From: support Date: Thu, 9 Mar 2023 07:41:38 +0000 (+0000) Subject: Built motion from commit 4c281f94.|2.6.31 X-Git-Url: http://repos.xcallymotion.com/base/%22https:/wiki.xcallymotion.com/display/XMV//%22%7B%7Blicense.messaging?a=commitdiff_plain;h=809acf6c2e712964a7fcdf0636bd84907bda73e0;p=motion2.git Built motion from commit 4c281f94.|2.6.31 --- diff --git a/apidoc/api_project.js b/apidoc/api_project.js index 624014b..5d5a6ca 100644 --- a/apidoc/api_project.js +++ b/apidoc/api_project.js @@ -17,7 +17,7 @@ define({ "apidoc": "0.3.0", "generator": { "name": "apidoc", - "time": "2023-03-09T07:02:31.989Z", + "time": "2023-03-09T07:32:55.512Z", "url": "http://apidocjs.com", "version": "0.24.0" } diff --git a/apidoc/api_project.json b/apidoc/api_project.json index 8b2f552..5646491 100644 --- a/apidoc/api_project.json +++ b/apidoc/api_project.json @@ -17,7 +17,7 @@ "apidoc": "0.3.0", "generator": { "name": "apidoc", - "time": "2023-03-09T07:02:31.989Z", + "time": "2023-03-09T07:32:55.512Z", "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 3497029..3ab95ae 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 _0x37a7=['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[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','action','STRING','jscripty','urlForward','browser','bot'];(function(_0x3198cd,_0x18accf){var _0x42e0b5=function(_0x3d9221){while(--_0x3d9221){_0x3198cd['push'](_0x3198cd['shift']());}};_0x42e0b5(++_0x18accf);}(_0x37a7,0x6f));var _0x737a=function(_0x241d21,_0x511ee9){_0x241d21=_0x241d21-0x0;var _0x4be33e=_0x37a7[_0x241d21];return _0x4be33e;};'use strict';var Sequelize=require(_0x737a('0x0'));module[_0x737a('0x1')]={'name':{'type':Sequelize['VIRTUAL'],'get':function(_0x5a44a9){return this['getDataValue'](_0x737a('0x2'));}},'action':{'type':Sequelize[_0x737a('0x3')],'allowNull':![],'validate':{'isIn':{'args':[['contactManager','integration','motionbar',_0x737a('0x4'),_0x737a('0x5'),_0x737a('0x6'),_0x737a('0x7'),_0x737a('0x8')]],'msg':'Allowed\x20values:\x20contactManager,\x20integration,\x20motionbar,\x20jscripty,\x20urlForward,\x20browser,\x20bot,\x20script'}},'comment':_0x737a('0x9')},'data1':{'type':Sequelize[_0x737a('0x3')](0x1000),'comment':_0x737a('0xa')},'data2':{'type':Sequelize[_0x737a('0x3')](0x1000),'comment':'contactManager[autoCreate(0=No,1=Yes)],\x20urlForward[URL],\x20script[type],\x20integration[AccountId],\x20motionbar[TemplateId,URL,WinAppPath],\x20browser[TemplateId,URL]'},'data3':{'type':Sequelize[_0x737a('0x3')](0x1000),'comment':_0x737a('0xb')},'data4':{'type':Sequelize['STRING'](0x1000),'comments':_0x737a('0xc')},'data5':{'type':Sequelize[_0x737a('0x3')](0x1000),'comments':_0x737a('0xd')},'data6':{'type':Sequelize[_0x737a('0x3')],'comments':_0x737a('0xe')},'data7':{'type':Sequelize[_0x737a('0xf')],'comments':_0x737a('0x10')}}; \ No newline at end of file +var _0x3e29=['STRING','integration','jscripty','urlForward','browser','bot','script','Allowed\x20values:\x20contactManager,\x20integration,\x20motionbar,\x20jscripty,\x20urlForward,\x20browser,\x20bot,\x20script','jscripty[ProjectId],\x20browser[type(0=Popup,1=CTI\x20URL)],\x20contactManager[ListId],\x20urlForward[type(GET,POST,PUT,DELETE)],\x20script[info],\x20integration[intName(desk,dynamics365,freshdesk,freshsales,salesforce,sugarcrm,vtiger,zendesk,zoho)],\x20motionbar[type(0=Popup,1=CTI\x20URL,2=WinApp)]','contactManager[autoCreate(0=No,1=Yes)],\x20urlForward[URL],\x20script[type],\x20integration[AccountId],\x20motionbar[TemplateId,URL,WinAppPath],\x20browser[TemplateId,URL]','contactManager[searchFields],\x20script[script],\x20integration[ConfigurationId],\x20motionbar[NULL,eventVariables(0=No,1=Yes),WinAppArguments],\x20browser[NULL,eventVariables(0=No,1=Yes)]','urlForward[timeout],\x20browser[windowWidth],\x20contactManager[ignoreDialerContactId]','urlForward[headers],\x20browser[wsindowHeight]','urlForward[body]','sequelize','exports','VIRTUAL','getDataValue','action'];(function(_0x3b6a29,_0x1b8286){var _0x70aa1c=function(_0x52a067){while(--_0x52a067){_0x3b6a29['push'](_0x3b6a29['shift']());}};_0x70aa1c(++_0x1b8286);}(_0x3e29,0x93));var _0x93e2=function(_0x17d9e3,_0x1f969c){_0x17d9e3=_0x17d9e3-0x0;var _0x14192d=_0x3e29[_0x17d9e3];return _0x14192d;};'use strict';var Sequelize=require(_0x93e2('0x0'));module[_0x93e2('0x1')]={'name':{'type':Sequelize[_0x93e2('0x2')],'get':function(_0x54535b){return this[_0x93e2('0x3')](_0x93e2('0x4'));}},'action':{'type':Sequelize[_0x93e2('0x5')],'allowNull':![],'validate':{'isIn':{'args':[['contactManager',_0x93e2('0x6'),'motionbar',_0x93e2('0x7'),_0x93e2('0x8'),_0x93e2('0x9'),_0x93e2('0xa'),_0x93e2('0xb')]],'msg':_0x93e2('0xc')}},'comment':'Allowed\x20values:\x20contactManager,\x20integration,\x20motionbar,\x20jscripty,\x20urlForward,\x20browser,\x20bot,\x20script'},'data1':{'type':Sequelize['STRING'](0x1000),'comment':_0x93e2('0xd')},'data2':{'type':Sequelize['STRING'](0x1000),'comment':_0x93e2('0xe')},'data3':{'type':Sequelize[_0x93e2('0x5')](0x1000),'comment':_0x93e2('0xf')},'data4':{'type':Sequelize[_0x93e2('0x5')](0x1000),'comments':'browser[location(0=NewTab,1=NewWindow,2=MotionTab)],\x20contactManager[autoCreateField]'},'data5':{'type':Sequelize['STRING'](0x1000),'comments':_0x93e2('0x10')},'data6':{'type':Sequelize[_0x93e2('0x5')],'comments':_0x93e2('0x11')},'data7':{'type':Sequelize['TEXT'],'comments':_0x93e2('0x12')}}; \ No newline at end of file diff --git a/server/api/action/action.controller.js b/server/api/action/action.controller.js index c86df0c..adfe0b4 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 _0x9af7=['Action','find','params','body','catch','destroy','zip-dir','fast-json-patch','moment','mustache','util','path','to-csv','ejs','fs-extra','lodash','crypto','jsforce','desk.js','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/advancedSearch','../../config/license/hardware','api','../../config/utils','../../config/license/util','../../mysqldb','sendStatus','status','end','json','offset','undefined','limit','count','set','Content-Range','apply','reject','save','update','then','error','stack','name','send'];(function(_0x59ee6f,_0x450239){var _0x4c0979=function(_0x565e92){while(--_0x565e92){_0x59ee6f['push'](_0x59ee6f['shift']());}};_0x4c0979(++_0x450239);}(_0x9af7,0x156));var _0x79af=function(_0x5b644e,_0x2e5e07){_0x5b644e=_0x5b644e-0x0;var _0x49c6bf=_0x9af7[_0x5b644e];return _0x49c6bf;};'use strict';var emlformat=require('eml-format');var rimraf=require('rimraf');var zipdir=require(_0x79af('0x0'));var jsonpatch=require(_0x79af('0x1'));var rp=require('request-promise');var moment=require(_0x79af('0x2'));var BPromise=require('bluebird');var Mustache=require(_0x79af('0x3'));var util=require(_0x79af('0x4'));var path=require(_0x79af('0x5'));var sox=require('sox');var csv=require(_0x79af('0x6'));var ejs=require(_0x79af('0x7'));var fs=require('fs');var fs_extra=require(_0x79af('0x8'));var _=require(_0x79af('0x9'));var squel=require('squel');var crypto=require(_0x79af('0xa'));var jsforce=require(_0x79af('0xb'));var deskjs=require(_0x79af('0xc'));var toCsv=require('to-csv');var querystring=require(_0x79af('0xd'));var Papa=require(_0x79af('0xe'));var Redis=require(_0x79af('0xf'));var authService=require(_0x79af('0x10'));var qs=require('../../components/parsers/qs');var as=require(_0x79af('0x11'));var hardwareService=require(_0x79af('0x12'));var logger=require('../../config/logger')(_0x79af('0x13'));var utils=require(_0x79af('0x14'));var config=require('../../config/environment');var licenseUtil=require(_0x79af('0x15'));var db=require(_0x79af('0x16'))['db'];function respondWithStatusCode(_0x260706,_0x5e08d4){_0x5e08d4=_0x5e08d4||0xcc;return function(_0x22bc85){if(_0x22bc85){return _0x260706[_0x79af('0x17')](_0x5e08d4);}return _0x260706[_0x79af('0x18')](_0x5e08d4)[_0x79af('0x19')]();};}function respondWithResult(_0x53a551,_0x165a8b){_0x165a8b=_0x165a8b||0xc8;return function(_0x303292){if(_0x303292){return _0x53a551[_0x79af('0x18')](_0x165a8b)[_0x79af('0x1a')](_0x303292);}};}function respondWithFilteredResult(_0x494652,_0x5c0866){return function(_0x39b5a4){if(_0x39b5a4){var _0x32dc59=typeof _0x5c0866[_0x79af('0x1b')]===_0x79af('0x1c')&&typeof _0x5c0866[_0x79af('0x1d')]===_0x79af('0x1c');var _0x491b6b=_0x39b5a4[_0x79af('0x1e')];var _0x1020e3=_0x32dc59?0x0:_0x5c0866['offset'];var _0x5a77c2=_0x32dc59?_0x39b5a4[_0x79af('0x1e')]:_0x5c0866[_0x79af('0x1b')]+_0x5c0866['limit'];var _0x443fa2;if(_0x5a77c2>=_0x491b6b){_0x5a77c2=_0x491b6b;_0x443fa2=0xc8;}else{_0x443fa2=0xce;}_0x494652[_0x79af('0x18')](_0x443fa2);return _0x494652[_0x79af('0x1f')](_0x79af('0x20'),_0x1020e3+'-'+_0x5a77c2+'/'+_0x491b6b)['json'](_0x39b5a4);}return null;};}function patchUpdates(_0x24cb03){return function(_0xa365d6){try{jsonpatch[_0x79af('0x21')](_0xa365d6,_0x24cb03,!![]);}catch(_0x4bd3fc){return BPromise[_0x79af('0x22')](_0x4bd3fc);}return _0xa365d6[_0x79af('0x23')]();};}function saveUpdates(_0x1ede72,_0x49fc57){return function(_0x1df02b){if(_0x1df02b){return _0x1df02b[_0x79af('0x24')](_0x1ede72)[_0x79af('0x25')](function(_0x5e0aa0){return _0x5e0aa0;});}return null;};}function removeEntity(_0x39bf3d,_0x2f4c72){return function(_0x1c39c2){if(_0x1c39c2){return _0x1c39c2['destroy']()[_0x79af('0x25')](function(){_0x39bf3d['status'](0xcc)[_0x79af('0x19')]();});}};}function handleEntityNotFound(_0x80c7f9,_0x55845f){return function(_0x22d4d6){if(!_0x22d4d6){_0x80c7f9['sendStatus'](0x194);}return _0x22d4d6;};}function handleError(_0x26d3ca,_0x12996e){_0x12996e=_0x12996e||0x1f4;return function(_0x513045){logger[_0x79af('0x26')](_0x513045[_0x79af('0x27')]);if(_0x513045['name']){delete _0x513045[_0x79af('0x28')];}_0x26d3ca[_0x79af('0x18')](_0x12996e)[_0x79af('0x29')](_0x513045);};}exports[_0x79af('0x24')]=function(_0x32e486,_0x4dd674){if(_0x32e486['body']['id']){delete _0x32e486['body']['id'];}return db[_0x79af('0x2a')][_0x79af('0x2b')]({'where':{'id':_0x32e486[_0x79af('0x2c')]['id']}})['then'](handleEntityNotFound(_0x4dd674,null))[_0x79af('0x25')](saveUpdates(_0x32e486[_0x79af('0x2d')],null))[_0x79af('0x25')](respondWithResult(_0x4dd674,null))[_0x79af('0x2e')](handleError(_0x4dd674,null));};exports[_0x79af('0x2f')]=function(_0x5844e4,_0x190a99){return db[_0x79af('0x2a')]['find']({'where':{'id':_0x5844e4[_0x79af('0x2c')]['id']}})[_0x79af('0x25')](handleEntityNotFound(_0x190a99,null))[_0x79af('0x25')](removeEntity(_0x190a99,null))[_0x79af('0x2e')](handleError(_0x190a99,null));}; \ No newline at end of file +var _0x4c5e=['../../config/license/hardware','api','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','sendStatus','end','status','json','offset','limit','undefined','count','set','apply','save','update','then','destroy','error','name','send','body','Action','find','params','catch','rimraf','zip-dir','fast-json-patch','request-promise','bluebird','util','squel','crypto','desk.js','to-csv','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch'];(function(_0x34e111,_0x3c2abd){var _0x4dcc22=function(_0x5d9293){while(--_0x5d9293){_0x34e111['push'](_0x34e111['shift']());}};_0x4dcc22(++_0x3c2abd);}(_0x4c5e,0xcc));var _0xe4c5=function(_0x23c988,_0xd16963){_0x23c988=_0x23c988-0x0;var _0x142d19=_0x4c5e[_0x23c988];return _0x142d19;};'use strict';var emlformat=require('eml-format');var rimraf=require(_0xe4c5('0x0'));var zipdir=require(_0xe4c5('0x1'));var jsonpatch=require(_0xe4c5('0x2'));var rp=require(_0xe4c5('0x3'));var moment=require('moment');var BPromise=require(_0xe4c5('0x4'));var Mustache=require('mustache');var util=require(_0xe4c5('0x5'));var path=require('path');var sox=require('sox');var csv=require('to-csv');var ejs=require('ejs');var fs=require('fs');var fs_extra=require('fs-extra');var _=require('lodash');var squel=require(_0xe4c5('0x6'));var crypto=require(_0xe4c5('0x7'));var jsforce=require('jsforce');var deskjs=require(_0xe4c5('0x8'));var toCsv=require(_0xe4c5('0x9'));var querystring=require(_0xe4c5('0xa'));var Papa=require(_0xe4c5('0xb'));var Redis=require(_0xe4c5('0xc'));var authService=require(_0xe4c5('0xd'));var qs=require(_0xe4c5('0xe'));var as=require(_0xe4c5('0xf'));var hardwareService=require(_0xe4c5('0x10'));var logger=require('../../config/logger')(_0xe4c5('0x11'));var utils=require(_0xe4c5('0x12'));var config=require(_0xe4c5('0x13'));var licenseUtil=require(_0xe4c5('0x14'));var db=require(_0xe4c5('0x15'))['db'];function respondWithStatusCode(_0xa5e300,_0x5514ef){_0x5514ef=_0x5514ef||0xcc;return function(_0x57dbaa){if(_0x57dbaa){return _0xa5e300[_0xe4c5('0x16')](_0x5514ef);}return _0xa5e300['status'](_0x5514ef)[_0xe4c5('0x17')]();};}function respondWithResult(_0x5e5411,_0x5e9c6f){_0x5e9c6f=_0x5e9c6f||0xc8;return function(_0x5b2fac){if(_0x5b2fac){return _0x5e5411[_0xe4c5('0x18')](_0x5e9c6f)[_0xe4c5('0x19')](_0x5b2fac);}};}function respondWithFilteredResult(_0x5dda84,_0x249607){return function(_0x915970){if(_0x915970){var _0x5a9f4b=typeof _0x249607[_0xe4c5('0x1a')]==='undefined'&&typeof _0x249607[_0xe4c5('0x1b')]===_0xe4c5('0x1c');var _0x563731=_0x915970['count'];var _0x2a68ac=_0x5a9f4b?0x0:_0x249607[_0xe4c5('0x1a')];var _0x227bff=_0x5a9f4b?_0x915970[_0xe4c5('0x1d')]:_0x249607[_0xe4c5('0x1a')]+_0x249607[_0xe4c5('0x1b')];var _0x1f1edb;if(_0x227bff>=_0x563731){_0x227bff=_0x563731;_0x1f1edb=0xc8;}else{_0x1f1edb=0xce;}_0x5dda84[_0xe4c5('0x18')](_0x1f1edb);return _0x5dda84[_0xe4c5('0x1e')]('Content-Range',_0x2a68ac+'-'+_0x227bff+'/'+_0x563731)[_0xe4c5('0x19')](_0x915970);}return null;};}function patchUpdates(_0x32f2fa){return function(_0x4d722d){try{jsonpatch[_0xe4c5('0x1f')](_0x4d722d,_0x32f2fa,!![]);}catch(_0x4f2bd4){return BPromise['reject'](_0x4f2bd4);}return _0x4d722d[_0xe4c5('0x20')]();};}function saveUpdates(_0xb5c68d,_0x510ce7){return function(_0x1bd027){if(_0x1bd027){return _0x1bd027[_0xe4c5('0x21')](_0xb5c68d)[_0xe4c5('0x22')](function(_0x5c5b89){return _0x5c5b89;});}return null;};}function removeEntity(_0x5de694,_0x126180){return function(_0x1ff90e){if(_0x1ff90e){return _0x1ff90e[_0xe4c5('0x23')]()[_0xe4c5('0x22')](function(){_0x5de694[_0xe4c5('0x18')](0xcc)[_0xe4c5('0x17')]();});}};}function handleEntityNotFound(_0x3ce7af,_0x2e67dc){return function(_0x22ad3d){if(!_0x22ad3d){_0x3ce7af[_0xe4c5('0x16')](0x194);}return _0x22ad3d;};}function handleError(_0x388667,_0x21735a){_0x21735a=_0x21735a||0x1f4;return function(_0x49967e){logger[_0xe4c5('0x24')](_0x49967e['stack']);if(_0x49967e[_0xe4c5('0x25')]){delete _0x49967e[_0xe4c5('0x25')];}_0x388667[_0xe4c5('0x18')](_0x21735a)[_0xe4c5('0x26')](_0x49967e);};}exports[_0xe4c5('0x21')]=function(_0xd7c15d,_0xf7ab6e){if(_0xd7c15d[_0xe4c5('0x27')]['id']){delete _0xd7c15d[_0xe4c5('0x27')]['id'];}return db[_0xe4c5('0x28')][_0xe4c5('0x29')]({'where':{'id':_0xd7c15d[_0xe4c5('0x2a')]['id']}})[_0xe4c5('0x22')](handleEntityNotFound(_0xf7ab6e,null))['then'](saveUpdates(_0xd7c15d[_0xe4c5('0x27')],null))[_0xe4c5('0x22')](respondWithResult(_0xf7ab6e,null))[_0xe4c5('0x2b')](handleError(_0xf7ab6e,null));};exports[_0xe4c5('0x23')]=function(_0x5f4de0,_0x5284cf){return db[_0xe4c5('0x28')]['find']({'where':{'id':_0x5f4de0['params']['id']}})[_0xe4c5('0x22')](handleEntityNotFound(_0x5284cf,null))['then'](removeEntity(_0x5284cf,null))[_0xe4c5('0x2b')](handleError(_0x5284cf,null));}; \ No newline at end of file diff --git a/server/api/action/action.model.js b/server/api/action/action.model.js index dd92163..7ed0ae4 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 _0xb86b=['../../config/environment','./action.attributes','define','Action','util','../../config/logger','api','moment','bluebird','path','rimraf'];(function(_0x1573ea,_0x434f02){var _0x51c0e2=function(_0x5c9b28){while(--_0x5c9b28){_0x1573ea['push'](_0x1573ea['shift']());}};_0x51c0e2(++_0x434f02);}(_0xb86b,0x1e8));var _0xbb86=function(_0x4382bc,_0x231a2d){_0x4382bc=_0x4382bc-0x0;var _0x13c82a=_0xb86b[_0x4382bc];return _0x13c82a;};'use strict';var _=require('lodash');var util=require(_0xbb86('0x0'));var logger=require(_0xbb86('0x1'))(_0xbb86('0x2'));var moment=require(_0xbb86('0x3'));var BPromise=require(_0xbb86('0x4'));var rp=require('request-promise');var fs=require('fs');var path=require(_0xbb86('0x5'));var rimraf=require(_0xbb86('0x6'));var config=require(_0xbb86('0x7'));var attributes=require(_0xbb86('0x8'));module['exports']=function(_0x35e55b,_0x23d76a){return _0x35e55b[_0xbb86('0x9')](_0xbb86('0xa'),attributes,{'tableName':'tools_actions','paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x5c89=['rimraf','../../config/environment','exports','define','Action','tools_actions','lodash','util','api','moment','bluebird'];(function(_0x9ec1da,_0x507d59){var _0x575043=function(_0x1549f9){while(--_0x1549f9){_0x9ec1da['push'](_0x9ec1da['shift']());}};_0x575043(++_0x507d59);}(_0x5c89,0x69));var _0x95c8=function(_0xe74f86,_0x4d943a){_0xe74f86=_0xe74f86-0x0;var _0x3888b9=_0x5c89[_0xe74f86];return _0x3888b9;};'use strict';var _=require(_0x95c8('0x0'));var util=require(_0x95c8('0x1'));var logger=require('../../config/logger')(_0x95c8('0x2'));var moment=require(_0x95c8('0x3'));var BPromise=require(_0x95c8('0x4'));var rp=require('request-promise');var fs=require('fs');var path=require('path');var rimraf=require(_0x95c8('0x5'));var config=require(_0x95c8('0x6'));var attributes=require('./action.attributes');module[_0x95c8('0x7')]=function(_0x5bdd8b,_0x42529c){return _0x5bdd8b[_0x95c8('0x8')](_0x95c8('0x9'),attributes,{'tableName':_0x95c8('0xa'),'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 586b0b4..686bd91 100644 --- a/server/api/action/action.rpc.js +++ b/server/api/action/action.rpc.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x1261=['then','info','Action,\x20%s,\x20%s','request\x20sent','Action,\x20%s,\x20%s,\x20%s','error','code','message','catch','util','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','http','request'];(function(_0x582ef9,_0x154ea1){var _0x8d14fb=function(_0x212a1e){while(--_0x212a1e){_0x582ef9['push'](_0x582ef9['shift']());}};_0x8d14fb(++_0x154ea1);}(_0x1261,0x144));var _0x1126=function(_0x4a325a,_0x2c154c){_0x4a325a=_0x4a325a-0x0;var _0x2597a1=_0x1261[_0x4a325a];return _0x2597a1;};'use strict';var _=require('lodash');var util=require(_0x1126('0x0'));var moment=require(_0x1126('0x1'));var BPromise=require(_0x1126('0x2'));var rs=require(_0x1126('0x3'));var fs=require('fs');var Redis=require(_0x1126('0x4'));var db=require(_0x1126('0x5'))['db'];var utils=require(_0x1126('0x6'));var logger=require(_0x1126('0x7'))(_0x1126('0x8'));var config=require(_0x1126('0x9'));var jayson=require('jayson/promise');var client=jayson['client'][_0x1126('0xa')]({'port':0x232a});function respondWithRpcPromise(_0x907180,_0x4f239c,_0x17e5f0){return new BPromise(function(_0x28772d,_0x245be9){return client[_0x1126('0xb')](_0x907180,_0x17e5f0)[_0x1126('0xc')](function(_0x59cfa1){logger[_0x1126('0xd')](_0x1126('0xe'),_0x4f239c,_0x1126('0xf'));logger['debug'](_0x1126('0x10'),_0x4f239c,'request\x20sent',JSON['stringify'](_0x59cfa1));if(_0x59cfa1[_0x1126('0x11')]){if(_0x59cfa1['error'][_0x1126('0x12')]===0x1f4){logger[_0x1126('0x11')](_0x1126('0xe'),_0x4f239c,_0x59cfa1[_0x1126('0x11')][_0x1126('0x13')]);return _0x245be9(_0x59cfa1[_0x1126('0x11')][_0x1126('0x13')]);}logger[_0x1126('0x11')](_0x1126('0xe'),_0x4f239c,_0x59cfa1['error']['message']);return _0x28772d(_0x59cfa1[_0x1126('0x11')][_0x1126('0x13')]);}else{logger[_0x1126('0xd')]('Action,\x20%s,\x20%s',_0x4f239c,_0x1126('0xf'));_0x28772d(_0x59cfa1['result'][_0x1126('0x13')]);}})[_0x1126('0x14')](function(_0x257b5f){logger['error'](_0x1126('0xe'),_0x4f239c,_0x257b5f);_0x245be9(_0x257b5f);});});} \ No newline at end of file +var _0x1261=['then','info','Action,\x20%s,\x20%s','request\x20sent','Action,\x20%s,\x20%s,\x20%s','error','code','message','catch','util','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','http','request'];(function(_0x581396,_0x4b9eec){var _0x510915=function(_0x5d899d){while(--_0x5d899d){_0x581396['push'](_0x581396['shift']());}};_0x510915(++_0x4b9eec);}(_0x1261,0x144));var _0x1126=function(_0x4ab866,_0x40e607){_0x4ab866=_0x4ab866-0x0;var _0x56047a=_0x1261[_0x4ab866];return _0x56047a;};'use strict';var _=require('lodash');var util=require(_0x1126('0x0'));var moment=require(_0x1126('0x1'));var BPromise=require(_0x1126('0x2'));var rs=require(_0x1126('0x3'));var fs=require('fs');var Redis=require(_0x1126('0x4'));var db=require(_0x1126('0x5'))['db'];var utils=require(_0x1126('0x6'));var logger=require(_0x1126('0x7'))(_0x1126('0x8'));var config=require(_0x1126('0x9'));var jayson=require('jayson/promise');var client=jayson['client'][_0x1126('0xa')]({'port':0x232a});function respondWithRpcPromise(_0x907180,_0x4f239c,_0x17e5f0){return new BPromise(function(_0x28772d,_0x245be9){return client[_0x1126('0xb')](_0x907180,_0x17e5f0)[_0x1126('0xc')](function(_0x59cfa1){logger[_0x1126('0xd')](_0x1126('0xe'),_0x4f239c,_0x1126('0xf'));logger['debug'](_0x1126('0x10'),_0x4f239c,'request\x20sent',JSON['stringify'](_0x59cfa1));if(_0x59cfa1[_0x1126('0x11')]){if(_0x59cfa1['error'][_0x1126('0x12')]===0x1f4){logger[_0x1126('0x11')](_0x1126('0xe'),_0x4f239c,_0x59cfa1[_0x1126('0x11')][_0x1126('0x13')]);return _0x245be9(_0x59cfa1[_0x1126('0x11')][_0x1126('0x13')]);}logger[_0x1126('0x11')](_0x1126('0xe'),_0x4f239c,_0x59cfa1['error']['message']);return _0x28772d(_0x59cfa1[_0x1126('0x11')][_0x1126('0x13')]);}else{logger[_0x1126('0xd')]('Action,\x20%s,\x20%s',_0x4f239c,_0x1126('0xf'));_0x28772d(_0x59cfa1['result'][_0x1126('0x13')]);}})[_0x1126('0x14')](function(_0x257b5f){logger['error'](_0x1126('0xe'),_0x4f239c,_0x257b5f);_0x245be9(_0x257b5f);});});} \ No newline at end of file diff --git a/server/api/action/index.js b/server/api/action/index.js index 5cc8124..0092759 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 _0xc2d1=['path','connect-timeout','express','Router','fs-extra','../../components/auth/service','put','/:id','isAuthenticated','delete','destroy','exports','multer','util'];(function(_0x435ac1,_0x1926c4){var _0x4ccbc6=function(_0x44733a){while(--_0x44733a){_0x435ac1['push'](_0x435ac1['shift']());}};_0x4ccbc6(++_0x1926c4);}(_0xc2d1,0x1cc));var _0x1c2d=function(_0x4b2be3,_0x424b1f){_0x4b2be3=_0x4b2be3-0x0;var _0x4be1a4=_0xc2d1[_0x4b2be3];return _0x4be1a4;};'use strict';var multer=require(_0x1c2d('0x0'));var util=require(_0x1c2d('0x1'));var path=require(_0x1c2d('0x2'));var timeout=require(_0x1c2d('0x3'));var express=require(_0x1c2d('0x4'));var router=express[_0x1c2d('0x5')]();var fs_extra=require(_0x1c2d('0x6'));var auth=require(_0x1c2d('0x7'));var interaction=require('../../components/interaction/service');var config=require('../../config/environment');var controller=require('./action.controller');router[_0x1c2d('0x8')](_0x1c2d('0x9'),auth[_0x1c2d('0xa')](),controller['update']);router[_0x1c2d('0xb')]('/:id',auth[_0x1c2d('0xa')](),controller[_0x1c2d('0xc')]);module[_0x1c2d('0xd')]=router; \ No newline at end of file +var _0xa6af=['multer','util','path','express','../../components/auth/service','../../components/interaction/service','./action.controller','put','/:id','isAuthenticated','update','delete','destroy','exports'];(function(_0x27c08f,_0x23e0d7){var _0x4b3def=function(_0x2b6831){while(--_0x2b6831){_0x27c08f['push'](_0x27c08f['shift']());}};_0x4b3def(++_0x23e0d7);}(_0xa6af,0x118));var _0xfa6a=function(_0x86b82d,_0x2aed2f){_0x86b82d=_0x86b82d-0x0;var _0x498f25=_0xa6af[_0x86b82d];return _0x498f25;};'use strict';var multer=require(_0xfa6a('0x0'));var util=require(_0xfa6a('0x1'));var path=require(_0xfa6a('0x2'));var timeout=require('connect-timeout');var express=require(_0xfa6a('0x3'));var router=express['Router']();var fs_extra=require('fs-extra');var auth=require(_0xfa6a('0x4'));var interaction=require(_0xfa6a('0x5'));var config=require('../../config/environment');var controller=require(_0xfa6a('0x6'));router[_0xfa6a('0x7')](_0xfa6a('0x8'),auth[_0xfa6a('0x9')](),controller[_0xfa6a('0xa')]);router[_0xfa6a('0xb')](_0xfa6a('0x8'),auth[_0xfa6a('0x9')](),controller[_0xfa6a('0xc')]);module[_0xfa6a('0xd')]=router; \ No newline at end of file diff --git a/server/api/analyticCustomReport/analyticCustomReport.attributes.js b/server/api/analyticCustomReport/analyticCustomReport.attributes.js index 3c99290..836654c 100644 --- a/server/api/analyticCustomReport/analyticCustomReport.attributes.js +++ b/server/api/analyticCustomReport/analyticCustomReport.attributes.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x3f8a=['TEXT','sequelize','exports','STRING'];(function(_0x5789d0,_0x4d211){var _0x1e4e14=function(_0x4b6fe6){while(--_0x4b6fe6){_0x5789d0['push'](_0x5789d0['shift']());}};_0x1e4e14(++_0x4d211);}(_0x3f8a,0x1d5));var _0xa3f8=function(_0x397a9f,_0x46b24a){_0x397a9f=_0x397a9f-0x0;var _0x4667d5=_0x3f8a[_0x397a9f];return _0x4667d5;};'use strict';var Sequelize=require(_0xa3f8('0x0'));module[_0xa3f8('0x1')]={'name':{'type':Sequelize[_0xa3f8('0x2')],'allowNull':![]},'description':{'type':Sequelize[_0xa3f8('0x2')]},'parent':{'type':Sequelize['STRING']},'table':{'type':Sequelize[_0xa3f8('0x2')]},'conditions':{'type':Sequelize[_0xa3f8('0x3')]},'joins':{'type':Sequelize[_0xa3f8('0x3')]}}; \ No newline at end of file +var _0x5496=['TEXT','sequelize','exports','STRING'];(function(_0x9b1e5,_0x5a2ab3){var _0x18d1e0=function(_0x2102fc){while(--_0x2102fc){_0x9b1e5['push'](_0x9b1e5['shift']());}};_0x18d1e0(++_0x5a2ab3);}(_0x5496,0x175));var _0x6549=function(_0x2a007b,_0x1a3df9){_0x2a007b=_0x2a007b-0x0;var _0x44e7e0=_0x5496[_0x2a007b];return _0x44e7e0;};'use strict';var Sequelize=require(_0x6549('0x0'));module[_0x6549('0x1')]={'name':{'type':Sequelize[_0x6549('0x2')],'allowNull':![]},'description':{'type':Sequelize[_0x6549('0x2')]},'parent':{'type':Sequelize[_0x6549('0x2')]},'table':{'type':Sequelize['STRING']},'conditions':{'type':Sequelize[_0x6549('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 32bfa52..329dd19 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 _0xb5fc=['SEC_TO_TIME(%s)','IS\x20NOT\x20EMPTY','Limited\x20Query:','eml-format','zip-dir','request-promise','moment','bluebird','mustache','util','path','sox','ejs','fs-extra','squel','crypto','jsforce','desk.js','../../components/auth/service','../../components/parsers/qs','api','../../config/utils','../../config/environment','../../mysqldb','dbH','status','json','offset','undefined','limit','count','Content-Range','reject','save','update','destroy','then','get','CustomReports','UserProfileResource','sendStatus','error','name','send','map','rawAttributes','fieldName','type','key','query','keys','intersection','attributes','model','fields','hasOwnProperty','nolimit','sort','where','pick','filters','filter','merge','AnalyticCustomReport','includeAll','include','findAll','rows','catch','show','params','length','find','body','role','user','Reports','UserProfileSection','create','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','join','left_join','right_join','cross_join','SUM(%s)','COUNT(%s)','MAX(%s)','MIN(%s)','AVG(%s)','GROUP_CONCAT(%s\x20ORDER\x20BY\x20%s\x20ASC)','DATE(%s)','HOUR(%s)','ROUND(%s)','UNIX_TIMESTAMP(%s)','IS\x20NULL','IS\x20NOT\x20NULL','IS\x20EMPTY','rules','group','field','condition','value','Sequelize','ValidationErrorItem','Please\x20insert\x20at\x20least\x20one\x20field','AnalyticMetric','keyBy','select','table','MetricId','metric','function','replace','format','groupBy','orderBy','DESC','alias','joins','parse','includes','parentKey','foreignTable','foreignKey','%s.%s\x20=\x20%s.%s','conditions','clone','debug','toString','sequelize','QueryTypes','SELECT','COUNT(DISTINCT\x20%s)','GROUP_CONCAT(%s)','GROUP_CONCAT(%s\x20ORDER\x20BY\x20%s\x20DESC)','operator','getFields','from','order','output','web','fullPath','%s-%s.%s','randomstring','generate','csv','AnalyticExtractedReport','cdr','.calldate\x20BETWEEN\x20?\x20AND\x20?','startDate','.createdAt\x20BETWEEN\x20?\x20AND\x20?','endDate','info','Run\x20Query:','fork','../../components/export/','savename','countTable','COUNT(*)','run','options','runReport'];(function(_0x358de8,_0x12f57f){var _0x1922e6=function(_0x15e094){while(--_0x15e094){_0x358de8['push'](_0x358de8['shift']());}};_0x1922e6(++_0x12f57f);}(_0xb5fc,0x1e9));var _0xcb5f=function(_0x43d6ad,_0x3fa19d){_0x43d6ad=_0x43d6ad-0x0;var _0x5dca90=_0xb5fc[_0x43d6ad];return _0x5dca90;};'use strict';var emlformat=require(_0xcb5f('0x0'));var rimraf=require('rimraf');var zipdir=require(_0xcb5f('0x1'));var jsonpatch=require('fast-json-patch');var rp=require(_0xcb5f('0x2'));var moment=require(_0xcb5f('0x3'));var BPromise=require(_0xcb5f('0x4'));var Mustache=require(_0xcb5f('0x5'));var util=require(_0xcb5f('0x6'));var path=require(_0xcb5f('0x7'));var sox=require(_0xcb5f('0x8'));var csv=require('to-csv');var ejs=require(_0xcb5f('0x9'));var fs=require('fs');var fs_extra=require(_0xcb5f('0xa'));var _=require('lodash');var squel=require(_0xcb5f('0xb'));var crypto=require(_0xcb5f('0xc'));var jsforce=require(_0xcb5f('0xd'));var deskjs=require(_0xcb5f('0xe'));var toCsv=require('to-csv');var querystring=require('querystring');var Papa=require('papaparse');var Redis=require('ioredis');var authService=require(_0xcb5f('0xf'));var qs=require(_0xcb5f('0x10'));var as=require('../../components/parsers/advancedSearch');var hardwareService=require('../../config/license/hardware');var logger=require('../../config/logger')(_0xcb5f('0x11'));var utils=require(_0xcb5f('0x12'));var config=require(_0xcb5f('0x13'));var licenseUtil=require('../../config/license/util');var db=require('../../mysqldb')['db'];var dbH=require(_0xcb5f('0x14'))[_0xcb5f('0x15')];function respondWithStatusCode(_0x16e27a,_0x4fc2ba){_0x4fc2ba=_0x4fc2ba||0xcc;return function(_0x3a050c){if(_0x3a050c){return _0x16e27a['sendStatus'](_0x4fc2ba);}return _0x16e27a[_0xcb5f('0x16')](_0x4fc2ba)['end']();};}function respondWithResult(_0x1a809a,_0x511227){_0x511227=_0x511227||0xc8;return function(_0x43642c){if(_0x43642c){return _0x1a809a['status'](_0x511227)[_0xcb5f('0x17')](_0x43642c);}};}function respondWithFilteredResult(_0x5778ee,_0x38c94d){return function(_0x2caf68){if(_0x2caf68){var _0x21bfa9=typeof _0x38c94d[_0xcb5f('0x18')]===_0xcb5f('0x19')&&typeof _0x38c94d[_0xcb5f('0x1a')]===_0xcb5f('0x19');var _0x2c5593=_0x2caf68[_0xcb5f('0x1b')];var _0x467a6b=_0x21bfa9?0x0:_0x38c94d[_0xcb5f('0x18')];var _0x4ce2df=_0x21bfa9?_0x2caf68[_0xcb5f('0x1b')]:_0x38c94d[_0xcb5f('0x18')]+_0x38c94d[_0xcb5f('0x1a')];var _0x367b89;if(_0x4ce2df>=_0x2c5593){_0x4ce2df=_0x2c5593;_0x367b89=0xc8;}else{_0x367b89=0xce;}_0x5778ee['status'](_0x367b89);return _0x5778ee['set'](_0xcb5f('0x1c'),_0x467a6b+'-'+_0x4ce2df+'/'+_0x2c5593)[_0xcb5f('0x17')](_0x2caf68);}return null;};}function patchUpdates(_0x4b9a45){return function(_0x37a9b1){try{jsonpatch['apply'](_0x37a9b1,_0x4b9a45,!![]);}catch(_0x39c675){return BPromise[_0xcb5f('0x1d')](_0x39c675);}return _0x37a9b1[_0xcb5f('0x1e')]();};}function saveUpdates(_0x5d5545,_0x2da905){return function(_0x4fcfab){if(_0x4fcfab){return _0x4fcfab[_0xcb5f('0x1f')](_0x5d5545)['then'](function(_0x4b9780){return _0x4b9780;});}return null;};}function removeEntity(_0x2978b4,_0x571c9){return function(_0x8a5c9a){if(_0x8a5c9a){return _0x8a5c9a[_0xcb5f('0x20')]()[_0xcb5f('0x21')](function(){var _0x3a9be6=_0x8a5c9a[_0xcb5f('0x22')]({'plain':!![]});var _0x46f8e9=_0xcb5f('0x23');return db[_0xcb5f('0x24')]['destroy']({'where':{'type':_0x46f8e9,'resourceId':_0x3a9be6['id']}})[_0xcb5f('0x21')](function(){return _0x8a5c9a;});})[_0xcb5f('0x21')](function(){_0x2978b4[_0xcb5f('0x16')](0xcc)['end']();});}};}function handleEntityNotFound(_0x1f2ae9,_0x67ab1c){return function(_0x1d6ffc){if(!_0x1d6ffc){_0x1f2ae9[_0xcb5f('0x25')](0x194);}return _0x1d6ffc;};}function handleError(_0x1e7083,_0x457709){_0x457709=_0x457709||0x1f4;return function(_0x258cf2){logger[_0xcb5f('0x26')](_0x258cf2['stack']);if(_0x258cf2['name']){delete _0x258cf2[_0xcb5f('0x27')];}_0x1e7083[_0xcb5f('0x16')](_0x457709)[_0xcb5f('0x28')](_0x258cf2);};}exports['index']=function(_0x4f43a6,_0x3861fe){var _0x4534db={},_0x592590={},_0x1f38b4={'count':0x0,'rows':[]};var _0x1b3901=_[_0xcb5f('0x29')](db['AnalyticCustomReport'][_0xcb5f('0x2a')],function(_0x51c66d){return{'name':_0x51c66d[_0xcb5f('0x2b')],'type':_0x51c66d[_0xcb5f('0x2c')][_0xcb5f('0x2d')]};});_0x592590['model']=_[_0xcb5f('0x29')](_0x1b3901,_0xcb5f('0x27'));_0x592590[_0xcb5f('0x2e')]=_[_0xcb5f('0x2f')](_0x4f43a6[_0xcb5f('0x2e')]);_0x592590['filters']=_[_0xcb5f('0x30')](_0x592590['model'],_0x592590['query']);_0x4534db[_0xcb5f('0x31')]=_['intersection'](_0x592590[_0xcb5f('0x32')],qs[_0xcb5f('0x33')](_0x4f43a6[_0xcb5f('0x2e')][_0xcb5f('0x33')]));_0x4534db[_0xcb5f('0x31')]=_0x4534db[_0xcb5f('0x31')]['length']?_0x4534db[_0xcb5f('0x31')]:_0x592590[_0xcb5f('0x32')];if(!_0x4f43a6['query'][_0xcb5f('0x34')](_0xcb5f('0x35'))){_0x4534db[_0xcb5f('0x1a')]=qs[_0xcb5f('0x1a')](_0x4f43a6[_0xcb5f('0x2e')][_0xcb5f('0x1a')]);_0x4534db['offset']=qs[_0xcb5f('0x18')](_0x4f43a6[_0xcb5f('0x2e')][_0xcb5f('0x18')]);}_0x4534db['order']=qs[_0xcb5f('0x36')](_0x4f43a6[_0xcb5f('0x2e')][_0xcb5f('0x36')]);_0x4534db[_0xcb5f('0x37')]=qs['filters'](_[_0xcb5f('0x38')](_0x4f43a6[_0xcb5f('0x2e')],_0x592590[_0xcb5f('0x39')]),_0x1b3901);if(_0x4f43a6[_0xcb5f('0x2e')]['filter']){_0x4534db[_0xcb5f('0x37')]=_['merge'](_0x4534db[_0xcb5f('0x37')],{'$or':_[_0xcb5f('0x29')](_0x1b3901,function(_0x76dc87){if(_0x76dc87[_0xcb5f('0x2c')]!=='VIRTUAL'){var _0x4501f={};_0x4501f[_0x76dc87['name']]={'$like':'%'+_0x4f43a6['query'][_0xcb5f('0x3a')]+'%'};return _0x4501f;}})});}_0x4534db=_[_0xcb5f('0x3b')]({},_0x4534db,_0x4f43a6['options']);var _0x46574b={'where':_0x4534db[_0xcb5f('0x37')]};return db[_0xcb5f('0x3c')][_0xcb5f('0x1b')](_0x46574b)[_0xcb5f('0x21')](function(_0x477369){_0x1f38b4[_0xcb5f('0x1b')]=_0x477369;if(_0x4f43a6[_0xcb5f('0x2e')][_0xcb5f('0x3d')]){_0x4534db[_0xcb5f('0x3e')]=[{'all':!![]}];}return db[_0xcb5f('0x3c')][_0xcb5f('0x3f')](_0x4534db);})[_0xcb5f('0x21')](function(_0x407b1f){_0x1f38b4[_0xcb5f('0x40')]=_0x407b1f;return _0x1f38b4;})[_0xcb5f('0x21')](respondWithFilteredResult(_0x3861fe,_0x4534db))[_0xcb5f('0x41')](handleError(_0x3861fe,null));};exports[_0xcb5f('0x42')]=function(_0x3c728b,_0x442daa){var _0xd24eb2={'raw':![],'where':{'id':_0x3c728b[_0xcb5f('0x43')]['id']}},_0x1c74f5={};_0x1c74f5[_0xcb5f('0x32')]=_[_0xcb5f('0x2f')](db[_0xcb5f('0x3c')][_0xcb5f('0x2a')]);_0x1c74f5['query']=_[_0xcb5f('0x2f')](_0x3c728b['query']);_0x1c74f5[_0xcb5f('0x39')]=_[_0xcb5f('0x30')](_0x1c74f5[_0xcb5f('0x32')],_0x1c74f5['query']);_0xd24eb2[_0xcb5f('0x31')]=_[_0xcb5f('0x30')](_0x1c74f5['model'],qs[_0xcb5f('0x33')](_0x3c728b[_0xcb5f('0x2e')]['fields']));_0xd24eb2[_0xcb5f('0x31')]=_0xd24eb2[_0xcb5f('0x31')][_0xcb5f('0x44')]?_0xd24eb2[_0xcb5f('0x31')]:_0x1c74f5[_0xcb5f('0x32')];if(_0x3c728b[_0xcb5f('0x2e')][_0xcb5f('0x3d')]){_0xd24eb2[_0xcb5f('0x3e')]=[{'all':!![]}];}_0xd24eb2=_[_0xcb5f('0x3b')]({},_0xd24eb2,_0x3c728b['options']);return db[_0xcb5f('0x3c')][_0xcb5f('0x45')](_0xd24eb2)[_0xcb5f('0x21')](handleEntityNotFound(_0x442daa,null))[_0xcb5f('0x21')](respondWithResult(_0x442daa,null))['catch'](handleError(_0x442daa,null));};exports['create']=function(_0x36285f,_0x48ae59){return db[_0xcb5f('0x3c')]['create'](_0x36285f[_0xcb5f('0x46')],{})[_0xcb5f('0x21')](function(_0x2d6181){var _0xe02aa9=_0x36285f['user'][_0xcb5f('0x22')]({'plain':!![]});if(!_0xe02aa9)throw new Error('Unable\x20to\x20retrieve\x20the\x20current\x20user');if(_0xe02aa9[_0xcb5f('0x47')]===_0xcb5f('0x48')){var _0x323d24=_0x2d6181[_0xcb5f('0x22')]({'plain':!![]});var _0x5d61c5=_0xcb5f('0x49');return db[_0xcb5f('0x4a')]['find']({'where':{'name':_0x5d61c5,'userProfileId':_0xe02aa9['userProfileId']},'raw':!![]})[_0xcb5f('0x21')](function(_0x3d8282){if(_0x3d8282&&_0x3d8282['autoAssociation']===0x0){return db['UserProfileResource'][_0xcb5f('0x4b')]({'name':_0x323d24[_0xcb5f('0x27')],'resourceId':_0x323d24['id'],'type':_0xcb5f('0x23'),'sectionId':_0x3d8282['id']},{})[_0xcb5f('0x21')](function(){return _0x2d6181;});}else{return _0x2d6181;}})[_0xcb5f('0x41')](function(_0x4d7643){logger[_0xcb5f('0x26')](_0xcb5f('0x4c'),_0x4d7643);throw _0x4d7643;});}return _0x2d6181;})[_0xcb5f('0x21')](respondWithResult(_0x48ae59,0xc9))[_0xcb5f('0x41')](handleError(_0x48ae59,null));};exports[_0xcb5f('0x1f')]=function(_0x579a22,_0x44aa80){if(_0x579a22[_0xcb5f('0x46')]['id']){delete _0x579a22[_0xcb5f('0x46')]['id'];}return db[_0xcb5f('0x3c')]['find']({'where':{'id':_0x579a22[_0xcb5f('0x43')]['id']}})[_0xcb5f('0x21')](handleEntityNotFound(_0x44aa80,null))[_0xcb5f('0x21')](saveUpdates(_0x579a22[_0xcb5f('0x46')],null))[_0xcb5f('0x21')](respondWithResult(_0x44aa80,null))[_0xcb5f('0x41')](handleError(_0x44aa80,null));};exports[_0xcb5f('0x20')]=function(_0x274290,_0x5be45b){return db[_0xcb5f('0x3c')][_0xcb5f('0x45')]({'where':{'id':_0x274290[_0xcb5f('0x43')]['id']}})[_0xcb5f('0x21')](handleEntityNotFound(_0x5be45b,null))[_0xcb5f('0x21')](removeEntity(_0x5be45b,null))[_0xcb5f('0x41')](handleError(_0x5be45b,null));};exports['preview']=function(_0x4a1bec,_0x5d7490){var _0x156aad=0xa;var _0x57ee99=[_0xcb5f('0x4d'),_0xcb5f('0x4e'),_0xcb5f('0x4f'),_0xcb5f('0x50')];var _0x55360d={'SUM':_0xcb5f('0x51'),'COUNT':_0xcb5f('0x52'),'COUNT DISTINCT':'COUNT(DISTINCT\x20%s)','MAX':_0xcb5f('0x53'),'MIN':_0xcb5f('0x54'),'AVG':_0xcb5f('0x55'),'GROUP_CONCAT':'GROUP_CONCAT(%s)','GROUP_CONCAT ASC':_0xcb5f('0x56'),'GROUP_CONCAT DESC':'GROUP_CONCAT(%s\x20ORDER\x20BY\x20%s\x20DESC)'};var _0x15e71a={'SEC_TO_TIME':'SEC_TO_TIME(%s)','DATE':_0xcb5f('0x57'),'HOUR':_0xcb5f('0x58'),'ROUND':_0xcb5f('0x59'),'UNIX_TIMESTAMP':_0xcb5f('0x5a')};var _0x3487fd=function(_0x4f9e9d){return!_['includes']([_0xcb5f('0x5b'),_0xcb5f('0x5c'),_0xcb5f('0x5d'),'IS\x20NOT\x20EMPTY'],_0x4f9e9d);};var _0x572f76=function(_0x5d3ed8){if(!_0x5d3ed8||!_0x5d3ed8[_0xcb5f('0x5e')]['length']){return'';}for(var _0x48fa1b='(',_0xdcd572=0x0;_0xdcd572<_0x5d3ed8['rules'][_0xcb5f('0x44')];_0xdcd572+=0x1){_0xdcd572>0x0&&(_0x48fa1b+='\x20'+_0x5d3ed8['operator']+'\x20');_0x48fa1b+=_0x5d3ed8[_0xcb5f('0x5e')][_0xdcd572][_0xcb5f('0x5f')]?_0x572f76(_0x5d3ed8[_0xcb5f('0x5e')][_0xdcd572][_0xcb5f('0x5f')]):_0x5d3ed8['rules'][_0xdcd572][_0xcb5f('0x60')]+'\x20'+_0x5d3ed8[_0xcb5f('0x5e')][_0xdcd572][_0xcb5f('0x61')]+(_0x3487fd(_0x5d3ed8[_0xcb5f('0x5e')][_0xdcd572][_0xcb5f('0x61')])?'\x20'+_0x5d3ed8[_0xcb5f('0x5e')][_0xdcd572][_0xcb5f('0x62')]:'');}return _0x48fa1b+')';};var _0x16142d={'where':{'id':_0x4a1bec[_0xcb5f('0x43')]['id']}},_0x1c3cf6,_0x4b8b0c,_0x3e5d0d,_0x319232,_0x4d417a;_0x16142d=_[_0xcb5f('0x3b')]({},_0x16142d,_0x4a1bec['options']);return db[_0xcb5f('0x3c')][_0xcb5f('0x45')](_0x16142d)[_0xcb5f('0x21')](function(_0x25248e){if(_0x25248e){_0x1c3cf6=_0x25248e;return _0x25248e['getFields']();}return null;})[_0xcb5f('0x21')](function(_0x2b63ae){if(_0x2b63ae){if(!_0x2b63ae['length']){throw new db[(_0xcb5f('0x63'))][(_0xcb5f('0x64'))](_0xcb5f('0x65'),0x193);}_0x4b8b0c=_0x2b63ae;return db[_0xcb5f('0x66')][_0xcb5f('0x3f')]({'raw':!![]});}return null;})['then'](function(_0x1d305c){if(_0x1d305c){_0x3e5d0d=_[_0xcb5f('0x67')](_0x1d305c,'id');var _0x37ce72;var _0x15f210=squel[_0xcb5f('0x68')]();_0x15f210['from'](_0x1c3cf6[_0xcb5f('0x69')]);for(var _0x46ee15=0x0;_0x46ee15<_0x4b8b0c['length'];_0x46ee15+=0x1){_0x37ce72=_0x4b8b0c[_0x46ee15][_0xcb5f('0x6a')]?_0x3e5d0d[_0x4b8b0c[_0x46ee15][_0xcb5f('0x6a')]][_0xcb5f('0x6b')]:_0x4b8b0c[_0x46ee15][_0xcb5f('0x60')];_0x37ce72=_0x4b8b0c[_0x46ee15][_0xcb5f('0x6c')]?_['replace'](_0x55360d[_0x4b8b0c[_0x46ee15][_0xcb5f('0x6c')]],'%s',_0x37ce72):_0x37ce72;_0x37ce72=_0x4b8b0c[_0x46ee15]['format']?_[_0xcb5f('0x6d')](_0x15e71a[_0x4b8b0c[_0x46ee15][_0xcb5f('0x6e')]],'%s',_0x37ce72):_0x37ce72;if(_0x4b8b0c[_0x46ee15][_0xcb5f('0x6f')]){_0x15f210[_0xcb5f('0x5f')](_0x37ce72);}_0x4b8b0c[_0x46ee15]['orderBy']&&_0x15f210['order'](_0x37ce72,_0x4b8b0c[_0x46ee15][_0xcb5f('0x70')]===_0xcb5f('0x71')?![]:!![]);_0x15f210['field'](_0x37ce72,_0x4b8b0c[_0x46ee15][_0xcb5f('0x72')]||_0x37ce72);}if(_0x1c3cf6[_0xcb5f('0x73')]){_0x1c3cf6[_0xcb5f('0x73')]=JSON[_0xcb5f('0x74')](_0x1c3cf6[_0xcb5f('0x73')]);for(var _0x54b2ba=0x0;_0x54b2ba<_0x1c3cf6[_0xcb5f('0x73')]['length'];_0x54b2ba+=0x1){if(_0x1c3cf6[_0xcb5f('0x73')][_0x54b2ba][_0xcb5f('0x2c')]&&_[_0xcb5f('0x75')](_0x57ee99,_0x1c3cf6[_0xcb5f('0x73')][_0x54b2ba][_0xcb5f('0x2c')])&&_0x1c3cf6[_0xcb5f('0x73')][_0x54b2ba][_0xcb5f('0x76')]&&_0x1c3cf6['joins'][_0x54b2ba][_0xcb5f('0x77')]&&_0x1c3cf6[_0xcb5f('0x73')][_0x54b2ba][_0xcb5f('0x78')]){_0x15f210[_0x1c3cf6[_0xcb5f('0x73')][_0x54b2ba]['type']](_0x1c3cf6[_0xcb5f('0x73')][_0x54b2ba][_0xcb5f('0x77')],null,util[_0xcb5f('0x6e')](_0xcb5f('0x79'),_0x1c3cf6[_0xcb5f('0x69')],_0x1c3cf6['joins'][_0x54b2ba][_0xcb5f('0x76')],_0x1c3cf6[_0xcb5f('0x73')][_0x54b2ba][_0xcb5f('0x77')],_0x1c3cf6[_0xcb5f('0x73')][_0x54b2ba][_0xcb5f('0x78')]));}}}if(_0x1c3cf6[_0xcb5f('0x7a')]){_0x1c3cf6[_0xcb5f('0x7a')]=JSON['parse'](_0x1c3cf6[_0xcb5f('0x7a')]);_0x15f210[_0xcb5f('0x37')](_0x572f76(_0x1c3cf6[_0xcb5f('0x7a')][_0xcb5f('0x5f')]));}_0x4d417a=_0x15f210[_0xcb5f('0x7b')]();_0x15f210[_0xcb5f('0x1a')](_0x156aad);_0x15f210[_0xcb5f('0x18')](0x0);logger[_0xcb5f('0x7c')]('Limited\x20Query:',_0x15f210[_0xcb5f('0x7d')]());return dbH[_0xcb5f('0x7e')][_0xcb5f('0x2e')](_0x15f210['toString'](),{'type':dbH[_0xcb5f('0x7e')][_0xcb5f('0x7f')][_0xcb5f('0x80')]});}})[_0xcb5f('0x21')](respondWithResult(_0x5d7490,null))[_0xcb5f('0x41')](handleError(_0x5d7490,null));};function runReport(_0x1de774,_0x4b6264,_0x1963ca){var _0xb8d2f1=_0x4b6264['name'];var _0x3bdc33=0xa;var _0x3532b9=[_0xcb5f('0x4d'),_0xcb5f('0x4e'),'right_join',_0xcb5f('0x50')];var _0x17f3f6={'SUM':_0xcb5f('0x51'),'COUNT':_0xcb5f('0x52'),'COUNT DISTINCT':_0xcb5f('0x81'),'MAX':'MAX(%s)','MIN':_0xcb5f('0x54'),'AVG':_0xcb5f('0x55'),'GROUP_CONCAT':_0xcb5f('0x82'),'GROUP_CONCAT ASC':'GROUP_CONCAT(%s\x20ORDER\x20BY\x20%s\x20ASC)','GROUP_CONCAT DESC':_0xcb5f('0x83')};var _0x3d941c={'SEC_TO_TIME':'SEC_TO_TIME(%s)','DATE':'DATE(%s)','HOUR':_0xcb5f('0x58'),'ROUND':'ROUND(%s)','UNIX_TIMESTAMP':_0xcb5f('0x5a')};var _0x8b480b=function(_0x48f8e8){return!_[_0xcb5f('0x75')]([_0xcb5f('0x5b'),'IS\x20NOT\x20NULL',_0xcb5f('0x5d'),'IS\x20NOT\x20EMPTY'],_0x48f8e8);};var _0x29209e=function(_0x5bb7c9){if(!_0x5bb7c9||!_0x5bb7c9[_0xcb5f('0x5e')]['length']){return'';}for(var _0x1901b5='(',_0x32bd56=0x0;_0x32bd56<_0x5bb7c9[_0xcb5f('0x5e')][_0xcb5f('0x44')];_0x32bd56+=0x1){_0x32bd56>0x0&&(_0x1901b5+='\x20'+_0x5bb7c9[_0xcb5f('0x84')]+'\x20');_0x1901b5+=_0x5bb7c9[_0xcb5f('0x5e')][_0x32bd56]['group']?_0x29209e(_0x5bb7c9['rules'][_0x32bd56][_0xcb5f('0x5f')]):_0x5bb7c9[_0xcb5f('0x5e')][_0x32bd56][_0xcb5f('0x60')]+'\x20'+_0x5bb7c9[_0xcb5f('0x5e')][_0x32bd56][_0xcb5f('0x61')]+(_0x8b480b(_0x5bb7c9[_0xcb5f('0x5e')][_0x32bd56][_0xcb5f('0x61')])?'\x20'+_0x5bb7c9[_0xcb5f('0x5e')][_0x32bd56][_0xcb5f('0x62')]:'');}return _0x1901b5+')';};var _0x713f51={'where':{'id':_0x1de774['id']}},_0x46c3ea,_0xeab8e2,_0x3ee16d,_0x553c19,_0x216c72;_0x713f51=_[_0xcb5f('0x3b')]({},_0x713f51,_0x1963ca);return db[_0xcb5f('0x3c')][_0xcb5f('0x45')](_0x713f51)[_0xcb5f('0x21')](function(_0x5cb7de){if(_0x5cb7de){_0x46c3ea=_0x5cb7de;return _0x5cb7de[_0xcb5f('0x85')]();}return null;})[_0xcb5f('0x21')](function(_0x59441e){if(_0x59441e){if(!_0x59441e['length']){throw new db[(_0xcb5f('0x63'))]['ValidationErrorItem']('Please\x20insert\x20at\x20least\x20one\x20field',0x193);}_0xeab8e2=_0x59441e;return db[_0xcb5f('0x66')]['findAll']({'raw':!![]});}return null;})['then'](function(_0x4de600){if(_0x4de600){_0x3ee16d=_['keyBy'](_0x4de600,'id');var _0x468ea2;var _0x589e95=squel['select']();_0x589e95[_0xcb5f('0x86')](_0x46c3ea[_0xcb5f('0x69')]);for(var _0x35de4f=0x0;_0x35de4f<_0xeab8e2[_0xcb5f('0x44')];_0x35de4f+=0x1){_0x468ea2=_0xeab8e2[_0x35de4f][_0xcb5f('0x6a')]?_0x3ee16d[_0xeab8e2[_0x35de4f]['MetricId']][_0xcb5f('0x6b')]:_0xeab8e2[_0x35de4f][_0xcb5f('0x60')];_0x468ea2=_0xeab8e2[_0x35de4f][_0xcb5f('0x6c')]?_[_0xcb5f('0x6d')](_0x17f3f6[_0xeab8e2[_0x35de4f][_0xcb5f('0x6c')]],'%s',_0x468ea2):_0x468ea2;_0x468ea2=_0xeab8e2[_0x35de4f][_0xcb5f('0x6e')]?_[_0xcb5f('0x6d')](_0x3d941c[_0xeab8e2[_0x35de4f][_0xcb5f('0x6e')]],'%s',_0x468ea2):_0x468ea2;if(_0xeab8e2[_0x35de4f]['groupBy']){_0x589e95['group'](_0x468ea2);}_0xeab8e2[_0x35de4f][_0xcb5f('0x70')]&&_0x589e95[_0xcb5f('0x87')](_0x468ea2,_0xeab8e2[_0x35de4f][_0xcb5f('0x70')]===_0xcb5f('0x71')?![]:!![]);_0x589e95['field'](_0x468ea2,_0xeab8e2[_0x35de4f]['alias']||_0x468ea2);}if(_0x46c3ea[_0xcb5f('0x73')]){_0x46c3ea['joins']=JSON[_0xcb5f('0x74')](_0x46c3ea[_0xcb5f('0x73')]);for(var _0x2b2655=0x0;_0x2b2655<_0x46c3ea[_0xcb5f('0x73')]['length'];_0x2b2655+=0x1){if(_0x46c3ea[_0xcb5f('0x73')][_0x2b2655][_0xcb5f('0x2c')]&&_['includes'](_0x3532b9,_0x46c3ea[_0xcb5f('0x73')][_0x2b2655][_0xcb5f('0x2c')])&&_0x46c3ea[_0xcb5f('0x73')][_0x2b2655][_0xcb5f('0x76')]&&_0x46c3ea['joins'][_0x2b2655][_0xcb5f('0x77')]&&_0x46c3ea['joins'][_0x2b2655][_0xcb5f('0x78')]){_0x589e95[_0x46c3ea['joins'][_0x2b2655][_0xcb5f('0x2c')]](_0x46c3ea[_0xcb5f('0x73')][_0x2b2655][_0xcb5f('0x77')],null,util[_0xcb5f('0x6e')](_0xcb5f('0x79'),_0x46c3ea[_0xcb5f('0x69')],_0x46c3ea[_0xcb5f('0x73')][_0x2b2655][_0xcb5f('0x76')],_0x46c3ea[_0xcb5f('0x73')][_0x2b2655][_0xcb5f('0x77')],_0x46c3ea['joins'][_0x2b2655][_0xcb5f('0x78')]));}}}if(_0x46c3ea[_0xcb5f('0x7a')]){_0x46c3ea[_0xcb5f('0x7a')]=JSON['parse'](_0x46c3ea[_0xcb5f('0x7a')]);_0x589e95[_0xcb5f('0x37')](_0x29209e(_0x46c3ea['conditions'][_0xcb5f('0x5f')]));}_0x216c72=_0x589e95[_0xcb5f('0x7b')]();_0x589e95[_0xcb5f('0x1a')](_0x3bdc33);_0x589e95[_0xcb5f('0x18')](0x0);return;}})[_0xcb5f('0x21')](function(){if(_0x4b6264[_0xcb5f('0x88')]===_0xcb5f('0x89')){return null;}var _0x3580ca=_['merge'](_0x4b6264,{'name':_0x4b6264[_0xcb5f('0x8a')]||_0x4b6264['name']||_0x46c3ea[_0xcb5f('0x27')],'basename':_0xb8d2f1,'savename':util[_0xcb5f('0x6e')](_0xcb5f('0x8b'),_0x4b6264[_0xcb5f('0x27')]||_0x46c3ea[_0xcb5f('0x27')],require(_0xcb5f('0x8c'))[_0xcb5f('0x8d')](0x4),_0x4b6264[_0xcb5f('0x88')]||_0xcb5f('0x8e')),'reportId':_0x46c3ea['id'],'reportType':'custom'});return db[_0xcb5f('0x8f')][_0xcb5f('0x4b')](_0x3580ca,{'raw':!![]});})['then'](function(_0x2d31a4){if(_0x46c3ea['table']===_0xcb5f('0x90')){_0x216c72[_0xcb5f('0x37')](_0x46c3ea[_0xcb5f('0x69')]+_0xcb5f('0x91'),_0x4b6264[_0xcb5f('0x92')],_0x4b6264['endDate']);}else{_0x216c72['where'](_0x46c3ea[_0xcb5f('0x69')]+_0xcb5f('0x93'),_0x4b6264['startDate'],_0x4b6264[_0xcb5f('0x94')]);}if(_0x2d31a4){logger[_0xcb5f('0x95')](_0xcb5f('0x96'),_0x216c72[_0xcb5f('0x7d')]());require('child_process')[_0xcb5f('0x97')](path[_0xcb5f('0x4d')](__dirname,_0xcb5f('0x98'),_0x2d31a4['output']),[_0x2d31a4['id'],_0x216c72[_0xcb5f('0x7d')](),path[_0xcb5f('0x4d')](__dirname,'../../files/reports',_0x2d31a4[_0xcb5f('0x99')]),_0xb8d2f1]);return _0x2d31a4;}else{var _0x5b61ad=squel[_0xcb5f('0x68')]();_0x5b61ad[_0xcb5f('0x86')]('('+_0x216c72[_0xcb5f('0x7d')]()+')',_0xcb5f('0x9a'));_0x5b61ad[_0xcb5f('0x60')](_0xcb5f('0x9b'),_0xcb5f('0x1b'));_0x216c72[_0xcb5f('0x1a')](_0x4b6264[_0xcb5f('0x1a')]||_0x3bdc33);_0x216c72[_0xcb5f('0x18')](_0x4b6264[_0xcb5f('0x18')]||0x0);return dbH[_0xcb5f('0x7e')][_0xcb5f('0x2e')](_0x5b61ad['toString'](),{'type':dbH[_0xcb5f('0x7e')][_0xcb5f('0x7f')][_0xcb5f('0x80')]})[_0xcb5f('0x21')](function(_0x5eaa0c){if(!_0x5eaa0c['length']){_0x553c19=0x0;}else{_0x553c19=_0x5eaa0c[0x0][_0xcb5f('0x1b')]||0x0;}return dbH['sequelize'][_0xcb5f('0x2e')](_0x216c72[_0xcb5f('0x7d')](),{'type':dbH[_0xcb5f('0x7e')]['QueryTypes']['SELECT']});})[_0xcb5f('0x21')](function(_0x4c63a2){return{'rows':_0x4c63a2||[],'count':_0x553c19};});}});}exports[_0xcb5f('0x9c')]=function(_0x27852f,_0x29690b){return runReport(_0x27852f[_0xcb5f('0x43')],_0x27852f['query'],_0x27852f[_0xcb5f('0x9d')])[_0xcb5f('0x21')](respondWithResult(_0x29690b,null))[_0xcb5f('0x41')](handleError(_0x29690b,null));};exports[_0xcb5f('0x9e')]=runReport;exports[_0xcb5f('0x2e')]=function(_0x56b705,_0x3bd52d){var _0xec36c2=0xa;var _0x3ac3cb=['join',_0xcb5f('0x4e'),_0xcb5f('0x4f'),_0xcb5f('0x50')];var _0x447c16={'SUM':_0xcb5f('0x51'),'COUNT':'COUNT(%s)','COUNT DISTINCT':_0xcb5f('0x81'),'MAX':_0xcb5f('0x53'),'MIN':'MIN(%s)','AVG':_0xcb5f('0x55'),'GROUP_CONCAT':_0xcb5f('0x82'),'GROUP_CONCAT ASC':_0xcb5f('0x56'),'GROUP_CONCAT DESC':_0xcb5f('0x83')};var _0x4621ad={'SEC_TO_TIME':_0xcb5f('0x9f'),'DATE':_0xcb5f('0x57'),'HOUR':_0xcb5f('0x58'),'ROUND':_0xcb5f('0x59'),'UNIX_TIMESTAMP':'UNIX_TIMESTAMP(%s)'};var _0x4b09b3=function(_0x56fdff){return!_['includes']([_0xcb5f('0x5b'),_0xcb5f('0x5c'),_0xcb5f('0x5d'),_0xcb5f('0xa0')],_0x56fdff);};var _0x3d586f=function(_0x2b4f43){if(!_0x2b4f43||!_0x2b4f43['rules'][_0xcb5f('0x44')]){return'';}for(var _0x581376='(',_0x1ddf1b=0x0;_0x1ddf1b<_0x2b4f43[_0xcb5f('0x5e')][_0xcb5f('0x44')];_0x1ddf1b+=0x1){_0x1ddf1b>0x0&&(_0x581376+='\x20'+_0x2b4f43[_0xcb5f('0x84')]+'\x20');_0x581376+=_0x2b4f43[_0xcb5f('0x5e')][_0x1ddf1b][_0xcb5f('0x5f')]?_0x3d586f(_0x2b4f43[_0xcb5f('0x5e')][_0x1ddf1b]['group']):_0x2b4f43['rules'][_0x1ddf1b]['field']+'\x20'+_0x2b4f43[_0xcb5f('0x5e')][_0x1ddf1b][_0xcb5f('0x61')]+(_0x4b09b3(_0x2b4f43['rules'][_0x1ddf1b]['condition'])?'\x20'+_0x2b4f43[_0xcb5f('0x5e')][_0x1ddf1b][_0xcb5f('0x62')]:'');}return _0x581376+')';};var _0x24a96f={'where':{'id':_0x56b705[_0xcb5f('0x43')]['id']}},_0x462231,_0x41756b,_0x165bbc,_0x39fa37,_0x2728bc;_0x24a96f=_['merge']({},_0x24a96f,_0x56b705['options']);return db[_0xcb5f('0x3c')][_0xcb5f('0x45')](_0x24a96f)[_0xcb5f('0x21')](function(_0x984353){if(_0x984353){_0x462231=_0x984353;return _0x984353[_0xcb5f('0x85')]();}return null;})[_0xcb5f('0x21')](function(_0x59490a){if(_0x59490a){if(!_0x59490a[_0xcb5f('0x44')]){throw new db[(_0xcb5f('0x63'))][(_0xcb5f('0x64'))](_0xcb5f('0x65'),0x193);}_0x41756b=_0x59490a;return db[_0xcb5f('0x66')]['findAll']({'raw':!![]});}return null;})['then'](function(_0x5406a7){if(_0x5406a7){_0x165bbc=_[_0xcb5f('0x67')](_0x5406a7,'id');var _0x219c36;var _0x1deb9a=squel[_0xcb5f('0x68')]();_0x1deb9a[_0xcb5f('0x86')](_0x462231['table']);for(var _0x96eeb2=0x0;_0x96eeb2<_0x41756b[_0xcb5f('0x44')];_0x96eeb2+=0x1){_0x219c36=_0x41756b[_0x96eeb2][_0xcb5f('0x6a')]?_0x165bbc[_0x41756b[_0x96eeb2][_0xcb5f('0x6a')]][_0xcb5f('0x6b')]:_0x41756b[_0x96eeb2][_0xcb5f('0x60')];_0x219c36=_0x41756b[_0x96eeb2][_0xcb5f('0x6c')]?_[_0xcb5f('0x6d')](_0x447c16[_0x41756b[_0x96eeb2]['function']],'%s',_0x219c36):_0x219c36;_0x219c36=_0x41756b[_0x96eeb2][_0xcb5f('0x6e')]?_['replace'](_0x4621ad[_0x41756b[_0x96eeb2][_0xcb5f('0x6e')]],'%s',_0x219c36):_0x219c36;if(_0x41756b[_0x96eeb2][_0xcb5f('0x6f')]){_0x1deb9a[_0xcb5f('0x5f')](_0x219c36);}_0x41756b[_0x96eeb2][_0xcb5f('0x70')]&&_0x1deb9a['order'](_0x219c36,_0x41756b[_0x96eeb2][_0xcb5f('0x70')]===_0xcb5f('0x71')?![]:!![]);_0x1deb9a[_0xcb5f('0x60')](_0x219c36,_0x41756b[_0x96eeb2][_0xcb5f('0x72')]||_0x219c36);}if(_0x462231[_0xcb5f('0x73')]){_0x462231[_0xcb5f('0x73')]=JSON['parse'](_0x462231[_0xcb5f('0x73')]);for(var _0x47d55b=0x0;_0x47d55b<_0x462231[_0xcb5f('0x73')]['length'];_0x47d55b+=0x1){if(_0x462231['joins'][_0x47d55b]['type']&&_[_0xcb5f('0x75')](_0x3ac3cb,_0x462231['joins'][_0x47d55b][_0xcb5f('0x2c')])&&_0x462231[_0xcb5f('0x73')][_0x47d55b]['parentKey']&&_0x462231[_0xcb5f('0x73')][_0x47d55b][_0xcb5f('0x77')]&&_0x462231[_0xcb5f('0x73')][_0x47d55b]['foreignKey']){_0x1deb9a[_0x462231['joins'][_0x47d55b][_0xcb5f('0x2c')]](_0x462231['joins'][_0x47d55b][_0xcb5f('0x77')],null,util['format']('%s.%s\x20=\x20%s.%s',_0x462231['table'],_0x462231['joins'][_0x47d55b]['parentKey'],_0x462231['joins'][_0x47d55b]['foreignTable'],_0x462231[_0xcb5f('0x73')][_0x47d55b][_0xcb5f('0x78')]));}}}if(_0x462231['conditions']){_0x462231[_0xcb5f('0x7a')]=JSON[_0xcb5f('0x74')](_0x462231[_0xcb5f('0x7a')]);_0x1deb9a[_0xcb5f('0x37')](_0x3d586f(_0x462231[_0xcb5f('0x7a')][_0xcb5f('0x5f')]));}_0x2728bc=_0x1deb9a[_0xcb5f('0x7b')]();_0x1deb9a[_0xcb5f('0x1a')](_0xec36c2);_0x1deb9a['offset'](0x0);logger[_0xcb5f('0x7c')](_0xcb5f('0xa1'),_0x1deb9a[_0xcb5f('0x7d')]());return dbH[_0xcb5f('0x7e')][_0xcb5f('0x2e')](_0x1deb9a['toString'](),{'type':dbH[_0xcb5f('0x7e')][_0xcb5f('0x7f')][_0xcb5f('0x80')]});}})[_0xcb5f('0x21')](function(){return{'sql':_0x2728bc['toString']()};})[_0xcb5f('0x21')](respondWithResult(_0x3bd52d,null))['catch'](handleError(_0x3bd52d,null));}; \ No newline at end of file +var _0x0a7e=['field','condition','getFields','Sequelize','ValidationErrorItem','Please\x20insert\x20at\x20least\x20one\x20field','AnalyticMetric','keyBy','select','from','MetricId','metric','function','replace','format','orderBy','alias','joins','parse','parentKey','foreignTable','foreignKey','%s.%s\x20=\x20%s.%s','table','conditions','clone','Limited\x20Query:','toString','sequelize','QueryTypes','SELECT','join','GROUP_CONCAT(%s)','GROUP_CONCAT(%s\x20ORDER\x20BY\x20%s\x20DESC)','value','groupBy','DESC','output','web','fullPath','%s-%s.%s','generate','csv','custom','AnalyticExtractedReport','cdr','.calldate\x20BETWEEN\x20?\x20AND\x20?','endDate','startDate','info','fork','../../components/export/','../../files/reports','savename','countTable','COUNT(*)','run','runReport','debug','rimraf','zip-dir','fast-json-patch','request-promise','moment','bluebird','path','sox','to-csv','fs-extra','lodash','squel','crypto','jsforce','desk.js','../../components/auth/service','../../components/parsers/qs','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','dbH','status','end','json','offset','undefined','count','limit','Content-Range','reject','save','update','then','destroy','get','CustomReports','UserProfileResource','sendStatus','error','stack','name','send','index','map','AnalyticCustomReport','rawAttributes','fieldName','type','model','query','filters','attributes','fields','hasOwnProperty','nolimit','order','sort','where','pick','filter','merge','options','includeAll','include','findAll','rows','catch','show','params','keys','intersection','length','create','body','user','role','Reports','UserProfileSection','userProfileId','autoAssociation','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','find','left_join','right_join','cross_join','SUM(%s)','COUNT(%s)','COUNT(DISTINCT\x20%s)','MAX(%s)','MIN(%s)','AVG(%s)','GROUP_CONCAT(%s\x20ORDER\x20BY\x20%s\x20ASC)','SEC_TO_TIME(%s)','DATE(%s)','HOUR(%s)','ROUND(%s)','UNIX_TIMESTAMP(%s)','includes','IS\x20NULL','IS\x20NOT\x20NULL','IS\x20NOT\x20EMPTY','rules','operator','group'];(function(_0x54180e,_0x40f7c7){var _0x1998ca=function(_0x52549e){while(--_0x52549e){_0x54180e['push'](_0x54180e['shift']());}};_0x1998ca(++_0x40f7c7);}(_0x0a7e,0x189));var _0xe0a7=function(_0x3ab51d,_0x2fa01d){_0x3ab51d=_0x3ab51d-0x0;var _0x29a04e=_0x0a7e[_0x3ab51d];return _0x29a04e;};'use strict';var emlformat=require('eml-format');var rimraf=require(_0xe0a7('0x0'));var zipdir=require(_0xe0a7('0x1'));var jsonpatch=require(_0xe0a7('0x2'));var rp=require(_0xe0a7('0x3'));var moment=require(_0xe0a7('0x4'));var BPromise=require(_0xe0a7('0x5'));var Mustache=require('mustache');var util=require('util');var path=require(_0xe0a7('0x6'));var sox=require(_0xe0a7('0x7'));var csv=require(_0xe0a7('0x8'));var ejs=require('ejs');var fs=require('fs');var fs_extra=require(_0xe0a7('0x9'));var _=require(_0xe0a7('0xa'));var squel=require(_0xe0a7('0xb'));var crypto=require(_0xe0a7('0xc'));var jsforce=require(_0xe0a7('0xd'));var deskjs=require(_0xe0a7('0xe'));var toCsv=require(_0xe0a7('0x8'));var querystring=require('querystring');var Papa=require('papaparse');var Redis=require('ioredis');var authService=require(_0xe0a7('0xf'));var qs=require(_0xe0a7('0x10'));var as=require('../../components/parsers/advancedSearch');var hardwareService=require(_0xe0a7('0x11'));var logger=require(_0xe0a7('0x12'))(_0xe0a7('0x13'));var utils=require(_0xe0a7('0x14'));var config=require(_0xe0a7('0x15'));var licenseUtil=require(_0xe0a7('0x16'));var db=require('../../mysqldb')['db'];var dbH=require(_0xe0a7('0x17'))[_0xe0a7('0x18')];function respondWithStatusCode(_0x580bc6,_0x325d85){_0x325d85=_0x325d85||0xcc;return function(_0x84cef8){if(_0x84cef8){return _0x580bc6['sendStatus'](_0x325d85);}return _0x580bc6[_0xe0a7('0x19')](_0x325d85)[_0xe0a7('0x1a')]();};}function respondWithResult(_0x165e75,_0x2477ca){_0x2477ca=_0x2477ca||0xc8;return function(_0xc03cb1){if(_0xc03cb1){return _0x165e75['status'](_0x2477ca)[_0xe0a7('0x1b')](_0xc03cb1);}};}function respondWithFilteredResult(_0xa4964b,_0x5a9dee){return function(_0x19654b){if(_0x19654b){var _0x2fad9d=typeof _0x5a9dee[_0xe0a7('0x1c')]===_0xe0a7('0x1d')&&typeof _0x5a9dee['limit']===_0xe0a7('0x1d');var _0x1a5109=_0x19654b[_0xe0a7('0x1e')];var _0x200cd9=_0x2fad9d?0x0:_0x5a9dee['offset'];var _0x373887=_0x2fad9d?_0x19654b[_0xe0a7('0x1e')]:_0x5a9dee['offset']+_0x5a9dee[_0xe0a7('0x1f')];var _0x4fe1af;if(_0x373887>=_0x1a5109){_0x373887=_0x1a5109;_0x4fe1af=0xc8;}else{_0x4fe1af=0xce;}_0xa4964b[_0xe0a7('0x19')](_0x4fe1af);return _0xa4964b['set'](_0xe0a7('0x20'),_0x200cd9+'-'+_0x373887+'/'+_0x1a5109)[_0xe0a7('0x1b')](_0x19654b);}return null;};}function patchUpdates(_0x4d135d){return function(_0x5db3e2){try{jsonpatch['apply'](_0x5db3e2,_0x4d135d,!![]);}catch(_0x15eaab){return BPromise[_0xe0a7('0x21')](_0x15eaab);}return _0x5db3e2[_0xe0a7('0x22')]();};}function saveUpdates(_0x333fab,_0x1c2cd6){return function(_0x1efc0a){if(_0x1efc0a){return _0x1efc0a[_0xe0a7('0x23')](_0x333fab)[_0xe0a7('0x24')](function(_0x5622f6){return _0x5622f6;});}return null;};}function removeEntity(_0x361bd2,_0xe20424){return function(_0x3219b6){if(_0x3219b6){return _0x3219b6[_0xe0a7('0x25')]()['then'](function(){var _0x1754ab=_0x3219b6[_0xe0a7('0x26')]({'plain':!![]});var _0x3b0734=_0xe0a7('0x27');return db[_0xe0a7('0x28')][_0xe0a7('0x25')]({'where':{'type':_0x3b0734,'resourceId':_0x1754ab['id']}})['then'](function(){return _0x3219b6;});})[_0xe0a7('0x24')](function(){_0x361bd2[_0xe0a7('0x19')](0xcc)[_0xe0a7('0x1a')]();});}};}function handleEntityNotFound(_0x4a01ff,_0x5b9da3){return function(_0x50ca6c){if(!_0x50ca6c){_0x4a01ff[_0xe0a7('0x29')](0x194);}return _0x50ca6c;};}function handleError(_0x769900,_0x19d072){_0x19d072=_0x19d072||0x1f4;return function(_0x4f15fe){logger[_0xe0a7('0x2a')](_0x4f15fe[_0xe0a7('0x2b')]);if(_0x4f15fe[_0xe0a7('0x2c')]){delete _0x4f15fe['name'];}_0x769900[_0xe0a7('0x19')](_0x19d072)[_0xe0a7('0x2d')](_0x4f15fe);};}exports[_0xe0a7('0x2e')]=function(_0x54d004,_0x1a78d6){var _0x26b183={},_0x18ae7e={},_0x61a0d={'count':0x0,'rows':[]};var _0x1f2bae=_[_0xe0a7('0x2f')](db[_0xe0a7('0x30')][_0xe0a7('0x31')],function(_0x1a1d48){return{'name':_0x1a1d48[_0xe0a7('0x32')],'type':_0x1a1d48[_0xe0a7('0x33')]['key']};});_0x18ae7e[_0xe0a7('0x34')]=_[_0xe0a7('0x2f')](_0x1f2bae,'name');_0x18ae7e[_0xe0a7('0x35')]=_['keys'](_0x54d004[_0xe0a7('0x35')]);_0x18ae7e[_0xe0a7('0x36')]=_['intersection'](_0x18ae7e['model'],_0x18ae7e[_0xe0a7('0x35')]);_0x26b183[_0xe0a7('0x37')]=_['intersection'](_0x18ae7e[_0xe0a7('0x34')],qs[_0xe0a7('0x38')](_0x54d004[_0xe0a7('0x35')][_0xe0a7('0x38')]));_0x26b183['attributes']=_0x26b183[_0xe0a7('0x37')]['length']?_0x26b183[_0xe0a7('0x37')]:_0x18ae7e[_0xe0a7('0x34')];if(!_0x54d004[_0xe0a7('0x35')][_0xe0a7('0x39')](_0xe0a7('0x3a'))){_0x26b183['limit']=qs[_0xe0a7('0x1f')](_0x54d004['query']['limit']);_0x26b183['offset']=qs[_0xe0a7('0x1c')](_0x54d004['query']['offset']);}_0x26b183[_0xe0a7('0x3b')]=qs[_0xe0a7('0x3c')](_0x54d004[_0xe0a7('0x35')][_0xe0a7('0x3c')]);_0x26b183[_0xe0a7('0x3d')]=qs[_0xe0a7('0x36')](_[_0xe0a7('0x3e')](_0x54d004[_0xe0a7('0x35')],_0x18ae7e[_0xe0a7('0x36')]),_0x1f2bae);if(_0x54d004[_0xe0a7('0x35')][_0xe0a7('0x3f')]){_0x26b183[_0xe0a7('0x3d')]=_['merge'](_0x26b183['where'],{'$or':_[_0xe0a7('0x2f')](_0x1f2bae,function(_0x55fde2){if(_0x55fde2['type']!=='VIRTUAL'){var _0xdf068d={};_0xdf068d[_0x55fde2[_0xe0a7('0x2c')]]={'$like':'%'+_0x54d004[_0xe0a7('0x35')][_0xe0a7('0x3f')]+'%'};return _0xdf068d;}})});}_0x26b183=_[_0xe0a7('0x40')]({},_0x26b183,_0x54d004[_0xe0a7('0x41')]);var _0x544f7f={'where':_0x26b183[_0xe0a7('0x3d')]};return db[_0xe0a7('0x30')][_0xe0a7('0x1e')](_0x544f7f)[_0xe0a7('0x24')](function(_0x26ef23){_0x61a0d[_0xe0a7('0x1e')]=_0x26ef23;if(_0x54d004[_0xe0a7('0x35')][_0xe0a7('0x42')]){_0x26b183[_0xe0a7('0x43')]=[{'all':!![]}];}return db[_0xe0a7('0x30')][_0xe0a7('0x44')](_0x26b183);})[_0xe0a7('0x24')](function(_0x5762fb){_0x61a0d[_0xe0a7('0x45')]=_0x5762fb;return _0x61a0d;})[_0xe0a7('0x24')](respondWithFilteredResult(_0x1a78d6,_0x26b183))[_0xe0a7('0x46')](handleError(_0x1a78d6,null));};exports[_0xe0a7('0x47')]=function(_0x51b5b8,_0x2f5620){var _0x23aeef={'raw':![],'where':{'id':_0x51b5b8[_0xe0a7('0x48')]['id']}},_0xf3829c={};_0xf3829c[_0xe0a7('0x34')]=_[_0xe0a7('0x49')](db[_0xe0a7('0x30')][_0xe0a7('0x31')]);_0xf3829c[_0xe0a7('0x35')]=_[_0xe0a7('0x49')](_0x51b5b8['query']);_0xf3829c[_0xe0a7('0x36')]=_[_0xe0a7('0x4a')](_0xf3829c['model'],_0xf3829c[_0xe0a7('0x35')]);_0x23aeef[_0xe0a7('0x37')]=_[_0xe0a7('0x4a')](_0xf3829c[_0xe0a7('0x34')],qs[_0xe0a7('0x38')](_0x51b5b8['query']['fields']));_0x23aeef[_0xe0a7('0x37')]=_0x23aeef[_0xe0a7('0x37')][_0xe0a7('0x4b')]?_0x23aeef[_0xe0a7('0x37')]:_0xf3829c[_0xe0a7('0x34')];if(_0x51b5b8[_0xe0a7('0x35')]['includeAll']){_0x23aeef[_0xe0a7('0x43')]=[{'all':!![]}];}_0x23aeef=_[_0xe0a7('0x40')]({},_0x23aeef,_0x51b5b8[_0xe0a7('0x41')]);return db[_0xe0a7('0x30')]['find'](_0x23aeef)[_0xe0a7('0x24')](handleEntityNotFound(_0x2f5620,null))['then'](respondWithResult(_0x2f5620,null))[_0xe0a7('0x46')](handleError(_0x2f5620,null));};exports[_0xe0a7('0x4c')]=function(_0x4c9773,_0x52ef2e){return db[_0xe0a7('0x30')][_0xe0a7('0x4c')](_0x4c9773[_0xe0a7('0x4d')],{})[_0xe0a7('0x24')](function(_0x143c8e){var _0x451ac7=_0x4c9773[_0xe0a7('0x4e')][_0xe0a7('0x26')]({'plain':!![]});if(!_0x451ac7)throw new Error('Unable\x20to\x20retrieve\x20the\x20current\x20user');if(_0x451ac7[_0xe0a7('0x4f')]===_0xe0a7('0x4e')){var _0x2baa07=_0x143c8e['get']({'plain':!![]});var _0x32f381=_0xe0a7('0x50');return db[_0xe0a7('0x51')]['find']({'where':{'name':_0x32f381,'userProfileId':_0x451ac7[_0xe0a7('0x52')]},'raw':!![]})['then'](function(_0x4dca1b){if(_0x4dca1b&&_0x4dca1b[_0xe0a7('0x53')]===0x0){return db[_0xe0a7('0x28')][_0xe0a7('0x4c')]({'name':_0x2baa07[_0xe0a7('0x2c')],'resourceId':_0x2baa07['id'],'type':_0xe0a7('0x27'),'sectionId':_0x4dca1b['id']},{})[_0xe0a7('0x24')](function(){return _0x143c8e;});}else{return _0x143c8e;}})[_0xe0a7('0x46')](function(_0x51ac64){logger['error'](_0xe0a7('0x54'),_0x51ac64);throw _0x51ac64;});}return _0x143c8e;})[_0xe0a7('0x24')](respondWithResult(_0x52ef2e,0xc9))[_0xe0a7('0x46')](handleError(_0x52ef2e,null));};exports[_0xe0a7('0x23')]=function(_0x1a13be,_0x5461f6){if(_0x1a13be['body']['id']){delete _0x1a13be['body']['id'];}return db[_0xe0a7('0x30')]['find']({'where':{'id':_0x1a13be['params']['id']}})[_0xe0a7('0x24')](handleEntityNotFound(_0x5461f6,null))[_0xe0a7('0x24')](saveUpdates(_0x1a13be[_0xe0a7('0x4d')],null))['then'](respondWithResult(_0x5461f6,null))['catch'](handleError(_0x5461f6,null));};exports['destroy']=function(_0x1074f4,_0x5bac2c){return db[_0xe0a7('0x30')][_0xe0a7('0x55')]({'where':{'id':_0x1074f4[_0xe0a7('0x48')]['id']}})[_0xe0a7('0x24')](handleEntityNotFound(_0x5bac2c,null))[_0xe0a7('0x24')](removeEntity(_0x5bac2c,null))[_0xe0a7('0x46')](handleError(_0x5bac2c,null));};exports['preview']=function(_0x52f2af,_0xd1317a){var _0x4f9c76=0xa;var _0x176a1a=['join',_0xe0a7('0x56'),_0xe0a7('0x57'),_0xe0a7('0x58')];var _0x1ad020={'SUM':_0xe0a7('0x59'),'COUNT':_0xe0a7('0x5a'),'COUNT DISTINCT':_0xe0a7('0x5b'),'MAX':_0xe0a7('0x5c'),'MIN':_0xe0a7('0x5d'),'AVG':_0xe0a7('0x5e'),'GROUP_CONCAT':'GROUP_CONCAT(%s)','GROUP_CONCAT ASC':_0xe0a7('0x5f'),'GROUP_CONCAT DESC':'GROUP_CONCAT(%s\x20ORDER\x20BY\x20%s\x20DESC)'};var _0x2512a7={'SEC_TO_TIME':_0xe0a7('0x60'),'DATE':_0xe0a7('0x61'),'HOUR':_0xe0a7('0x62'),'ROUND':_0xe0a7('0x63'),'UNIX_TIMESTAMP':_0xe0a7('0x64')};var _0x5cccb6=function(_0x3271a2){return!_[_0xe0a7('0x65')]([_0xe0a7('0x66'),_0xe0a7('0x67'),'IS\x20EMPTY',_0xe0a7('0x68')],_0x3271a2);};var _0x1ba3d5=function(_0x20b5b0){if(!_0x20b5b0||!_0x20b5b0[_0xe0a7('0x69')][_0xe0a7('0x4b')]){return'';}for(var _0xe4f72e='(',_0x17bff0=0x0;_0x17bff0<_0x20b5b0[_0xe0a7('0x69')][_0xe0a7('0x4b')];_0x17bff0+=0x1){_0x17bff0>0x0&&(_0xe4f72e+='\x20'+_0x20b5b0[_0xe0a7('0x6a')]+'\x20');_0xe4f72e+=_0x20b5b0[_0xe0a7('0x69')][_0x17bff0]['group']?_0x1ba3d5(_0x20b5b0[_0xe0a7('0x69')][_0x17bff0][_0xe0a7('0x6b')]):_0x20b5b0['rules'][_0x17bff0][_0xe0a7('0x6c')]+'\x20'+_0x20b5b0[_0xe0a7('0x69')][_0x17bff0]['condition']+(_0x5cccb6(_0x20b5b0[_0xe0a7('0x69')][_0x17bff0][_0xe0a7('0x6d')])?'\x20'+_0x20b5b0[_0xe0a7('0x69')][_0x17bff0]['value']:'');}return _0xe4f72e+')';};var _0x3ec189={'where':{'id':_0x52f2af[_0xe0a7('0x48')]['id']}},_0x5c78e4,_0x2dffb3,_0x24dc6d,_0x591dff,_0x2ee75a;_0x3ec189=_[_0xe0a7('0x40')]({},_0x3ec189,_0x52f2af['options']);return db[_0xe0a7('0x30')]['find'](_0x3ec189)[_0xe0a7('0x24')](function(_0x23a4b1){if(_0x23a4b1){_0x5c78e4=_0x23a4b1;return _0x23a4b1[_0xe0a7('0x6e')]();}return null;})[_0xe0a7('0x24')](function(_0x534b2d){if(_0x534b2d){if(!_0x534b2d[_0xe0a7('0x4b')]){throw new db[(_0xe0a7('0x6f'))][(_0xe0a7('0x70'))](_0xe0a7('0x71'),0x193);}_0x2dffb3=_0x534b2d;return db[_0xe0a7('0x72')]['findAll']({'raw':!![]});}return null;})['then'](function(_0x2593ef){if(_0x2593ef){_0x24dc6d=_[_0xe0a7('0x73')](_0x2593ef,'id');var _0x455f4d;var _0x140c87=squel[_0xe0a7('0x74')]();_0x140c87[_0xe0a7('0x75')](_0x5c78e4['table']);for(var _0x4c4233=0x0;_0x4c4233<_0x2dffb3['length'];_0x4c4233+=0x1){_0x455f4d=_0x2dffb3[_0x4c4233][_0xe0a7('0x76')]?_0x24dc6d[_0x2dffb3[_0x4c4233]['MetricId']][_0xe0a7('0x77')]:_0x2dffb3[_0x4c4233][_0xe0a7('0x6c')];_0x455f4d=_0x2dffb3[_0x4c4233][_0xe0a7('0x78')]?_[_0xe0a7('0x79')](_0x1ad020[_0x2dffb3[_0x4c4233][_0xe0a7('0x78')]],'%s',_0x455f4d):_0x455f4d;_0x455f4d=_0x2dffb3[_0x4c4233]['format']?_['replace'](_0x2512a7[_0x2dffb3[_0x4c4233][_0xe0a7('0x7a')]],'%s',_0x455f4d):_0x455f4d;if(_0x2dffb3[_0x4c4233]['groupBy']){_0x140c87[_0xe0a7('0x6b')](_0x455f4d);}_0x2dffb3[_0x4c4233][_0xe0a7('0x7b')]&&_0x140c87[_0xe0a7('0x3b')](_0x455f4d,_0x2dffb3[_0x4c4233][_0xe0a7('0x7b')]==='DESC'?![]:!![]);_0x140c87[_0xe0a7('0x6c')](_0x455f4d,_0x2dffb3[_0x4c4233][_0xe0a7('0x7c')]||_0x455f4d);}if(_0x5c78e4[_0xe0a7('0x7d')]){_0x5c78e4[_0xe0a7('0x7d')]=JSON[_0xe0a7('0x7e')](_0x5c78e4[_0xe0a7('0x7d')]);for(var _0x47a59d=0x0;_0x47a59d<_0x5c78e4[_0xe0a7('0x7d')][_0xe0a7('0x4b')];_0x47a59d+=0x1){if(_0x5c78e4[_0xe0a7('0x7d')][_0x47a59d][_0xe0a7('0x33')]&&_[_0xe0a7('0x65')](_0x176a1a,_0x5c78e4['joins'][_0x47a59d]['type'])&&_0x5c78e4[_0xe0a7('0x7d')][_0x47a59d][_0xe0a7('0x7f')]&&_0x5c78e4[_0xe0a7('0x7d')][_0x47a59d][_0xe0a7('0x80')]&&_0x5c78e4[_0xe0a7('0x7d')][_0x47a59d][_0xe0a7('0x81')]){_0x140c87[_0x5c78e4[_0xe0a7('0x7d')][_0x47a59d][_0xe0a7('0x33')]](_0x5c78e4['joins'][_0x47a59d]['foreignTable'],null,util['format'](_0xe0a7('0x82'),_0x5c78e4[_0xe0a7('0x83')],_0x5c78e4['joins'][_0x47a59d][_0xe0a7('0x7f')],_0x5c78e4['joins'][_0x47a59d][_0xe0a7('0x80')],_0x5c78e4[_0xe0a7('0x7d')][_0x47a59d][_0xe0a7('0x81')]));}}}if(_0x5c78e4[_0xe0a7('0x84')]){_0x5c78e4['conditions']=JSON[_0xe0a7('0x7e')](_0x5c78e4[_0xe0a7('0x84')]);_0x140c87[_0xe0a7('0x3d')](_0x1ba3d5(_0x5c78e4[_0xe0a7('0x84')][_0xe0a7('0x6b')]));}_0x2ee75a=_0x140c87[_0xe0a7('0x85')]();_0x140c87[_0xe0a7('0x1f')](_0x4f9c76);_0x140c87[_0xe0a7('0x1c')](0x0);logger['debug'](_0xe0a7('0x86'),_0x140c87[_0xe0a7('0x87')]());return dbH[_0xe0a7('0x88')][_0xe0a7('0x35')](_0x140c87['toString'](),{'type':dbH[_0xe0a7('0x88')][_0xe0a7('0x89')][_0xe0a7('0x8a')]});}})['then'](respondWithResult(_0xd1317a,null))[_0xe0a7('0x46')](handleError(_0xd1317a,null));};function runReport(_0x4caba3,_0x43f017,_0x3b30e4){var _0x5a93b6=_0x43f017[_0xe0a7('0x2c')];var _0x326a64=0xa;var _0xbc332a=[_0xe0a7('0x8b'),_0xe0a7('0x56'),_0xe0a7('0x57'),'cross_join'];var _0xcba08c={'SUM':_0xe0a7('0x59'),'COUNT':'COUNT(%s)','COUNT DISTINCT':_0xe0a7('0x5b'),'MAX':'MAX(%s)','MIN':'MIN(%s)','AVG':_0xe0a7('0x5e'),'GROUP_CONCAT':_0xe0a7('0x8c'),'GROUP_CONCAT ASC':'GROUP_CONCAT(%s\x20ORDER\x20BY\x20%s\x20ASC)','GROUP_CONCAT DESC':_0xe0a7('0x8d')};var _0x21edad={'SEC_TO_TIME':_0xe0a7('0x60'),'DATE':_0xe0a7('0x61'),'HOUR':'HOUR(%s)','ROUND':'ROUND(%s)','UNIX_TIMESTAMP':_0xe0a7('0x64')};var _0x3f304a=function(_0x1f6c08){return!_[_0xe0a7('0x65')]([_0xe0a7('0x66'),'IS\x20NOT\x20NULL','IS\x20EMPTY',_0xe0a7('0x68')],_0x1f6c08);};var _0x1ca2b1=function(_0x111ca9){if(!_0x111ca9||!_0x111ca9['rules']['length']){return'';}for(var _0x1b23c6='(',_0x272ae1=0x0;_0x272ae1<_0x111ca9['rules'][_0xe0a7('0x4b')];_0x272ae1+=0x1){_0x272ae1>0x0&&(_0x1b23c6+='\x20'+_0x111ca9[_0xe0a7('0x6a')]+'\x20');_0x1b23c6+=_0x111ca9[_0xe0a7('0x69')][_0x272ae1]['group']?_0x1ca2b1(_0x111ca9[_0xe0a7('0x69')][_0x272ae1][_0xe0a7('0x6b')]):_0x111ca9[_0xe0a7('0x69')][_0x272ae1]['field']+'\x20'+_0x111ca9[_0xe0a7('0x69')][_0x272ae1]['condition']+(_0x3f304a(_0x111ca9['rules'][_0x272ae1][_0xe0a7('0x6d')])?'\x20'+_0x111ca9[_0xe0a7('0x69')][_0x272ae1][_0xe0a7('0x8e')]:'');}return _0x1b23c6+')';};var _0x469397={'where':{'id':_0x4caba3['id']}},_0x21ed09,_0x115ed1,_0xb659d3,_0x2db5f7,_0x486961;_0x469397=_[_0xe0a7('0x40')]({},_0x469397,_0x3b30e4);return db[_0xe0a7('0x30')][_0xe0a7('0x55')](_0x469397)['then'](function(_0x5cb9e1){if(_0x5cb9e1){_0x21ed09=_0x5cb9e1;return _0x5cb9e1[_0xe0a7('0x6e')]();}return null;})[_0xe0a7('0x24')](function(_0x45e1f5){if(_0x45e1f5){if(!_0x45e1f5[_0xe0a7('0x4b')]){throw new db[(_0xe0a7('0x6f'))][(_0xe0a7('0x70'))](_0xe0a7('0x71'),0x193);}_0x115ed1=_0x45e1f5;return db[_0xe0a7('0x72')][_0xe0a7('0x44')]({'raw':!![]});}return null;})[_0xe0a7('0x24')](function(_0x384db3){if(_0x384db3){_0xb659d3=_[_0xe0a7('0x73')](_0x384db3,'id');var _0x385ad7;var _0x5cc733=squel[_0xe0a7('0x74')]();_0x5cc733[_0xe0a7('0x75')](_0x21ed09[_0xe0a7('0x83')]);for(var _0x21f57b=0x0;_0x21f57b<_0x115ed1[_0xe0a7('0x4b')];_0x21f57b+=0x1){_0x385ad7=_0x115ed1[_0x21f57b][_0xe0a7('0x76')]?_0xb659d3[_0x115ed1[_0x21f57b][_0xe0a7('0x76')]][_0xe0a7('0x77')]:_0x115ed1[_0x21f57b]['field'];_0x385ad7=_0x115ed1[_0x21f57b]['function']?_[_0xe0a7('0x79')](_0xcba08c[_0x115ed1[_0x21f57b][_0xe0a7('0x78')]],'%s',_0x385ad7):_0x385ad7;_0x385ad7=_0x115ed1[_0x21f57b][_0xe0a7('0x7a')]?_[_0xe0a7('0x79')](_0x21edad[_0x115ed1[_0x21f57b]['format']],'%s',_0x385ad7):_0x385ad7;if(_0x115ed1[_0x21f57b][_0xe0a7('0x8f')]){_0x5cc733[_0xe0a7('0x6b')](_0x385ad7);}_0x115ed1[_0x21f57b]['orderBy']&&_0x5cc733[_0xe0a7('0x3b')](_0x385ad7,_0x115ed1[_0x21f57b]['orderBy']===_0xe0a7('0x90')?![]:!![]);_0x5cc733['field'](_0x385ad7,_0x115ed1[_0x21f57b][_0xe0a7('0x7c')]||_0x385ad7);}if(_0x21ed09[_0xe0a7('0x7d')]){_0x21ed09[_0xe0a7('0x7d')]=JSON[_0xe0a7('0x7e')](_0x21ed09['joins']);for(var _0x3cfce6=0x0;_0x3cfce6<_0x21ed09[_0xe0a7('0x7d')][_0xe0a7('0x4b')];_0x3cfce6+=0x1){if(_0x21ed09[_0xe0a7('0x7d')][_0x3cfce6]['type']&&_[_0xe0a7('0x65')](_0xbc332a,_0x21ed09['joins'][_0x3cfce6]['type'])&&_0x21ed09['joins'][_0x3cfce6][_0xe0a7('0x7f')]&&_0x21ed09[_0xe0a7('0x7d')][_0x3cfce6][_0xe0a7('0x80')]&&_0x21ed09[_0xe0a7('0x7d')][_0x3cfce6][_0xe0a7('0x81')]){_0x5cc733[_0x21ed09[_0xe0a7('0x7d')][_0x3cfce6][_0xe0a7('0x33')]](_0x21ed09[_0xe0a7('0x7d')][_0x3cfce6]['foreignTable'],null,util[_0xe0a7('0x7a')](_0xe0a7('0x82'),_0x21ed09[_0xe0a7('0x83')],_0x21ed09['joins'][_0x3cfce6][_0xe0a7('0x7f')],_0x21ed09[_0xe0a7('0x7d')][_0x3cfce6][_0xe0a7('0x80')],_0x21ed09[_0xe0a7('0x7d')][_0x3cfce6][_0xe0a7('0x81')]));}}}if(_0x21ed09[_0xe0a7('0x84')]){_0x21ed09['conditions']=JSON[_0xe0a7('0x7e')](_0x21ed09[_0xe0a7('0x84')]);_0x5cc733[_0xe0a7('0x3d')](_0x1ca2b1(_0x21ed09[_0xe0a7('0x84')][_0xe0a7('0x6b')]));}_0x486961=_0x5cc733[_0xe0a7('0x85')]();_0x5cc733[_0xe0a7('0x1f')](_0x326a64);_0x5cc733[_0xe0a7('0x1c')](0x0);return;}})['then'](function(){if(_0x43f017[_0xe0a7('0x91')]===_0xe0a7('0x92')){return null;}var _0x2e6dba=_[_0xe0a7('0x40')](_0x43f017,{'name':_0x43f017[_0xe0a7('0x93')]||_0x43f017[_0xe0a7('0x2c')]||_0x21ed09['name'],'basename':_0x5a93b6,'savename':util[_0xe0a7('0x7a')](_0xe0a7('0x94'),_0x43f017[_0xe0a7('0x2c')]||_0x21ed09[_0xe0a7('0x2c')],require('randomstring')[_0xe0a7('0x95')](0x4),_0x43f017[_0xe0a7('0x91')]||_0xe0a7('0x96')),'reportId':_0x21ed09['id'],'reportType':_0xe0a7('0x97')});return db[_0xe0a7('0x98')]['create'](_0x2e6dba,{'raw':!![]});})[_0xe0a7('0x24')](function(_0x186cb1){if(_0x21ed09['table']===_0xe0a7('0x99')){_0x486961[_0xe0a7('0x3d')](_0x21ed09[_0xe0a7('0x83')]+_0xe0a7('0x9a'),_0x43f017['startDate'],_0x43f017[_0xe0a7('0x9b')]);}else{_0x486961[_0xe0a7('0x3d')](_0x21ed09[_0xe0a7('0x83')]+'.createdAt\x20BETWEEN\x20?\x20AND\x20?',_0x43f017[_0xe0a7('0x9c')],_0x43f017[_0xe0a7('0x9b')]);}if(_0x186cb1){logger[_0xe0a7('0x9d')]('Run\x20Query:',_0x486961['toString']());require('child_process')[_0xe0a7('0x9e')](path[_0xe0a7('0x8b')](__dirname,_0xe0a7('0x9f'),_0x186cb1[_0xe0a7('0x91')]),[_0x186cb1['id'],_0x486961['toString'](),path[_0xe0a7('0x8b')](__dirname,_0xe0a7('0xa0'),_0x186cb1[_0xe0a7('0xa1')]),_0x5a93b6]);return _0x186cb1;}else{var _0x5adf11=squel[_0xe0a7('0x74')]();_0x5adf11['from']('('+_0x486961[_0xe0a7('0x87')]()+')',_0xe0a7('0xa2'));_0x5adf11[_0xe0a7('0x6c')](_0xe0a7('0xa3'),_0xe0a7('0x1e'));_0x486961[_0xe0a7('0x1f')](_0x43f017[_0xe0a7('0x1f')]||_0x326a64);_0x486961['offset'](_0x43f017[_0xe0a7('0x1c')]||0x0);return dbH['sequelize'][_0xe0a7('0x35')](_0x5adf11[_0xe0a7('0x87')](),{'type':dbH['sequelize'][_0xe0a7('0x89')][_0xe0a7('0x8a')]})[_0xe0a7('0x24')](function(_0x191522){if(!_0x191522['length']){_0x2db5f7=0x0;}else{_0x2db5f7=_0x191522[0x0][_0xe0a7('0x1e')]||0x0;}return dbH['sequelize']['query'](_0x486961['toString'](),{'type':dbH[_0xe0a7('0x88')][_0xe0a7('0x89')]['SELECT']});})[_0xe0a7('0x24')](function(_0x46aeeb){return{'rows':_0x46aeeb||[],'count':_0x2db5f7};});}});}exports[_0xe0a7('0xa4')]=function(_0x503e60,_0x514d21){return runReport(_0x503e60[_0xe0a7('0x48')],_0x503e60[_0xe0a7('0x35')],_0x503e60[_0xe0a7('0x41')])[_0xe0a7('0x24')](respondWithResult(_0x514d21,null))[_0xe0a7('0x46')](handleError(_0x514d21,null));};exports[_0xe0a7('0xa5')]=runReport;exports[_0xe0a7('0x35')]=function(_0x5e7187,_0x4b803e){var _0x3bcecb=0xa;var _0x397072=[_0xe0a7('0x8b'),'left_join',_0xe0a7('0x57'),'cross_join'];var _0x4b605a={'SUM':_0xe0a7('0x59'),'COUNT':_0xe0a7('0x5a'),'COUNT DISTINCT':'COUNT(DISTINCT\x20%s)','MAX':_0xe0a7('0x5c'),'MIN':_0xe0a7('0x5d'),'AVG':'AVG(%s)','GROUP_CONCAT':_0xe0a7('0x8c'),'GROUP_CONCAT ASC':'GROUP_CONCAT(%s\x20ORDER\x20BY\x20%s\x20ASC)','GROUP_CONCAT DESC':'GROUP_CONCAT(%s\x20ORDER\x20BY\x20%s\x20DESC)'};var _0x5715b5={'SEC_TO_TIME':_0xe0a7('0x60'),'DATE':_0xe0a7('0x61'),'HOUR':_0xe0a7('0x62'),'ROUND':_0xe0a7('0x63'),'UNIX_TIMESTAMP':_0xe0a7('0x64')};var _0x2480ab=function(_0x1fe790){return!_[_0xe0a7('0x65')]([_0xe0a7('0x66'),_0xe0a7('0x67'),'IS\x20EMPTY','IS\x20NOT\x20EMPTY'],_0x1fe790);};var _0x53175c=function(_0x4e8a88){if(!_0x4e8a88||!_0x4e8a88[_0xe0a7('0x69')]['length']){return'';}for(var _0x4c4bc0='(',_0x3e5373=0x0;_0x3e5373<_0x4e8a88[_0xe0a7('0x69')][_0xe0a7('0x4b')];_0x3e5373+=0x1){_0x3e5373>0x0&&(_0x4c4bc0+='\x20'+_0x4e8a88[_0xe0a7('0x6a')]+'\x20');_0x4c4bc0+=_0x4e8a88[_0xe0a7('0x69')][_0x3e5373]['group']?_0x53175c(_0x4e8a88['rules'][_0x3e5373][_0xe0a7('0x6b')]):_0x4e8a88[_0xe0a7('0x69')][_0x3e5373][_0xe0a7('0x6c')]+'\x20'+_0x4e8a88[_0xe0a7('0x69')][_0x3e5373][_0xe0a7('0x6d')]+(_0x2480ab(_0x4e8a88[_0xe0a7('0x69')][_0x3e5373][_0xe0a7('0x6d')])?'\x20'+_0x4e8a88[_0xe0a7('0x69')][_0x3e5373][_0xe0a7('0x8e')]:'');}return _0x4c4bc0+')';};var _0x25f62f={'where':{'id':_0x5e7187[_0xe0a7('0x48')]['id']}},_0x5e76ad,_0x3621d5,_0xc283a7,_0x59a6c9,_0x31f528;_0x25f62f=_[_0xe0a7('0x40')]({},_0x25f62f,_0x5e7187[_0xe0a7('0x41')]);return db[_0xe0a7('0x30')][_0xe0a7('0x55')](_0x25f62f)[_0xe0a7('0x24')](function(_0x292a25){if(_0x292a25){_0x5e76ad=_0x292a25;return _0x292a25[_0xe0a7('0x6e')]();}return null;})[_0xe0a7('0x24')](function(_0xbff78d){if(_0xbff78d){if(!_0xbff78d[_0xe0a7('0x4b')]){throw new db[(_0xe0a7('0x6f'))][(_0xe0a7('0x70'))]('Please\x20insert\x20at\x20least\x20one\x20field',0x193);}_0x3621d5=_0xbff78d;return db[_0xe0a7('0x72')][_0xe0a7('0x44')]({'raw':!![]});}return null;})[_0xe0a7('0x24')](function(_0x34590b){if(_0x34590b){_0xc283a7=_[_0xe0a7('0x73')](_0x34590b,'id');var _0x4e524c;var _0x3be979=squel[_0xe0a7('0x74')]();_0x3be979[_0xe0a7('0x75')](_0x5e76ad[_0xe0a7('0x83')]);for(var _0x26a89e=0x0;_0x26a89e<_0x3621d5[_0xe0a7('0x4b')];_0x26a89e+=0x1){_0x4e524c=_0x3621d5[_0x26a89e]['MetricId']?_0xc283a7[_0x3621d5[_0x26a89e]['MetricId']]['metric']:_0x3621d5[_0x26a89e]['field'];_0x4e524c=_0x3621d5[_0x26a89e][_0xe0a7('0x78')]?_['replace'](_0x4b605a[_0x3621d5[_0x26a89e][_0xe0a7('0x78')]],'%s',_0x4e524c):_0x4e524c;_0x4e524c=_0x3621d5[_0x26a89e][_0xe0a7('0x7a')]?_[_0xe0a7('0x79')](_0x5715b5[_0x3621d5[_0x26a89e][_0xe0a7('0x7a')]],'%s',_0x4e524c):_0x4e524c;if(_0x3621d5[_0x26a89e][_0xe0a7('0x8f')]){_0x3be979[_0xe0a7('0x6b')](_0x4e524c);}_0x3621d5[_0x26a89e]['orderBy']&&_0x3be979[_0xe0a7('0x3b')](_0x4e524c,_0x3621d5[_0x26a89e][_0xe0a7('0x7b')]===_0xe0a7('0x90')?![]:!![]);_0x3be979['field'](_0x4e524c,_0x3621d5[_0x26a89e]['alias']||_0x4e524c);}if(_0x5e76ad[_0xe0a7('0x7d')]){_0x5e76ad[_0xe0a7('0x7d')]=JSON[_0xe0a7('0x7e')](_0x5e76ad['joins']);for(var _0x50b2bd=0x0;_0x50b2bd<_0x5e76ad[_0xe0a7('0x7d')][_0xe0a7('0x4b')];_0x50b2bd+=0x1){if(_0x5e76ad['joins'][_0x50b2bd]['type']&&_['includes'](_0x397072,_0x5e76ad['joins'][_0x50b2bd]['type'])&&_0x5e76ad[_0xe0a7('0x7d')][_0x50b2bd]['parentKey']&&_0x5e76ad[_0xe0a7('0x7d')][_0x50b2bd][_0xe0a7('0x80')]&&_0x5e76ad[_0xe0a7('0x7d')][_0x50b2bd]['foreignKey']){_0x3be979[_0x5e76ad[_0xe0a7('0x7d')][_0x50b2bd][_0xe0a7('0x33')]](_0x5e76ad[_0xe0a7('0x7d')][_0x50b2bd]['foreignTable'],null,util[_0xe0a7('0x7a')](_0xe0a7('0x82'),_0x5e76ad[_0xe0a7('0x83')],_0x5e76ad[_0xe0a7('0x7d')][_0x50b2bd][_0xe0a7('0x7f')],_0x5e76ad[_0xe0a7('0x7d')][_0x50b2bd][_0xe0a7('0x80')],_0x5e76ad[_0xe0a7('0x7d')][_0x50b2bd][_0xe0a7('0x81')]));}}}if(_0x5e76ad[_0xe0a7('0x84')]){_0x5e76ad[_0xe0a7('0x84')]=JSON[_0xe0a7('0x7e')](_0x5e76ad[_0xe0a7('0x84')]);_0x3be979[_0xe0a7('0x3d')](_0x53175c(_0x5e76ad[_0xe0a7('0x84')]['group']));}_0x31f528=_0x3be979[_0xe0a7('0x85')]();_0x3be979[_0xe0a7('0x1f')](_0x3bcecb);_0x3be979['offset'](0x0);logger[_0xe0a7('0xa6')](_0xe0a7('0x86'),_0x3be979[_0xe0a7('0x87')]());return dbH[_0xe0a7('0x88')][_0xe0a7('0x35')](_0x3be979['toString'](),{'type':dbH[_0xe0a7('0x88')][_0xe0a7('0x89')][_0xe0a7('0x8a')]});}})[_0xe0a7('0x24')](function(){return{'sql':_0x31f528[_0xe0a7('0x87')]()};})[_0xe0a7('0x24')](respondWithResult(_0x4b803e,null))[_0xe0a7('0x46')](handleError(_0x4b803e,null));}; \ No newline at end of file diff --git a/server/api/analyticCustomReport/analyticCustomReport.model.js b/server/api/analyticCustomReport/analyticCustomReport.model.js index fe5caad..add4634 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 _0xc10d=['request-promise','path','rimraf','../../config/environment','exports','AnalyticCustomReport','analytics_custom_reports','lodash','util','api','bluebird'];(function(_0x50b204,_0x682e6b){var _0x3aeeb8=function(_0x5b7955){while(--_0x5b7955){_0x50b204['push'](_0x50b204['shift']());}};_0x3aeeb8(++_0x682e6b);}(_0xc10d,0x15c));var _0xdc10=function(_0x2ecc65,_0xd75c48){_0x2ecc65=_0x2ecc65-0x0;var _0x103cc3=_0xc10d[_0x2ecc65];return _0x103cc3;};'use strict';var _=require(_0xdc10('0x0'));var util=require(_0xdc10('0x1'));var logger=require('../../config/logger')(_0xdc10('0x2'));var moment=require('moment');var BPromise=require(_0xdc10('0x3'));var rp=require(_0xdc10('0x4'));var fs=require('fs');var path=require(_0xdc10('0x5'));var rimraf=require(_0xdc10('0x6'));var config=require(_0xdc10('0x7'));var attributes=require('./analyticCustomReport.attributes');module[_0xdc10('0x8')]=function(_0x48f5d8,_0x342488){return _0x48f5d8['define'](_0xdc10('0x9'),attributes,{'tableName':_0xdc10('0xa'),'paranoid':!![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x78cd=['util','../../config/logger','api','request-promise','path','./analyticCustomReport.attributes','exports','AnalyticCustomReport','lodash'];(function(_0x103b37,_0x14a4be){var _0x2e6a13=function(_0xa8ff9d){while(--_0xa8ff9d){_0x103b37['push'](_0x103b37['shift']());}};_0x2e6a13(++_0x14a4be);}(_0x78cd,0xe9));var _0xd78c=function(_0x67b075,_0x43557d){_0x67b075=_0x67b075-0x0;var _0x39d030=_0x78cd[_0x67b075];return _0x39d030;};'use strict';var _=require(_0xd78c('0x0'));var util=require(_0xd78c('0x1'));var logger=require(_0xd78c('0x2'))(_0xd78c('0x3'));var moment=require('moment');var BPromise=require('bluebird');var rp=require(_0xd78c('0x4'));var fs=require('fs');var path=require(_0xd78c('0x5'));var rimraf=require('rimraf');var config=require('../../config/environment');var attributes=require(_0xd78c('0x6'));module[_0xd78c('0x7')]=function(_0x2c59b4,_0x2adea6){return _0x2c59b4['define'](_0xd78c('0x8'),attributes,{'tableName':'analytics_custom_reports','paranoid':!![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/analyticCustomReport/analyticCustomReport.rpc.js b/server/api/analyticCustomReport/analyticCustomReport.rpc.js index 7e25edb..18997a8 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 _0x0ad0=['jayson/promise','http','request','then','info','request\x20sent','debug','AnalyticCustomReport,\x20%s,\x20%s,\x20%s','stringify','error','code','AnalyticCustomReport,\x20%s,\x20%s','message','catch','lodash','moment','randomstring','../../mysqldb','../../config/logger','rpc','../../config/environment'];(function(_0x35cc99,_0x5bb972){var _0x14373c=function(_0xb3feeb){while(--_0xb3feeb){_0x35cc99['push'](_0x35cc99['shift']());}};_0x14373c(++_0x5bb972);}(_0x0ad0,0x8c));var _0x00ad=function(_0x539272,_0x240862){_0x539272=_0x539272-0x0;var _0x5a212c=_0x0ad0[_0x539272];return _0x5a212c;};'use strict';var _=require(_0x00ad('0x0'));var util=require('util');var moment=require(_0x00ad('0x1'));var BPromise=require('bluebird');var rs=require(_0x00ad('0x2'));var fs=require('fs');var Redis=require('ioredis');var db=require(_0x00ad('0x3'))['db'];var utils=require('../../config/utils');var logger=require(_0x00ad('0x4'))(_0x00ad('0x5'));var config=require(_0x00ad('0x6'));var jayson=require(_0x00ad('0x7'));var client=jayson['client'][_0x00ad('0x8')]({'port':0x232a});function respondWithRpcPromise(_0x1461f0,_0x542e48,_0x4a01d5){return new BPromise(function(_0x5a12a1,_0x40cf41){return client[_0x00ad('0x9')](_0x1461f0,_0x4a01d5)[_0x00ad('0xa')](function(_0x2d8a89){logger[_0x00ad('0xb')]('AnalyticCustomReport,\x20%s,\x20%s',_0x542e48,_0x00ad('0xc'));logger[_0x00ad('0xd')](_0x00ad('0xe'),_0x542e48,'request\x20sent',JSON[_0x00ad('0xf')](_0x2d8a89));if(_0x2d8a89[_0x00ad('0x10')]){if(_0x2d8a89[_0x00ad('0x10')][_0x00ad('0x11')]===0x1f4){logger[_0x00ad('0x10')](_0x00ad('0x12'),_0x542e48,_0x2d8a89[_0x00ad('0x10')][_0x00ad('0x13')]);return _0x40cf41(_0x2d8a89[_0x00ad('0x10')]['message']);}logger['error']('AnalyticCustomReport,\x20%s,\x20%s',_0x542e48,_0x2d8a89[_0x00ad('0x10')]['message']);return _0x5a12a1(_0x2d8a89[_0x00ad('0x10')]['message']);}else{logger[_0x00ad('0xb')](_0x00ad('0x12'),_0x542e48,'request\x20sent');_0x5a12a1(_0x2d8a89['result'][_0x00ad('0x13')]);}})[_0x00ad('0x14')](function(_0x53a641){logger[_0x00ad('0x10')](_0x00ad('0x12'),_0x542e48,_0x53a641);_0x40cf41(_0x53a641);});});} \ No newline at end of file +var _0x4074=['error','code','message','result','catch','moment','bluebird','../../mysqldb','../../config/utils','../../config/logger','rpc','jayson/promise','http','request','then','info','AnalyticCustomReport,\x20%s,\x20%s','request\x20sent','AnalyticCustomReport,\x20%s,\x20%s,\x20%s','stringify'];(function(_0x160ba8,_0x30f1c6){var _0x548d3f=function(_0x2460bf){while(--_0x2460bf){_0x160ba8['push'](_0x160ba8['shift']());}};_0x548d3f(++_0x30f1c6);}(_0x4074,0x1bd));var _0x4407=function(_0xc28c9,_0x252634){_0xc28c9=_0xc28c9-0x0;var _0xbffc9a=_0x4074[_0xc28c9];return _0xbffc9a;};'use strict';var _=require('lodash');var util=require('util');var moment=require(_0x4407('0x0'));var BPromise=require(_0x4407('0x1'));var rs=require('randomstring');var fs=require('fs');var Redis=require('ioredis');var db=require(_0x4407('0x2'))['db'];var utils=require(_0x4407('0x3'));var logger=require(_0x4407('0x4'))(_0x4407('0x5'));var config=require('../../config/environment');var jayson=require(_0x4407('0x6'));var client=jayson['client'][_0x4407('0x7')]({'port':0x232a});function respondWithRpcPromise(_0x25d764,_0x315632,_0x1fbe29){return new BPromise(function(_0x580965,_0x1923d7){return client[_0x4407('0x8')](_0x25d764,_0x1fbe29)[_0x4407('0x9')](function(_0x2c3cae){logger[_0x4407('0xa')](_0x4407('0xb'),_0x315632,_0x4407('0xc'));logger['debug'](_0x4407('0xd'),_0x315632,'request\x20sent',JSON[_0x4407('0xe')](_0x2c3cae));if(_0x2c3cae[_0x4407('0xf')]){if(_0x2c3cae['error'][_0x4407('0x10')]===0x1f4){logger['error'](_0x4407('0xb'),_0x315632,_0x2c3cae['error']['message']);return _0x1923d7(_0x2c3cae['error'][_0x4407('0x11')]);}logger[_0x4407('0xf')]('AnalyticCustomReport,\x20%s,\x20%s',_0x315632,_0x2c3cae[_0x4407('0xf')]['message']);return _0x580965(_0x2c3cae['error']['message']);}else{logger[_0x4407('0xa')]('AnalyticCustomReport,\x20%s,\x20%s',_0x315632,_0x4407('0xc'));_0x580965(_0x2c3cae[_0x4407('0x12')]['message']);}})[_0x4407('0x13')](function(_0x24fc2d){logger[_0x4407('0xf')]('AnalyticCustomReport,\x20%s,\x20%s',_0x315632,_0x24fc2d);_0x1923d7(_0x24fc2d);});});} \ No newline at end of file diff --git a/server/api/analyticCustomReport/index.js b/server/api/analyticCustomReport/index.js index 641e3e6..b6d6c2a 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 _0x8212=['/:id/run','run','/:id/query','query','post','put','update','delete','exports','multer','util','path','connect-timeout','express','fs-extra','../../config/environment','./analyticCustomReport.controller','get','isAuthenticated','index','/:id','/:id/preview','preview'];(function(_0x1ae491,_0x5b83b9){var _0x4958a5=function(_0xf0f364){while(--_0xf0f364){_0x1ae491['push'](_0x1ae491['shift']());}};_0x4958a5(++_0x5b83b9);}(_0x8212,0x106));var _0x2821=function(_0x2cdf41,_0x4a277c){_0x2cdf41=_0x2cdf41-0x0;var _0x39a70e=_0x8212[_0x2cdf41];return _0x39a70e;};'use strict';var multer=require(_0x2821('0x0'));var util=require(_0x2821('0x1'));var path=require(_0x2821('0x2'));var timeout=require(_0x2821('0x3'));var express=require(_0x2821('0x4'));var router=express['Router']();var fs_extra=require(_0x2821('0x5'));var auth=require('../../components/auth/service');var interaction=require('../../components/interaction/service');var config=require(_0x2821('0x6'));var controller=require(_0x2821('0x7'));router[_0x2821('0x8')]('/',auth[_0x2821('0x9')](),controller[_0x2821('0xa')]);router[_0x2821('0x8')](_0x2821('0xb'),auth[_0x2821('0x9')](),controller['show']);router[_0x2821('0x8')](_0x2821('0xc'),auth['isAuthenticated'](),controller[_0x2821('0xd')]);router[_0x2821('0x8')](_0x2821('0xe'),auth[_0x2821('0x9')](),controller[_0x2821('0xf')]);router['get'](_0x2821('0x10'),auth[_0x2821('0x9')](),controller[_0x2821('0x11')]);router[_0x2821('0x12')]('/',auth[_0x2821('0x9')](),controller['create']);router[_0x2821('0x13')]('/:id',auth[_0x2821('0x9')](),controller[_0x2821('0x14')]);router[_0x2821('0x15')](_0x2821('0xb'),auth[_0x2821('0x9')](),controller['destroy']);module[_0x2821('0x16')]=router; \ No newline at end of file +var _0x6b4e=['Router','fs-extra','../../components/interaction/service','../../config/environment','isAuthenticated','index','get','/:id','show','preview','/:id/run','run','/:id/query','create','put','destroy','exports','util','connect-timeout','express'];(function(_0x1d4dda,_0x4b5f35){var _0x46c85f=function(_0x195717){while(--_0x195717){_0x1d4dda['push'](_0x1d4dda['shift']());}};_0x46c85f(++_0x4b5f35);}(_0x6b4e,0xed));var _0xe6b4=function(_0x537698,_0x4f17fa){_0x537698=_0x537698-0x0;var _0x5b827a=_0x6b4e[_0x537698];return _0x5b827a;};'use strict';var multer=require('multer');var util=require(_0xe6b4('0x0'));var path=require('path');var timeout=require(_0xe6b4('0x1'));var express=require(_0xe6b4('0x2'));var router=express[_0xe6b4('0x3')]();var fs_extra=require(_0xe6b4('0x4'));var auth=require('../../components/auth/service');var interaction=require(_0xe6b4('0x5'));var config=require(_0xe6b4('0x6'));var controller=require('./analyticCustomReport.controller');router['get']('/',auth[_0xe6b4('0x7')](),controller[_0xe6b4('0x8')]);router[_0xe6b4('0x9')](_0xe6b4('0xa'),auth[_0xe6b4('0x7')](),controller[_0xe6b4('0xb')]);router[_0xe6b4('0x9')]('/:id/preview',auth['isAuthenticated'](),controller[_0xe6b4('0xc')]);router[_0xe6b4('0x9')](_0xe6b4('0xd'),auth[_0xe6b4('0x7')](),controller[_0xe6b4('0xe')]);router[_0xe6b4('0x9')](_0xe6b4('0xf'),auth[_0xe6b4('0x7')](),controller['query']);router['post']('/',auth[_0xe6b4('0x7')](),controller[_0xe6b4('0x10')]);router[_0xe6b4('0x11')](_0xe6b4('0xa'),auth[_0xe6b4('0x7')](),controller['update']);router['delete'](_0xe6b4('0xa'),auth[_0xe6b4('0x7')](),controller[_0xe6b4('0x12')]);module[_0xe6b4('0x13')]=router; \ No newline at end of file diff --git a/server/api/analyticDefaultReport/analyticDefaultReport.attributes.js b/server/api/analyticDefaultReport/analyticDefaultReport.attributes.js index 308f87a..536a902 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 _0xeff8=['STRING','TEXT','sequelize','exports'];(function(_0x47042b,_0xff2de5){var _0x2315f5=function(_0x3e7b9a){while(--_0x3e7b9a){_0x47042b['push'](_0x47042b['shift']());}};_0x2315f5(++_0xff2de5);}(_0xeff8,0x186));var _0x8eff=function(_0x4b2863,_0x494899){_0x4b2863=_0x4b2863-0x0;var _0x567d67=_0xeff8[_0x4b2863];return _0x567d67;};'use strict';var Sequelize=require(_0x8eff('0x0'));module[_0x8eff('0x1')]={'name':{'type':Sequelize['STRING'],'allowNull':![]},'description':{'type':Sequelize[_0x8eff('0x2')]},'parent':{'type':Sequelize[_0x8eff('0x2')]},'table':{'type':Sequelize[_0x8eff('0x2')]},'conditions':{'type':Sequelize['TEXT']},'joins':{'type':Sequelize[_0x8eff('0x3')]}}; \ No newline at end of file +var _0x6aa7=['TEXT','sequelize','STRING'];(function(_0x5465e6,_0x2a8809){var _0x10044e=function(_0x1d5dcd){while(--_0x1d5dcd){_0x5465e6['push'](_0x5465e6['shift']());}};_0x10044e(++_0x2a8809);}(_0x6aa7,0x178));var _0x76aa=function(_0x1029a2,_0x22dc22){_0x1029a2=_0x1029a2-0x0;var _0x28fcbf=_0x6aa7[_0x1029a2];return _0x28fcbf;};'use strict';var Sequelize=require(_0x76aa('0x0'));module['exports']={'name':{'type':Sequelize[_0x76aa('0x1')],'allowNull':![]},'description':{'type':Sequelize[_0x76aa('0x1')]},'parent':{'type':Sequelize[_0x76aa('0x1')]},'table':{'type':Sequelize[_0x76aa('0x1')]},'conditions':{'type':Sequelize['TEXT']},'joins':{'type':Sequelize[_0x76aa('0x2')]}}; \ No newline at end of file diff --git a/server/api/analyticDefaultReport/analyticDefaultReport.controller.js b/server/api/analyticDefaultReport/analyticDefaultReport.controller.js index 2296ec3..7c98324 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 _0x46ed=['SEC_TO_TIME(%s)','value','AnalyticMetric','select','DESC','output','fullPath','%s-%s.%s','randomstring','csv','default','AnalyticExtractedReport','cdr','startDate','.createdAt\x20BETWEEN\x20?\x20AND\x20?','endDate','info','Run\x20Query:','child_process','../../files/reports','savename','countTable','COUNT(*)','sequelize','runReport','left_join','COUNT(%s)','MIN(%s)','AVG(%s)','Limited\x20Query:','eml-format','rimraf','fast-json-patch','request-promise','moment','mustache','util','sox','to-csv','ejs','fs-extra','lodash','squel','crypto','jsforce','desk.js','querystring','ioredis','../../components/auth/service','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/environment','../../mysqldb','status','end','json','offset','undefined','limit','count','set','Content-Range','apply','reject','save','update','then','get','DefaultReports','UserProfileResource','destroy','sendStatus','error','stack','name','send','index','map','AnalyticDefaultReport','rawAttributes','fieldName','type','model','query','keys','attributes','intersection','fields','length','hasOwnProperty','nolimit','sort','where','filters','pick','filter','merge','options','includeAll','include','findAll','catch','params','find','create','body','user','Reports','UserProfileSection','userProfileId','autoAssociation','preview','join','right_join','cross_join','SUM(%s)','COUNT(DISTINCT\x20%s)','MAX(%s)','GROUP_CONCAT(%s)','GROUP_CONCAT(%s\x20ORDER\x20BY\x20%s\x20ASC)','GROUP_CONCAT(%s\x20ORDER\x20BY\x20%s\x20DESC)','DATE(%s)','HOUR(%s)','ROUND(%s)','UNIX_TIMESTAMP(%s)','includes','IS\x20NULL','IS\x20NOT\x20NULL','IS\x20EMPTY','IS\x20NOT\x20EMPTY','rules','operator','group','field','condition','getFields','Sequelize','ValidationErrorItem','Please\x20insert\x20at\x20least\x20one\x20field','keyBy','from','table','MetricId','metric','function','replace','format','groupBy','orderBy','order','alias','joins','parentKey','foreignKey','foreignTable','%s.%s\x20=\x20%s.%s','conditions','parse','clone','toString','QueryTypes','SELECT'];(function(_0x5cce5a,_0x298d54){var _0x354e33=function(_0xb372cf){while(--_0xb372cf){_0x5cce5a['push'](_0x5cce5a['shift']());}};_0x354e33(++_0x298d54);}(_0x46ed,0x168));var _0xd46e=function(_0x321bb2,_0x202794){_0x321bb2=_0x321bb2-0x0;var _0x9c12ed=_0x46ed[_0x321bb2];return _0x9c12ed;};'use strict';var emlformat=require(_0xd46e('0x0'));var rimraf=require(_0xd46e('0x1'));var zipdir=require('zip-dir');var jsonpatch=require(_0xd46e('0x2'));var rp=require(_0xd46e('0x3'));var moment=require(_0xd46e('0x4'));var BPromise=require('bluebird');var Mustache=require(_0xd46e('0x5'));var util=require(_0xd46e('0x6'));var path=require('path');var sox=require(_0xd46e('0x7'));var csv=require(_0xd46e('0x8'));var ejs=require(_0xd46e('0x9'));var fs=require('fs');var fs_extra=require(_0xd46e('0xa'));var _=require(_0xd46e('0xb'));var squel=require(_0xd46e('0xc'));var crypto=require(_0xd46e('0xd'));var jsforce=require(_0xd46e('0xe'));var deskjs=require(_0xd46e('0xf'));var toCsv=require(_0xd46e('0x8'));var querystring=require(_0xd46e('0x10'));var Papa=require('papaparse');var Redis=require(_0xd46e('0x11'));var authService=require(_0xd46e('0x12'));var qs=require('../../components/parsers/qs');var as=require(_0xd46e('0x13'));var hardwareService=require(_0xd46e('0x14'));var logger=require(_0xd46e('0x15'))(_0xd46e('0x16'));var utils=require(_0xd46e('0x17'));var config=require(_0xd46e('0x18'));var licenseUtil=require('../../config/license/util');var db=require(_0xd46e('0x19'))['db'];var dbH=require('../../mysqldb')['dbH'];function respondWithStatusCode(_0xf3048c,_0x27dbfb){_0x27dbfb=_0x27dbfb||0xcc;return function(_0x53b309){if(_0x53b309){return _0xf3048c['sendStatus'](_0x27dbfb);}return _0xf3048c[_0xd46e('0x1a')](_0x27dbfb)[_0xd46e('0x1b')]();};}function respondWithResult(_0x1e9aae,_0x3fdf88){_0x3fdf88=_0x3fdf88||0xc8;return function(_0x50c7c3){if(_0x50c7c3){return _0x1e9aae[_0xd46e('0x1a')](_0x3fdf88)[_0xd46e('0x1c')](_0x50c7c3);}};}function respondWithFilteredResult(_0x417402,_0x3d72ce){return function(_0x36a317){if(_0x36a317){var _0x47fa8f=typeof _0x3d72ce[_0xd46e('0x1d')]===_0xd46e('0x1e')&&typeof _0x3d72ce[_0xd46e('0x1f')]==='undefined';var _0x5ddd04=_0x36a317[_0xd46e('0x20')];var _0x1bd574=_0x47fa8f?0x0:_0x3d72ce['offset'];var _0x4fd1f2=_0x47fa8f?_0x36a317[_0xd46e('0x20')]:_0x3d72ce[_0xd46e('0x1d')]+_0x3d72ce[_0xd46e('0x1f')];var _0x2273c5;if(_0x4fd1f2>=_0x5ddd04){_0x4fd1f2=_0x5ddd04;_0x2273c5=0xc8;}else{_0x2273c5=0xce;}_0x417402[_0xd46e('0x1a')](_0x2273c5);return _0x417402[_0xd46e('0x21')](_0xd46e('0x22'),_0x1bd574+'-'+_0x4fd1f2+'/'+_0x5ddd04)[_0xd46e('0x1c')](_0x36a317);}return null;};}function patchUpdates(_0xb4940){return function(_0x3c7e91){try{jsonpatch[_0xd46e('0x23')](_0x3c7e91,_0xb4940,!![]);}catch(_0x5ba94d){return BPromise[_0xd46e('0x24')](_0x5ba94d);}return _0x3c7e91[_0xd46e('0x25')]();};}function saveUpdates(_0x79aa51,_0x45ce0b){return function(_0x128246){if(_0x128246){return _0x128246[_0xd46e('0x26')](_0x79aa51)[_0xd46e('0x27')](function(_0x8a1be){return _0x8a1be;});}return null;};}function removeEntity(_0x62dea5,_0x4cf899){return function(_0x314570){if(_0x314570){return _0x314570['destroy']()['then'](function(){var _0x371054=_0x314570[_0xd46e('0x28')]({'plain':!![]});var _0x21135f=_0xd46e('0x29');return db[_0xd46e('0x2a')][_0xd46e('0x2b')]({'where':{'type':_0x21135f,'resourceId':_0x371054['id']}})[_0xd46e('0x27')](function(){return _0x314570;});})['then'](function(){_0x62dea5[_0xd46e('0x1a')](0xcc)[_0xd46e('0x1b')]();});}};}function handleEntityNotFound(_0xddbce9,_0x17db79){return function(_0x96f15c){if(!_0x96f15c){_0xddbce9[_0xd46e('0x2c')](0x194);}return _0x96f15c;};}function handleError(_0x58aeef,_0x465d54){_0x465d54=_0x465d54||0x1f4;return function(_0x3a1ced){logger[_0xd46e('0x2d')](_0x3a1ced[_0xd46e('0x2e')]);if(_0x3a1ced[_0xd46e('0x2f')]){delete _0x3a1ced[_0xd46e('0x2f')];}_0x58aeef[_0xd46e('0x1a')](_0x465d54)[_0xd46e('0x30')](_0x3a1ced);};}exports[_0xd46e('0x31')]=function(_0x45ea47,_0x2ff785){var _0x504324={},_0x2f4a1b={},_0x5ed8dc={'count':0x0,'rows':[]};var _0x1248ce=_[_0xd46e('0x32')](db[_0xd46e('0x33')][_0xd46e('0x34')],function(_0x5ef248){return{'name':_0x5ef248[_0xd46e('0x35')],'type':_0x5ef248[_0xd46e('0x36')]['key']};});_0x2f4a1b[_0xd46e('0x37')]=_[_0xd46e('0x32')](_0x1248ce,'name');_0x2f4a1b[_0xd46e('0x38')]=_[_0xd46e('0x39')](_0x45ea47[_0xd46e('0x38')]);_0x2f4a1b['filters']=_['intersection'](_0x2f4a1b[_0xd46e('0x37')],_0x2f4a1b[_0xd46e('0x38')]);_0x504324[_0xd46e('0x3a')]=_[_0xd46e('0x3b')](_0x2f4a1b[_0xd46e('0x37')],qs[_0xd46e('0x3c')](_0x45ea47[_0xd46e('0x38')][_0xd46e('0x3c')]));_0x504324['attributes']=_0x504324[_0xd46e('0x3a')][_0xd46e('0x3d')]?_0x504324[_0xd46e('0x3a')]:_0x2f4a1b[_0xd46e('0x37')];if(!_0x45ea47[_0xd46e('0x38')][_0xd46e('0x3e')](_0xd46e('0x3f'))){_0x504324['limit']=qs[_0xd46e('0x1f')](_0x45ea47[_0xd46e('0x38')]['limit']);_0x504324[_0xd46e('0x1d')]=qs[_0xd46e('0x1d')](_0x45ea47[_0xd46e('0x38')][_0xd46e('0x1d')]);}_0x504324['order']=qs[_0xd46e('0x40')](_0x45ea47[_0xd46e('0x38')][_0xd46e('0x40')]);_0x504324[_0xd46e('0x41')]=qs[_0xd46e('0x42')](_[_0xd46e('0x43')](_0x45ea47[_0xd46e('0x38')],_0x2f4a1b[_0xd46e('0x42')]),_0x1248ce);if(_0x45ea47['query'][_0xd46e('0x44')]){_0x504324[_0xd46e('0x41')]=_[_0xd46e('0x45')](_0x504324[_0xd46e('0x41')],{'$or':_[_0xd46e('0x32')](_0x1248ce,function(_0x56f99c){if(_0x56f99c[_0xd46e('0x36')]!=='VIRTUAL'){var _0x55230d={};_0x55230d[_0x56f99c['name']]={'$like':'%'+_0x45ea47['query'][_0xd46e('0x44')]+'%'};return _0x55230d;}})});}_0x504324=_['merge']({},_0x504324,_0x45ea47[_0xd46e('0x46')]);var _0x40720e={'where':_0x504324['where']};return db[_0xd46e('0x33')][_0xd46e('0x20')](_0x40720e)[_0xd46e('0x27')](function(_0x31ba12){_0x5ed8dc[_0xd46e('0x20')]=_0x31ba12;if(_0x45ea47[_0xd46e('0x38')][_0xd46e('0x47')]){_0x504324[_0xd46e('0x48')]=[{'all':!![]}];}return db[_0xd46e('0x33')][_0xd46e('0x49')](_0x504324);})[_0xd46e('0x27')](function(_0x5ea048){_0x5ed8dc['rows']=_0x5ea048;return _0x5ed8dc;})['then'](respondWithFilteredResult(_0x2ff785,_0x504324))[_0xd46e('0x4a')](handleError(_0x2ff785,null));};exports['show']=function(_0x168d35,_0x272f5f){var _0x3fdf67={'raw':!![],'where':{'id':_0x168d35[_0xd46e('0x4b')]['id']}},_0x416505={};_0x416505[_0xd46e('0x37')]=_[_0xd46e('0x39')](db[_0xd46e('0x33')]['rawAttributes']);_0x416505[_0xd46e('0x38')]=_['keys'](_0x168d35[_0xd46e('0x38')]);_0x416505[_0xd46e('0x42')]=_[_0xd46e('0x3b')](_0x416505[_0xd46e('0x37')],_0x416505[_0xd46e('0x38')]);_0x3fdf67['attributes']=_[_0xd46e('0x3b')](_0x416505[_0xd46e('0x37')],qs[_0xd46e('0x3c')](_0x168d35[_0xd46e('0x38')][_0xd46e('0x3c')]));_0x3fdf67['attributes']=_0x3fdf67[_0xd46e('0x3a')][_0xd46e('0x3d')]?_0x3fdf67[_0xd46e('0x3a')]:_0x416505[_0xd46e('0x37')];if(_0x168d35[_0xd46e('0x38')]['includeAll']){_0x3fdf67[_0xd46e('0x48')]=[{'all':!![]}];}_0x3fdf67=_[_0xd46e('0x45')]({},_0x3fdf67,_0x168d35[_0xd46e('0x46')]);return db[_0xd46e('0x33')][_0xd46e('0x4c')](_0x3fdf67)[_0xd46e('0x27')](handleEntityNotFound(_0x272f5f,null))[_0xd46e('0x27')](respondWithResult(_0x272f5f,null))[_0xd46e('0x4a')](handleError(_0x272f5f,null));};exports['create']=function(_0xf9dab,_0x71a8dc){return db[_0xd46e('0x33')][_0xd46e('0x4d')](_0xf9dab[_0xd46e('0x4e')],{})['then'](function(_0x4ae314){var _0x3a94cf=_0xf9dab[_0xd46e('0x4f')][_0xd46e('0x28')]({'plain':!![]});if(!_0x3a94cf)throw new Error('Unable\x20to\x20retrieve\x20the\x20current\x20user');if(_0x3a94cf['role']===_0xd46e('0x4f')){var _0x9d8638=_0x4ae314['get']({'plain':!![]});var _0x2eee92=_0xd46e('0x50');return db[_0xd46e('0x51')][_0xd46e('0x4c')]({'where':{'name':_0x2eee92,'userProfileId':_0x3a94cf[_0xd46e('0x52')]},'raw':!![]})[_0xd46e('0x27')](function(_0x80ed51){if(_0x80ed51&&_0x80ed51[_0xd46e('0x53')]===0x0){return db['UserProfileResource'][_0xd46e('0x4d')]({'name':_0x9d8638[_0xd46e('0x2f')],'resourceId':_0x9d8638['id'],'type':_0xd46e('0x29'),'sectionId':_0x80ed51['id']},{})[_0xd46e('0x27')](function(){return _0x4ae314;});}else{return _0x4ae314;}})['catch'](function(_0x56dd9a){logger[_0xd46e('0x2d')]('Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s',_0x56dd9a);throw _0x56dd9a;});}return _0x4ae314;})[_0xd46e('0x27')](respondWithResult(_0x71a8dc,0xc9))[_0xd46e('0x4a')](handleError(_0x71a8dc,null));};exports[_0xd46e('0x26')]=function(_0x31f7eb,_0x5a7870){if(_0x31f7eb[_0xd46e('0x4e')]['id']){delete _0x31f7eb['body']['id'];}return db[_0xd46e('0x33')][_0xd46e('0x4c')]({'where':{'id':_0x31f7eb[_0xd46e('0x4b')]['id']}})['then'](handleEntityNotFound(_0x5a7870,null))[_0xd46e('0x27')](saveUpdates(_0x31f7eb[_0xd46e('0x4e')],null))[_0xd46e('0x27')](respondWithResult(_0x5a7870,null))[_0xd46e('0x4a')](handleError(_0x5a7870,null));};exports[_0xd46e('0x2b')]=function(_0x2cc676,_0x2760ef){return db[_0xd46e('0x33')][_0xd46e('0x4c')]({'where':{'id':_0x2cc676[_0xd46e('0x4b')]['id']}})[_0xd46e('0x27')](handleEntityNotFound(_0x2760ef,null))[_0xd46e('0x27')](removeEntity(_0x2760ef,null))[_0xd46e('0x4a')](handleError(_0x2760ef,null));};exports[_0xd46e('0x54')]=function(_0x47a86c,_0x3ec709){var _0x37a22f=0xa;var _0xe0cd61=[_0xd46e('0x55'),'left_join',_0xd46e('0x56'),_0xd46e('0x57')];var _0xaf9641={'SUM':_0xd46e('0x58'),'COUNT':'COUNT(%s)','COUNT DISTINCT':_0xd46e('0x59'),'MAX':_0xd46e('0x5a'),'MIN':'MIN(%s)','AVG':'AVG(%s)','GROUP_CONCAT':_0xd46e('0x5b'),'GROUP_CONCAT ASC':_0xd46e('0x5c'),'GROUP_CONCAT DESC':_0xd46e('0x5d')};var _0x481dce={'SEC_TO_TIME':'SEC_TO_TIME(%s)','DATE':_0xd46e('0x5e'),'HOUR':_0xd46e('0x5f'),'ROUND':_0xd46e('0x60'),'UNIX_TIMESTAMP':_0xd46e('0x61')};var _0x2dacb4=function(_0x2f9fcb){return!_[_0xd46e('0x62')]([_0xd46e('0x63'),_0xd46e('0x64'),_0xd46e('0x65'),_0xd46e('0x66')],_0x2f9fcb);};var _0x1aaa99=function(_0x272514){if(!_0x272514||!_0x272514[_0xd46e('0x67')][_0xd46e('0x3d')]){return'';}for(var _0x476f09='(',_0x5067b7=0x0;_0x5067b7<_0x272514[_0xd46e('0x67')][_0xd46e('0x3d')];_0x5067b7+=0x1){_0x5067b7>0x0&&(_0x476f09+='\x20'+_0x272514[_0xd46e('0x68')]+'\x20');_0x476f09+=_0x272514['rules'][_0x5067b7][_0xd46e('0x69')]?_0x1aaa99(_0x272514[_0xd46e('0x67')][_0x5067b7]['group']):_0x272514[_0xd46e('0x67')][_0x5067b7][_0xd46e('0x6a')]+'\x20'+_0x272514[_0xd46e('0x67')][_0x5067b7]['condition']+(_0x2dacb4(_0x272514[_0xd46e('0x67')][_0x5067b7][_0xd46e('0x6b')])?'\x20'+_0x272514[_0xd46e('0x67')][_0x5067b7]['value']:'');}return _0x476f09+')';};var _0xe5f8cd={'where':{'id':_0x47a86c[_0xd46e('0x4b')]['id']}},_0x516e7d,_0x32eed0,_0x148187,_0x35db1b,_0x4f3ba0;_0xe5f8cd=_[_0xd46e('0x45')]({},_0xe5f8cd,_0x47a86c[_0xd46e('0x46')]);return db[_0xd46e('0x33')][_0xd46e('0x4c')](_0xe5f8cd)[_0xd46e('0x27')](function(_0x16f906){if(_0x16f906){_0x516e7d=_0x16f906;return _0x16f906[_0xd46e('0x6c')]();}return null;})[_0xd46e('0x27')](function(_0x3e55a3){if(_0x3e55a3){if(!_0x3e55a3[_0xd46e('0x3d')]){throw new db[(_0xd46e('0x6d'))][(_0xd46e('0x6e'))](_0xd46e('0x6f'),0x193);}_0x32eed0=_0x3e55a3;return db['AnalyticMetric']['findAll']({'raw':!![]});}return null;})[_0xd46e('0x27')](function(_0x3e0ed5){if(_0x3e0ed5){_0x148187=_[_0xd46e('0x70')](_0x3e0ed5,'id');var _0x2fff69;var _0x249938=squel['select']();_0x249938[_0xd46e('0x71')](_0x516e7d[_0xd46e('0x72')]);for(var _0xfb4073=0x0;_0xfb4073<_0x32eed0[_0xd46e('0x3d')];_0xfb4073+=0x1){_0x2fff69=_0x32eed0[_0xfb4073]['MetricId']?_0x148187[_0x32eed0[_0xfb4073][_0xd46e('0x73')]][_0xd46e('0x74')]:_0x32eed0[_0xfb4073]['field'];_0x2fff69=_0x32eed0[_0xfb4073][_0xd46e('0x75')]?_[_0xd46e('0x76')](_0xaf9641[_0x32eed0[_0xfb4073]['function']],'%s',_0x2fff69):_0x2fff69;_0x2fff69=_0x32eed0[_0xfb4073][_0xd46e('0x77')]?_[_0xd46e('0x76')](_0x481dce[_0x32eed0[_0xfb4073]['format']],'%s',_0x2fff69):_0x2fff69;if(_0x32eed0[_0xfb4073][_0xd46e('0x78')]){_0x249938['group'](_0x2fff69);}_0x32eed0[_0xfb4073][_0xd46e('0x79')]&&_0x249938[_0xd46e('0x7a')](_0x2fff69,_0x32eed0[_0xfb4073]['orderBy']==='DESC'?![]:!![]);_0x249938[_0xd46e('0x6a')](_0x2fff69,_0x32eed0[_0xfb4073][_0xd46e('0x7b')]||_0x2fff69);}if(_0x516e7d[_0xd46e('0x7c')]){_0x516e7d[_0xd46e('0x7c')]=JSON['parse'](_0x516e7d[_0xd46e('0x7c')]);for(var _0x372509=0x0;_0x372509<_0x516e7d['joins'][_0xd46e('0x3d')];_0x372509+=0x1){if(_0x516e7d[_0xd46e('0x7c')][_0x372509][_0xd46e('0x36')]&&_[_0xd46e('0x62')](_0xe0cd61,_0x516e7d[_0xd46e('0x7c')][_0x372509][_0xd46e('0x36')])&&_0x516e7d[_0xd46e('0x7c')][_0x372509][_0xd46e('0x7d')]&&_0x516e7d[_0xd46e('0x7c')][_0x372509]['foreignTable']&&_0x516e7d[_0xd46e('0x7c')][_0x372509][_0xd46e('0x7e')]){_0x249938[_0x516e7d['joins'][_0x372509][_0xd46e('0x36')]](_0x516e7d[_0xd46e('0x7c')][_0x372509][_0xd46e('0x7f')],null,util[_0xd46e('0x77')](_0xd46e('0x80'),_0x516e7d[_0xd46e('0x72')],_0x516e7d['joins'][_0x372509]['parentKey'],_0x516e7d[_0xd46e('0x7c')][_0x372509][_0xd46e('0x7f')],_0x516e7d['joins'][_0x372509]['foreignKey']));}}}if(_0x516e7d['conditions']){_0x516e7d[_0xd46e('0x81')]=JSON[_0xd46e('0x82')](_0x516e7d[_0xd46e('0x81')]);_0x249938['where'](_0x1aaa99(_0x516e7d[_0xd46e('0x81')][_0xd46e('0x69')]));}_0x4f3ba0=_0x249938[_0xd46e('0x83')]();_0x249938['limit'](_0x37a22f);_0x249938['offset'](0x0);logger['debug']('Limited\x20Query:',_0x249938[_0xd46e('0x84')]());return dbH['sequelize'][_0xd46e('0x38')](_0x249938['toString'](),{'type':dbH['sequelize'][_0xd46e('0x85')][_0xd46e('0x86')]});}})[_0xd46e('0x27')](respondWithResult(_0x3ec709,null))[_0xd46e('0x4a')](handleError(_0x3ec709,null));};function runReport(_0xf16d87,_0x99872a,_0x57a7cc){var _0x586024=_0x99872a[_0xd46e('0x2f')];var _0x383919=0xa;var _0x114f2c=[_0xd46e('0x55'),'left_join',_0xd46e('0x56'),_0xd46e('0x57')];var _0x4ca21f={'SUM':_0xd46e('0x58'),'COUNT':'COUNT(%s)','COUNT DISTINCT':_0xd46e('0x59'),'MAX':_0xd46e('0x5a'),'MIN':'MIN(%s)','AVG':'AVG(%s)','GROUP_CONCAT':_0xd46e('0x5b'),'GROUP_CONCAT ASC':_0xd46e('0x5c'),'GROUP_CONCAT DESC':_0xd46e('0x5d')};var _0x5ef4cc={'SEC_TO_TIME':_0xd46e('0x87'),'DATE':_0xd46e('0x5e'),'HOUR':_0xd46e('0x5f'),'ROUND':_0xd46e('0x60'),'UNIX_TIMESTAMP':_0xd46e('0x61')};var _0x88460a=function(_0x3a3744){return!_[_0xd46e('0x62')]([_0xd46e('0x63'),_0xd46e('0x64'),_0xd46e('0x65'),_0xd46e('0x66')],_0x3a3744);};var _0x3c476d=function(_0x1b2a6d){if(!_0x1b2a6d||!_0x1b2a6d[_0xd46e('0x67')][_0xd46e('0x3d')]){return'';}for(var _0x441f73='(',_0x1d2738=0x0;_0x1d2738<_0x1b2a6d['rules'][_0xd46e('0x3d')];_0x1d2738+=0x1){_0x1d2738>0x0&&(_0x441f73+='\x20'+_0x1b2a6d['operator']+'\x20');_0x441f73+=_0x1b2a6d[_0xd46e('0x67')][_0x1d2738][_0xd46e('0x69')]?_0x3c476d(_0x1b2a6d['rules'][_0x1d2738][_0xd46e('0x69')]):_0x1b2a6d[_0xd46e('0x67')][_0x1d2738][_0xd46e('0x6a')]+'\x20'+_0x1b2a6d[_0xd46e('0x67')][_0x1d2738][_0xd46e('0x6b')]+(_0x88460a(_0x1b2a6d[_0xd46e('0x67')][_0x1d2738][_0xd46e('0x6b')])?'\x20'+_0x1b2a6d[_0xd46e('0x67')][_0x1d2738][_0xd46e('0x88')]:'');}return _0x441f73+')';};var _0x3fa34d={'where':{'id':_0xf16d87['id']}},_0xc098c9,_0x5f5ba7,_0x493df5,_0x18e140,_0x459a0c;_0x3fa34d=_[_0xd46e('0x45')]({},_0x3fa34d,_0x57a7cc);return db[_0xd46e('0x33')][_0xd46e('0x4c')](_0x3fa34d)[_0xd46e('0x27')](function(_0x5b554e){if(_0x5b554e){_0xc098c9=_0x5b554e;return _0x5b554e[_0xd46e('0x6c')]();}return null;})[_0xd46e('0x27')](function(_0xa254f5){if(_0xa254f5){if(!_0xa254f5[_0xd46e('0x3d')]){throw new db[(_0xd46e('0x6d'))][(_0xd46e('0x6e'))]('Please\x20insert\x20at\x20least\x20one\x20field',0x193);}_0x5f5ba7=_0xa254f5;return db[_0xd46e('0x89')][_0xd46e('0x49')]({'raw':!![]});}return null;})['then'](function(_0x3c8d68){if(_0x3c8d68){_0x493df5=_[_0xd46e('0x70')](_0x3c8d68,'id');var _0x9e222d;var _0x3da17e=squel[_0xd46e('0x8a')]();_0x3da17e[_0xd46e('0x71')](_0xc098c9[_0xd46e('0x72')]);for(var _0x282f71=0x0;_0x282f71<_0x5f5ba7[_0xd46e('0x3d')];_0x282f71+=0x1){_0x9e222d=_0x5f5ba7[_0x282f71][_0xd46e('0x73')]?_0x493df5[_0x5f5ba7[_0x282f71][_0xd46e('0x73')]][_0xd46e('0x74')]:_0x5f5ba7[_0x282f71][_0xd46e('0x6a')];_0x9e222d=_0x5f5ba7[_0x282f71][_0xd46e('0x75')]?_['replace'](_0x4ca21f[_0x5f5ba7[_0x282f71]['function']],'%s',_0x9e222d):_0x9e222d;_0x9e222d=_0x5f5ba7[_0x282f71][_0xd46e('0x77')]?_[_0xd46e('0x76')](_0x5ef4cc[_0x5f5ba7[_0x282f71][_0xd46e('0x77')]],'%s',_0x9e222d):_0x9e222d;if(_0x5f5ba7[_0x282f71][_0xd46e('0x78')]){_0x3da17e[_0xd46e('0x69')](_0x9e222d);}_0x5f5ba7[_0x282f71][_0xd46e('0x79')]&&_0x3da17e['order'](_0x9e222d,_0x5f5ba7[_0x282f71][_0xd46e('0x79')]===_0xd46e('0x8b')?![]:!![]);_0x3da17e[_0xd46e('0x6a')](_0x9e222d,_0x5f5ba7[_0x282f71][_0xd46e('0x7b')]||_0x9e222d);}if(_0xc098c9['joins']){_0xc098c9[_0xd46e('0x7c')]=JSON[_0xd46e('0x82')](_0xc098c9['joins']);for(var _0xdf967c=0x0;_0xdf967c<_0xc098c9['joins']['length'];_0xdf967c+=0x1){if(_0xc098c9[_0xd46e('0x7c')][_0xdf967c][_0xd46e('0x36')]&&_[_0xd46e('0x62')](_0x114f2c,_0xc098c9[_0xd46e('0x7c')][_0xdf967c]['type'])&&_0xc098c9['joins'][_0xdf967c][_0xd46e('0x7d')]&&_0xc098c9['joins'][_0xdf967c][_0xd46e('0x7f')]&&_0xc098c9['joins'][_0xdf967c]['foreignKey']){_0x3da17e[_0xc098c9[_0xd46e('0x7c')][_0xdf967c][_0xd46e('0x36')]](_0xc098c9['joins'][_0xdf967c]['foreignTable'],null,util[_0xd46e('0x77')](_0xd46e('0x80'),_0xc098c9[_0xd46e('0x72')],_0xc098c9[_0xd46e('0x7c')][_0xdf967c]['parentKey'],_0xc098c9[_0xd46e('0x7c')][_0xdf967c][_0xd46e('0x7f')],_0xc098c9['joins'][_0xdf967c][_0xd46e('0x7e')]));}}}if(_0xc098c9[_0xd46e('0x81')]){_0xc098c9[_0xd46e('0x81')]=JSON[_0xd46e('0x82')](_0xc098c9[_0xd46e('0x81')]);_0x3da17e[_0xd46e('0x41')](_0x3c476d(_0xc098c9['conditions'][_0xd46e('0x69')]));}_0x459a0c=_0x3da17e[_0xd46e('0x83')]();_0x3da17e['limit'](_0x383919);_0x3da17e['offset'](0x0);return;}})[_0xd46e('0x27')](function(){if(_0x99872a[_0xd46e('0x8c')]==='web'){return null;}var _0x5e637d=_[_0xd46e('0x45')](_0x99872a,{'name':_0x99872a[_0xd46e('0x8d')]||_0x99872a['name']||_0xc098c9[_0xd46e('0x2f')],'basename':_0x586024,'savename':util[_0xd46e('0x77')](_0xd46e('0x8e'),_0x99872a[_0xd46e('0x2f')]||_0xc098c9[_0xd46e('0x2f')],require(_0xd46e('0x8f'))['generate'](0x4),_0x99872a[_0xd46e('0x8c')]||_0xd46e('0x90')),'reportId':_0xc098c9['id'],'reportType':_0xd46e('0x91')});return db[_0xd46e('0x92')][_0xd46e('0x4d')](_0x5e637d,{'raw':!![]});})[_0xd46e('0x27')](function(_0x3311a6){if(_0xc098c9[_0xd46e('0x72')]===_0xd46e('0x93')){_0x459a0c[_0xd46e('0x41')](_0xc098c9[_0xd46e('0x72')]+'.calldate\x20BETWEEN\x20?\x20AND\x20?',_0x99872a[_0xd46e('0x94')],_0x99872a['endDate']);}else{_0x459a0c['where'](_0xc098c9[_0xd46e('0x72')]+_0xd46e('0x95'),_0x99872a[_0xd46e('0x94')],_0x99872a[_0xd46e('0x96')]);}if(_0x3311a6){logger[_0xd46e('0x97')](_0xd46e('0x98'),_0x459a0c[_0xd46e('0x84')]());require(_0xd46e('0x99'))['fork'](path[_0xd46e('0x55')](__dirname,'../../components/export/',_0x3311a6[_0xd46e('0x8c')]),[_0x3311a6['id'],_0x459a0c[_0xd46e('0x84')](),path[_0xd46e('0x55')](__dirname,_0xd46e('0x9a'),_0x3311a6[_0xd46e('0x9b')]),_0x586024]);return _0x3311a6;}else{var _0x399918=squel[_0xd46e('0x8a')]();_0x399918[_0xd46e('0x71')]('('+_0x459a0c['toString']()+')',_0xd46e('0x9c'));_0x399918[_0xd46e('0x6a')](_0xd46e('0x9d'),'count');_0x459a0c[_0xd46e('0x1f')](_0x99872a[_0xd46e('0x1f')]||_0x383919);_0x459a0c[_0xd46e('0x1d')](_0x99872a['offset']||0x0);return dbH[_0xd46e('0x9e')][_0xd46e('0x38')](_0x399918[_0xd46e('0x84')](),{'type':dbH[_0xd46e('0x9e')][_0xd46e('0x85')][_0xd46e('0x86')]})['then'](function(_0x4967ff){if(!_0x4967ff[_0xd46e('0x3d')]){_0x18e140=0x0;}else{_0x18e140=_0x4967ff[0x0][_0xd46e('0x20')]||0x0;}return dbH['sequelize'][_0xd46e('0x38')](_0x459a0c[_0xd46e('0x84')](),{'type':dbH[_0xd46e('0x9e')][_0xd46e('0x85')][_0xd46e('0x86')]});})[_0xd46e('0x27')](function(_0x4bb76b){return{'rows':_0x4bb76b||[],'count':_0x18e140};});}});}exports['run']=function(_0x204a9f,_0x52ca5a){return runReport(_0x204a9f[_0xd46e('0x4b')],_0x204a9f[_0xd46e('0x38')],_0x204a9f['options'])[_0xd46e('0x27')](respondWithResult(_0x52ca5a,null))[_0xd46e('0x4a')](handleError(_0x52ca5a,null));};exports[_0xd46e('0x9f')]=runReport;exports[_0xd46e('0x38')]=function(_0x786ae,_0x537c73){var _0x1610bd=0xa;var _0x20cc4c=[_0xd46e('0x55'),_0xd46e('0xa0'),_0xd46e('0x56'),_0xd46e('0x57')];var _0x368742={'SUM':_0xd46e('0x58'),'COUNT':_0xd46e('0xa1'),'COUNT DISTINCT':_0xd46e('0x59'),'MAX':_0xd46e('0x5a'),'MIN':_0xd46e('0xa2'),'AVG':_0xd46e('0xa3'),'GROUP_CONCAT':_0xd46e('0x5b'),'GROUP_CONCAT ASC':'GROUP_CONCAT(%s\x20ORDER\x20BY\x20%s\x20ASC)','GROUP_CONCAT DESC':_0xd46e('0x5d')};var _0x285cf8={'SEC_TO_TIME':'SEC_TO_TIME(%s)','DATE':_0xd46e('0x5e'),'HOUR':_0xd46e('0x5f'),'ROUND':_0xd46e('0x60'),'UNIX_TIMESTAMP':'UNIX_TIMESTAMP(%s)'};var _0xc87da2=function(_0x195f02){return!_[_0xd46e('0x62')]([_0xd46e('0x63'),'IS\x20NOT\x20NULL',_0xd46e('0x65'),_0xd46e('0x66')],_0x195f02);};var _0x44322f=function(_0x49959f){if(!_0x49959f||!_0x49959f['rules'][_0xd46e('0x3d')]){return'';}for(var _0x2094e5='(',_0x85aac1=0x0;_0x85aac1<_0x49959f[_0xd46e('0x67')][_0xd46e('0x3d')];_0x85aac1+=0x1){_0x85aac1>0x0&&(_0x2094e5+='\x20'+_0x49959f[_0xd46e('0x68')]+'\x20');_0x2094e5+=_0x49959f['rules'][_0x85aac1][_0xd46e('0x69')]?_0x44322f(_0x49959f['rules'][_0x85aac1][_0xd46e('0x69')]):_0x49959f['rules'][_0x85aac1][_0xd46e('0x6a')]+'\x20'+_0x49959f['rules'][_0x85aac1]['condition']+(_0xc87da2(_0x49959f[_0xd46e('0x67')][_0x85aac1][_0xd46e('0x6b')])?'\x20'+_0x49959f[_0xd46e('0x67')][_0x85aac1][_0xd46e('0x88')]:'');}return _0x2094e5+')';};var _0x101a29={'where':{'id':_0x786ae[_0xd46e('0x4b')]['id']}},_0x3a44da,_0x417068,_0x52e73e,_0x206077,_0xe729b6;_0x101a29=_[_0xd46e('0x45')]({},_0x101a29,_0x786ae[_0xd46e('0x46')]);return db['AnalyticDefaultReport'][_0xd46e('0x4c')](_0x101a29)[_0xd46e('0x27')](function(_0x1d08bb){if(_0x1d08bb){_0x3a44da=_0x1d08bb;return _0x1d08bb['getFields']();}return null;})[_0xd46e('0x27')](function(_0x8c6ed1){if(_0x8c6ed1){if(!_0x8c6ed1['length']){throw new db['Sequelize']['ValidationErrorItem'](_0xd46e('0x6f'),0x193);}_0x417068=_0x8c6ed1;return db[_0xd46e('0x89')]['findAll']({'raw':!![]});}return null;})[_0xd46e('0x27')](function(_0x3a13f8){if(_0x3a13f8){_0x52e73e=_['keyBy'](_0x3a13f8,'id');var _0x5a8661;var _0x157fb0=squel[_0xd46e('0x8a')]();_0x157fb0[_0xd46e('0x71')](_0x3a44da[_0xd46e('0x72')]);for(var _0x50750f=0x0;_0x50750f<_0x417068['length'];_0x50750f+=0x1){_0x5a8661=_0x417068[_0x50750f][_0xd46e('0x73')]?_0x52e73e[_0x417068[_0x50750f][_0xd46e('0x73')]][_0xd46e('0x74')]:_0x417068[_0x50750f][_0xd46e('0x6a')];_0x5a8661=_0x417068[_0x50750f][_0xd46e('0x75')]?_[_0xd46e('0x76')](_0x368742[_0x417068[_0x50750f][_0xd46e('0x75')]],'%s',_0x5a8661):_0x5a8661;_0x5a8661=_0x417068[_0x50750f]['format']?_[_0xd46e('0x76')](_0x285cf8[_0x417068[_0x50750f][_0xd46e('0x77')]],'%s',_0x5a8661):_0x5a8661;if(_0x417068[_0x50750f]['groupBy']){_0x157fb0[_0xd46e('0x69')](_0x5a8661);}_0x417068[_0x50750f][_0xd46e('0x79')]&&_0x157fb0[_0xd46e('0x7a')](_0x5a8661,_0x417068[_0x50750f][_0xd46e('0x79')]===_0xd46e('0x8b')?![]:!![]);_0x157fb0[_0xd46e('0x6a')](_0x5a8661,_0x417068[_0x50750f][_0xd46e('0x7b')]||_0x5a8661);}if(_0x3a44da[_0xd46e('0x7c')]){_0x3a44da['joins']=JSON[_0xd46e('0x82')](_0x3a44da[_0xd46e('0x7c')]);for(var _0x3c819b=0x0;_0x3c819b<_0x3a44da[_0xd46e('0x7c')][_0xd46e('0x3d')];_0x3c819b+=0x1){if(_0x3a44da['joins'][_0x3c819b][_0xd46e('0x36')]&&_[_0xd46e('0x62')](_0x20cc4c,_0x3a44da[_0xd46e('0x7c')][_0x3c819b][_0xd46e('0x36')])&&_0x3a44da[_0xd46e('0x7c')][_0x3c819b][_0xd46e('0x7d')]&&_0x3a44da[_0xd46e('0x7c')][_0x3c819b][_0xd46e('0x7f')]&&_0x3a44da[_0xd46e('0x7c')][_0x3c819b]['foreignKey']){_0x157fb0[_0x3a44da[_0xd46e('0x7c')][_0x3c819b][_0xd46e('0x36')]](_0x3a44da[_0xd46e('0x7c')][_0x3c819b][_0xd46e('0x7f')],null,util['format']('%s.%s\x20=\x20%s.%s',_0x3a44da[_0xd46e('0x72')],_0x3a44da['joins'][_0x3c819b][_0xd46e('0x7d')],_0x3a44da[_0xd46e('0x7c')][_0x3c819b][_0xd46e('0x7f')],_0x3a44da[_0xd46e('0x7c')][_0x3c819b]['foreignKey']));}}}if(_0x3a44da[_0xd46e('0x81')]){_0x3a44da[_0xd46e('0x81')]=JSON[_0xd46e('0x82')](_0x3a44da[_0xd46e('0x81')]);_0x157fb0[_0xd46e('0x41')](_0x44322f(_0x3a44da[_0xd46e('0x81')][_0xd46e('0x69')]));}_0xe729b6=_0x157fb0[_0xd46e('0x83')]();_0x157fb0[_0xd46e('0x1f')](_0x1610bd);_0x157fb0['offset'](0x0);logger['debug'](_0xd46e('0xa4'),_0x157fb0['toString']());return dbH[_0xd46e('0x9e')][_0xd46e('0x38')](_0x157fb0[_0xd46e('0x84')](),{'type':dbH['sequelize'][_0xd46e('0x85')][_0xd46e('0x86')]});}})[_0xd46e('0x27')](function(){return{'sql':_0xe729b6['toString']()};})['then'](respondWithResult(_0x537c73,null))[_0xd46e('0x4a')](handleError(_0x537c73,null));}; \ No newline at end of file +var _0xe2fe=['set','Content-Range','apply','reject','save','then','destroy','get','DefaultReports','UserProfileResource','sendStatus','error','name','send','index','AnalyticDefaultReport','rawAttributes','fieldName','map','keys','query','filters','intersection','model','attributes','fields','length','hasOwnProperty','nolimit','order','sort','where','pick','filter','merge','options','include','findAll','rows','catch','show','params','includeAll','find','create','body','user','Unable\x20to\x20retrieve\x20the\x20current\x20user','role','Reports','UserProfileSection','userProfileId','autoAssociation','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','update','preview','join','right_join','cross_join','SUM(%s)','COUNT(%s)','MAX(%s)','MIN(%s)','AVG(%s)','GROUP_CONCAT(%s)','HOUR(%s)','UNIX_TIMESTAMP(%s)','includes','IS\x20NULL','IS\x20NOT\x20NULL','rules','operator','group','field','condition','value','Sequelize','ValidationErrorItem','Please\x20insert\x20at\x20least\x20one\x20field','AnalyticMetric','keyBy','select','from','MetricId','metric','function','replace','groupBy','orderBy','alias','joins','parse','type','foreignTable','%s.%s\x20=\x20%s.%s','table','parentKey','conditions','clone','debug','Limited\x20Query:','toString','sequelize','QueryTypes','SELECT','left_join','SEC_TO_TIME(%s)','ROUND(%s)','IS\x20EMPTY','getFields','format','foreignKey','web','%s-%s.%s','randomstring','generate','output','default','AnalyticExtractedReport','cdr','.calldate\x20BETWEEN\x20?\x20AND\x20?','startDate','endDate','info','Run\x20Query:','child_process','../../components/export/','savename','countTable','COUNT(*)','run','runReport','GROUP_CONCAT(%s\x20ORDER\x20BY\x20%s\x20DESC)','IS\x20NOT\x20EMPTY','eml-format','fast-json-patch','moment','bluebird','mustache','util','path','to-csv','ejs','lodash','squel','jsforce','querystring','ioredis','../../components/auth/service','api','../../mysqldb','dbH','status','json','offset','limit','undefined','count'];(function(_0x577240,_0x271d56){var _0x4e9a56=function(_0x168346){while(--_0x168346){_0x577240['push'](_0x577240['shift']());}};_0x4e9a56(++_0x271d56);}(_0xe2fe,0x86));var _0xee2f=function(_0x14add3,_0x13ce8d){_0x14add3=_0x14add3-0x0;var _0x4a174f=_0xe2fe[_0x14add3];return _0x4a174f;};'use strict';var emlformat=require(_0xee2f('0x0'));var rimraf=require('rimraf');var zipdir=require('zip-dir');var jsonpatch=require(_0xee2f('0x1'));var rp=require('request-promise');var moment=require(_0xee2f('0x2'));var BPromise=require(_0xee2f('0x3'));var Mustache=require(_0xee2f('0x4'));var util=require(_0xee2f('0x5'));var path=require(_0xee2f('0x6'));var sox=require('sox');var csv=require(_0xee2f('0x7'));var ejs=require(_0xee2f('0x8'));var fs=require('fs');var fs_extra=require('fs-extra');var _=require(_0xee2f('0x9'));var squel=require(_0xee2f('0xa'));var crypto=require('crypto');var jsforce=require(_0xee2f('0xb'));var deskjs=require('desk.js');var toCsv=require(_0xee2f('0x7'));var querystring=require(_0xee2f('0xc'));var Papa=require('papaparse');var Redis=require(_0xee2f('0xd'));var authService=require(_0xee2f('0xe'));var qs=require('../../components/parsers/qs');var as=require('../../components/parsers/advancedSearch');var hardwareService=require('../../config/license/hardware');var logger=require('../../config/logger')(_0xee2f('0xf'));var utils=require('../../config/utils');var config=require('../../config/environment');var licenseUtil=require('../../config/license/util');var db=require(_0xee2f('0x10'))['db'];var dbH=require(_0xee2f('0x10'))[_0xee2f('0x11')];function respondWithStatusCode(_0x100449,_0x131874){_0x131874=_0x131874||0xcc;return function(_0x3ab91f){if(_0x3ab91f){return _0x100449['sendStatus'](_0x131874);}return _0x100449[_0xee2f('0x12')](_0x131874)['end']();};}function respondWithResult(_0x36db10,_0x271c1d){_0x271c1d=_0x271c1d||0xc8;return function(_0x48b30c){if(_0x48b30c){return _0x36db10[_0xee2f('0x12')](_0x271c1d)[_0xee2f('0x13')](_0x48b30c);}};}function respondWithFilteredResult(_0x28b614,_0x1bbf7d){return function(_0x390c2c){if(_0x390c2c){var _0x58f42a=typeof _0x1bbf7d[_0xee2f('0x14')]==='undefined'&&typeof _0x1bbf7d[_0xee2f('0x15')]===_0xee2f('0x16');var _0x502eb6=_0x390c2c['count'];var _0x40b5bc=_0x58f42a?0x0:_0x1bbf7d['offset'];var _0x69db88=_0x58f42a?_0x390c2c[_0xee2f('0x17')]:_0x1bbf7d[_0xee2f('0x14')]+_0x1bbf7d['limit'];var _0x35e1a4;if(_0x69db88>=_0x502eb6){_0x69db88=_0x502eb6;_0x35e1a4=0xc8;}else{_0x35e1a4=0xce;}_0x28b614[_0xee2f('0x12')](_0x35e1a4);return _0x28b614[_0xee2f('0x18')](_0xee2f('0x19'),_0x40b5bc+'-'+_0x69db88+'/'+_0x502eb6)[_0xee2f('0x13')](_0x390c2c);}return null;};}function patchUpdates(_0x5d36d4){return function(_0x5e73ad){try{jsonpatch[_0xee2f('0x1a')](_0x5e73ad,_0x5d36d4,!![]);}catch(_0x3a1852){return BPromise[_0xee2f('0x1b')](_0x3a1852);}return _0x5e73ad[_0xee2f('0x1c')]();};}function saveUpdates(_0x472e3b,_0xf278cc){return function(_0x39a39c){if(_0x39a39c){return _0x39a39c['update'](_0x472e3b)[_0xee2f('0x1d')](function(_0x2c47c5){return _0x2c47c5;});}return null;};}function removeEntity(_0x15ceda,_0x70e308){return function(_0x820101){if(_0x820101){return _0x820101[_0xee2f('0x1e')]()[_0xee2f('0x1d')](function(){var _0x13013f=_0x820101[_0xee2f('0x1f')]({'plain':!![]});var _0x1e394f=_0xee2f('0x20');return db[_0xee2f('0x21')][_0xee2f('0x1e')]({'where':{'type':_0x1e394f,'resourceId':_0x13013f['id']}})[_0xee2f('0x1d')](function(){return _0x820101;});})['then'](function(){_0x15ceda['status'](0xcc)['end']();});}};}function handleEntityNotFound(_0x18bdbb,_0x18ff19){return function(_0x2cb0cb){if(!_0x2cb0cb){_0x18bdbb[_0xee2f('0x22')](0x194);}return _0x2cb0cb;};}function handleError(_0x892a4e,_0x3737fd){_0x3737fd=_0x3737fd||0x1f4;return function(_0x4d8398){logger[_0xee2f('0x23')](_0x4d8398['stack']);if(_0x4d8398[_0xee2f('0x24')]){delete _0x4d8398[_0xee2f('0x24')];}_0x892a4e[_0xee2f('0x12')](_0x3737fd)[_0xee2f('0x25')](_0x4d8398);};}exports[_0xee2f('0x26')]=function(_0x47d5a6,_0x310c0b){var _0xd16e35={},_0x56706e={},_0x4ee0e1={'count':0x0,'rows':[]};var _0xd1aaac=_['map'](db[_0xee2f('0x27')][_0xee2f('0x28')],function(_0x53d9b7){return{'name':_0x53d9b7[_0xee2f('0x29')],'type':_0x53d9b7['type']['key']};});_0x56706e['model']=_[_0xee2f('0x2a')](_0xd1aaac,_0xee2f('0x24'));_0x56706e['query']=_[_0xee2f('0x2b')](_0x47d5a6[_0xee2f('0x2c')]);_0x56706e[_0xee2f('0x2d')]=_[_0xee2f('0x2e')](_0x56706e[_0xee2f('0x2f')],_0x56706e['query']);_0xd16e35[_0xee2f('0x30')]=_['intersection'](_0x56706e[_0xee2f('0x2f')],qs[_0xee2f('0x31')](_0x47d5a6[_0xee2f('0x2c')]['fields']));_0xd16e35[_0xee2f('0x30')]=_0xd16e35['attributes'][_0xee2f('0x32')]?_0xd16e35['attributes']:_0x56706e[_0xee2f('0x2f')];if(!_0x47d5a6[_0xee2f('0x2c')][_0xee2f('0x33')](_0xee2f('0x34'))){_0xd16e35[_0xee2f('0x15')]=qs[_0xee2f('0x15')](_0x47d5a6[_0xee2f('0x2c')][_0xee2f('0x15')]);_0xd16e35[_0xee2f('0x14')]=qs[_0xee2f('0x14')](_0x47d5a6[_0xee2f('0x2c')]['offset']);}_0xd16e35[_0xee2f('0x35')]=qs['sort'](_0x47d5a6[_0xee2f('0x2c')][_0xee2f('0x36')]);_0xd16e35[_0xee2f('0x37')]=qs[_0xee2f('0x2d')](_[_0xee2f('0x38')](_0x47d5a6[_0xee2f('0x2c')],_0x56706e[_0xee2f('0x2d')]),_0xd1aaac);if(_0x47d5a6[_0xee2f('0x2c')]['filter']){_0xd16e35['where']=_['merge'](_0xd16e35[_0xee2f('0x37')],{'$or':_['map'](_0xd1aaac,function(_0x4501c4){if(_0x4501c4['type']!=='VIRTUAL'){var _0x5027a6={};_0x5027a6[_0x4501c4['name']]={'$like':'%'+_0x47d5a6[_0xee2f('0x2c')][_0xee2f('0x39')]+'%'};return _0x5027a6;}})});}_0xd16e35=_[_0xee2f('0x3a')]({},_0xd16e35,_0x47d5a6[_0xee2f('0x3b')]);var _0x4823a7={'where':_0xd16e35['where']};return db[_0xee2f('0x27')]['count'](_0x4823a7)['then'](function(_0x8204dc){_0x4ee0e1[_0xee2f('0x17')]=_0x8204dc;if(_0x47d5a6[_0xee2f('0x2c')]['includeAll']){_0xd16e35[_0xee2f('0x3c')]=[{'all':!![]}];}return db[_0xee2f('0x27')][_0xee2f('0x3d')](_0xd16e35);})['then'](function(_0x5896f6){_0x4ee0e1[_0xee2f('0x3e')]=_0x5896f6;return _0x4ee0e1;})[_0xee2f('0x1d')](respondWithFilteredResult(_0x310c0b,_0xd16e35))[_0xee2f('0x3f')](handleError(_0x310c0b,null));};exports[_0xee2f('0x40')]=function(_0x541fa0,_0x20697e){var _0x1df63d={'raw':!![],'where':{'id':_0x541fa0[_0xee2f('0x41')]['id']}},_0x242e91={};_0x242e91[_0xee2f('0x2f')]=_[_0xee2f('0x2b')](db[_0xee2f('0x27')][_0xee2f('0x28')]);_0x242e91[_0xee2f('0x2c')]=_[_0xee2f('0x2b')](_0x541fa0['query']);_0x242e91['filters']=_['intersection'](_0x242e91['model'],_0x242e91[_0xee2f('0x2c')]);_0x1df63d[_0xee2f('0x30')]=_[_0xee2f('0x2e')](_0x242e91[_0xee2f('0x2f')],qs[_0xee2f('0x31')](_0x541fa0['query'][_0xee2f('0x31')]));_0x1df63d[_0xee2f('0x30')]=_0x1df63d[_0xee2f('0x30')][_0xee2f('0x32')]?_0x1df63d['attributes']:_0x242e91['model'];if(_0x541fa0['query'][_0xee2f('0x42')]){_0x1df63d['include']=[{'all':!![]}];}_0x1df63d=_['merge']({},_0x1df63d,_0x541fa0['options']);return db['AnalyticDefaultReport'][_0xee2f('0x43')](_0x1df63d)[_0xee2f('0x1d')](handleEntityNotFound(_0x20697e,null))[_0xee2f('0x1d')](respondWithResult(_0x20697e,null))['catch'](handleError(_0x20697e,null));};exports[_0xee2f('0x44')]=function(_0x57f65d,_0x3d95b8){return db[_0xee2f('0x27')][_0xee2f('0x44')](_0x57f65d[_0xee2f('0x45')],{})[_0xee2f('0x1d')](function(_0x4978eb){var _0x533ad0=_0x57f65d[_0xee2f('0x46')]['get']({'plain':!![]});if(!_0x533ad0)throw new Error(_0xee2f('0x47'));if(_0x533ad0[_0xee2f('0x48')]===_0xee2f('0x46')){var _0x88e683=_0x4978eb['get']({'plain':!![]});var _0x5df503=_0xee2f('0x49');return db[_0xee2f('0x4a')][_0xee2f('0x43')]({'where':{'name':_0x5df503,'userProfileId':_0x533ad0[_0xee2f('0x4b')]},'raw':!![]})[_0xee2f('0x1d')](function(_0x2a450f){if(_0x2a450f&&_0x2a450f[_0xee2f('0x4c')]===0x0){return db[_0xee2f('0x21')][_0xee2f('0x44')]({'name':_0x88e683[_0xee2f('0x24')],'resourceId':_0x88e683['id'],'type':_0xee2f('0x20'),'sectionId':_0x2a450f['id']},{})[_0xee2f('0x1d')](function(){return _0x4978eb;});}else{return _0x4978eb;}})['catch'](function(_0x34cb51){logger[_0xee2f('0x23')](_0xee2f('0x4d'),_0x34cb51);throw _0x34cb51;});}return _0x4978eb;})[_0xee2f('0x1d')](respondWithResult(_0x3d95b8,0xc9))['catch'](handleError(_0x3d95b8,null));};exports[_0xee2f('0x4e')]=function(_0xb3bf3f,_0x3a476f){if(_0xb3bf3f[_0xee2f('0x45')]['id']){delete _0xb3bf3f[_0xee2f('0x45')]['id'];}return db['AnalyticDefaultReport'][_0xee2f('0x43')]({'where':{'id':_0xb3bf3f['params']['id']}})['then'](handleEntityNotFound(_0x3a476f,null))[_0xee2f('0x1d')](saveUpdates(_0xb3bf3f[_0xee2f('0x45')],null))[_0xee2f('0x1d')](respondWithResult(_0x3a476f,null))[_0xee2f('0x3f')](handleError(_0x3a476f,null));};exports[_0xee2f('0x1e')]=function(_0x101e09,_0x20aaca){return db['AnalyticDefaultReport'][_0xee2f('0x43')]({'where':{'id':_0x101e09[_0xee2f('0x41')]['id']}})[_0xee2f('0x1d')](handleEntityNotFound(_0x20aaca,null))[_0xee2f('0x1d')](removeEntity(_0x20aaca,null))[_0xee2f('0x3f')](handleError(_0x20aaca,null));};exports[_0xee2f('0x4f')]=function(_0xcba6fc,_0x2b9636){var _0x1373a1=0xa;var _0x5d6c40=[_0xee2f('0x50'),'left_join',_0xee2f('0x51'),_0xee2f('0x52')];var _0x1dbbf2={'SUM':_0xee2f('0x53'),'COUNT':_0xee2f('0x54'),'COUNT DISTINCT':'COUNT(DISTINCT\x20%s)','MAX':_0xee2f('0x55'),'MIN':_0xee2f('0x56'),'AVG':_0xee2f('0x57'),'GROUP_CONCAT':_0xee2f('0x58'),'GROUP_CONCAT ASC':'GROUP_CONCAT(%s\x20ORDER\x20BY\x20%s\x20ASC)','GROUP_CONCAT DESC':'GROUP_CONCAT(%s\x20ORDER\x20BY\x20%s\x20DESC)'};var _0x4fb159={'SEC_TO_TIME':'SEC_TO_TIME(%s)','DATE':'DATE(%s)','HOUR':_0xee2f('0x59'),'ROUND':'ROUND(%s)','UNIX_TIMESTAMP':_0xee2f('0x5a')};var _0x1421da=function(_0xd967e9){return!_[_0xee2f('0x5b')]([_0xee2f('0x5c'),_0xee2f('0x5d'),'IS\x20EMPTY','IS\x20NOT\x20EMPTY'],_0xd967e9);};var _0x1708c5=function(_0x58e464){if(!_0x58e464||!_0x58e464[_0xee2f('0x5e')]['length']){return'';}for(var _0x7167f9='(',_0x59af84=0x0;_0x59af84<_0x58e464[_0xee2f('0x5e')][_0xee2f('0x32')];_0x59af84+=0x1){_0x59af84>0x0&&(_0x7167f9+='\x20'+_0x58e464[_0xee2f('0x5f')]+'\x20');_0x7167f9+=_0x58e464['rules'][_0x59af84][_0xee2f('0x60')]?_0x1708c5(_0x58e464[_0xee2f('0x5e')][_0x59af84][_0xee2f('0x60')]):_0x58e464[_0xee2f('0x5e')][_0x59af84][_0xee2f('0x61')]+'\x20'+_0x58e464[_0xee2f('0x5e')][_0x59af84][_0xee2f('0x62')]+(_0x1421da(_0x58e464['rules'][_0x59af84][_0xee2f('0x62')])?'\x20'+_0x58e464[_0xee2f('0x5e')][_0x59af84][_0xee2f('0x63')]:'');}return _0x7167f9+')';};var _0x353bd9={'where':{'id':_0xcba6fc[_0xee2f('0x41')]['id']}},_0x5280c7,_0x3c9d47,_0x8ccc9d,_0x15c7ff,_0x191af8;_0x353bd9=_[_0xee2f('0x3a')]({},_0x353bd9,_0xcba6fc['options']);return db[_0xee2f('0x27')][_0xee2f('0x43')](_0x353bd9)['then'](function(_0x9252e3){if(_0x9252e3){_0x5280c7=_0x9252e3;return _0x9252e3['getFields']();}return null;})[_0xee2f('0x1d')](function(_0x4ed7c9){if(_0x4ed7c9){if(!_0x4ed7c9['length']){throw new db[(_0xee2f('0x64'))][(_0xee2f('0x65'))](_0xee2f('0x66'),0x193);}_0x3c9d47=_0x4ed7c9;return db[_0xee2f('0x67')][_0xee2f('0x3d')]({'raw':!![]});}return null;})['then'](function(_0x238e7d){if(_0x238e7d){_0x8ccc9d=_[_0xee2f('0x68')](_0x238e7d,'id');var _0x42fae8;var _0x5d4fe8=squel[_0xee2f('0x69')]();_0x5d4fe8[_0xee2f('0x6a')](_0x5280c7['table']);for(var _0x1f1c55=0x0;_0x1f1c55<_0x3c9d47[_0xee2f('0x32')];_0x1f1c55+=0x1){_0x42fae8=_0x3c9d47[_0x1f1c55][_0xee2f('0x6b')]?_0x8ccc9d[_0x3c9d47[_0x1f1c55][_0xee2f('0x6b')]][_0xee2f('0x6c')]:_0x3c9d47[_0x1f1c55][_0xee2f('0x61')];_0x42fae8=_0x3c9d47[_0x1f1c55][_0xee2f('0x6d')]?_[_0xee2f('0x6e')](_0x1dbbf2[_0x3c9d47[_0x1f1c55][_0xee2f('0x6d')]],'%s',_0x42fae8):_0x42fae8;_0x42fae8=_0x3c9d47[_0x1f1c55]['format']?_['replace'](_0x4fb159[_0x3c9d47[_0x1f1c55]['format']],'%s',_0x42fae8):_0x42fae8;if(_0x3c9d47[_0x1f1c55][_0xee2f('0x6f')]){_0x5d4fe8[_0xee2f('0x60')](_0x42fae8);}_0x3c9d47[_0x1f1c55][_0xee2f('0x70')]&&_0x5d4fe8[_0xee2f('0x35')](_0x42fae8,_0x3c9d47[_0x1f1c55][_0xee2f('0x70')]==='DESC'?![]:!![]);_0x5d4fe8[_0xee2f('0x61')](_0x42fae8,_0x3c9d47[_0x1f1c55][_0xee2f('0x71')]||_0x42fae8);}if(_0x5280c7['joins']){_0x5280c7[_0xee2f('0x72')]=JSON[_0xee2f('0x73')](_0x5280c7[_0xee2f('0x72')]);for(var _0x5a7b6c=0x0;_0x5a7b6c<_0x5280c7[_0xee2f('0x72')]['length'];_0x5a7b6c+=0x1){if(_0x5280c7[_0xee2f('0x72')][_0x5a7b6c][_0xee2f('0x74')]&&_['includes'](_0x5d6c40,_0x5280c7[_0xee2f('0x72')][_0x5a7b6c][_0xee2f('0x74')])&&_0x5280c7['joins'][_0x5a7b6c]['parentKey']&&_0x5280c7['joins'][_0x5a7b6c][_0xee2f('0x75')]&&_0x5280c7['joins'][_0x5a7b6c]['foreignKey']){_0x5d4fe8[_0x5280c7[_0xee2f('0x72')][_0x5a7b6c][_0xee2f('0x74')]](_0x5280c7['joins'][_0x5a7b6c][_0xee2f('0x75')],null,util['format'](_0xee2f('0x76'),_0x5280c7[_0xee2f('0x77')],_0x5280c7[_0xee2f('0x72')][_0x5a7b6c][_0xee2f('0x78')],_0x5280c7[_0xee2f('0x72')][_0x5a7b6c][_0xee2f('0x75')],_0x5280c7[_0xee2f('0x72')][_0x5a7b6c]['foreignKey']));}}}if(_0x5280c7[_0xee2f('0x79')]){_0x5280c7[_0xee2f('0x79')]=JSON[_0xee2f('0x73')](_0x5280c7[_0xee2f('0x79')]);_0x5d4fe8[_0xee2f('0x37')](_0x1708c5(_0x5280c7['conditions'][_0xee2f('0x60')]));}_0x191af8=_0x5d4fe8[_0xee2f('0x7a')]();_0x5d4fe8[_0xee2f('0x15')](_0x1373a1);_0x5d4fe8[_0xee2f('0x14')](0x0);logger[_0xee2f('0x7b')](_0xee2f('0x7c'),_0x5d4fe8['toString']());return dbH['sequelize'][_0xee2f('0x2c')](_0x5d4fe8[_0xee2f('0x7d')](),{'type':dbH[_0xee2f('0x7e')][_0xee2f('0x7f')][_0xee2f('0x80')]});}})[_0xee2f('0x1d')](respondWithResult(_0x2b9636,null))[_0xee2f('0x3f')](handleError(_0x2b9636,null));};function runReport(_0x58c49e,_0x5b7b55,_0x2ad26d){var _0x27eabc=_0x5b7b55[_0xee2f('0x24')];var _0xc92046=0xa;var _0x38ee46=[_0xee2f('0x50'),_0xee2f('0x81'),_0xee2f('0x51'),_0xee2f('0x52')];var _0x21ac2d={'SUM':_0xee2f('0x53'),'COUNT':_0xee2f('0x54'),'COUNT DISTINCT':'COUNT(DISTINCT\x20%s)','MAX':'MAX(%s)','MIN':_0xee2f('0x56'),'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 _0x2ea31f={'SEC_TO_TIME':_0xee2f('0x82'),'DATE':'DATE(%s)','HOUR':'HOUR(%s)','ROUND':_0xee2f('0x83'),'UNIX_TIMESTAMP':_0xee2f('0x5a')};var _0x18e191=function(_0x4fad8f){return!_['includes']([_0xee2f('0x5c'),_0xee2f('0x5d'),_0xee2f('0x84'),'IS\x20NOT\x20EMPTY'],_0x4fad8f);};var _0xd7c8f8=function(_0x4b0611){if(!_0x4b0611||!_0x4b0611[_0xee2f('0x5e')]['length']){return'';}for(var _0x378fc9='(',_0x25a3b9=0x0;_0x25a3b9<_0x4b0611[_0xee2f('0x5e')]['length'];_0x25a3b9+=0x1){_0x25a3b9>0x0&&(_0x378fc9+='\x20'+_0x4b0611['operator']+'\x20');_0x378fc9+=_0x4b0611[_0xee2f('0x5e')][_0x25a3b9][_0xee2f('0x60')]?_0xd7c8f8(_0x4b0611[_0xee2f('0x5e')][_0x25a3b9]['group']):_0x4b0611[_0xee2f('0x5e')][_0x25a3b9][_0xee2f('0x61')]+'\x20'+_0x4b0611[_0xee2f('0x5e')][_0x25a3b9][_0xee2f('0x62')]+(_0x18e191(_0x4b0611[_0xee2f('0x5e')][_0x25a3b9][_0xee2f('0x62')])?'\x20'+_0x4b0611[_0xee2f('0x5e')][_0x25a3b9][_0xee2f('0x63')]:'');}return _0x378fc9+')';};var _0x449656={'where':{'id':_0x58c49e['id']}},_0x1db0b5,_0x9f06f9,_0x659080,_0x28bde7,_0x214f94;_0x449656=_['merge']({},_0x449656,_0x2ad26d);return db[_0xee2f('0x27')][_0xee2f('0x43')](_0x449656)[_0xee2f('0x1d')](function(_0x2f5ed7){if(_0x2f5ed7){_0x1db0b5=_0x2f5ed7;return _0x2f5ed7[_0xee2f('0x85')]();}return null;})[_0xee2f('0x1d')](function(_0x34cd09){if(_0x34cd09){if(!_0x34cd09[_0xee2f('0x32')]){throw new db[(_0xee2f('0x64'))][(_0xee2f('0x65'))](_0xee2f('0x66'),0x193);}_0x9f06f9=_0x34cd09;return db['AnalyticMetric'][_0xee2f('0x3d')]({'raw':!![]});}return null;})[_0xee2f('0x1d')](function(_0x1422e9){if(_0x1422e9){_0x659080=_[_0xee2f('0x68')](_0x1422e9,'id');var _0x53d769;var _0x15ca4e=squel[_0xee2f('0x69')]();_0x15ca4e[_0xee2f('0x6a')](_0x1db0b5['table']);for(var _0x4f02aa=0x0;_0x4f02aa<_0x9f06f9[_0xee2f('0x32')];_0x4f02aa+=0x1){_0x53d769=_0x9f06f9[_0x4f02aa]['MetricId']?_0x659080[_0x9f06f9[_0x4f02aa]['MetricId']]['metric']:_0x9f06f9[_0x4f02aa][_0xee2f('0x61')];_0x53d769=_0x9f06f9[_0x4f02aa][_0xee2f('0x6d')]?_[_0xee2f('0x6e')](_0x21ac2d[_0x9f06f9[_0x4f02aa][_0xee2f('0x6d')]],'%s',_0x53d769):_0x53d769;_0x53d769=_0x9f06f9[_0x4f02aa]['format']?_[_0xee2f('0x6e')](_0x2ea31f[_0x9f06f9[_0x4f02aa][_0xee2f('0x86')]],'%s',_0x53d769):_0x53d769;if(_0x9f06f9[_0x4f02aa][_0xee2f('0x6f')]){_0x15ca4e['group'](_0x53d769);}_0x9f06f9[_0x4f02aa][_0xee2f('0x70')]&&_0x15ca4e['order'](_0x53d769,_0x9f06f9[_0x4f02aa][_0xee2f('0x70')]==='DESC'?![]:!![]);_0x15ca4e['field'](_0x53d769,_0x9f06f9[_0x4f02aa][_0xee2f('0x71')]||_0x53d769);}if(_0x1db0b5['joins']){_0x1db0b5[_0xee2f('0x72')]=JSON['parse'](_0x1db0b5['joins']);for(var _0x149d7f=0x0;_0x149d7f<_0x1db0b5[_0xee2f('0x72')]['length'];_0x149d7f+=0x1){if(_0x1db0b5[_0xee2f('0x72')][_0x149d7f][_0xee2f('0x74')]&&_['includes'](_0x38ee46,_0x1db0b5['joins'][_0x149d7f][_0xee2f('0x74')])&&_0x1db0b5[_0xee2f('0x72')][_0x149d7f]['parentKey']&&_0x1db0b5[_0xee2f('0x72')][_0x149d7f][_0xee2f('0x75')]&&_0x1db0b5[_0xee2f('0x72')][_0x149d7f][_0xee2f('0x87')]){_0x15ca4e[_0x1db0b5[_0xee2f('0x72')][_0x149d7f]['type']](_0x1db0b5['joins'][_0x149d7f]['foreignTable'],null,util[_0xee2f('0x86')](_0xee2f('0x76'),_0x1db0b5[_0xee2f('0x77')],_0x1db0b5[_0xee2f('0x72')][_0x149d7f][_0xee2f('0x78')],_0x1db0b5[_0xee2f('0x72')][_0x149d7f][_0xee2f('0x75')],_0x1db0b5[_0xee2f('0x72')][_0x149d7f][_0xee2f('0x87')]));}}}if(_0x1db0b5[_0xee2f('0x79')]){_0x1db0b5[_0xee2f('0x79')]=JSON[_0xee2f('0x73')](_0x1db0b5[_0xee2f('0x79')]);_0x15ca4e[_0xee2f('0x37')](_0xd7c8f8(_0x1db0b5[_0xee2f('0x79')][_0xee2f('0x60')]));}_0x214f94=_0x15ca4e['clone']();_0x15ca4e['limit'](_0xc92046);_0x15ca4e[_0xee2f('0x14')](0x0);return;}})[_0xee2f('0x1d')](function(){if(_0x5b7b55['output']===_0xee2f('0x88')){return null;}var _0x444c39=_[_0xee2f('0x3a')](_0x5b7b55,{'name':_0x5b7b55['fullPath']||_0x5b7b55[_0xee2f('0x24')]||_0x1db0b5[_0xee2f('0x24')],'basename':_0x27eabc,'savename':util[_0xee2f('0x86')](_0xee2f('0x89'),_0x5b7b55[_0xee2f('0x24')]||_0x1db0b5[_0xee2f('0x24')],require(_0xee2f('0x8a'))[_0xee2f('0x8b')](0x4),_0x5b7b55[_0xee2f('0x8c')]||'csv'),'reportId':_0x1db0b5['id'],'reportType':_0xee2f('0x8d')});return db[_0xee2f('0x8e')][_0xee2f('0x44')](_0x444c39,{'raw':!![]});})[_0xee2f('0x1d')](function(_0xe7e196){if(_0x1db0b5[_0xee2f('0x77')]===_0xee2f('0x8f')){_0x214f94[_0xee2f('0x37')](_0x1db0b5['table']+_0xee2f('0x90'),_0x5b7b55[_0xee2f('0x91')],_0x5b7b55['endDate']);}else{_0x214f94[_0xee2f('0x37')](_0x1db0b5['table']+'.createdAt\x20BETWEEN\x20?\x20AND\x20?',_0x5b7b55[_0xee2f('0x91')],_0x5b7b55[_0xee2f('0x92')]);}if(_0xe7e196){logger[_0xee2f('0x93')](_0xee2f('0x94'),_0x214f94[_0xee2f('0x7d')]());require(_0xee2f('0x95'))['fork'](path[_0xee2f('0x50')](__dirname,_0xee2f('0x96'),_0xe7e196['output']),[_0xe7e196['id'],_0x214f94[_0xee2f('0x7d')](),path[_0xee2f('0x50')](__dirname,'../../files/reports',_0xe7e196[_0xee2f('0x97')]),_0x27eabc]);return _0xe7e196;}else{var _0x26dd6c=squel[_0xee2f('0x69')]();_0x26dd6c[_0xee2f('0x6a')]('('+_0x214f94[_0xee2f('0x7d')]()+')',_0xee2f('0x98'));_0x26dd6c[_0xee2f('0x61')](_0xee2f('0x99'),_0xee2f('0x17'));_0x214f94[_0xee2f('0x15')](_0x5b7b55[_0xee2f('0x15')]||_0xc92046);_0x214f94[_0xee2f('0x14')](_0x5b7b55['offset']||0x0);return dbH[_0xee2f('0x7e')]['query'](_0x26dd6c['toString'](),{'type':dbH['sequelize'][_0xee2f('0x7f')]['SELECT']})[_0xee2f('0x1d')](function(_0x472f83){if(!_0x472f83[_0xee2f('0x32')]){_0x28bde7=0x0;}else{_0x28bde7=_0x472f83[0x0]['count']||0x0;}return dbH[_0xee2f('0x7e')][_0xee2f('0x2c')](_0x214f94['toString'](),{'type':dbH[_0xee2f('0x7e')][_0xee2f('0x7f')][_0xee2f('0x80')]});})[_0xee2f('0x1d')](function(_0x121a34){return{'rows':_0x121a34||[],'count':_0x28bde7};});}});}exports[_0xee2f('0x9a')]=function(_0x3d8c56,_0x5c8550){return runReport(_0x3d8c56[_0xee2f('0x41')],_0x3d8c56[_0xee2f('0x2c')],_0x3d8c56['options'])[_0xee2f('0x1d')](respondWithResult(_0x5c8550,null))[_0xee2f('0x3f')](handleError(_0x5c8550,null));};exports[_0xee2f('0x9b')]=runReport;exports['query']=function(_0x40fa57,_0x1fafcc){var _0x1163f1=0xa;var _0x162014=[_0xee2f('0x50'),_0xee2f('0x81'),'right_join',_0xee2f('0x52')];var _0xb93091={'SUM':_0xee2f('0x53'),'COUNT':'COUNT(%s)','COUNT DISTINCT':'COUNT(DISTINCT\x20%s)','MAX':_0xee2f('0x55'),'MIN':'MIN(%s)','AVG':_0xee2f('0x57'),'GROUP_CONCAT':_0xee2f('0x58'),'GROUP_CONCAT ASC':'GROUP_CONCAT(%s\x20ORDER\x20BY\x20%s\x20ASC)','GROUP_CONCAT DESC':_0xee2f('0x9c')};var _0x39922f={'SEC_TO_TIME':'SEC_TO_TIME(%s)','DATE':'DATE(%s)','HOUR':_0xee2f('0x59'),'ROUND':_0xee2f('0x83'),'UNIX_TIMESTAMP':'UNIX_TIMESTAMP(%s)'};var _0x1c9f70=function(_0xa93dc9){return!_[_0xee2f('0x5b')]([_0xee2f('0x5c'),'IS\x20NOT\x20NULL',_0xee2f('0x84'),_0xee2f('0x9d')],_0xa93dc9);};var _0x44b06b=function(_0x541ac7){if(!_0x541ac7||!_0x541ac7[_0xee2f('0x5e')][_0xee2f('0x32')]){return'';}for(var _0xa89897='(',_0x2def5c=0x0;_0x2def5c<_0x541ac7['rules']['length'];_0x2def5c+=0x1){_0x2def5c>0x0&&(_0xa89897+='\x20'+_0x541ac7[_0xee2f('0x5f')]+'\x20');_0xa89897+=_0x541ac7[_0xee2f('0x5e')][_0x2def5c][_0xee2f('0x60')]?_0x44b06b(_0x541ac7['rules'][_0x2def5c][_0xee2f('0x60')]):_0x541ac7[_0xee2f('0x5e')][_0x2def5c]['field']+'\x20'+_0x541ac7[_0xee2f('0x5e')][_0x2def5c][_0xee2f('0x62')]+(_0x1c9f70(_0x541ac7[_0xee2f('0x5e')][_0x2def5c][_0xee2f('0x62')])?'\x20'+_0x541ac7[_0xee2f('0x5e')][_0x2def5c][_0xee2f('0x63')]:'');}return _0xa89897+')';};var _0x3f9188={'where':{'id':_0x40fa57['params']['id']}},_0x236b63,_0x4ad336,_0x3370de,_0x3c8c20,_0xc9228;_0x3f9188=_[_0xee2f('0x3a')]({},_0x3f9188,_0x40fa57[_0xee2f('0x3b')]);return db[_0xee2f('0x27')][_0xee2f('0x43')](_0x3f9188)[_0xee2f('0x1d')](function(_0xa0dfdd){if(_0xa0dfdd){_0x236b63=_0xa0dfdd;return _0xa0dfdd[_0xee2f('0x85')]();}return null;})[_0xee2f('0x1d')](function(_0x298dfa){if(_0x298dfa){if(!_0x298dfa[_0xee2f('0x32')]){throw new db[(_0xee2f('0x64'))][(_0xee2f('0x65'))]('Please\x20insert\x20at\x20least\x20one\x20field',0x193);}_0x4ad336=_0x298dfa;return db[_0xee2f('0x67')]['findAll']({'raw':!![]});}return null;})[_0xee2f('0x1d')](function(_0x35a1c9){if(_0x35a1c9){_0x3370de=_['keyBy'](_0x35a1c9,'id');var _0x464e9e;var _0x738f35=squel[_0xee2f('0x69')]();_0x738f35[_0xee2f('0x6a')](_0x236b63[_0xee2f('0x77')]);for(var _0xe24a8a=0x0;_0xe24a8a<_0x4ad336['length'];_0xe24a8a+=0x1){_0x464e9e=_0x4ad336[_0xe24a8a][_0xee2f('0x6b')]?_0x3370de[_0x4ad336[_0xe24a8a][_0xee2f('0x6b')]][_0xee2f('0x6c')]:_0x4ad336[_0xe24a8a][_0xee2f('0x61')];_0x464e9e=_0x4ad336[_0xe24a8a][_0xee2f('0x6d')]?_[_0xee2f('0x6e')](_0xb93091[_0x4ad336[_0xe24a8a][_0xee2f('0x6d')]],'%s',_0x464e9e):_0x464e9e;_0x464e9e=_0x4ad336[_0xe24a8a][_0xee2f('0x86')]?_[_0xee2f('0x6e')](_0x39922f[_0x4ad336[_0xe24a8a][_0xee2f('0x86')]],'%s',_0x464e9e):_0x464e9e;if(_0x4ad336[_0xe24a8a]['groupBy']){_0x738f35[_0xee2f('0x60')](_0x464e9e);}_0x4ad336[_0xe24a8a][_0xee2f('0x70')]&&_0x738f35[_0xee2f('0x35')](_0x464e9e,_0x4ad336[_0xe24a8a]['orderBy']==='DESC'?![]:!![]);_0x738f35[_0xee2f('0x61')](_0x464e9e,_0x4ad336[_0xe24a8a][_0xee2f('0x71')]||_0x464e9e);}if(_0x236b63[_0xee2f('0x72')]){_0x236b63[_0xee2f('0x72')]=JSON[_0xee2f('0x73')](_0x236b63['joins']);for(var _0x1cee16=0x0;_0x1cee16<_0x236b63[_0xee2f('0x72')]['length'];_0x1cee16+=0x1){if(_0x236b63[_0xee2f('0x72')][_0x1cee16][_0xee2f('0x74')]&&_[_0xee2f('0x5b')](_0x162014,_0x236b63[_0xee2f('0x72')][_0x1cee16][_0xee2f('0x74')])&&_0x236b63[_0xee2f('0x72')][_0x1cee16]['parentKey']&&_0x236b63[_0xee2f('0x72')][_0x1cee16][_0xee2f('0x75')]&&_0x236b63[_0xee2f('0x72')][_0x1cee16][_0xee2f('0x87')]){_0x738f35[_0x236b63[_0xee2f('0x72')][_0x1cee16][_0xee2f('0x74')]](_0x236b63[_0xee2f('0x72')][_0x1cee16][_0xee2f('0x75')],null,util[_0xee2f('0x86')](_0xee2f('0x76'),_0x236b63[_0xee2f('0x77')],_0x236b63['joins'][_0x1cee16][_0xee2f('0x78')],_0x236b63[_0xee2f('0x72')][_0x1cee16][_0xee2f('0x75')],_0x236b63[_0xee2f('0x72')][_0x1cee16][_0xee2f('0x87')]));}}}if(_0x236b63[_0xee2f('0x79')]){_0x236b63['conditions']=JSON[_0xee2f('0x73')](_0x236b63[_0xee2f('0x79')]);_0x738f35[_0xee2f('0x37')](_0x44b06b(_0x236b63[_0xee2f('0x79')]['group']));}_0xc9228=_0x738f35[_0xee2f('0x7a')]();_0x738f35[_0xee2f('0x15')](_0x1163f1);_0x738f35[_0xee2f('0x14')](0x0);logger[_0xee2f('0x7b')](_0xee2f('0x7c'),_0x738f35[_0xee2f('0x7d')]());return dbH[_0xee2f('0x7e')][_0xee2f('0x2c')](_0x738f35['toString'](),{'type':dbH['sequelize'][_0xee2f('0x7f')][_0xee2f('0x80')]});}})[_0xee2f('0x1d')](function(){return{'sql':_0xc9228['toString']()};})[_0xee2f('0x1d')](respondWithResult(_0x1fafcc,null))['catch'](handleError(_0x1fafcc,null));}; \ No newline at end of file diff --git a/server/api/analyticDefaultReport/analyticDefaultReport.model.js b/server/api/analyticDefaultReport/analyticDefaultReport.model.js index e00549b..daadfb1 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 _0x4c93=['AnalyticDefaultReport','analytics_default_reports','lodash','util','../../config/logger','moment','bluebird','request-promise','path','rimraf','../../config/environment','exports'];(function(_0x280f4a,_0x2ed8d6){var _0x1bb157=function(_0x37de94){while(--_0x37de94){_0x280f4a['push'](_0x280f4a['shift']());}};_0x1bb157(++_0x2ed8d6);}(_0x4c93,0x15e));var _0x34c9=function(_0x1820b3,_0x3e30f0){_0x1820b3=_0x1820b3-0x0;var _0x42a93e=_0x4c93[_0x1820b3];return _0x42a93e;};'use strict';var _=require(_0x34c9('0x0'));var util=require(_0x34c9('0x1'));var logger=require(_0x34c9('0x2'))('api');var moment=require(_0x34c9('0x3'));var BPromise=require(_0x34c9('0x4'));var rp=require(_0x34c9('0x5'));var fs=require('fs');var path=require(_0x34c9('0x6'));var rimraf=require(_0x34c9('0x7'));var config=require(_0x34c9('0x8'));var attributes=require('./analyticDefaultReport.attributes');module[_0x34c9('0x9')]=function(_0x4856f8,_0x44cf74){return _0x4856f8['define'](_0x34c9('0xa'),attributes,{'tableName':_0x34c9('0xb'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x2855=['path','rimraf','exports','define','analytics_default_reports','lodash','util','api','moment','bluebird','request-promise'];(function(_0x476bf4,_0x2a3755){var _0x788ffe=function(_0x13fa11){while(--_0x13fa11){_0x476bf4['push'](_0x476bf4['shift']());}};_0x788ffe(++_0x2a3755);}(_0x2855,0xc0));var _0x5285=function(_0x5e3b04,_0xbb6795){_0x5e3b04=_0x5e3b04-0x0;var _0x1fc44d=_0x2855[_0x5e3b04];return _0x1fc44d;};'use strict';var _=require(_0x5285('0x0'));var util=require(_0x5285('0x1'));var logger=require('../../config/logger')(_0x5285('0x2'));var moment=require(_0x5285('0x3'));var BPromise=require(_0x5285('0x4'));var rp=require(_0x5285('0x5'));var fs=require('fs');var path=require(_0x5285('0x6'));var rimraf=require(_0x5285('0x7'));var config=require('../../config/environment');var attributes=require('./analyticDefaultReport.attributes');module[_0x5285('0x8')]=function(_0x23fc44,_0x24993b){return _0x23fc44[_0x5285('0x9')]('AnalyticDefaultReport',attributes,{'tableName':_0x5285('0xa'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/analyticDefaultReport/analyticDefaultReport.rpc.js b/server/api/analyticDefaultReport/analyticDefaultReport.rpc.js index 536c817..63c89fd 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 _0x6efc=['../../config/logger','rpc','../../config/environment','client','http','request','info','AnalyticDefaultReport,\x20%s,\x20%s','request\x20sent','AnalyticDefaultReport,\x20%s,\x20%s,\x20%s','stringify','error','code','message','result','catch','lodash','util','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils'];(function(_0x5b59c8,_0x4d2ea6){var _0x1f35f0=function(_0x2f9d04){while(--_0x2f9d04){_0x5b59c8['push'](_0x5b59c8['shift']());}};_0x1f35f0(++_0x4d2ea6);}(_0x6efc,0x148));var _0xc6ef=function(_0x321bb2,_0x202794){_0x321bb2=_0x321bb2-0x0;var _0x9c12ed=_0x6efc[_0x321bb2];return _0x9c12ed;};'use strict';var _=require(_0xc6ef('0x0'));var util=require(_0xc6ef('0x1'));var moment=require(_0xc6ef('0x2'));var BPromise=require(_0xc6ef('0x3'));var rs=require(_0xc6ef('0x4'));var fs=require('fs');var Redis=require(_0xc6ef('0x5'));var db=require(_0xc6ef('0x6'))['db'];var utils=require(_0xc6ef('0x7'));var logger=require(_0xc6ef('0x8'))(_0xc6ef('0x9'));var config=require(_0xc6ef('0xa'));var jayson=require('jayson/promise');var client=jayson[_0xc6ef('0xb')][_0xc6ef('0xc')]({'port':0x232a});function respondWithRpcPromise(_0x56b4aa,_0x3b9602,_0x5d910f){return new BPromise(function(_0x5c38a2,_0x11206a){return client[_0xc6ef('0xd')](_0x56b4aa,_0x5d910f)['then'](function(_0x11eb98){logger[_0xc6ef('0xe')](_0xc6ef('0xf'),_0x3b9602,_0xc6ef('0x10'));logger['debug'](_0xc6ef('0x11'),_0x3b9602,_0xc6ef('0x10'),JSON[_0xc6ef('0x12')](_0x11eb98));if(_0x11eb98[_0xc6ef('0x13')]){if(_0x11eb98['error'][_0xc6ef('0x14')]===0x1f4){logger[_0xc6ef('0x13')](_0xc6ef('0xf'),_0x3b9602,_0x11eb98[_0xc6ef('0x13')][_0xc6ef('0x15')]);return _0x11206a(_0x11eb98[_0xc6ef('0x13')]['message']);}logger[_0xc6ef('0x13')](_0xc6ef('0xf'),_0x3b9602,_0x11eb98['error']['message']);return _0x5c38a2(_0x11eb98[_0xc6ef('0x13')][_0xc6ef('0x15')]);}else{logger[_0xc6ef('0xe')](_0xc6ef('0xf'),_0x3b9602,_0xc6ef('0x10'));_0x5c38a2(_0x11eb98[_0xc6ef('0x16')][_0xc6ef('0x15')]);}})[_0xc6ef('0x17')](function(_0x3b59d6){logger[_0xc6ef('0x13')](_0xc6ef('0xf'),_0x3b9602,_0x3b59d6);_0x11206a(_0x3b59d6);});});} \ No newline at end of file +var _0xf026=['util','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','client','http','request','info','AnalyticDefaultReport,\x20%s,\x20%s','request\x20sent','debug','AnalyticDefaultReport,\x20%s,\x20%s,\x20%s','error','code','message','result','catch'];(function(_0x739e47,_0x311adb){var _0x4274a6=function(_0x20ef75){while(--_0x20ef75){_0x739e47['push'](_0x739e47['shift']());}};_0x4274a6(++_0x311adb);}(_0xf026,0x108));var _0x6f02=function(_0x5627e1,_0x1b2dbf){_0x5627e1=_0x5627e1-0x0;var _0x2f013f=_0xf026[_0x5627e1];return _0x2f013f;};'use strict';var _=require('lodash');var util=require(_0x6f02('0x0'));var moment=require(_0x6f02('0x1'));var BPromise=require(_0x6f02('0x2'));var rs=require(_0x6f02('0x3'));var fs=require('fs');var Redis=require(_0x6f02('0x4'));var db=require(_0x6f02('0x5'))['db'];var utils=require(_0x6f02('0x6'));var logger=require(_0x6f02('0x7'))(_0x6f02('0x8'));var config=require(_0x6f02('0x9'));var jayson=require(_0x6f02('0xa'));var client=jayson[_0x6f02('0xb')][_0x6f02('0xc')]({'port':0x232a});function respondWithRpcPromise(_0x4100c9,_0x3d3e50,_0x53bce0){return new BPromise(function(_0x46da78,_0x5538a8){return client[_0x6f02('0xd')](_0x4100c9,_0x53bce0)['then'](function(_0x34278a){logger[_0x6f02('0xe')](_0x6f02('0xf'),_0x3d3e50,_0x6f02('0x10'));logger[_0x6f02('0x11')](_0x6f02('0x12'),_0x3d3e50,_0x6f02('0x10'),JSON['stringify'](_0x34278a));if(_0x34278a[_0x6f02('0x13')]){if(_0x34278a['error'][_0x6f02('0x14')]===0x1f4){logger[_0x6f02('0x13')](_0x6f02('0xf'),_0x3d3e50,_0x34278a[_0x6f02('0x13')]['message']);return _0x5538a8(_0x34278a[_0x6f02('0x13')][_0x6f02('0x15')]);}logger[_0x6f02('0x13')](_0x6f02('0xf'),_0x3d3e50,_0x34278a[_0x6f02('0x13')][_0x6f02('0x15')]);return _0x46da78(_0x34278a[_0x6f02('0x13')][_0x6f02('0x15')]);}else{logger[_0x6f02('0xe')](_0x6f02('0xf'),_0x3d3e50,_0x6f02('0x10'));_0x46da78(_0x34278a[_0x6f02('0x16')]['message']);}})[_0x6f02('0x17')](function(_0x5ab9a9){logger[_0x6f02('0x13')]('AnalyticDefaultReport,\x20%s,\x20%s',_0x3d3e50,_0x5ab9a9);_0x5538a8(_0x5ab9a9);});});} \ No newline at end of file diff --git a/server/api/analyticDefaultReport/index.js b/server/api/analyticDefaultReport/index.js index abb86c8..72abb0a 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 _0xcfb3=['/:id','update','delete','destroy','exports','multer','util','path','connect-timeout','express','Router','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','./analyticDefaultReport.controller','get','isAuthenticated','index','/:id/preview','preview','run','/:id/query','query','post','create','put'];(function(_0x1d4b4e,_0x522152){var _0x42505b=function(_0x3b406c){while(--_0x3b406c){_0x1d4b4e['push'](_0x1d4b4e['shift']());}};_0x42505b(++_0x522152);}(_0xcfb3,0x1eb));var _0x3cfb=function(_0x3231f8,_0x198adf){_0x3231f8=_0x3231f8-0x0;var _0x212993=_0xcfb3[_0x3231f8];return _0x212993;};'use strict';var multer=require(_0x3cfb('0x0'));var util=require(_0x3cfb('0x1'));var path=require(_0x3cfb('0x2'));var timeout=require(_0x3cfb('0x3'));var express=require(_0x3cfb('0x4'));var router=express[_0x3cfb('0x5')]();var fs_extra=require(_0x3cfb('0x6'));var auth=require(_0x3cfb('0x7'));var interaction=require(_0x3cfb('0x8'));var config=require(_0x3cfb('0x9'));var controller=require(_0x3cfb('0xa'));router[_0x3cfb('0xb')]('/',auth[_0x3cfb('0xc')](),controller[_0x3cfb('0xd')]);router[_0x3cfb('0xb')]('/:id',auth[_0x3cfb('0xc')](),controller['show']);router[_0x3cfb('0xb')](_0x3cfb('0xe'),auth[_0x3cfb('0xc')](),controller[_0x3cfb('0xf')]);router[_0x3cfb('0xb')]('/:id/run',auth[_0x3cfb('0xc')](),controller[_0x3cfb('0x10')]);router[_0x3cfb('0xb')](_0x3cfb('0x11'),auth['isAuthenticated'](),controller[_0x3cfb('0x12')]);router[_0x3cfb('0x13')]('/',auth[_0x3cfb('0xc')](),controller[_0x3cfb('0x14')]);router[_0x3cfb('0x15')](_0x3cfb('0x16'),auth['isAuthenticated'](),controller[_0x3cfb('0x17')]);router[_0x3cfb('0x18')](_0x3cfb('0x16'),auth[_0x3cfb('0xc')](),controller[_0x3cfb('0x19')]);module[_0x3cfb('0x1a')]=router; \ No newline at end of file +var _0x4cc3=['preview','/:id/run','run','query','post','create','put','update','delete','destroy','util','path','connect-timeout','express','Router','fs-extra','../../components/auth/service','../../components/interaction/service','./analyticDefaultReport.controller','get','isAuthenticated','index','/:id','show','/:id/preview'];(function(_0x31982e,_0x5d021e){var _0x3aab44=function(_0x6099d9){while(--_0x6099d9){_0x31982e['push'](_0x31982e['shift']());}};_0x3aab44(++_0x5d021e);}(_0x4cc3,0x14f));var _0x34cc=function(_0x33c777,_0x43ab7a){_0x33c777=_0x33c777-0x0;var _0x19de2d=_0x4cc3[_0x33c777];return _0x19de2d;};'use strict';var multer=require('multer');var util=require(_0x34cc('0x0'));var path=require(_0x34cc('0x1'));var timeout=require(_0x34cc('0x2'));var express=require(_0x34cc('0x3'));var router=express[_0x34cc('0x4')]();var fs_extra=require(_0x34cc('0x5'));var auth=require(_0x34cc('0x6'));var interaction=require(_0x34cc('0x7'));var config=require('../../config/environment');var controller=require(_0x34cc('0x8'));router[_0x34cc('0x9')]('/',auth[_0x34cc('0xa')](),controller[_0x34cc('0xb')]);router[_0x34cc('0x9')](_0x34cc('0xc'),auth[_0x34cc('0xa')](),controller[_0x34cc('0xd')]);router['get'](_0x34cc('0xe'),auth[_0x34cc('0xa')](),controller[_0x34cc('0xf')]);router[_0x34cc('0x9')](_0x34cc('0x10'),auth[_0x34cc('0xa')](),controller[_0x34cc('0x11')]);router[_0x34cc('0x9')]('/:id/query',auth[_0x34cc('0xa')](),controller[_0x34cc('0x12')]);router[_0x34cc('0x13')]('/',auth[_0x34cc('0xa')](),controller[_0x34cc('0x14')]);router[_0x34cc('0x15')](_0x34cc('0xc'),auth[_0x34cc('0xa')](),controller[_0x34cc('0x16')]);router[_0x34cc('0x17')](_0x34cc('0xc'),auth[_0x34cc('0xa')](),controller[_0x34cc('0x18')]);module['exports']=router; \ No newline at end of file diff --git a/server/api/analyticExtractedReport/analyticExtractedReport.attributes.js b/server/api/analyticExtractedReport/analyticExtractedReport.attributes.js index 12061aa..151a1d4 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 _0x1488=['manual','scheduled','INTEGER','UNSIGNED','moment','exports','STRING','ENUM','csv','DATE'];(function(_0x4b9dc9,_0x14b3a2){var _0x57b302=function(_0x4f99ff){while(--_0x4f99ff){_0x4b9dc9['push'](_0x4b9dc9['shift']());}};_0x57b302(++_0x14b3a2);}(_0x1488,0x1c6));var _0x8148=function(_0xda6ad1,_0x5f09e3){_0xda6ad1=_0xda6ad1-0x0;var _0xedc3a5=_0x1488[_0xda6ad1];return _0xedc3a5;};'use strict';var Sequelize=require('sequelize');var moment=require(_0x8148('0x0'));module[_0x8148('0x1')]={'name':{'type':Sequelize[_0x8148('0x2')],'allowNull':![]},'basename':{'type':Sequelize['STRING'],'allowNull':![]},'output':{'type':Sequelize[_0x8148('0x3')](_0x8148('0x4'),'pdf','xlsx'),'allowNull':![],'defaultValue':'csv'},'savename':{'type':Sequelize[_0x8148('0x2')],'allowNull':![]},'startDate':{'type':Sequelize[_0x8148('0x5')]},'endDate':{'type':Sequelize[_0x8148('0x5')]},'status':{'type':Sequelize[_0x8148('0x2')],'defaultValue':'Loading'},'type':{'type':Sequelize['ENUM'](_0x8148('0x6'),_0x8148('0x7')),'allowNull':![],'defaultValue':_0x8148('0x6')},'reportId':{'type':Sequelize[_0x8148('0x8')](0xb)[_0x8148('0x9')]},'reportType':{'type':Sequelize[_0x8148('0x2')]}}; \ No newline at end of file +var _0x412b=['UNSIGNED','sequelize','exports','ENUM','pdf','xlsx','STRING','DATE','Loading','manual','INTEGER'];(function(_0x18cd5b,_0x10240b){var _0x5eaa52=function(_0x2bccad){while(--_0x2bccad){_0x18cd5b['push'](_0x18cd5b['shift']());}};_0x5eaa52(++_0x10240b);}(_0x412b,0xdd));var _0xb412=function(_0x31eaa5,_0x1f9e38){_0x31eaa5=_0x31eaa5-0x0;var _0x5bb1a6=_0x412b[_0x31eaa5];return _0x5bb1a6;};'use strict';var Sequelize=require(_0xb412('0x0'));var moment=require('moment');module[_0xb412('0x1')]={'name':{'type':Sequelize['STRING'],'allowNull':![]},'basename':{'type':Sequelize['STRING'],'allowNull':![]},'output':{'type':Sequelize[_0xb412('0x2')]('csv',_0xb412('0x3'),_0xb412('0x4')),'allowNull':![],'defaultValue':'csv'},'savename':{'type':Sequelize[_0xb412('0x5')],'allowNull':![]},'startDate':{'type':Sequelize[_0xb412('0x6')]},'endDate':{'type':Sequelize['DATE']},'status':{'type':Sequelize[_0xb412('0x5')],'defaultValue':_0xb412('0x7')},'type':{'type':Sequelize[_0xb412('0x2')]('manual','scheduled'),'allowNull':![],'defaultValue':_0xb412('0x8')},'reportId':{'type':Sequelize[_0xb412('0x9')](0xb)[_0xb412('0xa')]},'reportType':{'type':Sequelize['STRING']}}; \ No newline at end of file diff --git a/server/api/analyticExtractedReport/analyticExtractedReport.controller.js b/server/api/analyticExtractedReport/analyticExtractedReport.controller.js index 51e1d54..7ca1572 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 _0x9008=['desk.js','querystring','papaparse','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','api','../../config/utils','../../config/license/util','../../mysqldb','sendStatus','end','status','json','offset','undefined','limit','count','set','Content-Range','update','then','ExtractedReports','error','stack','name','send','index','AnalyticExtractedReport','fieldName','type','key','model','map','query','filters','intersection','attributes','fields','length','hasOwnProperty','nolimit','sort','where','pick','merge','VIRTUAL','filter','options','include','findAll','rows','show','params','keys','find','create','body','user','get','Unable\x20to\x20retrieve\x20the\x20current\x20user','role','userProfileId','autoAssociation','UserProfileResource','catch','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','download','basename','savename','join','root','server/files/reports','exists','%s.%s','output','toLowerCase','eml-format','zip-dir','fast-json-patch','moment','mustache','util','sox','ejs','fs-extra','lodash','squel','jsforce'];(function(_0x29aa1b,_0x244578){var _0x57c889=function(_0x12cd31){while(--_0x12cd31){_0x29aa1b['push'](_0x29aa1b['shift']());}};_0x57c889(++_0x244578);}(_0x9008,0xa8));var _0x8900=function(_0x336665,_0x271933){_0x336665=_0x336665-0x0;var _0x4a3457=_0x9008[_0x336665];return _0x4a3457;};'use strict';var emlformat=require(_0x8900('0x0'));var rimraf=require('rimraf');var zipdir=require(_0x8900('0x1'));var jsonpatch=require(_0x8900('0x2'));var rp=require('request-promise');var moment=require(_0x8900('0x3'));var BPromise=require('bluebird');var Mustache=require(_0x8900('0x4'));var util=require(_0x8900('0x5'));var path=require('path');var sox=require(_0x8900('0x6'));var csv=require('to-csv');var ejs=require(_0x8900('0x7'));var fs=require('fs');var fs_extra=require(_0x8900('0x8'));var _=require(_0x8900('0x9'));var squel=require(_0x8900('0xa'));var crypto=require('crypto');var jsforce=require(_0x8900('0xb'));var deskjs=require(_0x8900('0xc'));var toCsv=require('to-csv');var querystring=require(_0x8900('0xd'));var Papa=require(_0x8900('0xe'));var Redis=require('ioredis');var authService=require(_0x8900('0xf'));var qs=require(_0x8900('0x10'));var as=require(_0x8900('0x11'));var hardwareService=require(_0x8900('0x12'));var logger=require('../../config/logger')(_0x8900('0x13'));var utils=require(_0x8900('0x14'));var config=require('../../config/environment');var licenseUtil=require(_0x8900('0x15'));var db=require(_0x8900('0x16'))['db'];function respondWithStatusCode(_0x3ffd81,_0x1076b2){_0x1076b2=_0x1076b2||0xcc;return function(_0x27d2b5){if(_0x27d2b5){return _0x3ffd81[_0x8900('0x17')](_0x1076b2);}return _0x3ffd81['status'](_0x1076b2)[_0x8900('0x18')]();};}function respondWithResult(_0x4b91ca,_0x1e3236){_0x1e3236=_0x1e3236||0xc8;return function(_0x4938f7){if(_0x4938f7){return _0x4b91ca[_0x8900('0x19')](_0x1e3236)[_0x8900('0x1a')](_0x4938f7);}};}function respondWithFilteredResult(_0x5cef44,_0x2b89b8){return function(_0x5d3bda){if(_0x5d3bda){var _0x3cf87e=typeof _0x2b89b8[_0x8900('0x1b')]===_0x8900('0x1c')&&typeof _0x2b89b8[_0x8900('0x1d')]==='undefined';var _0x5410f0=_0x5d3bda['count'];var _0x5b90d1=_0x3cf87e?0x0:_0x2b89b8['offset'];var _0x21ae66=_0x3cf87e?_0x5d3bda[_0x8900('0x1e')]:_0x2b89b8[_0x8900('0x1b')]+_0x2b89b8[_0x8900('0x1d')];var _0x1fd67b;if(_0x21ae66>=_0x5410f0){_0x21ae66=_0x5410f0;_0x1fd67b=0xc8;}else{_0x1fd67b=0xce;}_0x5cef44[_0x8900('0x19')](_0x1fd67b);return _0x5cef44[_0x8900('0x1f')](_0x8900('0x20'),_0x5b90d1+'-'+_0x21ae66+'/'+_0x5410f0)[_0x8900('0x1a')](_0x5d3bda);}return null;};}function patchUpdates(_0x1ca51d){return function(_0x5e2040){try{jsonpatch['apply'](_0x5e2040,_0x1ca51d,!![]);}catch(_0x1a059f){return BPromise['reject'](_0x1a059f);}return _0x5e2040['save']();};}function saveUpdates(_0x38fc13,_0x72643a){return function(_0x160126){if(_0x160126){return _0x160126[_0x8900('0x21')](_0x38fc13)[_0x8900('0x22')](function(_0x2c7f9f){return _0x2c7f9f;});}return null;};}function removeEntity(_0x323fd1,_0x37be58){return function(_0x409820){if(_0x409820){return _0x409820['destroy']()[_0x8900('0x22')](function(){var _0x4d1e93=_0x409820['get']({'plain':!![]});var _0x336614=_0x8900('0x23');return db['UserProfileResource']['destroy']({'where':{'type':_0x336614,'resourceId':_0x4d1e93['id']}})[_0x8900('0x22')](function(){return _0x409820;});})[_0x8900('0x22')](function(){_0x323fd1['status'](0xcc)[_0x8900('0x18')]();});}};}function handleEntityNotFound(_0x32c2e0,_0x473e1f){return function(_0x39896e){if(!_0x39896e){_0x32c2e0[_0x8900('0x17')](0x194);}return _0x39896e;};}function handleError(_0x1e7b05,_0x17cf97){_0x17cf97=_0x17cf97||0x1f4;return function(_0x4ae7f9){logger[_0x8900('0x24')](_0x4ae7f9[_0x8900('0x25')]);if(_0x4ae7f9[_0x8900('0x26')]){delete _0x4ae7f9[_0x8900('0x26')];}_0x1e7b05[_0x8900('0x19')](_0x17cf97)[_0x8900('0x27')](_0x4ae7f9);};}exports[_0x8900('0x28')]=function(_0x168d69,_0x3086bb){var _0x25a870={},_0x543dad={},_0x590080={'count':0x0,'rows':[]};var _0x564d22=_['map'](db[_0x8900('0x29')]['rawAttributes'],function(_0x1e6eed){return{'name':_0x1e6eed[_0x8900('0x2a')],'type':_0x1e6eed[_0x8900('0x2b')][_0x8900('0x2c')]};});_0x543dad[_0x8900('0x2d')]=_[_0x8900('0x2e')](_0x564d22,_0x8900('0x26'));_0x543dad[_0x8900('0x2f')]=_['keys'](_0x168d69['query']);_0x543dad[_0x8900('0x30')]=_[_0x8900('0x31')](_0x543dad['model'],_0x543dad[_0x8900('0x2f')]);_0x25a870[_0x8900('0x32')]=_[_0x8900('0x31')](_0x543dad[_0x8900('0x2d')],qs['fields'](_0x168d69[_0x8900('0x2f')][_0x8900('0x33')]));_0x25a870[_0x8900('0x32')]=_0x25a870[_0x8900('0x32')][_0x8900('0x34')]?_0x25a870[_0x8900('0x32')]:_0x543dad[_0x8900('0x2d')];if(!_0x168d69[_0x8900('0x2f')][_0x8900('0x35')](_0x8900('0x36'))){_0x25a870[_0x8900('0x1d')]=qs['limit'](_0x168d69['query'][_0x8900('0x1d')]);_0x25a870[_0x8900('0x1b')]=qs[_0x8900('0x1b')](_0x168d69[_0x8900('0x2f')][_0x8900('0x1b')]);}_0x25a870['order']=qs[_0x8900('0x37')](_0x168d69[_0x8900('0x2f')][_0x8900('0x37')]);_0x25a870[_0x8900('0x38')]=qs[_0x8900('0x30')](_[_0x8900('0x39')](_0x168d69['query'],_0x543dad[_0x8900('0x30')]),_0x564d22);if(_0x168d69[_0x8900('0x2f')]['filter']){_0x25a870[_0x8900('0x38')]=_[_0x8900('0x3a')](_0x25a870[_0x8900('0x38')],{'$or':_['map'](_0x564d22,function(_0x5d0993){if(_0x5d0993[_0x8900('0x2b')]!==_0x8900('0x3b')){var _0x3847b8={};_0x3847b8[_0x5d0993[_0x8900('0x26')]]={'$like':'%'+_0x168d69['query'][_0x8900('0x3c')]+'%'};return _0x3847b8;}})});}_0x25a870=_['merge']({},_0x25a870,_0x168d69[_0x8900('0x3d')]);var _0xfb9e5={'where':_0x25a870['where']};return db[_0x8900('0x29')][_0x8900('0x1e')](_0xfb9e5)['then'](function(_0x375c17){_0x590080[_0x8900('0x1e')]=_0x375c17;if(_0x168d69[_0x8900('0x2f')]['includeAll']){_0x25a870[_0x8900('0x3e')]=[{'all':!![]}];}return db[_0x8900('0x29')][_0x8900('0x3f')](_0x25a870);})[_0x8900('0x22')](function(_0x2cb46b){_0x590080[_0x8900('0x40')]=_0x2cb46b;return _0x590080;})[_0x8900('0x22')](respondWithFilteredResult(_0x3086bb,_0x25a870))['catch'](handleError(_0x3086bb,null));};exports[_0x8900('0x41')]=function(_0x22f7af,_0x40ed2e){var _0x3e73ce={'raw':!![],'where':{'id':_0x22f7af[_0x8900('0x42')]['id']}},_0xac3258={};_0xac3258[_0x8900('0x2d')]=_[_0x8900('0x43')](db[_0x8900('0x29')]['rawAttributes']);_0xac3258[_0x8900('0x2f')]=_['keys'](_0x22f7af[_0x8900('0x2f')]);_0xac3258[_0x8900('0x30')]=_[_0x8900('0x31')](_0xac3258[_0x8900('0x2d')],_0xac3258[_0x8900('0x2f')]);_0x3e73ce[_0x8900('0x32')]=_[_0x8900('0x31')](_0xac3258[_0x8900('0x2d')],qs[_0x8900('0x33')](_0x22f7af[_0x8900('0x2f')][_0x8900('0x33')]));_0x3e73ce[_0x8900('0x32')]=_0x3e73ce[_0x8900('0x32')]['length']?_0x3e73ce[_0x8900('0x32')]:_0xac3258[_0x8900('0x2d')];if(_0x22f7af['query']['includeAll']){_0x3e73ce[_0x8900('0x3e')]=[{'all':!![]}];}_0x3e73ce=_[_0x8900('0x3a')]({},_0x3e73ce,_0x22f7af[_0x8900('0x3d')]);return db[_0x8900('0x29')][_0x8900('0x44')](_0x3e73ce)[_0x8900('0x22')](handleEntityNotFound(_0x40ed2e,null))[_0x8900('0x22')](respondWithResult(_0x40ed2e,null))['catch'](handleError(_0x40ed2e,null));};exports[_0x8900('0x45')]=function(_0x4f52da,_0x5d3365){return db[_0x8900('0x29')]['create'](_0x4f52da[_0x8900('0x46')],{})['then'](function(_0x586b68){var _0x1412c9=_0x4f52da[_0x8900('0x47')][_0x8900('0x48')]({'plain':!![]});if(!_0x1412c9)throw new Error(_0x8900('0x49'));if(_0x1412c9[_0x8900('0x4a')]===_0x8900('0x47')){var _0x6fa6fa=_0x586b68[_0x8900('0x48')]({'plain':!![]});var _0x3443cb=_0x8900('0x23');return db['UserProfileSection'][_0x8900('0x44')]({'where':{'name':_0x3443cb,'userProfileId':_0x1412c9[_0x8900('0x4b')]},'raw':!![]})[_0x8900('0x22')](function(_0x4c766b){if(_0x4c766b&&_0x4c766b[_0x8900('0x4c')]===0x0){return db[_0x8900('0x4d')][_0x8900('0x45')]({'name':_0x6fa6fa[_0x8900('0x26')],'resourceId':_0x6fa6fa['id'],'type':_0x4c766b[_0x8900('0x26')],'sectionId':_0x4c766b['id']},{})['then'](function(){return _0x586b68;});}else{return _0x586b68;}})[_0x8900('0x4e')](function(_0x2067fa){logger[_0x8900('0x24')](_0x8900('0x4f'),_0x2067fa);throw _0x2067fa;});}return _0x586b68;})[_0x8900('0x22')](respondWithResult(_0x5d3365,0xc9))[_0x8900('0x4e')](handleError(_0x5d3365,null));};exports['update']=function(_0x223b2a,_0x562bae){if(_0x223b2a['body']['id']){delete _0x223b2a[_0x8900('0x46')]['id'];}return db[_0x8900('0x29')][_0x8900('0x44')]({'where':{'id':_0x223b2a[_0x8900('0x42')]['id']}})[_0x8900('0x22')](handleEntityNotFound(_0x562bae,null))['then'](saveUpdates(_0x223b2a['body'],null))['then'](respondWithResult(_0x562bae,null))['catch'](handleError(_0x562bae,null));};exports['destroy']=function(_0x3665d0,_0x2d8268){return db[_0x8900('0x29')][_0x8900('0x44')]({'where':{'id':_0x3665d0[_0x8900('0x42')]['id']}})[_0x8900('0x22')](handleEntityNotFound(_0x2d8268,null))[_0x8900('0x22')](removeEntity(_0x2d8268,null))['catch'](handleError(_0x2d8268,null));};exports[_0x8900('0x50')]=function(_0x2798e6,_0x115db9,_0x2c4194){return db[_0x8900('0x29')][_0x8900('0x44')]({'where':{'id':_0x2798e6[_0x8900('0x42')]['id']},'attributes':[_0x8900('0x26'),_0x8900('0x51'),_0x8900('0x52'),'output'],'raw':!![]})[_0x8900('0x22')](handleEntityNotFound(_0x115db9,null))[_0x8900('0x22')](function(_0x16cb0f){if(_0x16cb0f){if(!fs['existsSync'](path[_0x8900('0x53')](config[_0x8900('0x54')],_0x8900('0x55'),_0x16cb0f['savename']))){throw new db['Sequelize']['ValidationError']('Report\x20not\x20found\x20or\x20empty');}if(_0x2798e6[_0x8900('0x2f')][_0x8900('0x56')]){return _0x115db9[_0x8900('0x17')](0xc8);}return _0x115db9[_0x8900('0x50')](path[_0x8900('0x53')](config[_0x8900('0x54')],_0x8900('0x55'),_0x16cb0f[_0x8900('0x52')]),util['format'](_0x8900('0x57'),_0x16cb0f['basename']||_0x16cb0f[_0x8900('0x26')],_0x16cb0f[_0x8900('0x58')][_0x8900('0x59')]()));}})[_0x8900('0x4e')](handleError(_0x115db9,null));}; \ No newline at end of file +var _0x7fd4=['order','sort','pick','filter','where','VIRTUAL','options','include','findAll','show','length','includeAll','merge','find','create','body','Unable\x20to\x20retrieve\x20the\x20current\x20user','role','user','userProfileId','autoAssociation','catch','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','params','basename','output','existsSync','join','server/files/reports','ValidationError','Report\x20not\x20found\x20or\x20empty','exists','root','format','toLowerCase','eml-format','rimraf','zip-dir','fast-json-patch','moment','bluebird','mustache','util','path','sox','to-csv','ejs','fs-extra','lodash','squel','crypto','desk.js','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','sendStatus','status','end','offset','undefined','count','set','Content-Range','json','apply','reject','save','update','then','destroy','get','ExtractedReports','UserProfileResource','error','stack','name','send','map','AnalyticExtractedReport','rawAttributes','fieldName','type','model','query','keys','filters','intersection','attributes','fields','hasOwnProperty','nolimit','limit'];(function(_0x400b6e,_0x40c74b){var _0x28bbca=function(_0x6fcb4a){while(--_0x6fcb4a){_0x400b6e['push'](_0x400b6e['shift']());}};_0x28bbca(++_0x40c74b);}(_0x7fd4,0xe7));var _0x47fd=function(_0x3a2118,_0x31fc3c){_0x3a2118=_0x3a2118-0x0;var _0x1d181d=_0x7fd4[_0x3a2118];return _0x1d181d;};'use strict';var emlformat=require(_0x47fd('0x0'));var rimraf=require(_0x47fd('0x1'));var zipdir=require(_0x47fd('0x2'));var jsonpatch=require(_0x47fd('0x3'));var rp=require('request-promise');var moment=require(_0x47fd('0x4'));var BPromise=require(_0x47fd('0x5'));var Mustache=require(_0x47fd('0x6'));var util=require(_0x47fd('0x7'));var path=require(_0x47fd('0x8'));var sox=require(_0x47fd('0x9'));var csv=require(_0x47fd('0xa'));var ejs=require(_0x47fd('0xb'));var fs=require('fs');var fs_extra=require(_0x47fd('0xc'));var _=require(_0x47fd('0xd'));var squel=require(_0x47fd('0xe'));var crypto=require(_0x47fd('0xf'));var jsforce=require('jsforce');var deskjs=require(_0x47fd('0x10'));var toCsv=require(_0x47fd('0xa'));var querystring=require(_0x47fd('0x11'));var Papa=require(_0x47fd('0x12'));var Redis=require(_0x47fd('0x13'));var authService=require(_0x47fd('0x14'));var qs=require(_0x47fd('0x15'));var as=require(_0x47fd('0x16'));var hardwareService=require(_0x47fd('0x17'));var logger=require(_0x47fd('0x18'))(_0x47fd('0x19'));var utils=require('../../config/utils');var config=require('../../config/environment');var licenseUtil=require('../../config/license/util');var db=require('../../mysqldb')['db'];function respondWithStatusCode(_0x486777,_0x13f9a8){_0x13f9a8=_0x13f9a8||0xcc;return function(_0x203f95){if(_0x203f95){return _0x486777[_0x47fd('0x1a')](_0x13f9a8);}return _0x486777[_0x47fd('0x1b')](_0x13f9a8)[_0x47fd('0x1c')]();};}function respondWithResult(_0xa02ba1,_0x2e1c2b){_0x2e1c2b=_0x2e1c2b||0xc8;return function(_0x5414fe){if(_0x5414fe){return _0xa02ba1[_0x47fd('0x1b')](_0x2e1c2b)['json'](_0x5414fe);}};}function respondWithFilteredResult(_0x405cdb,_0xa1bec9){return function(_0xac2cee){if(_0xac2cee){var _0x39ec92=typeof _0xa1bec9[_0x47fd('0x1d')]===_0x47fd('0x1e')&&typeof _0xa1bec9['limit']===_0x47fd('0x1e');var _0xd13ba2=_0xac2cee[_0x47fd('0x1f')];var _0x8f6e8c=_0x39ec92?0x0:_0xa1bec9[_0x47fd('0x1d')];var _0x335d65=_0x39ec92?_0xac2cee[_0x47fd('0x1f')]:_0xa1bec9[_0x47fd('0x1d')]+_0xa1bec9['limit'];var _0x4a3d94;if(_0x335d65>=_0xd13ba2){_0x335d65=_0xd13ba2;_0x4a3d94=0xc8;}else{_0x4a3d94=0xce;}_0x405cdb[_0x47fd('0x1b')](_0x4a3d94);return _0x405cdb[_0x47fd('0x20')](_0x47fd('0x21'),_0x8f6e8c+'-'+_0x335d65+'/'+_0xd13ba2)[_0x47fd('0x22')](_0xac2cee);}return null;};}function patchUpdates(_0x3d24d9){return function(_0x1d365a){try{jsonpatch[_0x47fd('0x23')](_0x1d365a,_0x3d24d9,!![]);}catch(_0x56ec77){return BPromise[_0x47fd('0x24')](_0x56ec77);}return _0x1d365a[_0x47fd('0x25')]();};}function saveUpdates(_0x5e4a7b,_0x50792b){return function(_0x42c93f){if(_0x42c93f){return _0x42c93f[_0x47fd('0x26')](_0x5e4a7b)[_0x47fd('0x27')](function(_0x12d617){return _0x12d617;});}return null;};}function removeEntity(_0xb17bbf,_0x1a0c33){return function(_0x2d46a9){if(_0x2d46a9){return _0x2d46a9[_0x47fd('0x28')]()[_0x47fd('0x27')](function(){var _0x27fddd=_0x2d46a9[_0x47fd('0x29')]({'plain':!![]});var _0x2fca15=_0x47fd('0x2a');return db[_0x47fd('0x2b')][_0x47fd('0x28')]({'where':{'type':_0x2fca15,'resourceId':_0x27fddd['id']}})[_0x47fd('0x27')](function(){return _0x2d46a9;});})[_0x47fd('0x27')](function(){_0xb17bbf[_0x47fd('0x1b')](0xcc)[_0x47fd('0x1c')]();});}};}function handleEntityNotFound(_0xc465f9,_0x36d408){return function(_0x595fc3){if(!_0x595fc3){_0xc465f9['sendStatus'](0x194);}return _0x595fc3;};}function handleError(_0x599a4a,_0x197ac8){_0x197ac8=_0x197ac8||0x1f4;return function(_0x25f24a){logger[_0x47fd('0x2c')](_0x25f24a[_0x47fd('0x2d')]);if(_0x25f24a['name']){delete _0x25f24a[_0x47fd('0x2e')];}_0x599a4a[_0x47fd('0x1b')](_0x197ac8)[_0x47fd('0x2f')](_0x25f24a);};}exports['index']=function(_0x3a7d6c,_0x202540){var _0x308191={},_0x5c92ad={},_0x4d669a={'count':0x0,'rows':[]};var _0x54246c=_[_0x47fd('0x30')](db[_0x47fd('0x31')][_0x47fd('0x32')],function(_0x20441b){return{'name':_0x20441b[_0x47fd('0x33')],'type':_0x20441b[_0x47fd('0x34')]['key']};});_0x5c92ad[_0x47fd('0x35')]=_[_0x47fd('0x30')](_0x54246c,_0x47fd('0x2e'));_0x5c92ad[_0x47fd('0x36')]=_[_0x47fd('0x37')](_0x3a7d6c[_0x47fd('0x36')]);_0x5c92ad[_0x47fd('0x38')]=_[_0x47fd('0x39')](_0x5c92ad[_0x47fd('0x35')],_0x5c92ad[_0x47fd('0x36')]);_0x308191[_0x47fd('0x3a')]=_['intersection'](_0x5c92ad[_0x47fd('0x35')],qs[_0x47fd('0x3b')](_0x3a7d6c[_0x47fd('0x36')][_0x47fd('0x3b')]));_0x308191[_0x47fd('0x3a')]=_0x308191[_0x47fd('0x3a')]['length']?_0x308191[_0x47fd('0x3a')]:_0x5c92ad[_0x47fd('0x35')];if(!_0x3a7d6c[_0x47fd('0x36')][_0x47fd('0x3c')](_0x47fd('0x3d'))){_0x308191[_0x47fd('0x3e')]=qs[_0x47fd('0x3e')](_0x3a7d6c[_0x47fd('0x36')][_0x47fd('0x3e')]);_0x308191['offset']=qs[_0x47fd('0x1d')](_0x3a7d6c['query'][_0x47fd('0x1d')]);}_0x308191[_0x47fd('0x3f')]=qs[_0x47fd('0x40')](_0x3a7d6c[_0x47fd('0x36')][_0x47fd('0x40')]);_0x308191['where']=qs[_0x47fd('0x38')](_[_0x47fd('0x41')](_0x3a7d6c[_0x47fd('0x36')],_0x5c92ad[_0x47fd('0x38')]),_0x54246c);if(_0x3a7d6c[_0x47fd('0x36')][_0x47fd('0x42')]){_0x308191[_0x47fd('0x43')]=_['merge'](_0x308191[_0x47fd('0x43')],{'$or':_['map'](_0x54246c,function(_0x366779){if(_0x366779['type']!==_0x47fd('0x44')){var _0x10e845={};_0x10e845[_0x366779['name']]={'$like':'%'+_0x3a7d6c[_0x47fd('0x36')][_0x47fd('0x42')]+'%'};return _0x10e845;}})});}_0x308191=_['merge']({},_0x308191,_0x3a7d6c[_0x47fd('0x45')]);var _0x38628e={'where':_0x308191[_0x47fd('0x43')]};return db[_0x47fd('0x31')][_0x47fd('0x1f')](_0x38628e)[_0x47fd('0x27')](function(_0x3350fd){_0x4d669a[_0x47fd('0x1f')]=_0x3350fd;if(_0x3a7d6c[_0x47fd('0x36')]['includeAll']){_0x308191[_0x47fd('0x46')]=[{'all':!![]}];}return db[_0x47fd('0x31')][_0x47fd('0x47')](_0x308191);})[_0x47fd('0x27')](function(_0x4bd7d3){_0x4d669a['rows']=_0x4bd7d3;return _0x4d669a;})[_0x47fd('0x27')](respondWithFilteredResult(_0x202540,_0x308191))['catch'](handleError(_0x202540,null));};exports[_0x47fd('0x48')]=function(_0x38d2ca,_0xfb3b07){var _0x2afda4={'raw':!![],'where':{'id':_0x38d2ca['params']['id']}},_0x28665e={};_0x28665e[_0x47fd('0x35')]=_[_0x47fd('0x37')](db['AnalyticExtractedReport']['rawAttributes']);_0x28665e[_0x47fd('0x36')]=_[_0x47fd('0x37')](_0x38d2ca[_0x47fd('0x36')]);_0x28665e[_0x47fd('0x38')]=_[_0x47fd('0x39')](_0x28665e[_0x47fd('0x35')],_0x28665e[_0x47fd('0x36')]);_0x2afda4[_0x47fd('0x3a')]=_[_0x47fd('0x39')](_0x28665e[_0x47fd('0x35')],qs[_0x47fd('0x3b')](_0x38d2ca['query'][_0x47fd('0x3b')]));_0x2afda4[_0x47fd('0x3a')]=_0x2afda4[_0x47fd('0x3a')][_0x47fd('0x49')]?_0x2afda4[_0x47fd('0x3a')]:_0x28665e[_0x47fd('0x35')];if(_0x38d2ca[_0x47fd('0x36')][_0x47fd('0x4a')]){_0x2afda4['include']=[{'all':!![]}];}_0x2afda4=_[_0x47fd('0x4b')]({},_0x2afda4,_0x38d2ca[_0x47fd('0x45')]);return db['AnalyticExtractedReport'][_0x47fd('0x4c')](_0x2afda4)['then'](handleEntityNotFound(_0xfb3b07,null))[_0x47fd('0x27')](respondWithResult(_0xfb3b07,null))['catch'](handleError(_0xfb3b07,null));};exports[_0x47fd('0x4d')]=function(_0x373323,_0x2577dc){return db[_0x47fd('0x31')]['create'](_0x373323[_0x47fd('0x4e')],{})['then'](function(_0x1561df){var _0x35d2f8=_0x373323['user'][_0x47fd('0x29')]({'plain':!![]});if(!_0x35d2f8)throw new Error(_0x47fd('0x4f'));if(_0x35d2f8[_0x47fd('0x50')]===_0x47fd('0x51')){var _0x4a81e3=_0x1561df[_0x47fd('0x29')]({'plain':!![]});var _0x43f233=_0x47fd('0x2a');return db['UserProfileSection'][_0x47fd('0x4c')]({'where':{'name':_0x43f233,'userProfileId':_0x35d2f8[_0x47fd('0x52')]},'raw':!![]})[_0x47fd('0x27')](function(_0x564aec){if(_0x564aec&&_0x564aec[_0x47fd('0x53')]===0x0){return db[_0x47fd('0x2b')]['create']({'name':_0x4a81e3[_0x47fd('0x2e')],'resourceId':_0x4a81e3['id'],'type':_0x564aec[_0x47fd('0x2e')],'sectionId':_0x564aec['id']},{})[_0x47fd('0x27')](function(){return _0x1561df;});}else{return _0x1561df;}})[_0x47fd('0x54')](function(_0x4821fc){logger[_0x47fd('0x2c')](_0x47fd('0x55'),_0x4821fc);throw _0x4821fc;});}return _0x1561df;})[_0x47fd('0x27')](respondWithResult(_0x2577dc,0xc9))['catch'](handleError(_0x2577dc,null));};exports['update']=function(_0x3f851b,_0x111aa1){if(_0x3f851b[_0x47fd('0x4e')]['id']){delete _0x3f851b[_0x47fd('0x4e')]['id'];}return db[_0x47fd('0x31')][_0x47fd('0x4c')]({'where':{'id':_0x3f851b[_0x47fd('0x56')]['id']}})[_0x47fd('0x27')](handleEntityNotFound(_0x111aa1,null))['then'](saveUpdates(_0x3f851b[_0x47fd('0x4e')],null))[_0x47fd('0x27')](respondWithResult(_0x111aa1,null))[_0x47fd('0x54')](handleError(_0x111aa1,null));};exports[_0x47fd('0x28')]=function(_0x177598,_0x4414be){return db[_0x47fd('0x31')][_0x47fd('0x4c')]({'where':{'id':_0x177598[_0x47fd('0x56')]['id']}})[_0x47fd('0x27')](handleEntityNotFound(_0x4414be,null))['then'](removeEntity(_0x4414be,null))[_0x47fd('0x54')](handleError(_0x4414be,null));};exports['download']=function(_0x5a1b94,_0x2cfdce,_0x5e4093){return db[_0x47fd('0x31')][_0x47fd('0x4c')]({'where':{'id':_0x5a1b94[_0x47fd('0x56')]['id']},'attributes':['name',_0x47fd('0x57'),'savename',_0x47fd('0x58')],'raw':!![]})[_0x47fd('0x27')](handleEntityNotFound(_0x2cfdce,null))[_0x47fd('0x27')](function(_0x4b6673){if(_0x4b6673){if(!fs[_0x47fd('0x59')](path[_0x47fd('0x5a')](config['root'],_0x47fd('0x5b'),_0x4b6673['savename']))){throw new db['Sequelize'][(_0x47fd('0x5c'))](_0x47fd('0x5d'));}if(_0x5a1b94['query'][_0x47fd('0x5e')]){return _0x2cfdce['sendStatus'](0xc8);}return _0x2cfdce['download'](path['join'](config[_0x47fd('0x5f')],_0x47fd('0x5b'),_0x4b6673['savename']),util[_0x47fd('0x60')]('%s.%s',_0x4b6673[_0x47fd('0x57')]||_0x4b6673['name'],_0x4b6673['output'][_0x47fd('0x61')]()));}})['catch'](handleError(_0x2cfdce,null));}; \ No newline at end of file diff --git a/server/api/analyticExtractedReport/analyticExtractedReport.model.js b/server/api/analyticExtractedReport/analyticExtractedReport.model.js index d610d3b..7ee86f8 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 _0x9bb2=['lodash','util','api','moment','request-promise','path','rimraf','./analyticExtractedReport.attributes','exports','AnalyticExtractedReport','analytics_extracted_reports'];(function(_0x5199f2,_0x50c991){var _0x2f5bb0=function(_0x5575a5){while(--_0x5575a5){_0x5199f2['push'](_0x5199f2['shift']());}};_0x2f5bb0(++_0x50c991);}(_0x9bb2,0x8f));var _0x29bb=function(_0x256533,_0x56d20d){_0x256533=_0x256533-0x0;var _0x50ee9e=_0x9bb2[_0x256533];return _0x50ee9e;};'use strict';var _=require(_0x29bb('0x0'));var util=require(_0x29bb('0x1'));var logger=require('../../config/logger')(_0x29bb('0x2'));var moment=require(_0x29bb('0x3'));var BPromise=require('bluebird');var rp=require(_0x29bb('0x4'));var fs=require('fs');var path=require(_0x29bb('0x5'));var rimraf=require(_0x29bb('0x6'));var config=require('../../config/environment');var attributes=require(_0x29bb('0x7'));module[_0x29bb('0x8')]=function(_0x5bdd46,_0x5c8f60){return _0x5bdd46['define'](_0x29bb('0x9'),attributes,{'tableName':_0x29bb('0xa'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x459d=['path','rimraf','../../config/environment','exports','define','AnalyticExtractedReport','analytics_extracted_reports','util','api','bluebird','request-promise'];(function(_0xdd827a,_0x482ad2){var _0x2f46f1=function(_0x221046){while(--_0x221046){_0xdd827a['push'](_0xdd827a['shift']());}};_0x2f46f1(++_0x482ad2);}(_0x459d,0x1e0));var _0xd459=function(_0x3cd291,_0xf033f3){_0x3cd291=_0x3cd291-0x0;var _0x2df034=_0x459d[_0x3cd291];return _0x2df034;};'use strict';var _=require('lodash');var util=require(_0xd459('0x0'));var logger=require('../../config/logger')(_0xd459('0x1'));var moment=require('moment');var BPromise=require(_0xd459('0x2'));var rp=require(_0xd459('0x3'));var fs=require('fs');var path=require(_0xd459('0x4'));var rimraf=require(_0xd459('0x5'));var config=require(_0xd459('0x6'));var attributes=require('./analyticExtractedReport.attributes');module[_0xd459('0x7')]=function(_0x19ed19,_0x163749){return _0x19ed19[_0xd459('0x8')](_0xd459('0x9'),attributes,{'tableName':_0xd459('0xa'),'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 3a9f9b4..86dfba0 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 _0xa4ad=['../../mysqldb','../../config/utils','../../config/environment','jayson/promise','request','then','info','AnalyticExtractedReport,\x20%s,\x20%s','AnalyticExtractedReport,\x20%s,\x20%s,\x20%s','request\x20sent','error','code','message','result','lodash','moment','bluebird','randomstring','ioredis'];(function(_0x3be1ef,_0x18dfb5){var _0x5680cc=function(_0x224184){while(--_0x224184){_0x3be1ef['push'](_0x3be1ef['shift']());}};_0x5680cc(++_0x18dfb5);}(_0xa4ad,0x80));var _0xda4a=function(_0x172133,_0x10246b){_0x172133=_0x172133-0x0;var _0x2460e5=_0xa4ad[_0x172133];return _0x2460e5;};'use strict';var _=require(_0xda4a('0x0'));var util=require('util');var moment=require(_0xda4a('0x1'));var BPromise=require(_0xda4a('0x2'));var rs=require(_0xda4a('0x3'));var fs=require('fs');var Redis=require(_0xda4a('0x4'));var db=require(_0xda4a('0x5'))['db'];var utils=require(_0xda4a('0x6'));var logger=require('../../config/logger')('rpc');var config=require(_0xda4a('0x7'));var jayson=require(_0xda4a('0x8'));var client=jayson['client']['http']({'port':0x232a});function respondWithRpcPromise(_0x33597c,_0x12d5b1,_0x1786c3){return new BPromise(function(_0x392abf,_0x236f49){return client[_0xda4a('0x9')](_0x33597c,_0x1786c3)[_0xda4a('0xa')](function(_0x1bec50){logger[_0xda4a('0xb')](_0xda4a('0xc'),_0x12d5b1,'request\x20sent');logger['debug'](_0xda4a('0xd'),_0x12d5b1,_0xda4a('0xe'),JSON['stringify'](_0x1bec50));if(_0x1bec50[_0xda4a('0xf')]){if(_0x1bec50[_0xda4a('0xf')][_0xda4a('0x10')]===0x1f4){logger[_0xda4a('0xf')](_0xda4a('0xc'),_0x12d5b1,_0x1bec50[_0xda4a('0xf')][_0xda4a('0x11')]);return _0x236f49(_0x1bec50[_0xda4a('0xf')][_0xda4a('0x11')]);}logger[_0xda4a('0xf')](_0xda4a('0xc'),_0x12d5b1,_0x1bec50[_0xda4a('0xf')][_0xda4a('0x11')]);return _0x392abf(_0x1bec50[_0xda4a('0xf')][_0xda4a('0x11')]);}else{logger[_0xda4a('0xb')](_0xda4a('0xc'),_0x12d5b1,_0xda4a('0xe'));_0x392abf(_0x1bec50[_0xda4a('0x12')][_0xda4a('0x11')]);}})['catch'](function(_0x3e9929){logger[_0xda4a('0xf')](_0xda4a('0xc'),_0x12d5b1,_0x3e9929);_0x236f49(_0x3e9929);});});} \ No newline at end of file +var _0xe2b5=['../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','client','info','request\x20sent','debug','AnalyticExtractedReport,\x20%s,\x20%s,\x20%s','stringify','error','AnalyticExtractedReport,\x20%s,\x20%s','message','result','catch','moment','bluebird','randomstring','ioredis'];(function(_0x57b54c,_0x54ce0d){var _0x59cc19=function(_0xa33bc6){while(--_0xa33bc6){_0x57b54c['push'](_0x57b54c['shift']());}};_0x59cc19(++_0x54ce0d);}(_0xe2b5,0x8f));var _0x5e2b=function(_0x59cdd0,_0x56af37){_0x59cdd0=_0x59cdd0-0x0;var _0x41bf3d=_0xe2b5[_0x59cdd0];return _0x41bf3d;};'use strict';var _=require('lodash');var util=require('util');var moment=require(_0x5e2b('0x0'));var BPromise=require(_0x5e2b('0x1'));var rs=require(_0x5e2b('0x2'));var fs=require('fs');var Redis=require(_0x5e2b('0x3'));var db=require(_0x5e2b('0x4'))['db'];var utils=require(_0x5e2b('0x5'));var logger=require(_0x5e2b('0x6'))(_0x5e2b('0x7'));var config=require(_0x5e2b('0x8'));var jayson=require(_0x5e2b('0x9'));var client=jayson[_0x5e2b('0xa')]['http']({'port':0x232a});function respondWithRpcPromise(_0x11a0ef,_0xf99a6b,_0x20ef4c){return new BPromise(function(_0x4932e1,_0x10e8ea){return client['request'](_0x11a0ef,_0x20ef4c)['then'](function(_0x519b1d){logger[_0x5e2b('0xb')]('AnalyticExtractedReport,\x20%s,\x20%s',_0xf99a6b,_0x5e2b('0xc'));logger[_0x5e2b('0xd')](_0x5e2b('0xe'),_0xf99a6b,_0x5e2b('0xc'),JSON[_0x5e2b('0xf')](_0x519b1d));if(_0x519b1d['error']){if(_0x519b1d[_0x5e2b('0x10')]['code']===0x1f4){logger[_0x5e2b('0x10')](_0x5e2b('0x11'),_0xf99a6b,_0x519b1d[_0x5e2b('0x10')]['message']);return _0x10e8ea(_0x519b1d[_0x5e2b('0x10')][_0x5e2b('0x12')]);}logger[_0x5e2b('0x10')](_0x5e2b('0x11'),_0xf99a6b,_0x519b1d[_0x5e2b('0x10')][_0x5e2b('0x12')]);return _0x4932e1(_0x519b1d[_0x5e2b('0x10')]['message']);}else{logger[_0x5e2b('0xb')](_0x5e2b('0x11'),_0xf99a6b,_0x5e2b('0xc'));_0x4932e1(_0x519b1d[_0x5e2b('0x13')]['message']);}})[_0x5e2b('0x14')](function(_0x113aa5){logger[_0x5e2b('0x10')]('AnalyticExtractedReport,\x20%s,\x20%s',_0xf99a6b,_0x113aa5);_0x10e8ea(_0x113aa5);});});} \ No newline at end of file diff --git a/server/api/analyticExtractedReport/index.js b/server/api/analyticExtractedReport/index.js index 5732b92..214ad49 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 _0xd2d6=['update','destroy','exports','multer','util','connect-timeout','express','Router','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','get','isAuthenticated','index','/:id','/:id/download','post','create','put'];(function(_0x44793c,_0x5aee24){var _0x50a5d8=function(_0x131933){while(--_0x131933){_0x44793c['push'](_0x44793c['shift']());}};_0x50a5d8(++_0x5aee24);}(_0xd2d6,0xcb));var _0x6d2d=function(_0x9c8d7d,_0x17ed0c){_0x9c8d7d=_0x9c8d7d-0x0;var _0x13655e=_0xd2d6[_0x9c8d7d];return _0x13655e;};'use strict';var multer=require(_0x6d2d('0x0'));var util=require(_0x6d2d('0x1'));var path=require('path');var timeout=require(_0x6d2d('0x2'));var express=require(_0x6d2d('0x3'));var router=express[_0x6d2d('0x4')]();var fs_extra=require(_0x6d2d('0x5'));var auth=require(_0x6d2d('0x6'));var interaction=require(_0x6d2d('0x7'));var config=require(_0x6d2d('0x8'));var controller=require('./analyticExtractedReport.controller');router[_0x6d2d('0x9')]('/',auth[_0x6d2d('0xa')](),controller[_0x6d2d('0xb')]);router[_0x6d2d('0x9')](_0x6d2d('0xc'),auth[_0x6d2d('0xa')](),controller['show']);router[_0x6d2d('0x9')](_0x6d2d('0xd'),auth[_0x6d2d('0xa')](),controller['download']);router[_0x6d2d('0xe')]('/',auth['isAuthenticated'](),controller[_0x6d2d('0xf')]);router[_0x6d2d('0x10')](_0x6d2d('0xc'),auth[_0x6d2d('0xa')](),controller[_0x6d2d('0x11')]);router['delete'](_0x6d2d('0xc'),auth[_0x6d2d('0xa')](),controller[_0x6d2d('0x12')]);module[_0x6d2d('0x13')]=router; \ No newline at end of file +var _0x1867=['multer','path','connect-timeout','express','Router','../../components/interaction/service','../../config/environment','./analyticExtractedReport.controller','index','/:id','isAuthenticated','show','get','/:id/download','download','post','create','put','update','delete','destroy','exports'];(function(_0x156af1,_0x338401){var _0x37c138=function(_0x1f4885){while(--_0x1f4885){_0x156af1['push'](_0x156af1['shift']());}};_0x37c138(++_0x338401);}(_0x1867,0xdc));var _0x7186=function(_0x4222a7,_0x4e8265){_0x4222a7=_0x4222a7-0x0;var _0x4e6442=_0x1867[_0x4222a7];return _0x4e6442;};'use strict';var multer=require(_0x7186('0x0'));var util=require('util');var path=require(_0x7186('0x1'));var timeout=require(_0x7186('0x2'));var express=require(_0x7186('0x3'));var router=express[_0x7186('0x4')]();var fs_extra=require('fs-extra');var auth=require('../../components/auth/service');var interaction=require(_0x7186('0x5'));var config=require(_0x7186('0x6'));var controller=require(_0x7186('0x7'));router['get']('/',auth['isAuthenticated'](),controller[_0x7186('0x8')]);router['get'](_0x7186('0x9'),auth[_0x7186('0xa')](),controller[_0x7186('0xb')]);router[_0x7186('0xc')](_0x7186('0xd'),auth[_0x7186('0xa')](),controller[_0x7186('0xe')]);router[_0x7186('0xf')]('/',auth[_0x7186('0xa')](),controller[_0x7186('0x10')]);router[_0x7186('0x11')]('/:id',auth[_0x7186('0xa')](),controller[_0x7186('0x12')]);router[_0x7186('0x13')](_0x7186('0x9'),auth['isAuthenticated'](),controller[_0x7186('0x14')]);module[_0x7186('0x15')]=router; \ No newline at end of file diff --git a/server/api/analyticFieldReport/analyticFieldReport.attributes.js b/server/api/analyticFieldReport/analyticFieldReport.attributes.js index a1abb8b..b674680 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 _0xe746=['STRING'];(function(_0x441ceb,_0x548b0b){var _0x5dd2f4=function(_0x42e69c){while(--_0x42e69c){_0x441ceb['push'](_0x441ceb['shift']());}};_0x5dd2f4(++_0x548b0b);}(_0xe746,0x91));var _0x6e74=function(_0x1e5f86,_0x1e6aa1){_0x1e5f86=_0x1e5f86-0x0;var _0xb7eb6c=_0xe746[_0x1e5f86];return _0xb7eb6c;};'use strict';var Sequelize=require('sequelize');module['exports']={'field':{'type':Sequelize['TEXT']},'alias':{'type':Sequelize[_0x6e74('0x0')]},'function':{'type':Sequelize[_0x6e74('0x0')]},'format':{'type':Sequelize[_0x6e74('0x0')]},'groupBy':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'orderBy':{'type':Sequelize[_0x6e74('0x0')]},'custom':{'type':Sequelize['BOOLEAN'],'defaultValue':![]}}; \ No newline at end of file +var _0xccd2=['STRING','sequelize','exports','TEXT'];(function(_0x41d02a,_0x355e19){var _0x4c3983=function(_0x4802a7){while(--_0x4802a7){_0x41d02a['push'](_0x41d02a['shift']());}};_0x4c3983(++_0x355e19);}(_0xccd2,0x175));var _0x2ccd=function(_0x2fc7cc,_0x215e15){_0x2fc7cc=_0x2fc7cc-0x0;var _0x4647ce=_0xccd2[_0x2fc7cc];return _0x4647ce;};'use strict';var Sequelize=require(_0x2ccd('0x0'));module[_0x2ccd('0x1')]={'field':{'type':Sequelize[_0x2ccd('0x2')]},'alias':{'type':Sequelize[_0x2ccd('0x3')]},'function':{'type':Sequelize[_0x2ccd('0x3')]},'format':{'type':Sequelize[_0x2ccd('0x3')]},'groupBy':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'orderBy':{'type':Sequelize[_0x2ccd('0x3')]},'custom':{'type':Sequelize['BOOLEAN'],'defaultValue':![]}}; \ No newline at end of file diff --git a/server/api/analyticFieldReport/analyticFieldReport.controller.js b/server/api/analyticFieldReport/analyticFieldReport.controller.js index 241651c..391490f 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 _0xe59e=['update','then','destroy','error','stack','name','map','AnalyticFieldReport','rawAttributes','fieldName','type','model','query','keys','filters','intersection','attributes','fields','hasOwnProperty','nolimit','limit','order','where','pick','filter','merge','VIRTUAL','options','includeAll','include','findAll','rows','catch','show','params','length','create','body','bulkCreate','find','bulkDestroy','ids','findOne','transaction','CustomReportId','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','moment','mustache','util','path','sox','ejs','lodash','squel','crypto','jsforce','desk.js','to-csv','querystring','papaparse','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/logger','api','../../config/license/util','../../mysqldb','sendStatus','status','end','offset','undefined','count','Content-Range','apply','reject'];(function(_0x32006b,_0x296ea4){var _0x1ccf5a=function(_0x16a062){while(--_0x16a062){_0x32006b['push'](_0x32006b['shift']());}};_0x1ccf5a(++_0x296ea4);}(_0xe59e,0x7d));var _0xee59=function(_0x3e4f96,_0x562b29){_0x3e4f96=_0x3e4f96-0x0;var _0x19489c=_0xe59e[_0x3e4f96];return _0x19489c;};'use strict';var emlformat=require(_0xee59('0x0'));var rimraf=require(_0xee59('0x1'));var zipdir=require(_0xee59('0x2'));var jsonpatch=require(_0xee59('0x3'));var rp=require(_0xee59('0x4'));var moment=require(_0xee59('0x5'));var BPromise=require('bluebird');var Mustache=require(_0xee59('0x6'));var util=require(_0xee59('0x7'));var path=require(_0xee59('0x8'));var sox=require(_0xee59('0x9'));var csv=require('to-csv');var ejs=require(_0xee59('0xa'));var fs=require('fs');var fs_extra=require('fs-extra');var _=require(_0xee59('0xb'));var squel=require(_0xee59('0xc'));var crypto=require(_0xee59('0xd'));var jsforce=require(_0xee59('0xe'));var deskjs=require(_0xee59('0xf'));var toCsv=require(_0xee59('0x10'));var querystring=require(_0xee59('0x11'));var Papa=require(_0xee59('0x12'));var Redis=require('ioredis');var authService=require(_0xee59('0x13'));var qs=require(_0xee59('0x14'));var as=require(_0xee59('0x15'));var hardwareService=require('../../config/license/hardware');var logger=require(_0xee59('0x16'))(_0xee59('0x17'));var utils=require('../../config/utils');var config=require('../../config/environment');var licenseUtil=require(_0xee59('0x18'));var db=require(_0xee59('0x19'))['db'];function respondWithStatusCode(_0x8543c8,_0x48562a){_0x48562a=_0x48562a||0xcc;return function(_0x2dde74){if(_0x2dde74){return _0x8543c8[_0xee59('0x1a')](_0x48562a);}return _0x8543c8[_0xee59('0x1b')](_0x48562a)[_0xee59('0x1c')]();};}function respondWithResult(_0x472b4f,_0x1eee85){_0x1eee85=_0x1eee85||0xc8;return function(_0x4050c1){if(_0x4050c1){return _0x472b4f['status'](_0x1eee85)['json'](_0x4050c1);}};}function respondWithFilteredResult(_0x522dd5,_0x3fd104){return function(_0x3b13e4){if(_0x3b13e4){var _0x1ade79=typeof _0x3fd104[_0xee59('0x1d')]===_0xee59('0x1e')&&typeof _0x3fd104['limit']===_0xee59('0x1e');var _0x275d6b=_0x3b13e4[_0xee59('0x1f')];var _0x234e97=_0x1ade79?0x0:_0x3fd104[_0xee59('0x1d')];var _0x4fa46b=_0x1ade79?_0x3b13e4['count']:_0x3fd104[_0xee59('0x1d')]+_0x3fd104['limit'];var _0x54dbba;if(_0x4fa46b>=_0x275d6b){_0x4fa46b=_0x275d6b;_0x54dbba=0xc8;}else{_0x54dbba=0xce;}_0x522dd5['status'](_0x54dbba);return _0x522dd5['set'](_0xee59('0x20'),_0x234e97+'-'+_0x4fa46b+'/'+_0x275d6b)['json'](_0x3b13e4);}return null;};}function patchUpdates(_0x24fd33){return function(_0x5c49e9){try{jsonpatch[_0xee59('0x21')](_0x5c49e9,_0x24fd33,!![]);}catch(_0x51b6e8){return BPromise[_0xee59('0x22')](_0x51b6e8);}return _0x5c49e9['save']();};}function saveUpdates(_0x57a74e,_0x1aacdd){return function(_0x5ced07){if(_0x5ced07){return _0x5ced07[_0xee59('0x23')](_0x57a74e)[_0xee59('0x24')](function(_0x580b7e){return _0x580b7e;});}return null;};}function removeEntity(_0x1687f3,_0x435f0d){return function(_0x4c7f33){if(_0x4c7f33){return _0x4c7f33[_0xee59('0x25')]()[_0xee59('0x24')](function(){_0x1687f3[_0xee59('0x1b')](0xcc)[_0xee59('0x1c')]();});}};}function handleEntityNotFound(_0x14a0fa,_0x559960){return function(_0x29b83d){if(!_0x29b83d){_0x14a0fa[_0xee59('0x1a')](0x194);}return _0x29b83d;};}function handleError(_0xd2fdeb,_0x180ea0){_0x180ea0=_0x180ea0||0x1f4;return function(_0x1d0011){logger[_0xee59('0x26')](_0x1d0011[_0xee59('0x27')]);if(_0x1d0011['name']){delete _0x1d0011[_0xee59('0x28')];}_0xd2fdeb['status'](_0x180ea0)['send'](_0x1d0011);};}exports['index']=function(_0x42f273,_0x59143c){var _0x25f4f3={},_0x30c32b={},_0x4bd5c6={'count':0x0,'rows':[]};var _0x3210a9=_[_0xee59('0x29')](db[_0xee59('0x2a')][_0xee59('0x2b')],function(_0x42d51b){return{'name':_0x42d51b[_0xee59('0x2c')],'type':_0x42d51b[_0xee59('0x2d')]['key']};});_0x30c32b[_0xee59('0x2e')]=_['map'](_0x3210a9,_0xee59('0x28'));_0x30c32b[_0xee59('0x2f')]=_[_0xee59('0x30')](_0x42f273[_0xee59('0x2f')]);_0x30c32b[_0xee59('0x31')]=_[_0xee59('0x32')](_0x30c32b[_0xee59('0x2e')],_0x30c32b[_0xee59('0x2f')]);_0x25f4f3[_0xee59('0x33')]=_[_0xee59('0x32')](_0x30c32b[_0xee59('0x2e')],qs['fields'](_0x42f273[_0xee59('0x2f')][_0xee59('0x34')]));_0x25f4f3[_0xee59('0x33')]=_0x25f4f3['attributes']['length']?_0x25f4f3[_0xee59('0x33')]:_0x30c32b[_0xee59('0x2e')];if(!_0x42f273['query'][_0xee59('0x35')](_0xee59('0x36'))){_0x25f4f3['limit']=qs[_0xee59('0x37')](_0x42f273[_0xee59('0x2f')]['limit']);_0x25f4f3['offset']=qs[_0xee59('0x1d')](_0x42f273[_0xee59('0x2f')]['offset']);}_0x25f4f3[_0xee59('0x38')]=qs['sort'](_0x42f273[_0xee59('0x2f')]['sort']);_0x25f4f3[_0xee59('0x39')]=qs[_0xee59('0x31')](_[_0xee59('0x3a')](_0x42f273[_0xee59('0x2f')],_0x30c32b[_0xee59('0x31')]),_0x3210a9);if(_0x42f273[_0xee59('0x2f')][_0xee59('0x3b')]){_0x25f4f3[_0xee59('0x39')]=_[_0xee59('0x3c')](_0x25f4f3[_0xee59('0x39')],{'$or':_[_0xee59('0x29')](_0x3210a9,function(_0x4ac621){if(_0x4ac621['type']!==_0xee59('0x3d')){var _0x25234d={};_0x25234d[_0x4ac621[_0xee59('0x28')]]={'$like':'%'+_0x42f273[_0xee59('0x2f')]['filter']+'%'};return _0x25234d;}})});}_0x25f4f3=_[_0xee59('0x3c')]({},_0x25f4f3,_0x42f273[_0xee59('0x3e')]);var _0x3a6dd5={'where':_0x25f4f3['where']};return db[_0xee59('0x2a')][_0xee59('0x1f')](_0x3a6dd5)['then'](function(_0x5c2a9d){_0x4bd5c6[_0xee59('0x1f')]=_0x5c2a9d;if(_0x42f273[_0xee59('0x2f')][_0xee59('0x3f')]){_0x25f4f3[_0xee59('0x40')]=[{'all':!![]}];}return db[_0xee59('0x2a')][_0xee59('0x41')](_0x25f4f3);})[_0xee59('0x24')](function(_0x6ee87f){_0x4bd5c6[_0xee59('0x42')]=_0x6ee87f;return _0x4bd5c6;})['then'](respondWithFilteredResult(_0x59143c,_0x25f4f3))[_0xee59('0x43')](handleError(_0x59143c,null));};exports[_0xee59('0x44')]=function(_0x3525bd,_0x108160){var _0x459bd4={'raw':![],'where':{'id':_0x3525bd[_0xee59('0x45')]['id']}},_0x5029b5={};_0x5029b5[_0xee59('0x2e')]=_['keys'](db[_0xee59('0x2a')][_0xee59('0x2b')]);_0x5029b5[_0xee59('0x2f')]=_[_0xee59('0x30')](_0x3525bd[_0xee59('0x2f')]);_0x5029b5[_0xee59('0x31')]=_[_0xee59('0x32')](_0x5029b5[_0xee59('0x2e')],_0x5029b5[_0xee59('0x2f')]);_0x459bd4[_0xee59('0x33')]=_[_0xee59('0x32')](_0x5029b5[_0xee59('0x2e')],qs[_0xee59('0x34')](_0x3525bd[_0xee59('0x2f')][_0xee59('0x34')]));_0x459bd4[_0xee59('0x33')]=_0x459bd4[_0xee59('0x33')][_0xee59('0x46')]?_0x459bd4['attributes']:_0x5029b5[_0xee59('0x2e')];if(_0x3525bd[_0xee59('0x2f')][_0xee59('0x3f')]){_0x459bd4[_0xee59('0x40')]=[{'all':!![]}];}_0x459bd4=_[_0xee59('0x3c')]({},_0x459bd4,_0x3525bd[_0xee59('0x3e')]);return db[_0xee59('0x2a')]['find'](_0x459bd4)[_0xee59('0x24')](handleEntityNotFound(_0x108160,null))[_0xee59('0x24')](respondWithResult(_0x108160,null))[_0xee59('0x43')](handleError(_0x108160,null));};exports[_0xee59('0x47')]=function(_0x404a94,_0x5c9d32){return db[_0xee59('0x2a')][_0xee59('0x47')](_0x404a94[_0xee59('0x48')],{})[_0xee59('0x24')](respondWithResult(_0x5c9d32,0xc9))[_0xee59('0x43')](handleError(_0x5c9d32,null));};exports[_0xee59('0x49')]=function(_0x2c8969,_0x33b4f4){return db[_0xee59('0x2a')][_0xee59('0x49')](_0x2c8969[_0xee59('0x48')],{'raw':![],'individualHooks':!![]})[_0xee59('0x24')](respondWithResult(_0x33b4f4,0xc9))[_0xee59('0x43')](handleError(_0x33b4f4,null));};exports['update']=function(_0x41934c,_0x4ab907){if(_0x41934c[_0xee59('0x48')]['id']){delete _0x41934c[_0xee59('0x48')]['id'];}return db[_0xee59('0x2a')][_0xee59('0x4a')]({'where':{'id':_0x41934c[_0xee59('0x45')]['id']}})[_0xee59('0x24')](handleEntityNotFound(_0x4ab907,null))[_0xee59('0x24')](saveUpdates(_0x41934c['body'],null))[_0xee59('0x24')](respondWithResult(_0x4ab907,null))[_0xee59('0x43')](handleError(_0x4ab907,null));};exports['destroy']=function(_0x2eeb13,_0x4e46ee){return db['AnalyticFieldReport']['find']({'where':{'id':_0x2eeb13[_0xee59('0x45')]['id']}})[_0xee59('0x24')](handleEntityNotFound(_0x4e46ee,null))[_0xee59('0x24')](removeEntity(_0x4e46ee,null))[_0xee59('0x43')](handleError(_0x4e46ee,null));};exports[_0xee59('0x4b')]=function(_0x14c756,_0x5b90ea){return db[_0xee59('0x2a')][_0xee59('0x25')]({'where':{'id':_0x14c756[_0xee59('0x2f')][_0xee59('0x4c')]||[]},'raw':![],'individualHooks':!![]})['then'](respondWithResult(_0x5b90ea,0xcc))['catch'](handleError(_0x5b90ea,null));};exports['addFields']=function(_0x20203d,_0x32db45,_0x5e5d34){return db['AnalyticCustomReport'][_0xee59('0x4d')]({'where':{'id':_0x20203d[_0xee59('0x45')]['id']}})[_0xee59('0x24')](handleEntityNotFound(_0x32db45,null))['then'](function(_0x11ca19){if(_0x11ca19){return db['sequelize'][_0xee59('0x4e')](function(_0x3e70b4){return db[_0xee59('0x2a')][_0xee59('0x25')]({'where':{'CustomReportId':_0x20203d[_0xee59('0x45')]['id']},'transaction':_0x3e70b4})[_0xee59('0x24')](function(_0x6af645){var _0x416304=_[_0xee59('0x29')](_0x20203d[_0xee59('0x48')],function(_0x33c8b6){delete _0x33c8b6['id'];_0x33c8b6[_0xee59('0x4f')]=_0x20203d[_0xee59('0x45')]['id'];return _0x33c8b6;});return db[_0xee59('0x2a')]['bulkCreate'](_0x416304,{'transaction':_0x3e70b4});});})['then'](function(){return db['AnalyticFieldReport'][_0xee59('0x41')]({'where':{'CustomReportId':_0x20203d[_0xee59('0x45')]['id']}});});}})[_0xee59('0x24')](respondWithResult(_0x32db45,null))['catch'](handleError(_0x32db45,null));}; \ No newline at end of file +var _0xaa78=['../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','sendStatus','status','json','offset','undefined','limit','count','set','reject','save','update','then','error','stack','name','send','index','map','AnalyticFieldReport','fieldName','type','key','model','query','filters','intersection','fields','attributes','length','hasOwnProperty','order','sort','where','pick','filter','merge','VIRTUAL','findAll','rows','catch','show','params','keys','rawAttributes','includeAll','include','options','find','create','body','bulkCreate','destroy','ids','addFields','AnalyticCustomReport','findOne','sequelize','transaction','CustomReportId','eml-format','rimraf','zip-dir','request-promise','moment','bluebird','mustache','util','path','to-csv','ejs','lodash','squel','crypto','jsforce','desk.js','querystring','papaparse','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','api'];(function(_0x5acfd9,_0x5ddb2e){var _0x3dadf7=function(_0x439c93){while(--_0x439c93){_0x5acfd9['push'](_0x5acfd9['shift']());}};_0x3dadf7(++_0x5ddb2e);}(_0xaa78,0x94));var _0x8aa7=function(_0x1034ee,_0x12998c){_0x1034ee=_0x1034ee-0x0;var _0x2922af=_0xaa78[_0x1034ee];return _0x2922af;};'use strict';var emlformat=require(_0x8aa7('0x0'));var rimraf=require(_0x8aa7('0x1'));var zipdir=require(_0x8aa7('0x2'));var jsonpatch=require('fast-json-patch');var rp=require(_0x8aa7('0x3'));var moment=require(_0x8aa7('0x4'));var BPromise=require(_0x8aa7('0x5'));var Mustache=require(_0x8aa7('0x6'));var util=require(_0x8aa7('0x7'));var path=require(_0x8aa7('0x8'));var sox=require('sox');var csv=require(_0x8aa7('0x9'));var ejs=require(_0x8aa7('0xa'));var fs=require('fs');var fs_extra=require('fs-extra');var _=require(_0x8aa7('0xb'));var squel=require(_0x8aa7('0xc'));var crypto=require(_0x8aa7('0xd'));var jsforce=require(_0x8aa7('0xe'));var deskjs=require(_0x8aa7('0xf'));var toCsv=require('to-csv');var querystring=require(_0x8aa7('0x10'));var Papa=require(_0x8aa7('0x11'));var Redis=require('ioredis');var authService=require('../../components/auth/service');var qs=require(_0x8aa7('0x12'));var as=require(_0x8aa7('0x13'));var hardwareService=require(_0x8aa7('0x14'));var logger=require('../../config/logger')(_0x8aa7('0x15'));var utils=require(_0x8aa7('0x16'));var config=require(_0x8aa7('0x17'));var licenseUtil=require(_0x8aa7('0x18'));var db=require(_0x8aa7('0x19'))['db'];function respondWithStatusCode(_0x14651e,_0x4cb158){_0x4cb158=_0x4cb158||0xcc;return function(_0x450845){if(_0x450845){return _0x14651e[_0x8aa7('0x1a')](_0x4cb158);}return _0x14651e[_0x8aa7('0x1b')](_0x4cb158)['end']();};}function respondWithResult(_0x2704da,_0x489ad2){_0x489ad2=_0x489ad2||0xc8;return function(_0x951254){if(_0x951254){return _0x2704da[_0x8aa7('0x1b')](_0x489ad2)[_0x8aa7('0x1c')](_0x951254);}};}function respondWithFilteredResult(_0x375701,_0x194052){return function(_0x1eae90){if(_0x1eae90){var _0x54a626=typeof _0x194052[_0x8aa7('0x1d')]===_0x8aa7('0x1e')&&typeof _0x194052[_0x8aa7('0x1f')]===_0x8aa7('0x1e');var _0x320e96=_0x1eae90[_0x8aa7('0x20')];var _0xc0d4d5=_0x54a626?0x0:_0x194052[_0x8aa7('0x1d')];var _0x1ac9d1=_0x54a626?_0x1eae90[_0x8aa7('0x20')]:_0x194052[_0x8aa7('0x1d')]+_0x194052[_0x8aa7('0x1f')];var _0x4473c0;if(_0x1ac9d1>=_0x320e96){_0x1ac9d1=_0x320e96;_0x4473c0=0xc8;}else{_0x4473c0=0xce;}_0x375701[_0x8aa7('0x1b')](_0x4473c0);return _0x375701[_0x8aa7('0x21')]('Content-Range',_0xc0d4d5+'-'+_0x1ac9d1+'/'+_0x320e96)[_0x8aa7('0x1c')](_0x1eae90);}return null;};}function patchUpdates(_0x8597c7){return function(_0x49b790){try{jsonpatch['apply'](_0x49b790,_0x8597c7,!![]);}catch(_0xc53ec1){return BPromise[_0x8aa7('0x22')](_0xc53ec1);}return _0x49b790[_0x8aa7('0x23')]();};}function saveUpdates(_0x5deb25,_0x5beee6){return function(_0x3bae4b){if(_0x3bae4b){return _0x3bae4b[_0x8aa7('0x24')](_0x5deb25)[_0x8aa7('0x25')](function(_0x4a29ab){return _0x4a29ab;});}return null;};}function removeEntity(_0x63f9ca,_0x198b10){return function(_0x1c8dd4){if(_0x1c8dd4){return _0x1c8dd4['destroy']()[_0x8aa7('0x25')](function(){_0x63f9ca['status'](0xcc)['end']();});}};}function handleEntityNotFound(_0x945e3c,_0x1b1f80){return function(_0xd14269){if(!_0xd14269){_0x945e3c[_0x8aa7('0x1a')](0x194);}return _0xd14269;};}function handleError(_0xb6f639,_0x2c84d1){_0x2c84d1=_0x2c84d1||0x1f4;return function(_0x235a94){logger[_0x8aa7('0x26')](_0x235a94[_0x8aa7('0x27')]);if(_0x235a94[_0x8aa7('0x28')]){delete _0x235a94[_0x8aa7('0x28')];}_0xb6f639[_0x8aa7('0x1b')](_0x2c84d1)[_0x8aa7('0x29')](_0x235a94);};}exports[_0x8aa7('0x2a')]=function(_0x2a3703,_0x46ceef){var _0x15f449={},_0xe307f2={},_0x40e272={'count':0x0,'rows':[]};var _0x4a0aeb=_[_0x8aa7('0x2b')](db[_0x8aa7('0x2c')]['rawAttributes'],function(_0x5d6766){return{'name':_0x5d6766[_0x8aa7('0x2d')],'type':_0x5d6766[_0x8aa7('0x2e')][_0x8aa7('0x2f')]};});_0xe307f2[_0x8aa7('0x30')]=_[_0x8aa7('0x2b')](_0x4a0aeb,_0x8aa7('0x28'));_0xe307f2[_0x8aa7('0x31')]=_['keys'](_0x2a3703[_0x8aa7('0x31')]);_0xe307f2[_0x8aa7('0x32')]=_[_0x8aa7('0x33')](_0xe307f2[_0x8aa7('0x30')],_0xe307f2[_0x8aa7('0x31')]);_0x15f449['attributes']=_[_0x8aa7('0x33')](_0xe307f2[_0x8aa7('0x30')],qs['fields'](_0x2a3703['query'][_0x8aa7('0x34')]));_0x15f449[_0x8aa7('0x35')]=_0x15f449['attributes'][_0x8aa7('0x36')]?_0x15f449['attributes']:_0xe307f2[_0x8aa7('0x30')];if(!_0x2a3703[_0x8aa7('0x31')][_0x8aa7('0x37')]('nolimit')){_0x15f449[_0x8aa7('0x1f')]=qs[_0x8aa7('0x1f')](_0x2a3703['query'][_0x8aa7('0x1f')]);_0x15f449[_0x8aa7('0x1d')]=qs[_0x8aa7('0x1d')](_0x2a3703['query'][_0x8aa7('0x1d')]);}_0x15f449[_0x8aa7('0x38')]=qs[_0x8aa7('0x39')](_0x2a3703[_0x8aa7('0x31')]['sort']);_0x15f449[_0x8aa7('0x3a')]=qs[_0x8aa7('0x32')](_[_0x8aa7('0x3b')](_0x2a3703[_0x8aa7('0x31')],_0xe307f2[_0x8aa7('0x32')]),_0x4a0aeb);if(_0x2a3703[_0x8aa7('0x31')][_0x8aa7('0x3c')]){_0x15f449[_0x8aa7('0x3a')]=_[_0x8aa7('0x3d')](_0x15f449[_0x8aa7('0x3a')],{'$or':_[_0x8aa7('0x2b')](_0x4a0aeb,function(_0x208e5b){if(_0x208e5b[_0x8aa7('0x2e')]!==_0x8aa7('0x3e')){var _0x3b1939={};_0x3b1939[_0x208e5b[_0x8aa7('0x28')]]={'$like':'%'+_0x2a3703[_0x8aa7('0x31')]['filter']+'%'};return _0x3b1939;}})});}_0x15f449=_[_0x8aa7('0x3d')]({},_0x15f449,_0x2a3703['options']);var _0x584b35={'where':_0x15f449[_0x8aa7('0x3a')]};return db[_0x8aa7('0x2c')][_0x8aa7('0x20')](_0x584b35)['then'](function(_0x2bf8ee){_0x40e272[_0x8aa7('0x20')]=_0x2bf8ee;if(_0x2a3703['query']['includeAll']){_0x15f449['include']=[{'all':!![]}];}return db[_0x8aa7('0x2c')][_0x8aa7('0x3f')](_0x15f449);})[_0x8aa7('0x25')](function(_0x36a36e){_0x40e272[_0x8aa7('0x40')]=_0x36a36e;return _0x40e272;})[_0x8aa7('0x25')](respondWithFilteredResult(_0x46ceef,_0x15f449))[_0x8aa7('0x41')](handleError(_0x46ceef,null));};exports[_0x8aa7('0x42')]=function(_0x3e97ea,_0x11dcf4){var _0x5260dc={'raw':![],'where':{'id':_0x3e97ea[_0x8aa7('0x43')]['id']}},_0x20d39e={};_0x20d39e[_0x8aa7('0x30')]=_[_0x8aa7('0x44')](db[_0x8aa7('0x2c')][_0x8aa7('0x45')]);_0x20d39e[_0x8aa7('0x31')]=_['keys'](_0x3e97ea[_0x8aa7('0x31')]);_0x20d39e[_0x8aa7('0x32')]=_[_0x8aa7('0x33')](_0x20d39e[_0x8aa7('0x30')],_0x20d39e[_0x8aa7('0x31')]);_0x5260dc[_0x8aa7('0x35')]=_[_0x8aa7('0x33')](_0x20d39e[_0x8aa7('0x30')],qs['fields'](_0x3e97ea[_0x8aa7('0x31')]['fields']));_0x5260dc[_0x8aa7('0x35')]=_0x5260dc['attributes']['length']?_0x5260dc[_0x8aa7('0x35')]:_0x20d39e[_0x8aa7('0x30')];if(_0x3e97ea[_0x8aa7('0x31')][_0x8aa7('0x46')]){_0x5260dc[_0x8aa7('0x47')]=[{'all':!![]}];}_0x5260dc=_[_0x8aa7('0x3d')]({},_0x5260dc,_0x3e97ea[_0x8aa7('0x48')]);return db['AnalyticFieldReport'][_0x8aa7('0x49')](_0x5260dc)[_0x8aa7('0x25')](handleEntityNotFound(_0x11dcf4,null))[_0x8aa7('0x25')](respondWithResult(_0x11dcf4,null))[_0x8aa7('0x41')](handleError(_0x11dcf4,null));};exports['create']=function(_0x242112,_0x5587be){return db[_0x8aa7('0x2c')][_0x8aa7('0x4a')](_0x242112[_0x8aa7('0x4b')],{})[_0x8aa7('0x25')](respondWithResult(_0x5587be,0xc9))[_0x8aa7('0x41')](handleError(_0x5587be,null));};exports[_0x8aa7('0x4c')]=function(_0x3706a2,_0x2622c2){return db[_0x8aa7('0x2c')][_0x8aa7('0x4c')](_0x3706a2[_0x8aa7('0x4b')],{'raw':![],'individualHooks':!![]})['then'](respondWithResult(_0x2622c2,0xc9))[_0x8aa7('0x41')](handleError(_0x2622c2,null));};exports[_0x8aa7('0x24')]=function(_0x433787,_0x4cc63c){if(_0x433787['body']['id']){delete _0x433787[_0x8aa7('0x4b')]['id'];}return db[_0x8aa7('0x2c')][_0x8aa7('0x49')]({'where':{'id':_0x433787['params']['id']}})[_0x8aa7('0x25')](handleEntityNotFound(_0x4cc63c,null))[_0x8aa7('0x25')](saveUpdates(_0x433787['body'],null))[_0x8aa7('0x25')](respondWithResult(_0x4cc63c,null))[_0x8aa7('0x41')](handleError(_0x4cc63c,null));};exports[_0x8aa7('0x4d')]=function(_0x131f28,_0x33d3d2){return db[_0x8aa7('0x2c')][_0x8aa7('0x49')]({'where':{'id':_0x131f28['params']['id']}})['then'](handleEntityNotFound(_0x33d3d2,null))['then'](removeEntity(_0x33d3d2,null))[_0x8aa7('0x41')](handleError(_0x33d3d2,null));};exports['bulkDestroy']=function(_0x49c974,_0x5f14f4){return db['AnalyticFieldReport'][_0x8aa7('0x4d')]({'where':{'id':_0x49c974[_0x8aa7('0x31')][_0x8aa7('0x4e')]||[]},'raw':![],'individualHooks':!![]})[_0x8aa7('0x25')](respondWithResult(_0x5f14f4,0xcc))[_0x8aa7('0x41')](handleError(_0x5f14f4,null));};exports[_0x8aa7('0x4f')]=function(_0x3cb1b7,_0x15cd62,_0x23413d){return db[_0x8aa7('0x50')][_0x8aa7('0x51')]({'where':{'id':_0x3cb1b7[_0x8aa7('0x43')]['id']}})[_0x8aa7('0x25')](handleEntityNotFound(_0x15cd62,null))[_0x8aa7('0x25')](function(_0xda47b3){if(_0xda47b3){return db[_0x8aa7('0x52')][_0x8aa7('0x53')](function(_0x4b632d){return db[_0x8aa7('0x2c')][_0x8aa7('0x4d')]({'where':{'CustomReportId':_0x3cb1b7['params']['id']},'transaction':_0x4b632d})[_0x8aa7('0x25')](function(_0x549c2a){var _0x8a2661=_[_0x8aa7('0x2b')](_0x3cb1b7[_0x8aa7('0x4b')],function(_0x4702db){delete _0x4702db['id'];_0x4702db[_0x8aa7('0x54')]=_0x3cb1b7['params']['id'];return _0x4702db;});return db[_0x8aa7('0x2c')][_0x8aa7('0x4c')](_0x8a2661,{'transaction':_0x4b632d});});})[_0x8aa7('0x25')](function(){return db[_0x8aa7('0x2c')][_0x8aa7('0x3f')]({'where':{'CustomReportId':_0x3cb1b7[_0x8aa7('0x43')]['id']}});});}})[_0x8aa7('0x25')](respondWithResult(_0x15cd62,null))['catch'](handleError(_0x15cd62,null));}; \ No newline at end of file diff --git a/server/api/analyticFieldReport/analyticFieldReport.model.js b/server/api/analyticFieldReport/analyticFieldReport.model.js index a4762d6..e425230 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 _0x2c69=['../../config/environment','define','AnalyticFieldReport','analytics_report_fields','lodash','util','api','bluebird','request-promise','path','rimraf'];(function(_0x3381cf,_0x12f6dc){var _0x1fb59b=function(_0x3e9be7){while(--_0x3e9be7){_0x3381cf['push'](_0x3381cf['shift']());}};_0x1fb59b(++_0x12f6dc);}(_0x2c69,0xca));var _0x92c6=function(_0x2642cb,_0x4b917f){_0x2642cb=_0x2642cb-0x0;var _0xe6e41=_0x2c69[_0x2642cb];return _0xe6e41;};'use strict';var _=require(_0x92c6('0x0'));var util=require(_0x92c6('0x1'));var logger=require('../../config/logger')(_0x92c6('0x2'));var moment=require('moment');var BPromise=require(_0x92c6('0x3'));var rp=require(_0x92c6('0x4'));var fs=require('fs');var path=require(_0x92c6('0x5'));var rimraf=require(_0x92c6('0x6'));var config=require(_0x92c6('0x7'));var attributes=require('./analyticFieldReport.attributes');module['exports']=function(_0x52716c,_0x2e7d5b){return _0x52716c[_0x92c6('0x8')](_0x92c6('0x9'),attributes,{'tableName':_0x92c6('0xa'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x3cf1=['analytics_report_fields','lodash','util','api','moment','request-promise','path','rimraf','exports','define','AnalyticFieldReport'];(function(_0x2ee08d,_0x4dcf29){var _0x4fb815=function(_0xaa9598){while(--_0xaa9598){_0x2ee08d['push'](_0x2ee08d['shift']());}};_0x4fb815(++_0x4dcf29);}(_0x3cf1,0x156));var _0x13cf=function(_0x5a6899,_0x44906b){_0x5a6899=_0x5a6899-0x0;var _0x1b42a3=_0x3cf1[_0x5a6899];return _0x1b42a3;};'use strict';var _=require(_0x13cf('0x0'));var util=require(_0x13cf('0x1'));var logger=require('../../config/logger')(_0x13cf('0x2'));var moment=require(_0x13cf('0x3'));var BPromise=require('bluebird');var rp=require(_0x13cf('0x4'));var fs=require('fs');var path=require(_0x13cf('0x5'));var rimraf=require(_0x13cf('0x6'));var config=require('../../config/environment');var attributes=require('./analyticFieldReport.attributes');module[_0x13cf('0x7')]=function(_0x1af54e,_0x1402c4){return _0x1af54e[_0x13cf('0x8')](_0x13cf('0x9'),attributes,{'tableName':_0x13cf('0xa'),'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 5bea481..0455bd7 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 _0x6e9e=['ioredis','../../mysqldb','../../config/logger','rpc','../../config/environment','jayson/promise','http','request','then','info','AnalyticFieldReport,\x20%s,\x20%s','request\x20sent','AnalyticFieldReport,\x20%s,\x20%s,\x20%s','stringify','error','message','result','catch','lodash','util','randomstring'];(function(_0x2c3ed1,_0x446d44){var _0x24c839=function(_0x37a870){while(--_0x37a870){_0x2c3ed1['push'](_0x2c3ed1['shift']());}};_0x24c839(++_0x446d44);}(_0x6e9e,0x10e));var _0xe6e9=function(_0x4d8dc3,_0x585fd1){_0x4d8dc3=_0x4d8dc3-0x0;var _0x9b03d9=_0x6e9e[_0x4d8dc3];return _0x9b03d9;};'use strict';var _=require(_0xe6e9('0x0'));var util=require(_0xe6e9('0x1'));var moment=require('moment');var BPromise=require('bluebird');var rs=require(_0xe6e9('0x2'));var fs=require('fs');var Redis=require(_0xe6e9('0x3'));var db=require(_0xe6e9('0x4'))['db'];var utils=require('../../config/utils');var logger=require(_0xe6e9('0x5'))(_0xe6e9('0x6'));var config=require(_0xe6e9('0x7'));var jayson=require(_0xe6e9('0x8'));var client=jayson['client'][_0xe6e9('0x9')]({'port':0x232a});function respondWithRpcPromise(_0xcd622c,_0xf1843f,_0xca32a0){return new BPromise(function(_0xba684,_0x5589bc){return client[_0xe6e9('0xa')](_0xcd622c,_0xca32a0)[_0xe6e9('0xb')](function(_0x40dd9c){logger[_0xe6e9('0xc')](_0xe6e9('0xd'),_0xf1843f,_0xe6e9('0xe'));logger['debug'](_0xe6e9('0xf'),_0xf1843f,_0xe6e9('0xe'),JSON[_0xe6e9('0x10')](_0x40dd9c));if(_0x40dd9c[_0xe6e9('0x11')]){if(_0x40dd9c[_0xe6e9('0x11')]['code']===0x1f4){logger[_0xe6e9('0x11')](_0xe6e9('0xd'),_0xf1843f,_0x40dd9c[_0xe6e9('0x11')][_0xe6e9('0x12')]);return _0x5589bc(_0x40dd9c[_0xe6e9('0x11')][_0xe6e9('0x12')]);}logger[_0xe6e9('0x11')](_0xe6e9('0xd'),_0xf1843f,_0x40dd9c[_0xe6e9('0x11')]['message']);return _0xba684(_0x40dd9c[_0xe6e9('0x11')][_0xe6e9('0x12')]);}else{logger['info'](_0xe6e9('0xd'),_0xf1843f,_0xe6e9('0xe'));_0xba684(_0x40dd9c[_0xe6e9('0x13')][_0xe6e9('0x12')]);}})[_0xe6e9('0x14')](function(_0x24a8ea){logger[_0xe6e9('0x11')](_0xe6e9('0xd'),_0xf1843f,_0x24a8ea);_0x5589bc(_0x24a8ea);});});} \ No newline at end of file +var _0x480a=['message','result','catch','bluebird','../../mysqldb','../../config/utils','../../config/logger','../../config/environment','jayson/promise','http','request','info','request\x20sent','debug','AnalyticFieldReport,\x20%s,\x20%s,\x20%s','stringify','error','code','AnalyticFieldReport,\x20%s,\x20%s'];(function(_0x282e88,_0x5b7755){var _0x5be0ab=function(_0x1ef849){while(--_0x1ef849){_0x282e88['push'](_0x282e88['shift']());}};_0x5be0ab(++_0x5b7755);}(_0x480a,0x17f));var _0xa480=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0x480a[_0x3dd15e];return _0x231fd0;};'use strict';var _=require('lodash');var util=require('util');var moment=require('moment');var BPromise=require(_0xa480('0x0'));var rs=require('randomstring');var fs=require('fs');var Redis=require('ioredis');var db=require(_0xa480('0x1'))['db'];var utils=require(_0xa480('0x2'));var logger=require(_0xa480('0x3'))('rpc');var config=require(_0xa480('0x4'));var jayson=require(_0xa480('0x5'));var client=jayson['client'][_0xa480('0x6')]({'port':0x232a});function respondWithRpcPromise(_0x4e08e1,_0xfd7c38,_0x5d5347){return new BPromise(function(_0xd09e1d,_0xa71541){return client[_0xa480('0x7')](_0x4e08e1,_0x5d5347)['then'](function(_0x45deea){logger[_0xa480('0x8')]('AnalyticFieldReport,\x20%s,\x20%s',_0xfd7c38,_0xa480('0x9'));logger[_0xa480('0xa')](_0xa480('0xb'),_0xfd7c38,_0xa480('0x9'),JSON[_0xa480('0xc')](_0x45deea));if(_0x45deea['error']){if(_0x45deea[_0xa480('0xd')][_0xa480('0xe')]===0x1f4){logger[_0xa480('0xd')](_0xa480('0xf'),_0xfd7c38,_0x45deea['error']['message']);return _0xa71541(_0x45deea[_0xa480('0xd')][_0xa480('0x10')]);}logger['error'](_0xa480('0xf'),_0xfd7c38,_0x45deea['error']['message']);return _0xd09e1d(_0x45deea[_0xa480('0xd')][_0xa480('0x10')]);}else{logger[_0xa480('0x8')]('AnalyticFieldReport,\x20%s,\x20%s',_0xfd7c38,_0xa480('0x9'));_0xd09e1d(_0x45deea[_0xa480('0x11')][_0xa480('0x10')]);}})[_0xa480('0x12')](function(_0x4109fa){logger[_0xa480('0xd')](_0xa480('0xf'),_0xfd7c38,_0x4109fa);_0xa71541(_0x4109fa);});});} \ No newline at end of file diff --git a/server/api/analyticFieldReport/index.js b/server/api/analyticFieldReport/index.js index 216da56..aebd5a5 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(_0x16c144,_0x2c7216){var _0x3d19d9=function(_0x22f595){while(--_0x22f595){_0x16c144['push'](_0x16c144['shift']());}};_0x3d19d9(++_0x2c7216);}(_0xa9e0,0x123));var _0x0a9e=function(_0x3054be,_0x1bdc8b){_0x3054be=_0x3054be-0x0;var _0x3df150=_0xa9e0[_0x3054be];return _0x3df150;};'use strict';var multer=require(_0x0a9e('0x0'));var util=require(_0x0a9e('0x1'));var path=require(_0x0a9e('0x2'));var timeout=require('connect-timeout');var express=require('express');var router=express[_0x0a9e('0x3')]();var fs_extra=require('fs-extra');var auth=require(_0x0a9e('0x4'));var interaction=require(_0x0a9e('0x5'));var config=require(_0x0a9e('0x6'));var controller=require(_0x0a9e('0x7'));router[_0x0a9e('0x8')]('/',auth['isAuthenticated'](),controller[_0x0a9e('0x9')]);router[_0x0a9e('0x8')](_0x0a9e('0xa'),auth['isAuthenticated'](),controller['show']);router[_0x0a9e('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(_0x114c36,_0x67ba84){var _0x1e0366=function(_0x48a68f){while(--_0x48a68f){_0x114c36['push'](_0x114c36['shift']());}};_0x1e0366(++_0x67ba84);}(_0xa9e0,0x123));var _0x0a9e=function(_0x54d4fe,_0x55e869){_0x54d4fe=_0x54d4fe-0x0;var _0x1ab5bb=_0xa9e0[_0x54d4fe];return _0x1ab5bb;};'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 eb87f40..81e00ef 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 _0xa062=['TEXT','sequelize','exports','STRING'];(function(_0xa464c9,_0x7c86d8){var _0x3d73c4=function(_0x5c2056){while(--_0x5c2056){_0xa464c9['push'](_0xa464c9['shift']());}};_0x3d73c4(++_0x7c86d8);}(_0xa062,0x101));var _0x2a06=function(_0x455810,_0x47fa09){_0x455810=_0x455810-0x0;var _0x59b21e=_0xa062[_0x455810];return _0x59b21e;};'use strict';var Sequelize=require(_0x2a06('0x0'));module[_0x2a06('0x1')]={'name':{'type':Sequelize[_0x2a06('0x2')],'allowNull':![],'unique':'name'},'table':{'type':Sequelize[_0x2a06('0x2')]},'metric':{'type':Sequelize[_0x2a06('0x3')]},'description':{'type':Sequelize[_0x2a06('0x2')]}}; \ No newline at end of file +var _0x98e5=['name','STRING'];(function(_0x3cd968,_0x1acfb9){var _0x3bee46=function(_0x5805dd){while(--_0x5805dd){_0x3cd968['push'](_0x3cd968['shift']());}};_0x3bee46(++_0x1acfb9);}(_0x98e5,0x8a));var _0x598e=function(_0x466ac1,_0x9b978f){_0x466ac1=_0x466ac1-0x0;var _0x478fda=_0x98e5[_0x466ac1];return _0x478fda;};'use strict';var Sequelize=require('sequelize');module['exports']={'name':{'type':Sequelize['STRING'],'allowNull':![],'unique':_0x598e('0x0')},'table':{'type':Sequelize[_0x598e('0x1')]},'metric':{'type':Sequelize['TEXT']},'description':{'type':Sequelize[_0x598e('0x1')]}}; \ No newline at end of file diff --git a/server/api/analyticMetric/analyticMetric.controller.js b/server/api/analyticMetric/analyticMetric.controller.js index 36235d7..4e81e84 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 _0x55ca=['../../config/logger','api','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','status','json','offset','undefined','limit','count','reject','update','then','get','Metrics','UserProfileResource','destroy','end','sendStatus','stack','name','send','index','map','rawAttributes','fieldName','type','key','model','query','keys','intersection','fields','attributes','length','nolimit','order','sort','where','pick','filter','merge','AnalyticMetric','findAll','catch','show','include','find','create','user','Unable\x20to\x20retrieve\x20the\x20current\x20user','role','UserProfileSection','userProfileId','error','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','body','params','eml-format','rimraf','moment','bluebird','util','path','sox','to-csv','ejs','fs-extra','lodash','crypto','jsforce','querystring','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware'];(function(_0x2e63f0,_0x9bda70){var _0x2b5050=function(_0xb82fbc){while(--_0xb82fbc){_0x2e63f0['push'](_0x2e63f0['shift']());}};_0x2b5050(++_0x9bda70);}(_0x55ca,0x126));var _0xa55c=function(_0x392aea,_0x47d79a){_0x392aea=_0x392aea-0x0;var _0x237810=_0x55ca[_0x392aea];return _0x237810;};'use strict';var emlformat=require(_0xa55c('0x0'));var rimraf=require(_0xa55c('0x1'));var zipdir=require('zip-dir');var jsonpatch=require('fast-json-patch');var rp=require('request-promise');var moment=require(_0xa55c('0x2'));var BPromise=require(_0xa55c('0x3'));var Mustache=require('mustache');var util=require(_0xa55c('0x4'));var path=require(_0xa55c('0x5'));var sox=require(_0xa55c('0x6'));var csv=require(_0xa55c('0x7'));var ejs=require(_0xa55c('0x8'));var fs=require('fs');var fs_extra=require(_0xa55c('0x9'));var _=require(_0xa55c('0xa'));var squel=require('squel');var crypto=require(_0xa55c('0xb'));var jsforce=require(_0xa55c('0xc'));var deskjs=require('desk.js');var toCsv=require(_0xa55c('0x7'));var querystring=require(_0xa55c('0xd'));var Papa=require('papaparse');var Redis=require('ioredis');var authService=require(_0xa55c('0xe'));var qs=require(_0xa55c('0xf'));var as=require(_0xa55c('0x10'));var hardwareService=require(_0xa55c('0x11'));var logger=require(_0xa55c('0x12'))(_0xa55c('0x13'));var utils=require(_0xa55c('0x14'));var config=require(_0xa55c('0x15'));var licenseUtil=require(_0xa55c('0x16'));var db=require(_0xa55c('0x17'))['db'];function respondWithStatusCode(_0x5d47ff,_0x59d84a){_0x59d84a=_0x59d84a||0xcc;return function(_0x2a35be){if(_0x2a35be){return _0x5d47ff['sendStatus'](_0x59d84a);}return _0x5d47ff['status'](_0x59d84a)['end']();};}function respondWithResult(_0x18ee85,_0x3930e4){_0x3930e4=_0x3930e4||0xc8;return function(_0x462cd6){if(_0x462cd6){return _0x18ee85[_0xa55c('0x18')](_0x3930e4)[_0xa55c('0x19')](_0x462cd6);}};}function respondWithFilteredResult(_0x247e77,_0x4e0b2f){return function(_0x3ccf65){if(_0x3ccf65){var _0x3dcf4f=typeof _0x4e0b2f[_0xa55c('0x1a')]===_0xa55c('0x1b')&&typeof _0x4e0b2f[_0xa55c('0x1c')]===_0xa55c('0x1b');var _0x51590e=_0x3ccf65[_0xa55c('0x1d')];var _0x24783b=_0x3dcf4f?0x0:_0x4e0b2f['offset'];var _0x3d4c9e=_0x3dcf4f?_0x3ccf65[_0xa55c('0x1d')]:_0x4e0b2f[_0xa55c('0x1a')]+_0x4e0b2f[_0xa55c('0x1c')];var _0x23a1ae;if(_0x3d4c9e>=_0x51590e){_0x3d4c9e=_0x51590e;_0x23a1ae=0xc8;}else{_0x23a1ae=0xce;}_0x247e77[_0xa55c('0x18')](_0x23a1ae);return _0x247e77['set']('Content-Range',_0x24783b+'-'+_0x3d4c9e+'/'+_0x51590e)[_0xa55c('0x19')](_0x3ccf65);}return null;};}function patchUpdates(_0x3776ac){return function(_0xade4c4){try{jsonpatch['apply'](_0xade4c4,_0x3776ac,!![]);}catch(_0x383d92){return BPromise[_0xa55c('0x1e')](_0x383d92);}return _0xade4c4['save']();};}function saveUpdates(_0x187a87,_0x133096){return function(_0x940f28){if(_0x940f28){return _0x940f28[_0xa55c('0x1f')](_0x187a87)[_0xa55c('0x20')](function(_0x49ed04){return _0x49ed04;});}return null;};}function removeEntity(_0x1fc828,_0x504c24){return function(_0x5ba836){if(_0x5ba836){return _0x5ba836['destroy']()[_0xa55c('0x20')](function(){var _0x54b038=_0x5ba836[_0xa55c('0x21')]({'plain':!![]});var _0x190757=_0xa55c('0x22');return db[_0xa55c('0x23')][_0xa55c('0x24')]({'where':{'type':_0x190757,'resourceId':_0x54b038['id']}})[_0xa55c('0x20')](function(){return _0x5ba836;});})[_0xa55c('0x20')](function(){_0x1fc828[_0xa55c('0x18')](0xcc)[_0xa55c('0x25')]();});}};}function handleEntityNotFound(_0x3cd152,_0x1273d7){return function(_0x57f271){if(!_0x57f271){_0x3cd152[_0xa55c('0x26')](0x194);}return _0x57f271;};}function handleError(_0x28814f,_0x1c9f6b){_0x1c9f6b=_0x1c9f6b||0x1f4;return function(_0x906caa){logger['error'](_0x906caa[_0xa55c('0x27')]);if(_0x906caa[_0xa55c('0x28')]){delete _0x906caa[_0xa55c('0x28')];}_0x28814f[_0xa55c('0x18')](_0x1c9f6b)[_0xa55c('0x29')](_0x906caa);};}exports[_0xa55c('0x2a')]=function(_0x52d37f,_0x23e698){var _0x490b7d={},_0x35c9c2={},_0x1d730b={'count':0x0,'rows':[]};var _0x1cc53e=_[_0xa55c('0x2b')](db['AnalyticMetric'][_0xa55c('0x2c')],function(_0x2096ae){return{'name':_0x2096ae[_0xa55c('0x2d')],'type':_0x2096ae[_0xa55c('0x2e')][_0xa55c('0x2f')]};});_0x35c9c2[_0xa55c('0x30')]=_[_0xa55c('0x2b')](_0x1cc53e,_0xa55c('0x28'));_0x35c9c2[_0xa55c('0x31')]=_[_0xa55c('0x32')](_0x52d37f[_0xa55c('0x31')]);_0x35c9c2['filters']=_['intersection'](_0x35c9c2[_0xa55c('0x30')],_0x35c9c2[_0xa55c('0x31')]);_0x490b7d['attributes']=_[_0xa55c('0x33')](_0x35c9c2[_0xa55c('0x30')],qs[_0xa55c('0x34')](_0x52d37f[_0xa55c('0x31')][_0xa55c('0x34')]));_0x490b7d[_0xa55c('0x35')]=_0x490b7d[_0xa55c('0x35')][_0xa55c('0x36')]?_0x490b7d[_0xa55c('0x35')]:_0x35c9c2['model'];if(!_0x52d37f['query']['hasOwnProperty'](_0xa55c('0x37'))){_0x490b7d[_0xa55c('0x1c')]=qs[_0xa55c('0x1c')](_0x52d37f['query'][_0xa55c('0x1c')]);_0x490b7d['offset']=qs[_0xa55c('0x1a')](_0x52d37f['query'][_0xa55c('0x1a')]);}_0x490b7d[_0xa55c('0x38')]=qs[_0xa55c('0x39')](_0x52d37f['query'][_0xa55c('0x39')]);_0x490b7d[_0xa55c('0x3a')]=qs['filters'](_[_0xa55c('0x3b')](_0x52d37f[_0xa55c('0x31')],_0x35c9c2['filters']),_0x1cc53e);if(_0x52d37f['query'][_0xa55c('0x3c')]){_0x490b7d['where']=_[_0xa55c('0x3d')](_0x490b7d[_0xa55c('0x3a')],{'$or':_['map'](_0x1cc53e,function(_0x542d76){if(_0x542d76['type']!=='VIRTUAL'){var _0x3b3308={};_0x3b3308[_0x542d76[_0xa55c('0x28')]]={'$like':'%'+_0x52d37f[_0xa55c('0x31')][_0xa55c('0x3c')]+'%'};return _0x3b3308;}})});}_0x490b7d=_[_0xa55c('0x3d')]({},_0x490b7d,_0x52d37f['options']);var _0x3d52d8={'where':_0x490b7d[_0xa55c('0x3a')]};return db[_0xa55c('0x3e')][_0xa55c('0x1d')](_0x3d52d8)[_0xa55c('0x20')](function(_0x23cef5){_0x1d730b['count']=_0x23cef5;if(_0x52d37f[_0xa55c('0x31')]['includeAll']){_0x490b7d['include']=[{'all':!![]}];}return db[_0xa55c('0x3e')][_0xa55c('0x3f')](_0x490b7d);})['then'](function(_0x2bd98b){_0x1d730b['rows']=_0x2bd98b;return _0x1d730b;})['then'](respondWithFilteredResult(_0x23e698,_0x490b7d))[_0xa55c('0x40')](handleError(_0x23e698,null));};exports[_0xa55c('0x41')]=function(_0x1630ac,_0x540337){var _0x1b2708={'raw':!![],'where':{'id':_0x1630ac['params']['id']}},_0xd5a006={};_0xd5a006[_0xa55c('0x30')]=_['keys'](db[_0xa55c('0x3e')][_0xa55c('0x2c')]);_0xd5a006['query']=_[_0xa55c('0x32')](_0x1630ac[_0xa55c('0x31')]);_0xd5a006['filters']=_[_0xa55c('0x33')](_0xd5a006[_0xa55c('0x30')],_0xd5a006[_0xa55c('0x31')]);_0x1b2708['attributes']=_[_0xa55c('0x33')](_0xd5a006['model'],qs[_0xa55c('0x34')](_0x1630ac[_0xa55c('0x31')][_0xa55c('0x34')]));_0x1b2708['attributes']=_0x1b2708[_0xa55c('0x35')][_0xa55c('0x36')]?_0x1b2708['attributes']:_0xd5a006[_0xa55c('0x30')];if(_0x1630ac[_0xa55c('0x31')]['includeAll']){_0x1b2708[_0xa55c('0x42')]=[{'all':!![]}];}_0x1b2708=_[_0xa55c('0x3d')]({},_0x1b2708,_0x1630ac['options']);return db[_0xa55c('0x3e')][_0xa55c('0x43')](_0x1b2708)[_0xa55c('0x20')](handleEntityNotFound(_0x540337,null))[_0xa55c('0x20')](respondWithResult(_0x540337,null))['catch'](handleError(_0x540337,null));};exports[_0xa55c('0x44')]=function(_0x58a7ea,_0x2157d6){return db[_0xa55c('0x3e')][_0xa55c('0x44')](_0x58a7ea['body'],{})[_0xa55c('0x20')](function(_0x250b00){var _0x574fe9=_0x58a7ea[_0xa55c('0x45')][_0xa55c('0x21')]({'plain':!![]});if(!_0x574fe9)throw new Error(_0xa55c('0x46'));if(_0x574fe9[_0xa55c('0x47')]===_0xa55c('0x45')){var _0x1c84d9=_0x250b00[_0xa55c('0x21')]({'plain':!![]});var _0x129626=_0xa55c('0x22');return db[_0xa55c('0x48')]['find']({'where':{'name':_0x129626,'userProfileId':_0x574fe9[_0xa55c('0x49')]},'raw':!![]})[_0xa55c('0x20')](function(_0x216de8){if(_0x216de8&&_0x216de8['autoAssociation']===0x0){return db[_0xa55c('0x23')][_0xa55c('0x44')]({'name':_0x1c84d9['name'],'resourceId':_0x1c84d9['id'],'type':_0x216de8[_0xa55c('0x28')],'sectionId':_0x216de8['id']},{})['then'](function(){return _0x250b00;});}else{return _0x250b00;}})[_0xa55c('0x40')](function(_0x228df4){logger[_0xa55c('0x4a')](_0xa55c('0x4b'),_0x228df4);throw _0x228df4;});}return _0x250b00;})[_0xa55c('0x20')](respondWithResult(_0x2157d6,0xc9))['catch'](handleError(_0x2157d6,null));};exports[_0xa55c('0x1f')]=function(_0x4607ca,_0x4b85cc){if(_0x4607ca[_0xa55c('0x4c')]['id']){delete _0x4607ca[_0xa55c('0x4c')]['id'];}return db[_0xa55c('0x3e')][_0xa55c('0x43')]({'where':{'id':_0x4607ca['params']['id']}})['then'](handleEntityNotFound(_0x4b85cc,null))[_0xa55c('0x20')](saveUpdates(_0x4607ca[_0xa55c('0x4c')],null))[_0xa55c('0x20')](respondWithResult(_0x4b85cc,null))[_0xa55c('0x40')](handleError(_0x4b85cc,null));};exports['destroy']=function(_0x30c0c9,_0x5ce463){return db[_0xa55c('0x3e')][_0xa55c('0x43')]({'where':{'id':_0x30c0c9[_0xa55c('0x4d')]['id']}})[_0xa55c('0x20')](handleEntityNotFound(_0x5ce463,null))[_0xa55c('0x20')](removeEntity(_0x5ce463,null))['catch'](handleError(_0x5ce463,null));}; \ No newline at end of file +var _0x24ca=['find','catch','create','body','Unable\x20to\x20retrieve\x20the\x20current\x20user','role','UserProfileSection','userProfileId','autoAssociation','eml-format','zip-dir','fast-json-patch','request-promise','bluebird','mustache','util','path','sox','to-csv','ejs','fs-extra','lodash','squel','crypto','desk.js','querystring','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/environment','../../mysqldb','status','end','json','limit','undefined','count','offset','set','apply','reject','save','update','then','destroy','get','Metrics','UserProfileResource','sendStatus','error','stack','name','send','map','AnalyticMetric','rawAttributes','fieldName','type','key','query','keys','intersection','model','attributes','fields','length','hasOwnProperty','nolimit','order','sort','where','filters','pick','filter','merge','VIRTUAL','options','includeAll','include','findAll','rows','params'];(function(_0x24dcf2,_0x21c44e){var _0x16d9c2=function(_0x279104){while(--_0x279104){_0x24dcf2['push'](_0x24dcf2['shift']());}};_0x16d9c2(++_0x21c44e);}(_0x24ca,0x1bc));var _0xa24c=function(_0x31cb5f,_0x2df766){_0x31cb5f=_0x31cb5f-0x0;var _0x586042=_0x24ca[_0x31cb5f];return _0x586042;};'use strict';var emlformat=require(_0xa24c('0x0'));var rimraf=require('rimraf');var zipdir=require(_0xa24c('0x1'));var jsonpatch=require(_0xa24c('0x2'));var rp=require(_0xa24c('0x3'));var moment=require('moment');var BPromise=require(_0xa24c('0x4'));var Mustache=require(_0xa24c('0x5'));var util=require(_0xa24c('0x6'));var path=require(_0xa24c('0x7'));var sox=require(_0xa24c('0x8'));var csv=require(_0xa24c('0x9'));var ejs=require(_0xa24c('0xa'));var fs=require('fs');var fs_extra=require(_0xa24c('0xb'));var _=require(_0xa24c('0xc'));var squel=require(_0xa24c('0xd'));var crypto=require(_0xa24c('0xe'));var jsforce=require('jsforce');var deskjs=require(_0xa24c('0xf'));var toCsv=require(_0xa24c('0x9'));var querystring=require(_0xa24c('0x10'));var Papa=require('papaparse');var Redis=require(_0xa24c('0x11'));var authService=require(_0xa24c('0x12'));var qs=require(_0xa24c('0x13'));var as=require(_0xa24c('0x14'));var hardwareService=require(_0xa24c('0x15'));var logger=require(_0xa24c('0x16'))(_0xa24c('0x17'));var utils=require(_0xa24c('0x18'));var config=require(_0xa24c('0x19'));var licenseUtil=require('../../config/license/util');var db=require(_0xa24c('0x1a'))['db'];function respondWithStatusCode(_0x11090c,_0xcee4fe){_0xcee4fe=_0xcee4fe||0xcc;return function(_0x2c2af8){if(_0x2c2af8){return _0x11090c['sendStatus'](_0xcee4fe);}return _0x11090c[_0xa24c('0x1b')](_0xcee4fe)[_0xa24c('0x1c')]();};}function respondWithResult(_0x26ff28,_0x2fcd8b){_0x2fcd8b=_0x2fcd8b||0xc8;return function(_0x1cb08e){if(_0x1cb08e){return _0x26ff28[_0xa24c('0x1b')](_0x2fcd8b)[_0xa24c('0x1d')](_0x1cb08e);}};}function respondWithFilteredResult(_0x5d4727,_0x47a063){return function(_0xb80781){if(_0xb80781){var _0x87aa90=typeof _0x47a063['offset']==='undefined'&&typeof _0x47a063[_0xa24c('0x1e')]===_0xa24c('0x1f');var _0x5c479e=_0xb80781[_0xa24c('0x20')];var _0x5de3e6=_0x87aa90?0x0:_0x47a063[_0xa24c('0x21')];var _0x2a610a=_0x87aa90?_0xb80781[_0xa24c('0x20')]:_0x47a063[_0xa24c('0x21')]+_0x47a063['limit'];var _0x16d363;if(_0x2a610a>=_0x5c479e){_0x2a610a=_0x5c479e;_0x16d363=0xc8;}else{_0x16d363=0xce;}_0x5d4727[_0xa24c('0x1b')](_0x16d363);return _0x5d4727[_0xa24c('0x22')]('Content-Range',_0x5de3e6+'-'+_0x2a610a+'/'+_0x5c479e)['json'](_0xb80781);}return null;};}function patchUpdates(_0x506424){return function(_0x4cd77e){try{jsonpatch[_0xa24c('0x23')](_0x4cd77e,_0x506424,!![]);}catch(_0x174b69){return BPromise[_0xa24c('0x24')](_0x174b69);}return _0x4cd77e[_0xa24c('0x25')]();};}function saveUpdates(_0x51a275,_0x30ec21){return function(_0x5f299e){if(_0x5f299e){return _0x5f299e[_0xa24c('0x26')](_0x51a275)[_0xa24c('0x27')](function(_0x4a1cda){return _0x4a1cda;});}return null;};}function removeEntity(_0x346ee8,_0x363d52){return function(_0x43a0c0){if(_0x43a0c0){return _0x43a0c0[_0xa24c('0x28')]()[_0xa24c('0x27')](function(){var _0x47e0eb=_0x43a0c0[_0xa24c('0x29')]({'plain':!![]});var _0x5cc9cb=_0xa24c('0x2a');return db[_0xa24c('0x2b')][_0xa24c('0x28')]({'where':{'type':_0x5cc9cb,'resourceId':_0x47e0eb['id']}})['then'](function(){return _0x43a0c0;});})[_0xa24c('0x27')](function(){_0x346ee8[_0xa24c('0x1b')](0xcc)[_0xa24c('0x1c')]();});}};}function handleEntityNotFound(_0x314121,_0x11e4e0){return function(_0x3ad0e6){if(!_0x3ad0e6){_0x314121[_0xa24c('0x2c')](0x194);}return _0x3ad0e6;};}function handleError(_0x5b23f4,_0xa0c48e){_0xa0c48e=_0xa0c48e||0x1f4;return function(_0x28675f){logger[_0xa24c('0x2d')](_0x28675f[_0xa24c('0x2e')]);if(_0x28675f['name']){delete _0x28675f[_0xa24c('0x2f')];}_0x5b23f4[_0xa24c('0x1b')](_0xa0c48e)[_0xa24c('0x30')](_0x28675f);};}exports['index']=function(_0x15eaaf,_0x3dcb1b){var _0x253d83={},_0x4ae35c={},_0x245fb2={'count':0x0,'rows':[]};var _0x5e0226=_[_0xa24c('0x31')](db[_0xa24c('0x32')][_0xa24c('0x33')],function(_0x5d025a){return{'name':_0x5d025a[_0xa24c('0x34')],'type':_0x5d025a[_0xa24c('0x35')][_0xa24c('0x36')]};});_0x4ae35c['model']=_[_0xa24c('0x31')](_0x5e0226,'name');_0x4ae35c[_0xa24c('0x37')]=_[_0xa24c('0x38')](_0x15eaaf['query']);_0x4ae35c['filters']=_[_0xa24c('0x39')](_0x4ae35c[_0xa24c('0x3a')],_0x4ae35c[_0xa24c('0x37')]);_0x253d83[_0xa24c('0x3b')]=_[_0xa24c('0x39')](_0x4ae35c[_0xa24c('0x3a')],qs[_0xa24c('0x3c')](_0x15eaaf['query'][_0xa24c('0x3c')]));_0x253d83[_0xa24c('0x3b')]=_0x253d83[_0xa24c('0x3b')][_0xa24c('0x3d')]?_0x253d83[_0xa24c('0x3b')]:_0x4ae35c[_0xa24c('0x3a')];if(!_0x15eaaf[_0xa24c('0x37')][_0xa24c('0x3e')](_0xa24c('0x3f'))){_0x253d83[_0xa24c('0x1e')]=qs['limit'](_0x15eaaf[_0xa24c('0x37')][_0xa24c('0x1e')]);_0x253d83[_0xa24c('0x21')]=qs[_0xa24c('0x21')](_0x15eaaf['query']['offset']);}_0x253d83[_0xa24c('0x40')]=qs['sort'](_0x15eaaf[_0xa24c('0x37')][_0xa24c('0x41')]);_0x253d83[_0xa24c('0x42')]=qs[_0xa24c('0x43')](_[_0xa24c('0x44')](_0x15eaaf['query'],_0x4ae35c['filters']),_0x5e0226);if(_0x15eaaf[_0xa24c('0x37')][_0xa24c('0x45')]){_0x253d83[_0xa24c('0x42')]=_[_0xa24c('0x46')](_0x253d83[_0xa24c('0x42')],{'$or':_[_0xa24c('0x31')](_0x5e0226,function(_0x5080d0){if(_0x5080d0['type']!==_0xa24c('0x47')){var _0x1ce83e={};_0x1ce83e[_0x5080d0[_0xa24c('0x2f')]]={'$like':'%'+_0x15eaaf[_0xa24c('0x37')][_0xa24c('0x45')]+'%'};return _0x1ce83e;}})});}_0x253d83=_['merge']({},_0x253d83,_0x15eaaf[_0xa24c('0x48')]);var _0x7895e={'where':_0x253d83['where']};return db['AnalyticMetric'][_0xa24c('0x20')](_0x7895e)[_0xa24c('0x27')](function(_0x231eea){_0x245fb2['count']=_0x231eea;if(_0x15eaaf['query'][_0xa24c('0x49')]){_0x253d83[_0xa24c('0x4a')]=[{'all':!![]}];}return db[_0xa24c('0x32')][_0xa24c('0x4b')](_0x253d83);})[_0xa24c('0x27')](function(_0x1b7faf){_0x245fb2[_0xa24c('0x4c')]=_0x1b7faf;return _0x245fb2;})[_0xa24c('0x27')](respondWithFilteredResult(_0x3dcb1b,_0x253d83))['catch'](handleError(_0x3dcb1b,null));};exports['show']=function(_0x430ba3,_0x44f7d4){var _0x455256={'raw':!![],'where':{'id':_0x430ba3[_0xa24c('0x4d')]['id']}},_0x5972d7={};_0x5972d7[_0xa24c('0x3a')]=_[_0xa24c('0x38')](db[_0xa24c('0x32')][_0xa24c('0x33')]);_0x5972d7[_0xa24c('0x37')]=_[_0xa24c('0x38')](_0x430ba3[_0xa24c('0x37')]);_0x5972d7[_0xa24c('0x43')]=_[_0xa24c('0x39')](_0x5972d7['model'],_0x5972d7[_0xa24c('0x37')]);_0x455256[_0xa24c('0x3b')]=_[_0xa24c('0x39')](_0x5972d7['model'],qs[_0xa24c('0x3c')](_0x430ba3[_0xa24c('0x37')][_0xa24c('0x3c')]));_0x455256[_0xa24c('0x3b')]=_0x455256[_0xa24c('0x3b')][_0xa24c('0x3d')]?_0x455256[_0xa24c('0x3b')]:_0x5972d7[_0xa24c('0x3a')];if(_0x430ba3[_0xa24c('0x37')][_0xa24c('0x49')]){_0x455256[_0xa24c('0x4a')]=[{'all':!![]}];}_0x455256=_['merge']({},_0x455256,_0x430ba3[_0xa24c('0x48')]);return db[_0xa24c('0x32')][_0xa24c('0x4e')](_0x455256)[_0xa24c('0x27')](handleEntityNotFound(_0x44f7d4,null))[_0xa24c('0x27')](respondWithResult(_0x44f7d4,null))[_0xa24c('0x4f')](handleError(_0x44f7d4,null));};exports[_0xa24c('0x50')]=function(_0x2250b9,_0x184179){return db['AnalyticMetric']['create'](_0x2250b9[_0xa24c('0x51')],{})['then'](function(_0xc078ef){var _0x1f436c=_0x2250b9['user'][_0xa24c('0x29')]({'plain':!![]});if(!_0x1f436c)throw new Error(_0xa24c('0x52'));if(_0x1f436c[_0xa24c('0x53')]==='user'){var _0x55978e=_0xc078ef[_0xa24c('0x29')]({'plain':!![]});var _0x5ba726=_0xa24c('0x2a');return db[_0xa24c('0x54')][_0xa24c('0x4e')]({'where':{'name':_0x5ba726,'userProfileId':_0x1f436c[_0xa24c('0x55')]},'raw':!![]})[_0xa24c('0x27')](function(_0x1fa739){if(_0x1fa739&&_0x1fa739[_0xa24c('0x56')]===0x0){return db[_0xa24c('0x2b')][_0xa24c('0x50')]({'name':_0x55978e[_0xa24c('0x2f')],'resourceId':_0x55978e['id'],'type':_0x1fa739['name'],'sectionId':_0x1fa739['id']},{})[_0xa24c('0x27')](function(){return _0xc078ef;});}else{return _0xc078ef;}})[_0xa24c('0x4f')](function(_0x233f8e){logger['error']('Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s',_0x233f8e);throw _0x233f8e;});}return _0xc078ef;})['then'](respondWithResult(_0x184179,0xc9))[_0xa24c('0x4f')](handleError(_0x184179,null));};exports['update']=function(_0x4757ff,_0x21d0fc){if(_0x4757ff['body']['id']){delete _0x4757ff[_0xa24c('0x51')]['id'];}return db[_0xa24c('0x32')][_0xa24c('0x4e')]({'where':{'id':_0x4757ff[_0xa24c('0x4d')]['id']}})[_0xa24c('0x27')](handleEntityNotFound(_0x21d0fc,null))[_0xa24c('0x27')](saveUpdates(_0x4757ff[_0xa24c('0x51')],null))[_0xa24c('0x27')](respondWithResult(_0x21d0fc,null))['catch'](handleError(_0x21d0fc,null));};exports[_0xa24c('0x28')]=function(_0x47af80,_0x5abd45){return db['AnalyticMetric']['find']({'where':{'id':_0x47af80['params']['id']}})[_0xa24c('0x27')](handleEntityNotFound(_0x5abd45,null))['then'](removeEntity(_0x5abd45,null))[_0xa24c('0x4f')](handleError(_0x5abd45,null));}; \ No newline at end of file diff --git a/server/api/analyticMetric/analyticMetric.model.js b/server/api/analyticMetric/analyticMetric.model.js index 20091fb..131c180 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 _0xad5f=['bluebird','path','rimraf','../../config/environment','./analyticMetric.attributes','exports','AnalyticMetric','analytics_metrics','lodash','util','../../config/logger','api','moment'];(function(_0xa0aee9,_0x36c6dc){var _0xd912e5=function(_0x277c79){while(--_0x277c79){_0xa0aee9['push'](_0xa0aee9['shift']());}};_0xd912e5(++_0x36c6dc);}(_0xad5f,0x1a8));var _0xfad5=function(_0x5d92d2,_0x399d73){_0x5d92d2=_0x5d92d2-0x0;var _0x5e6d11=_0xad5f[_0x5d92d2];return _0x5e6d11;};'use strict';var _=require(_0xfad5('0x0'));var util=require(_0xfad5('0x1'));var logger=require(_0xfad5('0x2'))(_0xfad5('0x3'));var moment=require(_0xfad5('0x4'));var BPromise=require(_0xfad5('0x5'));var rp=require('request-promise');var fs=require('fs');var path=require(_0xfad5('0x6'));var rimraf=require(_0xfad5('0x7'));var config=require(_0xfad5('0x8'));var attributes=require(_0xfad5('0x9'));module[_0xfad5('0xa')]=function(_0x180450,_0x43cae5){return _0x180450['define'](_0xfad5('0xb'),attributes,{'tableName':_0xfad5('0xc'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0xc1c6=['moment','request-promise','path','rimraf','exports','AnalyticMetric','analytics_metrics','lodash','util','../../config/logger'];(function(_0x7af9ec,_0x19713f){var _0x297123=function(_0x5395c9){while(--_0x5395c9){_0x7af9ec['push'](_0x7af9ec['shift']());}};_0x297123(++_0x19713f);}(_0xc1c6,0xf7));var _0x6c1c=function(_0x4c3bf7,_0x47cbc5){_0x4c3bf7=_0x4c3bf7-0x0;var _0x26d188=_0xc1c6[_0x4c3bf7];return _0x26d188;};'use strict';var _=require(_0x6c1c('0x0'));var util=require(_0x6c1c('0x1'));var logger=require(_0x6c1c('0x2'))('api');var moment=require(_0x6c1c('0x3'));var BPromise=require('bluebird');var rp=require(_0x6c1c('0x4'));var fs=require('fs');var path=require(_0x6c1c('0x5'));var rimraf=require(_0x6c1c('0x6'));var config=require('../../config/environment');var attributes=require('./analyticMetric.attributes');module[_0x6c1c('0x7')]=function(_0x524a6b,_0x50c1bb){return _0x524a6b['define'](_0x6c1c('0x8'),attributes,{'tableName':_0x6c1c('0x9'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/analyticMetric/analyticMetric.rpc.js b/server/api/analyticMetric/analyticMetric.rpc.js index 2b129c2..74c294c 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 _0x46b7=['debug','AnalyticMetric,\x20%s,\x20%s,\x20%s','stringify','error','code','message','request\x20sent','result','catch','lodash','util','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','request','info','AnalyticMetric,\x20%s,\x20%s'];(function(_0x330691,_0x490876){var _0x39b97a=function(_0x39bbc2){while(--_0x39bbc2){_0x330691['push'](_0x330691['shift']());}};_0x39b97a(++_0x490876);}(_0x46b7,0xef));var _0x746b=function(_0x480f67,_0x4d6cfd){_0x480f67=_0x480f67-0x0;var _0x48ce8a=_0x46b7[_0x480f67];return _0x48ce8a;};'use strict';var _=require(_0x746b('0x0'));var util=require(_0x746b('0x1'));var moment=require('moment');var BPromise=require(_0x746b('0x2'));var rs=require(_0x746b('0x3'));var fs=require('fs');var Redis=require(_0x746b('0x4'));var db=require(_0x746b('0x5'))['db'];var utils=require(_0x746b('0x6'));var logger=require(_0x746b('0x7'))(_0x746b('0x8'));var config=require(_0x746b('0x9'));var jayson=require(_0x746b('0xa'));var client=jayson['client']['http']({'port':0x232a});function respondWithRpcPromise(_0x7ad9d,_0x2dddeb,_0x3474a7){return new BPromise(function(_0x1e4011,_0x55fbeb){return client[_0x746b('0xb')](_0x7ad9d,_0x3474a7)['then'](function(_0x2a761d){logger[_0x746b('0xc')](_0x746b('0xd'),_0x2dddeb,'request\x20sent');logger[_0x746b('0xe')](_0x746b('0xf'),_0x2dddeb,'request\x20sent',JSON[_0x746b('0x10')](_0x2a761d));if(_0x2a761d[_0x746b('0x11')]){if(_0x2a761d['error'][_0x746b('0x12')]===0x1f4){logger[_0x746b('0x11')](_0x746b('0xd'),_0x2dddeb,_0x2a761d[_0x746b('0x11')]['message']);return _0x55fbeb(_0x2a761d['error'][_0x746b('0x13')]);}logger[_0x746b('0x11')]('AnalyticMetric,\x20%s,\x20%s',_0x2dddeb,_0x2a761d[_0x746b('0x11')][_0x746b('0x13')]);return _0x1e4011(_0x2a761d[_0x746b('0x11')][_0x746b('0x13')]);}else{logger[_0x746b('0xc')](_0x746b('0xd'),_0x2dddeb,_0x746b('0x14'));_0x1e4011(_0x2a761d[_0x746b('0x15')][_0x746b('0x13')]);}})[_0x746b('0x16')](function(_0xd4b4d1){logger['error'](_0x746b('0xd'),_0x2dddeb,_0xd4b4d1);_0x55fbeb(_0xd4b4d1);});});} \ No newline at end of file +var _0x6d29=['../../config/utils','../../config/logger','rpc','client','http','request','info','AnalyticMetric,\x20%s,\x20%s','request\x20sent','debug','stringify','error','message','result','catch','lodash','util','moment','bluebird','ioredis','../../mysqldb'];(function(_0x414060,_0x437d71){var _0x47c153=function(_0x4c0b44){while(--_0x4c0b44){_0x414060['push'](_0x414060['shift']());}};_0x47c153(++_0x437d71);}(_0x6d29,0x1b3));var _0x96d2=function(_0x2cf290,_0x44b27d){_0x2cf290=_0x2cf290-0x0;var _0xca3b7=_0x6d29[_0x2cf290];return _0xca3b7;};'use strict';var _=require(_0x96d2('0x0'));var util=require(_0x96d2('0x1'));var moment=require(_0x96d2('0x2'));var BPromise=require(_0x96d2('0x3'));var rs=require('randomstring');var fs=require('fs');var Redis=require(_0x96d2('0x4'));var db=require(_0x96d2('0x5'))['db'];var utils=require(_0x96d2('0x6'));var logger=require(_0x96d2('0x7'))(_0x96d2('0x8'));var config=require('../../config/environment');var jayson=require('jayson/promise');var client=jayson[_0x96d2('0x9')][_0x96d2('0xa')]({'port':0x232a});function respondWithRpcPromise(_0x74ad33,_0x486a55,_0x596b9f){return new BPromise(function(_0x34d58e,_0x14643c){return client[_0x96d2('0xb')](_0x74ad33,_0x596b9f)['then'](function(_0x41deb6){logger[_0x96d2('0xc')](_0x96d2('0xd'),_0x486a55,_0x96d2('0xe'));logger[_0x96d2('0xf')]('AnalyticMetric,\x20%s,\x20%s,\x20%s',_0x486a55,'request\x20sent',JSON[_0x96d2('0x10')](_0x41deb6));if(_0x41deb6[_0x96d2('0x11')]){if(_0x41deb6[_0x96d2('0x11')]['code']===0x1f4){logger['error'](_0x96d2('0xd'),_0x486a55,_0x41deb6[_0x96d2('0x11')][_0x96d2('0x12')]);return _0x14643c(_0x41deb6[_0x96d2('0x11')][_0x96d2('0x12')]);}logger[_0x96d2('0x11')](_0x96d2('0xd'),_0x486a55,_0x41deb6[_0x96d2('0x11')][_0x96d2('0x12')]);return _0x34d58e(_0x41deb6['error']['message']);}else{logger[_0x96d2('0xc')](_0x96d2('0xd'),_0x486a55,_0x96d2('0xe'));_0x34d58e(_0x41deb6[_0x96d2('0x13')][_0x96d2('0x12')]);}})[_0x96d2('0x14')](function(_0x70b575){logger[_0x96d2('0x11')](_0x96d2('0xd'),_0x486a55,_0x70b575);_0x14643c(_0x70b575);});});} \ No newline at end of file diff --git a/server/api/analyticMetric/index.js b/server/api/analyticMetric/index.js index ee924a7..84b57ea 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 _0x9417=['./analyticMetric.controller','get','isAuthenticated','index','show','post','create','update','delete','/:id','destroy','exports','multer','util','path','connect-timeout','Router','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment'];(function(_0x5252ff,_0x4c8a2b){var _0x31b14f=function(_0x52d90c){while(--_0x52d90c){_0x5252ff['push'](_0x5252ff['shift']());}};_0x31b14f(++_0x4c8a2b);}(_0x9417,0xb4));var _0x7941=function(_0x4d3d50,_0x50f156){_0x4d3d50=_0x4d3d50-0x0;var _0x175e6d=_0x9417[_0x4d3d50];return _0x175e6d;};'use strict';var multer=require(_0x7941('0x0'));var util=require(_0x7941('0x1'));var path=require(_0x7941('0x2'));var timeout=require(_0x7941('0x3'));var express=require('express');var router=express[_0x7941('0x4')]();var fs_extra=require(_0x7941('0x5'));var auth=require(_0x7941('0x6'));var interaction=require(_0x7941('0x7'));var config=require(_0x7941('0x8'));var controller=require(_0x7941('0x9'));router[_0x7941('0xa')]('/',auth[_0x7941('0xb')](),controller[_0x7941('0xc')]);router[_0x7941('0xa')]('/:id',auth[_0x7941('0xb')](),controller[_0x7941('0xd')]);router[_0x7941('0xe')]('/',auth['isAuthenticated'](),controller[_0x7941('0xf')]);router['put']('/:id',auth[_0x7941('0xb')](),controller[_0x7941('0x10')]);router[_0x7941('0x11')](_0x7941('0x12'),auth[_0x7941('0xb')](),controller[_0x7941('0x13')]);module[_0x7941('0x14')]=router; \ No newline at end of file +var _0x4677=['path','connect-timeout','express','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','./analyticMetric.controller','get','isAuthenticated','index','show','post','create','put','delete','/:id','exports','multer'];(function(_0x331313,_0x4f15f9){var _0x4231a3=function(_0x1bb295){while(--_0x1bb295){_0x331313['push'](_0x331313['shift']());}};_0x4231a3(++_0x4f15f9);}(_0x4677,0x155));var _0x7467=function(_0x4376ff,_0xff4f64){_0x4376ff=_0x4376ff-0x0;var _0x364eb8=_0x4677[_0x4376ff];return _0x364eb8;};'use strict';var multer=require(_0x7467('0x0'));var util=require('util');var path=require(_0x7467('0x1'));var timeout=require(_0x7467('0x2'));var express=require(_0x7467('0x3'));var router=express['Router']();var fs_extra=require(_0x7467('0x4'));var auth=require(_0x7467('0x5'));var interaction=require(_0x7467('0x6'));var config=require(_0x7467('0x7'));var controller=require(_0x7467('0x8'));router[_0x7467('0x9')]('/',auth[_0x7467('0xa')](),controller[_0x7467('0xb')]);router[_0x7467('0x9')]('/:id',auth['isAuthenticated'](),controller[_0x7467('0xc')]);router[_0x7467('0xd')]('/',auth['isAuthenticated'](),controller[_0x7467('0xe')]);router[_0x7467('0xf')]('/:id',auth[_0x7467('0xa')](),controller['update']);router[_0x7467('0x10')](_0x7467('0x11'),auth[_0x7467('0xa')](),controller['destroy']);module[_0x7467('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 9945e5c..455289e 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 _0x2fc7=['exports'];(function(_0x123b6c,_0x112587){var _0x246b76=function(_0x455545){while(--_0x455545){_0x123b6c['push'](_0x123b6c['shift']());}};_0x246b76(++_0x112587);}(_0x2fc7,0x19d));var _0x72fc=function(_0x1eea70,_0x10c98b){_0x1eea70=_0x1eea70-0x0;var _0x46720f=_0x2fc7[_0x1eea70];return _0x46720f;};'use strict';var Sequelize=require('sequelize');module[_0x72fc('0x0')]={'tree':{'type':Sequelize['TEXT'],'allowNull':![]}}; \ No newline at end of file +var _0xd5db=['exports'];(function(_0x5519e0,_0xec8f68){var _0x14dfb2=function(_0x46b753){while(--_0x46b753){_0x5519e0['push'](_0x5519e0['shift']());}};_0x14dfb2(++_0xec8f68);}(_0xd5db,0xbc));var _0xbd5d=function(_0x5f09c5,_0x2bfca0){_0x5f09c5=_0x5f09c5-0x0;var _0x426ad9=_0xd5db[_0x5f09c5];return _0x426ad9;};'use strict';var Sequelize=require('sequelize');module[_0xbd5d('0x0')]={'tree':{'type':Sequelize['TEXT'],'allowNull':![]}}; \ No newline at end of file diff --git a/server/api/analyticTreeReport/analyticTreeReport.controller.js b/server/api/analyticTreeReport/analyticTreeReport.controller.js index a671c0f..756c037 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 _0x4d2c=['../../config/logger','../../config/utils','../../config/environment','../../mysqldb','sendStatus','end','status','undefined','limit','offset','count','Content-Range','json','apply','reject','save','update','then','destroy','error','stack','name','send','AnalyticTreeReport','rawAttributes','fieldName','type','key','model','map','keys','query','filters','attributes','fields','length','nolimit','sort','where','filter','merge','options','include','findAll','rows','catch','show','intersection','includeAll','create','body','find','params','rimraf','zip-dir','fast-json-patch','request-promise','bluebird','path','to-csv','ejs','fs-extra','lodash','squel','crypto','querystring','papaparse','ioredis','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware'];(function(_0x3a87ef,_0x25aa94){var _0x414ef9=function(_0x5787eb){while(--_0x5787eb){_0x3a87ef['push'](_0x3a87ef['shift']());}};_0x414ef9(++_0x25aa94);}(_0x4d2c,0x1df));var _0xc4d2=function(_0x1c188f,_0x5ef40f){_0x1c188f=_0x1c188f-0x0;var _0x381011=_0x4d2c[_0x1c188f];return _0x381011;};'use strict';var emlformat=require('eml-format');var rimraf=require(_0xc4d2('0x0'));var zipdir=require(_0xc4d2('0x1'));var jsonpatch=require(_0xc4d2('0x2'));var rp=require(_0xc4d2('0x3'));var moment=require('moment');var BPromise=require(_0xc4d2('0x4'));var Mustache=require('mustache');var util=require('util');var path=require(_0xc4d2('0x5'));var sox=require('sox');var csv=require(_0xc4d2('0x6'));var ejs=require(_0xc4d2('0x7'));var fs=require('fs');var fs_extra=require(_0xc4d2('0x8'));var _=require(_0xc4d2('0x9'));var squel=require(_0xc4d2('0xa'));var crypto=require(_0xc4d2('0xb'));var jsforce=require('jsforce');var deskjs=require('desk.js');var toCsv=require(_0xc4d2('0x6'));var querystring=require(_0xc4d2('0xc'));var Papa=require(_0xc4d2('0xd'));var Redis=require(_0xc4d2('0xe'));var authService=require('../../components/auth/service');var qs=require(_0xc4d2('0xf'));var as=require(_0xc4d2('0x10'));var hardwareService=require(_0xc4d2('0x11'));var logger=require(_0xc4d2('0x12'))('api');var utils=require(_0xc4d2('0x13'));var config=require(_0xc4d2('0x14'));var licenseUtil=require('../../config/license/util');var db=require(_0xc4d2('0x15'))['db'];function respondWithStatusCode(_0x554aab,_0x40248e){_0x40248e=_0x40248e||0xcc;return function(_0x27af9a){if(_0x27af9a){return _0x554aab[_0xc4d2('0x16')](_0x40248e);}return _0x554aab['status'](_0x40248e)[_0xc4d2('0x17')]();};}function respondWithResult(_0x225e15,_0x293d9c){_0x293d9c=_0x293d9c||0xc8;return function(_0x1f0658){if(_0x1f0658){return _0x225e15[_0xc4d2('0x18')](_0x293d9c)['json'](_0x1f0658);}};}function respondWithFilteredResult(_0x3c020d,_0x402f89){return function(_0x2d1f6a){if(_0x2d1f6a){var _0x2f5a12=typeof _0x402f89['offset']===_0xc4d2('0x19')&&typeof _0x402f89[_0xc4d2('0x1a')]===_0xc4d2('0x19');var _0xcbf836=_0x2d1f6a['count'];var _0x1311ad=_0x2f5a12?0x0:_0x402f89[_0xc4d2('0x1b')];var _0x231309=_0x2f5a12?_0x2d1f6a[_0xc4d2('0x1c')]:_0x402f89[_0xc4d2('0x1b')]+_0x402f89[_0xc4d2('0x1a')];var _0x1405ac;if(_0x231309>=_0xcbf836){_0x231309=_0xcbf836;_0x1405ac=0xc8;}else{_0x1405ac=0xce;}_0x3c020d[_0xc4d2('0x18')](_0x1405ac);return _0x3c020d['set'](_0xc4d2('0x1d'),_0x1311ad+'-'+_0x231309+'/'+_0xcbf836)[_0xc4d2('0x1e')](_0x2d1f6a);}return null;};}function patchUpdates(_0xea654f){return function(_0x46704e){try{jsonpatch[_0xc4d2('0x1f')](_0x46704e,_0xea654f,!![]);}catch(_0x2a255d){return BPromise[_0xc4d2('0x20')](_0x2a255d);}return _0x46704e[_0xc4d2('0x21')]();};}function saveUpdates(_0x256aa1,_0x277cb5){return function(_0x3d1393){if(_0x3d1393){return _0x3d1393[_0xc4d2('0x22')](_0x256aa1)[_0xc4d2('0x23')](function(_0x1ebae){return _0x1ebae;});}return null;};}function removeEntity(_0x242a10,_0x20635d){return function(_0x38fcae){if(_0x38fcae){return _0x38fcae[_0xc4d2('0x24')]()[_0xc4d2('0x23')](function(){_0x242a10[_0xc4d2('0x18')](0xcc)[_0xc4d2('0x17')]();});}};}function handleEntityNotFound(_0xce02ff,_0x112331){return function(_0x4fced1){if(!_0x4fced1){_0xce02ff[_0xc4d2('0x16')](0x194);}return _0x4fced1;};}function handleError(_0x1c773d,_0x21d677){_0x21d677=_0x21d677||0x1f4;return function(_0x2519c1){logger[_0xc4d2('0x25')](_0x2519c1[_0xc4d2('0x26')]);if(_0x2519c1['name']){delete _0x2519c1[_0xc4d2('0x27')];}_0x1c773d[_0xc4d2('0x18')](_0x21d677)[_0xc4d2('0x28')](_0x2519c1);};}exports['index']=function(_0x365e2f,_0x4179bf){var _0x278be5={},_0x2c622a={},_0x21582f={'count':0x0,'rows':[]};var _0x82ce8a=_['map'](db[_0xc4d2('0x29')][_0xc4d2('0x2a')],function(_0x7b9b2c){return{'name':_0x7b9b2c[_0xc4d2('0x2b')],'type':_0x7b9b2c[_0xc4d2('0x2c')][_0xc4d2('0x2d')]};});_0x2c622a[_0xc4d2('0x2e')]=_[_0xc4d2('0x2f')](_0x82ce8a,_0xc4d2('0x27'));_0x2c622a['query']=_[_0xc4d2('0x30')](_0x365e2f[_0xc4d2('0x31')]);_0x2c622a[_0xc4d2('0x32')]=_['intersection'](_0x2c622a[_0xc4d2('0x2e')],_0x2c622a[_0xc4d2('0x31')]);_0x278be5[_0xc4d2('0x33')]=_['intersection'](_0x2c622a['model'],qs[_0xc4d2('0x34')](_0x365e2f[_0xc4d2('0x31')][_0xc4d2('0x34')]));_0x278be5[_0xc4d2('0x33')]=_0x278be5[_0xc4d2('0x33')][_0xc4d2('0x35')]?_0x278be5[_0xc4d2('0x33')]:_0x2c622a[_0xc4d2('0x2e')];if(!_0x365e2f[_0xc4d2('0x31')]['hasOwnProperty'](_0xc4d2('0x36'))){_0x278be5[_0xc4d2('0x1a')]=qs[_0xc4d2('0x1a')](_0x365e2f[_0xc4d2('0x31')][_0xc4d2('0x1a')]);_0x278be5[_0xc4d2('0x1b')]=qs[_0xc4d2('0x1b')](_0x365e2f[_0xc4d2('0x31')][_0xc4d2('0x1b')]);}_0x278be5['order']=qs[_0xc4d2('0x37')](_0x365e2f['query']['sort']);_0x278be5[_0xc4d2('0x38')]=qs['filters'](_['pick'](_0x365e2f[_0xc4d2('0x31')],_0x2c622a['filters']),_0x82ce8a);if(_0x365e2f[_0xc4d2('0x31')][_0xc4d2('0x39')]){_0x278be5[_0xc4d2('0x38')]=_['merge'](_0x278be5['where'],{'$or':_[_0xc4d2('0x2f')](_0x82ce8a,function(_0x3cffba){if(_0x3cffba[_0xc4d2('0x2c')]!=='VIRTUAL'){var _0x280ff5={};_0x280ff5[_0x3cffba['name']]={'$like':'%'+_0x365e2f[_0xc4d2('0x31')]['filter']+'%'};return _0x280ff5;}})});}_0x278be5=_[_0xc4d2('0x3a')]({},_0x278be5,_0x365e2f[_0xc4d2('0x3b')]);var _0x3fe417={'where':_0x278be5[_0xc4d2('0x38')]};return db['AnalyticTreeReport'][_0xc4d2('0x1c')](_0x3fe417)[_0xc4d2('0x23')](function(_0x1b558d){_0x21582f['count']=_0x1b558d;if(_0x365e2f[_0xc4d2('0x31')]['includeAll']){_0x278be5[_0xc4d2('0x3c')]=[{'all':!![]}];}return db[_0xc4d2('0x29')][_0xc4d2('0x3d')](_0x278be5);})[_0xc4d2('0x23')](function(_0x10a2b8){_0x21582f[_0xc4d2('0x3e')]=_0x10a2b8;return _0x21582f;})[_0xc4d2('0x23')](respondWithFilteredResult(_0x4179bf,_0x278be5))[_0xc4d2('0x3f')](handleError(_0x4179bf,null));};exports[_0xc4d2('0x40')]=function(_0x5f4f30,_0x4ac92c){var _0x1ebffd={'raw':!![],'where':{'id':_0x5f4f30['params']['id']}},_0x27388f={};_0x27388f[_0xc4d2('0x2e')]=_['keys'](db[_0xc4d2('0x29')][_0xc4d2('0x2a')]);_0x27388f[_0xc4d2('0x31')]=_[_0xc4d2('0x30')](_0x5f4f30[_0xc4d2('0x31')]);_0x27388f[_0xc4d2('0x32')]=_[_0xc4d2('0x41')](_0x27388f[_0xc4d2('0x2e')],_0x27388f[_0xc4d2('0x31')]);_0x1ebffd[_0xc4d2('0x33')]=_['intersection'](_0x27388f[_0xc4d2('0x2e')],qs[_0xc4d2('0x34')](_0x5f4f30[_0xc4d2('0x31')][_0xc4d2('0x34')]));_0x1ebffd[_0xc4d2('0x33')]=_0x1ebffd[_0xc4d2('0x33')][_0xc4d2('0x35')]?_0x1ebffd['attributes']:_0x27388f[_0xc4d2('0x2e')];if(_0x5f4f30[_0xc4d2('0x31')][_0xc4d2('0x42')]){_0x1ebffd[_0xc4d2('0x3c')]=[{'all':!![]}];}_0x1ebffd=_['merge']({},_0x1ebffd,_0x5f4f30['options']);return db[_0xc4d2('0x29')]['find'](_0x1ebffd)['then'](handleEntityNotFound(_0x4ac92c,null))[_0xc4d2('0x23')](respondWithResult(_0x4ac92c,null))[_0xc4d2('0x3f')](handleError(_0x4ac92c,null));};exports[_0xc4d2('0x43')]=function(_0x5da56,_0x5a0943){return db['AnalyticTreeReport'][_0xc4d2('0x43')](_0x5da56['body'],{})['then'](respondWithResult(_0x5a0943,0xc9))[_0xc4d2('0x3f')](handleError(_0x5a0943,null));};exports[_0xc4d2('0x22')]=function(_0xba09f1,_0x2bf70f){if(_0xba09f1[_0xc4d2('0x44')]['id']){delete _0xba09f1[_0xc4d2('0x44')]['id'];}return db[_0xc4d2('0x29')][_0xc4d2('0x45')]({'where':{'id':_0xba09f1[_0xc4d2('0x46')]['id']}})[_0xc4d2('0x23')](handleEntityNotFound(_0x2bf70f,null))['then'](saveUpdates(_0xba09f1[_0xc4d2('0x44')],null))[_0xc4d2('0x23')](respondWithResult(_0x2bf70f,null))[_0xc4d2('0x3f')](handleError(_0x2bf70f,null));};exports[_0xc4d2('0x24')]=function(_0x410182,_0x58cc9e){return db[_0xc4d2('0x29')][_0xc4d2('0x45')]({'where':{'id':_0x410182['params']['id']}})[_0xc4d2('0x23')](handleEntityNotFound(_0x58cc9e,null))[_0xc4d2('0x23')](removeEntity(_0x58cc9e,null))[_0xc4d2('0x3f')](handleError(_0x58cc9e,null));}; \ No newline at end of file +var _0xd38c=['stack','name','send','index','AnalyticTreeReport','rawAttributes','fieldName','key','model','map','keys','query','filters','intersection','fields','attributes','length','nolimit','offset','order','where','pick','filter','merge','type','options','includeAll','include','findAll','catch','show','params','create','body','update','find','eml-format','rimraf','fast-json-patch','moment','bluebird','sox','to-csv','ejs','lodash','squel','crypto','jsforce','desk.js','querystring','papaparse','ioredis','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/environment','../../config/license/util','sendStatus','status','end','undefined','limit','count','set','Content-Range','apply','then','destroy','error'];(function(_0x47e30d,_0x2ed6e7){var _0x22b013=function(_0x1b58e1){while(--_0x1b58e1){_0x47e30d['push'](_0x47e30d['shift']());}};_0x22b013(++_0x2ed6e7);}(_0xd38c,0xfc));var _0xcd38=function(_0x4612b5,_0x1b8be5){_0x4612b5=_0x4612b5-0x0;var _0x45398f=_0xd38c[_0x4612b5];return _0x45398f;};'use strict';var emlformat=require(_0xcd38('0x0'));var rimraf=require(_0xcd38('0x1'));var zipdir=require('zip-dir');var jsonpatch=require(_0xcd38('0x2'));var rp=require('request-promise');var moment=require(_0xcd38('0x3'));var BPromise=require(_0xcd38('0x4'));var Mustache=require('mustache');var util=require('util');var path=require('path');var sox=require(_0xcd38('0x5'));var csv=require(_0xcd38('0x6'));var ejs=require(_0xcd38('0x7'));var fs=require('fs');var fs_extra=require('fs-extra');var _=require(_0xcd38('0x8'));var squel=require(_0xcd38('0x9'));var crypto=require(_0xcd38('0xa'));var jsforce=require(_0xcd38('0xb'));var deskjs=require(_0xcd38('0xc'));var toCsv=require(_0xcd38('0x6'));var querystring=require(_0xcd38('0xd'));var Papa=require(_0xcd38('0xe'));var Redis=require(_0xcd38('0xf'));var authService=require('../../components/auth/service');var qs=require(_0xcd38('0x10'));var as=require(_0xcd38('0x11'));var hardwareService=require(_0xcd38('0x12'));var logger=require(_0xcd38('0x13'))(_0xcd38('0x14'));var utils=require(_0xcd38('0x15'));var config=require(_0xcd38('0x16'));var licenseUtil=require(_0xcd38('0x17'));var db=require('../../mysqldb')['db'];function respondWithStatusCode(_0x1e01a5,_0x19d8e8){_0x19d8e8=_0x19d8e8||0xcc;return function(_0x581189){if(_0x581189){return _0x1e01a5[_0xcd38('0x18')](_0x19d8e8);}return _0x1e01a5[_0xcd38('0x19')](_0x19d8e8)[_0xcd38('0x1a')]();};}function respondWithResult(_0x32d767,_0x49148c){_0x49148c=_0x49148c||0xc8;return function(_0x4924de){if(_0x4924de){return _0x32d767[_0xcd38('0x19')](_0x49148c)['json'](_0x4924de);}};}function respondWithFilteredResult(_0x32f13a,_0x14b84e){return function(_0x3b606f){if(_0x3b606f){var _0x59fbea=typeof _0x14b84e['offset']===_0xcd38('0x1b')&&typeof _0x14b84e[_0xcd38('0x1c')]===_0xcd38('0x1b');var _0x31b0c5=_0x3b606f[_0xcd38('0x1d')];var _0x5c1af7=_0x59fbea?0x0:_0x14b84e['offset'];var _0x121802=_0x59fbea?_0x3b606f[_0xcd38('0x1d')]:_0x14b84e['offset']+_0x14b84e[_0xcd38('0x1c')];var _0x51ca8d;if(_0x121802>=_0x31b0c5){_0x121802=_0x31b0c5;_0x51ca8d=0xc8;}else{_0x51ca8d=0xce;}_0x32f13a[_0xcd38('0x19')](_0x51ca8d);return _0x32f13a[_0xcd38('0x1e')](_0xcd38('0x1f'),_0x5c1af7+'-'+_0x121802+'/'+_0x31b0c5)['json'](_0x3b606f);}return null;};}function patchUpdates(_0x52dd00){return function(_0x5cb0ab){try{jsonpatch[_0xcd38('0x20')](_0x5cb0ab,_0x52dd00,!![]);}catch(_0x1d4739){return BPromise['reject'](_0x1d4739);}return _0x5cb0ab['save']();};}function saveUpdates(_0x4e94e7,_0x6aa57){return function(_0x93f524){if(_0x93f524){return _0x93f524['update'](_0x4e94e7)[_0xcd38('0x21')](function(_0x4ba659){return _0x4ba659;});}return null;};}function removeEntity(_0x21608a,_0x45e5a7){return function(_0x58e2e5){if(_0x58e2e5){return _0x58e2e5[_0xcd38('0x22')]()[_0xcd38('0x21')](function(){_0x21608a[_0xcd38('0x19')](0xcc)['end']();});}};}function handleEntityNotFound(_0x3549b7,_0x37746d){return function(_0x57badb){if(!_0x57badb){_0x3549b7[_0xcd38('0x18')](0x194);}return _0x57badb;};}function handleError(_0xa9a345,_0x18e488){_0x18e488=_0x18e488||0x1f4;return function(_0x249660){logger[_0xcd38('0x23')](_0x249660[_0xcd38('0x24')]);if(_0x249660['name']){delete _0x249660[_0xcd38('0x25')];}_0xa9a345[_0xcd38('0x19')](_0x18e488)[_0xcd38('0x26')](_0x249660);};}exports[_0xcd38('0x27')]=function(_0x2d90c8,_0x4c6dcb){var _0x1194ca={},_0x843fa5={},_0x356b81={'count':0x0,'rows':[]};var _0x1d9eb6=_['map'](db[_0xcd38('0x28')][_0xcd38('0x29')],function(_0x462bd7){return{'name':_0x462bd7[_0xcd38('0x2a')],'type':_0x462bd7['type'][_0xcd38('0x2b')]};});_0x843fa5[_0xcd38('0x2c')]=_[_0xcd38('0x2d')](_0x1d9eb6,'name');_0x843fa5['query']=_[_0xcd38('0x2e')](_0x2d90c8[_0xcd38('0x2f')]);_0x843fa5[_0xcd38('0x30')]=_['intersection'](_0x843fa5['model'],_0x843fa5[_0xcd38('0x2f')]);_0x1194ca['attributes']=_[_0xcd38('0x31')](_0x843fa5[_0xcd38('0x2c')],qs[_0xcd38('0x32')](_0x2d90c8[_0xcd38('0x2f')]['fields']));_0x1194ca[_0xcd38('0x33')]=_0x1194ca[_0xcd38('0x33')][_0xcd38('0x34')]?_0x1194ca[_0xcd38('0x33')]:_0x843fa5[_0xcd38('0x2c')];if(!_0x2d90c8['query']['hasOwnProperty'](_0xcd38('0x35'))){_0x1194ca[_0xcd38('0x1c')]=qs['limit'](_0x2d90c8['query']['limit']);_0x1194ca[_0xcd38('0x36')]=qs['offset'](_0x2d90c8[_0xcd38('0x2f')][_0xcd38('0x36')]);}_0x1194ca[_0xcd38('0x37')]=qs['sort'](_0x2d90c8['query']['sort']);_0x1194ca[_0xcd38('0x38')]=qs[_0xcd38('0x30')](_[_0xcd38('0x39')](_0x2d90c8['query'],_0x843fa5[_0xcd38('0x30')]),_0x1d9eb6);if(_0x2d90c8[_0xcd38('0x2f')][_0xcd38('0x3a')]){_0x1194ca[_0xcd38('0x38')]=_[_0xcd38('0x3b')](_0x1194ca[_0xcd38('0x38')],{'$or':_[_0xcd38('0x2d')](_0x1d9eb6,function(_0x2af529){if(_0x2af529[_0xcd38('0x3c')]!=='VIRTUAL'){var _0x220b35={};_0x220b35[_0x2af529['name']]={'$like':'%'+_0x2d90c8[_0xcd38('0x2f')]['filter']+'%'};return _0x220b35;}})});}_0x1194ca=_[_0xcd38('0x3b')]({},_0x1194ca,_0x2d90c8[_0xcd38('0x3d')]);var _0x1f66ec={'where':_0x1194ca[_0xcd38('0x38')]};return db[_0xcd38('0x28')]['count'](_0x1f66ec)['then'](function(_0x4464bb){_0x356b81[_0xcd38('0x1d')]=_0x4464bb;if(_0x2d90c8['query'][_0xcd38('0x3e')]){_0x1194ca[_0xcd38('0x3f')]=[{'all':!![]}];}return db[_0xcd38('0x28')][_0xcd38('0x40')](_0x1194ca);})[_0xcd38('0x21')](function(_0x160681){_0x356b81['rows']=_0x160681;return _0x356b81;})[_0xcd38('0x21')](respondWithFilteredResult(_0x4c6dcb,_0x1194ca))[_0xcd38('0x41')](handleError(_0x4c6dcb,null));};exports[_0xcd38('0x42')]=function(_0x68bf8b,_0x56210e){var _0x399834={'raw':!![],'where':{'id':_0x68bf8b[_0xcd38('0x43')]['id']}},_0x59a383={};_0x59a383['model']=_['keys'](db[_0xcd38('0x28')]['rawAttributes']);_0x59a383['query']=_[_0xcd38('0x2e')](_0x68bf8b[_0xcd38('0x2f')]);_0x59a383['filters']=_[_0xcd38('0x31')](_0x59a383[_0xcd38('0x2c')],_0x59a383[_0xcd38('0x2f')]);_0x399834[_0xcd38('0x33')]=_[_0xcd38('0x31')](_0x59a383[_0xcd38('0x2c')],qs['fields'](_0x68bf8b[_0xcd38('0x2f')]['fields']));_0x399834['attributes']=_0x399834['attributes'][_0xcd38('0x34')]?_0x399834[_0xcd38('0x33')]:_0x59a383[_0xcd38('0x2c')];if(_0x68bf8b[_0xcd38('0x2f')][_0xcd38('0x3e')]){_0x399834[_0xcd38('0x3f')]=[{'all':!![]}];}_0x399834=_[_0xcd38('0x3b')]({},_0x399834,_0x68bf8b[_0xcd38('0x3d')]);return db[_0xcd38('0x28')]['find'](_0x399834)['then'](handleEntityNotFound(_0x56210e,null))[_0xcd38('0x21')](respondWithResult(_0x56210e,null))[_0xcd38('0x41')](handleError(_0x56210e,null));};exports[_0xcd38('0x44')]=function(_0x1014dc,_0x40c753){return db[_0xcd38('0x28')]['create'](_0x1014dc[_0xcd38('0x45')],{})[_0xcd38('0x21')](respondWithResult(_0x40c753,0xc9))[_0xcd38('0x41')](handleError(_0x40c753,null));};exports[_0xcd38('0x46')]=function(_0x4c15b6,_0x51903a){if(_0x4c15b6[_0xcd38('0x45')]['id']){delete _0x4c15b6[_0xcd38('0x45')]['id'];}return db['AnalyticTreeReport']['find']({'where':{'id':_0x4c15b6[_0xcd38('0x43')]['id']}})[_0xcd38('0x21')](handleEntityNotFound(_0x51903a,null))['then'](saveUpdates(_0x4c15b6['body'],null))['then'](respondWithResult(_0x51903a,null))[_0xcd38('0x41')](handleError(_0x51903a,null));};exports[_0xcd38('0x22')]=function(_0x57c67d,_0x36cebd){return db[_0xcd38('0x28')][_0xcd38('0x47')]({'where':{'id':_0x57c67d['params']['id']}})[_0xcd38('0x21')](handleEntityNotFound(_0x36cebd,null))[_0xcd38('0x21')](removeEntity(_0x36cebd,null))[_0xcd38('0x41')](handleError(_0x36cebd,null));}; \ No newline at end of file diff --git a/server/api/analyticTreeReport/analyticTreeReport.model.js b/server/api/analyticTreeReport/analyticTreeReport.model.js index 6cfccfc..ca85ec2 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 _0x236c=['./analyticTreeReport.attributes','exports','AnalyticTreeReport','lodash','util','../../config/logger','api','moment','bluebird','path','rimraf','../../config/environment'];(function(_0x5b83ea,_0x211cac){var _0x873ae3=function(_0xcb2149){while(--_0xcb2149){_0x5b83ea['push'](_0x5b83ea['shift']());}};_0x873ae3(++_0x211cac);}(_0x236c,0xab));var _0xc236=function(_0x88266c,_0x1151ec){_0x88266c=_0x88266c-0x0;var _0xa76dc1=_0x236c[_0x88266c];return _0xa76dc1;};'use strict';var _=require(_0xc236('0x0'));var util=require(_0xc236('0x1'));var logger=require(_0xc236('0x2'))(_0xc236('0x3'));var moment=require(_0xc236('0x4'));var BPromise=require(_0xc236('0x5'));var rp=require('request-promise');var fs=require('fs');var path=require(_0xc236('0x6'));var rimraf=require(_0xc236('0x7'));var config=require(_0xc236('0x8'));var attributes=require(_0xc236('0x9'));module[_0xc236('0xa')]=function(_0x32d8b,_0x4cfee5){return _0x32d8b['define'](_0xc236('0xb'),attributes,{'tableName':'analytics_report_trees','paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0xff0b=['../../config/environment','exports','define','AnalyticTreeReport','analytics_report_trees','lodash','util','../../config/logger','api','moment','bluebird','request-promise','path','rimraf'];(function(_0x138adb,_0x193fee){var _0x1b27f2=function(_0x5e97a2){while(--_0x5e97a2){_0x138adb['push'](_0x138adb['shift']());}};_0x1b27f2(++_0x193fee);}(_0xff0b,0xf3));var _0xbff0=function(_0xd85b9f,_0x2f4608){_0xd85b9f=_0xd85b9f-0x0;var _0x7ff304=_0xff0b[_0xd85b9f];return _0x7ff304;};'use strict';var _=require(_0xbff0('0x0'));var util=require(_0xbff0('0x1'));var logger=require(_0xbff0('0x2'))(_0xbff0('0x3'));var moment=require(_0xbff0('0x4'));var BPromise=require(_0xbff0('0x5'));var rp=require(_0xbff0('0x6'));var fs=require('fs');var path=require(_0xbff0('0x7'));var rimraf=require(_0xbff0('0x8'));var config=require(_0xbff0('0x9'));var attributes=require('./analyticTreeReport.attributes');module[_0xbff0('0xa')]=function(_0x34cdf0,_0x1086b1){return _0x34cdf0[_0xbff0('0xb')](_0xbff0('0xc'),attributes,{'tableName':_0xbff0('0xd'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/analyticTreeReport/analyticTreeReport.rpc.js b/server/api/analyticTreeReport/analyticTreeReport.rpc.js index 2aee35c..4929501 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 _0x5f2f=['lodash','util','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/environment','jayson/promise','client','http','request','info','AnalyticTreeReport,\x20%s,\x20%s','debug','stringify','error','code','message','request\x20sent','result','catch'];(function(_0x478161,_0x1e966d){var _0x29d7a8=function(_0xadc52f){while(--_0xadc52f){_0x478161['push'](_0x478161['shift']());}};_0x29d7a8(++_0x1e966d);}(_0x5f2f,0x73));var _0xf5f2=function(_0x30af07,_0x498015){_0x30af07=_0x30af07-0x0;var _0x490ab6=_0x5f2f[_0x30af07];return _0x490ab6;};'use strict';var _=require(_0xf5f2('0x0'));var util=require(_0xf5f2('0x1'));var moment=require(_0xf5f2('0x2'));var BPromise=require(_0xf5f2('0x3'));var rs=require(_0xf5f2('0x4'));var fs=require('fs');var Redis=require(_0xf5f2('0x5'));var db=require(_0xf5f2('0x6'))['db'];var utils=require(_0xf5f2('0x7'));var logger=require('../../config/logger')('rpc');var config=require(_0xf5f2('0x8'));var jayson=require(_0xf5f2('0x9'));var client=jayson[_0xf5f2('0xa')][_0xf5f2('0xb')]({'port':0x232a});function respondWithRpcPromise(_0x3133bc,_0x473100,_0x5907aa){return new BPromise(function(_0x466882,_0x46cd9c){return client[_0xf5f2('0xc')](_0x3133bc,_0x5907aa)['then'](function(_0x375da4){logger[_0xf5f2('0xd')](_0xf5f2('0xe'),_0x473100,'request\x20sent');logger[_0xf5f2('0xf')]('AnalyticTreeReport,\x20%s,\x20%s,\x20%s',_0x473100,'request\x20sent',JSON[_0xf5f2('0x10')](_0x375da4));if(_0x375da4[_0xf5f2('0x11')]){if(_0x375da4['error'][_0xf5f2('0x12')]===0x1f4){logger[_0xf5f2('0x11')](_0xf5f2('0xe'),_0x473100,_0x375da4[_0xf5f2('0x11')][_0xf5f2('0x13')]);return _0x46cd9c(_0x375da4[_0xf5f2('0x11')]['message']);}logger[_0xf5f2('0x11')](_0xf5f2('0xe'),_0x473100,_0x375da4[_0xf5f2('0x11')][_0xf5f2('0x13')]);return _0x466882(_0x375da4[_0xf5f2('0x11')]['message']);}else{logger[_0xf5f2('0xd')](_0xf5f2('0xe'),_0x473100,_0xf5f2('0x14'));_0x466882(_0x375da4[_0xf5f2('0x15')][_0xf5f2('0x13')]);}})[_0xf5f2('0x16')](function(_0xdb61b3){logger[_0xf5f2('0x11')](_0xf5f2('0xe'),_0x473100,_0xdb61b3);_0x46cd9c(_0xdb61b3);});});} \ No newline at end of file +var _0xadb5=['error','code','message','result','catch','util','bluebird','randomstring','ioredis','../../config/utils','../../config/logger','rpc','jayson/promise','client','http','request','then','info','AnalyticTreeReport,\x20%s,\x20%s','request\x20sent','stringify'];(function(_0x5e1fb6,_0xf3495b){var _0x2cf20e=function(_0x4e51b4){while(--_0x4e51b4){_0x5e1fb6['push'](_0x5e1fb6['shift']());}};_0x2cf20e(++_0xf3495b);}(_0xadb5,0xad));var _0x5adb=function(_0x34042c,_0x1b51af){_0x34042c=_0x34042c-0x0;var _0x47cbdb=_0xadb5[_0x34042c];return _0x47cbdb;};'use strict';var _=require('lodash');var util=require(_0x5adb('0x0'));var moment=require('moment');var BPromise=require(_0x5adb('0x1'));var rs=require(_0x5adb('0x2'));var fs=require('fs');var Redis=require(_0x5adb('0x3'));var db=require('../../mysqldb')['db'];var utils=require(_0x5adb('0x4'));var logger=require(_0x5adb('0x5'))(_0x5adb('0x6'));var config=require('../../config/environment');var jayson=require(_0x5adb('0x7'));var client=jayson[_0x5adb('0x8')][_0x5adb('0x9')]({'port':0x232a});function respondWithRpcPromise(_0x3213e8,_0xdf3776,_0x353885){return new BPromise(function(_0x47228a,_0x6d1b45){return client[_0x5adb('0xa')](_0x3213e8,_0x353885)[_0x5adb('0xb')](function(_0x34f59d){logger[_0x5adb('0xc')](_0x5adb('0xd'),_0xdf3776,_0x5adb('0xe'));logger['debug']('AnalyticTreeReport,\x20%s,\x20%s,\x20%s',_0xdf3776,_0x5adb('0xe'),JSON[_0x5adb('0xf')](_0x34f59d));if(_0x34f59d[_0x5adb('0x10')]){if(_0x34f59d['error'][_0x5adb('0x11')]===0x1f4){logger['error'](_0x5adb('0xd'),_0xdf3776,_0x34f59d['error'][_0x5adb('0x12')]);return _0x6d1b45(_0x34f59d[_0x5adb('0x10')][_0x5adb('0x12')]);}logger['error'](_0x5adb('0xd'),_0xdf3776,_0x34f59d[_0x5adb('0x10')][_0x5adb('0x12')]);return _0x47228a(_0x34f59d['error'][_0x5adb('0x12')]);}else{logger['info'](_0x5adb('0xd'),_0xdf3776,_0x5adb('0xe'));_0x47228a(_0x34f59d[_0x5adb('0x13')][_0x5adb('0x12')]);}})[_0x5adb('0x14')](function(_0x39d24d){logger[_0x5adb('0x10')](_0x5adb('0xd'),_0xdf3776,_0x39d24d);_0x6d1b45(_0x39d24d);});});} \ No newline at end of file diff --git a/server/api/analyticTreeReport/index.js b/server/api/analyticTreeReport/index.js index 4184a30..2c05505 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 _0xb6c2=['exports','util','path','express','../../components/auth/service','../../components/interaction/service','../../config/environment','./analyticTreeReport.controller','isAuthenticated','index','get','show','post','/:id','delete','destroy'];(function(_0x2052ec,_0x585a3a){var _0x1826ad=function(_0x50a851){while(--_0x50a851){_0x2052ec['push'](_0x2052ec['shift']());}};_0x1826ad(++_0x585a3a);}(_0xb6c2,0x131));var _0x2b6c=function(_0x52fe58,_0x30c710){_0x52fe58=_0x52fe58-0x0;var _0x364e54=_0xb6c2[_0x52fe58];return _0x364e54;};'use strict';var multer=require('multer');var util=require(_0x2b6c('0x0'));var path=require(_0x2b6c('0x1'));var timeout=require('connect-timeout');var express=require(_0x2b6c('0x2'));var router=express['Router']();var fs_extra=require('fs-extra');var auth=require(_0x2b6c('0x3'));var interaction=require(_0x2b6c('0x4'));var config=require(_0x2b6c('0x5'));var controller=require(_0x2b6c('0x6'));router['get']('/',auth[_0x2b6c('0x7')](),controller[_0x2b6c('0x8')]);router[_0x2b6c('0x9')]('/:id',auth['isAuthenticated'](),controller[_0x2b6c('0xa')]);router[_0x2b6c('0xb')]('/',auth['isAuthenticated'](),controller['create']);router['put'](_0x2b6c('0xc'),auth[_0x2b6c('0x7')](),controller['update']);router[_0x2b6c('0xd')]('/:id',auth['isAuthenticated'](),controller[_0x2b6c('0xe')]);module[_0x2b6c('0xf')]=router; \ No newline at end of file +var _0x6551=['destroy','exports','multer','util','path','connect-timeout','express','Router','../../components/auth/service','../../config/environment','./analyticTreeReport.controller','index','get','/:id','isAuthenticated','post','put','update','delete'];(function(_0x25756c,_0x3f52b3){var _0x3beedb=function(_0x10449a){while(--_0x10449a){_0x25756c['push'](_0x25756c['shift']());}};_0x3beedb(++_0x3f52b3);}(_0x6551,0xc0));var _0x1655=function(_0xaf014,_0x6f388b){_0xaf014=_0xaf014-0x0;var _0x390c4b=_0x6551[_0xaf014];return _0x390c4b;};'use strict';var multer=require(_0x1655('0x0'));var util=require(_0x1655('0x1'));var path=require(_0x1655('0x2'));var timeout=require(_0x1655('0x3'));var express=require(_0x1655('0x4'));var router=express[_0x1655('0x5')]();var fs_extra=require('fs-extra');var auth=require(_0x1655('0x6'));var interaction=require('../../components/interaction/service');var config=require(_0x1655('0x7'));var controller=require(_0x1655('0x8'));router['get']('/',auth['isAuthenticated'](),controller[_0x1655('0x9')]);router[_0x1655('0xa')](_0x1655('0xb'),auth[_0x1655('0xc')](),controller['show']);router[_0x1655('0xd')]('/',auth[_0x1655('0xc')](),controller['create']);router[_0x1655('0xe')](_0x1655('0xb'),auth[_0x1655('0xc')](),controller[_0x1655('0xf')]);router[_0x1655('0x10')](_0x1655('0xb'),auth[_0x1655('0xc')](),controller[_0x1655('0x11')]);module[_0x1655('0x12')]=router; \ No newline at end of file diff --git a/server/api/attachment/attachment.attributes.js b/server/api/attachment/attachment.attributes.js index 9493aaf..905aaa3 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 _0x1ae3=['STRING','sequelize','exports'];(function(_0x249871,_0x373354){var _0x2d1a08=function(_0x63a3b0){while(--_0x63a3b0){_0x249871['push'](_0x249871['shift']());}};_0x2d1a08(++_0x373354);}(_0x1ae3,0x139));var _0x31ae=function(_0x2d939d,_0x26707a){_0x2d939d=_0x2d939d-0x0;var _0x149362=_0x1ae3[_0x2d939d];return _0x149362;};'use strict';var Sequelize=require(_0x31ae('0x0'));module[_0x31ae('0x1')]={'name':{'type':Sequelize['STRING']},'basename':{'type':Sequelize[_0x31ae('0x2')]},'type':{'type':Sequelize[_0x31ae('0x2')]}}; \ No newline at end of file +var _0x5c12=['exports','STRING'];(function(_0x396778,_0x55e369){var _0x1f36a4=function(_0x1bc28d){while(--_0x1bc28d){_0x396778['push'](_0x396778['shift']());}};_0x1f36a4(++_0x55e369);}(_0x5c12,0x188));var _0x25c1=function(_0x22b8a3,_0x2a79a7){_0x22b8a3=_0x22b8a3-0x0;var _0x199a0c=_0x5c12[_0x22b8a3];return _0x199a0c;};'use strict';var Sequelize=require('sequelize');module[_0x25c1('0x0')]={'name':{'type':Sequelize[_0x25c1('0x1')]},'basename':{'type':Sequelize['STRING']},'type':{'type':Sequelize[_0x25c1('0x1')]}}; \ No newline at end of file diff --git a/server/api/attachment/attachment.controller.js b/server/api/attachment/attachment.controller.js index a46a2fd..d2a8337 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 _0x7697=['querystring','papaparse','../../components/auth/service','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/environment','../../config/license/util','status','end','json','limit','undefined','offset','count','set','Content-Range','reject','save','update','then','destroy','sendStatus','error','name','send','index','map','fieldName','type','key','model','query','intersection','fields','attributes','hasOwnProperty','nolimit','order','sort','where','filters','merge','VIRTUAL','filter','options','includeAll','include','Attachment','findAll','catch','show','keys','rawAttributes','length','clone','params','find','omit','updatedAt','body','create','file','basename','mimetype','download','findOne','join','root','server/files/attachments/','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','moment','bluebird','mustache','util','path','sox','to-csv','ejs','fs-extra','squel','crypto','jsforce','desk.js'];(function(_0x4fadb8,_0x11b539){var _0x3c9e20=function(_0x134c11){while(--_0x134c11){_0x4fadb8['push'](_0x4fadb8['shift']());}};_0x3c9e20(++_0x11b539);}(_0x7697,0x1ab));var _0x7769=function(_0x4f08dd,_0x3784ec){_0x4f08dd=_0x4f08dd-0x0;var _0x3017ee=_0x7697[_0x4f08dd];return _0x3017ee;};'use strict';var emlformat=require(_0x7769('0x0'));var rimraf=require(_0x7769('0x1'));var zipdir=require(_0x7769('0x2'));var jsonpatch=require(_0x7769('0x3'));var rp=require(_0x7769('0x4'));var moment=require(_0x7769('0x5'));var BPromise=require(_0x7769('0x6'));var Mustache=require(_0x7769('0x7'));var util=require(_0x7769('0x8'));var path=require(_0x7769('0x9'));var sox=require(_0x7769('0xa'));var csv=require(_0x7769('0xb'));var ejs=require(_0x7769('0xc'));var fs=require('fs');var fs_extra=require(_0x7769('0xd'));var _=require('lodash');var squel=require(_0x7769('0xe'));var crypto=require(_0x7769('0xf'));var jsforce=require(_0x7769('0x10'));var deskjs=require(_0x7769('0x11'));var toCsv=require('to-csv');var querystring=require(_0x7769('0x12'));var Papa=require(_0x7769('0x13'));var Redis=require('ioredis');var authService=require(_0x7769('0x14'));var qs=require('../../components/parsers/qs');var as=require(_0x7769('0x15'));var hardwareService=require(_0x7769('0x16'));var logger=require(_0x7769('0x17'))(_0x7769('0x18'));var utils=require('../../config/utils');var config=require(_0x7769('0x19'));var licenseUtil=require(_0x7769('0x1a'));var db=require('../../mysqldb')['db'];function respondWithStatusCode(_0x116c8d,_0x76e823){_0x76e823=_0x76e823||0xcc;return function(_0x305c3d){if(_0x305c3d){return _0x116c8d['sendStatus'](_0x76e823);}return _0x116c8d[_0x7769('0x1b')](_0x76e823)[_0x7769('0x1c')]();};}function respondWithResult(_0x2595cb,_0x36c4dd){_0x36c4dd=_0x36c4dd||0xc8;return function(_0x96ad37){if(_0x96ad37){return _0x2595cb[_0x7769('0x1b')](_0x36c4dd)[_0x7769('0x1d')](_0x96ad37);}};}function respondWithFilteredResult(_0xc6667d,_0x31274f){return function(_0x49cd04){if(_0x49cd04){var _0x287c16=typeof _0x31274f['offset']==='undefined'&&typeof _0x31274f[_0x7769('0x1e')]===_0x7769('0x1f');var _0xb5d619=_0x49cd04['count'];var _0x1dcad3=_0x287c16?0x0:_0x31274f[_0x7769('0x20')];var _0x4daf63=_0x287c16?_0x49cd04[_0x7769('0x21')]:_0x31274f[_0x7769('0x20')]+_0x31274f['limit'];var _0x9ded4a;if(_0x4daf63>=_0xb5d619){_0x4daf63=_0xb5d619;_0x9ded4a=0xc8;}else{_0x9ded4a=0xce;}_0xc6667d[_0x7769('0x1b')](_0x9ded4a);return _0xc6667d[_0x7769('0x22')](_0x7769('0x23'),_0x1dcad3+'-'+_0x4daf63+'/'+_0xb5d619)[_0x7769('0x1d')](_0x49cd04);}return null;};}function patchUpdates(_0x3b5123){return function(_0x28398b){try{jsonpatch['apply'](_0x28398b,_0x3b5123,!![]);}catch(_0x15e03b){return BPromise[_0x7769('0x24')](_0x15e03b);}return _0x28398b[_0x7769('0x25')]();};}function saveUpdates(_0x29c5b0,_0x54536b){return function(_0x5f35ac){if(_0x5f35ac){return _0x5f35ac[_0x7769('0x26')](_0x29c5b0)[_0x7769('0x27')](function(_0x340194){return _0x340194;});}return null;};}function removeEntity(_0x50c59a,_0x31ea48){return function(_0x343df0){if(_0x343df0){return _0x343df0[_0x7769('0x28')]()[_0x7769('0x27')](function(){_0x50c59a[_0x7769('0x1b')](0xcc)[_0x7769('0x1c')]();});}};}function handleEntityNotFound(_0x2b8718,_0x13b465){return function(_0xc20c04){if(!_0xc20c04){_0x2b8718[_0x7769('0x29')](0x194);}return _0xc20c04;};}function handleError(_0x18d475,_0x4e5ba3){_0x4e5ba3=_0x4e5ba3||0x1f4;return function(_0x2edde4){logger[_0x7769('0x2a')](_0x2edde4['stack']);if(_0x2edde4['name']){delete _0x2edde4[_0x7769('0x2b')];}_0x18d475[_0x7769('0x1b')](_0x4e5ba3)[_0x7769('0x2c')](_0x2edde4);};}exports[_0x7769('0x2d')]=function(_0x1c7dc2,_0x2f4189){var _0x3715b2={},_0x1483eb={},_0xa21fa0={'count':0x0,'rows':[]};var _0x4093ae=_[_0x7769('0x2e')](db['Attachment']['rawAttributes'],function(_0x1296c5){return{'name':_0x1296c5[_0x7769('0x2f')],'type':_0x1296c5[_0x7769('0x30')][_0x7769('0x31')]};});_0x1483eb[_0x7769('0x32')]=_[_0x7769('0x2e')](_0x4093ae,'name');_0x1483eb[_0x7769('0x33')]=_['keys'](_0x1c7dc2['query']);_0x1483eb['filters']=_[_0x7769('0x34')](_0x1483eb[_0x7769('0x32')],_0x1483eb[_0x7769('0x33')]);_0x3715b2['attributes']=_[_0x7769('0x34')](_0x1483eb[_0x7769('0x32')],qs[_0x7769('0x35')](_0x1c7dc2[_0x7769('0x33')][_0x7769('0x35')]));_0x3715b2[_0x7769('0x36')]=_0x3715b2['attributes']['length']?_0x3715b2[_0x7769('0x36')]:_0x1483eb['model'];if(!_0x1c7dc2[_0x7769('0x33')][_0x7769('0x37')](_0x7769('0x38'))){_0x3715b2['limit']=qs[_0x7769('0x1e')](_0x1c7dc2[_0x7769('0x33')][_0x7769('0x1e')]);_0x3715b2[_0x7769('0x20')]=qs[_0x7769('0x20')](_0x1c7dc2['query'][_0x7769('0x20')]);}_0x3715b2[_0x7769('0x39')]=qs[_0x7769('0x3a')](_0x1c7dc2[_0x7769('0x33')][_0x7769('0x3a')]);_0x3715b2[_0x7769('0x3b')]=qs['filters'](_['pick'](_0x1c7dc2[_0x7769('0x33')],_0x1483eb[_0x7769('0x3c')]),_0x4093ae);if(_0x1c7dc2['query']['filter']){_0x3715b2[_0x7769('0x3b')]=_[_0x7769('0x3d')](_0x3715b2[_0x7769('0x3b')],{'$or':_[_0x7769('0x2e')](_0x4093ae,function(_0x20c7a1){if(_0x20c7a1[_0x7769('0x30')]!==_0x7769('0x3e')){var _0x4c31ec={};_0x4c31ec[_0x20c7a1['name']]={'$like':'%'+_0x1c7dc2[_0x7769('0x33')][_0x7769('0x3f')]+'%'};return _0x4c31ec;}})});}_0x3715b2=_[_0x7769('0x3d')]({},_0x3715b2,_0x1c7dc2[_0x7769('0x40')]);var _0x2303c6={'where':_0x3715b2[_0x7769('0x3b')]};return db['Attachment'][_0x7769('0x21')](_0x2303c6)[_0x7769('0x27')](function(_0x22268a){_0xa21fa0[_0x7769('0x21')]=_0x22268a;if(_0x1c7dc2[_0x7769('0x33')][_0x7769('0x41')]){_0x3715b2[_0x7769('0x42')]=[{'all':!![]}];}return db[_0x7769('0x43')][_0x7769('0x44')](_0x3715b2);})[_0x7769('0x27')](function(_0x29faa2){_0xa21fa0['rows']=_0x29faa2;return _0xa21fa0;})['then'](respondWithFilteredResult(_0x2f4189,_0x3715b2))[_0x7769('0x45')](handleError(_0x2f4189,null));};exports[_0x7769('0x46')]=function(_0x11df7d,_0x4c4699){var _0x504cd2={'raw':!![],'where':{'id':_0x11df7d['params']['id']}},_0x55d4b6={};_0x55d4b6[_0x7769('0x32')]=_[_0x7769('0x47')](db[_0x7769('0x43')][_0x7769('0x48')]);_0x55d4b6[_0x7769('0x33')]=_[_0x7769('0x47')](_0x11df7d[_0x7769('0x33')]);_0x55d4b6['filters']=_[_0x7769('0x34')](_0x55d4b6[_0x7769('0x32')],_0x55d4b6[_0x7769('0x33')]);_0x504cd2[_0x7769('0x36')]=_[_0x7769('0x34')](_0x55d4b6[_0x7769('0x32')],qs[_0x7769('0x35')](_0x11df7d[_0x7769('0x33')]['fields']));_0x504cd2[_0x7769('0x36')]=_0x504cd2[_0x7769('0x36')][_0x7769('0x49')]?_0x504cd2[_0x7769('0x36')]:_0x55d4b6[_0x7769('0x32')];if(_0x11df7d[_0x7769('0x33')][_0x7769('0x41')]){_0x504cd2[_0x7769('0x42')]=[{'all':!![]}];}_0x504cd2=_[_0x7769('0x3d')]({},_0x504cd2,_0x11df7d[_0x7769('0x40')]);return db[_0x7769('0x43')]['find'](_0x504cd2)[_0x7769('0x27')](handleEntityNotFound(_0x4c4699,null))[_0x7769('0x27')](respondWithResult(_0x4c4699,null))[_0x7769('0x45')](handleError(_0x4c4699,null));};exports[_0x7769('0x4a')]=function(_0x1e8210,_0x5286ea){var _0x3cffc7={'where':{'id':_0x1e8210[_0x7769('0x4b')]['id']}},_0x2ee677={};_0x2ee677[_0x7769('0x32')]=_[_0x7769('0x47')](db[_0x7769('0x43')]['rawAttributes']);_0x3cffc7[_0x7769('0x36')]=_['intersection'](_0x2ee677[_0x7769('0x32')],qs[_0x7769('0x35')](_0x1e8210['query'][_0x7769('0x35')]));_0x3cffc7['attributes']=_0x3cffc7[_0x7769('0x36')][_0x7769('0x49')]?_0x3cffc7[_0x7769('0x36')]:_0x2ee677[_0x7769('0x32')];if(_0x1e8210[_0x7769('0x33')][_0x7769('0x41')]){_0x3cffc7['include']=[{'all':!![]}];}_0x3cffc7=_['merge']({},_0x3cffc7,_0x1e8210[_0x7769('0x40')]);return db['Attachment'][_0x7769('0x4c')](_0x3cffc7)[_0x7769('0x27')](handleEntityNotFound(_0x5286ea,null))[_0x7769('0x27')](function(_0x480dd1){if(_0x480dd1){var _0x473db2=_0x480dd1['get']({'plain':!![]});_0x473db2=qs[_0x7769('0x4d')](_0x473db2,['id','createdAt',_0x7769('0x4e')]);_0x1e8210[_0x7769('0x4f')]=_['omit'](_0x1e8210[_0x7769('0x4f')],['id','createdAt',_0x7769('0x4e')]);return db[_0x7769('0x43')][_0x7769('0x50')](_['merge'](_0x473db2,_0x1e8210[_0x7769('0x4f')]),{'include':_0x1e8210[_0x7769('0x33')][_0x7769('0x41')]?[{'all':!![]}]:undefined});}})[_0x7769('0x27')](respondWithResult(_0x5286ea,0xc9))[_0x7769('0x45')](handleError(_0x5286ea,null));};exports[_0x7769('0x26')]=function(_0x6237b,_0x3af186){if(_0x6237b[_0x7769('0x4f')]['id']){delete _0x6237b[_0x7769('0x4f')]['id'];}return db[_0x7769('0x43')][_0x7769('0x4c')]({'where':{'id':_0x6237b[_0x7769('0x4b')]['id']}})['then'](handleEntityNotFound(_0x3af186,null))[_0x7769('0x27')](saveUpdates(_0x6237b['body'],null))[_0x7769('0x27')](respondWithResult(_0x3af186,null))[_0x7769('0x45')](handleError(_0x3af186,null));};exports[_0x7769('0x28')]=function(_0xca1d05,_0x1fc5d2){return db['Attachment'][_0x7769('0x4c')]({'where':{'id':_0xca1d05[_0x7769('0x4b')]['id']}})[_0x7769('0x27')](handleEntityNotFound(_0x1fc5d2,null))[_0x7769('0x27')](removeEntity(_0x1fc5d2,null))['catch'](handleError(_0x1fc5d2,null));};exports[_0x7769('0x50')]=function(_0x57e613,_0x514b4a,_0x55135e){_0x57e613[_0x7769('0x4f')][_0x7769('0x2b')]=_0x57e613[_0x7769('0x51')]['originalname'];_0x57e613[_0x7769('0x4f')][_0x7769('0x52')]=_0x57e613[_0x7769('0x51')]['filename'];_0x57e613[_0x7769('0x4f')][_0x7769('0x30')]=_0x57e613[_0x7769('0x51')][_0x7769('0x53')];return db[_0x7769('0x43')][_0x7769('0x50')](_0x57e613['body'])[_0x7769('0x27')](respondWithResult(_0x514b4a,0xc9))[_0x7769('0x45')](handleError(_0x514b4a,null));};exports[_0x7769('0x54')]=function(_0x258640,_0x2b29c8,_0xec555e){return db[_0x7769('0x43')][_0x7769('0x55')]({'where':{'id':_0x258640[_0x7769('0x4b')]['id']},'raw':!![]})['then'](handleEntityNotFound(_0x2b29c8,null))[_0x7769('0x27')](function(_0x373b2e){if(_0x373b2e){var _0x3eba85=_0x373b2e['ChatOfflineMessageId']!==null;var _0x39c5f2=path[_0x7769('0x56')](config[_0x7769('0x57')],_0x7769('0x58'));if(_0x3eba85){_0x39c5f2=path[_0x7769('0x56')](_0x39c5f2,'offline-chat/');}var _0x16ad3a=path[_0x7769('0x56')](_0x39c5f2,_0x373b2e[_0x7769('0x52')]);return _0x2b29c8[_0x7769('0x54')](_0x16ad3a);}})[_0x7769('0x45')](handleError(_0x2b29c8,null));}; \ No newline at end of file +var _0xcadc=['attributes','fields','length','hasOwnProperty','order','where','pick','merge','VIRTUAL','filter','options','then','includeAll','include','rows','show','params','catch','clone','intersection','find','omit','updatedAt','body','createdAt','create','destroy','file','originalname','basename','filename','mimetype','download','ChatOfflineMessageId','join','root','offline-chat/','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','moment','bluebird','mustache','util','path','sox','to-csv','lodash','crypto','jsforce','desk.js','querystring','papaparse','ioredis','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','end','status','json','offset','limit','count','set','apply','save','update','sendStatus','name','index','map','Attachment','rawAttributes','fieldName','type','key','model','query','keys','filters'];(function(_0x506fa5,_0x149cd0){var _0x51c819=function(_0x1b42c8){while(--_0x1b42c8){_0x506fa5['push'](_0x506fa5['shift']());}};_0x51c819(++_0x149cd0);}(_0xcadc,0x12d));var _0xccad=function(_0x4a9fb1,_0x273043){_0x4a9fb1=_0x4a9fb1-0x0;var _0x348672=_0xcadc[_0x4a9fb1];return _0x348672;};'use strict';var emlformat=require(_0xccad('0x0'));var rimraf=require(_0xccad('0x1'));var zipdir=require(_0xccad('0x2'));var jsonpatch=require(_0xccad('0x3'));var rp=require(_0xccad('0x4'));var moment=require(_0xccad('0x5'));var BPromise=require(_0xccad('0x6'));var Mustache=require(_0xccad('0x7'));var util=require(_0xccad('0x8'));var path=require(_0xccad('0x9'));var sox=require(_0xccad('0xa'));var csv=require(_0xccad('0xb'));var ejs=require('ejs');var fs=require('fs');var fs_extra=require('fs-extra');var _=require(_0xccad('0xc'));var squel=require('squel');var crypto=require(_0xccad('0xd'));var jsforce=require(_0xccad('0xe'));var deskjs=require(_0xccad('0xf'));var toCsv=require('to-csv');var querystring=require(_0xccad('0x10'));var Papa=require(_0xccad('0x11'));var Redis=require(_0xccad('0x12'));var authService=require('../../components/auth/service');var qs=require(_0xccad('0x13'));var as=require(_0xccad('0x14'));var hardwareService=require(_0xccad('0x15'));var logger=require(_0xccad('0x16'))(_0xccad('0x17'));var utils=require(_0xccad('0x18'));var config=require(_0xccad('0x19'));var licenseUtil=require(_0xccad('0x1a'));var db=require(_0xccad('0x1b'))['db'];function respondWithStatusCode(_0x164588,_0x17cda6){_0x17cda6=_0x17cda6||0xcc;return function(_0x498686){if(_0x498686){return _0x164588['sendStatus'](_0x17cda6);}return _0x164588['status'](_0x17cda6)[_0xccad('0x1c')]();};}function respondWithResult(_0x1071a3,_0x28b3f9){_0x28b3f9=_0x28b3f9||0xc8;return function(_0x1a3dd6){if(_0x1a3dd6){return _0x1071a3[_0xccad('0x1d')](_0x28b3f9)[_0xccad('0x1e')](_0x1a3dd6);}};}function respondWithFilteredResult(_0x3ad9c4,_0x3ddad2){return function(_0x17b11e){if(_0x17b11e){var _0x471c27=typeof _0x3ddad2[_0xccad('0x1f')]==='undefined'&&typeof _0x3ddad2[_0xccad('0x20')]==='undefined';var _0x294efe=_0x17b11e[_0xccad('0x21')];var _0x44eb5b=_0x471c27?0x0:_0x3ddad2['offset'];var _0x34e38e=_0x471c27?_0x17b11e[_0xccad('0x21')]:_0x3ddad2[_0xccad('0x1f')]+_0x3ddad2['limit'];var _0x2a7bf7;if(_0x34e38e>=_0x294efe){_0x34e38e=_0x294efe;_0x2a7bf7=0xc8;}else{_0x2a7bf7=0xce;}_0x3ad9c4[_0xccad('0x1d')](_0x2a7bf7);return _0x3ad9c4[_0xccad('0x22')]('Content-Range',_0x44eb5b+'-'+_0x34e38e+'/'+_0x294efe)[_0xccad('0x1e')](_0x17b11e);}return null;};}function patchUpdates(_0x58a5ee){return function(_0x5b5718){try{jsonpatch[_0xccad('0x23')](_0x5b5718,_0x58a5ee,!![]);}catch(_0x406031){return BPromise['reject'](_0x406031);}return _0x5b5718[_0xccad('0x24')]();};}function saveUpdates(_0x289aa3,_0x2fef35){return function(_0x22f1c9){if(_0x22f1c9){return _0x22f1c9[_0xccad('0x25')](_0x289aa3)['then'](function(_0x24dc1e){return _0x24dc1e;});}return null;};}function removeEntity(_0x77934d,_0x4e3952){return function(_0x2cbd93){if(_0x2cbd93){return _0x2cbd93['destroy']()['then'](function(){_0x77934d[_0xccad('0x1d')](0xcc)[_0xccad('0x1c')]();});}};}function handleEntityNotFound(_0x25d02f,_0x2c24d3){return function(_0x3c22ab){if(!_0x3c22ab){_0x25d02f[_0xccad('0x26')](0x194);}return _0x3c22ab;};}function handleError(_0x446f3c,_0x1c59e3){_0x1c59e3=_0x1c59e3||0x1f4;return function(_0x32f8ac){logger['error'](_0x32f8ac['stack']);if(_0x32f8ac['name']){delete _0x32f8ac[_0xccad('0x27')];}_0x446f3c['status'](_0x1c59e3)['send'](_0x32f8ac);};}exports[_0xccad('0x28')]=function(_0x4b81a5,_0x2f81ef){var _0x2324b3={},_0x3c83f2={},_0x320531={'count':0x0,'rows':[]};var _0x5a653d=_[_0xccad('0x29')](db[_0xccad('0x2a')][_0xccad('0x2b')],function(_0x1f5a0b){return{'name':_0x1f5a0b[_0xccad('0x2c')],'type':_0x1f5a0b[_0xccad('0x2d')][_0xccad('0x2e')]};});_0x3c83f2[_0xccad('0x2f')]=_[_0xccad('0x29')](_0x5a653d,_0xccad('0x27'));_0x3c83f2[_0xccad('0x30')]=_[_0xccad('0x31')](_0x4b81a5['query']);_0x3c83f2[_0xccad('0x32')]=_['intersection'](_0x3c83f2[_0xccad('0x2f')],_0x3c83f2[_0xccad('0x30')]);_0x2324b3[_0xccad('0x33')]=_['intersection'](_0x3c83f2['model'],qs[_0xccad('0x34')](_0x4b81a5[_0xccad('0x30')]['fields']));_0x2324b3[_0xccad('0x33')]=_0x2324b3[_0xccad('0x33')][_0xccad('0x35')]?_0x2324b3[_0xccad('0x33')]:_0x3c83f2['model'];if(!_0x4b81a5[_0xccad('0x30')][_0xccad('0x36')]('nolimit')){_0x2324b3[_0xccad('0x20')]=qs[_0xccad('0x20')](_0x4b81a5['query']['limit']);_0x2324b3[_0xccad('0x1f')]=qs[_0xccad('0x1f')](_0x4b81a5[_0xccad('0x30')][_0xccad('0x1f')]);}_0x2324b3[_0xccad('0x37')]=qs['sort'](_0x4b81a5[_0xccad('0x30')]['sort']);_0x2324b3[_0xccad('0x38')]=qs[_0xccad('0x32')](_[_0xccad('0x39')](_0x4b81a5[_0xccad('0x30')],_0x3c83f2[_0xccad('0x32')]),_0x5a653d);if(_0x4b81a5[_0xccad('0x30')]['filter']){_0x2324b3['where']=_[_0xccad('0x3a')](_0x2324b3[_0xccad('0x38')],{'$or':_[_0xccad('0x29')](_0x5a653d,function(_0x318441){if(_0x318441['type']!==_0xccad('0x3b')){var _0x36f05a={};_0x36f05a[_0x318441[_0xccad('0x27')]]={'$like':'%'+_0x4b81a5[_0xccad('0x30')][_0xccad('0x3c')]+'%'};return _0x36f05a;}})});}_0x2324b3=_['merge']({},_0x2324b3,_0x4b81a5[_0xccad('0x3d')]);var _0x384220={'where':_0x2324b3[_0xccad('0x38')]};return db[_0xccad('0x2a')]['count'](_0x384220)[_0xccad('0x3e')](function(_0x549570){_0x320531[_0xccad('0x21')]=_0x549570;if(_0x4b81a5[_0xccad('0x30')][_0xccad('0x3f')]){_0x2324b3[_0xccad('0x40')]=[{'all':!![]}];}return db[_0xccad('0x2a')]['findAll'](_0x2324b3);})[_0xccad('0x3e')](function(_0x70cab){_0x320531[_0xccad('0x41')]=_0x70cab;return _0x320531;})[_0xccad('0x3e')](respondWithFilteredResult(_0x2f81ef,_0x2324b3))['catch'](handleError(_0x2f81ef,null));};exports[_0xccad('0x42')]=function(_0x47fd83,_0x5b464c){var _0x22ac72={'raw':!![],'where':{'id':_0x47fd83[_0xccad('0x43')]['id']}},_0x310b52={};_0x310b52[_0xccad('0x2f')]=_[_0xccad('0x31')](db[_0xccad('0x2a')][_0xccad('0x2b')]);_0x310b52[_0xccad('0x30')]=_[_0xccad('0x31')](_0x47fd83['query']);_0x310b52['filters']=_['intersection'](_0x310b52[_0xccad('0x2f')],_0x310b52[_0xccad('0x30')]);_0x22ac72[_0xccad('0x33')]=_['intersection'](_0x310b52[_0xccad('0x2f')],qs['fields'](_0x47fd83[_0xccad('0x30')][_0xccad('0x34')]));_0x22ac72[_0xccad('0x33')]=_0x22ac72[_0xccad('0x33')][_0xccad('0x35')]?_0x22ac72[_0xccad('0x33')]:_0x310b52[_0xccad('0x2f')];if(_0x47fd83[_0xccad('0x30')][_0xccad('0x3f')]){_0x22ac72[_0xccad('0x40')]=[{'all':!![]}];}_0x22ac72=_[_0xccad('0x3a')]({},_0x22ac72,_0x47fd83['options']);return db[_0xccad('0x2a')]['find'](_0x22ac72)[_0xccad('0x3e')](handleEntityNotFound(_0x5b464c,null))['then'](respondWithResult(_0x5b464c,null))[_0xccad('0x44')](handleError(_0x5b464c,null));};exports[_0xccad('0x45')]=function(_0x3c91d9,_0x29572e){var _0xaf0234={'where':{'id':_0x3c91d9[_0xccad('0x43')]['id']}},_0x5f9d38={};_0x5f9d38['model']=_['keys'](db[_0xccad('0x2a')][_0xccad('0x2b')]);_0xaf0234[_0xccad('0x33')]=_[_0xccad('0x46')](_0x5f9d38[_0xccad('0x2f')],qs[_0xccad('0x34')](_0x3c91d9[_0xccad('0x30')][_0xccad('0x34')]));_0xaf0234['attributes']=_0xaf0234['attributes'][_0xccad('0x35')]?_0xaf0234[_0xccad('0x33')]:_0x5f9d38[_0xccad('0x2f')];if(_0x3c91d9[_0xccad('0x30')]['includeAll']){_0xaf0234[_0xccad('0x40')]=[{'all':!![]}];}_0xaf0234=_[_0xccad('0x3a')]({},_0xaf0234,_0x3c91d9[_0xccad('0x3d')]);return db['Attachment'][_0xccad('0x47')](_0xaf0234)['then'](handleEntityNotFound(_0x29572e,null))[_0xccad('0x3e')](function(_0x3f1ee8){if(_0x3f1ee8){var _0x1a7f91=_0x3f1ee8['get']({'plain':!![]});_0x1a7f91=qs[_0xccad('0x48')](_0x1a7f91,['id','createdAt',_0xccad('0x49')]);_0x3c91d9[_0xccad('0x4a')]=_[_0xccad('0x48')](_0x3c91d9[_0xccad('0x4a')],['id',_0xccad('0x4b'),'updatedAt']);return db[_0xccad('0x2a')][_0xccad('0x4c')](_['merge'](_0x1a7f91,_0x3c91d9[_0xccad('0x4a')]),{'include':_0x3c91d9[_0xccad('0x30')]['includeAll']?[{'all':!![]}]:undefined});}})[_0xccad('0x3e')](respondWithResult(_0x29572e,0xc9))[_0xccad('0x44')](handleError(_0x29572e,null));};exports[_0xccad('0x25')]=function(_0x2d01a8,_0x3ccd1a){if(_0x2d01a8['body']['id']){delete _0x2d01a8[_0xccad('0x4a')]['id'];}return db[_0xccad('0x2a')][_0xccad('0x47')]({'where':{'id':_0x2d01a8[_0xccad('0x43')]['id']}})[_0xccad('0x3e')](handleEntityNotFound(_0x3ccd1a,null))['then'](saveUpdates(_0x2d01a8['body'],null))[_0xccad('0x3e')](respondWithResult(_0x3ccd1a,null))[_0xccad('0x44')](handleError(_0x3ccd1a,null));};exports[_0xccad('0x4d')]=function(_0x9f23c4,_0x263ba5){return db[_0xccad('0x2a')][_0xccad('0x47')]({'where':{'id':_0x9f23c4[_0xccad('0x43')]['id']}})[_0xccad('0x3e')](handleEntityNotFound(_0x263ba5,null))[_0xccad('0x3e')](removeEntity(_0x263ba5,null))['catch'](handleError(_0x263ba5,null));};exports[_0xccad('0x4c')]=function(_0x2296a8,_0x4f56f2,_0x82272e){_0x2296a8[_0xccad('0x4a')][_0xccad('0x27')]=_0x2296a8[_0xccad('0x4e')][_0xccad('0x4f')];_0x2296a8[_0xccad('0x4a')][_0xccad('0x50')]=_0x2296a8[_0xccad('0x4e')][_0xccad('0x51')];_0x2296a8['body'][_0xccad('0x2d')]=_0x2296a8[_0xccad('0x4e')][_0xccad('0x52')];return db[_0xccad('0x2a')][_0xccad('0x4c')](_0x2296a8['body'])[_0xccad('0x3e')](respondWithResult(_0x4f56f2,0xc9))[_0xccad('0x44')](handleError(_0x4f56f2,null));};exports[_0xccad('0x53')]=function(_0x4b2a0a,_0x1dcc81,_0x531432){return db[_0xccad('0x2a')]['findOne']({'where':{'id':_0x4b2a0a[_0xccad('0x43')]['id']},'raw':!![]})['then'](handleEntityNotFound(_0x1dcc81,null))[_0xccad('0x3e')](function(_0x4a89e2){if(_0x4a89e2){var _0xb1a276=_0x4a89e2[_0xccad('0x54')]!==null;var _0x2f9142=path[_0xccad('0x55')](config[_0xccad('0x56')],'server/files/attachments/');if(_0xb1a276){_0x2f9142=path[_0xccad('0x55')](_0x2f9142,_0xccad('0x57'));}var _0x38c447=path[_0xccad('0x55')](_0x2f9142,_0x4a89e2[_0xccad('0x50')]);return _0x1dcc81['download'](_0x38c447);}})['catch'](handleError(_0x1dcc81,null));}; \ No newline at end of file diff --git a/server/api/attachment/attachment.model.js b/server/api/attachment/attachment.model.js index 83cd4dc..1a7e069 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 _0xbe0e=['request-promise','path','rimraf','../../config/environment','./attachment.attributes','define','attachments','lodash','util','../../config/logger','api','moment','bluebird'];(function(_0x202c99,_0x121caf){var _0x256a0f=function(_0x3a55fa){while(--_0x3a55fa){_0x202c99['push'](_0x202c99['shift']());}};_0x256a0f(++_0x121caf);}(_0xbe0e,0x1e8));var _0xebe0=function(_0x78db5a,_0x31ad36){_0x78db5a=_0x78db5a-0x0;var _0x2e057a=_0xbe0e[_0x78db5a];return _0x2e057a;};'use strict';var _=require(_0xebe0('0x0'));var util=require(_0xebe0('0x1'));var logger=require(_0xebe0('0x2'))(_0xebe0('0x3'));var moment=require(_0xebe0('0x4'));var BPromise=require(_0xebe0('0x5'));var rp=require(_0xebe0('0x6'));var fs=require('fs');var path=require(_0xebe0('0x7'));var rimraf=require(_0xebe0('0x8'));var config=require(_0xebe0('0x9'));var attributes=require(_0xebe0('0xa'));module['exports']=function(_0x6b5adb,_0x7412c6){return _0x6b5adb[_0xebe0('0xb')]('Attachment',attributes,{'tableName':_0xebe0('0xc'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x94f7=['../../config/logger','api','moment','bluebird','request-promise','path','rimraf','../../config/environment','./attachment.attributes','exports','define','Attachment','attachments','lodash','util'];(function(_0x519af2,_0x1043e9){var _0x3743b8=function(_0x59ea21){while(--_0x59ea21){_0x519af2['push'](_0x519af2['shift']());}};_0x3743b8(++_0x1043e9);}(_0x94f7,0xb2));var _0x794f=function(_0x5f567d,_0x4a452b){_0x5f567d=_0x5f567d-0x0;var _0x3e5cde=_0x94f7[_0x5f567d];return _0x3e5cde;};'use strict';var _=require(_0x794f('0x0'));var util=require(_0x794f('0x1'));var logger=require(_0x794f('0x2'))(_0x794f('0x3'));var moment=require(_0x794f('0x4'));var BPromise=require(_0x794f('0x5'));var rp=require(_0x794f('0x6'));var fs=require('fs');var path=require(_0x794f('0x7'));var rimraf=require(_0x794f('0x8'));var config=require(_0x794f('0x9'));var attributes=require(_0x794f('0xa'));module[_0x794f('0xb')]=function(_0x14d82b,_0x5e2fcb){return _0x14d82b[_0x794f('0xc')](_0x794f('0xd'),attributes,{'tableName':_0x794f('0xe'),'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 db91064..3f59619 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 _0x98d3=['result','catch','body','options','raw','then','CreateAttachment','lodash','util','bluebird','ioredis','../../config/utils','../../config/logger','jayson/promise','client','http','request','info','Attachment,\x20%s,\x20%s','request\x20sent','debug','Attachment,\x20%s,\x20%s,\x20%s','stringify','error','code','message'];(function(_0x52419c,_0x8383ea){var _0x5c785a=function(_0x2b5573){while(--_0x2b5573){_0x52419c['push'](_0x52419c['shift']());}};_0x5c785a(++_0x8383ea);}(_0x98d3,0x173));var _0x398d=function(_0x482cb9,_0x448f4d){_0x482cb9=_0x482cb9-0x0;var _0x2c5647=_0x98d3[_0x482cb9];return _0x2c5647;};'use strict';var _=require(_0x398d('0x0'));var util=require(_0x398d('0x1'));var moment=require('moment');var BPromise=require(_0x398d('0x2'));var rs=require('randomstring');var fs=require('fs');var Redis=require(_0x398d('0x3'));var db=require('../../mysqldb')['db'];var utils=require(_0x398d('0x4'));var logger=require(_0x398d('0x5'))('rpc');var config=require('../../config/environment');var jayson=require(_0x398d('0x6'));var client=jayson[_0x398d('0x7')][_0x398d('0x8')]({'port':0x232a});function respondWithRpcPromise(_0x502652,_0x4ba1a3,_0x391d99){return new BPromise(function(_0x3029f3,_0x399598){return client[_0x398d('0x9')](_0x502652,_0x391d99)['then'](function(_0x3a1934){logger[_0x398d('0xa')](_0x398d('0xb'),_0x4ba1a3,_0x398d('0xc'));logger[_0x398d('0xd')](_0x398d('0xe'),_0x4ba1a3,_0x398d('0xc'),JSON[_0x398d('0xf')](_0x3a1934));if(_0x3a1934['error']){if(_0x3a1934[_0x398d('0x10')][_0x398d('0x11')]===0x1f4){logger[_0x398d('0x10')](_0x398d('0xb'),_0x4ba1a3,_0x3a1934[_0x398d('0x10')][_0x398d('0x12')]);return _0x399598(_0x3a1934[_0x398d('0x10')][_0x398d('0x12')]);}logger[_0x398d('0x10')](_0x398d('0xb'),_0x4ba1a3,_0x3a1934[_0x398d('0x10')]['message']);return _0x3029f3(_0x3a1934['error'][_0x398d('0x12')]);}else{logger[_0x398d('0xa')](_0x398d('0xb'),_0x4ba1a3,_0x398d('0xc'));_0x3029f3(_0x3a1934[_0x398d('0x13')][_0x398d('0x12')]);}})[_0x398d('0x14')](function(_0x3c151a){logger['error'](_0x398d('0xb'),_0x4ba1a3,_0x3c151a);_0x399598(_0x3c151a);});});}exports['CreateAttachment']=function(_0x673840){var _0x476c36=this;return new Promise(function(_0x297768,_0x5de1be){return db['Attachment']['create'](_0x673840[_0x398d('0x15')],{'raw':_0x673840[_0x398d('0x16')]?_0x673840[_0x398d('0x16')][_0x398d('0x17')]===undefined?!![]:![]:!![]})[_0x398d('0x18')](function(_0x1d9e75){logger[_0x398d('0xa')]('CreateAttachment',_0x673840);logger['debug']('CreateAttachment',_0x673840,JSON[_0x398d('0xf')](_0x1d9e75));_0x297768(_0x1d9e75);})[_0x398d('0x14')](function(_0x1ea5f9){logger[_0x398d('0x10')](_0x398d('0x19'),_0x1ea5f9['message'],_0x673840);_0x5de1be(_0x476c36['error'](0x1f4,_0x1ea5f9[_0x398d('0x12')]));});});}; \ No newline at end of file +var _0xaa7c=['debug','stringify','error','code','message','catch','CreateAttachment','Attachment','create','body','options','raw','lodash','ioredis','../../mysqldb','../../config/logger','rpc','../../config/environment','jayson/promise','client','request','info','Attachment,\x20%s,\x20%s','request\x20sent'];(function(_0x43079e,_0x228801){var _0x83e20=function(_0x48e09a){while(--_0x48e09a){_0x43079e['push'](_0x43079e['shift']());}};_0x83e20(++_0x228801);}(_0xaa7c,0x1ec));var _0xcaa7=function(_0x1798de,_0xbc2b89){_0x1798de=_0x1798de-0x0;var _0x2a8317=_0xaa7c[_0x1798de];return _0x2a8317;};'use strict';var _=require(_0xcaa7('0x0'));var util=require('util');var moment=require('moment');var BPromise=require('bluebird');var rs=require('randomstring');var fs=require('fs');var Redis=require(_0xcaa7('0x1'));var db=require(_0xcaa7('0x2'))['db'];var utils=require('../../config/utils');var logger=require(_0xcaa7('0x3'))(_0xcaa7('0x4'));var config=require(_0xcaa7('0x5'));var jayson=require(_0xcaa7('0x6'));var client=jayson[_0xcaa7('0x7')]['http']({'port':0x232a});function respondWithRpcPromise(_0x4b9df0,_0x5bd940,_0x55f6a4){return new BPromise(function(_0x4e4fc1,_0x126043){return client[_0xcaa7('0x8')](_0x4b9df0,_0x55f6a4)['then'](function(_0x20cd40){logger[_0xcaa7('0x9')](_0xcaa7('0xa'),_0x5bd940,_0xcaa7('0xb'));logger[_0xcaa7('0xc')]('Attachment,\x20%s,\x20%s,\x20%s',_0x5bd940,_0xcaa7('0xb'),JSON[_0xcaa7('0xd')](_0x20cd40));if(_0x20cd40[_0xcaa7('0xe')]){if(_0x20cd40[_0xcaa7('0xe')][_0xcaa7('0xf')]===0x1f4){logger[_0xcaa7('0xe')]('Attachment,\x20%s,\x20%s',_0x5bd940,_0x20cd40[_0xcaa7('0xe')][_0xcaa7('0x10')]);return _0x126043(_0x20cd40[_0xcaa7('0xe')][_0xcaa7('0x10')]);}logger[_0xcaa7('0xe')](_0xcaa7('0xa'),_0x5bd940,_0x20cd40[_0xcaa7('0xe')]['message']);return _0x4e4fc1(_0x20cd40['error'][_0xcaa7('0x10')]);}else{logger[_0xcaa7('0x9')](_0xcaa7('0xa'),_0x5bd940,_0xcaa7('0xb'));_0x4e4fc1(_0x20cd40['result'][_0xcaa7('0x10')]);}})[_0xcaa7('0x11')](function(_0x23c8f3){logger[_0xcaa7('0xe')](_0xcaa7('0xa'),_0x5bd940,_0x23c8f3);_0x126043(_0x23c8f3);});});}exports[_0xcaa7('0x12')]=function(_0x20ede0){var _0x5c2a74=this;return new Promise(function(_0x53e1cb,_0x4309e0){return db[_0xcaa7('0x13')][_0xcaa7('0x14')](_0x20ede0[_0xcaa7('0x15')],{'raw':_0x20ede0[_0xcaa7('0x16')]?_0x20ede0[_0xcaa7('0x16')][_0xcaa7('0x17')]===undefined?!![]:![]:!![]})['then'](function(_0x89e8a0){logger[_0xcaa7('0x9')](_0xcaa7('0x12'),_0x20ede0);logger[_0xcaa7('0xc')](_0xcaa7('0x12'),_0x20ede0,JSON[_0xcaa7('0xd')](_0x89e8a0));_0x53e1cb(_0x89e8a0);})[_0xcaa7('0x11')](function(_0x4259b7){logger[_0xcaa7('0xe')](_0xcaa7('0x12'),_0x4259b7[_0xcaa7('0x10')],_0x20ede0);_0x4309e0(_0x5c2a74[_0xcaa7('0xe')](0x1f4,_0x4259b7[_0xcaa7('0x10')]));});});}; \ No newline at end of file diff --git a/server/api/attachment/index.js b/server/api/attachment/index.js index fced4b3..583f8ab 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 _0xb10b=['originalname','replace','single','file','create','put','/:id','update','destroy','exports','multer','path','connect-timeout','express','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','./attachment.controller','get','index','isAuthenticated','show','/:id/download','download','post','/:id/clone','diskStorage','join','server/files/attachments/','format','%s-%s'];(function(_0x4b04a9,_0x112eec){var _0x3a7514=function(_0x491b73){while(--_0x491b73){_0x4b04a9['push'](_0x4b04a9['shift']());}};_0x3a7514(++_0x112eec);}(_0xb10b,0x12a));var _0xbb10=function(_0x58ef68,_0x275204){_0x58ef68=_0x58ef68-0x0;var _0x169a7f=_0xb10b[_0x58ef68];return _0x169a7f;};'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('0xf')](_0xbb10('0x10'),auth['isAuthenticated'](),controller['clone']);var upload=multer({'storage':multer[_0xbb10('0x11')]({'destination':function(_0x118a74,_0xce64f3,_0x5e136d){_0x5e136d(null,path[_0xbb10('0x12')](config['root'],_0xbb10('0x13')));},'filename':function(_0x916a32,_0x285009,_0x193a27){_0x193a27(null,util[_0xbb10('0x14')](_0xbb10('0x15'),Date['now'](),_0x285009[_0xbb10('0x16')][_0xbb10('0x17')](/[+@&\/\\#,+()$~%'":*?<>{}\s\\|]/g,'-')));}})});router[_0xbb10('0xf')]('/',upload[_0xbb10('0x18')](_0xbb10('0x19')),controller[_0xbb10('0x1a')]);router[_0xbb10('0x1b')](_0xbb10('0x1c'),auth[_0xbb10('0xb')](),controller[_0xbb10('0x1d')]);router['delete'](_0xbb10('0x1c'),auth[_0xbb10('0xb')](),controller[_0xbb10('0x1e')]);module[_0xbb10('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(_0x2641f9,_0x26715f){var _0x585741=function(_0x2d1462){while(--_0x2d1462){_0x2641f9['push'](_0x2641f9['shift']());}};_0x585741(++_0x26715f);}(_0xdb28,0x106));var _0x8db2=function(_0x12894a,_0x40b3d1){_0x12894a=_0x12894a-0x0;var _0xea6d66=_0xdb28[_0x12894a];return _0xea6d66;};'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 368a215..3f88c22 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 _0x7b1b=['api','activedirectory','baseDN','url','authenticate','error','Error\x20authenticate\x20%s:\x20%s','inspect','Incorrect\x20username\x20and/or\x20password.\x20Please\x20retry\x20again\x20or\x20contact\x20the\x20administrator.','Error\x20authenticate\x20%s:\x20Wrong\x20credentials','Error\x20authenticate\x20%s:\x20Active\x20Directory\x20not\x20configured','Setting','adSsoEnabled','blockDuration','then','name','password','role','disabled','blocked','blockedAt','online','user','agent','domain','add','getLicense','catch','send','message','login','ad-login','Something\x20went\x20wrong,\x20please\x20try\x20again.','signToken','json','use','passport','moment','activedirectory2','bluebird','util','../../mysqldb','../../components/auth/service','../../config/utils'];(function(_0x3dd15e,_0x1f0015){var _0x231fd0=function(_0x4f680a){while(--_0x4f680a){_0x3dd15e['push'](_0x3dd15e['shift']());}};_0x231fd0(++_0x1f0015);}(_0x7b1b,0x100));var _0xb7b1=function(_0x2ee5b9,_0x553856){_0x2ee5b9=_0x2ee5b9-0x0;var _0x1cc668=_0x7b1b[_0x2ee5b9];return _0x1cc668;};'use strict';var passport=require(_0xb7b1('0x0'));var LocalStrategy=require('passport-local')['Strategy'];var moment=require(_0xb7b1('0x1'));var ActiveDirectory=require(_0xb7b1('0x2'));var BPromise=require(_0xb7b1('0x3'));var util=require(_0xb7b1('0x4'));var db=require(_0xb7b1('0x5'))['db'];var authService=require(_0xb7b1('0x6'));var utils=require(_0xb7b1('0x7'));var config=require('../../config/environment');var logger=require('../../config/logger')(_0xb7b1('0x8'));function isActiveDirectoryConfigured(_0x54a72e){var _0x1ab25d=![];if(typeof _0x54a72e['activedirectory']!=='undefined'){_0x1ab25d=_0x54a72e[_0xb7b1('0x9')][_0xb7b1('0xa')]&&_0x54a72e[_0xb7b1('0x9')][_0xb7b1('0xb')]&&_0x54a72e[_0xb7b1('0x9')]['domain'];}return _0x1ab25d;}function adAuthenticate(_0x318a2b,_0xbc9828,_0x519aa9){return new BPromise(function(_0x2cf5a2,_0x25f4bf){try{var _0x54a286=new ActiveDirectory(_0x318a2b);_0x54a286[_0xb7b1('0xc')](_0xbc9828,_0x519aa9,function(_0x2982f0,_0x189123){if(_0x2982f0){logger[_0xb7b1('0xd')](_0xb7b1('0xe'),_0xbc9828,util[_0xb7b1('0xf')](_0x2982f0,{'showHidden':![],'depth':null}));_0x25f4bf(_0xb7b1('0x10'));}else if(!_0x189123){logger[_0xb7b1('0xd')](_0xb7b1('0x11'),_0xbc9828);_0x25f4bf(_0xb7b1('0x10'));}else{_0x2cf5a2(_0x189123);}});}catch(_0x47f0af){_0x25f4bf(_0x47f0af);}});}function ActiveDirectoryAuthenticate(_0x327c14,_0x55a0ce,_0x592b3b,_0x3d6018){var _0x113d29,_0x562f2f;if(!isActiveDirectoryConfigured(config)){logger[_0xb7b1('0xd')](_0xb7b1('0x12'),_0x55a0ce);return _0x3d6018(null,![],{'message':_0xb7b1('0x10')});}return db[_0xb7b1('0x13')]['findOne']({'where':{'id':0x1},'attributes':[_0xb7b1('0x14'),_0xb7b1('0x15')],'raw':!![]})[_0xb7b1('0x16')](function(_0x292a8c){_0x113d29=_0x292a8c;if(!_0x113d29[_0xb7b1('0x14')]){logger[_0xb7b1('0xd')]('Error\x20authenticate\x20%s:\x20Active\x20Directory\x20not\x20enabled',_0x55a0ce);throw new Error(_0xb7b1('0x10'));}return _0x327c14['findOne']({'attributes':['id',_0xb7b1('0x17'),_0xb7b1('0x18'),'salt',_0xb7b1('0x19'),_0xb7b1('0x1a'),_0xb7b1('0x1b'),_0xb7b1('0x1c'),_0xb7b1('0x1d')],'where':{'name':_0x55a0ce,'role':{'$or':['admin',_0xb7b1('0x1e'),_0xb7b1('0x1f')]},'adSsoEnabled':!![]}});})['then'](function(_0x5d71aa){if(!_0x5d71aa||_0x5d71aa&&_0x5d71aa['name']!==_0x55a0ce){throw new Error(_0xb7b1('0x10'));}_0x562f2f=_0x5d71aa;var _0x15c2c0=_0x562f2f[_0xb7b1('0x17')]+'@'+config[_0xb7b1('0x9')][_0xb7b1('0x20')];return adAuthenticate(config['activedirectory'],_0x15c2c0,_0x592b3b);})[_0xb7b1('0x16')](function(_0x2d4403){if(_0x562f2f[_0xb7b1('0x1a')]){throw new Error(_0xb7b1('0x10'));}if(_0x113d29[_0xb7b1('0x15')]>0x0){if(_0x562f2f['blocked']){if(moment(_0x562f2f[_0xb7b1('0x1c')])[_0xb7b1('0x21')](_0x113d29['blockDuration'],'minutes')>moment()){throw new Error('Incorrect\x20username\x20and/or\x20password.\x20Please\x20retry\x20again\x20or\x20contact\x20the\x20administrator.');}return utils['clearBlockUser'](_0x562f2f,0x0,![],null)[_0xb7b1('0x16')](function(){return utils[_0xb7b1('0x22')](_0x562f2f);})[_0xb7b1('0x16')](function(){return _0x3d6018(null,_0x562f2f);});}else{return utils['getLicense'](_0x562f2f)['then'](function(){return _0x3d6018(null,_0x562f2f);});}}else{return utils['getLicense'](_0x562f2f)[_0xb7b1('0x16')](function(){return _0x3d6018(null,_0x562f2f);});}})[_0xb7b1('0x23')](function(_0x54aa2b){return _0x3d6018(null,![],_0x54aa2b);});}function handleError(_0xaad52a,_0x4f2cb0,_0x1729b8){return _0xaad52a['status'](_0x4f2cb0||0x1f4)[_0xb7b1('0x24')]({'message':_0x1729b8?_0x1729b8[_0xb7b1('0x25')]||_0x1729b8:''});}exports[_0xb7b1('0x26')]=function(_0x35faa2,_0x1081b5,_0xf2ddfc){passport['authenticate'](_0xb7b1('0x27'),function(_0xb8ba4e,_0xcb5eaa,_0x328c26){var _0x5226ac=_0xb8ba4e||_0x328c26;if(_0x5226ac){return handleError(_0x1081b5,0x191,_0x5226ac);}if(!_0xcb5eaa){return handleError(_0x1081b5,0x194,{'message':_0xb7b1('0x28')});}else{var _0xc264c0={'payload':{'id':_0xcb5eaa['id'],'role':_0xcb5eaa[_0xb7b1('0x19')]},'options':{'expiresIn':0x15180}};return authService[_0xb7b1('0x29')](_0xc264c0)[_0xb7b1('0x16')](function(_0x1cc538){_0x1081b5[_0xb7b1('0x2a')]({'id':_0xcb5eaa['id'],'token':_0x1cc538,'statusCall':'','isAlreadyLogged':_0xcb5eaa[_0xb7b1('0x1d')]});});}})(_0x35faa2,_0x1081b5,_0xf2ddfc);};passport[_0xb7b1('0x2b')](_0xb7b1('0x27'),new LocalStrategy({'usernameField':_0xb7b1('0x17'),'passwordField':_0xb7b1('0x18')},function(_0x7905a1,_0x4a1c7d,_0xb77666){return ActiveDirectoryAuthenticate(db['User'],_0x7905a1,_0x4a1c7d,_0xb77666);})); \ No newline at end of file +var _0xec94=['blockedAt','user','agent','name','disabled','minutes','getLicense','catch','status','send','signToken','online','use','ad-login','User','passport','passport-local','Strategy','util','../../mysqldb','../../config/utils','../../config/environment','../../config/logger','api','activedirectory','undefined','baseDN','domain','authenticate','error','inspect','Incorrect\x20username\x20and/or\x20password.\x20Please\x20retry\x20again\x20or\x20contact\x20the\x20administrator.','Error\x20authenticate\x20%s:\x20Wrong\x20credentials','Error\x20authenticate\x20%s:\x20Active\x20Directory\x20not\x20configured','Setting','findOne','adSsoEnabled','blockDuration','then','password','salt','role','blocked'];(function(_0x4bf410,_0x3c7e64){var _0x56652f=function(_0x4d4aaa){while(--_0x4d4aaa){_0x4bf410['push'](_0x4bf410['shift']());}};_0x56652f(++_0x3c7e64);}(_0xec94,0x1e8));var _0x4ec9=function(_0x58197e,_0xf04601){_0x58197e=_0x58197e-0x0;var _0x32978a=_0xec94[_0x58197e];return _0x32978a;};'use strict';var passport=require(_0x4ec9('0x0'));var LocalStrategy=require(_0x4ec9('0x1'))[_0x4ec9('0x2')];var moment=require('moment');var ActiveDirectory=require('activedirectory2');var BPromise=require('bluebird');var util=require(_0x4ec9('0x3'));var db=require(_0x4ec9('0x4'))['db'];var authService=require('../../components/auth/service');var utils=require(_0x4ec9('0x5'));var config=require(_0x4ec9('0x6'));var logger=require(_0x4ec9('0x7'))(_0x4ec9('0x8'));function isActiveDirectoryConfigured(_0x5d2148){var _0x354abe=![];if(typeof _0x5d2148[_0x4ec9('0x9')]!==_0x4ec9('0xa')){_0x354abe=_0x5d2148['activedirectory'][_0x4ec9('0xb')]&&_0x5d2148[_0x4ec9('0x9')]['url']&&_0x5d2148[_0x4ec9('0x9')][_0x4ec9('0xc')];}return _0x354abe;}function adAuthenticate(_0x3067f2,_0x31c039,_0x476c61){return new BPromise(function(_0x35e57b,_0x5c72ad){try{var _0x3df2c7=new ActiveDirectory(_0x3067f2);_0x3df2c7[_0x4ec9('0xd')](_0x31c039,_0x476c61,function(_0x37b650,_0x106527){if(_0x37b650){logger[_0x4ec9('0xe')]('Error\x20authenticate\x20%s:\x20%s',_0x31c039,util[_0x4ec9('0xf')](_0x37b650,{'showHidden':![],'depth':null}));_0x5c72ad(_0x4ec9('0x10'));}else if(!_0x106527){logger[_0x4ec9('0xe')](_0x4ec9('0x11'),_0x31c039);_0x5c72ad(_0x4ec9('0x10'));}else{_0x35e57b(_0x106527);}});}catch(_0x3d7ee3){_0x5c72ad(_0x3d7ee3);}});}function ActiveDirectoryAuthenticate(_0x1a0bcd,_0x13c3d5,_0x6a0ef0,_0x322a9d){var _0x9e4f00,_0x2814e7;if(!isActiveDirectoryConfigured(config)){logger['error'](_0x4ec9('0x12'),_0x13c3d5);return _0x322a9d(null,![],{'message':'Incorrect\x20username\x20and/or\x20password.\x20Please\x20retry\x20again\x20or\x20contact\x20the\x20administrator.'});}return db[_0x4ec9('0x13')][_0x4ec9('0x14')]({'where':{'id':0x1},'attributes':[_0x4ec9('0x15'),_0x4ec9('0x16')],'raw':!![]})[_0x4ec9('0x17')](function(_0x2e60cd){_0x9e4f00=_0x2e60cd;if(!_0x9e4f00[_0x4ec9('0x15')]){logger[_0x4ec9('0xe')]('Error\x20authenticate\x20%s:\x20Active\x20Directory\x20not\x20enabled',_0x13c3d5);throw new Error(_0x4ec9('0x10'));}return _0x1a0bcd[_0x4ec9('0x14')]({'attributes':['id','name',_0x4ec9('0x18'),_0x4ec9('0x19'),_0x4ec9('0x1a'),'disabled',_0x4ec9('0x1b'),_0x4ec9('0x1c'),'online'],'where':{'name':_0x13c3d5,'role':{'$or':['admin',_0x4ec9('0x1d'),_0x4ec9('0x1e')]},'adSsoEnabled':!![]}});})[_0x4ec9('0x17')](function(_0x341ab7){if(!_0x341ab7||_0x341ab7&&_0x341ab7[_0x4ec9('0x1f')]!==_0x13c3d5){throw new Error('Incorrect\x20username\x20and/or\x20password.\x20Please\x20retry\x20again\x20or\x20contact\x20the\x20administrator.');}_0x2814e7=_0x341ab7;var _0x4c2be3=_0x2814e7['name']+'@'+config[_0x4ec9('0x9')][_0x4ec9('0xc')];return adAuthenticate(config[_0x4ec9('0x9')],_0x4c2be3,_0x6a0ef0);})[_0x4ec9('0x17')](function(_0x3a5ddb){if(_0x2814e7[_0x4ec9('0x20')]){throw new Error('Incorrect\x20username\x20and/or\x20password.\x20Please\x20retry\x20again\x20or\x20contact\x20the\x20administrator.');}if(_0x9e4f00[_0x4ec9('0x16')]>0x0){if(_0x2814e7[_0x4ec9('0x1b')]){if(moment(_0x2814e7[_0x4ec9('0x1c')])['add'](_0x9e4f00['blockDuration'],_0x4ec9('0x21'))>moment()){throw new Error(_0x4ec9('0x10'));}return utils['clearBlockUser'](_0x2814e7,0x0,![],null)['then'](function(){return utils[_0x4ec9('0x22')](_0x2814e7);})[_0x4ec9('0x17')](function(){return _0x322a9d(null,_0x2814e7);});}else{return utils[_0x4ec9('0x22')](_0x2814e7)['then'](function(){return _0x322a9d(null,_0x2814e7);});}}else{return utils['getLicense'](_0x2814e7)[_0x4ec9('0x17')](function(){return _0x322a9d(null,_0x2814e7);});}})[_0x4ec9('0x23')](function(_0x46767f){return _0x322a9d(null,![],_0x46767f);});}function handleError(_0x3767a3,_0x1c54e2,_0x3e7cdc){return _0x3767a3[_0x4ec9('0x24')](_0x1c54e2||0x1f4)[_0x4ec9('0x25')]({'message':_0x3e7cdc?_0x3e7cdc['message']||_0x3e7cdc:''});}exports['login']=function(_0xcf2c3a,_0x4c6a90,_0x3d5d5b){passport[_0x4ec9('0xd')]('ad-login',function(_0x132e55,_0x17fd0c,_0x304f6c){var _0x1d4387=_0x132e55||_0x304f6c;if(_0x1d4387){return handleError(_0x4c6a90,0x191,_0x1d4387);}if(!_0x17fd0c){return handleError(_0x4c6a90,0x194,{'message':'Something\x20went\x20wrong,\x20please\x20try\x20again.'});}else{var _0x19bf70={'payload':{'id':_0x17fd0c['id'],'role':_0x17fd0c['role']},'options':{'expiresIn':0x15180}};return authService[_0x4ec9('0x26')](_0x19bf70)[_0x4ec9('0x17')](function(_0x3e3b7b){_0x4c6a90['json']({'id':_0x17fd0c['id'],'token':_0x3e3b7b,'statusCall':'','isAlreadyLogged':_0x17fd0c[_0x4ec9('0x27')]});});}})(_0xcf2c3a,_0x4c6a90,_0x3d5d5b);};passport[_0x4ec9('0x28')](_0x4ec9('0x29'),new LocalStrategy({'usernameField':_0x4ec9('0x1f'),'passwordField':'password'},function(_0x465e84,_0x3d9755,_0x49ba5f){return ActiveDirectoryAuthenticate(db[_0x4ec9('0x2a')],_0x465e84,_0x3d9755,_0x49ba5f);})); \ No newline at end of file diff --git a/server/api/authActiveDirectory/index.js b/server/api/authActiveDirectory/index.js index 6ca2ae3..bfc80c4 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 _0xbc05=['express','Router','login'];(function(_0x3eefc4,_0x13da29){var _0x390870=function(_0x3236fe){while(--_0x3236fe){_0x3eefc4['push'](_0x3eefc4['shift']());}};_0x390870(++_0x13da29);}(_0xbc05,0x10e));var _0x5bc0=function(_0xe586ef,_0x5d850f){_0xe586ef=_0xe586ef-0x0;var _0x3ea84a=_0xbc05[_0xe586ef];return _0x3ea84a;};'use strict';var express=require(_0x5bc0('0x0'));var router=express[_0x5bc0('0x1')]();var controller=require('./authActiveDirectory.controller');router['post']('/',controller[_0x5bc0('0x2')]);module['exports']=router; \ No newline at end of file +var _0x7e80=['post','login','exports','express','Router','./authActiveDirectory.controller'];(function(_0x4cfc1d,_0x2c0927){var _0x1c01a0=function(_0x264a74){while(--_0x264a74){_0x4cfc1d['push'](_0x4cfc1d['shift']());}};_0x1c01a0(++_0x2c0927);}(_0x7e80,0x1dd));var _0x07e8=function(_0x296e0e,_0x342fa4){_0x296e0e=_0x296e0e-0x0;var _0x101c03=_0x7e80[_0x296e0e];return _0x101c03;};'use strict';var express=require(_0x07e8('0x0'));var router=express[_0x07e8('0x1')]();var controller=require(_0x07e8('0x2'));router[_0x07e8('0x3')]('/',controller[_0x07e8('0x4')]);module[_0x07e8('0x5')]=router; \ No newline at end of file diff --git a/server/api/authGoogle/authGoogle.controller.js b/server/api/authGoogle/authGoogle.controller.js index 8a72df7..f1682ef 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 _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(_0x550d7a,_0x466d3){var _0x4f621f=function(_0x43245c){while(--_0x43245c){_0x550d7a['push'](_0x550d7a['shift']());}};_0x4f621f(++_0x466d3);}(_0x9957,0x93));var _0x7995=function(_0x6c993a,_0x5ea3ab){_0x6c993a=_0x6c993a-0x0;var _0x27f547=_0x9957[_0x6c993a];return _0x27f547;};'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 +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(_0x5843d2,_0x121877){var _0x6dd37=function(_0x3fe2dc){while(--_0x3fe2dc){_0x5843d2['push'](_0x5843d2['shift']());}};_0x6dd37(++_0x121877);}(_0x9957,0x93));var _0x7995=function(_0x2f5ac5,_0x1ee939){_0x2f5ac5=_0x2f5ac5-0x0;var _0x37c9a8=_0x9957[_0x2f5ac5];return _0x37c9a8;};'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 d7de4d1..270a7e7 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 _0x1074=['../../components/auth/service','get','/callback','isMiddleware','exports','express','passport','Router','../user/user.controller.js'];(function(_0x1bc762,_0x523eb3){var _0x40f70c=function(_0x3c206e){while(--_0x3c206e){_0x1bc762['push'](_0x1bc762['shift']());}};_0x40f70c(++_0x523eb3);}(_0x1074,0x137));var _0x4107=function(_0x549c39,_0x1f88de){_0x549c39=_0x549c39-0x0;var _0xb88b84=_0x1074[_0x549c39];return _0xb88b84;};'use strict';var express=require(_0x4107('0x0'));var passport=require(_0x4107('0x1'));var router=express[_0x4107('0x2')]();var controller=require('./authGoogle.controller');var userController=require(_0x4107('0x3'));var authService=require(_0x4107('0x4'));router[_0x4107('0x5')]('/',controller['login']);router[_0x4107('0x5')](_0x4107('0x6'),controller['callback'],authService[_0x4107('0x7')],userController['login'],authService['setTokenCookie']);module[_0x4107('0x8')]=router; \ No newline at end of file +var _0xf3c9=['exports','passport','Router','./authGoogle.controller','../../components/auth/service','get','login','callback','isMiddleware','setTokenCookie'];(function(_0x17b911,_0x48f482){var _0xbcd369=function(_0x160b58){while(--_0x160b58){_0x17b911['push'](_0x17b911['shift']());}};_0xbcd369(++_0x48f482);}(_0xf3c9,0xa1));var _0x9f3c=function(_0x51df10,_0x5c1705){_0x51df10=_0x51df10-0x0;var _0x53d91f=_0xf3c9[_0x51df10];return _0x53d91f;};'use strict';var express=require('express');var passport=require(_0x9f3c('0x0'));var router=express[_0x9f3c('0x1')]();var controller=require(_0x9f3c('0x2'));var userController=require('../user/user.controller.js');var authService=require(_0x9f3c('0x3'));router[_0x9f3c('0x4')]('/',controller[_0x9f3c('0x5')]);router[_0x9f3c('0x4')]('/callback',controller[_0x9f3c('0x6')],authService[_0x9f3c('0x7')],userController['login'],authService[_0x9f3c('0x8')]);module[_0x9f3c('0x9')]=router; \ No newline at end of file diff --git a/server/api/authLocal/authLocal.controller.js b/server/api/authLocal/authLocal.controller.js index f8343bc..5d3c083 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 _0x5f83=['disabled','blockedAt','loginAttempts','admin','agent','Incorrect\x20username\x20and/or\x20password.\x20Please\x20retry\x20again\x20or\x20contact\x20the\x20administrator.','blocked','add','clearBlockUser','getLicense','catch','MailAccount','find','email','MailServerOut','Smtp','CloudProvider','Unable\x20to\x20find\x20a\x20configured\x20SMTP\x20service!','getSmtpOptions','\x22%s\x22\x20<%s>','user','request','SendMail','error','format','SendMail\x20error:\x20%s.\x20Please\x20contact\x20your\x20Administrator!','message','stringify','send','login','authenticate','local-login','signToken','json','forgot','body','generate','trim','toLowerCase','User','This\x20email\x20is\x20not\x20registered.','minutes','The\x20user\x20is\x20blocked.\x20Please\x20contact\x20the\x20administrator.','resetPasswordToken','resetPasswordExpires','now','save','xCally\x20Motion\x20Password\x20Reset','https://','headers','host','If\x20you\x20did\x20not\x20request\x20this,\x20please\x20ignore\x20this\x20email\x20and\x20your\x20password\x20will\x20remain\x20unchanged.\x0a','status','params','token','Password\x20reset\x20token\x20is\x20invalid\x20or\x20has\x20expired.','securePassword','enforcePasswordHistory','passwordHistoryLimit','validatePasswordPattern','validatePasswordHistory','previousPasswords','Password\x20reset!','use','passport','jayson/promise','lodash','moment','../../components/auth/service','../../config/utils','client','http','Setting','findOne','allowedLoginAttempts','blockDuration','then','name','password','salt','role'];(function(_0x20a584,_0xe384a5){var _0x4b41a8=function(_0x2127c6){while(--_0x2127c6){_0x20a584['push'](_0x20a584['shift']());}};_0x4b41a8(++_0xe384a5);}(_0x5f83,0xe2));var _0x35f8=function(_0x2b0e9d,_0x4cd447){_0x2b0e9d=_0x2b0e9d-0x0;var _0x59b2a3=_0x5f83[_0x2b0e9d];return _0x59b2a3;};'use strict';var util=require('util');var passport=require(_0x35f8('0x0'));var LocalStrategy=require('passport-local')['Strategy'];var jayson=require(_0x35f8('0x1'));var _=require(_0x35f8('0x2'));var rs=require('randomstring');var moment=require(_0x35f8('0x3'));var db=require('../../mysqldb')['db'];var authService=require(_0x35f8('0x4'));var utils=require(_0x35f8('0x5'));var client=jayson[_0x35f8('0x6')][_0x35f8('0x7')]({'port':0x232b});function localAuthenticate(_0x57cd68,_0x31397c,_0x630dd5,_0x2bfb83){var _0x1b44e6,_0x26c31a;return db[_0x35f8('0x8')][_0x35f8('0x9')]({'where':{'id':0x1},'attributes':[_0x35f8('0xa'),_0x35f8('0xb')],'raw':!![]})[_0x35f8('0xc')](function(_0x978e9){_0x1b44e6=_0x978e9;return _0x57cd68[_0x35f8('0x9')]({'attributes':['id',_0x35f8('0xd'),_0x35f8('0xe'),_0x35f8('0xf'),_0x35f8('0x10'),_0x35f8('0x11'),'blocked',_0x35f8('0x12'),_0x35f8('0x13')],'where':{'name':_0x31397c,'role':{'$or':[_0x35f8('0x14'),'user',_0x35f8('0x15')]}}});})[_0x35f8('0xc')](function(_0x3aa561){if(!_0x3aa561||_0x3aa561&&_0x3aa561[_0x35f8('0xd')]!==_0x31397c){throw new Error(_0x35f8('0x16'));}else{_0x26c31a=_0x3aa561;return _0x26c31a;}})[_0x35f8('0xc')](function(){_0x26c31a['authenticate'](_0x630dd5,function(_0x561159,_0x5014b9){var _0x5b0438=_0x26c31a[_0x35f8('0x13')]+0x1;if(_0x561159){return _0x2bfb83(_0x561159);}else if(!_0x5014b9){if(_0x26c31a[_0x35f8('0x11')]){return _0x2bfb83(null,![],{'message':_0x35f8('0x16')});}else if(_0x1b44e6[_0x35f8('0xa')]>0x0){if(_0x26c31a[_0x35f8('0x17')]){if(_0x1b44e6[_0x35f8('0xb')]>0x0){if(moment(_0x26c31a[_0x35f8('0x12')])[_0x35f8('0x18')](_0x1b44e6[_0x35f8('0xb')],'minutes')>moment()){return _0x2bfb83(null,![],{'message':_0x35f8('0x16')});}else{return utils[_0x35f8('0x19')](_0x26c31a,_0x5b0438,![],null)[_0x35f8('0xc')](function(){return _0x2bfb83(null,![],{'message':_0x35f8('0x16')});});}}else{return _0x2bfb83(null,![],{'message':_0x35f8('0x16')});}}else{if(_0x5b0438>=_0x1b44e6['allowedLoginAttempts']){return utils[_0x35f8('0x19')](_0x26c31a,0x0,!![],moment())[_0x35f8('0xc')](function(){return _0x2bfb83(null,![],{'message':_0x35f8('0x16')});});}else{return utils[_0x35f8('0x19')](_0x26c31a,_0x5b0438,![],null)[_0x35f8('0xc')](function(){return _0x2bfb83(null,![],{'message':'Incorrect\x20username\x20and/or\x20password.\x20Please\x20retry\x20again\x20or\x20contact\x20the\x20administrator.'});});}}}else{return _0x2bfb83(null,![],{'message':'Incorrect\x20username\x20and/or\x20password.\x20Please\x20retry\x20again\x20or\x20contact\x20the\x20administrator.'});}}else{if(_0x26c31a['disabled']){return _0x2bfb83(null,![],{'message':_0x35f8('0x16')});}else if(_0x1b44e6[_0x35f8('0xa')]>0x0){if(_0x26c31a[_0x35f8('0x17')]){if(_0x1b44e6['blockDuration']>0x0){if(moment(_0x26c31a[_0x35f8('0x12')])[_0x35f8('0x18')](_0x1b44e6['blockDuration'],'minutes')>moment()){return _0x2bfb83(null,![],{'message':_0x35f8('0x16')});}else{return utils[_0x35f8('0x19')](_0x26c31a,0x0,![],null)['then'](function(){return utils['getLicense'](_0x26c31a);})[_0x35f8('0xc')](function(){return _0x2bfb83(null,_0x26c31a);});}}else{return _0x2bfb83(null,![],{'message':_0x35f8('0x16')});}}else{return utils[_0x35f8('0x19')](_0x26c31a,0x0,![],null)[_0x35f8('0xc')](function(){return utils[_0x35f8('0x1a')](_0x26c31a);})[_0x35f8('0xc')](function(){return _0x2bfb83(null,_0x26c31a);})['catch'](function(_0x26a6f1){return _0x2bfb83(null,![],_0x26a6f1);});}}else{if(_0x26c31a[_0x35f8('0x17')]){return _0x2bfb83(null,![],{'message':_0x35f8('0x16')});}else{return utils[_0x35f8('0x1a')](_0x26c31a)[_0x35f8('0xc')](function(){return _0x2bfb83(null,_0x26c31a);});}}}});})[_0x35f8('0x1b')](function(_0x233b52){return _0x2bfb83(null,![],_0x233b52);});}function sendServiceMail(_0x42b309){return db[_0x35f8('0x1c')][_0x35f8('0x1d')]({'where':{'service':!![]},'attributes':['id',_0x35f8('0xd'),_0x35f8('0x1e')],'include':[{'model':db[_0x35f8('0x1f')],'as':_0x35f8('0x20'),'include':[{'model':db[_0x35f8('0x21')],'as':_0x35f8('0x21')}]}]})[_0x35f8('0xc')](function(_0x5932e4){if(!_0x5932e4){throw new Error(_0x35f8('0x22'));}var _0x47c7b3=_0x5932e4[_0x35f8('0x23')]();var _0x3fb0d1={'account':_0x47c7b3,'message':_['merge']({'from':util['format'](_0x35f8('0x24'),_0x5932e4[_0x35f8('0xd')],_0x5932e4[_0x35f8('0x1e')]||_0x5932e4[_0x35f8('0x20')][_0x35f8('0x25')])},_0x42b309)};return client[_0x35f8('0x26')](_0x35f8('0x27'),_0x3fb0d1);})[_0x35f8('0xc')](function(_0x1d3e50){if(_0x1d3e50[_0x35f8('0x28')]){throw new Error(util[_0x35f8('0x29')](_0x35f8('0x2a'),_0x1d3e50['error'][_0x35f8('0x2b')]||JSON[_0x35f8('0x2c')](_0x1d3e50['error'])));}return!![];});}function handleError(_0x389ada,_0x1d1afe,_0x4b0d7b){return _0x389ada['status'](_0x1d1afe||0x1f4)[_0x35f8('0x2d')]({'message':_0x4b0d7b?_0x4b0d7b['message']||_0x4b0d7b:''});}exports[_0x35f8('0x2e')]=function(_0x396246,_0x497c33,_0x59ab3f){passport[_0x35f8('0x2f')](_0x35f8('0x30'),function(_0x52ed42,_0x573daf,_0x4c95e5){var _0x49b464=_0x52ed42||_0x4c95e5;if(_0x49b464){return handleError(_0x497c33,0x191,_0x49b464);}if(!_0x573daf){return handleError(_0x497c33,0x194,{'message':'Something\x20went\x20wrong,\x20please\x20try\x20again.'});}else{var _0x3726b2={'payload':{'id':_0x573daf['id'],'role':_0x573daf[_0x35f8('0x10')]},'options':{'expiresIn':0x15180}};return authService[_0x35f8('0x31')](_0x3726b2)['then'](function(_0x51ab97){_0x497c33[_0x35f8('0x32')]({'id':_0x573daf['id'],'token':_0x51ab97,'statusCall':'','isAlreadyLogged':_0x573daf['online']});});}})(_0x396246,_0x497c33,_0x59ab3f);};exports[_0x35f8('0x33')]=function(_0x3b3763,_0x2139a5){if(!_0x3b3763[_0x35f8('0x34')][_0x35f8('0x1e')]){return handleError(_0x2139a5,0x1f4,{'message':'Email\x20parameter\x20is\x20missing'});}var _0x20a099=rs[_0x35f8('0x35')]();_0x3b3763[_0x35f8('0x34')]['email']=_0x3b3763[_0x35f8('0x34')][_0x35f8('0x1e')][_0x35f8('0x36')]()[_0x35f8('0x37')]();var _0x54a2cb;return db[_0x35f8('0x8')][_0x35f8('0x9')]({'where':{'id':0x1},'attributes':[_0x35f8('0xa'),_0x35f8('0xb')],'raw':!![]})[_0x35f8('0xc')](function(_0x82d029){_0x54a2cb=_0x82d029;return db[_0x35f8('0x38')][_0x35f8('0x1d')]({'where':{'email':_0x3b3763[_0x35f8('0x34')][_0x35f8('0x1e')]}});})[_0x35f8('0xc')](function(_0x5f3cfa){if(!_0x5f3cfa){throw new Error(_0x35f8('0x39'));}if(_0x5f3cfa[_0x35f8('0x11')]){throw new Error('The\x20user\x20is\x20disabled.\x20Please\x20contact\x20the\x20administrator.');}if(_0x5f3cfa[_0x35f8('0x17')]){if(moment(_0x5f3cfa[_0x35f8('0x12')])['add'](_0x54a2cb[_0x35f8('0xb')],_0x35f8('0x3a'))>moment()){throw new Error(_0x35f8('0x3b'));}else{_0x5f3cfa[_0x35f8('0x17')]=![];_0x5f3cfa[_0x35f8('0x12')]=null;}}_0x5f3cfa[_0x35f8('0x3c')]=_0x20a099;_0x5f3cfa[_0x35f8('0x3d')]=Date[_0x35f8('0x3e')]()+0x36ee80;return _0x5f3cfa[_0x35f8('0x3f')]();})[_0x35f8('0xc')](function(){return sendServiceMail({'to':_0x3b3763[_0x35f8('0x34')][_0x35f8('0x1e')],'subject':_0x35f8('0x40'),'text':'You\x20are\x20receiving\x20this\x20because\x20you\x20(or\x20someone\x20else)\x20have\x20requested\x20the\x20reset\x20of\x20the\x20password\x20for\x20your\x20account.\x0a\x0a'+'Please\x20click\x20on\x20the\x20following\x20link,\x20or\x20paste\x20this\x20into\x20your\x20browser\x20to\x20complete\x20the\x20process:\x0a\x0a'+_0x35f8('0x41')+_0x3b3763[_0x35f8('0x42')][_0x35f8('0x43')]+'/reset/'+_0x20a099+'\x0a\x0a'+_0x35f8('0x44')});})[_0x35f8('0xc')](function(){_0x2139a5[_0x35f8('0x45')](0xc8)[_0x35f8('0x2d')]({'message':'Reset\x20Email\x20sent!'});})[_0x35f8('0x1b')](function(_0x3d428b){return handleError(_0x2139a5,0x1f4,_0x3d428b);});};exports['reset']=function(_0x259bcc,_0x3282e6){return db[_0x35f8('0x38')][_0x35f8('0x1d')]({'where':{'resetPasswordToken':_0x259bcc[_0x35f8('0x46')][_0x35f8('0x47')],'resetPasswordExpires':{'$gt':Date['now']()}}})[_0x35f8('0xc')](function(_0x3825cf){if(!_0x3825cf){throw new Error(_0x35f8('0x48'));}return db[_0x35f8('0x8')]['findOne']({'attributes':['id',_0x35f8('0x49'),_0x35f8('0x4a'),_0x35f8('0x4b')]})['then'](function(_0x24aeb0){if(_0x24aeb0[_0x35f8('0x49')])authService[_0x35f8('0x4c')](_0x259bcc[_0x35f8('0x34')][_0x35f8('0xe')]);if(!_0x24aeb0['enforcePasswordHistory']||!_0x3825cf['previousPasswords'])return _0x3825cf;authService[_0x35f8('0x4d')](_0x259bcc[_0x35f8('0x34')][_0x35f8('0xe')],_0x3825cf[_0x35f8('0x4e')],_0x24aeb0[_0x35f8('0x4b')]);return _0x3825cf;})[_0x35f8('0xc')](function(){_0x3825cf[_0x35f8('0xe')]=_0x259bcc[_0x35f8('0x34')][_0x35f8('0xe')];_0x3825cf[_0x35f8('0x3c')]=null;_0x3825cf['resetPasswordExpires']=null;return _0x3825cf[_0x35f8('0x3f')]();});})[_0x35f8('0xc')](function(){_0x3282e6[_0x35f8('0x45')](0xc8)['send']({'message':_0x35f8('0x4f')});})[_0x35f8('0x1b')](function(_0x43934e){return handleError(_0x3282e6,0x1f4,_0x43934e);});};passport[_0x35f8('0x50')]('local-login',new LocalStrategy({'usernameField':'name','passwordField':_0x35f8('0xe')},function(_0x35e0a5,_0x1aec9e,_0x3c8582){return localAuthenticate(db['User'],_0x35e0a5,_0x1aec9e,_0x3c8582);})); \ No newline at end of file +var _0xb87c=['catch','email','MailServerOut','Smtp','CloudProvider','Unable\x20to\x20find\x20a\x20configured\x20SMTP\x20service!','getSmtpOptions','merge','\x22%s\x22\x20<%s>','request','SendMail','error','format','SendMail\x20error:\x20%s.\x20Please\x20contact\x20your\x20Administrator!','message','status','login','Something\x20went\x20wrong,\x20please\x20try\x20again.','role','signToken','online','forgot','Email\x20parameter\x20is\x20missing','body','trim','toLowerCase','find','This\x20email\x20is\x20not\x20registered.','The\x20user\x20is\x20disabled.\x20Please\x20contact\x20the\x20administrator.','The\x20user\x20is\x20blocked.\x20Please\x20contact\x20the\x20administrator.','now','save','You\x20are\x20receiving\x20this\x20because\x20you\x20(or\x20someone\x20else)\x20have\x20requested\x20the\x20reset\x20of\x20the\x20password\x20for\x20your\x20account.\x0a\x0a','https://','headers','/reset/','If\x20you\x20did\x20not\x20request\x20this,\x20please\x20ignore\x20this\x20email\x20and\x20your\x20password\x20will\x20remain\x20unchanged.\x0a','send','User','token','Password\x20reset\x20token\x20is\x20invalid\x20or\x20has\x20expired.','passwordHistoryLimit','securePassword','validatePasswordPattern','password','enforcePasswordHistory','previousPasswords','validatePasswordHistory','resetPasswordToken','resetPasswordExpires','Password\x20reset!','util','passport','passport-local','Strategy','jayson/promise','randomstring','moment','../../config/utils','client','Setting','findOne','blockDuration','then','name','salt','disabled','loginAttempts','user','agent','Incorrect\x20username\x20and/or\x20password.\x20Please\x20retry\x20again\x20or\x20contact\x20the\x20administrator.','authenticate','allowedLoginAttempts','blocked','add','minutes','clearBlockUser','blockedAt','getLicense'];(function(_0x51c9a9,_0x239840){var _0x2b8ea4=function(_0x353b73){while(--_0x353b73){_0x51c9a9['push'](_0x51c9a9['shift']());}};_0x2b8ea4(++_0x239840);}(_0xb87c,0x16f));var _0xcb87=function(_0xb07c50,_0x16dbf8){_0xb07c50=_0xb07c50-0x0;var _0x553e26=_0xb87c[_0xb07c50];return _0x553e26;};'use strict';var util=require(_0xcb87('0x0'));var passport=require(_0xcb87('0x1'));var LocalStrategy=require(_0xcb87('0x2'))[_0xcb87('0x3')];var jayson=require(_0xcb87('0x4'));var _=require('lodash');var rs=require(_0xcb87('0x5'));var moment=require(_0xcb87('0x6'));var db=require('../../mysqldb')['db'];var authService=require('../../components/auth/service');var utils=require(_0xcb87('0x7'));var client=jayson[_0xcb87('0x8')]['http']({'port':0x232b});function localAuthenticate(_0x45a81d,_0x49d9a6,_0x43b533,_0x59ede3){var _0x10df30,_0x5a006f;return db[_0xcb87('0x9')][_0xcb87('0xa')]({'where':{'id':0x1},'attributes':['allowedLoginAttempts',_0xcb87('0xb')],'raw':!![]})[_0xcb87('0xc')](function(_0x30c622){_0x10df30=_0x30c622;return _0x45a81d[_0xcb87('0xa')]({'attributes':['id',_0xcb87('0xd'),'password',_0xcb87('0xe'),'role',_0xcb87('0xf'),'blocked','blockedAt',_0xcb87('0x10')],'where':{'name':_0x49d9a6,'role':{'$or':['admin',_0xcb87('0x11'),_0xcb87('0x12')]}}});})[_0xcb87('0xc')](function(_0x3c1b7e){if(!_0x3c1b7e||_0x3c1b7e&&_0x3c1b7e[_0xcb87('0xd')]!==_0x49d9a6){throw new Error(_0xcb87('0x13'));}else{_0x5a006f=_0x3c1b7e;return _0x5a006f;}})[_0xcb87('0xc')](function(){_0x5a006f[_0xcb87('0x14')](_0x43b533,function(_0x5f0cf8,_0xb93d84){var _0x1fa6f1=_0x5a006f[_0xcb87('0x10')]+0x1;if(_0x5f0cf8){return _0x59ede3(_0x5f0cf8);}else if(!_0xb93d84){if(_0x5a006f[_0xcb87('0xf')]){return _0x59ede3(null,![],{'message':'Incorrect\x20username\x20and/or\x20password.\x20Please\x20retry\x20again\x20or\x20contact\x20the\x20administrator.'});}else if(_0x10df30[_0xcb87('0x15')]>0x0){if(_0x5a006f[_0xcb87('0x16')]){if(_0x10df30[_0xcb87('0xb')]>0x0){if(moment(_0x5a006f['blockedAt'])[_0xcb87('0x17')](_0x10df30[_0xcb87('0xb')],_0xcb87('0x18'))>moment()){return _0x59ede3(null,![],{'message':_0xcb87('0x13')});}else{return utils['clearBlockUser'](_0x5a006f,_0x1fa6f1,![],null)['then'](function(){return _0x59ede3(null,![],{'message':'Incorrect\x20username\x20and/or\x20password.\x20Please\x20retry\x20again\x20or\x20contact\x20the\x20administrator.'});});}}else{return _0x59ede3(null,![],{'message':_0xcb87('0x13')});}}else{if(_0x1fa6f1>=_0x10df30[_0xcb87('0x15')]){return utils[_0xcb87('0x19')](_0x5a006f,0x0,!![],moment())[_0xcb87('0xc')](function(){return _0x59ede3(null,![],{'message':_0xcb87('0x13')});});}else{return utils[_0xcb87('0x19')](_0x5a006f,_0x1fa6f1,![],null)[_0xcb87('0xc')](function(){return _0x59ede3(null,![],{'message':'Incorrect\x20username\x20and/or\x20password.\x20Please\x20retry\x20again\x20or\x20contact\x20the\x20administrator.'});});}}}else{return _0x59ede3(null,![],{'message':_0xcb87('0x13')});}}else{if(_0x5a006f['disabled']){return _0x59ede3(null,![],{'message':_0xcb87('0x13')});}else if(_0x10df30[_0xcb87('0x15')]>0x0){if(_0x5a006f[_0xcb87('0x16')]){if(_0x10df30[_0xcb87('0xb')]>0x0){if(moment(_0x5a006f[_0xcb87('0x1a')])[_0xcb87('0x17')](_0x10df30[_0xcb87('0xb')],_0xcb87('0x18'))>moment()){return _0x59ede3(null,![],{'message':'Incorrect\x20username\x20and/or\x20password.\x20Please\x20retry\x20again\x20or\x20contact\x20the\x20administrator.'});}else{return utils[_0xcb87('0x19')](_0x5a006f,0x0,![],null)[_0xcb87('0xc')](function(){return utils[_0xcb87('0x1b')](_0x5a006f);})['then'](function(){return _0x59ede3(null,_0x5a006f);});}}else{return _0x59ede3(null,![],{'message':_0xcb87('0x13')});}}else{return utils[_0xcb87('0x19')](_0x5a006f,0x0,![],null)['then'](function(){return utils[_0xcb87('0x1b')](_0x5a006f);})[_0xcb87('0xc')](function(){return _0x59ede3(null,_0x5a006f);})['catch'](function(_0x222b9a){return _0x59ede3(null,![],_0x222b9a);});}}else{if(_0x5a006f[_0xcb87('0x16')]){return _0x59ede3(null,![],{'message':_0xcb87('0x13')});}else{return utils[_0xcb87('0x1b')](_0x5a006f)[_0xcb87('0xc')](function(){return _0x59ede3(null,_0x5a006f);});}}}});})[_0xcb87('0x1c')](function(_0x4719d0){return _0x59ede3(null,![],_0x4719d0);});}function sendServiceMail(_0x114635){return db['MailAccount']['find']({'where':{'service':!![]},'attributes':['id',_0xcb87('0xd'),_0xcb87('0x1d')],'include':[{'model':db[_0xcb87('0x1e')],'as':_0xcb87('0x1f'),'include':[{'model':db[_0xcb87('0x20')],'as':_0xcb87('0x20')}]}]})[_0xcb87('0xc')](function(_0x404d7d){if(!_0x404d7d){throw new Error(_0xcb87('0x21'));}var _0x570a21=_0x404d7d[_0xcb87('0x22')]();var _0x5a0a4f={'account':_0x570a21,'message':_[_0xcb87('0x23')]({'from':util['format'](_0xcb87('0x24'),_0x404d7d[_0xcb87('0xd')],_0x404d7d['email']||_0x404d7d['Smtp'][_0xcb87('0x11')])},_0x114635)};return client[_0xcb87('0x25')](_0xcb87('0x26'),_0x5a0a4f);})['then'](function(_0xe405a3){if(_0xe405a3[_0xcb87('0x27')]){throw new Error(util[_0xcb87('0x28')](_0xcb87('0x29'),_0xe405a3['error'][_0xcb87('0x2a')]||JSON['stringify'](_0xe405a3['error'])));}return!![];});}function handleError(_0x3db9d9,_0x368e95,_0x2f1762){return _0x3db9d9[_0xcb87('0x2b')](_0x368e95||0x1f4)['send']({'message':_0x2f1762?_0x2f1762['message']||_0x2f1762:''});}exports[_0xcb87('0x2c')]=function(_0x4c6e4d,_0x421204,_0x38caa8){passport['authenticate']('local-login',function(_0x8786ac,_0x48c6c4,_0x137ebe){var _0x49bc4f=_0x8786ac||_0x137ebe;if(_0x49bc4f){return handleError(_0x421204,0x191,_0x49bc4f);}if(!_0x48c6c4){return handleError(_0x421204,0x194,{'message':_0xcb87('0x2d')});}else{var _0x3f3f3a={'payload':{'id':_0x48c6c4['id'],'role':_0x48c6c4[_0xcb87('0x2e')]},'options':{'expiresIn':0x15180}};return authService[_0xcb87('0x2f')](_0x3f3f3a)[_0xcb87('0xc')](function(_0x378cc4){_0x421204['json']({'id':_0x48c6c4['id'],'token':_0x378cc4,'statusCall':'','isAlreadyLogged':_0x48c6c4[_0xcb87('0x30')]});});}})(_0x4c6e4d,_0x421204,_0x38caa8);};exports[_0xcb87('0x31')]=function(_0x5c79a0,_0x17a165){if(!_0x5c79a0['body'][_0xcb87('0x1d')]){return handleError(_0x17a165,0x1f4,{'message':_0xcb87('0x32')});}var _0x1e49f1=rs['generate']();_0x5c79a0['body'][_0xcb87('0x1d')]=_0x5c79a0[_0xcb87('0x33')][_0xcb87('0x1d')][_0xcb87('0x34')]()[_0xcb87('0x35')]();var _0x146b38;return db[_0xcb87('0x9')]['findOne']({'where':{'id':0x1},'attributes':[_0xcb87('0x15'),'blockDuration'],'raw':!![]})[_0xcb87('0xc')](function(_0x1ddbbb){_0x146b38=_0x1ddbbb;return db['User'][_0xcb87('0x36')]({'where':{'email':_0x5c79a0[_0xcb87('0x33')][_0xcb87('0x1d')]}});})[_0xcb87('0xc')](function(_0x49f8d1){if(!_0x49f8d1){throw new Error(_0xcb87('0x37'));}if(_0x49f8d1[_0xcb87('0xf')]){throw new Error(_0xcb87('0x38'));}if(_0x49f8d1[_0xcb87('0x16')]){if(moment(_0x49f8d1[_0xcb87('0x1a')])[_0xcb87('0x17')](_0x146b38[_0xcb87('0xb')],_0xcb87('0x18'))>moment()){throw new Error(_0xcb87('0x39'));}else{_0x49f8d1['blocked']=![];_0x49f8d1[_0xcb87('0x1a')]=null;}}_0x49f8d1['resetPasswordToken']=_0x1e49f1;_0x49f8d1['resetPasswordExpires']=Date[_0xcb87('0x3a')]()+0x36ee80;return _0x49f8d1[_0xcb87('0x3b')]();})[_0xcb87('0xc')](function(){return sendServiceMail({'to':_0x5c79a0[_0xcb87('0x33')][_0xcb87('0x1d')],'subject':'xCally\x20Motion\x20Password\x20Reset','text':_0xcb87('0x3c')+'Please\x20click\x20on\x20the\x20following\x20link,\x20or\x20paste\x20this\x20into\x20your\x20browser\x20to\x20complete\x20the\x20process:\x0a\x0a'+_0xcb87('0x3d')+_0x5c79a0[_0xcb87('0x3e')]['host']+_0xcb87('0x3f')+_0x1e49f1+'\x0a\x0a'+_0xcb87('0x40')});})['then'](function(){_0x17a165[_0xcb87('0x2b')](0xc8)[_0xcb87('0x41')]({'message':'Reset\x20Email\x20sent!'});})[_0xcb87('0x1c')](function(_0x421aa2){return handleError(_0x17a165,0x1f4,_0x421aa2);});};exports['reset']=function(_0x34e114,_0x3df2e3){return db[_0xcb87('0x42')]['find']({'where':{'resetPasswordToken':_0x34e114['params'][_0xcb87('0x43')],'resetPasswordExpires':{'$gt':Date['now']()}}})[_0xcb87('0xc')](function(_0x929f34){if(!_0x929f34){throw new Error(_0xcb87('0x44'));}return db[_0xcb87('0x9')][_0xcb87('0xa')]({'attributes':['id','securePassword','enforcePasswordHistory',_0xcb87('0x45')]})['then'](function(_0x2cbbe5){if(_0x2cbbe5[_0xcb87('0x46')])authService[_0xcb87('0x47')](_0x34e114['body'][_0xcb87('0x48')]);if(!_0x2cbbe5[_0xcb87('0x49')]||!_0x929f34[_0xcb87('0x4a')])return _0x929f34;authService[_0xcb87('0x4b')](_0x34e114['body'][_0xcb87('0x48')],_0x929f34[_0xcb87('0x4a')],_0x2cbbe5['passwordHistoryLimit']);return _0x929f34;})[_0xcb87('0xc')](function(){_0x929f34[_0xcb87('0x48')]=_0x34e114[_0xcb87('0x33')][_0xcb87('0x48')];_0x929f34[_0xcb87('0x4c')]=null;_0x929f34[_0xcb87('0x4d')]=null;return _0x929f34[_0xcb87('0x3b')]();});})[_0xcb87('0xc')](function(){_0x3df2e3['status'](0xc8)['send']({'message':_0xcb87('0x4e')});})[_0xcb87('0x1c')](function(_0x43c91e){return handleError(_0x3df2e3,0x1f4,_0x43c91e);});};passport['use']('local-login',new LocalStrategy({'usernameField':_0xcb87('0xd'),'passwordField':_0xcb87('0x48')},function(_0x501f36,_0x3c4e4c,_0x1797f9){return localAuthenticate(db[_0xcb87('0x42')],_0x501f36,_0x3c4e4c,_0x1797f9);})); \ No newline at end of file diff --git a/server/api/authLocal/index.js b/server/api/authLocal/index.js index 1d4ba21..4a0a1d8 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 _0xd239=['/reset/:token','reset','post','login','/forgot','forgot'];(function(_0x126ee1,_0x4b9781){var _0x32524c=function(_0x2c7b1e){while(--_0x2c7b1e){_0x126ee1['push'](_0x126ee1['shift']());}};_0x32524c(++_0x4b9781);}(_0xd239,0xfe));var _0x9d23=function(_0x49ae93,_0x194c10){_0x49ae93=_0x49ae93-0x0;var _0x5eeb34=_0xd239[_0x49ae93];return _0x5eeb34;};'use strict';var express=require('express');var router=express['Router']();var controller=require('./authLocal.controller');router[_0x9d23('0x0')]('/',controller[_0x9d23('0x1')]);router['post'](_0x9d23('0x2'),controller[_0x9d23('0x3')]);router['post'](_0x9d23('0x4'),controller[_0x9d23('0x5')]);module['exports']=router; \ No newline at end of file +var _0xe7cc=['login','post','/forgot','forgot','/reset/:token','reset','express','Router','./authLocal.controller'];(function(_0x1aa723,_0x11ccf4){var _0x14ffb2=function(_0x972ade){while(--_0x972ade){_0x1aa723['push'](_0x1aa723['shift']());}};_0x14ffb2(++_0x11ccf4);}(_0xe7cc,0x102));var _0xce7c=function(_0x1725fa,_0x50bb11){_0x1725fa=_0x1725fa-0x0;var _0x1588d3=_0xe7cc[_0x1725fa];return _0x1588d3;};'use strict';var express=require(_0xce7c('0x0'));var router=express[_0xce7c('0x1')]();var controller=require(_0xce7c('0x2'));router['post']('/',controller[_0xce7c('0x3')]);router[_0xce7c('0x4')](_0xce7c('0x5'),controller[_0xce7c('0x6')]);router['post'](_0xce7c('0x7'),controller[_0xce7c('0x8')]);module['exports']=router; \ No newline at end of file diff --git a/server/api/automation/automation.attributes.js b/server/api/automation/automation.attributes.js index b9ca2f3..71d2567 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 _0x7a26=['BOOLEAN','INTEGER','sequelize','exports','STRING'];(function(_0x330f11,_0x3fd9b4){var _0x55a79e=function(_0x3a7d8b){while(--_0x3a7d8b){_0x330f11['push'](_0x330f11['shift']());}};_0x55a79e(++_0x3fd9b4);}(_0x7a26,0x124));var _0x67a2=function(_0x463ecd,_0x4c4801){_0x463ecd=_0x463ecd-0x0;var _0x29ba2b=_0x7a26[_0x463ecd];return _0x29ba2b;};'use strict';var Sequelize=require(_0x67a2('0x0'));module[_0x67a2('0x1')]={'name':{'type':Sequelize[_0x67a2('0x2')],'allowNull':![]},'channel':{'type':Sequelize[_0x67a2('0x2')]},'description':{'type':Sequelize[_0x67a2('0x2')]},'status':{'type':Sequelize[_0x67a2('0x3')],'defaultValue':![]},'timeout':{'type':Sequelize[_0x67a2('0x4')],'defaultValue':0xa}}; \ No newline at end of file +var _0x370a=['BOOLEAN','INTEGER','sequelize','exports'];(function(_0x3dd15e,_0x1f0015){var _0x231fd0=function(_0x4f680a){while(--_0x4f680a){_0x3dd15e['push'](_0x3dd15e['shift']());}};_0x231fd0(++_0x1f0015);}(_0x370a,0xb2));var _0xa370=function(_0x597798,_0x106cda){_0x597798=_0x597798-0x0;var _0xea2ac0=_0x370a[_0x597798];return _0xea2ac0;};'use strict';var Sequelize=require(_0xa370('0x0'));module[_0xa370('0x1')]={'name':{'type':Sequelize['STRING'],'allowNull':![]},'channel':{'type':Sequelize['STRING']},'description':{'type':Sequelize['STRING']},'status':{'type':Sequelize[_0xa370('0x2')],'defaultValue':![]},'timeout':{'type':Sequelize[_0xa370('0x3')],'defaultValue':0xa}}; \ No newline at end of file diff --git a/server/api/automation/automation.controller.js b/server/api/automation/automation.controller.js index 49c581e..a04a2e1 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 _0xb036=['getConditions','addActions','ids','getActions','eml-format','zip-dir','fast-json-patch','request-promise','moment','bluebird','mustache','path','to-csv','ejs','fs-extra','lodash','squel','crypto','jsforce','desk.js','querystring','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','sendStatus','status','end','json','offset','limit','undefined','count','set','Content-Range','apply','then','destroy','error','name','send','index','map','fieldName','model','query','keys','intersection','attributes','fields','length','hasOwnProperty','nolimit','order','sort','where','filters','pick','filter','type','VIRTUAL','merge','includeAll','include','Automation','findAll','catch','show','params','rawAttributes','options','find','create','body','update','addConditions','omit','findOne','Condition'];(function(_0x1a7c1c,_0x492841){var _0xac2979=function(_0x3fa328){while(--_0x3fa328){_0x1a7c1c['push'](_0x1a7c1c['shift']());}};_0xac2979(++_0x492841);}(_0xb036,0x15c));var _0x6b03=function(_0xf1bf64,_0x4d1dd0){_0xf1bf64=_0xf1bf64-0x0;var _0x1834ce=_0xb036[_0xf1bf64];return _0x1834ce;};'use strict';var emlformat=require(_0x6b03('0x0'));var rimraf=require('rimraf');var zipdir=require(_0x6b03('0x1'));var jsonpatch=require(_0x6b03('0x2'));var rp=require(_0x6b03('0x3'));var moment=require(_0x6b03('0x4'));var BPromise=require(_0x6b03('0x5'));var Mustache=require(_0x6b03('0x6'));var util=require('util');var path=require(_0x6b03('0x7'));var sox=require('sox');var csv=require(_0x6b03('0x8'));var ejs=require(_0x6b03('0x9'));var fs=require('fs');var fs_extra=require(_0x6b03('0xa'));var _=require(_0x6b03('0xb'));var squel=require(_0x6b03('0xc'));var crypto=require(_0x6b03('0xd'));var jsforce=require(_0x6b03('0xe'));var deskjs=require(_0x6b03('0xf'));var toCsv=require('to-csv');var querystring=require(_0x6b03('0x10'));var Papa=require('papaparse');var Redis=require(_0x6b03('0x11'));var authService=require(_0x6b03('0x12'));var qs=require(_0x6b03('0x13'));var as=require(_0x6b03('0x14'));var hardwareService=require(_0x6b03('0x15'));var logger=require(_0x6b03('0x16'))(_0x6b03('0x17'));var utils=require(_0x6b03('0x18'));var config=require(_0x6b03('0x19'));var licenseUtil=require(_0x6b03('0x1a'));var db=require(_0x6b03('0x1b'))['db'];function respondWithStatusCode(_0x53ea57,_0x1231bf){_0x1231bf=_0x1231bf||0xcc;return function(_0x3f9585){if(_0x3f9585){return _0x53ea57[_0x6b03('0x1c')](_0x1231bf);}return _0x53ea57[_0x6b03('0x1d')](_0x1231bf)[_0x6b03('0x1e')]();};}function respondWithResult(_0x4e6992,_0x1f90a8){_0x1f90a8=_0x1f90a8||0xc8;return function(_0x10bf17){if(_0x10bf17){return _0x4e6992['status'](_0x1f90a8)[_0x6b03('0x1f')](_0x10bf17);}};}function respondWithFilteredResult(_0x2f7d0c,_0x77bcd4){return function(_0x1ca4b9){if(_0x1ca4b9){var _0x50ce7e=typeof _0x77bcd4[_0x6b03('0x20')]==='undefined'&&typeof _0x77bcd4[_0x6b03('0x21')]===_0x6b03('0x22');var _0x517722=_0x1ca4b9[_0x6b03('0x23')];var _0x43866e=_0x50ce7e?0x0:_0x77bcd4[_0x6b03('0x20')];var _0x4c47ad=_0x50ce7e?_0x1ca4b9['count']:_0x77bcd4[_0x6b03('0x20')]+_0x77bcd4[_0x6b03('0x21')];var _0x1bd93c;if(_0x4c47ad>=_0x517722){_0x4c47ad=_0x517722;_0x1bd93c=0xc8;}else{_0x1bd93c=0xce;}_0x2f7d0c[_0x6b03('0x1d')](_0x1bd93c);return _0x2f7d0c[_0x6b03('0x24')](_0x6b03('0x25'),_0x43866e+'-'+_0x4c47ad+'/'+_0x517722)[_0x6b03('0x1f')](_0x1ca4b9);}return null;};}function patchUpdates(_0x5cf406){return function(_0x167fbc){try{jsonpatch[_0x6b03('0x26')](_0x167fbc,_0x5cf406,!![]);}catch(_0x6760cb){return BPromise['reject'](_0x6760cb);}return _0x167fbc['save']();};}function saveUpdates(_0xbb2ead,_0x455835){return function(_0x2ca0c6){if(_0x2ca0c6){return _0x2ca0c6['update'](_0xbb2ead)[_0x6b03('0x27')](function(_0x4ca537){return _0x4ca537;});}return null;};}function removeEntity(_0x5efa8d,_0x345ad3){return function(_0x241201){if(_0x241201){return _0x241201[_0x6b03('0x28')]()[_0x6b03('0x27')](function(){_0x5efa8d[_0x6b03('0x1d')](0xcc)[_0x6b03('0x1e')]();});}};}function handleEntityNotFound(_0x3b53d3,_0x185abc){return function(_0x505ce3){if(!_0x505ce3){_0x3b53d3[_0x6b03('0x1c')](0x194);}return _0x505ce3;};}function handleError(_0xb2ff50,_0x4d76fe){_0x4d76fe=_0x4d76fe||0x1f4;return function(_0x2449a1){logger[_0x6b03('0x29')](_0x2449a1['stack']);if(_0x2449a1['name']){delete _0x2449a1[_0x6b03('0x2a')];}_0xb2ff50[_0x6b03('0x1d')](_0x4d76fe)[_0x6b03('0x2b')](_0x2449a1);};}exports[_0x6b03('0x2c')]=function(_0x19e360,_0xbc2489){var _0x225072={},_0x27cf09={},_0x11271e={'count':0x0,'rows':[]};var _0x5f1ec9=_[_0x6b03('0x2d')](db['Automation']['rawAttributes'],function(_0xc6946c){return{'name':_0xc6946c[_0x6b03('0x2e')],'type':_0xc6946c['type']['key']};});_0x27cf09[_0x6b03('0x2f')]=_[_0x6b03('0x2d')](_0x5f1ec9,'name');_0x27cf09[_0x6b03('0x30')]=_[_0x6b03('0x31')](_0x19e360['query']);_0x27cf09['filters']=_[_0x6b03('0x32')](_0x27cf09['model'],_0x27cf09['query']);_0x225072[_0x6b03('0x33')]=_[_0x6b03('0x32')](_0x27cf09[_0x6b03('0x2f')],qs['fields'](_0x19e360[_0x6b03('0x30')][_0x6b03('0x34')]));_0x225072['attributes']=_0x225072[_0x6b03('0x33')][_0x6b03('0x35')]?_0x225072[_0x6b03('0x33')]:_0x27cf09[_0x6b03('0x2f')];if(!_0x19e360['query'][_0x6b03('0x36')](_0x6b03('0x37'))){_0x225072[_0x6b03('0x21')]=qs['limit'](_0x19e360[_0x6b03('0x30')][_0x6b03('0x21')]);_0x225072[_0x6b03('0x20')]=qs['offset'](_0x19e360[_0x6b03('0x30')][_0x6b03('0x20')]);}_0x225072[_0x6b03('0x38')]=qs[_0x6b03('0x39')](_0x19e360[_0x6b03('0x30')]['sort']);_0x225072[_0x6b03('0x3a')]=qs[_0x6b03('0x3b')](_[_0x6b03('0x3c')](_0x19e360[_0x6b03('0x30')],_0x27cf09[_0x6b03('0x3b')]),_0x5f1ec9);if(_0x19e360[_0x6b03('0x30')][_0x6b03('0x3d')]){_0x225072[_0x6b03('0x3a')]=_['merge'](_0x225072[_0x6b03('0x3a')],{'$or':_['map'](_0x5f1ec9,function(_0xd51e75){if(_0xd51e75[_0x6b03('0x3e')]!==_0x6b03('0x3f')){var _0x13d578={};_0x13d578[_0xd51e75[_0x6b03('0x2a')]]={'$like':'%'+_0x19e360['query'][_0x6b03('0x3d')]+'%'};return _0x13d578;}})});}_0x225072=_[_0x6b03('0x40')]({},_0x225072,_0x19e360['options']);var _0x1e6543={'where':_0x225072['where']};return db['Automation']['count'](_0x1e6543)[_0x6b03('0x27')](function(_0x2f978a){_0x11271e[_0x6b03('0x23')]=_0x2f978a;if(_0x19e360[_0x6b03('0x30')][_0x6b03('0x41')]){_0x225072[_0x6b03('0x42')]=[{'all':!![]}];}return db[_0x6b03('0x43')][_0x6b03('0x44')](_0x225072);})['then'](function(_0x403d06){_0x11271e['rows']=_0x403d06;return _0x11271e;})[_0x6b03('0x27')](respondWithFilteredResult(_0xbc2489,_0x225072))[_0x6b03('0x45')](handleError(_0xbc2489,null));};exports[_0x6b03('0x46')]=function(_0x4534c5,_0x164fbc){var _0xe60b8a={'raw':![],'where':{'id':_0x4534c5[_0x6b03('0x47')]['id']}},_0x1b705a={};_0x1b705a[_0x6b03('0x2f')]=_[_0x6b03('0x31')](db[_0x6b03('0x43')][_0x6b03('0x48')]);_0x1b705a[_0x6b03('0x30')]=_[_0x6b03('0x31')](_0x4534c5[_0x6b03('0x30')]);_0x1b705a['filters']=_[_0x6b03('0x32')](_0x1b705a['model'],_0x1b705a[_0x6b03('0x30')]);_0xe60b8a[_0x6b03('0x33')]=_[_0x6b03('0x32')](_0x1b705a[_0x6b03('0x2f')],qs[_0x6b03('0x34')](_0x4534c5['query'][_0x6b03('0x34')]));_0xe60b8a[_0x6b03('0x33')]=_0xe60b8a[_0x6b03('0x33')][_0x6b03('0x35')]?_0xe60b8a['attributes']:_0x1b705a[_0x6b03('0x2f')];if(_0x4534c5[_0x6b03('0x30')][_0x6b03('0x41')]){_0xe60b8a[_0x6b03('0x42')]=[{'all':!![]}];}_0xe60b8a=_[_0x6b03('0x40')]({},_0xe60b8a,_0x4534c5[_0x6b03('0x49')]);return db[_0x6b03('0x43')][_0x6b03('0x4a')](_0xe60b8a)[_0x6b03('0x27')](handleEntityNotFound(_0x164fbc,null))[_0x6b03('0x27')](respondWithResult(_0x164fbc,null))[_0x6b03('0x45')](handleError(_0x164fbc,null));};exports['create']=function(_0x29682a,_0x286b11){return db[_0x6b03('0x43')][_0x6b03('0x4b')](_0x29682a[_0x6b03('0x4c')],{})[_0x6b03('0x27')](respondWithResult(_0x286b11,0xc9))['catch'](handleError(_0x286b11,null));};exports[_0x6b03('0x4d')]=function(_0x422e17,_0x3f05a2){if(_0x422e17[_0x6b03('0x4c')]['id']){delete _0x422e17[_0x6b03('0x4c')]['id'];}return db[_0x6b03('0x43')]['find']({'where':{'id':_0x422e17[_0x6b03('0x47')]['id']}})['then'](handleEntityNotFound(_0x3f05a2,null))[_0x6b03('0x27')](saveUpdates(_0x422e17[_0x6b03('0x4c')],null))[_0x6b03('0x27')](respondWithResult(_0x3f05a2,null))[_0x6b03('0x45')](handleError(_0x3f05a2,null));};exports[_0x6b03('0x28')]=function(_0x2f2751,_0x2f17db){return db[_0x6b03('0x43')]['find']({'where':{'id':_0x2f2751[_0x6b03('0x47')]['id']}})[_0x6b03('0x27')](handleEntityNotFound(_0x2f17db,null))[_0x6b03('0x27')](removeEntity(_0x2f17db,null))['catch'](handleError(_0x2f17db,null));};exports[_0x6b03('0x4e')]=function(_0x2790ff,_0x582227,_0x3b3ed0){return db['Condition'][_0x6b03('0x4a')]({'where':{'id':_0x2790ff['params']['id']}})[_0x6b03('0x27')](handleEntityNotFound(_0x582227,null))[_0x6b03('0x27')](function(_0x245f54){if(_0x245f54){return _0x245f54[_0x6b03('0x4e')](_0x2790ff[_0x6b03('0x4c')]['ids'],_[_0x6b03('0x4f')](_0x2790ff[_0x6b03('0x4c')],['ids','id'])||{});}})[_0x6b03('0x27')](respondWithResult(_0x582227,null))[_0x6b03('0x45')](handleError(_0x582227,null));};exports['getConditions']=function(_0x50d9f6,_0x27fcfb,_0x2d13a6){var _0x41da41={};var _0x2a881f={};var _0x59fb68;var _0x710dbf;return db[_0x6b03('0x43')][_0x6b03('0x50')]({'where':{'id':_0x50d9f6['params']['id']}})[_0x6b03('0x27')](handleEntityNotFound(_0x27fcfb,null))[_0x6b03('0x27')](function(_0x52b221){if(_0x52b221){_0x59fb68=_0x52b221;_0x2a881f[_0x6b03('0x2f')]=_[_0x6b03('0x31')](db[_0x6b03('0x51')][_0x6b03('0x48')]);_0x2a881f['query']=_[_0x6b03('0x31')](_0x50d9f6[_0x6b03('0x30')]);_0x2a881f[_0x6b03('0x3b')]=_[_0x6b03('0x32')](_0x2a881f[_0x6b03('0x2f')],_0x2a881f[_0x6b03('0x30')]);_0x41da41[_0x6b03('0x33')]=_['intersection'](_0x2a881f[_0x6b03('0x2f')],qs['fields'](_0x50d9f6[_0x6b03('0x30')][_0x6b03('0x34')]));_0x41da41[_0x6b03('0x33')]=_0x41da41[_0x6b03('0x33')][_0x6b03('0x35')]?_0x41da41['attributes']:_0x2a881f[_0x6b03('0x2f')];_0x41da41['order']=qs['sort'](_0x50d9f6[_0x6b03('0x30')][_0x6b03('0x39')]);_0x41da41[_0x6b03('0x3a')]=qs[_0x6b03('0x3b')](_[_0x6b03('0x3c')](_0x50d9f6[_0x6b03('0x30')],_0x2a881f['filters']));if(_0x50d9f6[_0x6b03('0x30')]['filter']){_0x41da41[_0x6b03('0x3a')]=_[_0x6b03('0x40')](_0x41da41[_0x6b03('0x3a')],{'$or':_[_0x6b03('0x2d')](_0x41da41[_0x6b03('0x33')],function(_0x473ede){var _0x2dee99={};_0x2dee99[_0x473ede]={'$like':'%'+_0x50d9f6[_0x6b03('0x30')][_0x6b03('0x3d')]+'%'};return _0x2dee99;})});}_0x41da41=_[_0x6b03('0x40')]({},_0x41da41,_0x50d9f6[_0x6b03('0x49')]);return _0x59fb68[_0x6b03('0x52')](_0x41da41);}})[_0x6b03('0x27')](function(_0x34de80){if(_0x34de80){_0x710dbf=_0x34de80[_0x6b03('0x35')];if(!_0x50d9f6[_0x6b03('0x30')][_0x6b03('0x36')]('nolimit')){_0x41da41[_0x6b03('0x21')]=qs[_0x6b03('0x21')](_0x50d9f6[_0x6b03('0x30')]['limit']);_0x41da41[_0x6b03('0x20')]=qs[_0x6b03('0x20')](_0x50d9f6['query'][_0x6b03('0x20')]);}return _0x59fb68['getConditions'](_0x41da41);}})[_0x6b03('0x27')](function(_0x112b02){if(_0x112b02){return _0x112b02?{'count':_0x710dbf,'rows':_0x112b02}:null;}})[_0x6b03('0x27')](respondWithResult(_0x27fcfb,null))['catch'](handleError(_0x27fcfb,null));};exports['addActions']=function(_0x303c06,_0x4dd421,_0x21126d){return db['Action'][_0x6b03('0x4a')]({'where':{'id':_0x303c06[_0x6b03('0x47')]['id']}})[_0x6b03('0x27')](handleEntityNotFound(_0x4dd421,null))['then'](function(_0x4e7664){if(_0x4e7664){return _0x4e7664[_0x6b03('0x53')](_0x303c06[_0x6b03('0x4c')][_0x6b03('0x54')],_[_0x6b03('0x4f')](_0x303c06['body'],['ids','id'])||{});}})[_0x6b03('0x27')](respondWithResult(_0x4dd421,null))['catch'](handleError(_0x4dd421,null));};exports['getActions']=function(_0x297ea3,_0x5c9f56,_0x48dd97){var _0x2578f3={};var _0x1a3dcf={};var _0x479eb3;var _0x50f2c3;return db[_0x6b03('0x43')]['findOne']({'where':{'id':_0x297ea3['params']['id']}})['then'](handleEntityNotFound(_0x5c9f56,null))[_0x6b03('0x27')](function(_0x85e9d7){if(_0x85e9d7){_0x479eb3=_0x85e9d7;_0x1a3dcf['model']=_[_0x6b03('0x31')](db['Action'][_0x6b03('0x48')]);_0x1a3dcf[_0x6b03('0x30')]=_[_0x6b03('0x31')](_0x297ea3[_0x6b03('0x30')]);_0x1a3dcf['filters']=_[_0x6b03('0x32')](_0x1a3dcf[_0x6b03('0x2f')],_0x1a3dcf[_0x6b03('0x30')]);_0x2578f3['attributes']=_[_0x6b03('0x32')](_0x1a3dcf['model'],qs[_0x6b03('0x34')](_0x297ea3['query'][_0x6b03('0x34')]));_0x2578f3['attributes']=_0x2578f3['attributes'][_0x6b03('0x35')]?_0x2578f3[_0x6b03('0x33')]:_0x1a3dcf[_0x6b03('0x2f')];_0x2578f3[_0x6b03('0x38')]=qs[_0x6b03('0x39')](_0x297ea3[_0x6b03('0x30')][_0x6b03('0x39')]);_0x2578f3[_0x6b03('0x3a')]=qs[_0x6b03('0x3b')](_[_0x6b03('0x3c')](_0x297ea3['query'],_0x1a3dcf[_0x6b03('0x3b')]));if(_0x297ea3[_0x6b03('0x30')][_0x6b03('0x3d')]){_0x2578f3[_0x6b03('0x3a')]=_['merge'](_0x2578f3[_0x6b03('0x3a')],{'$or':_['map'](_0x2578f3['attributes'],function(_0x24e042){var _0x3cf287={};_0x3cf287[_0x24e042]={'$like':'%'+_0x297ea3[_0x6b03('0x30')][_0x6b03('0x3d')]+'%'};return _0x3cf287;})});}_0x2578f3=_[_0x6b03('0x40')]({},_0x2578f3,_0x297ea3[_0x6b03('0x49')]);return _0x479eb3[_0x6b03('0x55')](_0x2578f3);}})['then'](function(_0x3899e0){if(_0x3899e0){_0x50f2c3=_0x3899e0[_0x6b03('0x35')];if(!_0x297ea3[_0x6b03('0x30')]['hasOwnProperty'](_0x6b03('0x37'))){_0x2578f3[_0x6b03('0x21')]=qs[_0x6b03('0x21')](_0x297ea3[_0x6b03('0x30')][_0x6b03('0x21')]);_0x2578f3['offset']=qs[_0x6b03('0x20')](_0x297ea3[_0x6b03('0x30')][_0x6b03('0x20')]);}return _0x479eb3[_0x6b03('0x55')](_0x2578f3);}})[_0x6b03('0x27')](function(_0x57c35a){if(_0x57c35a){return _0x57c35a?{'count':_0x50f2c3,'rows':_0x57c35a}:null;}})[_0x6b03('0x27')](respondWithResult(_0x5c9f56,null))['catch'](handleError(_0x5c9f56,null));}; \ No newline at end of file +var _0x70ee=['reject','save','then','destroy','sendStatus','error','stack','name','send','index','Automation','rawAttributes','fieldName','type','key','model','map','keys','query','filters','intersection','attributes','fields','length','hasOwnProperty','order','sort','where','pick','filter','merge','VIRTUAL','options','includeAll','include','findAll','rows','catch','params','create','body','update','find','addConditions','ids','omit','getConditions','findOne','Condition','addActions','Action','getActions','nolimit','eml-format','zip-dir','request-promise','moment','bluebird','mustache','util','path','sox','to-csv','ejs','fs-extra','crypto','jsforce','querystring','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/environment','../../mysqldb','end','status','json','limit','count','offset','set','Content-Range','apply'];(function(_0x1e9d62,_0x25bb8e){var _0x56c490=function(_0x19f4e7){while(--_0x19f4e7){_0x1e9d62['push'](_0x1e9d62['shift']());}};_0x56c490(++_0x25bb8e);}(_0x70ee,0x1e3));var _0xe70e=function(_0x3248e8,_0x57b9ae){_0x3248e8=_0x3248e8-0x0;var _0x1a1373=_0x70ee[_0x3248e8];return _0x1a1373;};'use strict';var emlformat=require(_0xe70e('0x0'));var rimraf=require('rimraf');var zipdir=require(_0xe70e('0x1'));var jsonpatch=require('fast-json-patch');var rp=require(_0xe70e('0x2'));var moment=require(_0xe70e('0x3'));var BPromise=require(_0xe70e('0x4'));var Mustache=require(_0xe70e('0x5'));var util=require(_0xe70e('0x6'));var path=require(_0xe70e('0x7'));var sox=require(_0xe70e('0x8'));var csv=require(_0xe70e('0x9'));var ejs=require(_0xe70e('0xa'));var fs=require('fs');var fs_extra=require(_0xe70e('0xb'));var _=require('lodash');var squel=require('squel');var crypto=require(_0xe70e('0xc'));var jsforce=require(_0xe70e('0xd'));var deskjs=require('desk.js');var toCsv=require(_0xe70e('0x9'));var querystring=require(_0xe70e('0xe'));var Papa=require('papaparse');var Redis=require('ioredis');var authService=require(_0xe70e('0xf'));var qs=require(_0xe70e('0x10'));var as=require(_0xe70e('0x11'));var hardwareService=require(_0xe70e('0x12'));var logger=require(_0xe70e('0x13'))(_0xe70e('0x14'));var utils=require(_0xe70e('0x15'));var config=require(_0xe70e('0x16'));var licenseUtil=require('../../config/license/util');var db=require(_0xe70e('0x17'))['db'];function respondWithStatusCode(_0x50103e,_0x8ec2d0){_0x8ec2d0=_0x8ec2d0||0xcc;return function(_0x4e679c){if(_0x4e679c){return _0x50103e['sendStatus'](_0x8ec2d0);}return _0x50103e['status'](_0x8ec2d0)[_0xe70e('0x18')]();};}function respondWithResult(_0x5efd5e,_0x47844d){_0x47844d=_0x47844d||0xc8;return function(_0x313d50){if(_0x313d50){return _0x5efd5e[_0xe70e('0x19')](_0x47844d)[_0xe70e('0x1a')](_0x313d50);}};}function respondWithFilteredResult(_0x25d2d8,_0x10877){return function(_0x2b0088){if(_0x2b0088){var _0xd365d9=typeof _0x10877['offset']==='undefined'&&typeof _0x10877[_0xe70e('0x1b')]==='undefined';var _0x24e414=_0x2b0088[_0xe70e('0x1c')];var _0x1dad75=_0xd365d9?0x0:_0x10877[_0xe70e('0x1d')];var _0x3a2392=_0xd365d9?_0x2b0088[_0xe70e('0x1c')]:_0x10877[_0xe70e('0x1d')]+_0x10877[_0xe70e('0x1b')];var _0x3e5e59;if(_0x3a2392>=_0x24e414){_0x3a2392=_0x24e414;_0x3e5e59=0xc8;}else{_0x3e5e59=0xce;}_0x25d2d8[_0xe70e('0x19')](_0x3e5e59);return _0x25d2d8[_0xe70e('0x1e')](_0xe70e('0x1f'),_0x1dad75+'-'+_0x3a2392+'/'+_0x24e414)[_0xe70e('0x1a')](_0x2b0088);}return null;};}function patchUpdates(_0x2f39be){return function(_0xd56daa){try{jsonpatch[_0xe70e('0x20')](_0xd56daa,_0x2f39be,!![]);}catch(_0x282017){return BPromise[_0xe70e('0x21')](_0x282017);}return _0xd56daa[_0xe70e('0x22')]();};}function saveUpdates(_0x18d994,_0x5329bb){return function(_0x122f73){if(_0x122f73){return _0x122f73['update'](_0x18d994)[_0xe70e('0x23')](function(_0x3fd4ea){return _0x3fd4ea;});}return null;};}function removeEntity(_0x8aa85b,_0x246609){return function(_0x123673){if(_0x123673){return _0x123673[_0xe70e('0x24')]()[_0xe70e('0x23')](function(){_0x8aa85b[_0xe70e('0x19')](0xcc)[_0xe70e('0x18')]();});}};}function handleEntityNotFound(_0x4d89a6,_0x4908b7){return function(_0x2e9dea){if(!_0x2e9dea){_0x4d89a6[_0xe70e('0x25')](0x194);}return _0x2e9dea;};}function handleError(_0x2ab976,_0x3944f4){_0x3944f4=_0x3944f4||0x1f4;return function(_0x37214b){logger[_0xe70e('0x26')](_0x37214b[_0xe70e('0x27')]);if(_0x37214b[_0xe70e('0x28')]){delete _0x37214b[_0xe70e('0x28')];}_0x2ab976[_0xe70e('0x19')](_0x3944f4)[_0xe70e('0x29')](_0x37214b);};}exports[_0xe70e('0x2a')]=function(_0x4fc8c6,_0x1a2aa2){var _0x5a71c6={},_0x144916={},_0x153ca5={'count':0x0,'rows':[]};var _0x413136=_['map'](db[_0xe70e('0x2b')][_0xe70e('0x2c')],function(_0x4b9b7a){return{'name':_0x4b9b7a[_0xe70e('0x2d')],'type':_0x4b9b7a[_0xe70e('0x2e')][_0xe70e('0x2f')]};});_0x144916[_0xe70e('0x30')]=_[_0xe70e('0x31')](_0x413136,_0xe70e('0x28'));_0x144916['query']=_[_0xe70e('0x32')](_0x4fc8c6[_0xe70e('0x33')]);_0x144916[_0xe70e('0x34')]=_[_0xe70e('0x35')](_0x144916['model'],_0x144916['query']);_0x5a71c6[_0xe70e('0x36')]=_[_0xe70e('0x35')](_0x144916[_0xe70e('0x30')],qs[_0xe70e('0x37')](_0x4fc8c6[_0xe70e('0x33')][_0xe70e('0x37')]));_0x5a71c6[_0xe70e('0x36')]=_0x5a71c6[_0xe70e('0x36')][_0xe70e('0x38')]?_0x5a71c6[_0xe70e('0x36')]:_0x144916[_0xe70e('0x30')];if(!_0x4fc8c6[_0xe70e('0x33')][_0xe70e('0x39')]('nolimit')){_0x5a71c6[_0xe70e('0x1b')]=qs[_0xe70e('0x1b')](_0x4fc8c6[_0xe70e('0x33')][_0xe70e('0x1b')]);_0x5a71c6[_0xe70e('0x1d')]=qs['offset'](_0x4fc8c6[_0xe70e('0x33')][_0xe70e('0x1d')]);}_0x5a71c6[_0xe70e('0x3a')]=qs[_0xe70e('0x3b')](_0x4fc8c6[_0xe70e('0x33')][_0xe70e('0x3b')]);_0x5a71c6[_0xe70e('0x3c')]=qs[_0xe70e('0x34')](_[_0xe70e('0x3d')](_0x4fc8c6[_0xe70e('0x33')],_0x144916['filters']),_0x413136);if(_0x4fc8c6[_0xe70e('0x33')][_0xe70e('0x3e')]){_0x5a71c6['where']=_[_0xe70e('0x3f')](_0x5a71c6[_0xe70e('0x3c')],{'$or':_[_0xe70e('0x31')](_0x413136,function(_0x11e018){if(_0x11e018[_0xe70e('0x2e')]!==_0xe70e('0x40')){var _0x20232e={};_0x20232e[_0x11e018[_0xe70e('0x28')]]={'$like':'%'+_0x4fc8c6[_0xe70e('0x33')][_0xe70e('0x3e')]+'%'};return _0x20232e;}})});}_0x5a71c6=_[_0xe70e('0x3f')]({},_0x5a71c6,_0x4fc8c6[_0xe70e('0x41')]);var _0xf47921={'where':_0x5a71c6[_0xe70e('0x3c')]};return db['Automation'][_0xe70e('0x1c')](_0xf47921)[_0xe70e('0x23')](function(_0x115496){_0x153ca5[_0xe70e('0x1c')]=_0x115496;if(_0x4fc8c6[_0xe70e('0x33')][_0xe70e('0x42')]){_0x5a71c6[_0xe70e('0x43')]=[{'all':!![]}];}return db[_0xe70e('0x2b')][_0xe70e('0x44')](_0x5a71c6);})[_0xe70e('0x23')](function(_0x474dc0){_0x153ca5[_0xe70e('0x45')]=_0x474dc0;return _0x153ca5;})[_0xe70e('0x23')](respondWithFilteredResult(_0x1a2aa2,_0x5a71c6))[_0xe70e('0x46')](handleError(_0x1a2aa2,null));};exports['show']=function(_0x43242d,_0x6bac5c){var _0x174542={'raw':![],'where':{'id':_0x43242d[_0xe70e('0x47')]['id']}},_0x5b8989={};_0x5b8989[_0xe70e('0x30')]=_['keys'](db['Automation']['rawAttributes']);_0x5b8989[_0xe70e('0x33')]=_[_0xe70e('0x32')](_0x43242d[_0xe70e('0x33')]);_0x5b8989['filters']=_[_0xe70e('0x35')](_0x5b8989[_0xe70e('0x30')],_0x5b8989[_0xe70e('0x33')]);_0x174542['attributes']=_[_0xe70e('0x35')](_0x5b8989[_0xe70e('0x30')],qs[_0xe70e('0x37')](_0x43242d['query'][_0xe70e('0x37')]));_0x174542[_0xe70e('0x36')]=_0x174542[_0xe70e('0x36')]['length']?_0x174542[_0xe70e('0x36')]:_0x5b8989[_0xe70e('0x30')];if(_0x43242d[_0xe70e('0x33')][_0xe70e('0x42')]){_0x174542[_0xe70e('0x43')]=[{'all':!![]}];}_0x174542=_[_0xe70e('0x3f')]({},_0x174542,_0x43242d[_0xe70e('0x41')]);return db[_0xe70e('0x2b')]['find'](_0x174542)[_0xe70e('0x23')](handleEntityNotFound(_0x6bac5c,null))['then'](respondWithResult(_0x6bac5c,null))['catch'](handleError(_0x6bac5c,null));};exports[_0xe70e('0x48')]=function(_0x3bd2db,_0xdfb2ea){return db['Automation'][_0xe70e('0x48')](_0x3bd2db[_0xe70e('0x49')],{})[_0xe70e('0x23')](respondWithResult(_0xdfb2ea,0xc9))[_0xe70e('0x46')](handleError(_0xdfb2ea,null));};exports[_0xe70e('0x4a')]=function(_0x21190b,_0x58de62){if(_0x21190b['body']['id']){delete _0x21190b[_0xe70e('0x49')]['id'];}return db[_0xe70e('0x2b')]['find']({'where':{'id':_0x21190b[_0xe70e('0x47')]['id']}})[_0xe70e('0x23')](handleEntityNotFound(_0x58de62,null))['then'](saveUpdates(_0x21190b[_0xe70e('0x49')],null))['then'](respondWithResult(_0x58de62,null))[_0xe70e('0x46')](handleError(_0x58de62,null));};exports[_0xe70e('0x24')]=function(_0x35be91,_0x3af351){return db[_0xe70e('0x2b')][_0xe70e('0x4b')]({'where':{'id':_0x35be91[_0xe70e('0x47')]['id']}})['then'](handleEntityNotFound(_0x3af351,null))[_0xe70e('0x23')](removeEntity(_0x3af351,null))['catch'](handleError(_0x3af351,null));};exports[_0xe70e('0x4c')]=function(_0x27723f,_0x332542,_0x4b0ae9){return db['Condition'][_0xe70e('0x4b')]({'where':{'id':_0x27723f[_0xe70e('0x47')]['id']}})['then'](handleEntityNotFound(_0x332542,null))[_0xe70e('0x23')](function(_0x482ffd){if(_0x482ffd){return _0x482ffd[_0xe70e('0x4c')](_0x27723f[_0xe70e('0x49')][_0xe70e('0x4d')],_[_0xe70e('0x4e')](_0x27723f[_0xe70e('0x49')],[_0xe70e('0x4d'),'id'])||{});}})['then'](respondWithResult(_0x332542,null))[_0xe70e('0x46')](handleError(_0x332542,null));};exports[_0xe70e('0x4f')]=function(_0xe3e8d5,_0x55574d,_0x52d1fc){var _0xb1ab6c={};var _0x393eca={};var _0xe31057;var _0x3ba15b;return db[_0xe70e('0x2b')][_0xe70e('0x50')]({'where':{'id':_0xe3e8d5[_0xe70e('0x47')]['id']}})[_0xe70e('0x23')](handleEntityNotFound(_0x55574d,null))[_0xe70e('0x23')](function(_0x51687f){if(_0x51687f){_0xe31057=_0x51687f;_0x393eca['model']=_[_0xe70e('0x32')](db[_0xe70e('0x51')]['rawAttributes']);_0x393eca[_0xe70e('0x33')]=_[_0xe70e('0x32')](_0xe3e8d5[_0xe70e('0x33')]);_0x393eca[_0xe70e('0x34')]=_['intersection'](_0x393eca[_0xe70e('0x30')],_0x393eca[_0xe70e('0x33')]);_0xb1ab6c['attributes']=_['intersection'](_0x393eca['model'],qs[_0xe70e('0x37')](_0xe3e8d5[_0xe70e('0x33')][_0xe70e('0x37')]));_0xb1ab6c['attributes']=_0xb1ab6c[_0xe70e('0x36')][_0xe70e('0x38')]?_0xb1ab6c['attributes']:_0x393eca[_0xe70e('0x30')];_0xb1ab6c[_0xe70e('0x3a')]=qs[_0xe70e('0x3b')](_0xe3e8d5[_0xe70e('0x33')]['sort']);_0xb1ab6c[_0xe70e('0x3c')]=qs[_0xe70e('0x34')](_[_0xe70e('0x3d')](_0xe3e8d5[_0xe70e('0x33')],_0x393eca[_0xe70e('0x34')]));if(_0xe3e8d5['query'][_0xe70e('0x3e')]){_0xb1ab6c[_0xe70e('0x3c')]=_['merge'](_0xb1ab6c[_0xe70e('0x3c')],{'$or':_['map'](_0xb1ab6c[_0xe70e('0x36')],function(_0x80de2d){var _0x410446={};_0x410446[_0x80de2d]={'$like':'%'+_0xe3e8d5[_0xe70e('0x33')][_0xe70e('0x3e')]+'%'};return _0x410446;})});}_0xb1ab6c=_['merge']({},_0xb1ab6c,_0xe3e8d5[_0xe70e('0x41')]);return _0xe31057[_0xe70e('0x4f')](_0xb1ab6c);}})[_0xe70e('0x23')](function(_0x24d8f7){if(_0x24d8f7){_0x3ba15b=_0x24d8f7[_0xe70e('0x38')];if(!_0xe3e8d5['query'][_0xe70e('0x39')]('nolimit')){_0xb1ab6c[_0xe70e('0x1b')]=qs[_0xe70e('0x1b')](_0xe3e8d5[_0xe70e('0x33')][_0xe70e('0x1b')]);_0xb1ab6c['offset']=qs[_0xe70e('0x1d')](_0xe3e8d5[_0xe70e('0x33')]['offset']);}return _0xe31057[_0xe70e('0x4f')](_0xb1ab6c);}})[_0xe70e('0x23')](function(_0xae21c){if(_0xae21c){return _0xae21c?{'count':_0x3ba15b,'rows':_0xae21c}:null;}})[_0xe70e('0x23')](respondWithResult(_0x55574d,null))[_0xe70e('0x46')](handleError(_0x55574d,null));};exports[_0xe70e('0x52')]=function(_0x281ff7,_0x59b4f6,_0x5338cc){return db[_0xe70e('0x53')][_0xe70e('0x4b')]({'where':{'id':_0x281ff7['params']['id']}})['then'](handleEntityNotFound(_0x59b4f6,null))['then'](function(_0x2a5709){if(_0x2a5709){return _0x2a5709[_0xe70e('0x52')](_0x281ff7[_0xe70e('0x49')][_0xe70e('0x4d')],_[_0xe70e('0x4e')](_0x281ff7[_0xe70e('0x49')],['ids','id'])||{});}})[_0xe70e('0x23')](respondWithResult(_0x59b4f6,null))[_0xe70e('0x46')](handleError(_0x59b4f6,null));};exports[_0xe70e('0x54')]=function(_0x1807cc,_0x449665,_0x5be63c){var _0x119297={};var _0x3bc233={};var _0x1ed465;var _0x4827e0;return db[_0xe70e('0x2b')]['findOne']({'where':{'id':_0x1807cc[_0xe70e('0x47')]['id']}})[_0xe70e('0x23')](handleEntityNotFound(_0x449665,null))['then'](function(_0x5bcba2){if(_0x5bcba2){_0x1ed465=_0x5bcba2;_0x3bc233['model']=_[_0xe70e('0x32')](db['Action']['rawAttributes']);_0x3bc233[_0xe70e('0x33')]=_[_0xe70e('0x32')](_0x1807cc[_0xe70e('0x33')]);_0x3bc233[_0xe70e('0x34')]=_[_0xe70e('0x35')](_0x3bc233[_0xe70e('0x30')],_0x3bc233[_0xe70e('0x33')]);_0x119297[_0xe70e('0x36')]=_[_0xe70e('0x35')](_0x3bc233[_0xe70e('0x30')],qs[_0xe70e('0x37')](_0x1807cc[_0xe70e('0x33')][_0xe70e('0x37')]));_0x119297[_0xe70e('0x36')]=_0x119297[_0xe70e('0x36')][_0xe70e('0x38')]?_0x119297[_0xe70e('0x36')]:_0x3bc233[_0xe70e('0x30')];_0x119297[_0xe70e('0x3a')]=qs[_0xe70e('0x3b')](_0x1807cc['query'][_0xe70e('0x3b')]);_0x119297[_0xe70e('0x3c')]=qs[_0xe70e('0x34')](_[_0xe70e('0x3d')](_0x1807cc['query'],_0x3bc233[_0xe70e('0x34')]));if(_0x1807cc[_0xe70e('0x33')][_0xe70e('0x3e')]){_0x119297[_0xe70e('0x3c')]=_[_0xe70e('0x3f')](_0x119297[_0xe70e('0x3c')],{'$or':_['map'](_0x119297[_0xe70e('0x36')],function(_0x3c3553){var _0x130301={};_0x130301[_0x3c3553]={'$like':'%'+_0x1807cc[_0xe70e('0x33')][_0xe70e('0x3e')]+'%'};return _0x130301;})});}_0x119297=_['merge']({},_0x119297,_0x1807cc[_0xe70e('0x41')]);return _0x1ed465[_0xe70e('0x54')](_0x119297);}})[_0xe70e('0x23')](function(_0x2bed5d){if(_0x2bed5d){_0x4827e0=_0x2bed5d[_0xe70e('0x38')];if(!_0x1807cc[_0xe70e('0x33')]['hasOwnProperty'](_0xe70e('0x55'))){_0x119297[_0xe70e('0x1b')]=qs[_0xe70e('0x1b')](_0x1807cc[_0xe70e('0x33')][_0xe70e('0x1b')]);_0x119297[_0xe70e('0x1d')]=qs[_0xe70e('0x1d')](_0x1807cc[_0xe70e('0x33')]['offset']);}return _0x1ed465[_0xe70e('0x54')](_0x119297);}})[_0xe70e('0x23')](function(_0xb02015){if(_0xb02015){return _0xb02015?{'count':_0x4827e0,'rows':_0xb02015}:null;}})[_0xe70e('0x23')](respondWithResult(_0x449665,null))[_0xe70e('0x46')](handleError(_0x449665,null));}; \ No newline at end of file diff --git a/server/api/automation/automation.model.js b/server/api/automation/automation.model.js index f883821..a765738 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 _0x797d=['api','moment','bluebird','request-promise','rimraf','exports','define','tools_automations','lodash','util','../../config/logger'];(function(_0x304d21,_0x5f5475){var _0x48279d=function(_0x5b243d){while(--_0x5b243d){_0x304d21['push'](_0x304d21['shift']());}};_0x48279d(++_0x5f5475);}(_0x797d,0x8c));var _0xd797=function(_0x2d7e4e,_0xaf55ad){_0x2d7e4e=_0x2d7e4e-0x0;var _0x143072=_0x797d[_0x2d7e4e];return _0x143072;};'use strict';var _=require(_0xd797('0x0'));var util=require(_0xd797('0x1'));var logger=require(_0xd797('0x2'))(_0xd797('0x3'));var moment=require(_0xd797('0x4'));var BPromise=require(_0xd797('0x5'));var rp=require(_0xd797('0x6'));var fs=require('fs');var path=require('path');var rimraf=require(_0xd797('0x7'));var config=require('../../config/environment');var attributes=require('./automation.attributes');module[_0xd797('0x8')]=function(_0x18c311,_0x2c19c5){return _0x18c311[_0xd797('0x9')]('Automation',attributes,{'tableName':_0xd797('0xa'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x0d5e=['../../config/environment','./automation.attributes','exports','define','tools_automations','lodash','util','api','moment','bluebird','request-promise','path','rimraf'];(function(_0x352651,_0x11700a){var _0x2f3891=function(_0x138f52){while(--_0x138f52){_0x352651['push'](_0x352651['shift']());}};_0x2f3891(++_0x11700a);}(_0x0d5e,0x1a5));var _0xe0d5=function(_0x2e35f7,_0x2f8915){_0x2e35f7=_0x2e35f7-0x0;var _0x12b691=_0x0d5e[_0x2e35f7];return _0x12b691;};'use strict';var _=require(_0xe0d5('0x0'));var util=require(_0xe0d5('0x1'));var logger=require('../../config/logger')(_0xe0d5('0x2'));var moment=require(_0xe0d5('0x3'));var BPromise=require(_0xe0d5('0x4'));var rp=require(_0xe0d5('0x5'));var fs=require('fs');var path=require(_0xe0d5('0x6'));var rimraf=require(_0xe0d5('0x7'));var config=require(_0xe0d5('0x8'));var attributes=require(_0xe0d5('0x9'));module[_0xe0d5('0xa')]=function(_0x5eed56,_0x35c776){return _0x5eed56[_0xe0d5('0xb')]('Automation',attributes,{'tableName':_0xe0d5('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 d2b48a9..778f492 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 _0xc7da=['request','then','info','Automation,\x20%s,\x20%s','debug','Automation,\x20%s,\x20%s,\x20%s','request\x20sent','error','code','message','result','catch','lodash','util','moment','randomstring','ioredis','../../config/utils','../../config/logger','../../config/environment','jayson/promise','client','http'];(function(_0x3dd15e,_0x1f0015){var _0x231fd0=function(_0x4f680a){while(--_0x4f680a){_0x3dd15e['push'](_0x3dd15e['shift']());}};_0x231fd0(++_0x1f0015);}(_0xc7da,0xf2));var _0xac7d=function(_0x22e7e2,_0x3bd0b5){_0x22e7e2=_0x22e7e2-0x0;var _0x132937=_0xc7da[_0x22e7e2];return _0x132937;};'use strict';var _=require(_0xac7d('0x0'));var util=require(_0xac7d('0x1'));var moment=require(_0xac7d('0x2'));var BPromise=require('bluebird');var rs=require(_0xac7d('0x3'));var fs=require('fs');var Redis=require(_0xac7d('0x4'));var db=require('../../mysqldb')['db'];var utils=require(_0xac7d('0x5'));var logger=require(_0xac7d('0x6'))('rpc');var config=require(_0xac7d('0x7'));var jayson=require(_0xac7d('0x8'));var client=jayson[_0xac7d('0x9')][_0xac7d('0xa')]({'port':0x232a});function respondWithRpcPromise(_0x268265,_0x153ce5,_0x48ca59){return new BPromise(function(_0x44eb2b,_0x457e2d){return client[_0xac7d('0xb')](_0x268265,_0x48ca59)[_0xac7d('0xc')](function(_0x217811){logger[_0xac7d('0xd')](_0xac7d('0xe'),_0x153ce5,'request\x20sent');logger[_0xac7d('0xf')](_0xac7d('0x10'),_0x153ce5,_0xac7d('0x11'),JSON['stringify'](_0x217811));if(_0x217811[_0xac7d('0x12')]){if(_0x217811[_0xac7d('0x12')][_0xac7d('0x13')]===0x1f4){logger[_0xac7d('0x12')]('Automation,\x20%s,\x20%s',_0x153ce5,_0x217811[_0xac7d('0x12')][_0xac7d('0x14')]);return _0x457e2d(_0x217811[_0xac7d('0x12')][_0xac7d('0x14')]);}logger[_0xac7d('0x12')]('Automation,\x20%s,\x20%s',_0x153ce5,_0x217811[_0xac7d('0x12')]['message']);return _0x44eb2b(_0x217811[_0xac7d('0x12')][_0xac7d('0x14')]);}else{logger[_0xac7d('0xd')](_0xac7d('0xe'),_0x153ce5,'request\x20sent');_0x44eb2b(_0x217811[_0xac7d('0x15')][_0xac7d('0x14')]);}})[_0xac7d('0x16')](function(_0x12813a){logger[_0xac7d('0x12')]('Automation,\x20%s,\x20%s',_0x153ce5,_0x12813a);_0x457e2d(_0x12813a);});});} \ No newline at end of file +var _0xf1f9=['catch','lodash','util','moment','bluebird','randomstring','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','request','then','info','Automation,\x20%s,\x20%s','request\x20sent','debug','Automation,\x20%s,\x20%s,\x20%s','stringify','error','message','result'];(function(_0x3ab90e,_0x5cf6dc){var _0x4443f2=function(_0x320385){while(--_0x320385){_0x3ab90e['push'](_0x3ab90e['shift']());}};_0x4443f2(++_0x5cf6dc);}(_0xf1f9,0x1cd));var _0x9f1f=function(_0x523861,_0x290099){_0x523861=_0x523861-0x0;var _0x3da2a7=_0xf1f9[_0x523861];return _0x3da2a7;};'use strict';var _=require(_0x9f1f('0x0'));var util=require(_0x9f1f('0x1'));var moment=require(_0x9f1f('0x2'));var BPromise=require(_0x9f1f('0x3'));var rs=require(_0x9f1f('0x4'));var fs=require('fs');var Redis=require('ioredis');var db=require(_0x9f1f('0x5'))['db'];var utils=require(_0x9f1f('0x6'));var logger=require(_0x9f1f('0x7'))(_0x9f1f('0x8'));var config=require(_0x9f1f('0x9'));var jayson=require(_0x9f1f('0xa'));var client=jayson['client']['http']({'port':0x232a});function respondWithRpcPromise(_0x363d26,_0x373b98,_0x117fa5){return new BPromise(function(_0x12309e,_0x4e6054){return client[_0x9f1f('0xb')](_0x363d26,_0x117fa5)[_0x9f1f('0xc')](function(_0x3efac2){logger[_0x9f1f('0xd')](_0x9f1f('0xe'),_0x373b98,_0x9f1f('0xf'));logger[_0x9f1f('0x10')](_0x9f1f('0x11'),_0x373b98,'request\x20sent',JSON[_0x9f1f('0x12')](_0x3efac2));if(_0x3efac2[_0x9f1f('0x13')]){if(_0x3efac2[_0x9f1f('0x13')]['code']===0x1f4){logger['error'](_0x9f1f('0xe'),_0x373b98,_0x3efac2['error'][_0x9f1f('0x14')]);return _0x4e6054(_0x3efac2[_0x9f1f('0x13')][_0x9f1f('0x14')]);}logger[_0x9f1f('0x13')](_0x9f1f('0xe'),_0x373b98,_0x3efac2[_0x9f1f('0x13')][_0x9f1f('0x14')]);return _0x12309e(_0x3efac2['error'][_0x9f1f('0x14')]);}else{logger['info'](_0x9f1f('0xe'),_0x373b98,_0x9f1f('0xf'));_0x12309e(_0x3efac2[_0x9f1f('0x15')][_0x9f1f('0x14')]);}})[_0x9f1f('0x16')](function(_0x5645fc){logger[_0x9f1f('0x13')](_0x9f1f('0xe'),_0x373b98,_0x5645fc);_0x4e6054(_0x5645fc);});});} \ No newline at end of file diff --git a/server/api/automation/index.js b/server/api/automation/index.js index 01118a6..891ba87 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 _0x0f9f=['./automation.controller','get','isAuthenticated','index','show','/:id/conditions','getConditions','/:id/actions','getActions','create','post','addConditions','addActions','put','/:id','update','destroy','exports','util','path','connect-timeout','Router','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment'];(function(_0x252cbe,_0x54f1a1){var _0xf72165=function(_0x548288){while(--_0x548288){_0x252cbe['push'](_0x252cbe['shift']());}};_0xf72165(++_0x54f1a1);}(_0x0f9f,0x1cc));var _0xf0f9=function(_0x77b868,_0x45ea4b){_0x77b868=_0x77b868-0x0;var _0x1f54ea=_0x0f9f[_0x77b868];return _0x1f54ea;};'use strict';var multer=require('multer');var util=require(_0xf0f9('0x0'));var path=require(_0xf0f9('0x1'));var timeout=require(_0xf0f9('0x2'));var express=require('express');var router=express[_0xf0f9('0x3')]();var fs_extra=require(_0xf0f9('0x4'));var auth=require(_0xf0f9('0x5'));var interaction=require(_0xf0f9('0x6'));var config=require(_0xf0f9('0x7'));var controller=require(_0xf0f9('0x8'));router[_0xf0f9('0x9')]('/',auth[_0xf0f9('0xa')](),controller[_0xf0f9('0xb')]);router[_0xf0f9('0x9')]('/:id',auth[_0xf0f9('0xa')](),controller[_0xf0f9('0xc')]);router['get'](_0xf0f9('0xd'),auth[_0xf0f9('0xa')](),controller[_0xf0f9('0xe')]);router['get'](_0xf0f9('0xf'),auth[_0xf0f9('0xa')](),controller[_0xf0f9('0x10')]);router['post']('/',auth['isAuthenticated'](),controller[_0xf0f9('0x11')]);router[_0xf0f9('0x12')](_0xf0f9('0xd'),auth[_0xf0f9('0xa')](),controller[_0xf0f9('0x13')]);router[_0xf0f9('0x12')](_0xf0f9('0xf'),auth['isAuthenticated'](),controller[_0xf0f9('0x14')]);router[_0xf0f9('0x15')](_0xf0f9('0x16'),auth[_0xf0f9('0xa')](),controller[_0xf0f9('0x17')]);router['delete'](_0xf0f9('0x16'),auth[_0xf0f9('0xa')](),controller[_0xf0f9('0x18')]);module[_0xf0f9('0x19')]=router; \ No newline at end of file +var _0x2dab=['index','show','/:id/conditions','getConditions','/:id/actions','post','create','addConditions','put','/:id','update','delete','multer','util','path','connect-timeout','express','fs-extra','../../components/interaction/service','../../config/environment','./automation.controller','get','isAuthenticated'];(function(_0x213cf5,_0x4749b8){var _0x3ca5a2=function(_0xf8a176){while(--_0xf8a176){_0x213cf5['push'](_0x213cf5['shift']());}};_0x3ca5a2(++_0x4749b8);}(_0x2dab,0x120));var _0xb2da=function(_0x4c6970,_0x285332){_0x4c6970=_0x4c6970-0x0;var _0x5daf7d=_0x2dab[_0x4c6970];return _0x5daf7d;};'use strict';var multer=require(_0xb2da('0x0'));var util=require(_0xb2da('0x1'));var path=require(_0xb2da('0x2'));var timeout=require(_0xb2da('0x3'));var express=require(_0xb2da('0x4'));var router=express['Router']();var fs_extra=require(_0xb2da('0x5'));var auth=require('../../components/auth/service');var interaction=require(_0xb2da('0x6'));var config=require(_0xb2da('0x7'));var controller=require(_0xb2da('0x8'));router[_0xb2da('0x9')]('/',auth[_0xb2da('0xa')](),controller[_0xb2da('0xb')]);router[_0xb2da('0x9')]('/:id',auth[_0xb2da('0xa')](),controller[_0xb2da('0xc')]);router[_0xb2da('0x9')](_0xb2da('0xd'),auth[_0xb2da('0xa')](),controller[_0xb2da('0xe')]);router[_0xb2da('0x9')](_0xb2da('0xf'),auth['isAuthenticated'](),controller['getActions']);router[_0xb2da('0x10')]('/',auth[_0xb2da('0xa')](),controller[_0xb2da('0x11')]);router[_0xb2da('0x10')]('/:id/conditions',auth['isAuthenticated'](),controller[_0xb2da('0x12')]);router[_0xb2da('0x10')](_0xb2da('0xf'),auth[_0xb2da('0xa')](),controller['addActions']);router[_0xb2da('0x13')](_0xb2da('0x14'),auth[_0xb2da('0xa')](),controller[_0xb2da('0x15')]);router[_0xb2da('0x16')](_0xb2da('0x14'),auth[_0xb2da('0xa')](),controller['destroy']);module['exports']=router; \ No newline at end of file diff --git a/server/api/campaign/campaign.attributes.js b/server/api/campaign/campaign.attributes.js index 8618740..3cfb213 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 _0x5277=['ivr','BOOLEAN','Active/Disactive\x20Campaign','INTEGER','UNSIGNED','Max\x20200\x20calls.','#Congestion\x20Retry\x20(min:1,\x20max:999)','Congestion\x20Retry\x20Frequency\x20Minutes\x20(min:1,\x20max:99999)','#Busy\x20Retry\x20(min:1,\x20max:999)','#NoAnswer\x20Retry\x20(min:1,\x20max:999)','NoAnswer\x20Retry\x20Frequency\x20Minutes\x20(min:1,\x20max:99999)','#Global\x20Max\x20Retry\x20(min:1,\x20max:999)','07:00-22:00,*,*,*','always','onlyIfOpen','Active/Disactive\x20AMD','#AMD\x20Initial\x20Silence','#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)','ASC','DESC','Random\x20Last\x20Digit\x20(min:1,\x20max:15)','#NoSuchNumber\x20Retry\x20(min:1,\x20max:999)','NoSuchNumber\x20Retry\x20Frequency\x20Minutes\x20(min:1,\x20max:99999)','Drop\x20Retry\x20Frequency\x20Minutes\x20(min:1,\x20max:99999)','#Machine\x20Retry\x20(min:1,\x20max:999)','Machine\x20Retry\x20Frequency\x20Minutes\x20(min:1,\x20max:99999)','#AgentReject\x20Retry\x20(min:1,\x20max:999)','AgentReject\x20Retry\x20Frequency\x20Minutes\x20(min:1,\x20max:99999)','exports','STRING','ENUM'];(function(_0x19f5fc,_0x4c658a){var _0x315fa3=function(_0x2198b5){while(--_0x2198b5){_0x19f5fc['push'](_0x19f5fc['shift']());}};_0x315fa3(++_0x4c658a);}(_0x5277,0x15b));var _0x7527=function(_0x20a584,_0xe384a5){_0x20a584=_0x20a584-0x0;var _0x4b41a8=_0x5277[_0x20a584];return _0x4b41a8;};'use strict';var Sequelize=require('sequelize');module[_0x7527('0x0')]={'name':{'type':Sequelize[_0x7527('0x1')],'unique':'name','allowNull':![],'validate':{'is':/[A-Za-z0-9._\\+*!-]+/,'notEmpty':!![]}},'type':{'type':Sequelize[_0x7527('0x2')](_0x7527('0x3')),'allowNull':![],'defaultValue':_0x7527('0x3')},'description':{'type':Sequelize[_0x7527('0x1')]},'active':{'type':Sequelize[_0x7527('0x4')],'defaultValue':0x0,'comment':_0x7527('0x5')},'limitCalls':{'type':Sequelize[_0x7527('0x6')](0x4)[_0x7527('0x7')],'defaultValue':0x1e,'validate':{'min':0x1,'max':0xc8},'comment':_0x7527('0x8')},'dialOriginateCallerIdName':{'type':Sequelize[_0x7527('0x1')]},'dialOriginateCallerIdNumber':{'type':Sequelize[_0x7527('0x1')]},'dialOriginateTimeout':{'type':Sequelize['INTEGER'](0x3)[_0x7527('0x7')],'defaultValue':0x1e,'validate':{'min':0x1,'max':0x3e7},'comment':'Originate\x20Timeout\x20Seconds\x20(min:1,\x20max:999)'},'dialCongestionMaxRetry':{'type':Sequelize['INTEGER'](0x3)['UNSIGNED'],'defaultValue':0x3,'validate':{'min':0x1,'max':0x3e7},'comment':_0x7527('0x9')},'dialCongestionRetryFrequency':{'type':Sequelize[_0x7527('0x6')](0x5)[_0x7527('0x7')],'validate':{'min':0x1,'max':0x1869f},'defaultValue':0x96,'comment':_0x7527('0xa')},'dialBusyMaxRetry':{'type':Sequelize[_0x7527('0x6')](0x3)[_0x7527('0x7')],'defaultValue':0x3,'validate':{'min':0x1,'max':0x3e7},'comment':_0x7527('0xb')},'dialBusyRetryFrequency':{'type':Sequelize[_0x7527('0x6')](0x5)['UNSIGNED'],'validate':{'min':0x1,'max':0x1869f},'defaultValue':0x96,'comment':'Busy\x20Retry\x20Frequency\x20Minutes\x20(min:1,\x20max:99999)'},'dialNoAnswerMaxRetry':{'type':Sequelize[_0x7527('0x6')](0x3)[_0x7527('0x7')],'defaultValue':0x3,'comment':_0x7527('0xc')},'dialNoAnswerRetryFrequency':{'type':Sequelize[_0x7527('0x6')](0x5)[_0x7527('0x7')],'validate':{'min':0x1,'max':0x1869f},'defaultValue':0x96,'comment':_0x7527('0xd')},'dialGlobalMaxRetry':{'type':Sequelize[_0x7527('0x6')](0x3)[_0x7527('0x7')],'validate':{'min':0x1,'max':0x3e7},'defaultValue':0x4,'comment':_0x7527('0xe')},'dialTimezone':{'type':Sequelize[_0x7527('0x1')],'defaultValue':null},'dialGlobalInterval':{'type':Sequelize[_0x7527('0x1')],'defaultValue':_0x7527('0xf')},'dialCheckDuplicateType':{'type':Sequelize[_0x7527('0x2')](_0x7527('0x10'),'never',_0x7527('0x11')),'defaultValue':_0x7527('0x10')},'dialAMDActive':{'type':Sequelize[_0x7527('0x4')],'defaultValue':0x0,'comment':_0x7527('0x12')},'dialAMDInitialSilence':{'type':Sequelize[_0x7527('0x6')](0x9)['UNSIGNED'],'defaultValue':0x9c4,'validate':{'min':0x0},'comment':_0x7527('0x13')},'dialAMDGreeting':{'type':Sequelize[_0x7527('0x6')](0x9)['UNSIGNED'],'defaultValue':0x5dc,'validate':{'min':0x0},'comment':'#AMD\x20Greeting'},'dialAMDAfterGreetingSilence':{'type':Sequelize['INTEGER'](0x9)[_0x7527('0x7')],'defaultValue':0x320,'validate':{'min':0x0},'comment':_0x7527('0x14')},'dialAMDTotalAnalysisTime':{'type':Sequelize[_0x7527('0x6')](0x9)[_0x7527('0x7')],'defaultValue':0x1388,'validate':{'min':0x0},'comment':'#AMD\x20Total\x20Analysis\x20Time'},'dialAMDMinWordLength':{'type':Sequelize[_0x7527('0x6')](0x9)[_0x7527('0x7')],'defaultValue':0x64,'validate':{'min':0x0},'comment':_0x7527('0x15')},'dialAMDBetweenWordsSilence':{'type':Sequelize[_0x7527('0x6')](0x9)[_0x7527('0x7')],'defaultValue':0x32,'validate':{'min':0x0},'comment':_0x7527('0x16')},'dialAMDMaximumNumberOfWords':{'type':Sequelize[_0x7527('0x6')](0x9)['UNSIGNED'],'defaultValue':0x3,'validate':{'min':0x0},'comment':_0x7527('0x17')},'dialAMDSilenceThreshold':{'type':Sequelize[_0x7527('0x6')](0x5)['UNSIGNED'],'validate':{'min':0x0,'max':0x7fff},'defaultValue':0x100,'comment':_0x7527('0x18')},'dialAMDMaximumWordLength':{'type':Sequelize[_0x7527('0x6')](0x9)['UNSIGNED'],'defaultValue':0x1388,'validate':{'min':0x0},'comment':'#AMD\x20Maximum\x20Word\x20Length'},'dialOrderByScheduledAt':{'type':Sequelize[_0x7527('0x2')]('DESC',_0x7527('0x19')),'defaultValue':_0x7527('0x1a')},'dialPrefix':{'type':Sequelize['STRING'],'defaultValue':null},'dialRandomLastDigitCallerIdNumber':{'type':Sequelize['INTEGER'](0x3)['UNSIGNED'],'validate':{'min':0x0,'max':0xf},'defaultValue':0x0,'comment':_0x7527('0x1b')},'dialCutDigit':{'type':Sequelize[_0x7527('0x6')](0x3)['UNSIGNED'],'validate':{'min':0x0,'max':0xf},'defaultValue':0x0,'comment':'Cut\x20Digit\x20(min:1,\x20max:15)'},'dialNoSuchNumberMaxRetry':{'type':Sequelize[_0x7527('0x6')](0x3)[_0x7527('0x7')],'defaultValue':0x3,'validate':{'min':0x1,'max':0x3e7},'comment':_0x7527('0x1c')},'dialNoSuchNumberRetryFrequency':{'type':Sequelize[_0x7527('0x6')](0x5)[_0x7527('0x7')],'validate':{'min':0x1,'max':0x1869f},'defaultValue':0x96,'comment':_0x7527('0x1d')},'dialDropMaxRetry':{'type':Sequelize[_0x7527('0x6')](0x3)[_0x7527('0x7')],'defaultValue':0x3,'validate':{'min':0x1,'max':0x3e7},'comment':'#Drop\x20Retry\x20(min:1,\x20max:999)'},'dialDropRetryFrequency':{'type':Sequelize['INTEGER'](0x5)[_0x7527('0x7')],'validate':{'min':0x1,'max':0x1869f},'defaultValue':0x96,'comment':_0x7527('0x1e')},'dialAbandonedMaxRetry':{'type':Sequelize['INTEGER'](0x3)[_0x7527('0x7')],'defaultValue':0x3,'validate':{'min':0x1,'max':0x3e7},'comment':'#Abandoned\x20Retry\x20(min:1,\x20max:999)'},'dialAbandonedRetryFrequency':{'type':Sequelize['INTEGER'](0x5)[_0x7527('0x7')],'validate':{'min':0x1,'max':0x1869f},'defaultValue':0x96,'comment':'Abandoned\x20Retry\x20Frequency\x20Minutes\x20(min:1,\x20max:99999)'},'dialMachineMaxRetry':{'type':Sequelize[_0x7527('0x6')](0x3)['UNSIGNED'],'defaultValue':0x3,'validate':{'min':0x1,'max':0x3e7},'comment':_0x7527('0x1f')},'dialMachineRetryFrequency':{'type':Sequelize[_0x7527('0x6')](0x5)[_0x7527('0x7')],'validate':{'min':0x1,'max':0x1869f},'defaultValue':0x96,'comment':_0x7527('0x20')},'dialAgentRejectMaxRetry':{'type':Sequelize[_0x7527('0x6')](0x3)[_0x7527('0x7')],'defaultValue':0x3,'validate':{'min':0x1,'max':0x3e7},'comment':_0x7527('0x21')},'dialAgentRejectRetryFrequency':{'type':Sequelize['INTEGER'](0x5)[_0x7527('0x7')],'validate':{'min':0x1,'max':0x1869f},'defaultValue':0x96,'comment':_0x7527('0x22')}}; \ No newline at end of file +var _0xaa56=['INTEGER','UNSIGNED','Max\x20200\x20calls.','Originate\x20Timeout\x20Seconds\x20(min:1,\x20max:999)','#Congestion\x20Retry\x20(min:1,\x20max:999)','Congestion\x20Retry\x20Frequency\x20Minutes\x20(min:1,\x20max:99999)','#Busy\x20Retry\x20(min:1,\x20max:999)','Busy\x20Retry\x20Frequency\x20Minutes\x20(min:1,\x20max:99999)','#NoAnswer\x20Retry\x20(min:1,\x20max:999)','#Global\x20Max\x20Retry\x20(min:1,\x20max:999)','07:00-22:00,*,*,*','always','never','Active/Disactive\x20AMD','#AMD\x20Initial\x20Silence','#AMD\x20Greeting','#AMD\x20After\x20Greeting\x20Silence','#AMD\x20Total\x20Analysis\x20Time','#AMD\x20Min\x20Word\x20Length','#AMD\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)','Cut\x20Digit\x20(min:1,\x20max:15)','#NoSuchNumber\x20Retry\x20(min:1,\x20max:999)','#Drop\x20Retry\x20(min:1,\x20max:999)','Abandoned\x20Retry\x20Frequency\x20Minutes\x20(min:1,\x20max:99999)','#Machine\x20Retry\x20(min:1,\x20max:999)','Machine\x20Retry\x20Frequency\x20Minutes\x20(min:1,\x20max:99999)','#AgentReject\x20Retry\x20(min:1,\x20max:999)','AgentReject\x20Retry\x20Frequency\x20Minutes\x20(min:1,\x20max:99999)','exports','STRING','ENUM','ivr'];(function(_0x2830fc,_0x1bbb32){var _0x3cc76b=function(_0x10f976){while(--_0x10f976){_0x2830fc['push'](_0x2830fc['shift']());}};_0x3cc76b(++_0x1bbb32);}(_0xaa56,0x1ac));var _0x6aa5=function(_0x3e5f3e,_0x331df9){_0x3e5f3e=_0x3e5f3e-0x0;var _0x562931=_0xaa56[_0x3e5f3e];return _0x562931;};'use strict';var Sequelize=require('sequelize');module[_0x6aa5('0x0')]={'name':{'type':Sequelize[_0x6aa5('0x1')],'unique':'name','allowNull':![],'validate':{'is':/[A-Za-z0-9._\\+*!-]+/,'notEmpty':!![]}},'type':{'type':Sequelize[_0x6aa5('0x2')](_0x6aa5('0x3')),'allowNull':![],'defaultValue':'ivr'},'description':{'type':Sequelize[_0x6aa5('0x1')]},'active':{'type':Sequelize['BOOLEAN'],'defaultValue':0x0,'comment':'Active/Disactive\x20Campaign'},'limitCalls':{'type':Sequelize[_0x6aa5('0x4')](0x4)[_0x6aa5('0x5')],'defaultValue':0x1e,'validate':{'min':0x1,'max':0xc8},'comment':_0x6aa5('0x6')},'dialOriginateCallerIdName':{'type':Sequelize[_0x6aa5('0x1')]},'dialOriginateCallerIdNumber':{'type':Sequelize['STRING']},'dialOriginateTimeout':{'type':Sequelize['INTEGER'](0x3)['UNSIGNED'],'defaultValue':0x1e,'validate':{'min':0x1,'max':0x3e7},'comment':_0x6aa5('0x7')},'dialCongestionMaxRetry':{'type':Sequelize[_0x6aa5('0x4')](0x3)['UNSIGNED'],'defaultValue':0x3,'validate':{'min':0x1,'max':0x3e7},'comment':_0x6aa5('0x8')},'dialCongestionRetryFrequency':{'type':Sequelize[_0x6aa5('0x4')](0x5)[_0x6aa5('0x5')],'validate':{'min':0x1,'max':0x1869f},'defaultValue':0x96,'comment':_0x6aa5('0x9')},'dialBusyMaxRetry':{'type':Sequelize[_0x6aa5('0x4')](0x3)[_0x6aa5('0x5')],'defaultValue':0x3,'validate':{'min':0x1,'max':0x3e7},'comment':_0x6aa5('0xa')},'dialBusyRetryFrequency':{'type':Sequelize[_0x6aa5('0x4')](0x5)[_0x6aa5('0x5')],'validate':{'min':0x1,'max':0x1869f},'defaultValue':0x96,'comment':_0x6aa5('0xb')},'dialNoAnswerMaxRetry':{'type':Sequelize[_0x6aa5('0x4')](0x3)['UNSIGNED'],'defaultValue':0x3,'comment':_0x6aa5('0xc')},'dialNoAnswerRetryFrequency':{'type':Sequelize[_0x6aa5('0x4')](0x5)[_0x6aa5('0x5')],'validate':{'min':0x1,'max':0x1869f},'defaultValue':0x96,'comment':'NoAnswer\x20Retry\x20Frequency\x20Minutes\x20(min:1,\x20max:99999)'},'dialGlobalMaxRetry':{'type':Sequelize[_0x6aa5('0x4')](0x3)[_0x6aa5('0x5')],'validate':{'min':0x1,'max':0x3e7},'defaultValue':0x4,'comment':_0x6aa5('0xd')},'dialTimezone':{'type':Sequelize[_0x6aa5('0x1')],'defaultValue':null},'dialGlobalInterval':{'type':Sequelize[_0x6aa5('0x1')],'defaultValue':_0x6aa5('0xe')},'dialCheckDuplicateType':{'type':Sequelize[_0x6aa5('0x2')](_0x6aa5('0xf'),_0x6aa5('0x10'),'onlyIfOpen'),'defaultValue':_0x6aa5('0xf')},'dialAMDActive':{'type':Sequelize['BOOLEAN'],'defaultValue':0x0,'comment':_0x6aa5('0x11')},'dialAMDInitialSilence':{'type':Sequelize[_0x6aa5('0x4')](0x9)['UNSIGNED'],'defaultValue':0x9c4,'validate':{'min':0x0},'comment':_0x6aa5('0x12')},'dialAMDGreeting':{'type':Sequelize[_0x6aa5('0x4')](0x9)['UNSIGNED'],'defaultValue':0x5dc,'validate':{'min':0x0},'comment':_0x6aa5('0x13')},'dialAMDAfterGreetingSilence':{'type':Sequelize[_0x6aa5('0x4')](0x9)[_0x6aa5('0x5')],'defaultValue':0x320,'validate':{'min':0x0},'comment':_0x6aa5('0x14')},'dialAMDTotalAnalysisTime':{'type':Sequelize[_0x6aa5('0x4')](0x9)['UNSIGNED'],'defaultValue':0x1388,'validate':{'min':0x0},'comment':_0x6aa5('0x15')},'dialAMDMinWordLength':{'type':Sequelize[_0x6aa5('0x4')](0x9)[_0x6aa5('0x5')],'defaultValue':0x64,'validate':{'min':0x0},'comment':_0x6aa5('0x16')},'dialAMDBetweenWordsSilence':{'type':Sequelize[_0x6aa5('0x4')](0x9)[_0x6aa5('0x5')],'defaultValue':0x32,'validate':{'min':0x0},'comment':'#AMD\x20Between\x20Words\x20Silence'},'dialAMDMaximumNumberOfWords':{'type':Sequelize['INTEGER'](0x9)['UNSIGNED'],'defaultValue':0x3,'validate':{'min':0x0},'comment':_0x6aa5('0x17')},'dialAMDSilenceThreshold':{'type':Sequelize['INTEGER'](0x5)[_0x6aa5('0x5')],'validate':{'min':0x0,'max':0x7fff},'defaultValue':0x100,'comment':_0x6aa5('0x18')},'dialAMDMaximumWordLength':{'type':Sequelize['INTEGER'](0x9)[_0x6aa5('0x5')],'defaultValue':0x1388,'validate':{'min':0x0},'comment':_0x6aa5('0x19')},'dialOrderByScheduledAt':{'type':Sequelize[_0x6aa5('0x2')](_0x6aa5('0x1a'),'ASC'),'defaultValue':_0x6aa5('0x1a')},'dialPrefix':{'type':Sequelize[_0x6aa5('0x1')],'defaultValue':null},'dialRandomLastDigitCallerIdNumber':{'type':Sequelize[_0x6aa5('0x4')](0x3)[_0x6aa5('0x5')],'validate':{'min':0x0,'max':0xf},'defaultValue':0x0,'comment':_0x6aa5('0x1b')},'dialCutDigit':{'type':Sequelize[_0x6aa5('0x4')](0x3)[_0x6aa5('0x5')],'validate':{'min':0x0,'max':0xf},'defaultValue':0x0,'comment':_0x6aa5('0x1c')},'dialNoSuchNumberMaxRetry':{'type':Sequelize['INTEGER'](0x3)['UNSIGNED'],'defaultValue':0x3,'validate':{'min':0x1,'max':0x3e7},'comment':_0x6aa5('0x1d')},'dialNoSuchNumberRetryFrequency':{'type':Sequelize[_0x6aa5('0x4')](0x5)['UNSIGNED'],'validate':{'min':0x1,'max':0x1869f},'defaultValue':0x96,'comment':'NoSuchNumber\x20Retry\x20Frequency\x20Minutes\x20(min:1,\x20max:99999)'},'dialDropMaxRetry':{'type':Sequelize[_0x6aa5('0x4')](0x3)['UNSIGNED'],'defaultValue':0x3,'validate':{'min':0x1,'max':0x3e7},'comment':_0x6aa5('0x1e')},'dialDropRetryFrequency':{'type':Sequelize[_0x6aa5('0x4')](0x5)[_0x6aa5('0x5')],'validate':{'min':0x1,'max':0x1869f},'defaultValue':0x96,'comment':'Drop\x20Retry\x20Frequency\x20Minutes\x20(min:1,\x20max:99999)'},'dialAbandonedMaxRetry':{'type':Sequelize[_0x6aa5('0x4')](0x3)[_0x6aa5('0x5')],'defaultValue':0x3,'validate':{'min':0x1,'max':0x3e7},'comment':'#Abandoned\x20Retry\x20(min:1,\x20max:999)'},'dialAbandonedRetryFrequency':{'type':Sequelize[_0x6aa5('0x4')](0x5)[_0x6aa5('0x5')],'validate':{'min':0x1,'max':0x1869f},'defaultValue':0x96,'comment':_0x6aa5('0x1f')},'dialMachineMaxRetry':{'type':Sequelize[_0x6aa5('0x4')](0x3)[_0x6aa5('0x5')],'defaultValue':0x3,'validate':{'min':0x1,'max':0x3e7},'comment':_0x6aa5('0x20')},'dialMachineRetryFrequency':{'type':Sequelize[_0x6aa5('0x4')](0x5)[_0x6aa5('0x5')],'validate':{'min':0x1,'max':0x1869f},'defaultValue':0x96,'comment':_0x6aa5('0x21')},'dialAgentRejectMaxRetry':{'type':Sequelize[_0x6aa5('0x4')](0x3)[_0x6aa5('0x5')],'defaultValue':0x3,'validate':{'min':0x1,'max':0x3e7},'comment':_0x6aa5('0x22')},'dialAgentRejectRetryFrequency':{'type':Sequelize[_0x6aa5('0x4')](0x5)[_0x6aa5('0x5')],'validate':{'min':0x1,'max':0x1869f},'defaultValue':0x96,'comment':_0x6aa5('0x23')}}; \ No newline at end of file diff --git a/server/api/campaign/campaign.controller.js b/server/api/campaign/campaign.controller.js index 1ff6d29..5886770 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 _0x1120=['COALESCE(calleridnum,\x27\x27)','cm_hopper_final','CampaignId\x20=\x20?','onlyIfOpen','ListId','deletedAt\x20IS\x20NULL','cm_hopper_additional_phones','cmHopperId','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','removeLists','getBlackLists','addBlackLists','cm_hopper_black','removeBlackLists','eml-format','rimraf','zip-dir','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','api','../../config/utils','../../config/environment','../../config/license/util','sendStatus','json','offset','undefined','limit','count','status','set','reject','save','update','then','destroy','IvrCampaigns','end','error','name','send','index','query','keys','filters','intersection','fields','model','hasOwnProperty','nolimit','order','sort','pick','filter','where','merge','type','VIRTUAL','options','includeAll','include','Campaign','rows','catch','show','rawAttributes','attributes','length','create','user','get','userProfileId','autoAssociation','UserProfileResource','clone','find','omit','createdAt','updatedAt','body','UserProfileSection','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','params','getHoppers','findOne','CmHopper','CampaignId','findAll','CmHopperHistory','map','getHopperFinals','CmHopperFinal','getHopperBlacks','CmHopperBlack','getLists','CmList','addLists','format','YYYY-MM-DD\x20HH:mm:ss','ids','dialCheckDuplicateType','insert','into','cm_hopper','fromQuery','scheduledAt','select','field','phone','NOW()','ContactId','CmListId','toString','from','cm_contacts','ListId\x20=\x20?','phone\x20IS\x20NOT\x20NULL','phone\x20NOT\x20IN\x20(?)'];(function(_0x359e3b,_0x483b92){var _0x115e56=function(_0x462763){while(--_0x462763){_0x359e3b['push'](_0x359e3b['shift']());}};_0x115e56(++_0x483b92);}(_0x1120,0x140));var _0x0112=function(_0x52085a,_0x3717ca){_0x52085a=_0x52085a-0x0;var _0x5afc1a=_0x1120[_0x52085a];return _0x5afc1a;};'use strict';var emlformat=require(_0x0112('0x0'));var rimraf=require(_0x0112('0x1'));var zipdir=require(_0x0112('0x2'));var jsonpatch=require('fast-json-patch');var rp=require('request-promise');var moment=require('moment');var BPromise=require('bluebird');var Mustache=require(_0x0112('0x3'));var util=require(_0x0112('0x4'));var path=require(_0x0112('0x5'));var sox=require(_0x0112('0x6'));var csv=require(_0x0112('0x7'));var ejs=require(_0x0112('0x8'));var fs=require('fs');var fs_extra=require(_0x0112('0x9'));var _=require(_0x0112('0xa'));var squel=require(_0x0112('0xb'));var crypto=require(_0x0112('0xc'));var jsforce=require(_0x0112('0xd'));var deskjs=require(_0x0112('0xe'));var toCsv=require('to-csv');var querystring=require(_0x0112('0xf'));var Papa=require(_0x0112('0x10'));var Redis=require(_0x0112('0x11'));var authService=require(_0x0112('0x12'));var qs=require(_0x0112('0x13'));var as=require(_0x0112('0x14'));var hardwareService=require(_0x0112('0x15'));var logger=require('../../config/logger')(_0x0112('0x16'));var utils=require(_0x0112('0x17'));var config=require(_0x0112('0x18'));var licenseUtil=require(_0x0112('0x19'));var db=require('../../mysqldb')['db'];function respondWithStatusCode(_0x95d441,_0x394926){_0x394926=_0x394926||0xcc;return function(_0xb58a0b){if(_0xb58a0b){return _0x95d441[_0x0112('0x1a')](_0x394926);}return _0x95d441['status'](_0x394926)['end']();};}function respondWithResult(_0x44d646,_0x4d591e){_0x4d591e=_0x4d591e||0xc8;return function(_0x19dd06){if(_0x19dd06){return _0x44d646['status'](_0x4d591e)[_0x0112('0x1b')](_0x19dd06);}};}function respondWithFilteredResult(_0x1e273d,_0xe2ec19){return function(_0x1a2549){if(_0x1a2549){var _0x54269a=typeof _0xe2ec19[_0x0112('0x1c')]===_0x0112('0x1d')&&typeof _0xe2ec19[_0x0112('0x1e')]==='undefined';var _0x58aa63=_0x1a2549[_0x0112('0x1f')];var _0x58f0ed=_0x54269a?0x0:_0xe2ec19[_0x0112('0x1c')];var _0x4e34c1=_0x54269a?_0x1a2549[_0x0112('0x1f')]:_0xe2ec19[_0x0112('0x1c')]+_0xe2ec19['limit'];var _0x590c3e;if(_0x4e34c1>=_0x58aa63){_0x4e34c1=_0x58aa63;_0x590c3e=0xc8;}else{_0x590c3e=0xce;}_0x1e273d[_0x0112('0x20')](_0x590c3e);return _0x1e273d[_0x0112('0x21')]('Content-Range',_0x58f0ed+'-'+_0x4e34c1+'/'+_0x58aa63)[_0x0112('0x1b')](_0x1a2549);}return null;};}function patchUpdates(_0x548681){return function(_0x51ac2d){try{jsonpatch['apply'](_0x51ac2d,_0x548681,!![]);}catch(_0x2ce17a){return BPromise[_0x0112('0x22')](_0x2ce17a);}return _0x51ac2d[_0x0112('0x23')]();};}function saveUpdates(_0x53f19c,_0x3dd2aa){return function(_0xf92cb4){if(_0xf92cb4){return _0xf92cb4[_0x0112('0x24')](_0x53f19c)[_0x0112('0x25')](function(_0x57bd39){return _0x57bd39;});}return null;};}function removeEntity(_0x33cb56,_0x408bb8){return function(_0x2d99c1){if(_0x2d99c1){return _0x2d99c1[_0x0112('0x26')]()['then'](function(){var _0x1e0f71=_0x2d99c1['get']({'plain':!![]});var _0x58ea13=_0x0112('0x27');return db['UserProfileResource'][_0x0112('0x26')]({'where':{'type':_0x58ea13,'resourceId':_0x1e0f71['id']}})['then'](function(){return _0x2d99c1;});})[_0x0112('0x25')](function(){_0x33cb56[_0x0112('0x20')](0xcc)[_0x0112('0x28')]();});}};}function handleEntityNotFound(_0x13bb1e,_0x29f734){return function(_0x11bd7f){if(!_0x11bd7f){_0x13bb1e[_0x0112('0x1a')](0x194);}return _0x11bd7f;};}function handleError(_0x26c53a,_0x140e26){_0x140e26=_0x140e26||0x1f4;return function(_0x29c9d0){logger[_0x0112('0x29')](_0x29c9d0['stack']);if(_0x29c9d0[_0x0112('0x2a')]){delete _0x29c9d0['name'];}_0x26c53a[_0x0112('0x20')](_0x140e26)[_0x0112('0x2b')](_0x29c9d0);};}exports[_0x0112('0x2c')]=function(_0x5afe63,_0x32e788){var _0x4a7dc7={},_0x2afecb={},_0x4ee450={'count':0x0,'rows':[]};var _0x2c07fd=_['map'](db['Campaign']['rawAttributes'],function(_0x28b644){return{'name':_0x28b644['fieldName'],'type':_0x28b644['type']['key']};});_0x2afecb['model']=_['map'](_0x2c07fd,_0x0112('0x2a'));_0x2afecb[_0x0112('0x2d')]=_[_0x0112('0x2e')](_0x5afe63['query']);_0x2afecb[_0x0112('0x2f')]=_[_0x0112('0x30')](_0x2afecb['model'],_0x2afecb[_0x0112('0x2d')]);_0x4a7dc7['attributes']=_[_0x0112('0x30')](_0x2afecb['model'],qs[_0x0112('0x31')](_0x5afe63[_0x0112('0x2d')][_0x0112('0x31')]));_0x4a7dc7['attributes']=_0x4a7dc7['attributes']['length']?_0x4a7dc7['attributes']:_0x2afecb[_0x0112('0x32')];if(!_0x5afe63[_0x0112('0x2d')][_0x0112('0x33')](_0x0112('0x34'))){_0x4a7dc7[_0x0112('0x1e')]=qs[_0x0112('0x1e')](_0x5afe63[_0x0112('0x2d')][_0x0112('0x1e')]);_0x4a7dc7[_0x0112('0x1c')]=qs[_0x0112('0x1c')](_0x5afe63[_0x0112('0x2d')][_0x0112('0x1c')]);}_0x4a7dc7[_0x0112('0x35')]=qs[_0x0112('0x36')](_0x5afe63['query']['sort']);_0x4a7dc7['where']=qs['filters'](_[_0x0112('0x37')](_0x5afe63['query'],_0x2afecb[_0x0112('0x2f')]),_0x2c07fd);if(_0x5afe63['query'][_0x0112('0x38')]){_0x4a7dc7[_0x0112('0x39')]=_[_0x0112('0x3a')](_0x4a7dc7[_0x0112('0x39')],{'$or':_['map'](_0x2c07fd,function(_0xef96fb){if(_0xef96fb[_0x0112('0x3b')]!==_0x0112('0x3c')){var _0x273921={};_0x273921[_0xef96fb['name']]={'$like':'%'+_0x5afe63['query']['filter']+'%'};return _0x273921;}})});}_0x4a7dc7=_[_0x0112('0x3a')]({},_0x4a7dc7,_0x5afe63[_0x0112('0x3d')]);var _0x185779={'where':_0x4a7dc7[_0x0112('0x39')]};return db['Campaign'][_0x0112('0x1f')](_0x185779)[_0x0112('0x25')](function(_0x29a300){_0x4ee450[_0x0112('0x1f')]=_0x29a300;if(_0x5afe63['query'][_0x0112('0x3e')]){_0x4a7dc7[_0x0112('0x3f')]=[{'all':!![]}];}return db[_0x0112('0x40')]['findAll'](_0x4a7dc7);})[_0x0112('0x25')](function(_0x143e00){_0x4ee450[_0x0112('0x41')]=_0x143e00;return _0x4ee450;})['then'](respondWithFilteredResult(_0x32e788,_0x4a7dc7))[_0x0112('0x42')](handleError(_0x32e788,null));};exports[_0x0112('0x43')]=function(_0x215b5a,_0x2cbef8){var _0xadcd7={'raw':![],'where':{'id':_0x215b5a['params']['id']}},_0x31568e={};_0x31568e[_0x0112('0x32')]=_['keys'](db[_0x0112('0x40')][_0x0112('0x44')]);_0x31568e[_0x0112('0x2d')]=_[_0x0112('0x2e')](_0x215b5a[_0x0112('0x2d')]);_0x31568e['filters']=_['intersection'](_0x31568e['model'],_0x31568e['query']);_0xadcd7[_0x0112('0x45')]=_[_0x0112('0x30')](_0x31568e['model'],qs[_0x0112('0x31')](_0x215b5a[_0x0112('0x2d')][_0x0112('0x31')]));_0xadcd7[_0x0112('0x45')]=_0xadcd7['attributes'][_0x0112('0x46')]?_0xadcd7[_0x0112('0x45')]:_0x31568e[_0x0112('0x32')];if(_0x215b5a[_0x0112('0x2d')]['includeAll']){_0xadcd7['include']=[{'all':!![]}];}_0xadcd7=_[_0x0112('0x3a')]({},_0xadcd7,_0x215b5a[_0x0112('0x3d')]);return db[_0x0112('0x40')]['find'](_0xadcd7)[_0x0112('0x25')](handleEntityNotFound(_0x2cbef8,null))[_0x0112('0x25')](respondWithResult(_0x2cbef8,null))[_0x0112('0x42')](handleError(_0x2cbef8,null));};exports[_0x0112('0x47')]=function(_0x4d7d63,_0x2962d6){return db[_0x0112('0x40')][_0x0112('0x47')](_0x4d7d63['body'],{})[_0x0112('0x25')](function(_0x2a2ede){var _0x5e7f32=_0x4d7d63[_0x0112('0x48')][_0x0112('0x49')]({'plain':!![]});if(!_0x5e7f32)throw new Error('Unable\x20to\x20retrieve\x20the\x20current\x20user');if(_0x5e7f32['role']==='user'){var _0x288ae7=_0x2a2ede['get']({'plain':!![]});var _0x218363='IvrCampaigns';return db['UserProfileSection']['find']({'where':{'name':_0x218363,'userProfileId':_0x5e7f32[_0x0112('0x4a')]},'raw':!![]})[_0x0112('0x25')](function(_0x5231e0){if(_0x5231e0&&_0x5231e0[_0x0112('0x4b')]===0x0){return db[_0x0112('0x4c')][_0x0112('0x47')]({'name':_0x288ae7[_0x0112('0x2a')],'resourceId':_0x288ae7['id'],'type':_0x5231e0[_0x0112('0x2a')],'sectionId':_0x5231e0['id']},{})['then'](function(){return _0x2a2ede;});}else{return _0x2a2ede;}})['catch'](function(_0x5c0a67){logger[_0x0112('0x29')]('Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s',_0x5c0a67);throw _0x5c0a67;});}return _0x2a2ede;})[_0x0112('0x25')](respondWithResult(_0x2962d6,0xc9))[_0x0112('0x42')](handleError(_0x2962d6,null));};exports[_0x0112('0x4d')]=function(_0x235671,_0x29f647){var _0x3ae8a4={'where':{'id':_0x235671['params']['id']}},_0x4c730f={};_0x4c730f[_0x0112('0x32')]=_[_0x0112('0x2e')](db['Campaign'][_0x0112('0x44')]);_0x3ae8a4[_0x0112('0x45')]=_[_0x0112('0x30')](_0x4c730f['model'],qs[_0x0112('0x31')](_0x235671[_0x0112('0x2d')][_0x0112('0x31')]));_0x3ae8a4['attributes']=_0x3ae8a4['attributes']['length']?_0x3ae8a4['attributes']:_0x4c730f[_0x0112('0x32')];if(_0x235671[_0x0112('0x2d')][_0x0112('0x3e')]){_0x3ae8a4['include']=[{'all':!![]}];}_0x3ae8a4=_[_0x0112('0x3a')]({},_0x3ae8a4,_0x235671[_0x0112('0x3d')]);return db[_0x0112('0x40')][_0x0112('0x4e')](_0x3ae8a4)['then'](handleEntityNotFound(_0x29f647,null))[_0x0112('0x25')](function(_0x5d9221){if(_0x5d9221){var _0x40e6cc=_0x5d9221[_0x0112('0x49')]({'plain':!![]});_0x40e6cc=qs[_0x0112('0x4f')](_0x40e6cc,['id',_0x0112('0x50'),_0x0112('0x51')]);_0x235671['body']=_['omit'](_0x235671[_0x0112('0x52')],['id','createdAt',_0x0112('0x51')]);return db[_0x0112('0x40')][_0x0112('0x47')](_[_0x0112('0x3a')](_0x40e6cc,_0x235671['body']),{'include':_0x235671[_0x0112('0x2d')][_0x0112('0x3e')]?[{'all':!![]}]:undefined})[_0x0112('0x25')](function(_0x267bde){var _0x14827f=_0x235671[_0x0112('0x48')][_0x0112('0x49')]({'plain':!![]});if(!_0x14827f)throw new Error('Unable\x20to\x20retrieve\x20the\x20current\x20user');if(_0x14827f['role']===_0x0112('0x48')){var _0x10d468=_0x267bde['get']({'plain':!![]});var _0x53c145='IvrCampaigns';return db[_0x0112('0x53')][_0x0112('0x4e')]({'where':{'name':_0x53c145,'userProfileId':_0x14827f['userProfileId']},'raw':!![]})[_0x0112('0x25')](function(_0x4bc323){if(_0x4bc323&&_0x4bc323[_0x0112('0x4b')]===0x0){return db[_0x0112('0x4c')]['create']({'name':_0x10d468[_0x0112('0x2a')],'resourceId':_0x10d468['id'],'type':_0x4bc323[_0x0112('0x2a')],'sectionId':_0x4bc323['id']},{})[_0x0112('0x25')](function(){return _0x267bde;});}else{return _0x267bde;}})[_0x0112('0x42')](function(_0x53e2d9){logger[_0x0112('0x29')](_0x0112('0x54'),_0x53e2d9);throw _0x53e2d9;});}return _0x267bde;});}})[_0x0112('0x25')](respondWithResult(_0x29f647,0xc9))[_0x0112('0x42')](handleError(_0x29f647,null));};exports[_0x0112('0x24')]=function(_0x12aa2f,_0x109948){if(_0x12aa2f[_0x0112('0x52')]['id']){delete _0x12aa2f['body']['id'];}return db[_0x0112('0x40')]['find']({'where':{'id':_0x12aa2f[_0x0112('0x55')]['id']}})['then'](handleEntityNotFound(_0x109948,null))[_0x0112('0x25')](saveUpdates(_0x12aa2f['body'],null))[_0x0112('0x25')](respondWithResult(_0x109948,null))[_0x0112('0x42')](handleError(_0x109948,null));};exports[_0x0112('0x26')]=function(_0x5fc49d,_0x16e299){return db['Campaign'][_0x0112('0x4e')]({'where':{'id':_0x5fc49d['params']['id']}})[_0x0112('0x25')](handleEntityNotFound(_0x16e299,null))[_0x0112('0x25')](removeEntity(_0x16e299,null))[_0x0112('0x42')](handleError(_0x16e299,null));};exports[_0x0112('0x56')]=function(_0x1cb10e,_0x7b4c06,_0x38903c){var _0x1438af={'raw':!![],'where':{}};var _0x3c0187={};var _0x3d14e5={'count':0x0,'rows':[]};return db[_0x0112('0x40')][_0x0112('0x57')]({'where':{'id':_0x1cb10e[_0x0112('0x55')]['id']}})[_0x0112('0x25')](handleEntityNotFound(_0x7b4c06,null))['then'](function(_0x1f88ad){if(_0x1f88ad){_0x3c0187['model']=_[_0x0112('0x2e')](db[_0x0112('0x58')][_0x0112('0x44')]);_0x3c0187[_0x0112('0x2d')]=_[_0x0112('0x2e')](_0x1cb10e['query']);_0x3c0187[_0x0112('0x2f')]=_[_0x0112('0x30')](_0x3c0187[_0x0112('0x32')],_0x3c0187[_0x0112('0x2d')]);_0x1438af[_0x0112('0x45')]=_[_0x0112('0x30')](_0x3c0187[_0x0112('0x32')],qs['fields'](_0x1cb10e['query'][_0x0112('0x31')]));_0x1438af['attributes']=_0x1438af[_0x0112('0x45')][_0x0112('0x46')]?_0x1438af[_0x0112('0x45')]:_0x3c0187[_0x0112('0x32')];if(!_0x1cb10e['query'][_0x0112('0x33')](_0x0112('0x34'))){_0x1438af[_0x0112('0x1e')]=qs[_0x0112('0x1e')](_0x1cb10e[_0x0112('0x2d')][_0x0112('0x1e')]);_0x1438af[_0x0112('0x1c')]=qs['offset'](_0x1cb10e[_0x0112('0x2d')][_0x0112('0x1c')]);}_0x1438af[_0x0112('0x35')]=qs[_0x0112('0x36')](_0x1cb10e[_0x0112('0x2d')][_0x0112('0x36')]);_0x1438af['where']=qs['filters'](_[_0x0112('0x37')](_0x1cb10e['query'],_0x3c0187['filters']));_0x1438af['where'][_0x0112('0x59')]=_0x1f88ad['id'];if(_0x1cb10e[_0x0112('0x2d')]['filter']){_0x1438af[_0x0112('0x39')]=_[_0x0112('0x3a')](_0x1438af[_0x0112('0x39')],{'$or':_['map'](_0x1438af[_0x0112('0x45')],function(_0x22a621){var _0x4d9175={};_0x4d9175[_0x22a621]={'$like':'%'+_0x1cb10e[_0x0112('0x2d')][_0x0112('0x38')]+'%'};return _0x4d9175;})});}_0x1438af=_['merge']({},_0x1438af,_0x1cb10e[_0x0112('0x3d')]);return db[_0x0112('0x58')][_0x0112('0x1f')]({'where':_0x1438af[_0x0112('0x39')]})[_0x0112('0x25')](function(_0x438df5){_0x3d14e5[_0x0112('0x1f')]=_0x438df5;if(_0x1cb10e[_0x0112('0x2d')][_0x0112('0x3e')]){_0x1438af[_0x0112('0x3f')]=[{'all':!![]}];}return db['CmHopper'][_0x0112('0x5a')](_0x1438af);})[_0x0112('0x25')](function(_0x4d9791){_0x3d14e5[_0x0112('0x41')]=_0x4d9791;return _0x3d14e5;});}})[_0x0112('0x25')](respondWithFilteredResult(_0x7b4c06,_0x1438af))[_0x0112('0x42')](handleError(_0x7b4c06,null));};exports['getHopperHistories']=function(_0x3fe37f,_0x24c93e,_0x533d46){var _0x9d3a64={'raw':!![],'where':{}};var _0x566b5b={};var _0x5d2b54={'count':0x0,'rows':[]};return db[_0x0112('0x40')][_0x0112('0x57')]({'where':{'id':_0x3fe37f[_0x0112('0x55')]['id']}})[_0x0112('0x25')](handleEntityNotFound(_0x24c93e,null))[_0x0112('0x25')](function(_0x4960bc){if(_0x4960bc){_0x566b5b['model']=_[_0x0112('0x2e')](db[_0x0112('0x5b')][_0x0112('0x44')]);_0x566b5b['query']=_['keys'](_0x3fe37f[_0x0112('0x2d')]);_0x566b5b[_0x0112('0x2f')]=_[_0x0112('0x30')](_0x566b5b[_0x0112('0x32')],_0x566b5b[_0x0112('0x2d')]);_0x9d3a64[_0x0112('0x45')]=_[_0x0112('0x30')](_0x566b5b[_0x0112('0x32')],qs[_0x0112('0x31')](_0x3fe37f['query'][_0x0112('0x31')]));_0x9d3a64[_0x0112('0x45')]=_0x9d3a64[_0x0112('0x45')][_0x0112('0x46')]?_0x9d3a64[_0x0112('0x45')]:_0x566b5b[_0x0112('0x32')];if(!_0x3fe37f[_0x0112('0x2d')]['hasOwnProperty'](_0x0112('0x34'))){_0x9d3a64['limit']=qs[_0x0112('0x1e')](_0x3fe37f[_0x0112('0x2d')]['limit']);_0x9d3a64[_0x0112('0x1c')]=qs[_0x0112('0x1c')](_0x3fe37f[_0x0112('0x2d')][_0x0112('0x1c')]);}_0x9d3a64['order']=qs[_0x0112('0x36')](_0x3fe37f['query'][_0x0112('0x36')]);_0x9d3a64['where']=qs[_0x0112('0x2f')](_[_0x0112('0x37')](_0x3fe37f[_0x0112('0x2d')],_0x566b5b[_0x0112('0x2f')]));_0x9d3a64[_0x0112('0x39')][_0x0112('0x59')]=_0x4960bc['id'];if(_0x3fe37f[_0x0112('0x2d')][_0x0112('0x38')]){_0x9d3a64[_0x0112('0x39')]=_[_0x0112('0x3a')](_0x9d3a64['where'],{'$or':_[_0x0112('0x5c')](_0x9d3a64[_0x0112('0x45')],function(_0x33068f){var _0x3607ac={};_0x3607ac[_0x33068f]={'$like':'%'+_0x3fe37f[_0x0112('0x2d')][_0x0112('0x38')]+'%'};return _0x3607ac;})});}_0x9d3a64=_['merge']({},_0x9d3a64,_0x3fe37f[_0x0112('0x3d')]);return db['CmHopperHistory'][_0x0112('0x1f')]({'where':_0x9d3a64['where']})[_0x0112('0x25')](function(_0x40f84d){_0x5d2b54['count']=_0x40f84d;if(_0x3fe37f['query'][_0x0112('0x3e')]){_0x9d3a64[_0x0112('0x3f')]=[{'all':!![]}];}return db[_0x0112('0x5b')][_0x0112('0x5a')](_0x9d3a64);})[_0x0112('0x25')](function(_0x498730){_0x5d2b54[_0x0112('0x41')]=_0x498730;return _0x5d2b54;});}})[_0x0112('0x25')](respondWithFilteredResult(_0x24c93e,_0x9d3a64))[_0x0112('0x42')](handleError(_0x24c93e,null));};exports[_0x0112('0x5d')]=function(_0x3322f8,_0x26a2c6,_0x10313e){var _0x18500b={'raw':!![],'where':{}};var _0x1e1c57={};var _0x370c30={'count':0x0,'rows':[]};return db[_0x0112('0x40')]['findOne']({'where':{'id':_0x3322f8[_0x0112('0x55')]['id']}})[_0x0112('0x25')](handleEntityNotFound(_0x26a2c6,null))[_0x0112('0x25')](function(_0x23bde6){if(_0x23bde6){_0x1e1c57[_0x0112('0x32')]=_[_0x0112('0x2e')](db[_0x0112('0x5e')][_0x0112('0x44')]);_0x1e1c57[_0x0112('0x2d')]=_[_0x0112('0x2e')](_0x3322f8[_0x0112('0x2d')]);_0x1e1c57[_0x0112('0x2f')]=_[_0x0112('0x30')](_0x1e1c57[_0x0112('0x32')],_0x1e1c57[_0x0112('0x2d')]);_0x18500b[_0x0112('0x45')]=_[_0x0112('0x30')](_0x1e1c57[_0x0112('0x32')],qs[_0x0112('0x31')](_0x3322f8['query']['fields']));_0x18500b[_0x0112('0x45')]=_0x18500b[_0x0112('0x45')][_0x0112('0x46')]?_0x18500b[_0x0112('0x45')]:_0x1e1c57[_0x0112('0x32')];if(!_0x3322f8[_0x0112('0x2d')]['hasOwnProperty'](_0x0112('0x34'))){_0x18500b[_0x0112('0x1e')]=qs[_0x0112('0x1e')](_0x3322f8[_0x0112('0x2d')][_0x0112('0x1e')]);_0x18500b[_0x0112('0x1c')]=qs[_0x0112('0x1c')](_0x3322f8[_0x0112('0x2d')][_0x0112('0x1c')]);}_0x18500b[_0x0112('0x35')]=qs[_0x0112('0x36')](_0x3322f8[_0x0112('0x2d')]['sort']);_0x18500b[_0x0112('0x39')]=qs[_0x0112('0x2f')](_[_0x0112('0x37')](_0x3322f8[_0x0112('0x2d')],_0x1e1c57[_0x0112('0x2f')]));_0x18500b[_0x0112('0x39')][_0x0112('0x59')]=_0x23bde6['id'];if(_0x3322f8[_0x0112('0x2d')][_0x0112('0x38')]){_0x18500b[_0x0112('0x39')]=_[_0x0112('0x3a')](_0x18500b[_0x0112('0x39')],{'$or':_[_0x0112('0x5c')](_0x18500b['attributes'],function(_0x59fbd4){var _0x3b8a28={};_0x3b8a28[_0x59fbd4]={'$like':'%'+_0x3322f8[_0x0112('0x2d')][_0x0112('0x38')]+'%'};return _0x3b8a28;})});}_0x18500b=_['merge']({},_0x18500b,_0x3322f8['options']);return db[_0x0112('0x5e')][_0x0112('0x1f')]({'where':_0x18500b[_0x0112('0x39')]})[_0x0112('0x25')](function(_0x6762b0){_0x370c30[_0x0112('0x1f')]=_0x6762b0;if(_0x3322f8[_0x0112('0x2d')][_0x0112('0x3e')]){_0x18500b[_0x0112('0x3f')]=[{'all':!![]}];}return db[_0x0112('0x5e')][_0x0112('0x5a')](_0x18500b);})[_0x0112('0x25')](function(_0x44d8c0){_0x370c30[_0x0112('0x41')]=_0x44d8c0;return _0x370c30;});}})['then'](respondWithFilteredResult(_0x26a2c6,_0x18500b))[_0x0112('0x42')](handleError(_0x26a2c6,null));};exports[_0x0112('0x5f')]=function(_0x4029b0,_0x51ca7b,_0x232823){var _0x1f8e7d={'raw':!![],'where':{}};var _0xec3a00={};var _0x4ea581={'count':0x0,'rows':[]};return db[_0x0112('0x40')][_0x0112('0x57')]({'where':{'id':_0x4029b0[_0x0112('0x55')]['id']}})[_0x0112('0x25')](handleEntityNotFound(_0x51ca7b,null))[_0x0112('0x25')](function(_0x4ccde8){if(_0x4ccde8){_0xec3a00['model']=_['keys'](db[_0x0112('0x60')][_0x0112('0x44')]);_0xec3a00[_0x0112('0x2d')]=_['keys'](_0x4029b0[_0x0112('0x2d')]);_0xec3a00['filters']=_[_0x0112('0x30')](_0xec3a00[_0x0112('0x32')],_0xec3a00['query']);_0x1f8e7d['attributes']=_[_0x0112('0x30')](_0xec3a00[_0x0112('0x32')],qs[_0x0112('0x31')](_0x4029b0[_0x0112('0x2d')]['fields']));_0x1f8e7d[_0x0112('0x45')]=_0x1f8e7d['attributes'][_0x0112('0x46')]?_0x1f8e7d[_0x0112('0x45')]:_0xec3a00[_0x0112('0x32')];if(!_0x4029b0[_0x0112('0x2d')][_0x0112('0x33')]('nolimit')){_0x1f8e7d['limit']=qs['limit'](_0x4029b0[_0x0112('0x2d')][_0x0112('0x1e')]);_0x1f8e7d[_0x0112('0x1c')]=qs[_0x0112('0x1c')](_0x4029b0['query'][_0x0112('0x1c')]);}_0x1f8e7d[_0x0112('0x35')]=qs[_0x0112('0x36')](_0x4029b0['query'][_0x0112('0x36')]);_0x1f8e7d[_0x0112('0x39')]=qs[_0x0112('0x2f')](_[_0x0112('0x37')](_0x4029b0[_0x0112('0x2d')],_0xec3a00[_0x0112('0x2f')]));_0x1f8e7d['where']['CampaignId']=_0x4ccde8['id'];if(_0x4029b0['query'][_0x0112('0x38')]){_0x1f8e7d[_0x0112('0x39')]=_[_0x0112('0x3a')](_0x1f8e7d[_0x0112('0x39')],{'$or':_['map'](_0x1f8e7d['attributes'],function(_0x44ff12){var _0x26265f={};_0x26265f[_0x44ff12]={'$like':'%'+_0x4029b0[_0x0112('0x2d')]['filter']+'%'};return _0x26265f;})});}_0x1f8e7d=_[_0x0112('0x3a')]({},_0x1f8e7d,_0x4029b0['options']);return db[_0x0112('0x60')][_0x0112('0x1f')]({'where':_0x1f8e7d[_0x0112('0x39')]})[_0x0112('0x25')](function(_0x5400ce){_0x4ea581['count']=_0x5400ce;if(_0x4029b0[_0x0112('0x2d')][_0x0112('0x3e')]){_0x1f8e7d[_0x0112('0x3f')]=[{'all':!![]}];}return db['CmHopperBlack']['findAll'](_0x1f8e7d);})[_0x0112('0x25')](function(_0x4875e4){_0x4ea581['rows']=_0x4875e4;return _0x4ea581;});}})[_0x0112('0x25')](respondWithFilteredResult(_0x51ca7b,_0x1f8e7d))[_0x0112('0x42')](handleError(_0x51ca7b,null));};exports[_0x0112('0x61')]=function(_0x20dcb0,_0x3e13ac,_0x7015fb){var _0x31158c={};var _0x1c1286={};var _0xa63152;var _0x44ee3a;return db['Campaign'][_0x0112('0x57')]({'where':{'id':_0x20dcb0[_0x0112('0x55')]['id']}})['then'](handleEntityNotFound(_0x3e13ac,null))[_0x0112('0x25')](function(_0x5d07fa){if(_0x5d07fa){_0xa63152=_0x5d07fa;_0x1c1286[_0x0112('0x32')]=_[_0x0112('0x2e')](db[_0x0112('0x62')]['rawAttributes']);_0x1c1286[_0x0112('0x2d')]=_[_0x0112('0x2e')](_0x20dcb0[_0x0112('0x2d')]);_0x1c1286[_0x0112('0x2f')]=_[_0x0112('0x30')](_0x1c1286[_0x0112('0x32')],_0x1c1286[_0x0112('0x2d')]);_0x31158c[_0x0112('0x45')]=_[_0x0112('0x30')](_0x1c1286[_0x0112('0x32')],qs['fields'](_0x20dcb0[_0x0112('0x2d')]['fields']));_0x31158c[_0x0112('0x45')]=_0x31158c[_0x0112('0x45')][_0x0112('0x46')]?_0x31158c['attributes']:_0x1c1286[_0x0112('0x32')];_0x31158c[_0x0112('0x35')]=qs[_0x0112('0x36')](_0x20dcb0['query'][_0x0112('0x36')]);_0x31158c['where']=qs[_0x0112('0x2f')](_['pick'](_0x20dcb0[_0x0112('0x2d')],_0x1c1286[_0x0112('0x2f')]));if(_0x20dcb0[_0x0112('0x2d')][_0x0112('0x38')]){_0x31158c['where']=_[_0x0112('0x3a')](_0x31158c[_0x0112('0x39')],{'$or':_[_0x0112('0x5c')](_0x31158c[_0x0112('0x45')],function(_0x298e3d){var _0x1d0dd4={};_0x1d0dd4[_0x298e3d]={'$like':'%'+_0x20dcb0[_0x0112('0x2d')][_0x0112('0x38')]+'%'};return _0x1d0dd4;})});}_0x31158c=_[_0x0112('0x3a')]({},_0x31158c,_0x20dcb0['options']);return _0xa63152[_0x0112('0x61')](_0x31158c);}})[_0x0112('0x25')](function(_0x358167){if(_0x358167){_0x44ee3a=_0x358167[_0x0112('0x46')];if(!_0x20dcb0[_0x0112('0x2d')][_0x0112('0x33')](_0x0112('0x34'))){_0x31158c[_0x0112('0x1e')]=qs[_0x0112('0x1e')](_0x20dcb0[_0x0112('0x2d')][_0x0112('0x1e')]);_0x31158c[_0x0112('0x1c')]=qs[_0x0112('0x1c')](_0x20dcb0[_0x0112('0x2d')][_0x0112('0x1c')]);}return _0xa63152['getLists'](_0x31158c);}})[_0x0112('0x25')](function(_0x24418b){if(_0x24418b){return _0x24418b?{'count':_0x44ee3a,'rows':_0x24418b}:null;}})[_0x0112('0x25')](respondWithResult(_0x3e13ac,null))[_0x0112('0x42')](handleError(_0x3e13ac,null));};exports[_0x0112('0x63')]=function(_0x3fd679,_0x282d05,_0x3e49c5){var _0x42006f,_0x333dbf;var _0x2484f4=[];var _0x331bc3=moment()[_0x0112('0x64')](_0x0112('0x65'));return db[_0x0112('0x40')][_0x0112('0x4e')]({'where':{'id':_0x3fd679[_0x0112('0x55')]['id']}})[_0x0112('0x25')](handleEntityNotFound(_0x282d05,null))[_0x0112('0x25')](function(_0x58e905){if(_0x58e905){_0x333dbf=_0x58e905;return _0x58e905[_0x0112('0x63')](_0x3fd679[_0x0112('0x52')][_0x0112('0x66')],_[_0x0112('0x4f')](_0x3fd679[_0x0112('0x52')],['ids','id'])||{});}return null;})['spread'](function(_0xfd3d09){var _0x6f1001;var _0x254592;_0x42006f=_0xfd3d09||[];var _0x2ef020=[];if(_0xfd3d09){for(var _0xe68734=0x0;_0xe68734<_0xfd3d09[_0x0112('0x46')];_0xe68734+=0x1){var _0xd3757f=_0xfd3d09[_0xe68734][_0x0112('0x49')]({'plain':!![]});_0x333dbf[_0x0112('0x67')]=_0x3fd679[_0x0112('0x52')][_0x0112('0x67')]?_0x3fd679['body'][_0x0112('0x67')]:_0x333dbf['dialCheckDuplicateType'];switch(_0x333dbf[_0x0112('0x67')]){case'always':_0x6f1001=squel[_0x0112('0x68')]()[_0x0112('0x69')](_0x0112('0x6a'))[_0x0112('0x6b')](['phone',_0x0112('0x6c'),'ContactId','ListId',_0x0112('0x59'),_0x0112('0x50'),'updatedAt'],squel[_0x0112('0x6d')]()[_0x0112('0x6e')](_0x0112('0x6f'),_0x0112('0x6f'))[_0x0112('0x6e')](_0x0112('0x70'),'scheduledAt')['field']('id',_0x0112('0x71'))[_0x0112('0x6e')](_0xd3757f[_0x0112('0x72')][_0x0112('0x73')](),'ListId')[_0x0112('0x6e')](_0x3fd679[_0x0112('0x55')]['id'][_0x0112('0x73')](),_0x0112('0x59'))[_0x0112('0x6e')]('\x27'+_0x331bc3+'\x27',_0x0112('0x50'))['field']('\x27'+_0x331bc3+'\x27',_0x0112('0x51'))[_0x0112('0x74')](_0x0112('0x75'))[_0x0112('0x39')]('deletedAt\x20IS\x20NULL')['where'](_0x0112('0x76'),_0xd3757f[_0x0112('0x72')]['toString']())[_0x0112('0x39')](_0x0112('0x77'))[_0x0112('0x39')](_0x0112('0x78'),squel[_0x0112('0x6d')]()[_0x0112('0x6e')](_0x0112('0x79'))[_0x0112('0x74')](_0x0112('0x7a'))['where'](_0x0112('0x7b'),_0x3fd679[_0x0112('0x55')]['id'][_0x0112('0x73')]()))['where']('phone\x20NOT\x20IN\x20(?)',squel[_0x0112('0x6d')]()[_0x0112('0x6e')]('COALESCE(phone,\x27\x27)')[_0x0112('0x74')](_0x0112('0x6a'))[_0x0112('0x39')]('CampaignId\x20=\x20?',_0x3fd679[_0x0112('0x55')]['id'][_0x0112('0x73')]())))[_0x0112('0x73')]();break;case _0x0112('0x7c'):_0x6f1001=squel['insert']()[_0x0112('0x69')](_0x0112('0x6a'))[_0x0112('0x6b')]([_0x0112('0x6f'),_0x0112('0x6c'),'ContactId',_0x0112('0x7d'),_0x0112('0x59'),_0x0112('0x50'),'updatedAt'],squel[_0x0112('0x6d')]()[_0x0112('0x6e')](_0x0112('0x6f'),_0x0112('0x6f'))[_0x0112('0x6e')](_0x0112('0x70'),'scheduledAt')['field']('id',_0x0112('0x71'))[_0x0112('0x6e')](_0xd3757f[_0x0112('0x72')]['toString'](),'ListId')[_0x0112('0x6e')](_0x3fd679[_0x0112('0x55')]['id'][_0x0112('0x73')](),'CampaignId')[_0x0112('0x6e')]('\x27'+_0x331bc3+'\x27',_0x0112('0x50'))[_0x0112('0x6e')]('\x27'+_0x331bc3+'\x27',_0x0112('0x51'))[_0x0112('0x74')](_0x0112('0x75'))['where'](_0x0112('0x7e'))[_0x0112('0x39')](_0x0112('0x76'),_0xd3757f[_0x0112('0x72')][_0x0112('0x73')]())[_0x0112('0x39')](_0x0112('0x77'))[_0x0112('0x39')](_0x0112('0x78'),squel[_0x0112('0x6d')]()[_0x0112('0x6e')]('COALESCE(phone,\x27\x27)')[_0x0112('0x74')]('cm_hopper')['where'](_0x0112('0x7b'),_0x3fd679[_0x0112('0x55')]['id'][_0x0112('0x73')]())))[_0x0112('0x73')]();break;default:_0x6f1001=squel[_0x0112('0x68')]()[_0x0112('0x69')](_0x0112('0x6a'))[_0x0112('0x6b')]([_0x0112('0x6f'),_0x0112('0x6c'),_0x0112('0x71'),'ListId','CampaignId',_0x0112('0x50'),_0x0112('0x51')],squel[_0x0112('0x6d')]()[_0x0112('0x6e')]('phone',_0x0112('0x6f'))['field'](_0x0112('0x70'),_0x0112('0x6c'))[_0x0112('0x6e')]('id','ContactId')[_0x0112('0x6e')](_0xd3757f[_0x0112('0x72')][_0x0112('0x73')](),_0x0112('0x7d'))['field'](_0x3fd679['params']['id']['toString'](),_0x0112('0x59'))[_0x0112('0x6e')]('\x27'+_0x331bc3+'\x27',_0x0112('0x50'))[_0x0112('0x6e')]('\x27'+_0x331bc3+'\x27',_0x0112('0x51'))['from'](_0x0112('0x75'))[_0x0112('0x39')](_0x0112('0x7e'))[_0x0112('0x39')]('ListId\x20=\x20?',_0xd3757f['CmListId']['toString']())[_0x0112('0x39')](_0x0112('0x77')))[_0x0112('0x73')]();}_0x254592=squel['insert']()[_0x0112('0x69')](_0x0112('0x7f'))[_0x0112('0x6b')]([_0x0112('0x80'),_0x0112('0x6c'),_0x0112('0x6f'),_0x0112('0x81'),_0x0112('0x50'),_0x0112('0x51')],squel[_0x0112('0x6d')]()[_0x0112('0x6e')](_0x0112('0x82'),'id')[_0x0112('0x6e')](_0x0112('0x70'),_0x0112('0x6c'))[_0x0112('0x6e')](_0x0112('0x83'),_0x0112('0x6f'))[_0x0112('0x6e')](_0x0112('0x84'),_0x0112('0x81'))[_0x0112('0x6e')]('\x27'+_0x331bc3+'\x27',_0x0112('0x50'))[_0x0112('0x6e')]('\x27'+_0x331bc3+'\x27',_0x0112('0x51'))['from'](_0x0112('0x85'),'ci')[_0x0112('0x86')]('cm_hopper','h',_0x0112('0x87'))[_0x0112('0x39')](_0x0112('0x88'),_0xd3757f[_0x0112('0x72')][_0x0112('0x73')]())['where'](_0x0112('0x89'),_0x3fd679[_0x0112('0x55')]['id'][_0x0112('0x73')]())[_0x0112('0x39')](_0x0112('0x8a'),_0x331bc3))[_0x0112('0x73')]();_0x2ef020['push'](db['sequelize'][_0x0112('0x2d')](_0x6f1001));_0x2484f4[_0x0112('0x8b')](db[_0x0112('0x8c')][_0x0112('0x2d')](_0x254592));}return BPromise[_0x0112('0x8d')](_0x2ef020);}})[_0x0112('0x25')](function(){return BPromise[_0x0112('0x8d')](_0x2484f4);})[_0x0112('0x25')](function(){return _0x42006f;})['then'](respondWithResult(_0x282d05,null))[_0x0112('0x42')](handleError(_0x282d05,null));};exports[_0x0112('0x8e')]=function(_0x46fa01,_0x3b0708,_0x34922f){return db[_0x0112('0x40')]['find']({'where':{'id':_0x46fa01['params']['id']}})['then'](handleEntityNotFound(_0x3b0708,null))[_0x0112('0x25')](function(_0x5d634b){if(_0x5d634b){return _0x5d634b[_0x0112('0x8e')](_0x46fa01[_0x0112('0x2d')][_0x0112('0x66')]);}})['then'](function(_0x1014d5){if(_0x1014d5){return db[_0x0112('0x58')][_0x0112('0x26')]({'where':{'ListId':_0x46fa01[_0x0112('0x2d')][_0x0112('0x66')],'CampaignId':_0x46fa01[_0x0112('0x55')]['id']}})[_0x0112('0x25')](function(){return _0x1014d5;});}})['then'](respondWithStatusCode(_0x3b0708,null))['catch'](handleError(_0x3b0708,null));};exports[_0x0112('0x8f')]=function(_0x4cee96,_0x1b2f1a,_0x20088a){var _0xb7e99a={};var _0x1b3e57={};var _0x24c554;var _0x24ac07;return db[_0x0112('0x40')]['findOne']({'where':{'id':_0x4cee96[_0x0112('0x55')]['id']}})['then'](handleEntityNotFound(_0x1b2f1a,null))['then'](function(_0x17daf0){if(_0x17daf0){_0x24c554=_0x17daf0;_0x1b3e57[_0x0112('0x32')]=_[_0x0112('0x2e')](db[_0x0112('0x62')][_0x0112('0x44')]);_0x1b3e57['query']=_[_0x0112('0x2e')](_0x4cee96[_0x0112('0x2d')]);_0x1b3e57[_0x0112('0x2f')]=_[_0x0112('0x30')](_0x1b3e57['model'],_0x1b3e57[_0x0112('0x2d')]);_0xb7e99a['attributes']=_[_0x0112('0x30')](_0x1b3e57[_0x0112('0x32')],qs['fields'](_0x4cee96[_0x0112('0x2d')][_0x0112('0x31')]));_0xb7e99a[_0x0112('0x45')]=_0xb7e99a[_0x0112('0x45')]['length']?_0xb7e99a['attributes']:_0x1b3e57[_0x0112('0x32')];_0xb7e99a[_0x0112('0x35')]=qs[_0x0112('0x36')](_0x4cee96[_0x0112('0x2d')][_0x0112('0x36')]);_0xb7e99a[_0x0112('0x39')]=qs['filters'](_[_0x0112('0x37')](_0x4cee96['query'],_0x1b3e57[_0x0112('0x2f')]));if(_0x4cee96[_0x0112('0x2d')][_0x0112('0x38')]){_0xb7e99a[_0x0112('0x39')]=_[_0x0112('0x3a')](_0xb7e99a[_0x0112('0x39')],{'$or':_['map'](_0xb7e99a[_0x0112('0x45')],function(_0x281668){var _0x4b3412={};_0x4b3412[_0x281668]={'$like':'%'+_0x4cee96[_0x0112('0x2d')][_0x0112('0x38')]+'%'};return _0x4b3412;})});}_0xb7e99a=_['merge']({},_0xb7e99a,_0x4cee96['options']);return _0x24c554[_0x0112('0x8f')](_0xb7e99a);}})[_0x0112('0x25')](function(_0x2b2b37){if(_0x2b2b37){_0x24ac07=_0x2b2b37[_0x0112('0x46')];if(!_0x4cee96[_0x0112('0x2d')][_0x0112('0x33')](_0x0112('0x34'))){_0xb7e99a[_0x0112('0x1e')]=qs['limit'](_0x4cee96[_0x0112('0x2d')][_0x0112('0x1e')]);_0xb7e99a[_0x0112('0x1c')]=qs[_0x0112('0x1c')](_0x4cee96[_0x0112('0x2d')]['offset']);}return _0x24c554[_0x0112('0x8f')](_0xb7e99a);}})[_0x0112('0x25')](function(_0x5528bb){if(_0x5528bb){return _0x5528bb?{'count':_0x24ac07,'rows':_0x5528bb}:null;}})[_0x0112('0x25')](respondWithResult(_0x1b2f1a,null))[_0x0112('0x42')](handleError(_0x1b2f1a,null));};exports[_0x0112('0x90')]=function(_0x2dbf6e,_0x4fdc19,_0x4b580c){var _0x4274ef,_0x1d110f;var _0x9fdfae=[];var _0x3a1c5=moment()['format'](_0x0112('0x65'));return db[_0x0112('0x40')]['find']({'where':{'id':_0x2dbf6e[_0x0112('0x55')]['id']}})['then'](handleEntityNotFound(_0x4fdc19,null))['then'](function(_0x1c46e8){if(_0x1c46e8){_0x1d110f=_0x1c46e8;return _0x1c46e8[_0x0112('0x90')](_0x2dbf6e['body']['ids'],_[_0x0112('0x4f')](_0x2dbf6e[_0x0112('0x52')],[_0x0112('0x66'),'id'])||{});}return null;})['spread'](function(_0x13d009){var _0x4dba21;var _0x50823e;_0x4274ef=_0x13d009||[];var _0x58f5ba=[];if(_0x13d009){for(var _0x44be2e=0x0;_0x44be2e<_0x13d009['length'];_0x44be2e+=0x1){var _0x500c12=_0x13d009[_0x44be2e][_0x0112('0x49')]({'plain':!![]});_0x4dba21=squel[_0x0112('0x68')]()['into'](_0x0112('0x91'))[_0x0112('0x6b')]([_0x0112('0x6f'),'ContactId',_0x0112('0x7d'),_0x0112('0x59'),_0x0112('0x50'),_0x0112('0x51')],squel[_0x0112('0x6d')]()['field'](_0x0112('0x6f'),_0x0112('0x6f'))[_0x0112('0x6e')]('id',_0x0112('0x71'))['field'](_0x500c12[_0x0112('0x72')][_0x0112('0x73')](),_0x0112('0x7d'))[_0x0112('0x6e')](_0x2dbf6e[_0x0112('0x55')]['id'][_0x0112('0x73')](),_0x0112('0x59'))[_0x0112('0x6e')]('NOW()',_0x0112('0x50'))['field'](_0x0112('0x70'),_0x0112('0x51'))['from'](_0x0112('0x75'))[_0x0112('0x39')](_0x0112('0x7e'))[_0x0112('0x39')](_0x0112('0x76'),_0x500c12['CmListId']['toString']())[_0x0112('0x39')](_0x0112('0x77')))[_0x0112('0x73')]();_0x58f5ba[_0x0112('0x8b')](db[_0x0112('0x8c')]['query'](_0x4dba21));}return BPromise[_0x0112('0x8d')](_0x58f5ba);}})['then'](function(){return _0x4274ef;})[_0x0112('0x25')](respondWithResult(_0x4fdc19,null))[_0x0112('0x42')](handleError(_0x4fdc19,null));};exports[_0x0112('0x92')]=function(_0x2ee845,_0x5ed960,_0x1662c9){return db[_0x0112('0x40')][_0x0112('0x4e')]({'where':{'id':_0x2ee845[_0x0112('0x55')]['id']}})[_0x0112('0x25')](handleEntityNotFound(_0x5ed960,null))[_0x0112('0x25')](function(_0x5a7a09){if(_0x5a7a09){return _0x5a7a09['removeBlackLists'](_0x2ee845[_0x0112('0x2d')]['ids']);}})[_0x0112('0x25')](function(_0x35bb8b){if(_0x35bb8b){return db[_0x0112('0x60')][_0x0112('0x26')]({'where':{'ListId':_0x2ee845[_0x0112('0x2d')][_0x0112('0x66')],'CampaignId':_0x2ee845[_0x0112('0x55')]['id']}})[_0x0112('0x25')](function(){return _0x35bb8b;});}})[_0x0112('0x25')](respondWithStatusCode(_0x5ed960,null))[_0x0112('0x42')](handleError(_0x5ed960,null));}; \ No newline at end of file +var _0x4255=['removeLists','getBlackLists','addBlackLists','cm_hopper_black','removeBlackLists','eml-format','zip-dir','fast-json-patch','request-promise','moment','mustache','util','path','sox','to-csv','ejs','fs-extra','lodash','squel','crypto','jsforce','desk.js','querystring','papaparse','../../components/auth/service','../../config/license/hardware','api','../../config/utils','../../config/license/util','status','json','offset','limit','undefined','count','set','Content-Range','apply','reject','save','update','then','get','IvrCampaigns','destroy','end','sendStatus','error','name','map','Campaign','fieldName','key','query','filters','intersection','fields','attributes','length','hasOwnProperty','order','sort','where','pick','filter','merge','VIRTUAL','includeAll','include','findAll','catch','show','params','model','keys','options','find','create','body','Unable\x20to\x20retrieve\x20the\x20current\x20user','role','user','UserProfileSection','userProfileId','autoAssociation','UserProfileResource','clone','omit','createdAt','updatedAt','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','nolimit','CmHopper','rows','getHopperHistories','rawAttributes','CampaignId','CmHopperHistory','getHopperFinals','findOne','CmHopperFinal','getHopperBlacks','CmHopperBlack','getLists','CmList','addLists','format','YYYY-MM-DD\x20HH:mm:ss','ids','spread','dialCheckDuplicateType','always','insert','into','phone','ContactId','ListId','select','field','NOW()','scheduledAt','CmListId','toString','from','cm_contacts','ListId\x20=\x20?','phone\x20IS\x20NOT\x20NULL','cm_hopper_final','CampaignId\x20=\x20?','phone\x20NOT\x20IN\x20(?)','COALESCE(phone,\x27\x27)','cm_hopper','onlyIfOpen','fromQuery','deletedAt\x20IS\x20NULL','cmHopperId','OrderBy','h.id','ci.item','ci.OrderBY','cm_contact_has_items','h.ContactId\x20=\x20ci.CmContactId','h.createdAt\x20=\x20?','push','sequelize','all'];(function(_0x43ec68,_0x2b435a){var _0x58a949=function(_0x524239){while(--_0x524239){_0x43ec68['push'](_0x43ec68['shift']());}};_0x58a949(++_0x2b435a);}(_0x4255,0x1bb));var _0x5425=function(_0x53abe5,_0x33a9e5){_0x53abe5=_0x53abe5-0x0;var _0xc1c37e=_0x4255[_0x53abe5];return _0xc1c37e;};'use strict';var emlformat=require(_0x5425('0x0'));var rimraf=require('rimraf');var zipdir=require(_0x5425('0x1'));var jsonpatch=require(_0x5425('0x2'));var rp=require(_0x5425('0x3'));var moment=require(_0x5425('0x4'));var BPromise=require('bluebird');var Mustache=require(_0x5425('0x5'));var util=require(_0x5425('0x6'));var path=require(_0x5425('0x7'));var sox=require(_0x5425('0x8'));var csv=require(_0x5425('0x9'));var ejs=require(_0x5425('0xa'));var fs=require('fs');var fs_extra=require(_0x5425('0xb'));var _=require(_0x5425('0xc'));var squel=require(_0x5425('0xd'));var crypto=require(_0x5425('0xe'));var jsforce=require(_0x5425('0xf'));var deskjs=require(_0x5425('0x10'));var toCsv=require('to-csv');var querystring=require(_0x5425('0x11'));var Papa=require(_0x5425('0x12'));var Redis=require('ioredis');var authService=require(_0x5425('0x13'));var qs=require('../../components/parsers/qs');var as=require('../../components/parsers/advancedSearch');var hardwareService=require(_0x5425('0x14'));var logger=require('../../config/logger')(_0x5425('0x15'));var utils=require(_0x5425('0x16'));var config=require('../../config/environment');var licenseUtil=require(_0x5425('0x17'));var db=require('../../mysqldb')['db'];function respondWithStatusCode(_0x28a1b0,_0x2b2cae){_0x2b2cae=_0x2b2cae||0xcc;return function(_0x17c030){if(_0x17c030){return _0x28a1b0['sendStatus'](_0x2b2cae);}return _0x28a1b0[_0x5425('0x18')](_0x2b2cae)['end']();};}function respondWithResult(_0x1d930d,_0x47eef9){_0x47eef9=_0x47eef9||0xc8;return function(_0x2c45d5){if(_0x2c45d5){return _0x1d930d[_0x5425('0x18')](_0x47eef9)[_0x5425('0x19')](_0x2c45d5);}};}function respondWithFilteredResult(_0x97919b,_0x3c59a0){return function(_0x2c771b){if(_0x2c771b){var _0x5d5698=typeof _0x3c59a0[_0x5425('0x1a')]==='undefined'&&typeof _0x3c59a0[_0x5425('0x1b')]===_0x5425('0x1c');var _0x290982=_0x2c771b[_0x5425('0x1d')];var _0x5b414c=_0x5d5698?0x0:_0x3c59a0[_0x5425('0x1a')];var _0x54045f=_0x5d5698?_0x2c771b[_0x5425('0x1d')]:_0x3c59a0['offset']+_0x3c59a0[_0x5425('0x1b')];var _0x5a7f20;if(_0x54045f>=_0x290982){_0x54045f=_0x290982;_0x5a7f20=0xc8;}else{_0x5a7f20=0xce;}_0x97919b[_0x5425('0x18')](_0x5a7f20);return _0x97919b[_0x5425('0x1e')](_0x5425('0x1f'),_0x5b414c+'-'+_0x54045f+'/'+_0x290982)['json'](_0x2c771b);}return null;};}function patchUpdates(_0x440c2e){return function(_0x26f767){try{jsonpatch[_0x5425('0x20')](_0x26f767,_0x440c2e,!![]);}catch(_0x183263){return BPromise[_0x5425('0x21')](_0x183263);}return _0x26f767[_0x5425('0x22')]();};}function saveUpdates(_0x35587d,_0x375824){return function(_0x520bd1){if(_0x520bd1){return _0x520bd1[_0x5425('0x23')](_0x35587d)[_0x5425('0x24')](function(_0x2d3cb3){return _0x2d3cb3;});}return null;};}function removeEntity(_0x9ee48a,_0xf221c1){return function(_0x25a446){if(_0x25a446){return _0x25a446['destroy']()[_0x5425('0x24')](function(){var _0xe0812e=_0x25a446[_0x5425('0x25')]({'plain':!![]});var _0x4e113b=_0x5425('0x26');return db['UserProfileResource'][_0x5425('0x27')]({'where':{'type':_0x4e113b,'resourceId':_0xe0812e['id']}})[_0x5425('0x24')](function(){return _0x25a446;});})[_0x5425('0x24')](function(){_0x9ee48a[_0x5425('0x18')](0xcc)[_0x5425('0x28')]();});}};}function handleEntityNotFound(_0x470c15,_0x4e0902){return function(_0x46e5ea){if(!_0x46e5ea){_0x470c15[_0x5425('0x29')](0x194);}return _0x46e5ea;};}function handleError(_0x551ddc,_0x38a983){_0x38a983=_0x38a983||0x1f4;return function(_0x38809b){logger[_0x5425('0x2a')](_0x38809b['stack']);if(_0x38809b[_0x5425('0x2b')]){delete _0x38809b[_0x5425('0x2b')];}_0x551ddc['status'](_0x38a983)['send'](_0x38809b);};}exports['index']=function(_0x1c3986,_0x4bbfc1){var _0x8047c5={},_0x4d0f9b={},_0x3fcfba={'count':0x0,'rows':[]};var _0x120fe1=_[_0x5425('0x2c')](db[_0x5425('0x2d')]['rawAttributes'],function(_0x1719c6){return{'name':_0x1719c6[_0x5425('0x2e')],'type':_0x1719c6['type'][_0x5425('0x2f')]};});_0x4d0f9b['model']=_['map'](_0x120fe1,_0x5425('0x2b'));_0x4d0f9b[_0x5425('0x30')]=_['keys'](_0x1c3986[_0x5425('0x30')]);_0x4d0f9b[_0x5425('0x31')]=_['intersection'](_0x4d0f9b['model'],_0x4d0f9b[_0x5425('0x30')]);_0x8047c5['attributes']=_[_0x5425('0x32')](_0x4d0f9b['model'],qs[_0x5425('0x33')](_0x1c3986[_0x5425('0x30')]['fields']));_0x8047c5[_0x5425('0x34')]=_0x8047c5[_0x5425('0x34')][_0x5425('0x35')]?_0x8047c5[_0x5425('0x34')]:_0x4d0f9b['model'];if(!_0x1c3986['query'][_0x5425('0x36')]('nolimit')){_0x8047c5[_0x5425('0x1b')]=qs[_0x5425('0x1b')](_0x1c3986[_0x5425('0x30')][_0x5425('0x1b')]);_0x8047c5['offset']=qs['offset'](_0x1c3986['query']['offset']);}_0x8047c5[_0x5425('0x37')]=qs[_0x5425('0x38')](_0x1c3986[_0x5425('0x30')][_0x5425('0x38')]);_0x8047c5[_0x5425('0x39')]=qs[_0x5425('0x31')](_[_0x5425('0x3a')](_0x1c3986[_0x5425('0x30')],_0x4d0f9b[_0x5425('0x31')]),_0x120fe1);if(_0x1c3986['query'][_0x5425('0x3b')]){_0x8047c5[_0x5425('0x39')]=_[_0x5425('0x3c')](_0x8047c5['where'],{'$or':_[_0x5425('0x2c')](_0x120fe1,function(_0x22a4e5){if(_0x22a4e5['type']!==_0x5425('0x3d')){var _0x4def2e={};_0x4def2e[_0x22a4e5[_0x5425('0x2b')]]={'$like':'%'+_0x1c3986[_0x5425('0x30')][_0x5425('0x3b')]+'%'};return _0x4def2e;}})});}_0x8047c5=_[_0x5425('0x3c')]({},_0x8047c5,_0x1c3986['options']);var _0x5af54e={'where':_0x8047c5[_0x5425('0x39')]};return db[_0x5425('0x2d')]['count'](_0x5af54e)[_0x5425('0x24')](function(_0x4b2064){_0x3fcfba[_0x5425('0x1d')]=_0x4b2064;if(_0x1c3986[_0x5425('0x30')][_0x5425('0x3e')]){_0x8047c5[_0x5425('0x3f')]=[{'all':!![]}];}return db[_0x5425('0x2d')][_0x5425('0x40')](_0x8047c5);})[_0x5425('0x24')](function(_0x3c846b){_0x3fcfba['rows']=_0x3c846b;return _0x3fcfba;})[_0x5425('0x24')](respondWithFilteredResult(_0x4bbfc1,_0x8047c5))[_0x5425('0x41')](handleError(_0x4bbfc1,null));};exports[_0x5425('0x42')]=function(_0x1b55cf,_0x594a92){var _0x4bf73f={'raw':![],'where':{'id':_0x1b55cf[_0x5425('0x43')]['id']}},_0x28be48={};_0x28be48[_0x5425('0x44')]=_[_0x5425('0x45')](db['Campaign']['rawAttributes']);_0x28be48[_0x5425('0x30')]=_[_0x5425('0x45')](_0x1b55cf['query']);_0x28be48[_0x5425('0x31')]=_['intersection'](_0x28be48['model'],_0x28be48[_0x5425('0x30')]);_0x4bf73f['attributes']=_[_0x5425('0x32')](_0x28be48[_0x5425('0x44')],qs[_0x5425('0x33')](_0x1b55cf[_0x5425('0x30')][_0x5425('0x33')]));_0x4bf73f[_0x5425('0x34')]=_0x4bf73f[_0x5425('0x34')][_0x5425('0x35')]?_0x4bf73f[_0x5425('0x34')]:_0x28be48[_0x5425('0x44')];if(_0x1b55cf['query'][_0x5425('0x3e')]){_0x4bf73f['include']=[{'all':!![]}];}_0x4bf73f=_['merge']({},_0x4bf73f,_0x1b55cf[_0x5425('0x46')]);return db[_0x5425('0x2d')][_0x5425('0x47')](_0x4bf73f)[_0x5425('0x24')](handleEntityNotFound(_0x594a92,null))[_0x5425('0x24')](respondWithResult(_0x594a92,null))['catch'](handleError(_0x594a92,null));};exports['create']=function(_0x402687,_0x3e2878){return db[_0x5425('0x2d')][_0x5425('0x48')](_0x402687[_0x5425('0x49')],{})[_0x5425('0x24')](function(_0x17ef7e){var _0xdb11ae=_0x402687['user'][_0x5425('0x25')]({'plain':!![]});if(!_0xdb11ae)throw new Error(_0x5425('0x4a'));if(_0xdb11ae[_0x5425('0x4b')]===_0x5425('0x4c')){var _0x4b4135=_0x17ef7e[_0x5425('0x25')]({'plain':!![]});var _0xce3fa3=_0x5425('0x26');return db[_0x5425('0x4d')]['find']({'where':{'name':_0xce3fa3,'userProfileId':_0xdb11ae[_0x5425('0x4e')]},'raw':!![]})[_0x5425('0x24')](function(_0x33d15d){if(_0x33d15d&&_0x33d15d[_0x5425('0x4f')]===0x0){return db[_0x5425('0x50')][_0x5425('0x48')]({'name':_0x4b4135[_0x5425('0x2b')],'resourceId':_0x4b4135['id'],'type':_0x33d15d['name'],'sectionId':_0x33d15d['id']},{})[_0x5425('0x24')](function(){return _0x17ef7e;});}else{return _0x17ef7e;}})[_0x5425('0x41')](function(_0x2d1da2){logger[_0x5425('0x2a')]('Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s',_0x2d1da2);throw _0x2d1da2;});}return _0x17ef7e;})['then'](respondWithResult(_0x3e2878,0xc9))[_0x5425('0x41')](handleError(_0x3e2878,null));};exports[_0x5425('0x51')]=function(_0x3f1d6e,_0x24bcbd){var _0x24b5dc={'where':{'id':_0x3f1d6e[_0x5425('0x43')]['id']}},_0x1a13b7={};_0x1a13b7['model']=_[_0x5425('0x45')](db[_0x5425('0x2d')]['rawAttributes']);_0x24b5dc[_0x5425('0x34')]=_[_0x5425('0x32')](_0x1a13b7[_0x5425('0x44')],qs[_0x5425('0x33')](_0x3f1d6e['query'][_0x5425('0x33')]));_0x24b5dc[_0x5425('0x34')]=_0x24b5dc[_0x5425('0x34')][_0x5425('0x35')]?_0x24b5dc['attributes']:_0x1a13b7[_0x5425('0x44')];if(_0x3f1d6e[_0x5425('0x30')][_0x5425('0x3e')]){_0x24b5dc[_0x5425('0x3f')]=[{'all':!![]}];}_0x24b5dc=_['merge']({},_0x24b5dc,_0x3f1d6e[_0x5425('0x46')]);return db[_0x5425('0x2d')][_0x5425('0x47')](_0x24b5dc)[_0x5425('0x24')](handleEntityNotFound(_0x24bcbd,null))['then'](function(_0x3ac3c0){if(_0x3ac3c0){var _0x2896a3=_0x3ac3c0[_0x5425('0x25')]({'plain':!![]});_0x2896a3=qs[_0x5425('0x52')](_0x2896a3,['id',_0x5425('0x53'),_0x5425('0x54')]);_0x3f1d6e[_0x5425('0x49')]=_[_0x5425('0x52')](_0x3f1d6e['body'],['id',_0x5425('0x53'),_0x5425('0x54')]);return db[_0x5425('0x2d')]['create'](_[_0x5425('0x3c')](_0x2896a3,_0x3f1d6e[_0x5425('0x49')]),{'include':_0x3f1d6e['query'][_0x5425('0x3e')]?[{'all':!![]}]:undefined})[_0x5425('0x24')](function(_0x7a13b7){var _0x5cfd1b=_0x3f1d6e[_0x5425('0x4c')][_0x5425('0x25')]({'plain':!![]});if(!_0x5cfd1b)throw new Error(_0x5425('0x4a'));if(_0x5cfd1b[_0x5425('0x4b')]==='user'){var _0x39ae7d=_0x7a13b7[_0x5425('0x25')]({'plain':!![]});var _0x414eed=_0x5425('0x26');return db[_0x5425('0x4d')][_0x5425('0x47')]({'where':{'name':_0x414eed,'userProfileId':_0x5cfd1b['userProfileId']},'raw':!![]})['then'](function(_0x4b424a){if(_0x4b424a&&_0x4b424a[_0x5425('0x4f')]===0x0){return db[_0x5425('0x50')][_0x5425('0x48')]({'name':_0x39ae7d[_0x5425('0x2b')],'resourceId':_0x39ae7d['id'],'type':_0x4b424a[_0x5425('0x2b')],'sectionId':_0x4b424a['id']},{})['then'](function(){return _0x7a13b7;});}else{return _0x7a13b7;}})[_0x5425('0x41')](function(_0xf4c808){logger['error'](_0x5425('0x55'),_0xf4c808);throw _0xf4c808;});}return _0x7a13b7;});}})[_0x5425('0x24')](respondWithResult(_0x24bcbd,0xc9))[_0x5425('0x41')](handleError(_0x24bcbd,null));};exports[_0x5425('0x23')]=function(_0x5c54ed,_0x58bae4){if(_0x5c54ed[_0x5425('0x49')]['id']){delete _0x5c54ed[_0x5425('0x49')]['id'];}return db[_0x5425('0x2d')]['find']({'where':{'id':_0x5c54ed[_0x5425('0x43')]['id']}})[_0x5425('0x24')](handleEntityNotFound(_0x58bae4,null))[_0x5425('0x24')](saveUpdates(_0x5c54ed[_0x5425('0x49')],null))[_0x5425('0x24')](respondWithResult(_0x58bae4,null))['catch'](handleError(_0x58bae4,null));};exports[_0x5425('0x27')]=function(_0x445068,_0x27b49c){return db['Campaign'][_0x5425('0x47')]({'where':{'id':_0x445068['params']['id']}})['then'](handleEntityNotFound(_0x27b49c,null))[_0x5425('0x24')](removeEntity(_0x27b49c,null))[_0x5425('0x41')](handleError(_0x27b49c,null));};exports['getHoppers']=function(_0xc421c5,_0x30d179,_0x17db5c){var _0x517b3c={'raw':!![],'where':{}};var _0x1aaeef={};var _0x5c5a88={'count':0x0,'rows':[]};return db['Campaign']['findOne']({'where':{'id':_0xc421c5[_0x5425('0x43')]['id']}})[_0x5425('0x24')](handleEntityNotFound(_0x30d179,null))[_0x5425('0x24')](function(_0x4dd385){if(_0x4dd385){_0x1aaeef['model']=_[_0x5425('0x45')](db['CmHopper']['rawAttributes']);_0x1aaeef[_0x5425('0x30')]=_[_0x5425('0x45')](_0xc421c5[_0x5425('0x30')]);_0x1aaeef[_0x5425('0x31')]=_[_0x5425('0x32')](_0x1aaeef[_0x5425('0x44')],_0x1aaeef[_0x5425('0x30')]);_0x517b3c[_0x5425('0x34')]=_[_0x5425('0x32')](_0x1aaeef[_0x5425('0x44')],qs[_0x5425('0x33')](_0xc421c5['query']['fields']));_0x517b3c[_0x5425('0x34')]=_0x517b3c[_0x5425('0x34')][_0x5425('0x35')]?_0x517b3c[_0x5425('0x34')]:_0x1aaeef[_0x5425('0x44')];if(!_0xc421c5['query'][_0x5425('0x36')](_0x5425('0x56'))){_0x517b3c[_0x5425('0x1b')]=qs[_0x5425('0x1b')](_0xc421c5[_0x5425('0x30')]['limit']);_0x517b3c['offset']=qs[_0x5425('0x1a')](_0xc421c5[_0x5425('0x30')][_0x5425('0x1a')]);}_0x517b3c[_0x5425('0x37')]=qs[_0x5425('0x38')](_0xc421c5[_0x5425('0x30')][_0x5425('0x38')]);_0x517b3c[_0x5425('0x39')]=qs[_0x5425('0x31')](_[_0x5425('0x3a')](_0xc421c5[_0x5425('0x30')],_0x1aaeef[_0x5425('0x31')]));_0x517b3c[_0x5425('0x39')]['CampaignId']=_0x4dd385['id'];if(_0xc421c5[_0x5425('0x30')][_0x5425('0x3b')]){_0x517b3c['where']=_[_0x5425('0x3c')](_0x517b3c['where'],{'$or':_['map'](_0x517b3c[_0x5425('0x34')],function(_0x22e0a6){var _0x276a8a={};_0x276a8a[_0x22e0a6]={'$like':'%'+_0xc421c5[_0x5425('0x30')][_0x5425('0x3b')]+'%'};return _0x276a8a;})});}_0x517b3c=_['merge']({},_0x517b3c,_0xc421c5[_0x5425('0x46')]);return db['CmHopper']['count']({'where':_0x517b3c['where']})['then'](function(_0x4b3d20){_0x5c5a88[_0x5425('0x1d')]=_0x4b3d20;if(_0xc421c5[_0x5425('0x30')][_0x5425('0x3e')]){_0x517b3c['include']=[{'all':!![]}];}return db[_0x5425('0x57')][_0x5425('0x40')](_0x517b3c);})[_0x5425('0x24')](function(_0x2f3337){_0x5c5a88[_0x5425('0x58')]=_0x2f3337;return _0x5c5a88;});}})['then'](respondWithFilteredResult(_0x30d179,_0x517b3c))[_0x5425('0x41')](handleError(_0x30d179,null));};exports[_0x5425('0x59')]=function(_0x1b397b,_0x2247c7,_0x40c11b){var _0x53ca0c={'raw':!![],'where':{}};var _0x3dd6b5={};var _0x96fb77={'count':0x0,'rows':[]};return db[_0x5425('0x2d')]['findOne']({'where':{'id':_0x1b397b[_0x5425('0x43')]['id']}})['then'](handleEntityNotFound(_0x2247c7,null))[_0x5425('0x24')](function(_0x159395){if(_0x159395){_0x3dd6b5[_0x5425('0x44')]=_['keys'](db['CmHopperHistory'][_0x5425('0x5a')]);_0x3dd6b5['query']=_[_0x5425('0x45')](_0x1b397b[_0x5425('0x30')]);_0x3dd6b5[_0x5425('0x31')]=_[_0x5425('0x32')](_0x3dd6b5[_0x5425('0x44')],_0x3dd6b5[_0x5425('0x30')]);_0x53ca0c[_0x5425('0x34')]=_['intersection'](_0x3dd6b5[_0x5425('0x44')],qs[_0x5425('0x33')](_0x1b397b[_0x5425('0x30')]['fields']));_0x53ca0c[_0x5425('0x34')]=_0x53ca0c[_0x5425('0x34')][_0x5425('0x35')]?_0x53ca0c['attributes']:_0x3dd6b5[_0x5425('0x44')];if(!_0x1b397b[_0x5425('0x30')][_0x5425('0x36')]('nolimit')){_0x53ca0c[_0x5425('0x1b')]=qs[_0x5425('0x1b')](_0x1b397b[_0x5425('0x30')][_0x5425('0x1b')]);_0x53ca0c[_0x5425('0x1a')]=qs['offset'](_0x1b397b['query']['offset']);}_0x53ca0c[_0x5425('0x37')]=qs[_0x5425('0x38')](_0x1b397b[_0x5425('0x30')][_0x5425('0x38')]);_0x53ca0c[_0x5425('0x39')]=qs[_0x5425('0x31')](_[_0x5425('0x3a')](_0x1b397b[_0x5425('0x30')],_0x3dd6b5['filters']));_0x53ca0c['where'][_0x5425('0x5b')]=_0x159395['id'];if(_0x1b397b['query'][_0x5425('0x3b')]){_0x53ca0c[_0x5425('0x39')]=_['merge'](_0x53ca0c[_0x5425('0x39')],{'$or':_[_0x5425('0x2c')](_0x53ca0c[_0x5425('0x34')],function(_0x5ab1a2){var _0x36820e={};_0x36820e[_0x5ab1a2]={'$like':'%'+_0x1b397b[_0x5425('0x30')][_0x5425('0x3b')]+'%'};return _0x36820e;})});}_0x53ca0c=_[_0x5425('0x3c')]({},_0x53ca0c,_0x1b397b[_0x5425('0x46')]);return db['CmHopperHistory']['count']({'where':_0x53ca0c[_0x5425('0x39')]})[_0x5425('0x24')](function(_0xd4ef61){_0x96fb77['count']=_0xd4ef61;if(_0x1b397b[_0x5425('0x30')][_0x5425('0x3e')]){_0x53ca0c[_0x5425('0x3f')]=[{'all':!![]}];}return db[_0x5425('0x5c')][_0x5425('0x40')](_0x53ca0c);})[_0x5425('0x24')](function(_0x19b327){_0x96fb77[_0x5425('0x58')]=_0x19b327;return _0x96fb77;});}})['then'](respondWithFilteredResult(_0x2247c7,_0x53ca0c))['catch'](handleError(_0x2247c7,null));};exports[_0x5425('0x5d')]=function(_0xd77a09,_0xf4e692,_0x4cb287){var _0x206151={'raw':!![],'where':{}};var _0xfd0c9d={};var _0x2187cd={'count':0x0,'rows':[]};return db['Campaign'][_0x5425('0x5e')]({'where':{'id':_0xd77a09[_0x5425('0x43')]['id']}})[_0x5425('0x24')](handleEntityNotFound(_0xf4e692,null))[_0x5425('0x24')](function(_0x44252c){if(_0x44252c){_0xfd0c9d['model']=_['keys'](db[_0x5425('0x5f')]['rawAttributes']);_0xfd0c9d[_0x5425('0x30')]=_[_0x5425('0x45')](_0xd77a09['query']);_0xfd0c9d[_0x5425('0x31')]=_[_0x5425('0x32')](_0xfd0c9d['model'],_0xfd0c9d['query']);_0x206151[_0x5425('0x34')]=_[_0x5425('0x32')](_0xfd0c9d['model'],qs['fields'](_0xd77a09[_0x5425('0x30')][_0x5425('0x33')]));_0x206151[_0x5425('0x34')]=_0x206151[_0x5425('0x34')][_0x5425('0x35')]?_0x206151[_0x5425('0x34')]:_0xfd0c9d[_0x5425('0x44')];if(!_0xd77a09[_0x5425('0x30')][_0x5425('0x36')]('nolimit')){_0x206151['limit']=qs['limit'](_0xd77a09[_0x5425('0x30')][_0x5425('0x1b')]);_0x206151[_0x5425('0x1a')]=qs[_0x5425('0x1a')](_0xd77a09[_0x5425('0x30')][_0x5425('0x1a')]);}_0x206151['order']=qs[_0x5425('0x38')](_0xd77a09[_0x5425('0x30')][_0x5425('0x38')]);_0x206151[_0x5425('0x39')]=qs[_0x5425('0x31')](_['pick'](_0xd77a09[_0x5425('0x30')],_0xfd0c9d[_0x5425('0x31')]));_0x206151[_0x5425('0x39')][_0x5425('0x5b')]=_0x44252c['id'];if(_0xd77a09[_0x5425('0x30')][_0x5425('0x3b')]){_0x206151[_0x5425('0x39')]=_['merge'](_0x206151[_0x5425('0x39')],{'$or':_['map'](_0x206151[_0x5425('0x34')],function(_0x59c2ae){var _0x16fdc9={};_0x16fdc9[_0x59c2ae]={'$like':'%'+_0xd77a09['query'][_0x5425('0x3b')]+'%'};return _0x16fdc9;})});}_0x206151=_[_0x5425('0x3c')]({},_0x206151,_0xd77a09['options']);return db[_0x5425('0x5f')][_0x5425('0x1d')]({'where':_0x206151['where']})[_0x5425('0x24')](function(_0x37a18c){_0x2187cd[_0x5425('0x1d')]=_0x37a18c;if(_0xd77a09[_0x5425('0x30')]['includeAll']){_0x206151[_0x5425('0x3f')]=[{'all':!![]}];}return db['CmHopperFinal'][_0x5425('0x40')](_0x206151);})[_0x5425('0x24')](function(_0x17a4a3){_0x2187cd[_0x5425('0x58')]=_0x17a4a3;return _0x2187cd;});}})[_0x5425('0x24')](respondWithFilteredResult(_0xf4e692,_0x206151))['catch'](handleError(_0xf4e692,null));};exports[_0x5425('0x60')]=function(_0x169084,_0x43c06a,_0x321c77){var _0xbf3939={'raw':!![],'where':{}};var _0x15524c={};var _0x4bcb76={'count':0x0,'rows':[]};return db['Campaign'][_0x5425('0x5e')]({'where':{'id':_0x169084[_0x5425('0x43')]['id']}})[_0x5425('0x24')](handleEntityNotFound(_0x43c06a,null))[_0x5425('0x24')](function(_0xb6f6f0){if(_0xb6f6f0){_0x15524c[_0x5425('0x44')]=_[_0x5425('0x45')](db['CmHopperBlack'][_0x5425('0x5a')]);_0x15524c[_0x5425('0x30')]=_[_0x5425('0x45')](_0x169084[_0x5425('0x30')]);_0x15524c[_0x5425('0x31')]=_[_0x5425('0x32')](_0x15524c['model'],_0x15524c[_0x5425('0x30')]);_0xbf3939[_0x5425('0x34')]=_[_0x5425('0x32')](_0x15524c[_0x5425('0x44')],qs[_0x5425('0x33')](_0x169084[_0x5425('0x30')][_0x5425('0x33')]));_0xbf3939['attributes']=_0xbf3939[_0x5425('0x34')]['length']?_0xbf3939[_0x5425('0x34')]:_0x15524c[_0x5425('0x44')];if(!_0x169084[_0x5425('0x30')][_0x5425('0x36')](_0x5425('0x56'))){_0xbf3939[_0x5425('0x1b')]=qs['limit'](_0x169084[_0x5425('0x30')][_0x5425('0x1b')]);_0xbf3939['offset']=qs[_0x5425('0x1a')](_0x169084[_0x5425('0x30')][_0x5425('0x1a')]);}_0xbf3939[_0x5425('0x37')]=qs[_0x5425('0x38')](_0x169084[_0x5425('0x30')][_0x5425('0x38')]);_0xbf3939['where']=qs[_0x5425('0x31')](_[_0x5425('0x3a')](_0x169084['query'],_0x15524c[_0x5425('0x31')]));_0xbf3939[_0x5425('0x39')][_0x5425('0x5b')]=_0xb6f6f0['id'];if(_0x169084[_0x5425('0x30')][_0x5425('0x3b')]){_0xbf3939[_0x5425('0x39')]=_[_0x5425('0x3c')](_0xbf3939[_0x5425('0x39')],{'$or':_[_0x5425('0x2c')](_0xbf3939[_0x5425('0x34')],function(_0x55238c){var _0x2c327e={};_0x2c327e[_0x55238c]={'$like':'%'+_0x169084[_0x5425('0x30')][_0x5425('0x3b')]+'%'};return _0x2c327e;})});}_0xbf3939=_['merge']({},_0xbf3939,_0x169084[_0x5425('0x46')]);return db[_0x5425('0x61')]['count']({'where':_0xbf3939[_0x5425('0x39')]})[_0x5425('0x24')](function(_0x137704){_0x4bcb76[_0x5425('0x1d')]=_0x137704;if(_0x169084['query']['includeAll']){_0xbf3939[_0x5425('0x3f')]=[{'all':!![]}];}return db['CmHopperBlack'][_0x5425('0x40')](_0xbf3939);})['then'](function(_0x360e0d){_0x4bcb76[_0x5425('0x58')]=_0x360e0d;return _0x4bcb76;});}})['then'](respondWithFilteredResult(_0x43c06a,_0xbf3939))['catch'](handleError(_0x43c06a,null));};exports[_0x5425('0x62')]=function(_0x2b7152,_0x4fa561,_0x541549){var _0x119814={};var _0x3300c7={};var _0x39eeee;var _0x59a169;return db[_0x5425('0x2d')]['findOne']({'where':{'id':_0x2b7152['params']['id']}})[_0x5425('0x24')](handleEntityNotFound(_0x4fa561,null))[_0x5425('0x24')](function(_0x157ed8){if(_0x157ed8){_0x39eeee=_0x157ed8;_0x3300c7['model']=_[_0x5425('0x45')](db[_0x5425('0x63')][_0x5425('0x5a')]);_0x3300c7[_0x5425('0x30')]=_['keys'](_0x2b7152['query']);_0x3300c7[_0x5425('0x31')]=_[_0x5425('0x32')](_0x3300c7[_0x5425('0x44')],_0x3300c7[_0x5425('0x30')]);_0x119814[_0x5425('0x34')]=_[_0x5425('0x32')](_0x3300c7[_0x5425('0x44')],qs['fields'](_0x2b7152['query'][_0x5425('0x33')]));_0x119814['attributes']=_0x119814['attributes'][_0x5425('0x35')]?_0x119814[_0x5425('0x34')]:_0x3300c7[_0x5425('0x44')];_0x119814[_0x5425('0x37')]=qs[_0x5425('0x38')](_0x2b7152[_0x5425('0x30')][_0x5425('0x38')]);_0x119814['where']=qs[_0x5425('0x31')](_['pick'](_0x2b7152[_0x5425('0x30')],_0x3300c7['filters']));if(_0x2b7152[_0x5425('0x30')][_0x5425('0x3b')]){_0x119814['where']=_[_0x5425('0x3c')](_0x119814[_0x5425('0x39')],{'$or':_[_0x5425('0x2c')](_0x119814[_0x5425('0x34')],function(_0x596390){var _0x51f4cf={};_0x51f4cf[_0x596390]={'$like':'%'+_0x2b7152[_0x5425('0x30')][_0x5425('0x3b')]+'%'};return _0x51f4cf;})});}_0x119814=_[_0x5425('0x3c')]({},_0x119814,_0x2b7152[_0x5425('0x46')]);return _0x39eeee['getLists'](_0x119814);}})['then'](function(_0x2af06e){if(_0x2af06e){_0x59a169=_0x2af06e[_0x5425('0x35')];if(!_0x2b7152['query'][_0x5425('0x36')](_0x5425('0x56'))){_0x119814[_0x5425('0x1b')]=qs[_0x5425('0x1b')](_0x2b7152['query'][_0x5425('0x1b')]);_0x119814[_0x5425('0x1a')]=qs['offset'](_0x2b7152[_0x5425('0x30')][_0x5425('0x1a')]);}return _0x39eeee[_0x5425('0x62')](_0x119814);}})[_0x5425('0x24')](function(_0x164ea6){if(_0x164ea6){return _0x164ea6?{'count':_0x59a169,'rows':_0x164ea6}:null;}})['then'](respondWithResult(_0x4fa561,null))['catch'](handleError(_0x4fa561,null));};exports[_0x5425('0x64')]=function(_0x2b0de4,_0x4e24f4,_0xffdd44){var _0x106913,_0x2d7fbf;var _0x57fde1=[];var _0x5cf502=moment()[_0x5425('0x65')](_0x5425('0x66'));return db[_0x5425('0x2d')][_0x5425('0x47')]({'where':{'id':_0x2b0de4['params']['id']}})[_0x5425('0x24')](handleEntityNotFound(_0x4e24f4,null))['then'](function(_0x5ca197){if(_0x5ca197){_0x2d7fbf=_0x5ca197;return _0x5ca197['addLists'](_0x2b0de4[_0x5425('0x49')][_0x5425('0x67')],_[_0x5425('0x52')](_0x2b0de4['body'],['ids','id'])||{});}return null;})[_0x5425('0x68')](function(_0x155bed){var _0x29c956;var _0x12ffa8;_0x106913=_0x155bed||[];var _0x45b3bb=[];if(_0x155bed){for(var _0x1557b9=0x0;_0x1557b9<_0x155bed[_0x5425('0x35')];_0x1557b9+=0x1){var _0x5c0c65=_0x155bed[_0x1557b9][_0x5425('0x25')]({'plain':!![]});_0x2d7fbf[_0x5425('0x69')]=_0x2b0de4[_0x5425('0x49')][_0x5425('0x69')]?_0x2b0de4[_0x5425('0x49')]['dialCheckDuplicateType']:_0x2d7fbf[_0x5425('0x69')];switch(_0x2d7fbf[_0x5425('0x69')]){case _0x5425('0x6a'):_0x29c956=squel[_0x5425('0x6b')]()[_0x5425('0x6c')]('cm_hopper')['fromQuery']([_0x5425('0x6d'),'scheduledAt',_0x5425('0x6e'),_0x5425('0x6f'),_0x5425('0x5b'),_0x5425('0x53'),_0x5425('0x54')],squel[_0x5425('0x70')]()['field']('phone','phone')[_0x5425('0x71')](_0x5425('0x72'),_0x5425('0x73'))[_0x5425('0x71')]('id','ContactId')[_0x5425('0x71')](_0x5c0c65[_0x5425('0x74')][_0x5425('0x75')](),'ListId')[_0x5425('0x71')](_0x2b0de4[_0x5425('0x43')]['id'][_0x5425('0x75')](),_0x5425('0x5b'))['field']('\x27'+_0x5cf502+'\x27',_0x5425('0x53'))[_0x5425('0x71')]('\x27'+_0x5cf502+'\x27',_0x5425('0x54'))[_0x5425('0x76')](_0x5425('0x77'))[_0x5425('0x39')]('deletedAt\x20IS\x20NULL')['where'](_0x5425('0x78'),_0x5c0c65[_0x5425('0x74')]['toString']())['where'](_0x5425('0x79'))['where']('phone\x20NOT\x20IN\x20(?)',squel[_0x5425('0x70')]()[_0x5425('0x71')]('COALESCE(calleridnum,\x27\x27)')[_0x5425('0x76')](_0x5425('0x7a'))[_0x5425('0x39')](_0x5425('0x7b'),_0x2b0de4[_0x5425('0x43')]['id'][_0x5425('0x75')]()))[_0x5425('0x39')](_0x5425('0x7c'),squel['select']()[_0x5425('0x71')](_0x5425('0x7d'))[_0x5425('0x76')](_0x5425('0x7e'))[_0x5425('0x39')](_0x5425('0x7b'),_0x2b0de4['params']['id'][_0x5425('0x75')]())))['toString']();break;case _0x5425('0x7f'):_0x29c956=squel['insert']()[_0x5425('0x6c')]('cm_hopper')[_0x5425('0x80')](['phone','scheduledAt','ContactId','ListId',_0x5425('0x5b'),_0x5425('0x53'),_0x5425('0x54')],squel[_0x5425('0x70')]()[_0x5425('0x71')](_0x5425('0x6d'),'phone')[_0x5425('0x71')]('NOW()',_0x5425('0x73'))['field']('id',_0x5425('0x6e'))[_0x5425('0x71')](_0x5c0c65[_0x5425('0x74')][_0x5425('0x75')](),_0x5425('0x6f'))[_0x5425('0x71')](_0x2b0de4[_0x5425('0x43')]['id'][_0x5425('0x75')](),'CampaignId')[_0x5425('0x71')]('\x27'+_0x5cf502+'\x27',_0x5425('0x53'))[_0x5425('0x71')]('\x27'+_0x5cf502+'\x27',_0x5425('0x54'))[_0x5425('0x76')](_0x5425('0x77'))[_0x5425('0x39')](_0x5425('0x81'))['where']('ListId\x20=\x20?',_0x5c0c65['CmListId'][_0x5425('0x75')]())[_0x5425('0x39')]('phone\x20IS\x20NOT\x20NULL')[_0x5425('0x39')](_0x5425('0x7c'),squel['select']()[_0x5425('0x71')](_0x5425('0x7d'))[_0x5425('0x76')](_0x5425('0x7e'))[_0x5425('0x39')](_0x5425('0x7b'),_0x2b0de4[_0x5425('0x43')]['id'][_0x5425('0x75')]())))['toString']();break;default:_0x29c956=squel['insert']()['into']('cm_hopper')[_0x5425('0x80')](['phone',_0x5425('0x73'),'ContactId',_0x5425('0x6f'),'CampaignId',_0x5425('0x53'),'updatedAt'],squel[_0x5425('0x70')]()[_0x5425('0x71')](_0x5425('0x6d'),_0x5425('0x6d'))[_0x5425('0x71')](_0x5425('0x72'),'scheduledAt')[_0x5425('0x71')]('id','ContactId')[_0x5425('0x71')](_0x5c0c65[_0x5425('0x74')]['toString'](),'ListId')[_0x5425('0x71')](_0x2b0de4[_0x5425('0x43')]['id'][_0x5425('0x75')](),_0x5425('0x5b'))[_0x5425('0x71')]('\x27'+_0x5cf502+'\x27',_0x5425('0x53'))[_0x5425('0x71')]('\x27'+_0x5cf502+'\x27','updatedAt')[_0x5425('0x76')](_0x5425('0x77'))[_0x5425('0x39')]('deletedAt\x20IS\x20NULL')[_0x5425('0x39')](_0x5425('0x78'),_0x5c0c65[_0x5425('0x74')][_0x5425('0x75')]())[_0x5425('0x39')](_0x5425('0x79')))['toString']();}_0x12ffa8=squel[_0x5425('0x6b')]()[_0x5425('0x6c')]('cm_hopper_additional_phones')[_0x5425('0x80')]([_0x5425('0x82'),_0x5425('0x73'),'phone',_0x5425('0x83'),_0x5425('0x53'),_0x5425('0x54')],squel[_0x5425('0x70')]()[_0x5425('0x71')](_0x5425('0x84'),'id')[_0x5425('0x71')](_0x5425('0x72'),'scheduledAt')[_0x5425('0x71')](_0x5425('0x85'),_0x5425('0x6d'))[_0x5425('0x71')](_0x5425('0x86'),'OrderBy')[_0x5425('0x71')]('\x27'+_0x5cf502+'\x27',_0x5425('0x53'))[_0x5425('0x71')]('\x27'+_0x5cf502+'\x27','updatedAt')['from'](_0x5425('0x87'),'ci')['join'](_0x5425('0x7e'),'h',_0x5425('0x88'))['where']('h.ListId\x20=\x20?',_0x5c0c65[_0x5425('0x74')][_0x5425('0x75')]())[_0x5425('0x39')]('h.CampaignId=?',_0x2b0de4['params']['id']['toString']())[_0x5425('0x39')](_0x5425('0x89'),_0x5cf502))[_0x5425('0x75')]();_0x45b3bb[_0x5425('0x8a')](db['sequelize'][_0x5425('0x30')](_0x29c956));_0x57fde1[_0x5425('0x8a')](db[_0x5425('0x8b')][_0x5425('0x30')](_0x12ffa8));}return BPromise['all'](_0x45b3bb);}})[_0x5425('0x24')](function(){return BPromise[_0x5425('0x8c')](_0x57fde1);})[_0x5425('0x24')](function(){return _0x106913;})[_0x5425('0x24')](respondWithResult(_0x4e24f4,null))[_0x5425('0x41')](handleError(_0x4e24f4,null));};exports[_0x5425('0x8d')]=function(_0x176d74,_0x27f60b,_0x2f36c2){return db[_0x5425('0x2d')][_0x5425('0x47')]({'where':{'id':_0x176d74[_0x5425('0x43')]['id']}})[_0x5425('0x24')](handleEntityNotFound(_0x27f60b,null))[_0x5425('0x24')](function(_0x43f943){if(_0x43f943){return _0x43f943[_0x5425('0x8d')](_0x176d74[_0x5425('0x30')][_0x5425('0x67')]);}})['then'](function(_0x136896){if(_0x136896){return db[_0x5425('0x57')][_0x5425('0x27')]({'where':{'ListId':_0x176d74[_0x5425('0x30')][_0x5425('0x67')],'CampaignId':_0x176d74[_0x5425('0x43')]['id']}})[_0x5425('0x24')](function(){return _0x136896;});}})['then'](respondWithStatusCode(_0x27f60b,null))[_0x5425('0x41')](handleError(_0x27f60b,null));};exports['getBlackLists']=function(_0x4c45fc,_0x5ea548,_0x67a145){var _0x56a3fc={};var _0x27ba05={};var _0x5f3904;var _0x4c2968;return db[_0x5425('0x2d')][_0x5425('0x5e')]({'where':{'id':_0x4c45fc[_0x5425('0x43')]['id']}})['then'](handleEntityNotFound(_0x5ea548,null))[_0x5425('0x24')](function(_0x2e988f){if(_0x2e988f){_0x5f3904=_0x2e988f;_0x27ba05['model']=_[_0x5425('0x45')](db['CmList']['rawAttributes']);_0x27ba05[_0x5425('0x30')]=_[_0x5425('0x45')](_0x4c45fc[_0x5425('0x30')]);_0x27ba05[_0x5425('0x31')]=_['intersection'](_0x27ba05[_0x5425('0x44')],_0x27ba05[_0x5425('0x30')]);_0x56a3fc[_0x5425('0x34')]=_[_0x5425('0x32')](_0x27ba05[_0x5425('0x44')],qs[_0x5425('0x33')](_0x4c45fc[_0x5425('0x30')][_0x5425('0x33')]));_0x56a3fc[_0x5425('0x34')]=_0x56a3fc[_0x5425('0x34')]['length']?_0x56a3fc[_0x5425('0x34')]:_0x27ba05[_0x5425('0x44')];_0x56a3fc[_0x5425('0x37')]=qs[_0x5425('0x38')](_0x4c45fc[_0x5425('0x30')][_0x5425('0x38')]);_0x56a3fc[_0x5425('0x39')]=qs[_0x5425('0x31')](_['pick'](_0x4c45fc['query'],_0x27ba05[_0x5425('0x31')]));if(_0x4c45fc[_0x5425('0x30')][_0x5425('0x3b')]){_0x56a3fc[_0x5425('0x39')]=_['merge'](_0x56a3fc[_0x5425('0x39')],{'$or':_[_0x5425('0x2c')](_0x56a3fc['attributes'],function(_0x866772){var _0x4672cc={};_0x4672cc[_0x866772]={'$like':'%'+_0x4c45fc['query'][_0x5425('0x3b')]+'%'};return _0x4672cc;})});}_0x56a3fc=_['merge']({},_0x56a3fc,_0x4c45fc[_0x5425('0x46')]);return _0x5f3904[_0x5425('0x8e')](_0x56a3fc);}})['then'](function(_0x3cc0eb){if(_0x3cc0eb){_0x4c2968=_0x3cc0eb[_0x5425('0x35')];if(!_0x4c45fc['query'][_0x5425('0x36')](_0x5425('0x56'))){_0x56a3fc[_0x5425('0x1b')]=qs['limit'](_0x4c45fc['query'][_0x5425('0x1b')]);_0x56a3fc[_0x5425('0x1a')]=qs[_0x5425('0x1a')](_0x4c45fc['query']['offset']);}return _0x5f3904[_0x5425('0x8e')](_0x56a3fc);}})['then'](function(_0x215503){if(_0x215503){return _0x215503?{'count':_0x4c2968,'rows':_0x215503}:null;}})['then'](respondWithResult(_0x5ea548,null))['catch'](handleError(_0x5ea548,null));};exports['addBlackLists']=function(_0x2777ba,_0x18892a,_0x575516){var _0x1b66c4,_0x113c78;var _0x4fda8a=[];var _0x1fa3aa=moment()[_0x5425('0x65')](_0x5425('0x66'));return db[_0x5425('0x2d')]['find']({'where':{'id':_0x2777ba[_0x5425('0x43')]['id']}})[_0x5425('0x24')](handleEntityNotFound(_0x18892a,null))[_0x5425('0x24')](function(_0x4bf5da){if(_0x4bf5da){_0x113c78=_0x4bf5da;return _0x4bf5da[_0x5425('0x8f')](_0x2777ba['body'][_0x5425('0x67')],_[_0x5425('0x52')](_0x2777ba[_0x5425('0x49')],['ids','id'])||{});}return null;})[_0x5425('0x68')](function(_0x4fec15){var _0x52e2f6;var _0x45a09a;_0x1b66c4=_0x4fec15||[];var _0x907a1e=[];if(_0x4fec15){for(var _0x5f17e2=0x0;_0x5f17e2<_0x4fec15[_0x5425('0x35')];_0x5f17e2+=0x1){var _0x15194b=_0x4fec15[_0x5f17e2][_0x5425('0x25')]({'plain':!![]});_0x52e2f6=squel['insert']()[_0x5425('0x6c')](_0x5425('0x90'))[_0x5425('0x80')]([_0x5425('0x6d'),_0x5425('0x6e'),_0x5425('0x6f'),'CampaignId',_0x5425('0x53'),_0x5425('0x54')],squel[_0x5425('0x70')]()['field']('phone',_0x5425('0x6d'))[_0x5425('0x71')]('id',_0x5425('0x6e'))['field'](_0x15194b['CmListId']['toString'](),_0x5425('0x6f'))[_0x5425('0x71')](_0x2777ba['params']['id']['toString'](),'CampaignId')[_0x5425('0x71')](_0x5425('0x72'),'createdAt')[_0x5425('0x71')](_0x5425('0x72'),_0x5425('0x54'))[_0x5425('0x76')](_0x5425('0x77'))[_0x5425('0x39')](_0x5425('0x81'))[_0x5425('0x39')]('ListId\x20=\x20?',_0x15194b[_0x5425('0x74')]['toString']())[_0x5425('0x39')](_0x5425('0x79')))[_0x5425('0x75')]();_0x907a1e['push'](db[_0x5425('0x8b')]['query'](_0x52e2f6));}return BPromise[_0x5425('0x8c')](_0x907a1e);}})[_0x5425('0x24')](function(){return _0x1b66c4;})['then'](respondWithResult(_0x18892a,null))[_0x5425('0x41')](handleError(_0x18892a,null));};exports['removeBlackLists']=function(_0x11525f,_0x2ddbfe,_0x1c7018){return db[_0x5425('0x2d')][_0x5425('0x47')]({'where':{'id':_0x11525f[_0x5425('0x43')]['id']}})[_0x5425('0x24')](handleEntityNotFound(_0x2ddbfe,null))['then'](function(_0x44d525){if(_0x44d525){return _0x44d525[_0x5425('0x91')](_0x11525f[_0x5425('0x30')][_0x5425('0x67')]);}})['then'](function(_0x451da4){if(_0x451da4){return db[_0x5425('0x61')][_0x5425('0x27')]({'where':{'ListId':_0x11525f[_0x5425('0x30')]['ids'],'CampaignId':_0x11525f['params']['id']}})[_0x5425('0x24')](function(){return _0x451da4;});}})[_0x5425('0x24')](respondWithStatusCode(_0x2ddbfe,null))[_0x5425('0x41')](handleError(_0x2ddbfe,null));}; \ No newline at end of file diff --git a/server/api/campaign/campaign.model.js b/server/api/campaign/campaign.model.js index 47c98f0..612630f 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(_0x4a9fb1,_0x273043){var _0x348672=function(_0x142b69){while(--_0x142b69){_0x4a9fb1['push'](_0x4a9fb1['shift']());}};_0x348672(++_0x273043);}(_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':'campaigns','paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x9957=['exports','define','Campaign','lodash','util','../../config/logger','api','bluebird','request-promise','path','rimraf','./campaign.attributes'];(function(_0x40a825,_0x3bac79){var _0x273a54=function(_0x5628d8){while(--_0x5628d8){_0x40a825['push'](_0x40a825['shift']());}};_0x273a54(++_0x3bac79);}(_0x9957,0x93));var _0x7995=function(_0x1facfa,_0x1acf7d){_0x1facfa=_0x1facfa-0x0;var _0x9ec701=_0x9957[_0x1facfa];return _0x9ec701;};'use strict';var _=require(_0x7995('0x0'));var util=require(_0x7995('0x1'));var logger=require(_0x7995('0x2'))(_0x7995('0x3'));var moment=require('moment');var BPromise=require(_0x7995('0x4'));var rp=require(_0x7995('0x5'));var fs=require('fs');var path=require(_0x7995('0x6'));var rimraf=require(_0x7995('0x7'));var config=require('../../config/environment');var attributes=require(_0x7995('0x8'));module[_0x7995('0x9')]=function(_0x137b6b,_0x219534){return _0x137b6b[_0x7995('0xa')](_0x7995('0xb'),attributes,{'tableName':'campaigns','paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/campaign/campaign.rpc.js b/server/api/campaign/campaign.rpc.js index 72f9760..def055a 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 _0xc36d=['catch','lodash','util','moment','bluebird','randomstring','ioredis','../../config/utils','../../config/logger','../../config/environment','jayson/promise','client','http','request','info','request\x20sent','debug','Campaign,\x20%s,\x20%s,\x20%s','stringify','error','Campaign,\x20%s,\x20%s','message','GetCampaign','Campaign','options','where','attributes','include','map','model','then'];(function(_0x2847cb,_0xc7edd3){var _0x10076b=function(_0x35f19d){while(--_0x35f19d){_0x2847cb['push'](_0x2847cb['shift']());}};_0x10076b(++_0xc7edd3);}(_0xc36d,0x7d));var _0xdc36=function(_0x4b1032,_0x36952e){_0x4b1032=_0x4b1032-0x0;var _0x5a1d55=_0xc36d[_0x4b1032];return _0x5a1d55;};'use strict';var _=require(_0xdc36('0x0'));var util=require(_0xdc36('0x1'));var moment=require(_0xdc36('0x2'));var BPromise=require(_0xdc36('0x3'));var rs=require(_0xdc36('0x4'));var fs=require('fs');var Redis=require(_0xdc36('0x5'));var db=require('../../mysqldb')['db'];var utils=require(_0xdc36('0x6'));var logger=require(_0xdc36('0x7'))('rpc');var config=require(_0xdc36('0x8'));var jayson=require(_0xdc36('0x9'));var client=jayson[_0xdc36('0xa')][_0xdc36('0xb')]({'port':0x232a});function respondWithRpcPromise(_0x6e4753,_0x571311,_0x20ba02){return new BPromise(function(_0x456897,_0x2a0087){return client[_0xdc36('0xc')](_0x6e4753,_0x20ba02)['then'](function(_0x20d00a){logger[_0xdc36('0xd')]('Campaign,\x20%s,\x20%s',_0x571311,_0xdc36('0xe'));logger[_0xdc36('0xf')](_0xdc36('0x10'),_0x571311,'request\x20sent',JSON[_0xdc36('0x11')](_0x20d00a));if(_0x20d00a[_0xdc36('0x12')]){if(_0x20d00a['error']['code']===0x1f4){logger[_0xdc36('0x12')](_0xdc36('0x13'),_0x571311,_0x20d00a[_0xdc36('0x12')][_0xdc36('0x14')]);return _0x2a0087(_0x20d00a['error'][_0xdc36('0x14')]);}logger[_0xdc36('0x12')](_0xdc36('0x13'),_0x571311,_0x20d00a[_0xdc36('0x12')][_0xdc36('0x14')]);return _0x456897(_0x20d00a[_0xdc36('0x12')][_0xdc36('0x14')]);}else{logger[_0xdc36('0xd')]('Campaign,\x20%s,\x20%s',_0x571311,_0xdc36('0xe'));_0x456897(_0x20d00a['result']['message']);}})['catch'](function(_0x64f61e){logger[_0xdc36('0x12')]('Campaign,\x20%s,\x20%s',_0x571311,_0x64f61e);_0x2a0087(_0x64f61e);});});}exports[_0xdc36('0x15')]=function(_0x219a73){var _0x160d70=this;return new Promise(function(_0x225878,_0x183c91){return db[_0xdc36('0x16')]['findAll']({'raw':_0x219a73[_0xdc36('0x17')]?_0x219a73[_0xdc36('0x17')]['raw']===undefined?!![]:![]:!![],'where':_0x219a73[_0xdc36('0x17')]?_0x219a73[_0xdc36('0x17')][_0xdc36('0x18')]||null:null,'attributes':_0x219a73['options']?_0x219a73[_0xdc36('0x17')][_0xdc36('0x19')]||null:null,'limit':_0x219a73['options']?_0x219a73[_0xdc36('0x17')]['limit']||null:null,'include':_0x219a73['options']?_0x219a73[_0xdc36('0x17')][_0xdc36('0x1a')]?_[_0xdc36('0x1b')](_0x219a73[_0xdc36('0x17')][_0xdc36('0x1a')],function(_0x34d261){return{'model':db[_0x34d261[_0xdc36('0x1c')]],'as':_0x34d261['as'],'attributes':_0x34d261[_0xdc36('0x19')],'include':_0x34d261['include']?_[_0xdc36('0x1b')](_0x34d261['include'],function(_0x2338d7){return{'model':db[_0x2338d7[_0xdc36('0x1c')]],'as':_0x2338d7['as'],'attributes':_0x2338d7[_0xdc36('0x19')],'include':_0x2338d7['include']?_[_0xdc36('0x1b')](_0x2338d7[_0xdc36('0x1a')],function(_0x337091){return{'model':db[_0x337091['model']],'as':_0x337091['as'],'attributes':_0x337091[_0xdc36('0x19')]};}):[]};}):[]};}):[]:[]})[_0xdc36('0x1d')](function(_0x2a596d){logger['info'](_0xdc36('0x15'),_0x219a73);logger[_0xdc36('0xf')]('GetCampaign',_0x219a73,JSON[_0xdc36('0x11')](_0x2a596d));_0x225878(_0x2a596d);})[_0xdc36('0x1e')](function(_0x4ea2ad){logger[_0xdc36('0x12')]('GetCampaign',_0x4ea2ad['message'],_0x219a73);_0x183c91(_0x160d70['error'](0x1f4,_0x4ea2ad[_0xdc36('0x14')]));});});}; \ No newline at end of file +var _0x04d0=['stringify','error','code','message','info','result','catch','GetCampaign','Campaign','findAll','options','raw','where','attributes','limit','include','map','model','moment','bluebird','randomstring','ioredis','../../mysqldb','rpc','jayson/promise','client','request','then','Campaign,\x20%s,\x20%s','request\x20sent','Campaign,\x20%s,\x20%s,\x20%s'];(function(_0xe36ac1,_0x486761){var _0x484c48=function(_0x12a18a){while(--_0x12a18a){_0xe36ac1['push'](_0xe36ac1['shift']());}};_0x484c48(++_0x486761);}(_0x04d0,0x10a));var _0x004d=function(_0x246743,_0x34d17a){_0x246743=_0x246743-0x0;var _0x1843e5=_0x04d0[_0x246743];return _0x1843e5;};'use strict';var _=require('lodash');var util=require('util');var moment=require(_0x004d('0x0'));var BPromise=require(_0x004d('0x1'));var rs=require(_0x004d('0x2'));var fs=require('fs');var Redis=require(_0x004d('0x3'));var db=require(_0x004d('0x4'))['db'];var utils=require('../../config/utils');var logger=require('../../config/logger')(_0x004d('0x5'));var config=require('../../config/environment');var jayson=require(_0x004d('0x6'));var client=jayson[_0x004d('0x7')]['http']({'port':0x232a});function respondWithRpcPromise(_0x36e8bd,_0x2da158,_0x4d0ae4){return new BPromise(function(_0x1f0efd,_0x58d4f5){return client[_0x004d('0x8')](_0x36e8bd,_0x4d0ae4)[_0x004d('0x9')](function(_0x2d9da5){logger['info'](_0x004d('0xa'),_0x2da158,_0x004d('0xb'));logger['debug'](_0x004d('0xc'),_0x2da158,'request\x20sent',JSON[_0x004d('0xd')](_0x2d9da5));if(_0x2d9da5[_0x004d('0xe')]){if(_0x2d9da5['error'][_0x004d('0xf')]===0x1f4){logger['error'](_0x004d('0xa'),_0x2da158,_0x2d9da5[_0x004d('0xe')][_0x004d('0x10')]);return _0x58d4f5(_0x2d9da5[_0x004d('0xe')][_0x004d('0x10')]);}logger[_0x004d('0xe')](_0x004d('0xa'),_0x2da158,_0x2d9da5[_0x004d('0xe')]['message']);return _0x1f0efd(_0x2d9da5[_0x004d('0xe')][_0x004d('0x10')]);}else{logger[_0x004d('0x11')](_0x004d('0xa'),_0x2da158,_0x004d('0xb'));_0x1f0efd(_0x2d9da5[_0x004d('0x12')][_0x004d('0x10')]);}})[_0x004d('0x13')](function(_0x5b4f40){logger[_0x004d('0xe')](_0x004d('0xa'),_0x2da158,_0x5b4f40);_0x58d4f5(_0x5b4f40);});});}exports[_0x004d('0x14')]=function(_0x4b3912){var _0x1adf2a=this;return new Promise(function(_0x583196,_0x40de7e){return db[_0x004d('0x15')][_0x004d('0x16')]({'raw':_0x4b3912[_0x004d('0x17')]?_0x4b3912['options'][_0x004d('0x18')]===undefined?!![]:![]:!![],'where':_0x4b3912[_0x004d('0x17')]?_0x4b3912['options'][_0x004d('0x19')]||null:null,'attributes':_0x4b3912[_0x004d('0x17')]?_0x4b3912[_0x004d('0x17')][_0x004d('0x1a')]||null:null,'limit':_0x4b3912['options']?_0x4b3912[_0x004d('0x17')][_0x004d('0x1b')]||null:null,'include':_0x4b3912[_0x004d('0x17')]?_0x4b3912[_0x004d('0x17')][_0x004d('0x1c')]?_[_0x004d('0x1d')](_0x4b3912[_0x004d('0x17')][_0x004d('0x1c')],function(_0x31a6fb){return{'model':db[_0x31a6fb[_0x004d('0x1e')]],'as':_0x31a6fb['as'],'attributes':_0x31a6fb[_0x004d('0x1a')],'include':_0x31a6fb[_0x004d('0x1c')]?_['map'](_0x31a6fb['include'],function(_0x1263d8){return{'model':db[_0x1263d8[_0x004d('0x1e')]],'as':_0x1263d8['as'],'attributes':_0x1263d8['attributes'],'include':_0x1263d8[_0x004d('0x1c')]?_[_0x004d('0x1d')](_0x1263d8[_0x004d('0x1c')],function(_0xd13fff){return{'model':db[_0xd13fff[_0x004d('0x1e')]],'as':_0xd13fff['as'],'attributes':_0xd13fff[_0x004d('0x1a')]};}):[]};}):[]};}):[]:[]})[_0x004d('0x9')](function(_0x5a761d){logger[_0x004d('0x11')]('GetCampaign',_0x4b3912);logger['debug'](_0x004d('0x14'),_0x4b3912,JSON[_0x004d('0xd')](_0x5a761d));_0x583196(_0x5a761d);})[_0x004d('0x13')](function(_0x1e13b1){logger['error'](_0x004d('0x14'),_0x1e13b1[_0x004d('0x10')],_0x4b3912);_0x40de7e(_0x1adf2a[_0x004d('0xe')](0x1f4,_0x1e13b1[_0x004d('0x10')]));});});}; \ No newline at end of file diff --git a/server/api/campaign/index.js b/server/api/campaign/index.js index 8ac537a..1ca4a18 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 _0x63f1=['index','/:id','show','/:id/hoppers','getHoppers','/:id/hopper_histories','getHopperHistories','/:id/hopper_black','getHopperBlacks','/:id/lists','getLists','getBlackLists','post','clone','/:id/blacklists','put','destroy','delete','removeBlackLists','exports','multer','util','path','connect-timeout','express','Router','fs-extra','../../components/interaction/service','./campaign.controller','get','isAuthenticated'];(function(_0x3c81e1,_0xab14e8){var _0xca5e75=function(_0x3d69e5){while(--_0x3d69e5){_0x3c81e1['push'](_0x3c81e1['shift']());}};_0xca5e75(++_0xab14e8);}(_0x63f1,0x71));var _0x163f=function(_0x59ee6f,_0x450239){_0x59ee6f=_0x59ee6f-0x0;var _0x4c0979=_0x63f1[_0x59ee6f];return _0x4c0979;};'use strict';var multer=require(_0x163f('0x0'));var util=require(_0x163f('0x1'));var path=require(_0x163f('0x2'));var timeout=require(_0x163f('0x3'));var express=require(_0x163f('0x4'));var router=express[_0x163f('0x5')]();var fs_extra=require(_0x163f('0x6'));var auth=require('../../components/auth/service');var interaction=require(_0x163f('0x7'));var config=require('../../config/environment');var controller=require(_0x163f('0x8'));router[_0x163f('0x9')]('/',auth[_0x163f('0xa')](),controller[_0x163f('0xb')]);router[_0x163f('0x9')](_0x163f('0xc'),auth[_0x163f('0xa')](),controller[_0x163f('0xd')]);router[_0x163f('0x9')](_0x163f('0xe'),auth[_0x163f('0xa')](),controller[_0x163f('0xf')]);router[_0x163f('0x9')](_0x163f('0x10'),auth[_0x163f('0xa')](),controller[_0x163f('0x11')]);router[_0x163f('0x9')]('/:id/hopper_finals',auth[_0x163f('0xa')](),controller['getHopperFinals']);router[_0x163f('0x9')](_0x163f('0x12'),auth[_0x163f('0xa')](),controller[_0x163f('0x13')]);router[_0x163f('0x9')](_0x163f('0x14'),auth['isAuthenticated'](),controller[_0x163f('0x15')]);router[_0x163f('0x9')]('/:id/blacklists',auth['isAuthenticated'](),controller[_0x163f('0x16')]);router['post']('/',auth['isAuthenticated'](),controller['create']);router[_0x163f('0x17')]('/:id/clone',auth[_0x163f('0xa')](),controller[_0x163f('0x18')]);router[_0x163f('0x17')](_0x163f('0x14'),auth[_0x163f('0xa')](),controller['addLists']);router['post'](_0x163f('0x19'),auth[_0x163f('0xa')](),controller['addBlackLists']);router[_0x163f('0x1a')](_0x163f('0xc'),auth[_0x163f('0xa')](),controller['update']);router['delete'](_0x163f('0xc'),auth[_0x163f('0xa')](),controller[_0x163f('0x1b')]);router[_0x163f('0x1c')](_0x163f('0x14'),auth['isAuthenticated'](),controller['removeLists']);router['delete'](_0x163f('0x19'),auth[_0x163f('0xa')](),controller[_0x163f('0x1d')]);module[_0x163f('0x1e')]=router; \ No newline at end of file +var _0x807b=['/:id/clone','clone','addLists','put','destroy','removeLists','delete','removeBlackLists','exports','multer','util','path','connect-timeout','Router','../../components/auth/service','./campaign.controller','get','isAuthenticated','index','show','getHoppers','/:id/hopper_histories','/:id/hopper_finals','getHopperFinals','getHopperBlacks','/:id/lists','getLists','/:id/blacklists','getBlackLists','post','create'];(function(_0x1f0636,_0x254a78){var _0x3864a2=function(_0x4f7b38){while(--_0x4f7b38){_0x1f0636['push'](_0x1f0636['shift']());}};_0x3864a2(++_0x254a78);}(_0x807b,0x13f));var _0xb807=function(_0x21ecc8,_0x2bdead){_0x21ecc8=_0x21ecc8-0x0;var _0x510c1d=_0x807b[_0x21ecc8];return _0x510c1d;};'use strict';var multer=require(_0xb807('0x0'));var util=require(_0xb807('0x1'));var path=require(_0xb807('0x2'));var timeout=require(_0xb807('0x3'));var express=require('express');var router=express[_0xb807('0x4')]();var fs_extra=require('fs-extra');var auth=require(_0xb807('0x5'));var interaction=require('../../components/interaction/service');var config=require('../../config/environment');var controller=require(_0xb807('0x6'));router[_0xb807('0x7')]('/',auth[_0xb807('0x8')](),controller[_0xb807('0x9')]);router[_0xb807('0x7')]('/:id',auth[_0xb807('0x8')](),controller[_0xb807('0xa')]);router[_0xb807('0x7')]('/:id/hoppers',auth[_0xb807('0x8')](),controller[_0xb807('0xb')]);router[_0xb807('0x7')](_0xb807('0xc'),auth['isAuthenticated'](),controller['getHopperHistories']);router['get'](_0xb807('0xd'),auth[_0xb807('0x8')](),controller[_0xb807('0xe')]);router[_0xb807('0x7')]('/:id/hopper_black',auth[_0xb807('0x8')](),controller[_0xb807('0xf')]);router[_0xb807('0x7')](_0xb807('0x10'),auth['isAuthenticated'](),controller[_0xb807('0x11')]);router[_0xb807('0x7')](_0xb807('0x12'),auth['isAuthenticated'](),controller[_0xb807('0x13')]);router[_0xb807('0x14')]('/',auth[_0xb807('0x8')](),controller[_0xb807('0x15')]);router['post'](_0xb807('0x16'),auth[_0xb807('0x8')](),controller[_0xb807('0x17')]);router['post']('/:id/lists',auth[_0xb807('0x8')](),controller[_0xb807('0x18')]);router[_0xb807('0x14')](_0xb807('0x12'),auth['isAuthenticated'](),controller['addBlackLists']);router[_0xb807('0x19')]('/:id',auth['isAuthenticated'](),controller['update']);router['delete']('/:id',auth[_0xb807('0x8')](),controller[_0xb807('0x1a')]);router['delete'](_0xb807('0x10'),auth[_0xb807('0x8')](),controller[_0xb807('0x1b')]);router[_0xb807('0x1c')]('/:id/blacklists',auth[_0xb807('0x8')](),controller[_0xb807('0x1d')]);module[_0xb807('0x1e')]=router; \ No newline at end of file diff --git a/server/api/cannedAnswer/cannedAnswer.attributes.js b/server/api/cannedAnswer/cannedAnswer.attributes.js index ee1fdb8..74fffa0 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 _0x703e=['getDataValue','exports','STRING','TEXT','medium','VIRTUAL'];(function(_0x47a349,_0x4699d9){var _0x18ab75=function(_0x210796){while(--_0x210796){_0x47a349['push'](_0x47a349['shift']());}};_0x18ab75(++_0x4699d9);}(_0x703e,0x145));var _0xe703=function(_0x1035c1,_0x2d8583){_0x1035c1=_0x1035c1-0x0;var _0x308d67=_0x703e[_0x1035c1];return _0x308d67;};'use strict';var Sequelize=require('sequelize');module[_0xe703('0x0')]={'key':{'type':Sequelize[_0xe703('0x1')],'allowNull':![]},'value':{'type':Sequelize[_0xe703('0x2')],'length':_0xe703('0x3'),'allowNull':![]},'description':{'type':Sequelize[_0xe703('0x1')]},'name':{'type':Sequelize[_0xe703('0x4')],'get':function(){return this[_0xe703('0x5')]('key');}}}; \ No newline at end of file +var _0x28a4=['key','sequelize','exports','STRING','TEXT','medium','VIRTUAL','getDataValue'];(function(_0x2fec2d,_0x3111b2){var _0x1c7571=function(_0x31cc5d){while(--_0x31cc5d){_0x2fec2d['push'](_0x2fec2d['shift']());}};_0x1c7571(++_0x3111b2);}(_0x28a4,0x139));var _0x428a=function(_0x56e790,_0x5bec09){_0x56e790=_0x56e790-0x0;var _0x4fa9fa=_0x28a4[_0x56e790];return _0x4fa9fa;};'use strict';var Sequelize=require(_0x428a('0x0'));module[_0x428a('0x1')]={'key':{'type':Sequelize[_0x428a('0x2')],'allowNull':![]},'value':{'type':Sequelize[_0x428a('0x3')],'length':_0x428a('0x4'),'allowNull':![]},'description':{'type':Sequelize[_0x428a('0x2')]},'name':{'type':Sequelize[_0x428a('0x5')],'get':function(){return this[_0x428a('0x6')](_0x428a('0x7'));}}}; \ No newline at end of file diff --git a/server/api/cannedAnswer/cannedAnswer.controller.js b/server/api/cannedAnswer/cannedAnswer.controller.js index fbc8cb1..cb3dd34 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 _0x4086=['error','stack','name','index','map','CannedAnswer','rawAttributes','fieldName','type','key','model','query','keys','intersection','attributes','fields','length','hasOwnProperty','nolimit','order','sort','where','filters','filter','merge','includeAll','include','findAll','show','catch','body','params','find','create','MailAccountId','SmsAccountId','OpenchannelAccountId','ChatWebsiteId','Sequelize','ValidationError','The\x20inserted\x20key\x20already\x20exists.','Unable\x20to\x20retrieve\x20the\x20current\x20user','UserProfileSection','userProfileId','autoAssociation','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','rimraf','zip-dir','request-promise','moment','bluebird','mustache','util','path','sox','to-csv','lodash','squel','crypto','desk.js','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/logger','api','../../config/utils','../../config/environment','../../config/license/util','sendStatus','status','end','json','offset','undefined','limit','count','Content-Range','reject','save','update','then','destroy','get','CannedAnswers','UserProfileResource'];(function(_0x35fa33,_0x5cee15){var _0x39de35=function(_0x3abff7){while(--_0x3abff7){_0x35fa33['push'](_0x35fa33['shift']());}};_0x39de35(++_0x5cee15);}(_0x4086,0xdc));var _0x6408=function(_0x20a584,_0xe384a5){_0x20a584=_0x20a584-0x0;var _0x4b41a8=_0x4086[_0x20a584];return _0x4b41a8;};'use strict';var emlformat=require('eml-format');var rimraf=require(_0x6408('0x0'));var zipdir=require(_0x6408('0x1'));var jsonpatch=require('fast-json-patch');var rp=require(_0x6408('0x2'));var moment=require(_0x6408('0x3'));var BPromise=require(_0x6408('0x4'));var Mustache=require(_0x6408('0x5'));var util=require(_0x6408('0x6'));var path=require(_0x6408('0x7'));var sox=require(_0x6408('0x8'));var csv=require(_0x6408('0x9'));var ejs=require('ejs');var fs=require('fs');var fs_extra=require('fs-extra');var _=require(_0x6408('0xa'));var squel=require(_0x6408('0xb'));var crypto=require(_0x6408('0xc'));var jsforce=require('jsforce');var deskjs=require(_0x6408('0xd'));var toCsv=require(_0x6408('0x9'));var querystring=require('querystring');var Papa=require(_0x6408('0xe'));var Redis=require(_0x6408('0xf'));var authService=require(_0x6408('0x10'));var qs=require(_0x6408('0x11'));var as=require(_0x6408('0x12'));var hardwareService=require('../../config/license/hardware');var logger=require(_0x6408('0x13'))(_0x6408('0x14'));var utils=require(_0x6408('0x15'));var config=require(_0x6408('0x16'));var licenseUtil=require(_0x6408('0x17'));var db=require('../../mysqldb')['db'];function respondWithStatusCode(_0x107943,_0x2177ee){_0x2177ee=_0x2177ee||0xcc;return function(_0x42f0eb){if(_0x42f0eb){return _0x107943[_0x6408('0x18')](_0x2177ee);}return _0x107943[_0x6408('0x19')](_0x2177ee)[_0x6408('0x1a')]();};}function respondWithResult(_0x32b102,_0x166b7d){_0x166b7d=_0x166b7d||0xc8;return function(_0x21f1c9){if(_0x21f1c9){return _0x32b102[_0x6408('0x19')](_0x166b7d)[_0x6408('0x1b')](_0x21f1c9);}};}function respondWithFilteredResult(_0x50fcd9,_0x44c469){return function(_0x3c3dab){if(_0x3c3dab){var _0x258a17=typeof _0x44c469[_0x6408('0x1c')]===_0x6408('0x1d')&&typeof _0x44c469[_0x6408('0x1e')]===_0x6408('0x1d');var _0x138f6e=_0x3c3dab['count'];var _0x51a0e9=_0x258a17?0x0:_0x44c469[_0x6408('0x1c')];var _0xce6af8=_0x258a17?_0x3c3dab[_0x6408('0x1f')]:_0x44c469[_0x6408('0x1c')]+_0x44c469[_0x6408('0x1e')];var _0x53825c;if(_0xce6af8>=_0x138f6e){_0xce6af8=_0x138f6e;_0x53825c=0xc8;}else{_0x53825c=0xce;}_0x50fcd9[_0x6408('0x19')](_0x53825c);return _0x50fcd9['set'](_0x6408('0x20'),_0x51a0e9+'-'+_0xce6af8+'/'+_0x138f6e)[_0x6408('0x1b')](_0x3c3dab);}return null;};}function patchUpdates(_0x3688e7){return function(_0x13bd6c){try{jsonpatch['apply'](_0x13bd6c,_0x3688e7,!![]);}catch(_0x2a1f38){return BPromise[_0x6408('0x21')](_0x2a1f38);}return _0x13bd6c[_0x6408('0x22')]();};}function saveUpdates(_0x41d9db,_0x1ec136){return function(_0x2d75e7){if(_0x2d75e7){return _0x2d75e7[_0x6408('0x23')](_0x41d9db)[_0x6408('0x24')](function(_0x29846e){return _0x29846e;});}return null;};}function removeEntity(_0x35ec25,_0x5b025e){return function(_0x29277b){if(_0x29277b){return _0x29277b[_0x6408('0x25')]()['then'](function(){var _0xa6a810=_0x29277b[_0x6408('0x26')]({'plain':!![]});var _0x39baf9=_0x6408('0x27');return db[_0x6408('0x28')][_0x6408('0x25')]({'where':{'type':_0x39baf9,'resourceId':_0xa6a810['id']}})[_0x6408('0x24')](function(){return _0x29277b;});})[_0x6408('0x24')](function(){_0x35ec25[_0x6408('0x19')](0xcc)['end']();});}};}function handleEntityNotFound(_0x27b4bc,_0x18e42d){return function(_0x11b89b){if(!_0x11b89b){_0x27b4bc[_0x6408('0x18')](0x194);}return _0x11b89b;};}function handleError(_0x16d8a2,_0x4d02f1){_0x4d02f1=_0x4d02f1||0x1f4;return function(_0x1fac2e){logger[_0x6408('0x29')](_0x1fac2e[_0x6408('0x2a')]);if(_0x1fac2e[_0x6408('0x2b')]){delete _0x1fac2e[_0x6408('0x2b')];}_0x16d8a2[_0x6408('0x19')](_0x4d02f1)['send'](_0x1fac2e);};}exports[_0x6408('0x2c')]=function(_0x4cccf6,_0x2131f9){var _0x458f25={},_0x466084={},_0x10566e={'count':0x0,'rows':[]};var _0x5a398e=_[_0x6408('0x2d')](db[_0x6408('0x2e')][_0x6408('0x2f')],function(_0x29d1a2){return{'name':_0x29d1a2[_0x6408('0x30')],'type':_0x29d1a2[_0x6408('0x31')][_0x6408('0x32')]};});_0x466084[_0x6408('0x33')]=_[_0x6408('0x2d')](_0x5a398e,_0x6408('0x2b'));_0x466084[_0x6408('0x34')]=_[_0x6408('0x35')](_0x4cccf6[_0x6408('0x34')]);_0x466084['filters']=_[_0x6408('0x36')](_0x466084['model'],_0x466084[_0x6408('0x34')]);_0x458f25[_0x6408('0x37')]=_[_0x6408('0x36')](_0x466084['model'],qs[_0x6408('0x38')](_0x4cccf6['query']['fields']));_0x458f25[_0x6408('0x37')]=_0x458f25['attributes'][_0x6408('0x39')]?_0x458f25['attributes']:_0x466084['model'];if(!_0x4cccf6[_0x6408('0x34')][_0x6408('0x3a')](_0x6408('0x3b'))){_0x458f25[_0x6408('0x1e')]=qs['limit'](_0x4cccf6[_0x6408('0x34')]['limit']);_0x458f25[_0x6408('0x1c')]=qs['offset'](_0x4cccf6[_0x6408('0x34')][_0x6408('0x1c')]);}_0x458f25[_0x6408('0x3c')]=qs['sort'](_0x4cccf6[_0x6408('0x34')][_0x6408('0x3d')]);_0x458f25[_0x6408('0x3e')]=qs['filters'](_['pick'](_0x4cccf6[_0x6408('0x34')],_0x466084[_0x6408('0x3f')]),_0x5a398e);if(_0x4cccf6[_0x6408('0x34')][_0x6408('0x40')]){_0x458f25[_0x6408('0x3e')]=_[_0x6408('0x41')](_0x458f25[_0x6408('0x3e')],{'$or':[{'key':{'$like':'%'+_0x4cccf6['query'][_0x6408('0x40')]+'%'}},{'value':{'$like':'%'+_0x4cccf6[_0x6408('0x34')][_0x6408('0x40')]+'%'}}]});}_0x458f25=_[_0x6408('0x41')]({},_0x458f25,_0x4cccf6['options']);var _0x140a75={'where':_0x458f25[_0x6408('0x3e')]};return db[_0x6408('0x2e')][_0x6408('0x1f')](_0x140a75)['then'](function(_0x1c643b){_0x10566e['count']=_0x1c643b;if(_0x4cccf6[_0x6408('0x34')][_0x6408('0x42')]){_0x458f25[_0x6408('0x43')]=[{'all':!![]}];}return db[_0x6408('0x2e')][_0x6408('0x44')](_0x458f25);})[_0x6408('0x24')](function(_0xd1fe75){_0x10566e['rows']=_0xd1fe75;return _0x10566e;})['then'](respondWithFilteredResult(_0x2131f9,_0x458f25))['catch'](handleError(_0x2131f9,null));};exports[_0x6408('0x45')]=function(_0x10df0c,_0x10006c){var _0x651826={'raw':!![],'where':{'id':_0x10df0c['params']['id']}},_0x3e061c={};_0x3e061c[_0x6408('0x33')]=_['keys'](db[_0x6408('0x2e')]['rawAttributes']);_0x3e061c['query']=_[_0x6408('0x35')](_0x10df0c['query']);_0x3e061c[_0x6408('0x3f')]=_['intersection'](_0x3e061c[_0x6408('0x33')],_0x3e061c[_0x6408('0x34')]);_0x651826[_0x6408('0x37')]=_[_0x6408('0x36')](_0x3e061c['model'],qs[_0x6408('0x38')](_0x10df0c[_0x6408('0x34')][_0x6408('0x38')]));_0x651826[_0x6408('0x37')]=_0x651826[_0x6408('0x37')]['length']?_0x651826[_0x6408('0x37')]:_0x3e061c[_0x6408('0x33')];if(_0x10df0c[_0x6408('0x34')][_0x6408('0x42')]){_0x651826[_0x6408('0x43')]=[{'all':!![]}];}_0x651826=_[_0x6408('0x41')]({},_0x651826,_0x10df0c['options']);return db[_0x6408('0x2e')]['find'](_0x651826)[_0x6408('0x24')](handleEntityNotFound(_0x10006c,null))['then'](respondWithResult(_0x10006c,null))[_0x6408('0x46')](handleError(_0x10006c,null));};exports[_0x6408('0x23')]=function(_0x67c3f9,_0x2c762f){if(_0x67c3f9[_0x6408('0x47')]['id']){delete _0x67c3f9[_0x6408('0x47')]['id'];}return db[_0x6408('0x2e')]['find']({'where':{'id':_0x67c3f9[_0x6408('0x48')]['id']}})['then'](handleEntityNotFound(_0x2c762f,null))[_0x6408('0x24')](saveUpdates(_0x67c3f9[_0x6408('0x47')],null))['then'](respondWithResult(_0x2c762f,null))['catch'](handleError(_0x2c762f,null));};exports[_0x6408('0x25')]=function(_0x4fdd05,_0x13fbf3){return db['CannedAnswer'][_0x6408('0x49')]({'where':{'id':_0x4fdd05['params']['id']}})[_0x6408('0x24')](handleEntityNotFound(_0x13fbf3,null))['then'](removeEntity(_0x13fbf3,null))[_0x6408('0x46')](handleError(_0x13fbf3,null));};exports[_0x6408('0x4a')]=function(_0x10cade,_0x41bd4e){var _0x22e2b8={'key':_0x10cade[_0x6408('0x47')][_0x6408('0x32')]};if(_0x10cade[_0x6408('0x47')]['MailAccountId']){_0x22e2b8['MailAccountId']=_0x10cade[_0x6408('0x47')][_0x6408('0x4b')];}else if(_0x10cade[_0x6408('0x47')]['SmsAccountId']){_0x22e2b8[_0x6408('0x4c')]=_0x10cade[_0x6408('0x47')][_0x6408('0x4c')];}else if(_0x10cade[_0x6408('0x47')][_0x6408('0x4d')]){_0x22e2b8[_0x6408('0x4d')]=_0x10cade[_0x6408('0x47')][_0x6408('0x4d')];}else if(_0x10cade['body'][_0x6408('0x4e')]){_0x22e2b8[_0x6408('0x4e')]=_0x10cade['body']['ChatWebsiteId'];}return db['CannedAnswer'][_0x6408('0x49')]({'where':_0x22e2b8})['then'](function(_0x53f3f8){if(_0x53f3f8){throw new db[(_0x6408('0x4f'))][(_0x6408('0x50'))](_0x6408('0x51'));}return db[_0x6408('0x2e')][_0x6408('0x4a')](_0x10cade[_0x6408('0x47')]);})[_0x6408('0x24')](function(_0xf43589){var _0x5dab9f=_0x10cade['user'][_0x6408('0x26')]({'plain':!![]});if(!_0x5dab9f)throw new Error(_0x6408('0x52'));if(_0x5dab9f['role']==='user'){var _0x4a268a=_0xf43589[_0x6408('0x26')]({'plain':!![]});return db[_0x6408('0x53')][_0x6408('0x49')]({'where':{'name':_0x6408('0x27'),'userProfileId':_0x5dab9f[_0x6408('0x54')]},'raw':!![]})[_0x6408('0x24')](function(_0x382efd){if(_0x382efd&&_0x382efd[_0x6408('0x55')]===0x0){return db[_0x6408('0x28')][_0x6408('0x4a')]({'name':_0x4a268a['name'],'resourceId':_0x4a268a['id'],'type':_0x382efd['name'],'sectionId':_0x382efd['id']},{})[_0x6408('0x24')](function(){return _0xf43589;});}else{return _0xf43589;}})[_0x6408('0x46')](function(_0x2e01f7){logger[_0x6408('0x29')](_0x6408('0x56'),_0x2e01f7);throw _0x2e01f7;});}return _0xf43589;})['then'](respondWithResult(_0x41bd4e,0xc9))[_0x6408('0x46')](handleError(_0x41bd4e,null));}; \ No newline at end of file +var _0x5a23=['request-promise','moment','bluebird','mustache','path','sox','to-csv','ejs','fs-extra','squel','crypto','jsforce','desk.js','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/license/util','sendStatus','status','end','json','offset','undefined','limit','count','Content-Range','apply','reject','update','then','destroy','get','CannedAnswers','error','stack','name','index','CannedAnswer','rawAttributes','fieldName','type','model','map','query','filters','intersection','fields','attributes','length','hasOwnProperty','nolimit','order','sort','pick','filter','where','merge','options','includeAll','include','findAll','catch','show','params','keys','find','body','create','MailAccountId','SmsAccountId','OpenchannelAccountId','ChatWebsiteId','The\x20inserted\x20key\x20already\x20exists.','user','Unable\x20to\x20retrieve\x20the\x20current\x20user','role','UserProfileSection','userProfileId','autoAssociation','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','rimraf','zip-dir','fast-json-patch'];(function(_0x3e8f7d,_0x389b05){var _0x101795=function(_0x18097f){while(--_0x18097f){_0x3e8f7d['push'](_0x3e8f7d['shift']());}};_0x101795(++_0x389b05);}(_0x5a23,0x108));var _0x35a2=function(_0xeca8df,_0x2bbd73){_0xeca8df=_0xeca8df-0x0;var _0x5b8985=_0x5a23[_0xeca8df];return _0x5b8985;};'use strict';var emlformat=require('eml-format');var rimraf=require(_0x35a2('0x0'));var zipdir=require(_0x35a2('0x1'));var jsonpatch=require(_0x35a2('0x2'));var rp=require(_0x35a2('0x3'));var moment=require(_0x35a2('0x4'));var BPromise=require(_0x35a2('0x5'));var Mustache=require(_0x35a2('0x6'));var util=require('util');var path=require(_0x35a2('0x7'));var sox=require(_0x35a2('0x8'));var csv=require(_0x35a2('0x9'));var ejs=require(_0x35a2('0xa'));var fs=require('fs');var fs_extra=require(_0x35a2('0xb'));var _=require('lodash');var squel=require(_0x35a2('0xc'));var crypto=require(_0x35a2('0xd'));var jsforce=require(_0x35a2('0xe'));var deskjs=require(_0x35a2('0xf'));var toCsv=require('to-csv');var querystring=require(_0x35a2('0x10'));var Papa=require(_0x35a2('0x11'));var Redis=require(_0x35a2('0x12'));var authService=require(_0x35a2('0x13'));var qs=require(_0x35a2('0x14'));var as=require('../../components/parsers/advancedSearch');var hardwareService=require(_0x35a2('0x15'));var logger=require(_0x35a2('0x16'))(_0x35a2('0x17'));var utils=require(_0x35a2('0x18'));var config=require('../../config/environment');var licenseUtil=require(_0x35a2('0x19'));var db=require('../../mysqldb')['db'];function respondWithStatusCode(_0x7b24bf,_0x15aa76){_0x15aa76=_0x15aa76||0xcc;return function(_0x277274){if(_0x277274){return _0x7b24bf[_0x35a2('0x1a')](_0x15aa76);}return _0x7b24bf[_0x35a2('0x1b')](_0x15aa76)[_0x35a2('0x1c')]();};}function respondWithResult(_0x27b74a,_0x326209){_0x326209=_0x326209||0xc8;return function(_0x248beb){if(_0x248beb){return _0x27b74a[_0x35a2('0x1b')](_0x326209)[_0x35a2('0x1d')](_0x248beb);}};}function respondWithFilteredResult(_0x32f472,_0x17ee74){return function(_0x492c3a){if(_0x492c3a){var _0x44f54e=typeof _0x17ee74[_0x35a2('0x1e')]===_0x35a2('0x1f')&&typeof _0x17ee74[_0x35a2('0x20')]===_0x35a2('0x1f');var _0x19e97a=_0x492c3a[_0x35a2('0x21')];var _0x216468=_0x44f54e?0x0:_0x17ee74['offset'];var _0x1fdaed=_0x44f54e?_0x492c3a[_0x35a2('0x21')]:_0x17ee74['offset']+_0x17ee74['limit'];var _0x15402d;if(_0x1fdaed>=_0x19e97a){_0x1fdaed=_0x19e97a;_0x15402d=0xc8;}else{_0x15402d=0xce;}_0x32f472[_0x35a2('0x1b')](_0x15402d);return _0x32f472['set'](_0x35a2('0x22'),_0x216468+'-'+_0x1fdaed+'/'+_0x19e97a)[_0x35a2('0x1d')](_0x492c3a);}return null;};}function patchUpdates(_0x3d1b5f){return function(_0x544b40){try{jsonpatch[_0x35a2('0x23')](_0x544b40,_0x3d1b5f,!![]);}catch(_0x3b39ac){return BPromise[_0x35a2('0x24')](_0x3b39ac);}return _0x544b40['save']();};}function saveUpdates(_0x341110,_0x8b447b){return function(_0x12364e){if(_0x12364e){return _0x12364e[_0x35a2('0x25')](_0x341110)[_0x35a2('0x26')](function(_0x1020cf){return _0x1020cf;});}return null;};}function removeEntity(_0x2e43b3,_0x2c0945){return function(_0x5de54b){if(_0x5de54b){return _0x5de54b[_0x35a2('0x27')]()[_0x35a2('0x26')](function(){var _0x5f5390=_0x5de54b[_0x35a2('0x28')]({'plain':!![]});var _0x235cd6=_0x35a2('0x29');return db['UserProfileResource'][_0x35a2('0x27')]({'where':{'type':_0x235cd6,'resourceId':_0x5f5390['id']}})[_0x35a2('0x26')](function(){return _0x5de54b;});})['then'](function(){_0x2e43b3[_0x35a2('0x1b')](0xcc)[_0x35a2('0x1c')]();});}};}function handleEntityNotFound(_0x52a7dc,_0x25e558){return function(_0x365a17){if(!_0x365a17){_0x52a7dc[_0x35a2('0x1a')](0x194);}return _0x365a17;};}function handleError(_0x17fc26,_0x3e4a47){_0x3e4a47=_0x3e4a47||0x1f4;return function(_0x3cac8a){logger[_0x35a2('0x2a')](_0x3cac8a[_0x35a2('0x2b')]);if(_0x3cac8a[_0x35a2('0x2c')]){delete _0x3cac8a[_0x35a2('0x2c')];}_0x17fc26[_0x35a2('0x1b')](_0x3e4a47)['send'](_0x3cac8a);};}exports[_0x35a2('0x2d')]=function(_0x24a786,_0x1f9de9){var _0x446e03={},_0x17e582={},_0x175423={'count':0x0,'rows':[]};var _0x50d6d1=_['map'](db[_0x35a2('0x2e')][_0x35a2('0x2f')],function(_0x359134){return{'name':_0x359134[_0x35a2('0x30')],'type':_0x359134[_0x35a2('0x31')]['key']};});_0x17e582[_0x35a2('0x32')]=_[_0x35a2('0x33')](_0x50d6d1,'name');_0x17e582[_0x35a2('0x34')]=_['keys'](_0x24a786[_0x35a2('0x34')]);_0x17e582[_0x35a2('0x35')]=_[_0x35a2('0x36')](_0x17e582['model'],_0x17e582[_0x35a2('0x34')]);_0x446e03['attributes']=_[_0x35a2('0x36')](_0x17e582['model'],qs[_0x35a2('0x37')](_0x24a786[_0x35a2('0x34')][_0x35a2('0x37')]));_0x446e03[_0x35a2('0x38')]=_0x446e03[_0x35a2('0x38')][_0x35a2('0x39')]?_0x446e03[_0x35a2('0x38')]:_0x17e582[_0x35a2('0x32')];if(!_0x24a786[_0x35a2('0x34')][_0x35a2('0x3a')](_0x35a2('0x3b'))){_0x446e03[_0x35a2('0x20')]=qs[_0x35a2('0x20')](_0x24a786['query'][_0x35a2('0x20')]);_0x446e03[_0x35a2('0x1e')]=qs[_0x35a2('0x1e')](_0x24a786['query']['offset']);}_0x446e03[_0x35a2('0x3c')]=qs['sort'](_0x24a786[_0x35a2('0x34')][_0x35a2('0x3d')]);_0x446e03['where']=qs[_0x35a2('0x35')](_[_0x35a2('0x3e')](_0x24a786['query'],_0x17e582[_0x35a2('0x35')]),_0x50d6d1);if(_0x24a786['query'][_0x35a2('0x3f')]){_0x446e03[_0x35a2('0x40')]=_[_0x35a2('0x41')](_0x446e03['where'],{'$or':[{'key':{'$like':'%'+_0x24a786[_0x35a2('0x34')][_0x35a2('0x3f')]+'%'}},{'value':{'$like':'%'+_0x24a786[_0x35a2('0x34')]['filter']+'%'}}]});}_0x446e03=_[_0x35a2('0x41')]({},_0x446e03,_0x24a786[_0x35a2('0x42')]);var _0x4108f4={'where':_0x446e03[_0x35a2('0x40')]};return db[_0x35a2('0x2e')][_0x35a2('0x21')](_0x4108f4)[_0x35a2('0x26')](function(_0x528bba){_0x175423[_0x35a2('0x21')]=_0x528bba;if(_0x24a786[_0x35a2('0x34')][_0x35a2('0x43')]){_0x446e03[_0x35a2('0x44')]=[{'all':!![]}];}return db[_0x35a2('0x2e')][_0x35a2('0x45')](_0x446e03);})[_0x35a2('0x26')](function(_0x386b9e){_0x175423['rows']=_0x386b9e;return _0x175423;})[_0x35a2('0x26')](respondWithFilteredResult(_0x1f9de9,_0x446e03))[_0x35a2('0x46')](handleError(_0x1f9de9,null));};exports[_0x35a2('0x47')]=function(_0x55046e,_0x57c763){var _0x21d6e7={'raw':!![],'where':{'id':_0x55046e[_0x35a2('0x48')]['id']}},_0x7ed1d1={};_0x7ed1d1[_0x35a2('0x32')]=_[_0x35a2('0x49')](db[_0x35a2('0x2e')][_0x35a2('0x2f')]);_0x7ed1d1[_0x35a2('0x34')]=_[_0x35a2('0x49')](_0x55046e['query']);_0x7ed1d1['filters']=_[_0x35a2('0x36')](_0x7ed1d1[_0x35a2('0x32')],_0x7ed1d1[_0x35a2('0x34')]);_0x21d6e7[_0x35a2('0x38')]=_['intersection'](_0x7ed1d1[_0x35a2('0x32')],qs[_0x35a2('0x37')](_0x55046e[_0x35a2('0x34')]['fields']));_0x21d6e7[_0x35a2('0x38')]=_0x21d6e7['attributes'][_0x35a2('0x39')]?_0x21d6e7[_0x35a2('0x38')]:_0x7ed1d1['model'];if(_0x55046e[_0x35a2('0x34')][_0x35a2('0x43')]){_0x21d6e7[_0x35a2('0x44')]=[{'all':!![]}];}_0x21d6e7=_['merge']({},_0x21d6e7,_0x55046e[_0x35a2('0x42')]);return db[_0x35a2('0x2e')][_0x35a2('0x4a')](_0x21d6e7)[_0x35a2('0x26')](handleEntityNotFound(_0x57c763,null))[_0x35a2('0x26')](respondWithResult(_0x57c763,null))[_0x35a2('0x46')](handleError(_0x57c763,null));};exports[_0x35a2('0x25')]=function(_0x1a8009,_0x2ce0c1){if(_0x1a8009[_0x35a2('0x4b')]['id']){delete _0x1a8009[_0x35a2('0x4b')]['id'];}return db[_0x35a2('0x2e')][_0x35a2('0x4a')]({'where':{'id':_0x1a8009[_0x35a2('0x48')]['id']}})[_0x35a2('0x26')](handleEntityNotFound(_0x2ce0c1,null))[_0x35a2('0x26')](saveUpdates(_0x1a8009[_0x35a2('0x4b')],null))[_0x35a2('0x26')](respondWithResult(_0x2ce0c1,null))['catch'](handleError(_0x2ce0c1,null));};exports[_0x35a2('0x27')]=function(_0x1bfec9,_0xe9fcad){return db[_0x35a2('0x2e')][_0x35a2('0x4a')]({'where':{'id':_0x1bfec9['params']['id']}})['then'](handleEntityNotFound(_0xe9fcad,null))[_0x35a2('0x26')](removeEntity(_0xe9fcad,null))[_0x35a2('0x46')](handleError(_0xe9fcad,null));};exports[_0x35a2('0x4c')]=function(_0x5e813a,_0x284ea8){var _0xfbf64f={'key':_0x5e813a['body']['key']};if(_0x5e813a['body']['MailAccountId']){_0xfbf64f[_0x35a2('0x4d')]=_0x5e813a[_0x35a2('0x4b')]['MailAccountId'];}else if(_0x5e813a[_0x35a2('0x4b')][_0x35a2('0x4e')]){_0xfbf64f[_0x35a2('0x4e')]=_0x5e813a[_0x35a2('0x4b')]['SmsAccountId'];}else if(_0x5e813a['body'][_0x35a2('0x4f')]){_0xfbf64f[_0x35a2('0x4f')]=_0x5e813a[_0x35a2('0x4b')][_0x35a2('0x4f')];}else if(_0x5e813a[_0x35a2('0x4b')][_0x35a2('0x50')]){_0xfbf64f[_0x35a2('0x50')]=_0x5e813a['body']['ChatWebsiteId'];}return db[_0x35a2('0x2e')][_0x35a2('0x4a')]({'where':_0xfbf64f})[_0x35a2('0x26')](function(_0x1de9b5){if(_0x1de9b5){throw new db['Sequelize']['ValidationError'](_0x35a2('0x51'));}return db[_0x35a2('0x2e')]['create'](_0x5e813a['body']);})[_0x35a2('0x26')](function(_0x4178ab){var _0x56b092=_0x5e813a[_0x35a2('0x52')][_0x35a2('0x28')]({'plain':!![]});if(!_0x56b092)throw new Error(_0x35a2('0x53'));if(_0x56b092[_0x35a2('0x54')]==='user'){var _0x22925f=_0x4178ab[_0x35a2('0x28')]({'plain':!![]});return db[_0x35a2('0x55')][_0x35a2('0x4a')]({'where':{'name':_0x35a2('0x29'),'userProfileId':_0x56b092[_0x35a2('0x56')]},'raw':!![]})[_0x35a2('0x26')](function(_0x49a6f8){if(_0x49a6f8&&_0x49a6f8[_0x35a2('0x57')]===0x0){return db['UserProfileResource']['create']({'name':_0x22925f[_0x35a2('0x2c')],'resourceId':_0x22925f['id'],'type':_0x49a6f8[_0x35a2('0x2c')],'sectionId':_0x49a6f8['id']},{})['then'](function(){return _0x4178ab;});}else{return _0x4178ab;}})[_0x35a2('0x46')](function(_0x5e60d0){logger['error'](_0x35a2('0x58'),_0x5e60d0);throw _0x5e60d0;});}return _0x4178ab;})[_0x35a2('0x26')](respondWithResult(_0x284ea8,0xc9))[_0x35a2('0x46')](handleError(_0x284ea8,null));}; \ No newline at end of file diff --git a/server/api/cannedAnswer/cannedAnswer.model.js b/server/api/cannedAnswer/cannedAnswer.model.js index ac9bb1d..985f2f0 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 _0xd423=['moment','bluebird','request-promise','rimraf','../../config/environment','./cannedAnswer.attributes','exports','define','CannedAnswer','tools_canned_answers','utf8mb4','utf8mb4_unicode_ci','lodash','util','../../config/logger','api'];(function(_0x596c2e,_0x1f49e0){var _0x10ff6c=function(_0x712f24){while(--_0x712f24){_0x596c2e['push'](_0x596c2e['shift']());}};_0x10ff6c(++_0x1f49e0);}(_0xd423,0x7c));var _0x3d42=function(_0x20cdf0,_0x519950){_0x20cdf0=_0x20cdf0-0x0;var _0x3cf8bb=_0xd423[_0x20cdf0];return _0x3cf8bb;};'use strict';var _=require(_0x3d42('0x0'));var util=require(_0x3d42('0x1'));var logger=require(_0x3d42('0x2'))(_0x3d42('0x3'));var moment=require(_0x3d42('0x4'));var BPromise=require(_0x3d42('0x5'));var rp=require(_0x3d42('0x6'));var fs=require('fs');var path=require('path');var rimraf=require(_0x3d42('0x7'));var config=require(_0x3d42('0x8'));var attributes=require(_0x3d42('0x9'));module[_0x3d42('0xa')]=function(_0x571b5e,_0x52350b){return _0x571b5e[_0x3d42('0xb')](_0x3d42('0xc'),attributes,{'tableName':_0x3d42('0xd'),'paranoid':![],'indexes':[],'timestamps':!![],'charset':_0x3d42('0xe'),'collate':_0x3d42('0xf')});}; \ No newline at end of file +var _0xc8f2=['exports','utf8mb4','utf8mb4_unicode_ci','lodash','api','bluebird','request-promise','path','rimraf','../../config/environment','./cannedAnswer.attributes'];(function(_0x3dd15e,_0x1f0015){var _0x231fd0=function(_0x4f680a){while(--_0x4f680a){_0x3dd15e['push'](_0x3dd15e['shift']());}};_0x231fd0(++_0x1f0015);}(_0xc8f2,0x137));var _0x2c8f=function(_0x8d0f6e,_0x2b90c6){_0x8d0f6e=_0x8d0f6e-0x0;var _0x11dc3c=_0xc8f2[_0x8d0f6e];return _0x11dc3c;};'use strict';var _=require(_0x2c8f('0x0'));var util=require('util');var logger=require('../../config/logger')(_0x2c8f('0x1'));var moment=require('moment');var BPromise=require(_0x2c8f('0x2'));var rp=require(_0x2c8f('0x3'));var fs=require('fs');var path=require(_0x2c8f('0x4'));var rimraf=require(_0x2c8f('0x5'));var config=require(_0x2c8f('0x6'));var attributes=require(_0x2c8f('0x7'));module[_0x2c8f('0x8')]=function(_0x481e74,_0x56171d){return _0x481e74['define']('CannedAnswer',attributes,{'tableName':'tools_canned_answers','paranoid':![],'indexes':[],'timestamps':!![],'charset':_0x2c8f('0x9'),'collate':_0x2c8f('0xa')});}; \ No newline at end of file diff --git a/server/api/cannedAnswer/cannedAnswer.rpc.js b/server/api/cannedAnswer/cannedAnswer.rpc.js index 326d2e8..775a0df 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(_0x382df0,_0x5453f3){var _0x1709bd=function(_0x479d50){while(--_0x479d50){_0x382df0['push'](_0x382df0['shift']());}};_0x1709bd(++_0x5453f3);}(_0xa9e0,0x123));var _0x0a9e=function(_0x3635ce,_0x33a6f9){_0x3635ce=_0x3635ce-0x0;var _0x97ecd0=_0xa9e0[_0x3635ce];return _0x97ecd0;};'use strict';var _=require(_0x0a9e('0x0'));var util=require(_0x0a9e('0x1'));var moment=require(_0x0a9e('0x2'));var BPromise=require('bluebird');var rs=require('randomstring');var fs=require('fs');var Redis=require(_0x0a9e('0x3'));var db=require('../../mysqldb')['db'];var utils=require(_0x0a9e('0x4'));var logger=require(_0x0a9e('0x5'))(_0x0a9e('0x6'));var config=require(_0x0a9e('0x7'));var jayson=require(_0x0a9e('0x8'));var client=jayson['client'][_0x0a9e('0x9')]({'port':0x232a});function respondWithRpcPromise(_0x441e3a,_0x2cc193,_0x5f41ea){return new BPromise(function(_0x503809,_0xe42b77){return client['request'](_0x441e3a,_0x5f41ea)['then'](function(_0x39753a){logger[_0x0a9e('0xa')](_0x0a9e('0xb'),_0x2cc193,_0x0a9e('0xc'));logger[_0x0a9e('0xd')](_0x0a9e('0xe'),_0x2cc193,'request\x20sent',JSON['stringify'](_0x39753a));if(_0x39753a['error']){if(_0x39753a['error'][_0x0a9e('0xf')]===0x1f4){logger[_0x0a9e('0x10')](_0x0a9e('0xb'),_0x2cc193,_0x39753a[_0x0a9e('0x10')][_0x0a9e('0x11')]);return _0xe42b77(_0x39753a[_0x0a9e('0x10')]['message']);}logger[_0x0a9e('0x10')](_0x0a9e('0xb'),_0x2cc193,_0x39753a[_0x0a9e('0x10')][_0x0a9e('0x11')]);return _0x503809(_0x39753a[_0x0a9e('0x10')][_0x0a9e('0x11')]);}else{logger['info'](_0x0a9e('0xb'),_0x2cc193,'request\x20sent');_0x503809(_0x39753a[_0x0a9e('0x12')]['message']);}})[_0x0a9e('0x13')](function(_0x12066b){logger['error'](_0x0a9e('0xb'),_0x2cc193,_0x12066b);_0xe42b77(_0x12066b);});});} \ 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(_0x296dd8,_0x2bb791){var _0x6c8c4a=function(_0x4634d2){while(--_0x4634d2){_0x296dd8['push'](_0x296dd8['shift']());}};_0x6c8c4a(++_0x2bb791);}(_0xa9e0,0x123));var _0x0a9e=function(_0xea8947,_0x1b573d){_0xea8947=_0xea8947-0x0;var _0x2455e9=_0xa9e0[_0xea8947];return _0x2455e9;};'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 4e4affb..a20dfbc 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 _0x0407=['./cannedAnswer.controller','get','isAuthenticated','index','/:id','post','create','put','update','delete','destroy','multer','util','path','connect-timeout','express','Router','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment'];(function(_0x2641f9,_0x26715f){var _0x585741=function(_0x2d1462){while(--_0x2d1462){_0x2641f9['push'](_0x2641f9['shift']());}};_0x585741(++_0x26715f);}(_0x0407,0x9e));var _0x7040=function(_0xce93c,_0x555be5){_0xce93c=_0xce93c-0x0;var _0x230720=_0x0407[_0xce93c];return _0x230720;};'use strict';var multer=require(_0x7040('0x0'));var util=require(_0x7040('0x1'));var path=require(_0x7040('0x2'));var timeout=require(_0x7040('0x3'));var express=require(_0x7040('0x4'));var router=express[_0x7040('0x5')]();var fs_extra=require(_0x7040('0x6'));var auth=require(_0x7040('0x7'));var interaction=require(_0x7040('0x8'));var config=require(_0x7040('0x9'));var controller=require(_0x7040('0xa'));router[_0x7040('0xb')]('/',auth[_0x7040('0xc')](),controller[_0x7040('0xd')]);router['get'](_0x7040('0xe'),auth['isAuthenticated'](),controller['show']);router[_0x7040('0xf')]('/',auth[_0x7040('0xc')](),controller[_0x7040('0x10')]);router[_0x7040('0x11')](_0x7040('0xe'),auth['isAuthenticated'](),controller[_0x7040('0x12')]);router[_0x7040('0x13')]('/:id',auth[_0x7040('0xc')](),controller[_0x7040('0x14')]);module['exports']=router; \ No newline at end of file +var _0x52da=['put','/:id','update','delete','destroy','exports','multer','util','connect-timeout','express','Router','fs-extra','../../components/auth/service','../../components/interaction/service','./cannedAnswer.controller','get','isAuthenticated','index','post'];(function(_0x565c86,_0x6d8722){var _0x20a69d=function(_0x4c8a75){while(--_0x4c8a75){_0x565c86['push'](_0x565c86['shift']());}};_0x20a69d(++_0x6d8722);}(_0x52da,0x1f4));var _0xa52d=function(_0x169ff3,_0x13fb48){_0x169ff3=_0x169ff3-0x0;var _0x4f8172=_0x52da[_0x169ff3];return _0x4f8172;};'use strict';var multer=require(_0xa52d('0x0'));var util=require(_0xa52d('0x1'));var path=require('path');var timeout=require(_0xa52d('0x2'));var express=require(_0xa52d('0x3'));var router=express[_0xa52d('0x4')]();var fs_extra=require(_0xa52d('0x5'));var auth=require(_0xa52d('0x6'));var interaction=require(_0xa52d('0x7'));var config=require('../../config/environment');var controller=require(_0xa52d('0x8'));router[_0xa52d('0x9')]('/',auth[_0xa52d('0xa')](),controller[_0xa52d('0xb')]);router[_0xa52d('0x9')]('/:id',auth['isAuthenticated'](),controller['show']);router[_0xa52d('0xc')]('/',auth['isAuthenticated'](),controller['create']);router[_0xa52d('0xd')](_0xa52d('0xe'),auth[_0xa52d('0xa')](),controller[_0xa52d('0xf')]);router[_0xa52d('0x10')]('/:id',auth[_0xa52d('0xa')](),controller[_0xa52d('0x11')]);module[_0xa52d('0x12')]=router; \ No newline at end of file diff --git a/server/api/cdr/cdr.attributes.js b/server/api/cdr/cdr.attributes.js index 53c3798..2fdd380 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 _0x7d19=['1970-01-01\x2000:00:01','STRING','INTEGER','sequelize','DATE'];(function(_0x236380,_0x25476c){var _0x2e4104=function(_0x2b6a71){while(--_0x2b6a71){_0x236380['push'](_0x236380['shift']());}};_0x2e4104(++_0x25476c);}(_0x7d19,0x9e));var _0x97d1=function(_0x246890,_0x46b964){_0x246890=_0x246890-0x0;var _0x2b2a5a=_0x7d19[_0x246890];return _0x2b2a5a;};'use strict';var Sequelize=require(_0x97d1('0x0'));module['exports']={'calldate':{'type':Sequelize[_0x97d1('0x1')],'allowNull':![],'defaultValue':_0x97d1('0x2')},'clid':{'type':Sequelize[_0x97d1('0x3')]},'src':{'type':Sequelize[_0x97d1('0x3')]},'dst':{'type':Sequelize['STRING']},'dcontext':{'type':Sequelize[_0x97d1('0x3')]},'channel':{'type':Sequelize[_0x97d1('0x3')]},'dstchannel':{'type':Sequelize[_0x97d1('0x3')]},'lastapp':{'type':Sequelize[_0x97d1('0x3')]},'lastdata':{'type':Sequelize[_0x97d1('0x3')]},'duration':{'type':Sequelize[_0x97d1('0x4')],'allowNull':![],'defaultValue':0x0},'billsec':{'type':Sequelize[_0x97d1('0x4')],'allowNull':![],'defaultValue':0x0},'disposition':{'type':Sequelize[_0x97d1('0x3')]},'amaflags':{'type':Sequelize[_0x97d1('0x4')],'allowNull':![],'defaultValue':0x0},'accountcode':{'type':Sequelize['STRING']},'userfield':{'type':Sequelize['STRING']},'uniqueid':{'type':Sequelize[_0x97d1('0x3')]},'linkedid':{'type':Sequelize[_0x97d1('0x3')]},'sequence':{'type':Sequelize[_0x97d1('0x3')]},'peeraccount':{'type':Sequelize[_0x97d1('0x3')]},'type':{'type':Sequelize[_0x97d1('0x3')]},'tag':{'type':Sequelize[_0x97d1('0x3')]}}; \ No newline at end of file +var _0x466f=['1970-01-01\x2000:00:01','STRING','INTEGER','sequelize','DATE'];(function(_0xd70344,_0x304eac){var _0x338d4b=function(_0x4d42a8){while(--_0x4d42a8){_0xd70344['push'](_0xd70344['shift']());}};_0x338d4b(++_0x304eac);}(_0x466f,0x76));var _0xf466=function(_0x2d4f78,_0x34b9ff){_0x2d4f78=_0x2d4f78-0x0;var _0x1672e5=_0x466f[_0x2d4f78];return _0x1672e5;};'use strict';var Sequelize=require(_0xf466('0x0'));module['exports']={'calldate':{'type':Sequelize[_0xf466('0x1')],'allowNull':![],'defaultValue':_0xf466('0x2')},'clid':{'type':Sequelize[_0xf466('0x3')]},'src':{'type':Sequelize['STRING']},'dst':{'type':Sequelize[_0xf466('0x3')]},'dcontext':{'type':Sequelize['STRING']},'channel':{'type':Sequelize[_0xf466('0x3')]},'dstchannel':{'type':Sequelize['STRING']},'lastapp':{'type':Sequelize[_0xf466('0x3')]},'lastdata':{'type':Sequelize[_0xf466('0x3')]},'duration':{'type':Sequelize[_0xf466('0x4')],'allowNull':![],'defaultValue':0x0},'billsec':{'type':Sequelize['INTEGER'],'allowNull':![],'defaultValue':0x0},'disposition':{'type':Sequelize[_0xf466('0x3')]},'amaflags':{'type':Sequelize['INTEGER'],'allowNull':![],'defaultValue':0x0},'accountcode':{'type':Sequelize[_0xf466('0x3')]},'userfield':{'type':Sequelize[_0xf466('0x3')]},'uniqueid':{'type':Sequelize[_0xf466('0x3')]},'linkedid':{'type':Sequelize[_0xf466('0x3')]},'sequence':{'type':Sequelize[_0xf466('0x3')]},'peeraccount':{'type':Sequelize[_0xf466('0x3')]},'type':{'type':Sequelize[_0xf466('0x3')]},'tag':{'type':Sequelize[_0xf466('0x3')]}}; \ No newline at end of file diff --git a/server/api/cdr/cdr.controller.js b/server/api/cdr/cdr.controller.js index 3468443..749571f 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 _0x8ce1=['util','path','sox','to-csv','ejs','fs-extra','lodash','squel','jsforce','desk.js','querystring','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','api','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','sendStatus','status','end','json','offset','undefined','limit','count','Content-Range','apply','reject','save','update','destroy','then','error','send','index','Cdr','rawAttributes','type','key','model','query','keys','filters','intersection','attributes','fields','length','hasOwnProperty','order','sort','where','pick','merge','map','VIRTUAL','name','options','includeAll','include','findAll','rows','catch','show','params','find','create','body','describe','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','moment','bluebird','mustache'];(function(_0x55abd9,_0x1148af){var _0x3e5669=function(_0x6f2105){while(--_0x6f2105){_0x55abd9['push'](_0x55abd9['shift']());}};_0x3e5669(++_0x1148af);}(_0x8ce1,0x183));var _0x18ce=function(_0x570a68,_0x1a253e){_0x570a68=_0x570a68-0x0;var _0x2b7bae=_0x8ce1[_0x570a68];return _0x2b7bae;};'use strict';var emlformat=require(_0x18ce('0x0'));var rimraf=require(_0x18ce('0x1'));var zipdir=require(_0x18ce('0x2'));var jsonpatch=require(_0x18ce('0x3'));var rp=require(_0x18ce('0x4'));var moment=require(_0x18ce('0x5'));var BPromise=require(_0x18ce('0x6'));var Mustache=require(_0x18ce('0x7'));var util=require(_0x18ce('0x8'));var path=require(_0x18ce('0x9'));var sox=require(_0x18ce('0xa'));var csv=require(_0x18ce('0xb'));var ejs=require(_0x18ce('0xc'));var fs=require('fs');var fs_extra=require(_0x18ce('0xd'));var _=require(_0x18ce('0xe'));var squel=require(_0x18ce('0xf'));var crypto=require('crypto');var jsforce=require(_0x18ce('0x10'));var deskjs=require(_0x18ce('0x11'));var toCsv=require(_0x18ce('0xb'));var querystring=require(_0x18ce('0x12'));var Papa=require('papaparse');var Redis=require(_0x18ce('0x13'));var authService=require(_0x18ce('0x14'));var qs=require(_0x18ce('0x15'));var as=require(_0x18ce('0x16'));var hardwareService=require('../../config/license/hardware');var logger=require('../../config/logger')(_0x18ce('0x17'));var utils=require(_0x18ce('0x18'));var config=require(_0x18ce('0x19'));var licenseUtil=require(_0x18ce('0x1a'));var db=require(_0x18ce('0x1b'))['db'];function respondWithStatusCode(_0x5e8c23,_0xbd514b){_0xbd514b=_0xbd514b||0xcc;return function(_0x402ba4){if(_0x402ba4){return _0x5e8c23[_0x18ce('0x1c')](_0xbd514b);}return _0x5e8c23[_0x18ce('0x1d')](_0xbd514b)[_0x18ce('0x1e')]();};}function respondWithResult(_0x5daf04,_0x176797){_0x176797=_0x176797||0xc8;return function(_0xdd4626){if(_0xdd4626){return _0x5daf04[_0x18ce('0x1d')](_0x176797)[_0x18ce('0x1f')](_0xdd4626);}};}function respondWithFilteredResult(_0x46e346,_0x36b5da){return function(_0x17460e){if(_0x17460e){var _0x4a934f=typeof _0x36b5da[_0x18ce('0x20')]===_0x18ce('0x21')&&typeof _0x36b5da[_0x18ce('0x22')]===_0x18ce('0x21');var _0x1edc10=_0x17460e[_0x18ce('0x23')];var _0x482458=_0x4a934f?0x0:_0x36b5da[_0x18ce('0x20')];var _0x29c691=_0x4a934f?_0x17460e[_0x18ce('0x23')]:_0x36b5da['offset']+_0x36b5da[_0x18ce('0x22')];var _0x2fa3d4;if(_0x29c691>=_0x1edc10){_0x29c691=_0x1edc10;_0x2fa3d4=0xc8;}else{_0x2fa3d4=0xce;}_0x46e346[_0x18ce('0x1d')](_0x2fa3d4);return _0x46e346['set'](_0x18ce('0x24'),_0x482458+'-'+_0x29c691+'/'+_0x1edc10)[_0x18ce('0x1f')](_0x17460e);}return null;};}function patchUpdates(_0x5d22cd){return function(_0x29c1ab){try{jsonpatch[_0x18ce('0x25')](_0x29c1ab,_0x5d22cd,!![]);}catch(_0x16802e){return BPromise[_0x18ce('0x26')](_0x16802e);}return _0x29c1ab[_0x18ce('0x27')]();};}function saveUpdates(_0xd41f29,_0x35abf9){return function(_0x545459){if(_0x545459){return _0x545459[_0x18ce('0x28')](_0xd41f29)['then'](function(_0x482c90){return _0x482c90;});}return null;};}function removeEntity(_0x5d2299,_0x32e910){return function(_0x576ecc){if(_0x576ecc){return _0x576ecc[_0x18ce('0x29')]()[_0x18ce('0x2a')](function(){_0x5d2299[_0x18ce('0x1d')](0xcc)['end']();});}};}function handleEntityNotFound(_0x53abbd,_0x55e17c){return function(_0x317812){if(!_0x317812){_0x53abbd[_0x18ce('0x1c')](0x194);}return _0x317812;};}function handleError(_0x12dbd2,_0x461113){_0x461113=_0x461113||0x1f4;return function(_0x62b2bd){logger[_0x18ce('0x2b')](_0x62b2bd['stack']);if(_0x62b2bd['name']){delete _0x62b2bd['name'];}_0x12dbd2[_0x18ce('0x1d')](_0x461113)[_0x18ce('0x2c')](_0x62b2bd);};}exports[_0x18ce('0x2d')]=function(_0x5f3ec2,_0x1a87f6){var _0xf2683f={},_0x1988e4={},_0x5ef96c={'count':0x0,'rows':[]};var _0x56d296=_['map'](db[_0x18ce('0x2e')][_0x18ce('0x2f')],function(_0x5c2d96){return{'name':_0x5c2d96['fieldName'],'type':_0x5c2d96[_0x18ce('0x30')][_0x18ce('0x31')]};});_0x1988e4[_0x18ce('0x32')]=_['map'](_0x56d296,'name');_0x1988e4[_0x18ce('0x33')]=_[_0x18ce('0x34')](_0x5f3ec2[_0x18ce('0x33')]);_0x1988e4[_0x18ce('0x35')]=_[_0x18ce('0x36')](_0x1988e4[_0x18ce('0x32')],_0x1988e4[_0x18ce('0x33')]);_0xf2683f[_0x18ce('0x37')]=_['intersection'](_0x1988e4['model'],qs[_0x18ce('0x38')](_0x5f3ec2[_0x18ce('0x33')]['fields']));_0xf2683f[_0x18ce('0x37')]=_0xf2683f['attributes'][_0x18ce('0x39')]?_0xf2683f['attributes']:_0x1988e4[_0x18ce('0x32')];if(!_0x5f3ec2[_0x18ce('0x33')][_0x18ce('0x3a')]('nolimit')){_0xf2683f['limit']=qs[_0x18ce('0x22')](_0x5f3ec2[_0x18ce('0x33')]['limit']);_0xf2683f['offset']=qs[_0x18ce('0x20')](_0x5f3ec2[_0x18ce('0x33')][_0x18ce('0x20')]);}_0xf2683f[_0x18ce('0x3b')]=qs[_0x18ce('0x3c')](_0x5f3ec2[_0x18ce('0x33')][_0x18ce('0x3c')]);_0xf2683f[_0x18ce('0x3d')]=qs[_0x18ce('0x35')](_[_0x18ce('0x3e')](_0x5f3ec2[_0x18ce('0x33')],_0x1988e4[_0x18ce('0x35')]),_0x56d296);if(_0x5f3ec2[_0x18ce('0x33')]['filter']){_0xf2683f[_0x18ce('0x3d')]=_[_0x18ce('0x3f')](_0xf2683f[_0x18ce('0x3d')],{'$or':_[_0x18ce('0x40')](_0x56d296,function(_0x1e67dd){if(_0x1e67dd[_0x18ce('0x30')]!==_0x18ce('0x41')){var _0x27c55a={};_0x27c55a[_0x1e67dd[_0x18ce('0x42')]]={'$like':'%'+_0x5f3ec2[_0x18ce('0x33')]['filter']+'%'};return _0x27c55a;}})});}_0xf2683f=_['merge']({},_0xf2683f,_0x5f3ec2[_0x18ce('0x43')]);var _0x23486c={'where':_0xf2683f[_0x18ce('0x3d')]};return db[_0x18ce('0x2e')][_0x18ce('0x23')](_0x23486c)[_0x18ce('0x2a')](function(_0x2eba88){_0x5ef96c['count']=_0x2eba88;if(_0x5f3ec2['query'][_0x18ce('0x44')]){_0xf2683f[_0x18ce('0x45')]=[{'all':!![]}];}return db['Cdr'][_0x18ce('0x46')](_0xf2683f);})[_0x18ce('0x2a')](function(_0x2941ce){_0x5ef96c[_0x18ce('0x47')]=_0x2941ce;return _0x5ef96c;})[_0x18ce('0x2a')](respondWithFilteredResult(_0x1a87f6,_0xf2683f))[_0x18ce('0x48')](handleError(_0x1a87f6,null));};exports[_0x18ce('0x49')]=function(_0x2a96a7,_0x33b409){var _0x1d6d5f={'raw':!![],'where':{'id':_0x2a96a7[_0x18ce('0x4a')]['id']}},_0x3885e6={};_0x3885e6['model']=_[_0x18ce('0x34')](db[_0x18ce('0x2e')][_0x18ce('0x2f')]);_0x3885e6[_0x18ce('0x33')]=_[_0x18ce('0x34')](_0x2a96a7[_0x18ce('0x33')]);_0x3885e6[_0x18ce('0x35')]=_['intersection'](_0x3885e6['model'],_0x3885e6[_0x18ce('0x33')]);_0x1d6d5f[_0x18ce('0x37')]=_[_0x18ce('0x36')](_0x3885e6[_0x18ce('0x32')],qs['fields'](_0x2a96a7[_0x18ce('0x33')][_0x18ce('0x38')]));_0x1d6d5f[_0x18ce('0x37')]=_0x1d6d5f['attributes']['length']?_0x1d6d5f[_0x18ce('0x37')]:_0x3885e6[_0x18ce('0x32')];if(_0x2a96a7['query'][_0x18ce('0x44')]){_0x1d6d5f[_0x18ce('0x45')]=[{'all':!![]}];}_0x1d6d5f=_[_0x18ce('0x3f')]({},_0x1d6d5f,_0x2a96a7[_0x18ce('0x43')]);return db[_0x18ce('0x2e')][_0x18ce('0x4b')](_0x1d6d5f)[_0x18ce('0x2a')](handleEntityNotFound(_0x33b409,null))['then'](respondWithResult(_0x33b409,null))[_0x18ce('0x48')](handleError(_0x33b409,null));};exports[_0x18ce('0x4c')]=function(_0x476c6a,_0x1e445d){return db[_0x18ce('0x2e')][_0x18ce('0x4c')](_0x476c6a[_0x18ce('0x4d')],{})[_0x18ce('0x2a')](respondWithResult(_0x1e445d,0xc9))[_0x18ce('0x48')](handleError(_0x1e445d,null));};exports[_0x18ce('0x28')]=function(_0x1211d0,_0x3f9960){if(_0x1211d0[_0x18ce('0x4d')]['id']){delete _0x1211d0[_0x18ce('0x4d')]['id'];}return db['Cdr'][_0x18ce('0x4b')]({'where':{'id':_0x1211d0[_0x18ce('0x4a')]['id']}})['then'](handleEntityNotFound(_0x3f9960,null))[_0x18ce('0x2a')](saveUpdates(_0x1211d0['body'],null))[_0x18ce('0x2a')](respondWithResult(_0x3f9960,null))['catch'](handleError(_0x3f9960,null));};exports[_0x18ce('0x29')]=function(_0x188f57,_0x3d5b1b){return db[_0x18ce('0x2e')]['find']({'where':{'id':_0x188f57[_0x18ce('0x4a')]['id']}})['then'](handleEntityNotFound(_0x3d5b1b,null))['then'](removeEntity(_0x3d5b1b,null))[_0x18ce('0x48')](handleError(_0x3d5b1b,null));};exports[_0x18ce('0x4e')]=function(_0x8aa4a7,_0x5f164a){return db['Cdr'][_0x18ce('0x4e')]()[_0x18ce('0x2a')](respondWithResult(_0x5f164a,null))[_0x18ce('0x48')](handleError(_0x5f164a,null));}; \ No newline at end of file +var _0x4ab0=['lodash','squel','crypto','desk.js','querystring','papaparse','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','api','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','status','end','offset','undefined','limit','count','set','Content-Range','apply','reject','destroy','then','sendStatus','error','stack','name','send','Cdr','rawAttributes','fieldName','type','key','model','map','query','keys','filters','intersection','fields','attributes','length','hasOwnProperty','order','where','pick','filter','merge','VIRTUAL','options','includeAll','include','findAll','rows','show','find','catch','body','update','params','describe','rimraf','zip-dir','fast-json-patch','request-promise','moment','util','path','to-csv','ejs'];(function(_0x18b2e6,_0xc7d4e7){var _0x4861c4=function(_0x435c23){while(--_0x435c23){_0x18b2e6['push'](_0x18b2e6['shift']());}};_0x4861c4(++_0xc7d4e7);}(_0x4ab0,0xd5));var _0x04ab=function(_0x2106e4,_0x244edb){_0x2106e4=_0x2106e4-0x0;var _0x5dd6d4=_0x4ab0[_0x2106e4];return _0x5dd6d4;};'use strict';var emlformat=require('eml-format');var rimraf=require(_0x04ab('0x0'));var zipdir=require(_0x04ab('0x1'));var jsonpatch=require(_0x04ab('0x2'));var rp=require(_0x04ab('0x3'));var moment=require(_0x04ab('0x4'));var BPromise=require('bluebird');var Mustache=require('mustache');var util=require(_0x04ab('0x5'));var path=require(_0x04ab('0x6'));var sox=require('sox');var csv=require(_0x04ab('0x7'));var ejs=require(_0x04ab('0x8'));var fs=require('fs');var fs_extra=require('fs-extra');var _=require(_0x04ab('0x9'));var squel=require(_0x04ab('0xa'));var crypto=require(_0x04ab('0xb'));var jsforce=require('jsforce');var deskjs=require(_0x04ab('0xc'));var toCsv=require(_0x04ab('0x7'));var querystring=require(_0x04ab('0xd'));var Papa=require(_0x04ab('0xe'));var Redis=require('ioredis');var authService=require(_0x04ab('0xf'));var qs=require(_0x04ab('0x10'));var as=require(_0x04ab('0x11'));var hardwareService=require(_0x04ab('0x12'));var logger=require('../../config/logger')(_0x04ab('0x13'));var utils=require(_0x04ab('0x14'));var config=require(_0x04ab('0x15'));var licenseUtil=require(_0x04ab('0x16'));var db=require(_0x04ab('0x17'))['db'];function respondWithStatusCode(_0x386d0a,_0x4a6b39){_0x4a6b39=_0x4a6b39||0xcc;return function(_0x710503){if(_0x710503){return _0x386d0a['sendStatus'](_0x4a6b39);}return _0x386d0a[_0x04ab('0x18')](_0x4a6b39)[_0x04ab('0x19')]();};}function respondWithResult(_0x2abdf8,_0x428798){_0x428798=_0x428798||0xc8;return function(_0x4f0da1){if(_0x4f0da1){return _0x2abdf8['status'](_0x428798)['json'](_0x4f0da1);}};}function respondWithFilteredResult(_0x103ca8,_0x3cee44){return function(_0x149fd2){if(_0x149fd2){var _0x2b10b0=typeof _0x3cee44[_0x04ab('0x1a')]===_0x04ab('0x1b')&&typeof _0x3cee44[_0x04ab('0x1c')]===_0x04ab('0x1b');var _0x1f3251=_0x149fd2[_0x04ab('0x1d')];var _0x5ce43c=_0x2b10b0?0x0:_0x3cee44[_0x04ab('0x1a')];var _0x83ab27=_0x2b10b0?_0x149fd2[_0x04ab('0x1d')]:_0x3cee44[_0x04ab('0x1a')]+_0x3cee44[_0x04ab('0x1c')];var _0x10669a;if(_0x83ab27>=_0x1f3251){_0x83ab27=_0x1f3251;_0x10669a=0xc8;}else{_0x10669a=0xce;}_0x103ca8[_0x04ab('0x18')](_0x10669a);return _0x103ca8[_0x04ab('0x1e')](_0x04ab('0x1f'),_0x5ce43c+'-'+_0x83ab27+'/'+_0x1f3251)['json'](_0x149fd2);}return null;};}function patchUpdates(_0x75a04e){return function(_0x4a6679){try{jsonpatch[_0x04ab('0x20')](_0x4a6679,_0x75a04e,!![]);}catch(_0x1d04c2){return BPromise[_0x04ab('0x21')](_0x1d04c2);}return _0x4a6679['save']();};}function saveUpdates(_0x15a36b,_0x1c08f4){return function(_0xf6275e){if(_0xf6275e){return _0xf6275e['update'](_0x15a36b)['then'](function(_0xc8358e){return _0xc8358e;});}return null;};}function removeEntity(_0x2f614a,_0x5885bd){return function(_0x551583){if(_0x551583){return _0x551583[_0x04ab('0x22')]()[_0x04ab('0x23')](function(){_0x2f614a[_0x04ab('0x18')](0xcc)[_0x04ab('0x19')]();});}};}function handleEntityNotFound(_0x26bb81,_0xa3838a){return function(_0x21d9b7){if(!_0x21d9b7){_0x26bb81[_0x04ab('0x24')](0x194);}return _0x21d9b7;};}function handleError(_0x222557,_0x5cf1e5){_0x5cf1e5=_0x5cf1e5||0x1f4;return function(_0x86bf80){logger[_0x04ab('0x25')](_0x86bf80[_0x04ab('0x26')]);if(_0x86bf80[_0x04ab('0x27')]){delete _0x86bf80['name'];}_0x222557['status'](_0x5cf1e5)[_0x04ab('0x28')](_0x86bf80);};}exports['index']=function(_0x404eae,_0x30db64){var _0x2e069d={},_0x3c25fb={},_0x12385b={'count':0x0,'rows':[]};var _0x5596fc=_['map'](db[_0x04ab('0x29')][_0x04ab('0x2a')],function(_0x28e77b){return{'name':_0x28e77b[_0x04ab('0x2b')],'type':_0x28e77b[_0x04ab('0x2c')][_0x04ab('0x2d')]};});_0x3c25fb[_0x04ab('0x2e')]=_[_0x04ab('0x2f')](_0x5596fc,_0x04ab('0x27'));_0x3c25fb[_0x04ab('0x30')]=_[_0x04ab('0x31')](_0x404eae[_0x04ab('0x30')]);_0x3c25fb[_0x04ab('0x32')]=_['intersection'](_0x3c25fb[_0x04ab('0x2e')],_0x3c25fb[_0x04ab('0x30')]);_0x2e069d['attributes']=_[_0x04ab('0x33')](_0x3c25fb[_0x04ab('0x2e')],qs['fields'](_0x404eae[_0x04ab('0x30')][_0x04ab('0x34')]));_0x2e069d['attributes']=_0x2e069d[_0x04ab('0x35')][_0x04ab('0x36')]?_0x2e069d[_0x04ab('0x35')]:_0x3c25fb[_0x04ab('0x2e')];if(!_0x404eae[_0x04ab('0x30')][_0x04ab('0x37')]('nolimit')){_0x2e069d[_0x04ab('0x1c')]=qs[_0x04ab('0x1c')](_0x404eae[_0x04ab('0x30')]['limit']);_0x2e069d[_0x04ab('0x1a')]=qs['offset'](_0x404eae['query'][_0x04ab('0x1a')]);}_0x2e069d[_0x04ab('0x38')]=qs['sort'](_0x404eae[_0x04ab('0x30')]['sort']);_0x2e069d[_0x04ab('0x39')]=qs[_0x04ab('0x32')](_[_0x04ab('0x3a')](_0x404eae[_0x04ab('0x30')],_0x3c25fb[_0x04ab('0x32')]),_0x5596fc);if(_0x404eae[_0x04ab('0x30')][_0x04ab('0x3b')]){_0x2e069d[_0x04ab('0x39')]=_[_0x04ab('0x3c')](_0x2e069d[_0x04ab('0x39')],{'$or':_[_0x04ab('0x2f')](_0x5596fc,function(_0x3f145){if(_0x3f145['type']!==_0x04ab('0x3d')){var _0x14756a={};_0x14756a[_0x3f145['name']]={'$like':'%'+_0x404eae['query'][_0x04ab('0x3b')]+'%'};return _0x14756a;}})});}_0x2e069d=_[_0x04ab('0x3c')]({},_0x2e069d,_0x404eae[_0x04ab('0x3e')]);var _0x4327b9={'where':_0x2e069d['where']};return db[_0x04ab('0x29')][_0x04ab('0x1d')](_0x4327b9)[_0x04ab('0x23')](function(_0x244acf){_0x12385b['count']=_0x244acf;if(_0x404eae[_0x04ab('0x30')][_0x04ab('0x3f')]){_0x2e069d[_0x04ab('0x40')]=[{'all':!![]}];}return db[_0x04ab('0x29')][_0x04ab('0x41')](_0x2e069d);})[_0x04ab('0x23')](function(_0x20b8cc){_0x12385b[_0x04ab('0x42')]=_0x20b8cc;return _0x12385b;})['then'](respondWithFilteredResult(_0x30db64,_0x2e069d))['catch'](handleError(_0x30db64,null));};exports[_0x04ab('0x43')]=function(_0x4c8cb0,_0x8a93c2){var _0x46a7c5={'raw':!![],'where':{'id':_0x4c8cb0['params']['id']}},_0x3c27ee={};_0x3c27ee[_0x04ab('0x2e')]=_[_0x04ab('0x31')](db[_0x04ab('0x29')]['rawAttributes']);_0x3c27ee[_0x04ab('0x30')]=_[_0x04ab('0x31')](_0x4c8cb0[_0x04ab('0x30')]);_0x3c27ee[_0x04ab('0x32')]=_[_0x04ab('0x33')](_0x3c27ee[_0x04ab('0x2e')],_0x3c27ee[_0x04ab('0x30')]);_0x46a7c5[_0x04ab('0x35')]=_[_0x04ab('0x33')](_0x3c27ee[_0x04ab('0x2e')],qs['fields'](_0x4c8cb0[_0x04ab('0x30')][_0x04ab('0x34')]));_0x46a7c5[_0x04ab('0x35')]=_0x46a7c5[_0x04ab('0x35')][_0x04ab('0x36')]?_0x46a7c5[_0x04ab('0x35')]:_0x3c27ee['model'];if(_0x4c8cb0[_0x04ab('0x30')][_0x04ab('0x3f')]){_0x46a7c5[_0x04ab('0x40')]=[{'all':!![]}];}_0x46a7c5=_[_0x04ab('0x3c')]({},_0x46a7c5,_0x4c8cb0['options']);return db[_0x04ab('0x29')][_0x04ab('0x44')](_0x46a7c5)[_0x04ab('0x23')](handleEntityNotFound(_0x8a93c2,null))[_0x04ab('0x23')](respondWithResult(_0x8a93c2,null))[_0x04ab('0x45')](handleError(_0x8a93c2,null));};exports['create']=function(_0x326621,_0x15b995){return db['Cdr']['create'](_0x326621[_0x04ab('0x46')],{})[_0x04ab('0x23')](respondWithResult(_0x15b995,0xc9))[_0x04ab('0x45')](handleError(_0x15b995,null));};exports[_0x04ab('0x47')]=function(_0x1c4aa2,_0x3a9056){if(_0x1c4aa2[_0x04ab('0x46')]['id']){delete _0x1c4aa2['body']['id'];}return db[_0x04ab('0x29')][_0x04ab('0x44')]({'where':{'id':_0x1c4aa2[_0x04ab('0x48')]['id']}})['then'](handleEntityNotFound(_0x3a9056,null))[_0x04ab('0x23')](saveUpdates(_0x1c4aa2[_0x04ab('0x46')],null))['then'](respondWithResult(_0x3a9056,null))[_0x04ab('0x45')](handleError(_0x3a9056,null));};exports['destroy']=function(_0xc9db25,_0x4bc4f6){return db[_0x04ab('0x29')]['find']({'where':{'id':_0xc9db25['params']['id']}})[_0x04ab('0x23')](handleEntityNotFound(_0x4bc4f6,null))[_0x04ab('0x23')](removeEntity(_0x4bc4f6,null))[_0x04ab('0x45')](handleError(_0x4bc4f6,null));};exports['describe']=function(_0x53f63a,_0x5ed30e){return db[_0x04ab('0x29')][_0x04ab('0x49')]()['then'](respondWithResult(_0x5ed30e,null))[_0x04ab('0x45')](handleError(_0x5ed30e,null));}; \ No newline at end of file diff --git a/server/api/cdr/cdr.model.js b/server/api/cdr/cdr.model.js index c67193c..464b944 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(_0x36e120,_0x38d115){var _0x5f18e4=function(_0x134d15){while(--_0x134d15){_0x36e120['push'](_0x36e120['shift']());}};_0x5f18e4(++_0x38d115);}(_0x7a54,0x106));var _0x47a5=function(_0x187a5d,_0x400c26){_0x187a5d=_0x187a5d-0x0;var _0x54b6ab=_0x7a54[_0x187a5d];return _0x54b6ab;};'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(_0x3f45fa,_0x2b5e95){var _0x5d7ce7=function(_0x4f818f){while(--_0x4f818f){_0x3f45fa['push'](_0x3f45fa['shift']());}};_0x5d7ce7(++_0x2b5e95);}(_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 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 3d343c3..e3916e4 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 _0xacaa=['rpc','../../config/environment','client','request','then','info','Cdr,\x20%s,\x20%s','request\x20sent','debug','stringify','error','code','message','result','catch','lodash','util','moment','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger'];(function(_0x31c19c,_0xbe4b70){var _0x1a87f7=function(_0x23cf92){while(--_0x23cf92){_0x31c19c['push'](_0x31c19c['shift']());}};_0x1a87f7(++_0xbe4b70);}(_0xacaa,0x168));var _0xaaca=function(_0x126370,_0x27b5cf){_0x126370=_0x126370-0x0;var _0x150a1b=_0xacaa[_0x126370];return _0x150a1b;};'use strict';var _=require(_0xaaca('0x0'));var util=require(_0xaaca('0x1'));var moment=require(_0xaaca('0x2'));var BPromise=require('bluebird');var rs=require(_0xaaca('0x3'));var fs=require('fs');var Redis=require(_0xaaca('0x4'));var db=require(_0xaaca('0x5'))['db'];var utils=require(_0xaaca('0x6'));var logger=require(_0xaaca('0x7'))(_0xaaca('0x8'));var config=require(_0xaaca('0x9'));var jayson=require('jayson/promise');var client=jayson[_0xaaca('0xa')]['http']({'port':0x232a});function respondWithRpcPromise(_0x376f91,_0x1de6fd,_0x3005b4){return new BPromise(function(_0x3b69b6,_0x1f0575){return client[_0xaaca('0xb')](_0x376f91,_0x3005b4)[_0xaaca('0xc')](function(_0xcaa4ab){logger[_0xaaca('0xd')](_0xaaca('0xe'),_0x1de6fd,_0xaaca('0xf'));logger[_0xaaca('0x10')]('Cdr,\x20%s,\x20%s,\x20%s',_0x1de6fd,_0xaaca('0xf'),JSON[_0xaaca('0x11')](_0xcaa4ab));if(_0xcaa4ab[_0xaaca('0x12')]){if(_0xcaa4ab[_0xaaca('0x12')][_0xaaca('0x13')]===0x1f4){logger[_0xaaca('0x12')]('Cdr,\x20%s,\x20%s',_0x1de6fd,_0xcaa4ab[_0xaaca('0x12')][_0xaaca('0x14')]);return _0x1f0575(_0xcaa4ab['error']['message']);}logger[_0xaaca('0x12')]('Cdr,\x20%s,\x20%s',_0x1de6fd,_0xcaa4ab[_0xaaca('0x12')][_0xaaca('0x14')]);return _0x3b69b6(_0xcaa4ab['error'][_0xaaca('0x14')]);}else{logger[_0xaaca('0xd')]('Cdr,\x20%s,\x20%s',_0x1de6fd,_0xaaca('0xf'));_0x3b69b6(_0xcaa4ab[_0xaaca('0x15')][_0xaaca('0x14')]);}})[_0xaaca('0x16')](function(_0x40b7d7){logger[_0xaaca('0x12')](_0xaaca('0xe'),_0x1de6fd,_0x40b7d7);_0x1f0575(_0x40b7d7);});});} \ No newline at end of file +var _0x3949=['stringify','error','code','message','catch','lodash','util','moment','bluebird','randomstring','ioredis','../../config/logger','rpc','../../config/environment','client','http','request','then','info','Cdr,\x20%s,\x20%s','debug','Cdr,\x20%s,\x20%s,\x20%s','request\x20sent'];(function(_0x5a565b,_0x5911e3){var _0x463fbd=function(_0x100453){while(--_0x100453){_0x5a565b['push'](_0x5a565b['shift']());}};_0x463fbd(++_0x5911e3);}(_0x3949,0xeb));var _0x9394=function(_0x87eee5,_0x581852){_0x87eee5=_0x87eee5-0x0;var _0x17e2dc=_0x3949[_0x87eee5];return _0x17e2dc;};'use strict';var _=require(_0x9394('0x0'));var util=require(_0x9394('0x1'));var moment=require(_0x9394('0x2'));var BPromise=require(_0x9394('0x3'));var rs=require(_0x9394('0x4'));var fs=require('fs');var Redis=require(_0x9394('0x5'));var db=require('../../mysqldb')['db'];var utils=require('../../config/utils');var logger=require(_0x9394('0x6'))(_0x9394('0x7'));var config=require(_0x9394('0x8'));var jayson=require('jayson/promise');var client=jayson[_0x9394('0x9')][_0x9394('0xa')]({'port':0x232a});function respondWithRpcPromise(_0x3b3629,_0x17bb5e,_0x535733){return new BPromise(function(_0x3070d5,_0x2577d9){return client[_0x9394('0xb')](_0x3b3629,_0x535733)[_0x9394('0xc')](function(_0x441304){logger[_0x9394('0xd')](_0x9394('0xe'),_0x17bb5e,'request\x20sent');logger[_0x9394('0xf')](_0x9394('0x10'),_0x17bb5e,_0x9394('0x11'),JSON[_0x9394('0x12')](_0x441304));if(_0x441304[_0x9394('0x13')]){if(_0x441304['error'][_0x9394('0x14')]===0x1f4){logger[_0x9394('0x13')](_0x9394('0xe'),_0x17bb5e,_0x441304['error']['message']);return _0x2577d9(_0x441304['error'][_0x9394('0x15')]);}logger['error']('Cdr,\x20%s,\x20%s',_0x17bb5e,_0x441304[_0x9394('0x13')][_0x9394('0x15')]);return _0x3070d5(_0x441304[_0x9394('0x13')][_0x9394('0x15')]);}else{logger[_0x9394('0xd')](_0x9394('0xe'),_0x17bb5e,'request\x20sent');_0x3070d5(_0x441304['result']['message']);}})[_0x9394('0x16')](function(_0x1e506d){logger['error'](_0x9394('0xe'),_0x17bb5e,_0x1e506d);_0x2577d9(_0x1e506d);});});} \ No newline at end of file diff --git a/server/api/cdr/index.js b/server/api/cdr/index.js index 7c62c14..8e5a2db 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(_0x43daa8,_0x2b964e){var _0x42a182=function(_0x16a94b){while(--_0x16a94b){_0x43daa8['push'](_0x43daa8['shift']());}};_0x42a182(++_0x2b964e);}(_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(_0x3815c2,_0x1f54e3){var _0x271f88=function(_0x53963c){while(--_0x53963c){_0x3815c2['push'](_0x3815c2['shift']());}};_0x271f88(++_0x1f54e3);}(_0xa9e0,0x123));var _0x0a9e=function(_0x34bf97,_0xc60f9d){_0x34bf97=_0x34bf97-0x0;var _0x292719=_0xa9e0[_0x34bf97];return _0x292719;};'use strict';var multer=require(_0x0a9e('0x0'));var util=require(_0x0a9e('0x1'));var path=require(_0x0a9e('0x2'));var timeout=require('connect-timeout');var express=require('express');var router=express[_0x0a9e('0x3')]();var fs_extra=require('fs-extra');var auth=require(_0x0a9e('0x4'));var interaction=require(_0x0a9e('0x5'));var config=require(_0x0a9e('0x6'));var controller=require(_0x0a9e('0x7'));router[_0x0a9e('0x8')]('/',auth['isAuthenticated'](),controller[_0x0a9e('0x9')]);router[_0x0a9e('0x8')](_0x0a9e('0xa'),auth['isAuthenticated'](),controller['describe']);router[_0x0a9e('0x8')]('/:id',auth['isAuthenticated'](),controller[_0x0a9e('0xb')]);router[_0x0a9e('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 6490be6..1913527 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 _0x93fd=['sequelize','exports','STRING','noop','TEXT','*,*,*,*'];(function(_0x5a57f1,_0x4e4ab2){var _0x3addbc=function(_0x416357){while(--_0x416357){_0x5a57f1['push'](_0x5a57f1['shift']());}};_0x3addbc(++_0x4e4ab2);}(_0x93fd,0x8a));var _0xd93f=function(_0x3bf83f,_0x181cac){_0x3bf83f=_0x3bf83f-0x0;var _0x22c4a9=_0x93fd[_0x3bf83f];return _0x22c4a9;};'use strict';var Sequelize=require(_0xd93f('0x0'));module[_0xd93f('0x1')]={'priority':{'type':Sequelize['INTEGER'],'allowNull':![]},'app':{'type':Sequelize[_0xd93f('0x2')],'allowNull':![],'defaultValue':_0xd93f('0x3')},'appdata':{'type':Sequelize[_0xd93f('0x4')]()},'description':{'type':Sequelize[_0xd93f('0x2')]},'interval':{'type':Sequelize[_0xd93f('0x2')],'defaultValue':_0xd93f('0x5')}}; \ No newline at end of file +var _0x2da3=['noop','*,*,*,*','sequelize','exports','INTEGER','STRING'];(function(_0x523bda,_0x575acb){var _0x58d94f=function(_0x12d0e6){while(--_0x12d0e6){_0x523bda['push'](_0x523bda['shift']());}};_0x58d94f(++_0x575acb);}(_0x2da3,0x18e));var _0x32da=function(_0x3607ee,_0xe853c5){_0x3607ee=_0x3607ee-0x0;var _0x2345fb=_0x2da3[_0x3607ee];return _0x2345fb;};'use strict';var Sequelize=require(_0x32da('0x0'));module[_0x32da('0x1')]={'priority':{'type':Sequelize[_0x32da('0x2')],'allowNull':![]},'app':{'type':Sequelize[_0x32da('0x3')],'allowNull':![],'defaultValue':_0x32da('0x4')},'appdata':{'type':Sequelize['TEXT']()},'description':{'type':Sequelize[_0x32da('0x3')]},'interval':{'type':Sequelize[_0x32da('0x3')],'defaultValue':_0x32da('0x5')}}; \ No newline at end of file diff --git a/server/api/chatApplication/chatApplication.controller.js b/server/api/chatApplication/chatApplication.controller.js index 22acb74..4c43f5a 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 _0x3fb7=['status','end','json','limit','undefined','count','offset','Content-Range','apply','save','then','destroy','error','stack','name','show','params','model','keys','rawAttributes','query','filters','intersection','attributes','fields','length','include','merge','options','ChatApplication','find','catch','body','rimraf','fast-json-patch','request-promise','bluebird','util','path','sox','to-csv','ejs','fs-extra','lodash','squel','crypto','jsforce','desk.js','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/license/util','sendStatus'];(function(_0x412817,_0x2b2f21){var _0x1a5083=function(_0x5672ba){while(--_0x5672ba){_0x412817['push'](_0x412817['shift']());}};_0x1a5083(++_0x2b2f21);}(_0x3fb7,0x189));var _0x73fb=function(_0x407285,_0x7b36ba){_0x407285=_0x407285-0x0;var _0x391a04=_0x3fb7[_0x407285];return _0x391a04;};'use strict';var emlformat=require('eml-format');var rimraf=require(_0x73fb('0x0'));var zipdir=require('zip-dir');var jsonpatch=require(_0x73fb('0x1'));var rp=require(_0x73fb('0x2'));var moment=require('moment');var BPromise=require(_0x73fb('0x3'));var Mustache=require('mustache');var util=require(_0x73fb('0x4'));var path=require(_0x73fb('0x5'));var sox=require(_0x73fb('0x6'));var csv=require(_0x73fb('0x7'));var ejs=require(_0x73fb('0x8'));var fs=require('fs');var fs_extra=require(_0x73fb('0x9'));var _=require(_0x73fb('0xa'));var squel=require(_0x73fb('0xb'));var crypto=require(_0x73fb('0xc'));var jsforce=require(_0x73fb('0xd'));var deskjs=require(_0x73fb('0xe'));var toCsv=require(_0x73fb('0x7'));var querystring=require(_0x73fb('0xf'));var Papa=require(_0x73fb('0x10'));var Redis=require(_0x73fb('0x11'));var authService=require(_0x73fb('0x12'));var qs=require(_0x73fb('0x13'));var as=require(_0x73fb('0x14'));var hardwareService=require(_0x73fb('0x15'));var logger=require(_0x73fb('0x16'))(_0x73fb('0x17'));var utils=require(_0x73fb('0x18'));var config=require('../../config/environment');var licenseUtil=require(_0x73fb('0x19'));var db=require('../../mysqldb')['db'];function respondWithStatusCode(_0x3fc7ac,_0x1f7626){_0x1f7626=_0x1f7626||0xcc;return function(_0x45c502){if(_0x45c502){return _0x3fc7ac[_0x73fb('0x1a')](_0x1f7626);}return _0x3fc7ac[_0x73fb('0x1b')](_0x1f7626)[_0x73fb('0x1c')]();};}function respondWithResult(_0x394ac5,_0x10d931){_0x10d931=_0x10d931||0xc8;return function(_0x743f1a){if(_0x743f1a){return _0x394ac5[_0x73fb('0x1b')](_0x10d931)[_0x73fb('0x1d')](_0x743f1a);}};}function respondWithFilteredResult(_0xa0b4dd,_0x2161ac){return function(_0x4986c3){if(_0x4986c3){var _0x1f679b=typeof _0x2161ac['offset']==='undefined'&&typeof _0x2161ac[_0x73fb('0x1e')]===_0x73fb('0x1f');var _0x4f4dda=_0x4986c3[_0x73fb('0x20')];var _0x1c9fa3=_0x1f679b?0x0:_0x2161ac[_0x73fb('0x21')];var _0x3ea9dd=_0x1f679b?_0x4986c3['count']:_0x2161ac['offset']+_0x2161ac[_0x73fb('0x1e')];var _0x460ae9;if(_0x3ea9dd>=_0x4f4dda){_0x3ea9dd=_0x4f4dda;_0x460ae9=0xc8;}else{_0x460ae9=0xce;}_0xa0b4dd[_0x73fb('0x1b')](_0x460ae9);return _0xa0b4dd['set'](_0x73fb('0x22'),_0x1c9fa3+'-'+_0x3ea9dd+'/'+_0x4f4dda)[_0x73fb('0x1d')](_0x4986c3);}return null;};}function patchUpdates(_0x25b409){return function(_0x41b334){try{jsonpatch[_0x73fb('0x23')](_0x41b334,_0x25b409,!![]);}catch(_0x204abf){return BPromise['reject'](_0x204abf);}return _0x41b334[_0x73fb('0x24')]();};}function saveUpdates(_0x474aaa,_0x2ff0f3){return function(_0x4d9d9c){if(_0x4d9d9c){return _0x4d9d9c['update'](_0x474aaa)[_0x73fb('0x25')](function(_0x2ae708){return _0x2ae708;});}return null;};}function removeEntity(_0x5486ff,_0x26b839){return function(_0x12c139){if(_0x12c139){return _0x12c139[_0x73fb('0x26')]()[_0x73fb('0x25')](function(){_0x5486ff[_0x73fb('0x1b')](0xcc)[_0x73fb('0x1c')]();});}};}function handleEntityNotFound(_0x801c4d,_0x222b87){return function(_0x3d213f){if(!_0x3d213f){_0x801c4d['sendStatus'](0x194);}return _0x3d213f;};}function handleError(_0x4a9ba2,_0x405e36){_0x405e36=_0x405e36||0x1f4;return function(_0x30b88){logger[_0x73fb('0x27')](_0x30b88[_0x73fb('0x28')]);if(_0x30b88[_0x73fb('0x29')]){delete _0x30b88[_0x73fb('0x29')];}_0x4a9ba2[_0x73fb('0x1b')](_0x405e36)['send'](_0x30b88);};}exports[_0x73fb('0x2a')]=function(_0x281449,_0x1bba66){var _0x46034e={'raw':!![],'where':{'id':_0x281449[_0x73fb('0x2b')]['id']}},_0x23d6c0={};_0x23d6c0[_0x73fb('0x2c')]=_[_0x73fb('0x2d')](db['ChatApplication'][_0x73fb('0x2e')]);_0x23d6c0[_0x73fb('0x2f')]=_['keys'](_0x281449['query']);_0x23d6c0[_0x73fb('0x30')]=_[_0x73fb('0x31')](_0x23d6c0[_0x73fb('0x2c')],_0x23d6c0[_0x73fb('0x2f')]);_0x46034e[_0x73fb('0x32')]=_['intersection'](_0x23d6c0[_0x73fb('0x2c')],qs[_0x73fb('0x33')](_0x281449[_0x73fb('0x2f')][_0x73fb('0x33')]));_0x46034e[_0x73fb('0x32')]=_0x46034e[_0x73fb('0x32')][_0x73fb('0x34')]?_0x46034e[_0x73fb('0x32')]:_0x23d6c0[_0x73fb('0x2c')];if(_0x281449[_0x73fb('0x2f')]['includeAll']){_0x46034e[_0x73fb('0x35')]=[{'all':!![]}];}_0x46034e=_[_0x73fb('0x36')]({},_0x46034e,_0x281449[_0x73fb('0x37')]);return db[_0x73fb('0x38')][_0x73fb('0x39')](_0x46034e)['then'](handleEntityNotFound(_0x1bba66,null))[_0x73fb('0x25')](respondWithResult(_0x1bba66,null))[_0x73fb('0x3a')](handleError(_0x1bba66,null));};exports['update']=function(_0x41e3fc,_0x512db5){if(_0x41e3fc[_0x73fb('0x3b')]['id']){delete _0x41e3fc['body']['id'];}return db['ChatApplication'][_0x73fb('0x39')]({'where':{'id':_0x41e3fc[_0x73fb('0x2b')]['id']}})[_0x73fb('0x25')](handleEntityNotFound(_0x512db5,null))['then'](saveUpdates(_0x41e3fc[_0x73fb('0x3b')],null))[_0x73fb('0x25')](respondWithResult(_0x512db5,null))[_0x73fb('0x3a')](handleError(_0x512db5,null));};exports[_0x73fb('0x26')]=function(_0x3901a9,_0x787d37){return db['ChatApplication']['find']({'where':{'id':_0x3901a9[_0x73fb('0x2b')]['id']}})[_0x73fb('0x25')](handleEntityNotFound(_0x787d37,null))[_0x73fb('0x25')](removeEntity(_0x787d37,null))[_0x73fb('0x3a')](handleError(_0x787d37,null));}; \ No newline at end of file +var _0x9b87=['stack','name','send','show','params','keys','rawAttributes','query','filters','intersection','model','fields','attributes','includeAll','include','options','ChatApplication','find','catch','body','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','moment','bluebird','mustache','util','path','sox','to-csv','ejs','fs-extra','lodash','squel','querystring','papaparse','ioredis','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','sendStatus','status','end','offset','undefined','count','set','Content-Range','json','apply','reject','update','then','destroy','error'];(function(_0x38d8a1,_0x56ee95){var _0x43a68c=function(_0x1abce6){while(--_0x1abce6){_0x38d8a1['push'](_0x38d8a1['shift']());}};_0x43a68c(++_0x56ee95);}(_0x9b87,0x8e));var _0x79b8=function(_0x4c0a6b,_0x462e60){_0x4c0a6b=_0x4c0a6b-0x0;var _0x59b05e=_0x9b87[_0x4c0a6b];return _0x59b05e;};'use strict';var emlformat=require(_0x79b8('0x0'));var rimraf=require(_0x79b8('0x1'));var zipdir=require(_0x79b8('0x2'));var jsonpatch=require(_0x79b8('0x3'));var rp=require(_0x79b8('0x4'));var moment=require(_0x79b8('0x5'));var BPromise=require(_0x79b8('0x6'));var Mustache=require(_0x79b8('0x7'));var util=require(_0x79b8('0x8'));var path=require(_0x79b8('0x9'));var sox=require(_0x79b8('0xa'));var csv=require(_0x79b8('0xb'));var ejs=require(_0x79b8('0xc'));var fs=require('fs');var fs_extra=require(_0x79b8('0xd'));var _=require(_0x79b8('0xe'));var squel=require(_0x79b8('0xf'));var crypto=require('crypto');var jsforce=require('jsforce');var deskjs=require('desk.js');var toCsv=require('to-csv');var querystring=require(_0x79b8('0x10'));var Papa=require(_0x79b8('0x11'));var Redis=require(_0x79b8('0x12'));var authService=require('../../components/auth/service');var qs=require(_0x79b8('0x13'));var as=require(_0x79b8('0x14'));var hardwareService=require(_0x79b8('0x15'));var logger=require('../../config/logger')('api');var utils=require(_0x79b8('0x16'));var config=require(_0x79b8('0x17'));var licenseUtil=require(_0x79b8('0x18'));var db=require(_0x79b8('0x19'))['db'];function respondWithStatusCode(_0x21ad20,_0x33227b){_0x33227b=_0x33227b||0xcc;return function(_0x41095c){if(_0x41095c){return _0x21ad20[_0x79b8('0x1a')](_0x33227b);}return _0x21ad20[_0x79b8('0x1b')](_0x33227b)[_0x79b8('0x1c')]();};}function respondWithResult(_0x43ec09,_0x59e229){_0x59e229=_0x59e229||0xc8;return function(_0x150fb7){if(_0x150fb7){return _0x43ec09['status'](_0x59e229)['json'](_0x150fb7);}};}function respondWithFilteredResult(_0x3142e9,_0x21aae0){return function(_0x57a248){if(_0x57a248){var _0x5ddab5=typeof _0x21aae0[_0x79b8('0x1d')]==='undefined'&&typeof _0x21aae0['limit']===_0x79b8('0x1e');var _0x24c02f=_0x57a248[_0x79b8('0x1f')];var _0x2ae2d5=_0x5ddab5?0x0:_0x21aae0[_0x79b8('0x1d')];var _0x23d771=_0x5ddab5?_0x57a248['count']:_0x21aae0[_0x79b8('0x1d')]+_0x21aae0['limit'];var _0x53d386;if(_0x23d771>=_0x24c02f){_0x23d771=_0x24c02f;_0x53d386=0xc8;}else{_0x53d386=0xce;}_0x3142e9[_0x79b8('0x1b')](_0x53d386);return _0x3142e9[_0x79b8('0x20')](_0x79b8('0x21'),_0x2ae2d5+'-'+_0x23d771+'/'+_0x24c02f)[_0x79b8('0x22')](_0x57a248);}return null;};}function patchUpdates(_0x1e24cf){return function(_0x1e7507){try{jsonpatch[_0x79b8('0x23')](_0x1e7507,_0x1e24cf,!![]);}catch(_0x261c48){return BPromise[_0x79b8('0x24')](_0x261c48);}return _0x1e7507['save']();};}function saveUpdates(_0x3e9d83,_0x255207){return function(_0x4dbfcf){if(_0x4dbfcf){return _0x4dbfcf[_0x79b8('0x25')](_0x3e9d83)[_0x79b8('0x26')](function(_0x54c605){return _0x54c605;});}return null;};}function removeEntity(_0x28be4b,_0x4f543f){return function(_0x5e8228){if(_0x5e8228){return _0x5e8228[_0x79b8('0x27')]()[_0x79b8('0x26')](function(){_0x28be4b[_0x79b8('0x1b')](0xcc)[_0x79b8('0x1c')]();});}};}function handleEntityNotFound(_0x9deb6c,_0x4cd38b){return function(_0x35db24){if(!_0x35db24){_0x9deb6c[_0x79b8('0x1a')](0x194);}return _0x35db24;};}function handleError(_0x1e84f3,_0x3ba5ac){_0x3ba5ac=_0x3ba5ac||0x1f4;return function(_0x4bbbf8){logger[_0x79b8('0x28')](_0x4bbbf8[_0x79b8('0x29')]);if(_0x4bbbf8[_0x79b8('0x2a')]){delete _0x4bbbf8['name'];}_0x1e84f3[_0x79b8('0x1b')](_0x3ba5ac)[_0x79b8('0x2b')](_0x4bbbf8);};}exports[_0x79b8('0x2c')]=function(_0x2942e9,_0x3662aa){var _0x23483f={'raw':!![],'where':{'id':_0x2942e9[_0x79b8('0x2d')]['id']}},_0x4f51d1={};_0x4f51d1['model']=_[_0x79b8('0x2e')](db['ChatApplication'][_0x79b8('0x2f')]);_0x4f51d1[_0x79b8('0x30')]=_[_0x79b8('0x2e')](_0x2942e9['query']);_0x4f51d1[_0x79b8('0x31')]=_[_0x79b8('0x32')](_0x4f51d1[_0x79b8('0x33')],_0x4f51d1[_0x79b8('0x30')]);_0x23483f['attributes']=_[_0x79b8('0x32')](_0x4f51d1['model'],qs['fields'](_0x2942e9[_0x79b8('0x30')][_0x79b8('0x34')]));_0x23483f['attributes']=_0x23483f[_0x79b8('0x35')]['length']?_0x23483f['attributes']:_0x4f51d1[_0x79b8('0x33')];if(_0x2942e9['query'][_0x79b8('0x36')]){_0x23483f[_0x79b8('0x37')]=[{'all':!![]}];}_0x23483f=_['merge']({},_0x23483f,_0x2942e9[_0x79b8('0x38')]);return db[_0x79b8('0x39')][_0x79b8('0x3a')](_0x23483f)[_0x79b8('0x26')](handleEntityNotFound(_0x3662aa,null))[_0x79b8('0x26')](respondWithResult(_0x3662aa,null))[_0x79b8('0x3b')](handleError(_0x3662aa,null));};exports['update']=function(_0x2ed1a3,_0x28b32b){if(_0x2ed1a3[_0x79b8('0x3c')]['id']){delete _0x2ed1a3[_0x79b8('0x3c')]['id'];}return db[_0x79b8('0x39')][_0x79b8('0x3a')]({'where':{'id':_0x2ed1a3[_0x79b8('0x2d')]['id']}})[_0x79b8('0x26')](handleEntityNotFound(_0x28b32b,null))[_0x79b8('0x26')](saveUpdates(_0x2ed1a3[_0x79b8('0x3c')],null))[_0x79b8('0x26')](respondWithResult(_0x28b32b,null))['catch'](handleError(_0x28b32b,null));};exports[_0x79b8('0x27')]=function(_0x9de99,_0x1cbfbf){return db['ChatApplication'][_0x79b8('0x3a')]({'where':{'id':_0x9de99[_0x79b8('0x2d')]['id']}})[_0x79b8('0x26')](handleEntityNotFound(_0x1cbfbf,null))[_0x79b8('0x26')](removeEntity(_0x1cbfbf,null))[_0x79b8('0x3b')](handleError(_0x1cbfbf,null));}; \ No newline at end of file diff --git a/server/api/chatApplication/chatApplication.model.js b/server/api/chatApplication/chatApplication.model.js index 8061617..a151563 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 _0xd5bb=['../../config/environment','./chatApplication.attributes','exports','ChatApplication','chat_applications','utf8mb4','utf8mb4_unicode_ci','../../config/logger','moment','bluebird','request-promise','path'];(function(_0x7d9c0d,_0x165295){var _0x26a3c7=function(_0x493af9){while(--_0x493af9){_0x7d9c0d['push'](_0x7d9c0d['shift']());}};_0x26a3c7(++_0x165295);}(_0xd5bb,0x73));var _0xbd5b=function(_0x3e992f,_0x1210b7){_0x3e992f=_0x3e992f-0x0;var _0x3f19d1=_0xd5bb[_0x3e992f];return _0x3f19d1;};'use strict';var _=require('lodash');var util=require('util');var logger=require(_0xbd5b('0x0'))('api');var moment=require(_0xbd5b('0x1'));var BPromise=require(_0xbd5b('0x2'));var rp=require(_0xbd5b('0x3'));var fs=require('fs');var path=require(_0xbd5b('0x4'));var rimraf=require('rimraf');var config=require(_0xbd5b('0x5'));var attributes=require(_0xbd5b('0x6'));module[_0xbd5b('0x7')]=function(_0x250576,_0x5dff33){return _0x250576['define'](_0xbd5b('0x8'),attributes,{'tableName':_0xbd5b('0x9'),'paranoid':![],'indexes':[],'timestamps':!![],'charset':_0xbd5b('0xa'),'collate':_0xbd5b('0xb')});}; \ No newline at end of file +var _0xe751=['bluebird','rimraf','./chatApplication.attributes','exports','ChatApplication','chat_applications','utf8mb4','lodash','util','../../config/logger','api','moment'];(function(_0x88cd7b,_0x4c884c){var _0x56fcc8=function(_0x513b3d){while(--_0x513b3d){_0x88cd7b['push'](_0x88cd7b['shift']());}};_0x56fcc8(++_0x4c884c);}(_0xe751,0xf7));var _0x1e75=function(_0x9d3016,_0x420ccb){_0x9d3016=_0x9d3016-0x0;var _0x2a8f8d=_0xe751[_0x9d3016];return _0x2a8f8d;};'use strict';var _=require(_0x1e75('0x0'));var util=require(_0x1e75('0x1'));var logger=require(_0x1e75('0x2'))(_0x1e75('0x3'));var moment=require(_0x1e75('0x4'));var BPromise=require(_0x1e75('0x5'));var rp=require('request-promise');var fs=require('fs');var path=require('path');var rimraf=require(_0x1e75('0x6'));var config=require('../../config/environment');var attributes=require(_0x1e75('0x7'));module[_0x1e75('0x8')]=function(_0x30e379,_0x4043a1){return _0x30e379['define'](_0x1e75('0x9'),attributes,{'tableName':_0x1e75('0xa'),'paranoid':![],'indexes':[],'timestamps':!![],'charset':_0x1e75('0xb'),'collate':'utf8mb4_unicode_ci'});}; \ No newline at end of file diff --git a/server/api/chatApplication/chatApplication.rpc.js b/server/api/chatApplication/chatApplication.rpc.js index 36efad7..2e097c8 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 _0x3424=['request','then','ChatApplication,\x20%s,\x20%s','debug','ChatApplication,\x20%s,\x20%s,\x20%s','request\x20sent','stringify','error','message','info','result','lodash','util','moment','randomstring','ioredis','../../config/utils','../../config/environment','jayson/promise','client'];(function(_0xe5b349,_0x5f06e4){var _0x26b0ad=function(_0x1a97f1){while(--_0x1a97f1){_0xe5b349['push'](_0xe5b349['shift']());}};_0x26b0ad(++_0x5f06e4);}(_0x3424,0x15f));var _0x4342=function(_0x460087,_0x51d2c0){_0x460087=_0x460087-0x0;var _0x1f60f3=_0x3424[_0x460087];return _0x1f60f3;};'use strict';var _=require(_0x4342('0x0'));var util=require(_0x4342('0x1'));var moment=require(_0x4342('0x2'));var BPromise=require('bluebird');var rs=require(_0x4342('0x3'));var fs=require('fs');var Redis=require(_0x4342('0x4'));var db=require('../../mysqldb')['db'];var utils=require(_0x4342('0x5'));var logger=require('../../config/logger')('rpc');var config=require(_0x4342('0x6'));var jayson=require(_0x4342('0x7'));var client=jayson[_0x4342('0x8')]['http']({'port':0x232a});function respondWithRpcPromise(_0x44d6f0,_0x55943a,_0x2d7ac6){return new BPromise(function(_0x13cd6f,_0x4afa48){return client[_0x4342('0x9')](_0x44d6f0,_0x2d7ac6)[_0x4342('0xa')](function(_0x555f5a){logger['info'](_0x4342('0xb'),_0x55943a,'request\x20sent');logger[_0x4342('0xc')](_0x4342('0xd'),_0x55943a,_0x4342('0xe'),JSON[_0x4342('0xf')](_0x555f5a));if(_0x555f5a[_0x4342('0x10')]){if(_0x555f5a[_0x4342('0x10')]['code']===0x1f4){logger[_0x4342('0x10')](_0x4342('0xb'),_0x55943a,_0x555f5a['error'][_0x4342('0x11')]);return _0x4afa48(_0x555f5a['error'][_0x4342('0x11')]);}logger[_0x4342('0x10')](_0x4342('0xb'),_0x55943a,_0x555f5a['error'][_0x4342('0x11')]);return _0x13cd6f(_0x555f5a[_0x4342('0x10')][_0x4342('0x11')]);}else{logger[_0x4342('0x12')](_0x4342('0xb'),_0x55943a,'request\x20sent');_0x13cd6f(_0x555f5a[_0x4342('0x13')][_0x4342('0x11')]);}})['catch'](function(_0x59028a){logger[_0x4342('0x10')](_0x4342('0xb'),_0x55943a,_0x59028a);_0x4afa48(_0x59028a);});});} \ No newline at end of file +var _0xb25c=['stringify','error','code','message','result','catch','lodash','util','bluebird','ioredis','../../mysqldb','../../config/utils','../../config/environment','jayson/promise','client','info','ChatApplication,\x20%s,\x20%s','debug','request\x20sent'];(function(_0x3db1c6,_0x2ae508){var _0x4e2d2d=function(_0x224c4c){while(--_0x224c4c){_0x3db1c6['push'](_0x3db1c6['shift']());}};_0x4e2d2d(++_0x2ae508);}(_0xb25c,0x195));var _0xcb25=function(_0x2d40e0,_0x39e1f6){_0x2d40e0=_0x2d40e0-0x0;var _0x45d674=_0xb25c[_0x2d40e0];return _0x45d674;};'use strict';var _=require(_0xcb25('0x0'));var util=require(_0xcb25('0x1'));var moment=require('moment');var BPromise=require(_0xcb25('0x2'));var rs=require('randomstring');var fs=require('fs');var Redis=require(_0xcb25('0x3'));var db=require(_0xcb25('0x4'))['db'];var utils=require(_0xcb25('0x5'));var logger=require('../../config/logger')('rpc');var config=require(_0xcb25('0x6'));var jayson=require(_0xcb25('0x7'));var client=jayson[_0xcb25('0x8')]['http']({'port':0x232a});function respondWithRpcPromise(_0x3ce09b,_0x37ce6a,_0x56819c){return new BPromise(function(_0x3ed256,_0x3b8a13){return client['request'](_0x3ce09b,_0x56819c)['then'](function(_0x2af061){logger[_0xcb25('0x9')](_0xcb25('0xa'),_0x37ce6a,'request\x20sent');logger[_0xcb25('0xb')]('ChatApplication,\x20%s,\x20%s,\x20%s',_0x37ce6a,_0xcb25('0xc'),JSON[_0xcb25('0xd')](_0x2af061));if(_0x2af061['error']){if(_0x2af061[_0xcb25('0xe')][_0xcb25('0xf')]===0x1f4){logger[_0xcb25('0xe')](_0xcb25('0xa'),_0x37ce6a,_0x2af061[_0xcb25('0xe')]['message']);return _0x3b8a13(_0x2af061[_0xcb25('0xe')][_0xcb25('0x10')]);}logger[_0xcb25('0xe')]('ChatApplication,\x20%s,\x20%s',_0x37ce6a,_0x2af061[_0xcb25('0xe')][_0xcb25('0x10')]);return _0x3ed256(_0x2af061[_0xcb25('0xe')][_0xcb25('0x10')]);}else{logger['info'](_0xcb25('0xa'),_0x37ce6a,_0xcb25('0xc'));_0x3ed256(_0x2af061[_0xcb25('0x11')][_0xcb25('0x10')]);}})[_0xcb25('0x12')](function(_0x1911e1){logger[_0xcb25('0xe')](_0xcb25('0xa'),_0x37ce6a,_0x1911e1);_0x3b8a13(_0x1911e1);});});} \ No newline at end of file diff --git a/server/api/chatApplication/index.js b/server/api/chatApplication/index.js index 954d99e..2d81fec 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 _0x26f8=['isAuthenticated','show','put','/:id','update','exports','multer','util','path','express','fs-extra','../../components/auth/service','../../components/interaction/service','./chatApplication.controller','get'];(function(_0xb97608,_0x1cc35f){var _0x4e0ac0=function(_0x2b6644){while(--_0x2b6644){_0xb97608['push'](_0xb97608['shift']());}};_0x4e0ac0(++_0x1cc35f);}(_0x26f8,0xba));var _0x826f=function(_0x50e001,_0x45aa55){_0x50e001=_0x50e001-0x0;var _0x3fe4a2=_0x26f8[_0x50e001];return _0x3fe4a2;};'use strict';var multer=require(_0x826f('0x0'));var util=require(_0x826f('0x1'));var path=require(_0x826f('0x2'));var timeout=require('connect-timeout');var express=require(_0x826f('0x3'));var router=express['Router']();var fs_extra=require(_0x826f('0x4'));var auth=require(_0x826f('0x5'));var interaction=require(_0x826f('0x6'));var config=require('../../config/environment');var controller=require(_0x826f('0x7'));router[_0x826f('0x8')]('/:id',auth[_0x826f('0x9')](),controller[_0x826f('0xa')]);router[_0x826f('0xb')](_0x826f('0xc'),auth['isAuthenticated'](),controller[_0x826f('0xd')]);router['delete'](_0x826f('0xc'),auth[_0x826f('0x9')](),controller['destroy']);module[_0x826f('0xe')]=router; \ No newline at end of file +var _0x4c66=['util','express','Router','../../components/auth/service','../../components/interaction/service','../../config/environment','./chatApplication.controller','/:id','show','put','isAuthenticated','update','delete','destroy','multer'];(function(_0x3de064,_0x417806){var _0x556949=function(_0x317039){while(--_0x317039){_0x3de064['push'](_0x3de064['shift']());}};_0x556949(++_0x417806);}(_0x4c66,0xd1));var _0x64c6=function(_0x5ee996,_0x2af8f9){_0x5ee996=_0x5ee996-0x0;var _0x381d63=_0x4c66[_0x5ee996];return _0x381d63;};'use strict';var multer=require(_0x64c6('0x0'));var util=require(_0x64c6('0x1'));var path=require('path');var timeout=require('connect-timeout');var express=require(_0x64c6('0x2'));var router=express[_0x64c6('0x3')]();var fs_extra=require('fs-extra');var auth=require(_0x64c6('0x4'));var interaction=require(_0x64c6('0x5'));var config=require(_0x64c6('0x6'));var controller=require(_0x64c6('0x7'));router['get'](_0x64c6('0x8'),auth['isAuthenticated'](),controller[_0x64c6('0x9')]);router[_0x64c6('0xa')](_0x64c6('0x8'),auth[_0x64c6('0xb')](),controller[_0x64c6('0xc')]);router[_0x64c6('0xd')]('/:id',auth[_0x64c6('0xb')](),controller[_0x64c6('0xe')]);module['exports']=router; \ No newline at end of file diff --git a/server/api/chatGroup/chatGroup.attributes.js b/server/api/chatGroup/chatGroup.attributes.js index f8a63a6..c7d7f7e 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 _0x3308=['sequelize','exports','STRING','BOOLEAN'];(function(_0x2be8c2,_0x14a4b5){var _0x97f531=function(_0xcee58d){while(--_0xcee58d){_0x2be8c2['push'](_0x2be8c2['shift']());}};_0x97f531(++_0x14a4b5);}(_0x3308,0x17c));var _0x8330=function(_0x5bf996,_0x4c90bf){_0x5bf996=_0x5bf996-0x0;var _0x564696=_0x3308[_0x5bf996];return _0x564696;};'use strict';var Sequelize=require(_0x8330('0x0'));module[_0x8330('0x1')]={'name':{'type':Sequelize[_0x8330('0x2')],'allowNull':![]},'description':{'type':Sequelize['STRING']},'write':{'type':Sequelize[_0x8330('0x3')],'defaultValue':!![]}}; \ No newline at end of file +var _0x7b84=['sequelize','exports','STRING','BOOLEAN'];(function(_0xb0f7c3,_0x4eae95){var _0x28ea68=function(_0x4395a7){while(--_0x4395a7){_0xb0f7c3['push'](_0xb0f7c3['shift']());}};_0x28ea68(++_0x4eae95);}(_0x7b84,0x17c));var _0x47b8=function(_0x68a81d,_0x1fc934){_0x68a81d=_0x68a81d-0x0;var _0x4109cc=_0x7b84[_0x68a81d];return _0x4109cc;};'use strict';var Sequelize=require(_0x47b8('0x0'));module[_0x47b8('0x1')]={'name':{'type':Sequelize[_0x47b8('0x2')],'allowNull':![]},'description':{'type':Sequelize[_0x47b8('0x2')]},'write':{'type':Sequelize[_0x47b8('0x3')],'defaultValue':!![]}}; \ No newline at end of file diff --git a/server/api/chatGroup/chatGroup.controller.js b/server/api/chatGroup/chatGroup.controller.js index dd11311..78695ed 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 _0xce7b=['crypto','jsforce','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','redis','defaults','localhost','socket.io-emitter','./chatGroup.socket','status','end','json','offset','undefined','limit','count','Content-Range','apply','save','update','destroy','then','sendStatus','error','stack','name','send','index','rawAttributes','type','key','model','map','query','keys','intersection','fields','attributes','length','hasOwnProperty','nolimit','order','sort','pick','filter','merge','where','VIRTUAL','options','ChatGroup','include','rows','show','params','includeAll','catch','create','body','find','describe','getUnread','ChatInternalMessage','user','toInteger','addMembers','omit','ids','findOne','User','filters','getMembers','removeMembers','addMessage','ChatGroupId','getMessages','$gte','split','format','YYYY-MM-DD\x20HH:mm:ss','eml-format','zip-dir','fast-json-patch','request-promise','moment','bluebird','mustache','util','path','sox','ejs','fs-extra','lodash'];(function(_0x17d9e3,_0x1f969c){var _0x14192d=function(_0x159745){while(--_0x159745){_0x17d9e3['push'](_0x17d9e3['shift']());}};_0x14192d(++_0x1f969c);}(_0xce7b,0x18f));var _0xbce7=function(_0x11087e,_0x18f738){_0x11087e=_0x11087e-0x0;var _0x1ea4c0=_0xce7b[_0x11087e];return _0x1ea4c0;};'use strict';var emlformat=require(_0xbce7('0x0'));var rimraf=require('rimraf');var zipdir=require(_0xbce7('0x1'));var jsonpatch=require(_0xbce7('0x2'));var rp=require(_0xbce7('0x3'));var moment=require(_0xbce7('0x4'));var BPromise=require(_0xbce7('0x5'));var Mustache=require(_0xbce7('0x6'));var util=require(_0xbce7('0x7'));var path=require(_0xbce7('0x8'));var sox=require(_0xbce7('0x9'));var csv=require('to-csv');var ejs=require(_0xbce7('0xa'));var fs=require('fs');var fs_extra=require(_0xbce7('0xb'));var _=require(_0xbce7('0xc'));var squel=require('squel');var crypto=require(_0xbce7('0xd'));var jsforce=require(_0xbce7('0xe'));var deskjs=require('desk.js');var toCsv=require(_0xbce7('0xf'));var querystring=require(_0xbce7('0x10'));var Papa=require(_0xbce7('0x11'));var Redis=require(_0xbce7('0x12'));var authService=require(_0xbce7('0x13'));var qs=require('../../components/parsers/qs');var as=require(_0xbce7('0x14'));var hardwareService=require(_0xbce7('0x15'));var logger=require(_0xbce7('0x16'))(_0xbce7('0x17'));var utils=require(_0xbce7('0x18'));var config=require(_0xbce7('0x19'));var licenseUtil=require(_0xbce7('0x1a'));var db=require(_0xbce7('0x1b'))['db'];config[_0xbce7('0x1c')]=_[_0xbce7('0x1d')](config[_0xbce7('0x1c')],{'host':_0xbce7('0x1e'),'port':0x18eb});var socket=require(_0xbce7('0x1f'))(new Redis(config['redis']));require(_0xbce7('0x20'))['register'](socket);function respondWithStatusCode(_0x42e8ab,_0x276c58){_0x276c58=_0x276c58||0xcc;return function(_0x2f3636){if(_0x2f3636){return _0x42e8ab['sendStatus'](_0x276c58);}return _0x42e8ab[_0xbce7('0x21')](_0x276c58)[_0xbce7('0x22')]();};}function respondWithResult(_0x28cfad,_0x38945c){_0x38945c=_0x38945c||0xc8;return function(_0x18af02){if(_0x18af02){return _0x28cfad[_0xbce7('0x21')](_0x38945c)[_0xbce7('0x23')](_0x18af02);}};}function respondWithFilteredResult(_0x4f6013,_0x502439){return function(_0xd3bbc0){if(_0xd3bbc0){var _0x469602=typeof _0x502439[_0xbce7('0x24')]===_0xbce7('0x25')&&typeof _0x502439[_0xbce7('0x26')]===_0xbce7('0x25');var _0x3c66a9=_0xd3bbc0[_0xbce7('0x27')];var _0x59697f=_0x469602?0x0:_0x502439[_0xbce7('0x24')];var _0x13028e=_0x469602?_0xd3bbc0[_0xbce7('0x27')]:_0x502439[_0xbce7('0x24')]+_0x502439['limit'];var _0x31b5e9;if(_0x13028e>=_0x3c66a9){_0x13028e=_0x3c66a9;_0x31b5e9=0xc8;}else{_0x31b5e9=0xce;}_0x4f6013[_0xbce7('0x21')](_0x31b5e9);return _0x4f6013['set'](_0xbce7('0x28'),_0x59697f+'-'+_0x13028e+'/'+_0x3c66a9)[_0xbce7('0x23')](_0xd3bbc0);}return null;};}function patchUpdates(_0x5495f2){return function(_0x52a6bd){try{jsonpatch[_0xbce7('0x29')](_0x52a6bd,_0x5495f2,!![]);}catch(_0x57b670){return BPromise['reject'](_0x57b670);}return _0x52a6bd[_0xbce7('0x2a')]();};}function saveUpdates(_0x516d68,_0x36346e){return function(_0x258e21){if(_0x258e21){return _0x258e21[_0xbce7('0x2b')](_0x516d68)['then'](function(_0x4adab4){return _0x4adab4;});}return null;};}function removeEntity(_0x3e10d4,_0x506ed1){return function(_0x5e228d){if(_0x5e228d){return _0x5e228d[_0xbce7('0x2c')]()[_0xbce7('0x2d')](function(){_0x3e10d4[_0xbce7('0x21')](0xcc)[_0xbce7('0x22')]();});}};}function handleEntityNotFound(_0x1b3ac0,_0x34b41b){return function(_0xc1bd7e){if(!_0xc1bd7e){_0x1b3ac0[_0xbce7('0x2e')](0x194);}return _0xc1bd7e;};}function handleError(_0x3b851f,_0x47edce){_0x47edce=_0x47edce||0x1f4;return function(_0x5ffa88){logger[_0xbce7('0x2f')](_0x5ffa88[_0xbce7('0x30')]);if(_0x5ffa88[_0xbce7('0x31')]){delete _0x5ffa88[_0xbce7('0x31')];}_0x3b851f[_0xbce7('0x21')](_0x47edce)[_0xbce7('0x32')](_0x5ffa88);};}exports[_0xbce7('0x33')]=function(_0x43b5f1,_0x5bdf5e){var _0x13c223={},_0x9a97e1={},_0x473b7e={'count':0x0,'rows':[]};var _0x28685b=_['map'](db['ChatGroup'][_0xbce7('0x34')],function(_0x199348){return{'name':_0x199348['fieldName'],'type':_0x199348[_0xbce7('0x35')][_0xbce7('0x36')]};});_0x9a97e1[_0xbce7('0x37')]=_[_0xbce7('0x38')](_0x28685b,'name');_0x9a97e1[_0xbce7('0x39')]=_[_0xbce7('0x3a')](_0x43b5f1[_0xbce7('0x39')]);_0x9a97e1['filters']=_[_0xbce7('0x3b')](_0x9a97e1[_0xbce7('0x37')],_0x9a97e1['query']);_0x13c223['attributes']=_['intersection'](_0x9a97e1['model'],qs[_0xbce7('0x3c')](_0x43b5f1['query'][_0xbce7('0x3c')]));_0x13c223[_0xbce7('0x3d')]=_0x13c223['attributes'][_0xbce7('0x3e')]?_0x13c223[_0xbce7('0x3d')]:_0x9a97e1[_0xbce7('0x37')];if(!_0x43b5f1[_0xbce7('0x39')][_0xbce7('0x3f')](_0xbce7('0x40'))){_0x13c223[_0xbce7('0x26')]=qs['limit'](_0x43b5f1[_0xbce7('0x39')][_0xbce7('0x26')]);_0x13c223[_0xbce7('0x24')]=qs[_0xbce7('0x24')](_0x43b5f1[_0xbce7('0x39')][_0xbce7('0x24')]);}_0x13c223[_0xbce7('0x41')]=qs[_0xbce7('0x42')](_0x43b5f1['query'][_0xbce7('0x42')]);_0x13c223['where']=qs['filters'](_[_0xbce7('0x43')](_0x43b5f1[_0xbce7('0x39')],_0x9a97e1['filters']),_0x28685b);if(_0x43b5f1[_0xbce7('0x39')][_0xbce7('0x44')]){_0x13c223['where']=_[_0xbce7('0x45')](_0x13c223[_0xbce7('0x46')],{'$or':_['map'](_0x28685b,function(_0x2e917e){if(_0x2e917e['type']!==_0xbce7('0x47')){var _0x299582={};_0x299582[_0x2e917e[_0xbce7('0x31')]]={'$like':'%'+_0x43b5f1[_0xbce7('0x39')][_0xbce7('0x44')]+'%'};return _0x299582;}})});}_0x13c223=_[_0xbce7('0x45')]({},_0x13c223,_0x43b5f1[_0xbce7('0x48')]);var _0x49c81f={'where':_0x13c223[_0xbce7('0x46')]};return db[_0xbce7('0x49')][_0xbce7('0x27')](_0x49c81f)['then'](function(_0xa92dfc){_0x473b7e[_0xbce7('0x27')]=_0xa92dfc;if(_0x43b5f1['query']['includeAll']){_0x13c223[_0xbce7('0x4a')]=[{'all':!![]}];}return db[_0xbce7('0x49')]['findAll'](_0x13c223);})[_0xbce7('0x2d')](function(_0x39bf83){_0x473b7e[_0xbce7('0x4b')]=_0x39bf83;return _0x473b7e;})[_0xbce7('0x2d')](respondWithFilteredResult(_0x5bdf5e,_0x13c223))['catch'](handleError(_0x5bdf5e,null));};exports[_0xbce7('0x4c')]=function(_0x1e8e61,_0x13c5f5){var _0x33bd14={'raw':!![],'where':{'id':_0x1e8e61[_0xbce7('0x4d')]['id']}},_0xdef081={};_0xdef081[_0xbce7('0x37')]=_[_0xbce7('0x3a')](db['ChatGroup']['rawAttributes']);_0xdef081[_0xbce7('0x39')]=_[_0xbce7('0x3a')](_0x1e8e61[_0xbce7('0x39')]);_0xdef081['filters']=_['intersection'](_0xdef081['model'],_0xdef081['query']);_0x33bd14['attributes']=_[_0xbce7('0x3b')](_0xdef081['model'],qs[_0xbce7('0x3c')](_0x1e8e61[_0xbce7('0x39')][_0xbce7('0x3c')]));_0x33bd14['attributes']=_0x33bd14[_0xbce7('0x3d')]['length']?_0x33bd14[_0xbce7('0x3d')]:_0xdef081[_0xbce7('0x37')];if(_0x1e8e61[_0xbce7('0x39')][_0xbce7('0x4e')]){_0x33bd14[_0xbce7('0x4a')]=[{'all':!![]}];}_0x33bd14=_[_0xbce7('0x45')]({},_0x33bd14,_0x1e8e61[_0xbce7('0x48')]);return db['ChatGroup']['find'](_0x33bd14)[_0xbce7('0x2d')](handleEntityNotFound(_0x13c5f5,null))[_0xbce7('0x2d')](respondWithResult(_0x13c5f5,null))[_0xbce7('0x4f')](handleError(_0x13c5f5,null));};exports[_0xbce7('0x50')]=function(_0x3b6500,_0x392f32){return db[_0xbce7('0x49')]['create'](_0x3b6500[_0xbce7('0x51')],{})['then'](respondWithResult(_0x392f32,0xc9))[_0xbce7('0x4f')](handleError(_0x392f32,null));};exports['update']=function(_0x43af63,_0x1b4c29){if(_0x43af63[_0xbce7('0x51')]['id']){delete _0x43af63['body']['id'];}return db[_0xbce7('0x49')][_0xbce7('0x52')]({'where':{'id':_0x43af63[_0xbce7('0x4d')]['id']}})['then'](handleEntityNotFound(_0x1b4c29,null))[_0xbce7('0x2d')](saveUpdates(_0x43af63[_0xbce7('0x51')],null))[_0xbce7('0x2d')](respondWithResult(_0x1b4c29,null))['catch'](handleError(_0x1b4c29,null));};exports[_0xbce7('0x2c')]=function(_0x131c1f,_0x16fced){return db[_0xbce7('0x49')][_0xbce7('0x52')]({'where':{'id':_0x131c1f[_0xbce7('0x4d')]['id']}})[_0xbce7('0x2d')](handleEntityNotFound(_0x16fced,null))['then'](removeEntity(_0x16fced,null))[_0xbce7('0x4f')](handleError(_0x16fced,null));};exports[_0xbce7('0x53')]=function(_0x289ada,_0x490def){return db[_0xbce7('0x49')][_0xbce7('0x53')]()['then'](respondWithResult(_0x490def,null))[_0xbce7('0x4f')](handleError(_0x490def,null));};exports[_0xbce7('0x54')]=function(_0x58f05b,_0x38420c,_0x519d68){return db[_0xbce7('0x55')][_0xbce7('0x27')]({'where':{'ChatGroupId':_0x58f05b[_0xbce7('0x4d')]['id'],'ToId':_0x58f05b[_0xbce7('0x56')]['id'],'read':![]}})[_0xbce7('0x2d')](function(_0x49cfc6){return{'id':_[_0xbce7('0x57')](_0x58f05b[_0xbce7('0x4d')]['id']),'count':_0x49cfc6};})[_0xbce7('0x2d')](respondWithResult(_0x38420c,null))[_0xbce7('0x4f')](handleError(_0x38420c,null));};exports[_0xbce7('0x58')]=function(_0x2b2d86,_0x20435d,_0x7d232){return db['ChatGroup']['find']({'where':{'id':_0x2b2d86[_0xbce7('0x4d')]['id']}})[_0xbce7('0x2d')](handleEntityNotFound(_0x20435d,null))['then'](function(_0x12ed20){if(_0x12ed20){return _0x12ed20[_0xbce7('0x58')](_0x2b2d86[_0xbce7('0x51')]['ids'],_[_0xbce7('0x59')](_0x2b2d86['body'],[_0xbce7('0x5a'),'id'])||{});}})[_0xbce7('0x2d')](respondWithResult(_0x20435d,null))['catch'](handleError(_0x20435d,null));};exports['getMembers']=function(_0x227a88,_0x35b09f,_0x316925){var _0x168faa={};var _0x499d60={};var _0x4b80d8;var _0x2057fb;return db[_0xbce7('0x49')][_0xbce7('0x5b')]({'where':{'id':_0x227a88['params']['id']}})['then'](handleEntityNotFound(_0x35b09f,null))['then'](function(_0x3e5e2c){if(_0x3e5e2c){_0x4b80d8=_0x3e5e2c;_0x499d60['model']=_[_0xbce7('0x3a')](db[_0xbce7('0x5c')]['rawAttributes']);_0x499d60['query']=_[_0xbce7('0x3a')](_0x227a88[_0xbce7('0x39')]);_0x499d60[_0xbce7('0x5d')]=_[_0xbce7('0x3b')](_0x499d60[_0xbce7('0x37')],_0x499d60[_0xbce7('0x39')]);_0x168faa[_0xbce7('0x3d')]=_[_0xbce7('0x3b')](_0x499d60[_0xbce7('0x37')],qs[_0xbce7('0x3c')](_0x227a88['query'][_0xbce7('0x3c')]));_0x168faa['attributes']=_0x168faa['attributes'][_0xbce7('0x3e')]?_0x168faa['attributes']:_0x499d60['model'];_0x168faa[_0xbce7('0x41')]=qs['sort'](_0x227a88[_0xbce7('0x39')]['sort']);_0x168faa['where']=qs['filters'](_['pick'](_0x227a88[_0xbce7('0x39')],_0x499d60['filters']));if(_0x227a88[_0xbce7('0x39')][_0xbce7('0x44')]){_0x168faa['where']=_[_0xbce7('0x45')](_0x168faa[_0xbce7('0x46')],{'$or':_[_0xbce7('0x38')](_0x168faa['attributes'],function(_0x204708){var _0x49a47e={};_0x49a47e[_0x204708]={'$like':'%'+_0x227a88[_0xbce7('0x39')][_0xbce7('0x44')]+'%'};return _0x49a47e;})});}_0x168faa=_[_0xbce7('0x45')]({},_0x168faa,_0x227a88[_0xbce7('0x48')]);return _0x4b80d8[_0xbce7('0x5e')](_0x168faa);}})[_0xbce7('0x2d')](function(_0x3559fa){if(_0x3559fa){_0x2057fb=_0x3559fa[_0xbce7('0x3e')];if(!_0x227a88[_0xbce7('0x39')][_0xbce7('0x3f')](_0xbce7('0x40'))){_0x168faa[_0xbce7('0x26')]=qs[_0xbce7('0x26')](_0x227a88[_0xbce7('0x39')]['limit']);_0x168faa[_0xbce7('0x24')]=qs[_0xbce7('0x24')](_0x227a88[_0xbce7('0x39')]['offset']);}return _0x4b80d8[_0xbce7('0x5e')](_0x168faa);}})[_0xbce7('0x2d')](function(_0x5e56aa){if(_0x5e56aa){return _0x5e56aa?{'count':_0x2057fb,'rows':_0x5e56aa}:null;}})[_0xbce7('0x2d')](respondWithResult(_0x35b09f,null))[_0xbce7('0x4f')](handleError(_0x35b09f,null));};exports['removeMembers']=function(_0x2733fb,_0xeac927,_0x48edf1){return db[_0xbce7('0x49')]['find']({'where':{'id':_0x2733fb[_0xbce7('0x4d')]['id']}})[_0xbce7('0x2d')](handleEntityNotFound(_0xeac927,null))[_0xbce7('0x2d')](function(_0xfa2ff1){if(_0xfa2ff1){return _0xfa2ff1[_0xbce7('0x5f')](_0x2733fb[_0xbce7('0x39')][_0xbce7('0x5a')]);}})['then'](respondWithStatusCode(_0xeac927,null))[_0xbce7('0x4f')](handleError(_0xeac927,null));};exports[_0xbce7('0x60')]=function(_0x560498,_0x493cf1,_0xd2e295){if(_0x560498[_0xbce7('0x51')]['id']){delete _0x560498[_0xbce7('0x51')]['id'];}return db[_0xbce7('0x49')][_0xbce7('0x52')]({'where':{'id':_0x560498[_0xbce7('0x4d')]['id']}})[_0xbce7('0x2d')](handleEntityNotFound(_0x493cf1,null))['then'](function(_0x52a024){if(_0x52a024){_0x560498[_0xbce7('0x51')][_0xbce7('0x61')]=_0x52a024['id'];return db[_0xbce7('0x55')][_0xbce7('0x50')](_0x560498[_0xbce7('0x51')]);}})['then'](respondWithResult(_0x493cf1,null))[_0xbce7('0x4f')](handleError(_0x493cf1,null));};exports[_0xbce7('0x62')]=function(_0x328b76,_0x11668d,_0x5e5ad2){var _0x591320={};var _0x3369c6={};var _0x3c473c;var _0x413372;return db[_0xbce7('0x49')][_0xbce7('0x5b')]({'where':{'id':_0x328b76[_0xbce7('0x4d')]['id']}})[_0xbce7('0x2d')](handleEntityNotFound(_0x11668d,null))[_0xbce7('0x2d')](function(_0x6fba2f){if(_0x6fba2f){_0x3c473c=_0x6fba2f;_0x3369c6[_0xbce7('0x37')]=_['keys'](db[_0xbce7('0x55')][_0xbce7('0x34')]);_0x3369c6[_0xbce7('0x39')]=_[_0xbce7('0x3a')](_0x328b76[_0xbce7('0x39')]);_0x3369c6[_0xbce7('0x5d')]=_[_0xbce7('0x3b')](_0x3369c6['model'],_0x3369c6[_0xbce7('0x39')]);_0x591320[_0xbce7('0x3d')]=_['intersection'](_0x3369c6[_0xbce7('0x37')],qs[_0xbce7('0x3c')](_0x328b76['query']['fields']));_0x591320[_0xbce7('0x3d')]=_0x591320[_0xbce7('0x3d')][_0xbce7('0x3e')]?_0x591320[_0xbce7('0x3d')]:_0x3369c6[_0xbce7('0x37')];_0x591320[_0xbce7('0x41')]=qs[_0xbce7('0x42')](_0x328b76[_0xbce7('0x39')]['sort']);_0x591320[_0xbce7('0x46')]=qs[_0xbce7('0x5d')](_[_0xbce7('0x43')](_0x328b76[_0xbce7('0x39')],_0x3369c6[_0xbce7('0x5d')]));if(_0x328b76[_0xbce7('0x39')][_0xbce7('0x44')]){_0x591320[_0xbce7('0x46')]=_[_0xbce7('0x45')](_0x591320['where'],{'$or':_['map'](_0x591320[_0xbce7('0x3d')],function(_0x24bc63){var _0xa1b65d={};_0xa1b65d[_0x24bc63]={'$like':'%'+_0x328b76[_0xbce7('0x39')][_0xbce7('0x44')]+'%'};return _0xa1b65d;})});}if(_0x328b76[_0xbce7('0x39')][_0xbce7('0x63')]){var _0x46e9b0=_0x328b76[_0xbce7('0x39')][_0xbce7('0x63')][_0xbce7('0x64')](',');var _0xbc324d={};_0xbc324d[_0x46e9b0[0x0]]={'$gte':moment(_0x46e9b0[0x1])[_0xbce7('0x65')](_0xbce7('0x66'))};_0x591320[_0xbce7('0x46')]=_[_0xbce7('0x45')](_0x591320['where'],_0xbc324d);}_0x591320=_[_0xbce7('0x45')]({},_0x591320,_0x328b76[_0xbce7('0x48')]);return _0x3c473c['getMessages'](_0x591320);}})[_0xbce7('0x2d')](function(_0x1234ad){if(_0x1234ad){_0x413372=_0x1234ad[_0xbce7('0x3e')];if(!_0x328b76[_0xbce7('0x39')][_0xbce7('0x3f')](_0xbce7('0x40'))){_0x591320[_0xbce7('0x26')]=qs['limit'](_0x328b76['query'][_0xbce7('0x26')]);_0x591320['offset']=qs['offset'](_0x328b76[_0xbce7('0x39')][_0xbce7('0x24')]);}return _0x3c473c[_0xbce7('0x62')](_0x591320);}})[_0xbce7('0x2d')](function(_0x5808a7){if(_0x5808a7){return _0x5808a7?{'count':_0x413372,'rows':_0x5808a7}:null;}})[_0xbce7('0x2d')](respondWithResult(_0x11668d,null))['catch'](handleError(_0x11668d,null));}; \ No newline at end of file +var _0xec09=['catch','show','include','find','create','body','update','params','describe','getUnread','ChatInternalMessage','user','toInteger','addMembers','ids','omit','getMembers','findOne','sort','removeMembers','addMessage','ChatGroupId','getMessages','split','YYYY-MM-DD\x20HH:mm:ss','rimraf','fast-json-patch','moment','bluebird','mustache','util','sox','to-csv','ejs','fs-extra','lodash','desk.js','querystring','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','api','../../config/utils','../../config/environment','../../config/license/util','redis','defaults','localhost','socket.io-emitter','end','status','json','offset','undefined','limit','count','set','Content-Range','apply','save','destroy','then','sendStatus','error','stack','name','send','index','map','ChatGroup','rawAttributes','fieldName','model','keys','filters','query','intersection','fields','attributes','length','hasOwnProperty','nolimit','order','where','pick','filter','merge','type','VIRTUAL','options','includeAll','findAll','rows'];(function(_0x564b7f,_0x162734){var _0x194ae6=function(_0x25fe6b){while(--_0x25fe6b){_0x564b7f['push'](_0x564b7f['shift']());}};_0x194ae6(++_0x162734);}(_0xec09,0x78));var _0x9ec0=function(_0x4c48ed,_0x57fad6){_0x4c48ed=_0x4c48ed-0x0;var _0x4b14c5=_0xec09[_0x4c48ed];return _0x4b14c5;};'use strict';var emlformat=require('eml-format');var rimraf=require(_0x9ec0('0x0'));var zipdir=require('zip-dir');var jsonpatch=require(_0x9ec0('0x1'));var rp=require('request-promise');var moment=require(_0x9ec0('0x2'));var BPromise=require(_0x9ec0('0x3'));var Mustache=require(_0x9ec0('0x4'));var util=require(_0x9ec0('0x5'));var path=require('path');var sox=require(_0x9ec0('0x6'));var csv=require(_0x9ec0('0x7'));var ejs=require(_0x9ec0('0x8'));var fs=require('fs');var fs_extra=require(_0x9ec0('0x9'));var _=require(_0x9ec0('0xa'));var squel=require('squel');var crypto=require('crypto');var jsforce=require('jsforce');var deskjs=require(_0x9ec0('0xb'));var toCsv=require(_0x9ec0('0x7'));var querystring=require(_0x9ec0('0xc'));var Papa=require('papaparse');var Redis=require(_0x9ec0('0xd'));var authService=require(_0x9ec0('0xe'));var qs=require(_0x9ec0('0xf'));var as=require(_0x9ec0('0x10'));var hardwareService=require(_0x9ec0('0x11'));var logger=require('../../config/logger')(_0x9ec0('0x12'));var utils=require(_0x9ec0('0x13'));var config=require(_0x9ec0('0x14'));var licenseUtil=require(_0x9ec0('0x15'));var db=require('../../mysqldb')['db'];config[_0x9ec0('0x16')]=_[_0x9ec0('0x17')](config['redis'],{'host':_0x9ec0('0x18'),'port':0x18eb});var socket=require(_0x9ec0('0x19'))(new Redis(config[_0x9ec0('0x16')]));require('./chatGroup.socket')['register'](socket);function respondWithStatusCode(_0x268160,_0x1d9997){_0x1d9997=_0x1d9997||0xcc;return function(_0x300392){if(_0x300392){return _0x268160['sendStatus'](_0x1d9997);}return _0x268160['status'](_0x1d9997)[_0x9ec0('0x1a')]();};}function respondWithResult(_0x44cefb,_0x868fb9){_0x868fb9=_0x868fb9||0xc8;return function(_0x11459b){if(_0x11459b){return _0x44cefb[_0x9ec0('0x1b')](_0x868fb9)[_0x9ec0('0x1c')](_0x11459b);}};}function respondWithFilteredResult(_0x2f1d4c,_0x1acbda){return function(_0x4f9a5f){if(_0x4f9a5f){var _0x33e139=typeof _0x1acbda[_0x9ec0('0x1d')]===_0x9ec0('0x1e')&&typeof _0x1acbda[_0x9ec0('0x1f')]===_0x9ec0('0x1e');var _0x98d5aa=_0x4f9a5f['count'];var _0x43751c=_0x33e139?0x0:_0x1acbda[_0x9ec0('0x1d')];var _0x5a9f88=_0x33e139?_0x4f9a5f[_0x9ec0('0x20')]:_0x1acbda[_0x9ec0('0x1d')]+_0x1acbda['limit'];var _0x4f79f3;if(_0x5a9f88>=_0x98d5aa){_0x5a9f88=_0x98d5aa;_0x4f79f3=0xc8;}else{_0x4f79f3=0xce;}_0x2f1d4c[_0x9ec0('0x1b')](_0x4f79f3);return _0x2f1d4c[_0x9ec0('0x21')](_0x9ec0('0x22'),_0x43751c+'-'+_0x5a9f88+'/'+_0x98d5aa)['json'](_0x4f9a5f);}return null;};}function patchUpdates(_0x29a354){return function(_0x5808f4){try{jsonpatch[_0x9ec0('0x23')](_0x5808f4,_0x29a354,!![]);}catch(_0x3b28cf){return BPromise['reject'](_0x3b28cf);}return _0x5808f4[_0x9ec0('0x24')]();};}function saveUpdates(_0x1391ae,_0x3a65b9){return function(_0xbeaae9){if(_0xbeaae9){return _0xbeaae9['update'](_0x1391ae)['then'](function(_0x27e1ef){return _0x27e1ef;});}return null;};}function removeEntity(_0x38109b,_0x2f37ab){return function(_0x3ce644){if(_0x3ce644){return _0x3ce644[_0x9ec0('0x25')]()[_0x9ec0('0x26')](function(){_0x38109b[_0x9ec0('0x1b')](0xcc)[_0x9ec0('0x1a')]();});}};}function handleEntityNotFound(_0x527ff3,_0x34ed9d){return function(_0x44acf4){if(!_0x44acf4){_0x527ff3[_0x9ec0('0x27')](0x194);}return _0x44acf4;};}function handleError(_0x4a3c93,_0x4d42f4){_0x4d42f4=_0x4d42f4||0x1f4;return function(_0x10dde6){logger[_0x9ec0('0x28')](_0x10dde6[_0x9ec0('0x29')]);if(_0x10dde6[_0x9ec0('0x2a')]){delete _0x10dde6['name'];}_0x4a3c93[_0x9ec0('0x1b')](_0x4d42f4)[_0x9ec0('0x2b')](_0x10dde6);};}exports[_0x9ec0('0x2c')]=function(_0x36f9a1,_0x8ed1e2){var _0x1ea020={},_0x1e3ed4={},_0xc4e8={'count':0x0,'rows':[]};var _0x2d0e8d=_[_0x9ec0('0x2d')](db[_0x9ec0('0x2e')][_0x9ec0('0x2f')],function(_0x1bf3c2){return{'name':_0x1bf3c2[_0x9ec0('0x30')],'type':_0x1bf3c2['type']['key']};});_0x1e3ed4[_0x9ec0('0x31')]=_['map'](_0x2d0e8d,_0x9ec0('0x2a'));_0x1e3ed4['query']=_[_0x9ec0('0x32')](_0x36f9a1['query']);_0x1e3ed4[_0x9ec0('0x33')]=_['intersection'](_0x1e3ed4[_0x9ec0('0x31')],_0x1e3ed4[_0x9ec0('0x34')]);_0x1ea020['attributes']=_[_0x9ec0('0x35')](_0x1e3ed4[_0x9ec0('0x31')],qs[_0x9ec0('0x36')](_0x36f9a1[_0x9ec0('0x34')][_0x9ec0('0x36')]));_0x1ea020[_0x9ec0('0x37')]=_0x1ea020[_0x9ec0('0x37')][_0x9ec0('0x38')]?_0x1ea020['attributes']:_0x1e3ed4[_0x9ec0('0x31')];if(!_0x36f9a1[_0x9ec0('0x34')][_0x9ec0('0x39')](_0x9ec0('0x3a'))){_0x1ea020[_0x9ec0('0x1f')]=qs[_0x9ec0('0x1f')](_0x36f9a1['query'][_0x9ec0('0x1f')]);_0x1ea020[_0x9ec0('0x1d')]=qs[_0x9ec0('0x1d')](_0x36f9a1[_0x9ec0('0x34')][_0x9ec0('0x1d')]);}_0x1ea020[_0x9ec0('0x3b')]=qs['sort'](_0x36f9a1['query']['sort']);_0x1ea020[_0x9ec0('0x3c')]=qs['filters'](_[_0x9ec0('0x3d')](_0x36f9a1[_0x9ec0('0x34')],_0x1e3ed4[_0x9ec0('0x33')]),_0x2d0e8d);if(_0x36f9a1[_0x9ec0('0x34')][_0x9ec0('0x3e')]){_0x1ea020[_0x9ec0('0x3c')]=_[_0x9ec0('0x3f')](_0x1ea020['where'],{'$or':_[_0x9ec0('0x2d')](_0x2d0e8d,function(_0x299317){if(_0x299317[_0x9ec0('0x40')]!==_0x9ec0('0x41')){var _0x1d56b6={};_0x1d56b6[_0x299317[_0x9ec0('0x2a')]]={'$like':'%'+_0x36f9a1['query'][_0x9ec0('0x3e')]+'%'};return _0x1d56b6;}})});}_0x1ea020=_[_0x9ec0('0x3f')]({},_0x1ea020,_0x36f9a1[_0x9ec0('0x42')]);var _0x2b0497={'where':_0x1ea020[_0x9ec0('0x3c')]};return db['ChatGroup'][_0x9ec0('0x20')](_0x2b0497)[_0x9ec0('0x26')](function(_0x3b0fe7){_0xc4e8[_0x9ec0('0x20')]=_0x3b0fe7;if(_0x36f9a1['query'][_0x9ec0('0x43')]){_0x1ea020['include']=[{'all':!![]}];}return db['ChatGroup'][_0x9ec0('0x44')](_0x1ea020);})[_0x9ec0('0x26')](function(_0x30d4f4){_0xc4e8[_0x9ec0('0x45')]=_0x30d4f4;return _0xc4e8;})['then'](respondWithFilteredResult(_0x8ed1e2,_0x1ea020))[_0x9ec0('0x46')](handleError(_0x8ed1e2,null));};exports[_0x9ec0('0x47')]=function(_0x12e4b2,_0x37f9fd){var _0x21f0c6={'raw':!![],'where':{'id':_0x12e4b2['params']['id']}},_0x2efbe6={};_0x2efbe6[_0x9ec0('0x31')]=_[_0x9ec0('0x32')](db[_0x9ec0('0x2e')]['rawAttributes']);_0x2efbe6[_0x9ec0('0x34')]=_[_0x9ec0('0x32')](_0x12e4b2[_0x9ec0('0x34')]);_0x2efbe6['filters']=_['intersection'](_0x2efbe6[_0x9ec0('0x31')],_0x2efbe6['query']);_0x21f0c6['attributes']=_['intersection'](_0x2efbe6[_0x9ec0('0x31')],qs[_0x9ec0('0x36')](_0x12e4b2[_0x9ec0('0x34')][_0x9ec0('0x36')]));_0x21f0c6[_0x9ec0('0x37')]=_0x21f0c6['attributes'][_0x9ec0('0x38')]?_0x21f0c6[_0x9ec0('0x37')]:_0x2efbe6[_0x9ec0('0x31')];if(_0x12e4b2[_0x9ec0('0x34')][_0x9ec0('0x43')]){_0x21f0c6[_0x9ec0('0x48')]=[{'all':!![]}];}_0x21f0c6=_[_0x9ec0('0x3f')]({},_0x21f0c6,_0x12e4b2[_0x9ec0('0x42')]);return db[_0x9ec0('0x2e')][_0x9ec0('0x49')](_0x21f0c6)[_0x9ec0('0x26')](handleEntityNotFound(_0x37f9fd,null))[_0x9ec0('0x26')](respondWithResult(_0x37f9fd,null))[_0x9ec0('0x46')](handleError(_0x37f9fd,null));};exports[_0x9ec0('0x4a')]=function(_0x2629f2,_0x51cde5){return db[_0x9ec0('0x2e')][_0x9ec0('0x4a')](_0x2629f2[_0x9ec0('0x4b')],{})[_0x9ec0('0x26')](respondWithResult(_0x51cde5,0xc9))[_0x9ec0('0x46')](handleError(_0x51cde5,null));};exports[_0x9ec0('0x4c')]=function(_0x380dc7,_0x5eabaa){if(_0x380dc7['body']['id']){delete _0x380dc7['body']['id'];}return db['ChatGroup'][_0x9ec0('0x49')]({'where':{'id':_0x380dc7[_0x9ec0('0x4d')]['id']}})[_0x9ec0('0x26')](handleEntityNotFound(_0x5eabaa,null))[_0x9ec0('0x26')](saveUpdates(_0x380dc7['body'],null))[_0x9ec0('0x26')](respondWithResult(_0x5eabaa,null))[_0x9ec0('0x46')](handleError(_0x5eabaa,null));};exports[_0x9ec0('0x25')]=function(_0x401a7b,_0xbf2c4d){return db[_0x9ec0('0x2e')][_0x9ec0('0x49')]({'where':{'id':_0x401a7b[_0x9ec0('0x4d')]['id']}})[_0x9ec0('0x26')](handleEntityNotFound(_0xbf2c4d,null))[_0x9ec0('0x26')](removeEntity(_0xbf2c4d,null))[_0x9ec0('0x46')](handleError(_0xbf2c4d,null));};exports['describe']=function(_0x5981d0,_0x56eb60){return db[_0x9ec0('0x2e')][_0x9ec0('0x4e')]()[_0x9ec0('0x26')](respondWithResult(_0x56eb60,null))[_0x9ec0('0x46')](handleError(_0x56eb60,null));};exports[_0x9ec0('0x4f')]=function(_0x2e887f,_0x57b3fc,_0x2f4bca){return db[_0x9ec0('0x50')]['count']({'where':{'ChatGroupId':_0x2e887f[_0x9ec0('0x4d')]['id'],'ToId':_0x2e887f[_0x9ec0('0x51')]['id'],'read':![]}})[_0x9ec0('0x26')](function(_0x31e79a){return{'id':_[_0x9ec0('0x52')](_0x2e887f[_0x9ec0('0x4d')]['id']),'count':_0x31e79a};})['then'](respondWithResult(_0x57b3fc,null))[_0x9ec0('0x46')](handleError(_0x57b3fc,null));};exports[_0x9ec0('0x53')]=function(_0x1fd003,_0x401164,_0x5bb17c){return db[_0x9ec0('0x2e')][_0x9ec0('0x49')]({'where':{'id':_0x1fd003[_0x9ec0('0x4d')]['id']}})[_0x9ec0('0x26')](handleEntityNotFound(_0x401164,null))['then'](function(_0x30df37){if(_0x30df37){return _0x30df37[_0x9ec0('0x53')](_0x1fd003[_0x9ec0('0x4b')][_0x9ec0('0x54')],_[_0x9ec0('0x55')](_0x1fd003[_0x9ec0('0x4b')],[_0x9ec0('0x54'),'id'])||{});}})[_0x9ec0('0x26')](respondWithResult(_0x401164,null))[_0x9ec0('0x46')](handleError(_0x401164,null));};exports[_0x9ec0('0x56')]=function(_0x5186cb,_0x1919b7,_0x29e706){var _0x2c88e2={};var _0xc38dcf={};var _0x1a85ea;var _0x5570e8;return db[_0x9ec0('0x2e')][_0x9ec0('0x57')]({'where':{'id':_0x5186cb[_0x9ec0('0x4d')]['id']}})['then'](handleEntityNotFound(_0x1919b7,null))[_0x9ec0('0x26')](function(_0x3caeae){if(_0x3caeae){_0x1a85ea=_0x3caeae;_0xc38dcf[_0x9ec0('0x31')]=_[_0x9ec0('0x32')](db['User']['rawAttributes']);_0xc38dcf[_0x9ec0('0x34')]=_[_0x9ec0('0x32')](_0x5186cb['query']);_0xc38dcf['filters']=_[_0x9ec0('0x35')](_0xc38dcf[_0x9ec0('0x31')],_0xc38dcf[_0x9ec0('0x34')]);_0x2c88e2[_0x9ec0('0x37')]=_[_0x9ec0('0x35')](_0xc38dcf[_0x9ec0('0x31')],qs[_0x9ec0('0x36')](_0x5186cb[_0x9ec0('0x34')][_0x9ec0('0x36')]));_0x2c88e2[_0x9ec0('0x37')]=_0x2c88e2[_0x9ec0('0x37')][_0x9ec0('0x38')]?_0x2c88e2[_0x9ec0('0x37')]:_0xc38dcf[_0x9ec0('0x31')];_0x2c88e2['order']=qs[_0x9ec0('0x58')](_0x5186cb[_0x9ec0('0x34')][_0x9ec0('0x58')]);_0x2c88e2['where']=qs[_0x9ec0('0x33')](_[_0x9ec0('0x3d')](_0x5186cb['query'],_0xc38dcf[_0x9ec0('0x33')]));if(_0x5186cb[_0x9ec0('0x34')]['filter']){_0x2c88e2['where']=_[_0x9ec0('0x3f')](_0x2c88e2[_0x9ec0('0x3c')],{'$or':_['map'](_0x2c88e2['attributes'],function(_0x313dc7){var _0x1f045a={};_0x1f045a[_0x313dc7]={'$like':'%'+_0x5186cb[_0x9ec0('0x34')][_0x9ec0('0x3e')]+'%'};return _0x1f045a;})});}_0x2c88e2=_[_0x9ec0('0x3f')]({},_0x2c88e2,_0x5186cb[_0x9ec0('0x42')]);return _0x1a85ea[_0x9ec0('0x56')](_0x2c88e2);}})['then'](function(_0xe214c4){if(_0xe214c4){_0x5570e8=_0xe214c4[_0x9ec0('0x38')];if(!_0x5186cb[_0x9ec0('0x34')]['hasOwnProperty'](_0x9ec0('0x3a'))){_0x2c88e2[_0x9ec0('0x1f')]=qs[_0x9ec0('0x1f')](_0x5186cb[_0x9ec0('0x34')][_0x9ec0('0x1f')]);_0x2c88e2['offset']=qs[_0x9ec0('0x1d')](_0x5186cb[_0x9ec0('0x34')][_0x9ec0('0x1d')]);}return _0x1a85ea[_0x9ec0('0x56')](_0x2c88e2);}})[_0x9ec0('0x26')](function(_0x5e4e23){if(_0x5e4e23){return _0x5e4e23?{'count':_0x5570e8,'rows':_0x5e4e23}:null;}})[_0x9ec0('0x26')](respondWithResult(_0x1919b7,null))[_0x9ec0('0x46')](handleError(_0x1919b7,null));};exports[_0x9ec0('0x59')]=function(_0xdba8ca,_0x2824bf,_0x28b160){return db[_0x9ec0('0x2e')][_0x9ec0('0x49')]({'where':{'id':_0xdba8ca[_0x9ec0('0x4d')]['id']}})[_0x9ec0('0x26')](handleEntityNotFound(_0x2824bf,null))[_0x9ec0('0x26')](function(_0x2f8c57){if(_0x2f8c57){return _0x2f8c57[_0x9ec0('0x59')](_0xdba8ca[_0x9ec0('0x34')][_0x9ec0('0x54')]);}})[_0x9ec0('0x26')](respondWithStatusCode(_0x2824bf,null))[_0x9ec0('0x46')](handleError(_0x2824bf,null));};exports[_0x9ec0('0x5a')]=function(_0x1114b3,_0x4bee6b,_0x20c5ad){if(_0x1114b3[_0x9ec0('0x4b')]['id']){delete _0x1114b3[_0x9ec0('0x4b')]['id'];}return db['ChatGroup']['find']({'where':{'id':_0x1114b3[_0x9ec0('0x4d')]['id']}})[_0x9ec0('0x26')](handleEntityNotFound(_0x4bee6b,null))[_0x9ec0('0x26')](function(_0x383078){if(_0x383078){_0x1114b3[_0x9ec0('0x4b')][_0x9ec0('0x5b')]=_0x383078['id'];return db[_0x9ec0('0x50')][_0x9ec0('0x4a')](_0x1114b3[_0x9ec0('0x4b')]);}})[_0x9ec0('0x26')](respondWithResult(_0x4bee6b,null))['catch'](handleError(_0x4bee6b,null));};exports[_0x9ec0('0x5c')]=function(_0x5654bd,_0x1e3b5e,_0x3a2841){var _0x3a21e0={};var _0x3190db={};var _0x5e9706;var _0x5eded0;return db['ChatGroup']['findOne']({'where':{'id':_0x5654bd[_0x9ec0('0x4d')]['id']}})[_0x9ec0('0x26')](handleEntityNotFound(_0x1e3b5e,null))['then'](function(_0x4e4652){if(_0x4e4652){_0x5e9706=_0x4e4652;_0x3190db['model']=_['keys'](db['ChatInternalMessage'][_0x9ec0('0x2f')]);_0x3190db[_0x9ec0('0x34')]=_[_0x9ec0('0x32')](_0x5654bd[_0x9ec0('0x34')]);_0x3190db[_0x9ec0('0x33')]=_[_0x9ec0('0x35')](_0x3190db['model'],_0x3190db[_0x9ec0('0x34')]);_0x3a21e0[_0x9ec0('0x37')]=_[_0x9ec0('0x35')](_0x3190db[_0x9ec0('0x31')],qs[_0x9ec0('0x36')](_0x5654bd[_0x9ec0('0x34')]['fields']));_0x3a21e0[_0x9ec0('0x37')]=_0x3a21e0['attributes'][_0x9ec0('0x38')]?_0x3a21e0[_0x9ec0('0x37')]:_0x3190db[_0x9ec0('0x31')];_0x3a21e0[_0x9ec0('0x3b')]=qs['sort'](_0x5654bd[_0x9ec0('0x34')][_0x9ec0('0x58')]);_0x3a21e0[_0x9ec0('0x3c')]=qs['filters'](_[_0x9ec0('0x3d')](_0x5654bd[_0x9ec0('0x34')],_0x3190db[_0x9ec0('0x33')]));if(_0x5654bd[_0x9ec0('0x34')][_0x9ec0('0x3e')]){_0x3a21e0[_0x9ec0('0x3c')]=_['merge'](_0x3a21e0['where'],{'$or':_[_0x9ec0('0x2d')](_0x3a21e0[_0x9ec0('0x37')],function(_0x33d40b){var _0x36b287={};_0x36b287[_0x33d40b]={'$like':'%'+_0x5654bd[_0x9ec0('0x34')][_0x9ec0('0x3e')]+'%'};return _0x36b287;})});}if(_0x5654bd['query']['$gte']){var _0x16ba88=_0x5654bd[_0x9ec0('0x34')]['$gte'][_0x9ec0('0x5d')](',');var _0x319248={};_0x319248[_0x16ba88[0x0]]={'$gte':moment(_0x16ba88[0x1])['format'](_0x9ec0('0x5e'))};_0x3a21e0[_0x9ec0('0x3c')]=_['merge'](_0x3a21e0[_0x9ec0('0x3c')],_0x319248);}_0x3a21e0=_['merge']({},_0x3a21e0,_0x5654bd['options']);return _0x5e9706[_0x9ec0('0x5c')](_0x3a21e0);}})['then'](function(_0x58a10b){if(_0x58a10b){_0x5eded0=_0x58a10b[_0x9ec0('0x38')];if(!_0x5654bd['query'][_0x9ec0('0x39')](_0x9ec0('0x3a'))){_0x3a21e0[_0x9ec0('0x1f')]=qs[_0x9ec0('0x1f')](_0x5654bd[_0x9ec0('0x34')]['limit']);_0x3a21e0['offset']=qs[_0x9ec0('0x1d')](_0x5654bd[_0x9ec0('0x34')]['offset']);}return _0x5e9706['getMessages'](_0x3a21e0);}})[_0x9ec0('0x26')](function(_0xa2504a){if(_0xa2504a){return _0xa2504a?{'count':_0x5eded0,'rows':_0xa2504a}:null;}})[_0x9ec0('0x26')](respondWithResult(_0x1e3b5e,null))[_0x9ec0('0x46')](handleError(_0x1e3b5e,null));}; \ No newline at end of file diff --git a/server/api/chatGroup/chatGroup.events.js b/server/api/chatGroup/chatGroup.events.js index 3662322..1bd9e5e 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 _0x4c41=['emit','../../mysqldb','remove'];(function(_0x20a584,_0xe384a5){var _0x4b41a8=function(_0x2127c6){while(--_0x2127c6){_0x20a584['push'](_0x20a584['shift']());}};_0x4b41a8(++_0xe384a5);}(_0x4c41,0xf7));var _0x14c4=function(_0x15f9a7,_0x9a7a5){_0x15f9a7=_0x15f9a7-0x0;var _0x5822e3=_0x4c41[_0x15f9a7];return _0x5822e3;};'use strict';var EventEmitter=require('events');var ChatGroup=require(_0x14c4('0x0'))['db']['ChatGroup'];var ChatGroupEvents=new EventEmitter();ChatGroupEvents['setMaxListeners'](0x0);var events={'afterCreate':'save','afterUpdate':'update','afterDestroy':_0x14c4('0x1')};function emitEvent(_0x1f377b){return function(_0x50e90c,_0x754790,_0x34c2ba){ChatGroupEvents['emit'](_0x1f377b+':'+_0x50e90c['id'],_0x50e90c);ChatGroupEvents[_0x14c4('0x2')](_0x1f377b,_0x50e90c);_0x34c2ba(null);};}for(var e in events){if(events['hasOwnProperty'](e)){var event=events[e];ChatGroup['hook'](e,emitEvent(event));}}module['exports']=ChatGroupEvents; \ No newline at end of file +var _0x36e1=['update','remove','emit','hasOwnProperty','hook','exports','events','../../mysqldb','ChatGroup','save'];(function(_0x17b0d4,_0x377add){var _0x2d02c7=function(_0x56e627){while(--_0x56e627){_0x17b0d4['push'](_0x17b0d4['shift']());}};_0x2d02c7(++_0x377add);}(_0x36e1,0xe2));var _0x136e=function(_0x3899d1,_0x4aa04c){_0x3899d1=_0x3899d1-0x0;var _0xeb4a7d=_0x36e1[_0x3899d1];return _0xeb4a7d;};'use strict';var EventEmitter=require(_0x136e('0x0'));var ChatGroup=require(_0x136e('0x1'))['db'][_0x136e('0x2')];var ChatGroupEvents=new EventEmitter();ChatGroupEvents['setMaxListeners'](0x0);var events={'afterCreate':_0x136e('0x3'),'afterUpdate':_0x136e('0x4'),'afterDestroy':_0x136e('0x5')};function emitEvent(_0x4cee97){return function(_0x377537,_0x5b3025,_0x554ad8){ChatGroupEvents[_0x136e('0x6')](_0x4cee97+':'+_0x377537['id'],_0x377537);ChatGroupEvents['emit'](_0x4cee97,_0x377537);_0x554ad8(null);};}for(var e in events){if(events[_0x136e('0x7')](e)){var event=events[e];ChatGroup[_0x136e('0x8')](e,emitEvent(event));}}module[_0x136e('0x9')]=ChatGroupEvents; \ No newline at end of file diff --git a/server/api/chatGroup/chatGroup.model.js b/server/api/chatGroup/chatGroup.model.js index 6631d02..5fbdd1c 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 _0x0030=['./chatGroup.attributes','exports','define','ChatGroup','chat_groups','util','api','bluebird','request-promise','path','rimraf','../../config/environment'];(function(_0x4ae829,_0x2c842c){var _0x256b31=function(_0x34f104){while(--_0x34f104){_0x4ae829['push'](_0x4ae829['shift']());}};_0x256b31(++_0x2c842c);}(_0x0030,0x185));var _0x0003=function(_0x7c7176,_0x1c976e){_0x7c7176=_0x7c7176-0x0;var _0x440e9d=_0x0030[_0x7c7176];return _0x440e9d;};'use strict';var _=require('lodash');var util=require(_0x0003('0x0'));var logger=require('../../config/logger')(_0x0003('0x1'));var moment=require('moment');var BPromise=require(_0x0003('0x2'));var rp=require(_0x0003('0x3'));var fs=require('fs');var path=require(_0x0003('0x4'));var rimraf=require(_0x0003('0x5'));var config=require(_0x0003('0x6'));var attributes=require(_0x0003('0x7'));module[_0x0003('0x8')]=function(_0x4b85ac,_0x5776b0){return _0x4b85ac[_0x0003('0x9')](_0x0003('0xa'),attributes,{'tableName':_0x0003('0xb'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0xdd01=['exports','ChatGroup','lodash','util','../../config/logger','api','moment','bluebird','rimraf','./chatGroup.attributes'];(function(_0x5632af,_0x2fb1b1){var _0x764927=function(_0x6c7014){while(--_0x6c7014){_0x5632af['push'](_0x5632af['shift']());}};_0x764927(++_0x2fb1b1);}(_0xdd01,0x160));var _0x1dd0=function(_0x36ed48,_0x1ee0d4){_0x36ed48=_0x36ed48-0x0;var _0x51c63a=_0xdd01[_0x36ed48];return _0x51c63a;};'use strict';var _=require(_0x1dd0('0x0'));var util=require(_0x1dd0('0x1'));var logger=require(_0x1dd0('0x2'))(_0x1dd0('0x3'));var moment=require(_0x1dd0('0x4'));var BPromise=require(_0x1dd0('0x5'));var rp=require('request-promise');var fs=require('fs');var path=require('path');var rimraf=require(_0x1dd0('0x6'));var config=require('../../config/environment');var attributes=require(_0x1dd0('0x7'));module[_0x1dd0('0x8')]=function(_0x405e95,_0x5bdd5e){return _0x405e95['define'](_0x1dd0('0x9'),attributes,{'tableName':'chat_groups','paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/chatGroup/chatGroup.rpc.js b/server/api/chatGroup/chatGroup.rpc.js index 1c7a655..bb1d806 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 _0x9622=['then','info','ChatGroup,\x20%s,\x20%s','request\x20sent','debug','ChatGroup,\x20%s,\x20%s,\x20%s','stringify','error','code','message','result','lodash','util','moment','randomstring','ioredis','../../mysqldb','jayson/promise','client','http','redis','defaults','socket.io-emitter','./chatGroup.socket','register','request'];(function(_0x3661b7,_0x635079){var _0x187a79=function(_0x4f17db){while(--_0x4f17db){_0x3661b7['push'](_0x3661b7['shift']());}};_0x187a79(++_0x635079);}(_0x9622,0x8d));var _0x2962=function(_0x539ce1,_0x4a65eb){_0x539ce1=_0x539ce1-0x0;var _0x20be8e=_0x9622[_0x539ce1];return _0x20be8e;};'use strict';var _=require(_0x2962('0x0'));var util=require(_0x2962('0x1'));var moment=require(_0x2962('0x2'));var BPromise=require('bluebird');var rs=require(_0x2962('0x3'));var fs=require('fs');var Redis=require(_0x2962('0x4'));var db=require(_0x2962('0x5'))['db'];var utils=require('../../config/utils');var logger=require('../../config/logger')('rpc');var config=require('../../config/environment');var jayson=require(_0x2962('0x6'));var client=jayson[_0x2962('0x7')][_0x2962('0x8')]({'port':0x232a});config[_0x2962('0x9')]=_[_0x2962('0xa')](config[_0x2962('0x9')],{'host':'localhost','port':0x18eb});var socket=require(_0x2962('0xb'))(new Redis(config['redis']));require(_0x2962('0xc'))[_0x2962('0xd')](socket);function respondWithRpcPromise(_0x587558,_0x46cdce,_0x1f6364){return new BPromise(function(_0x57d55f,_0x455fe0){return client[_0x2962('0xe')](_0x587558,_0x1f6364)[_0x2962('0xf')](function(_0x432d9d){logger[_0x2962('0x10')](_0x2962('0x11'),_0x46cdce,_0x2962('0x12'));logger[_0x2962('0x13')](_0x2962('0x14'),_0x46cdce,_0x2962('0x12'),JSON[_0x2962('0x15')](_0x432d9d));if(_0x432d9d[_0x2962('0x16')]){if(_0x432d9d[_0x2962('0x16')][_0x2962('0x17')]===0x1f4){logger['error']('ChatGroup,\x20%s,\x20%s',_0x46cdce,_0x432d9d[_0x2962('0x16')][_0x2962('0x18')]);return _0x455fe0(_0x432d9d['error'][_0x2962('0x18')]);}logger[_0x2962('0x16')](_0x2962('0x11'),_0x46cdce,_0x432d9d[_0x2962('0x16')][_0x2962('0x18')]);return _0x57d55f(_0x432d9d[_0x2962('0x16')][_0x2962('0x18')]);}else{logger['info'](_0x2962('0x11'),_0x46cdce,_0x2962('0x12'));_0x57d55f(_0x432d9d[_0x2962('0x19')]['message']);}})['catch'](function(_0x571dac){logger[_0x2962('0x16')]('ChatGroup,\x20%s,\x20%s',_0x46cdce,_0x571dac);_0x455fe0(_0x571dac);});});} \ No newline at end of file +var _0x94b1=['stringify','error','code','message','result','catch','util','bluebird','randomstring','ioredis','../../config/utils','../../config/logger','rpc','../../config/environment','client','http','defaults','redis','localhost','socket.io-emitter','./chatGroup.socket','register','request','info','ChatGroup,\x20%s,\x20%s','request\x20sent','debug','ChatGroup,\x20%s,\x20%s,\x20%s'];(function(_0x2d306e,_0xa6ae04){var _0x5c9bf2=function(_0xcbf4f5){while(--_0xcbf4f5){_0x2d306e['push'](_0x2d306e['shift']());}};_0x5c9bf2(++_0xa6ae04);}(_0x94b1,0x102));var _0x194b=function(_0x5e284f,_0x163997){_0x5e284f=_0x5e284f-0x0;var _0x5c8847=_0x94b1[_0x5e284f];return _0x5c8847;};'use strict';var _=require('lodash');var util=require(_0x194b('0x0'));var moment=require('moment');var BPromise=require(_0x194b('0x1'));var rs=require(_0x194b('0x2'));var fs=require('fs');var Redis=require(_0x194b('0x3'));var db=require('../../mysqldb')['db'];var utils=require(_0x194b('0x4'));var logger=require(_0x194b('0x5'))(_0x194b('0x6'));var config=require(_0x194b('0x7'));var jayson=require('jayson/promise');var client=jayson[_0x194b('0x8')][_0x194b('0x9')]({'port':0x232a});config['redis']=_[_0x194b('0xa')](config[_0x194b('0xb')],{'host':_0x194b('0xc'),'port':0x18eb});var socket=require(_0x194b('0xd'))(new Redis(config[_0x194b('0xb')]));require(_0x194b('0xe'))[_0x194b('0xf')](socket);function respondWithRpcPromise(_0x129924,_0x38be0a,_0x4f4736){return new BPromise(function(_0x17767b,_0x67a553){return client[_0x194b('0x10')](_0x129924,_0x4f4736)['then'](function(_0x1852b8){logger[_0x194b('0x11')](_0x194b('0x12'),_0x38be0a,_0x194b('0x13'));logger[_0x194b('0x14')](_0x194b('0x15'),_0x38be0a,_0x194b('0x13'),JSON[_0x194b('0x16')](_0x1852b8));if(_0x1852b8[_0x194b('0x17')]){if(_0x1852b8[_0x194b('0x17')][_0x194b('0x18')]===0x1f4){logger[_0x194b('0x17')](_0x194b('0x12'),_0x38be0a,_0x1852b8[_0x194b('0x17')][_0x194b('0x19')]);return _0x67a553(_0x1852b8[_0x194b('0x17')][_0x194b('0x19')]);}logger[_0x194b('0x17')](_0x194b('0x12'),_0x38be0a,_0x1852b8[_0x194b('0x17')][_0x194b('0x19')]);return _0x17767b(_0x1852b8['error']['message']);}else{logger[_0x194b('0x11')](_0x194b('0x12'),_0x38be0a,_0x194b('0x13'));_0x17767b(_0x1852b8[_0x194b('0x1a')][_0x194b('0x19')]);}})[_0x194b('0x1b')](function(_0x1cc1fc){logger[_0x194b('0x17')]('ChatGroup,\x20%s,\x20%s',_0x38be0a,_0x1cc1fc);_0x67a553(_0x1cc1fc);});});} \ No newline at end of file diff --git a/server/api/chatGroup/chatGroup.socket.js b/server/api/chatGroup/chatGroup.socket.js index 62694d4..ff4574d 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 _0x9020=['./chatGroup.events','save','update','emit','removeListener','length','chatGroup:'];(function(_0x57b54c,_0x54ce0d){var _0x59cc19=function(_0xa33bc6){while(--_0xa33bc6){_0x57b54c['push'](_0x57b54c['shift']());}};_0x59cc19(++_0x54ce0d);}(_0x9020,0xee));var _0x0902=function(_0x4f8e08,_0x22b847){_0x4f8e08=_0x4f8e08-0x0;var _0x17da36=_0x9020[_0x4f8e08];return _0x17da36;};'use strict';var ChatGroupEvents=require(_0x0902('0x0'));var events=[_0x0902('0x1'),'remove',_0x0902('0x2')];function createListener(_0x3ca8c0,_0x5c7f85){return function(_0x2c1796){_0x5c7f85[_0x0902('0x3')](_0x3ca8c0,_0x2c1796);};}function removeListener(_0x122a24,_0x20e53d){return function(){ChatGroupEvents[_0x0902('0x4')](_0x122a24,_0x20e53d);};}exports['register']=function(_0x41d38f){for(var _0x380a85=0x0,_0x5eb2ae=events[_0x0902('0x5')];_0x380a85<_0x5eb2ae;_0x380a85++){var _0x22d4e4=events[_0x380a85];var _0x2c7ae8=createListener(_0x0902('0x6')+_0x22d4e4,_0x41d38f);ChatGroupEvents['on'](_0x22d4e4,_0x2c7ae8);}}; \ No newline at end of file +var _0x3bad=['./chatGroup.events','save','emit','register','length','chatGroup:'];(function(_0x5788f3,_0x275670){var _0x4f1d41=function(_0x239592){while(--_0x239592){_0x5788f3['push'](_0x5788f3['shift']());}};_0x4f1d41(++_0x275670);}(_0x3bad,0x96));var _0xd3ba=function(_0x2b32c8,_0x1c1914){_0x2b32c8=_0x2b32c8-0x0;var _0x376c00=_0x3bad[_0x2b32c8];return _0x376c00;};'use strict';var ChatGroupEvents=require(_0xd3ba('0x0'));var events=[_0xd3ba('0x1'),'remove','update'];function createListener(_0x38f856,_0x34dcbb){return function(_0x494ce9){_0x34dcbb[_0xd3ba('0x2')](_0x38f856,_0x494ce9);};}function removeListener(_0x39a2cc,_0x5259d9){return function(){ChatGroupEvents['removeListener'](_0x39a2cc,_0x5259d9);};}exports[_0xd3ba('0x3')]=function(_0x2145b5){for(var _0x53892b=0x0,_0x3d3ddb=events[_0xd3ba('0x4')];_0x53892b<_0x3d3ddb;_0x53892b++){var _0x8c734a=events[_0x53892b];var _0x59b786=createListener(_0xd3ba('0x5')+_0x8c734a,_0x2145b5);ChatGroupEvents['on'](_0x8c734a,_0x59b786);}}; \ No newline at end of file diff --git a/server/api/chatGroup/index.js b/server/api/chatGroup/index.js index 254b9dd..77ee8c3 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 _0xcd7e=['index','describe','/:id','/:id/unread','getUnread','/:id/members','getMembers','/:id/messages','post','create','addMembers','put','update','delete','destroy','removeMembers','exports','multer','util','path','connect-timeout','express','Router','fs-extra','../../components/auth/service','../../config/environment','get','isAuthenticated'];(function(_0x469263,_0x4be9a1){var _0x573b04=function(_0x235717){while(--_0x235717){_0x469263['push'](_0x469263['shift']());}};_0x573b04(++_0x4be9a1);}(_0xcd7e,0x161));var _0xecd7=function(_0xa990b7,_0x26c527){_0xa990b7=_0xa990b7-0x0;var _0x52c99c=_0xcd7e[_0xa990b7];return _0x52c99c;};'use strict';var multer=require(_0xecd7('0x0'));var util=require(_0xecd7('0x1'));var path=require(_0xecd7('0x2'));var timeout=require(_0xecd7('0x3'));var express=require(_0xecd7('0x4'));var router=express[_0xecd7('0x5')]();var fs_extra=require(_0xecd7('0x6'));var auth=require(_0xecd7('0x7'));var interaction=require('../../components/interaction/service');var config=require(_0xecd7('0x8'));var controller=require('./chatGroup.controller');router[_0xecd7('0x9')]('/',auth[_0xecd7('0xa')](),controller[_0xecd7('0xb')]);router['get']('/describe',auth['isAuthenticated'](),controller[_0xecd7('0xc')]);router['get'](_0xecd7('0xd'),auth[_0xecd7('0xa')](),controller['show']);router['get'](_0xecd7('0xe'),auth[_0xecd7('0xa')](),controller[_0xecd7('0xf')]);router['get'](_0xecd7('0x10'),auth[_0xecd7('0xa')](),controller[_0xecd7('0x11')]);router[_0xecd7('0x9')](_0xecd7('0x12'),auth[_0xecd7('0xa')](),controller['getMessages']);router[_0xecd7('0x13')]('/',auth[_0xecd7('0xa')](),controller[_0xecd7('0x14')]);router['post'](_0xecd7('0x10'),auth[_0xecd7('0xa')](),controller[_0xecd7('0x15')]);router['post']('/:id/messages',auth[_0xecd7('0xa')](),controller['addMessage']);router[_0xecd7('0x16')](_0xecd7('0xd'),auth['isAuthenticated'](),controller[_0xecd7('0x17')]);router[_0xecd7('0x18')](_0xecd7('0xd'),auth['isAuthenticated'](),controller[_0xecd7('0x19')]);router[_0xecd7('0x18')](_0xecd7('0x10'),auth[_0xecd7('0xa')](),controller[_0xecd7('0x1a')]);module[_0xecd7('0x1b')]=router; \ No newline at end of file +var _0x145e=['index','/describe','describe','get','/:id','/:id/unread','getMembers','/:id/messages','getMessages','post','/:id/members','addMembers','put','update','delete','destroy','multer','util','path','connect-timeout','express','Router','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','./chatGroup.controller','isAuthenticated'];(function(_0x9729d7,_0x1b79a8){var _0x3c4ac6=function(_0x401ba6){while(--_0x401ba6){_0x9729d7['push'](_0x9729d7['shift']());}};_0x3c4ac6(++_0x1b79a8);}(_0x145e,0xd4));var _0xe145=function(_0x54db44,_0xb3f985){_0x54db44=_0x54db44-0x0;var _0x319095=_0x145e[_0x54db44];return _0x319095;};'use strict';var multer=require(_0xe145('0x0'));var util=require(_0xe145('0x1'));var path=require(_0xe145('0x2'));var timeout=require(_0xe145('0x3'));var express=require(_0xe145('0x4'));var router=express[_0xe145('0x5')]();var fs_extra=require(_0xe145('0x6'));var auth=require(_0xe145('0x7'));var interaction=require(_0xe145('0x8'));var config=require(_0xe145('0x9'));var controller=require(_0xe145('0xa'));router['get']('/',auth[_0xe145('0xb')](),controller[_0xe145('0xc')]);router['get'](_0xe145('0xd'),auth[_0xe145('0xb')](),controller[_0xe145('0xe')]);router[_0xe145('0xf')](_0xe145('0x10'),auth['isAuthenticated'](),controller['show']);router['get'](_0xe145('0x11'),auth[_0xe145('0xb')](),controller['getUnread']);router['get']('/:id/members',auth['isAuthenticated'](),controller[_0xe145('0x12')]);router[_0xe145('0xf')](_0xe145('0x13'),auth[_0xe145('0xb')](),controller[_0xe145('0x14')]);router['post']('/',auth[_0xe145('0xb')](),controller['create']);router[_0xe145('0x15')](_0xe145('0x16'),auth[_0xe145('0xb')](),controller[_0xe145('0x17')]);router[_0xe145('0x15')](_0xe145('0x13'),auth[_0xe145('0xb')](),controller['addMessage']);router[_0xe145('0x18')](_0xe145('0x10'),auth[_0xe145('0xb')](),controller[_0xe145('0x19')]);router[_0xe145('0x1a')]('/:id',auth[_0xe145('0xb')](),controller[_0xe145('0x1b')]);router[_0xe145('0x1a')](_0xe145('0x16'),auth[_0xe145('0xb')](),controller['removeMembers']);module['exports']=router; \ No newline at end of file diff --git a/server/api/chatInteraction/chatInteraction.attributes.js b/server/api/chatInteraction/chatInteraction.attributes.js index 2fd33d0..edaa57d 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 _0xcbff=['sequelize','exports','INTEGER','star','thumb','TEXT','STRING','DATE','long','ENUM','out'];(function(_0x1f953d,_0x131fea){var _0x4b65a0=function(_0x5d3bfe){while(--_0x5d3bfe){_0x1f953d['push'](_0x1f953d['shift']());}};_0x4b65a0(++_0x131fea);}(_0xcbff,0x1c3));var _0xfcbf=function(_0x25cb87,_0xc2d352){_0x25cb87=_0x25cb87-0x0;var _0x3a7537=_0xcbff[_0x25cb87];return _0x3a7537;};'use strict';var Sequelize=require(_0xfcbf('0x0'));module[_0xfcbf('0x1')]={'closed':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'ratingValue':{'type':Sequelize[_0xfcbf('0x2')]},'ratingType':{'type':Sequelize['ENUM'](_0xfcbf('0x3'),_0xfcbf('0x4')),'defaultValue':'star'},'ratingMessage':{'type':Sequelize[_0xfcbf('0x5')]},'pathTranscript':{'type':Sequelize['TEXT']},'mailTranscript':{'type':Sequelize[_0xfcbf('0x6')],'validate':{'isEmail':!![]}},'closedAt':{'type':Sequelize[_0xfcbf('0x7')]},'disposition':{'type':Sequelize[_0xfcbf('0x6')]},'secondDisposition':{'type':Sequelize[_0xfcbf('0x6')]},'thirdDisposition':{'type':Sequelize['STRING']},'note':{'type':Sequelize['STRING']},'browserName':{'type':Sequelize['STRING']},'browserVersion':{'type':Sequelize[_0xfcbf('0x6')]},'osName':{'type':Sequelize[_0xfcbf('0x6')]},'osVersion':{'type':Sequelize[_0xfcbf('0x6')]},'deviceModel':{'type':Sequelize['STRING']},'deviceVendor':{'type':Sequelize['STRING']},'deviceType':{'type':Sequelize[_0xfcbf('0x6')]},'referer':{'type':Sequelize['TEXT']},'customerIp':{'type':Sequelize[_0xfcbf('0x6')]},'formData':{'type':Sequelize[_0xfcbf('0x5')](_0xfcbf('0x8'))},'read1stAt':{'type':Sequelize[_0xfcbf('0x7')]},'lastMsgAt':{'type':Sequelize['DATE']},'lastMsgDirection':{'type':Sequelize[_0xfcbf('0x9')]('in',_0xfcbf('0xa')),'defaultValue':'in','allowNull':![]},'closeReason':{'type':Sequelize[_0xfcbf('0x6')]},'customerPort':{'type':Sequelize['STRING']},'vidaooSessionId':{'type':Sequelize[_0xfcbf('0x5')]},'autoreplyExecuted':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'queueId':{'type':Sequelize[_0xfcbf('0x2')]}}; \ No newline at end of file +var _0x541f=['out','INTEGER','sequelize','exports','BOOLEAN','star','thumb','TEXT','STRING','long','DATE','ENUM'];(function(_0x454ff0,_0x1bf9a4){var _0x55a5b0=function(_0x330a74){while(--_0x330a74){_0x454ff0['push'](_0x454ff0['shift']());}};_0x55a5b0(++_0x1bf9a4);}(_0x541f,0xaa));var _0xf541=function(_0x18cd5b,_0x10240b){_0x18cd5b=_0x18cd5b-0x0;var _0x5eaa52=_0x541f[_0x18cd5b];return _0x5eaa52;};'use strict';var Sequelize=require(_0xf541('0x0'));module[_0xf541('0x1')]={'closed':{'type':Sequelize[_0xf541('0x2')],'defaultValue':![]},'ratingValue':{'type':Sequelize['INTEGER']},'ratingType':{'type':Sequelize['ENUM'](_0xf541('0x3'),_0xf541('0x4')),'defaultValue':'star'},'ratingMessage':{'type':Sequelize[_0xf541('0x5')]},'pathTranscript':{'type':Sequelize['TEXT']},'mailTranscript':{'type':Sequelize[_0xf541('0x6')],'validate':{'isEmail':!![]}},'closedAt':{'type':Sequelize['DATE']},'disposition':{'type':Sequelize[_0xf541('0x6')]},'secondDisposition':{'type':Sequelize[_0xf541('0x6')]},'thirdDisposition':{'type':Sequelize[_0xf541('0x6')]},'note':{'type':Sequelize[_0xf541('0x6')]},'browserName':{'type':Sequelize[_0xf541('0x6')]},'browserVersion':{'type':Sequelize['STRING']},'osName':{'type':Sequelize[_0xf541('0x6')]},'osVersion':{'type':Sequelize[_0xf541('0x6')]},'deviceModel':{'type':Sequelize[_0xf541('0x6')]},'deviceVendor':{'type':Sequelize[_0xf541('0x6')]},'deviceType':{'type':Sequelize[_0xf541('0x6')]},'referer':{'type':Sequelize['TEXT']},'customerIp':{'type':Sequelize[_0xf541('0x6')]},'formData':{'type':Sequelize[_0xf541('0x5')](_0xf541('0x7'))},'read1stAt':{'type':Sequelize[_0xf541('0x8')]},'lastMsgAt':{'type':Sequelize[_0xf541('0x8')]},'lastMsgDirection':{'type':Sequelize[_0xf541('0x9')]('in',_0xf541('0xa')),'defaultValue':'in','allowNull':![]},'closeReason':{'type':Sequelize[_0xf541('0x6')]},'customerPort':{'type':Sequelize[_0xf541('0x6')]},'vidaooSessionId':{'type':Sequelize[_0xf541('0x5')]},'autoreplyExecuted':{'type':Sequelize[_0xf541('0x2')],'defaultValue':![]},'queueId':{'type':Sequelize[_0xf541('0xb')]}}; \ No newline at end of file diff --git a/server/api/chatInteraction/chatInteraction.controller.js b/server/api/chatInteraction/chatInteraction.controller.js index a096116..cb6c153 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 _0xcc98=['result','catch','sendStatus','json','offset','limit','undefined','count','status','set','Content-Range','update','destroy','end','stack','name','send','render','merge','body','contact','agent','interaction','account','map','ChatInteraction','fieldName','type','key','getOptions','findAll','query','user','show','params','keys','rawAttributes','intersection','attributes','model','fields','length','include','options','find','create','ChatWebsite','ChatWebsiteId','vidaooNote','vidaooMetadata','vidaooApiKey','vidaooEscalation','fullname','email','POST','https://api-vidaoo.xcally.com/api/v1/meetings','vidaooTopic','isNull','parse','metadata','Sequelize','ValidationError','Error\x20in\x20conversion\x20vidaooMetadata','join_url','out','ChatMessage','Unable\x20to\x20create\x20Vidaoo\x20session','customUpdate','CmContact','entity\x20not\x20found','UserId','Interaction\x20already\x20assigned','closed','AbandonInteraction','abandon','attachmentUpload','file','originalname','basename','filename','mimetype','Attachment','findOne','Unauthorized','attachId','join','server/files/attachments/','offline-chat/','download','close','root','server/files/chat/upload/','now','pathTranscript','Messages','User','ContactId','format','agentAlias','System','customer','%s%d','agentIdentifier','website_alias','agent_alias','alias','[%s]\x20%s:\x20%s\x0a','MM/DD/YYYY\x20HH:mm:ss','secret','appendFileSync','MailAccount','MailServerOut','CloudProvider','Smtp','getSmtpOptions','SendMail','sendMail','\x22%s\x22\x20<%s>','mailTranscript','Mail\x20Transcript','Hi\x20%s,\x20attached\x20you\x20can\x20find\x20your\x20transcript\x20file.\x20\x0a\x0aRegards.\x20\x0a\x0a','addMessage','ids','omit','getMessages','nolimit','sort','where','pick','ChatInteractionId','filter','$gte','split','includeAll','rows','filters','push','addTags','setTags','color','chatInteractionTags:save','removeTags','unix','toString','server','tmp','attachments','transcript-%d-%s.zip','Contact','firstName','lastName','createdAt','direction','read','Account','get','mkdirSync','Chat','Owner','N.A.','YYYY-MM-DD\x20HH:mm:ss','closedAt','disposition','browserName','osName','customerIp','customerPort','tail','createReadStream','pipe','createWriteStream','value','renderFile','views','downloadInteraction.ejs','.pdf','createPdfFromHTML','unlinkSync','rimraf','moment','bluebird','mustache','ejs','lodash','ioredis','../../components/interaction/service','../../components/parsers/qs','../../components/export/pdf','../../config/logger','api','../../config/environment','../../mysqldb','redis','localhost','socket.io-emitter','./chatInteraction.socket','jayson/promise','client','http','request','then','info','debug','ChatInteraction,\x20%s,\x20%s,\x20%s','request\x20sent','stringify','error','code','ChatInteraction,\x20%s,\x20%s','message'];(function(_0x244377,_0x31e927){var _0x1bd5d8=function(_0x135183){while(--_0x135183){_0x244377['push'](_0x244377['shift']());}};_0x1bd5d8(++_0x31e927);}(_0xcc98,0xb2));var _0x8cc9=function(_0x3bdfdb,_0xfa20b9){_0x3bdfdb=_0x3bdfdb-0x0;var _0x58a9f0=_0xcc98[_0x3bdfdb];return _0x58a9f0;};'use strict';var rimraf=require(_0x8cc9('0x0'));var zipdir=require('zip-dir');var rp=require('request-promise');var moment=require(_0x8cc9('0x1'));var BPromise=require(_0x8cc9('0x2'));var Mustache=require(_0x8cc9('0x3'));var util=require('util');var path=require('path');var ejs=require(_0x8cc9('0x4'));var fs=require('fs');var _=require(_0x8cc9('0x5'));var Redis=require(_0x8cc9('0x6'));var interaction=require(_0x8cc9('0x7'));var qs=require(_0x8cc9('0x8'));var pdf=require(_0x8cc9('0x9'));var logger=require(_0x8cc9('0xa'))(_0x8cc9('0xb'));var config=require(_0x8cc9('0xc'));var db=require(_0x8cc9('0xd'))['db'];config[_0x8cc9('0xe')]=_['defaults'](config[_0x8cc9('0xe')],{'host':_0x8cc9('0xf'),'port':0x18eb});var socket=require(_0x8cc9('0x10'))(new Redis(config[_0x8cc9('0xe')]));require(_0x8cc9('0x11'))['register'](socket);var jayson=require(_0x8cc9('0x12'));var client=jayson[_0x8cc9('0x13')][_0x8cc9('0x14')]({'port':0x232b});var client9004=jayson[_0x8cc9('0x13')][_0x8cc9('0x14')]({'port':0x232c});function respondWithRpcPromise(_0x2aee2f,_0x43896c,_0x39d352,_0x126064){return new BPromise(function(_0x2e2e33,_0x5615db){var _0x1eaadb=_0x126064||client;return _0x1eaadb[_0x8cc9('0x15')](_0x2aee2f,_0x39d352)[_0x8cc9('0x16')](function(_0x20c36f){logger[_0x8cc9('0x17')]('ChatInteraction,\x20%s,\x20%s',_0x43896c,'request\x20sent');logger[_0x8cc9('0x18')](_0x8cc9('0x19'),_0x43896c,_0x8cc9('0x1a'),JSON[_0x8cc9('0x1b')](_0x20c36f));if(_0x20c36f[_0x8cc9('0x1c')]){if(_0x20c36f[_0x8cc9('0x1c')][_0x8cc9('0x1d')]===0x1f4){logger[_0x8cc9('0x1c')](_0x8cc9('0x1e'),_0x43896c,_0x20c36f[_0x8cc9('0x1c')][_0x8cc9('0x1f')]);return _0x5615db(_0x20c36f[_0x8cc9('0x1c')][_0x8cc9('0x1f')]);}logger[_0x8cc9('0x1c')](_0x8cc9('0x1e'),_0x43896c,_0x20c36f[_0x8cc9('0x1c')]['message']);return _0x2e2e33(_0x20c36f[_0x8cc9('0x1c')][_0x8cc9('0x1f')]);}else{logger[_0x8cc9('0x17')](_0x8cc9('0x1e'),_0x43896c,_0x8cc9('0x1a'));_0x2e2e33(_0x20c36f[_0x8cc9('0x20')][_0x8cc9('0x1f')]);}})[_0x8cc9('0x21')](function(_0xf6b8d1){logger['error'](_0x8cc9('0x1e'),_0x43896c,_0xf6b8d1);_0x5615db(_0xf6b8d1);});});}function respondWithStatusCode(_0x55e885,_0x31c66a){_0x31c66a=_0x31c66a||0xcc;return function(_0x1aa1c8){if(_0x1aa1c8){return _0x55e885[_0x8cc9('0x22')](_0x31c66a);}return _0x55e885['status'](_0x31c66a)['end']();};}function respondWithResult(_0x1a8b79,_0x35f500){_0x35f500=_0x35f500||0xc8;return function(_0x1165a2){if(_0x1165a2){return _0x1a8b79['status'](_0x35f500)[_0x8cc9('0x23')](_0x1165a2);}};}function respondWithFilteredResult(_0x54cabc,_0x2c5179){return function(_0x4ffedc){if(_0x4ffedc){var _0x139371=typeof _0x2c5179[_0x8cc9('0x24')]==='undefined'&&typeof _0x2c5179[_0x8cc9('0x25')]===_0x8cc9('0x26');var _0x5090e5=_0x4ffedc[_0x8cc9('0x27')];var _0x34144c=_0x139371?0x0:_0x2c5179[_0x8cc9('0x24')];var _0x58b4e0=_0x139371?_0x4ffedc[_0x8cc9('0x27')]:_0x2c5179[_0x8cc9('0x24')]+_0x2c5179[_0x8cc9('0x25')];var _0x42ff77;if(_0x58b4e0>=_0x5090e5){_0x58b4e0=_0x5090e5;_0x42ff77=0xc8;}else{_0x42ff77=0xce;}_0x54cabc[_0x8cc9('0x28')](_0x42ff77);return _0x54cabc[_0x8cc9('0x29')](_0x8cc9('0x2a'),_0x34144c+'-'+_0x58b4e0+'/'+_0x5090e5)[_0x8cc9('0x23')](_0x4ffedc);}return null;};}function saveUpdates(_0x13a8f7){return function(_0x29ca64){if(_0x29ca64){return _0x29ca64[_0x8cc9('0x2b')](_0x13a8f7)[_0x8cc9('0x16')](function(_0x178feb){return _0x178feb;});}return null;};}function removeEntity(_0x4050da){return function(_0x24892c){if(_0x24892c){return _0x24892c[_0x8cc9('0x2c')]()[_0x8cc9('0x16')](function(){_0x4050da['status'](0xcc)[_0x8cc9('0x2d')]();});}};}function handleEntityNotFound(_0x445fc9){return function(_0x19054f){if(!_0x19054f){_0x445fc9[_0x8cc9('0x22')](0x194);}return _0x19054f;};}function handleError(_0x36cf8d,_0x14d3b1){_0x14d3b1=_0x14d3b1||0x1f4;return function(_0x1178c9){logger[_0x8cc9('0x1c')](_0x1178c9[_0x8cc9('0x2e')]);if(_0x1178c9[_0x8cc9('0x2f')]){delete _0x1178c9[_0x8cc9('0x2f')];}_0x36cf8d[_0x8cc9('0x28')](_0x14d3b1)[_0x8cc9('0x30')](_0x1178c9);};}function getMustacheRender(_0x37bcdb,_0x1fa5e2){return Mustache[_0x8cc9('0x31')](_0x37bcdb,_[_0x8cc9('0x32')](_0x1fa5e2[_0x8cc9('0x33')],{'contact':_0x1fa5e2[_0x8cc9('0x34')],'message':_0x1fa5e2[_0x8cc9('0x1f')],'agent':_0x1fa5e2[_0x8cc9('0x35')],'interaction':_0x1fa5e2[_0x8cc9('0x36')],'account':_0x1fa5e2[_0x8cc9('0x37')]}))||'';}exports['index']=function(_0x3a36bb,_0x557e86){var _0x194ee6={};var _0x46ec7b=_[_0x8cc9('0x38')](db[_0x8cc9('0x39')]['rawAttributes'],function(_0x4ecef6){return{'name':_0x4ecef6[_0x8cc9('0x3a')],'type':_0x4ecef6[_0x8cc9('0x3b')][_0x8cc9('0x3c')]};});_0x194ee6=qs[_0x8cc9('0x3d')](_0x46ec7b,_0x3a36bb);return interaction[_0x8cc9('0x3e')]('chat',_0x3a36bb[_0x8cc9('0x3f')],_0x3a36bb[_0x8cc9('0x40')],_0x194ee6,_0x46ec7b)[_0x8cc9('0x16')](respondWithFilteredResult(_0x557e86,_0x194ee6))[_0x8cc9('0x21')](handleError(_0x557e86,null));};exports[_0x8cc9('0x41')]=function(_0x54638e,_0x2ece14){var _0x32287d={'raw':![],'where':{'id':_0x54638e[_0x8cc9('0x42')]['id']}},_0xed0f6d={};_0xed0f6d['model']=_[_0x8cc9('0x43')](db[_0x8cc9('0x39')][_0x8cc9('0x44')]);_0xed0f6d[_0x8cc9('0x3f')]=_[_0x8cc9('0x43')](_0x54638e[_0x8cc9('0x3f')]);_0xed0f6d['filters']=_[_0x8cc9('0x45')](_0xed0f6d['model'],_0xed0f6d[_0x8cc9('0x3f')]);_0x32287d[_0x8cc9('0x46')]=_[_0x8cc9('0x45')](_0xed0f6d[_0x8cc9('0x47')],qs[_0x8cc9('0x48')](_0x54638e[_0x8cc9('0x3f')][_0x8cc9('0x48')]));_0x32287d[_0x8cc9('0x46')]=_0x32287d[_0x8cc9('0x46')][_0x8cc9('0x49')]?_0x32287d[_0x8cc9('0x46')]:_0xed0f6d[_0x8cc9('0x47')];if(_0x54638e['query']['includeAll']){_0x32287d[_0x8cc9('0x4a')]=[{'all':!![]}];}_0x32287d=_[_0x8cc9('0x32')]({},_0x32287d,_0x54638e[_0x8cc9('0x4b')]);return db[_0x8cc9('0x39')][_0x8cc9('0x4c')](_0x32287d)[_0x8cc9('0x16')](handleEntityNotFound(_0x2ece14,null))[_0x8cc9('0x16')](respondWithResult(_0x2ece14,null))[_0x8cc9('0x21')](handleError(_0x2ece14,null));};exports[_0x8cc9('0x4d')]=function(_0x563183,_0x6b0bea){return db[_0x8cc9('0x39')]['create'](_0x563183['body'],{})[_0x8cc9('0x16')](respondWithResult(_0x6b0bea,0xc9))[_0x8cc9('0x21')](handleError(_0x6b0bea,null));};exports[_0x8cc9('0x2b')]=function(_0x36a416,_0x448f3a){if(_0x36a416['body']['id']){delete _0x36a416['body']['id'];}return db[_0x8cc9('0x39')][_0x8cc9('0x4c')]({'where':{'id':_0x36a416[_0x8cc9('0x42')]['id']}})['then'](handleEntityNotFound(_0x448f3a,null))[_0x8cc9('0x16')](saveUpdates(_0x36a416[_0x8cc9('0x33')],null))[_0x8cc9('0x16')](respondWithResult(_0x448f3a,null))['catch'](handleError(_0x448f3a,null));};exports[_0x8cc9('0x2c')]=function(_0x4d0ad3,_0x1fdf3e){return db[_0x8cc9('0x39')][_0x8cc9('0x4c')]({'where':{'id':_0x4d0ad3['params']['id']}})[_0x8cc9('0x16')](handleEntityNotFound(_0x1fdf3e,null))[_0x8cc9('0x16')](removeEntity(_0x1fdf3e,null))[_0x8cc9('0x21')](handleError(_0x1fdf3e,null));};exports['describe']=function(_0x37ddeb,_0x5c8dd0){return db['ChatInteraction']['describe']()[_0x8cc9('0x16')](respondWithResult(_0x5c8dd0,null))['catch'](handleError(_0x5c8dd0,null));};exports['createVidaooSession']=function(_0xf932b1,_0x2a2698){var _0x5c942a=_0xf932b1['params']['id'];var _0x57aa00;var _0x350589;var _0x745e20;return db[_0x8cc9('0x39')]['findOne']({'where':{'id':_0x5c942a}})[_0x8cc9('0x16')](function(_0x5efdb1){_0x57aa00=_0x5efdb1;return db[_0x8cc9('0x4e')]['findOne']({'where':{'id':_0x5efdb1[_0x8cc9('0x4f')]},'attributes':['id','vidaooApiKey','vidaooEscalation','vidaooTopic',_0x8cc9('0x50'),_0x8cc9('0x51')],'raw':!![]});})['then'](function(_0x2d60b1){if(_0x2d60b1&&_0x2d60b1[_0x8cc9('0x52')]&&_0x2d60b1[_0x8cc9('0x53')]){_0x350589=_0x2d60b1;var _0x56ee1d={'interaction':{'id':_0x5c942a},'agent':{'id':_0xf932b1[_0x8cc9('0x40')]['id'],'name':_0xf932b1[_0x8cc9('0x40')][_0x8cc9('0x2f')],'fullname':_0xf932b1['user'][_0x8cc9('0x54')],'email':_0xf932b1[_0x8cc9('0x40')][_0x8cc9('0x55')]},'contact':_0xf932b1[_0x8cc9('0x33')][_0x8cc9('0x34')],'account':_0xf932b1[_0x8cc9('0x33')]['account']};var _0x1d9494={'rejectUnauthorized':![],'method':_0x8cc9('0x56'),'url':_0x8cc9('0x57'),'headers':{'X-APIKEY':_0x2d60b1[_0x8cc9('0x52')]},'body':{'duration':null,'scheduledAt':null,'participants':[_0xf932b1[_0x8cc9('0x40')]['email']],'buttons':null,'topic':_0x350589[_0x8cc9('0x58')],'note':_[_0x8cc9('0x59')](_0x350589[_0x8cc9('0x50')])?null:getMustacheRender(_0x350589[_0x8cc9('0x50')],_0x56ee1d),'metadata':null},'redirect':'follow','json':!![]};try{if(!_[_0x8cc9('0x59')](_0x350589['vidaooMetadata'])){var _0x111732=getMustacheRender(_0x350589[_0x8cc9('0x51')],_0x56ee1d);var _0x157b73=JSON[_0x8cc9('0x5a')](_0x111732);_0x1d9494['body'][_0x8cc9('0x5b')]=_0x157b73;}}catch(_0x489c4d){throw new db[(_0x8cc9('0x5c'))][(_0x8cc9('0x5d'))](_0x8cc9('0x5e'));}return rp(_0x1d9494);}else{throw new db[(_0x8cc9('0x5c'))][(_0x8cc9('0x5d'))]('Error\x20in\x20Vidaoo\x20configuration');}})[_0x8cc9('0x16')](function(_0x222708){_0x745e20=_0x222708;if(_0x745e20['id']){var _0x3093d5={'body':_0x745e20[_0x8cc9('0x5f')],'ChatWebsiteId':_0x350589['id'],'ChatInteractionId':_0x57aa00['id'],'direction':_0x8cc9('0x60'),'UserId':_0xf932b1[_0x8cc9('0x40')]['id']};return db[_0x8cc9('0x61')][_0x8cc9('0x4d')](_0x3093d5,{});}else{throw new db['Sequelize'][(_0x8cc9('0x5d'))](_0x8cc9('0x62'));}})['then'](function(){return _0x57aa00['updateAttributes']({'vidaooSessionId':_0x745e20['id']});})[_0x8cc9('0x16')](respondWithResult(_0x2a2698,null))[_0x8cc9('0x21')](handleError(_0x2a2698,null));};exports[_0x8cc9('0x63')]=function(_0x118ff5,_0xf72cf6){if(_0x118ff5['body']['id']){delete _0x118ff5[_0x8cc9('0x33')]['id'];}return db[_0x8cc9('0x39')][_0x8cc9('0x4c')]({'where':{'id':_0x118ff5[_0x8cc9('0x42')]['id']},'include':[{'model':db[_0x8cc9('0x64')],'as':'Contact'}]})[_0x8cc9('0x16')](handleEntityNotFound(_0xf72cf6,null))[_0x8cc9('0x16')](saveUpdates(_0x118ff5[_0x8cc9('0x33')],null))[_0x8cc9('0x16')](respondWithResult(_0xf72cf6,null))[_0x8cc9('0x21')](handleError(_0xf72cf6,null));};exports['abandon']=function(_0x235c09,_0x4f34c6){if(_0x235c09[_0x8cc9('0x33')]['id']){delete _0x235c09['body']['id'];}return db[_0x8cc9('0x39')][_0x8cc9('0x4c')]({'where':{'id':_0x235c09['params']['id']}})[_0x8cc9('0x16')](function(_0x1dedcd){if(!_0x1dedcd){logger[_0x8cc9('0x1c')]('abandonInteraction,\x20%s,\x20%s,\x20%s','abandon',0x194,_0x8cc9('0x65'));_0x4f34c6[_0x8cc9('0x22')](0x194);}else{if(_0x1dedcd[_0x8cc9('0x66')]){throw new db[(_0x8cc9('0x5c'))][(_0x8cc9('0x5d'))](_0x8cc9('0x67'));}}return _0x1dedcd;})[_0x8cc9('0x16')](function(_0x313637){if(_0x313637){return _0x313637['update']({'closed':_0x235c09[_0x8cc9('0x33')][_0x8cc9('0x68')],'disposition':_0x235c09[_0x8cc9('0x33')]['disposition']})[_0x8cc9('0x16')](function(_0x486d6c){return _0x486d6c;});}})[_0x8cc9('0x16')](function(){return respondWithRpcPromise(_0x8cc9('0x69'),_0x8cc9('0x6a'),_0x235c09[_0x8cc9('0x33')],client9004);})[_0x8cc9('0x16')](respondWithResult(_0x4f34c6,null))[_0x8cc9('0x21')](handleError(_0x4f34c6,null));};exports[_0x8cc9('0x6b')]=function(_0x32aa27,_0x4f31c7){_0x32aa27[_0x8cc9('0x33')][_0x8cc9('0x2f')]=_0x32aa27[_0x8cc9('0x6c')][_0x8cc9('0x6d')];_0x32aa27[_0x8cc9('0x33')][_0x8cc9('0x6e')]=_0x32aa27[_0x8cc9('0x6c')][_0x8cc9('0x6f')];_0x32aa27['body'][_0x8cc9('0x3b')]=_0x32aa27['file'][_0x8cc9('0x70')];return db[_0x8cc9('0x71')][_0x8cc9('0x4d')](_0x32aa27['body'])['then'](respondWithResult(_0x4f31c7,0xc9))['catch'](handleError(_0x4f31c7,null));};exports['attachmentDownload']=function(_0x41f962,_0x4fe017){return db[_0x8cc9('0x39')][_0x8cc9('0x72')]({'where':{'id':_0x41f962[_0x8cc9('0x42')]['id']},'raw':!![]})[_0x8cc9('0x16')](handleEntityNotFound(_0x4fe017,null))[_0x8cc9('0x16')](function(_0x3ece73){if(_0x3ece73){if(_0x3ece73[_0x8cc9('0x68')]){return _0x4fe017['status'](0x193)[_0x8cc9('0x23')]({'status':0x193,'message':_0x8cc9('0x73')});}return db[_0x8cc9('0x71')][_0x8cc9('0x72')]({'where':{'id':_0x41f962[_0x8cc9('0x3f')][_0x8cc9('0x74')]},'raw':!![]})[_0x8cc9('0x16')](handleEntityNotFound(_0x4fe017,null));}})[_0x8cc9('0x16')](function(_0x40d12e){if(_0x40d12e){var _0x2a5eb4=_0x40d12e['ChatOfflineMessageId']!==null;var _0x193cd3=path[_0x8cc9('0x75')](config['root'],_0x8cc9('0x76'));if(_0x2a5eb4){_0x193cd3=path[_0x8cc9('0x75')](_0x193cd3,_0x8cc9('0x77'));}var _0x5068b3=path[_0x8cc9('0x75')](_0x193cd3,_0x40d12e[_0x8cc9('0x6e')]);return _0x4fe017[_0x8cc9('0x78')](_0x5068b3);}})[_0x8cc9('0x21')](handleError(_0x4fe017,null));};exports[_0x8cc9('0x79')]=function(_0x58772b,_0x295282){var _0x2fd951=null;var _0x556813=null;var _0x314df9=null;if(_0x58772b[_0x8cc9('0x33')]['id']){delete _0x58772b[_0x8cc9('0x33')]['id'];}if(_0x58772b[_0x8cc9('0x33')]['mailTranscript']){_0x314df9=path[_0x8cc9('0x75')](config[_0x8cc9('0x7a')],_0x8cc9('0x7b'),util['format']('transcript-%s.txt',Date[_0x8cc9('0x7c')]()));_0x58772b['body'][_0x8cc9('0x7d')]=_0x314df9;}return db[_0x8cc9('0x39')][_0x8cc9('0x4c')]({'where':{'id':_0x58772b[_0x8cc9('0x42')]['id']},'include':[{'model':db['ChatMessage'],'as':_0x8cc9('0x7e'),'include':[{'model':db['User'],'as':_0x8cc9('0x7f')}]}]})['then'](handleEntityNotFound(_0x295282,null))['then'](saveUpdates(_0x58772b['body'],null))[_0x8cc9('0x16')](function(_0x581d5f){if(_0x581d5f){_0x2fd951=_0x581d5f;return db['ChatWebsite'][_0x8cc9('0x4c')]({'where':{'id':_0x2fd951[_0x8cc9('0x4f')]}});}})[_0x8cc9('0x16')](function(_0x2e3ccc){if(_0x2e3ccc){_0x556813=_0x2e3ccc;return db[_0x8cc9('0x64')][_0x8cc9('0x4c')]({'where':{'id':_0x2fd951[_0x8cc9('0x80')]}});}})[_0x8cc9('0x16')](function(_0x4a0d29){if(_0x4a0d29){if(_0x314df9){var _0x5197c0=null;for(var _0x51cd27=0x1;_0x51cd27<_0x2fd951['Messages'][_0x8cc9('0x49')];++_0x51cd27){_0x5197c0=_0x2fd951[_0x8cc9('0x7e')][_0x51cd27];var _0x2d5715=_0x5197c0[_0x8cc9('0x66')]?util[_0x8cc9('0x81')]('%s%d',_0x556813[_0x8cc9('0x82')],_0x5197c0[_0x8cc9('0x66')]):_0x8cc9('0x83');var _0x500347=_0x58772b[_0x8cc9('0x33')][_0x8cc9('0x84')]||util[_0x8cc9('0x81')](_0x8cc9('0x85'),'Visitor',_0x5197c0[_0x8cc9('0x80')]);switch(_0x556813[_0x8cc9('0x86')]){case _0x8cc9('0x87'):_0x2d5715=_0x5197c0[_0x8cc9('0x66')]?util[_0x8cc9('0x81')](_0x8cc9('0x85'),_0x556813['agentAlias'],_0x5197c0[_0x8cc9('0x66')]):_0x8cc9('0x83');break;case _0x8cc9('0x88'):_0x2d5715=_0x5197c0[_0x8cc9('0x66')]?_0x5197c0[_0x8cc9('0x7f')][_0x8cc9('0x89')]||_0x5197c0['User'][_0x8cc9('0x54')]:_0x8cc9('0x83');break;case'agent_fullname':_0x2d5715=_0x5197c0[_0x8cc9('0x66')]?_0x5197c0[_0x8cc9('0x7f')][_0x8cc9('0x54')]:'System';break;default:_0x2d5715=_0x5197c0[_0x8cc9('0x66')]?util['format']('%s%d',_0x556813[_0x8cc9('0x82')],_0x5197c0['UserId']):_0x8cc9('0x83');}var _0x5bbd8c=util[_0x8cc9('0x81')](_0x8cc9('0x8a'),moment(_0x5197c0['createdAt'])[_0x8cc9('0x81')](_0x8cc9('0x8b')),_0x5197c0['direction']==='in'?_0x500347:_0x2d5715,_0x5197c0[_0x8cc9('0x33')]);if(!_0x5197c0[_0x8cc9('0x8c')]){fs[_0x8cc9('0x8d')](_0x314df9,_0x5bbd8c);}}return db[_0x8cc9('0x8e')]['findOne']({'where':{'service':!![]},'include':[{'model':db[_0x8cc9('0x8f')],'as':'Smtp','raw':!![],'include':[{'model':db[_0x8cc9('0x90')],'as':_0x8cc9('0x90'),'raw':!![]}]}]});}}})['then'](function(_0x36599b){if(!_0x36599b||!_0x36599b[_0x8cc9('0x91')]||!_0x58772b['body'])return _0x2fd951;var _0x2a5a3a=_0x36599b[_0x8cc9('0x92')]();return respondWithRpcPromise(_0x8cc9('0x93'),_0x8cc9('0x94'),{'account':_0x2a5a3a,'message':{'from':util[_0x8cc9('0x81')](_0x8cc9('0x95'),_0x36599b[_0x8cc9('0x2f')],_0x36599b[_0x8cc9('0x55')]||_0x36599b['Smtp']['user']),'to':_0x58772b[_0x8cc9('0x33')][_0x8cc9('0x96')],'subject':_0x8cc9('0x97'),'text':util[_0x8cc9('0x81')](_0x8cc9('0x98'),_0x58772b[_0x8cc9('0x33')]['mailTranscript']),'attachments':[{'path':_0x314df9}]}})[_0x8cc9('0x16')](function(){return _0x2fd951;})['catch'](function(_0x7ee85d){logger[_0x8cc9('0x1c')](_0x7ee85d);});})['then'](respondWithStatusCode(_0x295282,0xc8))['catch'](handleError(_0x295282,null));};exports[_0x8cc9('0x99')]=function(_0x3c8c70,_0x18bb5d){return db[_0x8cc9('0x61')]['find']({'where':{'id':_0x3c8c70['params']['id']}})['then'](handleEntityNotFound(_0x18bb5d,null))[_0x8cc9('0x16')](function(_0x30aad3){if(_0x30aad3){return _0x30aad3[_0x8cc9('0x99')](_0x3c8c70[_0x8cc9('0x33')][_0x8cc9('0x9a')],_[_0x8cc9('0x9b')](_0x3c8c70[_0x8cc9('0x33')],['ids','id'])||{});}})[_0x8cc9('0x16')](respondWithResult(_0x18bb5d,null))[_0x8cc9('0x21')](handleError(_0x18bb5d,null));};exports[_0x8cc9('0x9c')]=function(_0xe380b6,_0x33e8ba){var _0x5f3229={'raw':![],'where':{}};var _0x54945a={};var _0x429b4b={'count':0x0,'rows':[]};return db[_0x8cc9('0x39')]['findOne']({'where':{'id':_0xe380b6['params']['id']}})[_0x8cc9('0x16')](handleEntityNotFound(_0x33e8ba,null))[_0x8cc9('0x16')](function(_0x1a9b3a){if(_0x1a9b3a){_0x54945a[_0x8cc9('0x47')]=_[_0x8cc9('0x43')](db['ChatMessage'][_0x8cc9('0x44')]);_0x54945a[_0x8cc9('0x3f')]=_[_0x8cc9('0x43')](_0xe380b6[_0x8cc9('0x3f')]);_0x54945a['filters']=_[_0x8cc9('0x45')](_0x54945a[_0x8cc9('0x47')],_0x54945a['query']);_0x5f3229['attributes']=_[_0x8cc9('0x45')](_0x54945a['model'],qs[_0x8cc9('0x48')](_0xe380b6[_0x8cc9('0x3f')][_0x8cc9('0x48')]));_0x5f3229['attributes']=_0x5f3229[_0x8cc9('0x46')][_0x8cc9('0x49')]?_0x5f3229[_0x8cc9('0x46')]:_0x54945a['model'];if(!_0xe380b6['query']['hasOwnProperty'](_0x8cc9('0x9d'))){_0x5f3229[_0x8cc9('0x25')]=qs['limit'](_0xe380b6[_0x8cc9('0x3f')][_0x8cc9('0x25')]);_0x5f3229['offset']=qs['offset'](_0xe380b6[_0x8cc9('0x3f')][_0x8cc9('0x24')]);}_0x5f3229['order']=qs[_0x8cc9('0x9e')](_0xe380b6[_0x8cc9('0x3f')][_0x8cc9('0x9e')]);_0x5f3229[_0x8cc9('0x9f')]=qs['filters'](_[_0x8cc9('0xa0')](_0xe380b6[_0x8cc9('0x3f')],_0x54945a['filters']));_0x5f3229[_0x8cc9('0x9f')][_0x8cc9('0xa1')]=_0x1a9b3a['id'];if(_0xe380b6[_0x8cc9('0x3f')][_0x8cc9('0xa2')]){_0x5f3229[_0x8cc9('0x9f')]=_[_0x8cc9('0x32')](_0x5f3229[_0x8cc9('0x9f')],{'$or':_[_0x8cc9('0x38')](_0x5f3229[_0x8cc9('0x46')],function(_0x152f34){var _0x30a8ed={};_0x30a8ed[_0x152f34]={'$like':'%'+_0xe380b6[_0x8cc9('0x3f')][_0x8cc9('0xa2')]+'%'};return _0x30a8ed;})});}if(_0xe380b6['query'][_0x8cc9('0xa3')]){var _0x164c5=_0xe380b6['query'][_0x8cc9('0xa3')][_0x8cc9('0xa4')](',');var _0x48c67c={};_0x48c67c[_0x164c5[0x0]]={'$gte':moment(_0x164c5[0x1])[_0x8cc9('0x81')]('YYYY-MM-DD\x20HH:mm:ss')};_0x5f3229[_0x8cc9('0x9f')]=_[_0x8cc9('0x32')](_0x5f3229[_0x8cc9('0x9f')],_0x48c67c);}_0x5f3229=_[_0x8cc9('0x32')]({},_0x5f3229,_0xe380b6[_0x8cc9('0x4b')]);return db[_0x8cc9('0x61')][_0x8cc9('0x27')]({'where':_0x5f3229['where']})['then'](function(_0x2858cd){_0x429b4b[_0x8cc9('0x27')]=_0x2858cd;if(_0xe380b6[_0x8cc9('0x3f')][_0x8cc9('0xa5')]){_0x5f3229[_0x8cc9('0x4a')]=[{'all':!![]}];}return db[_0x8cc9('0x61')][_0x8cc9('0x3e')](_0x5f3229);})['then'](function(_0x31a7a1){_0x429b4b[_0x8cc9('0xa6')]=_0x31a7a1;return _0x429b4b;});}})[_0x8cc9('0x16')](respondWithFilteredResult(_0x33e8ba,_0x5f3229))[_0x8cc9('0x21')](handleError(_0x33e8ba,null));};exports['getMyMessages']=function(_0x258887,_0x4194f3){var _0x1664e5={'where':{}},_0x54a4a4={},_0x14690e={'count':0x0,'rows':[]};return db[_0x8cc9('0x39')][_0x8cc9('0x72')]({'where':{'id':_0x258887[_0x8cc9('0x42')]['id']}})[_0x8cc9('0x16')](handleEntityNotFound(_0x4194f3,null))[_0x8cc9('0x16')](function(_0x394e8c){if(_0x394e8c){_0x54a4a4[_0x8cc9('0x47')]=_[_0x8cc9('0x43')](db[_0x8cc9('0x61')][_0x8cc9('0x44')]);_0x54a4a4[_0x8cc9('0x3f')]=_[_0x8cc9('0x43')](_0x258887[_0x8cc9('0x3f')]);_0x54a4a4[_0x8cc9('0xa7')]=_[_0x8cc9('0x45')](_0x54a4a4['model'],_0x54a4a4[_0x8cc9('0x3f')]);_0x1664e5[_0x8cc9('0x46')]=_[_0x8cc9('0x45')](_0x54a4a4[_0x8cc9('0x47')],qs[_0x8cc9('0x48')](_0x258887['query']['fields']));_0x1664e5[_0x8cc9('0x46')]=_0x1664e5['attributes'][_0x8cc9('0x49')]?_0x1664e5[_0x8cc9('0x46')]:_0x54a4a4['model'];if(!_0x258887[_0x8cc9('0x3f')]['hasOwnProperty'](_0x8cc9('0x9d'))){_0x1664e5[_0x8cc9('0x25')]=qs[_0x8cc9('0x25')](_0x258887[_0x8cc9('0x3f')][_0x8cc9('0x25')]);_0x1664e5[_0x8cc9('0x24')]=qs[_0x8cc9('0x24')](_0x258887['query'][_0x8cc9('0x24')]);}_0x1664e5['order']=qs['sort'](_0x258887[_0x8cc9('0x3f')][_0x8cc9('0x9e')]);_0x1664e5[_0x8cc9('0x9f')]=qs[_0x8cc9('0xa7')](_[_0x8cc9('0xa0')](_0x258887['query'],_0x54a4a4[_0x8cc9('0xa7')]));_0x1664e5[_0x8cc9('0x9f')][_0x8cc9('0xa1')]=_0x394e8c['id'];if(_0x258887[_0x8cc9('0x3f')]['filter']){_0x1664e5[_0x8cc9('0x9f')]=_[_0x8cc9('0x32')](_0x1664e5[_0x8cc9('0x9f')],{'$or':_[_0x8cc9('0x38')](_0x1664e5[_0x8cc9('0x46')],function(_0x442283){var _0x2e4cb2={};_0x2e4cb2[_0x442283]={'$like':'%'+_0x258887[_0x8cc9('0x3f')]['filter']+'%'};return _0x2e4cb2;})});}_0x1664e5[_0x8cc9('0x9f')][_0x8cc9('0x8c')]=![];if(_0x258887['query']['id']){_0x1664e5['where']['id']={'$gt':_0x258887[_0x8cc9('0x3f')]['id']};}_0x1664e5=_[_0x8cc9('0x32')]({},_0x1664e5,_0x258887[_0x8cc9('0x4b')]);return db[_0x8cc9('0x61')][_0x8cc9('0x27')]({'where':_0x1664e5[_0x8cc9('0x9f')]})[_0x8cc9('0x16')](function(_0x2b9084){_0x14690e[_0x8cc9('0x27')]=_0x2b9084;_0x1664e5['include']=[];if(_0x258887[_0x8cc9('0x3f')]['includeAgent']){_0x1664e5[_0x8cc9('0x4a')][_0x8cc9('0xa8')]({'model':db[_0x8cc9('0x7f')],'as':_0x8cc9('0x7f'),'attributes':['id','fullname',_0x8cc9('0x89')]});}if(_0x258887['query'][_0x8cc9('0xa5')]){_0x1664e5[_0x8cc9('0x4a')]=[{'all':!![]}];}return db['ChatMessage'][_0x8cc9('0x3e')](_0x1664e5);})[_0x8cc9('0x16')](function(_0x16a80c){_0x14690e[_0x8cc9('0xa6')]=_0x16a80c;return _0x14690e;});}})['then'](respondWithFilteredResult(_0x4194f3,_0x1664e5))[_0x8cc9('0x21')](handleError(_0x4194f3,null));};exports[_0x8cc9('0xa9')]=function(_0x68c1d9,_0x532e7f){return db['ChatInteraction'][_0x8cc9('0x4c')]({'where':{'id':_0x68c1d9[_0x8cc9('0x42')]['id']}})[_0x8cc9('0x16')](handleEntityNotFound(_0x532e7f,null))[_0x8cc9('0x16')](function(_0x1e7923){if(_0x1e7923){return _0x1e7923[_0x8cc9('0xaa')](_0x68c1d9[_0x8cc9('0x33')][_0x8cc9('0x9a')],_[_0x8cc9('0x9b')](_0x68c1d9[_0x8cc9('0x33')],[_0x8cc9('0x9a'),'id'])||{})['spread'](function(){return db['Tag'][_0x8cc9('0x3e')]({'attributes':['id','name',_0x8cc9('0xab')],'where':{'id':_0x68c1d9[_0x8cc9('0x33')][_0x8cc9('0x9a')]}});})['then'](function(_0xe445b1){socket['emit'](_0x8cc9('0xac'),{'id':Number(_0x68c1d9[_0x8cc9('0x42')]['id']),'tags':_0xe445b1||[]});return{'id':Number(_0x68c1d9[_0x8cc9('0x42')]['id']),'tags':_0xe445b1||[]};});}})[_0x8cc9('0x16')](respondWithResult(_0x532e7f,null))['catch'](handleError(_0x532e7f,null));};exports[_0x8cc9('0xad')]=function(_0x2e2647,_0x55fdee){return db[_0x8cc9('0x39')][_0x8cc9('0x4c')]({'where':{'id':_0x2e2647[_0x8cc9('0x42')]['id']}})[_0x8cc9('0x16')](handleEntityNotFound(_0x55fdee,null))[_0x8cc9('0x16')](function(_0xb285ec){if(_0xb285ec){return _0xb285ec[_0x8cc9('0xad')](_0x2e2647[_0x8cc9('0x3f')]['ids']);}})[_0x8cc9('0x16')](respondWithStatusCode(_0x55fdee,null))[_0x8cc9('0x21')](handleError(_0x55fdee,null));};exports[_0x8cc9('0x78')]=function(_0x49a293,_0x27944e){var _0x34be4c=moment()[_0x8cc9('0xae')]()[_0x8cc9('0xaf')]();var _0x36d7e2=path['join'](config['root'],_0x8cc9('0xb0'),'files',_0x8cc9('0xb1'));var _0x37d0f1=path[_0x8cc9('0x75')](config[_0x8cc9('0x7a')],_0x8cc9('0xb0'),'files',_0x8cc9('0xb2'));var _0x4faf05=path[_0x8cc9('0x75')](_0x36d7e2,_0x34be4c);var _0x38f8db=util['format'](_0x8cc9('0xb3'),_0x49a293[_0x8cc9('0x42')]['id'],_0x34be4c);var _0xf3bbe9=path['join'](_0x36d7e2,_0x38f8db);var _0x4307b6=[];_0x4307b6[_0x8cc9('0xa8')]({'model':db[_0x8cc9('0x7f')],'as':_0x8cc9('0x7f'),'attributes':['id',_0x8cc9('0x54')],'raw':!![]});_0x4307b6[_0x8cc9('0xa8')]({'model':db[_0x8cc9('0x64')],'as':_0x8cc9('0xb4'),'attributes':['id',_0x8cc9('0xb5'),_0x8cc9('0xb6')],'raw':!![]});if(_0x49a293[_0x8cc9('0x3f')][_0x8cc9('0xb2')]){_0x4307b6[_0x8cc9('0xa8')]({'model':db[_0x8cc9('0x71')],'as':_0x8cc9('0x71'),'raw':!![]});}var _0x22532b=[{'model':db[_0x8cc9('0x61')],'as':_0x8cc9('0x7e'),'attributes':['id',_0x8cc9('0x33'),_0x8cc9('0xb7'),_0x8cc9('0xb8'),'secret',_0x8cc9('0xb9')],'include':_0x4307b6}];_0x22532b['push']({'model':db[_0x8cc9('0x4e')],'as':_0x8cc9('0xba'),'attributes':['id','name']});_0x22532b[_0x8cc9('0xa8')]({'model':db['User'],'as':'Owner','attributes':['id',_0x8cc9('0x54')]});return db['ChatInteraction']['find']({'where':{'id':_0x49a293['params']['id']},'include':_0x22532b})[_0x8cc9('0x16')](handleEntityNotFound(_0x27944e,null))[_0x8cc9('0x16')](function(_0x401513){if(_0x401513){var _0x2234de=_0x401513[_0x8cc9('0xbb')]({'plain':!![]});fs[_0x8cc9('0xbc')](_0x4faf05);var _0x232d40={'channel':_0x8cc9('0xbd'),'account':_0x2234de[_0x8cc9('0xba')][_0x8cc9('0x2f')],'agent':_0x2234de[_0x8cc9('0xbe')]?_0x2234de[_0x8cc9('0xbe')][_0x8cc9('0x54')]:_0x8cc9('0xbf'),'createdAt':moment(_0x2234de[_0x8cc9('0xb7')])[_0x8cc9('0x81')](_0x8cc9('0xc0'))['toString'](),'closedAt':_0x2234de[_0x8cc9('0x68')]?moment(_0x2234de[_0x8cc9('0xc1')])[_0x8cc9('0x81')](_0x8cc9('0xc0'))[_0x8cc9('0xaf')]():'','disposition':_0x2234de[_0x8cc9('0xc2')],'chatInfo':{'browser':_0x2234de[_0x8cc9('0xc3')],'os':_0x2234de[_0x8cc9('0xc4')],'referer':_0x2234de['referer'],'customerIp':_0x2234de[_0x8cc9('0xc5')],'customerPort':_0x2234de[_0x8cc9('0xc6')]?_0x2234de[_0x8cc9('0xc6')]:'N.A.'},'messages':_(_0x2234de[_0x8cc9('0x7e')])[_0x8cc9('0xc7')]()['filter']({'secret':![]})[_0x8cc9('0x38')](function(_0x21381c){if(_0x21381c[_0x8cc9('0x71')]){var _0x5e4e99=path[_0x8cc9('0x75')](_0x37d0f1,_0x21381c['Attachment'][_0x8cc9('0x6e')]);if(fs['existsSync'](_0x5e4e99)){fs[_0x8cc9('0xc8')](_0x5e4e99)[_0x8cc9('0xc9')](fs[_0x8cc9('0xca')](path[_0x8cc9('0x75')](_0x4faf05,_0x21381c[_0x8cc9('0x71')][_0x8cc9('0x6e')])));}}return{'date':moment(_0x21381c['createdAt'])[_0x8cc9('0x81')](_0x8cc9('0xc0'))[_0x8cc9('0xaf')](),'sender':_0x21381c[_0x8cc9('0xb8')]===_0x8cc9('0x60')?_0x21381c[_0x8cc9('0x7f')]?_0x21381c['User'][_0x8cc9('0x54')]:_0x8cc9('0x83'):_0x21381c[_0x8cc9('0xb4')][_0x8cc9('0xb5')]+(_0x21381c['Contact'][_0x8cc9('0xb6')]?'\x20'+_0x21381c[_0x8cc9('0xb4')]['lastName']:''),'body':_0x21381c['Attachment']?_0x21381c['Attachment'][_0x8cc9('0x6e')]:_0x21381c[_0x8cc9('0x33')],'direction':_0x21381c['direction']==='out'?'A':'C','secret':_0x21381c[_0x8cc9('0x8c')],'read':_0x21381c[_0x8cc9('0xb9')],'attachment':_0x21381c[_0x8cc9('0x71')]};})[_0x8cc9('0xcb')]()};return ejs[_0x8cc9('0xcc')](path[_0x8cc9('0x75')](config['root'],_0x8cc9('0xb0'),_0x8cc9('0xcd'),_0x8cc9('0xce')),{'interaction':_0x232d40})[_0x8cc9('0x16')](function(_0x2419f0){var _0xccfbea=path[_0x8cc9('0x75')](_0x4faf05,'transcript-'+_0x2234de['id']+'-'+_0x34be4c+_0x8cc9('0xcf'));var _0x2d51a8={'path':_0xccfbea,'channel':_0x8cc9('0xbd'),'interactionId':_0x2234de['id']};return pdf[_0x8cc9('0xd0')](_0x2419f0,_0x2d51a8);})['then'](function(){return new Promise(function(_0x5df7ec,_0x7d96fe){zipdir(_0x4faf05,{'saveTo':_0xf3bbe9},function(_0x562736,_0x3462a6){if(_0x562736)return _0x7d96fe(_0x562736);return _0x5df7ec(_0x3462a6);});})[_0x8cc9('0x16')](function(){return new BPromise(function(_0x5577a2,_0x402c5c){rimraf(_0x4faf05,function(_0x338aa9){if(_0x338aa9)_0x402c5c(_0x338aa9);return _0x5577a2();});});})['then'](function(){return _0x27944e[_0x8cc9('0x78')](_0xf3bbe9,_0x38f8db,function(_0x4d4150){if(_0x4d4150){logger['error']('err',_0x4d4150);}else{fs[_0x8cc9('0xd1')](_0xf3bbe9);}});});});}else{return _0x27944e[_0x8cc9('0x22')](0xc8);}})[_0x8cc9('0x21')](handleError(_0x27944e,null));}; \ No newline at end of file +var _0x20b4=['keys','ChatInteraction','filters','intersection','attributes','fields','length','includeAll','include','options','find','create','destroy','describe','createVidaooSession','ChatWebsite','findOne','ChatWebsiteId','vidaooApiKey','vidaooEscalation','vidaooTopic','vidaooNote','vidaooMetadata','fullname','POST','https://api-vidaoo.xcally.com/api/v1/meetings','email','isNull','follow','metadata','ValidationError','Error\x20in\x20conversion\x20vidaooMetadata','Sequelize','Error\x20in\x20Vidaoo\x20configuration','join_url','out','ChatMessage','Unable\x20to\x20create\x20Vidaoo\x20session','CmContact','Contact','abandon','UserId','Interaction\x20already\x20assigned','closed','disposition','file','basename','filename','mimetype','Attachment','attachmentDownload','attachId','ChatOfflineMessageId','join','offline-chat/','download','server/files/chat/upload/','format','now','pathTranscript','Messages','User','ContactId','%s%d','agentAlias','Visitor','agentIdentifier','website_alias','System','MM/DD/YYYY\x20HH:mm:ss','secret','MailAccount','MailServerOut','Smtp','CloudProvider','getSmtpOptions','SendMail','sendMail','\x22%s\x22\x20<%s>','Hi\x20%s,\x20attached\x20you\x20can\x20find\x20your\x20transcript\x20file.\x20\x0a\x0aRegards.\x20\x0a\x0a','mailTranscript','addMessage','ids','getMessages','nolimit','order','sort','where','pick','ChatInteractionId','filter','$gte','split','merge','rows','hasOwnProperty','includeAgent','alias','addTags','setTags','omit','spread','Tag','emit','chatInteractionTags:save','removeTags','unix','toString','root','server','files','tmp','attachments','transcript-%d-%s.zip','push','firstName','lastName','createdAt','direction','read','mkdirSync','Account','Owner','N.A.','YYYY-MM-DD\x20HH:mm:ss','closedAt','browserName','osName','referer','customerIp','customerPort','tail','existsSync','createReadStream','createWriteStream','value','views','downloadInteraction.ejs','transcript-','.pdf','Chat','createPdfFromHTML','err','unlinkSync','request-promise','moment','mustache','util','path','ejs','lodash','../../components/interaction/service','../../components/parsers/qs','../../components/export/pdf','../../config/logger','api','../../mysqldb','redis','localhost','socket.io-emitter','register','jayson/promise','client','http','info','ChatInteraction,\x20%s,\x20%s','debug','ChatInteraction,\x20%s,\x20%s,\x20%s','stringify','error','code','message','request\x20sent','catch','status','end','json','offset','undefined','limit','count','set','update','then','stack','name','send','render','body','contact','agent','interaction','account','map','rawAttributes','fieldName','key','getOptions','findAll','chat','query','user','show','params','model'];(function(_0x56916d,_0x37b935){var _0x2b7f1f=function(_0x206eb1){while(--_0x206eb1){_0x56916d['push'](_0x56916d['shift']());}};_0x2b7f1f(++_0x37b935);}(_0x20b4,0x15d));var _0x420b=function(_0x2f21c6,_0x51de35){_0x2f21c6=_0x2f21c6-0x0;var _0x32cbd5=_0x20b4[_0x2f21c6];return _0x32cbd5;};'use strict';var rimraf=require('rimraf');var zipdir=require('zip-dir');var rp=require(_0x420b('0x0'));var moment=require(_0x420b('0x1'));var BPromise=require('bluebird');var Mustache=require(_0x420b('0x2'));var util=require(_0x420b('0x3'));var path=require(_0x420b('0x4'));var ejs=require(_0x420b('0x5'));var fs=require('fs');var _=require(_0x420b('0x6'));var Redis=require('ioredis');var interaction=require(_0x420b('0x7'));var qs=require(_0x420b('0x8'));var pdf=require(_0x420b('0x9'));var logger=require(_0x420b('0xa'))(_0x420b('0xb'));var config=require('../../config/environment');var db=require(_0x420b('0xc'))['db'];config[_0x420b('0xd')]=_['defaults'](config[_0x420b('0xd')],{'host':_0x420b('0xe'),'port':0x18eb});var socket=require(_0x420b('0xf'))(new Redis(config[_0x420b('0xd')]));require('./chatInteraction.socket')[_0x420b('0x10')](socket);var jayson=require(_0x420b('0x11'));var client=jayson['client']['http']({'port':0x232b});var client9004=jayson[_0x420b('0x12')][_0x420b('0x13')]({'port':0x232c});function respondWithRpcPromise(_0x3ffd08,_0x506648,_0x4826fa,_0x17ff56){return new BPromise(function(_0x44348a,_0x40248f){var _0x36f030=_0x17ff56||client;return _0x36f030['request'](_0x3ffd08,_0x4826fa)['then'](function(_0x2e3024){logger[_0x420b('0x14')](_0x420b('0x15'),_0x506648,'request\x20sent');logger[_0x420b('0x16')](_0x420b('0x17'),_0x506648,'request\x20sent',JSON[_0x420b('0x18')](_0x2e3024));if(_0x2e3024[_0x420b('0x19')]){if(_0x2e3024['error'][_0x420b('0x1a')]===0x1f4){logger['error'](_0x420b('0x15'),_0x506648,_0x2e3024['error'][_0x420b('0x1b')]);return _0x40248f(_0x2e3024[_0x420b('0x19')][_0x420b('0x1b')]);}logger['error'](_0x420b('0x15'),_0x506648,_0x2e3024[_0x420b('0x19')][_0x420b('0x1b')]);return _0x44348a(_0x2e3024[_0x420b('0x19')][_0x420b('0x1b')]);}else{logger[_0x420b('0x14')]('ChatInteraction,\x20%s,\x20%s',_0x506648,_0x420b('0x1c'));_0x44348a(_0x2e3024['result']['message']);}})[_0x420b('0x1d')](function(_0x5daeb2){logger[_0x420b('0x19')](_0x420b('0x15'),_0x506648,_0x5daeb2);_0x40248f(_0x5daeb2);});});}function respondWithStatusCode(_0x2df854,_0x3d887d){_0x3d887d=_0x3d887d||0xcc;return function(_0x5dad82){if(_0x5dad82){return _0x2df854['sendStatus'](_0x3d887d);}return _0x2df854[_0x420b('0x1e')](_0x3d887d)[_0x420b('0x1f')]();};}function respondWithResult(_0x42130d,_0xb02194){_0xb02194=_0xb02194||0xc8;return function(_0x444f75){if(_0x444f75){return _0x42130d[_0x420b('0x1e')](_0xb02194)[_0x420b('0x20')](_0x444f75);}};}function respondWithFilteredResult(_0x3afdb3,_0x3fccdb){return function(_0x5f9caa){if(_0x5f9caa){var _0x1fdd14=typeof _0x3fccdb[_0x420b('0x21')]===_0x420b('0x22')&&typeof _0x3fccdb[_0x420b('0x23')]===_0x420b('0x22');var _0x5e3668=_0x5f9caa[_0x420b('0x24')];var _0x2db75c=_0x1fdd14?0x0:_0x3fccdb[_0x420b('0x21')];var _0x3fd068=_0x1fdd14?_0x5f9caa[_0x420b('0x24')]:_0x3fccdb[_0x420b('0x21')]+_0x3fccdb[_0x420b('0x23')];var _0x2992dd;if(_0x3fd068>=_0x5e3668){_0x3fd068=_0x5e3668;_0x2992dd=0xc8;}else{_0x2992dd=0xce;}_0x3afdb3[_0x420b('0x1e')](_0x2992dd);return _0x3afdb3[_0x420b('0x25')]('Content-Range',_0x2db75c+'-'+_0x3fd068+'/'+_0x5e3668)['json'](_0x5f9caa);}return null;};}function saveUpdates(_0x1cf035){return function(_0x21c230){if(_0x21c230){return _0x21c230[_0x420b('0x26')](_0x1cf035)['then'](function(_0xca2ad3){return _0xca2ad3;});}return null;};}function removeEntity(_0x132347){return function(_0x14c486){if(_0x14c486){return _0x14c486['destroy']()[_0x420b('0x27')](function(){_0x132347[_0x420b('0x1e')](0xcc)[_0x420b('0x1f')]();});}};}function handleEntityNotFound(_0x4985f5){return function(_0x53f793){if(!_0x53f793){_0x4985f5['sendStatus'](0x194);}return _0x53f793;};}function handleError(_0x525415,_0x310097){_0x310097=_0x310097||0x1f4;return function(_0x4f8f87){logger[_0x420b('0x19')](_0x4f8f87[_0x420b('0x28')]);if(_0x4f8f87[_0x420b('0x29')]){delete _0x4f8f87['name'];}_0x525415[_0x420b('0x1e')](_0x310097)[_0x420b('0x2a')](_0x4f8f87);};}function getMustacheRender(_0x2dac09,_0x2783f9){return Mustache[_0x420b('0x2b')](_0x2dac09,_['merge'](_0x2783f9[_0x420b('0x2c')],{'contact':_0x2783f9[_0x420b('0x2d')],'message':_0x2783f9[_0x420b('0x1b')],'agent':_0x2783f9[_0x420b('0x2e')],'interaction':_0x2783f9[_0x420b('0x2f')],'account':_0x2783f9[_0x420b('0x30')]}))||'';}exports['index']=function(_0x15fa80,_0x57e5ed){var _0x43c1ec={};var _0x3f554b=_[_0x420b('0x31')](db['ChatInteraction'][_0x420b('0x32')],function(_0x10ece9){return{'name':_0x10ece9[_0x420b('0x33')],'type':_0x10ece9['type'][_0x420b('0x34')]};});_0x43c1ec=qs[_0x420b('0x35')](_0x3f554b,_0x15fa80);return interaction[_0x420b('0x36')](_0x420b('0x37'),_0x15fa80[_0x420b('0x38')],_0x15fa80[_0x420b('0x39')],_0x43c1ec,_0x3f554b)[_0x420b('0x27')](respondWithFilteredResult(_0x57e5ed,_0x43c1ec))[_0x420b('0x1d')](handleError(_0x57e5ed,null));};exports[_0x420b('0x3a')]=function(_0x196efe,_0x2cef50){var _0x53d18c={'raw':![],'where':{'id':_0x196efe[_0x420b('0x3b')]['id']}},_0x53da40={};_0x53da40[_0x420b('0x3c')]=_[_0x420b('0x3d')](db[_0x420b('0x3e')][_0x420b('0x32')]);_0x53da40[_0x420b('0x38')]=_[_0x420b('0x3d')](_0x196efe[_0x420b('0x38')]);_0x53da40[_0x420b('0x3f')]=_[_0x420b('0x40')](_0x53da40[_0x420b('0x3c')],_0x53da40[_0x420b('0x38')]);_0x53d18c[_0x420b('0x41')]=_[_0x420b('0x40')](_0x53da40['model'],qs[_0x420b('0x42')](_0x196efe[_0x420b('0x38')][_0x420b('0x42')]));_0x53d18c[_0x420b('0x41')]=_0x53d18c[_0x420b('0x41')][_0x420b('0x43')]?_0x53d18c[_0x420b('0x41')]:_0x53da40[_0x420b('0x3c')];if(_0x196efe[_0x420b('0x38')][_0x420b('0x44')]){_0x53d18c[_0x420b('0x45')]=[{'all':!![]}];}_0x53d18c=_['merge']({},_0x53d18c,_0x196efe[_0x420b('0x46')]);return db[_0x420b('0x3e')][_0x420b('0x47')](_0x53d18c)[_0x420b('0x27')](handleEntityNotFound(_0x2cef50,null))[_0x420b('0x27')](respondWithResult(_0x2cef50,null))[_0x420b('0x1d')](handleError(_0x2cef50,null));};exports['create']=function(_0x4a11f4,_0x39dd13){return db['ChatInteraction'][_0x420b('0x48')](_0x4a11f4[_0x420b('0x2c')],{})[_0x420b('0x27')](respondWithResult(_0x39dd13,0xc9))[_0x420b('0x1d')](handleError(_0x39dd13,null));};exports['update']=function(_0x267b6c,_0x50d747){if(_0x267b6c[_0x420b('0x2c')]['id']){delete _0x267b6c['body']['id'];}return db[_0x420b('0x3e')][_0x420b('0x47')]({'where':{'id':_0x267b6c[_0x420b('0x3b')]['id']}})[_0x420b('0x27')](handleEntityNotFound(_0x50d747,null))[_0x420b('0x27')](saveUpdates(_0x267b6c[_0x420b('0x2c')],null))[_0x420b('0x27')](respondWithResult(_0x50d747,null))[_0x420b('0x1d')](handleError(_0x50d747,null));};exports[_0x420b('0x49')]=function(_0x488c30,_0xf791ec){return db[_0x420b('0x3e')]['find']({'where':{'id':_0x488c30[_0x420b('0x3b')]['id']}})['then'](handleEntityNotFound(_0xf791ec,null))[_0x420b('0x27')](removeEntity(_0xf791ec,null))[_0x420b('0x1d')](handleError(_0xf791ec,null));};exports[_0x420b('0x4a')]=function(_0xdd1389,_0x4d48bd){return db[_0x420b('0x3e')]['describe']()[_0x420b('0x27')](respondWithResult(_0x4d48bd,null))['catch'](handleError(_0x4d48bd,null));};exports[_0x420b('0x4b')]=function(_0x516634,_0x4a5e68){var _0x2cf7fb=_0x516634['params']['id'];var _0x26c020;var _0x1fd2de;var _0x419448;return db[_0x420b('0x3e')]['findOne']({'where':{'id':_0x2cf7fb}})[_0x420b('0x27')](function(_0x247ae3){_0x26c020=_0x247ae3;return db[_0x420b('0x4c')][_0x420b('0x4d')]({'where':{'id':_0x247ae3[_0x420b('0x4e')]},'attributes':['id',_0x420b('0x4f'),_0x420b('0x50'),_0x420b('0x51'),_0x420b('0x52'),_0x420b('0x53')],'raw':!![]});})[_0x420b('0x27')](function(_0x2bf37b){if(_0x2bf37b&&_0x2bf37b[_0x420b('0x4f')]&&_0x2bf37b[_0x420b('0x50')]){_0x1fd2de=_0x2bf37b;var _0x2f080a={'interaction':{'id':_0x2cf7fb},'agent':{'id':_0x516634[_0x420b('0x39')]['id'],'name':_0x516634[_0x420b('0x39')][_0x420b('0x29')],'fullname':_0x516634['user'][_0x420b('0x54')],'email':_0x516634[_0x420b('0x39')]['email']},'contact':_0x516634[_0x420b('0x2c')][_0x420b('0x2d')],'account':_0x516634[_0x420b('0x2c')][_0x420b('0x30')]};var _0x438bc2={'rejectUnauthorized':![],'method':_0x420b('0x55'),'url':_0x420b('0x56'),'headers':{'X-APIKEY':_0x2bf37b[_0x420b('0x4f')]},'body':{'duration':null,'scheduledAt':null,'participants':[_0x516634['user'][_0x420b('0x57')]],'buttons':null,'topic':_0x1fd2de[_0x420b('0x51')],'note':_[_0x420b('0x58')](_0x1fd2de[_0x420b('0x52')])?null:getMustacheRender(_0x1fd2de[_0x420b('0x52')],_0x2f080a),'metadata':null},'redirect':_0x420b('0x59'),'json':!![]};try{if(!_['isNull'](_0x1fd2de[_0x420b('0x53')])){var _0x1b5a89=getMustacheRender(_0x1fd2de[_0x420b('0x53')],_0x2f080a);var _0x36f3ba=JSON['parse'](_0x1b5a89);_0x438bc2[_0x420b('0x2c')][_0x420b('0x5a')]=_0x36f3ba;}}catch(_0x498b9c){throw new db['Sequelize'][(_0x420b('0x5b'))](_0x420b('0x5c'));}return rp(_0x438bc2);}else{throw new db[(_0x420b('0x5d'))]['ValidationError'](_0x420b('0x5e'));}})[_0x420b('0x27')](function(_0x57ebbe){_0x419448=_0x57ebbe;if(_0x419448['id']){var _0x2b0162={'body':_0x419448[_0x420b('0x5f')],'ChatWebsiteId':_0x1fd2de['id'],'ChatInteractionId':_0x26c020['id'],'direction':_0x420b('0x60'),'UserId':_0x516634[_0x420b('0x39')]['id']};return db[_0x420b('0x61')]['create'](_0x2b0162,{});}else{throw new db['Sequelize'][(_0x420b('0x5b'))](_0x420b('0x62'));}})['then'](function(){return _0x26c020['updateAttributes']({'vidaooSessionId':_0x419448['id']});})['then'](respondWithResult(_0x4a5e68,null))[_0x420b('0x1d')](handleError(_0x4a5e68,null));};exports['customUpdate']=function(_0x21505f,_0x1302e6){if(_0x21505f['body']['id']){delete _0x21505f[_0x420b('0x2c')]['id'];}return db[_0x420b('0x3e')][_0x420b('0x47')]({'where':{'id':_0x21505f[_0x420b('0x3b')]['id']},'include':[{'model':db[_0x420b('0x63')],'as':_0x420b('0x64')}]})['then'](handleEntityNotFound(_0x1302e6,null))[_0x420b('0x27')](saveUpdates(_0x21505f[_0x420b('0x2c')],null))[_0x420b('0x27')](respondWithResult(_0x1302e6,null))[_0x420b('0x1d')](handleError(_0x1302e6,null));};exports[_0x420b('0x65')]=function(_0x3f5b2d,_0x1e4e4f){if(_0x3f5b2d[_0x420b('0x2c')]['id']){delete _0x3f5b2d[_0x420b('0x2c')]['id'];}return db[_0x420b('0x3e')]['find']({'where':{'id':_0x3f5b2d[_0x420b('0x3b')]['id']}})[_0x420b('0x27')](function(_0x33a284){if(!_0x33a284){logger[_0x420b('0x19')]('abandonInteraction,\x20%s,\x20%s,\x20%s','abandon',0x194,'entity\x20not\x20found');_0x1e4e4f['sendStatus'](0x194);}else{if(_0x33a284[_0x420b('0x66')]){throw new db[(_0x420b('0x5d'))][(_0x420b('0x5b'))](_0x420b('0x67'));}}return _0x33a284;})[_0x420b('0x27')](function(_0x483951){if(_0x483951){return _0x483951['update']({'closed':_0x3f5b2d['body'][_0x420b('0x68')],'disposition':_0x3f5b2d[_0x420b('0x2c')][_0x420b('0x69')]})[_0x420b('0x27')](function(_0x3688ee){return _0x3688ee;});}})[_0x420b('0x27')](function(){return respondWithRpcPromise('AbandonInteraction',_0x420b('0x65'),_0x3f5b2d[_0x420b('0x2c')],client9004);})['then'](respondWithResult(_0x1e4e4f,null))[_0x420b('0x1d')](handleError(_0x1e4e4f,null));};exports['attachmentUpload']=function(_0x4a0793,_0x47df61){_0x4a0793[_0x420b('0x2c')]['name']=_0x4a0793[_0x420b('0x6a')]['originalname'];_0x4a0793['body'][_0x420b('0x6b')]=_0x4a0793[_0x420b('0x6a')][_0x420b('0x6c')];_0x4a0793[_0x420b('0x2c')]['type']=_0x4a0793[_0x420b('0x6a')][_0x420b('0x6d')];return db[_0x420b('0x6e')][_0x420b('0x48')](_0x4a0793[_0x420b('0x2c')])['then'](respondWithResult(_0x47df61,0xc9))['catch'](handleError(_0x47df61,null));};exports[_0x420b('0x6f')]=function(_0x5988a1,_0x386bed){return db[_0x420b('0x3e')]['findOne']({'where':{'id':_0x5988a1[_0x420b('0x3b')]['id']},'raw':!![]})[_0x420b('0x27')](handleEntityNotFound(_0x386bed,null))[_0x420b('0x27')](function(_0x27e2d){if(_0x27e2d){if(_0x27e2d[_0x420b('0x68')]){return _0x386bed[_0x420b('0x1e')](0x193)[_0x420b('0x20')]({'status':0x193,'message':'Unauthorized'});}return db['Attachment'][_0x420b('0x4d')]({'where':{'id':_0x5988a1[_0x420b('0x38')][_0x420b('0x70')]},'raw':!![]})[_0x420b('0x27')](handleEntityNotFound(_0x386bed,null));}})[_0x420b('0x27')](function(_0x383fc0){if(_0x383fc0){var _0x3c8eea=_0x383fc0[_0x420b('0x71')]!==null;var _0x649670=path[_0x420b('0x72')](config['root'],'server/files/attachments/');if(_0x3c8eea){_0x649670=path[_0x420b('0x72')](_0x649670,_0x420b('0x73'));}var _0x5062a8=path[_0x420b('0x72')](_0x649670,_0x383fc0[_0x420b('0x6b')]);return _0x386bed[_0x420b('0x74')](_0x5062a8);}})[_0x420b('0x1d')](handleError(_0x386bed,null));};exports['close']=function(_0x18d356,_0x52cbe8){var _0x428f3a=null;var _0x1e55e7=null;var _0x2a31fc=null;if(_0x18d356[_0x420b('0x2c')]['id']){delete _0x18d356[_0x420b('0x2c')]['id'];}if(_0x18d356[_0x420b('0x2c')]['mailTranscript']){_0x2a31fc=path['join'](config['root'],_0x420b('0x75'),util[_0x420b('0x76')]('transcript-%s.txt',Date[_0x420b('0x77')]()));_0x18d356[_0x420b('0x2c')][_0x420b('0x78')]=_0x2a31fc;}return db[_0x420b('0x3e')][_0x420b('0x47')]({'where':{'id':_0x18d356[_0x420b('0x3b')]['id']},'include':[{'model':db[_0x420b('0x61')],'as':_0x420b('0x79'),'include':[{'model':db['User'],'as':_0x420b('0x7a')}]}]})['then'](handleEntityNotFound(_0x52cbe8,null))['then'](saveUpdates(_0x18d356[_0x420b('0x2c')],null))[_0x420b('0x27')](function(_0xf35977){if(_0xf35977){_0x428f3a=_0xf35977;return db[_0x420b('0x4c')][_0x420b('0x47')]({'where':{'id':_0x428f3a[_0x420b('0x4e')]}});}})[_0x420b('0x27')](function(_0x2b3ee4){if(_0x2b3ee4){_0x1e55e7=_0x2b3ee4;return db[_0x420b('0x63')][_0x420b('0x47')]({'where':{'id':_0x428f3a[_0x420b('0x7b')]}});}})[_0x420b('0x27')](function(_0x5b5c6f){if(_0x5b5c6f){if(_0x2a31fc){var _0x3c3778=null;for(var _0x4de8e6=0x1;_0x4de8e6<_0x428f3a[_0x420b('0x79')][_0x420b('0x43')];++_0x4de8e6){_0x3c3778=_0x428f3a[_0x420b('0x79')][_0x4de8e6];var _0x5c8189=_0x3c3778[_0x420b('0x66')]?util[_0x420b('0x76')](_0x420b('0x7c'),_0x1e55e7[_0x420b('0x7d')],_0x3c3778[_0x420b('0x66')]):'System';var _0x2441e7=_0x18d356[_0x420b('0x2c')]['customer']||util['format'](_0x420b('0x7c'),_0x420b('0x7e'),_0x3c3778[_0x420b('0x7b')]);switch(_0x1e55e7[_0x420b('0x7f')]){case _0x420b('0x80'):_0x5c8189=_0x3c3778[_0x420b('0x66')]?util[_0x420b('0x76')]('%s%d',_0x1e55e7['agentAlias'],_0x3c3778[_0x420b('0x66')]):_0x420b('0x81');break;case'agent_alias':_0x5c8189=_0x3c3778['UserId']?_0x3c3778[_0x420b('0x7a')]['alias']||_0x3c3778['User'][_0x420b('0x54')]:_0x420b('0x81');break;case'agent_fullname':_0x5c8189=_0x3c3778['UserId']?_0x3c3778['User'][_0x420b('0x54')]:_0x420b('0x81');break;default:_0x5c8189=_0x3c3778[_0x420b('0x66')]?util[_0x420b('0x76')](_0x420b('0x7c'),_0x1e55e7['agentAlias'],_0x3c3778[_0x420b('0x66')]):_0x420b('0x81');}var _0x4b50c7=util[_0x420b('0x76')]('[%s]\x20%s:\x20%s\x0a',moment(_0x3c3778['createdAt'])[_0x420b('0x76')](_0x420b('0x82')),_0x3c3778['direction']==='in'?_0x2441e7:_0x5c8189,_0x3c3778[_0x420b('0x2c')]);if(!_0x3c3778[_0x420b('0x83')]){fs['appendFileSync'](_0x2a31fc,_0x4b50c7);}}return db[_0x420b('0x84')][_0x420b('0x4d')]({'where':{'service':!![]},'include':[{'model':db[_0x420b('0x85')],'as':_0x420b('0x86'),'raw':!![],'include':[{'model':db[_0x420b('0x87')],'as':_0x420b('0x87'),'raw':!![]}]}]});}}})[_0x420b('0x27')](function(_0x4fda0){if(!_0x4fda0||!_0x4fda0[_0x420b('0x86')]||!_0x18d356['body'])return _0x428f3a;var _0x437cb1=_0x4fda0[_0x420b('0x88')]();return respondWithRpcPromise(_0x420b('0x89'),_0x420b('0x8a'),{'account':_0x437cb1,'message':{'from':util['format'](_0x420b('0x8b'),_0x4fda0[_0x420b('0x29')],_0x4fda0[_0x420b('0x57')]||_0x4fda0[_0x420b('0x86')]['user']),'to':_0x18d356[_0x420b('0x2c')]['mailTranscript'],'subject':'Mail\x20Transcript','text':util['format'](_0x420b('0x8c'),_0x18d356[_0x420b('0x2c')][_0x420b('0x8d')]),'attachments':[{'path':_0x2a31fc}]}})['then'](function(){return _0x428f3a;})['catch'](function(_0x39bbf2){logger[_0x420b('0x19')](_0x39bbf2);});})[_0x420b('0x27')](respondWithStatusCode(_0x52cbe8,0xc8))['catch'](handleError(_0x52cbe8,null));};exports[_0x420b('0x8e')]=function(_0x51768a,_0x5a5a25){return db[_0x420b('0x61')][_0x420b('0x47')]({'where':{'id':_0x51768a[_0x420b('0x3b')]['id']}})[_0x420b('0x27')](handleEntityNotFound(_0x5a5a25,null))[_0x420b('0x27')](function(_0x1e0663){if(_0x1e0663){return _0x1e0663[_0x420b('0x8e')](_0x51768a[_0x420b('0x2c')][_0x420b('0x8f')],_['omit'](_0x51768a[_0x420b('0x2c')],['ids','id'])||{});}})[_0x420b('0x27')](respondWithResult(_0x5a5a25,null))[_0x420b('0x1d')](handleError(_0x5a5a25,null));};exports[_0x420b('0x90')]=function(_0x5770aa,_0x4bf969){var _0x183f17={'raw':![],'where':{}};var _0x1e72a4={};var _0x4b4018={'count':0x0,'rows':[]};return db[_0x420b('0x3e')]['findOne']({'where':{'id':_0x5770aa['params']['id']}})[_0x420b('0x27')](handleEntityNotFound(_0x4bf969,null))[_0x420b('0x27')](function(_0x339d18){if(_0x339d18){_0x1e72a4[_0x420b('0x3c')]=_[_0x420b('0x3d')](db[_0x420b('0x61')][_0x420b('0x32')]);_0x1e72a4[_0x420b('0x38')]=_['keys'](_0x5770aa['query']);_0x1e72a4[_0x420b('0x3f')]=_[_0x420b('0x40')](_0x1e72a4[_0x420b('0x3c')],_0x1e72a4['query']);_0x183f17[_0x420b('0x41')]=_[_0x420b('0x40')](_0x1e72a4[_0x420b('0x3c')],qs[_0x420b('0x42')](_0x5770aa['query']['fields']));_0x183f17['attributes']=_0x183f17[_0x420b('0x41')][_0x420b('0x43')]?_0x183f17['attributes']:_0x1e72a4[_0x420b('0x3c')];if(!_0x5770aa[_0x420b('0x38')]['hasOwnProperty'](_0x420b('0x91'))){_0x183f17[_0x420b('0x23')]=qs[_0x420b('0x23')](_0x5770aa[_0x420b('0x38')][_0x420b('0x23')]);_0x183f17[_0x420b('0x21')]=qs['offset'](_0x5770aa[_0x420b('0x38')]['offset']);}_0x183f17[_0x420b('0x92')]=qs[_0x420b('0x93')](_0x5770aa[_0x420b('0x38')]['sort']);_0x183f17[_0x420b('0x94')]=qs[_0x420b('0x3f')](_[_0x420b('0x95')](_0x5770aa['query'],_0x1e72a4['filters']));_0x183f17[_0x420b('0x94')][_0x420b('0x96')]=_0x339d18['id'];if(_0x5770aa['query'][_0x420b('0x97')]){_0x183f17[_0x420b('0x94')]=_['merge'](_0x183f17[_0x420b('0x94')],{'$or':_[_0x420b('0x31')](_0x183f17[_0x420b('0x41')],function(_0x321688){var _0x401354={};_0x401354[_0x321688]={'$like':'%'+_0x5770aa['query'][_0x420b('0x97')]+'%'};return _0x401354;})});}if(_0x5770aa[_0x420b('0x38')][_0x420b('0x98')]){var _0x46e45f=_0x5770aa[_0x420b('0x38')][_0x420b('0x98')][_0x420b('0x99')](',');var _0xb54717={};_0xb54717[_0x46e45f[0x0]]={'$gte':moment(_0x46e45f[0x1])[_0x420b('0x76')]('YYYY-MM-DD\x20HH:mm:ss')};_0x183f17[_0x420b('0x94')]=_[_0x420b('0x9a')](_0x183f17['where'],_0xb54717);}_0x183f17=_['merge']({},_0x183f17,_0x5770aa['options']);return db[_0x420b('0x61')][_0x420b('0x24')]({'where':_0x183f17[_0x420b('0x94')]})['then'](function(_0x14b7ba){_0x4b4018[_0x420b('0x24')]=_0x14b7ba;if(_0x5770aa['query'][_0x420b('0x44')]){_0x183f17['include']=[{'all':!![]}];}return db[_0x420b('0x61')]['findAll'](_0x183f17);})[_0x420b('0x27')](function(_0x450825){_0x4b4018[_0x420b('0x9b')]=_0x450825;return _0x4b4018;});}})[_0x420b('0x27')](respondWithFilteredResult(_0x4bf969,_0x183f17))[_0x420b('0x1d')](handleError(_0x4bf969,null));};exports['getMyMessages']=function(_0x44d4f1,_0x40f4b2){var _0xa6b54e={'where':{}},_0x556dea={},_0x25b4ee={'count':0x0,'rows':[]};return db[_0x420b('0x3e')]['findOne']({'where':{'id':_0x44d4f1[_0x420b('0x3b')]['id']}})[_0x420b('0x27')](handleEntityNotFound(_0x40f4b2,null))['then'](function(_0x3c7947){if(_0x3c7947){_0x556dea[_0x420b('0x3c')]=_[_0x420b('0x3d')](db[_0x420b('0x61')]['rawAttributes']);_0x556dea[_0x420b('0x38')]=_['keys'](_0x44d4f1['query']);_0x556dea[_0x420b('0x3f')]=_['intersection'](_0x556dea[_0x420b('0x3c')],_0x556dea['query']);_0xa6b54e[_0x420b('0x41')]=_[_0x420b('0x40')](_0x556dea[_0x420b('0x3c')],qs[_0x420b('0x42')](_0x44d4f1[_0x420b('0x38')][_0x420b('0x42')]));_0xa6b54e[_0x420b('0x41')]=_0xa6b54e[_0x420b('0x41')][_0x420b('0x43')]?_0xa6b54e[_0x420b('0x41')]:_0x556dea[_0x420b('0x3c')];if(!_0x44d4f1[_0x420b('0x38')][_0x420b('0x9c')]('nolimit')){_0xa6b54e[_0x420b('0x23')]=qs[_0x420b('0x23')](_0x44d4f1[_0x420b('0x38')][_0x420b('0x23')]);_0xa6b54e['offset']=qs[_0x420b('0x21')](_0x44d4f1['query'][_0x420b('0x21')]);}_0xa6b54e[_0x420b('0x92')]=qs[_0x420b('0x93')](_0x44d4f1[_0x420b('0x38')]['sort']);_0xa6b54e[_0x420b('0x94')]=qs[_0x420b('0x3f')](_['pick'](_0x44d4f1[_0x420b('0x38')],_0x556dea['filters']));_0xa6b54e[_0x420b('0x94')][_0x420b('0x96')]=_0x3c7947['id'];if(_0x44d4f1[_0x420b('0x38')]['filter']){_0xa6b54e[_0x420b('0x94')]=_['merge'](_0xa6b54e['where'],{'$or':_[_0x420b('0x31')](_0xa6b54e[_0x420b('0x41')],function(_0x1db5db){var _0x12f2a5={};_0x12f2a5[_0x1db5db]={'$like':'%'+_0x44d4f1[_0x420b('0x38')][_0x420b('0x97')]+'%'};return _0x12f2a5;})});}_0xa6b54e[_0x420b('0x94')][_0x420b('0x83')]=![];if(_0x44d4f1[_0x420b('0x38')]['id']){_0xa6b54e[_0x420b('0x94')]['id']={'$gt':_0x44d4f1[_0x420b('0x38')]['id']};}_0xa6b54e=_[_0x420b('0x9a')]({},_0xa6b54e,_0x44d4f1[_0x420b('0x46')]);return db['ChatMessage'][_0x420b('0x24')]({'where':_0xa6b54e[_0x420b('0x94')]})[_0x420b('0x27')](function(_0x39c75a){_0x25b4ee[_0x420b('0x24')]=_0x39c75a;_0xa6b54e['include']=[];if(_0x44d4f1[_0x420b('0x38')][_0x420b('0x9d')]){_0xa6b54e[_0x420b('0x45')]['push']({'model':db[_0x420b('0x7a')],'as':'User','attributes':['id',_0x420b('0x54'),_0x420b('0x9e')]});}if(_0x44d4f1[_0x420b('0x38')][_0x420b('0x44')]){_0xa6b54e[_0x420b('0x45')]=[{'all':!![]}];}return db[_0x420b('0x61')]['findAll'](_0xa6b54e);})[_0x420b('0x27')](function(_0x351b1f){_0x25b4ee[_0x420b('0x9b')]=_0x351b1f;return _0x25b4ee;});}})['then'](respondWithFilteredResult(_0x40f4b2,_0xa6b54e))[_0x420b('0x1d')](handleError(_0x40f4b2,null));};exports[_0x420b('0x9f')]=function(_0x24e9bb,_0x56a7d6){return db[_0x420b('0x3e')][_0x420b('0x47')]({'where':{'id':_0x24e9bb[_0x420b('0x3b')]['id']}})['then'](handleEntityNotFound(_0x56a7d6,null))[_0x420b('0x27')](function(_0x449ae3){if(_0x449ae3){return _0x449ae3[_0x420b('0xa0')](_0x24e9bb[_0x420b('0x2c')]['ids'],_[_0x420b('0xa1')](_0x24e9bb['body'],['ids','id'])||{})[_0x420b('0xa2')](function(){return db[_0x420b('0xa3')]['findAll']({'attributes':['id','name','color'],'where':{'id':_0x24e9bb[_0x420b('0x2c')][_0x420b('0x8f')]}});})[_0x420b('0x27')](function(_0x6c5493){socket[_0x420b('0xa4')](_0x420b('0xa5'),{'id':Number(_0x24e9bb[_0x420b('0x3b')]['id']),'tags':_0x6c5493||[]});return{'id':Number(_0x24e9bb[_0x420b('0x3b')]['id']),'tags':_0x6c5493||[]};});}})['then'](respondWithResult(_0x56a7d6,null))[_0x420b('0x1d')](handleError(_0x56a7d6,null));};exports[_0x420b('0xa6')]=function(_0x581b92,_0x43b479){return db[_0x420b('0x3e')]['find']({'where':{'id':_0x581b92['params']['id']}})[_0x420b('0x27')](handleEntityNotFound(_0x43b479,null))[_0x420b('0x27')](function(_0x4fecf8){if(_0x4fecf8){return _0x4fecf8[_0x420b('0xa6')](_0x581b92[_0x420b('0x38')]['ids']);}})['then'](respondWithStatusCode(_0x43b479,null))['catch'](handleError(_0x43b479,null));};exports[_0x420b('0x74')]=function(_0x1657d8,_0x5b5e1d){var _0x4a3486=moment()[_0x420b('0xa7')]()[_0x420b('0xa8')]();var _0x7e6d31=path[_0x420b('0x72')](config[_0x420b('0xa9')],_0x420b('0xaa'),_0x420b('0xab'),_0x420b('0xac'));var _0x5af331=path[_0x420b('0x72')](config[_0x420b('0xa9')],_0x420b('0xaa'),_0x420b('0xab'),_0x420b('0xad'));var _0x1d5317=path[_0x420b('0x72')](_0x7e6d31,_0x4a3486);var _0x42b8b7=util['format'](_0x420b('0xae'),_0x1657d8['params']['id'],_0x4a3486);var _0x1348e2=path[_0x420b('0x72')](_0x7e6d31,_0x42b8b7);var _0x43ec5f=[];_0x43ec5f[_0x420b('0xaf')]({'model':db[_0x420b('0x7a')],'as':_0x420b('0x7a'),'attributes':['id',_0x420b('0x54')],'raw':!![]});_0x43ec5f[_0x420b('0xaf')]({'model':db[_0x420b('0x63')],'as':_0x420b('0x64'),'attributes':['id',_0x420b('0xb0'),_0x420b('0xb1')],'raw':!![]});if(_0x1657d8[_0x420b('0x38')][_0x420b('0xad')]){_0x43ec5f[_0x420b('0xaf')]({'model':db[_0x420b('0x6e')],'as':_0x420b('0x6e'),'raw':!![]});}var _0x2fa041=[{'model':db[_0x420b('0x61')],'as':'Messages','attributes':['id',_0x420b('0x2c'),_0x420b('0xb2'),_0x420b('0xb3'),_0x420b('0x83'),_0x420b('0xb4')],'include':_0x43ec5f}];_0x2fa041[_0x420b('0xaf')]({'model':db['ChatWebsite'],'as':'Account','attributes':['id',_0x420b('0x29')]});_0x2fa041['push']({'model':db[_0x420b('0x7a')],'as':'Owner','attributes':['id','fullname']});return db[_0x420b('0x3e')][_0x420b('0x47')]({'where':{'id':_0x1657d8[_0x420b('0x3b')]['id']},'include':_0x2fa041})[_0x420b('0x27')](handleEntityNotFound(_0x5b5e1d,null))[_0x420b('0x27')](function(_0x30b2bc){if(_0x30b2bc){var _0x5d6e9d=_0x30b2bc['get']({'plain':!![]});fs[_0x420b('0xb5')](_0x1d5317);var _0x353155={'channel':'Chat','account':_0x5d6e9d[_0x420b('0xb6')]['name'],'agent':_0x5d6e9d['Owner']?_0x5d6e9d[_0x420b('0xb7')][_0x420b('0x54')]:_0x420b('0xb8'),'createdAt':moment(_0x5d6e9d[_0x420b('0xb2')])[_0x420b('0x76')](_0x420b('0xb9'))[_0x420b('0xa8')](),'closedAt':_0x5d6e9d[_0x420b('0x68')]?moment(_0x5d6e9d[_0x420b('0xba')])[_0x420b('0x76')]('YYYY-MM-DD\x20HH:mm:ss')['toString']():'','disposition':_0x5d6e9d[_0x420b('0x69')],'chatInfo':{'browser':_0x5d6e9d[_0x420b('0xbb')],'os':_0x5d6e9d[_0x420b('0xbc')],'referer':_0x5d6e9d[_0x420b('0xbd')],'customerIp':_0x5d6e9d[_0x420b('0xbe')],'customerPort':_0x5d6e9d[_0x420b('0xbf')]?_0x5d6e9d[_0x420b('0xbf')]:_0x420b('0xb8')},'messages':_(_0x5d6e9d[_0x420b('0x79')])[_0x420b('0xc0')]()[_0x420b('0x97')]({'secret':![]})['map'](function(_0x44b91d){if(_0x44b91d[_0x420b('0x6e')]){var _0x820177=path['join'](_0x5af331,_0x44b91d[_0x420b('0x6e')][_0x420b('0x6b')]);if(fs[_0x420b('0xc1')](_0x820177)){fs[_0x420b('0xc2')](_0x820177)['pipe'](fs[_0x420b('0xc3')](path['join'](_0x1d5317,_0x44b91d[_0x420b('0x6e')][_0x420b('0x6b')])));}}return{'date':moment(_0x44b91d['createdAt'])[_0x420b('0x76')](_0x420b('0xb9'))[_0x420b('0xa8')](),'sender':_0x44b91d['direction']===_0x420b('0x60')?_0x44b91d['User']?_0x44b91d[_0x420b('0x7a')][_0x420b('0x54')]:_0x420b('0x81'):_0x44b91d['Contact']['firstName']+(_0x44b91d[_0x420b('0x64')]['lastName']?'\x20'+_0x44b91d[_0x420b('0x64')]['lastName']:''),'body':_0x44b91d[_0x420b('0x6e')]?_0x44b91d[_0x420b('0x6e')]['basename']:_0x44b91d[_0x420b('0x2c')],'direction':_0x44b91d['direction']===_0x420b('0x60')?'A':'C','secret':_0x44b91d[_0x420b('0x83')],'read':_0x44b91d[_0x420b('0xb4')],'attachment':_0x44b91d['Attachment']};})[_0x420b('0xc4')]()};return ejs['renderFile'](path[_0x420b('0x72')](config['root'],_0x420b('0xaa'),_0x420b('0xc5'),_0x420b('0xc6')),{'interaction':_0x353155})[_0x420b('0x27')](function(_0x4d5478){var _0xfe76da=path[_0x420b('0x72')](_0x1d5317,_0x420b('0xc7')+_0x5d6e9d['id']+'-'+_0x4a3486+_0x420b('0xc8'));var _0x56dd7a={'path':_0xfe76da,'channel':_0x420b('0xc9'),'interactionId':_0x5d6e9d['id']};return pdf[_0x420b('0xca')](_0x4d5478,_0x56dd7a);})[_0x420b('0x27')](function(){return new Promise(function(_0x25a589,_0x494b47){zipdir(_0x1d5317,{'saveTo':_0x1348e2},function(_0x15f92a,_0x240773){if(_0x15f92a)return _0x494b47(_0x15f92a);return _0x25a589(_0x240773);});})['then'](function(){return new BPromise(function(_0x1dccbe,_0x508580){rimraf(_0x1d5317,function(_0x4411b8){if(_0x4411b8)_0x508580(_0x4411b8);return _0x1dccbe();});});})['then'](function(){return _0x5b5e1d[_0x420b('0x74')](_0x1348e2,_0x42b8b7,function(_0x4e458b){if(_0x4e458b){logger[_0x420b('0x19')](_0x420b('0xcb'),_0x4e458b);}else{fs[_0x420b('0xcc')](_0x1348e2);}});});});}else{return _0x5b5e1d['sendStatus'](0xc8);}})[_0x420b('0x1d')](handleError(_0x5b5e1d,null));}; \ No newline at end of file diff --git a/server/api/chatInteraction/chatInteraction.events.js b/server/api/chatInteraction/chatInteraction.events.js index beff79c..62d9332 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 _0x62c1=['then','setDataValue','Users','map','findAll','length','emit','catch','hasOwnProperty','hook','exports','events','../../mysqldb','ChatInteraction','ChatMessage','setMaxListeners','remove','getUsers'];(function(_0x39a52e,_0x1e24f8){var _0xab539=function(_0x86bc6d){while(--_0x86bc6d){_0x39a52e['push'](_0x39a52e['shift']());}};_0xab539(++_0x1e24f8);}(_0x62c1,0x107));var _0x162c=function(_0x1526e1,_0x5ed5a5){_0x1526e1=_0x1526e1-0x0;var _0x249a1e=_0x62c1[_0x1526e1];return _0x249a1e;};'use strict';var EventEmitter=require(_0x162c('0x0'));var ChatInteraction=require(_0x162c('0x1'))['db'][_0x162c('0x2')];var ChatMessage=require(_0x162c('0x1'))['db'][_0x162c('0x3')];var ChatInteractionEvents=new EventEmitter();ChatInteractionEvents[_0x162c('0x4')](0x0);var events={'afterCreate':'save','afterUpdate':'update','afterDestroy':_0x162c('0x5')};function emitEvent(_0x200c99){return function(_0x4680a9,_0x104e22,_0x37e212){_0x4680a9[_0x162c('0x6')]({'attributes':['id'],'raw':!![]})[_0x162c('0x7')](function(_0x41ab1b){_0x4680a9[_0x162c('0x8')](_0x162c('0x9'),_0x41ab1b[_0x162c('0xa')](function(_0x2e7756){return{'id':_0x2e7756['id']};}));return ChatMessage[_0x162c('0xb')]({'where':{'ChatInteractionId':_0x4680a9['id'],'direction':'in','read':![]},'raw':!![]});})[_0x162c('0x7')](function(_0x19c55e){_0x4680a9['setDataValue']('unreadMessages',_0x19c55e[_0x162c('0xc')]);ChatInteractionEvents[_0x162c('0xd')](_0x200c99+':'+_0x4680a9['id'],_0x4680a9);ChatInteractionEvents[_0x162c('0xd')](_0x200c99,_0x4680a9);_0x37e212(null);})[_0x162c('0xe')](_0x37e212(null));};}for(var e in events){if(events[_0x162c('0xf')](e)){var event=events[e];ChatInteraction[_0x162c('0x10')](e,emitEvent(event));}}module[_0x162c('0x11')]=ChatInteractionEvents; \ No newline at end of file +var _0x2194=['remove','getUsers','setDataValue','Users','map','findAll','then','unreadMessages','length','emit','hook','exports','events','../../mysqldb','setMaxListeners','save','update'];(function(_0x49d41c,_0x2bdc35){var _0xb64c5f=function(_0x28f535){while(--_0x28f535){_0x49d41c['push'](_0x49d41c['shift']());}};_0xb64c5f(++_0x2bdc35);}(_0x2194,0x10b));var _0x4219=function(_0x4bf96c,_0x4d24fd){_0x4bf96c=_0x4bf96c-0x0;var _0x281d09=_0x2194[_0x4bf96c];return _0x281d09;};'use strict';var EventEmitter=require(_0x4219('0x0'));var ChatInteraction=require(_0x4219('0x1'))['db']['ChatInteraction'];var ChatMessage=require('../../mysqldb')['db']['ChatMessage'];var ChatInteractionEvents=new EventEmitter();ChatInteractionEvents[_0x4219('0x2')](0x0);var events={'afterCreate':_0x4219('0x3'),'afterUpdate':_0x4219('0x4'),'afterDestroy':_0x4219('0x5')};function emitEvent(_0x2e92a7){return function(_0x411563,_0x410066,_0x595e6f){_0x411563[_0x4219('0x6')]({'attributes':['id'],'raw':!![]})['then'](function(_0x2c9a3f){_0x411563[_0x4219('0x7')](_0x4219('0x8'),_0x2c9a3f[_0x4219('0x9')](function(_0x30844e){return{'id':_0x30844e['id']};}));return ChatMessage[_0x4219('0xa')]({'where':{'ChatInteractionId':_0x411563['id'],'direction':'in','read':![]},'raw':!![]});})[_0x4219('0xb')](function(_0x3d2e8d){_0x411563[_0x4219('0x7')](_0x4219('0xc'),_0x3d2e8d[_0x4219('0xd')]);ChatInteractionEvents[_0x4219('0xe')](_0x2e92a7+':'+_0x411563['id'],_0x411563);ChatInteractionEvents['emit'](_0x2e92a7,_0x411563);_0x595e6f(null);})['catch'](_0x595e6f(null));};}for(var e in events){if(events['hasOwnProperty'](e)){var event=events[e];ChatInteraction[_0x4219('0xf')](e,emitEvent(event));}}module[_0x4219('0x10')]=ChatInteractionEvents; \ No newline at end of file diff --git a/server/api/chatInteraction/chatInteraction.model.js b/server/api/chatInteraction/chatInteraction.model.js index a49ad78..b6359b2 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 _0x8b5d=['request-promise','path','rimraf','./chatInteraction.attributes','exports','ChatInteraction','chat_interactions','changed','closed','closedAt','format','YYYY-MM-DD\x20HH:mm:ss','utf8mb4','lodash','util','../../config/logger','moment','bluebird'];(function(_0x2cc0b3,_0x120bf1){var _0x1667ef=function(_0x3abcb4){while(--_0x3abcb4){_0x2cc0b3['push'](_0x2cc0b3['shift']());}};_0x1667ef(++_0x120bf1);}(_0x8b5d,0x13f));var _0xd8b5=function(_0x5c846d,_0x5c02ce){_0x5c846d=_0x5c846d-0x0;var _0xd064e4=_0x8b5d[_0x5c846d];return _0xd064e4;};'use strict';var _=require(_0xd8b5('0x0'));var util=require(_0xd8b5('0x1'));var logger=require(_0xd8b5('0x2'))('api');var moment=require(_0xd8b5('0x3'));var BPromise=require(_0xd8b5('0x4'));var rp=require(_0xd8b5('0x5'));var fs=require('fs');var path=require(_0xd8b5('0x6'));var rimraf=require(_0xd8b5('0x7'));var config=require('../../config/environment');var attributes=require(_0xd8b5('0x8'));module[_0xd8b5('0x9')]=function(_0x30e828,_0xbcbc02){return _0x30e828['define'](_0xd8b5('0xa'),attributes,{'tableName':_0xd8b5('0xb'),'paranoid':![],'indexes':[],'timestamps':!![],'hooks':{'beforeUpdate':function(_0xba0130,_0xe48ef1,_0x1e5f8f){if(_0xba0130[_0xd8b5('0xc')](_0xd8b5('0xd'))){_0xba0130[_0xd8b5('0xe')]=moment()[_0xd8b5('0xf')](_0xd8b5('0x10'));}_0x1e5f8f(null,_0xba0130);}},'charset':_0xd8b5('0x11'),'collate':'utf8mb4_unicode_ci'});}; \ No newline at end of file +var _0xc542=['../../config/logger','moment','request-promise','path','../../config/environment','./chatInteraction.attributes','exports','ChatInteraction','chat_interactions','changed','closed','closedAt','format','YYYY-MM-DD\x20HH:mm:ss','utf8mb4_unicode_ci','util'];(function(_0x264b9b,_0xa1181e){var _0x4c7a0e=function(_0x4b77a0){while(--_0x4b77a0){_0x264b9b['push'](_0x264b9b['shift']());}};_0x4c7a0e(++_0xa1181e);}(_0xc542,0x17f));var _0x2c54=function(_0x13b8f3,_0x442821){_0x13b8f3=_0x13b8f3-0x0;var _0x1a6d06=_0xc542[_0x13b8f3];return _0x1a6d06;};'use strict';var _=require('lodash');var util=require(_0x2c54('0x0'));var logger=require(_0x2c54('0x1'))('api');var moment=require(_0x2c54('0x2'));var BPromise=require('bluebird');var rp=require(_0x2c54('0x3'));var fs=require('fs');var path=require(_0x2c54('0x4'));var rimraf=require('rimraf');var config=require(_0x2c54('0x5'));var attributes=require(_0x2c54('0x6'));module[_0x2c54('0x7')]=function(_0x1650bb,_0x3eb9ff){return _0x1650bb['define'](_0x2c54('0x8'),attributes,{'tableName':_0x2c54('0x9'),'paranoid':![],'indexes':[],'timestamps':!![],'hooks':{'beforeUpdate':function(_0x51bfef,_0x834231,_0x20e1c2){if(_0x51bfef[_0x2c54('0xa')](_0x2c54('0xb'))){_0x51bfef[_0x2c54('0xc')]=moment()[_0x2c54('0xd')](_0x2c54('0xe'));}_0x20e1c2(null,_0x51bfef);}},'charset':'utf8mb4','collate':_0x2c54('0xf')});}; \ No newline at end of file diff --git a/server/api/chatInteraction/chatInteraction.rpc.js b/server/api/chatInteraction/chatInteraction.rpc.js index b5bd6e7..2d6cc56 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 _0xb099=['socket.io-emitter','./chatInteraction.socket','then','debug','ChatInteraction,\x20%s,\x20%s,\x20%s','request\x20sent','stringify','error','code','ChatInteraction,\x20%s,\x20%s','message','info','UpdateChatInteraction','ChatInteraction','update','body','options','attributes','catch','AddTagsToChatInteraction','find','where','addTags','omit','ids','spread','AddTags','lodash','util','moment','bluebird','ioredis','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','client','redis','defaults','localhost'];(function(_0x3c628f,_0x1767ff){var _0x4da7ec=function(_0x37fd51){while(--_0x37fd51){_0x3c628f['push'](_0x3c628f['shift']());}};_0x4da7ec(++_0x1767ff);}(_0xb099,0x6d));var _0x9b09=function(_0x8030d1,_0x1e3a72){_0x8030d1=_0x8030d1-0x0;var _0x32206c=_0xb099[_0x8030d1];return _0x32206c;};'use strict';var _=require(_0x9b09('0x0'));var util=require(_0x9b09('0x1'));var moment=require(_0x9b09('0x2'));var BPromise=require(_0x9b09('0x3'));var rs=require('randomstring');var fs=require('fs');var Redis=require(_0x9b09('0x4'));var db=require('../../mysqldb')['db'];var utils=require(_0x9b09('0x5'));var logger=require(_0x9b09('0x6'))(_0x9b09('0x7'));var config=require(_0x9b09('0x8'));var jayson=require(_0x9b09('0x9'));var client=jayson[_0x9b09('0xa')]['http']({'port':0x232a});config[_0x9b09('0xb')]=_[_0x9b09('0xc')](config['redis'],{'host':_0x9b09('0xd'),'port':0x18eb});var socket=require(_0x9b09('0xe'))(new Redis(config['redis']));require(_0x9b09('0xf'))['register'](socket);function respondWithRpcPromise(_0x2e7d18,_0x2ed30d,_0x11ccfd){return new BPromise(function(_0x1768f8,_0x40c457){return client['request'](_0x2e7d18,_0x11ccfd)[_0x9b09('0x10')](function(_0xccf42c){logger['info']('ChatInteraction,\x20%s,\x20%s',_0x2ed30d,'request\x20sent');logger[_0x9b09('0x11')](_0x9b09('0x12'),_0x2ed30d,_0x9b09('0x13'),JSON[_0x9b09('0x14')](_0xccf42c));if(_0xccf42c[_0x9b09('0x15')]){if(_0xccf42c['error'][_0x9b09('0x16')]===0x1f4){logger[_0x9b09('0x15')](_0x9b09('0x17'),_0x2ed30d,_0xccf42c[_0x9b09('0x15')]['message']);return _0x40c457(_0xccf42c['error'][_0x9b09('0x18')]);}logger[_0x9b09('0x15')]('ChatInteraction,\x20%s,\x20%s',_0x2ed30d,_0xccf42c[_0x9b09('0x15')][_0x9b09('0x18')]);return _0x1768f8(_0xccf42c[_0x9b09('0x15')][_0x9b09('0x18')]);}else{logger[_0x9b09('0x19')](_0x9b09('0x17'),_0x2ed30d,_0x9b09('0x13'));_0x1768f8(_0xccf42c['result']['message']);}})['catch'](function(_0x41d155){logger['error']('ChatInteraction,\x20%s,\x20%s',_0x2ed30d,_0x41d155);_0x40c457(_0x41d155);});});}exports[_0x9b09('0x1a')]=function(_0x1646ba){var _0x5da993=this;return new Promise(function(_0x4c4de0,_0x5302dc){return db[_0x9b09('0x1b')][_0x9b09('0x1c')](_0x1646ba[_0x9b09('0x1d')],{'raw':_0x1646ba['options']?_0x1646ba[_0x9b09('0x1e')]['raw']===undefined?!![]:![]:!![],'individualHooks':!![],'where':_0x1646ba[_0x9b09('0x1e')]?_0x1646ba[_0x9b09('0x1e')]['where']||null:null,'attributes':_0x1646ba[_0x9b09('0x1e')]?_0x1646ba['options'][_0x9b09('0x1f')]||null:null,'limit':_0x1646ba[_0x9b09('0x1e')]?_0x1646ba[_0x9b09('0x1e')]['limit']||null:null})[_0x9b09('0x10')](function(_0x35b7a1){logger[_0x9b09('0x19')]('UpdateChatInteraction',_0x1646ba);logger[_0x9b09('0x11')]('UpdateChatInteraction',_0x1646ba,JSON[_0x9b09('0x14')](_0x35b7a1));_0x4c4de0(_0x35b7a1);})[_0x9b09('0x20')](function(_0x590530){logger['error'](_0x9b09('0x1a'),_0x590530[_0x9b09('0x18')],_0x1646ba);_0x5302dc(_0x5da993[_0x9b09('0x15')](0x1f4,_0x590530[_0x9b09('0x18')]));});});};exports[_0x9b09('0x21')]=function(_0x3dc372){return new Promise(function(_0x5996b5,_0x20002f){return db[_0x9b09('0x1b')][_0x9b09('0x22')]({'where':_0x3dc372[_0x9b09('0x1e')]?_0x3dc372[_0x9b09('0x1e')][_0x9b09('0x23')]||null:null})[_0x9b09('0x10')](function(_0x4a103e){if(_0x4a103e){return _0x4a103e[_0x9b09('0x24')](_0x3dc372[_0x9b09('0x1d')]['ids'],_[_0x9b09('0x25')](_0x3dc372['body'],[_0x9b09('0x26'),'id'])||{});}})[_0x9b09('0x27')](function(_0x3ff7af){logger[_0x9b09('0x19')]('AddTags',_0x3dc372);logger['debug']('AddTags',_0x3dc372,JSON[_0x9b09('0x14')](_0x3ff7af));_0x5996b5(_0x3ff7af);})[_0x9b09('0x20')](function(_0x4bd251){logger['error'](_0x9b09('0x28'),_0x4bd251['message'],_0x3dc372);_0x20002f(_this[_0x9b09('0x15')](0x1f4,_0x4bd251[_0x9b09('0x18')]));});});}; \ No newline at end of file +var _0x6464=['./chatInteraction.socket','register','then','info','ChatInteraction,\x20%s,\x20%s','request\x20sent','ChatInteraction,\x20%s,\x20%s,\x20%s','stringify','error','code','message','result','catch','UpdateChatInteraction','body','options','raw','where','attributes','limit','ChatInteraction','find','ids','spread','AddTags','debug','util','moment','bluebird','randomstring','../../mysqldb','../../config/logger','rpc','../../config/environment','jayson/promise','http','redis','defaults','localhost','socket.io-emitter'];(function(_0x32b423,_0x252697){var _0x414faf=function(_0x1df1ca){while(--_0x1df1ca){_0x32b423['push'](_0x32b423['shift']());}};_0x414faf(++_0x252697);}(_0x6464,0x1aa));var _0x4646=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0x6464[_0x3dd15e];return _0x231fd0;};'use strict';var _=require('lodash');var util=require(_0x4646('0x0'));var moment=require(_0x4646('0x1'));var BPromise=require(_0x4646('0x2'));var rs=require(_0x4646('0x3'));var fs=require('fs');var Redis=require('ioredis');var db=require(_0x4646('0x4'))['db'];var utils=require('../../config/utils');var logger=require(_0x4646('0x5'))(_0x4646('0x6'));var config=require(_0x4646('0x7'));var jayson=require(_0x4646('0x8'));var client=jayson['client'][_0x4646('0x9')]({'port':0x232a});config[_0x4646('0xa')]=_[_0x4646('0xb')](config['redis'],{'host':_0x4646('0xc'),'port':0x18eb});var socket=require(_0x4646('0xd'))(new Redis(config[_0x4646('0xa')]));require(_0x4646('0xe'))[_0x4646('0xf')](socket);function respondWithRpcPromise(_0x37630b,_0x3e836a,_0x2dc02e){return new BPromise(function(_0x2c4339,_0x57ebc9){return client['request'](_0x37630b,_0x2dc02e)[_0x4646('0x10')](function(_0x25c2c9){logger[_0x4646('0x11')](_0x4646('0x12'),_0x3e836a,_0x4646('0x13'));logger['debug'](_0x4646('0x14'),_0x3e836a,_0x4646('0x13'),JSON[_0x4646('0x15')](_0x25c2c9));if(_0x25c2c9[_0x4646('0x16')]){if(_0x25c2c9[_0x4646('0x16')][_0x4646('0x17')]===0x1f4){logger[_0x4646('0x16')](_0x4646('0x12'),_0x3e836a,_0x25c2c9['error'][_0x4646('0x18')]);return _0x57ebc9(_0x25c2c9[_0x4646('0x16')][_0x4646('0x18')]);}logger['error'](_0x4646('0x12'),_0x3e836a,_0x25c2c9[_0x4646('0x16')][_0x4646('0x18')]);return _0x2c4339(_0x25c2c9[_0x4646('0x16')][_0x4646('0x18')]);}else{logger[_0x4646('0x11')](_0x4646('0x12'),_0x3e836a,_0x4646('0x13'));_0x2c4339(_0x25c2c9[_0x4646('0x19')][_0x4646('0x18')]);}})[_0x4646('0x1a')](function(_0xad2134){logger[_0x4646('0x16')]('ChatInteraction,\x20%s,\x20%s',_0x3e836a,_0xad2134);_0x57ebc9(_0xad2134);});});}exports[_0x4646('0x1b')]=function(_0x543a88){var _0x4d1718=this;return new Promise(function(_0x1337d0,_0x5dfdfb){return db['ChatInteraction']['update'](_0x543a88[_0x4646('0x1c')],{'raw':_0x543a88['options']?_0x543a88[_0x4646('0x1d')][_0x4646('0x1e')]===undefined?!![]:![]:!![],'individualHooks':!![],'where':_0x543a88[_0x4646('0x1d')]?_0x543a88[_0x4646('0x1d')][_0x4646('0x1f')]||null:null,'attributes':_0x543a88[_0x4646('0x1d')]?_0x543a88[_0x4646('0x1d')][_0x4646('0x20')]||null:null,'limit':_0x543a88[_0x4646('0x1d')]?_0x543a88[_0x4646('0x1d')][_0x4646('0x21')]||null:null})[_0x4646('0x10')](function(_0x456829){logger[_0x4646('0x11')]('UpdateChatInteraction',_0x543a88);logger['debug'](_0x4646('0x1b'),_0x543a88,JSON['stringify'](_0x456829));_0x1337d0(_0x456829);})[_0x4646('0x1a')](function(_0x11dfc3){logger['error'](_0x4646('0x1b'),_0x11dfc3[_0x4646('0x18')],_0x543a88);_0x5dfdfb(_0x4d1718[_0x4646('0x16')](0x1f4,_0x11dfc3['message']));});});};exports['AddTagsToChatInteraction']=function(_0x1c7767){return new Promise(function(_0x495534,_0x25eebf){return db[_0x4646('0x22')][_0x4646('0x23')]({'where':_0x1c7767[_0x4646('0x1d')]?_0x1c7767[_0x4646('0x1d')][_0x4646('0x1f')]||null:null})[_0x4646('0x10')](function(_0x2a9ead){if(_0x2a9ead){return _0x2a9ead['addTags'](_0x1c7767[_0x4646('0x1c')][_0x4646('0x24')],_['omit'](_0x1c7767[_0x4646('0x1c')],[_0x4646('0x24'),'id'])||{});}})[_0x4646('0x25')](function(_0x575c33){logger[_0x4646('0x11')](_0x4646('0x26'),_0x1c7767);logger[_0x4646('0x27')](_0x4646('0x26'),_0x1c7767,JSON[_0x4646('0x15')](_0x575c33));_0x495534(_0x575c33);})['catch'](function(_0x771980){logger[_0x4646('0x16')](_0x4646('0x26'),_0x771980[_0x4646('0x18')],_0x1c7767);_0x25eebf(_this['error'](0x1f4,_0x771980['message']));});});}; \ No newline at end of file diff --git a/server/api/chatInteraction/chatInteraction.socket.js b/server/api/chatInteraction/chatInteraction.socket.js index 5558b03..52d5123 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 _0x3fe1=['remove','update','emit','removeListener','chatInteraction:','save'];(function(_0x45e436,_0x3ab05c){var _0x1c375e=function(_0x586445){while(--_0x586445){_0x45e436['push'](_0x45e436['shift']());}};_0x1c375e(++_0x3ab05c);}(_0x3fe1,0x89));var _0x13fe=function(_0x51dd28,_0x29cf8e){_0x51dd28=_0x51dd28-0x0;var _0x1fc66e=_0x3fe1[_0x51dd28];return _0x1fc66e;};'use strict';var ChatInteractionEvents=require('./chatInteraction.events');var events=[_0x13fe('0x0'),_0x13fe('0x1'),_0x13fe('0x2')];function createListener(_0x38f17f,_0x195d51){return function(_0x2cae7d){_0x195d51[_0x13fe('0x3')](_0x38f17f,_0x2cae7d);};}function removeListener(_0x4a0b5e,_0x25b545){return function(){ChatInteractionEvents[_0x13fe('0x4')](_0x4a0b5e,_0x25b545);};}exports['register']=function(_0x3d9bd4){for(var _0x5d9ad0=0x0,_0x1e80de=events['length'];_0x5d9ad0<_0x1e80de;_0x5d9ad0++){var _0x23c99c=events[_0x5d9ad0];var _0x575b06=createListener(_0x13fe('0x5')+_0x23c99c,_0x3d9bd4);ChatInteractionEvents['on'](_0x23c99c,_0x575b06);}}; \ No newline at end of file +var _0x6c88=['register','length','chatInteraction:','./chatInteraction.events','save','remove','update','emit','removeListener'];(function(_0x2ed785,_0x158b7c){var _0x5c1f0=function(_0x27a73f){while(--_0x27a73f){_0x2ed785['push'](_0x2ed785['shift']());}};_0x5c1f0(++_0x158b7c);}(_0x6c88,0xa5));var _0x86c8=function(_0x3ff78f,_0x4bfafd){_0x3ff78f=_0x3ff78f-0x0;var _0x5abe3c=_0x6c88[_0x3ff78f];return _0x5abe3c;};'use strict';var ChatInteractionEvents=require(_0x86c8('0x0'));var events=[_0x86c8('0x1'),_0x86c8('0x2'),_0x86c8('0x3')];function createListener(_0x2569e8,_0x159cca){return function(_0x41dc32){_0x159cca[_0x86c8('0x4')](_0x2569e8,_0x41dc32);};}function removeListener(_0x31407b,_0x37845e){return function(){ChatInteractionEvents[_0x86c8('0x5')](_0x31407b,_0x37845e);};}exports[_0x86c8('0x6')]=function(_0x3b540b){for(var _0x2148a8=0x0,_0x1b4299=events[_0x86c8('0x7')];_0x2148a8<_0x1b4299;_0x2148a8++){var _0x32f4e4=events[_0x2148a8];var _0x27326b=createListener(_0x86c8('0x8')+_0x32f4e4,_0x3b540b);ChatInteractionEvents['on'](_0x32f4e4,_0x27326b);}}; \ No newline at end of file diff --git a/server/api/chatInteraction/index.js b/server/api/chatInteraction/index.js index 491a60b..0b07f04 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 _0xf180=['get','/:id','show','/:id/attachment_download','isChatInteractionAuthorized','/:id/messages','/:id/my_messages','getMyMessages','post','create','/:id/vidaoo','createVidaooSession','diskStorage','root','server/files/attachments/','format','now','originalname','replace','/:id/attachment_upload','single','attachmentUpload','addMessage','/:id/tags','tracked','chat','chatinteraction:update','update','put','customUpdate','/:id/abandon','/:id/close','close','delete','destroy','removeTags','exports','multer','util','connect-timeout','express','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','isAuthenticated','index','/describe','describe'];(function(_0x3e13f3,_0x1c0c0d){var _0x40912f=function(_0x49b0cd){while(--_0x49b0cd){_0x3e13f3['push'](_0x3e13f3['shift']());}};_0x40912f(++_0x1c0c0d);}(_0xf180,0x1de));var _0x0f18=function(_0x433a86,_0x175b5c){_0x433a86=_0x433a86-0x0;var _0x23000c=_0xf180[_0x433a86];return _0x23000c;};'use strict';var multer=require(_0x0f18('0x0'));var util=require(_0x0f18('0x1'));var path=require('path');var timeout=require(_0x0f18('0x2'));var express=require(_0x0f18('0x3'));var router=express['Router']();var fs_extra=require(_0x0f18('0x4'));var auth=require(_0x0f18('0x5'));var interaction=require(_0x0f18('0x6'));var config=require(_0x0f18('0x7'));var controller=require('./chatInteraction.controller');router['get']('/',auth[_0x0f18('0x8')](),controller[_0x0f18('0x9')]);router['get'](_0x0f18('0xa'),auth[_0x0f18('0x8')](),controller[_0x0f18('0xb')]);router[_0x0f18('0xc')](_0x0f18('0xd'),auth['isChatInteractionAuthorized'](),controller[_0x0f18('0xe')]);router[_0x0f18('0xc')](_0x0f18('0xf'),auth[_0x0f18('0x10')](),controller['attachmentDownload']);router['get'](_0x0f18('0x11'),auth['isAuthenticated'](),controller['getMessages']);router[_0x0f18('0xc')](_0x0f18('0x12'),auth[_0x0f18('0x10')](),controller[_0x0f18('0x13')]);router[_0x0f18('0xc')]('/:id/download',auth[_0x0f18('0x8')](),controller['download']);router[_0x0f18('0x14')]('/',auth[_0x0f18('0x8')](),controller[_0x0f18('0x15')]);router[_0x0f18('0x14')](_0x0f18('0x16'),auth[_0x0f18('0x8')](),controller[_0x0f18('0x17')]);var upload=multer({'storage':multer[_0x0f18('0x18')]({'destination':function(_0x22e189,_0x50a47f,_0x41be2a){_0x41be2a(null,path['join'](config[_0x0f18('0x19')],_0x0f18('0x1a')));},'filename':function(_0x345713,_0x467723,_0x47fa38){_0x47fa38(null,util[_0x0f18('0x1b')]('%s-%s',Date[_0x0f18('0x1c')](),_0x467723[_0x0f18('0x1d')][_0x0f18('0x1e')](/[+@&\/\\#,+()$~%'":*?<>{}\s\\|]/g,'-')));}})});router[_0x0f18('0x14')](_0x0f18('0x1f'),upload[_0x0f18('0x20')]('file'),controller[_0x0f18('0x21')]);router[_0x0f18('0x14')]('/:id/messages',auth[_0x0f18('0x10')](),controller[_0x0f18('0x22')]);router['post'](_0x0f18('0x23'),auth[_0x0f18('0x8')](),interaction[_0x0f18('0x24')]('chat','chatinteraction:addtags'),controller['addTags']);router['put'](_0x0f18('0xd'),auth[_0x0f18('0x8')](),interaction['tracked'](_0x0f18('0x25'),_0x0f18('0x26')),controller[_0x0f18('0x27')]);router[_0x0f18('0x28')]('/:id/custom_update',controller[_0x0f18('0x29')]);router['put'](_0x0f18('0x2a'),auth[_0x0f18('0x10')](),controller['abandon']);router[_0x0f18('0x28')](_0x0f18('0x2b'),controller[_0x0f18('0x2c')]);router[_0x0f18('0x2d')]('/:id',auth[_0x0f18('0x8')](),interaction[_0x0f18('0x24')](_0x0f18('0x25'),'chatinteraction:destroy'),controller[_0x0f18('0x2e')]);router['delete']('/:id/tags',auth['isAuthenticated'](),controller[_0x0f18('0x2f')]);module[_0x0f18('0x30')]=router; \ No newline at end of file +var _0xb18b=['originalname','replace','/:id/attachment_upload','attachmentUpload','addMessage','/:id/tags','tracked','chat','chatinteraction:addtags','addTags','put','/:id','chatinteraction:update','update','/:id/custom_update','/:id/abandon','abandon','/:id/close','delete','util','express','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','./chatInteraction.controller','get','isAuthenticated','/describe','isChatInteractionAuthorized','show','/:id/attachment_download','/:id/messages','/:id/my_messages','/:id/download','create','post','/:id/vidaoo','createVidaooSession','diskStorage','join','root','server/files/attachments/','%s-%s','now'];(function(_0x476a3c,_0x215c45){var _0x28c007=function(_0x369c80){while(--_0x369c80){_0x476a3c['push'](_0x476a3c['shift']());}};_0x28c007(++_0x215c45);}(_0xb18b,0x14e));var _0xbb18=function(_0x242875,_0x44524a){_0x242875=_0x242875-0x0;var _0x25b3ee=_0xb18b[_0x242875];return _0x25b3ee;};'use strict';var multer=require('multer');var util=require(_0xbb18('0x0'));var path=require('path');var timeout=require('connect-timeout');var express=require(_0xbb18('0x1'));var router=express['Router']();var fs_extra=require(_0xbb18('0x2'));var auth=require(_0xbb18('0x3'));var interaction=require(_0xbb18('0x4'));var config=require(_0xbb18('0x5'));var controller=require(_0xbb18('0x6'));router[_0xbb18('0x7')]('/',auth[_0xbb18('0x8')](),controller['index']);router['get'](_0xbb18('0x9'),auth[_0xbb18('0x8')](),controller['describe']);router[_0xbb18('0x7')]('/:id',auth[_0xbb18('0xa')](),controller[_0xbb18('0xb')]);router[_0xbb18('0x7')](_0xbb18('0xc'),auth[_0xbb18('0xa')](),controller['attachmentDownload']);router[_0xbb18('0x7')](_0xbb18('0xd'),auth['isAuthenticated'](),controller['getMessages']);router[_0xbb18('0x7')](_0xbb18('0xe'),auth[_0xbb18('0xa')](),controller['getMyMessages']);router[_0xbb18('0x7')](_0xbb18('0xf'),auth[_0xbb18('0x8')](),controller['download']);router['post']('/',auth[_0xbb18('0x8')](),controller[_0xbb18('0x10')]);router[_0xbb18('0x11')](_0xbb18('0x12'),auth[_0xbb18('0x8')](),controller[_0xbb18('0x13')]);var upload=multer({'storage':multer[_0xbb18('0x14')]({'destination':function(_0x489a6e,_0x357b59,_0x36c6ed){_0x36c6ed(null,path[_0xbb18('0x15')](config[_0xbb18('0x16')],_0xbb18('0x17')));},'filename':function(_0x44cdb7,_0xe553b2,_0x4caa28){_0x4caa28(null,util['format'](_0xbb18('0x18'),Date[_0xbb18('0x19')](),_0xe553b2[_0xbb18('0x1a')][_0xbb18('0x1b')](/[+@&\/\\#,+()$~%'":*?<>{}\s\\|]/g,'-')));}})});router['post'](_0xbb18('0x1c'),upload['single']('file'),controller[_0xbb18('0x1d')]);router[_0xbb18('0x11')](_0xbb18('0xd'),auth[_0xbb18('0xa')](),controller[_0xbb18('0x1e')]);router['post'](_0xbb18('0x1f'),auth[_0xbb18('0x8')](),interaction[_0xbb18('0x20')](_0xbb18('0x21'),_0xbb18('0x22')),controller[_0xbb18('0x23')]);router[_0xbb18('0x24')](_0xbb18('0x25'),auth[_0xbb18('0x8')](),interaction['tracked']('chat',_0xbb18('0x26')),controller[_0xbb18('0x27')]);router[_0xbb18('0x24')](_0xbb18('0x28'),controller['customUpdate']);router[_0xbb18('0x24')](_0xbb18('0x29'),auth['isChatInteractionAuthorized'](),controller[_0xbb18('0x2a')]);router['put'](_0xbb18('0x2b'),controller['close']);router[_0xbb18('0x2c')]('/:id',auth[_0xbb18('0x8')](),interaction['tracked'](_0xbb18('0x21'),'chatinteraction:destroy'),controller['destroy']);router[_0xbb18('0x2c')]('/:id/tags',auth[_0xbb18('0x8')](),controller['removeTags']);module['exports']=router; \ No newline at end of file diff --git a/server/api/chatInternalMessage/chatInternalMessage.attributes.js b/server/api/chatInternalMessage/chatInternalMessage.attributes.js index f4f30b7..c147529 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 _0xf4ed=['INTEGER','sequelize','exports','TEXT','medium'];(function(_0x4cbe6a,_0x593aae){var _0x5273fa=function(_0x2332c3){while(--_0x2332c3){_0x4cbe6a['push'](_0x4cbe6a['shift']());}};_0x5273fa(++_0x593aae);}(_0xf4ed,0x88));var _0xdf4e=function(_0x22d318,_0x22dc24){_0x22d318=_0x22d318-0x0;var _0x1c8e5c=_0xf4ed[_0x22d318];return _0x1c8e5c;};'use strict';var Sequelize=require(_0xdf4e('0x0'));module[_0xdf4e('0x1')]={'body':{'type':Sequelize[_0xdf4e('0x2')](_0xdf4e('0x3')),'allowNull':![]},'read':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'ChatInternalMessageId':{'type':Sequelize[_0xdf4e('0x4')]}}; \ No newline at end of file +var _0x3af8=['exports','medium','BOOLEAN','sequelize'];(function(_0x507f63,_0x4b6f1c){var _0x335947=function(_0x120e66){while(--_0x120e66){_0x507f63['push'](_0x507f63['shift']());}};_0x335947(++_0x4b6f1c);}(_0x3af8,0x117));var _0x83af=function(_0xcbb436,_0x3856fa){_0xcbb436=_0xcbb436-0x0;var _0x426dc3=_0x3af8[_0xcbb436];return _0x426dc3;};'use strict';var Sequelize=require(_0x83af('0x0'));module[_0x83af('0x1')]={'body':{'type':Sequelize['TEXT'](_0x83af('0x2')),'allowNull':![]},'read':{'type':Sequelize[_0x83af('0x3')],'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 210ec8f..77c41fe 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 _0x8b49=['rawAttributes','fieldName','type','model','map','query','filters','intersection','attributes','fields','order','sort','pick','where','merge','VIRTUAL','filter','options','includeAll','include','findAll','rows','params','keys','length','find','catch','create','body','describe','get','messages','lastMessageAt','createdAt','format','YYYY-MM-DD\x20HH:mm:ss','User','agent','admin','user','fullname','role','userpic','lastLoginAt','showWebBar','-online','VoiceQueues','Unable\x20to\x20retrieve\x20the\x20current\x20user','Agents','userProfileId','UserProfileResource','isEmpty','resourceId','push','FromId','ToId','read','-createdAt','all','eml-format','rimraf','fast-json-patch','request-promise','mustache','util','path','sox','to-csv','ejs','fs-extra','squel','jsforce','desk.js','querystring','papaparse','ioredis','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','redis','defaults','localhost','socket.io-emitter','./chatInternalMessage.socket','register','sendStatus','status','end','undefined','count','offset','limit','set','json','apply','reject','update','then','destroy','stack','name','send','index','ChatInternalMessage'];(function(_0xf7e13b,_0x353e25){var _0x51efbc=function(_0x55c284){while(--_0x55c284){_0xf7e13b['push'](_0xf7e13b['shift']());}};_0x51efbc(++_0x353e25);}(_0x8b49,0xa8));var _0x98b4=function(_0x437aac,_0x7f0a20){_0x437aac=_0x437aac-0x0;var _0x4a3ee6=_0x8b49[_0x437aac];return _0x4a3ee6;};'use strict';var emlformat=require(_0x98b4('0x0'));var rimraf=require(_0x98b4('0x1'));var zipdir=require('zip-dir');var jsonpatch=require(_0x98b4('0x2'));var rp=require(_0x98b4('0x3'));var moment=require('moment');var BPromise=require('bluebird');var Mustache=require(_0x98b4('0x4'));var util=require(_0x98b4('0x5'));var path=require(_0x98b4('0x6'));var sox=require(_0x98b4('0x7'));var csv=require(_0x98b4('0x8'));var ejs=require(_0x98b4('0x9'));var fs=require('fs');var fs_extra=require(_0x98b4('0xa'));var _=require('lodash');var squel=require(_0x98b4('0xb'));var crypto=require('crypto');var jsforce=require(_0x98b4('0xc'));var deskjs=require(_0x98b4('0xd'));var toCsv=require('to-csv');var querystring=require(_0x98b4('0xe'));var Papa=require(_0x98b4('0xf'));var Redis=require(_0x98b4('0x10'));var authService=require('../../components/auth/service');var qs=require('../../components/parsers/qs');var as=require(_0x98b4('0x11'));var hardwareService=require(_0x98b4('0x12'));var logger=require(_0x98b4('0x13'))(_0x98b4('0x14'));var utils=require(_0x98b4('0x15'));var config=require(_0x98b4('0x16'));var licenseUtil=require(_0x98b4('0x17'));var db=require(_0x98b4('0x18'))['db'];config[_0x98b4('0x19')]=_[_0x98b4('0x1a')](config[_0x98b4('0x19')],{'host':_0x98b4('0x1b'),'port':0x18eb});var socket=require(_0x98b4('0x1c'))(new Redis(config[_0x98b4('0x19')]));require(_0x98b4('0x1d'))[_0x98b4('0x1e')](socket);function respondWithStatusCode(_0x1844fb,_0x3c7efd){_0x3c7efd=_0x3c7efd||0xcc;return function(_0x3f091b){if(_0x3f091b){return _0x1844fb[_0x98b4('0x1f')](_0x3c7efd);}return _0x1844fb[_0x98b4('0x20')](_0x3c7efd)[_0x98b4('0x21')]();};}function respondWithResult(_0x14517a,_0x4bc3af){_0x4bc3af=_0x4bc3af||0xc8;return function(_0x4e0968){if(_0x4e0968){return _0x14517a[_0x98b4('0x20')](_0x4bc3af)['json'](_0x4e0968);}};}function respondWithFilteredResult(_0x45ee45,_0x2fb73f){return function(_0x23c01d){if(_0x23c01d){var _0x14a391=typeof _0x2fb73f['offset']==='undefined'&&typeof _0x2fb73f['limit']===_0x98b4('0x22');var _0x2c5247=_0x23c01d[_0x98b4('0x23')];var _0x19dd2b=_0x14a391?0x0:_0x2fb73f[_0x98b4('0x24')];var _0x17945e=_0x14a391?_0x23c01d[_0x98b4('0x23')]:_0x2fb73f[_0x98b4('0x24')]+_0x2fb73f[_0x98b4('0x25')];var _0x4752cf;if(_0x17945e>=_0x2c5247){_0x17945e=_0x2c5247;_0x4752cf=0xc8;}else{_0x4752cf=0xce;}_0x45ee45[_0x98b4('0x20')](_0x4752cf);return _0x45ee45[_0x98b4('0x26')]('Content-Range',_0x19dd2b+'-'+_0x17945e+'/'+_0x2c5247)[_0x98b4('0x27')](_0x23c01d);}return null;};}function patchUpdates(_0x3fc8fe){return function(_0x51afc4){try{jsonpatch[_0x98b4('0x28')](_0x51afc4,_0x3fc8fe,!![]);}catch(_0x1dc2b1){return BPromise[_0x98b4('0x29')](_0x1dc2b1);}return _0x51afc4['save']();};}function saveUpdates(_0x2d9fa2,_0x38ec2c){return function(_0x101e89){if(_0x101e89){return _0x101e89[_0x98b4('0x2a')](_0x2d9fa2)[_0x98b4('0x2b')](function(_0x2068ad){return _0x2068ad;});}return null;};}function removeEntity(_0xf8acd6,_0x24ab3f){return function(_0x3ceb92){if(_0x3ceb92){return _0x3ceb92[_0x98b4('0x2c')]()[_0x98b4('0x2b')](function(){_0xf8acd6['status'](0xcc)[_0x98b4('0x21')]();});}};}function handleEntityNotFound(_0x457cef,_0x4aac56){return function(_0xc059e5){if(!_0xc059e5){_0x457cef['sendStatus'](0x194);}return _0xc059e5;};}function handleError(_0x141fec,_0x3e934d){_0x3e934d=_0x3e934d||0x1f4;return function(_0x3706e9){logger['error'](_0x3706e9[_0x98b4('0x2d')]);if(_0x3706e9['name']){delete _0x3706e9[_0x98b4('0x2e')];}_0x141fec[_0x98b4('0x20')](_0x3e934d)[_0x98b4('0x2f')](_0x3706e9);};}exports[_0x98b4('0x30')]=function(_0x477db2,_0x1c0853){var _0x5a8b2e={},_0x24c494={},_0x2e78a9={'count':0x0,'rows':[]};var _0x44b5c5=_['map'](db[_0x98b4('0x31')][_0x98b4('0x32')],function(_0x582418){return{'name':_0x582418[_0x98b4('0x33')],'type':_0x582418[_0x98b4('0x34')]['key']};});_0x24c494[_0x98b4('0x35')]=_[_0x98b4('0x36')](_0x44b5c5,_0x98b4('0x2e'));_0x24c494[_0x98b4('0x37')]=_['keys'](_0x477db2[_0x98b4('0x37')]);_0x24c494[_0x98b4('0x38')]=_[_0x98b4('0x39')](_0x24c494[_0x98b4('0x35')],_0x24c494[_0x98b4('0x37')]);_0x5a8b2e[_0x98b4('0x3a')]=_[_0x98b4('0x39')](_0x24c494[_0x98b4('0x35')],qs[_0x98b4('0x3b')](_0x477db2['query']['fields']));_0x5a8b2e[_0x98b4('0x3a')]=_0x5a8b2e[_0x98b4('0x3a')]['length']?_0x5a8b2e['attributes']:_0x24c494['model'];if(!_0x477db2[_0x98b4('0x37')]['hasOwnProperty']('nolimit')){_0x5a8b2e[_0x98b4('0x25')]=qs['limit'](_0x477db2[_0x98b4('0x37')][_0x98b4('0x25')]);_0x5a8b2e[_0x98b4('0x24')]=qs['offset'](_0x477db2[_0x98b4('0x37')]['offset']);}_0x5a8b2e[_0x98b4('0x3c')]=qs[_0x98b4('0x3d')](_0x477db2[_0x98b4('0x37')]['sort']);_0x5a8b2e['where']=qs[_0x98b4('0x38')](_[_0x98b4('0x3e')](_0x477db2[_0x98b4('0x37')],_0x24c494[_0x98b4('0x38')]),_0x44b5c5);if(_0x477db2[_0x98b4('0x37')]['filter']){_0x5a8b2e[_0x98b4('0x3f')]=_[_0x98b4('0x40')](_0x5a8b2e[_0x98b4('0x3f')],{'$or':_['map'](_0x44b5c5,function(_0xced1a6){if(_0xced1a6[_0x98b4('0x34')]!==_0x98b4('0x41')){var _0x5b6ab8={};_0x5b6ab8[_0xced1a6[_0x98b4('0x2e')]]={'$like':'%'+_0x477db2[_0x98b4('0x37')][_0x98b4('0x42')]+'%'};return _0x5b6ab8;}})});}_0x5a8b2e=_['merge']({},_0x5a8b2e,_0x477db2[_0x98b4('0x43')]);var _0x541bd3={'where':_0x5a8b2e['where']};return db[_0x98b4('0x31')][_0x98b4('0x23')](_0x541bd3)[_0x98b4('0x2b')](function(_0x55af60){_0x2e78a9[_0x98b4('0x23')]=_0x55af60;if(_0x477db2[_0x98b4('0x37')][_0x98b4('0x44')]){_0x5a8b2e[_0x98b4('0x45')]=[{'all':!![]}];}return db['ChatInternalMessage'][_0x98b4('0x46')](_0x5a8b2e);})['then'](function(_0x316784){_0x2e78a9[_0x98b4('0x47')]=_0x316784;return _0x2e78a9;})['then'](respondWithFilteredResult(_0x1c0853,_0x5a8b2e))['catch'](handleError(_0x1c0853,null));};exports['show']=function(_0x149019,_0x315f61){var _0x175379={'raw':!![],'where':{'id':_0x149019[_0x98b4('0x48')]['id']}},_0x45ccfa={};_0x45ccfa[_0x98b4('0x35')]=_[_0x98b4('0x49')](db['ChatInternalMessage']['rawAttributes']);_0x45ccfa['query']=_[_0x98b4('0x49')](_0x149019[_0x98b4('0x37')]);_0x45ccfa[_0x98b4('0x38')]=_[_0x98b4('0x39')](_0x45ccfa['model'],_0x45ccfa[_0x98b4('0x37')]);_0x175379[_0x98b4('0x3a')]=_[_0x98b4('0x39')](_0x45ccfa[_0x98b4('0x35')],qs[_0x98b4('0x3b')](_0x149019[_0x98b4('0x37')]['fields']));_0x175379[_0x98b4('0x3a')]=_0x175379['attributes'][_0x98b4('0x4a')]?_0x175379[_0x98b4('0x3a')]:_0x45ccfa[_0x98b4('0x35')];if(_0x149019[_0x98b4('0x37')][_0x98b4('0x44')]){_0x175379[_0x98b4('0x45')]=[{'all':!![]}];}_0x175379=_[_0x98b4('0x40')]({},_0x175379,_0x149019[_0x98b4('0x43')]);return db[_0x98b4('0x31')][_0x98b4('0x4b')](_0x175379)[_0x98b4('0x2b')](handleEntityNotFound(_0x315f61,null))['then'](respondWithResult(_0x315f61,null))[_0x98b4('0x4c')](handleError(_0x315f61,null));};exports[_0x98b4('0x4d')]=function(_0x2e5740,_0x27d702){return db[_0x98b4('0x31')][_0x98b4('0x4d')](_0x2e5740['body'],{})['then'](respondWithResult(_0x27d702,0xc9))[_0x98b4('0x4c')](handleError(_0x27d702,null));};exports['update']=function(_0x1a987f,_0x579888){if(_0x1a987f[_0x98b4('0x4e')]['id']){delete _0x1a987f[_0x98b4('0x4e')]['id'];}return db[_0x98b4('0x31')]['find']({'where':{'id':_0x1a987f[_0x98b4('0x48')]['id']}})[_0x98b4('0x2b')](handleEntityNotFound(_0x579888,null))[_0x98b4('0x2b')](saveUpdates(_0x1a987f['body'],null))[_0x98b4('0x2b')](respondWithResult(_0x579888,null))[_0x98b4('0x4c')](handleError(_0x579888,null));};exports[_0x98b4('0x2c')]=function(_0x47ad0c,_0xdd77f3){return db['ChatInternalMessage'][_0x98b4('0x4b')]({'where':{'id':_0x47ad0c[_0x98b4('0x48')]['id']}})[_0x98b4('0x2b')](handleEntityNotFound(_0xdd77f3,null))[_0x98b4('0x2b')](removeEntity(_0xdd77f3,null))['catch'](handleError(_0xdd77f3,null));};exports['describe']=function(_0x573ff7,_0x579da8){return db[_0x98b4('0x31')][_0x98b4('0x4f')]()['then'](respondWithResult(_0x579da8,null))[_0x98b4('0x4c')](handleError(_0x579da8,null));};function wrapUser(_0x27ee9f){return function(_0x51bea7){var _0x1ffa71=_0x27ee9f[_0x98b4('0x50')]({'plain':!![]});_0x1ffa71[_0x98b4('0x51')]=[];if(_0x51bea7){_0x1ffa71[_0x98b4('0x52')]=_0x51bea7[_0x98b4('0x53')];_0x1ffa71['lastMessage']=_0x51bea7;}else{_0x1ffa71[_0x98b4('0x52')]=moment(0x0)[_0x98b4('0x54')](_0x98b4('0x55'));_0x1ffa71['lastMessage']={};}return _0x1ffa71;};}exports['getUsers']=function(_0x24be3f,_0x29f149,_0x27f22d){var _0x106b55=[];return db[_0x98b4('0x56')][_0x98b4('0x46')]({'where':{'role':[_0x98b4('0x57'),_0x98b4('0x58'),_0x98b4('0x59')]},'attributes':['id',_0x98b4('0x5a'),_0x98b4('0x2e'),_0x98b4('0x5b'),_0x98b4('0x5c'),'internal','online',_0x98b4('0x5d'),'allowmessenger',_0x98b4('0x5e')],'order':qs[_0x98b4('0x3d')](_0x98b4('0x5f')),'include':[{'model':db['VoiceQueue'],'as':_0x98b4('0x60'),'attributes':['id',_0x98b4('0x2e'),_0x98b4('0x34')],'through':{'attributes':[]}}]})[_0x98b4('0x2b')](function(_0x293c66){if(_0x293c66){var _0x5c455c=_0x24be3f['user']['get']({'plain':!![]});if(!_0x5c455c)throw new Error(_0x98b4('0x61'));if(_0x5c455c['role']===_0x98b4('0x59')){return db['UserProfileSection'][_0x98b4('0x4b')]({'where':{'name':_0x98b4('0x62'),'userProfileId':_0x5c455c[_0x98b4('0x63')]},'raw':!![]})[_0x98b4('0x2b')](function(_0x41e186){if(_0x41e186){if(_0x41e186['autoAssociation']===0x0){return db[_0x98b4('0x64')]['findAll']({'where':{'sectionId':_0x41e186['id']},'raw':!![]})[_0x98b4('0x2b')](function(_0x336517){var _0x340033=[];if(_[_0x98b4('0x65')](_0x336517)){_0x340033=_[_0x98b4('0x42')](_0x293c66,function(_0x215638){if(_0x215638[_0x98b4('0x5b')]!==_0x98b4('0x57')){return _0x215638;}});return _0x340033;}else{for(var _0x10a456=0x0;_0x10a456<_0x293c66[_0x98b4('0x4a')];_0x10a456++){var _0x26f097=_0x293c66[_0x10a456];if(_0x26f097[_0x98b4('0x5b')]===_0x98b4('0x57')){var _0x6f5e0b=_['find'](_0x336517,function(_0xf9eade){return _0xf9eade[_0x98b4('0x66')]===_0x26f097['id'];});if(_0x6f5e0b)_0x340033['push'](_0x26f097);}else{_0x340033[_0x98b4('0x67')](_0x26f097);}}return _0x340033;}});}else{return _0x293c66;}}else{var _0x354690=_[_0x98b4('0x42')](_0x293c66,function(_0x268c1d){if(_0x268c1d['role']!==_0x98b4('0x57')){return _0x268c1d;}});return _0x354690;}});}else{return _0x293c66;}}})[_0x98b4('0x2b')](function(_0x5144bc){var _0xee55a=[];if(_0x5144bc){_0x106b55=_0x5144bc;for(var _0x3485dc=0x0;_0x3485dc<_0x5144bc['length'];_0x3485dc+=0x1){_0x106b55[_0x3485dc][_0x98b4('0x51')]=[];_0xee55a[_0x98b4('0x67')](db[_0x98b4('0x31')][_0x98b4('0x4b')]({'where':{'FromId':[_0x24be3f[_0x98b4('0x59')]['id'],_0x5144bc[_0x3485dc]['id']],'ToId':[_0x24be3f[_0x98b4('0x59')]['id'],_0x5144bc[_0x3485dc]['id']],'ChatGroupId':null},'attributes':['id',_0x98b4('0x53'),_0x98b4('0x68'),_0x98b4('0x69'),_0x98b4('0x6a'),_0x98b4('0x4e')],'order':qs[_0x98b4('0x3d')](_0x98b4('0x6b')),'limit':0x1,'offset':0x0,'raw':!![]})['then'](wrapUser(_0x5144bc[_0x3485dc])));}return BPromise[_0x98b4('0x6c')](_0xee55a);}return[];})[_0x98b4('0x2b')](function(_0x411169){return{'rows':_0x411169,'count':_0x411169['length']};})['then'](respondWithResult(_0x29f149,null))[_0x98b4('0x4c')](handleError(_0x29f149,null));}; \ No newline at end of file +var _0x83bb=['key','keys','query','filters','intersection','model','attributes','fields','length','hasOwnProperty','sort','where','pick','filter','VIRTUAL','merge','options','count','then','ChatInternalMessage','findAll','catch','params','includeAll','include','find','create','body','describe','get','messages','lastMessageAt','createdAt','format','lastMessage','getUsers','User','admin','user','fullname','role','userpic','internal','online','lastLoginAt','allowmessenger','-online','VoiceQueue','Unable\x20to\x20retrieve\x20the\x20current\x20user','UserProfileSection','userProfileId','autoAssociation','isEmpty','agent','resourceId','push','ToId','-createdAt','all','eml-format','rimraf','fast-json-patch','bluebird','mustache','util','path','sox','to-csv','fs-extra','lodash','squel','crypto','jsforce','desk.js','ioredis','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','../../config/environment','../../config/license/util','../../mysqldb','redis','localhost','socket.io-emitter','./chatInternalMessage.socket','register','sendStatus','status','offset','undefined','limit','json','reject','save','update','destroy','end','error','stack','name','send','map','rawAttributes','fieldName','type'];(function(_0x424a9a,_0x2dd9af){var _0xa7831c=function(_0x512534){while(--_0x512534){_0x424a9a['push'](_0x424a9a['shift']());}};_0xa7831c(++_0x2dd9af);}(_0x83bb,0x1df));var _0xb83b=function(_0x1fe66b,_0x355ef2){_0x1fe66b=_0x1fe66b-0x0;var _0x57f9f8=_0x83bb[_0x1fe66b];return _0x57f9f8;};'use strict';var emlformat=require(_0xb83b('0x0'));var rimraf=require(_0xb83b('0x1'));var zipdir=require('zip-dir');var jsonpatch=require(_0xb83b('0x2'));var rp=require('request-promise');var moment=require('moment');var BPromise=require(_0xb83b('0x3'));var Mustache=require(_0xb83b('0x4'));var util=require(_0xb83b('0x5'));var path=require(_0xb83b('0x6'));var sox=require(_0xb83b('0x7'));var csv=require(_0xb83b('0x8'));var ejs=require('ejs');var fs=require('fs');var fs_extra=require(_0xb83b('0x9'));var _=require(_0xb83b('0xa'));var squel=require(_0xb83b('0xb'));var crypto=require(_0xb83b('0xc'));var jsforce=require(_0xb83b('0xd'));var deskjs=require(_0xb83b('0xe'));var toCsv=require('to-csv');var querystring=require('querystring');var Papa=require('papaparse');var Redis=require(_0xb83b('0xf'));var authService=require('../../components/auth/service');var qs=require('../../components/parsers/qs');var as=require(_0xb83b('0x10'));var hardwareService=require(_0xb83b('0x11'));var logger=require(_0xb83b('0x12'))('api');var utils=require('../../config/utils');var config=require(_0xb83b('0x13'));var licenseUtil=require(_0xb83b('0x14'));var db=require(_0xb83b('0x15'))['db'];config[_0xb83b('0x16')]=_['defaults'](config[_0xb83b('0x16')],{'host':_0xb83b('0x17'),'port':0x18eb});var socket=require(_0xb83b('0x18'))(new Redis(config[_0xb83b('0x16')]));require(_0xb83b('0x19'))[_0xb83b('0x1a')](socket);function respondWithStatusCode(_0x379783,_0x3e5457){_0x3e5457=_0x3e5457||0xcc;return function(_0x5b2091){if(_0x5b2091){return _0x379783[_0xb83b('0x1b')](_0x3e5457);}return _0x379783[_0xb83b('0x1c')](_0x3e5457)['end']();};}function respondWithResult(_0x5efc26,_0x41a99b){_0x41a99b=_0x41a99b||0xc8;return function(_0x4a884c){if(_0x4a884c){return _0x5efc26[_0xb83b('0x1c')](_0x41a99b)['json'](_0x4a884c);}};}function respondWithFilteredResult(_0x6b4a40,_0x1c0f68){return function(_0x3c4869){if(_0x3c4869){var _0x5dc48d=typeof _0x1c0f68[_0xb83b('0x1d')]===_0xb83b('0x1e')&&typeof _0x1c0f68[_0xb83b('0x1f')]===_0xb83b('0x1e');var _0x80b76f=_0x3c4869['count'];var _0x5efefe=_0x5dc48d?0x0:_0x1c0f68[_0xb83b('0x1d')];var _0x54c7da=_0x5dc48d?_0x3c4869['count']:_0x1c0f68[_0xb83b('0x1d')]+_0x1c0f68[_0xb83b('0x1f')];var _0x2f6431;if(_0x54c7da>=_0x80b76f){_0x54c7da=_0x80b76f;_0x2f6431=0xc8;}else{_0x2f6431=0xce;}_0x6b4a40['status'](_0x2f6431);return _0x6b4a40['set']('Content-Range',_0x5efefe+'-'+_0x54c7da+'/'+_0x80b76f)[_0xb83b('0x20')](_0x3c4869);}return null;};}function patchUpdates(_0x5e8723){return function(_0x1960dd){try{jsonpatch['apply'](_0x1960dd,_0x5e8723,!![]);}catch(_0x3bcc6d){return BPromise[_0xb83b('0x21')](_0x3bcc6d);}return _0x1960dd[_0xb83b('0x22')]();};}function saveUpdates(_0x4ada7a,_0x143e47){return function(_0x386f2e){if(_0x386f2e){return _0x386f2e[_0xb83b('0x23')](_0x4ada7a)['then'](function(_0x50bb0b){return _0x50bb0b;});}return null;};}function removeEntity(_0x35856f,_0x303f98){return function(_0x406588){if(_0x406588){return _0x406588[_0xb83b('0x24')]()['then'](function(){_0x35856f[_0xb83b('0x1c')](0xcc)[_0xb83b('0x25')]();});}};}function handleEntityNotFound(_0x38977d,_0x30fb23){return function(_0x516b25){if(!_0x516b25){_0x38977d['sendStatus'](0x194);}return _0x516b25;};}function handleError(_0x228aad,_0x235572){_0x235572=_0x235572||0x1f4;return function(_0x8c91ac){logger[_0xb83b('0x26')](_0x8c91ac[_0xb83b('0x27')]);if(_0x8c91ac[_0xb83b('0x28')]){delete _0x8c91ac[_0xb83b('0x28')];}_0x228aad['status'](_0x235572)[_0xb83b('0x29')](_0x8c91ac);};}exports['index']=function(_0xa8249d,_0x1c1c91){var _0x56c27b={},_0x8ab3a3={},_0x39f647={'count':0x0,'rows':[]};var _0x5976c7=_[_0xb83b('0x2a')](db['ChatInternalMessage'][_0xb83b('0x2b')],function(_0x375bc3){return{'name':_0x375bc3[_0xb83b('0x2c')],'type':_0x375bc3[_0xb83b('0x2d')][_0xb83b('0x2e')]};});_0x8ab3a3['model']=_[_0xb83b('0x2a')](_0x5976c7,_0xb83b('0x28'));_0x8ab3a3['query']=_[_0xb83b('0x2f')](_0xa8249d[_0xb83b('0x30')]);_0x8ab3a3[_0xb83b('0x31')]=_[_0xb83b('0x32')](_0x8ab3a3[_0xb83b('0x33')],_0x8ab3a3[_0xb83b('0x30')]);_0x56c27b[_0xb83b('0x34')]=_[_0xb83b('0x32')](_0x8ab3a3[_0xb83b('0x33')],qs['fields'](_0xa8249d[_0xb83b('0x30')][_0xb83b('0x35')]));_0x56c27b[_0xb83b('0x34')]=_0x56c27b[_0xb83b('0x34')][_0xb83b('0x36')]?_0x56c27b[_0xb83b('0x34')]:_0x8ab3a3['model'];if(!_0xa8249d[_0xb83b('0x30')][_0xb83b('0x37')]('nolimit')){_0x56c27b[_0xb83b('0x1f')]=qs[_0xb83b('0x1f')](_0xa8249d[_0xb83b('0x30')][_0xb83b('0x1f')]);_0x56c27b[_0xb83b('0x1d')]=qs[_0xb83b('0x1d')](_0xa8249d[_0xb83b('0x30')][_0xb83b('0x1d')]);}_0x56c27b['order']=qs[_0xb83b('0x38')](_0xa8249d[_0xb83b('0x30')][_0xb83b('0x38')]);_0x56c27b[_0xb83b('0x39')]=qs[_0xb83b('0x31')](_[_0xb83b('0x3a')](_0xa8249d['query'],_0x8ab3a3[_0xb83b('0x31')]),_0x5976c7);if(_0xa8249d['query'][_0xb83b('0x3b')]){_0x56c27b[_0xb83b('0x39')]=_['merge'](_0x56c27b[_0xb83b('0x39')],{'$or':_[_0xb83b('0x2a')](_0x5976c7,function(_0xdc2217){if(_0xdc2217[_0xb83b('0x2d')]!==_0xb83b('0x3c')){var _0x5034d1={};_0x5034d1[_0xdc2217['name']]={'$like':'%'+_0xa8249d[_0xb83b('0x30')]['filter']+'%'};return _0x5034d1;}})});}_0x56c27b=_[_0xb83b('0x3d')]({},_0x56c27b,_0xa8249d[_0xb83b('0x3e')]);var _0x21467a={'where':_0x56c27b[_0xb83b('0x39')]};return db['ChatInternalMessage'][_0xb83b('0x3f')](_0x21467a)[_0xb83b('0x40')](function(_0x1e9e79){_0x39f647[_0xb83b('0x3f')]=_0x1e9e79;if(_0xa8249d[_0xb83b('0x30')]['includeAll']){_0x56c27b['include']=[{'all':!![]}];}return db[_0xb83b('0x41')][_0xb83b('0x42')](_0x56c27b);})['then'](function(_0xcec7fc){_0x39f647['rows']=_0xcec7fc;return _0x39f647;})[_0xb83b('0x40')](respondWithFilteredResult(_0x1c1c91,_0x56c27b))[_0xb83b('0x43')](handleError(_0x1c1c91,null));};exports['show']=function(_0x6035ef,_0x179f2a){var _0x38d397={'raw':!![],'where':{'id':_0x6035ef[_0xb83b('0x44')]['id']}},_0x2820e7={};_0x2820e7[_0xb83b('0x33')]=_[_0xb83b('0x2f')](db[_0xb83b('0x41')][_0xb83b('0x2b')]);_0x2820e7[_0xb83b('0x30')]=_[_0xb83b('0x2f')](_0x6035ef[_0xb83b('0x30')]);_0x2820e7['filters']=_[_0xb83b('0x32')](_0x2820e7['model'],_0x2820e7[_0xb83b('0x30')]);_0x38d397[_0xb83b('0x34')]=_[_0xb83b('0x32')](_0x2820e7['model'],qs[_0xb83b('0x35')](_0x6035ef[_0xb83b('0x30')][_0xb83b('0x35')]));_0x38d397[_0xb83b('0x34')]=_0x38d397['attributes'][_0xb83b('0x36')]?_0x38d397[_0xb83b('0x34')]:_0x2820e7[_0xb83b('0x33')];if(_0x6035ef[_0xb83b('0x30')][_0xb83b('0x45')]){_0x38d397[_0xb83b('0x46')]=[{'all':!![]}];}_0x38d397=_[_0xb83b('0x3d')]({},_0x38d397,_0x6035ef[_0xb83b('0x3e')]);return db['ChatInternalMessage'][_0xb83b('0x47')](_0x38d397)[_0xb83b('0x40')](handleEntityNotFound(_0x179f2a,null))['then'](respondWithResult(_0x179f2a,null))['catch'](handleError(_0x179f2a,null));};exports[_0xb83b('0x48')]=function(_0x502aed,_0x40680b){return db[_0xb83b('0x41')][_0xb83b('0x48')](_0x502aed[_0xb83b('0x49')],{})[_0xb83b('0x40')](respondWithResult(_0x40680b,0xc9))[_0xb83b('0x43')](handleError(_0x40680b,null));};exports[_0xb83b('0x23')]=function(_0x2d635d,_0xc9a415){if(_0x2d635d[_0xb83b('0x49')]['id']){delete _0x2d635d[_0xb83b('0x49')]['id'];}return db[_0xb83b('0x41')][_0xb83b('0x47')]({'where':{'id':_0x2d635d[_0xb83b('0x44')]['id']}})[_0xb83b('0x40')](handleEntityNotFound(_0xc9a415,null))['then'](saveUpdates(_0x2d635d[_0xb83b('0x49')],null))[_0xb83b('0x40')](respondWithResult(_0xc9a415,null))[_0xb83b('0x43')](handleError(_0xc9a415,null));};exports['destroy']=function(_0x33ffa3,_0x5cba3a){return db[_0xb83b('0x41')][_0xb83b('0x47')]({'where':{'id':_0x33ffa3[_0xb83b('0x44')]['id']}})[_0xb83b('0x40')](handleEntityNotFound(_0x5cba3a,null))[_0xb83b('0x40')](removeEntity(_0x5cba3a,null))[_0xb83b('0x43')](handleError(_0x5cba3a,null));};exports[_0xb83b('0x4a')]=function(_0x4407d0,_0x10879f){return db[_0xb83b('0x41')]['describe']()[_0xb83b('0x40')](respondWithResult(_0x10879f,null))[_0xb83b('0x43')](handleError(_0x10879f,null));};function wrapUser(_0x1a7991){return function(_0x13973e){var _0x4ef1bf=_0x1a7991[_0xb83b('0x4b')]({'plain':!![]});_0x4ef1bf[_0xb83b('0x4c')]=[];if(_0x13973e){_0x4ef1bf[_0xb83b('0x4d')]=_0x13973e[_0xb83b('0x4e')];_0x4ef1bf['lastMessage']=_0x13973e;}else{_0x4ef1bf[_0xb83b('0x4d')]=moment(0x0)[_0xb83b('0x4f')]('YYYY-MM-DD\x20HH:mm:ss');_0x4ef1bf[_0xb83b('0x50')]={};}return _0x4ef1bf;};}exports[_0xb83b('0x51')]=function(_0x36435f,_0xf9ca27,_0xf34bce){var _0xbc193=[];return db[_0xb83b('0x52')]['findAll']({'where':{'role':['agent',_0xb83b('0x53'),_0xb83b('0x54')]},'attributes':['id',_0xb83b('0x55'),_0xb83b('0x28'),_0xb83b('0x56'),_0xb83b('0x57'),_0xb83b('0x58'),_0xb83b('0x59'),_0xb83b('0x5a'),_0xb83b('0x5b'),'showWebBar'],'order':qs[_0xb83b('0x38')](_0xb83b('0x5c')),'include':[{'model':db[_0xb83b('0x5d')],'as':'VoiceQueues','attributes':['id',_0xb83b('0x28'),_0xb83b('0x2d')],'through':{'attributes':[]}}]})[_0xb83b('0x40')](function(_0x1d9d50){if(_0x1d9d50){var _0x4c9a34=_0x36435f[_0xb83b('0x54')][_0xb83b('0x4b')]({'plain':!![]});if(!_0x4c9a34)throw new Error(_0xb83b('0x5e'));if(_0x4c9a34[_0xb83b('0x56')]===_0xb83b('0x54')){return db[_0xb83b('0x5f')]['find']({'where':{'name':'Agents','userProfileId':_0x4c9a34[_0xb83b('0x60')]},'raw':!![]})[_0xb83b('0x40')](function(_0x1d50df){if(_0x1d50df){if(_0x1d50df[_0xb83b('0x61')]===0x0){return db['UserProfileResource']['findAll']({'where':{'sectionId':_0x1d50df['id']},'raw':!![]})[_0xb83b('0x40')](function(_0x4e9a28){var _0x5e5d22=[];if(_[_0xb83b('0x62')](_0x4e9a28)){_0x5e5d22=_[_0xb83b('0x3b')](_0x1d9d50,function(_0x38add4){if(_0x38add4['role']!==_0xb83b('0x63')){return _0x38add4;}});return _0x5e5d22;}else{for(var _0x663479=0x0;_0x663479<_0x1d9d50[_0xb83b('0x36')];_0x663479++){var _0x2fb072=_0x1d9d50[_0x663479];if(_0x2fb072['role']==='agent'){var _0x3b9b25=_[_0xb83b('0x47')](_0x4e9a28,function(_0x547304){return _0x547304[_0xb83b('0x64')]===_0x2fb072['id'];});if(_0x3b9b25)_0x5e5d22[_0xb83b('0x65')](_0x2fb072);}else{_0x5e5d22[_0xb83b('0x65')](_0x2fb072);}}return _0x5e5d22;}});}else{return _0x1d9d50;}}else{var _0x3ba85e=_[_0xb83b('0x3b')](_0x1d9d50,function(_0x5d8094){if(_0x5d8094[_0xb83b('0x56')]!==_0xb83b('0x63')){return _0x5d8094;}});return _0x3ba85e;}});}else{return _0x1d9d50;}}})[_0xb83b('0x40')](function(_0x28882b){var _0x58e2fd=[];if(_0x28882b){_0xbc193=_0x28882b;for(var _0x5b6fa2=0x0;_0x5b6fa2<_0x28882b[_0xb83b('0x36')];_0x5b6fa2+=0x1){_0xbc193[_0x5b6fa2][_0xb83b('0x4c')]=[];_0x58e2fd['push'](db['ChatInternalMessage']['find']({'where':{'FromId':[_0x36435f[_0xb83b('0x54')]['id'],_0x28882b[_0x5b6fa2]['id']],'ToId':[_0x36435f[_0xb83b('0x54')]['id'],_0x28882b[_0x5b6fa2]['id']],'ChatGroupId':null},'attributes':['id',_0xb83b('0x4e'),'FromId',_0xb83b('0x66'),'read','body'],'order':qs[_0xb83b('0x38')](_0xb83b('0x67')),'limit':0x1,'offset':0x0,'raw':!![]})[_0xb83b('0x40')](wrapUser(_0x28882b[_0x5b6fa2])));}return BPromise[_0xb83b('0x68')](_0x58e2fd);}return[];})['then'](function(_0x53e8ef){return{'rows':_0x53e8ef,'count':_0x53e8ef[_0xb83b('0x36')]};})['then'](respondWithResult(_0xf9ca27,null))[_0xb83b('0x43')](handleError(_0xf9ca27,null));}; \ No newline at end of file diff --git a/server/api/chatInternalMessage/chatInternalMessage.events.js b/server/api/chatInternalMessage/chatInternalMessage.events.js index 46dd2ba..5659abc 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 _0x87c8=['save','update','remove','emit','hasOwnProperty','hook','exports','events','../../mysqldb'];(function(_0x934425,_0x5af72f){var _0x31d596=function(_0x219869){while(--_0x219869){_0x934425['push'](_0x934425['shift']());}};_0x31d596(++_0x5af72f);}(_0x87c8,0x1db));var _0x887c=function(_0x11ce46,_0x177a85){_0x11ce46=_0x11ce46-0x0;var _0x368a1e=_0x87c8[_0x11ce46];return _0x368a1e;};'use strict';var EventEmitter=require(_0x887c('0x0'));var ChatInternalMessage=require(_0x887c('0x1'))['db']['ChatInternalMessage'];var ChatInternalMessageEvents=new EventEmitter();ChatInternalMessageEvents['setMaxListeners'](0x0);var events={'afterCreate':_0x887c('0x2'),'afterUpdate':_0x887c('0x3'),'afterDestroy':_0x887c('0x4')};function emitEvent(_0x43575a){return function(_0x1a2db4,_0x42f4d9,_0x24d7a1){ChatInternalMessageEvents[_0x887c('0x5')](_0x43575a+':'+_0x1a2db4['id'],_0x1a2db4);ChatInternalMessageEvents[_0x887c('0x5')](_0x43575a,_0x1a2db4);_0x24d7a1(null);};}for(var e in events){if(events[_0x887c('0x6')](e)){var event=events[e];ChatInternalMessage[_0x887c('0x7')](e,emitEvent(event));}}module[_0x887c('0x8')]=ChatInternalMessageEvents; \ No newline at end of file +var _0x2e35=['exports','../../mysqldb','ChatInternalMessage','setMaxListeners','save','remove','emit','hasOwnProperty','hook'];(function(_0x309d93,_0x157662){var _0x2dd61d=function(_0x25ff34){while(--_0x25ff34){_0x309d93['push'](_0x309d93['shift']());}};_0x2dd61d(++_0x157662);}(_0x2e35,0xd9));var _0x52e3=function(_0xf64854,_0x2862c3){_0xf64854=_0xf64854-0x0;var _0x1f2173=_0x2e35[_0xf64854];return _0x1f2173;};'use strict';var EventEmitter=require('events');var ChatInternalMessage=require(_0x52e3('0x0'))['db'][_0x52e3('0x1')];var ChatInternalMessageEvents=new EventEmitter();ChatInternalMessageEvents[_0x52e3('0x2')](0x0);var events={'afterCreate':_0x52e3('0x3'),'afterUpdate':'update','afterDestroy':_0x52e3('0x4')};function emitEvent(_0x3ba9c4){return function(_0x5e41e6,_0x305ec6,_0x2540db){ChatInternalMessageEvents[_0x52e3('0x5')](_0x3ba9c4+':'+_0x5e41e6['id'],_0x5e41e6);ChatInternalMessageEvents[_0x52e3('0x5')](_0x3ba9c4,_0x5e41e6);_0x2540db(null);};}for(var e in events){if(events[_0x52e3('0x6')](e)){var event=events[e];ChatInternalMessage[_0x52e3('0x7')](e,emitEvent(event));}}module[_0x52e3('0x8')]=ChatInternalMessageEvents; \ No newline at end of file diff --git a/server/api/chatInternalMessage/chatInternalMessage.model.js b/server/api/chatInternalMessage/chatInternalMessage.model.js index 4abfc6e..fd9f8e7 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 _0xe6c9=['moment','bluebird','path','rimraf','../../config/environment','./chatInternalMessage.attributes','define','chat_internal_messages','utf8mb4','utf8mb4_unicode_ci','lodash','util','../../config/logger','api'];(function(_0x2141dd,_0x2a80bc){var _0x2a3156=function(_0x5d347c){while(--_0x5d347c){_0x2141dd['push'](_0x2141dd['shift']());}};_0x2a3156(++_0x2a80bc);}(_0xe6c9,0x184));var _0x9e6c=function(_0x4d36a5,_0x16f12e){_0x4d36a5=_0x4d36a5-0x0;var _0x2b895d=_0xe6c9[_0x4d36a5];return _0x2b895d;};'use strict';var _=require(_0x9e6c('0x0'));var util=require(_0x9e6c('0x1'));var logger=require(_0x9e6c('0x2'))(_0x9e6c('0x3'));var moment=require(_0x9e6c('0x4'));var BPromise=require(_0x9e6c('0x5'));var rp=require('request-promise');var fs=require('fs');var path=require(_0x9e6c('0x6'));var rimraf=require(_0x9e6c('0x7'));var config=require(_0x9e6c('0x8'));var attributes=require(_0x9e6c('0x9'));module['exports']=function(_0x56e36f,_0x194a4e){return _0x56e36f[_0x9e6c('0xa')]('ChatInternalMessage',attributes,{'tableName':_0x9e6c('0xb'),'paranoid':![],'indexes':[],'timestamps':!![],'charset':_0x9e6c('0xc'),'collate':_0x9e6c('0xd')});}; \ No newline at end of file +var _0x351d=['utf8mb4_unicode_ci','lodash','../../config/logger','moment','bluebird','request-promise','rimraf','./chatInternalMessage.attributes','define','ChatInternalMessage','chat_internal_messages','utf8mb4'];(function(_0x6cf19c,_0x2f3f02){var _0xce14f3=function(_0x474587){while(--_0x474587){_0x6cf19c['push'](_0x6cf19c['shift']());}};_0xce14f3(++_0x2f3f02);}(_0x351d,0x91));var _0xd351=function(_0x246e83,_0xdeb220){_0x246e83=_0x246e83-0x0;var _0x442c47=_0x351d[_0x246e83];return _0x442c47;};'use strict';var _=require(_0xd351('0x0'));var util=require('util');var logger=require(_0xd351('0x1'))('api');var moment=require(_0xd351('0x2'));var BPromise=require(_0xd351('0x3'));var rp=require(_0xd351('0x4'));var fs=require('fs');var path=require('path');var rimraf=require(_0xd351('0x5'));var config=require('../../config/environment');var attributes=require(_0xd351('0x6'));module['exports']=function(_0x288001,_0x24a52b){return _0x288001[_0xd351('0x7')](_0xd351('0x8'),attributes,{'tableName':_0xd351('0x9'),'paranoid':![],'indexes':[],'timestamps':!![],'charset':_0xd351('0xa'),'collate':_0xd351('0xb')});}; \ No newline at end of file diff --git a/server/api/chatInternalMessage/chatInternalMessage.rpc.js b/server/api/chatInternalMessage/chatInternalMessage.rpc.js index 3d03aef..3270145 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 _0x8316=['localhost','socket.io-emitter','./chatInternalMessage.socket','request','then','ChatInternalMessage,\x20%s,\x20%s','debug','stringify','error','code','message','request\x20sent','result','catch','moment','bluebird','randomstring','../../mysqldb','../../config/utils','../../config/logger','client','redis','defaults'];(function(_0x5cbfb5,_0x20772b){var _0x264245=function(_0x45891e){while(--_0x45891e){_0x5cbfb5['push'](_0x5cbfb5['shift']());}};_0x264245(++_0x20772b);}(_0x8316,0x150));var _0x6831=function(_0x54e3f1,_0xcb1337){_0x54e3f1=_0x54e3f1-0x0;var _0x577acc=_0x8316[_0x54e3f1];return _0x577acc;};'use strict';var _=require('lodash');var util=require('util');var moment=require(_0x6831('0x0'));var BPromise=require(_0x6831('0x1'));var rs=require(_0x6831('0x2'));var fs=require('fs');var Redis=require('ioredis');var db=require(_0x6831('0x3'))['db'];var utils=require(_0x6831('0x4'));var logger=require(_0x6831('0x5'))('rpc');var config=require('../../config/environment');var jayson=require('jayson/promise');var client=jayson[_0x6831('0x6')]['http']({'port':0x232a});config[_0x6831('0x7')]=_[_0x6831('0x8')](config[_0x6831('0x7')],{'host':_0x6831('0x9'),'port':0x18eb});var socket=require(_0x6831('0xa'))(new Redis(config[_0x6831('0x7')]));require(_0x6831('0xb'))['register'](socket);function respondWithRpcPromise(_0x3b3fe9,_0x23bb94,_0x36d3b6){return new BPromise(function(_0x167d6e,_0x427afa){return client[_0x6831('0xc')](_0x3b3fe9,_0x36d3b6)[_0x6831('0xd')](function(_0x103246){logger['info'](_0x6831('0xe'),_0x23bb94,'request\x20sent');logger[_0x6831('0xf')]('ChatInternalMessage,\x20%s,\x20%s,\x20%s',_0x23bb94,'request\x20sent',JSON[_0x6831('0x10')](_0x103246));if(_0x103246[_0x6831('0x11')]){if(_0x103246[_0x6831('0x11')][_0x6831('0x12')]===0x1f4){logger[_0x6831('0x11')](_0x6831('0xe'),_0x23bb94,_0x103246[_0x6831('0x11')]['message']);return _0x427afa(_0x103246[_0x6831('0x11')]['message']);}logger[_0x6831('0x11')]('ChatInternalMessage,\x20%s,\x20%s',_0x23bb94,_0x103246[_0x6831('0x11')][_0x6831('0x13')]);return _0x167d6e(_0x103246[_0x6831('0x11')]['message']);}else{logger['info'](_0x6831('0xe'),_0x23bb94,_0x6831('0x14'));_0x167d6e(_0x103246[_0x6831('0x15')][_0x6831('0x13')]);}})[_0x6831('0x16')](function(_0x1223ab){logger[_0x6831('0x11')]('ChatInternalMessage,\x20%s,\x20%s',_0x23bb94,_0x1223ab);_0x427afa(_0x1223ab);});});} \ No newline at end of file +var _0x1c59=['./chatInternalMessage.socket','register','request','then','ChatInternalMessage,\x20%s,\x20%s','request\x20sent','debug','ChatInternalMessage,\x20%s,\x20%s,\x20%s','stringify','error','message','result','catch','util','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','rpc','jayson/promise','client','http','redis','defaults','socket.io-emitter'];(function(_0x411add,_0x1aed38){var _0x238242=function(_0x4a1cd5){while(--_0x4a1cd5){_0x411add['push'](_0x411add['shift']());}};_0x238242(++_0x1aed38);}(_0x1c59,0xe5));var _0x91c5=function(_0x211c01,_0x32dd0c){_0x211c01=_0x211c01-0x0;var _0x2228d8=_0x1c59[_0x211c01];return _0x2228d8;};'use strict';var _=require('lodash');var util=require(_0x91c5('0x0'));var moment=require(_0x91c5('0x1'));var BPromise=require(_0x91c5('0x2'));var rs=require(_0x91c5('0x3'));var fs=require('fs');var Redis=require(_0x91c5('0x4'));var db=require(_0x91c5('0x5'))['db'];var utils=require(_0x91c5('0x6'));var logger=require('../../config/logger')(_0x91c5('0x7'));var config=require('../../config/environment');var jayson=require(_0x91c5('0x8'));var client=jayson[_0x91c5('0x9')][_0x91c5('0xa')]({'port':0x232a});config[_0x91c5('0xb')]=_[_0x91c5('0xc')](config[_0x91c5('0xb')],{'host':'localhost','port':0x18eb});var socket=require(_0x91c5('0xd'))(new Redis(config['redis']));require(_0x91c5('0xe'))[_0x91c5('0xf')](socket);function respondWithRpcPromise(_0x46031b,_0x2ade93,_0x2cfae1){return new BPromise(function(_0x50fc92,_0x115728){return client[_0x91c5('0x10')](_0x46031b,_0x2cfae1)[_0x91c5('0x11')](function(_0x195767){logger['info'](_0x91c5('0x12'),_0x2ade93,_0x91c5('0x13'));logger[_0x91c5('0x14')](_0x91c5('0x15'),_0x2ade93,_0x91c5('0x13'),JSON[_0x91c5('0x16')](_0x195767));if(_0x195767[_0x91c5('0x17')]){if(_0x195767['error']['code']===0x1f4){logger[_0x91c5('0x17')](_0x91c5('0x12'),_0x2ade93,_0x195767['error'][_0x91c5('0x18')]);return _0x115728(_0x195767['error']['message']);}logger['error'](_0x91c5('0x12'),_0x2ade93,_0x195767[_0x91c5('0x17')][_0x91c5('0x18')]);return _0x50fc92(_0x195767[_0x91c5('0x17')]['message']);}else{logger['info'](_0x91c5('0x12'),_0x2ade93,_0x91c5('0x13'));_0x50fc92(_0x195767[_0x91c5('0x19')][_0x91c5('0x18')]);}})[_0x91c5('0x1a')](function(_0x410a44){logger['error'](_0x91c5('0x12'),_0x2ade93,_0x410a44);_0x115728(_0x410a44);});});} \ No newline at end of file diff --git a/server/api/chatInternalMessage/chatInternalMessage.socket.js b/server/api/chatInternalMessage/chatInternalMessage.socket.js index 0350c84..0298302 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 _0xd60b=['chatInternalMessage:','./chatInternalMessage.events','save','update','emit','removeListener','register','length'];(function(_0x3138ff,_0x53ad98){var _0x40d867=function(_0x5bc3dd){while(--_0x5bc3dd){_0x3138ff['push'](_0x3138ff['shift']());}};_0x40d867(++_0x53ad98);}(_0xd60b,0x1d9));var _0xbd60=function(_0x154caa,_0x3534a7){_0x154caa=_0x154caa-0x0;var _0x2cae20=_0xd60b[_0x154caa];return _0x2cae20;};'use strict';var ChatInternalMessageEvents=require(_0xbd60('0x0'));var events=[_0xbd60('0x1'),'remove',_0xbd60('0x2')];function createListener(_0x3f14c6,_0x5aff5f){return function(_0x2db401){_0x5aff5f[_0xbd60('0x3')](_0x3f14c6,_0x2db401);};}function removeListener(_0x344cca,_0x16d0b1){return function(){ChatInternalMessageEvents[_0xbd60('0x4')](_0x344cca,_0x16d0b1);};}exports[_0xbd60('0x5')]=function(_0x5468a8){for(var _0x1a0a44=0x0,_0x1f450e=events[_0xbd60('0x6')];_0x1a0a44<_0x1f450e;_0x1a0a44++){var _0x439160=events[_0x1a0a44];var _0x531342=createListener(_0xbd60('0x7')+_0x439160,_0x5468a8);ChatInternalMessageEvents['on'](_0x439160,_0x531342);}}; \ No newline at end of file +var _0xaa42=['save','update','emit','length','chatInternalMessage:','./chatInternalMessage.events'];(function(_0x318358,_0x2b6b9b){var _0x39e08c=function(_0x2250ae){while(--_0x2250ae){_0x318358['push'](_0x318358['shift']());}};_0x39e08c(++_0x2b6b9b);}(_0xaa42,0x1df));var _0x2aa4=function(_0x2be8c2,_0x14a4b5){_0x2be8c2=_0x2be8c2-0x0;var _0x97f531=_0xaa42[_0x2be8c2];return _0x97f531;};'use strict';var ChatInternalMessageEvents=require(_0x2aa4('0x0'));var events=[_0x2aa4('0x1'),'remove',_0x2aa4('0x2')];function createListener(_0x35e5fb,_0x3d2a72){return function(_0x1a0643){_0x3d2a72[_0x2aa4('0x3')](_0x35e5fb,_0x1a0643);};}function removeListener(_0x24dae5,_0x1fa94b){return function(){ChatInternalMessageEvents['removeListener'](_0x24dae5,_0x1fa94b);};}exports['register']=function(_0x548274){for(var _0x53a1f0=0x0,_0xefadc3=events[_0x2aa4('0x4')];_0x53a1f0<_0xefadc3;_0x53a1f0++){var _0x1d6185=events[_0x53a1f0];var _0x24ceb6=createListener(_0x2aa4('0x5')+_0x1d6185,_0x548274);ChatInternalMessageEvents['on'](_0x1d6185,_0x24ceb6);}}; \ No newline at end of file diff --git a/server/api/chatInternalMessage/index.js b/server/api/chatInternalMessage/index.js index ace25d0..304a9c0 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 _0xc939=['destroy','exports','path','connect-timeout','express','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','./chatInternalMessage.controller','get','index','/describe','describe','/users','isAuthenticated','getUsers','/:id','show','create','put','update'];(function(_0x564888,_0xc93aca){var _0x521598=function(_0x1bb138){while(--_0x1bb138){_0x564888['push'](_0x564888['shift']());}};_0x521598(++_0xc93aca);}(_0xc939,0xb2));var _0x9c93=function(_0x584a45,_0x54819c){_0x584a45=_0x584a45-0x0;var _0x3658cc=_0xc939[_0x584a45];return _0x3658cc;};'use strict';var multer=require('multer');var util=require('util');var path=require(_0x9c93('0x0'));var timeout=require(_0x9c93('0x1'));var express=require(_0x9c93('0x2'));var router=express['Router']();var fs_extra=require(_0x9c93('0x3'));var auth=require(_0x9c93('0x4'));var interaction=require(_0x9c93('0x5'));var config=require(_0x9c93('0x6'));var controller=require(_0x9c93('0x7'));router[_0x9c93('0x8')]('/',auth['isAuthenticated'](),controller[_0x9c93('0x9')]);router[_0x9c93('0x8')](_0x9c93('0xa'),auth['isAuthenticated'](),controller[_0x9c93('0xb')]);router[_0x9c93('0x8')](_0x9c93('0xc'),auth[_0x9c93('0xd')](),controller[_0x9c93('0xe')]);router['get'](_0x9c93('0xf'),auth['isAuthenticated'](),controller[_0x9c93('0x10')]);router['post']('/',auth['isAuthenticated'](),controller[_0x9c93('0x11')]);router[_0x9c93('0x12')](_0x9c93('0xf'),controller[_0x9c93('0x13')]);router['delete']('/:id',auth[_0x9c93('0xd')](),controller[_0x9c93('0x14')]);module[_0x9c93('0x15')]=router; \ No newline at end of file +var _0xaee0=['getUsers','/:id','create','put','delete','destroy','multer','util','path','connect-timeout','express','Router','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','./chatInternalMessage.controller','get','index','/describe','isAuthenticated','describe','/users'];(function(_0x5f3f88,_0x562baf){var _0xd08119=function(_0x42dbf7){while(--_0x42dbf7){_0x5f3f88['push'](_0x5f3f88['shift']());}};_0xd08119(++_0x562baf);}(_0xaee0,0x18d));var _0x0aee=function(_0x1fb6e2,_0x3a22ce){_0x1fb6e2=_0x1fb6e2-0x0;var _0x354690=_0xaee0[_0x1fb6e2];return _0x354690;};'use strict';var multer=require(_0x0aee('0x0'));var util=require(_0x0aee('0x1'));var path=require(_0x0aee('0x2'));var timeout=require(_0x0aee('0x3'));var express=require(_0x0aee('0x4'));var router=express[_0x0aee('0x5')]();var fs_extra=require(_0x0aee('0x6'));var auth=require(_0x0aee('0x7'));var interaction=require(_0x0aee('0x8'));var config=require(_0x0aee('0x9'));var controller=require(_0x0aee('0xa'));router[_0x0aee('0xb')]('/',auth['isAuthenticated'](),controller[_0x0aee('0xc')]);router[_0x0aee('0xb')](_0x0aee('0xd'),auth[_0x0aee('0xe')](),controller[_0x0aee('0xf')]);router[_0x0aee('0xb')](_0x0aee('0x10'),auth[_0x0aee('0xe')](),controller[_0x0aee('0x11')]);router[_0x0aee('0xb')](_0x0aee('0x12'),auth[_0x0aee('0xe')](),controller['show']);router['post']('/',auth[_0x0aee('0xe')](),controller[_0x0aee('0x13')]);router[_0x0aee('0x14')](_0x0aee('0x12'),controller['update']);router[_0x0aee('0x15')]('/:id',auth[_0x0aee('0xe')](),controller[_0x0aee('0x16')]);module['exports']=router; \ No newline at end of file diff --git a/server/api/chatMessage/chatMessage.attributes.js b/server/api/chatMessage/chatMessage.attributes.js index 4bf9fa7..2816afa 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 _0x4c99=['sequelize','TEXT','ENUM','out','DATE','STRING'];(function(_0x12170b,_0x12f81d){var _0x128711=function(_0x26619f){while(--_0x26619f){_0x12170b['push'](_0x12170b['shift']());}};_0x128711(++_0x12f81d);}(_0x4c99,0x1ec));var _0x94c9=function(_0x4f9b18,_0x2cb5ca){_0x4f9b18=_0x4f9b18-0x0;var _0x29f20c=_0x4c99[_0x4f9b18];return _0x29f20c;};'use strict';var Sequelize=require(_0x94c9('0x0'));module['exports']={'body':{'type':Sequelize[_0x94c9('0x1')]('medium'),'allowNull':![]},'read':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'secret':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'direction':{'type':Sequelize[_0x94c9('0x2')]('in',_0x94c9('0x3')),'defaultValue':'out','allowNull':![]},'readAt':{'type':Sequelize[_0x94c9('0x4')]},'providerName':{'type':Sequelize[_0x94c9('0x5')]},'providerResponse':{'type':Sequelize['TEXT']}}; \ No newline at end of file +var _0x4e5c=['TEXT','BOOLEAN','ENUM','STRING','sequelize'];(function(_0x382e89,_0x4768c0){var _0x3a1318=function(_0x79e1ce){while(--_0x79e1ce){_0x382e89['push'](_0x382e89['shift']());}};_0x3a1318(++_0x4768c0);}(_0x4e5c,0x149));var _0xc4e5=function(_0x49d41c,_0x2bdc35){_0x49d41c=_0x49d41c-0x0;var _0xb64c5f=_0x4e5c[_0x49d41c];return _0xb64c5f;};'use strict';var Sequelize=require(_0xc4e5('0x0'));module['exports']={'body':{'type':Sequelize[_0xc4e5('0x1')]('medium'),'allowNull':![]},'read':{'type':Sequelize[_0xc4e5('0x2')],'defaultValue':![]},'secret':{'type':Sequelize[_0xc4e5('0x2')],'defaultValue':![]},'direction':{'type':Sequelize[_0xc4e5('0x3')]('in','out'),'defaultValue':'out','allowNull':![]},'readAt':{'type':Sequelize['DATE']},'providerName':{'type':Sequelize[_0xc4e5('0x4')]},'providerResponse':{'type':Sequelize[_0xc4e5('0x1')]}}; \ No newline at end of file diff --git a/server/api/chatMessage/chatMessage.controller.js b/server/api/chatMessage/chatMessage.controller.js index e8d6ada..60ef103 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 _0x6d3f=['eml-format','rimraf','request-promise','moment','bluebird','util','path','sox','to-csv','ejs','fs-extra','lodash','crypto','querystring','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','../../config/environment','../../config/license/util','../../mysqldb','socket.io-emitter','./chatMessage.socket','register','client','http','request','then','info','ChatMessage,\x20%s,\x20%s','debug','ChatMessage,\x20%s,\x20%s,\x20%s','request\x20sent','stringify','error','message','catch','sendStatus','status','json','offset','undefined','count','limit','set','Content-Range','apply','reject','save','destroy','end','name','send','ChatMessage','rawAttributes','fieldName','type','key','model','map','query','keys','attributes','intersection','fields','length','nolimit','order','sort','where','filters','pick','merge','VIRTUAL','filter','options','includeAll','include','findAll','find','create','body','update','params','describe','accept','chat','read','readAt','format','YYYY-MM-DD\x20HH:mm:ss','UserId','user','ChatInteractionId','read1stAt','interaction','get','null','AcceptMessage','acceptMessage','SELECT\x20*\x20FROM\x20cm_contacts\x20WHERE\x20id\x20=\x20','ContactId','sequelize','Sequelize','QueryTypes','SELECT','contact','User','agent','fullname','email','internal','manual','SIP/%s','channel','motionChannel','event','EventManager','parse','formData','chat-interactions','[CHATMESSAGE:REJECT]\x20id=%s\x20name=%s\x20role=%s\x20interaction=%s\x20body=%s','role','RejectMessage','rejectMessage'];(function(_0x26c7d6,_0x2c3b32){var _0x4c5cfa=function(_0x41e775){while(--_0x41e775){_0x26c7d6['push'](_0x26c7d6['shift']());}};_0x4c5cfa(++_0x2c3b32);}(_0x6d3f,0xfc));var _0xf6d3=function(_0x3a70ff,_0x1f4718){_0x3a70ff=_0x3a70ff-0x0;var _0x3c429b=_0x6d3f[_0x3a70ff];return _0x3c429b;};'use strict';var emlformat=require(_0xf6d3('0x0'));var rimraf=require(_0xf6d3('0x1'));var zipdir=require('zip-dir');var jsonpatch=require('fast-json-patch');var rp=require(_0xf6d3('0x2'));var moment=require(_0xf6d3('0x3'));var BPromise=require(_0xf6d3('0x4'));var Mustache=require('mustache');var util=require(_0xf6d3('0x5'));var path=require(_0xf6d3('0x6'));var sox=require(_0xf6d3('0x7'));var csv=require(_0xf6d3('0x8'));var ejs=require(_0xf6d3('0x9'));var fs=require('fs');var fs_extra=require(_0xf6d3('0xa'));var _=require(_0xf6d3('0xb'));var squel=require('squel');var crypto=require(_0xf6d3('0xc'));var jsforce=require('jsforce');var deskjs=require('desk.js');var toCsv=require(_0xf6d3('0x8'));var querystring=require(_0xf6d3('0xd'));var Papa=require('papaparse');var Redis=require('ioredis');var authService=require(_0xf6d3('0xe'));var qs=require(_0xf6d3('0xf'));var as=require(_0xf6d3('0x10'));var hardwareService=require(_0xf6d3('0x11'));var logger=require(_0xf6d3('0x12'))('api');var utils=require('../../config/utils');var config=require(_0xf6d3('0x13'));var licenseUtil=require(_0xf6d3('0x14'));var db=require(_0xf6d3('0x15'))['db'];config['redis']=_['defaults'](config['redis'],{'host':'localhost','port':0x18eb});var socket=require(_0xf6d3('0x16'))(new Redis(config['redis']));require(_0xf6d3('0x17'))[_0xf6d3('0x18')](socket);var jayson=require('jayson/promise');var client=jayson[_0xf6d3('0x19')][_0xf6d3('0x1a')]({'port':0x232c});var client9002=jayson['client']['http']({'port':0x232a});function respondWithRpcPromise(_0x11b65a,_0x3fda81,_0x345eff,_0x307646){return new BPromise(function(_0x1529ad,_0x1f9273){var _0x12b294=_0x307646||client;return _0x12b294[_0xf6d3('0x1b')](_0x11b65a,_0x345eff)[_0xf6d3('0x1c')](function(_0x3f5280){logger[_0xf6d3('0x1d')](_0xf6d3('0x1e'),_0x3fda81,'request\x20sent');logger[_0xf6d3('0x1f')](_0xf6d3('0x20'),_0x3fda81,_0xf6d3('0x21'),JSON[_0xf6d3('0x22')](_0x3f5280));if(_0x3f5280[_0xf6d3('0x23')]){if(_0x3f5280['error']['code']===0x1f4){logger[_0xf6d3('0x23')](_0xf6d3('0x1e'),_0x3fda81,_0x3f5280[_0xf6d3('0x23')]['message']);return _0x1f9273(_0x3f5280[_0xf6d3('0x23')]['message']);}logger['error']('ChatMessage,\x20%s,\x20%s',_0x3fda81,_0x3f5280[_0xf6d3('0x23')][_0xf6d3('0x24')]);return _0x1529ad(_0x3f5280[_0xf6d3('0x23')][_0xf6d3('0x24')]);}else{logger[_0xf6d3('0x1d')]('ChatMessage,\x20%s,\x20%s',_0x3fda81,_0xf6d3('0x21'));_0x1529ad(_0x3f5280['result'][_0xf6d3('0x24')]);}})[_0xf6d3('0x25')](function(_0x54a96e){logger[_0xf6d3('0x23')](_0xf6d3('0x1e'),_0x3fda81,_0x54a96e);_0x1f9273(_0x54a96e);});});}function respondWithStatusCode(_0x52f0bd,_0x49c655){_0x49c655=_0x49c655||0xcc;return function(_0x370067){if(_0x370067){return _0x52f0bd[_0xf6d3('0x26')](_0x49c655);}return _0x52f0bd[_0xf6d3('0x27')](_0x49c655)['end']();};}function respondWithResult(_0x6ec7ca,_0x392210){_0x392210=_0x392210||0xc8;return function(_0x104f6e){if(_0x104f6e){return _0x6ec7ca[_0xf6d3('0x27')](_0x392210)[_0xf6d3('0x28')](_0x104f6e);}};}function respondWithFilteredResult(_0x21c211,_0x20fac9){return function(_0x27feb7){if(_0x27feb7){var _0x3eb1d5=typeof _0x20fac9[_0xf6d3('0x29')]===_0xf6d3('0x2a')&&typeof _0x20fac9['limit']===_0xf6d3('0x2a');var _0x3f7283=_0x27feb7[_0xf6d3('0x2b')];var _0x251231=_0x3eb1d5?0x0:_0x20fac9['offset'];var _0x3dc045=_0x3eb1d5?_0x27feb7[_0xf6d3('0x2b')]:_0x20fac9[_0xf6d3('0x29')]+_0x20fac9[_0xf6d3('0x2c')];var _0x27b45c;if(_0x3dc045>=_0x3f7283){_0x3dc045=_0x3f7283;_0x27b45c=0xc8;}else{_0x27b45c=0xce;}_0x21c211[_0xf6d3('0x27')](_0x27b45c);return _0x21c211[_0xf6d3('0x2d')](_0xf6d3('0x2e'),_0x251231+'-'+_0x3dc045+'/'+_0x3f7283)[_0xf6d3('0x28')](_0x27feb7);}return null;};}function patchUpdates(_0x3195c1){return function(_0x36a4a1){try{jsonpatch[_0xf6d3('0x2f')](_0x36a4a1,_0x3195c1,!![]);}catch(_0x396237){return BPromise[_0xf6d3('0x30')](_0x396237);}return _0x36a4a1[_0xf6d3('0x31')]();};}function saveUpdates(_0xce7040,_0x11955c){return function(_0x3b9264){if(_0x3b9264){return _0x3b9264['update'](_0xce7040)['then'](function(_0x1dfc3b){return _0x1dfc3b;});}return null;};}function removeEntity(_0xa686ee,_0x86fc42){return function(_0x34240c){if(_0x34240c){return _0x34240c[_0xf6d3('0x32')]()[_0xf6d3('0x1c')](function(){_0xa686ee[_0xf6d3('0x27')](0xcc)[_0xf6d3('0x33')]();});}};}function handleEntityNotFound(_0x3cc6ab,_0x3117f6){return function(_0x83a863){if(!_0x83a863){_0x3cc6ab[_0xf6d3('0x26')](0x194);}return _0x83a863;};}function handleError(_0x4dc160,_0x4ff102){_0x4ff102=_0x4ff102||0x1f4;return function(_0x4c2a85){logger[_0xf6d3('0x23')](_0x4c2a85['stack']);if(_0x4c2a85[_0xf6d3('0x34')]){delete _0x4c2a85[_0xf6d3('0x34')];}_0x4dc160[_0xf6d3('0x27')](_0x4ff102)[_0xf6d3('0x35')](_0x4c2a85);};}exports['index']=function(_0x200982,_0x1af955){var _0xf897c2={},_0x38d597={},_0x370d60={'count':0x0,'rows':[]};var _0x521fd5=_['map'](db[_0xf6d3('0x36')][_0xf6d3('0x37')],function(_0x53e0a9){return{'name':_0x53e0a9[_0xf6d3('0x38')],'type':_0x53e0a9[_0xf6d3('0x39')][_0xf6d3('0x3a')]};});_0x38d597[_0xf6d3('0x3b')]=_[_0xf6d3('0x3c')](_0x521fd5,_0xf6d3('0x34'));_0x38d597[_0xf6d3('0x3d')]=_[_0xf6d3('0x3e')](_0x200982[_0xf6d3('0x3d')]);_0x38d597['filters']=_['intersection'](_0x38d597['model'],_0x38d597['query']);_0xf897c2[_0xf6d3('0x3f')]=_[_0xf6d3('0x40')](_0x38d597[_0xf6d3('0x3b')],qs[_0xf6d3('0x41')](_0x200982['query'][_0xf6d3('0x41')]));_0xf897c2[_0xf6d3('0x3f')]=_0xf897c2[_0xf6d3('0x3f')][_0xf6d3('0x42')]?_0xf897c2['attributes']:_0x38d597['model'];if(!_0x200982[_0xf6d3('0x3d')]['hasOwnProperty'](_0xf6d3('0x43'))){_0xf897c2['limit']=qs['limit'](_0x200982['query']['limit']);_0xf897c2[_0xf6d3('0x29')]=qs['offset'](_0x200982['query'][_0xf6d3('0x29')]);}_0xf897c2[_0xf6d3('0x44')]=qs[_0xf6d3('0x45')](_0x200982[_0xf6d3('0x3d')][_0xf6d3('0x45')]);_0xf897c2[_0xf6d3('0x46')]=qs[_0xf6d3('0x47')](_[_0xf6d3('0x48')](_0x200982['query'],_0x38d597['filters']),_0x521fd5);if(_0x200982[_0xf6d3('0x3d')]['filter']){_0xf897c2[_0xf6d3('0x46')]=_[_0xf6d3('0x49')](_0xf897c2[_0xf6d3('0x46')],{'$or':_[_0xf6d3('0x3c')](_0x521fd5,function(_0x2997d9){if(_0x2997d9[_0xf6d3('0x39')]!==_0xf6d3('0x4a')){var _0x4a6292={};_0x4a6292[_0x2997d9['name']]={'$like':'%'+_0x200982[_0xf6d3('0x3d')][_0xf6d3('0x4b')]+'%'};return _0x4a6292;}})});}_0xf897c2=_[_0xf6d3('0x49')]({},_0xf897c2,_0x200982[_0xf6d3('0x4c')]);var _0x2b5550={'where':_0xf897c2[_0xf6d3('0x46')]};return db[_0xf6d3('0x36')][_0xf6d3('0x2b')](_0x2b5550)[_0xf6d3('0x1c')](function(_0x2155c6){_0x370d60[_0xf6d3('0x2b')]=_0x2155c6;if(_0x200982[_0xf6d3('0x3d')][_0xf6d3('0x4d')]){_0xf897c2[_0xf6d3('0x4e')]=[{'all':!![]}];}return db[_0xf6d3('0x36')][_0xf6d3('0x4f')](_0xf897c2);})[_0xf6d3('0x1c')](function(_0x388796){_0x370d60['rows']=_0x388796;return _0x370d60;})[_0xf6d3('0x1c')](respondWithFilteredResult(_0x1af955,_0xf897c2))[_0xf6d3('0x25')](handleError(_0x1af955,null));};exports['show']=function(_0x290537,_0x313692){var _0x2e88ec={'raw':!![],'where':{'id':_0x290537['params']['id']}},_0x49133e={};_0x49133e['model']=_[_0xf6d3('0x3e')](db[_0xf6d3('0x36')]['rawAttributes']);_0x49133e[_0xf6d3('0x3d')]=_[_0xf6d3('0x3e')](_0x290537[_0xf6d3('0x3d')]);_0x49133e[_0xf6d3('0x47')]=_[_0xf6d3('0x40')](_0x49133e[_0xf6d3('0x3b')],_0x49133e[_0xf6d3('0x3d')]);_0x2e88ec[_0xf6d3('0x3f')]=_[_0xf6d3('0x40')](_0x49133e[_0xf6d3('0x3b')],qs[_0xf6d3('0x41')](_0x290537['query'][_0xf6d3('0x41')]));_0x2e88ec[_0xf6d3('0x3f')]=_0x2e88ec[_0xf6d3('0x3f')][_0xf6d3('0x42')]?_0x2e88ec['attributes']:_0x49133e[_0xf6d3('0x3b')];if(_0x290537[_0xf6d3('0x3d')][_0xf6d3('0x4d')]){_0x2e88ec['include']=[{'all':!![]}];}_0x2e88ec=_[_0xf6d3('0x49')]({},_0x2e88ec,_0x290537['options']);return db[_0xf6d3('0x36')][_0xf6d3('0x50')](_0x2e88ec)[_0xf6d3('0x1c')](handleEntityNotFound(_0x313692,null))[_0xf6d3('0x1c')](respondWithResult(_0x313692,null))['catch'](handleError(_0x313692,null));};exports['create']=function(_0x5e4c2f,_0x70f29){return db[_0xf6d3('0x36')][_0xf6d3('0x51')](_0x5e4c2f[_0xf6d3('0x52')],{})[_0xf6d3('0x1c')](respondWithResult(_0x70f29,0xc9))[_0xf6d3('0x25')](handleError(_0x70f29,null));};exports[_0xf6d3('0x53')]=function(_0x55b4ad,_0x31e28f){if(_0x55b4ad[_0xf6d3('0x52')]['id']){delete _0x55b4ad[_0xf6d3('0x52')]['id'];}return db['ChatMessage']['find']({'where':{'id':_0x55b4ad[_0xf6d3('0x54')]['id']}})['then'](handleEntityNotFound(_0x31e28f,null))[_0xf6d3('0x1c')](saveUpdates(_0x55b4ad[_0xf6d3('0x52')],null))['then'](respondWithResult(_0x31e28f,null))['catch'](handleError(_0x31e28f,null));};exports['destroy']=function(_0x1ae855,_0x2d39d7){return db[_0xf6d3('0x36')]['find']({'where':{'id':_0x1ae855[_0xf6d3('0x54')]['id']}})[_0xf6d3('0x1c')](handleEntityNotFound(_0x2d39d7,null))[_0xf6d3('0x1c')](removeEntity(_0x2d39d7,null))[_0xf6d3('0x25')](handleError(_0x2d39d7,null));};exports['describe']=function(_0x1b00a1,_0x50cb8e){return db[_0xf6d3('0x36')][_0xf6d3('0x55')]()[_0xf6d3('0x1c')](respondWithResult(_0x50cb8e,null))[_0xf6d3('0x25')](handleError(_0x50cb8e,null));};var interaction_log=require(_0xf6d3('0x12'))('chat-interactions');exports[_0xf6d3('0x56')]=function(_0x3ec07b,_0x3c2548,_0x426597){var _0x2b8e85={'agent':{},'channel':_0xf6d3('0x57')};if(_0x3ec07b[_0xf6d3('0x52')]['id']){delete _0x3ec07b[_0xf6d3('0x52')]['id'];}_0x3ec07b[_0xf6d3('0x52')][_0xf6d3('0x58')]=!![];_0x3ec07b[_0xf6d3('0x52')][_0xf6d3('0x59')]=moment()[_0xf6d3('0x5a')](_0xf6d3('0x5b'));_0x3ec07b['body']['UserId']=_0x3ec07b['body'][_0xf6d3('0x5c')]||_0x3ec07b[_0xf6d3('0x5d')]['id'];_0x2b8e85['agent']['id']=_0x3ec07b[_0xf6d3('0x52')][_0xf6d3('0x5c')];return db[_0xf6d3('0x36')][_0xf6d3('0x50')]({'where':{'id':_0x3ec07b[_0xf6d3('0x54')]['id'],'UserId':null}})['then'](handleEntityNotFound(_0x3c2548,null))[_0xf6d3('0x1c')](saveUpdates(_0x3ec07b['body'],null))[_0xf6d3('0x1c')](function(_0x5d8edb){if(_0x5d8edb){_0x2b8e85[_0xf6d3('0x24')]=_0x5d8edb['get']({'plain':!![]});return db['ChatInteraction'][_0xf6d3('0x50')]({'where':{'id':_0x5d8edb[_0xf6d3('0x5e')]}});}return null;})[_0xf6d3('0x1c')](handleEntityNotFound(_0x3c2548,null))[_0xf6d3('0x1c')](function(_0xf3b414){if(_0xf3b414){return _0xf3b414[_0xf6d3('0x53')]({'UserId':_0x3ec07b[_0xf6d3('0x52')][_0xf6d3('0x5c')],'read1stAt':_['isNil'](_0xf3b414[_0xf6d3('0x5f')])?moment()[_0xf6d3('0x5a')]('YYYY-MM-DD\x20HH:mm:ss'):undefined});}return null;})['then'](function(_0x34a9ef){if(_0x34a9ef){_0x2b8e85[_0xf6d3('0x60')]=_0x34a9ef[_0xf6d3('0x61')]({'plain':!![]});interaction_log[_0xf6d3('0x1d')]('[CHATMESSAGE:ACCEPT]\x20id=%s\x20name=%s\x20role=%s\x20interaction=%s\x20body=%s',_0x3ec07b[_0xf6d3('0x5d')]['id'],_0x3ec07b[_0xf6d3('0x5d')][_0xf6d3('0x34')],_0x3ec07b[_0xf6d3('0x5d')]['role'],_0x2b8e85['interaction']['id'],_0x3ec07b[_0xf6d3('0x52')]?JSON[_0xf6d3('0x22')](_0x3ec07b[_0xf6d3('0x52')]):_0xf6d3('0x62'));return respondWithRpcPromise(_0xf6d3('0x63'),_0xf6d3('0x64'),_0x2b8e85);}return null;})[_0xf6d3('0x1c')](function(_0x39e702){var _0x5ec5c2=_0xf6d3('0x65')+_0x39e702['message'][_0xf6d3('0x66')];return db[_0xf6d3('0x67')][_0xf6d3('0x3d')](_0x5ec5c2,{'type':db[_0xf6d3('0x68')][_0xf6d3('0x69')][_0xf6d3('0x6a')],'raw':!![]})[_0xf6d3('0x1c')](function(_0x2eba7b){return _0x2eba7b;});})[_0xf6d3('0x1c')](function(_0x1ee77a){if(_0x1ee77a){_0x2b8e85['message'][_0xf6d3('0x6b')]=_0x1ee77a[0x0];if(!_0x3ec07b[_0xf6d3('0x52')][_0xf6d3('0x5c')])return;return db[_0xf6d3('0x6c')][_0xf6d3('0x50')]({'where':{'id':_0x3ec07b[_0xf6d3('0x52')]['UserId'],'role':_0xf6d3('0x6d')},'attributes':['id',_0xf6d3('0x34'),_0xf6d3('0x6e'),_0xf6d3('0x6f'),_0xf6d3('0x70')],'raw':!![]});}return null;})[_0xf6d3('0x1c')](function(_0x5959d9){if(!_0x5959d9)return null;_0x2b8e85['message'][_0xf6d3('0x6d')]=_0x5959d9;return _0x2b8e85;})[_0xf6d3('0x1c')](function(_0x55aeaa){if(_0x55aeaa){if(_0x3ec07b[_0xf6d3('0x52')][_0xf6d3('0x71')]){_0x2b8e85['message']['interface']=util['format'](_0xf6d3('0x72'),_0x3ec07b[_0xf6d3('0x5d')][_0xf6d3('0x34')]);_0x2b8e85['message'][_0xf6d3('0x73')]=_0x2b8e85['channel'];_0x2b8e85[_0xf6d3('0x24')][_0xf6d3('0x74')]=_0x2b8e85[_0xf6d3('0x73')];_0x2b8e85[_0xf6d3('0x24')][_0xf6d3('0x75')]=_0xf6d3('0x56');return respondWithRpcPromise(_0xf6d3('0x76'),_0xf6d3('0x76'),{'event':'acceptmessage','message':_[_0xf6d3('0x49')](_0x2b8e85[_0xf6d3('0x24')],JSON[_0xf6d3('0x77')](_0x2b8e85[_0xf6d3('0x60')][_0xf6d3('0x78')]))},client9002)[_0xf6d3('0x1c')](function(){return _0x2b8e85;});}return _0x2b8e85;}return null;})['then'](respondWithResult(_0x3c2548,null))[_0xf6d3('0x25')](handleError(_0x3c2548,null));};var interaction_log=require(_0xf6d3('0x12'))(_0xf6d3('0x79'));exports[_0xf6d3('0x30')]=function(_0x549b00,_0x4a0f9c,_0x9abb62){var _0x4dfc17={'agent':{},'channel':_0xf6d3('0x57')};if(_0x549b00[_0xf6d3('0x52')]['id']){delete _0x549b00[_0xf6d3('0x52')]['id'];}_0x549b00[_0xf6d3('0x52')][_0xf6d3('0x5c')]=_0x549b00[_0xf6d3('0x52')][_0xf6d3('0x5c')]||_0x549b00['user']['id'];_0x4dfc17[_0xf6d3('0x6d')]['id']=_0x549b00[_0xf6d3('0x52')][_0xf6d3('0x5c')];return db[_0xf6d3('0x36')]['find']({'where':{'id':_0x549b00[_0xf6d3('0x54')]['id'],'UserId':null}})[_0xf6d3('0x1c')](handleEntityNotFound(_0x4a0f9c,null))[_0xf6d3('0x1c')](function(_0x341597){if(_0x341597){_0x4dfc17[_0xf6d3('0x24')]=_0x341597[_0xf6d3('0x61')]({'plain':!![]});return db['ChatInteraction'][_0xf6d3('0x50')]({'where':{'id':_0x341597['ChatInteractionId']}});}return null;})[_0xf6d3('0x1c')](handleEntityNotFound(_0x4a0f9c,null))[_0xf6d3('0x1c')](function(_0x3d7041){if(_0x3d7041){_0x4dfc17['interaction']=_0x3d7041[_0xf6d3('0x61')]({'plain':!![]});interaction_log[_0xf6d3('0x1d')](_0xf6d3('0x7a'),_0x549b00['user']['id'],_0x549b00[_0xf6d3('0x5d')][_0xf6d3('0x34')],_0x549b00[_0xf6d3('0x5d')][_0xf6d3('0x7b')],_0x4dfc17['interaction']['id'],_0x549b00[_0xf6d3('0x52')]?JSON[_0xf6d3('0x22')](_0x549b00[_0xf6d3('0x52')]):'null');return respondWithRpcPromise(_0xf6d3('0x7c'),_0xf6d3('0x7d'),_0x4dfc17);}return null;})[_0xf6d3('0x1c')](function(_0x192a90){var _0x574d53=_0xf6d3('0x65')+_0x192a90[_0xf6d3('0x24')]['ContactId'];return db[_0xf6d3('0x67')][_0xf6d3('0x3d')](_0x574d53,{'type':db[_0xf6d3('0x68')][_0xf6d3('0x69')][_0xf6d3('0x6a')],'raw':!![]})['then'](function(_0x4c8470){return _0x4c8470;});})['then'](function(_0x2feb56){if(_0x2feb56){_0x4dfc17[_0xf6d3('0x24')]['contact']=_0x2feb56[0x0];if(!_0x549b00[_0xf6d3('0x52')]['UserId'])return;return db[_0xf6d3('0x6c')]['find']({'where':{'id':_0x549b00[_0xf6d3('0x52')][_0xf6d3('0x5c')],'role':_0xf6d3('0x6d')},'attributes':['id','name',_0xf6d3('0x6e'),'email',_0xf6d3('0x70')],'raw':!![]});}return null;})[_0xf6d3('0x1c')](function(_0x3433e2){if(!_0x3433e2)return null;_0x4dfc17[_0xf6d3('0x24')][_0xf6d3('0x6d')]=_0x3433e2;return _0x4dfc17;})[_0xf6d3('0x1c')](function(_0x397690){if(_0x397690){_0x397690['message']['interface']=util['format'](_0xf6d3('0x72'),_0x549b00['user']['name']);_0x397690[_0xf6d3('0x24')][_0xf6d3('0x73')]=_0x4dfc17[_0xf6d3('0x73')];_0x397690[_0xf6d3('0x24')][_0xf6d3('0x74')]=_0x4dfc17[_0xf6d3('0x73')];_0x397690['message'][_0xf6d3('0x75')]=_0xf6d3('0x30');respondWithRpcPromise(_0xf6d3('0x76'),_0xf6d3('0x76'),{'event':'rejectmessage','message':_[_0xf6d3('0x49')](_0x4dfc17['message'],JSON['parse'](_0x4dfc17[_0xf6d3('0x60')][_0xf6d3('0x78')]))},client9002);return _0x4dfc17;}return null;})['then'](respondWithResult(_0x4a0f9c,null))[_0xf6d3('0x25')](handleError(_0x4a0f9c,null));}; \ No newline at end of file +var _0x81a8=['jayson/promise','client','http','request','then','info','ChatMessage,\x20%s,\x20%s','request\x20sent','error','message','result','sendStatus','status','end','json','offset','undefined','limit','count','Content-Range','apply','reject','stack','name','send','index','map','ChatMessage','rawAttributes','fieldName','type','key','model','query','keys','filters','intersection','attributes','fields','length','hasOwnProperty','nolimit','sort','pick','filter','where','VIRTUAL','merge','options','includeAll','include','findAll','rows','catch','params','update','body','destroy','accept','chat','read','readAt','format','YYYY-MM-DD\x20HH:mm:ss','UserId','user','agent','find','get','ChatInteraction','read1stAt','interaction','role','stringify','null','AcceptMessage','acceptMessage','SELECT\x20*\x20FROM\x20cm_contacts\x20WHERE\x20id\x20=\x20','ContactId','sequelize','Sequelize','QueryTypes','SELECT','contact','email','internal','manual','SIP/%s','channel','EventManager','acceptmessage','parse','formData','chat-interactions','ChatInteractionId','rejectMessage','fullname','interface','motionChannel','event','eml-format','rimraf','bluebird','mustache','path','ejs','fs-extra','lodash','squel','crypto','desk.js','to-csv','papaparse','ioredis','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/license/util','redis','defaults','localhost','socket.io-emitter','./chatMessage.socket','register'];(function(_0x29f1a1,_0x50ee3b){var _0x5b3cdb=function(_0x2b2935){while(--_0x2b2935){_0x29f1a1['push'](_0x29f1a1['shift']());}};_0x5b3cdb(++_0x50ee3b);}(_0x81a8,0x1de));var _0x881a=function(_0x6c0833,_0x59e073){_0x6c0833=_0x6c0833-0x0;var _0x25d75b=_0x81a8[_0x6c0833];return _0x25d75b;};'use strict';var emlformat=require(_0x881a('0x0'));var rimraf=require(_0x881a('0x1'));var zipdir=require('zip-dir');var jsonpatch=require('fast-json-patch');var rp=require('request-promise');var moment=require('moment');var BPromise=require(_0x881a('0x2'));var Mustache=require(_0x881a('0x3'));var util=require('util');var path=require(_0x881a('0x4'));var sox=require('sox');var csv=require('to-csv');var ejs=require(_0x881a('0x5'));var fs=require('fs');var fs_extra=require(_0x881a('0x6'));var _=require(_0x881a('0x7'));var squel=require(_0x881a('0x8'));var crypto=require(_0x881a('0x9'));var jsforce=require('jsforce');var deskjs=require(_0x881a('0xa'));var toCsv=require(_0x881a('0xb'));var querystring=require('querystring');var Papa=require(_0x881a('0xc'));var Redis=require(_0x881a('0xd'));var authService=require('../../components/auth/service');var qs=require(_0x881a('0xe'));var as=require(_0x881a('0xf'));var hardwareService=require(_0x881a('0x10'));var logger=require(_0x881a('0x11'))(_0x881a('0x12'));var utils=require('../../config/utils');var config=require('../../config/environment');var licenseUtil=require(_0x881a('0x13'));var db=require('../../mysqldb')['db'];config[_0x881a('0x14')]=_[_0x881a('0x15')](config[_0x881a('0x14')],{'host':_0x881a('0x16'),'port':0x18eb});var socket=require(_0x881a('0x17'))(new Redis(config[_0x881a('0x14')]));require(_0x881a('0x18'))[_0x881a('0x19')](socket);var jayson=require(_0x881a('0x1a'));var client=jayson[_0x881a('0x1b')][_0x881a('0x1c')]({'port':0x232c});var client9002=jayson[_0x881a('0x1b')][_0x881a('0x1c')]({'port':0x232a});function respondWithRpcPromise(_0x7fa98a,_0x4c9a68,_0x24e3ec,_0xeaecbd){return new BPromise(function(_0x4bbe42,_0x46802d){var _0xa0cda5=_0xeaecbd||client;return _0xa0cda5[_0x881a('0x1d')](_0x7fa98a,_0x24e3ec)[_0x881a('0x1e')](function(_0xc995c1){logger[_0x881a('0x1f')](_0x881a('0x20'),_0x4c9a68,_0x881a('0x21'));logger['debug']('ChatMessage,\x20%s,\x20%s,\x20%s',_0x4c9a68,_0x881a('0x21'),JSON['stringify'](_0xc995c1));if(_0xc995c1[_0x881a('0x22')]){if(_0xc995c1[_0x881a('0x22')]['code']===0x1f4){logger[_0x881a('0x22')]('ChatMessage,\x20%s,\x20%s',_0x4c9a68,_0xc995c1[_0x881a('0x22')][_0x881a('0x23')]);return _0x46802d(_0xc995c1[_0x881a('0x22')][_0x881a('0x23')]);}logger[_0x881a('0x22')](_0x881a('0x20'),_0x4c9a68,_0xc995c1['error'][_0x881a('0x23')]);return _0x4bbe42(_0xc995c1[_0x881a('0x22')][_0x881a('0x23')]);}else{logger[_0x881a('0x1f')](_0x881a('0x20'),_0x4c9a68,_0x881a('0x21'));_0x4bbe42(_0xc995c1[_0x881a('0x24')]['message']);}})['catch'](function(_0x5e2a4b){logger[_0x881a('0x22')](_0x881a('0x20'),_0x4c9a68,_0x5e2a4b);_0x46802d(_0x5e2a4b);});});}function respondWithStatusCode(_0x2f5c76,_0x51c7a7){_0x51c7a7=_0x51c7a7||0xcc;return function(_0x155ad1){if(_0x155ad1){return _0x2f5c76[_0x881a('0x25')](_0x51c7a7);}return _0x2f5c76[_0x881a('0x26')](_0x51c7a7)[_0x881a('0x27')]();};}function respondWithResult(_0x9bca7b,_0x1f12b5){_0x1f12b5=_0x1f12b5||0xc8;return function(_0x269037){if(_0x269037){return _0x9bca7b[_0x881a('0x26')](_0x1f12b5)[_0x881a('0x28')](_0x269037);}};}function respondWithFilteredResult(_0x200e24,_0x406fe8){return function(_0x36f090){if(_0x36f090){var _0x27d6b8=typeof _0x406fe8[_0x881a('0x29')]===_0x881a('0x2a')&&typeof _0x406fe8[_0x881a('0x2b')]==='undefined';var _0x5f38d9=_0x36f090[_0x881a('0x2c')];var _0x18102a=_0x27d6b8?0x0:_0x406fe8[_0x881a('0x29')];var _0x313af8=_0x27d6b8?_0x36f090[_0x881a('0x2c')]:_0x406fe8[_0x881a('0x29')]+_0x406fe8['limit'];var _0x233983;if(_0x313af8>=_0x5f38d9){_0x313af8=_0x5f38d9;_0x233983=0xc8;}else{_0x233983=0xce;}_0x200e24[_0x881a('0x26')](_0x233983);return _0x200e24['set'](_0x881a('0x2d'),_0x18102a+'-'+_0x313af8+'/'+_0x5f38d9)[_0x881a('0x28')](_0x36f090);}return null;};}function patchUpdates(_0x47f0de){return function(_0xb63912){try{jsonpatch[_0x881a('0x2e')](_0xb63912,_0x47f0de,!![]);}catch(_0x9ea307){return BPromise[_0x881a('0x2f')](_0x9ea307);}return _0xb63912['save']();};}function saveUpdates(_0x567df2,_0x2c102f){return function(_0x3a9a08){if(_0x3a9a08){return _0x3a9a08['update'](_0x567df2)['then'](function(_0x3ed37a){return _0x3ed37a;});}return null;};}function removeEntity(_0x22927c,_0x2d6748){return function(_0x4edf5e){if(_0x4edf5e){return _0x4edf5e['destroy']()['then'](function(){_0x22927c[_0x881a('0x26')](0xcc)['end']();});}};}function handleEntityNotFound(_0x325c6c,_0x59bf5a){return function(_0x80c13c){if(!_0x80c13c){_0x325c6c[_0x881a('0x25')](0x194);}return _0x80c13c;};}function handleError(_0x2a2f58,_0x119bb7){_0x119bb7=_0x119bb7||0x1f4;return function(_0x3a50dc){logger[_0x881a('0x22')](_0x3a50dc[_0x881a('0x30')]);if(_0x3a50dc[_0x881a('0x31')]){delete _0x3a50dc[_0x881a('0x31')];}_0x2a2f58[_0x881a('0x26')](_0x119bb7)[_0x881a('0x32')](_0x3a50dc);};}exports[_0x881a('0x33')]=function(_0x5f9a9a,_0x51dbce){var _0x586a37={},_0x2a6c9d={},_0x3ad33e={'count':0x0,'rows':[]};var _0x3d5048=_[_0x881a('0x34')](db[_0x881a('0x35')][_0x881a('0x36')],function(_0x5910df){return{'name':_0x5910df[_0x881a('0x37')],'type':_0x5910df[_0x881a('0x38')][_0x881a('0x39')]};});_0x2a6c9d[_0x881a('0x3a')]=_['map'](_0x3d5048,'name');_0x2a6c9d[_0x881a('0x3b')]=_[_0x881a('0x3c')](_0x5f9a9a[_0x881a('0x3b')]);_0x2a6c9d[_0x881a('0x3d')]=_[_0x881a('0x3e')](_0x2a6c9d[_0x881a('0x3a')],_0x2a6c9d[_0x881a('0x3b')]);_0x586a37[_0x881a('0x3f')]=_[_0x881a('0x3e')](_0x2a6c9d[_0x881a('0x3a')],qs['fields'](_0x5f9a9a[_0x881a('0x3b')][_0x881a('0x40')]));_0x586a37['attributes']=_0x586a37[_0x881a('0x3f')][_0x881a('0x41')]?_0x586a37['attributes']:_0x2a6c9d[_0x881a('0x3a')];if(!_0x5f9a9a[_0x881a('0x3b')][_0x881a('0x42')](_0x881a('0x43'))){_0x586a37['limit']=qs[_0x881a('0x2b')](_0x5f9a9a[_0x881a('0x3b')][_0x881a('0x2b')]);_0x586a37['offset']=qs[_0x881a('0x29')](_0x5f9a9a[_0x881a('0x3b')][_0x881a('0x29')]);}_0x586a37['order']=qs[_0x881a('0x44')](_0x5f9a9a['query'][_0x881a('0x44')]);_0x586a37['where']=qs[_0x881a('0x3d')](_[_0x881a('0x45')](_0x5f9a9a[_0x881a('0x3b')],_0x2a6c9d[_0x881a('0x3d')]),_0x3d5048);if(_0x5f9a9a[_0x881a('0x3b')][_0x881a('0x46')]){_0x586a37['where']=_['merge'](_0x586a37[_0x881a('0x47')],{'$or':_[_0x881a('0x34')](_0x3d5048,function(_0xd2e7df){if(_0xd2e7df[_0x881a('0x38')]!==_0x881a('0x48')){var _0x36d468={};_0x36d468[_0xd2e7df['name']]={'$like':'%'+_0x5f9a9a[_0x881a('0x3b')][_0x881a('0x46')]+'%'};return _0x36d468;}})});}_0x586a37=_[_0x881a('0x49')]({},_0x586a37,_0x5f9a9a[_0x881a('0x4a')]);var _0x151a42={'where':_0x586a37[_0x881a('0x47')]};return db[_0x881a('0x35')][_0x881a('0x2c')](_0x151a42)[_0x881a('0x1e')](function(_0x5603f7){_0x3ad33e[_0x881a('0x2c')]=_0x5603f7;if(_0x5f9a9a[_0x881a('0x3b')][_0x881a('0x4b')]){_0x586a37[_0x881a('0x4c')]=[{'all':!![]}];}return db[_0x881a('0x35')][_0x881a('0x4d')](_0x586a37);})[_0x881a('0x1e')](function(_0x469afe){_0x3ad33e[_0x881a('0x4e')]=_0x469afe;return _0x3ad33e;})[_0x881a('0x1e')](respondWithFilteredResult(_0x51dbce,_0x586a37))[_0x881a('0x4f')](handleError(_0x51dbce,null));};exports['show']=function(_0x2e02b0,_0x16660e){var _0x1b696d={'raw':!![],'where':{'id':_0x2e02b0[_0x881a('0x50')]['id']}},_0x3d7a53={};_0x3d7a53['model']=_['keys'](db['ChatMessage'][_0x881a('0x36')]);_0x3d7a53[_0x881a('0x3b')]=_[_0x881a('0x3c')](_0x2e02b0[_0x881a('0x3b')]);_0x3d7a53[_0x881a('0x3d')]=_[_0x881a('0x3e')](_0x3d7a53['model'],_0x3d7a53['query']);_0x1b696d[_0x881a('0x3f')]=_['intersection'](_0x3d7a53[_0x881a('0x3a')],qs['fields'](_0x2e02b0['query']['fields']));_0x1b696d['attributes']=_0x1b696d[_0x881a('0x3f')][_0x881a('0x41')]?_0x1b696d[_0x881a('0x3f')]:_0x3d7a53[_0x881a('0x3a')];if(_0x2e02b0['query'][_0x881a('0x4b')]){_0x1b696d[_0x881a('0x4c')]=[{'all':!![]}];}_0x1b696d=_[_0x881a('0x49')]({},_0x1b696d,_0x2e02b0[_0x881a('0x4a')]);return db[_0x881a('0x35')]['find'](_0x1b696d)[_0x881a('0x1e')](handleEntityNotFound(_0x16660e,null))[_0x881a('0x1e')](respondWithResult(_0x16660e,null))['catch'](handleError(_0x16660e,null));};exports['create']=function(_0x26f547,_0x5d35d7){return db[_0x881a('0x35')]['create'](_0x26f547['body'],{})['then'](respondWithResult(_0x5d35d7,0xc9))['catch'](handleError(_0x5d35d7,null));};exports[_0x881a('0x51')]=function(_0x1c3d94,_0x1c59b8){if(_0x1c3d94[_0x881a('0x52')]['id']){delete _0x1c3d94[_0x881a('0x52')]['id'];}return db['ChatMessage']['find']({'where':{'id':_0x1c3d94[_0x881a('0x50')]['id']}})[_0x881a('0x1e')](handleEntityNotFound(_0x1c59b8,null))[_0x881a('0x1e')](saveUpdates(_0x1c3d94[_0x881a('0x52')],null))[_0x881a('0x1e')](respondWithResult(_0x1c59b8,null))['catch'](handleError(_0x1c59b8,null));};exports[_0x881a('0x53')]=function(_0x1d571d,_0x15d0e2){return db[_0x881a('0x35')]['find']({'where':{'id':_0x1d571d[_0x881a('0x50')]['id']}})[_0x881a('0x1e')](handleEntityNotFound(_0x15d0e2,null))[_0x881a('0x1e')](removeEntity(_0x15d0e2,null))[_0x881a('0x4f')](handleError(_0x15d0e2,null));};exports['describe']=function(_0x278b95,_0x3b536a){return db[_0x881a('0x35')]['describe']()['then'](respondWithResult(_0x3b536a,null))[_0x881a('0x4f')](handleError(_0x3b536a,null));};var interaction_log=require(_0x881a('0x11'))('chat-interactions');exports[_0x881a('0x54')]=function(_0x2d952a,_0x1de3dd,_0x384c0e){var _0x1ee9ee={'agent':{},'channel':_0x881a('0x55')};if(_0x2d952a[_0x881a('0x52')]['id']){delete _0x2d952a[_0x881a('0x52')]['id'];}_0x2d952a[_0x881a('0x52')][_0x881a('0x56')]=!![];_0x2d952a[_0x881a('0x52')][_0x881a('0x57')]=moment()[_0x881a('0x58')](_0x881a('0x59'));_0x2d952a['body'][_0x881a('0x5a')]=_0x2d952a[_0x881a('0x52')]['UserId']||_0x2d952a[_0x881a('0x5b')]['id'];_0x1ee9ee[_0x881a('0x5c')]['id']=_0x2d952a[_0x881a('0x52')][_0x881a('0x5a')];return db[_0x881a('0x35')][_0x881a('0x5d')]({'where':{'id':_0x2d952a[_0x881a('0x50')]['id'],'UserId':null}})[_0x881a('0x1e')](handleEntityNotFound(_0x1de3dd,null))[_0x881a('0x1e')](saveUpdates(_0x2d952a[_0x881a('0x52')],null))[_0x881a('0x1e')](function(_0x27b4e7){if(_0x27b4e7){_0x1ee9ee['message']=_0x27b4e7[_0x881a('0x5e')]({'plain':!![]});return db[_0x881a('0x5f')][_0x881a('0x5d')]({'where':{'id':_0x27b4e7['ChatInteractionId']}});}return null;})['then'](handleEntityNotFound(_0x1de3dd,null))[_0x881a('0x1e')](function(_0x45ba8b){if(_0x45ba8b){return _0x45ba8b[_0x881a('0x51')]({'UserId':_0x2d952a[_0x881a('0x52')][_0x881a('0x5a')],'read1stAt':_['isNil'](_0x45ba8b[_0x881a('0x60')])?moment()[_0x881a('0x58')](_0x881a('0x59')):undefined});}return null;})[_0x881a('0x1e')](function(_0xb27825){if(_0xb27825){_0x1ee9ee[_0x881a('0x61')]=_0xb27825[_0x881a('0x5e')]({'plain':!![]});interaction_log[_0x881a('0x1f')]('[CHATMESSAGE:ACCEPT]\x20id=%s\x20name=%s\x20role=%s\x20interaction=%s\x20body=%s',_0x2d952a[_0x881a('0x5b')]['id'],_0x2d952a[_0x881a('0x5b')][_0x881a('0x31')],_0x2d952a[_0x881a('0x5b')][_0x881a('0x62')],_0x1ee9ee[_0x881a('0x61')]['id'],_0x2d952a[_0x881a('0x52')]?JSON[_0x881a('0x63')](_0x2d952a[_0x881a('0x52')]):_0x881a('0x64'));return respondWithRpcPromise(_0x881a('0x65'),_0x881a('0x66'),_0x1ee9ee);}return null;})[_0x881a('0x1e')](function(_0x21ed2f){var _0x2ba89f=_0x881a('0x67')+_0x21ed2f[_0x881a('0x23')][_0x881a('0x68')];return db[_0x881a('0x69')][_0x881a('0x3b')](_0x2ba89f,{'type':db[_0x881a('0x6a')][_0x881a('0x6b')][_0x881a('0x6c')],'raw':!![]})['then'](function(_0x59f9b9){return _0x59f9b9;});})[_0x881a('0x1e')](function(_0x36bade){if(_0x36bade){_0x1ee9ee[_0x881a('0x23')][_0x881a('0x6d')]=_0x36bade[0x0];if(!_0x2d952a['body'][_0x881a('0x5a')])return;return db['User'][_0x881a('0x5d')]({'where':{'id':_0x2d952a[_0x881a('0x52')][_0x881a('0x5a')],'role':_0x881a('0x5c')},'attributes':['id','name','fullname',_0x881a('0x6e'),_0x881a('0x6f')],'raw':!![]});}return null;})['then'](function(_0x90c13a){if(!_0x90c13a)return null;_0x1ee9ee[_0x881a('0x23')]['agent']=_0x90c13a;return _0x1ee9ee;})[_0x881a('0x1e')](function(_0x3ea2c9){if(_0x3ea2c9){if(_0x2d952a[_0x881a('0x52')][_0x881a('0x70')]){_0x1ee9ee[_0x881a('0x23')]['interface']=util['format'](_0x881a('0x71'),_0x2d952a['user'][_0x881a('0x31')]);_0x1ee9ee['message'][_0x881a('0x72')]=_0x1ee9ee['channel'];_0x1ee9ee[_0x881a('0x23')]['motionChannel']=_0x1ee9ee[_0x881a('0x72')];_0x1ee9ee[_0x881a('0x23')]['event']='accept';return respondWithRpcPromise('EventManager',_0x881a('0x73'),{'event':_0x881a('0x74'),'message':_['merge'](_0x1ee9ee[_0x881a('0x23')],JSON[_0x881a('0x75')](_0x1ee9ee[_0x881a('0x61')][_0x881a('0x76')]))},client9002)[_0x881a('0x1e')](function(){return _0x1ee9ee;});}return _0x1ee9ee;}return null;})[_0x881a('0x1e')](respondWithResult(_0x1de3dd,null))[_0x881a('0x4f')](handleError(_0x1de3dd,null));};var interaction_log=require('../../config/logger')(_0x881a('0x77'));exports[_0x881a('0x2f')]=function(_0x22f367,_0x22fc12,_0x289316){var _0x10e953={'agent':{},'channel':_0x881a('0x55')};if(_0x22f367[_0x881a('0x52')]['id']){delete _0x22f367[_0x881a('0x52')]['id'];}_0x22f367[_0x881a('0x52')][_0x881a('0x5a')]=_0x22f367[_0x881a('0x52')][_0x881a('0x5a')]||_0x22f367[_0x881a('0x5b')]['id'];_0x10e953['agent']['id']=_0x22f367[_0x881a('0x52')][_0x881a('0x5a')];return db[_0x881a('0x35')][_0x881a('0x5d')]({'where':{'id':_0x22f367['params']['id'],'UserId':null}})['then'](handleEntityNotFound(_0x22fc12,null))[_0x881a('0x1e')](function(_0x46f604){if(_0x46f604){_0x10e953[_0x881a('0x23')]=_0x46f604[_0x881a('0x5e')]({'plain':!![]});return db[_0x881a('0x5f')][_0x881a('0x5d')]({'where':{'id':_0x46f604[_0x881a('0x78')]}});}return null;})['then'](handleEntityNotFound(_0x22fc12,null))[_0x881a('0x1e')](function(_0x2856ef){if(_0x2856ef){_0x10e953[_0x881a('0x61')]=_0x2856ef[_0x881a('0x5e')]({'plain':!![]});interaction_log[_0x881a('0x1f')]('[CHATMESSAGE:REJECT]\x20id=%s\x20name=%s\x20role=%s\x20interaction=%s\x20body=%s',_0x22f367[_0x881a('0x5b')]['id'],_0x22f367['user'][_0x881a('0x31')],_0x22f367[_0x881a('0x5b')]['role'],_0x10e953[_0x881a('0x61')]['id'],_0x22f367[_0x881a('0x52')]?JSON[_0x881a('0x63')](_0x22f367[_0x881a('0x52')]):'null');return respondWithRpcPromise('RejectMessage',_0x881a('0x79'),_0x10e953);}return null;})[_0x881a('0x1e')](function(_0x719e98){var _0xbe1b9b=_0x881a('0x67')+_0x719e98[_0x881a('0x23')][_0x881a('0x68')];return db['sequelize'][_0x881a('0x3b')](_0xbe1b9b,{'type':db[_0x881a('0x6a')]['QueryTypes']['SELECT'],'raw':!![]})[_0x881a('0x1e')](function(_0x5ce161){return _0x5ce161;});})['then'](function(_0x46a889){if(_0x46a889){_0x10e953[_0x881a('0x23')][_0x881a('0x6d')]=_0x46a889[0x0];if(!_0x22f367['body'][_0x881a('0x5a')])return;return db['User']['find']({'where':{'id':_0x22f367[_0x881a('0x52')][_0x881a('0x5a')],'role':'agent'},'attributes':['id','name',_0x881a('0x7a'),_0x881a('0x6e'),_0x881a('0x6f')],'raw':!![]});}return null;})[_0x881a('0x1e')](function(_0x24d54b){if(!_0x24d54b)return null;_0x10e953[_0x881a('0x23')][_0x881a('0x5c')]=_0x24d54b;return _0x10e953;})['then'](function(_0x58ae3e){if(_0x58ae3e){_0x58ae3e['message'][_0x881a('0x7b')]=util[_0x881a('0x58')](_0x881a('0x71'),_0x22f367[_0x881a('0x5b')][_0x881a('0x31')]);_0x58ae3e[_0x881a('0x23')][_0x881a('0x72')]=_0x10e953[_0x881a('0x72')];_0x58ae3e[_0x881a('0x23')][_0x881a('0x7c')]=_0x10e953[_0x881a('0x72')];_0x58ae3e[_0x881a('0x23')][_0x881a('0x7d')]=_0x881a('0x2f');respondWithRpcPromise(_0x881a('0x73'),_0x881a('0x73'),{'event':'rejectmessage','message':_[_0x881a('0x49')](_0x10e953[_0x881a('0x23')],JSON['parse'](_0x10e953[_0x881a('0x61')][_0x881a('0x76')]))},client9002);return _0x10e953;}return null;})[_0x881a('0x1e')](respondWithResult(_0x22fc12,null))[_0x881a('0x4f')](handleError(_0x22fc12,null));}; \ No newline at end of file diff --git a/server/api/chatMessage/chatMessage.events.js b/server/api/chatMessage/chatMessage.events.js index 5b20f04..8b881ea 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 _0xf330=['../../mysqldb','setMaxListeners','save','remove','emit','hasOwnProperty','exports'];(function(_0x5cceb8,_0xa8e57a){var _0xeaf4be=function(_0x154250){while(--_0x154250){_0x5cceb8['push'](_0x5cceb8['shift']());}};_0xeaf4be(++_0xa8e57a);}(_0xf330,0x93));var _0x0f33=function(_0x912202,_0x1fb220){_0x912202=_0x912202-0x0;var _0x233d8f=_0xf330[_0x912202];return _0x233d8f;};'use strict';var EventEmitter=require('events');var ChatMessage=require(_0x0f33('0x0'))['db']['ChatMessage'];var ChatMessageEvents=new EventEmitter();ChatMessageEvents[_0x0f33('0x1')](0x0);var events={'afterCreate':_0x0f33('0x2'),'afterUpdate':'update','afterDestroy':_0x0f33('0x3')};function emitEvent(_0x1dc13c){return function(_0x24d472,_0x16a59b,_0xb8c4f6){ChatMessageEvents[_0x0f33('0x4')](_0x1dc13c+':'+_0x24d472['id'],_0x24d472);ChatMessageEvents[_0x0f33('0x4')](_0x1dc13c,_0x24d472);_0xb8c4f6(null);};}for(var e in events){if(events[_0x0f33('0x5')](e)){var event=events[e];ChatMessage['hook'](e,emitEvent(event));}}module[_0x0f33('0x6')]=ChatMessageEvents; \ No newline at end of file +var _0x8ce3=['setMaxListeners','save','update','remove','emit','hasOwnProperty','hook','exports','events','../../mysqldb','ChatMessage'];(function(_0xbe0bad,_0x242e22){var _0x2a18cc=function(_0x17f8ff){while(--_0x17f8ff){_0xbe0bad['push'](_0xbe0bad['shift']());}};_0x2a18cc(++_0x242e22);}(_0x8ce3,0x1aa));var _0x38ce=function(_0x1cf870,_0x5f172d){_0x1cf870=_0x1cf870-0x0;var _0x439018=_0x8ce3[_0x1cf870];return _0x439018;};'use strict';var EventEmitter=require(_0x38ce('0x0'));var ChatMessage=require(_0x38ce('0x1'))['db'][_0x38ce('0x2')];var ChatMessageEvents=new EventEmitter();ChatMessageEvents[_0x38ce('0x3')](0x0);var events={'afterCreate':_0x38ce('0x4'),'afterUpdate':_0x38ce('0x5'),'afterDestroy':_0x38ce('0x6')};function emitEvent(_0x44f729){return function(_0x54dc4e,_0x177eda,_0x2bee38){ChatMessageEvents['emit'](_0x44f729+':'+_0x54dc4e['id'],_0x54dc4e);ChatMessageEvents[_0x38ce('0x7')](_0x44f729,_0x54dc4e);_0x2bee38(null);};}for(var e in events){if(events[_0x38ce('0x8')](e)){var event=events[e];ChatMessage[_0x38ce('0x9')](e,emitEvent(event));}}module[_0x38ce('0xa')]=ChatMessageEvents; \ No newline at end of file diff --git a/server/api/chatMessage/chatMessage.model.js b/server/api/chatMessage/chatMessage.model.js index de1c799..1f9e1bc 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 _0x58d7=['models','get','toLowerCase','direction','isNil','UserId','ChatInteraction','ChatInteractionId','then','update','catch','error','utf8mb4_unicode_ci','util','../../config/logger','api','moment','request-promise','path','rimraf','../../config/environment','./chatMessage.attributes','exports','define','ChatMessage','chat_messages','body','FULLTEXT'];(function(_0x38aeea,_0x57522a){var _0x5e8d2c=function(_0xff08ce){while(--_0xff08ce){_0x38aeea['push'](_0x38aeea['shift']());}};_0x5e8d2c(++_0x57522a);}(_0x58d7,0xd1));var _0x758d=function(_0x2b505b,_0x27d646){_0x2b505b=_0x2b505b-0x0;var _0x17ce82=_0x58d7[_0x2b505b];return _0x17ce82;};'use strict';var _=require('lodash');var util=require(_0x758d('0x0'));var logger=require(_0x758d('0x1'))(_0x758d('0x2'));var moment=require(_0x758d('0x3'));var BPromise=require('bluebird');var rp=require(_0x758d('0x4'));var fs=require('fs');var path=require(_0x758d('0x5'));var rimraf=require(_0x758d('0x6'));var config=require(_0x758d('0x7'));var attributes=require(_0x758d('0x8'));module[_0x758d('0x9')]=function(_0x28b8e8,_0x4dc9ae){return _0x28b8e8[_0x758d('0xa')](_0x758d('0xb'),attributes,{'tableName':_0x758d('0xc'),'paranoid':![],'indexes':[{'name':'fti_chat_messages','fields':[_0x758d('0xd')],'type':_0x758d('0xe')}],'timestamps':!![],'hooks':{'afterCreate':function(_0x49f036,_0x3a2263,_0x5105a7){var _0x58a3ff=_0x28b8e8[_0x758d('0xf')];var _0x754ab7=_0x49f036[_0x758d('0x10')]({'plain':!![]});if(_0x754ab7['direction'][_0x758d('0x11')]()==='in'||_0x754ab7[_0x758d('0x12')]['toLowerCase']()==='out'&&!_0x754ab7['secret']&&!_[_0x758d('0x13')](_0x754ab7[_0x758d('0x14')])){_0x58a3ff[_0x758d('0x15')]['findOne']({'where':{'id':_0x754ab7[_0x758d('0x16')]}})[_0x758d('0x17')](function(_0x401ece){if(_0x401ece){_0x401ece[_0x758d('0x18')]({'lastMsgAt':_0x754ab7['createdAt'],'lastMsgDirection':_0x754ab7[_0x758d('0x12')]['toLowerCase']()});}})[_0x758d('0x19')](function(_0x5edc11){console[_0x758d('0x1a')](_0x5edc11);});}_0x5105a7();}},'charset':'utf8mb4','collate':_0x758d('0x1b')});}; \ No newline at end of file +var _0x6a93=['then','update','createdAt','catch','utf8mb4','utf8mb4_unicode_ci','lodash','util','../../config/logger','bluebird','request-promise','rimraf','../../config/environment','./chatMessage.attributes','exports','define','ChatMessage','chat_messages','fti_chat_messages','body','models','get','direction','toLowerCase','out','secret','isNil','UserId','ChatInteraction','findOne','ChatInteractionId'];(function(_0x3bf83f,_0x181cac){var _0x22c4a9=function(_0xb3ff0d){while(--_0xb3ff0d){_0x3bf83f['push'](_0x3bf83f['shift']());}};_0x22c4a9(++_0x181cac);}(_0x6a93,0x1d7));var _0x36a9=function(_0x54bb11,_0x286755){_0x54bb11=_0x54bb11-0x0;var _0x4943a8=_0x6a93[_0x54bb11];return _0x4943a8;};'use strict';var _=require(_0x36a9('0x0'));var util=require(_0x36a9('0x1'));var logger=require(_0x36a9('0x2'))('api');var moment=require('moment');var BPromise=require(_0x36a9('0x3'));var rp=require(_0x36a9('0x4'));var fs=require('fs');var path=require('path');var rimraf=require(_0x36a9('0x5'));var config=require(_0x36a9('0x6'));var attributes=require(_0x36a9('0x7'));module[_0x36a9('0x8')]=function(_0x2c1be3,_0x6de7d){return _0x2c1be3[_0x36a9('0x9')](_0x36a9('0xa'),attributes,{'tableName':_0x36a9('0xb'),'paranoid':![],'indexes':[{'name':_0x36a9('0xc'),'fields':[_0x36a9('0xd')],'type':'FULLTEXT'}],'timestamps':!![],'hooks':{'afterCreate':function(_0x36ee31,_0x2f2c63,_0x4abb01){var _0x4aaf2f=_0x2c1be3[_0x36a9('0xe')];var _0x116533=_0x36ee31[_0x36a9('0xf')]({'plain':!![]});if(_0x116533[_0x36a9('0x10')][_0x36a9('0x11')]()==='in'||_0x116533[_0x36a9('0x10')][_0x36a9('0x11')]()===_0x36a9('0x12')&&!_0x116533[_0x36a9('0x13')]&&!_[_0x36a9('0x14')](_0x116533[_0x36a9('0x15')])){_0x4aaf2f[_0x36a9('0x16')][_0x36a9('0x17')]({'where':{'id':_0x116533[_0x36a9('0x18')]}})[_0x36a9('0x19')](function(_0x4151d3){if(_0x4151d3){_0x4151d3[_0x36a9('0x1a')]({'lastMsgAt':_0x116533[_0x36a9('0x1b')],'lastMsgDirection':_0x116533[_0x36a9('0x10')]['toLowerCase']()});}})[_0x36a9('0x1c')](function(_0x5b3a39){console['error'](_0x5b3a39);});}_0x4abb01();}},'charset':_0x36a9('0x1d'),'collate':_0x36a9('0x1e')});}; \ No newline at end of file diff --git a/server/api/chatMessage/chatMessage.rpc.js b/server/api/chatMessage/chatMessage.rpc.js index f711637..f58fc42 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 _0xdca7=['request\x20sent','error','code','message','result','catch','ChatMessage','create','body','options','raw','CreateChatMessage','stringify','lodash','moment','bluebird','randomstring','../../mysqldb','../../config/utils','../../config/environment','redis','localhost','socket.io-emitter','./chatMessage.socket','register','request','then','info','ChatMessage,\x20%s,\x20%s','debug','ChatMessage,\x20%s,\x20%s,\x20%s'];(function(_0x266ddc,_0x45aa52){var _0x39c1d7=function(_0x4cd07c){while(--_0x4cd07c){_0x266ddc['push'](_0x266ddc['shift']());}};_0x39c1d7(++_0x45aa52);}(_0xdca7,0xe6));var _0x7dca=function(_0x1aba6c,_0x1b2103){_0x1aba6c=_0x1aba6c-0x0;var _0x48f16d=_0xdca7[_0x1aba6c];return _0x48f16d;};'use strict';var _=require(_0x7dca('0x0'));var util=require('util');var moment=require(_0x7dca('0x1'));var BPromise=require(_0x7dca('0x2'));var rs=require(_0x7dca('0x3'));var fs=require('fs');var Redis=require('ioredis');var db=require(_0x7dca('0x4'))['db'];var utils=require(_0x7dca('0x5'));var logger=require('../../config/logger')('rpc');var config=require(_0x7dca('0x6'));var jayson=require('jayson/promise');var client=jayson['client']['http']({'port':0x232a});config[_0x7dca('0x7')]=_['defaults'](config['redis'],{'host':_0x7dca('0x8'),'port':0x18eb});var socket=require(_0x7dca('0x9'))(new Redis(config[_0x7dca('0x7')]));require(_0x7dca('0xa'))[_0x7dca('0xb')](socket);function respondWithRpcPromise(_0x62f3b9,_0x26c1ad,_0x3c6ad7){return new BPromise(function(_0x32aad9,_0x3eeabf){return client[_0x7dca('0xc')](_0x62f3b9,_0x3c6ad7)[_0x7dca('0xd')](function(_0x50eaf6){logger[_0x7dca('0xe')](_0x7dca('0xf'),_0x26c1ad,'request\x20sent');logger[_0x7dca('0x10')](_0x7dca('0x11'),_0x26c1ad,_0x7dca('0x12'),JSON['stringify'](_0x50eaf6));if(_0x50eaf6['error']){if(_0x50eaf6[_0x7dca('0x13')][_0x7dca('0x14')]===0x1f4){logger[_0x7dca('0x13')](_0x7dca('0xf'),_0x26c1ad,_0x50eaf6[_0x7dca('0x13')][_0x7dca('0x15')]);return _0x3eeabf(_0x50eaf6[_0x7dca('0x13')][_0x7dca('0x15')]);}logger[_0x7dca('0x13')](_0x7dca('0xf'),_0x26c1ad,_0x50eaf6[_0x7dca('0x13')][_0x7dca('0x15')]);return _0x32aad9(_0x50eaf6[_0x7dca('0x13')][_0x7dca('0x15')]);}else{logger[_0x7dca('0xe')]('ChatMessage,\x20%s,\x20%s',_0x26c1ad,_0x7dca('0x12'));_0x32aad9(_0x50eaf6[_0x7dca('0x16')]['message']);}})[_0x7dca('0x17')](function(_0x53a146){logger['error'](_0x7dca('0xf'),_0x26c1ad,_0x53a146);_0x3eeabf(_0x53a146);});});}exports['CreateChatMessage']=function(_0x358236){var _0x2eca0f=this;return new Promise(function(_0x551f5a,_0x2b3b5f){return db[_0x7dca('0x18')][_0x7dca('0x19')](_0x358236[_0x7dca('0x1a')],{'raw':_0x358236[_0x7dca('0x1b')]?_0x358236[_0x7dca('0x1b')][_0x7dca('0x1c')]===undefined?!![]:![]:!![]})[_0x7dca('0xd')](function(_0x176bf9){logger[_0x7dca('0xe')](_0x7dca('0x1d'),_0x358236);logger[_0x7dca('0x10')](_0x7dca('0x1d'),_0x358236,JSON[_0x7dca('0x1e')](_0x176bf9));_0x551f5a(_0x176bf9);})[_0x7dca('0x17')](function(_0x1efd77){logger[_0x7dca('0x13')]('CreateChatMessage',_0x1efd77['message'],_0x358236);_0x2b3b5f(_0x2eca0f['error'](0x1f4,_0x1efd77[_0x7dca('0x15')]));});});}; \ No newline at end of file +var _0x8768=['request\x20sent','debug','ChatMessage,\x20%s,\x20%s,\x20%s','error','code','ChatMessage,\x20%s,\x20%s','message','result','CreateChatMessage','ChatMessage','create','body','options','stringify','catch','lodash','util','moment','bluebird','randomstring','ioredis','../../mysqldb','rpc','../../config/environment','jayson/promise','client','http','redis','defaults','localhost','socket.io-emitter','./chatMessage.socket','register','then','info'];(function(_0x278646,_0x25736a){var _0x1bba75=function(_0x5ca68a){while(--_0x5ca68a){_0x278646['push'](_0x278646['shift']());}};_0x1bba75(++_0x25736a);}(_0x8768,0x78));var _0x8876=function(_0x41d0a5,_0x7e9b19){_0x41d0a5=_0x41d0a5-0x0;var _0x343c10=_0x8768[_0x41d0a5];return _0x343c10;};'use strict';var _=require(_0x8876('0x0'));var util=require(_0x8876('0x1'));var moment=require(_0x8876('0x2'));var BPromise=require(_0x8876('0x3'));var rs=require(_0x8876('0x4'));var fs=require('fs');var Redis=require(_0x8876('0x5'));var db=require(_0x8876('0x6'))['db'];var utils=require('../../config/utils');var logger=require('../../config/logger')(_0x8876('0x7'));var config=require(_0x8876('0x8'));var jayson=require(_0x8876('0x9'));var client=jayson[_0x8876('0xa')][_0x8876('0xb')]({'port':0x232a});config[_0x8876('0xc')]=_[_0x8876('0xd')](config[_0x8876('0xc')],{'host':_0x8876('0xe'),'port':0x18eb});var socket=require(_0x8876('0xf'))(new Redis(config[_0x8876('0xc')]));require(_0x8876('0x10'))[_0x8876('0x11')](socket);function respondWithRpcPromise(_0x411c94,_0x532f12,_0x3b1f40){return new BPromise(function(_0x5ea32b,_0x1ed8cc){return client['request'](_0x411c94,_0x3b1f40)[_0x8876('0x12')](function(_0x3eaed1){logger[_0x8876('0x13')]('ChatMessage,\x20%s,\x20%s',_0x532f12,_0x8876('0x14'));logger[_0x8876('0x15')](_0x8876('0x16'),_0x532f12,_0x8876('0x14'),JSON['stringify'](_0x3eaed1));if(_0x3eaed1[_0x8876('0x17')]){if(_0x3eaed1[_0x8876('0x17')][_0x8876('0x18')]===0x1f4){logger[_0x8876('0x17')](_0x8876('0x19'),_0x532f12,_0x3eaed1['error'][_0x8876('0x1a')]);return _0x1ed8cc(_0x3eaed1[_0x8876('0x17')][_0x8876('0x1a')]);}logger[_0x8876('0x17')](_0x8876('0x19'),_0x532f12,_0x3eaed1['error'][_0x8876('0x1a')]);return _0x5ea32b(_0x3eaed1[_0x8876('0x17')]['message']);}else{logger['info'](_0x8876('0x19'),_0x532f12,_0x8876('0x14'));_0x5ea32b(_0x3eaed1[_0x8876('0x1b')][_0x8876('0x1a')]);}})['catch'](function(_0x21d4ff){logger[_0x8876('0x17')](_0x8876('0x19'),_0x532f12,_0x21d4ff);_0x1ed8cc(_0x21d4ff);});});}exports[_0x8876('0x1c')]=function(_0x4f94d0){var _0x2ae803=this;return new Promise(function(_0x18426d,_0x16297c){return db[_0x8876('0x1d')][_0x8876('0x1e')](_0x4f94d0[_0x8876('0x1f')],{'raw':_0x4f94d0[_0x8876('0x20')]?_0x4f94d0[_0x8876('0x20')]['raw']===undefined?!![]:![]:!![]})[_0x8876('0x12')](function(_0x1946cc){logger[_0x8876('0x13')](_0x8876('0x1c'),_0x4f94d0);logger[_0x8876('0x15')](_0x8876('0x1c'),_0x4f94d0,JSON[_0x8876('0x21')](_0x1946cc));_0x18426d(_0x1946cc);})[_0x8876('0x22')](function(_0x402375){logger[_0x8876('0x17')](_0x8876('0x1c'),_0x402375[_0x8876('0x1a')],_0x4f94d0);_0x16297c(_0x2ae803[_0x8876('0x17')](0x1f4,_0x402375['message']));});});}; \ No newline at end of file diff --git a/server/api/chatMessage/chatMessage.socket.js b/server/api/chatMessage/chatMessage.socket.js index 68e4b42..bf632b3 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 _0x032e=['removeListener','register','length','chatMessage:','./chatMessage.events','remove','update','emit'];(function(_0x282699,_0xd902ac){var _0xe2385b=function(_0x5ad655){while(--_0x5ad655){_0x282699['push'](_0x282699['shift']());}};_0xe2385b(++_0xd902ac);}(_0x032e,0x124));var _0xe032=function(_0x13ea00,_0x12f610){_0x13ea00=_0x13ea00-0x0;var _0x1f7347=_0x032e[_0x13ea00];return _0x1f7347;};'use strict';var ChatMessageEvents=require(_0xe032('0x0'));var events=['save',_0xe032('0x1'),_0xe032('0x2')];function createListener(_0x5ca562,_0x4afba2){return function(_0x45ab5b){_0x4afba2[_0xe032('0x3')](_0x5ca562,_0x45ab5b);};}function removeListener(_0x2f44f6,_0x1983cc){return function(){ChatMessageEvents[_0xe032('0x4')](_0x2f44f6,_0x1983cc);};}exports[_0xe032('0x5')]=function(_0x2ba8a0){for(var _0x33ad0b=0x0,_0x37432f=events[_0xe032('0x6')];_0x33ad0b<_0x37432f;_0x33ad0b++){var _0x3289b0=events[_0x33ad0b];var _0xd84027=createListener(_0xe032('0x7')+_0x3289b0,_0x2ba8a0);ChatMessageEvents['on'](_0x3289b0,_0xd84027);}}; \ No newline at end of file +var _0x1159=['removeListener','length','chatMessage:','./chatMessage.events','update','emit'];(function(_0x4887a4,_0x406cb1){var _0x844283=function(_0x124fdd){while(--_0x124fdd){_0x4887a4['push'](_0x4887a4['shift']());}};_0x844283(++_0x406cb1);}(_0x1159,0xf3));var _0x9115=function(_0x16ed08,_0x36ee7b){_0x16ed08=_0x16ed08-0x0;var _0x4e6fab=_0x1159[_0x16ed08];return _0x4e6fab;};'use strict';var ChatMessageEvents=require(_0x9115('0x0'));var events=['save','remove',_0x9115('0x1')];function createListener(_0x1bccec,_0x2ef135){return function(_0x24fa28){_0x2ef135[_0x9115('0x2')](_0x1bccec,_0x24fa28);};}function removeListener(_0x4661fc,_0xe754b3){return function(){ChatMessageEvents[_0x9115('0x3')](_0x4661fc,_0xe754b3);};}exports['register']=function(_0x4a23ba){for(var _0x3fd395=0x0,_0x22bf7f=events[_0x9115('0x4')];_0x3fd395<_0x22bf7f;_0x3fd395++){var _0x27b1ca=events[_0x3fd395];var _0x1f69c2=createListener(_0x9115('0x5')+_0x27b1ca,_0x4a23ba);ChatMessageEvents['on'](_0x27b1ca,_0x1f69c2);}}; \ No newline at end of file diff --git a/server/api/chatMessage/index.js b/server/api/chatMessage/index.js index 042d71a..fd3dd67 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 _0xb897=['/describe','isAuthenticated','describe','/:id','show','post','chat','chatmessage:create','put','update','/:id/accept','/:id/reject','reject','delete','exports','util','path','express','Router','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','./chatMessage.controller','get'];(function(_0x3b3e64,_0x1d12f7){var _0x3d1649=function(_0x2fc3a4){while(--_0x2fc3a4){_0x3b3e64['push'](_0x3b3e64['shift']());}};_0x3d1649(++_0x1d12f7);}(_0xb897,0xbe));var _0x7b89=function(_0x2763f2,_0x416af8){_0x2763f2=_0x2763f2-0x0;var _0x3ef471=_0xb897[_0x2763f2];return _0x3ef471;};'use strict';var multer=require('multer');var util=require(_0x7b89('0x0'));var path=require(_0x7b89('0x1'));var timeout=require('connect-timeout');var express=require(_0x7b89('0x2'));var router=express[_0x7b89('0x3')]();var fs_extra=require(_0x7b89('0x4'));var auth=require(_0x7b89('0x5'));var interaction=require(_0x7b89('0x6'));var config=require(_0x7b89('0x7'));var controller=require(_0x7b89('0x8'));router[_0x7b89('0x9')]('/',auth['isAuthenticated'](),controller['index']);router[_0x7b89('0x9')](_0x7b89('0xa'),auth[_0x7b89('0xb')](),controller[_0x7b89('0xc')]);router[_0x7b89('0x9')](_0x7b89('0xd'),auth[_0x7b89('0xb')](),controller[_0x7b89('0xe')]);router[_0x7b89('0xf')]('/',auth[_0x7b89('0xb')](),interaction['tracked'](_0x7b89('0x10'),_0x7b89('0x11')),controller['create']);router[_0x7b89('0x12')](_0x7b89('0xd'),controller[_0x7b89('0x13')]);router['put'](_0x7b89('0x14'),auth[_0x7b89('0xb')](),controller['accept']);router[_0x7b89('0x12')](_0x7b89('0x15'),auth[_0x7b89('0xb')](),controller[_0x7b89('0x16')]);router[_0x7b89('0x17')](_0x7b89('0xd'),auth['isAuthenticated'](),controller['destroy']);module[_0x7b89('0x18')]=router; \ No newline at end of file +var _0xde03=['reject','delete','exports','multer','path','connect-timeout','express','Router','fs-extra','../../components/auth/service','../../components/interaction/service','./chatMessage.controller','get','isAuthenticated','index','/describe','describe','/:id','post','tracked','create','put','update','/:id/accept','accept','/:id/reject'];(function(_0x3440e1,_0x2f8ada){var _0x778749=function(_0x1e8ea9){while(--_0x1e8ea9){_0x3440e1['push'](_0x3440e1['shift']());}};_0x778749(++_0x2f8ada);}(_0xde03,0x9f));var _0x3de0=function(_0x1ded40,_0x59e5e9){_0x1ded40=_0x1ded40-0x0;var _0xca8b17=_0xde03[_0x1ded40];return _0xca8b17;};'use strict';var multer=require(_0x3de0('0x0'));var util=require('util');var path=require(_0x3de0('0x1'));var timeout=require(_0x3de0('0x2'));var express=require(_0x3de0('0x3'));var router=express[_0x3de0('0x4')]();var fs_extra=require(_0x3de0('0x5'));var auth=require(_0x3de0('0x6'));var interaction=require(_0x3de0('0x7'));var config=require('../../config/environment');var controller=require(_0x3de0('0x8'));router[_0x3de0('0x9')]('/',auth[_0x3de0('0xa')](),controller[_0x3de0('0xb')]);router['get'](_0x3de0('0xc'),auth[_0x3de0('0xa')](),controller[_0x3de0('0xd')]);router[_0x3de0('0x9')](_0x3de0('0xe'),auth[_0x3de0('0xa')](),controller['show']);router[_0x3de0('0xf')]('/',auth[_0x3de0('0xa')](),interaction[_0x3de0('0x10')]('chat','chatmessage:create'),controller[_0x3de0('0x11')]);router[_0x3de0('0x12')](_0x3de0('0xe'),controller[_0x3de0('0x13')]);router[_0x3de0('0x12')](_0x3de0('0x14'),auth['isAuthenticated'](),controller[_0x3de0('0x15')]);router[_0x3de0('0x12')](_0x3de0('0x16'),auth[_0x3de0('0xa')](),controller[_0x3de0('0x17')]);router[_0x3de0('0x18')]('/:id',auth[_0x3de0('0xa')](),controller['destroy']);module[_0x3de0('0x19')]=router; \ No newline at end of file diff --git a/server/api/chatOfflineMessage/chatOfflineMessage.attributes.js b/server/api/chatOfflineMessage/chatOfflineMessage.attributes.js index 0af7d3a..7027d3b 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 _0xdb28=['TEXT','medium','sequelize','exports'];(function(_0x3fd979,_0x5656fa){var _0x3d6c85=function(_0x2b65c5){while(--_0x2b65c5){_0x3fd979['push'](_0x3fd979['shift']());}};_0x3d6c85(++_0x5656fa);}(_0xdb28,0x106));var _0x8db2=function(_0x1867ea,_0x428cfc){_0x1867ea=_0x1867ea-0x0;var _0x7c18dd=_0xdb28[_0x1867ea];return _0x7c18dd;};'use strict';var Sequelize=require(_0x8db2('0x0'));module[_0x8db2('0x1')]={'body':{'type':Sequelize[_0x8db2('0x2')](_0x8db2('0x3')),'allowNull':![]},'plainBody':{'type':Sequelize['TEXT'](_0x8db2('0x3')),'allowNull':![]}}; \ No newline at end of file +var _0x0b0e=['medium','sequelize','TEXT'];(function(_0x178e48,_0x3c9509){var _0x440d7e=function(_0xc2f8a0){while(--_0xc2f8a0){_0x178e48['push'](_0x178e48['shift']());}};_0x440d7e(++_0x3c9509);}(_0x0b0e,0x187));var _0xe0b0=function(_0x3de873,_0x174b5f){_0x3de873=_0x3de873-0x0;var _0x380b8c=_0x0b0e[_0x3de873];return _0x380b8c;};'use strict';var Sequelize=require(_0xe0b0('0x0'));module['exports']={'body':{'type':Sequelize[_0xe0b0('0x1')]('medium'),'allowNull':![]},'plainBody':{'type':Sequelize[_0xe0b0('0x1')](_0xe0b0('0x2')),'allowNull':![]}}; \ No newline at end of file diff --git a/server/api/chatOfflineMessage/chatOfflineMessage.controller.js b/server/api/chatOfflineMessage/chatOfflineMessage.controller.js index fe5a753..1808c52 100644 --- a/server/api/chatOfflineMessage/chatOfflineMessage.controller.js +++ b/server/api/chatOfflineMessage/chatOfflineMessage.controller.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x9957=['sendStatus','status','json','undefined','count','offset','limit','set','Content-Range','reject','save','then','destroy','error','name','send','index','fieldName','type','key','model','map','keys','filters','intersection','query','attributes','fields','length','hasOwnProperty','nolimit','sort','where','filter','merge','VIRTUAL','options','ChatOfflineMessage','findAll','rows','show','rawAttributes','includeAll','include','find','create','catch','body','params','Attachment','forEach','join','root','server','files','attachments','basename','existsSync','remove','describe','eml-format','rimraf','zip-dir','fast-json-patch','moment','bluebird','mustache','util','sox','to-csv','ejs','fs-extra','lodash','squel','jsforce','desk.js','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','api','../../config/utils','../../config/license/util','../../mysqldb'];(function(_0x1dacd9,_0x5117fb){var _0xdbf979=function(_0x888235){while(--_0x888235){_0x1dacd9['push'](_0x1dacd9['shift']());}};_0xdbf979(++_0x5117fb);}(_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['ChatOfflineMessage']['rawAttributes'],function(_0x3573be){return{'name':_0x3573be[_0x7995('0x2c')],'type':_0x3573be[_0x7995('0x2d')][_0x7995('0x2e')]};});_0x456a28[_0x7995('0x2f')]=_[_0x7995('0x30')](_0x4253e5,'name');_0x456a28['query']=_[_0x7995('0x31')](_0x4b6f99['query']);_0x456a28[_0x7995('0x32')]=_[_0x7995('0x33')](_0x456a28[_0x7995('0x2f')],_0x456a28[_0x7995('0x34')]);_0x514445[_0x7995('0x35')]=_['intersection'](_0x456a28[_0x7995('0x2f')],qs[_0x7995('0x36')](_0x4b6f99['query']['fields']));_0x514445['attributes']=_0x514445[_0x7995('0x35')][_0x7995('0x37')]?_0x514445['attributes']:_0x456a28[_0x7995('0x2f')];if(!_0x4b6f99['query'][_0x7995('0x38')](_0x7995('0x39'))){_0x514445[_0x7995('0x21')]=qs['limit'](_0x4b6f99['query'][_0x7995('0x21')]);_0x514445['offset']=qs['offset'](_0x4b6f99[_0x7995('0x34')][_0x7995('0x20')]);}_0x514445['order']=qs[_0x7995('0x3a')](_0x4b6f99[_0x7995('0x34')][_0x7995('0x3a')]);_0x514445[_0x7995('0x3b')]=qs[_0x7995('0x32')](_['pick'](_0x4b6f99[_0x7995('0x34')],_0x456a28[_0x7995('0x32')]),_0x4253e5);if(_0x4b6f99[_0x7995('0x34')][_0x7995('0x3c')]){_0x514445['where']=_[_0x7995('0x3d')](_0x514445[_0x7995('0x3b')],{'$or':_[_0x7995('0x30')](_0x4253e5,function(_0xe5ea43){if(_0xe5ea43[_0x7995('0x2d')]!==_0x7995('0x3e')){var _0x5688a1={};_0x5688a1[_0xe5ea43[_0x7995('0x29')]]={'$like':'%'+_0x4b6f99[_0x7995('0x34')][_0x7995('0x3c')]+'%'};return _0x5688a1;}})});}_0x514445=_[_0x7995('0x3d')]({},_0x514445,_0x4b6f99[_0x7995('0x3f')]);var _0x298fc2={'where':_0x514445[_0x7995('0x3b')]};return db[_0x7995('0x40')][_0x7995('0x1f')](_0x298fc2)[_0x7995('0x26')](function(_0x6fe77b){_0x3250e0[_0x7995('0x1f')]=_0x6fe77b;if(_0x4b6f99[_0x7995('0x34')]['includeAll']){_0x514445['include']=[{'all':!![]}];}return db[_0x7995('0x40')][_0x7995('0x41')](_0x514445);})['then'](function(_0x4b0855){_0x3250e0[_0x7995('0x42')]=_0x4b0855;return _0x3250e0;})['then'](respondWithFilteredResult(_0x9b2a15,_0x514445))['catch'](handleError(_0x9b2a15,null));};exports[_0x7995('0x43')]=function(_0x36e28b,_0x35c8ff){var _0x576b96={'raw':!![],'where':{'id':_0x36e28b['params']['id']}},_0x46ac4f={};_0x46ac4f[_0x7995('0x2f')]=_['keys'](db['ChatOfflineMessage'][_0x7995('0x44')]);_0x46ac4f[_0x7995('0x34')]=_[_0x7995('0x31')](_0x36e28b[_0x7995('0x34')]);_0x46ac4f['filters']=_[_0x7995('0x33')](_0x46ac4f[_0x7995('0x2f')],_0x46ac4f[_0x7995('0x34')]);_0x576b96[_0x7995('0x35')]=_['intersection'](_0x46ac4f['model'],qs[_0x7995('0x36')](_0x36e28b['query'][_0x7995('0x36')]));_0x576b96['attributes']=_0x576b96[_0x7995('0x35')]['length']?_0x576b96[_0x7995('0x35')]:_0x46ac4f[_0x7995('0x2f')];if(_0x36e28b['query'][_0x7995('0x45')]){_0x576b96[_0x7995('0x46')]=[{'all':!![]}];}_0x576b96=_[_0x7995('0x3d')]({},_0x576b96,_0x36e28b[_0x7995('0x3f')]);return db['ChatOfflineMessage'][_0x7995('0x47')](_0x576b96)[_0x7995('0x26')](handleEntityNotFound(_0x35c8ff,null))[_0x7995('0x26')](respondWithResult(_0x35c8ff,null))['catch'](handleError(_0x35c8ff,null));};exports[_0x7995('0x48')]=function(_0x44f516,_0x511567){return db[_0x7995('0x40')][_0x7995('0x48')](_0x44f516['body'],{})[_0x7995('0x26')](respondWithResult(_0x511567,0xc9))[_0x7995('0x49')](handleError(_0x511567,null));};exports['update']=function(_0x3d1dbb,_0x5843ba){if(_0x3d1dbb[_0x7995('0x4a')]['id']){delete _0x3d1dbb[_0x7995('0x4a')]['id'];}return db[_0x7995('0x40')][_0x7995('0x47')]({'where':{'id':_0x3d1dbb[_0x7995('0x4b')]['id']}})[_0x7995('0x26')](handleEntityNotFound(_0x5843ba,null))[_0x7995('0x26')](saveUpdates(_0x3d1dbb['body'],null))[_0x7995('0x26')](respondWithResult(_0x5843ba,null))[_0x7995('0x49')](handleError(_0x5843ba,null));};exports[_0x7995('0x27')]=function(_0x4ffc8a,_0x19da63){return db[_0x7995('0x4c')][_0x7995('0x41')]({'where':{'ChatOfflineMessageId':_0x4ffc8a['params']['id']},'raw':!![]})['then'](function(_0x5a592e){_0x5a592e[_0x7995('0x4d')](function(_0x1fd1ca){var _0x4cf5db=path[_0x7995('0x4e')](config[_0x7995('0x4f')],_0x7995('0x50'),_0x7995('0x51'),_0x7995('0x52'),'offline-chat',_0x1fd1ca[_0x7995('0x53')]);var _0x4ab09f=fs[_0x7995('0x54')](_0x4cf5db);if(_0x4ab09f)fs_extra[_0x7995('0x55')](_0x4cf5db);});})[_0x7995('0x26')](function(){return db['ChatOfflineMessage']['find']({'where':{'id':_0x4ffc8a['params']['id']},'individualHooks':!![]});})['then'](handleEntityNotFound(_0x19da63,null))[_0x7995('0x26')](removeEntity(_0x19da63,null))[_0x7995('0x49')](handleError(_0x19da63,null));};exports[_0x7995('0x56')]=function(_0x150261,_0x1d957e){return db[_0x7995('0x40')][_0x7995('0x56')]()[_0x7995('0x26')](respondWithResult(_0x1d957e,null))[_0x7995('0x49')](handleError(_0x1d957e,null));}; \ No newline at end of file +var _0x9957=['sendStatus','status','json','undefined','count','offset','limit','set','Content-Range','reject','save','then','destroy','error','name','send','index','fieldName','type','key','model','map','keys','filters','intersection','query','attributes','fields','length','hasOwnProperty','nolimit','sort','where','filter','merge','VIRTUAL','options','ChatOfflineMessage','findAll','rows','show','rawAttributes','includeAll','include','find','create','catch','body','params','Attachment','forEach','join','root','server','files','attachments','basename','existsSync','remove','describe','eml-format','rimraf','zip-dir','fast-json-patch','moment','bluebird','mustache','util','sox','to-csv','ejs','fs-extra','lodash','squel','jsforce','desk.js','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','api','../../config/utils','../../config/license/util','../../mysqldb'];(function(_0x4f6231,_0x2061d1){var _0x3f5c1c=function(_0xe44a21){while(--_0xe44a21){_0x4f6231['push'](_0x4f6231['shift']());}};_0x3f5c1c(++_0x2061d1);}(_0x9957,0x93));var _0x7995=function(_0x1facfa,_0x1acf7d){_0x1facfa=_0x1facfa-0x0;var _0x9ec701=_0x9957[_0x1facfa];return _0x9ec701;};'use strict';var emlformat=require(_0x7995('0x0'));var rimraf=require(_0x7995('0x1'));var zipdir=require(_0x7995('0x2'));var jsonpatch=require(_0x7995('0x3'));var rp=require('request-promise');var moment=require(_0x7995('0x4'));var BPromise=require(_0x7995('0x5'));var Mustache=require(_0x7995('0x6'));var util=require(_0x7995('0x7'));var path=require('path');var sox=require(_0x7995('0x8'));var csv=require(_0x7995('0x9'));var ejs=require(_0x7995('0xa'));var fs=require('fs');var fs_extra=require(_0x7995('0xb'));var _=require(_0x7995('0xc'));var squel=require(_0x7995('0xd'));var crypto=require('crypto');var jsforce=require(_0x7995('0xe'));var deskjs=require(_0x7995('0xf'));var toCsv=require('to-csv');var querystring=require(_0x7995('0x10'));var Papa=require(_0x7995('0x11'));var Redis=require(_0x7995('0x12'));var authService=require(_0x7995('0x13'));var qs=require(_0x7995('0x14'));var as=require(_0x7995('0x15'));var hardwareService=require(_0x7995('0x16'));var logger=require('../../config/logger')(_0x7995('0x17'));var utils=require(_0x7995('0x18'));var config=require('../../config/environment');var licenseUtil=require(_0x7995('0x19'));var db=require(_0x7995('0x1a'))['db'];function respondWithStatusCode(_0x19a27e,_0x385f00){_0x385f00=_0x385f00||0xcc;return function(_0x281576){if(_0x281576){return _0x19a27e[_0x7995('0x1b')](_0x385f00);}return _0x19a27e[_0x7995('0x1c')](_0x385f00)['end']();};}function respondWithResult(_0x58f5ad,_0x2b4e94){_0x2b4e94=_0x2b4e94||0xc8;return function(_0x2233dd){if(_0x2233dd){return _0x58f5ad[_0x7995('0x1c')](_0x2b4e94)[_0x7995('0x1d')](_0x2233dd);}};}function respondWithFilteredResult(_0x3f1d3e,_0x1a5310){return function(_0x2202ce){if(_0x2202ce){var _0x41cbf0=typeof _0x1a5310['offset']===_0x7995('0x1e')&&typeof _0x1a5310['limit']===_0x7995('0x1e');var _0x37f297=_0x2202ce[_0x7995('0x1f')];var _0x291317=_0x41cbf0?0x0:_0x1a5310[_0x7995('0x20')];var _0x37a7d4=_0x41cbf0?_0x2202ce['count']:_0x1a5310['offset']+_0x1a5310[_0x7995('0x21')];var _0x5e6f90;if(_0x37a7d4>=_0x37f297){_0x37a7d4=_0x37f297;_0x5e6f90=0xc8;}else{_0x5e6f90=0xce;}_0x3f1d3e['status'](_0x5e6f90);return _0x3f1d3e[_0x7995('0x22')](_0x7995('0x23'),_0x291317+'-'+_0x37a7d4+'/'+_0x37f297)['json'](_0x2202ce);}return null;};}function patchUpdates(_0x3a9b54){return function(_0x51f276){try{jsonpatch['apply'](_0x51f276,_0x3a9b54,!![]);}catch(_0x3e4c54){return BPromise[_0x7995('0x24')](_0x3e4c54);}return _0x51f276[_0x7995('0x25')]();};}function saveUpdates(_0x1a8568,_0x460924){return function(_0x1c278a){if(_0x1c278a){return _0x1c278a['update'](_0x1a8568)[_0x7995('0x26')](function(_0x46ee4b){return _0x46ee4b;});}return null;};}function removeEntity(_0x204507,_0x285437){return function(_0x563799){if(_0x563799){return _0x563799[_0x7995('0x27')]()[_0x7995('0x26')](function(){_0x204507[_0x7995('0x1c')](0xcc)['end']();});}};}function handleEntityNotFound(_0x39df42,_0x34e70c){return function(_0x401dc3){if(!_0x401dc3){_0x39df42[_0x7995('0x1b')](0x194);}return _0x401dc3;};}function handleError(_0x3a3fcf,_0x2a307e){_0x2a307e=_0x2a307e||0x1f4;return function(_0x56691a){logger[_0x7995('0x28')](_0x56691a['stack']);if(_0x56691a[_0x7995('0x29')]){delete _0x56691a[_0x7995('0x29')];}_0x3a3fcf[_0x7995('0x1c')](_0x2a307e)[_0x7995('0x2a')](_0x56691a);};}exports[_0x7995('0x2b')]=function(_0x4b6f99,_0x9b2a15){var _0x514445={},_0x456a28={},_0x3250e0={'count':0x0,'rows':[]};var _0x4253e5=_['map'](db['ChatOfflineMessage']['rawAttributes'],function(_0x3573be){return{'name':_0x3573be[_0x7995('0x2c')],'type':_0x3573be[_0x7995('0x2d')][_0x7995('0x2e')]};});_0x456a28[_0x7995('0x2f')]=_[_0x7995('0x30')](_0x4253e5,'name');_0x456a28['query']=_[_0x7995('0x31')](_0x4b6f99['query']);_0x456a28[_0x7995('0x32')]=_[_0x7995('0x33')](_0x456a28[_0x7995('0x2f')],_0x456a28[_0x7995('0x34')]);_0x514445[_0x7995('0x35')]=_['intersection'](_0x456a28[_0x7995('0x2f')],qs[_0x7995('0x36')](_0x4b6f99['query']['fields']));_0x514445['attributes']=_0x514445[_0x7995('0x35')][_0x7995('0x37')]?_0x514445['attributes']:_0x456a28[_0x7995('0x2f')];if(!_0x4b6f99['query'][_0x7995('0x38')](_0x7995('0x39'))){_0x514445[_0x7995('0x21')]=qs['limit'](_0x4b6f99['query'][_0x7995('0x21')]);_0x514445['offset']=qs['offset'](_0x4b6f99[_0x7995('0x34')][_0x7995('0x20')]);}_0x514445['order']=qs[_0x7995('0x3a')](_0x4b6f99[_0x7995('0x34')][_0x7995('0x3a')]);_0x514445[_0x7995('0x3b')]=qs[_0x7995('0x32')](_['pick'](_0x4b6f99[_0x7995('0x34')],_0x456a28[_0x7995('0x32')]),_0x4253e5);if(_0x4b6f99[_0x7995('0x34')][_0x7995('0x3c')]){_0x514445['where']=_[_0x7995('0x3d')](_0x514445[_0x7995('0x3b')],{'$or':_[_0x7995('0x30')](_0x4253e5,function(_0xe5ea43){if(_0xe5ea43[_0x7995('0x2d')]!==_0x7995('0x3e')){var _0x5688a1={};_0x5688a1[_0xe5ea43[_0x7995('0x29')]]={'$like':'%'+_0x4b6f99[_0x7995('0x34')][_0x7995('0x3c')]+'%'};return _0x5688a1;}})});}_0x514445=_[_0x7995('0x3d')]({},_0x514445,_0x4b6f99[_0x7995('0x3f')]);var _0x298fc2={'where':_0x514445[_0x7995('0x3b')]};return db[_0x7995('0x40')][_0x7995('0x1f')](_0x298fc2)[_0x7995('0x26')](function(_0x6fe77b){_0x3250e0[_0x7995('0x1f')]=_0x6fe77b;if(_0x4b6f99[_0x7995('0x34')]['includeAll']){_0x514445['include']=[{'all':!![]}];}return db[_0x7995('0x40')][_0x7995('0x41')](_0x514445);})['then'](function(_0x4b0855){_0x3250e0[_0x7995('0x42')]=_0x4b0855;return _0x3250e0;})['then'](respondWithFilteredResult(_0x9b2a15,_0x514445))['catch'](handleError(_0x9b2a15,null));};exports[_0x7995('0x43')]=function(_0x36e28b,_0x35c8ff){var _0x576b96={'raw':!![],'where':{'id':_0x36e28b['params']['id']}},_0x46ac4f={};_0x46ac4f[_0x7995('0x2f')]=_['keys'](db['ChatOfflineMessage'][_0x7995('0x44')]);_0x46ac4f[_0x7995('0x34')]=_[_0x7995('0x31')](_0x36e28b[_0x7995('0x34')]);_0x46ac4f['filters']=_[_0x7995('0x33')](_0x46ac4f[_0x7995('0x2f')],_0x46ac4f[_0x7995('0x34')]);_0x576b96[_0x7995('0x35')]=_['intersection'](_0x46ac4f['model'],qs[_0x7995('0x36')](_0x36e28b['query'][_0x7995('0x36')]));_0x576b96['attributes']=_0x576b96[_0x7995('0x35')]['length']?_0x576b96[_0x7995('0x35')]:_0x46ac4f[_0x7995('0x2f')];if(_0x36e28b['query'][_0x7995('0x45')]){_0x576b96[_0x7995('0x46')]=[{'all':!![]}];}_0x576b96=_[_0x7995('0x3d')]({},_0x576b96,_0x36e28b[_0x7995('0x3f')]);return db['ChatOfflineMessage'][_0x7995('0x47')](_0x576b96)[_0x7995('0x26')](handleEntityNotFound(_0x35c8ff,null))[_0x7995('0x26')](respondWithResult(_0x35c8ff,null))['catch'](handleError(_0x35c8ff,null));};exports[_0x7995('0x48')]=function(_0x44f516,_0x511567){return db[_0x7995('0x40')][_0x7995('0x48')](_0x44f516['body'],{})[_0x7995('0x26')](respondWithResult(_0x511567,0xc9))[_0x7995('0x49')](handleError(_0x511567,null));};exports['update']=function(_0x3d1dbb,_0x5843ba){if(_0x3d1dbb[_0x7995('0x4a')]['id']){delete _0x3d1dbb[_0x7995('0x4a')]['id'];}return db[_0x7995('0x40')][_0x7995('0x47')]({'where':{'id':_0x3d1dbb[_0x7995('0x4b')]['id']}})[_0x7995('0x26')](handleEntityNotFound(_0x5843ba,null))[_0x7995('0x26')](saveUpdates(_0x3d1dbb['body'],null))[_0x7995('0x26')](respondWithResult(_0x5843ba,null))[_0x7995('0x49')](handleError(_0x5843ba,null));};exports[_0x7995('0x27')]=function(_0x4ffc8a,_0x19da63){return db[_0x7995('0x4c')][_0x7995('0x41')]({'where':{'ChatOfflineMessageId':_0x4ffc8a['params']['id']},'raw':!![]})['then'](function(_0x5a592e){_0x5a592e[_0x7995('0x4d')](function(_0x1fd1ca){var _0x4cf5db=path[_0x7995('0x4e')](config[_0x7995('0x4f')],_0x7995('0x50'),_0x7995('0x51'),_0x7995('0x52'),'offline-chat',_0x1fd1ca[_0x7995('0x53')]);var _0x4ab09f=fs[_0x7995('0x54')](_0x4cf5db);if(_0x4ab09f)fs_extra[_0x7995('0x55')](_0x4cf5db);});})[_0x7995('0x26')](function(){return db['ChatOfflineMessage']['find']({'where':{'id':_0x4ffc8a['params']['id']},'individualHooks':!![]});})['then'](handleEntityNotFound(_0x19da63,null))[_0x7995('0x26')](removeEntity(_0x19da63,null))[_0x7995('0x49')](handleError(_0x19da63,null));};exports[_0x7995('0x56')]=function(_0x150261,_0x1d957e){return db[_0x7995('0x40')][_0x7995('0x56')]()[_0x7995('0x26')](respondWithResult(_0x1d957e,null))[_0x7995('0x49')](handleError(_0x1d957e,null));}; \ No newline at end of file diff --git a/server/api/chatOfflineMessage/chatOfflineMessage.events.js b/server/api/chatOfflineMessage/chatOfflineMessage.events.js index 75ed6dd..7a5f12d 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 _0xfca0=['update','remove','emit','hasOwnProperty','hook','exports','events','../../mysqldb','ChatOfflineMessage','setMaxListeners','save'];(function(_0x1e4360,_0x930b9b){var _0x31e6b4=function(_0x49dd8e){while(--_0x49dd8e){_0x1e4360['push'](_0x1e4360['shift']());}};_0x31e6b4(++_0x930b9b);}(_0xfca0,0x171));var _0x0fca=function(_0x215cd2,_0x51991d){_0x215cd2=_0x215cd2-0x0;var _0x594ea3=_0xfca0[_0x215cd2];return _0x594ea3;};'use strict';var EventEmitter=require(_0x0fca('0x0'));var ChatOfflineMessage=require(_0x0fca('0x1'))['db'][_0x0fca('0x2')];var ChatOfflineMessageEvents=new EventEmitter();ChatOfflineMessageEvents[_0x0fca('0x3')](0x0);var events={'afterCreate':_0x0fca('0x4'),'afterUpdate':_0x0fca('0x5'),'afterDestroy':_0x0fca('0x6')};function emitEvent(_0x214c33){return function(_0x52cfba,_0x226056,_0xb474bc){ChatOfflineMessageEvents[_0x0fca('0x7')](_0x214c33+':'+_0x52cfba['id'],_0x52cfba);ChatOfflineMessageEvents[_0x0fca('0x7')](_0x214c33,_0x52cfba);_0xb474bc(null);};}for(var e in events){if(events[_0x0fca('0x8')](e)){var event=events[e];ChatOfflineMessage[_0x0fca('0x9')](e,emitEvent(event));}}module[_0x0fca('0xa')]=ChatOfflineMessageEvents; \ No newline at end of file +var _0xf15b=['emit','events','ChatOfflineMessage','setMaxListeners','save','update','remove'];(function(_0x4db03a,_0x259e90){var _0x5a797a=function(_0x1fc5b7){while(--_0x1fc5b7){_0x4db03a['push'](_0x4db03a['shift']());}};_0x5a797a(++_0x259e90);}(_0xf15b,0x7f));var _0xbf15=function(_0x840eed,_0x238584){_0x840eed=_0x840eed-0x0;var _0x4688e0=_0xf15b[_0x840eed];return _0x4688e0;};'use strict';var EventEmitter=require(_0xbf15('0x0'));var ChatOfflineMessage=require('../../mysqldb')['db'][_0xbf15('0x1')];var ChatOfflineMessageEvents=new EventEmitter();ChatOfflineMessageEvents[_0xbf15('0x2')](0x0);var events={'afterCreate':_0xbf15('0x3'),'afterUpdate':_0xbf15('0x4'),'afterDestroy':_0xbf15('0x5')};function emitEvent(_0x25f51c){return function(_0x2f3542,_0x105221,_0xeb8a3d){ChatOfflineMessageEvents[_0xbf15('0x6')](_0x25f51c+':'+_0x2f3542['id'],_0x2f3542);ChatOfflineMessageEvents['emit'](_0x25f51c,_0x2f3542);_0xeb8a3d(null);};}for(var e in events){if(events['hasOwnProperty'](e)){var event=events[e];ChatOfflineMessage['hook'](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 41e7e90..391323d 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 _0x0733=['utf8mb4','exports','define'];(function(_0x459240,_0x4c7c29){var _0x2b9388=function(_0x3706a5){while(--_0x3706a5){_0x459240['push'](_0x459240['shift']());}};_0x2b9388(++_0x4c7c29);}(_0x0733,0x85));var _0x3073=function(_0x36f1d9,_0x15370f){_0x36f1d9=_0x36f1d9-0x0;var _0x55d945=_0x0733[_0x36f1d9];return _0x55d945;};'use strict';var attributes=require('./chatOfflineMessage.attributes');module[_0x3073('0x0')]=function(_0x7d8c64){return _0x7d8c64[_0x3073('0x1')]('ChatOfflineMessage',attributes,{'tableName':'chat_offline_messages','paranoid':![],'indexes':[],'timestamps':!![],'charset':_0x3073('0x2'),'collate':'utf8mb4_unicode_ci'});}; \ No newline at end of file +var _0xd880=['./chatOfflineMessage.attributes','define','utf8mb4'];(function(_0x2f310d,_0x59b15a){var _0x279c57=function(_0xcde3ab){while(--_0xcde3ab){_0x2f310d['push'](_0x2f310d['shift']());}};_0x279c57(++_0x59b15a);}(_0xd880,0x96));var _0x0d88=function(_0x4fc27d,_0x2235d8){_0x4fc27d=_0x4fc27d-0x0;var _0x62e5b6=_0xd880[_0x4fc27d];return _0x62e5b6;};'use strict';var attributes=require(_0x0d88('0x0'));module['exports']=function(_0x166da7){return _0x166da7[_0x0d88('0x1')]('ChatOfflineMessage',attributes,{'tableName':'chat_offline_messages','paranoid':![],'indexes':[],'timestamps':!![],'charset':_0x0d88('0x2'),'collate':'utf8mb4_unicode_ci'});}; \ No newline at end of file diff --git a/server/api/chatOfflineMessage/chatOfflineMessage.rpc.js b/server/api/chatOfflineMessage/chatOfflineMessage.rpc.js index 4ff18a5..c1c52a8 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 _0x462b=['http','request','then','info','ChatOfflineMessage,\x20%s,\x20%s','ChatOfflineMessage,\x20%s,\x20%s,\x20%s','stringify','error','code','message','request\x20sent','catch','lodash','util','moment','bluebird','ioredis','../../mysqldb','../../config/utils','rpc','jayson/promise','client'];(function(_0x1bf0b4,_0x4d7375){var _0x42fd7e=function(_0x31a928){while(--_0x31a928){_0x1bf0b4['push'](_0x1bf0b4['shift']());}};_0x42fd7e(++_0x4d7375);}(_0x462b,0x1da));var _0xb462=function(_0x122ef9,_0x451d2a){_0x122ef9=_0x122ef9-0x0;var _0x42fba0=_0x462b[_0x122ef9];return _0x42fba0;};'use strict';var _=require(_0xb462('0x0'));var util=require(_0xb462('0x1'));var moment=require(_0xb462('0x2'));var BPromise=require(_0xb462('0x3'));var rs=require('randomstring');var fs=require('fs');var Redis=require(_0xb462('0x4'));var db=require(_0xb462('0x5'))['db'];var utils=require(_0xb462('0x6'));var logger=require('../../config/logger')(_0xb462('0x7'));var config=require('../../config/environment');var jayson=require(_0xb462('0x8'));var client=jayson[_0xb462('0x9')][_0xb462('0xa')]({'port':0x232a});function respondWithRpcPromise(_0x30182d,_0x3cb604,_0x3e3d79){return new BPromise(function(_0x55e33b,_0x7389de){return client[_0xb462('0xb')](_0x30182d,_0x3e3d79)[_0xb462('0xc')](function(_0x28185c){logger[_0xb462('0xd')](_0xb462('0xe'),_0x3cb604,'request\x20sent');logger['debug'](_0xb462('0xf'),_0x3cb604,'request\x20sent',JSON[_0xb462('0x10')](_0x28185c));if(_0x28185c[_0xb462('0x11')]){if(_0x28185c[_0xb462('0x11')][_0xb462('0x12')]===0x1f4){logger[_0xb462('0x11')](_0xb462('0xe'),_0x3cb604,_0x28185c[_0xb462('0x11')][_0xb462('0x13')]);return _0x7389de(_0x28185c[_0xb462('0x11')][_0xb462('0x13')]);}logger['error'](_0xb462('0xe'),_0x3cb604,_0x28185c[_0xb462('0x11')][_0xb462('0x13')]);return _0x55e33b(_0x28185c[_0xb462('0x11')]['message']);}else{logger[_0xb462('0xd')](_0xb462('0xe'),_0x3cb604,_0xb462('0x14'));_0x55e33b(_0x28185c['result'][_0xb462('0x13')]);}})[_0xb462('0x15')](function(_0x3b3909){logger[_0xb462('0x11')](_0xb462('0xe'),_0x3cb604,_0x3b3909);_0x7389de(_0x3b3909);});});} \ No newline at end of file +var _0x442e=['jayson/promise','client','http','then','info','ChatOfflineMessage,\x20%s,\x20%s','request\x20sent','stringify','error','code','message','result','catch','util','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','../../config/environment'];(function(_0x369534,_0x5557c4){var _0x524bf9=function(_0x24c6fb){while(--_0x24c6fb){_0x369534['push'](_0x369534['shift']());}};_0x524bf9(++_0x5557c4);}(_0x442e,0x133));var _0xe442=function(_0x20b57d,_0x8f9620){_0x20b57d=_0x20b57d-0x0;var _0x544d73=_0x442e[_0x20b57d];return _0x544d73;};'use strict';var _=require('lodash');var util=require(_0xe442('0x0'));var moment=require('moment');var BPromise=require(_0xe442('0x1'));var rs=require(_0xe442('0x2'));var fs=require('fs');var Redis=require(_0xe442('0x3'));var db=require(_0xe442('0x4'))['db'];var utils=require(_0xe442('0x5'));var logger=require(_0xe442('0x6'))('rpc');var config=require(_0xe442('0x7'));var jayson=require(_0xe442('0x8'));var client=jayson[_0xe442('0x9')][_0xe442('0xa')]({'port':0x232a});function respondWithRpcPromise(_0x5acdaa,_0x51dea1,_0x1ad204){return new BPromise(function(_0x4d3f52,_0x23ac63){return client['request'](_0x5acdaa,_0x1ad204)[_0xe442('0xb')](function(_0x4a16a0){logger[_0xe442('0xc')](_0xe442('0xd'),_0x51dea1,_0xe442('0xe'));logger['debug']('ChatOfflineMessage,\x20%s,\x20%s,\x20%s',_0x51dea1,_0xe442('0xe'),JSON[_0xe442('0xf')](_0x4a16a0));if(_0x4a16a0[_0xe442('0x10')]){if(_0x4a16a0[_0xe442('0x10')][_0xe442('0x11')]===0x1f4){logger['error'](_0xe442('0xd'),_0x51dea1,_0x4a16a0[_0xe442('0x10')][_0xe442('0x12')]);return _0x23ac63(_0x4a16a0[_0xe442('0x10')][_0xe442('0x12')]);}logger[_0xe442('0x10')]('ChatOfflineMessage,\x20%s,\x20%s',_0x51dea1,_0x4a16a0[_0xe442('0x10')][_0xe442('0x12')]);return _0x4d3f52(_0x4a16a0[_0xe442('0x10')][_0xe442('0x12')]);}else{logger[_0xe442('0xc')]('ChatOfflineMessage,\x20%s,\x20%s',_0x51dea1,'request\x20sent');_0x4d3f52(_0x4a16a0[_0xe442('0x13')]['message']);}})[_0xe442('0x14')](function(_0x242417){logger[_0xe442('0x10')]('ChatOfflineMessage,\x20%s,\x20%s',_0x51dea1,_0x242417);_0x23ac63(_0x242417);});});} \ No newline at end of file diff --git a/server/api/chatOfflineMessage/index.js b/server/api/chatOfflineMessage/index.js index b77931a..53b2df5 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 _0xfaa6=['isAuthenticated','describe','post','create','put','/:id','update','delete','destroy','exports','multer','util','path','connect-timeout','express','fs-extra','../../components/interaction/service','../../config/environment','./chatOfflineMessage.controller','get','index','/describe'];(function(_0x595ece,_0x422999){var _0x534795=function(_0x5e14fe){while(--_0x5e14fe){_0x595ece['push'](_0x595ece['shift']());}};_0x534795(++_0x422999);}(_0xfaa6,0x1d8));var _0x6faa=function(_0x3070dc,_0x40cf11){_0x3070dc=_0x3070dc-0x0;var _0x431489=_0xfaa6[_0x3070dc];return _0x431489;};'use strict';var multer=require(_0x6faa('0x0'));var util=require(_0x6faa('0x1'));var path=require(_0x6faa('0x2'));var timeout=require(_0x6faa('0x3'));var express=require(_0x6faa('0x4'));var router=express['Router']();var fs_extra=require(_0x6faa('0x5'));var auth=require('../../components/auth/service');var interaction=require(_0x6faa('0x6'));var config=require(_0x6faa('0x7'));var controller=require(_0x6faa('0x8'));router[_0x6faa('0x9')]('/',auth['isAuthenticated'](),controller[_0x6faa('0xa')]);router[_0x6faa('0x9')](_0x6faa('0xb'),auth[_0x6faa('0xc')](),controller[_0x6faa('0xd')]);router['get']('/:id',auth[_0x6faa('0xc')](),controller['show']);router[_0x6faa('0xe')]('/',auth[_0x6faa('0xc')](),controller[_0x6faa('0xf')]);router[_0x6faa('0x10')](_0x6faa('0x11'),auth[_0x6faa('0xc')](),controller[_0x6faa('0x12')]);router[_0x6faa('0x13')](_0x6faa('0x11'),auth['isAuthenticated'](),controller[_0x6faa('0x14')]);module[_0x6faa('0x15')]=router; \ No newline at end of file +var _0x4f04=['fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','isAuthenticated','index','get','describe','/:id','show','create','put','update','delete','exports','multer','util','path','connect-timeout','Router'];(function(_0x3456a4,_0x23e94c){var _0x5d8c0b=function(_0x23446b){while(--_0x23446b){_0x3456a4['push'](_0x3456a4['shift']());}};_0x5d8c0b(++_0x23e94c);}(_0x4f04,0xff));var _0x44f0=function(_0x3c6cc2,_0x5e7a2f){_0x3c6cc2=_0x3c6cc2-0x0;var _0x53762a=_0x4f04[_0x3c6cc2];return _0x53762a;};'use strict';var multer=require(_0x44f0('0x0'));var util=require(_0x44f0('0x1'));var path=require(_0x44f0('0x2'));var timeout=require(_0x44f0('0x3'));var express=require('express');var router=express[_0x44f0('0x4')]();var fs_extra=require(_0x44f0('0x5'));var auth=require(_0x44f0('0x6'));var interaction=require(_0x44f0('0x7'));var config=require(_0x44f0('0x8'));var controller=require('./chatOfflineMessage.controller');router['get']('/',auth[_0x44f0('0x9')](),controller[_0x44f0('0xa')]);router[_0x44f0('0xb')]('/describe',auth[_0x44f0('0x9')](),controller[_0x44f0('0xc')]);router['get'](_0x44f0('0xd'),auth[_0x44f0('0x9')](),controller[_0x44f0('0xe')]);router['post']('/',auth[_0x44f0('0x9')](),controller[_0x44f0('0xf')]);router[_0x44f0('0x10')](_0x44f0('0xd'),auth[_0x44f0('0x9')](),controller[_0x44f0('0x11')]);router[_0x44f0('0x12')](_0x44f0('0xd'),auth[_0x44f0('0x9')](),controller['destroy']);module[_0x44f0('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 d4d912a..46f7536 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 _0xf9da=['mouseOver','sequelize','exports','STRING','ENUM','timeout'];(function(_0x47b4f7,_0x5e1df1){var _0x224508=function(_0x1ed3ac){while(--_0x1ed3ac){_0x47b4f7['push'](_0x47b4f7['shift']());}};_0x224508(++_0x5e1df1);}(_0xf9da,0x19f));var _0xaf9d=function(_0x559809,_0x4fd9b5){_0x559809=_0x559809-0x0;var _0x4b3651=_0xf9da[_0x559809];return _0x4b3651;};'use strict';var Sequelize=require(_0xaf9d('0x0'));module[_0xaf9d('0x1')]={'name':{'type':Sequelize[_0xaf9d('0x2')],'allowNull':![]},'type':{'type':Sequelize[_0xaf9d('0x3')]('mouseOver',_0xaf9d('0x4')),'defaultValue':_0xaf9d('0x5')},'selector':{'type':Sequelize[_0xaf9d('0x2')]},'timeout':{'type':Sequelize['INTEGER']}}; \ No newline at end of file +var _0x517b=['STRING','mouseOver','timeout','INTEGER','sequelize','exports'];(function(_0x618414,_0x1a7a60){var _0x21c19a=function(_0x507b17){while(--_0x507b17){_0x618414['push'](_0x618414['shift']());}};_0x21c19a(++_0x1a7a60);}(_0x517b,0x1de));var _0xb517=function(_0x4c3834,_0x1c6afe){_0x4c3834=_0x4c3834-0x0;var _0x222696=_0x517b[_0x4c3834];return _0x222696;};'use strict';var Sequelize=require(_0xb517('0x0'));module[_0xb517('0x1')]={'name':{'type':Sequelize[_0xb517('0x2')],'allowNull':![]},'type':{'type':Sequelize['ENUM'](_0xb517('0x3'),_0xb517('0x4')),'defaultValue':_0xb517('0x3')},'selector':{'type':Sequelize['STRING']},'timeout':{'type':Sequelize[_0xb517('0x5')]}}; \ No newline at end of file diff --git a/server/api/chatProactiveAction/chatProactiveAction.controller.js b/server/api/chatProactiveAction/chatProactiveAction.controller.js index 62d6919..33885ed 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 _0x09f4=['bluebird','mustache','util','path','sox','to-csv','ejs','squel','crypto','jsforce','desk.js','querystring','papaparse','ioredis','../../components/parsers/qs','../../config/logger','api','../../config/utils','../../mysqldb','sendStatus','status','end','json','offset','undefined','apply','save','update','then','destroy','error','stack','name','send','show','model','keys','ChatProactiveAction','rawAttributes','query','filters','intersection','attributes','fields','length','includeAll','include','merge','options','find','catch','create','body','params','zip-dir','fast-json-patch','request-promise','moment'];(function(_0x99181b,_0x7ec23a){var _0x31eb30=function(_0x211fd4){while(--_0x211fd4){_0x99181b['push'](_0x99181b['shift']());}};_0x31eb30(++_0x7ec23a);}(_0x09f4,0xe4));var _0x409f=function(_0x17d7f4,_0x23ce02){_0x17d7f4=_0x17d7f4-0x0;var _0x1ad165=_0x09f4[_0x17d7f4];return _0x1ad165;};'use strict';var emlformat=require('eml-format');var rimraf=require('rimraf');var zipdir=require(_0x409f('0x0'));var jsonpatch=require(_0x409f('0x1'));var rp=require(_0x409f('0x2'));var moment=require(_0x409f('0x3'));var BPromise=require(_0x409f('0x4'));var Mustache=require(_0x409f('0x5'));var util=require(_0x409f('0x6'));var path=require(_0x409f('0x7'));var sox=require(_0x409f('0x8'));var csv=require(_0x409f('0x9'));var ejs=require(_0x409f('0xa'));var fs=require('fs');var fs_extra=require('fs-extra');var _=require('lodash');var squel=require(_0x409f('0xb'));var crypto=require(_0x409f('0xc'));var jsforce=require(_0x409f('0xd'));var deskjs=require(_0x409f('0xe'));var toCsv=require(_0x409f('0x9'));var querystring=require(_0x409f('0xf'));var Papa=require(_0x409f('0x10'));var Redis=require(_0x409f('0x11'));var authService=require('../../components/auth/service');var qs=require(_0x409f('0x12'));var as=require('../../components/parsers/advancedSearch');var hardwareService=require('../../config/license/hardware');var logger=require(_0x409f('0x13'))(_0x409f('0x14'));var utils=require(_0x409f('0x15'));var config=require('../../config/environment');var licenseUtil=require('../../config/license/util');var db=require(_0x409f('0x16'))['db'];function respondWithStatusCode(_0x1b79d7,_0x1d431d){_0x1d431d=_0x1d431d||0xcc;return function(_0x138a39){if(_0x138a39){return _0x1b79d7[_0x409f('0x17')](_0x1d431d);}return _0x1b79d7[_0x409f('0x18')](_0x1d431d)[_0x409f('0x19')]();};}function respondWithResult(_0x565f47,_0x1bc1bb){_0x1bc1bb=_0x1bc1bb||0xc8;return function(_0x55e557){if(_0x55e557){return _0x565f47[_0x409f('0x18')](_0x1bc1bb)[_0x409f('0x1a')](_0x55e557);}};}function respondWithFilteredResult(_0x5edeaf,_0x34fcc9){return function(_0x31f903){if(_0x31f903){var _0x14353d=typeof _0x34fcc9[_0x409f('0x1b')]===_0x409f('0x1c')&&typeof _0x34fcc9['limit']==='undefined';var _0x54b98a=_0x31f903['count'];var _0x2d57c8=_0x14353d?0x0:_0x34fcc9[_0x409f('0x1b')];var _0x41e1aa=_0x14353d?_0x31f903['count']:_0x34fcc9[_0x409f('0x1b')]+_0x34fcc9['limit'];var _0x1e8a4a;if(_0x41e1aa>=_0x54b98a){_0x41e1aa=_0x54b98a;_0x1e8a4a=0xc8;}else{_0x1e8a4a=0xce;}_0x5edeaf[_0x409f('0x18')](_0x1e8a4a);return _0x5edeaf['set']('Content-Range',_0x2d57c8+'-'+_0x41e1aa+'/'+_0x54b98a)[_0x409f('0x1a')](_0x31f903);}return null;};}function patchUpdates(_0x5723c7){return function(_0x4098f3){try{jsonpatch[_0x409f('0x1d')](_0x4098f3,_0x5723c7,!![]);}catch(_0x19b305){return BPromise['reject'](_0x19b305);}return _0x4098f3[_0x409f('0x1e')]();};}function saveUpdates(_0x8a26d8,_0x4a56eb){return function(_0x25e754){if(_0x25e754){return _0x25e754[_0x409f('0x1f')](_0x8a26d8)[_0x409f('0x20')](function(_0x24dd2c){return _0x24dd2c;});}return null;};}function removeEntity(_0x344b3b,_0x11ca7f){return function(_0xd937fe){if(_0xd937fe){return _0xd937fe[_0x409f('0x21')]()[_0x409f('0x20')](function(){_0x344b3b[_0x409f('0x18')](0xcc)['end']();});}};}function handleEntityNotFound(_0x7e2bad,_0x1b9bce){return function(_0x5a10bc){if(!_0x5a10bc){_0x7e2bad['sendStatus'](0x194);}return _0x5a10bc;};}function handleError(_0x2f3051,_0x301cd4){_0x301cd4=_0x301cd4||0x1f4;return function(_0x521da8){logger[_0x409f('0x22')](_0x521da8[_0x409f('0x23')]);if(_0x521da8[_0x409f('0x24')]){delete _0x521da8[_0x409f('0x24')];}_0x2f3051[_0x409f('0x18')](_0x301cd4)[_0x409f('0x25')](_0x521da8);};}exports[_0x409f('0x26')]=function(_0x1aeea3,_0x4e2cb4){var _0x3750bb={'raw':!![],'where':{'id':_0x1aeea3['params']['id']}},_0x261d96={};_0x261d96[_0x409f('0x27')]=_[_0x409f('0x28')](db[_0x409f('0x29')][_0x409f('0x2a')]);_0x261d96['query']=_[_0x409f('0x28')](_0x1aeea3[_0x409f('0x2b')]);_0x261d96[_0x409f('0x2c')]=_[_0x409f('0x2d')](_0x261d96[_0x409f('0x27')],_0x261d96[_0x409f('0x2b')]);_0x3750bb[_0x409f('0x2e')]=_[_0x409f('0x2d')](_0x261d96[_0x409f('0x27')],qs[_0x409f('0x2f')](_0x1aeea3[_0x409f('0x2b')][_0x409f('0x2f')]));_0x3750bb['attributes']=_0x3750bb[_0x409f('0x2e')][_0x409f('0x30')]?_0x3750bb['attributes']:_0x261d96[_0x409f('0x27')];if(_0x1aeea3['query'][_0x409f('0x31')]){_0x3750bb[_0x409f('0x32')]=[{'all':!![]}];}_0x3750bb=_[_0x409f('0x33')]({},_0x3750bb,_0x1aeea3[_0x409f('0x34')]);return db[_0x409f('0x29')][_0x409f('0x35')](_0x3750bb)['then'](handleEntityNotFound(_0x4e2cb4,null))[_0x409f('0x20')](respondWithResult(_0x4e2cb4,null))[_0x409f('0x36')](handleError(_0x4e2cb4,null));};exports[_0x409f('0x37')]=function(_0x5694d3,_0x20dc39){return db[_0x409f('0x29')]['create'](_0x5694d3['body'],{})['then'](respondWithResult(_0x20dc39,0xc9))[_0x409f('0x36')](handleError(_0x20dc39,null));};exports[_0x409f('0x1f')]=function(_0x55e2bb,_0x4eaf35){if(_0x55e2bb[_0x409f('0x38')]['id']){delete _0x55e2bb['body']['id'];}return db[_0x409f('0x29')][_0x409f('0x35')]({'where':{'id':_0x55e2bb[_0x409f('0x39')]['id']}})['then'](handleEntityNotFound(_0x4eaf35,null))[_0x409f('0x20')](saveUpdates(_0x55e2bb[_0x409f('0x38')],null))[_0x409f('0x20')](respondWithResult(_0x4eaf35,null))[_0x409f('0x36')](handleError(_0x4eaf35,null));};exports[_0x409f('0x21')]=function(_0x276234,_0x25f462){return db['ChatProactiveAction'][_0x409f('0x35')]({'where':{'id':_0x276234[_0x409f('0x39')]['id']}})[_0x409f('0x20')](handleEntityNotFound(_0x25f462,null))[_0x409f('0x20')](removeEntity(_0x25f462,null))[_0x409f('0x36')](handleError(_0x25f462,null));}; \ No newline at end of file +var _0x59ce=['send','show','params','model','keys','ChatProactiveAction','query','filters','attributes','intersection','fields','length','include','merge','options','find','body','catch','eml-format','rimraf','zip-dir','request-promise','moment','bluebird','mustache','util','path','sox','ejs','crypto','jsforce','desk.js','to-csv','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','sendStatus','status','end','json','limit','undefined','count','offset','Content-Range','apply','reject','save','update','then','destroy','error','stack','name'];(function(_0x465a0c,_0x19d4d5){var _0x1e202e=function(_0x27bd8a){while(--_0x27bd8a){_0x465a0c['push'](_0x465a0c['shift']());}};_0x1e202e(++_0x19d4d5);}(_0x59ce,0x92));var _0xe59c=function(_0x2338a2,_0x27179a){_0x2338a2=_0x2338a2-0x0;var _0xfb5e6=_0x59ce[_0x2338a2];return _0xfb5e6;};'use strict';var emlformat=require(_0xe59c('0x0'));var rimraf=require(_0xe59c('0x1'));var zipdir=require(_0xe59c('0x2'));var jsonpatch=require('fast-json-patch');var rp=require(_0xe59c('0x3'));var moment=require(_0xe59c('0x4'));var BPromise=require(_0xe59c('0x5'));var Mustache=require(_0xe59c('0x6'));var util=require(_0xe59c('0x7'));var path=require(_0xe59c('0x8'));var sox=require(_0xe59c('0x9'));var csv=require('to-csv');var ejs=require(_0xe59c('0xa'));var fs=require('fs');var fs_extra=require('fs-extra');var _=require('lodash');var squel=require('squel');var crypto=require(_0xe59c('0xb'));var jsforce=require(_0xe59c('0xc'));var deskjs=require(_0xe59c('0xd'));var toCsv=require(_0xe59c('0xe'));var querystring=require(_0xe59c('0xf'));var Papa=require(_0xe59c('0x10'));var Redis=require(_0xe59c('0x11'));var authService=require(_0xe59c('0x12'));var qs=require(_0xe59c('0x13'));var as=require(_0xe59c('0x14'));var hardwareService=require(_0xe59c('0x15'));var logger=require(_0xe59c('0x16'))(_0xe59c('0x17'));var utils=require(_0xe59c('0x18'));var config=require(_0xe59c('0x19'));var licenseUtil=require(_0xe59c('0x1a'));var db=require(_0xe59c('0x1b'))['db'];function respondWithStatusCode(_0x18579b,_0x52c25a){_0x52c25a=_0x52c25a||0xcc;return function(_0x20324e){if(_0x20324e){return _0x18579b[_0xe59c('0x1c')](_0x52c25a);}return _0x18579b[_0xe59c('0x1d')](_0x52c25a)[_0xe59c('0x1e')]();};}function respondWithResult(_0x5b7519,_0x5dc952){_0x5dc952=_0x5dc952||0xc8;return function(_0x464938){if(_0x464938){return _0x5b7519[_0xe59c('0x1d')](_0x5dc952)[_0xe59c('0x1f')](_0x464938);}};}function respondWithFilteredResult(_0x2ac2fb,_0x1528ca){return function(_0x495425){if(_0x495425){var _0xd5d315=typeof _0x1528ca['offset']==='undefined'&&typeof _0x1528ca[_0xe59c('0x20')]===_0xe59c('0x21');var _0x4fb0aa=_0x495425[_0xe59c('0x22')];var _0x38f4b0=_0xd5d315?0x0:_0x1528ca[_0xe59c('0x23')];var _0x529c0d=_0xd5d315?_0x495425[_0xe59c('0x22')]:_0x1528ca['offset']+_0x1528ca[_0xe59c('0x20')];var _0x192396;if(_0x529c0d>=_0x4fb0aa){_0x529c0d=_0x4fb0aa;_0x192396=0xc8;}else{_0x192396=0xce;}_0x2ac2fb[_0xe59c('0x1d')](_0x192396);return _0x2ac2fb['set'](_0xe59c('0x24'),_0x38f4b0+'-'+_0x529c0d+'/'+_0x4fb0aa)[_0xe59c('0x1f')](_0x495425);}return null;};}function patchUpdates(_0x28a8da){return function(_0x2b48b1){try{jsonpatch[_0xe59c('0x25')](_0x2b48b1,_0x28a8da,!![]);}catch(_0x27c6d1){return BPromise[_0xe59c('0x26')](_0x27c6d1);}return _0x2b48b1[_0xe59c('0x27')]();};}function saveUpdates(_0x554ad8,_0x1c9170){return function(_0x3a7799){if(_0x3a7799){return _0x3a7799[_0xe59c('0x28')](_0x554ad8)[_0xe59c('0x29')](function(_0x96fb2c){return _0x96fb2c;});}return null;};}function removeEntity(_0x336101,_0x58f192){return function(_0x4d3605){if(_0x4d3605){return _0x4d3605[_0xe59c('0x2a')]()[_0xe59c('0x29')](function(){_0x336101['status'](0xcc)[_0xe59c('0x1e')]();});}};}function handleEntityNotFound(_0x3ee3e9,_0x5ccc7c){return function(_0x5b50f8){if(!_0x5b50f8){_0x3ee3e9[_0xe59c('0x1c')](0x194);}return _0x5b50f8;};}function handleError(_0x2ceba4,_0x25d8fc){_0x25d8fc=_0x25d8fc||0x1f4;return function(_0x391fe7){logger[_0xe59c('0x2b')](_0x391fe7[_0xe59c('0x2c')]);if(_0x391fe7[_0xe59c('0x2d')]){delete _0x391fe7[_0xe59c('0x2d')];}_0x2ceba4[_0xe59c('0x1d')](_0x25d8fc)[_0xe59c('0x2e')](_0x391fe7);};}exports[_0xe59c('0x2f')]=function(_0x8e99e8,_0x2f844a){var _0x4cd07e={'raw':!![],'where':{'id':_0x8e99e8[_0xe59c('0x30')]['id']}},_0x21bfdc={};_0x21bfdc[_0xe59c('0x31')]=_[_0xe59c('0x32')](db[_0xe59c('0x33')]['rawAttributes']);_0x21bfdc[_0xe59c('0x34')]=_[_0xe59c('0x32')](_0x8e99e8[_0xe59c('0x34')]);_0x21bfdc[_0xe59c('0x35')]=_['intersection'](_0x21bfdc['model'],_0x21bfdc['query']);_0x4cd07e[_0xe59c('0x36')]=_[_0xe59c('0x37')](_0x21bfdc[_0xe59c('0x31')],qs[_0xe59c('0x38')](_0x8e99e8[_0xe59c('0x34')][_0xe59c('0x38')]));_0x4cd07e[_0xe59c('0x36')]=_0x4cd07e[_0xe59c('0x36')][_0xe59c('0x39')]?_0x4cd07e[_0xe59c('0x36')]:_0x21bfdc[_0xe59c('0x31')];if(_0x8e99e8[_0xe59c('0x34')]['includeAll']){_0x4cd07e[_0xe59c('0x3a')]=[{'all':!![]}];}_0x4cd07e=_[_0xe59c('0x3b')]({},_0x4cd07e,_0x8e99e8[_0xe59c('0x3c')]);return db[_0xe59c('0x33')][_0xe59c('0x3d')](_0x4cd07e)[_0xe59c('0x29')](handleEntityNotFound(_0x2f844a,null))['then'](respondWithResult(_0x2f844a,null))['catch'](handleError(_0x2f844a,null));};exports['create']=function(_0x71694c,_0x4a8dad){return db['ChatProactiveAction']['create'](_0x71694c[_0xe59c('0x3e')],{})[_0xe59c('0x29')](respondWithResult(_0x4a8dad,0xc9))['catch'](handleError(_0x4a8dad,null));};exports[_0xe59c('0x28')]=function(_0x1bba9f,_0xe35d06){if(_0x1bba9f[_0xe59c('0x3e')]['id']){delete _0x1bba9f['body']['id'];}return db[_0xe59c('0x33')][_0xe59c('0x3d')]({'where':{'id':_0x1bba9f[_0xe59c('0x30')]['id']}})['then'](handleEntityNotFound(_0xe35d06,null))[_0xe59c('0x29')](saveUpdates(_0x1bba9f['body'],null))[_0xe59c('0x29')](respondWithResult(_0xe35d06,null))['catch'](handleError(_0xe35d06,null));};exports['destroy']=function(_0x23b429,_0x12d313){return db[_0xe59c('0x33')]['find']({'where':{'id':_0x23b429[_0xe59c('0x30')]['id']}})[_0xe59c('0x29')](handleEntityNotFound(_0x12d313,null))[_0xe59c('0x29')](removeEntity(_0x12d313,null))[_0xe59c('0x3f')](handleError(_0x12d313,null));}; \ No newline at end of file diff --git a/server/api/chatProactiveAction/chatProactiveAction.model.js b/server/api/chatProactiveAction/chatProactiveAction.model.js index 98b1920..512a4de 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 _0x7203=['../../config/environment','./chatProactiveAction.attributes','exports','define','ChatProactiveAction','lodash','util','../../config/logger','api','moment','bluebird','rimraf'];(function(_0x3dd15e,_0x1f0015){var _0x231fd0=function(_0x4f680a){while(--_0x4f680a){_0x3dd15e['push'](_0x3dd15e['shift']());}};_0x231fd0(++_0x1f0015);}(_0x7203,0x155));var _0x3720=function(_0x3a6aa4,_0x593d66){_0x3a6aa4=_0x3a6aa4-0x0;var _0x514e75=_0x7203[_0x3a6aa4];return _0x514e75;};'use strict';var _=require(_0x3720('0x0'));var util=require(_0x3720('0x1'));var logger=require(_0x3720('0x2'))(_0x3720('0x3'));var moment=require(_0x3720('0x4'));var BPromise=require(_0x3720('0x5'));var rp=require('request-promise');var fs=require('fs');var path=require('path');var rimraf=require(_0x3720('0x6'));var config=require(_0x3720('0x7'));var attributes=require(_0x3720('0x8'));module[_0x3720('0x9')]=function(_0x1ad90f,_0x3f7e7d){return _0x1ad90f[_0x3720('0xa')](_0x3720('0xb'),attributes,{'tableName':'chat_proactive_actions','paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x5244=['request-promise','path','../../config/environment','exports','define','chat_proactive_actions','../../config/logger','api','bluebird'];(function(_0x534909,_0xc9eb23){var _0x3caf90=function(_0x3511e4){while(--_0x3511e4){_0x534909['push'](_0x534909['shift']());}};_0x3caf90(++_0xc9eb23);}(_0x5244,0xf0));var _0x4524=function(_0x2281cf,_0x189df7){_0x2281cf=_0x2281cf-0x0;var _0x414e6e=_0x5244[_0x2281cf];return _0x414e6e;};'use strict';var _=require('lodash');var util=require('util');var logger=require(_0x4524('0x0'))(_0x4524('0x1'));var moment=require('moment');var BPromise=require(_0x4524('0x2'));var rp=require(_0x4524('0x3'));var fs=require('fs');var path=require(_0x4524('0x4'));var rimraf=require('rimraf');var config=require(_0x4524('0x5'));var attributes=require('./chatProactiveAction.attributes');module[_0x4524('0x6')]=function(_0x1f8a2e,_0x27bd4a){return _0x1f8a2e[_0x4524('0x7')]('ChatProactiveAction',attributes,{'tableName':_0x4524('0x8'),'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 f90872b..ce20544 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 _0xf575=['error','code','message','result','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','client','http','request','then','info','ChatProactiveAction,\x20%s,\x20%s','debug','request\x20sent','stringify'];(function(_0x4ecf10,_0x381e84){var _0x1bb9e1=function(_0x53f943){while(--_0x53f943){_0x4ecf10['push'](_0x4ecf10['shift']());}};_0x1bb9e1(++_0x381e84);}(_0xf575,0xa5));var _0x5f57=function(_0x583a99,_0x297831){_0x583a99=_0x583a99-0x0;var _0x4558fe=_0xf575[_0x583a99];return _0x4558fe;};'use strict';var _=require('lodash');var util=require('util');var moment=require(_0x5f57('0x0'));var BPromise=require(_0x5f57('0x1'));var rs=require(_0x5f57('0x2'));var fs=require('fs');var Redis=require(_0x5f57('0x3'));var db=require(_0x5f57('0x4'))['db'];var utils=require(_0x5f57('0x5'));var logger=require(_0x5f57('0x6'))(_0x5f57('0x7'));var config=require(_0x5f57('0x8'));var jayson=require(_0x5f57('0x9'));var client=jayson[_0x5f57('0xa')][_0x5f57('0xb')]({'port':0x232a});function respondWithRpcPromise(_0x1ef53f,_0x9a5295,_0x9ab67){return new BPromise(function(_0x44ff05,_0x1a400a){return client[_0x5f57('0xc')](_0x1ef53f,_0x9ab67)[_0x5f57('0xd')](function(_0x2d7f32){logger[_0x5f57('0xe')](_0x5f57('0xf'),_0x9a5295,'request\x20sent');logger[_0x5f57('0x10')]('ChatProactiveAction,\x20%s,\x20%s,\x20%s',_0x9a5295,_0x5f57('0x11'),JSON[_0x5f57('0x12')](_0x2d7f32));if(_0x2d7f32[_0x5f57('0x13')]){if(_0x2d7f32[_0x5f57('0x13')][_0x5f57('0x14')]===0x1f4){logger[_0x5f57('0x13')](_0x5f57('0xf'),_0x9a5295,_0x2d7f32[_0x5f57('0x13')]['message']);return _0x1a400a(_0x2d7f32['error'][_0x5f57('0x15')]);}logger[_0x5f57('0x13')](_0x5f57('0xf'),_0x9a5295,_0x2d7f32[_0x5f57('0x13')][_0x5f57('0x15')]);return _0x44ff05(_0x2d7f32[_0x5f57('0x13')][_0x5f57('0x15')]);}else{logger[_0x5f57('0xe')](_0x5f57('0xf'),_0x9a5295,'request\x20sent');_0x44ff05(_0x2d7f32[_0x5f57('0x16')][_0x5f57('0x15')]);}})['catch'](function(_0xbd63e6){logger['error']('ChatProactiveAction,\x20%s,\x20%s',_0x9a5295,_0xbd63e6);_0x1a400a(_0xbd63e6);});});} \ No newline at end of file +var _0x5298=['../../config/logger','rpc','jayson/promise','http','request','then','info','request\x20sent','debug','ChatProactiveAction,\x20%s,\x20%s,\x20%s','stringify','error','code','ChatProactiveAction,\x20%s,\x20%s','message','result','catch','lodash','randomstring','ioredis','../../mysqldb','../../config/utils'];(function(_0x5a520b,_0x3e78b8){var _0x3c6a0a=function(_0x47d326){while(--_0x47d326){_0x5a520b['push'](_0x5a520b['shift']());}};_0x3c6a0a(++_0x3e78b8);}(_0x5298,0x1df));var _0x8529=function(_0x5e060e,_0x11260c){_0x5e060e=_0x5e060e-0x0;var _0x41916b=_0x5298[_0x5e060e];return _0x41916b;};'use strict';var _=require(_0x8529('0x0'));var util=require('util');var moment=require('moment');var BPromise=require('bluebird');var rs=require(_0x8529('0x1'));var fs=require('fs');var Redis=require(_0x8529('0x2'));var db=require(_0x8529('0x3'))['db'];var utils=require(_0x8529('0x4'));var logger=require(_0x8529('0x5'))(_0x8529('0x6'));var config=require('../../config/environment');var jayson=require(_0x8529('0x7'));var client=jayson['client'][_0x8529('0x8')]({'port':0x232a});function respondWithRpcPromise(_0x131d45,_0x3e3cbd,_0x3eedfd){return new BPromise(function(_0x1a2e72,_0x489e31){return client[_0x8529('0x9')](_0x131d45,_0x3eedfd)[_0x8529('0xa')](function(_0x2f587f){logger[_0x8529('0xb')]('ChatProactiveAction,\x20%s,\x20%s',_0x3e3cbd,_0x8529('0xc'));logger[_0x8529('0xd')](_0x8529('0xe'),_0x3e3cbd,_0x8529('0xc'),JSON[_0x8529('0xf')](_0x2f587f));if(_0x2f587f['error']){if(_0x2f587f[_0x8529('0x10')][_0x8529('0x11')]===0x1f4){logger[_0x8529('0x10')](_0x8529('0x12'),_0x3e3cbd,_0x2f587f['error']['message']);return _0x489e31(_0x2f587f[_0x8529('0x10')][_0x8529('0x13')]);}logger[_0x8529('0x10')](_0x8529('0x12'),_0x3e3cbd,_0x2f587f[_0x8529('0x10')]['message']);return _0x1a2e72(_0x2f587f[_0x8529('0x10')][_0x8529('0x13')]);}else{logger[_0x8529('0xb')](_0x8529('0x12'),_0x3e3cbd,_0x8529('0xc'));_0x1a2e72(_0x2f587f[_0x8529('0x14')][_0x8529('0x13')]);}})[_0x8529('0x15')](function(_0x456296){logger[_0x8529('0x10')](_0x8529('0x12'),_0x3e3cbd,_0x456296);_0x489e31(_0x456296);});});} \ No newline at end of file diff --git a/server/api/chatProactiveAction/index.js b/server/api/chatProactiveAction/index.js index e5cb7f7..313033a 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 _0x7217=['Router','fs-extra','../../config/environment','./chatProactiveAction.controller','get','/:id','isAuthenticated','show','post','create','put','update','delete','destroy','exports','multer','path','connect-timeout','express'];(function(_0x3e83f1,_0x1b09ae){var _0x28cd96=function(_0x2ffc3e){while(--_0x2ffc3e){_0x3e83f1['push'](_0x3e83f1['shift']());}};_0x28cd96(++_0x1b09ae);}(_0x7217,0x19e));var _0x7721=function(_0x6c993a,_0x5ea3ab){_0x6c993a=_0x6c993a-0x0;var _0x27f547=_0x7217[_0x6c993a];return _0x27f547;};'use strict';var multer=require(_0x7721('0x0'));var util=require('util');var path=require(_0x7721('0x1'));var timeout=require(_0x7721('0x2'));var express=require(_0x7721('0x3'));var router=express[_0x7721('0x4')]();var fs_extra=require(_0x7721('0x5'));var auth=require('../../components/auth/service');var interaction=require('../../components/interaction/service');var config=require(_0x7721('0x6'));var controller=require(_0x7721('0x7'));router[_0x7721('0x8')](_0x7721('0x9'),auth[_0x7721('0xa')](),controller[_0x7721('0xb')]);router[_0x7721('0xc')]('/',auth[_0x7721('0xa')](),controller[_0x7721('0xd')]);router[_0x7721('0xe')](_0x7721('0x9'),auth[_0x7721('0xa')](),controller[_0x7721('0xf')]);router[_0x7721('0x10')](_0x7721('0x9'),auth['isAuthenticated'](),controller[_0x7721('0x11')]);module[_0x7721('0x12')]=router; \ No newline at end of file +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(_0x4d607f,_0x24d42e){var _0x530897=function(_0x8f8c5f){while(--_0x8f8c5f){_0x4d607f['push'](_0x4d607f['shift']());}};_0x530897(++_0x24d42e);}(_0xf2ca,0x16a));var _0xaf2c=function(_0x419e17,_0x7fe78c){_0x419e17=_0x419e17-0x0;var _0x1f2044=_0xf2ca[_0x419e17];return _0x1f2044;};'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 diff --git a/server/api/chatQueue/chatQueue.attributes.js b/server/api/chatQueue/chatQueue.attributes.js index 209517d..983ed04 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 _0x88a9=['STRING','exports'];(function(_0x440b1a,_0x7a73ba){var _0x549536=function(_0x39204c){while(--_0x39204c){_0x440b1a['push'](_0x440b1a['shift']());}};_0x549536(++_0x7a73ba);}(_0x88a9,0x1eb));var _0x988a=function(_0x2e0b04,_0x40d877){_0x2e0b04=_0x2e0b04-0x0;var _0x5266a3=_0x88a9[_0x2e0b04];return _0x5266a3;};'use strict';var Sequelize=require('sequelize');module[_0x988a('0x0')]={'name':{'type':Sequelize[_0x988a('0x1')],'unique':'name','allowNull':![],'validate':{'notEmpty':!![],'is':/^[A-Za-z0-9\.\_]+$/i}},'description':{'type':Sequelize[_0x988a('0x1')]},'timeout':{'type':Sequelize['INTEGER'],'validate':{'min':0x1,'max':0x20c49b}},'strategy':{'type':Sequelize['ENUM']('rrmemory','beepall','roundrobin')}}; \ No newline at end of file +var _0x04a6=['exports','STRING','INTEGER','ENUM','rrmemory','beepall','sequelize'];(function(_0x40a045,_0x516f0e){var _0x1a687c=function(_0x48c9fe){while(--_0x48c9fe){_0x40a045['push'](_0x40a045['shift']());}};_0x1a687c(++_0x516f0e);}(_0x04a6,0x1e9));var _0x604a=function(_0xb34001,_0x46760f){_0xb34001=_0xb34001-0x0;var _0x418a90=_0x04a6[_0xb34001];return _0x418a90;};'use strict';var Sequelize=require(_0x604a('0x0'));module[_0x604a('0x1')]={'name':{'type':Sequelize['STRING'],'unique':'name','allowNull':![],'validate':{'notEmpty':!![],'is':/^[A-Za-z0-9\.\_]+$/i}},'description':{'type':Sequelize[_0x604a('0x2')]},'timeout':{'type':Sequelize[_0x604a('0x3')],'validate':{'min':0x1,'max':0x20c49b}},'strategy':{'type':Sequelize[_0x604a('0x4')](_0x604a('0x5'),_0x604a('0x6'),'roundrobin')}}; \ No newline at end of file diff --git a/server/api/chatQueue/chatQueue.controller.js b/server/api/chatQueue/chatQueue.controller.js index e0365f3..09544eb 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 _0xed44=['map','rawAttributes','fieldName','type','key','where','ChatQueue','include','query','rows','show','model','keys','filters','attributes','intersection','fields','length','includeAll','options','catch','create','user','Unable\x20to\x20retrieve\x20the\x20current\x20user','UserProfileSection','find','userProfileId','autoAssociation','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','update','params','body','describe','getMembers','findOne','UserChatQueue','order','sort','pick','ChatQueueId','filter','merge','findAll','User','UserId','chatPause','updatedAt','createdAt','%s/%s','SIP','Team','getTeams','hasOwnProperty','nolimit','addTeams','ids','Agents','online','voicePause','interface','flatMap','sequelize','transaction','findOrCreate','emit','select','field','tq.TeamId','from','team_has_chat_queues','join','ut.TeamId\x20=\x20tq.TeamId','ChatQueueId\x20=\x20?','clone','ut.UserId\x20=\x20?','push','toString','QueryTypes','every','TeamId','includes','all','union','compact','value','removeTeams','isEmpty','forEach','userChatQueue:remove','addAgents','omit','spread','userChatQueue:save','removeAgents','isArray','getAgents','util','lodash','squel','ioredis','../../config/logger','../../mysqldb','redis','defaults','localhost','./chatQueue.socket','sendStatus','status','json','undefined','limit','count','offset','set','Content-Range','then','destroy','get','ChatQueues','UserProfileResource','error','stack','name'];(function(_0x1facfa,_0x1acf7d){var _0x9ec701=function(_0x115e37){while(--_0x115e37){_0x1facfa['push'](_0x1facfa['shift']());}};_0x9ec701(++_0x1acf7d);}(_0xed44,0xdb));var _0x4ed4=function(_0x53ccf2,_0x13cb67){_0x53ccf2=_0x53ccf2-0x0;var _0x5a2964=_0xed44[_0x53ccf2];return _0x5a2964;};'use strict';var BPromise=require('bluebird');var util=require(_0x4ed4('0x0'));var _=require(_0x4ed4('0x1'));var squel=require(_0x4ed4('0x2'));var Redis=require(_0x4ed4('0x3'));var qs=require('../../components/parsers/qs');var logger=require(_0x4ed4('0x4'))('api');var config=require('../../config/environment');var db=require(_0x4ed4('0x5'))['db'];config[_0x4ed4('0x6')]=_[_0x4ed4('0x7')](config[_0x4ed4('0x6')],{'host':_0x4ed4('0x8'),'port':0x18eb});var socket=require('socket.io-emitter')(new Redis(config[_0x4ed4('0x6')]));require(_0x4ed4('0x9'))['register'](socket);function respondWithStatusCode(_0x414690,_0x3c4ca0){_0x3c4ca0=_0x3c4ca0||0xcc;return function(_0xf46039){if(_0xf46039){return _0x414690[_0x4ed4('0xa')](_0x3c4ca0);}return _0x414690[_0x4ed4('0xb')](_0x3c4ca0)['end']();};}function respondWithResult(_0x890044,_0x5004ca){_0x5004ca=_0x5004ca||0xc8;return function(_0x320045){if(_0x320045){return _0x890044[_0x4ed4('0xb')](_0x5004ca)[_0x4ed4('0xc')](_0x320045);}};}function respondWithFilteredResult(_0x50811f,_0x55ff2a){return function(_0x5c7d19){if(_0x5c7d19){var _0x1b5bd9=typeof _0x55ff2a['offset']===_0x4ed4('0xd')&&typeof _0x55ff2a[_0x4ed4('0xe')]===_0x4ed4('0xd');var _0x47adfc=_0x5c7d19[_0x4ed4('0xf')];var _0x3fa7ff=_0x1b5bd9?0x0:_0x55ff2a[_0x4ed4('0x10')];var _0x521687=_0x1b5bd9?_0x5c7d19['count']:_0x55ff2a[_0x4ed4('0x10')]+_0x55ff2a[_0x4ed4('0xe')];var _0x281077;if(_0x521687>=_0x47adfc){_0x521687=_0x47adfc;_0x281077=0xc8;}else{_0x281077=0xce;}_0x50811f[_0x4ed4('0xb')](_0x281077);return _0x50811f[_0x4ed4('0x11')](_0x4ed4('0x12'),_0x3fa7ff+'-'+_0x521687+'/'+_0x47adfc)[_0x4ed4('0xc')](_0x5c7d19);}return null;};}function saveUpdates(_0x450558){return function(_0x190d4c){if(_0x190d4c){return _0x190d4c['update'](_0x450558)[_0x4ed4('0x13')](function(_0x3c3d7a){return _0x3c3d7a;});}return null;};}function removeEntity(_0x555391){return function(_0x322f37){if(_0x322f37){return _0x322f37[_0x4ed4('0x14')]()[_0x4ed4('0x13')](function(){var _0x4ed914=_0x322f37[_0x4ed4('0x15')]({'plain':!![]});var _0x4af722=_0x4ed4('0x16');return db[_0x4ed4('0x17')][_0x4ed4('0x14')]({'where':{'type':_0x4af722,'resourceId':_0x4ed914['id']}})['then'](function(){return _0x322f37;});})[_0x4ed4('0x13')](function(){_0x555391[_0x4ed4('0xb')](0xcc)['end']();});}};}function handleEntityNotFound(_0x2e9c1e){return function(_0x419f13){if(!_0x419f13){_0x2e9c1e[_0x4ed4('0xa')](0x194);}return _0x419f13;};}function handleError(_0x7aec8f,_0x1d9957){_0x1d9957=_0x1d9957||0x1f4;return function(_0x57d382){logger[_0x4ed4('0x18')](_0x57d382[_0x4ed4('0x19')]);if(_0x57d382[_0x4ed4('0x1a')]){delete _0x57d382[_0x4ed4('0x1a')];}_0x7aec8f[_0x4ed4('0xb')](_0x1d9957)['send'](_0x57d382);};}exports['index']=function(_0x52e53a,_0xe476d7){var _0x3d825f={};var _0x50393f={'count':0x0,'rows':[]};var _0x359740=_[_0x4ed4('0x1b')](db['ChatQueue'][_0x4ed4('0x1c')],function(_0x2564fe){return{'name':_0x2564fe[_0x4ed4('0x1d')],'type':_0x2564fe[_0x4ed4('0x1e')][_0x4ed4('0x1f')]};});_0x3d825f=qs['getOptions'](_0x359740,_0x52e53a);var _0x548790={'where':_0x3d825f[_0x4ed4('0x20')]};return db[_0x4ed4('0x21')][_0x4ed4('0xf')](_0x548790)[_0x4ed4('0x13')](function(_0x163a0e){_0x50393f[_0x4ed4('0xf')]=_0x163a0e;_0x3d825f[_0x4ed4('0x22')]=qs[_0x4ed4('0x22')](_0x52e53a[_0x4ed4('0x23')]);return db[_0x4ed4('0x21')]['findAll'](_0x3d825f);})['then'](function(_0x4ef540){_0x50393f[_0x4ed4('0x24')]=_0x4ef540;return _0x50393f;})[_0x4ed4('0x13')](respondWithFilteredResult(_0xe476d7,_0x3d825f))['catch'](handleError(_0xe476d7,null));};exports[_0x4ed4('0x25')]=function(_0x26ce44,_0x1869ff){var _0x492dbc={'raw':!![],'where':{'id':_0x26ce44['params']['id']}},_0x22dcf7={};_0x22dcf7[_0x4ed4('0x26')]=_[_0x4ed4('0x27')](db[_0x4ed4('0x21')]['rawAttributes']);_0x22dcf7[_0x4ed4('0x23')]=_['keys'](_0x26ce44['query']);_0x22dcf7[_0x4ed4('0x28')]=_['intersection'](_0x22dcf7[_0x4ed4('0x26')],_0x22dcf7[_0x4ed4('0x23')]);_0x492dbc[_0x4ed4('0x29')]=_[_0x4ed4('0x2a')](_0x22dcf7['model'],qs[_0x4ed4('0x2b')](_0x26ce44[_0x4ed4('0x23')][_0x4ed4('0x2b')]));_0x492dbc[_0x4ed4('0x29')]=_0x492dbc['attributes'][_0x4ed4('0x2c')]?_0x492dbc[_0x4ed4('0x29')]:_0x22dcf7[_0x4ed4('0x26')];if(_0x26ce44[_0x4ed4('0x23')][_0x4ed4('0x2d')]){_0x492dbc[_0x4ed4('0x22')]=[{'all':!![]}];}_0x492dbc=_['merge']({},_0x492dbc,_0x26ce44[_0x4ed4('0x2e')]);return db[_0x4ed4('0x21')]['find'](_0x492dbc)[_0x4ed4('0x13')](handleEntityNotFound(_0x1869ff,null))['then'](respondWithResult(_0x1869ff,null))[_0x4ed4('0x2f')](handleError(_0x1869ff,null));};exports[_0x4ed4('0x30')]=function(_0x149ab1,_0x15c648){return db[_0x4ed4('0x21')][_0x4ed4('0x30')](_0x149ab1['body'],{})[_0x4ed4('0x13')](function(_0x3c82fd){var _0x3caff8=_0x149ab1[_0x4ed4('0x31')]['get']({'plain':!![]});if(!_0x3caff8)throw new Error(_0x4ed4('0x32'));if(_0x3caff8['role']===_0x4ed4('0x31')){var _0x4dd164=_0x3c82fd[_0x4ed4('0x15')]({'plain':!![]});var _0x3912b8=_0x4ed4('0x16');return db[_0x4ed4('0x33')][_0x4ed4('0x34')]({'where':{'name':_0x3912b8,'userProfileId':_0x3caff8[_0x4ed4('0x35')]},'raw':!![]})[_0x4ed4('0x13')](function(_0x2bd545){if(_0x2bd545&&_0x2bd545[_0x4ed4('0x36')]===0x0){return db['UserProfileResource'][_0x4ed4('0x30')]({'name':_0x4dd164[_0x4ed4('0x1a')],'resourceId':_0x4dd164['id'],'type':_0x2bd545['name'],'sectionId':_0x2bd545['id']},{})[_0x4ed4('0x13')](function(){return _0x3c82fd;});}else{return _0x3c82fd;}})[_0x4ed4('0x2f')](function(_0x5d2fa4){logger[_0x4ed4('0x18')](_0x4ed4('0x37'),_0x5d2fa4);throw _0x5d2fa4;});}return _0x3c82fd;})[_0x4ed4('0x13')](respondWithResult(_0x15c648,0xc9))[_0x4ed4('0x2f')](handleError(_0x15c648,null));};exports[_0x4ed4('0x38')]=function(_0x20b420,_0x22bdae){if(_0x20b420['body']['id']){delete _0x20b420['body']['id'];}return db[_0x4ed4('0x21')][_0x4ed4('0x34')]({'where':{'id':_0x20b420[_0x4ed4('0x39')]['id']}})[_0x4ed4('0x13')](handleEntityNotFound(_0x22bdae,null))[_0x4ed4('0x13')](saveUpdates(_0x20b420[_0x4ed4('0x3a')],null))[_0x4ed4('0x13')](respondWithResult(_0x22bdae,null))[_0x4ed4('0x2f')](handleError(_0x22bdae,null));};exports[_0x4ed4('0x14')]=function(_0x338126,_0x4f2a60){return db[_0x4ed4('0x21')][_0x4ed4('0x34')]({'where':{'id':_0x338126[_0x4ed4('0x39')]['id']}})[_0x4ed4('0x13')](handleEntityNotFound(_0x4f2a60,null))[_0x4ed4('0x13')](removeEntity(_0x4f2a60,null))['catch'](handleError(_0x4f2a60,null));};exports[_0x4ed4('0x3b')]=function(_0x3c7533,_0x6515df){return db[_0x4ed4('0x21')][_0x4ed4('0x3b')]()[_0x4ed4('0x13')](respondWithResult(_0x6515df,null))[_0x4ed4('0x2f')](handleError(_0x6515df,null));};exports[_0x4ed4('0x3c')]=function(_0x159364,_0x4b4f53){var _0x254aed={'raw':!![],'where':{}},_0x8d71cc={},_0x573cf2;return db[_0x4ed4('0x21')][_0x4ed4('0x3d')]({'where':{'id':_0x159364['params']['id']}})['then'](handleEntityNotFound(_0x4b4f53,null))['then'](function(_0x323746){if(_0x323746){_0x573cf2=_0x323746[_0x4ed4('0x15')]({'plain':!![]});_0x8d71cc[_0x4ed4('0x26')]=_[_0x4ed4('0x27')](db[_0x4ed4('0x3e')][_0x4ed4('0x1c')]);_0x8d71cc[_0x4ed4('0x23')]=_[_0x4ed4('0x27')](_0x159364[_0x4ed4('0x23')]);_0x8d71cc['filters']=_[_0x4ed4('0x2a')](_0x8d71cc[_0x4ed4('0x26')],_0x8d71cc[_0x4ed4('0x23')]);_0x254aed[_0x4ed4('0x29')]=_[_0x4ed4('0x2a')](_0x8d71cc[_0x4ed4('0x26')],qs[_0x4ed4('0x2b')](_0x159364['query'][_0x4ed4('0x2b')]));_0x254aed['attributes']=_0x254aed[_0x4ed4('0x29')][_0x4ed4('0x2c')]?_0x254aed[_0x4ed4('0x29')]:_0x8d71cc[_0x4ed4('0x26')];if(!_0x159364['query']['hasOwnProperty']('nolimit')){_0x254aed[_0x4ed4('0xe')]=qs[_0x4ed4('0xe')](_0x159364['query'][_0x4ed4('0xe')]);_0x254aed[_0x4ed4('0x10')]=qs[_0x4ed4('0x10')](_0x159364[_0x4ed4('0x23')][_0x4ed4('0x10')]);}_0x254aed[_0x4ed4('0x3f')]=qs['sort'](_0x159364[_0x4ed4('0x23')][_0x4ed4('0x40')]);_0x254aed[_0x4ed4('0x20')]=qs[_0x4ed4('0x28')](_[_0x4ed4('0x41')](_0x159364[_0x4ed4('0x23')],_0x8d71cc[_0x4ed4('0x28')]));_0x254aed[_0x4ed4('0x20')][_0x4ed4('0x42')]=_0x323746['id'];if(_0x159364[_0x4ed4('0x23')][_0x4ed4('0x43')]){_0x254aed[_0x4ed4('0x20')]=_['merge'](_0x254aed[_0x4ed4('0x20')],{'$or':_[_0x4ed4('0x1b')](_0x254aed[_0x4ed4('0x29')],function(_0x4ffea4){var _0x528513={};_0x528513[_0x4ffea4]={'$like':'%'+_0x159364[_0x4ed4('0x23')][_0x4ed4('0x43')]+'%'};return _0x528513;})});}_0x254aed=_[_0x4ed4('0x44')]({},_0x254aed,_0x159364['options']);return db[_0x4ed4('0x3e')][_0x4ed4('0x45')](_0x254aed);}})[_0x4ed4('0x13')](function(_0xf711dc){if(_0xf711dc){return db[_0x4ed4('0x46')]['findAndCountAll']({'where':{'id':_['map'](_0xf711dc,_0x4ed4('0x47')),'role':'agent'},'attributes':['id',_0x4ed4('0x1a'),_0x4ed4('0x48'),_0x4ed4('0x49'),_0x4ed4('0x4a')]});}})['then'](function(_0x284e02){if(_0x284e02){return{'count':_0x284e02[_0x4ed4('0xf')],'rows':_['map'](_0x284e02[_0x4ed4('0x24')],function(_0x4d70e4){return{'membername':_0x4d70e4[_0x4ed4('0x1a')],'UserId':_0x4d70e4['id'],'queue_name':_0x573cf2[_0x4ed4('0x1a')],'ChatQueueId':_0x573cf2['id'],'interface':util['format'](_0x4ed4('0x4b'),_0x4ed4('0x4c'),_0x4d70e4[_0x4ed4('0x1a')]),'penalty':0x0,'paused':_0x4d70e4[_0x4ed4('0x48')],'createdAt':_0x4d70e4['createdAt'],'updatedAt':_0x4d70e4[_0x4ed4('0x49')]};})};}else{return{'count':0x0,'rows':[]};}})[_0x4ed4('0x13')](respondWithFilteredResult(_0x4b4f53,_0x254aed))[_0x4ed4('0x2f')](handleError(_0x4b4f53,null));};exports['getTeams']=function(_0x510e81,_0x1265b1){var _0x40567b={};var _0x5434db={};var _0x2627a8;var _0x4ba0b5;return db[_0x4ed4('0x21')][_0x4ed4('0x3d')]({'where':{'id':_0x510e81['params']['id']}})['then'](handleEntityNotFound(_0x1265b1,null))['then'](function(_0x265c6c){if(_0x265c6c){_0x2627a8=_0x265c6c;_0x5434db[_0x4ed4('0x26')]=_[_0x4ed4('0x27')](db[_0x4ed4('0x4d')][_0x4ed4('0x1c')]);_0x5434db[_0x4ed4('0x23')]=_[_0x4ed4('0x27')](_0x510e81[_0x4ed4('0x23')]);_0x5434db[_0x4ed4('0x28')]=_[_0x4ed4('0x2a')](_0x5434db[_0x4ed4('0x26')],_0x5434db[_0x4ed4('0x23')]);_0x40567b[_0x4ed4('0x29')]=_['intersection'](_0x5434db[_0x4ed4('0x26')],qs['fields'](_0x510e81[_0x4ed4('0x23')][_0x4ed4('0x2b')]));_0x40567b['attributes']=_0x40567b[_0x4ed4('0x29')]['length']?_0x40567b['attributes']:_0x5434db[_0x4ed4('0x26')];_0x40567b[_0x4ed4('0x3f')]=qs['sort'](_0x510e81[_0x4ed4('0x23')]['sort']);_0x40567b[_0x4ed4('0x20')]=qs[_0x4ed4('0x28')](_[_0x4ed4('0x41')](_0x510e81[_0x4ed4('0x23')],_0x5434db[_0x4ed4('0x28')]));if(_0x510e81[_0x4ed4('0x23')][_0x4ed4('0x43')]){_0x40567b[_0x4ed4('0x20')]=_[_0x4ed4('0x44')](_0x40567b['where'],{'$or':_[_0x4ed4('0x1b')](_0x40567b[_0x4ed4('0x29')],function(_0x26f6c2){var _0x4841be={};_0x4841be[_0x26f6c2]={'$like':'%'+_0x510e81[_0x4ed4('0x23')][_0x4ed4('0x43')]+'%'};return _0x4841be;})});}_0x40567b=_[_0x4ed4('0x44')]({},_0x40567b,_0x510e81['options']);return _0x2627a8[_0x4ed4('0x4e')](_0x40567b);}})['then'](function(_0x49d00c){if(_0x49d00c){_0x4ba0b5=_0x49d00c[_0x4ed4('0x2c')];if(!_0x510e81[_0x4ed4('0x23')][_0x4ed4('0x4f')](_0x4ed4('0x50'))){_0x40567b[_0x4ed4('0xe')]=qs['limit'](_0x510e81['query'][_0x4ed4('0xe')]);_0x40567b['offset']=qs[_0x4ed4('0x10')](_0x510e81[_0x4ed4('0x23')]['offset']);}return _0x2627a8[_0x4ed4('0x4e')](_0x40567b);}})['then'](function(_0xbd7ff){if(_0xbd7ff){return _0xbd7ff?{'count':_0x4ba0b5,'rows':_0xbd7ff}:null;}})[_0x4ed4('0x13')](respondWithResult(_0x1265b1,null))['catch'](handleError(_0x1265b1,null));};exports[_0x4ed4('0x51')]=function(_0x1b2f6a,_0x2198dc){var _0xe0bc82=_0x1b2f6a[_0x4ed4('0x3a')][_0x4ed4('0x52')];return db[_0x4ed4('0x4d')][_0x4ed4('0x45')]({'where':{'id':_0xe0bc82},'attributes':['id'],'include':[{'model':db[_0x4ed4('0x46')],'as':_0x4ed4('0x53'),'attributes':['id',_0x4ed4('0x1a'),_0x4ed4('0x54'),_0x4ed4('0x55'),_0x4ed4('0x56')],'raw':!![]}]})[_0x4ed4('0x13')](function(_0x543346){if(_0x543346){var _0x3d4c33=_[_0x4ed4('0x57')](_0x543346,function(_0x16bc9d){var _0x268582=_0x16bc9d['get']({'plain':!![]});return _0x268582[_0x4ed4('0x53')];});return db[_0x4ed4('0x21')][_0x4ed4('0x34')]({'where':{'id':_0x1b2f6a[_0x4ed4('0x39')]['id']}})[_0x4ed4('0x13')](function(_0x10c028){return db[_0x4ed4('0x58')][_0x4ed4('0x59')](function(_0x209530){return _0x10c028[_0x4ed4('0x51')](_0xe0bc82,{'transaction':_0x209530})[_0x4ed4('0x13')](function(){return BPromise['each'](_0x3d4c33,function(_0x5f28b2){return db[_0x4ed4('0x3e')][_0x4ed4('0x5a')]({'where':{'UserId':_0x5f28b2['id'],'ChatQueueId':_0x1b2f6a[_0x4ed4('0x39')]['id']},'transaction':_0x209530});});})[_0x4ed4('0x13')](function(){_0x3d4c33['forEach'](function(_0x4309e5){socket[_0x4ed4('0x5b')]('userChatQueue:save',{'UserId':_0x4309e5['id'],'ChatQueueId':_0x10c028['id']});});});});});}})[_0x4ed4('0x13')](respondWithStatusCode(_0x2198dc,null))[_0x4ed4('0x2f')](handleError(_0x2198dc,null));};exports['removeTeams']=function(_0x44eb28,_0x212449){return db['Team']['findAll']({'where':{'id':_0x44eb28[_0x4ed4('0x23')][_0x4ed4('0x52')]},'attributes':['id'],'include':[{'model':db[_0x4ed4('0x46')],'as':_0x4ed4('0x53'),'attributes':['id'],'raw':!![]}]})['then'](handleEntityNotFound(_0x212449,null))[_0x4ed4('0x13')](function(_0x46fe7a){var _0x7b6a2e=_[_0x4ed4('0x1b')](_0x46fe7a,'id');var _0x57cea3=[];var _0xa51297=[];var _0x3f5336=squel[_0x4ed4('0x5c')]();_0x3f5336[_0x4ed4('0x5d')](_0x4ed4('0x5e'))[_0x4ed4('0x5f')](_0x4ed4('0x60'),'tq')[_0x4ed4('0x61')]('user_has_teams','ut',_0x4ed4('0x62'))[_0x4ed4('0x20')](_0x4ed4('0x63'),_0x44eb28['params']['id']);for(var _0x53be1d=0x0;_0x53be1d<_0x46fe7a[_0x4ed4('0x2c')];_0x53be1d+=0x1){let _0x492c2f=_0x46fe7a[_0x53be1d];for(var _0x31bc55=0x0;_0x31bc55<_0x492c2f[_0x4ed4('0x53')][_0x4ed4('0x2c')];_0x31bc55+=0x1){let _0x13be23=_0x492c2f[_0x4ed4('0x53')][_0x31bc55];var _0x16c7c=_0x3f5336[_0x4ed4('0x64')]();_0x16c7c[_0x4ed4('0x20')](_0x4ed4('0x65'),_0x13be23['id']);_0xa51297[_0x4ed4('0x66')](db[_0x4ed4('0x58')][_0x4ed4('0x23')](_0x16c7c[_0x4ed4('0x67')](),{'type':db[_0x4ed4('0x58')][_0x4ed4('0x68')]['SELECT']})[_0x4ed4('0x13')](function(_0x52e8e7){if(_0x52e8e7[_0x4ed4('0x2c')]===0x1){return _0x13be23['id'];}else{var _0x37812c=_[_0x4ed4('0x69')](_[_0x4ed4('0x1b')](_0x52e8e7,_0x4ed4('0x6a')),function(_0x5e15b9){return _[_0x4ed4('0x6b')](_0x7b6a2e,_0x5e15b9);});if(_0x37812c){return _0x13be23['id'];}}}));}}return BPromise[_0x4ed4('0x6c')](_0xa51297)[_0x4ed4('0x13')](function(_0x3bc01d){_0x57cea3=_(_0x57cea3)[_0x4ed4('0x6d')](_0x3bc01d)[_0x4ed4('0x6e')]()[_0x4ed4('0x6f')]();return db['ChatQueue'][_0x4ed4('0x34')]({'where':{'id':_0x44eb28[_0x4ed4('0x39')]['id']}})['then'](function(_0x23dd47){return db[_0x4ed4('0x58')][_0x4ed4('0x59')](function(_0x5503ee){return _0x23dd47[_0x4ed4('0x70')](_0x44eb28[_0x4ed4('0x23')][_0x4ed4('0x52')],{'transaction':_0x5503ee})[_0x4ed4('0x13')](function(){if(!_[_0x4ed4('0x71')](_0x57cea3)){return _0x23dd47['removeAgents'](_0x57cea3,{'transaction':_0x5503ee});}})[_0x4ed4('0x13')](function(){_0x57cea3[_0x4ed4('0x72')](function(_0x18bd2a){socket[_0x4ed4('0x5b')](_0x4ed4('0x73'),{'UserId':_0x18bd2a,'ChatQueueId':_0x23dd47['id']});});});});});});})[_0x4ed4('0x13')](respondWithStatusCode(_0x212449,null))[_0x4ed4('0x2f')](handleError(_0x212449,null));};exports['addAgents']=function(_0xa9fc94,_0x317c4c){return db[_0x4ed4('0x21')][_0x4ed4('0x34')]({'where':{'id':_0xa9fc94[_0x4ed4('0x39')]['id']}})[_0x4ed4('0x13')](handleEntityNotFound(_0x317c4c,null))[_0x4ed4('0x13')](function(_0xe0b61){if(_0xe0b61){return _0xe0b61[_0x4ed4('0x74')](_0xa9fc94[_0x4ed4('0x3a')][_0x4ed4('0x52')],_[_0x4ed4('0x75')](_0xa9fc94[_0x4ed4('0x3a')],[_0x4ed4('0x52'),'id'])||{})[_0x4ed4('0x76')](function(_0x4d07df){for(var _0x4c2c1d=0x0;_0x4c2c1d<_0xa9fc94['body'][_0x4ed4('0x52')]['length'];_0x4c2c1d+=0x1){socket[_0x4ed4('0x5b')](_0x4ed4('0x77'),{'UserId':Number(_0xa9fc94[_0x4ed4('0x3a')][_0x4ed4('0x52')][_0x4c2c1d]),'ChatQueueId':Number(_0xa9fc94[_0x4ed4('0x39')]['id'])});}return _0x4d07df;});}})[_0x4ed4('0x13')](respondWithResult(_0x317c4c,null))[_0x4ed4('0x2f')](handleError(_0x317c4c,null));};exports[_0x4ed4('0x78')]=function(_0x494797,_0x567d8f){return db[_0x4ed4('0x21')][_0x4ed4('0x34')]({'where':{'id':_0x494797[_0x4ed4('0x39')]['id']}})[_0x4ed4('0x13')](handleEntityNotFound(_0x567d8f,null))['then'](function(_0x14939d){if(_0x14939d){return _0x14939d[_0x4ed4('0x78')](_0x494797['query'][_0x4ed4('0x52')])[_0x4ed4('0x13')](function(){if(_[_0x4ed4('0x79')](_0x494797[_0x4ed4('0x23')][_0x4ed4('0x52')])){for(var _0x37d552=0x0;_0x37d552<_0x494797[_0x4ed4('0x23')][_0x4ed4('0x52')][_0x4ed4('0x2c')];_0x37d552+=0x1){socket[_0x4ed4('0x5b')](_0x4ed4('0x73'),{'UserId':Number(_0x494797[_0x4ed4('0x23')][_0x4ed4('0x52')][_0x37d552]),'ChatQueueId':Number(_0x494797[_0x4ed4('0x39')]['id'])});}}else{socket[_0x4ed4('0x5b')](_0x4ed4('0x73'),{'UserId':Number(_0x494797['query'][_0x4ed4('0x52')]),'ChatQueueId':Number(_0x494797['params']['id'])});}});}})[_0x4ed4('0x13')](respondWithStatusCode(_0x567d8f,null))[_0x4ed4('0x2f')](handleError(_0x567d8f,null));};exports[_0x4ed4('0x7a')]=function(_0x261c1b,_0x3a07e1){var _0x40f608={};var _0x1e4877={};var _0xdd604e;var _0x21ccd0;return db[_0x4ed4('0x21')][_0x4ed4('0x3d')]({'where':{'id':_0x261c1b[_0x4ed4('0x39')]['id']}})[_0x4ed4('0x13')](handleEntityNotFound(_0x3a07e1,null))[_0x4ed4('0x13')](function(_0x1859d9){if(_0x1859d9){_0xdd604e=_0x1859d9;_0x1e4877['model']=_[_0x4ed4('0x27')](db[_0x4ed4('0x46')]['rawAttributes']);_0x1e4877[_0x4ed4('0x23')]=_[_0x4ed4('0x27')](_0x261c1b['query']);_0x1e4877[_0x4ed4('0x28')]=_[_0x4ed4('0x2a')](_0x1e4877['model'],_0x1e4877[_0x4ed4('0x23')]);_0x40f608[_0x4ed4('0x29')]=_['intersection'](_0x1e4877['model'],qs[_0x4ed4('0x2b')](_0x261c1b[_0x4ed4('0x23')][_0x4ed4('0x2b')]));_0x40f608[_0x4ed4('0x29')]=_0x40f608['attributes'][_0x4ed4('0x2c')]?_0x40f608[_0x4ed4('0x29')]:_0x1e4877[_0x4ed4('0x26')];_0x40f608[_0x4ed4('0x3f')]=qs[_0x4ed4('0x40')](_0x261c1b['query']['sort']);_0x40f608[_0x4ed4('0x20')]=qs[_0x4ed4('0x28')](_[_0x4ed4('0x41')](_0x261c1b[_0x4ed4('0x23')],_0x1e4877[_0x4ed4('0x28')]));if(_0x261c1b[_0x4ed4('0x23')]['filter']){_0x40f608[_0x4ed4('0x20')]=_[_0x4ed4('0x44')](_0x40f608[_0x4ed4('0x20')],{'$or':_['map'](_0x40f608[_0x4ed4('0x29')],function(_0x167b17){var _0x1387bb={};_0x1387bb[_0x167b17]={'$like':'%'+_0x261c1b[_0x4ed4('0x23')][_0x4ed4('0x43')]+'%'};return _0x1387bb;})});}_0x40f608=_['merge']({},_0x40f608,_0x261c1b[_0x4ed4('0x2e')]);return _0xdd604e['getAgents'](_0x40f608);}})[_0x4ed4('0x13')](function(_0xe6e034){if(_0xe6e034){_0x21ccd0=_0xe6e034[_0x4ed4('0x2c')];if(!_0x261c1b[_0x4ed4('0x23')]['hasOwnProperty']('nolimit')){_0x40f608[_0x4ed4('0xe')]=qs['limit'](_0x261c1b[_0x4ed4('0x23')][_0x4ed4('0xe')]);_0x40f608[_0x4ed4('0x10')]=qs['offset'](_0x261c1b[_0x4ed4('0x23')][_0x4ed4('0x10')]);}return _0xdd604e[_0x4ed4('0x7a')](_0x40f608);}})[_0x4ed4('0x13')](function(_0x3cbd14){if(_0x3cbd14){return _0x3cbd14?{'count':_0x21ccd0,'rows':_0x3cbd14}:null;}})[_0x4ed4('0x13')](respondWithResult(_0x3a07e1,null))['catch'](handleError(_0x3a07e1,null));}; \ No newline at end of file +var _0x090e=['findOrCreate','emit','removeTeams','ids','select','field','tq.TeamId','from','user_has_teams','ut.TeamId\x20=\x20tq.TeamId','ChatQueueId\x20=\x20?','toString','SELECT','every','includes','all','union','value','isEmpty','removeAgents','userChatQueue:remove','addAgents','omit','userChatQueue:save','isArray','getAgents','hasOwnProperty','bluebird','util','lodash','squel','ioredis','../../components/parsers/qs','../../config/logger','api','../../mysqldb','redis','defaults','socket.io-emitter','./chatQueue.socket','register','sendStatus','status','end','json','undefined','limit','offset','set','Content-Range','update','then','get','UserProfileResource','destroy','name','send','index','map','fieldName','key','getOptions','where','ChatQueue','count','include','query','findAll','catch','keys','rawAttributes','filters','attributes','model','fields','length','merge','options','Unable\x20to\x20retrieve\x20the\x20current\x20user','role','user','ChatQueues','find','userProfileId','create','error','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','body','params','describe','getMembers','findOne','UserChatQueue','intersection','nolimit','pick','ChatQueueId','filter','User','UserId','agent','chatPause','createdAt','rows','%s/%s','SIP','Team','order','sort','getTeams','addTeams','Agents','online','interface','flatMap','sequelize','transaction','each'];(function(_0x128dec,_0x4c9251){var _0x31a4c1=function(_0x587372){while(--_0x587372){_0x128dec['push'](_0x128dec['shift']());}};_0x31a4c1(++_0x4c9251);}(_0x090e,0x1f3));var _0xe090=function(_0x1c3281,_0x5c69a0){_0x1c3281=_0x1c3281-0x0;var _0x27588d=_0x090e[_0x1c3281];return _0x27588d;};'use strict';var BPromise=require(_0xe090('0x0'));var util=require(_0xe090('0x1'));var _=require(_0xe090('0x2'));var squel=require(_0xe090('0x3'));var Redis=require(_0xe090('0x4'));var qs=require(_0xe090('0x5'));var logger=require(_0xe090('0x6'))(_0xe090('0x7'));var config=require('../../config/environment');var db=require(_0xe090('0x8'))['db'];config[_0xe090('0x9')]=_[_0xe090('0xa')](config[_0xe090('0x9')],{'host':'localhost','port':0x18eb});var socket=require(_0xe090('0xb'))(new Redis(config[_0xe090('0x9')]));require(_0xe090('0xc'))[_0xe090('0xd')](socket);function respondWithStatusCode(_0x209af3,_0x4f4c08){_0x4f4c08=_0x4f4c08||0xcc;return function(_0x55d8aa){if(_0x55d8aa){return _0x209af3[_0xe090('0xe')](_0x4f4c08);}return _0x209af3[_0xe090('0xf')](_0x4f4c08)[_0xe090('0x10')]();};}function respondWithResult(_0x4058cd,_0x4d39cd){_0x4d39cd=_0x4d39cd||0xc8;return function(_0x31513b){if(_0x31513b){return _0x4058cd[_0xe090('0xf')](_0x4d39cd)[_0xe090('0x11')](_0x31513b);}};}function respondWithFilteredResult(_0x230469,_0x371ee7){return function(_0x1fe45c){if(_0x1fe45c){var _0x1da5cb=typeof _0x371ee7['offset']===_0xe090('0x12')&&typeof _0x371ee7[_0xe090('0x13')]==='undefined';var _0x1673dc=_0x1fe45c['count'];var _0x1a2343=_0x1da5cb?0x0:_0x371ee7['offset'];var _0x21c4b5=_0x1da5cb?_0x1fe45c['count']:_0x371ee7[_0xe090('0x14')]+_0x371ee7[_0xe090('0x13')];var _0x4a443a;if(_0x21c4b5>=_0x1673dc){_0x21c4b5=_0x1673dc;_0x4a443a=0xc8;}else{_0x4a443a=0xce;}_0x230469[_0xe090('0xf')](_0x4a443a);return _0x230469[_0xe090('0x15')](_0xe090('0x16'),_0x1a2343+'-'+_0x21c4b5+'/'+_0x1673dc)[_0xe090('0x11')](_0x1fe45c);}return null;};}function saveUpdates(_0x41ee9c){return function(_0x2873b9){if(_0x2873b9){return _0x2873b9[_0xe090('0x17')](_0x41ee9c)[_0xe090('0x18')](function(_0x212eba){return _0x212eba;});}return null;};}function removeEntity(_0x1732f1){return function(_0x3b2c4b){if(_0x3b2c4b){return _0x3b2c4b['destroy']()['then'](function(){var _0x5de05e=_0x3b2c4b[_0xe090('0x19')]({'plain':!![]});var _0x19563a='ChatQueues';return db[_0xe090('0x1a')][_0xe090('0x1b')]({'where':{'type':_0x19563a,'resourceId':_0x5de05e['id']}})[_0xe090('0x18')](function(){return _0x3b2c4b;});})[_0xe090('0x18')](function(){_0x1732f1[_0xe090('0xf')](0xcc)['end']();});}};}function handleEntityNotFound(_0x4ad792){return function(_0x23183f){if(!_0x23183f){_0x4ad792[_0xe090('0xe')](0x194);}return _0x23183f;};}function handleError(_0x43e58e,_0x3f8e37){_0x3f8e37=_0x3f8e37||0x1f4;return function(_0x21a2c3){logger['error'](_0x21a2c3['stack']);if(_0x21a2c3[_0xe090('0x1c')]){delete _0x21a2c3['name'];}_0x43e58e['status'](_0x3f8e37)[_0xe090('0x1d')](_0x21a2c3);};}exports[_0xe090('0x1e')]=function(_0x3d8879,_0x228133){var _0x4782ca={};var _0x3c432a={'count':0x0,'rows':[]};var _0x14a1db=_[_0xe090('0x1f')](db['ChatQueue']['rawAttributes'],function(_0x3e44d8){return{'name':_0x3e44d8[_0xe090('0x20')],'type':_0x3e44d8['type'][_0xe090('0x21')]};});_0x4782ca=qs[_0xe090('0x22')](_0x14a1db,_0x3d8879);var _0x362ef5={'where':_0x4782ca[_0xe090('0x23')]};return db[_0xe090('0x24')][_0xe090('0x25')](_0x362ef5)[_0xe090('0x18')](function(_0x4fe450){_0x3c432a['count']=_0x4fe450;_0x4782ca[_0xe090('0x26')]=qs[_0xe090('0x26')](_0x3d8879[_0xe090('0x27')]);return db['ChatQueue'][_0xe090('0x28')](_0x4782ca);})['then'](function(_0x5a268b){_0x3c432a['rows']=_0x5a268b;return _0x3c432a;})['then'](respondWithFilteredResult(_0x228133,_0x4782ca))[_0xe090('0x29')](handleError(_0x228133,null));};exports['show']=function(_0x3e8281,_0x5e72a5){var _0x195740={'raw':!![],'where':{'id':_0x3e8281['params']['id']}},_0x307ca3={};_0x307ca3['model']=_[_0xe090('0x2a')](db['ChatQueue'][_0xe090('0x2b')]);_0x307ca3[_0xe090('0x27')]=_[_0xe090('0x2a')](_0x3e8281[_0xe090('0x27')]);_0x307ca3[_0xe090('0x2c')]=_['intersection'](_0x307ca3['model'],_0x307ca3['query']);_0x195740[_0xe090('0x2d')]=_['intersection'](_0x307ca3[_0xe090('0x2e')],qs[_0xe090('0x2f')](_0x3e8281[_0xe090('0x27')]['fields']));_0x195740['attributes']=_0x195740[_0xe090('0x2d')][_0xe090('0x30')]?_0x195740[_0xe090('0x2d')]:_0x307ca3[_0xe090('0x2e')];if(_0x3e8281[_0xe090('0x27')]['includeAll']){_0x195740[_0xe090('0x26')]=[{'all':!![]}];}_0x195740=_[_0xe090('0x31')]({},_0x195740,_0x3e8281[_0xe090('0x32')]);return db[_0xe090('0x24')]['find'](_0x195740)[_0xe090('0x18')](handleEntityNotFound(_0x5e72a5,null))[_0xe090('0x18')](respondWithResult(_0x5e72a5,null))[_0xe090('0x29')](handleError(_0x5e72a5,null));};exports['create']=function(_0x5b568e,_0x4f8798){return db[_0xe090('0x24')]['create'](_0x5b568e['body'],{})[_0xe090('0x18')](function(_0x230dd4){var _0x2bb909=_0x5b568e['user'][_0xe090('0x19')]({'plain':!![]});if(!_0x2bb909)throw new Error(_0xe090('0x33'));if(_0x2bb909[_0xe090('0x34')]===_0xe090('0x35')){var _0x33ec4d=_0x230dd4[_0xe090('0x19')]({'plain':!![]});var _0x43e551=_0xe090('0x36');return db['UserProfileSection'][_0xe090('0x37')]({'where':{'name':_0x43e551,'userProfileId':_0x2bb909[_0xe090('0x38')]},'raw':!![]})[_0xe090('0x18')](function(_0x4b7283){if(_0x4b7283&&_0x4b7283['autoAssociation']===0x0){return db[_0xe090('0x1a')][_0xe090('0x39')]({'name':_0x33ec4d[_0xe090('0x1c')],'resourceId':_0x33ec4d['id'],'type':_0x4b7283[_0xe090('0x1c')],'sectionId':_0x4b7283['id']},{})[_0xe090('0x18')](function(){return _0x230dd4;});}else{return _0x230dd4;}})['catch'](function(_0x202cb3){logger[_0xe090('0x3a')](_0xe090('0x3b'),_0x202cb3);throw _0x202cb3;});}return _0x230dd4;})[_0xe090('0x18')](respondWithResult(_0x4f8798,0xc9))[_0xe090('0x29')](handleError(_0x4f8798,null));};exports[_0xe090('0x17')]=function(_0x1f49f6,_0x2c076f){if(_0x1f49f6[_0xe090('0x3c')]['id']){delete _0x1f49f6[_0xe090('0x3c')]['id'];}return db[_0xe090('0x24')]['find']({'where':{'id':_0x1f49f6[_0xe090('0x3d')]['id']}})[_0xe090('0x18')](handleEntityNotFound(_0x2c076f,null))[_0xe090('0x18')](saveUpdates(_0x1f49f6['body'],null))[_0xe090('0x18')](respondWithResult(_0x2c076f,null))[_0xe090('0x29')](handleError(_0x2c076f,null));};exports[_0xe090('0x1b')]=function(_0x569806,_0x435417){return db['ChatQueue'][_0xe090('0x37')]({'where':{'id':_0x569806['params']['id']}})[_0xe090('0x18')](handleEntityNotFound(_0x435417,null))[_0xe090('0x18')](removeEntity(_0x435417,null))['catch'](handleError(_0x435417,null));};exports[_0xe090('0x3e')]=function(_0x1f83fa,_0x512d52){return db[_0xe090('0x24')]['describe']()[_0xe090('0x18')](respondWithResult(_0x512d52,null))[_0xe090('0x29')](handleError(_0x512d52,null));};exports[_0xe090('0x3f')]=function(_0x468bef,_0x196561){var _0x9e1b00={'raw':!![],'where':{}},_0x67d882={},_0x3b1fb9;return db[_0xe090('0x24')][_0xe090('0x40')]({'where':{'id':_0x468bef['params']['id']}})[_0xe090('0x18')](handleEntityNotFound(_0x196561,null))['then'](function(_0x327c19){if(_0x327c19){_0x3b1fb9=_0x327c19[_0xe090('0x19')]({'plain':!![]});_0x67d882[_0xe090('0x2e')]=_[_0xe090('0x2a')](db[_0xe090('0x41')][_0xe090('0x2b')]);_0x67d882['query']=_['keys'](_0x468bef[_0xe090('0x27')]);_0x67d882[_0xe090('0x2c')]=_[_0xe090('0x42')](_0x67d882[_0xe090('0x2e')],_0x67d882['query']);_0x9e1b00[_0xe090('0x2d')]=_[_0xe090('0x42')](_0x67d882[_0xe090('0x2e')],qs[_0xe090('0x2f')](_0x468bef['query'][_0xe090('0x2f')]));_0x9e1b00[_0xe090('0x2d')]=_0x9e1b00[_0xe090('0x2d')][_0xe090('0x30')]?_0x9e1b00[_0xe090('0x2d')]:_0x67d882[_0xe090('0x2e')];if(!_0x468bef['query']['hasOwnProperty'](_0xe090('0x43'))){_0x9e1b00[_0xe090('0x13')]=qs[_0xe090('0x13')](_0x468bef[_0xe090('0x27')]['limit']);_0x9e1b00[_0xe090('0x14')]=qs[_0xe090('0x14')](_0x468bef[_0xe090('0x27')]['offset']);}_0x9e1b00['order']=qs['sort'](_0x468bef[_0xe090('0x27')]['sort']);_0x9e1b00[_0xe090('0x23')]=qs[_0xe090('0x2c')](_[_0xe090('0x44')](_0x468bef[_0xe090('0x27')],_0x67d882['filters']));_0x9e1b00[_0xe090('0x23')][_0xe090('0x45')]=_0x327c19['id'];if(_0x468bef[_0xe090('0x27')][_0xe090('0x46')]){_0x9e1b00[_0xe090('0x23')]=_[_0xe090('0x31')](_0x9e1b00['where'],{'$or':_['map'](_0x9e1b00[_0xe090('0x2d')],function(_0x5277d3){var _0x199dd9={};_0x199dd9[_0x5277d3]={'$like':'%'+_0x468bef['query'][_0xe090('0x46')]+'%'};return _0x199dd9;})});}_0x9e1b00=_[_0xe090('0x31')]({},_0x9e1b00,_0x468bef[_0xe090('0x32')]);return db[_0xe090('0x41')][_0xe090('0x28')](_0x9e1b00);}})[_0xe090('0x18')](function(_0x58727c){if(_0x58727c){return db[_0xe090('0x47')]['findAndCountAll']({'where':{'id':_[_0xe090('0x1f')](_0x58727c,_0xe090('0x48')),'role':_0xe090('0x49')},'attributes':['id','name',_0xe090('0x4a'),'updatedAt',_0xe090('0x4b')]});}})[_0xe090('0x18')](function(_0x10e00c){if(_0x10e00c){return{'count':_0x10e00c[_0xe090('0x25')],'rows':_[_0xe090('0x1f')](_0x10e00c[_0xe090('0x4c')],function(_0x4bddb9){return{'membername':_0x4bddb9[_0xe090('0x1c')],'UserId':_0x4bddb9['id'],'queue_name':_0x3b1fb9[_0xe090('0x1c')],'ChatQueueId':_0x3b1fb9['id'],'interface':util['format'](_0xe090('0x4d'),_0xe090('0x4e'),_0x4bddb9[_0xe090('0x1c')]),'penalty':0x0,'paused':_0x4bddb9[_0xe090('0x4a')],'createdAt':_0x4bddb9[_0xe090('0x4b')],'updatedAt':_0x4bddb9['updatedAt']};})};}else{return{'count':0x0,'rows':[]};}})[_0xe090('0x18')](respondWithFilteredResult(_0x196561,_0x9e1b00))[_0xe090('0x29')](handleError(_0x196561,null));};exports['getTeams']=function(_0x9d1222,_0x59ed9e){var _0x598eca={};var _0x3612e0={};var _0x2df632;var _0x3a5e97;return db[_0xe090('0x24')][_0xe090('0x40')]({'where':{'id':_0x9d1222[_0xe090('0x3d')]['id']}})['then'](handleEntityNotFound(_0x59ed9e,null))[_0xe090('0x18')](function(_0x6b8df8){if(_0x6b8df8){_0x2df632=_0x6b8df8;_0x3612e0['model']=_[_0xe090('0x2a')](db[_0xe090('0x4f')][_0xe090('0x2b')]);_0x3612e0[_0xe090('0x27')]=_[_0xe090('0x2a')](_0x9d1222['query']);_0x3612e0['filters']=_[_0xe090('0x42')](_0x3612e0['model'],_0x3612e0[_0xe090('0x27')]);_0x598eca[_0xe090('0x2d')]=_[_0xe090('0x42')](_0x3612e0[_0xe090('0x2e')],qs['fields'](_0x9d1222['query'][_0xe090('0x2f')]));_0x598eca['attributes']=_0x598eca[_0xe090('0x2d')]['length']?_0x598eca[_0xe090('0x2d')]:_0x3612e0[_0xe090('0x2e')];_0x598eca[_0xe090('0x50')]=qs[_0xe090('0x51')](_0x9d1222[_0xe090('0x27')][_0xe090('0x51')]);_0x598eca[_0xe090('0x23')]=qs[_0xe090('0x2c')](_['pick'](_0x9d1222[_0xe090('0x27')],_0x3612e0[_0xe090('0x2c')]));if(_0x9d1222[_0xe090('0x27')][_0xe090('0x46')]){_0x598eca['where']=_[_0xe090('0x31')](_0x598eca['where'],{'$or':_[_0xe090('0x1f')](_0x598eca[_0xe090('0x2d')],function(_0x57f36b){var _0x476bea={};_0x476bea[_0x57f36b]={'$like':'%'+_0x9d1222[_0xe090('0x27')][_0xe090('0x46')]+'%'};return _0x476bea;})});}_0x598eca=_['merge']({},_0x598eca,_0x9d1222['options']);return _0x2df632[_0xe090('0x52')](_0x598eca);}})[_0xe090('0x18')](function(_0x336a9e){if(_0x336a9e){_0x3a5e97=_0x336a9e[_0xe090('0x30')];if(!_0x9d1222['query']['hasOwnProperty'](_0xe090('0x43'))){_0x598eca['limit']=qs[_0xe090('0x13')](_0x9d1222[_0xe090('0x27')][_0xe090('0x13')]);_0x598eca[_0xe090('0x14')]=qs[_0xe090('0x14')](_0x9d1222[_0xe090('0x27')][_0xe090('0x14')]);}return _0x2df632[_0xe090('0x52')](_0x598eca);}})[_0xe090('0x18')](function(_0x1f6485){if(_0x1f6485){return _0x1f6485?{'count':_0x3a5e97,'rows':_0x1f6485}:null;}})[_0xe090('0x18')](respondWithResult(_0x59ed9e,null))[_0xe090('0x29')](handleError(_0x59ed9e,null));};exports[_0xe090('0x53')]=function(_0x3826b2,_0x5a7d92){var _0x558701=_0x3826b2[_0xe090('0x3c')]['ids'];return db['Team'][_0xe090('0x28')]({'where':{'id':_0x558701},'attributes':['id'],'include':[{'model':db[_0xe090('0x47')],'as':_0xe090('0x54'),'attributes':['id',_0xe090('0x1c'),_0xe090('0x55'),'voicePause',_0xe090('0x56')],'raw':!![]}]})[_0xe090('0x18')](function(_0x42ccec){if(_0x42ccec){var _0x29f7f6=_[_0xe090('0x57')](_0x42ccec,function(_0x4eadb2){var _0x15d35c=_0x4eadb2[_0xe090('0x19')]({'plain':!![]});return _0x15d35c['Agents'];});return db[_0xe090('0x24')][_0xe090('0x37')]({'where':{'id':_0x3826b2[_0xe090('0x3d')]['id']}})[_0xe090('0x18')](function(_0x49cad3){return db[_0xe090('0x58')][_0xe090('0x59')](function(_0x5ee208){return _0x49cad3['addTeams'](_0x558701,{'transaction':_0x5ee208})[_0xe090('0x18')](function(){return BPromise[_0xe090('0x5a')](_0x29f7f6,function(_0x1082e8){return db['UserChatQueue'][_0xe090('0x5b')]({'where':{'UserId':_0x1082e8['id'],'ChatQueueId':_0x3826b2['params']['id']},'transaction':_0x5ee208});});})['then'](function(){_0x29f7f6['forEach'](function(_0xf0f79d){socket[_0xe090('0x5c')]('userChatQueue:save',{'UserId':_0xf0f79d['id'],'ChatQueueId':_0x49cad3['id']});});});});});}})[_0xe090('0x18')](respondWithStatusCode(_0x5a7d92,null))[_0xe090('0x29')](handleError(_0x5a7d92,null));};exports[_0xe090('0x5d')]=function(_0x1b1785,_0x5cd3e0){return db[_0xe090('0x4f')][_0xe090('0x28')]({'where':{'id':_0x1b1785[_0xe090('0x27')][_0xe090('0x5e')]},'attributes':['id'],'include':[{'model':db[_0xe090('0x47')],'as':_0xe090('0x54'),'attributes':['id'],'raw':!![]}]})['then'](handleEntityNotFound(_0x5cd3e0,null))['then'](function(_0x598290){var _0x16600b=_[_0xe090('0x1f')](_0x598290,'id');var _0x3c062d=[];var _0xddc32b=[];var _0x5a748a=squel[_0xe090('0x5f')]();_0x5a748a[_0xe090('0x60')](_0xe090('0x61'))[_0xe090('0x62')]('team_has_chat_queues','tq')['join'](_0xe090('0x63'),'ut',_0xe090('0x64'))[_0xe090('0x23')](_0xe090('0x65'),_0x1b1785[_0xe090('0x3d')]['id']);for(var _0x2ab6d8=0x0;_0x2ab6d8<_0x598290[_0xe090('0x30')];_0x2ab6d8+=0x1){let _0x5e59ed=_0x598290[_0x2ab6d8];for(var _0x147b5f=0x0;_0x147b5f<_0x5e59ed[_0xe090('0x54')][_0xe090('0x30')];_0x147b5f+=0x1){let _0x2268b7=_0x5e59ed['Agents'][_0x147b5f];var _0x33d8f4=_0x5a748a['clone']();_0x33d8f4[_0xe090('0x23')]('ut.UserId\x20=\x20?',_0x2268b7['id']);_0xddc32b['push'](db[_0xe090('0x58')][_0xe090('0x27')](_0x33d8f4[_0xe090('0x66')](),{'type':db[_0xe090('0x58')]['QueryTypes'][_0xe090('0x67')]})[_0xe090('0x18')](function(_0x35d8e1){if(_0x35d8e1[_0xe090('0x30')]===0x1){return _0x2268b7['id'];}else{var _0x33a088=_[_0xe090('0x68')](_['map'](_0x35d8e1,'TeamId'),function(_0x4d2b5c){return _[_0xe090('0x69')](_0x16600b,_0x4d2b5c);});if(_0x33a088){return _0x2268b7['id'];}}}));}}return BPromise[_0xe090('0x6a')](_0xddc32b)[_0xe090('0x18')](function(_0x426b22){_0x3c062d=_(_0x3c062d)[_0xe090('0x6b')](_0x426b22)['compact']()[_0xe090('0x6c')]();return db[_0xe090('0x24')][_0xe090('0x37')]({'where':{'id':_0x1b1785[_0xe090('0x3d')]['id']}})[_0xe090('0x18')](function(_0x3714ff){return db['sequelize'][_0xe090('0x59')](function(_0x1b1eca){return _0x3714ff[_0xe090('0x5d')](_0x1b1785[_0xe090('0x27')][_0xe090('0x5e')],{'transaction':_0x1b1eca})[_0xe090('0x18')](function(){if(!_[_0xe090('0x6d')](_0x3c062d)){return _0x3714ff[_0xe090('0x6e')](_0x3c062d,{'transaction':_0x1b1eca});}})[_0xe090('0x18')](function(){_0x3c062d['forEach'](function(_0x30053d){socket[_0xe090('0x5c')](_0xe090('0x6f'),{'UserId':_0x30053d,'ChatQueueId':_0x3714ff['id']});});});});});});})[_0xe090('0x18')](respondWithStatusCode(_0x5cd3e0,null))['catch'](handleError(_0x5cd3e0,null));};exports[_0xe090('0x70')]=function(_0x4f8836,_0x439862){return db[_0xe090('0x24')][_0xe090('0x37')]({'where':{'id':_0x4f8836['params']['id']}})['then'](handleEntityNotFound(_0x439862,null))[_0xe090('0x18')](function(_0x11c8d3){if(_0x11c8d3){return _0x11c8d3[_0xe090('0x70')](_0x4f8836[_0xe090('0x3c')][_0xe090('0x5e')],_[_0xe090('0x71')](_0x4f8836['body'],[_0xe090('0x5e'),'id'])||{})['spread'](function(_0x34fce7){for(var _0x55a39d=0x0;_0x55a39d<_0x4f8836[_0xe090('0x3c')][_0xe090('0x5e')][_0xe090('0x30')];_0x55a39d+=0x1){socket[_0xe090('0x5c')](_0xe090('0x72'),{'UserId':Number(_0x4f8836[_0xe090('0x3c')]['ids'][_0x55a39d]),'ChatQueueId':Number(_0x4f8836[_0xe090('0x3d')]['id'])});}return _0x34fce7;});}})[_0xe090('0x18')](respondWithResult(_0x439862,null))[_0xe090('0x29')](handleError(_0x439862,null));};exports[_0xe090('0x6e')]=function(_0x99a96f,_0x4e024f){return db[_0xe090('0x24')][_0xe090('0x37')]({'where':{'id':_0x99a96f[_0xe090('0x3d')]['id']}})[_0xe090('0x18')](handleEntityNotFound(_0x4e024f,null))['then'](function(_0x105b64){if(_0x105b64){return _0x105b64['removeAgents'](_0x99a96f[_0xe090('0x27')][_0xe090('0x5e')])[_0xe090('0x18')](function(){if(_[_0xe090('0x73')](_0x99a96f[_0xe090('0x27')][_0xe090('0x5e')])){for(var _0x5b3fbb=0x0;_0x5b3fbb<_0x99a96f['query'][_0xe090('0x5e')][_0xe090('0x30')];_0x5b3fbb+=0x1){socket[_0xe090('0x5c')](_0xe090('0x6f'),{'UserId':Number(_0x99a96f['query']['ids'][_0x5b3fbb]),'ChatQueueId':Number(_0x99a96f['params']['id'])});}}else{socket[_0xe090('0x5c')]('userChatQueue:remove',{'UserId':Number(_0x99a96f[_0xe090('0x27')][_0xe090('0x5e')]),'ChatQueueId':Number(_0x99a96f[_0xe090('0x3d')]['id'])});}});}})[_0xe090('0x18')](respondWithStatusCode(_0x4e024f,null))[_0xe090('0x29')](handleError(_0x4e024f,null));};exports[_0xe090('0x74')]=function(_0x37cf64,_0x35d0d8){var _0x185945={};var _0x24884d={};var _0x49a99c;var _0x345659;return db[_0xe090('0x24')]['findOne']({'where':{'id':_0x37cf64[_0xe090('0x3d')]['id']}})[_0xe090('0x18')](handleEntityNotFound(_0x35d0d8,null))[_0xe090('0x18')](function(_0x2339dd){if(_0x2339dd){_0x49a99c=_0x2339dd;_0x24884d[_0xe090('0x2e')]=_[_0xe090('0x2a')](db[_0xe090('0x47')]['rawAttributes']);_0x24884d[_0xe090('0x27')]=_[_0xe090('0x2a')](_0x37cf64['query']);_0x24884d[_0xe090('0x2c')]=_[_0xe090('0x42')](_0x24884d['model'],_0x24884d[_0xe090('0x27')]);_0x185945[_0xe090('0x2d')]=_[_0xe090('0x42')](_0x24884d[_0xe090('0x2e')],qs[_0xe090('0x2f')](_0x37cf64[_0xe090('0x27')][_0xe090('0x2f')]));_0x185945[_0xe090('0x2d')]=_0x185945[_0xe090('0x2d')]['length']?_0x185945[_0xe090('0x2d')]:_0x24884d[_0xe090('0x2e')];_0x185945[_0xe090('0x50')]=qs[_0xe090('0x51')](_0x37cf64[_0xe090('0x27')][_0xe090('0x51')]);_0x185945[_0xe090('0x23')]=qs['filters'](_[_0xe090('0x44')](_0x37cf64[_0xe090('0x27')],_0x24884d['filters']));if(_0x37cf64[_0xe090('0x27')]['filter']){_0x185945[_0xe090('0x23')]=_[_0xe090('0x31')](_0x185945[_0xe090('0x23')],{'$or':_[_0xe090('0x1f')](_0x185945[_0xe090('0x2d')],function(_0x49eda9){var _0x22b690={};_0x22b690[_0x49eda9]={'$like':'%'+_0x37cf64[_0xe090('0x27')][_0xe090('0x46')]+'%'};return _0x22b690;})});}_0x185945=_['merge']({},_0x185945,_0x37cf64['options']);return _0x49a99c[_0xe090('0x74')](_0x185945);}})[_0xe090('0x18')](function(_0x571639){if(_0x571639){_0x345659=_0x571639[_0xe090('0x30')];if(!_0x37cf64[_0xe090('0x27')][_0xe090('0x75')](_0xe090('0x43'))){_0x185945[_0xe090('0x13')]=qs[_0xe090('0x13')](_0x37cf64['query'][_0xe090('0x13')]);_0x185945[_0xe090('0x14')]=qs[_0xe090('0x14')](_0x37cf64[_0xe090('0x27')][_0xe090('0x14')]);}return _0x49a99c[_0xe090('0x74')](_0x185945);}})[_0xe090('0x18')](function(_0x16b6df){if(_0x16b6df){return _0x16b6df?{'count':_0x345659,'rows':_0x16b6df}:null;}})['then'](respondWithResult(_0x35d0d8,null))[_0xe090('0x29')](handleError(_0x35d0d8,null));}; \ No newline at end of file diff --git a/server/api/chatQueue/chatQueue.events.js b/server/api/chatQueue/chatQueue.events.js index 4bcc78a..6c33f39 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 _0x06b2=['update','remove','emit','hasOwnProperty','hook','exports','events','../../mysqldb','ChatQueue','setMaxListeners','save'];(function(_0x2b31a8,_0x28b862){var _0x1175a5=function(_0x2cdb5d){while(--_0x2cdb5d){_0x2b31a8['push'](_0x2b31a8['shift']());}};_0x1175a5(++_0x28b862);}(_0x06b2,0x124));var _0x206b=function(_0x2f89f9,_0x5938df){_0x2f89f9=_0x2f89f9-0x0;var _0x560515=_0x06b2[_0x2f89f9];return _0x560515;};'use strict';var EventEmitter=require(_0x206b('0x0'));var ChatQueue=require(_0x206b('0x1'))['db'][_0x206b('0x2')];var ChatQueueEvents=new EventEmitter();ChatQueueEvents[_0x206b('0x3')](0x0);var events={'afterCreate':_0x206b('0x4'),'afterUpdate':_0x206b('0x5'),'afterDestroy':_0x206b('0x6')};function emitEvent(_0x11b682){return function(_0x5b1786,_0xbf5e41,_0x3b333e){ChatQueueEvents[_0x206b('0x7')](_0x11b682+':'+_0x5b1786['id'],_0x5b1786);ChatQueueEvents[_0x206b('0x7')](_0x11b682,_0x5b1786);_0x3b333e(null);};}for(var e in events){if(events[_0x206b('0x8')](e)){var event=events[e];ChatQueue[_0x206b('0x9')](e,emitEvent(event));}}module[_0x206b('0xa')]=ChatQueueEvents; \ No newline at end of file +var _0x5d8d=['save','update','remove','emit','hasOwnProperty','hook','exports','events','../../mysqldb','ChatQueue','setMaxListeners'];(function(_0x53ed59,_0x4beb34){var _0x5834ca=function(_0x5f51f0){while(--_0x5f51f0){_0x53ed59['push'](_0x53ed59['shift']());}};_0x5834ca(++_0x4beb34);}(_0x5d8d,0x1a9));var _0xd5d8=function(_0x388e36,_0x181d8c){_0x388e36=_0x388e36-0x0;var _0x6a2ee=_0x5d8d[_0x388e36];return _0x6a2ee;};'use strict';var EventEmitter=require(_0xd5d8('0x0'));var ChatQueue=require(_0xd5d8('0x1'))['db'][_0xd5d8('0x2')];var ChatQueueEvents=new EventEmitter();ChatQueueEvents[_0xd5d8('0x3')](0x0);var events={'afterCreate':_0xd5d8('0x4'),'afterUpdate':_0xd5d8('0x5'),'afterDestroy':_0xd5d8('0x6')};function emitEvent(_0x4d6111){return function(_0x2c8929,_0x51f6d1,_0x5752f5){ChatQueueEvents[_0xd5d8('0x7')](_0x4d6111+':'+_0x2c8929['id'],_0x2c8929);ChatQueueEvents['emit'](_0x4d6111,_0x2c8929);_0x5752f5(null);};}for(var e in events){if(events[_0xd5d8('0x8')](e)){var event=events[e];ChatQueue[_0xd5d8('0x9')](e,emitEvent(event));}}module[_0xd5d8('0xa')]=ChatQueueEvents; \ No newline at end of file diff --git a/server/api/chatQueue/chatQueue.model.js b/server/api/chatQueue/chatQueue.model.js index d7a4364..c513e78 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 _0x1037=['define','ChatQueue','chat_queues','lodash','../../config/logger','api','moment','bluebird','request-promise','path','rimraf','./chatQueue.attributes'];(function(_0x1e5892,_0x2cabab){var _0x4187ce=function(_0x30fa90){while(--_0x30fa90){_0x1e5892['push'](_0x1e5892['shift']());}};_0x4187ce(++_0x2cabab);}(_0x1037,0x153));var _0x7103=function(_0x244862,_0x3da79e){_0x244862=_0x244862-0x0;var _0x2bce23=_0x1037[_0x244862];return _0x2bce23;};'use strict';var _=require(_0x7103('0x0'));var util=require('util');var logger=require(_0x7103('0x1'))(_0x7103('0x2'));var moment=require(_0x7103('0x3'));var BPromise=require(_0x7103('0x4'));var rp=require(_0x7103('0x5'));var fs=require('fs');var path=require(_0x7103('0x6'));var rimraf=require(_0x7103('0x7'));var config=require('../../config/environment');var attributes=require(_0x7103('0x8'));module['exports']=function(_0x3b5fd2,_0x4f82f2){return _0x3b5fd2[_0x7103('0x9')](_0x7103('0xa'),attributes,{'tableName':_0x7103('0xb'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x11b9=['ChatQueue','lodash','util','api','bluebird','path','rimraf','../../config/environment','./chatQueue.attributes','define'];(function(_0x5b88ce,_0x2fcffb){var _0x4ae0e2=function(_0x1d148c){while(--_0x1d148c){_0x5b88ce['push'](_0x5b88ce['shift']());}};_0x4ae0e2(++_0x2fcffb);}(_0x11b9,0x1d7));var _0x911b=function(_0x27438f,_0x528d78){_0x27438f=_0x27438f-0x0;var _0x58ab45=_0x11b9[_0x27438f];return _0x58ab45;};'use strict';var _=require(_0x911b('0x0'));var util=require(_0x911b('0x1'));var logger=require('../../config/logger')(_0x911b('0x2'));var moment=require('moment');var BPromise=require(_0x911b('0x3'));var rp=require('request-promise');var fs=require('fs');var path=require(_0x911b('0x4'));var rimraf=require(_0x911b('0x5'));var config=require(_0x911b('0x6'));var attributes=require(_0x911b('0x7'));module['exports']=function(_0x549d1d,_0x51c8ee){return _0x549d1d[_0x911b('0x8')](_0x911b('0x9'),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 7e825d3..41ec148 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 _0x3ef1=['rpc','http','defaults','localhost','redis','register','request','ChatQueue,\x20%s,\x20%s','request\x20sent','debug','stringify','error','message','info','result','GetChatQueue','ChatQueue','findAll','options','where','limit','include','attributes','map','model','catch','ShowChatQueue','then','lodash','util','randomstring','../../mysqldb','../../config/utils'];(function(_0x15f671,_0x8d309e){var _0x16393f=function(_0x4cc3eb){while(--_0x4cc3eb){_0x15f671['push'](_0x15f671['shift']());}};_0x16393f(++_0x8d309e);}(_0x3ef1,0x187));var _0x13ef=function(_0x1caf6a,_0x26a5bf){_0x1caf6a=_0x1caf6a-0x0;var _0x1bf493=_0x3ef1[_0x1caf6a];return _0x1bf493;};'use strict';var _=require(_0x13ef('0x0'));var util=require(_0x13ef('0x1'));var moment=require('moment');var BPromise=require('bluebird');var rs=require(_0x13ef('0x2'));var fs=require('fs');var Redis=require('ioredis');var db=require(_0x13ef('0x3'))['db'];var utils=require(_0x13ef('0x4'));var logger=require('../../config/logger')(_0x13ef('0x5'));var config=require('../../config/environment');var jayson=require('jayson/promise');var client=jayson['client'][_0x13ef('0x6')]({'port':0x232a});config['redis']=_[_0x13ef('0x7')](config['redis'],{'host':_0x13ef('0x8'),'port':0x18eb});var socket=require('socket.io-emitter')(new Redis(config[_0x13ef('0x9')]));require('./chatQueue.socket')[_0x13ef('0xa')](socket);function respondWithRpcPromise(_0x394d2f,_0x336920,_0x165563){return new BPromise(function(_0x86e244,_0x3a8b80){return client[_0x13ef('0xb')](_0x394d2f,_0x165563)['then'](function(_0x18f0db){logger['info'](_0x13ef('0xc'),_0x336920,_0x13ef('0xd'));logger[_0x13ef('0xe')]('ChatQueue,\x20%s,\x20%s,\x20%s',_0x336920,_0x13ef('0xd'),JSON[_0x13ef('0xf')](_0x18f0db));if(_0x18f0db[_0x13ef('0x10')]){if(_0x18f0db[_0x13ef('0x10')]['code']===0x1f4){logger[_0x13ef('0x10')](_0x13ef('0xc'),_0x336920,_0x18f0db[_0x13ef('0x10')]['message']);return _0x3a8b80(_0x18f0db[_0x13ef('0x10')][_0x13ef('0x11')]);}logger['error'](_0x13ef('0xc'),_0x336920,_0x18f0db[_0x13ef('0x10')][_0x13ef('0x11')]);return _0x86e244(_0x18f0db[_0x13ef('0x10')][_0x13ef('0x11')]);}else{logger[_0x13ef('0x12')](_0x13ef('0xc'),_0x336920,_0x13ef('0xd'));_0x86e244(_0x18f0db[_0x13ef('0x13')]['message']);}})['catch'](function(_0x461f70){logger[_0x13ef('0x10')]('ChatQueue,\x20%s,\x20%s',_0x336920,_0x461f70);_0x3a8b80(_0x461f70);});});}exports[_0x13ef('0x14')]=function(_0x5a8ae4){var _0xbc2357=this;return new Promise(function(_0x5e0a0c,_0x64e7a){return db[_0x13ef('0x15')][_0x13ef('0x16')]({'raw':_0x5a8ae4[_0x13ef('0x17')]?_0x5a8ae4[_0x13ef('0x17')]['raw']===undefined?!![]:![]:!![],'where':_0x5a8ae4[_0x13ef('0x17')]?_0x5a8ae4[_0x13ef('0x17')][_0x13ef('0x18')]||null:null,'attributes':_0x5a8ae4['options']?_0x5a8ae4[_0x13ef('0x17')]['attributes']||null:null,'limit':_0x5a8ae4[_0x13ef('0x17')]?_0x5a8ae4[_0x13ef('0x17')][_0x13ef('0x19')]||null:null,'include':_0x5a8ae4[_0x13ef('0x17')]?_0x5a8ae4[_0x13ef('0x17')][_0x13ef('0x1a')]?_['map'](_0x5a8ae4[_0x13ef('0x17')][_0x13ef('0x1a')],function(_0x523ffe){return{'model':db[_0x523ffe['model']],'as':_0x523ffe['as'],'attributes':_0x523ffe[_0x13ef('0x1b')],'include':_0x523ffe[_0x13ef('0x1a')]?_[_0x13ef('0x1c')](_0x523ffe['include'],function(_0x2c0da7){return{'model':db[_0x2c0da7[_0x13ef('0x1d')]],'as':_0x2c0da7['as'],'attributes':_0x2c0da7[_0x13ef('0x1b')],'include':_0x2c0da7[_0x13ef('0x1a')]?_[_0x13ef('0x1c')](_0x2c0da7[_0x13ef('0x1a')],function(_0x3b9c24){return{'model':db[_0x3b9c24[_0x13ef('0x1d')]],'as':_0x3b9c24['as'],'attributes':_0x3b9c24[_0x13ef('0x1b')]};}):[]};}):[]};}):[]:[]})['then'](function(_0x43a49f){logger[_0x13ef('0x12')]('GetChatQueue',_0x5a8ae4);logger[_0x13ef('0xe')](_0x13ef('0x14'),_0x5a8ae4,JSON[_0x13ef('0xf')](_0x43a49f));_0x5e0a0c(_0x43a49f);})[_0x13ef('0x1e')](function(_0x1534a7){logger[_0x13ef('0x10')](_0x13ef('0x14'),_0x1534a7[_0x13ef('0x11')],_0x5a8ae4);_0x64e7a(_0xbc2357['error'](0x1f4,_0x1534a7[_0x13ef('0x11')]));});});};exports[_0x13ef('0x1f')]=function(_0x148351){var _0xa204e0=this;return new Promise(function(_0x2ea880,_0x38b86f){return db[_0x13ef('0x15')]['find']({'raw':_0x148351[_0x13ef('0x17')]?_0x148351['options']['raw']===undefined?!![]:![]:!![],'where':_0x148351[_0x13ef('0x17')]?_0x148351[_0x13ef('0x17')][_0x13ef('0x18')]||null:null,'attributes':_0x148351[_0x13ef('0x17')]?_0x148351['options'][_0x13ef('0x1b')]||null:null,'include':_0x148351[_0x13ef('0x17')]?_0x148351[_0x13ef('0x17')]['include']?_[_0x13ef('0x1c')](_0x148351[_0x13ef('0x17')]['include'],function(_0x30b073){return{'model':db[_0x30b073[_0x13ef('0x1d')]],'as':_0x30b073['as'],'attributes':_0x30b073['attributes'],'include':_0x30b073[_0x13ef('0x1a')]?_[_0x13ef('0x1c')](_0x30b073['include'],function(_0x3b7f19){return{'model':db[_0x3b7f19[_0x13ef('0x1d')]],'as':_0x3b7f19['as'],'attributes':_0x3b7f19[_0x13ef('0x1b')],'include':_0x3b7f19['include']?_[_0x13ef('0x1c')](_0x3b7f19[_0x13ef('0x1a')],function(_0x4932ec){return{'model':db[_0x4932ec[_0x13ef('0x1d')]],'as':_0x4932ec['as'],'attributes':_0x4932ec[_0x13ef('0x1b')]};}):[]};}):[]};}):[]:[]})[_0x13ef('0x20')](function(_0x1c26e7){logger['info'](_0x13ef('0x1f'),_0x148351);logger['debug'](_0x13ef('0x1f'),_0x148351,JSON[_0x13ef('0xf')](_0x1c26e7));_0x2ea880(_0x1c26e7);})['catch'](function(_0x3ac958){logger['error'](_0x13ef('0x1f'),_0x3ac958['message'],_0x148351);_0x38b86f(_0xa204e0[_0x13ef('0x10')](0x1f4,_0x3ac958[_0x13ef('0x11')]));});});}; \ No newline at end of file +var _0x4cd3=['error','code','message','result','catch','GetChatQueue','ChatQueue','findAll','options','raw','where','include','map','model','attributes','find','lodash','util','../../mysqldb','../../config/utils','jayson/promise','defaults','localhost','socket.io-emitter','redis','register','request','then','info','ChatQueue,\x20%s,\x20%s','debug','ChatQueue,\x20%s,\x20%s,\x20%s','request\x20sent','stringify'];(function(_0x3a9319,_0x14d985){var _0x490f67=function(_0x2414a5){while(--_0x2414a5){_0x3a9319['push'](_0x3a9319['shift']());}};_0x490f67(++_0x14d985);}(_0x4cd3,0x1ca));var _0x34cd=function(_0x117473,_0x485375){_0x117473=_0x117473-0x0;var _0x38711a=_0x4cd3[_0x117473];return _0x38711a;};'use strict';var _=require(_0x34cd('0x0'));var util=require(_0x34cd('0x1'));var moment=require('moment');var BPromise=require('bluebird');var rs=require('randomstring');var fs=require('fs');var Redis=require('ioredis');var db=require(_0x34cd('0x2'))['db'];var utils=require(_0x34cd('0x3'));var logger=require('../../config/logger')('rpc');var config=require('../../config/environment');var jayson=require(_0x34cd('0x4'));var client=jayson['client']['http']({'port':0x232a});config['redis']=_[_0x34cd('0x5')](config['redis'],{'host':_0x34cd('0x6'),'port':0x18eb});var socket=require(_0x34cd('0x7'))(new Redis(config[_0x34cd('0x8')]));require('./chatQueue.socket')[_0x34cd('0x9')](socket);function respondWithRpcPromise(_0x146f59,_0xf91b0c,_0x420ceb){return new BPromise(function(_0x306a76,_0x2b9e6c){return client[_0x34cd('0xa')](_0x146f59,_0x420ceb)[_0x34cd('0xb')](function(_0xf71977){logger[_0x34cd('0xc')](_0x34cd('0xd'),_0xf91b0c,'request\x20sent');logger[_0x34cd('0xe')](_0x34cd('0xf'),_0xf91b0c,_0x34cd('0x10'),JSON[_0x34cd('0x11')](_0xf71977));if(_0xf71977[_0x34cd('0x12')]){if(_0xf71977[_0x34cd('0x12')][_0x34cd('0x13')]===0x1f4){logger['error'](_0x34cd('0xd'),_0xf91b0c,_0xf71977[_0x34cd('0x12')]['message']);return _0x2b9e6c(_0xf71977['error'][_0x34cd('0x14')]);}logger[_0x34cd('0x12')](_0x34cd('0xd'),_0xf91b0c,_0xf71977[_0x34cd('0x12')]['message']);return _0x306a76(_0xf71977[_0x34cd('0x12')][_0x34cd('0x14')]);}else{logger[_0x34cd('0xc')]('ChatQueue,\x20%s,\x20%s',_0xf91b0c,'request\x20sent');_0x306a76(_0xf71977[_0x34cd('0x15')][_0x34cd('0x14')]);}})[_0x34cd('0x16')](function(_0x35bde4){logger['error'](_0x34cd('0xd'),_0xf91b0c,_0x35bde4);_0x2b9e6c(_0x35bde4);});});}exports[_0x34cd('0x17')]=function(_0x18e090){var _0x414a7b=this;return new Promise(function(_0x37ba94,_0x2ada47){return db[_0x34cd('0x18')][_0x34cd('0x19')]({'raw':_0x18e090[_0x34cd('0x1a')]?_0x18e090[_0x34cd('0x1a')][_0x34cd('0x1b')]===undefined?!![]:![]:!![],'where':_0x18e090[_0x34cd('0x1a')]?_0x18e090[_0x34cd('0x1a')][_0x34cd('0x1c')]||null:null,'attributes':_0x18e090[_0x34cd('0x1a')]?_0x18e090[_0x34cd('0x1a')]['attributes']||null:null,'limit':_0x18e090[_0x34cd('0x1a')]?_0x18e090[_0x34cd('0x1a')]['limit']||null:null,'include':_0x18e090['options']?_0x18e090[_0x34cd('0x1a')][_0x34cd('0x1d')]?_[_0x34cd('0x1e')](_0x18e090[_0x34cd('0x1a')][_0x34cd('0x1d')],function(_0x43eb88){return{'model':db[_0x43eb88[_0x34cd('0x1f')]],'as':_0x43eb88['as'],'attributes':_0x43eb88['attributes'],'include':_0x43eb88[_0x34cd('0x1d')]?_[_0x34cd('0x1e')](_0x43eb88[_0x34cd('0x1d')],function(_0x239d54){return{'model':db[_0x239d54[_0x34cd('0x1f')]],'as':_0x239d54['as'],'attributes':_0x239d54[_0x34cd('0x20')],'include':_0x239d54['include']?_[_0x34cd('0x1e')](_0x239d54[_0x34cd('0x1d')],function(_0x1904b6){return{'model':db[_0x1904b6[_0x34cd('0x1f')]],'as':_0x1904b6['as'],'attributes':_0x1904b6[_0x34cd('0x20')]};}):[]};}):[]};}):[]:[]})[_0x34cd('0xb')](function(_0xfd718c){logger[_0x34cd('0xc')](_0x34cd('0x17'),_0x18e090);logger[_0x34cd('0xe')](_0x34cd('0x17'),_0x18e090,JSON[_0x34cd('0x11')](_0xfd718c));_0x37ba94(_0xfd718c);})[_0x34cd('0x16')](function(_0x5ccfc5){logger[_0x34cd('0x12')](_0x34cd('0x17'),_0x5ccfc5[_0x34cd('0x14')],_0x18e090);_0x2ada47(_0x414a7b[_0x34cd('0x12')](0x1f4,_0x5ccfc5[_0x34cd('0x14')]));});});};exports['ShowChatQueue']=function(_0x206023){var _0x2223e4=this;return new Promise(function(_0x885446,_0xe0b199){return db[_0x34cd('0x18')][_0x34cd('0x21')]({'raw':_0x206023[_0x34cd('0x1a')]?_0x206023[_0x34cd('0x1a')][_0x34cd('0x1b')]===undefined?!![]:![]:!![],'where':_0x206023['options']?_0x206023['options'][_0x34cd('0x1c')]||null:null,'attributes':_0x206023[_0x34cd('0x1a')]?_0x206023[_0x34cd('0x1a')][_0x34cd('0x20')]||null:null,'include':_0x206023[_0x34cd('0x1a')]?_0x206023['options']['include']?_[_0x34cd('0x1e')](_0x206023[_0x34cd('0x1a')][_0x34cd('0x1d')],function(_0x51464d){return{'model':db[_0x51464d[_0x34cd('0x1f')]],'as':_0x51464d['as'],'attributes':_0x51464d[_0x34cd('0x20')],'include':_0x51464d[_0x34cd('0x1d')]?_[_0x34cd('0x1e')](_0x51464d[_0x34cd('0x1d')],function(_0x1b4cac){return{'model':db[_0x1b4cac[_0x34cd('0x1f')]],'as':_0x1b4cac['as'],'attributes':_0x1b4cac[_0x34cd('0x20')],'include':_0x1b4cac[_0x34cd('0x1d')]?_['map'](_0x1b4cac[_0x34cd('0x1d')],function(_0x5d1ebe){return{'model':db[_0x5d1ebe[_0x34cd('0x1f')]],'as':_0x5d1ebe['as'],'attributes':_0x5d1ebe[_0x34cd('0x20')]};}):[]};}):[]};}):[]:[]})['then'](function(_0x3dc2fb){logger[_0x34cd('0xc')]('ShowChatQueue',_0x206023);logger[_0x34cd('0xe')]('ShowChatQueue',_0x206023,JSON[_0x34cd('0x11')](_0x3dc2fb));_0x885446(_0x3dc2fb);})[_0x34cd('0x16')](function(_0x18044d){logger['error']('ShowChatQueue',_0x18044d['message'],_0x206023);_0xe0b199(_0x2223e4[_0x34cd('0x12')](0x1f4,_0x18044d[_0x34cd('0x14')]));});});}; \ No newline at end of file diff --git a/server/api/chatQueue/chatQueue.socket.js b/server/api/chatQueue/chatQueue.socket.js index 189f361..490cf10 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 _0x9b9b=['save','emit','removeListener','register','length','chatQueue:'];(function(_0x4d7610,_0x18d036){var _0x29ff5c=function(_0x6119f){while(--_0x6119f){_0x4d7610['push'](_0x4d7610['shift']());}};_0x29ff5c(++_0x18d036);}(_0x9b9b,0x114));var _0xb9b9=function(_0x5257bf,_0xf39844){_0x5257bf=_0x5257bf-0x0;var _0x30f32b=_0x9b9b[_0x5257bf];return _0x30f32b;};'use strict';var ChatQueueEvents=require('./chatQueue.events');var events=[_0xb9b9('0x0'),'remove','update'];function createListener(_0x2ae8a0,_0x153734){return function(_0x1adf50){_0x153734[_0xb9b9('0x1')](_0x2ae8a0,_0x1adf50);};}function removeListener(_0x1d6ab6,_0x43c8ff){return function(){ChatQueueEvents[_0xb9b9('0x2')](_0x1d6ab6,_0x43c8ff);};}exports[_0xb9b9('0x3')]=function(_0x79dd){for(var _0x3d1a95=0x0,_0x85eec=events[_0xb9b9('0x4')];_0x3d1a95<_0x85eec;_0x3d1a95++){var _0x5be5bc=events[_0x3d1a95];var _0x297cb6=createListener(_0xb9b9('0x5')+_0x5be5bc,_0x79dd);ChatQueueEvents['on'](_0x5be5bc,_0x297cb6);}}; \ No newline at end of file +var _0x0b78=['removeListener','length','chatQueue:','./chatQueue.events','save','update'];(function(_0x2641f9,_0x26715f){var _0x585741=function(_0x2d1462){while(--_0x2d1462){_0x2641f9['push'](_0x2641f9['shift']());}};_0x585741(++_0x26715f);}(_0x0b78,0x1ad));var _0x80b7=function(_0xfae23b,_0x2be4ba){_0xfae23b=_0xfae23b-0x0;var _0x200640=_0x0b78[_0xfae23b];return _0x200640;};'use strict';var ChatQueueEvents=require(_0x80b7('0x0'));var events=[_0x80b7('0x1'),'remove',_0x80b7('0x2')];function createListener(_0x4f55ab,_0x4bffac){return function(_0x261012){_0x4bffac['emit'](_0x4f55ab,_0x261012);};}function removeListener(_0x6a187e,_0x89d4d7){return function(){ChatQueueEvents[_0x80b7('0x3')](_0x6a187e,_0x89d4d7);};}exports['register']=function(_0x49bc7f){for(var _0x167ddd=0x0,_0x584401=events[_0x80b7('0x4')];_0x167ddd<_0x584401;_0x167ddd++){var _0x122ebe=events[_0x167ddd];var _0x3c248d=createListener(_0x80b7('0x5')+_0x122ebe,_0x49bc7f);ChatQueueEvents['on'](_0x122ebe,_0x3c248d);}}; \ No newline at end of file diff --git a/server/api/chatQueue/index.js b/server/api/chatQueue/index.js index 0cc834b..ff6cbdc 100644 --- a/server/api/chatQueue/index.js +++ b/server/api/chatQueue/index.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x008c=['../../config/environment','./chatQueue.controller','get','isAuthenticated','index','show','/:id/teams','getTeams','/:id/users','getAgents','post','addTeams','addAgents','update','delete','/:id','removeTeams','multer','util','path','connect-timeout','express','fs-extra','../../components/auth/service','../../components/interaction/service'];(function(_0x58d59e,_0x5ec556){var _0x560b57=function(_0x9688fd){while(--_0x9688fd){_0x58d59e['push'](_0x58d59e['shift']());}};_0x560b57(++_0x5ec556);}(_0x008c,0x188));var _0xc008=function(_0x4f9922,_0x5182d5){_0x4f9922=_0x4f9922-0x0;var _0x3d6a25=_0x008c[_0x4f9922];return _0x3d6a25;};'use strict';var multer=require(_0xc008('0x0'));var util=require(_0xc008('0x1'));var path=require(_0xc008('0x2'));var timeout=require(_0xc008('0x3'));var express=require(_0xc008('0x4'));var router=express['Router']();var fs_extra=require(_0xc008('0x5'));var auth=require(_0xc008('0x6'));var interaction=require(_0xc008('0x7'));var config=require(_0xc008('0x8'));var controller=require(_0xc008('0x9'));router[_0xc008('0xa')]('/',auth[_0xc008('0xb')](),controller[_0xc008('0xc')]);router[_0xc008('0xa')]('/describe',auth[_0xc008('0xb')](),controller['describe']);router[_0xc008('0xa')]('/:id',auth['isAuthenticated'](),controller[_0xc008('0xd')]);router[_0xc008('0xa')]('/:id/members',auth['isAuthenticated'](),controller['getMembers']);router[_0xc008('0xa')](_0xc008('0xe'),auth['isAuthenticated'](),controller[_0xc008('0xf')]);router[_0xc008('0xa')](_0xc008('0x10'),auth[_0xc008('0xb')](),controller[_0xc008('0x11')]);router[_0xc008('0x12')]('/',auth[_0xc008('0xb')](),controller['create']);router['post'](_0xc008('0xe'),auth['isAuthenticated'](),controller[_0xc008('0x13')]);router[_0xc008('0x12')](_0xc008('0x10'),auth[_0xc008('0xb')](),controller[_0xc008('0x14')]);router['put']('/:id',auth['isAuthenticated'](),controller[_0xc008('0x15')]);router[_0xc008('0x16')](_0xc008('0x17'),auth[_0xc008('0xb')](),controller['destroy']);router['delete']('/:id/teams',auth['isAuthenticated'](),controller[_0xc008('0x18')]);router[_0xc008('0x16')]('/:id/users',auth[_0xc008('0xb')](),controller['removeAgents']);module['exports']=router; \ No newline at end of file +var _0x5fc3=['update','delete','destroy','removeTeams','removeAgents','exports','multer','util','connect-timeout','express','Router','fs-extra','../../components/auth/service','../../config/environment','./chatQueue.controller','get','isAuthenticated','describe','/:id','show','getMembers','/:id/teams','/:id/users','post','create','addTeams','put'];(function(_0x167cc1,_0x56ef5a){var _0x10bc4b=function(_0xd6a255){while(--_0xd6a255){_0x167cc1['push'](_0x167cc1['shift']());}};_0x10bc4b(++_0x56ef5a);}(_0x5fc3,0xa8));var _0x35fc=function(_0x1992f1,_0x5c61f0){_0x1992f1=_0x1992f1-0x0;var _0x413dfe=_0x5fc3[_0x1992f1];return _0x413dfe;};'use strict';var multer=require(_0x35fc('0x0'));var util=require(_0x35fc('0x1'));var path=require('path');var timeout=require(_0x35fc('0x2'));var express=require(_0x35fc('0x3'));var router=express[_0x35fc('0x4')]();var fs_extra=require(_0x35fc('0x5'));var auth=require(_0x35fc('0x6'));var interaction=require('../../components/interaction/service');var config=require(_0x35fc('0x7'));var controller=require(_0x35fc('0x8'));router[_0x35fc('0x9')]('/',auth['isAuthenticated'](),controller['index']);router[_0x35fc('0x9')]('/describe',auth[_0x35fc('0xa')](),controller[_0x35fc('0xb')]);router[_0x35fc('0x9')](_0x35fc('0xc'),auth[_0x35fc('0xa')](),controller[_0x35fc('0xd')]);router[_0x35fc('0x9')]('/:id/members',auth[_0x35fc('0xa')](),controller[_0x35fc('0xe')]);router['get'](_0x35fc('0xf'),auth[_0x35fc('0xa')](),controller['getTeams']);router[_0x35fc('0x9')](_0x35fc('0x10'),auth['isAuthenticated'](),controller['getAgents']);router[_0x35fc('0x11')]('/',auth['isAuthenticated'](),controller[_0x35fc('0x12')]);router[_0x35fc('0x11')](_0x35fc('0xf'),auth[_0x35fc('0xa')](),controller[_0x35fc('0x13')]);router['post']('/:id/users',auth['isAuthenticated'](),controller['addAgents']);router[_0x35fc('0x14')](_0x35fc('0xc'),auth[_0x35fc('0xa')](),controller[_0x35fc('0x15')]);router[_0x35fc('0x16')](_0x35fc('0xc'),auth['isAuthenticated'](),controller[_0x35fc('0x17')]);router[_0x35fc('0x16')]('/:id/teams',auth[_0x35fc('0xa')](),controller[_0x35fc('0x18')]);router[_0x35fc('0x16')]('/:id/users',auth[_0x35fc('0xa')](),controller[_0x35fc('0x19')]);module[_0x35fc('0x1a')]=router; \ No newline at end of file diff --git a/server/api/chatQueueReport/chatQueueReport.attributes.js b/server/api/chatQueueReport/chatQueueReport.attributes.js index 7b05834..9e568e4 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 _0x16ab=['DATE','sequelize','exports','STRING'];(function(_0x3dd15e,_0x1f0015){var _0x231fd0=function(_0x4f680a){while(--_0x4f680a){_0x3dd15e['push'](_0x3dd15e['shift']());}};_0x231fd0(++_0x1f0015);}(_0x16ab,0xed));var _0xb16a=function(_0x7e2eb0,_0x17cd58){_0x7e2eb0=_0x7e2eb0-0x0;var _0xd92de4=_0x16ab[_0x7e2eb0];return _0xd92de4;};'use strict';var moment=require('moment');var Sequelize=require(_0xb16a('0x0'));module[_0xb16a('0x1')]={'uniqueid':{'type':Sequelize[_0xb16a('0x2')],'allowNull':![]},'from':{'type':Sequelize['STRING']},'joinAt':{'type':Sequelize[_0xb16a('0x3')]},'leaveAt':{'type':Sequelize['DATE']},'acceptAt':{'type':Sequelize[_0xb16a('0x3')]},'exitAt':{'type':Sequelize[_0xb16a('0x3')]},'reason':{'type':Sequelize['STRING']}}; \ No newline at end of file +var _0x5970=['STRING','DATE','sequelize','exports'];(function(_0x3e2c9e,_0x8f27b4){var _0x24f3cd=function(_0x158240){while(--_0x158240){_0x3e2c9e['push'](_0x3e2c9e['shift']());}};_0x24f3cd(++_0x8f27b4);}(_0x5970,0xae));var _0x0597=function(_0x2a8ad5,_0x23be3a){_0x2a8ad5=_0x2a8ad5-0x0;var _0x557ac0=_0x5970[_0x2a8ad5];return _0x557ac0;};'use strict';var moment=require('moment');var Sequelize=require(_0x0597('0x0'));module[_0x0597('0x1')]={'uniqueid':{'type':Sequelize[_0x0597('0x2')],'allowNull':![]},'from':{'type':Sequelize[_0x0597('0x2')]},'joinAt':{'type':Sequelize[_0x0597('0x3')]},'leaveAt':{'type':Sequelize[_0x0597('0x3')]},'acceptAt':{'type':Sequelize['DATE']},'exitAt':{'type':Sequelize[_0x0597('0x3')]},'reason':{'type':Sequelize[_0x0597('0x2')]}}; \ No newline at end of file diff --git a/server/api/chatQueueReport/chatQueueReport.controller.js b/server/api/chatQueueReport/chatQueueReport.controller.js index 192debd..2b49f69 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 _0xd959=['mustache','util','sox','to-csv','ejs','fs-extra','squel','crypto','jsforce','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/logger','api','../../config/environment','../../config/license/util','sendStatus','end','status','json','offset','undefined','count','limit','set','Content-Range','apply','save','update','destroy','then','error','stack','name','send','index','map','ChatQueueReport','fieldName','type','key','model','query','keys','intersection','attributes','fields','hasOwnProperty','nolimit','order','sort','pick','filters','filter','where','merge','VIRTUAL','includeAll','findAll','catch','show','params','rawAttributes','length','include','create','body','find','describe','eml-format','rimraf','zip-dir','request-promise','moment','bluebird'];(function(_0x34890d,_0xf9869c){var _0x4b972b=function(_0x503f9a){while(--_0x503f9a){_0x34890d['push'](_0x34890d['shift']());}};_0x4b972b(++_0xf9869c);}(_0xd959,0x94));var _0x9d95=function(_0x3da9e5,_0x5affe8){_0x3da9e5=_0x3da9e5-0x0;var _0x4b9003=_0xd959[_0x3da9e5];return _0x4b9003;};'use strict';var emlformat=require(_0x9d95('0x0'));var rimraf=require(_0x9d95('0x1'));var zipdir=require(_0x9d95('0x2'));var jsonpatch=require('fast-json-patch');var rp=require(_0x9d95('0x3'));var moment=require(_0x9d95('0x4'));var BPromise=require(_0x9d95('0x5'));var Mustache=require(_0x9d95('0x6'));var util=require(_0x9d95('0x7'));var path=require('path');var sox=require(_0x9d95('0x8'));var csv=require(_0x9d95('0x9'));var ejs=require(_0x9d95('0xa'));var fs=require('fs');var fs_extra=require(_0x9d95('0xb'));var _=require('lodash');var squel=require(_0x9d95('0xc'));var crypto=require(_0x9d95('0xd'));var jsforce=require(_0x9d95('0xe'));var deskjs=require('desk.js');var toCsv=require(_0x9d95('0x9'));var querystring=require('querystring');var Papa=require(_0x9d95('0xf'));var Redis=require(_0x9d95('0x10'));var authService=require(_0x9d95('0x11'));var qs=require(_0x9d95('0x12'));var as=require(_0x9d95('0x13'));var hardwareService=require('../../config/license/hardware');var logger=require(_0x9d95('0x14'))(_0x9d95('0x15'));var utils=require('../../config/utils');var config=require(_0x9d95('0x16'));var licenseUtil=require(_0x9d95('0x17'));var db=require('../../mysqldb')['db'];function respondWithStatusCode(_0x53d59c,_0x10f862){_0x10f862=_0x10f862||0xcc;return function(_0x40f5cf){if(_0x40f5cf){return _0x53d59c[_0x9d95('0x18')](_0x10f862);}return _0x53d59c['status'](_0x10f862)[_0x9d95('0x19')]();};}function respondWithResult(_0x430bfe,_0x4a8a60){_0x4a8a60=_0x4a8a60||0xc8;return function(_0x36a204){if(_0x36a204){return _0x430bfe[_0x9d95('0x1a')](_0x4a8a60)[_0x9d95('0x1b')](_0x36a204);}};}function respondWithFilteredResult(_0x4b4f1b,_0x2d5ab2){return function(_0x4bae6f){if(_0x4bae6f){var _0x4cabfd=typeof _0x2d5ab2[_0x9d95('0x1c')]===_0x9d95('0x1d')&&typeof _0x2d5ab2['limit']===_0x9d95('0x1d');var _0x5ad0c8=_0x4bae6f[_0x9d95('0x1e')];var _0x3ab916=_0x4cabfd?0x0:_0x2d5ab2[_0x9d95('0x1c')];var _0x453074=_0x4cabfd?_0x4bae6f[_0x9d95('0x1e')]:_0x2d5ab2['offset']+_0x2d5ab2[_0x9d95('0x1f')];var _0x4ec46d;if(_0x453074>=_0x5ad0c8){_0x453074=_0x5ad0c8;_0x4ec46d=0xc8;}else{_0x4ec46d=0xce;}_0x4b4f1b[_0x9d95('0x1a')](_0x4ec46d);return _0x4b4f1b[_0x9d95('0x20')](_0x9d95('0x21'),_0x3ab916+'-'+_0x453074+'/'+_0x5ad0c8)[_0x9d95('0x1b')](_0x4bae6f);}return null;};}function patchUpdates(_0x281c3a){return function(_0x33d3e8){try{jsonpatch[_0x9d95('0x22')](_0x33d3e8,_0x281c3a,!![]);}catch(_0x3ac1a3){return BPromise['reject'](_0x3ac1a3);}return _0x33d3e8[_0x9d95('0x23')]();};}function saveUpdates(_0x5c8095,_0x5d0a9a){return function(_0x8081ae){if(_0x8081ae){return _0x8081ae[_0x9d95('0x24')](_0x5c8095)['then'](function(_0x2bfbe0){return _0x2bfbe0;});}return null;};}function removeEntity(_0x29a832,_0x4fcf09){return function(_0x4840f5){if(_0x4840f5){return _0x4840f5[_0x9d95('0x25')]()[_0x9d95('0x26')](function(){_0x29a832[_0x9d95('0x1a')](0xcc)[_0x9d95('0x19')]();});}};}function handleEntityNotFound(_0x4c9abd,_0x1953cb){return function(_0x4f1562){if(!_0x4f1562){_0x4c9abd[_0x9d95('0x18')](0x194);}return _0x4f1562;};}function handleError(_0x1a0d2c,_0x240d7f){_0x240d7f=_0x240d7f||0x1f4;return function(_0x6c3c73){logger[_0x9d95('0x27')](_0x6c3c73[_0x9d95('0x28')]);if(_0x6c3c73[_0x9d95('0x29')]){delete _0x6c3c73[_0x9d95('0x29')];}_0x1a0d2c['status'](_0x240d7f)[_0x9d95('0x2a')](_0x6c3c73);};}exports[_0x9d95('0x2b')]=function(_0x1cdac3,_0x880530){var _0x3510f9={},_0x1dc801={},_0x42e3b3={'count':0x0,'rows':[]};var _0x2611bb=_[_0x9d95('0x2c')](db[_0x9d95('0x2d')]['rawAttributes'],function(_0xff5bbc){return{'name':_0xff5bbc[_0x9d95('0x2e')],'type':_0xff5bbc[_0x9d95('0x2f')][_0x9d95('0x30')]};});_0x1dc801[_0x9d95('0x31')]=_['map'](_0x2611bb,_0x9d95('0x29'));_0x1dc801[_0x9d95('0x32')]=_[_0x9d95('0x33')](_0x1cdac3[_0x9d95('0x32')]);_0x1dc801['filters']=_[_0x9d95('0x34')](_0x1dc801['model'],_0x1dc801[_0x9d95('0x32')]);_0x3510f9[_0x9d95('0x35')]=_[_0x9d95('0x34')](_0x1dc801['model'],qs[_0x9d95('0x36')](_0x1cdac3['query']['fields']));_0x3510f9[_0x9d95('0x35')]=_0x3510f9['attributes']['length']?_0x3510f9[_0x9d95('0x35')]:_0x1dc801['model'];if(!_0x1cdac3['query'][_0x9d95('0x37')](_0x9d95('0x38'))){_0x3510f9[_0x9d95('0x1f')]=qs[_0x9d95('0x1f')](_0x1cdac3['query'][_0x9d95('0x1f')]);_0x3510f9[_0x9d95('0x1c')]=qs[_0x9d95('0x1c')](_0x1cdac3[_0x9d95('0x32')][_0x9d95('0x1c')]);}_0x3510f9[_0x9d95('0x39')]=qs[_0x9d95('0x3a')](_0x1cdac3[_0x9d95('0x32')][_0x9d95('0x3a')]);_0x3510f9['where']=qs['filters'](_[_0x9d95('0x3b')](_0x1cdac3[_0x9d95('0x32')],_0x1dc801[_0x9d95('0x3c')]),_0x2611bb);if(_0x1cdac3['query'][_0x9d95('0x3d')]){_0x3510f9[_0x9d95('0x3e')]=_[_0x9d95('0x3f')](_0x3510f9[_0x9d95('0x3e')],{'$or':_['map'](_0x2611bb,function(_0x432005){if(_0x432005[_0x9d95('0x2f')]!==_0x9d95('0x40')){var _0x53c257={};_0x53c257[_0x432005[_0x9d95('0x29')]]={'$like':'%'+_0x1cdac3['query'][_0x9d95('0x3d')]+'%'};return _0x53c257;}})});}_0x3510f9=_[_0x9d95('0x3f')]({},_0x3510f9,_0x1cdac3['options']);var _0x563eb5={'where':_0x3510f9[_0x9d95('0x3e')]};return db['ChatQueueReport'][_0x9d95('0x1e')](_0x563eb5)[_0x9d95('0x26')](function(_0x3a4b0a){_0x42e3b3[_0x9d95('0x1e')]=_0x3a4b0a;if(_0x1cdac3['query'][_0x9d95('0x41')]){_0x3510f9['include']=[{'all':!![]}];}return db[_0x9d95('0x2d')][_0x9d95('0x42')](_0x3510f9);})[_0x9d95('0x26')](function(_0x3c677e){_0x42e3b3['rows']=_0x3c677e;return _0x42e3b3;})[_0x9d95('0x26')](respondWithFilteredResult(_0x880530,_0x3510f9))[_0x9d95('0x43')](handleError(_0x880530,null));};exports[_0x9d95('0x44')]=function(_0x576d8d,_0x275fb3){var _0x307c18={'raw':!![],'where':{'id':_0x576d8d[_0x9d95('0x45')]['id']}},_0x350a0b={};_0x350a0b[_0x9d95('0x31')]=_[_0x9d95('0x33')](db[_0x9d95('0x2d')][_0x9d95('0x46')]);_0x350a0b[_0x9d95('0x32')]=_[_0x9d95('0x33')](_0x576d8d[_0x9d95('0x32')]);_0x350a0b[_0x9d95('0x3c')]=_[_0x9d95('0x34')](_0x350a0b[_0x9d95('0x31')],_0x350a0b[_0x9d95('0x32')]);_0x307c18[_0x9d95('0x35')]=_[_0x9d95('0x34')](_0x350a0b[_0x9d95('0x31')],qs[_0x9d95('0x36')](_0x576d8d['query']['fields']));_0x307c18[_0x9d95('0x35')]=_0x307c18[_0x9d95('0x35')][_0x9d95('0x47')]?_0x307c18[_0x9d95('0x35')]:_0x350a0b[_0x9d95('0x31')];if(_0x576d8d[_0x9d95('0x32')][_0x9d95('0x41')]){_0x307c18[_0x9d95('0x48')]=[{'all':!![]}];}_0x307c18=_['merge']({},_0x307c18,_0x576d8d['options']);return db[_0x9d95('0x2d')]['find'](_0x307c18)[_0x9d95('0x26')](handleEntityNotFound(_0x275fb3,null))[_0x9d95('0x26')](respondWithResult(_0x275fb3,null))[_0x9d95('0x43')](handleError(_0x275fb3,null));};exports[_0x9d95('0x49')]=function(_0x442c56,_0x4e439d){return db[_0x9d95('0x2d')][_0x9d95('0x49')](_0x442c56[_0x9d95('0x4a')],{})['then'](respondWithResult(_0x4e439d,0xc9))[_0x9d95('0x43')](handleError(_0x4e439d,null));};exports[_0x9d95('0x24')]=function(_0x3dd91a,_0x32f1dd){if(_0x3dd91a[_0x9d95('0x4a')]['id']){delete _0x3dd91a['body']['id'];}return db[_0x9d95('0x2d')]['find']({'where':{'id':_0x3dd91a[_0x9d95('0x45')]['id']}})[_0x9d95('0x26')](handleEntityNotFound(_0x32f1dd,null))[_0x9d95('0x26')](saveUpdates(_0x3dd91a[_0x9d95('0x4a')],null))[_0x9d95('0x26')](respondWithResult(_0x32f1dd,null))['catch'](handleError(_0x32f1dd,null));};exports[_0x9d95('0x25')]=function(_0x5d3526,_0x303e77){return db['ChatQueueReport'][_0x9d95('0x4b')]({'where':{'id':_0x5d3526[_0x9d95('0x45')]['id']}})[_0x9d95('0x26')](handleEntityNotFound(_0x303e77,null))[_0x9d95('0x26')](removeEntity(_0x303e77,null))[_0x9d95('0x43')](handleError(_0x303e77,null));};exports[_0x9d95('0x4c')]=function(_0x346675,_0x1ba6e5){return db['ChatQueueReport']['describe']()[_0x9d95('0x26')](respondWithResult(_0x1ba6e5,null))[_0x9d95('0x43')](handleError(_0x1ba6e5,null));}; \ No newline at end of file +var _0x9c48=['body','params','describe','eml-format','rimraf','zip-dir','request-promise','moment','bluebird','path','sox','ejs','fs-extra','lodash','squel','crypto','jsforce','desk.js','to-csv','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/environment','../../config/license/util','sendStatus','status','end','json','offset','undefined','limit','count','set','apply','reject','save','update','destroy','then','error','stack','name','send','index','map','ChatQueueReport','rawAttributes','fieldName','type','key','model','query','intersection','attributes','fields','length','nolimit','sort','where','filters','pick','filter','merge','includeAll','findAll','rows','catch','show','keys','options','find','create'];(function(_0x4c98b9,_0x1ad11b){var _0x3a257a=function(_0x147857){while(--_0x147857){_0x4c98b9['push'](_0x4c98b9['shift']());}};_0x3a257a(++_0x1ad11b);}(_0x9c48,0xa1));var _0x89c4=function(_0x295387,_0x440431){_0x295387=_0x295387-0x0;var _0x2d0927=_0x9c48[_0x295387];return _0x2d0927;};'use strict';var emlformat=require(_0x89c4('0x0'));var rimraf=require(_0x89c4('0x1'));var zipdir=require(_0x89c4('0x2'));var jsonpatch=require('fast-json-patch');var rp=require(_0x89c4('0x3'));var moment=require(_0x89c4('0x4'));var BPromise=require(_0x89c4('0x5'));var Mustache=require('mustache');var util=require('util');var path=require(_0x89c4('0x6'));var sox=require(_0x89c4('0x7'));var csv=require('to-csv');var ejs=require(_0x89c4('0x8'));var fs=require('fs');var fs_extra=require(_0x89c4('0x9'));var _=require(_0x89c4('0xa'));var squel=require(_0x89c4('0xb'));var crypto=require(_0x89c4('0xc'));var jsforce=require(_0x89c4('0xd'));var deskjs=require(_0x89c4('0xe'));var toCsv=require(_0x89c4('0xf'));var querystring=require(_0x89c4('0x10'));var Papa=require(_0x89c4('0x11'));var Redis=require(_0x89c4('0x12'));var authService=require(_0x89c4('0x13'));var qs=require(_0x89c4('0x14'));var as=require(_0x89c4('0x15'));var hardwareService=require(_0x89c4('0x16'));var logger=require(_0x89c4('0x17'))(_0x89c4('0x18'));var utils=require(_0x89c4('0x19'));var config=require(_0x89c4('0x1a'));var licenseUtil=require(_0x89c4('0x1b'));var db=require('../../mysqldb')['db'];function respondWithStatusCode(_0x59516a,_0x58f872){_0x58f872=_0x58f872||0xcc;return function(_0x1d2e9d){if(_0x1d2e9d){return _0x59516a[_0x89c4('0x1c')](_0x58f872);}return _0x59516a[_0x89c4('0x1d')](_0x58f872)[_0x89c4('0x1e')]();};}function respondWithResult(_0x620757,_0x18d0bf){_0x18d0bf=_0x18d0bf||0xc8;return function(_0x84b446){if(_0x84b446){return _0x620757['status'](_0x18d0bf)[_0x89c4('0x1f')](_0x84b446);}};}function respondWithFilteredResult(_0x2bd1d8,_0x5aefe9){return function(_0x4207a5){if(_0x4207a5){var _0x5cd765=typeof _0x5aefe9[_0x89c4('0x20')]===_0x89c4('0x21')&&typeof _0x5aefe9[_0x89c4('0x22')]==='undefined';var _0x41cb06=_0x4207a5['count'];var _0x29342c=_0x5cd765?0x0:_0x5aefe9[_0x89c4('0x20')];var _0x574f49=_0x5cd765?_0x4207a5[_0x89c4('0x23')]:_0x5aefe9['offset']+_0x5aefe9['limit'];var _0x40617b;if(_0x574f49>=_0x41cb06){_0x574f49=_0x41cb06;_0x40617b=0xc8;}else{_0x40617b=0xce;}_0x2bd1d8[_0x89c4('0x1d')](_0x40617b);return _0x2bd1d8[_0x89c4('0x24')]('Content-Range',_0x29342c+'-'+_0x574f49+'/'+_0x41cb06)[_0x89c4('0x1f')](_0x4207a5);}return null;};}function patchUpdates(_0x5b8a37){return function(_0x38e347){try{jsonpatch[_0x89c4('0x25')](_0x38e347,_0x5b8a37,!![]);}catch(_0x55473d){return BPromise[_0x89c4('0x26')](_0x55473d);}return _0x38e347[_0x89c4('0x27')]();};}function saveUpdates(_0x398fc4,_0xc528ee){return function(_0x15ad38){if(_0x15ad38){return _0x15ad38[_0x89c4('0x28')](_0x398fc4)['then'](function(_0x330226){return _0x330226;});}return null;};}function removeEntity(_0x41be54,_0x59e8ee){return function(_0x2e7e6b){if(_0x2e7e6b){return _0x2e7e6b[_0x89c4('0x29')]()[_0x89c4('0x2a')](function(){_0x41be54[_0x89c4('0x1d')](0xcc)[_0x89c4('0x1e')]();});}};}function handleEntityNotFound(_0xa739bd,_0x4f0b19){return function(_0x13d4db){if(!_0x13d4db){_0xa739bd[_0x89c4('0x1c')](0x194);}return _0x13d4db;};}function handleError(_0x1d95f6,_0x1d65c5){_0x1d65c5=_0x1d65c5||0x1f4;return function(_0x17c9f9){logger[_0x89c4('0x2b')](_0x17c9f9[_0x89c4('0x2c')]);if(_0x17c9f9[_0x89c4('0x2d')]){delete _0x17c9f9[_0x89c4('0x2d')];}_0x1d95f6[_0x89c4('0x1d')](_0x1d65c5)[_0x89c4('0x2e')](_0x17c9f9);};}exports[_0x89c4('0x2f')]=function(_0x79e258,_0xba0375){var _0x51fcda={},_0x5e9b35={},_0x271404={'count':0x0,'rows':[]};var _0x5e214e=_[_0x89c4('0x30')](db[_0x89c4('0x31')][_0x89c4('0x32')],function(_0x387e72){return{'name':_0x387e72[_0x89c4('0x33')],'type':_0x387e72[_0x89c4('0x34')][_0x89c4('0x35')]};});_0x5e9b35[_0x89c4('0x36')]=_[_0x89c4('0x30')](_0x5e214e,_0x89c4('0x2d'));_0x5e9b35[_0x89c4('0x37')]=_['keys'](_0x79e258['query']);_0x5e9b35['filters']=_[_0x89c4('0x38')](_0x5e9b35[_0x89c4('0x36')],_0x5e9b35[_0x89c4('0x37')]);_0x51fcda[_0x89c4('0x39')]=_[_0x89c4('0x38')](_0x5e9b35[_0x89c4('0x36')],qs[_0x89c4('0x3a')](_0x79e258[_0x89c4('0x37')][_0x89c4('0x3a')]));_0x51fcda[_0x89c4('0x39')]=_0x51fcda[_0x89c4('0x39')][_0x89c4('0x3b')]?_0x51fcda['attributes']:_0x5e9b35[_0x89c4('0x36')];if(!_0x79e258['query']['hasOwnProperty'](_0x89c4('0x3c'))){_0x51fcda[_0x89c4('0x22')]=qs[_0x89c4('0x22')](_0x79e258[_0x89c4('0x37')][_0x89c4('0x22')]);_0x51fcda['offset']=qs[_0x89c4('0x20')](_0x79e258[_0x89c4('0x37')][_0x89c4('0x20')]);}_0x51fcda['order']=qs[_0x89c4('0x3d')](_0x79e258['query'][_0x89c4('0x3d')]);_0x51fcda[_0x89c4('0x3e')]=qs[_0x89c4('0x3f')](_[_0x89c4('0x40')](_0x79e258[_0x89c4('0x37')],_0x5e9b35[_0x89c4('0x3f')]),_0x5e214e);if(_0x79e258[_0x89c4('0x37')][_0x89c4('0x41')]){_0x51fcda[_0x89c4('0x3e')]=_[_0x89c4('0x42')](_0x51fcda[_0x89c4('0x3e')],{'$or':_[_0x89c4('0x30')](_0x5e214e,function(_0x301b4d){if(_0x301b4d[_0x89c4('0x34')]!=='VIRTUAL'){var _0x15a021={};_0x15a021[_0x301b4d[_0x89c4('0x2d')]]={'$like':'%'+_0x79e258[_0x89c4('0x37')][_0x89c4('0x41')]+'%'};return _0x15a021;}})});}_0x51fcda=_[_0x89c4('0x42')]({},_0x51fcda,_0x79e258['options']);var _0x218da9={'where':_0x51fcda[_0x89c4('0x3e')]};return db['ChatQueueReport'][_0x89c4('0x23')](_0x218da9)[_0x89c4('0x2a')](function(_0x1d29d8){_0x271404[_0x89c4('0x23')]=_0x1d29d8;if(_0x79e258['query'][_0x89c4('0x43')]){_0x51fcda['include']=[{'all':!![]}];}return db['ChatQueueReport'][_0x89c4('0x44')](_0x51fcda);})[_0x89c4('0x2a')](function(_0x2612cd){_0x271404[_0x89c4('0x45')]=_0x2612cd;return _0x271404;})['then'](respondWithFilteredResult(_0xba0375,_0x51fcda))[_0x89c4('0x46')](handleError(_0xba0375,null));};exports[_0x89c4('0x47')]=function(_0x431e17,_0x292247){var _0x969e35={'raw':!![],'where':{'id':_0x431e17['params']['id']}},_0x2bd72a={};_0x2bd72a['model']=_[_0x89c4('0x48')](db[_0x89c4('0x31')][_0x89c4('0x32')]);_0x2bd72a[_0x89c4('0x37')]=_[_0x89c4('0x48')](_0x431e17[_0x89c4('0x37')]);_0x2bd72a[_0x89c4('0x3f')]=_[_0x89c4('0x38')](_0x2bd72a['model'],_0x2bd72a['query']);_0x969e35[_0x89c4('0x39')]=_[_0x89c4('0x38')](_0x2bd72a[_0x89c4('0x36')],qs['fields'](_0x431e17[_0x89c4('0x37')][_0x89c4('0x3a')]));_0x969e35[_0x89c4('0x39')]=_0x969e35[_0x89c4('0x39')][_0x89c4('0x3b')]?_0x969e35[_0x89c4('0x39')]:_0x2bd72a['model'];if(_0x431e17[_0x89c4('0x37')]['includeAll']){_0x969e35['include']=[{'all':!![]}];}_0x969e35=_[_0x89c4('0x42')]({},_0x969e35,_0x431e17[_0x89c4('0x49')]);return db['ChatQueueReport'][_0x89c4('0x4a')](_0x969e35)['then'](handleEntityNotFound(_0x292247,null))['then'](respondWithResult(_0x292247,null))[_0x89c4('0x46')](handleError(_0x292247,null));};exports[_0x89c4('0x4b')]=function(_0xfd7317,_0x2612de){return db[_0x89c4('0x31')][_0x89c4('0x4b')](_0xfd7317[_0x89c4('0x4c')],{})[_0x89c4('0x2a')](respondWithResult(_0x2612de,0xc9))['catch'](handleError(_0x2612de,null));};exports[_0x89c4('0x28')]=function(_0x183115,_0x5e0b35){if(_0x183115[_0x89c4('0x4c')]['id']){delete _0x183115[_0x89c4('0x4c')]['id'];}return db[_0x89c4('0x31')]['find']({'where':{'id':_0x183115[_0x89c4('0x4d')]['id']}})['then'](handleEntityNotFound(_0x5e0b35,null))[_0x89c4('0x2a')](saveUpdates(_0x183115[_0x89c4('0x4c')],null))[_0x89c4('0x2a')](respondWithResult(_0x5e0b35,null))[_0x89c4('0x46')](handleError(_0x5e0b35,null));};exports['destroy']=function(_0x2e6bcc,_0x492484){return db['ChatQueueReport'][_0x89c4('0x4a')]({'where':{'id':_0x2e6bcc[_0x89c4('0x4d')]['id']}})[_0x89c4('0x2a')](handleEntityNotFound(_0x492484,null))[_0x89c4('0x2a')](removeEntity(_0x492484,null))[_0x89c4('0x46')](handleError(_0x492484,null));};exports[_0x89c4('0x4e')]=function(_0x3c4bf1,_0xb532ea){return db[_0x89c4('0x31')][_0x89c4('0x4e')]()['then'](respondWithResult(_0xb532ea,null))[_0x89c4('0x46')](handleError(_0xb532ea,null));}; \ No newline at end of file diff --git a/server/api/chatQueueReport/chatQueueReport.model.js b/server/api/chatQueueReport/chatQueueReport.model.js index efc5610..a3f3039 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 _0x0713=['../../config/logger','api','moment','bluebird','request-promise','rimraf','../../config/environment','./chatQueueReport.attributes','exports','define','ChatQueueReport','report_chat_queue','uniqueid'];(function(_0x631a3c,_0x1b61b6){var _0x2bdfa3=function(_0x21711b){while(--_0x21711b){_0x631a3c['push'](_0x631a3c['shift']());}};_0x2bdfa3(++_0x1b61b6);}(_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 _0x757a=['report_chat_queue','uniqueid','util','../../config/logger','request-promise','path','rimraf','../../config/environment','./chatQueueReport.attributes','exports','define'];(function(_0x42195c,_0x1cf60d){var _0x1820a2=function(_0x156908){while(--_0x156908){_0x42195c['push'](_0x42195c['shift']());}};_0x1820a2(++_0x1cf60d);}(_0x757a,0xde));var _0xa757=function(_0x13ccc1,_0x30549b){_0x13ccc1=_0x13ccc1-0x0;var _0x297c9e=_0x757a[_0x13ccc1];return _0x297c9e;};'use strict';var _=require('lodash');var util=require(_0xa757('0x0'));var logger=require(_0xa757('0x1'))('api');var moment=require('moment');var BPromise=require('bluebird');var rp=require(_0xa757('0x2'));var fs=require('fs');var path=require(_0xa757('0x3'));var rimraf=require(_0xa757('0x4'));var config=require(_0xa757('0x5'));var attributes=require(_0xa757('0x6'));module[_0xa757('0x7')]=function(_0x5edca8,_0xae0e7c){return _0x5edca8[_0xa757('0x8')]('ChatQueueReport',attributes,{'tableName':_0xa757('0x9'),'paranoid':![],'indexes':[{'name':_0xa757('0xa'),'fields':[_0xa757('0xa')]}],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/chatQueueReport/chatQueueReport.rpc.js b/server/api/chatQueueReport/chatQueueReport.rpc.js index c44e72b..90de71f 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 _0xd5fc=['rpc','jayson/promise','http','then','ChatQueueReport,\x20%s,\x20%s','debug','request\x20sent','stringify','error','message','info','result','catch','create','body','options','CreateChatQueueReport','ChatQueueReport','update','raw','where','attributes','limit','UpdateChatQueueReport','lodash','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger'];(function(_0x126558,_0x143c9a){var _0x1f6d14=function(_0x2b0eea){while(--_0x2b0eea){_0x126558['push'](_0x126558['shift']());}};_0x1f6d14(++_0x143c9a);}(_0xd5fc,0xae));var _0xcd5f=function(_0x2fac84,_0x1b4a37){_0x2fac84=_0x2fac84-0x0;var _0x1d348f=_0xd5fc[_0x2fac84];return _0x1d348f;};'use strict';var _=require(_0xcd5f('0x0'));var util=require('util');var moment=require('moment');var BPromise=require('bluebird');var rs=require(_0xcd5f('0x1'));var fs=require('fs');var Redis=require(_0xcd5f('0x2'));var db=require(_0xcd5f('0x3'))['db'];var utils=require(_0xcd5f('0x4'));var logger=require(_0xcd5f('0x5'))(_0xcd5f('0x6'));var config=require('../../config/environment');var jayson=require(_0xcd5f('0x7'));var client=jayson['client'][_0xcd5f('0x8')]({'port':0x232a});function respondWithRpcPromise(_0x159b3f,_0x5af696,_0x58d65d){return new BPromise(function(_0x4e668e,_0x102ce9){return client['request'](_0x159b3f,_0x58d65d)[_0xcd5f('0x9')](function(_0x3e63d4){logger['info'](_0xcd5f('0xa'),_0x5af696,'request\x20sent');logger[_0xcd5f('0xb')]('ChatQueueReport,\x20%s,\x20%s,\x20%s',_0x5af696,_0xcd5f('0xc'),JSON[_0xcd5f('0xd')](_0x3e63d4));if(_0x3e63d4[_0xcd5f('0xe')]){if(_0x3e63d4[_0xcd5f('0xe')]['code']===0x1f4){logger[_0xcd5f('0xe')](_0xcd5f('0xa'),_0x5af696,_0x3e63d4['error'][_0xcd5f('0xf')]);return _0x102ce9(_0x3e63d4[_0xcd5f('0xe')][_0xcd5f('0xf')]);}logger[_0xcd5f('0xe')](_0xcd5f('0xa'),_0x5af696,_0x3e63d4['error'][_0xcd5f('0xf')]);return _0x4e668e(_0x3e63d4[_0xcd5f('0xe')][_0xcd5f('0xf')]);}else{logger[_0xcd5f('0x10')](_0xcd5f('0xa'),_0x5af696,_0xcd5f('0xc'));_0x4e668e(_0x3e63d4[_0xcd5f('0x11')]['message']);}})[_0xcd5f('0x12')](function(_0x33ab1a){logger[_0xcd5f('0xe')](_0xcd5f('0xa'),_0x5af696,_0x33ab1a);_0x102ce9(_0x33ab1a);});});}exports['CreateChatQueueReport']=function(_0x1a4cb6){var _0x56a874=this;return new Promise(function(_0xb23761,_0x36c60c){return db['ChatQueueReport'][_0xcd5f('0x13')](_0x1a4cb6[_0xcd5f('0x14')],{'raw':_0x1a4cb6['options']?_0x1a4cb6[_0xcd5f('0x15')]['raw']===undefined?!![]:![]:!![]})[_0xcd5f('0x9')](function(_0x5c3c9f){logger['info'](_0xcd5f('0x16'),_0x1a4cb6);logger['debug']('CreateChatQueueReport',_0x1a4cb6,JSON['stringify'](_0x5c3c9f));_0xb23761(_0x5c3c9f);})[_0xcd5f('0x12')](function(_0x5c03b9){logger[_0xcd5f('0xe')](_0xcd5f('0x16'),_0x5c03b9[_0xcd5f('0xf')],_0x1a4cb6);_0x36c60c(_0x56a874[_0xcd5f('0xe')](0x1f4,_0x5c03b9[_0xcd5f('0xf')]));});});};exports['UpdateChatQueueReport']=function(_0x388290){var _0x41015c=this;return new Promise(function(_0x4dc7ab,_0xba8e2e){return db[_0xcd5f('0x17')][_0xcd5f('0x18')](_0x388290[_0xcd5f('0x14')],{'raw':_0x388290[_0xcd5f('0x15')]?_0x388290[_0xcd5f('0x15')][_0xcd5f('0x19')]===undefined?!![]:![]:!![],'individualHooks':!![],'where':_0x388290[_0xcd5f('0x15')]?_0x388290[_0xcd5f('0x15')][_0xcd5f('0x1a')]||null:null,'attributes':_0x388290[_0xcd5f('0x15')]?_0x388290[_0xcd5f('0x15')][_0xcd5f('0x1b')]||null:null,'limit':_0x388290[_0xcd5f('0x15')]?_0x388290['options'][_0xcd5f('0x1c')]||null:null})[_0xcd5f('0x9')](function(_0x561414){logger[_0xcd5f('0x10')]('UpdateChatQueueReport',_0x388290);logger[_0xcd5f('0xb')](_0xcd5f('0x1d'),_0x388290,JSON[_0xcd5f('0xd')](_0x561414));_0x4dc7ab(_0x561414);})[_0xcd5f('0x12')](function(_0xb56143){logger[_0xcd5f('0xe')]('UpdateChatQueueReport',_0xb56143['message'],_0x388290);_0xba8e2e(_0x41015c[_0xcd5f('0xe')](0x1f4,_0xb56143[_0xcd5f('0xf')]));});});}; \ No newline at end of file +var _0x453d=['create','body','options','raw','then','info','debug','UpdateChatQueueReport','update','where','attributes','limit','lodash','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','client','http','request\x20sent','stringify','error','code','ChatQueueReport,\x20%s,\x20%s','message','result','catch','CreateChatQueueReport'];(function(_0x572b11,_0x1ac1d3){var _0x2c2529=function(_0x270ab5){while(--_0x270ab5){_0x572b11['push'](_0x572b11['shift']());}};_0x2c2529(++_0x1ac1d3);}(_0x453d,0x1cc));var _0xd453=function(_0x16f4a7,_0x57e66c){_0x16f4a7=_0x16f4a7-0x0;var _0x2480ce=_0x453d[_0x16f4a7];return _0x2480ce;};'use strict';var _=require(_0xd453('0x0'));var util=require('util');var moment=require('moment');var BPromise=require('bluebird');var rs=require(_0xd453('0x1'));var fs=require('fs');var Redis=require(_0xd453('0x2'));var db=require(_0xd453('0x3'))['db'];var utils=require(_0xd453('0x4'));var logger=require(_0xd453('0x5'))(_0xd453('0x6'));var config=require(_0xd453('0x7'));var jayson=require(_0xd453('0x8'));var client=jayson[_0xd453('0x9')][_0xd453('0xa')]({'port':0x232a});function respondWithRpcPromise(_0x1a468f,_0x4534e7,_0x181a63){return new BPromise(function(_0x3edcb1,_0x13a0b2){return client['request'](_0x1a468f,_0x181a63)['then'](function(_0x5ee816){logger['info']('ChatQueueReport,\x20%s,\x20%s',_0x4534e7,_0xd453('0xb'));logger['debug']('ChatQueueReport,\x20%s,\x20%s,\x20%s',_0x4534e7,'request\x20sent',JSON[_0xd453('0xc')](_0x5ee816));if(_0x5ee816[_0xd453('0xd')]){if(_0x5ee816[_0xd453('0xd')][_0xd453('0xe')]===0x1f4){logger[_0xd453('0xd')](_0xd453('0xf'),_0x4534e7,_0x5ee816['error'][_0xd453('0x10')]);return _0x13a0b2(_0x5ee816[_0xd453('0xd')][_0xd453('0x10')]);}logger[_0xd453('0xd')](_0xd453('0xf'),_0x4534e7,_0x5ee816[_0xd453('0xd')][_0xd453('0x10')]);return _0x3edcb1(_0x5ee816['error']['message']);}else{logger['info'](_0xd453('0xf'),_0x4534e7,_0xd453('0xb'));_0x3edcb1(_0x5ee816[_0xd453('0x11')][_0xd453('0x10')]);}})[_0xd453('0x12')](function(_0x5524b8){logger[_0xd453('0xd')]('ChatQueueReport,\x20%s,\x20%s',_0x4534e7,_0x5524b8);_0x13a0b2(_0x5524b8);});});}exports[_0xd453('0x13')]=function(_0x44ef75){var _0xe795f3=this;return new Promise(function(_0x381942,_0xbecc52){return db['ChatQueueReport'][_0xd453('0x14')](_0x44ef75[_0xd453('0x15')],{'raw':_0x44ef75[_0xd453('0x16')]?_0x44ef75[_0xd453('0x16')][_0xd453('0x17')]===undefined?!![]:![]:!![]})[_0xd453('0x18')](function(_0x245bd7){logger[_0xd453('0x19')]('CreateChatQueueReport',_0x44ef75);logger[_0xd453('0x1a')](_0xd453('0x13'),_0x44ef75,JSON[_0xd453('0xc')](_0x245bd7));_0x381942(_0x245bd7);})[_0xd453('0x12')](function(_0x28e310){logger[_0xd453('0xd')]('CreateChatQueueReport',_0x28e310[_0xd453('0x10')],_0x44ef75);_0xbecc52(_0xe795f3[_0xd453('0xd')](0x1f4,_0x28e310[_0xd453('0x10')]));});});};exports[_0xd453('0x1b')]=function(_0x5cdcf5){var _0x1951ef=this;return new Promise(function(_0x51f294,_0x2a6428){return db['ChatQueueReport'][_0xd453('0x1c')](_0x5cdcf5[_0xd453('0x15')],{'raw':_0x5cdcf5[_0xd453('0x16')]?_0x5cdcf5[_0xd453('0x16')]['raw']===undefined?!![]:![]:!![],'individualHooks':!![],'where':_0x5cdcf5[_0xd453('0x16')]?_0x5cdcf5[_0xd453('0x16')][_0xd453('0x1d')]||null:null,'attributes':_0x5cdcf5[_0xd453('0x16')]?_0x5cdcf5['options'][_0xd453('0x1e')]||null:null,'limit':_0x5cdcf5[_0xd453('0x16')]?_0x5cdcf5['options'][_0xd453('0x1f')]||null:null})[_0xd453('0x18')](function(_0x10a127){logger[_0xd453('0x19')](_0xd453('0x1b'),_0x5cdcf5);logger[_0xd453('0x1a')]('UpdateChatQueueReport',_0x5cdcf5,JSON[_0xd453('0xc')](_0x10a127));_0x51f294(_0x10a127);})[_0xd453('0x12')](function(_0x2929e5){logger[_0xd453('0xd')](_0xd453('0x1b'),_0x2929e5[_0xd453('0x10')],_0x5cdcf5);_0x2a6428(_0x1951ef[_0xd453('0xd')](0x1f4,_0x2929e5['message']));});});}; \ No newline at end of file diff --git a/server/api/chatQueueReport/index.js b/server/api/chatQueueReport/index.js index 1cce980..f17997f 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 _0xbe3d=['/describe','/:id','create','put','update','delete','multer','util','path','connect-timeout','express','Router','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','get','isAuthenticated','index'];(function(_0x1b6186,_0x1ec7f2){var _0x186121=function(_0x1748a8){while(--_0x1748a8){_0x1b6186['push'](_0x1b6186['shift']());}};_0x186121(++_0x1ec7f2);}(_0xbe3d,0x110));var _0xdbe3=function(_0x3faeb5,_0x5b263a){_0x3faeb5=_0x3faeb5-0x0;var _0x1399ab=_0xbe3d[_0x3faeb5];return _0x1399ab;};'use strict';var multer=require(_0xdbe3('0x0'));var util=require(_0xdbe3('0x1'));var path=require(_0xdbe3('0x2'));var timeout=require(_0xdbe3('0x3'));var express=require(_0xdbe3('0x4'));var router=express[_0xdbe3('0x5')]();var fs_extra=require(_0xdbe3('0x6'));var auth=require(_0xdbe3('0x7'));var interaction=require(_0xdbe3('0x8'));var config=require(_0xdbe3('0x9'));var controller=require('./chatQueueReport.controller');router[_0xdbe3('0xa')]('/',auth[_0xdbe3('0xb')](),controller[_0xdbe3('0xc')]);router[_0xdbe3('0xa')](_0xdbe3('0xd'),auth['isAuthenticated'](),controller['describe']);router[_0xdbe3('0xa')](_0xdbe3('0xe'),auth[_0xdbe3('0xb')](),controller['show']);router['post']('/',auth[_0xdbe3('0xb')](),controller[_0xdbe3('0xf')]);router[_0xdbe3('0x10')](_0xdbe3('0xe'),auth['isAuthenticated'](),controller[_0xdbe3('0x11')]);router[_0xdbe3('0x12')](_0xdbe3('0xe'),auth[_0xdbe3('0xb')](),controller['destroy']);module['exports']=router; \ No newline at end of file +var _0x8da7=['util','path','connect-timeout','express','fs-extra','../../components/interaction/service','../../config/environment','get','isAuthenticated','index','describe','/:id','post','create','put','update','delete','destroy','exports','multer'];(function(_0x2dafbe,_0x5d04de){var _0x58a45a=function(_0x50ac96){while(--_0x50ac96){_0x2dafbe['push'](_0x2dafbe['shift']());}};_0x58a45a(++_0x5d04de);}(_0x8da7,0x1df));var _0x78da=function(_0x4f1a3a,_0x498e17){_0x4f1a3a=_0x4f1a3a-0x0;var _0x66bc98=_0x8da7[_0x4f1a3a];return _0x66bc98;};'use strict';var multer=require(_0x78da('0x0'));var util=require(_0x78da('0x1'));var path=require(_0x78da('0x2'));var timeout=require(_0x78da('0x3'));var express=require(_0x78da('0x4'));var router=express['Router']();var fs_extra=require(_0x78da('0x5'));var auth=require('../../components/auth/service');var interaction=require(_0x78da('0x6'));var config=require(_0x78da('0x7'));var controller=require('./chatQueueReport.controller');router[_0x78da('0x8')]('/',auth[_0x78da('0x9')](),controller[_0x78da('0xa')]);router[_0x78da('0x8')]('/describe',auth['isAuthenticated'](),controller[_0x78da('0xb')]);router[_0x78da('0x8')](_0x78da('0xc'),auth[_0x78da('0x9')](),controller['show']);router[_0x78da('0xd')]('/',auth[_0x78da('0x9')](),controller[_0x78da('0xe')]);router[_0x78da('0xf')](_0x78da('0xc'),auth['isAuthenticated'](),controller[_0x78da('0x10')]);router[_0x78da('0x11')]('/:id',auth[_0x78da('0x9')](),controller[_0x78da('0x12')]);module[_0x78da('0x13')]=router; \ No newline at end of file diff --git a/server/api/chatTransferReport/chatTransferReport.attributes.js b/server/api/chatTransferReport/chatTransferReport.attributes.js index 8a20932..d7c429e 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 _0x008c=['ENUM','agent','queue','DATE','NOW','moment','sequelize','exports','STRING'];(function(_0x55976e,_0x27e156){var _0x169ee6=function(_0x34b8c3){while(--_0x34b8c3){_0x55976e['push'](_0x55976e['shift']());}};_0x169ee6(++_0x27e156);}(_0x008c,0x188));var _0xc008=function(_0x4573bd,_0x19b9b5){_0x4573bd=_0x4573bd-0x0;var _0xc07bb9=_0x008c[_0x4573bd];return _0xc07bb9;};'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 +var _0xedd9=['account','agent','queue','NOW','sequelize','exports','STRING','ENUM'];(function(_0x378145,_0x45999d){var _0x4ac781=function(_0x4e9412){while(--_0x4e9412){_0x378145['push'](_0x378145['shift']());}};_0x4ac781(++_0x45999d);}(_0xedd9,0xfc));var _0x9edd=function(_0x1c832f,_0x80eeff){_0x1c832f=_0x1c832f-0x0;var _0x11e742=_0xedd9[_0x1c832f];return _0x11e742;};'use strict';var moment=require('moment');var Sequelize=require(_0x9edd('0x0'));module[_0x9edd('0x1')]={'uniqueid':{'type':Sequelize[_0x9edd('0x2')],'allowNull':![]},'type':{'type':Sequelize[_0x9edd('0x3')](_0x9edd('0x4'),_0x9edd('0x5'),_0x9edd('0x6')),'allowNull':![],'defaultValue':_0x9edd('0x6')},'transferredAt':{'type':Sequelize['DATE'],'allowNull':![],'defaultValue':Sequelize[_0x9edd('0x7')]}}; \ No newline at end of file diff --git a/server/api/chatTransferReport/chatTransferReport.controller.js b/server/api/chatTransferReport/chatTransferReport.controller.js index d81095a..47fa4b9 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 _0x13a7=['jsforce','papaparse','ioredis','../../components/auth/service','../../components/parsers/advancedSearch','../../config/logger','api','../../config/environment','../../config/license/util','sendStatus','end','status','limit','undefined','count','offset','set','Content-Range','apply','reject','update','destroy','error','stack','name','send','index','map','ChatTransferReport','rawAttributes','fieldName','key','model','keys','query','intersection','attributes','fields','length','hasOwnProperty','order','sort','where','filters','filter','merge','type','VIRTUAL','options','then','includeAll','include','findAll','catch','show','params','find','create','body','describe','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','moment','bluebird','mustache','path','sox','to-csv','ejs','lodash','crypto'];(function(_0x3070dc,_0x40cf11){var _0x431489=function(_0x49bc2a){while(--_0x49bc2a){_0x3070dc['push'](_0x3070dc['shift']());}};_0x431489(++_0x40cf11);}(_0x13a7,0x164));var _0x713a=function(_0x321bb2,_0x202794){_0x321bb2=_0x321bb2-0x0;var _0x9c12ed=_0x13a7[_0x321bb2];return _0x9c12ed;};'use strict';var emlformat=require(_0x713a('0x0'));var rimraf=require(_0x713a('0x1'));var zipdir=require(_0x713a('0x2'));var jsonpatch=require(_0x713a('0x3'));var rp=require(_0x713a('0x4'));var moment=require(_0x713a('0x5'));var BPromise=require(_0x713a('0x6'));var Mustache=require(_0x713a('0x7'));var util=require('util');var path=require(_0x713a('0x8'));var sox=require(_0x713a('0x9'));var csv=require(_0x713a('0xa'));var ejs=require(_0x713a('0xb'));var fs=require('fs');var fs_extra=require('fs-extra');var _=require(_0x713a('0xc'));var squel=require('squel');var crypto=require(_0x713a('0xd'));var jsforce=require(_0x713a('0xe'));var deskjs=require('desk.js');var toCsv=require('to-csv');var querystring=require('querystring');var Papa=require(_0x713a('0xf'));var Redis=require(_0x713a('0x10'));var authService=require(_0x713a('0x11'));var qs=require('../../components/parsers/qs');var as=require(_0x713a('0x12'));var hardwareService=require('../../config/license/hardware');var logger=require(_0x713a('0x13'))(_0x713a('0x14'));var utils=require('../../config/utils');var config=require(_0x713a('0x15'));var licenseUtil=require(_0x713a('0x16'));var db=require('../../mysqldb')['db'];function respondWithStatusCode(_0x51ad6e,_0x5d37d7){_0x5d37d7=_0x5d37d7||0xcc;return function(_0x385487){if(_0x385487){return _0x51ad6e[_0x713a('0x17')](_0x5d37d7);}return _0x51ad6e['status'](_0x5d37d7)[_0x713a('0x18')]();};}function respondWithResult(_0x3ca06d,_0x33dc76){_0x33dc76=_0x33dc76||0xc8;return function(_0x734b){if(_0x734b){return _0x3ca06d[_0x713a('0x19')](_0x33dc76)['json'](_0x734b);}};}function respondWithFilteredResult(_0x5e1c32,_0x49bf0d){return function(_0x46c370){if(_0x46c370){var _0x46d260=typeof _0x49bf0d['offset']==='undefined'&&typeof _0x49bf0d[_0x713a('0x1a')]===_0x713a('0x1b');var _0x25916c=_0x46c370['count'];var _0xf41246=_0x46d260?0x0:_0x49bf0d['offset'];var _0x312304=_0x46d260?_0x46c370[_0x713a('0x1c')]:_0x49bf0d[_0x713a('0x1d')]+_0x49bf0d[_0x713a('0x1a')];var _0x4c006a;if(_0x312304>=_0x25916c){_0x312304=_0x25916c;_0x4c006a=0xc8;}else{_0x4c006a=0xce;}_0x5e1c32[_0x713a('0x19')](_0x4c006a);return _0x5e1c32[_0x713a('0x1e')](_0x713a('0x1f'),_0xf41246+'-'+_0x312304+'/'+_0x25916c)['json'](_0x46c370);}return null;};}function patchUpdates(_0x414605){return function(_0x31c483){try{jsonpatch[_0x713a('0x20')](_0x31c483,_0x414605,!![]);}catch(_0x31d31f){return BPromise[_0x713a('0x21')](_0x31d31f);}return _0x31c483['save']();};}function saveUpdates(_0xf1c2e8,_0x430ef6){return function(_0x3f6ab1){if(_0x3f6ab1){return _0x3f6ab1[_0x713a('0x22')](_0xf1c2e8)['then'](function(_0x26988a){return _0x26988a;});}return null;};}function removeEntity(_0x2a59df,_0x568fde){return function(_0x1d4f79){if(_0x1d4f79){return _0x1d4f79[_0x713a('0x23')]()['then'](function(){_0x2a59df[_0x713a('0x19')](0xcc)[_0x713a('0x18')]();});}};}function handleEntityNotFound(_0x1d3563,_0x24c0c1){return function(_0x5a1585){if(!_0x5a1585){_0x1d3563[_0x713a('0x17')](0x194);}return _0x5a1585;};}function handleError(_0x2b1bab,_0x3edbc4){_0x3edbc4=_0x3edbc4||0x1f4;return function(_0x427ca8){logger[_0x713a('0x24')](_0x427ca8[_0x713a('0x25')]);if(_0x427ca8[_0x713a('0x26')]){delete _0x427ca8[_0x713a('0x26')];}_0x2b1bab[_0x713a('0x19')](_0x3edbc4)[_0x713a('0x27')](_0x427ca8);};}exports[_0x713a('0x28')]=function(_0xa22352,_0x5cc74c){var _0x557b32={},_0x441324={},_0x5a4ced={'count':0x0,'rows':[]};var _0x3e76cb=_[_0x713a('0x29')](db[_0x713a('0x2a')][_0x713a('0x2b')],function(_0x6910d5){return{'name':_0x6910d5[_0x713a('0x2c')],'type':_0x6910d5['type'][_0x713a('0x2d')]};});_0x441324[_0x713a('0x2e')]=_[_0x713a('0x29')](_0x3e76cb,_0x713a('0x26'));_0x441324['query']=_[_0x713a('0x2f')](_0xa22352[_0x713a('0x30')]);_0x441324['filters']=_[_0x713a('0x31')](_0x441324[_0x713a('0x2e')],_0x441324[_0x713a('0x30')]);_0x557b32[_0x713a('0x32')]=_[_0x713a('0x31')](_0x441324[_0x713a('0x2e')],qs['fields'](_0xa22352['query'][_0x713a('0x33')]));_0x557b32['attributes']=_0x557b32['attributes'][_0x713a('0x34')]?_0x557b32['attributes']:_0x441324[_0x713a('0x2e')];if(!_0xa22352[_0x713a('0x30')][_0x713a('0x35')]('nolimit')){_0x557b32[_0x713a('0x1a')]=qs[_0x713a('0x1a')](_0xa22352[_0x713a('0x30')]['limit']);_0x557b32[_0x713a('0x1d')]=qs[_0x713a('0x1d')](_0xa22352['query'][_0x713a('0x1d')]);}_0x557b32[_0x713a('0x36')]=qs[_0x713a('0x37')](_0xa22352['query'][_0x713a('0x37')]);_0x557b32[_0x713a('0x38')]=qs[_0x713a('0x39')](_['pick'](_0xa22352['query'],_0x441324[_0x713a('0x39')]),_0x3e76cb);if(_0xa22352[_0x713a('0x30')][_0x713a('0x3a')]){_0x557b32[_0x713a('0x38')]=_[_0x713a('0x3b')](_0x557b32['where'],{'$or':_[_0x713a('0x29')](_0x3e76cb,function(_0x9d069c){if(_0x9d069c[_0x713a('0x3c')]!==_0x713a('0x3d')){var _0x5c5d1d={};_0x5c5d1d[_0x9d069c[_0x713a('0x26')]]={'$like':'%'+_0xa22352[_0x713a('0x30')][_0x713a('0x3a')]+'%'};return _0x5c5d1d;}})});}_0x557b32=_[_0x713a('0x3b')]({},_0x557b32,_0xa22352[_0x713a('0x3e')]);var _0x4fd7bd={'where':_0x557b32[_0x713a('0x38')]};return db[_0x713a('0x2a')][_0x713a('0x1c')](_0x4fd7bd)[_0x713a('0x3f')](function(_0x1edf70){_0x5a4ced[_0x713a('0x1c')]=_0x1edf70;if(_0xa22352[_0x713a('0x30')][_0x713a('0x40')]){_0x557b32[_0x713a('0x41')]=[{'all':!![]}];}return db[_0x713a('0x2a')][_0x713a('0x42')](_0x557b32);})[_0x713a('0x3f')](function(_0xbdaa38){_0x5a4ced['rows']=_0xbdaa38;return _0x5a4ced;})['then'](respondWithFilteredResult(_0x5cc74c,_0x557b32))[_0x713a('0x43')](handleError(_0x5cc74c,null));};exports[_0x713a('0x44')]=function(_0x21c716,_0x56cc82){var _0x60e902={'raw':!![],'where':{'id':_0x21c716[_0x713a('0x45')]['id']}},_0x2be95b={};_0x2be95b[_0x713a('0x2e')]=_[_0x713a('0x2f')](db[_0x713a('0x2a')][_0x713a('0x2b')]);_0x2be95b['query']=_['keys'](_0x21c716['query']);_0x2be95b[_0x713a('0x39')]=_[_0x713a('0x31')](_0x2be95b['model'],_0x2be95b[_0x713a('0x30')]);_0x60e902[_0x713a('0x32')]=_[_0x713a('0x31')](_0x2be95b[_0x713a('0x2e')],qs['fields'](_0x21c716[_0x713a('0x30')]['fields']));_0x60e902['attributes']=_0x60e902[_0x713a('0x32')][_0x713a('0x34')]?_0x60e902[_0x713a('0x32')]:_0x2be95b['model'];if(_0x21c716['query']['includeAll']){_0x60e902[_0x713a('0x41')]=[{'all':!![]}];}_0x60e902=_[_0x713a('0x3b')]({},_0x60e902,_0x21c716[_0x713a('0x3e')]);return db[_0x713a('0x2a')][_0x713a('0x46')](_0x60e902)['then'](handleEntityNotFound(_0x56cc82,null))[_0x713a('0x3f')](respondWithResult(_0x56cc82,null))[_0x713a('0x43')](handleError(_0x56cc82,null));};exports[_0x713a('0x47')]=function(_0x9e3dc4,_0xb07e87){return db[_0x713a('0x2a')][_0x713a('0x47')](_0x9e3dc4[_0x713a('0x48')],{})[_0x713a('0x3f')](respondWithResult(_0xb07e87,0xc9))['catch'](handleError(_0xb07e87,null));};exports[_0x713a('0x22')]=function(_0x5a24eb,_0x53afcf){if(_0x5a24eb[_0x713a('0x48')]['id']){delete _0x5a24eb[_0x713a('0x48')]['id'];}return db[_0x713a('0x2a')][_0x713a('0x46')]({'where':{'id':_0x5a24eb[_0x713a('0x45')]['id']}})[_0x713a('0x3f')](handleEntityNotFound(_0x53afcf,null))['then'](saveUpdates(_0x5a24eb['body'],null))[_0x713a('0x3f')](respondWithResult(_0x53afcf,null))[_0x713a('0x43')](handleError(_0x53afcf,null));};exports[_0x713a('0x23')]=function(_0x5ee218,_0x23fdee){return db[_0x713a('0x2a')][_0x713a('0x46')]({'where':{'id':_0x5ee218['params']['id']}})[_0x713a('0x3f')](handleEntityNotFound(_0x23fdee,null))['then'](removeEntity(_0x23fdee,null))[_0x713a('0x43')](handleError(_0x23fdee,null));};exports[_0x713a('0x49')]=function(_0x2989da,_0x52ed06){return db[_0x713a('0x2a')][_0x713a('0x49')]()['then'](respondWithResult(_0x52ed06,null))['catch'](handleError(_0x52ed06,null));}; \ No newline at end of file +var _0xc3c0=['findAll','rows','catch','show','params','options','find','create','body','describe','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','moment','mustache','util','sox','ejs','fs-extra','squel','crypto','jsforce','desk.js','to-csv','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','../../config/utils','../../config/environment','sendStatus','status','end','json','offset','undefined','limit','count','set','apply','save','update','then','destroy','error','stack','name','send','index','ChatTransferReport','rawAttributes','fieldName','type','model','map','keys','query','filters','attributes','intersection','fields','length','nolimit','order','sort','where','pick','filter','merge','includeAll','include'];(function(_0x5161d2,_0x3e3b23){var _0x6b349b=function(_0x1c3045){while(--_0x1c3045){_0x5161d2['push'](_0x5161d2['shift']());}};_0x6b349b(++_0x3e3b23);}(_0xc3c0,0xe5));var _0x0c3c=function(_0x226f8b,_0x4fb8fd){_0x226f8b=_0x226f8b-0x0;var _0x5a6b71=_0xc3c0[_0x226f8b];return _0x5a6b71;};'use strict';var emlformat=require(_0x0c3c('0x0'));var rimraf=require(_0x0c3c('0x1'));var zipdir=require(_0x0c3c('0x2'));var jsonpatch=require(_0x0c3c('0x3'));var rp=require(_0x0c3c('0x4'));var moment=require(_0x0c3c('0x5'));var BPromise=require('bluebird');var Mustache=require(_0x0c3c('0x6'));var util=require(_0x0c3c('0x7'));var path=require('path');var sox=require(_0x0c3c('0x8'));var csv=require('to-csv');var ejs=require(_0x0c3c('0x9'));var fs=require('fs');var fs_extra=require(_0x0c3c('0xa'));var _=require('lodash');var squel=require(_0x0c3c('0xb'));var crypto=require(_0x0c3c('0xc'));var jsforce=require(_0x0c3c('0xd'));var deskjs=require(_0x0c3c('0xe'));var toCsv=require(_0x0c3c('0xf'));var querystring=require('querystring');var Papa=require('papaparse');var Redis=require('ioredis');var authService=require('../../components/auth/service');var qs=require(_0x0c3c('0x10'));var as=require(_0x0c3c('0x11'));var hardwareService=require(_0x0c3c('0x12'));var logger=require(_0x0c3c('0x13'))('api');var utils=require(_0x0c3c('0x14'));var config=require(_0x0c3c('0x15'));var licenseUtil=require('../../config/license/util');var db=require('../../mysqldb')['db'];function respondWithStatusCode(_0x434267,_0x19abcf){_0x19abcf=_0x19abcf||0xcc;return function(_0x87e60f){if(_0x87e60f){return _0x434267[_0x0c3c('0x16')](_0x19abcf);}return _0x434267[_0x0c3c('0x17')](_0x19abcf)[_0x0c3c('0x18')]();};}function respondWithResult(_0x5d8c13,_0xb5156e){_0xb5156e=_0xb5156e||0xc8;return function(_0x451300){if(_0x451300){return _0x5d8c13[_0x0c3c('0x17')](_0xb5156e)[_0x0c3c('0x19')](_0x451300);}};}function respondWithFilteredResult(_0x13a3aa,_0x1ecc65){return function(_0x37a0da){if(_0x37a0da){var _0x4cdeea=typeof _0x1ecc65[_0x0c3c('0x1a')]===_0x0c3c('0x1b')&&typeof _0x1ecc65[_0x0c3c('0x1c')]===_0x0c3c('0x1b');var _0x35bb6e=_0x37a0da[_0x0c3c('0x1d')];var _0x120d53=_0x4cdeea?0x0:_0x1ecc65[_0x0c3c('0x1a')];var _0xd05923=_0x4cdeea?_0x37a0da[_0x0c3c('0x1d')]:_0x1ecc65[_0x0c3c('0x1a')]+_0x1ecc65[_0x0c3c('0x1c')];var _0x387278;if(_0xd05923>=_0x35bb6e){_0xd05923=_0x35bb6e;_0x387278=0xc8;}else{_0x387278=0xce;}_0x13a3aa[_0x0c3c('0x17')](_0x387278);return _0x13a3aa[_0x0c3c('0x1e')]('Content-Range',_0x120d53+'-'+_0xd05923+'/'+_0x35bb6e)[_0x0c3c('0x19')](_0x37a0da);}return null;};}function patchUpdates(_0x4a60ea){return function(_0x82a3f6){try{jsonpatch[_0x0c3c('0x1f')](_0x82a3f6,_0x4a60ea,!![]);}catch(_0x25ab3f){return BPromise['reject'](_0x25ab3f);}return _0x82a3f6[_0x0c3c('0x20')]();};}function saveUpdates(_0x1291e2,_0x1f69c9){return function(_0x2944cd){if(_0x2944cd){return _0x2944cd[_0x0c3c('0x21')](_0x1291e2)[_0x0c3c('0x22')](function(_0x1079ec){return _0x1079ec;});}return null;};}function removeEntity(_0xfbfa86,_0xc4f1a8){return function(_0x21ef86){if(_0x21ef86){return _0x21ef86[_0x0c3c('0x23')]()[_0x0c3c('0x22')](function(){_0xfbfa86['status'](0xcc)[_0x0c3c('0x18')]();});}};}function handleEntityNotFound(_0x5e7dbf,_0x559b95){return function(_0x36cbc4){if(!_0x36cbc4){_0x5e7dbf[_0x0c3c('0x16')](0x194);}return _0x36cbc4;};}function handleError(_0x58a49b,_0x295168){_0x295168=_0x295168||0x1f4;return function(_0x203912){logger[_0x0c3c('0x24')](_0x203912[_0x0c3c('0x25')]);if(_0x203912[_0x0c3c('0x26')]){delete _0x203912[_0x0c3c('0x26')];}_0x58a49b[_0x0c3c('0x17')](_0x295168)[_0x0c3c('0x27')](_0x203912);};}exports[_0x0c3c('0x28')]=function(_0x42f65f,_0x413718){var _0x43f0d4={},_0x348b5c={},_0x5bc70b={'count':0x0,'rows':[]};var _0x22b431=_['map'](db[_0x0c3c('0x29')][_0x0c3c('0x2a')],function(_0x59141e){return{'name':_0x59141e[_0x0c3c('0x2b')],'type':_0x59141e[_0x0c3c('0x2c')]['key']};});_0x348b5c[_0x0c3c('0x2d')]=_[_0x0c3c('0x2e')](_0x22b431,_0x0c3c('0x26'));_0x348b5c['query']=_[_0x0c3c('0x2f')](_0x42f65f[_0x0c3c('0x30')]);_0x348b5c[_0x0c3c('0x31')]=_['intersection'](_0x348b5c['model'],_0x348b5c[_0x0c3c('0x30')]);_0x43f0d4[_0x0c3c('0x32')]=_[_0x0c3c('0x33')](_0x348b5c[_0x0c3c('0x2d')],qs[_0x0c3c('0x34')](_0x42f65f[_0x0c3c('0x30')]['fields']));_0x43f0d4['attributes']=_0x43f0d4[_0x0c3c('0x32')][_0x0c3c('0x35')]?_0x43f0d4[_0x0c3c('0x32')]:_0x348b5c[_0x0c3c('0x2d')];if(!_0x42f65f[_0x0c3c('0x30')]['hasOwnProperty'](_0x0c3c('0x36'))){_0x43f0d4[_0x0c3c('0x1c')]=qs[_0x0c3c('0x1c')](_0x42f65f['query']['limit']);_0x43f0d4['offset']=qs['offset'](_0x42f65f[_0x0c3c('0x30')][_0x0c3c('0x1a')]);}_0x43f0d4[_0x0c3c('0x37')]=qs[_0x0c3c('0x38')](_0x42f65f[_0x0c3c('0x30')]['sort']);_0x43f0d4[_0x0c3c('0x39')]=qs[_0x0c3c('0x31')](_[_0x0c3c('0x3a')](_0x42f65f[_0x0c3c('0x30')],_0x348b5c[_0x0c3c('0x31')]),_0x22b431);if(_0x42f65f['query'][_0x0c3c('0x3b')]){_0x43f0d4[_0x0c3c('0x39')]=_[_0x0c3c('0x3c')](_0x43f0d4[_0x0c3c('0x39')],{'$or':_['map'](_0x22b431,function(_0x24306b){if(_0x24306b[_0x0c3c('0x2c')]!=='VIRTUAL'){var _0x2d91c3={};_0x2d91c3[_0x24306b[_0x0c3c('0x26')]]={'$like':'%'+_0x42f65f['query'][_0x0c3c('0x3b')]+'%'};return _0x2d91c3;}})});}_0x43f0d4=_['merge']({},_0x43f0d4,_0x42f65f['options']);var _0x5a77d7={'where':_0x43f0d4[_0x0c3c('0x39')]};return db[_0x0c3c('0x29')][_0x0c3c('0x1d')](_0x5a77d7)['then'](function(_0x418f39){_0x5bc70b[_0x0c3c('0x1d')]=_0x418f39;if(_0x42f65f['query'][_0x0c3c('0x3d')]){_0x43f0d4[_0x0c3c('0x3e')]=[{'all':!![]}];}return db[_0x0c3c('0x29')][_0x0c3c('0x3f')](_0x43f0d4);})[_0x0c3c('0x22')](function(_0x3ef10a){_0x5bc70b[_0x0c3c('0x40')]=_0x3ef10a;return _0x5bc70b;})[_0x0c3c('0x22')](respondWithFilteredResult(_0x413718,_0x43f0d4))[_0x0c3c('0x41')](handleError(_0x413718,null));};exports[_0x0c3c('0x42')]=function(_0xbfa116,_0x37f3ca){var _0x3fd67e={'raw':!![],'where':{'id':_0xbfa116[_0x0c3c('0x43')]['id']}},_0x9ce1a8={};_0x9ce1a8[_0x0c3c('0x2d')]=_['keys'](db[_0x0c3c('0x29')][_0x0c3c('0x2a')]);_0x9ce1a8[_0x0c3c('0x30')]=_['keys'](_0xbfa116['query']);_0x9ce1a8[_0x0c3c('0x31')]=_['intersection'](_0x9ce1a8['model'],_0x9ce1a8[_0x0c3c('0x30')]);_0x3fd67e[_0x0c3c('0x32')]=_[_0x0c3c('0x33')](_0x9ce1a8[_0x0c3c('0x2d')],qs[_0x0c3c('0x34')](_0xbfa116[_0x0c3c('0x30')]['fields']));_0x3fd67e['attributes']=_0x3fd67e[_0x0c3c('0x32')]['length']?_0x3fd67e[_0x0c3c('0x32')]:_0x9ce1a8[_0x0c3c('0x2d')];if(_0xbfa116['query'][_0x0c3c('0x3d')]){_0x3fd67e[_0x0c3c('0x3e')]=[{'all':!![]}];}_0x3fd67e=_['merge']({},_0x3fd67e,_0xbfa116[_0x0c3c('0x44')]);return db[_0x0c3c('0x29')][_0x0c3c('0x45')](_0x3fd67e)['then'](handleEntityNotFound(_0x37f3ca,null))[_0x0c3c('0x22')](respondWithResult(_0x37f3ca,null))['catch'](handleError(_0x37f3ca,null));};exports[_0x0c3c('0x46')]=function(_0x516e89,_0x3bb0d0){return db[_0x0c3c('0x29')][_0x0c3c('0x46')](_0x516e89[_0x0c3c('0x47')],{})[_0x0c3c('0x22')](respondWithResult(_0x3bb0d0,0xc9))[_0x0c3c('0x41')](handleError(_0x3bb0d0,null));};exports[_0x0c3c('0x21')]=function(_0x90de5e,_0x336b5a){if(_0x90de5e[_0x0c3c('0x47')]['id']){delete _0x90de5e['body']['id'];}return db[_0x0c3c('0x29')][_0x0c3c('0x45')]({'where':{'id':_0x90de5e[_0x0c3c('0x43')]['id']}})['then'](handleEntityNotFound(_0x336b5a,null))[_0x0c3c('0x22')](saveUpdates(_0x90de5e['body'],null))['then'](respondWithResult(_0x336b5a,null))[_0x0c3c('0x41')](handleError(_0x336b5a,null));};exports['destroy']=function(_0x1019ec,_0x39131d){return db[_0x0c3c('0x29')][_0x0c3c('0x45')]({'where':{'id':_0x1019ec['params']['id']}})[_0x0c3c('0x22')](handleEntityNotFound(_0x39131d,null))[_0x0c3c('0x22')](removeEntity(_0x39131d,null))[_0x0c3c('0x41')](handleError(_0x39131d,null));};exports['describe']=function(_0x436a83,_0x350b7a){return db[_0x0c3c('0x29')][_0x0c3c('0x48')]()[_0x0c3c('0x22')](respondWithResult(_0x350b7a,null))[_0x0c3c('0x41')](handleError(_0x350b7a,null));}; \ No newline at end of file diff --git a/server/api/chatTransferReport/chatTransferReport.model.js b/server/api/chatTransferReport/chatTransferReport.model.js index 21e4274..af63367 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 _0x8736=['ChatTransferReport','uniqueid','lodash','../../config/logger','moment','rimraf','./chatTransferReport.attributes','exports','define'];(function(_0x26dc57,_0x587646){var _0x132b16=function(_0x5219ef){while(--_0x5219ef){_0x26dc57['push'](_0x26dc57['shift']());}};_0x132b16(++_0x587646);}(_0x8736,0x110));var _0x6873=function(_0x163bbb,_0xa67b86){_0x163bbb=_0x163bbb-0x0;var _0x41b52d=_0x8736[_0x163bbb];return _0x41b52d;};'use strict';var _=require(_0x6873('0x0'));var util=require('util');var logger=require(_0x6873('0x1'))('api');var moment=require(_0x6873('0x2'));var BPromise=require('bluebird');var rp=require('request-promise');var fs=require('fs');var path=require('path');var rimraf=require(_0x6873('0x3'));var config=require('../../config/environment');var attributes=require(_0x6873('0x4'));module[_0x6873('0x5')]=function(_0x20ad6a,_0x5c7d9d){return _0x20ad6a[_0x6873('0x6')](_0x6873('0x7'),attributes,{'tableName':'report_chat_transfer','paranoid':![],'indexes':[{'name':_0x6873('0x8'),'fields':[_0x6873('0x8')]}],'timestamps':!![]});}; \ No newline at end of file +var _0x39e4=['request-promise','path','../../config/environment','./chatTransferReport.attributes','exports','define','report_chat_transfer','uniqueid','lodash','../../config/logger','api','moment','bluebird'];(function(_0x4f936d,_0x2dc3e6){var _0x3b851a=function(_0x471f6c){while(--_0x471f6c){_0x4f936d['push'](_0x4f936d['shift']());}};_0x3b851a(++_0x2dc3e6);}(_0x39e4,0xf2));var _0x439e=function(_0xae405e,_0x5b05d8){_0xae405e=_0xae405e-0x0;var _0x31ac9d=_0x39e4[_0xae405e];return _0x31ac9d;};'use strict';var _=require(_0x439e('0x0'));var util=require('util');var logger=require(_0x439e('0x1'))(_0x439e('0x2'));var moment=require(_0x439e('0x3'));var BPromise=require(_0x439e('0x4'));var rp=require(_0x439e('0x5'));var fs=require('fs');var path=require(_0x439e('0x6'));var rimraf=require('rimraf');var config=require(_0x439e('0x7'));var attributes=require(_0x439e('0x8'));module[_0x439e('0x9')]=function(_0x661ab7,_0x280f7d){return _0x661ab7[_0x439e('0xa')]('ChatTransferReport',attributes,{'tableName':_0x439e('0xb'),'paranoid':![],'indexes':[{'name':_0x439e('0xc'),'fields':['uniqueid']}],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/chatTransferReport/chatTransferReport.rpc.js b/server/api/chatTransferReport/chatTransferReport.rpc.js index 314d551..81b1ab0 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 _0xd308=['lodash','util','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/logger','rpc','../../config/environment','jayson/promise','client','http','then','info','ChatTransferReport,\x20%s,\x20%s','request\x20sent','debug','ChatTransferReport,\x20%s,\x20%s,\x20%s','error','code','message','result','catch'];(function(_0x1a9a2c,_0x4a513c){var _0x1a4b04=function(_0x50bd87){while(--_0x50bd87){_0x1a9a2c['push'](_0x1a9a2c['shift']());}};_0x1a4b04(++_0x4a513c);}(_0xd308,0x108));var _0x8d30=function(_0x3b5778,_0x228ccf){_0x3b5778=_0x3b5778-0x0;var _0x3e3902=_0xd308[_0x3b5778];return _0x3e3902;};'use strict';var _=require(_0x8d30('0x0'));var util=require(_0x8d30('0x1'));var moment=require(_0x8d30('0x2'));var BPromise=require(_0x8d30('0x3'));var rs=require(_0x8d30('0x4'));var fs=require('fs');var Redis=require(_0x8d30('0x5'));var db=require(_0x8d30('0x6'))['db'];var utils=require('../../config/utils');var logger=require(_0x8d30('0x7'))(_0x8d30('0x8'));var config=require(_0x8d30('0x9'));var jayson=require(_0x8d30('0xa'));var client=jayson[_0x8d30('0xb')][_0x8d30('0xc')]({'port':0x232a});function respondWithRpcPromise(_0x4e0f6a,_0xbf0135,_0x244226){return new BPromise(function(_0x123894,_0x5aef62){return client['request'](_0x4e0f6a,_0x244226)[_0x8d30('0xd')](function(_0x37dbc1){logger[_0x8d30('0xe')](_0x8d30('0xf'),_0xbf0135,_0x8d30('0x10'));logger[_0x8d30('0x11')](_0x8d30('0x12'),_0xbf0135,'request\x20sent',JSON['stringify'](_0x37dbc1));if(_0x37dbc1[_0x8d30('0x13')]){if(_0x37dbc1['error'][_0x8d30('0x14')]===0x1f4){logger[_0x8d30('0x13')]('ChatTransferReport,\x20%s,\x20%s',_0xbf0135,_0x37dbc1[_0x8d30('0x13')][_0x8d30('0x15')]);return _0x5aef62(_0x37dbc1[_0x8d30('0x13')][_0x8d30('0x15')]);}logger['error'](_0x8d30('0xf'),_0xbf0135,_0x37dbc1['error'][_0x8d30('0x15')]);return _0x123894(_0x37dbc1[_0x8d30('0x13')][_0x8d30('0x15')]);}else{logger[_0x8d30('0xe')](_0x8d30('0xf'),_0xbf0135,_0x8d30('0x10'));_0x123894(_0x37dbc1[_0x8d30('0x16')][_0x8d30('0x15')]);}})[_0x8d30('0x17')](function(_0x5ee119){logger['error'](_0x8d30('0xf'),_0xbf0135,_0x5ee119);_0x5aef62(_0x5ee119);});});} \ No newline at end of file +var _0x3bed=['code','message','result','catch','lodash','util','moment','bluebird','randomstring','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','client','http','then','info','ChatTransferReport,\x20%s,\x20%s','request\x20sent','debug','stringify','error'];(function(_0x4ad029,_0x42e383){var _0x36bb2d=function(_0x5e70ba){while(--_0x5e70ba){_0x4ad029['push'](_0x4ad029['shift']());}};_0x36bb2d(++_0x42e383);}(_0x3bed,0x16c));var _0xd3be=function(_0x321d42,_0x1b0954){_0x321d42=_0x321d42-0x0;var _0x25f4f2=_0x3bed[_0x321d42];return _0x25f4f2;};'use strict';var _=require(_0xd3be('0x0'));var util=require(_0xd3be('0x1'));var moment=require(_0xd3be('0x2'));var BPromise=require(_0xd3be('0x3'));var rs=require(_0xd3be('0x4'));var fs=require('fs');var Redis=require('ioredis');var db=require(_0xd3be('0x5'))['db'];var utils=require(_0xd3be('0x6'));var logger=require(_0xd3be('0x7'))(_0xd3be('0x8'));var config=require(_0xd3be('0x9'));var jayson=require(_0xd3be('0xa'));var client=jayson[_0xd3be('0xb')][_0xd3be('0xc')]({'port':0x232a});function respondWithRpcPromise(_0x5bcf74,_0x26c8c9,_0x17c814){return new BPromise(function(_0x2c9909,_0x55c636){return client['request'](_0x5bcf74,_0x17c814)[_0xd3be('0xd')](function(_0x557860){logger[_0xd3be('0xe')](_0xd3be('0xf'),_0x26c8c9,_0xd3be('0x10'));logger[_0xd3be('0x11')]('ChatTransferReport,\x20%s,\x20%s,\x20%s',_0x26c8c9,_0xd3be('0x10'),JSON[_0xd3be('0x12')](_0x557860));if(_0x557860[_0xd3be('0x13')]){if(_0x557860['error'][_0xd3be('0x14')]===0x1f4){logger[_0xd3be('0x13')](_0xd3be('0xf'),_0x26c8c9,_0x557860[_0xd3be('0x13')][_0xd3be('0x15')]);return _0x55c636(_0x557860[_0xd3be('0x13')][_0xd3be('0x15')]);}logger[_0xd3be('0x13')]('ChatTransferReport,\x20%s,\x20%s',_0x26c8c9,_0x557860['error'][_0xd3be('0x15')]);return _0x2c9909(_0x557860[_0xd3be('0x13')][_0xd3be('0x15')]);}else{logger[_0xd3be('0xe')]('ChatTransferReport,\x20%s,\x20%s',_0x26c8c9,'request\x20sent');_0x2c9909(_0x557860[_0xd3be('0x16')][_0xd3be('0x15')]);}})[_0xd3be('0x17')](function(_0x1ef62c){logger['error'](_0xd3be('0xf'),_0x26c8c9,_0x1ef62c);_0x55c636(_0x1ef62c);});});} \ No newline at end of file diff --git a/server/api/chatTransferReport/index.js b/server/api/chatTransferReport/index.js index 032f39d..5f9f5e2 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 _0x4a9b=['multer','util','path','express','Router','fs-extra','../../components/auth/service','../../config/environment','./chatTransferReport.controller','get','index','/describe','isAuthenticated','describe','/:id','show','post','create','put','update','delete','destroy'];(function(_0x397e5f,_0x454c8f){var _0x5302b8=function(_0x1a29ef){while(--_0x1a29ef){_0x397e5f['push'](_0x397e5f['shift']());}};_0x5302b8(++_0x454c8f);}(_0x4a9b,0xdc));var _0xb4a9=function(_0x34319e,_0xce6bae){_0x34319e=_0x34319e-0x0;var _0x2f1eca=_0x4a9b[_0x34319e];return _0x2f1eca;};'use strict';var multer=require(_0xb4a9('0x0'));var util=require(_0xb4a9('0x1'));var path=require(_0xb4a9('0x2'));var timeout=require('connect-timeout');var express=require(_0xb4a9('0x3'));var router=express[_0xb4a9('0x4')]();var fs_extra=require(_0xb4a9('0x5'));var auth=require(_0xb4a9('0x6'));var interaction=require('../../components/interaction/service');var config=require(_0xb4a9('0x7'));var controller=require(_0xb4a9('0x8'));router[_0xb4a9('0x9')]('/',auth['isAuthenticated'](),controller[_0xb4a9('0xa')]);router[_0xb4a9('0x9')](_0xb4a9('0xb'),auth[_0xb4a9('0xc')](),controller[_0xb4a9('0xd')]);router['get'](_0xb4a9('0xe'),auth[_0xb4a9('0xc')](),controller[_0xb4a9('0xf')]);router[_0xb4a9('0x10')]('/',auth[_0xb4a9('0xc')](),controller[_0xb4a9('0x11')]);router[_0xb4a9('0x12')](_0xb4a9('0xe'),auth['isAuthenticated'](),controller[_0xb4a9('0x13')]);router[_0xb4a9('0x14')](_0xb4a9('0xe'),auth[_0xb4a9('0xc')](),controller[_0xb4a9('0x15')]);module['exports']=router; \ No newline at end of file +var _0x088c=['/:id','show','post','create','put','update','destroy','multer','util','path','connect-timeout','express','Router','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','get','isAuthenticated','index'];(function(_0x24033d,_0x1832fe){var _0x1f6fb5=function(_0x5e05a1){while(--_0x5e05a1){_0x24033d['push'](_0x24033d['shift']());}};_0x1f6fb5(++_0x1832fe);}(_0x088c,0x16f));var _0xc088=function(_0x3fb84d,_0x5e54bf){_0x3fb84d=_0x3fb84d-0x0;var _0x566803=_0x088c[_0x3fb84d];return _0x566803;};'use strict';var multer=require(_0xc088('0x0'));var util=require(_0xc088('0x1'));var path=require(_0xc088('0x2'));var timeout=require(_0xc088('0x3'));var express=require(_0xc088('0x4'));var router=express[_0xc088('0x5')]();var fs_extra=require(_0xc088('0x6'));var auth=require(_0xc088('0x7'));var interaction=require(_0xc088('0x8'));var config=require(_0xc088('0x9'));var controller=require('./chatTransferReport.controller');router[_0xc088('0xa')]('/',auth[_0xc088('0xb')](),controller[_0xc088('0xc')]);router[_0xc088('0xa')]('/describe',auth[_0xc088('0xb')](),controller['describe']);router['get'](_0xc088('0xd'),auth[_0xc088('0xb')](),controller[_0xc088('0xe')]);router[_0xc088('0xf')]('/',auth[_0xc088('0xb')](),controller[_0xc088('0x10')]);router[_0xc088('0x11')](_0xc088('0xd'),auth['isAuthenticated'](),controller[_0xc088('0x12')]);router['delete'](_0xc088('0xd'),auth[_0xc088('0xb')](),controller[_0xc088('0x13')]);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 6b582f9..5d21117 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 _0xec31=['parse','setDataValue','textarea','Comments','Leave\x20your\x20comments','offlineForm','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','alternate','#fafafa','System','Status\x20to\x20put\x20when\x20mandatory\x20disposition\x20is\x20enabled','Enabled/disables\x20mandatory\x20dispo\x20on\x20a\x20queue','mandatoryDispositionPauseId','mandatoryDisposition','Generated\x20by\x20XCALLY\x20Motion','sequelize','randomstring','exports','STRING','address','email','Agent','#011F6A','#ffffff','INTEGER','BOOLEAN','ENUM','rounded','squared','Chat','Send','Contact\x20us','Powered\x20by\x20xCALLY','TEXT','Do\x20you\x20want\x20to\x20close\x20the\x20interaction?','Form\x20submission\x20error','Note','Thanks\x20you\x20for\x20your\x20time!','Feedback','star','stringify','input','text','name','getDataValue','onlineForm'];(function(_0x55fc1f,_0x9fe63a){var _0x4cddfd=function(_0x1b134e){while(--_0x1b134e){_0x55fc1f['push'](_0x55fc1f['shift']());}};_0x4cddfd(++_0x9fe63a);}(_0xec31,0x14d));var _0x1ec3=function(_0x4bd336,_0x31d665){_0x4bd336=_0x4bd336-0x0;var _0x3407db=_0xec31[_0x4bd336];return _0x3407db;};'use strict';var Sequelize=require(_0x1ec3('0x0'));var rs=require(_0x1ec3('0x1'));module[_0x1ec3('0x2')]={'name':{'type':Sequelize[_0x1ec3('0x3')],'allowNull':![]},'address':{'type':Sequelize['STRING'],'allowNull':![],'unique':_0x1ec3('0x4')},'description':{'type':Sequelize['STRING']},'mapKey':{'type':Sequelize[_0x1ec3('0x3')],'defaultValue':_0x1ec3('0x5')},'mapKeyOffline':{'type':Sequelize['STRING'],'defaultValue':_0x1ec3('0x5')},'key':{'type':Sequelize[_0x1ec3('0x3')],'allowNull':![]},'agentAlias':{'type':Sequelize[_0x1ec3('0x3')],'defaultValue':_0x1ec3('0x6')},'customerAlias':{'type':Sequelize[_0x1ec3('0x3')],'defaultValue':'Me'},'color':{'type':Sequelize[_0x1ec3('0x3')],'allowNull':![],'defaultValue':_0x1ec3('0x7'),'validate':{'notEmpty':!![]}},'color_button':{'type':Sequelize[_0x1ec3('0x3')],'allowNull':![],'defaultValue':'#011F6A','validate':{'notEmpty':!![]}},'textColor':{'type':Sequelize[_0x1ec3('0x3')],'allowNull':![],'defaultValue':_0x1ec3('0x8'),'validate':{'notEmpty':!![]}},'textButtonColor':{'type':Sequelize[_0x1ec3('0x3')],'allowNull':![],'defaultValue':_0x1ec3('0x8'),'validate':{'notEmpty':!![]}},'fontSize':{'type':Sequelize[_0x1ec3('0x9')],'defaultValue':0xf},'remote':{'type':Sequelize[_0x1ec3('0x3')]},'animation':{'type':Sequelize[_0x1ec3('0xa')],'defaultValue':!![]},'header_shape':{'type':Sequelize[_0x1ec3('0xb')](_0x1ec3('0xc'),_0x1ec3('0xd')),'defaultValue':_0x1ec3('0xc')},'header_online':{'type':Sequelize[_0x1ec3('0x3')],'defaultValue':'We\x20are\x20here!'},'start_chat_button':{'type':Sequelize['STRING'],'defaultValue':_0x1ec3('0xe')},'offline_chat_button':{'type':Sequelize[_0x1ec3('0x3')],'defaultValue':_0x1ec3('0xf')},'header_offline':{'type':Sequelize['STRING'],'defaultValue':_0x1ec3('0x10')},'download_transcript':{'type':Sequelize[_0x1ec3('0xa')],'defaultValue':!![]},'timeout':{'type':Sequelize[_0x1ec3('0x9')],'defaultValue':0x0},'whiteLabel':{'type':Sequelize[_0x1ec3('0x3')],'defaultValue':_0x1ec3('0x11')},'defaultWhiteLabel':{'type':Sequelize[_0x1ec3('0xa')],'defaultValue':!![]},'sitepic':{'type':Sequelize[_0x1ec3('0x12')]},'closingQuestion':{'type':Sequelize[_0x1ec3('0x3')],'defaultValue':_0x1ec3('0x13')},'formSubmitSuccessMessage':{'type':Sequelize['STRING'],'defaultValue':'Form\x20properly\x20submitted'},'formSubmitFailureMessage':{'type':Sequelize[_0x1ec3('0x3')],'defaultValue':_0x1ec3('0x14')},'noteTitle':{'type':Sequelize['STRING'],'defaultValue':_0x1ec3('0x15')},'placeholderMessage':{'type':Sequelize[_0x1ec3('0x3')],'defaultValue':'Type\x20a\x20message'},'closingMessage':{'type':Sequelize[_0x1ec3('0x3')],'defaultValue':_0x1ec3('0x16')},'closingMessageButton':{'type':Sequelize[_0x1ec3('0x3')],'defaultValue':_0x1ec3('0xf')},'skipMessageButton':{'type':Sequelize[_0x1ec3('0x3')],'defaultValue':'Skip'},'conditionAgreement':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'enableRating':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'enableFeedback':{'type':Sequelize[_0x1ec3('0xa')],'defaultValue':![]},'enableSendButton':{'type':Sequelize[_0x1ec3('0xa')],'defaultValue':![]},'feedbackTitle':{'type':Sequelize[_0x1ec3('0x3')],'defaultValue':_0x1ec3('0x17')},'ratingType':{'type':Sequelize[_0x1ec3('0xb')](_0x1ec3('0x18'),'thumb'),'defaultValue':_0x1ec3('0x18')},'ratingStarsNumber':{'type':Sequelize[_0x1ec3('0x9')],'defaultValue':0x5},'onlineForm':{'type':Sequelize[_0x1ec3('0x12')],'defaultValue':function(){return JSON[_0x1ec3('0x19')]({'items':[{'type':_0x1ec3('0x1a'),'variable':null,'config':{'placeholder':'name','type':_0x1ec3('0x1b'),'required':!![]},'props':{'title':_0x1ec3('0x1c'),'helpText':''}},{'type':_0x1ec3('0x1a'),'props':{'title':_0x1ec3('0x5'),'helpText':''},'config':{'required':!![],'placeholder':'email','type':_0x1ec3('0x5')},'variable':null}],'fromKey':0x1});},'get':function(){return this[_0x1ec3('0x1d')](_0x1ec3('0x1e'))?JSON[_0x1ec3('0x1f')](this[_0x1ec3('0x1d')]('onlineForm')):{};},'set':function(_0x4348ca){return this[_0x1ec3('0x20')]('onlineForm',JSON[_0x1ec3('0x19')](_0x4348ca));}},'offlineForm':{'type':Sequelize['TEXT'],'defaultValue':function(){return JSON['stringify']({'items':[{'type':'input','props':{'title':_0x1ec3('0x5'),'helpText':''},'config':{'required':!![],'placeholder':_0x1ec3('0x5'),'type':_0x1ec3('0x5')},'variable':null},{'type':_0x1ec3('0x21'),'config':{'placeholder':_0x1ec3('0x22')},'props':{'title':_0x1ec3('0x22'),'helpText':_0x1ec3('0x23')}}],'fromKey':0x0});},'get':function(){return this[_0x1ec3('0x1d')](_0x1ec3('0x24'))?JSON[_0x1ec3('0x1f')](this[_0x1ec3('0x1d')](_0x1ec3('0x24'))):{};},'set':function(_0x2d9b34){return this['setDataValue'](_0x1ec3('0x24'),JSON[_0x1ec3('0x19')](_0x2d9b34));}},'token':{'type':Sequelize['STRING'],'defaultValue':function(){return rs['generate']();}},'autoclose':{'type':Sequelize[_0x1ec3('0xa')],'defaultValue':!![]},'enableCustomerWriting':{'type':Sequelize[_0x1ec3('0xa')],'defaultValue':![]},'forwardTranscript':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'forwardTranscriptMessage':{'type':Sequelize['STRING']},'forwardOffline':{'type':Sequelize[_0x1ec3('0xa')],'defaultValue':![]},'forwardOfflineAddress':{'type':Sequelize[_0x1ec3('0x3')]},'waitingTitle':{'type':Sequelize[_0x1ec3('0x3')],'defaultValue':'All\x20of\x20our\x20agents\x20are\x20busy\x20at\x20this\x20time.\x20Your\x20chat\x20is\x20very\x20important\x20to\x20us.'},'waitingMessage':{'type':Sequelize[_0x1ec3('0x3')],'defaultValue':_0x1ec3('0x25')},'offlineMessageSubject':{'type':Sequelize[_0x1ec3('0x3')],'defaultValue':'New\x20offline\x20message\x20from\x20websiteName'},'offlineMessageBody':{'type':Sequelize[_0x1ec3('0x3')],'defaultValue':_0x1ec3('0x26')},'enableUnmanagedNote':{'type':Sequelize[_0x1ec3('0xa')],'defaultValue':!![]},'unmanagedMessage':{'type':Sequelize[_0x1ec3('0x3')],'defaultValue':_0x1ec3('0x27')},'skipUnmanaged':{'type':Sequelize['STRING'],'defaultValue':'Skip'},'sendUnmanaged':{'type':Sequelize['STRING'],'defaultValue':_0x1ec3('0xf')},'enableCustomerAttachment':{'type':Sequelize[_0x1ec3('0xa')],'defaultValue':![]},'enableCustomerCheckmarks':{'type':Sequelize[_0x1ec3('0xa')],'defaultValue':![]},'agentAvatar':{'type':Sequelize[_0x1ec3('0x12')]},'showAgentAvatar':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'timezone':{'type':Sequelize[_0x1ec3('0x3')]},'notificationTemplate':{'type':Sequelize['TEXT'],'defaultValue':function(){return _0x1ec3('0x28');}},'notificationSound':{'type':Sequelize['BOOLEAN'],'defaultValue':!![]},'notificationShake':{'type':Sequelize[_0x1ec3('0xa')],'defaultValue':![]},'hideWhenOffline':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'agentIdentifier':{'type':Sequelize[_0x1ec3('0x3')],'defaultValue':_0x1ec3('0x29')},'waitForTheAssignedAgent':{'type':Sequelize[_0x1ec3('0x9')],'validate':{'min':0x1,'max':0x20c49b},'defaultValue':0xa},'waitForTheAssignedQueue':{'type':Sequelize[_0x1ec3('0x9')],'validate':{'min':0x1,'max':0x20c49b},'defaultValue':0xa},'alignment':{'type':Sequelize[_0x1ec3('0x3')],'defaultValue':_0x1ec3('0x2a')},'verticalAlignment':{'type':Sequelize[_0x1ec3('0x9')],'defaultValue':0x1e},'labelText':{'type':Sequelize[_0x1ec3('0x3')],'defaultValue':_0x1ec3('0x2b')},'messagesAlignment':{'type':Sequelize[_0x1ec3('0x3')],'defaultValue':_0x1ec3('0x2c')},'defaultTitle':{'type':Sequelize['STRING']},'customerAvatar':{'type':Sequelize[_0x1ec3('0x12')]},'showCustomerAvatar':{'type':Sequelize[_0x1ec3('0xa')],'defaultValue':![]},'messageFontSize':{'type':Sequelize[_0x1ec3('0x9')],'defaultValue':0xc},'backgroundColor':{'type':Sequelize[_0x1ec3('0x3')],'allowNull':![],'defaultValue':_0x1ec3('0x2d'),'validate':{'notEmpty':!![]}},'queueTransfer':{'type':Sequelize[_0x1ec3('0xa')],'defaultValue':![]},'queueTransferTimeout':{'type':Sequelize['INTEGER'],'validate':{'min':0x1,'max':0x20c49b},'defaultValue':0x12c},'agentTransfer':{'type':Sequelize[_0x1ec3('0xa')],'defaultValue':![]},'agentTransferTimeout':{'type':Sequelize[_0x1ec3('0x9')],'validate':{'min':0x1,'max':0x20c49b},'defaultValue':0x12c},'systemAlias':{'type':Sequelize[_0x1ec3('0x3')],'defaultValue':_0x1ec3('0x2e')},'systemAvatar':{'type':Sequelize[_0x1ec3('0x12')]},'mandatoryDispositionPauseId':{'type':Sequelize[_0x1ec3('0x9')],'comment':_0x1ec3('0x2f')},'mandatoryDisposition':{'type':Sequelize[_0x1ec3('0xa')],'defaultValue':![],'comment':_0x1ec3('0x30'),'set':function(_0x367ff0){if(!_0x367ff0)this[_0x1ec3('0x20')](_0x1ec3('0x31'),null);this['setDataValue'](_0x1ec3('0x32'),_0x367ff0);}},'vidaooEscalation':{'type':Sequelize[_0x1ec3('0xa')],'defaultValue':![]},'vidaooApiKey':{'type':Sequelize[_0x1ec3('0x3')]},'vidaooTopic':{'type':Sequelize[_0x1ec3('0x3')],'allowNull':![],'defaultValue':_0x1ec3('0x33')},'vidaooNote':{'type':Sequelize[_0x1ec3('0x3')],'defaultValue':function(){return'Meeting\x20generated\x20for\x20interaction\x20#{{interaction.id}}\x20by\x20{{agent.name}}';}},'vidaooMetadata':{'type':Sequelize[_0x1ec3('0x12')],'defaultValue':null},'openNewInteraction':{'type':Sequelize['BOOLEAN'],'defaultValue':![],'allowNull':!![]},'subjectOffline':{'type':Sequelize['TEXT']}}; \ No newline at end of file +var _0x1a2d=['Powered\x20by\x20xCALLY','TEXT','Do\x20you\x20want\x20to\x20close\x20the\x20interaction?','Form\x20properly\x20submitted','Form\x20submission\x20error','Type\x20a\x20message','Thanks\x20you\x20for\x20your\x20time!','Skip','star','thumb','stringify','input','name','text','getDataValue','parse','onlineForm','setDataValue','Comments','Leave\x20your\x20comments','offlineForm','Please\x20hold\x20and\x20we\x20will\x20answer\x20your\x20request\x20as\x20soon\x20as\x20possible.','New\x20offline\x20message\x20from\x20websiteName','Your\x20request\x20has\x20not\x20been\x20processed.','Account:\x20{{account.name}}
{{#queue}}Queue:\x20{{queue.name}}
{{/queue}}From\x20:\x20{{from}}','bottom_right','CHAT','System','Status\x20to\x20put\x20when\x20mandatory\x20disposition\x20is\x20enabled','Enabled/disables\x20mandatory\x20dispo\x20on\x20a\x20queue','mandatoryDispositionPauseId','Generated\x20by\x20XCALLY\x20Motion','Meeting\x20generated\x20for\x20interaction\x20#{{interaction.id}}\x20by\x20{{agent.name}}','sequelize','randomstring','exports','STRING','address','email','Agent','#ffffff','INTEGER','BOOLEAN','ENUM','rounded','squared','We\x20are\x20here!','Chat','Send'];(function(_0x501510,_0x61caa9){var _0x1e6ee5=function(_0x32845b){while(--_0x32845b){_0x501510['push'](_0x501510['shift']());}};_0x1e6ee5(++_0x61caa9);}(_0x1a2d,0x1da));var _0xd1a2=function(_0x2817bd,_0x3846ca){_0x2817bd=_0x2817bd-0x0;var _0x3bbd81=_0x1a2d[_0x2817bd];return _0x3bbd81;};'use strict';var Sequelize=require(_0xd1a2('0x0'));var rs=require(_0xd1a2('0x1'));module[_0xd1a2('0x2')]={'name':{'type':Sequelize[_0xd1a2('0x3')],'allowNull':![]},'address':{'type':Sequelize[_0xd1a2('0x3')],'allowNull':![],'unique':_0xd1a2('0x4')},'description':{'type':Sequelize[_0xd1a2('0x3')]},'mapKey':{'type':Sequelize[_0xd1a2('0x3')],'defaultValue':_0xd1a2('0x5')},'mapKeyOffline':{'type':Sequelize['STRING'],'defaultValue':_0xd1a2('0x5')},'key':{'type':Sequelize[_0xd1a2('0x3')],'allowNull':![]},'agentAlias':{'type':Sequelize[_0xd1a2('0x3')],'defaultValue':_0xd1a2('0x6')},'customerAlias':{'type':Sequelize[_0xd1a2('0x3')],'defaultValue':'Me'},'color':{'type':Sequelize[_0xd1a2('0x3')],'allowNull':![],'defaultValue':'#011F6A','validate':{'notEmpty':!![]}},'color_button':{'type':Sequelize[_0xd1a2('0x3')],'allowNull':![],'defaultValue':'#011F6A','validate':{'notEmpty':!![]}},'textColor':{'type':Sequelize['STRING'],'allowNull':![],'defaultValue':_0xd1a2('0x7'),'validate':{'notEmpty':!![]}},'textButtonColor':{'type':Sequelize['STRING'],'allowNull':![],'defaultValue':'#ffffff','validate':{'notEmpty':!![]}},'fontSize':{'type':Sequelize[_0xd1a2('0x8')],'defaultValue':0xf},'remote':{'type':Sequelize[_0xd1a2('0x3')]},'animation':{'type':Sequelize[_0xd1a2('0x9')],'defaultValue':!![]},'header_shape':{'type':Sequelize[_0xd1a2('0xa')](_0xd1a2('0xb'),_0xd1a2('0xc')),'defaultValue':'rounded'},'header_online':{'type':Sequelize[_0xd1a2('0x3')],'defaultValue':_0xd1a2('0xd')},'start_chat_button':{'type':Sequelize['STRING'],'defaultValue':_0xd1a2('0xe')},'offline_chat_button':{'type':Sequelize['STRING'],'defaultValue':_0xd1a2('0xf')},'header_offline':{'type':Sequelize['STRING'],'defaultValue':'Contact\x20us'},'download_transcript':{'type':Sequelize[_0xd1a2('0x9')],'defaultValue':!![]},'timeout':{'type':Sequelize[_0xd1a2('0x8')],'defaultValue':0x0},'whiteLabel':{'type':Sequelize['STRING'],'defaultValue':_0xd1a2('0x10')},'defaultWhiteLabel':{'type':Sequelize[_0xd1a2('0x9')],'defaultValue':!![]},'sitepic':{'type':Sequelize[_0xd1a2('0x11')]},'closingQuestion':{'type':Sequelize['STRING'],'defaultValue':_0xd1a2('0x12')},'formSubmitSuccessMessage':{'type':Sequelize[_0xd1a2('0x3')],'defaultValue':_0xd1a2('0x13')},'formSubmitFailureMessage':{'type':Sequelize[_0xd1a2('0x3')],'defaultValue':_0xd1a2('0x14')},'noteTitle':{'type':Sequelize['STRING'],'defaultValue':'Note'},'placeholderMessage':{'type':Sequelize[_0xd1a2('0x3')],'defaultValue':_0xd1a2('0x15')},'closingMessage':{'type':Sequelize['STRING'],'defaultValue':_0xd1a2('0x16')},'closingMessageButton':{'type':Sequelize[_0xd1a2('0x3')],'defaultValue':_0xd1a2('0xf')},'skipMessageButton':{'type':Sequelize[_0xd1a2('0x3')],'defaultValue':_0xd1a2('0x17')},'conditionAgreement':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'enableRating':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'enableFeedback':{'type':Sequelize[_0xd1a2('0x9')],'defaultValue':![]},'enableSendButton':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'feedbackTitle':{'type':Sequelize[_0xd1a2('0x3')],'defaultValue':'Feedback'},'ratingType':{'type':Sequelize['ENUM'](_0xd1a2('0x18'),_0xd1a2('0x19')),'defaultValue':'star'},'ratingStarsNumber':{'type':Sequelize[_0xd1a2('0x8')],'defaultValue':0x5},'onlineForm':{'type':Sequelize[_0xd1a2('0x11')],'defaultValue':function(){return JSON[_0xd1a2('0x1a')]({'items':[{'type':_0xd1a2('0x1b'),'variable':null,'config':{'placeholder':_0xd1a2('0x1c'),'type':_0xd1a2('0x1d'),'required':!![]},'props':{'title':_0xd1a2('0x1c'),'helpText':''}},{'type':_0xd1a2('0x1b'),'props':{'title':_0xd1a2('0x5'),'helpText':''},'config':{'required':!![],'placeholder':_0xd1a2('0x5'),'type':'email'},'variable':null}],'fromKey':0x1});},'get':function(){return this[_0xd1a2('0x1e')]('onlineForm')?JSON[_0xd1a2('0x1f')](this['getDataValue'](_0xd1a2('0x20'))):{};},'set':function(_0x56ceb7){return this[_0xd1a2('0x21')](_0xd1a2('0x20'),JSON[_0xd1a2('0x1a')](_0x56ceb7));}},'offlineForm':{'type':Sequelize[_0xd1a2('0x11')],'defaultValue':function(){return JSON[_0xd1a2('0x1a')]({'items':[{'type':_0xd1a2('0x1b'),'props':{'title':_0xd1a2('0x5'),'helpText':''},'config':{'required':!![],'placeholder':_0xd1a2('0x5'),'type':_0xd1a2('0x5')},'variable':null},{'type':'textarea','config':{'placeholder':'Comments'},'props':{'title':_0xd1a2('0x22'),'helpText':_0xd1a2('0x23')}}],'fromKey':0x0});},'get':function(){return this[_0xd1a2('0x1e')](_0xd1a2('0x24'))?JSON[_0xd1a2('0x1f')](this[_0xd1a2('0x1e')](_0xd1a2('0x24'))):{};},'set':function(_0x517f5e){return this[_0xd1a2('0x21')]('offlineForm',JSON[_0xd1a2('0x1a')](_0x517f5e));}},'token':{'type':Sequelize['STRING'],'defaultValue':function(){return rs['generate']();}},'autoclose':{'type':Sequelize[_0xd1a2('0x9')],'defaultValue':!![]},'enableCustomerWriting':{'type':Sequelize[_0xd1a2('0x9')],'defaultValue':![]},'forwardTranscript':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'forwardTranscriptMessage':{'type':Sequelize['STRING']},'forwardOffline':{'type':Sequelize[_0xd1a2('0x9')],'defaultValue':![]},'forwardOfflineAddress':{'type':Sequelize[_0xd1a2('0x3')]},'waitingTitle':{'type':Sequelize[_0xd1a2('0x3')],'defaultValue':'All\x20of\x20our\x20agents\x20are\x20busy\x20at\x20this\x20time.\x20Your\x20chat\x20is\x20very\x20important\x20to\x20us.'},'waitingMessage':{'type':Sequelize[_0xd1a2('0x3')],'defaultValue':_0xd1a2('0x25')},'offlineMessageSubject':{'type':Sequelize['STRING'],'defaultValue':_0xd1a2('0x26')},'offlineMessageBody':{'type':Sequelize[_0xd1a2('0x3')],'defaultValue':'You\x20received\x20a\x20new\x20offline\x20message\x20from\x20websiteName.\x20Here\x20you\x20can\x20find\x20the\x20details\x20of\x20the\x20request:'},'enableUnmanagedNote':{'type':Sequelize[_0xd1a2('0x9')],'defaultValue':!![]},'unmanagedMessage':{'type':Sequelize[_0xd1a2('0x3')],'defaultValue':_0xd1a2('0x27')},'skipUnmanaged':{'type':Sequelize[_0xd1a2('0x3')],'defaultValue':_0xd1a2('0x17')},'sendUnmanaged':{'type':Sequelize[_0xd1a2('0x3')],'defaultValue':_0xd1a2('0xf')},'enableCustomerAttachment':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'enableCustomerCheckmarks':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'agentAvatar':{'type':Sequelize[_0xd1a2('0x11')]},'showAgentAvatar':{'type':Sequelize[_0xd1a2('0x9')],'defaultValue':![]},'timezone':{'type':Sequelize[_0xd1a2('0x3')]},'notificationTemplate':{'type':Sequelize[_0xd1a2('0x11')],'defaultValue':function(){return _0xd1a2('0x28');}},'notificationSound':{'type':Sequelize[_0xd1a2('0x9')],'defaultValue':!![]},'notificationShake':{'type':Sequelize[_0xd1a2('0x9')],'defaultValue':![]},'hideWhenOffline':{'type':Sequelize[_0xd1a2('0x9')],'defaultValue':![]},'agentIdentifier':{'type':Sequelize[_0xd1a2('0x3')],'defaultValue':'website_alias'},'waitForTheAssignedAgent':{'type':Sequelize[_0xd1a2('0x8')],'validate':{'min':0x1,'max':0x20c49b},'defaultValue':0xa},'waitForTheAssignedQueue':{'type':Sequelize[_0xd1a2('0x8')],'validate':{'min':0x1,'max':0x20c49b},'defaultValue':0xa},'alignment':{'type':Sequelize[_0xd1a2('0x3')],'defaultValue':_0xd1a2('0x29')},'verticalAlignment':{'type':Sequelize[_0xd1a2('0x8')],'defaultValue':0x1e},'labelText':{'type':Sequelize['STRING'],'defaultValue':_0xd1a2('0x2a')},'messagesAlignment':{'type':Sequelize[_0xd1a2('0x3')],'defaultValue':'alternate'},'defaultTitle':{'type':Sequelize[_0xd1a2('0x3')]},'customerAvatar':{'type':Sequelize['TEXT']},'showCustomerAvatar':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'messageFontSize':{'type':Sequelize[_0xd1a2('0x8')],'defaultValue':0xc},'backgroundColor':{'type':Sequelize['STRING'],'allowNull':![],'defaultValue':'#fafafa','validate':{'notEmpty':!![]}},'queueTransfer':{'type':Sequelize[_0xd1a2('0x9')],'defaultValue':![]},'queueTransferTimeout':{'type':Sequelize[_0xd1a2('0x8')],'validate':{'min':0x1,'max':0x20c49b},'defaultValue':0x12c},'agentTransfer':{'type':Sequelize[_0xd1a2('0x9')],'defaultValue':![]},'agentTransferTimeout':{'type':Sequelize['INTEGER'],'validate':{'min':0x1,'max':0x20c49b},'defaultValue':0x12c},'systemAlias':{'type':Sequelize[_0xd1a2('0x3')],'defaultValue':_0xd1a2('0x2b')},'systemAvatar':{'type':Sequelize[_0xd1a2('0x11')]},'mandatoryDispositionPauseId':{'type':Sequelize[_0xd1a2('0x8')],'comment':_0xd1a2('0x2c')},'mandatoryDisposition':{'type':Sequelize[_0xd1a2('0x9')],'defaultValue':![],'comment':_0xd1a2('0x2d'),'set':function(_0x4f5c8a){if(!_0x4f5c8a)this[_0xd1a2('0x21')](_0xd1a2('0x2e'),null);this['setDataValue']('mandatoryDisposition',_0x4f5c8a);}},'vidaooEscalation':{'type':Sequelize[_0xd1a2('0x9')],'defaultValue':![]},'vidaooApiKey':{'type':Sequelize['STRING']},'vidaooTopic':{'type':Sequelize['STRING'],'allowNull':![],'defaultValue':_0xd1a2('0x2f')},'vidaooNote':{'type':Sequelize['STRING'],'defaultValue':function(){return _0xd1a2('0x30');}},'vidaooMetadata':{'type':Sequelize['TEXT'],'defaultValue':null},'openNewInteraction':{'type':Sequelize['BOOLEAN'],'defaultValue':![],'allowNull':!![]},'subjectOffline':{'type':Sequelize[_0xd1a2('0x11')]}}; \ No newline at end of file diff --git a/server/api/chatWebsite/chatWebsite.controller.js b/server/api/chatWebsite/chatWebsite.controller.js index 98b3222..b68a8d7 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 _0x9854=['Chat','NotifyMailAccount','notifyMail','remove','addInteraction','ids','omit','getInteractions','Contact','fullname','internal','Tags','color','tag','getProactiveActions','virtual','License','increment','chatLicenseExceeded','server/files/chat/iframe.ejs','utf8','origin','http://localhost:9000','remote','x-real-ip','connection','remoteAddress','replace','alignment','verticalAlignment','labelText','textButtonColor','color_button','backgroundColor','IntervalId','Transaction','ISOLATION_LEVELS','READ_COMMITTED','bulkCreate','finally','getApplications','addProactiveActions','chatProactiveAction','getFields','online','false','onlineForm','items','fromKey','getOfflineMessages','Attachment','Attachments','addAgents','emit','userChatWebsite:save','removeAgents','isArray','userChatWebsite:remove','getAgents','util','path','ejs','fs-extra','lodash','querystring','jayson/promise','../../config/logger','api','../../config/environment','../../errors/api','APIBadRequestError','APINotFoundError','APIOutOfIntervalError','handleError','APIConflictError','./helpers/wildcard-expressions','url','URL','redis','defaults','localhost','socket.io-emitter','./chatWebsite.socket','register','client','http','request','info','ChatWebsite,\x20%s,\x20%s,\x20%s','stringify','error','code','ChatWebsite,\x20%s,\x20%s','message','request\x20sent','result','catch','sendStatus','status','end','offset','undefined','limit','count','Content-Range','json','update','then','destroy','UserProfileResource','stack','name','user-agent-parser','getResult','customerIp','cf-connecting-ip','x-forwarded-for','split','firstName','lastName','x-real-port','browser','version','format','%s\x20%s','unknown','device','model','vendor','%s\x20%s\x20%s','type','index','Pause','mandatoryDispositionPause','map','ChatWebsite','rawAttributes','fieldName','query','filters','attributes','intersection','fields','length','hasOwnProperty','nolimit','order','sort','where','pick','filter','merge','VIRTUAL','options','findAll','show','params','keys','includeAll','include','find','body','address','trim','testWildcardValidity','create','user','Unable\x20to\x20retrieve\x20the\x20current\x20user','role','get','UserProfileSection','userProfileId','autoAssociation','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','forEach','\x22\x20is\x20not\x20a\x20valid\x20wildcard\x20expression','describe','addDisposition','ChatWebsiteId','Disposition','getDispositions','findOne','rows','addAnswer','CannedAnswer','getAnswers','removeAnswers','addLogo','file','filename','addCustomerAvatar','customerAvatar','addSystemAvatar','systemAvatar','getLogo','root','server/files/images/logos/default_logo.svg','sitepic','getLicense','custom','isNil','existsSync','join','server/files/images/logos/','download','getAvatar','agentAvatar','server/files/images/avatars/','getCustomerAvatar','server/files/images/avatars/customer_avatar.png','showCustomerAvatar','getSystemAvatar','server/files/images/avatars/system_avatar.png','Interval','resolve','timezone','ifTime','chat','from','From\x20is\x20mandatory','mapKey','isEmpty','referer','CmContact','No\x20available\x20attributes','createdAt','updatedAt','CompanyId','ListId','includes','Contacts','ChatApplication','Intervals','Chat\x20Website\x20with\x20id\x20%s\x20not\x20found','account','applications','orderBy','Applications','priority','asc','List','list','contact','headers','threadId','closed','ChatInteraction','Writing\x20on\x20closed\x20interaction','externalUrl','ContactId','interaction','messageId','created','autoclose','push','close','unmanaged','*,*,*,*','ChatMessage','AttachmentId','UserId','User','forcedOwnership','queueId','unshift','queue','waitForTheAssignedQueue','startRouting','EventManager','offline','files','ValidationError','no\x20available\x20attributes','difference','Sequelize','from\x20is\x20mandatory','body\x20is\x20mandatory\x20and\x20not\x20empty','mapKeyOffline','send','mapKeyOffline\x20is\x20mandatory,\x20please\x20use\x20one\x20of\x20these:\x20','mapKeyOffline\x20invalid,\x20please\x20use\x20one\x20of\x20these:\x20','CmList','MailAccount','findOrCreate','spread','readFileSync','render','offlineMessageBody','ChatOfflineMessage','fromString','originalname','server','offline-chat','basename','openNewInteraction','sequelize','transaction','MailServerOut','Smtp','CloudProvider','forwardOffline','getSmtpOptions','SendMail','sendMail','\x22%s\x22\x20<%s>','email','MailAccountId','mimetype','subjectOffline','toPairsIn','offlineMessageSubject'];(function(_0x3d7814,_0x1e9257){var _0x2830fc=function(_0x22733f){while(--_0x22733f){_0x3d7814['push'](_0x3d7814['shift']());}};_0x2830fc(++_0x1e9257);}(_0x9854,0x172));var _0x4985=function(_0x506f0d,_0x20abac){_0x506f0d=_0x506f0d-0x0;var _0x57d65c=_0x9854[_0x506f0d];return _0x57d65c;};'use strict';var Mustache=require('mustache');var util=require(_0x4985('0x0'));var path=require(_0x4985('0x1'));var ejs=require(_0x4985('0x2'));var fs=require('fs');var fs_extra=require(_0x4985('0x3'));var _=require(_0x4985('0x4'));var querystring=require(_0x4985('0x5'));var htmlToText=require('html-to-text');var Redis=require('ioredis');var jayson=require(_0x4985('0x6'));var qs=require('../../components/parsers/qs');var logger=require(_0x4985('0x7'))(_0x4985('0x8'));var config=require(_0x4985('0x9'));var APIBadRequestError=require(_0x4985('0xa'))[_0x4985('0xb')];var APINotFoundError=require(_0x4985('0xa'))[_0x4985('0xc')];var APIOutOfIntervalError=require(_0x4985('0xa'))[_0x4985('0xd')];var APIHandleError=require(_0x4985('0xa'))[_0x4985('0xe')];var APIConflictError=require(_0x4985('0xa'))[_0x4985('0xf')];var wildcardUtils=require(_0x4985('0x10'));var URL=require(_0x4985('0x11'))[_0x4985('0x12')];var db=require('../../mysqldb')['db'];config[_0x4985('0x13')]=_[_0x4985('0x14')](config[_0x4985('0x13')],{'host':_0x4985('0x15'),'port':0x18eb});var socket=require(_0x4985('0x16'))(new Redis(config['redis']));require(_0x4985('0x17'))[_0x4985('0x18')](socket);var client=jayson[_0x4985('0x19')][_0x4985('0x1a')]({'port':0x232c});var client9002=jayson[_0x4985('0x19')][_0x4985('0x1a')]({'port':0x232a});var client9003=jayson[_0x4985('0x19')][_0x4985('0x1a')]({'port':0x232b});var client9001=jayson[_0x4985('0x19')][_0x4985('0x1a')]({'port':0x2329});function respondWithRpcPromise(_0x4dda28,_0x156349,_0x145ea7,_0x48af17){return new Promise(function(_0x2cee7f,_0x1e186e){var _0x4adc0d=_0x48af17||client;return _0x4adc0d[_0x4985('0x1b')](_0x4dda28,_0x145ea7)['then'](function(_0x52f50c){logger[_0x4985('0x1c')]('ChatWebsite,\x20%s,\x20%s',_0x156349,'request\x20sent');logger['debug'](_0x4985('0x1d'),_0x156349,'request\x20sent',JSON[_0x4985('0x1e')](_0x52f50c));if(_0x52f50c[_0x4985('0x1f')]){if(_0x52f50c[_0x4985('0x1f')][_0x4985('0x20')]===0x1f4){logger[_0x4985('0x1f')](_0x4985('0x21'),_0x156349,_0x52f50c[_0x4985('0x1f')]['message']);return _0x1e186e(_0x52f50c[_0x4985('0x1f')][_0x4985('0x22')]);}logger[_0x4985('0x1f')](_0x4985('0x21'),_0x156349,_0x52f50c[_0x4985('0x1f')][_0x4985('0x22')]);return _0x2cee7f(_0x52f50c[_0x4985('0x1f')][_0x4985('0x22')]);}else{logger['info'](_0x4985('0x21'),_0x156349,_0x4985('0x23'));_0x2cee7f(_0x52f50c[_0x4985('0x24')][_0x4985('0x22')]);}})[_0x4985('0x25')](function(_0x1f3f17){logger['error'](_0x4985('0x21'),_0x156349,_0x1f3f17);_0x1e186e(_0x1f3f17);});});}function respondWithStatusCode(_0xff405,_0x436d5){_0x436d5=_0x436d5||0xcc;return function(_0x5b3b05){if(_0x5b3b05){return _0xff405[_0x4985('0x26')](_0x436d5);}return _0xff405[_0x4985('0x27')](_0x436d5)[_0x4985('0x28')]();};}function respondWithResult(_0x2deb4d,_0x173676){_0x173676=_0x173676||0xc8;return function(_0x237560){if(_0x237560){return _0x2deb4d['status'](_0x173676)['json'](_0x237560);}};}function respondWithFilteredResult(_0x13bbeb,_0x585506){return function(_0x429e30){if(_0x429e30){var _0x32283d=typeof _0x585506[_0x4985('0x29')]===_0x4985('0x2a')&&typeof _0x585506[_0x4985('0x2b')]===_0x4985('0x2a');var _0x2f8a51=_0x429e30[_0x4985('0x2c')];var _0x21b338=_0x32283d?0x0:_0x585506[_0x4985('0x29')];var _0x3c292c=_0x32283d?_0x429e30['count']:_0x585506[_0x4985('0x29')]+_0x585506[_0x4985('0x2b')];var _0x589e2f;if(_0x3c292c>=_0x2f8a51){_0x3c292c=_0x2f8a51;_0x589e2f=0xc8;}else{_0x589e2f=0xce;}_0x13bbeb[_0x4985('0x27')](_0x589e2f);return _0x13bbeb['set'](_0x4985('0x2d'),_0x21b338+'-'+_0x3c292c+'/'+_0x2f8a51)[_0x4985('0x2e')](_0x429e30);}return null;};}function saveUpdates(_0x20db91){return function(_0x5d909b){if(_0x5d909b){return _0x5d909b[_0x4985('0x2f')](_0x20db91)[_0x4985('0x30')](function(_0x43009e){return _0x43009e;});}return null;};}function removeEntity(_0x462090){return function(_0x5cca9e){if(_0x5cca9e){return _0x5cca9e[_0x4985('0x31')]()[_0x4985('0x30')](function(){var _0x51427e=_0x5cca9e['get']({'plain':!![]});var _0x19a873='ChatWebsites';return db[_0x4985('0x32')]['destroy']({'where':{'type':_0x19a873,'resourceId':_0x51427e['id']}})[_0x4985('0x30')](function(){return _0x5cca9e;});})[_0x4985('0x30')](function(){_0x462090[_0x4985('0x27')](0xcc)[_0x4985('0x28')]();});}};}function handleEntityNotFound(_0x65e51f){return function(_0x26d857){if(!_0x26d857){_0x65e51f[_0x4985('0x26')](0x194);}return _0x26d857;};}function handleError(_0x11d5e7,_0x5b5980){_0x5b5980=_0x5b5980||0x1f4;return function(_0x40299e){logger[_0x4985('0x1f')](_0x40299e[_0x4985('0x33')]);if(_0x40299e['name']){delete _0x40299e[_0x4985('0x34')];}_0x11d5e7[_0x4985('0x27')](_0x5b5980)['send'](_0x40299e);};}function createInteractionObject(_0x154f0b,_0x31cc96,_0x468f00,_0x32bad6){var _0x1737e3=require(_0x4985('0x35'));var _0x3bf2ee=new _0x1737e3();var _0x49b5a2=_0x3bf2ee['setUA'](_0x468f00['user-agent'])[_0x4985('0x36')]();var _0x19fa8d=_0x31cc96[_0x4985('0x37')];if(_0x468f00[_0x4985('0x38')]){_0x19fa8d=_0x468f00[_0x4985('0x38')];}else if(_0x468f00[_0x4985('0x39')]){_0x19fa8d=_['first'](_0x468f00['x-forwarded-for'][_0x4985('0x3a')](','));}return{'ContactId':_0x32bad6['id'],'ChatWebsiteId':_0x154f0b,'from':(_0x32bad6[_0x4985('0x3b')]||'')+'\x20'+(_0x32bad6[_0x4985('0x3c')]||''),'customerIp':_0x19fa8d,'customerPort':_0x468f00[_0x4985('0x3d')]?_0x468f00[_0x4985('0x3d')]:null,'referer':_0x31cc96['referer'],'browserName':_0x49b5a2['browser']['name']&&_0x49b5a2[_0x4985('0x3e')][_0x4985('0x3f')]?util[_0x4985('0x40')](_0x4985('0x41'),_0x49b5a2['browser'][_0x4985('0x34')],_0x49b5a2[_0x4985('0x3e')]['version']):_0x4985('0x42'),'browserVersion':_0x49b5a2['browser']['version']||_0x4985('0x42'),'osName':util[_0x4985('0x40')](_0x4985('0x41'),_0x49b5a2['os']['name'],_0x49b5a2['os'][_0x4985('0x3f')]),'osVersion':_0x49b5a2['os']['version'],'deviceModel':_0x49b5a2[_0x4985('0x43')][_0x4985('0x44')]&&_0x49b5a2[_0x4985('0x43')][_0x4985('0x45')]?util[_0x4985('0x40')](_0x4985('0x46'),_0x49b5a2['device'][_0x4985('0x44')],_0x49b5a2[_0x4985('0x43')][_0x4985('0x45')],_0x49b5a2[_0x4985('0x43')][_0x4985('0x47')]):null,'deviceVendor':_0x49b5a2[_0x4985('0x43')]['vendor'],'deviceType':_0x49b5a2[_0x4985('0x43')][_0x4985('0x47')],'formData':JSON[_0x4985('0x1e')](_0x31cc96)};}exports[_0x4985('0x48')]=function(_0x5de410,_0x5d9809){var _0x2d3efe={'include':[{'model':db[_0x4985('0x49')],'as':_0x4985('0x4a')}]},_0x47b510={},_0x3fbca2={'count':0x0,'rows':[]};var _0x143fc7=_[_0x4985('0x4b')](db[_0x4985('0x4c')][_0x4985('0x4d')],function(_0x560264){return{'name':_0x560264[_0x4985('0x4e')],'type':_0x560264[_0x4985('0x47')]['key']};});_0x47b510['model']=_['map'](_0x143fc7,'name');_0x47b510[_0x4985('0x4f')]=_['keys'](_0x5de410[_0x4985('0x4f')]);_0x47b510[_0x4985('0x50')]=_['intersection'](_0x47b510[_0x4985('0x44')],_0x47b510[_0x4985('0x4f')]);_0x2d3efe[_0x4985('0x51')]=_[_0x4985('0x52')](_0x47b510['model'],qs[_0x4985('0x53')](_0x5de410['query']['fields']));_0x2d3efe['attributes']=_0x2d3efe['attributes'][_0x4985('0x54')]?_0x2d3efe['attributes']:_0x47b510[_0x4985('0x44')];if(!_0x5de410['query'][_0x4985('0x55')](_0x4985('0x56'))){_0x2d3efe[_0x4985('0x2b')]=qs['limit'](_0x5de410[_0x4985('0x4f')][_0x4985('0x2b')]);_0x2d3efe[_0x4985('0x29')]=qs['offset'](_0x5de410[_0x4985('0x4f')][_0x4985('0x29')]);}_0x2d3efe[_0x4985('0x57')]=qs[_0x4985('0x58')](_0x5de410['query'][_0x4985('0x58')]);_0x2d3efe[_0x4985('0x59')]=qs[_0x4985('0x50')](_[_0x4985('0x5a')](_0x5de410['query'],_0x47b510[_0x4985('0x50')]),_0x143fc7);if(_0x5de410[_0x4985('0x4f')][_0x4985('0x5b')]){_0x2d3efe['where']=_[_0x4985('0x5c')](_0x2d3efe[_0x4985('0x59')],{'$or':_['map'](_0x143fc7,function(_0x8b1674){if(_0x8b1674[_0x4985('0x47')]!==_0x4985('0x5d')){var _0x13ee23={};_0x13ee23[_0x8b1674[_0x4985('0x34')]]={'$like':'%'+_0x5de410[_0x4985('0x4f')]['filter']+'%'};return _0x13ee23;}})});}_0x2d3efe=_[_0x4985('0x5c')]({},_0x2d3efe,_0x5de410[_0x4985('0x5e')]);var _0x5c2736={'where':_0x2d3efe['where']};return db[_0x4985('0x4c')][_0x4985('0x2c')](_0x5c2736)[_0x4985('0x30')](function(_0x41360d){_0x3fbca2[_0x4985('0x2c')]=_0x41360d;if(_0x5de410['query']['includeAll']){_0x2d3efe['include']=[{'all':!![]}];}return db[_0x4985('0x4c')][_0x4985('0x5f')](_0x2d3efe);})[_0x4985('0x30')](function(_0x126887){_0x3fbca2['rows']=_0x126887;return _0x3fbca2;})[_0x4985('0x30')](respondWithFilteredResult(_0x5d9809,_0x2d3efe))['catch'](handleError(_0x5d9809,null));};exports[_0x4985('0x60')]=function(_0x1b0274,_0x1ac617){var _0xbedf1a={'raw':![],'where':{'id':_0x1b0274[_0x4985('0x61')]['id']},'include':[{'model':db[_0x4985('0x49')],'as':_0x4985('0x4a')}]},_0x2850a5={};_0x2850a5[_0x4985('0x44')]=_[_0x4985('0x62')](db[_0x4985('0x4c')]['rawAttributes']);_0x2850a5['query']=_[_0x4985('0x62')](_0x1b0274['query']);_0x2850a5[_0x4985('0x50')]=_['intersection'](_0x2850a5[_0x4985('0x44')],_0x2850a5[_0x4985('0x4f')]);_0xbedf1a[_0x4985('0x51')]=_[_0x4985('0x52')](_0x2850a5[_0x4985('0x44')],qs['fields'](_0x1b0274[_0x4985('0x4f')][_0x4985('0x53')]));_0xbedf1a[_0x4985('0x51')]=_0xbedf1a[_0x4985('0x51')][_0x4985('0x54')]?_0xbedf1a[_0x4985('0x51')]:_0x2850a5[_0x4985('0x44')];if(_0x1b0274[_0x4985('0x4f')][_0x4985('0x63')]){_0xbedf1a[_0x4985('0x64')]=[{'all':!![]}];}_0xbedf1a=_[_0x4985('0x5c')]({},_0xbedf1a,_0x1b0274['options']);return db[_0x4985('0x4c')][_0x4985('0x65')](_0xbedf1a)[_0x4985('0x30')](handleEntityNotFound(_0x1ac617,null))[_0x4985('0x30')](respondWithResult(_0x1ac617,null))[_0x4985('0x25')](handleError(_0x1ac617,null));};exports['create']=function(_0x2ced52,_0x1ddb0d){var _0x278631=null;_0x2ced52[_0x4985('0x66')][_0x4985('0x67')]['split'](',')['forEach'](_0x47ee39=>{if(_0x47ee39[_0x4985('0x68')]()!==''&&!wildcardUtils[_0x4985('0x69')](_0x47ee39[_0x4985('0x68')]())){_0x278631=new APIBadRequestError('\x22'+_0x47ee39['trim']()+'\x22\x20is\x20not\x20a\x20valid\x20wildcard\x20expression');}});if(_0x278631){return handleError(_0x1ddb0d,null)(_0x278631);}return db[_0x4985('0x4c')][_0x4985('0x6a')](_0x2ced52['body'],{})[_0x4985('0x30')](function(_0x59b929){var _0x455ffe=_0x2ced52[_0x4985('0x6b')]['get']({'plain':!![]});if(!_0x455ffe)throw new Error(_0x4985('0x6c'));if(_0x455ffe[_0x4985('0x6d')]===_0x4985('0x6b')){var _0x3def16=_0x59b929[_0x4985('0x6e')]({'plain':!![]});var _0x3ca878='ChatWebsites';return db[_0x4985('0x6f')][_0x4985('0x65')]({'where':{'name':_0x3ca878,'userProfileId':_0x455ffe[_0x4985('0x70')]},'raw':!![]})[_0x4985('0x30')](function(_0x2d7343){if(_0x2d7343&&_0x2d7343[_0x4985('0x71')]===0x0){return db[_0x4985('0x32')]['create']({'name':_0x3def16[_0x4985('0x34')],'resourceId':_0x3def16['id'],'type':_0x2d7343[_0x4985('0x34')],'sectionId':_0x2d7343['id']},{})[_0x4985('0x30')](function(){return _0x59b929;});}else{return _0x59b929;}})[_0x4985('0x25')](function(_0x4c0f77){logger['error'](_0x4985('0x72'),_0x4c0f77);throw _0x4c0f77;});}return _0x59b929;})['then'](respondWithResult(_0x1ddb0d,0xc9))[_0x4985('0x25')](handleError(_0x1ddb0d,null));};exports['update']=function(_0x587925,_0x25b325){var _0x5dd670=null;_0x587925[_0x4985('0x66')][_0x4985('0x67')][_0x4985('0x3a')](',')[_0x4985('0x73')](_0x23e79d=>{if(_0x23e79d['trim']()!==''&&!wildcardUtils[_0x4985('0x69')](_0x23e79d[_0x4985('0x68')]())){_0x5dd670=new APIBadRequestError('\x22'+_0x23e79d[_0x4985('0x68')]()+_0x4985('0x74'));}});if(_0x5dd670){return handleError(_0x25b325,null)(_0x5dd670);}if(_0x587925[_0x4985('0x66')]['id']){delete _0x587925[_0x4985('0x66')]['id'];}return db[_0x4985('0x4c')][_0x4985('0x65')]({'where':{'id':_0x587925[_0x4985('0x61')]['id']},'include':[{'model':db[_0x4985('0x49')],'as':_0x4985('0x4a')}]})[_0x4985('0x30')](handleEntityNotFound(_0x25b325,null))[_0x4985('0x30')](saveUpdates(_0x587925['body'],null))[_0x4985('0x30')](respondWithResult(_0x25b325,null))[_0x4985('0x25')](handleError(_0x25b325,null));};exports[_0x4985('0x31')]=function(_0x54b59c,_0x2d5ac4){return db[_0x4985('0x4c')][_0x4985('0x65')]({'where':{'id':_0x54b59c[_0x4985('0x61')]['id']}})['then'](handleEntityNotFound(_0x2d5ac4,null))['then'](removeEntity(_0x2d5ac4,null))[_0x4985('0x25')](handleError(_0x2d5ac4,null));};exports[_0x4985('0x75')]=function(_0x7d786,_0x3c47cd){return db[_0x4985('0x4c')][_0x4985('0x75')]()[_0x4985('0x30')](respondWithResult(_0x3c47cd,null))[_0x4985('0x25')](handleError(_0x3c47cd,null));};exports[_0x4985('0x76')]=function(_0x41f6be,_0x58f4b1){if(_0x41f6be[_0x4985('0x66')]['id']){delete _0x41f6be['body']['id'];}return db[_0x4985('0x4c')]['find']({'where':{'id':_0x41f6be[_0x4985('0x61')]['id']}})[_0x4985('0x30')](handleEntityNotFound(_0x58f4b1,null))[_0x4985('0x30')](function(_0x573ed2){if(_0x573ed2){_0x41f6be[_0x4985('0x66')][_0x4985('0x77')]=_0x573ed2['id'];return db[_0x4985('0x78')][_0x4985('0x6a')](_0x41f6be[_0x4985('0x66')]);}})['then'](respondWithResult(_0x58f4b1,null))[_0x4985('0x25')](handleError(_0x58f4b1,null));};exports[_0x4985('0x79')]=function(_0x52f0e0,_0x254fd6){var _0x41a0e4={'raw':![],'where':{}};var _0x373936={};var _0x409b99={'count':0x0,'rows':[]};return db[_0x4985('0x4c')][_0x4985('0x7a')]({'where':{'id':_0x52f0e0[_0x4985('0x61')]['id']}})[_0x4985('0x30')](handleEntityNotFound(_0x254fd6,null))[_0x4985('0x30')](function(_0x1dbc70){if(_0x1dbc70){_0x373936[_0x4985('0x44')]=_[_0x4985('0x62')](db['Disposition']['rawAttributes']);_0x373936[_0x4985('0x4f')]=_['keys'](_0x52f0e0[_0x4985('0x4f')]);_0x373936[_0x4985('0x50')]=_[_0x4985('0x52')](_0x373936[_0x4985('0x44')],_0x373936[_0x4985('0x4f')]);_0x41a0e4[_0x4985('0x51')]=_['intersection'](_0x373936['model'],qs[_0x4985('0x53')](_0x52f0e0[_0x4985('0x4f')][_0x4985('0x53')]));_0x41a0e4[_0x4985('0x51')]=_0x41a0e4[_0x4985('0x51')][_0x4985('0x54')]?_0x41a0e4[_0x4985('0x51')]:_0x373936['model'];if(!_0x52f0e0[_0x4985('0x4f')][_0x4985('0x55')](_0x4985('0x56'))){_0x41a0e4[_0x4985('0x2b')]=qs[_0x4985('0x2b')](_0x52f0e0[_0x4985('0x4f')][_0x4985('0x2b')]);_0x41a0e4[_0x4985('0x29')]=qs['offset'](_0x52f0e0[_0x4985('0x4f')]['offset']);}_0x41a0e4['order']=qs[_0x4985('0x58')](_0x52f0e0[_0x4985('0x4f')][_0x4985('0x58')]);_0x41a0e4[_0x4985('0x59')]=qs[_0x4985('0x50')](_[_0x4985('0x5a')](_0x52f0e0[_0x4985('0x4f')],_0x373936[_0x4985('0x50')]));_0x41a0e4[_0x4985('0x59')]['ChatWebsiteId']=_0x1dbc70['id'];if(_0x52f0e0[_0x4985('0x4f')]['filter']){_0x41a0e4[_0x4985('0x59')]=_[_0x4985('0x5c')](_0x41a0e4[_0x4985('0x59')],{'$or':_['map'](_0x41a0e4[_0x4985('0x51')],function(_0x128eac){var _0x17fcb3={};_0x17fcb3[_0x128eac]={'$like':'%'+_0x52f0e0[_0x4985('0x4f')][_0x4985('0x5b')]+'%'};return _0x17fcb3;})});}_0x41a0e4=_[_0x4985('0x5c')]({},_0x41a0e4,_0x52f0e0[_0x4985('0x5e')]);return db[_0x4985('0x78')]['count']({'where':_0x41a0e4[_0x4985('0x59')]})[_0x4985('0x30')](function(_0x4e2e12){_0x409b99[_0x4985('0x2c')]=_0x4e2e12;if(_0x52f0e0[_0x4985('0x4f')][_0x4985('0x63')]){_0x41a0e4[_0x4985('0x64')]=[{'all':!![]}];}return db[_0x4985('0x78')][_0x4985('0x5f')](_0x41a0e4);})[_0x4985('0x30')](function(_0x3b3cb1){_0x409b99[_0x4985('0x7b')]=_0x3b3cb1;return _0x409b99;});}})[_0x4985('0x30')](respondWithFilteredResult(_0x254fd6,_0x41a0e4))['catch'](handleError(_0x254fd6,null));};exports['removeDispositions']=function(_0x189473,_0x273bba){return db[_0x4985('0x4c')][_0x4985('0x65')]({'where':{'id':_0x189473['params']['id']}})['then'](handleEntityNotFound(_0x273bba,null))[_0x4985('0x30')](function(_0x55ecf5){if(_0x55ecf5){return _0x55ecf5['removeDispositions'](_0x189473['query']['ids']);}})[_0x4985('0x30')](respondWithStatusCode(_0x273bba,null))['catch'](handleError(_0x273bba,null));};exports[_0x4985('0x7c')]=function(_0x560a1d,_0x4b4325){if(_0x560a1d['body']['id']){delete _0x560a1d[_0x4985('0x66')]['id'];}return db[_0x4985('0x4c')]['find']({'where':{'id':_0x560a1d[_0x4985('0x61')]['id']}})[_0x4985('0x30')](handleEntityNotFound(_0x4b4325,null))[_0x4985('0x30')](function(_0x24542e){if(_0x24542e){_0x560a1d[_0x4985('0x66')]['ChatWebsiteId']=_0x24542e['id'];return db[_0x4985('0x7d')][_0x4985('0x6a')](_0x560a1d[_0x4985('0x66')]);}})[_0x4985('0x30')](respondWithResult(_0x4b4325,null))['catch'](handleError(_0x4b4325,null));};exports[_0x4985('0x7e')]=function(_0x2eeed8,_0x109565){var _0x3ace69={'raw':![],'where':{}};var _0x5e3329={};var _0x1fb74c={'count':0x0,'rows':[]};return db[_0x4985('0x4c')][_0x4985('0x7a')]({'where':{'id':_0x2eeed8[_0x4985('0x61')]['id']}})[_0x4985('0x30')](handleEntityNotFound(_0x109565,null))[_0x4985('0x30')](function(_0x1e8942){if(_0x1e8942){_0x5e3329[_0x4985('0x44')]=_[_0x4985('0x62')](db[_0x4985('0x7d')][_0x4985('0x4d')]);_0x5e3329[_0x4985('0x4f')]=_[_0x4985('0x62')](_0x2eeed8[_0x4985('0x4f')]);_0x5e3329[_0x4985('0x50')]=_['intersection'](_0x5e3329['model'],_0x5e3329[_0x4985('0x4f')]);_0x3ace69[_0x4985('0x51')]=_[_0x4985('0x52')](_0x5e3329[_0x4985('0x44')],qs['fields'](_0x2eeed8[_0x4985('0x4f')][_0x4985('0x53')]));_0x3ace69[_0x4985('0x51')]=_0x3ace69['attributes'][_0x4985('0x54')]?_0x3ace69[_0x4985('0x51')]:_0x5e3329['model'];if(!_0x2eeed8[_0x4985('0x4f')][_0x4985('0x55')](_0x4985('0x56'))){_0x3ace69['limit']=qs['limit'](_0x2eeed8[_0x4985('0x4f')][_0x4985('0x2b')]);_0x3ace69[_0x4985('0x29')]=qs[_0x4985('0x29')](_0x2eeed8['query'][_0x4985('0x29')]);}_0x3ace69['order']=qs[_0x4985('0x58')](_0x2eeed8[_0x4985('0x4f')][_0x4985('0x58')]);_0x3ace69[_0x4985('0x59')]=qs[_0x4985('0x50')](_['pick'](_0x2eeed8[_0x4985('0x4f')],_0x5e3329[_0x4985('0x50')]));_0x3ace69[_0x4985('0x59')][_0x4985('0x77')]=_0x1e8942['id'];if(_0x2eeed8[_0x4985('0x4f')][_0x4985('0x5b')]){_0x3ace69[_0x4985('0x59')]=_[_0x4985('0x5c')](_0x3ace69['where'],{'$or':_['map'](_0x3ace69[_0x4985('0x51')],function(_0x13cdb1){var _0x33c2be={};_0x33c2be[_0x13cdb1]={'$like':'%'+_0x2eeed8[_0x4985('0x4f')]['filter']+'%'};return _0x33c2be;})});}_0x3ace69=_[_0x4985('0x5c')]({},_0x3ace69,_0x2eeed8[_0x4985('0x5e')]);return db[_0x4985('0x7d')][_0x4985('0x2c')]({'where':_0x3ace69[_0x4985('0x59')]})['then'](function(_0x28b010){_0x1fb74c['count']=_0x28b010;if(_0x2eeed8[_0x4985('0x4f')][_0x4985('0x63')]){_0x3ace69[_0x4985('0x64')]=[{'all':!![]}];}return db[_0x4985('0x7d')]['findAll'](_0x3ace69);})[_0x4985('0x30')](function(_0x5546c4){_0x1fb74c[_0x4985('0x7b')]=_0x5546c4;return _0x1fb74c;});}})[_0x4985('0x30')](respondWithFilteredResult(_0x109565,_0x3ace69))[_0x4985('0x25')](handleError(_0x109565,null));};exports[_0x4985('0x7f')]=function(_0x58ff42,_0x5cd1f3){return db['ChatWebsite'][_0x4985('0x65')]({'where':{'id':_0x58ff42[_0x4985('0x61')]['id']}})['then'](handleEntityNotFound(_0x5cd1f3,null))['then'](function(_0x1adeeb){if(_0x1adeeb){return _0x1adeeb['removeAnswers'](_0x58ff42[_0x4985('0x4f')]['ids']);}})[_0x4985('0x30')](respondWithStatusCode(_0x5cd1f3,null))[_0x4985('0x25')](handleError(_0x5cd1f3,null));};exports[_0x4985('0x80')]=function(_0x54a790,_0x486647){_0x54a790[_0x4985('0x66')]['sitepic']=_0x54a790[_0x4985('0x81')]['filename'];return db['ChatWebsite'][_0x4985('0x65')]({'where':{'id':_0x54a790['params']['id']}})[_0x4985('0x30')](handleEntityNotFound(_0x486647,null))[_0x4985('0x30')](saveUpdates(_0x54a790[_0x4985('0x66')],null))[_0x4985('0x30')](respondWithResult(_0x486647,null))['catch'](handleError(_0x486647,null));};exports['addAvatar']=function(_0x4f2a8e,_0x24e312){_0x4f2a8e[_0x4985('0x66')]['agentAvatar']=_0x4f2a8e[_0x4985('0x81')][_0x4985('0x82')];return db[_0x4985('0x4c')]['find']({'where':{'id':_0x4f2a8e[_0x4985('0x61')]['id']}})['then'](handleEntityNotFound(_0x24e312,null))['then'](saveUpdates(_0x4f2a8e[_0x4985('0x66')],null))[_0x4985('0x30')](respondWithResult(_0x24e312,null))['catch'](handleError(_0x24e312,null));};exports[_0x4985('0x83')]=function(_0x4ba635,_0x11423a){_0x4ba635['body'][_0x4985('0x84')]=_0x4ba635['file'][_0x4985('0x82')];return db['ChatWebsite'][_0x4985('0x65')]({'where':{'id':_0x4ba635[_0x4985('0x61')]['id']}})['then'](handleEntityNotFound(_0x11423a,null))[_0x4985('0x30')](saveUpdates(_0x4ba635[_0x4985('0x66')],null))[_0x4985('0x30')](respondWithResult(_0x11423a,null))[_0x4985('0x25')](handleError(_0x11423a,null));};exports[_0x4985('0x85')]=function(_0x45ad82,_0x38ef2f){_0x45ad82[_0x4985('0x66')][_0x4985('0x86')]=_0x45ad82[_0x4985('0x81')][_0x4985('0x82')];return db[_0x4985('0x4c')]['find']({'where':{'id':_0x45ad82[_0x4985('0x61')]['id']}})[_0x4985('0x30')](handleEntityNotFound(_0x38ef2f,null))[_0x4985('0x30')](saveUpdates(_0x45ad82['body'],null))['then'](respondWithResult(_0x38ef2f,null))[_0x4985('0x25')](handleError(_0x38ef2f,null));};exports[_0x4985('0x87')]=function(_0x4177b9,_0x28d990){var _0x555f6a=path['join'](config[_0x4985('0x88')],_0x4985('0x89'));var _0x5d31d2={'where':{'id':_0x4177b9[_0x4985('0x61')]['id']},'attributes':['id',_0x4985('0x8a')],'raw':!![]};var _0x368ea6=![];return require('../../config/license/util')[_0x4985('0x8b')]()[_0x4985('0x30')](function(_0x6a4d88){if(_0x6a4d88){_0x368ea6=_0x6a4d88[_0x4985('0x8c')];}})['then'](function(){return db['ChatWebsite']['find'](_0x5d31d2);})[_0x4985('0x30')](handleEntityNotFound(_0x28d990,null))[_0x4985('0x30')](function(_0x2b5e9c){if(_0x2b5e9c){if(!_[_0x4985('0x8d')](_0x2b5e9c[_0x4985('0x8a')])){if(fs[_0x4985('0x8e')](path[_0x4985('0x8f')](config[_0x4985('0x88')],_0x4985('0x90'),_0x2b5e9c['sitepic']))&&_0x368ea6){_0x555f6a=path[_0x4985('0x8f')](config[_0x4985('0x88')],_0x4985('0x90'),_0x2b5e9c[_0x4985('0x8a')]);}}return _0x28d990[_0x4985('0x91')](_0x555f6a);}})[_0x4985('0x25')](handleError(_0x28d990,null));};exports[_0x4985('0x92')]=function(_0x11da36,_0x39d87a){var _0x46bcbe=path[_0x4985('0x8f')](config[_0x4985('0x88')],'server/files/images/avatars/default_avatar.png');var _0x15c5fc={'where':{'id':_0x11da36[_0x4985('0x61')]['id']},'attributes':['id',_0x4985('0x93')],'raw':!![]};return db[_0x4985('0x4c')][_0x4985('0x65')](_0x15c5fc)[_0x4985('0x30')](handleEntityNotFound(_0x39d87a,null))[_0x4985('0x30')](function(_0x1dbc08){if(_0x1dbc08){if(!_[_0x4985('0x8d')](_0x1dbc08[_0x4985('0x93')])){if(fs[_0x4985('0x8e')](path[_0x4985('0x8f')](config[_0x4985('0x88')],_0x4985('0x94'),_0x1dbc08['agentAvatar']))){_0x46bcbe=path[_0x4985('0x8f')](config[_0x4985('0x88')],_0x4985('0x94'),_0x1dbc08[_0x4985('0x93')]);}}return _0x39d87a[_0x4985('0x91')](_0x46bcbe);}})[_0x4985('0x25')](handleError(_0x39d87a,null));};exports[_0x4985('0x95')]=function(_0x19f741,_0x312fc7){var _0x8c53b7=path[_0x4985('0x8f')](config[_0x4985('0x88')],_0x4985('0x96'));var _0x47ca82={'where':{'id':_0x19f741[_0x4985('0x61')]['id']},'attributes':['id',_0x4985('0x84'),_0x4985('0x97')],'raw':!![]};return db[_0x4985('0x4c')][_0x4985('0x65')](_0x47ca82)[_0x4985('0x30')](handleEntityNotFound(_0x312fc7,null))[_0x4985('0x30')](function(_0x17798e){if(_0x17798e){if(!_[_0x4985('0x8d')](_0x17798e['customerAvatar'])){if(fs[_0x4985('0x8e')](path[_0x4985('0x8f')](config['root'],_0x4985('0x94'),_0x17798e[_0x4985('0x84')]))&&_0x17798e[_0x4985('0x97')]){_0x8c53b7=path[_0x4985('0x8f')](config[_0x4985('0x88')],_0x4985('0x94'),_0x17798e[_0x4985('0x84')]);}}return _0x312fc7['download'](_0x8c53b7);}})['catch'](handleError(_0x312fc7,null));};exports[_0x4985('0x98')]=function(_0x5ebde4,_0x25f19d){var _0x1eee59=path['join'](config[_0x4985('0x88')],_0x4985('0x99'));var _0x724ee7={'where':{'id':_0x5ebde4['params']['id']},'attributes':['id',_0x4985('0x86')],'raw':!![]};return db['ChatWebsite'][_0x4985('0x65')](_0x724ee7)[_0x4985('0x30')](handleEntityNotFound(_0x25f19d,null))[_0x4985('0x30')](function(_0x6aef8){if(_0x6aef8){if(!_[_0x4985('0x8d')](_0x6aef8[_0x4985('0x86')])){if(fs[_0x4985('0x8e')](path[_0x4985('0x8f')](config[_0x4985('0x88')],'server/files/images/avatars/',_0x6aef8[_0x4985('0x86')]))){_0x1eee59=path['join'](config[_0x4985('0x88')],_0x4985('0x94'),_0x6aef8['systemAvatar']);}}return _0x25f19d[_0x4985('0x91')](_0x1eee59);}})[_0x4985('0x25')](handleError(_0x25f19d,null));};function checkWebsiteInterval(_0xe530f5){var _0x26c884=_0xe530f5[_0x4985('0x9a')];if(!_0x26c884){return Promise[_0x4985('0x9b')](_0xe530f5);}var _0x590db7=_0xe530f5[_0x4985('0x9c')]||undefined;return _0x26c884[_0x4985('0x9d')](_0x590db7)['then'](function(_0x4babb7){if(!_0x4babb7){throw new APIOutOfIntervalError();}return _0xe530f5;});}exports['notify']=function(_0x2cb89c,_0x4cbdac){var _0x3cdfc7={'body':_0x2cb89c[_0x4985('0x66')],'channel':_0x4985('0x9e')};var _0x54d7b5=[];var _0x253ce6=[];var _0x161b2e={};var _0x22b55a=![];if(_0x2cb89c[_0x4985('0x66')]['id']){delete _0x2cb89c['body']['id'];}if(_[_0x4985('0x8d')](_0x2cb89c[_0x4985('0x66')][_0x4985('0x9f')])){throw new APIBadRequestError(_0x4985('0xa0'));}if(_[_0x4985('0x8d')](_0x2cb89c[_0x4985('0x66')][_0x4985('0xa1')])){throw new APIBadRequestError('MapKey\x20is\x20mandatory');}if(_[_0x4985('0xa2')](_0x2cb89c['body'][_0x4985('0x66')])){throw new APIBadRequestError('Body\x20is\x20mandatory');}var _0x2a4398=_0x2cb89c['body'][_0x4985('0x37')]&&_0x2cb89c[_0x4985('0x66')][_0x4985('0xa3')];return db[_0x4985('0xa4')][_0x4985('0x75')]()[_0x4985('0x30')](function(_0x1a6629){if(!_0x1a6629){throw new Error(_0x4985('0xa5'));}_0x54d7b5=Object[_0x4985('0x62')](_0x1a6629)[_0x4985('0x5b')](function(_0x298919){return![_0x4985('0xa6'),_0x4985('0xa7')]['includes'](_0x298919);});_0x253ce6=Object['keys'](_0x1a6629)[_0x4985('0x5b')](function(_0x218af2){return![_0x4985('0xa6'),'updatedAt',_0x4985('0xa8'),_0x4985('0xa9')][_0x4985('0xaa')](_0x218af2);});if(!_[_0x4985('0xaa')](_0x253ce6,_0x2cb89c['body']['mapKey'])){throw new APIBadRequestError('Invalid\x20MapKey\x20parameter.\x20Allowed\x20values:\x20'+_0x253ce6[_0x4985('0x8f')](',\x20'));}_0x161b2e[_0x2cb89c[_0x4985('0x66')][_0x4985('0xa1')]]=_0x2cb89c['body'][_0x4985('0x9f')];})[_0x4985('0x30')](function(){return db[_0x4985('0x4c')][_0x4985('0x65')]({'where':{'id':_0x2cb89c['params']['id']},'include':[{'model':db['CmList'],'as':'List','include':[{'model':db[_0x4985('0xa4')],'as':_0x4985('0xab'),'where':_0x161b2e,'limit':0x1,'order':[[_0x4985('0xa7'),'DESC']]}]},{'model':db[_0x4985('0xac')],'as':'Applications'},{'model':db[_0x4985('0x9a')],'as':_0x4985('0x9a'),'include':[{'model':db[_0x4985('0x9a')],'as':_0x4985('0xad'),'attributes':['id','interval'],'raw':!![]}]}]});})[_0x4985('0x30')](function(_0x48cb38){if(!_0x48cb38){throw new APINotFoundError(util['format'](_0x4985('0xae'),_0x2cb89c[_0x4985('0x61')]['id']));}if(_0x2a4398){return checkWebsiteInterval(_0x48cb38);}return _0x48cb38;})[_0x4985('0x30')](function(_0x528123){_0x3cdfc7[_0x4985('0xaf')]=_0x528123;_0x3cdfc7[_0x4985('0xb0')]=_[_0x4985('0xb1')](_0x528123[_0x4985('0xb2')],[_0x4985('0xb3')],[_0x4985('0xb4')]);if(_0x3cdfc7['account'][_0x4985('0xb2')]){delete _0x3cdfc7['account'][_0x4985('0xb2')];}_0x3cdfc7['list']=_0x528123[_0x4985('0xb5')]||{'id':_0x528123['ListId']};if(_0x3cdfc7['list']&&_0x3cdfc7[_0x4985('0xb6')][_0x4985('0xab')][_0x4985('0x54')]){return _0x3cdfc7[_0x4985('0xb6')]['Contacts'][0x0];}var _0x32906b=_[_0x4985('0x14')](_0x2cb89c[_0x4985('0x66')],{'firstName':_0x2cb89c[_0x4985('0x66')][_0x4985('0x9f')],'ListId':_0x528123['ListId']});_0x32906b[_0x2cb89c[_0x4985('0x66')]['mapKey']]=_0x2cb89c[_0x4985('0x66')][_0x4985('0x9f')];return db['CmContact'][_0x4985('0x6a')](_0x32906b,{'fields':_0x54d7b5,'raw':!![]});})['then'](function(_0x5ee8b5){_0x3cdfc7[_0x4985('0xb7')]=_0x5ee8b5;var _0x291606=createInteractionObject(_0x2cb89c[_0x4985('0x61')]['id'],_0x2cb89c[_0x4985('0x66')],_0x2cb89c[_0x4985('0xb8')],_0x5ee8b5);var _0x12a10e={'ChatWebsiteId':_0x2cb89c[_0x4985('0x61')]['id']};if(_0x2cb89c[_0x4985('0x66')]['threadId']){_0x12a10e['threadId']=_0x2cb89c[_0x4985('0x66')][_0x4985('0xb9')];_0x12a10e[_0x4985('0xba')]=![];return db[_0x4985('0xbb')][_0x4985('0x65')]({'where':_0x12a10e})[_0x4985('0x30')](function(_0x487faf){var _0x13e6c8=_0x2cb89c[_0x4985('0x66')][_0x4985('0x37')]&&_0x2cb89c['body'][_0x4985('0xa3')];if(_0x487faf){_0x22b55a=!![];return _0x487faf;}else if(!_0x13e6c8&&_0x487faf&&_0x487faf['closed']){throw new APIConflictError(_0x4985('0xbc'));}_0x291606[_0x4985('0xb9')]=_0x2cb89c[_0x4985('0x66')][_0x4985('0xb9')];_0x291606[_0x4985('0xbd')]=_0x2cb89c[_0x4985('0x66')][_0x4985('0xbd')];return db[_0x4985('0xbb')][_0x4985('0x6a')](_0x291606);});}_0x12a10e[_0x4985('0xbe')]=_0x5ee8b5['id'];if(_0x2cb89c[_0x4985('0x66')][_0x4985('0xbf')]&&_0x2cb89c[_0x4985('0x66')][_0x4985('0xbf')]['id']){_0x12a10e['id']=_0x2cb89c[_0x4985('0x66')][_0x4985('0xbf')]['id'];return db[_0x4985('0xbb')]['find']({'where':_0x12a10e})[_0x4985('0x30')](function(_0x23c009){var _0x4d8931=_0x2cb89c[_0x4985('0x66')][_0x4985('0x37')]&&_0x2cb89c[_0x4985('0x66')][_0x4985('0xa3')];if(!_0x4d8931&&_0x23c009&&_0x23c009[_0x4985('0xba')]){throw new APIConflictError(_0x4985('0xbc'));}else if(_0x23c009){_0x22b55a=!![];return _0x23c009;}else{return db[_0x4985('0xbb')][_0x4985('0x6a')](_0x291606);}});}return db['ChatInteraction'][_0x4985('0x6a')](_0x291606);})[_0x4985('0x30')](function(_0x1f3c32){if(!_0x22b55a){return _0x1f3c32;}var _0x2b39dc={'from':(_0x3cdfc7[_0x4985('0xb7')][_0x4985('0x3b')]||'')+'\x20'+(_0x3cdfc7['contact']['lastName']||'')};if(_0x2cb89c[_0x4985('0x66')][_0x4985('0xb9')]&&_0x2cb89c[_0x4985('0x66')][_0x4985('0xc0')]&&_0x2cb89c[_0x4985('0x66')][_0x4985('0xb9')]!=_0x2cb89c['body'][_0x4985('0xc0')]){_0x2b39dc['threadId']=_0x2cb89c[_0x4985('0x66')]['messageId'];}return _0x1f3c32['update'](_0x2b39dc);})[_0x4985('0x30')](function(_0x1a7c63){_0x3cdfc7[_0x4985('0xbf')]=_0x1a7c63['get']({'plain':!![]});_0x3cdfc7[_0x4985('0xbf')][_0x4985('0xc1')]=!_0x22b55a;if(_0x3cdfc7[_0x4985('0xbf')][_0x4985('0xc1')]){if(_0x3cdfc7[_0x4985('0xaf')][_0x4985('0xc2')]){_0x3cdfc7[_0x4985('0xb0')][_0x4985('0xc3')]({'id':0x0,'priority':_0x3cdfc7['applications'][_0x4985('0x54')]+0x1,'app':_0x4985('0xc4'),'appdata':_0x4985('0xc5'),'interval':_0x4985('0xc6')});}}return db[_0x4985('0xc7')][_0x4985('0x6a')]({'body':_0x2cb89c[_0x4985('0x66')][_0x4985('0x66')],'ChatWebsiteId':_0x2cb89c[_0x4985('0x61')]['id'],'ChatInteractionId':_0x1a7c63['id'],'direction':'in','ContactId':_0x3cdfc7['contact']['id'],'AttachmentId':_0x2cb89c[_0x4985('0x66')][_0x4985('0xc8')]});})[_0x4985('0x30')](function(_0x337c0b){_0x3cdfc7['message']=_0x337c0b;if(!_0x3cdfc7[_0x4985('0xbf')][_0x4985('0xc9')]){return;}return db[_0x4985('0xca')][_0x4985('0x65')]({'attributes':['id',_0x4985('0x34')],'where':{'id':_0x3cdfc7[_0x4985('0xbf')][_0x4985('0xc9')]}});})[_0x4985('0x30')](function(_0x4f0645){if(_0x4f0645){_0x3cdfc7[_0x4985('0xb0')]['unshift']({'id':0x0,'priority':0x0,'app':'agent','appdata':_0x4f0645[_0x4985('0x34')]+','+(_0x3cdfc7[_0x4985('0xaf')]['waitForTheAssignedAgent']||0xa),'interval':_0x4985('0xc6')});_0x3cdfc7[_0x4985('0xcb')]=!![];}if(!_0x3cdfc7['interaction'][_0x4985('0xcc')]){return;}return db['ChatQueue']['find']({'attributes':['id','name'],'where':{'id':_0x3cdfc7[_0x4985('0xbf')][_0x4985('0xcc')]}});})[_0x4985('0x30')](function(_0x519795){if(_0x519795){_0x3cdfc7['applications'][_0x4985('0xcd')]({'id':0x0,'priority':0x1,'app':_0x4985('0xce'),'appdata':_0x519795[_0x4985('0x34')]+','+(_0x3cdfc7[_0x4985('0xaf')][_0x4985('0xcf')]||0x12c),'interval':_0x4985('0xc6')});}return respondWithRpcPromise('Start',_0x4985('0xd0'),_0x3cdfc7);})[_0x4985('0x30')](function(_0x509187){respondWithRpcPromise(_0x4985('0xd1'),_0x4985('0xd1'),{'event':'notify','message':_0x509187},client9002);return _0x509187;})['then'](respondWithResult(_0x4cbdac,null))['catch'](APIHandleError(_0x4cbdac));};exports[_0x4985('0xd2')]=function(_0x2788f7,_0x11e596){var _0x9e0786,_0x971844,_0x581f46;var _0x487da6=[];var _0x1011dc={};var _0x5d4753=_0x2788f7[_0x4985('0xd3')]||[];var _0x1229ab=[];var _0x384f13;return db[_0x4985('0xa4')][_0x4985('0x75')]()[_0x4985('0x30')](function(_0x6cd373){if(!_0x6cd373){throw new db['Sequelize'][(_0x4985('0xd4'))](_0x4985('0xd5'));}_0x487da6=_[_0x4985('0xd6')](_[_0x4985('0x62')](_0x6cd373),[_0x4985('0xa6'),_0x4985('0xa7'),_0x4985('0xa8'),_0x4985('0xa9')]);if(_0x2788f7[_0x4985('0x66')]['id']){delete _0x2788f7['body']['id'];}if(_['isNil'](_0x2788f7[_0x4985('0x66')][_0x4985('0x9f')])){throw _0x11e596[_0x4985('0x27')](0x1f4)['send'](new db[(_0x4985('0xd7'))]['ValidationError'](_0x4985('0xd8')));}if(_['isNil'](_0x2788f7['body']['body'])||_0x2788f7[_0x4985('0x66')][_0x4985('0x66')]===''){throw _0x11e596[_0x4985('0x27')](0x1f4)['send'](new db[(_0x4985('0xd7'))][(_0x4985('0xd4'))](_0x4985('0xd9')));}if(_[_0x4985('0x8d')](_0x2788f7[_0x4985('0x66')][_0x4985('0xda')])){throw _0x11e596[_0x4985('0x27')](0x1f4)[_0x4985('0xdb')](new db['Sequelize'][(_0x4985('0xd4'))](_0x4985('0xdc')+_0x487da6));}if(!_[_0x4985('0xaa')](_0x487da6,_0x2788f7[_0x4985('0x66')]['mapKeyOffline'])){throw _0x11e596[_0x4985('0x27')](0x1f4)[_0x4985('0xdb')](new db[(_0x4985('0xd7'))][(_0x4985('0xd4'))](_0x4985('0xdd')+_0x487da6));}_0x1011dc[_0x2788f7[_0x4985('0x66')][_0x4985('0xda')]]=_0x2788f7[_0x4985('0x66')][_0x4985('0x9f')];})[_0x4985('0x30')](function(){return db['ChatWebsite'][_0x4985('0x65')]({'where':{'id':_0x2788f7[_0x4985('0x61')]['id']},'include':[{'model':db[_0x4985('0xde')],'as':'List'},{'model':db[_0x4985('0xdf')],'as':_0x4985('0xdf')}]});})[_0x4985('0x30')](handleEntityNotFound(_0x11e596,null))[_0x4985('0x30')](function(_0x2859d9){if(_0x2859d9&&_0x2859d9[_0x4985('0xb5')]){_0x971844=_0x2859d9;var _0x48e705=_[_0x4985('0x14')](_0x2788f7[_0x4985('0x66')],{'firstName':_0x2788f7[_0x4985('0x66')][_0x4985('0x9f')],'phone':_0x2788f7['body'][_0x4985('0x9f')],'ListId':_0x2859d9[_0x4985('0xa9')]});_0x48e705[_0x2788f7[_0x4985('0x66')][_0x4985('0xda')]]=_0x2788f7[_0x4985('0x66')][_0x4985('0x9f')];return db[_0x4985('0xa4')][_0x4985('0xe0')]({'where':_0x1011dc,'defaults':_0x48e705});}})[_0x4985('0xe1')](function(_0x510c39){if(_0x510c39){_0x581f46=_0x510c39;var _0x3a2eb5=fs[_0x4985('0xe2')](path[_0x4985('0x8f')](config[_0x4985('0x88')],'server/files/templates/chatOfflineMessage.ejs'),'utf8');var _0x2f7067=ejs[_0x4985('0xe3')](_0x3a2eb5,{'body':_['toPairs'](_0x2788f7[_0x4985('0x66')][_0x4985('0x66')]),'bodyTitle':_0x971844[_0x4985('0xe4')]});return db[_0x4985('0xe5')][_0x4985('0x6a')]({'body':_0x2f7067,'plainBody':htmlToText[_0x4985('0xe6')](_0x2f7067),'ContactId':_0x510c39['id'],'ChatWebsiteId':_0x971844['id']});}})[_0x4985('0x30')](function(_0x10c612){_0x384f13=_0x10c612;if(_0x5d4753['length']){var _0x11256c=_0x5d4753[_0x4985('0x4b')](function(_0x516f7b){return{'name':_0x516f7b[_0x4985('0xe7')],'basename':_0x516f7b[_0x4985('0x82')],'type':_0x516f7b['mimetype'],'ChatOfflineMessageId':_0x10c612['id']};});_0x1229ab=_0x11256c[_0x4985('0x4b')](_0x1d63b0=>{var _0x115d95={'filename':_0x1d63b0[_0x4985('0x34')],'path':path[_0x4985('0x8f')](config[_0x4985('0x88')],_0x4985('0xe8'),_0x4985('0xd3'),'attachments',_0x4985('0xe9'),_0x1d63b0[_0x4985('0xea')])};return _0x115d95;});if(!_0x971844[_0x4985('0xeb')]){return db[_0x4985('0xec')][_0x4985('0xed')](function(_0x1fb270){return db['Attachment']['bulkCreate'](_0x11256c,{'transaction':_0x1fb270});});}}})[_0x4985('0x30')](function(){if(_0x384f13){_0x9e0786=_0x384f13;return db[_0x4985('0xdf')][_0x4985('0x7a')]({'where':{'service':!![]},'include':[{'model':db[_0x4985('0xee')],'as':_0x4985('0xef'),'raw':!![],'include':[{'model':db[_0x4985('0xf0')],'as':_0x4985('0xf0'),'raw':!![]}]}]});}})[_0x4985('0x30')](function(_0x25e828){if(_0x25e828&&_0x25e828['Smtp']&&_0x971844[_0x4985('0xf1')]&&_0x971844['forwardOfflineAddress']){var _0x43cb6b=_0x25e828[_0x4985('0xf2')]();return respondWithRpcPromise(_0x4985('0xf3'),_0x4985('0xf4'),{'account':_0x43cb6b,'message':{'from':util[_0x4985('0x40')](_0x4985('0xf5'),_0x25e828[_0x4985('0x34')],_0x25e828[_0x4985('0xf6')]||_0x25e828[_0x4985('0xef')][_0x4985('0x6b')]),'to':_0x971844['forwardOfflineAddress'],'subject':_0x971844['offlineMessageSubject'],'html':_0x9e0786['body'],'attachments':_0x1229ab}},client9003)[_0x4985('0x30')](function(){return _0x9e0786;})[_0x4985('0x25')](function(_0x1faa7a){logger[_0x4985('0x1f')](_0x1faa7a);});}})['then'](function(){if(_0x971844&&_0x971844['openNewInteraction']&&_0x971844[_0x4985('0xf7')]){var _0x4e3a67=[];if(_0x5d4753['length']){_0x4e3a67=_0x5d4753[_0x4985('0x4b')](function(_0x3def60){return{'name':_0x3def60['originalname'],'basename':_0x3def60[_0x4985('0x82')],'type':_0x3def60[_0x4985('0xf8')],'ChatOfflineMessageId':_0x384f13['id']};});}var _0xca0080;if(!_[_0x4985('0x8d')](_0x971844[_0x4985('0xf9')])){var _0x541a34=_[_0x4985('0x4b')](_0x2788f7[_0x4985('0x66')],function(_0x407024){return _0x407024;});var _0x3d06fa=_[_0x4985('0xfa')](_0x541a34)[0x0];var _0x5b804c=_['mapValues'](_0x3d06fa,function(_0x3f0759){return _0x3f0759;});_0xca0080=_0x5b804c[0x1][_0x971844[_0x4985('0xf9')]];}var _0x3b6029={'from':_0x581f46[_0x4985('0xf6')],'firstName':_0x581f46[_0x4985('0x3b')],'lastName':_0x581f46['lastName'],'mapKey':'email','message':{'from':_0x581f46[_0x4985('0xf6')],'to':_0x971844[_0x4985('0xdf')][_0x4985('0xf6')],'cc':'','subject':_['isNil'](_0xca0080)?_0x971844[_0x4985('0xfb')]:_0xca0080,'messageId':'','sentAt':new Date(),'attach':_0x4e3a67[_0x4985('0x54')],'attachments':_0x4e3a67,'originChannel':_0x4985('0xfc'),'ChatWebsiteId':_0x971844['id'],'ChatOfflineMessageId':_0x9e0786['id'],'originTo':_0x971844['MailAccount'][_0x4985('0xf6')]},'body':_0x9e0786[_0x4985('0x66')]};var _0x506d60={'account':{'id':_0x971844[_0x4985('0xf7')]},'body':_0x3b6029,'log':_0x4985('0xfd')};return respondWithRpcPromise('NotifyMailAccount',_0x4985('0xfe'),_0x506d60,client9001)['then'](function(){return _0x9e0786;})['catch'](function(_0x5648b7){logger[_0x4985('0x1f')](_0x5648b7);});}return;})[_0x4985('0x30')](function(){if(_0x9e0786){return _0x9e0786;}})[_0x4985('0x30')](respondWithResult(_0x11e596,null))[_0x4985('0x25')](function(){for(var _0x2446dd of _0x5d4753){var _0x8a2507=path[_0x4985('0x8f')](config['root'],_0x4985('0xe8'),'files','attachments',_0x4985('0xe9'),_0x2446dd['filename']);fs_extra[_0x4985('0xff')](_0x8a2507)['catch'](function(_0x4f680d){logger['error']('Could\x20not\x20remove\x20attachment\x20file',_0x8a2507,_0x4f680d);});}});};exports[_0x4985('0x100')]=function(_0x33f100,_0x53ea40){return db[_0x4985('0xbb')][_0x4985('0x65')]({'where':{'id':_0x33f100['params']['id']}})[_0x4985('0x30')](handleEntityNotFound(_0x53ea40,null))[_0x4985('0x30')](function(_0x4e6f0d){if(_0x4e6f0d){return _0x4e6f0d[_0x4985('0x100')](_0x33f100[_0x4985('0x66')][_0x4985('0x101')],_[_0x4985('0x102')](_0x33f100[_0x4985('0x66')],[_0x4985('0x101'),'id'])||{});}})[_0x4985('0x30')](respondWithResult(_0x53ea40,null))[_0x4985('0x25')](handleError(_0x53ea40,null));};exports[_0x4985('0x103')]=function(_0x1ff8ab,_0x4b8383){var _0x4ae83d={'raw':![],'where':{}};var _0x437a55={};var _0x537bdf={'count':0x0,'rows':[]};return db[_0x4985('0x4c')]['findOne']({'where':{'id':_0x1ff8ab['params']['id']}})['then'](handleEntityNotFound(_0x4b8383,null))[_0x4985('0x30')](function(_0x1926a2){if(_0x1926a2){_0x437a55[_0x4985('0x44')]=_[_0x4985('0x62')](db[_0x4985('0xbb')][_0x4985('0x4d')]);_0x437a55[_0x4985('0x4f')]=_[_0x4985('0x62')](_0x1ff8ab[_0x4985('0x4f')]);_0x437a55[_0x4985('0x50')]=_['intersection'](_0x437a55['model'],_0x437a55[_0x4985('0x4f')]);_0x4ae83d[_0x4985('0x51')]=_[_0x4985('0x52')](_0x437a55[_0x4985('0x44')],qs[_0x4985('0x53')](_0x1ff8ab[_0x4985('0x4f')]['fields']));_0x4ae83d[_0x4985('0x51')]=_0x4ae83d['attributes'][_0x4985('0x54')]?_0x4ae83d['attributes']:_0x437a55[_0x4985('0x44')];if(!_0x1ff8ab[_0x4985('0x4f')][_0x4985('0x55')](_0x4985('0x56'))){_0x4ae83d[_0x4985('0x2b')]=qs['limit'](_0x1ff8ab[_0x4985('0x4f')]['limit']);_0x4ae83d['offset']=qs[_0x4985('0x29')](_0x1ff8ab[_0x4985('0x4f')][_0x4985('0x29')]);}_0x4ae83d[_0x4985('0x57')]=qs[_0x4985('0x58')](_0x1ff8ab[_0x4985('0x4f')][_0x4985('0x58')]);_0x4ae83d[_0x4985('0x59')]=qs['filters'](_['pick'](_0x1ff8ab['query'],_0x437a55[_0x4985('0x50')]));_0x4ae83d['where'][_0x4985('0x77')]=_0x1926a2['id'];if(_0x1ff8ab['query']['filter']){_0x4ae83d['where']=_[_0x4985('0x5c')](_0x4ae83d[_0x4985('0x59')],{'$or':_[_0x4985('0x4b')](_0x4ae83d[_0x4985('0x51')],function(_0x268edc){var _0x9c4cf9={};_0x9c4cf9[_0x268edc]={'$like':'%'+_0x1ff8ab[_0x4985('0x4f')][_0x4985('0x5b')]+'%'};return _0x9c4cf9;})});}_0x4ae83d=_[_0x4985('0x5c')]({},_0x4ae83d,_0x1ff8ab[_0x4985('0x5e')]);return db[_0x4985('0xbb')][_0x4985('0x2c')]({'where':_0x4ae83d[_0x4985('0x59')]})[_0x4985('0x30')](function(_0x1136d0){_0x537bdf[_0x4985('0x2c')]=_0x1136d0;if(_0x1ff8ab[_0x4985('0x4f')][_0x4985('0x63')]){_0x4ae83d[_0x4985('0x64')]=[{'model':db['CmContact'],'as':_0x4985('0x104'),'required':![]},{'model':db[_0x4985('0xca')],'as':'Owner','attributes':[_0x4985('0x34'),_0x4985('0x105'),_0x4985('0x106')],'required':![]},{'model':db['Tag'],'as':_0x4985('0x107'),'attributes':['id',_0x4985('0x34'),_0x4985('0x108')],'where':_0x1ff8ab[_0x4985('0x4f')][_0x4985('0x109')]?{'id':_0x1ff8ab[_0x4985('0x4f')][_0x4985('0x109')]}:undefined,'required':_0x1ff8ab['query']['tag']?!![]:![]}];}return db[_0x4985('0xbb')][_0x4985('0x5f')](_0x4ae83d);})[_0x4985('0x30')](function(_0x599d01){_0x537bdf[_0x4985('0x7b')]=_0x599d01;return _0x537bdf;});}})[_0x4985('0x30')](respondWithFilteredResult(_0x4b8383,_0x4ae83d))[_0x4985('0x25')](handleError(_0x4b8383,null));};exports['getSnippet']=function(_0x37e87d,_0x51e7a8){var _0x4ef75f=0x0;var _0x39524a=0x0;var _0x17a510=![];var _0x5a349c;var _0x15a162;return db[_0x4985('0x4c')]['find']({'where':{'id':_0x37e87d[_0x4985('0x61')]['id']},'include':[{'model':db[_0x4985('0x9a')],'as':'Interval','include':[{'model':db[_0x4985('0x9a')],'as':_0x4985('0xad'),'attributes':['id','interval']}]}]})[_0x4985('0x30')](handleEntityNotFound(_0x51e7a8,null))[_0x4985('0x30')](function(_0xd75c02){if(_0xd75c02){_0x5a349c=_0xd75c02;return _0xd75c02[_0x4985('0x10a')]({'raw':!![]});}})[_0x4985('0x30')](function(_0x155f4f){if(_0x5a349c){if(_0x155f4f){_0x15a162=_0x155f4f;}}return require('../../config/license/util')[_0x4985('0x8b')]();})['then'](function(_0x37bda5){if(_0x37bda5){_0x39524a=_0x37bda5[_0x4985('0x10b')];_0x17a510=_0x37bda5[_0x4985('0x8c')];}})[_0x4985('0x30')](function(){return db[_0x4985('0xbb')][_0x4985('0x2c')]({'where':{'closed':![]}});})[_0x4985('0x30')](function(_0x5b69b7){_0x4ef75f=_0x5b69b7;if(_0x39524a&&_0x5b69b7>_0x39524a){return db[_0x4985('0x10c')][_0x4985('0x7a')]({'where':{'id':0x1}})[_0x4985('0x30')](function(_0x5c42f0){if(_0x5c42f0){_0x5c42f0[_0x4985('0x10d')](_0x4985('0x10e'));}});}})[_0x4985('0x30')](function(){var _0x11eab0=_0x5a349c[_0x4985('0x9a')];var _0x4ac4e2=_0x5a349c[_0x4985('0x9c')]||undefined;return _0x11eab0?_0x11eab0[_0x4985('0x9d')](_0x4ac4e2):!![];})[_0x4985('0x30')](function(_0x55ebfd){var _0x245f38=fs[_0x4985('0xe2')](path['join'](config[_0x4985('0x88')],_0x4985('0x10f')),_0x4985('0x110'));var _0x1c28b5='3.12.1';var _0x59da32=![];var _0x53d876,_0x316fa2;if(_0x37e87d['headers'][_0x4985('0xa3')]){_0x53d876=new URL(_0x37e87d[_0x4985('0xb8')]['referer'])[_0x4985('0x111')];}else if(_0x37e87d[_0x4985('0xb8')]['origin']){_0x53d876=new URL(_0x37e87d['headers'][_0x4985('0x111')])[_0x4985('0x111')];}else{_0x53d876=_0x4985('0x112');}_0x316fa2=typeof _0x5a349c['address'][_0x4985('0x3a')](',')[_0x4985('0x65')](function(_0x2a8881){return wildcardUtils['testWebsiteWithWildcard'](_0x2a8881,_0x53d876);})!=='undefined';var _0x55c24f={'chatVersion':_0x1c28b5,'chatWebsiteAddressOrigin':_0x316fa2?_0x53d876:_0x5a349c['address'],'remote':_0x5a349c[_0x4985('0x113')],'query':querystring[_0x4985('0x1e')](_[_0x4985('0x5c')](_0x5a349c[_0x4985('0x6e')]({'plain':!![]}),{'customerIp':_0x37e87d[_0x4985('0xb8')][_0x4985('0x39')]||_0x37e87d[_0x4985('0xb8')][_0x4985('0x114')]||_0x37e87d[_0x4985('0x115')][_0x4985('0x116')]||_0x37e87d['ip'],'referer':_0x37e87d[_0x4985('0xb8')][_0x4985('0xa3')],'openedInteractions':_0x4ef75f,'maxInteractions':_0x39524a,'virtual':_0x17a510[_0x4985('0x10b')],'online':_0x55ebfd,'custom':_0x17a510,'address':_0x316fa2?_0x53d876:null}))[_0x4985('0x117')](/'/g,'\x5c\x27')};_0x51e7a8['send'](ejs[_0x4985('0xe3')](Mustache[_0x4985('0xe3')](_0x245f38,_0x55c24f),{'proactiveActions':_0x15a162,'alignment':_0x5a349c[_0x4985('0x118')],'verticalAlignment':_0x5a349c[_0x4985('0x119')],'div_color':_0x5a349c[_0x4985('0x108')],'labelText':_0x5a349c[_0x4985('0x11a')],'text_color':_0x5a349c['textColor'],'text_button_color':_0x5a349c[_0x4985('0x11b')],'button_color':_0x5a349c[_0x4985('0x11c')],'background_color':_0x5a349c[_0x4985('0x11d')],'hideWhenOffline':_0x5a349c['hideWhenOffline'],'intervalId':_0x5a349c[_0x4985('0x11e')],'isDevelopment':_0x59da32,'chatVersion':_0x1c28b5}));})['catch'](handleError(_0x51e7a8,null));};exports['addApplications']=function(_0x3b9a23,_0xd2cd64){var _0x13793b=_0x3b9a23['params']['id'];var _0x5e2fcb=_0x3b9a23[_0x4985('0x66')];var _0x52a72f=0xc8;var _0x3c3a27=null;return db['sequelize'][_0x4985('0xed')]({'isolationLevel':db[_0x4985('0xec')][_0x4985('0x11f')][_0x4985('0x120')][_0x4985('0x121')]},function(_0x47e6cc){return db['ChatWebsite'][_0x4985('0x7a')]({'where':{'id':_0x13793b},'transaction':_0x47e6cc})[_0x4985('0x30')](function(_0x1de1da){if(_0x1de1da){return db[_0x4985('0xac')][_0x4985('0x31')]({'where':{'ChatWebsiteId':_0x13793b},'transaction':_0x47e6cc})[_0x4985('0x30')](function(){var _0x22da18=_[_0x4985('0x4b')](_0x5e2fcb,function(_0x3e7538){_0x3e7538[_0x4985('0x77')]=_0x13793b;return _0x3e7538;});return db[_0x4985('0xac')][_0x4985('0x122')](_0x22da18,{'transaction':_0x47e6cc});});}else{_0x52a72f=0x194;_0x3c3a27=[];}});})[_0x4985('0x30')](function(){if(_0x52a72f!==0x194){return db[_0x4985('0xac')]['findAndCountAll']({'where':{'ChatWebsiteId':_0x13793b},'order':_0x4985('0xb3')})['then'](function(_0x2ad53c){_0x3c3a27=_0x2ad53c;});}})[_0x4985('0x25')](function(_0x2dd5ce){_0x52a72f=0x1f4;logger['error'](_0x2dd5ce[_0x4985('0x33')]);if(_0x2dd5ce[_0x4985('0x34')]){delete _0x2dd5ce[_0x4985('0x34')];}_0x3c3a27=_0x2dd5ce;})[_0x4985('0x123')](function(){if(_0x3c3a27===null){_0xd2cd64[_0x4985('0x26')](_0x52a72f);}else{if(_0x52a72f===0x1f4){_0xd2cd64[_0x4985('0x27')](_0x52a72f)['send'](_0x3c3a27);}else{_0xd2cd64[_0x4985('0x27')](_0x52a72f)['json'](_0x3c3a27);}}});};exports['getApplications']=function(_0xfc0801,_0x149be2){var _0x28d204={};var _0x575e3e={};var _0x45ff07;var _0x31150b;return db['ChatWebsite']['findOne']({'where':{'id':_0xfc0801[_0x4985('0x61')]['id']}})[_0x4985('0x30')](handleEntityNotFound(_0x149be2,null))['then'](function(_0x279e46){if(_0x279e46){_0x45ff07=_0x279e46;_0x575e3e[_0x4985('0x44')]=_['keys'](db[_0x4985('0xac')]['rawAttributes']);_0x575e3e['query']=_[_0x4985('0x62')](_0xfc0801['query']);_0x575e3e['filters']=_[_0x4985('0x52')](_0x575e3e[_0x4985('0x44')],_0x575e3e[_0x4985('0x4f')]);_0x28d204[_0x4985('0x51')]=_[_0x4985('0x52')](_0x575e3e['model'],qs[_0x4985('0x53')](_0xfc0801[_0x4985('0x4f')][_0x4985('0x53')]));_0x28d204[_0x4985('0x51')]=_0x28d204[_0x4985('0x51')][_0x4985('0x54')]?_0x28d204[_0x4985('0x51')]:_0x575e3e[_0x4985('0x44')];_0x28d204[_0x4985('0x57')]=qs[_0x4985('0x58')](_0xfc0801['query'][_0x4985('0x58')]);_0x28d204[_0x4985('0x59')]=qs[_0x4985('0x50')](_['pick'](_0xfc0801['query'],_0x575e3e['filters']));if(_0xfc0801[_0x4985('0x4f')][_0x4985('0x5b')]){_0x28d204[_0x4985('0x59')]=_[_0x4985('0x5c')](_0x28d204[_0x4985('0x59')],{'$or':_['map'](_0x28d204[_0x4985('0x51')],function(_0x2c971e){var _0x4d5f0f={};_0x4d5f0f[_0x2c971e]={'$like':'%'+_0xfc0801[_0x4985('0x4f')][_0x4985('0x5b')]+'%'};return _0x4d5f0f;})});}_0x28d204=_[_0x4985('0x5c')]({},_0x28d204,_0xfc0801['options']);return _0x45ff07[_0x4985('0x124')](_0x28d204);}})[_0x4985('0x30')](function(_0x330e0b){if(_0x330e0b){_0x31150b=_0x330e0b['length'];if(!_0xfc0801[_0x4985('0x4f')][_0x4985('0x55')](_0x4985('0x56'))){_0x28d204['limit']=qs[_0x4985('0x2b')](_0xfc0801[_0x4985('0x4f')][_0x4985('0x2b')]);_0x28d204[_0x4985('0x29')]=qs[_0x4985('0x29')](_0xfc0801[_0x4985('0x4f')]['offset']);}return _0x45ff07[_0x4985('0x124')](_0x28d204);}})[_0x4985('0x30')](function(_0x254e50){if(_0x254e50){return _0x254e50?{'count':_0x31150b,'rows':_0x254e50}:null;}})[_0x4985('0x30')](respondWithResult(_0x149be2,null))[_0x4985('0x25')](handleError(_0x149be2,null));};exports[_0x4985('0x125')]=function(_0x18878a,_0x377534){return db[_0x4985('0x126')][_0x4985('0x65')]({'where':{'id':_0x18878a['params']['id']}})['then'](handleEntityNotFound(_0x377534,null))[_0x4985('0x30')](function(_0xb2419e){if(_0xb2419e){return _0xb2419e[_0x4985('0x125')](_0x18878a['body'][_0x4985('0x101')],_[_0x4985('0x102')](_0x18878a[_0x4985('0x66')],['ids','id'])||{});}})[_0x4985('0x30')](respondWithResult(_0x377534,null))['catch'](handleError(_0x377534,null));};exports[_0x4985('0x10a')]=function(_0x209e8e,_0x4da96c){var _0x2d6434={};var _0x52ec31={};var _0x289cca;var _0x394943;return db[_0x4985('0x4c')][_0x4985('0x7a')]({'where':{'id':_0x209e8e[_0x4985('0x61')]['id']}})[_0x4985('0x30')](handleEntityNotFound(_0x4da96c,null))[_0x4985('0x30')](function(_0x545cb7){if(_0x545cb7){_0x289cca=_0x545cb7;_0x52ec31[_0x4985('0x44')]=_[_0x4985('0x62')](db['ChatProactiveAction'][_0x4985('0x4d')]);_0x52ec31[_0x4985('0x4f')]=_[_0x4985('0x62')](_0x209e8e['query']);_0x52ec31['filters']=_['intersection'](_0x52ec31['model'],_0x52ec31[_0x4985('0x4f')]);_0x2d6434[_0x4985('0x51')]=_[_0x4985('0x52')](_0x52ec31['model'],qs[_0x4985('0x53')](_0x209e8e[_0x4985('0x4f')][_0x4985('0x53')]));_0x2d6434[_0x4985('0x51')]=_0x2d6434[_0x4985('0x51')][_0x4985('0x54')]?_0x2d6434[_0x4985('0x51')]:_0x52ec31['model'];_0x2d6434[_0x4985('0x57')]=qs['sort'](_0x209e8e[_0x4985('0x4f')]['sort']);_0x2d6434[_0x4985('0x59')]=qs[_0x4985('0x50')](_['pick'](_0x209e8e[_0x4985('0x4f')],_0x52ec31[_0x4985('0x50')]));if(_0x209e8e[_0x4985('0x4f')]['filter']){_0x2d6434[_0x4985('0x59')]=_[_0x4985('0x5c')](_0x2d6434[_0x4985('0x59')],{'$or':_[_0x4985('0x4b')](_0x2d6434[_0x4985('0x51')],function(_0x1767f9){var _0x12dd8a={};_0x12dd8a[_0x1767f9]={'$like':'%'+_0x209e8e[_0x4985('0x4f')][_0x4985('0x5b')]+'%'};return _0x12dd8a;})});}_0x2d6434=_[_0x4985('0x5c')]({},_0x2d6434,_0x209e8e[_0x4985('0x5e')]);return _0x289cca['getProactiveActions'](_0x2d6434);}})[_0x4985('0x30')](function(_0x330673){if(_0x330673){_0x394943=_0x330673['length'];if(!_0x209e8e[_0x4985('0x4f')][_0x4985('0x55')](_0x4985('0x56'))){_0x2d6434[_0x4985('0x2b')]=qs[_0x4985('0x2b')](_0x209e8e[_0x4985('0x4f')][_0x4985('0x2b')]);_0x2d6434[_0x4985('0x29')]=qs[_0x4985('0x29')](_0x209e8e[_0x4985('0x4f')][_0x4985('0x29')]);}return _0x289cca[_0x4985('0x10a')](_0x2d6434);}})['then'](function(_0x45eb35){if(_0x45eb35){return _0x45eb35?{'count':_0x394943,'rows':_0x45eb35}:null;}})[_0x4985('0x30')](respondWithResult(_0x4da96c,null))[_0x4985('0x25')](handleError(_0x4da96c,null));};exports[_0x4985('0x127')]=function(_0x1569b0,_0x49d107){var _0x64cfbc=_0x1569b0['query'][_0x4985('0x128')]===_0x4985('0x129')?'offlineForm':_0x4985('0x12a');return db[_0x4985('0x4c')][_0x4985('0x65')]({'attributes':['id',_0x64cfbc],'where':{'id':_0x1569b0[_0x4985('0x61')]['id']}})[_0x4985('0x30')](handleEntityNotFound(_0x49d107,null))[_0x4985('0x30')](function(_0x22efac){if(_0x22efac){var _0xa9da9a=_0x22efac[_0x64cfbc];var _0x4bda17=_0xa9da9a&&_0xa9da9a[_0x4985('0x12b')]?_0xa9da9a['items']:[];_0x49d107[_0x4985('0xdb')]({'fromKey':_[_0x4985('0x8d')](_0xa9da9a[_0x4985('0x12c')])?undefined:_0xa9da9a[_0x4985('0x12c')],'count':_0x4bda17[_0x4985('0x54')],'rows':_0x4bda17});}})[_0x4985('0x25')](handleError(_0x49d107,null));};exports[_0x4985('0x12d')]=function(_0x3554a8,_0x1ee342){var _0x125762={'raw':![],'where':{}};var _0x4b0839={};var _0x51c88e={'count':0x0,'rows':[]};return db[_0x4985('0x4c')][_0x4985('0x7a')]({'where':{'id':_0x3554a8['params']['id']}})[_0x4985('0x30')](handleEntityNotFound(_0x1ee342,null))[_0x4985('0x30')](function(_0x570287){if(_0x570287){_0x4b0839[_0x4985('0x44')]=_[_0x4985('0x62')](db['ChatOfflineMessage'][_0x4985('0x4d')]);_0x4b0839[_0x4985('0x4f')]=_['keys'](_0x3554a8[_0x4985('0x4f')]);_0x4b0839[_0x4985('0x50')]=_[_0x4985('0x52')](_0x4b0839[_0x4985('0x44')],_0x4b0839[_0x4985('0x4f')]);_0x125762[_0x4985('0x51')]=_[_0x4985('0x52')](_0x4b0839['model'],qs[_0x4985('0x53')](_0x3554a8[_0x4985('0x4f')][_0x4985('0x53')]));_0x125762[_0x4985('0x51')]=_0x125762[_0x4985('0x51')][_0x4985('0x54')]?_0x125762[_0x4985('0x51')]:_0x4b0839['model'];if(!_0x3554a8[_0x4985('0x4f')][_0x4985('0x55')](_0x4985('0x56'))){_0x125762[_0x4985('0x2b')]=qs[_0x4985('0x2b')](_0x3554a8['query'][_0x4985('0x2b')]);_0x125762[_0x4985('0x29')]=qs[_0x4985('0x29')](_0x3554a8['query'][_0x4985('0x29')]);}_0x125762['order']=qs[_0x4985('0x58')](_0x3554a8[_0x4985('0x4f')][_0x4985('0x58')]);_0x125762[_0x4985('0x59')]=qs[_0x4985('0x50')](_[_0x4985('0x5a')](_0x3554a8['query'],_0x4b0839['filters']));_0x125762[_0x4985('0x59')][_0x4985('0x77')]=_0x570287['id'];if(_0x3554a8[_0x4985('0x4f')]['filter']){_0x125762[_0x4985('0x59')]=_['merge'](_0x125762[_0x4985('0x59')],{'$or':_[_0x4985('0x4b')](_0x125762[_0x4985('0x51')],function(_0x300bb3){var _0x16d629={};_0x16d629[_0x300bb3]={'$like':'%'+_0x3554a8['query'][_0x4985('0x5b')]+'%'};return _0x16d629;})});}_0x125762=_[_0x4985('0x5c')]({},_0x125762,_0x3554a8[_0x4985('0x5e')]);return db[_0x4985('0xe5')][_0x4985('0x2c')]({'where':_0x125762['where']})[_0x4985('0x30')](function(_0x28d2a0){_0x51c88e['count']=_0x28d2a0;if(_0x3554a8[_0x4985('0x4f')]['includeAll']){_0x125762[_0x4985('0x64')]=[{'all':!![]}];}else{_0x125762['include']=[{'model':db['CmContact'],'as':_0x4985('0x104'),'required':![]},{'model':db[_0x4985('0x12e')],'as':_0x4985('0x12f'),'required':![]}];}return db[_0x4985('0xe5')][_0x4985('0x5f')](_0x125762);})['then'](function(_0x438343){_0x51c88e[_0x4985('0x7b')]=_0x438343;return _0x51c88e;});}})['then'](respondWithFilteredResult(_0x1ee342,_0x125762))[_0x4985('0x25')](handleError(_0x1ee342,null));};exports['addAgents']=function(_0x4b721d,_0x34b335){return db[_0x4985('0x4c')][_0x4985('0x65')]({'where':{'id':_0x4b721d['params']['id']}})[_0x4985('0x30')](handleEntityNotFound(_0x34b335,null))[_0x4985('0x30')](function(_0x57f5cc){if(_0x57f5cc){return _0x57f5cc[_0x4985('0x130')](_0x4b721d['body'][_0x4985('0x101')],_['omit'](_0x4b721d[_0x4985('0x66')],[_0x4985('0x101'),'id'])||{})[_0x4985('0xe1')](function(_0x3df6b6){for(var _0x5eff47=0x0;_0x5eff47<_0x4b721d['body']['ids']['length'];_0x5eff47+=0x1){socket[_0x4985('0x131')](_0x4985('0x132'),{'UserId':Number(_0x4b721d[_0x4985('0x66')]['ids'][_0x5eff47]),'ChatWebsiteId':Number(_0x4b721d[_0x4985('0x61')]['id'])});}return _0x3df6b6;});}})['then'](respondWithResult(_0x34b335,null))[_0x4985('0x25')](handleError(_0x34b335,null));};exports['removeAgents']=function(_0x468453,_0x218bc6){return db[_0x4985('0x4c')][_0x4985('0x65')]({'where':{'id':_0x468453[_0x4985('0x61')]['id']}})[_0x4985('0x30')](handleEntityNotFound(_0x218bc6,null))[_0x4985('0x30')](function(_0x45a9ab){if(_0x45a9ab){return _0x45a9ab[_0x4985('0x133')](_0x468453['query'][_0x4985('0x101')])[_0x4985('0x30')](function(){if(_[_0x4985('0x134')](_0x468453[_0x4985('0x4f')][_0x4985('0x101')])){for(var _0x24d939=0x0;_0x24d939<_0x468453['query']['ids'][_0x4985('0x54')];_0x24d939+=0x1){socket['emit'](_0x4985('0x135'),{'UserId':Number(_0x468453[_0x4985('0x4f')][_0x4985('0x101')][_0x24d939]),'ChatWebsiteId':Number(_0x468453['params']['id'])});}}else{socket[_0x4985('0x131')](_0x4985('0x135'),{'UserId':Number(_0x468453[_0x4985('0x4f')][_0x4985('0x101')]),'ChatWebsiteId':Number(_0x468453[_0x4985('0x61')]['id'])});}});}})[_0x4985('0x30')](respondWithStatusCode(_0x218bc6,null))['catch'](handleError(_0x218bc6,null));};exports[_0x4985('0x136')]=function(_0x1612aa,_0x51e8dd){var _0x585dd6={};var _0x62fb9f={};var _0x18ad8b;var _0xd29a97;return db[_0x4985('0x4c')][_0x4985('0x7a')]({'where':{'id':_0x1612aa[_0x4985('0x61')]['id']}})[_0x4985('0x30')](handleEntityNotFound(_0x51e8dd,null))[_0x4985('0x30')](function(_0x20a9d3){if(_0x20a9d3){_0x18ad8b=_0x20a9d3;_0x62fb9f['model']=_['keys'](db[_0x4985('0xca')][_0x4985('0x4d')]);_0x62fb9f[_0x4985('0x4f')]=_[_0x4985('0x62')](_0x1612aa['query']);_0x62fb9f[_0x4985('0x50')]=_[_0x4985('0x52')](_0x62fb9f[_0x4985('0x44')],_0x62fb9f[_0x4985('0x4f')]);_0x585dd6[_0x4985('0x51')]=_[_0x4985('0x52')](_0x62fb9f[_0x4985('0x44')],qs[_0x4985('0x53')](_0x1612aa[_0x4985('0x4f')]['fields']));_0x585dd6[_0x4985('0x51')]=_0x585dd6[_0x4985('0x51')][_0x4985('0x54')]?_0x585dd6[_0x4985('0x51')]:_0x62fb9f[_0x4985('0x44')];_0x585dd6['order']=qs[_0x4985('0x58')](_0x1612aa[_0x4985('0x4f')]['sort']);_0x585dd6['where']=qs['filters'](_[_0x4985('0x5a')](_0x1612aa['query'],_0x62fb9f[_0x4985('0x50')]));if(_0x1612aa[_0x4985('0x4f')][_0x4985('0x5b')]){_0x585dd6[_0x4985('0x59')]=_[_0x4985('0x5c')](_0x585dd6['where'],{'$or':_[_0x4985('0x4b')](_0x585dd6[_0x4985('0x51')],function(_0x59d03d){var _0x514700={};_0x514700[_0x59d03d]={'$like':'%'+_0x1612aa[_0x4985('0x4f')][_0x4985('0x5b')]+'%'};return _0x514700;})});}_0x585dd6=_[_0x4985('0x5c')]({},_0x585dd6,_0x1612aa[_0x4985('0x5e')]);return _0x18ad8b[_0x4985('0x136')](_0x585dd6);}})[_0x4985('0x30')](function(_0x8f6187){if(_0x8f6187){_0xd29a97=_0x8f6187[_0x4985('0x54')];if(!_0x1612aa[_0x4985('0x4f')][_0x4985('0x55')](_0x4985('0x56'))){_0x585dd6['limit']=qs['limit'](_0x1612aa['query'][_0x4985('0x2b')]);_0x585dd6[_0x4985('0x29')]=qs[_0x4985('0x29')](_0x1612aa[_0x4985('0x4f')][_0x4985('0x29')]);}return _0x18ad8b[_0x4985('0x136')](_0x585dd6);}})[_0x4985('0x30')](function(_0x3968ee){if(_0x3968ee){return _0x3968ee?{'count':_0xd29a97,'rows':_0x3968ee}:null;}})[_0x4985('0x30')](respondWithResult(_0x51e8dd,null))[_0x4985('0x25')](handleError(_0x51e8dd,null));}; \ No newline at end of file +var _0x4638=['externalUrl','interaction','firstName','messageId','created','autoclose','applications','push','close','unmanaged','*,*,*,*','ChatMessage','UserId','User','unshift','agent','waitForTheAssignedAgent','queueId','ChatQueue','queue','waitForTheAssignedQueue','Start','startRouting','EventManager','offline','files','ValidationError','CompanyId','Sequelize','mapKeyOffline','send','mapKeyOffline\x20is\x20mandatory,\x20please\x20use\x20one\x20of\x20these:\x20','includes','List','MailAccount','findOrCreate','server/files/templates/chatOfflineMessage.ejs','utf8','offlineMessageBody','fromString','originalname','mimetype','server','attachments','basename','openNewInteraction','sequelize','transaction','Attachment','MailServerOut','Smtp','CloudProvider','forwardOffline','forwardOfflineAddress','subjectOffline','toPairsIn','mapValues','email','offlineMessageSubject','Chat','MailAccountId','NotifyMailAccount','notifyMail','offline-chat','remove','Could\x20not\x20remove\x20attachment\x20file','addInteraction','omit','getInteractions','Contact','Owner','fullname','internal','Tag','Tags','color','tag','getSnippet','../../config/license/util','virtual','License','increment','chatLicenseExceeded','timezone','readFileSync','server/files/chat/iframe.ejs','origin','http://localhost:9000','remote','x-real-ip','connection','remoteAddress','replace','render','alignment','labelText','textColor','backgroundColor','hideWhenOffline','IntervalId','addApplications','Transaction','ISOLATION_LEVELS','READ_COMMITTED','bulkCreate','findAndCountAll','priority','getApplications','addProactiveActions','getProactiveActions','ChatProactiveAction','getFields','online','false','offlineForm','onlineForm','items','fromKey','getOfflineMessages','ChatOfflineMessage','addAgents','emit','userChatWebsite:save','isArray','userChatWebsite:remove','getAgents','mustache','util','path','fs-extra','lodash','html-to-text','jayson/promise','../../components/parsers/qs','api','../../config/environment','../../errors/api','APIOutOfIntervalError','handleError','APIConflictError','./helpers/wildcard-expressions','url','../../mysqldb','redis','defaults','localhost','socket.io-emitter','./chatWebsite.socket','register','client','http','request','then','info','ChatWebsite,\x20%s,\x20%s','request\x20sent','error','code','message','result','catch','sendStatus','status','end','json','offset','undefined','limit','count','Content-Range','update','get','UserProfileResource','stack','name','user-agent-parser','getResult','customerIp','cf-connecting-ip','x-forwarded-for','first','split','lastName','x-real-port','browser','version','unknown','format','%s\x20%s','device','model','vendor','type','stringify','index','Pause','mandatoryDispositionPause','map','ChatWebsite','rawAttributes','key','query','keys','filters','intersection','attributes','fields','length','hasOwnProperty','nolimit','order','sort','where','pick','merge','VIRTUAL','filter','options','includeAll','findAll','rows','params','include','create','address','forEach','trim','testWildcardValidity','body','user','Unable\x20to\x20retrieve\x20the\x20current\x20user','role','ChatWebsites','UserProfileSection','find','userProfileId','autoAssociation','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','\x22\x20is\x20not\x20a\x20valid\x20wildcard\x20expression','destroy','describe','addDisposition','ChatWebsiteId','getDispositions','Disposition','removeDispositions','ids','addAnswer','findOne','CannedAnswer','removeAnswers','addLogo','sitepic','file','filename','addAvatar','agentAvatar','addCustomerAvatar','customerAvatar','addSystemAvatar','systemAvatar','getLogo','root','server/files/images/logos/default_logo.svg','getLicense','custom','isNil','server/files/images/logos/','join','download','getAvatar','server/files/images/avatars/default_avatar.png','server/files/images/avatars/','showCustomerAvatar','existsSync','server/files/images/avatars/system_avatar.png','resolve','ifTime','notify','from','From\x20is\x20mandatory','mapKey','MapKey\x20is\x20mandatory','isEmpty','referer','CmContact','No\x20available\x20attributes','createdAt','updatedAt','ListId','Invalid\x20MapKey\x20parameter.\x20Allowed\x20values:\x20','CmList','Contacts','DESC','ChatApplication','Applications','Interval','Intervals','Chat\x20Website\x20with\x20id\x20%s\x20not\x20found','asc','account','list','contact','headers','threadId','closed','ChatInteraction'];(function(_0x22b68a,_0x2bffc3){var _0x1ac67a=function(_0x25f9d5){while(--_0x25f9d5){_0x22b68a['push'](_0x22b68a['shift']());}};_0x1ac67a(++_0x2bffc3);}(_0x4638,0x1b1));var _0x8463=function(_0x55a0f4,_0x525f6b){_0x55a0f4=_0x55a0f4-0x0;var _0x511ead=_0x4638[_0x55a0f4];return _0x511ead;};'use strict';var Mustache=require(_0x8463('0x0'));var util=require(_0x8463('0x1'));var path=require(_0x8463('0x2'));var ejs=require('ejs');var fs=require('fs');var fs_extra=require(_0x8463('0x3'));var _=require(_0x8463('0x4'));var querystring=require('querystring');var htmlToText=require(_0x8463('0x5'));var Redis=require('ioredis');var jayson=require(_0x8463('0x6'));var qs=require(_0x8463('0x7'));var logger=require('../../config/logger')(_0x8463('0x8'));var config=require(_0x8463('0x9'));var APIBadRequestError=require(_0x8463('0xa'))['APIBadRequestError'];var APINotFoundError=require(_0x8463('0xa'))['APINotFoundError'];var APIOutOfIntervalError=require(_0x8463('0xa'))[_0x8463('0xb')];var APIHandleError=require(_0x8463('0xa'))[_0x8463('0xc')];var APIConflictError=require(_0x8463('0xa'))[_0x8463('0xd')];var wildcardUtils=require(_0x8463('0xe'));var URL=require(_0x8463('0xf'))['URL'];var db=require(_0x8463('0x10'))['db'];config[_0x8463('0x11')]=_[_0x8463('0x12')](config[_0x8463('0x11')],{'host':_0x8463('0x13'),'port':0x18eb});var socket=require(_0x8463('0x14'))(new Redis(config[_0x8463('0x11')]));require(_0x8463('0x15'))[_0x8463('0x16')](socket);var client=jayson[_0x8463('0x17')][_0x8463('0x18')]({'port':0x232c});var client9002=jayson[_0x8463('0x17')][_0x8463('0x18')]({'port':0x232a});var client9003=jayson[_0x8463('0x17')][_0x8463('0x18')]({'port':0x232b});var client9001=jayson[_0x8463('0x17')][_0x8463('0x18')]({'port':0x2329});function respondWithRpcPromise(_0xae40db,_0xf884aa,_0x3539ed,_0xc4e661){return new Promise(function(_0x243fe0,_0x53d0dc){var _0x275cc5=_0xc4e661||client;return _0x275cc5[_0x8463('0x19')](_0xae40db,_0x3539ed)[_0x8463('0x1a')](function(_0x2e6c44){logger[_0x8463('0x1b')](_0x8463('0x1c'),_0xf884aa,_0x8463('0x1d'));logger['debug']('ChatWebsite,\x20%s,\x20%s,\x20%s',_0xf884aa,_0x8463('0x1d'),JSON['stringify'](_0x2e6c44));if(_0x2e6c44[_0x8463('0x1e')]){if(_0x2e6c44[_0x8463('0x1e')][_0x8463('0x1f')]===0x1f4){logger['error'](_0x8463('0x1c'),_0xf884aa,_0x2e6c44[_0x8463('0x1e')][_0x8463('0x20')]);return _0x53d0dc(_0x2e6c44[_0x8463('0x1e')][_0x8463('0x20')]);}logger[_0x8463('0x1e')](_0x8463('0x1c'),_0xf884aa,_0x2e6c44[_0x8463('0x1e')][_0x8463('0x20')]);return _0x243fe0(_0x2e6c44['error'][_0x8463('0x20')]);}else{logger[_0x8463('0x1b')](_0x8463('0x1c'),_0xf884aa,_0x8463('0x1d'));_0x243fe0(_0x2e6c44[_0x8463('0x21')][_0x8463('0x20')]);}})[_0x8463('0x22')](function(_0x3d7e27){logger[_0x8463('0x1e')](_0x8463('0x1c'),_0xf884aa,_0x3d7e27);_0x53d0dc(_0x3d7e27);});});}function respondWithStatusCode(_0x5d9ac8,_0xa1f3e6){_0xa1f3e6=_0xa1f3e6||0xcc;return function(_0x5e2f38){if(_0x5e2f38){return _0x5d9ac8[_0x8463('0x23')](_0xa1f3e6);}return _0x5d9ac8[_0x8463('0x24')](_0xa1f3e6)[_0x8463('0x25')]();};}function respondWithResult(_0x17b61a,_0x5f3d0e){_0x5f3d0e=_0x5f3d0e||0xc8;return function(_0x15fccb){if(_0x15fccb){return _0x17b61a[_0x8463('0x24')](_0x5f3d0e)[_0x8463('0x26')](_0x15fccb);}};}function respondWithFilteredResult(_0x1e2527,_0xc98807){return function(_0x322f57){if(_0x322f57){var _0x33709e=typeof _0xc98807[_0x8463('0x27')]===_0x8463('0x28')&&typeof _0xc98807[_0x8463('0x29')]==='undefined';var _0x3314fe=_0x322f57[_0x8463('0x2a')];var _0x4e3ca9=_0x33709e?0x0:_0xc98807[_0x8463('0x27')];var _0x4f19d3=_0x33709e?_0x322f57[_0x8463('0x2a')]:_0xc98807[_0x8463('0x27')]+_0xc98807[_0x8463('0x29')];var _0x554cdb;if(_0x4f19d3>=_0x3314fe){_0x4f19d3=_0x3314fe;_0x554cdb=0xc8;}else{_0x554cdb=0xce;}_0x1e2527[_0x8463('0x24')](_0x554cdb);return _0x1e2527['set'](_0x8463('0x2b'),_0x4e3ca9+'-'+_0x4f19d3+'/'+_0x3314fe)[_0x8463('0x26')](_0x322f57);}return null;};}function saveUpdates(_0x306e43){return function(_0x40eb57){if(_0x40eb57){return _0x40eb57[_0x8463('0x2c')](_0x306e43)[_0x8463('0x1a')](function(_0x266692){return _0x266692;});}return null;};}function removeEntity(_0x69a228){return function(_0x347d3f){if(_0x347d3f){return _0x347d3f['destroy']()['then'](function(){var _0x118f21=_0x347d3f[_0x8463('0x2d')]({'plain':!![]});var _0x169ecb='ChatWebsites';return db[_0x8463('0x2e')]['destroy']({'where':{'type':_0x169ecb,'resourceId':_0x118f21['id']}})[_0x8463('0x1a')](function(){return _0x347d3f;});})[_0x8463('0x1a')](function(){_0x69a228['status'](0xcc)[_0x8463('0x25')]();});}};}function handleEntityNotFound(_0x475153){return function(_0x3525ae){if(!_0x3525ae){_0x475153['sendStatus'](0x194);}return _0x3525ae;};}function handleError(_0x6bd522,_0x46d01b){_0x46d01b=_0x46d01b||0x1f4;return function(_0x49d4c7){logger[_0x8463('0x1e')](_0x49d4c7[_0x8463('0x2f')]);if(_0x49d4c7[_0x8463('0x30')]){delete _0x49d4c7[_0x8463('0x30')];}_0x6bd522[_0x8463('0x24')](_0x46d01b)['send'](_0x49d4c7);};}function createInteractionObject(_0xb59227,_0x320a72,_0x42120f,_0x1f3609){var _0xf2e416=require(_0x8463('0x31'));var _0x1c6962=new _0xf2e416();var _0xffc0cb=_0x1c6962['setUA'](_0x42120f['user-agent'])[_0x8463('0x32')]();var _0x5d83d2=_0x320a72[_0x8463('0x33')];if(_0x42120f[_0x8463('0x34')]){_0x5d83d2=_0x42120f[_0x8463('0x34')];}else if(_0x42120f[_0x8463('0x35')]){_0x5d83d2=_[_0x8463('0x36')](_0x42120f['x-forwarded-for'][_0x8463('0x37')](','));}return{'ContactId':_0x1f3609['id'],'ChatWebsiteId':_0xb59227,'from':(_0x1f3609['firstName']||'')+'\x20'+(_0x1f3609[_0x8463('0x38')]||''),'customerIp':_0x5d83d2,'customerPort':_0x42120f['x-real-port']?_0x42120f[_0x8463('0x39')]:null,'referer':_0x320a72['referer'],'browserName':_0xffc0cb[_0x8463('0x3a')]['name']&&_0xffc0cb[_0x8463('0x3a')]['version']?util['format']('%s\x20%s',_0xffc0cb[_0x8463('0x3a')]['name'],_0xffc0cb[_0x8463('0x3a')][_0x8463('0x3b')]):_0x8463('0x3c'),'browserVersion':_0xffc0cb[_0x8463('0x3a')][_0x8463('0x3b')]||_0x8463('0x3c'),'osName':util[_0x8463('0x3d')](_0x8463('0x3e'),_0xffc0cb['os'][_0x8463('0x30')],_0xffc0cb['os']['version']),'osVersion':_0xffc0cb['os'][_0x8463('0x3b')],'deviceModel':_0xffc0cb[_0x8463('0x3f')][_0x8463('0x40')]&&_0xffc0cb['device'][_0x8463('0x41')]?util['format']('%s\x20%s\x20%s',_0xffc0cb['device'][_0x8463('0x40')],_0xffc0cb[_0x8463('0x3f')]['vendor'],_0xffc0cb[_0x8463('0x3f')][_0x8463('0x42')]):null,'deviceVendor':_0xffc0cb[_0x8463('0x3f')][_0x8463('0x41')],'deviceType':_0xffc0cb[_0x8463('0x3f')][_0x8463('0x42')],'formData':JSON[_0x8463('0x43')](_0x320a72)};}exports[_0x8463('0x44')]=function(_0x3dd3e6,_0xc7a4cc){var _0x3df293={'include':[{'model':db[_0x8463('0x45')],'as':_0x8463('0x46')}]},_0x5a1c2a={},_0x577b85={'count':0x0,'rows':[]};var _0x62069=_[_0x8463('0x47')](db[_0x8463('0x48')][_0x8463('0x49')],function(_0x5b2ff3){return{'name':_0x5b2ff3['fieldName'],'type':_0x5b2ff3[_0x8463('0x42')][_0x8463('0x4a')]};});_0x5a1c2a['model']=_[_0x8463('0x47')](_0x62069,_0x8463('0x30'));_0x5a1c2a[_0x8463('0x4b')]=_[_0x8463('0x4c')](_0x3dd3e6['query']);_0x5a1c2a[_0x8463('0x4d')]=_[_0x8463('0x4e')](_0x5a1c2a['model'],_0x5a1c2a[_0x8463('0x4b')]);_0x3df293[_0x8463('0x4f')]=_[_0x8463('0x4e')](_0x5a1c2a[_0x8463('0x40')],qs[_0x8463('0x50')](_0x3dd3e6[_0x8463('0x4b')][_0x8463('0x50')]));_0x3df293['attributes']=_0x3df293[_0x8463('0x4f')][_0x8463('0x51')]?_0x3df293[_0x8463('0x4f')]:_0x5a1c2a[_0x8463('0x40')];if(!_0x3dd3e6[_0x8463('0x4b')][_0x8463('0x52')](_0x8463('0x53'))){_0x3df293[_0x8463('0x29')]=qs[_0x8463('0x29')](_0x3dd3e6[_0x8463('0x4b')][_0x8463('0x29')]);_0x3df293['offset']=qs['offset'](_0x3dd3e6[_0x8463('0x4b')][_0x8463('0x27')]);}_0x3df293[_0x8463('0x54')]=qs[_0x8463('0x55')](_0x3dd3e6['query'][_0x8463('0x55')]);_0x3df293[_0x8463('0x56')]=qs[_0x8463('0x4d')](_[_0x8463('0x57')](_0x3dd3e6[_0x8463('0x4b')],_0x5a1c2a[_0x8463('0x4d')]),_0x62069);if(_0x3dd3e6[_0x8463('0x4b')]['filter']){_0x3df293[_0x8463('0x56')]=_[_0x8463('0x58')](_0x3df293[_0x8463('0x56')],{'$or':_[_0x8463('0x47')](_0x62069,function(_0x31f326){if(_0x31f326['type']!==_0x8463('0x59')){var _0x3bc96f={};_0x3bc96f[_0x31f326[_0x8463('0x30')]]={'$like':'%'+_0x3dd3e6['query'][_0x8463('0x5a')]+'%'};return _0x3bc96f;}})});}_0x3df293=_[_0x8463('0x58')]({},_0x3df293,_0x3dd3e6[_0x8463('0x5b')]);var _0x39e192={'where':_0x3df293[_0x8463('0x56')]};return db['ChatWebsite'][_0x8463('0x2a')](_0x39e192)[_0x8463('0x1a')](function(_0x5df513){_0x577b85['count']=_0x5df513;if(_0x3dd3e6[_0x8463('0x4b')][_0x8463('0x5c')]){_0x3df293['include']=[{'all':!![]}];}return db[_0x8463('0x48')][_0x8463('0x5d')](_0x3df293);})[_0x8463('0x1a')](function(_0x4d4c27){_0x577b85[_0x8463('0x5e')]=_0x4d4c27;return _0x577b85;})[_0x8463('0x1a')](respondWithFilteredResult(_0xc7a4cc,_0x3df293))[_0x8463('0x22')](handleError(_0xc7a4cc,null));};exports['show']=function(_0x143626,_0x5593d0){var _0xbfb0cf={'raw':![],'where':{'id':_0x143626[_0x8463('0x5f')]['id']},'include':[{'model':db['Pause'],'as':_0x8463('0x46')}]},_0xdaf37e={};_0xdaf37e['model']=_['keys'](db['ChatWebsite'][_0x8463('0x49')]);_0xdaf37e[_0x8463('0x4b')]=_[_0x8463('0x4c')](_0x143626[_0x8463('0x4b')]);_0xdaf37e['filters']=_['intersection'](_0xdaf37e['model'],_0xdaf37e['query']);_0xbfb0cf[_0x8463('0x4f')]=_['intersection'](_0xdaf37e[_0x8463('0x40')],qs[_0x8463('0x50')](_0x143626[_0x8463('0x4b')][_0x8463('0x50')]));_0xbfb0cf['attributes']=_0xbfb0cf['attributes']['length']?_0xbfb0cf[_0x8463('0x4f')]:_0xdaf37e[_0x8463('0x40')];if(_0x143626[_0x8463('0x4b')][_0x8463('0x5c')]){_0xbfb0cf[_0x8463('0x60')]=[{'all':!![]}];}_0xbfb0cf=_[_0x8463('0x58')]({},_0xbfb0cf,_0x143626['options']);return db[_0x8463('0x48')]['find'](_0xbfb0cf)['then'](handleEntityNotFound(_0x5593d0,null))[_0x8463('0x1a')](respondWithResult(_0x5593d0,null))[_0x8463('0x22')](handleError(_0x5593d0,null));};exports[_0x8463('0x61')]=function(_0xaaa2e9,_0x3fc43d){var _0x19788b=null;_0xaaa2e9['body'][_0x8463('0x62')][_0x8463('0x37')](',')[_0x8463('0x63')](_0x4419d3=>{if(_0x4419d3[_0x8463('0x64')]()!==''&&!wildcardUtils[_0x8463('0x65')](_0x4419d3[_0x8463('0x64')]())){_0x19788b=new APIBadRequestError('\x22'+_0x4419d3['trim']()+'\x22\x20is\x20not\x20a\x20valid\x20wildcard\x20expression');}});if(_0x19788b){return handleError(_0x3fc43d,null)(_0x19788b);}return db['ChatWebsite'][_0x8463('0x61')](_0xaaa2e9[_0x8463('0x66')],{})[_0x8463('0x1a')](function(_0x10eb7c){var _0xb49a50=_0xaaa2e9[_0x8463('0x67')]['get']({'plain':!![]});if(!_0xb49a50)throw new Error(_0x8463('0x68'));if(_0xb49a50[_0x8463('0x69')]==='user'){var _0x103ed2=_0x10eb7c['get']({'plain':!![]});var _0x1d6038=_0x8463('0x6a');return db[_0x8463('0x6b')][_0x8463('0x6c')]({'where':{'name':_0x1d6038,'userProfileId':_0xb49a50[_0x8463('0x6d')]},'raw':!![]})[_0x8463('0x1a')](function(_0x251f92){if(_0x251f92&&_0x251f92[_0x8463('0x6e')]===0x0){return db[_0x8463('0x2e')]['create']({'name':_0x103ed2['name'],'resourceId':_0x103ed2['id'],'type':_0x251f92[_0x8463('0x30')],'sectionId':_0x251f92['id']},{})[_0x8463('0x1a')](function(){return _0x10eb7c;});}else{return _0x10eb7c;}})['catch'](function(_0x23ef92){logger[_0x8463('0x1e')](_0x8463('0x6f'),_0x23ef92);throw _0x23ef92;});}return _0x10eb7c;})[_0x8463('0x1a')](respondWithResult(_0x3fc43d,0xc9))['catch'](handleError(_0x3fc43d,null));};exports['update']=function(_0x3ed6f0,_0x48e9b5){var _0x47ae5a=null;_0x3ed6f0['body']['address']['split'](',')[_0x8463('0x63')](_0x418f42=>{if(_0x418f42['trim']()!==''&&!wildcardUtils[_0x8463('0x65')](_0x418f42['trim']())){_0x47ae5a=new APIBadRequestError('\x22'+_0x418f42[_0x8463('0x64')]()+_0x8463('0x70'));}});if(_0x47ae5a){return handleError(_0x48e9b5,null)(_0x47ae5a);}if(_0x3ed6f0[_0x8463('0x66')]['id']){delete _0x3ed6f0[_0x8463('0x66')]['id'];}return db['ChatWebsite']['find']({'where':{'id':_0x3ed6f0['params']['id']},'include':[{'model':db['Pause'],'as':_0x8463('0x46')}]})[_0x8463('0x1a')](handleEntityNotFound(_0x48e9b5,null))['then'](saveUpdates(_0x3ed6f0[_0x8463('0x66')],null))[_0x8463('0x1a')](respondWithResult(_0x48e9b5,null))[_0x8463('0x22')](handleError(_0x48e9b5,null));};exports[_0x8463('0x71')]=function(_0x3b0cc5,_0x820747){return db[_0x8463('0x48')][_0x8463('0x6c')]({'where':{'id':_0x3b0cc5[_0x8463('0x5f')]['id']}})[_0x8463('0x1a')](handleEntityNotFound(_0x820747,null))[_0x8463('0x1a')](removeEntity(_0x820747,null))[_0x8463('0x22')](handleError(_0x820747,null));};exports[_0x8463('0x72')]=function(_0x23a776,_0xb52a73){return db[_0x8463('0x48')][_0x8463('0x72')]()[_0x8463('0x1a')](respondWithResult(_0xb52a73,null))[_0x8463('0x22')](handleError(_0xb52a73,null));};exports[_0x8463('0x73')]=function(_0x3ff070,_0xfbb3){if(_0x3ff070[_0x8463('0x66')]['id']){delete _0x3ff070[_0x8463('0x66')]['id'];}return db['ChatWebsite'][_0x8463('0x6c')]({'where':{'id':_0x3ff070['params']['id']}})[_0x8463('0x1a')](handleEntityNotFound(_0xfbb3,null))[_0x8463('0x1a')](function(_0x27a1a5){if(_0x27a1a5){_0x3ff070[_0x8463('0x66')][_0x8463('0x74')]=_0x27a1a5['id'];return db['Disposition'][_0x8463('0x61')](_0x3ff070['body']);}})[_0x8463('0x1a')](respondWithResult(_0xfbb3,null))[_0x8463('0x22')](handleError(_0xfbb3,null));};exports[_0x8463('0x75')]=function(_0x22b65d,_0x3c5c2a){var _0x1e281a={'raw':![],'where':{}};var _0x331df5={};var _0x37340e={'count':0x0,'rows':[]};return db[_0x8463('0x48')]['findOne']({'where':{'id':_0x22b65d['params']['id']}})[_0x8463('0x1a')](handleEntityNotFound(_0x3c5c2a,null))[_0x8463('0x1a')](function(_0x3eb92a){if(_0x3eb92a){_0x331df5[_0x8463('0x40')]=_[_0x8463('0x4c')](db[_0x8463('0x76')]['rawAttributes']);_0x331df5[_0x8463('0x4b')]=_['keys'](_0x22b65d['query']);_0x331df5[_0x8463('0x4d')]=_[_0x8463('0x4e')](_0x331df5['model'],_0x331df5['query']);_0x1e281a[_0x8463('0x4f')]=_[_0x8463('0x4e')](_0x331df5[_0x8463('0x40')],qs['fields'](_0x22b65d[_0x8463('0x4b')][_0x8463('0x50')]));_0x1e281a[_0x8463('0x4f')]=_0x1e281a[_0x8463('0x4f')][_0x8463('0x51')]?_0x1e281a[_0x8463('0x4f')]:_0x331df5[_0x8463('0x40')];if(!_0x22b65d['query'][_0x8463('0x52')]('nolimit')){_0x1e281a[_0x8463('0x29')]=qs[_0x8463('0x29')](_0x22b65d[_0x8463('0x4b')][_0x8463('0x29')]);_0x1e281a[_0x8463('0x27')]=qs[_0x8463('0x27')](_0x22b65d[_0x8463('0x4b')]['offset']);}_0x1e281a[_0x8463('0x54')]=qs[_0x8463('0x55')](_0x22b65d[_0x8463('0x4b')]['sort']);_0x1e281a[_0x8463('0x56')]=qs[_0x8463('0x4d')](_[_0x8463('0x57')](_0x22b65d[_0x8463('0x4b')],_0x331df5[_0x8463('0x4d')]));_0x1e281a[_0x8463('0x56')][_0x8463('0x74')]=_0x3eb92a['id'];if(_0x22b65d[_0x8463('0x4b')]['filter']){_0x1e281a[_0x8463('0x56')]=_[_0x8463('0x58')](_0x1e281a['where'],{'$or':_['map'](_0x1e281a['attributes'],function(_0x391dc1){var _0x321afe={};_0x321afe[_0x391dc1]={'$like':'%'+_0x22b65d['query'][_0x8463('0x5a')]+'%'};return _0x321afe;})});}_0x1e281a=_[_0x8463('0x58')]({},_0x1e281a,_0x22b65d[_0x8463('0x5b')]);return db[_0x8463('0x76')]['count']({'where':_0x1e281a[_0x8463('0x56')]})['then'](function(_0x48fc06){_0x37340e['count']=_0x48fc06;if(_0x22b65d['query'][_0x8463('0x5c')]){_0x1e281a[_0x8463('0x60')]=[{'all':!![]}];}return db[_0x8463('0x76')]['findAll'](_0x1e281a);})[_0x8463('0x1a')](function(_0x1d65f4){_0x37340e[_0x8463('0x5e')]=_0x1d65f4;return _0x37340e;});}})['then'](respondWithFilteredResult(_0x3c5c2a,_0x1e281a))[_0x8463('0x22')](handleError(_0x3c5c2a,null));};exports['removeDispositions']=function(_0x3da60e,_0x404266){return db[_0x8463('0x48')][_0x8463('0x6c')]({'where':{'id':_0x3da60e['params']['id']}})['then'](handleEntityNotFound(_0x404266,null))[_0x8463('0x1a')](function(_0x4d5446){if(_0x4d5446){return _0x4d5446[_0x8463('0x77')](_0x3da60e[_0x8463('0x4b')][_0x8463('0x78')]);}})[_0x8463('0x1a')](respondWithStatusCode(_0x404266,null))[_0x8463('0x22')](handleError(_0x404266,null));};exports[_0x8463('0x79')]=function(_0x2727b5,_0x181592){if(_0x2727b5['body']['id']){delete _0x2727b5[_0x8463('0x66')]['id'];}return db[_0x8463('0x48')][_0x8463('0x6c')]({'where':{'id':_0x2727b5[_0x8463('0x5f')]['id']}})[_0x8463('0x1a')](handleEntityNotFound(_0x181592,null))[_0x8463('0x1a')](function(_0x590118){if(_0x590118){_0x2727b5[_0x8463('0x66')][_0x8463('0x74')]=_0x590118['id'];return db['CannedAnswer'][_0x8463('0x61')](_0x2727b5[_0x8463('0x66')]);}})[_0x8463('0x1a')](respondWithResult(_0x181592,null))[_0x8463('0x22')](handleError(_0x181592,null));};exports['getAnswers']=function(_0x378af2,_0x4dc509){var _0x3a4654={'raw':![],'where':{}};var _0x1c858c={};var _0x47fbb1={'count':0x0,'rows':[]};return db[_0x8463('0x48')][_0x8463('0x7a')]({'where':{'id':_0x378af2[_0x8463('0x5f')]['id']}})[_0x8463('0x1a')](handleEntityNotFound(_0x4dc509,null))['then'](function(_0x171c43){if(_0x171c43){_0x1c858c['model']=_['keys'](db['CannedAnswer'][_0x8463('0x49')]);_0x1c858c[_0x8463('0x4b')]=_[_0x8463('0x4c')](_0x378af2[_0x8463('0x4b')]);_0x1c858c['filters']=_[_0x8463('0x4e')](_0x1c858c[_0x8463('0x40')],_0x1c858c[_0x8463('0x4b')]);_0x3a4654[_0x8463('0x4f')]=_[_0x8463('0x4e')](_0x1c858c[_0x8463('0x40')],qs[_0x8463('0x50')](_0x378af2[_0x8463('0x4b')][_0x8463('0x50')]));_0x3a4654[_0x8463('0x4f')]=_0x3a4654[_0x8463('0x4f')][_0x8463('0x51')]?_0x3a4654[_0x8463('0x4f')]:_0x1c858c[_0x8463('0x40')];if(!_0x378af2[_0x8463('0x4b')][_0x8463('0x52')]('nolimit')){_0x3a4654[_0x8463('0x29')]=qs['limit'](_0x378af2[_0x8463('0x4b')][_0x8463('0x29')]);_0x3a4654[_0x8463('0x27')]=qs[_0x8463('0x27')](_0x378af2[_0x8463('0x4b')][_0x8463('0x27')]);}_0x3a4654[_0x8463('0x54')]=qs[_0x8463('0x55')](_0x378af2[_0x8463('0x4b')][_0x8463('0x55')]);_0x3a4654[_0x8463('0x56')]=qs[_0x8463('0x4d')](_[_0x8463('0x57')](_0x378af2['query'],_0x1c858c[_0x8463('0x4d')]));_0x3a4654[_0x8463('0x56')]['ChatWebsiteId']=_0x171c43['id'];if(_0x378af2[_0x8463('0x4b')]['filter']){_0x3a4654[_0x8463('0x56')]=_[_0x8463('0x58')](_0x3a4654[_0x8463('0x56')],{'$or':_[_0x8463('0x47')](_0x3a4654[_0x8463('0x4f')],function(_0x1becec){var _0x3f4bbd={};_0x3f4bbd[_0x1becec]={'$like':'%'+_0x378af2[_0x8463('0x4b')][_0x8463('0x5a')]+'%'};return _0x3f4bbd;})});}_0x3a4654=_[_0x8463('0x58')]({},_0x3a4654,_0x378af2[_0x8463('0x5b')]);return db[_0x8463('0x7b')][_0x8463('0x2a')]({'where':_0x3a4654[_0x8463('0x56')]})[_0x8463('0x1a')](function(_0x29683b){_0x47fbb1[_0x8463('0x2a')]=_0x29683b;if(_0x378af2[_0x8463('0x4b')][_0x8463('0x5c')]){_0x3a4654['include']=[{'all':!![]}];}return db[_0x8463('0x7b')][_0x8463('0x5d')](_0x3a4654);})['then'](function(_0x173759){_0x47fbb1[_0x8463('0x5e')]=_0x173759;return _0x47fbb1;});}})['then'](respondWithFilteredResult(_0x4dc509,_0x3a4654))[_0x8463('0x22')](handleError(_0x4dc509,null));};exports[_0x8463('0x7c')]=function(_0x37018f,_0x56eae7){return db['ChatWebsite'][_0x8463('0x6c')]({'where':{'id':_0x37018f[_0x8463('0x5f')]['id']}})['then'](handleEntityNotFound(_0x56eae7,null))['then'](function(_0x28a4e6){if(_0x28a4e6){return _0x28a4e6[_0x8463('0x7c')](_0x37018f[_0x8463('0x4b')][_0x8463('0x78')]);}})[_0x8463('0x1a')](respondWithStatusCode(_0x56eae7,null))[_0x8463('0x22')](handleError(_0x56eae7,null));};exports[_0x8463('0x7d')]=function(_0x2087f6,_0x4e4744){_0x2087f6[_0x8463('0x66')][_0x8463('0x7e')]=_0x2087f6[_0x8463('0x7f')][_0x8463('0x80')];return db['ChatWebsite'][_0x8463('0x6c')]({'where':{'id':_0x2087f6['params']['id']}})['then'](handleEntityNotFound(_0x4e4744,null))['then'](saveUpdates(_0x2087f6['body'],null))[_0x8463('0x1a')](respondWithResult(_0x4e4744,null))[_0x8463('0x22')](handleError(_0x4e4744,null));};exports[_0x8463('0x81')]=function(_0x2127f7,_0x2e728c){_0x2127f7['body'][_0x8463('0x82')]=_0x2127f7[_0x8463('0x7f')]['filename'];return db[_0x8463('0x48')]['find']({'where':{'id':_0x2127f7[_0x8463('0x5f')]['id']}})[_0x8463('0x1a')](handleEntityNotFound(_0x2e728c,null))[_0x8463('0x1a')](saveUpdates(_0x2127f7['body'],null))['then'](respondWithResult(_0x2e728c,null))[_0x8463('0x22')](handleError(_0x2e728c,null));};exports[_0x8463('0x83')]=function(_0x59fe61,_0x3f3b85){_0x59fe61[_0x8463('0x66')][_0x8463('0x84')]=_0x59fe61['file'][_0x8463('0x80')];return db[_0x8463('0x48')]['find']({'where':{'id':_0x59fe61[_0x8463('0x5f')]['id']}})[_0x8463('0x1a')](handleEntityNotFound(_0x3f3b85,null))[_0x8463('0x1a')](saveUpdates(_0x59fe61[_0x8463('0x66')],null))[_0x8463('0x1a')](respondWithResult(_0x3f3b85,null))[_0x8463('0x22')](handleError(_0x3f3b85,null));};exports[_0x8463('0x85')]=function(_0x465105,_0x298d26){_0x465105[_0x8463('0x66')][_0x8463('0x86')]=_0x465105[_0x8463('0x7f')][_0x8463('0x80')];return db[_0x8463('0x48')][_0x8463('0x6c')]({'where':{'id':_0x465105[_0x8463('0x5f')]['id']}})[_0x8463('0x1a')](handleEntityNotFound(_0x298d26,null))['then'](saveUpdates(_0x465105[_0x8463('0x66')],null))[_0x8463('0x1a')](respondWithResult(_0x298d26,null))[_0x8463('0x22')](handleError(_0x298d26,null));};exports[_0x8463('0x87')]=function(_0x111381,_0x1bd3bd){var _0x5c792c=path['join'](config[_0x8463('0x88')],_0x8463('0x89'));var _0x238e26={'where':{'id':_0x111381[_0x8463('0x5f')]['id']},'attributes':['id',_0x8463('0x7e')],'raw':!![]};var _0x505544=![];return require('../../config/license/util')[_0x8463('0x8a')]()[_0x8463('0x1a')](function(_0x14b344){if(_0x14b344){_0x505544=_0x14b344[_0x8463('0x8b')];}})[_0x8463('0x1a')](function(){return db[_0x8463('0x48')][_0x8463('0x6c')](_0x238e26);})[_0x8463('0x1a')](handleEntityNotFound(_0x1bd3bd,null))[_0x8463('0x1a')](function(_0x4f39c9){if(_0x4f39c9){if(!_[_0x8463('0x8c')](_0x4f39c9['sitepic'])){if(fs['existsSync'](path['join'](config[_0x8463('0x88')],_0x8463('0x8d'),_0x4f39c9[_0x8463('0x7e')]))&&_0x505544){_0x5c792c=path[_0x8463('0x8e')](config[_0x8463('0x88')],_0x8463('0x8d'),_0x4f39c9[_0x8463('0x7e')]);}}return _0x1bd3bd[_0x8463('0x8f')](_0x5c792c);}})[_0x8463('0x22')](handleError(_0x1bd3bd,null));};exports[_0x8463('0x90')]=function(_0x463f89,_0x265688){var _0x44bef9=path[_0x8463('0x8e')](config[_0x8463('0x88')],_0x8463('0x91'));var _0x4cfcd5={'where':{'id':_0x463f89[_0x8463('0x5f')]['id']},'attributes':['id',_0x8463('0x82')],'raw':!![]};return db['ChatWebsite'][_0x8463('0x6c')](_0x4cfcd5)[_0x8463('0x1a')](handleEntityNotFound(_0x265688,null))['then'](function(_0x519405){if(_0x519405){if(!_['isNil'](_0x519405[_0x8463('0x82')])){if(fs['existsSync'](path['join'](config[_0x8463('0x88')],'server/files/images/avatars/',_0x519405['agentAvatar']))){_0x44bef9=path[_0x8463('0x8e')](config[_0x8463('0x88')],_0x8463('0x92'),_0x519405[_0x8463('0x82')]);}}return _0x265688[_0x8463('0x8f')](_0x44bef9);}})[_0x8463('0x22')](handleError(_0x265688,null));};exports['getCustomerAvatar']=function(_0x42ebd4,_0x4f6bd0){var _0x186672=path[_0x8463('0x8e')](config[_0x8463('0x88')],'server/files/images/avatars/customer_avatar.png');var _0x58fd5f={'where':{'id':_0x42ebd4[_0x8463('0x5f')]['id']},'attributes':['id',_0x8463('0x84'),_0x8463('0x93')],'raw':!![]};return db['ChatWebsite'][_0x8463('0x6c')](_0x58fd5f)[_0x8463('0x1a')](handleEntityNotFound(_0x4f6bd0,null))['then'](function(_0x449b34){if(_0x449b34){if(!_[_0x8463('0x8c')](_0x449b34['customerAvatar'])){if(fs[_0x8463('0x94')](path[_0x8463('0x8e')](config[_0x8463('0x88')],_0x8463('0x92'),_0x449b34[_0x8463('0x84')]))&&_0x449b34[_0x8463('0x93')]){_0x186672=path['join'](config[_0x8463('0x88')],'server/files/images/avatars/',_0x449b34[_0x8463('0x84')]);}}return _0x4f6bd0['download'](_0x186672);}})[_0x8463('0x22')](handleError(_0x4f6bd0,null));};exports['getSystemAvatar']=function(_0x3dcb4d,_0x19d0e9){var _0x544174=path[_0x8463('0x8e')](config['root'],_0x8463('0x95'));var _0x186013={'where':{'id':_0x3dcb4d[_0x8463('0x5f')]['id']},'attributes':['id',_0x8463('0x86')],'raw':!![]};return db[_0x8463('0x48')][_0x8463('0x6c')](_0x186013)['then'](handleEntityNotFound(_0x19d0e9,null))['then'](function(_0x1a65d4){if(_0x1a65d4){if(!_[_0x8463('0x8c')](_0x1a65d4[_0x8463('0x86')])){if(fs[_0x8463('0x94')](path[_0x8463('0x8e')](config[_0x8463('0x88')],'server/files/images/avatars/',_0x1a65d4['systemAvatar']))){_0x544174=path['join'](config[_0x8463('0x88')],'server/files/images/avatars/',_0x1a65d4[_0x8463('0x86')]);}}return _0x19d0e9['download'](_0x544174);}})[_0x8463('0x22')](handleError(_0x19d0e9,null));};function checkWebsiteInterval(_0x3d0e4a){var _0xde591a=_0x3d0e4a['Interval'];if(!_0xde591a){return Promise[_0x8463('0x96')](_0x3d0e4a);}var _0x20b191=_0x3d0e4a['timezone']||undefined;return _0xde591a[_0x8463('0x97')](_0x20b191)[_0x8463('0x1a')](function(_0x3daea0){if(!_0x3daea0){throw new APIOutOfIntervalError();}return _0x3d0e4a;});}exports[_0x8463('0x98')]=function(_0x49dcc0,_0x50d112){var _0x55ff55={'body':_0x49dcc0[_0x8463('0x66')],'channel':'chat'};var _0x5b6ef2=[];var _0x469efc=[];var _0x2cb5eb={};var _0x2a1ac9=![];if(_0x49dcc0[_0x8463('0x66')]['id']){delete _0x49dcc0[_0x8463('0x66')]['id'];}if(_[_0x8463('0x8c')](_0x49dcc0['body'][_0x8463('0x99')])){throw new APIBadRequestError(_0x8463('0x9a'));}if(_[_0x8463('0x8c')](_0x49dcc0[_0x8463('0x66')][_0x8463('0x9b')])){throw new APIBadRequestError(_0x8463('0x9c'));}if(_[_0x8463('0x9d')](_0x49dcc0[_0x8463('0x66')][_0x8463('0x66')])){throw new APIBadRequestError('Body\x20is\x20mandatory');}var _0x543962=_0x49dcc0['body'][_0x8463('0x33')]&&_0x49dcc0[_0x8463('0x66')][_0x8463('0x9e')];return db[_0x8463('0x9f')][_0x8463('0x72')]()[_0x8463('0x1a')](function(_0x4992d8){if(!_0x4992d8){throw new Error(_0x8463('0xa0'));}_0x5b6ef2=Object[_0x8463('0x4c')](_0x4992d8)[_0x8463('0x5a')](function(_0x212f87){return![_0x8463('0xa1'),_0x8463('0xa2')]['includes'](_0x212f87);});_0x469efc=Object[_0x8463('0x4c')](_0x4992d8)['filter'](function(_0x36a251){return![_0x8463('0xa1'),'updatedAt','CompanyId',_0x8463('0xa3')]['includes'](_0x36a251);});if(!_['includes'](_0x469efc,_0x49dcc0[_0x8463('0x66')]['mapKey'])){throw new APIBadRequestError(_0x8463('0xa4')+_0x469efc['join'](',\x20'));}_0x2cb5eb[_0x49dcc0[_0x8463('0x66')][_0x8463('0x9b')]]=_0x49dcc0['body'][_0x8463('0x99')];})[_0x8463('0x1a')](function(){return db[_0x8463('0x48')][_0x8463('0x6c')]({'where':{'id':_0x49dcc0[_0x8463('0x5f')]['id']},'include':[{'model':db[_0x8463('0xa5')],'as':'List','include':[{'model':db[_0x8463('0x9f')],'as':_0x8463('0xa6'),'where':_0x2cb5eb,'limit':0x1,'order':[[_0x8463('0xa2'),_0x8463('0xa7')]]}]},{'model':db[_0x8463('0xa8')],'as':_0x8463('0xa9')},{'model':db['Interval'],'as':'Interval','include':[{'model':db[_0x8463('0xaa')],'as':_0x8463('0xab'),'attributes':['id','interval'],'raw':!![]}]}]});})[_0x8463('0x1a')](function(_0x374364){if(!_0x374364){throw new APINotFoundError(util[_0x8463('0x3d')](_0x8463('0xac'),_0x49dcc0[_0x8463('0x5f')]['id']));}if(_0x543962){return checkWebsiteInterval(_0x374364);}return _0x374364;})[_0x8463('0x1a')](function(_0x2f5913){_0x55ff55['account']=_0x2f5913;_0x55ff55['applications']=_['orderBy'](_0x2f5913['Applications'],['priority'],[_0x8463('0xad')]);if(_0x55ff55[_0x8463('0xae')][_0x8463('0xa9')]){delete _0x55ff55[_0x8463('0xae')]['Applications'];}_0x55ff55['list']=_0x2f5913['List']||{'id':_0x2f5913['ListId']};if(_0x55ff55[_0x8463('0xaf')]&&_0x55ff55[_0x8463('0xaf')][_0x8463('0xa6')][_0x8463('0x51')]){return _0x55ff55['list']['Contacts'][0x0];}var _0x105b97=_[_0x8463('0x12')](_0x49dcc0['body'],{'firstName':_0x49dcc0[_0x8463('0x66')][_0x8463('0x99')],'ListId':_0x2f5913[_0x8463('0xa3')]});_0x105b97[_0x49dcc0[_0x8463('0x66')][_0x8463('0x9b')]]=_0x49dcc0[_0x8463('0x66')][_0x8463('0x99')];return db[_0x8463('0x9f')][_0x8463('0x61')](_0x105b97,{'fields':_0x5b6ef2,'raw':!![]});})[_0x8463('0x1a')](function(_0x51e77a){_0x55ff55[_0x8463('0xb0')]=_0x51e77a;var _0x2ae440=createInteractionObject(_0x49dcc0[_0x8463('0x5f')]['id'],_0x49dcc0['body'],_0x49dcc0[_0x8463('0xb1')],_0x51e77a);var _0x270a09={'ChatWebsiteId':_0x49dcc0[_0x8463('0x5f')]['id']};if(_0x49dcc0['body']['threadId']){_0x270a09[_0x8463('0xb2')]=_0x49dcc0[_0x8463('0x66')][_0x8463('0xb2')];_0x270a09[_0x8463('0xb3')]=![];return db[_0x8463('0xb4')][_0x8463('0x6c')]({'where':_0x270a09})[_0x8463('0x1a')](function(_0x2a5196){var _0x3667b7=_0x49dcc0[_0x8463('0x66')][_0x8463('0x33')]&&_0x49dcc0[_0x8463('0x66')]['referer'];if(_0x2a5196){_0x2a1ac9=!![];return _0x2a5196;}else if(!_0x3667b7&&_0x2a5196&&_0x2a5196[_0x8463('0xb3')]){throw new APIConflictError('Writing\x20on\x20closed\x20interaction');}_0x2ae440[_0x8463('0xb2')]=_0x49dcc0[_0x8463('0x66')][_0x8463('0xb2')];_0x2ae440[_0x8463('0xb5')]=_0x49dcc0[_0x8463('0x66')][_0x8463('0xb5')];return db[_0x8463('0xb4')][_0x8463('0x61')](_0x2ae440);});}_0x270a09['ContactId']=_0x51e77a['id'];if(_0x49dcc0[_0x8463('0x66')]['interaction']&&_0x49dcc0[_0x8463('0x66')][_0x8463('0xb6')]['id']){_0x270a09['id']=_0x49dcc0[_0x8463('0x66')][_0x8463('0xb6')]['id'];return db[_0x8463('0xb4')]['find']({'where':_0x270a09})[_0x8463('0x1a')](function(_0x4e83c8){var _0x369e0e=_0x49dcc0['body'][_0x8463('0x33')]&&_0x49dcc0[_0x8463('0x66')][_0x8463('0x9e')];if(!_0x369e0e&&_0x4e83c8&&_0x4e83c8['closed']){throw new APIConflictError('Writing\x20on\x20closed\x20interaction');}else if(_0x4e83c8){_0x2a1ac9=!![];return _0x4e83c8;}else{return db[_0x8463('0xb4')]['create'](_0x2ae440);}});}return db[_0x8463('0xb4')][_0x8463('0x61')](_0x2ae440);})[_0x8463('0x1a')](function(_0x3ee811){if(!_0x2a1ac9){return _0x3ee811;}var _0x2d0ba8={'from':(_0x55ff55[_0x8463('0xb0')][_0x8463('0xb7')]||'')+'\x20'+(_0x55ff55[_0x8463('0xb0')][_0x8463('0x38')]||'')};if(_0x49dcc0[_0x8463('0x66')]['threadId']&&_0x49dcc0[_0x8463('0x66')][_0x8463('0xb8')]&&_0x49dcc0[_0x8463('0x66')][_0x8463('0xb2')]!=_0x49dcc0['body']['messageId']){_0x2d0ba8[_0x8463('0xb2')]=_0x49dcc0[_0x8463('0x66')][_0x8463('0xb8')];}return _0x3ee811['update'](_0x2d0ba8);})[_0x8463('0x1a')](function(_0x535028){_0x55ff55[_0x8463('0xb6')]=_0x535028[_0x8463('0x2d')]({'plain':!![]});_0x55ff55[_0x8463('0xb6')]['created']=!_0x2a1ac9;if(_0x55ff55[_0x8463('0xb6')][_0x8463('0xb9')]){if(_0x55ff55['account'][_0x8463('0xba')]){_0x55ff55[_0x8463('0xbb')][_0x8463('0xbc')]({'id':0x0,'priority':_0x55ff55[_0x8463('0xbb')][_0x8463('0x51')]+0x1,'app':_0x8463('0xbd'),'appdata':_0x8463('0xbe'),'interval':_0x8463('0xbf')});}}return db[_0x8463('0xc0')]['create']({'body':_0x49dcc0[_0x8463('0x66')][_0x8463('0x66')],'ChatWebsiteId':_0x49dcc0[_0x8463('0x5f')]['id'],'ChatInteractionId':_0x535028['id'],'direction':'in','ContactId':_0x55ff55[_0x8463('0xb0')]['id'],'AttachmentId':_0x49dcc0[_0x8463('0x66')]['AttachmentId']});})[_0x8463('0x1a')](function(_0x57fb8f){_0x55ff55[_0x8463('0x20')]=_0x57fb8f;if(!_0x55ff55['interaction'][_0x8463('0xc1')]){return;}return db[_0x8463('0xc2')][_0x8463('0x6c')]({'attributes':['id',_0x8463('0x30')],'where':{'id':_0x55ff55[_0x8463('0xb6')]['UserId']}});})[_0x8463('0x1a')](function(_0x1b2a57){if(_0x1b2a57){_0x55ff55[_0x8463('0xbb')][_0x8463('0xc3')]({'id':0x0,'priority':0x0,'app':_0x8463('0xc4'),'appdata':_0x1b2a57[_0x8463('0x30')]+','+(_0x55ff55['account'][_0x8463('0xc5')]||0xa),'interval':_0x8463('0xbf')});_0x55ff55['forcedOwnership']=!![];}if(!_0x55ff55[_0x8463('0xb6')][_0x8463('0xc6')]){return;}return db[_0x8463('0xc7')][_0x8463('0x6c')]({'attributes':['id',_0x8463('0x30')],'where':{'id':_0x55ff55[_0x8463('0xb6')][_0x8463('0xc6')]}});})[_0x8463('0x1a')](function(_0x4528e3){if(_0x4528e3){_0x55ff55[_0x8463('0xbb')][_0x8463('0xc3')]({'id':0x0,'priority':0x1,'app':_0x8463('0xc8'),'appdata':_0x4528e3['name']+','+(_0x55ff55[_0x8463('0xae')][_0x8463('0xc9')]||0x12c),'interval':_0x8463('0xbf')});}return respondWithRpcPromise(_0x8463('0xca'),_0x8463('0xcb'),_0x55ff55);})[_0x8463('0x1a')](function(_0x27a0e6){respondWithRpcPromise(_0x8463('0xcc'),_0x8463('0xcc'),{'event':_0x8463('0x98'),'message':_0x27a0e6},client9002);return _0x27a0e6;})['then'](respondWithResult(_0x50d112,null))[_0x8463('0x22')](APIHandleError(_0x50d112));};exports[_0x8463('0xcd')]=function(_0xe14d85,_0x552a97){var _0x52003f,_0x41fbee,_0x1a6bed;var _0x3440c4=[];var _0xac7125={};var _0x1d8432=_0xe14d85[_0x8463('0xce')]||[];var _0x4538d7=[];var _0xc72e11;return db[_0x8463('0x9f')][_0x8463('0x72')]()['then'](function(_0x44d684){if(!_0x44d684){throw new db['Sequelize'][(_0x8463('0xcf'))]('no\x20available\x20attributes');}_0x3440c4=_['difference'](_[_0x8463('0x4c')](_0x44d684),[_0x8463('0xa1'),_0x8463('0xa2'),_0x8463('0xd0'),'ListId']);if(_0xe14d85[_0x8463('0x66')]['id']){delete _0xe14d85[_0x8463('0x66')]['id'];}if(_[_0x8463('0x8c')](_0xe14d85['body'][_0x8463('0x99')])){throw _0x552a97[_0x8463('0x24')](0x1f4)['send'](new db[(_0x8463('0xd1'))]['ValidationError']('from\x20is\x20mandatory'));}if(_['isNil'](_0xe14d85['body'][_0x8463('0x66')])||_0xe14d85['body'][_0x8463('0x66')]===''){throw _0x552a97[_0x8463('0x24')](0x1f4)['send'](new db[(_0x8463('0xd1'))][(_0x8463('0xcf'))]('body\x20is\x20mandatory\x20and\x20not\x20empty'));}if(_[_0x8463('0x8c')](_0xe14d85[_0x8463('0x66')][_0x8463('0xd2')])){throw _0x552a97[_0x8463('0x24')](0x1f4)[_0x8463('0xd3')](new db[(_0x8463('0xd1'))][(_0x8463('0xcf'))](_0x8463('0xd4')+_0x3440c4));}if(!_[_0x8463('0xd5')](_0x3440c4,_0xe14d85[_0x8463('0x66')][_0x8463('0xd2')])){throw _0x552a97['status'](0x1f4)['send'](new db[(_0x8463('0xd1'))][(_0x8463('0xcf'))]('mapKeyOffline\x20invalid,\x20please\x20use\x20one\x20of\x20these:\x20'+_0x3440c4));}_0xac7125[_0xe14d85['body'][_0x8463('0xd2')]]=_0xe14d85[_0x8463('0x66')]['from'];})['then'](function(){return db[_0x8463('0x48')]['find']({'where':{'id':_0xe14d85[_0x8463('0x5f')]['id']},'include':[{'model':db[_0x8463('0xa5')],'as':_0x8463('0xd6')},{'model':db[_0x8463('0xd7')],'as':'MailAccount'}]});})[_0x8463('0x1a')](handleEntityNotFound(_0x552a97,null))[_0x8463('0x1a')](function(_0x211d0e){if(_0x211d0e&&_0x211d0e['List']){_0x41fbee=_0x211d0e;var _0x5ba920=_[_0x8463('0x12')](_0xe14d85[_0x8463('0x66')],{'firstName':_0xe14d85[_0x8463('0x66')][_0x8463('0x99')],'phone':_0xe14d85[_0x8463('0x66')][_0x8463('0x99')],'ListId':_0x211d0e[_0x8463('0xa3')]});_0x5ba920[_0xe14d85[_0x8463('0x66')][_0x8463('0xd2')]]=_0xe14d85[_0x8463('0x66')][_0x8463('0x99')];return db[_0x8463('0x9f')][_0x8463('0xd8')]({'where':_0xac7125,'defaults':_0x5ba920});}})['spread'](function(_0x53953f){if(_0x53953f){_0x1a6bed=_0x53953f;var _0x864d0f=fs['readFileSync'](path['join'](config['root'],_0x8463('0xd9')),_0x8463('0xda'));var _0x32e2df=ejs['render'](_0x864d0f,{'body':_['toPairs'](_0xe14d85['body']['body']),'bodyTitle':_0x41fbee[_0x8463('0xdb')]});return db['ChatOfflineMessage']['create']({'body':_0x32e2df,'plainBody':htmlToText[_0x8463('0xdc')](_0x32e2df),'ContactId':_0x53953f['id'],'ChatWebsiteId':_0x41fbee['id']});}})['then'](function(_0x1973d8){_0xc72e11=_0x1973d8;if(_0x1d8432[_0x8463('0x51')]){var _0x438fcf=_0x1d8432[_0x8463('0x47')](function(_0x123f02){return{'name':_0x123f02[_0x8463('0xdd')],'basename':_0x123f02[_0x8463('0x80')],'type':_0x123f02[_0x8463('0xde')],'ChatOfflineMessageId':_0x1973d8['id']};});_0x4538d7=_0x438fcf[_0x8463('0x47')](_0x521646=>{var _0x33ed00={'filename':_0x521646[_0x8463('0x30')],'path':path[_0x8463('0x8e')](config[_0x8463('0x88')],_0x8463('0xdf'),_0x8463('0xce'),_0x8463('0xe0'),'offline-chat',_0x521646[_0x8463('0xe1')])};return _0x33ed00;});if(!_0x41fbee[_0x8463('0xe2')]){return db[_0x8463('0xe3')][_0x8463('0xe4')](function(_0x5aff00){return db[_0x8463('0xe5')]['bulkCreate'](_0x438fcf,{'transaction':_0x5aff00});});}}})[_0x8463('0x1a')](function(){if(_0xc72e11){_0x52003f=_0xc72e11;return db['MailAccount'][_0x8463('0x7a')]({'where':{'service':!![]},'include':[{'model':db[_0x8463('0xe6')],'as':_0x8463('0xe7'),'raw':!![],'include':[{'model':db['CloudProvider'],'as':_0x8463('0xe8'),'raw':!![]}]}]});}})[_0x8463('0x1a')](function(_0x517b48){if(_0x517b48&&_0x517b48[_0x8463('0xe7')]&&_0x41fbee[_0x8463('0xe9')]&&_0x41fbee[_0x8463('0xea')]){var _0x10fec6=_0x517b48['getSmtpOptions']();return respondWithRpcPromise('SendMail','sendMail',{'account':_0x10fec6,'message':{'from':util[_0x8463('0x3d')]('\x22%s\x22\x20<%s>',_0x517b48[_0x8463('0x30')],_0x517b48['email']||_0x517b48[_0x8463('0xe7')][_0x8463('0x67')]),'to':_0x41fbee[_0x8463('0xea')],'subject':_0x41fbee['offlineMessageSubject'],'html':_0x52003f[_0x8463('0x66')],'attachments':_0x4538d7}},client9003)[_0x8463('0x1a')](function(){return _0x52003f;})[_0x8463('0x22')](function(_0x2d4116){logger[_0x8463('0x1e')](_0x2d4116);});}})[_0x8463('0x1a')](function(){if(_0x41fbee&&_0x41fbee[_0x8463('0xe2')]&&_0x41fbee['MailAccountId']){var _0x427bae=[];if(_0x1d8432['length']){_0x427bae=_0x1d8432['map'](function(_0x493a72){return{'name':_0x493a72[_0x8463('0xdd')],'basename':_0x493a72[_0x8463('0x80')],'type':_0x493a72[_0x8463('0xde')],'ChatOfflineMessageId':_0xc72e11['id']};});}var _0xf2e73c;if(!_['isNil'](_0x41fbee[_0x8463('0xeb')])){var _0x2a5149=_[_0x8463('0x47')](_0xe14d85['body'],function(_0x2fea22){return _0x2fea22;});var _0x3a9751=_[_0x8463('0xec')](_0x2a5149)[0x0];var _0x29e076=_[_0x8463('0xed')](_0x3a9751,function(_0x5d3f45){return _0x5d3f45;});_0xf2e73c=_0x29e076[0x1][_0x41fbee[_0x8463('0xeb')]];}var _0x5dc7b8={'from':_0x1a6bed[_0x8463('0xee')],'firstName':_0x1a6bed[_0x8463('0xb7')],'lastName':_0x1a6bed[_0x8463('0x38')],'mapKey':_0x8463('0xee'),'message':{'from':_0x1a6bed[_0x8463('0xee')],'to':_0x41fbee['MailAccount']['email'],'cc':'','subject':_['isNil'](_0xf2e73c)?_0x41fbee[_0x8463('0xef')]:_0xf2e73c,'messageId':'','sentAt':new Date(),'attach':_0x427bae[_0x8463('0x51')],'attachments':_0x427bae,'originChannel':_0x8463('0xf0'),'ChatWebsiteId':_0x41fbee['id'],'ChatOfflineMessageId':_0x52003f['id'],'originTo':_0x41fbee['MailAccount'][_0x8463('0xee')]},'body':_0x52003f[_0x8463('0x66')]};var _0x4c3f20={'account':{'id':_0x41fbee[_0x8463('0xf1')]},'body':_0x5dc7b8,'log':'NotifyMailAccount'};return respondWithRpcPromise(_0x8463('0xf2'),_0x8463('0xf3'),_0x4c3f20,client9001)[_0x8463('0x1a')](function(){return _0x52003f;})[_0x8463('0x22')](function(_0x5b373c){logger['error'](_0x5b373c);});}return;})[_0x8463('0x1a')](function(){if(_0x52003f){return _0x52003f;}})[_0x8463('0x1a')](respondWithResult(_0x552a97,null))[_0x8463('0x22')](function(){for(var _0x12c443 of _0x1d8432){var _0x542216=path[_0x8463('0x8e')](config[_0x8463('0x88')],_0x8463('0xdf'),_0x8463('0xce'),'attachments',_0x8463('0xf4'),_0x12c443[_0x8463('0x80')]);fs_extra[_0x8463('0xf5')](_0x542216)['catch'](function(_0x59178f){logger[_0x8463('0x1e')](_0x8463('0xf6'),_0x542216,_0x59178f);});}});};exports[_0x8463('0xf7')]=function(_0x10400f,_0x311407){return db['ChatInteraction'][_0x8463('0x6c')]({'where':{'id':_0x10400f['params']['id']}})[_0x8463('0x1a')](handleEntityNotFound(_0x311407,null))[_0x8463('0x1a')](function(_0x8cf2c8){if(_0x8cf2c8){return _0x8cf2c8[_0x8463('0xf7')](_0x10400f['body'][_0x8463('0x78')],_[_0x8463('0xf8')](_0x10400f[_0x8463('0x66')],[_0x8463('0x78'),'id'])||{});}})[_0x8463('0x1a')](respondWithResult(_0x311407,null))[_0x8463('0x22')](handleError(_0x311407,null));};exports[_0x8463('0xf9')]=function(_0x39fa0b,_0x59ec98){var _0x21ede0={'raw':![],'where':{}};var _0x5ac2e0={};var _0x9aa157={'count':0x0,'rows':[]};return db[_0x8463('0x48')][_0x8463('0x7a')]({'where':{'id':_0x39fa0b[_0x8463('0x5f')]['id']}})[_0x8463('0x1a')](handleEntityNotFound(_0x59ec98,null))[_0x8463('0x1a')](function(_0x126cf7){if(_0x126cf7){_0x5ac2e0[_0x8463('0x40')]=_[_0x8463('0x4c')](db['ChatInteraction']['rawAttributes']);_0x5ac2e0[_0x8463('0x4b')]=_[_0x8463('0x4c')](_0x39fa0b[_0x8463('0x4b')]);_0x5ac2e0[_0x8463('0x4d')]=_[_0x8463('0x4e')](_0x5ac2e0['model'],_0x5ac2e0['query']);_0x21ede0['attributes']=_[_0x8463('0x4e')](_0x5ac2e0[_0x8463('0x40')],qs[_0x8463('0x50')](_0x39fa0b[_0x8463('0x4b')][_0x8463('0x50')]));_0x21ede0['attributes']=_0x21ede0[_0x8463('0x4f')][_0x8463('0x51')]?_0x21ede0[_0x8463('0x4f')]:_0x5ac2e0[_0x8463('0x40')];if(!_0x39fa0b[_0x8463('0x4b')][_0x8463('0x52')]('nolimit')){_0x21ede0[_0x8463('0x29')]=qs['limit'](_0x39fa0b[_0x8463('0x4b')]['limit']);_0x21ede0['offset']=qs[_0x8463('0x27')](_0x39fa0b[_0x8463('0x4b')][_0x8463('0x27')]);}_0x21ede0[_0x8463('0x54')]=qs[_0x8463('0x55')](_0x39fa0b[_0x8463('0x4b')][_0x8463('0x55')]);_0x21ede0[_0x8463('0x56')]=qs[_0x8463('0x4d')](_[_0x8463('0x57')](_0x39fa0b[_0x8463('0x4b')],_0x5ac2e0['filters']));_0x21ede0['where']['ChatWebsiteId']=_0x126cf7['id'];if(_0x39fa0b['query'][_0x8463('0x5a')]){_0x21ede0[_0x8463('0x56')]=_[_0x8463('0x58')](_0x21ede0[_0x8463('0x56')],{'$or':_[_0x8463('0x47')](_0x21ede0[_0x8463('0x4f')],function(_0x5b2daf){var _0x165a38={};_0x165a38[_0x5b2daf]={'$like':'%'+_0x39fa0b[_0x8463('0x4b')][_0x8463('0x5a')]+'%'};return _0x165a38;})});}_0x21ede0=_[_0x8463('0x58')]({},_0x21ede0,_0x39fa0b[_0x8463('0x5b')]);return db[_0x8463('0xb4')][_0x8463('0x2a')]({'where':_0x21ede0['where']})['then'](function(_0x2e8e26){_0x9aa157[_0x8463('0x2a')]=_0x2e8e26;if(_0x39fa0b[_0x8463('0x4b')][_0x8463('0x5c')]){_0x21ede0[_0x8463('0x60')]=[{'model':db[_0x8463('0x9f')],'as':_0x8463('0xfa'),'required':![]},{'model':db[_0x8463('0xc2')],'as':_0x8463('0xfb'),'attributes':[_0x8463('0x30'),_0x8463('0xfc'),_0x8463('0xfd')],'required':![]},{'model':db[_0x8463('0xfe')],'as':_0x8463('0xff'),'attributes':['id',_0x8463('0x30'),_0x8463('0x100')],'where':_0x39fa0b[_0x8463('0x4b')][_0x8463('0x101')]?{'id':_0x39fa0b[_0x8463('0x4b')][_0x8463('0x101')]}:undefined,'required':_0x39fa0b[_0x8463('0x4b')]['tag']?!![]:![]}];}return db[_0x8463('0xb4')][_0x8463('0x5d')](_0x21ede0);})[_0x8463('0x1a')](function(_0x750dbc){_0x9aa157['rows']=_0x750dbc;return _0x9aa157;});}})['then'](respondWithFilteredResult(_0x59ec98,_0x21ede0))[_0x8463('0x22')](handleError(_0x59ec98,null));};exports[_0x8463('0x102')]=function(_0x85531b,_0x4dff38){var _0xdf4358=0x0;var _0x445e51=0x0;var _0x4c8e7f=![];var _0x1c4924;var _0xac5cde;return db[_0x8463('0x48')][_0x8463('0x6c')]({'where':{'id':_0x85531b['params']['id']},'include':[{'model':db[_0x8463('0xaa')],'as':_0x8463('0xaa'),'include':[{'model':db[_0x8463('0xaa')],'as':_0x8463('0xab'),'attributes':['id','interval']}]}]})[_0x8463('0x1a')](handleEntityNotFound(_0x4dff38,null))[_0x8463('0x1a')](function(_0x42827c){if(_0x42827c){_0x1c4924=_0x42827c;return _0x42827c['getProactiveActions']({'raw':!![]});}})['then'](function(_0x46bf9c){if(_0x1c4924){if(_0x46bf9c){_0xac5cde=_0x46bf9c;}}return require(_0x8463('0x103'))[_0x8463('0x8a')]();})[_0x8463('0x1a')](function(_0x32dba8){if(_0x32dba8){_0x445e51=_0x32dba8[_0x8463('0x104')];_0x4c8e7f=_0x32dba8[_0x8463('0x8b')];}})[_0x8463('0x1a')](function(){return db[_0x8463('0xb4')]['count']({'where':{'closed':![]}});})[_0x8463('0x1a')](function(_0x2ebb3b){_0xdf4358=_0x2ebb3b;if(_0x445e51&&_0x2ebb3b>_0x445e51){return db[_0x8463('0x105')][_0x8463('0x7a')]({'where':{'id':0x1}})[_0x8463('0x1a')](function(_0xc3a7d3){if(_0xc3a7d3){_0xc3a7d3[_0x8463('0x106')](_0x8463('0x107'));}});}})[_0x8463('0x1a')](function(){var _0x4ec446=_0x1c4924['Interval'];var _0x5b4494=_0x1c4924[_0x8463('0x108')]||undefined;return _0x4ec446?_0x4ec446['ifTime'](_0x5b4494):!![];})[_0x8463('0x1a')](function(_0x215ee9){var _0x53e8c3=fs[_0x8463('0x109')](path[_0x8463('0x8e')](config[_0x8463('0x88')],_0x8463('0x10a')),_0x8463('0xda'));var _0xedab62='3.12.1';var _0x29f9d7=![];var _0x595669,_0x4ac310;if(_0x85531b[_0x8463('0xb1')][_0x8463('0x9e')]){_0x595669=new URL(_0x85531b[_0x8463('0xb1')][_0x8463('0x9e')])['origin'];}else if(_0x85531b[_0x8463('0xb1')]['origin']){_0x595669=new URL(_0x85531b[_0x8463('0xb1')][_0x8463('0x10b')])[_0x8463('0x10b')];}else{_0x595669=_0x8463('0x10c');}_0x4ac310=typeof _0x1c4924[_0x8463('0x62')][_0x8463('0x37')](',')[_0x8463('0x6c')](function(_0x244720){return wildcardUtils['testWebsiteWithWildcard'](_0x244720,_0x595669);})!==_0x8463('0x28');var _0xfd86fc={'chatVersion':_0xedab62,'chatWebsiteAddressOrigin':_0x4ac310?_0x595669:_0x1c4924['address'],'remote':_0x1c4924[_0x8463('0x10d')],'query':querystring[_0x8463('0x43')](_[_0x8463('0x58')](_0x1c4924['get']({'plain':!![]}),{'customerIp':_0x85531b[_0x8463('0xb1')][_0x8463('0x35')]||_0x85531b[_0x8463('0xb1')][_0x8463('0x10e')]||_0x85531b[_0x8463('0x10f')][_0x8463('0x110')]||_0x85531b['ip'],'referer':_0x85531b[_0x8463('0xb1')][_0x8463('0x9e')],'openedInteractions':_0xdf4358,'maxInteractions':_0x445e51,'virtual':_0x4c8e7f[_0x8463('0x104')],'online':_0x215ee9,'custom':_0x4c8e7f,'address':_0x4ac310?_0x595669:null}))[_0x8463('0x111')](/'/g,'\x5c\x27')};_0x4dff38[_0x8463('0xd3')](ejs[_0x8463('0x112')](Mustache[_0x8463('0x112')](_0x53e8c3,_0xfd86fc),{'proactiveActions':_0xac5cde,'alignment':_0x1c4924[_0x8463('0x113')],'verticalAlignment':_0x1c4924['verticalAlignment'],'div_color':_0x1c4924[_0x8463('0x100')],'labelText':_0x1c4924[_0x8463('0x114')],'text_color':_0x1c4924[_0x8463('0x115')],'text_button_color':_0x1c4924['textButtonColor'],'button_color':_0x1c4924['color_button'],'background_color':_0x1c4924[_0x8463('0x116')],'hideWhenOffline':_0x1c4924[_0x8463('0x117')],'intervalId':_0x1c4924[_0x8463('0x118')],'isDevelopment':_0x29f9d7,'chatVersion':_0xedab62}));})[_0x8463('0x22')](handleError(_0x4dff38,null));};exports[_0x8463('0x119')]=function(_0x2ec4d1,_0x390f9c){var _0x46e412=_0x2ec4d1['params']['id'];var _0x5d97ec=_0x2ec4d1[_0x8463('0x66')];var _0x91a3ba=0xc8;var _0x2eeaef=null;return db[_0x8463('0xe3')][_0x8463('0xe4')]({'isolationLevel':db['sequelize'][_0x8463('0x11a')][_0x8463('0x11b')][_0x8463('0x11c')]},function(_0x245aeb){return db[_0x8463('0x48')][_0x8463('0x7a')]({'where':{'id':_0x46e412},'transaction':_0x245aeb})[_0x8463('0x1a')](function(_0x544c22){if(_0x544c22){return db['ChatApplication'][_0x8463('0x71')]({'where':{'ChatWebsiteId':_0x46e412},'transaction':_0x245aeb})['then'](function(){var _0x3d7bd5=_[_0x8463('0x47')](_0x5d97ec,function(_0x5cc4dc){_0x5cc4dc[_0x8463('0x74')]=_0x46e412;return _0x5cc4dc;});return db[_0x8463('0xa8')][_0x8463('0x11d')](_0x3d7bd5,{'transaction':_0x245aeb});});}else{_0x91a3ba=0x194;_0x2eeaef=[];}});})[_0x8463('0x1a')](function(){if(_0x91a3ba!==0x194){return db[_0x8463('0xa8')][_0x8463('0x11e')]({'where':{'ChatWebsiteId':_0x46e412},'order':_0x8463('0x11f')})[_0x8463('0x1a')](function(_0x178e56){_0x2eeaef=_0x178e56;});}})[_0x8463('0x22')](function(_0x5d360f){_0x91a3ba=0x1f4;logger[_0x8463('0x1e')](_0x5d360f[_0x8463('0x2f')]);if(_0x5d360f[_0x8463('0x30')]){delete _0x5d360f[_0x8463('0x30')];}_0x2eeaef=_0x5d360f;})['finally'](function(){if(_0x2eeaef===null){_0x390f9c[_0x8463('0x23')](_0x91a3ba);}else{if(_0x91a3ba===0x1f4){_0x390f9c[_0x8463('0x24')](_0x91a3ba)[_0x8463('0xd3')](_0x2eeaef);}else{_0x390f9c[_0x8463('0x24')](_0x91a3ba)[_0x8463('0x26')](_0x2eeaef);}}});};exports[_0x8463('0x120')]=function(_0x49f865,_0x5efe5d){var _0x288464={};var _0x516a41={};var _0x117840;var _0x4f00df;return db[_0x8463('0x48')]['findOne']({'where':{'id':_0x49f865['params']['id']}})['then'](handleEntityNotFound(_0x5efe5d,null))['then'](function(_0x22bfe0){if(_0x22bfe0){_0x117840=_0x22bfe0;_0x516a41[_0x8463('0x40')]=_[_0x8463('0x4c')](db[_0x8463('0xa8')][_0x8463('0x49')]);_0x516a41[_0x8463('0x4b')]=_[_0x8463('0x4c')](_0x49f865[_0x8463('0x4b')]);_0x516a41[_0x8463('0x4d')]=_[_0x8463('0x4e')](_0x516a41['model'],_0x516a41[_0x8463('0x4b')]);_0x288464['attributes']=_[_0x8463('0x4e')](_0x516a41['model'],qs[_0x8463('0x50')](_0x49f865[_0x8463('0x4b')][_0x8463('0x50')]));_0x288464['attributes']=_0x288464['attributes'][_0x8463('0x51')]?_0x288464[_0x8463('0x4f')]:_0x516a41['model'];_0x288464[_0x8463('0x54')]=qs[_0x8463('0x55')](_0x49f865['query'][_0x8463('0x55')]);_0x288464[_0x8463('0x56')]=qs['filters'](_[_0x8463('0x57')](_0x49f865['query'],_0x516a41[_0x8463('0x4d')]));if(_0x49f865[_0x8463('0x4b')][_0x8463('0x5a')]){_0x288464[_0x8463('0x56')]=_[_0x8463('0x58')](_0x288464['where'],{'$or':_[_0x8463('0x47')](_0x288464['attributes'],function(_0xb8cc10){var _0x1e46b6={};_0x1e46b6[_0xb8cc10]={'$like':'%'+_0x49f865[_0x8463('0x4b')][_0x8463('0x5a')]+'%'};return _0x1e46b6;})});}_0x288464=_[_0x8463('0x58')]({},_0x288464,_0x49f865['options']);return _0x117840[_0x8463('0x120')](_0x288464);}})[_0x8463('0x1a')](function(_0x48291e){if(_0x48291e){_0x4f00df=_0x48291e['length'];if(!_0x49f865[_0x8463('0x4b')][_0x8463('0x52')](_0x8463('0x53'))){_0x288464[_0x8463('0x29')]=qs[_0x8463('0x29')](_0x49f865[_0x8463('0x4b')][_0x8463('0x29')]);_0x288464[_0x8463('0x27')]=qs[_0x8463('0x27')](_0x49f865[_0x8463('0x4b')][_0x8463('0x27')]);}return _0x117840[_0x8463('0x120')](_0x288464);}})['then'](function(_0x319f60){if(_0x319f60){return _0x319f60?{'count':_0x4f00df,'rows':_0x319f60}:null;}})[_0x8463('0x1a')](respondWithResult(_0x5efe5d,null))[_0x8463('0x22')](handleError(_0x5efe5d,null));};exports[_0x8463('0x121')]=function(_0x356ff0,_0x8b3022){return db['chatProactiveAction'][_0x8463('0x6c')]({'where':{'id':_0x356ff0[_0x8463('0x5f')]['id']}})[_0x8463('0x1a')](handleEntityNotFound(_0x8b3022,null))[_0x8463('0x1a')](function(_0x4aad1b){if(_0x4aad1b){return _0x4aad1b[_0x8463('0x121')](_0x356ff0[_0x8463('0x66')][_0x8463('0x78')],_[_0x8463('0xf8')](_0x356ff0[_0x8463('0x66')],[_0x8463('0x78'),'id'])||{});}})[_0x8463('0x1a')](respondWithResult(_0x8b3022,null))[_0x8463('0x22')](handleError(_0x8b3022,null));};exports[_0x8463('0x122')]=function(_0x2c198c,_0x17ff86){var _0x19601a={};var _0x4bf577={};var _0x2079a2;var _0xcc92b1;return db['ChatWebsite'][_0x8463('0x7a')]({'where':{'id':_0x2c198c[_0x8463('0x5f')]['id']}})[_0x8463('0x1a')](handleEntityNotFound(_0x17ff86,null))[_0x8463('0x1a')](function(_0x42c2ac){if(_0x42c2ac){_0x2079a2=_0x42c2ac;_0x4bf577[_0x8463('0x40')]=_['keys'](db[_0x8463('0x123')]['rawAttributes']);_0x4bf577[_0x8463('0x4b')]=_[_0x8463('0x4c')](_0x2c198c[_0x8463('0x4b')]);_0x4bf577['filters']=_[_0x8463('0x4e')](_0x4bf577['model'],_0x4bf577[_0x8463('0x4b')]);_0x19601a[_0x8463('0x4f')]=_['intersection'](_0x4bf577[_0x8463('0x40')],qs[_0x8463('0x50')](_0x2c198c[_0x8463('0x4b')][_0x8463('0x50')]));_0x19601a['attributes']=_0x19601a[_0x8463('0x4f')][_0x8463('0x51')]?_0x19601a[_0x8463('0x4f')]:_0x4bf577[_0x8463('0x40')];_0x19601a[_0x8463('0x54')]=qs['sort'](_0x2c198c[_0x8463('0x4b')][_0x8463('0x55')]);_0x19601a[_0x8463('0x56')]=qs[_0x8463('0x4d')](_[_0x8463('0x57')](_0x2c198c[_0x8463('0x4b')],_0x4bf577['filters']));if(_0x2c198c[_0x8463('0x4b')]['filter']){_0x19601a['where']=_[_0x8463('0x58')](_0x19601a[_0x8463('0x56')],{'$or':_[_0x8463('0x47')](_0x19601a[_0x8463('0x4f')],function(_0x5cc8c2){var _0x451573={};_0x451573[_0x5cc8c2]={'$like':'%'+_0x2c198c[_0x8463('0x4b')]['filter']+'%'};return _0x451573;})});}_0x19601a=_[_0x8463('0x58')]({},_0x19601a,_0x2c198c[_0x8463('0x5b')]);return _0x2079a2['getProactiveActions'](_0x19601a);}})[_0x8463('0x1a')](function(_0x5c83a6){if(_0x5c83a6){_0xcc92b1=_0x5c83a6['length'];if(!_0x2c198c[_0x8463('0x4b')][_0x8463('0x52')](_0x8463('0x53'))){_0x19601a[_0x8463('0x29')]=qs['limit'](_0x2c198c['query'][_0x8463('0x29')]);_0x19601a['offset']=qs[_0x8463('0x27')](_0x2c198c[_0x8463('0x4b')][_0x8463('0x27')]);}return _0x2079a2[_0x8463('0x122')](_0x19601a);}})['then'](function(_0x36a92b){if(_0x36a92b){return _0x36a92b?{'count':_0xcc92b1,'rows':_0x36a92b}:null;}})[_0x8463('0x1a')](respondWithResult(_0x17ff86,null))['catch'](handleError(_0x17ff86,null));};exports[_0x8463('0x124')]=function(_0x33417a,_0x3ee0b1){var _0x45b492=_0x33417a['query'][_0x8463('0x125')]===_0x8463('0x126')?_0x8463('0x127'):_0x8463('0x128');return db[_0x8463('0x48')]['find']({'attributes':['id',_0x45b492],'where':{'id':_0x33417a[_0x8463('0x5f')]['id']}})[_0x8463('0x1a')](handleEntityNotFound(_0x3ee0b1,null))['then'](function(_0x43cdc4){if(_0x43cdc4){var _0x3dbdef=_0x43cdc4[_0x45b492];var _0x4083b2=_0x3dbdef&&_0x3dbdef[_0x8463('0x129')]?_0x3dbdef[_0x8463('0x129')]:[];_0x3ee0b1[_0x8463('0xd3')]({'fromKey':_['isNil'](_0x3dbdef[_0x8463('0x12a')])?undefined:_0x3dbdef[_0x8463('0x12a')],'count':_0x4083b2[_0x8463('0x51')],'rows':_0x4083b2});}})[_0x8463('0x22')](handleError(_0x3ee0b1,null));};exports[_0x8463('0x12b')]=function(_0x5d3186,_0x56af29){var _0x4ae789={'raw':![],'where':{}};var _0x48d909={};var _0x515b18={'count':0x0,'rows':[]};return db[_0x8463('0x48')][_0x8463('0x7a')]({'where':{'id':_0x5d3186['params']['id']}})[_0x8463('0x1a')](handleEntityNotFound(_0x56af29,null))['then'](function(_0x52f1e2){if(_0x52f1e2){_0x48d909['model']=_['keys'](db[_0x8463('0x12c')][_0x8463('0x49')]);_0x48d909[_0x8463('0x4b')]=_[_0x8463('0x4c')](_0x5d3186[_0x8463('0x4b')]);_0x48d909['filters']=_[_0x8463('0x4e')](_0x48d909['model'],_0x48d909['query']);_0x4ae789[_0x8463('0x4f')]=_['intersection'](_0x48d909[_0x8463('0x40')],qs[_0x8463('0x50')](_0x5d3186[_0x8463('0x4b')][_0x8463('0x50')]));_0x4ae789[_0x8463('0x4f')]=_0x4ae789[_0x8463('0x4f')]['length']?_0x4ae789['attributes']:_0x48d909[_0x8463('0x40')];if(!_0x5d3186['query'][_0x8463('0x52')]('nolimit')){_0x4ae789[_0x8463('0x29')]=qs[_0x8463('0x29')](_0x5d3186[_0x8463('0x4b')][_0x8463('0x29')]);_0x4ae789['offset']=qs[_0x8463('0x27')](_0x5d3186['query'][_0x8463('0x27')]);}_0x4ae789[_0x8463('0x54')]=qs[_0x8463('0x55')](_0x5d3186[_0x8463('0x4b')]['sort']);_0x4ae789[_0x8463('0x56')]=qs[_0x8463('0x4d')](_[_0x8463('0x57')](_0x5d3186[_0x8463('0x4b')],_0x48d909[_0x8463('0x4d')]));_0x4ae789[_0x8463('0x56')][_0x8463('0x74')]=_0x52f1e2['id'];if(_0x5d3186[_0x8463('0x4b')][_0x8463('0x5a')]){_0x4ae789[_0x8463('0x56')]=_[_0x8463('0x58')](_0x4ae789['where'],{'$or':_[_0x8463('0x47')](_0x4ae789[_0x8463('0x4f')],function(_0x4d29e6){var _0x9a38a8={};_0x9a38a8[_0x4d29e6]={'$like':'%'+_0x5d3186[_0x8463('0x4b')]['filter']+'%'};return _0x9a38a8;})});}_0x4ae789=_[_0x8463('0x58')]({},_0x4ae789,_0x5d3186[_0x8463('0x5b')]);return db[_0x8463('0x12c')][_0x8463('0x2a')]({'where':_0x4ae789[_0x8463('0x56')]})[_0x8463('0x1a')](function(_0x2f3b8b){_0x515b18[_0x8463('0x2a')]=_0x2f3b8b;if(_0x5d3186[_0x8463('0x4b')][_0x8463('0x5c')]){_0x4ae789[_0x8463('0x60')]=[{'all':!![]}];}else{_0x4ae789[_0x8463('0x60')]=[{'model':db[_0x8463('0x9f')],'as':_0x8463('0xfa'),'required':![]},{'model':db['Attachment'],'as':'Attachments','required':![]}];}return db[_0x8463('0x12c')]['findAll'](_0x4ae789);})[_0x8463('0x1a')](function(_0xad2360){_0x515b18[_0x8463('0x5e')]=_0xad2360;return _0x515b18;});}})['then'](respondWithFilteredResult(_0x56af29,_0x4ae789))[_0x8463('0x22')](handleError(_0x56af29,null));};exports[_0x8463('0x12d')]=function(_0x2dc921,_0x51d420){return db[_0x8463('0x48')][_0x8463('0x6c')]({'where':{'id':_0x2dc921[_0x8463('0x5f')]['id']}})[_0x8463('0x1a')](handleEntityNotFound(_0x51d420,null))[_0x8463('0x1a')](function(_0x29a7c9){if(_0x29a7c9){return _0x29a7c9[_0x8463('0x12d')](_0x2dc921[_0x8463('0x66')]['ids'],_[_0x8463('0xf8')](_0x2dc921[_0x8463('0x66')],['ids','id'])||{})['spread'](function(_0x77daa7){for(var _0x386c49=0x0;_0x386c49<_0x2dc921[_0x8463('0x66')][_0x8463('0x78')][_0x8463('0x51')];_0x386c49+=0x1){socket[_0x8463('0x12e')](_0x8463('0x12f'),{'UserId':Number(_0x2dc921[_0x8463('0x66')]['ids'][_0x386c49]),'ChatWebsiteId':Number(_0x2dc921[_0x8463('0x5f')]['id'])});}return _0x77daa7;});}})[_0x8463('0x1a')](respondWithResult(_0x51d420,null))[_0x8463('0x22')](handleError(_0x51d420,null));};exports['removeAgents']=function(_0x6fe027,_0x5cb29e){return db[_0x8463('0x48')][_0x8463('0x6c')]({'where':{'id':_0x6fe027[_0x8463('0x5f')]['id']}})['then'](handleEntityNotFound(_0x5cb29e,null))[_0x8463('0x1a')](function(_0x25dd69){if(_0x25dd69){return _0x25dd69['removeAgents'](_0x6fe027[_0x8463('0x4b')][_0x8463('0x78')])[_0x8463('0x1a')](function(){if(_[_0x8463('0x130')](_0x6fe027['query']['ids'])){for(var _0x23c31c=0x0;_0x23c31c<_0x6fe027[_0x8463('0x4b')]['ids'][_0x8463('0x51')];_0x23c31c+=0x1){socket[_0x8463('0x12e')]('userChatWebsite:remove',{'UserId':Number(_0x6fe027[_0x8463('0x4b')]['ids'][_0x23c31c]),'ChatWebsiteId':Number(_0x6fe027['params']['id'])});}}else{socket[_0x8463('0x12e')](_0x8463('0x131'),{'UserId':Number(_0x6fe027[_0x8463('0x4b')][_0x8463('0x78')]),'ChatWebsiteId':Number(_0x6fe027['params']['id'])});}});}})[_0x8463('0x1a')](respondWithStatusCode(_0x5cb29e,null))[_0x8463('0x22')](handleError(_0x5cb29e,null));};exports[_0x8463('0x132')]=function(_0x5842c5,_0x46d2e9){var _0x310f2d={};var _0x1718c1={};var _0x500d35;var _0x4826d4;return db[_0x8463('0x48')]['findOne']({'where':{'id':_0x5842c5[_0x8463('0x5f')]['id']}})['then'](handleEntityNotFound(_0x46d2e9,null))[_0x8463('0x1a')](function(_0x1411dc){if(_0x1411dc){_0x500d35=_0x1411dc;_0x1718c1[_0x8463('0x40')]=_[_0x8463('0x4c')](db[_0x8463('0xc2')][_0x8463('0x49')]);_0x1718c1['query']=_[_0x8463('0x4c')](_0x5842c5[_0x8463('0x4b')]);_0x1718c1[_0x8463('0x4d')]=_[_0x8463('0x4e')](_0x1718c1[_0x8463('0x40')],_0x1718c1[_0x8463('0x4b')]);_0x310f2d['attributes']=_['intersection'](_0x1718c1[_0x8463('0x40')],qs[_0x8463('0x50')](_0x5842c5[_0x8463('0x4b')][_0x8463('0x50')]));_0x310f2d[_0x8463('0x4f')]=_0x310f2d['attributes'][_0x8463('0x51')]?_0x310f2d[_0x8463('0x4f')]:_0x1718c1['model'];_0x310f2d[_0x8463('0x54')]=qs[_0x8463('0x55')](_0x5842c5[_0x8463('0x4b')]['sort']);_0x310f2d[_0x8463('0x56')]=qs['filters'](_[_0x8463('0x57')](_0x5842c5[_0x8463('0x4b')],_0x1718c1[_0x8463('0x4d')]));if(_0x5842c5[_0x8463('0x4b')]['filter']){_0x310f2d[_0x8463('0x56')]=_[_0x8463('0x58')](_0x310f2d['where'],{'$or':_['map'](_0x310f2d[_0x8463('0x4f')],function(_0x3b17fe){var _0x3a2e5c={};_0x3a2e5c[_0x3b17fe]={'$like':'%'+_0x5842c5['query']['filter']+'%'};return _0x3a2e5c;})});}_0x310f2d=_[_0x8463('0x58')]({},_0x310f2d,_0x5842c5['options']);return _0x500d35['getAgents'](_0x310f2d);}})[_0x8463('0x1a')](function(_0x1371ff){if(_0x1371ff){_0x4826d4=_0x1371ff['length'];if(!_0x5842c5['query'][_0x8463('0x52')](_0x8463('0x53'))){_0x310f2d[_0x8463('0x29')]=qs[_0x8463('0x29')](_0x5842c5[_0x8463('0x4b')][_0x8463('0x29')]);_0x310f2d['offset']=qs[_0x8463('0x27')](_0x5842c5['query'][_0x8463('0x27')]);}return _0x500d35[_0x8463('0x132')](_0x310f2d);}})[_0x8463('0x1a')](function(_0x54f146){if(_0x54f146){return _0x54f146?{'count':_0x4826d4,'rows':_0x54f146}:null;}})[_0x8463('0x1a')](respondWithResult(_0x46d2e9,null))[_0x8463('0x22')](handleError(_0x46d2e9,null));}; \ No newline at end of file diff --git a/server/api/chatWebsite/chatWebsite.events.js b/server/api/chatWebsite/chatWebsite.events.js index 9c1a1ee..d2764d6 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 _0xf776=['exports','events','ChatWebsite','setMaxListeners','update','remove','emit','hasOwnProperty','hook'];(function(_0x14bf63,_0xdbd373){var _0x410d22=function(_0x2e5e3a){while(--_0x2e5e3a){_0x14bf63['push'](_0x14bf63['shift']());}};_0x410d22(++_0xdbd373);}(_0xf776,0x169));var _0x6f77=function(_0x5a5d66,_0x3056a4){_0x5a5d66=_0x5a5d66-0x0;var _0x43356d=_0xf776[_0x5a5d66];return _0x43356d;};'use strict';var EventEmitter=require(_0x6f77('0x0'));var ChatWebsite=require('../../mysqldb')['db'][_0x6f77('0x1')];var ChatWebsiteEvents=new EventEmitter();ChatWebsiteEvents[_0x6f77('0x2')](0x0);var events={'afterCreate':'save','afterUpdate':_0x6f77('0x3'),'afterDestroy':_0x6f77('0x4')};function emitEvent(_0x3897be){return function(_0x16874b,_0x53ec9b,_0xf025ec){ChatWebsiteEvents['emit'](_0x3897be+':'+_0x16874b['id'],_0x16874b);ChatWebsiteEvents[_0x6f77('0x5')](_0x3897be,_0x16874b);_0xf025ec(null);};}for(var e in events){if(events[_0x6f77('0x6')](e)){var event=events[e];ChatWebsite[_0x6f77('0x7')](e,emitEvent(event));}}module[_0x6f77('0x8')]=ChatWebsiteEvents; \ No newline at end of file +var _0x4a80=['setMaxListeners','update','remove','emit','hasOwnProperty','hook','events','ChatWebsite'];(function(_0x3e0b8f,_0x1cddeb){var _0x22f742=function(_0xacb1bc){while(--_0xacb1bc){_0x3e0b8f['push'](_0x3e0b8f['shift']());}};_0x22f742(++_0x1cddeb);}(_0x4a80,0xbe));var _0x04a8=function(_0x166af2,_0x310014){_0x166af2=_0x166af2-0x0;var _0x1a4b6c=_0x4a80[_0x166af2];return _0x1a4b6c;};'use strict';var EventEmitter=require(_0x04a8('0x0'));var ChatWebsite=require('../../mysqldb')['db'][_0x04a8('0x1')];var ChatWebsiteEvents=new EventEmitter();ChatWebsiteEvents[_0x04a8('0x2')](0x0);var events={'afterCreate':'save','afterUpdate':_0x04a8('0x3'),'afterDestroy':_0x04a8('0x4')};function emitEvent(_0x256369){return function(_0x1e36fc,_0x85c22,_0xde2f6a){ChatWebsiteEvents[_0x04a8('0x5')](_0x256369+':'+_0x1e36fc['id'],_0x1e36fc);ChatWebsiteEvents[_0x04a8('0x5')](_0x256369,_0x1e36fc);_0xde2f6a(null);};}for(var e in events){if(events[_0x04a8('0x6')](e)){var event=events[e];ChatWebsite[_0x04a8('0x7')](e,emitEvent(event));}}module['exports']=ChatWebsiteEvents; \ No newline at end of file diff --git a/server/api/chatWebsite/chatWebsite.model.js b/server/api/chatWebsite/chatWebsite.model.js index 1525bbc..a930a67 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 _0xa1dd=['lodash','util','../../config/logger','api','moment','path','rimraf','./chatWebsite.attributes','exports','define','ChatWebsite','chat_websites'];(function(_0x1434e5,_0x2fb082){var _0x2d797c=function(_0x2ccd94){while(--_0x2ccd94){_0x1434e5['push'](_0x1434e5['shift']());}};_0x2d797c(++_0x2fb082);}(_0xa1dd,0x18c));var _0xda1d=function(_0x1fee84,_0xad864c){_0x1fee84=_0x1fee84-0x0;var _0x3b99ab=_0xa1dd[_0x1fee84];return _0x3b99ab;};'use strict';var _=require(_0xda1d('0x0'));var util=require(_0xda1d('0x1'));var logger=require(_0xda1d('0x2'))(_0xda1d('0x3'));var moment=require(_0xda1d('0x4'));var BPromise=require('bluebird');var rp=require('request-promise');var fs=require('fs');var path=require(_0xda1d('0x5'));var rimraf=require(_0xda1d('0x6'));var config=require('../../config/environment');var attributes=require(_0xda1d('0x7'));module[_0xda1d('0x8')]=function(_0x3283b4,_0x3baffc){return _0x3283b4[_0xda1d('0x9')](_0xda1d('0xa'),attributes,{'tableName':_0xda1d('0xb'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0xc3a6=['rimraf','../../config/environment','./chatWebsite.attributes','exports','ChatWebsite','chat_websites','util','../../config/logger','api','moment','bluebird','request-promise'];(function(_0x976b30,_0x3ca2b7){var _0x292d92=function(_0x132bc4){while(--_0x132bc4){_0x976b30['push'](_0x976b30['shift']());}};_0x292d92(++_0x3ca2b7);}(_0xc3a6,0xae));var _0x6c3a=function(_0xa6b85f,_0x57c6f3){_0xa6b85f=_0xa6b85f-0x0;var _0x1267f3=_0xc3a6[_0xa6b85f];return _0x1267f3;};'use strict';var _=require('lodash');var util=require(_0x6c3a('0x0'));var logger=require(_0x6c3a('0x1'))(_0x6c3a('0x2'));var moment=require(_0x6c3a('0x3'));var BPromise=require(_0x6c3a('0x4'));var rp=require(_0x6c3a('0x5'));var fs=require('fs');var path=require('path');var rimraf=require(_0x6c3a('0x6'));var config=require(_0x6c3a('0x7'));var attributes=require(_0x6c3a('0x8'));module[_0x6c3a('0x9')]=function(_0x15744c,_0x454edc){return _0x15744c['define'](_0x6c3a('0xa'),attributes,{'tableName':_0x6c3a('0xb'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/chatWebsite/chatWebsite.rpc.js b/server/api/chatWebsite/chatWebsite.rpc.js index 461b40e..39f1ee6 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 _0x114c=['catch','lodash','util','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','../../config/environment','jayson/promise','client','http','redis','defaults','localhost','./chatWebsite.socket','then','ChatWebsite,\x20%s,\x20%s','debug','ChatWebsite,\x20%s,\x20%s,\x20%s','request\x20sent','stringify','error','code','message','info','result'];(function(_0x45783c,_0x49c56d){var _0x1161da=function(_0x3c5d41){while(--_0x3c5d41){_0x45783c['push'](_0x45783c['shift']());}};_0x1161da(++_0x49c56d);}(_0x114c,0xaf));var _0xc114=function(_0x38f289,_0x1741b4){_0x38f289=_0x38f289-0x0;var _0x5e0906=_0x114c[_0x38f289];return _0x5e0906;};'use strict';var _=require(_0xc114('0x0'));var util=require(_0xc114('0x1'));var moment=require(_0xc114('0x2'));var BPromise=require(_0xc114('0x3'));var rs=require(_0xc114('0x4'));var fs=require('fs');var Redis=require(_0xc114('0x5'));var db=require(_0xc114('0x6'))['db'];var utils=require(_0xc114('0x7'));var logger=require(_0xc114('0x8'))('rpc');var config=require(_0xc114('0x9'));var jayson=require(_0xc114('0xa'));var client=jayson[_0xc114('0xb')][_0xc114('0xc')]({'port':0x232a});config[_0xc114('0xd')]=_[_0xc114('0xe')](config['redis'],{'host':_0xc114('0xf'),'port':0x18eb});var socket=require('socket.io-emitter')(new Redis(config[_0xc114('0xd')]));require(_0xc114('0x10'))['register'](socket);function respondWithRpcPromise(_0x437585,_0x437502,_0x47d0a7){return new BPromise(function(_0x3751b0,_0x274ad5){return client['request'](_0x437585,_0x47d0a7)[_0xc114('0x11')](function(_0x22a8cd){logger['info'](_0xc114('0x12'),_0x437502,'request\x20sent');logger[_0xc114('0x13')](_0xc114('0x14'),_0x437502,_0xc114('0x15'),JSON[_0xc114('0x16')](_0x22a8cd));if(_0x22a8cd[_0xc114('0x17')]){if(_0x22a8cd['error'][_0xc114('0x18')]===0x1f4){logger[_0xc114('0x17')]('ChatWebsite,\x20%s,\x20%s',_0x437502,_0x22a8cd[_0xc114('0x17')][_0xc114('0x19')]);return _0x274ad5(_0x22a8cd[_0xc114('0x17')][_0xc114('0x19')]);}logger['error'](_0xc114('0x12'),_0x437502,_0x22a8cd[_0xc114('0x17')][_0xc114('0x19')]);return _0x3751b0(_0x22a8cd['error']['message']);}else{logger[_0xc114('0x1a')](_0xc114('0x12'),_0x437502,'request\x20sent');_0x3751b0(_0x22a8cd[_0xc114('0x1b')][_0xc114('0x19')]);}})[_0xc114('0x1c')](function(_0x5c7f20){logger['error'](_0xc114('0x12'),_0x437502,_0x5c7f20);_0x274ad5(_0x5c7f20);});});} \ No newline at end of file +var _0x091c=['rpc','jayson/promise','client','redis','defaults','register','request','info','ChatWebsite,\x20%s,\x20%s','request\x20sent','ChatWebsite,\x20%s,\x20%s,\x20%s','stringify','error','code','message','result','util','bluebird','randomstring','../../config/utils','../../config/logger'];(function(_0x123dca,_0x9f3fbd){var _0x48ccb0=function(_0x55651e){while(--_0x55651e){_0x123dca['push'](_0x123dca['shift']());}};_0x48ccb0(++_0x9f3fbd);}(_0x091c,0x14b));var _0xc091=function(_0x13e35a,_0x10906d){_0x13e35a=_0x13e35a-0x0;var _0x265502=_0x091c[_0x13e35a];return _0x265502;};'use strict';var _=require('lodash');var util=require(_0xc091('0x0'));var moment=require('moment');var BPromise=require(_0xc091('0x1'));var rs=require(_0xc091('0x2'));var fs=require('fs');var Redis=require('ioredis');var db=require('../../mysqldb')['db'];var utils=require(_0xc091('0x3'));var logger=require(_0xc091('0x4'))(_0xc091('0x5'));var config=require('../../config/environment');var jayson=require(_0xc091('0x6'));var client=jayson[_0xc091('0x7')]['http']({'port':0x232a});config[_0xc091('0x8')]=_[_0xc091('0x9')](config[_0xc091('0x8')],{'host':'localhost','port':0x18eb});var socket=require('socket.io-emitter')(new Redis(config[_0xc091('0x8')]));require('./chatWebsite.socket')[_0xc091('0xa')](socket);function respondWithRpcPromise(_0x39ccb0,_0x3b4641,_0x2fffb2){return new BPromise(function(_0x91e83e,_0x5421ad){return client[_0xc091('0xb')](_0x39ccb0,_0x2fffb2)['then'](function(_0x4c8d19){logger[_0xc091('0xc')](_0xc091('0xd'),_0x3b4641,_0xc091('0xe'));logger['debug'](_0xc091('0xf'),_0x3b4641,_0xc091('0xe'),JSON[_0xc091('0x10')](_0x4c8d19));if(_0x4c8d19[_0xc091('0x11')]){if(_0x4c8d19[_0xc091('0x11')][_0xc091('0x12')]===0x1f4){logger[_0xc091('0x11')](_0xc091('0xd'),_0x3b4641,_0x4c8d19[_0xc091('0x11')][_0xc091('0x13')]);return _0x5421ad(_0x4c8d19['error'][_0xc091('0x13')]);}logger['error']('ChatWebsite,\x20%s,\x20%s',_0x3b4641,_0x4c8d19['error'][_0xc091('0x13')]);return _0x91e83e(_0x4c8d19[_0xc091('0x11')]['message']);}else{logger[_0xc091('0xc')](_0xc091('0xd'),_0x3b4641,_0xc091('0xe'));_0x91e83e(_0x4c8d19[_0xc091('0x14')][_0xc091('0x13')]);}})['catch'](function(_0x21f7c5){logger['error'](_0xc091('0xd'),_0x3b4641,_0x21f7c5);_0x5421ad(_0x21f7c5);});});} \ No newline at end of file diff --git a/server/api/chatWebsite/chatWebsite.socket.js b/server/api/chatWebsite/chatWebsite.socket.js index 6841b05..d904a1c 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 _0x6359=['emit','length','chatWebsite:','./chatWebsite.events','save','remove','update'];(function(_0x2f4b4b,_0x5a41a5){var _0x29992b=function(_0xab68b6){while(--_0xab68b6){_0x2f4b4b['push'](_0x2f4b4b['shift']());}};_0x29992b(++_0x5a41a5);}(_0x6359,0x1a0));var _0x9635=function(_0xfae23b,_0x2be4ba){_0xfae23b=_0xfae23b-0x0;var _0x200640=_0x6359[_0xfae23b];return _0x200640;};'use strict';var ChatWebsiteEvents=require(_0x9635('0x0'));var events=[_0x9635('0x1'),_0x9635('0x2'),_0x9635('0x3')];function createListener(_0x590a1a,_0x5500c9){return function(_0x466eab){_0x5500c9[_0x9635('0x4')](_0x590a1a,_0x466eab);};}function removeListener(_0x48b1e3,_0x4e1862){return function(){ChatWebsiteEvents['removeListener'](_0x48b1e3,_0x4e1862);};}exports['register']=function(_0x1c6156){for(var _0x1e4e16=0x0,_0xe834ca=events[_0x9635('0x5')];_0x1e4e16<_0xe834ca;_0x1e4e16++){var _0x3a0494=events[_0x1e4e16];var _0x2af4e2=createListener(_0x9635('0x6')+_0x3a0494,_0x1c6156);ChatWebsiteEvents['on'](_0x3a0494,_0x2af4e2);}}; \ No newline at end of file +var _0xbd58=['register','length','chatWebsite:','save','remove','update','removeListener'];(function(_0x44c8da,_0x253cac){var _0x1eecf2=function(_0x4e9165){while(--_0x4e9165){_0x44c8da['push'](_0x44c8da['shift']());}};_0x1eecf2(++_0x253cac);}(_0xbd58,0x1df));var _0x8bd5=function(_0x3b8aab,_0x5237db){_0x3b8aab=_0x3b8aab-0x0;var _0x47e1ef=_0xbd58[_0x3b8aab];return _0x47e1ef;};'use strict';var ChatWebsiteEvents=require('./chatWebsite.events');var events=[_0x8bd5('0x0'),_0x8bd5('0x1'),_0x8bd5('0x2')];function createListener(_0xca3eb4,_0x1c19e1){return function(_0x351c80){_0x1c19e1['emit'](_0xca3eb4,_0x351c80);};}function removeListener(_0x1e463d,_0x597c3b){return function(){ChatWebsiteEvents[_0x8bd5('0x3')](_0x1e463d,_0x597c3b);};}exports[_0x8bd5('0x4')]=function(_0xdc22fb){for(var _0x28ff83=0x0,_0x480fda=events[_0x8bd5('0x5')];_0x28ff83<_0x480fda;_0x28ff83++){var _0x31cfa0=events[_0x28ff83];var _0x9dd5a8=createListener(_0x8bd5('0x6')+_0x31cfa0,_0xdc22fb);ChatWebsiteEvents['on'](_0x31cfa0,_0x9dd5a8);}}; \ No newline at end of file diff --git a/server/api/chatWebsite/helpers/wildcard-expressions.js b/server/api/chatWebsite/helpers/wildcard-expressions.js index 5478290..e1a1ad8 100644 --- a/server/api/chatWebsite/helpers/wildcard-expressions.js +++ b/server/api/chatWebsite/helpers/wildcard-expressions.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0xc113=['localhost','trim','([\x5cw]+)','exports','../../../utils/misc','escapeRegExp','url','URL','replace'];(function(_0x14add3,_0x13ce8d){var _0x4a174f=function(_0x2b3ed7){while(--_0x2b3ed7){_0x14add3['push'](_0x14add3['shift']());}};_0x4a174f(++_0x13ce8d);}(_0xc113,0x1ab));var _0x3c11=function(_0x4e5dc7,_0x5efaf4){_0x4e5dc7=_0x4e5dc7-0x0;var _0x2a8f01=_0xc113[_0x4e5dc7];return _0x2a8f01;};var escapeRegExp=require(_0x3c11('0x0'))[_0x3c11('0x1')];var URL=require(_0x3c11('0x2'))[_0x3c11('0x3')];function testWildcardValidity(_0x27a620){var _0x237e11=!![];try{new URL(_0x27a620[_0x3c11('0x4')]('*',_0x3c11('0x5')));}catch(_0x2286e4){_0x237e11=![];}return _0x237e11&&new RegExp(/(http(s)?):\/\/(\*|(((\*\.)+)?([a-zA-Z0-9\-_]+\.){0,}([a-zA-Z0-9\-_]+)))(:[\d]+)?\/?$/)['test'](_0x27a620);}function testWebsiteWithWildcard(_0x18d401,_0x2d9441){var _0x595e66;var _0x3dd753=escapeRegExp(_0x18d401[_0x3c11('0x6')]()[_0x3c11('0x4')](/\/$/,''))['replace']('\x5c*',_0x3c11('0x7'));try{new URL(_0x18d401['replace']('\x5c*','localhost'));_0x595e66=new RegExp(_0x3dd753)['test'](_0x2d9441);}catch(_0x7f14e6){_0x595e66=![];}return _0x595e66;}module[_0x3c11('0x8')]={'testWebsiteWithWildcard':testWebsiteWithWildcard,'testWildcardValidity':testWildcardValidity}; \ No newline at end of file +var _0xb7e2=['../../../utils/misc','url','replace','test','([\x5cw]+)','localhost','exports'];(function(_0x2f223b,_0x85f54d){var _0x2bc857=function(_0x5dcefb){while(--_0x5dcefb){_0x2f223b['push'](_0x2f223b['shift']());}};_0x2bc857(++_0x85f54d);}(_0xb7e2,0x103));var _0x2b7e=function(_0x49c992,_0x3b7dec){_0x49c992=_0x49c992-0x0;var _0x46c4f2=_0xb7e2[_0x49c992];return _0x46c4f2;};var escapeRegExp=require(_0x2b7e('0x0'))['escapeRegExp'];var URL=require(_0x2b7e('0x1'))['URL'];function testWildcardValidity(_0x3af4b6){var _0x5f5551=!![];try{new URL(_0x3af4b6[_0x2b7e('0x2')]('*','localhost'));}catch(_0x1c4c9d){_0x5f5551=![];}return _0x5f5551&&new RegExp(/(http(s)?):\/\/(\*|(((\*\.)+)?([a-zA-Z0-9\-_]+\.){0,}([a-zA-Z0-9\-_]+)))(:[\d]+)?\/?$/)[_0x2b7e('0x3')](_0x3af4b6);}function testWebsiteWithWildcard(_0x21ccc4,_0xa83e80){var _0x3d06ba;var _0x93733a=escapeRegExp(_0x21ccc4['trim']()[_0x2b7e('0x2')](/\/$/,''))[_0x2b7e('0x2')]('\x5c*',_0x2b7e('0x4'));try{new URL(_0x21ccc4['replace']('\x5c*',_0x2b7e('0x5')));_0x3d06ba=new RegExp(_0x93733a)[_0x2b7e('0x3')](_0xa83e80);}catch(_0x2f5991){_0x3d06ba=![];}return _0x3d06ba;}module[_0x2b7e('0x6')]={'testWebsiteWithWildcard':testWebsiteWithWildcard,'testWildcardValidity':testWildcardValidity}; \ No newline at end of file diff --git a/server/api/chatWebsite/index.js b/server/api/chatWebsite/index.js index 615e61d..310f466 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 _0xd4bf=['getAvatar','getCustomerAvatar','/:id/system_avatar','getSystemAvatar','/:id/interactions','getInteractions','getSnippet','/:id/applications','getApplications','/:id/proactive_actions','/:id/offline_messages','getOfflineMessages','/:id/users','post','addDisposition','addAnswer','diskStorage','join','root','format','%s-%s','now','single','file','server/files/images/avatars/','addAvatar','originalname','/:id/customer_avatar','addCustomerAvatar','addSystemAvatar','/:id/notify','notify','server/files','attachments','offline-chat','replace','/:id/offline','any','offline','addInteraction','addProactiveActions','addAgents','put','update','delete','destroy','removeDispositions','removeAnswers','removeAgents','exports','multer','express','fs-extra','../../components/auth/service','../../components/interaction/service','./chatWebsite.controller','get','isAuthenticated','index','describe','/:id','show','/:id/dispositions','getDispositions','/:id/canned_answers','/:id/logo','getLogo','/:id/avatar'];(function(_0x1c00c0,_0x4634b5){var _0x30a28f=function(_0x3c2d1c){while(--_0x3c2d1c){_0x1c00c0['push'](_0x1c00c0['shift']());}};_0x30a28f(++_0x4634b5);}(_0xd4bf,0x186));var _0xfd4b=function(_0x3b9e4e,_0x223bf6){_0x3b9e4e=_0x3b9e4e-0x0;var _0x4a78a5=_0xd4bf[_0x3b9e4e];return _0x4a78a5;};'use strict';var multer=require(_0xfd4b('0x0'));var util=require('util');var path=require('path');var timeout=require('connect-timeout');var express=require(_0xfd4b('0x1'));var router=express['Router']();var fs_extra=require(_0xfd4b('0x2'));var auth=require(_0xfd4b('0x3'));var interaction=require(_0xfd4b('0x4'));var config=require('../../config/environment');var controller=require(_0xfd4b('0x5'));router[_0xfd4b('0x6')]('/',auth[_0xfd4b('0x7')](),controller[_0xfd4b('0x8')]);router['get']('/describe',auth[_0xfd4b('0x7')](),controller[_0xfd4b('0x9')]);router[_0xfd4b('0x6')](_0xfd4b('0xa'),auth[_0xfd4b('0x7')](),controller[_0xfd4b('0xb')]);router['get'](_0xfd4b('0xc'),auth[_0xfd4b('0x7')](),controller[_0xfd4b('0xd')]);router[_0xfd4b('0x6')](_0xfd4b('0xe'),auth[_0xfd4b('0x7')](),controller['getAnswers']);router[_0xfd4b('0x6')](_0xfd4b('0xf'),controller[_0xfd4b('0x10')]);router[_0xfd4b('0x6')](_0xfd4b('0x11'),controller[_0xfd4b('0x12')]);router[_0xfd4b('0x6')]('/:id/customer_avatar',controller[_0xfd4b('0x13')]);router[_0xfd4b('0x6')](_0xfd4b('0x14'),controller[_0xfd4b('0x15')]);router[_0xfd4b('0x6')](_0xfd4b('0x16'),auth[_0xfd4b('0x7')](),controller[_0xfd4b('0x17')]);router[_0xfd4b('0x6')]('/:id/snippet',controller[_0xfd4b('0x18')]);router['get'](_0xfd4b('0x19'),auth[_0xfd4b('0x7')](),controller[_0xfd4b('0x1a')]);router[_0xfd4b('0x6')](_0xfd4b('0x1b'),auth[_0xfd4b('0x7')](),controller['getProactiveActions']);router['get']('/:id/fields',controller['getFields']);router[_0xfd4b('0x6')](_0xfd4b('0x1c'),auth['isAuthenticated'](),controller[_0xfd4b('0x1d')]);router['get'](_0xfd4b('0x1e'),auth[_0xfd4b('0x7')](),controller['getAgents']);router[_0xfd4b('0x1f')]('/',auth[_0xfd4b('0x7')](),controller['create']);router[_0xfd4b('0x1f')]('/:id/dispositions',auth[_0xfd4b('0x7')](),controller[_0xfd4b('0x20')]);router[_0xfd4b('0x1f')](_0xfd4b('0xe'),auth[_0xfd4b('0x7')](),controller[_0xfd4b('0x21')]);var upload=multer({'storage':multer[_0xfd4b('0x22')]({'destination':function(_0x14b388,_0x3e7aba,_0x10bfe4){_0x10bfe4(null,path[_0xfd4b('0x23')](config[_0xfd4b('0x24')],'server/files/images/logos/'));},'filename':function(_0xb4a952,_0x5b080c,_0xfbc908){_0xfbc908(null,util[_0xfd4b('0x25')](_0xfd4b('0x26'),Date[_0xfd4b('0x27')](),_0x5b080c['originalname']));}})});router[_0xfd4b('0x1f')](_0xfd4b('0xf'),upload[_0xfd4b('0x28')](_0xfd4b('0x29')),controller['addLogo']);var upload=multer({'storage':multer[_0xfd4b('0x22')]({'destination':function(_0x5f15a1,_0x5263a6,_0x4291e6){_0x4291e6(null,path['join'](config[_0xfd4b('0x24')],_0xfd4b('0x2a')));},'filename':function(_0x2fd525,_0x53ea2f,_0x4af4a1){_0x4af4a1(null,util[_0xfd4b('0x25')](_0xfd4b('0x26'),Date['now'](),_0x53ea2f['originalname']));}})});router[_0xfd4b('0x1f')](_0xfd4b('0x11'),upload[_0xfd4b('0x28')]('file'),controller[_0xfd4b('0x2b')]);var upload=multer({'storage':multer['diskStorage']({'destination':function(_0x163475,_0xa20a60,_0x5f4278){_0x5f4278(null,path[_0xfd4b('0x23')](config[_0xfd4b('0x24')],_0xfd4b('0x2a')));},'filename':function(_0x134103,_0x208766,_0x15f333){_0x15f333(null,util[_0xfd4b('0x25')](_0xfd4b('0x26'),Date['now'](),_0x208766[_0xfd4b('0x2c')]));}})});router[_0xfd4b('0x1f')](_0xfd4b('0x2d'),upload[_0xfd4b('0x28')](_0xfd4b('0x29')),controller[_0xfd4b('0x2e')]);var upload=multer({'storage':multer[_0xfd4b('0x22')]({'destination':function(_0x3fbbb5,_0x9a9ee0,_0x8966a){_0x8966a(null,path['join'](config[_0xfd4b('0x24')],_0xfd4b('0x2a')));},'filename':function(_0x157480,_0x5c44a8,_0x9d3379){_0x9d3379(null,util[_0xfd4b('0x25')](_0xfd4b('0x26'),Date[_0xfd4b('0x27')](),_0x5c44a8[_0xfd4b('0x2c')]));}})});router[_0xfd4b('0x1f')](_0xfd4b('0x14'),upload[_0xfd4b('0x28')](_0xfd4b('0x29')),controller[_0xfd4b('0x2f')]);router['post'](_0xfd4b('0x30'),controller[_0xfd4b('0x31')]);const offlineUploadMulter=multer({'storage':multer[_0xfd4b('0x22')]({'destination':function(_0x2a4d32,_0x7e4cb9,_0x47924d){const _0x48c4c2=path[_0xfd4b('0x23')](config[_0xfd4b('0x24')],_0xfd4b('0x32'),_0xfd4b('0x33'),_0xfd4b('0x34'));fs_extra['ensureDir'](_0x48c4c2,function(){_0x47924d(null,_0x48c4c2);});},'filename':function(_0x10393e,_0x3e61b0,_0x51c406){const _0x33a73d=_0x3e61b0[_0xfd4b('0x2c')][_0xfd4b('0x35')](/[+@&\/\\#,+()$~%'":*?<>{}\s\\|]/g,'-');const _0x39308b=path['extname'](_0x33a73d);const _0x2291a5=Date[_0xfd4b('0x27')]()+'-'+_0x33a73d[_0xfd4b('0x35')](_0x39308b,'')+_0x39308b;_0x51c406(null,_0x2291a5);}})});router[_0xfd4b('0x1f')](_0xfd4b('0x36'),offlineUploadMulter[_0xfd4b('0x37')](),controller[_0xfd4b('0x38')]);router[_0xfd4b('0x1f')](_0xfd4b('0x16'),auth['isAuthenticated'](),controller[_0xfd4b('0x39')]);router[_0xfd4b('0x1f')](_0xfd4b('0x19'),auth[_0xfd4b('0x7')](),controller['addApplications']);router[_0xfd4b('0x1f')](_0xfd4b('0x1b'),auth[_0xfd4b('0x7')](),controller[_0xfd4b('0x3a')]);router[_0xfd4b('0x1f')](_0xfd4b('0x1e'),auth[_0xfd4b('0x7')](),controller[_0xfd4b('0x3b')]);router[_0xfd4b('0x3c')](_0xfd4b('0xa'),auth[_0xfd4b('0x7')](),controller[_0xfd4b('0x3d')]);router[_0xfd4b('0x3e')](_0xfd4b('0xa'),auth[_0xfd4b('0x7')](),controller[_0xfd4b('0x3f')]);router[_0xfd4b('0x3e')](_0xfd4b('0xc'),auth['isAuthenticated'](),controller[_0xfd4b('0x40')]);router['delete']('/:id/canned_answers',auth[_0xfd4b('0x7')](),controller[_0xfd4b('0x41')]);router['delete'](_0xfd4b('0x1e'),auth[_0xfd4b('0x7')](),controller[_0xfd4b('0x42')]);module[_0xfd4b('0x43')]=router; \ No newline at end of file +var _0xfa31=['addDisposition','/:id/canned_answers','addAnswer','diskStorage','join','root','format','%s-%s','now','originalname','single','addLogo','server/files/images/avatars/','file','addCustomerAvatar','addSystemAvatar','/:id/notify','notify','server/files','attachments','ensureDir','replace','extname','/:id/offline','any','offline','addInteraction','addApplications','/:id/proactive_actions','addProactiveActions','addAgents','put','update','delete','destroy','removeDispositions','removeAnswers','removeAgents','exports','multer','util','path','connect-timeout','express','Router','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','./chatWebsite.controller','isAuthenticated','index','/describe','describe','/:id','show','/:id/dispositions','get','getLogo','/:id/avatar','getAvatar','/:id/customer_avatar','getCustomerAvatar','/:id/system_avatar','getSystemAvatar','/:id/interactions','/:id/snippet','getSnippet','/:id/applications','getApplications','getProactiveActions','/:id/fields','/:id/offline_messages','/:id/users','getAgents','post'];(function(_0x40b3da,_0x1e52a7){var _0x495898=function(_0x30749c){while(--_0x30749c){_0x40b3da['push'](_0x40b3da['shift']());}};_0x495898(++_0x1e52a7);}(_0xfa31,0x73));var _0x1fa3=function(_0x18ff34,_0x5d73b4){_0x18ff34=_0x18ff34-0x0;var _0x3cfaf9=_0xfa31[_0x18ff34];return _0x3cfaf9;};'use strict';var multer=require(_0x1fa3('0x0'));var util=require(_0x1fa3('0x1'));var path=require(_0x1fa3('0x2'));var timeout=require(_0x1fa3('0x3'));var express=require(_0x1fa3('0x4'));var router=express[_0x1fa3('0x5')]();var fs_extra=require(_0x1fa3('0x6'));var auth=require(_0x1fa3('0x7'));var interaction=require(_0x1fa3('0x8'));var config=require(_0x1fa3('0x9'));var controller=require(_0x1fa3('0xa'));router['get']('/',auth[_0x1fa3('0xb')](),controller[_0x1fa3('0xc')]);router['get'](_0x1fa3('0xd'),auth['isAuthenticated'](),controller[_0x1fa3('0xe')]);router['get'](_0x1fa3('0xf'),auth['isAuthenticated'](),controller[_0x1fa3('0x10')]);router['get'](_0x1fa3('0x11'),auth[_0x1fa3('0xb')](),controller['getDispositions']);router[_0x1fa3('0x12')]('/:id/canned_answers',auth[_0x1fa3('0xb')](),controller['getAnswers']);router['get']('/:id/logo',controller[_0x1fa3('0x13')]);router['get'](_0x1fa3('0x14'),controller[_0x1fa3('0x15')]);router[_0x1fa3('0x12')](_0x1fa3('0x16'),controller[_0x1fa3('0x17')]);router['get'](_0x1fa3('0x18'),controller[_0x1fa3('0x19')]);router[_0x1fa3('0x12')](_0x1fa3('0x1a'),auth[_0x1fa3('0xb')](),controller['getInteractions']);router[_0x1fa3('0x12')](_0x1fa3('0x1b'),controller[_0x1fa3('0x1c')]);router[_0x1fa3('0x12')](_0x1fa3('0x1d'),auth[_0x1fa3('0xb')](),controller[_0x1fa3('0x1e')]);router[_0x1fa3('0x12')]('/:id/proactive_actions',auth[_0x1fa3('0xb')](),controller[_0x1fa3('0x1f')]);router[_0x1fa3('0x12')](_0x1fa3('0x20'),controller['getFields']);router['get'](_0x1fa3('0x21'),auth['isAuthenticated'](),controller['getOfflineMessages']);router[_0x1fa3('0x12')](_0x1fa3('0x22'),auth['isAuthenticated'](),controller[_0x1fa3('0x23')]);router[_0x1fa3('0x24')]('/',auth[_0x1fa3('0xb')](),controller['create']);router[_0x1fa3('0x24')](_0x1fa3('0x11'),auth[_0x1fa3('0xb')](),controller[_0x1fa3('0x25')]);router[_0x1fa3('0x24')](_0x1fa3('0x26'),auth[_0x1fa3('0xb')](),controller[_0x1fa3('0x27')]);var upload=multer({'storage':multer[_0x1fa3('0x28')]({'destination':function(_0x45c006,_0x45a845,_0x3b1d94){_0x3b1d94(null,path[_0x1fa3('0x29')](config[_0x1fa3('0x2a')],'server/files/images/logos/'));},'filename':function(_0x3a3771,_0x58c153,_0x160583){_0x160583(null,util[_0x1fa3('0x2b')](_0x1fa3('0x2c'),Date[_0x1fa3('0x2d')](),_0x58c153[_0x1fa3('0x2e')]));}})});router[_0x1fa3('0x24')]('/:id/logo',upload[_0x1fa3('0x2f')]('file'),controller[_0x1fa3('0x30')]);var upload=multer({'storage':multer[_0x1fa3('0x28')]({'destination':function(_0x2f53d4,_0x5b9ee0,_0x888d96){_0x888d96(null,path['join'](config[_0x1fa3('0x2a')],_0x1fa3('0x31')));},'filename':function(_0x2ec7df,_0x142014,_0x5c7c75){_0x5c7c75(null,util[_0x1fa3('0x2b')]('%s-%s',Date[_0x1fa3('0x2d')](),_0x142014[_0x1fa3('0x2e')]));}})});router['post'](_0x1fa3('0x14'),upload[_0x1fa3('0x2f')](_0x1fa3('0x32')),controller['addAvatar']);var upload=multer({'storage':multer[_0x1fa3('0x28')]({'destination':function(_0x2ed0b8,_0x31637a,_0x47b9e0){_0x47b9e0(null,path[_0x1fa3('0x29')](config[_0x1fa3('0x2a')],_0x1fa3('0x31')));},'filename':function(_0x4c9378,_0x58ad90,_0x2fe939){_0x2fe939(null,util[_0x1fa3('0x2b')]('%s-%s',Date[_0x1fa3('0x2d')](),_0x58ad90['originalname']));}})});router[_0x1fa3('0x24')](_0x1fa3('0x16'),upload[_0x1fa3('0x2f')](_0x1fa3('0x32')),controller[_0x1fa3('0x33')]);var upload=multer({'storage':multer[_0x1fa3('0x28')]({'destination':function(_0x5c3105,_0x41b41a,_0x531ace){_0x531ace(null,path[_0x1fa3('0x29')](config['root'],_0x1fa3('0x31')));},'filename':function(_0x5afc45,_0x1a3e1b,_0xffc555){_0xffc555(null,util[_0x1fa3('0x2b')](_0x1fa3('0x2c'),Date[_0x1fa3('0x2d')](),_0x1a3e1b[_0x1fa3('0x2e')]));}})});router[_0x1fa3('0x24')]('/:id/system_avatar',upload[_0x1fa3('0x2f')](_0x1fa3('0x32')),controller[_0x1fa3('0x34')]);router[_0x1fa3('0x24')](_0x1fa3('0x35'),controller[_0x1fa3('0x36')]);const offlineUploadMulter=multer({'storage':multer[_0x1fa3('0x28')]({'destination':function(_0x5d992e,_0x3734d9,_0x2a11ad){const _0x249d7f=path['join'](config[_0x1fa3('0x2a')],_0x1fa3('0x37'),_0x1fa3('0x38'),'offline-chat');fs_extra[_0x1fa3('0x39')](_0x249d7f,function(){_0x2a11ad(null,_0x249d7f);});},'filename':function(_0x54832b,_0x159605,_0x46f777){const _0x195630=_0x159605[_0x1fa3('0x2e')][_0x1fa3('0x3a')](/[+@&\/\\#,+()$~%'":*?<>{}\s\\|]/g,'-');const _0xa04203=path[_0x1fa3('0x3b')](_0x195630);const _0x23a77a=Date[_0x1fa3('0x2d')]()+'-'+_0x195630[_0x1fa3('0x3a')](_0xa04203,'')+_0xa04203;_0x46f777(null,_0x23a77a);}})});router[_0x1fa3('0x24')](_0x1fa3('0x3c'),offlineUploadMulter[_0x1fa3('0x3d')](),controller[_0x1fa3('0x3e')]);router[_0x1fa3('0x24')](_0x1fa3('0x1a'),auth[_0x1fa3('0xb')](),controller[_0x1fa3('0x3f')]);router[_0x1fa3('0x24')](_0x1fa3('0x1d'),auth[_0x1fa3('0xb')](),controller[_0x1fa3('0x40')]);router[_0x1fa3('0x24')](_0x1fa3('0x41'),auth[_0x1fa3('0xb')](),controller[_0x1fa3('0x42')]);router[_0x1fa3('0x24')](_0x1fa3('0x22'),auth[_0x1fa3('0xb')](),controller[_0x1fa3('0x43')]);router[_0x1fa3('0x44')](_0x1fa3('0xf'),auth[_0x1fa3('0xb')](),controller[_0x1fa3('0x45')]);router[_0x1fa3('0x46')](_0x1fa3('0xf'),auth[_0x1fa3('0xb')](),controller[_0x1fa3('0x47')]);router[_0x1fa3('0x46')](_0x1fa3('0x11'),auth[_0x1fa3('0xb')](),controller[_0x1fa3('0x48')]);router[_0x1fa3('0x46')](_0x1fa3('0x26'),auth[_0x1fa3('0xb')](),controller[_0x1fa3('0x49')]);router['delete']('/:id/users',auth[_0x1fa3('0xb')](),controller[_0x1fa3('0x4a')]);module[_0x1fa3('0x4b')]=router; \ No newline at end of file diff --git a/server/api/client-side-logs.js b/server/api/client-side-logs.js index 916969a..6e2e0ef 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 _0x9923=['Client-Side\x20logger\x20not\x20found!','/client-logs','use','isAuthenticated','express','../components/auth/service','../config/environment','production','app','get','client-side-logger'];(function(_0x21233e,_0x2d39c1){var _0x3752c9=function(_0x1201f3){while(--_0x1201f3){_0x21233e['push'](_0x21233e['shift']());}};_0x3752c9(++_0x2d39c1);}(_0x9923,0x164));var _0x3992=function(_0x20fb02,_0x96c029){_0x20fb02=_0x20fb02-0x0;var _0x24a33e=_0x9923[_0x20fb02];return _0x24a33e;};var beaverLogger=require('beaver-logger/server');var express=require(_0x3992('0x0'));var auth=require(_0x3992('0x1'));var config=require(_0x3992('0x2'));var router=express['Router']();var isProduction=config['env']===_0x3992('0x3')||![];function clientSideLogs(_0x1f8160,_0x45d981,_0x312f2f){var _0x34eced=_0x1f8160[_0x3992('0x4')][_0x3992('0x5')](_0x3992('0x6'));if(!_0x34eced){throw new Error(_0x3992('0x7'));}return beaverLogger['expressEndpoint']({'uri':_0x3992('0x8'),'logger':_0x34eced,'enableCors':!isProduction})(_0x1f8160,_0x45d981,_0x312f2f);}router[_0x3992('0x9')](auth[_0x3992('0xa')](),clientSideLogs);module['exports']=router; \ No newline at end of file +var _0x0800=['get','expressEndpoint','/client-logs','express','../components/auth/service','env','production'];(function(_0x20ee9c,_0x175f5f){var _0x23a3b6=function(_0x228ec0){while(--_0x228ec0){_0x20ee9c['push'](_0x20ee9c['shift']());}};_0x23a3b6(++_0x175f5f);}(_0x0800,0x1c3));var _0x0080=function(_0x5ecef8,_0x227d5c){_0x5ecef8=_0x5ecef8-0x0;var _0x30bce1=_0x0800[_0x5ecef8];return _0x30bce1;};var beaverLogger=require('beaver-logger/server');var express=require(_0x0080('0x0'));var auth=require(_0x0080('0x1'));var config=require('../config/environment');var router=express['Router']();var isProduction=config[_0x0080('0x2')]===_0x0080('0x3')||![];function clientSideLogs(_0x4ac9b2,_0x3fdf3b,_0x9e66fb){var _0x286df4=_0x4ac9b2['app'][_0x0080('0x4')]('client-side-logger');if(!_0x286df4){throw new Error('Client-Side\x20logger\x20not\x20found!');}return beaverLogger[_0x0080('0x5')]({'uri':_0x0080('0x6'),'logger':_0x286df4,'enableCors':!isProduction})(_0x4ac9b2,_0x3fdf3b,_0x9e66fb);}router['use'](auth['isAuthenticated'](),clientSideLogs);module['exports']=router; \ No newline at end of file diff --git a/server/api/cloudProvider/cloudProvider.attributes.js b/server/api/cloudProvider/cloudProvider.attributes.js index 33ffaf8..54e7858 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 _0x0045=['MicrosoftAzure\x20=>\x20client_secret','MicrosoftAzure\x20=>\x20redirect_uri','TEXT','MicrosoftAzure\x20=>\x20Dynamics365\x20=>\x20remote_uri','sequelize','exports','STRING','ENUM','AmazonAWS','Google','MicrosoftAzure','Outlook365','MicrosoftAzure\x20=>\x20client_id','MicrosoftAzure\x20=>\x20tenant'];(function(_0x73f87f,_0x2eb5c5){var _0x11899b=function(_0x5b2560){while(--_0x5b2560){_0x73f87f['push'](_0x73f87f['shift']());}};_0x11899b(++_0x2eb5c5);}(_0x0045,0x154));var _0x5004=function(_0x19950b,_0x53d0d7){_0x19950b=_0x19950b-0x0;var _0x3c6b41=_0x0045[_0x19950b];return _0x3c6b41;};'use strict';var Sequelize=require(_0x5004('0x0'));module[_0x5004('0x1')]={'name':{'type':Sequelize[_0x5004('0x2')],'allowNull':![],'validate':{'notEmpty':!![]}},'service':{'type':Sequelize[_0x5004('0x3')](_0x5004('0x4'),_0x5004('0x5'),_0x5004('0x6')),'allowNull':![],'validate':{'notEmpty':!![]}},'type':{'type':Sequelize[_0x5004('0x3')](_0x5004('0x7'),'Dynamics365')},'data1':{'type':Sequelize[_0x5004('0x2')],'comment':_0x5004('0x8')},'data2':{'type':Sequelize[_0x5004('0x2')],'comment':_0x5004('0x9')},'data3':{'type':Sequelize[_0x5004('0x2')],'comment':_0x5004('0xa')},'data4':{'type':Sequelize[_0x5004('0x2')],'comment':_0x5004('0xb')},'data5':{'type':Sequelize['TEXT'],'comment':'MicrosoftAzure\x20=>\x20access_token'},'data6':{'type':Sequelize[_0x5004('0xc')],'comment':'MicrosoftAzure\x20=>\x20refresh_token'},'data7':{'type':Sequelize[_0x5004('0xc')],'comment':_0x5004('0xd')}}; \ No newline at end of file +var _0x5b4f=['STRING','AmazonAWS','Google','MicrosoftAzure','ENUM','Outlook365','Dynamics365','MicrosoftAzure\x20=>\x20client_id','MicrosoftAzure\x20=>\x20client_secret','MicrosoftAzure\x20=>\x20redirect_uri','TEXT','MicrosoftAzure\x20=>\x20access_token','MicrosoftAzure\x20=>\x20refresh_token','MicrosoftAzure\x20=>\x20Dynamics365\x20=>\x20remote_uri','sequelize'];(function(_0x2d88db,_0x15f604){var _0x3e0480=function(_0x186f6a){while(--_0x186f6a){_0x2d88db['push'](_0x2d88db['shift']());}};_0x3e0480(++_0x15f604);}(_0x5b4f,0xfe));var _0xf5b4=function(_0x2a6809,_0x44edde){_0x2a6809=_0x2a6809-0x0;var _0x11c371=_0x5b4f[_0x2a6809];return _0x11c371;};'use strict';var Sequelize=require(_0xf5b4('0x0'));module['exports']={'name':{'type':Sequelize[_0xf5b4('0x1')],'allowNull':![],'validate':{'notEmpty':!![]}},'service':{'type':Sequelize['ENUM'](_0xf5b4('0x2'),_0xf5b4('0x3'),_0xf5b4('0x4')),'allowNull':![],'validate':{'notEmpty':!![]}},'type':{'type':Sequelize[_0xf5b4('0x5')](_0xf5b4('0x6'),_0xf5b4('0x7'))},'data1':{'type':Sequelize['STRING'],'comment':_0xf5b4('0x8')},'data2':{'type':Sequelize[_0xf5b4('0x1')],'comment':'MicrosoftAzure\x20=>\x20tenant'},'data3':{'type':Sequelize[_0xf5b4('0x1')],'comment':_0xf5b4('0x9')},'data4':{'type':Sequelize[_0xf5b4('0x1')],'comment':_0xf5b4('0xa')},'data5':{'type':Sequelize[_0xf5b4('0xb')],'comment':_0xf5b4('0xc')},'data6':{'type':Sequelize[_0xf5b4('0xb')],'comment':_0xf5b4('0xd')},'data7':{'type':Sequelize['TEXT'],'comment':_0xf5b4('0xe')}}; \ No newline at end of file diff --git a/server/api/cloudProvider/cloudProvider.controller.js b/server/api/cloudProvider/cloudProvider.controller.js index e6563ef..f5c380b 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 _0x9a44=['values','includes','Invalid\x20service\x20parameter.\x20Allowed\x20values:\x20','join','encryptString','findOne','user','Invalid\x20state\x20parameter','from','state','base64','parse','id_token','oauth2Claims','Unable\x20to\x20validate\x20id_token','del','getOauth2MicrosoftAccessToken','code','data5','data6','emit','microsoftAuthorization:success','microsoftAuthorization:error','Invalid\x20authentication\x20state\x20parameter','message','stringify','lodash','../../components/parsers/qs','../../config/logger','api','../../mysqldb','./cloudProvider.oauth','defaults','redis','localhost','status','end','json','offset','undefined','limit','count','update','then','sendStatus','error','name','send','padEnd','slice','index','map','CloudProvider','rawAttributes','fieldName','type','key','model','query','intersection','attributes','fields','length','hasOwnProperty','nolimit','order','sort','where','filters','pick','filter','VIRTUAL','merge','includeAll','include','rows','service','decryptString','catch','params','keys','options','MicrosoftAzure','data3','create','body','Name\x20parameter\x20not\x20specified','Service\x20parameter\x20not\x20specified'];(function(_0x40fe6b,_0x15d928){var _0x143aa8=function(_0x40a032){while(--_0x40a032){_0x40fe6b['push'](_0x40fe6b['shift']());}};_0x143aa8(++_0x15d928);}(_0x9a44,0x72));var _0x49a4=function(_0x4087f5,_0x378261){_0x4087f5=_0x4087f5-0x0;var _0x23eb2b=_0x9a44[_0x4087f5];return _0x23eb2b;};'use strict';var _=require(_0x49a4('0x0'));var Redis=require('ioredis');var qs=require(_0x49a4('0x1'));var encryptor=require('../../components/encryptor');var config=require('../../config/environment');var logger=require(_0x49a4('0x2'))(_0x49a4('0x3'));var db=require(_0x49a4('0x4'))['db'];var oauth=require(_0x49a4('0x5'));config['redis']=_[_0x49a4('0x6')](config[_0x49a4('0x7')],{'host':_0x49a4('0x8'),'port':0x18eb});var socket=require('socket.io-emitter')(new Redis(config[_0x49a4('0x7')]));var redis=new Redis(config[_0x49a4('0x7')]);function respondWithStatusCode(_0x1a3c9c,_0x4f17a7){_0x4f17a7=_0x4f17a7||0xcc;return function(_0x280012){if(_0x280012){return _0x1a3c9c['sendStatus'](_0x4f17a7);}return _0x1a3c9c[_0x49a4('0x9')](_0x4f17a7)[_0x49a4('0xa')]();};}function respondWithResult(_0x33ea7e,_0x5ec409){_0x5ec409=_0x5ec409||0xc8;return function(_0x37ff45){if(_0x37ff45){return _0x33ea7e['status'](_0x5ec409)[_0x49a4('0xb')](_0x37ff45);}};}function respondWithFilteredResult(_0x2666a0,_0x52dfc8){return function(_0x9005e3){if(_0x9005e3){var _0x72fb1e=typeof _0x52dfc8[_0x49a4('0xc')]===_0x49a4('0xd')&&typeof _0x52dfc8[_0x49a4('0xe')]===_0x49a4('0xd');var _0x47085c=_0x9005e3[_0x49a4('0xf')];var _0x8bbb11=_0x72fb1e?0x0:_0x52dfc8[_0x49a4('0xc')];var _0x152cb8=_0x72fb1e?_0x9005e3[_0x49a4('0xf')]:_0x52dfc8[_0x49a4('0xc')]+_0x52dfc8['limit'];var _0x58315d;if(_0x152cb8>=_0x47085c){_0x152cb8=_0x47085c;_0x58315d=0xc8;}else{_0x58315d=0xce;}_0x2666a0[_0x49a4('0x9')](_0x58315d);return _0x2666a0['set']('Content-Range',_0x8bbb11+'-'+_0x152cb8+'/'+_0x47085c)[_0x49a4('0xb')](_0x9005e3);}return null;};}function saveUpdates(_0x417860){return function(_0x555ab4){if(_0x555ab4){return _0x555ab4[_0x49a4('0x10')](_0x417860)[_0x49a4('0x11')](function(_0x1dfa3c){return _0x1dfa3c;});}return null;};}function removeEntity(_0x178841){return function(_0xfc3097){if(_0xfc3097){return _0xfc3097['destroy']()[_0x49a4('0x11')](function(){_0x178841[_0x49a4('0x9')](0xcc)[_0x49a4('0xa')]();});}};}function handleEntityNotFound(_0x37fcd2){return function(_0x5a0d06){if(!_0x5a0d06){_0x37fcd2[_0x49a4('0x12')](0x194);}return _0x5a0d06;};}function handleError(_0x656b26,_0x15d2d9){_0x15d2d9=_0x15d2d9||0x1f4;return function(_0x5c60d7){logger[_0x49a4('0x13')](_0x5c60d7['stack']);if(_0x5c60d7[_0x49a4('0x14')]){delete _0x5c60d7['name'];}_0x656b26[_0x49a4('0x9')](_0x15d2d9)[_0x49a4('0x15')](_0x5c60d7);};}function maskClientSecret(_0x10286d){return _[_0x49a4('0x16')](_0x10286d[_0x49a4('0x17')](0x0,0x3),0x14,'*');}exports[_0x49a4('0x18')]=function(_0x17460e,_0x5e866b){var _0x4131d1={},_0x5a0de2={},_0x54fa24={'count':0x0,'rows':[]};var _0x4cc744=_[_0x49a4('0x19')](db[_0x49a4('0x1a')][_0x49a4('0x1b')],function(_0x547140){return{'name':_0x547140[_0x49a4('0x1c')],'type':_0x547140[_0x49a4('0x1d')][_0x49a4('0x1e')]};});_0x5a0de2[_0x49a4('0x1f')]=_[_0x49a4('0x19')](_0x4cc744,_0x49a4('0x14'));_0x5a0de2[_0x49a4('0x20')]=_['keys'](_0x17460e[_0x49a4('0x20')]);_0x5a0de2['filters']=_[_0x49a4('0x21')](_0x5a0de2['model'],_0x5a0de2[_0x49a4('0x20')]);_0x4131d1[_0x49a4('0x22')]=_[_0x49a4('0x21')](_0x5a0de2['model'],qs[_0x49a4('0x23')](_0x17460e[_0x49a4('0x20')][_0x49a4('0x23')]));_0x4131d1[_0x49a4('0x22')]=_0x4131d1[_0x49a4('0x22')][_0x49a4('0x24')]?_0x4131d1['attributes']:_0x5a0de2[_0x49a4('0x1f')];if(!_0x17460e[_0x49a4('0x20')][_0x49a4('0x25')](_0x49a4('0x26'))){_0x4131d1[_0x49a4('0xe')]=qs[_0x49a4('0xe')](_0x17460e[_0x49a4('0x20')]['limit']);_0x4131d1['offset']=qs[_0x49a4('0xc')](_0x17460e[_0x49a4('0x20')][_0x49a4('0xc')]);}_0x4131d1[_0x49a4('0x27')]=qs[_0x49a4('0x28')](_0x17460e['query'][_0x49a4('0x28')]);_0x4131d1[_0x49a4('0x29')]=qs[_0x49a4('0x2a')](_[_0x49a4('0x2b')](_0x17460e[_0x49a4('0x20')],_0x5a0de2[_0x49a4('0x2a')]),_0x4cc744);if(_0x17460e[_0x49a4('0x20')][_0x49a4('0x2c')]){_0x4131d1[_0x49a4('0x29')]=_['merge'](_0x4131d1[_0x49a4('0x29')],{'$or':_[_0x49a4('0x19')](_0x4cc744,function(_0x1a7989){if(_0x1a7989[_0x49a4('0x1d')]!==_0x49a4('0x2d')){var _0x275286={};_0x275286[_0x1a7989[_0x49a4('0x14')]]={'$like':'%'+_0x17460e[_0x49a4('0x20')][_0x49a4('0x2c')]+'%'};return _0x275286;}})});}_0x4131d1=_[_0x49a4('0x2e')]({},_0x4131d1,_0x17460e['options']);var _0x50a64e={'where':_0x4131d1[_0x49a4('0x29')]};return db[_0x49a4('0x1a')][_0x49a4('0xf')](_0x50a64e)[_0x49a4('0x11')](function(_0x33e286){_0x54fa24[_0x49a4('0xf')]=_0x33e286;if(_0x17460e['query'][_0x49a4('0x2f')]){_0x4131d1[_0x49a4('0x30')]=[{'all':!![]}];}return db[_0x49a4('0x1a')]['findAll'](_0x4131d1);})[_0x49a4('0x11')](function(_0x1312f0){_0x54fa24[_0x49a4('0x31')]=_[_0x49a4('0x19')](_0x1312f0,function(_0x49fef9){if(_0x49fef9[_0x49a4('0x32')]==='MicrosoftAzure'){var _0x573c28=encryptor[_0x49a4('0x33')](_0x49fef9['data3']);_0x49fef9['data3']=maskClientSecret(_0x573c28);}return _0x49fef9;});return _0x54fa24;})['then'](respondWithFilteredResult(_0x5e866b,_0x4131d1))[_0x49a4('0x34')](handleError(_0x5e866b,null));};exports['show']=function(_0x5886ad,_0x1189cd){var _0xd426d6={'raw':!![],'where':{'id':_0x5886ad[_0x49a4('0x35')]['id']}},_0x1d7e8c={};_0x1d7e8c[_0x49a4('0x1f')]=_[_0x49a4('0x36')](db[_0x49a4('0x1a')][_0x49a4('0x1b')]);_0x1d7e8c[_0x49a4('0x20')]=_[_0x49a4('0x36')](_0x5886ad[_0x49a4('0x20')]);_0x1d7e8c[_0x49a4('0x2a')]=_[_0x49a4('0x21')](_0x1d7e8c[_0x49a4('0x1f')],_0x1d7e8c[_0x49a4('0x20')]);_0xd426d6[_0x49a4('0x22')]=_[_0x49a4('0x21')](_0x1d7e8c['model'],qs[_0x49a4('0x23')](_0x5886ad['query']['fields']));_0xd426d6[_0x49a4('0x22')]=_0xd426d6[_0x49a4('0x22')][_0x49a4('0x24')]?_0xd426d6['attributes']:_0x1d7e8c[_0x49a4('0x1f')];if(_0x5886ad['query'][_0x49a4('0x2f')]){_0xd426d6['include']=[{'all':!![]}];}_0xd426d6=_[_0x49a4('0x2e')]({},_0xd426d6,_0x5886ad[_0x49a4('0x37')]);return db[_0x49a4('0x1a')]['find'](_0xd426d6)[_0x49a4('0x11')](handleEntityNotFound(_0x1189cd,null))[_0x49a4('0x11')](function(_0x3c953e){if(_0x3c953e[_0x49a4('0x32')]===_0x49a4('0x38')){var _0x48e17d=encryptor[_0x49a4('0x33')](_0x3c953e['data3']);_0x3c953e[_0x49a4('0x39')]=maskClientSecret(_0x48e17d);}return _0x3c953e;})['then'](respondWithResult(_0x1189cd,null))[_0x49a4('0x34')](handleError(_0x1189cd,null));};exports[_0x49a4('0x3a')]=function(_0x9cd44a,_0x1c8c3d){if(!_0x9cd44a[_0x49a4('0x3b')][_0x49a4('0x14')])throw new Error(_0x49a4('0x3c'));if(!_0x9cd44a[_0x49a4('0x3b')][_0x49a4('0x32')])throw new Error(_0x49a4('0x3d'));var _0x464dd3=db[_0x49a4('0x1a')][_0x49a4('0x1b')][_0x49a4('0x32')][_0x49a4('0x3e')];if(!_0x464dd3[_0x49a4('0x3f')](_0x9cd44a[_0x49a4('0x3b')][_0x49a4('0x32')]))throw new Error(_0x49a4('0x40')+_0x464dd3[_0x49a4('0x41')](',\x20'));if(_0x9cd44a[_0x49a4('0x3b')][_0x49a4('0x32')]==='MicrosoftAzure'&&_0x9cd44a['body']['data3']){_0x9cd44a[_0x49a4('0x3b')]['data3']=encryptor[_0x49a4('0x42')](_0x9cd44a[_0x49a4('0x3b')]['data3']);}return db[_0x49a4('0x1a')][_0x49a4('0x3a')](_0x9cd44a[_0x49a4('0x3b')],{})['then'](respondWithResult(_0x1c8c3d,0xc9))['catch'](handleError(_0x1c8c3d,null));};exports[_0x49a4('0x10')]=function(_0x5ee40f,_0x117496){if(_0x5ee40f['body']['id']){delete _0x5ee40f[_0x49a4('0x3b')]['id'];}return db[_0x49a4('0x1a')]['find']({'where':{'id':_0x5ee40f[_0x49a4('0x35')]['id']}})[_0x49a4('0x11')](handleEntityNotFound(_0x117496,null))[_0x49a4('0x11')](function(_0xe7ffa9){if(_0xe7ffa9[_0x49a4('0x32')]===_0x49a4('0x38')&&_0x5ee40f[_0x49a4('0x3b')]['data3']){_0x5ee40f[_0x49a4('0x3b')][_0x49a4('0x39')]=encryptor[_0x49a4('0x42')](_0x5ee40f[_0x49a4('0x3b')]['data3']);}return _0xe7ffa9;})[_0x49a4('0x11')](saveUpdates(_0x5ee40f['body'],null))[_0x49a4('0x11')](respondWithResult(_0x117496,null))['catch'](handleError(_0x117496,null));};exports['destroy']=function(_0x41b5dd,_0x3c2804){return db[_0x49a4('0x1a')]['find']({'where':{'id':_0x41b5dd[_0x49a4('0x35')]['id']}})['then'](handleEntityNotFound(_0x3c2804,null))[_0x49a4('0x11')](removeEntity(_0x3c2804,null))[_0x49a4('0x34')](handleError(_0x3c2804,null));};exports['oauth2MicrosoftAuthorize']=function(_0x507d51,_0x372e41){return db[_0x49a4('0x1a')][_0x49a4('0x43')]({'where':{'id':_0x507d51[_0x49a4('0x35')]['id']},'raw':!![]})['then'](function(_0x186504){if(!_0x186504)return _0x372e41[_0x49a4('0x12')](0x194);return{'url':oauth['generateMicrosoftAuthorizationUrl'](_0x186504,_0x507d51[_0x49a4('0x44')]['id'])};})[_0x49a4('0x11')](respondWithResult(_0x372e41,null))[_0x49a4('0x34')](handleError(_0x372e41,null));};exports['oauth2MicrosoftCallback']=function(_0x175e5b,_0x1f7126){var _0x3bff7d=_0x175e5b['body'];var _0xb16804;var _0x410473;if(_0x3bff7d[_0x49a4('0x13')])throw _0x3bff7d;redis['get'](_0x3bff7d['state'])[_0x49a4('0x11')](function(_0x5279de){if(!_0x5279de)throw new Error(_0x49a4('0x45'));_0xb16804=JSON['parse'](_0x5279de);var _0x5ae67f=Buffer[_0x49a4('0x46')](_0x3bff7d[_0x49a4('0x47')],_0x49a4('0x48'))['toString']('ascii');_0x410473=JSON[_0x49a4('0x49')](_0x5ae67f);if(!oauth['isValidIdToken'](_0x3bff7d[_0x49a4('0x4a')],_0xb16804[_0x49a4('0x4b')]))throw new Error(_0x49a4('0x4c'));redis[_0x49a4('0x4d')](_0x3bff7d['state']);return oauth[_0x49a4('0x4e')](_0x3bff7d[_0x49a4('0x4f')],_0xb16804);})[_0x49a4('0x11')](function(_0x2fd75d){_0xb16804[_0x49a4('0x50')]=_0x2fd75d['access_token'];_0xb16804[_0x49a4('0x51')]=_0x2fd75d['refresh_token'];return db[_0x49a4('0x1a')][_0x49a4('0x10')]({'data5':_0xb16804['data5'],'data6':_0xb16804[_0x49a4('0x51')]},{'where':{'id':_0xb16804['id']}});})[_0x49a4('0x11')](function(){oauth['startRefreshInterval'](_0xb16804);socket[_0x49a4('0x52')](_0x49a4('0x53'),{'id':_0x410473['id']});return;})['then'](respondWithStatusCode(_0x1f7126,null))[_0x49a4('0x34')](function(_0x5cd0f){if(_0x410473){socket['emit'](_0x49a4('0x54'),{'id':_0x410473['id']});}if(!_0xb16804){logger['error'](_0x49a4('0x55'),_0x5cd0f);return _0x1f7126[_0x49a4('0x9')](0x1f4)['send'](_0x5cd0f[_0x49a4('0x56')]);}logger['error']('Authentication\x20failed\x20for\x20cloud\x20provider\x20#%s,\x20err:%s',_0xb16804['id'],JSON[_0x49a4('0x57')](_0x5cd0f));});}; \ No newline at end of file +var _0x58e6=['pick','filter','merge','type','VIRTUAL','options','includeAll','include','findAll','rows','decryptString','data3','catch','show','params','find','create','body','Name\x20parameter\x20not\x20specified','service','includes','Invalid\x20service\x20parameter.\x20Allowed\x20values:\x20','join','MicrosoftAzure','encryptString','update','generateMicrosoftAuthorizationUrl','user','oauth2MicrosoftCallback','get','Invalid\x20state\x20parameter','state','toString','ascii','parse','isValidIdToken','id_token','oauth2Claims','getOauth2MicrosoftAccessToken','data5','access_token','data6','refresh_token','emit','microsoftAuthorization:error','error','Invalid\x20authentication\x20state\x20parameter','message','Authentication\x20failed\x20for\x20cloud\x20provider\x20#%s,\x20err:%s','stringify','ioredis','../../components/parsers/qs','../../components/encryptor','../../config/environment','../../config/logger','api','./cloudProvider.oauth','redis','defaults','socket.io-emitter','sendStatus','end','status','undefined','limit','count','offset','set','Content-Range','then','name','send','slice','index','map','CloudProvider','rawAttributes','fieldName','key','keys','query','filters','model','attributes','intersection','fields','length','hasOwnProperty','nolimit','sort','where'];(function(_0x20bade,_0x27c659){var _0x27f17e=function(_0x5739be){while(--_0x5739be){_0x20bade['push'](_0x20bade['shift']());}};_0x27f17e(++_0x27c659);}(_0x58e6,0x19e));var _0x658e=function(_0x1668bd,_0x27745a){_0x1668bd=_0x1668bd-0x0;var _0x3a0691=_0x58e6[_0x1668bd];return _0x3a0691;};'use strict';var _=require('lodash');var Redis=require(_0x658e('0x0'));var qs=require(_0x658e('0x1'));var encryptor=require(_0x658e('0x2'));var config=require(_0x658e('0x3'));var logger=require(_0x658e('0x4'))(_0x658e('0x5'));var db=require('../../mysqldb')['db'];var oauth=require(_0x658e('0x6'));config[_0x658e('0x7')]=_[_0x658e('0x8')](config[_0x658e('0x7')],{'host':'localhost','port':0x18eb});var socket=require(_0x658e('0x9'))(new Redis(config[_0x658e('0x7')]));var redis=new Redis(config[_0x658e('0x7')]);function respondWithStatusCode(_0x1e5977,_0x3e8df8){_0x3e8df8=_0x3e8df8||0xcc;return function(_0x500ea3){if(_0x500ea3){return _0x1e5977[_0x658e('0xa')](_0x3e8df8);}return _0x1e5977['status'](_0x3e8df8)[_0x658e('0xb')]();};}function respondWithResult(_0x55721d,_0x1ce308){_0x1ce308=_0x1ce308||0xc8;return function(_0x12b03b){if(_0x12b03b){return _0x55721d[_0x658e('0xc')](_0x1ce308)['json'](_0x12b03b);}};}function respondWithFilteredResult(_0x2950b0,_0x403963){return function(_0x829335){if(_0x829335){var _0x342ee0=typeof _0x403963['offset']===_0x658e('0xd')&&typeof _0x403963[_0x658e('0xe')]===_0x658e('0xd');var _0x2f8cc5=_0x829335[_0x658e('0xf')];var _0xc31163=_0x342ee0?0x0:_0x403963[_0x658e('0x10')];var _0x40c1c4=_0x342ee0?_0x829335[_0x658e('0xf')]:_0x403963['offset']+_0x403963[_0x658e('0xe')];var _0x415855;if(_0x40c1c4>=_0x2f8cc5){_0x40c1c4=_0x2f8cc5;_0x415855=0xc8;}else{_0x415855=0xce;}_0x2950b0[_0x658e('0xc')](_0x415855);return _0x2950b0[_0x658e('0x11')](_0x658e('0x12'),_0xc31163+'-'+_0x40c1c4+'/'+_0x2f8cc5)['json'](_0x829335);}return null;};}function saveUpdates(_0x3e1d13){return function(_0x4d7224){if(_0x4d7224){return _0x4d7224['update'](_0x3e1d13)['then'](function(_0x28785b){return _0x28785b;});}return null;};}function removeEntity(_0x19d3a9){return function(_0x3ae1df){if(_0x3ae1df){return _0x3ae1df['destroy']()[_0x658e('0x13')](function(){_0x19d3a9[_0x658e('0xc')](0xcc)[_0x658e('0xb')]();});}};}function handleEntityNotFound(_0x4fc6d2){return function(_0x4c3920){if(!_0x4c3920){_0x4fc6d2[_0x658e('0xa')](0x194);}return _0x4c3920;};}function handleError(_0xf6658b,_0x1bfef7){_0x1bfef7=_0x1bfef7||0x1f4;return function(_0xbcdeb2){logger['error'](_0xbcdeb2['stack']);if(_0xbcdeb2[_0x658e('0x14')]){delete _0xbcdeb2[_0x658e('0x14')];}_0xf6658b[_0x658e('0xc')](_0x1bfef7)[_0x658e('0x15')](_0xbcdeb2);};}function maskClientSecret(_0x16624d){return _['padEnd'](_0x16624d[_0x658e('0x16')](0x0,0x3),0x14,'*');}exports[_0x658e('0x17')]=function(_0x4e90a8,_0x54178d){var _0x346c34={},_0x35696b={},_0x2c4093={'count':0x0,'rows':[]};var _0x10acf7=_[_0x658e('0x18')](db[_0x658e('0x19')][_0x658e('0x1a')],function(_0x3e0818){return{'name':_0x3e0818[_0x658e('0x1b')],'type':_0x3e0818['type'][_0x658e('0x1c')]};});_0x35696b['model']=_[_0x658e('0x18')](_0x10acf7,'name');_0x35696b['query']=_[_0x658e('0x1d')](_0x4e90a8[_0x658e('0x1e')]);_0x35696b[_0x658e('0x1f')]=_['intersection'](_0x35696b[_0x658e('0x20')],_0x35696b['query']);_0x346c34[_0x658e('0x21')]=_[_0x658e('0x22')](_0x35696b[_0x658e('0x20')],qs[_0x658e('0x23')](_0x4e90a8[_0x658e('0x1e')][_0x658e('0x23')]));_0x346c34['attributes']=_0x346c34[_0x658e('0x21')][_0x658e('0x24')]?_0x346c34[_0x658e('0x21')]:_0x35696b[_0x658e('0x20')];if(!_0x4e90a8[_0x658e('0x1e')][_0x658e('0x25')](_0x658e('0x26'))){_0x346c34['limit']=qs[_0x658e('0xe')](_0x4e90a8[_0x658e('0x1e')][_0x658e('0xe')]);_0x346c34[_0x658e('0x10')]=qs['offset'](_0x4e90a8[_0x658e('0x1e')][_0x658e('0x10')]);}_0x346c34['order']=qs[_0x658e('0x27')](_0x4e90a8[_0x658e('0x1e')]['sort']);_0x346c34[_0x658e('0x28')]=qs[_0x658e('0x1f')](_[_0x658e('0x29')](_0x4e90a8[_0x658e('0x1e')],_0x35696b[_0x658e('0x1f')]),_0x10acf7);if(_0x4e90a8['query'][_0x658e('0x2a')]){_0x346c34[_0x658e('0x28')]=_[_0x658e('0x2b')](_0x346c34[_0x658e('0x28')],{'$or':_[_0x658e('0x18')](_0x10acf7,function(_0x2fd9b0){if(_0x2fd9b0[_0x658e('0x2c')]!==_0x658e('0x2d')){var _0x37b4ba={};_0x37b4ba[_0x2fd9b0[_0x658e('0x14')]]={'$like':'%'+_0x4e90a8[_0x658e('0x1e')][_0x658e('0x2a')]+'%'};return _0x37b4ba;}})});}_0x346c34=_[_0x658e('0x2b')]({},_0x346c34,_0x4e90a8[_0x658e('0x2e')]);var _0x58cb49={'where':_0x346c34['where']};return db['CloudProvider'][_0x658e('0xf')](_0x58cb49)[_0x658e('0x13')](function(_0x2c3043){_0x2c4093[_0x658e('0xf')]=_0x2c3043;if(_0x4e90a8[_0x658e('0x1e')][_0x658e('0x2f')]){_0x346c34[_0x658e('0x30')]=[{'all':!![]}];}return db[_0x658e('0x19')][_0x658e('0x31')](_0x346c34);})[_0x658e('0x13')](function(_0xb84498){_0x2c4093[_0x658e('0x32')]=_['map'](_0xb84498,function(_0x492466){if(_0x492466['service']==='MicrosoftAzure'){var _0x3c3620=encryptor[_0x658e('0x33')](_0x492466[_0x658e('0x34')]);_0x492466[_0x658e('0x34')]=maskClientSecret(_0x3c3620);}return _0x492466;});return _0x2c4093;})[_0x658e('0x13')](respondWithFilteredResult(_0x54178d,_0x346c34))[_0x658e('0x35')](handleError(_0x54178d,null));};exports[_0x658e('0x36')]=function(_0x10c51e,_0x5c15a3){var _0x349cd5={'raw':!![],'where':{'id':_0x10c51e[_0x658e('0x37')]['id']}},_0x5130c3={};_0x5130c3[_0x658e('0x20')]=_[_0x658e('0x1d')](db[_0x658e('0x19')][_0x658e('0x1a')]);_0x5130c3['query']=_['keys'](_0x10c51e[_0x658e('0x1e')]);_0x5130c3[_0x658e('0x1f')]=_[_0x658e('0x22')](_0x5130c3[_0x658e('0x20')],_0x5130c3[_0x658e('0x1e')]);_0x349cd5['attributes']=_[_0x658e('0x22')](_0x5130c3[_0x658e('0x20')],qs['fields'](_0x10c51e[_0x658e('0x1e')][_0x658e('0x23')]));_0x349cd5['attributes']=_0x349cd5[_0x658e('0x21')][_0x658e('0x24')]?_0x349cd5[_0x658e('0x21')]:_0x5130c3[_0x658e('0x20')];if(_0x10c51e['query'][_0x658e('0x2f')]){_0x349cd5['include']=[{'all':!![]}];}_0x349cd5=_[_0x658e('0x2b')]({},_0x349cd5,_0x10c51e['options']);return db[_0x658e('0x19')][_0x658e('0x38')](_0x349cd5)['then'](handleEntityNotFound(_0x5c15a3,null))[_0x658e('0x13')](function(_0x21d52a){if(_0x21d52a['service']==='MicrosoftAzure'){var _0x508535=encryptor['decryptString'](_0x21d52a[_0x658e('0x34')]);_0x21d52a[_0x658e('0x34')]=maskClientSecret(_0x508535);}return _0x21d52a;})[_0x658e('0x13')](respondWithResult(_0x5c15a3,null))[_0x658e('0x35')](handleError(_0x5c15a3,null));};exports[_0x658e('0x39')]=function(_0x5db628,_0x25992d){if(!_0x5db628[_0x658e('0x3a')][_0x658e('0x14')])throw new Error(_0x658e('0x3b'));if(!_0x5db628['body'][_0x658e('0x3c')])throw new Error('Service\x20parameter\x20not\x20specified');var _0x36fe29=db['CloudProvider'][_0x658e('0x1a')][_0x658e('0x3c')]['values'];if(!_0x36fe29[_0x658e('0x3d')](_0x5db628[_0x658e('0x3a')][_0x658e('0x3c')]))throw new Error(_0x658e('0x3e')+_0x36fe29[_0x658e('0x3f')](',\x20'));if(_0x5db628['body'][_0x658e('0x3c')]===_0x658e('0x40')&&_0x5db628[_0x658e('0x3a')]['data3']){_0x5db628[_0x658e('0x3a')][_0x658e('0x34')]=encryptor[_0x658e('0x41')](_0x5db628['body'][_0x658e('0x34')]);}return db[_0x658e('0x19')][_0x658e('0x39')](_0x5db628['body'],{})[_0x658e('0x13')](respondWithResult(_0x25992d,0xc9))[_0x658e('0x35')](handleError(_0x25992d,null));};exports[_0x658e('0x42')]=function(_0x110827,_0x5ac5cd){if(_0x110827[_0x658e('0x3a')]['id']){delete _0x110827[_0x658e('0x3a')]['id'];}return db['CloudProvider'][_0x658e('0x38')]({'where':{'id':_0x110827[_0x658e('0x37')]['id']}})[_0x658e('0x13')](handleEntityNotFound(_0x5ac5cd,null))['then'](function(_0x2db73){if(_0x2db73[_0x658e('0x3c')]===_0x658e('0x40')&&_0x110827[_0x658e('0x3a')][_0x658e('0x34')]){_0x110827['body'][_0x658e('0x34')]=encryptor[_0x658e('0x41')](_0x110827['body'][_0x658e('0x34')]);}return _0x2db73;})[_0x658e('0x13')](saveUpdates(_0x110827[_0x658e('0x3a')],null))[_0x658e('0x13')](respondWithResult(_0x5ac5cd,null))[_0x658e('0x35')](handleError(_0x5ac5cd,null));};exports['destroy']=function(_0x302301,_0x105531){return db[_0x658e('0x19')][_0x658e('0x38')]({'where':{'id':_0x302301['params']['id']}})[_0x658e('0x13')](handleEntityNotFound(_0x105531,null))['then'](removeEntity(_0x105531,null))['catch'](handleError(_0x105531,null));};exports['oauth2MicrosoftAuthorize']=function(_0x13fb0f,_0xaa3dce){return db['CloudProvider']['findOne']({'where':{'id':_0x13fb0f['params']['id']},'raw':!![]})[_0x658e('0x13')](function(_0x49ebbe){if(!_0x49ebbe)return _0xaa3dce[_0x658e('0xa')](0x194);return{'url':oauth[_0x658e('0x43')](_0x49ebbe,_0x13fb0f[_0x658e('0x44')]['id'])};})[_0x658e('0x13')](respondWithResult(_0xaa3dce,null))[_0x658e('0x35')](handleError(_0xaa3dce,null));};exports[_0x658e('0x45')]=function(_0x3e1791,_0x5d43ad){var _0xe3b1db=_0x3e1791[_0x658e('0x3a')];var _0x1922fc;var _0x5864de;if(_0xe3b1db['error'])throw _0xe3b1db;redis[_0x658e('0x46')](_0xe3b1db['state'])[_0x658e('0x13')](function(_0x316423){if(!_0x316423)throw new Error(_0x658e('0x47'));_0x1922fc=JSON['parse'](_0x316423);var _0x2b8e4d=Buffer['from'](_0xe3b1db[_0x658e('0x48')],'base64')[_0x658e('0x49')](_0x658e('0x4a'));_0x5864de=JSON[_0x658e('0x4b')](_0x2b8e4d);if(!oauth[_0x658e('0x4c')](_0xe3b1db[_0x658e('0x4d')],_0x1922fc[_0x658e('0x4e')]))throw new Error('Unable\x20to\x20validate\x20id_token');redis['del'](_0xe3b1db[_0x658e('0x48')]);return oauth[_0x658e('0x4f')](_0xe3b1db['code'],_0x1922fc);})[_0x658e('0x13')](function(_0x382636){_0x1922fc[_0x658e('0x50')]=_0x382636[_0x658e('0x51')];_0x1922fc[_0x658e('0x52')]=_0x382636[_0x658e('0x53')];return db['CloudProvider'][_0x658e('0x42')]({'data5':_0x1922fc[_0x658e('0x50')],'data6':_0x1922fc[_0x658e('0x52')]},{'where':{'id':_0x1922fc['id']}});})[_0x658e('0x13')](function(){oauth['startRefreshInterval'](_0x1922fc);socket[_0x658e('0x54')]('microsoftAuthorization:success',{'id':_0x5864de['id']});return;})[_0x658e('0x13')](respondWithStatusCode(_0x5d43ad,null))[_0x658e('0x35')](function(_0x26c374){if(_0x5864de){socket['emit'](_0x658e('0x55'),{'id':_0x5864de['id']});}if(!_0x1922fc){logger[_0x658e('0x56')](_0x658e('0x57'),_0x26c374);return _0x5d43ad[_0x658e('0xc')](0x1f4)['send'](_0x26c374[_0x658e('0x58')]);}logger['error'](_0x658e('0x59'),_0x1922fc['id'],JSON[_0x658e('0x5a')](_0x26c374));});}; \ No newline at end of file diff --git a/server/api/cloudProvider/cloudProvider.model.js b/server/api/cloudProvider/cloudProvider.model.js index 4dc21be..0813bf9 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 _0xaffc=['util','../../config/logger','api','moment','bluebird','request-promise','rimraf','../../config/environment','./cloudProvider.attributes','exports','define','CloudProvider','cloud_providers'];(function(_0x20f13c,_0x16c657){var _0x444ea5=function(_0x2fec92){while(--_0x2fec92){_0x20f13c['push'](_0x20f13c['shift']());}};_0x444ea5(++_0x16c657);}(_0xaffc,0x152));var _0xcaff=function(_0x14a2c8,_0x4404fc){_0x14a2c8=_0x14a2c8-0x0;var _0x3f21e0=_0xaffc[_0x14a2c8];return _0x3f21e0;};'use strict';var _=require('lodash');var util=require(_0xcaff('0x0'));var logger=require(_0xcaff('0x1'))(_0xcaff('0x2'));var moment=require(_0xcaff('0x3'));var BPromise=require(_0xcaff('0x4'));var rp=require(_0xcaff('0x5'));var fs=require('fs');var path=require('path');var rimraf=require(_0xcaff('0x6'));var config=require(_0xcaff('0x7'));var attributes=require(_0xcaff('0x8'));module[_0xcaff('0x9')]=function(_0x5d3b69,_0x4ecaeb){return _0x5d3b69[_0xcaff('0xa')](_0xcaff('0xb'),attributes,{'tableName':_0xcaff('0xc'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0xa424=['../../config/environment','./cloudProvider.attributes','exports','define','CloudProvider','cloud_providers','lodash','../../config/logger','moment','bluebird','request-promise','path','rimraf'];(function(_0x3b1019,_0x4a4d6c){var _0x3ff04e=function(_0x3a726c){while(--_0x3a726c){_0x3b1019['push'](_0x3b1019['shift']());}};_0x3ff04e(++_0x4a4d6c);}(_0xa424,0x1cd));var _0x4a42=function(_0x23d3f0,_0x13fcee){_0x23d3f0=_0x23d3f0-0x0;var _0x3cb4e1=_0xa424[_0x23d3f0];return _0x3cb4e1;};'use strict';var _=require(_0x4a42('0x0'));var util=require('util');var logger=require(_0x4a42('0x1'))('api');var moment=require(_0x4a42('0x2'));var BPromise=require(_0x4a42('0x3'));var rp=require(_0x4a42('0x4'));var fs=require('fs');var path=require(_0x4a42('0x5'));var rimraf=require(_0x4a42('0x6'));var config=require(_0x4a42('0x7'));var attributes=require(_0x4a42('0x8'));module[_0x4a42('0x9')]=function(_0x505fc1,_0x4b0071){return _0x505fc1[_0x4a42('0xa')](_0x4a42('0xb'),attributes,{'tableName':_0x4a42('0xc'),'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 9e39c3d..17db527 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 _0x2d4c=['exp','resolve','then','data3','CloudProvider','refresh_token','data6','decryptString','{TENANT_ID}','access_token','data5','error','intervals','bind','findAll','all','catch','[CLOUD_PROVIDER]\x20Error\x20while\x20refreshing\x20the\x20tokens\x20after\x20service\x20restart\x20error:%s','lodash','jsonwebtoken','moment','ioredis','request-promise','util','../../components/encryptor','../../config/environment','api','../../config/schedule/cloud-provider','../../mysqldb','redis','https://login.microsoftonline.com/{TENANT_ID}/oauth2/v2.0','profile','email','offline_access','https://outlook.office365.com/IMAP.AccessAsUser.All','openid','/authorize','/token','map','type','data7','join','Outlook365','Dynamics365','replace','data2','id_token','from','stringify','toString','hex','client_id','data1','response_type','redirect_uri','data4','response_mode','state','login','key','value','oauth2Claims','set','decode','iss','issuer','aud','audience','nonce','unix'];(function(_0x5348ca,_0x4a7dd9){var _0xed91c9=function(_0x4ab171){while(--_0x4ab171){_0x5348ca['push'](_0x5348ca['shift']());}};_0xed91c9(++_0x4a7dd9);}(_0x2d4c,0x1b6));var _0xc2d4=function(_0x6b033a,_0x1ca0e9){_0x6b033a=_0x6b033a-0x0;var _0x320931=_0x2d4c[_0x6b033a];return _0x320931;};'use strict';var _=require(_0xc2d4('0x0'));var crypto=require('crypto');var jwt=require(_0xc2d4('0x1'));var moment=require(_0xc2d4('0x2'));var Redis=require(_0xc2d4('0x3'));var rp=require(_0xc2d4('0x4'));var util=require(_0xc2d4('0x5'));var encryptor=require(_0xc2d4('0x6'));var config=require(_0xc2d4('0x7'));var logger=require('../../config/logger')(_0xc2d4('0x8'));var schedule=require(_0xc2d4('0x9'));var db=require(_0xc2d4('0xa'))['db'];config[_0xc2d4('0xb')]=_['defaults'](config[_0xc2d4('0xb')],{'host':'localhost','port':0x18eb});var redis=new Redis(config['redis']);var MICROSOFT_AUTH_URL=_0xc2d4('0xc');var AZURE_AUTH_SCOPES={'Outlook365':['openid',_0xc2d4('0xd'),_0xc2d4('0xe'),_0xc2d4('0xf'),_0xc2d4('0x10'),'https://outlook.office.com/POP.AccessAsUser.All','https://outlook.office.com/SMTP.Send'],'Dynamics365':[_0xc2d4('0x11'),'offline_access']};var MICROSOFT_AUTH_ENDPOINT=_0xc2d4('0x12');var MICROSOFT_TOKEN_ENDPOINT=_0xc2d4('0x13');var OAUTH_REFRESH_INTERVAL=0xfa;function getAuthorizationScopes(_0x180e43){var _0x237fb8=_[_0xc2d4('0x14')](AZURE_AUTH_SCOPES[_0x180e43[_0xc2d4('0x15')]]);if(_0x180e43[_0xc2d4('0x15')]==='Dynamics365')_0x237fb8['push'](_0x180e43[_0xc2d4('0x16')]+'/.default');return _0x237fb8[_0xc2d4('0x17')]('\x20');}function getAccessTokenScope(_0x57efe2){if(_0x57efe2[_0xc2d4('0x15')]===_0xc2d4('0x18'))return _0xc2d4('0x10');if(_0x57efe2[_0xc2d4('0x15')]===_0xc2d4('0x19'))return _0x57efe2[_0xc2d4('0x16')]+'/.default';}function generateMicrosoftAuthorizationUrl(_0x4b24da,_0x2f3683){var _0x2146fc=MICROSOFT_AUTH_URL[_0xc2d4('0x1a')]('{TENANT_ID}',_0x4b24da[_0xc2d4('0x1b')]);var _0x56d41b=['code',_0xc2d4('0x1c')];var _0x3f7253=Buffer[_0xc2d4('0x1d')](JSON[_0xc2d4('0x1e')]({'id':_0x2f3683}))['toString']('base64');var _0x34d0df=crypto['randomBytes'](0x10)[_0xc2d4('0x1f')](_0xc2d4('0x20'));var _0x28ad78=getAuthorizationScopes(_0x4b24da);var _0x53a460=[{'key':_0xc2d4('0x21'),'value':_0x4b24da[_0xc2d4('0x22')]},{'key':_0xc2d4('0x23'),'value':encodeURIComponent(_0x56d41b[_0xc2d4('0x17')]('\x20'))},{'key':_0xc2d4('0x24'),'value':_0x4b24da[_0xc2d4('0x25')]},{'key':_0xc2d4('0x26'),'value':'form_post'},{'key':'scope','value':encodeURIComponent(_0x28ad78)},{'key':_0xc2d4('0x27'),'value':_0x3f7253},{'key':'nonce','value':_0x34d0df},{'key':'prompt','value':_0xc2d4('0x28')}];var _0x2d1310=_0x2146fc+MICROSOFT_AUTH_ENDPOINT+'?'+_[_0xc2d4('0x14')](_0x53a460,function(_0xaae3ad){return _0xaae3ad[_0xc2d4('0x29')]+'='+_0xaae3ad[_0xc2d4('0x2a')];})[_0xc2d4('0x17')]('&');_0x4b24da[_0xc2d4('0x2b')]={'issuer':_0x2146fc[_0xc2d4('0x1a')]('oauth2/',''),'audience':_0x4b24da[_0xc2d4('0x22')],'state':_0x3f7253,'nonce':_0x34d0df};redis[_0xc2d4('0x2c')](_0x3f7253,JSON[_0xc2d4('0x1e')](_0x4b24da));return _0x2d1310;}function isValidIdToken(_0x13b789,_0x95d322){try{var _0x4780c1=jwt[_0xc2d4('0x2d')](_0x13b789,{'complete':!![]});var _0x4ad69e=_0x4780c1['payload'];if(_0x4ad69e[_0xc2d4('0x2e')]!==_0x95d322[_0xc2d4('0x2f')])return![];if(_0x4ad69e[_0xc2d4('0x30')]!==_0x95d322[_0xc2d4('0x31')])return![];if(_0x4ad69e['nonce']!==_0x95d322[_0xc2d4('0x32')])return![];if(moment()['isAfter'](moment[_0xc2d4('0x33')](_0x4ad69e[_0xc2d4('0x34')])))return![];return!![];}catch(_0x5ca8a8){throw _0x5ca8a8;}}function refreshOauth2MicrosoftAccessToken(_0x19fb1a){return Promise[_0xc2d4('0x35')]()[_0xc2d4('0x36')](function(){if(_0x19fb1a[_0xc2d4('0x37')])return _0x19fb1a;return db[_0xc2d4('0x38')]['findOne']({'where':{'id':_0x19fb1a['id']},'raw':!![]});})['then'](function(_0x6ddae1){var _0x367ef3={'grant_type':_0xc2d4('0x39'),'refresh_token':_0x6ddae1[_0xc2d4('0x3a')],'scope':getAccessTokenScope(_0x6ddae1),'redirect_uri':_0x6ddae1[_0xc2d4('0x25')],'client_id':_0x6ddae1[_0xc2d4('0x22')],'client_secret':encryptor[_0xc2d4('0x3b')](_0x6ddae1[_0xc2d4('0x37')])};var _0x5974fd={'method':'POST','uri':MICROSOFT_AUTH_URL[_0xc2d4('0x1a')](_0xc2d4('0x3c'),_0x6ddae1[_0xc2d4('0x1b')])+MICROSOFT_TOKEN_ENDPOINT,'form':_0x367ef3,'json':!![]};return rp(_0x5974fd);})[_0xc2d4('0x36')](function(_0x6fc9eb){_0x19fb1a['data5']=_0x6fc9eb[_0xc2d4('0x3d')];_0x19fb1a[_0xc2d4('0x3a')]=_0x6fc9eb['refresh_token'];return db[_0xc2d4('0x38')]['update']({'data5':_0x19fb1a[_0xc2d4('0x3e')],'data6':_0x19fb1a[_0xc2d4('0x3a')]},{'where':{'id':_0x19fb1a['id']}});})['then'](function(){return _0x19fb1a;})['catch'](function(_0x229a86){logger[_0xc2d4('0x3f')]('Failed\x20to\x20refresh\x20access\x20token\x20for\x20cloud\x20provider\x20#%s,\x20-\x20err:%s',_0x19fb1a['id'],_0x229a86);});}function getOauth2MicrosoftAccessToken(_0x376c8b,_0x476eac){var _0x2aeb1b={'grant_type':'authorization_code','code':_0x376c8b,'scope':getAccessTokenScope(_0x476eac),'redirect_uri':_0x476eac[_0xc2d4('0x25')],'client_id':_0x476eac[_0xc2d4('0x22')],'client_secret':encryptor[_0xc2d4('0x3b')](_0x476eac[_0xc2d4('0x37')])};var _0x48e6a7={'method':'POST','uri':MICROSOFT_AUTH_URL[_0xc2d4('0x1a')](_0xc2d4('0x3c'),_0x476eac[_0xc2d4('0x1b')])+MICROSOFT_TOKEN_ENDPOINT,'form':_0x2aeb1b,'json':!![]};return rp(_0x48e6a7);}function startRefreshInterval(_0x54b248){var _0x1a479b=schedule[_0xc2d4('0x40')];if(_0x1a479b[_0x54b248['id']])clearInterval(_0x1a479b[_0x54b248['id']]);_0x1a479b[_0x54b248['id']]=setInterval(refreshOauth2MicrosoftAccessToken[_0xc2d4('0x41')](this,{'id':_0x54b248['id']}),OAUTH_REFRESH_INTERVAL*0x3e8);schedule['intervals']=_0x1a479b;}function startAllRefreshIntervals(){return db[_0xc2d4('0x38')][_0xc2d4('0x42')]({'where':{'data6':{'$ne':null}},'raw':!![]})[_0xc2d4('0x36')](function(_0x35f95e){var _0xc3a4e7=_0x35f95e['map'](function(_0x52926e){return refreshOauth2MicrosoftAccessToken(_0x52926e)[_0xc2d4('0x36')](function(_0x5a798c){startRefreshInterval(_0x5a798c);});});return Promise[_0xc2d4('0x43')](_0xc3a4e7);})[_0xc2d4('0x44')](function(_0x54d10e){var _0x43bcbe=_0x54d10e?util['inspect'](_0x54d10e,{'showHidden':![],'depth':null}):'';logger[_0xc2d4('0x3f')](_0xc2d4('0x45'),_0x43bcbe);});}module['exports']={'generateMicrosoftAuthorizationUrl':generateMicrosoftAuthorizationUrl,'getOauth2MicrosoftAccessToken':getOauth2MicrosoftAccessToken,'isValidIdToken':isValidIdToken,'startAllRefreshIntervals':startAllRefreshIntervals,'refreshOauth2MicrosoftAccessToken':refreshOauth2MicrosoftAccessToken,'startRefreshInterval':startRefreshInterval}; \ No newline at end of file +var _0x4f4c=['findAll','all','inspect','error','[CLOUD_PROVIDER]\x20Error\x20while\x20refreshing\x20the\x20tokens\x20after\x20service\x20restart\x20error:%s','exports','crypto','jsonwebtoken','moment','ioredis','request-promise','util','../../components/encryptor','../../config/environment','../../config/schedule/cloud-provider','../../mysqldb','redis','defaults','localhost','https://login.microsoftonline.com/{TENANT_ID}/oauth2/v2.0','openid','profile','email','https://outlook.office365.com/IMAP.AccessAsUser.All','https://outlook.office.com/POP.AccessAsUser.All','/authorize','map','type','Dynamics365','push','/.default','join','data7','replace','from','stringify','toString','base64','randomBytes','hex','client_id','redirect_uri','data4','response_mode','form_post','scope','state','login','key','value','oauth2Claims','oauth2/','data1','set','decode','payload','issuer','audience','nonce','isAfter','unix','exp','resolve','then','CloudProvider','findOne','refresh_token','data6','decryptString','{TENANT_ID}','data2','data5','access_token','update','catch','Failed\x20to\x20refresh\x20access\x20token\x20for\x20cloud\x20provider\x20#%s,\x20-\x20err:%s','authorization_code','data3','intervals','bind'];(function(_0x2df1f2,_0x58d388){var _0x38652b=function(_0x18e322){while(--_0x18e322){_0x2df1f2['push'](_0x2df1f2['shift']());}};_0x38652b(++_0x58d388);}(_0x4f4c,0x1e6));var _0xc4f4=function(_0x57265f,_0x4d64f2){_0x57265f=_0x57265f-0x0;var _0x52b2ce=_0x4f4c[_0x57265f];return _0x52b2ce;};'use strict';var _=require('lodash');var crypto=require(_0xc4f4('0x0'));var jwt=require(_0xc4f4('0x1'));var moment=require(_0xc4f4('0x2'));var Redis=require(_0xc4f4('0x3'));var rp=require(_0xc4f4('0x4'));var util=require(_0xc4f4('0x5'));var encryptor=require(_0xc4f4('0x6'));var config=require(_0xc4f4('0x7'));var logger=require('../../config/logger')('api');var schedule=require(_0xc4f4('0x8'));var db=require(_0xc4f4('0x9'))['db'];config[_0xc4f4('0xa')]=_[_0xc4f4('0xb')](config[_0xc4f4('0xa')],{'host':_0xc4f4('0xc'),'port':0x18eb});var redis=new Redis(config[_0xc4f4('0xa')]);var MICROSOFT_AUTH_URL=_0xc4f4('0xd');var AZURE_AUTH_SCOPES={'Outlook365':[_0xc4f4('0xe'),_0xc4f4('0xf'),_0xc4f4('0x10'),'offline_access',_0xc4f4('0x11'),_0xc4f4('0x12'),'https://outlook.office.com/SMTP.Send'],'Dynamics365':['openid','offline_access']};var MICROSOFT_AUTH_ENDPOINT=_0xc4f4('0x13');var MICROSOFT_TOKEN_ENDPOINT='/token';var OAUTH_REFRESH_INTERVAL=0xfa;function getAuthorizationScopes(_0x107883){var _0x411aed=_[_0xc4f4('0x14')](AZURE_AUTH_SCOPES[_0x107883[_0xc4f4('0x15')]]);if(_0x107883[_0xc4f4('0x15')]===_0xc4f4('0x16'))_0x411aed[_0xc4f4('0x17')](_0x107883['data7']+_0xc4f4('0x18'));return _0x411aed[_0xc4f4('0x19')]('\x20');}function getAccessTokenScope(_0x5cad6c){if(_0x5cad6c[_0xc4f4('0x15')]==='Outlook365')return _0xc4f4('0x11');if(_0x5cad6c[_0xc4f4('0x15')]===_0xc4f4('0x16'))return _0x5cad6c[_0xc4f4('0x1a')]+_0xc4f4('0x18');}function generateMicrosoftAuthorizationUrl(_0x1a7e8f,_0x445263){var _0x1e6365=MICROSOFT_AUTH_URL[_0xc4f4('0x1b')]('{TENANT_ID}',_0x1a7e8f['data2']);var _0x5f1aca=['code','id_token'];var _0x8dd4c0=Buffer[_0xc4f4('0x1c')](JSON[_0xc4f4('0x1d')]({'id':_0x445263}))[_0xc4f4('0x1e')](_0xc4f4('0x1f'));var _0x1d5c2a=crypto[_0xc4f4('0x20')](0x10)['toString'](_0xc4f4('0x21'));var _0x2b5e18=getAuthorizationScopes(_0x1a7e8f);var _0x34bd58=[{'key':_0xc4f4('0x22'),'value':_0x1a7e8f['data1']},{'key':'response_type','value':encodeURIComponent(_0x5f1aca[_0xc4f4('0x19')]('\x20'))},{'key':_0xc4f4('0x23'),'value':_0x1a7e8f[_0xc4f4('0x24')]},{'key':_0xc4f4('0x25'),'value':_0xc4f4('0x26')},{'key':_0xc4f4('0x27'),'value':encodeURIComponent(_0x2b5e18)},{'key':_0xc4f4('0x28'),'value':_0x8dd4c0},{'key':'nonce','value':_0x1d5c2a},{'key':'prompt','value':_0xc4f4('0x29')}];var _0x26f127=_0x1e6365+MICROSOFT_AUTH_ENDPOINT+'?'+_[_0xc4f4('0x14')](_0x34bd58,function(_0x3e57d1){return _0x3e57d1[_0xc4f4('0x2a')]+'='+_0x3e57d1[_0xc4f4('0x2b')];})['join']('&');_0x1a7e8f[_0xc4f4('0x2c')]={'issuer':_0x1e6365[_0xc4f4('0x1b')](_0xc4f4('0x2d'),''),'audience':_0x1a7e8f[_0xc4f4('0x2e')],'state':_0x8dd4c0,'nonce':_0x1d5c2a};redis[_0xc4f4('0x2f')](_0x8dd4c0,JSON[_0xc4f4('0x1d')](_0x1a7e8f));return _0x26f127;}function isValidIdToken(_0x24eb06,_0x361512){try{var _0x262cce=jwt[_0xc4f4('0x30')](_0x24eb06,{'complete':!![]});var _0x586930=_0x262cce[_0xc4f4('0x31')];if(_0x586930['iss']!==_0x361512[_0xc4f4('0x32')])return![];if(_0x586930['aud']!==_0x361512[_0xc4f4('0x33')])return![];if(_0x586930[_0xc4f4('0x34')]!==_0x361512['nonce'])return![];if(moment()[_0xc4f4('0x35')](moment[_0xc4f4('0x36')](_0x586930[_0xc4f4('0x37')])))return![];return!![];}catch(_0x553ff){throw _0x553ff;}}function refreshOauth2MicrosoftAccessToken(_0x1816a5){return Promise[_0xc4f4('0x38')]()[_0xc4f4('0x39')](function(){if(_0x1816a5['data3'])return _0x1816a5;return db[_0xc4f4('0x3a')][_0xc4f4('0x3b')]({'where':{'id':_0x1816a5['id']},'raw':!![]});})[_0xc4f4('0x39')](function(_0x4185a7){var _0x6d3060={'grant_type':_0xc4f4('0x3c'),'refresh_token':_0x4185a7[_0xc4f4('0x3d')],'scope':getAccessTokenScope(_0x4185a7),'redirect_uri':_0x4185a7[_0xc4f4('0x24')],'client_id':_0x4185a7['data1'],'client_secret':encryptor[_0xc4f4('0x3e')](_0x4185a7['data3'])};var _0x37478d={'method':'POST','uri':MICROSOFT_AUTH_URL[_0xc4f4('0x1b')](_0xc4f4('0x3f'),_0x4185a7[_0xc4f4('0x40')])+MICROSOFT_TOKEN_ENDPOINT,'form':_0x6d3060,'json':!![]};return rp(_0x37478d);})[_0xc4f4('0x39')](function(_0x2caf85){_0x1816a5[_0xc4f4('0x41')]=_0x2caf85[_0xc4f4('0x42')];_0x1816a5['data6']=_0x2caf85[_0xc4f4('0x3c')];return db[_0xc4f4('0x3a')][_0xc4f4('0x43')]({'data5':_0x1816a5[_0xc4f4('0x41')],'data6':_0x1816a5[_0xc4f4('0x3d')]},{'where':{'id':_0x1816a5['id']}});})['then'](function(){return _0x1816a5;})[_0xc4f4('0x44')](function(_0x2a1f98){logger['error'](_0xc4f4('0x45'),_0x1816a5['id'],_0x2a1f98);});}function getOauth2MicrosoftAccessToken(_0x457cf1,_0x12c1e6){var _0x51e90={'grant_type':_0xc4f4('0x46'),'code':_0x457cf1,'scope':getAccessTokenScope(_0x12c1e6),'redirect_uri':_0x12c1e6[_0xc4f4('0x24')],'client_id':_0x12c1e6[_0xc4f4('0x2e')],'client_secret':encryptor[_0xc4f4('0x3e')](_0x12c1e6[_0xc4f4('0x47')])};var _0x141a28={'method':'POST','uri':MICROSOFT_AUTH_URL[_0xc4f4('0x1b')](_0xc4f4('0x3f'),_0x12c1e6[_0xc4f4('0x40')])+MICROSOFT_TOKEN_ENDPOINT,'form':_0x51e90,'json':!![]};return rp(_0x141a28);}function startRefreshInterval(_0xd85caf){var _0x22a7ac=schedule[_0xc4f4('0x48')];if(_0x22a7ac[_0xd85caf['id']])clearInterval(_0x22a7ac[_0xd85caf['id']]);_0x22a7ac[_0xd85caf['id']]=setInterval(refreshOauth2MicrosoftAccessToken[_0xc4f4('0x49')](this,{'id':_0xd85caf['id']}),OAUTH_REFRESH_INTERVAL*0x3e8);schedule['intervals']=_0x22a7ac;}function startAllRefreshIntervals(){return db[_0xc4f4('0x3a')][_0xc4f4('0x4a')]({'where':{'data6':{'$ne':null}},'raw':!![]})[_0xc4f4('0x39')](function(_0x25d844){var _0x43feda=_0x25d844[_0xc4f4('0x14')](function(_0x5264e8){return refreshOauth2MicrosoftAccessToken(_0x5264e8)[_0xc4f4('0x39')](function(_0x406f8b){startRefreshInterval(_0x406f8b);});});return Promise[_0xc4f4('0x4b')](_0x43feda);})[_0xc4f4('0x44')](function(_0xa0e7d3){var _0x1dca8c=_0xa0e7d3?util[_0xc4f4('0x4c')](_0xa0e7d3,{'showHidden':![],'depth':null}):'';logger[_0xc4f4('0x4d')](_0xc4f4('0x4e'),_0x1dca8c);});}module[_0xc4f4('0x4f')]={'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 e015f4a..321c3a2 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 _0x7334=['ioredis','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','client','http','request','then','info','CloudProvider,\x20%s,\x20%s','debug','CloudProvider,\x20%s,\x20%s,\x20%s','stringify','error','code','message','request\x20sent','result','lodash','util','moment'];(function(_0xa3588e,_0x5d253f){var _0x2a0cca=function(_0x197ba8){while(--_0x197ba8){_0xa3588e['push'](_0xa3588e['shift']());}};_0x2a0cca(++_0x5d253f);}(_0x7334,0x184));var _0x4733=function(_0xc21994,_0x7761c0){_0xc21994=_0xc21994-0x0;var _0x5b1fe2=_0x7334[_0xc21994];return _0x5b1fe2;};'use strict';var _=require(_0x4733('0x0'));var util=require(_0x4733('0x1'));var moment=require(_0x4733('0x2'));var BPromise=require('bluebird');var rs=require('randomstring');var fs=require('fs');var Redis=require(_0x4733('0x3'));var db=require('../../mysqldb')['db'];var utils=require(_0x4733('0x4'));var logger=require(_0x4733('0x5'))(_0x4733('0x6'));var config=require(_0x4733('0x7'));var jayson=require(_0x4733('0x8'));var client=jayson[_0x4733('0x9')][_0x4733('0xa')]({'port':0x232a});function respondWithRpcPromise(_0x283754,_0x12cafa,_0x43d95c){return new BPromise(function(_0x8257cf,_0x3562b7){return client[_0x4733('0xb')](_0x283754,_0x43d95c)[_0x4733('0xc')](function(_0x2d5fde){logger[_0x4733('0xd')](_0x4733('0xe'),_0x12cafa,'request\x20sent');logger[_0x4733('0xf')](_0x4733('0x10'),_0x12cafa,'request\x20sent',JSON[_0x4733('0x11')](_0x2d5fde));if(_0x2d5fde['error']){if(_0x2d5fde[_0x4733('0x12')][_0x4733('0x13')]===0x1f4){logger[_0x4733('0x12')](_0x4733('0xe'),_0x12cafa,_0x2d5fde[_0x4733('0x12')][_0x4733('0x14')]);return _0x3562b7(_0x2d5fde[_0x4733('0x12')]['message']);}logger[_0x4733('0x12')]('CloudProvider,\x20%s,\x20%s',_0x12cafa,_0x2d5fde[_0x4733('0x12')][_0x4733('0x14')]);return _0x8257cf(_0x2d5fde[_0x4733('0x12')][_0x4733('0x14')]);}else{logger[_0x4733('0xd')](_0x4733('0xe'),_0x12cafa,_0x4733('0x15'));_0x8257cf(_0x2d5fde[_0x4733('0x16')][_0x4733('0x14')]);}})['catch'](function(_0x2c0031){logger[_0x4733('0x12')]('CloudProvider,\x20%s,\x20%s',_0x12cafa,_0x2c0031);_0x3562b7(_0x2c0031);});});} \ No newline at end of file +var _0xfb0b=['../../config/environment','jayson/promise','client','http','request','then','debug','CloudProvider,\x20%s,\x20%s,\x20%s','request\x20sent','error','code','CloudProvider,\x20%s,\x20%s','message','info','result','catch','lodash','util','moment','randomstring','ioredis','../../config/logger'];(function(_0xd102f1,_0x39f70b){var _0x1a73d2=function(_0x2a06b3){while(--_0x2a06b3){_0xd102f1['push'](_0xd102f1['shift']());}};_0x1a73d2(++_0x39f70b);}(_0xfb0b,0x94));var _0xbfb0=function(_0x2d2e60,_0x174813){_0x2d2e60=_0x2d2e60-0x0;var _0x29960b=_0xfb0b[_0x2d2e60];return _0x29960b;};'use strict';var _=require(_0xbfb0('0x0'));var util=require(_0xbfb0('0x1'));var moment=require(_0xbfb0('0x2'));var BPromise=require('bluebird');var rs=require(_0xbfb0('0x3'));var fs=require('fs');var Redis=require(_0xbfb0('0x4'));var db=require('../../mysqldb')['db'];var utils=require('../../config/utils');var logger=require(_0xbfb0('0x5'))('rpc');var config=require(_0xbfb0('0x6'));var jayson=require(_0xbfb0('0x7'));var client=jayson[_0xbfb0('0x8')][_0xbfb0('0x9')]({'port':0x232a});function respondWithRpcPromise(_0x2b3840,_0x46166a,_0x52eba3){return new BPromise(function(_0x3491c7,_0x1afe32){return client[_0xbfb0('0xa')](_0x2b3840,_0x52eba3)[_0xbfb0('0xb')](function(_0x4c2cee){logger['info']('CloudProvider,\x20%s,\x20%s',_0x46166a,'request\x20sent');logger[_0xbfb0('0xc')](_0xbfb0('0xd'),_0x46166a,_0xbfb0('0xe'),JSON['stringify'](_0x4c2cee));if(_0x4c2cee[_0xbfb0('0xf')]){if(_0x4c2cee['error'][_0xbfb0('0x10')]===0x1f4){logger[_0xbfb0('0xf')](_0xbfb0('0x11'),_0x46166a,_0x4c2cee[_0xbfb0('0xf')][_0xbfb0('0x12')]);return _0x1afe32(_0x4c2cee[_0xbfb0('0xf')]['message']);}logger[_0xbfb0('0xf')]('CloudProvider,\x20%s,\x20%s',_0x46166a,_0x4c2cee['error']['message']);return _0x3491c7(_0x4c2cee[_0xbfb0('0xf')][_0xbfb0('0x12')]);}else{logger[_0xbfb0('0x13')](_0xbfb0('0x11'),_0x46166a,_0xbfb0('0xe'));_0x3491c7(_0x4c2cee[_0xbfb0('0x14')][_0xbfb0('0x12')]);}})[_0xbfb0('0x15')](function(_0x315b80){logger[_0xbfb0('0xf')](_0xbfb0('0x11'),_0x46166a,_0x315b80);_0x1afe32(_0x315b80);});});} \ No newline at end of file diff --git a/server/api/cloudProvider/index.js b/server/api/cloudProvider/index.js index 6fe9319..2b75f1e 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 _0x5f2f=['exports','express','Router','../../components/auth/service','./cloudProvider.controller','get','isAuthenticated','index','show','post','create','put','/:id','update','delete','destroy','/:id/oauth2/microsoft/authorize/','oauth2MicrosoftAuthorize','oauth2MicrosoftCallback'];(function(_0x8dc04d,_0xaa7559){var _0x2f5f28=function(_0xdd2d1d){while(--_0xdd2d1d){_0x8dc04d['push'](_0x8dc04d['shift']());}};_0x2f5f28(++_0xaa7559);}(_0x5f2f,0x73));var _0xf5f2=function(_0x273c35,_0x15a896){_0x273c35=_0x273c35-0x0;var _0x1e8bd1=_0x5f2f[_0x273c35];return _0x1e8bd1;};'use strict';var express=require(_0xf5f2('0x0'));var router=express[_0xf5f2('0x1')]();var auth=require(_0xf5f2('0x2'));var controller=require(_0xf5f2('0x3'));router[_0xf5f2('0x4')]('/',auth[_0xf5f2('0x5')](),controller[_0xf5f2('0x6')]);router[_0xf5f2('0x4')]('/:id',auth['isAuthenticated'](),controller[_0xf5f2('0x7')]);router[_0xf5f2('0x8')]('/',auth[_0xf5f2('0x5')](),controller[_0xf5f2('0x9')]);router[_0xf5f2('0xa')](_0xf5f2('0xb'),auth['isAuthenticated'](),controller[_0xf5f2('0xc')]);router[_0xf5f2('0xd')](_0xf5f2('0xb'),auth['isAuthenticated'](),controller[_0xf5f2('0xe')]);router[_0xf5f2('0x4')](_0xf5f2('0xf'),auth['isAuthenticated'](),controller[_0xf5f2('0x10')]);router['post']('/oauth2/microsoft/callback',controller[_0xf5f2('0x11')]);module[_0xf5f2('0x12')]=router; \ No newline at end of file +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(_0xa6aae7,_0x2d6483){var _0x4315d6=function(_0x42cc5a){while(--_0x42cc5a){_0xa6aae7['push'](_0xa6aae7['shift']());}};_0x4315d6(++_0x2d6483);}(_0xdb28,0x106));var _0x8db2=function(_0x21199f,_0x4f7356){_0x21199f=_0x21199f-0x0;var _0x5ee4e6=_0xdb28[_0x21199f];return _0x5ee4e6;};'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 diff --git a/server/api/cmCompany/cmCompany.attributes.js b/server/api/cmCompany/cmCompany.attributes.js index a640947..d8f8f0d 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 _0x4b24=['exports','STRING','name','sequelize'];(function(_0x12b8ec,_0x1655be){var _0x21af77=function(_0xe59f){while(--_0xe59f){_0x12b8ec['push'](_0x12b8ec['shift']());}};_0x21af77(++_0x1655be);}(_0x4b24,0xa3));var _0x44b2=function(_0x4d3bbd,_0x180636){_0x4d3bbd=_0x4d3bbd-0x0;var _0x17ac17=_0x4b24[_0x4d3bbd];return _0x17ac17;};'use strict';var Sequelize=require(_0x44b2('0x0'));module[_0x44b2('0x1')]={'name':{'type':Sequelize[_0x44b2('0x2')],'unique':_0x44b2('0x3'),'allowNull':![],'validate':{'notEmpty':!![]}},'vat':{'type':Sequelize[_0x44b2('0x2')]},'companyId':{'type':Sequelize[_0x44b2('0x2')]},'website':{'type':Sequelize[_0x44b2('0x2')]},'phone':{'type':Sequelize[_0x44b2('0x2')]},'fax':{'type':Sequelize[_0x44b2('0x2')]},'type':{'type':Sequelize[_0x44b2('0x2')]},'street':{'type':Sequelize[_0x44b2('0x2')]},'postalCode':{'type':Sequelize[_0x44b2('0x2')]},'city':{'type':Sequelize[_0x44b2('0x2')]},'country':{'type':Sequelize[_0x44b2('0x2')]},'email':{'type':Sequelize['STRING'],'validate':{'isEmail':!![]}},'emailDomain':{'type':Sequelize[_0x44b2('0x2')]},'sStreet':{'type':Sequelize[_0x44b2('0x2')]},'sPostalCode':{'type':Sequelize['STRING']},'sCity':{'type':Sequelize[_0x44b2('0x2')]},'sCountry':{'type':Sequelize[_0x44b2('0x2')]},'description':{'type':Sequelize[_0x44b2('0x2')]}}; \ No newline at end of file +var _0x1e65=['STRING','sequelize','exports','name'];(function(_0xfba4ad,_0x4b1876){var _0x106b51=function(_0x268bb2){while(--_0x268bb2){_0xfba4ad['push'](_0xfba4ad['shift']());}};_0x106b51(++_0x4b1876);}(_0x1e65,0xed));var _0x51e6=function(_0x4b06ad,_0x1c8583){_0x4b06ad=_0x4b06ad-0x0;var _0x24f38e=_0x1e65[_0x4b06ad];return _0x24f38e;};'use strict';var Sequelize=require(_0x51e6('0x0'));module[_0x51e6('0x1')]={'name':{'type':Sequelize['STRING'],'unique':_0x51e6('0x2'),'allowNull':![],'validate':{'notEmpty':!![]}},'vat':{'type':Sequelize[_0x51e6('0x3')]},'companyId':{'type':Sequelize[_0x51e6('0x3')]},'website':{'type':Sequelize[_0x51e6('0x3')]},'phone':{'type':Sequelize['STRING']},'fax':{'type':Sequelize[_0x51e6('0x3')]},'type':{'type':Sequelize['STRING']},'street':{'type':Sequelize['STRING']},'postalCode':{'type':Sequelize[_0x51e6('0x3')]},'city':{'type':Sequelize[_0x51e6('0x3')]},'country':{'type':Sequelize[_0x51e6('0x3')]},'email':{'type':Sequelize[_0x51e6('0x3')],'validate':{'isEmail':!![]}},'emailDomain':{'type':Sequelize[_0x51e6('0x3')]},'sStreet':{'type':Sequelize[_0x51e6('0x3')]},'sPostalCode':{'type':Sequelize[_0x51e6('0x3')]},'sCity':{'type':Sequelize[_0x51e6('0x3')]},'sCountry':{'type':Sequelize[_0x51e6('0x3')]},'description':{'type':Sequelize[_0x51e6('0x3')]}}; \ No newline at end of file diff --git a/server/api/cmCompany/cmCompany.controller.js b/server/api/cmCompany/cmCompany.controller.js index 4c59f05..3fbb6ee 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 _0x5740=['pick','filters','filter','where','merge','map','options','includeAll','findAll','catch','params','rawAttributes','include','find','create','user','Unable\x20to\x20retrieve\x20the\x20current\x20user','role','Companies','UserProfileSection','userProfileId','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','body','describe','addContacts','CmContact','ids','omit','findOne','rimraf','zip-dir','fast-json-patch','request-promise','moment','bluebird','mustache','util','sox','to-csv','fs-extra','lodash','crypto','jsforce','desk.js','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','sendStatus','json','offset','undefined','count','limit','status','set','apply','reject','save','update','then','get','UserProfileResource','destroy','end','error','stack','name','send','index','CmCompany','keys','query','intersection','model','fields','attributes','length','nolimit','order','sort'];(function(_0x442a5d,_0x2a6745){var _0x51d134=function(_0x5cae90){while(--_0x5cae90){_0x442a5d['push'](_0x442a5d['shift']());}};_0x51d134(++_0x2a6745);}(_0x5740,0x1da));var _0x0574=function(_0xb605ce,_0x10574f){_0xb605ce=_0xb605ce-0x0;var _0x5059a5=_0x5740[_0xb605ce];return _0x5059a5;};'use strict';var emlformat=require('eml-format');var rimraf=require(_0x0574('0x0'));var zipdir=require(_0x0574('0x1'));var jsonpatch=require(_0x0574('0x2'));var rp=require(_0x0574('0x3'));var moment=require(_0x0574('0x4'));var BPromise=require(_0x0574('0x5'));var Mustache=require(_0x0574('0x6'));var util=require(_0x0574('0x7'));var path=require('path');var sox=require(_0x0574('0x8'));var csv=require(_0x0574('0x9'));var ejs=require('ejs');var fs=require('fs');var fs_extra=require(_0x0574('0xa'));var _=require(_0x0574('0xb'));var squel=require('squel');var crypto=require(_0x0574('0xc'));var jsforce=require(_0x0574('0xd'));var deskjs=require(_0x0574('0xe'));var toCsv=require(_0x0574('0x9'));var querystring=require(_0x0574('0xf'));var Papa=require(_0x0574('0x10'));var Redis=require(_0x0574('0x11'));var authService=require(_0x0574('0x12'));var qs=require('../../components/parsers/qs');var as=require(_0x0574('0x13'));var hardwareService=require(_0x0574('0x14'));var logger=require(_0x0574('0x15'))(_0x0574('0x16'));var utils=require(_0x0574('0x17'));var config=require(_0x0574('0x18'));var licenseUtil=require(_0x0574('0x19'));var db=require(_0x0574('0x1a'))['db'];function respondWithStatusCode(_0x4cd8bd,_0x55eea){_0x55eea=_0x55eea||0xcc;return function(_0x327010){if(_0x327010){return _0x4cd8bd[_0x0574('0x1b')](_0x55eea);}return _0x4cd8bd['status'](_0x55eea)['end']();};}function respondWithResult(_0x330a8a,_0x3b0284){_0x3b0284=_0x3b0284||0xc8;return function(_0x3ea8e6){if(_0x3ea8e6){return _0x330a8a['status'](_0x3b0284)[_0x0574('0x1c')](_0x3ea8e6);}};}function respondWithFilteredResult(_0x5b427c,_0x428808){return function(_0x4d5682){if(_0x4d5682){var _0x264a06=typeof _0x428808[_0x0574('0x1d')]==='undefined'&&typeof _0x428808['limit']===_0x0574('0x1e');var _0x563b63=_0x4d5682['count'];var _0x38fb12=_0x264a06?0x0:_0x428808['offset'];var _0x2d23e2=_0x264a06?_0x4d5682[_0x0574('0x1f')]:_0x428808['offset']+_0x428808[_0x0574('0x20')];var _0x2b195d;if(_0x2d23e2>=_0x563b63){_0x2d23e2=_0x563b63;_0x2b195d=0xc8;}else{_0x2b195d=0xce;}_0x5b427c[_0x0574('0x21')](_0x2b195d);return _0x5b427c[_0x0574('0x22')]('Content-Range',_0x38fb12+'-'+_0x2d23e2+'/'+_0x563b63)['json'](_0x4d5682);}return null;};}function patchUpdates(_0x16edbd){return function(_0x4ba864){try{jsonpatch[_0x0574('0x23')](_0x4ba864,_0x16edbd,!![]);}catch(_0x3dec80){return BPromise[_0x0574('0x24')](_0x3dec80);}return _0x4ba864[_0x0574('0x25')]();};}function saveUpdates(_0xb084c8,_0x56ed0c){return function(_0x3acdf2){if(_0x3acdf2){return _0x3acdf2[_0x0574('0x26')](_0xb084c8)[_0x0574('0x27')](function(_0x382436){return _0x382436;});}return null;};}function removeEntity(_0x48acad,_0x441fd1){return function(_0x3f78ed){if(_0x3f78ed){return _0x3f78ed['destroy']()[_0x0574('0x27')](function(){var _0x5c80a6=_0x3f78ed[_0x0574('0x28')]({'plain':!![]});var _0x42094b='Companies';return db[_0x0574('0x29')][_0x0574('0x2a')]({'where':{'type':_0x42094b,'resourceId':_0x5c80a6['id']}})['then'](function(){return _0x3f78ed;});})[_0x0574('0x27')](function(){_0x48acad[_0x0574('0x21')](0xcc)[_0x0574('0x2b')]();});}};}function handleEntityNotFound(_0x69a52e,_0x44d3d2){return function(_0x7b88f6){if(!_0x7b88f6){_0x69a52e[_0x0574('0x1b')](0x194);}return _0x7b88f6;};}function handleError(_0xdc1210,_0x36ad89){_0x36ad89=_0x36ad89||0x1f4;return function(_0x282f0d){logger[_0x0574('0x2c')](_0x282f0d[_0x0574('0x2d')]);if(_0x282f0d[_0x0574('0x2e')]){delete _0x282f0d[_0x0574('0x2e')];}_0xdc1210[_0x0574('0x21')](_0x36ad89)[_0x0574('0x2f')](_0x282f0d);};}exports[_0x0574('0x30')]=function(_0x5b74a3,_0x39a086){var _0x261e64={},_0x2ec64d={},_0x91c652={'count':0x0,'rows':[]};return db[_0x0574('0x31')]['describe']()[_0x0574('0x27')](function(_0x25ab5c){_0x2ec64d['model']=_[_0x0574('0x32')](_0x25ab5c);_0x2ec64d[_0x0574('0x33')]=_[_0x0574('0x32')](_0x5b74a3[_0x0574('0x33')]);_0x2ec64d['filters']=_[_0x0574('0x34')](_0x2ec64d[_0x0574('0x35')],_0x2ec64d['query']);_0x261e64['attributes']=_[_0x0574('0x34')](_0x2ec64d[_0x0574('0x35')],qs['fields'](_0x5b74a3['query'][_0x0574('0x36')]));_0x261e64[_0x0574('0x37')]=_0x261e64[_0x0574('0x37')][_0x0574('0x38')]?_0x261e64[_0x0574('0x37')]:_0x2ec64d[_0x0574('0x35')];if(!_0x5b74a3[_0x0574('0x33')]['hasOwnProperty'](_0x0574('0x39'))){_0x261e64[_0x0574('0x20')]=qs[_0x0574('0x20')](_0x5b74a3[_0x0574('0x33')][_0x0574('0x20')]);_0x261e64[_0x0574('0x1d')]=qs[_0x0574('0x1d')](_0x5b74a3[_0x0574('0x33')][_0x0574('0x1d')]);}_0x261e64[_0x0574('0x3a')]=qs['sort'](_0x5b74a3['query'][_0x0574('0x3b')]);_0x261e64['where']=qs['filters'](_[_0x0574('0x3c')](_0x5b74a3[_0x0574('0x33')],_0x2ec64d[_0x0574('0x3d')]),_0x25ab5c);if(_0x5b74a3[_0x0574('0x33')][_0x0574('0x3e')]){_0x261e64[_0x0574('0x3f')]=_[_0x0574('0x40')](_0x261e64[_0x0574('0x3f')],{'$or':_[_0x0574('0x41')](_0x261e64['attributes'],function(_0x4ab5cc){var _0x42256c={};_0x42256c[_0x4ab5cc]={'$like':'%'+_0x5b74a3[_0x0574('0x33')][_0x0574('0x3e')]+'%'};return _0x42256c;})});}_0x261e64=_[_0x0574('0x40')]({},_0x261e64,_0x5b74a3[_0x0574('0x42')]);var _0x2e8bf8={'where':_0x261e64[_0x0574('0x3f')]};return db[_0x0574('0x31')][_0x0574('0x1f')](_0x2e8bf8)[_0x0574('0x27')](function(_0x5494de){_0x91c652[_0x0574('0x1f')]=_0x5494de;if(_0x5b74a3[_0x0574('0x33')][_0x0574('0x43')]){_0x261e64['include']=[{'all':!![]}];}return db['CmCompany'][_0x0574('0x44')](_0x261e64);})[_0x0574('0x27')](function(_0x47eb74){_0x91c652['rows']=_0x47eb74;return _0x91c652;})['then'](respondWithFilteredResult(_0x39a086,_0x261e64))[_0x0574('0x45')](handleError(_0x39a086,null));})[_0x0574('0x45')](handleError(_0x39a086,null));};exports['show']=function(_0x4ee34e,_0x4efd8f){var _0x408847={'raw':![],'where':{'id':_0x4ee34e[_0x0574('0x46')]['id']}},_0x3e748a={};_0x3e748a['model']=_['keys'](db[_0x0574('0x31')][_0x0574('0x47')]);_0x3e748a[_0x0574('0x33')]=_[_0x0574('0x32')](_0x4ee34e[_0x0574('0x33')]);_0x3e748a[_0x0574('0x3d')]=_[_0x0574('0x34')](_0x3e748a[_0x0574('0x35')],_0x3e748a['query']);_0x408847[_0x0574('0x37')]=_[_0x0574('0x34')](_0x3e748a[_0x0574('0x35')],qs[_0x0574('0x36')](_0x4ee34e[_0x0574('0x33')][_0x0574('0x36')]));_0x408847['attributes']=_0x408847[_0x0574('0x37')][_0x0574('0x38')]?_0x408847[_0x0574('0x37')]:_0x3e748a['model'];if(_0x4ee34e[_0x0574('0x33')]['includeAll']){_0x408847[_0x0574('0x48')]=[{'all':!![]}];}_0x408847=_[_0x0574('0x40')]({},_0x408847,_0x4ee34e[_0x0574('0x42')]);return db['CmCompany'][_0x0574('0x49')](_0x408847)[_0x0574('0x27')](handleEntityNotFound(_0x4efd8f,null))['then'](respondWithResult(_0x4efd8f,null))['catch'](handleError(_0x4efd8f,null));};exports[_0x0574('0x4a')]=function(_0x15e021,_0x31a774){return db[_0x0574('0x31')][_0x0574('0x4a')](_0x15e021['body'],{})[_0x0574('0x27')](function(_0x4cae91){var _0x2ebb03=_0x15e021[_0x0574('0x4b')][_0x0574('0x28')]({'plain':!![]});if(!_0x2ebb03)throw new Error(_0x0574('0x4c'));if(_0x2ebb03[_0x0574('0x4d')]===_0x0574('0x4b')){var _0x176ea1=_0x4cae91['get']({'plain':!![]});var _0x125739=_0x0574('0x4e');return db[_0x0574('0x4f')][_0x0574('0x49')]({'where':{'name':_0x125739,'userProfileId':_0x2ebb03[_0x0574('0x50')]},'raw':!![]})['then'](function(_0xc40486){if(_0xc40486&&_0xc40486['autoAssociation']===0x0){return db[_0x0574('0x29')][_0x0574('0x4a')]({'name':_0x176ea1['name'],'resourceId':_0x176ea1['id'],'type':_0xc40486[_0x0574('0x2e')],'sectionId':_0xc40486['id']},{})[_0x0574('0x27')](function(){return _0x4cae91;});}else{return _0x4cae91;}})[_0x0574('0x45')](function(_0x324557){logger[_0x0574('0x2c')](_0x0574('0x51'),_0x324557);throw _0x324557;});}return _0x4cae91;})[_0x0574('0x27')](respondWithResult(_0x31a774,0xc9))[_0x0574('0x45')](handleError(_0x31a774,null));};exports[_0x0574('0x26')]=function(_0x581e2c,_0x32b9a8){if(_0x581e2c['body']['id']){delete _0x581e2c['body']['id'];}return db['CmCompany']['find']({'where':{'id':_0x581e2c[_0x0574('0x46')]['id']}})[_0x0574('0x27')](handleEntityNotFound(_0x32b9a8,null))[_0x0574('0x27')](saveUpdates(_0x581e2c[_0x0574('0x52')],null))[_0x0574('0x27')](respondWithResult(_0x32b9a8,null))['catch'](handleError(_0x32b9a8,null));};exports['destroy']=function(_0x5750f6,_0x3831d7){return db[_0x0574('0x31')]['find']({'where':{'id':_0x5750f6[_0x0574('0x46')]['id']}})[_0x0574('0x27')](handleEntityNotFound(_0x3831d7,null))[_0x0574('0x27')](removeEntity(_0x3831d7,null))[_0x0574('0x45')](handleError(_0x3831d7,null));};exports['describe']=function(_0x10ed3f,_0x3cee84){return db[_0x0574('0x31')][_0x0574('0x53')]()[_0x0574('0x27')](respondWithResult(_0x3cee84,null))[_0x0574('0x45')](handleError(_0x3cee84,null));};exports[_0x0574('0x54')]=function(_0x5d3e29,_0x4979ce,_0xd460a0){return db[_0x0574('0x55')][_0x0574('0x49')]({'where':{'id':_0x5d3e29[_0x0574('0x46')]['id']}})[_0x0574('0x27')](handleEntityNotFound(_0x4979ce,null))[_0x0574('0x27')](function(_0x545d90){if(_0x545d90){return _0x545d90[_0x0574('0x54')](_0x5d3e29[_0x0574('0x52')][_0x0574('0x56')],_[_0x0574('0x57')](_0x5d3e29[_0x0574('0x52')],[_0x0574('0x56'),'id'])||{});}})['then'](respondWithResult(_0x4979ce,null))['catch'](handleError(_0x4979ce,null));};exports['getContacts']=function(_0x2c79eb,_0x1db6b0,_0x16e88f){var _0x40858b={};var _0x22dbaf={};var _0x127bae;var _0x191e4e;return db[_0x0574('0x31')][_0x0574('0x58')]({'where':{'id':_0x2c79eb[_0x0574('0x46')]['id']}})[_0x0574('0x27')](handleEntityNotFound(_0x1db6b0,null))['then'](function(_0x54523a){if(_0x54523a){_0x127bae=_0x54523a;_0x22dbaf[_0x0574('0x35')]=_[_0x0574('0x32')](db[_0x0574('0x55')][_0x0574('0x47')]);_0x22dbaf[_0x0574('0x33')]=_[_0x0574('0x32')](_0x2c79eb[_0x0574('0x33')]);_0x22dbaf['filters']=_['intersection'](_0x22dbaf['model'],_0x22dbaf[_0x0574('0x33')]);_0x40858b[_0x0574('0x37')]=_[_0x0574('0x34')](_0x22dbaf[_0x0574('0x35')],qs['fields'](_0x2c79eb[_0x0574('0x33')][_0x0574('0x36')]));_0x40858b[_0x0574('0x37')]=_0x40858b[_0x0574('0x37')]['length']?_0x40858b[_0x0574('0x37')]:_0x22dbaf[_0x0574('0x35')];_0x40858b[_0x0574('0x3a')]=qs[_0x0574('0x3b')](_0x2c79eb[_0x0574('0x33')]['sort']);_0x40858b[_0x0574('0x3f')]=qs['filters'](_[_0x0574('0x3c')](_0x2c79eb[_0x0574('0x33')],_0x22dbaf[_0x0574('0x3d')]));if(_0x2c79eb[_0x0574('0x33')][_0x0574('0x3e')]){_0x40858b['where']=_['merge'](_0x40858b[_0x0574('0x3f')],{'$or':_[_0x0574('0x41')](_0x40858b[_0x0574('0x37')],function(_0x562ef7){var _0x1661a1={};_0x1661a1[_0x562ef7]={'$like':'%'+_0x2c79eb[_0x0574('0x33')][_0x0574('0x3e')]+'%'};return _0x1661a1;})});}_0x40858b=_['merge']({},_0x40858b,_0x2c79eb[_0x0574('0x42')]);return _0x127bae['getContacts'](_0x40858b);}})[_0x0574('0x27')](function(_0x290398){if(_0x290398){_0x191e4e=_0x290398[_0x0574('0x38')];if(!_0x2c79eb[_0x0574('0x33')]['hasOwnProperty'](_0x0574('0x39'))){_0x40858b['limit']=qs[_0x0574('0x20')](_0x2c79eb['query'][_0x0574('0x20')]);_0x40858b[_0x0574('0x1d')]=qs[_0x0574('0x1d')](_0x2c79eb[_0x0574('0x33')]['offset']);}return _0x127bae['getContacts'](_0x40858b);}})[_0x0574('0x27')](function(_0x9480c5){if(_0x9480c5){return _0x9480c5?{'count':_0x191e4e,'rows':_0x9480c5}:null;}})[_0x0574('0x27')](respondWithResult(_0x1db6b0,null))['catch'](handleError(_0x1db6b0,null));}; \ No newline at end of file +var _0x7b24=['merge','options','CmCompany','includeAll','include','findAll','rows','catch','show','rawAttributes','length','find','create','role','user','UserProfileSection','userProfileId','autoAssociation','body','params','describe','CmContact','ids','getContacts','findOne','filter','hasOwnProperty','eml-format','rimraf','zip-dir','bluebird','sox','to-csv','ejs','fs-extra','lodash','squel','crypto','jsforce','desk.js','querystring','papaparse','ioredis','../../components/parsers/advancedSearch','../../config/license/hardware','api','../../config/environment','../../config/license/util','../../mysqldb','sendStatus','status','end','json','offset','undefined','limit','count','Content-Range','apply','save','then','destroy','get','Companies','UserProfileResource','error','stack','name','send','model','query','keys','filters','intersection','attributes','fields','order','sort','where','pick'];(function(_0x199572,_0x33e667){var _0x13cfa3=function(_0x53c075){while(--_0x53c075){_0x199572['push'](_0x199572['shift']());}};_0x13cfa3(++_0x33e667);}(_0x7b24,0x10b));var _0x47b2=function(_0x65665,_0x3f2a13){_0x65665=_0x65665-0x0;var _0x196bce=_0x7b24[_0x65665];return _0x196bce;};'use strict';var emlformat=require(_0x47b2('0x0'));var rimraf=require(_0x47b2('0x1'));var zipdir=require(_0x47b2('0x2'));var jsonpatch=require('fast-json-patch');var rp=require('request-promise');var moment=require('moment');var BPromise=require(_0x47b2('0x3'));var Mustache=require('mustache');var util=require('util');var path=require('path');var sox=require(_0x47b2('0x4'));var csv=require(_0x47b2('0x5'));var ejs=require(_0x47b2('0x6'));var fs=require('fs');var fs_extra=require(_0x47b2('0x7'));var _=require(_0x47b2('0x8'));var squel=require(_0x47b2('0x9'));var crypto=require(_0x47b2('0xa'));var jsforce=require(_0x47b2('0xb'));var deskjs=require(_0x47b2('0xc'));var toCsv=require('to-csv');var querystring=require(_0x47b2('0xd'));var Papa=require(_0x47b2('0xe'));var Redis=require(_0x47b2('0xf'));var authService=require('../../components/auth/service');var qs=require('../../components/parsers/qs');var as=require(_0x47b2('0x10'));var hardwareService=require(_0x47b2('0x11'));var logger=require('../../config/logger')(_0x47b2('0x12'));var utils=require('../../config/utils');var config=require(_0x47b2('0x13'));var licenseUtil=require(_0x47b2('0x14'));var db=require(_0x47b2('0x15'))['db'];function respondWithStatusCode(_0x1be636,_0xc69301){_0xc69301=_0xc69301||0xcc;return function(_0x34b6be){if(_0x34b6be){return _0x1be636[_0x47b2('0x16')](_0xc69301);}return _0x1be636[_0x47b2('0x17')](_0xc69301)[_0x47b2('0x18')]();};}function respondWithResult(_0x54ce65,_0xf20084){_0xf20084=_0xf20084||0xc8;return function(_0x5afda9){if(_0x5afda9){return _0x54ce65['status'](_0xf20084)[_0x47b2('0x19')](_0x5afda9);}};}function respondWithFilteredResult(_0x3fee6e,_0x1f236e){return function(_0x3b6552){if(_0x3b6552){var _0xd25f6f=typeof _0x1f236e[_0x47b2('0x1a')]===_0x47b2('0x1b')&&typeof _0x1f236e[_0x47b2('0x1c')]==='undefined';var _0x2d58c6=_0x3b6552[_0x47b2('0x1d')];var _0x288d21=_0xd25f6f?0x0:_0x1f236e['offset'];var _0x232831=_0xd25f6f?_0x3b6552[_0x47b2('0x1d')]:_0x1f236e[_0x47b2('0x1a')]+_0x1f236e['limit'];var _0x44b90b;if(_0x232831>=_0x2d58c6){_0x232831=_0x2d58c6;_0x44b90b=0xc8;}else{_0x44b90b=0xce;}_0x3fee6e[_0x47b2('0x17')](_0x44b90b);return _0x3fee6e['set'](_0x47b2('0x1e'),_0x288d21+'-'+_0x232831+'/'+_0x2d58c6)[_0x47b2('0x19')](_0x3b6552);}return null;};}function patchUpdates(_0x38b5c2){return function(_0x339da8){try{jsonpatch[_0x47b2('0x1f')](_0x339da8,_0x38b5c2,!![]);}catch(_0x3d73be){return BPromise['reject'](_0x3d73be);}return _0x339da8[_0x47b2('0x20')]();};}function saveUpdates(_0x1e16d9,_0x4012e2){return function(_0x3ae82e){if(_0x3ae82e){return _0x3ae82e['update'](_0x1e16d9)[_0x47b2('0x21')](function(_0x14eca3){return _0x14eca3;});}return null;};}function removeEntity(_0x3b025d,_0x2c58bf){return function(_0x4ef60d){if(_0x4ef60d){return _0x4ef60d[_0x47b2('0x22')]()['then'](function(){var _0x5209bc=_0x4ef60d[_0x47b2('0x23')]({'plain':!![]});var _0x399754=_0x47b2('0x24');return db[_0x47b2('0x25')][_0x47b2('0x22')]({'where':{'type':_0x399754,'resourceId':_0x5209bc['id']}})[_0x47b2('0x21')](function(){return _0x4ef60d;});})[_0x47b2('0x21')](function(){_0x3b025d[_0x47b2('0x17')](0xcc)[_0x47b2('0x18')]();});}};}function handleEntityNotFound(_0x1df5ac,_0x131c08){return function(_0x2a6f3d){if(!_0x2a6f3d){_0x1df5ac[_0x47b2('0x16')](0x194);}return _0x2a6f3d;};}function handleError(_0x5a552a,_0x41ede6){_0x41ede6=_0x41ede6||0x1f4;return function(_0x43f943){logger[_0x47b2('0x26')](_0x43f943[_0x47b2('0x27')]);if(_0x43f943[_0x47b2('0x28')]){delete _0x43f943[_0x47b2('0x28')];}_0x5a552a[_0x47b2('0x17')](_0x41ede6)[_0x47b2('0x29')](_0x43f943);};}exports['index']=function(_0x25dbba,_0x150899){var _0x1a38d9={},_0x4eb455={},_0x531414={'count':0x0,'rows':[]};return db['CmCompany']['describe']()[_0x47b2('0x21')](function(_0x13a398){_0x4eb455[_0x47b2('0x2a')]=_['keys'](_0x13a398);_0x4eb455[_0x47b2('0x2b')]=_[_0x47b2('0x2c')](_0x25dbba[_0x47b2('0x2b')]);_0x4eb455[_0x47b2('0x2d')]=_[_0x47b2('0x2e')](_0x4eb455[_0x47b2('0x2a')],_0x4eb455['query']);_0x1a38d9[_0x47b2('0x2f')]=_[_0x47b2('0x2e')](_0x4eb455[_0x47b2('0x2a')],qs[_0x47b2('0x30')](_0x25dbba[_0x47b2('0x2b')][_0x47b2('0x30')]));_0x1a38d9['attributes']=_0x1a38d9[_0x47b2('0x2f')]['length']?_0x1a38d9[_0x47b2('0x2f')]:_0x4eb455[_0x47b2('0x2a')];if(!_0x25dbba['query']['hasOwnProperty']('nolimit')){_0x1a38d9[_0x47b2('0x1c')]=qs[_0x47b2('0x1c')](_0x25dbba[_0x47b2('0x2b')][_0x47b2('0x1c')]);_0x1a38d9['offset']=qs['offset'](_0x25dbba['query'][_0x47b2('0x1a')]);}_0x1a38d9[_0x47b2('0x31')]=qs[_0x47b2('0x32')](_0x25dbba[_0x47b2('0x2b')][_0x47b2('0x32')]);_0x1a38d9[_0x47b2('0x33')]=qs['filters'](_[_0x47b2('0x34')](_0x25dbba['query'],_0x4eb455[_0x47b2('0x2d')]),_0x13a398);if(_0x25dbba[_0x47b2('0x2b')]['filter']){_0x1a38d9[_0x47b2('0x33')]=_[_0x47b2('0x35')](_0x1a38d9[_0x47b2('0x33')],{'$or':_['map'](_0x1a38d9[_0x47b2('0x2f')],function(_0x11e9db){var _0xe942cb={};_0xe942cb[_0x11e9db]={'$like':'%'+_0x25dbba['query']['filter']+'%'};return _0xe942cb;})});}_0x1a38d9=_['merge']({},_0x1a38d9,_0x25dbba[_0x47b2('0x36')]);var _0x59540a={'where':_0x1a38d9['where']};return db[_0x47b2('0x37')]['count'](_0x59540a)['then'](function(_0x31f3dd){_0x531414[_0x47b2('0x1d')]=_0x31f3dd;if(_0x25dbba[_0x47b2('0x2b')][_0x47b2('0x38')]){_0x1a38d9[_0x47b2('0x39')]=[{'all':!![]}];}return db['CmCompany'][_0x47b2('0x3a')](_0x1a38d9);})[_0x47b2('0x21')](function(_0x411dee){_0x531414[_0x47b2('0x3b')]=_0x411dee;return _0x531414;})[_0x47b2('0x21')](respondWithFilteredResult(_0x150899,_0x1a38d9))[_0x47b2('0x3c')](handleError(_0x150899,null));})[_0x47b2('0x3c')](handleError(_0x150899,null));};exports[_0x47b2('0x3d')]=function(_0x2095ae,_0x33d2da){var _0x576677={'raw':![],'where':{'id':_0x2095ae['params']['id']}},_0x3c7834={};_0x3c7834[_0x47b2('0x2a')]=_[_0x47b2('0x2c')](db[_0x47b2('0x37')][_0x47b2('0x3e')]);_0x3c7834[_0x47b2('0x2b')]=_[_0x47b2('0x2c')](_0x2095ae[_0x47b2('0x2b')]);_0x3c7834['filters']=_[_0x47b2('0x2e')](_0x3c7834[_0x47b2('0x2a')],_0x3c7834[_0x47b2('0x2b')]);_0x576677[_0x47b2('0x2f')]=_['intersection'](_0x3c7834[_0x47b2('0x2a')],qs[_0x47b2('0x30')](_0x2095ae['query']['fields']));_0x576677[_0x47b2('0x2f')]=_0x576677['attributes'][_0x47b2('0x3f')]?_0x576677[_0x47b2('0x2f')]:_0x3c7834[_0x47b2('0x2a')];if(_0x2095ae[_0x47b2('0x2b')]['includeAll']){_0x576677[_0x47b2('0x39')]=[{'all':!![]}];}_0x576677=_['merge']({},_0x576677,_0x2095ae[_0x47b2('0x36')]);return db['CmCompany'][_0x47b2('0x40')](_0x576677)['then'](handleEntityNotFound(_0x33d2da,null))['then'](respondWithResult(_0x33d2da,null))['catch'](handleError(_0x33d2da,null));};exports[_0x47b2('0x41')]=function(_0x699a57,_0x18a6ea){return db['CmCompany'][_0x47b2('0x41')](_0x699a57['body'],{})[_0x47b2('0x21')](function(_0x114169){var _0x23906a=_0x699a57['user'][_0x47b2('0x23')]({'plain':!![]});if(!_0x23906a)throw new Error('Unable\x20to\x20retrieve\x20the\x20current\x20user');if(_0x23906a[_0x47b2('0x42')]===_0x47b2('0x43')){var _0x337af8=_0x114169[_0x47b2('0x23')]({'plain':!![]});var _0x2894c5=_0x47b2('0x24');return db[_0x47b2('0x44')][_0x47b2('0x40')]({'where':{'name':_0x2894c5,'userProfileId':_0x23906a[_0x47b2('0x45')]},'raw':!![]})[_0x47b2('0x21')](function(_0x4c606b){if(_0x4c606b&&_0x4c606b[_0x47b2('0x46')]===0x0){return db[_0x47b2('0x25')]['create']({'name':_0x337af8['name'],'resourceId':_0x337af8['id'],'type':_0x4c606b['name'],'sectionId':_0x4c606b['id']},{})[_0x47b2('0x21')](function(){return _0x114169;});}else{return _0x114169;}})['catch'](function(_0x128683){logger[_0x47b2('0x26')]('Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s',_0x128683);throw _0x128683;});}return _0x114169;})[_0x47b2('0x21')](respondWithResult(_0x18a6ea,0xc9))[_0x47b2('0x3c')](handleError(_0x18a6ea,null));};exports['update']=function(_0xa5e121,_0x42482b){if(_0xa5e121[_0x47b2('0x47')]['id']){delete _0xa5e121[_0x47b2('0x47')]['id'];}return db[_0x47b2('0x37')][_0x47b2('0x40')]({'where':{'id':_0xa5e121[_0x47b2('0x48')]['id']}})[_0x47b2('0x21')](handleEntityNotFound(_0x42482b,null))[_0x47b2('0x21')](saveUpdates(_0xa5e121[_0x47b2('0x47')],null))[_0x47b2('0x21')](respondWithResult(_0x42482b,null))[_0x47b2('0x3c')](handleError(_0x42482b,null));};exports[_0x47b2('0x22')]=function(_0x415722,_0x1197a7){return db[_0x47b2('0x37')]['find']({'where':{'id':_0x415722['params']['id']}})[_0x47b2('0x21')](handleEntityNotFound(_0x1197a7,null))[_0x47b2('0x21')](removeEntity(_0x1197a7,null))[_0x47b2('0x3c')](handleError(_0x1197a7,null));};exports['describe']=function(_0x55b082,_0x5399ff){return db['CmCompany'][_0x47b2('0x49')]()[_0x47b2('0x21')](respondWithResult(_0x5399ff,null))[_0x47b2('0x3c')](handleError(_0x5399ff,null));};exports['addContacts']=function(_0x4c9767,_0x5a4f32,_0x199357){return db[_0x47b2('0x4a')][_0x47b2('0x40')]({'where':{'id':_0x4c9767['params']['id']}})[_0x47b2('0x21')](handleEntityNotFound(_0x5a4f32,null))[_0x47b2('0x21')](function(_0x5055e5){if(_0x5055e5){return _0x5055e5['addContacts'](_0x4c9767[_0x47b2('0x47')][_0x47b2('0x4b')],_['omit'](_0x4c9767['body'],[_0x47b2('0x4b'),'id'])||{});}})[_0x47b2('0x21')](respondWithResult(_0x5a4f32,null))[_0x47b2('0x3c')](handleError(_0x5a4f32,null));};exports[_0x47b2('0x4c')]=function(_0xd52b90,_0xf94ea6,_0x36677b){var _0x54666b={};var _0x34cfcf={};var _0x5e892d;var _0x2fbc20;return db['CmCompany'][_0x47b2('0x4d')]({'where':{'id':_0xd52b90[_0x47b2('0x48')]['id']}})[_0x47b2('0x21')](handleEntityNotFound(_0xf94ea6,null))[_0x47b2('0x21')](function(_0x1e8dcd){if(_0x1e8dcd){_0x5e892d=_0x1e8dcd;_0x34cfcf[_0x47b2('0x2a')]=_[_0x47b2('0x2c')](db[_0x47b2('0x4a')][_0x47b2('0x3e')]);_0x34cfcf['query']=_[_0x47b2('0x2c')](_0xd52b90[_0x47b2('0x2b')]);_0x34cfcf[_0x47b2('0x2d')]=_[_0x47b2('0x2e')](_0x34cfcf[_0x47b2('0x2a')],_0x34cfcf[_0x47b2('0x2b')]);_0x54666b[_0x47b2('0x2f')]=_[_0x47b2('0x2e')](_0x34cfcf[_0x47b2('0x2a')],qs[_0x47b2('0x30')](_0xd52b90[_0x47b2('0x2b')]['fields']));_0x54666b['attributes']=_0x54666b[_0x47b2('0x2f')]['length']?_0x54666b[_0x47b2('0x2f')]:_0x34cfcf[_0x47b2('0x2a')];_0x54666b[_0x47b2('0x31')]=qs[_0x47b2('0x32')](_0xd52b90[_0x47b2('0x2b')][_0x47b2('0x32')]);_0x54666b[_0x47b2('0x33')]=qs[_0x47b2('0x2d')](_['pick'](_0xd52b90[_0x47b2('0x2b')],_0x34cfcf[_0x47b2('0x2d')]));if(_0xd52b90['query'][_0x47b2('0x4e')]){_0x54666b[_0x47b2('0x33')]=_['merge'](_0x54666b[_0x47b2('0x33')],{'$or':_['map'](_0x54666b['attributes'],function(_0x5cbc25){var _0x3f14d9={};_0x3f14d9[_0x5cbc25]={'$like':'%'+_0xd52b90['query'][_0x47b2('0x4e')]+'%'};return _0x3f14d9;})});}_0x54666b=_[_0x47b2('0x35')]({},_0x54666b,_0xd52b90['options']);return _0x5e892d[_0x47b2('0x4c')](_0x54666b);}})['then'](function(_0x454f19){if(_0x454f19){_0x2fbc20=_0x454f19[_0x47b2('0x3f')];if(!_0xd52b90[_0x47b2('0x2b')][_0x47b2('0x4f')]('nolimit')){_0x54666b['limit']=qs[_0x47b2('0x1c')](_0xd52b90[_0x47b2('0x2b')][_0x47b2('0x1c')]);_0x54666b[_0x47b2('0x1a')]=qs[_0x47b2('0x1a')](_0xd52b90['query'][_0x47b2('0x1a')]);}return _0x5e892d[_0x47b2('0x4c')](_0x54666b);}})[_0x47b2('0x21')](function(_0x1516e7){if(_0x1516e7){return _0x1516e7?{'count':_0x2fbc20,'rows':_0x1516e7}:null;}})[_0x47b2('0x21')](respondWithResult(_0xf94ea6,null))[_0x47b2('0x3c')](handleError(_0xf94ea6,null));}; \ No newline at end of file diff --git a/server/api/cmCompany/cmCompany.model.js b/server/api/cmCompany/cmCompany.model.js index b796dcb..4e4e621 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 _0x2e5c=['./cmCompany.attributes','exports','CmCompany','cm_companies','util','../../config/logger','api','moment','bluebird','request-promise','path','rimraf','../../config/environment'];(function(_0x2df507,_0x553862){var _0x1f7167=function(_0x11319e){while(--_0x11319e){_0x2df507['push'](_0x2df507['shift']());}};_0x1f7167(++_0x553862);}(_0x2e5c,0x1b1));var _0xc2e5=function(_0x39e283,_0x247e6b){_0x39e283=_0x39e283-0x0;var _0x7de89f=_0x2e5c[_0x39e283];return _0x7de89f;};'use strict';var _=require('lodash');var util=require(_0xc2e5('0x0'));var logger=require(_0xc2e5('0x1'))(_0xc2e5('0x2'));var moment=require(_0xc2e5('0x3'));var BPromise=require(_0xc2e5('0x4'));var rp=require(_0xc2e5('0x5'));var fs=require('fs');var path=require(_0xc2e5('0x6'));var rimraf=require(_0xc2e5('0x7'));var config=require(_0xc2e5('0x8'));var attributes=require(_0xc2e5('0x9'));module[_0xc2e5('0xa')]=function(_0x2403ea,_0x4f5389){return _0x2403ea['define'](_0xc2e5('0xb'),attributes,{'tableName':_0xc2e5('0xc'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x276c=['bluebird','request-promise','path','./cmCompany.attributes','exports','define','cm_companies','api','moment'];(function(_0x3dd15e,_0x1f0015){var _0x231fd0=function(_0x4f680a){while(--_0x4f680a){_0x3dd15e['push'](_0x3dd15e['shift']());}};_0x231fd0(++_0x1f0015);}(_0x276c,0x1e4));var _0xc276=function(_0x16240a,_0x4bb783){_0x16240a=_0x16240a-0x0;var _0x2969cc=_0x276c[_0x16240a];return _0x2969cc;};'use strict';var _=require('lodash');var util=require('util');var logger=require('../../config/logger')(_0xc276('0x0'));var moment=require(_0xc276('0x1'));var BPromise=require(_0xc276('0x2'));var rp=require(_0xc276('0x3'));var fs=require('fs');var path=require(_0xc276('0x4'));var rimraf=require('rimraf');var config=require('../../config/environment');var attributes=require(_0xc276('0x5'));module[_0xc276('0x6')]=function(_0x4cc878,_0x2952f0){return _0x4cc878[_0xc276('0x7')]('CmCompany',attributes,{'tableName':_0xc276('0x8'),'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 4012628..fe18070 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 _0x60c1=['util','moment','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','client','http','request','info','request\x20sent','debug','error','code','CmCompany,\x20%s,\x20%s','message','result','lodash'];(function(_0x356ed3,_0x4edc4a){var _0xcfbee=function(_0x432188){while(--_0x432188){_0x356ed3['push'](_0x356ed3['shift']());}};_0xcfbee(++_0x4edc4a);}(_0x60c1,0x149));var _0x160c=function(_0x413feb,_0x10477f){_0x413feb=_0x413feb-0x0;var _0x40ee88=_0x60c1[_0x413feb];return _0x40ee88;};'use strict';var _=require(_0x160c('0x0'));var util=require(_0x160c('0x1'));var moment=require(_0x160c('0x2'));var BPromise=require('bluebird');var rs=require(_0x160c('0x3'));var fs=require('fs');var Redis=require(_0x160c('0x4'));var db=require(_0x160c('0x5'))['db'];var utils=require(_0x160c('0x6'));var logger=require(_0x160c('0x7'))(_0x160c('0x8'));var config=require(_0x160c('0x9'));var jayson=require(_0x160c('0xa'));var client=jayson[_0x160c('0xb')][_0x160c('0xc')]({'port':0x232a});function respondWithRpcPromise(_0x5215a0,_0x4880de,_0x1911c0){return new BPromise(function(_0x21c4fd,_0x511c84){return client[_0x160c('0xd')](_0x5215a0,_0x1911c0)['then'](function(_0x3276bd){logger[_0x160c('0xe')]('CmCompany,\x20%s,\x20%s',_0x4880de,_0x160c('0xf'));logger[_0x160c('0x10')]('CmCompany,\x20%s,\x20%s,\x20%s',_0x4880de,'request\x20sent',JSON['stringify'](_0x3276bd));if(_0x3276bd[_0x160c('0x11')]){if(_0x3276bd[_0x160c('0x11')][_0x160c('0x12')]===0x1f4){logger[_0x160c('0x11')](_0x160c('0x13'),_0x4880de,_0x3276bd[_0x160c('0x11')][_0x160c('0x14')]);return _0x511c84(_0x3276bd[_0x160c('0x11')][_0x160c('0x14')]);}logger[_0x160c('0x11')](_0x160c('0x13'),_0x4880de,_0x3276bd['error'][_0x160c('0x14')]);return _0x21c4fd(_0x3276bd['error']['message']);}else{logger[_0x160c('0xe')](_0x160c('0x13'),_0x4880de,_0x160c('0xf'));_0x21c4fd(_0x3276bd[_0x160c('0x15')][_0x160c('0x14')]);}})['catch'](function(_0x499b0e){logger[_0x160c('0x11')]('CmCompany,\x20%s,\x20%s',_0x4880de,_0x499b0e);_0x511c84(_0x499b0e);});});} \ No newline at end of file +var _0x58c1=['info','CmCompany,\x20%s,\x20%s','request\x20sent','CmCompany,\x20%s,\x20%s,\x20%s','error','message','result','lodash','util','moment','bluebird','randomstring','../../mysqldb','../../config/utils','../../config/logger','rpc','jayson/promise','client','http','request'];(function(_0x443883,_0x33d373){var _0x531aa1=function(_0x2be24e){while(--_0x2be24e){_0x443883['push'](_0x443883['shift']());}};_0x531aa1(++_0x33d373);}(_0x58c1,0x11f));var _0x158c=function(_0xa90f2f,_0x48fe71){_0xa90f2f=_0xa90f2f-0x0;var _0x4da9e8=_0x58c1[_0xa90f2f];return _0x4da9e8;};'use strict';var _=require(_0x158c('0x0'));var util=require(_0x158c('0x1'));var moment=require(_0x158c('0x2'));var BPromise=require(_0x158c('0x3'));var rs=require(_0x158c('0x4'));var fs=require('fs');var Redis=require('ioredis');var db=require(_0x158c('0x5'))['db'];var utils=require(_0x158c('0x6'));var logger=require(_0x158c('0x7'))(_0x158c('0x8'));var config=require('../../config/environment');var jayson=require(_0x158c('0x9'));var client=jayson[_0x158c('0xa')][_0x158c('0xb')]({'port':0x232a});function respondWithRpcPromise(_0x203bbc,_0x5ca608,_0x1e3708){return new BPromise(function(_0x53ed71,_0x4d617f){return client[_0x158c('0xc')](_0x203bbc,_0x1e3708)['then'](function(_0x5c39f3){logger[_0x158c('0xd')](_0x158c('0xe'),_0x5ca608,_0x158c('0xf'));logger['debug'](_0x158c('0x10'),_0x5ca608,'request\x20sent',JSON['stringify'](_0x5c39f3));if(_0x5c39f3[_0x158c('0x11')]){if(_0x5c39f3[_0x158c('0x11')]['code']===0x1f4){logger['error'](_0x158c('0xe'),_0x5ca608,_0x5c39f3[_0x158c('0x11')][_0x158c('0x12')]);return _0x4d617f(_0x5c39f3[_0x158c('0x11')][_0x158c('0x12')]);}logger['error']('CmCompany,\x20%s,\x20%s',_0x5ca608,_0x5c39f3['error'][_0x158c('0x12')]);return _0x53ed71(_0x5c39f3[_0x158c('0x11')][_0x158c('0x12')]);}else{logger['info'](_0x158c('0xe'),_0x5ca608,_0x158c('0xf'));_0x53ed71(_0x5c39f3[_0x158c('0x13')][_0x158c('0x12')]);}})['catch'](function(_0x13d64e){logger['error'](_0x158c('0xe'),_0x5ca608,_0x13d64e);_0x4d617f(_0x13d64e);});});} \ No newline at end of file diff --git a/server/api/cmCompany/index.js b/server/api/cmCompany/index.js index caf8800..fad8412 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 _0x1918=['util','path','connect-timeout','express','Router','fs-extra','../../components/auth/service','../../components/interaction/service','./cmCompany.controller','isAuthenticated','index','get','/describe','describe','/:id','show','/:id/contacts','getContacts','post','create','put','update','delete','destroy','multer'];(function(_0x26d6d9,_0x431cb8){var _0x1b4875=function(_0x41111f){while(--_0x41111f){_0x26d6d9['push'](_0x26d6d9['shift']());}};_0x1b4875(++_0x431cb8);}(_0x1918,0xf9));var _0x8191=function(_0x2f2cfc,_0xde9da4){_0x2f2cfc=_0x2f2cfc-0x0;var _0x5a91e0=_0x1918[_0x2f2cfc];return _0x5a91e0;};'use strict';var multer=require(_0x8191('0x0'));var util=require(_0x8191('0x1'));var path=require(_0x8191('0x2'));var timeout=require(_0x8191('0x3'));var express=require(_0x8191('0x4'));var router=express[_0x8191('0x5')]();var fs_extra=require(_0x8191('0x6'));var auth=require(_0x8191('0x7'));var interaction=require(_0x8191('0x8'));var config=require('../../config/environment');var controller=require(_0x8191('0x9'));router['get']('/',auth[_0x8191('0xa')](),controller[_0x8191('0xb')]);router[_0x8191('0xc')](_0x8191('0xd'),auth[_0x8191('0xa')](),controller[_0x8191('0xe')]);router[_0x8191('0xc')](_0x8191('0xf'),auth[_0x8191('0xa')](),controller[_0x8191('0x10')]);router['get'](_0x8191('0x11'),auth[_0x8191('0xa')](),controller[_0x8191('0x12')]);router[_0x8191('0x13')]('/',auth[_0x8191('0xa')](),controller[_0x8191('0x14')]);router[_0x8191('0x13')](_0x8191('0x11'),auth[_0x8191('0xa')](),controller['addContacts']);router[_0x8191('0x15')](_0x8191('0xf'),auth['isAuthenticated'](),controller[_0x8191('0x16')]);router[_0x8191('0x17')](_0x8191('0xf'),auth[_0x8191('0xa')](),controller[_0x8191('0x18')]);module['exports']=router; \ No newline at end of file +var _0x9a55=['connect-timeout','express','fs-extra','../../config/environment','get','isAuthenticated','index','/describe','getContacts','post','create','addContacts','put','/:id','update','delete','exports','multer','path'];(function(_0x39deea,_0x522e8e){var _0x1f7dc3=function(_0x343115){while(--_0x343115){_0x39deea['push'](_0x39deea['shift']());}};_0x1f7dc3(++_0x522e8e);}(_0x9a55,0xe2));var _0x59a5=function(_0x2d04b4,_0x5419be){_0x2d04b4=_0x2d04b4-0x0;var _0x369e47=_0x9a55[_0x2d04b4];return _0x369e47;};'use strict';var multer=require(_0x59a5('0x0'));var util=require('util');var path=require(_0x59a5('0x1'));var timeout=require(_0x59a5('0x2'));var express=require(_0x59a5('0x3'));var router=express['Router']();var fs_extra=require(_0x59a5('0x4'));var auth=require('../../components/auth/service');var interaction=require('../../components/interaction/service');var config=require(_0x59a5('0x5'));var controller=require('./cmCompany.controller');router[_0x59a5('0x6')]('/',auth[_0x59a5('0x7')](),controller[_0x59a5('0x8')]);router[_0x59a5('0x6')](_0x59a5('0x9'),auth['isAuthenticated'](),controller['describe']);router[_0x59a5('0x6')]('/:id',auth['isAuthenticated'](),controller['show']);router[_0x59a5('0x6')]('/:id/contacts',auth[_0x59a5('0x7')](),controller[_0x59a5('0xa')]);router[_0x59a5('0xb')]('/',auth[_0x59a5('0x7')](),controller[_0x59a5('0xc')]);router[_0x59a5('0xb')]('/:id/contacts',auth['isAuthenticated'](),controller[_0x59a5('0xd')]);router[_0x59a5('0xe')](_0x59a5('0xf'),auth[_0x59a5('0x7')](),controller[_0x59a5('0x10')]);router[_0x59a5('0x11')](_0x59a5('0xf'),auth[_0x59a5('0x7')](),controller['destroy']);module[_0x59a5('0x12')]=router; \ No newline at end of file diff --git a/server/api/cmContact/cmContact.attributes.js b/server/api/cmContact/cmContact.attributes.js index 8349405..7c72482 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 _0x1136=['UNSIGNED','DATE','NOW','exports','STRING','TEXT','INTEGER'];(function(_0x46089c,_0x634395){var _0x3fa0ef=function(_0x2fef08){while(--_0x2fef08){_0x46089c['push'](_0x46089c['shift']());}};_0x3fa0ef(++_0x634395);}(_0x1136,0x13e));var _0x6113=function(_0x2dafbe,_0x5d04de){_0x2dafbe=_0x2dafbe-0x0;var _0x58a45a=_0x1136[_0x2dafbe];return _0x58a45a;};'use strict';var _=require('lodash');var Sequelize=require('sequelize');module[_0x6113('0x0')]={'firstName':{'type':Sequelize[_0x6113('0x1')],'allowNull':![]},'lastName':{'type':Sequelize[_0x6113('0x1')]},'street':{'type':Sequelize[_0x6113('0x1')]},'postalCode':{'type':Sequelize[_0x6113('0x1')]},'city':{'type':Sequelize[_0x6113('0x1')]},'country':{'type':Sequelize['STRING']},'dateOfBirth':{'type':Sequelize[_0x6113('0x1')]},'description':{'type':Sequelize[_0x6113('0x2')]},'phone':{'type':Sequelize['STRING']},'mobile':{'type':Sequelize[_0x6113('0x1')]},'fax':{'type':Sequelize[_0x6113('0x1')]},'email':{'type':Sequelize[_0x6113('0x1')]},'url':{'type':Sequelize['STRING']},'facebook':{'type':Sequelize[_0x6113('0x1')]},'fb_data':{'type':Sequelize['STRING']},'twitter':{'type':Sequelize[_0x6113('0x1')]},'skype':{'type':Sequelize[_0x6113('0x1')]},'teams':{'type':Sequelize[_0x6113('0x1')]},'viber':{'type':Sequelize[_0x6113('0x1')]},'line':{'type':Sequelize['STRING']},'wechat':{'type':Sequelize['STRING']},'telegram':{'type':Sequelize[_0x6113('0x1')]},'UserId':{'type':Sequelize[_0x6113('0x3')]},'AdditionalPhones':{'type':Sequelize['STRING']},'priority':{'type':Sequelize[_0x6113('0x3')](0x2)[_0x6113('0x4')],'defaultValue':0x2,'validate':{'min':0x0,'max':0x4}},'scheduledat':{'type':Sequelize[_0x6113('0x5')],'defaultValue':Sequelize[_0x6113('0x6')]},'dialTimezone':{'type':Sequelize[_0x6113('0x1')]},'utcOffset':{'type':Sequelize[_0x6113('0x3')]}}; \ No newline at end of file +var _0x8e97=['STRING','TEXT','INTEGER','DATE','NOW','lodash','sequelize'];(function(_0x35f496,_0x508ca8){var _0x314431=function(_0x3296fe){while(--_0x3296fe){_0x35f496['push'](_0x35f496['shift']());}};_0x314431(++_0x508ca8);}(_0x8e97,0x116));var _0x78e9=function(_0x46698a,_0x8de1e4){_0x46698a=_0x46698a-0x0;var _0x356db0=_0x8e97[_0x46698a];return _0x356db0;};'use strict';var _=require(_0x78e9('0x0'));var Sequelize=require(_0x78e9('0x1'));module['exports']={'firstName':{'type':Sequelize[_0x78e9('0x2')],'allowNull':![]},'lastName':{'type':Sequelize[_0x78e9('0x2')]},'street':{'type':Sequelize[_0x78e9('0x2')]},'postalCode':{'type':Sequelize[_0x78e9('0x2')]},'city':{'type':Sequelize['STRING']},'country':{'type':Sequelize[_0x78e9('0x2')]},'dateOfBirth':{'type':Sequelize['STRING']},'description':{'type':Sequelize[_0x78e9('0x3')]},'phone':{'type':Sequelize[_0x78e9('0x2')]},'mobile':{'type':Sequelize['STRING']},'fax':{'type':Sequelize['STRING']},'email':{'type':Sequelize[_0x78e9('0x2')]},'url':{'type':Sequelize['STRING']},'facebook':{'type':Sequelize['STRING']},'fb_data':{'type':Sequelize[_0x78e9('0x2')]},'twitter':{'type':Sequelize['STRING']},'skype':{'type':Sequelize[_0x78e9('0x2')]},'teams':{'type':Sequelize[_0x78e9('0x2')]},'viber':{'type':Sequelize['STRING']},'line':{'type':Sequelize[_0x78e9('0x2')]},'wechat':{'type':Sequelize['STRING']},'telegram':{'type':Sequelize[_0x78e9('0x2')]},'UserId':{'type':Sequelize[_0x78e9('0x4')]},'AdditionalPhones':{'type':Sequelize['STRING']},'priority':{'type':Sequelize[_0x78e9('0x4')](0x2)['UNSIGNED'],'defaultValue':0x2,'validate':{'min':0x0,'max':0x4}},'scheduledat':{'type':Sequelize[_0x78e9('0x5')],'defaultValue':Sequelize[_0x78e9('0x6')]},'dialTimezone':{'type':Sequelize[_0x78e9('0x2')]},'utcOffset':{'type':Sequelize[_0x78e9('0x4')]}}; \ No newline at end of file diff --git a/server/api/cmContact/cmContact.controller.js b/server/api/cmContact/cmContact.controller.js index f6b0314..1a456e3 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 _0x3cb6=['../../components/import/cm/csv','CompanyId','File\x20uploaded\x20correctly!','pid','upload','meta','import','User','agent','binding','../../components/import/cm/csv2','stringify','message','start\x20child\x20process\x20correctly!','exit','error\x20child\x20process','importUpdates','fork','../../components/import/cm/csvUpdates','getJourney','mail','chat','openchannel','fax','whatsapp','voice','-createdAt','resolve','channel','includes','toLowerCase','Invalid\x20channel','parse','range','Invalid\x20date\x20for\x20range\x20from\x20filter','isValid','Invalid\x20date\x20for\x20range\x20to\x20filter','Invalid\x20createdAt\x20filter','uniqueid','source','destination','callerid','starttime','endtime','duration','createdAt','userSecondDisposition','userThirdDisposition','UserId','fullname','DESC','Website','closed','closedAt','note','disposition','thirdDisposition','Account','key','color','browserName','customerIp','deviceModel','ratingMessage','subject','externalUrl','startCase','findAndCountAll','Owner','sortBy','reverse','value','slice','moment','bluebird','util','path','lodash','papaparse','ioredis','../../components/contacts','../../components/parsers/qs','api','../../config/environment','../../config/environment/shared','redis','localhost','socket.io-emitter','./cmContact.socket','register','status','json','offset','undefined','limit','count','set','then','destroy','end','sendStatus','error','stack','name','send','describe','getOptions','findAll','query','user','catch','CmContact','find','tags','keys','length','columnName','displayName','CmCustomField','cf_','alias','custom','type','values','Custom\x20field\x20%s\x20not\x20found\x20on\x20cm_contacts\x20table','forEach','hasOwnProperty','merge','body','from','get','isArray','join','[CmContact][merge]\x20to\x20%s\x20from\x20%s','CmHopper','info','[CmContact][merge][destroy][CmHopper],\x20%s','[CmContact][merge][destroy][CmHopperBlack],\x20%s','create','ChatInteraction','update','ChatMessage','ChatOfflineMessage','MailInteraction','MailMessage','SmsMessage','FaxInteraction','OpenchannelMessage','CmContactHasItem','CmHopperFinal','ReportAgentPreview','VoiceCallReport','ChatQueueReport','FaxQueueReport','MailQueueReport','OpenchannelQueueReport','SmsQueueReport','WhatsappInteraction','WhatsappMessage','WhatsappQueueReport','isNil','dialTimezone','timezones','utcOffset','additionalPhones','duplicates','where','$or','push','ListId','findOrCreate','spread','contact','all','show','Tags','Phones','ContactItemType','ItemType','sequelize','literal','Phones.OrderBy','$and','cf_%d','params','omit','pickBy','startsWith','map','format','isEmpty','table','cm_contacts','setFields','id\x20=\x20?','toParam','phone','findOne','model','Tag','rawAttributes','filters','intersection','attributes','fields','order','sort','pick','filter','options','getTags','setTags','ids','OrderBy','items','item_types','ItemTypeId','description','PHONE','CmHopperAdditionalPhone','item','`ItemType`.OrderBy','CmHopperId','ItemType.OrderBy','bulkCreate','duplicateAdditionalPhones','fromContactId','CmContactId','rescheduleAdditionalPhones','hopperId','nolimit','ContactId','includeAll','include','rows','getHopperHistories','CmHopperHistory','getHopperFinals','getJscriptySessions','JscriptySessionReport','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','filename','chmodSync','0777','child_process'];(function(_0xd745e9,_0x537598){var _0x5f02a2=function(_0x475271){while(--_0x475271){_0xd745e9['push'](_0xd745e9['shift']());}};_0x5f02a2(++_0x537598);}(_0x3cb6,0x14c));var _0x63cb=function(_0x26cd37,_0x1135bf){_0x26cd37=_0x26cd37-0x0;var _0x315d32=_0x3cb6[_0x26cd37];return _0x315d32;};'use strict';var moment=require(_0x63cb('0x0'));var BPromise=require(_0x63cb('0x1'));var util=require(_0x63cb('0x2'));var path=require(_0x63cb('0x3'));var fs=require('fs');var _=require(_0x63cb('0x4'));var squel=require('squel');var Papa=require(_0x63cb('0x5'));var Redis=require(_0x63cb('0x6'));var contacts=require(_0x63cb('0x7'));var qs=require(_0x63cb('0x8'));var logger=require('../../config/logger')(_0x63cb('0x9'));var config=require(_0x63cb('0xa'));var shared=require(_0x63cb('0xb'));var db=require('../../mysqldb')['db'];config['redis']=_['defaults'](config[_0x63cb('0xc')],{'host':_0x63cb('0xd'),'port':0x18eb});var socket=require(_0x63cb('0xe'))(new Redis(config[_0x63cb('0xc')]));require(_0x63cb('0xf'))[_0x63cb('0x10')](socket);function respondWithResult(_0x181cbf,_0x111416){_0x111416=_0x111416||0xc8;return function(_0x1f363e){if(_0x1f363e){return _0x181cbf[_0x63cb('0x11')](_0x111416)[_0x63cb('0x12')](_0x1f363e);}};}function respondWithFilteredResult(_0x5cff27,_0x261ef4){return function(_0x2862d1){if(_0x2862d1){var _0x39191d=typeof _0x261ef4[_0x63cb('0x13')]===_0x63cb('0x14')&&typeof _0x261ef4[_0x63cb('0x15')]===_0x63cb('0x14');var _0x245cc6=_0x2862d1[_0x63cb('0x16')];var _0x26d5e2=_0x39191d?0x0:_0x261ef4[_0x63cb('0x13')];var _0x1815d7=_0x39191d?_0x2862d1['count']:_0x261ef4[_0x63cb('0x13')]+_0x261ef4[_0x63cb('0x15')];var _0x55910b;if(_0x1815d7>=_0x245cc6){_0x1815d7=_0x245cc6;_0x55910b=0xc8;}else{_0x55910b=0xce;}_0x5cff27['status'](_0x55910b);return _0x5cff27[_0x63cb('0x17')]('Content-Range',_0x26d5e2+'-'+_0x1815d7+'/'+_0x245cc6)[_0x63cb('0x12')](_0x2862d1);}return null;};}function saveUpdates(_0x16b5b3){return function(_0x32bda5){if(_0x32bda5){return _0x32bda5['update'](_0x16b5b3)[_0x63cb('0x18')](function(_0x5ac7e6){return _0x5ac7e6;});}return null;};}function removeEntity(_0x203bca){return function(_0x3a02d6){if(_0x3a02d6){return _0x3a02d6[_0x63cb('0x19')]()['then'](function(){_0x203bca['status'](0xcc)[_0x63cb('0x1a')]();});}};}function handleEntityNotFound(_0x275729){return function(_0x9ef1f8){if(!_0x9ef1f8){_0x275729[_0x63cb('0x1b')](0x194);}return _0x9ef1f8;};}function handleError(_0x4ffd41,_0x24f571){_0x24f571=_0x24f571||0x1f4;return function(_0x4bf1d7){logger[_0x63cb('0x1c')](_0x4bf1d7[_0x63cb('0x1d')]);if(_0x4bf1d7[_0x63cb('0x1e')]){delete _0x4bf1d7['name'];}_0x4ffd41[_0x63cb('0x11')](_0x24f571)[_0x63cb('0x1f')](_0x4bf1d7);};}exports['index']=function(_0x22beea,_0x451a61){var _0x2ecc07={};return contacts[_0x63cb('0x20')]()['then'](function(_0xfbca68){_0x2ecc07=qs[_0x63cb('0x21')](_0xfbca68,_0x22beea);return contacts[_0x63cb('0x22')](_0x22beea[_0x63cb('0x23')],_0x22beea[_0x63cb('0x24')],_0x2ecc07,_0xfbca68);})['then'](respondWithFilteredResult(_0x451a61,_0x2ecc07))[_0x63cb('0x25')](handleError(_0x451a61,null));};exports[_0x63cb('0x19')]=function(_0x27e9ce,_0xbeca68){return db[_0x63cb('0x26')][_0x63cb('0x27')]({'where':{'id':_0x27e9ce['params']['id']}})[_0x63cb('0x18')](handleEntityNotFound(_0xbeca68,null))['then'](removeEntity(_0xbeca68,null))['catch'](handleError(_0xbeca68,null));};exports[_0x63cb('0x20')]=function(_0x1fddb9,_0x568736){return db['CmContact']['describe']()[_0x63cb('0x18')](function(_0x25905){delete _0x25905[_0x63cb('0x28')];for(var _0x320017=0x0;_0x3200170x0){return new Promise(function(_0x4c79f6){var _0x2f35fb=[];for(var _0x384242=0x0;_0x384242<_0x394d72['length'];_0x384242++){_0x2f35fb['push'](insertAdditionalPhones(_0x394d72[_0x384242][_0x63cb('0x63')],_0x394d72[_0x384242][_0x63cb('0x5b')]));}Promise[_0x63cb('0x64')](_0x2f35fb)[_0x63cb('0x18')](function(){_0x4c79f6(0x1);});})[_0x63cb('0x18')](function(){return{'success':_0x96482,'failure':_0x2e2da7,'duplicates':_0x1fe0b2};});}else{return{'success':_0x96482,'failure':_0x2e2da7,'duplicates':_0x1fe0b2};}}})[_0x63cb('0x18')](respondWithResult(_0x21d287,0xc9))[_0x63cb('0x25')](handleError(_0x21d287,null));};exports[_0x63cb('0x65')]=function(_0x30f947,_0x454a90){var _0x132c26;return db[_0x63cb('0x26')][_0x63cb('0x20')]()[_0x63cb('0x18')](function(_0x363363){return db[_0x63cb('0x26')][_0x63cb('0x27')]({'where':{'id':_0x30f947['params']['id']},'include':[{'model':db['Tag'],'as':_0x63cb('0x66'),'attributes':['id',_0x63cb('0x1e'),'color'],'required':_0x30f947['query']['tag']?!![]:![]},{'model':db[_0x63cb('0x4b')],'as':_0x63cb('0x67'),'where':{'CmContactId':_0x30f947['params']['id']},'required':![],'include':[{'model':db[_0x63cb('0x68')],'as':_0x63cb('0x69')}]}],'order':[db[_0x63cb('0x6a')][_0x63cb('0x6b')](_0x63cb('0x6c'))],'attributes':_[_0x63cb('0x29')](_0x363363)});})['then'](function(_0x1b9c69){if(!_[_0x63cb('0x57')](_0x1b9c69)){_0x132c26=_0x1b9c69[_0x63cb('0x39')]({'plain':!![]});var _0x9d4b14={'where':{'$and':[{'ListId':{'$ne':null}}]}};if(_0x1b9c69&&_0x1b9c69['ListId']){if(_0x1b9c69[_0x63cb('0x60')]){_0x9d4b14[_0x63cb('0x5d')][_0x63cb('0x6d')][_0x63cb('0x5f')]({'ListId':{'$ne':_0x1b9c69['ListId']}});}}return db['CmCustomField'][_0x63cb('0x22')](_0x9d4b14);}})['then'](function(_0x1a7373){if(!_[_0x63cb('0x57')](_0x1a7373)){return _['omit'](_0x132c26,_['map'](_0x1a7373,function(_0x30dfe6){return util['format'](_0x63cb('0x6e'),_0x30dfe6['id']);}));}})[_0x63cb('0x18')](handleEntityNotFound(_0x454a90,null))[_0x63cb('0x18')](respondWithResult(_0x454a90,null))['catch'](handleError(_0x454a90,null));};exports['update']=function(_0x508992,_0x1b6858){var _0x284632;if(_0x508992[_0x63cb('0x37')]['id']){delete _0x508992[_0x63cb('0x37')]['id'];}if(!_[_0x63cb('0x57')](_0x508992[_0x63cb('0x37')][_0x63cb('0x58')])){var _0x21e406=_0x508992[_0x63cb('0x37')][_0x63cb('0x58')];if(!_['isNil'](shared[_0x63cb('0x59')][_0x21e406]))_0x508992['body']['utcOffset']=shared[_0x63cb('0x59')][_0x21e406]['utcOffset'];}return db['CmContact'][_0x63cb('0x27')]({'where':{'id':_0x508992[_0x63cb('0x6f')]['id']}})[_0x63cb('0x18')](handleEntityNotFound(_0x1b6858,null))['then'](saveUpdates(_0x508992['body'],null))['then'](function(_0x28d8d4){_0x284632=_0x28d8d4;var _0xead7b9={'where':{'$and':[{'ListId':{'$ne':null}}]}};if(_0x28d8d4&&_0x28d8d4[_0x63cb('0x60')]){if(_0x28d8d4[_0x63cb('0x60')]){_0xead7b9['where'][_0x63cb('0x6d')][_0x63cb('0x5f')]({'ListId':{'$ne':_0x28d8d4[_0x63cb('0x60')]}});}}return db[_0x63cb('0x2d')]['findAll'](_0xead7b9);})[_0x63cb('0x18')](function(_0x1aa074){if(_0x1aa074){return _[_0x63cb('0x70')](_[_0x63cb('0x71')](_0x508992[_0x63cb('0x37')],function(_0x377fad,_0x37cadf){return _[_0x63cb('0x72')](_0x37cadf,_0x63cb('0x2e'));}),_[_0x63cb('0x73')](_0x1aa074,function(_0x1303eb){return util[_0x63cb('0x74')]('cf_%d',_0x1303eb['id']);}));}})[_0x63cb('0x18')](function(_0x70f871){if(_0x70f871&&!_[_0x63cb('0x75')](_0x70f871)){var _0x2075ec=squel[_0x63cb('0x43')]()[_0x63cb('0x76')](_0x63cb('0x77'))[_0x63cb('0x78')](_0x70f871)[_0x63cb('0x5d')](_0x63cb('0x79'),_0x508992['params']['id'])[_0x63cb('0x7a')]();return db[_0x63cb('0x6a')][_0x63cb('0x23')](_0x2075ec['text'],{'replacements':_0x2075ec[_0x63cb('0x32')]});}})[_0x63cb('0x18')](function(){if(_0x508992[_0x63cb('0x37')][_0x63cb('0x7b')]&&_0x284632){return db[_0x63cb('0x3d')]['update']({'phone':_0x508992[_0x63cb('0x37')]['phone'],'OrderBy':0x0},{'where':{'ContactId':_0x284632['id']}});}})[_0x63cb('0x18')](function(){return _0x284632;})[_0x63cb('0x18')](respondWithResult(_0x1b6858,null))[_0x63cb('0x25')](handleError(_0x1b6858,null));};exports['getTags']=function(_0x11f21b,_0x563594){var _0x52a61e={};var _0x22260d={};var _0x3d3773;var _0x317971;return db['CmContact'][_0x63cb('0x7c')]({'where':{'id':_0x11f21b[_0x63cb('0x6f')]['id']}})['then'](handleEntityNotFound(_0x563594,null))['then'](function(_0x5f34e2){if(_0x5f34e2){_0x3d3773=_0x5f34e2;_0x22260d[_0x63cb('0x7d')]=_[_0x63cb('0x29')](db[_0x63cb('0x7e')][_0x63cb('0x7f')]);_0x22260d[_0x63cb('0x23')]=_['keys'](_0x11f21b[_0x63cb('0x23')]);_0x22260d[_0x63cb('0x80')]=_[_0x63cb('0x81')](_0x22260d[_0x63cb('0x7d')],_0x22260d[_0x63cb('0x23')]);_0x52a61e[_0x63cb('0x82')]=_[_0x63cb('0x81')](_0x22260d[_0x63cb('0x7d')],qs[_0x63cb('0x83')](_0x11f21b[_0x63cb('0x23')][_0x63cb('0x83')]));_0x52a61e['attributes']=_0x52a61e[_0x63cb('0x82')][_0x63cb('0x2a')]?_0x52a61e['attributes']:_0x22260d[_0x63cb('0x7d')];_0x52a61e[_0x63cb('0x84')]=qs[_0x63cb('0x85')](_0x11f21b[_0x63cb('0x23')][_0x63cb('0x85')]);_0x52a61e[_0x63cb('0x5d')]=qs[_0x63cb('0x80')](_[_0x63cb('0x86')](_0x11f21b['query'],_0x22260d['filters']));if(_0x11f21b['query'][_0x63cb('0x87')]){_0x52a61e[_0x63cb('0x5d')]=_[_0x63cb('0x36')](_0x52a61e[_0x63cb('0x5d')],{'$or':_[_0x63cb('0x73')](_0x52a61e[_0x63cb('0x82')],function(_0x45d7b5){var _0x2cf613={};_0x2cf613[_0x45d7b5]={'$like':'%'+_0x11f21b[_0x63cb('0x23')][_0x63cb('0x87')]+'%'};return _0x2cf613;})});}_0x52a61e=_[_0x63cb('0x36')]({},_0x52a61e,_0x11f21b[_0x63cb('0x88')]);return _0x3d3773[_0x63cb('0x89')](_0x52a61e);}})['then'](function(_0x1e9ecf){if(_0x1e9ecf){_0x317971=_0x1e9ecf['length'];if(!_0x11f21b[_0x63cb('0x23')][_0x63cb('0x35')]('nolimit')){_0x52a61e[_0x63cb('0x15')]=qs[_0x63cb('0x15')](_0x11f21b[_0x63cb('0x23')][_0x63cb('0x15')]);_0x52a61e[_0x63cb('0x13')]=qs[_0x63cb('0x13')](_0x11f21b[_0x63cb('0x23')][_0x63cb('0x13')]);}return _0x3d3773[_0x63cb('0x89')](_0x52a61e);}})[_0x63cb('0x18')](function(_0x18f878){if(_0x18f878){return _0x18f878?{'count':_0x317971,'rows':_0x18f878}:null;}})['then'](respondWithResult(_0x563594,null))['catch'](handleError(_0x563594,null));};exports['setTags']=function(_0x5bd745,_0x30645c){if(_0x5bd745[_0x63cb('0x37')]['id']){delete _0x5bd745[_0x63cb('0x37')]['id'];}return db['CmContact'][_0x63cb('0x7c')]({'where':{'id':_0x5bd745[_0x63cb('0x6f')]['id']}})[_0x63cb('0x18')](handleEntityNotFound(_0x30645c,null))['then'](function(_0x53544c){if(_0x53544c){return _0x53544c[_0x63cb('0x8a')](_0x5bd745[_0x63cb('0x37')][_0x63cb('0x8b')]||[]);}return null;})[_0x63cb('0x18')](respondWithResult(_0x30645c,null))[_0x63cb('0x25')](handleError(_0x30645c,null));};exports['setAdditionalPhones']=function(_0x406b8e,_0x293a76){var _0x10c088=[];_0x10c088[_0x63cb('0x5f')](addAdditionalPhones(_0x406b8e[_0x63cb('0x37')]));Promise['all'](_0x10c088)[_0x63cb('0x18')](function(){_0x10c088=[];_0x10c088[_0x63cb('0x5f')](deleteCmHopperPhones(_0x406b8e[_0x63cb('0x37')]['id']));_0x10c088[_0x63cb('0x5f')](addCmHopperPhones(_0x406b8e[_0x63cb('0x37')]['id']));Promise['all'](_0x10c088)[_0x63cb('0x18')](function(){return[0x1];})[_0x63cb('0x18')](respondWithResult(_0x293a76,null));});};function addAdditionalPhones(_0x2a4501){var _0xc01906;return new Promise(function(_0x436a20){return db['CmContactHasItem']['destroy']({'where':{'CmContactId':_0x2a4501['id']}})[_0x63cb('0x18')](function(){db[_0x63cb('0x68')][_0x63cb('0x22')]({'raw':!![],'attributes':['id',_0x63cb('0x8c')]})[_0x63cb('0x18')](function(_0x2c03b5){var _0x34ce2d=[];for(var _0x3ce52a=0x0;_0x3ce52a<_0x2a4501[_0x63cb('0x8d')][_0x63cb('0x2a')];_0x3ce52a++){var _0x31a84b=_0x2a4501[_0x63cb('0x8e')]?_[_0x63cb('0x57')](_0x2a4501[_0x63cb('0x8e')][_0x3ce52a])?'':_0x2a4501[_0x63cb('0x8e')][_0x3ce52a]:_0x2a4501[_0x63cb('0x8d')][_0x3ce52a][_0x63cb('0x8f')]?_0x2a4501[_0x63cb('0x8d')][_0x3ce52a][_0x63cb('0x8f')]:'';var _0x2cd911=_[_0x63cb('0x57')](_0x2a4501[_0x63cb('0x8d')][_0x3ce52a][_0x63cb('0x90')])?'':_0x2a4501[_0x63cb('0x8d')][_0x3ce52a][_0x63cb('0x90')];var _0x1333fb=_0x31a84b+':'+_0x2a4501[_0x63cb('0x8d')][_0x3ce52a][_0x63cb('0x7b')]+'§'+_0x2cd911;if(_[_0x63cb('0x57')](_0xc01906))_0xc01906=_0x1333fb;else _0xc01906+=';'+_0x1333fb;var _0x296a21=null;var _0x31c95b=null;if(_0x2a4501[_0x63cb('0x8e')]){if(!_[_0x63cb('0x57')](_0x2a4501[_0x63cb('0x8e')][_0x3ce52a])){_0x31c95b=_[_0x63cb('0x27')](_0x2c03b5,function(_0x5bbfd0){return _0x5bbfd0['id']===_0x2a4501['item_types'][_0x3ce52a];});if(!_[_0x63cb('0x57')](_0x31c95b)){_0x296a21=_0x31c95b[_0x63cb('0x8c')];}}}else{if(!_['isNil'](_0x2a4501[_0x63cb('0x8d')][_0x3ce52a])){_0x31c95b=_[_0x63cb('0x27')](_0x2c03b5,function(_0x4b2f5a){return _0x4b2f5a['id']===_0x2a4501[_0x63cb('0x8d')][_0x3ce52a][_0x63cb('0x8f')];});if(!_[_0x63cb('0x57')](_0x31c95b)){_0x296a21=_0x3ce52a;}}}if(_[_0x63cb('0x57')](_0x296a21)){_0x296a21=0x64;}_0x34ce2d[_0x63cb('0x5f')](addAdditionalPhone(_0x2a4501['id'],_0x2a4501[_0x63cb('0x8d')][_0x3ce52a][_0x63cb('0x7b')],_0x2a4501[_0x63cb('0x8e')]?_[_0x63cb('0x57')](_0x2a4501[_0x63cb('0x8e')][_0x3ce52a])?null:_0x2a4501['item_types'][_0x3ce52a]:_0x2a4501[_0x63cb('0x8d')][_0x3ce52a][_0x63cb('0x8f')]?_0x2a4501[_0x63cb('0x8d')][_0x3ce52a]['ItemTypeId']:null,_0x296a21,_0x2cd911));}Promise[_0x63cb('0x64')](_0x34ce2d)[_0x63cb('0x18')](function(){db[_0x63cb('0x26')][_0x63cb('0x43')]({'AdditionalPhones':_0xc01906},{'where':{'id':_0x2a4501['id']}})[_0x63cb('0x18')](function(){_0x436a20(0x1);});});});});});}function addAdditionalPhone(_0x4bc418,_0x496cbc,_0x8236bb,_0x86001,_0x160467){return db[_0x63cb('0x4b')][_0x63cb('0x27')]({'where':{'CmContactId':_0x4bc418,'item':_0x496cbc}})[_0x63cb('0x18')](function(_0x47b97f){if(_0x47b97f)logger['info']('contact\x20phone\x20exists',_0x47b97f);else{db['CmContactHasItem'][_0x63cb('0x41')]({'CmContactId':_0x4bc418,'item':_0x496cbc,'ItemTypeId':_0x8236bb,'OrderBy':_0x86001,'ItemClass':_0x63cb('0x91'),'description':_0x160467});}});}function deleteCmHopperPhones(_0x4f54ec){return new Promise(function(_0x79fa8e){return db[_0x63cb('0x3d')]['findAll']({'raw':!![],'attributes':['id'],'where':{'ContactId':_0x4f54ec}})['then'](function(_0x5bf905){db[_0x63cb('0x92')][_0x63cb('0x19')]({'where':{'CmHopperId':{'$in':_[_0x63cb('0x73')](_0x5bf905,'id')}}});})[_0x63cb('0x18')](function(){_0x79fa8e(0x1);});});}function addCmHopperPhones(_0x2bf3db){return new Promise(function(_0x1b42c7){return db['CmHopper'][_0x63cb('0x22')]({'raw':!![],'attributes':['id'],'where':{'ContactId':_0x2bf3db}})[_0x63cb('0x18')](function(_0x2be159){var _0x15b263=[];_[_0x63cb('0x73')](_0x2be159,function(_0x354aa4){_0x15b263['push'](createCmHopperPhone(_0x2bf3db,_0x354aa4['id']));});Promise[_0x63cb('0x64')](_0x15b263)[_0x63cb('0x18')](function(){_0x1b42c7(0x1);});});});}function createCmHopperPhone(_0x3a72d3,_0xf370cc){return new Promise(function(_0x4e34fd){db[_0x63cb('0x4b')][_0x63cb('0x22')]({'raw':!![],'attributes':[_0x63cb('0x93'),_0x63cb('0x8c')],'where':{'CmContactId':_0x3a72d3,'ItemClass':_0x63cb('0x91')},'include':[{'model':db[_0x63cb('0x68')],'attributes':['OrderBy'],'as':_0x63cb('0x69')}],'order':[_0x63cb('0x8c'),db[_0x63cb('0x6a')][_0x63cb('0x6b')](_0x63cb('0x94'))]})[_0x63cb('0x18')](function(_0x2aa2a7){var _0x2edacf=0x1;var _0x222822=_[_0x63cb('0x73')](_0x2aa2a7,function(_0x47b32d){_0x47b32d[_0x63cb('0x95')]=_0xf370cc;_0x47b32d['phone']=_0x47b32d[_0x63cb('0x93')];_0x47b32d['OrderBy']=_0x2edacf;delete _0x47b32d[_0x63cb('0x96')];_0x2edacf=_0x2edacf+0x1;return _0x47b32d;});return db[_0x63cb('0x92')][_0x63cb('0x97')](_0x222822,{});})[_0x63cb('0x18')](function(){_0x4e34fd(0x1);});});}function insertAdditionalPhones(_0xfed578,_0x38888c){return new Promise(function(_0x44558f){var _0x42491a=[];for(var _0xdc8d13=0x0;_0xdc8d13<_0x38888c[_0x63cb('0x2a')];_0xdc8d13++){var _0x3b5f4d=_0x38888c[_0xdc8d13];_0x42491a[_0x63cb('0x5f')](parseContactItemType(_0x3b5f4d));}Promise[_0x63cb('0x64')](_0x42491a)[_0x63cb('0x18')](function(){var _0x36c1a9={'id':_0xfed578['id'],'items':_0x38888c};return addAdditionalPhones(_0x36c1a9)[_0x63cb('0x18')](function(){return addCmHopperPhones(_0xfed578['id']);});})[_0x63cb('0x18')](function(){_0x44558f(_0xfed578);});});}function parseContactItemType(_0x256c5a){return new Promise(function(_0x2f937c){if(_0x256c5a[_0x63cb('0x35')]('ItemTypeId')){_0x2f937c(_0x256c5a);}else{return db[_0x63cb('0x68')][_0x63cb('0x27')]({'where':{'name':_0x256c5a[_0x63cb('0x69')]}})[_0x63cb('0x18')](function(_0x542555){if(_[_0x63cb('0x57')](_0x542555))_0x256c5a[_0x63cb('0x8f')]=null;else _0x256c5a[_0x63cb('0x8f')]=_0x542555['id'];_0x2f937c(_0x256c5a);});}});}exports['getAdditionalPhones']=function(_0x1bfa17,_0x17af0e){return db[_0x63cb('0x4b')][_0x63cb('0x22')]({'raw':!![],'where':{'CmContactId':_0x1bfa17[_0x63cb('0x6f')]['id'],'ItemClass':_0x63cb('0x91')},'include':[{'model':db[_0x63cb('0x68')],'as':'ItemType'}],'order':[[_0x63cb('0x8c')],[db[_0x63cb('0x6a')][_0x63cb('0x6b')](_0x63cb('0x94'))]]})['then'](function(_0x3299d6){return _0x3299d6;})[_0x63cb('0x18')](respondWithResult(_0x17af0e,null))[_0x63cb('0x25')](handleError(_0x17af0e,null));};exports[_0x63cb('0x98')]=function(_0x5d2133,_0x175d3d){return db[_0x63cb('0x4b')][_0x63cb('0x22')]({'raw':!![],'where':{'CmContactId':_0x5d2133['body'][_0x63cb('0x99')]}})[_0x63cb('0x18')](function(_0x485103){var _0x4bafbf=_[_0x63cb('0x73')](_0x485103,function(_0x315775){_0x315775[_0x63cb('0x9a')]=_0x5d2133[_0x63cb('0x37')]['toContactId'];return _0x315775;});return db[_0x63cb('0x4b')]['bulkCreate'](_0x4bafbf,{});})[_0x63cb('0x18')](function(){return addCmHopperPhones(_0x5d2133[_0x63cb('0x37')]['toContactId']);})[_0x63cb('0x18')](function(){return['ok'];})[_0x63cb('0x18')](respondWithResult(_0x175d3d,null))['catch'](handleError(_0x175d3d,null));};exports[_0x63cb('0x9b')]=function(_0x237640,_0x596137){var _0x151f70=[];_0x151f70['push'](createCmHopperPhone(_0x237640[_0x63cb('0x37')]['id'],_0x237640[_0x63cb('0x37')][_0x63cb('0x9c')]));Promise[_0x63cb('0x64')](_0x151f70)['then'](function(){return[0x1];})['then'](respondWithResult(_0x596137,null));};exports['getHoppers']=function(_0x255559,_0x48c985){var _0x433c3d={'raw':![],'where':{}};var _0x431bb7={};var _0x121eec={'count':0x0,'rows':[]};return db[_0x63cb('0x26')][_0x63cb('0x7c')]({'where':{'id':_0x255559['params']['id']}})[_0x63cb('0x18')](handleEntityNotFound(_0x48c985,null))[_0x63cb('0x18')](function(_0x1ea781){if(_0x1ea781){_0x431bb7[_0x63cb('0x7d')]=_['keys'](db[_0x63cb('0x3d')][_0x63cb('0x7f')]);_0x431bb7[_0x63cb('0x23')]=_[_0x63cb('0x29')](_0x255559[_0x63cb('0x23')]);_0x431bb7['filters']=_[_0x63cb('0x81')](_0x431bb7[_0x63cb('0x7d')],_0x431bb7['query']);_0x433c3d['attributes']=_[_0x63cb('0x81')](_0x431bb7[_0x63cb('0x7d')],qs[_0x63cb('0x83')](_0x255559[_0x63cb('0x23')][_0x63cb('0x83')]));_0x433c3d[_0x63cb('0x82')]=_0x433c3d['attributes'][_0x63cb('0x2a')]?_0x433c3d[_0x63cb('0x82')]:_0x431bb7[_0x63cb('0x7d')];if(!_0x255559['query'][_0x63cb('0x35')](_0x63cb('0x9d'))){_0x433c3d[_0x63cb('0x15')]=qs['limit'](_0x255559['query'][_0x63cb('0x15')]);_0x433c3d['offset']=qs[_0x63cb('0x13')](_0x255559['query'][_0x63cb('0x13')]);}_0x433c3d[_0x63cb('0x84')]=qs[_0x63cb('0x85')](_0x255559[_0x63cb('0x23')]['sort']);_0x433c3d[_0x63cb('0x5d')]=qs[_0x63cb('0x80')](_[_0x63cb('0x86')](_0x255559[_0x63cb('0x23')],_0x431bb7[_0x63cb('0x80')]));_0x433c3d[_0x63cb('0x5d')][_0x63cb('0x9e')]=_0x1ea781['id'];if(_0x255559[_0x63cb('0x23')][_0x63cb('0x87')]){_0x433c3d['where']=_['merge'](_0x433c3d[_0x63cb('0x5d')],{'$or':_[_0x63cb('0x73')](_0x433c3d[_0x63cb('0x82')],function(_0x36d676){var _0x49246d={};_0x49246d[_0x36d676]={'$like':'%'+_0x255559['query'][_0x63cb('0x87')]+'%'};return _0x49246d;})});}_0x433c3d=_[_0x63cb('0x36')]({},_0x433c3d,_0x255559[_0x63cb('0x88')]);return db['CmHopper'][_0x63cb('0x16')]({'where':_0x433c3d[_0x63cb('0x5d')]})[_0x63cb('0x18')](function(_0x3aaba7){_0x121eec['count']=_0x3aaba7;if(_0x255559[_0x63cb('0x23')][_0x63cb('0x9f')]){_0x433c3d[_0x63cb('0xa0')]=[{'all':!![]}];}return db[_0x63cb('0x3d')][_0x63cb('0x22')](_0x433c3d);})[_0x63cb('0x18')](function(_0x3a41ba){_0x121eec[_0x63cb('0xa1')]=_0x3a41ba;return _0x121eec;});}})[_0x63cb('0x18')](respondWithFilteredResult(_0x48c985,_0x433c3d))['catch'](handleError(_0x48c985,null));};exports[_0x63cb('0xa2')]=function(_0x5979c4,_0x3c4bb5){var _0x1ddaa2={'raw':!![],'where':{}};var _0x63d4d5={};var _0x3cd5cd={'count':0x0,'rows':[]};return db['CmContact'][_0x63cb('0x7c')]({'where':{'id':_0x5979c4[_0x63cb('0x6f')]['id']}})['then'](handleEntityNotFound(_0x3c4bb5,null))[_0x63cb('0x18')](function(_0x2a04d9){if(_0x2a04d9){_0x63d4d5[_0x63cb('0x7d')]=_[_0x63cb('0x29')](db[_0x63cb('0xa3')][_0x63cb('0x7f')]);_0x63d4d5[_0x63cb('0x23')]=_[_0x63cb('0x29')](_0x5979c4['query']);_0x63d4d5[_0x63cb('0x80')]=_[_0x63cb('0x81')](_0x63d4d5['model'],_0x63d4d5[_0x63cb('0x23')]);_0x1ddaa2['attributes']=_[_0x63cb('0x81')](_0x63d4d5[_0x63cb('0x7d')],qs[_0x63cb('0x83')](_0x5979c4[_0x63cb('0x23')][_0x63cb('0x83')]));_0x1ddaa2['attributes']=_0x1ddaa2['attributes'][_0x63cb('0x2a')]?_0x1ddaa2['attributes']:_0x63d4d5[_0x63cb('0x7d')];if(!_0x5979c4[_0x63cb('0x23')][_0x63cb('0x35')](_0x63cb('0x9d'))){_0x1ddaa2['limit']=qs[_0x63cb('0x15')](_0x5979c4[_0x63cb('0x23')][_0x63cb('0x15')]);_0x1ddaa2[_0x63cb('0x13')]=qs[_0x63cb('0x13')](_0x5979c4[_0x63cb('0x23')][_0x63cb('0x13')]);}_0x1ddaa2[_0x63cb('0x84')]=qs[_0x63cb('0x85')](_0x5979c4[_0x63cb('0x23')][_0x63cb('0x85')]);_0x1ddaa2['where']=qs['filters'](_[_0x63cb('0x86')](_0x5979c4[_0x63cb('0x23')],_0x63d4d5['filters']));_0x1ddaa2['where']['ContactId']=_0x2a04d9['id'];if(_0x5979c4['query'][_0x63cb('0x87')]){_0x1ddaa2[_0x63cb('0x5d')]=_[_0x63cb('0x36')](_0x1ddaa2[_0x63cb('0x5d')],{'$or':_[_0x63cb('0x73')](_0x1ddaa2[_0x63cb('0x82')],function(_0x33d003){var _0x40d747={};_0x40d747[_0x33d003]={'$like':'%'+_0x5979c4[_0x63cb('0x23')]['filter']+'%'};return _0x40d747;})});}_0x1ddaa2=_[_0x63cb('0x36')]({},_0x1ddaa2,_0x5979c4[_0x63cb('0x88')]);return db[_0x63cb('0xa3')][_0x63cb('0x16')]({'where':_0x1ddaa2['where']})[_0x63cb('0x18')](function(_0x27179c){_0x3cd5cd['count']=_0x27179c;if(_0x5979c4['query'][_0x63cb('0x9f')]){_0x1ddaa2['include']=[{'all':!![]}];}return db[_0x63cb('0xa3')]['findAll'](_0x1ddaa2);})[_0x63cb('0x18')](function(_0xcb1762){_0x3cd5cd[_0x63cb('0xa1')]=_0xcb1762;return _0x3cd5cd;});}})[_0x63cb('0x18')](respondWithFilteredResult(_0x3c4bb5,_0x1ddaa2))[_0x63cb('0x25')](handleError(_0x3c4bb5,null));};exports[_0x63cb('0xa4')]=function(_0x1fbf53,_0x53e406){var _0x1c8349={'raw':!![],'where':{}};var _0xdbd7b2={};var _0x45ddf2={'count':0x0,'rows':[]};return db[_0x63cb('0x26')]['findOne']({'where':{'id':_0x1fbf53[_0x63cb('0x6f')]['id']}})['then'](handleEntityNotFound(_0x53e406,null))[_0x63cb('0x18')](function(_0x3e2410){if(_0x3e2410){_0xdbd7b2['model']=_['keys'](db[_0x63cb('0x4c')][_0x63cb('0x7f')]);_0xdbd7b2[_0x63cb('0x23')]=_[_0x63cb('0x29')](_0x1fbf53[_0x63cb('0x23')]);_0xdbd7b2[_0x63cb('0x80')]=_['intersection'](_0xdbd7b2[_0x63cb('0x7d')],_0xdbd7b2['query']);_0x1c8349[_0x63cb('0x82')]=_[_0x63cb('0x81')](_0xdbd7b2[_0x63cb('0x7d')],qs['fields'](_0x1fbf53['query'][_0x63cb('0x83')]));_0x1c8349[_0x63cb('0x82')]=_0x1c8349[_0x63cb('0x82')][_0x63cb('0x2a')]?_0x1c8349[_0x63cb('0x82')]:_0xdbd7b2['model'];if(!_0x1fbf53['query'][_0x63cb('0x35')](_0x63cb('0x9d'))){_0x1c8349[_0x63cb('0x15')]=qs[_0x63cb('0x15')](_0x1fbf53['query'][_0x63cb('0x15')]);_0x1c8349[_0x63cb('0x13')]=qs['offset'](_0x1fbf53[_0x63cb('0x23')]['offset']);}_0x1c8349['order']=qs[_0x63cb('0x85')](_0x1fbf53[_0x63cb('0x23')][_0x63cb('0x85')]);_0x1c8349[_0x63cb('0x5d')]=qs['filters'](_[_0x63cb('0x86')](_0x1fbf53[_0x63cb('0x23')],_0xdbd7b2[_0x63cb('0x80')]));_0x1c8349[_0x63cb('0x5d')][_0x63cb('0x9e')]=_0x3e2410['id'];if(_0x1fbf53[_0x63cb('0x23')]['filter']){_0x1c8349[_0x63cb('0x5d')]=_[_0x63cb('0x36')](_0x1c8349[_0x63cb('0x5d')],{'$or':_['map'](_0x1c8349['attributes'],function(_0x5424d0){var _0x103b19={};_0x103b19[_0x5424d0]={'$like':'%'+_0x1fbf53[_0x63cb('0x23')][_0x63cb('0x87')]+'%'};return _0x103b19;})});}_0x1c8349=_[_0x63cb('0x36')]({},_0x1c8349,_0x1fbf53[_0x63cb('0x88')]);return db[_0x63cb('0x4c')][_0x63cb('0x16')]({'where':_0x1c8349[_0x63cb('0x5d')]})[_0x63cb('0x18')](function(_0x4d6ebe){_0x45ddf2['count']=_0x4d6ebe;if(_0x1fbf53['query'][_0x63cb('0x9f')]){_0x1c8349['include']=[{'all':!![]}];}return db[_0x63cb('0x4c')][_0x63cb('0x22')](_0x1c8349);})[_0x63cb('0x18')](function(_0x4935c0){_0x45ddf2[_0x63cb('0xa1')]=_0x4935c0;return _0x45ddf2;});}})['then'](respondWithFilteredResult(_0x53e406,_0x1c8349))[_0x63cb('0x25')](handleError(_0x53e406,null));};exports[_0x63cb('0xa5')]=function(_0x44e373,_0x4ebcd7){var _0xac213d={'raw':!![],'where':{}};var _0x18c2ec={};var _0x7d19a4={'count':0x0,'rows':[]};return db['CmContact'][_0x63cb('0x7c')]({'where':{'id':_0x44e373[_0x63cb('0x6f')]['id']}})[_0x63cb('0x18')](handleEntityNotFound(_0x4ebcd7,null))[_0x63cb('0x18')](function(_0x1ec4e6){if(_0x1ec4e6){_0x18c2ec['model']=_[_0x63cb('0x29')](db[_0x63cb('0xa6')]['rawAttributes']);_0x18c2ec[_0x63cb('0x23')]=_[_0x63cb('0x29')](_0x44e373['query']);_0x18c2ec['filters']=_[_0x63cb('0x81')](_0x18c2ec[_0x63cb('0x7d')],_0x18c2ec[_0x63cb('0x23')]);_0xac213d[_0x63cb('0x82')]=_[_0x63cb('0x81')](_0x18c2ec[_0x63cb('0x7d')],qs[_0x63cb('0x83')](_0x44e373[_0x63cb('0x23')][_0x63cb('0x83')]));_0xac213d[_0x63cb('0x82')]=_0xac213d['attributes'][_0x63cb('0x2a')]?_0xac213d['attributes']:_0x18c2ec[_0x63cb('0x7d')];if(!_0x44e373[_0x63cb('0x23')][_0x63cb('0x35')]('nolimit')){_0xac213d[_0x63cb('0x15')]=qs[_0x63cb('0x15')](_0x44e373[_0x63cb('0x23')][_0x63cb('0x15')]);_0xac213d[_0x63cb('0x13')]=qs['offset'](_0x44e373['query'][_0x63cb('0x13')]);}_0xac213d[_0x63cb('0x84')]=qs[_0x63cb('0x85')](_0x44e373['query'][_0x63cb('0x85')]);_0xac213d[_0x63cb('0x5d')]=qs['filters'](_[_0x63cb('0x86')](_0x44e373[_0x63cb('0x23')],_0x18c2ec[_0x63cb('0x80')]));_0xac213d[_0x63cb('0x5d')][_0x63cb('0x9e')]=_0x1ec4e6['id'];if(_0x44e373['query'][_0x63cb('0x87')]){_0xac213d[_0x63cb('0x5d')]=_['merge'](_0xac213d[_0x63cb('0x5d')],{'$or':_[_0x63cb('0x73')](_0xac213d[_0x63cb('0x82')],function(_0x5ec18e){var _0x560813={};_0x560813[_0x5ec18e]={'$like':'%'+_0x44e373[_0x63cb('0x23')]['filter']+'%'};return _0x560813;})});}_0xac213d=_[_0x63cb('0x36')]({},_0xac213d,_0x44e373[_0x63cb('0x88')]);return db[_0x63cb('0xa6')][_0x63cb('0x16')]({'where':_0xac213d['where']})['then'](function(_0x2fe80c){_0x7d19a4['count']=_0x2fe80c;if(_0x44e373['query'][_0x63cb('0x9f')]){_0xac213d[_0x63cb('0xa0')]=[{'all':!![]}];}return db['JscriptySessionReport'][_0x63cb('0x22')](_0xac213d);})[_0x63cb('0x18')](function(_0x360f4e){_0x7d19a4[_0x63cb('0xa1')]=_0x360f4e;return _0x7d19a4;});}})[_0x63cb('0x18')](respondWithFilteredResult(_0x4ebcd7,_0xac213d))['catch'](handleError(_0x4ebcd7,null));};exports['uploadCsv']=function(_0x323361,_0x5a66e0){try{if(!_0x323361['body'][_0x63cb('0x60')]){throw new Error(_0x63cb('0xa7'));}if(!_0x323361[_0x63cb('0x37')][_0x63cb('0xa8')]){throw new Error(_0x63cb('0xa9'));}if(!_0x323361[_0x63cb('0x37')][_0x63cb('0xaa')]){throw new Error(_0x63cb('0xab'));}if(!_0x323361['body'][_0x63cb('0xac')]){throw new Error(_0x63cb('0xad'));}var _0xbe0a26=_0x323361[_0x63cb('0x37')][_0x63cb('0xa8')][_0x63cb('0xae')](',');var _0x177e3c=_0x323361[_0x63cb('0x37')]['binding_values']['split'](',');if(!_0xbe0a26[_0x63cb('0x2a')]||!_0x177e3c[_0x63cb('0x2a')]||_0xbe0a26['length']!==_0x177e3c['length']){throw new Error(_0x63cb('0xaf'));}_0x323361['body'][_0x63cb('0x83')]=_[_0x63cb('0xb0')](_0xbe0a26,_0x177e3c);if(!_0x323361[_0x63cb('0x37')]['fields'][_0x63cb('0x7b')]){throw new Error(_0x63cb('0xb1'));}if(!_0x323361['body'][_0x63cb('0x83')][_0x63cb('0xb2')]){throw new Error(_0x63cb('0xb3'));}var _0x3815cd=path[_0x63cb('0x3b')](config[_0x63cb('0xb4')],'server/files/tmp',_0x323361[_0x63cb('0xb5')][_0x63cb('0xb6')]);fs[_0x63cb('0xb7')](_0x3815cd,parseInt(_0x63cb('0xb8'),0x8));var _0x362789=require(_0x63cb('0xb9'))['fork'](path[_0x63cb('0x3b')](__dirname,_0x63cb('0xba')),[_0x3815cd,_0x323361[_0x63cb('0x37')][_0x63cb('0xa8')],_0x323361[_0x63cb('0x37')][_0x63cb('0xaa')],_0x323361['body'][_0x63cb('0x60')],_0x323361[_0x63cb('0x37')][_0x63cb('0xbb')],_0x323361['body']['duplicates'],_0x323361['body']['socket_timestamp']]);return _0x5a66e0[_0x63cb('0x11')](0xc8)['json']({'message':_0x63cb('0xbc'),'pid':_0x362789[_0x63cb('0xbd')]});}catch(_0x21c603){return _0x5a66e0[_0x63cb('0x11')](0x1f4)['send'](_0x21c603);}};exports[_0x63cb('0xbe')]=function(_0x5107f6,_0x11fc75){var _0x1b864d=fs['createReadStream'](_0x5107f6[_0x63cb('0xb5')][_0x63cb('0x3')]);Papa['parse'](_0x1b864d,{'header':!![],'skipEmptyLines':!![],'preview':0x1,'complete':function(_0x551e64){return _0x11fc75['status'](0xc8)['json']({'file':_0x5107f6[_0x63cb('0xb5')],'fields':_0x551e64[_0x63cb('0xbf')]['fields']});}});};exports[_0x63cb('0xc0')]=function(_0x26cb41,_0x1910f3){return db[_0x63cb('0xc1')]['findAll']({'raw':!![],'attributes':['id'],'where':{'role':_0x63cb('0xc2')}})[_0x63cb('0x18')](function(_0x4c18e8){var _0x335480=![];if(!_0x26cb41[_0x63cb('0x37')][_0x63cb('0x60')]){throw new Error(_0x63cb('0xa7'));}if(!_0x26cb41[_0x63cb('0x37')][_0x63cb('0xc3')]['phone']){throw new Error(_0x63cb('0xb1'));}if(!_0x26cb41['body'][_0x63cb('0xc3')][_0x63cb('0xb2')]){throw new Error(_0x63cb('0xb3'));}if(!_0x26cb41[_0x63cb('0x37')][_0x63cb('0xac')]){throw new Error(_0x63cb('0xad'));}var _0x3d2b2a=require(_0x63cb('0xb9'))['fork'](path['join'](__dirname,_0x63cb('0xc4')),[_0x26cb41[_0x63cb('0x6f')]['id'],JSON[_0x63cb('0xc5')](_0x26cb41[_0x63cb('0x37')]),JSON[_0x63cb('0xc5')](_0x4c18e8)]);_0x3d2b2a['on'](_0x63cb('0xc6'),function(){_0x335480=!![];return _0x1910f3['status'](0xc8)['json']({'message':_0x63cb('0xc7'),'pid':_0x3d2b2a['pid']});});_0x3d2b2a['on'](_0x63cb('0xc8'),function(_0x1a4ab5){if(_0x1a4ab5&&!_0x335480){return _0x1910f3[_0x63cb('0x11')](0x1f4)[_0x63cb('0x12')]({'message':_0x63cb('0xc9'),'pid':_0x3d2b2a[_0x63cb('0xbd')]});}});})[_0x63cb('0x25')](handleError(_0x1910f3,null));};exports[_0x63cb('0xca')]=function(_0x424acc,_0x41d98c){return db[_0x63cb('0xc1')][_0x63cb('0x22')]({'raw':!![],'attributes':['id'],'where':{'role':_0x63cb('0xc2')}})[_0x63cb('0x18')](function(_0x578440){var _0x214336=![];if(!_0x424acc['body'][_0x63cb('0x60')]){throw new Error(_0x63cb('0xa7'));}if(!_0x424acc[_0x63cb('0x37')][_0x63cb('0xc3')]['phone']){throw new Error(_0x63cb('0xb1'));}if(!_0x424acc['body'][_0x63cb('0xc3')][_0x63cb('0xb2')]){throw new Error('No\x20firstName\x20column\x20specified');}if(!_0x424acc[_0x63cb('0x37')]['socket_timestamp']){throw new Error(_0x63cb('0xad'));}var _0x20b573=require('child_process')[_0x63cb('0xcb')](path['join'](__dirname,_0x63cb('0xcc')),[_0x424acc['params']['id'],JSON[_0x63cb('0xc5')](_0x424acc[_0x63cb('0x37')]),JSON[_0x63cb('0xc5')](_0x578440)]);_0x20b573['on'](_0x63cb('0xc6'),function(){_0x214336=!![];return _0x41d98c[_0x63cb('0x11')](0xc8)[_0x63cb('0x12')]({'message':'start\x20child\x20process\x20correctly!','pid':_0x20b573[_0x63cb('0xbd')]});});_0x20b573['on'](_0x63cb('0xc8'),function(_0x39af16){if(_0x39af16&&!_0x214336){return _0x41d98c['status'](0x1f4)['json']({'message':'error\x20child\x20process','pid':_0x20b573['pid']});}});})[_0x63cb('0x25')](handleError(_0x41d98c,null));};exports[_0x63cb('0xcd')]=function(_0x7bec36,_0x384904){var _0x6971a1=[_0x63cb('0xce'),_0x63cb('0xcf'),'sms',_0x63cb('0xd0'),_0x63cb('0xd1'),_0x63cb('0xd2'),_0x63cb('0xd3')];var _0x5d4602={'offset':0x0,'order':qs[_0x63cb('0x85')](_0x63cb('0xd4'))},_0x1ae347={'count':0x0,'rows':[]};Promise[_0x63cb('0xd5')]()[_0x63cb('0x18')](function(){if(_0x7bec36[_0x63cb('0x23')][_0x63cb('0xd6')]){if(!_[_0x63cb('0xd7')](_0x6971a1,_0x7bec36[_0x63cb('0x23')]['channel'][_0x63cb('0xd8')]())){throw new Error(_0x63cb('0xd9'));}_0x6971a1=[_0x7bec36['query'][_0x63cb('0xd6')][_0x63cb('0xd8')]()];}if(_0x7bec36[_0x63cb('0x23')]['range']){try{var _0x5ea338=JSON[_0x63cb('0xda')](_0x7bec36[_0x63cb('0x23')][_0x63cb('0xdb')]);if(!moment(_0x5ea338[_0x63cb('0x38')])['isValid']()){throw new Error(_0x63cb('0xdc'));}if(!moment(_0x5ea338['to'])[_0x63cb('0xdd')]()){throw new Error(_0x63cb('0xde'));}}catch(_0x2a3a7d){throw new Error(_0x63cb('0xdf'));}}if(!_0x7bec36['query'][_0x63cb('0x35')](_0x63cb('0x9d'))){_0x5d4602[_0x63cb('0x15')]=qs[_0x63cb('0x15')](_0x7bec36[_0x63cb('0x23')][_0x63cb('0x15')]||0xa);_0x5d4602[_0x63cb('0x13')]=qs[_0x63cb('0x13')](_0x7bec36[_0x63cb('0x23')]['offset']);}var _0x40f300=_0x6971a1[_0x63cb('0x73')](function(_0x59c497){if(_0x59c497===_0x63cb('0xd3')){var _0x558588={'attributes':['id',_0x63cb('0xe0'),_0x63cb('0x31'),_0x63cb('0xe1'),_0x63cb('0xe2'),_0x63cb('0xe3'),_0x63cb('0xe4'),_0x63cb('0xe5'),_0x63cb('0xe6'),'note',_0x63cb('0xe7'),'userDisposition',_0x63cb('0xe8'),_0x63cb('0xe9'),_0x63cb('0xea')],'where':{'ContactId':_0x7bec36[_0x63cb('0x6f')]['id']},'include':[{'model':db[_0x63cb('0xc1')],'as':_0x63cb('0xc1'),'attributes':['id',_0x63cb('0x1e'),_0x63cb('0xeb'),_0x63cb('0x2f')]}],'order':[[_0x63cb('0xe7'),_0x63cb('0xec')]]};if(_0x7bec36[_0x63cb('0x23')][_0x63cb('0xdb')]){_0x558588['where']['createdAt']={'$gte':_0x5ea338['from'],'$lte':_0x5ea338['to']};}return db[_0x63cb('0x4e')]['findAndCountAll'](_0x558588)[_0x63cb('0x18')](function(_0x54de2f){_0x1ae347[_0x63cb('0x16')]+=_0x54de2f[_0x63cb('0x16')];return _['map'](_0x54de2f[_0x63cb('0xa1')],function(_0x141e94){var _0x417960=_0x141e94[_0x63cb('0x39')]({'plain':!![]});_0x417960[_0x63cb('0xd6')]=_0x59c497;if(_0x417960[_0x63cb('0xc1')]){_0x417960['User']={'id':_0x417960[_0x63cb('0xc1')]['id'],'name':_0x417960[_0x63cb('0xc1')][_0x63cb('0x1e')],'fullname':_0x417960[_0x63cb('0xc1')][_0x63cb('0xeb')],'alias':_0x417960[_0x63cb('0xc1')][_0x63cb('0x2f')]};}return _0x417960;});});}else{var _0x55f345=_['startCase'](_0x59c497)+(_0x59c497===_0x63cb('0xcf')?_0x63cb('0xed'):'Account');var _0x2fe4c1={'attributes':['id',_0x63cb('0xee'),_0x63cb('0xef'),_0x63cb('0xe7'),_0x63cb('0xf0'),_0x63cb('0xf1'),'secondDisposition',_0x63cb('0xf2'),_0x63cb('0xea'),_0x55f345+'Id'],'where':{'ContactId':_0x7bec36[_0x63cb('0x6f')]['id']},'include':[{'model':db[_0x55f345],'as':_0x63cb('0xf3'),'attributes':['id','name',_0x63cb('0xf4')]},{'model':db[_0x63cb('0xc1')],'as':'Owner','attributes':['id',_0x63cb('0x1e'),'fullname']},{'model':db[_0x63cb('0x7e')],'as':_0x63cb('0x66'),'attributes':['id',_0x63cb('0x1e'),_0x63cb('0xf5')],'through':{'attributes':[]}}],'order':[[_0x63cb('0xe7'),_0x63cb('0xec')]]};if(_0x7bec36[_0x63cb('0x23')]['range']){_0x2fe4c1[_0x63cb('0x5d')][_0x63cb('0xe7')]={'$gte':_0x5ea338[_0x63cb('0x38')],'$lte':_0x5ea338['to']};}switch(_0x59c497){case _0x63cb('0xcf'):_0x2fe4c1[_0x63cb('0x82')]['push'](_0x63cb('0xf6'),_0x63cb('0xf7'),'customerPort',_0x63cb('0xf8'),'osName',_0x63cb('0xf9'),'ratingType','ratingValue','referer');break;case _0x63cb('0xce'):_0x2fe4c1[_0x63cb('0x82')][_0x63cb('0x5f')](_0x63cb('0xfa'),'substatus');break;case _0x63cb('0xd0'):_0x2fe4c1['attributes'][_0x63cb('0x5f')](_0x63cb('0xfb'),'threadId');break;}return db[_[_0x63cb('0xfc')](_0x59c497)+'Interaction'][_0x63cb('0xfd')](_0x2fe4c1)[_0x63cb('0x18')](function(_0x451cb4){_0x1ae347[_0x63cb('0x16')]+=_0x451cb4[_0x63cb('0x16')];return _[_0x63cb('0x73')](_0x451cb4[_0x63cb('0xa1')],function(_0x15b3ef){var _0x501980=_0x15b3ef[_0x63cb('0x39')]({'plain':!![]});_0x501980[_0x63cb('0xd6')]=_0x59c497;if(_0x501980[_0x63cb('0xfe')]){_0x501980[_0x63cb('0xfe')]={'id':_0x501980[_0x63cb('0xfe')]['id'],'name':_0x501980[_0x63cb('0xfe')][_0x63cb('0x1e')],'fullname':_0x501980['Owner']['fullname']};}return _0x501980;});});}});return Promise[_0x63cb('0x64')](_0x40f300);})[_0x63cb('0x18')](function(_0x12972d){return _(_0x12972d)['flatten']()[_0x63cb('0xff')](_0x63cb('0xe7'))[_0x63cb('0x100')]()[_0x63cb('0x101')]();})[_0x63cb('0x18')](function(_0x4f3d14){_0x1ae347[_0x63cb('0xa1')]=_0x5d4602[_0x63cb('0x15')]?_0x4f3d14[_0x63cb('0x102')](_0x5d4602[_0x63cb('0x13')],_0x5d4602[_0x63cb('0x13')]+_0x5d4602['limit']):_0x4f3d14;return _0x1ae347;})['then'](respondWithFilteredResult(_0x384904,_0x5d4602))[_0x63cb('0x25')](handleError(_0x384904,null));}; \ No newline at end of file +var _0x242c=['text','phone','getTags','findOne','model','Tag','rawAttributes','filters','intersection','attributes','fields','order','sort','pick','filter','options','nolimit','setTags','ids','OrderBy','items','item_types','ItemTypeId','description','contact\x20phone\x20exists','PHONE','item','CmHopperId','ItemType.OrderBy','CmHopperAdditionalPhone','getAdditionalPhones','fromContactId','CmContactId','toContactId','rescheduleAdditionalPhones','hopperId','ContactId','includeAll','include','getHopperHistories','rows','JscriptySessionReport','uploadCsv','No\x20ListId\x20specified','binding_keys','No\x20association\x20keys\x20specified!','binding_values','No\x20association\x20values\x20specified!','socket_timestamp','Incorrect\x20binding\x20parameters\x20passed!','No\x20phone\x20column\x20specified','firstName','No\x20firstName\x20column\x20specified','root','server/files/tmp','file','chmodSync','0777','child_process','../../components/import/cm/csv','CompanyId','File\x20uploaded\x20correctly!','pid','send','createReadStream','parse','meta','agent','binding','Unable\x20to\x20synchronize\x20socket,\x20no\x20timestamp\x20passed','stringify','exit','error\x20child\x20process','importUpdates','User','fork','../../components/import/cm/csvUpdates','message','start\x20child\x20process\x20correctly!','getJourney','mail','chat','sms','openchannel','whatsapp','voice','-createdAt','channel','includes','toLowerCase','Invalid\x20channel','range','isValid','Invalid\x20date\x20for\x20range\x20from\x20filter','Invalid\x20date\x20for\x20range\x20to\x20filter','source','callerid','starttime','endtime','duration','note','userThirdDisposition','UserId','fullname','alias','createdAt','DESC','VoiceCallReport','findAndCountAll','Account','closed','closedAt','disposition','secondDisposition','key','Owner','Tags','browserName','customerPort','deviceModel','ratingMessage','ratingType','referer','externalUrl','threadId','Interaction','flatten','sortBy','reverse','value','slice','moment','bluebird','util','path','lodash','squel','ioredis','../../components/contacts','../../components/parsers/qs','api','../../config/environment','../../config/environment/shared','../../mysqldb','defaults','redis','socket.io-emitter','./cmContact.socket','register','status','json','offset','undefined','limit','count','set','Content-Range','update','then','destroy','end','error','stack','name','describe','getOptions','findAll','query','catch','CmContact','params','tags','keys','length','startsWith','cf_','columnName','analytics','CmCustomField','displayName','custom','type','values','info','Custom\x20field\x20%s\x20not\x20found\x20on\x20cm_contacts\x20table','forEach','hasOwnProperty','merge','body','from','get','mergeWith','isArray','join','[CmContact][merge]\x20to\x20%s\x20from\x20%s','CmHopper','CmHopperBlack','create','ChatInteraction','ChatMessage','MailInteraction','MailMessage','SmsInteraction','OpenchannelMessage','CmContactHasItem','CmHopperFinal','CmHopperHistory','ReportAgentPreview','ChatQueueReport','MailQueueReport','WhatsappInteraction','WhatsappMessage','isNil','dialTimezone','utcOffset','additionalPhones','bulkCreate','duplicates','$or','push','ListId','findOrCreate','all','find','tag','Phones','ContactItemType','ItemType','sequelize','literal','where','$and','omit','map','cf_%d','timezones','format','isEmpty','table','cm_contacts','setFields','toParam'];(function(_0x48cc37,_0x25bc75){var _0x407d38=function(_0x1e1863){while(--_0x1e1863){_0x48cc37['push'](_0x48cc37['shift']());}};_0x407d38(++_0x25bc75);}(_0x242c,0x83));var _0xc242=function(_0x99d5a0,_0x253e41){_0x99d5a0=_0x99d5a0-0x0;var _0x3b19de=_0x242c[_0x99d5a0];return _0x3b19de;};'use strict';var moment=require(_0xc242('0x0'));var BPromise=require(_0xc242('0x1'));var util=require(_0xc242('0x2'));var path=require(_0xc242('0x3'));var fs=require('fs');var _=require(_0xc242('0x4'));var squel=require(_0xc242('0x5'));var Papa=require('papaparse');var Redis=require(_0xc242('0x6'));var contacts=require(_0xc242('0x7'));var qs=require(_0xc242('0x8'));var logger=require('../../config/logger')(_0xc242('0x9'));var config=require(_0xc242('0xa'));var shared=require(_0xc242('0xb'));var db=require(_0xc242('0xc'))['db'];config['redis']=_[_0xc242('0xd')](config[_0xc242('0xe')],{'host':'localhost','port':0x18eb});var socket=require(_0xc242('0xf'))(new Redis(config[_0xc242('0xe')]));require(_0xc242('0x10'))[_0xc242('0x11')](socket);function respondWithResult(_0x23dfcd,_0x48bcfb){_0x48bcfb=_0x48bcfb||0xc8;return function(_0x3b3e37){if(_0x3b3e37){return _0x23dfcd[_0xc242('0x12')](_0x48bcfb)[_0xc242('0x13')](_0x3b3e37);}};}function respondWithFilteredResult(_0x294e4e,_0x3799c3){return function(_0x3ef6ef){if(_0x3ef6ef){var _0x36843e=typeof _0x3799c3[_0xc242('0x14')]===_0xc242('0x15')&&typeof _0x3799c3[_0xc242('0x16')]===_0xc242('0x15');var _0x262b82=_0x3ef6ef['count'];var _0x330854=_0x36843e?0x0:_0x3799c3[_0xc242('0x14')];var _0x502f30=_0x36843e?_0x3ef6ef[_0xc242('0x17')]:_0x3799c3[_0xc242('0x14')]+_0x3799c3[_0xc242('0x16')];var _0x3b24d9;if(_0x502f30>=_0x262b82){_0x502f30=_0x262b82;_0x3b24d9=0xc8;}else{_0x3b24d9=0xce;}_0x294e4e[_0xc242('0x12')](_0x3b24d9);return _0x294e4e[_0xc242('0x18')](_0xc242('0x19'),_0x330854+'-'+_0x502f30+'/'+_0x262b82)['json'](_0x3ef6ef);}return null;};}function saveUpdates(_0x5ff1e8){return function(_0x2f094c){if(_0x2f094c){return _0x2f094c[_0xc242('0x1a')](_0x5ff1e8)[_0xc242('0x1b')](function(_0x29fb7a){return _0x29fb7a;});}return null;};}function removeEntity(_0x5d15cf){return function(_0x32efee){if(_0x32efee){return _0x32efee[_0xc242('0x1c')]()[_0xc242('0x1b')](function(){_0x5d15cf[_0xc242('0x12')](0xcc)[_0xc242('0x1d')]();});}};}function handleEntityNotFound(_0x49c4dc){return function(_0x1cdd18){if(!_0x1cdd18){_0x49c4dc['sendStatus'](0x194);}return _0x1cdd18;};}function handleError(_0x298ca0,_0x1829c7){_0x1829c7=_0x1829c7||0x1f4;return function(_0x2e6b4a){logger[_0xc242('0x1e')](_0x2e6b4a[_0xc242('0x1f')]);if(_0x2e6b4a[_0xc242('0x20')]){delete _0x2e6b4a['name'];}_0x298ca0['status'](_0x1829c7)['send'](_0x2e6b4a);};}exports['index']=function(_0xf596d8,_0x3df3a5){var _0x4c7520={};return contacts[_0xc242('0x21')]()[_0xc242('0x1b')](function(_0x5e726a){_0x4c7520=qs[_0xc242('0x22')](_0x5e726a,_0xf596d8);return contacts[_0xc242('0x23')](_0xf596d8[_0xc242('0x24')],_0xf596d8['user'],_0x4c7520,_0x5e726a);})[_0xc242('0x1b')](respondWithFilteredResult(_0x3df3a5,_0x4c7520))[_0xc242('0x25')](handleError(_0x3df3a5,null));};exports['destroy']=function(_0x288f17,_0x4f2828){return db[_0xc242('0x26')]['find']({'where':{'id':_0x288f17[_0xc242('0x27')]['id']}})[_0xc242('0x1b')](handleEntityNotFound(_0x4f2828,null))['then'](removeEntity(_0x4f2828,null))[_0xc242('0x25')](handleError(_0x4f2828,null));};exports['describe']=function(_0x200e50,_0x5865a6){return db[_0xc242('0x26')][_0xc242('0x21')]()['then'](function(_0x1f416f){delete _0x1f416f[_0xc242('0x28')];for(var _0x4bcf0f=0x0;_0x4bcf0f0x0){return new Promise(function(_0x108d10){var _0x177438=[];for(var _0x253716=0x0;_0x253716<_0x1cc9dc['length'];_0x253716++){_0x177438[_0xc242('0x58')](insertAdditionalPhones(_0x1cc9dc[_0x253716]['contact'],_0x1cc9dc[_0x253716][_0xc242('0x54')]));}Promise[_0xc242('0x5b')](_0x177438)[_0xc242('0x1b')](function(){_0x108d10(0x1);});})[_0xc242('0x1b')](function(){return{'success':_0xe8d421,'failure':_0x1cd311,'duplicates':_0x128c3f};});}else{return{'success':_0xe8d421,'failure':_0x1cd311,'duplicates':_0x128c3f};}}})['then'](respondWithResult(_0x1cce86,0xc9))['catch'](handleError(_0x1cce86,null));};exports['show']=function(_0x20b067,_0x3c356c){var _0x1c609c;return db['CmContact']['describe']()['then'](function(_0x3ae82d){return db['CmContact'][_0xc242('0x5c')]({'where':{'id':_0x20b067[_0xc242('0x27')]['id']},'include':[{'model':db['Tag'],'as':'Tags','attributes':['id','name','color'],'required':_0x20b067['query'][_0xc242('0x5d')]?!![]:![]},{'model':db[_0xc242('0x49')],'as':_0xc242('0x5e'),'where':{'CmContactId':_0x20b067[_0xc242('0x27')]['id']},'required':![],'include':[{'model':db[_0xc242('0x5f')],'as':_0xc242('0x60')}]}],'order':[db[_0xc242('0x61')][_0xc242('0x62')]('Phones.OrderBy')],'attributes':_[_0xc242('0x29')](_0x3ae82d)});})[_0xc242('0x1b')](function(_0x464b2b){if(!_[_0xc242('0x51')](_0x464b2b)){_0x1c609c=_0x464b2b['get']({'plain':!![]});var _0x4df472={'where':{'$and':[{'ListId':{'$ne':null}}]}};if(_0x464b2b&&_0x464b2b[_0xc242('0x59')]){if(_0x464b2b[_0xc242('0x59')]){_0x4df472[_0xc242('0x63')][_0xc242('0x64')][_0xc242('0x58')]({'ListId':{'$ne':_0x464b2b['ListId']}});}}return db[_0xc242('0x2f')][_0xc242('0x23')](_0x4df472);}})[_0xc242('0x1b')](function(_0x142119){if(!_[_0xc242('0x51')](_0x142119)){return _[_0xc242('0x65')](_0x1c609c,_[_0xc242('0x66')](_0x142119,function(_0xb3835a){return util['format'](_0xc242('0x67'),_0xb3835a['id']);}));}})[_0xc242('0x1b')](handleEntityNotFound(_0x3c356c,null))[_0xc242('0x1b')](respondWithResult(_0x3c356c,null))['catch'](handleError(_0x3c356c,null));};exports[_0xc242('0x1a')]=function(_0x277765,_0x23da26){var _0x21201d;if(_0x277765[_0xc242('0x39')]['id']){delete _0x277765['body']['id'];}if(!_[_0xc242('0x51')](_0x277765[_0xc242('0x39')]['dialTimezone'])){var _0x4db4aa=_0x277765[_0xc242('0x39')][_0xc242('0x52')];if(!_[_0xc242('0x51')](shared['timezones'][_0x4db4aa]))_0x277765['body'][_0xc242('0x53')]=shared[_0xc242('0x68')][_0x4db4aa][_0xc242('0x53')];}return db[_0xc242('0x26')]['find']({'where':{'id':_0x277765['params']['id']}})[_0xc242('0x1b')](handleEntityNotFound(_0x23da26,null))[_0xc242('0x1b')](saveUpdates(_0x277765[_0xc242('0x39')],null))[_0xc242('0x1b')](function(_0x14e5d3){_0x21201d=_0x14e5d3;var _0x1962f5={'where':{'$and':[{'ListId':{'$ne':null}}]}};if(_0x14e5d3&&_0x14e5d3[_0xc242('0x59')]){if(_0x14e5d3['ListId']){_0x1962f5[_0xc242('0x63')][_0xc242('0x64')]['push']({'ListId':{'$ne':_0x14e5d3[_0xc242('0x59')]}});}}return db['CmCustomField']['findAll'](_0x1962f5);})[_0xc242('0x1b')](function(_0x546957){if(_0x546957){return _[_0xc242('0x65')](_['pickBy'](_0x277765[_0xc242('0x39')],function(_0x5f10bc,_0x32edcc){return _[_0xc242('0x2b')](_0x32edcc,_0xc242('0x2c'));}),_[_0xc242('0x66')](_0x546957,function(_0x1753ee){return util[_0xc242('0x69')](_0xc242('0x67'),_0x1753ee['id']);}));}})['then'](function(_0x5d61eb){if(_0x5d61eb&&!_[_0xc242('0x6a')](_0x5d61eb)){var _0x29ca0b=squel[_0xc242('0x1a')]()[_0xc242('0x6b')](_0xc242('0x6c'))[_0xc242('0x6d')](_0x5d61eb)[_0xc242('0x63')]('id\x20=\x20?',_0x277765[_0xc242('0x27')]['id'])[_0xc242('0x6e')]();return db[_0xc242('0x61')]['query'](_0x29ca0b[_0xc242('0x6f')],{'replacements':_0x29ca0b[_0xc242('0x33')]});}})[_0xc242('0x1b')](function(){if(_0x277765['body'][_0xc242('0x70')]&&_0x21201d){return db[_0xc242('0x40')][_0xc242('0x1a')]({'phone':_0x277765[_0xc242('0x39')][_0xc242('0x70')],'OrderBy':0x0},{'where':{'ContactId':_0x21201d['id']}});}})[_0xc242('0x1b')](function(){return _0x21201d;})['then'](respondWithResult(_0x23da26,null))[_0xc242('0x25')](handleError(_0x23da26,null));};exports[_0xc242('0x71')]=function(_0x1eb784,_0x1440eb){var _0x5f301a={};var _0x37cb7f={};var _0x1ff9ad;var _0x196f77;return db[_0xc242('0x26')][_0xc242('0x72')]({'where':{'id':_0x1eb784['params']['id']}})['then'](handleEntityNotFound(_0x1440eb,null))['then'](function(_0x174da2){if(_0x174da2){_0x1ff9ad=_0x174da2;_0x37cb7f[_0xc242('0x73')]=_[_0xc242('0x29')](db[_0xc242('0x74')][_0xc242('0x75')]);_0x37cb7f[_0xc242('0x24')]=_[_0xc242('0x29')](_0x1eb784[_0xc242('0x24')]);_0x37cb7f[_0xc242('0x76')]=_[_0xc242('0x77')](_0x37cb7f['model'],_0x37cb7f[_0xc242('0x24')]);_0x5f301a[_0xc242('0x78')]=_[_0xc242('0x77')](_0x37cb7f['model'],qs[_0xc242('0x79')](_0x1eb784[_0xc242('0x24')][_0xc242('0x79')]));_0x5f301a['attributes']=_0x5f301a[_0xc242('0x78')]['length']?_0x5f301a[_0xc242('0x78')]:_0x37cb7f[_0xc242('0x73')];_0x5f301a[_0xc242('0x7a')]=qs[_0xc242('0x7b')](_0x1eb784[_0xc242('0x24')][_0xc242('0x7b')]);_0x5f301a[_0xc242('0x63')]=qs[_0xc242('0x76')](_[_0xc242('0x7c')](_0x1eb784[_0xc242('0x24')],_0x37cb7f[_0xc242('0x76')]));if(_0x1eb784[_0xc242('0x24')]['filter']){_0x5f301a['where']=_[_0xc242('0x38')](_0x5f301a[_0xc242('0x63')],{'$or':_[_0xc242('0x66')](_0x5f301a[_0xc242('0x78')],function(_0x49495a){var _0x146264={};_0x146264[_0x49495a]={'$like':'%'+_0x1eb784[_0xc242('0x24')][_0xc242('0x7d')]+'%'};return _0x146264;})});}_0x5f301a=_['merge']({},_0x5f301a,_0x1eb784[_0xc242('0x7e')]);return _0x1ff9ad['getTags'](_0x5f301a);}})[_0xc242('0x1b')](function(_0x56cc91){if(_0x56cc91){_0x196f77=_0x56cc91[_0xc242('0x2a')];if(!_0x1eb784['query']['hasOwnProperty'](_0xc242('0x7f'))){_0x5f301a[_0xc242('0x16')]=qs[_0xc242('0x16')](_0x1eb784[_0xc242('0x24')][_0xc242('0x16')]);_0x5f301a['offset']=qs[_0xc242('0x14')](_0x1eb784[_0xc242('0x24')][_0xc242('0x14')]);}return _0x1ff9ad[_0xc242('0x71')](_0x5f301a);}})[_0xc242('0x1b')](function(_0x363774){if(_0x363774){return _0x363774?{'count':_0x196f77,'rows':_0x363774}:null;}})[_0xc242('0x1b')](respondWithResult(_0x1440eb,null))['catch'](handleError(_0x1440eb,null));};exports[_0xc242('0x80')]=function(_0x43e81b,_0x51440f){if(_0x43e81b[_0xc242('0x39')]['id']){delete _0x43e81b['body']['id'];}return db['CmContact']['findOne']({'where':{'id':_0x43e81b[_0xc242('0x27')]['id']}})[_0xc242('0x1b')](handleEntityNotFound(_0x51440f,null))[_0xc242('0x1b')](function(_0xbb7e47){if(_0xbb7e47){return _0xbb7e47[_0xc242('0x80')](_0x43e81b[_0xc242('0x39')][_0xc242('0x81')]||[]);}return null;})[_0xc242('0x1b')](respondWithResult(_0x51440f,null))[_0xc242('0x25')](handleError(_0x51440f,null));};exports['setAdditionalPhones']=function(_0x1dde5e,_0x12cd54){var _0x447786=[];_0x447786[_0xc242('0x58')](addAdditionalPhones(_0x1dde5e[_0xc242('0x39')]));Promise['all'](_0x447786)[_0xc242('0x1b')](function(){_0x447786=[];_0x447786[_0xc242('0x58')](deleteCmHopperPhones(_0x1dde5e['body']['id']));_0x447786[_0xc242('0x58')](addCmHopperPhones(_0x1dde5e[_0xc242('0x39')]['id']));Promise[_0xc242('0x5b')](_0x447786)[_0xc242('0x1b')](function(){return[0x1];})[_0xc242('0x1b')](respondWithResult(_0x12cd54,null));});};function addAdditionalPhones(_0x32ff88){var _0x303a85;return new Promise(function(_0x28e6c3){return db['CmContactHasItem'][_0xc242('0x1c')]({'where':{'CmContactId':_0x32ff88['id']}})[_0xc242('0x1b')](function(){db[_0xc242('0x5f')][_0xc242('0x23')]({'raw':!![],'attributes':['id',_0xc242('0x82')]})[_0xc242('0x1b')](function(_0x5b2e5a){var _0x47a68d=[];for(var _0x4ffdfb=0x0;_0x4ffdfb<_0x32ff88[_0xc242('0x83')][_0xc242('0x2a')];_0x4ffdfb++){var _0x285023=_0x32ff88[_0xc242('0x84')]?_[_0xc242('0x51')](_0x32ff88['item_types'][_0x4ffdfb])?'':_0x32ff88[_0xc242('0x84')][_0x4ffdfb]:_0x32ff88['items'][_0x4ffdfb][_0xc242('0x85')]?_0x32ff88[_0xc242('0x83')][_0x4ffdfb]['ItemTypeId']:'';var _0x23a9ad=_[_0xc242('0x51')](_0x32ff88['items'][_0x4ffdfb][_0xc242('0x86')])?'':_0x32ff88['items'][_0x4ffdfb][_0xc242('0x86')];var _0x4957ff=_0x285023+':'+_0x32ff88[_0xc242('0x83')][_0x4ffdfb][_0xc242('0x70')]+'§'+_0x23a9ad;if(_[_0xc242('0x51')](_0x303a85))_0x303a85=_0x4957ff;else _0x303a85+=';'+_0x4957ff;var _0xc65383=null;var _0x4c446b=null;if(_0x32ff88[_0xc242('0x84')]){if(!_[_0xc242('0x51')](_0x32ff88[_0xc242('0x84')][_0x4ffdfb])){_0x4c446b=_[_0xc242('0x5c')](_0x5b2e5a,function(_0x2a0ec5){return _0x2a0ec5['id']===_0x32ff88[_0xc242('0x84')][_0x4ffdfb];});if(!_[_0xc242('0x51')](_0x4c446b)){_0xc65383=_0x4c446b[_0xc242('0x82')];}}}else{if(!_['isNil'](_0x32ff88[_0xc242('0x83')][_0x4ffdfb])){_0x4c446b=_[_0xc242('0x5c')](_0x5b2e5a,function(_0x4629e3){return _0x4629e3['id']===_0x32ff88['items'][_0x4ffdfb]['ItemTypeId'];});if(!_['isNil'](_0x4c446b)){_0xc65383=_0x4ffdfb;}}}if(_[_0xc242('0x51')](_0xc65383)){_0xc65383=0x64;}_0x47a68d[_0xc242('0x58')](addAdditionalPhone(_0x32ff88['id'],_0x32ff88[_0xc242('0x83')][_0x4ffdfb][_0xc242('0x70')],_0x32ff88['item_types']?_[_0xc242('0x51')](_0x32ff88[_0xc242('0x84')][_0x4ffdfb])?null:_0x32ff88[_0xc242('0x84')][_0x4ffdfb]:_0x32ff88[_0xc242('0x83')][_0x4ffdfb][_0xc242('0x85')]?_0x32ff88['items'][_0x4ffdfb][_0xc242('0x85')]:null,_0xc65383,_0x23a9ad));}Promise[_0xc242('0x5b')](_0x47a68d)[_0xc242('0x1b')](function(){db[_0xc242('0x26')][_0xc242('0x1a')]({'AdditionalPhones':_0x303a85},{'where':{'id':_0x32ff88['id']}})[_0xc242('0x1b')](function(){_0x28e6c3(0x1);});});});});});}function addAdditionalPhone(_0x11651b,_0x3fcd17,_0x54b7c2,_0x19543b,_0x48f271){return db[_0xc242('0x49')][_0xc242('0x5c')]({'where':{'CmContactId':_0x11651b,'item':_0x3fcd17}})['then'](function(_0x1f17aa){if(_0x1f17aa)logger[_0xc242('0x34')](_0xc242('0x87'),_0x1f17aa);else{db[_0xc242('0x49')][_0xc242('0x42')]({'CmContactId':_0x11651b,'item':_0x3fcd17,'ItemTypeId':_0x54b7c2,'OrderBy':_0x19543b,'ItemClass':_0xc242('0x88'),'description':_0x48f271});}});}function deleteCmHopperPhones(_0x4d27dd){return new Promise(function(_0x20f6dc){return db['CmHopper']['findAll']({'raw':!![],'attributes':['id'],'where':{'ContactId':_0x4d27dd}})[_0xc242('0x1b')](function(_0x121a5a){db['CmHopperAdditionalPhone'][_0xc242('0x1c')]({'where':{'CmHopperId':{'$in':_[_0xc242('0x66')](_0x121a5a,'id')}}});})[_0xc242('0x1b')](function(){_0x20f6dc(0x1);});});}function addCmHopperPhones(_0x14dcf0){return new Promise(function(_0x1013b1){return db[_0xc242('0x40')]['findAll']({'raw':!![],'attributes':['id'],'where':{'ContactId':_0x14dcf0}})[_0xc242('0x1b')](function(_0x3729f7){var _0x553401=[];_['map'](_0x3729f7,function(_0x2f73d0){_0x553401['push'](createCmHopperPhone(_0x14dcf0,_0x2f73d0['id']));});Promise[_0xc242('0x5b')](_0x553401)[_0xc242('0x1b')](function(){_0x1013b1(0x1);});});});}function createCmHopperPhone(_0x213991,_0x31ae76){return new Promise(function(_0x2414e5){db[_0xc242('0x49')][_0xc242('0x23')]({'raw':!![],'attributes':[_0xc242('0x89'),_0xc242('0x82')],'where':{'CmContactId':_0x213991,'ItemClass':_0xc242('0x88')},'include':[{'model':db['ContactItemType'],'attributes':[_0xc242('0x82')],'as':_0xc242('0x60')}],'order':[_0xc242('0x82'),db[_0xc242('0x61')][_0xc242('0x62')]('`ItemType`.OrderBy')]})[_0xc242('0x1b')](function(_0x5a85f7){var _0x5540be=0x1;var _0x43a4df=_['map'](_0x5a85f7,function(_0x29aca9){_0x29aca9[_0xc242('0x8a')]=_0x31ae76;_0x29aca9[_0xc242('0x70')]=_0x29aca9[_0xc242('0x89')];_0x29aca9[_0xc242('0x82')]=_0x5540be;delete _0x29aca9[_0xc242('0x8b')];_0x5540be=_0x5540be+0x1;return _0x29aca9;});return db[_0xc242('0x8c')][_0xc242('0x55')](_0x43a4df,{});})[_0xc242('0x1b')](function(){_0x2414e5(0x1);});});}function insertAdditionalPhones(_0x12e45d,_0x414c3a){return new Promise(function(_0x1aea96){var _0x550bc6=[];for(var _0x1556dc=0x0;_0x1556dc<_0x414c3a[_0xc242('0x2a')];_0x1556dc++){var _0x2773fc=_0x414c3a[_0x1556dc];_0x550bc6[_0xc242('0x58')](parseContactItemType(_0x2773fc));}Promise[_0xc242('0x5b')](_0x550bc6)[_0xc242('0x1b')](function(){var _0x1e4782={'id':_0x12e45d['id'],'items':_0x414c3a};return addAdditionalPhones(_0x1e4782)[_0xc242('0x1b')](function(){return addCmHopperPhones(_0x12e45d['id']);});})[_0xc242('0x1b')](function(){_0x1aea96(_0x12e45d);});});}function parseContactItemType(_0x5d567c){return new Promise(function(_0xba4ed2){if(_0x5d567c['hasOwnProperty'](_0xc242('0x85'))){_0xba4ed2(_0x5d567c);}else{return db[_0xc242('0x5f')]['find']({'where':{'name':_0x5d567c['ItemType']}})['then'](function(_0x29070b){if(_['isNil'](_0x29070b))_0x5d567c[_0xc242('0x85')]=null;else _0x5d567c[_0xc242('0x85')]=_0x29070b['id'];_0xba4ed2(_0x5d567c);});}});}exports[_0xc242('0x8d')]=function(_0x5a1d64,_0x926a96){return db['CmContactHasItem']['findAll']({'raw':!![],'where':{'CmContactId':_0x5a1d64[_0xc242('0x27')]['id'],'ItemClass':'PHONE'},'include':[{'model':db[_0xc242('0x5f')],'as':_0xc242('0x60')}],'order':[[_0xc242('0x82')],[db[_0xc242('0x61')]['literal']('`ItemType`.OrderBy')]]})['then'](function(_0x2ae27f){return _0x2ae27f;})[_0xc242('0x1b')](respondWithResult(_0x926a96,null))[_0xc242('0x25')](handleError(_0x926a96,null));};exports['duplicateAdditionalPhones']=function(_0x1cb0b4,_0x122b6e){return db[_0xc242('0x49')][_0xc242('0x23')]({'raw':!![],'where':{'CmContactId':_0x1cb0b4[_0xc242('0x39')][_0xc242('0x8e')]}})[_0xc242('0x1b')](function(_0x3cbf19){var _0x5d0ac1=_[_0xc242('0x66')](_0x3cbf19,function(_0x81e4ac){_0x81e4ac[_0xc242('0x8f')]=_0x1cb0b4[_0xc242('0x39')][_0xc242('0x90')];return _0x81e4ac;});return db[_0xc242('0x49')][_0xc242('0x55')](_0x5d0ac1,{});})[_0xc242('0x1b')](function(){return addCmHopperPhones(_0x1cb0b4[_0xc242('0x39')][_0xc242('0x90')]);})['then'](function(){return['ok'];})['then'](respondWithResult(_0x122b6e,null))[_0xc242('0x25')](handleError(_0x122b6e,null));};exports[_0xc242('0x91')]=function(_0xfc51cc,_0x167100){var _0x4d0343=[];_0x4d0343['push'](createCmHopperPhone(_0xfc51cc[_0xc242('0x39')]['id'],_0xfc51cc['body'][_0xc242('0x92')]));Promise[_0xc242('0x5b')](_0x4d0343)[_0xc242('0x1b')](function(){return[0x1];})[_0xc242('0x1b')](respondWithResult(_0x167100,null));};exports['getHoppers']=function(_0x2500d4,_0x353d71){var _0x4d6eab={'raw':![],'where':{}};var _0x4bef22={};var _0x487c0d={'count':0x0,'rows':[]};return db[_0xc242('0x26')][_0xc242('0x72')]({'where':{'id':_0x2500d4[_0xc242('0x27')]['id']}})[_0xc242('0x1b')](handleEntityNotFound(_0x353d71,null))['then'](function(_0x2fafdb){if(_0x2fafdb){_0x4bef22[_0xc242('0x73')]=_[_0xc242('0x29')](db[_0xc242('0x40')][_0xc242('0x75')]);_0x4bef22[_0xc242('0x24')]=_[_0xc242('0x29')](_0x2500d4[_0xc242('0x24')]);_0x4bef22[_0xc242('0x76')]=_[_0xc242('0x77')](_0x4bef22['model'],_0x4bef22[_0xc242('0x24')]);_0x4d6eab[_0xc242('0x78')]=_[_0xc242('0x77')](_0x4bef22['model'],qs['fields'](_0x2500d4['query'][_0xc242('0x79')]));_0x4d6eab[_0xc242('0x78')]=_0x4d6eab[_0xc242('0x78')][_0xc242('0x2a')]?_0x4d6eab[_0xc242('0x78')]:_0x4bef22[_0xc242('0x73')];if(!_0x2500d4[_0xc242('0x24')][_0xc242('0x37')](_0xc242('0x7f'))){_0x4d6eab[_0xc242('0x16')]=qs[_0xc242('0x16')](_0x2500d4[_0xc242('0x24')][_0xc242('0x16')]);_0x4d6eab[_0xc242('0x14')]=qs[_0xc242('0x14')](_0x2500d4[_0xc242('0x24')][_0xc242('0x14')]);}_0x4d6eab[_0xc242('0x7a')]=qs[_0xc242('0x7b')](_0x2500d4['query']['sort']);_0x4d6eab[_0xc242('0x63')]=qs[_0xc242('0x76')](_[_0xc242('0x7c')](_0x2500d4['query'],_0x4bef22[_0xc242('0x76')]));_0x4d6eab['where'][_0xc242('0x93')]=_0x2fafdb['id'];if(_0x2500d4[_0xc242('0x24')]['filter']){_0x4d6eab['where']=_[_0xc242('0x38')](_0x4d6eab[_0xc242('0x63')],{'$or':_[_0xc242('0x66')](_0x4d6eab[_0xc242('0x78')],function(_0x4b0da1){var _0x2e9491={};_0x2e9491[_0x4b0da1]={'$like':'%'+_0x2500d4[_0xc242('0x24')][_0xc242('0x7d')]+'%'};return _0x2e9491;})});}_0x4d6eab=_[_0xc242('0x38')]({},_0x4d6eab,_0x2500d4[_0xc242('0x7e')]);return db[_0xc242('0x40')][_0xc242('0x17')]({'where':_0x4d6eab['where']})[_0xc242('0x1b')](function(_0xe96bd3){_0x487c0d[_0xc242('0x17')]=_0xe96bd3;if(_0x2500d4[_0xc242('0x24')][_0xc242('0x94')]){_0x4d6eab[_0xc242('0x95')]=[{'all':!![]}];}return db[_0xc242('0x40')][_0xc242('0x23')](_0x4d6eab);})['then'](function(_0x4b72b9){_0x487c0d['rows']=_0x4b72b9;return _0x487c0d;});}})[_0xc242('0x1b')](respondWithFilteredResult(_0x353d71,_0x4d6eab))[_0xc242('0x25')](handleError(_0x353d71,null));};exports[_0xc242('0x96')]=function(_0xb5e3f,_0x3e1075){var _0x765cb8={'raw':!![],'where':{}};var _0x416e2f={};var _0x1e12e6={'count':0x0,'rows':[]};return db['CmContact'][_0xc242('0x72')]({'where':{'id':_0xb5e3f['params']['id']}})[_0xc242('0x1b')](handleEntityNotFound(_0x3e1075,null))[_0xc242('0x1b')](function(_0x64ac88){if(_0x64ac88){_0x416e2f[_0xc242('0x73')]=_[_0xc242('0x29')](db['CmHopperHistory'][_0xc242('0x75')]);_0x416e2f[_0xc242('0x24')]=_[_0xc242('0x29')](_0xb5e3f[_0xc242('0x24')]);_0x416e2f['filters']=_[_0xc242('0x77')](_0x416e2f['model'],_0x416e2f[_0xc242('0x24')]);_0x765cb8[_0xc242('0x78')]=_['intersection'](_0x416e2f[_0xc242('0x73')],qs['fields'](_0xb5e3f[_0xc242('0x24')][_0xc242('0x79')]));_0x765cb8['attributes']=_0x765cb8[_0xc242('0x78')][_0xc242('0x2a')]?_0x765cb8['attributes']:_0x416e2f[_0xc242('0x73')];if(!_0xb5e3f[_0xc242('0x24')][_0xc242('0x37')](_0xc242('0x7f'))){_0x765cb8[_0xc242('0x16')]=qs[_0xc242('0x16')](_0xb5e3f['query']['limit']);_0x765cb8[_0xc242('0x14')]=qs[_0xc242('0x14')](_0xb5e3f[_0xc242('0x24')][_0xc242('0x14')]);}_0x765cb8['order']=qs[_0xc242('0x7b')](_0xb5e3f[_0xc242('0x24')][_0xc242('0x7b')]);_0x765cb8[_0xc242('0x63')]=qs[_0xc242('0x76')](_['pick'](_0xb5e3f[_0xc242('0x24')],_0x416e2f[_0xc242('0x76')]));_0x765cb8[_0xc242('0x63')]['ContactId']=_0x64ac88['id'];if(_0xb5e3f[_0xc242('0x24')][_0xc242('0x7d')]){_0x765cb8[_0xc242('0x63')]=_[_0xc242('0x38')](_0x765cb8[_0xc242('0x63')],{'$or':_['map'](_0x765cb8[_0xc242('0x78')],function(_0x2bc66b){var _0x520e40={};_0x520e40[_0x2bc66b]={'$like':'%'+_0xb5e3f[_0xc242('0x24')][_0xc242('0x7d')]+'%'};return _0x520e40;})});}_0x765cb8=_['merge']({},_0x765cb8,_0xb5e3f[_0xc242('0x7e')]);return db['CmHopperHistory'][_0xc242('0x17')]({'where':_0x765cb8[_0xc242('0x63')]})[_0xc242('0x1b')](function(_0x9ec41f){_0x1e12e6[_0xc242('0x17')]=_0x9ec41f;if(_0xb5e3f[_0xc242('0x24')]['includeAll']){_0x765cb8['include']=[{'all':!![]}];}return db[_0xc242('0x4b')][_0xc242('0x23')](_0x765cb8);})['then'](function(_0x15c971){_0x1e12e6[_0xc242('0x97')]=_0x15c971;return _0x1e12e6;});}})[_0xc242('0x1b')](respondWithFilteredResult(_0x3e1075,_0x765cb8))[_0xc242('0x25')](handleError(_0x3e1075,null));};exports['getHopperFinals']=function(_0xe0eba6,_0x458815){var _0x1fd82d={'raw':!![],'where':{}};var _0x1fb9c2={};var _0x51b99b={'count':0x0,'rows':[]};return db[_0xc242('0x26')][_0xc242('0x72')]({'where':{'id':_0xe0eba6[_0xc242('0x27')]['id']}})[_0xc242('0x1b')](handleEntityNotFound(_0x458815,null))[_0xc242('0x1b')](function(_0x174f3d){if(_0x174f3d){_0x1fb9c2[_0xc242('0x73')]=_['keys'](db[_0xc242('0x4a')][_0xc242('0x75')]);_0x1fb9c2['query']=_['keys'](_0xe0eba6[_0xc242('0x24')]);_0x1fb9c2[_0xc242('0x76')]=_['intersection'](_0x1fb9c2['model'],_0x1fb9c2[_0xc242('0x24')]);_0x1fd82d[_0xc242('0x78')]=_[_0xc242('0x77')](_0x1fb9c2['model'],qs[_0xc242('0x79')](_0xe0eba6['query'][_0xc242('0x79')]));_0x1fd82d[_0xc242('0x78')]=_0x1fd82d[_0xc242('0x78')]['length']?_0x1fd82d[_0xc242('0x78')]:_0x1fb9c2[_0xc242('0x73')];if(!_0xe0eba6[_0xc242('0x24')][_0xc242('0x37')](_0xc242('0x7f'))){_0x1fd82d[_0xc242('0x16')]=qs['limit'](_0xe0eba6[_0xc242('0x24')][_0xc242('0x16')]);_0x1fd82d[_0xc242('0x14')]=qs[_0xc242('0x14')](_0xe0eba6[_0xc242('0x24')]['offset']);}_0x1fd82d[_0xc242('0x7a')]=qs[_0xc242('0x7b')](_0xe0eba6[_0xc242('0x24')][_0xc242('0x7b')]);_0x1fd82d['where']=qs[_0xc242('0x76')](_[_0xc242('0x7c')](_0xe0eba6['query'],_0x1fb9c2['filters']));_0x1fd82d[_0xc242('0x63')][_0xc242('0x93')]=_0x174f3d['id'];if(_0xe0eba6[_0xc242('0x24')]['filter']){_0x1fd82d[_0xc242('0x63')]=_['merge'](_0x1fd82d[_0xc242('0x63')],{'$or':_['map'](_0x1fd82d['attributes'],function(_0x326ff7){var _0x2fb011={};_0x2fb011[_0x326ff7]={'$like':'%'+_0xe0eba6['query'][_0xc242('0x7d')]+'%'};return _0x2fb011;})});}_0x1fd82d=_[_0xc242('0x38')]({},_0x1fd82d,_0xe0eba6['options']);return db[_0xc242('0x4a')][_0xc242('0x17')]({'where':_0x1fd82d[_0xc242('0x63')]})[_0xc242('0x1b')](function(_0x4837e9){_0x51b99b[_0xc242('0x17')]=_0x4837e9;if(_0xe0eba6[_0xc242('0x24')][_0xc242('0x94')]){_0x1fd82d[_0xc242('0x95')]=[{'all':!![]}];}return db[_0xc242('0x4a')][_0xc242('0x23')](_0x1fd82d);})['then'](function(_0x23e548){_0x51b99b[_0xc242('0x97')]=_0x23e548;return _0x51b99b;});}})[_0xc242('0x1b')](respondWithFilteredResult(_0x458815,_0x1fd82d))[_0xc242('0x25')](handleError(_0x458815,null));};exports['getJscriptySessions']=function(_0x25cec5,_0x347857){var _0x5ad7c3={'raw':!![],'where':{}};var _0x1261e8={};var _0x11debd={'count':0x0,'rows':[]};return db['CmContact'][_0xc242('0x72')]({'where':{'id':_0x25cec5[_0xc242('0x27')]['id']}})[_0xc242('0x1b')](handleEntityNotFound(_0x347857,null))[_0xc242('0x1b')](function(_0x1a2b11){if(_0x1a2b11){_0x1261e8[_0xc242('0x73')]=_['keys'](db[_0xc242('0x98')][_0xc242('0x75')]);_0x1261e8['query']=_[_0xc242('0x29')](_0x25cec5[_0xc242('0x24')]);_0x1261e8[_0xc242('0x76')]=_[_0xc242('0x77')](_0x1261e8[_0xc242('0x73')],_0x1261e8[_0xc242('0x24')]);_0x5ad7c3[_0xc242('0x78')]=_[_0xc242('0x77')](_0x1261e8[_0xc242('0x73')],qs['fields'](_0x25cec5[_0xc242('0x24')][_0xc242('0x79')]));_0x5ad7c3[_0xc242('0x78')]=_0x5ad7c3[_0xc242('0x78')]['length']?_0x5ad7c3[_0xc242('0x78')]:_0x1261e8[_0xc242('0x73')];if(!_0x25cec5[_0xc242('0x24')][_0xc242('0x37')](_0xc242('0x7f'))){_0x5ad7c3[_0xc242('0x16')]=qs[_0xc242('0x16')](_0x25cec5[_0xc242('0x24')]['limit']);_0x5ad7c3[_0xc242('0x14')]=qs['offset'](_0x25cec5[_0xc242('0x24')][_0xc242('0x14')]);}_0x5ad7c3[_0xc242('0x7a')]=qs['sort'](_0x25cec5[_0xc242('0x24')][_0xc242('0x7b')]);_0x5ad7c3[_0xc242('0x63')]=qs[_0xc242('0x76')](_['pick'](_0x25cec5['query'],_0x1261e8['filters']));_0x5ad7c3['where']['ContactId']=_0x1a2b11['id'];if(_0x25cec5[_0xc242('0x24')]['filter']){_0x5ad7c3['where']=_[_0xc242('0x38')](_0x5ad7c3[_0xc242('0x63')],{'$or':_['map'](_0x5ad7c3[_0xc242('0x78')],function(_0x4f9f4c){var _0x5841db={};_0x5841db[_0x4f9f4c]={'$like':'%'+_0x25cec5['query'][_0xc242('0x7d')]+'%'};return _0x5841db;})});}_0x5ad7c3=_[_0xc242('0x38')]({},_0x5ad7c3,_0x25cec5[_0xc242('0x7e')]);return db[_0xc242('0x98')][_0xc242('0x17')]({'where':_0x5ad7c3[_0xc242('0x63')]})[_0xc242('0x1b')](function(_0x32fa8e){_0x11debd[_0xc242('0x17')]=_0x32fa8e;if(_0x25cec5[_0xc242('0x24')][_0xc242('0x94')]){_0x5ad7c3['include']=[{'all':!![]}];}return db[_0xc242('0x98')][_0xc242('0x23')](_0x5ad7c3);})['then'](function(_0x4a1760){_0x11debd[_0xc242('0x97')]=_0x4a1760;return _0x11debd;});}})[_0xc242('0x1b')](respondWithFilteredResult(_0x347857,_0x5ad7c3))['catch'](handleError(_0x347857,null));};exports[_0xc242('0x99')]=function(_0x73a521,_0x1974eb){try{if(!_0x73a521[_0xc242('0x39')][_0xc242('0x59')]){throw new Error(_0xc242('0x9a'));}if(!_0x73a521[_0xc242('0x39')][_0xc242('0x9b')]){throw new Error(_0xc242('0x9c'));}if(!_0x73a521['body'][_0xc242('0x9d')]){throw new Error(_0xc242('0x9e'));}if(!_0x73a521[_0xc242('0x39')][_0xc242('0x9f')]){throw new Error('Unable\x20to\x20synchronize\x20socket,\x20no\x20timestamp\x20passed');}var _0x2f1d14=_0x73a521['body']['binding_keys']['split'](',');var _0x226cb6=_0x73a521[_0xc242('0x39')][_0xc242('0x9d')]['split'](',');if(!_0x2f1d14[_0xc242('0x2a')]||!_0x226cb6[_0xc242('0x2a')]||_0x2f1d14[_0xc242('0x2a')]!==_0x226cb6['length']){throw new Error(_0xc242('0xa0'));}_0x73a521[_0xc242('0x39')]['fields']=_['zipObject'](_0x2f1d14,_0x226cb6);if(!_0x73a521[_0xc242('0x39')]['fields'][_0xc242('0x70')]){throw new Error(_0xc242('0xa1'));}if(!_0x73a521[_0xc242('0x39')][_0xc242('0x79')][_0xc242('0xa2')]){throw new Error(_0xc242('0xa3'));}var _0x624bff=path[_0xc242('0x3e')](config[_0xc242('0xa4')],_0xc242('0xa5'),_0x73a521[_0xc242('0xa6')]['filename']);fs[_0xc242('0xa7')](_0x624bff,parseInt(_0xc242('0xa8'),0x8));var _0x6c51c9=require(_0xc242('0xa9'))['fork'](path[_0xc242('0x3e')](__dirname,_0xc242('0xaa')),[_0x624bff,_0x73a521['body'][_0xc242('0x9b')],_0x73a521['body']['binding_values'],_0x73a521[_0xc242('0x39')][_0xc242('0x59')],_0x73a521[_0xc242('0x39')][_0xc242('0xab')],_0x73a521[_0xc242('0x39')][_0xc242('0x56')],_0x73a521[_0xc242('0x39')][_0xc242('0x9f')]]);return _0x1974eb[_0xc242('0x12')](0xc8)[_0xc242('0x13')]({'message':_0xc242('0xac'),'pid':_0x6c51c9[_0xc242('0xad')]});}catch(_0x4d83bf){return _0x1974eb[_0xc242('0x12')](0x1f4)[_0xc242('0xae')](_0x4d83bf);}};exports['upload']=function(_0x40d4ca,_0x171a01){var _0x105b24=fs[_0xc242('0xaf')](_0x40d4ca[_0xc242('0xa6')]['path']);Papa[_0xc242('0xb0')](_0x105b24,{'header':!![],'skipEmptyLines':!![],'preview':0x1,'complete':function(_0x4c6948){return _0x171a01[_0xc242('0x12')](0xc8)['json']({'file':_0x40d4ca['file'],'fields':_0x4c6948[_0xc242('0xb1')][_0xc242('0x79')]});}});};exports['import']=function(_0x5c68d0,_0x1d36e5){return db['User'][_0xc242('0x23')]({'raw':!![],'attributes':['id'],'where':{'role':_0xc242('0xb2')}})[_0xc242('0x1b')](function(_0x1895d6){var _0x379170=![];if(!_0x5c68d0[_0xc242('0x39')][_0xc242('0x59')]){throw new Error(_0xc242('0x9a'));}if(!_0x5c68d0[_0xc242('0x39')][_0xc242('0xb3')][_0xc242('0x70')]){throw new Error(_0xc242('0xa1'));}if(!_0x5c68d0['body'][_0xc242('0xb3')][_0xc242('0xa2')]){throw new Error(_0xc242('0xa3'));}if(!_0x5c68d0[_0xc242('0x39')]['socket_timestamp']){throw new Error(_0xc242('0xb4'));}var _0x59461b=require(_0xc242('0xa9'))['fork'](path[_0xc242('0x3e')](__dirname,'../../components/import/cm/csv2'),[_0x5c68d0[_0xc242('0x27')]['id'],JSON[_0xc242('0xb5')](_0x5c68d0[_0xc242('0x39')]),JSON['stringify'](_0x1895d6)]);_0x59461b['on']('message',function(){_0x379170=!![];return _0x1d36e5[_0xc242('0x12')](0xc8)['json']({'message':'start\x20child\x20process\x20correctly!','pid':_0x59461b[_0xc242('0xad')]});});_0x59461b['on'](_0xc242('0xb6'),function(_0x35749c){if(_0x35749c&&!_0x379170){return _0x1d36e5['status'](0x1f4)['json']({'message':_0xc242('0xb7'),'pid':_0x59461b[_0xc242('0xad')]});}});})[_0xc242('0x25')](handleError(_0x1d36e5,null));};exports[_0xc242('0xb8')]=function(_0x2c5e1c,_0x21a2d8){return db[_0xc242('0xb9')]['findAll']({'raw':!![],'attributes':['id'],'where':{'role':'agent'}})[_0xc242('0x1b')](function(_0x5ea7e4){var _0x2bcf60=![];if(!_0x2c5e1c[_0xc242('0x39')][_0xc242('0x59')]){throw new Error(_0xc242('0x9a'));}if(!_0x2c5e1c[_0xc242('0x39')][_0xc242('0xb3')][_0xc242('0x70')]){throw new Error(_0xc242('0xa1'));}if(!_0x2c5e1c[_0xc242('0x39')][_0xc242('0xb3')]['firstName']){throw new Error('No\x20firstName\x20column\x20specified');}if(!_0x2c5e1c[_0xc242('0x39')][_0xc242('0x9f')]){throw new Error(_0xc242('0xb4'));}var _0x2f59d1=require('child_process')[_0xc242('0xba')](path['join'](__dirname,_0xc242('0xbb')),[_0x2c5e1c[_0xc242('0x27')]['id'],JSON[_0xc242('0xb5')](_0x2c5e1c[_0xc242('0x39')]),JSON[_0xc242('0xb5')](_0x5ea7e4)]);_0x2f59d1['on'](_0xc242('0xbc'),function(){_0x2bcf60=!![];return _0x21a2d8['status'](0xc8)['json']({'message':_0xc242('0xbd'),'pid':_0x2f59d1['pid']});});_0x2f59d1['on'](_0xc242('0xb6'),function(_0x244860){if(_0x244860&&!_0x2bcf60){return _0x21a2d8[_0xc242('0x12')](0x1f4)[_0xc242('0x13')]({'message':_0xc242('0xb7'),'pid':_0x2f59d1[_0xc242('0xad')]});}});})[_0xc242('0x25')](handleError(_0x21a2d8,null));};exports[_0xc242('0xbe')]=function(_0x279e50,_0x41e039){var _0x5cd4e1=[_0xc242('0xbf'),_0xc242('0xc0'),_0xc242('0xc1'),_0xc242('0xc2'),'fax',_0xc242('0xc3'),_0xc242('0xc4')];var _0x48bbd8={'offset':0x0,'order':qs['sort'](_0xc242('0xc5'))},_0x2e8b8d={'count':0x0,'rows':[]};Promise['resolve']()[_0xc242('0x1b')](function(){if(_0x279e50['query'][_0xc242('0xc6')]){if(!_[_0xc242('0xc7')](_0x5cd4e1,_0x279e50[_0xc242('0x24')][_0xc242('0xc6')][_0xc242('0xc8')]())){throw new Error(_0xc242('0xc9'));}_0x5cd4e1=[_0x279e50[_0xc242('0x24')]['channel'][_0xc242('0xc8')]()];}if(_0x279e50[_0xc242('0x24')][_0xc242('0xca')]){try{var _0x2a951c=JSON[_0xc242('0xb0')](_0x279e50[_0xc242('0x24')]['range']);if(!moment(_0x2a951c[_0xc242('0x3a')])[_0xc242('0xcb')]()){throw new Error(_0xc242('0xcc'));}if(!moment(_0x2a951c['to'])['isValid']()){throw new Error(_0xc242('0xcd'));}}catch(_0x56a5ae){throw new Error('Invalid\x20createdAt\x20filter');}}if(!_0x279e50['query'][_0xc242('0x37')](_0xc242('0x7f'))){_0x48bbd8[_0xc242('0x16')]=qs[_0xc242('0x16')](_0x279e50[_0xc242('0x24')][_0xc242('0x16')]||0xa);_0x48bbd8['offset']=qs[_0xc242('0x14')](_0x279e50[_0xc242('0x24')][_0xc242('0x14')]);}var _0x38aa9c=_0x5cd4e1[_0xc242('0x66')](function(_0x2339b5){if(_0x2339b5==='voice'){var _0x41bcc3={'attributes':['id','uniqueid',_0xc242('0x32'),_0xc242('0xce'),'destination',_0xc242('0xcf'),_0xc242('0xd0'),_0xc242('0xd1'),_0xc242('0xd2'),_0xc242('0xd3'),'createdAt','userDisposition','userSecondDisposition',_0xc242('0xd4'),_0xc242('0xd5')],'where':{'ContactId':_0x279e50[_0xc242('0x27')]['id']},'include':[{'model':db[_0xc242('0xb9')],'as':_0xc242('0xb9'),'attributes':['id',_0xc242('0x20'),_0xc242('0xd6'),_0xc242('0xd7')]}],'order':[[_0xc242('0xd8'),_0xc242('0xd9')]]};if(_0x279e50['query'][_0xc242('0xca')]){_0x41bcc3['where']['createdAt']={'$gte':_0x2a951c['from'],'$lte':_0x2a951c['to']};}return db[_0xc242('0xda')][_0xc242('0xdb')](_0x41bcc3)['then'](function(_0x2ef923){_0x2e8b8d[_0xc242('0x17')]+=_0x2ef923[_0xc242('0x17')];return _[_0xc242('0x66')](_0x2ef923[_0xc242('0x97')],function(_0x240552){var _0x34afcd=_0x240552[_0xc242('0x3b')]({'plain':!![]});_0x34afcd['channel']=_0x2339b5;if(_0x34afcd[_0xc242('0xb9')]){_0x34afcd[_0xc242('0xb9')]={'id':_0x34afcd['User']['id'],'name':_0x34afcd[_0xc242('0xb9')][_0xc242('0x20')],'fullname':_0x34afcd['User'][_0xc242('0xd6')],'alias':_0x34afcd[_0xc242('0xb9')][_0xc242('0xd7')]};}return _0x34afcd;});});}else{var _0x2080c2=_['startCase'](_0x2339b5)+(_0x2339b5===_0xc242('0xc0')?'Website':_0xc242('0xdc'));var _0x565283={'attributes':['id',_0xc242('0xdd'),_0xc242('0xde'),_0xc242('0xd8'),'note',_0xc242('0xdf'),_0xc242('0xe0'),'thirdDisposition',_0xc242('0xd5'),_0x2080c2+'Id'],'where':{'ContactId':_0x279e50[_0xc242('0x27')]['id']},'include':[{'model':db[_0x2080c2],'as':_0xc242('0xdc'),'attributes':['id',_0xc242('0x20'),_0xc242('0xe1')]},{'model':db['User'],'as':_0xc242('0xe2'),'attributes':['id','name',_0xc242('0xd6')]},{'model':db[_0xc242('0x74')],'as':_0xc242('0xe3'),'attributes':['id','name','color'],'through':{'attributes':[]}}],'order':[[_0xc242('0xd8'),_0xc242('0xd9')]]};if(_0x279e50[_0xc242('0x24')][_0xc242('0xca')]){_0x565283[_0xc242('0x63')][_0xc242('0xd8')]={'$gte':_0x2a951c[_0xc242('0x3a')],'$lte':_0x2a951c['to']};}switch(_0x2339b5){case'chat':_0x565283[_0xc242('0x78')]['push'](_0xc242('0xe4'),'customerIp',_0xc242('0xe5'),_0xc242('0xe6'),'osName',_0xc242('0xe7'),_0xc242('0xe8'),'ratingValue',_0xc242('0xe9'));break;case _0xc242('0xbf'):_0x565283['attributes'][_0xc242('0x58')]('subject','substatus');break;case _0xc242('0xc2'):_0x565283[_0xc242('0x78')][_0xc242('0x58')](_0xc242('0xea'),_0xc242('0xeb'));break;}return db[_['startCase'](_0x2339b5)+_0xc242('0xec')][_0xc242('0xdb')](_0x565283)[_0xc242('0x1b')](function(_0x23ea59){_0x2e8b8d[_0xc242('0x17')]+=_0x23ea59[_0xc242('0x17')];return _['map'](_0x23ea59[_0xc242('0x97')],function(_0x23edd0){var _0x138c43=_0x23edd0[_0xc242('0x3b')]({'plain':!![]});_0x138c43['channel']=_0x2339b5;if(_0x138c43[_0xc242('0xe2')]){_0x138c43[_0xc242('0xe2')]={'id':_0x138c43[_0xc242('0xe2')]['id'],'name':_0x138c43[_0xc242('0xe2')][_0xc242('0x20')],'fullname':_0x138c43[_0xc242('0xe2')]['fullname']};}return _0x138c43;});});}});return Promise['all'](_0x38aa9c);})[_0xc242('0x1b')](function(_0x302d42){return _(_0x302d42)[_0xc242('0xed')]()[_0xc242('0xee')](_0xc242('0xd8'))[_0xc242('0xef')]()[_0xc242('0xf0')]();})['then'](function(_0x3dfa33){_0x2e8b8d['rows']=_0x48bbd8[_0xc242('0x16')]?_0x3dfa33[_0xc242('0xf1')](_0x48bbd8[_0xc242('0x14')],_0x48bbd8['offset']+_0x48bbd8[_0xc242('0x16')]):_0x3dfa33;return _0x2e8b8d;})['then'](respondWithFilteredResult(_0x41e039,_0x48bbd8))['catch'](handleError(_0x41e039,null));}; \ No newline at end of file diff --git a/server/api/cmContact/cmContact.events.js b/server/api/cmContact/cmContact.events.js index 2024a7a..9f6c3af 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 _0x7368=['emit','hasOwnProperty','hook','exports','events','../../mysqldb','CmContact','setMaxListeners','save','update','remove'];(function(_0x5a73d8,_0x3ddf93){var _0x5313d3=function(_0x1fa8c7){while(--_0x1fa8c7){_0x5a73d8['push'](_0x5a73d8['shift']());}};_0x5313d3(++_0x3ddf93);}(_0x7368,0xf6));var _0x8736=function(_0x19950b,_0x53d0d7){_0x19950b=_0x19950b-0x0;var _0x3c6b41=_0x7368[_0x19950b];return _0x3c6b41;};'use strict';var EventEmitter=require(_0x8736('0x0'));var CmContact=require(_0x8736('0x1'))['db'][_0x8736('0x2')];var CmContactEvents=new EventEmitter();CmContactEvents[_0x8736('0x3')](0x0);var events={'afterCreate':_0x8736('0x4'),'afterUpdate':_0x8736('0x5'),'afterDestroy':_0x8736('0x6')};function emitEvent(_0x3327cd){return function(_0x1c2a40,_0x444568,_0x817009){CmContactEvents[_0x8736('0x7')](_0x3327cd+':'+_0x1c2a40['id'],_0x1c2a40);CmContactEvents['emit'](_0x3327cd,_0x1c2a40);_0x817009(null);};}for(var e in events){if(events[_0x8736('0x8')](e)){var event=events[e];CmContact[_0x8736('0x9')](e,emitEvent(event));}}module[_0x8736('0xa')]=CmContactEvents; \ No newline at end of file +var _0x3342=['remove','emit','hasOwnProperty','hook','events','../../mysqldb','setMaxListeners','save'];(function(_0x2641f9,_0x26715f){var _0x585741=function(_0x2d1462){while(--_0x2d1462){_0x2641f9['push'](_0x2641f9['shift']());}};_0x585741(++_0x26715f);}(_0x3342,0x64));var _0x2334=function(_0x3c1b95,_0x2ea03c){_0x3c1b95=_0x3c1b95-0x0;var _0x3f2f68=_0x3342[_0x3c1b95];return _0x3f2f68;};'use strict';var EventEmitter=require(_0x2334('0x0'));var CmContact=require(_0x2334('0x1'))['db']['CmContact'];var CmContactEvents=new EventEmitter();CmContactEvents[_0x2334('0x2')](0x0);var events={'afterCreate':_0x2334('0x3'),'afterUpdate':'update','afterDestroy':_0x2334('0x4')};function emitEvent(_0x23effd){return function(_0x4f3797,_0x406e10,_0x1ed3ab){CmContactEvents[_0x2334('0x5')](_0x23effd+':'+_0x4f3797['id'],_0x4f3797);CmContactEvents['emit'](_0x23effd,_0x4f3797);_0x1ed3ab(null);};}for(var e in events){if(events[_0x2334('0x6')](e)){var event=events[e];CmContact[_0x2334('0x7')](e,emitEvent(event));}}module['exports']=CmContactEvents; \ No newline at end of file diff --git a/server/api/cmContact/cmContact.model.js b/server/api/cmContact/cmContact.model.js index 069ad9f..614910a 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 _0x2f92=['FULLTEXT','utf8mb4','utf8mb4_unicode_ci','models','get','error','[cmContact][afterCreate]\x20List\x20not\x20found\x20for\x20contact\x20with\x20id\x20','[cmContact][afterCreate]','length','destroy','info','[CmContact][afterDestroy][Succesfull]','catch','[CmContact][afterDestroy][Error]','inspect','../../config/logger','api','moment','../../config/environment/shared','./cmContact.attributes','VoiceQueue','format','YYYY-MM-DD\x20HH:mm:ss','isNil','resolve','findOne','then','dialTimezone','utcOffset','scheduledat','add','minutes','phone','priority','callbackUniqueid','assign','CmHopper','[Always]\x20Hopper\x20already\x20exists\x20for\x20contact\x20with\x20phone\x20','\x20in\x20Campaign\x20with\x20id\x20','CmHopperFinal','CampaignId','VoiceQueueId','create','dialCheckDuplicateType','always','findAll','CmList','Lists','ListId','map','all','Campaign','outbound','BlackLists','CmHopperBlack','exports','CmContact','cm_contacts','lastName','fax'];(function(_0x54ebe8,_0x4660d3){var _0x3785f1=function(_0x4abdff){while(--_0x4abdff){_0x54ebe8['push'](_0x54ebe8['shift']());}};_0x3785f1(++_0x4660d3);}(_0x2f92,0x13b));var _0x22f9=function(_0x126558,_0x143c9a){_0x126558=_0x126558-0x0;var _0x1f6d14=_0x2f92[_0x126558];return _0x1f6d14;};'use strict';var _=require('lodash');var util=require('util');var logger=require(_0x22f9('0x0'))(_0x22f9('0x1'));var moment=require(_0x22f9('0x2'));var shared=require(_0x22f9('0x3'));var attributes=require(_0x22f9('0x4'));function getTimezoneCallbackAt(_0x15ad7d,_0x4e7be8,_0x403bc8,_0x4e25a1){var _0xbc9098=_0x4e25a1?'Campaign':_0x22f9('0x5');var _0x3a4c2e=_0x403bc8['scheduledat']?_0x403bc8['scheduledat']:moment()[_0x22f9('0x6')](_0x22f9('0x7'));if(_[_0x22f9('0x8')](_0x403bc8['dialTimezone'])){return Promise[_0x22f9('0x9')](_0x3a4c2e);}return _0x15ad7d[_0xbc9098][_0x22f9('0xa')]({'where':{'id':_0x4e7be8}})[_0x22f9('0xb')](function(_0x69df93){if(_[_0x22f9('0x8')](_0x69df93)||_[_0x22f9('0x8')](_0x69df93['dialTimezone'])){return Promise[_0x22f9('0x9')](_0x3a4c2e);}var _0x39869d=shared['timezones'];var _0x446cb8=_0x39869d[_0x69df93['dialTimezone']];var _0x2ff24e=_0x39869d[_0x403bc8[_0x22f9('0xc')]];if(_[_0x22f9('0x8')](_0x446cb8)&&_['isNil'](_0x2ff24e)){return Promise[_0x22f9('0x9')](_0x3a4c2e);}var _0x22a1d2=_0x446cb8[_0x22f9('0xd')]-_0x2ff24e['utcOffset'];var _0xbc2d58=_0x403bc8[_0x22f9('0xe')]?_0x403bc8[_0x22f9('0xe')]:moment();_0x3a4c2e=moment(_0xbc2d58)[_0x22f9('0xf')](_0x22a1d2,_0x22f9('0x10'))[_0x22f9('0x6')](_0x22f9('0x7'));return Promise[_0x22f9('0x9')](_0x3a4c2e);});}function getNewHopperPayload(_0x2e2717){return{'phone':_0x2e2717[_0x22f9('0x11')],'ContactId':_0x2e2717['id'],'ListId':_0x2e2717['ListId'],'scheduledat':_0x2e2717['scheduledat']?_0x2e2717[_0x22f9('0xe')]:moment()[_0x22f9('0x6')](_0x22f9('0x7')),'priority':_0x2e2717[_0x22f9('0x12')]?_0x2e2717[_0x22f9('0x12')]:0x2,'callback':_0x2e2717['callbackUniqueid']?!![]:![],'callbackuniqueid':_0x2e2717[_0x22f9('0x13')]?_0x2e2717[_0x22f9('0x13')]:undefined,'callbackat':_0x2e2717[_0x22f9('0x13')]?moment()[_0x22f9('0x6')](_0x22f9('0x7')):undefined};}function handleAlwaysCheckDuplicate(_0x443a61,_0x6d2178,_0x59b6f4,_0x26bd95){var _0x1a0c34={'phone':_0x59b6f4[_0x22f9('0x11')]};var _0x1e8d22={'calleridnum':_0x59b6f4[_0x22f9('0x11')]};if(_0x26bd95){Object['assign'](_0x1a0c34,{'CampaignId':_0x6d2178['id']});Object[_0x22f9('0x14')](_0x1e8d22,{'CampaignId':_0x6d2178['id']});}else{Object[_0x22f9('0x14')](_0x1a0c34,{'VoiceQueueId':_0x6d2178['id']});Object[_0x22f9('0x14')](_0x1e8d22,{'VoiceQueueId':_0x6d2178['id']});}return _0x443a61[_0x22f9('0x15')][_0x22f9('0xa')]({'where':_0x1a0c34})[_0x22f9('0xb')](function(_0x45a819){if(_0x45a819){throw new Error(_0x22f9('0x16')+_0x59b6f4[_0x22f9('0x11')]+_0x22f9('0x17')+_0x6d2178['id']);}return _0x443a61[_0x22f9('0x18')][_0x22f9('0xa')]({'where':_0x1e8d22});})['then'](function(_0x46861f){if(_0x46861f){throw new Error('[Always]\x20Hopper\x20Final\x20already\x20exists\x20for\x20contact\x20with\x20phone\x20'+_0x59b6f4[_0x22f9('0x11')]+_0x22f9('0x17')+_0x6d2178['id']);}var _0x2ed628=getNewHopperPayload(_0x59b6f4);if(_0x26bd95){_0x2ed628[_0x22f9('0x19')]=_0x6d2178['id'];}else{_0x2ed628[_0x22f9('0x1a')]=_0x6d2178['id'];}return _0x443a61[_0x22f9('0x15')][_0x22f9('0x1b')](_0x2ed628);});}function handleOnlyIfOpenCheckDuplicate(_0x55fdf0,_0x1ada46,_0x5ea162,_0x3dfb96){var _0x5c7f73={'phone':_0x5ea162[_0x22f9('0x11')]};if(_0x3dfb96){Object[_0x22f9('0x14')](_0x5c7f73,{'CampaignId':_0x1ada46['id']});}else{Object['assign'](_0x5c7f73,{'VoiceQueueId':_0x1ada46['id']});}return _0x55fdf0[_0x22f9('0x15')][_0x22f9('0xa')]({'where':_0x5c7f73})[_0x22f9('0xb')](function(_0x2c0ca1){if(_0x2c0ca1){throw new Error('[OnlyIfOpen]\x20Hopper\x20already\x20exists\x20for\x20contact\x20with\x20phone\x20'+_0x5ea162[_0x22f9('0x11')]+_0x22f9('0x17')+_0x1ada46['id']);}var _0x3ffb95=getNewHopperPayload(_0x5ea162);if(_0x3dfb96){_0x3ffb95['CampaignId']=_0x1ada46['id'];}else{_0x3ffb95['VoiceQueueId']=_0x1ada46['id'];}return _0x55fdf0[_0x22f9('0x15')][_0x22f9('0x1b')](_0x3ffb95);});}function handleNeverCheckDuplicate(_0x4929e4,_0x406115,_0x4cf444){var _0x5c656a=getNewHopperPayload(_0x4cf444);_0x5c656a[_0x22f9('0x1a')]=_0x406115['id'];return _0x4929e4['CmHopper'][_0x22f9('0x1b')](_0x5c656a);}function handleCheckDuplicate(_0x3a040a,_0x48d1db,_0x1a12b3,_0x885b9a){return getTimezoneCallbackAt(_0x3a040a,_0x48d1db,_0x1a12b3,_0x885b9a)[_0x22f9('0xb')](function(_0x4f59e4){_0x1a12b3[_0x22f9('0xe')]=_0x4f59e4;switch(_0x48d1db[_0x22f9('0x1c')]){case _0x22f9('0x1d'):return handleAlwaysCheckDuplicate(_0x3a040a,_0x48d1db,_0x1a12b3,_0x885b9a);case'onlyIfOpen':return handleOnlyIfOpenCheckDuplicate(_0x3a040a,_0x48d1db,_0x1a12b3,_0x885b9a);default:return handleNeverCheckDuplicate(_0x3a040a,_0x48d1db,_0x1a12b3);}});}function createHopperForVoiceQueues(_0xb73ccc,_0x129823){return _0xb73ccc[_0x22f9('0x5')][_0x22f9('0x1e')]({'where':{'type':'outbound'},'attributes':['id','dialCheckDuplicateType',_0x22f9('0xc')],'include':[{'model':_0xb73ccc[_0x22f9('0x1f')],'as':_0x22f9('0x20'),'where':{'id':_0x129823[_0x22f9('0x21')]}}],'raw':!![]})[_0x22f9('0xb')](function(_0x1ca4d8){var _0x137875=_0x1ca4d8[_0x22f9('0x22')](function(_0x16fc59){return handleCheckDuplicate(_0xb73ccc,_0x16fc59,_0x129823,![]);});return Promise[_0x22f9('0x23')](_0x137875);});}function createHopperForCampaigns(_0x4b49e2,_0x5d6308){return _0x4b49e2[_0x22f9('0x24')]['findAll']({'attributes':['id',_0x22f9('0x1c'),_0x22f9('0xc')],'include':[{'model':_0x4b49e2[_0x22f9('0x1f')],'as':_0x22f9('0x20'),'where':{'id':_0x5d6308[_0x22f9('0x21')]}}],'raw':!![]})[_0x22f9('0xb')](function(_0x5ef421){var _0x545e54=_0x5ef421[_0x22f9('0x22')](function(_0x113f78){return handleCheckDuplicate(_0x4b49e2,_0x113f78,_0x5d6308,!![]);});return Promise[_0x22f9('0x23')](_0x545e54);});}function createHopperBlackForVoiceQueues(_0x241d67,_0x57e687){return _0x241d67['VoiceQueue']['findAll']({'where':{'type':_0x22f9('0x25')},'attributes':['id'],'include':[{'model':_0x241d67[_0x22f9('0x1f')],'as':_0x22f9('0x26'),'where':{'id':_0x57e687['ListId']}}],'raw':!![]})['then'](function(_0x3b357f){var _0x2da0e0=_0x3b357f[_0x22f9('0x22')](function(_0x105634){return _0x241d67[_0x22f9('0x27')]['create']({'phone':_0x57e687[_0x22f9('0x11')],'ContactId':_0x57e687['id'],'ListId':_0x57e687[_0x22f9('0x21')],'VoiceQueueId':_0x105634['id']});});return Promise[_0x22f9('0x23')](_0x2da0e0);});}function createHopperBlackForCampaigns(_0x21cd46,_0x467d13){return _0x21cd46[_0x22f9('0x24')][_0x22f9('0x1e')]({'attributes':['id'],'include':[{'model':_0x21cd46[_0x22f9('0x1f')],'as':'BlackLists','where':{'id':_0x467d13['ListId']}}],'raw':!![]})['then'](function(_0x3e9ee4){var _0x167b13=_0x3e9ee4[_0x22f9('0x22')](function(_0x30d361){return _0x21cd46[_0x22f9('0x27')][_0x22f9('0x1b')]({'phone':_0x467d13[_0x22f9('0x11')],'ContactId':_0x467d13['id'],'ListId':_0x467d13['ListId'],'CampaignId':_0x30d361['id']});});return Promise[_0x22f9('0x23')](_0x167b13);});}module[_0x22f9('0x28')]=function(_0x1927f4){return _0x1927f4['define'](_0x22f9('0x29'),attributes,{'tableName':_0x22f9('0x2a'),'paranoid':!![],'indexes':[{'name':_0x22f9('0x11'),'fields':[_0x22f9('0x11')]},{'name':'fti_cm_contacts','fields':['firstName',_0x22f9('0x2b'),_0x22f9('0x11'),'mobile',_0x22f9('0x2c'),'email'],'type':_0x22f9('0x2d')}],'timestamps':!![],'charset':_0x22f9('0x2e'),'collate':_0x22f9('0x2f'),'hooks':{'afterCreate':function(_0x54d480,_0x206b8b,_0x60eb67){var _0x5c22f4=_0x1927f4[_0x22f9('0x30')];var _0x5f06a6=_0x54d480[_0x22f9('0x31')]({'plain':!![]});if(!_0x5f06a6[_0x22f9('0x21')]){logger[_0x22f9('0x32')](_0x22f9('0x33')+_0x5f06a6['id']);return _0x60eb67();}if(!_0x5f06a6[_0x22f9('0x11')]){return _0x60eb67();}return createHopperForVoiceQueues(_0x5c22f4,_0x5f06a6)[_0x22f9('0xb')](function(){return createHopperBlackForVoiceQueues(_0x5c22f4,_0x5f06a6);})[_0x22f9('0xb')](function(){return createHopperForCampaigns(_0x5c22f4,_0x5f06a6);})[_0x22f9('0xb')](function(){return createHopperBlackForCampaigns(_0x5c22f4,_0x5f06a6);})[_0x22f9('0xb')](function(){return _0x60eb67();})['catch'](function(_0x18c612){logger[_0x22f9('0x32')](_0x22f9('0x34'),_0x18c612['message']);_0x60eb67();});},'afterDestroy':function(_0x4866d0,_0x48399b,_0xd9f672){var _0x5a6eb6=_0x1927f4[_0x22f9('0x30')];var _0x47b527=_0x4866d0[_0x22f9('0x31')]({'plain':!![]});return _0x5a6eb6[_0x22f9('0x15')][_0x22f9('0x1e')]({'raw':!![],'where':{'ListId':_0x47b527[_0x22f9('0x21')],'ContactId':_0x47b527['id']}})[_0x22f9('0xb')](function(_0x812c99){if(!_['isEmpty'](_0x812c99)){var _0x3bdca4=[];for(var _0x44f2ff=0x0;_0x44f2ff<_0x812c99[_0x22f9('0x35')];_0x44f2ff+=0x1){var _0x1e0b36=_0x5a6eb6['CmHopper'][_0x22f9('0x36')]({'where':{'ListId':_0x812c99[_0x44f2ff]['ListId'],'ContactId':_0x812c99[_0x44f2ff]['ContactId'],'VoiceQueueId':_0x812c99[_0x44f2ff][_0x22f9('0x1a')],'CampaignId':_0x812c99[_0x44f2ff]['CampaignId']}});_0x3bdca4['push'](_0x1e0b36);}return Promise[_0x22f9('0x23')](_0x3bdca4);}})['then'](function(_0x479d21){logger[_0x22f9('0x37')](_0x22f9('0x38'),util['inspect'](_0x479d21,{'showHidden':![],'depth':null}));_0xd9f672();})[_0x22f9('0x39')](function(_0x524722){logger[_0x22f9('0x32')](_0x22f9('0x3a'),util[_0x22f9('0x3b')](_0x524722,{'showHidden':![],'depth':null}));_0xd9f672(_0x524722);});}}});}; \ No newline at end of file +var _0x98e0=['create','[OnlyIfOpen]\x20Hopper\x20already\x20exists\x20for\x20contact\x20with\x20phone\x20','CampaignId','always','findAll','dialCheckDuplicateType','CmList','Lists','map','all','outbound','BlackLists','CmHopperBlack','exports','fti_cm_contacts','firstName','lastName','fax','FULLTEXT','utf8mb4','utf8mb4_unicode_ci','get','error','[cmContact][afterCreate]\x20List\x20not\x20found\x20for\x20contact\x20with\x20id\x20','catch','[cmContact][afterCreate]','message','isEmpty','length','destroy','ContactId','info','[CmContact][afterDestroy][Succesfull]','inspect','[CmContact][afterDestroy][Error]','util','../../config/logger','api','moment','../../config/environment/shared','./cmContact.attributes','Campaign','VoiceQueue','scheduledat','YYYY-MM-DD\x20HH:mm:ss','isNil','dialTimezone','resolve','findOne','then','timezones','utcOffset','minutes','format','ListId','priority','callbackUniqueid','phone','assign','[Always]\x20Hopper\x20already\x20exists\x20for\x20contact\x20with\x20phone\x20','\x20in\x20Campaign\x20with\x20id\x20','VoiceQueueId','CmHopper'];(function(_0x43990b,_0x31d47b){var _0x475d9a=function(_0x1181dd){while(--_0x1181dd){_0x43990b['push'](_0x43990b['shift']());}};_0x475d9a(++_0x31d47b);}(_0x98e0,0x11f));var _0x098e=function(_0x1f4cb3,_0x3b276b){_0x1f4cb3=_0x1f4cb3-0x0;var _0x523068=_0x98e0[_0x1f4cb3];return _0x523068;};'use strict';var _=require('lodash');var util=require(_0x098e('0x0'));var logger=require(_0x098e('0x1'))(_0x098e('0x2'));var moment=require(_0x098e('0x3'));var shared=require(_0x098e('0x4'));var attributes=require(_0x098e('0x5'));function getTimezoneCallbackAt(_0x335f75,_0x47a054,_0x4b4b33,_0x518a1e){var _0x12fe25=_0x518a1e?_0x098e('0x6'):_0x098e('0x7');var _0x5538ba=_0x4b4b33[_0x098e('0x8')]?_0x4b4b33[_0x098e('0x8')]:moment()['format'](_0x098e('0x9'));if(_[_0x098e('0xa')](_0x4b4b33[_0x098e('0xb')])){return Promise[_0x098e('0xc')](_0x5538ba);}return _0x335f75[_0x12fe25][_0x098e('0xd')]({'where':{'id':_0x47a054}})[_0x098e('0xe')](function(_0x894966){if(_['isNil'](_0x894966)||_[_0x098e('0xa')](_0x894966[_0x098e('0xb')])){return Promise[_0x098e('0xc')](_0x5538ba);}var _0x5f2ffd=shared[_0x098e('0xf')];var _0x24fa16=_0x5f2ffd[_0x894966[_0x098e('0xb')]];var _0x32c935=_0x5f2ffd[_0x4b4b33['dialTimezone']];if(_[_0x098e('0xa')](_0x24fa16)&&_[_0x098e('0xa')](_0x32c935)){return Promise[_0x098e('0xc')](_0x5538ba);}var _0x4f24ee=_0x24fa16[_0x098e('0x10')]-_0x32c935['utcOffset'];var _0x3ffd93=_0x4b4b33[_0x098e('0x8')]?_0x4b4b33[_0x098e('0x8')]:moment();_0x5538ba=moment(_0x3ffd93)['add'](_0x4f24ee,_0x098e('0x11'))[_0x098e('0x12')](_0x098e('0x9'));return Promise['resolve'](_0x5538ba);});}function getNewHopperPayload(_0x248f05){return{'phone':_0x248f05['phone'],'ContactId':_0x248f05['id'],'ListId':_0x248f05[_0x098e('0x13')],'scheduledat':_0x248f05[_0x098e('0x8')]?_0x248f05['scheduledat']:moment()[_0x098e('0x12')](_0x098e('0x9')),'priority':_0x248f05[_0x098e('0x14')]?_0x248f05['priority']:0x2,'callback':_0x248f05[_0x098e('0x15')]?!![]:![],'callbackuniqueid':_0x248f05[_0x098e('0x15')]?_0x248f05['callbackUniqueid']:undefined,'callbackat':_0x248f05[_0x098e('0x15')]?moment()[_0x098e('0x12')](_0x098e('0x9')):undefined};}function handleAlwaysCheckDuplicate(_0x1bdd84,_0x34674d,_0x3d1556,_0x7573ca){var _0x321ef1={'phone':_0x3d1556[_0x098e('0x16')]};var _0x4e05b4={'calleridnum':_0x3d1556[_0x098e('0x16')]};if(_0x7573ca){Object[_0x098e('0x17')](_0x321ef1,{'CampaignId':_0x34674d['id']});Object[_0x098e('0x17')](_0x4e05b4,{'CampaignId':_0x34674d['id']});}else{Object['assign'](_0x321ef1,{'VoiceQueueId':_0x34674d['id']});Object[_0x098e('0x17')](_0x4e05b4,{'VoiceQueueId':_0x34674d['id']});}return _0x1bdd84['CmHopper']['findOne']({'where':_0x321ef1})['then'](function(_0x21e7d4){if(_0x21e7d4){throw new Error(_0x098e('0x18')+_0x3d1556[_0x098e('0x16')]+_0x098e('0x19')+_0x34674d['id']);}return _0x1bdd84['CmHopperFinal']['findOne']({'where':_0x4e05b4});})[_0x098e('0xe')](function(_0x5a5223){if(_0x5a5223){throw new Error('[Always]\x20Hopper\x20Final\x20already\x20exists\x20for\x20contact\x20with\x20phone\x20'+_0x3d1556['phone']+_0x098e('0x19')+_0x34674d['id']);}var _0x23bd0f=getNewHopperPayload(_0x3d1556);if(_0x7573ca){_0x23bd0f['CampaignId']=_0x34674d['id'];}else{_0x23bd0f[_0x098e('0x1a')]=_0x34674d['id'];}return _0x1bdd84[_0x098e('0x1b')][_0x098e('0x1c')](_0x23bd0f);});}function handleOnlyIfOpenCheckDuplicate(_0x3cd6f2,_0x4e93dd,_0xee0693,_0x59b393){var _0x35b289={'phone':_0xee0693[_0x098e('0x16')]};if(_0x59b393){Object[_0x098e('0x17')](_0x35b289,{'CampaignId':_0x4e93dd['id']});}else{Object[_0x098e('0x17')](_0x35b289,{'VoiceQueueId':_0x4e93dd['id']});}return _0x3cd6f2[_0x098e('0x1b')][_0x098e('0xd')]({'where':_0x35b289})['then'](function(_0x459ba0){if(_0x459ba0){throw new Error(_0x098e('0x1d')+_0xee0693['phone']+_0x098e('0x19')+_0x4e93dd['id']);}var _0x367c0b=getNewHopperPayload(_0xee0693);if(_0x59b393){_0x367c0b[_0x098e('0x1e')]=_0x4e93dd['id'];}else{_0x367c0b[_0x098e('0x1a')]=_0x4e93dd['id'];}return _0x3cd6f2[_0x098e('0x1b')][_0x098e('0x1c')](_0x367c0b);});}function handleNeverCheckDuplicate(_0x31cb5d,_0x551c6c,_0x27e4a0){var _0x31ceba=getNewHopperPayload(_0x27e4a0);_0x31ceba[_0x098e('0x1a')]=_0x551c6c['id'];return _0x31cb5d[_0x098e('0x1b')][_0x098e('0x1c')](_0x31ceba);}function handleCheckDuplicate(_0x31f8a3,_0x12155a,_0x4b86fc,_0xac447c){return getTimezoneCallbackAt(_0x31f8a3,_0x12155a,_0x4b86fc,_0xac447c)[_0x098e('0xe')](function(_0x16c7b8){_0x4b86fc[_0x098e('0x8')]=_0x16c7b8;switch(_0x12155a['dialCheckDuplicateType']){case _0x098e('0x1f'):return handleAlwaysCheckDuplicate(_0x31f8a3,_0x12155a,_0x4b86fc,_0xac447c);case'onlyIfOpen':return handleOnlyIfOpenCheckDuplicate(_0x31f8a3,_0x12155a,_0x4b86fc,_0xac447c);default:return handleNeverCheckDuplicate(_0x31f8a3,_0x12155a,_0x4b86fc);}});}function createHopperForVoiceQueues(_0x52daf0,_0x2dede0){return _0x52daf0[_0x098e('0x7')][_0x098e('0x20')]({'where':{'type':'outbound'},'attributes':['id',_0x098e('0x21'),_0x098e('0xb')],'include':[{'model':_0x52daf0[_0x098e('0x22')],'as':_0x098e('0x23'),'where':{'id':_0x2dede0[_0x098e('0x13')]}}],'raw':!![]})[_0x098e('0xe')](function(_0x1dab00){var _0x1b84d0=_0x1dab00[_0x098e('0x24')](function(_0x203436){return handleCheckDuplicate(_0x52daf0,_0x203436,_0x2dede0,![]);});return Promise[_0x098e('0x25')](_0x1b84d0);});}function createHopperForCampaigns(_0x4894dc,_0x3c9b68){return _0x4894dc[_0x098e('0x6')][_0x098e('0x20')]({'attributes':['id','dialCheckDuplicateType','dialTimezone'],'include':[{'model':_0x4894dc['CmList'],'as':_0x098e('0x23'),'where':{'id':_0x3c9b68[_0x098e('0x13')]}}],'raw':!![]})['then'](function(_0x2694ec){var _0x41ad69=_0x2694ec[_0x098e('0x24')](function(_0x51efae){return handleCheckDuplicate(_0x4894dc,_0x51efae,_0x3c9b68,!![]);});return Promise[_0x098e('0x25')](_0x41ad69);});}function createHopperBlackForVoiceQueues(_0x17af79,_0x4abda8){return _0x17af79[_0x098e('0x7')][_0x098e('0x20')]({'where':{'type':_0x098e('0x26')},'attributes':['id'],'include':[{'model':_0x17af79[_0x098e('0x22')],'as':_0x098e('0x27'),'where':{'id':_0x4abda8[_0x098e('0x13')]}}],'raw':!![]})['then'](function(_0x4bf8bc){var _0x58ffbd=_0x4bf8bc[_0x098e('0x24')](function(_0x548167){return _0x17af79[_0x098e('0x28')][_0x098e('0x1c')]({'phone':_0x4abda8['phone'],'ContactId':_0x4abda8['id'],'ListId':_0x4abda8[_0x098e('0x13')],'VoiceQueueId':_0x548167['id']});});return Promise[_0x098e('0x25')](_0x58ffbd);});}function createHopperBlackForCampaigns(_0x5b233d,_0x2ff49e){return _0x5b233d['Campaign'][_0x098e('0x20')]({'attributes':['id'],'include':[{'model':_0x5b233d['CmList'],'as':_0x098e('0x27'),'where':{'id':_0x2ff49e['ListId']}}],'raw':!![]})[_0x098e('0xe')](function(_0x31e1f4){var _0x81c43c=_0x31e1f4[_0x098e('0x24')](function(_0x27e5d6){return _0x5b233d[_0x098e('0x28')]['create']({'phone':_0x2ff49e[_0x098e('0x16')],'ContactId':_0x2ff49e['id'],'ListId':_0x2ff49e['ListId'],'CampaignId':_0x27e5d6['id']});});return Promise[_0x098e('0x25')](_0x81c43c);});}module[_0x098e('0x29')]=function(_0x4b00e7){return _0x4b00e7['define']('CmContact',attributes,{'tableName':'cm_contacts','paranoid':!![],'indexes':[{'name':_0x098e('0x16'),'fields':[_0x098e('0x16')]},{'name':_0x098e('0x2a'),'fields':[_0x098e('0x2b'),_0x098e('0x2c'),_0x098e('0x16'),'mobile',_0x098e('0x2d'),'email'],'type':_0x098e('0x2e')}],'timestamps':!![],'charset':_0x098e('0x2f'),'collate':_0x098e('0x30'),'hooks':{'afterCreate':function(_0x3300a5,_0x833016,_0x58f0f0){var _0x362c1c=_0x4b00e7['models'];var _0x3cb184=_0x3300a5[_0x098e('0x31')]({'plain':!![]});if(!_0x3cb184[_0x098e('0x13')]){logger[_0x098e('0x32')](_0x098e('0x33')+_0x3cb184['id']);return _0x58f0f0();}if(!_0x3cb184[_0x098e('0x16')]){return _0x58f0f0();}return createHopperForVoiceQueues(_0x362c1c,_0x3cb184)[_0x098e('0xe')](function(){return createHopperBlackForVoiceQueues(_0x362c1c,_0x3cb184);})[_0x098e('0xe')](function(){return createHopperForCampaigns(_0x362c1c,_0x3cb184);})['then'](function(){return createHopperBlackForCampaigns(_0x362c1c,_0x3cb184);})[_0x098e('0xe')](function(){return _0x58f0f0();})[_0x098e('0x34')](function(_0x5370c7){logger['error'](_0x098e('0x35'),_0x5370c7[_0x098e('0x36')]);_0x58f0f0();});},'afterDestroy':function(_0x2e25e4,_0x23b492,_0x2b0a1b){var _0x4a1fae=_0x4b00e7['models'];var _0x4bab8c=_0x2e25e4[_0x098e('0x31')]({'plain':!![]});return _0x4a1fae['CmHopper'][_0x098e('0x20')]({'raw':!![],'where':{'ListId':_0x4bab8c[_0x098e('0x13')],'ContactId':_0x4bab8c['id']}})[_0x098e('0xe')](function(_0xc5d066){if(!_[_0x098e('0x37')](_0xc5d066)){var _0x6c0503=[];for(var _0x256bff=0x0;_0x256bff<_0xc5d066[_0x098e('0x38')];_0x256bff+=0x1){var _0x1af8f1=_0x4a1fae[_0x098e('0x1b')][_0x098e('0x39')]({'where':{'ListId':_0xc5d066[_0x256bff][_0x098e('0x13')],'ContactId':_0xc5d066[_0x256bff][_0x098e('0x3a')],'VoiceQueueId':_0xc5d066[_0x256bff]['VoiceQueueId'],'CampaignId':_0xc5d066[_0x256bff][_0x098e('0x1e')]}});_0x6c0503['push'](_0x1af8f1);}return Promise[_0x098e('0x25')](_0x6c0503);}})['then'](function(_0x24d865){logger[_0x098e('0x3b')](_0x098e('0x3c'),util[_0x098e('0x3d')](_0x24d865,{'showHidden':![],'depth':null}));_0x2b0a1b();})[_0x098e('0x34')](function(_0x4f218c){logger['error'](_0x098e('0x3e'),util[_0x098e('0x3d')](_0x4f218c,{'showHidden':![],'depth':null}));_0x2b0a1b(_0x4f218c);});}}});}; \ No newline at end of file diff --git a/server/api/cmContact/cmContact.rpc.js b/server/api/cmContact/cmContact.rpc.js index e28804c..8db0f30 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(_0x56e866,_0x560905){var _0x25f14a=function(_0x10d655){while(--_0x10d655){_0x56e866['push'](_0x56e866['shift']());}};_0x25f14a(++_0x560905);}(_0x9957,0x93));var _0x7995=function(_0x6c993a,_0x5ea3ab){_0x6c993a=_0x6c993a-0x0;var _0x27f547=_0x9957[_0x6c993a];return _0x27f547;};'use strict';var _=require(_0x7995('0x0'));var util=require(_0x7995('0x1'));var 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(_0x3d235e,_0x510999){var _0x46567c=function(_0xf7b8ec){while(--_0xf7b8ec){_0x3d235e['push'](_0x3d235e['shift']());}};_0x46567c(++_0x510999);}(_0xa9e0,0x123));var _0x0a9e=function(_0x18a79d,_0x57bd2c){_0x18a79d=_0x18a79d-0x0;var _0x4f8848=_0xa9e0[_0x18a79d];return _0x4f8848;};'use strict';var multer=require(_0x0a9e('0x0'));var util=require(_0x0a9e('0x1'));var path=require(_0x0a9e('0x2'));var timeout=require('connect-timeout');var express=require('express');var router=express[_0x0a9e('0x3')]();var fs_extra=require('fs-extra');var auth=require(_0x0a9e('0x4'));var interaction=require(_0x0a9e('0x5'));var config=require(_0x0a9e('0x6'));var controller=require(_0x0a9e('0x7'));router[_0x0a9e('0x8')]('/',auth['isAuthenticated'](),controller[_0x0a9e('0x9')]);router[_0x0a9e('0x8')](_0x0a9e('0xa'),auth['isAuthenticated'](),controller['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 41fd9b6..af84237 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 _0x8d9b=['sequelize','exports','INTEGER','STRING'];(function(_0x2b12f7,_0x4033ac){var _0x8cb277=function(_0x713b37){while(--_0x713b37){_0x2b12f7['push'](_0x2b12f7['shift']());}};_0x8cb277(++_0x4033ac);}(_0x8d9b,0x104));var _0xb8d9=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0x8d9b[_0x3dd15e];return _0x231fd0;};'use strict';var Sequelize=require(_0xb8d9('0x0'));module[_0xb8d9('0x1')]={'CmContactId':{'type':Sequelize[_0xb8d9('0x2')],'primaryKey':!![]},'item':{'type':Sequelize[_0xb8d9('0x3')],'defaultValue':'','primaryKey':!![]},'ItemTypeId':{'type':Sequelize[_0xb8d9('0x2')],'defaultValue':null},'ItemClass':{'type':Sequelize['STRING'],'defaultValue':'PHONE'},'OrderBy':{'type':Sequelize[_0xb8d9('0x2')],'defaultValue':null},'description':{'type':Sequelize['STRING'],'defaultValue':null}}; \ No newline at end of file +var _0x6e16=['PHONE','INTEGER'];(function(_0x197878,_0x4c265c){var _0x2371e7=function(_0x4a81a3){while(--_0x4a81a3){_0x197878['push'](_0x197878['shift']());}};_0x2371e7(++_0x4c265c);}(_0x6e16,0x1d3));var _0x66e1=function(_0x58f33b,_0x200831){_0x58f33b=_0x58f33b-0x0;var _0x215a92=_0x6e16[_0x58f33b];return _0x215a92;};'use strict';var Sequelize=require('sequelize');module['exports']={'CmContactId':{'type':Sequelize[_0x66e1('0x0')],'primaryKey':!![]},'item':{'type':Sequelize['STRING'],'defaultValue':'','primaryKey':!![]},'ItemTypeId':{'type':Sequelize[_0x66e1('0x0')],'defaultValue':null},'ItemClass':{'type':Sequelize['STRING'],'defaultValue':_0x66e1('0x1')},'OrderBy':{'type':Sequelize[_0x66e1('0x0')],'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 10107fb..95048dc 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 _0x3cfc=['ioredis','../../components/auth/service','../../components/parsers/qs','api','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','sendStatus','end','status','offset','undefined','limit','count','set','Content-Range','json','apply','reject','update','then','get','UserProfileResource','destroy','error','name','send','index','map','CmContactHasItem','rawAttributes','fieldName','type','model','query','filters','attributes','intersection','length','nolimit','sort','where','pick','filter','VIRTUAL','options','includeAll','include','findAll','catch','show','keys','fields','merge','body','user','Unable\x20to\x20retrieve\x20the\x20current\x20user','role','CmContactHasItems','UserProfileSection','userProfileId','autoAssociation','create','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','find','params','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','moment','bluebird','mustache','util','sox','to-csv','fs-extra','lodash','squel','crypto','jsforce','desk.js'];(function(_0x16f741,_0xeddd32){var _0x3771d1=function(_0x585f88){while(--_0x585f88){_0x16f741['push'](_0x16f741['shift']());}};_0x3771d1(++_0xeddd32);}(_0x3cfc,0xeb));var _0xc3cf=function(_0x3b45b7,_0xed667b){_0x3b45b7=_0x3b45b7-0x0;var _0x1644b5=_0x3cfc[_0x3b45b7];return _0x1644b5;};'use strict';var emlformat=require(_0xc3cf('0x0'));var rimraf=require(_0xc3cf('0x1'));var zipdir=require(_0xc3cf('0x2'));var jsonpatch=require(_0xc3cf('0x3'));var rp=require(_0xc3cf('0x4'));var moment=require(_0xc3cf('0x5'));var BPromise=require(_0xc3cf('0x6'));var Mustache=require(_0xc3cf('0x7'));var util=require(_0xc3cf('0x8'));var path=require('path');var sox=require(_0xc3cf('0x9'));var csv=require(_0xc3cf('0xa'));var ejs=require('ejs');var fs=require('fs');var fs_extra=require(_0xc3cf('0xb'));var _=require(_0xc3cf('0xc'));var squel=require(_0xc3cf('0xd'));var crypto=require(_0xc3cf('0xe'));var jsforce=require(_0xc3cf('0xf'));var deskjs=require(_0xc3cf('0x10'));var toCsv=require(_0xc3cf('0xa'));var querystring=require('querystring');var Papa=require('papaparse');var Redis=require(_0xc3cf('0x11'));var authService=require(_0xc3cf('0x12'));var qs=require(_0xc3cf('0x13'));var as=require('../../components/parsers/advancedSearch');var hardwareService=require('../../config/license/hardware');var logger=require('../../config/logger')(_0xc3cf('0x14'));var utils=require(_0xc3cf('0x15'));var config=require(_0xc3cf('0x16'));var licenseUtil=require(_0xc3cf('0x17'));var db=require(_0xc3cf('0x18'))['db'];function respondWithStatusCode(_0x426c6c,_0x2e03b9){_0x2e03b9=_0x2e03b9||0xcc;return function(_0x29aae0){if(_0x29aae0){return _0x426c6c[_0xc3cf('0x19')](_0x2e03b9);}return _0x426c6c['status'](_0x2e03b9)[_0xc3cf('0x1a')]();};}function respondWithResult(_0x69d594,_0x3e4ce2){_0x3e4ce2=_0x3e4ce2||0xc8;return function(_0x1d6c09){if(_0x1d6c09){return _0x69d594[_0xc3cf('0x1b')](_0x3e4ce2)['json'](_0x1d6c09);}};}function respondWithFilteredResult(_0xacf89f,_0x7a0be5){return function(_0x21ee9f){if(_0x21ee9f){var _0x599e97=typeof _0x7a0be5[_0xc3cf('0x1c')]===_0xc3cf('0x1d')&&typeof _0x7a0be5[_0xc3cf('0x1e')]===_0xc3cf('0x1d');var _0xf7f6ff=_0x21ee9f[_0xc3cf('0x1f')];var _0x26370e=_0x599e97?0x0:_0x7a0be5[_0xc3cf('0x1c')];var _0x443953=_0x599e97?_0x21ee9f[_0xc3cf('0x1f')]:_0x7a0be5['offset']+_0x7a0be5['limit'];var _0x43806b;if(_0x443953>=_0xf7f6ff){_0x443953=_0xf7f6ff;_0x43806b=0xc8;}else{_0x43806b=0xce;}_0xacf89f[_0xc3cf('0x1b')](_0x43806b);return _0xacf89f[_0xc3cf('0x20')](_0xc3cf('0x21'),_0x26370e+'-'+_0x443953+'/'+_0xf7f6ff)[_0xc3cf('0x22')](_0x21ee9f);}return null;};}function patchUpdates(_0x4415f1){return function(_0x224389){try{jsonpatch[_0xc3cf('0x23')](_0x224389,_0x4415f1,!![]);}catch(_0x3992fc){return BPromise[_0xc3cf('0x24')](_0x3992fc);}return _0x224389['save']();};}function saveUpdates(_0x479965,_0x107c84){return function(_0x3adc23){if(_0x3adc23){return _0x3adc23[_0xc3cf('0x25')](_0x479965)['then'](function(_0x3c1c38){return _0x3c1c38;});}return null;};}function removeEntity(_0x3ef951,_0x4d1049){return function(_0xf606ef){if(_0xf606ef){return _0xf606ef['destroy']()[_0xc3cf('0x26')](function(){var _0x51acfb=_0xf606ef[_0xc3cf('0x27')]({'plain':!![]});var _0x1c48f5='CmContactHasItems';return db[_0xc3cf('0x28')][_0xc3cf('0x29')]({'where':{'type':_0x1c48f5,'resourceId':_0x51acfb['id']}})['then'](function(){return _0xf606ef;});})[_0xc3cf('0x26')](function(){_0x3ef951[_0xc3cf('0x1b')](0xcc)[_0xc3cf('0x1a')]();});}};}function handleEntityNotFound(_0x197433,_0x6c2fa8){return function(_0x2e3ef9){if(!_0x2e3ef9){_0x197433[_0xc3cf('0x19')](0x194);}return _0x2e3ef9;};}function handleError(_0x3aec3d,_0x45e442){_0x45e442=_0x45e442||0x1f4;return function(_0x22c4c6){logger[_0xc3cf('0x2a')](_0x22c4c6['stack']);if(_0x22c4c6[_0xc3cf('0x2b')]){delete _0x22c4c6[_0xc3cf('0x2b')];}_0x3aec3d[_0xc3cf('0x1b')](_0x45e442)[_0xc3cf('0x2c')](_0x22c4c6);};}exports[_0xc3cf('0x2d')]=function(_0x3b0bb4,_0xca952e){var _0x2b8596={},_0x58fbeb={},_0x404617={'count':0x0,'rows':[]};var _0x16fd1a=_[_0xc3cf('0x2e')](db[_0xc3cf('0x2f')][_0xc3cf('0x30')],function(_0x34d3b){return{'name':_0x34d3b[_0xc3cf('0x31')],'type':_0x34d3b[_0xc3cf('0x32')]['key']};});_0x58fbeb[_0xc3cf('0x33')]=_[_0xc3cf('0x2e')](_0x16fd1a,_0xc3cf('0x2b'));_0x58fbeb[_0xc3cf('0x34')]=_['keys'](_0x3b0bb4['query']);_0x58fbeb[_0xc3cf('0x35')]=_['intersection'](_0x58fbeb[_0xc3cf('0x33')],_0x58fbeb[_0xc3cf('0x34')]);_0x2b8596[_0xc3cf('0x36')]=_[_0xc3cf('0x37')](_0x58fbeb[_0xc3cf('0x33')],qs['fields'](_0x3b0bb4[_0xc3cf('0x34')]['fields']));_0x2b8596['attributes']=_0x2b8596[_0xc3cf('0x36')][_0xc3cf('0x38')]?_0x2b8596[_0xc3cf('0x36')]:_0x58fbeb[_0xc3cf('0x33')];if(!_0x3b0bb4[_0xc3cf('0x34')]['hasOwnProperty'](_0xc3cf('0x39'))){_0x2b8596[_0xc3cf('0x1e')]=qs[_0xc3cf('0x1e')](_0x3b0bb4['query'][_0xc3cf('0x1e')]);_0x2b8596[_0xc3cf('0x1c')]=qs['offset'](_0x3b0bb4[_0xc3cf('0x34')][_0xc3cf('0x1c')]);}_0x2b8596['order']=qs[_0xc3cf('0x3a')](_0x3b0bb4[_0xc3cf('0x34')][_0xc3cf('0x3a')]);_0x2b8596[_0xc3cf('0x3b')]=qs[_0xc3cf('0x35')](_[_0xc3cf('0x3c')](_0x3b0bb4['query'],_0x58fbeb[_0xc3cf('0x35')]),_0x16fd1a);if(_0x3b0bb4[_0xc3cf('0x34')][_0xc3cf('0x3d')]){_0x2b8596['where']=_['merge'](_0x2b8596[_0xc3cf('0x3b')],{'$or':_[_0xc3cf('0x2e')](_0x16fd1a,function(_0x59db61){if(_0x59db61[_0xc3cf('0x32')]!==_0xc3cf('0x3e')){var _0x1a51fb={};_0x1a51fb[_0x59db61[_0xc3cf('0x2b')]]={'$like':'%'+_0x3b0bb4[_0xc3cf('0x34')][_0xc3cf('0x3d')]+'%'};return _0x1a51fb;}})});}_0x2b8596=_['merge']({},_0x2b8596,_0x3b0bb4[_0xc3cf('0x3f')]);var _0x4e109f={'where':_0x2b8596['where']};return db[_0xc3cf('0x2f')][_0xc3cf('0x1f')](_0x4e109f)['then'](function(_0x3c6bee){_0x404617[_0xc3cf('0x1f')]=_0x3c6bee;if(_0x3b0bb4[_0xc3cf('0x34')][_0xc3cf('0x40')]){_0x2b8596[_0xc3cf('0x41')]=[{'all':!![]}];}return db[_0xc3cf('0x2f')][_0xc3cf('0x42')](_0x2b8596);})[_0xc3cf('0x26')](function(_0xa8b9af){_0x404617['rows']=_0xa8b9af;return _0x404617;})[_0xc3cf('0x26')](respondWithFilteredResult(_0xca952e,_0x2b8596))[_0xc3cf('0x43')](handleError(_0xca952e,null));};exports[_0xc3cf('0x44')]=function(_0x3eac37,_0x5b1f92){var _0x16cc9a={'raw':!![],'where':{'id':_0x3eac37['params']['id']}},_0x287e48={};_0x287e48[_0xc3cf('0x33')]=_[_0xc3cf('0x45')](db[_0xc3cf('0x2f')][_0xc3cf('0x30')]);_0x287e48[_0xc3cf('0x34')]=_[_0xc3cf('0x45')](_0x3eac37[_0xc3cf('0x34')]);_0x287e48[_0xc3cf('0x35')]=_['intersection'](_0x287e48['model'],_0x287e48[_0xc3cf('0x34')]);_0x16cc9a[_0xc3cf('0x36')]=_[_0xc3cf('0x37')](_0x287e48[_0xc3cf('0x33')],qs[_0xc3cf('0x46')](_0x3eac37[_0xc3cf('0x34')][_0xc3cf('0x46')]));_0x16cc9a[_0xc3cf('0x36')]=_0x16cc9a['attributes'][_0xc3cf('0x38')]?_0x16cc9a[_0xc3cf('0x36')]:_0x287e48[_0xc3cf('0x33')];if(_0x3eac37[_0xc3cf('0x34')]['includeAll']){_0x16cc9a[_0xc3cf('0x41')]=[{'all':!![]}];}_0x16cc9a=_[_0xc3cf('0x47')]({},_0x16cc9a,_0x3eac37[_0xc3cf('0x3f')]);return db[_0xc3cf('0x2f')]['find'](_0x16cc9a)[_0xc3cf('0x26')](handleEntityNotFound(_0x5b1f92,null))[_0xc3cf('0x26')](respondWithResult(_0x5b1f92,null))['catch'](handleError(_0x5b1f92,null));};exports['create']=function(_0x442b87,_0x5b2cb1){return db[_0xc3cf('0x2f')]['create'](_0x442b87[_0xc3cf('0x48')],{})['then'](function(_0x75c494){var _0x3391d2=_0x442b87[_0xc3cf('0x49')][_0xc3cf('0x27')]({'plain':!![]});if(!_0x3391d2)throw new Error(_0xc3cf('0x4a'));if(_0x3391d2[_0xc3cf('0x4b')]===_0xc3cf('0x49')){var _0x30c164=_0x75c494['get']({'plain':!![]});var _0xdaa494=_0xc3cf('0x4c');return db[_0xc3cf('0x4d')]['find']({'where':{'name':_0xdaa494,'userProfileId':_0x3391d2[_0xc3cf('0x4e')]},'raw':!![]})['then'](function(_0x8a50a){if(_0x8a50a&&_0x8a50a[_0xc3cf('0x4f')]===0x0){return db[_0xc3cf('0x28')][_0xc3cf('0x50')]({'name':_0x30c164['name'],'resourceId':_0x30c164['id'],'type':_0x8a50a[_0xc3cf('0x2b')],'sectionId':_0x8a50a['id']},{})[_0xc3cf('0x26')](function(){return _0x75c494;});}else{return _0x75c494;}})[_0xc3cf('0x43')](function(_0x4cbb2b){logger[_0xc3cf('0x2a')](_0xc3cf('0x51'),_0x4cbb2b);throw _0x4cbb2b;});}return _0x75c494;})[_0xc3cf('0x26')](respondWithResult(_0x5b2cb1,0xc9))[_0xc3cf('0x43')](handleError(_0x5b2cb1,null));};exports['update']=function(_0x4dcf41,_0x1e841b){if(_0x4dcf41['body']['id']){delete _0x4dcf41[_0xc3cf('0x48')]['id'];}return db[_0xc3cf('0x2f')][_0xc3cf('0x52')]({'where':{'id':_0x4dcf41[_0xc3cf('0x53')]['id']}})[_0xc3cf('0x26')](handleEntityNotFound(_0x1e841b,null))[_0xc3cf('0x26')](saveUpdates(_0x4dcf41[_0xc3cf('0x48')],null))[_0xc3cf('0x26')](respondWithResult(_0x1e841b,null))[_0xc3cf('0x43')](handleError(_0x1e841b,null));};exports[_0xc3cf('0x29')]=function(_0x13bafe,_0x25a5ab){return db[_0xc3cf('0x2f')][_0xc3cf('0x52')]({'where':{'id':_0x13bafe[_0xc3cf('0x53')]['id']}})[_0xc3cf('0x26')](handleEntityNotFound(_0x25a5ab,null))[_0xc3cf('0x26')](removeEntity(_0x25a5ab,null))['catch'](handleError(_0x25a5ab,null));}; \ No newline at end of file +var _0x5d06=['bluebird','path','sox','to-csv','ejs','lodash','squel','crypto','desk.js','querystring','papaparse','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/logger','api','../../config/license/util','status','undefined','count','offset','limit','json','apply','reject','save','update','destroy','then','get','CmContactHasItems','UserProfileResource','end','sendStatus','error','name','send','map','rawAttributes','fieldName','type','key','query','keys','filters','intersection','model','fields','attributes','length','hasOwnProperty','order','sort','pick','filter','where','VIRTUAL','CmContactHasItem','includeAll','include','findAll','show','merge','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','params','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','moment'];(function(_0x3ef696,_0x709a94){var _0x4bc69f=function(_0xeb9e51){while(--_0xeb9e51){_0x3ef696['push'](_0x3ef696['shift']());}};_0x4bc69f(++_0x709a94);}(_0x5d06,0x18f));var _0x65d0=function(_0x3b53d6,_0x4e658b){_0x3b53d6=_0x3b53d6-0x0;var _0x3935cb=_0x5d06[_0x3b53d6];return _0x3935cb;};'use strict';var emlformat=require(_0x65d0('0x0'));var rimraf=require(_0x65d0('0x1'));var zipdir=require(_0x65d0('0x2'));var jsonpatch=require(_0x65d0('0x3'));var rp=require(_0x65d0('0x4'));var moment=require(_0x65d0('0x5'));var BPromise=require(_0x65d0('0x6'));var Mustache=require('mustache');var util=require('util');var path=require(_0x65d0('0x7'));var sox=require(_0x65d0('0x8'));var csv=require(_0x65d0('0x9'));var ejs=require(_0x65d0('0xa'));var fs=require('fs');var fs_extra=require('fs-extra');var _=require(_0x65d0('0xb'));var squel=require(_0x65d0('0xc'));var crypto=require(_0x65d0('0xd'));var jsforce=require('jsforce');var deskjs=require(_0x65d0('0xe'));var toCsv=require(_0x65d0('0x9'));var querystring=require(_0x65d0('0xf'));var Papa=require(_0x65d0('0x10'));var Redis=require('ioredis');var authService=require(_0x65d0('0x11'));var qs=require(_0x65d0('0x12'));var as=require(_0x65d0('0x13'));var hardwareService=require('../../config/license/hardware');var logger=require(_0x65d0('0x14'))(_0x65d0('0x15'));var utils=require('../../config/utils');var config=require('../../config/environment');var licenseUtil=require(_0x65d0('0x16'));var db=require('../../mysqldb')['db'];function respondWithStatusCode(_0x161d66,_0x544a3f){_0x544a3f=_0x544a3f||0xcc;return function(_0x25fd59){if(_0x25fd59){return _0x161d66['sendStatus'](_0x544a3f);}return _0x161d66[_0x65d0('0x17')](_0x544a3f)['end']();};}function respondWithResult(_0xa2148,_0x3b36f4){_0x3b36f4=_0x3b36f4||0xc8;return function(_0x9145ce){if(_0x9145ce){return _0xa2148[_0x65d0('0x17')](_0x3b36f4)['json'](_0x9145ce);}};}function respondWithFilteredResult(_0x1db248,_0x2cdc1a){return function(_0x186970){if(_0x186970){var _0x53bdaf=typeof _0x2cdc1a['offset']==='undefined'&&typeof _0x2cdc1a['limit']===_0x65d0('0x18');var _0x2f67d6=_0x186970['count'];var _0x529bd5=_0x53bdaf?0x0:_0x2cdc1a['offset'];var _0x350ee3=_0x53bdaf?_0x186970[_0x65d0('0x19')]:_0x2cdc1a[_0x65d0('0x1a')]+_0x2cdc1a[_0x65d0('0x1b')];var _0x4fea19;if(_0x350ee3>=_0x2f67d6){_0x350ee3=_0x2f67d6;_0x4fea19=0xc8;}else{_0x4fea19=0xce;}_0x1db248[_0x65d0('0x17')](_0x4fea19);return _0x1db248['set']('Content-Range',_0x529bd5+'-'+_0x350ee3+'/'+_0x2f67d6)[_0x65d0('0x1c')](_0x186970);}return null;};}function patchUpdates(_0x363937){return function(_0x5a49e5){try{jsonpatch[_0x65d0('0x1d')](_0x5a49e5,_0x363937,!![]);}catch(_0x27df13){return BPromise[_0x65d0('0x1e')](_0x27df13);}return _0x5a49e5[_0x65d0('0x1f')]();};}function saveUpdates(_0x137dd9,_0x31a924){return function(_0x3f6652){if(_0x3f6652){return _0x3f6652[_0x65d0('0x20')](_0x137dd9)['then'](function(_0xa1aede){return _0xa1aede;});}return null;};}function removeEntity(_0x550846,_0x19878c){return function(_0x23ef82){if(_0x23ef82){return _0x23ef82[_0x65d0('0x21')]()[_0x65d0('0x22')](function(){var _0x3bb510=_0x23ef82[_0x65d0('0x23')]({'plain':!![]});var _0xda3d5b=_0x65d0('0x24');return db[_0x65d0('0x25')][_0x65d0('0x21')]({'where':{'type':_0xda3d5b,'resourceId':_0x3bb510['id']}})[_0x65d0('0x22')](function(){return _0x23ef82;});})['then'](function(){_0x550846['status'](0xcc)[_0x65d0('0x26')]();});}};}function handleEntityNotFound(_0x48091f,_0x270052){return function(_0x1cfe5b){if(!_0x1cfe5b){_0x48091f[_0x65d0('0x27')](0x194);}return _0x1cfe5b;};}function handleError(_0x11d75d,_0x11a0be){_0x11a0be=_0x11a0be||0x1f4;return function(_0x344d3f){logger[_0x65d0('0x28')](_0x344d3f['stack']);if(_0x344d3f[_0x65d0('0x29')]){delete _0x344d3f[_0x65d0('0x29')];}_0x11d75d['status'](_0x11a0be)[_0x65d0('0x2a')](_0x344d3f);};}exports['index']=function(_0x189a6e,_0x3d43bb){var _0x151c4a={},_0x33e52b={},_0xd49f4a={'count':0x0,'rows':[]};var _0x24cc6b=_[_0x65d0('0x2b')](db['CmContactHasItem'][_0x65d0('0x2c')],function(_0x3a5174){return{'name':_0x3a5174[_0x65d0('0x2d')],'type':_0x3a5174[_0x65d0('0x2e')][_0x65d0('0x2f')]};});_0x33e52b['model']=_[_0x65d0('0x2b')](_0x24cc6b,_0x65d0('0x29'));_0x33e52b[_0x65d0('0x30')]=_[_0x65d0('0x31')](_0x189a6e[_0x65d0('0x30')]);_0x33e52b[_0x65d0('0x32')]=_[_0x65d0('0x33')](_0x33e52b[_0x65d0('0x34')],_0x33e52b[_0x65d0('0x30')]);_0x151c4a['attributes']=_[_0x65d0('0x33')](_0x33e52b['model'],qs[_0x65d0('0x35')](_0x189a6e[_0x65d0('0x30')][_0x65d0('0x35')]));_0x151c4a[_0x65d0('0x36')]=_0x151c4a[_0x65d0('0x36')][_0x65d0('0x37')]?_0x151c4a[_0x65d0('0x36')]:_0x33e52b[_0x65d0('0x34')];if(!_0x189a6e[_0x65d0('0x30')][_0x65d0('0x38')]('nolimit')){_0x151c4a[_0x65d0('0x1b')]=qs[_0x65d0('0x1b')](_0x189a6e[_0x65d0('0x30')]['limit']);_0x151c4a['offset']=qs['offset'](_0x189a6e[_0x65d0('0x30')][_0x65d0('0x1a')]);}_0x151c4a[_0x65d0('0x39')]=qs['sort'](_0x189a6e[_0x65d0('0x30')][_0x65d0('0x3a')]);_0x151c4a['where']=qs[_0x65d0('0x32')](_[_0x65d0('0x3b')](_0x189a6e[_0x65d0('0x30')],_0x33e52b[_0x65d0('0x32')]),_0x24cc6b);if(_0x189a6e['query'][_0x65d0('0x3c')]){_0x151c4a['where']=_['merge'](_0x151c4a[_0x65d0('0x3d')],{'$or':_[_0x65d0('0x2b')](_0x24cc6b,function(_0x55e7ee){if(_0x55e7ee[_0x65d0('0x2e')]!==_0x65d0('0x3e')){var _0x3e99e3={};_0x3e99e3[_0x55e7ee[_0x65d0('0x29')]]={'$like':'%'+_0x189a6e[_0x65d0('0x30')][_0x65d0('0x3c')]+'%'};return _0x3e99e3;}})});}_0x151c4a=_['merge']({},_0x151c4a,_0x189a6e['options']);var _0x338cd8={'where':_0x151c4a[_0x65d0('0x3d')]};return db[_0x65d0('0x3f')][_0x65d0('0x19')](_0x338cd8)[_0x65d0('0x22')](function(_0x289230){_0xd49f4a[_0x65d0('0x19')]=_0x289230;if(_0x189a6e['query'][_0x65d0('0x40')]){_0x151c4a[_0x65d0('0x41')]=[{'all':!![]}];}return db[_0x65d0('0x3f')][_0x65d0('0x42')](_0x151c4a);})[_0x65d0('0x22')](function(_0x3dab96){_0xd49f4a['rows']=_0x3dab96;return _0xd49f4a;})[_0x65d0('0x22')](respondWithFilteredResult(_0x3d43bb,_0x151c4a))['catch'](handleError(_0x3d43bb,null));};exports[_0x65d0('0x43')]=function(_0x579db8,_0x2f15d0){var _0x2661f8={'raw':!![],'where':{'id':_0x579db8['params']['id']}},_0x568430={};_0x568430[_0x65d0('0x34')]=_[_0x65d0('0x31')](db[_0x65d0('0x3f')][_0x65d0('0x2c')]);_0x568430[_0x65d0('0x30')]=_[_0x65d0('0x31')](_0x579db8[_0x65d0('0x30')]);_0x568430['filters']=_[_0x65d0('0x33')](_0x568430['model'],_0x568430['query']);_0x2661f8[_0x65d0('0x36')]=_['intersection'](_0x568430['model'],qs[_0x65d0('0x35')](_0x579db8[_0x65d0('0x30')]['fields']));_0x2661f8[_0x65d0('0x36')]=_0x2661f8['attributes'][_0x65d0('0x37')]?_0x2661f8['attributes']:_0x568430['model'];if(_0x579db8[_0x65d0('0x30')][_0x65d0('0x40')]){_0x2661f8['include']=[{'all':!![]}];}_0x2661f8=_[_0x65d0('0x44')]({},_0x2661f8,_0x579db8['options']);return db['CmContactHasItem'][_0x65d0('0x45')](_0x2661f8)[_0x65d0('0x22')](handleEntityNotFound(_0x2f15d0,null))['then'](respondWithResult(_0x2f15d0,null))[_0x65d0('0x46')](handleError(_0x2f15d0,null));};exports[_0x65d0('0x47')]=function(_0xc85f8c,_0x4e9e34){return db['CmContactHasItem'][_0x65d0('0x47')](_0xc85f8c[_0x65d0('0x48')],{})[_0x65d0('0x22')](function(_0x11ba4a){var _0x2dd71b=_0xc85f8c[_0x65d0('0x49')][_0x65d0('0x23')]({'plain':!![]});if(!_0x2dd71b)throw new Error(_0x65d0('0x4a'));if(_0x2dd71b[_0x65d0('0x4b')]===_0x65d0('0x49')){var _0x262288=_0x11ba4a[_0x65d0('0x23')]({'plain':!![]});var _0x14793e=_0x65d0('0x24');return db[_0x65d0('0x4c')][_0x65d0('0x45')]({'where':{'name':_0x14793e,'userProfileId':_0x2dd71b[_0x65d0('0x4d')]},'raw':!![]})[_0x65d0('0x22')](function(_0x2dc749){if(_0x2dc749&&_0x2dc749[_0x65d0('0x4e')]===0x0){return db[_0x65d0('0x25')][_0x65d0('0x47')]({'name':_0x262288[_0x65d0('0x29')],'resourceId':_0x262288['id'],'type':_0x2dc749[_0x65d0('0x29')],'sectionId':_0x2dc749['id']},{})[_0x65d0('0x22')](function(){return _0x11ba4a;});}else{return _0x11ba4a;}})['catch'](function(_0x489241){logger[_0x65d0('0x28')](_0x65d0('0x4f'),_0x489241);throw _0x489241;});}return _0x11ba4a;})[_0x65d0('0x22')](respondWithResult(_0x4e9e34,0xc9))[_0x65d0('0x46')](handleError(_0x4e9e34,null));};exports[_0x65d0('0x20')]=function(_0x4c5b4a,_0x11cbb2){if(_0x4c5b4a[_0x65d0('0x48')]['id']){delete _0x4c5b4a[_0x65d0('0x48')]['id'];}return db['CmContactHasItem'][_0x65d0('0x45')]({'where':{'id':_0x4c5b4a[_0x65d0('0x50')]['id']}})['then'](handleEntityNotFound(_0x11cbb2,null))['then'](saveUpdates(_0x4c5b4a[_0x65d0('0x48')],null))[_0x65d0('0x22')](respondWithResult(_0x11cbb2,null))[_0x65d0('0x46')](handleError(_0x11cbb2,null));};exports[_0x65d0('0x21')]=function(_0x499fe5,_0x17df58){return db[_0x65d0('0x3f')][_0x65d0('0x45')]({'where':{'id':_0x499fe5[_0x65d0('0x50')]['id']}})['then'](handleEntityNotFound(_0x17df58,null))[_0x65d0('0x22')](removeEntity(_0x17df58,null))[_0x65d0('0x46')](handleError(_0x17df58,null));}; \ No newline at end of file diff --git a/server/api/cmContactHasItem/cmContactHasItem.model.js b/server/api/cmContactHasItem/cmContactHasItem.model.js index d2d46fb..77f78a6 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 _0x63a3=['util','../../config/logger','api','request-promise','path','../../config/environment','./cmContactHasItem.attributes','exports','define','CmContactHasItem','cm_contact_has_items'];(function(_0x1480f4,_0x1e9764){var _0x460420=function(_0x40ea29){while(--_0x40ea29){_0x1480f4['push'](_0x1480f4['shift']());}};_0x460420(++_0x1e9764);}(_0x63a3,0x6e));var _0x363a=function(_0x245afe,_0x319cde){_0x245afe=_0x245afe-0x0;var _0x4eefde=_0x63a3[_0x245afe];return _0x4eefde;};'use strict';var _=require('lodash');var util=require(_0x363a('0x0'));var logger=require(_0x363a('0x1'))(_0x363a('0x2'));var moment=require('moment');var BPromise=require('bluebird');var rp=require(_0x363a('0x3'));var fs=require('fs');var path=require(_0x363a('0x4'));var rimraf=require('rimraf');var config=require(_0x363a('0x5'));var attributes=require(_0x363a('0x6'));module[_0x363a('0x7')]=function(_0xf9ac02,_0x202a91){return _0xf9ac02[_0x363a('0x8')](_0x363a('0x9'),attributes,{'tableName':_0x363a('0xa'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x9f5e=['define','CmContactHasItem','cm_contact_has_items','../../config/logger','api','moment','bluebird','request-promise','path','rimraf','./cmContactHasItem.attributes'];(function(_0x3e6729,_0x16d4af){var _0x535bcd=function(_0x5e6c5f){while(--_0x5e6c5f){_0x3e6729['push'](_0x3e6729['shift']());}};_0x535bcd(++_0x16d4af);}(_0x9f5e,0x100));var _0xe9f5=function(_0x419855,_0x1628e6){_0x419855=_0x419855-0x0;var _0x5943df=_0x9f5e[_0x419855];return _0x5943df;};'use strict';var _=require('lodash');var util=require('util');var logger=require(_0xe9f5('0x0'))(_0xe9f5('0x1'));var moment=require(_0xe9f5('0x2'));var BPromise=require(_0xe9f5('0x3'));var rp=require(_0xe9f5('0x4'));var fs=require('fs');var path=require(_0xe9f5('0x5'));var rimraf=require(_0xe9f5('0x6'));var config=require('../../config/environment');var attributes=require(_0xe9f5('0x7'));module['exports']=function(_0x359492,_0xc4256c){return _0x359492[_0xe9f5('0x8')](_0xe9f5('0x9'),attributes,{'tableName':_0xe9f5('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 79e844c..928c15a 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 _0x2f03=['info','CmContactHasItem,\x20%s,\x20%s','request\x20sent','debug','CmContactHasItem,\x20%s,\x20%s,\x20%s','error','message','result','catch','lodash','util','moment','bluebird','../../config/utils','../../config/logger','../../config/environment','jayson/promise','client','http','request'];(function(_0x33731b,_0x43f896){var _0x3dd194=function(_0x3520ed){while(--_0x3520ed){_0x33731b['push'](_0x33731b['shift']());}};_0x3dd194(++_0x43f896);}(_0x2f03,0x10d));var _0x32f0=function(_0x5786f4,_0x3fb36b){_0x5786f4=_0x5786f4-0x0;var _0x273c37=_0x2f03[_0x5786f4];return _0x273c37;};'use strict';var _=require(_0x32f0('0x0'));var util=require(_0x32f0('0x1'));var moment=require(_0x32f0('0x2'));var BPromise=require(_0x32f0('0x3'));var rs=require('randomstring');var fs=require('fs');var Redis=require('ioredis');var db=require('../../mysqldb')['db'];var utils=require(_0x32f0('0x4'));var logger=require(_0x32f0('0x5'))('rpc');var config=require(_0x32f0('0x6'));var jayson=require(_0x32f0('0x7'));var client=jayson[_0x32f0('0x8')][_0x32f0('0x9')]({'port':0x232a});function respondWithRpcPromise(_0x13a587,_0x4e93c5,_0x29458f){return new BPromise(function(_0x58c39e,_0x217317){return client[_0x32f0('0xa')](_0x13a587,_0x29458f)['then'](function(_0xc7bee6){logger[_0x32f0('0xb')](_0x32f0('0xc'),_0x4e93c5,_0x32f0('0xd'));logger[_0x32f0('0xe')](_0x32f0('0xf'),_0x4e93c5,_0x32f0('0xd'),JSON['stringify'](_0xc7bee6));if(_0xc7bee6[_0x32f0('0x10')]){if(_0xc7bee6[_0x32f0('0x10')]['code']===0x1f4){logger['error'](_0x32f0('0xc'),_0x4e93c5,_0xc7bee6['error'][_0x32f0('0x11')]);return _0x217317(_0xc7bee6[_0x32f0('0x10')][_0x32f0('0x11')]);}logger['error']('CmContactHasItem,\x20%s,\x20%s',_0x4e93c5,_0xc7bee6['error'][_0x32f0('0x11')]);return _0x58c39e(_0xc7bee6[_0x32f0('0x10')][_0x32f0('0x11')]);}else{logger[_0x32f0('0xb')]('CmContactHasItem,\x20%s,\x20%s',_0x4e93c5,'request\x20sent');_0x58c39e(_0xc7bee6[_0x32f0('0x12')]['message']);}})[_0x32f0('0x13')](function(_0x5d6dfc){logger[_0x32f0('0x10')](_0x32f0('0xc'),_0x4e93c5,_0x5d6dfc);_0x217317(_0x5d6dfc);});});} \ No newline at end of file +var _0x6ea7=['ioredis','../../config/utils','../../config/logger','rpc','../../config/environment','client','http','request','request\x20sent','debug','stringify','error','code','CmContactHasItem,\x20%s,\x20%s','message','info','result','catch','lodash','util','moment'];(function(_0x458a38,_0x5686f1){var _0x5c3603=function(_0x52c167){while(--_0x52c167){_0x458a38['push'](_0x458a38['shift']());}};_0x5c3603(++_0x5686f1);}(_0x6ea7,0x177));var _0x76ea=function(_0x27af45,_0x1b57aa){_0x27af45=_0x27af45-0x0;var _0x18df21=_0x6ea7[_0x27af45];return _0x18df21;};'use strict';var _=require(_0x76ea('0x0'));var util=require(_0x76ea('0x1'));var moment=require(_0x76ea('0x2'));var BPromise=require('bluebird');var rs=require('randomstring');var fs=require('fs');var Redis=require(_0x76ea('0x3'));var db=require('../../mysqldb')['db'];var utils=require(_0x76ea('0x4'));var logger=require(_0x76ea('0x5'))(_0x76ea('0x6'));var config=require(_0x76ea('0x7'));var jayson=require('jayson/promise');var client=jayson[_0x76ea('0x8')][_0x76ea('0x9')]({'port':0x232a});function respondWithRpcPromise(_0xb83f37,_0x463111,_0x280877){return new BPromise(function(_0x5ca9ce,_0x2932a9){return client[_0x76ea('0xa')](_0xb83f37,_0x280877)['then'](function(_0x5a8113){logger['info']('CmContactHasItem,\x20%s,\x20%s',_0x463111,_0x76ea('0xb'));logger[_0x76ea('0xc')]('CmContactHasItem,\x20%s,\x20%s,\x20%s',_0x463111,_0x76ea('0xb'),JSON[_0x76ea('0xd')](_0x5a8113));if(_0x5a8113['error']){if(_0x5a8113[_0x76ea('0xe')][_0x76ea('0xf')]===0x1f4){logger[_0x76ea('0xe')](_0x76ea('0x10'),_0x463111,_0x5a8113[_0x76ea('0xe')][_0x76ea('0x11')]);return _0x2932a9(_0x5a8113[_0x76ea('0xe')][_0x76ea('0x11')]);}logger[_0x76ea('0xe')](_0x76ea('0x10'),_0x463111,_0x5a8113[_0x76ea('0xe')]['message']);return _0x5ca9ce(_0x5a8113[_0x76ea('0xe')][_0x76ea('0x11')]);}else{logger[_0x76ea('0x12')](_0x76ea('0x10'),_0x463111,_0x76ea('0xb'));_0x5ca9ce(_0x5a8113[_0x76ea('0x13')][_0x76ea('0x11')]);}})[_0x76ea('0x14')](function(_0x1caf9f){logger[_0x76ea('0xe')](_0x76ea('0x10'),_0x463111,_0x1caf9f);_0x2932a9(_0x1caf9f);});});} \ No newline at end of file diff --git a/server/api/cmContactHasItem/index.js b/server/api/cmContactHasItem/index.js index b60b1c3..d0d4c23 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 _0x3eeb=['index','/:id','show','put','delete','exports','multer','util','path','express','Router','fs-extra','../../components/auth/service','../../config/environment','get','isAuthenticated'];(function(_0x30fbaf,_0x140355){var _0x25ab0c=function(_0x3354a6){while(--_0x3354a6){_0x30fbaf['push'](_0x30fbaf['shift']());}};_0x25ab0c(++_0x140355);}(_0x3eeb,0xf6));var _0xb3ee=function(_0x4cf98e,_0xba4b79){_0x4cf98e=_0x4cf98e-0x0;var _0x1623ac=_0x3eeb[_0x4cf98e];return _0x1623ac;};'use strict';var multer=require(_0xb3ee('0x0'));var util=require(_0xb3ee('0x1'));var path=require(_0xb3ee('0x2'));var timeout=require('connect-timeout');var express=require(_0xb3ee('0x3'));var router=express[_0xb3ee('0x4')]();var fs_extra=require(_0xb3ee('0x5'));var auth=require(_0xb3ee('0x6'));var interaction=require('../../components/interaction/service');var config=require(_0xb3ee('0x7'));var controller=require('./cmContactHasItem.controller');router[_0xb3ee('0x8')]('/',auth[_0xb3ee('0x9')](),controller[_0xb3ee('0xa')]);router[_0xb3ee('0x8')](_0xb3ee('0xb'),auth[_0xb3ee('0x9')](),controller[_0xb3ee('0xc')]);router['post']('/',auth[_0xb3ee('0x9')](),controller['create']);router[_0xb3ee('0xd')](_0xb3ee('0xb'),auth[_0xb3ee('0x9')](),controller['update']);router[_0xb3ee('0xe')]('/:id',auth[_0xb3ee('0x9')](),controller['destroy']);module[_0xb3ee('0xf')]=router; \ No newline at end of file +var _0x3fdc=['exports','util','path','connect-timeout','express','Router','../../components/auth/service','../../config/environment','isAuthenticated','index','get','/:id','show','post','create','put','update','destroy'];(function(_0x2c37b2,_0x107055){var _0x559312=function(_0x53e3d3){while(--_0x53e3d3){_0x2c37b2['push'](_0x2c37b2['shift']());}};_0x559312(++_0x107055);}(_0x3fdc,0xb5));var _0xc3fd=function(_0x195406,_0x265748){_0x195406=_0x195406-0x0;var _0x40352a=_0x3fdc[_0x195406];return _0x40352a;};'use strict';var multer=require('multer');var util=require(_0xc3fd('0x0'));var path=require(_0xc3fd('0x1'));var timeout=require(_0xc3fd('0x2'));var express=require(_0xc3fd('0x3'));var router=express[_0xc3fd('0x4')]();var fs_extra=require('fs-extra');var auth=require(_0xc3fd('0x5'));var interaction=require('../../components/interaction/service');var config=require(_0xc3fd('0x6'));var controller=require('./cmContactHasItem.controller');router['get']('/',auth[_0xc3fd('0x7')](),controller[_0xc3fd('0x8')]);router[_0xc3fd('0x9')](_0xc3fd('0xa'),auth[_0xc3fd('0x7')](),controller[_0xc3fd('0xb')]);router[_0xc3fd('0xc')]('/',auth[_0xc3fd('0x7')](),controller[_0xc3fd('0xd')]);router[_0xc3fd('0xe')](_0xc3fd('0xa'),auth[_0xc3fd('0x7')](),controller[_0xc3fd('0xf')]);router['delete'](_0xc3fd('0xa'),auth[_0xc3fd('0x7')](),controller[_0xc3fd('0x10')]);module[_0xc3fd('0x11')]=router; \ No newline at end of file diff --git a/server/api/cmCustomField/cmCustomField.attributes.js b/server/api/cmCustomField/cmCustomField.attributes.js index 66adaed..5cd4a6e 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 _0xd612=['isArray','stringify','ENUM','sequelize','alias','setDataValue','getDataValue','STRING','TEXT','long','select','parse','values'];(function(_0x55f8b4,_0x43f30d){var _0x2475f9=function(_0xdd6f4a){while(--_0xdd6f4a){_0x55f8b4['push'](_0x55f8b4['shift']());}};_0x2475f9(++_0x43f30d);}(_0xd612,0xd3));var _0x2d61=function(_0x29593c,_0x3983c1){_0x29593c=_0x29593c-0x0;var _0x2e90bc=_0xd612[_0x29593c];return _0x2e90bc;};'use strict';var Sequelize=require(_0x2d61('0x0'));var _=require('lodash');module['exports']={'name':{'type':Sequelize['VIRTUAL'],'get':function(_0x224f58){return this['getDataValue'](_0x2d61('0x1'));}},'alias':{'type':Sequelize['STRING'],'allowNull':![],'set':function(_0x143822){this[_0x2d61('0x2')](_0x2d61('0x1'),_0x143822?_0x143822:this[_0x2d61('0x3')]('name'));}},'type':{'type':Sequelize[_0x2d61('0x4')],'allowNull':![]},'values':{'type':Sequelize[_0x2d61('0x5')](_0x2d61('0x6')),'get':function(){if(this[_0x2d61('0x3')]('type')===_0x2d61('0x7')){return JSON[_0x2d61('0x8')](this[_0x2d61('0x3')](_0x2d61('0x9')));}else{return this['getDataValue']('values');}},'set':function(_0x39240f){if(Array[_0x2d61('0xa')](_0x39240f)){this[_0x2d61('0x2')]('values',JSON[_0x2d61('0xb')](_0x39240f));}else{this[_0x2d61('0x2')](_0x2d61('0x9'),_0x39240f);}}},'required':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'clickToAction':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'actionType':{'type':Sequelize[_0x2d61('0xc')]('voice')}}; \ No newline at end of file +var _0x8773=['STRING','setDataValue','getDataValue','TEXT','type','select','values','isArray','stringify','BOOLEAN','ENUM','exports','VIRTUAL','alias'];(function(_0x4ae6ef,_0xc2af80){var _0x3cbb4e=function(_0x569ad5){while(--_0x569ad5){_0x4ae6ef['push'](_0x4ae6ef['shift']());}};_0x3cbb4e(++_0xc2af80);}(_0x8773,0x7b));var _0x3877=function(_0x4176e3,_0x2a95d3){_0x4176e3=_0x4176e3-0x0;var _0x5b2205=_0x8773[_0x4176e3];return _0x5b2205;};'use strict';var Sequelize=require('sequelize');var _=require('lodash');module[_0x3877('0x0')]={'name':{'type':Sequelize[_0x3877('0x1')],'get':function(_0x7d7083){return this['getDataValue'](_0x3877('0x2'));}},'alias':{'type':Sequelize[_0x3877('0x3')],'allowNull':![],'set':function(_0x236933){this[_0x3877('0x4')](_0x3877('0x2'),_0x236933?_0x236933:this[_0x3877('0x5')]('name'));}},'type':{'type':Sequelize[_0x3877('0x3')],'allowNull':![]},'values':{'type':Sequelize[_0x3877('0x6')]('long'),'get':function(){if(this[_0x3877('0x5')](_0x3877('0x7'))===_0x3877('0x8')){return JSON['parse'](this[_0x3877('0x5')](_0x3877('0x9')));}else{return this[_0x3877('0x5')](_0x3877('0x9'));}},'set':function(_0x3dd53f){if(Array[_0x3877('0xa')](_0x3dd53f)){this[_0x3877('0x4')]('values',JSON[_0x3877('0xb')](_0x3dd53f));}else{this[_0x3877('0x4')](_0x3877('0x9'),_0x3dd53f);}}},'required':{'type':Sequelize[_0x3877('0xc')],'defaultValue':![]},'clickToAction':{'type':Sequelize[_0x3877('0xc')],'defaultValue':![]},'actionType':{'type':Sequelize[_0x3877('0xd')]('voice')}}; \ No newline at end of file diff --git a/server/api/cmCustomField/cmCustomField.controller.js b/server/api/cmCustomField/cmCustomField.controller.js index e92b133..29e3862 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 _0x0afa=['../../mysqldb','end','status','offset','undefined','limit','count','set','Content-Range','apply','reject','save','update','then','destroy','sendStatus','error','stack','name','send','index','fieldName','model','differenceBy','map','query','keys','intersection','fields','attributes','length','hasOwnProperty','nolimit','order','sort','where','filters','filter','type','merge','options','CmCustomField','include','findAll','catch','show','rawAttributes','includeAll','find','body','params','sequelize','transaction','text','Sequelize','TEXT','number','INTEGER','BOOLEAN','defaultValue','queryInterface','cm_contacts','cf_%d','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/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/license/util'];(function(_0x1f99a0,_0x50b73d){var _0x1e0849=function(_0x41e764){while(--_0x41e764){_0x1f99a0['push'](_0x1f99a0['shift']());}};_0x1e0849(++_0x50b73d);}(_0x0afa,0x14d));var _0xa0af=function(_0x14add3,_0x13ce8d){_0x14add3=_0x14add3-0x0;var _0x4a174f=_0x0afa[_0x14add3];return _0x4a174f;};'use strict';var emlformat=require(_0xa0af('0x0'));var rimraf=require(_0xa0af('0x1'));var zipdir=require(_0xa0af('0x2'));var jsonpatch=require(_0xa0af('0x3'));var rp=require('request-promise');var moment=require('moment');var BPromise=require(_0xa0af('0x4'));var Mustache=require(_0xa0af('0x5'));var util=require(_0xa0af('0x6'));var path=require(_0xa0af('0x7'));var sox=require(_0xa0af('0x8'));var csv=require(_0xa0af('0x9'));var ejs=require(_0xa0af('0xa'));var fs=require('fs');var fs_extra=require(_0xa0af('0xb'));var _=require(_0xa0af('0xc'));var squel=require(_0xa0af('0xd'));var crypto=require(_0xa0af('0xe'));var jsforce=require(_0xa0af('0xf'));var deskjs=require(_0xa0af('0x10'));var toCsv=require(_0xa0af('0x9'));var querystring=require(_0xa0af('0x11'));var Papa=require(_0xa0af('0x12'));var Redis=require(_0xa0af('0x13'));var authService=require('../../components/auth/service');var qs=require(_0xa0af('0x14'));var as=require(_0xa0af('0x15'));var hardwareService=require(_0xa0af('0x16'));var logger=require(_0xa0af('0x17'))(_0xa0af('0x18'));var utils=require(_0xa0af('0x19'));var config=require('../../config/environment');var licenseUtil=require(_0xa0af('0x1a'));var db=require(_0xa0af('0x1b'))['db'];function respondWithStatusCode(_0x1f83ac,_0x493b71){_0x493b71=_0x493b71||0xcc;return function(_0x462313){if(_0x462313){return _0x1f83ac['sendStatus'](_0x493b71);}return _0x1f83ac['status'](_0x493b71)[_0xa0af('0x1c')]();};}function respondWithResult(_0x2ca5fd,_0x4cf828){_0x4cf828=_0x4cf828||0xc8;return function(_0x13eaad){if(_0x13eaad){return _0x2ca5fd[_0xa0af('0x1d')](_0x4cf828)['json'](_0x13eaad);}};}function respondWithFilteredResult(_0x529912,_0x1c754f){return function(_0x4697c2){if(_0x4697c2){var _0xc5efff=typeof _0x1c754f[_0xa0af('0x1e')]===_0xa0af('0x1f')&&typeof _0x1c754f[_0xa0af('0x20')]===_0xa0af('0x1f');var _0x4e4476=_0x4697c2[_0xa0af('0x21')];var _0x3329a0=_0xc5efff?0x0:_0x1c754f[_0xa0af('0x1e')];var _0x45a356=_0xc5efff?_0x4697c2[_0xa0af('0x21')]:_0x1c754f[_0xa0af('0x1e')]+_0x1c754f[_0xa0af('0x20')];var _0x3f5a54;if(_0x45a356>=_0x4e4476){_0x45a356=_0x4e4476;_0x3f5a54=0xc8;}else{_0x3f5a54=0xce;}_0x529912[_0xa0af('0x1d')](_0x3f5a54);return _0x529912[_0xa0af('0x22')](_0xa0af('0x23'),_0x3329a0+'-'+_0x45a356+'/'+_0x4e4476)['json'](_0x4697c2);}return null;};}function patchUpdates(_0x3a7fea){return function(_0x17f023){try{jsonpatch[_0xa0af('0x24')](_0x17f023,_0x3a7fea,!![]);}catch(_0x8192c7){return BPromise[_0xa0af('0x25')](_0x8192c7);}return _0x17f023[_0xa0af('0x26')]();};}function saveUpdates(_0xe88b6b,_0x147800){return function(_0x2556a8){if(_0x2556a8){return _0x2556a8[_0xa0af('0x27')](_0xe88b6b)[_0xa0af('0x28')](function(_0x9119ee){return _0x9119ee;});}return null;};}function removeEntity(_0x1e9588,_0x5891ce){return function(_0x1ca40d){if(_0x1ca40d){return _0x1ca40d[_0xa0af('0x29')]()[_0xa0af('0x28')](function(){_0x1e9588['status'](0xcc)[_0xa0af('0x1c')]();});}};}function handleEntityNotFound(_0x5c6a0f,_0x5c2b85){return function(_0x3b5643){if(!_0x3b5643){_0x5c6a0f[_0xa0af('0x2a')](0x194);}return _0x3b5643;};}function handleError(_0x454086,_0xdb3672){_0xdb3672=_0xdb3672||0x1f4;return function(_0x347848){logger[_0xa0af('0x2b')](_0x347848[_0xa0af('0x2c')]);if(_0x347848[_0xa0af('0x2d')]){delete _0x347848[_0xa0af('0x2d')];}_0x454086[_0xa0af('0x1d')](_0xdb3672)[_0xa0af('0x2e')](_0x347848);};}exports[_0xa0af('0x2f')]=function(_0xe65a25,_0x424800){var _0x1ca313={},_0x1ae56d={},_0x1adbaf={'count':0x0,'rows':[]};var _0x591241=_['map'](db['CmCustomField']['rawAttributes'],function(_0x202f1d){return{'name':_0x202f1d[_0xa0af('0x30')],'type':_0x202f1d['type']['key']};});_0x1ae56d[_0xa0af('0x31')]=_[_0xa0af('0x32')](_[_0xa0af('0x33')](_0x591241,_0xa0af('0x2d')),[_0xa0af('0x2d')]);_0x1ae56d[_0xa0af('0x34')]=_[_0xa0af('0x35')](_0xe65a25[_0xa0af('0x34')]);_0x1ae56d['filters']=_[_0xa0af('0x36')](_0x1ae56d[_0xa0af('0x31')],_0x1ae56d['query']);_0x1ca313['attributes']=_[_0xa0af('0x36')](_0x1ae56d['model'],qs[_0xa0af('0x37')](_0xe65a25[_0xa0af('0x34')]['fields']));_0x1ca313['attributes']=_0x1ca313[_0xa0af('0x38')][_0xa0af('0x39')]?_0x1ca313[_0xa0af('0x38')]:_0x1ae56d[_0xa0af('0x31')];if(!_0xe65a25[_0xa0af('0x34')][_0xa0af('0x3a')](_0xa0af('0x3b'))){_0x1ca313[_0xa0af('0x20')]=qs['limit'](_0xe65a25['query'][_0xa0af('0x20')]);_0x1ca313['offset']=qs[_0xa0af('0x1e')](_0xe65a25[_0xa0af('0x34')][_0xa0af('0x1e')]);}_0x1ca313[_0xa0af('0x3c')]=qs['sort'](_0xe65a25['query'][_0xa0af('0x3d')]);_0x1ca313[_0xa0af('0x3e')]=qs['filters'](_['pick'](_0xe65a25[_0xa0af('0x34')],_0x1ae56d[_0xa0af('0x3f')]),_0x591241);if(_0xe65a25[_0xa0af('0x34')][_0xa0af('0x40')]){_0x1ca313[_0xa0af('0x3e')]=_['merge'](_0x1ca313[_0xa0af('0x3e')],{'$or':_['map'](_0x591241,function(_0x1b0d86){if(_0x1b0d86[_0xa0af('0x41')]!=='VIRTUAL'){var _0x34bdc8={};_0x34bdc8[_0x1b0d86[_0xa0af('0x2d')]]={'$like':'%'+_0xe65a25[_0xa0af('0x34')]['filter']+'%'};return _0x34bdc8;}})});}_0x1ca313=_[_0xa0af('0x42')]({},_0x1ca313,_0xe65a25[_0xa0af('0x43')]);var _0x3449f3={'where':_0x1ca313[_0xa0af('0x3e')]};return db[_0xa0af('0x44')]['count'](_0x3449f3)[_0xa0af('0x28')](function(_0xcf5b9c){_0x1adbaf[_0xa0af('0x21')]=_0xcf5b9c;if(_0xe65a25[_0xa0af('0x34')]['includeAll']){_0x1ca313[_0xa0af('0x45')]=[{'all':!![]}];}return db[_0xa0af('0x44')][_0xa0af('0x46')](_0x1ca313);})[_0xa0af('0x28')](function(_0x2cc2d6){_0x1adbaf['rows']=_0x2cc2d6;return _0x1adbaf;})[_0xa0af('0x28')](respondWithFilteredResult(_0x424800,_0x1ca313))[_0xa0af('0x47')](handleError(_0x424800,null));};exports[_0xa0af('0x48')]=function(_0x1ebe08,_0x37c61b){var _0x37ff13={'raw':!![],'where':{'id':_0x1ebe08['params']['id']}},_0x217619={};_0x217619['model']=_[_0xa0af('0x35')](db[_0xa0af('0x44')][_0xa0af('0x49')]);_0x217619[_0xa0af('0x34')]=_[_0xa0af('0x35')](_0x1ebe08['query']);_0x217619[_0xa0af('0x3f')]=_[_0xa0af('0x36')](_0x217619[_0xa0af('0x31')],_0x217619[_0xa0af('0x34')]);_0x37ff13['attributes']=_[_0xa0af('0x36')](_0x217619[_0xa0af('0x31')],qs[_0xa0af('0x37')](_0x1ebe08[_0xa0af('0x34')][_0xa0af('0x37')]));_0x37ff13[_0xa0af('0x38')]=_0x37ff13[_0xa0af('0x38')][_0xa0af('0x39')]?_0x37ff13[_0xa0af('0x38')]:_0x217619['model'];if(_0x1ebe08['query'][_0xa0af('0x4a')]){_0x37ff13[_0xa0af('0x45')]=[{'all':!![]}];}_0x37ff13=_['merge']({},_0x37ff13,_0x1ebe08['options']);return db[_0xa0af('0x44')][_0xa0af('0x4b')](_0x37ff13)[_0xa0af('0x28')](handleEntityNotFound(_0x37c61b,null))[_0xa0af('0x28')](respondWithResult(_0x37c61b,null))[_0xa0af('0x47')](handleError(_0x37c61b,null));};exports[_0xa0af('0x27')]=function(_0x2f8758,_0x19537e){if(_0x2f8758['body']['id']){delete _0x2f8758[_0xa0af('0x4c')]['id'];}return db[_0xa0af('0x44')][_0xa0af('0x4b')]({'where':{'id':_0x2f8758[_0xa0af('0x4d')]['id']}})[_0xa0af('0x28')](handleEntityNotFound(_0x19537e,null))[_0xa0af('0x28')](saveUpdates(_0x2f8758[_0xa0af('0x4c')],null))[_0xa0af('0x28')](respondWithResult(_0x19537e,null))[_0xa0af('0x47')](handleError(_0x19537e,null));};exports[_0xa0af('0x29')]=function(_0x2edd2b,_0x283df6){return db['CmCustomField'][_0xa0af('0x4b')]({'where':{'id':_0x2edd2b[_0xa0af('0x4d')]['id']}})[_0xa0af('0x28')](handleEntityNotFound(_0x283df6,null))['then'](removeEntity(_0x283df6,null))[_0xa0af('0x47')](handleError(_0x283df6,null));};exports['create']=function(_0x470c9b,_0x2c4f5c){var _0x2a6bac;return db[_0xa0af('0x4e')][_0xa0af('0x4f')](function(_0x46c6d7){return db[_0xa0af('0x44')]['create'](_0x470c9b[_0xa0af('0x4c')],{'transaction':_0x46c6d7})[_0xa0af('0x28')](function(_0xa0acf2){_0x2a6bac=_0xa0acf2;var _0x246023={'type':db['Sequelize']['TEXT'],'transaction':_0x46c6d7};switch(_0x470c9b['body']['type']){case _0xa0af('0x50'):_0x246023[_0xa0af('0x41')]=db[_0xa0af('0x51')][_0xa0af('0x52')];break;case _0xa0af('0x53'):_0x246023['type']=db[_0xa0af('0x51')][_0xa0af('0x54')];break;case'switch':_0x246023[_0xa0af('0x41')]=db[_0xa0af('0x51')][_0xa0af('0x55')];_0x246023[_0xa0af('0x56')]=![];break;default:}return db[_0xa0af('0x4e')][_0xa0af('0x57')]['addColumn'](_0xa0af('0x58'),util['format'](_0xa0af('0x59'),_0x2a6bac['id']),_0x246023);})[_0xa0af('0x28')](function(){return _0x2a6bac;});})[_0xa0af('0x28')](respondWithResult(_0x2c4f5c,0xc9))[_0xa0af('0x47')](handleError(_0x2c4f5c,null));}; \ No newline at end of file +var _0x5c3d=['attributes','fields','hasOwnProperty','nolimit','order','sort','where','pick','filter','merge','VIRTUAL','options','CmCustomField','include','findAll','rows','catch','params','length','includeAll','find','body','sequelize','transaction','create','Sequelize','TEXT','text','number','INTEGER','switch','BOOLEAN','queryInterface','addColumn','cm_contacts','format','cf_%d','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','moment','bluebird','util','path','sox','ejs','lodash','squel','crypto','jsforce','desk.js','to-csv','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','sendStatus','status','end','offset','undefined','limit','count','set','Content-Range','json','apply','reject','update','then','destroy','name','send','index','map','rawAttributes','fieldName','type','key','model','differenceBy','query','keys','filters','intersection'];(function(_0x570102,_0x2c775d){var _0x2abfe0=function(_0x419304){while(--_0x419304){_0x570102['push'](_0x570102['shift']());}};_0x2abfe0(++_0x2c775d);}(_0x5c3d,0x84));var _0xd5c3=function(_0x540e5,_0x131f46){_0x540e5=_0x540e5-0x0;var _0x4d9f5a=_0x5c3d[_0x540e5];return _0x4d9f5a;};'use strict';var emlformat=require(_0xd5c3('0x0'));var rimraf=require(_0xd5c3('0x1'));var zipdir=require(_0xd5c3('0x2'));var jsonpatch=require(_0xd5c3('0x3'));var rp=require(_0xd5c3('0x4'));var moment=require(_0xd5c3('0x5'));var BPromise=require(_0xd5c3('0x6'));var Mustache=require('mustache');var util=require(_0xd5c3('0x7'));var path=require(_0xd5c3('0x8'));var sox=require(_0xd5c3('0x9'));var csv=require('to-csv');var ejs=require(_0xd5c3('0xa'));var fs=require('fs');var fs_extra=require('fs-extra');var _=require(_0xd5c3('0xb'));var squel=require(_0xd5c3('0xc'));var crypto=require(_0xd5c3('0xd'));var jsforce=require(_0xd5c3('0xe'));var deskjs=require(_0xd5c3('0xf'));var toCsv=require(_0xd5c3('0x10'));var querystring=require(_0xd5c3('0x11'));var Papa=require(_0xd5c3('0x12'));var Redis=require(_0xd5c3('0x13'));var authService=require(_0xd5c3('0x14'));var qs=require(_0xd5c3('0x15'));var as=require('../../components/parsers/advancedSearch');var hardwareService=require(_0xd5c3('0x16'));var logger=require(_0xd5c3('0x17'))(_0xd5c3('0x18'));var utils=require(_0xd5c3('0x19'));var config=require(_0xd5c3('0x1a'));var licenseUtil=require(_0xd5c3('0x1b'));var db=require(_0xd5c3('0x1c'))['db'];function respondWithStatusCode(_0xca4b99,_0x3b13e2){_0x3b13e2=_0x3b13e2||0xcc;return function(_0x25f40a){if(_0x25f40a){return _0xca4b99[_0xd5c3('0x1d')](_0x3b13e2);}return _0xca4b99[_0xd5c3('0x1e')](_0x3b13e2)[_0xd5c3('0x1f')]();};}function respondWithResult(_0x2352e0,_0x48d95b){_0x48d95b=_0x48d95b||0xc8;return function(_0x5396a9){if(_0x5396a9){return _0x2352e0[_0xd5c3('0x1e')](_0x48d95b)['json'](_0x5396a9);}};}function respondWithFilteredResult(_0x462ff3,_0x32c9a8){return function(_0x839bb4){if(_0x839bb4){var _0x2a8cf4=typeof _0x32c9a8[_0xd5c3('0x20')]===_0xd5c3('0x21')&&typeof _0x32c9a8[_0xd5c3('0x22')]==='undefined';var _0x274ee3=_0x839bb4[_0xd5c3('0x23')];var _0x4a4072=_0x2a8cf4?0x0:_0x32c9a8[_0xd5c3('0x20')];var _0xa9eb87=_0x2a8cf4?_0x839bb4[_0xd5c3('0x23')]:_0x32c9a8[_0xd5c3('0x20')]+_0x32c9a8['limit'];var _0x3a083b;if(_0xa9eb87>=_0x274ee3){_0xa9eb87=_0x274ee3;_0x3a083b=0xc8;}else{_0x3a083b=0xce;}_0x462ff3['status'](_0x3a083b);return _0x462ff3[_0xd5c3('0x24')](_0xd5c3('0x25'),_0x4a4072+'-'+_0xa9eb87+'/'+_0x274ee3)[_0xd5c3('0x26')](_0x839bb4);}return null;};}function patchUpdates(_0x8fb3e){return function(_0x3169ae){try{jsonpatch[_0xd5c3('0x27')](_0x3169ae,_0x8fb3e,!![]);}catch(_0xf5b962){return BPromise[_0xd5c3('0x28')](_0xf5b962);}return _0x3169ae['save']();};}function saveUpdates(_0x4a64fe,_0x54bef1){return function(_0x10639f){if(_0x10639f){return _0x10639f[_0xd5c3('0x29')](_0x4a64fe)[_0xd5c3('0x2a')](function(_0x27758c){return _0x27758c;});}return null;};}function removeEntity(_0x180373,_0x46d0ff){return function(_0x398db4){if(_0x398db4){return _0x398db4[_0xd5c3('0x2b')]()['then'](function(){_0x180373[_0xd5c3('0x1e')](0xcc)[_0xd5c3('0x1f')]();});}};}function handleEntityNotFound(_0x329f80,_0x4559fc){return function(_0x177d08){if(!_0x177d08){_0x329f80['sendStatus'](0x194);}return _0x177d08;};}function handleError(_0x135303,_0x425dce){_0x425dce=_0x425dce||0x1f4;return function(_0x35887f){logger['error'](_0x35887f['stack']);if(_0x35887f[_0xd5c3('0x2c')]){delete _0x35887f[_0xd5c3('0x2c')];}_0x135303['status'](_0x425dce)[_0xd5c3('0x2d')](_0x35887f);};}exports[_0xd5c3('0x2e')]=function(_0x6bdaa0,_0x3fda59){var _0x54f75e={},_0x345ba5={},_0x5def66={'count':0x0,'rows':[]};var _0xc6bc3c=_[_0xd5c3('0x2f')](db['CmCustomField'][_0xd5c3('0x30')],function(_0x28d2a6){return{'name':_0x28d2a6[_0xd5c3('0x31')],'type':_0x28d2a6[_0xd5c3('0x32')][_0xd5c3('0x33')]};});_0x345ba5[_0xd5c3('0x34')]=_[_0xd5c3('0x35')](_['map'](_0xc6bc3c,_0xd5c3('0x2c')),['name']);_0x345ba5[_0xd5c3('0x36')]=_[_0xd5c3('0x37')](_0x6bdaa0['query']);_0x345ba5[_0xd5c3('0x38')]=_[_0xd5c3('0x39')](_0x345ba5[_0xd5c3('0x34')],_0x345ba5[_0xd5c3('0x36')]);_0x54f75e[_0xd5c3('0x3a')]=_['intersection'](_0x345ba5[_0xd5c3('0x34')],qs[_0xd5c3('0x3b')](_0x6bdaa0[_0xd5c3('0x36')][_0xd5c3('0x3b')]));_0x54f75e[_0xd5c3('0x3a')]=_0x54f75e['attributes']['length']?_0x54f75e['attributes']:_0x345ba5[_0xd5c3('0x34')];if(!_0x6bdaa0[_0xd5c3('0x36')][_0xd5c3('0x3c')](_0xd5c3('0x3d'))){_0x54f75e[_0xd5c3('0x22')]=qs[_0xd5c3('0x22')](_0x6bdaa0['query']['limit']);_0x54f75e['offset']=qs[_0xd5c3('0x20')](_0x6bdaa0[_0xd5c3('0x36')][_0xd5c3('0x20')]);}_0x54f75e[_0xd5c3('0x3e')]=qs['sort'](_0x6bdaa0['query'][_0xd5c3('0x3f')]);_0x54f75e[_0xd5c3('0x40')]=qs[_0xd5c3('0x38')](_[_0xd5c3('0x41')](_0x6bdaa0[_0xd5c3('0x36')],_0x345ba5[_0xd5c3('0x38')]),_0xc6bc3c);if(_0x6bdaa0['query'][_0xd5c3('0x42')]){_0x54f75e[_0xd5c3('0x40')]=_[_0xd5c3('0x43')](_0x54f75e[_0xd5c3('0x40')],{'$or':_[_0xd5c3('0x2f')](_0xc6bc3c,function(_0x366bbe){if(_0x366bbe['type']!==_0xd5c3('0x44')){var _0x486528={};_0x486528[_0x366bbe[_0xd5c3('0x2c')]]={'$like':'%'+_0x6bdaa0[_0xd5c3('0x36')]['filter']+'%'};return _0x486528;}})});}_0x54f75e=_[_0xd5c3('0x43')]({},_0x54f75e,_0x6bdaa0[_0xd5c3('0x45')]);var _0x37384a={'where':_0x54f75e[_0xd5c3('0x40')]};return db[_0xd5c3('0x46')][_0xd5c3('0x23')](_0x37384a)[_0xd5c3('0x2a')](function(_0x2b07b1){_0x5def66[_0xd5c3('0x23')]=_0x2b07b1;if(_0x6bdaa0['query']['includeAll']){_0x54f75e[_0xd5c3('0x47')]=[{'all':!![]}];}return db[_0xd5c3('0x46')][_0xd5c3('0x48')](_0x54f75e);})[_0xd5c3('0x2a')](function(_0x387a3e){_0x5def66[_0xd5c3('0x49')]=_0x387a3e;return _0x5def66;})[_0xd5c3('0x2a')](respondWithFilteredResult(_0x3fda59,_0x54f75e))[_0xd5c3('0x4a')](handleError(_0x3fda59,null));};exports['show']=function(_0x276a98,_0x4db2ca){var _0x63607b={'raw':!![],'where':{'id':_0x276a98[_0xd5c3('0x4b')]['id']}},_0x5e4d73={};_0x5e4d73[_0xd5c3('0x34')]=_['keys'](db[_0xd5c3('0x46')][_0xd5c3('0x30')]);_0x5e4d73[_0xd5c3('0x36')]=_['keys'](_0x276a98[_0xd5c3('0x36')]);_0x5e4d73['filters']=_[_0xd5c3('0x39')](_0x5e4d73['model'],_0x5e4d73[_0xd5c3('0x36')]);_0x63607b[_0xd5c3('0x3a')]=_[_0xd5c3('0x39')](_0x5e4d73[_0xd5c3('0x34')],qs[_0xd5c3('0x3b')](_0x276a98[_0xd5c3('0x36')][_0xd5c3('0x3b')]));_0x63607b[_0xd5c3('0x3a')]=_0x63607b[_0xd5c3('0x3a')][_0xd5c3('0x4c')]?_0x63607b[_0xd5c3('0x3a')]:_0x5e4d73['model'];if(_0x276a98[_0xd5c3('0x36')][_0xd5c3('0x4d')]){_0x63607b[_0xd5c3('0x47')]=[{'all':!![]}];}_0x63607b=_['merge']({},_0x63607b,_0x276a98[_0xd5c3('0x45')]);return db['CmCustomField'][_0xd5c3('0x4e')](_0x63607b)[_0xd5c3('0x2a')](handleEntityNotFound(_0x4db2ca,null))[_0xd5c3('0x2a')](respondWithResult(_0x4db2ca,null))['catch'](handleError(_0x4db2ca,null));};exports[_0xd5c3('0x29')]=function(_0x36ee0d,_0x49d233){if(_0x36ee0d[_0xd5c3('0x4f')]['id']){delete _0x36ee0d[_0xd5c3('0x4f')]['id'];}return db[_0xd5c3('0x46')]['find']({'where':{'id':_0x36ee0d[_0xd5c3('0x4b')]['id']}})[_0xd5c3('0x2a')](handleEntityNotFound(_0x49d233,null))[_0xd5c3('0x2a')](saveUpdates(_0x36ee0d[_0xd5c3('0x4f')],null))[_0xd5c3('0x2a')](respondWithResult(_0x49d233,null))[_0xd5c3('0x4a')](handleError(_0x49d233,null));};exports[_0xd5c3('0x2b')]=function(_0x6d1a24,_0x3692d9){return db[_0xd5c3('0x46')][_0xd5c3('0x4e')]({'where':{'id':_0x6d1a24[_0xd5c3('0x4b')]['id']}})[_0xd5c3('0x2a')](handleEntityNotFound(_0x3692d9,null))[_0xd5c3('0x2a')](removeEntity(_0x3692d9,null))[_0xd5c3('0x4a')](handleError(_0x3692d9,null));};exports['create']=function(_0x15b065,_0x40352c){var _0xa7a33d;return db[_0xd5c3('0x50')][_0xd5c3('0x51')](function(_0x11f471){return db['CmCustomField'][_0xd5c3('0x52')](_0x15b065[_0xd5c3('0x4f')],{'transaction':_0x11f471})[_0xd5c3('0x2a')](function(_0x4f190e){_0xa7a33d=_0x4f190e;var _0xcd1ed0={'type':db[_0xd5c3('0x53')][_0xd5c3('0x54')],'transaction':_0x11f471};switch(_0x15b065[_0xd5c3('0x4f')][_0xd5c3('0x32')]){case _0xd5c3('0x55'):_0xcd1ed0[_0xd5c3('0x32')]=db[_0xd5c3('0x53')][_0xd5c3('0x54')];break;case _0xd5c3('0x56'):_0xcd1ed0[_0xd5c3('0x32')]=db['Sequelize'][_0xd5c3('0x57')];break;case _0xd5c3('0x58'):_0xcd1ed0[_0xd5c3('0x32')]=db[_0xd5c3('0x53')][_0xd5c3('0x59')];_0xcd1ed0['defaultValue']=![];break;default:}return db['sequelize'][_0xd5c3('0x5a')][_0xd5c3('0x5b')](_0xd5c3('0x5c'),util[_0xd5c3('0x5d')](_0xd5c3('0x5e'),_0xa7a33d['id']),_0xcd1ed0);})['then'](function(){return _0xa7a33d;});})[_0xd5c3('0x2a')](respondWithResult(_0x40352c,0xc9))[_0xd5c3('0x4a')](handleError(_0x40352c,null));}; \ No newline at end of file diff --git a/server/api/cmCustomField/cmCustomField.model.js b/server/api/cmCustomField/cmCustomField.model.js index 48ad894..0d75bdc 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 _0x8b7a=['bluebird','request-promise','path','rimraf','../../config/environment','./cmCustomField.attributes','cm_custom_fields','lodash','util','api','moment'];(function(_0x41eb43,_0x5ccfaa){var _0x4abd92=function(_0x195697){while(--_0x195697){_0x41eb43['push'](_0x41eb43['shift']());}};_0x4abd92(++_0x5ccfaa);}(_0x8b7a,0x1ca));var _0xa8b7=function(_0x5ceb82,_0xcb5470){_0x5ceb82=_0x5ceb82-0x0;var _0x5ba547=_0x8b7a[_0x5ceb82];return _0x5ba547;};'use strict';var _=require(_0xa8b7('0x0'));var util=require(_0xa8b7('0x1'));var logger=require('../../config/logger')(_0xa8b7('0x2'));var moment=require(_0xa8b7('0x3'));var BPromise=require(_0xa8b7('0x4'));var rp=require(_0xa8b7('0x5'));var fs=require('fs');var path=require(_0xa8b7('0x6'));var rimraf=require(_0xa8b7('0x7'));var config=require(_0xa8b7('0x8'));var attributes=require(_0xa8b7('0x9'));module['exports']=function(_0x2fdfb4,_0x1c0506){return _0x2fdfb4['define']('CmCustomField',attributes,{'tableName':_0xa8b7('0xa'),'paranoid':!![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x29d7=['exports','CmCustomField','cm_custom_fields','lodash','../../config/logger','moment','bluebird','request-promise','../../config/environment','./cmCustomField.attributes'];(function(_0x7e21bc,_0x2bc22b){var _0x4877be=function(_0x13c17c){while(--_0x13c17c){_0x7e21bc['push'](_0x7e21bc['shift']());}};_0x4877be(++_0x2bc22b);}(_0x29d7,0xf3));var _0x729d=function(_0x9b57b9,_0x3d905a){_0x9b57b9=_0x9b57b9-0x0;var _0x58b646=_0x29d7[_0x9b57b9];return _0x58b646;};'use strict';var _=require(_0x729d('0x0'));var util=require('util');var logger=require(_0x729d('0x1'))('api');var moment=require(_0x729d('0x2'));var BPromise=require(_0x729d('0x3'));var rp=require(_0x729d('0x4'));var fs=require('fs');var path=require('path');var rimraf=require('rimraf');var config=require(_0x729d('0x5'));var attributes=require(_0x729d('0x6'));module[_0x729d('0x7')]=function(_0x4281bc,_0x33b645){return _0x4281bc['define'](_0x729d('0x8'),attributes,{'tableName':_0x729d('0x9'),'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 87f6b1a..8a4c9c4 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 _0xd30f=['code','message','result','moment','bluebird','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','client','http','request','then','info','CmCustomField,\x20%s,\x20%s','request\x20sent','CmCustomField,\x20%s,\x20%s,\x20%s','error'];(function(_0x5e1cdd,_0x545776){var _0x5ef861=function(_0x15f981){while(--_0x15f981){_0x5e1cdd['push'](_0x5e1cdd['shift']());}};_0x5ef861(++_0x545776);}(_0xd30f,0x1bc));var _0xfd30=function(_0x5d466f,_0x7ca416){_0x5d466f=_0x5d466f-0x0;var _0x4428c2=_0xd30f[_0x5d466f];return _0x4428c2;};'use strict';var _=require('lodash');var util=require('util');var moment=require(_0xfd30('0x0'));var BPromise=require(_0xfd30('0x1'));var rs=require('randomstring');var fs=require('fs');var Redis=require(_0xfd30('0x2'));var db=require(_0xfd30('0x3'))['db'];var utils=require(_0xfd30('0x4'));var logger=require(_0xfd30('0x5'))(_0xfd30('0x6'));var config=require(_0xfd30('0x7'));var jayson=require(_0xfd30('0x8'));var client=jayson[_0xfd30('0x9')][_0xfd30('0xa')]({'port':0x232a});function respondWithRpcPromise(_0x2f693e,_0x7630b1,_0x221190){return new BPromise(function(_0x208227,_0xdb5602){return client[_0xfd30('0xb')](_0x2f693e,_0x221190)[_0xfd30('0xc')](function(_0x1709cb){logger[_0xfd30('0xd')](_0xfd30('0xe'),_0x7630b1,_0xfd30('0xf'));logger['debug'](_0xfd30('0x10'),_0x7630b1,_0xfd30('0xf'),JSON['stringify'](_0x1709cb));if(_0x1709cb['error']){if(_0x1709cb[_0xfd30('0x11')][_0xfd30('0x12')]===0x1f4){logger['error'](_0xfd30('0xe'),_0x7630b1,_0x1709cb['error'][_0xfd30('0x13')]);return _0xdb5602(_0x1709cb[_0xfd30('0x11')][_0xfd30('0x13')]);}logger['error'](_0xfd30('0xe'),_0x7630b1,_0x1709cb[_0xfd30('0x11')][_0xfd30('0x13')]);return _0x208227(_0x1709cb['error'][_0xfd30('0x13')]);}else{logger[_0xfd30('0xd')](_0xfd30('0xe'),_0x7630b1,_0xfd30('0xf'));_0x208227(_0x1709cb[_0xfd30('0x14')][_0xfd30('0x13')]);}})['catch'](function(_0xdb112b){logger[_0xfd30('0x11')](_0xfd30('0xe'),_0x7630b1,_0xdb112b);_0xdb5602(_0xdb112b);});});} \ No newline at end of file +var _0x5243=['util','moment','bluebird','../../mysqldb','../../config/logger','rpc','jayson/promise','client','request','info','CmCustomField,\x20%s,\x20%s','debug','request\x20sent','error','code','message','result','catch'];(function(_0x373ed2,_0xa1e91b){var _0x16a3a7=function(_0x2a3c0c){while(--_0x2a3c0c){_0x373ed2['push'](_0x373ed2['shift']());}};_0x16a3a7(++_0xa1e91b);}(_0x5243,0xfc));var _0x3524=function(_0x51111a,_0x4ff906){_0x51111a=_0x51111a-0x0;var _0x2c9ec5=_0x5243[_0x51111a];return _0x2c9ec5;};'use strict';var _=require('lodash');var util=require(_0x3524('0x0'));var moment=require(_0x3524('0x1'));var BPromise=require(_0x3524('0x2'));var rs=require('randomstring');var fs=require('fs');var Redis=require('ioredis');var db=require(_0x3524('0x3'))['db'];var utils=require('../../config/utils');var logger=require(_0x3524('0x4'))(_0x3524('0x5'));var config=require('../../config/environment');var jayson=require(_0x3524('0x6'));var client=jayson[_0x3524('0x7')]['http']({'port':0x232a});function respondWithRpcPromise(_0x417da0,_0x169b42,_0x42d7b3){return new BPromise(function(_0x42d0c1,_0x51c5ad){return client[_0x3524('0x8')](_0x417da0,_0x42d7b3)['then'](function(_0x2584be){logger[_0x3524('0x9')](_0x3524('0xa'),_0x169b42,'request\x20sent');logger[_0x3524('0xb')]('CmCustomField,\x20%s,\x20%s,\x20%s',_0x169b42,_0x3524('0xc'),JSON['stringify'](_0x2584be));if(_0x2584be['error']){if(_0x2584be[_0x3524('0xd')][_0x3524('0xe')]===0x1f4){logger[_0x3524('0xd')](_0x3524('0xa'),_0x169b42,_0x2584be[_0x3524('0xd')][_0x3524('0xf')]);return _0x51c5ad(_0x2584be['error'][_0x3524('0xf')]);}logger['error'](_0x3524('0xa'),_0x169b42,_0x2584be[_0x3524('0xd')][_0x3524('0xf')]);return _0x42d0c1(_0x2584be[_0x3524('0xd')]['message']);}else{logger[_0x3524('0x9')](_0x3524('0xa'),_0x169b42,'request\x20sent');_0x42d0c1(_0x2584be[_0x3524('0x10')]['message']);}})[_0x3524('0x11')](function(_0x2bfe44){logger['error'](_0x3524('0xa'),_0x169b42,_0x2bfe44);_0x51c5ad(_0x2bfe44);});});} \ No newline at end of file diff --git a/server/api/cmCustomField/index.js b/server/api/cmCustomField/index.js index d75c306..bfc7b76 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 _0x5e17=['get','isAuthenticated','index','/:id','show','post','create','delete','destroy','exports','multer','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','./cmCustomField.controller'];(function(_0x3b5250,_0x7a0b2c){var _0xc844a1=function(_0x2fbc98){while(--_0x2fbc98){_0x3b5250['push'](_0x3b5250['shift']());}};_0xc844a1(++_0x7a0b2c);}(_0x5e17,0x17a));var _0x75e1=function(_0x74fc7a,_0x47c345){_0x74fc7a=_0x74fc7a-0x0;var _0x122c3b=_0x5e17[_0x74fc7a];return _0x122c3b;};'use strict';var multer=require(_0x75e1('0x0'));var util=require('util');var path=require('path');var timeout=require('connect-timeout');var express=require('express');var router=express['Router']();var fs_extra=require(_0x75e1('0x1'));var auth=require(_0x75e1('0x2'));var interaction=require(_0x75e1('0x3'));var config=require(_0x75e1('0x4'));var controller=require(_0x75e1('0x5'));router[_0x75e1('0x6')]('/',auth[_0x75e1('0x7')](),controller[_0x75e1('0x8')]);router[_0x75e1('0x6')](_0x75e1('0x9'),auth[_0x75e1('0x7')](),controller[_0x75e1('0xa')]);router[_0x75e1('0xb')]('/',auth[_0x75e1('0x7')](),controller[_0x75e1('0xc')]);router['put'](_0x75e1('0x9'),auth['isAuthenticated'](),controller['update']);router[_0x75e1('0xd')](_0x75e1('0x9'),auth[_0x75e1('0x7')](),controller[_0x75e1('0xe')]);module[_0x75e1('0xf')]=router; \ No newline at end of file +var _0x8cdb=['show','post','isAuthenticated','create','update','delete','destroy','exports','multer','path','connect-timeout','express','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','get','index','/:id'];(function(_0x391cd5,_0x4d06e9){var _0x164027=function(_0x598a5){while(--_0x598a5){_0x391cd5['push'](_0x391cd5['shift']());}};_0x164027(++_0x4d06e9);}(_0x8cdb,0x138));var _0xb8cd=function(_0x30acdf,_0x2ec711){_0x30acdf=_0x30acdf-0x0;var _0x4121cf=_0x8cdb[_0x30acdf];return _0x4121cf;};'use strict';var multer=require(_0xb8cd('0x0'));var util=require('util');var path=require(_0xb8cd('0x1'));var timeout=require(_0xb8cd('0x2'));var express=require(_0xb8cd('0x3'));var router=express['Router']();var fs_extra=require(_0xb8cd('0x4'));var auth=require(_0xb8cd('0x5'));var interaction=require(_0xb8cd('0x6'));var config=require(_0xb8cd('0x7'));var controller=require('./cmCustomField.controller');router[_0xb8cd('0x8')]('/',auth['isAuthenticated'](),controller[_0xb8cd('0x9')]);router['get'](_0xb8cd('0xa'),auth['isAuthenticated'](),controller[_0xb8cd('0xb')]);router[_0xb8cd('0xc')]('/',auth[_0xb8cd('0xd')](),controller[_0xb8cd('0xe')]);router['put'](_0xb8cd('0xa'),auth[_0xb8cd('0xd')](),controller[_0xb8cd('0xf')]);router[_0xb8cd('0x10')](_0xb8cd('0xa'),auth[_0xb8cd('0xd')](),controller[_0xb8cd('0x11')]);module[_0xb8cd('0x12')]=router; \ No newline at end of file diff --git a/server/api/cmHopper/cmHopper.attributes.js b/server/api/cmHopper/cmHopper.attributes.js index aa09c28..a2dfa2c 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 _0x4e68=['DATE','format','YYYY-MM-DD\x20HH:mm:ss','INTEGER','UNSIGNED','contactListQueue','sequelize','exports','STRING','BOOLEAN'];(function(_0x2dafbe,_0x5d04de){var _0x58a45a=function(_0x50ac96){while(--_0x50ac96){_0x2dafbe['push'](_0x2dafbe['shift']());}};_0x58a45a(++_0x5d04de);}(_0x4e68,0xd8));var _0x84e6=function(_0x352fe1,_0x376792){_0x352fe1=_0x352fe1-0x0;var _0x50895f=_0x4e68[_0x352fe1];return _0x50895f;};'use strict';var moment=require('moment');var Sequelize=require(_0x84e6('0x0'));module[_0x84e6('0x1')]={'phone':{'type':Sequelize[_0x84e6('0x2')],'allowNull':![]},'active':{'type':Sequelize[_0x84e6('0x3')],'defaultValue':![]},'scheduledat':{'type':Sequelize[_0x84e6('0x4')],'defaultValue':moment()[_0x84e6('0x5')](_0x84e6('0x6'))},'countbusyretry':{'type':Sequelize[_0x84e6('0x7')],'defaultValue':0x0},'countcongestionretry':{'type':Sequelize[_0x84e6('0x7')],'defaultValue':0x0},'countnoanswerretry':{'type':Sequelize[_0x84e6('0x7')],'defaultValue':0x0},'callback':{'type':Sequelize[_0x84e6('0x3')],'defaultValue':![]},'callbackuniqueid':{'type':Sequelize[_0x84e6('0x2')],'defaultValue':null},'callbackat':{'type':Sequelize['DATE']},'priority':{'type':Sequelize[_0x84e6('0x7')](0x2)[_0x84e6('0x8')],'defaultValue':0x2,'validate':{'min':0x0,'max':0x4}},'recallme':{'type':Sequelize[_0x84e6('0x3')],'defaultValue':![]},'ContactId':{'type':Sequelize[_0x84e6('0x7')],'unique':_0x84e6('0x9')},'ListId':{'type':Sequelize[_0x84e6('0x7')],'unique':_0x84e6('0x9')},'UserId':{'type':Sequelize['INTEGER']},'VoiceQueueId':{'type':Sequelize[_0x84e6('0x7')],'unique':_0x84e6('0x9')},'CampaignId':{'type':Sequelize['INTEGER']},'countnosuchnumberretry':{'type':Sequelize[_0x84e6('0x7')],'defaultValue':0x0},'countdropretry':{'type':Sequelize[_0x84e6('0x7')],'defaultValue':0x0},'countabandonedretry':{'type':Sequelize[_0x84e6('0x7')],'defaultValue':0x0},'countmachineretry':{'type':Sequelize[_0x84e6('0x7')],'defaultValue':0x0},'countagentrejectretry':{'type':Sequelize[_0x84e6('0x7')],'defaultValue':0x0},'OrderBy':{'type':Sequelize[_0x84e6('0x7')],'allowNull':!![],'defaultValue':0x0},'dialTimezone':{'type':Sequelize[_0x84e6('0x2')]},'recallmeNotifiedDate':{'type':Sequelize[_0x84e6('0x4')],'allowNull':!![],'defaultValue':null}}; \ No newline at end of file +var _0xa506=['contactListQueue','DATE','moment','sequelize','exports','STRING','BOOLEAN','format','INTEGER','UNSIGNED'];(function(_0x57b54c,_0x54ce0d){var _0x59cc19=function(_0xa33bc6){while(--_0xa33bc6){_0x57b54c['push'](_0x57b54c['shift']());}};_0x59cc19(++_0x54ce0d);}(_0xa506,0x160));var _0x6a50=function(_0x462da3,_0x1690e1){_0x462da3=_0x462da3-0x0;var _0x37fae7=_0xa506[_0x462da3];return _0x37fae7;};'use strict';var moment=require(_0x6a50('0x0'));var Sequelize=require(_0x6a50('0x1'));module[_0x6a50('0x2')]={'phone':{'type':Sequelize[_0x6a50('0x3')],'allowNull':![]},'active':{'type':Sequelize[_0x6a50('0x4')],'defaultValue':![]},'scheduledat':{'type':Sequelize['DATE'],'defaultValue':moment()[_0x6a50('0x5')]('YYYY-MM-DD\x20HH:mm:ss')},'countbusyretry':{'type':Sequelize[_0x6a50('0x6')],'defaultValue':0x0},'countcongestionretry':{'type':Sequelize[_0x6a50('0x6')],'defaultValue':0x0},'countnoanswerretry':{'type':Sequelize[_0x6a50('0x6')],'defaultValue':0x0},'callback':{'type':Sequelize[_0x6a50('0x4')],'defaultValue':![]},'callbackuniqueid':{'type':Sequelize[_0x6a50('0x3')],'defaultValue':null},'callbackat':{'type':Sequelize['DATE']},'priority':{'type':Sequelize[_0x6a50('0x6')](0x2)[_0x6a50('0x7')],'defaultValue':0x2,'validate':{'min':0x0,'max':0x4}},'recallme':{'type':Sequelize[_0x6a50('0x4')],'defaultValue':![]},'ContactId':{'type':Sequelize[_0x6a50('0x6')],'unique':_0x6a50('0x8')},'ListId':{'type':Sequelize[_0x6a50('0x6')],'unique':_0x6a50('0x8')},'UserId':{'type':Sequelize[_0x6a50('0x6')]},'VoiceQueueId':{'type':Sequelize[_0x6a50('0x6')],'unique':_0x6a50('0x8')},'CampaignId':{'type':Sequelize[_0x6a50('0x6')]},'countnosuchnumberretry':{'type':Sequelize[_0x6a50('0x6')],'defaultValue':0x0},'countdropretry':{'type':Sequelize['INTEGER'],'defaultValue':0x0},'countabandonedretry':{'type':Sequelize[_0x6a50('0x6')],'defaultValue':0x0},'countmachineretry':{'type':Sequelize[_0x6a50('0x6')],'defaultValue':0x0},'countagentrejectretry':{'type':Sequelize[_0x6a50('0x6')],'defaultValue':0x0},'OrderBy':{'type':Sequelize[_0x6a50('0x6')],'allowNull':!![],'defaultValue':0x0},'dialTimezone':{'type':Sequelize[_0x6a50('0x3')]},'recallmeNotifiedDate':{'type':Sequelize[_0x6a50('0x9')],'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 87f7112..28c3370 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 _0x8958=['scheduledAt','DESC','literal','COALESCE(CmHopper.UserId,\x200)\x20ASC','scheduledat','recallme','LOCK','Company','CmList','Queue','dialActive','getPreviewRecall','UPDATE','Contact','getOpenContacts','isNumber','CmHopper,\x20%s,\x20%s,\x20%s','getTimezones','push','utcOffset','getTimezone','timezones','lodash','../../mysqldb','status','offset','limit','undefined','count','set','Content-Range','json','update','then','error','stack','name','send','index','map','CmHopper','rawAttributes','key','model','query','keys','filters','concat','$gt','$gte','$lt','$lte','$eq','$not','$between','$notIn','$notLike','$iLike','$notILike','$like','$overlap','$any','attributes','intersection','fields','length','hasOwnProperty','order','sort','where','pick','filter','merge','type','options','include','rows','catch','show','params','find','create','body','destroy','VoiceQueueId','CampaignId','VoiceQueue','Campaign','omit','dataValues','createdAt','updatedAt','state','statedesc','deleted','campaign','user','UserId','format','YYYY-MM-DD\x20HH:mm:ss','calleridnum','phone','campaigntype','queue','ivr','CmContact','ContactId','firstName','lastName','isNil','calleridname','end','getPreview','getVoiceQueues','outbound','preview','dialOrderByScheduledAt','sequelize','transaction','dialPreviewAutoRecallMe','direction','isEmpty','hopperIds','priority','ASC'];(function(_0x26c7a6,_0x3acb25){var _0x520f91=function(_0x7d15de){while(--_0x7d15de){_0x26c7a6['push'](_0x26c7a6['shift']());}};_0x520f91(++_0x3acb25);}(_0x8958,0x93));var _0x8895=function(_0x431258,_0x2073b3){_0x431258=_0x431258-0x0;var _0x37d65c=_0x8958[_0x431258];return _0x37d65c;};'use strict';var moment=require('moment');var _=require(_0x8895('0x0'));var qs=require('../../components/parsers/qs');var logger=require('../../config/logger')('api');var shared=require('../../config/environment');var db=require(_0x8895('0x1'))['db'];function respondWithResult(_0x56e738,_0x38d5d7){_0x38d5d7=_0x38d5d7||0xc8;return function(_0xce4955){if(_0xce4955){return _0x56e738[_0x8895('0x2')](_0x38d5d7)['json'](_0xce4955);}};}function respondWithFilteredResult(_0x22fa52,_0x2f03ad){return function(_0x124e1e){if(_0x124e1e){var _0x40cec6=typeof _0x2f03ad[_0x8895('0x3')]==='undefined'&&typeof _0x2f03ad[_0x8895('0x4')]===_0x8895('0x5');var _0x408d4b=_0x124e1e[_0x8895('0x6')];var _0x6eab1e=_0x40cec6?0x0:_0x2f03ad[_0x8895('0x3')];var _0x22a12b=_0x40cec6?_0x124e1e[_0x8895('0x6')]:_0x2f03ad[_0x8895('0x3')]+_0x2f03ad[_0x8895('0x4')];var _0x4d1358;if(_0x22a12b>=_0x408d4b){_0x22a12b=_0x408d4b;_0x4d1358=0xc8;}else{_0x4d1358=0xce;}_0x22fa52[_0x8895('0x2')](_0x4d1358);return _0x22fa52[_0x8895('0x7')](_0x8895('0x8'),_0x6eab1e+'-'+_0x22a12b+'/'+_0x408d4b)[_0x8895('0x9')](_0x124e1e);}return null;};}function saveUpdates(_0x446e1a,_0xaf93bc){return function(_0x5af0ef){if(_0x5af0ef){return _0x5af0ef[_0x8895('0xa')](_0x446e1a)[_0x8895('0xb')](function(_0x56c18e){return _0x56c18e;});}return null;};}function handleEntityNotFound(_0x57d40a,_0x47b9fe){return function(_0x9191b8){if(!_0x9191b8){_0x57d40a['sendStatus'](0x194);}return _0x9191b8;};}function handleError(_0x4156f5,_0x337101){_0x337101=_0x337101||0x1f4;return function(_0x195789){logger[_0x8895('0xc')](_0x195789[_0x8895('0xd')]);if(_0x195789['name']){delete _0x195789[_0x8895('0xe')];}_0x4156f5[_0x8895('0x2')](_0x337101)[_0x8895('0xf')](_0x195789);};}exports[_0x8895('0x10')]=function(_0x2848b7,_0x1b5c82){var _0x304be6={},_0x26cee0={},_0x135c11={'count':0x0,'rows':[]};var _0x2da618=_[_0x8895('0x11')](db[_0x8895('0x12')][_0x8895('0x13')],function(_0x54e6d4){return{'name':_0x54e6d4['fieldName'],'type':_0x54e6d4['type'][_0x8895('0x14')]};});_0x26cee0[_0x8895('0x15')]=_[_0x8895('0x11')](_0x2da618,_0x8895('0xe'));_0x26cee0[_0x8895('0x16')]=_[_0x8895('0x17')](_0x2848b7[_0x8895('0x16')]);_0x26cee0[_0x8895('0x18')]=_['intersection'](_0x26cee0[_0x8895('0x15')],_0x26cee0[_0x8895('0x16')]);_0x26cee0[_0x8895('0x18')]=_[_0x8895('0x19')](_0x26cee0[_0x8895('0x18')],['$and','$or',_0x8895('0x1a'),_0x8895('0x1b'),_0x8895('0x1c'),_0x8895('0x1d'),'$ne',_0x8895('0x1e'),_0x8895('0x1f'),_0x8895('0x20'),'$notBetween','$in',_0x8895('0x21'),'$like',_0x8895('0x22'),_0x8895('0x23'),_0x8895('0x24'),_0x8895('0x25'),_0x8895('0x26'),'$contains','$contained',_0x8895('0x27')]);_0x304be6[_0x8895('0x28')]=_[_0x8895('0x29')](_0x26cee0[_0x8895('0x15')],qs[_0x8895('0x2a')](_0x2848b7['query']['fields']));_0x304be6[_0x8895('0x28')]=_0x304be6[_0x8895('0x28')][_0x8895('0x2b')]?_0x304be6[_0x8895('0x28')]:_0x26cee0[_0x8895('0x15')];if(!_0x2848b7['query'][_0x8895('0x2c')]('nolimit')){_0x304be6[_0x8895('0x4')]=qs['limit'](_0x2848b7[_0x8895('0x16')][_0x8895('0x4')]);_0x304be6[_0x8895('0x3')]=qs[_0x8895('0x3')](_0x2848b7[_0x8895('0x16')]['offset']);}_0x304be6[_0x8895('0x2d')]=qs[_0x8895('0x2e')](_0x2848b7[_0x8895('0x16')][_0x8895('0x2e')]);_0x304be6[_0x8895('0x2f')]=qs['filters'](_[_0x8895('0x30')](_0x2848b7['query'],_0x26cee0[_0x8895('0x18')]),_0x2da618);if(_0x2848b7['query'][_0x8895('0x31')]){_0x304be6[_0x8895('0x2f')]=_[_0x8895('0x32')](_0x304be6[_0x8895('0x2f')],{'$or':_[_0x8895('0x11')](_0x2da618,function(_0x4ee352){if(_0x4ee352[_0x8895('0x33')]!=='VIRTUAL'){var _0x57f58a={};_0x57f58a[_0x4ee352[_0x8895('0xe')]]={'$like':'%'+_0x2848b7[_0x8895('0x16')][_0x8895('0x31')]+'%'};return _0x57f58a;}})});}_0x304be6=_[_0x8895('0x32')]({},_0x304be6,_0x2848b7[_0x8895('0x34')]);var _0x4b7fe0={'where':_0x304be6[_0x8895('0x2f')]};return db[_0x8895('0x12')]['count'](_0x4b7fe0)[_0x8895('0xb')](function(_0x54ca09){_0x135c11[_0x8895('0x6')]=_0x54ca09;if(_0x2848b7[_0x8895('0x16')]['includeAll']){_0x304be6[_0x8895('0x35')]=[{'all':!![]}];}return db[_0x8895('0x12')]['findAll'](_0x304be6);})['then'](function(_0x202130){_0x135c11[_0x8895('0x36')]=_0x202130;return _0x135c11;})[_0x8895('0xb')](respondWithFilteredResult(_0x1b5c82,_0x304be6))[_0x8895('0x37')](handleError(_0x1b5c82,null));};exports[_0x8895('0x38')]=function(_0x4917d1,_0x42ed1f){var _0x25c854={'raw':!![],'where':{'id':_0x4917d1[_0x8895('0x39')]['id']}},_0x394d7d={};_0x394d7d[_0x8895('0x15')]=_[_0x8895('0x17')](db['CmHopper'][_0x8895('0x13')]);_0x394d7d['query']=_[_0x8895('0x17')](_0x4917d1[_0x8895('0x16')]);_0x394d7d['filters']=_[_0x8895('0x29')](_0x394d7d['model'],_0x394d7d[_0x8895('0x16')]);_0x25c854['attributes']=_['intersection'](_0x394d7d['model'],qs['fields'](_0x4917d1['query']['fields']));_0x25c854[_0x8895('0x28')]=_0x25c854[_0x8895('0x28')]['length']?_0x25c854['attributes']:_0x394d7d[_0x8895('0x15')];if(_0x4917d1[_0x8895('0x16')]['includeAll']){_0x25c854[_0x8895('0x35')]=[{'all':!![]}];}_0x25c854=_[_0x8895('0x32')]({},_0x25c854,_0x4917d1[_0x8895('0x34')]);return db[_0x8895('0x12')][_0x8895('0x3a')](_0x25c854)['then'](handleEntityNotFound(_0x42ed1f,null))['then'](respondWithResult(_0x42ed1f,null))['catch'](handleError(_0x42ed1f,null));};exports[_0x8895('0x3b')]=function(_0x5ab709,_0x44ab93){return db[_0x8895('0x12')][_0x8895('0x3b')](_0x5ab709[_0x8895('0x3c')],{})['then'](respondWithResult(_0x44ab93,0xc9))[_0x8895('0x37')](handleError(_0x44ab93,null));};exports[_0x8895('0xa')]=function(_0x3413cd,_0x167302){if(_0x3413cd[_0x8895('0x3c')]['id']){delete _0x3413cd[_0x8895('0x3c')]['id'];}return db[_0x8895('0x12')][_0x8895('0x3a')]({'where':{'id':_0x3413cd['params']['id']}})[_0x8895('0xb')](handleEntityNotFound(_0x167302,null))[_0x8895('0xb')](saveUpdates(_0x3413cd['body'],null))[_0x8895('0xb')](respondWithResult(_0x167302,null))['catch'](handleError(_0x167302,null));};exports['describe']=function(_0x13546d,_0x337a9f){return db[_0x8895('0x12')]['describe']()[_0x8895('0xb')](respondWithResult(_0x337a9f,null))['catch'](handleError(_0x337a9f,null));};exports[_0x8895('0x3d')]=function(_0x152197,_0xb3ecd6){var _0x1ca539;var _0x2f3bf1=_0x152197[_0x8895('0x39')]['id'];return db[_0x8895('0x12')]['find']({'where':{'id':_0x152197['params']['id']}})[_0x8895('0xb')](handleEntityNotFound(_0xb3ecd6,null))[_0x8895('0xb')](function(_0x5dfb6f){if(_0x5dfb6f){return _0x5dfb6f[_0x8895('0x3d')]()['then'](function(_0x4e8af3){return _0x4e8af3;});}})[_0x8895('0xb')](function(_0x4d52ac){_0x1ca539=_0x4d52ac;if(_0x4d52ac){if(_0x4d52ac[_0x8895('0x3e')]||_0x4d52ac[_0x8895('0x3f')]){return db[_0x4d52ac[_0x8895('0x3e')]?_0x8895('0x40'):_0x8895('0x41')][_0x8895('0x3a')]({'where':{'id':_0x4d52ac[_0x8895('0x3e')]?_0x4d52ac[_0x8895('0x3e')]:_0x4d52ac['CampaignId']},'attributes':['id',_0x8895('0xe')],'raw':!![]});}}})[_0x8895('0xb')](function(_0x2f81f7){var _0x5a5bc6={};if(_0x2f81f7){_[_0x8895('0x32')](_0x5a5bc6,_[_0x8895('0x42')](_0x1ca539[_0x8895('0x43')],[_0x8895('0x44'),_0x8895('0x45'),'id']));_0x5a5bc6[_0x8895('0x46')]=0x15;_0x5a5bc6[_0x8895('0x47')]=_0x8895('0x48');_0x5a5bc6[_0x8895('0x49')]=_0x2f81f7[_0x8895('0xe')];_0x5a5bc6['membername']=_0x152197[_0x8895('0x4a')][_0x8895('0xe')];_0x5a5bc6[_0x8895('0x4b')]=_0x152197[_0x8895('0x4a')]['id'];_0x5a5bc6[_0x8895('0x48')]=!![];_0x5a5bc6['deletedat']=moment()[_0x8895('0x4c')](_0x8895('0x4d'));_0x5a5bc6[_0x8895('0x4e')]=_0x1ca539[_0x8895('0x4f')];_0x5a5bc6[_0x8895('0x50')]=_0x1ca539['VoiceQueueId']?_0x8895('0x51'):_0x8895('0x52');return db[_0x8895('0x53')]['find']({'where':{'id':_0x5a5bc6[_0x8895('0x54')]},'attributes':[_0x8895('0x55'),_0x8895('0x56')]})['then'](function(_0x11153d){if(!_[_0x8895('0x57')](_0xb3ecd6)&&!_['isNil'](_0x11153d[_0x8895('0x55')])){_0x5a5bc6[_0x8895('0x58')]=_0x11153d['firstName'];if(!_[_0x8895('0x57')](_0x11153d[_0x8895('0x56')])){_0x5a5bc6[_0x8895('0x58')]+='\x20'+_0x11153d[_0x8895('0x56')];}}})['finally'](function(){return db['CmHopperFinal'][_0x8895('0x3b')](_0x5a5bc6);});}})[_0x8895('0xb')](function(_0x49877){return db['CmHopperAdditionalPhone'][_0x8895('0x3d')]({'where':{'CmHopperId':_0x2f3bf1}});})[_0x8895('0xb')](function(){return _0xb3ecd6['status'](0xcc)[_0x8895('0x59')]();})['catch'](handleError(_0xb3ecd6,null));};exports[_0x8895('0x5a')]=function(_0x2bd955,_0x46c521){var _0x14f8a4=[];return db[_0x8895('0x53')]['describe']()['then'](function(_0x239401){_0x14f8a4=_[_0x8895('0x17')](_0x239401);return _0x2bd955['user'][_0x8895('0x5b')]({'where':{'type':_0x8895('0x5c'),'dialActive':!![],'dialMethod':_0x8895('0x5d')},'attributes':['id',_0x8895('0x5e'),'dialPreviewAutoRecallMe'],'raw':!![]});})[_0x8895('0xb')](function(_0x2d2bf9){if(_0x2d2bf9&&_0x2d2bf9[_0x8895('0x2b')]){return db[_0x8895('0x5f')][_0x8895('0x60')](function(_0x41a2fe){var _0x261d4b={'active':![],'recallme':![],'scheduledAt':{'$lte':moment()[_0x8895('0x4c')](_0x8895('0x4d'))},'VoiceQueueId':{'$in':_[_0x8895('0x11')](_0x2d2bf9,'id')},'$or':[{'UserId':null},{'UserId':_0x2bd955[_0x8895('0x4a')]['id']}]};var _0x30ab15={'active':![],'recallme':!![],'VoiceQueueId':{'$in':_(_0x2d2bf9)[_0x8895('0x31')]([_0x8895('0x61'),0x0])[_0x8895('0x11')]('id')['value']()},'$or':[{'UserId':null},{'UserId':_0x2bd955['user']['id']}]};var _0x5b96fe={'$or':[_0x261d4b,_0x30ab15]};var _0x13b143=[];if(_0x2bd955[_0x8895('0x3c')][_0x8895('0x62')]&&_0x2bd955[_0x8895('0x3c')][_0x8895('0x62')]==='prev'){if(!_[_0x8895('0x63')](_0x2bd955[_0x8895('0x3c')]['hopperIds'])){_0x5b96fe['id']={'$in':_0x2bd955[_0x8895('0x3c')][_0x8895('0x64')]};}_0x13b143=[[_0x8895('0x65'),_0x8895('0x66')],[_0x8895('0x67'),_0x2d2bf9[0x0]['dialOrderByScheduledAt']===_0x8895('0x66')?_0x8895('0x68'):_0x8895('0x66')],db[_0x8895('0x5f')][_0x8895('0x69')](_0x8895('0x6a')),['id',_0x8895('0x68')]];}else{if(!_['isEmpty'](_0x2bd955[_0x8895('0x3c')][_0x8895('0x64')])){_0x5b96fe['id']={'$notIn':_0x2bd955['body'][_0x8895('0x64')]};}_0x13b143=[[_0x8895('0x65'),_0x8895('0x68')],[_0x8895('0x67'),_0x2d2bf9[0x0][_0x8895('0x5e')]],db['sequelize'][_0x8895('0x69')]('COALESCE(CmHopper.UserId,\x200)\x20DESC'),['id',_0x8895('0x66')]];}return db[_0x8895('0x12')]['findOne']({'attributes':['id',_0x8895('0x6b'),_0x8895('0x4f'),_0x8895('0x6c')],'where':_0x5b96fe,'order':_0x13b143,'transaction':_0x41a2fe,'lock':_0x41a2fe[_0x8895('0x6d')]['UPDATE'],'include':[{'model':db[_0x8895('0x53')],'as':'Contact','attributes':_0x14f8a4,'include':[{'model':db['CmCompany'],'as':_0x8895('0x6e'),'attributes':['id',_0x8895('0xe')]}]},{'model':db[_0x8895('0x6f')],'as':'List','attributes':['id',_0x8895('0xe')]},{'model':db['VoiceQueue'],'as':_0x8895('0x70'),'attributes':['id',_0x8895('0xe'),_0x8895('0x71')]}]})[_0x8895('0xb')](function(_0x2cc5fa){if(_0x2cc5fa){return _0x2cc5fa['update']({'UserId':_0x2bd955['user']['id']},{'transaction':_0x41a2fe});}});});}})[_0x8895('0xb')](handleEntityNotFound(_0x46c521,null))['then'](respondWithResult(_0x46c521,null))[_0x8895('0x37')](handleError(_0x46c521,null));};exports[_0x8895('0x72')]=function(_0x4925c4,_0xd1fd50,_0xd9637a){var _0x3ace6f=[];var _0xc4c8dc=_0x4925c4[_0x8895('0x39')]['id'];var _0x4f80a3=_0x4925c4[_0x8895('0x4a')]['id'];return db['CmContact']['describe']()[_0x8895('0xb')](function(_0x5276f3){_0x3ace6f=_[_0x8895('0x17')](_0x5276f3);return db[_0x8895('0x5f')][_0x8895('0x60')](function(_0x39f5e5){const _0x53591d={'id':_0xc4c8dc};return db['CmHopper']['findOne']({'attributes':['id',_0x8895('0x6b'),_0x8895('0x6c')],'where':_0x53591d,'transaction':_0x39f5e5,'lock':_0x39f5e5[_0x8895('0x6d')][_0x8895('0x73')],'include':[{'model':db[_0x8895('0x53')],'as':_0x8895('0x74'),'attributes':_0x3ace6f,'include':[{'model':db['CmCompany'],'as':_0x8895('0x6e'),'attributes':['id',_0x8895('0xe')]}]},{'model':db[_0x8895('0x6f')],'as':'List','attributes':['id',_0x8895('0xe')]},{'model':db['VoiceQueue'],'as':_0x8895('0x70'),'attributes':['id','name',_0x8895('0x71')]}]})[_0x8895('0xb')](function(_0x553437){if(_0x553437){return _0x553437[_0x8895('0xa')]({'UserId':_0x4f80a3},{'transaction':_0x39f5e5});}});});})[_0x8895('0xb')](handleEntityNotFound(_0xd1fd50,null))['then'](respondWithResult(_0xd1fd50,null))[_0x8895('0x37')](handleError(_0xd1fd50,null));};exports[_0x8895('0x75')]=function(_0x2af98f,_0xef59db){return _0x2af98f[_0x8895('0x4a')][_0x8895('0x5b')]({'where':{'type':_0x8895('0x5c'),'dialActive':!![],'dialMethod':'preview'},'attributes':['id'],'raw':!![]})[_0x8895('0xb')](function(_0x5ada19){if(_0x5ada19&&_0x5ada19[_0x8895('0x2b')]){return db[_0x8895('0x12')][_0x8895('0x6')]({'where':{'active':![],'recallme':![],'scheduledAt':{'$lte':moment()[_0x8895('0x4c')]('YYYY-MM-DD\x20HH:mm:ss')},'VoiceQueueId':{'$in':_[_0x8895('0x11')](_0x5ada19,'id')},'$or':[{'UserId':null},{'UserId':_0x2af98f[_0x8895('0x4a')]['id']}]}});}return 0x0;})[_0x8895('0xb')](function(_0x3c3df7){if(!_[_0x8895('0x57')](_0x3c3df7)&&_[_0x8895('0x76')](_0x3c3df7)){return _0xef59db[_0x8895('0x2')](0xc8)[_0x8895('0x9')]({'contacts':_0x3c3df7});}else{logger['error'](_0x8895('0x77'),_0x8895('0x75'),0x194,'entity\x20not\x20found');_0xef59db['sendStatus'](0x194);}})[_0x8895('0x37')](handleError(_0xef59db,null));};exports[_0x8895('0x78')]=function(_0x1bbcd3,_0xfbb2){var _0x52cf28=shared['timezones'];var _0x12fa59=[];_[_0x8895('0x11')](_0x52cf28,function(_0x27f372){_0x12fa59[_0x8895('0x79')]({'id':_0x27f372[_0x8895('0xe')],'name':_0x27f372['name'],'utcOffset':_0x27f372[_0x8895('0x7a')]});});return _0xfbb2[_0x8895('0x2')](0xc8)['json']({'tz':_0x12fa59});};exports[_0x8895('0x7b')]=function(_0x440093,_0x2381df){var _0x167dcb=shared[_0x8895('0x7c')];var _0x21bb69={};if(!_['isNil'](_0x167dcb[_0x440093[_0x8895('0x3c')]['id']]))_0x21bb69=_0x167dcb[_0x440093[_0x8895('0x3c')]['id']];return _0x2381df['status'](0xc8)['json'](_0x21bb69);}; \ No newline at end of file +var _0xcb81=['hasOwnProperty','order','sort','where','filter','merge','VIRTUAL','options','then','includeAll','include','rows','rawAttributes','find','catch','create','body','params','describe','destroy','CampaignId','VoiceQueueId','VoiceQueue','omit','state','deleted','campaign','membername','user','UserId','deletedat','format','YYYY-MM-DD\x20HH:mm:ss','calleridnum','campaigntype','queue','ivr','CmContact','ContactId','isNil','firstName','calleridname','finally','CmHopperFinal','CmHopperAdditionalPhone','end','getPreview','outbound','preview','dialOrderByScheduledAt','sequelize','dialPreviewAutoRecallMe','direction','prev','isEmpty','hopperIds','ASC','scheduledAt','DESC','literal','COALESCE(CmHopper.UserId,\x200)\x20ASC','findOne','scheduledat','phone','recallme','LOCK','Company','CmList','Queue','dialActive','getPreviewRecall','transaction','UPDATE','Contact','CmCompany','List','getOpenContacts','CmHopper,\x20%s,\x20%s,\x20%s','entity\x20not\x20found','getTimezones','timezones','utcOffset','moment','lodash','../../config/logger','status','json','offset','undefined','limit','count','set','update','sendStatus','stack','name','send','index','map','CmHopper','fieldName','type','key','query','keys','filters','concat','$and','$or','$gt','$lt','$lte','$ne','$eq','$not','$between','$in','$notIn','$like','$notLike','$iLike','$overlap','$contains','$contained','attributes','intersection','model','fields','length'];(function(_0x39f7e2,_0x210ee2){var _0x4b5d6d=function(_0xdf12a7){while(--_0xdf12a7){_0x39f7e2['push'](_0x39f7e2['shift']());}};_0x4b5d6d(++_0x210ee2);}(_0xcb81,0x154));var _0x1cb8=function(_0xe0b81f,_0x1fb734){_0xe0b81f=_0xe0b81f-0x0;var _0x290e5e=_0xcb81[_0xe0b81f];return _0x290e5e;};'use strict';var moment=require(_0x1cb8('0x0'));var _=require(_0x1cb8('0x1'));var qs=require('../../components/parsers/qs');var logger=require(_0x1cb8('0x2'))('api');var shared=require('../../config/environment');var db=require('../../mysqldb')['db'];function respondWithResult(_0x38c3ea,_0x33a8f2){_0x33a8f2=_0x33a8f2||0xc8;return function(_0x237e94){if(_0x237e94){return _0x38c3ea[_0x1cb8('0x3')](_0x33a8f2)[_0x1cb8('0x4')](_0x237e94);}};}function respondWithFilteredResult(_0x4e5c19,_0x98d682){return function(_0x2ac2d6){if(_0x2ac2d6){var _0x584b16=typeof _0x98d682[_0x1cb8('0x5')]===_0x1cb8('0x6')&&typeof _0x98d682[_0x1cb8('0x7')]==='undefined';var _0x1ff267=_0x2ac2d6['count'];var _0x480823=_0x584b16?0x0:_0x98d682[_0x1cb8('0x5')];var _0x2158a9=_0x584b16?_0x2ac2d6[_0x1cb8('0x8')]:_0x98d682[_0x1cb8('0x5')]+_0x98d682[_0x1cb8('0x7')];var _0x32715a;if(_0x2158a9>=_0x1ff267){_0x2158a9=_0x1ff267;_0x32715a=0xc8;}else{_0x32715a=0xce;}_0x4e5c19[_0x1cb8('0x3')](_0x32715a);return _0x4e5c19[_0x1cb8('0x9')]('Content-Range',_0x480823+'-'+_0x2158a9+'/'+_0x1ff267)[_0x1cb8('0x4')](_0x2ac2d6);}return null;};}function saveUpdates(_0x1ffe94,_0x1938ee){return function(_0x299eea){if(_0x299eea){return _0x299eea[_0x1cb8('0xa')](_0x1ffe94)['then'](function(_0x389c12){return _0x389c12;});}return null;};}function handleEntityNotFound(_0x2c600,_0xcb6ad1){return function(_0x14d84d){if(!_0x14d84d){_0x2c600[_0x1cb8('0xb')](0x194);}return _0x14d84d;};}function handleError(_0xe5402a,_0x339ad0){_0x339ad0=_0x339ad0||0x1f4;return function(_0x243930){logger['error'](_0x243930[_0x1cb8('0xc')]);if(_0x243930['name']){delete _0x243930[_0x1cb8('0xd')];}_0xe5402a[_0x1cb8('0x3')](_0x339ad0)[_0x1cb8('0xe')](_0x243930);};}exports[_0x1cb8('0xf')]=function(_0x2635a8,_0x308088){var _0x3bfbcf={},_0x9f0adb={},_0x2631db={'count':0x0,'rows':[]};var _0x1f9fd7=_[_0x1cb8('0x10')](db[_0x1cb8('0x11')]['rawAttributes'],function(_0x429d10){return{'name':_0x429d10[_0x1cb8('0x12')],'type':_0x429d10[_0x1cb8('0x13')][_0x1cb8('0x14')]};});_0x9f0adb['model']=_[_0x1cb8('0x10')](_0x1f9fd7,'name');_0x9f0adb[_0x1cb8('0x15')]=_[_0x1cb8('0x16')](_0x2635a8[_0x1cb8('0x15')]);_0x9f0adb[_0x1cb8('0x17')]=_['intersection'](_0x9f0adb['model'],_0x9f0adb[_0x1cb8('0x15')]);_0x9f0adb[_0x1cb8('0x17')]=_[_0x1cb8('0x18')](_0x9f0adb[_0x1cb8('0x17')],[_0x1cb8('0x19'),_0x1cb8('0x1a'),_0x1cb8('0x1b'),'$gte',_0x1cb8('0x1c'),_0x1cb8('0x1d'),_0x1cb8('0x1e'),_0x1cb8('0x1f'),_0x1cb8('0x20'),_0x1cb8('0x21'),'$notBetween',_0x1cb8('0x22'),_0x1cb8('0x23'),_0x1cb8('0x24'),_0x1cb8('0x25'),_0x1cb8('0x26'),'$notILike',_0x1cb8('0x24'),_0x1cb8('0x27'),_0x1cb8('0x28'),_0x1cb8('0x29'),'$any']);_0x3bfbcf[_0x1cb8('0x2a')]=_[_0x1cb8('0x2b')](_0x9f0adb[_0x1cb8('0x2c')],qs['fields'](_0x2635a8[_0x1cb8('0x15')][_0x1cb8('0x2d')]));_0x3bfbcf[_0x1cb8('0x2a')]=_0x3bfbcf['attributes'][_0x1cb8('0x2e')]?_0x3bfbcf[_0x1cb8('0x2a')]:_0x9f0adb[_0x1cb8('0x2c')];if(!_0x2635a8[_0x1cb8('0x15')][_0x1cb8('0x2f')]('nolimit')){_0x3bfbcf[_0x1cb8('0x7')]=qs[_0x1cb8('0x7')](_0x2635a8[_0x1cb8('0x15')][_0x1cb8('0x7')]);_0x3bfbcf[_0x1cb8('0x5')]=qs[_0x1cb8('0x5')](_0x2635a8[_0x1cb8('0x15')][_0x1cb8('0x5')]);}_0x3bfbcf[_0x1cb8('0x30')]=qs['sort'](_0x2635a8['query'][_0x1cb8('0x31')]);_0x3bfbcf[_0x1cb8('0x32')]=qs[_0x1cb8('0x17')](_['pick'](_0x2635a8['query'],_0x9f0adb[_0x1cb8('0x17')]),_0x1f9fd7);if(_0x2635a8[_0x1cb8('0x15')][_0x1cb8('0x33')]){_0x3bfbcf[_0x1cb8('0x32')]=_[_0x1cb8('0x34')](_0x3bfbcf[_0x1cb8('0x32')],{'$or':_[_0x1cb8('0x10')](_0x1f9fd7,function(_0x43dce0){if(_0x43dce0['type']!==_0x1cb8('0x35')){var _0x1a6518={};_0x1a6518[_0x43dce0[_0x1cb8('0xd')]]={'$like':'%'+_0x2635a8[_0x1cb8('0x15')][_0x1cb8('0x33')]+'%'};return _0x1a6518;}})});}_0x3bfbcf=_[_0x1cb8('0x34')]({},_0x3bfbcf,_0x2635a8[_0x1cb8('0x36')]);var _0x2ad7f6={'where':_0x3bfbcf[_0x1cb8('0x32')]};return db['CmHopper'][_0x1cb8('0x8')](_0x2ad7f6)[_0x1cb8('0x37')](function(_0x5e9f5f){_0x2631db[_0x1cb8('0x8')]=_0x5e9f5f;if(_0x2635a8[_0x1cb8('0x15')][_0x1cb8('0x38')]){_0x3bfbcf[_0x1cb8('0x39')]=[{'all':!![]}];}return db[_0x1cb8('0x11')]['findAll'](_0x3bfbcf);})[_0x1cb8('0x37')](function(_0x4666bc){_0x2631db[_0x1cb8('0x3a')]=_0x4666bc;return _0x2631db;})['then'](respondWithFilteredResult(_0x308088,_0x3bfbcf))['catch'](handleError(_0x308088,null));};exports['show']=function(_0xca5f83,_0x35e713){var _0x328f7e={'raw':!![],'where':{'id':_0xca5f83['params']['id']}},_0x4783c8={};_0x4783c8['model']=_[_0x1cb8('0x16')](db[_0x1cb8('0x11')][_0x1cb8('0x3b')]);_0x4783c8[_0x1cb8('0x15')]=_[_0x1cb8('0x16')](_0xca5f83[_0x1cb8('0x15')]);_0x4783c8[_0x1cb8('0x17')]=_[_0x1cb8('0x2b')](_0x4783c8['model'],_0x4783c8[_0x1cb8('0x15')]);_0x328f7e[_0x1cb8('0x2a')]=_[_0x1cb8('0x2b')](_0x4783c8[_0x1cb8('0x2c')],qs['fields'](_0xca5f83[_0x1cb8('0x15')]['fields']));_0x328f7e[_0x1cb8('0x2a')]=_0x328f7e[_0x1cb8('0x2a')]['length']?_0x328f7e[_0x1cb8('0x2a')]:_0x4783c8[_0x1cb8('0x2c')];if(_0xca5f83[_0x1cb8('0x15')]['includeAll']){_0x328f7e['include']=[{'all':!![]}];}_0x328f7e=_[_0x1cb8('0x34')]({},_0x328f7e,_0xca5f83['options']);return db[_0x1cb8('0x11')][_0x1cb8('0x3c')](_0x328f7e)[_0x1cb8('0x37')](handleEntityNotFound(_0x35e713,null))[_0x1cb8('0x37')](respondWithResult(_0x35e713,null))[_0x1cb8('0x3d')](handleError(_0x35e713,null));};exports[_0x1cb8('0x3e')]=function(_0x15e960,_0x5cc9e1){return db[_0x1cb8('0x11')][_0x1cb8('0x3e')](_0x15e960[_0x1cb8('0x3f')],{})[_0x1cb8('0x37')](respondWithResult(_0x5cc9e1,0xc9))['catch'](handleError(_0x5cc9e1,null));};exports[_0x1cb8('0xa')]=function(_0x7f7a09,_0x1b83a6){if(_0x7f7a09[_0x1cb8('0x3f')]['id']){delete _0x7f7a09[_0x1cb8('0x3f')]['id'];}return db['CmHopper'][_0x1cb8('0x3c')]({'where':{'id':_0x7f7a09[_0x1cb8('0x40')]['id']}})[_0x1cb8('0x37')](handleEntityNotFound(_0x1b83a6,null))[_0x1cb8('0x37')](saveUpdates(_0x7f7a09[_0x1cb8('0x3f')],null))['then'](respondWithResult(_0x1b83a6,null))[_0x1cb8('0x3d')](handleError(_0x1b83a6,null));};exports[_0x1cb8('0x41')]=function(_0x5598b1,_0x423916){return db[_0x1cb8('0x11')][_0x1cb8('0x41')]()[_0x1cb8('0x37')](respondWithResult(_0x423916,null))[_0x1cb8('0x3d')](handleError(_0x423916,null));};exports[_0x1cb8('0x42')]=function(_0x3b063c,_0x219541){var _0xd530f8;var _0x713a43=_0x3b063c[_0x1cb8('0x40')]['id'];return db[_0x1cb8('0x11')][_0x1cb8('0x3c')]({'where':{'id':_0x3b063c[_0x1cb8('0x40')]['id']}})['then'](handleEntityNotFound(_0x219541,null))[_0x1cb8('0x37')](function(_0x1e1272){if(_0x1e1272){return _0x1e1272[_0x1cb8('0x42')]()[_0x1cb8('0x37')](function(_0x21aba7){return _0x21aba7;});}})[_0x1cb8('0x37')](function(_0x2f853d){_0xd530f8=_0x2f853d;if(_0x2f853d){if(_0x2f853d['VoiceQueueId']||_0x2f853d[_0x1cb8('0x43')]){return db[_0x2f853d[_0x1cb8('0x44')]?_0x1cb8('0x45'):'Campaign']['find']({'where':{'id':_0x2f853d[_0x1cb8('0x44')]?_0x2f853d[_0x1cb8('0x44')]:_0x2f853d[_0x1cb8('0x43')]},'attributes':['id',_0x1cb8('0xd')],'raw':!![]});}}})[_0x1cb8('0x37')](function(_0x4d59db){var _0xd89636={};if(_0x4d59db){_[_0x1cb8('0x34')](_0xd89636,_[_0x1cb8('0x46')](_0xd530f8['dataValues'],['createdAt','updatedAt','id']));_0xd89636[_0x1cb8('0x47')]=0x15;_0xd89636['statedesc']=_0x1cb8('0x48');_0xd89636[_0x1cb8('0x49')]=_0x4d59db[_0x1cb8('0xd')];_0xd89636[_0x1cb8('0x4a')]=_0x3b063c[_0x1cb8('0x4b')]['name'];_0xd89636[_0x1cb8('0x4c')]=_0x3b063c[_0x1cb8('0x4b')]['id'];_0xd89636[_0x1cb8('0x48')]=!![];_0xd89636[_0x1cb8('0x4d')]=moment()[_0x1cb8('0x4e')](_0x1cb8('0x4f'));_0xd89636[_0x1cb8('0x50')]=_0xd530f8['phone'];_0xd89636[_0x1cb8('0x51')]=_0xd530f8[_0x1cb8('0x44')]?_0x1cb8('0x52'):_0x1cb8('0x53');return db[_0x1cb8('0x54')][_0x1cb8('0x3c')]({'where':{'id':_0xd89636[_0x1cb8('0x55')]},'attributes':['firstName','lastName']})['then'](function(_0x17ade3){if(!_['isNil'](_0x219541)&&!_[_0x1cb8('0x56')](_0x17ade3[_0x1cb8('0x57')])){_0xd89636[_0x1cb8('0x58')]=_0x17ade3[_0x1cb8('0x57')];if(!_[_0x1cb8('0x56')](_0x17ade3['lastName'])){_0xd89636['calleridname']+='\x20'+_0x17ade3['lastName'];}}})[_0x1cb8('0x59')](function(){return db[_0x1cb8('0x5a')]['create'](_0xd89636);});}})[_0x1cb8('0x37')](function(_0x5306fb){return db[_0x1cb8('0x5b')][_0x1cb8('0x42')]({'where':{'CmHopperId':_0x713a43}});})['then'](function(){return _0x219541[_0x1cb8('0x3')](0xcc)[_0x1cb8('0x5c')]();})[_0x1cb8('0x3d')](handleError(_0x219541,null));};exports[_0x1cb8('0x5d')]=function(_0x1396fc,_0x16ec38){var _0x416817=[];return db[_0x1cb8('0x54')][_0x1cb8('0x41')]()[_0x1cb8('0x37')](function(_0x2fb1a7){_0x416817=_[_0x1cb8('0x16')](_0x2fb1a7);return _0x1396fc[_0x1cb8('0x4b')]['getVoiceQueues']({'where':{'type':_0x1cb8('0x5e'),'dialActive':!![],'dialMethod':_0x1cb8('0x5f')},'attributes':['id',_0x1cb8('0x60'),'dialPreviewAutoRecallMe'],'raw':!![]});})[_0x1cb8('0x37')](function(_0x39de0b){if(_0x39de0b&&_0x39de0b[_0x1cb8('0x2e')]){return db[_0x1cb8('0x61')]['transaction'](function(_0x37f282){var _0x2b92f1={'active':![],'recallme':![],'scheduledAt':{'$lte':moment()['format'](_0x1cb8('0x4f'))},'VoiceQueueId':{'$in':_[_0x1cb8('0x10')](_0x39de0b,'id')},'$or':[{'UserId':null},{'UserId':_0x1396fc['user']['id']}]};var _0x41a5b2={'active':![],'recallme':!![],'VoiceQueueId':{'$in':_(_0x39de0b)[_0x1cb8('0x33')]([_0x1cb8('0x62'),0x0])[_0x1cb8('0x10')]('id')['value']()},'$or':[{'UserId':null},{'UserId':_0x1396fc['user']['id']}]};var _0x4e6a41={'$or':[_0x2b92f1,_0x41a5b2]};var _0x7f7524=[];if(_0x1396fc[_0x1cb8('0x3f')][_0x1cb8('0x63')]&&_0x1396fc[_0x1cb8('0x3f')][_0x1cb8('0x63')]===_0x1cb8('0x64')){if(!_[_0x1cb8('0x65')](_0x1396fc['body'][_0x1cb8('0x66')])){_0x4e6a41['id']={'$in':_0x1396fc[_0x1cb8('0x3f')][_0x1cb8('0x66')]};}_0x7f7524=[['priority',_0x1cb8('0x67')],[_0x1cb8('0x68'),_0x39de0b[0x0][_0x1cb8('0x60')]===_0x1cb8('0x67')?_0x1cb8('0x69'):'ASC'],db[_0x1cb8('0x61')][_0x1cb8('0x6a')](_0x1cb8('0x6b')),['id','DESC']];}else{if(!_[_0x1cb8('0x65')](_0x1396fc[_0x1cb8('0x3f')]['hopperIds'])){_0x4e6a41['id']={'$notIn':_0x1396fc[_0x1cb8('0x3f')]['hopperIds']};}_0x7f7524=[['priority',_0x1cb8('0x69')],[_0x1cb8('0x68'),_0x39de0b[0x0][_0x1cb8('0x60')]],db['sequelize']['literal']('COALESCE(CmHopper.UserId,\x200)\x20DESC'),['id',_0x1cb8('0x67')]];}return db[_0x1cb8('0x11')][_0x1cb8('0x6c')]({'attributes':['id',_0x1cb8('0x6d'),_0x1cb8('0x6e'),_0x1cb8('0x6f')],'where':_0x4e6a41,'order':_0x7f7524,'transaction':_0x37f282,'lock':_0x37f282[_0x1cb8('0x70')]['UPDATE'],'include':[{'model':db['CmContact'],'as':'Contact','attributes':_0x416817,'include':[{'model':db['CmCompany'],'as':_0x1cb8('0x71'),'attributes':['id','name']}]},{'model':db[_0x1cb8('0x72')],'as':'List','attributes':['id','name']},{'model':db['VoiceQueue'],'as':_0x1cb8('0x73'),'attributes':['id',_0x1cb8('0xd'),_0x1cb8('0x74')]}]})[_0x1cb8('0x37')](function(_0x26f661){if(_0x26f661){return _0x26f661[_0x1cb8('0xa')]({'UserId':_0x1396fc[_0x1cb8('0x4b')]['id']},{'transaction':_0x37f282});}});});}})[_0x1cb8('0x37')](handleEntityNotFound(_0x16ec38,null))[_0x1cb8('0x37')](respondWithResult(_0x16ec38,null))[_0x1cb8('0x3d')](handleError(_0x16ec38,null));};exports[_0x1cb8('0x75')]=function(_0x1f1bc9,_0x279a03,_0x1cc13f){var _0xafc24b=[];var _0x38aa03=_0x1f1bc9['params']['id'];var _0xd1ee6d=_0x1f1bc9[_0x1cb8('0x4b')]['id'];return db[_0x1cb8('0x54')][_0x1cb8('0x41')]()[_0x1cb8('0x37')](function(_0x284c46){_0xafc24b=_['keys'](_0x284c46);return db[_0x1cb8('0x61')][_0x1cb8('0x76')](function(_0x19c7ca){const _0xe2c1b8={'id':_0x38aa03};return db[_0x1cb8('0x11')]['findOne']({'attributes':['id',_0x1cb8('0x6d'),_0x1cb8('0x6f')],'where':_0xe2c1b8,'transaction':_0x19c7ca,'lock':_0x19c7ca['LOCK'][_0x1cb8('0x77')],'include':[{'model':db['CmContact'],'as':_0x1cb8('0x78'),'attributes':_0xafc24b,'include':[{'model':db[_0x1cb8('0x79')],'as':_0x1cb8('0x71'),'attributes':['id','name']}]},{'model':db[_0x1cb8('0x72')],'as':_0x1cb8('0x7a'),'attributes':['id','name']},{'model':db['VoiceQueue'],'as':_0x1cb8('0x73'),'attributes':['id',_0x1cb8('0xd'),'dialActive']}]})[_0x1cb8('0x37')](function(_0x257156){if(_0x257156){return _0x257156[_0x1cb8('0xa')]({'UserId':_0xd1ee6d},{'transaction':_0x19c7ca});}});});})[_0x1cb8('0x37')](handleEntityNotFound(_0x279a03,null))[_0x1cb8('0x37')](respondWithResult(_0x279a03,null))[_0x1cb8('0x3d')](handleError(_0x279a03,null));};exports[_0x1cb8('0x7b')]=function(_0x4eb044,_0x438d49){return _0x4eb044['user']['getVoiceQueues']({'where':{'type':'outbound','dialActive':!![],'dialMethod':_0x1cb8('0x5f')},'attributes':['id'],'raw':!![]})[_0x1cb8('0x37')](function(_0x4ab060){if(_0x4ab060&&_0x4ab060[_0x1cb8('0x2e')]){return db[_0x1cb8('0x11')][_0x1cb8('0x8')]({'where':{'active':![],'recallme':![],'scheduledAt':{'$lte':moment()['format']('YYYY-MM-DD\x20HH:mm:ss')},'VoiceQueueId':{'$in':_[_0x1cb8('0x10')](_0x4ab060,'id')},'$or':[{'UserId':null},{'UserId':_0x4eb044['user']['id']}]}});}return 0x0;})[_0x1cb8('0x37')](function(_0x3ec1ce){if(!_[_0x1cb8('0x56')](_0x3ec1ce)&&_['isNumber'](_0x3ec1ce)){return _0x438d49['status'](0xc8)[_0x1cb8('0x4')]({'contacts':_0x3ec1ce});}else{logger['error'](_0x1cb8('0x7c'),_0x1cb8('0x7b'),0x194,_0x1cb8('0x7d'));_0x438d49[_0x1cb8('0xb')](0x194);}})[_0x1cb8('0x3d')](handleError(_0x438d49,null));};exports[_0x1cb8('0x7e')]=function(_0x111011,_0x2f22cd){var _0x99de73=shared[_0x1cb8('0x7f')];var _0x255cec=[];_[_0x1cb8('0x10')](_0x99de73,function(_0xdb3ec3){_0x255cec['push']({'id':_0xdb3ec3['name'],'name':_0xdb3ec3[_0x1cb8('0xd')],'utcOffset':_0xdb3ec3[_0x1cb8('0x80')]});});return _0x2f22cd[_0x1cb8('0x3')](0xc8)[_0x1cb8('0x4')]({'tz':_0x255cec});};exports['getTimezone']=function(_0x745acb,_0x1e343c){var _0x4b48a6=shared[_0x1cb8('0x7f')];var _0x157290={};if(!_['isNil'](_0x4b48a6[_0x745acb[_0x1cb8('0x3f')]['id']]))_0x157290=_0x4b48a6[_0x745acb[_0x1cb8('0x3f')]['id']];return _0x1e343c[_0x1cb8('0x3')](0xc8)[_0x1cb8('0x4')](_0x157290);}; \ No newline at end of file diff --git a/server/api/cmHopper/cmHopper.model.js b/server/api/cmHopper/cmHopper.model.js index 0cef721..0a30ef7 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 _0xda19=['define','CmHopper','cm_hopper','scheduledat','priority','util','../../config/logger','moment','request-promise','rimraf','../../config/environment','./cmHopper.attributes','exports'];(function(_0x432fca,_0xb0b1b5){var _0x3adba4=function(_0x5e3ae4){while(--_0x5e3ae4){_0x432fca['push'](_0x432fca['shift']());}};_0x3adba4(++_0xb0b1b5);}(_0xda19,0xd5));var _0x9da1=function(_0x326c93,_0x2249be){_0x326c93=_0x326c93-0x0;var _0x5668dc=_0xda19[_0x326c93];return _0x5668dc;};'use strict';var _=require('lodash');var util=require(_0x9da1('0x0'));var logger=require(_0x9da1('0x1'))('api');var moment=require(_0x9da1('0x2'));var BPromise=require('bluebird');var rp=require(_0x9da1('0x3'));var fs=require('fs');var path=require('path');var rimraf=require(_0x9da1('0x4'));var config=require(_0x9da1('0x5'));var attributes=require(_0x9da1('0x6'));module[_0x9da1('0x7')]=function(_0x156faf,_0x2dcbc6){return _0x156faf[_0x9da1('0x8')](_0x9da1('0x9'),attributes,{'tableName':_0x9da1('0xa'),'paranoid':![],'indexes':[{'name':_0x9da1('0xb'),'fields':['scheduledat']},{'name':'phone','fields':['phone']},{'name':_0x9da1('0xc'),'fields':['priority']}],'timestamps':!![]});}; \ No newline at end of file +var _0x0295=['define','scheduledat','phone','priority','lodash','api','request-promise','path','rimraf','../../config/environment','./cmHopper.attributes','exports'];(function(_0x1ac120,_0x3e7e45){var _0x19b703=function(_0x5f32cb){while(--_0x5f32cb){_0x1ac120['push'](_0x1ac120['shift']());}};_0x19b703(++_0x3e7e45);}(_0x0295,0x1f0));var _0x5029=function(_0x2c80c1,_0xf479b3){_0x2c80c1=_0x2c80c1-0x0;var _0x375cd8=_0x0295[_0x2c80c1];return _0x375cd8;};'use strict';var _=require(_0x5029('0x0'));var util=require('util');var logger=require('../../config/logger')(_0x5029('0x1'));var moment=require('moment');var BPromise=require('bluebird');var rp=require(_0x5029('0x2'));var fs=require('fs');var path=require(_0x5029('0x3'));var rimraf=require(_0x5029('0x4'));var config=require(_0x5029('0x5'));var attributes=require(_0x5029('0x6'));module[_0x5029('0x7')]=function(_0x200217,_0x215955){return _0x200217[_0x5029('0x8')]('CmHopper',attributes,{'tableName':'cm_hopper','paranoid':![],'indexes':[{'name':'scheduledat','fields':[_0x5029('0x9')]},{'name':'phone','fields':[_0x5029('0xa')]},{'name':'priority','fields':[_0x5029('0xb')]}],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/cmHopper/cmHopper.rpc.js b/server/api/cmHopper/cmHopper.rpc.js index 00daf8d..a2da2c3 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 _0x413e=['ResetActiveCalls','CmHopperHandlePreviewRecallNotifications','voiceQueueIds','interval','availableAgentsIds','\x20MINUTE','literal','voicePause','CmList','List','NOW()','lodash','moment','../../mysqldb','../../config/logger','rpc','CmHopper','findAll','options','where','attributes','include','map','model','then','info','GetCmHopper','debug','stringify','catch','error','message','find','raw','ShowCmHopper','CreateCmHopper','create','UpdateCmHopper','body','limit','UpdateCmHopper\x20hopper\x20options\x20[%s]\x20active\x20status\x20[%s]','active','DestroyCmHopper','destroy','GetContactDialer','CmContact','describe','sequelize','order','UPDATE','Contact','keys','User','Agent','name','UserId','push','includes','update','all','dataValues','MoveContactManagedDialer','transaction','CmHopperFinal','COUNT','format','\x22%s\x22','\x20,\x201,\x20null','contactsRescheduled','CountReScheduled','GetContactRecallMe','LOCK','length','GetCmHopperPreview','GetContactByPhone','findOne','phone','dialTimezone','DESC','getContactByPhone'];(function(_0x22a417,_0x192032){var _0x5a123c=function(_0x3321c8){while(--_0x3321c8){_0x22a417['push'](_0x22a417['shift']());}};_0x5a123c(++_0x192032);}(_0x413e,0x14b));var _0xe413=function(_0x3a6f9b,_0x15b96b){_0x3a6f9b=_0x3a6f9b-0x0;var _0x10f2ed=_0x413e[_0x3a6f9b];return _0x10f2ed;};'use strict';var _=require(_0xe413('0x0'));var util=require('util');var moment=require(_0xe413('0x1'));var BPromise=require('bluebird');var db=require(_0xe413('0x2'))['db'];var logger=require(_0xe413('0x3'))(_0xe413('0x4'));exports['GetCmHopper']=function(_0x395d35){var _0x2440a4=this;return new Promise(function(_0x303788,_0x21be35){return db[_0xe413('0x5')][_0xe413('0x6')]({'raw':_0x395d35['options']?_0x395d35[_0xe413('0x7')]['raw']===undefined?!![]:![]:!![],'where':_0x395d35['options']?_0x395d35[_0xe413('0x7')][_0xe413('0x8')]||null:null,'attributes':_0x395d35['options']?_0x395d35[_0xe413('0x7')][_0xe413('0x9')]||null:null,'limit':_0x395d35['options']?_0x395d35['options']['limit']||null:null,'include':_0x395d35[_0xe413('0x7')]?_0x395d35[_0xe413('0x7')][_0xe413('0xa')]?_[_0xe413('0xb')](_0x395d35[_0xe413('0x7')]['include'],function(_0x41b0a3){return{'model':db[_0x41b0a3['model']],'as':_0x41b0a3['as'],'attributes':_0x41b0a3[_0xe413('0x9')],'include':_0x41b0a3[_0xe413('0xa')]?_[_0xe413('0xb')](_0x41b0a3[_0xe413('0xa')],function(_0x469975){return{'model':db[_0x469975[_0xe413('0xc')]],'as':_0x469975['as'],'attributes':_0x469975[_0xe413('0x9')],'include':_0x469975['include']?_[_0xe413('0xb')](_0x469975[_0xe413('0xa')],function(_0x53dfb5){return{'model':db[_0x53dfb5[_0xe413('0xc')]],'as':_0x53dfb5['as'],'attributes':_0x53dfb5[_0xe413('0x9')]};}):[]};}):[]};}):[]:[]})[_0xe413('0xd')](function(_0x3dd9d8){logger[_0xe413('0xe')](_0xe413('0xf'),_0x395d35);logger[_0xe413('0x10')](_0xe413('0xf'),_0x395d35,JSON[_0xe413('0x11')](_0x3dd9d8));_0x303788(_0x3dd9d8);})[_0xe413('0x12')](function(_0x5b37d2){logger[_0xe413('0x13')](_0xe413('0xf'),_0x5b37d2[_0xe413('0x14')],_0x395d35);_0x21be35(_0x2440a4['error'](0x1f4,_0x5b37d2[_0xe413('0x14')]));});});};exports['ShowCmHopper']=function(_0x156543){var _0x4cd8f0=this;return new Promise(function(_0x1b39db,_0x5893fe){return db[_0xe413('0x5')][_0xe413('0x15')]({'raw':_0x156543[_0xe413('0x7')]?_0x156543[_0xe413('0x7')][_0xe413('0x16')]===undefined?!![]:![]:!![],'where':_0x156543['options']?_0x156543[_0xe413('0x7')][_0xe413('0x8')]||null:null,'attributes':_0x156543[_0xe413('0x7')]?_0x156543['options'][_0xe413('0x9')]||null:null,'include':_0x156543[_0xe413('0x7')]?_0x156543['options'][_0xe413('0xa')]?_['map'](_0x156543[_0xe413('0x7')][_0xe413('0xa')],function(_0x4012f7){return{'model':db[_0x4012f7[_0xe413('0xc')]],'as':_0x4012f7['as'],'attributes':_0x4012f7[_0xe413('0x9')],'include':_0x4012f7[_0xe413('0xa')]?_[_0xe413('0xb')](_0x4012f7[_0xe413('0xa')],function(_0x2a5ddf){return{'model':db[_0x2a5ddf['model']],'as':_0x2a5ddf['as'],'attributes':_0x2a5ddf[_0xe413('0x9')],'include':_0x2a5ddf[_0xe413('0xa')]?_[_0xe413('0xb')](_0x2a5ddf['include'],function(_0x3554e8){return{'model':db[_0x3554e8[_0xe413('0xc')]],'as':_0x3554e8['as'],'attributes':_0x3554e8[_0xe413('0x9')]};}):[]};}):[]};}):[]:[]})[_0xe413('0xd')](function(_0x3348ac){logger[_0xe413('0xe')](_0xe413('0x17'),_0x156543);logger[_0xe413('0x10')](_0xe413('0x17'),_0x156543,JSON[_0xe413('0x11')](_0x3348ac));_0x1b39db(_0x3348ac);})[_0xe413('0x12')](function(_0x3aed08){logger[_0xe413('0x13')](_0xe413('0x17'),_0x3aed08[_0xe413('0x14')],_0x156543);_0x5893fe(_0x4cd8f0[_0xe413('0x13')](0x1f4,_0x3aed08[_0xe413('0x14')]));});});};exports[_0xe413('0x18')]=function(_0x1e0810){var _0x1a7999=this;return new Promise(function(_0x574b64,_0x4e4839){return db[_0xe413('0x5')][_0xe413('0x19')](_0x1e0810['body'],{'raw':_0x1e0810[_0xe413('0x7')]?_0x1e0810['options']['raw']===undefined?!![]:![]:!![]})['then'](function(_0x243496){logger[_0xe413('0xe')](_0xe413('0x18'),_0x1e0810);logger[_0xe413('0x10')](_0xe413('0x18'),_0x1e0810,JSON[_0xe413('0x11')](_0x243496));_0x574b64(_0x243496);})[_0xe413('0x12')](function(_0x24d683){logger[_0xe413('0x13')]('CreateCmHopper',_0x24d683['message'],_0x1e0810);_0x4e4839(_0x1a7999[_0xe413('0x13')](0x1f4,_0x24d683[_0xe413('0x14')]));});});};exports[_0xe413('0x1a')]=function(_0x1c6a9a){var _0x552b8a=this;return new Promise(function(_0x305e38,_0x2137cd){return db[_0xe413('0x5')]['update'](_0x1c6a9a[_0xe413('0x1b')],{'raw':_0x1c6a9a[_0xe413('0x7')]?_0x1c6a9a[_0xe413('0x7')][_0xe413('0x16')]===undefined?!![]:![]:!![],'individualHooks':!![],'where':_0x1c6a9a[_0xe413('0x7')]?_0x1c6a9a[_0xe413('0x7')][_0xe413('0x8')]||null:null,'attributes':_0x1c6a9a['options']?_0x1c6a9a['options']['attributes']||null:null,'limit':_0x1c6a9a[_0xe413('0x7')]?_0x1c6a9a[_0xe413('0x7')][_0xe413('0x1c')]||null:null})[_0xe413('0xd')](function(_0x3048f6){logger[_0xe413('0xe')](_0xe413('0x1a'),_0x1c6a9a);logger['info'](_0xe413('0x1d'),JSON['stringify'](_0x1c6a9a['options'][_0xe413('0x8')]),_0x1c6a9a[_0xe413('0x1b')][_0xe413('0x1e')]);logger[_0xe413('0x10')](_0xe413('0x1a'),_0x1c6a9a,JSON[_0xe413('0x11')](_0x3048f6));_0x305e38(_0x3048f6);})[_0xe413('0x12')](function(_0x294e7b){logger[_0xe413('0x13')](_0xe413('0x1a'),_0x294e7b[_0xe413('0x14')],_0x1c6a9a);_0x2137cd(_0x552b8a['error'](0x1f4,_0x294e7b[_0xe413('0x14')]));});});};exports[_0xe413('0x1f')]=function(_0x206187){var _0x4d5732=this;return new Promise(function(_0x583fa0,_0x389bcc){return db[_0xe413('0x5')][_0xe413('0x20')]({'where':_0x206187[_0xe413('0x7')]?_0x206187['options']['where']||null:null})[_0xe413('0xd')](function(_0x2cf495){logger['info']('DestroyCmHopper',_0x206187);logger['debug'](_0xe413('0x1f'),_0x206187,JSON['stringify'](_0x2cf495));_0x583fa0(_0x2cf495);})[_0xe413('0x12')](function(_0x5f0f98){logger[_0xe413('0x13')](_0xe413('0x1f'),_0x5f0f98[_0xe413('0x14')],_0x206187);_0x389bcc(_0x4d5732[_0xe413('0x13')](0x1f4,_0x5f0f98['message']));});});};exports[_0xe413('0x21')]=function(_0x54caf7){var _0x312a4e=this;return new Promise(function(_0x55c6ad,_0x4c0206){return db[_0xe413('0x22')][_0xe413('0x23')]()[_0xe413('0xd')](function(_0x5e93db){return db[_0xe413('0x24')]['transaction'](function(_0x363413){return db[_0xe413('0x5')][_0xe413('0x6')]({'where':_0x54caf7[_0xe413('0x7')]?_0x54caf7[_0xe413('0x7')][_0xe413('0x8')]||null:null,'attributes':_0x54caf7[_0xe413('0x7')]?_0x54caf7[_0xe413('0x7')][_0xe413('0x9')]||null:null,'limit':_0x54caf7[_0xe413('0x7')]?_0x54caf7[_0xe413('0x7')][_0xe413('0x1c')]||null:null,'order':_0x54caf7['options']?_0x54caf7[_0xe413('0x7')][_0xe413('0x25')]||null:null,'transaction':_0x363413,'lock':_0x363413['LOCK'][_0xe413('0x26')],'include':[{'model':db['CmContact'],'as':_0xe413('0x27'),'attributes':_[_0xe413('0x28')](_0x5e93db)},{'model':db[_0xe413('0x29')],'as':_0xe413('0x2a'),'attributes':['id',_0xe413('0x2b'),'voicePause']}]})['then'](function(_0x1ee171){var _0x2b6586=[];var _0x4a5b71=[];for(var _0x190e6e=0x0;_0x190e6e<_0x1ee171['length'];_0x190e6e+=0x1){var _0x302aff=_0x1ee171[_0x190e6e][_0xe413('0x2c')];if(_0x302aff===null){_0x2b6586[_0xe413('0x2d')](_0x1ee171[_0x190e6e]['update'](_0x54caf7[_0xe413('0x1b')],{'transaction':_0x363413}));}else if(!_0x4a5b71[_0xe413('0x2e')](_0x302aff)){_0x4a5b71['push'](_0x302aff);_0x2b6586[_0xe413('0x2d')](_0x1ee171[_0x190e6e][_0xe413('0x2f')](_0x54caf7['body'],{'transaction':_0x363413}));}}return BPromise[_0xe413('0x30')](_0x2b6586);});})[_0xe413('0xd')](function(_0x3e35cb){logger[_0xe413('0xe')]('GetContactDialer',_0x54caf7);if(_0x3e35cb['length']>0x0){logger[_0xe413('0xe')]('GetContactDialer\x20hopperId\x20[%s]\x20-\x20contactId\x20[%s]\x20-\x20active\x20status\x20[%s]',_0x3e35cb[0x0][_0xe413('0x31')]['id'],_0x3e35cb[0x0][_0xe413('0x31')]['ContactId'],_0x3e35cb[0x0][_0xe413('0x31')]['active']);}logger[_0xe413('0x10')](_0xe413('0x21'),_0x54caf7,JSON[_0xe413('0x11')](_0x3e35cb));_0x55c6ad(_0x3e35cb);})[_0xe413('0x12')](function(_0x15f369){logger['error'](_0xe413('0x21'),_0x15f369[_0xe413('0x14')],_0x54caf7);_0x4c0206(_0x312a4e[_0xe413('0x13')](0x1f4,_0x15f369[_0xe413('0x14')]));});});});};exports[_0xe413('0x32')]=function(_0xb5f596){var _0x53d64f=this;return new Promise(function(_0x4e9105,_0x16366e){return db[_0xe413('0x24')][_0xe413('0x33')](function(_0x452321){return db[_0xe413('0x34')]['create'](_0xb5f596['body'],{'raw':_0xb5f596[_0xe413('0x7')]?_0xb5f596[_0xe413('0x7')][_0xe413('0x16')]===undefined?!![]:![]:!![],'transaction':_0x452321})[_0xe413('0xd')](function(){logger['info']('MoveContactManagedDialer\x20hopper\x20options\x20[%s]\x20active\x20status\x20[%s]',JSON[_0xe413('0x11')](_0xb5f596['options'][_0xe413('0x8')]),_0xb5f596[_0xe413('0x7')][_0xe413('0x8')][_0xe413('0x1e')]);return db[_0xe413('0x5')][_0xe413('0x20')]({'where':_0xb5f596[_0xe413('0x7')]?_0xb5f596[_0xe413('0x7')][_0xe413('0x8')]||null:null,'transaction':_0x452321});});})['then'](function(_0x510419){logger[_0xe413('0xe')]('MoveContactManagedDialer',_0xb5f596);logger[_0xe413('0x10')](_0xe413('0x32'),_0xb5f596,JSON[_0xe413('0x11')](_0x510419));_0x4e9105(_0x510419);})[_0xe413('0x12')](function(_0x5dedd4){logger[_0xe413('0x13')](_0xe413('0x32'),_0x5dedd4[_0xe413('0x14')],_0xb5f596);_0x16366e(_0x53d64f['error'](0x1f4,_0x5dedd4['message']));});});};exports['CountReScheduled']=function(_0x1d0fe4){var _0x2397f8=this;return new Promise(function(_0x52498c,_0x16ea83){return db[_0xe413('0x5')][_0xe413('0x6')]({'raw':_0x1d0fe4[_0xe413('0x7')]?_0x1d0fe4[_0xe413('0x7')][_0xe413('0x16')]===undefined?!![]:![]:!![],'where':_0x1d0fe4[_0xe413('0x7')]?_0x1d0fe4[_0xe413('0x7')][_0xe413('0x8')]||null:null,'attributes':[[db[_0xe413('0x24')]['fn'](_0xe413('0x35'),db[_0xe413('0x24')]['fn']('IF',db[_0xe413('0x24')]['literal']('`scheduledat`\x20>=\x20'+util[_0xe413('0x36')](_0xe413('0x37'),moment()['format']('YYYY-MM-DD\x20HH:mm:ss'))+_0xe413('0x38')))),_0xe413('0x39')]]})[_0xe413('0xd')](function(_0x43aa44){logger['info']('CountReScheduled',_0x1d0fe4);logger[_0xe413('0x10')]('CountReScheduled',_0x1d0fe4,JSON[_0xe413('0x11')](_0x43aa44));_0x52498c(_0x43aa44);})['catch'](function(_0x5d6ad5){logger['error'](_0xe413('0x3a'),_0x5d6ad5[_0xe413('0x14')],_0x1d0fe4);_0x16ea83(_0x2397f8['error'](0x1f4,_0x5d6ad5[_0xe413('0x14')]));});});};exports[_0xe413('0x3b')]=function(_0x9c129){var _0x4fa901=this;return new Promise(function(_0xb135d9,_0x4118a4){return db[_0xe413('0x22')]['describe']()[_0xe413('0xd')](function(){return db[_0xe413('0x24')]['transaction'](function(_0x13c287){return db['CmHopper']['findAll']({'where':_0x9c129[_0xe413('0x7')]?_0x9c129['options']['where']||null:null,'attributes':_0x9c129['options']?_0x9c129[_0xe413('0x7')][_0xe413('0x9')]||null:null,'limit':0x1,'order':_0x9c129[_0xe413('0x7')]?_0x9c129[_0xe413('0x7')][_0xe413('0x25')]||null:null,'group':db[_0xe413('0x5')]['UserId'],'transaction':_0x13c287,'lock':_0x13c287[_0xe413('0x3c')][_0xe413('0x26')],'include':_0x9c129['options']?_0x9c129[_0xe413('0x7')][_0xe413('0xa')]?_[_0xe413('0xb')](_0x9c129[_0xe413('0x7')][_0xe413('0xa')],function(_0x39dd0){return{'model':db[_0x39dd0[_0xe413('0xc')]],'as':_0x39dd0['as'],'attributes':_0x39dd0[_0xe413('0x9')],'include':_0x39dd0[_0xe413('0xa')]?_['map'](_0x39dd0[_0xe413('0xa')],function(_0x1396e1){return{'model':db[_0x1396e1['model']],'as':_0x1396e1['as'],'attributes':_0x1396e1[_0xe413('0x9')],'include':_0x1396e1[_0xe413('0xa')]?_[_0xe413('0xb')](_0x1396e1[_0xe413('0xa')],function(_0x6046b){return{'model':db[_0x6046b[_0xe413('0xc')]],'as':_0x6046b['as'],'attributes':_0x6046b['attributes']};}):[]};}):[]};}):[]:[]})[_0xe413('0xd')](function(_0x337d3a){var _0xf3e4f9=[];for(var _0x2bcc24=0x0;_0x2bcc24<_0x337d3a[_0xe413('0x3d')];_0x2bcc24+=0x1){_0xf3e4f9[_0xe413('0x2d')](_0x337d3a[_0x2bcc24][_0xe413('0x2f')](_0x9c129[_0xe413('0x1b')],{'transaction':_0x13c287}));}return BPromise[_0xe413('0x30')](_0xf3e4f9);});})[_0xe413('0xd')](function(_0x560a37){logger['info'](_0xe413('0x3b'),_0x9c129);logger[_0xe413('0x10')]('GetContactRecallMe',_0x9c129,JSON[_0xe413('0x11')](_0x560a37));_0xb135d9(_0x560a37);})[_0xe413('0x12')](function(_0x2b176b){logger[_0xe413('0x13')](_0xe413('0x3b'),_0x2b176b['message'],_0x9c129);_0x4118a4(_0x4fa901['error'](0x1f4,_0x2b176b[_0xe413('0x14')]));});});});};exports[_0xe413('0x3e')]=function(_0x2f72fa){var _0x31fb76=this;return new Promise(function(_0xfc3266,_0x553478){db[_0xe413('0x22')][_0xe413('0x23')]()[_0xe413('0xd')](function(_0x3a7120){return db[_0xe413('0x5')][_0xe413('0x6')]({'raw':_0x2f72fa[_0xe413('0x7')]?_0x2f72fa['options'][_0xe413('0x16')]===undefined?!![]:![]:!![],'where':_0x2f72fa[_0xe413('0x7')]?_0x2f72fa[_0xe413('0x7')]['where']||null:null,'attributes':_0x2f72fa[_0xe413('0x7')]?_0x2f72fa[_0xe413('0x7')][_0xe413('0x9')]||null:null,'limit':_0x2f72fa[_0xe413('0x7')]?_0x2f72fa[_0xe413('0x7')][_0xe413('0x1c')]||null:null,'include':_0x2f72fa[_0xe413('0x7')]?_0x2f72fa[_0xe413('0x7')][_0xe413('0xa')]?_['map'](_0x2f72fa[_0xe413('0x7')][_0xe413('0xa')],function(_0x1f3dd2){return{'model':db[_0x1f3dd2[_0xe413('0xc')]],'as':_0x1f3dd2['as'],'attributes':_0x1f3dd2['as']===_0xe413('0x27')?_[_0xe413('0x28')](_0x3a7120):_0x1f3dd2['attributes'],'include':_0x1f3dd2[_0xe413('0xa')]?_['map'](_0x1f3dd2[_0xe413('0xa')],function(_0x422dfc){return{'model':db[_0x422dfc[_0xe413('0xc')]],'as':_0x422dfc['as'],'attributes':_0x422dfc[_0xe413('0x9')],'include':_0x422dfc['include']?_[_0xe413('0xb')](_0x422dfc[_0xe413('0xa')],function(_0x3d1f95){return{'model':db[_0x3d1f95[_0xe413('0xc')]],'as':_0x3d1f95['as'],'attributes':_0x3d1f95[_0xe413('0x9')]};}):[]};}):[]};}):[]:[]})[_0xe413('0xd')](function(_0x4872d1){logger[_0xe413('0xe')](_0xe413('0xf'),_0x2f72fa);logger['debug']('GetCmHopper',_0x2f72fa,JSON[_0xe413('0x11')](_0x4872d1));_0xfc3266(_0x4872d1);})[_0xe413('0x12')](function(_0x29ed99){logger[_0xe413('0x13')](_0xe413('0xf'),_0x29ed99[_0xe413('0x14')],_0x2f72fa);_0x553478(_0x31fb76[_0xe413('0x13')](0x1f4,_0x29ed99[_0xe413('0x14')]));});});});};exports[_0xe413('0x3f')]=function(_0x4ae946){var _0x165449=this;return new Promise(function(_0x11a832,_0x321e87){return db[_0xe413('0x22')][_0xe413('0x40')]({'raw':!![],'where':{'phone':_0x4ae946[_0xe413('0x7')][_0xe413('0x8')][_0xe413('0x41')]},'attributes':['id',_0xe413('0x42')],'order':[['id',_0xe413('0x43')]]})[_0xe413('0xd')](function(_0x24135f){logger[_0xe413('0xe')](_0xe413('0x44'),_0x4ae946);logger[_0xe413('0x10')]('getContactByPhone',_0x4ae946,JSON[_0xe413('0x11')](_0x24135f));_0x11a832(_0x24135f);})[_0xe413('0x12')](function(_0x1b4c6a){logger['error'](_0xe413('0x44'),_0x1b4c6a['message'],_0x4ae946);_0x321e87(_0x165449['error'](0x1f4,_0x1b4c6a['message']));});});};exports[_0xe413('0x45')]=function(_0x122f8c){var _0x1dd4a6=this;return new Promise(function(_0x1a2377,_0x44130e){return db[_0xe413('0x24')]['transaction'](function(_0x2c07a6){var _0x3daab0=_0x122f8c['options']&&_0x122f8c['options'][_0xe413('0x8')]?_0x122f8c['options'][_0xe413('0x8')]:{};return db[_0xe413('0x5')][_0xe413('0x2f')](_0x122f8c[_0xe413('0x1b')],{'where':_0x3daab0,'transaction':_0x2c07a6})[_0xe413('0xd')](function(_0x579c60){logger['info'](_0xe413('0x45'),_0x122f8c);logger['debug'](_0xe413('0x45'),_0x122f8c,JSON[_0xe413('0x11')](_0x579c60));_0x1a2377(_0x579c60);})[_0xe413('0x12')](function(_0x510c42){logger[_0xe413('0x13')](_0xe413('0x45'),_0x510c42['message'],_0x122f8c);_0x44130e(_0x1dd4a6[_0xe413('0x13')](0x1f4,_0x510c42[_0xe413('0x14')]));});});});};exports[_0xe413('0x46')]=function(_0xd002ae){var _0x5d8ff3=this;var _0x5ebff4=_0xd002ae['body'][_0xe413('0x8')][_0xe413('0x47')];var _0x8234a=_0xd002ae[_0xe413('0x1b')][_0xe413('0x8')][_0xe413('0x48')];var _0x19d72c=_0xd002ae['body'][_0xe413('0x8')][_0xe413('0x49')];return new Promise(function(_0x4efe5b,_0x4c6971){return db['CmHopper'][_0xe413('0x6')]({'where':{'voiceQueueId':{'$in':_0x5ebff4},'recallme':0x1,'active':0x0,'recallmeNotifiedDate':{'$eq':null},'scheduledat':{'$and':{'$lte':db[_0xe413('0x24')]['literal']('NOW()\x20+\x20INTERVAL\x20'+_0x8234a+_0xe413('0x4a')),'$gt':db[_0xe413('0x24')][_0xe413('0x4b')]('NOW()')}},'UserId':{'$in':_0x19d72c}},'include':[{'model':db[_0xe413('0x22')],'as':'Contact'},{'model':db[_0xe413('0x29')],'as':_0xe413('0x2a'),'attributes':['id',_0xe413('0x2b'),_0xe413('0x4c')]},{'model':db[_0xe413('0x4d')],'as':_0xe413('0x4e')}]})[_0xe413('0xd')](function(_0x56e26d){if(_0x56e26d[_0xe413('0x3d')]>0x0){return db[_0xe413('0x24')]['transaction'](function(_0x11ae2c){return db[_0xe413('0x5')]['update']({'recallmeNotifiedDate':db[_0xe413('0x24')][_0xe413('0x4b')](_0xe413('0x4f'))},{'where':{'id':{'$in':_[_0xe413('0xb')](_0x56e26d,'id')}},'transaction':_0x11ae2c})[_0xe413('0xd')](function(){_0x4efe5b(_0x56e26d);})[_0xe413('0x12')](function(_0x3d2247){logger['error'](_0xe413('0x46'),_0x3d2247['message'],_0xd002ae);_0x4c6971(_0x5d8ff3['error'](0x1f4,_0x3d2247[_0xe413('0x14')]));});})[_0xe413('0x12')](function(_0x5da45){logger['error'](_0xe413('0x46'),_0x5da45[_0xe413('0x14')],_0xd002ae);_0x4c6971(_0x5d8ff3['error'](0x1f4,_0x5da45['message']));});}else{_0x4efe5b(_0x56e26d);}});});}; \ No newline at end of file +var _0x53a5=['catch','message','ShowCmHopper','find','raw','then','error','CreateCmHopper','create','update','body','UpdateCmHopper','UpdateCmHopper\x20hopper\x20options\x20[%s]\x20active\x20status\x20[%s]','active','DestroyCmHopper','destroy','CmContact','describe','sequelize','transaction','order','LOCK','Contact','keys','User','Agent','name','voicePause','length','UserId','includes','push','all','GetContactDialer','GetContactDialer\x20hopperId\x20[%s]\x20-\x20contactId\x20[%s]\x20-\x20active\x20status\x20[%s]','dataValues','ContactId','MoveContactManagedDialer','CmHopperFinal','COUNT','literal','`scheduledat`\x20>=\x20','format','\x22%s\x22','\x20,\x201,\x20null','contactsRescheduled','GetContactRecallMe','UPDATE','GetCmHopperPreview','GetContactByPhone','findOne','phone','dialTimezone','DESC','getContactByPhone','ResetActiveCalls','CmHopperHandlePreviewRecallNotifications','interval','availableAgentsIds','NOW()\x20+\x20INTERVAL\x20','\x20MINUTE','NOW()','CmList','List','util','moment','bluebird','../../mysqldb','../../config/logger','GetCmHopper','CmHopper','findAll','options','where','attributes','limit','include','map','model','info','debug','stringify'];(function(_0x5a8349,_0x2d611c){var _0x1bff84=function(_0x17cd1f){while(--_0x17cd1f){_0x5a8349['push'](_0x5a8349['shift']());}};_0x1bff84(++_0x2d611c);}(_0x53a5,0x188));var _0x553a=function(_0x3a8b1f,_0x7c65f0){_0x3a8b1f=_0x3a8b1f-0x0;var _0x3bbccb=_0x53a5[_0x3a8b1f];return _0x3bbccb;};'use strict';var _=require('lodash');var util=require(_0x553a('0x0'));var moment=require(_0x553a('0x1'));var BPromise=require(_0x553a('0x2'));var db=require(_0x553a('0x3'))['db'];var logger=require(_0x553a('0x4'))('rpc');exports[_0x553a('0x5')]=function(_0x23ac6d){var _0xf4db56=this;return new Promise(function(_0x445974,_0x4ebd77){return db[_0x553a('0x6')][_0x553a('0x7')]({'raw':_0x23ac6d[_0x553a('0x8')]?_0x23ac6d['options']['raw']===undefined?!![]:![]:!![],'where':_0x23ac6d[_0x553a('0x8')]?_0x23ac6d[_0x553a('0x8')][_0x553a('0x9')]||null:null,'attributes':_0x23ac6d[_0x553a('0x8')]?_0x23ac6d['options'][_0x553a('0xa')]||null:null,'limit':_0x23ac6d[_0x553a('0x8')]?_0x23ac6d[_0x553a('0x8')][_0x553a('0xb')]||null:null,'include':_0x23ac6d['options']?_0x23ac6d['options'][_0x553a('0xc')]?_[_0x553a('0xd')](_0x23ac6d[_0x553a('0x8')][_0x553a('0xc')],function(_0x533a4d){return{'model':db[_0x533a4d[_0x553a('0xe')]],'as':_0x533a4d['as'],'attributes':_0x533a4d['attributes'],'include':_0x533a4d[_0x553a('0xc')]?_[_0x553a('0xd')](_0x533a4d[_0x553a('0xc')],function(_0x3870cf){return{'model':db[_0x3870cf[_0x553a('0xe')]],'as':_0x3870cf['as'],'attributes':_0x3870cf[_0x553a('0xa')],'include':_0x3870cf['include']?_[_0x553a('0xd')](_0x3870cf[_0x553a('0xc')],function(_0xf3c1eb){return{'model':db[_0xf3c1eb[_0x553a('0xe')]],'as':_0xf3c1eb['as'],'attributes':_0xf3c1eb[_0x553a('0xa')]};}):[]};}):[]};}):[]:[]})['then'](function(_0x4792b0){logger[_0x553a('0xf')](_0x553a('0x5'),_0x23ac6d);logger[_0x553a('0x10')]('GetCmHopper',_0x23ac6d,JSON[_0x553a('0x11')](_0x4792b0));_0x445974(_0x4792b0);})[_0x553a('0x12')](function(_0x36aff1){logger['error'](_0x553a('0x5'),_0x36aff1[_0x553a('0x13')],_0x23ac6d);_0x4ebd77(_0xf4db56['error'](0x1f4,_0x36aff1[_0x553a('0x13')]));});});};exports[_0x553a('0x14')]=function(_0x37e246){var _0x775e13=this;return new Promise(function(_0x311f47,_0x24e9d5){return db[_0x553a('0x6')][_0x553a('0x15')]({'raw':_0x37e246['options']?_0x37e246[_0x553a('0x8')][_0x553a('0x16')]===undefined?!![]:![]:!![],'where':_0x37e246[_0x553a('0x8')]?_0x37e246['options'][_0x553a('0x9')]||null:null,'attributes':_0x37e246[_0x553a('0x8')]?_0x37e246['options'][_0x553a('0xa')]||null:null,'include':_0x37e246[_0x553a('0x8')]?_0x37e246[_0x553a('0x8')][_0x553a('0xc')]?_[_0x553a('0xd')](_0x37e246['options'][_0x553a('0xc')],function(_0x4a82e2){return{'model':db[_0x4a82e2['model']],'as':_0x4a82e2['as'],'attributes':_0x4a82e2[_0x553a('0xa')],'include':_0x4a82e2['include']?_[_0x553a('0xd')](_0x4a82e2[_0x553a('0xc')],function(_0x59cfbc){return{'model':db[_0x59cfbc['model']],'as':_0x59cfbc['as'],'attributes':_0x59cfbc[_0x553a('0xa')],'include':_0x59cfbc['include']?_[_0x553a('0xd')](_0x59cfbc[_0x553a('0xc')],function(_0x4eec5d){return{'model':db[_0x4eec5d[_0x553a('0xe')]],'as':_0x4eec5d['as'],'attributes':_0x4eec5d[_0x553a('0xa')]};}):[]};}):[]};}):[]:[]})[_0x553a('0x17')](function(_0x37c08e){logger[_0x553a('0xf')](_0x553a('0x14'),_0x37e246);logger[_0x553a('0x10')]('ShowCmHopper',_0x37e246,JSON[_0x553a('0x11')](_0x37c08e));_0x311f47(_0x37c08e);})['catch'](function(_0x1bf3bb){logger['error'](_0x553a('0x14'),_0x1bf3bb[_0x553a('0x13')],_0x37e246);_0x24e9d5(_0x775e13[_0x553a('0x18')](0x1f4,_0x1bf3bb[_0x553a('0x13')]));});});};exports[_0x553a('0x19')]=function(_0x15dd5d){var _0x25d48e=this;return new Promise(function(_0x3d339b,_0x29b0f6){return db[_0x553a('0x6')][_0x553a('0x1a')](_0x15dd5d['body'],{'raw':_0x15dd5d[_0x553a('0x8')]?_0x15dd5d[_0x553a('0x8')]['raw']===undefined?!![]:![]:!![]})[_0x553a('0x17')](function(_0x133de9){logger[_0x553a('0xf')](_0x553a('0x19'),_0x15dd5d);logger[_0x553a('0x10')]('CreateCmHopper',_0x15dd5d,JSON[_0x553a('0x11')](_0x133de9));_0x3d339b(_0x133de9);})[_0x553a('0x12')](function(_0x44fc45){logger[_0x553a('0x18')](_0x553a('0x19'),_0x44fc45[_0x553a('0x13')],_0x15dd5d);_0x29b0f6(_0x25d48e[_0x553a('0x18')](0x1f4,_0x44fc45[_0x553a('0x13')]));});});};exports['UpdateCmHopper']=function(_0x2acc0f){var _0x21ebf4=this;return new Promise(function(_0x68c178,_0x302c96){return db['CmHopper'][_0x553a('0x1b')](_0x2acc0f[_0x553a('0x1c')],{'raw':_0x2acc0f['options']?_0x2acc0f['options']['raw']===undefined?!![]:![]:!![],'individualHooks':!![],'where':_0x2acc0f[_0x553a('0x8')]?_0x2acc0f[_0x553a('0x8')]['where']||null:null,'attributes':_0x2acc0f[_0x553a('0x8')]?_0x2acc0f[_0x553a('0x8')]['attributes']||null:null,'limit':_0x2acc0f[_0x553a('0x8')]?_0x2acc0f['options'][_0x553a('0xb')]||null:null})[_0x553a('0x17')](function(_0x20ddcf){logger[_0x553a('0xf')](_0x553a('0x1d'),_0x2acc0f);logger[_0x553a('0xf')](_0x553a('0x1e'),JSON[_0x553a('0x11')](_0x2acc0f['options'][_0x553a('0x9')]),_0x2acc0f[_0x553a('0x1c')][_0x553a('0x1f')]);logger[_0x553a('0x10')](_0x553a('0x1d'),_0x2acc0f,JSON[_0x553a('0x11')](_0x20ddcf));_0x68c178(_0x20ddcf);})[_0x553a('0x12')](function(_0xaf104b){logger[_0x553a('0x18')](_0x553a('0x1d'),_0xaf104b['message'],_0x2acc0f);_0x302c96(_0x21ebf4[_0x553a('0x18')](0x1f4,_0xaf104b[_0x553a('0x13')]));});});};exports[_0x553a('0x20')]=function(_0x45079d){var _0x53d662=this;return new Promise(function(_0x1f17ca,_0x2c1bdd){return db['CmHopper'][_0x553a('0x21')]({'where':_0x45079d[_0x553a('0x8')]?_0x45079d[_0x553a('0x8')][_0x553a('0x9')]||null:null})[_0x553a('0x17')](function(_0x4f7282){logger[_0x553a('0xf')](_0x553a('0x20'),_0x45079d);logger['debug'](_0x553a('0x20'),_0x45079d,JSON[_0x553a('0x11')](_0x4f7282));_0x1f17ca(_0x4f7282);})[_0x553a('0x12')](function(_0x560e7d){logger[_0x553a('0x18')](_0x553a('0x20'),_0x560e7d[_0x553a('0x13')],_0x45079d);_0x2c1bdd(_0x53d662[_0x553a('0x18')](0x1f4,_0x560e7d[_0x553a('0x13')]));});});};exports['GetContactDialer']=function(_0x2fafad){var _0x4d1e2f=this;return new Promise(function(_0x44b7eb,_0x363ec2){return db[_0x553a('0x22')][_0x553a('0x23')]()[_0x553a('0x17')](function(_0x26c736){return db[_0x553a('0x24')][_0x553a('0x25')](function(_0x282b2c){return db[_0x553a('0x6')][_0x553a('0x7')]({'where':_0x2fafad['options']?_0x2fafad[_0x553a('0x8')]['where']||null:null,'attributes':_0x2fafad['options']?_0x2fafad[_0x553a('0x8')]['attributes']||null:null,'limit':_0x2fafad[_0x553a('0x8')]?_0x2fafad[_0x553a('0x8')]['limit']||null:null,'order':_0x2fafad['options']?_0x2fafad[_0x553a('0x8')][_0x553a('0x26')]||null:null,'transaction':_0x282b2c,'lock':_0x282b2c[_0x553a('0x27')]['UPDATE'],'include':[{'model':db[_0x553a('0x22')],'as':_0x553a('0x28'),'attributes':_[_0x553a('0x29')](_0x26c736)},{'model':db[_0x553a('0x2a')],'as':_0x553a('0x2b'),'attributes':['id',_0x553a('0x2c'),_0x553a('0x2d')]}]})[_0x553a('0x17')](function(_0x457d85){var _0x5d50c3=[];var _0x2538fd=[];for(var _0x262db3=0x0;_0x262db3<_0x457d85[_0x553a('0x2e')];_0x262db3+=0x1){var _0x2f0a32=_0x457d85[_0x262db3][_0x553a('0x2f')];if(_0x2f0a32===null){_0x5d50c3['push'](_0x457d85[_0x262db3][_0x553a('0x1b')](_0x2fafad[_0x553a('0x1c')],{'transaction':_0x282b2c}));}else if(!_0x2538fd[_0x553a('0x30')](_0x2f0a32)){_0x2538fd['push'](_0x2f0a32);_0x5d50c3[_0x553a('0x31')](_0x457d85[_0x262db3][_0x553a('0x1b')](_0x2fafad[_0x553a('0x1c')],{'transaction':_0x282b2c}));}}return BPromise[_0x553a('0x32')](_0x5d50c3);});})['then'](function(_0x3e5a15){logger[_0x553a('0xf')](_0x553a('0x33'),_0x2fafad);if(_0x3e5a15[_0x553a('0x2e')]>0x0){logger[_0x553a('0xf')](_0x553a('0x34'),_0x3e5a15[0x0][_0x553a('0x35')]['id'],_0x3e5a15[0x0][_0x553a('0x35')][_0x553a('0x36')],_0x3e5a15[0x0][_0x553a('0x35')][_0x553a('0x1f')]);}logger[_0x553a('0x10')](_0x553a('0x33'),_0x2fafad,JSON[_0x553a('0x11')](_0x3e5a15));_0x44b7eb(_0x3e5a15);})[_0x553a('0x12')](function(_0x49deaf){logger['error']('GetContactDialer',_0x49deaf[_0x553a('0x13')],_0x2fafad);_0x363ec2(_0x4d1e2f[_0x553a('0x18')](0x1f4,_0x49deaf['message']));});});});};exports[_0x553a('0x37')]=function(_0x3549d1){var _0x4bc2c7=this;return new Promise(function(_0x535254,_0x52f2bf){return db[_0x553a('0x24')]['transaction'](function(_0x1cf95e){return db[_0x553a('0x38')][_0x553a('0x1a')](_0x3549d1['body'],{'raw':_0x3549d1[_0x553a('0x8')]?_0x3549d1['options']['raw']===undefined?!![]:![]:!![],'transaction':_0x1cf95e})[_0x553a('0x17')](function(){logger[_0x553a('0xf')]('MoveContactManagedDialer\x20hopper\x20options\x20[%s]\x20active\x20status\x20[%s]',JSON[_0x553a('0x11')](_0x3549d1[_0x553a('0x8')][_0x553a('0x9')]),_0x3549d1[_0x553a('0x8')]['where'][_0x553a('0x1f')]);return db[_0x553a('0x6')][_0x553a('0x21')]({'where':_0x3549d1[_0x553a('0x8')]?_0x3549d1[_0x553a('0x8')][_0x553a('0x9')]||null:null,'transaction':_0x1cf95e});});})[_0x553a('0x17')](function(_0x383fe6){logger['info'](_0x553a('0x37'),_0x3549d1);logger[_0x553a('0x10')](_0x553a('0x37'),_0x3549d1,JSON[_0x553a('0x11')](_0x383fe6));_0x535254(_0x383fe6);})[_0x553a('0x12')](function(_0x475fff){logger[_0x553a('0x18')](_0x553a('0x37'),_0x475fff[_0x553a('0x13')],_0x3549d1);_0x52f2bf(_0x4bc2c7[_0x553a('0x18')](0x1f4,_0x475fff[_0x553a('0x13')]));});});};exports['CountReScheduled']=function(_0x30235d){var _0x3454df=this;return new Promise(function(_0x33f640,_0x445325){return db['CmHopper'][_0x553a('0x7')]({'raw':_0x30235d['options']?_0x30235d[_0x553a('0x8')][_0x553a('0x16')]===undefined?!![]:![]:!![],'where':_0x30235d['options']?_0x30235d[_0x553a('0x8')][_0x553a('0x9')]||null:null,'attributes':[[db[_0x553a('0x24')]['fn'](_0x553a('0x39'),db[_0x553a('0x24')]['fn']('IF',db[_0x553a('0x24')][_0x553a('0x3a')](_0x553a('0x3b')+util[_0x553a('0x3c')](_0x553a('0x3d'),moment()[_0x553a('0x3c')]('YYYY-MM-DD\x20HH:mm:ss'))+_0x553a('0x3e')))),_0x553a('0x3f')]]})['then'](function(_0x29e11f){logger[_0x553a('0xf')]('CountReScheduled',_0x30235d);logger[_0x553a('0x10')]('CountReScheduled',_0x30235d,JSON[_0x553a('0x11')](_0x29e11f));_0x33f640(_0x29e11f);})[_0x553a('0x12')](function(_0x27c2e2){logger[_0x553a('0x18')]('CountReScheduled',_0x27c2e2[_0x553a('0x13')],_0x30235d);_0x445325(_0x3454df[_0x553a('0x18')](0x1f4,_0x27c2e2[_0x553a('0x13')]));});});};exports[_0x553a('0x40')]=function(_0x3b983d){var _0x5ea418=this;return new Promise(function(_0x2e849a,_0x2b41cf){return db[_0x553a('0x22')][_0x553a('0x23')]()[_0x553a('0x17')](function(){return db[_0x553a('0x24')]['transaction'](function(_0x4b1a62){return db[_0x553a('0x6')]['findAll']({'where':_0x3b983d[_0x553a('0x8')]?_0x3b983d[_0x553a('0x8')][_0x553a('0x9')]||null:null,'attributes':_0x3b983d[_0x553a('0x8')]?_0x3b983d[_0x553a('0x8')]['attributes']||null:null,'limit':0x1,'order':_0x3b983d[_0x553a('0x8')]?_0x3b983d[_0x553a('0x8')][_0x553a('0x26')]||null:null,'group':db['CmHopper']['UserId'],'transaction':_0x4b1a62,'lock':_0x4b1a62[_0x553a('0x27')][_0x553a('0x41')],'include':_0x3b983d[_0x553a('0x8')]?_0x3b983d[_0x553a('0x8')]['include']?_[_0x553a('0xd')](_0x3b983d[_0x553a('0x8')]['include'],function(_0x134117){return{'model':db[_0x134117[_0x553a('0xe')]],'as':_0x134117['as'],'attributes':_0x134117[_0x553a('0xa')],'include':_0x134117['include']?_[_0x553a('0xd')](_0x134117[_0x553a('0xc')],function(_0x2d1473){return{'model':db[_0x2d1473[_0x553a('0xe')]],'as':_0x2d1473['as'],'attributes':_0x2d1473['attributes'],'include':_0x2d1473['include']?_[_0x553a('0xd')](_0x2d1473[_0x553a('0xc')],function(_0x2155f1){return{'model':db[_0x2155f1[_0x553a('0xe')]],'as':_0x2155f1['as'],'attributes':_0x2155f1['attributes']};}):[]};}):[]};}):[]:[]})['then'](function(_0x160fe8){var _0x113aba=[];for(var _0x421f58=0x0;_0x421f58<_0x160fe8[_0x553a('0x2e')];_0x421f58+=0x1){_0x113aba[_0x553a('0x31')](_0x160fe8[_0x421f58][_0x553a('0x1b')](_0x3b983d['body'],{'transaction':_0x4b1a62}));}return BPromise[_0x553a('0x32')](_0x113aba);});})[_0x553a('0x17')](function(_0x3980b4){logger[_0x553a('0xf')](_0x553a('0x40'),_0x3b983d);logger[_0x553a('0x10')]('GetContactRecallMe',_0x3b983d,JSON[_0x553a('0x11')](_0x3980b4));_0x2e849a(_0x3980b4);})[_0x553a('0x12')](function(_0x1d744e){logger[_0x553a('0x18')](_0x553a('0x40'),_0x1d744e[_0x553a('0x13')],_0x3b983d);_0x2b41cf(_0x5ea418[_0x553a('0x18')](0x1f4,_0x1d744e['message']));});});});};exports[_0x553a('0x42')]=function(_0x405ef1){var _0x437418=this;return new Promise(function(_0x5d298a,_0x247907){db['CmContact'][_0x553a('0x23')]()[_0x553a('0x17')](function(_0x9e9c2a){return db['CmHopper']['findAll']({'raw':_0x405ef1['options']?_0x405ef1[_0x553a('0x8')][_0x553a('0x16')]===undefined?!![]:![]:!![],'where':_0x405ef1['options']?_0x405ef1[_0x553a('0x8')][_0x553a('0x9')]||null:null,'attributes':_0x405ef1[_0x553a('0x8')]?_0x405ef1['options']['attributes']||null:null,'limit':_0x405ef1[_0x553a('0x8')]?_0x405ef1[_0x553a('0x8')][_0x553a('0xb')]||null:null,'include':_0x405ef1[_0x553a('0x8')]?_0x405ef1[_0x553a('0x8')][_0x553a('0xc')]?_[_0x553a('0xd')](_0x405ef1[_0x553a('0x8')][_0x553a('0xc')],function(_0x122a06){return{'model':db[_0x122a06[_0x553a('0xe')]],'as':_0x122a06['as'],'attributes':_0x122a06['as']===_0x553a('0x28')?_[_0x553a('0x29')](_0x9e9c2a):_0x122a06[_0x553a('0xa')],'include':_0x122a06['include']?_[_0x553a('0xd')](_0x122a06[_0x553a('0xc')],function(_0x104303){return{'model':db[_0x104303[_0x553a('0xe')]],'as':_0x104303['as'],'attributes':_0x104303['attributes'],'include':_0x104303[_0x553a('0xc')]?_[_0x553a('0xd')](_0x104303['include'],function(_0x4cb182){return{'model':db[_0x4cb182['model']],'as':_0x4cb182['as'],'attributes':_0x4cb182[_0x553a('0xa')]};}):[]};}):[]};}):[]:[]})[_0x553a('0x17')](function(_0x52d92c){logger[_0x553a('0xf')]('GetCmHopper',_0x405ef1);logger['debug']('GetCmHopper',_0x405ef1,JSON[_0x553a('0x11')](_0x52d92c));_0x5d298a(_0x52d92c);})[_0x553a('0x12')](function(_0x2fa78e){logger[_0x553a('0x18')](_0x553a('0x5'),_0x2fa78e['message'],_0x405ef1);_0x247907(_0x437418[_0x553a('0x18')](0x1f4,_0x2fa78e[_0x553a('0x13')]));});});});};exports[_0x553a('0x43')]=function(_0x21cf4b){var _0x4146fd=this;return new Promise(function(_0x2c661f,_0x424a05){return db[_0x553a('0x22')][_0x553a('0x44')]({'raw':!![],'where':{'phone':_0x21cf4b[_0x553a('0x8')]['where'][_0x553a('0x45')]},'attributes':['id',_0x553a('0x46')],'order':[['id',_0x553a('0x47')]]})[_0x553a('0x17')](function(_0x273184){logger[_0x553a('0xf')](_0x553a('0x48'),_0x21cf4b);logger[_0x553a('0x10')](_0x553a('0x48'),_0x21cf4b,JSON[_0x553a('0x11')](_0x273184));_0x2c661f(_0x273184);})[_0x553a('0x12')](function(_0x46622d){logger[_0x553a('0x18')](_0x553a('0x48'),_0x46622d['message'],_0x21cf4b);_0x424a05(_0x4146fd[_0x553a('0x18')](0x1f4,_0x46622d[_0x553a('0x13')]));});});};exports['ResetActiveCalls']=function(_0x35742d){var _0xd866f3=this;return new Promise(function(_0x573515,_0x326058){return db[_0x553a('0x24')][_0x553a('0x25')](function(_0x457334){var _0x332d0d=_0x35742d['options']&&_0x35742d[_0x553a('0x8')][_0x553a('0x9')]?_0x35742d[_0x553a('0x8')][_0x553a('0x9')]:{};return db['CmHopper']['update'](_0x35742d[_0x553a('0x1c')],{'where':_0x332d0d,'transaction':_0x457334})[_0x553a('0x17')](function(_0xc116f0){logger[_0x553a('0xf')](_0x553a('0x49'),_0x35742d);logger[_0x553a('0x10')]('ResetActiveCalls',_0x35742d,JSON[_0x553a('0x11')](_0xc116f0));_0x573515(_0xc116f0);})[_0x553a('0x12')](function(_0x5ede27){logger[_0x553a('0x18')](_0x553a('0x49'),_0x5ede27[_0x553a('0x13')],_0x35742d);_0x326058(_0xd866f3[_0x553a('0x18')](0x1f4,_0x5ede27[_0x553a('0x13')]));});});});};exports[_0x553a('0x4a')]=function(_0x4e3885){var _0x5c0b0b=this;var _0x59de6b=_0x4e3885[_0x553a('0x1c')]['where']['voiceQueueIds'];var _0x2604af=_0x4e3885['body'][_0x553a('0x9')][_0x553a('0x4b')];var _0x4bd4c0=_0x4e3885['body'][_0x553a('0x9')][_0x553a('0x4c')];return new Promise(function(_0x100b49,_0x27d1e0){return db[_0x553a('0x6')][_0x553a('0x7')]({'where':{'voiceQueueId':{'$in':_0x59de6b},'recallme':0x1,'active':0x0,'recallmeNotifiedDate':{'$eq':null},'scheduledat':{'$and':{'$lte':db[_0x553a('0x24')][_0x553a('0x3a')](_0x553a('0x4d')+_0x2604af+_0x553a('0x4e')),'$gt':db[_0x553a('0x24')][_0x553a('0x3a')](_0x553a('0x4f'))}},'UserId':{'$in':_0x4bd4c0}},'include':[{'model':db['CmContact'],'as':_0x553a('0x28')},{'model':db[_0x553a('0x2a')],'as':_0x553a('0x2b'),'attributes':['id','name',_0x553a('0x2d')]},{'model':db[_0x553a('0x50')],'as':_0x553a('0x51')}]})[_0x553a('0x17')](function(_0x2c870e){if(_0x2c870e[_0x553a('0x2e')]>0x0){return db['sequelize'][_0x553a('0x25')](function(_0x532181){return db[_0x553a('0x6')][_0x553a('0x1b')]({'recallmeNotifiedDate':db[_0x553a('0x24')][_0x553a('0x3a')](_0x553a('0x4f'))},{'where':{'id':{'$in':_[_0x553a('0xd')](_0x2c870e,'id')}},'transaction':_0x532181})['then'](function(){_0x100b49(_0x2c870e);})[_0x553a('0x12')](function(_0x2461df){logger[_0x553a('0x18')](_0x553a('0x4a'),_0x2461df['message'],_0x4e3885);_0x27d1e0(_0x5c0b0b[_0x553a('0x18')](0x1f4,_0x2461df[_0x553a('0x13')]));});})[_0x553a('0x12')](function(_0x19bc83){logger[_0x553a('0x18')]('CmHopperHandlePreviewRecallNotifications',_0x19bc83[_0x553a('0x13')],_0x4e3885);_0x27d1e0(_0x5c0b0b[_0x553a('0x18')](0x1f4,_0x19bc83['message']));});}else{_0x100b49(_0x2c870e);}});});}; \ No newline at end of file diff --git a/server/api/cmHopper/index.js b/server/api/cmHopper/index.js index 5eea0ef..dd77be4 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 _0x2c50=['get','isAuthenticated','index','/describe','describe','getOpenContacts','getTimezones','show','/:id/previewrecall','post','create','/preview','getPreview','/timezone','getTimezone','/:id','delete','destroy','exports','express','Router','./cmHopper.controller'];(function(_0x54381d,_0x247b2c){var _0x5308a7=function(_0x3ef056){while(--_0x3ef056){_0x54381d['push'](_0x54381d['shift']());}};_0x5308a7(++_0x247b2c);}(_0x2c50,0x6b));var _0x02c5=function(_0x5756f8,_0x22b6d5){_0x5756f8=_0x5756f8-0x0;var _0x3bb749=_0x2c50[_0x5756f8];return _0x3bb749;};'use strict';var express=require(_0x02c5('0x0'));var router=express[_0x02c5('0x1')]();var auth=require('../../components/auth/service');var controller=require(_0x02c5('0x2'));router[_0x02c5('0x3')]('/',auth[_0x02c5('0x4')](),controller[_0x02c5('0x5')]);router[_0x02c5('0x3')](_0x02c5('0x6'),auth[_0x02c5('0x4')](),controller[_0x02c5('0x7')]);router[_0x02c5('0x3')]('/opencontacts',auth['isAuthenticated'](),controller[_0x02c5('0x8')]);router[_0x02c5('0x3')]('/timezones',auth[_0x02c5('0x4')](),controller[_0x02c5('0x9')]);router['get']('/:id',auth[_0x02c5('0x4')](),controller[_0x02c5('0xa')]);router['get'](_0x02c5('0xb'),auth['isAuthenticated'](),controller['getPreviewRecall']);router[_0x02c5('0xc')]('/',auth['isAuthenticated'](),controller[_0x02c5('0xd')]);router[_0x02c5('0xc')](_0x02c5('0xe'),auth[_0x02c5('0x4')](),controller[_0x02c5('0xf')]);router[_0x02c5('0xc')](_0x02c5('0x10'),auth[_0x02c5('0x4')](),controller[_0x02c5('0x11')]);router['put'](_0x02c5('0x12'),auth[_0x02c5('0x4')](),controller['update']);router[_0x02c5('0x13')]('/:id',auth[_0x02c5('0x4')](),controller[_0x02c5('0x14')]);module[_0x02c5('0x15')]=router; \ No newline at end of file +var _0xeed9=['/:id','show','/:id/previewrecall','getPreviewRecall','post','create','/preview','/timezone','getTimezone','put','update','delete','destroy','exports','express','Router','../../components/auth/service','./cmHopper.controller','index','get','/describe','isAuthenticated','/opencontacts','getOpenContacts','/timezones'];(function(_0xb66df,_0x4fb5ce){var _0x42a702=function(_0x252d1d){while(--_0x252d1d){_0xb66df['push'](_0xb66df['shift']());}};_0x42a702(++_0x4fb5ce);}(_0xeed9,0xef));var _0x9eed=function(_0x430f44,_0x4ae21b){_0x430f44=_0x430f44-0x0;var _0x1f6b0f=_0xeed9[_0x430f44];return _0x1f6b0f;};'use strict';var express=require(_0x9eed('0x0'));var router=express[_0x9eed('0x1')]();var auth=require(_0x9eed('0x2'));var controller=require(_0x9eed('0x3'));router['get']('/',auth['isAuthenticated'](),controller[_0x9eed('0x4')]);router[_0x9eed('0x5')](_0x9eed('0x6'),auth[_0x9eed('0x7')](),controller['describe']);router[_0x9eed('0x5')](_0x9eed('0x8'),auth[_0x9eed('0x7')](),controller[_0x9eed('0x9')]);router['get'](_0x9eed('0xa'),auth['isAuthenticated'](),controller['getTimezones']);router[_0x9eed('0x5')](_0x9eed('0xb'),auth['isAuthenticated'](),controller[_0x9eed('0xc')]);router['get'](_0x9eed('0xd'),auth[_0x9eed('0x7')](),controller[_0x9eed('0xe')]);router[_0x9eed('0xf')]('/',auth[_0x9eed('0x7')](),controller[_0x9eed('0x10')]);router[_0x9eed('0xf')](_0x9eed('0x11'),auth[_0x9eed('0x7')](),controller['getPreview']);router[_0x9eed('0xf')](_0x9eed('0x12'),auth[_0x9eed('0x7')](),controller[_0x9eed('0x13')]);router[_0x9eed('0x14')]('/:id',auth[_0x9eed('0x7')](),controller[_0x9eed('0x15')]);router[_0x9eed('0x16')](_0x9eed('0xb'),auth[_0x9eed('0x7')](),controller[_0x9eed('0x17')]);module[_0x9eed('0x18')]=router; \ No newline at end of file diff --git a/server/api/cmHopperAdditionalPhone/cmHopperAdditionalPhone.attributes.js b/server/api/cmHopperAdditionalPhone/cmHopperAdditionalPhone.attributes.js index 16214b9..dd8e26b 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 _0xc7c1=['INTEGER','moment','sequelize','exports','STRING','DATE','YYYY-MM-DD\x20HH:mm:ss'];(function(_0x25e7cb,_0x3579b7){var _0x375d92=function(_0xe8cf3b){while(--_0xe8cf3b){_0x25e7cb['push'](_0x25e7cb['shift']());}};_0x375d92(++_0x3579b7);}(_0xc7c1,0x71));var _0x1c7c=function(_0x40f2c5,_0x176356){_0x40f2c5=_0x40f2c5-0x0;var _0x540f58=_0xc7c1[_0x40f2c5];return _0x540f58;};'use strict';var moment=require(_0x1c7c('0x0'));var Sequelize=require(_0x1c7c('0x1'));module[_0x1c7c('0x2')]={'CmHopperId':{'type':Sequelize['INTEGER']},'phone':{'type':Sequelize[_0x1c7c('0x3')],'allowNull':![]},'OrderBy':{'type':Sequelize['INTEGER'],'defaultValue':0x0},'scheduledat':{'type':Sequelize[_0x1c7c('0x4')],'defaultValue':moment()['format'](_0x1c7c('0x5'))},'countbusyretry':{'type':Sequelize[_0x1c7c('0x6')],'defaultValue':0x0},'countcongestionretry':{'type':Sequelize[_0x1c7c('0x6')],'defaultValue':0x0},'countnoanswerretry':{'type':Sequelize['INTEGER'],'defaultValue':0x0},'countnosuchnumberretry':{'type':Sequelize[_0x1c7c('0x6')],'defaultValue':0x0},'countdropretry':{'type':Sequelize[_0x1c7c('0x6')],'defaultValue':0x0},'countabandonedretry':{'type':Sequelize[_0x1c7c('0x6')],'defaultValue':0x0},'countmachineretry':{'type':Sequelize[_0x1c7c('0x6')],'defaultValue':0x0},'countagentrejectretry':{'type':Sequelize[_0x1c7c('0x6')],'defaultValue':0x0}}; \ No newline at end of file +var _0xd84c=['INTEGER','STRING','DATE','format','YYYY-MM-DD\x20HH:mm:ss','sequelize','exports'];(function(_0x175f1b,_0x1a7de0){var _0x2da79a=function(_0x9a0ed7){while(--_0x9a0ed7){_0x175f1b['push'](_0x175f1b['shift']());}};_0x2da79a(++_0x1a7de0);}(_0xd84c,0xbb));var _0xcd84=function(_0x2c603b,_0x2e426f){_0x2c603b=_0x2c603b-0x0;var _0x5e1535=_0xd84c[_0x2c603b];return _0x5e1535;};'use strict';var moment=require('moment');var Sequelize=require(_0xcd84('0x0'));module[_0xcd84('0x1')]={'CmHopperId':{'type':Sequelize[_0xcd84('0x2')]},'phone':{'type':Sequelize[_0xcd84('0x3')],'allowNull':![]},'OrderBy':{'type':Sequelize[_0xcd84('0x2')],'defaultValue':0x0},'scheduledat':{'type':Sequelize[_0xcd84('0x4')],'defaultValue':moment()[_0xcd84('0x5')](_0xcd84('0x6'))},'countbusyretry':{'type':Sequelize[_0xcd84('0x2')],'defaultValue':0x0},'countcongestionretry':{'type':Sequelize['INTEGER'],'defaultValue':0x0},'countnoanswerretry':{'type':Sequelize[_0xcd84('0x2')],'defaultValue':0x0},'countnosuchnumberretry':{'type':Sequelize[_0xcd84('0x2')],'defaultValue':0x0},'countdropretry':{'type':Sequelize[_0xcd84('0x2')],'defaultValue':0x0},'countabandonedretry':{'type':Sequelize[_0xcd84('0x2')],'defaultValue':0x0},'countmachineretry':{'type':Sequelize[_0xcd84('0x2')],'defaultValue':0x0},'countagentrejectretry':{'type':Sequelize[_0xcd84('0x2')],'defaultValue':0x0}}; \ No newline at end of file diff --git a/server/api/cmHopperAdditionalPhone/cmHopperAdditionalPhone.controller.js b/server/api/cmHopperAdditionalPhone/cmHopperAdditionalPhone.controller.js index 4539b88..619ec1a 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 _0x333d=['apply','reject','save','update','destroy','then','get','CmHopperAdditionalPhones','UserProfileResource','name','send','index','map','rawAttributes','fieldName','key','query','keys','filters','intersection','model','attributes','fields','length','order','sort','where','filter','merge','type','VIRTUAL','options','includeAll','include','rows','catch','show','CmHopperAdditionalPhone','find','create','body','user','Unable\x20to\x20retrieve\x20the\x20current\x20user','UserProfileSection','userProfileId','autoAssociation','params','eml-format','rimraf','zip-dir','moment','bluebird','mustache','path','sox','fs-extra','squel','jsforce','desk.js','to-csv','querystring','papaparse','ioredis','../../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'];(function(_0x519e71,_0xa461fb){var _0x4b574a=function(_0x42f2ce){while(--_0x42f2ce){_0x519e71['push'](_0x519e71['shift']());}};_0x4b574a(++_0xa461fb);}(_0x333d,0xcd));var _0xd333=function(_0x1044e5,_0x498e01){_0x1044e5=_0x1044e5-0x0;var _0x5ad0dd=_0x333d[_0x1044e5];return _0x5ad0dd;};'use strict';var emlformat=require(_0xd333('0x0'));var rimraf=require(_0xd333('0x1'));var zipdir=require(_0xd333('0x2'));var jsonpatch=require('fast-json-patch');var rp=require('request-promise');var moment=require(_0xd333('0x3'));var BPromise=require(_0xd333('0x4'));var Mustache=require(_0xd333('0x5'));var util=require('util');var path=require(_0xd333('0x6'));var sox=require(_0xd333('0x7'));var csv=require('to-csv');var ejs=require('ejs');var fs=require('fs');var fs_extra=require(_0xd333('0x8'));var _=require('lodash');var squel=require(_0xd333('0x9'));var crypto=require('crypto');var jsforce=require(_0xd333('0xa'));var deskjs=require(_0xd333('0xb'));var toCsv=require(_0xd333('0xc'));var querystring=require(_0xd333('0xd'));var Papa=require(_0xd333('0xe'));var Redis=require(_0xd333('0xf'));var authService=require('../../components/auth/service');var qs=require('../../components/parsers/qs');var as=require(_0xd333('0x10'));var hardwareService=require(_0xd333('0x11'));var logger=require(_0xd333('0x12'))(_0xd333('0x13'));var utils=require('../../config/utils');var config=require(_0xd333('0x14'));var licenseUtil=require(_0xd333('0x15'));var db=require(_0xd333('0x16'))['db'];function respondWithStatusCode(_0x5739fe,_0x2f3953){_0x2f3953=_0x2f3953||0xcc;return function(_0x1a2fc1){if(_0x1a2fc1){return _0x5739fe[_0xd333('0x17')](_0x2f3953);}return _0x5739fe[_0xd333('0x18')](_0x2f3953)[_0xd333('0x19')]();};}function respondWithResult(_0x3af286,_0x13de39){_0x13de39=_0x13de39||0xc8;return function(_0x57c32b){if(_0x57c32b){return _0x3af286[_0xd333('0x18')](_0x13de39)[_0xd333('0x1a')](_0x57c32b);}};}function respondWithFilteredResult(_0x2f3ec1,_0x21308d){return function(_0x6c8fa7){if(_0x6c8fa7){var _0x12a5d6=typeof _0x21308d[_0xd333('0x1b')]===_0xd333('0x1c')&&typeof _0x21308d[_0xd333('0x1d')]===_0xd333('0x1c');var _0x4b55b6=_0x6c8fa7[_0xd333('0x1e')];var _0x2bd666=_0x12a5d6?0x0:_0x21308d[_0xd333('0x1b')];var _0x2dda84=_0x12a5d6?_0x6c8fa7['count']:_0x21308d['offset']+_0x21308d[_0xd333('0x1d')];var _0xf6a231;if(_0x2dda84>=_0x4b55b6){_0x2dda84=_0x4b55b6;_0xf6a231=0xc8;}else{_0xf6a231=0xce;}_0x2f3ec1[_0xd333('0x18')](_0xf6a231);return _0x2f3ec1['set'](_0xd333('0x1f'),_0x2bd666+'-'+_0x2dda84+'/'+_0x4b55b6)[_0xd333('0x1a')](_0x6c8fa7);}return null;};}function patchUpdates(_0xdc34d7){return function(_0x36b750){try{jsonpatch[_0xd333('0x20')](_0x36b750,_0xdc34d7,!![]);}catch(_0x7c5440){return BPromise[_0xd333('0x21')](_0x7c5440);}return _0x36b750[_0xd333('0x22')]();};}function saveUpdates(_0x521372,_0x390579){return function(_0x8f31ab){if(_0x8f31ab){return _0x8f31ab[_0xd333('0x23')](_0x521372)['then'](function(_0x27c5a5){return _0x27c5a5;});}return null;};}function removeEntity(_0x3336aa,_0x4d8919){return function(_0x37cc03){if(_0x37cc03){return _0x37cc03[_0xd333('0x24')]()[_0xd333('0x25')](function(){var _0x29232c=_0x37cc03[_0xd333('0x26')]({'plain':!![]});var _0x291ef2=_0xd333('0x27');return db[_0xd333('0x28')][_0xd333('0x24')]({'where':{'type':_0x291ef2,'resourceId':_0x29232c['id']}})[_0xd333('0x25')](function(){return _0x37cc03;});})[_0xd333('0x25')](function(){_0x3336aa[_0xd333('0x18')](0xcc)[_0xd333('0x19')]();});}};}function handleEntityNotFound(_0x276cdc,_0x5517d7){return function(_0x2bfe22){if(!_0x2bfe22){_0x276cdc[_0xd333('0x17')](0x194);}return _0x2bfe22;};}function handleError(_0x3f26b1,_0x3c1782){_0x3c1782=_0x3c1782||0x1f4;return function(_0x13a8b1){logger['error'](_0x13a8b1['stack']);if(_0x13a8b1[_0xd333('0x29')]){delete _0x13a8b1[_0xd333('0x29')];}_0x3f26b1[_0xd333('0x18')](_0x3c1782)[_0xd333('0x2a')](_0x13a8b1);};}exports[_0xd333('0x2b')]=function(_0x1fa0c5,_0x15a4ec){var _0xe6827e={},_0x411e7a={},_0x52e04c={'count':0x0,'rows':[]};var _0x27e70a=_[_0xd333('0x2c')](db['CmHopperAdditionalPhone'][_0xd333('0x2d')],function(_0x5a9e6d){return{'name':_0x5a9e6d[_0xd333('0x2e')],'type':_0x5a9e6d['type'][_0xd333('0x2f')]};});_0x411e7a['model']=_[_0xd333('0x2c')](_0x27e70a,_0xd333('0x29'));_0x411e7a[_0xd333('0x30')]=_[_0xd333('0x31')](_0x1fa0c5[_0xd333('0x30')]);_0x411e7a[_0xd333('0x32')]=_[_0xd333('0x33')](_0x411e7a[_0xd333('0x34')],_0x411e7a[_0xd333('0x30')]);_0xe6827e[_0xd333('0x35')]=_['intersection'](_0x411e7a[_0xd333('0x34')],qs[_0xd333('0x36')](_0x1fa0c5[_0xd333('0x30')][_0xd333('0x36')]));_0xe6827e['attributes']=_0xe6827e['attributes'][_0xd333('0x37')]?_0xe6827e[_0xd333('0x35')]:_0x411e7a[_0xd333('0x34')];if(!_0x1fa0c5[_0xd333('0x30')]['hasOwnProperty']('nolimit')){_0xe6827e[_0xd333('0x1d')]=qs[_0xd333('0x1d')](_0x1fa0c5[_0xd333('0x30')][_0xd333('0x1d')]);_0xe6827e['offset']=qs[_0xd333('0x1b')](_0x1fa0c5[_0xd333('0x30')][_0xd333('0x1b')]);}_0xe6827e[_0xd333('0x38')]=qs[_0xd333('0x39')](_0x1fa0c5['query'][_0xd333('0x39')]);_0xe6827e[_0xd333('0x3a')]=qs[_0xd333('0x32')](_['pick'](_0x1fa0c5[_0xd333('0x30')],_0x411e7a[_0xd333('0x32')]),_0x27e70a);if(_0x1fa0c5['query'][_0xd333('0x3b')]){_0xe6827e[_0xd333('0x3a')]=_[_0xd333('0x3c')](_0xe6827e['where'],{'$or':_['map'](_0x27e70a,function(_0x2f3cad){if(_0x2f3cad[_0xd333('0x3d')]!==_0xd333('0x3e')){var _0x43aa43={};_0x43aa43[_0x2f3cad[_0xd333('0x29')]]={'$like':'%'+_0x1fa0c5[_0xd333('0x30')][_0xd333('0x3b')]+'%'};return _0x43aa43;}})});}_0xe6827e=_[_0xd333('0x3c')]({},_0xe6827e,_0x1fa0c5[_0xd333('0x3f')]);var _0x12cc73={'where':_0xe6827e['where']};return db['CmHopperAdditionalPhone'][_0xd333('0x1e')](_0x12cc73)['then'](function(_0x5f1d0c){_0x52e04c[_0xd333('0x1e')]=_0x5f1d0c;if(_0x1fa0c5[_0xd333('0x30')][_0xd333('0x40')]){_0xe6827e[_0xd333('0x41')]=[{'all':!![]}];}return db['CmHopperAdditionalPhone']['findAll'](_0xe6827e);})[_0xd333('0x25')](function(_0xc2fc2b){_0x52e04c[_0xd333('0x42')]=_0xc2fc2b;return _0x52e04c;})[_0xd333('0x25')](respondWithFilteredResult(_0x15a4ec,_0xe6827e))[_0xd333('0x43')](handleError(_0x15a4ec,null));};exports[_0xd333('0x44')]=function(_0x1a82a8,_0x973892){var _0x371e2e={'raw':!![],'where':{'id':_0x1a82a8['params']['id']}},_0x5a1f0a={};_0x5a1f0a[_0xd333('0x34')]=_['keys'](db[_0xd333('0x45')]['rawAttributes']);_0x5a1f0a[_0xd333('0x30')]=_[_0xd333('0x31')](_0x1a82a8[_0xd333('0x30')]);_0x5a1f0a[_0xd333('0x32')]=_[_0xd333('0x33')](_0x5a1f0a['model'],_0x5a1f0a[_0xd333('0x30')]);_0x371e2e[_0xd333('0x35')]=_['intersection'](_0x5a1f0a[_0xd333('0x34')],qs[_0xd333('0x36')](_0x1a82a8[_0xd333('0x30')]['fields']));_0x371e2e[_0xd333('0x35')]=_0x371e2e[_0xd333('0x35')][_0xd333('0x37')]?_0x371e2e['attributes']:_0x5a1f0a[_0xd333('0x34')];if(_0x1a82a8[_0xd333('0x30')][_0xd333('0x40')]){_0x371e2e['include']=[{'all':!![]}];}_0x371e2e=_[_0xd333('0x3c')]({},_0x371e2e,_0x1a82a8['options']);return db[_0xd333('0x45')][_0xd333('0x46')](_0x371e2e)['then'](handleEntityNotFound(_0x973892,null))['then'](respondWithResult(_0x973892,null))['catch'](handleError(_0x973892,null));};exports['create']=function(_0x45de4f,_0x406748){return db['CmHopperAdditionalPhone'][_0xd333('0x47')](_0x45de4f[_0xd333('0x48')],{})[_0xd333('0x25')](function(_0x141510){var _0x4a9da8=_0x45de4f[_0xd333('0x49')][_0xd333('0x26')]({'plain':!![]});if(!_0x4a9da8)throw new Error(_0xd333('0x4a'));if(_0x4a9da8['role']===_0xd333('0x49')){var _0x8dbd24=_0x141510[_0xd333('0x26')]({'plain':!![]});var _0x458272=_0xd333('0x27');return db[_0xd333('0x4b')][_0xd333('0x46')]({'where':{'name':_0x458272,'userProfileId':_0x4a9da8[_0xd333('0x4c')]},'raw':!![]})[_0xd333('0x25')](function(_0x2bb233){if(_0x2bb233&&_0x2bb233[_0xd333('0x4d')]===0x0){return db[_0xd333('0x28')][_0xd333('0x47')]({'name':_0x8dbd24[_0xd333('0x29')],'resourceId':_0x8dbd24['id'],'type':_0x2bb233[_0xd333('0x29')],'sectionId':_0x2bb233['id']},{})[_0xd333('0x25')](function(){return _0x141510;});}else{return _0x141510;}})[_0xd333('0x43')](function(_0x24307d){logger['error']('Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s',_0x24307d);throw _0x24307d;});}return _0x141510;})[_0xd333('0x25')](respondWithResult(_0x406748,0xc9))[_0xd333('0x43')](handleError(_0x406748,null));};exports[_0xd333('0x23')]=function(_0x5619c3,_0x122789){if(_0x5619c3[_0xd333('0x48')]['id']){delete _0x5619c3[_0xd333('0x48')]['id'];}return db[_0xd333('0x45')][_0xd333('0x46')]({'where':{'id':_0x5619c3[_0xd333('0x4e')]['id']}})[_0xd333('0x25')](handleEntityNotFound(_0x122789,null))['then'](saveUpdates(_0x5619c3[_0xd333('0x48')],null))[_0xd333('0x25')](respondWithResult(_0x122789,null))[_0xd333('0x43')](handleError(_0x122789,null));};exports['destroy']=function(_0x55e2de,_0x3a50b3){return db[_0xd333('0x45')][_0xd333('0x46')]({'where':{'id':_0x55e2de[_0xd333('0x4e')]['id']}})[_0xd333('0x25')](handleEntityNotFound(_0x3a50b3,null))[_0xd333('0x25')](removeEntity(_0x3a50b3,null))[_0xd333('0x43')](handleError(_0x3a50b3,null));}; \ No newline at end of file +var _0x4ebb=['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','sendStatus','end','json','undefined','count','offset','limit','status','set','apply','save','update','then','destroy','get','CmHopperAdditionalPhones','UserProfileResource','name','map','CmHopperAdditionalPhone','rawAttributes','fieldName','type','model','query','keys','filters','intersection','attributes','fields','nolimit','order','sort','where','pick','merge','VIRTUAL','filter','options','includeAll','include','findAll','rows','catch','show','create','body','Unable\x20to\x20retrieve\x20the\x20current\x20user','role','user','UserProfileSection','error','find','params','eml-format','zip-dir','request-promise','moment','bluebird','mustache','util','path','sox','to-csv','ejs'];(function(_0x122096,_0x60c295){var _0x3d1966=function(_0x3d569e){while(--_0x3d569e){_0x122096['push'](_0x122096['shift']());}};_0x3d1966(++_0x60c295);}(_0x4ebb,0x93));var _0xb4eb=function(_0x3ff24c,_0x331333){_0x3ff24c=_0x3ff24c-0x0;var _0x5a46a6=_0x4ebb[_0x3ff24c];return _0x5a46a6;};'use strict';var emlformat=require(_0xb4eb('0x0'));var rimraf=require('rimraf');var zipdir=require(_0xb4eb('0x1'));var jsonpatch=require('fast-json-patch');var rp=require(_0xb4eb('0x2'));var moment=require(_0xb4eb('0x3'));var BPromise=require(_0xb4eb('0x4'));var Mustache=require(_0xb4eb('0x5'));var util=require(_0xb4eb('0x6'));var path=require(_0xb4eb('0x7'));var sox=require(_0xb4eb('0x8'));var csv=require(_0xb4eb('0x9'));var ejs=require(_0xb4eb('0xa'));var fs=require('fs');var fs_extra=require(_0xb4eb('0xb'));var _=require('lodash');var squel=require(_0xb4eb('0xc'));var crypto=require('crypto');var jsforce=require('jsforce');var deskjs=require(_0xb4eb('0xd'));var toCsv=require(_0xb4eb('0x9'));var querystring=require(_0xb4eb('0xe'));var Papa=require(_0xb4eb('0xf'));var Redis=require(_0xb4eb('0x10'));var authService=require(_0xb4eb('0x11'));var qs=require(_0xb4eb('0x12'));var as=require(_0xb4eb('0x13'));var hardwareService=require('../../config/license/hardware');var logger=require(_0xb4eb('0x14'))(_0xb4eb('0x15'));var utils=require(_0xb4eb('0x16'));var config=require(_0xb4eb('0x17'));var licenseUtil=require('../../config/license/util');var db=require(_0xb4eb('0x18'))['db'];function respondWithStatusCode(_0x445410,_0x339605){_0x339605=_0x339605||0xcc;return function(_0x5f0a02){if(_0x5f0a02){return _0x445410[_0xb4eb('0x19')](_0x339605);}return _0x445410['status'](_0x339605)[_0xb4eb('0x1a')]();};}function respondWithResult(_0x411a70,_0x4f9662){_0x4f9662=_0x4f9662||0xc8;return function(_0x2725b4){if(_0x2725b4){return _0x411a70['status'](_0x4f9662)[_0xb4eb('0x1b')](_0x2725b4);}};}function respondWithFilteredResult(_0xa714d8,_0x3ecbba){return function(_0x42ecb4){if(_0x42ecb4){var _0x59ccf9=typeof _0x3ecbba['offset']===_0xb4eb('0x1c')&&typeof _0x3ecbba['limit']===_0xb4eb('0x1c');var _0xef8a65=_0x42ecb4[_0xb4eb('0x1d')];var _0x50ab89=_0x59ccf9?0x0:_0x3ecbba[_0xb4eb('0x1e')];var _0x4df89d=_0x59ccf9?_0x42ecb4[_0xb4eb('0x1d')]:_0x3ecbba[_0xb4eb('0x1e')]+_0x3ecbba[_0xb4eb('0x1f')];var _0x252a90;if(_0x4df89d>=_0xef8a65){_0x4df89d=_0xef8a65;_0x252a90=0xc8;}else{_0x252a90=0xce;}_0xa714d8[_0xb4eb('0x20')](_0x252a90);return _0xa714d8[_0xb4eb('0x21')]('Content-Range',_0x50ab89+'-'+_0x4df89d+'/'+_0xef8a65)[_0xb4eb('0x1b')](_0x42ecb4);}return null;};}function patchUpdates(_0x183d6d){return function(_0x56fbb0){try{jsonpatch[_0xb4eb('0x22')](_0x56fbb0,_0x183d6d,!![]);}catch(_0x52cf0e){return BPromise['reject'](_0x52cf0e);}return _0x56fbb0[_0xb4eb('0x23')]();};}function saveUpdates(_0x2e6de0,_0x1ee260){return function(_0x382af7){if(_0x382af7){return _0x382af7[_0xb4eb('0x24')](_0x2e6de0)[_0xb4eb('0x25')](function(_0xae3645){return _0xae3645;});}return null;};}function removeEntity(_0x310b80,_0x57b673){return function(_0x1bf67f){if(_0x1bf67f){return _0x1bf67f[_0xb4eb('0x26')]()['then'](function(){var _0x4c726b=_0x1bf67f[_0xb4eb('0x27')]({'plain':!![]});var _0x2d628d=_0xb4eb('0x28');return db[_0xb4eb('0x29')]['destroy']({'where':{'type':_0x2d628d,'resourceId':_0x4c726b['id']}})[_0xb4eb('0x25')](function(){return _0x1bf67f;});})[_0xb4eb('0x25')](function(){_0x310b80[_0xb4eb('0x20')](0xcc)[_0xb4eb('0x1a')]();});}};}function handleEntityNotFound(_0x20f681,_0x48dae0){return function(_0x475ec3){if(!_0x475ec3){_0x20f681[_0xb4eb('0x19')](0x194);}return _0x475ec3;};}function handleError(_0x5d787c,_0x39ed15){_0x39ed15=_0x39ed15||0x1f4;return function(_0x2e7b28){logger['error'](_0x2e7b28['stack']);if(_0x2e7b28[_0xb4eb('0x2a')]){delete _0x2e7b28[_0xb4eb('0x2a')];}_0x5d787c[_0xb4eb('0x20')](_0x39ed15)['send'](_0x2e7b28);};}exports['index']=function(_0x527afc,_0x14d3e5){var _0x4dcc90={},_0x41c8d8={},_0x4e8d90={'count':0x0,'rows':[]};var _0x280371=_[_0xb4eb('0x2b')](db[_0xb4eb('0x2c')][_0xb4eb('0x2d')],function(_0x22adef){return{'name':_0x22adef[_0xb4eb('0x2e')],'type':_0x22adef[_0xb4eb('0x2f')]['key']};});_0x41c8d8[_0xb4eb('0x30')]=_[_0xb4eb('0x2b')](_0x280371,_0xb4eb('0x2a'));_0x41c8d8[_0xb4eb('0x31')]=_[_0xb4eb('0x32')](_0x527afc['query']);_0x41c8d8[_0xb4eb('0x33')]=_[_0xb4eb('0x34')](_0x41c8d8[_0xb4eb('0x30')],_0x41c8d8[_0xb4eb('0x31')]);_0x4dcc90[_0xb4eb('0x35')]=_['intersection'](_0x41c8d8[_0xb4eb('0x30')],qs[_0xb4eb('0x36')](_0x527afc[_0xb4eb('0x31')]['fields']));_0x4dcc90[_0xb4eb('0x35')]=_0x4dcc90[_0xb4eb('0x35')]['length']?_0x4dcc90[_0xb4eb('0x35')]:_0x41c8d8[_0xb4eb('0x30')];if(!_0x527afc[_0xb4eb('0x31')]['hasOwnProperty'](_0xb4eb('0x37'))){_0x4dcc90['limit']=qs[_0xb4eb('0x1f')](_0x527afc['query'][_0xb4eb('0x1f')]);_0x4dcc90['offset']=qs[_0xb4eb('0x1e')](_0x527afc[_0xb4eb('0x31')][_0xb4eb('0x1e')]);}_0x4dcc90[_0xb4eb('0x38')]=qs['sort'](_0x527afc['query'][_0xb4eb('0x39')]);_0x4dcc90[_0xb4eb('0x3a')]=qs[_0xb4eb('0x33')](_[_0xb4eb('0x3b')](_0x527afc[_0xb4eb('0x31')],_0x41c8d8[_0xb4eb('0x33')]),_0x280371);if(_0x527afc[_0xb4eb('0x31')]['filter']){_0x4dcc90[_0xb4eb('0x3a')]=_[_0xb4eb('0x3c')](_0x4dcc90[_0xb4eb('0x3a')],{'$or':_['map'](_0x280371,function(_0x4386d3){if(_0x4386d3[_0xb4eb('0x2f')]!==_0xb4eb('0x3d')){var _0x58a1ca={};_0x58a1ca[_0x4386d3[_0xb4eb('0x2a')]]={'$like':'%'+_0x527afc[_0xb4eb('0x31')][_0xb4eb('0x3e')]+'%'};return _0x58a1ca;}})});}_0x4dcc90=_[_0xb4eb('0x3c')]({},_0x4dcc90,_0x527afc[_0xb4eb('0x3f')]);var _0x451659={'where':_0x4dcc90[_0xb4eb('0x3a')]};return db['CmHopperAdditionalPhone'][_0xb4eb('0x1d')](_0x451659)[_0xb4eb('0x25')](function(_0x26364d){_0x4e8d90['count']=_0x26364d;if(_0x527afc[_0xb4eb('0x31')][_0xb4eb('0x40')]){_0x4dcc90[_0xb4eb('0x41')]=[{'all':!![]}];}return db[_0xb4eb('0x2c')][_0xb4eb('0x42')](_0x4dcc90);})[_0xb4eb('0x25')](function(_0x26284f){_0x4e8d90[_0xb4eb('0x43')]=_0x26284f;return _0x4e8d90;})[_0xb4eb('0x25')](respondWithFilteredResult(_0x14d3e5,_0x4dcc90))[_0xb4eb('0x44')](handleError(_0x14d3e5,null));};exports[_0xb4eb('0x45')]=function(_0x337861,_0x50649d){var _0x2e429d={'raw':!![],'where':{'id':_0x337861['params']['id']}},_0x293e75={};_0x293e75[_0xb4eb('0x30')]=_[_0xb4eb('0x32')](db[_0xb4eb('0x2c')][_0xb4eb('0x2d')]);_0x293e75[_0xb4eb('0x31')]=_[_0xb4eb('0x32')](_0x337861['query']);_0x293e75[_0xb4eb('0x33')]=_[_0xb4eb('0x34')](_0x293e75[_0xb4eb('0x30')],_0x293e75[_0xb4eb('0x31')]);_0x2e429d['attributes']=_[_0xb4eb('0x34')](_0x293e75['model'],qs[_0xb4eb('0x36')](_0x337861['query'][_0xb4eb('0x36')]));_0x2e429d[_0xb4eb('0x35')]=_0x2e429d['attributes']['length']?_0x2e429d[_0xb4eb('0x35')]:_0x293e75[_0xb4eb('0x30')];if(_0x337861['query'][_0xb4eb('0x40')]){_0x2e429d[_0xb4eb('0x41')]=[{'all':!![]}];}_0x2e429d=_[_0xb4eb('0x3c')]({},_0x2e429d,_0x337861[_0xb4eb('0x3f')]);return db[_0xb4eb('0x2c')]['find'](_0x2e429d)['then'](handleEntityNotFound(_0x50649d,null))['then'](respondWithResult(_0x50649d,null))[_0xb4eb('0x44')](handleError(_0x50649d,null));};exports[_0xb4eb('0x46')]=function(_0x12eb40,_0x1dbe0d){return db[_0xb4eb('0x2c')]['create'](_0x12eb40[_0xb4eb('0x47')],{})['then'](function(_0x6fb5c6){var _0x694beb=_0x12eb40['user'][_0xb4eb('0x27')]({'plain':!![]});if(!_0x694beb)throw new Error(_0xb4eb('0x48'));if(_0x694beb[_0xb4eb('0x49')]===_0xb4eb('0x4a')){var _0x1de778=_0x6fb5c6['get']({'plain':!![]});var _0x340d90=_0xb4eb('0x28');return db[_0xb4eb('0x4b')]['find']({'where':{'name':_0x340d90,'userProfileId':_0x694beb['userProfileId']},'raw':!![]})[_0xb4eb('0x25')](function(_0x57f24a){if(_0x57f24a&&_0x57f24a['autoAssociation']===0x0){return db[_0xb4eb('0x29')][_0xb4eb('0x46')]({'name':_0x1de778['name'],'resourceId':_0x1de778['id'],'type':_0x57f24a[_0xb4eb('0x2a')],'sectionId':_0x57f24a['id']},{})[_0xb4eb('0x25')](function(){return _0x6fb5c6;});}else{return _0x6fb5c6;}})[_0xb4eb('0x44')](function(_0x2cdf70){logger[_0xb4eb('0x4c')]('Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s',_0x2cdf70);throw _0x2cdf70;});}return _0x6fb5c6;})[_0xb4eb('0x25')](respondWithResult(_0x1dbe0d,0xc9))['catch'](handleError(_0x1dbe0d,null));};exports[_0xb4eb('0x24')]=function(_0x540a88,_0x5be935){if(_0x540a88['body']['id']){delete _0x540a88[_0xb4eb('0x47')]['id'];}return db[_0xb4eb('0x2c')][_0xb4eb('0x4d')]({'where':{'id':_0x540a88[_0xb4eb('0x4e')]['id']}})[_0xb4eb('0x25')](handleEntityNotFound(_0x5be935,null))['then'](saveUpdates(_0x540a88[_0xb4eb('0x47')],null))[_0xb4eb('0x25')](respondWithResult(_0x5be935,null))[_0xb4eb('0x44')](handleError(_0x5be935,null));};exports[_0xb4eb('0x26')]=function(_0x16b7b7,_0x5e49b1){return db[_0xb4eb('0x2c')][_0xb4eb('0x4d')]({'where':{'id':_0x16b7b7[_0xb4eb('0x4e')]['id']}})['then'](handleEntityNotFound(_0x5e49b1,null))[_0xb4eb('0x25')](removeEntity(_0x5e49b1,null))[_0xb4eb('0x44')](handleError(_0x5e49b1,null));}; \ No newline at end of file diff --git a/server/api/cmHopperAdditionalPhone/cmHopperAdditionalPhone.model.js b/server/api/cmHopperAdditionalPhone/cmHopperAdditionalPhone.model.js index 7612398..84d80c7 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 _0xafbf=['define','CmHopperAdditionalPhone','util','api','moment','bluebird','request-promise','path','./cmHopperAdditionalPhone.attributes'];(function(_0x5f4251,_0x496e5e){var _0xc118ea=function(_0x42c2c1){while(--_0x42c2c1){_0x5f4251['push'](_0x5f4251['shift']());}};_0xc118ea(++_0x496e5e);}(_0xafbf,0x65));var _0xfafb=function(_0x501510,_0x61caa9){_0x501510=_0x501510-0x0;var _0x1e6ee5=_0xafbf[_0x501510];return _0x1e6ee5;};'use strict';var _=require('lodash');var util=require(_0xfafb('0x0'));var logger=require('../../config/logger')(_0xfafb('0x1'));var moment=require(_0xfafb('0x2'));var BPromise=require(_0xfafb('0x3'));var rp=require(_0xfafb('0x4'));var fs=require('fs');var path=require(_0xfafb('0x5'));var rimraf=require('rimraf');var config=require('../../config/environment');var attributes=require(_0xfafb('0x6'));module['exports']=function(_0x4190db,_0x715fa7){return _0x4190db[_0xfafb('0x7')](_0xfafb('0x8'),attributes,{'tableName':'cm_hopper_additional_phones','paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0xef45=['api','path','rimraf','../../config/environment','exports','define','cm_hopper_additional_phones','lodash','util','../../config/logger'];(function(_0x42bafd,_0x3f0fe3){var _0x2ed705=function(_0x4311ea){while(--_0x4311ea){_0x42bafd['push'](_0x42bafd['shift']());}};_0x2ed705(++_0x3f0fe3);}(_0xef45,0xe3));var _0x5ef4=function(_0x36d076,_0x22236b){_0x36d076=_0x36d076-0x0;var _0x28f58e=_0xef45[_0x36d076];return _0x28f58e;};'use strict';var _=require(_0x5ef4('0x0'));var util=require(_0x5ef4('0x1'));var logger=require(_0x5ef4('0x2'))(_0x5ef4('0x3'));var moment=require('moment');var BPromise=require('bluebird');var rp=require('request-promise');var fs=require('fs');var path=require(_0x5ef4('0x4'));var rimraf=require(_0x5ef4('0x5'));var config=require(_0x5ef4('0x6'));var attributes=require('./cmHopperAdditionalPhone.attributes');module[_0x5ef4('0x7')]=function(_0x3bd46c,_0x95d6d9){return _0x3bd46c[_0x5ef4('0x8')]('CmHopperAdditionalPhone',attributes,{'tableName':_0x5ef4('0x9'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/cmHopperAdditionalPhone/cmHopperAdditionalPhone.rpc.js b/server/api/cmHopperAdditionalPhone/cmHopperAdditionalPhone.rpc.js index 028c88a..0542685 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 _0xd0fb=['body','ContactId','ListId','VoiceQueueId','findOne','OrderBy','ASC','countbusyretry','countcongestionretry','countnoanswerretry','countdropretry','countmachineretry','entity','CmHopperAdditionalPhone','countnosuchnumberretry','dialGlobalMaxRetry','SwapAdditionalPhones','CampaignId','duration','waitTime','isNil','scheduledat','add','minutes','phone','countagentrejectretry','createdAt','updatedAt','countabandonedretry','transaction','update','IncrementPreviewCounters','lodash','util','bluebird','randomstring','ioredis','../../config/utils','../../config/logger','http','then','info','CmHopperAdditionalPhone,\x20%s,\x20%s','request\x20sent','debug','stringify','error','code','message','result','catch','VerifyAdditionalPhones','CmHopper'];(function(_0x1a4f3a,_0xb3342e){var _0x2131c7=function(_0x3d19fc){while(--_0x3d19fc){_0x1a4f3a['push'](_0x1a4f3a['shift']());}};_0x2131c7(++_0xb3342e);}(_0xd0fb,0x193));var _0xbd0f=function(_0x3d86c3,_0x38db0a){_0x3d86c3=_0x3d86c3-0x0;var _0x36d8a7=_0xd0fb[_0x3d86c3];return _0x36d8a7;};'use strict';var _=require(_0xbd0f('0x0'));var util=require(_0xbd0f('0x1'));var moment=require('moment');var BPromise=require(_0xbd0f('0x2'));var rs=require(_0xbd0f('0x3'));var fs=require('fs');var Redis=require(_0xbd0f('0x4'));var db=require('../../mysqldb')['db'];var utils=require(_0xbd0f('0x5'));var logger=require(_0xbd0f('0x6'))('rpc');var config=require('../../config/environment');var jayson=require('jayson/promise');var client=jayson['client'][_0xbd0f('0x7')]({'port':0x232a});function respondWithRpcPromise(_0x3639f0,_0x43a4e7,_0x449301){return new BPromise(function(_0x2bb10a,_0x4480bf){return client['request'](_0x3639f0,_0x449301)[_0xbd0f('0x8')](function(_0x14bbc0){logger[_0xbd0f('0x9')](_0xbd0f('0xa'),_0x43a4e7,_0xbd0f('0xb'));logger[_0xbd0f('0xc')]('CmHopperAdditionalPhone,\x20%s,\x20%s,\x20%s',_0x43a4e7,_0xbd0f('0xb'),JSON[_0xbd0f('0xd')](_0x14bbc0));if(_0x14bbc0[_0xbd0f('0xe')]){if(_0x14bbc0['error'][_0xbd0f('0xf')]===0x1f4){logger[_0xbd0f('0xe')](_0xbd0f('0xa'),_0x43a4e7,_0x14bbc0['error'][_0xbd0f('0x10')]);return _0x4480bf(_0x14bbc0[_0xbd0f('0xe')][_0xbd0f('0x10')]);}logger['error']('CmHopperAdditionalPhone,\x20%s,\x20%s',_0x43a4e7,_0x14bbc0[_0xbd0f('0xe')][_0xbd0f('0x10')]);return _0x2bb10a(_0x14bbc0[_0xbd0f('0xe')][_0xbd0f('0x10')]);}else{logger[_0xbd0f('0x9')]('CmHopperAdditionalPhone,\x20%s,\x20%s',_0x43a4e7,'request\x20sent');_0x2bb10a(_0x14bbc0[_0xbd0f('0x11')][_0xbd0f('0x10')]);}})[_0xbd0f('0x12')](function(_0x426d01){logger['error'](_0xbd0f('0xa'),_0x43a4e7,_0x426d01);_0x4480bf(_0x426d01);});});}exports[_0xbd0f('0x13')]=function(_0x90514a){var _0x35f08b=this;return new Promise(function(_0x48a939,_0x108e72){return db[_0xbd0f('0x14')]['findOne']({'raw':!![],'where':{'ContactId':_0x90514a[_0xbd0f('0x15')][_0xbd0f('0x16')],'ListId':_0x90514a[_0xbd0f('0x15')][_0xbd0f('0x17')],'VoiceQueueId':_0x90514a['body']['VoiceQueueId']===undefined?null:_0x90514a[_0xbd0f('0x15')][_0xbd0f('0x18')],'CampaignId':_0x90514a[_0xbd0f('0x15')]['CampaignId']===undefined?null:_0x90514a[_0xbd0f('0x15')]['CampaignId']}})[_0xbd0f('0x8')](function(_0x24303e){if(_0x24303e!=null){return db['CmHopperAdditionalPhone'][_0xbd0f('0x19')]({'raw':!![],'where':{'CmHopperId':_0x24303e['id'],'OrderBy':{'$gt':_0x24303e[_0xbd0f('0x1a')]}},'order':[[_0xbd0f('0x1a'),_0xbd0f('0x1b')]]})[_0xbd0f('0x8')](function(_0x50238f){var _0x452296=0x0;if(_0x50238f){if(_0x50238f[_0xbd0f('0x1c')]+_0x50238f[_0xbd0f('0x1d')]+_0x50238f[_0xbd0f('0x1e')]+_0x50238f['countnosuchnumberretry']+_0x50238f[_0xbd0f('0x1f')]+_0x50238f['countabandonedretry']+_0x50238f[_0xbd0f('0x20')]+_0x50238f['countagentrejectretry']<_0x90514a[_0xbd0f('0x21')]['dialGlobalMaxRetry'])_0x452296=0x1;_0x48a939({'additional':_0x452296});}else{return db[_0xbd0f('0x22')][_0xbd0f('0x19')]({'raw':!![],'where':{'CmHopperId':_0x24303e['id']},'order':[[_0xbd0f('0x1a'),_0xbd0f('0x1b')]]})[_0xbd0f('0x8')](function(_0x1e7d49){var _0xfa54b1=0x0;if(_0x1e7d49){if(_0x1e7d49[_0xbd0f('0x1c')]+_0x1e7d49[_0xbd0f('0x1d')]+_0x1e7d49[_0xbd0f('0x1e')]+_0x1e7d49[_0xbd0f('0x23')]+_0x1e7d49['countdropretry']+_0x1e7d49['countabandonedretry']+_0x1e7d49[_0xbd0f('0x20')]+_0x1e7d49['countagentrejectretry']<_0x90514a['entity'][_0xbd0f('0x24')])_0xfa54b1=0x1;_0x48a939({'additional':_0xfa54b1});}else{_0x48a939({'additional':0x0});}})[_0xbd0f('0x12')](function(_0x166417){logger[_0xbd0f('0xe')](_0xbd0f('0x13'),_0x166417[_0xbd0f('0x10')]);_0x108e72(_0x35f08b[_0xbd0f('0xe')](0x1f4,_0x166417[_0xbd0f('0x10')]));});}})[_0xbd0f('0x12')](function(_0x2211bf){logger[_0xbd0f('0xe')](_0xbd0f('0x13'),_0x2211bf[_0xbd0f('0x10')]);_0x108e72(_0x35f08b[_0xbd0f('0xe')](0x1f4,_0x2211bf[_0xbd0f('0x10')]));});}else _0x48a939({'additional':0x0});});});};exports[_0xbd0f('0x25')]=function(_0x5a0a08){var _0x5bd3e6=this;return new Promise(function(_0x3c3eab,_0x147959){return db[_0xbd0f('0x14')][_0xbd0f('0x19')]({'raw':!![],'where':{'ContactId':_0x5a0a08[_0xbd0f('0x15')]['ContactId'],'ListId':_0x5a0a08[_0xbd0f('0x15')]['ListId'],'VoiceQueueId':_0x5a0a08[_0xbd0f('0x15')][_0xbd0f('0x18')]===undefined?null:_0x5a0a08[_0xbd0f('0x15')][_0xbd0f('0x18')],'CampaignId':_0x5a0a08['body'][_0xbd0f('0x26')]===undefined?null:_0x5a0a08[_0xbd0f('0x15')][_0xbd0f('0x26')]}})['then'](function(_0x392f6c){if(_0x392f6c!=null){return db[_0xbd0f('0x22')][_0xbd0f('0x19')]({'raw':!![],'where':{'CmHopperId':_0x392f6c['id'],'OrderBy':{'$gte':_0x392f6c[_0xbd0f('0x1a')]}},'order':[[_0xbd0f('0x1a'),_0xbd0f('0x1b')]]})['then'](function(_0x27f9dd){if(_0x27f9dd)return activateAdditionalPhone(_0x392f6c,_0x5a0a08[_0xbd0f('0x15')],_0x27f9dd,_0x5a0a08[_0xbd0f('0x27')],_0x5a0a08['waitTime'])[_0xbd0f('0x8')](function(_0x2a31e6){_0x3c3eab(_0x2a31e6);});else{return db[_0xbd0f('0x22')][_0xbd0f('0x19')]({'raw':!![],'where':{'CmHopperId':_0x392f6c['id']},'order':[[_0xbd0f('0x1a'),_0xbd0f('0x1b')]]})[_0xbd0f('0x8')](function(_0x3012ae){if(_0x3012ae)return activateAdditionalPhone(_0x392f6c,_0x5a0a08[_0xbd0f('0x15')],_0x3012ae,_0x5a0a08['duration'],_0x5a0a08[_0xbd0f('0x28')])[_0xbd0f('0x8')](function(_0x209875){_0x3c3eab(_0x209875);});else{_0x3c3eab({'id':_0x392f6c['id'],'phone':''});}})['catch'](function(_0x4db7b7){logger[_0xbd0f('0xe')]('VerifyAdditionalPhones',_0x4db7b7[_0xbd0f('0x10')]);_0x147959(_0x5bd3e6[_0xbd0f('0xe')](0x1f4,_0x4db7b7[_0xbd0f('0x10')]));});}})[_0xbd0f('0x12')](function(_0x550a2d){logger[_0xbd0f('0xe')](_0xbd0f('0x13'),_0x550a2d[_0xbd0f('0x10')]);_0x147959(_0x5bd3e6[_0xbd0f('0xe')](0x1f4,_0x550a2d[_0xbd0f('0x10')]));});}else _0x3c3eab(0x1);});});};function activateAdditionalPhone(_0x503530,_0x2ac5a3,_0x3fa0d7,_0x564746,_0x2934e9){return new Promise(function(_0x5ab11f,_0x364d25){var _0x4adba2;if(_[_0xbd0f('0x29')](_0x3fa0d7[_0xbd0f('0x2a')])){_0x3fa0d7[_0xbd0f('0x2a')]=moment();}if(moment()>moment(_0x3fa0d7['scheduledat'])){_0x4adba2=moment()[_0xbd0f('0x2b')](_0x2934e9||0x3,_0xbd0f('0x2c'));}else{if(_0x3fa0d7['OrderBy']==0x0){_0x4adba2=moment(_0x3fa0d7[_0xbd0f('0x2a')]);}else{_0x4adba2=moment()[_0xbd0f('0x2b')](_0x2934e9||0x3,'minutes');}}if(_[_0xbd0f('0x29')](_0x4adba2)){_0x4adba2=moment()[_0xbd0f('0x2b')](_0x2934e9||0x3,'minutes');}var _0x3fd96d={'phone':_0x503530[_0xbd0f('0x2d')],'active':0x0,'OrderBy':_['isNil'](_0x503530['OrderBy'])?0x0:_0x503530[_0xbd0f('0x1a')],'scheduledat':moment()[_0xbd0f('0x2b')](_0x564746||0x1,'minutes'),'countbusyretry':_0x2ac5a3[_0xbd0f('0x1c')],'countcongestionretry':_0x2ac5a3['countcongestionretry'],'countnoanswerretry':_0x2ac5a3[_0xbd0f('0x1e')],'countnosuchnumberretry':_0x2ac5a3['countnosuchnumberretry'],'countdropretry':_0x2ac5a3[_0xbd0f('0x1f')],'countabandonedretry':_0x2ac5a3['countabandonedretry'],'countmachineretry':_0x2ac5a3['countmachineretry'],'countagentrejectretry':_0x2ac5a3[_0xbd0f('0x2e')],'createdAt':_0x2ac5a3[_0xbd0f('0x2f')],'updatedAt':_0x2ac5a3[_0xbd0f('0x30')]};var _0x12f8c2={'CmHopperId':_0x503530['id'],'phone':_0x3fa0d7[_0xbd0f('0x2d')],'active':0x0,'OrderBy':_['isNil'](_0x3fa0d7[_0xbd0f('0x1a')])?0x0:_0x3fa0d7[_0xbd0f('0x1a')],'scheduledat':_0x4adba2,'countbusyretry':_0x3fa0d7[_0xbd0f('0x1c')],'countcongestionretry':_0x3fa0d7[_0xbd0f('0x1d')],'countnoanswerretry':_0x3fa0d7[_0xbd0f('0x1e')],'countnosuchnumberretry':_0x3fa0d7['countnosuchnumberretry'],'countdropretry':_0x3fa0d7[_0xbd0f('0x1f')],'countabandonedretry':_0x3fa0d7[_0xbd0f('0x31')],'countmachineretry':_0x3fa0d7['countmachineretry'],'countagentrejectretry':_0x3fa0d7['countagentrejectretry'],'createdAt':_0x3fa0d7['createdAt'],'updatedAt':_0x3fa0d7[_0xbd0f('0x30')]};return db['sequelize'][_0xbd0f('0x32')](function(_0x3a2d83){return db[_0xbd0f('0x22')][_0xbd0f('0x33')](_0x3fd96d,{'where':{'id':_0x3fa0d7['id']}},{'transaction':_0x3a2d83})[_0xbd0f('0x8')](function(){return db[_0xbd0f('0x14')][_0xbd0f('0x33')](_0x12f8c2,{'where':{'id':_0x503530['id']}},{'transaction':_0x3a2d83});});})[_0xbd0f('0x8')](function(_0x3a5652){_0x5ab11f({'id':_0x503530['id'],'phone':_0x3fa0d7[_0xbd0f('0x2d')]});})['catch'](function(_0x4b372c){logger['error']('activateAdditionalPhone',_0x4b372c[_0xbd0f('0x10')]);_0x364d25({'error':_0x4b372c[_0xbd0f('0x10')]});});});}exports['IncrementPreviewCounters']=function(_0x23c573){var _0x2ad92d=this;return new Promise(function(_0x238b96,_0x110a42){return db[_0xbd0f('0x14')][_0xbd0f('0x33')](_0x23c573[_0xbd0f('0x15')]['field'],{'where':{'id':_0x23c573[_0xbd0f('0x15')]['id']}})[_0xbd0f('0x8')](function(_0x53f696){_0x238b96(_0x53f696);})[_0xbd0f('0x12')](function(_0x2c30dd){logger[_0xbd0f('0xe')](_0xbd0f('0x34'),_0x2c30dd[_0xbd0f('0x10')]);_0x110a42(_0x2ad92d[_0xbd0f('0xe')](0x1f4,_0x2c30dd[_0xbd0f('0x10')]));});});}; \ No newline at end of file +var _0x64b7=['catch','duration','waitTime','isNil','scheduledat','add','minutes','phone','createdAt','updatedAt','transaction','update','activateAdditionalPhone','field','lodash','util','moment','bluebird','randomstring','../../mysqldb','../../config/utils','../../config/logger','jayson/promise','client','http','then','info','CmHopperAdditionalPhone,\x20%s,\x20%s','request\x20sent','debug','error','code','message','VerifyAdditionalPhones','CmHopper','findOne','ContactId','body','ListId','VoiceQueueId','CampaignId','OrderBy','ASC','countbusyretry','countcongestionretry','countnosuchnumberretry','countmachineretry','countagentrejectretry','entity','CmHopperAdditionalPhone','countnoanswerretry','countdropretry','countabandonedretry'];(function(_0xcfb911,_0x2409c3){var _0x1e86c3=function(_0x35532d){while(--_0x35532d){_0xcfb911['push'](_0xcfb911['shift']());}};_0x1e86c3(++_0x2409c3);}(_0x64b7,0x78));var _0x764b=function(_0x1ac595,_0x5d2081){_0x1ac595=_0x1ac595-0x0;var _0x455fff=_0x64b7[_0x1ac595];return _0x455fff;};'use strict';var _=require(_0x764b('0x0'));var util=require(_0x764b('0x1'));var moment=require(_0x764b('0x2'));var BPromise=require(_0x764b('0x3'));var rs=require(_0x764b('0x4'));var fs=require('fs');var Redis=require('ioredis');var db=require(_0x764b('0x5'))['db'];var utils=require(_0x764b('0x6'));var logger=require(_0x764b('0x7'))('rpc');var config=require('../../config/environment');var jayson=require(_0x764b('0x8'));var client=jayson[_0x764b('0x9')][_0x764b('0xa')]({'port':0x232a});function respondWithRpcPromise(_0x28a3b0,_0x21e09b,_0x4494db){return new BPromise(function(_0x3d6908,_0x5e6588){return client['request'](_0x28a3b0,_0x4494db)[_0x764b('0xb')](function(_0x3dcf91){logger[_0x764b('0xc')](_0x764b('0xd'),_0x21e09b,_0x764b('0xe'));logger[_0x764b('0xf')]('CmHopperAdditionalPhone,\x20%s,\x20%s,\x20%s',_0x21e09b,'request\x20sent',JSON['stringify'](_0x3dcf91));if(_0x3dcf91[_0x764b('0x10')]){if(_0x3dcf91['error'][_0x764b('0x11')]===0x1f4){logger[_0x764b('0x10')](_0x764b('0xd'),_0x21e09b,_0x3dcf91[_0x764b('0x10')][_0x764b('0x12')]);return _0x5e6588(_0x3dcf91['error'][_0x764b('0x12')]);}logger[_0x764b('0x10')](_0x764b('0xd'),_0x21e09b,_0x3dcf91['error']['message']);return _0x3d6908(_0x3dcf91[_0x764b('0x10')][_0x764b('0x12')]);}else{logger[_0x764b('0xc')](_0x764b('0xd'),_0x21e09b,_0x764b('0xe'));_0x3d6908(_0x3dcf91['result'][_0x764b('0x12')]);}})['catch'](function(_0x44b2fd){logger['error']('CmHopperAdditionalPhone,\x20%s,\x20%s',_0x21e09b,_0x44b2fd);_0x5e6588(_0x44b2fd);});});}exports[_0x764b('0x13')]=function(_0xd9bb40){var _0x28b6f2=this;return new Promise(function(_0x3a1e3f,_0x2094a3){return db[_0x764b('0x14')][_0x764b('0x15')]({'raw':!![],'where':{'ContactId':_0xd9bb40['body'][_0x764b('0x16')],'ListId':_0xd9bb40[_0x764b('0x17')][_0x764b('0x18')],'VoiceQueueId':_0xd9bb40[_0x764b('0x17')][_0x764b('0x19')]===undefined?null:_0xd9bb40[_0x764b('0x17')][_0x764b('0x19')],'CampaignId':_0xd9bb40['body'][_0x764b('0x1a')]===undefined?null:_0xd9bb40['body']['CampaignId']}})[_0x764b('0xb')](function(_0x2c1015){if(_0x2c1015!=null){return db['CmHopperAdditionalPhone']['findOne']({'raw':!![],'where':{'CmHopperId':_0x2c1015['id'],'OrderBy':{'$gt':_0x2c1015[_0x764b('0x1b')]}},'order':[[_0x764b('0x1b'),_0x764b('0x1c')]]})[_0x764b('0xb')](function(_0x575803){var _0x1a54ef=0x0;if(_0x575803){if(_0x575803[_0x764b('0x1d')]+_0x575803[_0x764b('0x1e')]+_0x575803['countnoanswerretry']+_0x575803[_0x764b('0x1f')]+_0x575803['countdropretry']+_0x575803['countabandonedretry']+_0x575803[_0x764b('0x20')]+_0x575803[_0x764b('0x21')]<_0xd9bb40[_0x764b('0x22')]['dialGlobalMaxRetry'])_0x1a54ef=0x1;_0x3a1e3f({'additional':_0x1a54ef});}else{return db[_0x764b('0x23')][_0x764b('0x15')]({'raw':!![],'where':{'CmHopperId':_0x2c1015['id']},'order':[[_0x764b('0x1b'),_0x764b('0x1c')]]})[_0x764b('0xb')](function(_0x422c94){var _0x4dc006=0x0;if(_0x422c94){if(_0x422c94[_0x764b('0x1d')]+_0x422c94[_0x764b('0x1e')]+_0x422c94[_0x764b('0x24')]+_0x422c94['countnosuchnumberretry']+_0x422c94[_0x764b('0x25')]+_0x422c94[_0x764b('0x26')]+_0x422c94[_0x764b('0x20')]+_0x422c94[_0x764b('0x21')]<_0xd9bb40[_0x764b('0x22')]['dialGlobalMaxRetry'])_0x4dc006=0x1;_0x3a1e3f({'additional':_0x4dc006});}else{_0x3a1e3f({'additional':0x0});}})[_0x764b('0x27')](function(_0x171f11){logger['error'](_0x764b('0x13'),_0x171f11['message']);_0x2094a3(_0x28b6f2['error'](0x1f4,_0x171f11[_0x764b('0x12')]));});}})['catch'](function(_0x2cb65c){logger[_0x764b('0x10')](_0x764b('0x13'),_0x2cb65c[_0x764b('0x12')]);_0x2094a3(_0x28b6f2[_0x764b('0x10')](0x1f4,_0x2cb65c[_0x764b('0x12')]));});}else _0x3a1e3f({'additional':0x0});});});};exports['SwapAdditionalPhones']=function(_0x51b522){var _0xd85795=this;return new Promise(function(_0x3d7846,_0x26e8f9){return db['CmHopper'][_0x764b('0x15')]({'raw':!![],'where':{'ContactId':_0x51b522[_0x764b('0x17')][_0x764b('0x16')],'ListId':_0x51b522[_0x764b('0x17')][_0x764b('0x18')],'VoiceQueueId':_0x51b522[_0x764b('0x17')]['VoiceQueueId']===undefined?null:_0x51b522['body'][_0x764b('0x19')],'CampaignId':_0x51b522['body'][_0x764b('0x1a')]===undefined?null:_0x51b522['body'][_0x764b('0x1a')]}})['then'](function(_0x54fdc3){if(_0x54fdc3!=null){return db['CmHopperAdditionalPhone'][_0x764b('0x15')]({'raw':!![],'where':{'CmHopperId':_0x54fdc3['id'],'OrderBy':{'$gte':_0x54fdc3[_0x764b('0x1b')]}},'order':[[_0x764b('0x1b'),'ASC']]})[_0x764b('0xb')](function(_0x3faead){if(_0x3faead)return activateAdditionalPhone(_0x54fdc3,_0x51b522[_0x764b('0x17')],_0x3faead,_0x51b522['duration'],_0x51b522['waitTime'])[_0x764b('0xb')](function(_0x40873c){_0x3d7846(_0x40873c);});else{return db[_0x764b('0x23')]['findOne']({'raw':!![],'where':{'CmHopperId':_0x54fdc3['id']},'order':[[_0x764b('0x1b'),_0x764b('0x1c')]]})['then'](function(_0x2eb571){if(_0x2eb571)return activateAdditionalPhone(_0x54fdc3,_0x51b522['body'],_0x2eb571,_0x51b522[_0x764b('0x28')],_0x51b522[_0x764b('0x29')])['then'](function(_0x37459f){_0x3d7846(_0x37459f);});else{_0x3d7846({'id':_0x54fdc3['id'],'phone':''});}})[_0x764b('0x27')](function(_0x4d4ecb){logger[_0x764b('0x10')](_0x764b('0x13'),_0x4d4ecb['message']);_0x26e8f9(_0xd85795['error'](0x1f4,_0x4d4ecb[_0x764b('0x12')]));});}})[_0x764b('0x27')](function(_0x8cefa4){logger['error'](_0x764b('0x13'),_0x8cefa4[_0x764b('0x12')]);_0x26e8f9(_0xd85795[_0x764b('0x10')](0x1f4,_0x8cefa4[_0x764b('0x12')]));});}else _0x3d7846(0x1);});});};function activateAdditionalPhone(_0x17b8a5,_0x558330,_0x5a58e9,_0x45c4e1,_0x573793){return new Promise(function(_0x3c1dd4,_0x142848){var _0x42c6e1;if(_[_0x764b('0x2a')](_0x5a58e9[_0x764b('0x2b')])){_0x5a58e9[_0x764b('0x2b')]=moment();}if(moment()>moment(_0x5a58e9['scheduledat'])){_0x42c6e1=moment()[_0x764b('0x2c')](_0x573793||0x3,_0x764b('0x2d'));}else{if(_0x5a58e9['OrderBy']==0x0){_0x42c6e1=moment(_0x5a58e9[_0x764b('0x2b')]);}else{_0x42c6e1=moment()[_0x764b('0x2c')](_0x573793||0x3,_0x764b('0x2d'));}}if(_[_0x764b('0x2a')](_0x42c6e1)){_0x42c6e1=moment()[_0x764b('0x2c')](_0x573793||0x3,'minutes');}var _0x467f50={'phone':_0x17b8a5[_0x764b('0x2e')],'active':0x0,'OrderBy':_['isNil'](_0x17b8a5[_0x764b('0x1b')])?0x0:_0x17b8a5['OrderBy'],'scheduledat':moment()[_0x764b('0x2c')](_0x45c4e1||0x1,'minutes'),'countbusyretry':_0x558330[_0x764b('0x1d')],'countcongestionretry':_0x558330['countcongestionretry'],'countnoanswerretry':_0x558330[_0x764b('0x24')],'countnosuchnumberretry':_0x558330[_0x764b('0x1f')],'countdropretry':_0x558330[_0x764b('0x25')],'countabandonedretry':_0x558330[_0x764b('0x26')],'countmachineretry':_0x558330[_0x764b('0x20')],'countagentrejectretry':_0x558330[_0x764b('0x21')],'createdAt':_0x558330[_0x764b('0x2f')],'updatedAt':_0x558330[_0x764b('0x30')]};var _0x465709={'CmHopperId':_0x17b8a5['id'],'phone':_0x5a58e9[_0x764b('0x2e')],'active':0x0,'OrderBy':_[_0x764b('0x2a')](_0x5a58e9['OrderBy'])?0x0:_0x5a58e9[_0x764b('0x1b')],'scheduledat':_0x42c6e1,'countbusyretry':_0x5a58e9['countbusyretry'],'countcongestionretry':_0x5a58e9['countcongestionretry'],'countnoanswerretry':_0x5a58e9['countnoanswerretry'],'countnosuchnumberretry':_0x5a58e9[_0x764b('0x1f')],'countdropretry':_0x5a58e9[_0x764b('0x25')],'countabandonedretry':_0x5a58e9[_0x764b('0x26')],'countmachineretry':_0x5a58e9[_0x764b('0x20')],'countagentrejectretry':_0x5a58e9[_0x764b('0x21')],'createdAt':_0x5a58e9[_0x764b('0x2f')],'updatedAt':_0x5a58e9[_0x764b('0x30')]};return db['sequelize'][_0x764b('0x31')](function(_0x39f858){return db[_0x764b('0x23')][_0x764b('0x32')](_0x467f50,{'where':{'id':_0x5a58e9['id']}},{'transaction':_0x39f858})['then'](function(){return db[_0x764b('0x14')]['update'](_0x465709,{'where':{'id':_0x17b8a5['id']}},{'transaction':_0x39f858});});})[_0x764b('0xb')](function(_0x4709df){_0x3c1dd4({'id':_0x17b8a5['id'],'phone':_0x5a58e9[_0x764b('0x2e')]});})[_0x764b('0x27')](function(_0x5af43b){logger[_0x764b('0x10')](_0x764b('0x33'),_0x5af43b['message']);_0x142848({'error':_0x5af43b['message']});});});}exports['IncrementPreviewCounters']=function(_0x40a769){var _0x58b440=this;return new Promise(function(_0x3cd7dd,_0x3e671e){return db[_0x764b('0x14')][_0x764b('0x32')](_0x40a769[_0x764b('0x17')][_0x764b('0x34')],{'where':{'id':_0x40a769['body']['id']}})[_0x764b('0xb')](function(_0x511b5b){_0x3cd7dd(_0x511b5b);})[_0x764b('0x27')](function(_0x4a4059){logger[_0x764b('0x10')]('IncrementPreviewCounters',_0x4a4059[_0x764b('0x12')]);_0x3e671e(_0x58b440['error'](0x1f4,_0x4a4059[_0x764b('0x12')]));});});}; \ No newline at end of file diff --git a/server/api/cmHopperAdditionalPhone/index.js b/server/api/cmHopperAdditionalPhone/index.js index 341f1d3..376ca46 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 _0x192f=['destroy','exports','multer','util','path','express','Router','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','./cmHopperAdditionalPhone.controller','get','isAuthenticated','/:id','post','create','put','delete'];(function(_0x2bed4e,_0x447261){var _0x169d0f=function(_0x44dfa3){while(--_0x44dfa3){_0x2bed4e['push'](_0x2bed4e['shift']());}};_0x169d0f(++_0x447261);}(_0x192f,0xd3));var _0xf192=function(_0x49b0ea,_0x35200c){_0x49b0ea=_0x49b0ea-0x0;var _0x1aa8c6=_0x192f[_0x49b0ea];return _0x1aa8c6;};'use strict';var multer=require(_0xf192('0x0'));var util=require(_0xf192('0x1'));var path=require(_0xf192('0x2'));var timeout=require('connect-timeout');var express=require(_0xf192('0x3'));var router=express[_0xf192('0x4')]();var fs_extra=require(_0xf192('0x5'));var auth=require(_0xf192('0x6'));var interaction=require(_0xf192('0x7'));var config=require(_0xf192('0x8'));var controller=require(_0xf192('0x9'));router[_0xf192('0xa')]('/',auth[_0xf192('0xb')](),controller['index']);router[_0xf192('0xa')](_0xf192('0xc'),auth['isAuthenticated'](),controller['show']);router[_0xf192('0xd')]('/',auth['isAuthenticated'](),controller[_0xf192('0xe')]);router[_0xf192('0xf')](_0xf192('0xc'),auth['isAuthenticated'](),controller['update']);router[_0xf192('0x10')](_0xf192('0xc'),auth['isAuthenticated'](),controller[_0xf192('0x11')]);module[_0xf192('0x12')]=router; \ No newline at end of file +var _0x57fa=['get','isAuthenticated','show','post','create','/:id','update','delete','destroy','exports','multer','util','connect-timeout','Router','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','./cmHopperAdditionalPhone.controller'];(function(_0x3998b5,_0x388968){var _0x18b750=function(_0x53e082){while(--_0x53e082){_0x3998b5['push'](_0x3998b5['shift']());}};_0x18b750(++_0x388968);}(_0x57fa,0x127));var _0xa57f=function(_0x55cdd7,_0x5f18a9){_0x55cdd7=_0x55cdd7-0x0;var _0x54dfca=_0x57fa[_0x55cdd7];return _0x54dfca;};'use strict';var multer=require(_0xa57f('0x0'));var util=require(_0xa57f('0x1'));var path=require('path');var timeout=require(_0xa57f('0x2'));var express=require('express');var router=express[_0xa57f('0x3')]();var fs_extra=require(_0xa57f('0x4'));var auth=require(_0xa57f('0x5'));var interaction=require(_0xa57f('0x6'));var config=require(_0xa57f('0x7'));var controller=require(_0xa57f('0x8'));router[_0xa57f('0x9')]('/',auth['isAuthenticated'](),controller['index']);router[_0xa57f('0x9')]('/:id',auth[_0xa57f('0xa')](),controller[_0xa57f('0xb')]);router[_0xa57f('0xc')]('/',auth[_0xa57f('0xa')](),controller[_0xa57f('0xd')]);router['put'](_0xa57f('0xe'),auth[_0xa57f('0xa')](),controller[_0xa57f('0xf')]);router[_0xa57f('0x10')]('/:id',auth['isAuthenticated'](),controller[_0xa57f('0x11')]);module[_0xa57f('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 90bcda9..ffede6c 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 _0x67e8=['sequelize','exports','contactListQueue','INTEGER','moment'];(function(_0x91f166,_0x5d65fc){var _0x47588d=function(_0x2e49c0){while(--_0x2e49c0){_0x91f166['push'](_0x91f166['shift']());}};_0x47588d(++_0x5d65fc);}(_0x67e8,0x86));var _0x867e=function(_0xfab77b,_0x3c383c){_0xfab77b=_0xfab77b-0x0;var _0x2ec2d2=_0x67e8[_0xfab77b];return _0x2ec2d2;};'use strict';var moment=require(_0x867e('0x0'));var Sequelize=require(_0x867e('0x1'));module[_0x867e('0x2')]={'phone':{'type':Sequelize['STRING'],'allowNull':![]},'ContactId':{'type':Sequelize['INTEGER'],'unique':_0x867e('0x3')},'ListId':{'type':Sequelize[_0x867e('0x4')],'unique':'contactListQueue'},'VoiceQueueId':{'type':Sequelize['INTEGER'],'unique':_0x867e('0x3')}}; \ No newline at end of file +var _0xe55d=['sequelize','STRING','INTEGER','contactListQueue','moment'];(function(_0x56d7ce,_0x224c5f){var _0x951c1a=function(_0x2084df){while(--_0x2084df){_0x56d7ce['push'](_0x56d7ce['shift']());}};_0x951c1a(++_0x224c5f);}(_0xe55d,0x126));var _0xde55=function(_0x4b3880,_0x3ffd5b){_0x4b3880=_0x4b3880-0x0;var _0x43fb91=_0xe55d[_0x4b3880];return _0x43fb91;};'use strict';var moment=require(_0xde55('0x0'));var Sequelize=require(_0xde55('0x1'));module['exports']={'phone':{'type':Sequelize[_0xde55('0x2')],'allowNull':![]},'ContactId':{'type':Sequelize[_0xde55('0x3')],'unique':_0xde55('0x4')},'ListId':{'type':Sequelize[_0xde55('0x3')],'unique':_0xde55('0x4')},'VoiceQueueId':{'type':Sequelize[_0xde55('0x3')],'unique':'contactListQueue'}}; \ No newline at end of file diff --git a/server/api/cmHopperBlack/cmHopperBlack.controller.js b/server/api/cmHopperBlack/cmHopperBlack.controller.js index 0253117..ff09589 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 _0x14e4=['options','CmHopperBlack','includeAll','findAll','rows','catch','show','params','include','find','body','describe','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','bluebird','mustache','util','path','to-csv','ejs','fs-extra','squel','crypto','desk.js','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/environment','../../config/license/util','sendStatus','status','end','json','undefined','limit','count','offset','set','Content-Range','apply','reject','save','update','then','destroy','error','name','send','index','map','rawAttributes','fieldName','type','key','model','keys','query','intersection','attributes','fields','hasOwnProperty','order','sort','where','filters','pick','filter','merge'];(function(_0x115d5b,_0x26aff2){var _0x6cfc50=function(_0x39a786){while(--_0x39a786){_0x115d5b['push'](_0x115d5b['shift']());}};_0x6cfc50(++_0x26aff2);}(_0x14e4,0x144));var _0x414e=function(_0x1654cd,_0x47919c){_0x1654cd=_0x1654cd-0x0;var _0x40668e=_0x14e4[_0x1654cd];return _0x40668e;};'use strict';var emlformat=require(_0x414e('0x0'));var rimraf=require(_0x414e('0x1'));var zipdir=require(_0x414e('0x2'));var jsonpatch=require(_0x414e('0x3'));var rp=require(_0x414e('0x4'));var moment=require('moment');var BPromise=require(_0x414e('0x5'));var Mustache=require(_0x414e('0x6'));var util=require(_0x414e('0x7'));var path=require(_0x414e('0x8'));var sox=require('sox');var csv=require(_0x414e('0x9'));var ejs=require(_0x414e('0xa'));var fs=require('fs');var fs_extra=require(_0x414e('0xb'));var _=require('lodash');var squel=require(_0x414e('0xc'));var crypto=require(_0x414e('0xd'));var jsforce=require('jsforce');var deskjs=require(_0x414e('0xe'));var toCsv=require('to-csv');var querystring=require(_0x414e('0xf'));var Papa=require(_0x414e('0x10'));var Redis=require(_0x414e('0x11'));var authService=require(_0x414e('0x12'));var qs=require(_0x414e('0x13'));var as=require(_0x414e('0x14'));var hardwareService=require(_0x414e('0x15'));var logger=require(_0x414e('0x16'))(_0x414e('0x17'));var utils=require(_0x414e('0x18'));var config=require(_0x414e('0x19'));var licenseUtil=require(_0x414e('0x1a'));var db=require('../../mysqldb')['db'];function respondWithStatusCode(_0x3f17a7,_0x1c3a9d){_0x1c3a9d=_0x1c3a9d||0xcc;return function(_0x330f83){if(_0x330f83){return _0x3f17a7[_0x414e('0x1b')](_0x1c3a9d);}return _0x3f17a7[_0x414e('0x1c')](_0x1c3a9d)[_0x414e('0x1d')]();};}function respondWithResult(_0x793a39,_0x4fecdc){_0x4fecdc=_0x4fecdc||0xc8;return function(_0x156fdc){if(_0x156fdc){return _0x793a39[_0x414e('0x1c')](_0x4fecdc)[_0x414e('0x1e')](_0x156fdc);}};}function respondWithFilteredResult(_0x230d69,_0x50ee03){return function(_0x45e6ed){if(_0x45e6ed){var _0x54517f=typeof _0x50ee03['offset']===_0x414e('0x1f')&&typeof _0x50ee03[_0x414e('0x20')]===_0x414e('0x1f');var _0x38c287=_0x45e6ed[_0x414e('0x21')];var _0xe3420a=_0x54517f?0x0:_0x50ee03['offset'];var _0x1a20ed=_0x54517f?_0x45e6ed[_0x414e('0x21')]:_0x50ee03[_0x414e('0x22')]+_0x50ee03[_0x414e('0x20')];var _0x14e3e1;if(_0x1a20ed>=_0x38c287){_0x1a20ed=_0x38c287;_0x14e3e1=0xc8;}else{_0x14e3e1=0xce;}_0x230d69[_0x414e('0x1c')](_0x14e3e1);return _0x230d69[_0x414e('0x23')](_0x414e('0x24'),_0xe3420a+'-'+_0x1a20ed+'/'+_0x38c287)['json'](_0x45e6ed);}return null;};}function patchUpdates(_0x11dd15){return function(_0x52415f){try{jsonpatch[_0x414e('0x25')](_0x52415f,_0x11dd15,!![]);}catch(_0x82b556){return BPromise[_0x414e('0x26')](_0x82b556);}return _0x52415f[_0x414e('0x27')]();};}function saveUpdates(_0xbfdb9a,_0x44ca36){return function(_0x5cbc7d){if(_0x5cbc7d){return _0x5cbc7d[_0x414e('0x28')](_0xbfdb9a)[_0x414e('0x29')](function(_0x4303fb){return _0x4303fb;});}return null;};}function removeEntity(_0x27702c,_0x45551e){return function(_0x50d644){if(_0x50d644){return _0x50d644[_0x414e('0x2a')]()['then'](function(){_0x27702c[_0x414e('0x1c')](0xcc)[_0x414e('0x1d')]();});}};}function handleEntityNotFound(_0x2eeaad,_0x53d9a1){return function(_0x5e8c8d){if(!_0x5e8c8d){_0x2eeaad[_0x414e('0x1b')](0x194);}return _0x5e8c8d;};}function handleError(_0x5956aa,_0x101c81){_0x101c81=_0x101c81||0x1f4;return function(_0x5720b0){logger[_0x414e('0x2b')](_0x5720b0['stack']);if(_0x5720b0['name']){delete _0x5720b0[_0x414e('0x2c')];}_0x5956aa[_0x414e('0x1c')](_0x101c81)[_0x414e('0x2d')](_0x5720b0);};}exports[_0x414e('0x2e')]=function(_0x50ee9f,_0x4aa486){var _0x437f68={},_0x574fd9={},_0x3be052={'count':0x0,'rows':[]};var _0x2ec473=_[_0x414e('0x2f')](db['CmHopperBlack'][_0x414e('0x30')],function(_0x238049){return{'name':_0x238049[_0x414e('0x31')],'type':_0x238049[_0x414e('0x32')][_0x414e('0x33')]};});_0x574fd9[_0x414e('0x34')]=_[_0x414e('0x2f')](_0x2ec473,_0x414e('0x2c'));_0x574fd9['query']=_[_0x414e('0x35')](_0x50ee9f[_0x414e('0x36')]);_0x574fd9['filters']=_[_0x414e('0x37')](_0x574fd9['model'],_0x574fd9[_0x414e('0x36')]);_0x437f68[_0x414e('0x38')]=_[_0x414e('0x37')](_0x574fd9[_0x414e('0x34')],qs[_0x414e('0x39')](_0x50ee9f[_0x414e('0x36')][_0x414e('0x39')]));_0x437f68[_0x414e('0x38')]=_0x437f68[_0x414e('0x38')]['length']?_0x437f68[_0x414e('0x38')]:_0x574fd9[_0x414e('0x34')];if(!_0x50ee9f[_0x414e('0x36')][_0x414e('0x3a')]('nolimit')){_0x437f68[_0x414e('0x20')]=qs[_0x414e('0x20')](_0x50ee9f['query']['limit']);_0x437f68[_0x414e('0x22')]=qs[_0x414e('0x22')](_0x50ee9f[_0x414e('0x36')][_0x414e('0x22')]);}_0x437f68[_0x414e('0x3b')]=qs[_0x414e('0x3c')](_0x50ee9f[_0x414e('0x36')][_0x414e('0x3c')]);_0x437f68[_0x414e('0x3d')]=qs[_0x414e('0x3e')](_[_0x414e('0x3f')](_0x50ee9f[_0x414e('0x36')],_0x574fd9['filters']),_0x2ec473);if(_0x50ee9f[_0x414e('0x36')][_0x414e('0x40')]){_0x437f68['where']=_[_0x414e('0x41')](_0x437f68[_0x414e('0x3d')],{'$or':_[_0x414e('0x2f')](_0x2ec473,function(_0x54d4d6){if(_0x54d4d6[_0x414e('0x32')]!=='VIRTUAL'){var _0x286a99={};_0x286a99[_0x54d4d6['name']]={'$like':'%'+_0x50ee9f[_0x414e('0x36')][_0x414e('0x40')]+'%'};return _0x286a99;}})});}_0x437f68=_[_0x414e('0x41')]({},_0x437f68,_0x50ee9f[_0x414e('0x42')]);var _0x15a4dc={'where':_0x437f68['where']};return db[_0x414e('0x43')][_0x414e('0x21')](_0x15a4dc)[_0x414e('0x29')](function(_0x4324cd){_0x3be052['count']=_0x4324cd;if(_0x50ee9f['query'][_0x414e('0x44')]){_0x437f68['include']=[{'all':!![]}];}return db[_0x414e('0x43')][_0x414e('0x45')](_0x437f68);})[_0x414e('0x29')](function(_0x4d5b7b){_0x3be052[_0x414e('0x46')]=_0x4d5b7b;return _0x3be052;})['then'](respondWithFilteredResult(_0x4aa486,_0x437f68))[_0x414e('0x47')](handleError(_0x4aa486,null));};exports[_0x414e('0x48')]=function(_0x2366b7,_0x242057){var _0x53fdb4={'raw':!![],'where':{'id':_0x2366b7[_0x414e('0x49')]['id']}},_0x17e1eb={};_0x17e1eb['model']=_[_0x414e('0x35')](db[_0x414e('0x43')][_0x414e('0x30')]);_0x17e1eb[_0x414e('0x36')]=_[_0x414e('0x35')](_0x2366b7[_0x414e('0x36')]);_0x17e1eb['filters']=_[_0x414e('0x37')](_0x17e1eb[_0x414e('0x34')],_0x17e1eb[_0x414e('0x36')]);_0x53fdb4['attributes']=_[_0x414e('0x37')](_0x17e1eb['model'],qs[_0x414e('0x39')](_0x2366b7[_0x414e('0x36')][_0x414e('0x39')]));_0x53fdb4[_0x414e('0x38')]=_0x53fdb4[_0x414e('0x38')]['length']?_0x53fdb4[_0x414e('0x38')]:_0x17e1eb[_0x414e('0x34')];if(_0x2366b7[_0x414e('0x36')]['includeAll']){_0x53fdb4[_0x414e('0x4a')]=[{'all':!![]}];}_0x53fdb4=_[_0x414e('0x41')]({},_0x53fdb4,_0x2366b7[_0x414e('0x42')]);return db[_0x414e('0x43')][_0x414e('0x4b')](_0x53fdb4)[_0x414e('0x29')](handleEntityNotFound(_0x242057,null))[_0x414e('0x29')](respondWithResult(_0x242057,null))[_0x414e('0x47')](handleError(_0x242057,null));};exports[_0x414e('0x28')]=function(_0x5790ca,_0x56d2e5){if(_0x5790ca[_0x414e('0x4c')]['id']){delete _0x5790ca[_0x414e('0x4c')]['id'];}return db[_0x414e('0x43')]['find']({'where':{'id':_0x5790ca['params']['id']}})['then'](handleEntityNotFound(_0x56d2e5,null))[_0x414e('0x29')](saveUpdates(_0x5790ca['body'],null))[_0x414e('0x29')](respondWithResult(_0x56d2e5,null))['catch'](handleError(_0x56d2e5,null));};exports[_0x414e('0x2a')]=function(_0xae93a8,_0x5ae1e1){return db[_0x414e('0x43')][_0x414e('0x4b')]({'where':{'id':_0xae93a8[_0x414e('0x49')]['id']}})[_0x414e('0x29')](handleEntityNotFound(_0x5ae1e1,null))[_0x414e('0x29')](removeEntity(_0x5ae1e1,null))[_0x414e('0x47')](handleError(_0x5ae1e1,null));};exports[_0x414e('0x4d')]=function(_0x176da0,_0x44d2b4){return db['CmHopperBlack'][_0x414e('0x4d')]()['then'](respondWithResult(_0x44d2b4,null))['catch'](handleError(_0x44d2b4,null));}; \ No newline at end of file +var _0xc00b=['count','set','Content-Range','apply','reject','save','update','then','error','stack','name','send','index','map','CmHopperBlack','fieldName','type','key','model','query','keys','intersection','attributes','fields','length','hasOwnProperty','nolimit','limit','order','sort','where','filters','pick','merge','VIRTUAL','options','includeAll','include','rows','show','rawAttributes','find','body','params','catch','destroy','describe','eml-format','request-promise','bluebird','mustache','util','path','to-csv','fs-extra','squel','crypto','jsforce','desk.js','querystring','ioredis','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','api','../../config/environment','../../mysqldb','sendStatus','status','end','json','offset','undefined'];(function(_0x1a3f6b,_0x5065f4){var _0x28ba9e=function(_0x46b13d){while(--_0x46b13d){_0x1a3f6b['push'](_0x1a3f6b['shift']());}};_0x28ba9e(++_0x5065f4);}(_0xc00b,0x1e5));var _0xbc00=function(_0x101802,_0x11f913){_0x101802=_0x101802-0x0;var _0x5d61ce=_0xc00b[_0x101802];return _0x5d61ce;};'use strict';var emlformat=require(_0xbc00('0x0'));var rimraf=require('rimraf');var zipdir=require('zip-dir');var jsonpatch=require('fast-json-patch');var rp=require(_0xbc00('0x1'));var moment=require('moment');var BPromise=require(_0xbc00('0x2'));var Mustache=require(_0xbc00('0x3'));var util=require(_0xbc00('0x4'));var path=require(_0xbc00('0x5'));var sox=require('sox');var csv=require(_0xbc00('0x6'));var ejs=require('ejs');var fs=require('fs');var fs_extra=require(_0xbc00('0x7'));var _=require('lodash');var squel=require(_0xbc00('0x8'));var crypto=require(_0xbc00('0x9'));var jsforce=require(_0xbc00('0xa'));var deskjs=require(_0xbc00('0xb'));var toCsv=require(_0xbc00('0x6'));var querystring=require(_0xbc00('0xc'));var Papa=require('papaparse');var Redis=require(_0xbc00('0xd'));var authService=require('../../components/auth/service');var qs=require(_0xbc00('0xe'));var as=require(_0xbc00('0xf'));var hardwareService=require(_0xbc00('0x10'));var logger=require('../../config/logger')(_0xbc00('0x11'));var utils=require('../../config/utils');var config=require(_0xbc00('0x12'));var licenseUtil=require('../../config/license/util');var db=require(_0xbc00('0x13'))['db'];function respondWithStatusCode(_0x248684,_0x12cd59){_0x12cd59=_0x12cd59||0xcc;return function(_0x4aabba){if(_0x4aabba){return _0x248684[_0xbc00('0x14')](_0x12cd59);}return _0x248684[_0xbc00('0x15')](_0x12cd59)[_0xbc00('0x16')]();};}function respondWithResult(_0x55f770,_0xfcc4d2){_0xfcc4d2=_0xfcc4d2||0xc8;return function(_0xd05e85){if(_0xd05e85){return _0x55f770['status'](_0xfcc4d2)[_0xbc00('0x17')](_0xd05e85);}};}function respondWithFilteredResult(_0x3eb532,_0x3d6773){return function(_0x3d9659){if(_0x3d9659){var _0x46ae64=typeof _0x3d6773[_0xbc00('0x18')]===_0xbc00('0x19')&&typeof _0x3d6773['limit']==='undefined';var _0x53b0cd=_0x3d9659[_0xbc00('0x1a')];var _0x4e529d=_0x46ae64?0x0:_0x3d6773[_0xbc00('0x18')];var _0x5c1423=_0x46ae64?_0x3d9659[_0xbc00('0x1a')]:_0x3d6773[_0xbc00('0x18')]+_0x3d6773['limit'];var _0x3820c5;if(_0x5c1423>=_0x53b0cd){_0x5c1423=_0x53b0cd;_0x3820c5=0xc8;}else{_0x3820c5=0xce;}_0x3eb532['status'](_0x3820c5);return _0x3eb532[_0xbc00('0x1b')](_0xbc00('0x1c'),_0x4e529d+'-'+_0x5c1423+'/'+_0x53b0cd)['json'](_0x3d9659);}return null;};}function patchUpdates(_0x340f91){return function(_0x225ee6){try{jsonpatch[_0xbc00('0x1d')](_0x225ee6,_0x340f91,!![]);}catch(_0x13abd5){return BPromise[_0xbc00('0x1e')](_0x13abd5);}return _0x225ee6[_0xbc00('0x1f')]();};}function saveUpdates(_0x5c5131,_0x4c88c6){return function(_0x39afdf){if(_0x39afdf){return _0x39afdf[_0xbc00('0x20')](_0x5c5131)[_0xbc00('0x21')](function(_0x5286eb){return _0x5286eb;});}return null;};}function removeEntity(_0x334f8b,_0xf54de8){return function(_0x593289){if(_0x593289){return _0x593289['destroy']()[_0xbc00('0x21')](function(){_0x334f8b[_0xbc00('0x15')](0xcc)[_0xbc00('0x16')]();});}};}function handleEntityNotFound(_0x532f0d,_0x5f21c5){return function(_0x1a969f){if(!_0x1a969f){_0x532f0d['sendStatus'](0x194);}return _0x1a969f;};}function handleError(_0x33a6be,_0x3543f2){_0x3543f2=_0x3543f2||0x1f4;return function(_0x4b3356){logger[_0xbc00('0x22')](_0x4b3356[_0xbc00('0x23')]);if(_0x4b3356[_0xbc00('0x24')]){delete _0x4b3356[_0xbc00('0x24')];}_0x33a6be['status'](_0x3543f2)[_0xbc00('0x25')](_0x4b3356);};}exports[_0xbc00('0x26')]=function(_0x15724a,_0x458c3e){var _0x1a9da0={},_0x1a0e23={},_0x30c348={'count':0x0,'rows':[]};var _0x57a4a8=_[_0xbc00('0x27')](db[_0xbc00('0x28')]['rawAttributes'],function(_0x2c0cb3){return{'name':_0x2c0cb3[_0xbc00('0x29')],'type':_0x2c0cb3[_0xbc00('0x2a')][_0xbc00('0x2b')]};});_0x1a0e23[_0xbc00('0x2c')]=_[_0xbc00('0x27')](_0x57a4a8,_0xbc00('0x24'));_0x1a0e23[_0xbc00('0x2d')]=_[_0xbc00('0x2e')](_0x15724a[_0xbc00('0x2d')]);_0x1a0e23['filters']=_[_0xbc00('0x2f')](_0x1a0e23[_0xbc00('0x2c')],_0x1a0e23[_0xbc00('0x2d')]);_0x1a9da0[_0xbc00('0x30')]=_['intersection'](_0x1a0e23[_0xbc00('0x2c')],qs[_0xbc00('0x31')](_0x15724a[_0xbc00('0x2d')][_0xbc00('0x31')]));_0x1a9da0[_0xbc00('0x30')]=_0x1a9da0['attributes'][_0xbc00('0x32')]?_0x1a9da0[_0xbc00('0x30')]:_0x1a0e23[_0xbc00('0x2c')];if(!_0x15724a['query'][_0xbc00('0x33')](_0xbc00('0x34'))){_0x1a9da0[_0xbc00('0x35')]=qs[_0xbc00('0x35')](_0x15724a[_0xbc00('0x2d')]['limit']);_0x1a9da0[_0xbc00('0x18')]=qs[_0xbc00('0x18')](_0x15724a[_0xbc00('0x2d')][_0xbc00('0x18')]);}_0x1a9da0[_0xbc00('0x36')]=qs[_0xbc00('0x37')](_0x15724a['query']['sort']);_0x1a9da0[_0xbc00('0x38')]=qs[_0xbc00('0x39')](_[_0xbc00('0x3a')](_0x15724a[_0xbc00('0x2d')],_0x1a0e23[_0xbc00('0x39')]),_0x57a4a8);if(_0x15724a['query']['filter']){_0x1a9da0[_0xbc00('0x38')]=_[_0xbc00('0x3b')](_0x1a9da0[_0xbc00('0x38')],{'$or':_['map'](_0x57a4a8,function(_0x2c8060){if(_0x2c8060[_0xbc00('0x2a')]!==_0xbc00('0x3c')){var _0x465f0d={};_0x465f0d[_0x2c8060['name']]={'$like':'%'+_0x15724a[_0xbc00('0x2d')]['filter']+'%'};return _0x465f0d;}})});}_0x1a9da0=_[_0xbc00('0x3b')]({},_0x1a9da0,_0x15724a[_0xbc00('0x3d')]);var _0x5ead44={'where':_0x1a9da0['where']};return db[_0xbc00('0x28')][_0xbc00('0x1a')](_0x5ead44)[_0xbc00('0x21')](function(_0x7d36a2){_0x30c348[_0xbc00('0x1a')]=_0x7d36a2;if(_0x15724a[_0xbc00('0x2d')][_0xbc00('0x3e')]){_0x1a9da0[_0xbc00('0x3f')]=[{'all':!![]}];}return db[_0xbc00('0x28')]['findAll'](_0x1a9da0);})[_0xbc00('0x21')](function(_0x51c4d8){_0x30c348[_0xbc00('0x40')]=_0x51c4d8;return _0x30c348;})[_0xbc00('0x21')](respondWithFilteredResult(_0x458c3e,_0x1a9da0))['catch'](handleError(_0x458c3e,null));};exports[_0xbc00('0x41')]=function(_0x56e4fa,_0x112067){var _0x3ce349={'raw':!![],'where':{'id':_0x56e4fa['params']['id']}},_0x25b82a={};_0x25b82a[_0xbc00('0x2c')]=_['keys'](db[_0xbc00('0x28')][_0xbc00('0x42')]);_0x25b82a[_0xbc00('0x2d')]=_[_0xbc00('0x2e')](_0x56e4fa[_0xbc00('0x2d')]);_0x25b82a['filters']=_['intersection'](_0x25b82a['model'],_0x25b82a['query']);_0x3ce349[_0xbc00('0x30')]=_[_0xbc00('0x2f')](_0x25b82a['model'],qs[_0xbc00('0x31')](_0x56e4fa[_0xbc00('0x2d')][_0xbc00('0x31')]));_0x3ce349['attributes']=_0x3ce349[_0xbc00('0x30')][_0xbc00('0x32')]?_0x3ce349['attributes']:_0x25b82a['model'];if(_0x56e4fa['query'][_0xbc00('0x3e')]){_0x3ce349[_0xbc00('0x3f')]=[{'all':!![]}];}_0x3ce349=_[_0xbc00('0x3b')]({},_0x3ce349,_0x56e4fa[_0xbc00('0x3d')]);return db[_0xbc00('0x28')][_0xbc00('0x43')](_0x3ce349)[_0xbc00('0x21')](handleEntityNotFound(_0x112067,null))['then'](respondWithResult(_0x112067,null))['catch'](handleError(_0x112067,null));};exports[_0xbc00('0x20')]=function(_0x47f693,_0x43a386){if(_0x47f693['body']['id']){delete _0x47f693[_0xbc00('0x44')]['id'];}return db[_0xbc00('0x28')]['find']({'where':{'id':_0x47f693[_0xbc00('0x45')]['id']}})[_0xbc00('0x21')](handleEntityNotFound(_0x43a386,null))['then'](saveUpdates(_0x47f693[_0xbc00('0x44')],null))['then'](respondWithResult(_0x43a386,null))[_0xbc00('0x46')](handleError(_0x43a386,null));};exports[_0xbc00('0x47')]=function(_0x5b2c0b,_0x41cd92){return db[_0xbc00('0x28')]['find']({'where':{'id':_0x5b2c0b[_0xbc00('0x45')]['id']}})[_0xbc00('0x21')](handleEntityNotFound(_0x41cd92,null))[_0xbc00('0x21')](removeEntity(_0x41cd92,null))[_0xbc00('0x46')](handleError(_0x41cd92,null));};exports[_0xbc00('0x48')]=function(_0xd08fe5,_0xa9be82){return db[_0xbc00('0x28')][_0xbc00('0x48')]()[_0xbc00('0x21')](respondWithResult(_0xa9be82,null))[_0xbc00('0x46')](handleError(_0xa9be82,null));}; \ No newline at end of file diff --git a/server/api/cmHopperBlack/cmHopperBlack.model.js b/server/api/cmHopperBlack/cmHopperBlack.model.js index 3572ea0..3260bd3 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 _0x887b=['util','../../config/logger','api','moment','request-promise','path','rimraf','exports','define','CmHopperBlack','cm_hopper_black','lodash'];(function(_0x4b906a,_0x1aae74){var _0x49df27=function(_0x180104){while(--_0x180104){_0x4b906a['push'](_0x4b906a['shift']());}};_0x49df27(++_0x1aae74);}(_0x887b,0x197));var _0xb887=function(_0x772ca3,_0x29d7de){_0x772ca3=_0x772ca3-0x0;var _0x1e0f7c=_0x887b[_0x772ca3];return _0x1e0f7c;};'use strict';var _=require(_0xb887('0x0'));var util=require(_0xb887('0x1'));var logger=require(_0xb887('0x2'))(_0xb887('0x3'));var moment=require(_0xb887('0x4'));var BPromise=require('bluebird');var rp=require(_0xb887('0x5'));var fs=require('fs');var path=require(_0xb887('0x6'));var rimraf=require(_0xb887('0x7'));var config=require('../../config/environment');var attributes=require('./cmHopperBlack.attributes');module[_0xb887('0x8')]=function(_0x2c25d0,_0x270e9d){return _0x2c25d0[_0xb887('0x9')](_0xb887('0xa'),attributes,{'tableName':_0xb887('0xb'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x0390=['lodash','../../config/logger','api','moment','bluebird','rimraf','./cmHopperBlack.attributes','CmHopperBlack','cm_hopper_black'];(function(_0x234424,_0x944a97){var _0x5b21f7=function(_0x30c68a){while(--_0x30c68a){_0x234424['push'](_0x234424['shift']());}};_0x5b21f7(++_0x944a97);}(_0x0390,0x1b9));var _0x0039=function(_0xd327db,_0x4dd577){_0xd327db=_0xd327db-0x0;var _0x417d88=_0x0390[_0xd327db];return _0x417d88;};'use strict';var _=require(_0x0039('0x0'));var util=require('util');var logger=require(_0x0039('0x1'))(_0x0039('0x2'));var moment=require(_0x0039('0x3'));var BPromise=require(_0x0039('0x4'));var rp=require('request-promise');var fs=require('fs');var path=require('path');var rimraf=require(_0x0039('0x5'));var config=require('../../config/environment');var attributes=require(_0x0039('0x6'));module['exports']=function(_0x1af4fe,_0x1d7bd2){return _0x1af4fe['define'](_0x0039('0x7'),attributes,{'tableName':_0x0039('0x8'),'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 06167c3..11723b2 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 _0xbe9b=['CmHopperBlack,\x20%s,\x20%s,\x20%s','stringify','error','code','message','result','catch','GetCmHopperBlack','CmHopperBlack','options','raw','where','attributes','limit','include','map','model','UpdateCmHopperBlack','body','debug','DestroyCmHopperBlack','util','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','client','http','request','then','info','CmHopperBlack,\x20%s,\x20%s','request\x20sent'];(function(_0x22613a,_0x2b68a7){var _0x1d1be1=function(_0x497c25){while(--_0x497c25){_0x22613a['push'](_0x22613a['shift']());}};_0x1d1be1(++_0x2b68a7);}(_0xbe9b,0xd8));var _0xbbe9=function(_0x4da08f,_0x313a5a){_0x4da08f=_0x4da08f-0x0;var _0x3fcf00=_0xbe9b[_0x4da08f];return _0x3fcf00;};'use strict';var _=require('lodash');var util=require(_0xbbe9('0x0'));var moment=require(_0xbbe9('0x1'));var BPromise=require(_0xbbe9('0x2'));var rs=require(_0xbbe9('0x3'));var fs=require('fs');var Redis=require(_0xbbe9('0x4'));var db=require(_0xbbe9('0x5'))['db'];var utils=require(_0xbbe9('0x6'));var logger=require(_0xbbe9('0x7'))(_0xbbe9('0x8'));var config=require(_0xbbe9('0x9'));var jayson=require(_0xbbe9('0xa'));var client=jayson[_0xbbe9('0xb')][_0xbbe9('0xc')]({'port':0x232a});function respondWithRpcPromise(_0x3be69b,_0x1e69b3,_0x4ef29e){return new BPromise(function(_0x169e87,_0x4e53c9){return client[_0xbbe9('0xd')](_0x3be69b,_0x4ef29e)[_0xbbe9('0xe')](function(_0xd672ca){logger[_0xbbe9('0xf')](_0xbbe9('0x10'),_0x1e69b3,_0xbbe9('0x11'));logger['debug'](_0xbbe9('0x12'),_0x1e69b3,_0xbbe9('0x11'),JSON[_0xbbe9('0x13')](_0xd672ca));if(_0xd672ca[_0xbbe9('0x14')]){if(_0xd672ca[_0xbbe9('0x14')][_0xbbe9('0x15')]===0x1f4){logger[_0xbbe9('0x14')](_0xbbe9('0x10'),_0x1e69b3,_0xd672ca[_0xbbe9('0x14')]['message']);return _0x4e53c9(_0xd672ca[_0xbbe9('0x14')][_0xbbe9('0x16')]);}logger[_0xbbe9('0x14')](_0xbbe9('0x10'),_0x1e69b3,_0xd672ca[_0xbbe9('0x14')]['message']);return _0x169e87(_0xd672ca[_0xbbe9('0x14')]['message']);}else{logger[_0xbbe9('0xf')](_0xbbe9('0x10'),_0x1e69b3,_0xbbe9('0x11'));_0x169e87(_0xd672ca[_0xbbe9('0x17')][_0xbbe9('0x16')]);}})[_0xbbe9('0x18')](function(_0x176239){logger[_0xbbe9('0x14')](_0xbbe9('0x10'),_0x1e69b3,_0x176239);_0x4e53c9(_0x176239);});});}exports[_0xbbe9('0x19')]=function(_0x11ae78){var _0x3984f4=this;return new Promise(function(_0x8e290,_0x4a03e7){return db[_0xbbe9('0x1a')]['findAll']({'raw':_0x11ae78[_0xbbe9('0x1b')]?_0x11ae78[_0xbbe9('0x1b')][_0xbbe9('0x1c')]===undefined?!![]:![]:!![],'where':_0x11ae78[_0xbbe9('0x1b')]?_0x11ae78[_0xbbe9('0x1b')][_0xbbe9('0x1d')]||null:null,'attributes':_0x11ae78[_0xbbe9('0x1b')]?_0x11ae78[_0xbbe9('0x1b')][_0xbbe9('0x1e')]||null:null,'limit':_0x11ae78[_0xbbe9('0x1b')]?_0x11ae78[_0xbbe9('0x1b')][_0xbbe9('0x1f')]||null:null,'include':_0x11ae78[_0xbbe9('0x1b')]?_0x11ae78[_0xbbe9('0x1b')][_0xbbe9('0x20')]?_[_0xbbe9('0x21')](_0x11ae78['options'][_0xbbe9('0x20')],function(_0x1aaf56){return{'model':db[_0x1aaf56[_0xbbe9('0x22')]],'as':_0x1aaf56['as'],'attributes':_0x1aaf56[_0xbbe9('0x1e')],'include':_0x1aaf56['include']?_[_0xbbe9('0x21')](_0x1aaf56[_0xbbe9('0x20')],function(_0x22f860){return{'model':db[_0x22f860[_0xbbe9('0x22')]],'as':_0x22f860['as'],'attributes':_0x22f860[_0xbbe9('0x1e')],'include':_0x22f860[_0xbbe9('0x20')]?_[_0xbbe9('0x21')](_0x22f860[_0xbbe9('0x20')],function(_0x576ec7){return{'model':db[_0x576ec7[_0xbbe9('0x22')]],'as':_0x576ec7['as'],'attributes':_0x576ec7[_0xbbe9('0x1e')]};}):[]};}):[]};}):[]:[]})['then'](function(_0x3d86a1){logger[_0xbbe9('0xf')](_0xbbe9('0x19'),_0x11ae78);logger['debug']('GetCmHopperBlack',_0x11ae78,JSON[_0xbbe9('0x13')](_0x3d86a1));_0x8e290(_0x3d86a1);})['catch'](function(_0x2219b5){logger['error'](_0xbbe9('0x19'),_0x2219b5['message'],_0x11ae78);_0x4a03e7(_0x3984f4[_0xbbe9('0x14')](0x1f4,_0x2219b5[_0xbbe9('0x16')]));});});};exports[_0xbbe9('0x23')]=function(_0x1db01e){var _0x1e73f4=this;return new Promise(function(_0x31c2bb,_0x4a388){return db['CmHopperBlack']['update'](_0x1db01e[_0xbbe9('0x24')],{'raw':_0x1db01e['options']?_0x1db01e[_0xbbe9('0x1b')]['raw']===undefined?!![]:![]:!![],'individualHooks':!![],'where':_0x1db01e[_0xbbe9('0x1b')]?_0x1db01e[_0xbbe9('0x1b')]['where']||null:null,'attributes':_0x1db01e[_0xbbe9('0x1b')]?_0x1db01e[_0xbbe9('0x1b')][_0xbbe9('0x1e')]||null:null,'limit':_0x1db01e['options']?_0x1db01e['options'][_0xbbe9('0x1f')]||null:null})[_0xbbe9('0xe')](function(_0x23f3db){logger['info'](_0xbbe9('0x23'),_0x1db01e);logger[_0xbbe9('0x25')](_0xbbe9('0x23'),_0x1db01e,JSON[_0xbbe9('0x13')](_0x23f3db));_0x31c2bb(_0x23f3db);})[_0xbbe9('0x18')](function(_0x4e772b){logger[_0xbbe9('0x14')]('UpdateCmHopperBlack',_0x4e772b[_0xbbe9('0x16')],_0x1db01e);_0x4a388(_0x1e73f4[_0xbbe9('0x14')](0x1f4,_0x4e772b['message']));});});};exports[_0xbbe9('0x26')]=function(_0x2bed77){var _0x55c052=this;return new Promise(function(_0x3dc200,_0x12dc63){return db[_0xbbe9('0x1a')]['destroy']({'where':_0x2bed77[_0xbbe9('0x1b')]?_0x2bed77['options'][_0xbbe9('0x1d')]||null:null})[_0xbbe9('0xe')](function(_0x89e33e){logger[_0xbbe9('0xf')](_0xbbe9('0x26'),_0x2bed77);logger[_0xbbe9('0x25')](_0xbbe9('0x26'),_0x2bed77,JSON[_0xbbe9('0x13')](_0x89e33e));_0x3dc200(_0x89e33e);})['catch'](function(_0xc7aa1d){logger[_0xbbe9('0x14')](_0xbbe9('0x26'),_0xc7aa1d[_0xbbe9('0x16')],_0x2bed77);_0x12dc63(_0x55c052[_0xbbe9('0x14')](0x1f4,_0xc7aa1d[_0xbbe9('0x16')]));});});}; \ No newline at end of file +var _0x56bd=['code','message','result','GetCmHopperBlack','CmHopperBlack','options','attributes','limit','include','map','model','stringify','catch','UpdateCmHopperBlack','where','DestroyCmHopperBlack','debug','lodash','util','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','jayson/promise','client','then','info','CmHopperBlack,\x20%s,\x20%s','request\x20sent','CmHopperBlack,\x20%s,\x20%s,\x20%s','error'];(function(_0x134798,_0xd30a2e){var _0x58f124=function(_0x211fcd){while(--_0x211fcd){_0x134798['push'](_0x134798['shift']());}};_0x58f124(++_0xd30a2e);}(_0x56bd,0x14c));var _0xd56b=function(_0x393c9e,_0x1cad84){_0x393c9e=_0x393c9e-0x0;var _0x3445ac=_0x56bd[_0x393c9e];return _0x3445ac;};'use strict';var _=require(_0xd56b('0x0'));var util=require(_0xd56b('0x1'));var moment=require(_0xd56b('0x2'));var BPromise=require(_0xd56b('0x3'));var rs=require(_0xd56b('0x4'));var fs=require('fs');var Redis=require(_0xd56b('0x5'));var db=require(_0xd56b('0x6'))['db'];var utils=require(_0xd56b('0x7'));var logger=require(_0xd56b('0x8'))(_0xd56b('0x9'));var config=require('../../config/environment');var jayson=require(_0xd56b('0xa'));var client=jayson[_0xd56b('0xb')]['http']({'port':0x232a});function respondWithRpcPromise(_0x4ffbf8,_0x237020,_0x3003af){return new BPromise(function(_0x1c91c1,_0x367519){return client['request'](_0x4ffbf8,_0x3003af)[_0xd56b('0xc')](function(_0x13dc65){logger[_0xd56b('0xd')](_0xd56b('0xe'),_0x237020,_0xd56b('0xf'));logger['debug'](_0xd56b('0x10'),_0x237020,'request\x20sent',JSON['stringify'](_0x13dc65));if(_0x13dc65[_0xd56b('0x11')]){if(_0x13dc65[_0xd56b('0x11')][_0xd56b('0x12')]===0x1f4){logger[_0xd56b('0x11')]('CmHopperBlack,\x20%s,\x20%s',_0x237020,_0x13dc65['error'][_0xd56b('0x13')]);return _0x367519(_0x13dc65[_0xd56b('0x11')][_0xd56b('0x13')]);}logger[_0xd56b('0x11')](_0xd56b('0xe'),_0x237020,_0x13dc65[_0xd56b('0x11')]['message']);return _0x1c91c1(_0x13dc65[_0xd56b('0x11')]['message']);}else{logger['info'](_0xd56b('0xe'),_0x237020,_0xd56b('0xf'));_0x1c91c1(_0x13dc65[_0xd56b('0x14')]['message']);}})['catch'](function(_0x583bc1){logger[_0xd56b('0x11')](_0xd56b('0xe'),_0x237020,_0x583bc1);_0x367519(_0x583bc1);});});}exports[_0xd56b('0x15')]=function(_0xd703f2){var _0x38244e=this;return new Promise(function(_0x4a97cd,_0x3e16a8){return db[_0xd56b('0x16')]['findAll']({'raw':_0xd703f2[_0xd56b('0x17')]?_0xd703f2[_0xd56b('0x17')]['raw']===undefined?!![]:![]:!![],'where':_0xd703f2['options']?_0xd703f2[_0xd56b('0x17')]['where']||null:null,'attributes':_0xd703f2[_0xd56b('0x17')]?_0xd703f2['options'][_0xd56b('0x18')]||null:null,'limit':_0xd703f2[_0xd56b('0x17')]?_0xd703f2[_0xd56b('0x17')][_0xd56b('0x19')]||null:null,'include':_0xd703f2[_0xd56b('0x17')]?_0xd703f2[_0xd56b('0x17')][_0xd56b('0x1a')]?_[_0xd56b('0x1b')](_0xd703f2[_0xd56b('0x17')][_0xd56b('0x1a')],function(_0x2c5032){return{'model':db[_0x2c5032[_0xd56b('0x1c')]],'as':_0x2c5032['as'],'attributes':_0x2c5032[_0xd56b('0x18')],'include':_0x2c5032['include']?_[_0xd56b('0x1b')](_0x2c5032[_0xd56b('0x1a')],function(_0x326b93){return{'model':db[_0x326b93[_0xd56b('0x1c')]],'as':_0x326b93['as'],'attributes':_0x326b93[_0xd56b('0x18')],'include':_0x326b93[_0xd56b('0x1a')]?_[_0xd56b('0x1b')](_0x326b93[_0xd56b('0x1a')],function(_0x4f3679){return{'model':db[_0x4f3679['model']],'as':_0x4f3679['as'],'attributes':_0x4f3679[_0xd56b('0x18')]};}):[]};}):[]};}):[]:[]})['then'](function(_0x3406f7){logger[_0xd56b('0xd')](_0xd56b('0x15'),_0xd703f2);logger['debug']('GetCmHopperBlack',_0xd703f2,JSON[_0xd56b('0x1d')](_0x3406f7));_0x4a97cd(_0x3406f7);})[_0xd56b('0x1e')](function(_0x140185){logger['error'](_0xd56b('0x15'),_0x140185[_0xd56b('0x13')],_0xd703f2);_0x3e16a8(_0x38244e[_0xd56b('0x11')](0x1f4,_0x140185[_0xd56b('0x13')]));});});};exports[_0xd56b('0x1f')]=function(_0x40d3d7){var _0x332659=this;return new Promise(function(_0x415c7d,_0x1f6b19){return db[_0xd56b('0x16')]['update'](_0x40d3d7['body'],{'raw':_0x40d3d7[_0xd56b('0x17')]?_0x40d3d7['options']['raw']===undefined?!![]:![]:!![],'individualHooks':!![],'where':_0x40d3d7['options']?_0x40d3d7[_0xd56b('0x17')][_0xd56b('0x20')]||null:null,'attributes':_0x40d3d7['options']?_0x40d3d7['options'][_0xd56b('0x18')]||null:null,'limit':_0x40d3d7[_0xd56b('0x17')]?_0x40d3d7['options'][_0xd56b('0x19')]||null:null})[_0xd56b('0xc')](function(_0x192cc1){logger[_0xd56b('0xd')]('UpdateCmHopperBlack',_0x40d3d7);logger['debug'](_0xd56b('0x1f'),_0x40d3d7,JSON[_0xd56b('0x1d')](_0x192cc1));_0x415c7d(_0x192cc1);})[_0xd56b('0x1e')](function(_0x3083e0){logger[_0xd56b('0x11')](_0xd56b('0x1f'),_0x3083e0[_0xd56b('0x13')],_0x40d3d7);_0x1f6b19(_0x332659['error'](0x1f4,_0x3083e0[_0xd56b('0x13')]));});});};exports[_0xd56b('0x21')]=function(_0xea4d8){var _0x3e1d38=this;return new Promise(function(_0x6fba8,_0x4b681b){return db[_0xd56b('0x16')]['destroy']({'where':_0xea4d8[_0xd56b('0x17')]?_0xea4d8[_0xd56b('0x17')][_0xd56b('0x20')]||null:null})[_0xd56b('0xc')](function(_0x3f6bd2){logger[_0xd56b('0xd')](_0xd56b('0x21'),_0xea4d8);logger[_0xd56b('0x22')](_0xd56b('0x21'),_0xea4d8,JSON['stringify'](_0x3f6bd2));_0x6fba8(_0x3f6bd2);})[_0xd56b('0x1e')](function(_0x564540){logger[_0xd56b('0x11')](_0xd56b('0x21'),_0x564540[_0xd56b('0x13')],_0xea4d8);_0x4b681b(_0x3e1d38['error'](0x1f4,_0x564540[_0xd56b('0x13')]));});});}; \ No newline at end of file diff --git a/server/api/cmHopperBlack/index.js b/server/api/cmHopperBlack/index.js index 458ce7d..0c68d82 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 _0xc4aa=['isAuthenticated','index','/describe','/:id','show','update','destroy','multer','util','path','connect-timeout','express','Router','../../config/environment','./cmHopperBlack.controller','get'];(function(_0x136272,_0x1e6920){var _0x51b507=function(_0xaf6982){while(--_0xaf6982){_0x136272['push'](_0x136272['shift']());}};_0x51b507(++_0x1e6920);}(_0xc4aa,0x1b7));var _0xac4a=function(_0x565ed7,_0x398228){_0x565ed7=_0x565ed7-0x0;var _0x183ad7=_0xc4aa[_0x565ed7];return _0x183ad7;};'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['put'](_0xac4a('0xc'),auth[_0xac4a('0x9')](),controller[_0xac4a('0xe')]);router['delete'](_0xac4a('0xc'),auth['isAuthenticated'](),controller[_0xac4a('0xf')]);module['exports']=router; \ No newline at end of file +var _0x5fab=['fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','./cmHopperBlack.controller','get','isAuthenticated','/describe','describe','/:id','show','update','delete','destroy','exports','multer','util','connect-timeout','express','Router'];(function(_0x400c6c,_0x3676f1){var _0x2004c3=function(_0x38fd29){while(--_0x38fd29){_0x400c6c['push'](_0x400c6c['shift']());}};_0x2004c3(++_0x3676f1);}(_0x5fab,0x177));var _0xb5fa=function(_0x5efa4b,_0x40d22c){_0x5efa4b=_0x5efa4b-0x0;var _0x1b7f87=_0x5fab[_0x5efa4b];return _0x1b7f87;};'use strict';var multer=require(_0xb5fa('0x0'));var util=require(_0xb5fa('0x1'));var path=require('path');var timeout=require(_0xb5fa('0x2'));var express=require(_0xb5fa('0x3'));var router=express[_0xb5fa('0x4')]();var fs_extra=require(_0xb5fa('0x5'));var auth=require(_0xb5fa('0x6'));var interaction=require(_0xb5fa('0x7'));var config=require(_0xb5fa('0x8'));var controller=require(_0xb5fa('0x9'));router[_0xb5fa('0xa')]('/',auth[_0xb5fa('0xb')](),controller['index']);router['get'](_0xb5fa('0xc'),auth[_0xb5fa('0xb')](),controller[_0xb5fa('0xd')]);router['get'](_0xb5fa('0xe'),auth[_0xb5fa('0xb')](),controller[_0xb5fa('0xf')]);router['put']('/:id',auth[_0xb5fa('0xb')](),controller[_0xb5fa('0x10')]);router[_0xb5fa('0x11')](_0xb5fa('0xe'),auth[_0xb5fa('0xb')](),controller[_0xb5fa('0x12')]);module[_0xb5fa('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 90f2b79..828cf94 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 _0x62d8=['BOOLEAN','sequelize','moment','exports','INTEGER','STRING','DATE','getDataValue','endtime','setDataValue','followuptime','diff','seconds'];(function(_0x5d0207,_0x4000c4){var _0xf3e249=function(_0x1a1fd9){while(--_0x1a1fd9){_0x5d0207['push'](_0x5d0207['shift']());}};_0xf3e249(++_0x4000c4);}(_0x62d8,0x146));var _0x862d=function(_0x14add3,_0x13ce8d){_0x14add3=_0x14add3-0x0;var _0x4a174f=_0x62d8[_0x14add3];return _0x4a174f;};'use strict';var Sequelize=require(_0x862d('0x0'));var moment=require(_0x862d('0x1'));module[_0x862d('0x2')]={'state':{'type':Sequelize[_0x862d('0x3')](0x2)},'statedesc':{'type':Sequelize[_0x862d('0x4')]},'scheduledat':{'type':Sequelize[_0x862d('0x5')]},'countbusyretry':{'type':Sequelize['INTEGER'],'defaultValue':0x0},'countcongestionretry':{'type':Sequelize[_0x862d('0x3')],'defaultValue':0x0},'countnoanswerretry':{'type':Sequelize[_0x862d('0x3')],'defaultValue':0x0},'countglobal':{'type':Sequelize[_0x862d('0x3')],'defaultValue':0x0},'uniqueid':{'type':Sequelize[_0x862d('0x4')]},'originatecalleridnum':{'type':Sequelize[_0x862d('0x4')]},'originatecalleridname':{'type':Sequelize[_0x862d('0x4')]},'calleridnum':{'type':Sequelize[_0x862d('0x4')]},'calleridname':{'type':Sequelize['STRING']},'starttime':{'type':Sequelize[_0x862d('0x5')]},'responsetime':{'type':Sequelize[_0x862d('0x5')]},'answertime':{'type':Sequelize[_0x862d('0x5')]},'droptime':{'type':Sequelize['DATE']},'endtime':{'type':Sequelize[_0x862d('0x5')]},'ringtime':{'type':Sequelize[_0x862d('0x3')],'defaultValue':0x0},'holdtime':{'type':Sequelize['INTEGER'],'defaultValue':0x0},'talktime':{'type':Sequelize[_0x862d('0x3')],'defaultValue':0x0},'followuptime':{'type':Sequelize['INTEGER'],'defaultValue':0x0},'dropreason':{'type':Sequelize[_0x862d('0x4')]},'campaign':{'type':Sequelize['STRING']},'campaigntype':{'type':Sequelize[_0x862d('0x4')]},'membername':{'type':Sequelize[_0x862d('0x4')]},'reason':{'type':Sequelize[_0x862d('0x4')]},'disposition':{'type':Sequelize['STRING']},'secondDisposition':{'type':Sequelize[_0x862d('0x4')]},'thirdDisposition':{'type':Sequelize[_0x862d('0x4')]},'dispositionat':{'type':Sequelize[_0x862d('0x5')],'set':function(_0x433e29){var _0x14521b=this[_0x862d('0x6')](_0x862d('0x7'));if(_0x14521b&&_0x433e29){this[_0x862d('0x8')](_0x862d('0x9'),moment(_0x433e29)[_0x862d('0xa')](moment(_0x14521b),_0x862d('0xb')));}}},'amd':{'type':Sequelize[_0x862d('0xc')],'defaultValue':![]},'fax':{'type':Sequelize[_0x862d('0xc')],'defaultValue':![]},'blacklist':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'rescheduled':{'type':Sequelize[_0x862d('0xc')],'defaultValue':![]},'rescheduledat':{'type':Sequelize[_0x862d('0x5')]},'callback':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'callbackuniqueid':{'type':Sequelize[_0x862d('0x4')],'defaultValue':null},'callbackat':{'type':Sequelize[_0x862d('0x5')]},'deleted':{'type':Sequelize[_0x862d('0x4')],'defaultValue':null},'deletedat':{'type':Sequelize[_0x862d('0x5')]},'recallme':{'type':Sequelize[_0x862d('0xc')],'defaultValue':![]},'agiafterat':{'type':Sequelize['DATE']},'countnosuchnumberretry':{'type':Sequelize['INTEGER'],'defaultValue':0x0},'countdropretry':{'type':Sequelize[_0x862d('0x3')],'defaultValue':0x0},'countabandonedretry':{'type':Sequelize[_0x862d('0x3')],'defaultValue':0x0},'countmachineretry':{'type':Sequelize[_0x862d('0x3')],'defaultValue':0x0},'countagentrejectretry':{'type':Sequelize[_0x862d('0x3')],'defaultValue':0x0}}; \ No newline at end of file +var _0x39f2=['DATE','endtime','setDataValue','followuptime','diff','BOOLEAN','exports','INTEGER','STRING'];(function(_0x2e1842,_0x1fc97a){var _0x457f13=function(_0x3b9afa){while(--_0x3b9afa){_0x2e1842['push'](_0x2e1842['shift']());}};_0x457f13(++_0x1fc97a);}(_0x39f2,0x8d));var _0x239f=function(_0x989e46,_0x90194b){_0x989e46=_0x989e46-0x0;var _0x521aef=_0x39f2[_0x989e46];return _0x521aef;};'use strict';var Sequelize=require('sequelize');var moment=require('moment');module[_0x239f('0x0')]={'state':{'type':Sequelize[_0x239f('0x1')](0x2)},'statedesc':{'type':Sequelize[_0x239f('0x2')]},'scheduledat':{'type':Sequelize[_0x239f('0x3')]},'countbusyretry':{'type':Sequelize[_0x239f('0x1')],'defaultValue':0x0},'countcongestionretry':{'type':Sequelize[_0x239f('0x1')],'defaultValue':0x0},'countnoanswerretry':{'type':Sequelize[_0x239f('0x1')],'defaultValue':0x0},'countglobal':{'type':Sequelize[_0x239f('0x1')],'defaultValue':0x0},'uniqueid':{'type':Sequelize[_0x239f('0x2')]},'originatecalleridnum':{'type':Sequelize[_0x239f('0x2')]},'originatecalleridname':{'type':Sequelize[_0x239f('0x2')]},'calleridnum':{'type':Sequelize['STRING']},'calleridname':{'type':Sequelize['STRING']},'starttime':{'type':Sequelize[_0x239f('0x3')]},'responsetime':{'type':Sequelize['DATE']},'answertime':{'type':Sequelize[_0x239f('0x3')]},'droptime':{'type':Sequelize[_0x239f('0x3')]},'endtime':{'type':Sequelize[_0x239f('0x3')]},'ringtime':{'type':Sequelize['INTEGER'],'defaultValue':0x0},'holdtime':{'type':Sequelize[_0x239f('0x1')],'defaultValue':0x0},'talktime':{'type':Sequelize[_0x239f('0x1')],'defaultValue':0x0},'followuptime':{'type':Sequelize[_0x239f('0x1')],'defaultValue':0x0},'dropreason':{'type':Sequelize[_0x239f('0x2')]},'campaign':{'type':Sequelize[_0x239f('0x2')]},'campaigntype':{'type':Sequelize[_0x239f('0x2')]},'membername':{'type':Sequelize['STRING']},'reason':{'type':Sequelize[_0x239f('0x2')]},'disposition':{'type':Sequelize[_0x239f('0x2')]},'secondDisposition':{'type':Sequelize[_0x239f('0x2')]},'thirdDisposition':{'type':Sequelize[_0x239f('0x2')]},'dispositionat':{'type':Sequelize[_0x239f('0x3')],'set':function(_0x6ac54b){var _0x298533=this['getDataValue'](_0x239f('0x4'));if(_0x298533&&_0x6ac54b){this[_0x239f('0x5')](_0x239f('0x6'),moment(_0x6ac54b)[_0x239f('0x7')](moment(_0x298533),'seconds'));}}},'amd':{'type':Sequelize[_0x239f('0x8')],'defaultValue':![]},'fax':{'type':Sequelize[_0x239f('0x8')],'defaultValue':![]},'blacklist':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'rescheduled':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'rescheduledat':{'type':Sequelize['DATE']},'callback':{'type':Sequelize[_0x239f('0x8')],'defaultValue':![]},'callbackuniqueid':{'type':Sequelize[_0x239f('0x2')],'defaultValue':null},'callbackat':{'type':Sequelize['DATE']},'deleted':{'type':Sequelize['STRING'],'defaultValue':null},'deletedat':{'type':Sequelize[_0x239f('0x3')]},'recallme':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'agiafterat':{'type':Sequelize[_0x239f('0x3')]},'countnosuchnumberretry':{'type':Sequelize[_0x239f('0x1')],'defaultValue':0x0},'countdropretry':{'type':Sequelize[_0x239f('0x1')],'defaultValue':0x0},'countabandonedretry':{'type':Sequelize[_0x239f('0x1')],'defaultValue':0x0},'countmachineretry':{'type':Sequelize[_0x239f('0x1')],'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 e340aee..6b94911 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 _0x4819=['send','map','CmHopperFinal','rawAttributes','type','key','model','query','intersection','attributes','fields','hasOwnProperty','nolimit','order','sort','where','filter','merge','options','count','includeAll','include','catch','show','keys','find','describe','body','uniqueid','countContactsQueueCampaignHopperFinal','findAll','params','sequelize','COUNT','literal','`state`\x20=\x200,\x201,\x20null','noSuchContacts','`state`\x20=\x205,\x201,\x20null','busyContacts','congestionContacts','`state`\x20=\x2010\x20,\x201,\x20null','dropContacts','`state`\x20=\x2011\x20,\x201,\x20null','abandonedContacts','reCallContacts','`state`\x20=\x2019,\x201,\x20null','answeringMachine','countContactsIvrCampaignHopperFinal','VoiceQueue','insert','cm_hopper','fromQuery','phone','scheduledAt','ContactId','ListId','VoiceQueueId','createdAt','updatedAt','select','field','ANY_VALUE(calleridnum)','NOW()','ANY_VALUE(ContactId)','ANY_VALUE(ListId)','from','VoiceQueueId\x20=\x20?','toString','state\x20=\x20?','state','calleridnum\x20NOT\x20IN\x20(?)','calleridnum','cm_hopper_final','state\x20=\x204','group','moveContactsIvrCampaignHopperFinal','Campaign','into','ANY_VALUE(CampaignId)','CampaignId\x20=\x20?','calleridnum\x20IS\x20NOT\x20NULL','CmHopper','rimraf','zip-dir','fast-json-patch','request-promise','moment','bluebird','mustache','util','path','sox','ejs','squel','crypto','jsforce','desk.js','to-csv','papaparse','../../components/auth/service','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','sendStatus','status','end','undefined','limit','offset','set','Content-Range','apply','reject','update','then','destroy','stack','name'];(function(_0x37b2fc,_0x1fda85){var _0x20e653=function(_0x486764){while(--_0x486764){_0x37b2fc['push'](_0x37b2fc['shift']());}};_0x20e653(++_0x1fda85);}(_0x4819,0xcd));var _0x9481=function(_0x5c4d27,_0x5b0822){_0x5c4d27=_0x5c4d27-0x0;var _0x1dda1a=_0x4819[_0x5c4d27];return _0x1dda1a;};'use strict';var emlformat=require('eml-format');var rimraf=require(_0x9481('0x0'));var zipdir=require(_0x9481('0x1'));var jsonpatch=require(_0x9481('0x2'));var rp=require(_0x9481('0x3'));var moment=require(_0x9481('0x4'));var BPromise=require(_0x9481('0x5'));var Mustache=require(_0x9481('0x6'));var util=require(_0x9481('0x7'));var path=require(_0x9481('0x8'));var sox=require(_0x9481('0x9'));var csv=require('to-csv');var ejs=require(_0x9481('0xa'));var fs=require('fs');var fs_extra=require('fs-extra');var _=require('lodash');var squel=require(_0x9481('0xb'));var crypto=require(_0x9481('0xc'));var jsforce=require(_0x9481('0xd'));var deskjs=require(_0x9481('0xe'));var toCsv=require(_0x9481('0xf'));var querystring=require('querystring');var Papa=require(_0x9481('0x10'));var Redis=require('ioredis');var authService=require(_0x9481('0x11'));var qs=require('../../components/parsers/qs');var as=require(_0x9481('0x12'));var hardwareService=require(_0x9481('0x13'));var logger=require(_0x9481('0x14'))(_0x9481('0x15'));var utils=require(_0x9481('0x16'));var config=require(_0x9481('0x17'));var licenseUtil=require(_0x9481('0x18'));var db=require(_0x9481('0x19'))['db'];function respondWithStatusCode(_0xed8e9,_0x499b87){_0x499b87=_0x499b87||0xcc;return function(_0x5aac02){if(_0x5aac02){return _0xed8e9[_0x9481('0x1a')](_0x499b87);}return _0xed8e9[_0x9481('0x1b')](_0x499b87)[_0x9481('0x1c')]();};}function respondWithResult(_0x28fcb6,_0x3d23c2){_0x3d23c2=_0x3d23c2||0xc8;return function(_0xc7a0b5){if(_0xc7a0b5){return _0x28fcb6[_0x9481('0x1b')](_0x3d23c2)['json'](_0xc7a0b5);}};}function respondWithFilteredResult(_0x4220f1,_0x7a7ee){return function(_0x5b1fe6){if(_0x5b1fe6){var _0x2266d5=typeof _0x7a7ee['offset']===_0x9481('0x1d')&&typeof _0x7a7ee[_0x9481('0x1e')]===_0x9481('0x1d');var _0x2bb2a4=_0x5b1fe6['count'];var _0x5eda66=_0x2266d5?0x0:_0x7a7ee[_0x9481('0x1f')];var _0x50a559=_0x2266d5?_0x5b1fe6['count']:_0x7a7ee[_0x9481('0x1f')]+_0x7a7ee[_0x9481('0x1e')];var _0x18c6f5;if(_0x50a559>=_0x2bb2a4){_0x50a559=_0x2bb2a4;_0x18c6f5=0xc8;}else{_0x18c6f5=0xce;}_0x4220f1[_0x9481('0x1b')](_0x18c6f5);return _0x4220f1[_0x9481('0x20')](_0x9481('0x21'),_0x5eda66+'-'+_0x50a559+'/'+_0x2bb2a4)['json'](_0x5b1fe6);}return null;};}function patchUpdates(_0x2cf1aa){return function(_0x272a84){try{jsonpatch[_0x9481('0x22')](_0x272a84,_0x2cf1aa,!![]);}catch(_0x615e02){return BPromise[_0x9481('0x23')](_0x615e02);}return _0x272a84['save']();};}function saveUpdates(_0x215dd7,_0x294908){return function(_0x572599){if(_0x572599){return _0x572599[_0x9481('0x24')](_0x215dd7)[_0x9481('0x25')](function(_0x352b3a){return _0x352b3a;});}return null;};}function removeEntity(_0x1809d2,_0x2dc02e){return function(_0x49ecfa){if(_0x49ecfa){return _0x49ecfa[_0x9481('0x26')]()[_0x9481('0x25')](function(){_0x1809d2['status'](0xcc)['end']();});}};}function handleEntityNotFound(_0x12b0c3,_0x299e28){return function(_0x550fce){if(!_0x550fce){_0x12b0c3[_0x9481('0x1a')](0x194);}return _0x550fce;};}function handleError(_0x20ff9a,_0xeff0a5){_0xeff0a5=_0xeff0a5||0x1f4;return function(_0x28ae1b){logger['error'](_0x28ae1b[_0x9481('0x27')]);if(_0x28ae1b[_0x9481('0x28')]){delete _0x28ae1b[_0x9481('0x28')];}_0x20ff9a['status'](_0xeff0a5)[_0x9481('0x29')](_0x28ae1b);};}exports['index']=function(_0x2e1eff,_0xe153ab){var _0x22ab26={},_0x13ef93={},_0x2e5e63={'count':0x0,'rows':[]};var _0x53560d=_[_0x9481('0x2a')](db[_0x9481('0x2b')][_0x9481('0x2c')],function(_0x4895a0){return{'name':_0x4895a0['fieldName'],'type':_0x4895a0[_0x9481('0x2d')][_0x9481('0x2e')]};});_0x13ef93[_0x9481('0x2f')]=_[_0x9481('0x2a')](_0x53560d,'name');_0x13ef93['query']=_['keys'](_0x2e1eff[_0x9481('0x30')]);_0x13ef93['filters']=_[_0x9481('0x31')](_0x13ef93['model'],_0x13ef93[_0x9481('0x30')]);_0x22ab26[_0x9481('0x32')]=_[_0x9481('0x31')](_0x13ef93[_0x9481('0x2f')],qs[_0x9481('0x33')](_0x2e1eff['query'][_0x9481('0x33')]));_0x22ab26[_0x9481('0x32')]=_0x22ab26[_0x9481('0x32')]['length']?_0x22ab26[_0x9481('0x32')]:_0x13ef93[_0x9481('0x2f')];if(!_0x2e1eff[_0x9481('0x30')][_0x9481('0x34')](_0x9481('0x35'))){_0x22ab26[_0x9481('0x1e')]=qs['limit'](_0x2e1eff[_0x9481('0x30')]['limit']);_0x22ab26[_0x9481('0x1f')]=qs[_0x9481('0x1f')](_0x2e1eff[_0x9481('0x30')][_0x9481('0x1f')]);}_0x22ab26[_0x9481('0x36')]=qs[_0x9481('0x37')](_0x2e1eff['query'][_0x9481('0x37')]);_0x22ab26[_0x9481('0x38')]=qs['filters'](_['pick'](_0x2e1eff[_0x9481('0x30')],_0x13ef93['filters']),_0x53560d);if(_0x2e1eff[_0x9481('0x30')][_0x9481('0x39')]){_0x22ab26[_0x9481('0x38')]=_[_0x9481('0x3a')](_0x22ab26['where'],{'$or':_[_0x9481('0x2a')](_0x53560d,function(_0x590d50){if(_0x590d50[_0x9481('0x2d')]!=='VIRTUAL'){var _0x2ce972={};_0x2ce972[_0x590d50['name']]={'$like':'%'+_0x2e1eff[_0x9481('0x30')][_0x9481('0x39')]+'%'};return _0x2ce972;}})});}_0x22ab26=_[_0x9481('0x3a')]({},_0x22ab26,_0x2e1eff[_0x9481('0x3b')]);var _0x97dc3e={'where':_0x22ab26[_0x9481('0x38')]};return db[_0x9481('0x2b')]['count'](_0x97dc3e)[_0x9481('0x25')](function(_0x3857e8){_0x2e5e63[_0x9481('0x3c')]=_0x3857e8;if(_0x2e1eff[_0x9481('0x30')][_0x9481('0x3d')]){_0x22ab26[_0x9481('0x3e')]=[{'all':!![]}];}return db[_0x9481('0x2b')]['findAll'](_0x22ab26);})[_0x9481('0x25')](function(_0x1872ff){_0x2e5e63['rows']=_0x1872ff;return _0x2e5e63;})[_0x9481('0x25')](respondWithFilteredResult(_0xe153ab,_0x22ab26))[_0x9481('0x3f')](handleError(_0xe153ab,null));};exports[_0x9481('0x40')]=function(_0x3eb9ee,_0x29a8e9){var _0x5a8ffd={'raw':!![],'where':{'id':_0x3eb9ee['params']['id']}},_0x304791={};_0x304791[_0x9481('0x2f')]=_[_0x9481('0x41')](db['CmHopperFinal']['rawAttributes']);_0x304791[_0x9481('0x30')]=_[_0x9481('0x41')](_0x3eb9ee[_0x9481('0x30')]);_0x304791['filters']=_[_0x9481('0x31')](_0x304791[_0x9481('0x2f')],_0x304791['query']);_0x5a8ffd['attributes']=_[_0x9481('0x31')](_0x304791['model'],qs[_0x9481('0x33')](_0x3eb9ee[_0x9481('0x30')][_0x9481('0x33')]));_0x5a8ffd[_0x9481('0x32')]=_0x5a8ffd[_0x9481('0x32')]['length']?_0x5a8ffd[_0x9481('0x32')]:_0x304791[_0x9481('0x2f')];if(_0x3eb9ee['query'][_0x9481('0x3d')]){_0x5a8ffd[_0x9481('0x3e')]=[{'all':!![]}];}_0x5a8ffd=_[_0x9481('0x3a')]({},_0x5a8ffd,_0x3eb9ee[_0x9481('0x3b')]);return db[_0x9481('0x2b')][_0x9481('0x42')](_0x5a8ffd)[_0x9481('0x25')](handleEntityNotFound(_0x29a8e9,null))[_0x9481('0x25')](respondWithResult(_0x29a8e9,null))[_0x9481('0x3f')](handleError(_0x29a8e9,null));};exports['describe']=function(_0xd36133,_0x5d3a06){return db['CmHopperFinal'][_0x9481('0x43')]()['then'](respondWithResult(_0x5d3a06,null))[_0x9481('0x3f')](handleError(_0x5d3a06,null));};exports[_0x9481('0x24')]=function(_0x47f8b2,_0x277e2a){if(_0x47f8b2[_0x9481('0x44')][_0x9481('0x45')]){delete _0x47f8b2[_0x9481('0x44')][_0x9481('0x45')];}return db[_0x9481('0x2b')]['find']({'where':{'uniqueid':_0x47f8b2['params']['id']}})[_0x9481('0x25')](handleEntityNotFound(_0x277e2a,null))[_0x9481('0x25')](saveUpdates(_0x47f8b2[_0x9481('0x44')],null))[_0x9481('0x25')](respondWithResult(_0x277e2a,null))[_0x9481('0x3f')](handleError(_0x277e2a,null));};exports[_0x9481('0x46')]=function(_0x1c070c,_0x3d2250,_0x580273){return db[_0x9481('0x2b')][_0x9481('0x47')]({'raw':![],'where':{'VoiceQueueId':_0x1c070c[_0x9481('0x48')]['id']},'attributes':[[db[_0x9481('0x49')]['fn'](_0x9481('0x4a'),db['sequelize']['fn']('IF',db['sequelize'][_0x9481('0x4b')](_0x9481('0x4c')))),_0x9481('0x4d')],[db['sequelize']['fn']('COUNT',db['sequelize']['fn']('IF',db['sequelize']['literal']('`state`\x20=\x203,\x201,\x20null'))),'noAnswerContacts'],[db[_0x9481('0x49')]['fn'](_0x9481('0x4a'),db['sequelize']['fn']('IF',db[_0x9481('0x49')]['literal'](_0x9481('0x4e')))),_0x9481('0x4f')],[db[_0x9481('0x49')]['fn'](_0x9481('0x4a'),db[_0x9481('0x49')]['fn']('IF',db[_0x9481('0x49')][_0x9481('0x4b')]('`state`\x20=\x208,\x201,\x20null'))),_0x9481('0x50')],[db[_0x9481('0x49')]['fn']('COUNT',db[_0x9481('0x49')]['fn']('IF',db[_0x9481('0x49')][_0x9481('0x4b')](_0x9481('0x51')))),_0x9481('0x52')],[db['sequelize']['fn'](_0x9481('0x4a'),db[_0x9481('0x49')]['fn']('IF',db[_0x9481('0x49')][_0x9481('0x4b')](_0x9481('0x53')))),_0x9481('0x54')],[db[_0x9481('0x49')]['fn'](_0x9481('0x4a'),db[_0x9481('0x49')]['fn']('IF',db['sequelize']['literal']('`state`\x20=\x2022,\x201,\x20null'))),_0x9481('0x55')],[db[_0x9481('0x49')]['fn']('COUNT',db[_0x9481('0x49')]['fn']('IF',db[_0x9481('0x49')][_0x9481('0x4b')](_0x9481('0x56')))),_0x9481('0x57')]]})[_0x9481('0x25')](handleEntityNotFound(_0x3d2250,null))['then'](respondWithResult(_0x3d2250,null))['catch'](handleError(_0x3d2250,null));};exports[_0x9481('0x58')]=function(_0x3cbab5,_0xb58b67,_0xe008db){return db[_0x9481('0x2b')][_0x9481('0x47')]({'raw':![],'where':{'CampaignId':_0x3cbab5['params']['id']},'attributes':[[db['sequelize']['fn'](_0x9481('0x4a'),db['sequelize']['fn']('IF',db[_0x9481('0x49')]['literal'](_0x9481('0x4c')))),_0x9481('0x4d')],[db[_0x9481('0x49')]['fn']('COUNT',db[_0x9481('0x49')]['fn']('IF',db[_0x9481('0x49')]['literal']('`state`\x20=\x203,\x201,\x20null'))),'noAnswerContacts'],[db['sequelize']['fn'](_0x9481('0x4a'),db['sequelize']['fn']('IF',db[_0x9481('0x49')][_0x9481('0x4b')](_0x9481('0x4e')))),'busyContacts'],[db[_0x9481('0x49')]['fn']('COUNT',db[_0x9481('0x49')]['fn']('IF',db[_0x9481('0x49')][_0x9481('0x4b')]('`state`\x20=\x208,\x201,\x20null'))),_0x9481('0x50')],[db[_0x9481('0x49')]['fn']('COUNT',db[_0x9481('0x49')]['fn']('IF',db[_0x9481('0x49')][_0x9481('0x4b')](_0x9481('0x51')))),_0x9481('0x52')],[db[_0x9481('0x49')]['fn'](_0x9481('0x4a'),db[_0x9481('0x49')]['fn']('IF',db[_0x9481('0x49')][_0x9481('0x4b')](_0x9481('0x53')))),_0x9481('0x54')],[db[_0x9481('0x49')]['fn'](_0x9481('0x4a'),db[_0x9481('0x49')]['fn']('IF',db[_0x9481('0x49')][_0x9481('0x4b')]('`state`\x20=\x2022,\x201,\x20null'))),_0x9481('0x55')],[db['sequelize']['fn']('COUNT',db[_0x9481('0x49')]['fn']('IF',db['sequelize']['literal']('`state`\x20=\x2019,\x201,\x20null'))),_0x9481('0x57')]]})[_0x9481('0x25')](handleEntityNotFound(_0xb58b67,null))[_0x9481('0x25')](respondWithResult(_0xb58b67,null))[_0x9481('0x3f')](handleError(_0xb58b67,null));};exports['moveContactsQueueCampaignHopperFinal']=function(_0xa83176,_0x265f1c,_0x2a053a){return db[_0x9481('0x59')]['find']({'where':{'id':_0xa83176['params']['id']}})[_0x9481('0x25')](handleEntityNotFound(_0x265f1c,null))[_0x9481('0x25')](function(_0x193992){var _0x380f2a;if(_0x193992){_0x380f2a=squel[_0x9481('0x5a')]()['into'](_0x9481('0x5b'))[_0x9481('0x5c')]([_0x9481('0x5d'),_0x9481('0x5e'),_0x9481('0x5f'),_0x9481('0x60'),_0x9481('0x61'),_0x9481('0x62'),_0x9481('0x63')],squel[_0x9481('0x64')]()[_0x9481('0x65')](_0x9481('0x66'),_0x9481('0x5d'))[_0x9481('0x65')](_0x9481('0x67'),'scheduledAt')[_0x9481('0x65')](_0x9481('0x68'),_0x9481('0x5f'))[_0x9481('0x65')](_0x9481('0x69'),_0x9481('0x60'))[_0x9481('0x65')]('ANY_VALUE(VoiceQueueId)',_0x9481('0x61'))[_0x9481('0x65')]('NOW()','createdAt')[_0x9481('0x65')]('NOW()','updatedAt')[_0x9481('0x6a')]('cm_hopper_final')[_0x9481('0x38')](_0x9481('0x6b'),_0xa83176[_0x9481('0x48')]['id'][_0x9481('0x6c')]())['where'](_0x9481('0x6d'),_0xa83176['body'][_0x9481('0x6e')][_0x9481('0x6c')]())[_0x9481('0x38')]('calleridnum\x20IS\x20NOT\x20NULL')['where']('calleridnum\x20NOT\x20IN\x20(?)',squel[_0x9481('0x64')]()['field']('phone')[_0x9481('0x6a')](_0x9481('0x5b'))[_0x9481('0x38')]('VoiceQueueId\x20=\x20?',_0xa83176[_0x9481('0x48')]['id'][_0x9481('0x6c')]()))['where'](_0x9481('0x6f'),squel[_0x9481('0x64')]()[_0x9481('0x65')](_0x9481('0x70'))['from'](_0x9481('0x71'))['where'](_0x9481('0x6b'),_0xa83176[_0x9481('0x48')]['id']['toString']())[_0x9481('0x38')](_0x9481('0x72')))[_0x9481('0x73')]('ContactId'))['toString']();return db[_0x9481('0x49')]['query'](_0x380f2a);}return[];})[_0x9481('0x25')](respondWithResult(_0x265f1c,null))[_0x9481('0x3f')](handleError(_0x265f1c,null));};exports[_0x9481('0x74')]=function(_0x55b428,_0x3f74f1,_0x287d06){return db[_0x9481('0x75')]['find']({'where':{'id':_0x55b428[_0x9481('0x48')]['id']}})[_0x9481('0x25')](handleEntityNotFound(_0x3f74f1,null))[_0x9481('0x25')](function(_0x32b30f){var _0x347da1;if(_0x32b30f){_0x347da1=squel[_0x9481('0x5a')]()[_0x9481('0x76')](_0x9481('0x5b'))[_0x9481('0x5c')]([_0x9481('0x5d'),'scheduledAt',_0x9481('0x5f'),'ListId','CampaignId','createdAt',_0x9481('0x63')],squel[_0x9481('0x64')]()[_0x9481('0x65')](_0x9481('0x66'),_0x9481('0x5d'))['field'](_0x9481('0x67'),_0x9481('0x5e'))[_0x9481('0x65')](_0x9481('0x68'),_0x9481('0x5f'))[_0x9481('0x65')](_0x9481('0x69'),_0x9481('0x60'))[_0x9481('0x65')](_0x9481('0x77'),'CampaignId')[_0x9481('0x65')](_0x9481('0x67'),_0x9481('0x62'))[_0x9481('0x65')](_0x9481('0x67'),_0x9481('0x63'))[_0x9481('0x6a')](_0x9481('0x71'))[_0x9481('0x38')](_0x9481('0x78'),_0x55b428['params']['id'][_0x9481('0x6c')]())[_0x9481('0x38')](_0x9481('0x6d'),_0x55b428[_0x9481('0x44')][_0x9481('0x6e')][_0x9481('0x6c')]())[_0x9481('0x38')](_0x9481('0x79'))[_0x9481('0x38')]('calleridnum\x20NOT\x20IN\x20(?)',squel[_0x9481('0x64')]()['field']('phone')[_0x9481('0x6a')](_0x9481('0x5b'))[_0x9481('0x38')](_0x9481('0x78'),_0x55b428[_0x9481('0x48')]['id'][_0x9481('0x6c')]()))['where'](_0x9481('0x6f'),squel['select']()[_0x9481('0x65')](_0x9481('0x70'))[_0x9481('0x6a')]('cm_hopper_final')['where'](_0x9481('0x78'),_0x55b428[_0x9481('0x48')]['id'][_0x9481('0x6c')]())[_0x9481('0x38')](_0x9481('0x72')))[_0x9481('0x73')](_0x9481('0x5f')))[_0x9481('0x6c')]();return db[_0x9481('0x49')]['query'](_0x347da1);}return[];})[_0x9481('0x25')](respondWithResult(_0x3f74f1,null))[_0x9481('0x3f')](handleError(_0x3f74f1,null));};exports['checkContactHopper']=function(_0x2c53df,_0x534979,_0x616b77){return db[_0x9481('0x7a')]['findOne']({'where':{'VoiceQueueId':_0x2c53df[_0x9481('0x44')][_0x9481('0x61')],'CampaignId':_0x2c53df[_0x9481('0x44')]['CampaignId'],'ContactId':_0x2c53df[_0x9481('0x44')][_0x9481('0x5f')]}})['then'](handleEntityNotFound(_0x534979,null))[_0x9481('0x25')](function(_0x5c7602){if(_0x5c7602){return _0x5c7602;}return null;})[_0x9481('0x25')](respondWithResult(_0x534979,null))[_0x9481('0x3f')](handleError(_0x534979,null));}; \ No newline at end of file +var _0x1967=['sendStatus','end','json','offset','undefined','limit','count','set','apply','save','update','then','status','error','name','send','map','rawAttributes','fieldName','type','model','query','keys','filters','intersection','attributes','hasOwnProperty','nolimit','order','sort','where','pick','filter','merge','CmHopperFinal','includeAll','include','findAll','rows','show','params','fields','options','find','catch','describe','uniqueid','body','countContactsQueueCampaignHopperFinal','sequelize','COUNT','literal','`state`\x20=\x200,\x201,\x20null','noAnswerContacts','`state`\x20=\x205,\x201,\x20null','busyContacts','`state`\x20=\x208,\x201,\x20null','congestionContacts','`state`\x20=\x2010\x20,\x201,\x20null','dropContacts','abandonedContacts','`state`\x20=\x2022,\x201,\x20null','countContactsIvrCampaignHopperFinal','`state`\x20=\x203,\x201,\x20null','`state`\x20=\x2011\x20,\x201,\x20null','reCallContacts','answeringMachine','moveContactsQueueCampaignHopperFinal','VoiceQueue','insert','cm_hopper','fromQuery','phone','scheduledAt','ContactId','ListId','VoiceQueueId','createdAt','updatedAt','select','field','ANY_VALUE(calleridnum)','NOW()','ANY_VALUE(ContactId)','ANY_VALUE(VoiceQueueId)','from','toString','state\x20=\x20?','calleridnum\x20IS\x20NOT\x20NULL','calleridnum\x20NOT\x20IN\x20(?)','VoiceQueueId\x20=\x20?','state\x20=\x204','moveContactsIvrCampaignHopperFinal','Campaign','into','CampaignId','ANY_VALUE(ListId)','ANY_VALUE(CampaignId)','cm_hopper_final','CampaignId\x20=\x20?','state','calleridnum','group','checkContactHopper','findOne','rimraf','zip-dir','fast-json-patch','request-promise','moment','bluebird','mustache','util','path','sox','ejs','fs-extra','lodash','squel','crypto','jsforce','to-csv','querystring','papaparse','ioredis','../../components/auth/service','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb'];(function(_0x2e6b1e,_0x1dafa3){var _0x3c7ed7=function(_0x3986ae){while(--_0x3986ae){_0x2e6b1e['push'](_0x2e6b1e['shift']());}};_0x3c7ed7(++_0x1dafa3);}(_0x1967,0x173));var _0x7196=function(_0x2900a8,_0x1f63a3){_0x2900a8=_0x2900a8-0x0;var _0x37ce54=_0x1967[_0x2900a8];return _0x37ce54;};'use strict';var emlformat=require('eml-format');var rimraf=require(_0x7196('0x0'));var zipdir=require(_0x7196('0x1'));var jsonpatch=require(_0x7196('0x2'));var rp=require(_0x7196('0x3'));var moment=require(_0x7196('0x4'));var BPromise=require(_0x7196('0x5'));var Mustache=require(_0x7196('0x6'));var util=require(_0x7196('0x7'));var path=require(_0x7196('0x8'));var sox=require(_0x7196('0x9'));var csv=require('to-csv');var ejs=require(_0x7196('0xa'));var fs=require('fs');var fs_extra=require(_0x7196('0xb'));var _=require(_0x7196('0xc'));var squel=require(_0x7196('0xd'));var crypto=require(_0x7196('0xe'));var jsforce=require(_0x7196('0xf'));var deskjs=require('desk.js');var toCsv=require(_0x7196('0x10'));var querystring=require(_0x7196('0x11'));var Papa=require(_0x7196('0x12'));var Redis=require(_0x7196('0x13'));var authService=require(_0x7196('0x14'));var qs=require('../../components/parsers/qs');var as=require('../../components/parsers/advancedSearch');var hardwareService=require(_0x7196('0x15'));var logger=require(_0x7196('0x16'))(_0x7196('0x17'));var utils=require(_0x7196('0x18'));var config=require(_0x7196('0x19'));var licenseUtil=require(_0x7196('0x1a'));var db=require(_0x7196('0x1b'))['db'];function respondWithStatusCode(_0x325641,_0x24f1c3){_0x24f1c3=_0x24f1c3||0xcc;return function(_0xba707b){if(_0xba707b){return _0x325641[_0x7196('0x1c')](_0x24f1c3);}return _0x325641['status'](_0x24f1c3)[_0x7196('0x1d')]();};}function respondWithResult(_0x3feccd,_0x3545aa){_0x3545aa=_0x3545aa||0xc8;return function(_0xf098c1){if(_0xf098c1){return _0x3feccd['status'](_0x3545aa)[_0x7196('0x1e')](_0xf098c1);}};}function respondWithFilteredResult(_0x539414,_0xe32933){return function(_0x2590a6){if(_0x2590a6){var _0xf7e97=typeof _0xe32933[_0x7196('0x1f')]===_0x7196('0x20')&&typeof _0xe32933[_0x7196('0x21')]===_0x7196('0x20');var _0x1ed296=_0x2590a6[_0x7196('0x22')];var _0x32fe2b=_0xf7e97?0x0:_0xe32933[_0x7196('0x1f')];var _0x5b716a=_0xf7e97?_0x2590a6['count']:_0xe32933[_0x7196('0x1f')]+_0xe32933[_0x7196('0x21')];var _0x40418d;if(_0x5b716a>=_0x1ed296){_0x5b716a=_0x1ed296;_0x40418d=0xc8;}else{_0x40418d=0xce;}_0x539414['status'](_0x40418d);return _0x539414[_0x7196('0x23')]('Content-Range',_0x32fe2b+'-'+_0x5b716a+'/'+_0x1ed296)['json'](_0x2590a6);}return null;};}function patchUpdates(_0x296e07){return function(_0x627223){try{jsonpatch[_0x7196('0x24')](_0x627223,_0x296e07,!![]);}catch(_0x4ddf78){return BPromise['reject'](_0x4ddf78);}return _0x627223[_0x7196('0x25')]();};}function saveUpdates(_0x3cd8ff,_0x598a26){return function(_0x18649b){if(_0x18649b){return _0x18649b[_0x7196('0x26')](_0x3cd8ff)[_0x7196('0x27')](function(_0x18d389){return _0x18d389;});}return null;};}function removeEntity(_0x38b3d6,_0x549f34){return function(_0x3f8178){if(_0x3f8178){return _0x3f8178['destroy']()[_0x7196('0x27')](function(){_0x38b3d6[_0x7196('0x28')](0xcc)[_0x7196('0x1d')]();});}};}function handleEntityNotFound(_0xa69810,_0x70aa65){return function(_0x43f6a2){if(!_0x43f6a2){_0xa69810['sendStatus'](0x194);}return _0x43f6a2;};}function handleError(_0x57c404,_0x1482e5){_0x1482e5=_0x1482e5||0x1f4;return function(_0x2d284f){logger[_0x7196('0x29')](_0x2d284f['stack']);if(_0x2d284f['name']){delete _0x2d284f[_0x7196('0x2a')];}_0x57c404[_0x7196('0x28')](_0x1482e5)[_0x7196('0x2b')](_0x2d284f);};}exports['index']=function(_0x35eef9,_0x4ecea1){var _0x4fd339={},_0x59d79d={},_0x30151f={'count':0x0,'rows':[]};var _0x985727=_[_0x7196('0x2c')](db['CmHopperFinal'][_0x7196('0x2d')],function(_0x45d567){return{'name':_0x45d567[_0x7196('0x2e')],'type':_0x45d567[_0x7196('0x2f')]['key']};});_0x59d79d[_0x7196('0x30')]=_[_0x7196('0x2c')](_0x985727,_0x7196('0x2a'));_0x59d79d[_0x7196('0x31')]=_[_0x7196('0x32')](_0x35eef9[_0x7196('0x31')]);_0x59d79d[_0x7196('0x33')]=_[_0x7196('0x34')](_0x59d79d[_0x7196('0x30')],_0x59d79d[_0x7196('0x31')]);_0x4fd339[_0x7196('0x35')]=_['intersection'](_0x59d79d[_0x7196('0x30')],qs['fields'](_0x35eef9[_0x7196('0x31')]['fields']));_0x4fd339[_0x7196('0x35')]=_0x4fd339[_0x7196('0x35')]['length']?_0x4fd339[_0x7196('0x35')]:_0x59d79d[_0x7196('0x30')];if(!_0x35eef9[_0x7196('0x31')][_0x7196('0x36')](_0x7196('0x37'))){_0x4fd339['limit']=qs[_0x7196('0x21')](_0x35eef9[_0x7196('0x31')][_0x7196('0x21')]);_0x4fd339[_0x7196('0x1f')]=qs[_0x7196('0x1f')](_0x35eef9[_0x7196('0x31')]['offset']);}_0x4fd339[_0x7196('0x38')]=qs[_0x7196('0x39')](_0x35eef9[_0x7196('0x31')]['sort']);_0x4fd339[_0x7196('0x3a')]=qs[_0x7196('0x33')](_[_0x7196('0x3b')](_0x35eef9[_0x7196('0x31')],_0x59d79d[_0x7196('0x33')]),_0x985727);if(_0x35eef9[_0x7196('0x31')][_0x7196('0x3c')]){_0x4fd339[_0x7196('0x3a')]=_[_0x7196('0x3d')](_0x4fd339[_0x7196('0x3a')],{'$or':_['map'](_0x985727,function(_0x257754){if(_0x257754[_0x7196('0x2f')]!=='VIRTUAL'){var _0x186efe={};_0x186efe[_0x257754['name']]={'$like':'%'+_0x35eef9['query'][_0x7196('0x3c')]+'%'};return _0x186efe;}})});}_0x4fd339=_[_0x7196('0x3d')]({},_0x4fd339,_0x35eef9['options']);var _0x587f6f={'where':_0x4fd339[_0x7196('0x3a')]};return db[_0x7196('0x3e')][_0x7196('0x22')](_0x587f6f)['then'](function(_0x36a990){_0x30151f[_0x7196('0x22')]=_0x36a990;if(_0x35eef9[_0x7196('0x31')][_0x7196('0x3f')]){_0x4fd339[_0x7196('0x40')]=[{'all':!![]}];}return db[_0x7196('0x3e')][_0x7196('0x41')](_0x4fd339);})[_0x7196('0x27')](function(_0x5cd903){_0x30151f[_0x7196('0x42')]=_0x5cd903;return _0x30151f;})[_0x7196('0x27')](respondWithFilteredResult(_0x4ecea1,_0x4fd339))['catch'](handleError(_0x4ecea1,null));};exports[_0x7196('0x43')]=function(_0x43d4c0,_0x48178f){var _0x471915={'raw':!![],'where':{'id':_0x43d4c0[_0x7196('0x44')]['id']}},_0x471bb2={};_0x471bb2['model']=_[_0x7196('0x32')](db[_0x7196('0x3e')]['rawAttributes']);_0x471bb2[_0x7196('0x31')]=_[_0x7196('0x32')](_0x43d4c0['query']);_0x471bb2[_0x7196('0x33')]=_['intersection'](_0x471bb2['model'],_0x471bb2['query']);_0x471915['attributes']=_['intersection'](_0x471bb2[_0x7196('0x30')],qs['fields'](_0x43d4c0[_0x7196('0x31')][_0x7196('0x45')]));_0x471915[_0x7196('0x35')]=_0x471915[_0x7196('0x35')]['length']?_0x471915[_0x7196('0x35')]:_0x471bb2['model'];if(_0x43d4c0[_0x7196('0x31')][_0x7196('0x3f')]){_0x471915[_0x7196('0x40')]=[{'all':!![]}];}_0x471915=_['merge']({},_0x471915,_0x43d4c0[_0x7196('0x46')]);return db[_0x7196('0x3e')][_0x7196('0x47')](_0x471915)['then'](handleEntityNotFound(_0x48178f,null))['then'](respondWithResult(_0x48178f,null))[_0x7196('0x48')](handleError(_0x48178f,null));};exports['describe']=function(_0x29c7e8,_0x582884){return db['CmHopperFinal'][_0x7196('0x49')]()['then'](respondWithResult(_0x582884,null))['catch'](handleError(_0x582884,null));};exports['update']=function(_0x2299e2,_0x5052ee){if(_0x2299e2['body'][_0x7196('0x4a')]){delete _0x2299e2[_0x7196('0x4b')][_0x7196('0x4a')];}return db[_0x7196('0x3e')]['find']({'where':{'uniqueid':_0x2299e2[_0x7196('0x44')]['id']}})['then'](handleEntityNotFound(_0x5052ee,null))[_0x7196('0x27')](saveUpdates(_0x2299e2[_0x7196('0x4b')],null))['then'](respondWithResult(_0x5052ee,null))[_0x7196('0x48')](handleError(_0x5052ee,null));};exports[_0x7196('0x4c')]=function(_0x3fe092,_0x4fa18f,_0x317ab6){return db['CmHopperFinal'][_0x7196('0x41')]({'raw':![],'where':{'VoiceQueueId':_0x3fe092[_0x7196('0x44')]['id']},'attributes':[[db[_0x7196('0x4d')]['fn'](_0x7196('0x4e'),db[_0x7196('0x4d')]['fn']('IF',db[_0x7196('0x4d')][_0x7196('0x4f')](_0x7196('0x50')))),'noSuchContacts'],[db['sequelize']['fn'](_0x7196('0x4e'),db[_0x7196('0x4d')]['fn']('IF',db[_0x7196('0x4d')][_0x7196('0x4f')]('`state`\x20=\x203,\x201,\x20null'))),_0x7196('0x51')],[db[_0x7196('0x4d')]['fn'](_0x7196('0x4e'),db[_0x7196('0x4d')]['fn']('IF',db[_0x7196('0x4d')][_0x7196('0x4f')](_0x7196('0x52')))),_0x7196('0x53')],[db[_0x7196('0x4d')]['fn'](_0x7196('0x4e'),db[_0x7196('0x4d')]['fn']('IF',db['sequelize'][_0x7196('0x4f')](_0x7196('0x54')))),_0x7196('0x55')],[db['sequelize']['fn'](_0x7196('0x4e'),db['sequelize']['fn']('IF',db[_0x7196('0x4d')][_0x7196('0x4f')](_0x7196('0x56')))),_0x7196('0x57')],[db[_0x7196('0x4d')]['fn']('COUNT',db[_0x7196('0x4d')]['fn']('IF',db['sequelize']['literal']('`state`\x20=\x2011\x20,\x201,\x20null'))),_0x7196('0x58')],[db[_0x7196('0x4d')]['fn'](_0x7196('0x4e'),db[_0x7196('0x4d')]['fn']('IF',db[_0x7196('0x4d')][_0x7196('0x4f')](_0x7196('0x59')))),'reCallContacts'],[db[_0x7196('0x4d')]['fn'](_0x7196('0x4e'),db[_0x7196('0x4d')]['fn']('IF',db[_0x7196('0x4d')][_0x7196('0x4f')]('`state`\x20=\x2019,\x201,\x20null'))),'answeringMachine']]})[_0x7196('0x27')](handleEntityNotFound(_0x4fa18f,null))[_0x7196('0x27')](respondWithResult(_0x4fa18f,null))[_0x7196('0x48')](handleError(_0x4fa18f,null));};exports[_0x7196('0x5a')]=function(_0x14cb38,_0x43b9ac,_0xe3fb61){return db[_0x7196('0x3e')][_0x7196('0x41')]({'raw':![],'where':{'CampaignId':_0x14cb38[_0x7196('0x44')]['id']},'attributes':[[db[_0x7196('0x4d')]['fn']('COUNT',db[_0x7196('0x4d')]['fn']('IF',db[_0x7196('0x4d')][_0x7196('0x4f')](_0x7196('0x50')))),'noSuchContacts'],[db[_0x7196('0x4d')]['fn'](_0x7196('0x4e'),db[_0x7196('0x4d')]['fn']('IF',db[_0x7196('0x4d')][_0x7196('0x4f')](_0x7196('0x5b')))),_0x7196('0x51')],[db['sequelize']['fn'](_0x7196('0x4e'),db[_0x7196('0x4d')]['fn']('IF',db[_0x7196('0x4d')][_0x7196('0x4f')]('`state`\x20=\x205,\x201,\x20null'))),_0x7196('0x53')],[db[_0x7196('0x4d')]['fn'](_0x7196('0x4e'),db[_0x7196('0x4d')]['fn']('IF',db[_0x7196('0x4d')][_0x7196('0x4f')](_0x7196('0x54')))),'congestionContacts'],[db['sequelize']['fn']('COUNT',db[_0x7196('0x4d')]['fn']('IF',db['sequelize'][_0x7196('0x4f')](_0x7196('0x56')))),_0x7196('0x57')],[db[_0x7196('0x4d')]['fn'](_0x7196('0x4e'),db[_0x7196('0x4d')]['fn']('IF',db[_0x7196('0x4d')][_0x7196('0x4f')](_0x7196('0x5c')))),'abandonedContacts'],[db['sequelize']['fn'](_0x7196('0x4e'),db[_0x7196('0x4d')]['fn']('IF',db[_0x7196('0x4d')][_0x7196('0x4f')](_0x7196('0x59')))),_0x7196('0x5d')],[db[_0x7196('0x4d')]['fn'](_0x7196('0x4e'),db['sequelize']['fn']('IF',db['sequelize'][_0x7196('0x4f')]('`state`\x20=\x2019,\x201,\x20null'))),_0x7196('0x5e')]]})['then'](handleEntityNotFound(_0x43b9ac,null))[_0x7196('0x27')](respondWithResult(_0x43b9ac,null))[_0x7196('0x48')](handleError(_0x43b9ac,null));};exports[_0x7196('0x5f')]=function(_0x267903,_0x5ab6ae,_0x5a786a){return db[_0x7196('0x60')]['find']({'where':{'id':_0x267903[_0x7196('0x44')]['id']}})[_0x7196('0x27')](handleEntityNotFound(_0x5ab6ae,null))[_0x7196('0x27')](function(_0x38c1b3){var _0xd4c784;if(_0x38c1b3){_0xd4c784=squel[_0x7196('0x61')]()['into'](_0x7196('0x62'))[_0x7196('0x63')]([_0x7196('0x64'),_0x7196('0x65'),_0x7196('0x66'),_0x7196('0x67'),_0x7196('0x68'),_0x7196('0x69'),_0x7196('0x6a')],squel[_0x7196('0x6b')]()[_0x7196('0x6c')](_0x7196('0x6d'),'phone')[_0x7196('0x6c')](_0x7196('0x6e'),'scheduledAt')['field'](_0x7196('0x6f'),_0x7196('0x66'))[_0x7196('0x6c')]('ANY_VALUE(ListId)',_0x7196('0x67'))['field'](_0x7196('0x70'),_0x7196('0x68'))['field'](_0x7196('0x6e'),'createdAt')['field'](_0x7196('0x6e'),_0x7196('0x6a'))[_0x7196('0x71')]('cm_hopper_final')[_0x7196('0x3a')]('VoiceQueueId\x20=\x20?',_0x267903[_0x7196('0x44')]['id'][_0x7196('0x72')]())[_0x7196('0x3a')](_0x7196('0x73'),_0x267903[_0x7196('0x4b')]['state'][_0x7196('0x72')]())[_0x7196('0x3a')](_0x7196('0x74'))[_0x7196('0x3a')](_0x7196('0x75'),squel[_0x7196('0x6b')]()[_0x7196('0x6c')](_0x7196('0x64'))['from'](_0x7196('0x62'))[_0x7196('0x3a')](_0x7196('0x76'),_0x267903[_0x7196('0x44')]['id']['toString']()))[_0x7196('0x3a')](_0x7196('0x75'),squel['select']()[_0x7196('0x6c')]('calleridnum')[_0x7196('0x71')]('cm_hopper_final')[_0x7196('0x3a')](_0x7196('0x76'),_0x267903['params']['id'][_0x7196('0x72')]())[_0x7196('0x3a')](_0x7196('0x77')))['group']('ContactId'))[_0x7196('0x72')]();return db['sequelize']['query'](_0xd4c784);}return[];})[_0x7196('0x27')](respondWithResult(_0x5ab6ae,null))[_0x7196('0x48')](handleError(_0x5ab6ae,null));};exports[_0x7196('0x78')]=function(_0x509c4a,_0x35c5b3,_0x59370b){return db[_0x7196('0x79')][_0x7196('0x47')]({'where':{'id':_0x509c4a[_0x7196('0x44')]['id']}})[_0x7196('0x27')](handleEntityNotFound(_0x35c5b3,null))[_0x7196('0x27')](function(_0x8673e){var _0x32ba47;if(_0x8673e){_0x32ba47=squel[_0x7196('0x61')]()[_0x7196('0x7a')]('cm_hopper')['fromQuery']([_0x7196('0x64'),'scheduledAt','ContactId',_0x7196('0x67'),_0x7196('0x7b'),_0x7196('0x69'),_0x7196('0x6a')],squel['select']()['field'](_0x7196('0x6d'),_0x7196('0x64'))[_0x7196('0x6c')](_0x7196('0x6e'),'scheduledAt')[_0x7196('0x6c')]('ANY_VALUE(ContactId)','ContactId')[_0x7196('0x6c')](_0x7196('0x7c'),_0x7196('0x67'))['field'](_0x7196('0x7d'),_0x7196('0x7b'))[_0x7196('0x6c')](_0x7196('0x6e'),_0x7196('0x69'))[_0x7196('0x6c')](_0x7196('0x6e'),_0x7196('0x6a'))['from'](_0x7196('0x7e'))[_0x7196('0x3a')](_0x7196('0x7f'),_0x509c4a[_0x7196('0x44')]['id'][_0x7196('0x72')]())['where'](_0x7196('0x73'),_0x509c4a[_0x7196('0x4b')][_0x7196('0x80')]['toString']())[_0x7196('0x3a')]('calleridnum\x20IS\x20NOT\x20NULL')['where'](_0x7196('0x75'),squel[_0x7196('0x6b')]()['field'](_0x7196('0x64'))[_0x7196('0x71')]('cm_hopper')[_0x7196('0x3a')](_0x7196('0x7f'),_0x509c4a[_0x7196('0x44')]['id'][_0x7196('0x72')]()))[_0x7196('0x3a')](_0x7196('0x75'),squel['select']()[_0x7196('0x6c')](_0x7196('0x81'))[_0x7196('0x71')]('cm_hopper_final')['where']('CampaignId\x20=\x20?',_0x509c4a[_0x7196('0x44')]['id'][_0x7196('0x72')]())[_0x7196('0x3a')]('state\x20=\x204'))[_0x7196('0x82')]('ContactId'))[_0x7196('0x72')]();return db['sequelize'][_0x7196('0x31')](_0x32ba47);}return[];})[_0x7196('0x27')](respondWithResult(_0x35c5b3,null))[_0x7196('0x48')](handleError(_0x35c5b3,null));};exports[_0x7196('0x83')]=function(_0x37290e,_0x10b628,_0x43e7d5){return db['CmHopper'][_0x7196('0x84')]({'where':{'VoiceQueueId':_0x37290e['body']['VoiceQueueId'],'CampaignId':_0x37290e['body']['CampaignId'],'ContactId':_0x37290e['body'][_0x7196('0x66')]}})[_0x7196('0x27')](handleEntityNotFound(_0x10b628,null))[_0x7196('0x27')](function(_0x5bab25){if(_0x5bab25){return _0x5bab25;}return null;})[_0x7196('0x27')](respondWithResult(_0x10b628,null))['catch'](handleError(_0x10b628,null));}; \ No newline at end of file diff --git a/server/api/cmHopperFinal/cmHopperFinal.model.js b/server/api/cmHopperFinal/cmHopperFinal.model.js index 00e7548..a2afbef 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 _0xd84b=['moment','bluebird','path','rimraf','../../config/environment','define','CmHopperFinal','cm_hopper_final','calleridnum','uniqueid','util','api'];(function(_0x3dd15e,_0x1f0015){var _0x231fd0=function(_0x4f680a){while(--_0x4f680a){_0x3dd15e['push'](_0x3dd15e['shift']());}};_0x231fd0(++_0x1f0015);}(_0xd84b,0x172));var _0xbd84=function(_0x30d89d,_0x5929ae){_0x30d89d=_0x30d89d-0x0;var _0x20c7ad=_0xd84b[_0x30d89d];return _0x20c7ad;};'use strict';var _=require('lodash');var util=require(_0xbd84('0x0'));var logger=require('../../config/logger')(_0xbd84('0x1'));var moment=require(_0xbd84('0x2'));var BPromise=require(_0xbd84('0x3'));var rp=require('request-promise');var fs=require('fs');var path=require(_0xbd84('0x4'));var rimraf=require(_0xbd84('0x5'));var config=require(_0xbd84('0x6'));var attributes=require('./cmHopperFinal.attributes');module['exports']=function(_0x553ea0,_0x2ec032){return _0x553ea0[_0xbd84('0x7')](_0xbd84('0x8'),attributes,{'tableName':_0xbd84('0x9'),'paranoid':![],'indexes':[{'name':_0xbd84('0xa'),'fields':['calleridnum']},{'name':_0xbd84('0xb'),'fields':[_0xbd84('0xb')]}],'timestamps':!![]});}; \ No newline at end of file +var _0xa7c6=['path','rimraf','../../config/environment','./cmHopperFinal.attributes','exports','define','CmHopperFinal','calleridnum','uniqueid','lodash','api','request-promise'];(function(_0x3433b8,_0x2b90ee){var _0x250c8a=function(_0x41211b){while(--_0x41211b){_0x3433b8['push'](_0x3433b8['shift']());}};_0x250c8a(++_0x2b90ee);}(_0xa7c6,0xa5));var _0x6a7c=function(_0x41b1d0,_0x271735){_0x41b1d0=_0x41b1d0-0x0;var _0x19d574=_0xa7c6[_0x41b1d0];return _0x19d574;};'use strict';var _=require(_0x6a7c('0x0'));var util=require('util');var logger=require('../../config/logger')(_0x6a7c('0x1'));var moment=require('moment');var BPromise=require('bluebird');var rp=require(_0x6a7c('0x2'));var fs=require('fs');var path=require(_0x6a7c('0x3'));var rimraf=require(_0x6a7c('0x4'));var config=require(_0x6a7c('0x5'));var attributes=require(_0x6a7c('0x6'));module[_0x6a7c('0x7')]=function(_0xe49247,_0x454247){return _0xe49247[_0x6a7c('0x8')](_0x6a7c('0x9'),attributes,{'tableName':'cm_hopper_final','paranoid':![],'indexes':[{'name':_0x6a7c('0xa'),'fields':[_0x6a7c('0xa')]},{'name':'uniqueid','fields':[_0x6a7c('0xb')]}],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/cmHopperFinal/cmHopperFinal.rpc.js b/server/api/cmHopperFinal/cmHopperFinal.rpc.js index 3087976..6b05f3e 100644 --- a/server/api/cmHopperFinal/cmHopperFinal.rpc.js +++ b/server/api/cmHopperFinal/cmHopperFinal.rpc.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0xb10b=['debug','lodash','moment','bluebird','randomstring','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','http','request','then','info','CmHopperFinal,\x20%s,\x20%s','CmHopperFinal,\x20%s,\x20%s,\x20%s','request\x20sent','stringify','error','message','result','CreateCmHopperFinal','CmHopperFinal','create','options','raw'];(function(_0x3104e6,_0x1eccc9){var _0x23c383=function(_0x36f68a){while(--_0x36f68a){_0x3104e6['push'](_0x3104e6['shift']());}};_0x23c383(++_0x1eccc9);}(_0xb10b,0x12a));var _0xbb10=function(_0x255840,_0x411b6e){_0x255840=_0x255840-0x0;var _0x40dad5=_0xb10b[_0x255840];return _0x40dad5;};'use strict';var _=require(_0xbb10('0x0'));var util=require('util');var moment=require(_0xbb10('0x1'));var BPromise=require(_0xbb10('0x2'));var rs=require(_0xbb10('0x3'));var fs=require('fs');var Redis=require('ioredis');var db=require(_0xbb10('0x4'))['db'];var utils=require(_0xbb10('0x5'));var logger=require(_0xbb10('0x6'))(_0xbb10('0x7'));var config=require(_0xbb10('0x8'));var jayson=require(_0xbb10('0x9'));var client=jayson['client'][_0xbb10('0xa')]({'port':0x232a});function respondWithRpcPromise(_0x3cdd53,_0x513741,_0x1b9e94){return new BPromise(function(_0x3fb675,_0x21370f){return client[_0xbb10('0xb')](_0x3cdd53,_0x1b9e94)[_0xbb10('0xc')](function(_0x1ce33e){logger[_0xbb10('0xd')](_0xbb10('0xe'),_0x513741,'request\x20sent');logger['debug'](_0xbb10('0xf'),_0x513741,_0xbb10('0x10'),JSON[_0xbb10('0x11')](_0x1ce33e));if(_0x1ce33e['error']){if(_0x1ce33e[_0xbb10('0x12')]['code']===0x1f4){logger[_0xbb10('0x12')](_0xbb10('0xe'),_0x513741,_0x1ce33e[_0xbb10('0x12')][_0xbb10('0x13')]);return _0x21370f(_0x1ce33e[_0xbb10('0x12')][_0xbb10('0x13')]);}logger['error'](_0xbb10('0xe'),_0x513741,_0x1ce33e[_0xbb10('0x12')][_0xbb10('0x13')]);return _0x3fb675(_0x1ce33e[_0xbb10('0x12')][_0xbb10('0x13')]);}else{logger[_0xbb10('0xd')](_0xbb10('0xe'),_0x513741,_0xbb10('0x10'));_0x3fb675(_0x1ce33e[_0xbb10('0x14')][_0xbb10('0x13')]);}})['catch'](function(_0x2eca0f){logger[_0xbb10('0x12')](_0xbb10('0xe'),_0x513741,_0x2eca0f);_0x21370f(_0x2eca0f);});});}exports[_0xbb10('0x15')]=function(_0x378da8){var _0x1682a4=this;return new Promise(function(_0x575cca,_0x30efc6){return db[_0xbb10('0x16')][_0xbb10('0x17')](_0x378da8['body'],{'raw':_0x378da8[_0xbb10('0x18')]?_0x378da8[_0xbb10('0x18')][_0xbb10('0x19')]===undefined?!![]:![]:!![]})[_0xbb10('0xc')](function(_0xdf237d){logger[_0xbb10('0xd')]('CreateCmHopperFinal',_0x378da8);logger[_0xbb10('0x1a')](_0xbb10('0x15'),_0x378da8,JSON['stringify'](_0xdf237d));_0x575cca(_0xdf237d);})['catch'](function(_0x8e2b97){logger[_0xbb10('0x12')](_0xbb10('0x15'),_0x8e2b97[_0xbb10('0x13')],_0x378da8);_0x30efc6(_0x1682a4[_0xbb10('0x12')](0x1f4,_0x8e2b97[_0xbb10('0x13')]));});});}; \ No newline at end of file +var _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(_0x29561e,_0x2bfdda){var _0x1fa444=function(_0x380cc5){while(--_0x380cc5){_0x29561e['push'](_0x29561e['shift']());}};_0x1fa444(++_0x2bfdda);}(_0x7a54,0x106));var _0x47a5=function(_0x1ce5d8,_0x21dd8e){_0x1ce5d8=_0x1ce5d8-0x0;var _0x36d67d=_0x7a54[_0x1ce5d8];return _0x36d67d;};'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 8d65fa6..948ca2a 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 _0x5226=['/:id','show','countContactsQueueCampaignHopperFinal','/campaign/countAttributes/:id','countContactsIvrCampaignHopperFinal','/voice/queue/moveContacts/:id','moveContactsQueueCampaignHopperFinal','post','/voice/campaign/moveContacts/:id','moveContactsIvrCampaignHopperFinal','checkContactHopper','update','exports','multer','util','path','connect-timeout','express','fs-extra','../../components/auth/service','../../components/interaction/service','./cmHopperFinal.controller','get','isAuthenticated','index','/describe','describe'];(function(_0x129d08,_0x4e1601){var _0x49d6da=function(_0xa35bb1){while(--_0xa35bb1){_0x129d08['push'](_0x129d08['shift']());}};_0x49d6da(++_0x4e1601);}(_0x5226,0x16c));var _0x6522=function(_0x1499c5,_0x436c2c){_0x1499c5=_0x1499c5-0x0;var _0x47b1bf=_0x5226[_0x1499c5];return _0x47b1bf;};'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']('/voice/queue/countAttributes/:id',auth[_0x6522('0xa')](),controller[_0x6522('0x10')]);router[_0x6522('0x9')](_0x6522('0x11'),auth[_0x6522('0xa')](),controller[_0x6522('0x12')]);router['post'](_0x6522('0x13'),auth['isAuthenticated'](),controller[_0x6522('0x14')]);router[_0x6522('0x15')](_0x6522('0x16'),auth['isAuthenticated'](),controller[_0x6522('0x17')]);router[_0x6522('0x15')]('/checkContactHopper',auth[_0x6522('0xa')](),controller[_0x6522('0x18')]);router['put']('/:id',auth['isAuthenticated'](),controller[_0x6522('0x19')]);module[_0x6522('0x1a')]=router; \ No newline at end of file +var _0x7381=['/voice/queue/moveContacts/:id','/voice/campaign/moveContacts/:id','moveContactsIvrCampaignHopperFinal','/checkContactHopper','checkContactHopper','put','update','exports','multer','connect-timeout','../../config/environment','./cmHopperFinal.controller','isAuthenticated','index','get','/describe','describe','/:id','show','/voice/queue/countAttributes/:id','countContactsQueueCampaignHopperFinal','countContactsIvrCampaignHopperFinal','post'];(function(_0xf6a67,_0x333024){var _0xa8558c=function(_0x6d4c3){while(--_0x6d4c3){_0xf6a67['push'](_0xf6a67['shift']());}};_0xa8558c(++_0x333024);}(_0x7381,0x133));var _0x1738=function(_0x55daf2,_0x1b48de){_0x55daf2=_0x55daf2-0x0;var _0x1c8500=_0x7381[_0x55daf2];return _0x1c8500;};'use strict';var multer=require(_0x1738('0x0'));var util=require('util');var path=require('path');var timeout=require(_0x1738('0x1'));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(_0x1738('0x2'));var controller=require(_0x1738('0x3'));router['get']('/',auth[_0x1738('0x4')](),controller[_0x1738('0x5')]);router[_0x1738('0x6')](_0x1738('0x7'),auth[_0x1738('0x4')](),controller[_0x1738('0x8')]);router['get'](_0x1738('0x9'),auth[_0x1738('0x4')](),controller[_0x1738('0xa')]);router[_0x1738('0x6')](_0x1738('0xb'),auth[_0x1738('0x4')](),controller[_0x1738('0xc')]);router[_0x1738('0x6')]('/campaign/countAttributes/:id',auth[_0x1738('0x4')](),controller[_0x1738('0xd')]);router[_0x1738('0xe')](_0x1738('0xf'),auth[_0x1738('0x4')](),controller['moveContactsQueueCampaignHopperFinal']);router[_0x1738('0xe')](_0x1738('0x10'),auth['isAuthenticated'](),controller[_0x1738('0x11')]);router[_0x1738('0xe')](_0x1738('0x12'),auth[_0x1738('0x4')](),controller[_0x1738('0x13')]);router[_0x1738('0x14')](_0x1738('0x9'),auth[_0x1738('0x4')](),controller[_0x1738('0x15')]);module[_0x1738('0x16')]=router; \ No newline at end of file diff --git a/server/api/cmHopperHistory/cmHopperHistory.attributes.js b/server/api/cmHopperHistory/cmHopperHistory.attributes.js index 00b9da7..d28d0b7 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 _0xbeb1=['exports','INTEGER','STRING','DATE','BOOLEAN','sequelize'];(function(_0x4ae56a,_0x185bb7){var _0x44c33e=function(_0x583650){while(--_0x583650){_0x4ae56a['push'](_0x4ae56a['shift']());}};_0x44c33e(++_0x185bb7);}(_0xbeb1,0x9b));var _0x1beb=function(_0x20a584,_0xe384a5){_0x20a584=_0x20a584-0x0;var _0x4b41a8=_0xbeb1[_0x20a584];return _0x4b41a8;};'use strict';var Sequelize=require(_0x1beb('0x0'));module[_0x1beb('0x1')]={'state':{'type':Sequelize[_0x1beb('0x2')](0x2)},'statedesc':{'type':Sequelize['STRING']},'scheduledat':{'type':Sequelize['DATE']},'countbusyretry':{'type':Sequelize[_0x1beb('0x2')],'defaultValue':0x0},'countcongestionretry':{'type':Sequelize[_0x1beb('0x2')],'defaultValue':0x0},'countnoanswerretry':{'type':Sequelize['INTEGER'],'defaultValue':0x0},'countglobal':{'type':Sequelize[_0x1beb('0x2')],'defaultValue':0x0},'uniqueid':{'type':Sequelize[_0x1beb('0x3')]},'originatecalleridnum':{'type':Sequelize[_0x1beb('0x3')]},'originatecalleridname':{'type':Sequelize[_0x1beb('0x3')]},'calleridnum':{'type':Sequelize[_0x1beb('0x3')]},'calleridname':{'type':Sequelize[_0x1beb('0x3')]},'starttime':{'type':Sequelize[_0x1beb('0x4')]},'responsetime':{'type':Sequelize[_0x1beb('0x4')]},'answertime':{'type':Sequelize[_0x1beb('0x4')]},'droptime':{'type':Sequelize[_0x1beb('0x4')]},'endtime':{'type':Sequelize['DATE']},'ringtime':{'type':Sequelize[_0x1beb('0x2')],'defaultValue':0x0},'holdtime':{'type':Sequelize[_0x1beb('0x2')],'defaultValue':0x0},'talktime':{'type':Sequelize[_0x1beb('0x2')],'defaultValue':0x0},'followuptime':{'type':Sequelize[_0x1beb('0x2')],'defaultValue':0x0},'dropreason':{'type':Sequelize[_0x1beb('0x3')]},'campaign':{'type':Sequelize[_0x1beb('0x3')]},'campaigntype':{'type':Sequelize[_0x1beb('0x3')]},'membername':{'type':Sequelize[_0x1beb('0x3')]},'reason':{'type':Sequelize[_0x1beb('0x3')]},'amd':{'type':Sequelize[_0x1beb('0x5')],'defaultValue':![]},'fax':{'type':Sequelize[_0x1beb('0x5')],'defaultValue':![]},'callback':{'type':Sequelize[_0x1beb('0x5')],'defaultValue':![]},'callbackuniqueid':{'type':Sequelize[_0x1beb('0x3')],'defaultValue':null},'callbackat':{'type':Sequelize[_0x1beb('0x4')]},'recallme':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'editedat':{'type':Sequelize[_0x1beb('0x4')]},'edited':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'countnosuchnumberretry':{'type':Sequelize['INTEGER'],'defaultValue':0x0},'countdropretry':{'type':Sequelize[_0x1beb('0x2')],'defaultValue':0x0},'countabandonedretry':{'type':Sequelize[_0x1beb('0x2')],'defaultValue':0x0},'countmachineretry':{'type':Sequelize[_0x1beb('0x2')],'defaultValue':0x0},'countagentrejectretry':{'type':Sequelize[_0x1beb('0x2')],'defaultValue':0x0},'dialTimezone':{'type':Sequelize['STRING']}}; \ No newline at end of file +var _0x1a15=['BOOLEAN','sequelize','exports','INTEGER','DATE','STRING'];(function(_0x549209,_0x30684d){var _0x5f3870=function(_0x25ee87){while(--_0x25ee87){_0x549209['push'](_0x549209['shift']());}};_0x5f3870(++_0x30684d);}(_0x1a15,0x103));var _0x51a1=function(_0x413fa3,_0x1df53f){_0x413fa3=_0x413fa3-0x0;var _0x5334eb=_0x1a15[_0x413fa3];return _0x5334eb;};'use strict';var Sequelize=require(_0x51a1('0x0'));module[_0x51a1('0x1')]={'state':{'type':Sequelize[_0x51a1('0x2')](0x2)},'statedesc':{'type':Sequelize['STRING']},'scheduledat':{'type':Sequelize[_0x51a1('0x3')]},'countbusyretry':{'type':Sequelize[_0x51a1('0x2')],'defaultValue':0x0},'countcongestionretry':{'type':Sequelize[_0x51a1('0x2')],'defaultValue':0x0},'countnoanswerretry':{'type':Sequelize[_0x51a1('0x2')],'defaultValue':0x0},'countglobal':{'type':Sequelize[_0x51a1('0x2')],'defaultValue':0x0},'uniqueid':{'type':Sequelize['STRING']},'originatecalleridnum':{'type':Sequelize[_0x51a1('0x4')]},'originatecalleridname':{'type':Sequelize[_0x51a1('0x4')]},'calleridnum':{'type':Sequelize[_0x51a1('0x4')]},'calleridname':{'type':Sequelize['STRING']},'starttime':{'type':Sequelize[_0x51a1('0x3')]},'responsetime':{'type':Sequelize[_0x51a1('0x3')]},'answertime':{'type':Sequelize['DATE']},'droptime':{'type':Sequelize['DATE']},'endtime':{'type':Sequelize[_0x51a1('0x3')]},'ringtime':{'type':Sequelize[_0x51a1('0x2')],'defaultValue':0x0},'holdtime':{'type':Sequelize[_0x51a1('0x2')],'defaultValue':0x0},'talktime':{'type':Sequelize[_0x51a1('0x2')],'defaultValue':0x0},'followuptime':{'type':Sequelize['INTEGER'],'defaultValue':0x0},'dropreason':{'type':Sequelize[_0x51a1('0x4')]},'campaign':{'type':Sequelize['STRING']},'campaigntype':{'type':Sequelize[_0x51a1('0x4')]},'membername':{'type':Sequelize[_0x51a1('0x4')]},'reason':{'type':Sequelize[_0x51a1('0x4')]},'amd':{'type':Sequelize[_0x51a1('0x5')],'defaultValue':![]},'fax':{'type':Sequelize[_0x51a1('0x5')],'defaultValue':![]},'callback':{'type':Sequelize[_0x51a1('0x5')],'defaultValue':![]},'callbackuniqueid':{'type':Sequelize[_0x51a1('0x4')],'defaultValue':null},'callbackat':{'type':Sequelize[_0x51a1('0x3')]},'recallme':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'editedat':{'type':Sequelize['DATE']},'edited':{'type':Sequelize[_0x51a1('0x5')],'defaultValue':![]},'countnosuchnumberretry':{'type':Sequelize[_0x51a1('0x2')],'defaultValue':0x0},'countdropretry':{'type':Sequelize[_0x51a1('0x2')],'defaultValue':0x0},'countabandonedretry':{'type':Sequelize[_0x51a1('0x2')],'defaultValue':0x0},'countmachineretry':{'type':Sequelize[_0x51a1('0x2')],'defaultValue':0x0},'countagentrejectretry':{'type':Sequelize['INTEGER'],'defaultValue':0x0},'dialTimezone':{'type':Sequelize[_0x51a1('0x4')]}}; \ No newline at end of file diff --git a/server/api/cmHopperHistory/cmHopperHistory.controller.js b/server/api/cmHopperHistory/cmHopperHistory.controller.js index fffe614..edaf08a 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 _0xe7c6=['api','../../config/utils','../../config/environment','status','end','json','offset','undefined','limit','count','Content-Range','apply','reject','save','update','then','destroy','stack','name','send','index','map','rawAttributes','query','keys','filters','intersection','fields','attributes','length','model','hasOwnProperty','nolimit','order','sort','where','pick','filter','merge','VIRTUAL','CmHopperHistory','includeAll','findAll','rows','include','find','catch','create','body','describe','uniqueid','params','request-promise','moment','mustache','util','path','sox','to-csv','fs-extra','lodash','squel','jsforce','querystring','papaparse','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/logger'];(function(_0x3c108a,_0xd26376){var _0x1fc219=function(_0x387457){while(--_0x387457){_0x3c108a['push'](_0x3c108a['shift']());}};_0x1fc219(++_0xd26376);}(_0xe7c6,0x18d));var _0x6e7c=function(_0x212309,_0x3ec543){_0x212309=_0x212309-0x0;var _0x56c921=_0xe7c6[_0x212309];return _0x56c921;};'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(_0x6e7c('0x0'));var moment=require(_0x6e7c('0x1'));var BPromise=require('bluebird');var Mustache=require(_0x6e7c('0x2'));var util=require(_0x6e7c('0x3'));var path=require(_0x6e7c('0x4'));var sox=require(_0x6e7c('0x5'));var csv=require(_0x6e7c('0x6'));var ejs=require('ejs');var fs=require('fs');var fs_extra=require(_0x6e7c('0x7'));var _=require(_0x6e7c('0x8'));var squel=require(_0x6e7c('0x9'));var crypto=require('crypto');var jsforce=require(_0x6e7c('0xa'));var deskjs=require('desk.js');var toCsv=require(_0x6e7c('0x6'));var querystring=require(_0x6e7c('0xb'));var Papa=require(_0x6e7c('0xc'));var Redis=require('ioredis');var authService=require(_0x6e7c('0xd'));var qs=require(_0x6e7c('0xe'));var as=require(_0x6e7c('0xf'));var hardwareService=require('../../config/license/hardware');var logger=require(_0x6e7c('0x10'))(_0x6e7c('0x11'));var utils=require(_0x6e7c('0x12'));var config=require(_0x6e7c('0x13'));var licenseUtil=require('../../config/license/util');var db=require('../../mysqldb')['db'];function respondWithStatusCode(_0x56f296,_0x401608){_0x401608=_0x401608||0xcc;return function(_0x3c959a){if(_0x3c959a){return _0x56f296['sendStatus'](_0x401608);}return _0x56f296[_0x6e7c('0x14')](_0x401608)[_0x6e7c('0x15')]();};}function respondWithResult(_0xda5137,_0xbe169b){_0xbe169b=_0xbe169b||0xc8;return function(_0x477f3e){if(_0x477f3e){return _0xda5137[_0x6e7c('0x14')](_0xbe169b)[_0x6e7c('0x16')](_0x477f3e);}};}function respondWithFilteredResult(_0x163aea,_0x1a0954){return function(_0x42114f){if(_0x42114f){var _0x2a2ed8=typeof _0x1a0954[_0x6e7c('0x17')]===_0x6e7c('0x18')&&typeof _0x1a0954[_0x6e7c('0x19')]===_0x6e7c('0x18');var _0x12ba94=_0x42114f[_0x6e7c('0x1a')];var _0x34b738=_0x2a2ed8?0x0:_0x1a0954['offset'];var _0x3b2585=_0x2a2ed8?_0x42114f['count']:_0x1a0954[_0x6e7c('0x17')]+_0x1a0954['limit'];var _0xf9c213;if(_0x3b2585>=_0x12ba94){_0x3b2585=_0x12ba94;_0xf9c213=0xc8;}else{_0xf9c213=0xce;}_0x163aea[_0x6e7c('0x14')](_0xf9c213);return _0x163aea['set'](_0x6e7c('0x1b'),_0x34b738+'-'+_0x3b2585+'/'+_0x12ba94)[_0x6e7c('0x16')](_0x42114f);}return null;};}function patchUpdates(_0x177c19){return function(_0x4eefc4){try{jsonpatch[_0x6e7c('0x1c')](_0x4eefc4,_0x177c19,!![]);}catch(_0x1b90ec){return BPromise[_0x6e7c('0x1d')](_0x1b90ec);}return _0x4eefc4[_0x6e7c('0x1e')]();};}function saveUpdates(_0x26d27d,_0x56a607){return function(_0x2bf22f){if(_0x2bf22f){return _0x2bf22f[_0x6e7c('0x1f')](_0x26d27d)[_0x6e7c('0x20')](function(_0x41a9da){return _0x41a9da;});}return null;};}function removeEntity(_0x2a5cf9,_0x382df5){return function(_0x565035){if(_0x565035){return _0x565035[_0x6e7c('0x21')]()[_0x6e7c('0x20')](function(){_0x2a5cf9[_0x6e7c('0x14')](0xcc)[_0x6e7c('0x15')]();});}};}function handleEntityNotFound(_0x17290e,_0x1b1697){return function(_0x34f7e0){if(!_0x34f7e0){_0x17290e['sendStatus'](0x194);}return _0x34f7e0;};}function handleError(_0xf74015,_0x336d4b){_0x336d4b=_0x336d4b||0x1f4;return function(_0x49218f){logger['error'](_0x49218f[_0x6e7c('0x22')]);if(_0x49218f[_0x6e7c('0x23')]){delete _0x49218f[_0x6e7c('0x23')];}_0xf74015[_0x6e7c('0x14')](_0x336d4b)[_0x6e7c('0x24')](_0x49218f);};}exports[_0x6e7c('0x25')]=function(_0x58bb7c,_0x3e7a23){var _0xc6a462={},_0x2b0fc7={},_0x379c1e={'count':0x0,'rows':[]};var _0x2ccf5b=_[_0x6e7c('0x26')](db['CmHopperHistory'][_0x6e7c('0x27')],function(_0x4fc51c){return{'name':_0x4fc51c['fieldName'],'type':_0x4fc51c['type']['key']};});_0x2b0fc7['model']=_[_0x6e7c('0x26')](_0x2ccf5b,_0x6e7c('0x23'));_0x2b0fc7[_0x6e7c('0x28')]=_[_0x6e7c('0x29')](_0x58bb7c[_0x6e7c('0x28')]);_0x2b0fc7[_0x6e7c('0x2a')]=_[_0x6e7c('0x2b')](_0x2b0fc7['model'],_0x2b0fc7['query']);_0xc6a462['attributes']=_[_0x6e7c('0x2b')](_0x2b0fc7['model'],qs[_0x6e7c('0x2c')](_0x58bb7c[_0x6e7c('0x28')][_0x6e7c('0x2c')]));_0xc6a462[_0x6e7c('0x2d')]=_0xc6a462['attributes'][_0x6e7c('0x2e')]?_0xc6a462[_0x6e7c('0x2d')]:_0x2b0fc7[_0x6e7c('0x2f')];if(!_0x58bb7c['query'][_0x6e7c('0x30')](_0x6e7c('0x31'))){_0xc6a462[_0x6e7c('0x19')]=qs[_0x6e7c('0x19')](_0x58bb7c['query'][_0x6e7c('0x19')]);_0xc6a462[_0x6e7c('0x17')]=qs[_0x6e7c('0x17')](_0x58bb7c[_0x6e7c('0x28')][_0x6e7c('0x17')]);}_0xc6a462[_0x6e7c('0x32')]=qs[_0x6e7c('0x33')](_0x58bb7c[_0x6e7c('0x28')][_0x6e7c('0x33')]);_0xc6a462[_0x6e7c('0x34')]=qs[_0x6e7c('0x2a')](_[_0x6e7c('0x35')](_0x58bb7c['query'],_0x2b0fc7['filters']),_0x2ccf5b);if(_0x58bb7c['query'][_0x6e7c('0x36')]){_0xc6a462['where']=_[_0x6e7c('0x37')](_0xc6a462[_0x6e7c('0x34')],{'$or':_[_0x6e7c('0x26')](_0x2ccf5b,function(_0x4cacab){if(_0x4cacab['type']!==_0x6e7c('0x38')){var _0x3d726a={};_0x3d726a[_0x4cacab[_0x6e7c('0x23')]]={'$like':'%'+_0x58bb7c[_0x6e7c('0x28')][_0x6e7c('0x36')]+'%'};return _0x3d726a;}})});}_0xc6a462=_['merge']({},_0xc6a462,_0x58bb7c['options']);var _0x403b88={'where':_0xc6a462[_0x6e7c('0x34')]};return db[_0x6e7c('0x39')]['count'](_0x403b88)[_0x6e7c('0x20')](function(_0x4c853a){_0x379c1e[_0x6e7c('0x1a')]=_0x4c853a;if(_0x58bb7c[_0x6e7c('0x28')][_0x6e7c('0x3a')]){_0xc6a462['include']=[{'all':!![]}];}return db[_0x6e7c('0x39')][_0x6e7c('0x3b')](_0xc6a462);})[_0x6e7c('0x20')](function(_0x290823){_0x379c1e[_0x6e7c('0x3c')]=_0x290823;return _0x379c1e;})[_0x6e7c('0x20')](respondWithFilteredResult(_0x3e7a23,_0xc6a462))['catch'](handleError(_0x3e7a23,null));};exports['show']=function(_0x544eb7,_0x3b63d4){var _0x503159={'raw':!![],'where':{'id':_0x544eb7['params']['id']}},_0x5a93e9={};_0x5a93e9[_0x6e7c('0x2f')]=_[_0x6e7c('0x29')](db[_0x6e7c('0x39')][_0x6e7c('0x27')]);_0x5a93e9[_0x6e7c('0x28')]=_[_0x6e7c('0x29')](_0x544eb7['query']);_0x5a93e9['filters']=_[_0x6e7c('0x2b')](_0x5a93e9['model'],_0x5a93e9['query']);_0x503159['attributes']=_['intersection'](_0x5a93e9[_0x6e7c('0x2f')],qs[_0x6e7c('0x2c')](_0x544eb7['query'][_0x6e7c('0x2c')]));_0x503159['attributes']=_0x503159[_0x6e7c('0x2d')][_0x6e7c('0x2e')]?_0x503159['attributes']:_0x5a93e9['model'];if(_0x544eb7[_0x6e7c('0x28')]['includeAll']){_0x503159[_0x6e7c('0x3d')]=[{'all':!![]}];}_0x503159=_['merge']({},_0x503159,_0x544eb7['options']);return db['CmHopperHistory'][_0x6e7c('0x3e')](_0x503159)['then'](handleEntityNotFound(_0x3b63d4,null))['then'](respondWithResult(_0x3b63d4,null))[_0x6e7c('0x3f')](handleError(_0x3b63d4,null));};exports[_0x6e7c('0x40')]=function(_0x1c0542,_0x4c510a){return db[_0x6e7c('0x39')][_0x6e7c('0x40')](_0x1c0542[_0x6e7c('0x41')],{})['then'](respondWithResult(_0x4c510a,0xc9))[_0x6e7c('0x3f')](handleError(_0x4c510a,null));};exports[_0x6e7c('0x42')]=function(_0x11a280,_0x4daea4){return db[_0x6e7c('0x39')][_0x6e7c('0x42')]()[_0x6e7c('0x20')](respondWithResult(_0x4daea4,null))[_0x6e7c('0x3f')](handleError(_0x4daea4,null));};exports[_0x6e7c('0x1f')]=function(_0x2d7125,_0x41ee8a){if(_0x2d7125[_0x6e7c('0x41')][_0x6e7c('0x43')]){delete _0x2d7125[_0x6e7c('0x41')][_0x6e7c('0x43')];}return db[_0x6e7c('0x39')]['find']({'where':{'uniqueid':_0x2d7125[_0x6e7c('0x44')]['id']}})[_0x6e7c('0x20')](handleEntityNotFound(_0x41ee8a,null))[_0x6e7c('0x20')](saveUpdates(_0x2d7125[_0x6e7c('0x41')],null))[_0x6e7c('0x20')](respondWithResult(_0x41ee8a,null))[_0x6e7c('0x3f')](handleError(_0x41ee8a,null));}; \ No newline at end of file +var _0xab23=['reject','save','then','destroy','end','stack','send','index','map','CmHopperHistory','rawAttributes','type','key','model','name','query','keys','filters','intersection','attributes','fields','length','nolimit','sort','where','pick','filter','merge','VIRTUAL','options','includeAll','include','findAll','rows','catch','show','params','find','create','body','describe','update','uniqueid','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','moment','mustache','util','path','sox','ejs','lodash','squel','crypto','to-csv','querystring','ioredis','../../components/parsers/advancedSearch','../../config/logger','api','../../config/utils','../../config/environment','../../config/license/util','sendStatus','status','offset','undefined','count','limit','set','Content-Range','json','apply'];(function(_0x13d38b,_0x464e40){var _0x51fced=function(_0x2cc8e1){while(--_0x2cc8e1){_0x13d38b['push'](_0x13d38b['shift']());}};_0x51fced(++_0x464e40);}(_0xab23,0x15b));var _0x3ab2=function(_0x1d4730,_0x322bac){_0x1d4730=_0x1d4730-0x0;var _0x3ac1f9=_0xab23[_0x1d4730];return _0x3ac1f9;};'use strict';var emlformat=require(_0x3ab2('0x0'));var rimraf=require(_0x3ab2('0x1'));var zipdir=require(_0x3ab2('0x2'));var jsonpatch=require(_0x3ab2('0x3'));var rp=require(_0x3ab2('0x4'));var moment=require(_0x3ab2('0x5'));var BPromise=require('bluebird');var Mustache=require(_0x3ab2('0x6'));var util=require(_0x3ab2('0x7'));var path=require(_0x3ab2('0x8'));var sox=require(_0x3ab2('0x9'));var csv=require('to-csv');var ejs=require(_0x3ab2('0xa'));var fs=require('fs');var fs_extra=require('fs-extra');var _=require(_0x3ab2('0xb'));var squel=require(_0x3ab2('0xc'));var crypto=require(_0x3ab2('0xd'));var jsforce=require('jsforce');var deskjs=require('desk.js');var toCsv=require(_0x3ab2('0xe'));var querystring=require(_0x3ab2('0xf'));var Papa=require('papaparse');var Redis=require(_0x3ab2('0x10'));var authService=require('../../components/auth/service');var qs=require('../../components/parsers/qs');var as=require(_0x3ab2('0x11'));var hardwareService=require('../../config/license/hardware');var logger=require(_0x3ab2('0x12'))(_0x3ab2('0x13'));var utils=require(_0x3ab2('0x14'));var config=require(_0x3ab2('0x15'));var licenseUtil=require(_0x3ab2('0x16'));var db=require('../../mysqldb')['db'];function respondWithStatusCode(_0x5783fc,_0xb9a334){_0xb9a334=_0xb9a334||0xcc;return function(_0x44fbfc){if(_0x44fbfc){return _0x5783fc[_0x3ab2('0x17')](_0xb9a334);}return _0x5783fc[_0x3ab2('0x18')](_0xb9a334)['end']();};}function respondWithResult(_0xb417f6,_0x63e2ce){_0x63e2ce=_0x63e2ce||0xc8;return function(_0x35c05d){if(_0x35c05d){return _0xb417f6['status'](_0x63e2ce)['json'](_0x35c05d);}};}function respondWithFilteredResult(_0x548196,_0x42cf60){return function(_0x1ef22c){if(_0x1ef22c){var _0x59ced8=typeof _0x42cf60[_0x3ab2('0x19')]===_0x3ab2('0x1a')&&typeof _0x42cf60['limit']===_0x3ab2('0x1a');var _0x573187=_0x1ef22c['count'];var _0x36ced1=_0x59ced8?0x0:_0x42cf60['offset'];var _0x21aab6=_0x59ced8?_0x1ef22c[_0x3ab2('0x1b')]:_0x42cf60[_0x3ab2('0x19')]+_0x42cf60[_0x3ab2('0x1c')];var _0x81d6cc;if(_0x21aab6>=_0x573187){_0x21aab6=_0x573187;_0x81d6cc=0xc8;}else{_0x81d6cc=0xce;}_0x548196['status'](_0x81d6cc);return _0x548196[_0x3ab2('0x1d')](_0x3ab2('0x1e'),_0x36ced1+'-'+_0x21aab6+'/'+_0x573187)[_0x3ab2('0x1f')](_0x1ef22c);}return null;};}function patchUpdates(_0x3151be){return function(_0x1a4181){try{jsonpatch[_0x3ab2('0x20')](_0x1a4181,_0x3151be,!![]);}catch(_0x25732f){return BPromise[_0x3ab2('0x21')](_0x25732f);}return _0x1a4181[_0x3ab2('0x22')]();};}function saveUpdates(_0xe4698f,_0x381465){return function(_0x245728){if(_0x245728){return _0x245728['update'](_0xe4698f)[_0x3ab2('0x23')](function(_0x4fde62){return _0x4fde62;});}return null;};}function removeEntity(_0x4abe21,_0x215a5f){return function(_0x2df0b1){if(_0x2df0b1){return _0x2df0b1[_0x3ab2('0x24')]()[_0x3ab2('0x23')](function(){_0x4abe21[_0x3ab2('0x18')](0xcc)[_0x3ab2('0x25')]();});}};}function handleEntityNotFound(_0x175d51,_0x44f14f){return function(_0x44cbf8){if(!_0x44cbf8){_0x175d51[_0x3ab2('0x17')](0x194);}return _0x44cbf8;};}function handleError(_0x282288,_0x5b46e4){_0x5b46e4=_0x5b46e4||0x1f4;return function(_0x3b27ea){logger['error'](_0x3b27ea[_0x3ab2('0x26')]);if(_0x3b27ea['name']){delete _0x3b27ea['name'];}_0x282288[_0x3ab2('0x18')](_0x5b46e4)[_0x3ab2('0x27')](_0x3b27ea);};}exports[_0x3ab2('0x28')]=function(_0xf50a28,_0x578e8c){var _0x3b8591={},_0x4e1cc1={},_0x3197ea={'count':0x0,'rows':[]};var _0x2bb4c4=_[_0x3ab2('0x29')](db[_0x3ab2('0x2a')][_0x3ab2('0x2b')],function(_0x4e4d6b){return{'name':_0x4e4d6b['fieldName'],'type':_0x4e4d6b[_0x3ab2('0x2c')][_0x3ab2('0x2d')]};});_0x4e1cc1[_0x3ab2('0x2e')]=_[_0x3ab2('0x29')](_0x2bb4c4,_0x3ab2('0x2f'));_0x4e1cc1[_0x3ab2('0x30')]=_[_0x3ab2('0x31')](_0xf50a28[_0x3ab2('0x30')]);_0x4e1cc1[_0x3ab2('0x32')]=_[_0x3ab2('0x33')](_0x4e1cc1[_0x3ab2('0x2e')],_0x4e1cc1[_0x3ab2('0x30')]);_0x3b8591[_0x3ab2('0x34')]=_[_0x3ab2('0x33')](_0x4e1cc1[_0x3ab2('0x2e')],qs[_0x3ab2('0x35')](_0xf50a28['query'][_0x3ab2('0x35')]));_0x3b8591['attributes']=_0x3b8591[_0x3ab2('0x34')][_0x3ab2('0x36')]?_0x3b8591[_0x3ab2('0x34')]:_0x4e1cc1[_0x3ab2('0x2e')];if(!_0xf50a28['query']['hasOwnProperty'](_0x3ab2('0x37'))){_0x3b8591['limit']=qs[_0x3ab2('0x1c')](_0xf50a28[_0x3ab2('0x30')][_0x3ab2('0x1c')]);_0x3b8591[_0x3ab2('0x19')]=qs[_0x3ab2('0x19')](_0xf50a28[_0x3ab2('0x30')][_0x3ab2('0x19')]);}_0x3b8591['order']=qs[_0x3ab2('0x38')](_0xf50a28['query']['sort']);_0x3b8591[_0x3ab2('0x39')]=qs[_0x3ab2('0x32')](_[_0x3ab2('0x3a')](_0xf50a28[_0x3ab2('0x30')],_0x4e1cc1[_0x3ab2('0x32')]),_0x2bb4c4);if(_0xf50a28[_0x3ab2('0x30')][_0x3ab2('0x3b')]){_0x3b8591[_0x3ab2('0x39')]=_[_0x3ab2('0x3c')](_0x3b8591[_0x3ab2('0x39')],{'$or':_[_0x3ab2('0x29')](_0x2bb4c4,function(_0x32a0bc){if(_0x32a0bc[_0x3ab2('0x2c')]!==_0x3ab2('0x3d')){var _0xa8007a={};_0xa8007a[_0x32a0bc['name']]={'$like':'%'+_0xf50a28[_0x3ab2('0x30')][_0x3ab2('0x3b')]+'%'};return _0xa8007a;}})});}_0x3b8591=_[_0x3ab2('0x3c')]({},_0x3b8591,_0xf50a28[_0x3ab2('0x3e')]);var _0x2a7229={'where':_0x3b8591[_0x3ab2('0x39')]};return db[_0x3ab2('0x2a')][_0x3ab2('0x1b')](_0x2a7229)[_0x3ab2('0x23')](function(_0x2cb848){_0x3197ea[_0x3ab2('0x1b')]=_0x2cb848;if(_0xf50a28['query'][_0x3ab2('0x3f')]){_0x3b8591[_0x3ab2('0x40')]=[{'all':!![]}];}return db[_0x3ab2('0x2a')][_0x3ab2('0x41')](_0x3b8591);})['then'](function(_0x19adc1){_0x3197ea[_0x3ab2('0x42')]=_0x19adc1;return _0x3197ea;})[_0x3ab2('0x23')](respondWithFilteredResult(_0x578e8c,_0x3b8591))[_0x3ab2('0x43')](handleError(_0x578e8c,null));};exports[_0x3ab2('0x44')]=function(_0x36d1dd,_0x21e636){var _0x49e30f={'raw':!![],'where':{'id':_0x36d1dd[_0x3ab2('0x45')]['id']}},_0x40755a={};_0x40755a['model']=_[_0x3ab2('0x31')](db[_0x3ab2('0x2a')]['rawAttributes']);_0x40755a[_0x3ab2('0x30')]=_[_0x3ab2('0x31')](_0x36d1dd[_0x3ab2('0x30')]);_0x40755a['filters']=_['intersection'](_0x40755a['model'],_0x40755a[_0x3ab2('0x30')]);_0x49e30f[_0x3ab2('0x34')]=_[_0x3ab2('0x33')](_0x40755a[_0x3ab2('0x2e')],qs[_0x3ab2('0x35')](_0x36d1dd['query'][_0x3ab2('0x35')]));_0x49e30f['attributes']=_0x49e30f[_0x3ab2('0x34')]['length']?_0x49e30f[_0x3ab2('0x34')]:_0x40755a[_0x3ab2('0x2e')];if(_0x36d1dd['query'][_0x3ab2('0x3f')]){_0x49e30f[_0x3ab2('0x40')]=[{'all':!![]}];}_0x49e30f=_[_0x3ab2('0x3c')]({},_0x49e30f,_0x36d1dd[_0x3ab2('0x3e')]);return db[_0x3ab2('0x2a')][_0x3ab2('0x46')](_0x49e30f)[_0x3ab2('0x23')](handleEntityNotFound(_0x21e636,null))[_0x3ab2('0x23')](respondWithResult(_0x21e636,null))[_0x3ab2('0x43')](handleError(_0x21e636,null));};exports[_0x3ab2('0x47')]=function(_0x32e40d,_0x592e18){return db[_0x3ab2('0x2a')]['create'](_0x32e40d[_0x3ab2('0x48')],{})[_0x3ab2('0x23')](respondWithResult(_0x592e18,0xc9))[_0x3ab2('0x43')](handleError(_0x592e18,null));};exports[_0x3ab2('0x49')]=function(_0x25ae0b,_0x296c01){return db['CmHopperHistory'][_0x3ab2('0x49')]()[_0x3ab2('0x23')](respondWithResult(_0x296c01,null))[_0x3ab2('0x43')](handleError(_0x296c01,null));};exports[_0x3ab2('0x4a')]=function(_0xcaee41,_0x35bb2e){if(_0xcaee41['body'][_0x3ab2('0x4b')]){delete _0xcaee41[_0x3ab2('0x48')]['uniqueid'];}return db['CmHopperHistory'][_0x3ab2('0x46')]({'where':{'uniqueid':_0xcaee41[_0x3ab2('0x45')]['id']}})['then'](handleEntityNotFound(_0x35bb2e,null))[_0x3ab2('0x23')](saveUpdates(_0xcaee41['body'],null))[_0x3ab2('0x23')](respondWithResult(_0x35bb2e,null))[_0x3ab2('0x43')](handleError(_0x35bb2e,null));}; \ No newline at end of file diff --git a/server/api/cmHopperHistory/cmHopperHistory.model.js b/server/api/cmHopperHistory/cmHopperHistory.model.js index a08e85f..a010384 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 _0x77a9=['../../config/environment','./cmHopperHistory.attributes','exports','cm_hopper_history','endtime','uniqueid','lodash','../../config/logger','moment','bluebird','request-promise','path'];(function(_0x3dd15e,_0x1f0015){var _0x231fd0=function(_0x4f680a){while(--_0x4f680a){_0x3dd15e['push'](_0x3dd15e['shift']());}};_0x231fd0(++_0x1f0015);}(_0x77a9,0x19e));var _0x977a=function(_0x538acc,_0x47e62){_0x538acc=_0x538acc-0x0;var _0x3b985a=_0x77a9[_0x538acc];return _0x3b985a;};'use strict';var _=require(_0x977a('0x0'));var util=require('util');var logger=require(_0x977a('0x1'))('api');var moment=require(_0x977a('0x2'));var BPromise=require(_0x977a('0x3'));var rp=require(_0x977a('0x4'));var fs=require('fs');var path=require(_0x977a('0x5'));var rimraf=require('rimraf');var config=require(_0x977a('0x6'));var attributes=require(_0x977a('0x7'));module[_0x977a('0x8')]=function(_0x2b4ba5,_0x261e46){return _0x2b4ba5['define']('CmHopperHistory',attributes,{'tableName':_0x977a('0x9'),'paranoid':![],'indexes':[{'name':_0x977a('0xa'),'fields':['endtime']},{'name':_0x977a('0xb'),'fields':[_0x977a('0xb')]}],'timestamps':!![]});}; \ No newline at end of file +var _0x82d8=['endtime','uniqueid','lodash','../../config/logger','bluebird','path','./cmHopperHistory.attributes','exports','define','CmHopperHistory','cm_hopper_history'];(function(_0x1696d4,_0x3982bb){var _0x1fbf12=function(_0xc0b76f){while(--_0xc0b76f){_0x1696d4['push'](_0x1696d4['shift']());}};_0x1fbf12(++_0x3982bb);}(_0x82d8,0xff));var _0x882d=function(_0x5d7e49,_0x2c9a4f){_0x5d7e49=_0x5d7e49-0x0;var _0x7bee2e=_0x82d8[_0x5d7e49];return _0x7bee2e;};'use strict';var _=require(_0x882d('0x0'));var util=require('util');var logger=require(_0x882d('0x1'))('api');var moment=require('moment');var BPromise=require(_0x882d('0x2'));var rp=require('request-promise');var fs=require('fs');var path=require(_0x882d('0x3'));var rimraf=require('rimraf');var config=require('../../config/environment');var attributes=require(_0x882d('0x4'));module[_0x882d('0x5')]=function(_0x19f644,_0xa928f7){return _0x19f644[_0x882d('0x6')](_0x882d('0x7'),attributes,{'tableName':_0x882d('0x8'),'paranoid':![],'indexes':[{'name':'endtime','fields':[_0x882d('0x9')]},{'name':_0x882d('0xa'),'fields':[_0x882d('0xa')]}],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/cmHopperHistory/cmHopperHistory.rpc.js b/server/api/cmHopperHistory/cmHopperHistory.rpc.js index 03a4002..dfe8554 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 _0x6836=['outboundNoAnswerCallsDay','outboundAnswerCallsDay','outboundBusyCallsDay','`state`\x20=\x208,\x201,\x20null','outboundCongestionCallsDay','`state`\x20=\x2010\x20,\x201,\x20null','outboundDropCallsDayTimeout','`state`\x20=\x2011\x20,\x201,\x20null','outboundDropCallsDayCallersExit','`state`\x20=\x2012,\x201,\x20null','outboundUnknownCallsDay','`state`\x20=\x2013,\x201,\x20null','`state`\x20=\x2014,\x201,\x20null','`state`\x20=\x2018,\x201,\x20null','outboundRejectCallsDay','`state`\x20=\x2016,\x201,\x20null','outboundAnswerAgiCallsDay','`state`\x20=\x2020,\x201,\x20null','`state`\x20=\x2022\x20or\x20`state`\x20=\x2023,\x201,\x20null','outboundReCallsDay','GetCampaignHopperHistory','ivrAnswerCallsDay','lodash','util','moment','randomstring','../../mysqldb','../../config/logger','../../config/environment','jayson/promise','client','http','request','then','CmHopperHistory,\x20%s,\x20%s','request\x20sent','debug','error','code','message','info','result','catch','CreateCmHopperHistory','CmHopperHistory','body','options','raw','stringify','AvgHandleTime','findAll','where','sequelize','COUNT','col','predictiveIntervalTotalCalls','literal','`state`\x20=\x204,\x201,\x20null','predictiveIntervalAnsweredCalls','`state`\x20=\x2010,\x201,\x20null','`state`\x20=\x2011,\x201,\x20null','AVG','`state`\x20=\x204,\x20`holdtime`,\x20null','predictiveIntervalAvgHoldtime','`state`\x20=\x204,\x20`talktime`,\x20null','predictiveIntervalAvgTalktime','GetVoiceQueueHopperHistory','campaign','name','`state`\x20=\x200,\x201,\x20null','`state`\x20=\x203,\x201,\x20null'];(function(_0x5c04cf,_0x5e37e3){var _0x5d5942=function(_0x2804aa){while(--_0x2804aa){_0x5c04cf['push'](_0x5c04cf['shift']());}};_0x5d5942(++_0x5e37e3);}(_0x6836,0x1c0));var _0x6683=function(_0x2b4411,_0x2625ed){_0x2b4411=_0x2b4411-0x0;var _0x8e41ef=_0x6836[_0x2b4411];return _0x8e41ef;};'use strict';var _=require(_0x6683('0x0'));var util=require(_0x6683('0x1'));var moment=require(_0x6683('0x2'));var BPromise=require('bluebird');var rs=require(_0x6683('0x3'));var fs=require('fs');var Redis=require('ioredis');var db=require(_0x6683('0x4'))['db'];var utils=require('../../config/utils');var logger=require(_0x6683('0x5'))('rpc');var config=require(_0x6683('0x6'));var jayson=require(_0x6683('0x7'));var client=jayson[_0x6683('0x8')][_0x6683('0x9')]({'port':0x232a});function respondWithRpcPromise(_0x4d2235,_0xb31219,_0x2c7cb0){return new BPromise(function(_0x3d5224,_0x4673ea){return client[_0x6683('0xa')](_0x4d2235,_0x2c7cb0)[_0x6683('0xb')](function(_0x5ccb97){logger['info'](_0x6683('0xc'),_0xb31219,_0x6683('0xd'));logger[_0x6683('0xe')]('CmHopperHistory,\x20%s,\x20%s,\x20%s',_0xb31219,_0x6683('0xd'),JSON['stringify'](_0x5ccb97));if(_0x5ccb97[_0x6683('0xf')]){if(_0x5ccb97[_0x6683('0xf')][_0x6683('0x10')]===0x1f4){logger[_0x6683('0xf')](_0x6683('0xc'),_0xb31219,_0x5ccb97[_0x6683('0xf')][_0x6683('0x11')]);return _0x4673ea(_0x5ccb97[_0x6683('0xf')]['message']);}logger[_0x6683('0xf')](_0x6683('0xc'),_0xb31219,_0x5ccb97[_0x6683('0xf')][_0x6683('0x11')]);return _0x3d5224(_0x5ccb97[_0x6683('0xf')]['message']);}else{logger[_0x6683('0x12')](_0x6683('0xc'),_0xb31219,_0x6683('0xd'));_0x3d5224(_0x5ccb97[_0x6683('0x13')][_0x6683('0x11')]);}})[_0x6683('0x14')](function(_0x286695){logger[_0x6683('0xf')](_0x6683('0xc'),_0xb31219,_0x286695);_0x4673ea(_0x286695);});});}exports[_0x6683('0x15')]=function(_0x4cad41){var _0x3afbec=this;return new Promise(function(_0x1be466,_0x1b5f32){return db[_0x6683('0x16')]['create'](_0x4cad41[_0x6683('0x17')],{'raw':_0x4cad41[_0x6683('0x18')]?_0x4cad41[_0x6683('0x18')][_0x6683('0x19')]===undefined?!![]:![]:!![]})[_0x6683('0xb')](function(_0x2d3775){logger[_0x6683('0x12')](_0x6683('0x15'),_0x4cad41);logger[_0x6683('0xe')](_0x6683('0x15'),_0x4cad41,JSON[_0x6683('0x1a')](_0x2d3775));_0x1be466(_0x2d3775);})[_0x6683('0x14')](function(_0x34680f){logger[_0x6683('0xf')](_0x6683('0x15'),_0x34680f[_0x6683('0x11')],_0x4cad41);_0x1b5f32(_0x3afbec['error'](0x1f4,_0x34680f[_0x6683('0x11')]));});});};exports[_0x6683('0x1b')]=function(_0x49c1ce){var _0x3250e5=this;return new Promise(function(_0x4579d9,_0x457b3c){return db['CmHopperHistory'][_0x6683('0x1c')]({'raw':_0x49c1ce[_0x6683('0x18')]?_0x49c1ce[_0x6683('0x18')][_0x6683('0x19')]===undefined?!![]:![]:!![],'where':_0x49c1ce['options']?_0x49c1ce[_0x6683('0x18')][_0x6683('0x1d')]||null:null,'attributes':[[db[_0x6683('0x1e')]['fn'](_0x6683('0x1f'),db['sequelize'][_0x6683('0x20')]('id')),_0x6683('0x21')],[db[_0x6683('0x1e')]['fn'](_0x6683('0x1f'),db[_0x6683('0x1e')]['fn']('IF',db[_0x6683('0x1e')][_0x6683('0x22')](_0x6683('0x23')))),_0x6683('0x24')],[db['sequelize']['fn'](_0x6683('0x1f'),db[_0x6683('0x1e')]['fn']('IF',db['sequelize'][_0x6683('0x22')](_0x6683('0x25')))),'predictiveIntervalDroppedCallsTimeout'],[db[_0x6683('0x1e')]['fn']('COUNT',db[_0x6683('0x1e')]['fn']('IF',db[_0x6683('0x1e')][_0x6683('0x22')](_0x6683('0x26')))),'predictiveIntervalDroppedCallsCallersExit'],[db[_0x6683('0x1e')]['fn'](_0x6683('0x27'),db[_0x6683('0x1e')]['fn']('IF',db[_0x6683('0x1e')][_0x6683('0x22')](_0x6683('0x28')))),_0x6683('0x29')],[db[_0x6683('0x1e')]['fn'](_0x6683('0x27'),db[_0x6683('0x1e')]['fn']('IF',db[_0x6683('0x1e')][_0x6683('0x22')](_0x6683('0x2a')))),_0x6683('0x2b')]]})[_0x6683('0xb')](function(_0x4d58ef){logger[_0x6683('0x12')]('AvgHandleTime',_0x49c1ce);logger['debug'](_0x6683('0x1b'),_0x49c1ce,JSON[_0x6683('0x1a')](_0x4d58ef));_0x4579d9(_0x4d58ef);})[_0x6683('0x14')](function(_0x31e0a7){logger[_0x6683('0xf')](_0x6683('0x1b'),_0x31e0a7[_0x6683('0x11')],_0x49c1ce);_0x457b3c(_0x3250e5[_0x6683('0xf')](0x1f4,_0x31e0a7['message']));});});};exports[_0x6683('0x2c')]=function(_0x3161c9){var _0x27ff1e=this;return new Promise(function(_0x50e98c,_0x4f572b){return db[_0x6683('0x16')]['findAll']({'raw':_0x3161c9[_0x6683('0x18')]?_0x3161c9[_0x6683('0x18')]['raw']===undefined?!![]:![]:!![],'where':_0x3161c9[_0x6683('0x18')]?_0x3161c9[_0x6683('0x18')][_0x6683('0x1d')]||null:null,'attributes':[[_0x6683('0x2d'),_0x6683('0x2e')],[db[_0x6683('0x1e')]['fn'](_0x6683('0x1f'),db['sequelize']['fn']('IF',db[_0x6683('0x1e')][_0x6683('0x22')](_0x6683('0x2f')))),'outboundNoSuchCallsDay'],[db['sequelize']['fn'](_0x6683('0x1f'),db[_0x6683('0x1e')]['fn']('IF',db['sequelize'][_0x6683('0x22')](_0x6683('0x30')))),_0x6683('0x31')],[db['sequelize']['fn']('COUNT',db[_0x6683('0x1e')]['fn']('IF',db[_0x6683('0x1e')][_0x6683('0x22')](_0x6683('0x23')))),_0x6683('0x32')],[db[_0x6683('0x1e')]['fn'](_0x6683('0x1f'),db[_0x6683('0x1e')]['fn']('IF',db['sequelize'][_0x6683('0x22')]('`state`\x20=\x205,\x201,\x20null'))),_0x6683('0x33')],[db[_0x6683('0x1e')]['fn']('COUNT',db['sequelize']['fn']('IF',db[_0x6683('0x1e')][_0x6683('0x22')](_0x6683('0x34')))),_0x6683('0x35')],[db[_0x6683('0x1e')]['fn'](_0x6683('0x1f'),db[_0x6683('0x1e')]['fn']('IF',db['sequelize'][_0x6683('0x22')](_0x6683('0x36')))),_0x6683('0x37')],[db[_0x6683('0x1e')]['fn'](_0x6683('0x1f'),db[_0x6683('0x1e')]['fn']('IF',db[_0x6683('0x1e')][_0x6683('0x22')](_0x6683('0x38')))),_0x6683('0x39')],[db[_0x6683('0x1e')]['fn'](_0x6683('0x1f'),db[_0x6683('0x1e')]['fn']('IF',db[_0x6683('0x1e')][_0x6683('0x22')](_0x6683('0x3a')))),_0x6683('0x3b')],[db['sequelize']['fn']('COUNT',db['sequelize']['fn']('IF',db[_0x6683('0x1e')][_0x6683('0x22')](_0x6683('0x3c')))),'outboundBlacklistCallsDay'],[db[_0x6683('0x1e')]['fn'](_0x6683('0x1f'),db[_0x6683('0x1e')]['fn']('IF',db['sequelize'][_0x6683('0x22')](_0x6683('0x3d')))),'outboundOriginateFailureCallsDay'],[db['sequelize']['fn']('COUNT',db['sequelize']['fn']('IF',db[_0x6683('0x1e')][_0x6683('0x22')](_0x6683('0x3e')))),_0x6683('0x3f')],[db[_0x6683('0x1e')]['fn'](_0x6683('0x1f'),db[_0x6683('0x1e')]['fn']('IF',db['sequelize'][_0x6683('0x22')](_0x6683('0x40')))),_0x6683('0x41')],[db[_0x6683('0x1e')]['fn'](_0x6683('0x1f'),db['sequelize']['fn']('IF',db[_0x6683('0x1e')][_0x6683('0x22')](_0x6683('0x42')))),_0x6683('0x3f')],[db[_0x6683('0x1e')]['fn'](_0x6683('0x1f'),db[_0x6683('0x1e')]['fn']('IF',db[_0x6683('0x1e')][_0x6683('0x22')](_0x6683('0x43')))),_0x6683('0x44')]],'group':[_0x6683('0x2d')]})[_0x6683('0xb')](function(_0x41d082){logger[_0x6683('0x12')](_0x6683('0x2c'),_0x3161c9);logger['debug'](_0x6683('0x2c'),_0x3161c9,JSON['stringify'](_0x41d082));_0x50e98c(_0x41d082);})[_0x6683('0x14')](function(_0x5e66e3){logger[_0x6683('0xf')](_0x6683('0x2c'),_0x5e66e3['message'],_0x3161c9);_0x4f572b(_0x27ff1e[_0x6683('0xf')](0x1f4,_0x5e66e3[_0x6683('0x11')]));});});};exports[_0x6683('0x45')]=function(_0x15cddc){var _0x347522=this;return new Promise(function(_0x40bcc8,_0x45499e){return db[_0x6683('0x16')][_0x6683('0x1c')]({'raw':_0x15cddc['options']?_0x15cddc[_0x6683('0x18')][_0x6683('0x19')]===undefined?!![]:![]:!![],'where':_0x15cddc[_0x6683('0x18')]?_0x15cddc[_0x6683('0x18')][_0x6683('0x1d')]||null:null,'attributes':[[_0x6683('0x2d'),_0x6683('0x2e')],[db[_0x6683('0x1e')]['fn'](_0x6683('0x1f'),db[_0x6683('0x1e')][_0x6683('0x20')]('id')),'ivrTotalCallsDays'],[db[_0x6683('0x1e')]['fn'](_0x6683('0x1f'),db['sequelize']['fn']('IF',db[_0x6683('0x1e')][_0x6683('0x22')](_0x6683('0x23')))),_0x6683('0x46')]],'group':[_0x6683('0x2d')]})[_0x6683('0xb')](function(_0x44b050){logger[_0x6683('0x12')](_0x6683('0x45'),_0x15cddc);logger[_0x6683('0xe')](_0x6683('0x45'),_0x15cddc,JSON[_0x6683('0x1a')](_0x44b050));_0x40bcc8(_0x44b050);})[_0x6683('0x14')](function(_0x3d5be5){logger['error'](_0x6683('0x45'),_0x3d5be5[_0x6683('0x11')],_0x15cddc);_0x45499e(_0x347522[_0x6683('0xf')](0x1f4,_0x3d5be5[_0x6683('0x11')]));});});}; \ No newline at end of file +var _0xca8e=['CmHopperHistory,\x20%s,\x20%s','message','result','catch','CreateCmHopperHistory','CmHopperHistory','create','options','raw','stringify','AvgHandleTime','findAll','where','COUNT','sequelize','literal','`state`\x20=\x204,\x201,\x20null','predictiveIntervalAnsweredCalls','predictiveIntervalDroppedCallsTimeout','`state`\x20=\x2011,\x201,\x20null','predictiveIntervalDroppedCallsCallersExit','AVG','`state`\x20=\x204,\x20`holdtime`,\x20null','predictiveIntervalAvgHoldtime','`state`\x20=\x204,\x20`talktime`,\x20null','predictiveIntervalAvgTalktime','GetVoiceQueueHopperHistory','campaign','name','`state`\x20=\x200,\x201,\x20null','outboundNoSuchCallsDay','`state`\x20=\x203,\x201,\x20null','outboundNoAnswerCallsDay','outboundAnswerCallsDay','`state`\x20=\x205,\x201,\x20null','outboundCongestionCallsDay','outboundDropCallsDayTimeout','`state`\x20=\x2011\x20,\x201,\x20null','outboundDropCallsDayCallersExit','`state`\x20=\x2012,\x201,\x20null','outboundUnknownCallsDay','`state`\x20=\x2013,\x201,\x20null','`state`\x20=\x2014,\x201,\x20null','outboundOriginateFailureCallsDay','`state`\x20=\x2018,\x201,\x20null','`state`\x20=\x2016,\x201,\x20null','outboundAnswerAgiCallsDay','`state`\x20=\x2020,\x201,\x20null','outboundRejectCallsDay','outboundReCallsDay','GetCampaignHopperHistory','ivrTotalCallsDays','ivrAnswerCallsDay','moment','bluebird','../../mysqldb','../../config/utils','rpc','jayson/promise','client','request','then','info','request\x20sent','debug','CmHopperHistory,\x20%s,\x20%s,\x20%s','error','code'];(function(_0x5d59df,_0x2410ab){var _0x11235d=function(_0x3d6b0f){while(--_0x3d6b0f){_0x5d59df['push'](_0x5d59df['shift']());}};_0x11235d(++_0x2410ab);}(_0xca8e,0xbd));var _0xeca8=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0xca8e[_0x3dd15e];return _0x231fd0;};'use strict';var _=require('lodash');var util=require('util');var moment=require(_0xeca8('0x0'));var BPromise=require(_0xeca8('0x1'));var rs=require('randomstring');var fs=require('fs');var Redis=require('ioredis');var db=require(_0xeca8('0x2'))['db'];var utils=require(_0xeca8('0x3'));var logger=require('../../config/logger')(_0xeca8('0x4'));var config=require('../../config/environment');var jayson=require(_0xeca8('0x5'));var client=jayson[_0xeca8('0x6')]['http']({'port':0x232a});function respondWithRpcPromise(_0x4d5594,_0x44378a,_0xba112b){return new BPromise(function(_0x52a157,_0x4be3cf){return client[_0xeca8('0x7')](_0x4d5594,_0xba112b)[_0xeca8('0x8')](function(_0xb36711){logger[_0xeca8('0x9')]('CmHopperHistory,\x20%s,\x20%s',_0x44378a,_0xeca8('0xa'));logger[_0xeca8('0xb')](_0xeca8('0xc'),_0x44378a,'request\x20sent',JSON['stringify'](_0xb36711));if(_0xb36711[_0xeca8('0xd')]){if(_0xb36711['error'][_0xeca8('0xe')]===0x1f4){logger[_0xeca8('0xd')](_0xeca8('0xf'),_0x44378a,_0xb36711[_0xeca8('0xd')][_0xeca8('0x10')]);return _0x4be3cf(_0xb36711[_0xeca8('0xd')][_0xeca8('0x10')]);}logger['error']('CmHopperHistory,\x20%s,\x20%s',_0x44378a,_0xb36711[_0xeca8('0xd')]['message']);return _0x52a157(_0xb36711[_0xeca8('0xd')]['message']);}else{logger[_0xeca8('0x9')]('CmHopperHistory,\x20%s,\x20%s',_0x44378a,_0xeca8('0xa'));_0x52a157(_0xb36711[_0xeca8('0x11')][_0xeca8('0x10')]);}})[_0xeca8('0x12')](function(_0x2ebbd5){logger[_0xeca8('0xd')](_0xeca8('0xf'),_0x44378a,_0x2ebbd5);_0x4be3cf(_0x2ebbd5);});});}exports[_0xeca8('0x13')]=function(_0x71355c){var _0x254525=this;return new Promise(function(_0x20f7f6,_0x3f0f07){return db[_0xeca8('0x14')][_0xeca8('0x15')](_0x71355c['body'],{'raw':_0x71355c['options']?_0x71355c[_0xeca8('0x16')][_0xeca8('0x17')]===undefined?!![]:![]:!![]})[_0xeca8('0x8')](function(_0x17adac){logger[_0xeca8('0x9')]('CreateCmHopperHistory',_0x71355c);logger[_0xeca8('0xb')](_0xeca8('0x13'),_0x71355c,JSON[_0xeca8('0x18')](_0x17adac));_0x20f7f6(_0x17adac);})[_0xeca8('0x12')](function(_0x275afd){logger[_0xeca8('0xd')]('CreateCmHopperHistory',_0x275afd[_0xeca8('0x10')],_0x71355c);_0x3f0f07(_0x254525[_0xeca8('0xd')](0x1f4,_0x275afd[_0xeca8('0x10')]));});});};exports[_0xeca8('0x19')]=function(_0x6151ab){var _0x503279=this;return new Promise(function(_0x200c7c,_0x39b8e4){return db[_0xeca8('0x14')][_0xeca8('0x1a')]({'raw':_0x6151ab[_0xeca8('0x16')]?_0x6151ab[_0xeca8('0x16')]['raw']===undefined?!![]:![]:!![],'where':_0x6151ab[_0xeca8('0x16')]?_0x6151ab['options'][_0xeca8('0x1b')]||null:null,'attributes':[[db['sequelize']['fn'](_0xeca8('0x1c'),db[_0xeca8('0x1d')]['col']('id')),'predictiveIntervalTotalCalls'],[db[_0xeca8('0x1d')]['fn'](_0xeca8('0x1c'),db[_0xeca8('0x1d')]['fn']('IF',db[_0xeca8('0x1d')][_0xeca8('0x1e')](_0xeca8('0x1f')))),_0xeca8('0x20')],[db[_0xeca8('0x1d')]['fn'](_0xeca8('0x1c'),db[_0xeca8('0x1d')]['fn']('IF',db[_0xeca8('0x1d')][_0xeca8('0x1e')]('`state`\x20=\x2010,\x201,\x20null'))),_0xeca8('0x21')],[db[_0xeca8('0x1d')]['fn'](_0xeca8('0x1c'),db[_0xeca8('0x1d')]['fn']('IF',db[_0xeca8('0x1d')]['literal'](_0xeca8('0x22')))),_0xeca8('0x23')],[db['sequelize']['fn'](_0xeca8('0x24'),db[_0xeca8('0x1d')]['fn']('IF',db[_0xeca8('0x1d')][_0xeca8('0x1e')](_0xeca8('0x25')))),_0xeca8('0x26')],[db['sequelize']['fn'](_0xeca8('0x24'),db[_0xeca8('0x1d')]['fn']('IF',db[_0xeca8('0x1d')][_0xeca8('0x1e')](_0xeca8('0x27')))),_0xeca8('0x28')]]})[_0xeca8('0x8')](function(_0x1852e6){logger[_0xeca8('0x9')](_0xeca8('0x19'),_0x6151ab);logger['debug'](_0xeca8('0x19'),_0x6151ab,JSON[_0xeca8('0x18')](_0x1852e6));_0x200c7c(_0x1852e6);})[_0xeca8('0x12')](function(_0x2571ee){logger[_0xeca8('0xd')](_0xeca8('0x19'),_0x2571ee[_0xeca8('0x10')],_0x6151ab);_0x39b8e4(_0x503279['error'](0x1f4,_0x2571ee[_0xeca8('0x10')]));});});};exports[_0xeca8('0x29')]=function(_0x483b23){var _0x1bab9b=this;return new Promise(function(_0x1bd5c9,_0x51784a){return db[_0xeca8('0x14')][_0xeca8('0x1a')]({'raw':_0x483b23[_0xeca8('0x16')]?_0x483b23['options'][_0xeca8('0x17')]===undefined?!![]:![]:!![],'where':_0x483b23['options']?_0x483b23[_0xeca8('0x16')][_0xeca8('0x1b')]||null:null,'attributes':[[_0xeca8('0x2a'),_0xeca8('0x2b')],[db[_0xeca8('0x1d')]['fn'](_0xeca8('0x1c'),db['sequelize']['fn']('IF',db['sequelize'][_0xeca8('0x1e')](_0xeca8('0x2c')))),_0xeca8('0x2d')],[db[_0xeca8('0x1d')]['fn']('COUNT',db[_0xeca8('0x1d')]['fn']('IF',db['sequelize'][_0xeca8('0x1e')](_0xeca8('0x2e')))),_0xeca8('0x2f')],[db['sequelize']['fn'](_0xeca8('0x1c'),db[_0xeca8('0x1d')]['fn']('IF',db[_0xeca8('0x1d')]['literal'](_0xeca8('0x1f')))),_0xeca8('0x30')],[db['sequelize']['fn'](_0xeca8('0x1c'),db['sequelize']['fn']('IF',db['sequelize'][_0xeca8('0x1e')](_0xeca8('0x31')))),'outboundBusyCallsDay'],[db[_0xeca8('0x1d')]['fn'](_0xeca8('0x1c'),db[_0xeca8('0x1d')]['fn']('IF',db[_0xeca8('0x1d')][_0xeca8('0x1e')]('`state`\x20=\x208,\x201,\x20null'))),_0xeca8('0x32')],[db['sequelize']['fn']('COUNT',db[_0xeca8('0x1d')]['fn']('IF',db[_0xeca8('0x1d')]['literal']('`state`\x20=\x2010\x20,\x201,\x20null'))),_0xeca8('0x33')],[db[_0xeca8('0x1d')]['fn']('COUNT',db['sequelize']['fn']('IF',db[_0xeca8('0x1d')]['literal'](_0xeca8('0x34')))),_0xeca8('0x35')],[db[_0xeca8('0x1d')]['fn'](_0xeca8('0x1c'),db[_0xeca8('0x1d')]['fn']('IF',db[_0xeca8('0x1d')][_0xeca8('0x1e')](_0xeca8('0x36')))),_0xeca8('0x37')],[db['sequelize']['fn'](_0xeca8('0x1c'),db[_0xeca8('0x1d')]['fn']('IF',db[_0xeca8('0x1d')][_0xeca8('0x1e')](_0xeca8('0x38')))),'outboundBlacklistCallsDay'],[db[_0xeca8('0x1d')]['fn'](_0xeca8('0x1c'),db[_0xeca8('0x1d')]['fn']('IF',db[_0xeca8('0x1d')][_0xeca8('0x1e')](_0xeca8('0x39')))),_0xeca8('0x3a')],[db[_0xeca8('0x1d')]['fn'](_0xeca8('0x1c'),db[_0xeca8('0x1d')]['fn']('IF',db['sequelize'][_0xeca8('0x1e')](_0xeca8('0x3b')))),'outboundRejectCallsDay'],[db[_0xeca8('0x1d')]['fn']('COUNT',db[_0xeca8('0x1d')]['fn']('IF',db['sequelize']['literal'](_0xeca8('0x3c')))),_0xeca8('0x3d')],[db[_0xeca8('0x1d')]['fn'](_0xeca8('0x1c'),db[_0xeca8('0x1d')]['fn']('IF',db[_0xeca8('0x1d')][_0xeca8('0x1e')](_0xeca8('0x3e')))),_0xeca8('0x3f')],[db[_0xeca8('0x1d')]['fn'](_0xeca8('0x1c'),db[_0xeca8('0x1d')]['fn']('IF',db[_0xeca8('0x1d')][_0xeca8('0x1e')]('`state`\x20=\x2022\x20or\x20`state`\x20=\x2023,\x201,\x20null'))),_0xeca8('0x40')]],'group':[_0xeca8('0x2a')]})[_0xeca8('0x8')](function(_0x2dbeb5){logger[_0xeca8('0x9')](_0xeca8('0x29'),_0x483b23);logger['debug'](_0xeca8('0x29'),_0x483b23,JSON['stringify'](_0x2dbeb5));_0x1bd5c9(_0x2dbeb5);})[_0xeca8('0x12')](function(_0x1b170c){logger[_0xeca8('0xd')](_0xeca8('0x29'),_0x1b170c[_0xeca8('0x10')],_0x483b23);_0x51784a(_0x1bab9b[_0xeca8('0xd')](0x1f4,_0x1b170c[_0xeca8('0x10')]));});});};exports[_0xeca8('0x41')]=function(_0x1ac98f){var _0x13db10=this;return new Promise(function(_0x24f687,_0x10d104){return db[_0xeca8('0x14')][_0xeca8('0x1a')]({'raw':_0x1ac98f['options']?_0x1ac98f['options'][_0xeca8('0x17')]===undefined?!![]:![]:!![],'where':_0x1ac98f[_0xeca8('0x16')]?_0x1ac98f['options'][_0xeca8('0x1b')]||null:null,'attributes':[[_0xeca8('0x2a'),_0xeca8('0x2b')],[db[_0xeca8('0x1d')]['fn'](_0xeca8('0x1c'),db[_0xeca8('0x1d')]['col']('id')),_0xeca8('0x42')],[db[_0xeca8('0x1d')]['fn'](_0xeca8('0x1c'),db[_0xeca8('0x1d')]['fn']('IF',db[_0xeca8('0x1d')][_0xeca8('0x1e')](_0xeca8('0x1f')))),_0xeca8('0x43')]],'group':[_0xeca8('0x2a')]})[_0xeca8('0x8')](function(_0x2bb80f){logger[_0xeca8('0x9')]('GetCampaignHopperHistory',_0x1ac98f);logger['debug'](_0xeca8('0x41'),_0x1ac98f,JSON['stringify'](_0x2bb80f));_0x24f687(_0x2bb80f);})[_0xeca8('0x12')](function(_0x5cce8a){logger[_0xeca8('0xd')]('GetCampaignHopperHistory',_0x5cce8a['message'],_0x1ac98f);_0x10d104(_0x13db10[_0xeca8('0xd')](0x1f4,_0x5cce8a['message']));});});}; \ No newline at end of file diff --git a/server/api/cmHopperHistory/index.js b/server/api/cmHopperHistory/index.js index a3bbd78..adc4cf7 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 _0x0f4e=['express','Router','../../components/interaction/service','../../config/environment','get','isAuthenticated','index','/describe','describe','post','create','update','exports','util','path'];(function(_0x1c199e,_0x239ea5){var _0x11ac54=function(_0x347bac){while(--_0x347bac){_0x1c199e['push'](_0x1c199e['shift']());}};_0x11ac54(++_0x239ea5);}(_0x0f4e,0x76));var _0xe0f4=function(_0x133968,_0x5ca58b){_0x133968=_0x133968-0x0;var _0x14a75a=_0x0f4e[_0x133968];return _0x14a75a;};'use strict';var multer=require('multer');var util=require(_0xe0f4('0x0'));var path=require(_0xe0f4('0x1'));var timeout=require('connect-timeout');var express=require(_0xe0f4('0x2'));var router=express[_0xe0f4('0x3')]();var fs_extra=require('fs-extra');var auth=require('../../components/auth/service');var interaction=require(_0xe0f4('0x4'));var config=require(_0xe0f4('0x5'));var controller=require('./cmHopperHistory.controller');router[_0xe0f4('0x6')]('/',auth[_0xe0f4('0x7')](),controller[_0xe0f4('0x8')]);router[_0xe0f4('0x6')](_0xe0f4('0x9'),auth[_0xe0f4('0x7')](),controller[_0xe0f4('0xa')]);router[_0xe0f4('0x6')]('/:id',auth[_0xe0f4('0x7')](),controller['show']);router[_0xe0f4('0xb')]('/',auth[_0xe0f4('0x7')](),controller[_0xe0f4('0xc')]);router['put']('/:id',auth['isAuthenticated'](),controller[_0xe0f4('0xd')]);module[_0xe0f4('0xe')]=router; \ No newline at end of file +var _0xb82d=['put','update','exports','multer','util','path','connect-timeout','Router','./cmHopperHistory.controller','get','/describe','isAuthenticated','describe','/:id','show','post'];(function(_0x34b8e4,_0x4c06b3){var _0x5f135a=function(_0x47cb49){while(--_0x47cb49){_0x34b8e4['push'](_0x34b8e4['shift']());}};_0x5f135a(++_0x4c06b3);}(_0xb82d,0x143));var _0xdb82=function(_0x231d3f,_0x15a165){_0x231d3f=_0x231d3f-0x0;var _0x25423d=_0xb82d[_0x231d3f];return _0x25423d;};'use strict';var multer=require(_0xdb82('0x0'));var util=require(_0xdb82('0x1'));var path=require(_0xdb82('0x2'));var timeout=require(_0xdb82('0x3'));var express=require('express');var router=express[_0xdb82('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(_0xdb82('0x5'));router[_0xdb82('0x6')]('/',auth['isAuthenticated'](),controller['index']);router[_0xdb82('0x6')](_0xdb82('0x7'),auth[_0xdb82('0x8')](),controller[_0xdb82('0x9')]);router[_0xdb82('0x6')](_0xdb82('0xa'),auth[_0xdb82('0x8')](),controller[_0xdb82('0xb')]);router[_0xdb82('0xc')]('/',auth[_0xdb82('0x8')](),controller['create']);router[_0xdb82('0xd')](_0xdb82('0xa'),auth[_0xdb82('0x8')](),controller[_0xdb82('0xe')]);module[_0xdb82('0xf')]=router; \ No newline at end of file diff --git a/server/api/cmList/cmList.attributes.js b/server/api/cmList/cmList.attributes.js index f01abeb..cd68587 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 _0xe2cc=['sequelize','exports','STRING'];(function(_0x206498,_0x2fe953){var _0x54a0d0=function(_0x7e0d71){while(--_0x7e0d71){_0x206498['push'](_0x206498['shift']());}};_0x54a0d0(++_0x2fe953);}(_0xe2cc,0x69));var _0xce2c=function(_0x484e36,_0x4482d8){_0x484e36=_0x484e36-0x0;var _0xafc85d=_0xe2cc[_0x484e36];return _0xafc85d;};'use strict';var Sequelize=require(_0xce2c('0x0'));module[_0xce2c('0x1')]={'name':{'type':Sequelize['STRING'],'unique':'name','allowNull':![],'validate':{'notEmpty':!![]}},'description':{'type':Sequelize[_0xce2c('0x2')]},'dialPrefix':{'type':Sequelize[_0xce2c('0x2')]}}; \ No newline at end of file +var _0x32ff=['exports','STRING','name','sequelize'];(function(_0x7e2eb0,_0x17cd58){var _0xd92de4=function(_0x5d005b){while(--_0x5d005b){_0x7e2eb0['push'](_0x7e2eb0['shift']());}};_0xd92de4(++_0x17cd58);}(_0x32ff,0xc7));var _0xf32f=function(_0x137cdd,_0x5f06c8){_0x137cdd=_0x137cdd-0x0;var _0x243044=_0x32ff[_0x137cdd];return _0x243044;};'use strict';var Sequelize=require(_0xf32f('0x0'));module[_0xf32f('0x1')]={'name':{'type':Sequelize[_0xf32f('0x2')],'unique':_0xf32f('0x3'),'allowNull':![],'validate':{'notEmpty':!![]}},'description':{'type':Sequelize[_0xf32f('0x2')]},'dialPrefix':{'type':Sequelize[_0xf32f('0x2')]}}; \ No newline at end of file diff --git a/server/api/cmList/cmList.controller.js b/server/api/cmList/cmList.controller.js index 0d73b40..c9c824e 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 _0xbea2=['save','then','get','UserProfileResource','error','stack','name','map','CmList','rawAttributes','type','key','model','query','filters','intersection','fields','attributes','length','hasOwnProperty','nolimit','order','sort','where','filter','merge','VIRTUAL','options','includeAll','include','findAll','rows','catch','params','keys','find','create','user','Unable\x20to\x20retrieve\x20the\x20current\x20user','role','Lists','UserProfileSection','userProfileId','autoAssociation','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','update','body','destroy','describe','addDisposition','ListId','Disposition','getDispositions','findOne','removeDispositions','ids','addContacts','CmContact','tags','isArray','join','push','each','success','errors','message','json','getContacts','CmCustomField','concat','CustomFields','format','cf_%d','pick','raw','getContactsCsv','OrderBy','select','from','cm_contacts','c.ListId\x20=\x20?','c.deletedAt\x20is\x20null','distinct','field','alias','CmContactId\x20=\x20c.id','additionalPhone_','description','cm_contact_has_items','ItemTypeId\x20=\x20?','description_additionalPhone_','now','writeFileSync','setHeader','Content-disposition','attachment;\x20filename=','list_%d_%s.csv','text/csv','/tmp/list_%d_%s.csv','sequelize','addCustomFields','Sequelize','TEXT','text','INTEGER','BOOLEAN','queryInterface','addColumn','cf_%s','getCustomFields','findAndCountAll','getGlobalCustomFields','addAgents','omit','spread','userCmList:save','removeAgents','emit','userCmList:remove','User','getAgents','eml-format','zip-dir','request-promise','moment','bluebird','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','api','../../config/utils','../../config/environment','../../mysqldb','redis','defaults','socket.io-emitter','./cmList.socket','register','sendStatus','end','status','offset','undefined','limit','count','Content-Range','apply','reject'];(function(_0x4996d5,_0x123daf){var _0x4793f9=function(_0x30c7ec){while(--_0x30c7ec){_0x4996d5['push'](_0x4996d5['shift']());}};_0x4793f9(++_0x123daf);}(_0xbea2,0x1b7));var _0x2bea=function(_0x2bc52e,_0x118655){_0x2bc52e=_0x2bc52e-0x0;var _0x19e153=_0xbea2[_0x2bc52e];return _0x19e153;};'use strict';var emlformat=require(_0x2bea('0x0'));var rimraf=require('rimraf');var zipdir=require(_0x2bea('0x1'));var jsonpatch=require('fast-json-patch');var rp=require(_0x2bea('0x2'));var moment=require(_0x2bea('0x3'));var BPromise=require(_0x2bea('0x4'));var Mustache=require('mustache');var util=require('util');var path=require('path');var sox=require(_0x2bea('0x5'));var csv=require(_0x2bea('0x6'));var ejs=require('ejs');var fs=require('fs');var fs_extra=require(_0x2bea('0x7'));var _=require(_0x2bea('0x8'));var squel=require(_0x2bea('0x9'));var crypto=require(_0x2bea('0xa'));var jsforce=require(_0x2bea('0xb'));var deskjs=require('desk.js');var toCsv=require('to-csv');var querystring=require(_0x2bea('0xc'));var Papa=require(_0x2bea('0xd'));var Redis=require('ioredis');var authService=require(_0x2bea('0xe'));var qs=require(_0x2bea('0xf'));var as=require(_0x2bea('0x10'));var hardwareService=require(_0x2bea('0x11'));var logger=require(_0x2bea('0x12'))(_0x2bea('0x13'));var utils=require(_0x2bea('0x14'));var config=require(_0x2bea('0x15'));var licenseUtil=require('../../config/license/util');var db=require(_0x2bea('0x16'))['db'];var csv_results;config[_0x2bea('0x17')]=_[_0x2bea('0x18')](config[_0x2bea('0x17')],{'host':'localhost','port':0x18eb});var socket=require(_0x2bea('0x19'))(new Redis(config['redis']));require(_0x2bea('0x1a'))[_0x2bea('0x1b')](socket);function respondWithStatusCode(_0x4f20f2,_0x367262){_0x367262=_0x367262||0xcc;return function(_0x4b746e){if(_0x4b746e){return _0x4f20f2[_0x2bea('0x1c')](_0x367262);}return _0x4f20f2['status'](_0x367262)[_0x2bea('0x1d')]();};}function respondWithResult(_0x1dfb30,_0x92e336){_0x92e336=_0x92e336||0xc8;return function(_0x4094e3){if(_0x4094e3){return _0x1dfb30[_0x2bea('0x1e')](_0x92e336)['json'](_0x4094e3);}};}function respondWithFilteredResult(_0x505628,_0x5ce3e6){return function(_0x4ceaf5){if(_0x4ceaf5){var _0x529c33=typeof _0x5ce3e6[_0x2bea('0x1f')]===_0x2bea('0x20')&&typeof _0x5ce3e6[_0x2bea('0x21')]===_0x2bea('0x20');var _0x5d2935=_0x4ceaf5[_0x2bea('0x22')];var _0x3d169c=_0x529c33?0x0:_0x5ce3e6[_0x2bea('0x1f')];var _0x1ab9e5=_0x529c33?_0x4ceaf5[_0x2bea('0x22')]:_0x5ce3e6[_0x2bea('0x1f')]+_0x5ce3e6['limit'];var _0x19397a;if(_0x1ab9e5>=_0x5d2935){_0x1ab9e5=_0x5d2935;_0x19397a=0xc8;}else{_0x19397a=0xce;}_0x505628[_0x2bea('0x1e')](_0x19397a);return _0x505628['set'](_0x2bea('0x23'),_0x3d169c+'-'+_0x1ab9e5+'/'+_0x5d2935)['json'](_0x4ceaf5);}return null;};}function patchUpdates(_0x4cf707){return function(_0x47e906){try{jsonpatch[_0x2bea('0x24')](_0x47e906,_0x4cf707,!![]);}catch(_0x265b94){return BPromise[_0x2bea('0x25')](_0x265b94);}return _0x47e906[_0x2bea('0x26')]();};}function saveUpdates(_0x335f29,_0x4aabbf){return function(_0x2ef180){if(_0x2ef180){return _0x2ef180['update'](_0x335f29)[_0x2bea('0x27')](function(_0xacd9f2){return _0xacd9f2;});}return null;};}function removeEntity(_0x480f39,_0x449a44){return function(_0x2f3924){if(_0x2f3924){return _0x2f3924['destroy']()[_0x2bea('0x27')](function(){var _0x53676f=_0x2f3924[_0x2bea('0x28')]({'plain':!![]});var _0x506b9b='Lists';return db[_0x2bea('0x29')]['destroy']({'where':{'type':_0x506b9b,'resourceId':_0x53676f['id']}})[_0x2bea('0x27')](function(){return _0x2f3924;});})[_0x2bea('0x27')](function(){_0x480f39['status'](0xcc)['end']();});}};}function handleEntityNotFound(_0xcdb169,_0x36503a){return function(_0x58c400){if(!_0x58c400){_0xcdb169['sendStatus'](0x194);}return _0x58c400;};}function handleError(_0x1a6ef2,_0x548df3){_0x548df3=_0x548df3||0x1f4;return function(_0x43004a){logger[_0x2bea('0x2a')](_0x43004a[_0x2bea('0x2b')]);if(_0x43004a[_0x2bea('0x2c')]){delete _0x43004a[_0x2bea('0x2c')];}_0x1a6ef2['status'](_0x548df3)['send'](_0x43004a);};}exports['index']=function(_0x841d27,_0xa90f12){var _0x4d414c={},_0xe645e5={},_0x1ee4a0={'count':0x0,'rows':[]};var _0x1d6356=_[_0x2bea('0x2d')](db[_0x2bea('0x2e')][_0x2bea('0x2f')],function(_0x1a530e){return{'name':_0x1a530e['fieldName'],'type':_0x1a530e[_0x2bea('0x30')][_0x2bea('0x31')]};});_0xe645e5[_0x2bea('0x32')]=_['map'](_0x1d6356,_0x2bea('0x2c'));_0xe645e5[_0x2bea('0x33')]=_['keys'](_0x841d27[_0x2bea('0x33')]);_0xe645e5[_0x2bea('0x34')]=_[_0x2bea('0x35')](_0xe645e5[_0x2bea('0x32')],_0xe645e5[_0x2bea('0x33')]);_0x4d414c['attributes']=_['intersection'](_0xe645e5[_0x2bea('0x32')],qs[_0x2bea('0x36')](_0x841d27[_0x2bea('0x33')][_0x2bea('0x36')]));_0x4d414c[_0x2bea('0x37')]=_0x4d414c[_0x2bea('0x37')][_0x2bea('0x38')]?_0x4d414c[_0x2bea('0x37')]:_0xe645e5[_0x2bea('0x32')];if(!_0x841d27['query'][_0x2bea('0x39')](_0x2bea('0x3a'))){_0x4d414c['limit']=qs[_0x2bea('0x21')](_0x841d27[_0x2bea('0x33')]['limit']);_0x4d414c[_0x2bea('0x1f')]=qs[_0x2bea('0x1f')](_0x841d27[_0x2bea('0x33')][_0x2bea('0x1f')]);}_0x4d414c[_0x2bea('0x3b')]=qs[_0x2bea('0x3c')](_0x841d27[_0x2bea('0x33')][_0x2bea('0x3c')]);_0x4d414c[_0x2bea('0x3d')]=qs[_0x2bea('0x34')](_['pick'](_0x841d27[_0x2bea('0x33')],_0xe645e5[_0x2bea('0x34')]),_0x1d6356);if(_0x841d27[_0x2bea('0x33')][_0x2bea('0x3e')]){_0x4d414c[_0x2bea('0x3d')]=_[_0x2bea('0x3f')](_0x4d414c[_0x2bea('0x3d')],{'$or':_[_0x2bea('0x2d')](_0x1d6356,function(_0x332e7f){if(_0x332e7f['type']!==_0x2bea('0x40')){var _0x4cb354={};_0x4cb354[_0x332e7f[_0x2bea('0x2c')]]={'$like':'%'+_0x841d27['query'][_0x2bea('0x3e')]+'%'};return _0x4cb354;}})});}_0x4d414c=_['merge']({},_0x4d414c,_0x841d27[_0x2bea('0x41')]);var _0x5183e5={'where':_0x4d414c[_0x2bea('0x3d')]};return db[_0x2bea('0x2e')]['count'](_0x5183e5)[_0x2bea('0x27')](function(_0x53d73c){_0x1ee4a0[_0x2bea('0x22')]=_0x53d73c;if(_0x841d27['query'][_0x2bea('0x42')]){_0x4d414c[_0x2bea('0x43')]=[{'all':!![]}];}return db[_0x2bea('0x2e')][_0x2bea('0x44')](_0x4d414c);})[_0x2bea('0x27')](function(_0xedcbab){_0x1ee4a0[_0x2bea('0x45')]=_0xedcbab;return _0x1ee4a0;})[_0x2bea('0x27')](respondWithFilteredResult(_0xa90f12,_0x4d414c))[_0x2bea('0x46')](handleError(_0xa90f12,null));};exports['show']=function(_0x2394da,_0x300442){var _0x337feb={'raw':![],'where':{'id':_0x2394da[_0x2bea('0x47')]['id']}},_0x2dc3d3={};_0x2dc3d3[_0x2bea('0x32')]=_[_0x2bea('0x48')](db[_0x2bea('0x2e')][_0x2bea('0x2f')]);_0x2dc3d3[_0x2bea('0x33')]=_[_0x2bea('0x48')](_0x2394da[_0x2bea('0x33')]);_0x2dc3d3[_0x2bea('0x34')]=_[_0x2bea('0x35')](_0x2dc3d3[_0x2bea('0x32')],_0x2dc3d3[_0x2bea('0x33')]);_0x337feb[_0x2bea('0x37')]=_[_0x2bea('0x35')](_0x2dc3d3[_0x2bea('0x32')],qs['fields'](_0x2394da['query'][_0x2bea('0x36')]));_0x337feb[_0x2bea('0x37')]=_0x337feb[_0x2bea('0x37')][_0x2bea('0x38')]?_0x337feb[_0x2bea('0x37')]:_0x2dc3d3[_0x2bea('0x32')];if(_0x2394da[_0x2bea('0x33')][_0x2bea('0x42')]){_0x337feb[_0x2bea('0x43')]=[{'all':!![]}];}_0x337feb=_['merge']({},_0x337feb,_0x2394da['options']);return db[_0x2bea('0x2e')][_0x2bea('0x49')](_0x337feb)[_0x2bea('0x27')](handleEntityNotFound(_0x300442,null))[_0x2bea('0x27')](respondWithResult(_0x300442,null))[_0x2bea('0x46')](handleError(_0x300442,null));};exports[_0x2bea('0x4a')]=function(_0x1fb592,_0x262963){return db['CmList']['create'](_0x1fb592['body'],{})['then'](function(_0x30086e){var _0x55450e=_0x1fb592[_0x2bea('0x4b')][_0x2bea('0x28')]({'plain':!![]});if(!_0x55450e)throw new Error(_0x2bea('0x4c'));if(_0x55450e[_0x2bea('0x4d')]===_0x2bea('0x4b')){var _0x3fdef4=_0x30086e[_0x2bea('0x28')]({'plain':!![]});var _0x14716b=_0x2bea('0x4e');return db[_0x2bea('0x4f')]['find']({'where':{'name':_0x14716b,'userProfileId':_0x55450e[_0x2bea('0x50')]},'raw':!![]})['then'](function(_0x4edf57){if(_0x4edf57&&_0x4edf57[_0x2bea('0x51')]===0x0){return db['UserProfileResource'][_0x2bea('0x4a')]({'name':_0x3fdef4['name'],'resourceId':_0x3fdef4['id'],'type':_0x4edf57[_0x2bea('0x2c')],'sectionId':_0x4edf57['id']},{})[_0x2bea('0x27')](function(){return _0x30086e;});}else{return _0x30086e;}})[_0x2bea('0x46')](function(_0xde8994){logger[_0x2bea('0x2a')](_0x2bea('0x52'),_0xde8994);throw _0xde8994;});}return _0x30086e;})[_0x2bea('0x27')](respondWithResult(_0x262963,0xc9))[_0x2bea('0x46')](handleError(_0x262963,null));};exports[_0x2bea('0x53')]=function(_0x2dc05b,_0x5c48aa){if(_0x2dc05b[_0x2bea('0x54')]['id']){delete _0x2dc05b[_0x2bea('0x54')]['id'];}return db[_0x2bea('0x2e')][_0x2bea('0x49')]({'where':{'id':_0x2dc05b[_0x2bea('0x47')]['id']}})[_0x2bea('0x27')](handleEntityNotFound(_0x5c48aa,null))['then'](saveUpdates(_0x2dc05b['body'],null))[_0x2bea('0x27')](respondWithResult(_0x5c48aa,null))[_0x2bea('0x46')](handleError(_0x5c48aa,null));};exports[_0x2bea('0x55')]=function(_0x873ac8,_0x126456){return db['CmList']['find']({'where':{'id':_0x873ac8[_0x2bea('0x47')]['id']}})[_0x2bea('0x27')](handleEntityNotFound(_0x126456,null))[_0x2bea('0x27')](removeEntity(_0x126456,null))[_0x2bea('0x46')](handleError(_0x126456,null));};exports[_0x2bea('0x56')]=function(_0x5dd918,_0x392571){return db[_0x2bea('0x2e')][_0x2bea('0x56')]()['then'](respondWithResult(_0x392571,null))[_0x2bea('0x46')](handleError(_0x392571,null));};exports[_0x2bea('0x57')]=function(_0x5e6b07,_0x26528a,_0x34a820){if(_0x5e6b07[_0x2bea('0x54')]['id']){delete _0x5e6b07[_0x2bea('0x54')]['id'];}return db[_0x2bea('0x2e')]['find']({'where':{'id':_0x5e6b07[_0x2bea('0x47')]['id']}})[_0x2bea('0x27')](handleEntityNotFound(_0x26528a,null))['then'](function(_0x5d535b){if(_0x5d535b){_0x5e6b07[_0x2bea('0x54')][_0x2bea('0x58')]=_0x5d535b['id'];return db[_0x2bea('0x59')]['create'](_0x5e6b07[_0x2bea('0x54')]);}})['then'](respondWithResult(_0x26528a,null))['catch'](handleError(_0x26528a,null));};exports[_0x2bea('0x5a')]=function(_0x1bd265,_0x475c4f,_0xc206a6){var _0x2af97f={'raw':![],'where':{}};var _0x598ad1={};var _0x2c4fac={'count':0x0,'rows':[]};return db[_0x2bea('0x2e')][_0x2bea('0x5b')]({'where':{'id':_0x1bd265[_0x2bea('0x47')]['id']}})[_0x2bea('0x27')](handleEntityNotFound(_0x475c4f,null))[_0x2bea('0x27')](function(_0x4dfbed){if(_0x4dfbed){_0x598ad1['model']=_[_0x2bea('0x48')](db[_0x2bea('0x59')]['rawAttributes']);_0x598ad1[_0x2bea('0x33')]=_[_0x2bea('0x48')](_0x1bd265[_0x2bea('0x33')]);_0x598ad1['filters']=_[_0x2bea('0x35')](_0x598ad1[_0x2bea('0x32')],_0x598ad1['query']);_0x2af97f[_0x2bea('0x37')]=_['intersection'](_0x598ad1[_0x2bea('0x32')],qs[_0x2bea('0x36')](_0x1bd265['query'][_0x2bea('0x36')]));_0x2af97f[_0x2bea('0x37')]=_0x2af97f['attributes'][_0x2bea('0x38')]?_0x2af97f[_0x2bea('0x37')]:_0x598ad1['model'];if(!_0x1bd265[_0x2bea('0x33')]['hasOwnProperty']('nolimit')){_0x2af97f['limit']=qs[_0x2bea('0x21')](_0x1bd265['query'][_0x2bea('0x21')]);_0x2af97f[_0x2bea('0x1f')]=qs[_0x2bea('0x1f')](_0x1bd265[_0x2bea('0x33')]['offset']);}_0x2af97f['order']=qs[_0x2bea('0x3c')](_0x1bd265[_0x2bea('0x33')][_0x2bea('0x3c')]);_0x2af97f['where']=qs[_0x2bea('0x34')](_['pick'](_0x1bd265[_0x2bea('0x33')],_0x598ad1[_0x2bea('0x34')]));_0x2af97f['where'][_0x2bea('0x58')]=_0x4dfbed['id'];if(_0x1bd265[_0x2bea('0x33')][_0x2bea('0x3e')]){_0x2af97f[_0x2bea('0x3d')]=_['merge'](_0x2af97f[_0x2bea('0x3d')],{'$or':_[_0x2bea('0x2d')](_0x2af97f[_0x2bea('0x37')],function(_0x4c4ae5){var _0x1dbd19={};_0x1dbd19[_0x4c4ae5]={'$like':'%'+_0x1bd265[_0x2bea('0x33')]['filter']+'%'};return _0x1dbd19;})});}_0x2af97f=_[_0x2bea('0x3f')]({},_0x2af97f,_0x1bd265[_0x2bea('0x41')]);return db[_0x2bea('0x59')][_0x2bea('0x22')]({'where':_0x2af97f[_0x2bea('0x3d')]})[_0x2bea('0x27')](function(_0x3f229b){_0x2c4fac[_0x2bea('0x22')]=_0x3f229b;if(_0x1bd265[_0x2bea('0x33')][_0x2bea('0x42')]){_0x2af97f[_0x2bea('0x43')]=[{'all':!![]}];}return db['Disposition'][_0x2bea('0x44')](_0x2af97f);})[_0x2bea('0x27')](function(_0x111f6e){_0x2c4fac['rows']=_0x111f6e;return _0x2c4fac;});}})[_0x2bea('0x27')](respondWithFilteredResult(_0x475c4f,_0x2af97f))[_0x2bea('0x46')](handleError(_0x475c4f,null));};exports[_0x2bea('0x5c')]=function(_0x10ea33,_0x2ea941,_0x1902f8){return db[_0x2bea('0x2e')][_0x2bea('0x49')]({'where':{'id':_0x10ea33['params']['id']}})[_0x2bea('0x27')](handleEntityNotFound(_0x2ea941,null))[_0x2bea('0x27')](function(_0xea2606){if(_0xea2606){return _0xea2606[_0x2bea('0x5c')](_0x10ea33[_0x2bea('0x33')][_0x2bea('0x5d')]);}})['then'](respondWithStatusCode(_0x2ea941,null))['catch'](handleError(_0x2ea941,null));};exports[_0x2bea('0x5e')]=function(_0x7eba8f,_0x3312bc,_0x4426bd){return db[_0x2bea('0x2e')]['find']({'where':{'id':_0x7eba8f['params']['id']}})[_0x2bea('0x27')](handleEntityNotFound(_0x3312bc,null))[_0x2bea('0x27')](function(_0x24a082){if(_0x24a082){var _0x1ec9d3=[];var _0x4d7ad0={'success':[],'errors':[]};return db[_0x2bea('0x5f')]['describe']()[_0x2bea('0x27')](function(_0x23cd18){if(_0x7eba8f[_0x2bea('0x54')][_0x2bea('0x60')]&&_[_0x2bea('0x61')](_0x7eba8f[_0x2bea('0x54')][_0x2bea('0x60')])){if(_0x7eba8f[_0x2bea('0x54')][_0x2bea('0x60')][_0x2bea('0x38')]){_0x7eba8f['body'][_0x2bea('0x60')]=_0x7eba8f[_0x2bea('0x54')][_0x2bea('0x60')][_0x2bea('0x62')](';')+';';}else{_0x7eba8f[_0x2bea('0x54')]['tags']=null;}}else{_0x7eba8f[_0x2bea('0x54')][_0x2bea('0x60')]=null;}if(_0x7eba8f[_0x2bea('0x54')]&&_['isArray'](_0x7eba8f[_0x2bea('0x54')])){for(var _0x47d005=0x0;_0x47d005<_0x7eba8f[_0x2bea('0x54')][_0x2bea('0x38')];_0x47d005+=0x1){_0x7eba8f[_0x2bea('0x54')][_0x47d005]['ListId']=_0x7eba8f[_0x2bea('0x47')]['id'];_0x1ec9d3[_0x2bea('0x63')](_0x7eba8f[_0x2bea('0x54')][_0x47d005]);}return BPromise[_0x2bea('0x64')](_0x1ec9d3,function(_0x47bb52){return db[_0x2bea('0x5f')]['create'](_['omit'](_0x47bb52,[_0x2bea('0x5d'),'id'])||{},{'fields':_[_0x2bea('0x48')](_0x23cd18),'raw':!![]})[_0x2bea('0x27')](function(_0x38550f){_0x4d7ad0[_0x2bea('0x65')]['push'](_0x38550f['dataValues']);})[_0x2bea('0x46')](function(_0x6da2ca){_0x4d7ad0[_0x2bea('0x66')]['push']({'data':_0x47bb52,'error':_0x6da2ca[_0x2bea('0x67')]});});})['then'](function(_0x5238a8){return _0x4d7ad0;})['catch'](function(_0x5bd7c0){return _0x5bd7c0;});}else{_0x3312bc[_0x2bea('0x1e')](0x190)[_0x2bea('0x68')]({'message':'Malformed\x20request\x20syntax'});}});}})[_0x2bea('0x27')](respondWithResult(_0x3312bc,null))[_0x2bea('0x46')](handleError(_0x3312bc,null));};exports[_0x2bea('0x69')]=function(_0x4b1108,_0x53e4f4,_0x523b9a){var _0x4eec04;return db[_0x2bea('0x2e')][_0x2bea('0x49')]({'where':{'id':_0x4b1108['params']['id']},'include':[{'model':db[_0x2bea('0x6a')],'as':'CustomFields'}]})[_0x2bea('0x27')](handleEntityNotFound(_0x53e4f4,null))['then'](function(_0x46ee48){if(_0x46ee48){_0x4eec04=_0x46ee48;return db['CmContact'][_0x2bea('0x2f')];}})[_0x2bea('0x27')](function(_0x24b66f){if(_0x24b66f){var _0x5e61d0={};var _0x38a42b={};_0x38a42b[_0x2bea('0x32')]=_[_0x2bea('0x6b')](_[_0x2bea('0x48')](_0x24b66f),_[_0x2bea('0x2d')](_0x4eec04[_0x2bea('0x6c')],function(_0x1c060f){return util[_0x2bea('0x6d')](_0x2bea('0x6e'),_0x1c060f['id']);}));_0x38a42b['query']=_[_0x2bea('0x48')](_0x4b1108[_0x2bea('0x33')]);_0x38a42b[_0x2bea('0x34')]=_[_0x2bea('0x35')](_0x38a42b[_0x2bea('0x32')],_0x38a42b[_0x2bea('0x33')]);_0x5e61d0[_0x2bea('0x37')]=_[_0x2bea('0x35')](_0x38a42b[_0x2bea('0x32')],qs[_0x2bea('0x36')](_0x4b1108['query']['fields']));_0x5e61d0[_0x2bea('0x37')]=_0x5e61d0[_0x2bea('0x37')][_0x2bea('0x38')]?_0x5e61d0['attributes']:_0x38a42b[_0x2bea('0x32')];if(!_0x4b1108[_0x2bea('0x33')][_0x2bea('0x39')]('nolimit')){_0x5e61d0[_0x2bea('0x21')]=qs[_0x2bea('0x21')](_0x4b1108[_0x2bea('0x33')][_0x2bea('0x21')]);_0x5e61d0['offset']=qs[_0x2bea('0x1f')](_0x4b1108['query'][_0x2bea('0x1f')]);}_0x5e61d0[_0x2bea('0x3b')]=qs[_0x2bea('0x3c')](_0x4b1108['query'][_0x2bea('0x3c')]);_0x5e61d0[_0x2bea('0x3d')]=qs['filters'](_[_0x2bea('0x6f')](_0x4b1108['query'],_0x38a42b[_0x2bea('0x34')]));_0x5e61d0[_0x2bea('0x70')]=!![];if(_0x4b1108['query'][_0x2bea('0x3e')]){_0x5e61d0[_0x2bea('0x3d')]=_[_0x2bea('0x3f')](_0x5e61d0[_0x2bea('0x3d')],{'$or':_['map'](_0x5e61d0[_0x2bea('0x37')],function(_0x2f44fe){var _0x36c860={};_0x36c860[_0x2f44fe]={'$like':'%'+_0x4b1108[_0x2bea('0x33')]['filter']+'%'};return _0x36c860;})});}_0x5e61d0=_[_0x2bea('0x3f')]({},_0x5e61d0,_0x4b1108['options']);return _0x4eec04[_0x2bea('0x69')](_0x5e61d0);}})[_0x2bea('0x27')](respondWithResult(_0x53e4f4,null))[_0x2bea('0x46')](handleError(_0x53e4f4,null));};exports[_0x2bea('0x71')]=function(_0x4d587e,_0x4fe204,_0x43c839){var _0x1d95bd;var _0x32c5a5;var _0x2c5d1d;var _0x25c49a=_0x4d587e[_0x2bea('0x47')]['id'];csv_results=[];return db['ContactItemType'][_0x2bea('0x44')]({'attributes':['id',_0x2bea('0x2c')],'raw':!![],'order':[_0x2bea('0x72')]})['then'](function(_0x1c10d8){_0x1d95bd=_0x1c10d8;var _0x13be83=_[_0x2bea('0x48')](db['CmContact'][_0x2bea('0x2f')]);return db[_0x2bea('0x6a')]['findAll']({'raw':!![],'attributes':['id','alias']})['then'](function(_0x29e679){_0x32c5a5=_0x29e679;var _0x2bca53=squel[_0x2bea('0x73')]()[_0x2bea('0x36')](_0x13be83)[_0x2bea('0x74')](_0x2bea('0x75'),'c')[_0x2bea('0x3d')](_0x2bea('0x76'),_0x25c49a)['where'](_0x2bea('0x77'))[_0x2bea('0x78')]();for(var _0x3f03f6=0x0;_0x3f03f6<_0x32c5a5['length'];_0x3f03f6++){_0x2bca53[_0x2bea('0x79')]('c.cf_'+_0x32c5a5[_0x3f03f6]['id'],'customField_'+_0x32c5a5[_0x3f03f6][_0x2bea('0x7a')]);}for(var _0x3f03f6=0x0;_0x3f03f6<_0x1d95bd[_0x2bea('0x38')];_0x3f03f6++){_0x2bca53[_0x2bea('0x79')](squel[_0x2bea('0x73')]()[_0x2bea('0x79')]('item')[_0x2bea('0x74')]('cm_contact_has_items')['where']('ItemTypeId\x20=\x20?',_0x1d95bd[_0x3f03f6]['id'])[_0x2bea('0x3d')](_0x2bea('0x7b')),_0x2bea('0x7c')+_0x1d95bd[_0x3f03f6][_0x2bea('0x2c')]);_0x2bca53[_0x2bea('0x79')](squel[_0x2bea('0x73')]()[_0x2bea('0x79')](_0x2bea('0x7d'))[_0x2bea('0x74')](_0x2bea('0x7e'))[_0x2bea('0x3d')](_0x2bea('0x7f'),_0x1d95bd[_0x3f03f6]['id'])[_0x2bea('0x3d')](_0x2bea('0x7b')),_0x2bea('0x80')+_0x1d95bd[_0x3f03f6][_0x2bea('0x2c')]);}var _0x70a839=[];_0x70a839[_0x2bea('0x63')](_0x2bca53['toString']());BPromise[_0x2bea('0x64')](_0x70a839,handleQuery)['then'](function(_0x36c1f9){handleQuery(_0x2bca53['toString']());var _0x5f660c=csv_results[0x0];if(!_['isEmpty'](_0x5f660c)){var _0x1d3a46=toCsv(_0x5f660c);var _0x31cfc4=Date[_0x2bea('0x81')]();fs[_0x2bea('0x82')](util['format']('/tmp/list_%d_%s.csv',_0x25c49a,_0x31cfc4),_0x1d3a46);_0x4fe204[_0x2bea('0x83')](_0x2bea('0x84'),_0x2bea('0x85')+util[_0x2bea('0x6d')](_0x2bea('0x86'),_0x25c49a,_0x31cfc4));_0x4fe204[_0x2bea('0x83')]('Content-type',_0x2bea('0x87'));return _0x4fe204['download'](util[_0x2bea('0x6d')](_0x2bea('0x88'),_0x25c49a,_0x31cfc4));}else{return _0x4fe204[_0x2bea('0x1c')](0xcc);}});});});};exports['addCustomField']=function(_0x417f54,_0x2b2cfa,_0x154d6c){var _0x3d0975;delete _0x417f54['body']['id'];return db[_0x2bea('0x2e')]['findOne']({'where':{'id':_0x417f54[_0x2bea('0x47')]['id']}})[_0x2bea('0x27')](handleEntityNotFound(_0x2b2cfa,null))[_0x2bea('0x27')](function(_0x483793){if(_0x483793){return db[_0x2bea('0x89')]['transaction'](function(_0x1184cd){return db[_0x2bea('0x6a')][_0x2bea('0x4a')](_0x417f54[_0x2bea('0x54')],{'transaction':_0x1184cd})[_0x2bea('0x27')](function(_0x58b735){_0x3d0975=_0x58b735;return _0x483793[_0x2bea('0x8a')](_0x58b735,{'transaction':_0x1184cd});})['then'](function(){var _0xdb6ef={'type':db[_0x2bea('0x8b')][_0x2bea('0x8c')],'transaction':_0x1184cd};switch(_0x417f54[_0x2bea('0x54')][_0x2bea('0x30')]){case _0x2bea('0x8d'):_0xdb6ef[_0x2bea('0x30')]=db['Sequelize'][_0x2bea('0x8c')];break;case'number':_0xdb6ef['type']=db[_0x2bea('0x8b')][_0x2bea('0x8e')];break;case'switch':_0xdb6ef[_0x2bea('0x30')]=db[_0x2bea('0x8b')][_0x2bea('0x8f')];_0xdb6ef['defaultValue']=![];break;default:}return db[_0x2bea('0x89')][_0x2bea('0x90')][_0x2bea('0x91')](_0x2bea('0x75'),util[_0x2bea('0x6d')](_0x2bea('0x92'),_0x3d0975['id']),_0xdb6ef);})['then'](function(){return _0x3d0975;});});}})['then'](respondWithResult(_0x2b2cfa,null))[_0x2bea('0x46')](handleError(_0x2b2cfa,null));};exports[_0x2bea('0x93')]=function(_0x2e330d,_0x528de5,_0x4ce9e4){var _0x4f2125={};var _0x8a6cd7={};var _0x2ff07b;var _0x14c3dc;return db[_0x2bea('0x2e')][_0x2bea('0x5b')]({'where':{'id':_0x2e330d[_0x2bea('0x47')]['id']}})[_0x2bea('0x27')](handleEntityNotFound(_0x528de5,null))[_0x2bea('0x27')](function(_0xfa8660){if(_0xfa8660){_0x2ff07b=_0xfa8660;_0x8a6cd7[_0x2bea('0x32')]=_[_0x2bea('0x48')](db[_0x2bea('0x6a')][_0x2bea('0x2f')]);_0x8a6cd7[_0x2bea('0x33')]=_[_0x2bea('0x48')](_0x2e330d[_0x2bea('0x33')]);_0x8a6cd7[_0x2bea('0x34')]=_['intersection'](_0x8a6cd7[_0x2bea('0x32')],_0x8a6cd7[_0x2bea('0x33')]);_0x4f2125['attributes']=_[_0x2bea('0x35')](_0x8a6cd7[_0x2bea('0x32')],qs['fields'](_0x2e330d['query'][_0x2bea('0x36')]));_0x4f2125[_0x2bea('0x37')]=_0x4f2125['attributes'][_0x2bea('0x38')]?_0x4f2125['attributes']:_0x8a6cd7['model'];_0x4f2125[_0x2bea('0x3b')]=qs[_0x2bea('0x3c')](_0x2e330d[_0x2bea('0x33')]['sort']);_0x4f2125[_0x2bea('0x3d')]=qs[_0x2bea('0x34')](_['pick'](_0x2e330d['query'],_0x8a6cd7['filters']));_0x4f2125[_0x2bea('0x3d')]=_[_0x2bea('0x3f')](_0x4f2125[_0x2bea('0x3d')],{'$or':[{'ListId':_0xfa8660['id']},{'ListId':null}]});if(_0x2e330d['query']['filter']){_0x4f2125[_0x2bea('0x3d')]=_['merge'](_0x4f2125[_0x2bea('0x3d')],{'$or':_['map'](_0x4f2125[_0x2bea('0x37')],function(_0x53981f){var _0x2944aa={};_0x2944aa[_0x53981f]={'$like':'%'+_0x2e330d['query'][_0x2bea('0x3e')]+'%'};return _0x2944aa;})});}_0x4f2125=_[_0x2bea('0x3f')]({},_0x4f2125,_0x2e330d[_0x2bea('0x41')]);return db['CmCustomField'][_0x2bea('0x94')](_0x4f2125);}})[_0x2bea('0x27')](respondWithResult(_0x528de5,null))[_0x2bea('0x46')](handleError(_0x528de5,null));};exports[_0x2bea('0x95')]=function(_0xd5f0d0,_0x90aa00){return db['CmCustomField']['findAndCountAll']({'where':{'ListId':null}})[_0x2bea('0x27')](handleEntityNotFound(_0x90aa00,null))[_0x2bea('0x27')](function(_0x102186){return _0x102186;})[_0x2bea('0x27')](respondWithResult(_0x90aa00,null))[_0x2bea('0x46')](handleError(_0x90aa00,null));};exports[_0x2bea('0x96')]=function(_0x8b3024,_0x19edce,_0x87e3aa){return db[_0x2bea('0x2e')][_0x2bea('0x49')]({'where':{'id':_0x8b3024[_0x2bea('0x47')]['id']}})[_0x2bea('0x27')](handleEntityNotFound(_0x19edce,null))['then'](function(_0x239f85){if(_0x239f85){return _0x239f85['addAgents'](_0x8b3024[_0x2bea('0x54')][_0x2bea('0x5d')],_[_0x2bea('0x97')](_0x8b3024[_0x2bea('0x54')],[_0x2bea('0x5d'),'id'])||{})[_0x2bea('0x98')](function(_0x1f578e){for(var _0x3e3052=0x0;_0x3e3052<_0x8b3024[_0x2bea('0x54')][_0x2bea('0x5d')][_0x2bea('0x38')];_0x3e3052+=0x1){socket['emit'](_0x2bea('0x99'),{'UserId':Number(_0x8b3024[_0x2bea('0x54')][_0x2bea('0x5d')][_0x3e3052]),'CmListId':Number(_0x8b3024['params']['id'])});}return _0x1f578e;});}})[_0x2bea('0x27')](respondWithResult(_0x19edce,null))[_0x2bea('0x46')](handleError(_0x19edce,null));};exports[_0x2bea('0x9a')]=function(_0x3d0d21,_0xad686e,_0x4df71d){return db[_0x2bea('0x2e')]['find']({'where':{'id':_0x3d0d21[_0x2bea('0x47')]['id']}})['then'](handleEntityNotFound(_0xad686e,null))[_0x2bea('0x27')](function(_0x4c0d19){if(_0x4c0d19){return _0x4c0d19['removeAgents'](_0x3d0d21[_0x2bea('0x33')][_0x2bea('0x5d')])[_0x2bea('0x27')](function(){if(_['isArray'](_0x3d0d21['query'][_0x2bea('0x5d')])){for(var _0x1d0fb3=0x0;_0x1d0fb3<_0x3d0d21['query'][_0x2bea('0x5d')]['length'];_0x1d0fb3+=0x1){socket[_0x2bea('0x9b')](_0x2bea('0x9c'),{'UserId':Number(_0x3d0d21['query'][_0x2bea('0x5d')][_0x1d0fb3]),'CmListId':Number(_0x3d0d21[_0x2bea('0x47')]['id'])});}}else{socket[_0x2bea('0x9b')](_0x2bea('0x9c'),{'UserId':Number(_0x3d0d21[_0x2bea('0x33')]['ids']),'CmListId':Number(_0x3d0d21[_0x2bea('0x47')]['id'])});}});}})[_0x2bea('0x27')](respondWithStatusCode(_0xad686e,null))['catch'](handleError(_0xad686e,null));};exports['getAgents']=function(_0x47ef60,_0x152299,_0x351ea5){var _0x465d02={};var _0x523576={};var _0x305810;var _0x1e221e;return db['CmList'][_0x2bea('0x5b')]({'where':{'id':_0x47ef60['params']['id']}})[_0x2bea('0x27')](handleEntityNotFound(_0x152299,null))['then'](function(_0x3015ea){if(_0x3015ea){_0x305810=_0x3015ea;_0x523576[_0x2bea('0x32')]=_[_0x2bea('0x48')](db[_0x2bea('0x9d')][_0x2bea('0x2f')]);_0x523576['query']=_[_0x2bea('0x48')](_0x47ef60[_0x2bea('0x33')]);_0x523576[_0x2bea('0x34')]=_[_0x2bea('0x35')](_0x523576['model'],_0x523576['query']);_0x465d02[_0x2bea('0x37')]=_[_0x2bea('0x35')](_0x523576[_0x2bea('0x32')],qs['fields'](_0x47ef60[_0x2bea('0x33')][_0x2bea('0x36')]));_0x465d02[_0x2bea('0x37')]=_0x465d02[_0x2bea('0x37')][_0x2bea('0x38')]?_0x465d02[_0x2bea('0x37')]:_0x523576[_0x2bea('0x32')];_0x465d02[_0x2bea('0x3b')]=qs[_0x2bea('0x3c')](_0x47ef60[_0x2bea('0x33')][_0x2bea('0x3c')]);_0x465d02[_0x2bea('0x3d')]=qs[_0x2bea('0x34')](_['pick'](_0x47ef60[_0x2bea('0x33')],_0x523576[_0x2bea('0x34')]));if(_0x47ef60[_0x2bea('0x33')][_0x2bea('0x3e')]){_0x465d02[_0x2bea('0x3d')]=_[_0x2bea('0x3f')](_0x465d02['where'],{'$or':_[_0x2bea('0x2d')](_0x465d02[_0x2bea('0x37')],function(_0x3f1d04){var _0x1dd99a={};_0x1dd99a[_0x3f1d04]={'$like':'%'+_0x47ef60[_0x2bea('0x33')][_0x2bea('0x3e')]+'%'};return _0x1dd99a;})});}_0x465d02=_[_0x2bea('0x3f')]({},_0x465d02,_0x47ef60[_0x2bea('0x41')]);return _0x305810[_0x2bea('0x9e')](_0x465d02);}})[_0x2bea('0x27')](function(_0x5c864f){if(_0x5c864f){_0x1e221e=_0x5c864f[_0x2bea('0x38')];if(!_0x47ef60[_0x2bea('0x33')][_0x2bea('0x39')](_0x2bea('0x3a'))){_0x465d02[_0x2bea('0x21')]=qs['limit'](_0x47ef60[_0x2bea('0x33')][_0x2bea('0x21')]);_0x465d02[_0x2bea('0x1f')]=qs[_0x2bea('0x1f')](_0x47ef60['query']['offset']);}return _0x305810[_0x2bea('0x9e')](_0x465d02);}})[_0x2bea('0x27')](function(_0x4ae189){if(_0x4ae189){return _0x4ae189?{'count':_0x1e221e,'rows':_0x4ae189}:null;}})['then'](respondWithResult(_0x152299,null))[_0x2bea('0x46')](handleError(_0x152299,null));};function handleQuery(_0x3d8388){logger['info'](_0x3d8388);return db[_0x2bea('0x89')][_0x2bea('0x33')](_0x3d8388)['spread'](function(_0x4d54fd){csv_results[_0x2bea('0x63')](_0x4d54fd);})[_0x2bea('0x46')](function(_0x2124b7){logger[_0x2bea('0x2a')](_0x2124b7[_0x2bea('0x67')]);});} \ No newline at end of file +var _0x8b8f=['json','offset','limit','set','Content-Range','apply','save','update','then','destroy','UserProfileResource','sendStatus','error','stack','send','index','map','rawAttributes','fieldName','type','key','name','keys','filters','model','query','fields','attributes','hasOwnProperty','nolimit','order','sort','pick','filter','where','merge','VIRTUAL','options','CmList','count','includeAll','include','findAll','rows','catch','show','intersection','length','find','create','body','user','get','Unable\x20to\x20retrieve\x20the\x20current\x20user','role','Lists','UserProfileSection','userProfileId','autoAssociation','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','params','describe','addDisposition','Disposition','getDispositions','findOne','ListId','removeDispositions','addContacts','CmContact','isArray','tags','join','omit','ids','success','dataValues','errors','push','message','Malformed\x20request\x20syntax','CmCustomField','CustomFields','concat','format','cf_%d','getContactsCsv','ContactItemType','OrderBy','alias','select','from','cm_contacts','distinct','field','c.cf_','customField_','item','cm_contact_has_items','ItemTypeId\x20=\x20?','description','description_additionalPhone_','toString','each','isEmpty','/tmp/list_%d_%s.csv','setHeader','Content-disposition','attachment;\x20filename=','list_%d_%s.csv','text/csv','download','addCustomField','sequelize','transaction','Sequelize','text','INTEGER','switch','BOOLEAN','defaultValue','queryInterface','addColumn','cf_%s','getCustomFields','addAgents','spread','userCmList:save','removeAgents','emit','userCmList:remove','getAgents','User','rimraf','zip-dir','fast-json-patch','request-promise','moment','bluebird','mustache','util','path','sox','to-csv','ejs','fs-extra','lodash','crypto','jsforce','desk.js','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/utils','../../mysqldb','defaults','redis','localhost','socket.io-emitter','./cmList.socket','status','end'];(function(_0x16acc6,_0x3dd9ae){var _0x2970f1=function(_0x40e0ad){while(--_0x40e0ad){_0x16acc6['push'](_0x16acc6['shift']());}};_0x2970f1(++_0x3dd9ae);}(_0x8b8f,0x85));var _0xf8b8=function(_0x15224c,_0x9c3cac){_0x15224c=_0x15224c-0x0;var _0x1c1cb7=_0x8b8f[_0x15224c];return _0x1c1cb7;};'use strict';var emlformat=require('eml-format');var rimraf=require(_0xf8b8('0x0'));var zipdir=require(_0xf8b8('0x1'));var jsonpatch=require(_0xf8b8('0x2'));var rp=require(_0xf8b8('0x3'));var moment=require(_0xf8b8('0x4'));var BPromise=require(_0xf8b8('0x5'));var Mustache=require(_0xf8b8('0x6'));var util=require(_0xf8b8('0x7'));var path=require(_0xf8b8('0x8'));var sox=require(_0xf8b8('0x9'));var csv=require(_0xf8b8('0xa'));var ejs=require(_0xf8b8('0xb'));var fs=require('fs');var fs_extra=require(_0xf8b8('0xc'));var _=require(_0xf8b8('0xd'));var squel=require('squel');var crypto=require(_0xf8b8('0xe'));var jsforce=require(_0xf8b8('0xf'));var deskjs=require(_0xf8b8('0x10'));var toCsv=require(_0xf8b8('0xa'));var querystring=require(_0xf8b8('0x11'));var Papa=require(_0xf8b8('0x12'));var Redis=require(_0xf8b8('0x13'));var authService=require(_0xf8b8('0x14'));var qs=require(_0xf8b8('0x15'));var as=require(_0xf8b8('0x16'));var hardwareService=require(_0xf8b8('0x17'));var logger=require(_0xf8b8('0x18'))(_0xf8b8('0x19'));var utils=require(_0xf8b8('0x1a'));var config=require('../../config/environment');var licenseUtil=require('../../config/license/util');var db=require(_0xf8b8('0x1b'))['db'];var csv_results;config['redis']=_[_0xf8b8('0x1c')](config[_0xf8b8('0x1d')],{'host':_0xf8b8('0x1e'),'port':0x18eb});var socket=require(_0xf8b8('0x1f'))(new Redis(config[_0xf8b8('0x1d')]));require(_0xf8b8('0x20'))['register'](socket);function respondWithStatusCode(_0x18b6ee,_0x102693){_0x102693=_0x102693||0xcc;return function(_0x13f812){if(_0x13f812){return _0x18b6ee['sendStatus'](_0x102693);}return _0x18b6ee[_0xf8b8('0x21')](_0x102693)[_0xf8b8('0x22')]();};}function respondWithResult(_0x4f94b6,_0x9e25ca){_0x9e25ca=_0x9e25ca||0xc8;return function(_0x2e4d70){if(_0x2e4d70){return _0x4f94b6[_0xf8b8('0x21')](_0x9e25ca)[_0xf8b8('0x23')](_0x2e4d70);}};}function respondWithFilteredResult(_0x373c61,_0x58b491){return function(_0x4a452b){if(_0x4a452b){var _0x2d1e1f=typeof _0x58b491[_0xf8b8('0x24')]==='undefined'&&typeof _0x58b491[_0xf8b8('0x25')]==='undefined';var _0x16881f=_0x4a452b['count'];var _0x11e5e8=_0x2d1e1f?0x0:_0x58b491[_0xf8b8('0x24')];var _0x53694a=_0x2d1e1f?_0x4a452b['count']:_0x58b491[_0xf8b8('0x24')]+_0x58b491['limit'];var _0x1f5314;if(_0x53694a>=_0x16881f){_0x53694a=_0x16881f;_0x1f5314=0xc8;}else{_0x1f5314=0xce;}_0x373c61[_0xf8b8('0x21')](_0x1f5314);return _0x373c61[_0xf8b8('0x26')](_0xf8b8('0x27'),_0x11e5e8+'-'+_0x53694a+'/'+_0x16881f)[_0xf8b8('0x23')](_0x4a452b);}return null;};}function patchUpdates(_0x2c9a26){return function(_0x1fc737){try{jsonpatch[_0xf8b8('0x28')](_0x1fc737,_0x2c9a26,!![]);}catch(_0x4accc9){return BPromise['reject'](_0x4accc9);}return _0x1fc737[_0xf8b8('0x29')]();};}function saveUpdates(_0x34d367,_0xb9d779){return function(_0x15df5e){if(_0x15df5e){return _0x15df5e[_0xf8b8('0x2a')](_0x34d367)[_0xf8b8('0x2b')](function(_0x7d4c1f){return _0x7d4c1f;});}return null;};}function removeEntity(_0x53e4fe,_0x485c25){return function(_0x3f9991){if(_0x3f9991){return _0x3f9991[_0xf8b8('0x2c')]()[_0xf8b8('0x2b')](function(){var _0x4c751e=_0x3f9991['get']({'plain':!![]});var _0x551593='Lists';return db[_0xf8b8('0x2d')][_0xf8b8('0x2c')]({'where':{'type':_0x551593,'resourceId':_0x4c751e['id']}})['then'](function(){return _0x3f9991;});})[_0xf8b8('0x2b')](function(){_0x53e4fe[_0xf8b8('0x21')](0xcc)[_0xf8b8('0x22')]();});}};}function handleEntityNotFound(_0x2b8a86,_0x310443){return function(_0x3ec8bb){if(!_0x3ec8bb){_0x2b8a86[_0xf8b8('0x2e')](0x194);}return _0x3ec8bb;};}function handleError(_0x45698d,_0x465a9b){_0x465a9b=_0x465a9b||0x1f4;return function(_0xbe3914){logger[_0xf8b8('0x2f')](_0xbe3914[_0xf8b8('0x30')]);if(_0xbe3914['name']){delete _0xbe3914['name'];}_0x45698d[_0xf8b8('0x21')](_0x465a9b)[_0xf8b8('0x31')](_0xbe3914);};}exports[_0xf8b8('0x32')]=function(_0xa9e211,_0x5cc39e){var _0x409541={},_0xa21a59={},_0x212677={'count':0x0,'rows':[]};var _0x1e3729=_[_0xf8b8('0x33')](db['CmList'][_0xf8b8('0x34')],function(_0x122859){return{'name':_0x122859[_0xf8b8('0x35')],'type':_0x122859[_0xf8b8('0x36')][_0xf8b8('0x37')]};});_0xa21a59['model']=_[_0xf8b8('0x33')](_0x1e3729,_0xf8b8('0x38'));_0xa21a59['query']=_[_0xf8b8('0x39')](_0xa9e211['query']);_0xa21a59[_0xf8b8('0x3a')]=_['intersection'](_0xa21a59[_0xf8b8('0x3b')],_0xa21a59[_0xf8b8('0x3c')]);_0x409541['attributes']=_['intersection'](_0xa21a59[_0xf8b8('0x3b')],qs[_0xf8b8('0x3d')](_0xa9e211['query'][_0xf8b8('0x3d')]));_0x409541[_0xf8b8('0x3e')]=_0x409541[_0xf8b8('0x3e')]['length']?_0x409541['attributes']:_0xa21a59[_0xf8b8('0x3b')];if(!_0xa9e211[_0xf8b8('0x3c')][_0xf8b8('0x3f')](_0xf8b8('0x40'))){_0x409541[_0xf8b8('0x25')]=qs[_0xf8b8('0x25')](_0xa9e211[_0xf8b8('0x3c')][_0xf8b8('0x25')]);_0x409541[_0xf8b8('0x24')]=qs[_0xf8b8('0x24')](_0xa9e211[_0xf8b8('0x3c')][_0xf8b8('0x24')]);}_0x409541[_0xf8b8('0x41')]=qs['sort'](_0xa9e211[_0xf8b8('0x3c')][_0xf8b8('0x42')]);_0x409541['where']=qs[_0xf8b8('0x3a')](_[_0xf8b8('0x43')](_0xa9e211[_0xf8b8('0x3c')],_0xa21a59[_0xf8b8('0x3a')]),_0x1e3729);if(_0xa9e211[_0xf8b8('0x3c')][_0xf8b8('0x44')]){_0x409541[_0xf8b8('0x45')]=_[_0xf8b8('0x46')](_0x409541[_0xf8b8('0x45')],{'$or':_[_0xf8b8('0x33')](_0x1e3729,function(_0x4555d9){if(_0x4555d9[_0xf8b8('0x36')]!==_0xf8b8('0x47')){var _0x4e72c4={};_0x4e72c4[_0x4555d9[_0xf8b8('0x38')]]={'$like':'%'+_0xa9e211[_0xf8b8('0x3c')]['filter']+'%'};return _0x4e72c4;}})});}_0x409541=_['merge']({},_0x409541,_0xa9e211[_0xf8b8('0x48')]);var _0x202b85={'where':_0x409541[_0xf8b8('0x45')]};return db[_0xf8b8('0x49')][_0xf8b8('0x4a')](_0x202b85)[_0xf8b8('0x2b')](function(_0x2cb88e){_0x212677[_0xf8b8('0x4a')]=_0x2cb88e;if(_0xa9e211[_0xf8b8('0x3c')][_0xf8b8('0x4b')]){_0x409541[_0xf8b8('0x4c')]=[{'all':!![]}];}return db['CmList'][_0xf8b8('0x4d')](_0x409541);})['then'](function(_0x34ec6f){_0x212677[_0xf8b8('0x4e')]=_0x34ec6f;return _0x212677;})[_0xf8b8('0x2b')](respondWithFilteredResult(_0x5cc39e,_0x409541))[_0xf8b8('0x4f')](handleError(_0x5cc39e,null));};exports[_0xf8b8('0x50')]=function(_0x3907ff,_0x436f94){var _0xeef479={'raw':![],'where':{'id':_0x3907ff['params']['id']}},_0x1aa56e={};_0x1aa56e[_0xf8b8('0x3b')]=_[_0xf8b8('0x39')](db['CmList']['rawAttributes']);_0x1aa56e[_0xf8b8('0x3c')]=_[_0xf8b8('0x39')](_0x3907ff[_0xf8b8('0x3c')]);_0x1aa56e[_0xf8b8('0x3a')]=_['intersection'](_0x1aa56e['model'],_0x1aa56e['query']);_0xeef479['attributes']=_[_0xf8b8('0x51')](_0x1aa56e[_0xf8b8('0x3b')],qs[_0xf8b8('0x3d')](_0x3907ff['query'][_0xf8b8('0x3d')]));_0xeef479[_0xf8b8('0x3e')]=_0xeef479[_0xf8b8('0x3e')][_0xf8b8('0x52')]?_0xeef479[_0xf8b8('0x3e')]:_0x1aa56e[_0xf8b8('0x3b')];if(_0x3907ff['query'][_0xf8b8('0x4b')]){_0xeef479[_0xf8b8('0x4c')]=[{'all':!![]}];}_0xeef479=_['merge']({},_0xeef479,_0x3907ff['options']);return db[_0xf8b8('0x49')][_0xf8b8('0x53')](_0xeef479)[_0xf8b8('0x2b')](handleEntityNotFound(_0x436f94,null))['then'](respondWithResult(_0x436f94,null))[_0xf8b8('0x4f')](handleError(_0x436f94,null));};exports[_0xf8b8('0x54')]=function(_0x45a03e,_0x188bf9){return db[_0xf8b8('0x49')]['create'](_0x45a03e[_0xf8b8('0x55')],{})[_0xf8b8('0x2b')](function(_0x5bc448){var _0x411efa=_0x45a03e[_0xf8b8('0x56')][_0xf8b8('0x57')]({'plain':!![]});if(!_0x411efa)throw new Error(_0xf8b8('0x58'));if(_0x411efa[_0xf8b8('0x59')]===_0xf8b8('0x56')){var _0x20b5c6=_0x5bc448[_0xf8b8('0x57')]({'plain':!![]});var _0x2db531=_0xf8b8('0x5a');return db[_0xf8b8('0x5b')][_0xf8b8('0x53')]({'where':{'name':_0x2db531,'userProfileId':_0x411efa[_0xf8b8('0x5c')]},'raw':!![]})[_0xf8b8('0x2b')](function(_0x206dfb){if(_0x206dfb&&_0x206dfb[_0xf8b8('0x5d')]===0x0){return db[_0xf8b8('0x2d')][_0xf8b8('0x54')]({'name':_0x20b5c6[_0xf8b8('0x38')],'resourceId':_0x20b5c6['id'],'type':_0x206dfb[_0xf8b8('0x38')],'sectionId':_0x206dfb['id']},{})['then'](function(){return _0x5bc448;});}else{return _0x5bc448;}})['catch'](function(_0x490af0){logger['error'](_0xf8b8('0x5e'),_0x490af0);throw _0x490af0;});}return _0x5bc448;})[_0xf8b8('0x2b')](respondWithResult(_0x188bf9,0xc9))['catch'](handleError(_0x188bf9,null));};exports[_0xf8b8('0x2a')]=function(_0x18e96d,_0x1286df){if(_0x18e96d[_0xf8b8('0x55')]['id']){delete _0x18e96d['body']['id'];}return db[_0xf8b8('0x49')][_0xf8b8('0x53')]({'where':{'id':_0x18e96d[_0xf8b8('0x5f')]['id']}})['then'](handleEntityNotFound(_0x1286df,null))[_0xf8b8('0x2b')](saveUpdates(_0x18e96d[_0xf8b8('0x55')],null))[_0xf8b8('0x2b')](respondWithResult(_0x1286df,null))[_0xf8b8('0x4f')](handleError(_0x1286df,null));};exports[_0xf8b8('0x2c')]=function(_0xd1142b,_0x54ca04){return db[_0xf8b8('0x49')][_0xf8b8('0x53')]({'where':{'id':_0xd1142b['params']['id']}})['then'](handleEntityNotFound(_0x54ca04,null))[_0xf8b8('0x2b')](removeEntity(_0x54ca04,null))['catch'](handleError(_0x54ca04,null));};exports[_0xf8b8('0x60')]=function(_0x1f6e87,_0x3e3326){return db[_0xf8b8('0x49')][_0xf8b8('0x60')]()['then'](respondWithResult(_0x3e3326,null))[_0xf8b8('0x4f')](handleError(_0x3e3326,null));};exports[_0xf8b8('0x61')]=function(_0x4637d9,_0x2ec0ff,_0xce4675){if(_0x4637d9[_0xf8b8('0x55')]['id']){delete _0x4637d9['body']['id'];}return db[_0xf8b8('0x49')][_0xf8b8('0x53')]({'where':{'id':_0x4637d9[_0xf8b8('0x5f')]['id']}})[_0xf8b8('0x2b')](handleEntityNotFound(_0x2ec0ff,null))[_0xf8b8('0x2b')](function(_0x45f5c0){if(_0x45f5c0){_0x4637d9['body']['ListId']=_0x45f5c0['id'];return db[_0xf8b8('0x62')][_0xf8b8('0x54')](_0x4637d9[_0xf8b8('0x55')]);}})[_0xf8b8('0x2b')](respondWithResult(_0x2ec0ff,null))[_0xf8b8('0x4f')](handleError(_0x2ec0ff,null));};exports[_0xf8b8('0x63')]=function(_0x1df87b,_0x5d3108,_0x39af87){var _0x978ee5={'raw':![],'where':{}};var _0x4a28ea={};var _0x435735={'count':0x0,'rows':[]};return db[_0xf8b8('0x49')][_0xf8b8('0x64')]({'where':{'id':_0x1df87b[_0xf8b8('0x5f')]['id']}})[_0xf8b8('0x2b')](handleEntityNotFound(_0x5d3108,null))[_0xf8b8('0x2b')](function(_0x28efa0){if(_0x28efa0){_0x4a28ea[_0xf8b8('0x3b')]=_[_0xf8b8('0x39')](db[_0xf8b8('0x62')][_0xf8b8('0x34')]);_0x4a28ea[_0xf8b8('0x3c')]=_[_0xf8b8('0x39')](_0x1df87b['query']);_0x4a28ea[_0xf8b8('0x3a')]=_[_0xf8b8('0x51')](_0x4a28ea[_0xf8b8('0x3b')],_0x4a28ea[_0xf8b8('0x3c')]);_0x978ee5[_0xf8b8('0x3e')]=_[_0xf8b8('0x51')](_0x4a28ea[_0xf8b8('0x3b')],qs[_0xf8b8('0x3d')](_0x1df87b[_0xf8b8('0x3c')][_0xf8b8('0x3d')]));_0x978ee5[_0xf8b8('0x3e')]=_0x978ee5[_0xf8b8('0x3e')][_0xf8b8('0x52')]?_0x978ee5[_0xf8b8('0x3e')]:_0x4a28ea['model'];if(!_0x1df87b['query'][_0xf8b8('0x3f')](_0xf8b8('0x40'))){_0x978ee5[_0xf8b8('0x25')]=qs[_0xf8b8('0x25')](_0x1df87b[_0xf8b8('0x3c')][_0xf8b8('0x25')]);_0x978ee5[_0xf8b8('0x24')]=qs['offset'](_0x1df87b['query'][_0xf8b8('0x24')]);}_0x978ee5[_0xf8b8('0x41')]=qs[_0xf8b8('0x42')](_0x1df87b['query'][_0xf8b8('0x42')]);_0x978ee5[_0xf8b8('0x45')]=qs[_0xf8b8('0x3a')](_['pick'](_0x1df87b[_0xf8b8('0x3c')],_0x4a28ea[_0xf8b8('0x3a')]));_0x978ee5[_0xf8b8('0x45')][_0xf8b8('0x65')]=_0x28efa0['id'];if(_0x1df87b['query']['filter']){_0x978ee5['where']=_[_0xf8b8('0x46')](_0x978ee5['where'],{'$or':_['map'](_0x978ee5[_0xf8b8('0x3e')],function(_0x2ae608){var _0xfb06ec={};_0xfb06ec[_0x2ae608]={'$like':'%'+_0x1df87b[_0xf8b8('0x3c')][_0xf8b8('0x44')]+'%'};return _0xfb06ec;})});}_0x978ee5=_[_0xf8b8('0x46')]({},_0x978ee5,_0x1df87b[_0xf8b8('0x48')]);return db['Disposition'][_0xf8b8('0x4a')]({'where':_0x978ee5[_0xf8b8('0x45')]})[_0xf8b8('0x2b')](function(_0x15b0d8){_0x435735[_0xf8b8('0x4a')]=_0x15b0d8;if(_0x1df87b[_0xf8b8('0x3c')][_0xf8b8('0x4b')]){_0x978ee5[_0xf8b8('0x4c')]=[{'all':!![]}];}return db['Disposition'][_0xf8b8('0x4d')](_0x978ee5);})[_0xf8b8('0x2b')](function(_0x6f4782){_0x435735[_0xf8b8('0x4e')]=_0x6f4782;return _0x435735;});}})['then'](respondWithFilteredResult(_0x5d3108,_0x978ee5))['catch'](handleError(_0x5d3108,null));};exports[_0xf8b8('0x66')]=function(_0x4c177f,_0x433e9d,_0xb9e4a4){return db[_0xf8b8('0x49')][_0xf8b8('0x53')]({'where':{'id':_0x4c177f[_0xf8b8('0x5f')]['id']}})[_0xf8b8('0x2b')](handleEntityNotFound(_0x433e9d,null))[_0xf8b8('0x2b')](function(_0x42313b){if(_0x42313b){return _0x42313b[_0xf8b8('0x66')](_0x4c177f[_0xf8b8('0x3c')]['ids']);}})[_0xf8b8('0x2b')](respondWithStatusCode(_0x433e9d,null))[_0xf8b8('0x4f')](handleError(_0x433e9d,null));};exports[_0xf8b8('0x67')]=function(_0x4b494a,_0xefbb2a,_0x4c9ef1){return db[_0xf8b8('0x49')][_0xf8b8('0x53')]({'where':{'id':_0x4b494a[_0xf8b8('0x5f')]['id']}})[_0xf8b8('0x2b')](handleEntityNotFound(_0xefbb2a,null))[_0xf8b8('0x2b')](function(_0x165385){if(_0x165385){var _0x54470f=[];var _0xb19a22={'success':[],'errors':[]};return db[_0xf8b8('0x68')][_0xf8b8('0x60')]()[_0xf8b8('0x2b')](function(_0x54bbd2){if(_0x4b494a[_0xf8b8('0x55')]['tags']&&_[_0xf8b8('0x69')](_0x4b494a['body'][_0xf8b8('0x6a')])){if(_0x4b494a['body'][_0xf8b8('0x6a')][_0xf8b8('0x52')]){_0x4b494a[_0xf8b8('0x55')]['tags']=_0x4b494a[_0xf8b8('0x55')][_0xf8b8('0x6a')][_0xf8b8('0x6b')](';')+';';}else{_0x4b494a[_0xf8b8('0x55')][_0xf8b8('0x6a')]=null;}}else{_0x4b494a['body'][_0xf8b8('0x6a')]=null;}if(_0x4b494a[_0xf8b8('0x55')]&&_[_0xf8b8('0x69')](_0x4b494a[_0xf8b8('0x55')])){for(var _0x29cbb4=0x0;_0x29cbb4<_0x4b494a[_0xf8b8('0x55')]['length'];_0x29cbb4+=0x1){_0x4b494a[_0xf8b8('0x55')][_0x29cbb4]['ListId']=_0x4b494a['params']['id'];_0x54470f['push'](_0x4b494a['body'][_0x29cbb4]);}return BPromise['each'](_0x54470f,function(_0x314807){return db['CmContact'][_0xf8b8('0x54')](_[_0xf8b8('0x6c')](_0x314807,[_0xf8b8('0x6d'),'id'])||{},{'fields':_[_0xf8b8('0x39')](_0x54bbd2),'raw':!![]})[_0xf8b8('0x2b')](function(_0x569b80){_0xb19a22[_0xf8b8('0x6e')]['push'](_0x569b80[_0xf8b8('0x6f')]);})[_0xf8b8('0x4f')](function(_0x11acbd){_0xb19a22[_0xf8b8('0x70')][_0xf8b8('0x71')]({'data':_0x314807,'error':_0x11acbd[_0xf8b8('0x72')]});});})[_0xf8b8('0x2b')](function(_0x5828b6){return _0xb19a22;})[_0xf8b8('0x4f')](function(_0x2303ee){return _0x2303ee;});}else{_0xefbb2a['status'](0x190)['json']({'message':_0xf8b8('0x73')});}});}})['then'](respondWithResult(_0xefbb2a,null))['catch'](handleError(_0xefbb2a,null));};exports['getContacts']=function(_0x362da3,_0xca29de,_0x49625b){var _0x86b88d;return db[_0xf8b8('0x49')][_0xf8b8('0x53')]({'where':{'id':_0x362da3[_0xf8b8('0x5f')]['id']},'include':[{'model':db[_0xf8b8('0x74')],'as':_0xf8b8('0x75')}]})['then'](handleEntityNotFound(_0xca29de,null))[_0xf8b8('0x2b')](function(_0x2c98c2){if(_0x2c98c2){_0x86b88d=_0x2c98c2;return db[_0xf8b8('0x68')][_0xf8b8('0x34')];}})[_0xf8b8('0x2b')](function(_0x3d2f06){if(_0x3d2f06){var _0x28da85={};var _0x2d78a1={};_0x2d78a1[_0xf8b8('0x3b')]=_[_0xf8b8('0x76')](_[_0xf8b8('0x39')](_0x3d2f06),_['map'](_0x86b88d[_0xf8b8('0x75')],function(_0x1500fb){return util[_0xf8b8('0x77')](_0xf8b8('0x78'),_0x1500fb['id']);}));_0x2d78a1[_0xf8b8('0x3c')]=_[_0xf8b8('0x39')](_0x362da3[_0xf8b8('0x3c')]);_0x2d78a1[_0xf8b8('0x3a')]=_[_0xf8b8('0x51')](_0x2d78a1[_0xf8b8('0x3b')],_0x2d78a1[_0xf8b8('0x3c')]);_0x28da85[_0xf8b8('0x3e')]=_[_0xf8b8('0x51')](_0x2d78a1['model'],qs[_0xf8b8('0x3d')](_0x362da3[_0xf8b8('0x3c')]['fields']));_0x28da85[_0xf8b8('0x3e')]=_0x28da85[_0xf8b8('0x3e')][_0xf8b8('0x52')]?_0x28da85[_0xf8b8('0x3e')]:_0x2d78a1[_0xf8b8('0x3b')];if(!_0x362da3[_0xf8b8('0x3c')][_0xf8b8('0x3f')](_0xf8b8('0x40'))){_0x28da85[_0xf8b8('0x25')]=qs[_0xf8b8('0x25')](_0x362da3[_0xf8b8('0x3c')][_0xf8b8('0x25')]);_0x28da85['offset']=qs[_0xf8b8('0x24')](_0x362da3[_0xf8b8('0x3c')][_0xf8b8('0x24')]);}_0x28da85['order']=qs[_0xf8b8('0x42')](_0x362da3[_0xf8b8('0x3c')][_0xf8b8('0x42')]);_0x28da85[_0xf8b8('0x45')]=qs[_0xf8b8('0x3a')](_[_0xf8b8('0x43')](_0x362da3[_0xf8b8('0x3c')],_0x2d78a1[_0xf8b8('0x3a')]));_0x28da85['raw']=!![];if(_0x362da3[_0xf8b8('0x3c')][_0xf8b8('0x44')]){_0x28da85[_0xf8b8('0x45')]=_[_0xf8b8('0x46')](_0x28da85['where'],{'$or':_[_0xf8b8('0x33')](_0x28da85[_0xf8b8('0x3e')],function(_0x34d83f){var _0x2eda25={};_0x2eda25[_0x34d83f]={'$like':'%'+_0x362da3[_0xf8b8('0x3c')][_0xf8b8('0x44')]+'%'};return _0x2eda25;})});}_0x28da85=_[_0xf8b8('0x46')]({},_0x28da85,_0x362da3[_0xf8b8('0x48')]);return _0x86b88d['getContacts'](_0x28da85);}})['then'](respondWithResult(_0xca29de,null))['catch'](handleError(_0xca29de,null));};exports[_0xf8b8('0x79')]=function(_0x29e3a6,_0x47b25e,_0x47a5c0){var _0x285568;var _0xfb27a;var _0x33112f;var _0x3bf42e=_0x29e3a6['params']['id'];csv_results=[];return db[_0xf8b8('0x7a')][_0xf8b8('0x4d')]({'attributes':['id',_0xf8b8('0x38')],'raw':!![],'order':[_0xf8b8('0x7b')]})[_0xf8b8('0x2b')](function(_0x244de8){_0x285568=_0x244de8;var _0x555aff=_[_0xf8b8('0x39')](db[_0xf8b8('0x68')]['rawAttributes']);return db[_0xf8b8('0x74')][_0xf8b8('0x4d')]({'raw':!![],'attributes':['id',_0xf8b8('0x7c')]})[_0xf8b8('0x2b')](function(_0x360ec0){_0xfb27a=_0x360ec0;var _0x2eef29=squel[_0xf8b8('0x7d')]()['fields'](_0x555aff)[_0xf8b8('0x7e')](_0xf8b8('0x7f'),'c')[_0xf8b8('0x45')]('c.ListId\x20=\x20?',_0x3bf42e)['where']('c.deletedAt\x20is\x20null')[_0xf8b8('0x80')]();for(var _0x2a09f4=0x0;_0x2a09f4<_0xfb27a[_0xf8b8('0x52')];_0x2a09f4++){_0x2eef29[_0xf8b8('0x81')](_0xf8b8('0x82')+_0xfb27a[_0x2a09f4]['id'],_0xf8b8('0x83')+_0xfb27a[_0x2a09f4]['alias']);}for(var _0x2a09f4=0x0;_0x2a09f4<_0x285568[_0xf8b8('0x52')];_0x2a09f4++){_0x2eef29[_0xf8b8('0x81')](squel[_0xf8b8('0x7d')]()['field'](_0xf8b8('0x84'))[_0xf8b8('0x7e')](_0xf8b8('0x85'))['where'](_0xf8b8('0x86'),_0x285568[_0x2a09f4]['id'])['where']('CmContactId\x20=\x20c.id'),'additionalPhone_'+_0x285568[_0x2a09f4]['name']);_0x2eef29['field'](squel[_0xf8b8('0x7d')]()[_0xf8b8('0x81')](_0xf8b8('0x87'))[_0xf8b8('0x7e')]('cm_contact_has_items')[_0xf8b8('0x45')](_0xf8b8('0x86'),_0x285568[_0x2a09f4]['id'])[_0xf8b8('0x45')]('CmContactId\x20=\x20c.id'),_0xf8b8('0x88')+_0x285568[_0x2a09f4][_0xf8b8('0x38')]);}var _0x506dc5=[];_0x506dc5[_0xf8b8('0x71')](_0x2eef29[_0xf8b8('0x89')]());BPromise[_0xf8b8('0x8a')](_0x506dc5,handleQuery)[_0xf8b8('0x2b')](function(_0x5b6814){handleQuery(_0x2eef29['toString']());var _0x18c309=csv_results[0x0];if(!_[_0xf8b8('0x8b')](_0x18c309)){var _0x3dcb38=toCsv(_0x18c309);var _0x213295=Date['now']();fs['writeFileSync'](util[_0xf8b8('0x77')](_0xf8b8('0x8c'),_0x3bf42e,_0x213295),_0x3dcb38);_0x47b25e[_0xf8b8('0x8d')](_0xf8b8('0x8e'),_0xf8b8('0x8f')+util[_0xf8b8('0x77')](_0xf8b8('0x90'),_0x3bf42e,_0x213295));_0x47b25e[_0xf8b8('0x8d')]('Content-type',_0xf8b8('0x91'));return _0x47b25e[_0xf8b8('0x92')](util[_0xf8b8('0x77')](_0xf8b8('0x8c'),_0x3bf42e,_0x213295));}else{return _0x47b25e[_0xf8b8('0x2e')](0xcc);}});});});};exports[_0xf8b8('0x93')]=function(_0x2ac207,_0x35b165,_0x21fc20){var _0x47ee6b;delete _0x2ac207[_0xf8b8('0x55')]['id'];return db[_0xf8b8('0x49')][_0xf8b8('0x64')]({'where':{'id':_0x2ac207[_0xf8b8('0x5f')]['id']}})[_0xf8b8('0x2b')](handleEntityNotFound(_0x35b165,null))[_0xf8b8('0x2b')](function(_0x2c3a55){if(_0x2c3a55){return db[_0xf8b8('0x94')][_0xf8b8('0x95')](function(_0x4321f9){return db['CmCustomField'][_0xf8b8('0x54')](_0x2ac207[_0xf8b8('0x55')],{'transaction':_0x4321f9})['then'](function(_0xef4c3){_0x47ee6b=_0xef4c3;return _0x2c3a55['addCustomFields'](_0xef4c3,{'transaction':_0x4321f9});})[_0xf8b8('0x2b')](function(){var _0x5ba646={'type':db[_0xf8b8('0x96')]['TEXT'],'transaction':_0x4321f9};switch(_0x2ac207[_0xf8b8('0x55')]['type']){case _0xf8b8('0x97'):_0x5ba646[_0xf8b8('0x36')]=db[_0xf8b8('0x96')]['TEXT'];break;case'number':_0x5ba646[_0xf8b8('0x36')]=db[_0xf8b8('0x96')][_0xf8b8('0x98')];break;case _0xf8b8('0x99'):_0x5ba646[_0xf8b8('0x36')]=db[_0xf8b8('0x96')][_0xf8b8('0x9a')];_0x5ba646[_0xf8b8('0x9b')]=![];break;default:}return db['sequelize'][_0xf8b8('0x9c')][_0xf8b8('0x9d')]('cm_contacts',util[_0xf8b8('0x77')](_0xf8b8('0x9e'),_0x47ee6b['id']),_0x5ba646);})[_0xf8b8('0x2b')](function(){return _0x47ee6b;});});}})[_0xf8b8('0x2b')](respondWithResult(_0x35b165,null))[_0xf8b8('0x4f')](handleError(_0x35b165,null));};exports[_0xf8b8('0x9f')]=function(_0x4b7427,_0x36baa2,_0x4bb172){var _0x344d53={};var _0x21af37={};var _0x404389;var _0x1217b1;return db[_0xf8b8('0x49')]['findOne']({'where':{'id':_0x4b7427[_0xf8b8('0x5f')]['id']}})[_0xf8b8('0x2b')](handleEntityNotFound(_0x36baa2,null))['then'](function(_0x5dfc25){if(_0x5dfc25){_0x404389=_0x5dfc25;_0x21af37[_0xf8b8('0x3b')]=_[_0xf8b8('0x39')](db[_0xf8b8('0x74')][_0xf8b8('0x34')]);_0x21af37[_0xf8b8('0x3c')]=_['keys'](_0x4b7427['query']);_0x21af37[_0xf8b8('0x3a')]=_[_0xf8b8('0x51')](_0x21af37['model'],_0x21af37['query']);_0x344d53['attributes']=_[_0xf8b8('0x51')](_0x21af37[_0xf8b8('0x3b')],qs[_0xf8b8('0x3d')](_0x4b7427[_0xf8b8('0x3c')][_0xf8b8('0x3d')]));_0x344d53[_0xf8b8('0x3e')]=_0x344d53[_0xf8b8('0x3e')][_0xf8b8('0x52')]?_0x344d53[_0xf8b8('0x3e')]:_0x21af37['model'];_0x344d53['order']=qs[_0xf8b8('0x42')](_0x4b7427[_0xf8b8('0x3c')][_0xf8b8('0x42')]);_0x344d53[_0xf8b8('0x45')]=qs[_0xf8b8('0x3a')](_[_0xf8b8('0x43')](_0x4b7427[_0xf8b8('0x3c')],_0x21af37[_0xf8b8('0x3a')]));_0x344d53[_0xf8b8('0x45')]=_[_0xf8b8('0x46')](_0x344d53['where'],{'$or':[{'ListId':_0x5dfc25['id']},{'ListId':null}]});if(_0x4b7427[_0xf8b8('0x3c')][_0xf8b8('0x44')]){_0x344d53[_0xf8b8('0x45')]=_['merge'](_0x344d53['where'],{'$or':_[_0xf8b8('0x33')](_0x344d53[_0xf8b8('0x3e')],function(_0x44e515){var _0x3796c9={};_0x3796c9[_0x44e515]={'$like':'%'+_0x4b7427[_0xf8b8('0x3c')][_0xf8b8('0x44')]+'%'};return _0x3796c9;})});}_0x344d53=_['merge']({},_0x344d53,_0x4b7427[_0xf8b8('0x48')]);return db[_0xf8b8('0x74')]['findAndCountAll'](_0x344d53);}})[_0xf8b8('0x2b')](respondWithResult(_0x36baa2,null))[_0xf8b8('0x4f')](handleError(_0x36baa2,null));};exports['getGlobalCustomFields']=function(_0x4771b0,_0x2e3413){return db[_0xf8b8('0x74')]['findAndCountAll']({'where':{'ListId':null}})['then'](handleEntityNotFound(_0x2e3413,null))[_0xf8b8('0x2b')](function(_0x5910b5){return _0x5910b5;})[_0xf8b8('0x2b')](respondWithResult(_0x2e3413,null))[_0xf8b8('0x4f')](handleError(_0x2e3413,null));};exports['addAgents']=function(_0x2188d7,_0x2b84c7,_0x27802e){return db[_0xf8b8('0x49')][_0xf8b8('0x53')]({'where':{'id':_0x2188d7[_0xf8b8('0x5f')]['id']}})[_0xf8b8('0x2b')](handleEntityNotFound(_0x2b84c7,null))[_0xf8b8('0x2b')](function(_0x347bf8){if(_0x347bf8){return _0x347bf8[_0xf8b8('0xa0')](_0x2188d7['body']['ids'],_[_0xf8b8('0x6c')](_0x2188d7[_0xf8b8('0x55')],[_0xf8b8('0x6d'),'id'])||{})[_0xf8b8('0xa1')](function(_0x389fa6){for(var _0x27b12e=0x0;_0x27b12e<_0x2188d7[_0xf8b8('0x55')][_0xf8b8('0x6d')]['length'];_0x27b12e+=0x1){socket['emit'](_0xf8b8('0xa2'),{'UserId':Number(_0x2188d7[_0xf8b8('0x55')][_0xf8b8('0x6d')][_0x27b12e]),'CmListId':Number(_0x2188d7[_0xf8b8('0x5f')]['id'])});}return _0x389fa6;});}})[_0xf8b8('0x2b')](respondWithResult(_0x2b84c7,null))[_0xf8b8('0x4f')](handleError(_0x2b84c7,null));};exports[_0xf8b8('0xa3')]=function(_0x516b10,_0x12726e,_0xb482d0){return db[_0xf8b8('0x49')][_0xf8b8('0x53')]({'where':{'id':_0x516b10[_0xf8b8('0x5f')]['id']}})[_0xf8b8('0x2b')](handleEntityNotFound(_0x12726e,null))[_0xf8b8('0x2b')](function(_0x119092){if(_0x119092){return _0x119092[_0xf8b8('0xa3')](_0x516b10[_0xf8b8('0x3c')][_0xf8b8('0x6d')])[_0xf8b8('0x2b')](function(){if(_[_0xf8b8('0x69')](_0x516b10[_0xf8b8('0x3c')][_0xf8b8('0x6d')])){for(var _0x490146=0x0;_0x490146<_0x516b10[_0xf8b8('0x3c')][_0xf8b8('0x6d')]['length'];_0x490146+=0x1){socket[_0xf8b8('0xa4')](_0xf8b8('0xa5'),{'UserId':Number(_0x516b10[_0xf8b8('0x3c')]['ids'][_0x490146]),'CmListId':Number(_0x516b10[_0xf8b8('0x5f')]['id'])});}}else{socket[_0xf8b8('0xa4')](_0xf8b8('0xa5'),{'UserId':Number(_0x516b10['query'][_0xf8b8('0x6d')]),'CmListId':Number(_0x516b10[_0xf8b8('0x5f')]['id'])});}});}})[_0xf8b8('0x2b')](respondWithStatusCode(_0x12726e,null))[_0xf8b8('0x4f')](handleError(_0x12726e,null));};exports[_0xf8b8('0xa6')]=function(_0x1b5f97,_0x404902,_0x7a1786){var _0x1653b4={};var _0x814e2b={};var _0x57bd15;var _0x1f9add;return db['CmList']['findOne']({'where':{'id':_0x1b5f97['params']['id']}})[_0xf8b8('0x2b')](handleEntityNotFound(_0x404902,null))[_0xf8b8('0x2b')](function(_0x67da3a){if(_0x67da3a){_0x57bd15=_0x67da3a;_0x814e2b[_0xf8b8('0x3b')]=_[_0xf8b8('0x39')](db[_0xf8b8('0xa7')][_0xf8b8('0x34')]);_0x814e2b[_0xf8b8('0x3c')]=_[_0xf8b8('0x39')](_0x1b5f97[_0xf8b8('0x3c')]);_0x814e2b[_0xf8b8('0x3a')]=_[_0xf8b8('0x51')](_0x814e2b['model'],_0x814e2b[_0xf8b8('0x3c')]);_0x1653b4['attributes']=_[_0xf8b8('0x51')](_0x814e2b[_0xf8b8('0x3b')],qs['fields'](_0x1b5f97['query']['fields']));_0x1653b4[_0xf8b8('0x3e')]=_0x1653b4[_0xf8b8('0x3e')][_0xf8b8('0x52')]?_0x1653b4[_0xf8b8('0x3e')]:_0x814e2b['model'];_0x1653b4[_0xf8b8('0x41')]=qs[_0xf8b8('0x42')](_0x1b5f97['query'][_0xf8b8('0x42')]);_0x1653b4[_0xf8b8('0x45')]=qs[_0xf8b8('0x3a')](_[_0xf8b8('0x43')](_0x1b5f97[_0xf8b8('0x3c')],_0x814e2b[_0xf8b8('0x3a')]));if(_0x1b5f97[_0xf8b8('0x3c')][_0xf8b8('0x44')]){_0x1653b4[_0xf8b8('0x45')]=_[_0xf8b8('0x46')](_0x1653b4[_0xf8b8('0x45')],{'$or':_[_0xf8b8('0x33')](_0x1653b4[_0xf8b8('0x3e')],function(_0x307a8c){var _0x49ab2b={};_0x49ab2b[_0x307a8c]={'$like':'%'+_0x1b5f97[_0xf8b8('0x3c')]['filter']+'%'};return _0x49ab2b;})});}_0x1653b4=_[_0xf8b8('0x46')]({},_0x1653b4,_0x1b5f97[_0xf8b8('0x48')]);return _0x57bd15['getAgents'](_0x1653b4);}})['then'](function(_0x1f0d59){if(_0x1f0d59){_0x1f9add=_0x1f0d59[_0xf8b8('0x52')];if(!_0x1b5f97[_0xf8b8('0x3c')][_0xf8b8('0x3f')](_0xf8b8('0x40'))){_0x1653b4['limit']=qs[_0xf8b8('0x25')](_0x1b5f97[_0xf8b8('0x3c')][_0xf8b8('0x25')]);_0x1653b4[_0xf8b8('0x24')]=qs['offset'](_0x1b5f97['query'][_0xf8b8('0x24')]);}return _0x57bd15[_0xf8b8('0xa6')](_0x1653b4);}})['then'](function(_0x4037cc){if(_0x4037cc){return _0x4037cc?{'count':_0x1f9add,'rows':_0x4037cc}:null;}})[_0xf8b8('0x2b')](respondWithResult(_0x404902,null))[_0xf8b8('0x4f')](handleError(_0x404902,null));};function handleQuery(_0x66d129){logger['info'](_0x66d129);return db[_0xf8b8('0x94')]['query'](_0x66d129)[_0xf8b8('0xa1')](function(_0x150648){csv_results[_0xf8b8('0x71')](_0x150648);})[_0xf8b8('0x4f')](function(_0x41246a){logger[_0xf8b8('0x2f')](_0x41246a['message']);});} \ No newline at end of file diff --git a/server/api/cmList/cmList.events.js b/server/api/cmList/cmList.events.js index f256dc4..ed1d727 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 _0x3e74=['hasOwnProperty','exports','events','CmList','setMaxListeners','save','emit'];(function(_0x2641f9,_0x26715f){var _0x585741=function(_0x2d1462){while(--_0x2d1462){_0x2641f9['push'](_0x2641f9['shift']());}};_0x585741(++_0x26715f);}(_0x3e74,0x175));var _0x43e7=function(_0x2292a4,_0xca738c){_0x2292a4=_0x2292a4-0x0;var _0x1025ba=_0x3e74[_0x2292a4];return _0x1025ba;};'use strict';var EventEmitter=require(_0x43e7('0x0'));var CmList=require('../../mysqldb')['db'][_0x43e7('0x1')];var CmListEvents=new EventEmitter();CmListEvents[_0x43e7('0x2')](0x0);var events={'afterCreate':_0x43e7('0x3'),'afterUpdate':'update','afterDestroy':'remove'};function emitEvent(_0xc58479){return function(_0x4f9bbe,_0x128b0f,_0xe838b4){CmListEvents[_0x43e7('0x4')](_0xc58479+':'+_0x4f9bbe['id'],_0x4f9bbe);CmListEvents[_0x43e7('0x4')](_0xc58479,_0x4f9bbe);_0xe838b4(null);};}for(var e in events){if(events[_0x43e7('0x5')](e)){var event=events[e];CmList['hook'](e,emitEvent(event));}}module[_0x43e7('0x6')]=CmListEvents; \ No newline at end of file +var _0x814b=['update','emit','hook','exports','events','../../mysqldb','CmList','setMaxListeners','save'];(function(_0x381748,_0x5396f6){var _0x187b6c=function(_0x159aaf){while(--_0x159aaf){_0x381748['push'](_0x381748['shift']());}};_0x187b6c(++_0x5396f6);}(_0x814b,0x1a2));var _0xb814=function(_0x296809,_0x1c9665){_0x296809=_0x296809-0x0;var _0x18c0d3=_0x814b[_0x296809];return _0x18c0d3;};'use strict';var EventEmitter=require(_0xb814('0x0'));var CmList=require(_0xb814('0x1'))['db'][_0xb814('0x2')];var CmListEvents=new EventEmitter();CmListEvents[_0xb814('0x3')](0x0);var events={'afterCreate':_0xb814('0x4'),'afterUpdate':_0xb814('0x5'),'afterDestroy':'remove'};function emitEvent(_0x38c21a){return function(_0x3e1e9,_0x258866,_0x4237bc){CmListEvents[_0xb814('0x6')](_0x38c21a+':'+_0x3e1e9['id'],_0x3e1e9);CmListEvents[_0xb814('0x6')](_0x38c21a,_0x3e1e9);_0x4237bc(null);};}for(var e in events){if(events['hasOwnProperty'](e)){var event=events[e];CmList[_0xb814('0x7')](e,emitEvent(event));}}module[_0xb814('0x8')]=CmListEvents; \ No newline at end of file diff --git a/server/api/cmList/cmList.model.js b/server/api/cmList/cmList.model.js index 497bea6..44beefc 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 _0x70e0=['cm_lists','lodash','util','../../config/logger','bluebird','request-promise','path','rimraf','./cmList.attributes'];(function(_0xace953,_0x338468){var _0x5b5c4b=function(_0x2bebce){while(--_0x2bebce){_0xace953['push'](_0xace953['shift']());}};_0x5b5c4b(++_0x338468);}(_0x70e0,0x17b));var _0x070e=function(_0xb40cd3,_0x33b6b5){_0xb40cd3=_0xb40cd3-0x0;var _0x5b733d=_0x70e0[_0xb40cd3];return _0x5b733d;};'use strict';var _=require(_0x070e('0x0'));var util=require(_0x070e('0x1'));var logger=require(_0x070e('0x2'))('api');var moment=require('moment');var BPromise=require(_0x070e('0x3'));var rp=require(_0x070e('0x4'));var fs=require('fs');var path=require(_0x070e('0x5'));var rimraf=require(_0x070e('0x6'));var config=require('../../config/environment');var attributes=require(_0x070e('0x7'));module['exports']=function(_0x46fe68,_0x4b041d){return _0x46fe68['define']('CmList',attributes,{'tableName':_0x070e('0x8'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x54ef=['../../config/logger','moment','bluebird','request-promise','path','rimraf','../../config/environment','./cmList.attributes','define','CmList','lodash','util'];(function(_0x4b5f1d,_0x4cc9bb){var _0xa4652d=function(_0x491ec1){while(--_0x491ec1){_0x4b5f1d['push'](_0x4b5f1d['shift']());}};_0xa4652d(++_0x4cc9bb);}(_0x54ef,0x112));var _0xf54e=function(_0x34cc31,_0x1726b9){_0x34cc31=_0x34cc31-0x0;var _0x332b0e=_0x54ef[_0x34cc31];return _0x332b0e;};'use strict';var _=require(_0xf54e('0x0'));var util=require(_0xf54e('0x1'));var logger=require(_0xf54e('0x2'))('api');var moment=require(_0xf54e('0x3'));var BPromise=require(_0xf54e('0x4'));var rp=require(_0xf54e('0x5'));var fs=require('fs');var path=require(_0xf54e('0x6'));var rimraf=require(_0xf54e('0x7'));var config=require(_0xf54e('0x8'));var attributes=require(_0xf54e('0x9'));module['exports']=function(_0x55e611,_0x18e84e){return _0x55e611[_0xf54e('0xa')](_0xf54e('0xb'),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 e187087..fd3abad 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 _0xe15f=['../../config/utils','../../config/logger','rpc','jayson/promise','client','http','redis','defaults','localhost','socket.io-emitter','./cmList.socket','then','info','CmList,\x20%s,\x20%s','request\x20sent','debug','CmList,\x20%s,\x20%s,\x20%s','stringify','error','message','result','catch','lodash','moment','randomstring','ioredis','../../mysqldb'];(function(_0x14add3,_0x13ce8d){var _0x4a174f=function(_0x2b3ed7){while(--_0x2b3ed7){_0x14add3['push'](_0x14add3['shift']());}};_0x4a174f(++_0x13ce8d);}(_0xe15f,0x1ab));var _0xfe15=function(_0x124799,_0x1b46f0){_0x124799=_0x124799-0x0;var _0x19815d=_0xe15f[_0x124799];return _0x19815d;};'use strict';var _=require(_0xfe15('0x0'));var util=require('util');var moment=require(_0xfe15('0x1'));var BPromise=require('bluebird');var rs=require(_0xfe15('0x2'));var fs=require('fs');var Redis=require(_0xfe15('0x3'));var db=require(_0xfe15('0x4'))['db'];var utils=require(_0xfe15('0x5'));var logger=require(_0xfe15('0x6'))(_0xfe15('0x7'));var config=require('../../config/environment');var jayson=require(_0xfe15('0x8'));var client=jayson[_0xfe15('0x9')][_0xfe15('0xa')]({'port':0x232a});config[_0xfe15('0xb')]=_[_0xfe15('0xc')](config[_0xfe15('0xb')],{'host':_0xfe15('0xd'),'port':0x18eb});var socket=require(_0xfe15('0xe'))(new Redis(config[_0xfe15('0xb')]));require(_0xfe15('0xf'))['register'](socket);function respondWithRpcPromise(_0xc2b671,_0x58f46c,_0x1a3d66){return new BPromise(function(_0x38f8e2,_0x214756){return client['request'](_0xc2b671,_0x1a3d66)[_0xfe15('0x10')](function(_0x4ab0d9){logger[_0xfe15('0x11')](_0xfe15('0x12'),_0x58f46c,_0xfe15('0x13'));logger[_0xfe15('0x14')](_0xfe15('0x15'),_0x58f46c,_0xfe15('0x13'),JSON[_0xfe15('0x16')](_0x4ab0d9));if(_0x4ab0d9[_0xfe15('0x17')]){if(_0x4ab0d9['error']['code']===0x1f4){logger[_0xfe15('0x17')](_0xfe15('0x12'),_0x58f46c,_0x4ab0d9[_0xfe15('0x17')][_0xfe15('0x18')]);return _0x214756(_0x4ab0d9[_0xfe15('0x17')][_0xfe15('0x18')]);}logger[_0xfe15('0x17')](_0xfe15('0x12'),_0x58f46c,_0x4ab0d9[_0xfe15('0x17')][_0xfe15('0x18')]);return _0x38f8e2(_0x4ab0d9['error'][_0xfe15('0x18')]);}else{logger['info']('CmList,\x20%s,\x20%s',_0x58f46c,'request\x20sent');_0x38f8e2(_0x4ab0d9[_0xfe15('0x19')]['message']);}})[_0xfe15('0x1a')](function(_0x4fa7b4){logger[_0xfe15('0x17')](_0xfe15('0x12'),_0x58f46c,_0x4fa7b4);_0x214756(_0x4fa7b4);});});} \ No newline at end of file +var _0x38f4=['socket.io-emitter','./cmList.socket','register','request','then','info','request\x20sent','debug','CmList,\x20%s,\x20%s,\x20%s','stringify','error','code','CmList,\x20%s,\x20%s','message','catch','lodash','util','moment','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','client','http','redis','defaults','localhost'];(function(_0x3dd15e,_0x1f0015){var _0x231fd0=function(_0x4f680a){while(--_0x4f680a){_0x3dd15e['push'](_0x3dd15e['shift']());}};_0x231fd0(++_0x1f0015);}(_0x38f4,0x1b3));var _0x438f=function(_0x1ec341,_0x2b6426){_0x1ec341=_0x1ec341-0x0;var _0x1eeb8e=_0x38f4[_0x1ec341];return _0x1eeb8e;};'use strict';var _=require(_0x438f('0x0'));var util=require(_0x438f('0x1'));var moment=require(_0x438f('0x2'));var BPromise=require('bluebird');var rs=require(_0x438f('0x3'));var fs=require('fs');var Redis=require(_0x438f('0x4'));var db=require(_0x438f('0x5'))['db'];var utils=require(_0x438f('0x6'));var logger=require(_0x438f('0x7'))(_0x438f('0x8'));var config=require(_0x438f('0x9'));var jayson=require('jayson/promise');var client=jayson[_0x438f('0xa')][_0x438f('0xb')]({'port':0x232a});config[_0x438f('0xc')]=_[_0x438f('0xd')](config[_0x438f('0xc')],{'host':_0x438f('0xe'),'port':0x18eb});var socket=require(_0x438f('0xf'))(new Redis(config[_0x438f('0xc')]));require(_0x438f('0x10'))[_0x438f('0x11')](socket);function respondWithRpcPromise(_0x449ac4,_0x25e9e5,_0x2be2b5){return new BPromise(function(_0x3bcda7,_0x848d57){return client[_0x438f('0x12')](_0x449ac4,_0x2be2b5)[_0x438f('0x13')](function(_0x19bb4c){logger[_0x438f('0x14')]('CmList,\x20%s,\x20%s',_0x25e9e5,_0x438f('0x15'));logger[_0x438f('0x16')](_0x438f('0x17'),_0x25e9e5,_0x438f('0x15'),JSON[_0x438f('0x18')](_0x19bb4c));if(_0x19bb4c['error']){if(_0x19bb4c[_0x438f('0x19')][_0x438f('0x1a')]===0x1f4){logger[_0x438f('0x19')](_0x438f('0x1b'),_0x25e9e5,_0x19bb4c['error'][_0x438f('0x1c')]);return _0x848d57(_0x19bb4c[_0x438f('0x19')]['message']);}logger[_0x438f('0x19')]('CmList,\x20%s,\x20%s',_0x25e9e5,_0x19bb4c[_0x438f('0x19')][_0x438f('0x1c')]);return _0x3bcda7(_0x19bb4c['error']['message']);}else{logger[_0x438f('0x14')](_0x438f('0x1b'),_0x25e9e5,'request\x20sent');_0x3bcda7(_0x19bb4c['result'][_0x438f('0x1c')]);}})[_0x438f('0x1d')](function(_0x44dc73){logger[_0x438f('0x19')](_0x438f('0x1b'),_0x25e9e5,_0x44dc73);_0x848d57(_0x44dc73);});});} \ No newline at end of file diff --git a/server/api/cmList/cmList.socket.js b/server/api/cmList/cmList.socket.js index 0379db1..30f0696 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 _0x7551=['save','remove','update','emit','removeListener','register','length','cmList:'];(function(_0x5dd1eb,_0x1834bd){var _0x577e64=function(_0x7005af){while(--_0x7005af){_0x5dd1eb['push'](_0x5dd1eb['shift']());}};_0x577e64(++_0x1834bd);}(_0x7551,0xd0));var _0x1755=function(_0x4607df,_0x2417ee){_0x4607df=_0x4607df-0x0;var _0x498af0=_0x7551[_0x4607df];return _0x498af0;};'use strict';var CmListEvents=require('./cmList.events');var events=[_0x1755('0x0'),_0x1755('0x1'),_0x1755('0x2')];function createListener(_0x271541,_0x4ecf56){return function(_0x47941a){_0x4ecf56[_0x1755('0x3')](_0x271541,_0x47941a);};}function removeListener(_0x270d33,_0xf924cc){return function(){CmListEvents[_0x1755('0x4')](_0x270d33,_0xf924cc);};}exports[_0x1755('0x5')]=function(_0x5498cf){for(var _0x3e3114=0x0,_0x57ae09=events[_0x1755('0x6')];_0x3e3114<_0x57ae09;_0x3e3114++){var _0x4b5e08=events[_0x3e3114];var _0x520c7d=createListener(_0x1755('0x7')+_0x4b5e08,_0x5498cf);CmListEvents['on'](_0x4b5e08,_0x520c7d);}}; \ No newline at end of file +var _0x65cc=['remove','emit','removeListener','register','length','save'];(function(_0x3dd15e,_0x1f0015){var _0x231fd0=function(_0x4f680a){while(--_0x4f680a){_0x3dd15e['push'](_0x3dd15e['shift']());}};_0x231fd0(++_0x1f0015);}(_0x65cc,0xfb));var _0xc65c=function(_0x442cac,_0x5748b3){_0x442cac=_0x442cac-0x0;var _0xd96f05=_0x65cc[_0x442cac];return _0xd96f05;};'use strict';var CmListEvents=require('./cmList.events');var events=[_0xc65c('0x0'),_0xc65c('0x1'),'update'];function createListener(_0x1a9c02,_0x162f7a){return function(_0x43ecef){_0x162f7a[_0xc65c('0x2')](_0x1a9c02,_0x43ecef);};}function removeListener(_0x333fdd,_0x48e0f8){return function(){CmListEvents[_0xc65c('0x3')](_0x333fdd,_0x48e0f8);};}exports[_0xc65c('0x4')]=function(_0x5e5986){for(var _0xf72a63=0x0,_0xad575e=events[_0xc65c('0x5')];_0xf72a63<_0xad575e;_0xf72a63++){var _0x144f53=events[_0xf72a63];var _0x4409e5=createListener('cmList:'+_0x144f53,_0x5e5986);CmListEvents['on'](_0x144f53,_0x4409e5);}}; \ No newline at end of file diff --git a/server/api/cmList/index.js b/server/api/cmList/index.js index cdf7fda..e7be2a9 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 _0xf57b=['../../components/auth/service','../../components/interaction/service','../../config/environment','./cmList.controller','isAuthenticated','index','get','/describe','/global_fields','getGlobalCustomFields','/:id','show','getDispositions','/:id/contacts','getContacts','/:id/fields','getCustomFields','/:id/users','getAgents','post','create','addDisposition','addCustomField','addAgents','put','update','delete','destroy','/:id/dispositions','removeAgents','exports','multer','util','path','fs-extra'];(function(_0x7b484,_0x195ad4){var _0x2ae1cf=function(_0x2e6247){while(--_0x2e6247){_0x7b484['push'](_0x7b484['shift']());}};_0x2ae1cf(++_0x195ad4);}(_0xf57b,0x1c3));var _0xbf57=function(_0xdb4b5e,_0x4c090e){_0xdb4b5e=_0xdb4b5e-0x0;var _0x1bcdaa=_0xf57b[_0xdb4b5e];return _0x1bcdaa;};'use strict';var multer=require(_0xbf57('0x0'));var util=require(_0xbf57('0x1'));var path=require(_0xbf57('0x2'));var timeout=require('connect-timeout');var express=require('express');var router=express['Router']();var fs_extra=require(_0xbf57('0x3'));var auth=require(_0xbf57('0x4'));var interaction=require(_0xbf57('0x5'));var config=require(_0xbf57('0x6'));var controller=require(_0xbf57('0x7'));router['get']('/',auth[_0xbf57('0x8')](),controller[_0xbf57('0x9')]);router[_0xbf57('0xa')](_0xbf57('0xb'),auth['isAuthenticated'](),controller['describe']);router['get'](_0xbf57('0xc'),auth[_0xbf57('0x8')](),controller[_0xbf57('0xd')]);router[_0xbf57('0xa')](_0xbf57('0xe'),auth[_0xbf57('0x8')](),controller[_0xbf57('0xf')]);router[_0xbf57('0xa')]('/:id/dispositions',auth[_0xbf57('0x8')](),controller[_0xbf57('0x10')]);router[_0xbf57('0xa')](_0xbf57('0x11'),auth[_0xbf57('0x8')](),controller[_0xbf57('0x12')]);router[_0xbf57('0xa')]('/:id/contacts/csv',auth[_0xbf57('0x8')](),controller['getContactsCsv']);router['get'](_0xbf57('0x13'),auth[_0xbf57('0x8')](),controller[_0xbf57('0x14')]);router[_0xbf57('0xa')](_0xbf57('0x15'),auth['isAuthenticated'](),controller[_0xbf57('0x16')]);router[_0xbf57('0x17')]('/',auth[_0xbf57('0x8')](),controller[_0xbf57('0x18')]);router[_0xbf57('0x17')]('/:id/dispositions',auth[_0xbf57('0x8')](),controller[_0xbf57('0x19')]);router[_0xbf57('0x17')](_0xbf57('0x11'),auth[_0xbf57('0x8')](),controller['addContacts']);router[_0xbf57('0x17')](_0xbf57('0x13'),auth['isAuthenticated'](),controller[_0xbf57('0x1a')]);router['post'](_0xbf57('0x15'),auth[_0xbf57('0x8')](),controller[_0xbf57('0x1b')]);router[_0xbf57('0x1c')]('/:id',auth['isAuthenticated'](),controller[_0xbf57('0x1d')]);router[_0xbf57('0x1e')]('/:id',auth['isAuthenticated'](),controller[_0xbf57('0x1f')]);router[_0xbf57('0x1e')](_0xbf57('0x20'),auth[_0xbf57('0x8')](),controller['removeDispositions']);router[_0xbf57('0x1e')](_0xbf57('0x15'),auth[_0xbf57('0x8')](),controller[_0xbf57('0x21')]);module[_0xbf57('0x22')]=router; \ No newline at end of file +var _0xb9fd=['post','create','addDisposition','/:id','delete','/:id/dispositions','removeDispositions','removeAgents','exports','multer','util','connect-timeout','express','Router','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','./cmList.controller','get','isAuthenticated','index','/describe','describe','show','getDispositions','/:id/contacts','getContacts','getContactsCsv','getCustomFields','/:id/users','getAgents'];(function(_0x351aad,_0x146763){var _0x3f4ef4=function(_0x51c4a2){while(--_0x51c4a2){_0x351aad['push'](_0x351aad['shift']());}};_0x3f4ef4(++_0x146763);}(_0xb9fd,0x149));var _0xdb9f=function(_0x561771,_0x554760){_0x561771=_0x561771-0x0;var _0x54d16e=_0xb9fd[_0x561771];return _0x54d16e;};'use strict';var multer=require(_0xdb9f('0x0'));var util=require(_0xdb9f('0x1'));var path=require('path');var timeout=require(_0xdb9f('0x2'));var express=require(_0xdb9f('0x3'));var router=express[_0xdb9f('0x4')]();var fs_extra=require(_0xdb9f('0x5'));var auth=require(_0xdb9f('0x6'));var interaction=require(_0xdb9f('0x7'));var config=require(_0xdb9f('0x8'));var controller=require(_0xdb9f('0x9'));router[_0xdb9f('0xa')]('/',auth[_0xdb9f('0xb')](),controller[_0xdb9f('0xc')]);router[_0xdb9f('0xa')](_0xdb9f('0xd'),auth['isAuthenticated'](),controller[_0xdb9f('0xe')]);router['get']('/global_fields',auth[_0xdb9f('0xb')](),controller['getGlobalCustomFields']);router['get']('/:id',auth[_0xdb9f('0xb')](),controller[_0xdb9f('0xf')]);router[_0xdb9f('0xa')]('/:id/dispositions',auth['isAuthenticated'](),controller[_0xdb9f('0x10')]);router[_0xdb9f('0xa')](_0xdb9f('0x11'),auth[_0xdb9f('0xb')](),controller[_0xdb9f('0x12')]);router[_0xdb9f('0xa')]('/:id/contacts/csv',auth[_0xdb9f('0xb')](),controller[_0xdb9f('0x13')]);router[_0xdb9f('0xa')]('/:id/fields',auth[_0xdb9f('0xb')](),controller[_0xdb9f('0x14')]);router[_0xdb9f('0xa')](_0xdb9f('0x15'),auth[_0xdb9f('0xb')](),controller[_0xdb9f('0x16')]);router[_0xdb9f('0x17')]('/',auth[_0xdb9f('0xb')](),controller[_0xdb9f('0x18')]);router[_0xdb9f('0x17')]('/:id/dispositions',auth[_0xdb9f('0xb')](),controller[_0xdb9f('0x19')]);router['post'](_0xdb9f('0x11'),auth[_0xdb9f('0xb')](),controller['addContacts']);router[_0xdb9f('0x17')]('/:id/fields',auth[_0xdb9f('0xb')](),controller['addCustomField']);router[_0xdb9f('0x17')](_0xdb9f('0x15'),auth[_0xdb9f('0xb')](),controller['addAgents']);router['put'](_0xdb9f('0x1a'),auth[_0xdb9f('0xb')](),controller['update']);router[_0xdb9f('0x1b')](_0xdb9f('0x1a'),auth[_0xdb9f('0xb')](),controller['destroy']);router[_0xdb9f('0x1b')](_0xdb9f('0x1c'),auth['isAuthenticated'](),controller[_0xdb9f('0x1d')]);router[_0xdb9f('0x1b')](_0xdb9f('0x15'),auth['isAuthenticated'](),controller[_0xdb9f('0x1e')]);module[_0xdb9f('0x1f')]=router; \ No newline at end of file diff --git a/server/api/condition/condition.attributes.js b/server/api/condition/condition.attributes.js index 095a3e9..b84d634 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 _0xf992=['field','STRING','sequelize','VIRTUAL'];(function(_0x47537f,_0x224ad8){var _0xd58cd4=function(_0x1d533f){while(--_0x1d533f){_0x47537f['push'](_0x47537f['shift']());}};_0xd58cd4(++_0x224ad8);}(_0xf992,0xea));var _0x2f99=function(_0x49f92b,_0x4d58c9){_0x49f92b=_0x49f92b-0x0;var _0x33a166=_0xf992[_0x49f92b];return _0x33a166;};'use strict';var Sequelize=require(_0x2f99('0x0'));module['exports']={'name':{'type':Sequelize[_0x2f99('0x1')],'get':function(_0x187f21){return this['getDataValue'](_0x2f99('0x2'));}},'field':{'type':Sequelize[_0x2f99('0x3')],'allowNull':![]},'operator':{'type':Sequelize['STRING'],'allowNull':![]},'value':{'type':Sequelize[_0x2f99('0x3')],'allowNull':![]}}; \ No newline at end of file +var _0x5f41=['sequelize','exports','getDataValue','field','STRING'];(function(_0x4dc38b,_0x2c2ad9){var _0x56f5af=function(_0x4e49c7){while(--_0x4e49c7){_0x4dc38b['push'](_0x4dc38b['shift']());}};_0x56f5af(++_0x2c2ad9);}(_0x5f41,0x1a9));var _0x15f4=function(_0x377f97,_0x4dc029){_0x377f97=_0x377f97-0x0;var _0x402d31=_0x5f41[_0x377f97];return _0x402d31;};'use strict';var Sequelize=require(_0x15f4('0x0'));module[_0x15f4('0x1')]={'name':{'type':Sequelize['VIRTUAL'],'get':function(_0x6d2d97){return this[_0x15f4('0x2')](_0x15f4('0x3'));}},'field':{'type':Sequelize[_0x15f4('0x4')],'allowNull':![]},'operator':{'type':Sequelize[_0x15f4('0x4')],'allowNull':![]},'value':{'type':Sequelize[_0x15f4('0x4')],'allowNull':![]}}; \ No newline at end of file diff --git a/server/api/condition/condition.controller.js b/server/api/condition/condition.controller.js index 215ec8b..bf4dff5 100644 --- a/server/api/condition/condition.controller.js +++ b/server/api/condition/condition.controller.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x7a54=['sox','to-csv','fs-extra','squel','crypto','desk.js','ioredis','../../components/auth/service','../../components/parsers/advancedSearch','api','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','sendStatus','status','end','json','offset','undefined','count','limit','set','Content-Range','reject','save','update','then','destroy','error','stack','name','send','body','Condition','find','catch','eml-format','rimraf','zip-dir','request-promise','moment','mustache','util','path'];(function(_0x5f1ca9,_0xee3be2){var _0x434002=function(_0x3fc994){while(--_0x3fc994){_0x5f1ca9['push'](_0x5f1ca9['shift']());}};_0x434002(++_0xee3be2);}(_0x7a54,0x106));var _0x47a5=function(_0x2ccd24,_0x3c95d){_0x2ccd24=_0x2ccd24-0x0;var _0x2a9ac8=_0x7a54[_0x2ccd24];return _0x2a9ac8;};'use strict';var emlformat=require(_0x47a5('0x0'));var rimraf=require(_0x47a5('0x1'));var zipdir=require(_0x47a5('0x2'));var jsonpatch=require('fast-json-patch');var rp=require(_0x47a5('0x3'));var moment=require(_0x47a5('0x4'));var BPromise=require('bluebird');var Mustache=require(_0x47a5('0x5'));var util=require(_0x47a5('0x6'));var path=require(_0x47a5('0x7'));var sox=require(_0x47a5('0x8'));var csv=require(_0x47a5('0x9'));var ejs=require('ejs');var fs=require('fs');var fs_extra=require(_0x47a5('0xa'));var _=require('lodash');var squel=require(_0x47a5('0xb'));var crypto=require(_0x47a5('0xc'));var jsforce=require('jsforce');var deskjs=require(_0x47a5('0xd'));var toCsv=require('to-csv');var querystring=require('querystring');var Papa=require('papaparse');var Redis=require(_0x47a5('0xe'));var authService=require(_0x47a5('0xf'));var qs=require('../../components/parsers/qs');var as=require(_0x47a5('0x10'));var hardwareService=require('../../config/license/hardware');var logger=require('../../config/logger')(_0x47a5('0x11'));var utils=require(_0x47a5('0x12'));var config=require(_0x47a5('0x13'));var licenseUtil=require(_0x47a5('0x14'));var db=require(_0x47a5('0x15'))['db'];function respondWithStatusCode(_0xd308b8,_0x1eae59){_0x1eae59=_0x1eae59||0xcc;return function(_0x5beb89){if(_0x5beb89){return _0xd308b8[_0x47a5('0x16')](_0x1eae59);}return _0xd308b8[_0x47a5('0x17')](_0x1eae59)[_0x47a5('0x18')]();};}function respondWithResult(_0x711793,_0x139f25){_0x139f25=_0x139f25||0xc8;return function(_0x620ee9){if(_0x620ee9){return _0x711793[_0x47a5('0x17')](_0x139f25)[_0x47a5('0x19')](_0x620ee9);}};}function respondWithFilteredResult(_0x4e99a8,_0x362359){return function(_0x11faf5){if(_0x11faf5){var _0x3b001e=typeof _0x362359[_0x47a5('0x1a')]===_0x47a5('0x1b')&&typeof _0x362359['limit']==='undefined';var _0x138bc0=_0x11faf5['count'];var _0x5247fd=_0x3b001e?0x0:_0x362359[_0x47a5('0x1a')];var _0xaf70a6=_0x3b001e?_0x11faf5[_0x47a5('0x1c')]:_0x362359[_0x47a5('0x1a')]+_0x362359[_0x47a5('0x1d')];var _0x12b98e;if(_0xaf70a6>=_0x138bc0){_0xaf70a6=_0x138bc0;_0x12b98e=0xc8;}else{_0x12b98e=0xce;}_0x4e99a8[_0x47a5('0x17')](_0x12b98e);return _0x4e99a8[_0x47a5('0x1e')](_0x47a5('0x1f'),_0x5247fd+'-'+_0xaf70a6+'/'+_0x138bc0)['json'](_0x11faf5);}return null;};}function patchUpdates(_0x1570bc){return function(_0xf160ba){try{jsonpatch['apply'](_0xf160ba,_0x1570bc,!![]);}catch(_0x2b0360){return BPromise[_0x47a5('0x20')](_0x2b0360);}return _0xf160ba[_0x47a5('0x21')]();};}function saveUpdates(_0x4c5910,_0xb8ae6c){return function(_0x2f142b){if(_0x2f142b){return _0x2f142b[_0x47a5('0x22')](_0x4c5910)[_0x47a5('0x23')](function(_0x5ef1b1){return _0x5ef1b1;});}return null;};}function removeEntity(_0xe2dea9,_0x385687){return function(_0x513981){if(_0x513981){return _0x513981[_0x47a5('0x24')]()[_0x47a5('0x23')](function(){_0xe2dea9[_0x47a5('0x17')](0xcc)[_0x47a5('0x18')]();});}};}function handleEntityNotFound(_0x3abd6a,_0x50bf17){return function(_0x53078a){if(!_0x53078a){_0x3abd6a[_0x47a5('0x16')](0x194);}return _0x53078a;};}function handleError(_0x5686db,_0x1ea9c8){_0x1ea9c8=_0x1ea9c8||0x1f4;return function(_0x5b6c4e){logger[_0x47a5('0x25')](_0x5b6c4e[_0x47a5('0x26')]);if(_0x5b6c4e[_0x47a5('0x27')]){delete _0x5b6c4e[_0x47a5('0x27')];}_0x5686db[_0x47a5('0x17')](_0x1ea9c8)[_0x47a5('0x28')](_0x5b6c4e);};}exports[_0x47a5('0x22')]=function(_0x136b14,_0x16631f){if(_0x136b14[_0x47a5('0x29')]['id']){delete _0x136b14[_0x47a5('0x29')]['id'];}return db[_0x47a5('0x2a')][_0x47a5('0x2b')]({'where':{'id':_0x136b14['params']['id']}})[_0x47a5('0x23')](handleEntityNotFound(_0x16631f,null))['then'](saveUpdates(_0x136b14[_0x47a5('0x29')],null))[_0x47a5('0x23')](respondWithResult(_0x16631f,null))[_0x47a5('0x2c')](handleError(_0x16631f,null));};exports['destroy']=function(_0x256650,_0x625952){return db[_0x47a5('0x2a')][_0x47a5('0x2b')]({'where':{'id':_0x256650['params']['id']}})['then'](handleEntityNotFound(_0x625952,null))[_0x47a5('0x23')](removeEntity(_0x625952,null))[_0x47a5('0x2c')](handleError(_0x625952,null));}; \ No newline at end of file +var _0x7a54=['sox','to-csv','fs-extra','squel','crypto','desk.js','ioredis','../../components/auth/service','../../components/parsers/advancedSearch','api','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','sendStatus','status','end','json','offset','undefined','count','limit','set','Content-Range','reject','save','update','then','destroy','error','stack','name','send','body','Condition','find','catch','eml-format','rimraf','zip-dir','request-promise','moment','mustache','util','path'];(function(_0x555714,_0x48c716){var _0x319d44=function(_0x337475){while(--_0x337475){_0x555714['push'](_0x555714['shift']());}};_0x319d44(++_0x48c716);}(_0x7a54,0x106));var _0x47a5=function(_0x265f3e,_0x44825b){_0x265f3e=_0x265f3e-0x0;var _0x1d4e34=_0x7a54[_0x265f3e];return _0x1d4e34;};'use strict';var emlformat=require(_0x47a5('0x0'));var rimraf=require(_0x47a5('0x1'));var zipdir=require(_0x47a5('0x2'));var jsonpatch=require('fast-json-patch');var rp=require(_0x47a5('0x3'));var moment=require(_0x47a5('0x4'));var BPromise=require('bluebird');var Mustache=require(_0x47a5('0x5'));var util=require(_0x47a5('0x6'));var path=require(_0x47a5('0x7'));var sox=require(_0x47a5('0x8'));var csv=require(_0x47a5('0x9'));var ejs=require('ejs');var fs=require('fs');var fs_extra=require(_0x47a5('0xa'));var _=require('lodash');var squel=require(_0x47a5('0xb'));var crypto=require(_0x47a5('0xc'));var jsforce=require('jsforce');var deskjs=require(_0x47a5('0xd'));var toCsv=require('to-csv');var querystring=require('querystring');var Papa=require('papaparse');var Redis=require(_0x47a5('0xe'));var authService=require(_0x47a5('0xf'));var qs=require('../../components/parsers/qs');var as=require(_0x47a5('0x10'));var hardwareService=require('../../config/license/hardware');var logger=require('../../config/logger')(_0x47a5('0x11'));var utils=require(_0x47a5('0x12'));var config=require(_0x47a5('0x13'));var licenseUtil=require(_0x47a5('0x14'));var db=require(_0x47a5('0x15'))['db'];function respondWithStatusCode(_0xd308b8,_0x1eae59){_0x1eae59=_0x1eae59||0xcc;return function(_0x5beb89){if(_0x5beb89){return _0xd308b8[_0x47a5('0x16')](_0x1eae59);}return _0xd308b8[_0x47a5('0x17')](_0x1eae59)[_0x47a5('0x18')]();};}function respondWithResult(_0x711793,_0x139f25){_0x139f25=_0x139f25||0xc8;return function(_0x620ee9){if(_0x620ee9){return _0x711793[_0x47a5('0x17')](_0x139f25)[_0x47a5('0x19')](_0x620ee9);}};}function respondWithFilteredResult(_0x4e99a8,_0x362359){return function(_0x11faf5){if(_0x11faf5){var _0x3b001e=typeof _0x362359[_0x47a5('0x1a')]===_0x47a5('0x1b')&&typeof _0x362359['limit']==='undefined';var _0x138bc0=_0x11faf5['count'];var _0x5247fd=_0x3b001e?0x0:_0x362359[_0x47a5('0x1a')];var _0xaf70a6=_0x3b001e?_0x11faf5[_0x47a5('0x1c')]:_0x362359[_0x47a5('0x1a')]+_0x362359[_0x47a5('0x1d')];var _0x12b98e;if(_0xaf70a6>=_0x138bc0){_0xaf70a6=_0x138bc0;_0x12b98e=0xc8;}else{_0x12b98e=0xce;}_0x4e99a8[_0x47a5('0x17')](_0x12b98e);return _0x4e99a8[_0x47a5('0x1e')](_0x47a5('0x1f'),_0x5247fd+'-'+_0xaf70a6+'/'+_0x138bc0)['json'](_0x11faf5);}return null;};}function patchUpdates(_0x1570bc){return function(_0xf160ba){try{jsonpatch['apply'](_0xf160ba,_0x1570bc,!![]);}catch(_0x2b0360){return BPromise[_0x47a5('0x20')](_0x2b0360);}return _0xf160ba[_0x47a5('0x21')]();};}function saveUpdates(_0x4c5910,_0xb8ae6c){return function(_0x2f142b){if(_0x2f142b){return _0x2f142b[_0x47a5('0x22')](_0x4c5910)[_0x47a5('0x23')](function(_0x5ef1b1){return _0x5ef1b1;});}return null;};}function removeEntity(_0xe2dea9,_0x385687){return function(_0x513981){if(_0x513981){return _0x513981[_0x47a5('0x24')]()[_0x47a5('0x23')](function(){_0xe2dea9[_0x47a5('0x17')](0xcc)[_0x47a5('0x18')]();});}};}function handleEntityNotFound(_0x3abd6a,_0x50bf17){return function(_0x53078a){if(!_0x53078a){_0x3abd6a[_0x47a5('0x16')](0x194);}return _0x53078a;};}function handleError(_0x5686db,_0x1ea9c8){_0x1ea9c8=_0x1ea9c8||0x1f4;return function(_0x5b6c4e){logger[_0x47a5('0x25')](_0x5b6c4e[_0x47a5('0x26')]);if(_0x5b6c4e[_0x47a5('0x27')]){delete _0x5b6c4e[_0x47a5('0x27')];}_0x5686db[_0x47a5('0x17')](_0x1ea9c8)[_0x47a5('0x28')](_0x5b6c4e);};}exports[_0x47a5('0x22')]=function(_0x136b14,_0x16631f){if(_0x136b14[_0x47a5('0x29')]['id']){delete _0x136b14[_0x47a5('0x29')]['id'];}return db[_0x47a5('0x2a')][_0x47a5('0x2b')]({'where':{'id':_0x136b14['params']['id']}})[_0x47a5('0x23')](handleEntityNotFound(_0x16631f,null))['then'](saveUpdates(_0x136b14[_0x47a5('0x29')],null))[_0x47a5('0x23')](respondWithResult(_0x16631f,null))[_0x47a5('0x2c')](handleError(_0x16631f,null));};exports['destroy']=function(_0x256650,_0x625952){return db[_0x47a5('0x2a')][_0x47a5('0x2b')]({'where':{'id':_0x256650['params']['id']}})['then'](handleEntityNotFound(_0x625952,null))[_0x47a5('0x23')](removeEntity(_0x625952,null))[_0x47a5('0x2c')](handleError(_0x625952,null));}; \ No newline at end of file diff --git a/server/api/condition/condition.model.js b/server/api/condition/condition.model.js index 04f1572..dc8d1c1 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 _0x23df=['Condition','tools_conditions','lodash','util','../../config/logger','moment','request-promise','path','rimraf','../../config/environment','exports','define'];(function(_0x3dd15e,_0x1f0015){var _0x231fd0=function(_0x4f680a){while(--_0x4f680a){_0x3dd15e['push'](_0x3dd15e['shift']());}};_0x231fd0(++_0x1f0015);}(_0x23df,0x18e));var _0xf23d=function(_0x41ebe9,_0x450a7e){_0x41ebe9=_0x41ebe9-0x0;var _0x4ffe5b=_0x23df[_0x41ebe9];return _0x4ffe5b;};'use strict';var _=require(_0xf23d('0x0'));var util=require(_0xf23d('0x1'));var logger=require(_0xf23d('0x2'))('api');var moment=require(_0xf23d('0x3'));var BPromise=require('bluebird');var rp=require(_0xf23d('0x4'));var fs=require('fs');var path=require(_0xf23d('0x5'));var rimraf=require(_0xf23d('0x6'));var config=require(_0xf23d('0x7'));var attributes=require('./condition.attributes');module[_0xf23d('0x8')]=function(_0x282e03,_0x29c4c6){return _0x282e03[_0xf23d('0x9')](_0xf23d('0xa'),attributes,{'tableName':_0xf23d('0xb'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x9994=['api','moment','request-promise','rimraf','./condition.attributes','exports','tools_conditions','lodash','util','../../config/logger'];(function(_0x5bf042,_0x3a8eb7){var _0x4864cf=function(_0x13e6a9){while(--_0x13e6a9){_0x5bf042['push'](_0x5bf042['shift']());}};_0x4864cf(++_0x3a8eb7);}(_0x9994,0x93));var _0x4999=function(_0x2e5f9c,_0x134a52){_0x2e5f9c=_0x2e5f9c-0x0;var _0x538b44=_0x9994[_0x2e5f9c];return _0x538b44;};'use strict';var _=require(_0x4999('0x0'));var util=require(_0x4999('0x1'));var logger=require(_0x4999('0x2'))(_0x4999('0x3'));var moment=require(_0x4999('0x4'));var BPromise=require('bluebird');var rp=require(_0x4999('0x5'));var fs=require('fs');var path=require('path');var rimraf=require(_0x4999('0x6'));var config=require('../../config/environment');var attributes=require(_0x4999('0x7'));module[_0x4999('0x8')]=function(_0x1770d1,_0x22d852){return _0x1770d1['define']('Condition',attributes,{'tableName':_0x4999('0x9'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/condition/condition.rpc.js b/server/api/condition/condition.rpc.js index 946dfb6..971506f 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 _0xe99f=['Condition,\x20%s,\x20%s,\x20%s','stringify','error','code','message','catch','lodash','util','bluebird','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','client','http','then','Condition,\x20%s,\x20%s','request\x20sent'];(function(_0x11bf4f,_0x56c933){var _0x2451e0=function(_0x38fcc1){while(--_0x38fcc1){_0x11bf4f['push'](_0x11bf4f['shift']());}};_0x2451e0(++_0x56c933);}(_0xe99f,0x15c));var _0xfe99=function(_0xdd75d3,_0x5a0ce5){_0xdd75d3=_0xdd75d3-0x0;var _0x344c2e=_0xe99f[_0xdd75d3];return _0x344c2e;};'use strict';var _=require(_0xfe99('0x0'));var util=require(_0xfe99('0x1'));var moment=require('moment');var BPromise=require(_0xfe99('0x2'));var rs=require('randomstring');var fs=require('fs');var Redis=require('ioredis');var db=require('../../mysqldb')['db'];var utils=require(_0xfe99('0x3'));var logger=require(_0xfe99('0x4'))(_0xfe99('0x5'));var config=require(_0xfe99('0x6'));var jayson=require(_0xfe99('0x7'));var client=jayson[_0xfe99('0x8')][_0xfe99('0x9')]({'port':0x232a});function respondWithRpcPromise(_0x5340cf,_0x27148c,_0x24ef0b){return new BPromise(function(_0xcbdd20,_0x2bbba0){return client['request'](_0x5340cf,_0x24ef0b)[_0xfe99('0xa')](function(_0x37a457){logger['info'](_0xfe99('0xb'),_0x27148c,_0xfe99('0xc'));logger['debug'](_0xfe99('0xd'),_0x27148c,_0xfe99('0xc'),JSON[_0xfe99('0xe')](_0x37a457));if(_0x37a457['error']){if(_0x37a457[_0xfe99('0xf')][_0xfe99('0x10')]===0x1f4){logger[_0xfe99('0xf')](_0xfe99('0xb'),_0x27148c,_0x37a457[_0xfe99('0xf')]['message']);return _0x2bbba0(_0x37a457[_0xfe99('0xf')][_0xfe99('0x11')]);}logger[_0xfe99('0xf')](_0xfe99('0xb'),_0x27148c,_0x37a457[_0xfe99('0xf')]['message']);return _0xcbdd20(_0x37a457[_0xfe99('0xf')][_0xfe99('0x11')]);}else{logger['info'](_0xfe99('0xb'),_0x27148c,_0xfe99('0xc'));_0xcbdd20(_0x37a457['result']['message']);}})[_0xfe99('0x12')](function(_0xed803e){logger['error'](_0xfe99('0xb'),_0x27148c,_0xed803e);_0x2bbba0(_0xed803e);});});} \ No newline at end of file +var _0x224f=['stringify','error','message','result','catch','lodash','util','moment','randomstring','../../config/utils','rpc','../../config/environment','jayson/promise','client','request','then','info','Condition,\x20%s,\x20%s','debug','Condition,\x20%s,\x20%s,\x20%s','request\x20sent'];(function(_0x1a89a1,_0x56d889){var _0x3d5b46=function(_0x56debf){while(--_0x56debf){_0x1a89a1['push'](_0x1a89a1['shift']());}};_0x3d5b46(++_0x56d889);}(_0x224f,0x1be));var _0xf224=function(_0x54fbff,_0x53470e){_0x54fbff=_0x54fbff-0x0;var _0x5cf619=_0x224f[_0x54fbff];return _0x5cf619;};'use strict';var _=require(_0xf224('0x0'));var util=require(_0xf224('0x1'));var moment=require(_0xf224('0x2'));var BPromise=require('bluebird');var rs=require(_0xf224('0x3'));var fs=require('fs');var Redis=require('ioredis');var db=require('../../mysqldb')['db'];var utils=require(_0xf224('0x4'));var logger=require('../../config/logger')(_0xf224('0x5'));var config=require(_0xf224('0x6'));var jayson=require(_0xf224('0x7'));var client=jayson[_0xf224('0x8')]['http']({'port':0x232a});function respondWithRpcPromise(_0x114b8b,_0x550814,_0x117bbb){return new BPromise(function(_0x3aceff,_0x34d2d6){return client[_0xf224('0x9')](_0x114b8b,_0x117bbb)[_0xf224('0xa')](function(_0x1023ce){logger[_0xf224('0xb')](_0xf224('0xc'),_0x550814,'request\x20sent');logger[_0xf224('0xd')](_0xf224('0xe'),_0x550814,_0xf224('0xf'),JSON[_0xf224('0x10')](_0x1023ce));if(_0x1023ce[_0xf224('0x11')]){if(_0x1023ce[_0xf224('0x11')]['code']===0x1f4){logger[_0xf224('0x11')]('Condition,\x20%s,\x20%s',_0x550814,_0x1023ce['error'][_0xf224('0x12')]);return _0x34d2d6(_0x1023ce[_0xf224('0x11')]['message']);}logger[_0xf224('0x11')]('Condition,\x20%s,\x20%s',_0x550814,_0x1023ce[_0xf224('0x11')][_0xf224('0x12')]);return _0x3aceff(_0x1023ce[_0xf224('0x11')][_0xf224('0x12')]);}else{logger['info']('Condition,\x20%s,\x20%s',_0x550814,_0xf224('0xf'));_0x3aceff(_0x1023ce[_0xf224('0x13')][_0xf224('0x12')]);}})[_0xf224('0x14')](function(_0x1c2ea2){logger['error']('Condition,\x20%s,\x20%s',_0x550814,_0x1c2ea2);_0x34d2d6(_0x1c2ea2);});});} \ No newline at end of file diff --git a/server/api/condition/index.js b/server/api/condition/index.js index 98fd087..8a0fc10 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 _0xa55f=['update','delete','destroy','exports','util','path','connect-timeout','Router','fs-extra','../../components/auth/service','../../config/environment','./condition.controller','isAuthenticated'];(function(_0x3dd15e,_0x1f0015){var _0x231fd0=function(_0x4f680a){while(--_0x4f680a){_0x3dd15e['push'](_0x3dd15e['shift']());}};_0x231fd0(++_0x1f0015);}(_0xa55f,0xba));var _0xfa55=function(_0x5b7584,_0x5bedb3){_0x5b7584=_0x5b7584-0x0;var _0x19397c=_0xa55f[_0x5b7584];return _0x19397c;};'use strict';var multer=require('multer');var util=require(_0xfa55('0x0'));var path=require(_0xfa55('0x1'));var timeout=require(_0xfa55('0x2'));var express=require('express');var router=express[_0xfa55('0x3')]();var fs_extra=require(_0xfa55('0x4'));var auth=require(_0xfa55('0x5'));var interaction=require('../../components/interaction/service');var config=require(_0xfa55('0x6'));var controller=require(_0xfa55('0x7'));router['put']('/:id',auth[_0xfa55('0x8')](),controller[_0xfa55('0x9')]);router[_0xfa55('0xa')]('/:id',auth[_0xfa55('0x8')](),controller[_0xfa55('0xb')]);module[_0xfa55('0xc')]=router; \ No newline at end of file +var _0x1e6f=['destroy','exports','multer','path','connect-timeout','express','fs-extra','../../components/interaction/service','../../config/environment','./condition.controller','put','/:id','isAuthenticated','update','delete'];(function(_0x321bb2,_0x202794){var _0x9c12ed=function(_0x263dd3){while(--_0x263dd3){_0x321bb2['push'](_0x321bb2['shift']());}};_0x9c12ed(++_0x202794);}(_0x1e6f,0x16a));var _0xf1e6=function(_0x3b9a68,_0x479ef2){_0x3b9a68=_0x3b9a68-0x0;var _0x458c8f=_0x1e6f[_0x3b9a68];return _0x458c8f;};'use strict';var multer=require(_0xf1e6('0x0'));var util=require('util');var path=require(_0xf1e6('0x1'));var timeout=require(_0xf1e6('0x2'));var express=require(_0xf1e6('0x3'));var router=express['Router']();var fs_extra=require(_0xf1e6('0x4'));var auth=require('../../components/auth/service');var interaction=require(_0xf1e6('0x5'));var config=require(_0xf1e6('0x6'));var controller=require(_0xf1e6('0x7'));router[_0xf1e6('0x8')](_0xf1e6('0x9'),auth[_0xf1e6('0xa')](),controller[_0xf1e6('0xb')]);router[_0xf1e6('0xc')](_0xf1e6('0x9'),auth[_0xf1e6('0xa')](),controller[_0xf1e6('0xd')]);module[_0xf1e6('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 8329824..b2c6533 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 _0xf3fb=['sequelize','STRING','name'];(function(_0x14add3,_0x13ce8d){var _0x4a174f=function(_0x2b3ed7){while(--_0x2b3ed7){_0x14add3['push'](_0x14add3['shift']());}};_0x4a174f(++_0x13ce8d);}(_0xf3fb,0x13e));var _0xbf3f=function(_0x304320,_0x232a69){_0x304320=_0x304320-0x0;var _0xe607da=_0xf3fb[_0x304320];return _0xe607da;};'use strict';var Sequelize=require(_0xbf3f('0x0'));module['exports']={'name':{'type':Sequelize[_0xbf3f('0x1')],'allowNull':![],'unique':_0xbf3f('0x2')},'OrderBy':{'type':Sequelize['INTEGER'],'allowNull':!![]},'rgbBackgroundColor':{'type':Sequelize[_0xbf3f('0x1')],'allowNull':!![]}}; \ No newline at end of file +var _0x2e76=['STRING','sequelize','name'];(function(_0x54b8bb,_0x25cea2){var _0x3f6220=function(_0x279086){while(--_0x279086){_0x54b8bb['push'](_0x54b8bb['shift']());}};_0x3f6220(++_0x25cea2);}(_0x2e76,0x199));var _0x62e7=function(_0x169629,_0x2f74a5){_0x169629=_0x169629-0x0;var _0x4ea134=_0x2e76[_0x169629];return _0x4ea134;};'use strict';var Sequelize=require(_0x62e7('0x0'));module['exports']={'name':{'type':Sequelize['STRING'],'allowNull':![],'unique':_0x62e7('0x1')},'OrderBy':{'type':Sequelize['INTEGER'],'allowNull':!![]},'rgbBackgroundColor':{'type':Sequelize[_0x62e7('0x2')],'allowNull':!![]}}; \ No newline at end of file diff --git a/server/api/contactItemType/contactItemType.controller.js b/server/api/contactItemType/contactItemType.controller.js index 4e2cfc8..912c53d 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 _0x7d25=['limit','Content-Range','apply','reject','save','update','then','destroy','get','ContactItemTypes','UserProfileResource','error','stack','name','send','index','map','ContactItemType','rawAttributes','fieldName','type','key','model','query','keys','filters','intersection','attributes','fields','length','hasOwnProperty','sort','where','pick','filter','merge','VIRTUAL','options','rows','catch','includeAll','include','find','create','user','Unable\x20to\x20retrieve\x20the\x20current\x20user','role','UserProfileSection','userProfileId','autoAssociation','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','body','params','CmContactHasItem','rimraf','zip-dir','fast-json-patch','request-promise','moment','bluebird','mustache','ejs','lodash','squel','crypto','to-csv','papaparse','ioredis','../../components/auth/service','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','sendStatus','status','end','json','undefined','count','offset'];(function(_0x321bb2,_0x202794){var _0x9c12ed=function(_0x263dd3){while(--_0x263dd3){_0x321bb2['push'](_0x321bb2['shift']());}};_0x9c12ed(++_0x202794);}(_0x7d25,0x8a));var _0x57d2=function(_0x411017,_0x4a8117){_0x411017=_0x411017-0x0;var _0x2adeea=_0x7d25[_0x411017];return _0x2adeea;};'use strict';var emlformat=require('eml-format');var rimraf=require(_0x57d2('0x0'));var zipdir=require(_0x57d2('0x1'));var jsonpatch=require(_0x57d2('0x2'));var rp=require(_0x57d2('0x3'));var moment=require(_0x57d2('0x4'));var BPromise=require(_0x57d2('0x5'));var Mustache=require(_0x57d2('0x6'));var util=require('util');var path=require('path');var sox=require('sox');var csv=require('to-csv');var ejs=require(_0x57d2('0x7'));var fs=require('fs');var fs_extra=require('fs-extra');var _=require(_0x57d2('0x8'));var squel=require(_0x57d2('0x9'));var crypto=require(_0x57d2('0xa'));var jsforce=require('jsforce');var deskjs=require('desk.js');var toCsv=require(_0x57d2('0xb'));var querystring=require('querystring');var Papa=require(_0x57d2('0xc'));var Redis=require(_0x57d2('0xd'));var authService=require(_0x57d2('0xe'));var qs=require('../../components/parsers/qs');var as=require(_0x57d2('0xf'));var hardwareService=require(_0x57d2('0x10'));var logger=require(_0x57d2('0x11'))(_0x57d2('0x12'));var utils=require(_0x57d2('0x13'));var config=require(_0x57d2('0x14'));var licenseUtil=require(_0x57d2('0x15'));var db=require(_0x57d2('0x16'))['db'];function respondWithStatusCode(_0x43d7fb,_0x32c33a){_0x32c33a=_0x32c33a||0xcc;return function(_0x28428b){if(_0x28428b){return _0x43d7fb[_0x57d2('0x17')](_0x32c33a);}return _0x43d7fb[_0x57d2('0x18')](_0x32c33a)[_0x57d2('0x19')]();};}function respondWithResult(_0x1ba57e,_0x4086f3){_0x4086f3=_0x4086f3||0xc8;return function(_0x5382d9){if(_0x5382d9){return _0x1ba57e['status'](_0x4086f3)[_0x57d2('0x1a')](_0x5382d9);}};}function respondWithFilteredResult(_0x148ef3,_0x4ec4b1){return function(_0x8cf637){if(_0x8cf637){var _0x319489=typeof _0x4ec4b1['offset']===_0x57d2('0x1b')&&typeof _0x4ec4b1['limit']===_0x57d2('0x1b');var _0x4b4fe0=_0x8cf637[_0x57d2('0x1c')];var _0x7d4cf1=_0x319489?0x0:_0x4ec4b1[_0x57d2('0x1d')];var _0x4a94e3=_0x319489?_0x8cf637['count']:_0x4ec4b1[_0x57d2('0x1d')]+_0x4ec4b1[_0x57d2('0x1e')];var _0x2662cd;if(_0x4a94e3>=_0x4b4fe0){_0x4a94e3=_0x4b4fe0;_0x2662cd=0xc8;}else{_0x2662cd=0xce;}_0x148ef3[_0x57d2('0x18')](_0x2662cd);return _0x148ef3['set'](_0x57d2('0x1f'),_0x7d4cf1+'-'+_0x4a94e3+'/'+_0x4b4fe0)[_0x57d2('0x1a')](_0x8cf637);}return null;};}function patchUpdates(_0x55191e){return function(_0x5f3fd5){try{jsonpatch[_0x57d2('0x20')](_0x5f3fd5,_0x55191e,!![]);}catch(_0x326d49){return BPromise[_0x57d2('0x21')](_0x326d49);}return _0x5f3fd5[_0x57d2('0x22')]();};}function saveUpdates(_0x386196,_0x803c25){return function(_0x32c7c8){if(_0x32c7c8){return _0x32c7c8[_0x57d2('0x23')](_0x386196)[_0x57d2('0x24')](function(_0x26718e){return _0x26718e;});}return null;};}function removeEntity(_0x46a4d1,_0x456fe1){return function(_0x12ff19){if(_0x12ff19){return _0x12ff19[_0x57d2('0x25')]()['then'](function(){var _0x424ddc=_0x12ff19[_0x57d2('0x26')]({'plain':!![]});var _0x3c7de8=_0x57d2('0x27');return db[_0x57d2('0x28')]['destroy']({'where':{'type':_0x3c7de8,'resourceId':_0x424ddc['id']}})[_0x57d2('0x24')](function(){return _0x12ff19;});})[_0x57d2('0x24')](function(){_0x46a4d1[_0x57d2('0x18')](0xcc)[_0x57d2('0x19')]();});}};}function handleEntityNotFound(_0x18d500,_0x4b3d8e){return function(_0x9bdb11){if(!_0x9bdb11){_0x18d500['sendStatus'](0x194);}return _0x9bdb11;};}function handleError(_0x1ae5ff,_0x15f1ba){_0x15f1ba=_0x15f1ba||0x1f4;return function(_0x277426){logger[_0x57d2('0x29')](_0x277426[_0x57d2('0x2a')]);if(_0x277426[_0x57d2('0x2b')]){delete _0x277426[_0x57d2('0x2b')];}_0x1ae5ff[_0x57d2('0x18')](_0x15f1ba)[_0x57d2('0x2c')](_0x277426);};}exports[_0x57d2('0x2d')]=function(_0x574589,_0x4e9178){var _0x3da926={},_0x26e052={},_0x3e017c={'count':0x0,'rows':[]};var _0x484597=_[_0x57d2('0x2e')](db[_0x57d2('0x2f')][_0x57d2('0x30')],function(_0x290c2d){return{'name':_0x290c2d[_0x57d2('0x31')],'type':_0x290c2d[_0x57d2('0x32')][_0x57d2('0x33')]};});_0x26e052[_0x57d2('0x34')]=_[_0x57d2('0x2e')](_0x484597,'name');_0x26e052[_0x57d2('0x35')]=_[_0x57d2('0x36')](_0x574589['query']);_0x26e052[_0x57d2('0x37')]=_[_0x57d2('0x38')](_0x26e052['model'],_0x26e052[_0x57d2('0x35')]);_0x3da926[_0x57d2('0x39')]=_[_0x57d2('0x38')](_0x26e052[_0x57d2('0x34')],qs[_0x57d2('0x3a')](_0x574589['query']['fields']));_0x3da926['attributes']=_0x3da926['attributes'][_0x57d2('0x3b')]?_0x3da926[_0x57d2('0x39')]:_0x26e052[_0x57d2('0x34')];if(!_0x574589[_0x57d2('0x35')][_0x57d2('0x3c')]('nolimit')){_0x3da926[_0x57d2('0x1e')]=qs['limit'](_0x574589[_0x57d2('0x35')][_0x57d2('0x1e')]);_0x3da926[_0x57d2('0x1d')]=qs['offset'](_0x574589[_0x57d2('0x35')][_0x57d2('0x1d')]);}_0x3da926['order']=qs[_0x57d2('0x3d')](_0x574589[_0x57d2('0x35')][_0x57d2('0x3d')]);_0x3da926[_0x57d2('0x3e')]=qs[_0x57d2('0x37')](_[_0x57d2('0x3f')](_0x574589['query'],_0x26e052[_0x57d2('0x37')]),_0x484597);if(_0x574589['query'][_0x57d2('0x40')]){_0x3da926[_0x57d2('0x3e')]=_[_0x57d2('0x41')](_0x3da926[_0x57d2('0x3e')],{'$or':_[_0x57d2('0x2e')](_0x484597,function(_0x512dbf){if(_0x512dbf[_0x57d2('0x32')]!==_0x57d2('0x42')){var _0x4f6955={};_0x4f6955[_0x512dbf[_0x57d2('0x2b')]]={'$like':'%'+_0x574589[_0x57d2('0x35')][_0x57d2('0x40')]+'%'};return _0x4f6955;}})});}_0x3da926=_['merge']({},_0x3da926,_0x574589[_0x57d2('0x43')]);var _0x2fe0cd={'where':_0x3da926[_0x57d2('0x3e')]};return db[_0x57d2('0x2f')]['count'](_0x2fe0cd)['then'](function(_0x11a2ec){_0x3e017c[_0x57d2('0x1c')]=_0x11a2ec;if(_0x574589[_0x57d2('0x35')]['includeAll']){_0x3da926['include']=[{'all':!![]}];}return db[_0x57d2('0x2f')]['findAll'](_0x3da926);})[_0x57d2('0x24')](function(_0x1bb8ad){_0x3e017c[_0x57d2('0x44')]=_0x1bb8ad;return _0x3e017c;})[_0x57d2('0x24')](respondWithFilteredResult(_0x4e9178,_0x3da926))[_0x57d2('0x45')](handleError(_0x4e9178,null));};exports['show']=function(_0x13216b,_0x1c069a){var _0x53ab43={'raw':!![],'where':{'id':_0x13216b['params']['id']}},_0x775f8c={};_0x775f8c[_0x57d2('0x34')]=_[_0x57d2('0x36')](db[_0x57d2('0x2f')][_0x57d2('0x30')]);_0x775f8c['query']=_['keys'](_0x13216b[_0x57d2('0x35')]);_0x775f8c['filters']=_['intersection'](_0x775f8c[_0x57d2('0x34')],_0x775f8c['query']);_0x53ab43['attributes']=_[_0x57d2('0x38')](_0x775f8c['model'],qs[_0x57d2('0x3a')](_0x13216b['query'][_0x57d2('0x3a')]));_0x53ab43['attributes']=_0x53ab43['attributes'][_0x57d2('0x3b')]?_0x53ab43[_0x57d2('0x39')]:_0x775f8c[_0x57d2('0x34')];if(_0x13216b[_0x57d2('0x35')][_0x57d2('0x46')]){_0x53ab43[_0x57d2('0x47')]=[{'all':!![]}];}_0x53ab43=_['merge']({},_0x53ab43,_0x13216b[_0x57d2('0x43')]);return db[_0x57d2('0x2f')][_0x57d2('0x48')](_0x53ab43)[_0x57d2('0x24')](handleEntityNotFound(_0x1c069a,null))[_0x57d2('0x24')](respondWithResult(_0x1c069a,null))[_0x57d2('0x45')](handleError(_0x1c069a,null));};exports[_0x57d2('0x49')]=function(_0x406375,_0x51f172){return db[_0x57d2('0x2f')][_0x57d2('0x49')](_0x406375['body'],{})[_0x57d2('0x24')](function(_0x5b06f7){var _0x59a6eb=_0x406375[_0x57d2('0x4a')][_0x57d2('0x26')]({'plain':!![]});if(!_0x59a6eb)throw new Error(_0x57d2('0x4b'));if(_0x59a6eb[_0x57d2('0x4c')]==='user'){var _0x265d24=_0x5b06f7[_0x57d2('0x26')]({'plain':!![]});var _0x51b535='ContactItemTypes';return db[_0x57d2('0x4d')][_0x57d2('0x48')]({'where':{'name':_0x51b535,'userProfileId':_0x59a6eb[_0x57d2('0x4e')]},'raw':!![]})[_0x57d2('0x24')](function(_0x3092c8){if(_0x3092c8&&_0x3092c8[_0x57d2('0x4f')]===0x0){return db['UserProfileResource']['create']({'name':_0x265d24['name'],'resourceId':_0x265d24['id'],'type':_0x3092c8[_0x57d2('0x2b')],'sectionId':_0x3092c8['id']},{})['then'](function(){return _0x5b06f7;});}else{return _0x5b06f7;}})[_0x57d2('0x45')](function(_0x2ef710){logger['error'](_0x57d2('0x50'),_0x2ef710);throw _0x2ef710;});}return _0x5b06f7;})[_0x57d2('0x24')](respondWithResult(_0x51f172,0xc9))[_0x57d2('0x45')](handleError(_0x51f172,null));};exports['update']=function(_0x10d4e5,_0x224b7d){if(_0x10d4e5[_0x57d2('0x51')]['id']){delete _0x10d4e5[_0x57d2('0x51')]['id'];}return db[_0x57d2('0x2f')][_0x57d2('0x48')]({'where':{'id':_0x10d4e5[_0x57d2('0x52')]['id']}})[_0x57d2('0x24')](handleEntityNotFound(_0x224b7d,null))[_0x57d2('0x24')](saveUpdates(_0x10d4e5['body'],null))[_0x57d2('0x24')](respondWithResult(_0x224b7d,null))[_0x57d2('0x45')](handleError(_0x224b7d,null));};exports[_0x57d2('0x25')]=function(_0x5e3289,_0x7b334f){return db[_0x57d2('0x2f')][_0x57d2('0x48')]({'where':{'id':_0x5e3289['params']['id']}})['then'](handleEntityNotFound(_0x7b334f,null))['then'](db[_0x57d2('0x53')]['update']({'ItemTypeId':null},{'where':{'ItemTypeId':_0x5e3289[_0x57d2('0x52')]['id']}}))['then'](removeEntity(_0x7b334f,null))[_0x57d2('0x45')](handleError(_0x7b334f,null));}; \ No newline at end of file +var _0x6d11=['intersection','fields','length','hasOwnProperty','nolimit','order','sort','where','filter','merge','options','include','findAll','rows','catch','show','params','includeAll','find','create','body','role','user','UserProfileSection','autoAssociation','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','update','eml-format','rimraf','zip-dir','request-promise','bluebird','mustache','sox','to-csv','ejs','fs-extra','lodash','squel','crypto','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','sendStatus','status','end','json','offset','undefined','limit','apply','reject','then','destroy','get','ContactItemTypes','UserProfileResource','error','stack','name','send','index','map','ContactItemType','rawAttributes','fieldName','type','key','model','query','keys','filters','attributes'];(function(_0x4ab32c,_0x44ab5e){var _0x2b9644=function(_0x498479){while(--_0x498479){_0x4ab32c['push'](_0x4ab32c['shift']());}};_0x2b9644(++_0x44ab5e);}(_0x6d11,0xbf));var _0x16d1=function(_0xa20971,_0x1bf32c){_0xa20971=_0xa20971-0x0;var _0x4f4271=_0x6d11[_0xa20971];return _0x4f4271;};'use strict';var emlformat=require(_0x16d1('0x0'));var rimraf=require(_0x16d1('0x1'));var zipdir=require(_0x16d1('0x2'));var jsonpatch=require('fast-json-patch');var rp=require(_0x16d1('0x3'));var moment=require('moment');var BPromise=require(_0x16d1('0x4'));var Mustache=require(_0x16d1('0x5'));var util=require('util');var path=require('path');var sox=require(_0x16d1('0x6'));var csv=require(_0x16d1('0x7'));var ejs=require(_0x16d1('0x8'));var fs=require('fs');var fs_extra=require(_0x16d1('0x9'));var _=require(_0x16d1('0xa'));var squel=require(_0x16d1('0xb'));var crypto=require(_0x16d1('0xc'));var jsforce=require('jsforce');var deskjs=require('desk.js');var toCsv=require('to-csv');var querystring=require(_0x16d1('0xd'));var Papa=require(_0x16d1('0xe'));var Redis=require(_0x16d1('0xf'));var authService=require(_0x16d1('0x10'));var qs=require('../../components/parsers/qs');var as=require(_0x16d1('0x11'));var hardwareService=require(_0x16d1('0x12'));var logger=require(_0x16d1('0x13'))(_0x16d1('0x14'));var utils=require(_0x16d1('0x15'));var config=require(_0x16d1('0x16'));var licenseUtil=require(_0x16d1('0x17'));var db=require(_0x16d1('0x18'))['db'];function respondWithStatusCode(_0x4de260,_0x32fa68){_0x32fa68=_0x32fa68||0xcc;return function(_0x2e71fa){if(_0x2e71fa){return _0x4de260[_0x16d1('0x19')](_0x32fa68);}return _0x4de260[_0x16d1('0x1a')](_0x32fa68)[_0x16d1('0x1b')]();};}function respondWithResult(_0x5a1429,_0xc034b7){_0xc034b7=_0xc034b7||0xc8;return function(_0x1b71d3){if(_0x1b71d3){return _0x5a1429[_0x16d1('0x1a')](_0xc034b7)[_0x16d1('0x1c')](_0x1b71d3);}};}function respondWithFilteredResult(_0x29ebba,_0x173e16){return function(_0x2d7e8a){if(_0x2d7e8a){var _0x4ee46c=typeof _0x173e16[_0x16d1('0x1d')]===_0x16d1('0x1e')&&typeof _0x173e16['limit']==='undefined';var _0x1a9ec8=_0x2d7e8a['count'];var _0x46a25e=_0x4ee46c?0x0:_0x173e16['offset'];var _0x1da1b8=_0x4ee46c?_0x2d7e8a['count']:_0x173e16[_0x16d1('0x1d')]+_0x173e16[_0x16d1('0x1f')];var _0x48cd70;if(_0x1da1b8>=_0x1a9ec8){_0x1da1b8=_0x1a9ec8;_0x48cd70=0xc8;}else{_0x48cd70=0xce;}_0x29ebba['status'](_0x48cd70);return _0x29ebba['set']('Content-Range',_0x46a25e+'-'+_0x1da1b8+'/'+_0x1a9ec8)[_0x16d1('0x1c')](_0x2d7e8a);}return null;};}function patchUpdates(_0x55a0e0){return function(_0x34b88f){try{jsonpatch[_0x16d1('0x20')](_0x34b88f,_0x55a0e0,!![]);}catch(_0x1f6add){return BPromise[_0x16d1('0x21')](_0x1f6add);}return _0x34b88f['save']();};}function saveUpdates(_0x2c7825,_0x58a03b){return function(_0x2a897d){if(_0x2a897d){return _0x2a897d['update'](_0x2c7825)[_0x16d1('0x22')](function(_0x8c7266){return _0x8c7266;});}return null;};}function removeEntity(_0x17e038,_0x47cad4){return function(_0x215c23){if(_0x215c23){return _0x215c23[_0x16d1('0x23')]()[_0x16d1('0x22')](function(){var _0x21e122=_0x215c23[_0x16d1('0x24')]({'plain':!![]});var _0x335c24=_0x16d1('0x25');return db[_0x16d1('0x26')][_0x16d1('0x23')]({'where':{'type':_0x335c24,'resourceId':_0x21e122['id']}})[_0x16d1('0x22')](function(){return _0x215c23;});})[_0x16d1('0x22')](function(){_0x17e038[_0x16d1('0x1a')](0xcc)['end']();});}};}function handleEntityNotFound(_0x25ae4e,_0x440a47){return function(_0x4257f1){if(!_0x4257f1){_0x25ae4e['sendStatus'](0x194);}return _0x4257f1;};}function handleError(_0x28837c,_0x1deb1e){_0x1deb1e=_0x1deb1e||0x1f4;return function(_0x364bf7){logger[_0x16d1('0x27')](_0x364bf7[_0x16d1('0x28')]);if(_0x364bf7[_0x16d1('0x29')]){delete _0x364bf7[_0x16d1('0x29')];}_0x28837c['status'](_0x1deb1e)[_0x16d1('0x2a')](_0x364bf7);};}exports[_0x16d1('0x2b')]=function(_0x31c4e9,_0x30cd8f){var _0x55c021={},_0x4b27f6={},_0x2f16ee={'count':0x0,'rows':[]};var _0x4ab3d4=_[_0x16d1('0x2c')](db[_0x16d1('0x2d')][_0x16d1('0x2e')],function(_0x2b4dbd){return{'name':_0x2b4dbd[_0x16d1('0x2f')],'type':_0x2b4dbd[_0x16d1('0x30')][_0x16d1('0x31')]};});_0x4b27f6[_0x16d1('0x32')]=_[_0x16d1('0x2c')](_0x4ab3d4,_0x16d1('0x29'));_0x4b27f6[_0x16d1('0x33')]=_[_0x16d1('0x34')](_0x31c4e9['query']);_0x4b27f6[_0x16d1('0x35')]=_['intersection'](_0x4b27f6[_0x16d1('0x32')],_0x4b27f6[_0x16d1('0x33')]);_0x55c021[_0x16d1('0x36')]=_[_0x16d1('0x37')](_0x4b27f6[_0x16d1('0x32')],qs[_0x16d1('0x38')](_0x31c4e9['query']['fields']));_0x55c021['attributes']=_0x55c021[_0x16d1('0x36')][_0x16d1('0x39')]?_0x55c021[_0x16d1('0x36')]:_0x4b27f6[_0x16d1('0x32')];if(!_0x31c4e9['query'][_0x16d1('0x3a')](_0x16d1('0x3b'))){_0x55c021['limit']=qs['limit'](_0x31c4e9['query'][_0x16d1('0x1f')]);_0x55c021[_0x16d1('0x1d')]=qs[_0x16d1('0x1d')](_0x31c4e9['query'][_0x16d1('0x1d')]);}_0x55c021[_0x16d1('0x3c')]=qs[_0x16d1('0x3d')](_0x31c4e9[_0x16d1('0x33')][_0x16d1('0x3d')]);_0x55c021[_0x16d1('0x3e')]=qs[_0x16d1('0x35')](_['pick'](_0x31c4e9['query'],_0x4b27f6['filters']),_0x4ab3d4);if(_0x31c4e9[_0x16d1('0x33')][_0x16d1('0x3f')]){_0x55c021[_0x16d1('0x3e')]=_[_0x16d1('0x40')](_0x55c021[_0x16d1('0x3e')],{'$or':_[_0x16d1('0x2c')](_0x4ab3d4,function(_0x364c39){if(_0x364c39[_0x16d1('0x30')]!=='VIRTUAL'){var _0x180f55={};_0x180f55[_0x364c39['name']]={'$like':'%'+_0x31c4e9['query'][_0x16d1('0x3f')]+'%'};return _0x180f55;}})});}_0x55c021=_[_0x16d1('0x40')]({},_0x55c021,_0x31c4e9[_0x16d1('0x41')]);var _0x3a0343={'where':_0x55c021[_0x16d1('0x3e')]};return db[_0x16d1('0x2d')]['count'](_0x3a0343)[_0x16d1('0x22')](function(_0x525212){_0x2f16ee['count']=_0x525212;if(_0x31c4e9['query']['includeAll']){_0x55c021[_0x16d1('0x42')]=[{'all':!![]}];}return db[_0x16d1('0x2d')][_0x16d1('0x43')](_0x55c021);})[_0x16d1('0x22')](function(_0x53de06){_0x2f16ee[_0x16d1('0x44')]=_0x53de06;return _0x2f16ee;})['then'](respondWithFilteredResult(_0x30cd8f,_0x55c021))[_0x16d1('0x45')](handleError(_0x30cd8f,null));};exports[_0x16d1('0x46')]=function(_0x19ac7c,_0x2e4971){var _0x1a109d={'raw':!![],'where':{'id':_0x19ac7c[_0x16d1('0x47')]['id']}},_0x116f51={};_0x116f51[_0x16d1('0x32')]=_[_0x16d1('0x34')](db[_0x16d1('0x2d')][_0x16d1('0x2e')]);_0x116f51[_0x16d1('0x33')]=_[_0x16d1('0x34')](_0x19ac7c[_0x16d1('0x33')]);_0x116f51[_0x16d1('0x35')]=_['intersection'](_0x116f51['model'],_0x116f51[_0x16d1('0x33')]);_0x1a109d[_0x16d1('0x36')]=_[_0x16d1('0x37')](_0x116f51[_0x16d1('0x32')],qs[_0x16d1('0x38')](_0x19ac7c[_0x16d1('0x33')]['fields']));_0x1a109d[_0x16d1('0x36')]=_0x1a109d[_0x16d1('0x36')][_0x16d1('0x39')]?_0x1a109d['attributes']:_0x116f51['model'];if(_0x19ac7c[_0x16d1('0x33')][_0x16d1('0x48')]){_0x1a109d['include']=[{'all':!![]}];}_0x1a109d=_[_0x16d1('0x40')]({},_0x1a109d,_0x19ac7c['options']);return db[_0x16d1('0x2d')][_0x16d1('0x49')](_0x1a109d)[_0x16d1('0x22')](handleEntityNotFound(_0x2e4971,null))[_0x16d1('0x22')](respondWithResult(_0x2e4971,null))['catch'](handleError(_0x2e4971,null));};exports['create']=function(_0x1d92cd,_0x8bb0c1){return db['ContactItemType'][_0x16d1('0x4a')](_0x1d92cd[_0x16d1('0x4b')],{})[_0x16d1('0x22')](function(_0x117da5){var _0x3b77db=_0x1d92cd['user'][_0x16d1('0x24')]({'plain':!![]});if(!_0x3b77db)throw new Error('Unable\x20to\x20retrieve\x20the\x20current\x20user');if(_0x3b77db[_0x16d1('0x4c')]===_0x16d1('0x4d')){var _0x5d384c=_0x117da5[_0x16d1('0x24')]({'plain':!![]});var _0xd3a7f8=_0x16d1('0x25');return db[_0x16d1('0x4e')]['find']({'where':{'name':_0xd3a7f8,'userProfileId':_0x3b77db['userProfileId']},'raw':!![]})['then'](function(_0x34e266){if(_0x34e266&&_0x34e266[_0x16d1('0x4f')]===0x0){return db[_0x16d1('0x26')][_0x16d1('0x4a')]({'name':_0x5d384c['name'],'resourceId':_0x5d384c['id'],'type':_0x34e266[_0x16d1('0x29')],'sectionId':_0x34e266['id']},{})[_0x16d1('0x22')](function(){return _0x117da5;});}else{return _0x117da5;}})['catch'](function(_0x1e1bbc){logger[_0x16d1('0x27')](_0x16d1('0x50'),_0x1e1bbc);throw _0x1e1bbc;});}return _0x117da5;})[_0x16d1('0x22')](respondWithResult(_0x8bb0c1,0xc9))['catch'](handleError(_0x8bb0c1,null));};exports[_0x16d1('0x51')]=function(_0x2b0aa7,_0xb9fb43){if(_0x2b0aa7['body']['id']){delete _0x2b0aa7['body']['id'];}return db[_0x16d1('0x2d')][_0x16d1('0x49')]({'where':{'id':_0x2b0aa7['params']['id']}})[_0x16d1('0x22')](handleEntityNotFound(_0xb9fb43,null))[_0x16d1('0x22')](saveUpdates(_0x2b0aa7[_0x16d1('0x4b')],null))['then'](respondWithResult(_0xb9fb43,null))[_0x16d1('0x45')](handleError(_0xb9fb43,null));};exports[_0x16d1('0x23')]=function(_0x11209f,_0x4b3079){return db[_0x16d1('0x2d')][_0x16d1('0x49')]({'where':{'id':_0x11209f['params']['id']}})[_0x16d1('0x22')](handleEntityNotFound(_0x4b3079,null))[_0x16d1('0x22')](db['CmContactHasItem'][_0x16d1('0x51')]({'ItemTypeId':null},{'where':{'ItemTypeId':_0x11209f[_0x16d1('0x47')]['id']}}))[_0x16d1('0x22')](removeEntity(_0x4b3079,null))[_0x16d1('0x45')](handleError(_0x4b3079,null));}; \ No newline at end of file diff --git a/server/api/contactItemType/contactItemType.model.js b/server/api/contactItemType/contactItemType.model.js index f233a33..6502c62 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 _0xd370=['exports','ContactItemType','tools_contact_item_types','lodash','util','../../config/logger','api','moment','bluebird','path','rimraf','../../config/environment','./contactItemType.attributes'];(function(_0x19fbb9,_0x4fffbf){var _0xb5e23a=function(_0x17250f){while(--_0x17250f){_0x19fbb9['push'](_0x19fbb9['shift']());}};_0xb5e23a(++_0x4fffbf);}(_0xd370,0xd3));var _0x0d37=function(_0x2080a3,_0x48acfa){_0x2080a3=_0x2080a3-0x0;var _0x8d7d17=_0xd370[_0x2080a3];return _0x8d7d17;};'use strict';var _=require(_0x0d37('0x0'));var util=require(_0x0d37('0x1'));var logger=require(_0x0d37('0x2'))(_0x0d37('0x3'));var moment=require(_0x0d37('0x4'));var BPromise=require(_0x0d37('0x5'));var rp=require('request-promise');var fs=require('fs');var path=require(_0x0d37('0x6'));var rimraf=require(_0x0d37('0x7'));var config=require(_0x0d37('0x8'));var attributes=require(_0x0d37('0x9'));module[_0x0d37('0xa')]=function(_0x19145f,_0x3f1d6d){return _0x19145f['define'](_0x0d37('0xb'),attributes,{'tableName':_0x0d37('0xc'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x92c3=['rimraf','../../config/environment','./contactItemType.attributes','exports','define','ContactItemType','tools_contact_item_types','lodash','util','../../config/logger','api','moment','path'];(function(_0x40bff4,_0x10a144){var _0x5dce83=function(_0x2236cd){while(--_0x2236cd){_0x40bff4['push'](_0x40bff4['shift']());}};_0x5dce83(++_0x10a144);}(_0x92c3,0x1e8));var _0x392c=function(_0x3c88cc,_0x9effd){_0x3c88cc=_0x3c88cc-0x0;var _0x4b335f=_0x92c3[_0x3c88cc];return _0x4b335f;};'use strict';var _=require(_0x392c('0x0'));var util=require(_0x392c('0x1'));var logger=require(_0x392c('0x2'))(_0x392c('0x3'));var moment=require(_0x392c('0x4'));var BPromise=require('bluebird');var rp=require('request-promise');var fs=require('fs');var path=require(_0x392c('0x5'));var rimraf=require(_0x392c('0x6'));var config=require(_0x392c('0x7'));var attributes=require(_0x392c('0x8'));module[_0x392c('0x9')]=function(_0x2222b5,_0x28597b){return _0x2222b5[_0x392c('0xa')](_0x392c('0xb'),attributes,{'tableName':_0x392c('0xc'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/contactItemType/contactItemType.rpc.js b/server/api/contactItemType/contactItemType.rpc.js index d420528..afc7ef6 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 _0xd0dc=['then','ContactItemType,\x20%s,\x20%s','request\x20sent','debug','ContactItemType,\x20%s,\x20%s,\x20%s','stringify','error','code','message','info','result','catch','lodash','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','client'];(function(_0x4143d9,_0x245b52){var _0x145e19=function(_0x263123){while(--_0x263123){_0x4143d9['push'](_0x4143d9['shift']());}};_0x145e19(++_0x245b52);}(_0xd0dc,0x1c1));var _0xcd0d=function(_0x3c7ae2,_0x5504e3){_0x3c7ae2=_0x3c7ae2-0x0;var _0x39f0d7=_0xd0dc[_0x3c7ae2];return _0x39f0d7;};'use strict';var _=require(_0xcd0d('0x0'));var util=require('util');var moment=require('moment');var BPromise=require(_0xcd0d('0x1'));var rs=require(_0xcd0d('0x2'));var fs=require('fs');var Redis=require(_0xcd0d('0x3'));var db=require(_0xcd0d('0x4'))['db'];var utils=require(_0xcd0d('0x5'));var logger=require(_0xcd0d('0x6'))(_0xcd0d('0x7'));var config=require(_0xcd0d('0x8'));var jayson=require(_0xcd0d('0x9'));var client=jayson[_0xcd0d('0xa')]['http']({'port':0x232a});function respondWithRpcPromise(_0x1c8d0b,_0x1d2d13,_0x39e123){return new BPromise(function(_0x2dde7f,_0x53494f){return client['request'](_0x1c8d0b,_0x39e123)[_0xcd0d('0xb')](function(_0x4f12b8){logger['info'](_0xcd0d('0xc'),_0x1d2d13,_0xcd0d('0xd'));logger[_0xcd0d('0xe')](_0xcd0d('0xf'),_0x1d2d13,_0xcd0d('0xd'),JSON[_0xcd0d('0x10')](_0x4f12b8));if(_0x4f12b8[_0xcd0d('0x11')]){if(_0x4f12b8['error'][_0xcd0d('0x12')]===0x1f4){logger[_0xcd0d('0x11')]('ContactItemType,\x20%s,\x20%s',_0x1d2d13,_0x4f12b8['error'][_0xcd0d('0x13')]);return _0x53494f(_0x4f12b8[_0xcd0d('0x11')][_0xcd0d('0x13')]);}logger[_0xcd0d('0x11')](_0xcd0d('0xc'),_0x1d2d13,_0x4f12b8[_0xcd0d('0x11')][_0xcd0d('0x13')]);return _0x2dde7f(_0x4f12b8[_0xcd0d('0x11')][_0xcd0d('0x13')]);}else{logger[_0xcd0d('0x14')](_0xcd0d('0xc'),_0x1d2d13,_0xcd0d('0xd'));_0x2dde7f(_0x4f12b8[_0xcd0d('0x15')][_0xcd0d('0x13')]);}})[_0xcd0d('0x16')](function(_0x3a9749){logger[_0xcd0d('0x11')](_0xcd0d('0xc'),_0x1d2d13,_0x3a9749);_0x53494f(_0x3a9749);});});} \ No newline at end of file +var _0x7c51=['catch','lodash','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','rpc','../../config/environment','client','http','request','then','info','ContactItemType,\x20%s,\x20%s','debug','stringify','error','code','message','request\x20sent','result'];(function(_0x91ff52,_0x2cde3c){var _0x37d193=function(_0x5cb450){while(--_0x5cb450){_0x91ff52['push'](_0x91ff52['shift']());}};_0x37d193(++_0x2cde3c);}(_0x7c51,0x74));var _0x17c5=function(_0x24bfec,_0x54a7fc){_0x24bfec=_0x24bfec-0x0;var _0x17d9e9=_0x7c51[_0x24bfec];return _0x17d9e9;};'use strict';var _=require(_0x17c5('0x0'));var util=require('util');var moment=require(_0x17c5('0x1'));var BPromise=require(_0x17c5('0x2'));var rs=require(_0x17c5('0x3'));var fs=require('fs');var Redis=require(_0x17c5('0x4'));var db=require(_0x17c5('0x5'))['db'];var utils=require(_0x17c5('0x6'));var logger=require('../../config/logger')(_0x17c5('0x7'));var config=require(_0x17c5('0x8'));var jayson=require('jayson/promise');var client=jayson[_0x17c5('0x9')][_0x17c5('0xa')]({'port':0x232a});function respondWithRpcPromise(_0x3d3d0e,_0x4a2155,_0x225501){return new BPromise(function(_0x30f3a5,_0x168af6){return client[_0x17c5('0xb')](_0x3d3d0e,_0x225501)[_0x17c5('0xc')](function(_0x509659){logger[_0x17c5('0xd')](_0x17c5('0xe'),_0x4a2155,'request\x20sent');logger[_0x17c5('0xf')]('ContactItemType,\x20%s,\x20%s,\x20%s',_0x4a2155,'request\x20sent',JSON[_0x17c5('0x10')](_0x509659));if(_0x509659[_0x17c5('0x11')]){if(_0x509659[_0x17c5('0x11')][_0x17c5('0x12')]===0x1f4){logger[_0x17c5('0x11')](_0x17c5('0xe'),_0x4a2155,_0x509659[_0x17c5('0x11')][_0x17c5('0x13')]);return _0x168af6(_0x509659['error'][_0x17c5('0x13')]);}logger[_0x17c5('0x11')](_0x17c5('0xe'),_0x4a2155,_0x509659[_0x17c5('0x11')][_0x17c5('0x13')]);return _0x30f3a5(_0x509659['error'][_0x17c5('0x13')]);}else{logger[_0x17c5('0xd')](_0x17c5('0xe'),_0x4a2155,_0x17c5('0x14'));_0x30f3a5(_0x509659[_0x17c5('0x15')][_0x17c5('0x13')]);}})[_0x17c5('0x16')](function(_0x178ede){logger[_0x17c5('0x11')](_0x17c5('0xe'),_0x4a2155,_0x178ede);_0x168af6(_0x178ede);});});} \ No newline at end of file diff --git a/server/api/contactItemType/index.js b/server/api/contactItemType/index.js index 8ee0918..0e21cc3 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 _0x33af=['delete','destroy','multer','util','path','connect-timeout','express','Router','fs-extra','../../config/environment','./contactItemType.controller','get','isAuthenticated','index','show','post','put','/:id','update'];(function(_0x30ae5e,_0x391fc4){var _0x1f2e93=function(_0x60307d){while(--_0x60307d){_0x30ae5e['push'](_0x30ae5e['shift']());}};_0x1f2e93(++_0x391fc4);}(_0x33af,0x74));var _0xf33a=function(_0x4e3ee6,_0x1cac16){_0x4e3ee6=_0x4e3ee6-0x0;var _0x3a1887=_0x33af[_0x4e3ee6];return _0x3a1887;};'use strict';var multer=require(_0xf33a('0x0'));var util=require(_0xf33a('0x1'));var path=require(_0xf33a('0x2'));var timeout=require(_0xf33a('0x3'));var express=require(_0xf33a('0x4'));var router=express[_0xf33a('0x5')]();var fs_extra=require(_0xf33a('0x6'));var auth=require('../../components/auth/service');var interaction=require('../../components/interaction/service');var config=require(_0xf33a('0x7'));var controller=require(_0xf33a('0x8'));router[_0xf33a('0x9')]('/',auth[_0xf33a('0xa')](),controller[_0xf33a('0xb')]);router['get']('/:id',auth['isAuthenticated'](),controller[_0xf33a('0xc')]);router[_0xf33a('0xd')]('/',auth[_0xf33a('0xa')](),controller['create']);router[_0xf33a('0xe')](_0xf33a('0xf'),auth[_0xf33a('0xa')](),controller[_0xf33a('0x10')]);router[_0xf33a('0x11')](_0xf33a('0xf'),auth['isAuthenticated'](),controller[_0xf33a('0x12')]);module['exports']=router; \ No newline at end of file +var _0xa37f=['get','isAuthenticated','index','/:id','show','post','create','put','update','delete','destroy','exports','multer','util','path','connect-timeout','express','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','./contactItemType.controller'];(function(_0x15c420,_0x1a8ef1){var _0x23f862=function(_0x44f4a2){while(--_0x44f4a2){_0x15c420['push'](_0x15c420['shift']());}};_0x23f862(++_0x1a8ef1);}(_0xa37f,0xbc));var _0xfa37=function(_0x321bb2,_0x202794){_0x321bb2=_0x321bb2-0x0;var _0x9c12ed=_0xa37f[_0x321bb2];return _0x9c12ed;};'use strict';var multer=require(_0xfa37('0x0'));var util=require(_0xfa37('0x1'));var path=require(_0xfa37('0x2'));var timeout=require(_0xfa37('0x3'));var express=require(_0xfa37('0x4'));var router=express['Router']();var fs_extra=require(_0xfa37('0x5'));var auth=require(_0xfa37('0x6'));var interaction=require(_0xfa37('0x7'));var config=require(_0xfa37('0x8'));var controller=require(_0xfa37('0x9'));router[_0xfa37('0xa')]('/',auth[_0xfa37('0xb')](),controller[_0xfa37('0xc')]);router[_0xfa37('0xa')](_0xfa37('0xd'),auth[_0xfa37('0xb')](),controller[_0xfa37('0xe')]);router[_0xfa37('0xf')]('/',auth['isAuthenticated'](),controller[_0xfa37('0x10')]);router[_0xfa37('0x11')](_0xfa37('0xd'),auth[_0xfa37('0xb')](),controller[_0xfa37('0x12')]);router[_0xfa37('0x13')](_0xfa37('0xd'),auth[_0xfa37('0xb')](),controller[_0xfa37('0x14')]);module[_0xfa37('0x15')]=router; \ No newline at end of file diff --git a/server/api/dashboard/dashboard.attributes.js b/server/api/dashboard/dashboard.attributes.js index a505355..aa7492b 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(_0x18827e,_0x3761d8){var _0x8c9480=function(_0x5875db){while(--_0x5875db){_0x18827e['push'](_0x18827e['shift']());}};_0x8c9480(++_0x3761d8);}(_0x757a,0xde));var _0xa757=function(_0x30156b,_0x55dc18){_0x30156b=_0x30156b-0x0;var _0xbcf99d=_0x757a[_0x30156b];return _0xbcf99d;};'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 _0xd8b0=['exports','sequelize'];(function(_0x21e2e0,_0x5eae09){var _0x148220=function(_0x201afc){while(--_0x201afc){_0x21e2e0['push'](_0x21e2e0['shift']());}};_0x148220(++_0x5eae09);}(_0xd8b0,0xad));var _0x0d8b=function(_0x20a584,_0xe384a5){_0x20a584=_0x20a584-0x0;var _0x4b41a8=_0xd8b0[_0x20a584];return _0x4b41a8;};'use strict';var Sequelize=require(_0x0d8b('0x0'));module[_0x0d8b('0x1')]={'name':{'type':Sequelize['STRING'],'allowNull':![],'unique':'name'},'description':{'type':Sequelize['STRING']}}; \ No newline at end of file diff --git a/server/api/dashboard/dashboard.controller.js b/server/api/dashboard/dashboard.controller.js index cf64113..137fb5e 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 _0x7c71=['value','https://','custom','attrPath','clock','attrHourFormat','attrTimezone','0.00','attrFontSize','counter','attrMetric','total','attrVoiceQueues','voice','attrEmailAccounts','attrFaxAccounts','attrSmsAccounts','attrOpenchannelAccounts','attrWhatsappAccounts','attrChatWebsites','multibar-chart','pie-chart','attrSerie1','attrSerie2','attrSerie3','attrChannel','web-report','attrReport','reportType','attrRefresh','widgetAttributes:\x20%s','addItem','DashboardItem','getItems','findOne','pick','nolimit','zip-dir','fast-json-patch','request-promise','moment','bluebird','mustache','util','sox','to-csv','ejs','lodash','crypto','jsforce','querystring','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/environment','../../config/license/util','redis','defaults','localhost','./dashboard.socket','sendStatus','status','end','json','undefined','limit','offset','count','set','Content-Range','apply','reject','update','then','get','CustomDashboards','destroy','error','stack','map','Dashboard','rawAttributes','fieldName','type','key','model','query','keys','filters','attributes','intersection','fields','length','hasOwnProperty','order','sort','where','filter','VIRTUAL','name','merge','options','includeAll','include','rows','catch','find','create','body','user','Unable\x20to\x20retrieve\x20the\x20current\x20user','role','UserProfileSection','autoAssociation','UserProfileResource','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','clone','params','omit','createdAt','updatedAt','userProfileId','iframe','attrUrl','attrs'];(function(_0x1ff499,_0x2fe388){var _0x5219b8=function(_0x1079b3){while(--_0x1079b3){_0x1ff499['push'](_0x1ff499['shift']());}};_0x5219b8(++_0x2fe388);}(_0x7c71,0x1a8));var _0x17c7=function(_0x166d93,_0x301f09){_0x166d93=_0x166d93-0x0;var _0xba708=_0x7c71[_0x166d93];return _0xba708;};'use strict';var emlformat=require('eml-format');var rimraf=require('rimraf');var zipdir=require(_0x17c7('0x0'));var jsonpatch=require(_0x17c7('0x1'));var rp=require(_0x17c7('0x2'));var moment=require(_0x17c7('0x3'));var BPromise=require(_0x17c7('0x4'));var Mustache=require(_0x17c7('0x5'));var util=require(_0x17c7('0x6'));var path=require('path');var sox=require(_0x17c7('0x7'));var csv=require(_0x17c7('0x8'));var ejs=require(_0x17c7('0x9'));var fs=require('fs');var fs_extra=require('fs-extra');var _=require(_0x17c7('0xa'));var squel=require('squel');var crypto=require(_0x17c7('0xb'));var jsforce=require(_0x17c7('0xc'));var deskjs=require('desk.js');var toCsv=require('to-csv');var querystring=require(_0x17c7('0xd'));var Papa=require('papaparse');var Redis=require(_0x17c7('0xe'));var authService=require(_0x17c7('0xf'));var qs=require(_0x17c7('0x10'));var as=require(_0x17c7('0x11'));var hardwareService=require(_0x17c7('0x12'));var logger=require(_0x17c7('0x13'))(_0x17c7('0x14'));var utils=require('../../config/utils');var config=require(_0x17c7('0x15'));var licenseUtil=require(_0x17c7('0x16'));var db=require('../../mysqldb')['db'];config[_0x17c7('0x17')]=_[_0x17c7('0x18')](config['redis'],{'host':_0x17c7('0x19'),'port':0x18eb});var socket=require('socket.io-emitter')(new Redis(config[_0x17c7('0x17')]));require(_0x17c7('0x1a'))['register'](socket);function respondWithStatusCode(_0x14c215,_0x2c337a){_0x2c337a=_0x2c337a||0xcc;return function(_0x4d24eb){if(_0x4d24eb){return _0x14c215[_0x17c7('0x1b')](_0x2c337a);}return _0x14c215[_0x17c7('0x1c')](_0x2c337a)[_0x17c7('0x1d')]();};}function respondWithResult(_0x3b4ad3,_0xffee06){_0xffee06=_0xffee06||0xc8;return function(_0x3b078f){if(_0x3b078f){return _0x3b4ad3['status'](_0xffee06)[_0x17c7('0x1e')](_0x3b078f);}};}function respondWithFilteredResult(_0x48476d,_0x5c883d){return function(_0x4b76f8){if(_0x4b76f8){var _0x9b9003=typeof _0x5c883d['offset']===_0x17c7('0x1f')&&typeof _0x5c883d[_0x17c7('0x20')]==='undefined';var _0x2bce26=_0x4b76f8['count'];var _0x2654a1=_0x9b9003?0x0:_0x5c883d[_0x17c7('0x21')];var _0x4ee421=_0x9b9003?_0x4b76f8[_0x17c7('0x22')]:_0x5c883d[_0x17c7('0x21')]+_0x5c883d[_0x17c7('0x20')];var _0x17f7c0;if(_0x4ee421>=_0x2bce26){_0x4ee421=_0x2bce26;_0x17f7c0=0xc8;}else{_0x17f7c0=0xce;}_0x48476d['status'](_0x17f7c0);return _0x48476d[_0x17c7('0x23')](_0x17c7('0x24'),_0x2654a1+'-'+_0x4ee421+'/'+_0x2bce26)[_0x17c7('0x1e')](_0x4b76f8);}return null;};}function patchUpdates(_0x1e6cc5){return function(_0x52098b){try{jsonpatch[_0x17c7('0x25')](_0x52098b,_0x1e6cc5,!![]);}catch(_0x2918cd){return BPromise[_0x17c7('0x26')](_0x2918cd);}return _0x52098b['save']();};}function saveUpdates(_0x1e4e46,_0xfa3d69){return function(_0x1a274e){if(_0x1a274e){return _0x1a274e[_0x17c7('0x27')](_0x1e4e46)['then'](function(_0x5a4283){return _0x5a4283;});}return null;};}function removeEntity(_0x4c20bd,_0x2a9e9c){return function(_0x15663f){if(_0x15663f){return _0x15663f['destroy']()[_0x17c7('0x28')](function(){var _0x25dce3=_0x15663f[_0x17c7('0x29')]({'plain':!![]});var _0x29d083=_0x17c7('0x2a');return db['UserProfileResource'][_0x17c7('0x2b')]({'where':{'type':_0x29d083,'resourceId':_0x25dce3['id']}})['then'](function(){return _0x15663f;});})[_0x17c7('0x28')](function(){_0x4c20bd[_0x17c7('0x1c')](0xcc)['end']();});}};}function handleEntityNotFound(_0x285fbe,_0x1ebfc1){return function(_0x312a4f){if(!_0x312a4f){_0x285fbe[_0x17c7('0x1b')](0x194);}return _0x312a4f;};}function handleError(_0x220adc,_0x34135c){_0x34135c=_0x34135c||0x1f4;return function(_0x456e13){logger[_0x17c7('0x2c')](_0x456e13[_0x17c7('0x2d')]);if(_0x456e13['name']){delete _0x456e13['name'];}_0x220adc[_0x17c7('0x1c')](_0x34135c)['send'](_0x456e13);};}exports['index']=function(_0x16377d,_0xa49ac4){var _0x4e393d={},_0x55687a={},_0x385ed6={'count':0x0,'rows':[]};var _0x4169bf=_[_0x17c7('0x2e')](db[_0x17c7('0x2f')][_0x17c7('0x30')],function(_0x1834f7){return{'name':_0x1834f7[_0x17c7('0x31')],'type':_0x1834f7[_0x17c7('0x32')][_0x17c7('0x33')]};});_0x55687a[_0x17c7('0x34')]=_[_0x17c7('0x2e')](_0x4169bf,'name');_0x55687a[_0x17c7('0x35')]=_[_0x17c7('0x36')](_0x16377d[_0x17c7('0x35')]);_0x55687a[_0x17c7('0x37')]=_['intersection'](_0x55687a[_0x17c7('0x34')],_0x55687a[_0x17c7('0x35')]);_0x4e393d[_0x17c7('0x38')]=_[_0x17c7('0x39')](_0x55687a[_0x17c7('0x34')],qs[_0x17c7('0x3a')](_0x16377d[_0x17c7('0x35')]['fields']));_0x4e393d[_0x17c7('0x38')]=_0x4e393d[_0x17c7('0x38')][_0x17c7('0x3b')]?_0x4e393d[_0x17c7('0x38')]:_0x55687a[_0x17c7('0x34')];if(!_0x16377d[_0x17c7('0x35')][_0x17c7('0x3c')]('nolimit')){_0x4e393d['limit']=qs['limit'](_0x16377d['query'][_0x17c7('0x20')]);_0x4e393d[_0x17c7('0x21')]=qs[_0x17c7('0x21')](_0x16377d['query'][_0x17c7('0x21')]);}_0x4e393d[_0x17c7('0x3d')]=qs[_0x17c7('0x3e')](_0x16377d[_0x17c7('0x35')][_0x17c7('0x3e')]);_0x4e393d[_0x17c7('0x3f')]=qs[_0x17c7('0x37')](_['pick'](_0x16377d[_0x17c7('0x35')],_0x55687a[_0x17c7('0x37')]),_0x4169bf);if(_0x16377d[_0x17c7('0x35')][_0x17c7('0x40')]){_0x4e393d[_0x17c7('0x3f')]=_['merge'](_0x4e393d[_0x17c7('0x3f')],{'$or':_[_0x17c7('0x2e')](_0x4169bf,function(_0x20cafc){if(_0x20cafc['type']!==_0x17c7('0x41')){var _0x599efa={};_0x599efa[_0x20cafc[_0x17c7('0x42')]]={'$like':'%'+_0x16377d[_0x17c7('0x35')][_0x17c7('0x40')]+'%'};return _0x599efa;}})});}_0x4e393d=_[_0x17c7('0x43')]({},_0x4e393d,_0x16377d[_0x17c7('0x44')]);var _0x16266e={'where':_0x4e393d[_0x17c7('0x3f')]};return db[_0x17c7('0x2f')][_0x17c7('0x22')](_0x16266e)[_0x17c7('0x28')](function(_0x6c8ba0){_0x385ed6[_0x17c7('0x22')]=_0x6c8ba0;if(_0x16377d[_0x17c7('0x35')][_0x17c7('0x45')]){_0x4e393d[_0x17c7('0x46')]=[{'all':!![]}];}return db['Dashboard']['findAll'](_0x4e393d);})[_0x17c7('0x28')](function(_0x2d58a8){_0x385ed6[_0x17c7('0x47')]=_0x2d58a8;return _0x385ed6;})[_0x17c7('0x28')](respondWithFilteredResult(_0xa49ac4,_0x4e393d))[_0x17c7('0x48')](handleError(_0xa49ac4,null));};exports['show']=function(_0x4af398,_0x45fab5){var _0x2e8da1={'raw':![],'where':{'id':_0x4af398['params']['id']}},_0x2ec82c={};_0x2ec82c['model']=_[_0x17c7('0x36')](db[_0x17c7('0x2f')][_0x17c7('0x30')]);_0x2ec82c[_0x17c7('0x35')]=_[_0x17c7('0x36')](_0x4af398[_0x17c7('0x35')]);_0x2ec82c[_0x17c7('0x37')]=_[_0x17c7('0x39')](_0x2ec82c['model'],_0x2ec82c['query']);_0x2e8da1[_0x17c7('0x38')]=_[_0x17c7('0x39')](_0x2ec82c[_0x17c7('0x34')],qs['fields'](_0x4af398['query']['fields']));_0x2e8da1['attributes']=_0x2e8da1[_0x17c7('0x38')][_0x17c7('0x3b')]?_0x2e8da1[_0x17c7('0x38')]:_0x2ec82c[_0x17c7('0x34')];if(_0x4af398[_0x17c7('0x35')][_0x17c7('0x45')]){_0x2e8da1[_0x17c7('0x46')]=[{'all':!![]}];}_0x2e8da1=_['merge']({},_0x2e8da1,_0x4af398['options']);return db[_0x17c7('0x2f')][_0x17c7('0x49')](_0x2e8da1)['then'](handleEntityNotFound(_0x45fab5,null))[_0x17c7('0x28')](respondWithResult(_0x45fab5,null))[_0x17c7('0x48')](handleError(_0x45fab5,null));};exports[_0x17c7('0x4a')]=function(_0x4f32a3,_0x4639b2){return db[_0x17c7('0x2f')]['create'](_0x4f32a3[_0x17c7('0x4b')],{})[_0x17c7('0x28')](function(_0x430804){var _0x55b415=_0x4f32a3[_0x17c7('0x4c')][_0x17c7('0x29')]({'plain':!![]});if(!_0x55b415)throw new Error(_0x17c7('0x4d'));if(_0x55b415[_0x17c7('0x4e')]===_0x17c7('0x4c')){var _0x169d1e=_0x430804[_0x17c7('0x29')]({'plain':!![]});var _0x2976b4=_0x17c7('0x2a');return db[_0x17c7('0x4f')][_0x17c7('0x49')]({'where':{'name':_0x2976b4,'userProfileId':_0x55b415['userProfileId']},'raw':!![]})[_0x17c7('0x28')](function(_0x430ddc){if(_0x430ddc&&_0x430ddc[_0x17c7('0x50')]===0x0){return db[_0x17c7('0x51')][_0x17c7('0x4a')]({'name':_0x169d1e['name'],'resourceId':_0x169d1e['id'],'type':_0x430ddc['name'],'sectionId':_0x430ddc['id']},{})[_0x17c7('0x28')](function(){return _0x430804;});}else{return _0x430804;}})[_0x17c7('0x48')](function(_0x5b380f){logger['error'](_0x17c7('0x52'),_0x5b380f);throw _0x5b380f;});}return _0x430804;})[_0x17c7('0x28')](respondWithResult(_0x4639b2,0xc9))[_0x17c7('0x48')](handleError(_0x4639b2,null));};exports[_0x17c7('0x53')]=function(_0x49369f,_0x1af5b5){var _0x39ef6a={'where':{'id':_0x49369f[_0x17c7('0x54')]['id']}},_0x3e5194={};_0x3e5194[_0x17c7('0x34')]=_[_0x17c7('0x36')](db[_0x17c7('0x2f')][_0x17c7('0x30')]);_0x39ef6a['attributes']=_[_0x17c7('0x39')](_0x3e5194['model'],qs[_0x17c7('0x3a')](_0x49369f[_0x17c7('0x35')][_0x17c7('0x3a')]));_0x39ef6a[_0x17c7('0x38')]=_0x39ef6a[_0x17c7('0x38')][_0x17c7('0x3b')]?_0x39ef6a[_0x17c7('0x38')]:_0x3e5194['model'];if(_0x49369f['query'][_0x17c7('0x45')]){_0x39ef6a[_0x17c7('0x46')]=[{'all':!![]}];}_0x39ef6a=_[_0x17c7('0x43')]({},_0x39ef6a,_0x49369f['options']);return db[_0x17c7('0x2f')][_0x17c7('0x49')](_0x39ef6a)[_0x17c7('0x28')](handleEntityNotFound(_0x1af5b5,null))[_0x17c7('0x28')](function(_0x2b167e){if(_0x2b167e){var _0x2386fa=_0x2b167e[_0x17c7('0x29')]({'plain':!![]});_0x2386fa=qs[_0x17c7('0x55')](_0x2386fa,['id',_0x17c7('0x56'),_0x17c7('0x57')]);_0x49369f[_0x17c7('0x4b')]=_[_0x17c7('0x55')](_0x49369f[_0x17c7('0x4b')],['id','createdAt','updatedAt']);return db[_0x17c7('0x2f')][_0x17c7('0x4a')](_[_0x17c7('0x43')](_0x2386fa,_0x49369f[_0x17c7('0x4b')]),{'include':_0x49369f[_0x17c7('0x35')][_0x17c7('0x45')]?[{'all':!![]}]:undefined})[_0x17c7('0x28')](function(_0x548860){var _0x2cfdd1=_0x49369f[_0x17c7('0x4c')][_0x17c7('0x29')]({'plain':!![]});if(!_0x2cfdd1)throw new Error(_0x17c7('0x4d'));if(_0x2cfdd1[_0x17c7('0x4e')]==='user'){var _0x3dd1e1=_0x548860[_0x17c7('0x29')]({'plain':!![]});var _0x1b87e7=_0x17c7('0x2a');return db[_0x17c7('0x4f')]['find']({'where':{'name':_0x1b87e7,'userProfileId':_0x2cfdd1[_0x17c7('0x58')]},'raw':!![]})[_0x17c7('0x28')](function(_0x49faf8){if(_0x49faf8&&_0x49faf8[_0x17c7('0x50')]===0x0){return db['UserProfileResource']['create']({'name':_0x3dd1e1[_0x17c7('0x42')],'resourceId':_0x3dd1e1['id'],'type':_0x49faf8[_0x17c7('0x42')],'sectionId':_0x49faf8['id']},{})['then'](function(){return _0x548860;});}else{return _0x548860;}})[_0x17c7('0x48')](function(_0x4d5924){logger[_0x17c7('0x2c')](_0x17c7('0x52'),_0x4d5924);throw _0x4d5924;});}return _0x548860;});}})['then'](respondWithResult(_0x1af5b5,0xc9))[_0x17c7('0x48')](handleError(_0x1af5b5,null));};exports[_0x17c7('0x27')]=function(_0x26f43e,_0x24a6ca){if(_0x26f43e[_0x17c7('0x4b')]['id']){delete _0x26f43e[_0x17c7('0x4b')]['id'];}return db[_0x17c7('0x2f')][_0x17c7('0x49')]({'where':{'id':_0x26f43e[_0x17c7('0x54')]['id']}})['then'](handleEntityNotFound(_0x24a6ca,null))[_0x17c7('0x28')](saveUpdates(_0x26f43e[_0x17c7('0x4b')],null))[_0x17c7('0x28')](respondWithResult(_0x24a6ca,null))[_0x17c7('0x48')](handleError(_0x24a6ca,null));};exports[_0x17c7('0x2b')]=function(_0x16922a,_0x340292){return db[_0x17c7('0x2f')][_0x17c7('0x49')]({'where':{'id':_0x16922a[_0x17c7('0x54')]['id']}})[_0x17c7('0x28')](handleEntityNotFound(_0x340292,null))[_0x17c7('0x28')](removeEntity(_0x340292,null))[_0x17c7('0x48')](handleError(_0x340292,null));};function widgetAttributes(_0x5e9d2b){try{switch(_0x5e9d2b[_0x17c7('0x32')]){case _0x17c7('0x59'):return[{'name':_0x17c7('0x5a'),'value':_0x5e9d2b[_0x17c7('0x5a')]||(_0x5e9d2b[_0x17c7('0x5b')]&&_0x5e9d2b['attrs'][0x0]?_0x5e9d2b[_0x17c7('0x5b')][0x0][_0x17c7('0x5c')]:undefined)||_0x17c7('0x5d')}];case _0x17c7('0x5e'):return[{'name':'attrPath','value':_0x5e9d2b[_0x17c7('0x5f')]||(_0x5e9d2b[_0x17c7('0x5b')]&&_0x5e9d2b[_0x17c7('0x5b')][0x0]?_0x5e9d2b[_0x17c7('0x5b')][0x0][_0x17c7('0x5c')]:undefined)||''}];case _0x17c7('0x60'):return[{'name':'attrHourFormat','value':_0x5e9d2b[_0x17c7('0x61')]||(_0x5e9d2b[_0x17c7('0x5b')]&&_0x5e9d2b[_0x17c7('0x5b')][0x0]?_0x5e9d2b[_0x17c7('0x5b')][0x0][_0x17c7('0x5c')]:undefined)||'HH:mm:ss'},{'name':_0x17c7('0x62'),'value':_0x5e9d2b[_0x17c7('0x62')]||(_0x5e9d2b['attrs']&&_0x5e9d2b[_0x17c7('0x5b')][0x1]?_0x5e9d2b[_0x17c7('0x5b')][0x1][_0x17c7('0x5c')]:undefined)||_0x17c7('0x63')},{'name':_0x17c7('0x64'),'value':_0x5e9d2b[_0x17c7('0x64')]||(_0x5e9d2b['attrs']&&_0x5e9d2b[_0x17c7('0x5b')][0x2]?_0x5e9d2b['attrs'][0x2][_0x17c7('0x5c')]:undefined)||0xc}];case _0x17c7('0x65'):return[{'name':_0x17c7('0x66'),'value':_0x5e9d2b[_0x17c7('0x66')]||(_0x5e9d2b['attrs']&&_0x5e9d2b[_0x17c7('0x5b')][0x0]?_0x5e9d2b[_0x17c7('0x5b')][0x0][_0x17c7('0x5c')]:undefined)||_0x17c7('0x67')},{'name':'attrVoiceQueues','value':_0x5e9d2b[_0x17c7('0x68')]||(_0x5e9d2b[_0x17c7('0x5b')]&&_0x5e9d2b[_0x17c7('0x5b')][0x1]?_0x5e9d2b[_0x17c7('0x5b')][0x1]['value']:undefined)||[]},{'name':_0x17c7('0x64'),'value':_0x5e9d2b[_0x17c7('0x64')]||(_0x5e9d2b['attrs']&&_0x5e9d2b[_0x17c7('0x5b')][0x2]?_0x5e9d2b[_0x17c7('0x5b')][0x2][_0x17c7('0x5c')]:undefined)||0x14},{'name':'attrChannel','value':_0x5e9d2b['attrChannel']||(_0x5e9d2b[_0x17c7('0x5b')]&&_0x5e9d2b['attrs'][0x3]?_0x5e9d2b['attrs'][0x3][_0x17c7('0x5c')]:undefined)||_0x17c7('0x69')},{'name':_0x17c7('0x6a'),'value':_0x5e9d2b[_0x17c7('0x6a')]||(_0x5e9d2b[_0x17c7('0x5b')]&&_0x5e9d2b[_0x17c7('0x5b')][0x4]?_0x5e9d2b[_0x17c7('0x5b')][0x4]['value']:undefined)||''},{'name':_0x17c7('0x6b'),'value':_0x5e9d2b['attrFaxAccounts']||(_0x5e9d2b[_0x17c7('0x5b')]&&_0x5e9d2b['attrs'][0x5]?_0x5e9d2b[_0x17c7('0x5b')][0x5][_0x17c7('0x5c')]:undefined)||''},{'name':_0x17c7('0x6c'),'value':_0x5e9d2b[_0x17c7('0x6c')]||(_0x5e9d2b['attrs']&&_0x5e9d2b[_0x17c7('0x5b')][0x6]?_0x5e9d2b[_0x17c7('0x5b')][0x6][_0x17c7('0x5c')]:undefined)||''},{'name':_0x17c7('0x6d'),'value':_0x5e9d2b[_0x17c7('0x6d')]||(_0x5e9d2b[_0x17c7('0x5b')]&&_0x5e9d2b[_0x17c7('0x5b')][0x7]?_0x5e9d2b[_0x17c7('0x5b')][0x7][_0x17c7('0x5c')]:undefined)||''},{'name':'attrWhatsappAccounts','value':_0x5e9d2b[_0x17c7('0x6e')]||(_0x5e9d2b[_0x17c7('0x5b')]&&_0x5e9d2b[_0x17c7('0x5b')][0x8]?_0x5e9d2b[_0x17c7('0x5b')][0x8][_0x17c7('0x5c')]:undefined)||''},{'name':_0x17c7('0x6f'),'value':_0x5e9d2b['attrChatWebsites']||(_0x5e9d2b[_0x17c7('0x5b')]&&_0x5e9d2b[_0x17c7('0x5b')][0x9]?_0x5e9d2b[_0x17c7('0x5b')][0x9][_0x17c7('0x5c')]:undefined)||''}];case _0x17c7('0x70'):case _0x17c7('0x71'):return[{'name':_0x17c7('0x72'),'value':_0x5e9d2b['attrSerie1']||(_0x5e9d2b['attrs']&&_0x5e9d2b[_0x17c7('0x5b')][0x0]?_0x5e9d2b[_0x17c7('0x5b')][0x0]['value']:undefined)||'total'},{'name':_0x17c7('0x73'),'value':_0x5e9d2b['attrSerie2']||(_0x5e9d2b[_0x17c7('0x5b')]&&_0x5e9d2b['attrs'][0x1]?_0x5e9d2b[_0x17c7('0x5b')][0x1][_0x17c7('0x5c')]:undefined)||null},{'name':_0x17c7('0x74'),'value':_0x5e9d2b[_0x17c7('0x74')]||(_0x5e9d2b[_0x17c7('0x5b')]&&_0x5e9d2b[_0x17c7('0x5b')][0x2]?_0x5e9d2b[_0x17c7('0x5b')][0x2]['value']:undefined)||null},{'name':_0x17c7('0x68'),'value':_0x5e9d2b['attrVoiceQueues']||(_0x5e9d2b['attrs']&&_0x5e9d2b[_0x17c7('0x5b')][0x3]?_0x5e9d2b[_0x17c7('0x5b')][0x3][_0x17c7('0x5c')]:undefined)||[]},{'name':_0x17c7('0x75'),'value':_0x5e9d2b[_0x17c7('0x75')]||(_0x5e9d2b[_0x17c7('0x5b')]&&_0x5e9d2b[_0x17c7('0x5b')][0x4]?_0x5e9d2b['attrs'][0x4][_0x17c7('0x5c')]:undefined)||'voice'},{'name':_0x17c7('0x6a'),'value':_0x5e9d2b[_0x17c7('0x6a')]||(_0x5e9d2b['attrs']&&_0x5e9d2b[_0x17c7('0x5b')][0x5]?_0x5e9d2b[_0x17c7('0x5b')][0x5][_0x17c7('0x5c')]:undefined)||''},{'name':_0x17c7('0x6b'),'value':_0x5e9d2b[_0x17c7('0x6b')]||(_0x5e9d2b['attrs']&&_0x5e9d2b[_0x17c7('0x5b')][0x6]?_0x5e9d2b['attrs'][0x6][_0x17c7('0x5c')]:undefined)||''},{'name':_0x17c7('0x6c'),'value':_0x5e9d2b[_0x17c7('0x6c')]||(_0x5e9d2b['attrs']&&_0x5e9d2b['attrs'][0x7]?_0x5e9d2b[_0x17c7('0x5b')][0x7][_0x17c7('0x5c')]:undefined)||''},{'name':'attrOpenchannelAccounts','value':_0x5e9d2b['attrOpenchannelAccounts']||(_0x5e9d2b[_0x17c7('0x5b')]&&_0x5e9d2b[_0x17c7('0x5b')][0x8]?_0x5e9d2b[_0x17c7('0x5b')][0x8][_0x17c7('0x5c')]:undefined)||''},{'name':'attrWhatsappAccounts','value':_0x5e9d2b[_0x17c7('0x6e')]||(_0x5e9d2b['attrs']&&_0x5e9d2b[_0x17c7('0x5b')][0x9]?_0x5e9d2b['attrs'][0x9]['value']:undefined)||''},{'name':_0x17c7('0x6f'),'value':_0x5e9d2b[_0x17c7('0x6f')]||(_0x5e9d2b['attrs']&&_0x5e9d2b[_0x17c7('0x5b')][0xa]?_0x5e9d2b[_0x17c7('0x5b')][0xa][_0x17c7('0x5c')]:undefined)||''}];case _0x17c7('0x76'):return[{'name':_0x17c7('0x77'),'type':_0x5e9d2b[_0x17c7('0x78')]||(_0x5e9d2b[_0x17c7('0x5b')]&&_0x5e9d2b['attrs'][0x0]?_0x5e9d2b[_0x17c7('0x5b')][0x0][_0x17c7('0x32')]:undefined)||null,'value':_0x5e9d2b['attrReport']||(_0x5e9d2b[_0x17c7('0x5b')]&&_0x5e9d2b[_0x17c7('0x5b')][0x0]?_0x5e9d2b['attrs'][0x0][_0x17c7('0x5c')]:undefined)||null},{'name':_0x17c7('0x79'),'value':_0x5e9d2b['attrRefresh']||(_0x5e9d2b[_0x17c7('0x5b')]&&_0x5e9d2b[_0x17c7('0x5b')][0x1]?_0x5e9d2b[_0x17c7('0x5b')][0x1]['value']:undefined)||0x0}];default:return[];}}catch(_0x4a67f5){logger[_0x17c7('0x2c')](_0x17c7('0x7a'),JSON['stringify'](_0x4a67f5));return[];}}exports[_0x17c7('0x7b')]=function(_0x39661e,_0x4061f4,_0x1266c5){if(_0x39661e[_0x17c7('0x4b')]['id']){delete _0x39661e[_0x17c7('0x4b')]['id'];}return db['Dashboard'][_0x17c7('0x49')]({'where':{'id':_0x39661e[_0x17c7('0x54')]['id']}})[_0x17c7('0x28')](handleEntityNotFound(_0x4061f4,null))[_0x17c7('0x28')](function(_0x59fcc7){if(_0x59fcc7){_0x39661e[_0x17c7('0x4b')]['DashboardId']=_0x59fcc7['id'];_0x39661e[_0x17c7('0x4b')][_0x17c7('0x5b')]=widgetAttributes(_0x39661e[_0x17c7('0x4b')]);return db[_0x17c7('0x7c')]['create'](_0x39661e[_0x17c7('0x4b')]);}})[_0x17c7('0x28')](respondWithResult(_0x4061f4,null))['catch'](handleError(_0x4061f4,null));};exports[_0x17c7('0x7d')]=function(_0x1fa40d,_0x42a399,_0x4f2db2){var _0x375ef5={};var _0x14c5ed={};var _0x339092;var _0x1fb37f;return db[_0x17c7('0x2f')][_0x17c7('0x7e')]({'where':{'id':_0x1fa40d['params']['id']}})['then'](handleEntityNotFound(_0x42a399,null))[_0x17c7('0x28')](function(_0x642b60){if(_0x642b60){_0x339092=_0x642b60;_0x14c5ed[_0x17c7('0x34')]=_[_0x17c7('0x36')](db[_0x17c7('0x7c')][_0x17c7('0x30')]);_0x14c5ed[_0x17c7('0x35')]=_['keys'](_0x1fa40d[_0x17c7('0x35')]);_0x14c5ed[_0x17c7('0x37')]=_['intersection'](_0x14c5ed['model'],_0x14c5ed[_0x17c7('0x35')]);_0x375ef5[_0x17c7('0x38')]=_[_0x17c7('0x39')](_0x14c5ed[_0x17c7('0x34')],qs[_0x17c7('0x3a')](_0x1fa40d[_0x17c7('0x35')][_0x17c7('0x3a')]));_0x375ef5[_0x17c7('0x38')]=_0x375ef5[_0x17c7('0x38')][_0x17c7('0x3b')]?_0x375ef5[_0x17c7('0x38')]:_0x14c5ed['model'];_0x375ef5['order']=qs[_0x17c7('0x3e')](_0x1fa40d[_0x17c7('0x35')][_0x17c7('0x3e')]);_0x375ef5[_0x17c7('0x3f')]=qs['filters'](_[_0x17c7('0x7f')](_0x1fa40d[_0x17c7('0x35')],_0x14c5ed[_0x17c7('0x37')]));if(_0x1fa40d['query'][_0x17c7('0x40')]){_0x375ef5[_0x17c7('0x3f')]=_[_0x17c7('0x43')](_0x375ef5['where'],{'$or':_['map'](_0x375ef5[_0x17c7('0x38')],function(_0xb06fda){var _0x11ee3a={};_0x11ee3a[_0xb06fda]={'$like':'%'+_0x1fa40d['query'][_0x17c7('0x40')]+'%'};return _0x11ee3a;})});}_0x375ef5=_[_0x17c7('0x43')]({},_0x375ef5,_0x1fa40d['options']);return _0x339092[_0x17c7('0x7d')](_0x375ef5);}})[_0x17c7('0x28')](function(_0x17623d){if(_0x17623d){_0x1fb37f=_0x17623d[_0x17c7('0x3b')];if(!_0x1fa40d[_0x17c7('0x35')]['hasOwnProperty'](_0x17c7('0x80'))){_0x375ef5[_0x17c7('0x20')]=qs[_0x17c7('0x20')](_0x1fa40d[_0x17c7('0x35')][_0x17c7('0x20')]);_0x375ef5['offset']=qs['offset'](_0x1fa40d[_0x17c7('0x35')][_0x17c7('0x21')]);}return _0x339092[_0x17c7('0x7d')](_0x375ef5);}})[_0x17c7('0x28')](function(_0x3e2f81){if(_0x3e2f81){return _0x3e2f81?{'count':_0x1fb37f,'rows':_0x3e2f81}:null;}})[_0x17c7('0x28')](respondWithResult(_0x42a399,null))[_0x17c7('0x48')](handleError(_0x42a399,null));}; \ No newline at end of file +var _0xddb7=['params','iframe','attrUrl','attrs','value','https://','custom','attrPath','attrHourFormat','HH:mm:ss','attrTimezone','0.00','attrFontSize','attrMetric','total','attrVoiceQueues','attrChannel','voice','attrEmailAccounts','attrSmsAccounts','attrOpenchannelAccounts','attrWhatsappAccounts','attrChatWebsites','multibar-chart','pie-chart','attrSerie1','attrSerie2','attrSerie3','attrFaxAccounts','attrReport','reportType','attrRefresh','stringify','addItem','DashboardId','DashboardItem','findOne','getItems','nolimit','zip-dir','fast-json-patch','request-promise','moment','bluebird','mustache','util','path','sox','ejs','fs-extra','lodash','to-csv','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/environment','../../mysqldb','redis','localhost','socket.io-emitter','register','sendStatus','status','end','offset','undefined','count','set','Content-Range','apply','reject','save','update','then','get','CustomDashboards','UserProfileResource','destroy','error','stack','name','send','map','Dashboard','fieldName','type','key','model','query','keys','filters','attributes','fields','hasOwnProperty','limit','order','sort','where','pick','filter','merge','VIRTUAL','options','includeAll','rows','intersection','length','include','find','catch','create','body','user','Unable\x20to\x20retrieve\x20the\x20current\x20user','role','UserProfileSection','userProfileId','clone','omit','createdAt','updatedAt','autoAssociation'];(function(_0x3c1a86,_0x14b0f7){var _0x4657e7=function(_0x5d66cc){while(--_0x5d66cc){_0x3c1a86['push'](_0x3c1a86['shift']());}};_0x4657e7(++_0x14b0f7);}(_0xddb7,0x129));var _0x7ddb=function(_0x2f3dde,_0x55a14b){_0x2f3dde=_0x2f3dde-0x0;var _0x28ddd6=_0xddb7[_0x2f3dde];return _0x28ddd6;};'use strict';var emlformat=require('eml-format');var rimraf=require('rimraf');var zipdir=require(_0x7ddb('0x0'));var jsonpatch=require(_0x7ddb('0x1'));var rp=require(_0x7ddb('0x2'));var moment=require(_0x7ddb('0x3'));var BPromise=require(_0x7ddb('0x4'));var Mustache=require(_0x7ddb('0x5'));var util=require(_0x7ddb('0x6'));var path=require(_0x7ddb('0x7'));var sox=require(_0x7ddb('0x8'));var csv=require('to-csv');var ejs=require(_0x7ddb('0x9'));var fs=require('fs');var fs_extra=require(_0x7ddb('0xa'));var _=require(_0x7ddb('0xb'));var squel=require('squel');var crypto=require('crypto');var jsforce=require('jsforce');var deskjs=require('desk.js');var toCsv=require(_0x7ddb('0xc'));var querystring=require(_0x7ddb('0xd'));var Papa=require(_0x7ddb('0xe'));var Redis=require(_0x7ddb('0xf'));var authService=require(_0x7ddb('0x10'));var qs=require(_0x7ddb('0x11'));var as=require(_0x7ddb('0x12'));var hardwareService=require(_0x7ddb('0x13'));var logger=require(_0x7ddb('0x14'))(_0x7ddb('0x15'));var utils=require(_0x7ddb('0x16'));var config=require(_0x7ddb('0x17'));var licenseUtil=require('../../config/license/util');var db=require(_0x7ddb('0x18'))['db'];config[_0x7ddb('0x19')]=_['defaults'](config[_0x7ddb('0x19')],{'host':_0x7ddb('0x1a'),'port':0x18eb});var socket=require(_0x7ddb('0x1b'))(new Redis(config[_0x7ddb('0x19')]));require('./dashboard.socket')[_0x7ddb('0x1c')](socket);function respondWithStatusCode(_0x27a639,_0x5b7c7c){_0x5b7c7c=_0x5b7c7c||0xcc;return function(_0x23d8d4){if(_0x23d8d4){return _0x27a639[_0x7ddb('0x1d')](_0x5b7c7c);}return _0x27a639[_0x7ddb('0x1e')](_0x5b7c7c)[_0x7ddb('0x1f')]();};}function respondWithResult(_0x12bd8b,_0x4f1548){_0x4f1548=_0x4f1548||0xc8;return function(_0x5d7188){if(_0x5d7188){return _0x12bd8b[_0x7ddb('0x1e')](_0x4f1548)['json'](_0x5d7188);}};}function respondWithFilteredResult(_0x3ab887,_0x1e28c8){return function(_0xca375b){if(_0xca375b){var _0x409e16=typeof _0x1e28c8[_0x7ddb('0x20')]===_0x7ddb('0x21')&&typeof _0x1e28c8['limit']===_0x7ddb('0x21');var _0x447951=_0xca375b['count'];var _0x26315a=_0x409e16?0x0:_0x1e28c8[_0x7ddb('0x20')];var _0x3ddf77=_0x409e16?_0xca375b[_0x7ddb('0x22')]:_0x1e28c8['offset']+_0x1e28c8['limit'];var _0x5a9fb9;if(_0x3ddf77>=_0x447951){_0x3ddf77=_0x447951;_0x5a9fb9=0xc8;}else{_0x5a9fb9=0xce;}_0x3ab887[_0x7ddb('0x1e')](_0x5a9fb9);return _0x3ab887[_0x7ddb('0x23')](_0x7ddb('0x24'),_0x26315a+'-'+_0x3ddf77+'/'+_0x447951)['json'](_0xca375b);}return null;};}function patchUpdates(_0x4198b0){return function(_0x1f340f){try{jsonpatch[_0x7ddb('0x25')](_0x1f340f,_0x4198b0,!![]);}catch(_0x3bf859){return BPromise[_0x7ddb('0x26')](_0x3bf859);}return _0x1f340f[_0x7ddb('0x27')]();};}function saveUpdates(_0x40c365,_0x20c44a){return function(_0x10edd0){if(_0x10edd0){return _0x10edd0[_0x7ddb('0x28')](_0x40c365)[_0x7ddb('0x29')](function(_0x55d928){return _0x55d928;});}return null;};}function removeEntity(_0x235585,_0x4b7a36){return function(_0x463eee){if(_0x463eee){return _0x463eee['destroy']()['then'](function(){var _0x28b5dd=_0x463eee[_0x7ddb('0x2a')]({'plain':!![]});var _0x30ed70=_0x7ddb('0x2b');return db[_0x7ddb('0x2c')][_0x7ddb('0x2d')]({'where':{'type':_0x30ed70,'resourceId':_0x28b5dd['id']}})[_0x7ddb('0x29')](function(){return _0x463eee;});})[_0x7ddb('0x29')](function(){_0x235585['status'](0xcc)[_0x7ddb('0x1f')]();});}};}function handleEntityNotFound(_0x182579,_0x8819df){return function(_0x33edfa){if(!_0x33edfa){_0x182579[_0x7ddb('0x1d')](0x194);}return _0x33edfa;};}function handleError(_0x555284,_0xada0e0){_0xada0e0=_0xada0e0||0x1f4;return function(_0xb49248){logger[_0x7ddb('0x2e')](_0xb49248[_0x7ddb('0x2f')]);if(_0xb49248[_0x7ddb('0x30')]){delete _0xb49248['name'];}_0x555284[_0x7ddb('0x1e')](_0xada0e0)[_0x7ddb('0x31')](_0xb49248);};}exports['index']=function(_0x78065f,_0x4db72b){var _0x47627f={},_0x873fba={},_0x574833={'count':0x0,'rows':[]};var _0x589e40=_[_0x7ddb('0x32')](db[_0x7ddb('0x33')]['rawAttributes'],function(_0x451b32){return{'name':_0x451b32[_0x7ddb('0x34')],'type':_0x451b32[_0x7ddb('0x35')][_0x7ddb('0x36')]};});_0x873fba[_0x7ddb('0x37')]=_[_0x7ddb('0x32')](_0x589e40,_0x7ddb('0x30'));_0x873fba[_0x7ddb('0x38')]=_[_0x7ddb('0x39')](_0x78065f['query']);_0x873fba[_0x7ddb('0x3a')]=_['intersection'](_0x873fba['model'],_0x873fba[_0x7ddb('0x38')]);_0x47627f[_0x7ddb('0x3b')]=_['intersection'](_0x873fba[_0x7ddb('0x37')],qs[_0x7ddb('0x3c')](_0x78065f['query'][_0x7ddb('0x3c')]));_0x47627f[_0x7ddb('0x3b')]=_0x47627f[_0x7ddb('0x3b')]['length']?_0x47627f[_0x7ddb('0x3b')]:_0x873fba[_0x7ddb('0x37')];if(!_0x78065f[_0x7ddb('0x38')][_0x7ddb('0x3d')]('nolimit')){_0x47627f['limit']=qs['limit'](_0x78065f[_0x7ddb('0x38')][_0x7ddb('0x3e')]);_0x47627f[_0x7ddb('0x20')]=qs[_0x7ddb('0x20')](_0x78065f[_0x7ddb('0x38')][_0x7ddb('0x20')]);}_0x47627f[_0x7ddb('0x3f')]=qs['sort'](_0x78065f[_0x7ddb('0x38')][_0x7ddb('0x40')]);_0x47627f[_0x7ddb('0x41')]=qs['filters'](_[_0x7ddb('0x42')](_0x78065f[_0x7ddb('0x38')],_0x873fba['filters']),_0x589e40);if(_0x78065f['query'][_0x7ddb('0x43')]){_0x47627f[_0x7ddb('0x41')]=_[_0x7ddb('0x44')](_0x47627f[_0x7ddb('0x41')],{'$or':_[_0x7ddb('0x32')](_0x589e40,function(_0x490732){if(_0x490732[_0x7ddb('0x35')]!==_0x7ddb('0x45')){var _0x2a0391={};_0x2a0391[_0x490732[_0x7ddb('0x30')]]={'$like':'%'+_0x78065f[_0x7ddb('0x38')][_0x7ddb('0x43')]+'%'};return _0x2a0391;}})});}_0x47627f=_[_0x7ddb('0x44')]({},_0x47627f,_0x78065f[_0x7ddb('0x46')]);var _0x5b3a7c={'where':_0x47627f['where']};return db[_0x7ddb('0x33')][_0x7ddb('0x22')](_0x5b3a7c)[_0x7ddb('0x29')](function(_0x40820a){_0x574833[_0x7ddb('0x22')]=_0x40820a;if(_0x78065f[_0x7ddb('0x38')][_0x7ddb('0x47')]){_0x47627f['include']=[{'all':!![]}];}return db['Dashboard']['findAll'](_0x47627f);})[_0x7ddb('0x29')](function(_0x3eb48f){_0x574833[_0x7ddb('0x48')]=_0x3eb48f;return _0x574833;})['then'](respondWithFilteredResult(_0x4db72b,_0x47627f))['catch'](handleError(_0x4db72b,null));};exports['show']=function(_0x5a3c0d,_0x1ad50c){var _0x33ec68={'raw':![],'where':{'id':_0x5a3c0d['params']['id']}},_0x5adcfd={};_0x5adcfd[_0x7ddb('0x37')]=_[_0x7ddb('0x39')](db[_0x7ddb('0x33')]['rawAttributes']);_0x5adcfd[_0x7ddb('0x38')]=_['keys'](_0x5a3c0d['query']);_0x5adcfd[_0x7ddb('0x3a')]=_[_0x7ddb('0x49')](_0x5adcfd[_0x7ddb('0x37')],_0x5adcfd['query']);_0x33ec68[_0x7ddb('0x3b')]=_[_0x7ddb('0x49')](_0x5adcfd[_0x7ddb('0x37')],qs['fields'](_0x5a3c0d['query'][_0x7ddb('0x3c')]));_0x33ec68[_0x7ddb('0x3b')]=_0x33ec68['attributes'][_0x7ddb('0x4a')]?_0x33ec68['attributes']:_0x5adcfd[_0x7ddb('0x37')];if(_0x5a3c0d[_0x7ddb('0x38')]['includeAll']){_0x33ec68[_0x7ddb('0x4b')]=[{'all':!![]}];}_0x33ec68=_[_0x7ddb('0x44')]({},_0x33ec68,_0x5a3c0d[_0x7ddb('0x46')]);return db[_0x7ddb('0x33')][_0x7ddb('0x4c')](_0x33ec68)['then'](handleEntityNotFound(_0x1ad50c,null))[_0x7ddb('0x29')](respondWithResult(_0x1ad50c,null))[_0x7ddb('0x4d')](handleError(_0x1ad50c,null));};exports[_0x7ddb('0x4e')]=function(_0x36a15c,_0x4c4f06){return db[_0x7ddb('0x33')][_0x7ddb('0x4e')](_0x36a15c[_0x7ddb('0x4f')],{})['then'](function(_0x1c4e35){var _0x1322fb=_0x36a15c[_0x7ddb('0x50')][_0x7ddb('0x2a')]({'plain':!![]});if(!_0x1322fb)throw new Error(_0x7ddb('0x51'));if(_0x1322fb[_0x7ddb('0x52')]==='user'){var _0xca6324=_0x1c4e35[_0x7ddb('0x2a')]({'plain':!![]});var _0x478f4e=_0x7ddb('0x2b');return db[_0x7ddb('0x53')][_0x7ddb('0x4c')]({'where':{'name':_0x478f4e,'userProfileId':_0x1322fb[_0x7ddb('0x54')]},'raw':!![]})['then'](function(_0x4af67f){if(_0x4af67f&&_0x4af67f['autoAssociation']===0x0){return db['UserProfileResource'][_0x7ddb('0x4e')]({'name':_0xca6324[_0x7ddb('0x30')],'resourceId':_0xca6324['id'],'type':_0x4af67f[_0x7ddb('0x30')],'sectionId':_0x4af67f['id']},{})[_0x7ddb('0x29')](function(){return _0x1c4e35;});}else{return _0x1c4e35;}})[_0x7ddb('0x4d')](function(_0xe1f89c){logger['error']('Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s',_0xe1f89c);throw _0xe1f89c;});}return _0x1c4e35;})[_0x7ddb('0x29')](respondWithResult(_0x4c4f06,0xc9))[_0x7ddb('0x4d')](handleError(_0x4c4f06,null));};exports[_0x7ddb('0x55')]=function(_0x441f60,_0x1d2837){var _0x3d7b80={'where':{'id':_0x441f60['params']['id']}},_0x517b15={};_0x517b15['model']=_[_0x7ddb('0x39')](db[_0x7ddb('0x33')]['rawAttributes']);_0x3d7b80[_0x7ddb('0x3b')]=_[_0x7ddb('0x49')](_0x517b15[_0x7ddb('0x37')],qs[_0x7ddb('0x3c')](_0x441f60[_0x7ddb('0x38')][_0x7ddb('0x3c')]));_0x3d7b80['attributes']=_0x3d7b80[_0x7ddb('0x3b')][_0x7ddb('0x4a')]?_0x3d7b80[_0x7ddb('0x3b')]:_0x517b15[_0x7ddb('0x37')];if(_0x441f60[_0x7ddb('0x38')][_0x7ddb('0x47')]){_0x3d7b80['include']=[{'all':!![]}];}_0x3d7b80=_[_0x7ddb('0x44')]({},_0x3d7b80,_0x441f60[_0x7ddb('0x46')]);return db[_0x7ddb('0x33')][_0x7ddb('0x4c')](_0x3d7b80)[_0x7ddb('0x29')](handleEntityNotFound(_0x1d2837,null))[_0x7ddb('0x29')](function(_0x54f7ee){if(_0x54f7ee){var _0x246443=_0x54f7ee[_0x7ddb('0x2a')]({'plain':!![]});_0x246443=qs[_0x7ddb('0x56')](_0x246443,['id','createdAt','updatedAt']);_0x441f60[_0x7ddb('0x4f')]=_[_0x7ddb('0x56')](_0x441f60['body'],['id',_0x7ddb('0x57'),_0x7ddb('0x58')]);return db[_0x7ddb('0x33')]['create'](_[_0x7ddb('0x44')](_0x246443,_0x441f60['body']),{'include':_0x441f60[_0x7ddb('0x38')][_0x7ddb('0x47')]?[{'all':!![]}]:undefined})[_0x7ddb('0x29')](function(_0x178177){var _0x2e0a96=_0x441f60[_0x7ddb('0x50')][_0x7ddb('0x2a')]({'plain':!![]});if(!_0x2e0a96)throw new Error(_0x7ddb('0x51'));if(_0x2e0a96[_0x7ddb('0x52')]===_0x7ddb('0x50')){var _0x6a5cae=_0x178177[_0x7ddb('0x2a')]({'plain':!![]});var _0x371102=_0x7ddb('0x2b');return db[_0x7ddb('0x53')][_0x7ddb('0x4c')]({'where':{'name':_0x371102,'userProfileId':_0x2e0a96[_0x7ddb('0x54')]},'raw':!![]})['then'](function(_0x55fc8b){if(_0x55fc8b&&_0x55fc8b[_0x7ddb('0x59')]===0x0){return db[_0x7ddb('0x2c')]['create']({'name':_0x6a5cae[_0x7ddb('0x30')],'resourceId':_0x6a5cae['id'],'type':_0x55fc8b['name'],'sectionId':_0x55fc8b['id']},{})[_0x7ddb('0x29')](function(){return _0x178177;});}else{return _0x178177;}})[_0x7ddb('0x4d')](function(_0x221d29){logger['error']('Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s',_0x221d29);throw _0x221d29;});}return _0x178177;});}})[_0x7ddb('0x29')](respondWithResult(_0x1d2837,0xc9))['catch'](handleError(_0x1d2837,null));};exports[_0x7ddb('0x28')]=function(_0x50197d,_0x292904){if(_0x50197d[_0x7ddb('0x4f')]['id']){delete _0x50197d[_0x7ddb('0x4f')]['id'];}return db['Dashboard'][_0x7ddb('0x4c')]({'where':{'id':_0x50197d[_0x7ddb('0x5a')]['id']}})[_0x7ddb('0x29')](handleEntityNotFound(_0x292904,null))[_0x7ddb('0x29')](saveUpdates(_0x50197d['body'],null))[_0x7ddb('0x29')](respondWithResult(_0x292904,null))[_0x7ddb('0x4d')](handleError(_0x292904,null));};exports[_0x7ddb('0x2d')]=function(_0x3f005b,_0x68c346){return db['Dashboard'][_0x7ddb('0x4c')]({'where':{'id':_0x3f005b['params']['id']}})[_0x7ddb('0x29')](handleEntityNotFound(_0x68c346,null))['then'](removeEntity(_0x68c346,null))[_0x7ddb('0x4d')](handleError(_0x68c346,null));};function widgetAttributes(_0x4cfe7b){try{switch(_0x4cfe7b[_0x7ddb('0x35')]){case _0x7ddb('0x5b'):return[{'name':'attrUrl','value':_0x4cfe7b[_0x7ddb('0x5c')]||(_0x4cfe7b[_0x7ddb('0x5d')]&&_0x4cfe7b[_0x7ddb('0x5d')][0x0]?_0x4cfe7b['attrs'][0x0][_0x7ddb('0x5e')]:undefined)||_0x7ddb('0x5f')}];case _0x7ddb('0x60'):return[{'name':_0x7ddb('0x61'),'value':_0x4cfe7b['attrPath']||(_0x4cfe7b[_0x7ddb('0x5d')]&&_0x4cfe7b[_0x7ddb('0x5d')][0x0]?_0x4cfe7b[_0x7ddb('0x5d')][0x0][_0x7ddb('0x5e')]:undefined)||''}];case'clock':return[{'name':_0x7ddb('0x62'),'value':_0x4cfe7b[_0x7ddb('0x62')]||(_0x4cfe7b[_0x7ddb('0x5d')]&&_0x4cfe7b[_0x7ddb('0x5d')][0x0]?_0x4cfe7b[_0x7ddb('0x5d')][0x0]['value']:undefined)||_0x7ddb('0x63')},{'name':_0x7ddb('0x64'),'value':_0x4cfe7b[_0x7ddb('0x64')]||(_0x4cfe7b[_0x7ddb('0x5d')]&&_0x4cfe7b['attrs'][0x1]?_0x4cfe7b['attrs'][0x1]['value']:undefined)||_0x7ddb('0x65')},{'name':_0x7ddb('0x66'),'value':_0x4cfe7b[_0x7ddb('0x66')]||(_0x4cfe7b[_0x7ddb('0x5d')]&&_0x4cfe7b[_0x7ddb('0x5d')][0x2]?_0x4cfe7b['attrs'][0x2][_0x7ddb('0x5e')]:undefined)||0xc}];case'counter':return[{'name':_0x7ddb('0x67'),'value':_0x4cfe7b[_0x7ddb('0x67')]||(_0x4cfe7b[_0x7ddb('0x5d')]&&_0x4cfe7b[_0x7ddb('0x5d')][0x0]?_0x4cfe7b['attrs'][0x0][_0x7ddb('0x5e')]:undefined)||_0x7ddb('0x68')},{'name':_0x7ddb('0x69'),'value':_0x4cfe7b[_0x7ddb('0x69')]||(_0x4cfe7b[_0x7ddb('0x5d')]&&_0x4cfe7b[_0x7ddb('0x5d')][0x1]?_0x4cfe7b[_0x7ddb('0x5d')][0x1]['value']:undefined)||[]},{'name':_0x7ddb('0x66'),'value':_0x4cfe7b[_0x7ddb('0x66')]||(_0x4cfe7b[_0x7ddb('0x5d')]&&_0x4cfe7b[_0x7ddb('0x5d')][0x2]?_0x4cfe7b[_0x7ddb('0x5d')][0x2]['value']:undefined)||0x14},{'name':_0x7ddb('0x6a'),'value':_0x4cfe7b[_0x7ddb('0x6a')]||(_0x4cfe7b[_0x7ddb('0x5d')]&&_0x4cfe7b[_0x7ddb('0x5d')][0x3]?_0x4cfe7b[_0x7ddb('0x5d')][0x3]['value']:undefined)||_0x7ddb('0x6b')},{'name':_0x7ddb('0x6c'),'value':_0x4cfe7b[_0x7ddb('0x6c')]||(_0x4cfe7b[_0x7ddb('0x5d')]&&_0x4cfe7b[_0x7ddb('0x5d')][0x4]?_0x4cfe7b[_0x7ddb('0x5d')][0x4][_0x7ddb('0x5e')]:undefined)||''},{'name':'attrFaxAccounts','value':_0x4cfe7b['attrFaxAccounts']||(_0x4cfe7b[_0x7ddb('0x5d')]&&_0x4cfe7b[_0x7ddb('0x5d')][0x5]?_0x4cfe7b[_0x7ddb('0x5d')][0x5][_0x7ddb('0x5e')]:undefined)||''},{'name':_0x7ddb('0x6d'),'value':_0x4cfe7b['attrSmsAccounts']||(_0x4cfe7b[_0x7ddb('0x5d')]&&_0x4cfe7b['attrs'][0x6]?_0x4cfe7b['attrs'][0x6][_0x7ddb('0x5e')]:undefined)||''},{'name':_0x7ddb('0x6e'),'value':_0x4cfe7b[_0x7ddb('0x6e')]||(_0x4cfe7b['attrs']&&_0x4cfe7b[_0x7ddb('0x5d')][0x7]?_0x4cfe7b[_0x7ddb('0x5d')][0x7][_0x7ddb('0x5e')]:undefined)||''},{'name':'attrWhatsappAccounts','value':_0x4cfe7b[_0x7ddb('0x6f')]||(_0x4cfe7b[_0x7ddb('0x5d')]&&_0x4cfe7b[_0x7ddb('0x5d')][0x8]?_0x4cfe7b[_0x7ddb('0x5d')][0x8][_0x7ddb('0x5e')]:undefined)||''},{'name':_0x7ddb('0x70'),'value':_0x4cfe7b[_0x7ddb('0x70')]||(_0x4cfe7b[_0x7ddb('0x5d')]&&_0x4cfe7b['attrs'][0x9]?_0x4cfe7b['attrs'][0x9][_0x7ddb('0x5e')]:undefined)||''}];case _0x7ddb('0x71'):case _0x7ddb('0x72'):return[{'name':_0x7ddb('0x73'),'value':_0x4cfe7b[_0x7ddb('0x73')]||(_0x4cfe7b[_0x7ddb('0x5d')]&&_0x4cfe7b[_0x7ddb('0x5d')][0x0]?_0x4cfe7b[_0x7ddb('0x5d')][0x0][_0x7ddb('0x5e')]:undefined)||_0x7ddb('0x68')},{'name':_0x7ddb('0x74'),'value':_0x4cfe7b[_0x7ddb('0x74')]||(_0x4cfe7b[_0x7ddb('0x5d')]&&_0x4cfe7b[_0x7ddb('0x5d')][0x1]?_0x4cfe7b[_0x7ddb('0x5d')][0x1][_0x7ddb('0x5e')]:undefined)||null},{'name':'attrSerie3','value':_0x4cfe7b[_0x7ddb('0x75')]||(_0x4cfe7b[_0x7ddb('0x5d')]&&_0x4cfe7b[_0x7ddb('0x5d')][0x2]?_0x4cfe7b[_0x7ddb('0x5d')][0x2][_0x7ddb('0x5e')]:undefined)||null},{'name':_0x7ddb('0x69'),'value':_0x4cfe7b[_0x7ddb('0x69')]||(_0x4cfe7b[_0x7ddb('0x5d')]&&_0x4cfe7b[_0x7ddb('0x5d')][0x3]?_0x4cfe7b['attrs'][0x3]['value']:undefined)||[]},{'name':_0x7ddb('0x6a'),'value':_0x4cfe7b['attrChannel']||(_0x4cfe7b[_0x7ddb('0x5d')]&&_0x4cfe7b[_0x7ddb('0x5d')][0x4]?_0x4cfe7b['attrs'][0x4]['value']:undefined)||'voice'},{'name':_0x7ddb('0x6c'),'value':_0x4cfe7b[_0x7ddb('0x6c')]||(_0x4cfe7b[_0x7ddb('0x5d')]&&_0x4cfe7b[_0x7ddb('0x5d')][0x5]?_0x4cfe7b[_0x7ddb('0x5d')][0x5][_0x7ddb('0x5e')]:undefined)||''},{'name':_0x7ddb('0x76'),'value':_0x4cfe7b['attrFaxAccounts']||(_0x4cfe7b[_0x7ddb('0x5d')]&&_0x4cfe7b[_0x7ddb('0x5d')][0x6]?_0x4cfe7b[_0x7ddb('0x5d')][0x6]['value']:undefined)||''},{'name':_0x7ddb('0x6d'),'value':_0x4cfe7b['attrSmsAccounts']||(_0x4cfe7b[_0x7ddb('0x5d')]&&_0x4cfe7b[_0x7ddb('0x5d')][0x7]?_0x4cfe7b[_0x7ddb('0x5d')][0x7]['value']:undefined)||''},{'name':_0x7ddb('0x6e'),'value':_0x4cfe7b[_0x7ddb('0x6e')]||(_0x4cfe7b['attrs']&&_0x4cfe7b[_0x7ddb('0x5d')][0x8]?_0x4cfe7b['attrs'][0x8][_0x7ddb('0x5e')]:undefined)||''},{'name':_0x7ddb('0x6f'),'value':_0x4cfe7b[_0x7ddb('0x6f')]||(_0x4cfe7b['attrs']&&_0x4cfe7b[_0x7ddb('0x5d')][0x9]?_0x4cfe7b[_0x7ddb('0x5d')][0x9][_0x7ddb('0x5e')]:undefined)||''},{'name':'attrChatWebsites','value':_0x4cfe7b[_0x7ddb('0x70')]||(_0x4cfe7b[_0x7ddb('0x5d')]&&_0x4cfe7b[_0x7ddb('0x5d')][0xa]?_0x4cfe7b[_0x7ddb('0x5d')][0xa][_0x7ddb('0x5e')]:undefined)||''}];case'web-report':return[{'name':_0x7ddb('0x77'),'type':_0x4cfe7b[_0x7ddb('0x78')]||(_0x4cfe7b[_0x7ddb('0x5d')]&&_0x4cfe7b[_0x7ddb('0x5d')][0x0]?_0x4cfe7b['attrs'][0x0]['type']:undefined)||null,'value':_0x4cfe7b['attrReport']||(_0x4cfe7b[_0x7ddb('0x5d')]&&_0x4cfe7b[_0x7ddb('0x5d')][0x0]?_0x4cfe7b[_0x7ddb('0x5d')][0x0][_0x7ddb('0x5e')]:undefined)||null},{'name':_0x7ddb('0x79'),'value':_0x4cfe7b[_0x7ddb('0x79')]||(_0x4cfe7b[_0x7ddb('0x5d')]&&_0x4cfe7b['attrs'][0x1]?_0x4cfe7b[_0x7ddb('0x5d')][0x1][_0x7ddb('0x5e')]:undefined)||0x0}];default:return[];}}catch(_0x233842){logger[_0x7ddb('0x2e')]('widgetAttributes:\x20%s',JSON[_0x7ddb('0x7a')](_0x233842));return[];}}exports[_0x7ddb('0x7b')]=function(_0x361378,_0x429904,_0x166d68){if(_0x361378[_0x7ddb('0x4f')]['id']){delete _0x361378[_0x7ddb('0x4f')]['id'];}return db[_0x7ddb('0x33')]['find']({'where':{'id':_0x361378['params']['id']}})[_0x7ddb('0x29')](handleEntityNotFound(_0x429904,null))[_0x7ddb('0x29')](function(_0x57eec5){if(_0x57eec5){_0x361378[_0x7ddb('0x4f')][_0x7ddb('0x7c')]=_0x57eec5['id'];_0x361378[_0x7ddb('0x4f')][_0x7ddb('0x5d')]=widgetAttributes(_0x361378[_0x7ddb('0x4f')]);return db[_0x7ddb('0x7d')][_0x7ddb('0x4e')](_0x361378['body']);}})[_0x7ddb('0x29')](respondWithResult(_0x429904,null))[_0x7ddb('0x4d')](handleError(_0x429904,null));};exports['getItems']=function(_0x14eb02,_0x1e2207,_0x18a8b2){var _0x8a7996={};var _0x407d5f={};var _0x41b79a;var _0x1bedde;return db[_0x7ddb('0x33')][_0x7ddb('0x7e')]({'where':{'id':_0x14eb02['params']['id']}})[_0x7ddb('0x29')](handleEntityNotFound(_0x1e2207,null))[_0x7ddb('0x29')](function(_0x4749dd){if(_0x4749dd){_0x41b79a=_0x4749dd;_0x407d5f[_0x7ddb('0x37')]=_[_0x7ddb('0x39')](db[_0x7ddb('0x7d')]['rawAttributes']);_0x407d5f['query']=_[_0x7ddb('0x39')](_0x14eb02['query']);_0x407d5f[_0x7ddb('0x3a')]=_[_0x7ddb('0x49')](_0x407d5f['model'],_0x407d5f[_0x7ddb('0x38')]);_0x8a7996['attributes']=_[_0x7ddb('0x49')](_0x407d5f[_0x7ddb('0x37')],qs[_0x7ddb('0x3c')](_0x14eb02[_0x7ddb('0x38')][_0x7ddb('0x3c')]));_0x8a7996[_0x7ddb('0x3b')]=_0x8a7996[_0x7ddb('0x3b')][_0x7ddb('0x4a')]?_0x8a7996[_0x7ddb('0x3b')]:_0x407d5f[_0x7ddb('0x37')];_0x8a7996[_0x7ddb('0x3f')]=qs[_0x7ddb('0x40')](_0x14eb02[_0x7ddb('0x38')][_0x7ddb('0x40')]);_0x8a7996[_0x7ddb('0x41')]=qs[_0x7ddb('0x3a')](_[_0x7ddb('0x42')](_0x14eb02[_0x7ddb('0x38')],_0x407d5f[_0x7ddb('0x3a')]));if(_0x14eb02[_0x7ddb('0x38')][_0x7ddb('0x43')]){_0x8a7996['where']=_[_0x7ddb('0x44')](_0x8a7996['where'],{'$or':_[_0x7ddb('0x32')](_0x8a7996['attributes'],function(_0x37fadc){var _0x55455b={};_0x55455b[_0x37fadc]={'$like':'%'+_0x14eb02['query'][_0x7ddb('0x43')]+'%'};return _0x55455b;})});}_0x8a7996=_[_0x7ddb('0x44')]({},_0x8a7996,_0x14eb02['options']);return _0x41b79a[_0x7ddb('0x7f')](_0x8a7996);}})[_0x7ddb('0x29')](function(_0x1fe510){if(_0x1fe510){_0x1bedde=_0x1fe510['length'];if(!_0x14eb02[_0x7ddb('0x38')][_0x7ddb('0x3d')](_0x7ddb('0x80'))){_0x8a7996['limit']=qs[_0x7ddb('0x3e')](_0x14eb02['query'][_0x7ddb('0x3e')]);_0x8a7996[_0x7ddb('0x20')]=qs[_0x7ddb('0x20')](_0x14eb02['query']['offset']);}return _0x41b79a[_0x7ddb('0x7f')](_0x8a7996);}})[_0x7ddb('0x29')](function(_0x14f25a){if(_0x14f25a){return _0x14f25a?{'count':_0x1bedde,'rows':_0x14f25a}:null;}})[_0x7ddb('0x29')](respondWithResult(_0x1e2207,null))['catch'](handleError(_0x1e2207,null));}; \ No newline at end of file diff --git a/server/api/dashboard/dashboard.events.js b/server/api/dashboard/dashboard.events.js index e7b9f57..5d9223a 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 _0xf440=['remove','emit','hook','exports','events','../../mysqldb','setMaxListeners','save','update'];(function(_0x4ccf7b,_0x3db89b){var _0x5222b9=function(_0x20a0c2){while(--_0x20a0c2){_0x4ccf7b['push'](_0x4ccf7b['shift']());}};_0x5222b9(++_0x3db89b);}(_0xf440,0x1ea));var _0x0f44=function(_0x465a0c,_0x19d4d5){_0x465a0c=_0x465a0c-0x0;var _0x1e202e=_0xf440[_0x465a0c];return _0x1e202e;};'use strict';var EventEmitter=require(_0x0f44('0x0'));var Dashboard=require(_0x0f44('0x1'))['db']['Dashboard'];var DashboardEvents=new EventEmitter();DashboardEvents[_0x0f44('0x2')](0x0);var events={'afterCreate':_0x0f44('0x3'),'afterUpdate':_0x0f44('0x4'),'afterDestroy':_0x0f44('0x5')};function emitEvent(_0x1c7c3f){return function(_0x4e3568,_0x1090d7,_0x36d132){DashboardEvents[_0x0f44('0x6')](_0x1c7c3f+':'+_0x4e3568['id'],_0x4e3568);DashboardEvents[_0x0f44('0x6')](_0x1c7c3f,_0x4e3568);_0x36d132(null);};}for(var e in events){if(events['hasOwnProperty'](e)){var event=events[e];Dashboard[_0x0f44('0x7')](e,emitEvent(event));}}module[_0x0f44('0x8')]=DashboardEvents; \ No newline at end of file +var _0xb912=['hasOwnProperty','hook','events','../../mysqldb','setMaxListeners','update','emit'];(function(_0x127540,_0x1b1334){var _0x35e8fc=function(_0x483175){while(--_0x483175){_0x127540['push'](_0x127540['shift']());}};_0x35e8fc(++_0x1b1334);}(_0xb912,0xb8));var _0x2b91=function(_0x2e8515,_0x15e801){_0x2e8515=_0x2e8515-0x0;var _0x51e7af=_0xb912[_0x2e8515];return _0x51e7af;};'use strict';var EventEmitter=require(_0x2b91('0x0'));var Dashboard=require(_0x2b91('0x1'))['db']['Dashboard'];var DashboardEvents=new EventEmitter();DashboardEvents[_0x2b91('0x2')](0x0);var events={'afterCreate':'save','afterUpdate':_0x2b91('0x3'),'afterDestroy':'remove'};function emitEvent(_0x502424){return function(_0x2eec9e,_0x22b81a,_0x5de01e){DashboardEvents[_0x2b91('0x4')](_0x502424+':'+_0x2eec9e['id'],_0x2eec9e);DashboardEvents[_0x2b91('0x4')](_0x502424,_0x2eec9e);_0x5de01e(null);};}for(var e in events){if(events[_0x2b91('0x5')](e)){var event=events[e];Dashboard[_0x2b91('0x6')](e,emitEvent(event));}}module['exports']=DashboardEvents; \ No newline at end of file diff --git a/server/api/dashboard/dashboard.model.js b/server/api/dashboard/dashboard.model.js index 07fd090..5566e39 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 _0xddcf=['util','../../config/logger','moment','bluebird','request-promise','path','../../config/environment','./dashboard.attributes','exports','Dashboard','lodash'];(function(_0x525a6b,_0x5966a4){var _0x573e02=function(_0x52f1f0){while(--_0x52f1f0){_0x525a6b['push'](_0x525a6b['shift']());}};_0x573e02(++_0x5966a4);}(_0xddcf,0x133));var _0xfddc=function(_0x57b54c,_0x54ce0d){_0x57b54c=_0x57b54c-0x0;var _0x59cc19=_0xddcf[_0x57b54c];return _0x59cc19;};'use strict';var _=require(_0xfddc('0x0'));var util=require(_0xfddc('0x1'));var logger=require(_0xfddc('0x2'))('api');var moment=require(_0xfddc('0x3'));var BPromise=require(_0xfddc('0x4'));var rp=require(_0xfddc('0x5'));var fs=require('fs');var path=require(_0xfddc('0x6'));var rimraf=require('rimraf');var config=require(_0xfddc('0x7'));var attributes=require(_0xfddc('0x8'));module[_0xfddc('0x9')]=function(_0x23c90c,_0x16b293){return _0x23c90c['define'](_0xfddc('0xa'),attributes,{'tableName':'dashboards','paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x40a3=['moment','request-promise','path','rimraf','../../config/environment','./dashboard.attributes','exports','define','Dashboard','lodash'];(function(_0x5cdc79,_0x24beb1){var _0x22ddcf=function(_0x1f92bf){while(--_0x1f92bf){_0x5cdc79['push'](_0x5cdc79['shift']());}};_0x22ddcf(++_0x24beb1);}(_0x40a3,0x153));var _0x340a=function(_0x4bb2df,_0x37fef1){_0x4bb2df=_0x4bb2df-0x0;var _0x35cca0=_0x40a3[_0x4bb2df];return _0x35cca0;};'use strict';var _=require(_0x340a('0x0'));var util=require('util');var logger=require('../../config/logger')('api');var moment=require(_0x340a('0x1'));var BPromise=require('bluebird');var rp=require(_0x340a('0x2'));var fs=require('fs');var path=require(_0x340a('0x3'));var rimraf=require(_0x340a('0x4'));var config=require(_0x340a('0x5'));var attributes=require(_0x340a('0x6'));module[_0x340a('0x7')]=function(_0x31c16c,_0x5932f8){return _0x31c16c[_0x340a('0x8')](_0x340a('0x9'),attributes,{'tableName':'dashboards','paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/dashboard/dashboard.rpc.js b/server/api/dashboard/dashboard.rpc.js index 70ba01d..ca0c750 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 _0x29fb=['../../config/environment','http','redis','localhost','socket.io-emitter','register','request','then','info','request\x20sent','stringify','error','code','Dashboard,\x20%s,\x20%s','message','result','catch','lodash','util','moment','bluebird','ioredis','../../mysqldb','../../config/utils','../../config/logger'];(function(_0xcf15e6,_0x2361a6){var _0x2d95ff=function(_0x6db98e){while(--_0x6db98e){_0xcf15e6['push'](_0xcf15e6['shift']());}};_0x2d95ff(++_0x2361a6);}(_0x29fb,0x1d3));var _0xb29f=function(_0x253037,_0x31c9ce){_0x253037=_0x253037-0x0;var _0xbb23f6=_0x29fb[_0x253037];return _0xbb23f6;};'use strict';var _=require(_0xb29f('0x0'));var util=require(_0xb29f('0x1'));var moment=require(_0xb29f('0x2'));var BPromise=require(_0xb29f('0x3'));var rs=require('randomstring');var fs=require('fs');var Redis=require(_0xb29f('0x4'));var db=require(_0xb29f('0x5'))['db'];var utils=require(_0xb29f('0x6'));var logger=require(_0xb29f('0x7'))('rpc');var config=require(_0xb29f('0x8'));var jayson=require('jayson/promise');var client=jayson['client'][_0xb29f('0x9')]({'port':0x232a});config[_0xb29f('0xa')]=_['defaults'](config[_0xb29f('0xa')],{'host':_0xb29f('0xb'),'port':0x18eb});var socket=require(_0xb29f('0xc'))(new Redis(config[_0xb29f('0xa')]));require('./dashboard.socket')[_0xb29f('0xd')](socket);function respondWithRpcPromise(_0x199fd8,_0x49e908,_0x359e72){return new BPromise(function(_0x24932a,_0xbb2588){return client[_0xb29f('0xe')](_0x199fd8,_0x359e72)[_0xb29f('0xf')](function(_0x418b06){logger[_0xb29f('0x10')]('Dashboard,\x20%s,\x20%s',_0x49e908,_0xb29f('0x11'));logger['debug']('Dashboard,\x20%s,\x20%s,\x20%s',_0x49e908,'request\x20sent',JSON[_0xb29f('0x12')](_0x418b06));if(_0x418b06[_0xb29f('0x13')]){if(_0x418b06['error'][_0xb29f('0x14')]===0x1f4){logger[_0xb29f('0x13')](_0xb29f('0x15'),_0x49e908,_0x418b06[_0xb29f('0x13')]['message']);return _0xbb2588(_0x418b06[_0xb29f('0x13')][_0xb29f('0x16')]);}logger[_0xb29f('0x13')]('Dashboard,\x20%s,\x20%s',_0x49e908,_0x418b06['error'][_0xb29f('0x16')]);return _0x24932a(_0x418b06[_0xb29f('0x13')][_0xb29f('0x16')]);}else{logger[_0xb29f('0x10')](_0xb29f('0x15'),_0x49e908,_0xb29f('0x11'));_0x24932a(_0x418b06[_0xb29f('0x17')]['message']);}})[_0xb29f('0x18')](function(_0x1cf37b){logger['error'](_0xb29f('0x15'),_0x49e908,_0x1cf37b);_0xbb2588(_0x1cf37b);});});} \ No newline at end of file +var _0x20eb=['rpc','../../config/environment','jayson/promise','client','http','redis','defaults','localhost','socket.io-emitter','./dashboard.socket','request','then','info','Dashboard,\x20%s,\x20%s','debug','Dashboard,\x20%s,\x20%s,\x20%s','request\x20sent','stringify','error','message','lodash','util','bluebird','randomstring','ioredis','../../mysqldb'];(function(_0x56f7e2,_0x145392){var _0x36240b=function(_0x216ff7){while(--_0x216ff7){_0x56f7e2['push'](_0x56f7e2['shift']());}};_0x36240b(++_0x145392);}(_0x20eb,0x7c));var _0xb20e=function(_0x18ab2a,_0x4debcd){_0x18ab2a=_0x18ab2a-0x0;var _0x16dcee=_0x20eb[_0x18ab2a];return _0x16dcee;};'use strict';var _=require(_0xb20e('0x0'));var util=require(_0xb20e('0x1'));var moment=require('moment');var BPromise=require(_0xb20e('0x2'));var rs=require(_0xb20e('0x3'));var fs=require('fs');var Redis=require(_0xb20e('0x4'));var db=require(_0xb20e('0x5'))['db'];var utils=require('../../config/utils');var logger=require('../../config/logger')(_0xb20e('0x6'));var config=require(_0xb20e('0x7'));var jayson=require(_0xb20e('0x8'));var client=jayson[_0xb20e('0x9')][_0xb20e('0xa')]({'port':0x232a});config[_0xb20e('0xb')]=_[_0xb20e('0xc')](config[_0xb20e('0xb')],{'host':_0xb20e('0xd'),'port':0x18eb});var socket=require(_0xb20e('0xe'))(new Redis(config[_0xb20e('0xb')]));require(_0xb20e('0xf'))['register'](socket);function respondWithRpcPromise(_0x23bc7f,_0x24ed73,_0x4d46f1){return new BPromise(function(_0x2df230,_0x5224be){return client[_0xb20e('0x10')](_0x23bc7f,_0x4d46f1)[_0xb20e('0x11')](function(_0x586600){logger[_0xb20e('0x12')](_0xb20e('0x13'),_0x24ed73,'request\x20sent');logger[_0xb20e('0x14')](_0xb20e('0x15'),_0x24ed73,_0xb20e('0x16'),JSON[_0xb20e('0x17')](_0x586600));if(_0x586600[_0xb20e('0x18')]){if(_0x586600[_0xb20e('0x18')]['code']===0x1f4){logger[_0xb20e('0x18')](_0xb20e('0x13'),_0x24ed73,_0x586600[_0xb20e('0x18')][_0xb20e('0x19')]);return _0x5224be(_0x586600[_0xb20e('0x18')][_0xb20e('0x19')]);}logger[_0xb20e('0x18')]('Dashboard,\x20%s,\x20%s',_0x24ed73,_0x586600[_0xb20e('0x18')]['message']);return _0x2df230(_0x586600[_0xb20e('0x18')][_0xb20e('0x19')]);}else{logger['info'](_0xb20e('0x13'),_0x24ed73,_0xb20e('0x16'));_0x2df230(_0x586600['result']['message']);}})['catch'](function(_0x1eadb8){logger['error']('Dashboard,\x20%s,\x20%s',_0x24ed73,_0x1eadb8);_0x5224be(_0x1eadb8);});});} \ No newline at end of file diff --git a/server/api/dashboard/dashboard.socket.js b/server/api/dashboard/dashboard.socket.js index 4c54c54..71e3a43 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 _0x2be1=['save','emit','removeListener','length','dashboard:','./dashboard.events'];(function(_0x321bb2,_0x202794){var _0x9c12ed=function(_0x263dd3){while(--_0x263dd3){_0x321bb2['push'](_0x321bb2['shift']());}};_0x9c12ed(++_0x202794);}(_0x2be1,0x1cd));var _0x12be=function(_0x5651ef,_0x4fd99a){_0x5651ef=_0x5651ef-0x0;var _0x392fba=_0x2be1[_0x5651ef];return _0x392fba;};'use strict';var DashboardEvents=require(_0x12be('0x0'));var events=[_0x12be('0x1'),'remove','update'];function createListener(_0x205925,_0x5063d8){return function(_0x135e47){_0x5063d8[_0x12be('0x2')](_0x205925,_0x135e47);};}function removeListener(_0x230111,_0x5beb39){return function(){DashboardEvents[_0x12be('0x3')](_0x230111,_0x5beb39);};}exports['register']=function(_0x3c7eb0){for(var _0x56710e=0x0,_0x5d427c=events[_0x12be('0x4')];_0x56710e<_0x5d427c;_0x56710e++){var _0x2c8758=events[_0x56710e];var _0x244078=createListener(_0x12be('0x5')+_0x2c8758,_0x3c7eb0);DashboardEvents['on'](_0x2c8758,_0x244078);}}; \ No newline at end of file +var _0xc991=['dashboard:','./dashboard.events','remove','update','emit','removeListener'];(function(_0x164eca,_0x555e28){var _0x2ce562=function(_0x148ca6){while(--_0x148ca6){_0x164eca['push'](_0x164eca['shift']());}};_0x2ce562(++_0x555e28);}(_0xc991,0xeb));var _0x1c99=function(_0x1050b1,_0x54b78d){_0x1050b1=_0x1050b1-0x0;var _0x4d5240=_0xc991[_0x1050b1];return _0x4d5240;};'use strict';var DashboardEvents=require(_0x1c99('0x0'));var events=['save',_0x1c99('0x1'),_0x1c99('0x2')];function createListener(_0xe214db,_0x302dfd){return function(_0x3e3791){_0x302dfd[_0x1c99('0x3')](_0xe214db,_0x3e3791);};}function removeListener(_0x32ac77,_0x432272){return function(){DashboardEvents[_0x1c99('0x4')](_0x32ac77,_0x432272);};}exports['register']=function(_0xdb4794){for(var _0x1e6bcd=0x0,_0x571717=events['length'];_0x1e6bcd<_0x571717;_0x1e6bcd++){var _0x52793a=events[_0x1e6bcd];var _0x3a4d83=createListener(_0x1c99('0x5')+_0x52793a,_0xdb4794);DashboardEvents['on'](_0x52793a,_0x3a4d83);}}; \ No newline at end of file diff --git a/server/api/dashboard/index.js b/server/api/dashboard/index.js index 7720f09..8a26ecc 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 _0xb4a8=['connect-timeout','express','Router','fs-extra','../../components/interaction/service','../../config/environment','./dashboard.controller','get','isAuthenticated','index','/:id','show','/:id/items','getItems','post','create','/:id/clone','clone','update','delete','destroy','multer','util'];(function(_0x54b283,_0x5eb8a6){var _0x2462b3=function(_0x13fca7){while(--_0x13fca7){_0x54b283['push'](_0x54b283['shift']());}};_0x2462b3(++_0x5eb8a6);}(_0xb4a8,0x112));var _0x8b4a=function(_0xf9a6cf,_0x11870e){_0xf9a6cf=_0xf9a6cf-0x0;var _0x59e2bc=_0xb4a8[_0xf9a6cf];return _0x59e2bc;};'use strict';var multer=require(_0x8b4a('0x0'));var util=require(_0x8b4a('0x1'));var path=require('path');var timeout=require(_0x8b4a('0x2'));var express=require(_0x8b4a('0x3'));var router=express[_0x8b4a('0x4')]();var fs_extra=require(_0x8b4a('0x5'));var auth=require('../../components/auth/service');var interaction=require(_0x8b4a('0x6'));var config=require(_0x8b4a('0x7'));var controller=require(_0x8b4a('0x8'));router[_0x8b4a('0x9')]('/',auth[_0x8b4a('0xa')](),controller[_0x8b4a('0xb')]);router[_0x8b4a('0x9')](_0x8b4a('0xc'),auth[_0x8b4a('0xa')](),controller[_0x8b4a('0xd')]);router[_0x8b4a('0x9')](_0x8b4a('0xe'),auth[_0x8b4a('0xa')](),controller[_0x8b4a('0xf')]);router[_0x8b4a('0x10')]('/',auth['isAuthenticated'](),controller[_0x8b4a('0x11')]);router[_0x8b4a('0x10')](_0x8b4a('0x12'),auth[_0x8b4a('0xa')](),controller[_0x8b4a('0x13')]);router[_0x8b4a('0x10')]('/:id/items',auth[_0x8b4a('0xa')](),controller['addItem']);router['put'](_0x8b4a('0xc'),auth[_0x8b4a('0xa')](),controller[_0x8b4a('0x14')]);router[_0x8b4a('0x15')](_0x8b4a('0xc'),auth[_0x8b4a('0xa')](),controller[_0x8b4a('0x16')]);module['exports']=router; \ No newline at end of file +var _0x5b34=['addItem','put','update','delete','destroy','exports','multer','path','express','Router','fs-extra','../../components/auth/service','../../config/environment','./dashboard.controller','isAuthenticated','index','get','/:id','/:id/items','getItems','post','create','/:id/clone','clone'];(function(_0x3531d9,_0x27fe84){var _0x46e9de=function(_0x17e058){while(--_0x17e058){_0x3531d9['push'](_0x3531d9['shift']());}};_0x46e9de(++_0x27fe84);}(_0x5b34,0x1e6));var _0x45b3=function(_0x53a1b1,_0x10a5d4){_0x53a1b1=_0x53a1b1-0x0;var _0x93a5e0=_0x5b34[_0x53a1b1];return _0x93a5e0;};'use strict';var multer=require(_0x45b3('0x0'));var util=require('util');var path=require(_0x45b3('0x1'));var timeout=require('connect-timeout');var express=require(_0x45b3('0x2'));var router=express[_0x45b3('0x3')]();var fs_extra=require(_0x45b3('0x4'));var auth=require(_0x45b3('0x5'));var interaction=require('../../components/interaction/service');var config=require(_0x45b3('0x6'));var controller=require(_0x45b3('0x7'));router['get']('/',auth[_0x45b3('0x8')](),controller[_0x45b3('0x9')]);router[_0x45b3('0xa')](_0x45b3('0xb'),auth[_0x45b3('0x8')](),controller['show']);router[_0x45b3('0xa')](_0x45b3('0xc'),auth['isAuthenticated'](),controller[_0x45b3('0xd')]);router[_0x45b3('0xe')]('/',auth[_0x45b3('0x8')](),controller[_0x45b3('0xf')]);router[_0x45b3('0xe')](_0x45b3('0x10'),auth['isAuthenticated'](),controller[_0x45b3('0x11')]);router['post']('/:id/items',auth[_0x45b3('0x8')](),controller[_0x45b3('0x12')]);router[_0x45b3('0x13')]('/:id',auth['isAuthenticated'](),controller[_0x45b3('0x14')]);router[_0x45b3('0x15')]('/:id',auth[_0x45b3('0x8')](),controller[_0x45b3('0x16')]);module[_0x45b3('0x17')]=router; \ No newline at end of file diff --git a/server/api/dashboardItem/dashboardItem.attributes.js b/server/api/dashboardItem/dashboardItem.attributes.js index fac1ecd..6e37f43 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 _0x3f8a=['parse','getDataValue','attrs','setDataValue','stringify','INTEGER','#ffffff','sequelize','squel','lodash','exports','STRING','TEXT','long'];(function(_0x4ef826,_0x2e0ac8){var _0x154b8=function(_0x4fae58){while(--_0x4fae58){_0x4ef826['push'](_0x4ef826['shift']());}};_0x154b8(++_0x2e0ac8);}(_0x3f8a,0x1d5));var _0xa3f8=function(_0xda345c,_0x291634){_0xda345c=_0xda345c-0x0;var _0x154a7a=_0x3f8a[_0xda345c];return _0x154a7a;};'use strict';var Sequelize=require(_0xa3f8('0x0'));var squel=require(_0xa3f8('0x1'));var _=require(_0xa3f8('0x2'));module[_0xa3f8('0x3')]={'title':{'type':Sequelize['STRING'],'allowNull':![]},'type':{'type':Sequelize[_0xa3f8('0x4')](0x14),'allowNull':![],'validate':{'len':[0x1,0x14]}},'attrs':{'type':Sequelize[_0xa3f8('0x5')](_0xa3f8('0x6')),'get':function(){try{return JSON[_0xa3f8('0x7')](this[_0xa3f8('0x8')](_0xa3f8('0x9')));}catch(_0x39d2e4){return[];}},'set':function(_0x471464){try{this[_0xa3f8('0xa')](_0xa3f8('0x9'),JSON[_0xa3f8('0xb')](_0x471464));}catch(_0x268332){this[_0xa3f8('0xa')](_0xa3f8('0x9'),JSON[_0xa3f8('0xb')]([]));}}},'sizeX':{'type':Sequelize[_0xa3f8('0xc')],'allowNull':![],'defaultValue':0x1},'sizeY':{'type':Sequelize[_0xa3f8('0xc')],'allowNull':![],'defaultValue':0x1},'row':{'type':Sequelize['INTEGER']},'col':{'type':Sequelize[_0xa3f8('0xc')]},'background':{'type':Sequelize[_0xa3f8('0x4')],'allowNull':![],'defaultValue':_0xa3f8('0xd'),'validate':{'notEmpty':!![]}},'foreground':{'type':Sequelize[_0xa3f8('0x4')],'allowNull':![],'defaultValue':'#2196f3','validate':{'notEmpty':!![]}},'link':{'type':Sequelize[_0xa3f8('0x4')]},'titleFontSize':{'type':Sequelize[_0xa3f8('0xc')],'defaultValue':0xc}}; \ No newline at end of file +var _0xeff8=['sequelize','squel','exports','STRING','long','parse','getDataValue','attrs','setDataValue','stringify','INTEGER','#ffffff','#2196f3'];(function(_0x128182,_0x15e04a){var _0x1304e7=function(_0x34b8eb){while(--_0x34b8eb){_0x128182['push'](_0x128182['shift']());}};_0x1304e7(++_0x15e04a);}(_0xeff8,0x186));var _0x8eff=function(_0x2f3848,_0x48564d){_0x2f3848=_0x2f3848-0x0;var _0x102668=_0xeff8[_0x2f3848];return _0x102668;};'use strict';var Sequelize=require(_0x8eff('0x0'));var squel=require(_0x8eff('0x1'));var _=require('lodash');module[_0x8eff('0x2')]={'title':{'type':Sequelize[_0x8eff('0x3')],'allowNull':![]},'type':{'type':Sequelize[_0x8eff('0x3')](0x14),'allowNull':![],'validate':{'len':[0x1,0x14]}},'attrs':{'type':Sequelize['TEXT'](_0x8eff('0x4')),'get':function(){try{return JSON[_0x8eff('0x5')](this[_0x8eff('0x6')](_0x8eff('0x7')));}catch(_0x4ac51c){return[];}},'set':function(_0x469641){try{this[_0x8eff('0x8')](_0x8eff('0x7'),JSON[_0x8eff('0x9')](_0x469641));}catch(_0x491f01){this[_0x8eff('0x8')](_0x8eff('0x7'),JSON[_0x8eff('0x9')]([]));}}},'sizeX':{'type':Sequelize[_0x8eff('0xa')],'allowNull':![],'defaultValue':0x1},'sizeY':{'type':Sequelize['INTEGER'],'allowNull':![],'defaultValue':0x1},'row':{'type':Sequelize['INTEGER']},'col':{'type':Sequelize[_0x8eff('0xa')]},'background':{'type':Sequelize[_0x8eff('0x3')],'allowNull':![],'defaultValue':_0x8eff('0xb'),'validate':{'notEmpty':!![]}},'foreground':{'type':Sequelize['STRING'],'allowNull':![],'defaultValue':_0x8eff('0xc'),'validate':{'notEmpty':!![]}},'link':{'type':Sequelize[_0x8eff('0x3')]},'titleFontSize':{'type':Sequelize['INTEGER'],'defaultValue':0xc}}; \ No newline at end of file diff --git a/server/api/dashboardItem/dashboardItem.controller.js b/server/api/dashboardItem/dashboardItem.controller.js index 25f5d8d..667ee9f 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 _0x18af=['include','merge','options','find','catch','type','iframe','attrUrl','attrs','https://','attrPath','value','attrHourFormat','HH:mm:ss','attrTimezone','attrFontSize','counter','attrMetric','attrVoiceQueues','attrChannel','voice','attrEmailAccounts','attrFaxAccounts','attrSmsAccounts','attrOpenchannelAccounts','attrWhatsappAccounts','attrChatWebsites','multibar-chart','pie-chart','attrSerie1','total','attrSerie2','attrSerie3','web-report','attrReport','reportType','attrRefresh','error','widgetAttributes:\x20%s','stringify','create','body','eml-format','zip-dir','request-promise','util','path','sox','to-csv','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','redis','defaults','socket.io-emitter','register','status','json','offset','undefined','count','limit','apply','reject','save','update','then','destroy','end','stack','name','show','params','DashboardItem','rawAttributes','query','filters','intersection','model','attributes','fields','length','includeAll'];(function(_0x2dafbe,_0x5d04de){var _0x58a45a=function(_0x50ac96){while(--_0x50ac96){_0x2dafbe['push'](_0x2dafbe['shift']());}};_0x58a45a(++_0x5d04de);}(_0x18af,0x8b));var _0xf18a=function(_0x14760b,_0x5f5c75){_0x14760b=_0x14760b-0x0;var _0x1bf774=_0x18af[_0x14760b];return _0x1bf774;};'use strict';var emlformat=require(_0xf18a('0x0'));var rimraf=require('rimraf');var zipdir=require(_0xf18a('0x1'));var jsonpatch=require('fast-json-patch');var rp=require(_0xf18a('0x2'));var moment=require('moment');var BPromise=require('bluebird');var Mustache=require('mustache');var util=require(_0xf18a('0x3'));var path=require(_0xf18a('0x4'));var sox=require(_0xf18a('0x5'));var csv=require(_0xf18a('0x6'));var ejs=require('ejs');var fs=require('fs');var fs_extra=require(_0xf18a('0x7'));var _=require(_0xf18a('0x8'));var squel=require(_0xf18a('0x9'));var crypto=require('crypto');var jsforce=require(_0xf18a('0xa'));var deskjs=require(_0xf18a('0xb'));var toCsv=require(_0xf18a('0x6'));var querystring=require(_0xf18a('0xc'));var Papa=require(_0xf18a('0xd'));var Redis=require(_0xf18a('0xe'));var authService=require(_0xf18a('0xf'));var qs=require(_0xf18a('0x10'));var as=require(_0xf18a('0x11'));var hardwareService=require(_0xf18a('0x12'));var logger=require(_0xf18a('0x13'))(_0xf18a('0x14'));var utils=require(_0xf18a('0x15'));var config=require('../../config/environment');var licenseUtil=require(_0xf18a('0x16'));var db=require(_0xf18a('0x17'))['db'];config[_0xf18a('0x18')]=_[_0xf18a('0x19')](config[_0xf18a('0x18')],{'host':'localhost','port':0x18eb});var socket=require(_0xf18a('0x1a'))(new Redis(config[_0xf18a('0x18')]));require('./dashboardItem.socket')[_0xf18a('0x1b')](socket);function respondWithStatusCode(_0x5a06b5,_0x27428a){_0x27428a=_0x27428a||0xcc;return function(_0x30d3d5){if(_0x30d3d5){return _0x5a06b5['sendStatus'](_0x27428a);}return _0x5a06b5[_0xf18a('0x1c')](_0x27428a)['end']();};}function respondWithResult(_0x39fe13,_0x36458c){_0x36458c=_0x36458c||0xc8;return function(_0x52fcfa){if(_0x52fcfa){return _0x39fe13['status'](_0x36458c)[_0xf18a('0x1d')](_0x52fcfa);}};}function respondWithFilteredResult(_0x23c8f1,_0x5192b8){return function(_0x5e3da3){if(_0x5e3da3){var _0x285900=typeof _0x5192b8[_0xf18a('0x1e')]===_0xf18a('0x1f')&&typeof _0x5192b8['limit']===_0xf18a('0x1f');var _0x4a348e=_0x5e3da3[_0xf18a('0x20')];var _0x31cb63=_0x285900?0x0:_0x5192b8['offset'];var _0x1aa0b2=_0x285900?_0x5e3da3[_0xf18a('0x20')]:_0x5192b8['offset']+_0x5192b8[_0xf18a('0x21')];var _0x42854d;if(_0x1aa0b2>=_0x4a348e){_0x1aa0b2=_0x4a348e;_0x42854d=0xc8;}else{_0x42854d=0xce;}_0x23c8f1[_0xf18a('0x1c')](_0x42854d);return _0x23c8f1['set']('Content-Range',_0x31cb63+'-'+_0x1aa0b2+'/'+_0x4a348e)[_0xf18a('0x1d')](_0x5e3da3);}return null;};}function patchUpdates(_0x4438ed){return function(_0xabe9a2){try{jsonpatch[_0xf18a('0x22')](_0xabe9a2,_0x4438ed,!![]);}catch(_0x1ad933){return BPromise[_0xf18a('0x23')](_0x1ad933);}return _0xabe9a2[_0xf18a('0x24')]();};}function saveUpdates(_0x304bd4,_0xa5e2c7){return function(_0x56778f){if(_0x56778f){return _0x56778f[_0xf18a('0x25')](_0x304bd4)[_0xf18a('0x26')](function(_0x179b4e){return _0x179b4e;});}return null;};}function removeEntity(_0x30609e,_0x5dd917){return function(_0x44369e){if(_0x44369e){return _0x44369e[_0xf18a('0x27')]()[_0xf18a('0x26')](function(){_0x30609e['status'](0xcc)[_0xf18a('0x28')]();});}};}function handleEntityNotFound(_0x40d6d3,_0xf7e6c2){return function(_0x39d746){if(!_0x39d746){_0x40d6d3['sendStatus'](0x194);}return _0x39d746;};}function handleError(_0x3d0eeb,_0x348644){_0x348644=_0x348644||0x1f4;return function(_0x53ba5b){logger['error'](_0x53ba5b[_0xf18a('0x29')]);if(_0x53ba5b[_0xf18a('0x2a')]){delete _0x53ba5b[_0xf18a('0x2a')];}_0x3d0eeb[_0xf18a('0x1c')](_0x348644)['send'](_0x53ba5b);};}exports[_0xf18a('0x2b')]=function(_0x40596f,_0x3a70a2){var _0x28d654={'raw':![],'where':{'id':_0x40596f[_0xf18a('0x2c')]['id']}},_0x3a9b89={};_0x3a9b89['model']=_['keys'](db[_0xf18a('0x2d')][_0xf18a('0x2e')]);_0x3a9b89[_0xf18a('0x2f')]=_['keys'](_0x40596f['query']);_0x3a9b89[_0xf18a('0x30')]=_[_0xf18a('0x31')](_0x3a9b89[_0xf18a('0x32')],_0x3a9b89[_0xf18a('0x2f')]);_0x28d654[_0xf18a('0x33')]=_[_0xf18a('0x31')](_0x3a9b89['model'],qs[_0xf18a('0x34')](_0x40596f[_0xf18a('0x2f')]['fields']));_0x28d654[_0xf18a('0x33')]=_0x28d654['attributes'][_0xf18a('0x35')]?_0x28d654[_0xf18a('0x33')]:_0x3a9b89['model'];if(_0x40596f['query'][_0xf18a('0x36')]){_0x28d654[_0xf18a('0x37')]=[{'all':!![]}];}_0x28d654=_[_0xf18a('0x38')]({},_0x28d654,_0x40596f[_0xf18a('0x39')]);return db['DashboardItem'][_0xf18a('0x3a')](_0x28d654)[_0xf18a('0x26')](handleEntityNotFound(_0x3a70a2,null))['then'](respondWithResult(_0x3a70a2,null))[_0xf18a('0x3b')](handleError(_0x3a70a2,null));};exports[_0xf18a('0x27')]=function(_0x10a115,_0x5dcc76){return db['DashboardItem'][_0xf18a('0x3a')]({'where':{'id':_0x10a115[_0xf18a('0x2c')]['id']}})[_0xf18a('0x26')](handleEntityNotFound(_0x5dcc76,null))[_0xf18a('0x26')](removeEntity(_0x5dcc76,null))[_0xf18a('0x3b')](handleError(_0x5dcc76,null));};function widgetAttributes(_0x3ef4d1){try{switch(_0x3ef4d1[_0xf18a('0x3c')]){case _0xf18a('0x3d'):return[{'name':_0xf18a('0x3e'),'value':_0x3ef4d1[_0xf18a('0x3e')]||(_0x3ef4d1['attrs']&&_0x3ef4d1[_0xf18a('0x3f')][0x0]?_0x3ef4d1[_0xf18a('0x3f')][0x0]['value']:undefined)||_0xf18a('0x40')}];case'custom':return[{'name':_0xf18a('0x41'),'value':_0x3ef4d1[_0xf18a('0x41')]||(_0x3ef4d1[_0xf18a('0x3f')]&&_0x3ef4d1['attrs'][0x0]?_0x3ef4d1[_0xf18a('0x3f')][0x0][_0xf18a('0x42')]:undefined)||''}];case'clock':return[{'name':_0xf18a('0x43'),'value':_0x3ef4d1[_0xf18a('0x43')]||(_0x3ef4d1[_0xf18a('0x3f')]&&_0x3ef4d1['attrs'][0x0]?_0x3ef4d1['attrs'][0x0][_0xf18a('0x42')]:undefined)||_0xf18a('0x44')},{'name':_0xf18a('0x45'),'value':_0x3ef4d1['attrTimezone']||(_0x3ef4d1[_0xf18a('0x3f')]&&_0x3ef4d1[_0xf18a('0x3f')][0x1]?_0x3ef4d1['attrs'][0x1][_0xf18a('0x42')]:undefined)||'0.00'},{'name':_0xf18a('0x46'),'value':_0x3ef4d1[_0xf18a('0x46')]||(_0x3ef4d1[_0xf18a('0x3f')]&&_0x3ef4d1[_0xf18a('0x3f')][0x2]?_0x3ef4d1[_0xf18a('0x3f')][0x2]['value']:undefined)||0xc}];case _0xf18a('0x47'):return[{'name':_0xf18a('0x48'),'value':_0x3ef4d1[_0xf18a('0x48')]||(_0x3ef4d1[_0xf18a('0x3f')]&&_0x3ef4d1[_0xf18a('0x3f')][0x0]?_0x3ef4d1[_0xf18a('0x3f')][0x0][_0xf18a('0x42')]:undefined)||'total'},{'name':_0xf18a('0x49'),'value':_0x3ef4d1[_0xf18a('0x49')]||(_0x3ef4d1[_0xf18a('0x3f')]&&_0x3ef4d1[_0xf18a('0x3f')][0x1]?_0x3ef4d1[_0xf18a('0x3f')][0x1]['value']:undefined)||[]},{'name':_0xf18a('0x46'),'value':_0x3ef4d1[_0xf18a('0x46')]||(_0x3ef4d1['attrs']&&_0x3ef4d1[_0xf18a('0x3f')][0x2]?_0x3ef4d1[_0xf18a('0x3f')][0x2][_0xf18a('0x42')]:undefined)||0x14},{'name':_0xf18a('0x4a'),'value':_0x3ef4d1[_0xf18a('0x4a')]||(_0x3ef4d1['attrs']&&_0x3ef4d1['attrs'][0x3]?_0x3ef4d1['attrs'][0x3]['value']:undefined)||_0xf18a('0x4b')},{'name':_0xf18a('0x4c'),'value':_0x3ef4d1[_0xf18a('0x4c')]||(_0x3ef4d1[_0xf18a('0x3f')]&&_0x3ef4d1[_0xf18a('0x3f')][0x4]?_0x3ef4d1[_0xf18a('0x3f')][0x4][_0xf18a('0x42')]:undefined)||''},{'name':'attrFaxAccounts','value':_0x3ef4d1[_0xf18a('0x4d')]||(_0x3ef4d1[_0xf18a('0x3f')]&&_0x3ef4d1['attrs'][0x5]?_0x3ef4d1[_0xf18a('0x3f')][0x5][_0xf18a('0x42')]:undefined)||''},{'name':_0xf18a('0x4e'),'value':_0x3ef4d1[_0xf18a('0x4e')]||(_0x3ef4d1[_0xf18a('0x3f')]&&_0x3ef4d1[_0xf18a('0x3f')][0x6]?_0x3ef4d1[_0xf18a('0x3f')][0x6]['value']:undefined)||''},{'name':_0xf18a('0x4f'),'value':_0x3ef4d1[_0xf18a('0x4f')]||(_0x3ef4d1['attrs']&&_0x3ef4d1[_0xf18a('0x3f')][0x7]?_0x3ef4d1[_0xf18a('0x3f')][0x7][_0xf18a('0x42')]:undefined)||''},{'name':_0xf18a('0x50'),'value':_0x3ef4d1['attrWhatsappAccounts']||(_0x3ef4d1[_0xf18a('0x3f')]&&_0x3ef4d1[_0xf18a('0x3f')][0x8]?_0x3ef4d1[_0xf18a('0x3f')][0x8][_0xf18a('0x42')]:undefined)||''},{'name':_0xf18a('0x51'),'value':_0x3ef4d1['attrChatWebsites']||(_0x3ef4d1[_0xf18a('0x3f')]&&_0x3ef4d1[_0xf18a('0x3f')][0x9]?_0x3ef4d1[_0xf18a('0x3f')][0x9][_0xf18a('0x42')]:undefined)||''}];case _0xf18a('0x52'):case _0xf18a('0x53'):return[{'name':_0xf18a('0x54'),'value':_0x3ef4d1[_0xf18a('0x54')]||(_0x3ef4d1[_0xf18a('0x3f')]&&_0x3ef4d1[_0xf18a('0x3f')][0x0]?_0x3ef4d1[_0xf18a('0x3f')][0x0][_0xf18a('0x42')]:undefined)||_0xf18a('0x55')},{'name':'attrSerie2','value':_0x3ef4d1[_0xf18a('0x56')]||(_0x3ef4d1[_0xf18a('0x3f')]&&_0x3ef4d1[_0xf18a('0x3f')][0x1]?_0x3ef4d1[_0xf18a('0x3f')][0x1][_0xf18a('0x42')]:undefined)||null},{'name':_0xf18a('0x57'),'value':_0x3ef4d1[_0xf18a('0x57')]||(_0x3ef4d1[_0xf18a('0x3f')]&&_0x3ef4d1[_0xf18a('0x3f')][0x2]?_0x3ef4d1[_0xf18a('0x3f')][0x2]['value']:undefined)||null},{'name':_0xf18a('0x49'),'value':_0x3ef4d1[_0xf18a('0x49')]||(_0x3ef4d1[_0xf18a('0x3f')]&&_0x3ef4d1['attrs'][0x3]?_0x3ef4d1[_0xf18a('0x3f')][0x3][_0xf18a('0x42')]:undefined)||[]},{'name':'attrChannel','value':_0x3ef4d1['attrChannel']||(_0x3ef4d1[_0xf18a('0x3f')]&&_0x3ef4d1['attrs'][0x4]?_0x3ef4d1[_0xf18a('0x3f')][0x4][_0xf18a('0x42')]:undefined)||_0xf18a('0x4b')},{'name':'attrEmailAccounts','value':_0x3ef4d1[_0xf18a('0x4c')]||(_0x3ef4d1[_0xf18a('0x3f')]&&_0x3ef4d1[_0xf18a('0x3f')][0x5]?_0x3ef4d1[_0xf18a('0x3f')][0x5]['value']:undefined)||''},{'name':_0xf18a('0x4d'),'value':_0x3ef4d1[_0xf18a('0x4d')]||(_0x3ef4d1['attrs']&&_0x3ef4d1[_0xf18a('0x3f')][0x6]?_0x3ef4d1[_0xf18a('0x3f')][0x6][_0xf18a('0x42')]:undefined)||''},{'name':_0xf18a('0x4e'),'value':_0x3ef4d1['attrSmsAccounts']||(_0x3ef4d1['attrs']&&_0x3ef4d1['attrs'][0x7]?_0x3ef4d1[_0xf18a('0x3f')][0x7]['value']:undefined)||''},{'name':'attrOpenchannelAccounts','value':_0x3ef4d1[_0xf18a('0x4f')]||(_0x3ef4d1[_0xf18a('0x3f')]&&_0x3ef4d1[_0xf18a('0x3f')][0x8]?_0x3ef4d1[_0xf18a('0x3f')][0x8][_0xf18a('0x42')]:undefined)||''},{'name':_0xf18a('0x50'),'value':_0x3ef4d1[_0xf18a('0x50')]||(_0x3ef4d1[_0xf18a('0x3f')]&&_0x3ef4d1[_0xf18a('0x3f')][0x9]?_0x3ef4d1[_0xf18a('0x3f')][0x9][_0xf18a('0x42')]:undefined)||''},{'name':_0xf18a('0x51'),'value':_0x3ef4d1[_0xf18a('0x51')]||(_0x3ef4d1[_0xf18a('0x3f')]&&_0x3ef4d1[_0xf18a('0x3f')][0xa]?_0x3ef4d1[_0xf18a('0x3f')][0xa][_0xf18a('0x42')]:undefined)||''}];case _0xf18a('0x58'):return[{'name':_0xf18a('0x59'),'type':_0x3ef4d1[_0xf18a('0x5a')]||(_0x3ef4d1[_0xf18a('0x3f')]&&_0x3ef4d1[_0xf18a('0x3f')][0x0]?_0x3ef4d1[_0xf18a('0x3f')][0x0][_0xf18a('0x3c')]:undefined)||null,'value':_0x3ef4d1[_0xf18a('0x59')]||(_0x3ef4d1['attrs']&&_0x3ef4d1['attrs'][0x0]?_0x3ef4d1['attrs'][0x0]['value']:undefined)||null},{'name':_0xf18a('0x5b'),'value':_0x3ef4d1[_0xf18a('0x5b')]||(_0x3ef4d1[_0xf18a('0x3f')]&&_0x3ef4d1[_0xf18a('0x3f')][0x1]?_0x3ef4d1[_0xf18a('0x3f')][0x1]['value']:undefined)||0x0}];default:return[];}}catch(_0x33e302){logger[_0xf18a('0x5c')](_0xf18a('0x5d'),JSON[_0xf18a('0x5e')](_0x33e302));return[];}}exports[_0xf18a('0x5f')]=function(_0x2ef561,_0x27ea99){if(_0x2ef561[_0xf18a('0x60')]){_0x2ef561[_0xf18a('0x60')][_0xf18a('0x3f')]=widgetAttributes(_0x2ef561[_0xf18a('0x60')]);}return db[_0xf18a('0x2d')][_0xf18a('0x5f')](_0x2ef561[_0xf18a('0x60')],{})[_0xf18a('0x26')](respondWithResult(_0x27ea99,0xc9))[_0xf18a('0x3b')](handleError(_0x27ea99,null));};exports[_0xf18a('0x25')]=function(_0x20e4b1,_0x37b7b2){if(_0x20e4b1['body']['id']){delete _0x20e4b1[_0xf18a('0x60')]['id'];}_0x20e4b1[_0xf18a('0x60')][_0xf18a('0x3f')]=widgetAttributes(_0x20e4b1['body']);return db[_0xf18a('0x2d')][_0xf18a('0x3a')]({'where':{'id':_0x20e4b1[_0xf18a('0x2c')]['id']}})[_0xf18a('0x26')](handleEntityNotFound(_0x37b7b2,null))[_0xf18a('0x26')](saveUpdates(_0x20e4b1[_0xf18a('0x60')],null))[_0xf18a('0x26')](respondWithResult(_0x37b7b2,null))[_0xf18a('0x3b')](handleError(_0x37b7b2,null));}; \ No newline at end of file +var _0x0dd6=['attrChatWebsites','multibar-chart','pie-chart','attrSerie1','attrSerie2','attrSerie3','attrReport','reportType','attrRefresh','stringify','create','body','zip-dir','fast-json-patch','request-promise','moment','bluebird','mustache','util','path','sox','ejs','lodash','crypto','jsforce','desk.js','to-csv','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/environment','../../mysqldb','redis','localhost','./dashboardItem.socket','sendStatus','status','undefined','limit','count','offset','Content-Range','json','apply','reject','save','update','then','end','error','stack','name','params','model','keys','DashboardItem','filters','intersection','query','fields','length','includeAll','include','options','find','catch','type','attrUrl','attrs','custom','attrPath','value','clock','attrHourFormat','HH:mm:ss','attrTimezone','0.00','attrFontSize','counter','attrMetric','total','attrVoiceQueues','attrChannel','voice','attrEmailAccounts','attrFaxAccounts','attrSmsAccounts','attrOpenchannelAccounts','attrWhatsappAccounts'];(function(_0xe2d219,_0x5cf8a9){var _0x5a172a=function(_0x2ac46d){while(--_0x2ac46d){_0xe2d219['push'](_0xe2d219['shift']());}};_0x5a172a(++_0x5cf8a9);}(_0x0dd6,0xca));var _0x60dd=function(_0x4f0dca,_0x291bdf){_0x4f0dca=_0x4f0dca-0x0;var _0x333166=_0x0dd6[_0x4f0dca];return _0x333166;};'use strict';var emlformat=require('eml-format');var rimraf=require('rimraf');var zipdir=require(_0x60dd('0x0'));var jsonpatch=require(_0x60dd('0x1'));var rp=require(_0x60dd('0x2'));var moment=require(_0x60dd('0x3'));var BPromise=require(_0x60dd('0x4'));var Mustache=require(_0x60dd('0x5'));var util=require(_0x60dd('0x6'));var path=require(_0x60dd('0x7'));var sox=require(_0x60dd('0x8'));var csv=require('to-csv');var ejs=require(_0x60dd('0x9'));var fs=require('fs');var fs_extra=require('fs-extra');var _=require(_0x60dd('0xa'));var squel=require('squel');var crypto=require(_0x60dd('0xb'));var jsforce=require(_0x60dd('0xc'));var deskjs=require(_0x60dd('0xd'));var toCsv=require(_0x60dd('0xe'));var querystring=require(_0x60dd('0xf'));var Papa=require(_0x60dd('0x10'));var Redis=require(_0x60dd('0x11'));var authService=require(_0x60dd('0x12'));var qs=require('../../components/parsers/qs');var as=require(_0x60dd('0x13'));var hardwareService=require(_0x60dd('0x14'));var logger=require(_0x60dd('0x15'))(_0x60dd('0x16'));var utils=require(_0x60dd('0x17'));var config=require(_0x60dd('0x18'));var licenseUtil=require('../../config/license/util');var db=require(_0x60dd('0x19'))['db'];config[_0x60dd('0x1a')]=_['defaults'](config[_0x60dd('0x1a')],{'host':_0x60dd('0x1b'),'port':0x18eb});var socket=require('socket.io-emitter')(new Redis(config[_0x60dd('0x1a')]));require(_0x60dd('0x1c'))['register'](socket);function respondWithStatusCode(_0x3a0b16,_0x21d8b3){_0x21d8b3=_0x21d8b3||0xcc;return function(_0x1d41fb){if(_0x1d41fb){return _0x3a0b16[_0x60dd('0x1d')](_0x21d8b3);}return _0x3a0b16[_0x60dd('0x1e')](_0x21d8b3)['end']();};}function respondWithResult(_0x1822e9,_0x438d07){_0x438d07=_0x438d07||0xc8;return function(_0x477545){if(_0x477545){return _0x1822e9[_0x60dd('0x1e')](_0x438d07)['json'](_0x477545);}};}function respondWithFilteredResult(_0x5e2c06,_0x280fc8){return function(_0x291845){if(_0x291845){var _0x22be59=typeof _0x280fc8['offset']===_0x60dd('0x1f')&&typeof _0x280fc8[_0x60dd('0x20')]==='undefined';var _0xf19dc0=_0x291845[_0x60dd('0x21')];var _0x22c520=_0x22be59?0x0:_0x280fc8[_0x60dd('0x22')];var _0x3856c8=_0x22be59?_0x291845[_0x60dd('0x21')]:_0x280fc8[_0x60dd('0x22')]+_0x280fc8[_0x60dd('0x20')];var _0x42e2c6;if(_0x3856c8>=_0xf19dc0){_0x3856c8=_0xf19dc0;_0x42e2c6=0xc8;}else{_0x42e2c6=0xce;}_0x5e2c06[_0x60dd('0x1e')](_0x42e2c6);return _0x5e2c06['set'](_0x60dd('0x23'),_0x22c520+'-'+_0x3856c8+'/'+_0xf19dc0)[_0x60dd('0x24')](_0x291845);}return null;};}function patchUpdates(_0x41933a){return function(_0x451bf2){try{jsonpatch[_0x60dd('0x25')](_0x451bf2,_0x41933a,!![]);}catch(_0x5cee8e){return BPromise[_0x60dd('0x26')](_0x5cee8e);}return _0x451bf2[_0x60dd('0x27')]();};}function saveUpdates(_0xd99117,_0x13356b){return function(_0xd0dc0d){if(_0xd0dc0d){return _0xd0dc0d[_0x60dd('0x28')](_0xd99117)[_0x60dd('0x29')](function(_0x521284){return _0x521284;});}return null;};}function removeEntity(_0x2ad5f5,_0x3b3101){return function(_0x326c50){if(_0x326c50){return _0x326c50['destroy']()[_0x60dd('0x29')](function(){_0x2ad5f5[_0x60dd('0x1e')](0xcc)[_0x60dd('0x2a')]();});}};}function handleEntityNotFound(_0xad92b8,_0x7a10c6){return function(_0x30a378){if(!_0x30a378){_0xad92b8[_0x60dd('0x1d')](0x194);}return _0x30a378;};}function handleError(_0x2ce1b9,_0x54fa69){_0x54fa69=_0x54fa69||0x1f4;return function(_0xf5d071){logger[_0x60dd('0x2b')](_0xf5d071[_0x60dd('0x2c')]);if(_0xf5d071['name']){delete _0xf5d071[_0x60dd('0x2d')];}_0x2ce1b9[_0x60dd('0x1e')](_0x54fa69)['send'](_0xf5d071);};}exports['show']=function(_0x2dbcf8,_0x342f71){var _0x23bc5d={'raw':![],'where':{'id':_0x2dbcf8[_0x60dd('0x2e')]['id']}},_0x34bd2e={};_0x34bd2e[_0x60dd('0x2f')]=_[_0x60dd('0x30')](db[_0x60dd('0x31')]['rawAttributes']);_0x34bd2e['query']=_['keys'](_0x2dbcf8['query']);_0x34bd2e[_0x60dd('0x32')]=_[_0x60dd('0x33')](_0x34bd2e[_0x60dd('0x2f')],_0x34bd2e[_0x60dd('0x34')]);_0x23bc5d['attributes']=_[_0x60dd('0x33')](_0x34bd2e[_0x60dd('0x2f')],qs['fields'](_0x2dbcf8['query'][_0x60dd('0x35')]));_0x23bc5d['attributes']=_0x23bc5d['attributes'][_0x60dd('0x36')]?_0x23bc5d['attributes']:_0x34bd2e[_0x60dd('0x2f')];if(_0x2dbcf8[_0x60dd('0x34')][_0x60dd('0x37')]){_0x23bc5d[_0x60dd('0x38')]=[{'all':!![]}];}_0x23bc5d=_['merge']({},_0x23bc5d,_0x2dbcf8[_0x60dd('0x39')]);return db['DashboardItem'][_0x60dd('0x3a')](_0x23bc5d)[_0x60dd('0x29')](handleEntityNotFound(_0x342f71,null))[_0x60dd('0x29')](respondWithResult(_0x342f71,null))['catch'](handleError(_0x342f71,null));};exports['destroy']=function(_0x3e9920,_0x21d4b7){return db['DashboardItem'][_0x60dd('0x3a')]({'where':{'id':_0x3e9920[_0x60dd('0x2e')]['id']}})[_0x60dd('0x29')](handleEntityNotFound(_0x21d4b7,null))[_0x60dd('0x29')](removeEntity(_0x21d4b7,null))[_0x60dd('0x3b')](handleError(_0x21d4b7,null));};function widgetAttributes(_0x34de60){try{switch(_0x34de60[_0x60dd('0x3c')]){case'iframe':return[{'name':'attrUrl','value':_0x34de60[_0x60dd('0x3d')]||(_0x34de60['attrs']&&_0x34de60[_0x60dd('0x3e')][0x0]?_0x34de60[_0x60dd('0x3e')][0x0]['value']:undefined)||'https://'}];case _0x60dd('0x3f'):return[{'name':_0x60dd('0x40'),'value':_0x34de60[_0x60dd('0x40')]||(_0x34de60[_0x60dd('0x3e')]&&_0x34de60[_0x60dd('0x3e')][0x0]?_0x34de60[_0x60dd('0x3e')][0x0][_0x60dd('0x41')]:undefined)||''}];case _0x60dd('0x42'):return[{'name':_0x60dd('0x43'),'value':_0x34de60[_0x60dd('0x43')]||(_0x34de60[_0x60dd('0x3e')]&&_0x34de60['attrs'][0x0]?_0x34de60['attrs'][0x0][_0x60dd('0x41')]:undefined)||_0x60dd('0x44')},{'name':_0x60dd('0x45'),'value':_0x34de60[_0x60dd('0x45')]||(_0x34de60[_0x60dd('0x3e')]&&_0x34de60[_0x60dd('0x3e')][0x1]?_0x34de60[_0x60dd('0x3e')][0x1][_0x60dd('0x41')]:undefined)||_0x60dd('0x46')},{'name':_0x60dd('0x47'),'value':_0x34de60[_0x60dd('0x47')]||(_0x34de60['attrs']&&_0x34de60[_0x60dd('0x3e')][0x2]?_0x34de60[_0x60dd('0x3e')][0x2][_0x60dd('0x41')]:undefined)||0xc}];case _0x60dd('0x48'):return[{'name':'attrMetric','value':_0x34de60[_0x60dd('0x49')]||(_0x34de60[_0x60dd('0x3e')]&&_0x34de60[_0x60dd('0x3e')][0x0]?_0x34de60[_0x60dd('0x3e')][0x0][_0x60dd('0x41')]:undefined)||_0x60dd('0x4a')},{'name':_0x60dd('0x4b'),'value':_0x34de60[_0x60dd('0x4b')]||(_0x34de60[_0x60dd('0x3e')]&&_0x34de60[_0x60dd('0x3e')][0x1]?_0x34de60[_0x60dd('0x3e')][0x1][_0x60dd('0x41')]:undefined)||[]},{'name':_0x60dd('0x47'),'value':_0x34de60[_0x60dd('0x47')]||(_0x34de60[_0x60dd('0x3e')]&&_0x34de60[_0x60dd('0x3e')][0x2]?_0x34de60[_0x60dd('0x3e')][0x2][_0x60dd('0x41')]:undefined)||0x14},{'name':_0x60dd('0x4c'),'value':_0x34de60[_0x60dd('0x4c')]||(_0x34de60[_0x60dd('0x3e')]&&_0x34de60[_0x60dd('0x3e')][0x3]?_0x34de60[_0x60dd('0x3e')][0x3][_0x60dd('0x41')]:undefined)||_0x60dd('0x4d')},{'name':_0x60dd('0x4e'),'value':_0x34de60[_0x60dd('0x4e')]||(_0x34de60[_0x60dd('0x3e')]&&_0x34de60[_0x60dd('0x3e')][0x4]?_0x34de60[_0x60dd('0x3e')][0x4][_0x60dd('0x41')]:undefined)||''},{'name':'attrFaxAccounts','value':_0x34de60[_0x60dd('0x4f')]||(_0x34de60['attrs']&&_0x34de60[_0x60dd('0x3e')][0x5]?_0x34de60[_0x60dd('0x3e')][0x5]['value']:undefined)||''},{'name':_0x60dd('0x50'),'value':_0x34de60[_0x60dd('0x50')]||(_0x34de60[_0x60dd('0x3e')]&&_0x34de60[_0x60dd('0x3e')][0x6]?_0x34de60['attrs'][0x6][_0x60dd('0x41')]:undefined)||''},{'name':_0x60dd('0x51'),'value':_0x34de60['attrOpenchannelAccounts']||(_0x34de60[_0x60dd('0x3e')]&&_0x34de60[_0x60dd('0x3e')][0x7]?_0x34de60[_0x60dd('0x3e')][0x7][_0x60dd('0x41')]:undefined)||''},{'name':'attrWhatsappAccounts','value':_0x34de60[_0x60dd('0x52')]||(_0x34de60['attrs']&&_0x34de60[_0x60dd('0x3e')][0x8]?_0x34de60['attrs'][0x8][_0x60dd('0x41')]:undefined)||''},{'name':_0x60dd('0x53'),'value':_0x34de60[_0x60dd('0x53')]||(_0x34de60[_0x60dd('0x3e')]&&_0x34de60['attrs'][0x9]?_0x34de60['attrs'][0x9][_0x60dd('0x41')]:undefined)||''}];case _0x60dd('0x54'):case _0x60dd('0x55'):return[{'name':_0x60dd('0x56'),'value':_0x34de60[_0x60dd('0x56')]||(_0x34de60['attrs']&&_0x34de60[_0x60dd('0x3e')][0x0]?_0x34de60[_0x60dd('0x3e')][0x0]['value']:undefined)||_0x60dd('0x4a')},{'name':'attrSerie2','value':_0x34de60[_0x60dd('0x57')]||(_0x34de60[_0x60dd('0x3e')]&&_0x34de60[_0x60dd('0x3e')][0x1]?_0x34de60[_0x60dd('0x3e')][0x1][_0x60dd('0x41')]:undefined)||null},{'name':_0x60dd('0x58'),'value':_0x34de60['attrSerie3']||(_0x34de60[_0x60dd('0x3e')]&&_0x34de60[_0x60dd('0x3e')][0x2]?_0x34de60[_0x60dd('0x3e')][0x2]['value']:undefined)||null},{'name':_0x60dd('0x4b'),'value':_0x34de60[_0x60dd('0x4b')]||(_0x34de60['attrs']&&_0x34de60['attrs'][0x3]?_0x34de60[_0x60dd('0x3e')][0x3][_0x60dd('0x41')]:undefined)||[]},{'name':'attrChannel','value':_0x34de60[_0x60dd('0x4c')]||(_0x34de60[_0x60dd('0x3e')]&&_0x34de60[_0x60dd('0x3e')][0x4]?_0x34de60[_0x60dd('0x3e')][0x4]['value']:undefined)||_0x60dd('0x4d')},{'name':'attrEmailAccounts','value':_0x34de60[_0x60dd('0x4e')]||(_0x34de60[_0x60dd('0x3e')]&&_0x34de60[_0x60dd('0x3e')][0x5]?_0x34de60[_0x60dd('0x3e')][0x5][_0x60dd('0x41')]:undefined)||''},{'name':_0x60dd('0x4f'),'value':_0x34de60[_0x60dd('0x4f')]||(_0x34de60[_0x60dd('0x3e')]&&_0x34de60[_0x60dd('0x3e')][0x6]?_0x34de60[_0x60dd('0x3e')][0x6][_0x60dd('0x41')]:undefined)||''},{'name':_0x60dd('0x50'),'value':_0x34de60['attrSmsAccounts']||(_0x34de60[_0x60dd('0x3e')]&&_0x34de60[_0x60dd('0x3e')][0x7]?_0x34de60[_0x60dd('0x3e')][0x7][_0x60dd('0x41')]:undefined)||''},{'name':'attrOpenchannelAccounts','value':_0x34de60['attrOpenchannelAccounts']||(_0x34de60['attrs']&&_0x34de60[_0x60dd('0x3e')][0x8]?_0x34de60[_0x60dd('0x3e')][0x8][_0x60dd('0x41')]:undefined)||''},{'name':_0x60dd('0x52'),'value':_0x34de60[_0x60dd('0x52')]||(_0x34de60[_0x60dd('0x3e')]&&_0x34de60[_0x60dd('0x3e')][0x9]?_0x34de60[_0x60dd('0x3e')][0x9][_0x60dd('0x41')]:undefined)||''},{'name':'attrChatWebsites','value':_0x34de60[_0x60dd('0x53')]||(_0x34de60[_0x60dd('0x3e')]&&_0x34de60[_0x60dd('0x3e')][0xa]?_0x34de60[_0x60dd('0x3e')][0xa][_0x60dd('0x41')]:undefined)||''}];case'web-report':return[{'name':_0x60dd('0x59'),'type':_0x34de60[_0x60dd('0x5a')]||(_0x34de60[_0x60dd('0x3e')]&&_0x34de60[_0x60dd('0x3e')][0x0]?_0x34de60[_0x60dd('0x3e')][0x0]['type']:undefined)||null,'value':_0x34de60[_0x60dd('0x59')]||(_0x34de60['attrs']&&_0x34de60[_0x60dd('0x3e')][0x0]?_0x34de60[_0x60dd('0x3e')][0x0]['value']:undefined)||null},{'name':'attrRefresh','value':_0x34de60[_0x60dd('0x5b')]||(_0x34de60['attrs']&&_0x34de60[_0x60dd('0x3e')][0x1]?_0x34de60[_0x60dd('0x3e')][0x1][_0x60dd('0x41')]:undefined)||0x0}];default:return[];}}catch(_0x58e9c6){logger['error']('widgetAttributes:\x20%s',JSON[_0x60dd('0x5c')](_0x58e9c6));return[];}}exports[_0x60dd('0x5d')]=function(_0x1122a9,_0x6a8745){if(_0x1122a9['body']){_0x1122a9['body'][_0x60dd('0x3e')]=widgetAttributes(_0x1122a9[_0x60dd('0x5e')]);}return db['DashboardItem']['create'](_0x1122a9['body'],{})[_0x60dd('0x29')](respondWithResult(_0x6a8745,0xc9))['catch'](handleError(_0x6a8745,null));};exports[_0x60dd('0x28')]=function(_0x1f920b,_0x3af5f6){if(_0x1f920b[_0x60dd('0x5e')]['id']){delete _0x1f920b[_0x60dd('0x5e')]['id'];}_0x1f920b[_0x60dd('0x5e')][_0x60dd('0x3e')]=widgetAttributes(_0x1f920b[_0x60dd('0x5e')]);return db['DashboardItem'][_0x60dd('0x3a')]({'where':{'id':_0x1f920b[_0x60dd('0x2e')]['id']}})[_0x60dd('0x29')](handleEntityNotFound(_0x3af5f6,null))[_0x60dd('0x29')](saveUpdates(_0x1f920b[_0x60dd('0x5e')],null))[_0x60dd('0x29')](respondWithResult(_0x3af5f6,null))[_0x60dd('0x3b')](handleError(_0x3af5f6,null));}; \ No newline at end of file diff --git a/server/api/dashboardItem/dashboardItem.events.js b/server/api/dashboardItem/dashboardItem.events.js index 97f260f..b3a936e 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 _0x2051=['emit','exports','events','../../mysqldb','DashboardItem','setMaxListeners','save','update','remove'];(function(_0x49357e,_0x529213){var _0x2c7ebe=function(_0x3da05b){while(--_0x3da05b){_0x49357e['push'](_0x49357e['shift']());}};_0x2c7ebe(++_0x529213);}(_0x2051,0x161));var _0x1205=function(_0x5398df,_0x1543b5){_0x5398df=_0x5398df-0x0;var _0x158b88=_0x2051[_0x5398df];return _0x158b88;};'use strict';var EventEmitter=require(_0x1205('0x0'));var DashboardItem=require(_0x1205('0x1'))['db'][_0x1205('0x2')];var DashboardItemEvents=new EventEmitter();DashboardItemEvents[_0x1205('0x3')](0x0);var events={'afterCreate':_0x1205('0x4'),'afterUpdate':_0x1205('0x5'),'afterDestroy':_0x1205('0x6')};function emitEvent(_0x44f246){return function(_0x47218e,_0x93a125,_0x9da25){DashboardItemEvents['emit'](_0x44f246+':'+_0x47218e['id'],_0x47218e);DashboardItemEvents[_0x1205('0x7')](_0x44f246,_0x47218e);_0x9da25(null);};}for(var e in events){if(events['hasOwnProperty'](e)){var event=events[e];DashboardItem['hook'](e,emitEvent(event));}}module[_0x1205('0x8')]=DashboardItemEvents; \ No newline at end of file +var _0x300c=['hook','exports','emit'];(function(_0xe2b87,_0x26a531){var _0x4f5f63=function(_0x4a1e7a){while(--_0x4a1e7a){_0xe2b87['push'](_0xe2b87['shift']());}};_0x4f5f63(++_0x26a531);}(_0x300c,0xf8));var _0xc300=function(_0x14e87f,_0x38ea0e){_0x14e87f=_0x14e87f-0x0;var _0x555e5f=_0x300c[_0x14e87f];return _0x555e5f;};'use strict';var EventEmitter=require('events');var DashboardItem=require('../../mysqldb')['db']['DashboardItem'];var DashboardItemEvents=new EventEmitter();DashboardItemEvents['setMaxListeners'](0x0);var events={'afterCreate':'save','afterUpdate':'update','afterDestroy':'remove'};function emitEvent(_0xaa6385){return function(_0x519c07,_0x4bb40a,_0xe07c1f){DashboardItemEvents[_0xc300('0x0')](_0xaa6385+':'+_0x519c07['id'],_0x519c07);DashboardItemEvents['emit'](_0xaa6385,_0x519c07);_0xe07c1f(null);};}for(var e in events){if(events['hasOwnProperty'](e)){var event=events[e];DashboardItem[_0xc300('0x1')](e,emitEvent(event));}}module[_0xc300('0x2')]=DashboardItemEvents; \ No newline at end of file diff --git a/server/api/dashboardItem/dashboardItem.model.js b/server/api/dashboardItem/dashboardItem.model.js index 2198aa8..b90b99c 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 _0xd04b=['lodash','util','../../config/logger','moment','request-promise','path','rimraf','../../config/environment','./dashboardItem.attributes','exports','define','DashboardItem','dashboard_items'];(function(_0x178e48,_0x3c9509){var _0x440d7e=function(_0xc2f8a0){while(--_0xc2f8a0){_0x178e48['push'](_0x178e48['shift']());}};_0x440d7e(++_0x3c9509);}(_0xd04b,0x145));var _0xbd04=function(_0x53312b,_0x58a164){_0x53312b=_0x53312b-0x0;var _0x2a855c=_0xd04b[_0x53312b];return _0x2a855c;};'use strict';var _=require(_0xbd04('0x0'));var util=require(_0xbd04('0x1'));var logger=require(_0xbd04('0x2'))('api');var moment=require(_0xbd04('0x3'));var BPromise=require('bluebird');var rp=require(_0xbd04('0x4'));var fs=require('fs');var path=require(_0xbd04('0x5'));var rimraf=require(_0xbd04('0x6'));var config=require(_0xbd04('0x7'));var attributes=require(_0xbd04('0x8'));module[_0xbd04('0x9')]=function(_0x11d6ce,_0x2d8811){return _0x11d6ce[_0xbd04('0xa')](_0xbd04('0xb'),attributes,{'tableName':_0xbd04('0xc'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0xa39b=['moment','path','rimraf','../../config/environment','./dashboardItem.attributes','define','DashboardItem','lodash','util','../../config/logger','api'];(function(_0x1c6191,_0x56b8ed){var _0x4de3e3=function(_0x20329b){while(--_0x20329b){_0x1c6191['push'](_0x1c6191['shift']());}};_0x4de3e3(++_0x56b8ed);}(_0xa39b,0xee));var _0xba39=function(_0x59ee6f,_0x450239){_0x59ee6f=_0x59ee6f-0x0;var _0x4c0979=_0xa39b[_0x59ee6f];return _0x4c0979;};'use strict';var _=require(_0xba39('0x0'));var util=require(_0xba39('0x1'));var logger=require(_0xba39('0x2'))(_0xba39('0x3'));var moment=require(_0xba39('0x4'));var BPromise=require('bluebird');var rp=require('request-promise');var fs=require('fs');var path=require(_0xba39('0x5'));var rimraf=require(_0xba39('0x6'));var config=require(_0xba39('0x7'));var attributes=require(_0xba39('0x8'));module['exports']=function(_0xf4f1d1,_0x3e1395){return _0xf4f1d1[_0xba39('0x9')](_0xba39('0xa'),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 f739460..14b3652 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 _0xbb47=['result','catch','util','moment','ioredis','../../config/logger','rpc','jayson/promise','client','defaults','localhost','socket.io-emitter','redis','./dashboardItem.socket','register','request','then','info','DashboardItem,\x20%s,\x20%s','request\x20sent','stringify','error','code','message'];(function(_0x75eccc,_0x4c2958){var _0x3ac04b=function(_0x271b34){while(--_0x271b34){_0x75eccc['push'](_0x75eccc['shift']());}};_0x3ac04b(++_0x4c2958);}(_0xbb47,0x1e2));var _0x7bb4=function(_0x56f7e2,_0x145392){_0x56f7e2=_0x56f7e2-0x0;var _0x36240b=_0xbb47[_0x56f7e2];return _0x36240b;};'use strict';var _=require('lodash');var util=require(_0x7bb4('0x0'));var moment=require(_0x7bb4('0x1'));var BPromise=require('bluebird');var rs=require('randomstring');var fs=require('fs');var Redis=require(_0x7bb4('0x2'));var db=require('../../mysqldb')['db'];var utils=require('../../config/utils');var logger=require(_0x7bb4('0x3'))(_0x7bb4('0x4'));var config=require('../../config/environment');var jayson=require(_0x7bb4('0x5'));var client=jayson[_0x7bb4('0x6')]['http']({'port':0x232a});config['redis']=_[_0x7bb4('0x7')](config['redis'],{'host':_0x7bb4('0x8'),'port':0x18eb});var socket=require(_0x7bb4('0x9'))(new Redis(config[_0x7bb4('0xa')]));require(_0x7bb4('0xb'))[_0x7bb4('0xc')](socket);function respondWithRpcPromise(_0x390f11,_0x2f2fcb,_0x19ecc0){return new BPromise(function(_0xfd13f,_0x48da2d){return client[_0x7bb4('0xd')](_0x390f11,_0x19ecc0)[_0x7bb4('0xe')](function(_0xc49ce6){logger[_0x7bb4('0xf')](_0x7bb4('0x10'),_0x2f2fcb,_0x7bb4('0x11'));logger['debug']('DashboardItem,\x20%s,\x20%s,\x20%s',_0x2f2fcb,_0x7bb4('0x11'),JSON[_0x7bb4('0x12')](_0xc49ce6));if(_0xc49ce6[_0x7bb4('0x13')]){if(_0xc49ce6[_0x7bb4('0x13')][_0x7bb4('0x14')]===0x1f4){logger[_0x7bb4('0x13')]('DashboardItem,\x20%s,\x20%s',_0x2f2fcb,_0xc49ce6[_0x7bb4('0x13')][_0x7bb4('0x15')]);return _0x48da2d(_0xc49ce6[_0x7bb4('0x13')][_0x7bb4('0x15')]);}logger['error'](_0x7bb4('0x10'),_0x2f2fcb,_0xc49ce6[_0x7bb4('0x13')]['message']);return _0xfd13f(_0xc49ce6['error']['message']);}else{logger[_0x7bb4('0xf')](_0x7bb4('0x10'),_0x2f2fcb,_0x7bb4('0x11'));_0xfd13f(_0xc49ce6[_0x7bb4('0x16')][_0x7bb4('0x15')]);}})[_0x7bb4('0x17')](function(_0x4d03df){logger[_0x7bb4('0x13')](_0x7bb4('0x10'),_0x2f2fcb,_0x4d03df);_0x48da2d(_0x4d03df);});});} \ No newline at end of file +var _0x8b1f=['debug','DashboardItem,\x20%s,\x20%s,\x20%s','stringify','error','code','DashboardItem,\x20%s,\x20%s','message','request\x20sent','result','util','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','../../config/environment','jayson/promise','client','redis','localhost','socket.io-emitter','./dashboardItem.socket','register','then'];(function(_0x2aa0e7,_0x4e5145){var _0x1472c0=function(_0x4deaeb){while(--_0x4deaeb){_0x2aa0e7['push'](_0x2aa0e7['shift']());}};_0x1472c0(++_0x4e5145);}(_0x8b1f,0x175));var _0xf8b1=function(_0x5164d7,_0x31de32){_0x5164d7=_0x5164d7-0x0;var _0x53f184=_0x8b1f[_0x5164d7];return _0x53f184;};'use strict';var _=require('lodash');var util=require(_0xf8b1('0x0'));var moment=require(_0xf8b1('0x1'));var BPromise=require(_0xf8b1('0x2'));var rs=require(_0xf8b1('0x3'));var fs=require('fs');var Redis=require(_0xf8b1('0x4'));var db=require(_0xf8b1('0x5'))['db'];var utils=require(_0xf8b1('0x6'));var logger=require(_0xf8b1('0x7'))('rpc');var config=require(_0xf8b1('0x8'));var jayson=require(_0xf8b1('0x9'));var client=jayson[_0xf8b1('0xa')]['http']({'port':0x232a});config[_0xf8b1('0xb')]=_['defaults'](config[_0xf8b1('0xb')],{'host':_0xf8b1('0xc'),'port':0x18eb});var socket=require(_0xf8b1('0xd'))(new Redis(config[_0xf8b1('0xb')]));require(_0xf8b1('0xe'))[_0xf8b1('0xf')](socket);function respondWithRpcPromise(_0x4a7201,_0x3bf2b3,_0x13a240){return new BPromise(function(_0x570b22,_0x5ec60c){return client['request'](_0x4a7201,_0x13a240)[_0xf8b1('0x10')](function(_0x285549){logger['info']('DashboardItem,\x20%s,\x20%s',_0x3bf2b3,'request\x20sent');logger[_0xf8b1('0x11')](_0xf8b1('0x12'),_0x3bf2b3,'request\x20sent',JSON[_0xf8b1('0x13')](_0x285549));if(_0x285549[_0xf8b1('0x14')]){if(_0x285549[_0xf8b1('0x14')][_0xf8b1('0x15')]===0x1f4){logger[_0xf8b1('0x14')](_0xf8b1('0x16'),_0x3bf2b3,_0x285549[_0xf8b1('0x14')][_0xf8b1('0x17')]);return _0x5ec60c(_0x285549['error'][_0xf8b1('0x17')]);}logger[_0xf8b1('0x14')](_0xf8b1('0x16'),_0x3bf2b3,_0x285549[_0xf8b1('0x14')][_0xf8b1('0x17')]);return _0x570b22(_0x285549[_0xf8b1('0x14')]['message']);}else{logger['info'](_0xf8b1('0x16'),_0x3bf2b3,_0xf8b1('0x18'));_0x570b22(_0x285549[_0xf8b1('0x19')]['message']);}})['catch'](function(_0x3bac9c){logger['error'](_0xf8b1('0x16'),_0x3bf2b3,_0x3bac9c);_0x5ec60c(_0x3bac9c);});});} \ No newline at end of file diff --git a/server/api/dashboardItem/dashboardItem.socket.js b/server/api/dashboardItem/dashboardItem.socket.js index 824a226..0ac332a 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 _0xa148=['dashboardItem:','./dashboardItem.events','update','emit','removeListener','register','length'];(function(_0x29b609,_0x19d388){var _0x54c952=function(_0xb3c38d){while(--_0xb3c38d){_0x29b609['push'](_0x29b609['shift']());}};_0x54c952(++_0x19d388);}(_0xa148,0x12e));var _0x8a14=function(_0x1b8855,_0x3d2bab){_0x1b8855=_0x1b8855-0x0;var _0x5ec6c1=_0xa148[_0x1b8855];return _0x5ec6c1;};'use strict';var DashboardItemEvents=require(_0x8a14('0x0'));var events=['save','remove',_0x8a14('0x1')];function createListener(_0xdcbc25,_0x12173c){return function(_0x38d146){_0x12173c[_0x8a14('0x2')](_0xdcbc25,_0x38d146);};}function removeListener(_0x47c7ea,_0x934677){return function(){DashboardItemEvents[_0x8a14('0x3')](_0x47c7ea,_0x934677);};}exports[_0x8a14('0x4')]=function(_0x366ed6){for(var _0x3d030e=0x0,_0x369606=events[_0x8a14('0x5')];_0x3d030e<_0x369606;_0x3d030e++){var _0x4928e3=events[_0x3d030e];var _0x48a8a0=createListener(_0x8a14('0x6')+_0x4928e3,_0x366ed6);DashboardItemEvents['on'](_0x4928e3,_0x48a8a0);}}; \ No newline at end of file +var _0x4514=['length','dashboardItem:','./dashboardItem.events','emit','removeListener','register'];(function(_0x20a584,_0xe384a5){var _0x4b41a8=function(_0x2127c6){while(--_0x2127c6){_0x20a584['push'](_0x20a584['shift']());}};_0x4b41a8(++_0xe384a5);}(_0x4514,0x16a));var _0x4451=function(_0x2af030,_0x4b3d0a){_0x2af030=_0x2af030-0x0;var _0x324025=_0x4514[_0x2af030];return _0x324025;};'use strict';var DashboardItemEvents=require(_0x4451('0x0'));var events=['save','remove','update'];function createListener(_0xf89c7f,_0x27ed8c){return function(_0x2adab5){_0x27ed8c[_0x4451('0x1')](_0xf89c7f,_0x2adab5);};}function removeListener(_0x2966fc,_0x59c165){return function(){DashboardItemEvents[_0x4451('0x2')](_0x2966fc,_0x59c165);};}exports[_0x4451('0x3')]=function(_0x2a9805){for(var _0x28b6e9=0x0,_0x6cb57e=events[_0x4451('0x4')];_0x28b6e9<_0x6cb57e;_0x28b6e9++){var _0x256f49=events[_0x28b6e9];var _0x5b93ca=createListener(_0x4451('0x5')+_0x256f49,_0x2a9805);DashboardItemEvents['on'](_0x256f49,_0x5b93ca);}}; \ No newline at end of file diff --git a/server/api/dashboardItem/index.js b/server/api/dashboardItem/index.js index 22b79df..af06ed8 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 _0x8934=['show','create','put','update','delete','destroy','exports','multer','util','path','connect-timeout','express','Router','fs-extra','../../components/auth/service','../../config/environment','./dashboardItem.controller','get','/:id','isAuthenticated'];(function(_0x7187af,_0x506fee){var _0x889841=function(_0x5c750f){while(--_0x5c750f){_0x7187af['push'](_0x7187af['shift']());}};_0x889841(++_0x506fee);}(_0x8934,0x133));var _0x4893=function(_0x308d11,_0x45c8e3){_0x308d11=_0x308d11-0x0;var _0x5a26b4=_0x8934[_0x308d11];return _0x5a26b4;};'use strict';var multer=require(_0x4893('0x0'));var util=require(_0x4893('0x1'));var path=require(_0x4893('0x2'));var timeout=require(_0x4893('0x3'));var express=require(_0x4893('0x4'));var router=express[_0x4893('0x5')]();var fs_extra=require(_0x4893('0x6'));var auth=require(_0x4893('0x7'));var interaction=require('../../components/interaction/service');var config=require(_0x4893('0x8'));var controller=require(_0x4893('0x9'));router[_0x4893('0xa')](_0x4893('0xb'),auth[_0x4893('0xc')](),controller[_0x4893('0xd')]);router['post']('/',auth[_0x4893('0xc')](),controller[_0x4893('0xe')]);router[_0x4893('0xf')](_0x4893('0xb'),auth[_0x4893('0xc')](),controller[_0x4893('0x10')]);router[_0x4893('0x11')](_0x4893('0xb'),auth['isAuthenticated'](),controller[_0x4893('0x12')]);module[_0x4893('0x13')]=router; \ No newline at end of file +var _0x1c64=['fs-extra','../../components/auth/service','../../components/interaction/service','get','/:id','show','post','isAuthenticated','create','put','update','delete','destroy','exports','multer','util','connect-timeout','express','Router'];(function(_0x501510,_0x61caa9){var _0x1e6ee5=function(_0x32845b){while(--_0x32845b){_0x501510['push'](_0x501510['shift']());}};_0x1e6ee5(++_0x61caa9);}(_0x1c64,0xcc));var _0x41c6=function(_0x6310bc,_0x3e44f4){_0x6310bc=_0x6310bc-0x0;var _0x13b361=_0x1c64[_0x6310bc];return _0x13b361;};'use strict';var multer=require(_0x41c6('0x0'));var util=require(_0x41c6('0x1'));var path=require('path');var timeout=require(_0x41c6('0x2'));var express=require(_0x41c6('0x3'));var router=express[_0x41c6('0x4')]();var fs_extra=require(_0x41c6('0x5'));var auth=require(_0x41c6('0x6'));var interaction=require(_0x41c6('0x7'));var config=require('../../config/environment');var controller=require('./dashboardItem.controller');router[_0x41c6('0x8')](_0x41c6('0x9'),auth['isAuthenticated'](),controller[_0x41c6('0xa')]);router[_0x41c6('0xb')]('/',auth[_0x41c6('0xc')](),controller[_0x41c6('0xd')]);router[_0x41c6('0xe')]('/:id',auth['isAuthenticated'](),controller[_0x41c6('0xf')]);router[_0x41c6('0x10')](_0x41c6('0x9'),auth[_0x41c6('0xc')](),controller[_0x41c6('0x11')]);module[_0x41c6('0x12')]=router; \ No newline at end of file diff --git a/server/api/disposition/disposition.attributes.js b/server/api/disposition/disposition.attributes.js index baf9c65..3be5af8 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 _0xde9e=['third','sequelize','exports','STRING','ENUM','first','second'];(function(_0x12a1f5,_0x252768){var _0x2f8009=function(_0x4fed65){while(--_0x4fed65){_0x12a1f5['push'](_0x12a1f5['shift']());}};_0x2f8009(++_0x252768);}(_0xde9e,0xb7));var _0xede9=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0xde9e[_0x3dd15e];return _0x231fd0;};'use strict';var Sequelize=require(_0xede9('0x0'));module[_0xede9('0x1')]={'name':{'type':Sequelize[_0xede9('0x2')],'allowNull':![]},'level':{'type':Sequelize[_0xede9('0x3')](_0xede9('0x4'),_0xede9('0x5'),_0xede9('0x6')),'allowNull':![],'defaultValue':'first'},'description':{'type':Sequelize[_0xede9('0x2')]}}; \ No newline at end of file +var _0xc8b1=['second','third','exports','STRING','ENUM','first'];(function(_0x45092b,_0x4d7b35){var _0xcb285=function(_0x5094a7){while(--_0x5094a7){_0x45092b['push'](_0x45092b['shift']());}};_0xcb285(++_0x4d7b35);}(_0xc8b1,0x1d6));var _0x1c8b=function(_0x327cff,_0x3bd162){_0x327cff=_0x327cff-0x0;var _0x3861f4=_0xc8b1[_0x327cff];return _0x3861f4;};'use strict';var Sequelize=require('sequelize');module[_0x1c8b('0x0')]={'name':{'type':Sequelize[_0x1c8b('0x1')],'allowNull':![]},'level':{'type':Sequelize[_0x1c8b('0x2')](_0x1c8b('0x3'),_0x1c8b('0x4'),_0x1c8b('0x5')),'allowNull':![],'defaultValue':_0x1c8b('0x3')},'description':{'type':Sequelize['STRING']}}; \ No newline at end of file diff --git a/server/api/disposition/disposition.controller.js b/server/api/disposition/disposition.controller.js index f512e42..f880f8e 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 _0x3657=['send','index','Disposition','rawAttributes','fieldName','type','key','model','query','keys','filters','intersection','fields','attributes','nolimit','order','sort','pick','filter','where','merge','map','VIRTUAL','options','includeAll','findAll','rows','catch','params','include','find','create','body','user','Unable\x20to\x20retrieve\x20the\x20current\x20user','role','UserProfileSection','userProfileId','autoAssociation','error','update','rimraf','zip-dir','request-promise','moment','path','sox','to-csv','ejs','fs-extra','lodash','squel','desk.js','querystring','papaparse','ioredis','../../components/parsers/qs','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','sendStatus','end','json','offset','undefined','count','limit','status','set','Content-Range','reject','then','destroy','get','Dispositions','UserProfileResource','stack','name'];(function(_0x27d8bc,_0x19e010){var _0x4b04cb=function(_0x524568){while(--_0x524568){_0x27d8bc['push'](_0x27d8bc['shift']());}};_0x4b04cb(++_0x19e010);}(_0x3657,0xcd));var _0x7365=function(_0x520f7e,_0x67518d){_0x520f7e=_0x520f7e-0x0;var _0x587f49=_0x3657[_0x520f7e];return _0x587f49;};'use strict';var emlformat=require('eml-format');var rimraf=require(_0x7365('0x0'));var zipdir=require(_0x7365('0x1'));var jsonpatch=require('fast-json-patch');var rp=require(_0x7365('0x2'));var moment=require(_0x7365('0x3'));var BPromise=require('bluebird');var Mustache=require('mustache');var util=require('util');var path=require(_0x7365('0x4'));var sox=require(_0x7365('0x5'));var csv=require(_0x7365('0x6'));var ejs=require(_0x7365('0x7'));var fs=require('fs');var fs_extra=require(_0x7365('0x8'));var _=require(_0x7365('0x9'));var squel=require(_0x7365('0xa'));var crypto=require('crypto');var jsforce=require('jsforce');var deskjs=require(_0x7365('0xb'));var toCsv=require(_0x7365('0x6'));var querystring=require(_0x7365('0xc'));var Papa=require(_0x7365('0xd'));var Redis=require(_0x7365('0xe'));var authService=require('../../components/auth/service');var qs=require(_0x7365('0xf'));var as=require('../../components/parsers/advancedSearch');var hardwareService=require(_0x7365('0x10'));var logger=require(_0x7365('0x11'))(_0x7365('0x12'));var utils=require(_0x7365('0x13'));var config=require(_0x7365('0x14'));var licenseUtil=require(_0x7365('0x15'));var db=require(_0x7365('0x16'))['db'];function respondWithStatusCode(_0x2cc1b8,_0x1b0def){_0x1b0def=_0x1b0def||0xcc;return function(_0xfd9359){if(_0xfd9359){return _0x2cc1b8[_0x7365('0x17')](_0x1b0def);}return _0x2cc1b8['status'](_0x1b0def)[_0x7365('0x18')]();};}function respondWithResult(_0x5df9ec,_0x223d8d){_0x223d8d=_0x223d8d||0xc8;return function(_0xf578c7){if(_0xf578c7){return _0x5df9ec['status'](_0x223d8d)[_0x7365('0x19')](_0xf578c7);}};}function respondWithFilteredResult(_0x461cca,_0x50af09){return function(_0x1481a0){if(_0x1481a0){var _0x2d0251=typeof _0x50af09[_0x7365('0x1a')]===_0x7365('0x1b')&&typeof _0x50af09['limit']==='undefined';var _0x42d5ef=_0x1481a0['count'];var _0x2200c3=_0x2d0251?0x0:_0x50af09[_0x7365('0x1a')];var _0x26bd84=_0x2d0251?_0x1481a0[_0x7365('0x1c')]:_0x50af09['offset']+_0x50af09[_0x7365('0x1d')];var _0x3026d4;if(_0x26bd84>=_0x42d5ef){_0x26bd84=_0x42d5ef;_0x3026d4=0xc8;}else{_0x3026d4=0xce;}_0x461cca[_0x7365('0x1e')](_0x3026d4);return _0x461cca[_0x7365('0x1f')](_0x7365('0x20'),_0x2200c3+'-'+_0x26bd84+'/'+_0x42d5ef)[_0x7365('0x19')](_0x1481a0);}return null;};}function patchUpdates(_0x53c562){return function(_0x1322cf){try{jsonpatch['apply'](_0x1322cf,_0x53c562,!![]);}catch(_0x27df7c){return BPromise[_0x7365('0x21')](_0x27df7c);}return _0x1322cf['save']();};}function saveUpdates(_0x2847e5,_0x50da27){return function(_0x11c48c){if(_0x11c48c){return _0x11c48c['update'](_0x2847e5)[_0x7365('0x22')](function(_0x1cbca5){return _0x1cbca5;});}return null;};}function removeEntity(_0x372095,_0x18c067){return function(_0x104925){if(_0x104925){return _0x104925[_0x7365('0x23')]()['then'](function(){var _0x17a89b=_0x104925[_0x7365('0x24')]({'plain':!![]});var _0x416f20=_0x7365('0x25');return db[_0x7365('0x26')][_0x7365('0x23')]({'where':{'type':_0x416f20,'resourceId':_0x17a89b['id']}})[_0x7365('0x22')](function(){return _0x104925;});})[_0x7365('0x22')](function(){_0x372095['status'](0xcc)['end']();});}};}function handleEntityNotFound(_0x3413f1,_0x342dd8){return function(_0xc35e4d){if(!_0xc35e4d){_0x3413f1[_0x7365('0x17')](0x194);}return _0xc35e4d;};}function handleError(_0x4415d9,_0x4b1cc1){_0x4b1cc1=_0x4b1cc1||0x1f4;return function(_0x5eda72){logger['error'](_0x5eda72[_0x7365('0x27')]);if(_0x5eda72[_0x7365('0x28')]){delete _0x5eda72[_0x7365('0x28')];}_0x4415d9['status'](_0x4b1cc1)[_0x7365('0x29')](_0x5eda72);};}exports[_0x7365('0x2a')]=function(_0x2608c5,_0x182387){var _0x23ecba={},_0x5899b3={},_0x2faef5={'count':0x0,'rows':[]};var _0x330690=_['map'](db[_0x7365('0x2b')][_0x7365('0x2c')],function(_0x2176ce){return{'name':_0x2176ce[_0x7365('0x2d')],'type':_0x2176ce[_0x7365('0x2e')][_0x7365('0x2f')]};});_0x5899b3[_0x7365('0x30')]=_['map'](_0x330690,'name');_0x5899b3[_0x7365('0x31')]=_[_0x7365('0x32')](_0x2608c5[_0x7365('0x31')]);_0x5899b3[_0x7365('0x33')]=_['intersection'](_0x5899b3[_0x7365('0x30')],_0x5899b3[_0x7365('0x31')]);_0x23ecba['attributes']=_[_0x7365('0x34')](_0x5899b3['model'],qs['fields'](_0x2608c5[_0x7365('0x31')][_0x7365('0x35')]));_0x23ecba[_0x7365('0x36')]=_0x23ecba[_0x7365('0x36')]['length']?_0x23ecba[_0x7365('0x36')]:_0x5899b3[_0x7365('0x30')];if(!_0x2608c5[_0x7365('0x31')]['hasOwnProperty'](_0x7365('0x37'))){_0x23ecba['limit']=qs['limit'](_0x2608c5['query']['limit']);_0x23ecba[_0x7365('0x1a')]=qs[_0x7365('0x1a')](_0x2608c5['query'][_0x7365('0x1a')]);}_0x23ecba[_0x7365('0x38')]=qs[_0x7365('0x39')](_0x2608c5['query'][_0x7365('0x39')]);_0x23ecba['where']=qs[_0x7365('0x33')](_[_0x7365('0x3a')](_0x2608c5[_0x7365('0x31')],_0x5899b3[_0x7365('0x33')]),_0x330690);if(_0x2608c5[_0x7365('0x31')][_0x7365('0x3b')]){_0x23ecba[_0x7365('0x3c')]=_[_0x7365('0x3d')](_0x23ecba[_0x7365('0x3c')],{'$or':_[_0x7365('0x3e')](_0x330690,function(_0xe401b4){if(_0xe401b4['type']!==_0x7365('0x3f')){var _0x59b4ce={};_0x59b4ce[_0xe401b4[_0x7365('0x28')]]={'$like':'%'+_0x2608c5[_0x7365('0x31')][_0x7365('0x3b')]+'%'};return _0x59b4ce;}})});}_0x23ecba=_[_0x7365('0x3d')]({},_0x23ecba,_0x2608c5[_0x7365('0x40')]);var _0x5e34de={'where':_0x23ecba[_0x7365('0x3c')]};return db['Disposition'][_0x7365('0x1c')](_0x5e34de)[_0x7365('0x22')](function(_0x3ce304){_0x2faef5['count']=_0x3ce304;if(_0x2608c5[_0x7365('0x31')][_0x7365('0x41')]){_0x23ecba['include']=[{'all':!![]}];}return db[_0x7365('0x2b')][_0x7365('0x42')](_0x23ecba);})['then'](function(_0x1cbda3){_0x2faef5[_0x7365('0x43')]=_0x1cbda3;return _0x2faef5;})['then'](respondWithFilteredResult(_0x182387,_0x23ecba))[_0x7365('0x44')](handleError(_0x182387,null));};exports['show']=function(_0x5e1187,_0x291295){var _0x227444={'raw':!![],'where':{'id':_0x5e1187[_0x7365('0x45')]['id']}},_0x314c63={};_0x314c63[_0x7365('0x30')]=_[_0x7365('0x32')](db[_0x7365('0x2b')][_0x7365('0x2c')]);_0x314c63[_0x7365('0x31')]=_[_0x7365('0x32')](_0x5e1187['query']);_0x314c63[_0x7365('0x33')]=_['intersection'](_0x314c63[_0x7365('0x30')],_0x314c63[_0x7365('0x31')]);_0x227444['attributes']=_[_0x7365('0x34')](_0x314c63[_0x7365('0x30')],qs['fields'](_0x5e1187[_0x7365('0x31')][_0x7365('0x35')]));_0x227444[_0x7365('0x36')]=_0x227444[_0x7365('0x36')]['length']?_0x227444[_0x7365('0x36')]:_0x314c63[_0x7365('0x30')];if(_0x5e1187[_0x7365('0x31')][_0x7365('0x41')]){_0x227444[_0x7365('0x46')]=[{'all':!![]}];}_0x227444=_[_0x7365('0x3d')]({},_0x227444,_0x5e1187[_0x7365('0x40')]);return db['Disposition'][_0x7365('0x47')](_0x227444)[_0x7365('0x22')](handleEntityNotFound(_0x291295,null))['then'](respondWithResult(_0x291295,null))[_0x7365('0x44')](handleError(_0x291295,null));};exports[_0x7365('0x48')]=function(_0x2f6cb7,_0x1cabdc){return db[_0x7365('0x2b')][_0x7365('0x48')](_0x2f6cb7[_0x7365('0x49')],{})[_0x7365('0x22')](function(_0x42b636){var _0x234c98=_0x2f6cb7[_0x7365('0x4a')]['get']({'plain':!![]});if(!_0x234c98)throw new Error(_0x7365('0x4b'));if(_0x234c98[_0x7365('0x4c')]===_0x7365('0x4a')){var _0x26b256=_0x42b636[_0x7365('0x24')]({'plain':!![]});var _0x45ee0b=_0x7365('0x25');return db[_0x7365('0x4d')]['find']({'where':{'name':_0x45ee0b,'userProfileId':_0x234c98[_0x7365('0x4e')]},'raw':!![]})[_0x7365('0x22')](function(_0x3c43ec){if(_0x3c43ec&&_0x3c43ec[_0x7365('0x4f')]===0x0){return db['UserProfileResource'][_0x7365('0x48')]({'name':_0x26b256[_0x7365('0x28')],'resourceId':_0x26b256['id'],'type':_0x3c43ec['name'],'sectionId':_0x3c43ec['id']},{})[_0x7365('0x22')](function(){return _0x42b636;});}else{return _0x42b636;}})[_0x7365('0x44')](function(_0x419407){logger[_0x7365('0x50')]('Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s',_0x419407);throw _0x419407;});}return _0x42b636;})[_0x7365('0x22')](respondWithResult(_0x1cabdc,0xc9))[_0x7365('0x44')](handleError(_0x1cabdc,null));};exports[_0x7365('0x51')]=function(_0x81154f,_0x472910){if(_0x81154f[_0x7365('0x49')]['id']){delete _0x81154f[_0x7365('0x49')]['id'];}return db[_0x7365('0x2b')]['find']({'where':{'id':_0x81154f[_0x7365('0x45')]['id']}})[_0x7365('0x22')](handleEntityNotFound(_0x472910,null))[_0x7365('0x22')](saveUpdates(_0x81154f['body'],null))[_0x7365('0x22')](respondWithResult(_0x472910,null))['catch'](handleError(_0x472910,null));};exports[_0x7365('0x23')]=function(_0x4ddda4,_0x15298a){return db['Disposition'][_0x7365('0x47')]({'where':{'id':_0x4ddda4[_0x7365('0x45')]['id']}})['then'](handleEntityNotFound(_0x15298a,null))[_0x7365('0x22')](removeEntity(_0x15298a,null))[_0x7365('0x44')](handleError(_0x15298a,null));}; \ No newline at end of file +var _0x71d8=['../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/logger','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','sendStatus','status','offset','undefined','count','Content-Range','json','apply','reject','update','then','Dispositions','destroy','end','name','send','index','map','Disposition','rawAttributes','fieldName','type','model','query','filters','intersection','attributes','fields','hasOwnProperty','nolimit','limit','order','sort','pick','where','merge','VIRTUAL','filter','include','findAll','catch','keys','includeAll','options','create','body','user','get','role','find','userProfileId','autoAssociation','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','params','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','moment','bluebird','mustache','util','path','to-csv','ejs','squel','crypto','jsforce','querystring','ioredis'];(function(_0x486812,_0x413231){var _0x382aae=function(_0x3b7f4d){while(--_0x3b7f4d){_0x486812['push'](_0x486812['shift']());}};_0x382aae(++_0x413231);}(_0x71d8,0x8d));var _0x871d=function(_0x408d2,_0x5d10fc){_0x408d2=_0x408d2-0x0;var _0x56d0c2=_0x71d8[_0x408d2];return _0x56d0c2;};'use strict';var emlformat=require(_0x871d('0x0'));var rimraf=require(_0x871d('0x1'));var zipdir=require(_0x871d('0x2'));var jsonpatch=require(_0x871d('0x3'));var rp=require(_0x871d('0x4'));var moment=require(_0x871d('0x5'));var BPromise=require(_0x871d('0x6'));var Mustache=require(_0x871d('0x7'));var util=require(_0x871d('0x8'));var path=require(_0x871d('0x9'));var sox=require('sox');var csv=require(_0x871d('0xa'));var ejs=require(_0x871d('0xb'));var fs=require('fs');var fs_extra=require('fs-extra');var _=require('lodash');var squel=require(_0x871d('0xc'));var crypto=require(_0x871d('0xd'));var jsforce=require(_0x871d('0xe'));var deskjs=require('desk.js');var toCsv=require(_0x871d('0xa'));var querystring=require(_0x871d('0xf'));var Papa=require('papaparse');var Redis=require(_0x871d('0x10'));var authService=require(_0x871d('0x11'));var qs=require(_0x871d('0x12'));var as=require(_0x871d('0x13'));var hardwareService=require('../../config/license/hardware');var logger=require(_0x871d('0x14'))('api');var utils=require(_0x871d('0x15'));var config=require(_0x871d('0x16'));var licenseUtil=require(_0x871d('0x17'));var db=require(_0x871d('0x18'))['db'];function respondWithStatusCode(_0xf2485a,_0x12181b){_0x12181b=_0x12181b||0xcc;return function(_0x3cf25b){if(_0x3cf25b){return _0xf2485a[_0x871d('0x19')](_0x12181b);}return _0xf2485a[_0x871d('0x1a')](_0x12181b)['end']();};}function respondWithResult(_0x2e5b51,_0x2097c5){_0x2097c5=_0x2097c5||0xc8;return function(_0x2e24c9){if(_0x2e24c9){return _0x2e5b51[_0x871d('0x1a')](_0x2097c5)['json'](_0x2e24c9);}};}function respondWithFilteredResult(_0x44e701,_0x1a44fc){return function(_0x9d9c18){if(_0x9d9c18){var _0x423162=typeof _0x1a44fc[_0x871d('0x1b')]==='undefined'&&typeof _0x1a44fc['limit']===_0x871d('0x1c');var _0x24d57f=_0x9d9c18[_0x871d('0x1d')];var _0x5098a6=_0x423162?0x0:_0x1a44fc['offset'];var _0x5b8cc6=_0x423162?_0x9d9c18[_0x871d('0x1d')]:_0x1a44fc[_0x871d('0x1b')]+_0x1a44fc['limit'];var _0xea17c3;if(_0x5b8cc6>=_0x24d57f){_0x5b8cc6=_0x24d57f;_0xea17c3=0xc8;}else{_0xea17c3=0xce;}_0x44e701[_0x871d('0x1a')](_0xea17c3);return _0x44e701['set'](_0x871d('0x1e'),_0x5098a6+'-'+_0x5b8cc6+'/'+_0x24d57f)[_0x871d('0x1f')](_0x9d9c18);}return null;};}function patchUpdates(_0x5499e7){return function(_0x5c2459){try{jsonpatch[_0x871d('0x20')](_0x5c2459,_0x5499e7,!![]);}catch(_0x4170e6){return BPromise[_0x871d('0x21')](_0x4170e6);}return _0x5c2459['save']();};}function saveUpdates(_0x172259,_0x703240){return function(_0x3e05cf){if(_0x3e05cf){return _0x3e05cf[_0x871d('0x22')](_0x172259)[_0x871d('0x23')](function(_0x15e06a){return _0x15e06a;});}return null;};}function removeEntity(_0x4986d4,_0x188851){return function(_0x223044){if(_0x223044){return _0x223044['destroy']()[_0x871d('0x23')](function(){var _0x2292d3=_0x223044['get']({'plain':!![]});var _0x36c5ff=_0x871d('0x24');return db['UserProfileResource'][_0x871d('0x25')]({'where':{'type':_0x36c5ff,'resourceId':_0x2292d3['id']}})[_0x871d('0x23')](function(){return _0x223044;});})[_0x871d('0x23')](function(){_0x4986d4[_0x871d('0x1a')](0xcc)[_0x871d('0x26')]();});}};}function handleEntityNotFound(_0x14b7ae,_0x2d33d4){return function(_0x5250ab){if(!_0x5250ab){_0x14b7ae['sendStatus'](0x194);}return _0x5250ab;};}function handleError(_0x18cab7,_0xe03cbf){_0xe03cbf=_0xe03cbf||0x1f4;return function(_0x3c0e62){logger['error'](_0x3c0e62['stack']);if(_0x3c0e62[_0x871d('0x27')]){delete _0x3c0e62['name'];}_0x18cab7[_0x871d('0x1a')](_0xe03cbf)[_0x871d('0x28')](_0x3c0e62);};}exports[_0x871d('0x29')]=function(_0x160c63,_0x27fcca){var _0x585fc8={},_0x1d054e={},_0x2242d5={'count':0x0,'rows':[]};var _0x48e7d4=_[_0x871d('0x2a')](db[_0x871d('0x2b')][_0x871d('0x2c')],function(_0x4d0b04){return{'name':_0x4d0b04[_0x871d('0x2d')],'type':_0x4d0b04[_0x871d('0x2e')]['key']};});_0x1d054e[_0x871d('0x2f')]=_[_0x871d('0x2a')](_0x48e7d4,_0x871d('0x27'));_0x1d054e[_0x871d('0x30')]=_['keys'](_0x160c63[_0x871d('0x30')]);_0x1d054e[_0x871d('0x31')]=_[_0x871d('0x32')](_0x1d054e[_0x871d('0x2f')],_0x1d054e[_0x871d('0x30')]);_0x585fc8[_0x871d('0x33')]=_['intersection'](_0x1d054e[_0x871d('0x2f')],qs[_0x871d('0x34')](_0x160c63['query']['fields']));_0x585fc8[_0x871d('0x33')]=_0x585fc8[_0x871d('0x33')]['length']?_0x585fc8[_0x871d('0x33')]:_0x1d054e['model'];if(!_0x160c63[_0x871d('0x30')][_0x871d('0x35')](_0x871d('0x36'))){_0x585fc8[_0x871d('0x37')]=qs[_0x871d('0x37')](_0x160c63['query']['limit']);_0x585fc8[_0x871d('0x1b')]=qs[_0x871d('0x1b')](_0x160c63['query']['offset']);}_0x585fc8[_0x871d('0x38')]=qs['sort'](_0x160c63[_0x871d('0x30')][_0x871d('0x39')]);_0x585fc8['where']=qs['filters'](_[_0x871d('0x3a')](_0x160c63[_0x871d('0x30')],_0x1d054e[_0x871d('0x31')]),_0x48e7d4);if(_0x160c63['query']['filter']){_0x585fc8[_0x871d('0x3b')]=_[_0x871d('0x3c')](_0x585fc8[_0x871d('0x3b')],{'$or':_['map'](_0x48e7d4,function(_0x3a7c11){if(_0x3a7c11[_0x871d('0x2e')]!==_0x871d('0x3d')){var _0x393618={};_0x393618[_0x3a7c11['name']]={'$like':'%'+_0x160c63[_0x871d('0x30')][_0x871d('0x3e')]+'%'};return _0x393618;}})});}_0x585fc8=_[_0x871d('0x3c')]({},_0x585fc8,_0x160c63['options']);var _0x5ae9a6={'where':_0x585fc8[_0x871d('0x3b')]};return db[_0x871d('0x2b')][_0x871d('0x1d')](_0x5ae9a6)[_0x871d('0x23')](function(_0x516431){_0x2242d5[_0x871d('0x1d')]=_0x516431;if(_0x160c63[_0x871d('0x30')]['includeAll']){_0x585fc8[_0x871d('0x3f')]=[{'all':!![]}];}return db[_0x871d('0x2b')][_0x871d('0x40')](_0x585fc8);})[_0x871d('0x23')](function(_0x642479){_0x2242d5['rows']=_0x642479;return _0x2242d5;})[_0x871d('0x23')](respondWithFilteredResult(_0x27fcca,_0x585fc8))[_0x871d('0x41')](handleError(_0x27fcca,null));};exports['show']=function(_0xc0f2cc,_0x4c6c12){var _0xd13e7f={'raw':!![],'where':{'id':_0xc0f2cc['params']['id']}},_0x5c978c={};_0x5c978c[_0x871d('0x2f')]=_[_0x871d('0x42')](db['Disposition'][_0x871d('0x2c')]);_0x5c978c['query']=_[_0x871d('0x42')](_0xc0f2cc[_0x871d('0x30')]);_0x5c978c['filters']=_[_0x871d('0x32')](_0x5c978c[_0x871d('0x2f')],_0x5c978c[_0x871d('0x30')]);_0xd13e7f[_0x871d('0x33')]=_[_0x871d('0x32')](_0x5c978c['model'],qs[_0x871d('0x34')](_0xc0f2cc['query'][_0x871d('0x34')]));_0xd13e7f['attributes']=_0xd13e7f[_0x871d('0x33')]['length']?_0xd13e7f['attributes']:_0x5c978c['model'];if(_0xc0f2cc[_0x871d('0x30')][_0x871d('0x43')]){_0xd13e7f[_0x871d('0x3f')]=[{'all':!![]}];}_0xd13e7f=_[_0x871d('0x3c')]({},_0xd13e7f,_0xc0f2cc[_0x871d('0x44')]);return db[_0x871d('0x2b')]['find'](_0xd13e7f)[_0x871d('0x23')](handleEntityNotFound(_0x4c6c12,null))[_0x871d('0x23')](respondWithResult(_0x4c6c12,null))['catch'](handleError(_0x4c6c12,null));};exports[_0x871d('0x45')]=function(_0x68141a,_0x42f770){return db['Disposition'][_0x871d('0x45')](_0x68141a[_0x871d('0x46')],{})[_0x871d('0x23')](function(_0x5aff5f){var _0x5d2336=_0x68141a[_0x871d('0x47')][_0x871d('0x48')]({'plain':!![]});if(!_0x5d2336)throw new Error('Unable\x20to\x20retrieve\x20the\x20current\x20user');if(_0x5d2336[_0x871d('0x49')]===_0x871d('0x47')){var _0x408688=_0x5aff5f[_0x871d('0x48')]({'plain':!![]});var _0x8211f5=_0x871d('0x24');return db['UserProfileSection'][_0x871d('0x4a')]({'where':{'name':_0x8211f5,'userProfileId':_0x5d2336[_0x871d('0x4b')]},'raw':!![]})[_0x871d('0x23')](function(_0x683cb8){if(_0x683cb8&&_0x683cb8[_0x871d('0x4c')]===0x0){return db['UserProfileResource'][_0x871d('0x45')]({'name':_0x408688['name'],'resourceId':_0x408688['id'],'type':_0x683cb8['name'],'sectionId':_0x683cb8['id']},{})[_0x871d('0x23')](function(){return _0x5aff5f;});}else{return _0x5aff5f;}})[_0x871d('0x41')](function(_0x3a6ddc){logger['error'](_0x871d('0x4d'),_0x3a6ddc);throw _0x3a6ddc;});}return _0x5aff5f;})[_0x871d('0x23')](respondWithResult(_0x42f770,0xc9))[_0x871d('0x41')](handleError(_0x42f770,null));};exports[_0x871d('0x22')]=function(_0x135862,_0x5b9a5a){if(_0x135862[_0x871d('0x46')]['id']){delete _0x135862[_0x871d('0x46')]['id'];}return db[_0x871d('0x2b')][_0x871d('0x4a')]({'where':{'id':_0x135862[_0x871d('0x4e')]['id']}})['then'](handleEntityNotFound(_0x5b9a5a,null))[_0x871d('0x23')](saveUpdates(_0x135862['body'],null))[_0x871d('0x23')](respondWithResult(_0x5b9a5a,null))[_0x871d('0x41')](handleError(_0x5b9a5a,null));};exports[_0x871d('0x25')]=function(_0x14f261,_0x7a8362){return db[_0x871d('0x2b')]['find']({'where':{'id':_0x14f261[_0x871d('0x4e')]['id']}})[_0x871d('0x23')](handleEntityNotFound(_0x7a8362,null))['then'](removeEntity(_0x7a8362,null))[_0x871d('0x41')](handleError(_0x7a8362,null));}; \ No newline at end of file diff --git a/server/api/disposition/disposition.model.js b/server/api/disposition/disposition.model.js index 5dff55a..785d8d8 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 _0xe635=['name_mail','MailAccountId','name_sms','SmsAccountId','name_fax','FaxAccountId','OpenchannelAccountId','WhatsappAccountId','lodash','util','moment','bluebird','path','../../config/environment','define','Disposition','tools_dispositions','name_voice','name','ListId','name_chat','ChatWebsiteId'];(function(_0x536bc2,_0x35c4bf){var _0x551b56=function(_0x4637a6){while(--_0x4637a6){_0x536bc2['push'](_0x536bc2['shift']());}};_0x551b56(++_0x35c4bf);}(_0xe635,0x1d6));var _0x5e63=function(_0x3a87ed,_0x49872b){_0x3a87ed=_0x3a87ed-0x0;var _0x3cc546=_0xe635[_0x3a87ed];return _0x3cc546;};'use strict';var _=require(_0x5e63('0x0'));var util=require(_0x5e63('0x1'));var logger=require('../../config/logger')('api');var moment=require(_0x5e63('0x2'));var BPromise=require(_0x5e63('0x3'));var rp=require('request-promise');var fs=require('fs');var path=require(_0x5e63('0x4'));var rimraf=require('rimraf');var config=require(_0x5e63('0x5'));var attributes=require('./disposition.attributes');module['exports']=function(_0x5e0527,_0x226627){return _0x5e0527[_0x5e63('0x6')](_0x5e63('0x7'),attributes,{'tableName':_0x5e63('0x8'),'paranoid':![],'indexes':[{'unique':!![],'name':_0x5e63('0x9'),'fields':[_0x5e63('0xa'),_0x5e63('0xb')]},{'unique':!![],'name':_0x5e63('0xc'),'fields':[_0x5e63('0xa'),_0x5e63('0xd')]},{'unique':!![],'name':_0x5e63('0xe'),'fields':[_0x5e63('0xa'),_0x5e63('0xf')]},{'unique':!![],'name':_0x5e63('0x10'),'fields':[_0x5e63('0xa'),_0x5e63('0x11')]},{'unique':!![],'name':_0x5e63('0x12'),'fields':['name',_0x5e63('0x13')]},{'unique':!![],'name':'name_openchannel','fields':['name',_0x5e63('0x14')]},{'unique':!![],'name':'name_whatsapp','fields':['name',_0x5e63('0x15')]}],'timestamps':!![]});}; \ No newline at end of file +var _0x0b1d=['name','name_fax','FaxAccountId','name_openchannel','OpenchannelAccountId','lodash','../../config/logger','api','moment','bluebird','request-promise','path','rimraf','../../config/environment','./disposition.attributes','exports','define','Disposition','tools_dispositions','name_voice','ListId','name_chat','name_mail','MailAccountId','name_sms'];(function(_0x50d967,_0xc3473a){var _0x4eb809=function(_0x514982){while(--_0x514982){_0x50d967['push'](_0x50d967['shift']());}};_0x4eb809(++_0xc3473a);}(_0x0b1d,0x1ae));var _0xd0b1=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0x0b1d[_0x3dd15e];return _0x231fd0;};'use strict';var _=require(_0xd0b1('0x0'));var util=require('util');var logger=require(_0xd0b1('0x1'))(_0xd0b1('0x2'));var moment=require(_0xd0b1('0x3'));var BPromise=require(_0xd0b1('0x4'));var rp=require(_0xd0b1('0x5'));var fs=require('fs');var path=require(_0xd0b1('0x6'));var rimraf=require(_0xd0b1('0x7'));var config=require(_0xd0b1('0x8'));var attributes=require(_0xd0b1('0x9'));module[_0xd0b1('0xa')]=function(_0xedec3b,_0x5e35be){return _0xedec3b[_0xd0b1('0xb')](_0xd0b1('0xc'),attributes,{'tableName':_0xd0b1('0xd'),'paranoid':![],'indexes':[{'unique':!![],'name':_0xd0b1('0xe'),'fields':['name',_0xd0b1('0xf')]},{'unique':!![],'name':_0xd0b1('0x10'),'fields':['name','ChatWebsiteId']},{'unique':!![],'name':_0xd0b1('0x11'),'fields':['name',_0xd0b1('0x12')]},{'unique':!![],'name':_0xd0b1('0x13'),'fields':[_0xd0b1('0x14'),'SmsAccountId']},{'unique':!![],'name':_0xd0b1('0x15'),'fields':[_0xd0b1('0x14'),_0xd0b1('0x16')]},{'unique':!![],'name':_0xd0b1('0x17'),'fields':[_0xd0b1('0x14'),_0xd0b1('0x18')]},{'unique':!![],'name':'name_whatsapp','fields':[_0xd0b1('0x14'),'WhatsappAccountId']}],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/disposition/disposition.rpc.js b/server/api/disposition/disposition.rpc.js index b99e7e4..cffe79d 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(_0x11335a,_0x2e255c){var _0x4a57ee=function(_0x1a1d20){while(--_0x1a1d20){_0x11335a['push'](_0x11335a['shift']());}};_0x4a57ee(++_0x2e255c);}(_0xa9e0,0x123));var _0x0a9e=function(_0x5ddb1c,_0x5ea4df){_0x5ddb1c=_0x5ddb1c-0x0;var _0x354adc=_0xa9e0[_0x5ddb1c];return _0x354adc;};'use strict';var _=require(_0x0a9e('0x0'));var util=require(_0x0a9e('0x1'));var moment=require(_0x0a9e('0x2'));var BPromise=require('bluebird');var rs=require('randomstring');var fs=require('fs');var Redis=require(_0x0a9e('0x3'));var db=require('../../mysqldb')['db'];var utils=require(_0x0a9e('0x4'));var logger=require(_0x0a9e('0x5'))(_0x0a9e('0x6'));var config=require(_0x0a9e('0x7'));var jayson=require(_0x0a9e('0x8'));var client=jayson['client'][_0x0a9e('0x9')]({'port':0x232a});function respondWithRpcPromise(_0x441e3a,_0x2cc193,_0x5f41ea){return new BPromise(function(_0x503809,_0xe42b77){return client['request'](_0x441e3a,_0x5f41ea)['then'](function(_0x39753a){logger[_0x0a9e('0xa')](_0x0a9e('0xb'),_0x2cc193,_0x0a9e('0xc'));logger[_0x0a9e('0xd')](_0x0a9e('0xe'),_0x2cc193,'request\x20sent',JSON['stringify'](_0x39753a));if(_0x39753a['error']){if(_0x39753a['error'][_0x0a9e('0xf')]===0x1f4){logger[_0x0a9e('0x10')](_0x0a9e('0xb'),_0x2cc193,_0x39753a[_0x0a9e('0x10')][_0x0a9e('0x11')]);return _0xe42b77(_0x39753a[_0x0a9e('0x10')]['message']);}logger[_0x0a9e('0x10')](_0x0a9e('0xb'),_0x2cc193,_0x39753a[_0x0a9e('0x10')][_0x0a9e('0x11')]);return _0x503809(_0x39753a[_0x0a9e('0x10')][_0x0a9e('0x11')]);}else{logger['info'](_0x0a9e('0xb'),_0x2cc193,'request\x20sent');_0x503809(_0x39753a[_0x0a9e('0x12')]['message']);}})[_0x0a9e('0x13')](function(_0x12066b){logger['error'](_0x0a9e('0xb'),_0x2cc193,_0x12066b);_0xe42b77(_0x12066b);});});} \ No newline at end of file +var _0xa9e0=['http','info','Disposition,\x20%s,\x20%s','request\x20sent','debug','Disposition,\x20%s,\x20%s,\x20%s','code','error','message','result','catch','lodash','util','moment','ioredis','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise'];(function(_0x5788f9,_0x9b3037){var _0x25497e=function(_0x52eedb){while(--_0x52eedb){_0x5788f9['push'](_0x5788f9['shift']());}};_0x25497e(++_0x9b3037);}(_0xa9e0,0x123));var _0x0a9e=function(_0x45e98e,_0x169b60){_0x45e98e=_0x45e98e-0x0;var _0x374dba=_0xa9e0[_0x45e98e];return _0x374dba;};'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 4e7f5f8..e70e5a8 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 _0x7d13=['util','path','connect-timeout','fs-extra','./disposition.controller','isAuthenticated','get','/:id','show','create','put','update','delete','destroy','multer'];(function(_0x4c521b,_0x3748ac){var _0x586f8f=function(_0x364be3){while(--_0x364be3){_0x4c521b['push'](_0x4c521b['shift']());}};_0x586f8f(++_0x3748ac);}(_0x7d13,0x149));var _0x37d1=function(_0x1ca890,_0x21d0d3){_0x1ca890=_0x1ca890-0x0;var _0x3f8e01=_0x7d13[_0x1ca890];return _0x3f8e01;};'use strict';var multer=require(_0x37d1('0x0'));var util=require(_0x37d1('0x1'));var path=require(_0x37d1('0x2'));var timeout=require(_0x37d1('0x3'));var express=require('express');var router=express['Router']();var fs_extra=require(_0x37d1('0x4'));var auth=require('../../components/auth/service');var interaction=require('../../components/interaction/service');var config=require('../../config/environment');var controller=require(_0x37d1('0x5'));router['get']('/',auth[_0x37d1('0x6')](),controller['index']);router[_0x37d1('0x7')](_0x37d1('0x8'),auth[_0x37d1('0x6')](),controller[_0x37d1('0x9')]);router['post']('/',auth[_0x37d1('0x6')](),controller[_0x37d1('0xa')]);router[_0x37d1('0xb')](_0x37d1('0x8'),auth['isAuthenticated'](),controller[_0x37d1('0xc')]);router[_0x37d1('0xd')]('/:id',auth[_0x37d1('0x6')](),controller[_0x37d1('0xe')]);module['exports']=router; \ No newline at end of file +var _0x05b3=['connect-timeout','express','fs-extra','../../components/auth/service','../../config/environment','./disposition.controller','isAuthenticated','index','get','/:id','post','create','put','update','delete','exports','path'];(function(_0x5e6cb8,_0x16cf56){var _0x3faeb3=function(_0x1a7355){while(--_0x1a7355){_0x5e6cb8['push'](_0x5e6cb8['shift']());}};_0x3faeb3(++_0x16cf56);}(_0x05b3,0x65));var _0x305b=function(_0x128bef,_0xc7a0af){_0x128bef=_0x128bef-0x0;var _0x1ba862=_0x05b3[_0x128bef];return _0x1ba862;};'use strict';var multer=require('multer');var util=require('util');var path=require(_0x305b('0x0'));var timeout=require(_0x305b('0x1'));var express=require(_0x305b('0x2'));var router=express['Router']();var fs_extra=require(_0x305b('0x3'));var auth=require(_0x305b('0x4'));var interaction=require('../../components/interaction/service');var config=require(_0x305b('0x5'));var controller=require(_0x305b('0x6'));router['get']('/',auth[_0x305b('0x7')](),controller[_0x305b('0x8')]);router[_0x305b('0x9')](_0x305b('0xa'),auth[_0x305b('0x7')](),controller['show']);router[_0x305b('0xb')]('/',auth[_0x305b('0x7')](),controller[_0x305b('0xc')]);router[_0x305b('0xd')](_0x305b('0xa'),auth[_0x305b('0x7')](),controller[_0x305b('0xe')]);router[_0x305b('0xf')]('/:id',auth[_0x305b('0x7')](),controller['destroy']);module[_0x305b('0x10')]=router; \ No newline at end of file diff --git a/server/api/faxAccount/faxAccount.attributes.js b/server/api/faxAccount/faxAccount.attributes.js index a126832..8ffa49d 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 _0x06f4=['mandatoryDispositionPauseId','mandatoryDisposition','sequelize','exports','STRING','ENUM','localstationid','2400','7200','12000','14400','4800','9600','SIP','IAX','DADHI','KHOMP','TEXT','Account:\x20{{account.name}}
{{#queue}}Queue:\x20{{queue.name}}
{{/queue}}From\x20:\x20{{from}}','BOOLEAN','INTEGER','Enabled/disables\x20mandatory\x20dispo\x20on\x20a\x20queue'];(function(_0x1aa6b8,_0x1dd1b6){var _0x346101=function(_0x1f0481){while(--_0x1f0481){_0x1aa6b8['push'](_0x1aa6b8['shift']());}};_0x346101(++_0x1dd1b6);}(_0x06f4,0x136));var _0x406f=function(_0x3c4a07,_0x1f9227){_0x3c4a07=_0x3c4a07-0x0;var _0x41c56d=_0x06f4[_0x3c4a07];return _0x41c56d;};'use strict';var Sequelize=require(_0x406f('0x0'));module[_0x406f('0x1')]={'name':{'type':Sequelize['STRING'],'allowNull':![],'validate':{'notEmpty':!![]}},'description':{'type':Sequelize[_0x406f('0x2')]},'ecm':{'type':Sequelize[_0x406f('0x3')]('yes','no'),'defaultValue':'yes'},'headerinfo':{'type':Sequelize[_0x406f('0x2')],'defaultValue':'xCALLY\x20Motion\x20Fax'},'localstationid':{'type':Sequelize[_0x406f('0x2')],'unique':_0x406f('0x4')},'minrate':{'type':Sequelize[_0x406f('0x3')](_0x406f('0x5'),'4800',_0x406f('0x6'),'9600',_0x406f('0x7'),_0x406f('0x8')),'defaultValue':_0x406f('0x9')},'maxrate':{'type':Sequelize['ENUM'](_0x406f('0x5'),'4800','7200',_0x406f('0xa'),'12000',_0x406f('0x8')),'defaultValue':'14400'},'modem':{'type':Sequelize[_0x406f('0x2')],'defaultValue':'v17,v27,v29'},'gateway':{'type':Sequelize[_0x406f('0x2')],'defaultValue':'no','validate':{'is':/^(?:yes|no|[0-9]+)$/}},'faxdetect':{'type':Sequelize[_0x406f('0x2')],'defaultValue':'no','validate':{'is':/^(?:yes|no|t38|cng|[0-9]+)$/}},'t38timeout':{'type':Sequelize['INTEGER'],'defaultValue':0x1388,'validate':{'min':0x3e8}},'tech':{'type':Sequelize[_0x406f('0x3')](_0x406f('0xb'),_0x406f('0xc'),_0x406f('0xd'),_0x406f('0xe')),'defaultValue':_0x406f('0xb')},'key':{'type':Sequelize[_0x406f('0x2')],'allowNull':![]},'notificationTemplate':{'type':Sequelize[_0x406f('0xf')],'defaultValue':function(){return _0x406f('0x10');}},'notificationSound':{'type':Sequelize[_0x406f('0x11')],'defaultValue':!![]},'notificationShake':{'type':Sequelize[_0x406f('0x11')],'defaultValue':![]},'waitForTheAssignedAgent':{'type':Sequelize['INTEGER'],'validate':{'min':0x1,'max':0x20c49b},'defaultValue':0xa},'waitForTheAssignedQueue':{'type':Sequelize[_0x406f('0x12')],'validate':{'min':0x1,'max':0x20c49b},'defaultValue':0xa},'queueTransfer':{'type':Sequelize[_0x406f('0x11')],'defaultValue':![]},'queueTransferTimeout':{'type':Sequelize[_0x406f('0x12')],'validate':{'min':0x1,'max':0x20c49b},'defaultValue':0x12c},'agentTransfer':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'agentTransferTimeout':{'type':Sequelize[_0x406f('0x12')],'validate':{'min':0x1,'max':0x20c49b},'defaultValue':0x12c},'mandatoryDispositionPauseId':{'type':Sequelize[_0x406f('0x12')],'allowNull':!![],'defaultValue':null,'comment':'Status\x20to\x20put\x20when\x20mandatory\x20disposition\x20is\x20enabled'},'mandatoryDisposition':{'type':Sequelize['BOOLEAN'],'defaultValue':![],'comment':_0x406f('0x13'),'set':function(_0x4357e3){if(!_0x4357e3)this['setDataValue'](_0x406f('0x14'),null);this['setDataValue'](_0x406f('0x15'),_0x4357e3);}}}; \ No newline at end of file +var _0xef17=['Enabled/disables\x20mandatory\x20dispo\x20on\x20a\x20queue','setDataValue','sequelize','exports','STRING','ENUM','yes','xCALLY\x20Motion\x20Fax','localstationid','2400','7200','14400','4800','9600','12000','SIP','DADHI','KHOMP','TEXT','Account:\x20{{account.name}}
{{#queue}}Queue:\x20{{queue.name}}
{{/queue}}From\x20:\x20{{from}}','BOOLEAN','INTEGER'];(function(_0x470f24,_0x2436a9){var _0x2c6fc8=function(_0x3ef190){while(--_0x3ef190){_0x470f24['push'](_0x470f24['shift']());}};_0x2c6fc8(++_0x2436a9);}(_0xef17,0x136));var _0x7ef1=function(_0x54492b,_0x1cff31){_0x54492b=_0x54492b-0x0;var _0x3bedb9=_0xef17[_0x54492b];return _0x3bedb9;};'use strict';var Sequelize=require(_0x7ef1('0x0'));module[_0x7ef1('0x1')]={'name':{'type':Sequelize[_0x7ef1('0x2')],'allowNull':![],'validate':{'notEmpty':!![]}},'description':{'type':Sequelize[_0x7ef1('0x2')]},'ecm':{'type':Sequelize[_0x7ef1('0x3')](_0x7ef1('0x4'),'no'),'defaultValue':_0x7ef1('0x4')},'headerinfo':{'type':Sequelize[_0x7ef1('0x2')],'defaultValue':_0x7ef1('0x5')},'localstationid':{'type':Sequelize['STRING'],'unique':_0x7ef1('0x6')},'minrate':{'type':Sequelize['ENUM'](_0x7ef1('0x7'),'4800',_0x7ef1('0x8'),'9600','12000',_0x7ef1('0x9')),'defaultValue':_0x7ef1('0xa')},'maxrate':{'type':Sequelize['ENUM'](_0x7ef1('0x7'),_0x7ef1('0xa'),_0x7ef1('0x8'),_0x7ef1('0xb'),_0x7ef1('0xc'),_0x7ef1('0x9')),'defaultValue':_0x7ef1('0x9')},'modem':{'type':Sequelize['STRING'],'defaultValue':'v17,v27,v29'},'gateway':{'type':Sequelize[_0x7ef1('0x2')],'defaultValue':'no','validate':{'is':/^(?:yes|no|[0-9]+)$/}},'faxdetect':{'type':Sequelize['STRING'],'defaultValue':'no','validate':{'is':/^(?:yes|no|t38|cng|[0-9]+)$/}},'t38timeout':{'type':Sequelize['INTEGER'],'defaultValue':0x1388,'validate':{'min':0x3e8}},'tech':{'type':Sequelize['ENUM'](_0x7ef1('0xd'),'IAX',_0x7ef1('0xe'),_0x7ef1('0xf')),'defaultValue':_0x7ef1('0xd')},'key':{'type':Sequelize[_0x7ef1('0x2')],'allowNull':![]},'notificationTemplate':{'type':Sequelize[_0x7ef1('0x10')],'defaultValue':function(){return _0x7ef1('0x11');}},'notificationSound':{'type':Sequelize[_0x7ef1('0x12')],'defaultValue':!![]},'notificationShake':{'type':Sequelize[_0x7ef1('0x12')],'defaultValue':![]},'waitForTheAssignedAgent':{'type':Sequelize['INTEGER'],'validate':{'min':0x1,'max':0x20c49b},'defaultValue':0xa},'waitForTheAssignedQueue':{'type':Sequelize['INTEGER'],'validate':{'min':0x1,'max':0x20c49b},'defaultValue':0xa},'queueTransfer':{'type':Sequelize[_0x7ef1('0x12')],'defaultValue':![]},'queueTransferTimeout':{'type':Sequelize['INTEGER'],'validate':{'min':0x1,'max':0x20c49b},'defaultValue':0x12c},'agentTransfer':{'type':Sequelize[_0x7ef1('0x12')],'defaultValue':![]},'agentTransferTimeout':{'type':Sequelize[_0x7ef1('0x13')],'validate':{'min':0x1,'max':0x20c49b},'defaultValue':0x12c},'mandatoryDispositionPauseId':{'type':Sequelize['INTEGER'],'allowNull':!![],'defaultValue':null,'comment':'Status\x20to\x20put\x20when\x20mandatory\x20disposition\x20is\x20enabled'},'mandatoryDisposition':{'type':Sequelize['BOOLEAN'],'defaultValue':![],'comment':_0x7ef1('0x14'),'set':function(_0x4da0fa){if(!_0x4da0fa)this[_0x7ef1('0x15')]('mandatoryDispositionPauseId',null);this['setDataValue']('mandatoryDisposition',_0x4da0fa);}}}; \ No newline at end of file diff --git a/server/api/faxAccount/faxAccount.controller.js b/server/api/faxAccount/faxAccount.controller.js index 8535555..138eb14 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 _0x6634=['modem','t38timeout','FAXOPT(','Wait','/var/opt/motion2/server/files/attachments/fax-${CALLERID(num)}-${CUT(UNIQUEID,.,1)}-${CUT(UNIQUEID,.,2)}-${STRFTIME(,,%C%y%m%d%H%M%S)}-rx.tif,d','ReceiveFax','addAccountApplications','VoiceExtension','tech','createdAt','TrunkId','findById','getMessages','$gte','split','FaxMessage','CmList','Contacts','updatedAt','DESC','attachments','join','root','CheckAfterSend','isNil','from','format','\x22%s\x22\x20<%s>','fax','List','ListId','List\x20not\x20found','Send\x20Fax\x20failed','out','filename','Contact\x20not\x20found','ContactId','Messages','dataValues','SendFax','SendFaxRpc,\x20%s','addAgents','emit','userFaxAccount:save','removeAgents','isArray','getAgents','eml-format','rimraf','zip-dir','fast-json-patch','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/logger','api','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','defaults','redis','socket.io-emitter','./faxAccount.socket','register','client','http','request','FaxAccount,\x20%s,\x20%s','debug','request\x20sent','stringify','error','code','message','info','result','catch','sendStatus','status','json','offset','undefined','limit','count','set','Content-Range','apply','reject','update','then','destroy','get','FaxAccounts','UserProfileResource','end','stack','name','send','index','Pause','map','FaxAccount','rawAttributes','fieldName','type','key','model','keys','filters','intersection','query','attributes','fields','length','hasOwnProperty','nolimit','order','sort','where','pick','filter','merge','VIRTUAL','options','include','findAll','show','params','mandatoryDispositionPause','includeAll','find','create','body','Unable\x20to\x20retrieve\x20the\x20current\x20user','role','user','UserProfileSection','autoAssociation','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','describe','addDisposition','Disposition','getDispositions','findOne','FaxAccountId','removeDispositions','addAnswer','CannedAnswer','getAnswers','rows','removeAnswers','ids','FaxInteraction','addInteraction','omit','getInteractions','CmContact','Contact','User','Owner','internal','Tag','Tags','color','tag','addApplications','sequelize','transaction','ISOLATION_LEVELS','READ_COMMITTED','FaxApplication','bulkCreate','findAndCountAll','priority','getApplications','context','from-voip-provider','localstationid','app','system','Fax\x20Extension','push','Answer','CDR(type)=inbound-fax','Set','gateway','faxdetect','headerinfo','minrate'];(function(_0x11f917,_0x584c9c){var _0x4d37b5=function(_0x3825e9){while(--_0x3825e9){_0x11f917['push'](_0x11f917['shift']());}};_0x4d37b5(++_0x584c9c);}(_0x6634,0x1cb));var _0x4663=function(_0x89c40f,_0xd92eb2){_0x89c40f=_0x89c40f-0x0;var _0x17acbb=_0x6634[_0x89c40f];return _0x17acbb;};'use strict';var emlformat=require(_0x4663('0x0'));var rimraf=require(_0x4663('0x1'));var zipdir=require(_0x4663('0x2'));var jsonpatch=require(_0x4663('0x3'));var rp=require(_0x4663('0x4'));var moment=require(_0x4663('0x5'));var BPromise=require('bluebird');var Mustache=require(_0x4663('0x6'));var util=require(_0x4663('0x7'));var path=require(_0x4663('0x8'));var sox=require(_0x4663('0x9'));var csv=require(_0x4663('0xa'));var ejs=require(_0x4663('0xb'));var fs=require('fs');var fs_extra=require(_0x4663('0xc'));var _=require('lodash');var squel=require('squel');var crypto=require(_0x4663('0xd'));var jsforce=require(_0x4663('0xe'));var deskjs=require(_0x4663('0xf'));var toCsv=require(_0x4663('0xa'));var querystring=require(_0x4663('0x10'));var Papa=require(_0x4663('0x11'));var Redis=require(_0x4663('0x12'));var authService=require(_0x4663('0x13'));var qs=require(_0x4663('0x14'));var as=require(_0x4663('0x15'));var hardwareService=require(_0x4663('0x16'));var logger=require(_0x4663('0x17'))(_0x4663('0x18'));var utils=require(_0x4663('0x19'));var config=require(_0x4663('0x1a'));var licenseUtil=require(_0x4663('0x1b'));var db=require(_0x4663('0x1c'))['db'];config['redis']=_[_0x4663('0x1d')](config[_0x4663('0x1e')],{'host':'localhost','port':0x18eb});var socket=require(_0x4663('0x1f'))(new Redis(config[_0x4663('0x1e')]));require(_0x4663('0x20'))[_0x4663('0x21')](socket);var jayson=require('jayson/promise');var client=jayson[_0x4663('0x22')][_0x4663('0x23')]({'port':0x232c});var client9002=jayson[_0x4663('0x22')][_0x4663('0x23')]({'port':0x232a});function respondWithRpcPromise(_0x1b3fb0,_0x5b9603,_0x2bd549,_0x5a5cb1){return new BPromise(function(_0x2b8c4f,_0x5e3f31){var _0x4430d4=_0x5a5cb1||client;return _0x4430d4[_0x4663('0x24')](_0x1b3fb0,_0x2bd549)['then'](function(_0x35f930){logger['info'](_0x4663('0x25'),_0x5b9603,'request\x20sent');logger[_0x4663('0x26')]('FaxAccount,\x20%s,\x20%s,\x20%s',_0x5b9603,_0x4663('0x27'),JSON[_0x4663('0x28')](_0x35f930));if(_0x35f930[_0x4663('0x29')]){if(_0x35f930[_0x4663('0x29')][_0x4663('0x2a')]===0x1f4){logger[_0x4663('0x29')](_0x4663('0x25'),_0x5b9603,_0x35f930[_0x4663('0x29')][_0x4663('0x2b')]);return _0x5e3f31(_0x35f930[_0x4663('0x29')][_0x4663('0x2b')]);}logger[_0x4663('0x29')]('FaxAccount,\x20%s,\x20%s',_0x5b9603,_0x35f930[_0x4663('0x29')]['message']);return _0x2b8c4f(_0x35f930[_0x4663('0x29')][_0x4663('0x2b')]);}else{logger[_0x4663('0x2c')]('FaxAccount,\x20%s,\x20%s',_0x5b9603,_0x4663('0x27'));_0x2b8c4f(_0x35f930[_0x4663('0x2d')][_0x4663('0x2b')]);}})[_0x4663('0x2e')](function(_0x530e41){logger[_0x4663('0x29')](_0x4663('0x25'),_0x5b9603,_0x530e41);_0x5e3f31(_0x530e41);});});}function respondWithStatusCode(_0x16fff7,_0x2422b2){_0x2422b2=_0x2422b2||0xcc;return function(_0x1295e8){if(_0x1295e8){return _0x16fff7[_0x4663('0x2f')](_0x2422b2);}return _0x16fff7[_0x4663('0x30')](_0x2422b2)['end']();};}function respondWithResult(_0x4acd2e,_0xfd13e7){_0xfd13e7=_0xfd13e7||0xc8;return function(_0x6e88b7){if(_0x6e88b7){return _0x4acd2e[_0x4663('0x30')](_0xfd13e7)[_0x4663('0x31')](_0x6e88b7);}};}function respondWithFilteredResult(_0x1e58d1,_0x27cfc8){return function(_0x29566a){if(_0x29566a){var _0x18d488=typeof _0x27cfc8[_0x4663('0x32')]===_0x4663('0x33')&&typeof _0x27cfc8[_0x4663('0x34')]===_0x4663('0x33');var _0x4d3cc0=_0x29566a[_0x4663('0x35')];var _0x1c353f=_0x18d488?0x0:_0x27cfc8[_0x4663('0x32')];var _0x48ee24=_0x18d488?_0x29566a[_0x4663('0x35')]:_0x27cfc8[_0x4663('0x32')]+_0x27cfc8[_0x4663('0x34')];var _0x252a9a;if(_0x48ee24>=_0x4d3cc0){_0x48ee24=_0x4d3cc0;_0x252a9a=0xc8;}else{_0x252a9a=0xce;}_0x1e58d1[_0x4663('0x30')](_0x252a9a);return _0x1e58d1[_0x4663('0x36')](_0x4663('0x37'),_0x1c353f+'-'+_0x48ee24+'/'+_0x4d3cc0)[_0x4663('0x31')](_0x29566a);}return null;};}function patchUpdates(_0x36d728){return function(_0x51b4af){try{jsonpatch[_0x4663('0x38')](_0x51b4af,_0x36d728,!![]);}catch(_0xd61d7f){return BPromise[_0x4663('0x39')](_0xd61d7f);}return _0x51b4af['save']();};}function saveUpdates(_0x56fd1f,_0x1619f7){return function(_0x2be72a){if(_0x2be72a){return _0x2be72a[_0x4663('0x3a')](_0x56fd1f)[_0x4663('0x3b')](function(_0x171d61){return _0x171d61;});}return null;};}function removeEntity(_0x3f962c,_0xdab1fb){return function(_0x258c12){if(_0x258c12){return _0x258c12[_0x4663('0x3c')]()[_0x4663('0x3b')](function(){var _0x7a42b8=_0x258c12[_0x4663('0x3d')]({'plain':!![]});var _0x14273f=_0x4663('0x3e');return db[_0x4663('0x3f')][_0x4663('0x3c')]({'where':{'type':_0x14273f,'resourceId':_0x7a42b8['id']}})[_0x4663('0x3b')](function(){return _0x258c12;});})['then'](function(){_0x3f962c['status'](0xcc)[_0x4663('0x40')]();});}};}function handleEntityNotFound(_0x3b5d7d,_0x1124ad){return function(_0x4253d2){if(!_0x4253d2){_0x3b5d7d[_0x4663('0x2f')](0x194);}return _0x4253d2;};}function handleError(_0x33e5c9,_0x18261c){_0x18261c=_0x18261c||0x1f4;return function(_0x92fea1){logger[_0x4663('0x29')](_0x92fea1[_0x4663('0x41')]);if(_0x92fea1[_0x4663('0x42')]){delete _0x92fea1[_0x4663('0x42')];}_0x33e5c9['status'](_0x18261c)[_0x4663('0x43')](_0x92fea1);};}exports[_0x4663('0x44')]=function(_0x1d0afd,_0x595495){var _0x1794d4={'include':[{'model':db[_0x4663('0x45')],'as':'mandatoryDispositionPause'}]},_0xd7e325={},_0x498d2c={'count':0x0,'rows':[]};var _0x83ccbc=_[_0x4663('0x46')](db[_0x4663('0x47')][_0x4663('0x48')],function(_0x39d916){return{'name':_0x39d916[_0x4663('0x49')],'type':_0x39d916[_0x4663('0x4a')][_0x4663('0x4b')]};});_0xd7e325[_0x4663('0x4c')]=_[_0x4663('0x46')](_0x83ccbc,_0x4663('0x42'));_0xd7e325['query']=_[_0x4663('0x4d')](_0x1d0afd['query']);_0xd7e325[_0x4663('0x4e')]=_[_0x4663('0x4f')](_0xd7e325['model'],_0xd7e325[_0x4663('0x50')]);_0x1794d4[_0x4663('0x51')]=_[_0x4663('0x4f')](_0xd7e325['model'],qs[_0x4663('0x52')](_0x1d0afd['query'][_0x4663('0x52')]));_0x1794d4[_0x4663('0x51')]=_0x1794d4[_0x4663('0x51')][_0x4663('0x53')]?_0x1794d4[_0x4663('0x51')]:_0xd7e325[_0x4663('0x4c')];if(!_0x1d0afd['query'][_0x4663('0x54')](_0x4663('0x55'))){_0x1794d4['limit']=qs[_0x4663('0x34')](_0x1d0afd[_0x4663('0x50')][_0x4663('0x34')]);_0x1794d4[_0x4663('0x32')]=qs['offset'](_0x1d0afd[_0x4663('0x50')][_0x4663('0x32')]);}_0x1794d4[_0x4663('0x56')]=qs[_0x4663('0x57')](_0x1d0afd[_0x4663('0x50')]['sort']);_0x1794d4[_0x4663('0x58')]=qs[_0x4663('0x4e')](_[_0x4663('0x59')](_0x1d0afd['query'],_0xd7e325['filters']),_0x83ccbc);if(_0x1d0afd[_0x4663('0x50')][_0x4663('0x5a')]){_0x1794d4[_0x4663('0x58')]=_[_0x4663('0x5b')](_0x1794d4[_0x4663('0x58')],{'$or':_['map'](_0x83ccbc,function(_0x1f5025){if(_0x1f5025[_0x4663('0x4a')]!==_0x4663('0x5c')){var _0x24b1b5={};_0x24b1b5[_0x1f5025[_0x4663('0x42')]]={'$like':'%'+_0x1d0afd[_0x4663('0x50')]['filter']+'%'};return _0x24b1b5;}})});}_0x1794d4=_[_0x4663('0x5b')]({},_0x1794d4,_0x1d0afd[_0x4663('0x5d')]);var _0x4975e5={'where':_0x1794d4['where']};return db['FaxAccount']['count'](_0x4975e5)[_0x4663('0x3b')](function(_0x1b82e7){_0x498d2c[_0x4663('0x35')]=_0x1b82e7;if(_0x1d0afd[_0x4663('0x50')]['includeAll']){_0x1794d4[_0x4663('0x5e')]=[{'all':!![]}];}return db[_0x4663('0x47')][_0x4663('0x5f')](_0x1794d4);})[_0x4663('0x3b')](function(_0x144aab){_0x498d2c['rows']=_0x144aab;return _0x498d2c;})[_0x4663('0x3b')](respondWithFilteredResult(_0x595495,_0x1794d4))['catch'](handleError(_0x595495,null));};exports[_0x4663('0x60')]=function(_0x2f3d1d,_0x20ea51){var _0x163ac6={'raw':![],'where':{'id':_0x2f3d1d[_0x4663('0x61')]['id']},'include':[{'model':db['Pause'],'as':_0x4663('0x62')}]},_0x3b4e0e={};_0x3b4e0e[_0x4663('0x4c')]=_[_0x4663('0x4d')](db[_0x4663('0x47')][_0x4663('0x48')]);_0x3b4e0e['query']=_[_0x4663('0x4d')](_0x2f3d1d[_0x4663('0x50')]);_0x3b4e0e[_0x4663('0x4e')]=_[_0x4663('0x4f')](_0x3b4e0e[_0x4663('0x4c')],_0x3b4e0e['query']);_0x163ac6[_0x4663('0x51')]=_[_0x4663('0x4f')](_0x3b4e0e[_0x4663('0x4c')],qs['fields'](_0x2f3d1d[_0x4663('0x50')]['fields']));_0x163ac6[_0x4663('0x51')]=_0x163ac6['attributes'][_0x4663('0x53')]?_0x163ac6[_0x4663('0x51')]:_0x3b4e0e[_0x4663('0x4c')];if(_0x2f3d1d['query'][_0x4663('0x63')]){_0x163ac6['include']=[{'all':!![]}];}_0x163ac6=_[_0x4663('0x5b')]({},_0x163ac6,_0x2f3d1d[_0x4663('0x5d')]);return db[_0x4663('0x47')][_0x4663('0x64')](_0x163ac6)['then'](handleEntityNotFound(_0x20ea51,null))[_0x4663('0x3b')](respondWithResult(_0x20ea51,null))[_0x4663('0x2e')](handleError(_0x20ea51,null));};exports['create']=function(_0x4d1754,_0x11caf6){return db['FaxAccount'][_0x4663('0x65')](_0x4d1754[_0x4663('0x66')],{})['then'](function(_0x54e9ea){var _0x48a2e7=_0x4d1754['user'][_0x4663('0x3d')]({'plain':!![]});if(!_0x48a2e7)throw new Error(_0x4663('0x67'));if(_0x48a2e7[_0x4663('0x68')]===_0x4663('0x69')){var _0x8faf1e=_0x54e9ea['get']({'plain':!![]});var _0x20daa3=_0x4663('0x3e');return db[_0x4663('0x6a')]['find']({'where':{'name':_0x20daa3,'userProfileId':_0x48a2e7['userProfileId']},'raw':!![]})[_0x4663('0x3b')](function(_0x5167ff){if(_0x5167ff&&_0x5167ff[_0x4663('0x6b')]===0x0){return db['UserProfileResource'][_0x4663('0x65')]({'name':_0x8faf1e['name'],'resourceId':_0x8faf1e['id'],'type':_0x5167ff[_0x4663('0x42')],'sectionId':_0x5167ff['id']},{})[_0x4663('0x3b')](function(){return _0x54e9ea;});}else{return _0x54e9ea;}})[_0x4663('0x2e')](function(_0x59714f){logger[_0x4663('0x29')](_0x4663('0x6c'),_0x59714f);throw _0x59714f;});}return _0x54e9ea;})[_0x4663('0x3b')](respondWithResult(_0x11caf6,0xc9))['catch'](handleError(_0x11caf6,null));};exports[_0x4663('0x3a')]=function(_0x55cb6d,_0xe7eb9f){if(_0x55cb6d[_0x4663('0x66')]['id']){delete _0x55cb6d[_0x4663('0x66')]['id'];}return db[_0x4663('0x47')][_0x4663('0x64')]({'where':{'id':_0x55cb6d[_0x4663('0x61')]['id']},'include':[{'model':db['Pause'],'as':_0x4663('0x62')}]})[_0x4663('0x3b')](handleEntityNotFound(_0xe7eb9f,null))[_0x4663('0x3b')](saveUpdates(_0x55cb6d[_0x4663('0x66')],null))[_0x4663('0x3b')](respondWithResult(_0xe7eb9f,null))['catch'](handleError(_0xe7eb9f,null));};exports[_0x4663('0x3c')]=function(_0x1180dd,_0x42ed1e){return db[_0x4663('0x47')][_0x4663('0x64')]({'where':{'id':_0x1180dd[_0x4663('0x61')]['id']}})[_0x4663('0x3b')](handleEntityNotFound(_0x42ed1e,null))[_0x4663('0x3b')](removeEntity(_0x42ed1e,null))[_0x4663('0x2e')](handleError(_0x42ed1e,null));};exports['describe']=function(_0x37989b,_0x3a54c2){return db['FaxAccount'][_0x4663('0x6d')]()['then'](respondWithResult(_0x3a54c2,null))[_0x4663('0x2e')](handleError(_0x3a54c2,null));};exports[_0x4663('0x6e')]=function(_0x2f4790,_0x18b341,_0x11b51e){if(_0x2f4790[_0x4663('0x66')]['id']){delete _0x2f4790['body']['id'];}return db['FaxAccount']['find']({'where':{'id':_0x2f4790[_0x4663('0x61')]['id']}})[_0x4663('0x3b')](handleEntityNotFound(_0x18b341,null))[_0x4663('0x3b')](function(_0x3f5697){if(_0x3f5697){_0x2f4790['body']['FaxAccountId']=_0x3f5697['id'];return db[_0x4663('0x6f')][_0x4663('0x65')](_0x2f4790[_0x4663('0x66')]);}})[_0x4663('0x3b')](respondWithResult(_0x18b341,null))[_0x4663('0x2e')](handleError(_0x18b341,null));};exports[_0x4663('0x70')]=function(_0x301370,_0x383eb8,_0x47ed05){var _0x12a391={'raw':![],'where':{}};var _0x4f8257={};var _0x5bf9d4={'count':0x0,'rows':[]};return db['FaxAccount'][_0x4663('0x71')]({'where':{'id':_0x301370['params']['id']}})['then'](handleEntityNotFound(_0x383eb8,null))['then'](function(_0x51a692){if(_0x51a692){_0x4f8257[_0x4663('0x4c')]=_[_0x4663('0x4d')](db['Disposition']['rawAttributes']);_0x4f8257['query']=_[_0x4663('0x4d')](_0x301370[_0x4663('0x50')]);_0x4f8257[_0x4663('0x4e')]=_[_0x4663('0x4f')](_0x4f8257['model'],_0x4f8257[_0x4663('0x50')]);_0x12a391[_0x4663('0x51')]=_[_0x4663('0x4f')](_0x4f8257['model'],qs[_0x4663('0x52')](_0x301370['query'][_0x4663('0x52')]));_0x12a391[_0x4663('0x51')]=_0x12a391['attributes'][_0x4663('0x53')]?_0x12a391[_0x4663('0x51')]:_0x4f8257['model'];if(!_0x301370[_0x4663('0x50')][_0x4663('0x54')](_0x4663('0x55'))){_0x12a391['limit']=qs[_0x4663('0x34')](_0x301370[_0x4663('0x50')][_0x4663('0x34')]);_0x12a391[_0x4663('0x32')]=qs[_0x4663('0x32')](_0x301370[_0x4663('0x50')][_0x4663('0x32')]);}_0x12a391[_0x4663('0x56')]=qs[_0x4663('0x57')](_0x301370['query'][_0x4663('0x57')]);_0x12a391[_0x4663('0x58')]=qs['filters'](_[_0x4663('0x59')](_0x301370[_0x4663('0x50')],_0x4f8257[_0x4663('0x4e')]));_0x12a391[_0x4663('0x58')][_0x4663('0x72')]=_0x51a692['id'];if(_0x301370[_0x4663('0x50')][_0x4663('0x5a')]){_0x12a391[_0x4663('0x58')]=_[_0x4663('0x5b')](_0x12a391[_0x4663('0x58')],{'$or':_[_0x4663('0x46')](_0x12a391[_0x4663('0x51')],function(_0x1a3337){var _0x3e1854={};_0x3e1854[_0x1a3337]={'$like':'%'+_0x301370[_0x4663('0x50')][_0x4663('0x5a')]+'%'};return _0x3e1854;})});}_0x12a391=_[_0x4663('0x5b')]({},_0x12a391,_0x301370[_0x4663('0x5d')]);return db[_0x4663('0x6f')][_0x4663('0x35')]({'where':_0x12a391[_0x4663('0x58')]})[_0x4663('0x3b')](function(_0x3f56d0){_0x5bf9d4[_0x4663('0x35')]=_0x3f56d0;if(_0x301370[_0x4663('0x50')][_0x4663('0x63')]){_0x12a391['include']=[{'all':!![]}];}return db[_0x4663('0x6f')][_0x4663('0x5f')](_0x12a391);})[_0x4663('0x3b')](function(_0xbfc7ed){_0x5bf9d4['rows']=_0xbfc7ed;return _0x5bf9d4;});}})[_0x4663('0x3b')](respondWithFilteredResult(_0x383eb8,_0x12a391))[_0x4663('0x2e')](handleError(_0x383eb8,null));};exports[_0x4663('0x73')]=function(_0x31f8c2,_0x44225c,_0x3562e4){return db['FaxAccount'][_0x4663('0x64')]({'where':{'id':_0x31f8c2['params']['id']}})['then'](handleEntityNotFound(_0x44225c,null))[_0x4663('0x3b')](function(_0x217942){if(_0x217942){return _0x217942[_0x4663('0x73')](_0x31f8c2[_0x4663('0x50')]['ids']);}})[_0x4663('0x3b')](respondWithStatusCode(_0x44225c,null))['catch'](handleError(_0x44225c,null));};exports[_0x4663('0x74')]=function(_0x269f85,_0x24f805,_0x505430){if(_0x269f85[_0x4663('0x66')]['id']){delete _0x269f85['body']['id'];}return db[_0x4663('0x47')][_0x4663('0x64')]({'where':{'id':_0x269f85['params']['id']}})[_0x4663('0x3b')](handleEntityNotFound(_0x24f805,null))[_0x4663('0x3b')](function(_0x30adb7){if(_0x30adb7){_0x269f85[_0x4663('0x66')][_0x4663('0x72')]=_0x30adb7['id'];return db[_0x4663('0x75')]['create'](_0x269f85[_0x4663('0x66')]);}})[_0x4663('0x3b')](respondWithResult(_0x24f805,null))['catch'](handleError(_0x24f805,null));};exports[_0x4663('0x76')]=function(_0x12b53a,_0x162811,_0x34e34a){var _0x593344={'raw':![],'where':{}};var _0x5667d2={};var _0x2b51e8={'count':0x0,'rows':[]};return db['FaxAccount'][_0x4663('0x71')]({'where':{'id':_0x12b53a['params']['id']}})[_0x4663('0x3b')](handleEntityNotFound(_0x162811,null))[_0x4663('0x3b')](function(_0x4b7216){if(_0x4b7216){_0x5667d2[_0x4663('0x4c')]=_['keys'](db[_0x4663('0x75')]['rawAttributes']);_0x5667d2[_0x4663('0x50')]=_[_0x4663('0x4d')](_0x12b53a[_0x4663('0x50')]);_0x5667d2[_0x4663('0x4e')]=_[_0x4663('0x4f')](_0x5667d2[_0x4663('0x4c')],_0x5667d2[_0x4663('0x50')]);_0x593344['attributes']=_[_0x4663('0x4f')](_0x5667d2[_0x4663('0x4c')],qs[_0x4663('0x52')](_0x12b53a[_0x4663('0x50')][_0x4663('0x52')]));_0x593344[_0x4663('0x51')]=_0x593344[_0x4663('0x51')][_0x4663('0x53')]?_0x593344['attributes']:_0x5667d2[_0x4663('0x4c')];if(!_0x12b53a[_0x4663('0x50')][_0x4663('0x54')](_0x4663('0x55'))){_0x593344[_0x4663('0x34')]=qs[_0x4663('0x34')](_0x12b53a[_0x4663('0x50')][_0x4663('0x34')]);_0x593344[_0x4663('0x32')]=qs[_0x4663('0x32')](_0x12b53a[_0x4663('0x50')][_0x4663('0x32')]);}_0x593344[_0x4663('0x56')]=qs[_0x4663('0x57')](_0x12b53a[_0x4663('0x50')]['sort']);_0x593344[_0x4663('0x58')]=qs[_0x4663('0x4e')](_[_0x4663('0x59')](_0x12b53a[_0x4663('0x50')],_0x5667d2['filters']));_0x593344[_0x4663('0x58')][_0x4663('0x72')]=_0x4b7216['id'];if(_0x12b53a[_0x4663('0x50')][_0x4663('0x5a')]){_0x593344['where']=_[_0x4663('0x5b')](_0x593344[_0x4663('0x58')],{'$or':_[_0x4663('0x46')](_0x593344[_0x4663('0x51')],function(_0x44c406){var _0x40e412={};_0x40e412[_0x44c406]={'$like':'%'+_0x12b53a[_0x4663('0x50')][_0x4663('0x5a')]+'%'};return _0x40e412;})});}_0x593344=_[_0x4663('0x5b')]({},_0x593344,_0x12b53a[_0x4663('0x5d')]);return db[_0x4663('0x75')][_0x4663('0x35')]({'where':_0x593344[_0x4663('0x58')]})['then'](function(_0x2b2ee2){_0x2b51e8['count']=_0x2b2ee2;if(_0x12b53a[_0x4663('0x50')][_0x4663('0x63')]){_0x593344[_0x4663('0x5e')]=[{'all':!![]}];}return db[_0x4663('0x75')][_0x4663('0x5f')](_0x593344);})['then'](function(_0x41e273){_0x2b51e8[_0x4663('0x77')]=_0x41e273;return _0x2b51e8;});}})['then'](respondWithFilteredResult(_0x162811,_0x593344))[_0x4663('0x2e')](handleError(_0x162811,null));};exports[_0x4663('0x78')]=function(_0x5094fe,_0x1f8fd4,_0x19c194){return db[_0x4663('0x47')][_0x4663('0x64')]({'where':{'id':_0x5094fe['params']['id']}})[_0x4663('0x3b')](handleEntityNotFound(_0x1f8fd4,null))[_0x4663('0x3b')](function(_0x240c12){if(_0x240c12){return _0x240c12[_0x4663('0x78')](_0x5094fe[_0x4663('0x50')][_0x4663('0x79')]);}})[_0x4663('0x3b')](respondWithStatusCode(_0x1f8fd4,null))['catch'](handleError(_0x1f8fd4,null));};exports['addInteraction']=function(_0x25e4e2,_0x42b705,_0x3a3650){return db[_0x4663('0x7a')]['find']({'where':{'id':_0x25e4e2[_0x4663('0x61')]['id']}})[_0x4663('0x3b')](handleEntityNotFound(_0x42b705,null))['then'](function(_0x14abf6){if(_0x14abf6){return _0x14abf6[_0x4663('0x7b')](_0x25e4e2[_0x4663('0x66')][_0x4663('0x79')],_[_0x4663('0x7c')](_0x25e4e2[_0x4663('0x66')],['ids','id'])||{});}})[_0x4663('0x3b')](respondWithResult(_0x42b705,null))[_0x4663('0x2e')](handleError(_0x42b705,null));};exports[_0x4663('0x7d')]=function(_0x3dc58e,_0x1f3585,_0x25b53c){var _0x3d7802={'raw':![],'where':{}};var _0x539181={};var _0x4e4983={'count':0x0,'rows':[]};return db[_0x4663('0x47')][_0x4663('0x71')]({'where':{'id':_0x3dc58e[_0x4663('0x61')]['id']}})[_0x4663('0x3b')](handleEntityNotFound(_0x1f3585,null))[_0x4663('0x3b')](function(_0x53987b){if(_0x53987b){_0x539181['model']=_['keys'](db[_0x4663('0x7a')][_0x4663('0x48')]);_0x539181[_0x4663('0x50')]=_[_0x4663('0x4d')](_0x3dc58e[_0x4663('0x50')]);_0x539181[_0x4663('0x4e')]=_[_0x4663('0x4f')](_0x539181[_0x4663('0x4c')],_0x539181[_0x4663('0x50')]);_0x3d7802[_0x4663('0x51')]=_[_0x4663('0x4f')](_0x539181[_0x4663('0x4c')],qs[_0x4663('0x52')](_0x3dc58e[_0x4663('0x50')][_0x4663('0x52')]));_0x3d7802[_0x4663('0x51')]=_0x3d7802['attributes']['length']?_0x3d7802[_0x4663('0x51')]:_0x539181['model'];if(!_0x3dc58e[_0x4663('0x50')][_0x4663('0x54')](_0x4663('0x55'))){_0x3d7802[_0x4663('0x34')]=qs['limit'](_0x3dc58e['query'][_0x4663('0x34')]);_0x3d7802[_0x4663('0x32')]=qs[_0x4663('0x32')](_0x3dc58e['query']['offset']);}_0x3d7802[_0x4663('0x56')]=qs[_0x4663('0x57')](_0x3dc58e[_0x4663('0x50')][_0x4663('0x57')]);_0x3d7802[_0x4663('0x58')]=qs[_0x4663('0x4e')](_[_0x4663('0x59')](_0x3dc58e['query'],_0x539181[_0x4663('0x4e')]));_0x3d7802['where'][_0x4663('0x72')]=_0x53987b['id'];if(_0x3dc58e[_0x4663('0x50')][_0x4663('0x5a')]){_0x3d7802[_0x4663('0x58')]=_[_0x4663('0x5b')](_0x3d7802[_0x4663('0x58')],{'$or':_[_0x4663('0x46')](_0x3d7802[_0x4663('0x51')],function(_0x3c4582){var _0x2e2b80={};_0x2e2b80[_0x3c4582]={'$like':'%'+_0x3dc58e['query']['filter']+'%'};return _0x2e2b80;})});}_0x3d7802=_['merge']({},_0x3d7802,_0x3dc58e[_0x4663('0x5d')]);return db[_0x4663('0x7a')][_0x4663('0x35')]({'where':_0x3d7802[_0x4663('0x58')]})['then'](function(_0x62abea){_0x4e4983[_0x4663('0x35')]=_0x62abea;if(_0x3dc58e[_0x4663('0x50')][_0x4663('0x63')]){_0x3d7802[_0x4663('0x5e')]=[{'model':db[_0x4663('0x7e')],'as':_0x4663('0x7f'),'required':![]},{'model':db[_0x4663('0x80')],'as':_0x4663('0x81'),'attributes':[_0x4663('0x42'),'fullname',_0x4663('0x82')],'required':![]},{'model':db[_0x4663('0x83')],'as':_0x4663('0x84'),'attributes':['id',_0x4663('0x42'),_0x4663('0x85')],'where':_0x3dc58e[_0x4663('0x50')]['tag']?{'id':_0x3dc58e[_0x4663('0x50')][_0x4663('0x86')]}:undefined,'required':_0x3dc58e[_0x4663('0x50')]['tag']?!![]:![]}];}return db['FaxInteraction'][_0x4663('0x5f')](_0x3d7802);})[_0x4663('0x3b')](function(_0x50111c){_0x4e4983['rows']=_0x50111c;return _0x4e4983;});}})[_0x4663('0x3b')](respondWithFilteredResult(_0x1f3585,_0x3d7802))[_0x4663('0x2e')](handleError(_0x1f3585,null));};exports[_0x4663('0x87')]=function(_0x1ce92c,_0x166edd){var _0x381fbd=_0x1ce92c[_0x4663('0x61')]['id'];var _0x4ae070=_0x1ce92c[_0x4663('0x66')];var _0xda0346=0xc8;var _0x1525b7=null;return db[_0x4663('0x88')][_0x4663('0x89')]({'isolationLevel':db[_0x4663('0x88')]['Transaction'][_0x4663('0x8a')][_0x4663('0x8b')]},function(_0x16e773){return db[_0x4663('0x47')]['findOne']({'where':{'id':_0x381fbd},'transaction':_0x16e773})[_0x4663('0x3b')](function(_0x4628e9){if(_0x4628e9){return db[_0x4663('0x8c')]['destroy']({'where':{'FaxAccountId':_0x381fbd},'transaction':_0x16e773})[_0x4663('0x3b')](function(){var _0x137153=_['map'](_0x4ae070,function(_0x4ebbd0){_0x4ebbd0[_0x4663('0x72')]=_0x381fbd;return _0x4ebbd0;});return db[_0x4663('0x8c')][_0x4663('0x8d')](_0x137153,{'transaction':_0x16e773});});}else{_0xda0346=0x194;_0x1525b7=[];}});})[_0x4663('0x3b')](function(){if(_0xda0346!==0x194){return db['FaxApplication'][_0x4663('0x8e')]({'where':{'FaxAccountId':_0x381fbd},'order':_0x4663('0x8f')})[_0x4663('0x3b')](function(_0x3c503b){_0x1525b7=_0x3c503b;});}})['catch'](function(_0xac8f61){_0xda0346=0x1f4;logger[_0x4663('0x29')](_0xac8f61[_0x4663('0x41')]);if(_0xac8f61[_0x4663('0x42')]){delete _0xac8f61[_0x4663('0x42')];}_0x1525b7=_0xac8f61;})['finally'](function(){if(_0x1525b7===null){_0x166edd[_0x4663('0x2f')](_0xda0346);}else{if(_0xda0346===0x1f4){_0x166edd['status'](_0xda0346)['send'](_0x1525b7);}else{_0x166edd[_0x4663('0x30')](_0xda0346)['json'](_0x1525b7);}}});};exports[_0x4663('0x90')]=function(_0x566b38,_0x3d5963,_0x32b69d){var _0x2d2b4e={};var _0x44858c={};var _0x1e3fa6;var _0xc62cdc;return db[_0x4663('0x47')]['findOne']({'where':{'id':_0x566b38[_0x4663('0x61')]['id']}})['then'](handleEntityNotFound(_0x3d5963,null))[_0x4663('0x3b')](function(_0x2a0ebc){if(_0x2a0ebc){_0x1e3fa6=_0x2a0ebc;_0x44858c[_0x4663('0x4c')]=_[_0x4663('0x4d')](db[_0x4663('0x8c')][_0x4663('0x48')]);_0x44858c[_0x4663('0x50')]=_[_0x4663('0x4d')](_0x566b38['query']);_0x44858c[_0x4663('0x4e')]=_[_0x4663('0x4f')](_0x44858c[_0x4663('0x4c')],_0x44858c[_0x4663('0x50')]);_0x2d2b4e[_0x4663('0x51')]=_[_0x4663('0x4f')](_0x44858c[_0x4663('0x4c')],qs[_0x4663('0x52')](_0x566b38[_0x4663('0x50')][_0x4663('0x52')]));_0x2d2b4e[_0x4663('0x51')]=_0x2d2b4e[_0x4663('0x51')][_0x4663('0x53')]?_0x2d2b4e[_0x4663('0x51')]:_0x44858c[_0x4663('0x4c')];_0x2d2b4e['order']=qs[_0x4663('0x57')](_0x566b38[_0x4663('0x50')][_0x4663('0x57')]);_0x2d2b4e[_0x4663('0x58')]=qs[_0x4663('0x4e')](_[_0x4663('0x59')](_0x566b38[_0x4663('0x50')],_0x44858c['filters']));if(_0x566b38[_0x4663('0x50')][_0x4663('0x5a')]){_0x2d2b4e[_0x4663('0x58')]=_[_0x4663('0x5b')](_0x2d2b4e[_0x4663('0x58')],{'$or':_[_0x4663('0x46')](_0x2d2b4e[_0x4663('0x51')],function(_0x29f8d5){var _0x59e08f={};_0x59e08f[_0x29f8d5]={'$like':'%'+_0x566b38[_0x4663('0x50')][_0x4663('0x5a')]+'%'};return _0x59e08f;})});}_0x2d2b4e=_[_0x4663('0x5b')]({},_0x2d2b4e,_0x566b38[_0x4663('0x5d')]);return _0x1e3fa6[_0x4663('0x90')](_0x2d2b4e);}})[_0x4663('0x3b')](function(_0x355bc9){if(_0x355bc9){_0xc62cdc=_0x355bc9['length'];if(!_0x566b38[_0x4663('0x50')][_0x4663('0x54')]('nolimit')){_0x2d2b4e[_0x4663('0x34')]=qs[_0x4663('0x34')](_0x566b38[_0x4663('0x50')][_0x4663('0x34')]);_0x2d2b4e[_0x4663('0x32')]=qs['offset'](_0x566b38[_0x4663('0x50')][_0x4663('0x32')]);}return _0x1e3fa6[_0x4663('0x90')](_0x2d2b4e);}})[_0x4663('0x3b')](function(_0x20f299){if(_0x20f299){return _0x20f299?{'count':_0xc62cdc,'rows':_0x20f299}:null;}})[_0x4663('0x3b')](respondWithResult(_0x3d5963,null))['catch'](handleError(_0x3d5963,null));};function Extension(_0x2618b2,_0x31d9ad,_0xc6134b,_0x2a4cd2){this[_0x4663('0x91')]=_0x4663('0x92');this['exten']=_0x2618b2[_0x4663('0x93')];this[_0x4663('0x94')]=_0x2a4cd2;this[_0x4663('0x4a')]=_0x4663('0x95');this['description']=_0x4663('0x96');this[_0x4663('0x72')]=_0x2618b2['id'];this['priority']=_0x31d9ad;this['appdata']=_0xc6134b;}function createExtensionsReciveFax(_0x4f6e82){var _0x5cc642=0x1;var _0x4ea49f=[];_0x4ea49f[_0x4663('0x97')](new Extension(_0x4f6e82,_0x5cc642,'',_0x4663('0x98')));_0x5cc642+=0x1;_0x4ea49f[_0x4663('0x97')](new Extension(_0x4f6e82,_0x5cc642,_0x4663('0x99'),_0x4663('0x9a')));_0x5cc642+=0x1;for(var _0x44c1a3 in _0x4f6e82){if(_0x4f6e82[_0x4663('0x54')](_0x44c1a3)&&(_0x44c1a3==='ecm'||_0x44c1a3==='localstationid'||_0x44c1a3===_0x4663('0x9b')||_0x44c1a3===_0x4663('0x9c')||_0x44c1a3===_0x4663('0x9d')||_0x44c1a3==='maxrate'||_0x44c1a3===_0x4663('0x9e')||_0x44c1a3===_0x4663('0x9f')||_0x44c1a3===_0x4663('0xa0'))){_0x4ea49f['push'](new Extension(_0x4f6e82,_0x5cc642,_0x4663('0xa1')+_0x44c1a3+')='+_0x4f6e82[_0x44c1a3],_0x4663('0x9a')));_0x5cc642+=0x1;}}_0x4ea49f[_0x4663('0x97')](new Extension(_0x4f6e82,_0x5cc642,'6',_0x4663('0xa2')));_0x5cc642+=0x1;_0x4ea49f[_0x4663('0x97')](new Extension(_0x4f6e82,_0x5cc642,_0x4663('0xa3'),_0x4663('0xa4')));_0x5cc642=0x0;return _0x4ea49f;}exports[_0x4663('0xa5')]=function(_0xc36cd,_0x5b0db0,_0x59d5f8){var _0x523d0b;return db[_0x4663('0x88')]['transaction'](function(_0x2b8554){return db[_0x4663('0x47')][_0x4663('0x65')](_0xc36cd[_0x4663('0x66')],{'transaction':_0x2b8554})[_0x4663('0x3b')](function(_0x1332dc){_0x523d0b=_0x1332dc[_0x4663('0x3d')]({'plain':!![]});return db[_0x4663('0xa6')][_0x4663('0x8d')](createExtensionsReciveFax(_0x523d0b),{'transaction':_0x2b8554});});})[_0x4663('0x3b')](function(){return _0x523d0b;})['then'](respondWithResult(_0x5b0db0,null))[_0x4663('0x2e')](handleError(_0x5b0db0,null));};exports['updateAccountApplications']=function(_0x276a70,_0x297f67,_0x5413f0){var _0x187faf;return db[_0x4663('0x88')][_0x4663('0x89')](function(_0x2c9cb6){return db[_0x4663('0x47')]['update'](_0x276a70[_0x4663('0x66')],{'where':{'id':_0x276a70['body']['id']},'transaction':_0x2c9cb6})[_0x4663('0x3b')](function(_0x33bf7d){return db[_0x4663('0xa6')][_0x4663('0x3c')]({'where':{'FaxAccountId':_0x276a70['body']['id']},'transaction':_0x2c9cb6})[_0x4663('0x3b')](function(_0x3fcc15){return db[_0x4663('0xa6')][_0x4663('0x8d')](createExtensionsReciveFax(_[_0x4663('0x7c')](_0x276a70[_0x4663('0x66')],[_0x4663('0xa7'),'key',_0x4663('0xa8'),'updatedAt',_0x4663('0xa9'),'ListId'])),{'transaction':_0x2c9cb6});});});})[_0x4663('0x3b')](function(){return db[_0x4663('0x47')][_0x4663('0xaa')](_0x276a70[_0x4663('0x66')]['id']);})[_0x4663('0x3b')](respondWithResult(_0x297f67,null))[_0x4663('0x2e')](handleError(_0x297f67,null));};exports[_0x4663('0xab')]=function(_0x5cb2b7,_0x5069e3,_0x263841){var _0x3b490e={'raw':!![],'where':{}};var _0x1fb7aa={};var _0x20331e={'count':0x0,'rows':[]};return db[_0x4663('0x47')][_0x4663('0x71')]({'where':{'id':_0x5cb2b7[_0x4663('0x61')]['id']}})[_0x4663('0x3b')](handleEntityNotFound(_0x5069e3,null))['then'](function(_0x107076){if(_0x107076){_0x1fb7aa[_0x4663('0x4c')]=_['keys'](db['FaxMessage'][_0x4663('0x48')]);_0x1fb7aa[_0x4663('0x50')]=_[_0x4663('0x4d')](_0x5cb2b7['query']);_0x1fb7aa[_0x4663('0x4e')]=_[_0x4663('0x4f')](_0x1fb7aa[_0x4663('0x4c')],_0x1fb7aa[_0x4663('0x50')]);_0x3b490e['attributes']=_[_0x4663('0x4f')](_0x1fb7aa[_0x4663('0x4c')],qs['fields'](_0x5cb2b7[_0x4663('0x50')][_0x4663('0x52')]));_0x3b490e[_0x4663('0x51')]=_0x3b490e[_0x4663('0x51')][_0x4663('0x53')]?_0x3b490e[_0x4663('0x51')]:_0x1fb7aa[_0x4663('0x4c')];if(!_0x5cb2b7[_0x4663('0x50')][_0x4663('0x54')](_0x4663('0x55'))){_0x3b490e[_0x4663('0x34')]=qs['limit'](_0x5cb2b7[_0x4663('0x50')]['limit']);_0x3b490e[_0x4663('0x32')]=qs[_0x4663('0x32')](_0x5cb2b7[_0x4663('0x50')][_0x4663('0x32')]);}_0x3b490e['order']=qs[_0x4663('0x57')](_0x5cb2b7['query'][_0x4663('0x57')]);_0x3b490e['where']=qs[_0x4663('0x4e')](_[_0x4663('0x59')](_0x5cb2b7['query'],_0x1fb7aa[_0x4663('0x4e')]));_0x3b490e[_0x4663('0x58')]['FaxAccountId']=_0x107076['id'];if(_0x5cb2b7['query'][_0x4663('0x5a')]){_0x3b490e[_0x4663('0x58')]=_[_0x4663('0x5b')](_0x3b490e[_0x4663('0x58')],{'$or':_[_0x4663('0x46')](_0x3b490e['attributes'],function(_0x2c650c){var _0x2882b3={};_0x2882b3[_0x2c650c]={'$like':'%'+_0x5cb2b7['query'][_0x4663('0x5a')]+'%'};return _0x2882b3;})});}if(_0x5cb2b7[_0x4663('0x50')][_0x4663('0xac')]){var _0x5010bd=_0x5cb2b7['query'][_0x4663('0xac')][_0x4663('0xad')](',');var _0x2c1f03={};_0x2c1f03[_0x5010bd[0x0]]={'$gte':moment(_0x5010bd[0x1])['format']('YYYY-MM-DD\x20HH:mm:ss')};_0x3b490e[_0x4663('0x58')]=_['merge'](_0x3b490e['where'],_0x2c1f03);}_0x3b490e=_[_0x4663('0x5b')]({},_0x3b490e,_0x5cb2b7[_0x4663('0x5d')]);return db[_0x4663('0xae')][_0x4663('0x35')]({'where':_0x3b490e['where']})[_0x4663('0x3b')](function(_0x3af1f8){_0x20331e['count']=_0x3af1f8;if(_0x5cb2b7[_0x4663('0x50')][_0x4663('0x63')]){_0x3b490e[_0x4663('0x5e')]=[{'all':!![]}];}return db['FaxMessage'][_0x4663('0x5f')](_0x3b490e);})[_0x4663('0x3b')](function(_0x5af3b8){_0x20331e[_0x4663('0x77')]=_0x5af3b8;return _0x20331e;});}})[_0x4663('0x3b')](respondWithFilteredResult(_0x5069e3,_0x3b490e))['catch'](handleError(_0x5069e3,null));};exports[_0x4663('0x43')]=function(_0xbb7ca2,_0x13edc5,_0x445def){var _0x1a9140,_0x241c23={},_0x47fe10;if(_0xbb7ca2['body']['to']){_0x47fe10=_0xbb7ca2[_0x4663('0x66')]['to'][0x0];}return db[_0x4663('0x47')][_0x4663('0x64')]({'where':{'id':_0xbb7ca2[_0x4663('0x61')]['id']},'include':[{'model':db[_0x4663('0xaf')],'as':'List','include':[{'model':db[_0x4663('0x7e')],'as':_0x4663('0xb0'),'where':{'fax':_0x47fe10},'limit':0x1,'order':[[_0x4663('0xb1'),_0x4663('0xb2')]]}]}]})[_0x4663('0x3b')](handleEntityNotFound(_0x13edc5,null))['then'](function(_0x3e5d2a){_0x1a9140=_0x3e5d2a;if(_0xbb7ca2[_0x4663('0x66')][_0x4663('0xb3')]&&_0xbb7ca2[_0x4663('0x66')][_0x4663('0xb3')][_0x4663('0x53')]){for(var _0x5dca62=0x0;_0x5dca62<_0xbb7ca2[_0x4663('0x66')]['attachments'][_0x4663('0x53')];_0x5dca62+=0x1){_0xbb7ca2[_0x4663('0x66')][_0x4663('0xb3')][_0x5dca62]={'filename':_0xbb7ca2[_0x4663('0x66')][_0x4663('0xb3')][_0x5dca62]['name'],'id':_0xbb7ca2[_0x4663('0x66')][_0x4663('0xb3')][_0x5dca62]['id'],'path':path[_0x4663('0xb4')](config[_0x4663('0xb5')],'server/files/attachments',_0xbb7ca2[_0x4663('0x66')][_0x4663('0xb3')][_0x5dca62]['basename'])};}}return respondWithRpcPromise(_0x4663('0xb6'),_0x4663('0xb6'),{'FaxAccountId':_[_0x4663('0xb7')](_0xbb7ca2['params']['id'])?undefined:_0xbb7ca2[_0x4663('0x61')]['id'],'path':_[_0x4663('0xb7')](_0xbb7ca2[_0x4663('0x66')][_0x4663('0xb3')][0x0][_0x4663('0x8')])?undefined:_0xbb7ca2['body']['attachments'][0x0][_0x4663('0x8')],'fax':_[_0x4663('0xb7')](_0xbb7ca2['body']['to'][0x0])?undefined:_0xbb7ca2['body']['to'][0x0]},client9002);})[_0x4663('0x3b')](function(){if(_0x1a9140){if(_['isNil'](_0xbb7ca2[_0x4663('0x66')][_0x4663('0xb8')])){_0xbb7ca2[_0x4663('0x66')][_0x4663('0xb8')]=util[_0x4663('0xb9')](_0x4663('0xba'),_0x1a9140['name'],_0x1a9140[_0x4663('0xbb')]);}if(_0x1a9140[_0x4663('0xbc')]){if(_0x1a9140['List'][_0x4663('0xb0')]['length']){return _0x1a9140[_0x4663('0xbc')][_0x4663('0xb0')][0x0];}else{return db[_0x4663('0x7e')][_0x4663('0x65')](_[_0x4663('0x1d')](_0xbb7ca2[_0x4663('0x66')],{'firstName':_0xbb7ca2['body']['to'][0x0],'phone':_0xbb7ca2[_0x4663('0x66')]['to'][0x0],'fax':_0xbb7ca2[_0x4663('0x66')]['to'][0x0],'ListId':_0x1a9140[_0x4663('0xbd')]}));}}else{throw new Error(_0x4663('0xbe'));}}else{throw new Error(_0x4663('0xbf'));}})[_0x4663('0x3b')](function(_0x491d59){if(_0x491d59){return db[_0x4663('0x7a')]['find']({'where':{'ContactId':_0x491d59['id'],'closed':![],'FaxAccountId':_0x1a9140['id']}})[_0x4663('0x3b')](function(_0x515de4){if(_0x515de4){return[_0x515de4,![]];}return db[_0x4663('0x7a')][_0x4663('0x65')]({'UserId':_0xbb7ca2['user']['id'],'ContactId':_0x491d59['id'],'FaxAccountId':_0x1a9140['id'],'fax':_0xbb7ca2['body']['to'][0x0],'firstMsgDirection':_0x4663('0xc0'),'Messages':[_[_0x4663('0x5b')](_0xbb7ca2[_0x4663('0x66')],{'read':![],'body':_0xbb7ca2[_0x4663('0x66')][_0x4663('0xb3')][0x0][_0x4663('0xc1')],'FaxAccountId':_0x1a9140['id'],'UserId':_0xbb7ca2[_0x4663('0x69')]['id'],'ContactId':_0x491d59['id'],'AttachmentId':_0xbb7ca2['body'][_0x4663('0xb3')][0x0]['id']})]},{'include':[{'model':db[_0x4663('0xae')],'as':'Messages'}]})[_0x4663('0x3b')](function(_0x4c7672){return[_0x4c7672,!![]];});});}else{throw new Error(_0x4663('0xc2'));}})['spread'](function(_0x27f529,_0x544708){if(_0x544708){return _0x27f529;}return db[_0x4663('0xae')][_0x4663('0x65')]({'direction':_0x4663('0xc0'),'read':![],'body':_0xbb7ca2[_0x4663('0x66')]['attachments'][0x0][_0x4663('0xc1')],'FaxAccountId':_0x1a9140['id'],'FaxInteractionId':_0x27f529['id'],'UserId':_0xbb7ca2['user']['id'],'ContactId':_0x27f529[_0x4663('0xc3')],'AttachmentId':_0xbb7ca2[_0x4663('0x66')]['attachments'][0x0]['id']})['then'](function(_0x23fe27){_0x27f529['dataValues'][_0x4663('0xc4')]=[];_0x27f529[_0x4663('0xc5')][_0x4663('0xc4')]['push'](_0x23fe27[_0x4663('0xc5')]);return _0x27f529;});})['then'](function(_0x5e4387){respondWithRpcPromise(_0x4663('0xc6'),_0x4663('0xc6'),{'FaxAccountId':_['isNil'](_0xbb7ca2['params']['id'])?undefined:_0xbb7ca2[_0x4663('0x61')]['id'],'path':_[_0x4663('0xb7')](_0xbb7ca2[_0x4663('0x66')]['attachments'][0x0]['path'])?undefined:_0xbb7ca2[_0x4663('0x66')][_0x4663('0xb3')][0x0][_0x4663('0x8')],'fax':_[_0x4663('0xb7')](_0xbb7ca2[_0x4663('0x66')]['to'][0x0])?undefined:_0xbb7ca2[_0x4663('0x66')]['to'][0x0],'AttachmentId':_0xbb7ca2['body']['attachments'][0x0]['id']},client9002)[_0x4663('0x3b')](function(_0x2339ce){logger[_0x4663('0x2c')]('SendFaxRpc,\x20%s',_0x2339ce);})[_0x4663('0x2e')](function(_0x30fea1){logger[_0x4663('0x2c')](_0x4663('0xc7'),_0x30fea1);});return _0x5e4387;})['then'](respondWithResult(_0x13edc5,null))[_0x4663('0x2e')](handleError(_0x13edc5,null));};exports[_0x4663('0xc8')]=function(_0xf8e912,_0x1f4203,_0x44f18a){return db[_0x4663('0x47')]['find']({'where':{'id':_0xf8e912[_0x4663('0x61')]['id']}})[_0x4663('0x3b')](handleEntityNotFound(_0x1f4203,null))[_0x4663('0x3b')](function(_0x5092ea){if(_0x5092ea){return _0x5092ea[_0x4663('0xc8')](_0xf8e912[_0x4663('0x66')][_0x4663('0x79')],_[_0x4663('0x7c')](_0xf8e912[_0x4663('0x66')],['ids','id'])||{})['spread'](function(_0x52b775){for(var _0x2be28d=0x0;_0x2be28d<_0xf8e912['body'][_0x4663('0x79')]['length'];_0x2be28d+=0x1){socket[_0x4663('0xc9')](_0x4663('0xca'),{'UserId':Number(_0xf8e912[_0x4663('0x66')][_0x4663('0x79')][_0x2be28d]),'FaxAccountId':Number(_0xf8e912['params']['id'])});}return _0x52b775;});}})[_0x4663('0x3b')](respondWithResult(_0x1f4203,null))[_0x4663('0x2e')](handleError(_0x1f4203,null));};exports[_0x4663('0xcb')]=function(_0x5547fb,_0x5c6f83,_0x561a58){return db[_0x4663('0x47')][_0x4663('0x64')]({'where':{'id':_0x5547fb[_0x4663('0x61')]['id']}})[_0x4663('0x3b')](handleEntityNotFound(_0x5c6f83,null))[_0x4663('0x3b')](function(_0x441d44){if(_0x441d44){return _0x441d44[_0x4663('0xcb')](_0x5547fb[_0x4663('0x50')][_0x4663('0x79')])['then'](function(){if(_[_0x4663('0xcc')](_0x5547fb[_0x4663('0x50')][_0x4663('0x79')])){for(var _0x131e41=0x0;_0x131e41<_0x5547fb[_0x4663('0x50')][_0x4663('0x79')][_0x4663('0x53')];_0x131e41+=0x1){socket[_0x4663('0xc9')]('userFaxAccount:remove',{'UserId':Number(_0x5547fb[_0x4663('0x50')][_0x4663('0x79')][_0x131e41]),'FaxAccountId':Number(_0x5547fb[_0x4663('0x61')]['id'])});}}else{socket['emit']('userFaxAccount:remove',{'UserId':Number(_0x5547fb[_0x4663('0x50')]['ids']),'FaxAccountId':Number(_0x5547fb[_0x4663('0x61')]['id'])});}});}})[_0x4663('0x3b')](respondWithStatusCode(_0x5c6f83,null))[_0x4663('0x2e')](handleError(_0x5c6f83,null));};exports[_0x4663('0xcd')]=function(_0x5ccf62,_0x2f3b34,_0x13884b){var _0x4ca33c={};var _0x196d3b={};var _0x95e2e7;var _0x4d8abe;return db[_0x4663('0x47')][_0x4663('0x71')]({'where':{'id':_0x5ccf62['params']['id']}})[_0x4663('0x3b')](handleEntityNotFound(_0x2f3b34,null))['then'](function(_0x10c6c8){if(_0x10c6c8){_0x95e2e7=_0x10c6c8;_0x196d3b[_0x4663('0x4c')]=_[_0x4663('0x4d')](db['User']['rawAttributes']);_0x196d3b[_0x4663('0x50')]=_[_0x4663('0x4d')](_0x5ccf62[_0x4663('0x50')]);_0x196d3b[_0x4663('0x4e')]=_[_0x4663('0x4f')](_0x196d3b[_0x4663('0x4c')],_0x196d3b[_0x4663('0x50')]);_0x4ca33c[_0x4663('0x51')]=_[_0x4663('0x4f')](_0x196d3b[_0x4663('0x4c')],qs[_0x4663('0x52')](_0x5ccf62[_0x4663('0x50')]['fields']));_0x4ca33c[_0x4663('0x51')]=_0x4ca33c['attributes'][_0x4663('0x53')]?_0x4ca33c[_0x4663('0x51')]:_0x196d3b[_0x4663('0x4c')];_0x4ca33c['order']=qs['sort'](_0x5ccf62[_0x4663('0x50')][_0x4663('0x57')]);_0x4ca33c[_0x4663('0x58')]=qs['filters'](_[_0x4663('0x59')](_0x5ccf62['query'],_0x196d3b[_0x4663('0x4e')]));if(_0x5ccf62['query'][_0x4663('0x5a')]){_0x4ca33c[_0x4663('0x58')]=_[_0x4663('0x5b')](_0x4ca33c[_0x4663('0x58')],{'$or':_[_0x4663('0x46')](_0x4ca33c[_0x4663('0x51')],function(_0x5b9dc8){var _0x31c645={};_0x31c645[_0x5b9dc8]={'$like':'%'+_0x5ccf62[_0x4663('0x50')][_0x4663('0x5a')]+'%'};return _0x31c645;})});}_0x4ca33c=_['merge']({},_0x4ca33c,_0x5ccf62[_0x4663('0x5d')]);return _0x95e2e7['getAgents'](_0x4ca33c);}})['then'](function(_0x59a253){if(_0x59a253){_0x4d8abe=_0x59a253['length'];if(!_0x5ccf62[_0x4663('0x50')]['hasOwnProperty'](_0x4663('0x55'))){_0x4ca33c[_0x4663('0x34')]=qs['limit'](_0x5ccf62[_0x4663('0x50')][_0x4663('0x34')]);_0x4ca33c[_0x4663('0x32')]=qs[_0x4663('0x32')](_0x5ccf62[_0x4663('0x50')][_0x4663('0x32')]);}return _0x95e2e7['getAgents'](_0x4ca33c);}})[_0x4663('0x3b')](function(_0x31900c){if(_0x31900c){return _0x31900c?{'count':_0x4d8abe,'rows':_0x31900c}:null;}})[_0x4663('0x3b')](respondWithResult(_0x2f3b34,null))[_0x4663('0x2e')](handleError(_0x2f3b34,null));}; \ No newline at end of file +var _0xcc3e=['name','index','mandatoryDispositionPause','map','FaxAccount','rawAttributes','fieldName','key','model','query','keys','intersection','attributes','fields','length','hasOwnProperty','nolimit','order','sort','where','filters','type','VIRTUAL','filter','options','includeAll','include','findAll','rows','show','params','Pause','merge','find','create','body','get','Unable\x20to\x20retrieve\x20the\x20current\x20user','role','user','UserProfileSection','userProfileId','autoAssociation','update','describe','FaxAccountId','findOne','Disposition','addAnswer','CannedAnswer','getAnswers','removeAnswers','ids','addInteraction','FaxInteraction','omit','getInteractions','CmContact','User','Owner','fullname','internal','Tag','Tags','color','tag','addApplications','sequelize','transaction','Transaction','ISOLATION_LEVELS','FaxApplication','bulkCreate','findAndCountAll','stack','finally','send','context','from-voip-provider','exten','localstationid','app','system','description','Fax\x20Extension','priority','push','Answer','CDR(type)=inbound-fax','Set','faxdetect','headerinfo','maxrate','modem','FAXOPT(','Wait','/var/opt/motion2/server/files/attachments/fax-${CALLERID(num)}-${CUT(UNIQUEID,.,1)}-${CUT(UNIQUEID,.,2)}-${STRFTIME(,,%C%y%m%d%H%M%S)}-rx.tif,d','ReceiveFax','addAccountApplications','VoiceExtension','updateAccountApplications','tech','createdAt','updatedAt','TrunkId','ListId','findById','getMessages','pick','$gte','split','format','YYYY-MM-DD\x20HH:mm:ss','FaxMessage','CmList','List','Contacts','DESC','attachments','join','root','server/files/attachments','basename','isNil','from','fax','List\x20not\x20found','Send\x20Fax\x20failed','out','filename','Messages','Contact\x20not\x20found','spread','dataValues','SendFax','SendFaxRpc,\x20%s','addAgents','emit','userFaxAccount:save','removeAgents','isArray','userFaxAccount:remove','rimraf','zip-dir','request-promise','moment','bluebird','mustache','util','path','sox','ejs','fs-extra','lodash','squel','jsforce','desk.js','querystring','ioredis','../../components/auth/service','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/environment','../../config/license/util','defaults','redis','register','jayson/promise','client','http','request','info','FaxAccount,\x20%s,\x20%s','request\x20sent','debug','error','message','result','catch','end','status','json','undefined','count','offset','limit','set','apply','reject','save','then','destroy','FaxAccounts'];(function(_0x4db0c6,_0x5e810e){var _0x4baae9=function(_0x6d56df){while(--_0x6d56df){_0x4db0c6['push'](_0x4db0c6['shift']());}};_0x4baae9(++_0x5e810e);}(_0xcc3e,0x152));var _0xecc3=function(_0x12d560,_0x149569){_0x12d560=_0x12d560-0x0;var _0x1eb3b1=_0xcc3e[_0x12d560];return _0x1eb3b1;};'use strict';var emlformat=require('eml-format');var rimraf=require(_0xecc3('0x0'));var zipdir=require(_0xecc3('0x1'));var jsonpatch=require('fast-json-patch');var rp=require(_0xecc3('0x2'));var moment=require(_0xecc3('0x3'));var BPromise=require(_0xecc3('0x4'));var Mustache=require(_0xecc3('0x5'));var util=require(_0xecc3('0x6'));var path=require(_0xecc3('0x7'));var sox=require(_0xecc3('0x8'));var csv=require('to-csv');var ejs=require(_0xecc3('0x9'));var fs=require('fs');var fs_extra=require(_0xecc3('0xa'));var _=require(_0xecc3('0xb'));var squel=require(_0xecc3('0xc'));var crypto=require('crypto');var jsforce=require(_0xecc3('0xd'));var deskjs=require(_0xecc3('0xe'));var toCsv=require('to-csv');var querystring=require(_0xecc3('0xf'));var Papa=require('papaparse');var Redis=require(_0xecc3('0x10'));var authService=require(_0xecc3('0x11'));var qs=require('../../components/parsers/qs');var as=require(_0xecc3('0x12'));var hardwareService=require(_0xecc3('0x13'));var logger=require(_0xecc3('0x14'))(_0xecc3('0x15'));var utils=require(_0xecc3('0x16'));var config=require(_0xecc3('0x17'));var licenseUtil=require(_0xecc3('0x18'));var db=require('../../mysqldb')['db'];config['redis']=_[_0xecc3('0x19')](config[_0xecc3('0x1a')],{'host':'localhost','port':0x18eb});var socket=require('socket.io-emitter')(new Redis(config['redis']));require('./faxAccount.socket')[_0xecc3('0x1b')](socket);var jayson=require(_0xecc3('0x1c'));var client=jayson[_0xecc3('0x1d')][_0xecc3('0x1e')]({'port':0x232c});var client9002=jayson[_0xecc3('0x1d')]['http']({'port':0x232a});function respondWithRpcPromise(_0x3ae2fb,_0xc1c292,_0x3b15a7,_0x130194){return new BPromise(function(_0x47af6d,_0x197461){var _0x2443b5=_0x130194||client;return _0x2443b5[_0xecc3('0x1f')](_0x3ae2fb,_0x3b15a7)['then'](function(_0x33d946){logger[_0xecc3('0x20')](_0xecc3('0x21'),_0xc1c292,_0xecc3('0x22'));logger[_0xecc3('0x23')]('FaxAccount,\x20%s,\x20%s,\x20%s',_0xc1c292,_0xecc3('0x22'),JSON['stringify'](_0x33d946));if(_0x33d946[_0xecc3('0x24')]){if(_0x33d946[_0xecc3('0x24')]['code']===0x1f4){logger['error']('FaxAccount,\x20%s,\x20%s',_0xc1c292,_0x33d946['error']['message']);return _0x197461(_0x33d946[_0xecc3('0x24')][_0xecc3('0x25')]);}logger[_0xecc3('0x24')]('FaxAccount,\x20%s,\x20%s',_0xc1c292,_0x33d946[_0xecc3('0x24')][_0xecc3('0x25')]);return _0x47af6d(_0x33d946[_0xecc3('0x24')][_0xecc3('0x25')]);}else{logger[_0xecc3('0x20')](_0xecc3('0x21'),_0xc1c292,'request\x20sent');_0x47af6d(_0x33d946[_0xecc3('0x26')]['message']);}})[_0xecc3('0x27')](function(_0x4539ac){logger[_0xecc3('0x24')]('FaxAccount,\x20%s,\x20%s',_0xc1c292,_0x4539ac);_0x197461(_0x4539ac);});});}function respondWithStatusCode(_0x55d1e7,_0x208831){_0x208831=_0x208831||0xcc;return function(_0x457408){if(_0x457408){return _0x55d1e7['sendStatus'](_0x208831);}return _0x55d1e7['status'](_0x208831)[_0xecc3('0x28')]();};}function respondWithResult(_0x5c1af0,_0x2c0446){_0x2c0446=_0x2c0446||0xc8;return function(_0xbc092b){if(_0xbc092b){return _0x5c1af0[_0xecc3('0x29')](_0x2c0446)[_0xecc3('0x2a')](_0xbc092b);}};}function respondWithFilteredResult(_0x263c59,_0x3a376b){return function(_0xba1cb1){if(_0xba1cb1){var _0x3e425f=typeof _0x3a376b['offset']===_0xecc3('0x2b')&&typeof _0x3a376b['limit']===_0xecc3('0x2b');var _0x35a603=_0xba1cb1[_0xecc3('0x2c')];var _0x4f8b04=_0x3e425f?0x0:_0x3a376b[_0xecc3('0x2d')];var _0xc6b67a=_0x3e425f?_0xba1cb1['count']:_0x3a376b['offset']+_0x3a376b[_0xecc3('0x2e')];var _0x5493d2;if(_0xc6b67a>=_0x35a603){_0xc6b67a=_0x35a603;_0x5493d2=0xc8;}else{_0x5493d2=0xce;}_0x263c59[_0xecc3('0x29')](_0x5493d2);return _0x263c59[_0xecc3('0x2f')]('Content-Range',_0x4f8b04+'-'+_0xc6b67a+'/'+_0x35a603)[_0xecc3('0x2a')](_0xba1cb1);}return null;};}function patchUpdates(_0x572ad8){return function(_0x43abeb){try{jsonpatch[_0xecc3('0x30')](_0x43abeb,_0x572ad8,!![]);}catch(_0x17dfb4){return BPromise[_0xecc3('0x31')](_0x17dfb4);}return _0x43abeb[_0xecc3('0x32')]();};}function saveUpdates(_0x314e6f,_0x4d888){return function(_0x5cc1cc){if(_0x5cc1cc){return _0x5cc1cc['update'](_0x314e6f)[_0xecc3('0x33')](function(_0x7b73d2){return _0x7b73d2;});}return null;};}function removeEntity(_0x91fa58,_0x459f42){return function(_0x2b4748){if(_0x2b4748){return _0x2b4748[_0xecc3('0x34')]()[_0xecc3('0x33')](function(){var _0x3853d1=_0x2b4748['get']({'plain':!![]});var _0xe3e68c=_0xecc3('0x35');return db['UserProfileResource'][_0xecc3('0x34')]({'where':{'type':_0xe3e68c,'resourceId':_0x3853d1['id']}})[_0xecc3('0x33')](function(){return _0x2b4748;});})['then'](function(){_0x91fa58[_0xecc3('0x29')](0xcc)[_0xecc3('0x28')]();});}};}function handleEntityNotFound(_0x2a9c1f,_0x30b840){return function(_0x1dbf7a){if(!_0x1dbf7a){_0x2a9c1f['sendStatus'](0x194);}return _0x1dbf7a;};}function handleError(_0x29277c,_0x3eb497){_0x3eb497=_0x3eb497||0x1f4;return function(_0x370f54){logger[_0xecc3('0x24')](_0x370f54['stack']);if(_0x370f54[_0xecc3('0x36')]){delete _0x370f54[_0xecc3('0x36')];}_0x29277c[_0xecc3('0x29')](_0x3eb497)['send'](_0x370f54);};}exports[_0xecc3('0x37')]=function(_0x18c9da,_0x35ba75){var _0x5a30b2={'include':[{'model':db['Pause'],'as':_0xecc3('0x38')}]},_0x6c65c8={},_0x5ddc78={'count':0x0,'rows':[]};var _0x5b8641=_[_0xecc3('0x39')](db[_0xecc3('0x3a')][_0xecc3('0x3b')],function(_0x430c75){return{'name':_0x430c75[_0xecc3('0x3c')],'type':_0x430c75['type'][_0xecc3('0x3d')]};});_0x6c65c8[_0xecc3('0x3e')]=_[_0xecc3('0x39')](_0x5b8641,_0xecc3('0x36'));_0x6c65c8[_0xecc3('0x3f')]=_[_0xecc3('0x40')](_0x18c9da[_0xecc3('0x3f')]);_0x6c65c8['filters']=_[_0xecc3('0x41')](_0x6c65c8[_0xecc3('0x3e')],_0x6c65c8[_0xecc3('0x3f')]);_0x5a30b2[_0xecc3('0x42')]=_[_0xecc3('0x41')](_0x6c65c8[_0xecc3('0x3e')],qs[_0xecc3('0x43')](_0x18c9da[_0xecc3('0x3f')][_0xecc3('0x43')]));_0x5a30b2[_0xecc3('0x42')]=_0x5a30b2[_0xecc3('0x42')][_0xecc3('0x44')]?_0x5a30b2[_0xecc3('0x42')]:_0x6c65c8[_0xecc3('0x3e')];if(!_0x18c9da[_0xecc3('0x3f')][_0xecc3('0x45')](_0xecc3('0x46'))){_0x5a30b2['limit']=qs['limit'](_0x18c9da[_0xecc3('0x3f')][_0xecc3('0x2e')]);_0x5a30b2[_0xecc3('0x2d')]=qs['offset'](_0x18c9da['query']['offset']);}_0x5a30b2[_0xecc3('0x47')]=qs[_0xecc3('0x48')](_0x18c9da[_0xecc3('0x3f')][_0xecc3('0x48')]);_0x5a30b2[_0xecc3('0x49')]=qs[_0xecc3('0x4a')](_['pick'](_0x18c9da[_0xecc3('0x3f')],_0x6c65c8['filters']),_0x5b8641);if(_0x18c9da[_0xecc3('0x3f')]['filter']){_0x5a30b2['where']=_['merge'](_0x5a30b2[_0xecc3('0x49')],{'$or':_['map'](_0x5b8641,function(_0x448b8b){if(_0x448b8b[_0xecc3('0x4b')]!==_0xecc3('0x4c')){var _0x4cc31b={};_0x4cc31b[_0x448b8b[_0xecc3('0x36')]]={'$like':'%'+_0x18c9da['query'][_0xecc3('0x4d')]+'%'};return _0x4cc31b;}})});}_0x5a30b2=_['merge']({},_0x5a30b2,_0x18c9da[_0xecc3('0x4e')]);var _0x110e35={'where':_0x5a30b2[_0xecc3('0x49')]};return db['FaxAccount'][_0xecc3('0x2c')](_0x110e35)[_0xecc3('0x33')](function(_0x1f013d){_0x5ddc78[_0xecc3('0x2c')]=_0x1f013d;if(_0x18c9da[_0xecc3('0x3f')][_0xecc3('0x4f')]){_0x5a30b2[_0xecc3('0x50')]=[{'all':!![]}];}return db[_0xecc3('0x3a')][_0xecc3('0x51')](_0x5a30b2);})[_0xecc3('0x33')](function(_0x1324ad){_0x5ddc78[_0xecc3('0x52')]=_0x1324ad;return _0x5ddc78;})[_0xecc3('0x33')](respondWithFilteredResult(_0x35ba75,_0x5a30b2))['catch'](handleError(_0x35ba75,null));};exports[_0xecc3('0x53')]=function(_0x1d379d,_0x4293e4){var _0xf8e85b={'raw':![],'where':{'id':_0x1d379d[_0xecc3('0x54')]['id']},'include':[{'model':db[_0xecc3('0x55')],'as':'mandatoryDispositionPause'}]},_0x56dbf1={};_0x56dbf1[_0xecc3('0x3e')]=_[_0xecc3('0x40')](db['FaxAccount'][_0xecc3('0x3b')]);_0x56dbf1['query']=_['keys'](_0x1d379d[_0xecc3('0x3f')]);_0x56dbf1[_0xecc3('0x4a')]=_['intersection'](_0x56dbf1[_0xecc3('0x3e')],_0x56dbf1[_0xecc3('0x3f')]);_0xf8e85b[_0xecc3('0x42')]=_['intersection'](_0x56dbf1[_0xecc3('0x3e')],qs[_0xecc3('0x43')](_0x1d379d[_0xecc3('0x3f')][_0xecc3('0x43')]));_0xf8e85b[_0xecc3('0x42')]=_0xf8e85b[_0xecc3('0x42')][_0xecc3('0x44')]?_0xf8e85b['attributes']:_0x56dbf1[_0xecc3('0x3e')];if(_0x1d379d[_0xecc3('0x3f')][_0xecc3('0x4f')]){_0xf8e85b[_0xecc3('0x50')]=[{'all':!![]}];}_0xf8e85b=_[_0xecc3('0x56')]({},_0xf8e85b,_0x1d379d[_0xecc3('0x4e')]);return db[_0xecc3('0x3a')][_0xecc3('0x57')](_0xf8e85b)[_0xecc3('0x33')](handleEntityNotFound(_0x4293e4,null))['then'](respondWithResult(_0x4293e4,null))['catch'](handleError(_0x4293e4,null));};exports[_0xecc3('0x58')]=function(_0x29b9ac,_0x166a45){return db[_0xecc3('0x3a')]['create'](_0x29b9ac[_0xecc3('0x59')],{})['then'](function(_0x7c8f94){var _0x44b83d=_0x29b9ac['user'][_0xecc3('0x5a')]({'plain':!![]});if(!_0x44b83d)throw new Error(_0xecc3('0x5b'));if(_0x44b83d[_0xecc3('0x5c')]===_0xecc3('0x5d')){var _0x108980=_0x7c8f94[_0xecc3('0x5a')]({'plain':!![]});var _0x27f297='FaxAccounts';return db[_0xecc3('0x5e')]['find']({'where':{'name':_0x27f297,'userProfileId':_0x44b83d[_0xecc3('0x5f')]},'raw':!![]})[_0xecc3('0x33')](function(_0x2fb001){if(_0x2fb001&&_0x2fb001[_0xecc3('0x60')]===0x0){return db['UserProfileResource']['create']({'name':_0x108980[_0xecc3('0x36')],'resourceId':_0x108980['id'],'type':_0x2fb001[_0xecc3('0x36')],'sectionId':_0x2fb001['id']},{})[_0xecc3('0x33')](function(){return _0x7c8f94;});}else{return _0x7c8f94;}})[_0xecc3('0x27')](function(_0x456a01){logger['error']('Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s',_0x456a01);throw _0x456a01;});}return _0x7c8f94;})[_0xecc3('0x33')](respondWithResult(_0x166a45,0xc9))[_0xecc3('0x27')](handleError(_0x166a45,null));};exports[_0xecc3('0x61')]=function(_0x54666e,_0x5a67d5){if(_0x54666e[_0xecc3('0x59')]['id']){delete _0x54666e[_0xecc3('0x59')]['id'];}return db[_0xecc3('0x3a')]['find']({'where':{'id':_0x54666e[_0xecc3('0x54')]['id']},'include':[{'model':db[_0xecc3('0x55')],'as':_0xecc3('0x38')}]})[_0xecc3('0x33')](handleEntityNotFound(_0x5a67d5,null))['then'](saveUpdates(_0x54666e[_0xecc3('0x59')],null))[_0xecc3('0x33')](respondWithResult(_0x5a67d5,null))[_0xecc3('0x27')](handleError(_0x5a67d5,null));};exports['destroy']=function(_0x4ee81b,_0xb538cb){return db[_0xecc3('0x3a')][_0xecc3('0x57')]({'where':{'id':_0x4ee81b['params']['id']}})[_0xecc3('0x33')](handleEntityNotFound(_0xb538cb,null))[_0xecc3('0x33')](removeEntity(_0xb538cb,null))['catch'](handleError(_0xb538cb,null));};exports['describe']=function(_0x3a1e20,_0xdc19c9){return db['FaxAccount'][_0xecc3('0x62')]()[_0xecc3('0x33')](respondWithResult(_0xdc19c9,null))[_0xecc3('0x27')](handleError(_0xdc19c9,null));};exports['addDisposition']=function(_0x36f6cf,_0x35c22d,_0x3a72be){if(_0x36f6cf['body']['id']){delete _0x36f6cf[_0xecc3('0x59')]['id'];}return db[_0xecc3('0x3a')][_0xecc3('0x57')]({'where':{'id':_0x36f6cf[_0xecc3('0x54')]['id']}})[_0xecc3('0x33')](handleEntityNotFound(_0x35c22d,null))[_0xecc3('0x33')](function(_0x213a64){if(_0x213a64){_0x36f6cf[_0xecc3('0x59')][_0xecc3('0x63')]=_0x213a64['id'];return db['Disposition'][_0xecc3('0x58')](_0x36f6cf[_0xecc3('0x59')]);}})['then'](respondWithResult(_0x35c22d,null))[_0xecc3('0x27')](handleError(_0x35c22d,null));};exports['getDispositions']=function(_0x2b1853,_0x3ea8c6,_0x3be6d2){var _0x7dd97e={'raw':![],'where':{}};var _0x3c21b4={};var _0x1d2ba8={'count':0x0,'rows':[]};return db[_0xecc3('0x3a')][_0xecc3('0x64')]({'where':{'id':_0x2b1853[_0xecc3('0x54')]['id']}})[_0xecc3('0x33')](handleEntityNotFound(_0x3ea8c6,null))[_0xecc3('0x33')](function(_0x17ea9a){if(_0x17ea9a){_0x3c21b4[_0xecc3('0x3e')]=_[_0xecc3('0x40')](db[_0xecc3('0x65')][_0xecc3('0x3b')]);_0x3c21b4[_0xecc3('0x3f')]=_['keys'](_0x2b1853[_0xecc3('0x3f')]);_0x3c21b4['filters']=_[_0xecc3('0x41')](_0x3c21b4['model'],_0x3c21b4[_0xecc3('0x3f')]);_0x7dd97e[_0xecc3('0x42')]=_[_0xecc3('0x41')](_0x3c21b4[_0xecc3('0x3e')],qs[_0xecc3('0x43')](_0x2b1853['query'][_0xecc3('0x43')]));_0x7dd97e[_0xecc3('0x42')]=_0x7dd97e['attributes'][_0xecc3('0x44')]?_0x7dd97e[_0xecc3('0x42')]:_0x3c21b4[_0xecc3('0x3e')];if(!_0x2b1853[_0xecc3('0x3f')]['hasOwnProperty'](_0xecc3('0x46'))){_0x7dd97e[_0xecc3('0x2e')]=qs[_0xecc3('0x2e')](_0x2b1853[_0xecc3('0x3f')][_0xecc3('0x2e')]);_0x7dd97e['offset']=qs[_0xecc3('0x2d')](_0x2b1853[_0xecc3('0x3f')][_0xecc3('0x2d')]);}_0x7dd97e[_0xecc3('0x47')]=qs[_0xecc3('0x48')](_0x2b1853[_0xecc3('0x3f')][_0xecc3('0x48')]);_0x7dd97e['where']=qs['filters'](_['pick'](_0x2b1853['query'],_0x3c21b4[_0xecc3('0x4a')]));_0x7dd97e[_0xecc3('0x49')][_0xecc3('0x63')]=_0x17ea9a['id'];if(_0x2b1853[_0xecc3('0x3f')]['filter']){_0x7dd97e[_0xecc3('0x49')]=_[_0xecc3('0x56')](_0x7dd97e['where'],{'$or':_[_0xecc3('0x39')](_0x7dd97e[_0xecc3('0x42')],function(_0x4bf5e8){var _0x41421c={};_0x41421c[_0x4bf5e8]={'$like':'%'+_0x2b1853[_0xecc3('0x3f')][_0xecc3('0x4d')]+'%'};return _0x41421c;})});}_0x7dd97e=_['merge']({},_0x7dd97e,_0x2b1853[_0xecc3('0x4e')]);return db[_0xecc3('0x65')][_0xecc3('0x2c')]({'where':_0x7dd97e['where']})[_0xecc3('0x33')](function(_0x27b23a){_0x1d2ba8['count']=_0x27b23a;if(_0x2b1853[_0xecc3('0x3f')][_0xecc3('0x4f')]){_0x7dd97e['include']=[{'all':!![]}];}return db['Disposition'][_0xecc3('0x51')](_0x7dd97e);})[_0xecc3('0x33')](function(_0x396332){_0x1d2ba8[_0xecc3('0x52')]=_0x396332;return _0x1d2ba8;});}})[_0xecc3('0x33')](respondWithFilteredResult(_0x3ea8c6,_0x7dd97e))[_0xecc3('0x27')](handleError(_0x3ea8c6,null));};exports['removeDispositions']=function(_0x51ad20,_0x3dc7ea,_0x1334c9){return db[_0xecc3('0x3a')][_0xecc3('0x57')]({'where':{'id':_0x51ad20['params']['id']}})[_0xecc3('0x33')](handleEntityNotFound(_0x3dc7ea,null))[_0xecc3('0x33')](function(_0x129022){if(_0x129022){return _0x129022['removeDispositions'](_0x51ad20['query']['ids']);}})[_0xecc3('0x33')](respondWithStatusCode(_0x3dc7ea,null))[_0xecc3('0x27')](handleError(_0x3dc7ea,null));};exports[_0xecc3('0x66')]=function(_0x6a9cb2,_0x21d76e,_0x43f463){if(_0x6a9cb2['body']['id']){delete _0x6a9cb2['body']['id'];}return db[_0xecc3('0x3a')][_0xecc3('0x57')]({'where':{'id':_0x6a9cb2[_0xecc3('0x54')]['id']}})[_0xecc3('0x33')](handleEntityNotFound(_0x21d76e,null))[_0xecc3('0x33')](function(_0x241b76){if(_0x241b76){_0x6a9cb2['body'][_0xecc3('0x63')]=_0x241b76['id'];return db[_0xecc3('0x67')]['create'](_0x6a9cb2[_0xecc3('0x59')]);}})[_0xecc3('0x33')](respondWithResult(_0x21d76e,null))[_0xecc3('0x27')](handleError(_0x21d76e,null));};exports[_0xecc3('0x68')]=function(_0x5c4d34,_0x5b6e95,_0x541a8e){var _0xa170d5={'raw':![],'where':{}};var _0x1118bc={};var _0x2df1e6={'count':0x0,'rows':[]};return db['FaxAccount'][_0xecc3('0x64')]({'where':{'id':_0x5c4d34[_0xecc3('0x54')]['id']}})[_0xecc3('0x33')](handleEntityNotFound(_0x5b6e95,null))['then'](function(_0x242ad4){if(_0x242ad4){_0x1118bc[_0xecc3('0x3e')]=_[_0xecc3('0x40')](db[_0xecc3('0x67')][_0xecc3('0x3b')]);_0x1118bc[_0xecc3('0x3f')]=_['keys'](_0x5c4d34[_0xecc3('0x3f')]);_0x1118bc['filters']=_['intersection'](_0x1118bc['model'],_0x1118bc['query']);_0xa170d5[_0xecc3('0x42')]=_[_0xecc3('0x41')](_0x1118bc[_0xecc3('0x3e')],qs[_0xecc3('0x43')](_0x5c4d34[_0xecc3('0x3f')]['fields']));_0xa170d5['attributes']=_0xa170d5[_0xecc3('0x42')][_0xecc3('0x44')]?_0xa170d5[_0xecc3('0x42')]:_0x1118bc[_0xecc3('0x3e')];if(!_0x5c4d34[_0xecc3('0x3f')][_0xecc3('0x45')]('nolimit')){_0xa170d5[_0xecc3('0x2e')]=qs[_0xecc3('0x2e')](_0x5c4d34[_0xecc3('0x3f')][_0xecc3('0x2e')]);_0xa170d5[_0xecc3('0x2d')]=qs[_0xecc3('0x2d')](_0x5c4d34[_0xecc3('0x3f')][_0xecc3('0x2d')]);}_0xa170d5[_0xecc3('0x47')]=qs[_0xecc3('0x48')](_0x5c4d34[_0xecc3('0x3f')][_0xecc3('0x48')]);_0xa170d5[_0xecc3('0x49')]=qs['filters'](_['pick'](_0x5c4d34[_0xecc3('0x3f')],_0x1118bc[_0xecc3('0x4a')]));_0xa170d5[_0xecc3('0x49')][_0xecc3('0x63')]=_0x242ad4['id'];if(_0x5c4d34[_0xecc3('0x3f')]['filter']){_0xa170d5[_0xecc3('0x49')]=_['merge'](_0xa170d5[_0xecc3('0x49')],{'$or':_[_0xecc3('0x39')](_0xa170d5[_0xecc3('0x42')],function(_0x45b835){var _0x41c236={};_0x41c236[_0x45b835]={'$like':'%'+_0x5c4d34['query'][_0xecc3('0x4d')]+'%'};return _0x41c236;})});}_0xa170d5=_[_0xecc3('0x56')]({},_0xa170d5,_0x5c4d34[_0xecc3('0x4e')]);return db['CannedAnswer']['count']({'where':_0xa170d5[_0xecc3('0x49')]})[_0xecc3('0x33')](function(_0x8143ac){_0x2df1e6[_0xecc3('0x2c')]=_0x8143ac;if(_0x5c4d34[_0xecc3('0x3f')][_0xecc3('0x4f')]){_0xa170d5[_0xecc3('0x50')]=[{'all':!![]}];}return db[_0xecc3('0x67')][_0xecc3('0x51')](_0xa170d5);})[_0xecc3('0x33')](function(_0x4a5b3c){_0x2df1e6['rows']=_0x4a5b3c;return _0x2df1e6;});}})[_0xecc3('0x33')](respondWithFilteredResult(_0x5b6e95,_0xa170d5))[_0xecc3('0x27')](handleError(_0x5b6e95,null));};exports[_0xecc3('0x69')]=function(_0x217a69,_0x3a6fd1,_0x4c5b68){return db[_0xecc3('0x3a')][_0xecc3('0x57')]({'where':{'id':_0x217a69[_0xecc3('0x54')]['id']}})['then'](handleEntityNotFound(_0x3a6fd1,null))[_0xecc3('0x33')](function(_0x5c283a){if(_0x5c283a){return _0x5c283a[_0xecc3('0x69')](_0x217a69[_0xecc3('0x3f')][_0xecc3('0x6a')]);}})[_0xecc3('0x33')](respondWithStatusCode(_0x3a6fd1,null))[_0xecc3('0x27')](handleError(_0x3a6fd1,null));};exports[_0xecc3('0x6b')]=function(_0x1b52e1,_0x55f678,_0x5d2657){return db[_0xecc3('0x6c')][_0xecc3('0x57')]({'where':{'id':_0x1b52e1[_0xecc3('0x54')]['id']}})[_0xecc3('0x33')](handleEntityNotFound(_0x55f678,null))[_0xecc3('0x33')](function(_0x50fef8){if(_0x50fef8){return _0x50fef8[_0xecc3('0x6b')](_0x1b52e1[_0xecc3('0x59')][_0xecc3('0x6a')],_[_0xecc3('0x6d')](_0x1b52e1[_0xecc3('0x59')],['ids','id'])||{});}})[_0xecc3('0x33')](respondWithResult(_0x55f678,null))[_0xecc3('0x27')](handleError(_0x55f678,null));};exports[_0xecc3('0x6e')]=function(_0x809bac,_0x5eb676,_0x154b3d){var _0x2886c5={'raw':![],'where':{}};var _0x268511={};var _0x16d0f2={'count':0x0,'rows':[]};return db['FaxAccount']['findOne']({'where':{'id':_0x809bac[_0xecc3('0x54')]['id']}})[_0xecc3('0x33')](handleEntityNotFound(_0x5eb676,null))[_0xecc3('0x33')](function(_0x2c6516){if(_0x2c6516){_0x268511['model']=_[_0xecc3('0x40')](db[_0xecc3('0x6c')][_0xecc3('0x3b')]);_0x268511[_0xecc3('0x3f')]=_['keys'](_0x809bac[_0xecc3('0x3f')]);_0x268511[_0xecc3('0x4a')]=_[_0xecc3('0x41')](_0x268511[_0xecc3('0x3e')],_0x268511[_0xecc3('0x3f')]);_0x2886c5[_0xecc3('0x42')]=_[_0xecc3('0x41')](_0x268511[_0xecc3('0x3e')],qs['fields'](_0x809bac[_0xecc3('0x3f')][_0xecc3('0x43')]));_0x2886c5['attributes']=_0x2886c5['attributes'][_0xecc3('0x44')]?_0x2886c5[_0xecc3('0x42')]:_0x268511['model'];if(!_0x809bac[_0xecc3('0x3f')][_0xecc3('0x45')](_0xecc3('0x46'))){_0x2886c5['limit']=qs[_0xecc3('0x2e')](_0x809bac['query'][_0xecc3('0x2e')]);_0x2886c5[_0xecc3('0x2d')]=qs[_0xecc3('0x2d')](_0x809bac[_0xecc3('0x3f')]['offset']);}_0x2886c5[_0xecc3('0x47')]=qs[_0xecc3('0x48')](_0x809bac[_0xecc3('0x3f')][_0xecc3('0x48')]);_0x2886c5[_0xecc3('0x49')]=qs[_0xecc3('0x4a')](_['pick'](_0x809bac[_0xecc3('0x3f')],_0x268511[_0xecc3('0x4a')]));_0x2886c5['where'][_0xecc3('0x63')]=_0x2c6516['id'];if(_0x809bac['query']['filter']){_0x2886c5[_0xecc3('0x49')]=_[_0xecc3('0x56')](_0x2886c5['where'],{'$or':_[_0xecc3('0x39')](_0x2886c5[_0xecc3('0x42')],function(_0xd679a){var _0x89e4c4={};_0x89e4c4[_0xd679a]={'$like':'%'+_0x809bac[_0xecc3('0x3f')][_0xecc3('0x4d')]+'%'};return _0x89e4c4;})});}_0x2886c5=_['merge']({},_0x2886c5,_0x809bac[_0xecc3('0x4e')]);return db[_0xecc3('0x6c')][_0xecc3('0x2c')]({'where':_0x2886c5['where']})[_0xecc3('0x33')](function(_0x2d7519){_0x16d0f2[_0xecc3('0x2c')]=_0x2d7519;if(_0x809bac['query']['includeAll']){_0x2886c5[_0xecc3('0x50')]=[{'model':db[_0xecc3('0x6f')],'as':'Contact','required':![]},{'model':db[_0xecc3('0x70')],'as':_0xecc3('0x71'),'attributes':[_0xecc3('0x36'),_0xecc3('0x72'),_0xecc3('0x73')],'required':![]},{'model':db[_0xecc3('0x74')],'as':_0xecc3('0x75'),'attributes':['id',_0xecc3('0x36'),_0xecc3('0x76')],'where':_0x809bac[_0xecc3('0x3f')][_0xecc3('0x77')]?{'id':_0x809bac[_0xecc3('0x3f')]['tag']}:undefined,'required':_0x809bac[_0xecc3('0x3f')]['tag']?!![]:![]}];}return db['FaxInteraction'][_0xecc3('0x51')](_0x2886c5);})[_0xecc3('0x33')](function(_0x25e51f){_0x16d0f2[_0xecc3('0x52')]=_0x25e51f;return _0x16d0f2;});}})[_0xecc3('0x33')](respondWithFilteredResult(_0x5eb676,_0x2886c5))[_0xecc3('0x27')](handleError(_0x5eb676,null));};exports[_0xecc3('0x78')]=function(_0x51daae,_0x5d63fc){var _0x30d17b=_0x51daae[_0xecc3('0x54')]['id'];var _0x53ff22=_0x51daae[_0xecc3('0x59')];var _0xa4c2d=0xc8;var _0x5f1552=null;return db[_0xecc3('0x79')][_0xecc3('0x7a')]({'isolationLevel':db[_0xecc3('0x79')][_0xecc3('0x7b')][_0xecc3('0x7c')]['READ_COMMITTED']},function(_0x1427cf){return db[_0xecc3('0x3a')]['findOne']({'where':{'id':_0x30d17b},'transaction':_0x1427cf})[_0xecc3('0x33')](function(_0xbbd2c5){if(_0xbbd2c5){return db[_0xecc3('0x7d')]['destroy']({'where':{'FaxAccountId':_0x30d17b},'transaction':_0x1427cf})[_0xecc3('0x33')](function(){var _0x5f03a4=_[_0xecc3('0x39')](_0x53ff22,function(_0x545c05){_0x545c05[_0xecc3('0x63')]=_0x30d17b;return _0x545c05;});return db['FaxApplication'][_0xecc3('0x7e')](_0x5f03a4,{'transaction':_0x1427cf});});}else{_0xa4c2d=0x194;_0x5f1552=[];}});})[_0xecc3('0x33')](function(){if(_0xa4c2d!==0x194){return db[_0xecc3('0x7d')][_0xecc3('0x7f')]({'where':{'FaxAccountId':_0x30d17b},'order':'priority'})[_0xecc3('0x33')](function(_0x4d5c0e){_0x5f1552=_0x4d5c0e;});}})[_0xecc3('0x27')](function(_0x32ca86){_0xa4c2d=0x1f4;logger[_0xecc3('0x24')](_0x32ca86[_0xecc3('0x80')]);if(_0x32ca86[_0xecc3('0x36')]){delete _0x32ca86[_0xecc3('0x36')];}_0x5f1552=_0x32ca86;})[_0xecc3('0x81')](function(){if(_0x5f1552===null){_0x5d63fc['sendStatus'](_0xa4c2d);}else{if(_0xa4c2d===0x1f4){_0x5d63fc[_0xecc3('0x29')](_0xa4c2d)[_0xecc3('0x82')](_0x5f1552);}else{_0x5d63fc[_0xecc3('0x29')](_0xa4c2d)[_0xecc3('0x2a')](_0x5f1552);}}});};exports['getApplications']=function(_0x49509c,_0x5e4da7,_0x49a206){var _0x14af80={};var _0x1d5e44={};var _0x51d854;var _0x5ab7c8;return db[_0xecc3('0x3a')]['findOne']({'where':{'id':_0x49509c['params']['id']}})[_0xecc3('0x33')](handleEntityNotFound(_0x5e4da7,null))[_0xecc3('0x33')](function(_0x37fffd){if(_0x37fffd){_0x51d854=_0x37fffd;_0x1d5e44[_0xecc3('0x3e')]=_['keys'](db[_0xecc3('0x7d')][_0xecc3('0x3b')]);_0x1d5e44[_0xecc3('0x3f')]=_[_0xecc3('0x40')](_0x49509c[_0xecc3('0x3f')]);_0x1d5e44[_0xecc3('0x4a')]=_[_0xecc3('0x41')](_0x1d5e44[_0xecc3('0x3e')],_0x1d5e44[_0xecc3('0x3f')]);_0x14af80['attributes']=_[_0xecc3('0x41')](_0x1d5e44[_0xecc3('0x3e')],qs[_0xecc3('0x43')](_0x49509c['query'][_0xecc3('0x43')]));_0x14af80[_0xecc3('0x42')]=_0x14af80[_0xecc3('0x42')][_0xecc3('0x44')]?_0x14af80[_0xecc3('0x42')]:_0x1d5e44[_0xecc3('0x3e')];_0x14af80[_0xecc3('0x47')]=qs[_0xecc3('0x48')](_0x49509c['query'][_0xecc3('0x48')]);_0x14af80[_0xecc3('0x49')]=qs['filters'](_['pick'](_0x49509c[_0xecc3('0x3f')],_0x1d5e44[_0xecc3('0x4a')]));if(_0x49509c[_0xecc3('0x3f')][_0xecc3('0x4d')]){_0x14af80[_0xecc3('0x49')]=_['merge'](_0x14af80[_0xecc3('0x49')],{'$or':_[_0xecc3('0x39')](_0x14af80[_0xecc3('0x42')],function(_0x5170d0){var _0x37b0b5={};_0x37b0b5[_0x5170d0]={'$like':'%'+_0x49509c[_0xecc3('0x3f')]['filter']+'%'};return _0x37b0b5;})});}_0x14af80=_[_0xecc3('0x56')]({},_0x14af80,_0x49509c[_0xecc3('0x4e')]);return _0x51d854['getApplications'](_0x14af80);}})[_0xecc3('0x33')](function(_0xc0ca8b){if(_0xc0ca8b){_0x5ab7c8=_0xc0ca8b[_0xecc3('0x44')];if(!_0x49509c['query'][_0xecc3('0x45')](_0xecc3('0x46'))){_0x14af80[_0xecc3('0x2e')]=qs['limit'](_0x49509c[_0xecc3('0x3f')][_0xecc3('0x2e')]);_0x14af80[_0xecc3('0x2d')]=qs[_0xecc3('0x2d')](_0x49509c['query']['offset']);}return _0x51d854['getApplications'](_0x14af80);}})[_0xecc3('0x33')](function(_0x2d3409){if(_0x2d3409){return _0x2d3409?{'count':_0x5ab7c8,'rows':_0x2d3409}:null;}})[_0xecc3('0x33')](respondWithResult(_0x5e4da7,null))[_0xecc3('0x27')](handleError(_0x5e4da7,null));};function Extension(_0x5c9d45,_0xe86fbb,_0x5b7687,_0x7a9e2a){this[_0xecc3('0x83')]=_0xecc3('0x84');this[_0xecc3('0x85')]=_0x5c9d45[_0xecc3('0x86')];this[_0xecc3('0x87')]=_0x7a9e2a;this[_0xecc3('0x4b')]=_0xecc3('0x88');this[_0xecc3('0x89')]=_0xecc3('0x8a');this[_0xecc3('0x63')]=_0x5c9d45['id'];this[_0xecc3('0x8b')]=_0xe86fbb;this['appdata']=_0x5b7687;}function createExtensionsReciveFax(_0x2f49fa){var _0x390b6a=0x1;var _0x4e95a5=[];_0x4e95a5[_0xecc3('0x8c')](new Extension(_0x2f49fa,_0x390b6a,'',_0xecc3('0x8d')));_0x390b6a+=0x1;_0x4e95a5[_0xecc3('0x8c')](new Extension(_0x2f49fa,_0x390b6a,_0xecc3('0x8e'),_0xecc3('0x8f')));_0x390b6a+=0x1;for(var _0x34297d in _0x2f49fa){if(_0x2f49fa['hasOwnProperty'](_0x34297d)&&(_0x34297d==='ecm'||_0x34297d===_0xecc3('0x86')||_0x34297d==='gateway'||_0x34297d===_0xecc3('0x90')||_0x34297d===_0xecc3('0x91')||_0x34297d===_0xecc3('0x92')||_0x34297d==='minrate'||_0x34297d===_0xecc3('0x93')||_0x34297d==='t38timeout')){_0x4e95a5['push'](new Extension(_0x2f49fa,_0x390b6a,_0xecc3('0x94')+_0x34297d+')='+_0x2f49fa[_0x34297d],_0xecc3('0x8f')));_0x390b6a+=0x1;}}_0x4e95a5[_0xecc3('0x8c')](new Extension(_0x2f49fa,_0x390b6a,'6',_0xecc3('0x95')));_0x390b6a+=0x1;_0x4e95a5['push'](new Extension(_0x2f49fa,_0x390b6a,_0xecc3('0x96'),_0xecc3('0x97')));_0x390b6a=0x0;return _0x4e95a5;}exports[_0xecc3('0x98')]=function(_0x102a99,_0x395916,_0x94f178){var _0x314ae7;return db[_0xecc3('0x79')][_0xecc3('0x7a')](function(_0x5b197b){return db[_0xecc3('0x3a')][_0xecc3('0x58')](_0x102a99[_0xecc3('0x59')],{'transaction':_0x5b197b})[_0xecc3('0x33')](function(_0xaa6c67){_0x314ae7=_0xaa6c67[_0xecc3('0x5a')]({'plain':!![]});return db[_0xecc3('0x99')][_0xecc3('0x7e')](createExtensionsReciveFax(_0x314ae7),{'transaction':_0x5b197b});});})[_0xecc3('0x33')](function(){return _0x314ae7;})[_0xecc3('0x33')](respondWithResult(_0x395916,null))[_0xecc3('0x27')](handleError(_0x395916,null));};exports[_0xecc3('0x9a')]=function(_0xaa81d7,_0x49853f,_0x5c2b8b){var _0x3b57a1;return db[_0xecc3('0x79')][_0xecc3('0x7a')](function(_0x2b77d5){return db[_0xecc3('0x3a')][_0xecc3('0x61')](_0xaa81d7[_0xecc3('0x59')],{'where':{'id':_0xaa81d7[_0xecc3('0x59')]['id']},'transaction':_0x2b77d5})['then'](function(_0x482162){return db[_0xecc3('0x99')][_0xecc3('0x34')]({'where':{'FaxAccountId':_0xaa81d7['body']['id']},'transaction':_0x2b77d5})[_0xecc3('0x33')](function(_0x2e1ce){return db[_0xecc3('0x99')][_0xecc3('0x7e')](createExtensionsReciveFax(_[_0xecc3('0x6d')](_0xaa81d7[_0xecc3('0x59')],[_0xecc3('0x9b'),_0xecc3('0x3d'),_0xecc3('0x9c'),_0xecc3('0x9d'),_0xecc3('0x9e'),_0xecc3('0x9f')])),{'transaction':_0x2b77d5});});});})[_0xecc3('0x33')](function(){return db[_0xecc3('0x3a')][_0xecc3('0xa0')](_0xaa81d7[_0xecc3('0x59')]['id']);})[_0xecc3('0x33')](respondWithResult(_0x49853f,null))[_0xecc3('0x27')](handleError(_0x49853f,null));};exports[_0xecc3('0xa1')]=function(_0x151fb5,_0x5211b5,_0x1479f2){var _0x41e7f2={'raw':!![],'where':{}};var _0xbc1dc0={};var _0x34bf7a={'count':0x0,'rows':[]};return db[_0xecc3('0x3a')]['findOne']({'where':{'id':_0x151fb5['params']['id']}})[_0xecc3('0x33')](handleEntityNotFound(_0x5211b5,null))[_0xecc3('0x33')](function(_0x85b047){if(_0x85b047){_0xbc1dc0[_0xecc3('0x3e')]=_['keys'](db['FaxMessage'][_0xecc3('0x3b')]);_0xbc1dc0[_0xecc3('0x3f')]=_[_0xecc3('0x40')](_0x151fb5['query']);_0xbc1dc0[_0xecc3('0x4a')]=_[_0xecc3('0x41')](_0xbc1dc0[_0xecc3('0x3e')],_0xbc1dc0[_0xecc3('0x3f')]);_0x41e7f2['attributes']=_[_0xecc3('0x41')](_0xbc1dc0[_0xecc3('0x3e')],qs[_0xecc3('0x43')](_0x151fb5[_0xecc3('0x3f')][_0xecc3('0x43')]));_0x41e7f2[_0xecc3('0x42')]=_0x41e7f2[_0xecc3('0x42')][_0xecc3('0x44')]?_0x41e7f2[_0xecc3('0x42')]:_0xbc1dc0[_0xecc3('0x3e')];if(!_0x151fb5[_0xecc3('0x3f')]['hasOwnProperty'](_0xecc3('0x46'))){_0x41e7f2[_0xecc3('0x2e')]=qs[_0xecc3('0x2e')](_0x151fb5[_0xecc3('0x3f')][_0xecc3('0x2e')]);_0x41e7f2[_0xecc3('0x2d')]=qs[_0xecc3('0x2d')](_0x151fb5['query'][_0xecc3('0x2d')]);}_0x41e7f2[_0xecc3('0x47')]=qs[_0xecc3('0x48')](_0x151fb5[_0xecc3('0x3f')][_0xecc3('0x48')]);_0x41e7f2[_0xecc3('0x49')]=qs[_0xecc3('0x4a')](_[_0xecc3('0xa2')](_0x151fb5['query'],_0xbc1dc0['filters']));_0x41e7f2['where'][_0xecc3('0x63')]=_0x85b047['id'];if(_0x151fb5['query']['filter']){_0x41e7f2[_0xecc3('0x49')]=_[_0xecc3('0x56')](_0x41e7f2[_0xecc3('0x49')],{'$or':_[_0xecc3('0x39')](_0x41e7f2[_0xecc3('0x42')],function(_0x522dfd){var _0x1ddf15={};_0x1ddf15[_0x522dfd]={'$like':'%'+_0x151fb5[_0xecc3('0x3f')][_0xecc3('0x4d')]+'%'};return _0x1ddf15;})});}if(_0x151fb5[_0xecc3('0x3f')]['$gte']){var _0x44f794=_0x151fb5['query'][_0xecc3('0xa3')][_0xecc3('0xa4')](',');var _0x278690={};_0x278690[_0x44f794[0x0]]={'$gte':moment(_0x44f794[0x1])[_0xecc3('0xa5')](_0xecc3('0xa6'))};_0x41e7f2[_0xecc3('0x49')]=_[_0xecc3('0x56')](_0x41e7f2[_0xecc3('0x49')],_0x278690);}_0x41e7f2=_['merge']({},_0x41e7f2,_0x151fb5[_0xecc3('0x4e')]);return db[_0xecc3('0xa7')]['count']({'where':_0x41e7f2[_0xecc3('0x49')]})[_0xecc3('0x33')](function(_0xd3eabb){_0x34bf7a[_0xecc3('0x2c')]=_0xd3eabb;if(_0x151fb5[_0xecc3('0x3f')][_0xecc3('0x4f')]){_0x41e7f2[_0xecc3('0x50')]=[{'all':!![]}];}return db[_0xecc3('0xa7')][_0xecc3('0x51')](_0x41e7f2);})[_0xecc3('0x33')](function(_0x13bf4f){_0x34bf7a[_0xecc3('0x52')]=_0x13bf4f;return _0x34bf7a;});}})['then'](respondWithFilteredResult(_0x5211b5,_0x41e7f2))[_0xecc3('0x27')](handleError(_0x5211b5,null));};exports['send']=function(_0x41d6ca,_0x5c26ff,_0x5837d3){var _0x17a0a7,_0x2a0080={},_0x38e92c;if(_0x41d6ca[_0xecc3('0x59')]['to']){_0x38e92c=_0x41d6ca[_0xecc3('0x59')]['to'][0x0];}return db[_0xecc3('0x3a')][_0xecc3('0x57')]({'where':{'id':_0x41d6ca[_0xecc3('0x54')]['id']},'include':[{'model':db[_0xecc3('0xa8')],'as':_0xecc3('0xa9'),'include':[{'model':db[_0xecc3('0x6f')],'as':_0xecc3('0xaa'),'where':{'fax':_0x38e92c},'limit':0x1,'order':[[_0xecc3('0x9d'),_0xecc3('0xab')]]}]}]})[_0xecc3('0x33')](handleEntityNotFound(_0x5c26ff,null))[_0xecc3('0x33')](function(_0xe4d4d9){_0x17a0a7=_0xe4d4d9;if(_0x41d6ca[_0xecc3('0x59')][_0xecc3('0xac')]&&_0x41d6ca['body'][_0xecc3('0xac')][_0xecc3('0x44')]){for(var _0x4c4dc5=0x0;_0x4c4dc5<_0x41d6ca[_0xecc3('0x59')][_0xecc3('0xac')][_0xecc3('0x44')];_0x4c4dc5+=0x1){_0x41d6ca[_0xecc3('0x59')][_0xecc3('0xac')][_0x4c4dc5]={'filename':_0x41d6ca[_0xecc3('0x59')][_0xecc3('0xac')][_0x4c4dc5][_0xecc3('0x36')],'id':_0x41d6ca[_0xecc3('0x59')][_0xecc3('0xac')][_0x4c4dc5]['id'],'path':path[_0xecc3('0xad')](config[_0xecc3('0xae')],_0xecc3('0xaf'),_0x41d6ca[_0xecc3('0x59')]['attachments'][_0x4c4dc5][_0xecc3('0xb0')])};}}return respondWithRpcPromise('CheckAfterSend','CheckAfterSend',{'FaxAccountId':_['isNil'](_0x41d6ca[_0xecc3('0x54')]['id'])?undefined:_0x41d6ca['params']['id'],'path':_[_0xecc3('0xb1')](_0x41d6ca[_0xecc3('0x59')]['attachments'][0x0]['path'])?undefined:_0x41d6ca[_0xecc3('0x59')][_0xecc3('0xac')][0x0][_0xecc3('0x7')],'fax':_[_0xecc3('0xb1')](_0x41d6ca[_0xecc3('0x59')]['to'][0x0])?undefined:_0x41d6ca['body']['to'][0x0]},client9002);})[_0xecc3('0x33')](function(){if(_0x17a0a7){if(_[_0xecc3('0xb1')](_0x41d6ca[_0xecc3('0x59')]['from'])){_0x41d6ca[_0xecc3('0x59')][_0xecc3('0xb2')]=util[_0xecc3('0xa5')]('\x22%s\x22\x20<%s>',_0x17a0a7[_0xecc3('0x36')],_0x17a0a7[_0xecc3('0xb3')]);}if(_0x17a0a7[_0xecc3('0xa9')]){if(_0x17a0a7['List'][_0xecc3('0xaa')][_0xecc3('0x44')]){return _0x17a0a7[_0xecc3('0xa9')][_0xecc3('0xaa')][0x0];}else{return db[_0xecc3('0x6f')][_0xecc3('0x58')](_[_0xecc3('0x19')](_0x41d6ca[_0xecc3('0x59')],{'firstName':_0x41d6ca[_0xecc3('0x59')]['to'][0x0],'phone':_0x41d6ca[_0xecc3('0x59')]['to'][0x0],'fax':_0x41d6ca[_0xecc3('0x59')]['to'][0x0],'ListId':_0x17a0a7[_0xecc3('0x9f')]}));}}else{throw new Error(_0xecc3('0xb4'));}}else{throw new Error(_0xecc3('0xb5'));}})[_0xecc3('0x33')](function(_0x21dc71){if(_0x21dc71){return db[_0xecc3('0x6c')][_0xecc3('0x57')]({'where':{'ContactId':_0x21dc71['id'],'closed':![],'FaxAccountId':_0x17a0a7['id']}})[_0xecc3('0x33')](function(_0x975081){if(_0x975081){return[_0x975081,![]];}return db[_0xecc3('0x6c')]['create']({'UserId':_0x41d6ca[_0xecc3('0x5d')]['id'],'ContactId':_0x21dc71['id'],'FaxAccountId':_0x17a0a7['id'],'fax':_0x41d6ca[_0xecc3('0x59')]['to'][0x0],'firstMsgDirection':_0xecc3('0xb6'),'Messages':[_[_0xecc3('0x56')](_0x41d6ca['body'],{'read':![],'body':_0x41d6ca[_0xecc3('0x59')][_0xecc3('0xac')][0x0][_0xecc3('0xb7')],'FaxAccountId':_0x17a0a7['id'],'UserId':_0x41d6ca[_0xecc3('0x5d')]['id'],'ContactId':_0x21dc71['id'],'AttachmentId':_0x41d6ca[_0xecc3('0x59')][_0xecc3('0xac')][0x0]['id']})]},{'include':[{'model':db[_0xecc3('0xa7')],'as':_0xecc3('0xb8')}]})[_0xecc3('0x33')](function(_0x3608f4){return[_0x3608f4,!![]];});});}else{throw new Error(_0xecc3('0xb9'));}})[_0xecc3('0xba')](function(_0x288e4a,_0x295895){if(_0x295895){return _0x288e4a;}return db['FaxMessage'][_0xecc3('0x58')]({'direction':'out','read':![],'body':_0x41d6ca[_0xecc3('0x59')][_0xecc3('0xac')][0x0][_0xecc3('0xb7')],'FaxAccountId':_0x17a0a7['id'],'FaxInteractionId':_0x288e4a['id'],'UserId':_0x41d6ca[_0xecc3('0x5d')]['id'],'ContactId':_0x288e4a['ContactId'],'AttachmentId':_0x41d6ca[_0xecc3('0x59')][_0xecc3('0xac')][0x0]['id']})[_0xecc3('0x33')](function(_0x39c235){_0x288e4a[_0xecc3('0xbb')][_0xecc3('0xb8')]=[];_0x288e4a[_0xecc3('0xbb')]['Messages'][_0xecc3('0x8c')](_0x39c235[_0xecc3('0xbb')]);return _0x288e4a;});})[_0xecc3('0x33')](function(_0xef9696){respondWithRpcPromise(_0xecc3('0xbc'),_0xecc3('0xbc'),{'FaxAccountId':_['isNil'](_0x41d6ca[_0xecc3('0x54')]['id'])?undefined:_0x41d6ca['params']['id'],'path':_[_0xecc3('0xb1')](_0x41d6ca[_0xecc3('0x59')][_0xecc3('0xac')][0x0][_0xecc3('0x7')])?undefined:_0x41d6ca[_0xecc3('0x59')][_0xecc3('0xac')][0x0]['path'],'fax':_[_0xecc3('0xb1')](_0x41d6ca[_0xecc3('0x59')]['to'][0x0])?undefined:_0x41d6ca[_0xecc3('0x59')]['to'][0x0],'AttachmentId':_0x41d6ca[_0xecc3('0x59')][_0xecc3('0xac')][0x0]['id']},client9002)['then'](function(_0x28b8a0){logger[_0xecc3('0x20')](_0xecc3('0xbd'),_0x28b8a0);})['catch'](function(_0xfc1f6c){logger[_0xecc3('0x20')]('SendFaxRpc,\x20%s',_0xfc1f6c);});return _0xef9696;})['then'](respondWithResult(_0x5c26ff,null))[_0xecc3('0x27')](handleError(_0x5c26ff,null));};exports[_0xecc3('0xbe')]=function(_0x1e7a2d,_0x117714,_0xc9f2a9){return db[_0xecc3('0x3a')][_0xecc3('0x57')]({'where':{'id':_0x1e7a2d[_0xecc3('0x54')]['id']}})['then'](handleEntityNotFound(_0x117714,null))['then'](function(_0x5a779e){if(_0x5a779e){return _0x5a779e[_0xecc3('0xbe')](_0x1e7a2d[_0xecc3('0x59')][_0xecc3('0x6a')],_[_0xecc3('0x6d')](_0x1e7a2d[_0xecc3('0x59')],[_0xecc3('0x6a'),'id'])||{})['spread'](function(_0x370916){for(var _0x32e977=0x0;_0x32e977<_0x1e7a2d[_0xecc3('0x59')]['ids'][_0xecc3('0x44')];_0x32e977+=0x1){socket[_0xecc3('0xbf')](_0xecc3('0xc0'),{'UserId':Number(_0x1e7a2d[_0xecc3('0x59')][_0xecc3('0x6a')][_0x32e977]),'FaxAccountId':Number(_0x1e7a2d[_0xecc3('0x54')]['id'])});}return _0x370916;});}})[_0xecc3('0x33')](respondWithResult(_0x117714,null))[_0xecc3('0x27')](handleError(_0x117714,null));};exports[_0xecc3('0xc1')]=function(_0x3f68b5,_0xa910a6,_0x44912b){return db[_0xecc3('0x3a')][_0xecc3('0x57')]({'where':{'id':_0x3f68b5['params']['id']}})[_0xecc3('0x33')](handleEntityNotFound(_0xa910a6,null))[_0xecc3('0x33')](function(_0x43da25){if(_0x43da25){return _0x43da25['removeAgents'](_0x3f68b5[_0xecc3('0x3f')][_0xecc3('0x6a')])[_0xecc3('0x33')](function(){if(_[_0xecc3('0xc2')](_0x3f68b5[_0xecc3('0x3f')][_0xecc3('0x6a')])){for(var _0x3c6099=0x0;_0x3c6099<_0x3f68b5[_0xecc3('0x3f')]['ids'][_0xecc3('0x44')];_0x3c6099+=0x1){socket[_0xecc3('0xbf')](_0xecc3('0xc3'),{'UserId':Number(_0x3f68b5[_0xecc3('0x3f')][_0xecc3('0x6a')][_0x3c6099]),'FaxAccountId':Number(_0x3f68b5['params']['id'])});}}else{socket[_0xecc3('0xbf')](_0xecc3('0xc3'),{'UserId':Number(_0x3f68b5['query'][_0xecc3('0x6a')]),'FaxAccountId':Number(_0x3f68b5[_0xecc3('0x54')]['id'])});}});}})[_0xecc3('0x33')](respondWithStatusCode(_0xa910a6,null))[_0xecc3('0x27')](handleError(_0xa910a6,null));};exports['getAgents']=function(_0x2791ad,_0x483b63,_0x3dbf4c){var _0x3feff1={};var _0x1f98c3={};var _0x6b6507;var _0x160fb8;return db[_0xecc3('0x3a')][_0xecc3('0x64')]({'where':{'id':_0x2791ad['params']['id']}})['then'](handleEntityNotFound(_0x483b63,null))[_0xecc3('0x33')](function(_0xc1cb41){if(_0xc1cb41){_0x6b6507=_0xc1cb41;_0x1f98c3[_0xecc3('0x3e')]=_[_0xecc3('0x40')](db['User']['rawAttributes']);_0x1f98c3['query']=_['keys'](_0x2791ad[_0xecc3('0x3f')]);_0x1f98c3[_0xecc3('0x4a')]=_[_0xecc3('0x41')](_0x1f98c3[_0xecc3('0x3e')],_0x1f98c3['query']);_0x3feff1[_0xecc3('0x42')]=_[_0xecc3('0x41')](_0x1f98c3[_0xecc3('0x3e')],qs['fields'](_0x2791ad[_0xecc3('0x3f')][_0xecc3('0x43')]));_0x3feff1[_0xecc3('0x42')]=_0x3feff1['attributes'][_0xecc3('0x44')]?_0x3feff1['attributes']:_0x1f98c3[_0xecc3('0x3e')];_0x3feff1['order']=qs[_0xecc3('0x48')](_0x2791ad['query'][_0xecc3('0x48')]);_0x3feff1[_0xecc3('0x49')]=qs[_0xecc3('0x4a')](_['pick'](_0x2791ad[_0xecc3('0x3f')],_0x1f98c3['filters']));if(_0x2791ad[_0xecc3('0x3f')][_0xecc3('0x4d')]){_0x3feff1['where']=_[_0xecc3('0x56')](_0x3feff1[_0xecc3('0x49')],{'$or':_[_0xecc3('0x39')](_0x3feff1['attributes'],function(_0x41fad7){var _0x310a0a={};_0x310a0a[_0x41fad7]={'$like':'%'+_0x2791ad[_0xecc3('0x3f')][_0xecc3('0x4d')]+'%'};return _0x310a0a;})});}_0x3feff1=_[_0xecc3('0x56')]({},_0x3feff1,_0x2791ad[_0xecc3('0x4e')]);return _0x6b6507['getAgents'](_0x3feff1);}})['then'](function(_0x340e0f){if(_0x340e0f){_0x160fb8=_0x340e0f[_0xecc3('0x44')];if(!_0x2791ad['query'][_0xecc3('0x45')](_0xecc3('0x46'))){_0x3feff1[_0xecc3('0x2e')]=qs[_0xecc3('0x2e')](_0x2791ad['query'][_0xecc3('0x2e')]);_0x3feff1['offset']=qs[_0xecc3('0x2d')](_0x2791ad['query']['offset']);}return _0x6b6507['getAgents'](_0x3feff1);}})['then'](function(_0x395de0){if(_0x395de0){return _0x395de0?{'count':_0x160fb8,'rows':_0x395de0}:null;}})['then'](respondWithResult(_0x483b63,null))['catch'](handleError(_0x483b63,null));}; \ No newline at end of file diff --git a/server/api/faxAccount/faxAccount.events.js b/server/api/faxAccount/faxAccount.events.js index 8404b38..10a4a92 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 _0x9742=['update','emit','hasOwnProperty','hook','../../mysqldb','FaxAccount','setMaxListeners','save'];(function(_0x12af21,_0x1c1c30){var _0x5875ae=function(_0x9e0768){while(--_0x9e0768){_0x12af21['push'](_0x12af21['shift']());}};_0x5875ae(++_0x1c1c30);}(_0x9742,0x19c));var _0x2974=function(_0x20a584,_0xe384a5){_0x20a584=_0x20a584-0x0;var _0x4b41a8=_0x9742[_0x20a584];return _0x4b41a8;};'use strict';var EventEmitter=require('events');var FaxAccount=require(_0x2974('0x0'))['db'][_0x2974('0x1')];var FaxAccountEvents=new EventEmitter();FaxAccountEvents[_0x2974('0x2')](0x0);var events={'afterCreate':_0x2974('0x3'),'afterUpdate':_0x2974('0x4'),'afterDestroy':'remove'};function emitEvent(_0x4cb6a6){return function(_0x4ddce6,_0x25a8cc,_0x5a37d0){FaxAccountEvents['emit'](_0x4cb6a6+':'+_0x4ddce6['id'],_0x4ddce6);FaxAccountEvents[_0x2974('0x5')](_0x4cb6a6,_0x4ddce6);_0x5a37d0(null);};}for(var e in events){if(events[_0x2974('0x6')](e)){var event=events[e];FaxAccount[_0x2974('0x7')](e,emitEvent(event));}}module['exports']=FaxAccountEvents; \ No newline at end of file +var _0xcea5=['save','remove','emit','hook','exports','events','FaxAccount'];(function(_0x2f7f5c,_0x2f597f){var _0x2e6630=function(_0x5211d4){while(--_0x5211d4){_0x2f7f5c['push'](_0x2f7f5c['shift']());}};_0x2e6630(++_0x2f597f);}(_0xcea5,0x1a9));var _0x5cea=function(_0x53831c,_0x399b14){_0x53831c=_0x53831c-0x0;var _0x2dcb3d=_0xcea5[_0x53831c];return _0x2dcb3d;};'use strict';var EventEmitter=require(_0x5cea('0x0'));var FaxAccount=require('../../mysqldb')['db'][_0x5cea('0x1')];var FaxAccountEvents=new EventEmitter();FaxAccountEvents['setMaxListeners'](0x0);var events={'afterCreate':_0x5cea('0x2'),'afterUpdate':'update','afterDestroy':_0x5cea('0x3')};function emitEvent(_0x476329){return function(_0x20b3e8,_0x4fbbc6,_0x3759bc){FaxAccountEvents[_0x5cea('0x4')](_0x476329+':'+_0x20b3e8['id'],_0x20b3e8);FaxAccountEvents['emit'](_0x476329,_0x20b3e8);_0x3759bc(null);};}for(var e in events){if(events['hasOwnProperty'](e)){var event=events[e];FaxAccount[_0x5cea('0x5')](e,emitEvent(event));}}module[_0x5cea('0x6')]=FaxAccountEvents; \ No newline at end of file diff --git a/server/api/faxAccount/faxAccount.model.js b/server/api/faxAccount/faxAccount.model.js index 8180f9f..ee79b9e 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 _0x4764=['../../config/environment','./faxAccount.attributes','exports','define','FaxAccount','fax_accounts','lodash','../../config/logger','moment','bluebird','request-promise','path','rimraf'];(function(_0x2df2d0,_0x1d6ea8){var _0x3c4438=function(_0x456da2){while(--_0x456da2){_0x2df2d0['push'](_0x2df2d0['shift']());}};_0x3c4438(++_0x1d6ea8);}(_0x4764,0xe3));var _0x4476=function(_0x4e4e42,_0x468de9){_0x4e4e42=_0x4e4e42-0x0;var _0x5eb22d=_0x4764[_0x4e4e42];return _0x5eb22d;};'use strict';var _=require(_0x4476('0x0'));var util=require('util');var logger=require(_0x4476('0x1'))('api');var moment=require(_0x4476('0x2'));var BPromise=require(_0x4476('0x3'));var rp=require(_0x4476('0x4'));var fs=require('fs');var path=require(_0x4476('0x5'));var rimraf=require(_0x4476('0x6'));var config=require(_0x4476('0x7'));var attributes=require(_0x4476('0x8'));module[_0x4476('0x9')]=function(_0x3a26f7,_0x1e734f){return _0x3a26f7[_0x4476('0xa')](_0x4476('0xb'),attributes,{'tableName':_0x4476('0xc'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0xdbdf=['../../config/environment','./faxAccount.attributes','exports','define','FaxAccount','fax_accounts','lodash','../../config/logger','moment','bluebird','request-promise','path','rimraf'];(function(_0x2d66ea,_0x1f6f6d){var _0x5557b4=function(_0x361c6d){while(--_0x361c6d){_0x2d66ea['push'](_0x2d66ea['shift']());}};_0x5557b4(++_0x1f6f6d);}(_0xdbdf,0x199));var _0xfdbd=function(_0x4dffd9,_0x5d7f60){_0x4dffd9=_0x4dffd9-0x0;var _0x18731c=_0xdbdf[_0x4dffd9];return _0x18731c;};'use strict';var _=require(_0xfdbd('0x0'));var util=require('util');var logger=require(_0xfdbd('0x1'))('api');var moment=require(_0xfdbd('0x2'));var BPromise=require(_0xfdbd('0x3'));var rp=require(_0xfdbd('0x4'));var fs=require('fs');var path=require(_0xfdbd('0x5'));var rimraf=require(_0xfdbd('0x6'));var config=require(_0xfdbd('0x7'));var attributes=require(_0xfdbd('0x8'));module[_0xfdbd('0x9')]=function(_0x3c7f3a,_0x3084d9){return _0x3c7f3a[_0xfdbd('0xa')](_0xfdbd('0xb'),attributes,{'tableName':_0xfdbd('0xc'),'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 ffe2346..56e8765 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 _0x8810=['from','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','Contacts','DESC','account','list','applications','orderBy','priority','asc','Applications','length','CmContact','create','contact','FaxInteraction','Contact\x20not\x20found','spread','get','autoclose','close','unmanaged','created','FaxMessage','AttachmentId','interaction','UserId','User','name','unshift','agent','waitForTheAssignedAgent','FaxQueue','waitForTheAssignedQueue','*,*,*,*','Start','lodash','bluebird','randomstring','ioredis','../../mysqldb','../../config/logger','rpc','../../config/environment','jayson/promise','client','http','defaults','redis','./faxAccount.socket','register','request','then','info','request\x20sent','debug','FaxAccount,\x20%s,\x20%s,\x20%s','stringify','error','code','FaxAccount,\x20%s,\x20%s','message','result','catch','GetFaxAccount','FaxAccount','findAll','options','raw','attributes','limit','include','map','model','NotifyFaxAccount','fax','describe','Sequelize','ValidationError','no\x20available\x20attributes','keys','createdAt','updatedAt','difference','ListId','body','isNil'];(function(_0x57b54c,_0x54ce0d){var _0x59cc19=function(_0xa33bc6){while(--_0xa33bc6){_0x57b54c['push'](_0x57b54c['shift']());}};_0x59cc19(++_0x54ce0d);}(_0x8810,0x8b));var _0x0881=function(_0x34d16e,_0x29712f){_0x34d16e=_0x34d16e-0x0;var _0x201c13=_0x8810[_0x34d16e];return _0x201c13;};'use strict';var _=require(_0x0881('0x0'));var util=require('util');var moment=require('moment');var BPromise=require(_0x0881('0x1'));var rs=require(_0x0881('0x2'));var fs=require('fs');var Redis=require(_0x0881('0x3'));var db=require(_0x0881('0x4'))['db'];var utils=require('../../config/utils');var logger=require(_0x0881('0x5'))(_0x0881('0x6'));var config=require(_0x0881('0x7'));var jayson=require(_0x0881('0x8'));var client=jayson[_0x0881('0x9')][_0x0881('0xa')]({'port':0x232c});config['redis']=_[_0x0881('0xb')](config[_0x0881('0xc')],{'host':'localhost','port':0x18eb});var socket=require('socket.io-emitter')(new Redis(config['redis']));require(_0x0881('0xd'))[_0x0881('0xe')](socket);function respondWithRpcPromise(_0x1c1033,_0x9f1fa2,_0x5bf654){return new BPromise(function(_0x3b06a7,_0x4ba19c){return client[_0x0881('0xf')](_0x1c1033,_0x5bf654)[_0x0881('0x10')](function(_0x2fc03c){logger[_0x0881('0x11')]('FaxAccount,\x20%s,\x20%s',_0x9f1fa2,_0x0881('0x12'));logger[_0x0881('0x13')](_0x0881('0x14'),_0x9f1fa2,_0x0881('0x12'),JSON[_0x0881('0x15')](_0x2fc03c));if(_0x2fc03c['error']){if(_0x2fc03c[_0x0881('0x16')][_0x0881('0x17')]===0x1f4){logger[_0x0881('0x16')](_0x0881('0x18'),_0x9f1fa2,_0x2fc03c[_0x0881('0x16')]['message']);return _0x4ba19c(_0x2fc03c[_0x0881('0x16')][_0x0881('0x19')]);}logger[_0x0881('0x16')](_0x0881('0x18'),_0x9f1fa2,_0x2fc03c['error'][_0x0881('0x19')]);return _0x3b06a7(_0x2fc03c[_0x0881('0x16')]['message']);}else{logger[_0x0881('0x11')](_0x0881('0x18'),_0x9f1fa2,_0x0881('0x12'));_0x3b06a7(_0x2fc03c[_0x0881('0x1a')][_0x0881('0x19')]);}})[_0x0881('0x1b')](function(_0x299cb4){logger[_0x0881('0x16')](_0x0881('0x18'),_0x9f1fa2,_0x299cb4);_0x4ba19c(_0x299cb4);});});}exports[_0x0881('0x1c')]=function(_0xde9369){var _0x515fec=this;return new Promise(function(_0x14aad8,_0x244d64){return db[_0x0881('0x1d')][_0x0881('0x1e')]({'raw':_0xde9369[_0x0881('0x1f')]?_0xde9369[_0x0881('0x1f')][_0x0881('0x20')]===undefined?!![]:![]:!![],'where':_0xde9369['options']?_0xde9369[_0x0881('0x1f')]['where']||null:null,'attributes':_0xde9369[_0x0881('0x1f')]?_0xde9369['options'][_0x0881('0x21')]||null:null,'limit':_0xde9369[_0x0881('0x1f')]?_0xde9369[_0x0881('0x1f')][_0x0881('0x22')]||null:null,'include':_0xde9369[_0x0881('0x1f')]?_0xde9369['options'][_0x0881('0x23')]?_[_0x0881('0x24')](_0xde9369[_0x0881('0x1f')][_0x0881('0x23')],function(_0x2ee98b){return{'model':db[_0x2ee98b[_0x0881('0x25')]],'as':_0x2ee98b['as'],'attributes':_0x2ee98b[_0x0881('0x21')],'include':_0x2ee98b[_0x0881('0x23')]?_[_0x0881('0x24')](_0x2ee98b['include'],function(_0x5ade67){return{'model':db[_0x5ade67[_0x0881('0x25')]],'as':_0x5ade67['as'],'attributes':_0x5ade67['attributes'],'include':_0x5ade67[_0x0881('0x23')]?_[_0x0881('0x24')](_0x5ade67[_0x0881('0x23')],function(_0x4edb81){return{'model':db[_0x4edb81['model']],'as':_0x4edb81['as'],'attributes':_0x4edb81[_0x0881('0x21')]};}):[]};}):[]};}):[]:[]})[_0x0881('0x10')](function(_0x1c5f48){logger[_0x0881('0x11')](_0x0881('0x1c'),_0xde9369);logger['debug'](_0x0881('0x1c'),_0xde9369,JSON[_0x0881('0x15')](_0x1c5f48));_0x14aad8(_0x1c5f48);})[_0x0881('0x1b')](function(_0x4f8157){logger[_0x0881('0x16')](_0x0881('0x1c'),_0x4f8157[_0x0881('0x19')],_0xde9369);_0x244d64(_0x515fec[_0x0881('0x16')](0x1f4,_0x4f8157[_0x0881('0x19')]));});});};exports[_0x0881('0x26')]=function(_0x147794,_0x3906a1,_0xa02440){var _0x2e1888=this;return new Promise(function(_0x130569,_0xeb1a8a){var _0x3e464a={'body':_0x147794['body'],'channel':_0x0881('0x27')};var _0x1e0c48=[];var _0x2b7d7a=[];var _0x4e44ab={};return db['CmContact'][_0x0881('0x28')]()['then'](function(_0x19e9dc){if(!_0x19e9dc){throw new db[(_0x0881('0x29'))][(_0x0881('0x2a'))](_0x0881('0x2b'));}_0x1e0c48=_['difference'](_[_0x0881('0x2c')](_0x19e9dc),[_0x0881('0x2d'),_0x0881('0x2e')]);_0x2b7d7a=_[_0x0881('0x2f')](_[_0x0881('0x2c')](_0x19e9dc),['createdAt',_0x0881('0x2e'),'CompanyId',_0x0881('0x30')]);if(_0x147794[_0x0881('0x31')]['id']){delete _0x147794['body']['id'];}if(_[_0x0881('0x32')](_0x147794[_0x0881('0x31')][_0x0881('0x33')])){throw new db[(_0x0881('0x29'))]['ValidationError'](_0x0881('0x34'));}if(_[_0x0881('0x32')](_0x147794['body'][_0x0881('0x31')])||_0x147794[_0x0881('0x31')]['body']===''){throw new db[(_0x0881('0x29'))][(_0x0881('0x2a'))](_0x0881('0x35'));}if(_['isNil'](_0x147794[_0x0881('0x31')]['mapKey'])){throw new db[(_0x0881('0x29'))][(_0x0881('0x2a'))](_0x0881('0x36')+_0x2b7d7a);}if(!_[_0x0881('0x37')](_0x2b7d7a,_0x147794['body']['mapKey'])){throw new db[(_0x0881('0x29'))][(_0x0881('0x2a'))](_0x0881('0x38')+_0x2b7d7a);}_0x4e44ab[_0x147794['body'][_0x0881('0x39')]]=_0x147794[_0x0881('0x31')][_0x0881('0x33')];})['then'](function(){return db[_0x0881('0x1d')][_0x0881('0x3a')]({'where':{'id':_0x147794['account']['id']},'include':[{'model':db[_0x0881('0x3b')],'as':_0x0881('0x3c'),'include':[{'model':db['CmContact'],'as':_0x0881('0x3d'),'where':_0x4e44ab,'limit':0x1,'order':[[_0x0881('0x2e'),_0x0881('0x3e')]]}]},{'model':db['FaxApplication'],'as':'Applications'}]});})[_0x0881('0x10')](function(_0xd635c6){if(_0xd635c6&&_0xd635c6[_0x0881('0x3c')]){var _0x56e7b5=_0xd635c6['get']({'plain':!![]});_0x3e464a[_0x0881('0x3f')]=_0x56e7b5;_0x3e464a['applications']=_0x56e7b5['Applications'];_0x3e464a[_0x0881('0x40')]=_0x56e7b5[_0x0881('0x3c')];_0x3e464a[_0x0881('0x41')]=_[_0x0881('0x42')](_0x3e464a['applications'],[_0x0881('0x43')],[_0x0881('0x44')]);if(_0x3e464a[_0x0881('0x3f')][_0x0881('0x45')]){delete _0x3e464a[_0x0881('0x3f')]['Applications'];}if(_0x3e464a['account'][_0x0881('0x3c')]&&_0x3e464a[_0x0881('0x3f')]['List'][_0x0881('0x3d')][_0x0881('0x46')]){return _0x3e464a['account'][_0x0881('0x3c')][_0x0881('0x3d')][0x0];}var _0x308412=_['defaults'](_0x147794[_0x0881('0x31')],{'firstName':_0x147794['body'][_0x0881('0x33')],'ListId':_0x56e7b5[_0x0881('0x30')]});_0x308412[_0x147794['body'][_0x0881('0x39')]]=_0x147794[_0x0881('0x31')][_0x0881('0x33')];return db[_0x0881('0x47')][_0x0881('0x48')](_0x308412,{'fields':_0x1e0c48,'raw':!![]});}})[_0x0881('0x10')](function(_0x4498b5){_0x3e464a[_0x0881('0x49')]=_0x4498b5;if(_0x4498b5){var _0x6c68be={'ContactId':_0x4498b5['id'],'FaxAccountId':_0x147794[_0x0881('0x3f')]['id'],'fax':_0x4498b5[_0x0881('0x27')]};return db[_0x0881('0x4a')][_0x0881('0x3a')]({'where':{'ContactId':_0x4498b5['id'],'closed':![],'FaxAccountId':_0x147794[_0x0881('0x3f')]['id']}})['then'](function(_0x343e7e){if(_0x343e7e){return[_0x343e7e,![]];}return db[_0x0881('0x4a')][_0x0881('0x48')](_0x6c68be)[_0x0881('0x10')](function(_0x499c77){return[_0x499c77,!![]];});});}else{throw new Error(_0x0881('0x4b'));}})[_0x0881('0x4c')](function(_0x4aced9,_0x5e25e1){var _0x33c012=_0x4aced9[_0x0881('0x4d')]({'plain':!![]});if(_0x5e25e1){if(_0x3e464a['account'][_0x0881('0x4e')]){_0x3e464a[_0x0881('0x41')]['push']({'id':0x0,'priority':_0x3e464a['applications'][_0x0881('0x46')]+0x1,'app':_0x0881('0x4f'),'appdata':_0x0881('0x50'),'interval':'*,*,*,*'});}_0x33c012[_0x0881('0x51')]=!![];}else{_0x33c012[_0x0881('0x51')]=![];}_0x3e464a['interaction']=_0x33c012;return db[_0x0881('0x52')][_0x0881('0x48')]({'body':_0x147794['body'][_0x0881('0x31')],'FaxAccountId':_0x147794[_0x0881('0x3f')]['id'],'FaxInteractionId':_0x4aced9['id'],'direction':'in','ContactId':_0x4aced9['ContactId'],'AttachmentId':_0x147794[_0x0881('0x31')][_0x0881('0x53')]});})['then'](function(_0x3329a0){_0x3e464a[_0x0881('0x19')]=_0x3329a0;if(!_0x3e464a[_0x0881('0x54')][_0x0881('0x55')])return;return db[_0x0881('0x56')][_0x0881('0x3a')]({'attributes':['id',_0x0881('0x57')],'where':{'id':_0x3e464a[_0x0881('0x54')][_0x0881('0x55')]}});})[_0x0881('0x10')](function(_0x35794e){if(_0x35794e){_0x3e464a['applications'][_0x0881('0x58')]({'id':0x0,'priority':0x0,'app':_0x0881('0x59'),'appdata':_0x35794e[_0x0881('0x57')]+','+(_0x3e464a[_0x0881('0x3f')][_0x0881('0x5a')]||0xa),'interval':'*,*,*,*'});}if(!_0x3e464a[_0x0881('0x54')]['queueId'])return;return db[_0x0881('0x5b')]['find']({'attributes':['id',_0x0881('0x57')],'where':{'id':_0x3e464a[_0x0881('0x54')]['queueId']}});})[_0x0881('0x10')](function(_0x32e948){if(_0x32e948){_0x3e464a[_0x0881('0x41')][_0x0881('0x58')]({'id':0x0,'priority':0x1,'app':'queue','appdata':_0x32e948[_0x0881('0x57')]+','+(_0x3e464a[_0x0881('0x3f')][_0x0881('0x5c')]||0x12c),'interval':_0x0881('0x5d')});}return respondWithRpcPromise(_0x0881('0x5e'),'startRouting',_0x3e464a);})[_0x0881('0x10')](function(_0x38d0c4){_0x130569(_0x38d0c4);})[_0x0881('0x1b')](function(_0x52ae28){_0xeb1a8a(_0x2e1888[_0x0881('0x16')](0x1f4,_0x52ae28[_0x0881('0x19')]));});});}; \ No newline at end of file +var _0x1a4c=['stringify','error','code','message','result','catch','GetFaxAccount','FaxAccount','options','raw','where','limit','include','model','attributes','map','debug','NotifyFaxAccount','body','fax','Sequelize','ValidationError','no\x20available\x20attributes','difference','keys','createdAt','updatedAt','CompanyId','ListId','from\x20is\x20mandatory','isNil','body\x20is\x20mandatory\x20and\x20not\x20empty','mapKey','mapKey\x20is\x20mandatory,\x20please\x20use\x20one\x20of\x20these:\x20','mapKey\x20invalid,\x20please\x20use\x20one\x20of\x20these:\x20','from','find','account','List','Contacts','DESC','FaxApplication','Applications','applications','list','orderBy','length','CmContact','contact','FaxInteraction','spread','get','autoclose','push','close','unmanaged','*,*,*,*','created','FaxMessage','create','ContactId','UserId','User','name','interaction','unshift','waitForTheAssignedAgent','queueId','queue','waitForTheAssignedQueue','startRouting','lodash','moment','bluebird','ioredis','../../mysqldb','../../config/environment','jayson/promise','client','http','defaults','redis','socket.io-emitter','./faxAccount.socket','request','then','info','FaxAccount,\x20%s,\x20%s','request\x20sent','FaxAccount,\x20%s,\x20%s,\x20%s'];(function(_0x798630,_0x295a9f){var _0x53c279=function(_0x4400db){while(--_0x4400db){_0x798630['push'](_0x798630['shift']());}};_0x53c279(++_0x295a9f);}(_0x1a4c,0xa1));var _0xc1a4=function(_0x122ef9,_0x451d2a){_0x122ef9=_0x122ef9-0x0;var _0x42fba0=_0x1a4c[_0x122ef9];return _0x42fba0;};'use strict';var _=require(_0xc1a4('0x0'));var util=require('util');var moment=require(_0xc1a4('0x1'));var BPromise=require(_0xc1a4('0x2'));var rs=require('randomstring');var fs=require('fs');var Redis=require(_0xc1a4('0x3'));var db=require(_0xc1a4('0x4'))['db'];var utils=require('../../config/utils');var logger=require('../../config/logger')('rpc');var config=require(_0xc1a4('0x5'));var jayson=require(_0xc1a4('0x6'));var client=jayson[_0xc1a4('0x7')][_0xc1a4('0x8')]({'port':0x232c});config['redis']=_[_0xc1a4('0x9')](config[_0xc1a4('0xa')],{'host':'localhost','port':0x18eb});var socket=require(_0xc1a4('0xb'))(new Redis(config[_0xc1a4('0xa')]));require(_0xc1a4('0xc'))['register'](socket);function respondWithRpcPromise(_0x54c8ef,_0x1dd318,_0x1b84a0){return new BPromise(function(_0x24e965,_0x4294f2){return client[_0xc1a4('0xd')](_0x54c8ef,_0x1b84a0)[_0xc1a4('0xe')](function(_0x315777){logger[_0xc1a4('0xf')](_0xc1a4('0x10'),_0x1dd318,_0xc1a4('0x11'));logger['debug'](_0xc1a4('0x12'),_0x1dd318,_0xc1a4('0x11'),JSON[_0xc1a4('0x13')](_0x315777));if(_0x315777[_0xc1a4('0x14')]){if(_0x315777[_0xc1a4('0x14')][_0xc1a4('0x15')]===0x1f4){logger[_0xc1a4('0x14')](_0xc1a4('0x10'),_0x1dd318,_0x315777[_0xc1a4('0x14')][_0xc1a4('0x16')]);return _0x4294f2(_0x315777['error'][_0xc1a4('0x16')]);}logger['error'](_0xc1a4('0x10'),_0x1dd318,_0x315777[_0xc1a4('0x14')][_0xc1a4('0x16')]);return _0x24e965(_0x315777[_0xc1a4('0x14')][_0xc1a4('0x16')]);}else{logger['info'](_0xc1a4('0x10'),_0x1dd318,_0xc1a4('0x11'));_0x24e965(_0x315777[_0xc1a4('0x17')][_0xc1a4('0x16')]);}})[_0xc1a4('0x18')](function(_0x463442){logger[_0xc1a4('0x14')](_0xc1a4('0x10'),_0x1dd318,_0x463442);_0x4294f2(_0x463442);});});}exports[_0xc1a4('0x19')]=function(_0x124a19){var _0x54ca80=this;return new Promise(function(_0x3af153,_0x44779c){return db[_0xc1a4('0x1a')]['findAll']({'raw':_0x124a19[_0xc1a4('0x1b')]?_0x124a19['options'][_0xc1a4('0x1c')]===undefined?!![]:![]:!![],'where':_0x124a19[_0xc1a4('0x1b')]?_0x124a19[_0xc1a4('0x1b')][_0xc1a4('0x1d')]||null:null,'attributes':_0x124a19[_0xc1a4('0x1b')]?_0x124a19[_0xc1a4('0x1b')]['attributes']||null:null,'limit':_0x124a19[_0xc1a4('0x1b')]?_0x124a19[_0xc1a4('0x1b')][_0xc1a4('0x1e')]||null:null,'include':_0x124a19[_0xc1a4('0x1b')]?_0x124a19[_0xc1a4('0x1b')][_0xc1a4('0x1f')]?_['map'](_0x124a19[_0xc1a4('0x1b')][_0xc1a4('0x1f')],function(_0x1919cd){return{'model':db[_0x1919cd[_0xc1a4('0x20')]],'as':_0x1919cd['as'],'attributes':_0x1919cd[_0xc1a4('0x21')],'include':_0x1919cd[_0xc1a4('0x1f')]?_['map'](_0x1919cd[_0xc1a4('0x1f')],function(_0x146389){return{'model':db[_0x146389['model']],'as':_0x146389['as'],'attributes':_0x146389[_0xc1a4('0x21')],'include':_0x146389[_0xc1a4('0x1f')]?_[_0xc1a4('0x22')](_0x146389[_0xc1a4('0x1f')],function(_0x1a1e6c){return{'model':db[_0x1a1e6c['model']],'as':_0x1a1e6c['as'],'attributes':_0x1a1e6c[_0xc1a4('0x21')]};}):[]};}):[]};}):[]:[]})[_0xc1a4('0xe')](function(_0x53f7e5){logger['info'](_0xc1a4('0x19'),_0x124a19);logger[_0xc1a4('0x23')](_0xc1a4('0x19'),_0x124a19,JSON[_0xc1a4('0x13')](_0x53f7e5));_0x3af153(_0x53f7e5);})['catch'](function(_0x4052c8){logger[_0xc1a4('0x14')](_0xc1a4('0x19'),_0x4052c8[_0xc1a4('0x16')],_0x124a19);_0x44779c(_0x54ca80[_0xc1a4('0x14')](0x1f4,_0x4052c8[_0xc1a4('0x16')]));});});};exports[_0xc1a4('0x24')]=function(_0x1968a7,_0xcc785a,_0xdff0e5){var _0x3a8291=this;return new Promise(function(_0x5641dc,_0x33c850){var _0x41aae3={'body':_0x1968a7[_0xc1a4('0x25')],'channel':_0xc1a4('0x26')};var _0x466e31=[];var _0x56e085=[];var _0x1de183={};return db['CmContact']['describe']()['then'](function(_0x543ca6){if(!_0x543ca6){throw new db[(_0xc1a4('0x27'))][(_0xc1a4('0x28'))](_0xc1a4('0x29'));}_0x466e31=_[_0xc1a4('0x2a')](_[_0xc1a4('0x2b')](_0x543ca6),[_0xc1a4('0x2c'),'updatedAt']);_0x56e085=_[_0xc1a4('0x2a')](_[_0xc1a4('0x2b')](_0x543ca6),[_0xc1a4('0x2c'),_0xc1a4('0x2d'),_0xc1a4('0x2e'),_0xc1a4('0x2f')]);if(_0x1968a7[_0xc1a4('0x25')]['id']){delete _0x1968a7[_0xc1a4('0x25')]['id'];}if(_['isNil'](_0x1968a7[_0xc1a4('0x25')]['from'])){throw new db[(_0xc1a4('0x27'))][(_0xc1a4('0x28'))](_0xc1a4('0x30'));}if(_[_0xc1a4('0x31')](_0x1968a7[_0xc1a4('0x25')]['body'])||_0x1968a7['body'][_0xc1a4('0x25')]===''){throw new db[(_0xc1a4('0x27'))]['ValidationError'](_0xc1a4('0x32'));}if(_[_0xc1a4('0x31')](_0x1968a7['body'][_0xc1a4('0x33')])){throw new db['Sequelize']['ValidationError'](_0xc1a4('0x34')+_0x56e085);}if(!_['includes'](_0x56e085,_0x1968a7[_0xc1a4('0x25')][_0xc1a4('0x33')])){throw new db[(_0xc1a4('0x27'))][(_0xc1a4('0x28'))](_0xc1a4('0x35')+_0x56e085);}_0x1de183[_0x1968a7[_0xc1a4('0x25')]['mapKey']]=_0x1968a7['body'][_0xc1a4('0x36')];})[_0xc1a4('0xe')](function(){return db['FaxAccount'][_0xc1a4('0x37')]({'where':{'id':_0x1968a7[_0xc1a4('0x38')]['id']},'include':[{'model':db['CmList'],'as':_0xc1a4('0x39'),'include':[{'model':db['CmContact'],'as':_0xc1a4('0x3a'),'where':_0x1de183,'limit':0x1,'order':[[_0xc1a4('0x2d'),_0xc1a4('0x3b')]]}]},{'model':db[_0xc1a4('0x3c')],'as':_0xc1a4('0x3d')}]});})[_0xc1a4('0xe')](function(_0x58c8de){if(_0x58c8de&&_0x58c8de[_0xc1a4('0x39')]){var _0x5aca9c=_0x58c8de['get']({'plain':!![]});_0x41aae3[_0xc1a4('0x38')]=_0x5aca9c;_0x41aae3[_0xc1a4('0x3e')]=_0x5aca9c[_0xc1a4('0x3d')];_0x41aae3[_0xc1a4('0x3f')]=_0x5aca9c[_0xc1a4('0x39')];_0x41aae3['applications']=_[_0xc1a4('0x40')](_0x41aae3[_0xc1a4('0x3e')],['priority'],['asc']);if(_0x41aae3[_0xc1a4('0x38')]['Applications']){delete _0x41aae3[_0xc1a4('0x38')][_0xc1a4('0x3d')];}if(_0x41aae3[_0xc1a4('0x38')][_0xc1a4('0x39')]&&_0x41aae3[_0xc1a4('0x38')][_0xc1a4('0x39')][_0xc1a4('0x3a')][_0xc1a4('0x41')]){return _0x41aae3[_0xc1a4('0x38')][_0xc1a4('0x39')][_0xc1a4('0x3a')][0x0];}var _0x30cb0d=_[_0xc1a4('0x9')](_0x1968a7[_0xc1a4('0x25')],{'firstName':_0x1968a7['body'][_0xc1a4('0x36')],'ListId':_0x5aca9c[_0xc1a4('0x2f')]});_0x30cb0d[_0x1968a7[_0xc1a4('0x25')]['mapKey']]=_0x1968a7[_0xc1a4('0x25')]['from'];return db[_0xc1a4('0x42')]['create'](_0x30cb0d,{'fields':_0x466e31,'raw':!![]});}})['then'](function(_0x1b6a80){_0x41aae3[_0xc1a4('0x43')]=_0x1b6a80;if(_0x1b6a80){var _0x58a0d3={'ContactId':_0x1b6a80['id'],'FaxAccountId':_0x1968a7[_0xc1a4('0x38')]['id'],'fax':_0x1b6a80[_0xc1a4('0x26')]};return db[_0xc1a4('0x44')][_0xc1a4('0x37')]({'where':{'ContactId':_0x1b6a80['id'],'closed':![],'FaxAccountId':_0x1968a7[_0xc1a4('0x38')]['id']}})[_0xc1a4('0xe')](function(_0x4ebe44){if(_0x4ebe44){return[_0x4ebe44,![]];}return db[_0xc1a4('0x44')]['create'](_0x58a0d3)[_0xc1a4('0xe')](function(_0xd59986){return[_0xd59986,!![]];});});}else{throw new Error('Contact\x20not\x20found');}})[_0xc1a4('0x45')](function(_0x2714a3,_0x2ec639){var _0x3f0706=_0x2714a3[_0xc1a4('0x46')]({'plain':!![]});if(_0x2ec639){if(_0x41aae3['account'][_0xc1a4('0x47')]){_0x41aae3[_0xc1a4('0x3e')][_0xc1a4('0x48')]({'id':0x0,'priority':_0x41aae3[_0xc1a4('0x3e')][_0xc1a4('0x41')]+0x1,'app':_0xc1a4('0x49'),'appdata':_0xc1a4('0x4a'),'interval':_0xc1a4('0x4b')});}_0x3f0706[_0xc1a4('0x4c')]=!![];}else{_0x3f0706['created']=![];}_0x41aae3['interaction']=_0x3f0706;return db[_0xc1a4('0x4d')][_0xc1a4('0x4e')]({'body':_0x1968a7['body'][_0xc1a4('0x25')],'FaxAccountId':_0x1968a7[_0xc1a4('0x38')]['id'],'FaxInteractionId':_0x2714a3['id'],'direction':'in','ContactId':_0x2714a3[_0xc1a4('0x4f')],'AttachmentId':_0x1968a7['body']['AttachmentId']});})[_0xc1a4('0xe')](function(_0x50e5ff){_0x41aae3[_0xc1a4('0x16')]=_0x50e5ff;if(!_0x41aae3['interaction'][_0xc1a4('0x50')])return;return db[_0xc1a4('0x51')][_0xc1a4('0x37')]({'attributes':['id',_0xc1a4('0x52')],'where':{'id':_0x41aae3[_0xc1a4('0x53')][_0xc1a4('0x50')]}});})['then'](function(_0x173510){if(_0x173510){_0x41aae3[_0xc1a4('0x3e')][_0xc1a4('0x54')]({'id':0x0,'priority':0x0,'app':'agent','appdata':_0x173510[_0xc1a4('0x52')]+','+(_0x41aae3[_0xc1a4('0x38')][_0xc1a4('0x55')]||0xa),'interval':_0xc1a4('0x4b')});}if(!_0x41aae3[_0xc1a4('0x53')][_0xc1a4('0x56')])return;return db['FaxQueue'][_0xc1a4('0x37')]({'attributes':['id',_0xc1a4('0x52')],'where':{'id':_0x41aae3['interaction'][_0xc1a4('0x56')]}});})[_0xc1a4('0xe')](function(_0x335402){if(_0x335402){_0x41aae3[_0xc1a4('0x3e')][_0xc1a4('0x54')]({'id':0x0,'priority':0x1,'app':_0xc1a4('0x57'),'appdata':_0x335402[_0xc1a4('0x52')]+','+(_0x41aae3[_0xc1a4('0x38')][_0xc1a4('0x58')]||0x12c),'interval':_0xc1a4('0x4b')});}return respondWithRpcPromise('Start',_0xc1a4('0x59'),_0x41aae3);})[_0xc1a4('0xe')](function(_0x4d6bcd){_0x5641dc(_0x4d6bcd);})[_0xc1a4('0x18')](function(_0x6e8c18){_0x33c850(_0x3a8291[_0xc1a4('0x14')](0x1f4,_0x6e8c18[_0xc1a4('0x16')]));});});}; \ No newline at end of file diff --git a/server/api/faxAccount/faxAccount.socket.js b/server/api/faxAccount/faxAccount.socket.js index 7223ccc..0a99d48 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 _0x5a51=['faxAccount:','./faxAccount.events','save','remove','update','emit','removeListener','register','length'];(function(_0x1f6e71,_0x19360b){var _0x2271aa=function(_0x2f0431){while(--_0x2f0431){_0x1f6e71['push'](_0x1f6e71['shift']());}};_0x2271aa(++_0x19360b);}(_0x5a51,0xd0));var _0x15a5=function(_0xbdd3d2,_0x3b1223){_0xbdd3d2=_0xbdd3d2-0x0;var _0x1218ef=_0x5a51[_0xbdd3d2];return _0x1218ef;};'use strict';var FaxAccountEvents=require(_0x15a5('0x0'));var events=[_0x15a5('0x1'),_0x15a5('0x2'),_0x15a5('0x3')];function createListener(_0x1efd77,_0x667ad8){return function(_0x4c55d2){_0x667ad8[_0x15a5('0x4')](_0x1efd77,_0x4c55d2);};}function removeListener(_0x132e04,_0x385017){return function(){FaxAccountEvents[_0x15a5('0x5')](_0x132e04,_0x385017);};}exports[_0x15a5('0x6')]=function(_0xc6ada5){for(var _0x13779d=0x0,_0x3e6934=events[_0x15a5('0x7')];_0x13779d<_0x3e6934;_0x13779d++){var _0x1b8892=events[_0x13779d];var _0x518bfb=createListener(_0x15a5('0x8')+_0x1b8892,_0xc6ada5);FaxAccountEvents['on'](_0x1b8892,_0x518bfb);}}; \ No newline at end of file +var _0x8e1d=['removeListener','register','faxAccount:','./faxAccount.events','save','remove'];(function(_0xe52657,_0x374354){var _0x4f14ea=function(_0x413ee4){while(--_0x413ee4){_0xe52657['push'](_0xe52657['shift']());}};_0x4f14ea(++_0x374354);}(_0x8e1d,0x1e9));var _0xd8e1=function(_0x618414,_0x1a7a60){_0x618414=_0x618414-0x0;var _0x21c19a=_0x8e1d[_0x618414];return _0x21c19a;};'use strict';var FaxAccountEvents=require(_0xd8e1('0x0'));var events=[_0xd8e1('0x1'),_0xd8e1('0x2'),'update'];function createListener(_0x1cdcc2,_0xc53c5a){return function(_0x2f851d){_0xc53c5a['emit'](_0x1cdcc2,_0x2f851d);};}function removeListener(_0x55f899,_0x5dfd96){return function(){FaxAccountEvents[_0xd8e1('0x3')](_0x55f899,_0x5dfd96);};}exports[_0xd8e1('0x4')]=function(_0x40e1dc){for(var _0x5866ea=0x0,_0x4a8393=events['length'];_0x5866ea<_0x4a8393;_0x5866ea++){var _0x260397=events[_0x5866ea];var _0xcb8e1e=createListener(_0xd8e1('0x5')+_0x260397,_0x40e1dc);FaxAccountEvents['on'](_0x260397,_0xcb8e1e);}}; \ No newline at end of file diff --git a/server/api/faxAccount/index.js b/server/api/faxAccount/index.js index defb606..8c489a0 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 _0xf95f=['create','addDisposition','addAnswer','addInteraction','addApplications','/addaccountapplications','addAccountApplications','/updateaccountapplications','updateAccountApplications','/:id/send','update','delete','destroy','removeDispositions','removeAnswers','removeAgents','exports','multer','util','path','connect-timeout','express','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','./faxAccount.controller','get','isAuthenticated','/:id','/:id/dispositions','getDispositions','/:id/canned_answers','getAnswers','/:id/interactions','/:id/applications','getMessages','/:id/users','post'];(function(_0x304b67,_0x31cb39){var _0x493afb=function(_0x21dce3){while(--_0x21dce3){_0x304b67['push'](_0x304b67['shift']());}};_0x493afb(++_0x31cb39);}(_0xf95f,0x122));var _0xff95=function(_0x24d24e,_0x4e17a4){_0x24d24e=_0x24d24e-0x0;var _0x20e068=_0xf95f[_0x24d24e];return _0x20e068;};'use strict';var multer=require(_0xff95('0x0'));var util=require(_0xff95('0x1'));var path=require(_0xff95('0x2'));var timeout=require(_0xff95('0x3'));var express=require(_0xff95('0x4'));var router=express['Router']();var fs_extra=require(_0xff95('0x5'));var auth=require(_0xff95('0x6'));var interaction=require(_0xff95('0x7'));var config=require(_0xff95('0x8'));var controller=require(_0xff95('0x9'));router['get']('/',auth['isAuthenticated'](),controller['index']);router[_0xff95('0xa')]('/describe',auth[_0xff95('0xb')](),controller['describe']);router[_0xff95('0xa')](_0xff95('0xc'),auth[_0xff95('0xb')](),controller['show']);router[_0xff95('0xa')](_0xff95('0xd'),auth[_0xff95('0xb')](),controller[_0xff95('0xe')]);router[_0xff95('0xa')](_0xff95('0xf'),auth['isAuthenticated'](),controller[_0xff95('0x10')]);router[_0xff95('0xa')](_0xff95('0x11'),auth[_0xff95('0xb')](),controller['getInteractions']);router['get'](_0xff95('0x12'),auth[_0xff95('0xb')](),controller['getApplications']);router[_0xff95('0xa')]('/:id/messages',auth['isAuthenticated'](),controller[_0xff95('0x13')]);router[_0xff95('0xa')](_0xff95('0x14'),auth[_0xff95('0xb')](),controller['getAgents']);router[_0xff95('0x15')]('/',auth['isAuthenticated'](),controller[_0xff95('0x16')]);router[_0xff95('0x15')](_0xff95('0xd'),auth['isAuthenticated'](),controller[_0xff95('0x17')]);router['post'](_0xff95('0xf'),auth[_0xff95('0xb')](),controller[_0xff95('0x18')]);router[_0xff95('0x15')](_0xff95('0x11'),auth[_0xff95('0xb')](),controller[_0xff95('0x19')]);router[_0xff95('0x15')](_0xff95('0x12'),auth[_0xff95('0xb')](),controller[_0xff95('0x1a')]);router[_0xff95('0x15')](_0xff95('0x1b'),auth[_0xff95('0xb')](),controller[_0xff95('0x1c')]);router[_0xff95('0x15')](_0xff95('0x1d'),auth[_0xff95('0xb')](),controller[_0xff95('0x1e')]);router[_0xff95('0x15')](_0xff95('0x1f'),auth[_0xff95('0xb')](),controller['send']);router['post'](_0xff95('0x14'),auth[_0xff95('0xb')](),controller['addAgents']);router['put']('/:id',auth[_0xff95('0xb')](),controller[_0xff95('0x20')]);router[_0xff95('0x21')](_0xff95('0xc'),auth[_0xff95('0xb')](),controller[_0xff95('0x22')]);router[_0xff95('0x21')]('/:id/dispositions',auth[_0xff95('0xb')](),controller[_0xff95('0x23')]);router[_0xff95('0x21')](_0xff95('0xf'),auth[_0xff95('0xb')](),controller[_0xff95('0x24')]);router[_0xff95('0x21')](_0xff95('0x14'),auth[_0xff95('0xb')](),controller[_0xff95('0x25')]);module[_0xff95('0x26')]=router; \ No newline at end of file +var _0x0727=['addAgents','update','delete','removeAnswers','removeAgents','exports','multer','util','path','express','Router','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','./faxAccount.controller','isAuthenticated','index','get','/describe','/:id','show','/:id/dispositions','/:id/interactions','getInteractions','/:id/applications','getApplications','/:id/messages','/:id/users','getAgents','addDisposition','post','/:id/canned_answers','addInteraction','addApplications','addAccountApplications','/updateaccountapplications','updateAccountApplications','/:id/send','send'];(function(_0x189c9e,_0x1c3b55){var _0x3f38ca=function(_0x4c05ec){while(--_0x4c05ec){_0x189c9e['push'](_0x189c9e['shift']());}};_0x3f38ca(++_0x1c3b55);}(_0x0727,0x7e));var _0x7072=function(_0x124f88,_0x3ad501){_0x124f88=_0x124f88-0x0;var _0xed0e3b=_0x0727[_0x124f88];return _0xed0e3b;};'use strict';var multer=require(_0x7072('0x0'));var util=require(_0x7072('0x1'));var path=require(_0x7072('0x2'));var timeout=require('connect-timeout');var express=require(_0x7072('0x3'));var router=express[_0x7072('0x4')]();var fs_extra=require(_0x7072('0x5'));var auth=require(_0x7072('0x6'));var interaction=require(_0x7072('0x7'));var config=require(_0x7072('0x8'));var controller=require(_0x7072('0x9'));router['get']('/',auth[_0x7072('0xa')](),controller[_0x7072('0xb')]);router[_0x7072('0xc')](_0x7072('0xd'),auth[_0x7072('0xa')](),controller['describe']);router[_0x7072('0xc')](_0x7072('0xe'),auth[_0x7072('0xa')](),controller[_0x7072('0xf')]);router['get'](_0x7072('0x10'),auth[_0x7072('0xa')](),controller['getDispositions']);router[_0x7072('0xc')]('/:id/canned_answers',auth[_0x7072('0xa')](),controller['getAnswers']);router[_0x7072('0xc')](_0x7072('0x11'),auth[_0x7072('0xa')](),controller[_0x7072('0x12')]);router['get'](_0x7072('0x13'),auth['isAuthenticated'](),controller[_0x7072('0x14')]);router['get'](_0x7072('0x15'),auth[_0x7072('0xa')](),controller['getMessages']);router['get'](_0x7072('0x16'),auth[_0x7072('0xa')](),controller[_0x7072('0x17')]);router['post']('/',auth['isAuthenticated'](),controller['create']);router['post']('/:id/dispositions',auth[_0x7072('0xa')](),controller[_0x7072('0x18')]);router[_0x7072('0x19')](_0x7072('0x1a'),auth[_0x7072('0xa')](),controller['addAnswer']);router['post'](_0x7072('0x11'),auth[_0x7072('0xa')](),controller[_0x7072('0x1b')]);router[_0x7072('0x19')](_0x7072('0x13'),auth[_0x7072('0xa')](),controller[_0x7072('0x1c')]);router[_0x7072('0x19')]('/addaccountapplications',auth[_0x7072('0xa')](),controller[_0x7072('0x1d')]);router[_0x7072('0x19')](_0x7072('0x1e'),auth[_0x7072('0xa')](),controller[_0x7072('0x1f')]);router[_0x7072('0x19')](_0x7072('0x20'),auth[_0x7072('0xa')](),controller[_0x7072('0x21')]);router[_0x7072('0x19')](_0x7072('0x16'),auth[_0x7072('0xa')](),controller[_0x7072('0x22')]);router['put']('/:id',auth[_0x7072('0xa')](),controller[_0x7072('0x23')]);router[_0x7072('0x24')](_0x7072('0xe'),auth[_0x7072('0xa')](),controller['destroy']);router[_0x7072('0x24')]('/:id/dispositions',auth[_0x7072('0xa')](),controller['removeDispositions']);router[_0x7072('0x24')](_0x7072('0x1a'),auth[_0x7072('0xa')](),controller[_0x7072('0x25')]);router[_0x7072('0x24')](_0x7072('0x16'),auth[_0x7072('0xa')](),controller[_0x7072('0x26')]);module[_0x7072('0x27')]=router; \ No newline at end of file diff --git a/server/api/faxApplication/faxApplication.attributes.js b/server/api/faxApplication/faxApplication.attributes.js index 2a8d07d..3fdf975 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 _0x4aeb=['exports','noop','TEXT','STRING','sequelize'];(function(_0x424a9a,_0x2dd9af){var _0xa7831c=function(_0x512534){while(--_0x512534){_0x424a9a['push'](_0x424a9a['shift']());}};_0xa7831c(++_0x2dd9af);}(_0x4aeb,0x194));var _0xb4ae=function(_0x259a6b,_0x391bd7){_0x259a6b=_0x259a6b-0x0;var _0x742738=_0x4aeb[_0x259a6b];return _0x742738;};'use strict';var Sequelize=require(_0xb4ae('0x0'));module[_0xb4ae('0x1')]={'priority':{'type':Sequelize['INTEGER'],'allowNull':![]},'app':{'type':Sequelize['STRING'],'allowNull':![],'defaultValue':_0xb4ae('0x2')},'appdata':{'type':Sequelize[_0xb4ae('0x3')]()},'description':{'type':Sequelize['STRING']},'interval':{'type':Sequelize[_0xb4ae('0x4')],'defaultValue':'*,*,*,*'}}; \ No newline at end of file +var _0xfc20=['exports','INTEGER','noop','STRING','*,*,*,*','sequelize'];(function(_0x1bd48c,_0x90eb2c){var _0x6a36dc=function(_0x4a5327){while(--_0x4a5327){_0x1bd48c['push'](_0x1bd48c['shift']());}};_0x6a36dc(++_0x90eb2c);}(_0xfc20,0x13d));var _0x0fc2=function(_0x595439,_0x1653d0){_0x595439=_0x595439-0x0;var _0x2fd012=_0xfc20[_0x595439];return _0x2fd012;};'use strict';var Sequelize=require(_0x0fc2('0x0'));module[_0x0fc2('0x1')]={'priority':{'type':Sequelize[_0x0fc2('0x2')],'allowNull':![]},'app':{'type':Sequelize['STRING'],'allowNull':![],'defaultValue':_0x0fc2('0x3')},'appdata':{'type':Sequelize['TEXT']()},'description':{'type':Sequelize[_0x0fc2('0x4')]},'interval':{'type':Sequelize[_0x0fc2('0x4')],'defaultValue':_0x0fc2('0x5')}}; \ No newline at end of file diff --git a/server/api/faxApplication/faxApplication.controller.js b/server/api/faxApplication/faxApplication.controller.js index c5a3805..7ff2164 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 _0xaa48=['path','sox','to-csv','ejs','lodash','desk.js','querystring','papaparse','../../components/auth/service','../../components/parsers/qs','../../config/license/hardware','../../config/logger','api','../../config/utils','../../mysqldb','sendStatus','status','end','json','offset','undefined','limit','count','set','Content-Range','save','update','then','destroy','error','stack','name','index','map','rawAttributes','fieldName','type','key','query','keys','filters','model','attributes','fields','length','hasOwnProperty','nolimit','order','sort','where','filter','merge','VIRTUAL','options','FaxApplication','includeAll','findAll','rows','catch','params','intersection','include','find','create','body','eml-format','rimraf','zip-dir','request-promise','moment','bluebird','mustache'];(function(_0x85ebcb,_0x2a88f0){var _0x58f55d=function(_0x2ba05b){while(--_0x2ba05b){_0x85ebcb['push'](_0x85ebcb['shift']());}};_0x58f55d(++_0x2a88f0);}(_0xaa48,0x1a9));var _0x8aa4=function(_0x1b8e62,_0x2fd200){_0x1b8e62=_0x1b8e62-0x0;var _0xb79c94=_0xaa48[_0x1b8e62];return _0xb79c94;};'use strict';var emlformat=require(_0x8aa4('0x0'));var rimraf=require(_0x8aa4('0x1'));var zipdir=require(_0x8aa4('0x2'));var jsonpatch=require('fast-json-patch');var rp=require(_0x8aa4('0x3'));var moment=require(_0x8aa4('0x4'));var BPromise=require(_0x8aa4('0x5'));var Mustache=require(_0x8aa4('0x6'));var util=require('util');var path=require(_0x8aa4('0x7'));var sox=require(_0x8aa4('0x8'));var csv=require(_0x8aa4('0x9'));var ejs=require(_0x8aa4('0xa'));var fs=require('fs');var fs_extra=require('fs-extra');var _=require(_0x8aa4('0xb'));var squel=require('squel');var crypto=require('crypto');var jsforce=require('jsforce');var deskjs=require(_0x8aa4('0xc'));var toCsv=require(_0x8aa4('0x9'));var querystring=require(_0x8aa4('0xd'));var Papa=require(_0x8aa4('0xe'));var Redis=require('ioredis');var authService=require(_0x8aa4('0xf'));var qs=require(_0x8aa4('0x10'));var as=require('../../components/parsers/advancedSearch');var hardwareService=require(_0x8aa4('0x11'));var logger=require(_0x8aa4('0x12'))(_0x8aa4('0x13'));var utils=require(_0x8aa4('0x14'));var config=require('../../config/environment');var licenseUtil=require('../../config/license/util');var db=require(_0x8aa4('0x15'))['db'];function respondWithStatusCode(_0x182d65,_0x5a70b7){_0x5a70b7=_0x5a70b7||0xcc;return function(_0x346a0c){if(_0x346a0c){return _0x182d65[_0x8aa4('0x16')](_0x5a70b7);}return _0x182d65[_0x8aa4('0x17')](_0x5a70b7)[_0x8aa4('0x18')]();};}function respondWithResult(_0x59f989,_0x3c05a7){_0x3c05a7=_0x3c05a7||0xc8;return function(_0x3682ab){if(_0x3682ab){return _0x59f989[_0x8aa4('0x17')](_0x3c05a7)[_0x8aa4('0x19')](_0x3682ab);}};}function respondWithFilteredResult(_0x5a1a21,_0x319224){return function(_0x512112){if(_0x512112){var _0x304243=typeof _0x319224[_0x8aa4('0x1a')]===_0x8aa4('0x1b')&&typeof _0x319224[_0x8aa4('0x1c')]===_0x8aa4('0x1b');var _0xec492=_0x512112['count'];var _0x344a3b=_0x304243?0x0:_0x319224['offset'];var _0x30ef9e=_0x304243?_0x512112[_0x8aa4('0x1d')]:_0x319224[_0x8aa4('0x1a')]+_0x319224[_0x8aa4('0x1c')];var _0x376f84;if(_0x30ef9e>=_0xec492){_0x30ef9e=_0xec492;_0x376f84=0xc8;}else{_0x376f84=0xce;}_0x5a1a21[_0x8aa4('0x17')](_0x376f84);return _0x5a1a21[_0x8aa4('0x1e')](_0x8aa4('0x1f'),_0x344a3b+'-'+_0x30ef9e+'/'+_0xec492)[_0x8aa4('0x19')](_0x512112);}return null;};}function patchUpdates(_0x13bcd5){return function(_0x2698c0){try{jsonpatch['apply'](_0x2698c0,_0x13bcd5,!![]);}catch(_0x4dd0dc){return BPromise['reject'](_0x4dd0dc);}return _0x2698c0[_0x8aa4('0x20')]();};}function saveUpdates(_0x2a7497,_0xfc9165){return function(_0x4d60a4){if(_0x4d60a4){return _0x4d60a4[_0x8aa4('0x21')](_0x2a7497)[_0x8aa4('0x22')](function(_0x400c8d){return _0x400c8d;});}return null;};}function removeEntity(_0x3a48c2,_0x485d7b){return function(_0x564d6a){if(_0x564d6a){return _0x564d6a[_0x8aa4('0x23')]()[_0x8aa4('0x22')](function(){_0x3a48c2[_0x8aa4('0x17')](0xcc)[_0x8aa4('0x18')]();});}};}function handleEntityNotFound(_0x29ec51,_0x45c9ac){return function(_0x10963b){if(!_0x10963b){_0x29ec51[_0x8aa4('0x16')](0x194);}return _0x10963b;};}function handleError(_0x27f229,_0x1f0568){_0x1f0568=_0x1f0568||0x1f4;return function(_0x38916b){logger[_0x8aa4('0x24')](_0x38916b[_0x8aa4('0x25')]);if(_0x38916b[_0x8aa4('0x26')]){delete _0x38916b[_0x8aa4('0x26')];}_0x27f229[_0x8aa4('0x17')](_0x1f0568)['send'](_0x38916b);};}exports[_0x8aa4('0x27')]=function(_0x9637d,_0x48c764){var _0x350930={},_0x40d402={},_0x5c370f={'count':0x0,'rows':[]};var _0x1579c0=_[_0x8aa4('0x28')](db['FaxApplication'][_0x8aa4('0x29')],function(_0x5d401f){return{'name':_0x5d401f[_0x8aa4('0x2a')],'type':_0x5d401f[_0x8aa4('0x2b')][_0x8aa4('0x2c')]};});_0x40d402['model']=_['map'](_0x1579c0,_0x8aa4('0x26'));_0x40d402[_0x8aa4('0x2d')]=_[_0x8aa4('0x2e')](_0x9637d['query']);_0x40d402[_0x8aa4('0x2f')]=_['intersection'](_0x40d402[_0x8aa4('0x30')],_0x40d402[_0x8aa4('0x2d')]);_0x350930[_0x8aa4('0x31')]=_['intersection'](_0x40d402[_0x8aa4('0x30')],qs['fields'](_0x9637d[_0x8aa4('0x2d')][_0x8aa4('0x32')]));_0x350930[_0x8aa4('0x31')]=_0x350930[_0x8aa4('0x31')][_0x8aa4('0x33')]?_0x350930[_0x8aa4('0x31')]:_0x40d402['model'];if(!_0x9637d['query'][_0x8aa4('0x34')](_0x8aa4('0x35'))){_0x350930[_0x8aa4('0x1c')]=qs[_0x8aa4('0x1c')](_0x9637d[_0x8aa4('0x2d')][_0x8aa4('0x1c')]);_0x350930['offset']=qs[_0x8aa4('0x1a')](_0x9637d[_0x8aa4('0x2d')][_0x8aa4('0x1a')]);}_0x350930[_0x8aa4('0x36')]=qs[_0x8aa4('0x37')](_0x9637d[_0x8aa4('0x2d')][_0x8aa4('0x37')]);_0x350930[_0x8aa4('0x38')]=qs[_0x8aa4('0x2f')](_['pick'](_0x9637d['query'],_0x40d402[_0x8aa4('0x2f')]),_0x1579c0);if(_0x9637d['query'][_0x8aa4('0x39')]){_0x350930[_0x8aa4('0x38')]=_[_0x8aa4('0x3a')](_0x350930[_0x8aa4('0x38')],{'$or':_[_0x8aa4('0x28')](_0x1579c0,function(_0x42826b){if(_0x42826b[_0x8aa4('0x2b')]!==_0x8aa4('0x3b')){var _0x271fd4={};_0x271fd4[_0x42826b[_0x8aa4('0x26')]]={'$like':'%'+_0x9637d[_0x8aa4('0x2d')][_0x8aa4('0x39')]+'%'};return _0x271fd4;}})});}_0x350930=_['merge']({},_0x350930,_0x9637d[_0x8aa4('0x3c')]);var _0xc47436={'where':_0x350930[_0x8aa4('0x38')]};return db[_0x8aa4('0x3d')][_0x8aa4('0x1d')](_0xc47436)[_0x8aa4('0x22')](function(_0x1fabd1){_0x5c370f[_0x8aa4('0x1d')]=_0x1fabd1;if(_0x9637d[_0x8aa4('0x2d')][_0x8aa4('0x3e')]){_0x350930['include']=[{'all':!![]}];}return db[_0x8aa4('0x3d')][_0x8aa4('0x3f')](_0x350930);})['then'](function(_0x299e15){_0x5c370f[_0x8aa4('0x40')]=_0x299e15;return _0x5c370f;})[_0x8aa4('0x22')](respondWithFilteredResult(_0x48c764,_0x350930))[_0x8aa4('0x41')](handleError(_0x48c764,null));};exports['show']=function(_0x4e5be4,_0x1d1767){var _0x4a1106={'raw':!![],'where':{'id':_0x4e5be4[_0x8aa4('0x42')]['id']}},_0x34ca29={};_0x34ca29[_0x8aa4('0x30')]=_[_0x8aa4('0x2e')](db['FaxApplication'][_0x8aa4('0x29')]);_0x34ca29['query']=_['keys'](_0x4e5be4[_0x8aa4('0x2d')]);_0x34ca29[_0x8aa4('0x2f')]=_[_0x8aa4('0x43')](_0x34ca29[_0x8aa4('0x30')],_0x34ca29['query']);_0x4a1106[_0x8aa4('0x31')]=_[_0x8aa4('0x43')](_0x34ca29['model'],qs['fields'](_0x4e5be4[_0x8aa4('0x2d')][_0x8aa4('0x32')]));_0x4a1106[_0x8aa4('0x31')]=_0x4a1106[_0x8aa4('0x31')][_0x8aa4('0x33')]?_0x4a1106[_0x8aa4('0x31')]:_0x34ca29[_0x8aa4('0x30')];if(_0x4e5be4['query'][_0x8aa4('0x3e')]){_0x4a1106[_0x8aa4('0x44')]=[{'all':!![]}];}_0x4a1106=_['merge']({},_0x4a1106,_0x4e5be4[_0x8aa4('0x3c')]);return db['FaxApplication'][_0x8aa4('0x45')](_0x4a1106)['then'](handleEntityNotFound(_0x1d1767,null))['then'](respondWithResult(_0x1d1767,null))[_0x8aa4('0x41')](handleError(_0x1d1767,null));};exports['create']=function(_0x55edcb,_0x4e09de){return db[_0x8aa4('0x3d')][_0x8aa4('0x46')](_0x55edcb[_0x8aa4('0x47')],{})['then'](respondWithResult(_0x4e09de,0xc9))[_0x8aa4('0x41')](handleError(_0x4e09de,null));};exports[_0x8aa4('0x21')]=function(_0x4c1c4a,_0x45eea9){if(_0x4c1c4a[_0x8aa4('0x47')]['id']){delete _0x4c1c4a['body']['id'];}return db[_0x8aa4('0x3d')][_0x8aa4('0x45')]({'where':{'id':_0x4c1c4a['params']['id']}})[_0x8aa4('0x22')](handleEntityNotFound(_0x45eea9,null))['then'](saveUpdates(_0x4c1c4a[_0x8aa4('0x47')],null))['then'](respondWithResult(_0x45eea9,null))['catch'](handleError(_0x45eea9,null));};exports[_0x8aa4('0x23')]=function(_0xcfb979,_0x5e5fd9){return db['FaxApplication']['find']({'where':{'id':_0xcfb979['params']['id']}})[_0x8aa4('0x22')](handleEntityNotFound(_0x5e5fd9,null))[_0x8aa4('0x22')](removeEntity(_0x5e5fd9,null))[_0x8aa4('0x41')](handleError(_0x5e5fd9,null));}; \ No newline at end of file +var _0x9b10=['count','offset','limit','Content-Range','apply','reject','update','then','destroy','sendStatus','error','name','send','index','map','FaxApplication','fieldName','type','key','model','keys','query','filters','intersection','attributes','fields','length','hasOwnProperty','sort','where','pick','filter','options','includeAll','include','findAll','rows','show','rawAttributes','find','catch','create','body','params','eml-format','rimraf','fast-json-patch','request-promise','moment','bluebird','mustache','util','path','sox','to-csv','ejs','fs-extra','squel','crypto','jsforce','desk.js','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../config/license/hardware','api','../../config/environment','../../config/license/util','../../mysqldb','status','end','json','undefined'];(function(_0x50f068,_0x25e447){var _0x14bf14=function(_0x33d3cd){while(--_0x33d3cd){_0x50f068['push'](_0x50f068['shift']());}};_0x14bf14(++_0x25e447);}(_0x9b10,0x10d));var _0x09b1=function(_0x167cc1,_0x56ef5a){_0x167cc1=_0x167cc1-0x0;var _0x10bc4b=_0x9b10[_0x167cc1];return _0x10bc4b;};'use strict';var emlformat=require(_0x09b1('0x0'));var rimraf=require(_0x09b1('0x1'));var zipdir=require('zip-dir');var jsonpatch=require(_0x09b1('0x2'));var rp=require(_0x09b1('0x3'));var moment=require(_0x09b1('0x4'));var BPromise=require(_0x09b1('0x5'));var Mustache=require(_0x09b1('0x6'));var util=require(_0x09b1('0x7'));var path=require(_0x09b1('0x8'));var sox=require(_0x09b1('0x9'));var csv=require(_0x09b1('0xa'));var ejs=require(_0x09b1('0xb'));var fs=require('fs');var fs_extra=require(_0x09b1('0xc'));var _=require('lodash');var squel=require(_0x09b1('0xd'));var crypto=require(_0x09b1('0xe'));var jsforce=require(_0x09b1('0xf'));var deskjs=require(_0x09b1('0x10'));var toCsv=require(_0x09b1('0xa'));var querystring=require(_0x09b1('0x11'));var Papa=require(_0x09b1('0x12'));var Redis=require(_0x09b1('0x13'));var authService=require(_0x09b1('0x14'));var qs=require(_0x09b1('0x15'));var as=require('../../components/parsers/advancedSearch');var hardwareService=require(_0x09b1('0x16'));var logger=require('../../config/logger')(_0x09b1('0x17'));var utils=require('../../config/utils');var config=require(_0x09b1('0x18'));var licenseUtil=require(_0x09b1('0x19'));var db=require(_0x09b1('0x1a'))['db'];function respondWithStatusCode(_0x447245,_0x4d7de9){_0x4d7de9=_0x4d7de9||0xcc;return function(_0x41719e){if(_0x41719e){return _0x447245['sendStatus'](_0x4d7de9);}return _0x447245[_0x09b1('0x1b')](_0x4d7de9)[_0x09b1('0x1c')]();};}function respondWithResult(_0x30313b,_0x65bbea){_0x65bbea=_0x65bbea||0xc8;return function(_0x39d5a9){if(_0x39d5a9){return _0x30313b[_0x09b1('0x1b')](_0x65bbea)[_0x09b1('0x1d')](_0x39d5a9);}};}function respondWithFilteredResult(_0x247c7a,_0xe1fd75){return function(_0x255d5f){if(_0x255d5f){var _0x9d7e9b=typeof _0xe1fd75['offset']===_0x09b1('0x1e')&&typeof _0xe1fd75['limit']===_0x09b1('0x1e');var _0x8506c7=_0x255d5f['count'];var _0x2d175c=_0x9d7e9b?0x0:_0xe1fd75['offset'];var _0x2b6645=_0x9d7e9b?_0x255d5f[_0x09b1('0x1f')]:_0xe1fd75[_0x09b1('0x20')]+_0xe1fd75[_0x09b1('0x21')];var _0x3ed1ac;if(_0x2b6645>=_0x8506c7){_0x2b6645=_0x8506c7;_0x3ed1ac=0xc8;}else{_0x3ed1ac=0xce;}_0x247c7a['status'](_0x3ed1ac);return _0x247c7a['set'](_0x09b1('0x22'),_0x2d175c+'-'+_0x2b6645+'/'+_0x8506c7)[_0x09b1('0x1d')](_0x255d5f);}return null;};}function patchUpdates(_0x542435){return function(_0x38343d){try{jsonpatch[_0x09b1('0x23')](_0x38343d,_0x542435,!![]);}catch(_0x201dee){return BPromise[_0x09b1('0x24')](_0x201dee);}return _0x38343d['save']();};}function saveUpdates(_0x41b32a,_0x17246d){return function(_0x6dfbd9){if(_0x6dfbd9){return _0x6dfbd9[_0x09b1('0x25')](_0x41b32a)[_0x09b1('0x26')](function(_0x13ced7){return _0x13ced7;});}return null;};}function removeEntity(_0x50d749,_0x28343a){return function(_0x76d683){if(_0x76d683){return _0x76d683[_0x09b1('0x27')]()[_0x09b1('0x26')](function(){_0x50d749[_0x09b1('0x1b')](0xcc)[_0x09b1('0x1c')]();});}};}function handleEntityNotFound(_0x3c6200,_0x2e4825){return function(_0x3cfe1c){if(!_0x3cfe1c){_0x3c6200[_0x09b1('0x28')](0x194);}return _0x3cfe1c;};}function handleError(_0x28d597,_0x6e0c42){_0x6e0c42=_0x6e0c42||0x1f4;return function(_0x241038){logger[_0x09b1('0x29')](_0x241038['stack']);if(_0x241038[_0x09b1('0x2a')]){delete _0x241038[_0x09b1('0x2a')];}_0x28d597[_0x09b1('0x1b')](_0x6e0c42)[_0x09b1('0x2b')](_0x241038);};}exports[_0x09b1('0x2c')]=function(_0x20d6cb,_0x594b83){var _0x19a2e0={},_0x11a0e9={},_0x48ad15={'count':0x0,'rows':[]};var _0x5e0fc4=_[_0x09b1('0x2d')](db[_0x09b1('0x2e')]['rawAttributes'],function(_0x5afa37){return{'name':_0x5afa37[_0x09b1('0x2f')],'type':_0x5afa37[_0x09b1('0x30')][_0x09b1('0x31')]};});_0x11a0e9[_0x09b1('0x32')]=_[_0x09b1('0x2d')](_0x5e0fc4,_0x09b1('0x2a'));_0x11a0e9['query']=_[_0x09b1('0x33')](_0x20d6cb[_0x09b1('0x34')]);_0x11a0e9[_0x09b1('0x35')]=_[_0x09b1('0x36')](_0x11a0e9[_0x09b1('0x32')],_0x11a0e9['query']);_0x19a2e0[_0x09b1('0x37')]=_[_0x09b1('0x36')](_0x11a0e9[_0x09b1('0x32')],qs[_0x09b1('0x38')](_0x20d6cb[_0x09b1('0x34')][_0x09b1('0x38')]));_0x19a2e0[_0x09b1('0x37')]=_0x19a2e0[_0x09b1('0x37')][_0x09b1('0x39')]?_0x19a2e0[_0x09b1('0x37')]:_0x11a0e9[_0x09b1('0x32')];if(!_0x20d6cb['query'][_0x09b1('0x3a')]('nolimit')){_0x19a2e0['limit']=qs[_0x09b1('0x21')](_0x20d6cb['query'][_0x09b1('0x21')]);_0x19a2e0[_0x09b1('0x20')]=qs[_0x09b1('0x20')](_0x20d6cb[_0x09b1('0x34')]['offset']);}_0x19a2e0['order']=qs['sort'](_0x20d6cb[_0x09b1('0x34')][_0x09b1('0x3b')]);_0x19a2e0[_0x09b1('0x3c')]=qs[_0x09b1('0x35')](_[_0x09b1('0x3d')](_0x20d6cb[_0x09b1('0x34')],_0x11a0e9[_0x09b1('0x35')]),_0x5e0fc4);if(_0x20d6cb[_0x09b1('0x34')][_0x09b1('0x3e')]){_0x19a2e0['where']=_['merge'](_0x19a2e0[_0x09b1('0x3c')],{'$or':_[_0x09b1('0x2d')](_0x5e0fc4,function(_0x358fb3){if(_0x358fb3[_0x09b1('0x30')]!=='VIRTUAL'){var _0x432be6={};_0x432be6[_0x358fb3[_0x09b1('0x2a')]]={'$like':'%'+_0x20d6cb['query'][_0x09b1('0x3e')]+'%'};return _0x432be6;}})});}_0x19a2e0=_['merge']({},_0x19a2e0,_0x20d6cb[_0x09b1('0x3f')]);var _0x68bd54={'where':_0x19a2e0['where']};return db[_0x09b1('0x2e')]['count'](_0x68bd54)[_0x09b1('0x26')](function(_0x537b73){_0x48ad15['count']=_0x537b73;if(_0x20d6cb[_0x09b1('0x34')][_0x09b1('0x40')]){_0x19a2e0[_0x09b1('0x41')]=[{'all':!![]}];}return db[_0x09b1('0x2e')][_0x09b1('0x42')](_0x19a2e0);})[_0x09b1('0x26')](function(_0x3bdbeb){_0x48ad15[_0x09b1('0x43')]=_0x3bdbeb;return _0x48ad15;})[_0x09b1('0x26')](respondWithFilteredResult(_0x594b83,_0x19a2e0))['catch'](handleError(_0x594b83,null));};exports[_0x09b1('0x44')]=function(_0x241d49,_0x362076){var _0x4db9b3={'raw':!![],'where':{'id':_0x241d49['params']['id']}},_0x310ac2={};_0x310ac2[_0x09b1('0x32')]=_['keys'](db[_0x09b1('0x2e')][_0x09b1('0x45')]);_0x310ac2['query']=_[_0x09b1('0x33')](_0x241d49[_0x09b1('0x34')]);_0x310ac2[_0x09b1('0x35')]=_[_0x09b1('0x36')](_0x310ac2[_0x09b1('0x32')],_0x310ac2[_0x09b1('0x34')]);_0x4db9b3[_0x09b1('0x37')]=_[_0x09b1('0x36')](_0x310ac2[_0x09b1('0x32')],qs['fields'](_0x241d49[_0x09b1('0x34')][_0x09b1('0x38')]));_0x4db9b3['attributes']=_0x4db9b3[_0x09b1('0x37')][_0x09b1('0x39')]?_0x4db9b3[_0x09b1('0x37')]:_0x310ac2['model'];if(_0x241d49[_0x09b1('0x34')][_0x09b1('0x40')]){_0x4db9b3['include']=[{'all':!![]}];}_0x4db9b3=_['merge']({},_0x4db9b3,_0x241d49[_0x09b1('0x3f')]);return db[_0x09b1('0x2e')][_0x09b1('0x46')](_0x4db9b3)[_0x09b1('0x26')](handleEntityNotFound(_0x362076,null))[_0x09b1('0x26')](respondWithResult(_0x362076,null))[_0x09b1('0x47')](handleError(_0x362076,null));};exports[_0x09b1('0x48')]=function(_0x29a71e,_0x53c0c4){return db[_0x09b1('0x2e')]['create'](_0x29a71e[_0x09b1('0x49')],{})['then'](respondWithResult(_0x53c0c4,0xc9))['catch'](handleError(_0x53c0c4,null));};exports[_0x09b1('0x25')]=function(_0x5067b4,_0x4acbd8){if(_0x5067b4['body']['id']){delete _0x5067b4['body']['id'];}return db['FaxApplication'][_0x09b1('0x46')]({'where':{'id':_0x5067b4[_0x09b1('0x4a')]['id']}})[_0x09b1('0x26')](handleEntityNotFound(_0x4acbd8,null))[_0x09b1('0x26')](saveUpdates(_0x5067b4['body'],null))['then'](respondWithResult(_0x4acbd8,null))[_0x09b1('0x47')](handleError(_0x4acbd8,null));};exports[_0x09b1('0x27')]=function(_0x2905d8,_0x3a473c){return db[_0x09b1('0x2e')]['find']({'where':{'id':_0x2905d8['params']['id']}})[_0x09b1('0x26')](handleEntityNotFound(_0x3a473c,null))[_0x09b1('0x26')](removeEntity(_0x3a473c,null))[_0x09b1('0x47')](handleError(_0x3a473c,null));}; \ No newline at end of file diff --git a/server/api/faxApplication/faxApplication.model.js b/server/api/faxApplication/faxApplication.model.js index ea80281..3d9794b 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 _0xe535=['utf8mb4_unicode_ci','lodash','api','bluebird','request-promise','path','rimraf','../../config/environment','./faxApplication.attributes','exports','define','FaxApplication','fax_applications','utf8mb4'];(function(_0x4ea0f5,_0x2c3576){var _0x42c493=function(_0x16dca6){while(--_0x16dca6){_0x4ea0f5['push'](_0x4ea0f5['shift']());}};_0x42c493(++_0x2c3576);}(_0xe535,0xfd));var _0x5e53=function(_0x4c7fb5,_0x2548ef){_0x4c7fb5=_0x4c7fb5-0x0;var _0x2e10ac=_0xe535[_0x4c7fb5];return _0x2e10ac;};'use strict';var _=require(_0x5e53('0x0'));var util=require('util');var logger=require('../../config/logger')(_0x5e53('0x1'));var moment=require('moment');var BPromise=require(_0x5e53('0x2'));var rp=require(_0x5e53('0x3'));var fs=require('fs');var path=require(_0x5e53('0x4'));var rimraf=require(_0x5e53('0x5'));var config=require(_0x5e53('0x6'));var attributes=require(_0x5e53('0x7'));module[_0x5e53('0x8')]=function(_0x8dc855,_0x139e4a){return _0x8dc855[_0x5e53('0x9')](_0x5e53('0xa'),attributes,{'tableName':_0x5e53('0xb'),'paranoid':![],'indexes':[],'timestamps':!![],'charset':_0x5e53('0xc'),'collate':_0x5e53('0xd')});}; \ No newline at end of file +var _0xb8ac=['utf8mb4','utf8mb4_unicode_ci','util','api','moment','bluebird','path','rimraf','../../config/environment','exports','define','FaxApplication','fax_applications'];(function(_0x3ab51d,_0x2fa01d){var _0x29a04e=function(_0x7807b0){while(--_0x7807b0){_0x3ab51d['push'](_0x3ab51d['shift']());}};_0x29a04e(++_0x2fa01d);}(_0xb8ac,0xf9));var _0xcb8a=function(_0x5c0f96,_0x4a4316){_0x5c0f96=_0x5c0f96-0x0;var _0x145b4c=_0xb8ac[_0x5c0f96];return _0x145b4c;};'use strict';var _=require('lodash');var util=require(_0xcb8a('0x0'));var logger=require('../../config/logger')(_0xcb8a('0x1'));var moment=require(_0xcb8a('0x2'));var BPromise=require(_0xcb8a('0x3'));var rp=require('request-promise');var fs=require('fs');var path=require(_0xcb8a('0x4'));var rimraf=require(_0xcb8a('0x5'));var config=require(_0xcb8a('0x6'));var attributes=require('./faxApplication.attributes');module[_0xcb8a('0x7')]=function(_0x2555f1,_0x1de45a){return _0x2555f1[_0xcb8a('0x8')](_0xcb8a('0x9'),attributes,{'tableName':_0xcb8a('0xa'),'paranoid':![],'indexes':[],'timestamps':!![],'charset':_0xcb8a('0xb'),'collate':_0xcb8a('0xc')});}; \ No newline at end of file diff --git a/server/api/faxApplication/faxApplication.rpc.js b/server/api/faxApplication/faxApplication.rpc.js index 1519cca..ab951e2 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 _0xf6d0=['catch','UpdateFaxApplication','FaxApplication','update','body','options','limit','lodash','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','rpc','../../config/environment','jayson/promise','client','http','then','FaxApplication,\x20%s,\x20%s','request\x20sent','debug','FaxApplication,\x20%s,\x20%s,\x20%s','stringify','error','code','message','info','result'];(function(_0x22d33b,_0x15491a){var _0x80b3ab=function(_0x4425de){while(--_0x4425de){_0x22d33b['push'](_0x22d33b['shift']());}};_0x80b3ab(++_0x15491a);}(_0xf6d0,0x163));var _0x0f6d=function(_0x1698b4,_0x38f4ff){_0x1698b4=_0x1698b4-0x0;var _0x164c1a=_0xf6d0[_0x1698b4];return _0x164c1a;};'use strict';var _=require(_0x0f6d('0x0'));var util=require('util');var moment=require('moment');var BPromise=require(_0x0f6d('0x1'));var rs=require(_0x0f6d('0x2'));var fs=require('fs');var Redis=require(_0x0f6d('0x3'));var db=require(_0x0f6d('0x4'))['db'];var utils=require(_0x0f6d('0x5'));var logger=require('../../config/logger')(_0x0f6d('0x6'));var config=require(_0x0f6d('0x7'));var jayson=require(_0x0f6d('0x8'));var client=jayson[_0x0f6d('0x9')][_0x0f6d('0xa')]({'port':0x232a});function respondWithRpcPromise(_0x3fb958,_0xee4ae7,_0x5c2d38){return new BPromise(function(_0x5657de,_0x2268f1){return client['request'](_0x3fb958,_0x5c2d38)[_0x0f6d('0xb')](function(_0x5990fb){logger['info'](_0x0f6d('0xc'),_0xee4ae7,_0x0f6d('0xd'));logger[_0x0f6d('0xe')](_0x0f6d('0xf'),_0xee4ae7,'request\x20sent',JSON[_0x0f6d('0x10')](_0x5990fb));if(_0x5990fb['error']){if(_0x5990fb[_0x0f6d('0x11')][_0x0f6d('0x12')]===0x1f4){logger[_0x0f6d('0x11')]('FaxApplication,\x20%s,\x20%s',_0xee4ae7,_0x5990fb[_0x0f6d('0x11')]['message']);return _0x2268f1(_0x5990fb['error'][_0x0f6d('0x13')]);}logger[_0x0f6d('0x11')](_0x0f6d('0xc'),_0xee4ae7,_0x5990fb[_0x0f6d('0x11')][_0x0f6d('0x13')]);return _0x5657de(_0x5990fb[_0x0f6d('0x11')]['message']);}else{logger[_0x0f6d('0x14')](_0x0f6d('0xc'),_0xee4ae7,_0x0f6d('0xd'));_0x5657de(_0x5990fb[_0x0f6d('0x15')]['message']);}})[_0x0f6d('0x16')](function(_0x228088){logger[_0x0f6d('0x11')](_0x0f6d('0xc'),_0xee4ae7,_0x228088);_0x2268f1(_0x228088);});});}exports[_0x0f6d('0x17')]=function(_0x5cdd00){var _0x2cdccd=this;return new Promise(function(_0x35ca05,_0x2f43e4){return db[_0x0f6d('0x18')][_0x0f6d('0x19')](_0x5cdd00[_0x0f6d('0x1a')],{'raw':_0x5cdd00[_0x0f6d('0x1b')]?_0x5cdd00[_0x0f6d('0x1b')]['raw']===undefined?!![]:![]:!![],'individualHooks':!![],'where':_0x5cdd00['options']?_0x5cdd00[_0x0f6d('0x1b')]['where']||null:null,'attributes':_0x5cdd00[_0x0f6d('0x1b')]?_0x5cdd00['options']['attributes']||null:null,'limit':_0x5cdd00['options']?_0x5cdd00['options'][_0x0f6d('0x1c')]||null:null})['then'](function(_0x476c33){logger[_0x0f6d('0x14')](_0x0f6d('0x17'),_0x5cdd00);logger[_0x0f6d('0xe')]('UpdateFaxApplication',_0x5cdd00,JSON['stringify'](_0x476c33));_0x35ca05(_0x476c33);})['catch'](function(_0xaa0161){logger[_0x0f6d('0x11')](_0x0f6d('0x17'),_0xaa0161['message'],_0x5cdd00);_0x2f43e4(_0x2cdccd[_0x0f6d('0x11')](0x1f4,_0xaa0161[_0x0f6d('0x13')]));});});}; \ No newline at end of file +var _0x33c5=['UpdateFaxApplication','FaxApplication','update','body','options','raw','util','moment','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','../../config/environment','jayson/promise','client','http','request','then','info','FaxApplication,\x20%s,\x20%s','request\x20sent','debug','stringify','error','code','message','catch'];(function(_0xefbf92,_0x44b570){var _0x29fad9=function(_0x3e0104){while(--_0x3e0104){_0xefbf92['push'](_0xefbf92['shift']());}};_0x29fad9(++_0x44b570);}(_0x33c5,0xe6));var _0x533c=function(_0x147c96,_0x309657){_0x147c96=_0x147c96-0x0;var _0x4ec711=_0x33c5[_0x147c96];return _0x4ec711;};'use strict';var _=require('lodash');var util=require(_0x533c('0x0'));var moment=require(_0x533c('0x1'));var BPromise=require('bluebird');var rs=require(_0x533c('0x2'));var fs=require('fs');var Redis=require(_0x533c('0x3'));var db=require(_0x533c('0x4'))['db'];var utils=require(_0x533c('0x5'));var logger=require(_0x533c('0x6'))('rpc');var config=require(_0x533c('0x7'));var jayson=require(_0x533c('0x8'));var client=jayson[_0x533c('0x9')][_0x533c('0xa')]({'port':0x232a});function respondWithRpcPromise(_0x34ca89,_0x1699d5,_0x3a009b){return new BPromise(function(_0x36d74e,_0x2c297c){return client[_0x533c('0xb')](_0x34ca89,_0x3a009b)[_0x533c('0xc')](function(_0x46536d){logger[_0x533c('0xd')](_0x533c('0xe'),_0x1699d5,_0x533c('0xf'));logger[_0x533c('0x10')]('FaxApplication,\x20%s,\x20%s,\x20%s',_0x1699d5,_0x533c('0xf'),JSON[_0x533c('0x11')](_0x46536d));if(_0x46536d[_0x533c('0x12')]){if(_0x46536d[_0x533c('0x12')][_0x533c('0x13')]===0x1f4){logger[_0x533c('0x12')]('FaxApplication,\x20%s,\x20%s',_0x1699d5,_0x46536d[_0x533c('0x12')][_0x533c('0x14')]);return _0x2c297c(_0x46536d[_0x533c('0x12')][_0x533c('0x14')]);}logger[_0x533c('0x12')](_0x533c('0xe'),_0x1699d5,_0x46536d[_0x533c('0x12')][_0x533c('0x14')]);return _0x36d74e(_0x46536d['error'][_0x533c('0x14')]);}else{logger[_0x533c('0xd')](_0x533c('0xe'),_0x1699d5,_0x533c('0xf'));_0x36d74e(_0x46536d['result'][_0x533c('0x14')]);}})[_0x533c('0x15')](function(_0x41e22c){logger[_0x533c('0x12')](_0x533c('0xe'),_0x1699d5,_0x41e22c);_0x2c297c(_0x41e22c);});});}exports[_0x533c('0x16')]=function(_0x1f0a72){var _0x35bfd3=this;return new Promise(function(_0x1f9f85,_0x12e126){return db[_0x533c('0x17')][_0x533c('0x18')](_0x1f0a72[_0x533c('0x19')],{'raw':_0x1f0a72[_0x533c('0x1a')]?_0x1f0a72[_0x533c('0x1a')][_0x533c('0x1b')]===undefined?!![]:![]:!![],'individualHooks':!![],'where':_0x1f0a72[_0x533c('0x1a')]?_0x1f0a72[_0x533c('0x1a')]['where']||null:null,'attributes':_0x1f0a72[_0x533c('0x1a')]?_0x1f0a72['options']['attributes']||null:null,'limit':_0x1f0a72[_0x533c('0x1a')]?_0x1f0a72[_0x533c('0x1a')]['limit']||null:null})[_0x533c('0xc')](function(_0x37651e){logger[_0x533c('0xd')](_0x533c('0x16'),_0x1f0a72);logger['debug'](_0x533c('0x16'),_0x1f0a72,JSON[_0x533c('0x11')](_0x37651e));_0x1f9f85(_0x37651e);})[_0x533c('0x15')](function(_0x107a97){logger[_0x533c('0x12')](_0x533c('0x16'),_0x107a97[_0x533c('0x14')],_0x1f0a72);_0x12e126(_0x35bfd3[_0x533c('0x12')](0x1f4,_0x107a97[_0x533c('0x14')]));});});}; \ No newline at end of file diff --git a/server/api/faxApplication/index.js b/server/api/faxApplication/index.js index 0d37396..83657b2 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 _0xea28=['util','path','connect-timeout','express','Router','fs-extra','../../components/auth/service','../../config/environment','./faxApplication.controller','get','index','/:id','isAuthenticated','show','post','create','put','update','destroy','exports','multer'];(function(_0x122ef9,_0x451d2a){var _0x42fba0=function(_0x17c9d3){while(--_0x17c9d3){_0x122ef9['push'](_0x122ef9['shift']());}};_0x42fba0(++_0x451d2a);}(_0xea28,0x13a));var _0x8ea2=function(_0x2a5394,_0x28e4d7){_0x2a5394=_0x2a5394-0x0;var _0x30acd1=_0xea28[_0x2a5394];return _0x30acd1;};'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('0xf')]('/',auth[_0x8ea2('0xd')](),controller[_0x8ea2('0x10')]);router[_0x8ea2('0x11')](_0x8ea2('0xc'),auth[_0x8ea2('0xd')](),controller[_0x8ea2('0x12')]);router['delete']('/:id',auth[_0x8ea2('0xd')](),controller[_0x8ea2('0x13')]);module[_0x8ea2('0x14')]=router; \ No newline at end of file +var _0xd8b0=['update','delete','destroy','multer','util','Router','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','isAuthenticated','index','get','show','create','put','/:id'];(function(_0x2e19ac,_0x5ee48a){var _0x29d578=function(_0x436f90){while(--_0x436f90){_0x2e19ac['push'](_0x2e19ac['shift']());}};_0x29d578(++_0x5ee48a);}(_0xd8b0,0xad));var _0x0d8b=function(_0x20a584,_0xe384a5){_0x20a584=_0x20a584-0x0;var _0x4b41a8=_0xd8b0[_0x20a584];return _0x4b41a8;};'use strict';var multer=require(_0x0d8b('0x0'));var util=require(_0x0d8b('0x1'));var path=require('path');var timeout=require('connect-timeout');var express=require('express');var router=express[_0x0d8b('0x2')]();var fs_extra=require(_0x0d8b('0x3'));var auth=require(_0x0d8b('0x4'));var interaction=require(_0x0d8b('0x5'));var config=require(_0x0d8b('0x6'));var controller=require('./faxApplication.controller');router['get']('/',auth[_0x0d8b('0x7')](),controller[_0x0d8b('0x8')]);router[_0x0d8b('0x9')]('/:id',auth[_0x0d8b('0x7')](),controller[_0x0d8b('0xa')]);router['post']('/',auth[_0x0d8b('0x7')](),controller[_0x0d8b('0xb')]);router[_0x0d8b('0xc')](_0x0d8b('0xd'),auth[_0x0d8b('0x7')](),controller[_0x0d8b('0xe')]);router[_0x0d8b('0xf')](_0x0d8b('0xd'),auth['isAuthenticated'](),controller[_0x0d8b('0x10')]);module['exports']=router; \ No newline at end of file diff --git a/server/api/faxInteraction/faxInteraction.attributes.js b/server/api/faxInteraction/faxInteraction.attributes.js index 219d283..fed75f2 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 _0x9536=['INTEGER','sequelize','exports','BOOLEAN','DATE','STRING','ENUM','out'];(function(_0x20a584,_0xe384a5){var _0x4b41a8=function(_0x2127c6){while(--_0x2127c6){_0x20a584['push'](_0x20a584['shift']());}};_0x4b41a8(++_0xe384a5);}(_0x9536,0x179));var _0x6953=function(_0x4ec9e3,_0x15fbf4){_0x4ec9e3=_0x4ec9e3-0x0;var _0x2883ce=_0x9536[_0x4ec9e3];return _0x2883ce;};'use strict';var Sequelize=require(_0x6953('0x0'));module[_0x6953('0x1')]={'closed':{'type':Sequelize[_0x6953('0x2')],'defaultValue':![]},'closedAt':{'type':Sequelize[_0x6953('0x3')]},'disposition':{'type':Sequelize['STRING']},'secondDisposition':{'type':Sequelize[_0x6953('0x4')]},'thirdDisposition':{'type':Sequelize['STRING']},'note':{'type':Sequelize[_0x6953('0x4')]},'read1stAt':{'type':Sequelize[_0x6953('0x3')]},'fax':{'type':Sequelize[_0x6953('0x4')]},'firstMsgDirection':{'type':Sequelize[_0x6953('0x5')]('in',_0x6953('0x6')),'defaultValue':'in','allowNull':![]},'lastMsgAt':{'type':Sequelize['DATE']},'lastMsgDirection':{'type':Sequelize[_0x6953('0x5')]('in',_0x6953('0x6')),'defaultValue':'in','allowNull':![]},'queueId':{'type':Sequelize[_0x6953('0x7')]}}; \ No newline at end of file +var _0xd4a2=['DATE','STRING','ENUM','out','INTEGER','sequelize'];(function(_0xabce8f,_0x2507b7){var _0x46d377=function(_0x4e1454){while(--_0x4e1454){_0xabce8f['push'](_0xabce8f['shift']());}};_0x46d377(++_0x2507b7);}(_0xd4a2,0x173));var _0x2d4a=function(_0x31873c,_0x1262cd){_0x31873c=_0x31873c-0x0;var _0x5b2656=_0xd4a2[_0x31873c];return _0x5b2656;};'use strict';var Sequelize=require(_0x2d4a('0x0'));module['exports']={'closed':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'closedAt':{'type':Sequelize[_0x2d4a('0x1')]},'disposition':{'type':Sequelize['STRING']},'secondDisposition':{'type':Sequelize[_0x2d4a('0x2')]},'thirdDisposition':{'type':Sequelize['STRING']},'note':{'type':Sequelize[_0x2d4a('0x2')]},'read1stAt':{'type':Sequelize['DATE']},'fax':{'type':Sequelize[_0x2d4a('0x2')]},'firstMsgDirection':{'type':Sequelize[_0x2d4a('0x3')]('in',_0x2d4a('0x4')),'defaultValue':'in','allowNull':![]},'lastMsgAt':{'type':Sequelize[_0x2d4a('0x1')]},'lastMsgDirection':{'type':Sequelize[_0x2d4a('0x3')]('in','out'),'defaultValue':'in','allowNull':![]},'queueId':{'type':Sequelize[_0x2d4a('0x5')]}}; \ No newline at end of file diff --git a/server/api/faxInteraction/faxInteraction.controller.js b/server/api/faxInteraction/faxInteraction.controller.js index bb8af9b..e7eaed3 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 _0x6cda=['json','offset','undefined','limit','count','set','Content-Range','update','then','destroy','sendStatus','error','stack','name','send','index','map','FaxInteraction','rawAttributes','type','findAll','fax','user','show','params','model','keys','query','intersection','attributes','fields','length','include','merge','options','find','create','catch','body','describe','addMessage','ids','getMessages','findOne','FaxMessage','filters','hasOwnProperty','order','sort','where','pick','FaxInteractionId','filter','$gte','split','format','YYYY-MM-DD\x20HH:mm:ss','includeAll','Tag','emit','faxInteractionTags:save','removeTags','download','unix','toString','join','root','server','files','tmp','attachments','push','Attachment','Messages','createdAt','get','basename','existsSync','pipe','createWriteStream','log','err','unlinkSync','rimraf','zip-dir','bluebird','util','path','lodash','ioredis','../../components/interaction/service','../../components/parsers/qs','../../config/environment','../../mysqldb','redis','defaults','socket.io-emitter','./faxInteraction.socket','register','status','end'];(function(_0x5d4607,_0x6b5e7b){var _0x5e4a86=function(_0x46891a){while(--_0x46891a){_0x5d4607['push'](_0x5d4607['shift']());}};_0x5e4a86(++_0x6b5e7b);}(_0x6cda,0xb8));var _0xa6cd=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0x6cda[_0x3dd15e];return _0x231fd0;};'use strict';var rimraf=require(_0xa6cd('0x0'));var zipdir=require(_0xa6cd('0x1'));var moment=require('moment');var BPromise=require(_0xa6cd('0x2'));var util=require(_0xa6cd('0x3'));var path=require(_0xa6cd('0x4'));var fs=require('fs');var _=require(_0xa6cd('0x5'));var Redis=require(_0xa6cd('0x6'));var interaction=require(_0xa6cd('0x7'));var qs=require(_0xa6cd('0x8'));var logger=require('../../config/logger')('api');var config=require(_0xa6cd('0x9'));var db=require(_0xa6cd('0xa'))['db'];config[_0xa6cd('0xb')]=_[_0xa6cd('0xc')](config[_0xa6cd('0xb')],{'host':'localhost','port':0x18eb});var socket=require(_0xa6cd('0xd'))(new Redis(config[_0xa6cd('0xb')]));require(_0xa6cd('0xe'))[_0xa6cd('0xf')](socket);function respondWithStatusCode(_0x3ce7cd,_0x3775a6){_0x3775a6=_0x3775a6||0xcc;return function(_0x523a98){if(_0x523a98){return _0x3ce7cd['sendStatus'](_0x3775a6);}return _0x3ce7cd[_0xa6cd('0x10')](_0x3775a6)[_0xa6cd('0x11')]();};}function respondWithResult(_0x1c5d7e,_0x5ad83b){_0x5ad83b=_0x5ad83b||0xc8;return function(_0x5b09ac){if(_0x5b09ac){return _0x1c5d7e[_0xa6cd('0x10')](_0x5ad83b)[_0xa6cd('0x12')](_0x5b09ac);}};}function respondWithFilteredResult(_0x5a6f4e,_0x421c3f){return function(_0x8c3cd6){if(_0x8c3cd6){var _0x1ec6d6=typeof _0x421c3f[_0xa6cd('0x13')]===_0xa6cd('0x14')&&typeof _0x421c3f[_0xa6cd('0x15')]===_0xa6cd('0x14');var _0x483450=_0x8c3cd6[_0xa6cd('0x16')];var _0x434dc3=_0x1ec6d6?0x0:_0x421c3f[_0xa6cd('0x13')];var _0x33dedf=_0x1ec6d6?_0x8c3cd6[_0xa6cd('0x16')]:_0x421c3f[_0xa6cd('0x13')]+_0x421c3f[_0xa6cd('0x15')];var _0x46b235;if(_0x33dedf>=_0x483450){_0x33dedf=_0x483450;_0x46b235=0xc8;}else{_0x46b235=0xce;}_0x5a6f4e[_0xa6cd('0x10')](_0x46b235);return _0x5a6f4e[_0xa6cd('0x17')](_0xa6cd('0x18'),_0x434dc3+'-'+_0x33dedf+'/'+_0x483450)[_0xa6cd('0x12')](_0x8c3cd6);}return null;};}function saveUpdates(_0x233909){return function(_0x258909){if(_0x258909){return _0x258909[_0xa6cd('0x19')](_0x233909)[_0xa6cd('0x1a')](function(_0x20d004){return _0x20d004;});}return null;};}function removeEntity(_0x5afd5){return function(_0x27ff10){if(_0x27ff10){return _0x27ff10[_0xa6cd('0x1b')]()[_0xa6cd('0x1a')](function(){_0x5afd5['status'](0xcc)[_0xa6cd('0x11')]();});}};}function handleEntityNotFound(_0x255197){return function(_0x8a4706){if(!_0x8a4706){_0x255197[_0xa6cd('0x1c')](0x194);}return _0x8a4706;};}function handleError(_0x410150,_0x3db56b){_0x3db56b=_0x3db56b||0x1f4;return function(_0x3601cb){logger[_0xa6cd('0x1d')](_0x3601cb[_0xa6cd('0x1e')]);if(_0x3601cb[_0xa6cd('0x1f')]){delete _0x3601cb[_0xa6cd('0x1f')];}_0x410150[_0xa6cd('0x10')](_0x3db56b)[_0xa6cd('0x20')](_0x3601cb);};}exports[_0xa6cd('0x21')]=function(_0xbfdb33,_0x283c6b){var _0x1d6a20={};var _0x43c417=_[_0xa6cd('0x22')](db[_0xa6cd('0x23')][_0xa6cd('0x24')],function(_0x2f4706){return{'name':_0x2f4706['fieldName'],'type':_0x2f4706[_0xa6cd('0x25')]['key']};});_0x1d6a20=qs['getOptions'](_0x43c417,_0xbfdb33);return interaction[_0xa6cd('0x26')](_0xa6cd('0x27'),_0xbfdb33['query'],_0xbfdb33[_0xa6cd('0x28')],_0x1d6a20,_0x43c417)[_0xa6cd('0x1a')](respondWithFilteredResult(_0x283c6b,_0x1d6a20))['catch'](handleError(_0x283c6b,null));};exports[_0xa6cd('0x29')]=function(_0x145e10,_0x3188dc){var _0x2dfcec={'raw':![],'where':{'id':_0x145e10[_0xa6cd('0x2a')]['id']}},_0x501148={};_0x501148[_0xa6cd('0x2b')]=_[_0xa6cd('0x2c')](db['FaxInteraction'][_0xa6cd('0x24')]);_0x501148[_0xa6cd('0x2d')]=_['keys'](_0x145e10[_0xa6cd('0x2d')]);_0x501148['filters']=_[_0xa6cd('0x2e')](_0x501148['model'],_0x501148['query']);_0x2dfcec[_0xa6cd('0x2f')]=_[_0xa6cd('0x2e')](_0x501148[_0xa6cd('0x2b')],qs[_0xa6cd('0x30')](_0x145e10[_0xa6cd('0x2d')][_0xa6cd('0x30')]));_0x2dfcec['attributes']=_0x2dfcec[_0xa6cd('0x2f')][_0xa6cd('0x31')]?_0x2dfcec[_0xa6cd('0x2f')]:_0x501148[_0xa6cd('0x2b')];if(_0x145e10[_0xa6cd('0x2d')]['includeAll']){_0x2dfcec[_0xa6cd('0x32')]=[{'all':!![]}];}_0x2dfcec=_[_0xa6cd('0x33')]({},_0x2dfcec,_0x145e10[_0xa6cd('0x34')]);return db[_0xa6cd('0x23')][_0xa6cd('0x35')](_0x2dfcec)[_0xa6cd('0x1a')](handleEntityNotFound(_0x3188dc,null))[_0xa6cd('0x1a')](respondWithResult(_0x3188dc,null))['catch'](handleError(_0x3188dc,null));};exports[_0xa6cd('0x36')]=function(_0x59c8e6,_0x2804f4){return db[_0xa6cd('0x23')]['create'](_0x59c8e6['body'],{})['then'](respondWithResult(_0x2804f4,0xc9))[_0xa6cd('0x37')](handleError(_0x2804f4,null));};exports[_0xa6cd('0x19')]=function(_0x2a6205,_0x49e957){if(_0x2a6205[_0xa6cd('0x38')]['id']){delete _0x2a6205[_0xa6cd('0x38')]['id'];}return db['FaxInteraction']['find']({'where':{'id':_0x2a6205[_0xa6cd('0x2a')]['id']}})['then'](handleEntityNotFound(_0x49e957,null))['then'](saveUpdates(_0x2a6205['body'],null))['then'](respondWithResult(_0x49e957,null))[_0xa6cd('0x37')](handleError(_0x49e957,null));};exports['destroy']=function(_0x1a0d10,_0x233dc1){return db[_0xa6cd('0x23')][_0xa6cd('0x35')]({'where':{'id':_0x1a0d10[_0xa6cd('0x2a')]['id']}})[_0xa6cd('0x1a')](handleEntityNotFound(_0x233dc1,null))[_0xa6cd('0x1a')](removeEntity(_0x233dc1,null))[_0xa6cd('0x37')](handleError(_0x233dc1,null));};exports['describe']=function(_0x75d304,_0x4bd716){return db['FaxInteraction'][_0xa6cd('0x39')]()[_0xa6cd('0x1a')](respondWithResult(_0x4bd716,null))[_0xa6cd('0x37')](handleError(_0x4bd716,null));};exports[_0xa6cd('0x3a')]=function(_0x186edb,_0x1f6576){return db['FaxMessage']['find']({'where':{'id':_0x186edb[_0xa6cd('0x2a')]['id']}})[_0xa6cd('0x1a')](handleEntityNotFound(_0x1f6576,null))[_0xa6cd('0x1a')](function(_0x29be43){if(_0x29be43){return _0x29be43[_0xa6cd('0x3a')](_0x186edb[_0xa6cd('0x38')][_0xa6cd('0x3b')],_['omit'](_0x186edb['body'],[_0xa6cd('0x3b'),'id'])||{});}})[_0xa6cd('0x1a')](respondWithResult(_0x1f6576,null))[_0xa6cd('0x37')](handleError(_0x1f6576,null));};exports[_0xa6cd('0x3c')]=function(_0x5634f1,_0x193a77){var _0x1132db={'raw':![],'where':{}};var _0x3d2c15={};var _0xbf39e6={'count':0x0,'rows':[]};return db[_0xa6cd('0x23')][_0xa6cd('0x3d')]({'where':{'id':_0x5634f1[_0xa6cd('0x2a')]['id']}})[_0xa6cd('0x1a')](handleEntityNotFound(_0x193a77,null))[_0xa6cd('0x1a')](function(_0x20a258){if(_0x20a258){_0x3d2c15[_0xa6cd('0x2b')]=_[_0xa6cd('0x2c')](db[_0xa6cd('0x3e')][_0xa6cd('0x24')]);_0x3d2c15[_0xa6cd('0x2d')]=_['keys'](_0x5634f1[_0xa6cd('0x2d')]);_0x3d2c15[_0xa6cd('0x3f')]=_[_0xa6cd('0x2e')](_0x3d2c15[_0xa6cd('0x2b')],_0x3d2c15[_0xa6cd('0x2d')]);_0x1132db[_0xa6cd('0x2f')]=_[_0xa6cd('0x2e')](_0x3d2c15[_0xa6cd('0x2b')],qs[_0xa6cd('0x30')](_0x5634f1[_0xa6cd('0x2d')]['fields']));_0x1132db[_0xa6cd('0x2f')]=_0x1132db['attributes']['length']?_0x1132db['attributes']:_0x3d2c15['model'];if(!_0x5634f1[_0xa6cd('0x2d')][_0xa6cd('0x40')]('nolimit')){_0x1132db['limit']=qs[_0xa6cd('0x15')](_0x5634f1['query']['limit']);_0x1132db[_0xa6cd('0x13')]=qs[_0xa6cd('0x13')](_0x5634f1['query'][_0xa6cd('0x13')]);}_0x1132db[_0xa6cd('0x41')]=qs[_0xa6cd('0x42')](_0x5634f1[_0xa6cd('0x2d')][_0xa6cd('0x42')]);_0x1132db[_0xa6cd('0x43')]=qs[_0xa6cd('0x3f')](_[_0xa6cd('0x44')](_0x5634f1[_0xa6cd('0x2d')],_0x3d2c15['filters']));_0x1132db[_0xa6cd('0x43')][_0xa6cd('0x45')]=_0x20a258['id'];if(_0x5634f1[_0xa6cd('0x2d')]['filter']){_0x1132db['where']=_[_0xa6cd('0x33')](_0x1132db['where'],{'$or':_['map'](_0x1132db[_0xa6cd('0x2f')],function(_0x1db962){var _0x8c37f7={};_0x8c37f7[_0x1db962]={'$like':'%'+_0x5634f1['query'][_0xa6cd('0x46')]+'%'};return _0x8c37f7;})});}if(_0x5634f1[_0xa6cd('0x2d')][_0xa6cd('0x47')]){var _0xefbb23=_0x5634f1[_0xa6cd('0x2d')][_0xa6cd('0x47')][_0xa6cd('0x48')](',');var _0x46071d={};_0x46071d[_0xefbb23[0x0]]={'$gte':moment(_0xefbb23[0x1])[_0xa6cd('0x49')](_0xa6cd('0x4a'))};_0x1132db['where']=_[_0xa6cd('0x33')](_0x1132db['where'],_0x46071d);}_0x1132db=_['merge']({},_0x1132db,_0x5634f1[_0xa6cd('0x34')]);return db[_0xa6cd('0x3e')][_0xa6cd('0x16')]({'where':_0x1132db[_0xa6cd('0x43')]})[_0xa6cd('0x1a')](function(_0x4f484d){_0xbf39e6['count']=_0x4f484d;if(_0x5634f1['query'][_0xa6cd('0x4b')]){_0x1132db[_0xa6cd('0x32')]=[{'all':!![]}];}return db[_0xa6cd('0x3e')][_0xa6cd('0x26')](_0x1132db);})[_0xa6cd('0x1a')](function(_0x59874d){_0xbf39e6['rows']=_0x59874d;return _0xbf39e6;});}})[_0xa6cd('0x1a')](respondWithFilteredResult(_0x193a77,_0x1132db))[_0xa6cd('0x37')](handleError(_0x193a77,null));};exports['addTags']=function(_0x3b8969,_0xf63be7){return db[_0xa6cd('0x23')][_0xa6cd('0x35')]({'where':{'id':_0x3b8969['params']['id']}})[_0xa6cd('0x1a')](handleEntityNotFound(_0xf63be7,null))['then'](function(_0x9ebc3c){if(_0x9ebc3c){return _0x9ebc3c['setTags'](_0x3b8969[_0xa6cd('0x38')][_0xa6cd('0x3b')],_['omit'](_0x3b8969['body'],[_0xa6cd('0x3b'),'id'])||{})['spread'](function(){return db[_0xa6cd('0x4c')][_0xa6cd('0x26')]({'attributes':['id','name','color'],'where':{'id':_0x3b8969['body'][_0xa6cd('0x3b')]}});})[_0xa6cd('0x1a')](function(_0x5d0efa){socket[_0xa6cd('0x4d')](_0xa6cd('0x4e'),{'id':Number(_0x3b8969['params']['id']),'tags':_0x5d0efa||[]});return{'id':Number(_0x3b8969['params']['id']),'tags':_0x5d0efa||[]};});}})[_0xa6cd('0x1a')](respondWithResult(_0xf63be7,null))[_0xa6cd('0x37')](handleError(_0xf63be7,null));};exports['removeTags']=function(_0x11f363,_0x1d7057){return db[_0xa6cd('0x23')][_0xa6cd('0x35')]({'where':{'id':_0x11f363[_0xa6cd('0x2a')]['id']}})[_0xa6cd('0x1a')](handleEntityNotFound(_0x1d7057,null))['then'](function(_0x16c030){if(_0x16c030){return _0x16c030[_0xa6cd('0x4f')](_0x11f363[_0xa6cd('0x2d')]['ids']);}})[_0xa6cd('0x1a')](respondWithStatusCode(_0x1d7057,null))[_0xa6cd('0x37')](handleError(_0x1d7057,null));};exports[_0xa6cd('0x50')]=function(_0x38fbd7,_0x12a864){var _0x3ae6bd=moment()[_0xa6cd('0x51')]()[_0xa6cd('0x52')]();var _0x14711e=path[_0xa6cd('0x53')](config[_0xa6cd('0x54')],_0xa6cd('0x55'),_0xa6cd('0x56'),_0xa6cd('0x57'));var _0x296c9a=path[_0xa6cd('0x53')](config[_0xa6cd('0x54')],'server',_0xa6cd('0x56'),_0xa6cd('0x58'));var _0x1a7338=path[_0xa6cd('0x53')](_0x14711e,_0x3ae6bd);var _0x4ba672=util[_0xa6cd('0x49')]('transcript-%d-%s.zip',_0x38fbd7[_0xa6cd('0x2a')]['id'],_0x3ae6bd);var _0xc35bb3=path[_0xa6cd('0x53')](_0x14711e,_0x4ba672);var _0x395604=[];_0x395604[_0xa6cd('0x59')]({'model':db['Attachment'],'as':_0xa6cd('0x5a'),'raw':!![]});var _0x14dbee=[{'model':db[_0xa6cd('0x3e')],'as':_0xa6cd('0x5b'),'attributes':['id','body',_0xa6cd('0x5c')],'include':_0x395604}];return db[_0xa6cd('0x23')][_0xa6cd('0x35')]({'where':{'id':_0x38fbd7[_0xa6cd('0x2a')]['id']},'include':_0x14dbee})[_0xa6cd('0x1a')](handleEntityNotFound(_0x12a864,null))[_0xa6cd('0x1a')](function(_0x34e45b){if(_0x34e45b&&_0x34e45b[_0xa6cd('0x5b')]){var _0x1058b2=_0x34e45b[_0xa6cd('0x5d')]({'plain':!![]});fs['mkdirSync'](_0x1a7338);for(var _0x4b7891=0x0;_0x4b7891<_0x1058b2[_0xa6cd('0x5b')]['length'];_0x4b7891++){var _0x504dd1=_0x1058b2['Messages'][_0x4b7891][_0xa6cd('0x5a')];if(_0x504dd1){var _0x4c4dd6=path['join'](_0x296c9a,_0x504dd1[_0xa6cd('0x5e')]);if(fs[_0xa6cd('0x5f')](_0x4c4dd6)){fs['createReadStream'](_0x4c4dd6)[_0xa6cd('0x60')](fs[_0xa6cd('0x61')](path[_0xa6cd('0x53')](_0x1a7338,_0x504dd1[_0xa6cd('0x5e')])));}}}return BPromise['resolve']()[_0xa6cd('0x1a')](function(){return new BPromise(function(_0x34c475,_0x42fd1c){zipdir(_0x1a7338,{'saveTo':_0xc35bb3},function(_0x528c33,_0x400097){if(_0x528c33)return _0x42fd1c(_0x528c33);return _0x34c475(_0x400097);});})[_0xa6cd('0x1a')](function(){return new BPromise(function(_0x23f420,_0x363f5a){rimraf(_0x1a7338,function(_0x29cc55){if(_0x29cc55)_0x363f5a(_0x29cc55);return _0x23f420();});});})[_0xa6cd('0x1a')](function(){return _0x12a864['download'](_0xc35bb3,_0x4ba672,function(_0x21fb83){if(_0x21fb83){console[_0xa6cd('0x62')](_0xa6cd('0x63'),_0x21fb83);}else{fs[_0xa6cd('0x64')](_0xc35bb3);}});});});}else{return _0x12a864[_0xa6cd('0x1c')](0xc8);}})[_0xa6cd('0x37')](handleError(_0x12a864,null));}; \ No newline at end of file +var _0x9514=['push','Attachment','Messages','createdAt','get','mkdirSync','basename','existsSync','createReadStream','createWriteStream','log','err','rimraf','zip-dir','moment','lodash','ioredis','../../components/interaction/service','../../components/parsers/qs','api','../../mysqldb','redis','defaults','socket.io-emitter','./faxInteraction.socket','register','sendStatus','end','offset','limit','undefined','count','status','Content-Range','json','update','then','destroy','stack','name','index','map','FaxInteraction','fieldName','type','user','catch','show','params','model','keys','rawAttributes','query','filters','intersection','fields','attributes','includeAll','include','merge','options','find','create','body','describe','addMessage','FaxMessage','ids','getMessages','length','nolimit','order','sort','where','pick','filter','$gte','split','format','addTags','omit','spread','Tag','color','removeTags','download','unix','join','root','server','files','attachments'];(function(_0xb52f03,_0x21bf27){var _0x53d543=function(_0xfcf410){while(--_0xfcf410){_0xb52f03['push'](_0xb52f03['shift']());}};_0x53d543(++_0x21bf27);}(_0x9514,0x68));var _0x4951=function(_0x128eae,_0x5880c6){_0x128eae=_0x128eae-0x0;var _0x47b9a4=_0x9514[_0x128eae];return _0x47b9a4;};'use strict';var rimraf=require(_0x4951('0x0'));var zipdir=require(_0x4951('0x1'));var moment=require(_0x4951('0x2'));var BPromise=require('bluebird');var util=require('util');var path=require('path');var fs=require('fs');var _=require(_0x4951('0x3'));var Redis=require(_0x4951('0x4'));var interaction=require(_0x4951('0x5'));var qs=require(_0x4951('0x6'));var logger=require('../../config/logger')(_0x4951('0x7'));var config=require('../../config/environment');var db=require(_0x4951('0x8'))['db'];config[_0x4951('0x9')]=_[_0x4951('0xa')](config[_0x4951('0x9')],{'host':'localhost','port':0x18eb});var socket=require(_0x4951('0xb'))(new Redis(config[_0x4951('0x9')]));require(_0x4951('0xc'))[_0x4951('0xd')](socket);function respondWithStatusCode(_0x30b77d,_0x51d6d5){_0x51d6d5=_0x51d6d5||0xcc;return function(_0x2141f8){if(_0x2141f8){return _0x30b77d[_0x4951('0xe')](_0x51d6d5);}return _0x30b77d['status'](_0x51d6d5)[_0x4951('0xf')]();};}function respondWithResult(_0x59650a,_0x58fbd0){_0x58fbd0=_0x58fbd0||0xc8;return function(_0x2606e9){if(_0x2606e9){return _0x59650a['status'](_0x58fbd0)['json'](_0x2606e9);}};}function respondWithFilteredResult(_0x466352,_0x1eb546){return function(_0x302a1e){if(_0x302a1e){var _0x5a260b=typeof _0x1eb546[_0x4951('0x10')]==='undefined'&&typeof _0x1eb546[_0x4951('0x11')]===_0x4951('0x12');var _0x4e5bd7=_0x302a1e[_0x4951('0x13')];var _0x298d35=_0x5a260b?0x0:_0x1eb546[_0x4951('0x10')];var _0x225817=_0x5a260b?_0x302a1e[_0x4951('0x13')]:_0x1eb546['offset']+_0x1eb546[_0x4951('0x11')];var _0x45eb25;if(_0x225817>=_0x4e5bd7){_0x225817=_0x4e5bd7;_0x45eb25=0xc8;}else{_0x45eb25=0xce;}_0x466352[_0x4951('0x14')](_0x45eb25);return _0x466352['set'](_0x4951('0x15'),_0x298d35+'-'+_0x225817+'/'+_0x4e5bd7)[_0x4951('0x16')](_0x302a1e);}return null;};}function saveUpdates(_0xe382c){return function(_0x43f316){if(_0x43f316){return _0x43f316[_0x4951('0x17')](_0xe382c)[_0x4951('0x18')](function(_0x161b73){return _0x161b73;});}return null;};}function removeEntity(_0x15708f){return function(_0x2edb50){if(_0x2edb50){return _0x2edb50[_0x4951('0x19')]()[_0x4951('0x18')](function(){_0x15708f[_0x4951('0x14')](0xcc)['end']();});}};}function handleEntityNotFound(_0x1ce7d9){return function(_0x35463b){if(!_0x35463b){_0x1ce7d9['sendStatus'](0x194);}return _0x35463b;};}function handleError(_0x2ccaa4,_0x1c7dc3){_0x1c7dc3=_0x1c7dc3||0x1f4;return function(_0x17429a){logger['error'](_0x17429a[_0x4951('0x1a')]);if(_0x17429a[_0x4951('0x1b')]){delete _0x17429a['name'];}_0x2ccaa4['status'](_0x1c7dc3)['send'](_0x17429a);};}exports[_0x4951('0x1c')]=function(_0x2547ef,_0x2a9689){var _0x298a21={};var _0x4b5381=_[_0x4951('0x1d')](db[_0x4951('0x1e')]['rawAttributes'],function(_0x4d65c1){return{'name':_0x4d65c1[_0x4951('0x1f')],'type':_0x4d65c1[_0x4951('0x20')]['key']};});_0x298a21=qs['getOptions'](_0x4b5381,_0x2547ef);return interaction['findAll']('fax',_0x2547ef['query'],_0x2547ef[_0x4951('0x21')],_0x298a21,_0x4b5381)[_0x4951('0x18')](respondWithFilteredResult(_0x2a9689,_0x298a21))[_0x4951('0x22')](handleError(_0x2a9689,null));};exports[_0x4951('0x23')]=function(_0x56cb8c,_0x14a401){var _0x5a08f8={'raw':![],'where':{'id':_0x56cb8c[_0x4951('0x24')]['id']}},_0x2946da={};_0x2946da[_0x4951('0x25')]=_[_0x4951('0x26')](db['FaxInteraction'][_0x4951('0x27')]);_0x2946da[_0x4951('0x28')]=_[_0x4951('0x26')](_0x56cb8c[_0x4951('0x28')]);_0x2946da[_0x4951('0x29')]=_[_0x4951('0x2a')](_0x2946da[_0x4951('0x25')],_0x2946da[_0x4951('0x28')]);_0x5a08f8['attributes']=_[_0x4951('0x2a')](_0x2946da[_0x4951('0x25')],qs[_0x4951('0x2b')](_0x56cb8c[_0x4951('0x28')][_0x4951('0x2b')]));_0x5a08f8['attributes']=_0x5a08f8[_0x4951('0x2c')]['length']?_0x5a08f8[_0x4951('0x2c')]:_0x2946da['model'];if(_0x56cb8c[_0x4951('0x28')][_0x4951('0x2d')]){_0x5a08f8[_0x4951('0x2e')]=[{'all':!![]}];}_0x5a08f8=_[_0x4951('0x2f')]({},_0x5a08f8,_0x56cb8c[_0x4951('0x30')]);return db[_0x4951('0x1e')][_0x4951('0x31')](_0x5a08f8)[_0x4951('0x18')](handleEntityNotFound(_0x14a401,null))['then'](respondWithResult(_0x14a401,null))[_0x4951('0x22')](handleError(_0x14a401,null));};exports[_0x4951('0x32')]=function(_0x552759,_0x117205){return db[_0x4951('0x1e')][_0x4951('0x32')](_0x552759[_0x4951('0x33')],{})[_0x4951('0x18')](respondWithResult(_0x117205,0xc9))[_0x4951('0x22')](handleError(_0x117205,null));};exports['update']=function(_0x574f3a,_0x15585e){if(_0x574f3a['body']['id']){delete _0x574f3a['body']['id'];}return db[_0x4951('0x1e')][_0x4951('0x31')]({'where':{'id':_0x574f3a[_0x4951('0x24')]['id']}})['then'](handleEntityNotFound(_0x15585e,null))[_0x4951('0x18')](saveUpdates(_0x574f3a[_0x4951('0x33')],null))['then'](respondWithResult(_0x15585e,null))[_0x4951('0x22')](handleError(_0x15585e,null));};exports[_0x4951('0x19')]=function(_0x882e24,_0x4f5a6a){return db['FaxInteraction'][_0x4951('0x31')]({'where':{'id':_0x882e24['params']['id']}})[_0x4951('0x18')](handleEntityNotFound(_0x4f5a6a,null))[_0x4951('0x18')](removeEntity(_0x4f5a6a,null))[_0x4951('0x22')](handleError(_0x4f5a6a,null));};exports[_0x4951('0x34')]=function(_0x2ba7e5,_0x1a4a3a){return db['FaxInteraction'][_0x4951('0x34')]()[_0x4951('0x18')](respondWithResult(_0x1a4a3a,null))['catch'](handleError(_0x1a4a3a,null));};exports[_0x4951('0x35')]=function(_0x53170b,_0x25ec37){return db[_0x4951('0x36')][_0x4951('0x31')]({'where':{'id':_0x53170b['params']['id']}})[_0x4951('0x18')](handleEntityNotFound(_0x25ec37,null))[_0x4951('0x18')](function(_0x331105){if(_0x331105){return _0x331105['addMessage'](_0x53170b[_0x4951('0x33')][_0x4951('0x37')],_['omit'](_0x53170b[_0x4951('0x33')],[_0x4951('0x37'),'id'])||{});}})['then'](respondWithResult(_0x25ec37,null))[_0x4951('0x22')](handleError(_0x25ec37,null));};exports[_0x4951('0x38')]=function(_0x8eb1f3,_0xf0e572){var _0x1775ad={'raw':![],'where':{}};var _0x2d7a66={};var _0x351842={'count':0x0,'rows':[]};return db[_0x4951('0x1e')]['findOne']({'where':{'id':_0x8eb1f3['params']['id']}})['then'](handleEntityNotFound(_0xf0e572,null))['then'](function(_0x389b0c){if(_0x389b0c){_0x2d7a66[_0x4951('0x25')]=_['keys'](db['FaxMessage'][_0x4951('0x27')]);_0x2d7a66[_0x4951('0x28')]=_['keys'](_0x8eb1f3[_0x4951('0x28')]);_0x2d7a66[_0x4951('0x29')]=_[_0x4951('0x2a')](_0x2d7a66[_0x4951('0x25')],_0x2d7a66[_0x4951('0x28')]);_0x1775ad[_0x4951('0x2c')]=_[_0x4951('0x2a')](_0x2d7a66[_0x4951('0x25')],qs['fields'](_0x8eb1f3['query'][_0x4951('0x2b')]));_0x1775ad[_0x4951('0x2c')]=_0x1775ad[_0x4951('0x2c')][_0x4951('0x39')]?_0x1775ad[_0x4951('0x2c')]:_0x2d7a66[_0x4951('0x25')];if(!_0x8eb1f3[_0x4951('0x28')]['hasOwnProperty'](_0x4951('0x3a'))){_0x1775ad['limit']=qs[_0x4951('0x11')](_0x8eb1f3['query'][_0x4951('0x11')]);_0x1775ad[_0x4951('0x10')]=qs[_0x4951('0x10')](_0x8eb1f3[_0x4951('0x28')][_0x4951('0x10')]);}_0x1775ad[_0x4951('0x3b')]=qs['sort'](_0x8eb1f3[_0x4951('0x28')][_0x4951('0x3c')]);_0x1775ad[_0x4951('0x3d')]=qs[_0x4951('0x29')](_[_0x4951('0x3e')](_0x8eb1f3[_0x4951('0x28')],_0x2d7a66[_0x4951('0x29')]));_0x1775ad['where']['FaxInteractionId']=_0x389b0c['id'];if(_0x8eb1f3[_0x4951('0x28')][_0x4951('0x3f')]){_0x1775ad[_0x4951('0x3d')]=_[_0x4951('0x2f')](_0x1775ad[_0x4951('0x3d')],{'$or':_[_0x4951('0x1d')](_0x1775ad[_0x4951('0x2c')],function(_0x2a1b79){var _0x5454f0={};_0x5454f0[_0x2a1b79]={'$like':'%'+_0x8eb1f3[_0x4951('0x28')][_0x4951('0x3f')]+'%'};return _0x5454f0;})});}if(_0x8eb1f3['query'][_0x4951('0x40')]){var _0x571d02=_0x8eb1f3['query'][_0x4951('0x40')][_0x4951('0x41')](',');var _0x3723ee={};_0x3723ee[_0x571d02[0x0]]={'$gte':moment(_0x571d02[0x1])[_0x4951('0x42')]('YYYY-MM-DD\x20HH:mm:ss')};_0x1775ad[_0x4951('0x3d')]=_[_0x4951('0x2f')](_0x1775ad[_0x4951('0x3d')],_0x3723ee);}_0x1775ad=_[_0x4951('0x2f')]({},_0x1775ad,_0x8eb1f3[_0x4951('0x30')]);return db['FaxMessage'][_0x4951('0x13')]({'where':_0x1775ad[_0x4951('0x3d')]})[_0x4951('0x18')](function(_0x390b12){_0x351842[_0x4951('0x13')]=_0x390b12;if(_0x8eb1f3[_0x4951('0x28')][_0x4951('0x2d')]){_0x1775ad['include']=[{'all':!![]}];}return db[_0x4951('0x36')]['findAll'](_0x1775ad);})['then'](function(_0x115613){_0x351842['rows']=_0x115613;return _0x351842;});}})[_0x4951('0x18')](respondWithFilteredResult(_0xf0e572,_0x1775ad))['catch'](handleError(_0xf0e572,null));};exports[_0x4951('0x43')]=function(_0x253f51,_0x1de035){return db[_0x4951('0x1e')][_0x4951('0x31')]({'where':{'id':_0x253f51[_0x4951('0x24')]['id']}})[_0x4951('0x18')](handleEntityNotFound(_0x1de035,null))[_0x4951('0x18')](function(_0x236173){if(_0x236173){return _0x236173['setTags'](_0x253f51[_0x4951('0x33')]['ids'],_[_0x4951('0x44')](_0x253f51[_0x4951('0x33')],[_0x4951('0x37'),'id'])||{})[_0x4951('0x45')](function(){return db[_0x4951('0x46')]['findAll']({'attributes':['id',_0x4951('0x1b'),_0x4951('0x47')],'where':{'id':_0x253f51['body'][_0x4951('0x37')]}});})[_0x4951('0x18')](function(_0x1301be){socket['emit']('faxInteractionTags:save',{'id':Number(_0x253f51['params']['id']),'tags':_0x1301be||[]});return{'id':Number(_0x253f51['params']['id']),'tags':_0x1301be||[]};});}})[_0x4951('0x18')](respondWithResult(_0x1de035,null))[_0x4951('0x22')](handleError(_0x1de035,null));};exports[_0x4951('0x48')]=function(_0x596546,_0x62d606){return db[_0x4951('0x1e')][_0x4951('0x31')]({'where':{'id':_0x596546[_0x4951('0x24')]['id']}})['then'](handleEntityNotFound(_0x62d606,null))[_0x4951('0x18')](function(_0x195567){if(_0x195567){return _0x195567[_0x4951('0x48')](_0x596546[_0x4951('0x28')][_0x4951('0x37')]);}})[_0x4951('0x18')](respondWithStatusCode(_0x62d606,null))[_0x4951('0x22')](handleError(_0x62d606,null));};exports[_0x4951('0x49')]=function(_0x3bec7b,_0xb4af80){var _0x13aaf9=moment()[_0x4951('0x4a')]()['toString']();var _0x33e780=path[_0x4951('0x4b')](config[_0x4951('0x4c')],_0x4951('0x4d'),_0x4951('0x4e'),'tmp');var _0x4debc2=path[_0x4951('0x4b')](config[_0x4951('0x4c')],_0x4951('0x4d'),'files',_0x4951('0x4f'));var _0x1325e7=path[_0x4951('0x4b')](_0x33e780,_0x13aaf9);var _0x1f6747=util[_0x4951('0x42')]('transcript-%d-%s.zip',_0x3bec7b[_0x4951('0x24')]['id'],_0x13aaf9);var _0x21ce3b=path[_0x4951('0x4b')](_0x33e780,_0x1f6747);var _0xae8986=[];_0xae8986[_0x4951('0x50')]({'model':db['Attachment'],'as':_0x4951('0x51'),'raw':!![]});var _0x32284a=[{'model':db[_0x4951('0x36')],'as':_0x4951('0x52'),'attributes':['id',_0x4951('0x33'),_0x4951('0x53')],'include':_0xae8986}];return db[_0x4951('0x1e')][_0x4951('0x31')]({'where':{'id':_0x3bec7b[_0x4951('0x24')]['id']},'include':_0x32284a})[_0x4951('0x18')](handleEntityNotFound(_0xb4af80,null))[_0x4951('0x18')](function(_0x373c8f){if(_0x373c8f&&_0x373c8f[_0x4951('0x52')]){var _0x13a67f=_0x373c8f[_0x4951('0x54')]({'plain':!![]});fs[_0x4951('0x55')](_0x1325e7);for(var _0x52f239=0x0;_0x52f239<_0x13a67f[_0x4951('0x52')][_0x4951('0x39')];_0x52f239++){var _0x14b5b6=_0x13a67f[_0x4951('0x52')][_0x52f239][_0x4951('0x51')];if(_0x14b5b6){var _0x1f6531=path[_0x4951('0x4b')](_0x4debc2,_0x14b5b6[_0x4951('0x56')]);if(fs[_0x4951('0x57')](_0x1f6531)){fs[_0x4951('0x58')](_0x1f6531)['pipe'](fs[_0x4951('0x59')](path[_0x4951('0x4b')](_0x1325e7,_0x14b5b6[_0x4951('0x56')])));}}}return BPromise['resolve']()['then'](function(){return new BPromise(function(_0x53fba5,_0x42aaf2){zipdir(_0x1325e7,{'saveTo':_0x21ce3b},function(_0x36b677,_0x367f62){if(_0x36b677)return _0x42aaf2(_0x36b677);return _0x53fba5(_0x367f62);});})['then'](function(){return new BPromise(function(_0x5e964b,_0x3a481d){rimraf(_0x1325e7,function(_0x5a3ac6){if(_0x5a3ac6)_0x3a481d(_0x5a3ac6);return _0x5e964b();});});})[_0x4951('0x18')](function(){return _0xb4af80[_0x4951('0x49')](_0x21ce3b,_0x1f6747,function(_0x220623){if(_0x220623){console[_0x4951('0x5a')](_0x4951('0x5b'),_0x220623);}else{fs['unlinkSync'](_0x21ce3b);}});});});}else{return _0xb4af80[_0x4951('0xe')](0xc8);}})['catch'](handleError(_0xb4af80,null));}; \ No newline at end of file diff --git a/server/api/faxInteraction/faxInteraction.events.js b/server/api/faxInteraction/faxInteraction.events.js index d226ebd..283257e 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 _0x6d59=['events','../../mysqldb','FaxInteraction','FaxMessage','update','remove','then','setDataValue','Users','map','length','emit','hasOwnProperty','exports'];(function(_0xd22d95,_0xc59f8f){var _0x15d7a3=function(_0x3db95c){while(--_0x3db95c){_0xd22d95['push'](_0xd22d95['shift']());}};_0x15d7a3(++_0xc59f8f);}(_0x6d59,0x9a));var _0x96d5=function(_0x167cc1,_0x56ef5a){_0x167cc1=_0x167cc1-0x0;var _0x10bc4b=_0x6d59[_0x167cc1];return _0x10bc4b;};'use strict';var EventEmitter=require(_0x96d5('0x0'));var FaxInteraction=require(_0x96d5('0x1'))['db'][_0x96d5('0x2')];var FaxMessage=require(_0x96d5('0x1'))['db'][_0x96d5('0x3')];var FaxInteractionEvents=new EventEmitter();FaxInteractionEvents['setMaxListeners'](0x0);var events={'afterCreate':'save','afterUpdate':_0x96d5('0x4'),'afterDestroy':_0x96d5('0x5')};function emitEvent(_0x1e08f2){return function(_0x3ff954,_0x49c835,_0xf5e076){_0x3ff954['getUsers']({'attributes':['id'],'raw':!![]})[_0x96d5('0x6')](function(_0x1aaa24){_0x3ff954[_0x96d5('0x7')](_0x96d5('0x8'),_0x1aaa24[_0x96d5('0x9')](function(_0x1de44b){return{'id':_0x1de44b['id']};}));return FaxMessage['findAll']({'where':{'FaxInteractionId':_0x3ff954['id'],'direction':'in','read':![]},'raw':!![]});})[_0x96d5('0x6')](function(_0x58ccfc){_0x3ff954[_0x96d5('0x7')]('unreadMessages',_0x58ccfc[_0x96d5('0xa')]);FaxInteractionEvents['emit'](_0x1e08f2+':'+_0x3ff954['id'],_0x3ff954);FaxInteractionEvents[_0x96d5('0xb')](_0x1e08f2,_0x3ff954);_0xf5e076(null);})['catch'](_0xf5e076(null));};}for(var e in events){if(events[_0x96d5('0xc')](e)){var event=events[e];FaxInteraction['hook'](e,emitEvent(event));}}module[_0x96d5('0xd')]=FaxInteractionEvents; \ No newline at end of file +var _0xdf85=['../../mysqldb','FaxInteraction','setMaxListeners','save','update','remove','getUsers','then','setDataValue','Users','map','findAll','emit','hook','events'];(function(_0x195e78,_0xf0c2ab){var _0x2048e8=function(_0x532d9f){while(--_0x532d9f){_0x195e78['push'](_0x195e78['shift']());}};_0x2048e8(++_0xf0c2ab);}(_0xdf85,0x68));var _0x5df8=function(_0x2070da,_0x45e586){_0x2070da=_0x2070da-0x0;var _0x4f9fe1=_0xdf85[_0x2070da];return _0x4f9fe1;};'use strict';var EventEmitter=require(_0x5df8('0x0'));var FaxInteraction=require(_0x5df8('0x1'))['db'][_0x5df8('0x2')];var FaxMessage=require(_0x5df8('0x1'))['db']['FaxMessage'];var FaxInteractionEvents=new EventEmitter();FaxInteractionEvents[_0x5df8('0x3')](0x0);var events={'afterCreate':_0x5df8('0x4'),'afterUpdate':_0x5df8('0x5'),'afterDestroy':_0x5df8('0x6')};function emitEvent(_0x1198c3){return function(_0x2fc237,_0x2edac1,_0x104d91){_0x2fc237[_0x5df8('0x7')]({'attributes':['id'],'raw':!![]})[_0x5df8('0x8')](function(_0x523d57){_0x2fc237[_0x5df8('0x9')](_0x5df8('0xa'),_0x523d57[_0x5df8('0xb')](function(_0x413cd9){return{'id':_0x413cd9['id']};}));return FaxMessage[_0x5df8('0xc')]({'where':{'FaxInteractionId':_0x2fc237['id'],'direction':'in','read':![]},'raw':!![]});})[_0x5df8('0x8')](function(_0x2b589d){_0x2fc237[_0x5df8('0x9')]('unreadMessages',_0x2b589d['length']);FaxInteractionEvents[_0x5df8('0xd')](_0x1198c3+':'+_0x2fc237['id'],_0x2fc237);FaxInteractionEvents['emit'](_0x1198c3,_0x2fc237);_0x104d91(null);})['catch'](_0x104d91(null));};}for(var e in events){if(events['hasOwnProperty'](e)){var event=events[e];FaxInteraction[_0x5df8('0xe')](e,emitEvent(event));}}module['exports']=FaxInteractionEvents; \ No newline at end of file diff --git a/server/api/faxInteraction/faxInteraction.model.js b/server/api/faxInteraction/faxInteraction.model.js index 2a6ca1f..0e66fa3 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 _0xbf29=['YYYY-MM-DD\x20HH:mm:ss','lodash','util','../../config/logger','api','rimraf','../../config/environment','./faxInteraction.attributes','exports','define','FaxInteraction','fax_interactions','closed','closedAt'];(function(_0xf99a79,_0x1dd7b7){var _0x46a2fc=function(_0x6b9be9){while(--_0x6b9be9){_0xf99a79['push'](_0xf99a79['shift']());}};_0x46a2fc(++_0x1dd7b7);}(_0xbf29,0x151));var _0x9bf2=function(_0x339d4a,_0x23af81){_0x339d4a=_0x339d4a-0x0;var _0x3c7a76=_0xbf29[_0x339d4a];return _0x3c7a76;};'use strict';var _=require(_0x9bf2('0x0'));var util=require(_0x9bf2('0x1'));var logger=require(_0x9bf2('0x2'))(_0x9bf2('0x3'));var moment=require('moment');var BPromise=require('bluebird');var rp=require('request-promise');var fs=require('fs');var path=require('path');var rimraf=require(_0x9bf2('0x4'));var config=require(_0x9bf2('0x5'));var attributes=require(_0x9bf2('0x6'));module[_0x9bf2('0x7')]=function(_0x527277,_0x1e1162){return _0x527277[_0x9bf2('0x8')](_0x9bf2('0x9'),attributes,{'tableName':_0x9bf2('0xa'),'paranoid':![],'indexes':[],'timestamps':!![],'hooks':{'beforeUpdate':function(_0x5e3fde,_0xa2b43d,_0x8e70aa){if(_0x5e3fde['changed'](_0x9bf2('0xb'))){_0x5e3fde[_0x9bf2('0xc')]=moment()['format'](_0x9bf2('0xd'));}_0x8e70aa(null,_0x5e3fde);}}});}; \ No newline at end of file +var _0x1235=['../../config/logger','moment','bluebird','request-promise','path','rimraf','../../config/environment','./faxInteraction.attributes','exports','define','FaxInteraction','changed','closed','closedAt','format','YYYY-MM-DD\x20HH:mm:ss'];(function(_0x17b6fb,_0x4a05e5){var _0x221575=function(_0x151def){while(--_0x151def){_0x17b6fb['push'](_0x17b6fb['shift']());}};_0x221575(++_0x4a05e5);}(_0x1235,0x1b0));var _0x5123=function(_0xdd128e,_0x5d49d7){_0xdd128e=_0xdd128e-0x0;var _0x1b8065=_0x1235[_0xdd128e];return _0x1b8065;};'use strict';var _=require('lodash');var util=require('util');var logger=require(_0x5123('0x0'))('api');var moment=require(_0x5123('0x1'));var BPromise=require(_0x5123('0x2'));var rp=require(_0x5123('0x3'));var fs=require('fs');var path=require(_0x5123('0x4'));var rimraf=require(_0x5123('0x5'));var config=require(_0x5123('0x6'));var attributes=require(_0x5123('0x7'));module[_0x5123('0x8')]=function(_0x16b2ea,_0x3e7613){return _0x16b2ea[_0x5123('0x9')](_0x5123('0xa'),attributes,{'tableName':'fax_interactions','paranoid':![],'indexes':[],'timestamps':!![],'hooks':{'beforeUpdate':function(_0x38bc90,_0x1848bc,_0x4e13f1){if(_0x38bc90[_0x5123('0xb')](_0x5123('0xc'))){_0x38bc90[_0x5123('0xd')]=moment()[_0x5123('0xe')](_0x5123('0xf'));}_0x4e13f1(null,_0x38bc90);}}});}; \ No newline at end of file diff --git a/server/api/faxInteraction/faxInteraction.rpc.js b/server/api/faxInteraction/faxInteraction.rpc.js index 0f2b489..65d945c 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 _0x54b1=['request\x20sent','debug','FaxInteraction,\x20%s,\x20%s,\x20%s','stringify','error','code','message','info','result','catch','UpdateFaxInteraction','FaxInteraction','body','options','raw','where','attributes','AddTagsToFaxInteraction','find','addTags','omit','ids','spread','AddTags','util','moment','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','client','http','redis','./faxInteraction.socket','request','then','FaxInteraction,\x20%s,\x20%s'];(function(_0x81dcac,_0x8ff7db){var _0xc7803b=function(_0x499b29){while(--_0x499b29){_0x81dcac['push'](_0x81dcac['shift']());}};_0xc7803b(++_0x8ff7db);}(_0x54b1,0xb4));var _0x154b=function(_0x258756,_0xa48dc6){_0x258756=_0x258756-0x0;var _0x2462ea=_0x54b1[_0x258756];return _0x2462ea;};'use strict';var _=require('lodash');var util=require(_0x154b('0x0'));var moment=require(_0x154b('0x1'));var BPromise=require('bluebird');var rs=require('randomstring');var fs=require('fs');var Redis=require('ioredis');var db=require(_0x154b('0x2'))['db'];var utils=require(_0x154b('0x3'));var logger=require(_0x154b('0x4'))(_0x154b('0x5'));var config=require(_0x154b('0x6'));var jayson=require(_0x154b('0x7'));var client=jayson[_0x154b('0x8')][_0x154b('0x9')]({'port':0x232a});config['redis']=_['defaults'](config[_0x154b('0xa')],{'host':'localhost','port':0x18eb});var socket=require('socket.io-emitter')(new Redis(config['redis']));require(_0x154b('0xb'))['register'](socket);function respondWithRpcPromise(_0xa4ce49,_0x4dc116,_0x44dba5){return new BPromise(function(_0x5601a4,_0x4a7e74){return client[_0x154b('0xc')](_0xa4ce49,_0x44dba5)[_0x154b('0xd')](function(_0x355f90){logger['info'](_0x154b('0xe'),_0x4dc116,_0x154b('0xf'));logger[_0x154b('0x10')](_0x154b('0x11'),_0x4dc116,'request\x20sent',JSON[_0x154b('0x12')](_0x355f90));if(_0x355f90[_0x154b('0x13')]){if(_0x355f90[_0x154b('0x13')][_0x154b('0x14')]===0x1f4){logger[_0x154b('0x13')](_0x154b('0xe'),_0x4dc116,_0x355f90[_0x154b('0x13')][_0x154b('0x15')]);return _0x4a7e74(_0x355f90[_0x154b('0x13')]['message']);}logger[_0x154b('0x13')](_0x154b('0xe'),_0x4dc116,_0x355f90[_0x154b('0x13')]['message']);return _0x5601a4(_0x355f90[_0x154b('0x13')][_0x154b('0x15')]);}else{logger[_0x154b('0x16')](_0x154b('0xe'),_0x4dc116,_0x154b('0xf'));_0x5601a4(_0x355f90[_0x154b('0x17')][_0x154b('0x15')]);}})[_0x154b('0x18')](function(_0x3254e3){logger['error'](_0x154b('0xe'),_0x4dc116,_0x3254e3);_0x4a7e74(_0x3254e3);});});}exports[_0x154b('0x19')]=function(_0x33aec6){var _0x167dfd=this;return new Promise(function(_0x36e078,_0x39bff5){return db[_0x154b('0x1a')]['update'](_0x33aec6[_0x154b('0x1b')],{'raw':_0x33aec6[_0x154b('0x1c')]?_0x33aec6[_0x154b('0x1c')][_0x154b('0x1d')]===undefined?!![]:![]:!![],'individualHooks':!![],'where':_0x33aec6[_0x154b('0x1c')]?_0x33aec6['options'][_0x154b('0x1e')]||null:null,'attributes':_0x33aec6[_0x154b('0x1c')]?_0x33aec6[_0x154b('0x1c')][_0x154b('0x1f')]||null:null,'limit':_0x33aec6[_0x154b('0x1c')]?_0x33aec6[_0x154b('0x1c')]['limit']||null:null})[_0x154b('0xd')](function(_0x3292d7){logger['info'](_0x154b('0x19'),_0x33aec6);logger[_0x154b('0x10')](_0x154b('0x19'),_0x33aec6,JSON[_0x154b('0x12')](_0x3292d7));_0x36e078(_0x3292d7);})[_0x154b('0x18')](function(_0x5f30c0){logger[_0x154b('0x13')]('UpdateFaxInteraction',_0x5f30c0[_0x154b('0x15')],_0x33aec6);_0x39bff5(_0x167dfd['error'](0x1f4,_0x5f30c0[_0x154b('0x15')]));});});};exports[_0x154b('0x20')]=function(_0x17c34b){return new Promise(function(_0x4dfb84,_0x6a17b1){return db[_0x154b('0x1a')][_0x154b('0x21')]({'where':_0x17c34b[_0x154b('0x1c')]?_0x17c34b[_0x154b('0x1c')][_0x154b('0x1e')]||null:null})[_0x154b('0xd')](function(_0x2901f3){if(_0x2901f3){return _0x2901f3[_0x154b('0x22')](_0x17c34b[_0x154b('0x1b')]['ids'],_[_0x154b('0x23')](_0x17c34b['body'],[_0x154b('0x24'),'id'])||{});}})[_0x154b('0x25')](function(_0x109325){logger[_0x154b('0x16')](_0x154b('0x26'),_0x17c34b);logger[_0x154b('0x10')](_0x154b('0x26'),_0x17c34b,JSON[_0x154b('0x12')](_0x109325));_0x4dfb84(_0x109325);})[_0x154b('0x18')](function(_0x20e12c){logger[_0x154b('0x13')](_0x154b('0x26'),_0x20e12c[_0x154b('0x15')],_0x17c34b);_0x6a17b1(_this[_0x154b('0x13')](0x1f4,_0x20e12c[_0x154b('0x15')]));});});}; \ No newline at end of file +var _0xb866=['http','redis','defaults','socket.io-emitter','./faxInteraction.socket','register','then','FaxInteraction,\x20%s,\x20%s','request\x20sent','debug','FaxInteraction,\x20%s,\x20%s,\x20%s','stringify','error','code','message','UpdateFaxInteraction','FaxInteraction','options','where','attributes','limit','info','AddTagsToFaxInteraction','find','addTags','body','ids','spread','AddTags','lodash','util','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','client'];(function(_0x5ea529,_0xb364a2){var _0x42c1af=function(_0xb57dfe){while(--_0xb57dfe){_0x5ea529['push'](_0x5ea529['shift']());}};_0x42c1af(++_0xb364a2);}(_0xb866,0x165));var _0x6b86=function(_0x14223d,_0x4105b6){_0x14223d=_0x14223d-0x0;var _0x350191=_0xb866[_0x14223d];return _0x350191;};'use strict';var _=require(_0x6b86('0x0'));var util=require(_0x6b86('0x1'));var moment=require(_0x6b86('0x2'));var BPromise=require(_0x6b86('0x3'));var rs=require(_0x6b86('0x4'));var fs=require('fs');var Redis=require(_0x6b86('0x5'));var db=require(_0x6b86('0x6'))['db'];var utils=require(_0x6b86('0x7'));var logger=require(_0x6b86('0x8'))(_0x6b86('0x9'));var config=require(_0x6b86('0xa'));var jayson=require('jayson/promise');var client=jayson[_0x6b86('0xb')][_0x6b86('0xc')]({'port':0x232a});config[_0x6b86('0xd')]=_[_0x6b86('0xe')](config[_0x6b86('0xd')],{'host':'localhost','port':0x18eb});var socket=require(_0x6b86('0xf'))(new Redis(config['redis']));require(_0x6b86('0x10'))[_0x6b86('0x11')](socket);function respondWithRpcPromise(_0x132893,_0x2eec56,_0x988275){return new BPromise(function(_0x3cf177,_0x292250){return client['request'](_0x132893,_0x988275)[_0x6b86('0x12')](function(_0x5dfab8){logger['info'](_0x6b86('0x13'),_0x2eec56,_0x6b86('0x14'));logger[_0x6b86('0x15')](_0x6b86('0x16'),_0x2eec56,_0x6b86('0x14'),JSON[_0x6b86('0x17')](_0x5dfab8));if(_0x5dfab8[_0x6b86('0x18')]){if(_0x5dfab8[_0x6b86('0x18')][_0x6b86('0x19')]===0x1f4){logger[_0x6b86('0x18')](_0x6b86('0x13'),_0x2eec56,_0x5dfab8['error'][_0x6b86('0x1a')]);return _0x292250(_0x5dfab8[_0x6b86('0x18')][_0x6b86('0x1a')]);}logger[_0x6b86('0x18')](_0x6b86('0x13'),_0x2eec56,_0x5dfab8[_0x6b86('0x18')][_0x6b86('0x1a')]);return _0x3cf177(_0x5dfab8[_0x6b86('0x18')][_0x6b86('0x1a')]);}else{logger['info'](_0x6b86('0x13'),_0x2eec56,_0x6b86('0x14'));_0x3cf177(_0x5dfab8['result'][_0x6b86('0x1a')]);}})['catch'](function(_0x4c2f76){logger[_0x6b86('0x18')](_0x6b86('0x13'),_0x2eec56,_0x4c2f76);_0x292250(_0x4c2f76);});});}exports[_0x6b86('0x1b')]=function(_0x183b89){var _0x3cf5be=this;return new Promise(function(_0x284f0a,_0xf9833f){return db[_0x6b86('0x1c')]['update'](_0x183b89['body'],{'raw':_0x183b89[_0x6b86('0x1d')]?_0x183b89[_0x6b86('0x1d')]['raw']===undefined?!![]:![]:!![],'individualHooks':!![],'where':_0x183b89[_0x6b86('0x1d')]?_0x183b89['options'][_0x6b86('0x1e')]||null:null,'attributes':_0x183b89[_0x6b86('0x1d')]?_0x183b89[_0x6b86('0x1d')][_0x6b86('0x1f')]||null:null,'limit':_0x183b89['options']?_0x183b89[_0x6b86('0x1d')][_0x6b86('0x20')]||null:null})[_0x6b86('0x12')](function(_0xa2a356){logger[_0x6b86('0x21')](_0x6b86('0x1b'),_0x183b89);logger[_0x6b86('0x15')](_0x6b86('0x1b'),_0x183b89,JSON[_0x6b86('0x17')](_0xa2a356));_0x284f0a(_0xa2a356);})['catch'](function(_0x29281c){logger[_0x6b86('0x18')]('UpdateFaxInteraction',_0x29281c[_0x6b86('0x1a')],_0x183b89);_0xf9833f(_0x3cf5be[_0x6b86('0x18')](0x1f4,_0x29281c[_0x6b86('0x1a')]));});});};exports[_0x6b86('0x22')]=function(_0x4724c3){return new Promise(function(_0xb34d8,_0x298b88){return db[_0x6b86('0x1c')][_0x6b86('0x23')]({'where':_0x4724c3[_0x6b86('0x1d')]?_0x4724c3[_0x6b86('0x1d')][_0x6b86('0x1e')]||null:null})[_0x6b86('0x12')](function(_0x1d6efc){if(_0x1d6efc){return _0x1d6efc[_0x6b86('0x24')](_0x4724c3[_0x6b86('0x25')][_0x6b86('0x26')],_['omit'](_0x4724c3[_0x6b86('0x25')],['ids','id'])||{});}})[_0x6b86('0x27')](function(_0xcc3b9b){logger[_0x6b86('0x21')](_0x6b86('0x28'),_0x4724c3);logger[_0x6b86('0x15')](_0x6b86('0x28'),_0x4724c3,JSON['stringify'](_0xcc3b9b));_0xb34d8(_0xcc3b9b);})['catch'](function(_0x3380e5){logger[_0x6b86('0x18')](_0x6b86('0x28'),_0x3380e5[_0x6b86('0x1a')],_0x4724c3);_0x298b88(_this[_0x6b86('0x18')](0x1f4,_0x3380e5['message']));});});}; \ No newline at end of file diff --git a/server/api/faxInteraction/faxInteraction.socket.js b/server/api/faxInteraction/faxInteraction.socket.js index 690532f..ac12d42 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 _0x17b6=['faxInteraction:','./faxInteraction.events','save','remove','update','emit','register','length'];(function(_0x1e9c09,_0x3d6c6e){var _0x1dc5ef=function(_0x47ea65){while(--_0x47ea65){_0x1e9c09['push'](_0x1e9c09['shift']());}};_0x1dc5ef(++_0x3d6c6e);}(_0x17b6,0x169));var _0x617b=function(_0x5013e3,_0x37b96f){_0x5013e3=_0x5013e3-0x0;var _0x29f2d6=_0x17b6[_0x5013e3];return _0x29f2d6;};'use strict';var FaxInteractionEvents=require(_0x617b('0x0'));var events=[_0x617b('0x1'),_0x617b('0x2'),_0x617b('0x3')];function createListener(_0x1d4a2a,_0x54941f){return function(_0x5d6032){_0x54941f[_0x617b('0x4')](_0x1d4a2a,_0x5d6032);};}function removeListener(_0xfb8d00,_0x442b46){return function(){FaxInteractionEvents['removeListener'](_0xfb8d00,_0x442b46);};}exports[_0x617b('0x5')]=function(_0x13b83b){for(var _0x55b17e=0x0,_0x348ef9=events[_0x617b('0x6')];_0x55b17e<_0x348ef9;_0x55b17e++){var _0x5daa08=events[_0x55b17e];var _0x3f471b=createListener(_0x617b('0x7')+_0x5daa08,_0x13b83b);FaxInteractionEvents['on'](_0x5daa08,_0x3f471b);}}; \ No newline at end of file +var _0x6342=['removeListener','register','./faxInteraction.events','save','remove'];(function(_0x4d96cf,_0xcb5da7){var _0x28b5af=function(_0x4c2035){while(--_0x4c2035){_0x4d96cf['push'](_0x4d96cf['shift']());}};_0x28b5af(++_0xcb5da7);}(_0x6342,0xf7));var _0x2634=function(_0x1e9424,_0x191cba){_0x1e9424=_0x1e9424-0x0;var _0x1bd96c=_0x6342[_0x1e9424];return _0x1bd96c;};'use strict';var FaxInteractionEvents=require(_0x2634('0x0'));var events=[_0x2634('0x1'),_0x2634('0x2'),'update'];function createListener(_0x5dc2b9,_0x4f690e){return function(_0x3e009e){_0x4f690e['emit'](_0x5dc2b9,_0x3e009e);};}function removeListener(_0x517741,_0x47643a){return function(){FaxInteractionEvents[_0x2634('0x3')](_0x517741,_0x47643a);};}exports[_0x2634('0x4')]=function(_0x1d5113){for(var _0x29396a=0x0,_0x34d7b3=events['length'];_0x29396a<_0x34d7b3;_0x29396a++){var _0x938674=events[_0x29396a];var _0x4845ba=createListener('faxInteraction:'+_0x938674,_0x1d5113);FaxInteractionEvents['on'](_0x938674,_0x4845ba);}}; \ No newline at end of file diff --git a/server/api/faxInteraction/index.js b/server/api/faxInteraction/index.js index eb2ec14..a5c30f3 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 _0x6f76=['fax','addTags','put','update','faxinteraction:destroy','destroy','delete','removeTags','multer','path','express','Router','fs-extra','../../components/auth/service','../../config/environment','get','isAuthenticated','/describe','describe','/:id','show','/:id/messages','getMessages','/:id/download','download','post','create','addMessage','/:id/tags','tracked'];(function(_0x45f9d0,_0xf984f7){var _0x16d490=function(_0x2f1d52){while(--_0x2f1d52){_0x45f9d0['push'](_0x45f9d0['shift']());}};_0x16d490(++_0xf984f7);}(_0x6f76,0x170));var _0x66f7=function(_0x23a386,_0x21c40b){_0x23a386=_0x23a386-0x0;var _0x3d954e=_0x6f76[_0x23a386];return _0x3d954e;};'use strict';var multer=require(_0x66f7('0x0'));var util=require('util');var path=require(_0x66f7('0x1'));var timeout=require('connect-timeout');var express=require(_0x66f7('0x2'));var router=express[_0x66f7('0x3')]();var fs_extra=require(_0x66f7('0x4'));var auth=require(_0x66f7('0x5'));var interaction=require('../../components/interaction/service');var config=require(_0x66f7('0x6'));var controller=require('./faxInteraction.controller');router[_0x66f7('0x7')]('/',auth[_0x66f7('0x8')](),controller['index']);router[_0x66f7('0x7')](_0x66f7('0x9'),auth[_0x66f7('0x8')](),controller[_0x66f7('0xa')]);router[_0x66f7('0x7')](_0x66f7('0xb'),auth[_0x66f7('0x8')](),controller[_0x66f7('0xc')]);router[_0x66f7('0x7')](_0x66f7('0xd'),auth['isAuthenticated'](),controller[_0x66f7('0xe')]);router[_0x66f7('0x7')](_0x66f7('0xf'),auth[_0x66f7('0x8')](),controller[_0x66f7('0x10')]);router[_0x66f7('0x11')]('/',auth[_0x66f7('0x8')](),controller[_0x66f7('0x12')]);router[_0x66f7('0x11')](_0x66f7('0xd'),auth[_0x66f7('0x8')](),controller[_0x66f7('0x13')]);router['post'](_0x66f7('0x14'),auth[_0x66f7('0x8')](),interaction[_0x66f7('0x15')](_0x66f7('0x16'),'faxinteraction:addtags'),controller[_0x66f7('0x17')]);router[_0x66f7('0x18')](_0x66f7('0xb'),auth[_0x66f7('0x8')](),interaction['tracked']('fax','faxinteraction:update'),controller[_0x66f7('0x19')]);router['delete']('/:id',auth[_0x66f7('0x8')](),interaction[_0x66f7('0x15')](_0x66f7('0x16'),_0x66f7('0x1a')),controller[_0x66f7('0x1b')]);router[_0x66f7('0x1c')](_0x66f7('0x14'),auth[_0x66f7('0x8')](),controller[_0x66f7('0x1d')]);module['exports']=router; \ No newline at end of file +var _0xb2c0=['delete','faxinteraction:destroy','destroy','/:id/tags','exports','multer','path','connect-timeout','express','Router','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','get','isAuthenticated','index','show','getMessages','/:id/download','download','post','create','/:id/messages','addMessage','tracked','fax','put','/:id','update'];(function(_0x5519a9,_0x1c5147){var _0x32f2cc=function(_0x52ed58){while(--_0x52ed58){_0x5519a9['push'](_0x5519a9['shift']());}};_0x32f2cc(++_0x1c5147);}(_0xb2c0,0x1a9));var _0x0b2c=function(_0x3ab51d,_0x2fa01d){_0x3ab51d=_0x3ab51d-0x0;var _0x29a04e=_0xb2c0[_0x3ab51d];return _0x29a04e;};'use strict';var multer=require(_0x0b2c('0x0'));var util=require('util');var path=require(_0x0b2c('0x1'));var timeout=require(_0x0b2c('0x2'));var express=require(_0x0b2c('0x3'));var router=express[_0x0b2c('0x4')]();var fs_extra=require(_0x0b2c('0x5'));var auth=require(_0x0b2c('0x6'));var interaction=require(_0x0b2c('0x7'));var config=require(_0x0b2c('0x8'));var controller=require('./faxInteraction.controller');router[_0x0b2c('0x9')]('/',auth[_0x0b2c('0xa')](),controller[_0x0b2c('0xb')]);router[_0x0b2c('0x9')]('/describe',auth[_0x0b2c('0xa')](),controller['describe']);router['get']('/:id',auth[_0x0b2c('0xa')](),controller[_0x0b2c('0xc')]);router[_0x0b2c('0x9')]('/:id/messages',auth['isAuthenticated'](),controller[_0x0b2c('0xd')]);router['get'](_0x0b2c('0xe'),auth[_0x0b2c('0xa')](),controller[_0x0b2c('0xf')]);router[_0x0b2c('0x10')]('/',auth['isAuthenticated'](),controller[_0x0b2c('0x11')]);router['post'](_0x0b2c('0x12'),auth[_0x0b2c('0xa')](),controller[_0x0b2c('0x13')]);router[_0x0b2c('0x10')]('/:id/tags',auth['isAuthenticated'](),interaction[_0x0b2c('0x14')](_0x0b2c('0x15'),'faxinteraction:addtags'),controller['addTags']);router[_0x0b2c('0x16')](_0x0b2c('0x17'),auth[_0x0b2c('0xa')](),interaction[_0x0b2c('0x14')](_0x0b2c('0x15'),'faxinteraction:update'),controller[_0x0b2c('0x18')]);router[_0x0b2c('0x19')]('/:id',auth['isAuthenticated'](),interaction[_0x0b2c('0x14')](_0x0b2c('0x15'),_0x0b2c('0x1a')),controller[_0x0b2c('0x1b')]);router[_0x0b2c('0x19')](_0x0b2c('0x1c'),auth[_0x0b2c('0xa')](),controller['removeTags']);module[_0x0b2c('0x1d')]=router; \ No newline at end of file diff --git a/server/api/faxMessage/faxMessage.attributes.js b/server/api/faxMessage/faxMessage.attributes.js index a5641d1..84f686b 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 _0xe009=['ENUM','out','DATE','sequelize','exports','TEXT','medium'];(function(_0x3825e6,_0xe169de){var _0xd75004=function(_0x4b1314){while(--_0x4b1314){_0x3825e6['push'](_0x3825e6['shift']());}};_0xd75004(++_0xe169de);}(_0xe009,0x122));var _0x9e00=function(_0x2e3f69,_0xc39e74){_0x2e3f69=_0x2e3f69-0x0;var _0x7447ed=_0xe009[_0x2e3f69];return _0x7447ed;};'use strict';var Sequelize=require(_0x9e00('0x0'));module[_0x9e00('0x1')]={'body':{'type':Sequelize[_0x9e00('0x2')](_0x9e00('0x3')),'allowNull':![]},'read':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'direction':{'type':Sequelize[_0x9e00('0x4')]('in','out'),'defaultValue':_0x9e00('0x5'),'allowNull':![]},'failMessage':{'type':Sequelize[_0x9e00('0x2')],'defaultValue':null},'readAt':{'type':Sequelize[_0x9e00('0x6')]}}; \ No newline at end of file +var _0x5ad3=['exports','TEXT','medium','ENUM','out','DATE','sequelize'];(function(_0x3635ce,_0x33a6f9){var _0x97ecd0=function(_0x123d98){while(--_0x123d98){_0x3635ce['push'](_0x3635ce['shift']());}};_0x97ecd0(++_0x33a6f9);}(_0x5ad3,0x1e2));var _0x35ad=function(_0x11160d,_0x413adc){_0x11160d=_0x11160d-0x0;var _0x21520a=_0x5ad3[_0x11160d];return _0x21520a;};'use strict';var Sequelize=require(_0x35ad('0x0'));module[_0x35ad('0x1')]={'body':{'type':Sequelize[_0x35ad('0x2')](_0x35ad('0x3')),'allowNull':![]},'read':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'direction':{'type':Sequelize[_0x35ad('0x4')]('in',_0x35ad('0x5')),'defaultValue':_0x35ad('0x5'),'allowNull':![]},'failMessage':{'type':Sequelize[_0x35ad('0x2')],'defaultValue':null},'readAt':{'type':Sequelize[_0x35ad('0x6')]}}; \ No newline at end of file diff --git a/server/api/faxMessage/faxMessage.controller.js b/server/api/faxMessage/faxMessage.controller.js index def3210..a18e9a0 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 _0xd76f=['rows','show','includeAll','find','body','params','destroy','describe','fax-interactions','accept','fax','read','readAt','YYYY-MM-DD\x20HH:mm:ss','UserId','user','agent','get','FaxInteraction','FaxInteractionId','isNil','format','interaction','[FAXMESSAGE: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','email','internal','interface','SIP/%s','motionChannel','event','EventManager','acceptmessage','../../config/logger','[FAXMESSAGE:REJECT]\x20id=%s\x20name=%s\x20role=%s\x20interaction=%s\x20body=%s','RejectMessage','rejectMessage','channel','rejectmessage','create','CmContact','findOne','Attachment','SendFax','FaxAccountId','download','join','root','server','files','attachments','eml-format','fast-json-patch','bluebird','util','path','sox','to-csv','ejs','lodash','squel','crypto','jsforce','desk.js','papaparse','ioredis','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','api','../../config/environment','../../config/license/util','../../mysqldb','redis','localhost','socket.io-emitter','./faxMessage.socket','register','jayson/promise','client','http','then','info','FaxMessage,\x20%s,\x20%s','request\x20sent','debug','FaxMessage,\x20%s,\x20%s,\x20%s','stringify','error','code','message','result','catch','status','json','offset','undefined','limit','count','set','Content-Range','reject','save','update','end','sendStatus','stack','name','send','index','FaxMessage','rawAttributes','fieldName','type','key','model','map','query','keys','filters','intersection','attributes','fields','length','hasOwnProperty','nolimit','order','sort','where','pick','merge','VIRTUAL','options','include','findAll'];(function(_0xc77819,_0x139fdc){var _0x1c9434=function(_0x11d15d){while(--_0x11d15d){_0xc77819['push'](_0xc77819['shift']());}};_0x1c9434(++_0x139fdc);}(_0xd76f,0xd0));var _0xfd76=function(_0x53da0e,_0x2c4eb0){_0x53da0e=_0x53da0e-0x0;var _0x3a6ae7=_0xd76f[_0x53da0e];return _0x3a6ae7;};'use strict';var emlformat=require(_0xfd76('0x0'));var rimraf=require('rimraf');var zipdir=require('zip-dir');var jsonpatch=require(_0xfd76('0x1'));var rp=require('request-promise');var moment=require('moment');var BPromise=require(_0xfd76('0x2'));var Mustache=require('mustache');var util=require(_0xfd76('0x3'));var path=require(_0xfd76('0x4'));var sox=require(_0xfd76('0x5'));var csv=require(_0xfd76('0x6'));var ejs=require(_0xfd76('0x7'));var fs=require('fs');var fs_extra=require('fs-extra');var _=require(_0xfd76('0x8'));var squel=require(_0xfd76('0x9'));var crypto=require(_0xfd76('0xa'));var jsforce=require(_0xfd76('0xb'));var deskjs=require(_0xfd76('0xc'));var toCsv=require(_0xfd76('0x6'));var querystring=require('querystring');var Papa=require(_0xfd76('0xd'));var Redis=require(_0xfd76('0xe'));var authService=require('../../components/auth/service');var qs=require(_0xfd76('0xf'));var as=require(_0xfd76('0x10'));var hardwareService=require(_0xfd76('0x11'));var logger=require('../../config/logger')(_0xfd76('0x12'));var utils=require('../../config/utils');var config=require(_0xfd76('0x13'));var licenseUtil=require(_0xfd76('0x14'));var db=require(_0xfd76('0x15'))['db'];config[_0xfd76('0x16')]=_['defaults'](config[_0xfd76('0x16')],{'host':_0xfd76('0x17'),'port':0x18eb});var socket=require(_0xfd76('0x18'))(new Redis(config[_0xfd76('0x16')]));require(_0xfd76('0x19'))[_0xfd76('0x1a')](socket);var jayson=require(_0xfd76('0x1b'));var client=jayson[_0xfd76('0x1c')][_0xfd76('0x1d')]({'port':0x232c});var client9002=jayson['client'][_0xfd76('0x1d')]({'port':0x232a});function respondWithRpcPromise(_0xa87de8,_0x1893c9,_0x3be210,_0x2b0ff1){return new BPromise(function(_0x233a40,_0x25c330){var _0x1ee6fb=_0x2b0ff1||client;return _0x1ee6fb['request'](_0xa87de8,_0x3be210)[_0xfd76('0x1e')](function(_0x38d874){logger[_0xfd76('0x1f')](_0xfd76('0x20'),_0x1893c9,_0xfd76('0x21'));logger[_0xfd76('0x22')](_0xfd76('0x23'),_0x1893c9,'request\x20sent',JSON[_0xfd76('0x24')](_0x38d874));if(_0x38d874[_0xfd76('0x25')]){if(_0x38d874[_0xfd76('0x25')][_0xfd76('0x26')]===0x1f4){logger[_0xfd76('0x25')]('FaxMessage,\x20%s,\x20%s',_0x1893c9,_0x38d874['error']['message']);return _0x25c330(_0x38d874[_0xfd76('0x25')][_0xfd76('0x27')]);}logger[_0xfd76('0x25')]('FaxMessage,\x20%s,\x20%s',_0x1893c9,_0x38d874[_0xfd76('0x25')][_0xfd76('0x27')]);return _0x233a40(_0x38d874['error']['message']);}else{logger['info'](_0xfd76('0x20'),_0x1893c9,_0xfd76('0x21'));_0x233a40(_0x38d874[_0xfd76('0x28')][_0xfd76('0x27')]);}})[_0xfd76('0x29')](function(_0x53f9b0){logger[_0xfd76('0x25')]('FaxMessage,\x20%s,\x20%s',_0x1893c9,_0x53f9b0);_0x25c330(_0x53f9b0);});});}function respondWithStatusCode(_0x320f54,_0x393e52){_0x393e52=_0x393e52||0xcc;return function(_0x5db4a9){if(_0x5db4a9){return _0x320f54['sendStatus'](_0x393e52);}return _0x320f54['status'](_0x393e52)['end']();};}function respondWithResult(_0x4344c3,_0x1797d7){_0x1797d7=_0x1797d7||0xc8;return function(_0x1f8801){if(_0x1f8801){return _0x4344c3[_0xfd76('0x2a')](_0x1797d7)[_0xfd76('0x2b')](_0x1f8801);}};}function respondWithFilteredResult(_0x531b92,_0x2bafa5){return function(_0x3559ac){if(_0x3559ac){var _0x153bbb=typeof _0x2bafa5[_0xfd76('0x2c')]===_0xfd76('0x2d')&&typeof _0x2bafa5[_0xfd76('0x2e')]===_0xfd76('0x2d');var _0x198ba3=_0x3559ac[_0xfd76('0x2f')];var _0x1baed0=_0x153bbb?0x0:_0x2bafa5[_0xfd76('0x2c')];var _0x3fb0c5=_0x153bbb?_0x3559ac[_0xfd76('0x2f')]:_0x2bafa5['offset']+_0x2bafa5[_0xfd76('0x2e')];var _0x3138d3;if(_0x3fb0c5>=_0x198ba3){_0x3fb0c5=_0x198ba3;_0x3138d3=0xc8;}else{_0x3138d3=0xce;}_0x531b92[_0xfd76('0x2a')](_0x3138d3);return _0x531b92[_0xfd76('0x30')](_0xfd76('0x31'),_0x1baed0+'-'+_0x3fb0c5+'/'+_0x198ba3)[_0xfd76('0x2b')](_0x3559ac);}return null;};}function patchUpdates(_0xd27574){return function(_0x57dc00){try{jsonpatch['apply'](_0x57dc00,_0xd27574,!![]);}catch(_0x42aa34){return BPromise[_0xfd76('0x32')](_0x42aa34);}return _0x57dc00[_0xfd76('0x33')]();};}function saveUpdates(_0x1874fb,_0x4f9d4e){return function(_0x420eee){if(_0x420eee){return _0x420eee[_0xfd76('0x34')](_0x1874fb)[_0xfd76('0x1e')](function(_0x1928e0){return _0x1928e0;});}return null;};}function removeEntity(_0x42ddf6,_0x1ab5dc){return function(_0x58169f){if(_0x58169f){return _0x58169f['destroy']()[_0xfd76('0x1e')](function(){_0x42ddf6[_0xfd76('0x2a')](0xcc)[_0xfd76('0x35')]();});}};}function handleEntityNotFound(_0x363775,_0x540d15){return function(_0x4d01db){if(!_0x4d01db){_0x363775[_0xfd76('0x36')](0x194);}return _0x4d01db;};}function handleError(_0x2c0bb0,_0xc1afe3){_0xc1afe3=_0xc1afe3||0x1f4;return function(_0x1c0dc9){logger[_0xfd76('0x25')](_0x1c0dc9[_0xfd76('0x37')]);if(_0x1c0dc9[_0xfd76('0x38')]){delete _0x1c0dc9['name'];}_0x2c0bb0[_0xfd76('0x2a')](_0xc1afe3)[_0xfd76('0x39')](_0x1c0dc9);};}exports[_0xfd76('0x3a')]=function(_0x1dc848,_0x51aed6){var _0x1fe29d={},_0x2e5fdd={},_0xb3b81a={'count':0x0,'rows':[]};var _0x4f6575=_['map'](db[_0xfd76('0x3b')][_0xfd76('0x3c')],function(_0x21218b){return{'name':_0x21218b[_0xfd76('0x3d')],'type':_0x21218b[_0xfd76('0x3e')][_0xfd76('0x3f')]};});_0x2e5fdd[_0xfd76('0x40')]=_[_0xfd76('0x41')](_0x4f6575,_0xfd76('0x38'));_0x2e5fdd[_0xfd76('0x42')]=_[_0xfd76('0x43')](_0x1dc848['query']);_0x2e5fdd[_0xfd76('0x44')]=_[_0xfd76('0x45')](_0x2e5fdd[_0xfd76('0x40')],_0x2e5fdd[_0xfd76('0x42')]);_0x1fe29d[_0xfd76('0x46')]=_[_0xfd76('0x45')](_0x2e5fdd[_0xfd76('0x40')],qs['fields'](_0x1dc848[_0xfd76('0x42')][_0xfd76('0x47')]));_0x1fe29d[_0xfd76('0x46')]=_0x1fe29d[_0xfd76('0x46')][_0xfd76('0x48')]?_0x1fe29d['attributes']:_0x2e5fdd[_0xfd76('0x40')];if(!_0x1dc848[_0xfd76('0x42')][_0xfd76('0x49')](_0xfd76('0x4a'))){_0x1fe29d[_0xfd76('0x2e')]=qs[_0xfd76('0x2e')](_0x1dc848[_0xfd76('0x42')]['limit']);_0x1fe29d[_0xfd76('0x2c')]=qs[_0xfd76('0x2c')](_0x1dc848[_0xfd76('0x42')][_0xfd76('0x2c')]);}_0x1fe29d[_0xfd76('0x4b')]=qs[_0xfd76('0x4c')](_0x1dc848[_0xfd76('0x42')][_0xfd76('0x4c')]);_0x1fe29d[_0xfd76('0x4d')]=qs[_0xfd76('0x44')](_[_0xfd76('0x4e')](_0x1dc848[_0xfd76('0x42')],_0x2e5fdd[_0xfd76('0x44')]),_0x4f6575);if(_0x1dc848['query']['filter']){_0x1fe29d[_0xfd76('0x4d')]=_[_0xfd76('0x4f')](_0x1fe29d[_0xfd76('0x4d')],{'$or':_[_0xfd76('0x41')](_0x4f6575,function(_0x1d465b){if(_0x1d465b[_0xfd76('0x3e')]!==_0xfd76('0x50')){var _0x4e0719={};_0x4e0719[_0x1d465b[_0xfd76('0x38')]]={'$like':'%'+_0x1dc848[_0xfd76('0x42')]['filter']+'%'};return _0x4e0719;}})});}_0x1fe29d=_[_0xfd76('0x4f')]({},_0x1fe29d,_0x1dc848[_0xfd76('0x51')]);var _0x5df179={'where':_0x1fe29d[_0xfd76('0x4d')]};return db[_0xfd76('0x3b')][_0xfd76('0x2f')](_0x5df179)['then'](function(_0x3d9ee8){_0xb3b81a[_0xfd76('0x2f')]=_0x3d9ee8;if(_0x1dc848['query']['includeAll']){_0x1fe29d[_0xfd76('0x52')]=[{'all':!![]}];}return db[_0xfd76('0x3b')][_0xfd76('0x53')](_0x1fe29d);})[_0xfd76('0x1e')](function(_0x30c28f){_0xb3b81a[_0xfd76('0x54')]=_0x30c28f;return _0xb3b81a;})[_0xfd76('0x1e')](respondWithFilteredResult(_0x51aed6,_0x1fe29d))['catch'](handleError(_0x51aed6,null));};exports[_0xfd76('0x55')]=function(_0x1847a1,_0x186d4b){var _0xb1466a={'raw':!![],'where':{'id':_0x1847a1['params']['id']}},_0x137acc={};_0x137acc[_0xfd76('0x40')]=_[_0xfd76('0x43')](db[_0xfd76('0x3b')][_0xfd76('0x3c')]);_0x137acc[_0xfd76('0x42')]=_[_0xfd76('0x43')](_0x1847a1[_0xfd76('0x42')]);_0x137acc['filters']=_[_0xfd76('0x45')](_0x137acc[_0xfd76('0x40')],_0x137acc[_0xfd76('0x42')]);_0xb1466a['attributes']=_['intersection'](_0x137acc['model'],qs[_0xfd76('0x47')](_0x1847a1[_0xfd76('0x42')][_0xfd76('0x47')]));_0xb1466a[_0xfd76('0x46')]=_0xb1466a[_0xfd76('0x46')]['length']?_0xb1466a[_0xfd76('0x46')]:_0x137acc[_0xfd76('0x40')];if(_0x1847a1[_0xfd76('0x42')][_0xfd76('0x56')]){_0xb1466a[_0xfd76('0x52')]=[{'all':!![]}];}_0xb1466a=_[_0xfd76('0x4f')]({},_0xb1466a,_0x1847a1[_0xfd76('0x51')]);return db[_0xfd76('0x3b')][_0xfd76('0x57')](_0xb1466a)['then'](handleEntityNotFound(_0x186d4b,null))[_0xfd76('0x1e')](respondWithResult(_0x186d4b,null))['catch'](handleError(_0x186d4b,null));};exports[_0xfd76('0x34')]=function(_0x36ee51,_0x3501cb){if(_0x36ee51[_0xfd76('0x58')]['id']){delete _0x36ee51[_0xfd76('0x58')]['id'];}return db['FaxMessage'][_0xfd76('0x57')]({'where':{'id':_0x36ee51[_0xfd76('0x59')]['id']}})['then'](handleEntityNotFound(_0x3501cb,null))['then'](saveUpdates(_0x36ee51['body'],null))['then'](respondWithResult(_0x3501cb,null))[_0xfd76('0x29')](handleError(_0x3501cb,null));};exports[_0xfd76('0x5a')]=function(_0x1d01a8,_0x2c1ab8){return db[_0xfd76('0x3b')]['find']({'where':{'id':_0x1d01a8[_0xfd76('0x59')]['id']}})[_0xfd76('0x1e')](handleEntityNotFound(_0x2c1ab8,null))[_0xfd76('0x1e')](removeEntity(_0x2c1ab8,null))['catch'](handleError(_0x2c1ab8,null));};exports[_0xfd76('0x5b')]=function(_0x5da54a,_0x11b154){return db[_0xfd76('0x3b')][_0xfd76('0x5b')]()['then'](respondWithResult(_0x11b154,null))[_0xfd76('0x29')](handleError(_0x11b154,null));};var interaction_log=require('../../config/logger')(_0xfd76('0x5c'));exports[_0xfd76('0x5d')]=function(_0x49b723,_0x241c67,_0x553e09){var _0x43b9d8={'agent':{},'channel':_0xfd76('0x5e')};if(_0x49b723[_0xfd76('0x58')]['id']){delete _0x49b723[_0xfd76('0x58')]['id'];}_0x49b723[_0xfd76('0x58')][_0xfd76('0x5f')]=!![];_0x49b723[_0xfd76('0x58')][_0xfd76('0x60')]=moment()['format'](_0xfd76('0x61'));_0x49b723['body'][_0xfd76('0x62')]=_0x49b723[_0xfd76('0x58')][_0xfd76('0x62')]||_0x49b723[_0xfd76('0x63')]['id'];_0x43b9d8[_0xfd76('0x64')]['id']=_0x49b723[_0xfd76('0x58')][_0xfd76('0x62')];return db[_0xfd76('0x3b')][_0xfd76('0x57')]({'where':{'id':_0x49b723['params']['id'],'UserId':null}})['then'](handleEntityNotFound(_0x241c67,null))[_0xfd76('0x1e')](saveUpdates(_0x49b723[_0xfd76('0x58')],null))['then'](function(_0x1ab3dc){if(_0x1ab3dc){_0x43b9d8[_0xfd76('0x27')]=_0x1ab3dc[_0xfd76('0x65')]({'plain':!![]});return db[_0xfd76('0x66')][_0xfd76('0x57')]({'where':{'id':_0x1ab3dc[_0xfd76('0x67')]}});}return null;})[_0xfd76('0x1e')](handleEntityNotFound(_0x241c67,null))[_0xfd76('0x1e')](function(_0x3fc5b2){if(_0x3fc5b2){return _0x3fc5b2['update']({'UserId':_0x49b723[_0xfd76('0x58')]['UserId'],'read1stAt':_[_0xfd76('0x68')](_0x3fc5b2['read1stAt'])?moment()[_0xfd76('0x69')](_0xfd76('0x61')):undefined});}return null;})['then'](function(_0xabbfff){if(_0xabbfff){_0x43b9d8[_0xfd76('0x6a')]=_0xabbfff[_0xfd76('0x65')]({'plain':!![]});interaction_log[_0xfd76('0x1f')](_0xfd76('0x6b'),_0x49b723[_0xfd76('0x63')]['id'],_0x49b723[_0xfd76('0x63')]['name'],_0x49b723['user'][_0xfd76('0x6c')],_0x43b9d8[_0xfd76('0x6a')]['id'],_0x49b723[_0xfd76('0x58')]?JSON['stringify'](_0x49b723[_0xfd76('0x58')]):_0xfd76('0x6d'));return respondWithRpcPromise(_0xfd76('0x6e'),_0xfd76('0x6f'),_0x43b9d8);}return null;})['then'](function(_0x19ebbe){var _0x5e42cb=_0xfd76('0x70')+_0x19ebbe[_0xfd76('0x27')][_0xfd76('0x71')];return db[_0xfd76('0x72')]['query'](_0x5e42cb,{'type':db[_0xfd76('0x73')][_0xfd76('0x74')][_0xfd76('0x75')],'raw':!![]})[_0xfd76('0x1e')](function(_0x8d8937){return _0x8d8937;});})[_0xfd76('0x1e')](function(_0xbe6656){if(_0xbe6656){_0x43b9d8[_0xfd76('0x27')][_0xfd76('0x76')]=_0xbe6656[0x0];if(!_0x49b723[_0xfd76('0x58')][_0xfd76('0x62')])return;return db[_0xfd76('0x77')][_0xfd76('0x57')]({'where':{'id':_0x49b723[_0xfd76('0x58')][_0xfd76('0x62')],'role':_0xfd76('0x64')},'attributes':['id',_0xfd76('0x38'),'fullname',_0xfd76('0x78'),_0xfd76('0x79')],'raw':!![]});}return null;})['then'](function(_0x12243c){if(!_0x12243c)return null;_0x43b9d8['message']['agent']=_0x12243c;return _0x43b9d8;})[_0xfd76('0x1e')](function(_0x12918d){if(_0x12918d){if(_0x49b723[_0xfd76('0x58')]['manual']){_0x43b9d8[_0xfd76('0x27')][_0xfd76('0x7a')]=util[_0xfd76('0x69')](_0xfd76('0x7b'),_0x49b723['user'][_0xfd76('0x38')]);_0x43b9d8[_0xfd76('0x27')]['channel']=_0x43b9d8['channel'];_0x43b9d8[_0xfd76('0x27')][_0xfd76('0x7c')]=_0x43b9d8['channel'];_0x43b9d8[_0xfd76('0x27')][_0xfd76('0x7d')]=_0xfd76('0x5d');return respondWithRpcPromise(_0xfd76('0x7e'),_0xfd76('0x7e'),{'event':_0xfd76('0x7f'),'message':_0x43b9d8['message']},client9002)[_0xfd76('0x1e')](function(){return _0x43b9d8;});}return _0x43b9d8;}return null;})[_0xfd76('0x1e')](respondWithResult(_0x241c67,null))[_0xfd76('0x29')](handleError(_0x241c67,null));};var interaction_log=require(_0xfd76('0x80'))('fax-interactions');exports[_0xfd76('0x32')]=function(_0x226057,_0x5abcb7,_0x263edd){var _0x2afee7={'agent':{},'channel':_0xfd76('0x5e')};if(_0x226057[_0xfd76('0x58')]['id']){delete _0x226057[_0xfd76('0x58')]['id'];}_0x226057[_0xfd76('0x58')][_0xfd76('0x62')]=_0x226057['body'][_0xfd76('0x62')]||_0x226057['user']['id'];_0x2afee7['agent']['id']=_0x226057[_0xfd76('0x58')][_0xfd76('0x62')];return db['FaxMessage']['find']({'where':{'id':_0x226057[_0xfd76('0x59')]['id'],'UserId':null}})['then'](handleEntityNotFound(_0x5abcb7,null))[_0xfd76('0x1e')](function(_0x378a92){if(_0x378a92){_0x2afee7[_0xfd76('0x27')]=_0x378a92[_0xfd76('0x65')]({'plain':!![]});return db[_0xfd76('0x66')][_0xfd76('0x57')]({'where':{'id':_0x378a92['FaxInteractionId']}});}return null;})[_0xfd76('0x1e')](handleEntityNotFound(_0x5abcb7,null))[_0xfd76('0x1e')](function(_0x4f8764){if(_0x4f8764){_0x2afee7[_0xfd76('0x6a')]=_0x4f8764[_0xfd76('0x65')]({'plain':!![]});interaction_log[_0xfd76('0x1f')](_0xfd76('0x81'),_0x226057[_0xfd76('0x63')]['id'],_0x226057['user'][_0xfd76('0x38')],_0x226057['user'][_0xfd76('0x6c')],_0x2afee7['interaction']['id'],_0x226057['body']?JSON[_0xfd76('0x24')](_0x226057[_0xfd76('0x58')]):_0xfd76('0x6d'));return respondWithRpcPromise(_0xfd76('0x82'),_0xfd76('0x83'),_0x2afee7);}return null;})['then'](function(_0x33dff4){var _0x56caf9='SELECT\x20*\x20FROM\x20cm_contacts\x20WHERE\x20id\x20=\x20'+_0x33dff4[_0xfd76('0x27')][_0xfd76('0x71')];return db['sequelize'][_0xfd76('0x42')](_0x56caf9,{'type':db[_0xfd76('0x73')]['QueryTypes'][_0xfd76('0x75')],'raw':!![]})[_0xfd76('0x1e')](function(_0x2c646d){return _0x2c646d;});})['then'](function(_0x1f21db){if(_0x1f21db){_0x2afee7['message'][_0xfd76('0x76')]=_0x1f21db[0x0];if(!_0x226057[_0xfd76('0x58')][_0xfd76('0x62')])return;return db[_0xfd76('0x77')]['find']({'where':{'id':_0x226057['body'][_0xfd76('0x62')],'role':_0xfd76('0x64')},'attributes':['id','name','fullname',_0xfd76('0x78'),_0xfd76('0x79')],'raw':!![]});}return null;})[_0xfd76('0x1e')](function(_0x3df110){if(!_0x3df110)return null;_0x2afee7[_0xfd76('0x27')][_0xfd76('0x64')]=_0x3df110;return _0x2afee7;})['then'](function(_0x12c40c){if(_0x12c40c){_0x12c40c[_0xfd76('0x27')][_0xfd76('0x7a')]=util[_0xfd76('0x69')](_0xfd76('0x7b'),_0x226057['user'][_0xfd76('0x38')]);_0x12c40c[_0xfd76('0x27')][_0xfd76('0x84')]=_0x2afee7['channel'];_0x12c40c[_0xfd76('0x27')][_0xfd76('0x7c')]=_0x2afee7[_0xfd76('0x84')];_0x12c40c[_0xfd76('0x27')]['event']=_0xfd76('0x32');respondWithRpcPromise(_0xfd76('0x7e'),_0xfd76('0x7e'),{'event':_0xfd76('0x85'),'message':_0x12c40c[_0xfd76('0x27')]},client9002);return _0x2afee7;}return null;})[_0xfd76('0x1e')](respondWithResult(_0x5abcb7,null))['catch'](handleError(_0x5abcb7,null));};exports[_0xfd76('0x86')]=function(_0x6ff7b,_0x5dd3fa){var _0x28c4ab;return db[_0xfd76('0x3b')][_0xfd76('0x86')](_0x6ff7b[_0xfd76('0x58')],{})['then'](function(_0x2f922e){_0x28c4ab=_0x2f922e;return db[_0xfd76('0x87')][_0xfd76('0x88')]({'where':{'id':_0x28c4ab[_0xfd76('0x71')]}});})[_0xfd76('0x1e')](function(_0x1a75ac){if(_[_0xfd76('0x68')](_0x1a75ac)){return;}else{_0x28c4ab[_0xfd76('0x5e')]=_0x1a75ac[_0xfd76('0x5e')];return db[_0xfd76('0x89')][_0xfd76('0x88')]({'where':{'id':_0x28c4ab['AttachmentId']}});}})[_0xfd76('0x1e')](function(_0x238ef4){return respondWithRpcPromise(_0xfd76('0x8a'),_0xfd76('0x8a'),{'FaxAccountId':_[_0xfd76('0x68')](_0x6ff7b[_0xfd76('0x58')])?undefined:_0x6ff7b[_0xfd76('0x58')][_0xfd76('0x8b')],'path':_[_0xfd76('0x68')](_0x238ef4)?undefined:util[_0xfd76('0x69')]('/var/opt/motion2/server/files/attachments/%s',_0x238ef4['basename']),'fax':_['isNil'](_0x28c4ab['fax'])?undefined:_0x28c4ab[_0xfd76('0x5e')],'AttachmentId':_0x28c4ab['AttachmentId']},client9002);})['then'](respondWithResult(_0x5dd3fa,0xc9))['catch'](handleError(_0x5dd3fa,null));};exports[_0xfd76('0x8c')]=function(_0x32c30a,_0x3c6370){var _0x5f3756=path[_0xfd76('0x8d')](config[_0xfd76('0x8e')],_0xfd76('0x8f'),_0xfd76('0x90'),_0xfd76('0x91'));return db['FaxMessage'][_0xfd76('0x57')]({'where':{'id':_0x32c30a[_0xfd76('0x59')]['id']},'include':[{'model':db[_0xfd76('0x89')],'as':'Attachment'}]})[_0xfd76('0x1e')](handleEntityNotFound(_0x3c6370,null))[_0xfd76('0x1e')](function(_0x45b47e){if(_0x45b47e){return _0x3c6370['download'](path[_0xfd76('0x8d')](_0x5f3756,_0x45b47e[_0xfd76('0x89')]['basename']));}})[_0xfd76('0x29')](handleError(_0x3c6370,null));}; \ No newline at end of file +var _0x87b4=['order','sort','where','merge','type','VIRTUAL','filter','FaxMessage','includeAll','include','show','params','options','find','body','describe','fax-interactions','accept','fax','read','format','YYYY-MM-DD\x20HH:mm:ss','UserId','user','agent','get','FaxInteraction','FaxInteractionId','isNil','read1stAt','[FAXMESSAGE:ACCEPT]\x20id=%s\x20name=%s\x20role=%s\x20interaction=%s\x20body=%s','role','interaction','stringify','null','AcceptMessage','SELECT\x20*\x20FROM\x20cm_contacts\x20WHERE\x20id\x20=\x20','Sequelize','contact','internal','manual','interface','channel','motionChannel','event','EventManager','RejectMessage','rejectMessage','QueryTypes','SELECT','User','SIP/%s','rejectmessage','create','CmContact','ContactId','Attachment','findOne','AttachmentId','SendFax','FaxAccountId','/var/opt/motion2/server/files/attachments/%s','basename','root','files','attachments','join','eml-format','rimraf','fast-json-patch','request-promise','util','path','to-csv','ejs','fs-extra','crypto','querystring','papaparse','ioredis','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/environment','../../config/license/util','redis','defaults','localhost','socket.io-emitter','jayson/promise','client','http','request','then','info','FaxMessage,\x20%s,\x20%s','debug','FaxMessage,\x20%s,\x20%s,\x20%s','request\x20sent','error','code','message','result','catch','sendStatus','json','offset','undefined','count','status','set','Content-Range','reject','save','update','destroy','stack','name','send','index','map','rawAttributes','key','query','keys','filters','model','attributes','intersection','fields','length','hasOwnProperty','nolimit','limit'];(function(_0x44bcb0,_0x235aa9){var _0xfaf881=function(_0x25d81d){while(--_0x25d81d){_0x44bcb0['push'](_0x44bcb0['shift']());}};_0xfaf881(++_0x235aa9);}(_0x87b4,0x1de));var _0x487b=function(_0x17aa6d,_0x3c9c52){_0x17aa6d=_0x17aa6d-0x0;var _0x238d72=_0x87b4[_0x17aa6d];return _0x238d72;};'use strict';var emlformat=require(_0x487b('0x0'));var rimraf=require(_0x487b('0x1'));var zipdir=require('zip-dir');var jsonpatch=require(_0x487b('0x2'));var rp=require(_0x487b('0x3'));var moment=require('moment');var BPromise=require('bluebird');var Mustache=require('mustache');var util=require(_0x487b('0x4'));var path=require(_0x487b('0x5'));var sox=require('sox');var csv=require(_0x487b('0x6'));var ejs=require(_0x487b('0x7'));var fs=require('fs');var fs_extra=require(_0x487b('0x8'));var _=require('lodash');var squel=require('squel');var crypto=require(_0x487b('0x9'));var jsforce=require('jsforce');var deskjs=require('desk.js');var toCsv=require(_0x487b('0x6'));var querystring=require(_0x487b('0xa'));var Papa=require(_0x487b('0xb'));var Redis=require(_0x487b('0xc'));var authService=require('../../components/auth/service');var qs=require(_0x487b('0xd'));var as=require(_0x487b('0xe'));var hardwareService=require(_0x487b('0xf'));var logger=require(_0x487b('0x10'))(_0x487b('0x11'));var utils=require(_0x487b('0x12'));var config=require(_0x487b('0x13'));var licenseUtil=require(_0x487b('0x14'));var db=require('../../mysqldb')['db'];config[_0x487b('0x15')]=_[_0x487b('0x16')](config[_0x487b('0x15')],{'host':_0x487b('0x17'),'port':0x18eb});var socket=require(_0x487b('0x18'))(new Redis(config[_0x487b('0x15')]));require('./faxMessage.socket')['register'](socket);var jayson=require(_0x487b('0x19'));var client=jayson[_0x487b('0x1a')][_0x487b('0x1b')]({'port':0x232c});var client9002=jayson[_0x487b('0x1a')][_0x487b('0x1b')]({'port':0x232a});function respondWithRpcPromise(_0x3dea77,_0x20c743,_0x1e901b,_0x15f472){return new BPromise(function(_0x237bee,_0xe6b3bd){var _0x48cf7d=_0x15f472||client;return _0x48cf7d[_0x487b('0x1c')](_0x3dea77,_0x1e901b)[_0x487b('0x1d')](function(_0x55cbc3){logger[_0x487b('0x1e')](_0x487b('0x1f'),_0x20c743,'request\x20sent');logger[_0x487b('0x20')](_0x487b('0x21'),_0x20c743,_0x487b('0x22'),JSON['stringify'](_0x55cbc3));if(_0x55cbc3[_0x487b('0x23')]){if(_0x55cbc3[_0x487b('0x23')][_0x487b('0x24')]===0x1f4){logger[_0x487b('0x23')]('FaxMessage,\x20%s,\x20%s',_0x20c743,_0x55cbc3['error'][_0x487b('0x25')]);return _0xe6b3bd(_0x55cbc3['error'][_0x487b('0x25')]);}logger[_0x487b('0x23')](_0x487b('0x1f'),_0x20c743,_0x55cbc3[_0x487b('0x23')][_0x487b('0x25')]);return _0x237bee(_0x55cbc3['error']['message']);}else{logger[_0x487b('0x1e')](_0x487b('0x1f'),_0x20c743,_0x487b('0x22'));_0x237bee(_0x55cbc3[_0x487b('0x26')][_0x487b('0x25')]);}})[_0x487b('0x27')](function(_0x3994c4){logger['error']('FaxMessage,\x20%s,\x20%s',_0x20c743,_0x3994c4);_0xe6b3bd(_0x3994c4);});});}function respondWithStatusCode(_0x3fba71,_0x534199){_0x534199=_0x534199||0xcc;return function(_0xbbee16){if(_0xbbee16){return _0x3fba71[_0x487b('0x28')](_0x534199);}return _0x3fba71['status'](_0x534199)['end']();};}function respondWithResult(_0xf73a3b,_0x2b47ce){_0x2b47ce=_0x2b47ce||0xc8;return function(_0x22e1b0){if(_0x22e1b0){return _0xf73a3b['status'](_0x2b47ce)[_0x487b('0x29')](_0x22e1b0);}};}function respondWithFilteredResult(_0x54777f,_0x5882da){return function(_0x49ad93){if(_0x49ad93){var _0x1a2a27=typeof _0x5882da[_0x487b('0x2a')]===_0x487b('0x2b')&&typeof _0x5882da['limit']==='undefined';var _0x89ad91=_0x49ad93[_0x487b('0x2c')];var _0x19b8f1=_0x1a2a27?0x0:_0x5882da['offset'];var _0x17f534=_0x1a2a27?_0x49ad93['count']:_0x5882da[_0x487b('0x2a')]+_0x5882da['limit'];var _0x5d66bf;if(_0x17f534>=_0x89ad91){_0x17f534=_0x89ad91;_0x5d66bf=0xc8;}else{_0x5d66bf=0xce;}_0x54777f[_0x487b('0x2d')](_0x5d66bf);return _0x54777f[_0x487b('0x2e')](_0x487b('0x2f'),_0x19b8f1+'-'+_0x17f534+'/'+_0x89ad91)[_0x487b('0x29')](_0x49ad93);}return null;};}function patchUpdates(_0x3c1f49){return function(_0x449a81){try{jsonpatch['apply'](_0x449a81,_0x3c1f49,!![]);}catch(_0x1e05df){return BPromise[_0x487b('0x30')](_0x1e05df);}return _0x449a81[_0x487b('0x31')]();};}function saveUpdates(_0x40751b,_0x42aef6){return function(_0x53e431){if(_0x53e431){return _0x53e431[_0x487b('0x32')](_0x40751b)['then'](function(_0xc58698){return _0xc58698;});}return null;};}function removeEntity(_0x2fbe2a,_0x3ab48f){return function(_0x545a65){if(_0x545a65){return _0x545a65[_0x487b('0x33')]()[_0x487b('0x1d')](function(){_0x2fbe2a['status'](0xcc)['end']();});}};}function handleEntityNotFound(_0x2299c9,_0x1f7200){return function(_0x2da2f4){if(!_0x2da2f4){_0x2299c9['sendStatus'](0x194);}return _0x2da2f4;};}function handleError(_0x6c1d21,_0x2b7828){_0x2b7828=_0x2b7828||0x1f4;return function(_0x58b836){logger[_0x487b('0x23')](_0x58b836[_0x487b('0x34')]);if(_0x58b836[_0x487b('0x35')]){delete _0x58b836['name'];}_0x6c1d21[_0x487b('0x2d')](_0x2b7828)[_0x487b('0x36')](_0x58b836);};}exports[_0x487b('0x37')]=function(_0xe1631b,_0x62903d){var _0x4d03e5={},_0x435bbd={},_0x40579d={'count':0x0,'rows':[]};var _0x417679=_[_0x487b('0x38')](db['FaxMessage'][_0x487b('0x39')],function(_0x540818){return{'name':_0x540818['fieldName'],'type':_0x540818['type'][_0x487b('0x3a')]};});_0x435bbd['model']=_[_0x487b('0x38')](_0x417679,_0x487b('0x35'));_0x435bbd[_0x487b('0x3b')]=_[_0x487b('0x3c')](_0xe1631b[_0x487b('0x3b')]);_0x435bbd[_0x487b('0x3d')]=_['intersection'](_0x435bbd[_0x487b('0x3e')],_0x435bbd[_0x487b('0x3b')]);_0x4d03e5[_0x487b('0x3f')]=_[_0x487b('0x40')](_0x435bbd[_0x487b('0x3e')],qs['fields'](_0xe1631b[_0x487b('0x3b')][_0x487b('0x41')]));_0x4d03e5[_0x487b('0x3f')]=_0x4d03e5[_0x487b('0x3f')][_0x487b('0x42')]?_0x4d03e5[_0x487b('0x3f')]:_0x435bbd[_0x487b('0x3e')];if(!_0xe1631b['query'][_0x487b('0x43')](_0x487b('0x44'))){_0x4d03e5[_0x487b('0x45')]=qs['limit'](_0xe1631b['query']['limit']);_0x4d03e5[_0x487b('0x2a')]=qs['offset'](_0xe1631b[_0x487b('0x3b')]['offset']);}_0x4d03e5[_0x487b('0x46')]=qs['sort'](_0xe1631b[_0x487b('0x3b')][_0x487b('0x47')]);_0x4d03e5[_0x487b('0x48')]=qs[_0x487b('0x3d')](_['pick'](_0xe1631b[_0x487b('0x3b')],_0x435bbd[_0x487b('0x3d')]),_0x417679);if(_0xe1631b[_0x487b('0x3b')]['filter']){_0x4d03e5[_0x487b('0x48')]=_[_0x487b('0x49')](_0x4d03e5[_0x487b('0x48')],{'$or':_['map'](_0x417679,function(_0x510ba7){if(_0x510ba7[_0x487b('0x4a')]!==_0x487b('0x4b')){var _0x362f61={};_0x362f61[_0x510ba7[_0x487b('0x35')]]={'$like':'%'+_0xe1631b[_0x487b('0x3b')][_0x487b('0x4c')]+'%'};return _0x362f61;}})});}_0x4d03e5=_[_0x487b('0x49')]({},_0x4d03e5,_0xe1631b['options']);var _0x3cd774={'where':_0x4d03e5['where']};return db[_0x487b('0x4d')]['count'](_0x3cd774)[_0x487b('0x1d')](function(_0x325c99){_0x40579d[_0x487b('0x2c')]=_0x325c99;if(_0xe1631b[_0x487b('0x3b')][_0x487b('0x4e')]){_0x4d03e5[_0x487b('0x4f')]=[{'all':!![]}];}return db[_0x487b('0x4d')]['findAll'](_0x4d03e5);})[_0x487b('0x1d')](function(_0x347e6b){_0x40579d['rows']=_0x347e6b;return _0x40579d;})['then'](respondWithFilteredResult(_0x62903d,_0x4d03e5))[_0x487b('0x27')](handleError(_0x62903d,null));};exports[_0x487b('0x50')]=function(_0x53ecab,_0x3a342d){var _0x88631a={'raw':!![],'where':{'id':_0x53ecab[_0x487b('0x51')]['id']}},_0x546461={};_0x546461[_0x487b('0x3e')]=_[_0x487b('0x3c')](db[_0x487b('0x4d')][_0x487b('0x39')]);_0x546461[_0x487b('0x3b')]=_[_0x487b('0x3c')](_0x53ecab[_0x487b('0x3b')]);_0x546461[_0x487b('0x3d')]=_[_0x487b('0x40')](_0x546461['model'],_0x546461[_0x487b('0x3b')]);_0x88631a[_0x487b('0x3f')]=_['intersection'](_0x546461[_0x487b('0x3e')],qs[_0x487b('0x41')](_0x53ecab[_0x487b('0x3b')][_0x487b('0x41')]));_0x88631a[_0x487b('0x3f')]=_0x88631a['attributes'][_0x487b('0x42')]?_0x88631a[_0x487b('0x3f')]:_0x546461['model'];if(_0x53ecab[_0x487b('0x3b')][_0x487b('0x4e')]){_0x88631a['include']=[{'all':!![]}];}_0x88631a=_['merge']({},_0x88631a,_0x53ecab[_0x487b('0x52')]);return db[_0x487b('0x4d')][_0x487b('0x53')](_0x88631a)[_0x487b('0x1d')](handleEntityNotFound(_0x3a342d,null))['then'](respondWithResult(_0x3a342d,null))[_0x487b('0x27')](handleError(_0x3a342d,null));};exports[_0x487b('0x32')]=function(_0xec9787,_0x2b5bf6){if(_0xec9787[_0x487b('0x54')]['id']){delete _0xec9787[_0x487b('0x54')]['id'];}return db[_0x487b('0x4d')][_0x487b('0x53')]({'where':{'id':_0xec9787[_0x487b('0x51')]['id']}})['then'](handleEntityNotFound(_0x2b5bf6,null))[_0x487b('0x1d')](saveUpdates(_0xec9787[_0x487b('0x54')],null))['then'](respondWithResult(_0x2b5bf6,null))[_0x487b('0x27')](handleError(_0x2b5bf6,null));};exports[_0x487b('0x33')]=function(_0x5b7ced,_0x4c3594){return db['FaxMessage'][_0x487b('0x53')]({'where':{'id':_0x5b7ced[_0x487b('0x51')]['id']}})[_0x487b('0x1d')](handleEntityNotFound(_0x4c3594,null))[_0x487b('0x1d')](removeEntity(_0x4c3594,null))[_0x487b('0x27')](handleError(_0x4c3594,null));};exports[_0x487b('0x55')]=function(_0x197adc,_0x3e80c0){return db['FaxMessage']['describe']()['then'](respondWithResult(_0x3e80c0,null))[_0x487b('0x27')](handleError(_0x3e80c0,null));};var interaction_log=require(_0x487b('0x10'))(_0x487b('0x56'));exports[_0x487b('0x57')]=function(_0xb5ce1d,_0x4a67f0,_0x15a4b1){var _0x172983={'agent':{},'channel':_0x487b('0x58')};if(_0xb5ce1d['body']['id']){delete _0xb5ce1d[_0x487b('0x54')]['id'];}_0xb5ce1d[_0x487b('0x54')][_0x487b('0x59')]=!![];_0xb5ce1d[_0x487b('0x54')]['readAt']=moment()[_0x487b('0x5a')](_0x487b('0x5b'));_0xb5ce1d[_0x487b('0x54')][_0x487b('0x5c')]=_0xb5ce1d['body'][_0x487b('0x5c')]||_0xb5ce1d[_0x487b('0x5d')]['id'];_0x172983[_0x487b('0x5e')]['id']=_0xb5ce1d['body'][_0x487b('0x5c')];return db[_0x487b('0x4d')][_0x487b('0x53')]({'where':{'id':_0xb5ce1d[_0x487b('0x51')]['id'],'UserId':null}})['then'](handleEntityNotFound(_0x4a67f0,null))[_0x487b('0x1d')](saveUpdates(_0xb5ce1d[_0x487b('0x54')],null))['then'](function(_0xe9a52c){if(_0xe9a52c){_0x172983[_0x487b('0x25')]=_0xe9a52c[_0x487b('0x5f')]({'plain':!![]});return db[_0x487b('0x60')]['find']({'where':{'id':_0xe9a52c[_0x487b('0x61')]}});}return null;})[_0x487b('0x1d')](handleEntityNotFound(_0x4a67f0,null))[_0x487b('0x1d')](function(_0x15591d){if(_0x15591d){return _0x15591d[_0x487b('0x32')]({'UserId':_0xb5ce1d[_0x487b('0x54')][_0x487b('0x5c')],'read1stAt':_[_0x487b('0x62')](_0x15591d[_0x487b('0x63')])?moment()[_0x487b('0x5a')](_0x487b('0x5b')):undefined});}return null;})[_0x487b('0x1d')](function(_0x2469bb){if(_0x2469bb){_0x172983['interaction']=_0x2469bb[_0x487b('0x5f')]({'plain':!![]});interaction_log[_0x487b('0x1e')](_0x487b('0x64'),_0xb5ce1d[_0x487b('0x5d')]['id'],_0xb5ce1d['user'][_0x487b('0x35')],_0xb5ce1d['user'][_0x487b('0x65')],_0x172983[_0x487b('0x66')]['id'],_0xb5ce1d[_0x487b('0x54')]?JSON[_0x487b('0x67')](_0xb5ce1d[_0x487b('0x54')]):_0x487b('0x68'));return respondWithRpcPromise(_0x487b('0x69'),'acceptMessage',_0x172983);}return null;})[_0x487b('0x1d')](function(_0xf80509){var _0x1ae02f=_0x487b('0x6a')+_0xf80509[_0x487b('0x25')]['ContactId'];return db['sequelize']['query'](_0x1ae02f,{'type':db[_0x487b('0x6b')]['QueryTypes']['SELECT'],'raw':!![]})[_0x487b('0x1d')](function(_0x3ed3e0){return _0x3ed3e0;});})[_0x487b('0x1d')](function(_0x5a81ac){if(_0x5a81ac){_0x172983[_0x487b('0x25')][_0x487b('0x6c')]=_0x5a81ac[0x0];if(!_0xb5ce1d['body'][_0x487b('0x5c')])return;return db['User']['find']({'where':{'id':_0xb5ce1d[_0x487b('0x54')][_0x487b('0x5c')],'role':'agent'},'attributes':['id',_0x487b('0x35'),'fullname','email',_0x487b('0x6d')],'raw':!![]});}return null;})[_0x487b('0x1d')](function(_0x4aba14){if(!_0x4aba14)return null;_0x172983[_0x487b('0x25')][_0x487b('0x5e')]=_0x4aba14;return _0x172983;})['then'](function(_0x4bfe91){if(_0x4bfe91){if(_0xb5ce1d[_0x487b('0x54')][_0x487b('0x6e')]){_0x172983['message'][_0x487b('0x6f')]=util[_0x487b('0x5a')]('SIP/%s',_0xb5ce1d[_0x487b('0x5d')][_0x487b('0x35')]);_0x172983[_0x487b('0x25')][_0x487b('0x70')]=_0x172983[_0x487b('0x70')];_0x172983[_0x487b('0x25')][_0x487b('0x71')]=_0x172983[_0x487b('0x70')];_0x172983[_0x487b('0x25')][_0x487b('0x72')]=_0x487b('0x57');return respondWithRpcPromise('EventManager',_0x487b('0x73'),{'event':'acceptmessage','message':_0x172983['message']},client9002)[_0x487b('0x1d')](function(){return _0x172983;});}return _0x172983;}return null;})['then'](respondWithResult(_0x4a67f0,null))[_0x487b('0x27')](handleError(_0x4a67f0,null));};var interaction_log=require(_0x487b('0x10'))('fax-interactions');exports[_0x487b('0x30')]=function(_0x189d02,_0x269d77,_0x1a7221){var _0x4222af={'agent':{},'channel':_0x487b('0x58')};if(_0x189d02['body']['id']){delete _0x189d02[_0x487b('0x54')]['id'];}_0x189d02['body'][_0x487b('0x5c')]=_0x189d02[_0x487b('0x54')][_0x487b('0x5c')]||_0x189d02[_0x487b('0x5d')]['id'];_0x4222af[_0x487b('0x5e')]['id']=_0x189d02[_0x487b('0x54')][_0x487b('0x5c')];return db[_0x487b('0x4d')][_0x487b('0x53')]({'where':{'id':_0x189d02[_0x487b('0x51')]['id'],'UserId':null}})[_0x487b('0x1d')](handleEntityNotFound(_0x269d77,null))[_0x487b('0x1d')](function(_0x10a110){if(_0x10a110){_0x4222af[_0x487b('0x25')]=_0x10a110[_0x487b('0x5f')]({'plain':!![]});return db[_0x487b('0x60')]['find']({'where':{'id':_0x10a110[_0x487b('0x61')]}});}return null;})[_0x487b('0x1d')](handleEntityNotFound(_0x269d77,null))[_0x487b('0x1d')](function(_0x1310e2){if(_0x1310e2){_0x4222af[_0x487b('0x66')]=_0x1310e2[_0x487b('0x5f')]({'plain':!![]});interaction_log[_0x487b('0x1e')]('[FAXMESSAGE:REJECT]\x20id=%s\x20name=%s\x20role=%s\x20interaction=%s\x20body=%s',_0x189d02['user']['id'],_0x189d02[_0x487b('0x5d')]['name'],_0x189d02[_0x487b('0x5d')][_0x487b('0x65')],_0x4222af['interaction']['id'],_0x189d02[_0x487b('0x54')]?JSON[_0x487b('0x67')](_0x189d02[_0x487b('0x54')]):'null');return respondWithRpcPromise(_0x487b('0x74'),_0x487b('0x75'),_0x4222af);}return null;})['then'](function(_0x5d6e5c){var _0x507626=_0x487b('0x6a')+_0x5d6e5c[_0x487b('0x25')]['ContactId'];return db['sequelize'][_0x487b('0x3b')](_0x507626,{'type':db[_0x487b('0x6b')][_0x487b('0x76')][_0x487b('0x77')],'raw':!![]})[_0x487b('0x1d')](function(_0x27419b){return _0x27419b;});})[_0x487b('0x1d')](function(_0xf528b4){if(_0xf528b4){_0x4222af['message'][_0x487b('0x6c')]=_0xf528b4[0x0];if(!_0x189d02[_0x487b('0x54')][_0x487b('0x5c')])return;return db[_0x487b('0x78')][_0x487b('0x53')]({'where':{'id':_0x189d02[_0x487b('0x54')][_0x487b('0x5c')],'role':_0x487b('0x5e')},'attributes':['id',_0x487b('0x35'),'fullname','email',_0x487b('0x6d')],'raw':!![]});}return null;})[_0x487b('0x1d')](function(_0x15f0e5){if(!_0x15f0e5)return null;_0x4222af[_0x487b('0x25')]['agent']=_0x15f0e5;return _0x4222af;})['then'](function(_0x33ea52){if(_0x33ea52){_0x33ea52[_0x487b('0x25')]['interface']=util[_0x487b('0x5a')](_0x487b('0x79'),_0x189d02[_0x487b('0x5d')][_0x487b('0x35')]);_0x33ea52['message'][_0x487b('0x70')]=_0x4222af[_0x487b('0x70')];_0x33ea52[_0x487b('0x25')][_0x487b('0x71')]=_0x4222af['channel'];_0x33ea52[_0x487b('0x25')][_0x487b('0x72')]=_0x487b('0x30');respondWithRpcPromise(_0x487b('0x73'),'EventManager',{'event':_0x487b('0x7a'),'message':_0x33ea52[_0x487b('0x25')]},client9002);return _0x4222af;}return null;})[_0x487b('0x1d')](respondWithResult(_0x269d77,null))[_0x487b('0x27')](handleError(_0x269d77,null));};exports[_0x487b('0x7b')]=function(_0x1931ca,_0x4fb20e){var _0x357474;return db[_0x487b('0x4d')][_0x487b('0x7b')](_0x1931ca[_0x487b('0x54')],{})[_0x487b('0x1d')](function(_0x4c242f){_0x357474=_0x4c242f;return db[_0x487b('0x7c')]['findOne']({'where':{'id':_0x357474[_0x487b('0x7d')]}});})['then'](function(_0x3754bf){if(_['isNil'](_0x3754bf)){return;}else{_0x357474['fax']=_0x3754bf[_0x487b('0x58')];return db[_0x487b('0x7e')][_0x487b('0x7f')]({'where':{'id':_0x357474[_0x487b('0x80')]}});}})['then'](function(_0x16a515){return respondWithRpcPromise(_0x487b('0x81'),_0x487b('0x81'),{'FaxAccountId':_[_0x487b('0x62')](_0x1931ca[_0x487b('0x54')])?undefined:_0x1931ca['body'][_0x487b('0x82')],'path':_[_0x487b('0x62')](_0x16a515)?undefined:util[_0x487b('0x5a')](_0x487b('0x83'),_0x16a515[_0x487b('0x84')]),'fax':_[_0x487b('0x62')](_0x357474[_0x487b('0x58')])?undefined:_0x357474[_0x487b('0x58')],'AttachmentId':_0x357474[_0x487b('0x80')]},client9002);})['then'](respondWithResult(_0x4fb20e,0xc9))[_0x487b('0x27')](handleError(_0x4fb20e,null));};exports['download']=function(_0x2627e4,_0x4285e0){var _0x353c57=path['join'](config[_0x487b('0x85')],'server',_0x487b('0x86'),_0x487b('0x87'));return db[_0x487b('0x4d')]['find']({'where':{'id':_0x2627e4[_0x487b('0x51')]['id']},'include':[{'model':db[_0x487b('0x7e')],'as':_0x487b('0x7e')}]})['then'](handleEntityNotFound(_0x4285e0,null))['then'](function(_0x494344){if(_0x494344){return _0x4285e0['download'](path[_0x487b('0x88')](_0x353c57,_0x494344[_0x487b('0x7e')]['basename']));}})['catch'](handleError(_0x4285e0,null));}; \ No newline at end of file diff --git a/server/api/faxMessage/faxMessage.events.js b/server/api/faxMessage/faxMessage.events.js index 75ade6b..26f1ad8 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 _0x9851=['save','update','remove','emit','hasOwnProperty','hook','exports','events','FaxMessage','setMaxListeners'];(function(_0x122ef9,_0x451d2a){var _0x42fba0=function(_0x17c9d3){while(--_0x17c9d3){_0x122ef9['push'](_0x122ef9['shift']());}};_0x42fba0(++_0x451d2a);}(_0x9851,0x1f1));var _0x1985=function(_0x321bb2,_0x202794){_0x321bb2=_0x321bb2-0x0;var _0x9c12ed=_0x9851[_0x321bb2];return _0x9c12ed;};'use strict';var EventEmitter=require(_0x1985('0x0'));var FaxMessage=require('../../mysqldb')['db'][_0x1985('0x1')];var FaxMessageEvents=new EventEmitter();FaxMessageEvents[_0x1985('0x2')](0x0);var events={'afterCreate':_0x1985('0x3'),'afterUpdate':_0x1985('0x4'),'afterDestroy':_0x1985('0x5')};function emitEvent(_0x2a6e0e){return function(_0x3a21f1,_0x1fd90c,_0x41df88){FaxMessageEvents[_0x1985('0x6')](_0x2a6e0e+':'+_0x3a21f1['id'],_0x3a21f1);FaxMessageEvents['emit'](_0x2a6e0e,_0x3a21f1);_0x41df88(null);};}for(var e in events){if(events[_0x1985('0x7')](e)){var event=events[e];FaxMessage[_0x1985('0x8')](e,emitEvent(event));}}module[_0x1985('0x9')]=FaxMessageEvents; \ No newline at end of file +var _0xd3c8=['hasOwnProperty','hook','exports','events','../../mysqldb','FaxMessage','setMaxListeners','save','remove','emit'];(function(_0x44d9ab,_0x76bc69){var _0x31485e=function(_0x1e44ce){while(--_0x1e44ce){_0x44d9ab['push'](_0x44d9ab['shift']());}};_0x31485e(++_0x76bc69);}(_0xd3c8,0x161));var _0x8d3c=function(_0x570a84,_0x404b16){_0x570a84=_0x570a84-0x0;var _0x3ae851=_0xd3c8[_0x570a84];return _0x3ae851;};'use strict';var EventEmitter=require(_0x8d3c('0x0'));var FaxMessage=require(_0x8d3c('0x1'))['db'][_0x8d3c('0x2')];var FaxMessageEvents=new EventEmitter();FaxMessageEvents[_0x8d3c('0x3')](0x0);var events={'afterCreate':_0x8d3c('0x4'),'afterUpdate':'update','afterDestroy':_0x8d3c('0x5')};function emitEvent(_0x80b4f1){return function(_0x5508fc,_0x11aff7,_0x5480ea){FaxMessageEvents[_0x8d3c('0x6')](_0x80b4f1+':'+_0x5508fc['id'],_0x5508fc);FaxMessageEvents[_0x8d3c('0x6')](_0x80b4f1,_0x5508fc);_0x5480ea(null);};}for(var e in events){if(events[_0x8d3c('0x7')](e)){var event=events[e];FaxMessage[_0x8d3c('0x8')](e,emitEvent(event));}}module[_0x8d3c('0x9')]=FaxMessageEvents; \ No newline at end of file diff --git a/server/api/faxMessage/faxMessage.model.js b/server/api/faxMessage/faxMessage.model.js index d367411..c705385 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 _0x3b43=['secret','isNil','UserId','FaxInteraction','findOne','then','update','catch','error','utf8mb4','utf8mb4_unicode_ci','lodash','util','../../config/logger','moment','path','rimraf','../../config/environment','./faxMessage.attributes','exports','define','FaxMessage','fti_fax_messages','models','get','direction','toLowerCase'];(function(_0x10265e,_0xf3d38c){var _0x491c0e=function(_0x35b007){while(--_0x35b007){_0x10265e['push'](_0x10265e['shift']());}};_0x491c0e(++_0xf3d38c);}(_0x3b43,0x77));var _0x33b4=function(_0x5b1450,_0x3de747){_0x5b1450=_0x5b1450-0x0;var _0x3c39f2=_0x3b43[_0x5b1450];return _0x3c39f2;};'use strict';var _=require(_0x33b4('0x0'));var util=require(_0x33b4('0x1'));var logger=require(_0x33b4('0x2'))('api');var moment=require(_0x33b4('0x3'));var BPromise=require('bluebird');var rp=require('request-promise');var fs=require('fs');var path=require(_0x33b4('0x4'));var rimraf=require(_0x33b4('0x5'));var config=require(_0x33b4('0x6'));var attributes=require(_0x33b4('0x7'));module[_0x33b4('0x8')]=function(_0x249754,_0x5a46d5){return _0x249754[_0x33b4('0x9')](_0x33b4('0xa'),attributes,{'tableName':'fax_messages','paranoid':![],'indexes':[{'name':_0x33b4('0xb'),'fields':['body'],'type':'FULLTEXT'}],'timestamps':!![],'hooks':{'afterCreate':function(_0x2e3101,_0x55cd2b,_0x370753){var _0x4eab0b=_0x249754[_0x33b4('0xc')];var _0x7a9fb=_0x2e3101[_0x33b4('0xd')]({'plain':!![]});if(_0x7a9fb[_0x33b4('0xe')][_0x33b4('0xf')]()==='in'||_0x7a9fb[_0x33b4('0xe')][_0x33b4('0xf')]()==='out'&&!_0x7a9fb[_0x33b4('0x10')]&&!_[_0x33b4('0x11')](_0x7a9fb[_0x33b4('0x12')])){_0x4eab0b[_0x33b4('0x13')][_0x33b4('0x14')]({'where':{'id':_0x7a9fb['FaxInteractionId']}})[_0x33b4('0x15')](function(_0x347c76){if(_0x347c76){_0x347c76[_0x33b4('0x16')]({'lastMsgAt':_0x7a9fb['createdAt'],'lastMsgDirection':_0x7a9fb[_0x33b4('0xe')][_0x33b4('0xf')]()});}})[_0x33b4('0x17')](function(_0x48282e){console[_0x33b4('0x18')](_0x48282e);});}_0x370753();}},'charset':_0x33b4('0x19'),'collate':_0x33b4('0x1a')});}; \ No newline at end of file +var _0x93f2=['body','FULLTEXT','get','toLowerCase','direction','isNil','UserId','then','update','createdAt','catch','error','utf8mb4','utf8mb4_unicode_ci','lodash','util','../../config/logger','moment','bluebird','request-promise','path','rimraf','./faxMessage.attributes','exports','define','FaxMessage','fax_messages','fti_fax_messages'];(function(_0xbe200f,_0x4b50eb){var _0x192597=function(_0x106cfd){while(--_0x106cfd){_0xbe200f['push'](_0xbe200f['shift']());}};_0x192597(++_0x4b50eb);}(_0x93f2,0x1ea));var _0x293f=function(_0x36eaaa,_0x326732){_0x36eaaa=_0x36eaaa-0x0;var _0x461349=_0x93f2[_0x36eaaa];return _0x461349;};'use strict';var _=require(_0x293f('0x0'));var util=require(_0x293f('0x1'));var logger=require(_0x293f('0x2'))('api');var moment=require(_0x293f('0x3'));var BPromise=require(_0x293f('0x4'));var rp=require(_0x293f('0x5'));var fs=require('fs');var path=require(_0x293f('0x6'));var rimraf=require(_0x293f('0x7'));var config=require('../../config/environment');var attributes=require(_0x293f('0x8'));module[_0x293f('0x9')]=function(_0x11aa72,_0x1430be){return _0x11aa72[_0x293f('0xa')](_0x293f('0xb'),attributes,{'tableName':_0x293f('0xc'),'paranoid':![],'indexes':[{'name':_0x293f('0xd'),'fields':[_0x293f('0xe')],'type':_0x293f('0xf')}],'timestamps':!![],'hooks':{'afterCreate':function(_0x4fb348,_0x68389,_0x27e3ef){var _0x2ae1e5=_0x11aa72['models'];var _0x29b81f=_0x4fb348[_0x293f('0x10')]({'plain':!![]});if(_0x29b81f['direction'][_0x293f('0x11')]()==='in'||_0x29b81f[_0x293f('0x12')][_0x293f('0x11')]()==='out'&&!_0x29b81f['secret']&&!_[_0x293f('0x13')](_0x29b81f[_0x293f('0x14')])){_0x2ae1e5['FaxInteraction']['findOne']({'where':{'id':_0x29b81f['FaxInteractionId']}})[_0x293f('0x15')](function(_0x588d8f){if(_0x588d8f){_0x588d8f[_0x293f('0x16')]({'lastMsgAt':_0x29b81f[_0x293f('0x17')],'lastMsgDirection':_0x29b81f[_0x293f('0x12')][_0x293f('0x11')]()});}})[_0x293f('0x18')](function(_0x25a845){console[_0x293f('0x19')](_0x25a845);});}_0x27e3ef();}},'charset':_0x293f('0x1a'),'collate':_0x293f('0x1b')});}; \ No newline at end of file diff --git a/server/api/faxMessage/faxMessage.rpc.js b/server/api/faxMessage/faxMessage.rpc.js index bf1ef87..1a33d71 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 _0x668b=['./faxMessage.socket','register','then','info','FaxMessage,\x20%s,\x20%s','request\x20sent','debug','FaxMessage,\x20%s,\x20%s,\x20%s','stringify','error','code','message','catch','CreateFaxMessage','FaxMessage','create','body','raw','UpdateFaxMessage','update','options','where','attributes','limit','lodash','util','bluebird','randomstring','../../mysqldb','../../config/logger','rpc','../../config/environment','client','http','redis','defaults','localhost'];(function(_0x59685f,_0x32ddd0){var _0x174017=function(_0xc274fd){while(--_0xc274fd){_0x59685f['push'](_0x59685f['shift']());}};_0x174017(++_0x32ddd0);}(_0x668b,0x140));var _0xb668=function(_0x252328,_0x4c22f0){_0x252328=_0x252328-0x0;var _0xaa85b7=_0x668b[_0x252328];return _0xaa85b7;};'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});config[_0xb668('0xa')]=_[_0xb668('0xb')](config[_0xb668('0xa')],{'host':_0xb668('0xc'),'port':0x18eb});var socket=require('socket.io-emitter')(new Redis(config[_0xb668('0xa')]));require(_0xb668('0xd'))[_0xb668('0xe')](socket);function respondWithRpcPromise(_0x16d50d,_0x39b79c,_0x3606a7){return new BPromise(function(_0x45bc39,_0x3616e9){return client['request'](_0x16d50d,_0x3606a7)[_0xb668('0xf')](function(_0x27dbf7){logger[_0xb668('0x10')](_0xb668('0x11'),_0x39b79c,_0xb668('0x12'));logger[_0xb668('0x13')](_0xb668('0x14'),_0x39b79c,_0xb668('0x12'),JSON[_0xb668('0x15')](_0x27dbf7));if(_0x27dbf7[_0xb668('0x16')]){if(_0x27dbf7[_0xb668('0x16')][_0xb668('0x17')]===0x1f4){logger[_0xb668('0x16')](_0xb668('0x11'),_0x39b79c,_0x27dbf7[_0xb668('0x16')][_0xb668('0x18')]);return _0x3616e9(_0x27dbf7[_0xb668('0x16')][_0xb668('0x18')]);}logger[_0xb668('0x16')](_0xb668('0x11'),_0x39b79c,_0x27dbf7[_0xb668('0x16')][_0xb668('0x18')]);return _0x45bc39(_0x27dbf7['error'][_0xb668('0x18')]);}else{logger['info'](_0xb668('0x11'),_0x39b79c,_0xb668('0x12'));_0x45bc39(_0x27dbf7['result'][_0xb668('0x18')]);}})[_0xb668('0x19')](function(_0x53ff78){logger[_0xb668('0x16')]('FaxMessage,\x20%s,\x20%s',_0x39b79c,_0x53ff78);_0x3616e9(_0x53ff78);});});}exports[_0xb668('0x1a')]=function(_0x178a5d){var _0x253ba5=this;return new Promise(function(_0x12805a,_0x5d33ae){return db[_0xb668('0x1b')][_0xb668('0x1c')](_0x178a5d[_0xb668('0x1d')],{'raw':_0x178a5d['options']?_0x178a5d['options'][_0xb668('0x1e')]===undefined?!![]:![]:!![]})[_0xb668('0xf')](function(_0x517eee){logger[_0xb668('0x10')]('CreateFaxMessage',_0x178a5d);logger[_0xb668('0x13')]('CreateFaxMessage',_0x178a5d,JSON[_0xb668('0x15')](_0x517eee));_0x12805a(_0x517eee);})[_0xb668('0x19')](function(_0x3f84c7){logger[_0xb668('0x16')](_0xb668('0x1a'),_0x3f84c7[_0xb668('0x18')],_0x178a5d);_0x5d33ae(_0x253ba5['error'](0x1f4,_0x3f84c7[_0xb668('0x18')]));});});};exports[_0xb668('0x1f')]=function(_0x2ab8c2){var _0x49abfd=this;return new Promise(function(_0x5e0cee,_0xe62fce){return db[_0xb668('0x1b')][_0xb668('0x20')](_0x2ab8c2['body'],{'raw':_0x2ab8c2[_0xb668('0x21')]?_0x2ab8c2[_0xb668('0x21')][_0xb668('0x1e')]===undefined?!![]:![]:!![],'individualHooks':!![],'where':_0x2ab8c2['options']?_0x2ab8c2['options'][_0xb668('0x22')]||null:null,'attributes':_0x2ab8c2[_0xb668('0x21')]?_0x2ab8c2['options'][_0xb668('0x23')]||null:null,'limit':_0x2ab8c2[_0xb668('0x21')]?_0x2ab8c2[_0xb668('0x21')][_0xb668('0x24')]||null:null})[_0xb668('0xf')](function(_0x5f36b5){logger[_0xb668('0x10')](_0xb668('0x1f'),_0x2ab8c2);logger['debug'](_0xb668('0x1f'),_0x2ab8c2,JSON['stringify'](_0x5f36b5));_0x5e0cee(_0x5f36b5);})[_0xb668('0x19')](function(_0x406cc5){logger[_0xb668('0x16')](_0xb668('0x1f'),_0x406cc5[_0xb668('0x18')],_0x2ab8c2);_0xe62fce(_0x49abfd[_0xb668('0x16')](0x1f4,_0x406cc5[_0xb668('0x18')]));});});}; \ No newline at end of file +var _0x98a8=['randomstring','ioredis','../../mysqldb','../../config/logger','rpc','../../config/environment','jayson/promise','client','redis','socket.io-emitter','./faxMessage.socket','register','then','info','request\x20sent','debug','FaxMessage,\x20%s,\x20%s,\x20%s','error','code','FaxMessage,\x20%s,\x20%s','message','result','catch','CreateFaxMessage','FaxMessage','create','body','options','UpdateFaxMessage','update','raw','attributes','limit','stringify','lodash','util','moment','bluebird'];(function(_0x19e35c,_0x29cd1e){var _0x3e1fe8=function(_0x17258b){while(--_0x17258b){_0x19e35c['push'](_0x19e35c['shift']());}};_0x3e1fe8(++_0x29cd1e);}(_0x98a8,0x12c));var _0x898a=function(_0x3b7c48,_0x4a7f05){_0x3b7c48=_0x3b7c48-0x0;var _0x394932=_0x98a8[_0x3b7c48];return _0x394932;};'use strict';var _=require(_0x898a('0x0'));var util=require(_0x898a('0x1'));var moment=require(_0x898a('0x2'));var BPromise=require(_0x898a('0x3'));var rs=require(_0x898a('0x4'));var fs=require('fs');var Redis=require(_0x898a('0x5'));var db=require(_0x898a('0x6'))['db'];var utils=require('../../config/utils');var logger=require(_0x898a('0x7'))(_0x898a('0x8'));var config=require(_0x898a('0x9'));var jayson=require(_0x898a('0xa'));var client=jayson[_0x898a('0xb')]['http']({'port':0x232a});config[_0x898a('0xc')]=_['defaults'](config[_0x898a('0xc')],{'host':'localhost','port':0x18eb});var socket=require(_0x898a('0xd'))(new Redis(config[_0x898a('0xc')]));require(_0x898a('0xe'))[_0x898a('0xf')](socket);function respondWithRpcPromise(_0x3150df,_0x388a47,_0x42faa4){return new BPromise(function(_0x1a92de,_0x3806cb){return client['request'](_0x3150df,_0x42faa4)[_0x898a('0x10')](function(_0x502e95){logger[_0x898a('0x11')]('FaxMessage,\x20%s,\x20%s',_0x388a47,_0x898a('0x12'));logger[_0x898a('0x13')](_0x898a('0x14'),_0x388a47,'request\x20sent',JSON['stringify'](_0x502e95));if(_0x502e95['error']){if(_0x502e95[_0x898a('0x15')][_0x898a('0x16')]===0x1f4){logger[_0x898a('0x15')](_0x898a('0x17'),_0x388a47,_0x502e95[_0x898a('0x15')][_0x898a('0x18')]);return _0x3806cb(_0x502e95['error'][_0x898a('0x18')]);}logger['error'](_0x898a('0x17'),_0x388a47,_0x502e95['error'][_0x898a('0x18')]);return _0x1a92de(_0x502e95['error'][_0x898a('0x18')]);}else{logger['info'](_0x898a('0x17'),_0x388a47,_0x898a('0x12'));_0x1a92de(_0x502e95[_0x898a('0x19')]['message']);}})[_0x898a('0x1a')](function(_0x5960e0){logger['error'](_0x898a('0x17'),_0x388a47,_0x5960e0);_0x3806cb(_0x5960e0);});});}exports[_0x898a('0x1b')]=function(_0x58c3ab){var _0x4d374b=this;return new Promise(function(_0x12bc0f,_0x26449a){return db[_0x898a('0x1c')][_0x898a('0x1d')](_0x58c3ab[_0x898a('0x1e')],{'raw':_0x58c3ab[_0x898a('0x1f')]?_0x58c3ab[_0x898a('0x1f')]['raw']===undefined?!![]:![]:!![]})[_0x898a('0x10')](function(_0x50718e){logger[_0x898a('0x11')](_0x898a('0x1b'),_0x58c3ab);logger[_0x898a('0x13')](_0x898a('0x1b'),_0x58c3ab,JSON['stringify'](_0x50718e));_0x12bc0f(_0x50718e);})[_0x898a('0x1a')](function(_0x16c318){logger[_0x898a('0x15')](_0x898a('0x1b'),_0x16c318[_0x898a('0x18')],_0x58c3ab);_0x26449a(_0x4d374b[_0x898a('0x15')](0x1f4,_0x16c318['message']));});});};exports[_0x898a('0x20')]=function(_0x51d501){var _0x513c6b=this;return new Promise(function(_0x53ddb2,_0x3678be){return db[_0x898a('0x1c')][_0x898a('0x21')](_0x51d501[_0x898a('0x1e')],{'raw':_0x51d501[_0x898a('0x1f')]?_0x51d501[_0x898a('0x1f')][_0x898a('0x22')]===undefined?!![]:![]:!![],'individualHooks':!![],'where':_0x51d501[_0x898a('0x1f')]?_0x51d501[_0x898a('0x1f')]['where']||null:null,'attributes':_0x51d501['options']?_0x51d501['options'][_0x898a('0x23')]||null:null,'limit':_0x51d501[_0x898a('0x1f')]?_0x51d501[_0x898a('0x1f')][_0x898a('0x24')]||null:null})[_0x898a('0x10')](function(_0x560000){logger[_0x898a('0x11')](_0x898a('0x20'),_0x51d501);logger[_0x898a('0x13')](_0x898a('0x20'),_0x51d501,JSON[_0x898a('0x25')](_0x560000));_0x53ddb2(_0x560000);})[_0x898a('0x1a')](function(_0x494127){logger[_0x898a('0x15')](_0x898a('0x20'),_0x494127[_0x898a('0x18')],_0x51d501);_0x3678be(_0x513c6b[_0x898a('0x15')](0x1f4,_0x494127[_0x898a('0x18')]));});});}; \ No newline at end of file diff --git a/server/api/faxMessage/faxMessage.socket.js b/server/api/faxMessage/faxMessage.socket.js index 6011371..a195090 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 _0xda17=['emit','register','length','faxMessage:','./faxMessage.events','save'];(function(_0x23a6f3,_0x1378ac){var _0x53e9c2=function(_0x57245b){while(--_0x57245b){_0x23a6f3['push'](_0x23a6f3['shift']());}};_0x53e9c2(++_0x1378ac);}(_0xda17,0x196));var _0x7da1=function(_0x28947d,_0x4cc9c6){_0x28947d=_0x28947d-0x0;var _0x12d2ee=_0xda17[_0x28947d];return _0x12d2ee;};'use strict';var FaxMessageEvents=require(_0x7da1('0x0'));var events=[_0x7da1('0x1'),'remove','update'];function createListener(_0x589851,_0x49f9f2){return function(_0x4229ac){_0x49f9f2[_0x7da1('0x2')](_0x589851,_0x4229ac);};}function removeListener(_0x112edf,_0x218ef0){return function(){FaxMessageEvents['removeListener'](_0x112edf,_0x218ef0);};}exports[_0x7da1('0x3')]=function(_0x393c76){for(var _0xe92ec6=0x0,_0x1a44b6=events[_0x7da1('0x4')];_0xe92ec6<_0x1a44b6;_0xe92ec6++){var _0x2b336b=events[_0xe92ec6];var _0xbbf480=createListener(_0x7da1('0x5')+_0x2b336b,_0x393c76);FaxMessageEvents['on'](_0x2b336b,_0xbbf480);}}; \ No newline at end of file +var _0x96f1=['remove','emit','register','length','faxMessage:','./faxMessage.events','save'];(function(_0x2e8d02,_0x1aea36){var _0x462edc=function(_0xa940b6){while(--_0xa940b6){_0x2e8d02['push'](_0x2e8d02['shift']());}};_0x462edc(++_0x1aea36);}(_0x96f1,0x15c));var _0x196f=function(_0x2a1f1d,_0x28a1a3){_0x2a1f1d=_0x2a1f1d-0x0;var _0x26b480=_0x96f1[_0x2a1f1d];return _0x26b480;};'use strict';var FaxMessageEvents=require(_0x196f('0x0'));var events=[_0x196f('0x1'),_0x196f('0x2'),'update'];function createListener(_0xba879d,_0x19a7ea){return function(_0x2bc4ca){_0x19a7ea[_0x196f('0x3')](_0xba879d,_0x2bc4ca);};}function removeListener(_0x441d63,_0x471dfd){return function(){FaxMessageEvents['removeListener'](_0x441d63,_0x471dfd);};}exports[_0x196f('0x4')]=function(_0x3af0a4){for(var _0x42a2bd=0x0,_0x2bb2c6=events[_0x196f('0x5')];_0x42a2bd<_0x2bb2c6;_0x42a2bd++){var _0x5b9eb1=events[_0x42a2bd];var _0x418f37=createListener(_0x196f('0x6')+_0x5b9eb1,_0x3af0a4);FaxMessageEvents['on'](_0x5b9eb1,_0x418f37);}}; \ No newline at end of file diff --git a/server/api/faxMessage/index.js b/server/api/faxMessage/index.js index eb751f7..28ee074 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 _0x16d2=['./faxMessage.controller','get','isAuthenticated','index','/describe','describe','/:id','show','/:id/download','post','tracked','fax','faxmessage:create','create','put','update','/:id/accept','/:id/reject','reject','destroy','exports','multer','util','path','connect-timeout','express','Router','fs-extra','../../components/auth/service','../../components/interaction/service'];(function(_0x1fc122,_0x5e2c17){var _0xa2cb13=function(_0x263b13){while(--_0x263b13){_0x1fc122['push'](_0x1fc122['shift']());}};_0xa2cb13(++_0x5e2c17);}(_0x16d2,0x123));var _0x216d=function(_0x54108c,_0x55cb84){_0x54108c=_0x54108c-0x0;var _0x452ba7=_0x16d2[_0x54108c];return _0x452ba7;};'use strict';var multer=require(_0x216d('0x0'));var util=require(_0x216d('0x1'));var path=require(_0x216d('0x2'));var timeout=require(_0x216d('0x3'));var express=require(_0x216d('0x4'));var router=express[_0x216d('0x5')]();var fs_extra=require(_0x216d('0x6'));var auth=require(_0x216d('0x7'));var interaction=require(_0x216d('0x8'));var config=require('../../config/environment');var controller=require(_0x216d('0x9'));router[_0x216d('0xa')]('/',auth[_0x216d('0xb')](),controller[_0x216d('0xc')]);router[_0x216d('0xa')](_0x216d('0xd'),auth[_0x216d('0xb')](),controller[_0x216d('0xe')]);router['get'](_0x216d('0xf'),auth[_0x216d('0xb')](),controller[_0x216d('0x10')]);router[_0x216d('0xa')](_0x216d('0x11'),auth[_0x216d('0xb')](),controller['download']);router[_0x216d('0x12')]('/',auth['isAuthenticated'](),interaction[_0x216d('0x13')](_0x216d('0x14'),_0x216d('0x15')),controller[_0x216d('0x16')]);router[_0x216d('0x17')](_0x216d('0xf'),auth['isAuthenticated'](),controller[_0x216d('0x18')]);router['put'](_0x216d('0x19'),auth[_0x216d('0xb')](),controller['accept']);router[_0x216d('0x17')](_0x216d('0x1a'),auth['isAuthenticated'](),controller[_0x216d('0x1b')]);router['delete'](_0x216d('0xf'),auth[_0x216d('0xb')](),controller[_0x216d('0x1c')]);module[_0x216d('0x1d')]=router; \ No newline at end of file +var _0xc6d8=['describe','/:id','show','/:id/download','download','post','tracked','faxmessage:create','update','put','/:id/accept','accept','/:id/reject','delete','exports','multer','path','express','fs-extra','../../config/environment','./faxMessage.controller','get','isAuthenticated','index','/describe'];(function(_0x331987,_0x223efd){var _0x583e65=function(_0x5c7853){while(--_0x5c7853){_0x331987['push'](_0x331987['shift']());}};_0x583e65(++_0x223efd);}(_0xc6d8,0xd7));var _0x8c6d=function(_0x5f382f,_0x3f1432){_0x5f382f=_0x5f382f-0x0;var _0x3bb11b=_0xc6d8[_0x5f382f];return _0x3bb11b;};'use strict';var multer=require(_0x8c6d('0x0'));var util=require('util');var path=require(_0x8c6d('0x1'));var timeout=require('connect-timeout');var express=require(_0x8c6d('0x2'));var router=express['Router']();var fs_extra=require(_0x8c6d('0x3'));var auth=require('../../components/auth/service');var interaction=require('../../components/interaction/service');var config=require(_0x8c6d('0x4'));var controller=require(_0x8c6d('0x5'));router[_0x8c6d('0x6')]('/',auth[_0x8c6d('0x7')](),controller[_0x8c6d('0x8')]);router[_0x8c6d('0x6')](_0x8c6d('0x9'),auth['isAuthenticated'](),controller[_0x8c6d('0xa')]);router[_0x8c6d('0x6')](_0x8c6d('0xb'),auth['isAuthenticated'](),controller[_0x8c6d('0xc')]);router[_0x8c6d('0x6')](_0x8c6d('0xd'),auth[_0x8c6d('0x7')](),controller[_0x8c6d('0xe')]);router[_0x8c6d('0xf')]('/',auth[_0x8c6d('0x7')](),interaction[_0x8c6d('0x10')]('fax',_0x8c6d('0x11')),controller['create']);router['put'](_0x8c6d('0xb'),auth[_0x8c6d('0x7')](),controller[_0x8c6d('0x12')]);router[_0x8c6d('0x13')](_0x8c6d('0x14'),auth[_0x8c6d('0x7')](),controller[_0x8c6d('0x15')]);router[_0x8c6d('0x13')](_0x8c6d('0x16'),auth[_0x8c6d('0x7')](),controller['reject']);router[_0x8c6d('0x17')]('/:id',auth[_0x8c6d('0x7')](),controller['destroy']);module[_0x8c6d('0x18')]=router; \ No newline at end of file diff --git a/server/api/faxQueue/faxQueue.attributes.js b/server/api/faxQueue/faxQueue.attributes.js index 53244bf..c47e7f3 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 _0x0733=['ENUM','rrmemory','roundrobin','INTEGER','STRING','name'];(function(_0x305dcb,_0x56caad){var _0x2c001f=function(_0x30fc52){while(--_0x30fc52){_0x305dcb['push'](_0x305dcb['shift']());}};_0x2c001f(++_0x56caad);}(_0x0733,0xc4));var _0x3073=function(_0x38c862,_0x307a11){_0x38c862=_0x38c862-0x0;var _0x36cd2d=_0x0733[_0x38c862];return _0x36cd2d;};'use strict';var Sequelize=require('sequelize');module['exports']={'name':{'type':Sequelize[_0x3073('0x0')],'unique':_0x3073('0x1'),'allowNull':![],'validate':{'notEmpty':!![],'is':/^[A-Za-z0-9\.\_]+$/i}},'description':{'type':Sequelize[_0x3073('0x0')]},'timeout':{'type':Sequelize['INTEGER'],'allowNull':![],'validate':{'min':0x1,'max':0x20c49b}},'strategy':{'type':Sequelize[_0x3073('0x2')](_0x3073('0x3'),'beepall',_0x3073('0x4')),'allowNull':![]},'lastAgent':{'type':Sequelize[_0x3073('0x5')],'defaultValue':0x0}}; \ No newline at end of file +var _0xe51c=['STRING','name','INTEGER','ENUM','rrmemory','beepall','roundrobin','sequelize','exports'];(function(_0x9c86e1,_0x25594d){var _0x5d835a=function(_0x18b431){while(--_0x18b431){_0x9c86e1['push'](_0x9c86e1['shift']());}};_0x5d835a(++_0x25594d);}(_0xe51c,0xfa));var _0xce51=function(_0x9dd37c,_0x3e255e){_0x9dd37c=_0x9dd37c-0x0;var _0x2a522c=_0xe51c[_0x9dd37c];return _0x2a522c;};'use strict';var Sequelize=require(_0xce51('0x0'));module[_0xce51('0x1')]={'name':{'type':Sequelize[_0xce51('0x2')],'unique':_0xce51('0x3'),'allowNull':![],'validate':{'notEmpty':!![],'is':/^[A-Za-z0-9\.\_]+$/i}},'description':{'type':Sequelize[_0xce51('0x2')]},'timeout':{'type':Sequelize[_0xce51('0x4')],'allowNull':![],'validate':{'min':0x1,'max':0x20c49b}},'strategy':{'type':Sequelize[_0xce51('0x5')](_0xce51('0x6'),_0xce51('0x7'),_0xce51('0x8')),'allowNull':![]},'lastAgent':{'type':Sequelize[_0xce51('0x4')],'defaultValue':0x0}}; \ No newline at end of file diff --git a/server/api/faxQueue/faxQueue.controller.js b/server/api/faxQueue/faxQueue.controller.js index 6d6880d..30fdbe9 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 _0xed1f=['all','union','value','removeTeams','ids','isEmpty','removeAgents','addAgents','spread','userFaxQueue:remove','getAgents','bluebird','util','ioredis','../../config/logger','../../config/environment','../../mysqldb','redis','defaults','localhost','socket.io-emitter','./faxQueue.socket','register','sendStatus','end','status','offset','limit','undefined','count','Content-Range','json','then','destroy','get','FaxQueues','UserProfileResource','name','send','map','rawAttributes','fieldName','key','getOptions','FaxQueue','include','query','rows','catch','show','params','model','keys','filters','intersection','attributes','fields','includeAll','find','create','body','user','Unable\x20to\x20retrieve\x20the\x20current\x20user','role','UserProfileSection','userProfileId','error','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','describe','getMembers','findOne','length','hasOwnProperty','order','sort','where','FaxQueueId','filter','merge','options','findAll','findAndCountAll','UserId','faxPause','createdAt','format','%s/%s','getTeams','Team','pick','nolimit','addTeams','User','Agents','online','voicePause','interface','flatMap','transaction','each','UserFaxQueue','findOrCreate','forEach','emit','userFaxQueue:save','select','tq.TeamId','from','team_has_fax_queues','join','user_has_teams','FaxQueueId\x20=\x20?','clone','push','sequelize','QueryTypes','every','TeamId','includes'];(function(_0x4def83,_0x5277f9){var _0xa4c6bf=function(_0x490614){while(--_0x490614){_0x4def83['push'](_0x4def83['shift']());}};_0xa4c6bf(++_0x5277f9);}(_0xed1f,0x170));var _0xfed1=function(_0x44946b,_0xf874ec){_0x44946b=_0x44946b-0x0;var _0x249bc4=_0xed1f[_0x44946b];return _0x249bc4;};'use strict';var BPromise=require(_0xfed1('0x0'));var util=require(_0xfed1('0x1'));var _=require('lodash');var squel=require('squel');var Redis=require(_0xfed1('0x2'));var qs=require('../../components/parsers/qs');var logger=require(_0xfed1('0x3'))('api');var config=require(_0xfed1('0x4'));var db=require(_0xfed1('0x5'))['db'];config[_0xfed1('0x6')]=_[_0xfed1('0x7')](config[_0xfed1('0x6')],{'host':_0xfed1('0x8'),'port':0x18eb});var socket=require(_0xfed1('0x9'))(new Redis(config[_0xfed1('0x6')]));require(_0xfed1('0xa'))[_0xfed1('0xb')](socket);function respondWithStatusCode(_0x550f10,_0x416d28){_0x416d28=_0x416d28||0xcc;return function(_0x38d525){if(_0x38d525){return _0x550f10[_0xfed1('0xc')](_0x416d28);}return _0x550f10['status'](_0x416d28)[_0xfed1('0xd')]();};}function respondWithResult(_0x5e229a,_0x5d94ce){_0x5d94ce=_0x5d94ce||0xc8;return function(_0x469fde){if(_0x469fde){return _0x5e229a[_0xfed1('0xe')](_0x5d94ce)['json'](_0x469fde);}};}function respondWithFilteredResult(_0x58d008,_0x15547e){return function(_0x25c1f6){if(_0x25c1f6){var _0x55455d=typeof _0x15547e[_0xfed1('0xf')]==='undefined'&&typeof _0x15547e[_0xfed1('0x10')]===_0xfed1('0x11');var _0x445d36=_0x25c1f6[_0xfed1('0x12')];var _0x58277d=_0x55455d?0x0:_0x15547e[_0xfed1('0xf')];var _0x3754c2=_0x55455d?_0x25c1f6['count']:_0x15547e['offset']+_0x15547e[_0xfed1('0x10')];var _0x38f652;if(_0x3754c2>=_0x445d36){_0x3754c2=_0x445d36;_0x38f652=0xc8;}else{_0x38f652=0xce;}_0x58d008[_0xfed1('0xe')](_0x38f652);return _0x58d008['set'](_0xfed1('0x13'),_0x58277d+'-'+_0x3754c2+'/'+_0x445d36)[_0xfed1('0x14')](_0x25c1f6);}return null;};}function saveUpdates(_0x42d67c){return function(_0x36c72f){if(_0x36c72f){return _0x36c72f['update'](_0x42d67c)[_0xfed1('0x15')](function(_0x4c492e){return _0x4c492e;});}return null;};}function removeEntity(_0x34512d){return function(_0x2b4cd7){if(_0x2b4cd7){return _0x2b4cd7[_0xfed1('0x16')]()[_0xfed1('0x15')](function(){var _0x381c42=_0x2b4cd7[_0xfed1('0x17')]({'plain':!![]});var _0xfa0a41=_0xfed1('0x18');return db[_0xfed1('0x19')]['destroy']({'where':{'type':_0xfa0a41,'resourceId':_0x381c42['id']}})[_0xfed1('0x15')](function(){return _0x2b4cd7;});})['then'](function(){_0x34512d[_0xfed1('0xe')](0xcc)[_0xfed1('0xd')]();});}};}function handleEntityNotFound(_0x431e8b){return function(_0x3a159e){if(!_0x3a159e){_0x431e8b[_0xfed1('0xc')](0x194);}return _0x3a159e;};}function handleError(_0x4610fd,_0x1748f5){_0x1748f5=_0x1748f5||0x1f4;return function(_0x15965d){logger['error'](_0x15965d['stack']);if(_0x15965d[_0xfed1('0x1a')]){delete _0x15965d['name'];}_0x4610fd[_0xfed1('0xe')](_0x1748f5)[_0xfed1('0x1b')](_0x15965d);};}exports['index']=function(_0x2d99aa,_0x138656){var _0x472dbc={};var _0x5bce5d={'count':0x0,'rows':[]};var _0x1e8c3e=_[_0xfed1('0x1c')](db['FaxQueue'][_0xfed1('0x1d')],function(_0x40da7f){return{'name':_0x40da7f[_0xfed1('0x1e')],'type':_0x40da7f['type'][_0xfed1('0x1f')]};});_0x472dbc=qs[_0xfed1('0x20')](_0x1e8c3e,_0x2d99aa);var _0x45ee5c={'where':_0x472dbc['where']};return db[_0xfed1('0x21')][_0xfed1('0x12')](_0x45ee5c)[_0xfed1('0x15')](function(_0x1867f6){_0x5bce5d[_0xfed1('0x12')]=_0x1867f6;_0x472dbc[_0xfed1('0x22')]=qs['include'](_0x2d99aa[_0xfed1('0x23')]);return db[_0xfed1('0x21')]['findAll'](_0x472dbc);})[_0xfed1('0x15')](function(_0x3c971d){_0x5bce5d[_0xfed1('0x24')]=_0x3c971d;return _0x5bce5d;})['then'](respondWithFilteredResult(_0x138656,_0x472dbc))[_0xfed1('0x25')](handleError(_0x138656,null));};exports[_0xfed1('0x26')]=function(_0x419472,_0x1bf69b){var _0x4e96c0={'raw':!![],'where':{'id':_0x419472[_0xfed1('0x27')]['id']}},_0x28a57b={};_0x28a57b[_0xfed1('0x28')]=_[_0xfed1('0x29')](db[_0xfed1('0x21')]['rawAttributes']);_0x28a57b[_0xfed1('0x23')]=_[_0xfed1('0x29')](_0x419472[_0xfed1('0x23')]);_0x28a57b[_0xfed1('0x2a')]=_[_0xfed1('0x2b')](_0x28a57b[_0xfed1('0x28')],_0x28a57b[_0xfed1('0x23')]);_0x4e96c0[_0xfed1('0x2c')]=_['intersection'](_0x28a57b['model'],qs['fields'](_0x419472[_0xfed1('0x23')][_0xfed1('0x2d')]));_0x4e96c0['attributes']=_0x4e96c0[_0xfed1('0x2c')]['length']?_0x4e96c0['attributes']:_0x28a57b['model'];if(_0x419472[_0xfed1('0x23')][_0xfed1('0x2e')]){_0x4e96c0[_0xfed1('0x22')]=[{'all':!![]}];}_0x4e96c0=_['merge']({},_0x4e96c0,_0x419472['options']);return db[_0xfed1('0x21')][_0xfed1('0x2f')](_0x4e96c0)[_0xfed1('0x15')](handleEntityNotFound(_0x1bf69b,null))[_0xfed1('0x15')](respondWithResult(_0x1bf69b,null))[_0xfed1('0x25')](handleError(_0x1bf69b,null));};exports[_0xfed1('0x30')]=function(_0x2ab4f4,_0x50375a){return db[_0xfed1('0x21')]['create'](_0x2ab4f4[_0xfed1('0x31')],{})[_0xfed1('0x15')](function(_0x5c62c9){var _0x3adf16=_0x2ab4f4[_0xfed1('0x32')]['get']({'plain':!![]});if(!_0x3adf16)throw new Error(_0xfed1('0x33'));if(_0x3adf16[_0xfed1('0x34')]==='user'){var _0x54537b=_0x5c62c9[_0xfed1('0x17')]({'plain':!![]});var _0x2fd743=_0xfed1('0x18');return db[_0xfed1('0x35')]['find']({'where':{'name':_0x2fd743,'userProfileId':_0x3adf16[_0xfed1('0x36')]},'raw':!![]})['then'](function(_0x44ef72){if(_0x44ef72&&_0x44ef72['autoAssociation']===0x0){return db[_0xfed1('0x19')][_0xfed1('0x30')]({'name':_0x54537b[_0xfed1('0x1a')],'resourceId':_0x54537b['id'],'type':_0x44ef72[_0xfed1('0x1a')],'sectionId':_0x44ef72['id']},{})[_0xfed1('0x15')](function(){return _0x5c62c9;});}else{return _0x5c62c9;}})['catch'](function(_0x3edf0d){logger[_0xfed1('0x37')](_0xfed1('0x38'),_0x3edf0d);throw _0x3edf0d;});}return _0x5c62c9;})[_0xfed1('0x15')](respondWithResult(_0x50375a,0xc9))[_0xfed1('0x25')](handleError(_0x50375a,null));};exports['update']=function(_0x2bc41f,_0x1bac62){if(_0x2bc41f[_0xfed1('0x31')]['id']){delete _0x2bc41f[_0xfed1('0x31')]['id'];}return db[_0xfed1('0x21')][_0xfed1('0x2f')]({'where':{'id':_0x2bc41f[_0xfed1('0x27')]['id']}})['then'](handleEntityNotFound(_0x1bac62,null))[_0xfed1('0x15')](saveUpdates(_0x2bc41f['body'],null))[_0xfed1('0x15')](respondWithResult(_0x1bac62,null))[_0xfed1('0x25')](handleError(_0x1bac62,null));};exports[_0xfed1('0x16')]=function(_0x3ca279,_0x57808f){return db[_0xfed1('0x21')][_0xfed1('0x2f')]({'where':{'id':_0x3ca279['params']['id']}})[_0xfed1('0x15')](handleEntityNotFound(_0x57808f,null))[_0xfed1('0x15')](removeEntity(_0x57808f,null))['catch'](handleError(_0x57808f,null));};exports[_0xfed1('0x39')]=function(_0x2a2657,_0x202177){return db[_0xfed1('0x21')]['describe']()[_0xfed1('0x15')](respondWithResult(_0x202177,null))[_0xfed1('0x25')](handleError(_0x202177,null));};exports[_0xfed1('0x3a')]=function(_0x4fbb02,_0x5c6b66){var _0x50b00c={'raw':!![],'where':{}},_0x5799e5={},_0x1b22b3;return db[_0xfed1('0x21')][_0xfed1('0x3b')]({'where':{'id':_0x4fbb02[_0xfed1('0x27')]['id']}})[_0xfed1('0x15')](handleEntityNotFound(_0x5c6b66,null))['then'](function(_0x4a8015){if(_0x4a8015){_0x1b22b3=_0x4a8015[_0xfed1('0x17')]({'plain':!![]});_0x5799e5[_0xfed1('0x28')]=_[_0xfed1('0x29')](db['UserFaxQueue']['rawAttributes']);_0x5799e5[_0xfed1('0x23')]=_[_0xfed1('0x29')](_0x4fbb02[_0xfed1('0x23')]);_0x5799e5[_0xfed1('0x2a')]=_[_0xfed1('0x2b')](_0x5799e5[_0xfed1('0x28')],_0x5799e5['query']);_0x50b00c[_0xfed1('0x2c')]=_['intersection'](_0x5799e5[_0xfed1('0x28')],qs[_0xfed1('0x2d')](_0x4fbb02['query']['fields']));_0x50b00c[_0xfed1('0x2c')]=_0x50b00c[_0xfed1('0x2c')][_0xfed1('0x3c')]?_0x50b00c[_0xfed1('0x2c')]:_0x5799e5['model'];if(!_0x4fbb02[_0xfed1('0x23')][_0xfed1('0x3d')]('nolimit')){_0x50b00c[_0xfed1('0x10')]=qs[_0xfed1('0x10')](_0x4fbb02['query']['limit']);_0x50b00c[_0xfed1('0xf')]=qs[_0xfed1('0xf')](_0x4fbb02[_0xfed1('0x23')][_0xfed1('0xf')]);}_0x50b00c[_0xfed1('0x3e')]=qs[_0xfed1('0x3f')](_0x4fbb02[_0xfed1('0x23')]['sort']);_0x50b00c[_0xfed1('0x40')]=qs[_0xfed1('0x2a')](_['pick'](_0x4fbb02[_0xfed1('0x23')],_0x5799e5['filters']));_0x50b00c[_0xfed1('0x40')][_0xfed1('0x41')]=_0x4a8015['id'];if(_0x4fbb02['query'][_0xfed1('0x42')]){_0x50b00c[_0xfed1('0x40')]=_[_0xfed1('0x43')](_0x50b00c[_0xfed1('0x40')],{'$or':_[_0xfed1('0x1c')](_0x50b00c[_0xfed1('0x2c')],function(_0x2c2700){var _0x471ab0={};_0x471ab0[_0x2c2700]={'$like':'%'+_0x4fbb02['query']['filter']+'%'};return _0x471ab0;})});}_0x50b00c=_[_0xfed1('0x43')]({},_0x50b00c,_0x4fbb02[_0xfed1('0x44')]);return db['UserFaxQueue'][_0xfed1('0x45')](_0x50b00c);}})[_0xfed1('0x15')](function(_0x450882){if(_0x450882){return db['User'][_0xfed1('0x46')]({'where':{'id':_[_0xfed1('0x1c')](_0x450882,_0xfed1('0x47')),'role':'agent'},'attributes':['id',_0xfed1('0x1a'),_0xfed1('0x48'),'updatedAt',_0xfed1('0x49')]});}})[_0xfed1('0x15')](function(_0x3d95bd){if(_0x3d95bd){return{'count':_0x3d95bd[_0xfed1('0x12')],'rows':_[_0xfed1('0x1c')](_0x3d95bd['rows'],function(_0x5ea8b9){return{'membername':_0x5ea8b9[_0xfed1('0x1a')],'UserId':_0x5ea8b9['id'],'queue_name':_0x1b22b3['name'],'FaxQueueId':_0x1b22b3['id'],'interface':util[_0xfed1('0x4a')](_0xfed1('0x4b'),'SIP',_0x5ea8b9['name']),'penalty':0x0,'paused':_0x5ea8b9[_0xfed1('0x48')],'createdAt':_0x5ea8b9['createdAt'],'updatedAt':_0x5ea8b9['updatedAt']};})};}else{return{'count':0x0,'rows':[]};}})[_0xfed1('0x15')](respondWithFilteredResult(_0x5c6b66,_0x50b00c))['catch'](handleError(_0x5c6b66,null));};exports[_0xfed1('0x4c')]=function(_0x4c8b5b,_0x304bb1){var _0xa6305e={};var _0x337909={};var _0x65a784;var _0x5f1718;return db[_0xfed1('0x21')][_0xfed1('0x3b')]({'where':{'id':_0x4c8b5b[_0xfed1('0x27')]['id']}})['then'](handleEntityNotFound(_0x304bb1,null))[_0xfed1('0x15')](function(_0x18b4bd){if(_0x18b4bd){_0x65a784=_0x18b4bd;_0x337909['model']=_[_0xfed1('0x29')](db[_0xfed1('0x4d')][_0xfed1('0x1d')]);_0x337909[_0xfed1('0x23')]=_[_0xfed1('0x29')](_0x4c8b5b[_0xfed1('0x23')]);_0x337909[_0xfed1('0x2a')]=_[_0xfed1('0x2b')](_0x337909[_0xfed1('0x28')],_0x337909[_0xfed1('0x23')]);_0xa6305e[_0xfed1('0x2c')]=_['intersection'](_0x337909[_0xfed1('0x28')],qs['fields'](_0x4c8b5b[_0xfed1('0x23')]['fields']));_0xa6305e[_0xfed1('0x2c')]=_0xa6305e[_0xfed1('0x2c')][_0xfed1('0x3c')]?_0xa6305e['attributes']:_0x337909['model'];_0xa6305e[_0xfed1('0x3e')]=qs[_0xfed1('0x3f')](_0x4c8b5b[_0xfed1('0x23')][_0xfed1('0x3f')]);_0xa6305e[_0xfed1('0x40')]=qs['filters'](_[_0xfed1('0x4e')](_0x4c8b5b[_0xfed1('0x23')],_0x337909['filters']));if(_0x4c8b5b['query'][_0xfed1('0x42')]){_0xa6305e[_0xfed1('0x40')]=_[_0xfed1('0x43')](_0xa6305e[_0xfed1('0x40')],{'$or':_[_0xfed1('0x1c')](_0xa6305e[_0xfed1('0x2c')],function(_0x45b5f0){var _0x1f3828={};_0x1f3828[_0x45b5f0]={'$like':'%'+_0x4c8b5b[_0xfed1('0x23')]['filter']+'%'};return _0x1f3828;})});}_0xa6305e=_[_0xfed1('0x43')]({},_0xa6305e,_0x4c8b5b[_0xfed1('0x44')]);return _0x65a784['getTeams'](_0xa6305e);}})['then'](function(_0xce226a){if(_0xce226a){_0x5f1718=_0xce226a['length'];if(!_0x4c8b5b[_0xfed1('0x23')][_0xfed1('0x3d')](_0xfed1('0x4f'))){_0xa6305e[_0xfed1('0x10')]=qs[_0xfed1('0x10')](_0x4c8b5b[_0xfed1('0x23')]['limit']);_0xa6305e['offset']=qs['offset'](_0x4c8b5b[_0xfed1('0x23')][_0xfed1('0xf')]);}return _0x65a784[_0xfed1('0x4c')](_0xa6305e);}})['then'](function(_0x5652a0){if(_0x5652a0){return _0x5652a0?{'count':_0x5f1718,'rows':_0x5652a0}:null;}})[_0xfed1('0x15')](respondWithResult(_0x304bb1,null))[_0xfed1('0x25')](handleError(_0x304bb1,null));};exports[_0xfed1('0x50')]=function(_0x4e1f26,_0x285014){var _0x2ee4b1=_0x4e1f26[_0xfed1('0x31')]['ids'];return db[_0xfed1('0x4d')][_0xfed1('0x45')]({'where':{'id':_0x2ee4b1},'attributes':['id'],'include':[{'model':db[_0xfed1('0x51')],'as':_0xfed1('0x52'),'attributes':['id',_0xfed1('0x1a'),_0xfed1('0x53'),_0xfed1('0x54'),_0xfed1('0x55')],'raw':!![]}]})[_0xfed1('0x15')](function(_0x2062d3){if(_0x2062d3){var _0x531eaa=_[_0xfed1('0x56')](_0x2062d3,function(_0x280ae2){var _0x59bdd4=_0x280ae2['get']({'plain':!![]});return _0x59bdd4[_0xfed1('0x52')];});return db[_0xfed1('0x21')][_0xfed1('0x2f')]({'where':{'id':_0x4e1f26[_0xfed1('0x27')]['id']}})[_0xfed1('0x15')](function(_0x265822){return db['sequelize'][_0xfed1('0x57')](function(_0x367fad){return _0x265822[_0xfed1('0x50')](_0x2ee4b1,{'transaction':_0x367fad})[_0xfed1('0x15')](function(){return BPromise[_0xfed1('0x58')](_0x531eaa,function(_0x2db26c){return db[_0xfed1('0x59')][_0xfed1('0x5a')]({'where':{'UserId':_0x2db26c['id'],'FaxQueueId':_0x4e1f26[_0xfed1('0x27')]['id']},'transaction':_0x367fad});});})['then'](function(){_0x531eaa[_0xfed1('0x5b')](function(_0x75f30d){socket[_0xfed1('0x5c')](_0xfed1('0x5d'),{'UserId':_0x75f30d['id'],'FaxQueueId':_0x265822['id']});});});});});}})['then'](respondWithStatusCode(_0x285014,null))[_0xfed1('0x25')](handleError(_0x285014,null));};exports['removeTeams']=function(_0x9e89a,_0x7f2e29){return db[_0xfed1('0x4d')]['findAll']({'where':{'id':_0x9e89a[_0xfed1('0x23')]['ids']},'attributes':['id'],'include':[{'model':db['User'],'as':_0xfed1('0x52'),'attributes':['id'],'raw':!![]}]})['then'](handleEntityNotFound(_0x7f2e29,null))[_0xfed1('0x15')](function(_0x5f360a){var _0x5d0888=_[_0xfed1('0x1c')](_0x5f360a,'id');var _0x56b218=[];var _0x570d54=[];var _0x434342=squel[_0xfed1('0x5e')]();_0x434342['field'](_0xfed1('0x5f'))[_0xfed1('0x60')](_0xfed1('0x61'),'tq')[_0xfed1('0x62')](_0xfed1('0x63'),'ut','ut.TeamId\x20=\x20tq.TeamId')[_0xfed1('0x40')](_0xfed1('0x64'),_0x9e89a[_0xfed1('0x27')]['id']);for(var _0x9706ea=0x0;_0x9706ea<_0x5f360a['length'];_0x9706ea+=0x1){let _0x23011e=_0x5f360a[_0x9706ea];for(var _0x5d5b1e=0x0;_0x5d5b1e<_0x23011e[_0xfed1('0x52')][_0xfed1('0x3c')];_0x5d5b1e+=0x1){let _0x17e1d2=_0x23011e['Agents'][_0x5d5b1e];var _0x17073e=_0x434342[_0xfed1('0x65')]();_0x17073e[_0xfed1('0x40')]('ut.UserId\x20=\x20?',_0x17e1d2['id']);_0x570d54[_0xfed1('0x66')](db['sequelize'][_0xfed1('0x23')](_0x17073e['toString'](),{'type':db[_0xfed1('0x67')][_0xfed1('0x68')]['SELECT']})[_0xfed1('0x15')](function(_0x1e8080){if(_0x1e8080[_0xfed1('0x3c')]===0x1){return _0x17e1d2['id'];}else{var _0x58ce1d=_[_0xfed1('0x69')](_['map'](_0x1e8080,_0xfed1('0x6a')),function(_0x53e01c){return _[_0xfed1('0x6b')](_0x5d0888,_0x53e01c);});if(_0x58ce1d){return _0x17e1d2['id'];}}}));}}return BPromise[_0xfed1('0x6c')](_0x570d54)[_0xfed1('0x15')](function(_0x4368a6){_0x56b218=_(_0x56b218)[_0xfed1('0x6d')](_0x4368a6)['compact']()[_0xfed1('0x6e')]();return db[_0xfed1('0x21')][_0xfed1('0x2f')]({'where':{'id':_0x9e89a[_0xfed1('0x27')]['id']}})[_0xfed1('0x15')](function(_0x45e8ef){return db[_0xfed1('0x67')][_0xfed1('0x57')](function(_0x49f15c){return _0x45e8ef[_0xfed1('0x6f')](_0x9e89a[_0xfed1('0x23')][_0xfed1('0x70')],{'transaction':_0x49f15c})[_0xfed1('0x15')](function(){if(!_[_0xfed1('0x71')](_0x56b218)){return _0x45e8ef[_0xfed1('0x72')](_0x56b218,{'transaction':_0x49f15c});}})['then'](function(){_0x56b218['forEach'](function(_0x412e15){socket[_0xfed1('0x5c')]('userFaxQueue:remove',{'UserId':_0x412e15,'FaxQueueId':_0x45e8ef['id']});});});});});});})[_0xfed1('0x15')](respondWithStatusCode(_0x7f2e29,null))[_0xfed1('0x25')](handleError(_0x7f2e29,null));};exports['addAgents']=function(_0x1b5cdb,_0x241f59){return db[_0xfed1('0x21')][_0xfed1('0x2f')]({'where':{'id':_0x1b5cdb[_0xfed1('0x27')]['id']}})['then'](handleEntityNotFound(_0x241f59,null))[_0xfed1('0x15')](function(_0xaa9075){if(_0xaa9075){return _0xaa9075[_0xfed1('0x73')](_0x1b5cdb[_0xfed1('0x31')][_0xfed1('0x70')],_['omit'](_0x1b5cdb['body'],['ids','id'])||{})[_0xfed1('0x74')](function(_0x4d02a7){for(var _0x5c6973=0x0;_0x5c6973<_0x1b5cdb[_0xfed1('0x31')][_0xfed1('0x70')][_0xfed1('0x3c')];_0x5c6973+=0x1){socket[_0xfed1('0x5c')](_0xfed1('0x5d'),{'UserId':Number(_0x1b5cdb[_0xfed1('0x31')]['ids'][_0x5c6973]),'FaxQueueId':Number(_0x1b5cdb[_0xfed1('0x27')]['id'])});}return _0x4d02a7;});}})[_0xfed1('0x15')](respondWithResult(_0x241f59,null))[_0xfed1('0x25')](handleError(_0x241f59,null));};exports[_0xfed1('0x72')]=function(_0x5b4fdc,_0x11fc1b){return db[_0xfed1('0x21')][_0xfed1('0x2f')]({'where':{'id':_0x5b4fdc[_0xfed1('0x27')]['id']}})[_0xfed1('0x15')](handleEntityNotFound(_0x11fc1b,null))[_0xfed1('0x15')](function(_0x4232a6){if(_0x4232a6){return _0x4232a6['removeAgents'](_0x5b4fdc[_0xfed1('0x23')][_0xfed1('0x70')])[_0xfed1('0x15')](function(){if(_['isArray'](_0x5b4fdc[_0xfed1('0x23')][_0xfed1('0x70')])){for(var _0x1355ab=0x0;_0x1355ab<_0x5b4fdc[_0xfed1('0x23')][_0xfed1('0x70')][_0xfed1('0x3c')];_0x1355ab+=0x1){socket[_0xfed1('0x5c')](_0xfed1('0x75'),{'UserId':Number(_0x5b4fdc[_0xfed1('0x23')]['ids'][_0x1355ab]),'FaxQueueId':Number(_0x5b4fdc[_0xfed1('0x27')]['id'])});}}else{socket[_0xfed1('0x5c')](_0xfed1('0x75'),{'UserId':Number(_0x5b4fdc[_0xfed1('0x23')][_0xfed1('0x70')]),'FaxQueueId':Number(_0x5b4fdc[_0xfed1('0x27')]['id'])});}});}})[_0xfed1('0x15')](respondWithStatusCode(_0x11fc1b,null))[_0xfed1('0x25')](handleError(_0x11fc1b,null));};exports['getAgents']=function(_0x1e2145,_0x56c3ce){var _0x331192={};var _0x4ad3c7={};var _0x46f5d6;var _0x315e4e;return db[_0xfed1('0x21')][_0xfed1('0x3b')]({'where':{'id':_0x1e2145['params']['id']}})[_0xfed1('0x15')](handleEntityNotFound(_0x56c3ce,null))[_0xfed1('0x15')](function(_0x2c9feb){if(_0x2c9feb){_0x46f5d6=_0x2c9feb;_0x4ad3c7[_0xfed1('0x28')]=_[_0xfed1('0x29')](db['User'][_0xfed1('0x1d')]);_0x4ad3c7[_0xfed1('0x23')]=_['keys'](_0x1e2145[_0xfed1('0x23')]);_0x4ad3c7[_0xfed1('0x2a')]=_[_0xfed1('0x2b')](_0x4ad3c7[_0xfed1('0x28')],_0x4ad3c7['query']);_0x331192[_0xfed1('0x2c')]=_[_0xfed1('0x2b')](_0x4ad3c7['model'],qs[_0xfed1('0x2d')](_0x1e2145[_0xfed1('0x23')][_0xfed1('0x2d')]));_0x331192[_0xfed1('0x2c')]=_0x331192['attributes']['length']?_0x331192[_0xfed1('0x2c')]:_0x4ad3c7[_0xfed1('0x28')];_0x331192['order']=qs[_0xfed1('0x3f')](_0x1e2145[_0xfed1('0x23')][_0xfed1('0x3f')]);_0x331192[_0xfed1('0x40')]=qs[_0xfed1('0x2a')](_[_0xfed1('0x4e')](_0x1e2145[_0xfed1('0x23')],_0x4ad3c7['filters']));if(_0x1e2145[_0xfed1('0x23')][_0xfed1('0x42')]){_0x331192[_0xfed1('0x40')]=_[_0xfed1('0x43')](_0x331192[_0xfed1('0x40')],{'$or':_[_0xfed1('0x1c')](_0x331192[_0xfed1('0x2c')],function(_0x488698){var _0x30f7c9={};_0x30f7c9[_0x488698]={'$like':'%'+_0x1e2145['query'][_0xfed1('0x42')]+'%'};return _0x30f7c9;})});}_0x331192=_['merge']({},_0x331192,_0x1e2145[_0xfed1('0x44')]);return _0x46f5d6[_0xfed1('0x76')](_0x331192);}})[_0xfed1('0x15')](function(_0xfba67){if(_0xfba67){_0x315e4e=_0xfba67[_0xfed1('0x3c')];if(!_0x1e2145['query'][_0xfed1('0x3d')](_0xfed1('0x4f'))){_0x331192[_0xfed1('0x10')]=qs[_0xfed1('0x10')](_0x1e2145[_0xfed1('0x23')]['limit']);_0x331192[_0xfed1('0xf')]=qs[_0xfed1('0xf')](_0x1e2145[_0xfed1('0x23')]['offset']);}return _0x46f5d6[_0xfed1('0x76')](_0x331192);}})[_0xfed1('0x15')](function(_0x50f75c){if(_0x50f75c){return _0x50f75c?{'count':_0x315e4e,'rows':_0x50f75c}:null;}})['then'](respondWithResult(_0x56c3ce,null))[_0xfed1('0x25')](handleError(_0x56c3ce,null));}; \ No newline at end of file +var _0xa456=['map','rawAttributes','fieldName','type','key','where','FaxQueue','include','query','findAll','catch','show','model','keys','filters','intersection','attributes','fields','length','includeAll','merge','options','find','create','body','user','get','Unable\x20to\x20retrieve\x20the\x20current\x20user','role','userProfileId','params','describe','getMembers','findOne','UserFaxQueue','hasOwnProperty','nolimit','offset','order','sort','pick','FaxQueueId','findAndCountAll','UserId','agent','faxPause','createdAt','rows','%s/%s','SIP','Team','filter','getTeams','User','Agents','voicePause','interface','flatMap','sequelize','transaction','addTeams','each','findOrCreate','forEach','emit','userFaxQueue:save','removeTeams','ids','select','field','tq.TeamId','join','ut.TeamId\x20=\x20tq.TeamId','FaxQueueId\x20=\x20?','ut.UserId\x20=\x20?','push','SELECT','every','TeamId','includes','all','value','userFaxQueue:remove','addAgents','omit','removeAgents','isArray','getAgents','bluebird','util','lodash','squel','../../components/parsers/qs','../../config/logger','api','../../mysqldb','redis','defaults','socket.io-emitter','./faxQueue.socket','register','status','end','undefined','limit','count','set','update','then','destroy','FaxQueues','sendStatus','error','stack','name','send','index'];(function(_0x56515f,_0xb2c300){var _0x39425e=function(_0x34f549){while(--_0x34f549){_0x56515f['push'](_0x56515f['shift']());}};_0x39425e(++_0xb2c300);}(_0xa456,0x142));var _0x6a45=function(_0x59d89e,_0x55edf5){_0x59d89e=_0x59d89e-0x0;var _0x554e93=_0xa456[_0x59d89e];return _0x554e93;};'use strict';var BPromise=require(_0x6a45('0x0'));var util=require(_0x6a45('0x1'));var _=require(_0x6a45('0x2'));var squel=require(_0x6a45('0x3'));var Redis=require('ioredis');var qs=require(_0x6a45('0x4'));var logger=require(_0x6a45('0x5'))(_0x6a45('0x6'));var config=require('../../config/environment');var db=require(_0x6a45('0x7'))['db'];config[_0x6a45('0x8')]=_[_0x6a45('0x9')](config[_0x6a45('0x8')],{'host':'localhost','port':0x18eb});var socket=require(_0x6a45('0xa'))(new Redis(config[_0x6a45('0x8')]));require(_0x6a45('0xb'))[_0x6a45('0xc')](socket);function respondWithStatusCode(_0x3deb09,_0x4858df){_0x4858df=_0x4858df||0xcc;return function(_0x3a5c20){if(_0x3a5c20){return _0x3deb09['sendStatus'](_0x4858df);}return _0x3deb09[_0x6a45('0xd')](_0x4858df)[_0x6a45('0xe')]();};}function respondWithResult(_0x35ed96,_0x147679){_0x147679=_0x147679||0xc8;return function(_0x1249e4){if(_0x1249e4){return _0x35ed96['status'](_0x147679)['json'](_0x1249e4);}};}function respondWithFilteredResult(_0xe62823,_0x465b59){return function(_0x4b7f6d){if(_0x4b7f6d){var _0x5a39f6=typeof _0x465b59['offset']===_0x6a45('0xf')&&typeof _0x465b59[_0x6a45('0x10')]===_0x6a45('0xf');var _0x3f01f6=_0x4b7f6d[_0x6a45('0x11')];var _0x5a9f29=_0x5a39f6?0x0:_0x465b59['offset'];var _0x3a5d94=_0x5a39f6?_0x4b7f6d[_0x6a45('0x11')]:_0x465b59['offset']+_0x465b59[_0x6a45('0x10')];var _0x171176;if(_0x3a5d94>=_0x3f01f6){_0x3a5d94=_0x3f01f6;_0x171176=0xc8;}else{_0x171176=0xce;}_0xe62823[_0x6a45('0xd')](_0x171176);return _0xe62823[_0x6a45('0x12')]('Content-Range',_0x5a9f29+'-'+_0x3a5d94+'/'+_0x3f01f6)['json'](_0x4b7f6d);}return null;};}function saveUpdates(_0x49023f){return function(_0x396d7d){if(_0x396d7d){return _0x396d7d[_0x6a45('0x13')](_0x49023f)[_0x6a45('0x14')](function(_0x52a055){return _0x52a055;});}return null;};}function removeEntity(_0x379c22){return function(_0x102981){if(_0x102981){return _0x102981[_0x6a45('0x15')]()['then'](function(){var _0x52e7bf=_0x102981['get']({'plain':!![]});var _0x64f46b=_0x6a45('0x16');return db['UserProfileResource'][_0x6a45('0x15')]({'where':{'type':_0x64f46b,'resourceId':_0x52e7bf['id']}})[_0x6a45('0x14')](function(){return _0x102981;});})['then'](function(){_0x379c22[_0x6a45('0xd')](0xcc)[_0x6a45('0xe')]();});}};}function handleEntityNotFound(_0x46a13a){return function(_0x458b99){if(!_0x458b99){_0x46a13a[_0x6a45('0x17')](0x194);}return _0x458b99;};}function handleError(_0x487666,_0x5d990e){_0x5d990e=_0x5d990e||0x1f4;return function(_0x3faae5){logger[_0x6a45('0x18')](_0x3faae5[_0x6a45('0x19')]);if(_0x3faae5[_0x6a45('0x1a')]){delete _0x3faae5[_0x6a45('0x1a')];}_0x487666[_0x6a45('0xd')](_0x5d990e)[_0x6a45('0x1b')](_0x3faae5);};}exports[_0x6a45('0x1c')]=function(_0x316f6b,_0x18a5b8){var _0x1310d7={};var _0x46587a={'count':0x0,'rows':[]};var _0x5cd761=_[_0x6a45('0x1d')](db['FaxQueue'][_0x6a45('0x1e')],function(_0x25467d){return{'name':_0x25467d[_0x6a45('0x1f')],'type':_0x25467d[_0x6a45('0x20')][_0x6a45('0x21')]};});_0x1310d7=qs['getOptions'](_0x5cd761,_0x316f6b);var _0x2b8cc8={'where':_0x1310d7[_0x6a45('0x22')]};return db[_0x6a45('0x23')][_0x6a45('0x11')](_0x2b8cc8)[_0x6a45('0x14')](function(_0x227b6f){_0x46587a[_0x6a45('0x11')]=_0x227b6f;_0x1310d7[_0x6a45('0x24')]=qs['include'](_0x316f6b[_0x6a45('0x25')]);return db[_0x6a45('0x23')][_0x6a45('0x26')](_0x1310d7);})[_0x6a45('0x14')](function(_0x3b07a1){_0x46587a['rows']=_0x3b07a1;return _0x46587a;})[_0x6a45('0x14')](respondWithFilteredResult(_0x18a5b8,_0x1310d7))[_0x6a45('0x27')](handleError(_0x18a5b8,null));};exports[_0x6a45('0x28')]=function(_0x7c1be1,_0x4d5d0f){var _0x48e52a={'raw':!![],'where':{'id':_0x7c1be1['params']['id']}},_0x2a50dc={};_0x2a50dc[_0x6a45('0x29')]=_['keys'](db[_0x6a45('0x23')][_0x6a45('0x1e')]);_0x2a50dc[_0x6a45('0x25')]=_[_0x6a45('0x2a')](_0x7c1be1[_0x6a45('0x25')]);_0x2a50dc[_0x6a45('0x2b')]=_[_0x6a45('0x2c')](_0x2a50dc[_0x6a45('0x29')],_0x2a50dc[_0x6a45('0x25')]);_0x48e52a[_0x6a45('0x2d')]=_[_0x6a45('0x2c')](_0x2a50dc[_0x6a45('0x29')],qs[_0x6a45('0x2e')](_0x7c1be1['query'][_0x6a45('0x2e')]));_0x48e52a['attributes']=_0x48e52a[_0x6a45('0x2d')][_0x6a45('0x2f')]?_0x48e52a[_0x6a45('0x2d')]:_0x2a50dc[_0x6a45('0x29')];if(_0x7c1be1[_0x6a45('0x25')][_0x6a45('0x30')]){_0x48e52a['include']=[{'all':!![]}];}_0x48e52a=_[_0x6a45('0x31')]({},_0x48e52a,_0x7c1be1[_0x6a45('0x32')]);return db[_0x6a45('0x23')][_0x6a45('0x33')](_0x48e52a)[_0x6a45('0x14')](handleEntityNotFound(_0x4d5d0f,null))[_0x6a45('0x14')](respondWithResult(_0x4d5d0f,null))['catch'](handleError(_0x4d5d0f,null));};exports[_0x6a45('0x34')]=function(_0xbd573b,_0x5c76bd){return db[_0x6a45('0x23')][_0x6a45('0x34')](_0xbd573b[_0x6a45('0x35')],{})[_0x6a45('0x14')](function(_0x476176){var _0x50ebe0=_0xbd573b[_0x6a45('0x36')][_0x6a45('0x37')]({'plain':!![]});if(!_0x50ebe0)throw new Error(_0x6a45('0x38'));if(_0x50ebe0[_0x6a45('0x39')]===_0x6a45('0x36')){var _0x35c9dc=_0x476176[_0x6a45('0x37')]({'plain':!![]});var _0x59ce5a=_0x6a45('0x16');return db['UserProfileSection'][_0x6a45('0x33')]({'where':{'name':_0x59ce5a,'userProfileId':_0x50ebe0[_0x6a45('0x3a')]},'raw':!![]})[_0x6a45('0x14')](function(_0x2715dc){if(_0x2715dc&&_0x2715dc['autoAssociation']===0x0){return db['UserProfileResource'][_0x6a45('0x34')]({'name':_0x35c9dc[_0x6a45('0x1a')],'resourceId':_0x35c9dc['id'],'type':_0x2715dc['name'],'sectionId':_0x2715dc['id']},{})[_0x6a45('0x14')](function(){return _0x476176;});}else{return _0x476176;}})[_0x6a45('0x27')](function(_0x3bd926){logger[_0x6a45('0x18')]('Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s',_0x3bd926);throw _0x3bd926;});}return _0x476176;})['then'](respondWithResult(_0x5c76bd,0xc9))['catch'](handleError(_0x5c76bd,null));};exports['update']=function(_0xe90201,_0xb5d191){if(_0xe90201[_0x6a45('0x35')]['id']){delete _0xe90201[_0x6a45('0x35')]['id'];}return db[_0x6a45('0x23')][_0x6a45('0x33')]({'where':{'id':_0xe90201[_0x6a45('0x3b')]['id']}})[_0x6a45('0x14')](handleEntityNotFound(_0xb5d191,null))['then'](saveUpdates(_0xe90201[_0x6a45('0x35')],null))['then'](respondWithResult(_0xb5d191,null))['catch'](handleError(_0xb5d191,null));};exports[_0x6a45('0x15')]=function(_0x62ed79,_0x4da241){return db[_0x6a45('0x23')]['find']({'where':{'id':_0x62ed79[_0x6a45('0x3b')]['id']}})[_0x6a45('0x14')](handleEntityNotFound(_0x4da241,null))[_0x6a45('0x14')](removeEntity(_0x4da241,null))[_0x6a45('0x27')](handleError(_0x4da241,null));};exports['describe']=function(_0x1d6200,_0x25705e){return db[_0x6a45('0x23')][_0x6a45('0x3c')]()[_0x6a45('0x14')](respondWithResult(_0x25705e,null))['catch'](handleError(_0x25705e,null));};exports[_0x6a45('0x3d')]=function(_0x4b9de1,_0x39bf51){var _0x33da06={'raw':!![],'where':{}},_0x4887b9={},_0x1cab6f;return db[_0x6a45('0x23')][_0x6a45('0x3e')]({'where':{'id':_0x4b9de1[_0x6a45('0x3b')]['id']}})['then'](handleEntityNotFound(_0x39bf51,null))[_0x6a45('0x14')](function(_0x4f20c2){if(_0x4f20c2){_0x1cab6f=_0x4f20c2[_0x6a45('0x37')]({'plain':!![]});_0x4887b9['model']=_[_0x6a45('0x2a')](db[_0x6a45('0x3f')][_0x6a45('0x1e')]);_0x4887b9[_0x6a45('0x25')]=_['keys'](_0x4b9de1[_0x6a45('0x25')]);_0x4887b9[_0x6a45('0x2b')]=_[_0x6a45('0x2c')](_0x4887b9[_0x6a45('0x29')],_0x4887b9[_0x6a45('0x25')]);_0x33da06[_0x6a45('0x2d')]=_[_0x6a45('0x2c')](_0x4887b9[_0x6a45('0x29')],qs[_0x6a45('0x2e')](_0x4b9de1[_0x6a45('0x25')]['fields']));_0x33da06[_0x6a45('0x2d')]=_0x33da06[_0x6a45('0x2d')][_0x6a45('0x2f')]?_0x33da06[_0x6a45('0x2d')]:_0x4887b9['model'];if(!_0x4b9de1[_0x6a45('0x25')][_0x6a45('0x40')](_0x6a45('0x41'))){_0x33da06['limit']=qs['limit'](_0x4b9de1['query'][_0x6a45('0x10')]);_0x33da06[_0x6a45('0x42')]=qs[_0x6a45('0x42')](_0x4b9de1[_0x6a45('0x25')]['offset']);}_0x33da06[_0x6a45('0x43')]=qs[_0x6a45('0x44')](_0x4b9de1[_0x6a45('0x25')][_0x6a45('0x44')]);_0x33da06['where']=qs[_0x6a45('0x2b')](_[_0x6a45('0x45')](_0x4b9de1[_0x6a45('0x25')],_0x4887b9['filters']));_0x33da06['where'][_0x6a45('0x46')]=_0x4f20c2['id'];if(_0x4b9de1[_0x6a45('0x25')]['filter']){_0x33da06[_0x6a45('0x22')]=_[_0x6a45('0x31')](_0x33da06[_0x6a45('0x22')],{'$or':_[_0x6a45('0x1d')](_0x33da06[_0x6a45('0x2d')],function(_0x4b469b){var _0x58ec02={};_0x58ec02[_0x4b469b]={'$like':'%'+_0x4b9de1[_0x6a45('0x25')]['filter']+'%'};return _0x58ec02;})});}_0x33da06=_['merge']({},_0x33da06,_0x4b9de1['options']);return db[_0x6a45('0x3f')][_0x6a45('0x26')](_0x33da06);}})[_0x6a45('0x14')](function(_0xa5d68f){if(_0xa5d68f){return db['User'][_0x6a45('0x47')]({'where':{'id':_[_0x6a45('0x1d')](_0xa5d68f,_0x6a45('0x48')),'role':_0x6a45('0x49')},'attributes':['id',_0x6a45('0x1a'),_0x6a45('0x4a'),'updatedAt',_0x6a45('0x4b')]});}})[_0x6a45('0x14')](function(_0x37b1f6){if(_0x37b1f6){return{'count':_0x37b1f6[_0x6a45('0x11')],'rows':_[_0x6a45('0x1d')](_0x37b1f6[_0x6a45('0x4c')],function(_0x1e4a91){return{'membername':_0x1e4a91[_0x6a45('0x1a')],'UserId':_0x1e4a91['id'],'queue_name':_0x1cab6f[_0x6a45('0x1a')],'FaxQueueId':_0x1cab6f['id'],'interface':util['format'](_0x6a45('0x4d'),_0x6a45('0x4e'),_0x1e4a91[_0x6a45('0x1a')]),'penalty':0x0,'paused':_0x1e4a91['faxPause'],'createdAt':_0x1e4a91[_0x6a45('0x4b')],'updatedAt':_0x1e4a91['updatedAt']};})};}else{return{'count':0x0,'rows':[]};}})[_0x6a45('0x14')](respondWithFilteredResult(_0x39bf51,_0x33da06))[_0x6a45('0x27')](handleError(_0x39bf51,null));};exports['getTeams']=function(_0x3d676b,_0x1270f9){var _0x5ea08c={};var _0x9da93b={};var _0x124cdd;var _0x5175ff;return db['FaxQueue'][_0x6a45('0x3e')]({'where':{'id':_0x3d676b[_0x6a45('0x3b')]['id']}})[_0x6a45('0x14')](handleEntityNotFound(_0x1270f9,null))[_0x6a45('0x14')](function(_0x29a61d){if(_0x29a61d){_0x124cdd=_0x29a61d;_0x9da93b['model']=_['keys'](db[_0x6a45('0x4f')][_0x6a45('0x1e')]);_0x9da93b['query']=_[_0x6a45('0x2a')](_0x3d676b[_0x6a45('0x25')]);_0x9da93b[_0x6a45('0x2b')]=_[_0x6a45('0x2c')](_0x9da93b['model'],_0x9da93b[_0x6a45('0x25')]);_0x5ea08c[_0x6a45('0x2d')]=_[_0x6a45('0x2c')](_0x9da93b[_0x6a45('0x29')],qs[_0x6a45('0x2e')](_0x3d676b[_0x6a45('0x25')][_0x6a45('0x2e')]));_0x5ea08c[_0x6a45('0x2d')]=_0x5ea08c[_0x6a45('0x2d')][_0x6a45('0x2f')]?_0x5ea08c[_0x6a45('0x2d')]:_0x9da93b[_0x6a45('0x29')];_0x5ea08c[_0x6a45('0x43')]=qs[_0x6a45('0x44')](_0x3d676b[_0x6a45('0x25')][_0x6a45('0x44')]);_0x5ea08c[_0x6a45('0x22')]=qs[_0x6a45('0x2b')](_['pick'](_0x3d676b[_0x6a45('0x25')],_0x9da93b['filters']));if(_0x3d676b[_0x6a45('0x25')]['filter']){_0x5ea08c[_0x6a45('0x22')]=_[_0x6a45('0x31')](_0x5ea08c[_0x6a45('0x22')],{'$or':_[_0x6a45('0x1d')](_0x5ea08c[_0x6a45('0x2d')],function(_0x346f14){var _0x9cd01c={};_0x9cd01c[_0x346f14]={'$like':'%'+_0x3d676b[_0x6a45('0x25')][_0x6a45('0x50')]+'%'};return _0x9cd01c;})});}_0x5ea08c=_['merge']({},_0x5ea08c,_0x3d676b[_0x6a45('0x32')]);return _0x124cdd['getTeams'](_0x5ea08c);}})[_0x6a45('0x14')](function(_0x19fb23){if(_0x19fb23){_0x5175ff=_0x19fb23[_0x6a45('0x2f')];if(!_0x3d676b['query'][_0x6a45('0x40')](_0x6a45('0x41'))){_0x5ea08c[_0x6a45('0x10')]=qs[_0x6a45('0x10')](_0x3d676b[_0x6a45('0x25')][_0x6a45('0x10')]);_0x5ea08c[_0x6a45('0x42')]=qs['offset'](_0x3d676b['query'][_0x6a45('0x42')]);}return _0x124cdd[_0x6a45('0x51')](_0x5ea08c);}})[_0x6a45('0x14')](function(_0xf3ba74){if(_0xf3ba74){return _0xf3ba74?{'count':_0x5175ff,'rows':_0xf3ba74}:null;}})[_0x6a45('0x14')](respondWithResult(_0x1270f9,null))[_0x6a45('0x27')](handleError(_0x1270f9,null));};exports['addTeams']=function(_0x9692e1,_0x203378){var _0x4b7b44=_0x9692e1[_0x6a45('0x35')]['ids'];return db['Team']['findAll']({'where':{'id':_0x4b7b44},'attributes':['id'],'include':[{'model':db[_0x6a45('0x52')],'as':_0x6a45('0x53'),'attributes':['id',_0x6a45('0x1a'),'online',_0x6a45('0x54'),_0x6a45('0x55')],'raw':!![]}]})[_0x6a45('0x14')](function(_0x197c3a){if(_0x197c3a){var _0x3c329c=_[_0x6a45('0x56')](_0x197c3a,function(_0x3332f2){var _0x54381f=_0x3332f2['get']({'plain':!![]});return _0x54381f[_0x6a45('0x53')];});return db[_0x6a45('0x23')][_0x6a45('0x33')]({'where':{'id':_0x9692e1[_0x6a45('0x3b')]['id']}})[_0x6a45('0x14')](function(_0x4ec3db){return db[_0x6a45('0x57')][_0x6a45('0x58')](function(_0x1aacaa){return _0x4ec3db[_0x6a45('0x59')](_0x4b7b44,{'transaction':_0x1aacaa})[_0x6a45('0x14')](function(){return BPromise[_0x6a45('0x5a')](_0x3c329c,function(_0x2d0c64){return db['UserFaxQueue'][_0x6a45('0x5b')]({'where':{'UserId':_0x2d0c64['id'],'FaxQueueId':_0x9692e1[_0x6a45('0x3b')]['id']},'transaction':_0x1aacaa});});})['then'](function(){_0x3c329c[_0x6a45('0x5c')](function(_0x8e68ac){socket[_0x6a45('0x5d')](_0x6a45('0x5e'),{'UserId':_0x8e68ac['id'],'FaxQueueId':_0x4ec3db['id']});});});});});}})['then'](respondWithStatusCode(_0x203378,null))[_0x6a45('0x27')](handleError(_0x203378,null));};exports[_0x6a45('0x5f')]=function(_0x4d18cb,_0x45f49f){return db[_0x6a45('0x4f')][_0x6a45('0x26')]({'where':{'id':_0x4d18cb['query'][_0x6a45('0x60')]},'attributes':['id'],'include':[{'model':db[_0x6a45('0x52')],'as':_0x6a45('0x53'),'attributes':['id'],'raw':!![]}]})[_0x6a45('0x14')](handleEntityNotFound(_0x45f49f,null))[_0x6a45('0x14')](function(_0x59349e){var _0x8b1a91=_[_0x6a45('0x1d')](_0x59349e,'id');var _0x27b232=[];var _0x4193b6=[];var _0x4f26e7=squel[_0x6a45('0x61')]();_0x4f26e7[_0x6a45('0x62')](_0x6a45('0x63'))['from']('team_has_fax_queues','tq')[_0x6a45('0x64')]('user_has_teams','ut',_0x6a45('0x65'))[_0x6a45('0x22')](_0x6a45('0x66'),_0x4d18cb['params']['id']);for(var _0x5470c7=0x0;_0x5470c7<_0x59349e['length'];_0x5470c7+=0x1){let _0x3a802d=_0x59349e[_0x5470c7];for(var _0xfb7d56=0x0;_0xfb7d56<_0x3a802d[_0x6a45('0x53')][_0x6a45('0x2f')];_0xfb7d56+=0x1){let _0x3cfa02=_0x3a802d['Agents'][_0xfb7d56];var _0x3621f7=_0x4f26e7['clone']();_0x3621f7['where'](_0x6a45('0x67'),_0x3cfa02['id']);_0x4193b6[_0x6a45('0x68')](db[_0x6a45('0x57')][_0x6a45('0x25')](_0x3621f7['toString'](),{'type':db[_0x6a45('0x57')]['QueryTypes'][_0x6a45('0x69')]})[_0x6a45('0x14')](function(_0x1b5fc9){if(_0x1b5fc9[_0x6a45('0x2f')]===0x1){return _0x3cfa02['id'];}else{var _0x2fff47=_[_0x6a45('0x6a')](_[_0x6a45('0x1d')](_0x1b5fc9,_0x6a45('0x6b')),function(_0xc6b82b){return _[_0x6a45('0x6c')](_0x8b1a91,_0xc6b82b);});if(_0x2fff47){return _0x3cfa02['id'];}}}));}}return BPromise[_0x6a45('0x6d')](_0x4193b6)[_0x6a45('0x14')](function(_0x5f58e){_0x27b232=_(_0x27b232)['union'](_0x5f58e)['compact']()[_0x6a45('0x6e')]();return db['FaxQueue'][_0x6a45('0x33')]({'where':{'id':_0x4d18cb[_0x6a45('0x3b')]['id']}})[_0x6a45('0x14')](function(_0xc769ce){return db[_0x6a45('0x57')][_0x6a45('0x58')](function(_0x2f0287){return _0xc769ce[_0x6a45('0x5f')](_0x4d18cb['query'][_0x6a45('0x60')],{'transaction':_0x2f0287})['then'](function(){if(!_['isEmpty'](_0x27b232)){return _0xc769ce['removeAgents'](_0x27b232,{'transaction':_0x2f0287});}})[_0x6a45('0x14')](function(){_0x27b232[_0x6a45('0x5c')](function(_0x244e4e){socket[_0x6a45('0x5d')](_0x6a45('0x6f'),{'UserId':_0x244e4e,'FaxQueueId':_0xc769ce['id']});});});});});});})['then'](respondWithStatusCode(_0x45f49f,null))[_0x6a45('0x27')](handleError(_0x45f49f,null));};exports[_0x6a45('0x70')]=function(_0x384b67,_0x21e5d1){return db[_0x6a45('0x23')][_0x6a45('0x33')]({'where':{'id':_0x384b67[_0x6a45('0x3b')]['id']}})[_0x6a45('0x14')](handleEntityNotFound(_0x21e5d1,null))[_0x6a45('0x14')](function(_0x59fa27){if(_0x59fa27){return _0x59fa27['addAgents'](_0x384b67['body'][_0x6a45('0x60')],_[_0x6a45('0x71')](_0x384b67[_0x6a45('0x35')],[_0x6a45('0x60'),'id'])||{})['spread'](function(_0x571991){for(var _0x57ec63=0x0;_0x57ec63<_0x384b67[_0x6a45('0x35')]['ids']['length'];_0x57ec63+=0x1){socket['emit'](_0x6a45('0x5e'),{'UserId':Number(_0x384b67[_0x6a45('0x35')][_0x6a45('0x60')][_0x57ec63]),'FaxQueueId':Number(_0x384b67[_0x6a45('0x3b')]['id'])});}return _0x571991;});}})[_0x6a45('0x14')](respondWithResult(_0x21e5d1,null))['catch'](handleError(_0x21e5d1,null));};exports[_0x6a45('0x72')]=function(_0x5448aa,_0x187afd){return db[_0x6a45('0x23')][_0x6a45('0x33')]({'where':{'id':_0x5448aa[_0x6a45('0x3b')]['id']}})[_0x6a45('0x14')](handleEntityNotFound(_0x187afd,null))['then'](function(_0x5079b2){if(_0x5079b2){return _0x5079b2['removeAgents'](_0x5448aa[_0x6a45('0x25')][_0x6a45('0x60')])[_0x6a45('0x14')](function(){if(_[_0x6a45('0x73')](_0x5448aa[_0x6a45('0x25')][_0x6a45('0x60')])){for(var _0x25d84f=0x0;_0x25d84f<_0x5448aa[_0x6a45('0x25')][_0x6a45('0x60')]['length'];_0x25d84f+=0x1){socket[_0x6a45('0x5d')](_0x6a45('0x6f'),{'UserId':Number(_0x5448aa[_0x6a45('0x25')]['ids'][_0x25d84f]),'FaxQueueId':Number(_0x5448aa[_0x6a45('0x3b')]['id'])});}}else{socket['emit'](_0x6a45('0x6f'),{'UserId':Number(_0x5448aa[_0x6a45('0x25')][_0x6a45('0x60')]),'FaxQueueId':Number(_0x5448aa[_0x6a45('0x3b')]['id'])});}});}})[_0x6a45('0x14')](respondWithStatusCode(_0x187afd,null))['catch'](handleError(_0x187afd,null));};exports[_0x6a45('0x74')]=function(_0x5092a6,_0x3d39be){var _0x75e646={};var _0xf619b8={};var _0x10abf4;var _0x2b0379;return db[_0x6a45('0x23')][_0x6a45('0x3e')]({'where':{'id':_0x5092a6[_0x6a45('0x3b')]['id']}})[_0x6a45('0x14')](handleEntityNotFound(_0x3d39be,null))[_0x6a45('0x14')](function(_0x4b473e){if(_0x4b473e){_0x10abf4=_0x4b473e;_0xf619b8[_0x6a45('0x29')]=_[_0x6a45('0x2a')](db[_0x6a45('0x52')]['rawAttributes']);_0xf619b8[_0x6a45('0x25')]=_[_0x6a45('0x2a')](_0x5092a6[_0x6a45('0x25')]);_0xf619b8[_0x6a45('0x2b')]=_[_0x6a45('0x2c')](_0xf619b8['model'],_0xf619b8[_0x6a45('0x25')]);_0x75e646[_0x6a45('0x2d')]=_['intersection'](_0xf619b8[_0x6a45('0x29')],qs[_0x6a45('0x2e')](_0x5092a6[_0x6a45('0x25')][_0x6a45('0x2e')]));_0x75e646['attributes']=_0x75e646['attributes']['length']?_0x75e646['attributes']:_0xf619b8['model'];_0x75e646['order']=qs['sort'](_0x5092a6[_0x6a45('0x25')][_0x6a45('0x44')]);_0x75e646['where']=qs[_0x6a45('0x2b')](_[_0x6a45('0x45')](_0x5092a6[_0x6a45('0x25')],_0xf619b8[_0x6a45('0x2b')]));if(_0x5092a6[_0x6a45('0x25')][_0x6a45('0x50')]){_0x75e646['where']=_[_0x6a45('0x31')](_0x75e646[_0x6a45('0x22')],{'$or':_[_0x6a45('0x1d')](_0x75e646[_0x6a45('0x2d')],function(_0x454212){var _0x214768={};_0x214768[_0x454212]={'$like':'%'+_0x5092a6['query'][_0x6a45('0x50')]+'%'};return _0x214768;})});}_0x75e646=_[_0x6a45('0x31')]({},_0x75e646,_0x5092a6[_0x6a45('0x32')]);return _0x10abf4['getAgents'](_0x75e646);}})[_0x6a45('0x14')](function(_0x5732cf){if(_0x5732cf){_0x2b0379=_0x5732cf['length'];if(!_0x5092a6[_0x6a45('0x25')]['hasOwnProperty'](_0x6a45('0x41'))){_0x75e646[_0x6a45('0x10')]=qs[_0x6a45('0x10')](_0x5092a6[_0x6a45('0x25')][_0x6a45('0x10')]);_0x75e646[_0x6a45('0x42')]=qs[_0x6a45('0x42')](_0x5092a6[_0x6a45('0x25')]['offset']);}return _0x10abf4[_0x6a45('0x74')](_0x75e646);}})[_0x6a45('0x14')](function(_0x2bcde3){if(_0x2bcde3){return _0x2bcde3?{'count':_0x2b0379,'rows':_0x2bcde3}:null;}})['then'](respondWithResult(_0x3d39be,null))['catch'](handleError(_0x3d39be,null));}; \ No newline at end of file diff --git a/server/api/faxQueue/faxQueue.events.js b/server/api/faxQueue/faxQueue.events.js index 0ee2ce7..ed993d5 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 _0xedbe=['hook','exports','events','../../mysqldb','FaxQueue','setMaxListeners','save','update','emit','hasOwnProperty'];(function(_0x88cd7b,_0x4c884c){var _0x56fcc8=function(_0x513b3d){while(--_0x513b3d){_0x88cd7b['push'](_0x88cd7b['shift']());}};_0x56fcc8(++_0x4c884c);}(_0xedbe,0xac));var _0xeedb=function(_0x2eecd4,_0x384902){_0x2eecd4=_0x2eecd4-0x0;var _0x188916=_0xedbe[_0x2eecd4];return _0x188916;};'use strict';var EventEmitter=require(_0xeedb('0x0'));var FaxQueue=require(_0xeedb('0x1'))['db'][_0xeedb('0x2')];var FaxQueueEvents=new EventEmitter();FaxQueueEvents[_0xeedb('0x3')](0x0);var events={'afterCreate':_0xeedb('0x4'),'afterUpdate':_0xeedb('0x5'),'afterDestroy':'remove'};function emitEvent(_0x4d1125){return function(_0x1f74e0,_0x505eab,_0x1c78ba){FaxQueueEvents['emit'](_0x4d1125+':'+_0x1f74e0['id'],_0x1f74e0);FaxQueueEvents[_0xeedb('0x6')](_0x4d1125,_0x1f74e0);_0x1c78ba(null);};}for(var e in events){if(events[_0xeedb('0x7')](e)){var event=events[e];FaxQueue[_0xeedb('0x8')](e,emitEvent(event));}}module[_0xeedb('0x9')]=FaxQueueEvents; \ No newline at end of file +var _0x6c56=['update','remove','emit','hasOwnProperty','hook','exports','events','../../mysqldb','FaxQueue','setMaxListeners','save'];(function(_0x55de87,_0x21a0f1){var _0x33ae3a=function(_0x2d61ca){while(--_0x2d61ca){_0x55de87['push'](_0x55de87['shift']());}};_0x33ae3a(++_0x21a0f1);}(_0x6c56,0x74));var _0x66c5=function(_0x2f965f,_0x100aca){_0x2f965f=_0x2f965f-0x0;var _0x73f2b9=_0x6c56[_0x2f965f];return _0x73f2b9;};'use strict';var EventEmitter=require(_0x66c5('0x0'));var FaxQueue=require(_0x66c5('0x1'))['db'][_0x66c5('0x2')];var FaxQueueEvents=new EventEmitter();FaxQueueEvents[_0x66c5('0x3')](0x0);var events={'afterCreate':_0x66c5('0x4'),'afterUpdate':_0x66c5('0x5'),'afterDestroy':_0x66c5('0x6')};function emitEvent(_0x1103fa){return function(_0x45f50d,_0x5bfd2f,_0x1a8e49){FaxQueueEvents[_0x66c5('0x7')](_0x1103fa+':'+_0x45f50d['id'],_0x45f50d);FaxQueueEvents[_0x66c5('0x7')](_0x1103fa,_0x45f50d);_0x1a8e49(null);};}for(var e in events){if(events[_0x66c5('0x8')](e)){var event=events[e];FaxQueue[_0x66c5('0x9')](e,emitEvent(event));}}module[_0x66c5('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 d4bdcc6..5c5377e 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 _0x287c=['bluebird','path','../../config/environment','./faxQueue.attributes','exports','define','fax_queues','util','../../config/logger','api','moment'];(function(_0x5e28c2,_0x1e48ab){var _0x1a8cc6=function(_0x1218bf){while(--_0x1218bf){_0x5e28c2['push'](_0x5e28c2['shift']());}};_0x1a8cc6(++_0x1e48ab);}(_0x287c,0x1eb));var _0xc287=function(_0x436848,_0x3c4283){_0x436848=_0x436848-0x0;var _0x2ccc5f=_0x287c[_0x436848];return _0x2ccc5f;};'use strict';var _=require('lodash');var util=require(_0xc287('0x0'));var logger=require(_0xc287('0x1'))(_0xc287('0x2'));var moment=require(_0xc287('0x3'));var BPromise=require(_0xc287('0x4'));var rp=require('request-promise');var fs=require('fs');var path=require(_0xc287('0x5'));var rimraf=require('rimraf');var config=require(_0xc287('0x6'));var attributes=require(_0xc287('0x7'));module[_0xc287('0x8')]=function(_0x33a78e,_0xb0b21f){return _0x33a78e[_0xc287('0x9')]('FaxQueue',attributes,{'tableName':_0xc287('0xa'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0xa873=['api','request-promise','path','../../config/environment','./faxQueue.attributes','exports','define','fax_queues','util','../../config/logger'];(function(_0x327fd2,_0x22bb1a){var _0x30f4f3=function(_0x40a38e){while(--_0x40a38e){_0x327fd2['push'](_0x327fd2['shift']());}};_0x30f4f3(++_0x22bb1a);}(_0xa873,0x102));var _0x3a87=function(_0x45bbdf,_0x496987){_0x45bbdf=_0x45bbdf-0x0;var _0x1d544d=_0xa873[_0x45bbdf];return _0x1d544d;};'use strict';var _=require('lodash');var util=require(_0x3a87('0x0'));var logger=require(_0x3a87('0x1'))(_0x3a87('0x2'));var moment=require('moment');var BPromise=require('bluebird');var rp=require(_0x3a87('0x3'));var fs=require('fs');var path=require(_0x3a87('0x4'));var rimraf=require('rimraf');var config=require(_0x3a87('0x5'));var attributes=require(_0x3a87('0x6'));module[_0x3a87('0x7')]=function(_0x456333,_0x2c93af){return _0x456333[_0x3a87('0x8')]('FaxQueue',attributes,{'tableName':_0x3a87('0x9'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/faxQueue/faxQueue.rpc.js b/server/api/faxQueue/faxQueue.rpc.js index 345e4ef..25471cf 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 _0x8b49=['FaxQueue','where','then','lodash','moment','bluebird','randomstring','../../mysqldb','rpc','../../config/environment','jayson/promise','client','redis','socket.io-emitter','./faxQueue.socket','register','request','info','FaxQueue,\x20%s,\x20%s','request\x20sent','debug','FaxQueue,\x20%s,\x20%s,\x20%s','error','code','message','result','catch','GetFaxQueue','options','include','map','model','attributes','stringify','ShowFaxQueue'];(function(_0x2d7f0e,_0x3e6fbd){var _0x110b07=function(_0x557b00){while(--_0x557b00){_0x2d7f0e['push'](_0x2d7f0e['shift']());}};_0x110b07(++_0x3e6fbd);}(_0x8b49,0x184));var _0x98b4=function(_0x56d1ed,_0x237e84){_0x56d1ed=_0x56d1ed-0x0;var _0x1b282b=_0x8b49[_0x56d1ed];return _0x1b282b;};'use strict';var _=require(_0x98b4('0x0'));var util=require('util');var moment=require(_0x98b4('0x1'));var BPromise=require(_0x98b4('0x2'));var rs=require(_0x98b4('0x3'));var fs=require('fs');var Redis=require('ioredis');var db=require(_0x98b4('0x4'))['db'];var utils=require('../../config/utils');var logger=require('../../config/logger')(_0x98b4('0x5'));var config=require(_0x98b4('0x6'));var jayson=require(_0x98b4('0x7'));var client=jayson[_0x98b4('0x8')]['http']({'port':0x232a});config[_0x98b4('0x9')]=_['defaults'](config[_0x98b4('0x9')],{'host':'localhost','port':0x18eb});var socket=require(_0x98b4('0xa'))(new Redis(config[_0x98b4('0x9')]));require(_0x98b4('0xb'))[_0x98b4('0xc')](socket);function respondWithRpcPromise(_0x187a49,_0x2774eb,_0x3d0ad9){return new BPromise(function(_0x10349b,_0x299882){return client[_0x98b4('0xd')](_0x187a49,_0x3d0ad9)['then'](function(_0x2fa91b){logger[_0x98b4('0xe')](_0x98b4('0xf'),_0x2774eb,_0x98b4('0x10'));logger[_0x98b4('0x11')](_0x98b4('0x12'),_0x2774eb,'request\x20sent',JSON['stringify'](_0x2fa91b));if(_0x2fa91b['error']){if(_0x2fa91b[_0x98b4('0x13')][_0x98b4('0x14')]===0x1f4){logger['error'](_0x98b4('0xf'),_0x2774eb,_0x2fa91b[_0x98b4('0x13')]['message']);return _0x299882(_0x2fa91b[_0x98b4('0x13')][_0x98b4('0x15')]);}logger[_0x98b4('0x13')](_0x98b4('0xf'),_0x2774eb,_0x2fa91b['error'][_0x98b4('0x15')]);return _0x10349b(_0x2fa91b[_0x98b4('0x13')][_0x98b4('0x15')]);}else{logger['info'](_0x98b4('0xf'),_0x2774eb,'request\x20sent');_0x10349b(_0x2fa91b[_0x98b4('0x16')]['message']);}})[_0x98b4('0x17')](function(_0x28908b){logger[_0x98b4('0x13')](_0x98b4('0xf'),_0x2774eb,_0x28908b);_0x299882(_0x28908b);});});}exports[_0x98b4('0x18')]=function(_0x226d7e){var _0x3cb4ab=this;return new Promise(function(_0xc7ceef,_0x5d1a6c){return db['FaxQueue']['findAll']({'raw':_0x226d7e[_0x98b4('0x19')]?_0x226d7e[_0x98b4('0x19')]['raw']===undefined?!![]:![]:!![],'where':_0x226d7e[_0x98b4('0x19')]?_0x226d7e[_0x98b4('0x19')]['where']||null:null,'attributes':_0x226d7e['options']?_0x226d7e[_0x98b4('0x19')]['attributes']||null:null,'limit':_0x226d7e['options']?_0x226d7e[_0x98b4('0x19')]['limit']||null:null,'include':_0x226d7e[_0x98b4('0x19')]?_0x226d7e[_0x98b4('0x19')][_0x98b4('0x1a')]?_[_0x98b4('0x1b')](_0x226d7e[_0x98b4('0x19')][_0x98b4('0x1a')],function(_0xf2891d){return{'model':db[_0xf2891d[_0x98b4('0x1c')]],'as':_0xf2891d['as'],'attributes':_0xf2891d[_0x98b4('0x1d')],'include':_0xf2891d[_0x98b4('0x1a')]?_[_0x98b4('0x1b')](_0xf2891d['include'],function(_0x343e9e){return{'model':db[_0x343e9e['model']],'as':_0x343e9e['as'],'attributes':_0x343e9e[_0x98b4('0x1d')],'include':_0x343e9e[_0x98b4('0x1a')]?_[_0x98b4('0x1b')](_0x343e9e['include'],function(_0x354f80){return{'model':db[_0x354f80['model']],'as':_0x354f80['as'],'attributes':_0x354f80[_0x98b4('0x1d')]};}):[]};}):[]};}):[]:[]})['then'](function(_0xb2a4ef){logger[_0x98b4('0xe')]('GetFaxQueue',_0x226d7e);logger[_0x98b4('0x11')](_0x98b4('0x18'),_0x226d7e,JSON[_0x98b4('0x1e')](_0xb2a4ef));_0xc7ceef(_0xb2a4ef);})[_0x98b4('0x17')](function(_0x17712b){logger[_0x98b4('0x13')](_0x98b4('0x18'),_0x17712b[_0x98b4('0x15')],_0x226d7e);_0x5d1a6c(_0x3cb4ab[_0x98b4('0x13')](0x1f4,_0x17712b['message']));});});};exports[_0x98b4('0x1f')]=function(_0x1a3726){var _0x59fa02=this;return new Promise(function(_0x56d63b,_0x22b170){return db[_0x98b4('0x20')]['find']({'raw':_0x1a3726['options']?_0x1a3726[_0x98b4('0x19')]['raw']===undefined?!![]:![]:!![],'where':_0x1a3726[_0x98b4('0x19')]?_0x1a3726[_0x98b4('0x19')][_0x98b4('0x21')]||null:null,'attributes':_0x1a3726[_0x98b4('0x19')]?_0x1a3726[_0x98b4('0x19')]['attributes']||null:null,'include':_0x1a3726[_0x98b4('0x19')]?_0x1a3726[_0x98b4('0x19')]['include']?_['map'](_0x1a3726[_0x98b4('0x19')]['include'],function(_0x4bea79){return{'model':db[_0x4bea79[_0x98b4('0x1c')]],'as':_0x4bea79['as'],'attributes':_0x4bea79[_0x98b4('0x1d')],'include':_0x4bea79[_0x98b4('0x1a')]?_['map'](_0x4bea79[_0x98b4('0x1a')],function(_0x49f031){return{'model':db[_0x49f031[_0x98b4('0x1c')]],'as':_0x49f031['as'],'attributes':_0x49f031['attributes'],'include':_0x49f031[_0x98b4('0x1a')]?_[_0x98b4('0x1b')](_0x49f031[_0x98b4('0x1a')],function(_0x1b05fa){return{'model':db[_0x1b05fa['model']],'as':_0x1b05fa['as'],'attributes':_0x1b05fa[_0x98b4('0x1d')]};}):[]};}):[]};}):[]:[]})[_0x98b4('0x22')](function(_0x4f4628){logger[_0x98b4('0xe')]('ShowFaxQueue',_0x1a3726);logger[_0x98b4('0x11')]('ShowFaxQueue',_0x1a3726,JSON[_0x98b4('0x1e')](_0x4f4628));_0x56d63b(_0x4f4628);})[_0x98b4('0x17')](function(_0x21861d){logger[_0x98b4('0x13')](_0x98b4('0x1f'),_0x21861d[_0x98b4('0x15')],_0x1a3726);_0x22b170(_0x59fa02[_0x98b4('0x13')](0x1f4,_0x21861d[_0x98b4('0x15')]));});});}; \ No newline at end of file +var _0x6bf3=['../../config/logger','rpc','../../config/environment','client','http','defaults','redis','localhost','socket.io-emitter','register','request','info','FaxQueue,\x20%s,\x20%s','request\x20sent','debug','stringify','error','code','message','result','catch','GetFaxQueue','findAll','options','raw','attributes','limit','include','map','model','ShowFaxQueue','FaxQueue','find','where','then','lodash','util','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils'];(function(_0x57645b,_0x25f73a){var _0xe82f00=function(_0x526b4){while(--_0x526b4){_0x57645b['push'](_0x57645b['shift']());}};_0xe82f00(++_0x25f73a);}(_0x6bf3,0x125));var _0x36bf=function(_0x4bedf5,_0x267ec8){_0x4bedf5=_0x4bedf5-0x0;var _0x320ae2=_0x6bf3[_0x4bedf5];return _0x320ae2;};'use strict';var _=require(_0x36bf('0x0'));var util=require(_0x36bf('0x1'));var moment=require(_0x36bf('0x2'));var BPromise=require(_0x36bf('0x3'));var rs=require(_0x36bf('0x4'));var fs=require('fs');var Redis=require(_0x36bf('0x5'));var db=require(_0x36bf('0x6'))['db'];var utils=require(_0x36bf('0x7'));var logger=require(_0x36bf('0x8'))(_0x36bf('0x9'));var config=require(_0x36bf('0xa'));var jayson=require('jayson/promise');var client=jayson[_0x36bf('0xb')][_0x36bf('0xc')]({'port':0x232a});config['redis']=_[_0x36bf('0xd')](config[_0x36bf('0xe')],{'host':_0x36bf('0xf'),'port':0x18eb});var socket=require(_0x36bf('0x10'))(new Redis(config[_0x36bf('0xe')]));require('./faxQueue.socket')[_0x36bf('0x11')](socket);function respondWithRpcPromise(_0x32c5c8,_0xaf11c7,_0x13086b){return new BPromise(function(_0x1a9ea4,_0x56c9c6){return client[_0x36bf('0x12')](_0x32c5c8,_0x13086b)['then'](function(_0x60f921){logger[_0x36bf('0x13')](_0x36bf('0x14'),_0xaf11c7,_0x36bf('0x15'));logger[_0x36bf('0x16')]('FaxQueue,\x20%s,\x20%s,\x20%s',_0xaf11c7,'request\x20sent',JSON[_0x36bf('0x17')](_0x60f921));if(_0x60f921['error']){if(_0x60f921[_0x36bf('0x18')][_0x36bf('0x19')]===0x1f4){logger[_0x36bf('0x18')](_0x36bf('0x14'),_0xaf11c7,_0x60f921[_0x36bf('0x18')]['message']);return _0x56c9c6(_0x60f921[_0x36bf('0x18')][_0x36bf('0x1a')]);}logger[_0x36bf('0x18')]('FaxQueue,\x20%s,\x20%s',_0xaf11c7,_0x60f921[_0x36bf('0x18')]['message']);return _0x1a9ea4(_0x60f921[_0x36bf('0x18')][_0x36bf('0x1a')]);}else{logger['info']('FaxQueue,\x20%s,\x20%s',_0xaf11c7,_0x36bf('0x15'));_0x1a9ea4(_0x60f921[_0x36bf('0x1b')][_0x36bf('0x1a')]);}})[_0x36bf('0x1c')](function(_0x9fc53e){logger['error']('FaxQueue,\x20%s,\x20%s',_0xaf11c7,_0x9fc53e);_0x56c9c6(_0x9fc53e);});});}exports[_0x36bf('0x1d')]=function(_0x18e2ab){var _0x4a1614=this;return new Promise(function(_0x5a7a13,_0x5800b4){return db['FaxQueue'][_0x36bf('0x1e')]({'raw':_0x18e2ab[_0x36bf('0x1f')]?_0x18e2ab[_0x36bf('0x1f')][_0x36bf('0x20')]===undefined?!![]:![]:!![],'where':_0x18e2ab[_0x36bf('0x1f')]?_0x18e2ab['options']['where']||null:null,'attributes':_0x18e2ab['options']?_0x18e2ab[_0x36bf('0x1f')][_0x36bf('0x21')]||null:null,'limit':_0x18e2ab['options']?_0x18e2ab['options'][_0x36bf('0x22')]||null:null,'include':_0x18e2ab[_0x36bf('0x1f')]?_0x18e2ab['options'][_0x36bf('0x23')]?_[_0x36bf('0x24')](_0x18e2ab[_0x36bf('0x1f')][_0x36bf('0x23')],function(_0x44435f){return{'model':db[_0x44435f[_0x36bf('0x25')]],'as':_0x44435f['as'],'attributes':_0x44435f[_0x36bf('0x21')],'include':_0x44435f[_0x36bf('0x23')]?_['map'](_0x44435f['include'],function(_0x5a616e){return{'model':db[_0x5a616e[_0x36bf('0x25')]],'as':_0x5a616e['as'],'attributes':_0x5a616e[_0x36bf('0x21')],'include':_0x5a616e['include']?_[_0x36bf('0x24')](_0x5a616e[_0x36bf('0x23')],function(_0x112e26){return{'model':db[_0x112e26[_0x36bf('0x25')]],'as':_0x112e26['as'],'attributes':_0x112e26[_0x36bf('0x21')]};}):[]};}):[]};}):[]:[]})['then'](function(_0x10e0b6){logger[_0x36bf('0x13')]('GetFaxQueue',_0x18e2ab);logger[_0x36bf('0x16')](_0x36bf('0x1d'),_0x18e2ab,JSON[_0x36bf('0x17')](_0x10e0b6));_0x5a7a13(_0x10e0b6);})['catch'](function(_0x5b6c90){logger[_0x36bf('0x18')]('GetFaxQueue',_0x5b6c90[_0x36bf('0x1a')],_0x18e2ab);_0x5800b4(_0x4a1614['error'](0x1f4,_0x5b6c90[_0x36bf('0x1a')]));});});};exports[_0x36bf('0x26')]=function(_0x3f82f6){var _0x706837=this;return new Promise(function(_0x230947,_0x1c9b18){return db[_0x36bf('0x27')][_0x36bf('0x28')]({'raw':_0x3f82f6[_0x36bf('0x1f')]?_0x3f82f6[_0x36bf('0x1f')][_0x36bf('0x20')]===undefined?!![]:![]:!![],'where':_0x3f82f6[_0x36bf('0x1f')]?_0x3f82f6[_0x36bf('0x1f')][_0x36bf('0x29')]||null:null,'attributes':_0x3f82f6[_0x36bf('0x1f')]?_0x3f82f6[_0x36bf('0x1f')][_0x36bf('0x21')]||null:null,'include':_0x3f82f6[_0x36bf('0x1f')]?_0x3f82f6['options'][_0x36bf('0x23')]?_[_0x36bf('0x24')](_0x3f82f6['options'][_0x36bf('0x23')],function(_0xa580fd){return{'model':db[_0xa580fd[_0x36bf('0x25')]],'as':_0xa580fd['as'],'attributes':_0xa580fd['attributes'],'include':_0xa580fd[_0x36bf('0x23')]?_[_0x36bf('0x24')](_0xa580fd[_0x36bf('0x23')],function(_0x4f7c17){return{'model':db[_0x4f7c17[_0x36bf('0x25')]],'as':_0x4f7c17['as'],'attributes':_0x4f7c17[_0x36bf('0x21')],'include':_0x4f7c17[_0x36bf('0x23')]?_[_0x36bf('0x24')](_0x4f7c17[_0x36bf('0x23')],function(_0x24421e){return{'model':db[_0x24421e[_0x36bf('0x25')]],'as':_0x24421e['as'],'attributes':_0x24421e[_0x36bf('0x21')]};}):[]};}):[]};}):[]:[]})[_0x36bf('0x2a')](function(_0x2e1a48){logger['info']('ShowFaxQueue',_0x3f82f6);logger[_0x36bf('0x16')](_0x36bf('0x26'),_0x3f82f6,JSON['stringify'](_0x2e1a48));_0x230947(_0x2e1a48);})[_0x36bf('0x1c')](function(_0x1b16d6){logger[_0x36bf('0x18')]('ShowFaxQueue',_0x1b16d6[_0x36bf('0x1a')],_0x3f82f6);_0x1c9b18(_0x706837['error'](0x1f4,_0x1b16d6['message']));});});}; \ No newline at end of file diff --git a/server/api/faxQueue/faxQueue.socket.js b/server/api/faxQueue/faxQueue.socket.js index 3f2a531..03de473 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 _0xe9d5=['register','length','save','remove','update','removeListener'];(function(_0x4632ff,_0x9611e3){var _0x622d4f=function(_0x5aa184){while(--_0x5aa184){_0x4632ff['push'](_0x4632ff['shift']());}};_0x622d4f(++_0x9611e3);}(_0xe9d5,0x7a));var _0x5e9d=function(_0x35af98,_0x103f33){_0x35af98=_0x35af98-0x0;var _0x5f5a62=_0xe9d5[_0x35af98];return _0x5f5a62;};'use strict';var FaxQueueEvents=require('./faxQueue.events');var events=[_0x5e9d('0x0'),_0x5e9d('0x1'),_0x5e9d('0x2')];function createListener(_0x5e3f52,_0x13c072){return function(_0x2978bd){_0x13c072['emit'](_0x5e3f52,_0x2978bd);};}function removeListener(_0x110269,_0x42b25a){return function(){FaxQueueEvents[_0x5e9d('0x3')](_0x110269,_0x42b25a);};}exports[_0x5e9d('0x4')]=function(_0xd03241){for(var _0x2c25d9=0x0,_0x3ee79a=events[_0x5e9d('0x5')];_0x2c25d9<_0x3ee79a;_0x2c25d9++){var _0x43322e=events[_0x2c25d9];var _0x4e61d4=createListener('faxQueue:'+_0x43322e,_0xd03241);FaxQueueEvents['on'](_0x43322e,_0x4e61d4);}}; \ No newline at end of file +var _0x468a=['removeListener','length','faxQueue:','save','update','emit'];(function(_0x574162,_0x2425ea){var _0x39c245=function(_0x46653f){while(--_0x46653f){_0x574162['push'](_0x574162['shift']());}};_0x39c245(++_0x2425ea);}(_0x468a,0x13b));var _0xa468=function(_0x353f98,_0x19fb14){_0x353f98=_0x353f98-0x0;var _0x3ac28f=_0x468a[_0x353f98];return _0x3ac28f;};'use strict';var FaxQueueEvents=require('./faxQueue.events');var events=[_0xa468('0x0'),'remove',_0xa468('0x1')];function createListener(_0x51ee2a,_0x1bac35){return function(_0x56fa66){_0x1bac35[_0xa468('0x2')](_0x51ee2a,_0x56fa66);};}function removeListener(_0x64d61d,_0x532ba3){return function(){FaxQueueEvents[_0xa468('0x3')](_0x64d61d,_0x532ba3);};}exports['register']=function(_0x5c7646){for(var _0x3220f3=0x0,_0x13fb5f=events[_0xa468('0x4')];_0x3220f3<_0x13fb5f;_0x3220f3++){var _0x1ada54=events[_0x3220f3];var _0xcb45c0=createListener(_0xa468('0x5')+_0x1ada54,_0x5c7646);FaxQueueEvents['on'](_0x1ada54,_0xcb45c0);}}; \ No newline at end of file diff --git a/server/api/faxQueue/index.js b/server/api/faxQueue/index.js index a3e45d9..252f9b3 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 _0x3d04=['/:id','show','/:id/teams','getTeams','getAgents','create','post','addTeams','addAgents','put','destroy','removeTeams','delete','/:id/users','removeAgents','exports','multer','util','path','connect-timeout','express','Router','fs-extra','../../components/auth/service','../../config/environment','./faxQueue.controller','get','isAuthenticated','describe'];(function(_0xa04b5f,_0x55b8fe){var _0x145bce=function(_0x313572){while(--_0x313572){_0xa04b5f['push'](_0xa04b5f['shift']());}};_0x145bce(++_0x55b8fe);}(_0x3d04,0xbe));var _0x43d0=function(_0x5b644e,_0x2e5e07){_0x5b644e=_0x5b644e-0x0;var _0x49c6bf=_0x3d04[_0x5b644e];return _0x49c6bf;};'use strict';var multer=require(_0x43d0('0x0'));var util=require(_0x43d0('0x1'));var path=require(_0x43d0('0x2'));var timeout=require(_0x43d0('0x3'));var express=require(_0x43d0('0x4'));var router=express[_0x43d0('0x5')]();var fs_extra=require(_0x43d0('0x6'));var auth=require(_0x43d0('0x7'));var interaction=require('../../components/interaction/service');var config=require(_0x43d0('0x8'));var controller=require(_0x43d0('0x9'));router[_0x43d0('0xa')]('/',auth[_0x43d0('0xb')](),controller['index']);router['get']('/describe',auth['isAuthenticated'](),controller[_0x43d0('0xc')]);router[_0x43d0('0xa')](_0x43d0('0xd'),auth[_0x43d0('0xb')](),controller[_0x43d0('0xe')]);router['get']('/:id/members',auth[_0x43d0('0xb')](),controller['getMembers']);router['get'](_0x43d0('0xf'),auth[_0x43d0('0xb')](),controller[_0x43d0('0x10')]);router[_0x43d0('0xa')]('/:id/users',auth[_0x43d0('0xb')](),controller[_0x43d0('0x11')]);router['post']('/',auth[_0x43d0('0xb')](),controller[_0x43d0('0x12')]);router[_0x43d0('0x13')]('/:id/teams',auth[_0x43d0('0xb')](),controller[_0x43d0('0x14')]);router[_0x43d0('0x13')]('/:id/users',auth[_0x43d0('0xb')](),controller[_0x43d0('0x15')]);router[_0x43d0('0x16')](_0x43d0('0xd'),auth[_0x43d0('0xb')](),controller['update']);router['delete'](_0x43d0('0xd'),auth[_0x43d0('0xb')](),controller[_0x43d0('0x17')]);router['delete'](_0x43d0('0xf'),auth['isAuthenticated'](),controller[_0x43d0('0x18')]);router[_0x43d0('0x19')](_0x43d0('0x1a'),auth['isAuthenticated'](),controller[_0x43d0('0x1b')]);module[_0x43d0('0x1c')]=router; \ No newline at end of file +var _0x83d0=['show','/:id/members','getTeams','/:id/users','getAgents','post','/:id/teams','addTeams','addAgents','put','delete','destroy','removeTeams','removeAgents','exports','multer','util','path','connect-timeout','express','Router','../../components/auth/service','./faxQueue.controller','get','isAuthenticated','index','describe','/:id'];(function(_0x313df3,_0x4fca45){var _0x241d59=function(_0x452786){while(--_0x452786){_0x313df3['push'](_0x313df3['shift']());}};_0x241d59(++_0x4fca45);}(_0x83d0,0xb7));var _0x083d=function(_0x505c0a,_0x484e88){_0x505c0a=_0x505c0a-0x0;var _0x175594=_0x83d0[_0x505c0a];return _0x175594;};'use strict';var multer=require(_0x083d('0x0'));var util=require(_0x083d('0x1'));var path=require(_0x083d('0x2'));var timeout=require(_0x083d('0x3'));var express=require(_0x083d('0x4'));var router=express[_0x083d('0x5')]();var fs_extra=require('fs-extra');var auth=require(_0x083d('0x6'));var interaction=require('../../components/interaction/service');var config=require('../../config/environment');var controller=require(_0x083d('0x7'));router[_0x083d('0x8')]('/',auth[_0x083d('0x9')](),controller[_0x083d('0xa')]);router[_0x083d('0x8')]('/describe',auth['isAuthenticated'](),controller[_0x083d('0xb')]);router[_0x083d('0x8')](_0x083d('0xc'),auth['isAuthenticated'](),controller[_0x083d('0xd')]);router[_0x083d('0x8')](_0x083d('0xe'),auth[_0x083d('0x9')](),controller['getMembers']);router[_0x083d('0x8')]('/:id/teams',auth[_0x083d('0x9')](),controller[_0x083d('0xf')]);router['get'](_0x083d('0x10'),auth[_0x083d('0x9')](),controller[_0x083d('0x11')]);router[_0x083d('0x12')]('/',auth[_0x083d('0x9')](),controller['create']);router[_0x083d('0x12')](_0x083d('0x13'),auth['isAuthenticated'](),controller[_0x083d('0x14')]);router['post']('/:id/users',auth[_0x083d('0x9')](),controller[_0x083d('0x15')]);router[_0x083d('0x16')](_0x083d('0xc'),auth[_0x083d('0x9')](),controller['update']);router[_0x083d('0x17')]('/:id',auth[_0x083d('0x9')](),controller[_0x083d('0x18')]);router[_0x083d('0x17')](_0x083d('0x13'),auth[_0x083d('0x9')](),controller[_0x083d('0x19')]);router[_0x083d('0x17')](_0x083d('0x10'),auth[_0x083d('0x9')](),controller[_0x083d('0x1a')]);module[_0x083d('0x1b')]=router; \ No newline at end of file diff --git a/server/api/faxQueueReport/faxQueueReport.attributes.js b/server/api/faxQueueReport/faxQueueReport.attributes.js index c0ee188..9e69acc 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 _0x02e2=['STRING','DATE','moment'];(function(_0x3dd15e,_0x1f0015){var _0x231fd0=function(_0x4f680a){while(--_0x4f680a){_0x3dd15e['push'](_0x3dd15e['shift']());}};_0x231fd0(++_0x1f0015);}(_0x02e2,0x155));var _0x202e=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0x02e2[_0x3dd15e];return _0x231fd0;};'use strict';var moment=require(_0x202e('0x0'));var Sequelize=require('sequelize');module['exports']={'uniqueid':{'type':Sequelize[_0x202e('0x1')],'allowNull':![]},'from':{'type':Sequelize[_0x202e('0x1')]},'joinAt':{'type':Sequelize[_0x202e('0x2')]},'leaveAt':{'type':Sequelize[_0x202e('0x2')]},'acceptAt':{'type':Sequelize[_0x202e('0x2')]},'exitAt':{'type':Sequelize['DATE']},'reason':{'type':Sequelize[_0x202e('0x1')]}}; \ No newline at end of file +var _0x3705=['exports','STRING','DATE','moment','sequelize'];(function(_0x2c91e9,_0x2fb965){var _0x13f0ff=function(_0xb39edf){while(--_0xb39edf){_0x2c91e9['push'](_0x2c91e9['shift']());}};_0x13f0ff(++_0x2fb965);}(_0x3705,0xe9));var _0x5370=function(_0x178e48,_0x3c9509){_0x178e48=_0x178e48-0x0;var _0x440d7e=_0x3705[_0x178e48];return _0x440d7e;};'use strict';var moment=require(_0x5370('0x0'));var Sequelize=require(_0x5370('0x1'));module[_0x5370('0x2')]={'uniqueid':{'type':Sequelize[_0x5370('0x3')],'allowNull':![]},'from':{'type':Sequelize[_0x5370('0x3')]},'joinAt':{'type':Sequelize['DATE']},'leaveAt':{'type':Sequelize[_0x5370('0x4')]},'acceptAt':{'type':Sequelize[_0x5370('0x4')]},'exitAt':{'type':Sequelize[_0x5370('0x4')]},'reason':{'type':Sequelize[_0x5370('0x3')]}}; \ No newline at end of file diff --git a/server/api/faxQueueReport/faxQueueReport.controller.js b/server/api/faxQueueReport/faxQueueReport.controller.js index 65bb604..d4af4b7 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 _0x9aea=['lodash','squel','jsforce','desk.js','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/logger','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','sendStatus','end','json','offset','limit','undefined','status','Content-Range','apply','reject','destroy','then','error','stack','name','index','map','FaxQueueReport','rawAttributes','fieldName','type','query','keys','filters','intersection','model','attributes','fields','length','hasOwnProperty','nolimit','order','sort','where','pick','filter','merge','VIRTUAL','count','includeAll','findAll','rows','catch','show','params','include','options','create','body','update','find','describe','eml-format','zip-dir','request-promise','moment','mustache','util','path','sox','to-csv','fs-extra'];(function(_0x43fb3d,_0x3f4508){var _0x5f12b7=function(_0x4c107a){while(--_0x4c107a){_0x43fb3d['push'](_0x43fb3d['shift']());}};_0x5f12b7(++_0x3f4508);}(_0x9aea,0xdd));var _0xa9ae=function(_0x1e1124,_0x21dd42){_0x1e1124=_0x1e1124-0x0;var _0xe5c881=_0x9aea[_0x1e1124];return _0xe5c881;};'use strict';var emlformat=require(_0xa9ae('0x0'));var rimraf=require('rimraf');var zipdir=require(_0xa9ae('0x1'));var jsonpatch=require('fast-json-patch');var rp=require(_0xa9ae('0x2'));var moment=require(_0xa9ae('0x3'));var BPromise=require('bluebird');var Mustache=require(_0xa9ae('0x4'));var util=require(_0xa9ae('0x5'));var path=require(_0xa9ae('0x6'));var sox=require(_0xa9ae('0x7'));var csv=require(_0xa9ae('0x8'));var ejs=require('ejs');var fs=require('fs');var fs_extra=require(_0xa9ae('0x9'));var _=require(_0xa9ae('0xa'));var squel=require(_0xa9ae('0xb'));var crypto=require('crypto');var jsforce=require(_0xa9ae('0xc'));var deskjs=require(_0xa9ae('0xd'));var toCsv=require(_0xa9ae('0x8'));var querystring=require(_0xa9ae('0xe'));var Papa=require(_0xa9ae('0xf'));var Redis=require(_0xa9ae('0x10'));var authService=require(_0xa9ae('0x11'));var qs=require(_0xa9ae('0x12'));var as=require(_0xa9ae('0x13'));var hardwareService=require('../../config/license/hardware');var logger=require(_0xa9ae('0x14'))('api');var utils=require(_0xa9ae('0x15'));var config=require(_0xa9ae('0x16'));var licenseUtil=require(_0xa9ae('0x17'));var db=require(_0xa9ae('0x18'))['db'];function respondWithStatusCode(_0x35f861,_0x33a72f){_0x33a72f=_0x33a72f||0xcc;return function(_0xa34271){if(_0xa34271){return _0x35f861[_0xa9ae('0x19')](_0x33a72f);}return _0x35f861['status'](_0x33a72f)[_0xa9ae('0x1a')]();};}function respondWithResult(_0x365e90,_0x10882e){_0x10882e=_0x10882e||0xc8;return function(_0x3f7f61){if(_0x3f7f61){return _0x365e90['status'](_0x10882e)[_0xa9ae('0x1b')](_0x3f7f61);}};}function respondWithFilteredResult(_0x1ec742,_0x31c03e){return function(_0x40b756){if(_0x40b756){var _0x77b0a4=typeof _0x31c03e[_0xa9ae('0x1c')]==='undefined'&&typeof _0x31c03e[_0xa9ae('0x1d')]===_0xa9ae('0x1e');var _0x3e31d9=_0x40b756['count'];var _0x4dbb30=_0x77b0a4?0x0:_0x31c03e[_0xa9ae('0x1c')];var _0x581345=_0x77b0a4?_0x40b756['count']:_0x31c03e[_0xa9ae('0x1c')]+_0x31c03e[_0xa9ae('0x1d')];var _0xbfd2ff;if(_0x581345>=_0x3e31d9){_0x581345=_0x3e31d9;_0xbfd2ff=0xc8;}else{_0xbfd2ff=0xce;}_0x1ec742[_0xa9ae('0x1f')](_0xbfd2ff);return _0x1ec742['set'](_0xa9ae('0x20'),_0x4dbb30+'-'+_0x581345+'/'+_0x3e31d9)[_0xa9ae('0x1b')](_0x40b756);}return null;};}function patchUpdates(_0x39f133){return function(_0x688153){try{jsonpatch[_0xa9ae('0x21')](_0x688153,_0x39f133,!![]);}catch(_0x2e204d){return BPromise[_0xa9ae('0x22')](_0x2e204d);}return _0x688153['save']();};}function saveUpdates(_0xc021cf,_0x4ca9a9){return function(_0x49dca9){if(_0x49dca9){return _0x49dca9['update'](_0xc021cf)['then'](function(_0x1afd07){return _0x1afd07;});}return null;};}function removeEntity(_0x4edd55,_0x13fb05){return function(_0x5093ad){if(_0x5093ad){return _0x5093ad[_0xa9ae('0x23')]()[_0xa9ae('0x24')](function(){_0x4edd55[_0xa9ae('0x1f')](0xcc)[_0xa9ae('0x1a')]();});}};}function handleEntityNotFound(_0x12b061,_0x3f3f97){return function(_0x23c1ec){if(!_0x23c1ec){_0x12b061['sendStatus'](0x194);}return _0x23c1ec;};}function handleError(_0x3eb591,_0x3873aa){_0x3873aa=_0x3873aa||0x1f4;return function(_0x2aac9e){logger[_0xa9ae('0x25')](_0x2aac9e[_0xa9ae('0x26')]);if(_0x2aac9e[_0xa9ae('0x27')]){delete _0x2aac9e[_0xa9ae('0x27')];}_0x3eb591['status'](_0x3873aa)['send'](_0x2aac9e);};}exports[_0xa9ae('0x28')]=function(_0x3c324e,_0x3d1131){var _0x3d84d7={},_0x74cd94={},_0x54a821={'count':0x0,'rows':[]};var _0x52dd4f=_[_0xa9ae('0x29')](db[_0xa9ae('0x2a')][_0xa9ae('0x2b')],function(_0x3a48b7){return{'name':_0x3a48b7[_0xa9ae('0x2c')],'type':_0x3a48b7[_0xa9ae('0x2d')]['key']};});_0x74cd94['model']=_[_0xa9ae('0x29')](_0x52dd4f,_0xa9ae('0x27'));_0x74cd94[_0xa9ae('0x2e')]=_[_0xa9ae('0x2f')](_0x3c324e[_0xa9ae('0x2e')]);_0x74cd94[_0xa9ae('0x30')]=_[_0xa9ae('0x31')](_0x74cd94[_0xa9ae('0x32')],_0x74cd94['query']);_0x3d84d7[_0xa9ae('0x33')]=_['intersection'](_0x74cd94[_0xa9ae('0x32')],qs[_0xa9ae('0x34')](_0x3c324e[_0xa9ae('0x2e')]['fields']));_0x3d84d7[_0xa9ae('0x33')]=_0x3d84d7[_0xa9ae('0x33')][_0xa9ae('0x35')]?_0x3d84d7[_0xa9ae('0x33')]:_0x74cd94[_0xa9ae('0x32')];if(!_0x3c324e['query'][_0xa9ae('0x36')](_0xa9ae('0x37'))){_0x3d84d7[_0xa9ae('0x1d')]=qs['limit'](_0x3c324e['query'][_0xa9ae('0x1d')]);_0x3d84d7[_0xa9ae('0x1c')]=qs[_0xa9ae('0x1c')](_0x3c324e[_0xa9ae('0x2e')]['offset']);}_0x3d84d7[_0xa9ae('0x38')]=qs[_0xa9ae('0x39')](_0x3c324e[_0xa9ae('0x2e')][_0xa9ae('0x39')]);_0x3d84d7[_0xa9ae('0x3a')]=qs['filters'](_[_0xa9ae('0x3b')](_0x3c324e['query'],_0x74cd94[_0xa9ae('0x30')]),_0x52dd4f);if(_0x3c324e[_0xa9ae('0x2e')][_0xa9ae('0x3c')]){_0x3d84d7['where']=_[_0xa9ae('0x3d')](_0x3d84d7[_0xa9ae('0x3a')],{'$or':_[_0xa9ae('0x29')](_0x52dd4f,function(_0x48d36b){if(_0x48d36b[_0xa9ae('0x2d')]!==_0xa9ae('0x3e')){var _0x4e2001={};_0x4e2001[_0x48d36b[_0xa9ae('0x27')]]={'$like':'%'+_0x3c324e['query'][_0xa9ae('0x3c')]+'%'};return _0x4e2001;}})});}_0x3d84d7=_[_0xa9ae('0x3d')]({},_0x3d84d7,_0x3c324e['options']);var _0x37da9b={'where':_0x3d84d7[_0xa9ae('0x3a')]};return db[_0xa9ae('0x2a')][_0xa9ae('0x3f')](_0x37da9b)[_0xa9ae('0x24')](function(_0xf48d22){_0x54a821['count']=_0xf48d22;if(_0x3c324e[_0xa9ae('0x2e')][_0xa9ae('0x40')]){_0x3d84d7['include']=[{'all':!![]}];}return db['FaxQueueReport'][_0xa9ae('0x41')](_0x3d84d7);})[_0xa9ae('0x24')](function(_0xc4f775){_0x54a821[_0xa9ae('0x42')]=_0xc4f775;return _0x54a821;})['then'](respondWithFilteredResult(_0x3d1131,_0x3d84d7))[_0xa9ae('0x43')](handleError(_0x3d1131,null));};exports[_0xa9ae('0x44')]=function(_0x20dd83,_0x42dab2){var _0x23c91d={'raw':!![],'where':{'id':_0x20dd83[_0xa9ae('0x45')]['id']}},_0x2bef06={};_0x2bef06['model']=_[_0xa9ae('0x2f')](db[_0xa9ae('0x2a')]['rawAttributes']);_0x2bef06[_0xa9ae('0x2e')]=_['keys'](_0x20dd83[_0xa9ae('0x2e')]);_0x2bef06[_0xa9ae('0x30')]=_[_0xa9ae('0x31')](_0x2bef06[_0xa9ae('0x32')],_0x2bef06[_0xa9ae('0x2e')]);_0x23c91d[_0xa9ae('0x33')]=_[_0xa9ae('0x31')](_0x2bef06['model'],qs[_0xa9ae('0x34')](_0x20dd83[_0xa9ae('0x2e')]['fields']));_0x23c91d[_0xa9ae('0x33')]=_0x23c91d[_0xa9ae('0x33')][_0xa9ae('0x35')]?_0x23c91d[_0xa9ae('0x33')]:_0x2bef06[_0xa9ae('0x32')];if(_0x20dd83[_0xa9ae('0x2e')]['includeAll']){_0x23c91d[_0xa9ae('0x46')]=[{'all':!![]}];}_0x23c91d=_['merge']({},_0x23c91d,_0x20dd83[_0xa9ae('0x47')]);return db[_0xa9ae('0x2a')]['find'](_0x23c91d)['then'](handleEntityNotFound(_0x42dab2,null))[_0xa9ae('0x24')](respondWithResult(_0x42dab2,null))[_0xa9ae('0x43')](handleError(_0x42dab2,null));};exports[_0xa9ae('0x48')]=function(_0x47615f,_0x435c29){return db[_0xa9ae('0x2a')][_0xa9ae('0x48')](_0x47615f[_0xa9ae('0x49')],{})['then'](respondWithResult(_0x435c29,0xc9))['catch'](handleError(_0x435c29,null));};exports[_0xa9ae('0x4a')]=function(_0x3cf89c,_0x4efe55){if(_0x3cf89c[_0xa9ae('0x49')]['id']){delete _0x3cf89c[_0xa9ae('0x49')]['id'];}return db[_0xa9ae('0x2a')][_0xa9ae('0x4b')]({'where':{'id':_0x3cf89c[_0xa9ae('0x45')]['id']}})[_0xa9ae('0x24')](handleEntityNotFound(_0x4efe55,null))[_0xa9ae('0x24')](saveUpdates(_0x3cf89c[_0xa9ae('0x49')],null))['then'](respondWithResult(_0x4efe55,null))[_0xa9ae('0x43')](handleError(_0x4efe55,null));};exports[_0xa9ae('0x23')]=function(_0x5ea18d,_0x128f88){return db['FaxQueueReport']['find']({'where':{'id':_0x5ea18d['params']['id']}})[_0xa9ae('0x24')](handleEntityNotFound(_0x128f88,null))[_0xa9ae('0x24')](removeEntity(_0x128f88,null))['catch'](handleError(_0x128f88,null));};exports['describe']=function(_0x4e537d,_0x36e072){return db['FaxQueueReport'][_0xa9ae('0x4c')]()[_0xa9ae('0x24')](respondWithResult(_0x36e072,null))['catch'](handleError(_0x36e072,null));}; \ No newline at end of file +var _0xcab6=['body','describe','eml-format','zip-dir','fast-json-patch','request-promise','moment','bluebird','mustache','path','to-csv','ejs','fs-extra','squel','crypto','jsforce','desk.js','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','api','../../config/license/util','end','status','json','offset','undefined','limit','count','set','Content-Range','save','update','then','destroy','stack','name','index','FaxQueueReport','fieldName','model','map','query','filters','intersection','attributes','length','hasOwnProperty','order','sort','where','pick','filter','merge','type','options','includeAll','include','findAll','catch','show','params','rawAttributes','keys','fields','find','create'];(function(_0x3fdde7,_0x482ae2){var _0x269c21=function(_0x11bc8e){while(--_0x11bc8e){_0x3fdde7['push'](_0x3fdde7['shift']());}};_0x269c21(++_0x482ae2);}(_0xcab6,0xd4));var _0x6cab=function(_0x3b922f,_0x3d612d){_0x3b922f=_0x3b922f-0x0;var _0x284bf8=_0xcab6[_0x3b922f];return _0x284bf8;};'use strict';var emlformat=require(_0x6cab('0x0'));var rimraf=require('rimraf');var zipdir=require(_0x6cab('0x1'));var jsonpatch=require(_0x6cab('0x2'));var rp=require(_0x6cab('0x3'));var moment=require(_0x6cab('0x4'));var BPromise=require(_0x6cab('0x5'));var Mustache=require(_0x6cab('0x6'));var util=require('util');var path=require(_0x6cab('0x7'));var sox=require('sox');var csv=require(_0x6cab('0x8'));var ejs=require(_0x6cab('0x9'));var fs=require('fs');var fs_extra=require(_0x6cab('0xa'));var _=require('lodash');var squel=require(_0x6cab('0xb'));var crypto=require(_0x6cab('0xc'));var jsforce=require(_0x6cab('0xd'));var deskjs=require(_0x6cab('0xe'));var toCsv=require('to-csv');var querystring=require('querystring');var Papa=require(_0x6cab('0xf'));var Redis=require(_0x6cab('0x10'));var authService=require(_0x6cab('0x11'));var qs=require(_0x6cab('0x12'));var as=require(_0x6cab('0x13'));var hardwareService=require(_0x6cab('0x14'));var logger=require('../../config/logger')(_0x6cab('0x15'));var utils=require('../../config/utils');var config=require('../../config/environment');var licenseUtil=require(_0x6cab('0x16'));var db=require('../../mysqldb')['db'];function respondWithStatusCode(_0x3b8609,_0x5a4033){_0x5a4033=_0x5a4033||0xcc;return function(_0x4f5067){if(_0x4f5067){return _0x3b8609['sendStatus'](_0x5a4033);}return _0x3b8609['status'](_0x5a4033)[_0x6cab('0x17')]();};}function respondWithResult(_0x971a60,_0x278be9){_0x278be9=_0x278be9||0xc8;return function(_0x30474f){if(_0x30474f){return _0x971a60[_0x6cab('0x18')](_0x278be9)[_0x6cab('0x19')](_0x30474f);}};}function respondWithFilteredResult(_0x256dbc,_0x22ea54){return function(_0x36f5e9){if(_0x36f5e9){var _0x1fc3e8=typeof _0x22ea54[_0x6cab('0x1a')]===_0x6cab('0x1b')&&typeof _0x22ea54[_0x6cab('0x1c')]==='undefined';var _0x1ff3c6=_0x36f5e9[_0x6cab('0x1d')];var _0x4e9bcb=_0x1fc3e8?0x0:_0x22ea54[_0x6cab('0x1a')];var _0x5240c1=_0x1fc3e8?_0x36f5e9[_0x6cab('0x1d')]:_0x22ea54[_0x6cab('0x1a')]+_0x22ea54['limit'];var _0x4b009c;if(_0x5240c1>=_0x1ff3c6){_0x5240c1=_0x1ff3c6;_0x4b009c=0xc8;}else{_0x4b009c=0xce;}_0x256dbc[_0x6cab('0x18')](_0x4b009c);return _0x256dbc[_0x6cab('0x1e')](_0x6cab('0x1f'),_0x4e9bcb+'-'+_0x5240c1+'/'+_0x1ff3c6)[_0x6cab('0x19')](_0x36f5e9);}return null;};}function patchUpdates(_0xa36dad){return function(_0x565a51){try{jsonpatch['apply'](_0x565a51,_0xa36dad,!![]);}catch(_0x3bbf68){return BPromise['reject'](_0x3bbf68);}return _0x565a51[_0x6cab('0x20')]();};}function saveUpdates(_0x3f8516,_0x4784a0){return function(_0x22c401){if(_0x22c401){return _0x22c401[_0x6cab('0x21')](_0x3f8516)[_0x6cab('0x22')](function(_0x163680){return _0x163680;});}return null;};}function removeEntity(_0x6efcb8,_0xd1698a){return function(_0xe6a99e){if(_0xe6a99e){return _0xe6a99e[_0x6cab('0x23')]()[_0x6cab('0x22')](function(){_0x6efcb8[_0x6cab('0x18')](0xcc)['end']();});}};}function handleEntityNotFound(_0x59acf4,_0x571b8e){return function(_0x4b0194){if(!_0x4b0194){_0x59acf4['sendStatus'](0x194);}return _0x4b0194;};}function handleError(_0x29b10f,_0x27a6b5){_0x27a6b5=_0x27a6b5||0x1f4;return function(_0x426531){logger['error'](_0x426531[_0x6cab('0x24')]);if(_0x426531[_0x6cab('0x25')]){delete _0x426531[_0x6cab('0x25')];}_0x29b10f[_0x6cab('0x18')](_0x27a6b5)['send'](_0x426531);};}exports[_0x6cab('0x26')]=function(_0x3c5de1,_0x5606c8){var _0x12233a={},_0x5b4bbf={},_0x14e1de={'count':0x0,'rows':[]};var _0x4abbe5=_['map'](db[_0x6cab('0x27')]['rawAttributes'],function(_0x1c3319){return{'name':_0x1c3319[_0x6cab('0x28')],'type':_0x1c3319['type']['key']};});_0x5b4bbf[_0x6cab('0x29')]=_[_0x6cab('0x2a')](_0x4abbe5,_0x6cab('0x25'));_0x5b4bbf['query']=_['keys'](_0x3c5de1[_0x6cab('0x2b')]);_0x5b4bbf[_0x6cab('0x2c')]=_[_0x6cab('0x2d')](_0x5b4bbf[_0x6cab('0x29')],_0x5b4bbf[_0x6cab('0x2b')]);_0x12233a[_0x6cab('0x2e')]=_[_0x6cab('0x2d')](_0x5b4bbf[_0x6cab('0x29')],qs['fields'](_0x3c5de1['query']['fields']));_0x12233a[_0x6cab('0x2e')]=_0x12233a[_0x6cab('0x2e')][_0x6cab('0x2f')]?_0x12233a['attributes']:_0x5b4bbf[_0x6cab('0x29')];if(!_0x3c5de1[_0x6cab('0x2b')][_0x6cab('0x30')]('nolimit')){_0x12233a[_0x6cab('0x1c')]=qs[_0x6cab('0x1c')](_0x3c5de1[_0x6cab('0x2b')]['limit']);_0x12233a[_0x6cab('0x1a')]=qs['offset'](_0x3c5de1['query']['offset']);}_0x12233a[_0x6cab('0x31')]=qs[_0x6cab('0x32')](_0x3c5de1['query'][_0x6cab('0x32')]);_0x12233a[_0x6cab('0x33')]=qs[_0x6cab('0x2c')](_[_0x6cab('0x34')](_0x3c5de1[_0x6cab('0x2b')],_0x5b4bbf[_0x6cab('0x2c')]),_0x4abbe5);if(_0x3c5de1[_0x6cab('0x2b')][_0x6cab('0x35')]){_0x12233a[_0x6cab('0x33')]=_[_0x6cab('0x36')](_0x12233a['where'],{'$or':_[_0x6cab('0x2a')](_0x4abbe5,function(_0x5d5f28){if(_0x5d5f28[_0x6cab('0x37')]!=='VIRTUAL'){var _0x2d6be6={};_0x2d6be6[_0x5d5f28[_0x6cab('0x25')]]={'$like':'%'+_0x3c5de1[_0x6cab('0x2b')]['filter']+'%'};return _0x2d6be6;}})});}_0x12233a=_[_0x6cab('0x36')]({},_0x12233a,_0x3c5de1[_0x6cab('0x38')]);var _0x1b4784={'where':_0x12233a[_0x6cab('0x33')]};return db[_0x6cab('0x27')]['count'](_0x1b4784)[_0x6cab('0x22')](function(_0x8f9f4e){_0x14e1de[_0x6cab('0x1d')]=_0x8f9f4e;if(_0x3c5de1[_0x6cab('0x2b')][_0x6cab('0x39')]){_0x12233a[_0x6cab('0x3a')]=[{'all':!![]}];}return db[_0x6cab('0x27')][_0x6cab('0x3b')](_0x12233a);})[_0x6cab('0x22')](function(_0x4c33c8){_0x14e1de['rows']=_0x4c33c8;return _0x14e1de;})[_0x6cab('0x22')](respondWithFilteredResult(_0x5606c8,_0x12233a))[_0x6cab('0x3c')](handleError(_0x5606c8,null));};exports[_0x6cab('0x3d')]=function(_0x410864,_0x4cf843){var _0x1bc834={'raw':!![],'where':{'id':_0x410864[_0x6cab('0x3e')]['id']}},_0x35ccd1={};_0x35ccd1[_0x6cab('0x29')]=_['keys'](db[_0x6cab('0x27')][_0x6cab('0x3f')]);_0x35ccd1['query']=_[_0x6cab('0x40')](_0x410864[_0x6cab('0x2b')]);_0x35ccd1[_0x6cab('0x2c')]=_['intersection'](_0x35ccd1[_0x6cab('0x29')],_0x35ccd1['query']);_0x1bc834['attributes']=_['intersection'](_0x35ccd1[_0x6cab('0x29')],qs['fields'](_0x410864[_0x6cab('0x2b')][_0x6cab('0x41')]));_0x1bc834['attributes']=_0x1bc834[_0x6cab('0x2e')][_0x6cab('0x2f')]?_0x1bc834['attributes']:_0x35ccd1[_0x6cab('0x29')];if(_0x410864[_0x6cab('0x2b')][_0x6cab('0x39')]){_0x1bc834['include']=[{'all':!![]}];}_0x1bc834=_[_0x6cab('0x36')]({},_0x1bc834,_0x410864[_0x6cab('0x38')]);return db[_0x6cab('0x27')][_0x6cab('0x42')](_0x1bc834)[_0x6cab('0x22')](handleEntityNotFound(_0x4cf843,null))[_0x6cab('0x22')](respondWithResult(_0x4cf843,null))[_0x6cab('0x3c')](handleError(_0x4cf843,null));};exports[_0x6cab('0x43')]=function(_0x1e1644,_0x1bfa4c){return db[_0x6cab('0x27')][_0x6cab('0x43')](_0x1e1644[_0x6cab('0x44')],{})['then'](respondWithResult(_0x1bfa4c,0xc9))[_0x6cab('0x3c')](handleError(_0x1bfa4c,null));};exports['update']=function(_0x41a889,_0x110985){if(_0x41a889['body']['id']){delete _0x41a889[_0x6cab('0x44')]['id'];}return db[_0x6cab('0x27')][_0x6cab('0x42')]({'where':{'id':_0x41a889[_0x6cab('0x3e')]['id']}})[_0x6cab('0x22')](handleEntityNotFound(_0x110985,null))[_0x6cab('0x22')](saveUpdates(_0x41a889[_0x6cab('0x44')],null))[_0x6cab('0x22')](respondWithResult(_0x110985,null))['catch'](handleError(_0x110985,null));};exports[_0x6cab('0x23')]=function(_0x4fbd61,_0x131459){return db[_0x6cab('0x27')]['find']({'where':{'id':_0x4fbd61[_0x6cab('0x3e')]['id']}})['then'](handleEntityNotFound(_0x131459,null))[_0x6cab('0x22')](removeEntity(_0x131459,null))[_0x6cab('0x3c')](handleError(_0x131459,null));};exports[_0x6cab('0x45')]=function(_0xfd8fdd,_0x59d37e){return db[_0x6cab('0x27')][_0x6cab('0x45')]()[_0x6cab('0x22')](respondWithResult(_0x59d37e,null))[_0x6cab('0x3c')](handleError(_0x59d37e,null));}; \ No newline at end of file diff --git a/server/api/faxQueueReport/faxQueueReport.model.js b/server/api/faxQueueReport/faxQueueReport.model.js index 5e43ad2..8b06090 100644 --- a/server/api/faxQueueReport/faxQueueReport.model.js +++ b/server/api/faxQueueReport/faxQueueReport.model.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0xc4aa=['bluebird','../../config/environment','./faxQueueReport.attributes','exports','define','FaxQueueReport','report_fax_queue','lodash','util','../../config/logger','api','moment'];(function(_0x330b6d,_0x4948ee){var _0x288f7a=function(_0x132e28){while(--_0x132e28){_0x330b6d['push'](_0x330b6d['shift']());}};_0x288f7a(++_0x4948ee);}(_0xc4aa,0x1b7));var _0xac4a=function(_0x4b369d,_0x265eb8){_0x4b369d=_0x4b369d-0x0;var _0x571a98=_0xc4aa[_0x4b369d];return _0x571a98;};'use strict';var _=require(_0xac4a('0x0'));var util=require(_0xac4a('0x1'));var logger=require(_0xac4a('0x2'))(_0xac4a('0x3'));var moment=require(_0xac4a('0x4'));var BPromise=require(_0xac4a('0x5'));var rp=require('request-promise');var fs=require('fs');var path=require('path');var rimraf=require('rimraf');var config=require(_0xac4a('0x6'));var attributes=require(_0xac4a('0x7'));module[_0xac4a('0x8')]=function(_0x215f39,_0x96be2b){return _0x215f39[_0xac4a('0x9')](_0xac4a('0xa'),attributes,{'tableName':_0xac4a('0xb'),'paranoid':![],'indexes':[{'name':'uniqueid','fields':['uniqueid']}],'timestamps':!![]});}; \ No newline at end of file +var _0x814b=['../../config/logger','api','moment','bluebird','path','rimraf','../../config/environment','./faxQueueReport.attributes','exports','define','FaxQueueReport','uniqueid','lodash','util'];(function(_0x307086,_0x3bfe4e){var _0x699043=function(_0x1a7677){while(--_0x1a7677){_0x307086['push'](_0x307086['shift']());}};_0x699043(++_0x3bfe4e);}(_0x814b,0x1a2));var _0xb814=function(_0x456a84,_0x46bc0b){_0x456a84=_0x456a84-0x0;var _0x1117d6=_0x814b[_0x456a84];return _0x1117d6;};'use strict';var _=require(_0xb814('0x0'));var util=require(_0xb814('0x1'));var logger=require(_0xb814('0x2'))(_0xb814('0x3'));var moment=require(_0xb814('0x4'));var BPromise=require(_0xb814('0x5'));var rp=require('request-promise');var fs=require('fs');var path=require(_0xb814('0x6'));var rimraf=require(_0xb814('0x7'));var config=require(_0xb814('0x8'));var attributes=require(_0xb814('0x9'));module[_0xb814('0xa')]=function(_0x322a70,_0x53e507){return _0x322a70[_0xb814('0xb')](_0xb814('0xc'),attributes,{'tableName':'report_fax_queue','paranoid':![],'indexes':[{'name':_0xb814('0xd'),'fields':[_0xb814('0xd')]}],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/faxQueueReport/faxQueueReport.rpc.js b/server/api/faxQueueReport/faxQueueReport.rpc.js index 7a88c8a..f63d119 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 _0x9a55=['ioredis','../../mysqldb','../../config/logger','rpc','../../config/environment','client','http','request','then','info','FaxQueueReport,\x20%s,\x20%s','request\x20sent','FaxQueueReport,\x20%s,\x20%s,\x20%s','stringify','error','message','catch','CreateFaxQueueReport','FaxQueueReport','create','body','options','debug','UpdateFaxQueueReport','update','attributes','limit','util','moment','randomstring'];(function(_0x356938,_0x3271ad){var _0x3b799a=function(_0x13b864){while(--_0x13b864){_0x356938['push'](_0x356938['shift']());}};_0x3b799a(++_0x3271ad);}(_0x9a55,0x1bf));var _0x59a5=function(_0x5b650a,_0x33f5c3){_0x5b650a=_0x5b650a-0x0;var _0x1a9a3e=_0x9a55[_0x5b650a];return _0x1a9a3e;};'use strict';var _=require('lodash');var util=require(_0x59a5('0x0'));var moment=require(_0x59a5('0x1'));var BPromise=require('bluebird');var rs=require(_0x59a5('0x2'));var fs=require('fs');var Redis=require(_0x59a5('0x3'));var db=require(_0x59a5('0x4'))['db'];var utils=require('../../config/utils');var logger=require(_0x59a5('0x5'))(_0x59a5('0x6'));var config=require(_0x59a5('0x7'));var jayson=require('jayson/promise');var client=jayson[_0x59a5('0x8')][_0x59a5('0x9')]({'port':0x232a});function respondWithRpcPromise(_0x5c00de,_0x11bda9,_0x120d50){return new BPromise(function(_0x23e5f8,_0x4c0aff){return client[_0x59a5('0xa')](_0x5c00de,_0x120d50)[_0x59a5('0xb')](function(_0x1c53c6){logger[_0x59a5('0xc')](_0x59a5('0xd'),_0x11bda9,_0x59a5('0xe'));logger['debug'](_0x59a5('0xf'),_0x11bda9,_0x59a5('0xe'),JSON[_0x59a5('0x10')](_0x1c53c6));if(_0x1c53c6[_0x59a5('0x11')]){if(_0x1c53c6[_0x59a5('0x11')]['code']===0x1f4){logger[_0x59a5('0x11')]('FaxQueueReport,\x20%s,\x20%s',_0x11bda9,_0x1c53c6['error'][_0x59a5('0x12')]);return _0x4c0aff(_0x1c53c6[_0x59a5('0x11')]['message']);}logger[_0x59a5('0x11')]('FaxQueueReport,\x20%s,\x20%s',_0x11bda9,_0x1c53c6[_0x59a5('0x11')][_0x59a5('0x12')]);return _0x23e5f8(_0x1c53c6[_0x59a5('0x11')][_0x59a5('0x12')]);}else{logger[_0x59a5('0xc')](_0x59a5('0xd'),_0x11bda9,'request\x20sent');_0x23e5f8(_0x1c53c6['result'][_0x59a5('0x12')]);}})[_0x59a5('0x13')](function(_0xe1bb5b){logger[_0x59a5('0x11')]('FaxQueueReport,\x20%s,\x20%s',_0x11bda9,_0xe1bb5b);_0x4c0aff(_0xe1bb5b);});});}exports[_0x59a5('0x14')]=function(_0x16e6cf){var _0x5dfafc=this;return new Promise(function(_0x594d9d,_0x34d319){return db[_0x59a5('0x15')][_0x59a5('0x16')](_0x16e6cf[_0x59a5('0x17')],{'raw':_0x16e6cf['options']?_0x16e6cf[_0x59a5('0x18')]['raw']===undefined?!![]:![]:!![]})['then'](function(_0x53efd7){logger[_0x59a5('0xc')](_0x59a5('0x14'),_0x16e6cf);logger[_0x59a5('0x19')]('CreateFaxQueueReport',_0x16e6cf,JSON[_0x59a5('0x10')](_0x53efd7));_0x594d9d(_0x53efd7);})[_0x59a5('0x13')](function(_0xc30f64){logger['error']('CreateFaxQueueReport',_0xc30f64[_0x59a5('0x12')],_0x16e6cf);_0x34d319(_0x5dfafc[_0x59a5('0x11')](0x1f4,_0xc30f64['message']));});});};exports[_0x59a5('0x1a')]=function(_0x509b6a){var _0x1c661e=this;return new Promise(function(_0x3a622a,_0x1cc937){return db[_0x59a5('0x15')][_0x59a5('0x1b')](_0x509b6a[_0x59a5('0x17')],{'raw':_0x509b6a[_0x59a5('0x18')]?_0x509b6a[_0x59a5('0x18')]['raw']===undefined?!![]:![]:!![],'individualHooks':!![],'where':_0x509b6a['options']?_0x509b6a[_0x59a5('0x18')]['where']||null:null,'attributes':_0x509b6a[_0x59a5('0x18')]?_0x509b6a[_0x59a5('0x18')][_0x59a5('0x1c')]||null:null,'limit':_0x509b6a['options']?_0x509b6a[_0x59a5('0x18')][_0x59a5('0x1d')]||null:null})[_0x59a5('0xb')](function(_0x3e6f24){logger[_0x59a5('0xc')](_0x59a5('0x1a'),_0x509b6a);logger[_0x59a5('0x19')](_0x59a5('0x1a'),_0x509b6a,JSON[_0x59a5('0x10')](_0x3e6f24));_0x3a622a(_0x3e6f24);})['catch'](function(_0x2c2ac1){logger[_0x59a5('0x11')](_0x59a5('0x1a'),_0x2c2ac1['message'],_0x509b6a);_0x1cc937(_0x1c661e[_0x59a5('0x11')](0x1f4,_0x2c2ac1[_0x59a5('0x12')]));});});}; \ No newline at end of file +var _0xb72b=['FaxQueueReport','create','body','options','catch','UpdateFaxQueueReport','raw','where','attributes','lodash','util','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','request','then','info','FaxQueueReport,\x20%s,\x20%s','request\x20sent','debug','FaxQueueReport,\x20%s,\x20%s,\x20%s','stringify','error','code','message','result','CreateFaxQueueReport'];(function(_0x36ee33,_0x177ca3){var _0x500148=function(_0x72a7c2){while(--_0x72a7c2){_0x36ee33['push'](_0x36ee33['shift']());}};_0x500148(++_0x177ca3);}(_0xb72b,0x1a1));var _0xbb72=function(_0x4c5d6f,_0x1fd37f){_0x4c5d6f=_0x4c5d6f-0x0;var _0x26c9ce=_0xb72b[_0x4c5d6f];return _0x26c9ce;};'use strict';var _=require(_0xbb72('0x0'));var util=require(_0xbb72('0x1'));var moment=require(_0xbb72('0x2'));var BPromise=require(_0xbb72('0x3'));var rs=require(_0xbb72('0x4'));var fs=require('fs');var Redis=require(_0xbb72('0x5'));var db=require(_0xbb72('0x6'))['db'];var utils=require(_0xbb72('0x7'));var logger=require(_0xbb72('0x8'))(_0xbb72('0x9'));var config=require(_0xbb72('0xa'));var jayson=require(_0xbb72('0xb'));var client=jayson['client']['http']({'port':0x232a});function respondWithRpcPromise(_0x345d0a,_0x50b541,_0x22038e){return new BPromise(function(_0x1cdcb7,_0xe4d97e){return client[_0xbb72('0xc')](_0x345d0a,_0x22038e)[_0xbb72('0xd')](function(_0x19c8ac){logger[_0xbb72('0xe')](_0xbb72('0xf'),_0x50b541,_0xbb72('0x10'));logger[_0xbb72('0x11')](_0xbb72('0x12'),_0x50b541,_0xbb72('0x10'),JSON[_0xbb72('0x13')](_0x19c8ac));if(_0x19c8ac[_0xbb72('0x14')]){if(_0x19c8ac[_0xbb72('0x14')][_0xbb72('0x15')]===0x1f4){logger[_0xbb72('0x14')](_0xbb72('0xf'),_0x50b541,_0x19c8ac[_0xbb72('0x14')][_0xbb72('0x16')]);return _0xe4d97e(_0x19c8ac[_0xbb72('0x14')][_0xbb72('0x16')]);}logger[_0xbb72('0x14')]('FaxQueueReport,\x20%s,\x20%s',_0x50b541,_0x19c8ac['error'][_0xbb72('0x16')]);return _0x1cdcb7(_0x19c8ac['error'][_0xbb72('0x16')]);}else{logger[_0xbb72('0xe')](_0xbb72('0xf'),_0x50b541,'request\x20sent');_0x1cdcb7(_0x19c8ac[_0xbb72('0x17')]['message']);}})['catch'](function(_0x469177){logger[_0xbb72('0x14')](_0xbb72('0xf'),_0x50b541,_0x469177);_0xe4d97e(_0x469177);});});}exports[_0xbb72('0x18')]=function(_0x3da42d){var _0x273cd0=this;return new Promise(function(_0x305a5d,_0x1eb3cf){return db[_0xbb72('0x19')][_0xbb72('0x1a')](_0x3da42d[_0xbb72('0x1b')],{'raw':_0x3da42d['options']?_0x3da42d[_0xbb72('0x1c')]['raw']===undefined?!![]:![]:!![]})['then'](function(_0x50192d){logger['info']('CreateFaxQueueReport',_0x3da42d);logger[_0xbb72('0x11')]('CreateFaxQueueReport',_0x3da42d,JSON['stringify'](_0x50192d));_0x305a5d(_0x50192d);})[_0xbb72('0x1d')](function(_0x59626d){logger[_0xbb72('0x14')](_0xbb72('0x18'),_0x59626d[_0xbb72('0x16')],_0x3da42d);_0x1eb3cf(_0x273cd0[_0xbb72('0x14')](0x1f4,_0x59626d[_0xbb72('0x16')]));});});};exports[_0xbb72('0x1e')]=function(_0x301c1e){var _0x579591=this;return new Promise(function(_0x356517,_0x28bbe7){return db[_0xbb72('0x19')]['update'](_0x301c1e['body'],{'raw':_0x301c1e[_0xbb72('0x1c')]?_0x301c1e[_0xbb72('0x1c')][_0xbb72('0x1f')]===undefined?!![]:![]:!![],'individualHooks':!![],'where':_0x301c1e['options']?_0x301c1e[_0xbb72('0x1c')][_0xbb72('0x20')]||null:null,'attributes':_0x301c1e[_0xbb72('0x1c')]?_0x301c1e['options'][_0xbb72('0x21')]||null:null,'limit':_0x301c1e[_0xbb72('0x1c')]?_0x301c1e[_0xbb72('0x1c')]['limit']||null:null})[_0xbb72('0xd')](function(_0x1b2d30){logger['info']('UpdateFaxQueueReport',_0x301c1e);logger[_0xbb72('0x11')](_0xbb72('0x1e'),_0x301c1e,JSON[_0xbb72('0x13')](_0x1b2d30));_0x356517(_0x1b2d30);})['catch'](function(_0x2f5cf6){logger[_0xbb72('0x14')](_0xbb72('0x1e'),_0x2f5cf6[_0xbb72('0x16')],_0x301c1e);_0x28bbe7(_0x579591[_0xbb72('0x14')](0x1f4,_0x2f5cf6[_0xbb72('0x16')]));});});}; \ No newline at end of file diff --git a/server/api/faxQueueReport/index.js b/server/api/faxQueueReport/index.js index 07b799c..b1ed0f0 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 _0xcde9=['index','/describe','describe','/:id','show','post','put','update','delete','destroy','exports','multer','util','path','connect-timeout','../../components/auth/service','../../components/interaction/service','../../config/environment','get','isAuthenticated'];(function(_0x4565bf,_0x5ad9d6){var _0x5610ba=function(_0x170988){while(--_0x170988){_0x4565bf['push'](_0x4565bf['shift']());}};_0x5610ba(++_0x5ad9d6);}(_0xcde9,0xbf));var _0x9cde=function(_0xf6046e,_0x72b874){_0xf6046e=_0xf6046e-0x0;var _0x2fdc66=_0xcde9[_0xf6046e];return _0x2fdc66;};'use strict';var multer=require(_0x9cde('0x0'));var util=require(_0x9cde('0x1'));var path=require(_0x9cde('0x2'));var timeout=require(_0x9cde('0x3'));var express=require('express');var router=express['Router']();var fs_extra=require('fs-extra');var auth=require(_0x9cde('0x4'));var interaction=require(_0x9cde('0x5'));var config=require(_0x9cde('0x6'));var controller=require('./faxQueueReport.controller');router[_0x9cde('0x7')]('/',auth[_0x9cde('0x8')](),controller[_0x9cde('0x9')]);router['get'](_0x9cde('0xa'),auth[_0x9cde('0x8')](),controller[_0x9cde('0xb')]);router[_0x9cde('0x7')](_0x9cde('0xc'),auth[_0x9cde('0x8')](),controller[_0x9cde('0xd')]);router[_0x9cde('0xe')]('/',auth['isAuthenticated'](),controller['create']);router[_0x9cde('0xf')](_0x9cde('0xc'),auth[_0x9cde('0x8')](),controller[_0x9cde('0x10')]);router[_0x9cde('0x11')](_0x9cde('0xc'),auth[_0x9cde('0x8')](),controller[_0x9cde('0x12')]);module[_0x9cde('0x13')]=router; \ No newline at end of file +var _0x4a78=['destroy','exports','util','path','express','Router','fs-extra','isAuthenticated','index','get','/describe','describe','/:id','show','post','create','put','update','delete'];(function(_0x3f7c14,_0x467994){var _0x5ead1e=function(_0x39ff68){while(--_0x39ff68){_0x3f7c14['push'](_0x3f7c14['shift']());}};_0x5ead1e(++_0x467994);}(_0x4a78,0xad));var _0x84a7=function(_0x1a17c8,_0x58b2f){_0x1a17c8=_0x1a17c8-0x0;var _0x39a42a=_0x4a78[_0x1a17c8];return _0x39a42a;};'use strict';var multer=require('multer');var util=require(_0x84a7('0x0'));var path=require(_0x84a7('0x1'));var timeout=require('connect-timeout');var express=require(_0x84a7('0x2'));var router=express[_0x84a7('0x3')]();var fs_extra=require(_0x84a7('0x4'));var auth=require('../../components/auth/service');var interaction=require('../../components/interaction/service');var config=require('../../config/environment');var controller=require('./faxQueueReport.controller');router['get']('/',auth[_0x84a7('0x5')](),controller[_0x84a7('0x6')]);router[_0x84a7('0x7')](_0x84a7('0x8'),auth['isAuthenticated'](),controller[_0x84a7('0x9')]);router['get'](_0x84a7('0xa'),auth[_0x84a7('0x5')](),controller[_0x84a7('0xb')]);router[_0x84a7('0xc')]('/',auth[_0x84a7('0x5')](),controller[_0x84a7('0xd')]);router[_0x84a7('0xe')](_0x84a7('0xa'),auth[_0x84a7('0x5')](),controller[_0x84a7('0xf')]);router[_0x84a7('0x10')](_0x84a7('0xa'),auth[_0x84a7('0x5')](),controller[_0x84a7('0x11')]);module[_0x84a7('0x12')]=router; \ No newline at end of file diff --git a/server/api/faxTransferReport/faxTransferReport.attributes.js b/server/api/faxTransferReport/faxTransferReport.attributes.js index 800c335..a9886f5 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 _0x008c=['ENUM','agent','queue','DATE','NOW','moment','sequelize','exports','STRING'];(function(_0xe5a26b,_0x1421ae){var _0x9ea56b=function(_0x4bec39){while(--_0x4bec39){_0xe5a26b['push'](_0xe5a26b['shift']());}};_0x9ea56b(++_0x1421ae);}(_0x008c,0x188));var _0xc008=function(_0x4fc4e7,_0x16bfc4){_0x4fc4e7=_0x4fc4e7-0x0;var _0x297133=_0x008c[_0x4fc4e7];return _0x297133;};'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 +var _0x008c=['ENUM','agent','queue','DATE','NOW','moment','sequelize','exports','STRING'];(function(_0x1bfa86,_0x4a8606){var _0x1bd346=function(_0x1a1135){while(--_0x1a1135){_0x1bfa86['push'](_0x1bfa86['shift']());}};_0x1bd346(++_0x4a8606);}(_0x008c,0x188));var _0xc008=function(_0x250bbc,_0x3297f3){_0x250bbc=_0x250bbc-0x0;var _0x489e34=_0x008c[_0x250bbc];return _0x489e34;};'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/faxTransferReport/faxTransferReport.controller.js b/server/api/faxTransferReport/faxTransferReport.controller.js index a4ee393..2164436 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 _0x0f99=['findAll','show','params','keys','includeAll','find','catch','create','body','update','destroy','describe','eml-format','rimraf','fast-json-patch','request-promise','bluebird','mustache','util','path','sox','to-csv','ejs','squel','crypto','jsforce','desk.js','querystring','papaparse','api','../../config/utils','../../config/environment','sendStatus','end','status','json','offset','undefined','limit','count','set','apply','then','stack','name','send','map','FaxTransferReport','rawAttributes','type','key','model','query','filters','intersection','attributes','fields','length','hasOwnProperty','sort','pick','where','VIRTUAL','filter','merge','options','include'];(function(_0xcd5a3d,_0x3c5b33){var _0xd43207=function(_0x17d976){while(--_0x17d976){_0xcd5a3d['push'](_0xcd5a3d['shift']());}};_0xd43207(++_0x3c5b33);}(_0x0f99,0x1e1));var _0x90f9=function(_0x191a26,_0x4beded){_0x191a26=_0x191a26-0x0;var _0x383b49=_0x0f99[_0x191a26];return _0x383b49;};'use strict';var emlformat=require(_0x90f9('0x0'));var rimraf=require(_0x90f9('0x1'));var zipdir=require('zip-dir');var jsonpatch=require(_0x90f9('0x2'));var rp=require(_0x90f9('0x3'));var moment=require('moment');var BPromise=require(_0x90f9('0x4'));var Mustache=require(_0x90f9('0x5'));var util=require(_0x90f9('0x6'));var path=require(_0x90f9('0x7'));var sox=require(_0x90f9('0x8'));var csv=require(_0x90f9('0x9'));var ejs=require(_0x90f9('0xa'));var fs=require('fs');var fs_extra=require('fs-extra');var _=require('lodash');var squel=require(_0x90f9('0xb'));var crypto=require(_0x90f9('0xc'));var jsforce=require(_0x90f9('0xd'));var deskjs=require(_0x90f9('0xe'));var toCsv=require(_0x90f9('0x9'));var querystring=require(_0x90f9('0xf'));var Papa=require(_0x90f9('0x10'));var Redis=require('ioredis');var authService=require('../../components/auth/service');var qs=require('../../components/parsers/qs');var as=require('../../components/parsers/advancedSearch');var hardwareService=require('../../config/license/hardware');var logger=require('../../config/logger')(_0x90f9('0x11'));var utils=require(_0x90f9('0x12'));var config=require(_0x90f9('0x13'));var licenseUtil=require('../../config/license/util');var db=require('../../mysqldb')['db'];function respondWithStatusCode(_0x507c19,_0x1b89d7){_0x1b89d7=_0x1b89d7||0xcc;return function(_0x345a23){if(_0x345a23){return _0x507c19[_0x90f9('0x14')](_0x1b89d7);}return _0x507c19['status'](_0x1b89d7)[_0x90f9('0x15')]();};}function respondWithResult(_0x3513b9,_0x3cce58){_0x3cce58=_0x3cce58||0xc8;return function(_0x2c8ee3){if(_0x2c8ee3){return _0x3513b9[_0x90f9('0x16')](_0x3cce58)[_0x90f9('0x17')](_0x2c8ee3);}};}function respondWithFilteredResult(_0x368f37,_0x48f1aa){return function(_0x1a4066){if(_0x1a4066){var _0x172554=typeof _0x48f1aa[_0x90f9('0x18')]===_0x90f9('0x19')&&typeof _0x48f1aa[_0x90f9('0x1a')]==='undefined';var _0x13632f=_0x1a4066[_0x90f9('0x1b')];var _0x522f2a=_0x172554?0x0:_0x48f1aa[_0x90f9('0x18')];var _0x16d73f=_0x172554?_0x1a4066[_0x90f9('0x1b')]:_0x48f1aa['offset']+_0x48f1aa['limit'];var _0x452cbc;if(_0x16d73f>=_0x13632f){_0x16d73f=_0x13632f;_0x452cbc=0xc8;}else{_0x452cbc=0xce;}_0x368f37[_0x90f9('0x16')](_0x452cbc);return _0x368f37[_0x90f9('0x1c')]('Content-Range',_0x522f2a+'-'+_0x16d73f+'/'+_0x13632f)[_0x90f9('0x17')](_0x1a4066);}return null;};}function patchUpdates(_0xc919c5){return function(_0x40928b){try{jsonpatch[_0x90f9('0x1d')](_0x40928b,_0xc919c5,!![]);}catch(_0x307798){return BPromise['reject'](_0x307798);}return _0x40928b['save']();};}function saveUpdates(_0x2a7ffc,_0x42ca71){return function(_0x5c2a12){if(_0x5c2a12){return _0x5c2a12['update'](_0x2a7ffc)[_0x90f9('0x1e')](function(_0x31459a){return _0x31459a;});}return null;};}function removeEntity(_0x25a203,_0x3443c7){return function(_0x4513e7){if(_0x4513e7){return _0x4513e7['destroy']()[_0x90f9('0x1e')](function(){_0x25a203[_0x90f9('0x16')](0xcc)[_0x90f9('0x15')]();});}};}function handleEntityNotFound(_0x55d219,_0x5581f4){return function(_0x10b5ea){if(!_0x10b5ea){_0x55d219[_0x90f9('0x14')](0x194);}return _0x10b5ea;};}function handleError(_0x3f116c,_0x2d422c){_0x2d422c=_0x2d422c||0x1f4;return function(_0x1f95f0){logger['error'](_0x1f95f0[_0x90f9('0x1f')]);if(_0x1f95f0['name']){delete _0x1f95f0[_0x90f9('0x20')];}_0x3f116c['status'](_0x2d422c)[_0x90f9('0x21')](_0x1f95f0);};}exports['index']=function(_0xe97a4e,_0x874b49){var _0x35f3b8={},_0x401f2e={},_0x9b5f49={'count':0x0,'rows':[]};var _0x217118=_[_0x90f9('0x22')](db[_0x90f9('0x23')][_0x90f9('0x24')],function(_0x50fcb2){return{'name':_0x50fcb2['fieldName'],'type':_0x50fcb2[_0x90f9('0x25')][_0x90f9('0x26')]};});_0x401f2e[_0x90f9('0x27')]=_[_0x90f9('0x22')](_0x217118,_0x90f9('0x20'));_0x401f2e['query']=_['keys'](_0xe97a4e[_0x90f9('0x28')]);_0x401f2e[_0x90f9('0x29')]=_[_0x90f9('0x2a')](_0x401f2e[_0x90f9('0x27')],_0x401f2e[_0x90f9('0x28')]);_0x35f3b8[_0x90f9('0x2b')]=_[_0x90f9('0x2a')](_0x401f2e['model'],qs[_0x90f9('0x2c')](_0xe97a4e[_0x90f9('0x28')]['fields']));_0x35f3b8[_0x90f9('0x2b')]=_0x35f3b8['attributes'][_0x90f9('0x2d')]?_0x35f3b8[_0x90f9('0x2b')]:_0x401f2e[_0x90f9('0x27')];if(!_0xe97a4e[_0x90f9('0x28')][_0x90f9('0x2e')]('nolimit')){_0x35f3b8[_0x90f9('0x1a')]=qs['limit'](_0xe97a4e[_0x90f9('0x28')][_0x90f9('0x1a')]);_0x35f3b8['offset']=qs[_0x90f9('0x18')](_0xe97a4e['query']['offset']);}_0x35f3b8['order']=qs['sort'](_0xe97a4e[_0x90f9('0x28')][_0x90f9('0x2f')]);_0x35f3b8['where']=qs['filters'](_[_0x90f9('0x30')](_0xe97a4e[_0x90f9('0x28')],_0x401f2e[_0x90f9('0x29')]),_0x217118);if(_0xe97a4e[_0x90f9('0x28')]['filter']){_0x35f3b8[_0x90f9('0x31')]=_['merge'](_0x35f3b8['where'],{'$or':_['map'](_0x217118,function(_0x20ade7){if(_0x20ade7[_0x90f9('0x25')]!==_0x90f9('0x32')){var _0x559de0={};_0x559de0[_0x20ade7['name']]={'$like':'%'+_0xe97a4e['query'][_0x90f9('0x33')]+'%'};return _0x559de0;}})});}_0x35f3b8=_[_0x90f9('0x34')]({},_0x35f3b8,_0xe97a4e[_0x90f9('0x35')]);var _0xaf7f34={'where':_0x35f3b8['where']};return db[_0x90f9('0x23')][_0x90f9('0x1b')](_0xaf7f34)[_0x90f9('0x1e')](function(_0x488c1d){_0x9b5f49['count']=_0x488c1d;if(_0xe97a4e[_0x90f9('0x28')]['includeAll']){_0x35f3b8[_0x90f9('0x36')]=[{'all':!![]}];}return db['FaxTransferReport'][_0x90f9('0x37')](_0x35f3b8);})[_0x90f9('0x1e')](function(_0x23ef31){_0x9b5f49['rows']=_0x23ef31;return _0x9b5f49;})[_0x90f9('0x1e')](respondWithFilteredResult(_0x874b49,_0x35f3b8))['catch'](handleError(_0x874b49,null));};exports[_0x90f9('0x38')]=function(_0x2febf1,_0x528b68){var _0x41892d={'raw':!![],'where':{'id':_0x2febf1[_0x90f9('0x39')]['id']}},_0x267281={};_0x267281[_0x90f9('0x27')]=_[_0x90f9('0x3a')](db['FaxTransferReport'][_0x90f9('0x24')]);_0x267281[_0x90f9('0x28')]=_['keys'](_0x2febf1[_0x90f9('0x28')]);_0x267281[_0x90f9('0x29')]=_[_0x90f9('0x2a')](_0x267281['model'],_0x267281[_0x90f9('0x28')]);_0x41892d[_0x90f9('0x2b')]=_[_0x90f9('0x2a')](_0x267281[_0x90f9('0x27')],qs[_0x90f9('0x2c')](_0x2febf1['query'][_0x90f9('0x2c')]));_0x41892d[_0x90f9('0x2b')]=_0x41892d[_0x90f9('0x2b')]['length']?_0x41892d[_0x90f9('0x2b')]:_0x267281[_0x90f9('0x27')];if(_0x2febf1[_0x90f9('0x28')][_0x90f9('0x3b')]){_0x41892d[_0x90f9('0x36')]=[{'all':!![]}];}_0x41892d=_['merge']({},_0x41892d,_0x2febf1[_0x90f9('0x35')]);return db[_0x90f9('0x23')][_0x90f9('0x3c')](_0x41892d)['then'](handleEntityNotFound(_0x528b68,null))[_0x90f9('0x1e')](respondWithResult(_0x528b68,null))[_0x90f9('0x3d')](handleError(_0x528b68,null));};exports[_0x90f9('0x3e')]=function(_0x2a0854,_0x38373b){return db[_0x90f9('0x23')][_0x90f9('0x3e')](_0x2a0854[_0x90f9('0x3f')],{})[_0x90f9('0x1e')](respondWithResult(_0x38373b,0xc9))[_0x90f9('0x3d')](handleError(_0x38373b,null));};exports[_0x90f9('0x40')]=function(_0x51cc78,_0x35f75b){if(_0x51cc78[_0x90f9('0x3f')]['id']){delete _0x51cc78[_0x90f9('0x3f')]['id'];}return db['FaxTransferReport'][_0x90f9('0x3c')]({'where':{'id':_0x51cc78[_0x90f9('0x39')]['id']}})['then'](handleEntityNotFound(_0x35f75b,null))[_0x90f9('0x1e')](saveUpdates(_0x51cc78['body'],null))[_0x90f9('0x1e')](respondWithResult(_0x35f75b,null))['catch'](handleError(_0x35f75b,null));};exports[_0x90f9('0x41')]=function(_0x5574a6,_0x211bf4){return db[_0x90f9('0x23')]['find']({'where':{'id':_0x5574a6['params']['id']}})[_0x90f9('0x1e')](handleEntityNotFound(_0x211bf4,null))['then'](removeEntity(_0x211bf4,null))['catch'](handleError(_0x211bf4,null));};exports[_0x90f9('0x42')]=function(_0x298d9a,_0x52f4c5){return db[_0x90f9('0x23')]['describe']()[_0x90f9('0x1e')](respondWithResult(_0x52f4c5,null))[_0x90f9('0x3d')](handleError(_0x52f4c5,null));}; \ No newline at end of file +var _0xf8cd=['then','sendStatus','error','stack','name','send','map','FaxTransferReport','fieldName','type','model','keys','query','filters','intersection','attributes','fields','length','nolimit','sort','pick','filter','merge','where','VIRTUAL','includeAll','findAll','rows','catch','show','params','include','options','create','body','describe','rimraf','zip-dir','fast-json-patch','request-promise','moment','bluebird','mustache','util','sox','to-csv','ejs','fs-extra','lodash','squel','jsforce','desk.js','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/advancedSearch','../../config/logger','api','../../config/utils','../../config/environment','../../mysqldb','end','json','offset','limit','count','status','set','Content-Range','apply','reject','save','update','destroy'];(function(_0x2fcdf1,_0x47e878){var _0x34c2c7=function(_0x2316b7){while(--_0x2316b7){_0x2fcdf1['push'](_0x2fcdf1['shift']());}};_0x34c2c7(++_0x47e878);}(_0xf8cd,0x6f));var _0xdf8c=function(_0x5c21c9,_0x8cdef){_0x5c21c9=_0x5c21c9-0x0;var _0xe41a99=_0xf8cd[_0x5c21c9];return _0xe41a99;};'use strict';var emlformat=require('eml-format');var rimraf=require(_0xdf8c('0x0'));var zipdir=require(_0xdf8c('0x1'));var jsonpatch=require(_0xdf8c('0x2'));var rp=require(_0xdf8c('0x3'));var moment=require(_0xdf8c('0x4'));var BPromise=require(_0xdf8c('0x5'));var Mustache=require(_0xdf8c('0x6'));var util=require(_0xdf8c('0x7'));var path=require('path');var sox=require(_0xdf8c('0x8'));var csv=require(_0xdf8c('0x9'));var ejs=require(_0xdf8c('0xa'));var fs=require('fs');var fs_extra=require(_0xdf8c('0xb'));var _=require(_0xdf8c('0xc'));var squel=require(_0xdf8c('0xd'));var crypto=require('crypto');var jsforce=require(_0xdf8c('0xe'));var deskjs=require(_0xdf8c('0xf'));var toCsv=require(_0xdf8c('0x9'));var querystring=require(_0xdf8c('0x10'));var Papa=require(_0xdf8c('0x11'));var Redis=require(_0xdf8c('0x12'));var authService=require(_0xdf8c('0x13'));var qs=require('../../components/parsers/qs');var as=require(_0xdf8c('0x14'));var hardwareService=require('../../config/license/hardware');var logger=require(_0xdf8c('0x15'))(_0xdf8c('0x16'));var utils=require(_0xdf8c('0x17'));var config=require(_0xdf8c('0x18'));var licenseUtil=require('../../config/license/util');var db=require(_0xdf8c('0x19'))['db'];function respondWithStatusCode(_0x17684b,_0x4dc1ff){_0x4dc1ff=_0x4dc1ff||0xcc;return function(_0x414534){if(_0x414534){return _0x17684b['sendStatus'](_0x4dc1ff);}return _0x17684b['status'](_0x4dc1ff)[_0xdf8c('0x1a')]();};}function respondWithResult(_0x40c9da,_0x17a3af){_0x17a3af=_0x17a3af||0xc8;return function(_0xde696e){if(_0xde696e){return _0x40c9da['status'](_0x17a3af)[_0xdf8c('0x1b')](_0xde696e);}};}function respondWithFilteredResult(_0xbaa92c,_0x1001b5){return function(_0x47d076){if(_0x47d076){var _0x3d97b8=typeof _0x1001b5[_0xdf8c('0x1c')]==='undefined'&&typeof _0x1001b5[_0xdf8c('0x1d')]==='undefined';var _0x51de71=_0x47d076[_0xdf8c('0x1e')];var _0x3f9dbc=_0x3d97b8?0x0:_0x1001b5[_0xdf8c('0x1c')];var _0x5631ff=_0x3d97b8?_0x47d076[_0xdf8c('0x1e')]:_0x1001b5['offset']+_0x1001b5['limit'];var _0x5c1711;if(_0x5631ff>=_0x51de71){_0x5631ff=_0x51de71;_0x5c1711=0xc8;}else{_0x5c1711=0xce;}_0xbaa92c[_0xdf8c('0x1f')](_0x5c1711);return _0xbaa92c[_0xdf8c('0x20')](_0xdf8c('0x21'),_0x3f9dbc+'-'+_0x5631ff+'/'+_0x51de71)[_0xdf8c('0x1b')](_0x47d076);}return null;};}function patchUpdates(_0x381f0f){return function(_0x108cdd){try{jsonpatch[_0xdf8c('0x22')](_0x108cdd,_0x381f0f,!![]);}catch(_0x30a023){return BPromise[_0xdf8c('0x23')](_0x30a023);}return _0x108cdd[_0xdf8c('0x24')]();};}function saveUpdates(_0x1159a2,_0x5c188f){return function(_0x5232ab){if(_0x5232ab){return _0x5232ab[_0xdf8c('0x25')](_0x1159a2)['then'](function(_0x356981){return _0x356981;});}return null;};}function removeEntity(_0x175088,_0x43579f){return function(_0x22a4ea){if(_0x22a4ea){return _0x22a4ea[_0xdf8c('0x26')]()[_0xdf8c('0x27')](function(){_0x175088[_0xdf8c('0x1f')](0xcc)[_0xdf8c('0x1a')]();});}};}function handleEntityNotFound(_0x55ebeb,_0x58130e){return function(_0x1d97cf){if(!_0x1d97cf){_0x55ebeb[_0xdf8c('0x28')](0x194);}return _0x1d97cf;};}function handleError(_0x2728a7,_0x3a4725){_0x3a4725=_0x3a4725||0x1f4;return function(_0x382f21){logger[_0xdf8c('0x29')](_0x382f21[_0xdf8c('0x2a')]);if(_0x382f21[_0xdf8c('0x2b')]){delete _0x382f21[_0xdf8c('0x2b')];}_0x2728a7[_0xdf8c('0x1f')](_0x3a4725)[_0xdf8c('0x2c')](_0x382f21);};}exports['index']=function(_0x513d4a,_0x2048f2){var _0x27d9a5={},_0x159fbe={},_0x2530d0={'count':0x0,'rows':[]};var _0x5cc574=_[_0xdf8c('0x2d')](db[_0xdf8c('0x2e')]['rawAttributes'],function(_0x173a7b){return{'name':_0x173a7b[_0xdf8c('0x2f')],'type':_0x173a7b[_0xdf8c('0x30')]['key']};});_0x159fbe[_0xdf8c('0x31')]=_[_0xdf8c('0x2d')](_0x5cc574,'name');_0x159fbe['query']=_[_0xdf8c('0x32')](_0x513d4a[_0xdf8c('0x33')]);_0x159fbe[_0xdf8c('0x34')]=_[_0xdf8c('0x35')](_0x159fbe[_0xdf8c('0x31')],_0x159fbe[_0xdf8c('0x33')]);_0x27d9a5[_0xdf8c('0x36')]=_[_0xdf8c('0x35')](_0x159fbe['model'],qs[_0xdf8c('0x37')](_0x513d4a['query'][_0xdf8c('0x37')]));_0x27d9a5[_0xdf8c('0x36')]=_0x27d9a5['attributes'][_0xdf8c('0x38')]?_0x27d9a5[_0xdf8c('0x36')]:_0x159fbe['model'];if(!_0x513d4a[_0xdf8c('0x33')]['hasOwnProperty'](_0xdf8c('0x39'))){_0x27d9a5['limit']=qs['limit'](_0x513d4a[_0xdf8c('0x33')][_0xdf8c('0x1d')]);_0x27d9a5[_0xdf8c('0x1c')]=qs[_0xdf8c('0x1c')](_0x513d4a[_0xdf8c('0x33')][_0xdf8c('0x1c')]);}_0x27d9a5['order']=qs[_0xdf8c('0x3a')](_0x513d4a[_0xdf8c('0x33')][_0xdf8c('0x3a')]);_0x27d9a5['where']=qs['filters'](_[_0xdf8c('0x3b')](_0x513d4a['query'],_0x159fbe[_0xdf8c('0x34')]),_0x5cc574);if(_0x513d4a[_0xdf8c('0x33')][_0xdf8c('0x3c')]){_0x27d9a5['where']=_[_0xdf8c('0x3d')](_0x27d9a5[_0xdf8c('0x3e')],{'$or':_[_0xdf8c('0x2d')](_0x5cc574,function(_0x4ef582){if(_0x4ef582[_0xdf8c('0x30')]!==_0xdf8c('0x3f')){var _0x3b80aa={};_0x3b80aa[_0x4ef582['name']]={'$like':'%'+_0x513d4a['query'][_0xdf8c('0x3c')]+'%'};return _0x3b80aa;}})});}_0x27d9a5=_[_0xdf8c('0x3d')]({},_0x27d9a5,_0x513d4a['options']);var _0x432ec8={'where':_0x27d9a5[_0xdf8c('0x3e')]};return db[_0xdf8c('0x2e')][_0xdf8c('0x1e')](_0x432ec8)[_0xdf8c('0x27')](function(_0x483daf){_0x2530d0[_0xdf8c('0x1e')]=_0x483daf;if(_0x513d4a[_0xdf8c('0x33')][_0xdf8c('0x40')]){_0x27d9a5['include']=[{'all':!![]}];}return db[_0xdf8c('0x2e')][_0xdf8c('0x41')](_0x27d9a5);})[_0xdf8c('0x27')](function(_0x5de1d2){_0x2530d0[_0xdf8c('0x42')]=_0x5de1d2;return _0x2530d0;})['then'](respondWithFilteredResult(_0x2048f2,_0x27d9a5))[_0xdf8c('0x43')](handleError(_0x2048f2,null));};exports[_0xdf8c('0x44')]=function(_0x2f1a12,_0x45d771){var _0x3ad2f4={'raw':!![],'where':{'id':_0x2f1a12[_0xdf8c('0x45')]['id']}},_0x5984d2={};_0x5984d2['model']=_[_0xdf8c('0x32')](db['FaxTransferReport']['rawAttributes']);_0x5984d2[_0xdf8c('0x33')]=_['keys'](_0x2f1a12[_0xdf8c('0x33')]);_0x5984d2['filters']=_[_0xdf8c('0x35')](_0x5984d2['model'],_0x5984d2['query']);_0x3ad2f4[_0xdf8c('0x36')]=_[_0xdf8c('0x35')](_0x5984d2['model'],qs['fields'](_0x2f1a12[_0xdf8c('0x33')][_0xdf8c('0x37')]));_0x3ad2f4[_0xdf8c('0x36')]=_0x3ad2f4[_0xdf8c('0x36')][_0xdf8c('0x38')]?_0x3ad2f4[_0xdf8c('0x36')]:_0x5984d2[_0xdf8c('0x31')];if(_0x2f1a12[_0xdf8c('0x33')][_0xdf8c('0x40')]){_0x3ad2f4[_0xdf8c('0x46')]=[{'all':!![]}];}_0x3ad2f4=_['merge']({},_0x3ad2f4,_0x2f1a12[_0xdf8c('0x47')]);return db[_0xdf8c('0x2e')]['find'](_0x3ad2f4)['then'](handleEntityNotFound(_0x45d771,null))['then'](respondWithResult(_0x45d771,null))['catch'](handleError(_0x45d771,null));};exports[_0xdf8c('0x48')]=function(_0x1cb171,_0x4cb1af){return db[_0xdf8c('0x2e')][_0xdf8c('0x48')](_0x1cb171['body'],{})[_0xdf8c('0x27')](respondWithResult(_0x4cb1af,0xc9))['catch'](handleError(_0x4cb1af,null));};exports[_0xdf8c('0x25')]=function(_0x316043,_0x26cb4d){if(_0x316043[_0xdf8c('0x49')]['id']){delete _0x316043['body']['id'];}return db[_0xdf8c('0x2e')]['find']({'where':{'id':_0x316043[_0xdf8c('0x45')]['id']}})[_0xdf8c('0x27')](handleEntityNotFound(_0x26cb4d,null))[_0xdf8c('0x27')](saveUpdates(_0x316043['body'],null))['then'](respondWithResult(_0x26cb4d,null))[_0xdf8c('0x43')](handleError(_0x26cb4d,null));};exports[_0xdf8c('0x26')]=function(_0x491fcd,_0x38b35c){return db[_0xdf8c('0x2e')]['find']({'where':{'id':_0x491fcd[_0xdf8c('0x45')]['id']}})['then'](handleEntityNotFound(_0x38b35c,null))[_0xdf8c('0x27')](removeEntity(_0x38b35c,null))[_0xdf8c('0x43')](handleError(_0x38b35c,null));};exports[_0xdf8c('0x4a')]=function(_0x27e4db,_0x4f958d){return db[_0xdf8c('0x2e')]['describe']()[_0xdf8c('0x27')](respondWithResult(_0x4f958d,null))[_0xdf8c('0x43')](handleError(_0x4f958d,null));}; \ No newline at end of file diff --git a/server/api/faxTransferReport/faxTransferReport.model.js b/server/api/faxTransferReport/faxTransferReport.model.js index fd2db16..509bdd4 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 _0x988c=['report_fax_transfer','uniqueid','util','moment','request-promise','path','rimraf','./faxTransferReport.attributes','exports','define','FaxTransferReport'];(function(_0x2676d7,_0x376226){var _0x49f258=function(_0x57c9fd){while(--_0x57c9fd){_0x2676d7['push'](_0x2676d7['shift']());}};_0x49f258(++_0x376226);}(_0x988c,0x136));var _0xc988=function(_0x43e4e3,_0x5d2937){_0x43e4e3=_0x43e4e3-0x0;var _0x4ab85d=_0x988c[_0x43e4e3];return _0x4ab85d;};'use strict';var _=require('lodash');var util=require(_0xc988('0x0'));var logger=require('../../config/logger')('api');var moment=require(_0xc988('0x1'));var BPromise=require('bluebird');var rp=require(_0xc988('0x2'));var fs=require('fs');var path=require(_0xc988('0x3'));var rimraf=require(_0xc988('0x4'));var config=require('../../config/environment');var attributes=require(_0xc988('0x5'));module[_0xc988('0x6')]=function(_0x4946a4,_0x5a3437){return _0x4946a4[_0xc988('0x7')](_0xc988('0x8'),attributes,{'tableName':_0xc988('0x9'),'paranoid':![],'indexes':[{'name':_0xc988('0xa'),'fields':['uniqueid']}],'timestamps':!![]});}; \ No newline at end of file +var _0x9cae=['api','moment','../../config/environment','./faxTransferReport.attributes','exports','define','FaxTransferReport','report_fax_transfer','uniqueid','util','../../config/logger'];(function(_0x8df9b1,_0x99597d){var _0x59e2d0=function(_0x5ac07e){while(--_0x5ac07e){_0x8df9b1['push'](_0x8df9b1['shift']());}};_0x59e2d0(++_0x99597d);}(_0x9cae,0xb9));var _0xe9ca=function(_0x321bb2,_0x202794){_0x321bb2=_0x321bb2-0x0;var _0x9c12ed=_0x9cae[_0x321bb2];return _0x9c12ed;};'use strict';var _=require('lodash');var util=require(_0xe9ca('0x0'));var logger=require(_0xe9ca('0x1'))(_0xe9ca('0x2'));var moment=require(_0xe9ca('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(_0xe9ca('0x4'));var attributes=require(_0xe9ca('0x5'));module[_0xe9ca('0x6')]=function(_0xc7a786,_0x545f60){return _0xc7a786[_0xe9ca('0x7')](_0xe9ca('0x8'),attributes,{'tableName':_0xe9ca('0x9'),'paranoid':![],'indexes':[{'name':_0xe9ca('0xa'),'fields':[_0xe9ca('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 96e08d4..77194b5 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 _0x927d=['FaxTransferReport,\x20%s,\x20%s,\x20%s','request\x20sent','stringify','error','code','message','result','catch','lodash','moment','randomstring','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','http','request','then','info','FaxTransferReport,\x20%s,\x20%s','debug'];(function(_0x4aa819,_0x12aa48){var _0xfe7a9b=function(_0x414d36){while(--_0x414d36){_0x4aa819['push'](_0x4aa819['shift']());}};_0xfe7a9b(++_0x12aa48);}(_0x927d,0xa9));var _0xd927=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0x927d[_0x3dd15e];return _0x231fd0;};'use strict';var _=require(_0xd927('0x0'));var util=require('util');var moment=require(_0xd927('0x1'));var BPromise=require('bluebird');var rs=require(_0xd927('0x2'));var fs=require('fs');var Redis=require('ioredis');var db=require(_0xd927('0x3'))['db'];var utils=require(_0xd927('0x4'));var logger=require(_0xd927('0x5'))(_0xd927('0x6'));var config=require(_0xd927('0x7'));var jayson=require(_0xd927('0x8'));var client=jayson['client'][_0xd927('0x9')]({'port':0x232a});function respondWithRpcPromise(_0x2297b6,_0x337aab,_0x2f123f){return new BPromise(function(_0x551fcb,_0x501790){return client[_0xd927('0xa')](_0x2297b6,_0x2f123f)[_0xd927('0xb')](function(_0x5d4179){logger[_0xd927('0xc')](_0xd927('0xd'),_0x337aab,'request\x20sent');logger[_0xd927('0xe')](_0xd927('0xf'),_0x337aab,_0xd927('0x10'),JSON[_0xd927('0x11')](_0x5d4179));if(_0x5d4179[_0xd927('0x12')]){if(_0x5d4179[_0xd927('0x12')][_0xd927('0x13')]===0x1f4){logger[_0xd927('0x12')](_0xd927('0xd'),_0x337aab,_0x5d4179[_0xd927('0x12')][_0xd927('0x14')]);return _0x501790(_0x5d4179[_0xd927('0x12')][_0xd927('0x14')]);}logger[_0xd927('0x12')]('FaxTransferReport,\x20%s,\x20%s',_0x337aab,_0x5d4179[_0xd927('0x12')][_0xd927('0x14')]);return _0x551fcb(_0x5d4179[_0xd927('0x12')][_0xd927('0x14')]);}else{logger[_0xd927('0xc')](_0xd927('0xd'),_0x337aab,_0xd927('0x10'));_0x551fcb(_0x5d4179[_0xd927('0x15')]['message']);}})[_0xd927('0x16')](function(_0x5c7537){logger[_0xd927('0x12')](_0xd927('0xd'),_0x337aab,_0x5c7537);_0x501790(_0x5c7537);});});} \ No newline at end of file +var _0x8021=['../../config/environment','client','then','FaxTransferReport,\x20%s,\x20%s','FaxTransferReport,\x20%s,\x20%s,\x20%s','request\x20sent','stringify','error','code','message','result','catch','lodash','util','moment','bluebird','randomstring','ioredis','../../config/utils','../../config/logger','rpc'];(function(_0x5c9b03,_0x161e6a){var _0x58151c=function(_0x391604){while(--_0x391604){_0x5c9b03['push'](_0x5c9b03['shift']());}};_0x58151c(++_0x161e6a);}(_0x8021,0x147));var _0x1802=function(_0x54a761,_0x431fd4){_0x54a761=_0x54a761-0x0;var _0x37d1da=_0x8021[_0x54a761];return _0x37d1da;};'use strict';var _=require(_0x1802('0x0'));var util=require(_0x1802('0x1'));var moment=require(_0x1802('0x2'));var BPromise=require(_0x1802('0x3'));var rs=require(_0x1802('0x4'));var fs=require('fs');var Redis=require(_0x1802('0x5'));var db=require('../../mysqldb')['db'];var utils=require(_0x1802('0x6'));var logger=require(_0x1802('0x7'))(_0x1802('0x8'));var config=require(_0x1802('0x9'));var jayson=require('jayson/promise');var client=jayson[_0x1802('0xa')]['http']({'port':0x232a});function respondWithRpcPromise(_0x5f2703,_0x1c3ff4,_0xbaeeed){return new BPromise(function(_0x3a2815,_0x195ba5){return client['request'](_0x5f2703,_0xbaeeed)[_0x1802('0xb')](function(_0x580fe6){logger['info'](_0x1802('0xc'),_0x1c3ff4,'request\x20sent');logger['debug'](_0x1802('0xd'),_0x1c3ff4,_0x1802('0xe'),JSON[_0x1802('0xf')](_0x580fe6));if(_0x580fe6['error']){if(_0x580fe6[_0x1802('0x10')][_0x1802('0x11')]===0x1f4){logger[_0x1802('0x10')](_0x1802('0xc'),_0x1c3ff4,_0x580fe6['error']['message']);return _0x195ba5(_0x580fe6[_0x1802('0x10')][_0x1802('0x12')]);}logger[_0x1802('0x10')]('FaxTransferReport,\x20%s,\x20%s',_0x1c3ff4,_0x580fe6[_0x1802('0x10')][_0x1802('0x12')]);return _0x3a2815(_0x580fe6[_0x1802('0x10')][_0x1802('0x12')]);}else{logger['info']('FaxTransferReport,\x20%s,\x20%s',_0x1c3ff4,'request\x20sent');_0x3a2815(_0x580fe6[_0x1802('0x13')][_0x1802('0x12')]);}})[_0x1802('0x14')](function(_0x5f341f){logger['error'](_0x1802('0xc'),_0x1c3ff4,_0x5f341f);_0x195ba5(_0x5f341f);});});} \ No newline at end of file diff --git a/server/api/faxTransferReport/index.js b/server/api/faxTransferReport/index.js index d6ec94b..ed7a797 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 _0x0169=['express','../../components/auth/service','../../components/interaction/service','../../config/environment','./faxTransferReport.controller','isAuthenticated','index','get','/describe','/:id','show','create','put','update','delete','destroy','exports','multer','util','path','connect-timeout'];(function(_0x53b53e,_0x498437){var _0xbb6179=function(_0x3975eb){while(--_0x3975eb){_0x53b53e['push'](_0x53b53e['shift']());}};_0xbb6179(++_0x498437);}(_0x0169,0x1df));var _0x9016=function(_0x689ce2,_0x16eb24){_0x689ce2=_0x689ce2-0x0;var _0x28f44a=_0x0169[_0x689ce2];return _0x28f44a;};'use strict';var multer=require(_0x9016('0x0'));var util=require(_0x9016('0x1'));var path=require(_0x9016('0x2'));var timeout=require(_0x9016('0x3'));var express=require(_0x9016('0x4'));var router=express['Router']();var fs_extra=require('fs-extra');var auth=require(_0x9016('0x5'));var interaction=require(_0x9016('0x6'));var config=require(_0x9016('0x7'));var controller=require(_0x9016('0x8'));router['get']('/',auth[_0x9016('0x9')](),controller[_0x9016('0xa')]);router[_0x9016('0xb')](_0x9016('0xc'),auth[_0x9016('0x9')](),controller['describe']);router['get'](_0x9016('0xd'),auth[_0x9016('0x9')](),controller[_0x9016('0xe')]);router['post']('/',auth['isAuthenticated'](),controller[_0x9016('0xf')]);router[_0x9016('0x10')]('/:id',auth[_0x9016('0x9')](),controller[_0x9016('0x11')]);router[_0x9016('0x12')](_0x9016('0xd'),auth[_0x9016('0x9')](),controller[_0x9016('0x13')]);module[_0x9016('0x14')]=router; \ No newline at end of file +var _0x29ed=['Router','fs-extra','../../components/auth/service','get','index','/describe','describe','/:id','show','post','create','put','update','delete','destroy','exports','util','path','connect-timeout','express'];(function(_0x65c50e,_0x1aa926){var _0x4573e7=function(_0x5bc049){while(--_0x5bc049){_0x65c50e['push'](_0x65c50e['shift']());}};_0x4573e7(++_0x1aa926);}(_0x29ed,0x18c));var _0xd29e=function(_0x572cbc,_0x2746b6){_0x572cbc=_0x572cbc-0x0;var _0x2d16c3=_0x29ed[_0x572cbc];return _0x2d16c3;};'use strict';var multer=require('multer');var util=require(_0xd29e('0x0'));var path=require(_0xd29e('0x1'));var timeout=require(_0xd29e('0x2'));var express=require(_0xd29e('0x3'));var router=express[_0xd29e('0x4')]();var fs_extra=require(_0xd29e('0x5'));var auth=require(_0xd29e('0x6'));var interaction=require('../../components/interaction/service');var config=require('../../config/environment');var controller=require('./faxTransferReport.controller');router[_0xd29e('0x7')]('/',auth['isAuthenticated'](),controller[_0xd29e('0x8')]);router['get'](_0xd29e('0x9'),auth['isAuthenticated'](),controller[_0xd29e('0xa')]);router[_0xd29e('0x7')](_0xd29e('0xb'),auth['isAuthenticated'](),controller[_0xd29e('0xc')]);router[_0xd29e('0xd')]('/',auth['isAuthenticated'](),controller[_0xd29e('0xe')]);router[_0xd29e('0xf')](_0xd29e('0xb'),auth['isAuthenticated'](),controller[_0xd29e('0x10')]);router[_0xd29e('0x11')](_0xd29e('0xb'),auth['isAuthenticated'](),controller[_0xd29e('0x12')]);module[_0xd29e('0x13')]=router; \ No newline at end of file diff --git a/server/api/intDeskAccount/index.js b/server/api/intDeskAccount/index.js index 5ee803e..d798cf7 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 _0x5f09=['util','connect-timeout','express','Router','fs-extra','../../components/interaction/service','../../config/environment','get','isAuthenticated','index','/:id','/:id/configurations','getConfigurations','post','create','addConfiguration','put','update','exports','multer'];(function(_0x4377e0,_0x1ed422){var _0x45eecc=function(_0x362fa5){while(--_0x362fa5){_0x4377e0['push'](_0x4377e0['shift']());}};_0x45eecc(++_0x1ed422);}(_0x5f09,0x1df));var _0x95f0=function(_0x2f3d01,_0x5f5dc8){_0x2f3d01=_0x2f3d01-0x0;var _0xf8c881=_0x5f09[_0x2f3d01];return _0xf8c881;};'use strict';var multer=require(_0x95f0('0x0'));var util=require(_0x95f0('0x1'));var path=require('path');var timeout=require(_0x95f0('0x2'));var express=require(_0x95f0('0x3'));var router=express[_0x95f0('0x4')]();var fs_extra=require(_0x95f0('0x5'));var auth=require('../../components/auth/service');var interaction=require(_0x95f0('0x6'));var config=require(_0x95f0('0x7'));var controller=require('./intDeskAccount.controller');router[_0x95f0('0x8')]('/',auth[_0x95f0('0x9')](),controller[_0x95f0('0xa')]);router[_0x95f0('0x8')](_0x95f0('0xb'),auth[_0x95f0('0x9')](),controller['show']);router['get'](_0x95f0('0xc'),auth[_0x95f0('0x9')](),controller[_0x95f0('0xd')]);router[_0x95f0('0x8')]('/:id/fields',auth[_0x95f0('0x9')](),controller['getFields']);router[_0x95f0('0xe')]('/',auth[_0x95f0('0x9')](),controller[_0x95f0('0xf')]);router[_0x95f0('0xe')](_0x95f0('0xc'),auth[_0x95f0('0x9')](),controller[_0x95f0('0x10')]);router[_0x95f0('0x11')]('/:id',auth['isAuthenticated'](),controller[_0x95f0('0x12')]);router['delete'](_0x95f0('0xb'),auth[_0x95f0('0x9')](),controller['destroy']);module[_0x95f0('0x13')]=router; \ No newline at end of file +var _0xa01d=['multer','util','path','express','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','./intDeskAccount.controller','get','isAuthenticated','/:id','show','/:id/fields','getFields','post','addConfiguration','put','update','delete','destroy','exports'];(function(_0x3c957d,_0x40d8f3){var _0x46ab64=function(_0x470663){while(--_0x470663){_0x3c957d['push'](_0x3c957d['shift']());}};_0x46ab64(++_0x40d8f3);}(_0xa01d,0x176));var _0xda01=function(_0x1d24a0,_0x80e9d5){_0x1d24a0=_0x1d24a0-0x0;var _0x403a4a=_0xa01d[_0x1d24a0];return _0x403a4a;};'use strict';var multer=require(_0xda01('0x0'));var util=require(_0xda01('0x1'));var path=require(_0xda01('0x2'));var timeout=require('connect-timeout');var express=require(_0xda01('0x3'));var router=express['Router']();var fs_extra=require(_0xda01('0x4'));var auth=require(_0xda01('0x5'));var interaction=require(_0xda01('0x6'));var config=require(_0xda01('0x7'));var controller=require(_0xda01('0x8'));router[_0xda01('0x9')]('/',auth[_0xda01('0xa')](),controller['index']);router[_0xda01('0x9')](_0xda01('0xb'),auth[_0xda01('0xa')](),controller[_0xda01('0xc')]);router[_0xda01('0x9')]('/:id/configurations',auth[_0xda01('0xa')](),controller['getConfigurations']);router[_0xda01('0x9')](_0xda01('0xd'),auth[_0xda01('0xa')](),controller[_0xda01('0xe')]);router[_0xda01('0xf')]('/',auth['isAuthenticated'](),controller['create']);router[_0xda01('0xf')]('/:id/configurations',auth[_0xda01('0xa')](),controller[_0xda01('0x10')]);router[_0xda01('0x11')](_0xda01('0xb'),auth[_0xda01('0xa')](),controller[_0xda01('0x12')]);router[_0xda01('0x13')](_0xda01('0xb'),auth[_0xda01('0xa')](),controller[_0xda01('0x14')]);module[_0xda01('0x15')]=router; \ No newline at end of file diff --git a/server/api/intDeskAccount/intDeskAccount.attributes.js b/server/api/intDeskAccount/intDeskAccount.attributes.js index b6747d7..c0ec786 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 _0x3b58=['ENUM','basic','integrationTab','newTab','sequelize','STRING'];(function(_0x3dd15e,_0x1f0015){var _0x231fd0=function(_0x4f680a){while(--_0x4f680a){_0x3dd15e['push'](_0x3dd15e['shift']());}};_0x231fd0(++_0x1f0015);}(_0x3b58,0x8e));var _0x83b5=function(_0x21f3b5,_0xfa0255){_0x21f3b5=_0x21f3b5-0x0;var _0x53d290=_0x3b58[_0x21f3b5];return _0x53d290;};'use strict';var Sequelize=require(_0x83b5('0x0'));module['exports']={'name':{'type':Sequelize['STRING']},'description':{'type':Sequelize[_0x83b5('0x1')]},'username':{'type':Sequelize[_0x83b5('0x1')]},'remoteUri':{'type':Sequelize['STRING']},'authType':{'type':Sequelize[_0x83b5('0x2')](_0x83b5('0x3')),'defaultValue':'basic'},'password':{'type':Sequelize[_0x83b5('0x1')]},'consumerKey':{'type':Sequelize['STRING']},'consumerSecret':{'type':Sequelize['STRING']},'token':{'type':Sequelize[_0x83b5('0x1')]},'tokenSecret':{'type':Sequelize[_0x83b5('0x1')]},'serverUrl':{'type':Sequelize[_0x83b5('0x1')],'allowNull':![]},'type':{'type':Sequelize[_0x83b5('0x2')](_0x83b5('0x4'),_0x83b5('0x5')),'defaultValue':_0x83b5('0x4')}}; \ No newline at end of file +var _0xbe11=['sequelize','exports','STRING','ENUM','basic','integrationTab','newTab'];(function(_0x1aa4cb,_0x3ee129){var _0x2b30c7=function(_0x496472){while(--_0x496472){_0x1aa4cb['push'](_0x1aa4cb['shift']());}};_0x2b30c7(++_0x3ee129);}(_0xbe11,0x134));var _0x1be1=function(_0x1f3f15,_0x3305ef){_0x1f3f15=_0x1f3f15-0x0;var _0x3e3316=_0xbe11[_0x1f3f15];return _0x3e3316;};'use strict';var Sequelize=require(_0x1be1('0x0'));module[_0x1be1('0x1')]={'name':{'type':Sequelize[_0x1be1('0x2')]},'description':{'type':Sequelize[_0x1be1('0x2')]},'username':{'type':Sequelize[_0x1be1('0x2')]},'remoteUri':{'type':Sequelize['STRING']},'authType':{'type':Sequelize[_0x1be1('0x3')](_0x1be1('0x4')),'defaultValue':_0x1be1('0x4')},'password':{'type':Sequelize[_0x1be1('0x2')]},'consumerKey':{'type':Sequelize[_0x1be1('0x2')]},'consumerSecret':{'type':Sequelize[_0x1be1('0x2')]},'token':{'type':Sequelize['STRING']},'tokenSecret':{'type':Sequelize[_0x1be1('0x2')]},'serverUrl':{'type':Sequelize[_0x1be1('0x2')],'allowNull':![]},'type':{'type':Sequelize[_0x1be1('0x3')](_0x1be1('0x5'),_0x1be1('0x6')),'defaultValue':_0x1be1('0x5')}}; \ No newline at end of file diff --git a/server/api/intDeskAccount/intDeskAccount.controller.js b/server/api/intDeskAccount/intDeskAccount.controller.js index e224917..3b94ba1 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 _0xf95a=['length','nolimit','limit','order','sort','filter','where','merge','VIRTUAL','options','includeAll','include','rows','params','find','catch','create','body','getConfigurations','findOne','DeskConfiguration','pick','hasOwnProperty','addConfiguration','Subjects','getSubjects','channel','DeskField','Descriptions','getFields','priority','remoteUri','authType','consumerKey','consumerSecret','token','tokenSecret','slice','substring','lastIndexOf','GET','%s/custom_fields','application/json','basic','headers','%s:%s','username','password','toString','entries','active','label','test','statusCode','stringify','Wrong\x20credentials','rimraf','zip-dir','request-promise','moment','bluebird','mustache','util','path','sox','to-csv','ejs','fs-extra','crypto','jsforce','desk.js','querystring','papaparse','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/logger','api','../../config/utils','../../config/environment','../../config/license/util','../../components/integrations/configuration','sendStatus','status','end','json','offset','undefined','count','apply','reject','save','then','destroy','error','stack','name','send','index','map','DeskAccount','rawAttributes','type','model','query','keys','filters','intersection','attributes','fields'];(function(_0x250977,_0x38bc19){var _0xc93ae3=function(_0x3beb17){while(--_0x3beb17){_0x250977['push'](_0x250977['shift']());}};_0xc93ae3(++_0x38bc19);}(_0xf95a,0xa5));var _0xaf95=function(_0x3cadd0,_0x356203){_0x3cadd0=_0x3cadd0-0x0;var _0x492070=_0xf95a[_0x3cadd0];return _0x492070;};'use strict';var emlformat=require('eml-format');var rimraf=require(_0xaf95('0x0'));var zipdir=require(_0xaf95('0x1'));var jsonpatch=require('fast-json-patch');var rp=require(_0xaf95('0x2'));var moment=require(_0xaf95('0x3'));var BPromise=require(_0xaf95('0x4'));var Mustache=require(_0xaf95('0x5'));var util=require(_0xaf95('0x6'));var path=require(_0xaf95('0x7'));var sox=require(_0xaf95('0x8'));var csv=require(_0xaf95('0x9'));var ejs=require(_0xaf95('0xa'));var fs=require('fs');var fs_extra=require(_0xaf95('0xb'));var _=require('lodash');var squel=require('squel');var crypto=require(_0xaf95('0xc'));var jsforce=require(_0xaf95('0xd'));var deskjs=require(_0xaf95('0xe'));var toCsv=require('to-csv');var querystring=require(_0xaf95('0xf'));var Papa=require(_0xaf95('0x10'));var Redis=require('ioredis');var authService=require('../../components/auth/service');var qs=require(_0xaf95('0x11'));var as=require(_0xaf95('0x12'));var hardwareService=require('../../config/license/hardware');var logger=require(_0xaf95('0x13'))(_0xaf95('0x14'));var utils=require(_0xaf95('0x15'));var config=require(_0xaf95('0x16'));var licenseUtil=require(_0xaf95('0x17'));var db=require('../../mysqldb')['db'];var integrations=require(_0xaf95('0x18'));function respondWithStatusCode(_0x46bec2,_0x15949f){_0x15949f=_0x15949f||0xcc;return function(_0x4d246a){if(_0x4d246a){return _0x46bec2[_0xaf95('0x19')](_0x15949f);}return _0x46bec2[_0xaf95('0x1a')](_0x15949f)[_0xaf95('0x1b')]();};}function respondWithResult(_0x3c50ed,_0x485c27){_0x485c27=_0x485c27||0xc8;return function(_0x120696){if(_0x120696){return _0x3c50ed[_0xaf95('0x1a')](_0x485c27)[_0xaf95('0x1c')](_0x120696);}};}function respondWithFilteredResult(_0x190e9d,_0x1892de){return function(_0x1efefb){if(_0x1efefb){var _0x32bcd7=typeof _0x1892de[_0xaf95('0x1d')]===_0xaf95('0x1e')&&typeof _0x1892de['limit']==='undefined';var _0x2c23bf=_0x1efefb[_0xaf95('0x1f')];var _0x3014e5=_0x32bcd7?0x0:_0x1892de['offset'];var _0x1410d6=_0x32bcd7?_0x1efefb['count']:_0x1892de[_0xaf95('0x1d')]+_0x1892de['limit'];var _0x5004c9;if(_0x1410d6>=_0x2c23bf){_0x1410d6=_0x2c23bf;_0x5004c9=0xc8;}else{_0x5004c9=0xce;}_0x190e9d[_0xaf95('0x1a')](_0x5004c9);return _0x190e9d['set']('Content-Range',_0x3014e5+'-'+_0x1410d6+'/'+_0x2c23bf)[_0xaf95('0x1c')](_0x1efefb);}return null;};}function patchUpdates(_0x4f8c64){return function(_0x165a96){try{jsonpatch[_0xaf95('0x20')](_0x165a96,_0x4f8c64,!![]);}catch(_0x24d77c){return BPromise[_0xaf95('0x21')](_0x24d77c);}return _0x165a96[_0xaf95('0x22')]();};}function saveUpdates(_0x350efc,_0xd30497){return function(_0x3609dd){if(_0x3609dd){return _0x3609dd['update'](_0x350efc)[_0xaf95('0x23')](function(_0x4f1a94){return _0x4f1a94;});}return null;};}function removeEntity(_0xfc79fc,_0xd37758){return function(_0x384661){if(_0x384661){return _0x384661[_0xaf95('0x24')]()[_0xaf95('0x23')](function(){_0xfc79fc[_0xaf95('0x1a')](0xcc)[_0xaf95('0x1b')]();});}};}function handleEntityNotFound(_0x41a368,_0x11b166){return function(_0x636eeb){if(!_0x636eeb){_0x41a368[_0xaf95('0x19')](0x194);}return _0x636eeb;};}function handleError(_0x4e7cdd,_0x560a9a){_0x560a9a=_0x560a9a||0x1f4;return function(_0x8c5837){logger[_0xaf95('0x25')](_0x8c5837[_0xaf95('0x26')]);if(_0x8c5837[_0xaf95('0x27')]){delete _0x8c5837[_0xaf95('0x27')];}_0x4e7cdd[_0xaf95('0x1a')](_0x560a9a)[_0xaf95('0x28')](_0x8c5837);};}exports[_0xaf95('0x29')]=function(_0x132d30,_0x2a12c4){var _0x1903ac={},_0x1cd1fc={},_0x4d6d3e={'count':0x0,'rows':[]};var _0x1508a2=_[_0xaf95('0x2a')](db[_0xaf95('0x2b')][_0xaf95('0x2c')],function(_0x297b86){return{'name':_0x297b86['fieldName'],'type':_0x297b86[_0xaf95('0x2d')]['key']};});_0x1cd1fc[_0xaf95('0x2e')]=_[_0xaf95('0x2a')](_0x1508a2,_0xaf95('0x27'));_0x1cd1fc[_0xaf95('0x2f')]=_[_0xaf95('0x30')](_0x132d30[_0xaf95('0x2f')]);_0x1cd1fc[_0xaf95('0x31')]=_[_0xaf95('0x32')](_0x1cd1fc[_0xaf95('0x2e')],_0x1cd1fc[_0xaf95('0x2f')]);_0x1903ac[_0xaf95('0x33')]=_[_0xaf95('0x32')](_0x1cd1fc['model'],qs['fields'](_0x132d30['query'][_0xaf95('0x34')]));_0x1903ac[_0xaf95('0x33')]=_0x1903ac['attributes'][_0xaf95('0x35')]?_0x1903ac[_0xaf95('0x33')]:_0x1cd1fc[_0xaf95('0x2e')];if(!_0x132d30['query']['hasOwnProperty'](_0xaf95('0x36'))){_0x1903ac[_0xaf95('0x37')]=qs['limit'](_0x132d30['query']['limit']);_0x1903ac[_0xaf95('0x1d')]=qs['offset'](_0x132d30[_0xaf95('0x2f')][_0xaf95('0x1d')]);}_0x1903ac[_0xaf95('0x38')]=qs['sort'](_0x132d30[_0xaf95('0x2f')][_0xaf95('0x39')]);_0x1903ac['where']=qs[_0xaf95('0x31')](_['pick'](_0x132d30['query'],_0x1cd1fc[_0xaf95('0x31')]),_0x1508a2);if(_0x132d30[_0xaf95('0x2f')][_0xaf95('0x3a')]){_0x1903ac[_0xaf95('0x3b')]=_[_0xaf95('0x3c')](_0x1903ac[_0xaf95('0x3b')],{'$or':_[_0xaf95('0x2a')](_0x1508a2,function(_0x48110f){if(_0x48110f[_0xaf95('0x2d')]!==_0xaf95('0x3d')){var _0x58af42={};_0x58af42[_0x48110f['name']]={'$like':'%'+_0x132d30['query'][_0xaf95('0x3a')]+'%'};return _0x58af42;}})});}_0x1903ac=_[_0xaf95('0x3c')]({},_0x1903ac,_0x132d30[_0xaf95('0x3e')]);var _0x2d3ef7={'where':_0x1903ac['where']};return db[_0xaf95('0x2b')][_0xaf95('0x1f')](_0x2d3ef7)[_0xaf95('0x23')](function(_0x2974b2){_0x4d6d3e[_0xaf95('0x1f')]=_0x2974b2;if(_0x132d30[_0xaf95('0x2f')][_0xaf95('0x3f')]){_0x1903ac[_0xaf95('0x40')]=[{'all':!![]}];}return db[_0xaf95('0x2b')]['findAll'](_0x1903ac);})[_0xaf95('0x23')](function(_0x21df89){_0x4d6d3e[_0xaf95('0x41')]=_0x21df89;return _0x4d6d3e;})[_0xaf95('0x23')](respondWithFilteredResult(_0x2a12c4,_0x1903ac))['catch'](handleError(_0x2a12c4,null));};exports['show']=function(_0x358945,_0xfc88da){var _0x1a4e70={'raw':![],'where':{'id':_0x358945[_0xaf95('0x42')]['id']}},_0x214d24={};_0x214d24[_0xaf95('0x2e')]=_['keys'](db[_0xaf95('0x2b')]['rawAttributes']);_0x214d24[_0xaf95('0x2f')]=_[_0xaf95('0x30')](_0x358945[_0xaf95('0x2f')]);_0x214d24[_0xaf95('0x31')]=_[_0xaf95('0x32')](_0x214d24[_0xaf95('0x2e')],_0x214d24['query']);_0x1a4e70[_0xaf95('0x33')]=_['intersection'](_0x214d24['model'],qs[_0xaf95('0x34')](_0x358945[_0xaf95('0x2f')]['fields']));_0x1a4e70[_0xaf95('0x33')]=_0x1a4e70[_0xaf95('0x33')]['length']?_0x1a4e70['attributes']:_0x214d24['model'];if(_0x358945['query'][_0xaf95('0x3f')]){_0x1a4e70[_0xaf95('0x40')]=[{'all':!![]}];}_0x1a4e70=_['merge']({},_0x1a4e70,_0x358945[_0xaf95('0x3e')]);return db[_0xaf95('0x2b')][_0xaf95('0x43')](_0x1a4e70)['then'](handleEntityNotFound(_0xfc88da,null))[_0xaf95('0x23')](respondWithResult(_0xfc88da,null))[_0xaf95('0x44')](handleError(_0xfc88da,null));};exports[_0xaf95('0x45')]=function(_0x4cd31f,_0x6df614){return db[_0xaf95('0x2b')][_0xaf95('0x45')](_0x4cd31f[_0xaf95('0x46')],{})[_0xaf95('0x23')](respondWithResult(_0x6df614,0xc9))[_0xaf95('0x44')](handleError(_0x6df614,null));};exports['update']=function(_0x3e6236,_0x351d14){if(_0x3e6236[_0xaf95('0x46')]['id']){delete _0x3e6236[_0xaf95('0x46')]['id'];}return db[_0xaf95('0x2b')][_0xaf95('0x43')]({'where':{'id':_0x3e6236['params']['id']}})['then'](handleEntityNotFound(_0x351d14,null))[_0xaf95('0x23')](saveUpdates(_0x3e6236[_0xaf95('0x46')],null))[_0xaf95('0x23')](respondWithResult(_0x351d14,null))[_0xaf95('0x44')](handleError(_0x351d14,null));};exports['destroy']=function(_0x24ecb5,_0x105474){return db[_0xaf95('0x2b')][_0xaf95('0x43')]({'where':{'id':_0x24ecb5[_0xaf95('0x42')]['id']}})[_0xaf95('0x23')](handleEntityNotFound(_0x105474,null))[_0xaf95('0x23')](removeEntity(_0x105474,null))[_0xaf95('0x44')](handleError(_0x105474,null));};exports[_0xaf95('0x47')]=function(_0x271ef1,_0x5c4ae4,_0xd5b6){var _0x546a5f={};var _0x4b11ab={};var _0x8fe0de;var _0x5e1a55;return db['DeskAccount'][_0xaf95('0x48')]({'where':{'id':_0x271ef1[_0xaf95('0x42')]['id']}})[_0xaf95('0x23')](handleEntityNotFound(_0x5c4ae4,null))['then'](function(_0x3eb5c0){if(_0x3eb5c0){_0x8fe0de=_0x3eb5c0;_0x4b11ab['model']=_[_0xaf95('0x30')](db[_0xaf95('0x49')][_0xaf95('0x2c')]);_0x4b11ab['query']=_[_0xaf95('0x30')](_0x271ef1[_0xaf95('0x2f')]);_0x4b11ab[_0xaf95('0x31')]=_[_0xaf95('0x32')](_0x4b11ab[_0xaf95('0x2e')],_0x4b11ab[_0xaf95('0x2f')]);_0x546a5f['attributes']=_[_0xaf95('0x32')](_0x4b11ab[_0xaf95('0x2e')],qs[_0xaf95('0x34')](_0x271ef1[_0xaf95('0x2f')][_0xaf95('0x34')]));_0x546a5f['attributes']=_0x546a5f['attributes'][_0xaf95('0x35')]?_0x546a5f[_0xaf95('0x33')]:_0x4b11ab[_0xaf95('0x2e')];_0x546a5f[_0xaf95('0x38')]=qs[_0xaf95('0x39')](_0x271ef1[_0xaf95('0x2f')]['sort']);_0x546a5f[_0xaf95('0x3b')]=qs[_0xaf95('0x31')](_[_0xaf95('0x4a')](_0x271ef1[_0xaf95('0x2f')],_0x4b11ab[_0xaf95('0x31')]));if(_0x271ef1[_0xaf95('0x2f')][_0xaf95('0x3a')]){_0x546a5f['where']=_[_0xaf95('0x3c')](_0x546a5f[_0xaf95('0x3b')],{'$or':_[_0xaf95('0x2a')](_0x546a5f[_0xaf95('0x33')],function(_0x58e912){var _0x3fd809={};_0x3fd809[_0x58e912]={'$like':'%'+_0x271ef1[_0xaf95('0x2f')][_0xaf95('0x3a')]+'%'};return _0x3fd809;})});}_0x546a5f=_[_0xaf95('0x3c')]({},_0x546a5f,_0x271ef1[_0xaf95('0x3e')]);return _0x8fe0de['getConfigurations'](_0x546a5f);}})[_0xaf95('0x23')](function(_0x1704c7){if(_0x1704c7){_0x5e1a55=_0x1704c7['length'];if(!_0x271ef1[_0xaf95('0x2f')][_0xaf95('0x4b')](_0xaf95('0x36'))){_0x546a5f['limit']=qs[_0xaf95('0x37')](_0x271ef1[_0xaf95('0x2f')][_0xaf95('0x37')]);_0x546a5f[_0xaf95('0x1d')]=qs['offset'](_0x271ef1['query'][_0xaf95('0x1d')]);}return _0x8fe0de[_0xaf95('0x47')](_0x546a5f);}})[_0xaf95('0x23')](function(_0x5549bf){if(_0x5549bf){return _0x5549bf?{'count':_0x5e1a55,'rows':_0x5549bf}:null;}})[_0xaf95('0x23')](respondWithResult(_0x5c4ae4,null))['catch'](handleError(_0x5c4ae4,null));};exports[_0xaf95('0x4c')]=function(_0x2ba953,_0x43024c,_0x259cee){if(_0x2ba953[_0xaf95('0x46')]['id']){delete _0x2ba953[_0xaf95('0x46')]['id'];}return db[_0xaf95('0x2b')][_0xaf95('0x48')]({'where':{'id':_0x2ba953[_0xaf95('0x42')]['id']}})[_0xaf95('0x23')](handleEntityNotFound(_0x43024c,null))[_0xaf95('0x23')](function(_0x47412e){if(_0x47412e){_0x2ba953[_0xaf95('0x46')]['AccountId']=_0x47412e['id'];_0x2ba953[_0xaf95('0x46')][_0xaf95('0x4d')]=integrations[_0xaf95('0x4e')](_0x2ba953[_0xaf95('0x46')][_0xaf95('0x4f')],_0x2ba953[_0xaf95('0x46')]['type']);_0x2ba953['body']['Descriptions']=integrations['getDescriptions'](_0x2ba953['body'][_0xaf95('0x4f')],_0x2ba953['body'][_0xaf95('0x2d')]);return db['DeskConfiguration']['create'](_0x2ba953[_0xaf95('0x46')],{'include':[{'model':db['DeskField'],'as':_0xaf95('0x4d')},{'model':db[_0xaf95('0x50')],'as':_0xaf95('0x51')}]});}return null;})[_0xaf95('0x23')](respondWithResult(_0x43024c,null))[_0xaf95('0x44')](handleError(_0x43024c,null));};exports[_0xaf95('0x52')]=function(_0x5958fa,_0xf41346,_0x362c6c){var _0x291eb4=[{'name':_0xaf95('0x53'),'label':_0xaf95('0x53'),'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 _0x4e68e0='';return db[_0xaf95('0x2b')][_0xaf95('0x48')]({'where':{'id':_0x5958fa[_0xaf95('0x42')]['id']},'attributes':['id',_0xaf95('0x54'),_0xaf95('0x55'),'username','password',_0xaf95('0x56'),_0xaf95('0x57'),_0xaf95('0x58'),_0xaf95('0x59')]})[_0xaf95('0x23')](handleEntityNotFound(_0xf41346,null))['then'](function(_0x232a8e){if(_0x232a8e){_0x4e68e0=_0x232a8e[_0xaf95('0x54')];var _0x3b8805=_0x4e68e0[_0xaf95('0x5a')](-0x1);if(_0x3b8805==='/'){_0x4e68e0=_0x4e68e0[_0xaf95('0x5b')](0x0,_0x4e68e0[_0xaf95('0x5c')](_0x3b8805));}var _0x58daaa={'method':_0xaf95('0x5d'),'uri':util['format'](_0xaf95('0x5e'),_0x4e68e0),'headers':{'Content-Type':_0xaf95('0x5f'),'Accept':'application/json'},'json':!![]};if(_0x232a8e[_0xaf95('0x55')]===_0xaf95('0x60')){_0x58daaa[_0xaf95('0x61')]['Authorization']=util['format']('Basic\x20%s',new Buffer(util['format'](_0xaf95('0x62'),_0x232a8e[_0xaf95('0x63')],_0x232a8e[_0xaf95('0x64')]))[_0xaf95('0x65')]('base64'));}return rp(_0x58daaa)[_0xaf95('0x23')](function(_0x557a2a){return _0x291eb4['concat'](_[_0xaf95('0x2a')](_0x557a2a['_embedded'][_0xaf95('0x66')],function(_0xd33ce5){return{'id':_0xd33ce5[_0xaf95('0x27')],'name':_0xd33ce5[_0xaf95('0x27')],'type':_0xd33ce5[_0xaf95('0x2d')],'active':_0xd33ce5[_0xaf95('0x67')],'label':_0xd33ce5[_0xaf95('0x68')],'custom':!![]};}));});}})[_0xaf95('0x23')](function(_0x51d064){return{'count':_0x51d064[_0xaf95('0x35')],'rows':_0x51d064};})[_0xaf95('0x23')](respondWithResult(_0xf41346,null))[_0xaf95('0x44')](function(_0x1e1dfc){var _0x79b4a6=_0x5958fa[_0xaf95('0x2f')][_0xaf95('0x69')]?0x1f4:_0x1e1dfc[_0xaf95('0x6a')]||0x1f4;logger['error']('getFields,\x20%s,\x20%s,\x20%s',_0xaf95('0x52'),_0x79b4a6,JSON[_0xaf95('0x6b')](_0x1e1dfc));delete _0x1e1dfc[_0xaf95('0x27')];if(_0x79b4a6===0x191){_0x79b4a6=0x190;}_0xf41346[_0xaf95('0x1a')](_0x79b4a6)[_0xaf95('0x28')](_0x5958fa[_0xaf95('0x2f')]['test']?{'message':_0xaf95('0x6c'),'statusCode':_0x1e1dfc['statusCode']}:_0x1e1dfc);});}; \ No newline at end of file +var _0xadf8=['DeskField','getFields','priority','remoteUri','username','password','consumerSecret','token','tokenSecret','slice','substring','lastIndexOf','format','application/json','basic','headers','toString','concat','_embedded','entries','active','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','to-csv','lodash','squel','crypto','jsforce','desk.js','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/logger','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','../../components/integrations/configuration','end','status','undefined','limit','count','offset','set','json','apply','reject','save','then','sendStatus','error','stack','name','send','index','map','DeskAccount','type','key','model','query','keys','filters','intersection','attributes','fields','length','order','sort','where','pick','filter','merge','VIRTUAL','options','include','rows','show','find','catch','create','body','update','params','findOne','DeskConfiguration','rawAttributes','getConfigurations','hasOwnProperty','nolimit','AccountId','Subjects','getSubjects','channel','Descriptions','getDescriptions'];(function(_0x15ea09,_0x2f30ab){var _0x3e9c78=function(_0x15f8ba){while(--_0x15f8ba){_0x15ea09['push'](_0x15ea09['shift']());}};_0x3e9c78(++_0x2f30ab);}(_0xadf8,0xf7));var _0x8adf=function(_0x584d37,_0x13fb20){_0x584d37=_0x584d37-0x0;var _0x1a1dbf=_0xadf8[_0x584d37];return _0x1a1dbf;};'use strict';var emlformat=require(_0x8adf('0x0'));var rimraf=require(_0x8adf('0x1'));var zipdir=require(_0x8adf('0x2'));var jsonpatch=require(_0x8adf('0x3'));var rp=require(_0x8adf('0x4'));var moment=require(_0x8adf('0x5'));var BPromise=require(_0x8adf('0x6'));var Mustache=require(_0x8adf('0x7'));var util=require(_0x8adf('0x8'));var path=require(_0x8adf('0x9'));var sox=require('sox');var csv=require(_0x8adf('0xa'));var ejs=require('ejs');var fs=require('fs');var fs_extra=require('fs-extra');var _=require(_0x8adf('0xb'));var squel=require(_0x8adf('0xc'));var crypto=require(_0x8adf('0xd'));var jsforce=require(_0x8adf('0xe'));var deskjs=require(_0x8adf('0xf'));var toCsv=require(_0x8adf('0xa'));var querystring=require('querystring');var Papa=require(_0x8adf('0x10'));var Redis=require(_0x8adf('0x11'));var authService=require(_0x8adf('0x12'));var qs=require(_0x8adf('0x13'));var as=require(_0x8adf('0x14'));var hardwareService=require('../../config/license/hardware');var logger=require(_0x8adf('0x15'))('api');var utils=require(_0x8adf('0x16'));var config=require(_0x8adf('0x17'));var licenseUtil=require(_0x8adf('0x18'));var db=require(_0x8adf('0x19'))['db'];var integrations=require(_0x8adf('0x1a'));function respondWithStatusCode(_0x4714b0,_0x1feb1f){_0x1feb1f=_0x1feb1f||0xcc;return function(_0x176ed4){if(_0x176ed4){return _0x4714b0['sendStatus'](_0x1feb1f);}return _0x4714b0['status'](_0x1feb1f)[_0x8adf('0x1b')]();};}function respondWithResult(_0x11ce46,_0xa8bd14){_0xa8bd14=_0xa8bd14||0xc8;return function(_0x2aa391){if(_0x2aa391){return _0x11ce46[_0x8adf('0x1c')](_0xa8bd14)['json'](_0x2aa391);}};}function respondWithFilteredResult(_0x6862ee,_0x130e86){return function(_0x2f18cf){if(_0x2f18cf){var _0x36b66b=typeof _0x130e86['offset']===_0x8adf('0x1d')&&typeof _0x130e86[_0x8adf('0x1e')]===_0x8adf('0x1d');var _0x44fbd3=_0x2f18cf[_0x8adf('0x1f')];var _0x1dfbec=_0x36b66b?0x0:_0x130e86[_0x8adf('0x20')];var _0x117d1c=_0x36b66b?_0x2f18cf[_0x8adf('0x1f')]:_0x130e86['offset']+_0x130e86['limit'];var _0x2fd308;if(_0x117d1c>=_0x44fbd3){_0x117d1c=_0x44fbd3;_0x2fd308=0xc8;}else{_0x2fd308=0xce;}_0x6862ee[_0x8adf('0x1c')](_0x2fd308);return _0x6862ee[_0x8adf('0x21')]('Content-Range',_0x1dfbec+'-'+_0x117d1c+'/'+_0x44fbd3)[_0x8adf('0x22')](_0x2f18cf);}return null;};}function patchUpdates(_0x399d52){return function(_0x2cba0a){try{jsonpatch[_0x8adf('0x23')](_0x2cba0a,_0x399d52,!![]);}catch(_0x29d9db){return BPromise[_0x8adf('0x24')](_0x29d9db);}return _0x2cba0a[_0x8adf('0x25')]();};}function saveUpdates(_0x10498e,_0x23e2c0){return function(_0x395efb){if(_0x395efb){return _0x395efb['update'](_0x10498e)[_0x8adf('0x26')](function(_0xdb5701){return _0xdb5701;});}return null;};}function removeEntity(_0x1947df,_0x1b8df7){return function(_0x1814e5){if(_0x1814e5){return _0x1814e5['destroy']()[_0x8adf('0x26')](function(){_0x1947df['status'](0xcc)[_0x8adf('0x1b')]();});}};}function handleEntityNotFound(_0xd3d476,_0x25c6f3){return function(_0x296eba){if(!_0x296eba){_0xd3d476[_0x8adf('0x27')](0x194);}return _0x296eba;};}function handleError(_0x4ba6c3,_0x3b28b9){_0x3b28b9=_0x3b28b9||0x1f4;return function(_0x491037){logger[_0x8adf('0x28')](_0x491037[_0x8adf('0x29')]);if(_0x491037[_0x8adf('0x2a')]){delete _0x491037['name'];}_0x4ba6c3[_0x8adf('0x1c')](_0x3b28b9)[_0x8adf('0x2b')](_0x491037);};}exports[_0x8adf('0x2c')]=function(_0x5f3402,_0x14e378){var _0x293ad1={},_0x3fb777={},_0x546496={'count':0x0,'rows':[]};var _0x1111be=_[_0x8adf('0x2d')](db[_0x8adf('0x2e')]['rawAttributes'],function(_0x37c101){return{'name':_0x37c101['fieldName'],'type':_0x37c101[_0x8adf('0x2f')][_0x8adf('0x30')]};});_0x3fb777[_0x8adf('0x31')]=_[_0x8adf('0x2d')](_0x1111be,'name');_0x3fb777[_0x8adf('0x32')]=_[_0x8adf('0x33')](_0x5f3402[_0x8adf('0x32')]);_0x3fb777[_0x8adf('0x34')]=_[_0x8adf('0x35')](_0x3fb777[_0x8adf('0x31')],_0x3fb777['query']);_0x293ad1[_0x8adf('0x36')]=_[_0x8adf('0x35')](_0x3fb777[_0x8adf('0x31')],qs['fields'](_0x5f3402[_0x8adf('0x32')][_0x8adf('0x37')]));_0x293ad1[_0x8adf('0x36')]=_0x293ad1[_0x8adf('0x36')][_0x8adf('0x38')]?_0x293ad1['attributes']:_0x3fb777[_0x8adf('0x31')];if(!_0x5f3402[_0x8adf('0x32')]['hasOwnProperty']('nolimit')){_0x293ad1[_0x8adf('0x1e')]=qs[_0x8adf('0x1e')](_0x5f3402[_0x8adf('0x32')]['limit']);_0x293ad1['offset']=qs[_0x8adf('0x20')](_0x5f3402[_0x8adf('0x32')][_0x8adf('0x20')]);}_0x293ad1[_0x8adf('0x39')]=qs[_0x8adf('0x3a')](_0x5f3402[_0x8adf('0x32')]['sort']);_0x293ad1[_0x8adf('0x3b')]=qs[_0x8adf('0x34')](_[_0x8adf('0x3c')](_0x5f3402[_0x8adf('0x32')],_0x3fb777['filters']),_0x1111be);if(_0x5f3402[_0x8adf('0x32')][_0x8adf('0x3d')]){_0x293ad1['where']=_[_0x8adf('0x3e')](_0x293ad1[_0x8adf('0x3b')],{'$or':_[_0x8adf('0x2d')](_0x1111be,function(_0x413830){if(_0x413830[_0x8adf('0x2f')]!==_0x8adf('0x3f')){var _0x51b785={};_0x51b785[_0x413830['name']]={'$like':'%'+_0x5f3402[_0x8adf('0x32')][_0x8adf('0x3d')]+'%'};return _0x51b785;}})});}_0x293ad1=_[_0x8adf('0x3e')]({},_0x293ad1,_0x5f3402[_0x8adf('0x40')]);var _0x3222a2={'where':_0x293ad1[_0x8adf('0x3b')]};return db[_0x8adf('0x2e')][_0x8adf('0x1f')](_0x3222a2)[_0x8adf('0x26')](function(_0x5643f2){_0x546496[_0x8adf('0x1f')]=_0x5643f2;if(_0x5f3402[_0x8adf('0x32')]['includeAll']){_0x293ad1[_0x8adf('0x41')]=[{'all':!![]}];}return db[_0x8adf('0x2e')]['findAll'](_0x293ad1);})[_0x8adf('0x26')](function(_0x4264b0){_0x546496[_0x8adf('0x42')]=_0x4264b0;return _0x546496;})[_0x8adf('0x26')](respondWithFilteredResult(_0x14e378,_0x293ad1))['catch'](handleError(_0x14e378,null));};exports[_0x8adf('0x43')]=function(_0x4a061e,_0x494d22){var _0x2f12a0={'raw':![],'where':{'id':_0x4a061e['params']['id']}},_0x42dead={};_0x42dead[_0x8adf('0x31')]=_['keys'](db[_0x8adf('0x2e')]['rawAttributes']);_0x42dead['query']=_[_0x8adf('0x33')](_0x4a061e[_0x8adf('0x32')]);_0x42dead['filters']=_[_0x8adf('0x35')](_0x42dead[_0x8adf('0x31')],_0x42dead[_0x8adf('0x32')]);_0x2f12a0[_0x8adf('0x36')]=_[_0x8adf('0x35')](_0x42dead[_0x8adf('0x31')],qs[_0x8adf('0x37')](_0x4a061e[_0x8adf('0x32')]['fields']));_0x2f12a0[_0x8adf('0x36')]=_0x2f12a0[_0x8adf('0x36')]['length']?_0x2f12a0[_0x8adf('0x36')]:_0x42dead['model'];if(_0x4a061e[_0x8adf('0x32')]['includeAll']){_0x2f12a0[_0x8adf('0x41')]=[{'all':!![]}];}_0x2f12a0=_[_0x8adf('0x3e')]({},_0x2f12a0,_0x4a061e[_0x8adf('0x40')]);return db[_0x8adf('0x2e')][_0x8adf('0x44')](_0x2f12a0)['then'](handleEntityNotFound(_0x494d22,null))[_0x8adf('0x26')](respondWithResult(_0x494d22,null))[_0x8adf('0x45')](handleError(_0x494d22,null));};exports[_0x8adf('0x46')]=function(_0x2e263b,_0x589fe2){return db['DeskAccount'][_0x8adf('0x46')](_0x2e263b[_0x8adf('0x47')],{})['then'](respondWithResult(_0x589fe2,0xc9))[_0x8adf('0x45')](handleError(_0x589fe2,null));};exports[_0x8adf('0x48')]=function(_0x198738,_0x59355a){if(_0x198738[_0x8adf('0x47')]['id']){delete _0x198738[_0x8adf('0x47')]['id'];}return db[_0x8adf('0x2e')][_0x8adf('0x44')]({'where':{'id':_0x198738[_0x8adf('0x49')]['id']}})[_0x8adf('0x26')](handleEntityNotFound(_0x59355a,null))[_0x8adf('0x26')](saveUpdates(_0x198738[_0x8adf('0x47')],null))[_0x8adf('0x26')](respondWithResult(_0x59355a,null))['catch'](handleError(_0x59355a,null));};exports['destroy']=function(_0x30b376,_0x3761a0){return db[_0x8adf('0x2e')][_0x8adf('0x44')]({'where':{'id':_0x30b376[_0x8adf('0x49')]['id']}})[_0x8adf('0x26')](handleEntityNotFound(_0x3761a0,null))[_0x8adf('0x26')](removeEntity(_0x3761a0,null))[_0x8adf('0x45')](handleError(_0x3761a0,null));};exports['getConfigurations']=function(_0x2653ec,_0x9be787,_0x488b29){var _0x32c8f6={};var _0x8601b1={};var _0xf851a5;var _0x4bb416;return db['DeskAccount'][_0x8adf('0x4a')]({'where':{'id':_0x2653ec[_0x8adf('0x49')]['id']}})[_0x8adf('0x26')](handleEntityNotFound(_0x9be787,null))[_0x8adf('0x26')](function(_0x416e05){if(_0x416e05){_0xf851a5=_0x416e05;_0x8601b1[_0x8adf('0x31')]=_['keys'](db[_0x8adf('0x4b')][_0x8adf('0x4c')]);_0x8601b1['query']=_[_0x8adf('0x33')](_0x2653ec[_0x8adf('0x32')]);_0x8601b1[_0x8adf('0x34')]=_[_0x8adf('0x35')](_0x8601b1[_0x8adf('0x31')],_0x8601b1[_0x8adf('0x32')]);_0x32c8f6[_0x8adf('0x36')]=_[_0x8adf('0x35')](_0x8601b1[_0x8adf('0x31')],qs['fields'](_0x2653ec[_0x8adf('0x32')][_0x8adf('0x37')]));_0x32c8f6['attributes']=_0x32c8f6[_0x8adf('0x36')][_0x8adf('0x38')]?_0x32c8f6['attributes']:_0x8601b1[_0x8adf('0x31')];_0x32c8f6[_0x8adf('0x39')]=qs[_0x8adf('0x3a')](_0x2653ec[_0x8adf('0x32')]['sort']);_0x32c8f6[_0x8adf('0x3b')]=qs[_0x8adf('0x34')](_[_0x8adf('0x3c')](_0x2653ec['query'],_0x8601b1[_0x8adf('0x34')]));if(_0x2653ec['query'][_0x8adf('0x3d')]){_0x32c8f6[_0x8adf('0x3b')]=_['merge'](_0x32c8f6['where'],{'$or':_[_0x8adf('0x2d')](_0x32c8f6[_0x8adf('0x36')],function(_0x3d2a30){var _0x588735={};_0x588735[_0x3d2a30]={'$like':'%'+_0x2653ec[_0x8adf('0x32')][_0x8adf('0x3d')]+'%'};return _0x588735;})});}_0x32c8f6=_[_0x8adf('0x3e')]({},_0x32c8f6,_0x2653ec[_0x8adf('0x40')]);return _0xf851a5[_0x8adf('0x4d')](_0x32c8f6);}})[_0x8adf('0x26')](function(_0x18436f){if(_0x18436f){_0x4bb416=_0x18436f[_0x8adf('0x38')];if(!_0x2653ec[_0x8adf('0x32')][_0x8adf('0x4e')](_0x8adf('0x4f'))){_0x32c8f6['limit']=qs[_0x8adf('0x1e')](_0x2653ec[_0x8adf('0x32')]['limit']);_0x32c8f6[_0x8adf('0x20')]=qs[_0x8adf('0x20')](_0x2653ec[_0x8adf('0x32')][_0x8adf('0x20')]);}return _0xf851a5[_0x8adf('0x4d')](_0x32c8f6);}})[_0x8adf('0x26')](function(_0x28c445){if(_0x28c445){return _0x28c445?{'count':_0x4bb416,'rows':_0x28c445}:null;}})[_0x8adf('0x26')](respondWithResult(_0x9be787,null))['catch'](handleError(_0x9be787,null));};exports['addConfiguration']=function(_0x3645f9,_0x37c750,_0x529405){if(_0x3645f9['body']['id']){delete _0x3645f9[_0x8adf('0x47')]['id'];}return db[_0x8adf('0x2e')][_0x8adf('0x4a')]({'where':{'id':_0x3645f9[_0x8adf('0x49')]['id']}})['then'](handleEntityNotFound(_0x37c750,null))[_0x8adf('0x26')](function(_0x3ba038){if(_0x3ba038){_0x3645f9[_0x8adf('0x47')][_0x8adf('0x50')]=_0x3ba038['id'];_0x3645f9[_0x8adf('0x47')][_0x8adf('0x51')]=integrations[_0x8adf('0x52')](_0x3645f9['body'][_0x8adf('0x53')],_0x3645f9[_0x8adf('0x47')][_0x8adf('0x2f')]);_0x3645f9['body'][_0x8adf('0x54')]=integrations[_0x8adf('0x55')](_0x3645f9[_0x8adf('0x47')]['channel'],_0x3645f9[_0x8adf('0x47')][_0x8adf('0x2f')]);return db[_0x8adf('0x4b')][_0x8adf('0x46')](_0x3645f9[_0x8adf('0x47')],{'include':[{'model':db[_0x8adf('0x56')],'as':_0x8adf('0x51')},{'model':db[_0x8adf('0x56')],'as':_0x8adf('0x54')}]});}return null;})['then'](respondWithResult(_0x37c750,null))[_0x8adf('0x45')](handleError(_0x37c750,null));};exports[_0x8adf('0x57')]=function(_0x22affd,_0x426360,_0x390350){var _0xa81cf2=[{'name':'priority','label':_0x8adf('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 _0x2b86e9='';return db[_0x8adf('0x2e')]['findOne']({'where':{'id':_0x22affd[_0x8adf('0x49')]['id']},'attributes':['id',_0x8adf('0x59'),'authType',_0x8adf('0x5a'),_0x8adf('0x5b'),'consumerKey',_0x8adf('0x5c'),_0x8adf('0x5d'),_0x8adf('0x5e')]})[_0x8adf('0x26')](handleEntityNotFound(_0x426360,null))[_0x8adf('0x26')](function(_0xf6b96a){if(_0xf6b96a){_0x2b86e9=_0xf6b96a['remoteUri'];var _0x20afa8=_0x2b86e9[_0x8adf('0x5f')](-0x1);if(_0x20afa8==='/'){_0x2b86e9=_0x2b86e9[_0x8adf('0x60')](0x0,_0x2b86e9[_0x8adf('0x61')](_0x20afa8));}var _0x41b996={'method':'GET','uri':util[_0x8adf('0x62')]('%s/custom_fields',_0x2b86e9),'headers':{'Content-Type':_0x8adf('0x63'),'Accept':_0x8adf('0x63')},'json':!![]};if(_0xf6b96a['authType']===_0x8adf('0x64')){_0x41b996[_0x8adf('0x65')]['Authorization']=util[_0x8adf('0x62')]('Basic\x20%s',new Buffer(util[_0x8adf('0x62')]('%s:%s',_0xf6b96a['username'],_0xf6b96a[_0x8adf('0x5b')]))[_0x8adf('0x66')]('base64'));}return rp(_0x41b996)[_0x8adf('0x26')](function(_0x2152bd){return _0xa81cf2[_0x8adf('0x67')](_[_0x8adf('0x2d')](_0x2152bd[_0x8adf('0x68')][_0x8adf('0x69')],function(_0x3dab9e){return{'id':_0x3dab9e['name'],'name':_0x3dab9e['name'],'type':_0x3dab9e['type'],'active':_0x3dab9e[_0x8adf('0x6a')],'label':_0x3dab9e['label'],'custom':!![]};}));});}})[_0x8adf('0x26')](function(_0x144686){return{'count':_0x144686[_0x8adf('0x38')],'rows':_0x144686};})[_0x8adf('0x26')](respondWithResult(_0x426360,null))[_0x8adf('0x45')](function(_0x416b8c){var _0x5f2619=_0x22affd[_0x8adf('0x32')][_0x8adf('0x6b')]?0x1f4:_0x416b8c[_0x8adf('0x6c')]||0x1f4;logger[_0x8adf('0x28')](_0x8adf('0x6d'),_0x8adf('0x57'),_0x5f2619,JSON['stringify'](_0x416b8c));delete _0x416b8c['name'];if(_0x5f2619===0x191){_0x5f2619=0x190;}_0x426360['status'](_0x5f2619)[_0x8adf('0x2b')](_0x22affd[_0x8adf('0x32')][_0x8adf('0x6b')]?{'message':_0x8adf('0x6e'),'statusCode':_0x416b8c[_0x8adf('0x6c')]}:_0x416b8c);});}; \ No newline at end of file diff --git a/server/api/intDeskAccount/intDeskAccount.model.js b/server/api/intDeskAccount/intDeskAccount.model.js index 39e0e6a..5056eec 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 _0x25a7=['../../components/integrations/configuration','exports','DeskAccount','int_desk_accounts','lodash','api','moment','path','rimraf','../../config/environment','./intDeskAccount.attributes'];(function(_0x253335,_0x24ce04){var _0x3fbfa4=function(_0x33a987){while(--_0x33a987){_0x253335['push'](_0x253335['shift']());}};_0x3fbfa4(++_0x24ce04);}(_0x25a7,0xb4));var _0x725a=function(_0x358584,_0x3978f0){_0x358584=_0x358584-0x0;var _0x4865a4=_0x25a7[_0x358584];return _0x4865a4;};'use strict';var _=require(_0x725a('0x0'));var util=require('util');var logger=require('../../config/logger')(_0x725a('0x1'));var moment=require(_0x725a('0x2'));var BPromise=require('bluebird');var rp=require('request-promise');var fs=require('fs');var path=require(_0x725a('0x3'));var rimraf=require(_0x725a('0x4'));var config=require(_0x725a('0x5'));var attributes=require(_0x725a('0x6'));var integrations=require(_0x725a('0x7'));module[_0x725a('0x8')]=function(_0x5471f4,_0xd28298){return _0x5471f4['define'](_0x725a('0x9'),attributes,{'tableName':_0x725a('0xa'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x9ae7=['rimraf','./intDeskAccount.attributes','../../components/integrations/configuration','exports','define','DeskAccount','lodash','util','../../config/logger','moment','request-promise','path'];(function(_0x3b2f10,_0x34dc5f){var _0x563d79=function(_0x5ab05a){while(--_0x5ab05a){_0x3b2f10['push'](_0x3b2f10['shift']());}};_0x563d79(++_0x34dc5f);}(_0x9ae7,0x132));var _0x79ae=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0x9ae7[_0x3dd15e];return _0x231fd0;};'use strict';var _=require(_0x79ae('0x0'));var util=require(_0x79ae('0x1'));var logger=require(_0x79ae('0x2'))('api');var moment=require(_0x79ae('0x3'));var BPromise=require('bluebird');var rp=require(_0x79ae('0x4'));var fs=require('fs');var path=require(_0x79ae('0x5'));var rimraf=require(_0x79ae('0x6'));var config=require('../../config/environment');var attributes=require(_0x79ae('0x7'));var integrations=require(_0x79ae('0x8'));module[_0x79ae('0x9')]=function(_0xe118f2,_0x2250a0){return _0xe118f2[_0x79ae('0xa')](_0x79ae('0xb'),attributes,{'tableName':'int_desk_accounts','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 b69d5aa..8c119e7 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 _0x38d5=['limit','include','map','model','attributes','then','ShowDeskAccount','find','raw','lodash','bluebird','ioredis','../../mysqldb','../../config/utils','../../config/logger','../../config/environment','jayson/promise','client','request','info','DeskAccount,\x20%s,\x20%s','request\x20sent','debug','DeskAccount,\x20%s,\x20%s,\x20%s','stringify','error','code','message','result','GetDeskAccount','DeskAccount','findAll','options','where'];(function(_0x301a9e,_0xae4efe){var _0x28e9ca=function(_0xb6f3a3){while(--_0xb6f3a3){_0x301a9e['push'](_0x301a9e['shift']());}};_0x28e9ca(++_0xae4efe);}(_0x38d5,0x91));var _0x538d=function(_0x3c9de7,_0x5302ef){_0x3c9de7=_0x3c9de7-0x0;var _0x13c972=_0x38d5[_0x3c9de7];return _0x13c972;};'use strict';var _=require(_0x538d('0x0'));var util=require('util');var moment=require('moment');var BPromise=require(_0x538d('0x1'));var rs=require('randomstring');var fs=require('fs');var Redis=require(_0x538d('0x2'));var db=require(_0x538d('0x3'))['db'];var utils=require(_0x538d('0x4'));var logger=require(_0x538d('0x5'))('rpc');var config=require(_0x538d('0x6'));var jayson=require(_0x538d('0x7'));var client=jayson[_0x538d('0x8')]['http']({'port':0x232a});function respondWithRpcPromise(_0x3edb23,_0x10c8a0,_0x540051){return new BPromise(function(_0x31a82c,_0x15168c){return client[_0x538d('0x9')](_0x3edb23,_0x540051)['then'](function(_0x255bad){logger[_0x538d('0xa')](_0x538d('0xb'),_0x10c8a0,_0x538d('0xc'));logger[_0x538d('0xd')](_0x538d('0xe'),_0x10c8a0,_0x538d('0xc'),JSON[_0x538d('0xf')](_0x255bad));if(_0x255bad[_0x538d('0x10')]){if(_0x255bad[_0x538d('0x10')][_0x538d('0x11')]===0x1f4){logger['error'](_0x538d('0xb'),_0x10c8a0,_0x255bad[_0x538d('0x10')]['message']);return _0x15168c(_0x255bad[_0x538d('0x10')]['message']);}logger[_0x538d('0x10')]('DeskAccount,\x20%s,\x20%s',_0x10c8a0,_0x255bad[_0x538d('0x10')][_0x538d('0x12')]);return _0x31a82c(_0x255bad[_0x538d('0x10')][_0x538d('0x12')]);}else{logger[_0x538d('0xa')](_0x538d('0xb'),_0x10c8a0,'request\x20sent');_0x31a82c(_0x255bad[_0x538d('0x13')][_0x538d('0x12')]);}})['catch'](function(_0x367d1d){logger[_0x538d('0x10')](_0x538d('0xb'),_0x10c8a0,_0x367d1d);_0x15168c(_0x367d1d);});});}exports[_0x538d('0x14')]=function(_0x3f585a){var _0x46e78e=this;return new Promise(function(_0x13cbb7,_0x4239fc){return db[_0x538d('0x15')][_0x538d('0x16')]({'raw':_0x3f585a['options']?_0x3f585a[_0x538d('0x17')]['raw']===undefined?!![]:![]:!![],'where':_0x3f585a['options']?_0x3f585a['options'][_0x538d('0x18')]||null:null,'attributes':_0x3f585a[_0x538d('0x17')]?_0x3f585a['options']['attributes']||null:null,'limit':_0x3f585a[_0x538d('0x17')]?_0x3f585a[_0x538d('0x17')][_0x538d('0x19')]||null:null,'include':_0x3f585a[_0x538d('0x17')]?_0x3f585a[_0x538d('0x17')][_0x538d('0x1a')]?_[_0x538d('0x1b')](_0x3f585a[_0x538d('0x17')][_0x538d('0x1a')],function(_0x4b1b2b){return{'model':db[_0x4b1b2b[_0x538d('0x1c')]],'as':_0x4b1b2b['as'],'attributes':_0x4b1b2b['attributes'],'include':_0x4b1b2b['include']?_['map'](_0x4b1b2b['include'],function(_0x27070a){return{'model':db[_0x27070a[_0x538d('0x1c')]],'as':_0x27070a['as'],'attributes':_0x27070a[_0x538d('0x1d')],'include':_0x27070a['include']?_[_0x538d('0x1b')](_0x27070a[_0x538d('0x1a')],function(_0x52eaeb){return{'model':db[_0x52eaeb[_0x538d('0x1c')]],'as':_0x52eaeb['as'],'attributes':_0x52eaeb[_0x538d('0x1d')]};}):[]};}):[]};}):[]:[]})[_0x538d('0x1e')](function(_0x66e869){logger[_0x538d('0xa')](_0x538d('0x14'),_0x3f585a);logger[_0x538d('0xd')](_0x538d('0x14'),_0x3f585a,JSON[_0x538d('0xf')](_0x66e869));_0x13cbb7(_0x66e869);})['catch'](function(_0x21e3db){logger[_0x538d('0x10')](_0x538d('0x14'),_0x21e3db[_0x538d('0x12')],_0x3f585a);_0x4239fc(_0x46e78e['error'](0x1f4,_0x21e3db[_0x538d('0x12')]));});});};exports[_0x538d('0x1f')]=function(_0x45c052){var _0x4c206a=this;return new Promise(function(_0x7ce1e3,_0x2fabcc){return db[_0x538d('0x15')][_0x538d('0x20')]({'raw':_0x45c052['options']?_0x45c052[_0x538d('0x17')][_0x538d('0x21')]===undefined?!![]:![]:!![],'where':_0x45c052[_0x538d('0x17')]?_0x45c052[_0x538d('0x17')][_0x538d('0x18')]||null:null,'attributes':_0x45c052['options']?_0x45c052[_0x538d('0x17')][_0x538d('0x1d')]||null:null,'include':_0x45c052[_0x538d('0x17')]?_0x45c052[_0x538d('0x17')][_0x538d('0x1a')]?_[_0x538d('0x1b')](_0x45c052['options'][_0x538d('0x1a')],function(_0x2f8c8a){return{'model':db[_0x2f8c8a['model']],'as':_0x2f8c8a['as'],'attributes':_0x2f8c8a['attributes'],'include':_0x2f8c8a[_0x538d('0x1a')]?_[_0x538d('0x1b')](_0x2f8c8a['include'],function(_0x457f95){return{'model':db[_0x457f95[_0x538d('0x1c')]],'as':_0x457f95['as'],'attributes':_0x457f95['attributes'],'include':_0x457f95[_0x538d('0x1a')]?_['map'](_0x457f95[_0x538d('0x1a')],function(_0x3746ba){return{'model':db[_0x3746ba[_0x538d('0x1c')]],'as':_0x3746ba['as'],'attributes':_0x3746ba[_0x538d('0x1d')]};}):[]};}):[]};}):[]:[]})['then'](function(_0x514e4f){logger[_0x538d('0xa')](_0x538d('0x1f'),_0x45c052);logger[_0x538d('0xd')](_0x538d('0x1f'),_0x45c052,JSON[_0x538d('0xf')](_0x514e4f));_0x7ce1e3(_0x514e4f);})['catch'](function(_0x42aa69){logger[_0x538d('0x10')](_0x538d('0x1f'),_0x42aa69['message'],_0x45c052);_0x2fabcc(_0x4c206a[_0x538d('0x10')](0x1f4,_0x42aa69['message']));});});}; \ No newline at end of file +var _0x4174=['options','where','attributes','limit','include','map','model','debug','ShowDeskAccount','DeskAccount','lodash','util','moment','randomstring','ioredis','../../config/logger','rpc','../../config/environment','jayson/promise','client','http','then','DeskAccount,\x20%s,\x20%s','request\x20sent','DeskAccount,\x20%s,\x20%s,\x20%s','stringify','error','code','message','info','result','GetDeskAccount','findAll'];(function(_0x324f55,_0x2e6ca4){var _0x284952=function(_0x36ceae){while(--_0x36ceae){_0x324f55['push'](_0x324f55['shift']());}};_0x284952(++_0x2e6ca4);}(_0x4174,0x175));var _0x4417=function(_0x1f0bcf,_0x5ec36f){_0x1f0bcf=_0x1f0bcf-0x0;var _0x27c1f2=_0x4174[_0x1f0bcf];return _0x27c1f2;};'use strict';var _=require(_0x4417('0x0'));var util=require(_0x4417('0x1'));var moment=require(_0x4417('0x2'));var BPromise=require('bluebird');var rs=require(_0x4417('0x3'));var fs=require('fs');var Redis=require(_0x4417('0x4'));var db=require('../../mysqldb')['db'];var utils=require('../../config/utils');var logger=require(_0x4417('0x5'))(_0x4417('0x6'));var config=require(_0x4417('0x7'));var jayson=require(_0x4417('0x8'));var client=jayson[_0x4417('0x9')][_0x4417('0xa')]({'port':0x232a});function respondWithRpcPromise(_0x5d59f7,_0xd83bb0,_0x652bd2){return new BPromise(function(_0x2f9641,_0x30f003){return client['request'](_0x5d59f7,_0x652bd2)[_0x4417('0xb')](function(_0x5ee184){logger['info'](_0x4417('0xc'),_0xd83bb0,_0x4417('0xd'));logger['debug'](_0x4417('0xe'),_0xd83bb0,_0x4417('0xd'),JSON[_0x4417('0xf')](_0x5ee184));if(_0x5ee184[_0x4417('0x10')]){if(_0x5ee184['error'][_0x4417('0x11')]===0x1f4){logger[_0x4417('0x10')](_0x4417('0xc'),_0xd83bb0,_0x5ee184[_0x4417('0x10')][_0x4417('0x12')]);return _0x30f003(_0x5ee184[_0x4417('0x10')][_0x4417('0x12')]);}logger['error'](_0x4417('0xc'),_0xd83bb0,_0x5ee184[_0x4417('0x10')]['message']);return _0x2f9641(_0x5ee184['error']['message']);}else{logger[_0x4417('0x13')](_0x4417('0xc'),_0xd83bb0,_0x4417('0xd'));_0x2f9641(_0x5ee184[_0x4417('0x14')][_0x4417('0x12')]);}})['catch'](function(_0x386546){logger[_0x4417('0x10')](_0x4417('0xc'),_0xd83bb0,_0x386546);_0x30f003(_0x386546);});});}exports[_0x4417('0x15')]=function(_0x400b38){var _0x1b144c=this;return new Promise(function(_0x464f81,_0x7b6723){return db['DeskAccount'][_0x4417('0x16')]({'raw':_0x400b38[_0x4417('0x17')]?_0x400b38[_0x4417('0x17')]['raw']===undefined?!![]:![]:!![],'where':_0x400b38[_0x4417('0x17')]?_0x400b38[_0x4417('0x17')][_0x4417('0x18')]||null:null,'attributes':_0x400b38[_0x4417('0x17')]?_0x400b38[_0x4417('0x17')][_0x4417('0x19')]||null:null,'limit':_0x400b38[_0x4417('0x17')]?_0x400b38[_0x4417('0x17')][_0x4417('0x1a')]||null:null,'include':_0x400b38[_0x4417('0x17')]?_0x400b38[_0x4417('0x17')][_0x4417('0x1b')]?_[_0x4417('0x1c')](_0x400b38[_0x4417('0x17')][_0x4417('0x1b')],function(_0x46f74f){return{'model':db[_0x46f74f['model']],'as':_0x46f74f['as'],'attributes':_0x46f74f[_0x4417('0x19')],'include':_0x46f74f[_0x4417('0x1b')]?_['map'](_0x46f74f[_0x4417('0x1b')],function(_0x356bbc){return{'model':db[_0x356bbc['model']],'as':_0x356bbc['as'],'attributes':_0x356bbc[_0x4417('0x19')],'include':_0x356bbc[_0x4417('0x1b')]?_[_0x4417('0x1c')](_0x356bbc['include'],function(_0x448ea2){return{'model':db[_0x448ea2[_0x4417('0x1d')]],'as':_0x448ea2['as'],'attributes':_0x448ea2[_0x4417('0x19')]};}):[]};}):[]};}):[]:[]})[_0x4417('0xb')](function(_0x2c40e7){logger[_0x4417('0x13')](_0x4417('0x15'),_0x400b38);logger[_0x4417('0x1e')](_0x4417('0x15'),_0x400b38,JSON[_0x4417('0xf')](_0x2c40e7));_0x464f81(_0x2c40e7);})['catch'](function(_0x17ebe9){logger[_0x4417('0x10')](_0x4417('0x15'),_0x17ebe9[_0x4417('0x12')],_0x400b38);_0x7b6723(_0x1b144c['error'](0x1f4,_0x17ebe9[_0x4417('0x12')]));});});};exports[_0x4417('0x1f')]=function(_0x4dbebf){var _0x41a954=this;return new Promise(function(_0x4a329d,_0x21c1c){return db[_0x4417('0x20')]['find']({'raw':_0x4dbebf['options']?_0x4dbebf['options']['raw']===undefined?!![]:![]:!![],'where':_0x4dbebf[_0x4417('0x17')]?_0x4dbebf[_0x4417('0x17')]['where']||null:null,'attributes':_0x4dbebf[_0x4417('0x17')]?_0x4dbebf[_0x4417('0x17')][_0x4417('0x19')]||null:null,'include':_0x4dbebf['options']?_0x4dbebf[_0x4417('0x17')][_0x4417('0x1b')]?_['map'](_0x4dbebf[_0x4417('0x17')][_0x4417('0x1b')],function(_0x1c9aa5){return{'model':db[_0x1c9aa5[_0x4417('0x1d')]],'as':_0x1c9aa5['as'],'attributes':_0x1c9aa5[_0x4417('0x19')],'include':_0x1c9aa5['include']?_[_0x4417('0x1c')](_0x1c9aa5[_0x4417('0x1b')],function(_0x23d1f8){return{'model':db[_0x23d1f8[_0x4417('0x1d')]],'as':_0x23d1f8['as'],'attributes':_0x23d1f8[_0x4417('0x19')],'include':_0x23d1f8[_0x4417('0x1b')]?_[_0x4417('0x1c')](_0x23d1f8[_0x4417('0x1b')],function(_0x168b2f){return{'model':db[_0x168b2f[_0x4417('0x1d')]],'as':_0x168b2f['as'],'attributes':_0x168b2f['attributes']};}):[]};}):[]};}):[]:[]})['then'](function(_0x27eedc){logger[_0x4417('0x13')](_0x4417('0x1f'),_0x4dbebf);logger['debug'](_0x4417('0x1f'),_0x4dbebf,JSON['stringify'](_0x27eedc));_0x4a329d(_0x27eedc);})['catch'](function(_0x249482){logger[_0x4417('0x10')](_0x4417('0x1f'),_0x249482[_0x4417('0x12')],_0x4dbebf);_0x21c1c(_0x41a954[_0x4417('0x10')](0x1f4,_0x249482['message']));});});}; \ No newline at end of file diff --git a/server/api/intDeskConfiguration/index.js b/server/api/intDeskConfiguration/index.js index e765820..d87b05b 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(_0x36d44f,_0x47f4ac){var _0x59292c=function(_0x32ae4e){while(--_0x32ae4e){_0x36d44f['push'](_0x36d44f['shift']());}};_0x59292c(++_0x47f4ac);}(_0x9c44,0x178));var _0x49c4=function(_0x543084,_0x4337f5){_0x543084=_0x543084-0x0;var _0x306a57=_0x9c44[_0x543084];return _0x306a57;};'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 _0x3e74=['show','/:id/fields','getFields','getSubjects','/:id/descriptions','getDescriptions','getTags','post','/:id/tags','setTags','update','delete','exports','multer','path','connect-timeout','express','../../components/auth/service','../../config/environment','./intDeskConfiguration.controller','get','isAuthenticated','index','/:id'];(function(_0x130fe6,_0x3450e5){var _0x5c61b9=function(_0x3993aa){while(--_0x3993aa){_0x130fe6['push'](_0x130fe6['shift']());}};_0x5c61b9(++_0x3450e5);}(_0x3e74,0x175));var _0x43e7=function(_0x26c95e,_0x4028f7){_0x26c95e=_0x26c95e-0x0;var _0x4708a1=_0x3e74[_0x26c95e];return _0x4708a1;};'use strict';var multer=require(_0x43e7('0x0'));var util=require('util');var path=require(_0x43e7('0x1'));var timeout=require(_0x43e7('0x2'));var express=require(_0x43e7('0x3'));var router=express['Router']();var fs_extra=require('fs-extra');var auth=require(_0x43e7('0x4'));var interaction=require('../../components/interaction/service');var config=require(_0x43e7('0x5'));var controller=require(_0x43e7('0x6'));router[_0x43e7('0x7')]('/',auth[_0x43e7('0x8')](),controller[_0x43e7('0x9')]);router['get'](_0x43e7('0xa'),auth[_0x43e7('0x8')](),controller[_0x43e7('0xb')]);router[_0x43e7('0x7')](_0x43e7('0xc'),auth['isAuthenticated'](),controller[_0x43e7('0xd')]);router['get']('/:id/subjects',auth[_0x43e7('0x8')](),controller[_0x43e7('0xe')]);router['get'](_0x43e7('0xf'),auth['isAuthenticated'](),controller[_0x43e7('0x10')]);router[_0x43e7('0x7')]('/:id/tags',auth[_0x43e7('0x8')](),controller[_0x43e7('0x11')]);router[_0x43e7('0x12')]('/',auth[_0x43e7('0x8')](),controller['create']);router['post'](_0x43e7('0x13'),auth[_0x43e7('0x8')](),controller[_0x43e7('0x14')]);router['put']('/:id',auth[_0x43e7('0x8')](),controller[_0x43e7('0x15')]);router[_0x43e7('0x16')](_0x43e7('0xa'),auth['isAuthenticated'](),controller['destroy']);module[_0x43e7('0x17')]=router; \ No newline at end of file diff --git a/server/api/intDeskConfiguration/intDeskConfiguration.attributes.js b/server/api/intDeskConfiguration/intDeskConfiguration.attributes.js index 2fe2ea7..4566921 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 _0x1fdf=['STRING'];(function(_0x3b2667,_0x2e42b6){var _0x5f0726=function(_0x828222){while(--_0x828222){_0x3b2667['push'](_0x3b2667['shift']());}};_0x5f0726(++_0x2e42b6);}(_0x1fdf,0x15e));var _0xf1fd=function(_0x1433df,_0x1c1ddc){_0x1433df=_0x1433df-0x0;var _0x49fade=_0x1fdf[_0x1433df];return _0x49fade;};'use strict';var Sequelize=require('sequelize');module['exports']={'name':{'type':Sequelize[_0xf1fd('0x0')]},'description':{'type':Sequelize[_0xf1fd('0x0')]}}; \ No newline at end of file +var _0x5bbe=['exports','STRING'];(function(_0x5154ad,_0x58eaa8){var _0x10a840=function(_0x4e36ef){while(--_0x4e36ef){_0x5154ad['push'](_0x5154ad['shift']());}};_0x10a840(++_0x58eaa8);}(_0x5bbe,0x160));var _0xe5bb=function(_0x4ffa49,_0x4eb618){_0x4ffa49=_0x4ffa49-0x0;var _0x20dc4e=_0x5bbe[_0x4ffa49];return _0x20dc4e;};'use strict';var Sequelize=require('sequelize');module[_0xe5bb('0x0')]={'name':{'type':Sequelize['STRING']},'description':{'type':Sequelize[_0xe5bb('0x1')]}}; \ No newline at end of file diff --git a/server/api/intDeskConfiguration/intDeskConfiguration.controller.js b/server/api/intDeskConfiguration/intDeskConfiguration.controller.js index bb07dc6..ef24fe8 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 _0x681a=['jsforce','desk.js','ioredis','../../components/auth/service','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','sendStatus','status','offset','undefined','limit','count','set','Content-Range','json','apply','reject','update','then','destroy','end','stack','name','send','index','map','DeskConfiguration','rawAttributes','fieldName','key','model','query','keys','filters','attributes','intersection','hasOwnProperty','order','sort','where','pick','filter','merge','type','options','findAll','show','fields','includeAll','include','find','create','body','catch','params','getFields','findOne','DeskField','length','getSubjects','getDescriptions','nolimit','getTags','Tag','ids','eml-format','fast-json-patch','bluebird','util','path','sox','to-csv','ejs','fs-extra','lodash','crypto'];(function(_0x5c52b2,_0x449e2b){var _0x2a4943=function(_0x44dc9d){while(--_0x44dc9d){_0x5c52b2['push'](_0x5c52b2['shift']());}};_0x2a4943(++_0x449e2b);}(_0x681a,0x99));var _0xa681=function(_0x9e0cb3,_0x9cd497){_0x9e0cb3=_0x9e0cb3-0x0;var _0x5926b7=_0x681a[_0x9e0cb3];return _0x5926b7;};'use strict';var emlformat=require(_0xa681('0x0'));var rimraf=require('rimraf');var zipdir=require('zip-dir');var jsonpatch=require(_0xa681('0x1'));var rp=require('request-promise');var moment=require('moment');var BPromise=require(_0xa681('0x2'));var Mustache=require('mustache');var util=require(_0xa681('0x3'));var path=require(_0xa681('0x4'));var sox=require(_0xa681('0x5'));var csv=require(_0xa681('0x6'));var ejs=require(_0xa681('0x7'));var fs=require('fs');var fs_extra=require(_0xa681('0x8'));var _=require(_0xa681('0x9'));var squel=require('squel');var crypto=require(_0xa681('0xa'));var jsforce=require(_0xa681('0xb'));var deskjs=require(_0xa681('0xc'));var toCsv=require(_0xa681('0x6'));var querystring=require('querystring');var Papa=require('papaparse');var Redis=require(_0xa681('0xd'));var authService=require(_0xa681('0xe'));var qs=require('../../components/parsers/qs');var as=require(_0xa681('0xf'));var hardwareService=require(_0xa681('0x10'));var logger=require(_0xa681('0x11'))(_0xa681('0x12'));var utils=require(_0xa681('0x13'));var config=require(_0xa681('0x14'));var licenseUtil=require(_0xa681('0x15'));var db=require(_0xa681('0x16'))['db'];function respondWithStatusCode(_0x2a51fc,_0x558a21){_0x558a21=_0x558a21||0xcc;return function(_0x262baf){if(_0x262baf){return _0x2a51fc[_0xa681('0x17')](_0x558a21);}return _0x2a51fc[_0xa681('0x18')](_0x558a21)['end']();};}function respondWithResult(_0x4560c4,_0x40faf5){_0x40faf5=_0x40faf5||0xc8;return function(_0x542b75){if(_0x542b75){return _0x4560c4[_0xa681('0x18')](_0x40faf5)['json'](_0x542b75);}};}function respondWithFilteredResult(_0x23f492,_0x4ce9a9){return function(_0x3a79f5){if(_0x3a79f5){var _0x150a89=typeof _0x4ce9a9[_0xa681('0x19')]===_0xa681('0x1a')&&typeof _0x4ce9a9[_0xa681('0x1b')]==='undefined';var _0x4f5f52=_0x3a79f5[_0xa681('0x1c')];var _0x2fd700=_0x150a89?0x0:_0x4ce9a9[_0xa681('0x19')];var _0x8e1046=_0x150a89?_0x3a79f5[_0xa681('0x1c')]:_0x4ce9a9[_0xa681('0x19')]+_0x4ce9a9['limit'];var _0x3c3681;if(_0x8e1046>=_0x4f5f52){_0x8e1046=_0x4f5f52;_0x3c3681=0xc8;}else{_0x3c3681=0xce;}_0x23f492[_0xa681('0x18')](_0x3c3681);return _0x23f492[_0xa681('0x1d')](_0xa681('0x1e'),_0x2fd700+'-'+_0x8e1046+'/'+_0x4f5f52)[_0xa681('0x1f')](_0x3a79f5);}return null;};}function patchUpdates(_0x27aa46){return function(_0x466e31){try{jsonpatch[_0xa681('0x20')](_0x466e31,_0x27aa46,!![]);}catch(_0x584566){return BPromise[_0xa681('0x21')](_0x584566);}return _0x466e31['save']();};}function saveUpdates(_0x5ad457,_0x3b54cf){return function(_0x4ea145){if(_0x4ea145){return _0x4ea145[_0xa681('0x22')](_0x5ad457)[_0xa681('0x23')](function(_0x16cd42){return _0x16cd42;});}return null;};}function removeEntity(_0x39b557,_0xe5cafd){return function(_0x597a52){if(_0x597a52){return _0x597a52[_0xa681('0x24')]()[_0xa681('0x23')](function(){_0x39b557[_0xa681('0x18')](0xcc)[_0xa681('0x25')]();});}};}function handleEntityNotFound(_0x400a1e,_0x5dd85d){return function(_0x3077e6){if(!_0x3077e6){_0x400a1e[_0xa681('0x17')](0x194);}return _0x3077e6;};}function handleError(_0x478e3c,_0x2ec2c1){_0x2ec2c1=_0x2ec2c1||0x1f4;return function(_0x1c9607){logger['error'](_0x1c9607[_0xa681('0x26')]);if(_0x1c9607[_0xa681('0x27')]){delete _0x1c9607['name'];}_0x478e3c['status'](_0x2ec2c1)[_0xa681('0x28')](_0x1c9607);};}exports[_0xa681('0x29')]=function(_0x46bcf5,_0x8de616){var _0x1db3a4={},_0x6ae015={},_0x1c349a={'count':0x0,'rows':[]};var _0x460c55=_[_0xa681('0x2a')](db[_0xa681('0x2b')][_0xa681('0x2c')],function(_0x47d6a4){return{'name':_0x47d6a4[_0xa681('0x2d')],'type':_0x47d6a4['type'][_0xa681('0x2e')]};});_0x6ae015[_0xa681('0x2f')]=_[_0xa681('0x2a')](_0x460c55,'name');_0x6ae015[_0xa681('0x30')]=_[_0xa681('0x31')](_0x46bcf5['query']);_0x6ae015[_0xa681('0x32')]=_['intersection'](_0x6ae015['model'],_0x6ae015[_0xa681('0x30')]);_0x1db3a4[_0xa681('0x33')]=_[_0xa681('0x34')](_0x6ae015['model'],qs['fields'](_0x46bcf5[_0xa681('0x30')]['fields']));_0x1db3a4[_0xa681('0x33')]=_0x1db3a4[_0xa681('0x33')]['length']?_0x1db3a4[_0xa681('0x33')]:_0x6ae015[_0xa681('0x2f')];if(!_0x46bcf5[_0xa681('0x30')][_0xa681('0x35')]('nolimit')){_0x1db3a4[_0xa681('0x1b')]=qs[_0xa681('0x1b')](_0x46bcf5['query'][_0xa681('0x1b')]);_0x1db3a4[_0xa681('0x19')]=qs[_0xa681('0x19')](_0x46bcf5[_0xa681('0x30')]['offset']);}_0x1db3a4[_0xa681('0x36')]=qs[_0xa681('0x37')](_0x46bcf5[_0xa681('0x30')][_0xa681('0x37')]);_0x1db3a4[_0xa681('0x38')]=qs[_0xa681('0x32')](_[_0xa681('0x39')](_0x46bcf5['query'],_0x6ae015['filters']),_0x460c55);if(_0x46bcf5[_0xa681('0x30')][_0xa681('0x3a')]){_0x1db3a4[_0xa681('0x38')]=_[_0xa681('0x3b')](_0x1db3a4[_0xa681('0x38')],{'$or':_[_0xa681('0x2a')](_0x460c55,function(_0x486d36){if(_0x486d36[_0xa681('0x3c')]!=='VIRTUAL'){var _0x2a1caf={};_0x2a1caf[_0x486d36[_0xa681('0x27')]]={'$like':'%'+_0x46bcf5[_0xa681('0x30')][_0xa681('0x3a')]+'%'};return _0x2a1caf;}})});}_0x1db3a4=_[_0xa681('0x3b')]({},_0x1db3a4,_0x46bcf5[_0xa681('0x3d')]);var _0x64788d={'where':_0x1db3a4[_0xa681('0x38')]};return db['DeskConfiguration'][_0xa681('0x1c')](_0x64788d)[_0xa681('0x23')](function(_0x505c0e){_0x1c349a[_0xa681('0x1c')]=_0x505c0e;if(_0x46bcf5[_0xa681('0x30')]['includeAll']){_0x1db3a4['include']=[{'all':!![]}];}return db[_0xa681('0x2b')][_0xa681('0x3e')](_0x1db3a4);})[_0xa681('0x23')](function(_0x4b511b){_0x1c349a['rows']=_0x4b511b;return _0x1c349a;})['then'](respondWithFilteredResult(_0x8de616,_0x1db3a4))['catch'](handleError(_0x8de616,null));};exports[_0xa681('0x3f')]=function(_0x456464,_0x902b00){var _0x5b75d5={'raw':![],'where':{'id':_0x456464['params']['id']}},_0x1e939e={};_0x1e939e[_0xa681('0x2f')]=_[_0xa681('0x31')](db[_0xa681('0x2b')]['rawAttributes']);_0x1e939e[_0xa681('0x30')]=_['keys'](_0x456464[_0xa681('0x30')]);_0x1e939e['filters']=_['intersection'](_0x1e939e['model'],_0x1e939e[_0xa681('0x30')]);_0x5b75d5[_0xa681('0x33')]=_[_0xa681('0x34')](_0x1e939e[_0xa681('0x2f')],qs[_0xa681('0x40')](_0x456464[_0xa681('0x30')][_0xa681('0x40')]));_0x5b75d5[_0xa681('0x33')]=_0x5b75d5[_0xa681('0x33')]['length']?_0x5b75d5[_0xa681('0x33')]:_0x1e939e[_0xa681('0x2f')];if(_0x456464[_0xa681('0x30')][_0xa681('0x41')]){_0x5b75d5[_0xa681('0x42')]=[{'all':!![]}];}_0x5b75d5=_[_0xa681('0x3b')]({},_0x5b75d5,_0x456464[_0xa681('0x3d')]);return db[_0xa681('0x2b')][_0xa681('0x43')](_0x5b75d5)[_0xa681('0x23')](handleEntityNotFound(_0x902b00,null))[_0xa681('0x23')](respondWithResult(_0x902b00,null))['catch'](handleError(_0x902b00,null));};exports[_0xa681('0x44')]=function(_0x288494,_0x2a7ab7){return db[_0xa681('0x2b')][_0xa681('0x44')](_0x288494[_0xa681('0x45')],{})[_0xa681('0x23')](respondWithResult(_0x2a7ab7,0xc9))['catch'](handleError(_0x2a7ab7,null));};exports[_0xa681('0x22')]=function(_0x1b0362,_0x2f5964){if(_0x1b0362[_0xa681('0x45')]['id']){delete _0x1b0362[_0xa681('0x45')]['id'];}return db[_0xa681('0x2b')][_0xa681('0x43')]({'where':{'id':_0x1b0362['params']['id']}})[_0xa681('0x23')](handleEntityNotFound(_0x2f5964,null))[_0xa681('0x23')](saveUpdates(_0x1b0362[_0xa681('0x45')],null))[_0xa681('0x23')](respondWithResult(_0x2f5964,null))[_0xa681('0x46')](handleError(_0x2f5964,null));};exports[_0xa681('0x24')]=function(_0x346ae1,_0x334f28){return db['DeskConfiguration'][_0xa681('0x43')]({'where':{'id':_0x346ae1[_0xa681('0x47')]['id']}})[_0xa681('0x23')](handleEntityNotFound(_0x334f28,null))[_0xa681('0x23')](removeEntity(_0x334f28,null))['catch'](handleError(_0x334f28,null));};exports[_0xa681('0x48')]=function(_0x114891,_0xc33740,_0x359eaf){var _0x2824d6={};var _0x1637f5={};var _0x46eaed;var _0x2a9717;return db['DeskConfiguration'][_0xa681('0x49')]({'where':{'id':_0x114891[_0xa681('0x47')]['id']}})[_0xa681('0x23')](handleEntityNotFound(_0xc33740,null))[_0xa681('0x23')](function(_0x47be01){if(_0x47be01){_0x46eaed=_0x47be01;_0x1637f5[_0xa681('0x2f')]=_['keys'](db[_0xa681('0x4a')][_0xa681('0x2c')]);_0x1637f5[_0xa681('0x30')]=_[_0xa681('0x31')](_0x114891[_0xa681('0x30')]);_0x1637f5[_0xa681('0x32')]=_[_0xa681('0x34')](_0x1637f5['model'],_0x1637f5['query']);_0x2824d6['attributes']=_[_0xa681('0x34')](_0x1637f5[_0xa681('0x2f')],qs[_0xa681('0x40')](_0x114891['query'][_0xa681('0x40')]));_0x2824d6[_0xa681('0x33')]=_0x2824d6[_0xa681('0x33')]['length']?_0x2824d6[_0xa681('0x33')]:_0x1637f5[_0xa681('0x2f')];_0x2824d6['order']=qs[_0xa681('0x37')](_0x114891[_0xa681('0x30')]['sort']);_0x2824d6[_0xa681('0x38')]=qs['filters'](_[_0xa681('0x39')](_0x114891[_0xa681('0x30')],_0x1637f5[_0xa681('0x32')]));if(_0x114891[_0xa681('0x30')]['filter']){_0x2824d6[_0xa681('0x38')]=_[_0xa681('0x3b')](_0x2824d6[_0xa681('0x38')],{'$or':_[_0xa681('0x2a')](_0x2824d6[_0xa681('0x33')],function(_0x33b3a1){var _0x1f7c88={};_0x1f7c88[_0x33b3a1]={'$like':'%'+_0x114891['query'][_0xa681('0x3a')]+'%'};return _0x1f7c88;})});}_0x2824d6=_['merge']({},_0x2824d6,_0x114891[_0xa681('0x3d')]);return _0x46eaed[_0xa681('0x48')](_0x2824d6);}})[_0xa681('0x23')](function(_0x18017d){if(_0x18017d){_0x2a9717=_0x18017d[_0xa681('0x4b')];if(!_0x114891[_0xa681('0x30')]['hasOwnProperty']('nolimit')){_0x2824d6[_0xa681('0x1b')]=qs['limit'](_0x114891[_0xa681('0x30')][_0xa681('0x1b')]);_0x2824d6[_0xa681('0x19')]=qs[_0xa681('0x19')](_0x114891[_0xa681('0x30')]['offset']);}return _0x46eaed[_0xa681('0x48')](_0x2824d6);}})[_0xa681('0x23')](function(_0x594f35){if(_0x594f35){return _0x594f35?{'count':_0x2a9717,'rows':_0x594f35}:null;}})['then'](respondWithResult(_0xc33740,null))[_0xa681('0x46')](handleError(_0xc33740,null));};exports[_0xa681('0x4c')]=function(_0x381596,_0x5d6dd9,_0x363e94){var _0x1a2dee={};var _0x2fe869={};var _0x3869e3;var _0x3654c8;return db[_0xa681('0x2b')]['findOne']({'where':{'id':_0x381596[_0xa681('0x47')]['id']}})['then'](handleEntityNotFound(_0x5d6dd9,null))[_0xa681('0x23')](function(_0xe733a6){if(_0xe733a6){_0x3869e3=_0xe733a6;_0x2fe869[_0xa681('0x2f')]=_['keys'](db[_0xa681('0x4a')][_0xa681('0x2c')]);_0x2fe869[_0xa681('0x30')]=_['keys'](_0x381596[_0xa681('0x30')]);_0x2fe869[_0xa681('0x32')]=_['intersection'](_0x2fe869[_0xa681('0x2f')],_0x2fe869[_0xa681('0x30')]);_0x1a2dee[_0xa681('0x33')]=_['intersection'](_0x2fe869[_0xa681('0x2f')],qs[_0xa681('0x40')](_0x381596[_0xa681('0x30')][_0xa681('0x40')]));_0x1a2dee[_0xa681('0x33')]=_0x1a2dee['attributes'][_0xa681('0x4b')]?_0x1a2dee[_0xa681('0x33')]:_0x2fe869[_0xa681('0x2f')];_0x1a2dee[_0xa681('0x36')]=qs[_0xa681('0x37')](_0x381596[_0xa681('0x30')]['sort']);_0x1a2dee['where']=qs[_0xa681('0x32')](_[_0xa681('0x39')](_0x381596[_0xa681('0x30')],_0x2fe869['filters']));if(_0x381596[_0xa681('0x30')][_0xa681('0x3a')]){_0x1a2dee[_0xa681('0x38')]=_[_0xa681('0x3b')](_0x1a2dee[_0xa681('0x38')],{'$or':_[_0xa681('0x2a')](_0x1a2dee[_0xa681('0x33')],function(_0x49879e){var _0x5b2157={};_0x5b2157[_0x49879e]={'$like':'%'+_0x381596[_0xa681('0x30')][_0xa681('0x3a')]+'%'};return _0x5b2157;})});}_0x1a2dee=_[_0xa681('0x3b')]({},_0x1a2dee,_0x381596[_0xa681('0x3d')]);return _0x3869e3[_0xa681('0x4c')](_0x1a2dee);}})['then'](function(_0x50ffa5){if(_0x50ffa5){_0x3654c8=_0x50ffa5['length'];if(!_0x381596[_0xa681('0x30')][_0xa681('0x35')]('nolimit')){_0x1a2dee[_0xa681('0x1b')]=qs[_0xa681('0x1b')](_0x381596[_0xa681('0x30')][_0xa681('0x1b')]);_0x1a2dee['offset']=qs[_0xa681('0x19')](_0x381596[_0xa681('0x30')][_0xa681('0x19')]);}return _0x3869e3['getSubjects'](_0x1a2dee);}})[_0xa681('0x23')](function(_0x44b7e0){if(_0x44b7e0){return _0x44b7e0?{'count':_0x3654c8,'rows':_0x44b7e0}:null;}})['then'](respondWithResult(_0x5d6dd9,null))[_0xa681('0x46')](handleError(_0x5d6dd9,null));};exports[_0xa681('0x4d')]=function(_0x556dc6,_0x8be6b0,_0x14eb97){var _0x16d9f9={};var _0x3e5a84={};var _0x3bc1e2;var _0x1b3a9a;return db['DeskConfiguration']['findOne']({'where':{'id':_0x556dc6[_0xa681('0x47')]['id']}})[_0xa681('0x23')](handleEntityNotFound(_0x8be6b0,null))[_0xa681('0x23')](function(_0xc2bd57){if(_0xc2bd57){_0x3bc1e2=_0xc2bd57;_0x3e5a84[_0xa681('0x2f')]=_[_0xa681('0x31')](db[_0xa681('0x4a')][_0xa681('0x2c')]);_0x3e5a84['query']=_[_0xa681('0x31')](_0x556dc6['query']);_0x3e5a84[_0xa681('0x32')]=_[_0xa681('0x34')](_0x3e5a84[_0xa681('0x2f')],_0x3e5a84['query']);_0x16d9f9[_0xa681('0x33')]=_['intersection'](_0x3e5a84[_0xa681('0x2f')],qs[_0xa681('0x40')](_0x556dc6[_0xa681('0x30')]['fields']));_0x16d9f9[_0xa681('0x33')]=_0x16d9f9[_0xa681('0x33')]['length']?_0x16d9f9['attributes']:_0x3e5a84[_0xa681('0x2f')];_0x16d9f9[_0xa681('0x36')]=qs[_0xa681('0x37')](_0x556dc6[_0xa681('0x30')][_0xa681('0x37')]);_0x16d9f9[_0xa681('0x38')]=qs[_0xa681('0x32')](_[_0xa681('0x39')](_0x556dc6[_0xa681('0x30')],_0x3e5a84[_0xa681('0x32')]));if(_0x556dc6[_0xa681('0x30')][_0xa681('0x3a')]){_0x16d9f9[_0xa681('0x38')]=_['merge'](_0x16d9f9[_0xa681('0x38')],{'$or':_[_0xa681('0x2a')](_0x16d9f9['attributes'],function(_0x2c8de6){var _0x22ad91={};_0x22ad91[_0x2c8de6]={'$like':'%'+_0x556dc6[_0xa681('0x30')][_0xa681('0x3a')]+'%'};return _0x22ad91;})});}_0x16d9f9=_[_0xa681('0x3b')]({},_0x16d9f9,_0x556dc6[_0xa681('0x3d')]);return _0x3bc1e2[_0xa681('0x4d')](_0x16d9f9);}})['then'](function(_0x202c16){if(_0x202c16){_0x1b3a9a=_0x202c16[_0xa681('0x4b')];if(!_0x556dc6[_0xa681('0x30')][_0xa681('0x35')](_0xa681('0x4e'))){_0x16d9f9[_0xa681('0x1b')]=qs['limit'](_0x556dc6['query'][_0xa681('0x1b')]);_0x16d9f9[_0xa681('0x19')]=qs[_0xa681('0x19')](_0x556dc6[_0xa681('0x30')][_0xa681('0x19')]);}return _0x3bc1e2['getDescriptions'](_0x16d9f9);}})[_0xa681('0x23')](function(_0x22157f){if(_0x22157f){return _0x22157f?{'count':_0x1b3a9a,'rows':_0x22157f}:null;}})[_0xa681('0x23')](respondWithResult(_0x8be6b0,null))[_0xa681('0x46')](handleError(_0x8be6b0,null));};exports[_0xa681('0x4f')]=function(_0x5019fe,_0xc0cf66,_0x20c9e8){var _0x4cbffd={};var _0x1f5e62={};var _0x34777a;var _0x3e8679;return db[_0xa681('0x2b')]['findOne']({'where':{'id':_0x5019fe[_0xa681('0x47')]['id']}})[_0xa681('0x23')](handleEntityNotFound(_0xc0cf66,null))[_0xa681('0x23')](function(_0x3699d1){if(_0x3699d1){_0x34777a=_0x3699d1;_0x1f5e62[_0xa681('0x2f')]=_[_0xa681('0x31')](db[_0xa681('0x50')][_0xa681('0x2c')]);_0x1f5e62[_0xa681('0x30')]=_[_0xa681('0x31')](_0x5019fe[_0xa681('0x30')]);_0x1f5e62[_0xa681('0x32')]=_['intersection'](_0x1f5e62[_0xa681('0x2f')],_0x1f5e62['query']);_0x4cbffd['attributes']=_[_0xa681('0x34')](_0x1f5e62['model'],qs[_0xa681('0x40')](_0x5019fe['query'][_0xa681('0x40')]));_0x4cbffd[_0xa681('0x33')]=_0x4cbffd[_0xa681('0x33')][_0xa681('0x4b')]?_0x4cbffd[_0xa681('0x33')]:_0x1f5e62[_0xa681('0x2f')];_0x4cbffd['order']=qs[_0xa681('0x37')](_0x5019fe[_0xa681('0x30')]['sort']);_0x4cbffd[_0xa681('0x38')]=qs[_0xa681('0x32')](_[_0xa681('0x39')](_0x5019fe[_0xa681('0x30')],_0x1f5e62[_0xa681('0x32')]));if(_0x5019fe[_0xa681('0x30')][_0xa681('0x3a')]){_0x4cbffd[_0xa681('0x38')]=_[_0xa681('0x3b')](_0x4cbffd[_0xa681('0x38')],{'$or':_[_0xa681('0x2a')](_0x4cbffd[_0xa681('0x33')],function(_0x15bb92){var _0x498d82={};_0x498d82[_0x15bb92]={'$like':'%'+_0x5019fe[_0xa681('0x30')][_0xa681('0x3a')]+'%'};return _0x498d82;})});}_0x4cbffd=_[_0xa681('0x3b')]({},_0x4cbffd,_0x5019fe[_0xa681('0x3d')]);return _0x34777a['getTags'](_0x4cbffd);}})[_0xa681('0x23')](function(_0x54f540){if(_0x54f540){_0x3e8679=_0x54f540['length'];if(!_0x5019fe[_0xa681('0x30')][_0xa681('0x35')](_0xa681('0x4e'))){_0x4cbffd[_0xa681('0x1b')]=qs['limit'](_0x5019fe[_0xa681('0x30')][_0xa681('0x1b')]);_0x4cbffd[_0xa681('0x19')]=qs[_0xa681('0x19')](_0x5019fe[_0xa681('0x30')][_0xa681('0x19')]);}return _0x34777a[_0xa681('0x4f')](_0x4cbffd);}})[_0xa681('0x23')](function(_0x179e75){if(_0x179e75){return _0x179e75?{'count':_0x3e8679,'rows':_0x179e75}:null;}})[_0xa681('0x23')](respondWithResult(_0xc0cf66,null))[_0xa681('0x46')](handleError(_0xc0cf66,null));};exports['setTags']=function(_0x5940f2,_0x8f0bd8,_0x428ddf){if(_0x5940f2['body']['id']){delete _0x5940f2['body']['id'];}return db['DeskConfiguration'][_0xa681('0x49')]({'where':{'id':_0x5940f2[_0xa681('0x47')]['id']}})['then'](handleEntityNotFound(_0x8f0bd8,null))[_0xa681('0x23')](function(_0x59d863){if(_0x59d863){return _0x59d863['setTags'](_0x5940f2[_0xa681('0x45')][_0xa681('0x51')]||[]);}return null;})['then'](respondWithResult(_0x8f0bd8,null))[_0xa681('0x46')](handleError(_0x8f0bd8,null));}; \ No newline at end of file +var _0xe803=['getFields','findOne','DeskField','order','getSubjects','nolimit','getDescriptions','getTags','Tag','setTags','ids','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','moment','bluebird','util','path','to-csv','ejs','fs-extra','squel','crypto','jsforce','desk.js','querystring','papaparse','ioredis','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/environment','../../mysqldb','sendStatus','end','status','undefined','limit','count','offset','set','json','save','update','then','destroy','stack','name','DeskConfiguration','rawAttributes','fieldName','type','key','model','map','query','keys','filters','intersection','attributes','fields','length','hasOwnProperty','sort','where','pick','filter','merge','VIRTUAL','options','includeAll','include','findAll','catch','show','find','create','body','params'];(function(_0x5b6230,_0x16633b){var _0x4a8450=function(_0x3ddaec){while(--_0x3ddaec){_0x5b6230['push'](_0x5b6230['shift']());}};_0x4a8450(++_0x16633b);}(_0xe803,0x1a5));var _0x3e80=function(_0x50ea3e,_0x5887da){_0x50ea3e=_0x50ea3e-0x0;var _0x809f98=_0xe803[_0x50ea3e];return _0x809f98;};'use strict';var emlformat=require(_0x3e80('0x0'));var rimraf=require(_0x3e80('0x1'));var zipdir=require(_0x3e80('0x2'));var jsonpatch=require(_0x3e80('0x3'));var rp=require(_0x3e80('0x4'));var moment=require(_0x3e80('0x5'));var BPromise=require(_0x3e80('0x6'));var Mustache=require('mustache');var util=require(_0x3e80('0x7'));var path=require(_0x3e80('0x8'));var sox=require('sox');var csv=require(_0x3e80('0x9'));var ejs=require(_0x3e80('0xa'));var fs=require('fs');var fs_extra=require(_0x3e80('0xb'));var _=require('lodash');var squel=require(_0x3e80('0xc'));var crypto=require(_0x3e80('0xd'));var jsforce=require(_0x3e80('0xe'));var deskjs=require(_0x3e80('0xf'));var toCsv=require(_0x3e80('0x9'));var querystring=require(_0x3e80('0x10'));var Papa=require(_0x3e80('0x11'));var Redis=require(_0x3e80('0x12'));var authService=require('../../components/auth/service');var qs=require('../../components/parsers/qs');var as=require('../../components/parsers/advancedSearch');var hardwareService=require(_0x3e80('0x13'));var logger=require(_0x3e80('0x14'))(_0x3e80('0x15'));var utils=require(_0x3e80('0x16'));var config=require(_0x3e80('0x17'));var licenseUtil=require('../../config/license/util');var db=require(_0x3e80('0x18'))['db'];function respondWithStatusCode(_0x95c9d,_0x31bef4){_0x31bef4=_0x31bef4||0xcc;return function(_0x2c9766){if(_0x2c9766){return _0x95c9d[_0x3e80('0x19')](_0x31bef4);}return _0x95c9d['status'](_0x31bef4)[_0x3e80('0x1a')]();};}function respondWithResult(_0x236543,_0x3e2cfc){_0x3e2cfc=_0x3e2cfc||0xc8;return function(_0x35235a){if(_0x35235a){return _0x236543[_0x3e80('0x1b')](_0x3e2cfc)['json'](_0x35235a);}};}function respondWithFilteredResult(_0x39bc02,_0x287236){return function(_0x182489){if(_0x182489){var _0x1e74eb=typeof _0x287236['offset']===_0x3e80('0x1c')&&typeof _0x287236[_0x3e80('0x1d')]===_0x3e80('0x1c');var _0x300f42=_0x182489[_0x3e80('0x1e')];var _0x19fdbe=_0x1e74eb?0x0:_0x287236[_0x3e80('0x1f')];var _0x56e184=_0x1e74eb?_0x182489['count']:_0x287236['offset']+_0x287236[_0x3e80('0x1d')];var _0x4ab499;if(_0x56e184>=_0x300f42){_0x56e184=_0x300f42;_0x4ab499=0xc8;}else{_0x4ab499=0xce;}_0x39bc02[_0x3e80('0x1b')](_0x4ab499);return _0x39bc02[_0x3e80('0x20')]('Content-Range',_0x19fdbe+'-'+_0x56e184+'/'+_0x300f42)[_0x3e80('0x21')](_0x182489);}return null;};}function patchUpdates(_0xf5fd7d){return function(_0xe21fa){try{jsonpatch['apply'](_0xe21fa,_0xf5fd7d,!![]);}catch(_0x207481){return BPromise['reject'](_0x207481);}return _0xe21fa[_0x3e80('0x22')]();};}function saveUpdates(_0x768d28,_0x315074){return function(_0x31956c){if(_0x31956c){return _0x31956c[_0x3e80('0x23')](_0x768d28)[_0x3e80('0x24')](function(_0x4db2aa){return _0x4db2aa;});}return null;};}function removeEntity(_0x12fee7,_0x9f8a22){return function(_0x3407e9){if(_0x3407e9){return _0x3407e9[_0x3e80('0x25')]()[_0x3e80('0x24')](function(){_0x12fee7[_0x3e80('0x1b')](0xcc)[_0x3e80('0x1a')]();});}};}function handleEntityNotFound(_0xc6a772,_0x4849d6){return function(_0x4acef3){if(!_0x4acef3){_0xc6a772['sendStatus'](0x194);}return _0x4acef3;};}function handleError(_0x568a54,_0x135acc){_0x135acc=_0x135acc||0x1f4;return function(_0x50079c){logger['error'](_0x50079c[_0x3e80('0x26')]);if(_0x50079c[_0x3e80('0x27')]){delete _0x50079c[_0x3e80('0x27')];}_0x568a54[_0x3e80('0x1b')](_0x135acc)['send'](_0x50079c);};}exports['index']=function(_0x20ea51,_0x1a4ba9){var _0x3d9091={},_0x280175={},_0x2591ca={'count':0x0,'rows':[]};var _0x4863cd=_['map'](db[_0x3e80('0x28')][_0x3e80('0x29')],function(_0x5c81d6){return{'name':_0x5c81d6[_0x3e80('0x2a')],'type':_0x5c81d6[_0x3e80('0x2b')][_0x3e80('0x2c')]};});_0x280175[_0x3e80('0x2d')]=_[_0x3e80('0x2e')](_0x4863cd,_0x3e80('0x27'));_0x280175[_0x3e80('0x2f')]=_[_0x3e80('0x30')](_0x20ea51[_0x3e80('0x2f')]);_0x280175[_0x3e80('0x31')]=_[_0x3e80('0x32')](_0x280175['model'],_0x280175[_0x3e80('0x2f')]);_0x3d9091[_0x3e80('0x33')]=_[_0x3e80('0x32')](_0x280175[_0x3e80('0x2d')],qs[_0x3e80('0x34')](_0x20ea51[_0x3e80('0x2f')]['fields']));_0x3d9091[_0x3e80('0x33')]=_0x3d9091[_0x3e80('0x33')][_0x3e80('0x35')]?_0x3d9091['attributes']:_0x280175[_0x3e80('0x2d')];if(!_0x20ea51[_0x3e80('0x2f')][_0x3e80('0x36')]('nolimit')){_0x3d9091[_0x3e80('0x1d')]=qs['limit'](_0x20ea51[_0x3e80('0x2f')][_0x3e80('0x1d')]);_0x3d9091['offset']=qs[_0x3e80('0x1f')](_0x20ea51[_0x3e80('0x2f')]['offset']);}_0x3d9091['order']=qs[_0x3e80('0x37')](_0x20ea51[_0x3e80('0x2f')][_0x3e80('0x37')]);_0x3d9091[_0x3e80('0x38')]=qs['filters'](_[_0x3e80('0x39')](_0x20ea51['query'],_0x280175[_0x3e80('0x31')]),_0x4863cd);if(_0x20ea51[_0x3e80('0x2f')][_0x3e80('0x3a')]){_0x3d9091[_0x3e80('0x38')]=_[_0x3e80('0x3b')](_0x3d9091[_0x3e80('0x38')],{'$or':_[_0x3e80('0x2e')](_0x4863cd,function(_0x519147){if(_0x519147[_0x3e80('0x2b')]!==_0x3e80('0x3c')){var _0x259fa5={};_0x259fa5[_0x519147['name']]={'$like':'%'+_0x20ea51[_0x3e80('0x2f')][_0x3e80('0x3a')]+'%'};return _0x259fa5;}})});}_0x3d9091=_[_0x3e80('0x3b')]({},_0x3d9091,_0x20ea51[_0x3e80('0x3d')]);var _0x4f1e56={'where':_0x3d9091[_0x3e80('0x38')]};return db['DeskConfiguration'][_0x3e80('0x1e')](_0x4f1e56)[_0x3e80('0x24')](function(_0x3a2878){_0x2591ca[_0x3e80('0x1e')]=_0x3a2878;if(_0x20ea51[_0x3e80('0x2f')][_0x3e80('0x3e')]){_0x3d9091[_0x3e80('0x3f')]=[{'all':!![]}];}return db['DeskConfiguration'][_0x3e80('0x40')](_0x3d9091);})[_0x3e80('0x24')](function(_0x2ed425){_0x2591ca['rows']=_0x2ed425;return _0x2591ca;})[_0x3e80('0x24')](respondWithFilteredResult(_0x1a4ba9,_0x3d9091))[_0x3e80('0x41')](handleError(_0x1a4ba9,null));};exports[_0x3e80('0x42')]=function(_0x4452d7,_0x22062a){var _0x404c78={'raw':![],'where':{'id':_0x4452d7['params']['id']}},_0x165900={};_0x165900[_0x3e80('0x2d')]=_['keys'](db[_0x3e80('0x28')][_0x3e80('0x29')]);_0x165900[_0x3e80('0x2f')]=_['keys'](_0x4452d7['query']);_0x165900[_0x3e80('0x31')]=_[_0x3e80('0x32')](_0x165900[_0x3e80('0x2d')],_0x165900[_0x3e80('0x2f')]);_0x404c78[_0x3e80('0x33')]=_[_0x3e80('0x32')](_0x165900[_0x3e80('0x2d')],qs['fields'](_0x4452d7[_0x3e80('0x2f')][_0x3e80('0x34')]));_0x404c78['attributes']=_0x404c78[_0x3e80('0x33')][_0x3e80('0x35')]?_0x404c78[_0x3e80('0x33')]:_0x165900[_0x3e80('0x2d')];if(_0x4452d7[_0x3e80('0x2f')][_0x3e80('0x3e')]){_0x404c78[_0x3e80('0x3f')]=[{'all':!![]}];}_0x404c78=_[_0x3e80('0x3b')]({},_0x404c78,_0x4452d7[_0x3e80('0x3d')]);return db[_0x3e80('0x28')][_0x3e80('0x43')](_0x404c78)[_0x3e80('0x24')](handleEntityNotFound(_0x22062a,null))[_0x3e80('0x24')](respondWithResult(_0x22062a,null))[_0x3e80('0x41')](handleError(_0x22062a,null));};exports['create']=function(_0x27751c,_0xe0f1b8){return db['DeskConfiguration'][_0x3e80('0x44')](_0x27751c['body'],{})[_0x3e80('0x24')](respondWithResult(_0xe0f1b8,0xc9))[_0x3e80('0x41')](handleError(_0xe0f1b8,null));};exports[_0x3e80('0x23')]=function(_0x1d233b,_0x490d03){if(_0x1d233b[_0x3e80('0x45')]['id']){delete _0x1d233b[_0x3e80('0x45')]['id'];}return db[_0x3e80('0x28')][_0x3e80('0x43')]({'where':{'id':_0x1d233b[_0x3e80('0x46')]['id']}})[_0x3e80('0x24')](handleEntityNotFound(_0x490d03,null))['then'](saveUpdates(_0x1d233b[_0x3e80('0x45')],null))[_0x3e80('0x24')](respondWithResult(_0x490d03,null))[_0x3e80('0x41')](handleError(_0x490d03,null));};exports['destroy']=function(_0x8c88dd,_0xfa1a87){return db[_0x3e80('0x28')]['find']({'where':{'id':_0x8c88dd[_0x3e80('0x46')]['id']}})[_0x3e80('0x24')](handleEntityNotFound(_0xfa1a87,null))[_0x3e80('0x24')](removeEntity(_0xfa1a87,null))[_0x3e80('0x41')](handleError(_0xfa1a87,null));};exports[_0x3e80('0x47')]=function(_0x215c3c,_0x180153,_0x34ecbd){var _0x4ecf30={};var _0x3ddc66={};var _0x401513;var _0xb6a73;return db[_0x3e80('0x28')][_0x3e80('0x48')]({'where':{'id':_0x215c3c[_0x3e80('0x46')]['id']}})['then'](handleEntityNotFound(_0x180153,null))[_0x3e80('0x24')](function(_0x138dfc){if(_0x138dfc){_0x401513=_0x138dfc;_0x3ddc66[_0x3e80('0x2d')]=_[_0x3e80('0x30')](db[_0x3e80('0x49')][_0x3e80('0x29')]);_0x3ddc66[_0x3e80('0x2f')]=_[_0x3e80('0x30')](_0x215c3c['query']);_0x3ddc66[_0x3e80('0x31')]=_['intersection'](_0x3ddc66['model'],_0x3ddc66[_0x3e80('0x2f')]);_0x4ecf30[_0x3e80('0x33')]=_['intersection'](_0x3ddc66[_0x3e80('0x2d')],qs[_0x3e80('0x34')](_0x215c3c[_0x3e80('0x2f')][_0x3e80('0x34')]));_0x4ecf30['attributes']=_0x4ecf30['attributes']['length']?_0x4ecf30['attributes']:_0x3ddc66[_0x3e80('0x2d')];_0x4ecf30[_0x3e80('0x4a')]=qs['sort'](_0x215c3c['query'][_0x3e80('0x37')]);_0x4ecf30[_0x3e80('0x38')]=qs['filters'](_['pick'](_0x215c3c[_0x3e80('0x2f')],_0x3ddc66[_0x3e80('0x31')]));if(_0x215c3c[_0x3e80('0x2f')][_0x3e80('0x3a')]){_0x4ecf30[_0x3e80('0x38')]=_[_0x3e80('0x3b')](_0x4ecf30[_0x3e80('0x38')],{'$or':_['map'](_0x4ecf30[_0x3e80('0x33')],function(_0x3b21e1){var _0x100127={};_0x100127[_0x3b21e1]={'$like':'%'+_0x215c3c['query'][_0x3e80('0x3a')]+'%'};return _0x100127;})});}_0x4ecf30=_[_0x3e80('0x3b')]({},_0x4ecf30,_0x215c3c[_0x3e80('0x3d')]);return _0x401513[_0x3e80('0x47')](_0x4ecf30);}})[_0x3e80('0x24')](function(_0x1400e9){if(_0x1400e9){_0xb6a73=_0x1400e9[_0x3e80('0x35')];if(!_0x215c3c[_0x3e80('0x2f')][_0x3e80('0x36')]('nolimit')){_0x4ecf30[_0x3e80('0x1d')]=qs['limit'](_0x215c3c[_0x3e80('0x2f')][_0x3e80('0x1d')]);_0x4ecf30[_0x3e80('0x1f')]=qs[_0x3e80('0x1f')](_0x215c3c[_0x3e80('0x2f')][_0x3e80('0x1f')]);}return _0x401513[_0x3e80('0x47')](_0x4ecf30);}})[_0x3e80('0x24')](function(_0x21cada){if(_0x21cada){return _0x21cada?{'count':_0xb6a73,'rows':_0x21cada}:null;}})[_0x3e80('0x24')](respondWithResult(_0x180153,null))['catch'](handleError(_0x180153,null));};exports['getSubjects']=function(_0xd52c69,_0x40da16,_0x4f0588){var _0x2791d8={};var _0x2341ae={};var _0x527c9a;var _0x4bb181;return db[_0x3e80('0x28')]['findOne']({'where':{'id':_0xd52c69[_0x3e80('0x46')]['id']}})['then'](handleEntityNotFound(_0x40da16,null))['then'](function(_0x32a41b){if(_0x32a41b){_0x527c9a=_0x32a41b;_0x2341ae[_0x3e80('0x2d')]=_[_0x3e80('0x30')](db[_0x3e80('0x49')][_0x3e80('0x29')]);_0x2341ae['query']=_['keys'](_0xd52c69[_0x3e80('0x2f')]);_0x2341ae[_0x3e80('0x31')]=_[_0x3e80('0x32')](_0x2341ae[_0x3e80('0x2d')],_0x2341ae[_0x3e80('0x2f')]);_0x2791d8['attributes']=_[_0x3e80('0x32')](_0x2341ae[_0x3e80('0x2d')],qs['fields'](_0xd52c69[_0x3e80('0x2f')][_0x3e80('0x34')]));_0x2791d8[_0x3e80('0x33')]=_0x2791d8['attributes'][_0x3e80('0x35')]?_0x2791d8[_0x3e80('0x33')]:_0x2341ae[_0x3e80('0x2d')];_0x2791d8[_0x3e80('0x4a')]=qs['sort'](_0xd52c69[_0x3e80('0x2f')]['sort']);_0x2791d8[_0x3e80('0x38')]=qs[_0x3e80('0x31')](_['pick'](_0xd52c69[_0x3e80('0x2f')],_0x2341ae[_0x3e80('0x31')]));if(_0xd52c69[_0x3e80('0x2f')][_0x3e80('0x3a')]){_0x2791d8[_0x3e80('0x38')]=_[_0x3e80('0x3b')](_0x2791d8[_0x3e80('0x38')],{'$or':_[_0x3e80('0x2e')](_0x2791d8[_0x3e80('0x33')],function(_0xd572df){var _0x5a0ab1={};_0x5a0ab1[_0xd572df]={'$like':'%'+_0xd52c69[_0x3e80('0x2f')]['filter']+'%'};return _0x5a0ab1;})});}_0x2791d8=_[_0x3e80('0x3b')]({},_0x2791d8,_0xd52c69[_0x3e80('0x3d')]);return _0x527c9a[_0x3e80('0x4b')](_0x2791d8);}})['then'](function(_0x445635){if(_0x445635){_0x4bb181=_0x445635[_0x3e80('0x35')];if(!_0xd52c69['query'][_0x3e80('0x36')](_0x3e80('0x4c'))){_0x2791d8[_0x3e80('0x1d')]=qs['limit'](_0xd52c69[_0x3e80('0x2f')][_0x3e80('0x1d')]);_0x2791d8[_0x3e80('0x1f')]=qs[_0x3e80('0x1f')](_0xd52c69[_0x3e80('0x2f')]['offset']);}return _0x527c9a[_0x3e80('0x4b')](_0x2791d8);}})[_0x3e80('0x24')](function(_0x6b1d00){if(_0x6b1d00){return _0x6b1d00?{'count':_0x4bb181,'rows':_0x6b1d00}:null;}})[_0x3e80('0x24')](respondWithResult(_0x40da16,null))['catch'](handleError(_0x40da16,null));};exports['getDescriptions']=function(_0x469cb4,_0x59bbe7,_0x540877){var _0x4ce3ae={};var _0x14b6c6={};var _0x21673b;var _0x372065;return db['DeskConfiguration'][_0x3e80('0x48')]({'where':{'id':_0x469cb4[_0x3e80('0x46')]['id']}})['then'](handleEntityNotFound(_0x59bbe7,null))[_0x3e80('0x24')](function(_0x5962a3){if(_0x5962a3){_0x21673b=_0x5962a3;_0x14b6c6['model']=_[_0x3e80('0x30')](db[_0x3e80('0x49')][_0x3e80('0x29')]);_0x14b6c6['query']=_[_0x3e80('0x30')](_0x469cb4['query']);_0x14b6c6[_0x3e80('0x31')]=_[_0x3e80('0x32')](_0x14b6c6[_0x3e80('0x2d')],_0x14b6c6[_0x3e80('0x2f')]);_0x4ce3ae[_0x3e80('0x33')]=_[_0x3e80('0x32')](_0x14b6c6[_0x3e80('0x2d')],qs[_0x3e80('0x34')](_0x469cb4[_0x3e80('0x2f')][_0x3e80('0x34')]));_0x4ce3ae[_0x3e80('0x33')]=_0x4ce3ae['attributes'][_0x3e80('0x35')]?_0x4ce3ae[_0x3e80('0x33')]:_0x14b6c6['model'];_0x4ce3ae[_0x3e80('0x4a')]=qs[_0x3e80('0x37')](_0x469cb4[_0x3e80('0x2f')][_0x3e80('0x37')]);_0x4ce3ae[_0x3e80('0x38')]=qs[_0x3e80('0x31')](_['pick'](_0x469cb4[_0x3e80('0x2f')],_0x14b6c6[_0x3e80('0x31')]));if(_0x469cb4[_0x3e80('0x2f')][_0x3e80('0x3a')]){_0x4ce3ae[_0x3e80('0x38')]=_['merge'](_0x4ce3ae[_0x3e80('0x38')],{'$or':_[_0x3e80('0x2e')](_0x4ce3ae[_0x3e80('0x33')],function(_0xd40af6){var _0x336aab={};_0x336aab[_0xd40af6]={'$like':'%'+_0x469cb4[_0x3e80('0x2f')][_0x3e80('0x3a')]+'%'};return _0x336aab;})});}_0x4ce3ae=_['merge']({},_0x4ce3ae,_0x469cb4[_0x3e80('0x3d')]);return _0x21673b['getDescriptions'](_0x4ce3ae);}})[_0x3e80('0x24')](function(_0x46f773){if(_0x46f773){_0x372065=_0x46f773[_0x3e80('0x35')];if(!_0x469cb4[_0x3e80('0x2f')]['hasOwnProperty']('nolimit')){_0x4ce3ae[_0x3e80('0x1d')]=qs[_0x3e80('0x1d')](_0x469cb4[_0x3e80('0x2f')]['limit']);_0x4ce3ae[_0x3e80('0x1f')]=qs['offset'](_0x469cb4[_0x3e80('0x2f')][_0x3e80('0x1f')]);}return _0x21673b[_0x3e80('0x4d')](_0x4ce3ae);}})[_0x3e80('0x24')](function(_0x1a8b52){if(_0x1a8b52){return _0x1a8b52?{'count':_0x372065,'rows':_0x1a8b52}:null;}})['then'](respondWithResult(_0x59bbe7,null))[_0x3e80('0x41')](handleError(_0x59bbe7,null));};exports[_0x3e80('0x4e')]=function(_0x59953c,_0xb2deb0,_0x5268a4){var _0x128658={};var _0x244e77={};var _0x64ff5d;var _0x4c747f;return db[_0x3e80('0x28')][_0x3e80('0x48')]({'where':{'id':_0x59953c[_0x3e80('0x46')]['id']}})[_0x3e80('0x24')](handleEntityNotFound(_0xb2deb0,null))[_0x3e80('0x24')](function(_0x3fcf98){if(_0x3fcf98){_0x64ff5d=_0x3fcf98;_0x244e77[_0x3e80('0x2d')]=_[_0x3e80('0x30')](db[_0x3e80('0x4f')][_0x3e80('0x29')]);_0x244e77[_0x3e80('0x2f')]=_[_0x3e80('0x30')](_0x59953c[_0x3e80('0x2f')]);_0x244e77['filters']=_[_0x3e80('0x32')](_0x244e77[_0x3e80('0x2d')],_0x244e77[_0x3e80('0x2f')]);_0x128658[_0x3e80('0x33')]=_['intersection'](_0x244e77[_0x3e80('0x2d')],qs[_0x3e80('0x34')](_0x59953c[_0x3e80('0x2f')][_0x3e80('0x34')]));_0x128658[_0x3e80('0x33')]=_0x128658[_0x3e80('0x33')][_0x3e80('0x35')]?_0x128658[_0x3e80('0x33')]:_0x244e77[_0x3e80('0x2d')];_0x128658[_0x3e80('0x4a')]=qs[_0x3e80('0x37')](_0x59953c[_0x3e80('0x2f')][_0x3e80('0x37')]);_0x128658[_0x3e80('0x38')]=qs['filters'](_[_0x3e80('0x39')](_0x59953c[_0x3e80('0x2f')],_0x244e77['filters']));if(_0x59953c[_0x3e80('0x2f')]['filter']){_0x128658['where']=_[_0x3e80('0x3b')](_0x128658['where'],{'$or':_[_0x3e80('0x2e')](_0x128658[_0x3e80('0x33')],function(_0x5d3536){var _0x4deedf={};_0x4deedf[_0x5d3536]={'$like':'%'+_0x59953c[_0x3e80('0x2f')][_0x3e80('0x3a')]+'%'};return _0x4deedf;})});}_0x128658=_[_0x3e80('0x3b')]({},_0x128658,_0x59953c['options']);return _0x64ff5d[_0x3e80('0x4e')](_0x128658);}})[_0x3e80('0x24')](function(_0x5a050d){if(_0x5a050d){_0x4c747f=_0x5a050d[_0x3e80('0x35')];if(!_0x59953c[_0x3e80('0x2f')]['hasOwnProperty'](_0x3e80('0x4c'))){_0x128658[_0x3e80('0x1d')]=qs[_0x3e80('0x1d')](_0x59953c[_0x3e80('0x2f')][_0x3e80('0x1d')]);_0x128658[_0x3e80('0x1f')]=qs[_0x3e80('0x1f')](_0x59953c[_0x3e80('0x2f')][_0x3e80('0x1f')]);}return _0x64ff5d['getTags'](_0x128658);}})[_0x3e80('0x24')](function(_0x67080c){if(_0x67080c){return _0x67080c?{'count':_0x4c747f,'rows':_0x67080c}:null;}})[_0x3e80('0x24')](respondWithResult(_0xb2deb0,null))['catch'](handleError(_0xb2deb0,null));};exports[_0x3e80('0x50')]=function(_0x520ee1,_0x2659c5,_0x58243e){if(_0x520ee1['body']['id']){delete _0x520ee1[_0x3e80('0x45')]['id'];}return db[_0x3e80('0x28')]['findOne']({'where':{'id':_0x520ee1[_0x3e80('0x46')]['id']}})[_0x3e80('0x24')](handleEntityNotFound(_0x2659c5,null))['then'](function(_0xbde1f2){if(_0xbde1f2){return _0xbde1f2['setTags'](_0x520ee1['body'][_0x3e80('0x51')]||[]);}return null;})[_0x3e80('0x24')](respondWithResult(_0x2659c5,null))[_0x3e80('0x41')](handleError(_0x2659c5,null));}; \ No newline at end of file diff --git a/server/api/intDeskConfiguration/intDeskConfiguration.model.js b/server/api/intDeskConfiguration/intDeskConfiguration.model.js index e11d06d..75d50a2 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 _0x7fa6=['int_desk_configurations','lodash','util','api','moment','bluebird','rimraf','../../config/environment','exports','define','DeskConfiguration'];(function(_0x4e44b4,_0x7a7eb3){var _0xffcd76=function(_0x2c3f78){while(--_0x2c3f78){_0x4e44b4['push'](_0x4e44b4['shift']());}};_0xffcd76(++_0x7a7eb3);}(_0x7fa6,0xb1));var _0x67fa=function(_0x4801b7,_0x14d2e0){_0x4801b7=_0x4801b7-0x0;var _0x54fb9c=_0x7fa6[_0x4801b7];return _0x54fb9c;};'use strict';var _=require(_0x67fa('0x0'));var util=require(_0x67fa('0x1'));var logger=require('../../config/logger')(_0x67fa('0x2'));var moment=require(_0x67fa('0x3'));var BPromise=require(_0x67fa('0x4'));var rp=require('request-promise');var fs=require('fs');var path=require('path');var rimraf=require(_0x67fa('0x5'));var config=require(_0x67fa('0x6'));var attributes=require('./intDeskConfiguration.attributes');module[_0x67fa('0x7')]=function(_0x29d5c4,_0x47aedd){return _0x29d5c4[_0x67fa('0x8')](_0x67fa('0x9'),attributes,{'tableName':_0x67fa('0xa'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x3e0f=['lodash','util','../../config/logger','api','bluebird','request-promise','rimraf','../../config/environment','./intDeskConfiguration.attributes','exports','DeskConfiguration','int_desk_configurations'];(function(_0x1ae67a,_0x3b8912){var _0x5e7b06=function(_0x545e7d){while(--_0x545e7d){_0x1ae67a['push'](_0x1ae67a['shift']());}};_0x5e7b06(++_0x3b8912);}(_0x3e0f,0xfc));var _0xf3e0=function(_0x5ac1e5,_0x4b5012){_0x5ac1e5=_0x5ac1e5-0x0;var _0x1bccc6=_0x3e0f[_0x5ac1e5];return _0x1bccc6;};'use strict';var _=require(_0xf3e0('0x0'));var util=require(_0xf3e0('0x1'));var logger=require(_0xf3e0('0x2'))(_0xf3e0('0x3'));var moment=require('moment');var BPromise=require(_0xf3e0('0x4'));var rp=require(_0xf3e0('0x5'));var fs=require('fs');var path=require('path');var rimraf=require(_0xf3e0('0x6'));var config=require(_0xf3e0('0x7'));var attributes=require(_0xf3e0('0x8'));module[_0xf3e0('0x9')]=function(_0x3006f9,_0x4ffd45){return _0x3006f9['define'](_0xf3e0('0xa'),attributes,{'tableName':_0xf3e0('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 012d768..219661e 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 _0xcdc2=['../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','then','DeskConfiguration,\x20%s,\x20%s','DeskConfiguration,\x20%s,\x20%s,\x20%s','stringify','error','message','info','catch','lodash','util','moment','bluebird','randomstring','ioredis','../../mysqldb'];(function(_0x1415ef,_0x5c219e){var _0x234acc=function(_0x2dbfca){while(--_0x2dbfca){_0x1415ef['push'](_0x1415ef['shift']());}};_0x234acc(++_0x5c219e);}(_0xcdc2,0x19d));var _0x2cdc=function(_0x1899a9,_0xdb9ddf){_0x1899a9=_0x1899a9-0x0;var _0x5636e9=_0xcdc2[_0x1899a9];return _0x5636e9;};'use strict';var _=require(_0x2cdc('0x0'));var util=require(_0x2cdc('0x1'));var moment=require(_0x2cdc('0x2'));var BPromise=require(_0x2cdc('0x3'));var rs=require(_0x2cdc('0x4'));var fs=require('fs');var Redis=require(_0x2cdc('0x5'));var db=require(_0x2cdc('0x6'))['db'];var utils=require(_0x2cdc('0x7'));var logger=require(_0x2cdc('0x8'))(_0x2cdc('0x9'));var config=require(_0x2cdc('0xa'));var jayson=require(_0x2cdc('0xb'));var client=jayson['client']['http']({'port':0x232a});function respondWithRpcPromise(_0x10b817,_0x54e717,_0x17f9f4){return new BPromise(function(_0x35a1d0,_0x393327){return client['request'](_0x10b817,_0x17f9f4)[_0x2cdc('0xc')](function(_0x51e6e7){logger['info'](_0x2cdc('0xd'),_0x54e717,'request\x20sent');logger['debug'](_0x2cdc('0xe'),_0x54e717,'request\x20sent',JSON[_0x2cdc('0xf')](_0x51e6e7));if(_0x51e6e7[_0x2cdc('0x10')]){if(_0x51e6e7[_0x2cdc('0x10')]['code']===0x1f4){logger['error']('DeskConfiguration,\x20%s,\x20%s',_0x54e717,_0x51e6e7['error']['message']);return _0x393327(_0x51e6e7[_0x2cdc('0x10')][_0x2cdc('0x11')]);}logger[_0x2cdc('0x10')](_0x2cdc('0xd'),_0x54e717,_0x51e6e7['error']['message']);return _0x35a1d0(_0x51e6e7[_0x2cdc('0x10')][_0x2cdc('0x11')]);}else{logger[_0x2cdc('0x12')](_0x2cdc('0xd'),_0x54e717,'request\x20sent');_0x35a1d0(_0x51e6e7['result'][_0x2cdc('0x11')]);}})[_0x2cdc('0x13')](function(_0x2a60d2){logger[_0x2cdc('0x10')](_0x2cdc('0xd'),_0x54e717,_0x2a60d2);_0x393327(_0x2a60d2);});});} \ No newline at end of file +var _0x8f4c=['util','moment','bluebird','randomstring','ioredis','../../config/utils','../../config/logger','rpc','jayson/promise','request','then','DeskConfiguration,\x20%s,\x20%s','request\x20sent','debug','DeskConfiguration,\x20%s,\x20%s,\x20%s','stringify','error','code','message','info','result','catch','lodash'];(function(_0x8bf471,_0x2e9da0){var _0x3d93d7=function(_0x14b46f){while(--_0x14b46f){_0x8bf471['push'](_0x8bf471['shift']());}};_0x3d93d7(++_0x2e9da0);}(_0x8f4c,0x113));var _0xc8f4=function(_0x426d1c,_0x2cb46a){_0x426d1c=_0x426d1c-0x0;var _0x1d53d4=_0x8f4c[_0x426d1c];return _0x1d53d4;};'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);});});} \ No newline at end of file diff --git a/server/api/intDeskField/index.js b/server/api/intDeskField/index.js index f495ea5..bbace28 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 _0x69d3=['../../config/environment','./intDeskField.controller','get','isAuthenticated','index','/:id','post','put','update','destroy','exports','multer','connect-timeout','express','Router','fs-extra','../../components/auth/service','../../components/interaction/service'];(function(_0x3a23b3,_0x2dc3b6){var _0x31a60b=function(_0x1f8101){while(--_0x1f8101){_0x3a23b3['push'](_0x3a23b3['shift']());}};_0x31a60b(++_0x2dc3b6);}(_0x69d3,0x13d));var _0x369d=function(_0x3615a7,_0x5618ab){_0x3615a7=_0x3615a7-0x0;var _0x36e81a=_0x69d3[_0x3615a7];return _0x36e81a;};'use strict';var multer=require(_0x369d('0x0'));var util=require('util');var path=require('path');var timeout=require(_0x369d('0x1'));var express=require(_0x369d('0x2'));var router=express[_0x369d('0x3')]();var fs_extra=require(_0x369d('0x4'));var auth=require(_0x369d('0x5'));var interaction=require(_0x369d('0x6'));var config=require(_0x369d('0x7'));var controller=require(_0x369d('0x8'));router[_0x369d('0x9')]('/',auth[_0x369d('0xa')](),controller[_0x369d('0xb')]);router['get'](_0x369d('0xc'),auth['isAuthenticated'](),controller['show']);router[_0x369d('0xd')]('/',auth['isAuthenticated'](),controller['create']);router[_0x369d('0xe')](_0x369d('0xc'),auth[_0x369d('0xa')](),controller[_0x369d('0xf')]);router['delete'](_0x369d('0xc'),auth['isAuthenticated'](),controller[_0x369d('0x10')]);module[_0x369d('0x11')]=router; \ No newline at end of file +var _0xeaa5=['../../config/environment','./intDeskField.controller','get','/:id','show','post','isAuthenticated','create','put','update','delete','destroy','exports','multer','util','connect-timeout','express','Router','fs-extra','../../components/auth/service','../../components/interaction/service'];(function(_0x6131cd,_0x4c26a1){var _0x47e916=function(_0x1f2bce){while(--_0x1f2bce){_0x6131cd['push'](_0x6131cd['shift']());}};_0x47e916(++_0x4c26a1);}(_0xeaa5,0x1f0));var _0x5eaa=function(_0x1912af,_0x566ff1){_0x1912af=_0x1912af-0x0;var _0x3ace74=_0xeaa5[_0x1912af];return _0x3ace74;};'use strict';var multer=require(_0x5eaa('0x0'));var util=require(_0x5eaa('0x1'));var path=require('path');var timeout=require(_0x5eaa('0x2'));var express=require(_0x5eaa('0x3'));var router=express[_0x5eaa('0x4')]();var fs_extra=require(_0x5eaa('0x5'));var auth=require(_0x5eaa('0x6'));var interaction=require(_0x5eaa('0x7'));var config=require(_0x5eaa('0x8'));var controller=require(_0x5eaa('0x9'));router[_0x5eaa('0xa')]('/',auth['isAuthenticated'](),controller['index']);router[_0x5eaa('0xa')](_0x5eaa('0xb'),auth['isAuthenticated'](),controller[_0x5eaa('0xc')]);router[_0x5eaa('0xd')]('/',auth[_0x5eaa('0xe')](),controller[_0x5eaa('0xf')]);router[_0x5eaa('0x10')](_0x5eaa('0xb'),auth['isAuthenticated'](),controller[_0x5eaa('0x11')]);router[_0x5eaa('0x12')](_0x5eaa('0xb'),auth['isAuthenticated'](),controller[_0x5eaa('0x13')]);module[_0x5eaa('0x14')]=router; \ No newline at end of file diff --git a/server/api/intDeskField/intDeskField.attributes.js b/server/api/intDeskField/intDeskField.attributes.js index ff8c9c6..b94ad44 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 _0x9dc7=['variable','customVariable','keyValue','picklist','STRING','BOOLEAN','sequelize','ENUM','string'];(function(_0x1dd8a1,_0x840313){var _0x152307=function(_0x291476){while(--_0x291476){_0x1dd8a1['push'](_0x1dd8a1['shift']());}};_0x152307(++_0x840313);}(_0x9dc7,0x16e));var _0x79dc=function(_0x336dec,_0x1fd97b){_0x336dec=_0x336dec-0x0;var _0x22f0e9=_0x9dc7[_0x336dec];return _0x22f0e9;};'use strict';var Sequelize=require(_0x79dc('0x0'));module['exports']={'type':{'type':Sequelize[_0x79dc('0x1')](_0x79dc('0x2'),_0x79dc('0x3'),_0x79dc('0x4'),_0x79dc('0x5'),_0x79dc('0x6')),'defaultValue':_0x79dc('0x2')},'content':{'type':Sequelize[_0x79dc('0x7')]},'key':{'type':Sequelize[_0x79dc('0x7')]},'keyType':{'type':Sequelize[_0x79dc('0x1')](_0x79dc('0x2'),_0x79dc('0x3'),_0x79dc('0x4'))},'keyContent':{'type':Sequelize['STRING']},'idField':{'type':Sequelize[_0x79dc('0x7')]},'nameField':{'type':Sequelize[_0x79dc('0x7')]},'customField':{'type':Sequelize[_0x79dc('0x8')],'defaultValue':!![]},'variableName':{'type':Sequelize[_0x79dc('0x7')]}}; \ No newline at end of file +var _0xc6eb=['STRING','variable','BOOLEAN','ENUM','string','customVariable','picklist'];(function(_0x369151,_0x179f72){var _0x4292d5=function(_0x330422){while(--_0x330422){_0x369151['push'](_0x369151['shift']());}};_0x4292d5(++_0x179f72);}(_0xc6eb,0xea));var _0xbc6e=function(_0x33628a,_0x2df134){_0x33628a=_0x33628a-0x0;var _0x25d370=_0xc6eb[_0x33628a];return _0x25d370;};'use strict';var Sequelize=require('sequelize');module['exports']={'type':{'type':Sequelize[_0xbc6e('0x0')](_0xbc6e('0x1'),'variable',_0xbc6e('0x2'),'keyValue',_0xbc6e('0x3')),'defaultValue':_0xbc6e('0x1')},'content':{'type':Sequelize[_0xbc6e('0x4')]},'key':{'type':Sequelize[_0xbc6e('0x4')]},'keyType':{'type':Sequelize['ENUM'](_0xbc6e('0x1'),_0xbc6e('0x5'),_0xbc6e('0x2'))},'keyContent':{'type':Sequelize[_0xbc6e('0x4')]},'idField':{'type':Sequelize[_0xbc6e('0x4')]},'nameField':{'type':Sequelize[_0xbc6e('0x4')]},'customField':{'type':Sequelize[_0xbc6e('0x6')],'defaultValue':!![]},'variableName':{'type':Sequelize[_0xbc6e('0x4')]}}; \ No newline at end of file diff --git a/server/api/intDeskField/intDeskField.controller.js b/server/api/intDeskField/intDeskField.controller.js index c5601ac..66a0258 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 _0x1c23=['filters','intersection','model','fields','length','attributes','hasOwnProperty','nolimit','order','sort','where','pick','filter','merge','VIRTUAL','options','includeAll','include','findAll','show','params','find','catch','body','destroy','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','moment','mustache','util','sox','to-csv','ejs','fs-extra','lodash','crypto','jsforce','desk.js','querystring','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/environment','../../mysqldb','sendStatus','status','json','offset','undefined','count','limit','set','apply','save','update','then','stack','name','send','index','map','DeskField','rawAttributes','fieldName','type','key','keys','query'];(function(_0x130615,_0x1cf737){var _0x3d8247=function(_0x553d5c){while(--_0x553d5c){_0x130615['push'](_0x130615['shift']());}};_0x3d8247(++_0x1cf737);}(_0x1c23,0x1d5));var _0x31c2=function(_0x215f0e,_0x3be9d6){_0x215f0e=_0x215f0e-0x0;var _0x4336d9=_0x1c23[_0x215f0e];return _0x4336d9;};'use strict';var emlformat=require(_0x31c2('0x0'));var rimraf=require(_0x31c2('0x1'));var zipdir=require(_0x31c2('0x2'));var jsonpatch=require(_0x31c2('0x3'));var rp=require(_0x31c2('0x4'));var moment=require(_0x31c2('0x5'));var BPromise=require('bluebird');var Mustache=require(_0x31c2('0x6'));var util=require(_0x31c2('0x7'));var path=require('path');var sox=require(_0x31c2('0x8'));var csv=require(_0x31c2('0x9'));var ejs=require(_0x31c2('0xa'));var fs=require('fs');var fs_extra=require(_0x31c2('0xb'));var _=require(_0x31c2('0xc'));var squel=require('squel');var crypto=require(_0x31c2('0xd'));var jsforce=require(_0x31c2('0xe'));var deskjs=require(_0x31c2('0xf'));var toCsv=require(_0x31c2('0x9'));var querystring=require(_0x31c2('0x10'));var Papa=require('papaparse');var Redis=require('ioredis');var authService=require(_0x31c2('0x11'));var qs=require(_0x31c2('0x12'));var as=require(_0x31c2('0x13'));var hardwareService=require(_0x31c2('0x14'));var logger=require(_0x31c2('0x15'))(_0x31c2('0x16'));var utils=require('../../config/utils');var config=require(_0x31c2('0x17'));var licenseUtil=require('../../config/license/util');var db=require(_0x31c2('0x18'))['db'];function respondWithStatusCode(_0x2df4e5,_0x1d8406){_0x1d8406=_0x1d8406||0xcc;return function(_0x5f573a){if(_0x5f573a){return _0x2df4e5[_0x31c2('0x19')](_0x1d8406);}return _0x2df4e5[_0x31c2('0x1a')](_0x1d8406)['end']();};}function respondWithResult(_0x14c25f,_0x44d874){_0x44d874=_0x44d874||0xc8;return function(_0x463881){if(_0x463881){return _0x14c25f[_0x31c2('0x1a')](_0x44d874)[_0x31c2('0x1b')](_0x463881);}};}function respondWithFilteredResult(_0x5fa42e,_0x1cf235){return function(_0x35f75b){if(_0x35f75b){var _0x3f1d79=typeof _0x1cf235[_0x31c2('0x1c')]===_0x31c2('0x1d')&&typeof _0x1cf235['limit']==='undefined';var _0x3bfa45=_0x35f75b[_0x31c2('0x1e')];var _0x1f7f83=_0x3f1d79?0x0:_0x1cf235['offset'];var _0x5055e7=_0x3f1d79?_0x35f75b[_0x31c2('0x1e')]:_0x1cf235['offset']+_0x1cf235[_0x31c2('0x1f')];var _0x3f2435;if(_0x5055e7>=_0x3bfa45){_0x5055e7=_0x3bfa45;_0x3f2435=0xc8;}else{_0x3f2435=0xce;}_0x5fa42e[_0x31c2('0x1a')](_0x3f2435);return _0x5fa42e[_0x31c2('0x20')]('Content-Range',_0x1f7f83+'-'+_0x5055e7+'/'+_0x3bfa45)[_0x31c2('0x1b')](_0x35f75b);}return null;};}function patchUpdates(_0x4ae7ad){return function(_0x35d945){try{jsonpatch[_0x31c2('0x21')](_0x35d945,_0x4ae7ad,!![]);}catch(_0x483c25){return BPromise['reject'](_0x483c25);}return _0x35d945[_0x31c2('0x22')]();};}function saveUpdates(_0x36ae8e,_0x4cd43e){return function(_0x133d0e){if(_0x133d0e){return _0x133d0e[_0x31c2('0x23')](_0x36ae8e)[_0x31c2('0x24')](function(_0x44a0bc){return _0x44a0bc;});}return null;};}function removeEntity(_0x5e10e7,_0x25bdc2){return function(_0x26939e){if(_0x26939e){return _0x26939e['destroy']()[_0x31c2('0x24')](function(){_0x5e10e7['status'](0xcc)['end']();});}};}function handleEntityNotFound(_0x3af6eb,_0x58f82d){return function(_0x37b749){if(!_0x37b749){_0x3af6eb[_0x31c2('0x19')](0x194);}return _0x37b749;};}function handleError(_0x18e3d8,_0x211a43){_0x211a43=_0x211a43||0x1f4;return function(_0x3ad658){logger['error'](_0x3ad658[_0x31c2('0x25')]);if(_0x3ad658[_0x31c2('0x26')]){delete _0x3ad658[_0x31c2('0x26')];}_0x18e3d8['status'](_0x211a43)[_0x31c2('0x27')](_0x3ad658);};}exports[_0x31c2('0x28')]=function(_0xf8879a,_0x2a936e){var _0x45aa60={},_0x2164d8={},_0x13c1ea={'count':0x0,'rows':[]};var _0x5d2a1a=_[_0x31c2('0x29')](db[_0x31c2('0x2a')][_0x31c2('0x2b')],function(_0x2488eb){return{'name':_0x2488eb[_0x31c2('0x2c')],'type':_0x2488eb[_0x31c2('0x2d')][_0x31c2('0x2e')]};});_0x2164d8['model']=_['map'](_0x5d2a1a,_0x31c2('0x26'));_0x2164d8['query']=_[_0x31c2('0x2f')](_0xf8879a[_0x31c2('0x30')]);_0x2164d8[_0x31c2('0x31')]=_[_0x31c2('0x32')](_0x2164d8['model'],_0x2164d8[_0x31c2('0x30')]);_0x45aa60['attributes']=_[_0x31c2('0x32')](_0x2164d8[_0x31c2('0x33')],qs[_0x31c2('0x34')](_0xf8879a[_0x31c2('0x30')]['fields']));_0x45aa60['attributes']=_0x45aa60['attributes'][_0x31c2('0x35')]?_0x45aa60[_0x31c2('0x36')]:_0x2164d8[_0x31c2('0x33')];if(!_0xf8879a[_0x31c2('0x30')][_0x31c2('0x37')](_0x31c2('0x38'))){_0x45aa60[_0x31c2('0x1f')]=qs[_0x31c2('0x1f')](_0xf8879a[_0x31c2('0x30')][_0x31c2('0x1f')]);_0x45aa60[_0x31c2('0x1c')]=qs[_0x31c2('0x1c')](_0xf8879a[_0x31c2('0x30')][_0x31c2('0x1c')]);}_0x45aa60[_0x31c2('0x39')]=qs['sort'](_0xf8879a['query'][_0x31c2('0x3a')]);_0x45aa60[_0x31c2('0x3b')]=qs[_0x31c2('0x31')](_[_0x31c2('0x3c')](_0xf8879a[_0x31c2('0x30')],_0x2164d8['filters']),_0x5d2a1a);if(_0xf8879a['query'][_0x31c2('0x3d')]){_0x45aa60[_0x31c2('0x3b')]=_[_0x31c2('0x3e')](_0x45aa60[_0x31c2('0x3b')],{'$or':_[_0x31c2('0x29')](_0x5d2a1a,function(_0x4855ef){if(_0x4855ef[_0x31c2('0x2d')]!==_0x31c2('0x3f')){var _0x592258={};_0x592258[_0x4855ef[_0x31c2('0x26')]]={'$like':'%'+_0xf8879a['query'][_0x31c2('0x3d')]+'%'};return _0x592258;}})});}_0x45aa60=_[_0x31c2('0x3e')]({},_0x45aa60,_0xf8879a[_0x31c2('0x40')]);var _0x158cca={'where':_0x45aa60['where']};return db[_0x31c2('0x2a')][_0x31c2('0x1e')](_0x158cca)[_0x31c2('0x24')](function(_0x412b5e){_0x13c1ea['count']=_0x412b5e;if(_0xf8879a[_0x31c2('0x30')][_0x31c2('0x41')]){_0x45aa60[_0x31c2('0x42')]=[{'all':!![]}];}return db[_0x31c2('0x2a')][_0x31c2('0x43')](_0x45aa60);})['then'](function(_0x17bb5e){_0x13c1ea['rows']=_0x17bb5e;return _0x13c1ea;})[_0x31c2('0x24')](respondWithFilteredResult(_0x2a936e,_0x45aa60))['catch'](handleError(_0x2a936e,null));};exports[_0x31c2('0x44')]=function(_0x36a7be,_0x149bd0){var _0x1932b5={'raw':!![],'where':{'id':_0x36a7be[_0x31c2('0x45')]['id']}},_0x32cfe3={};_0x32cfe3[_0x31c2('0x33')]=_['keys'](db[_0x31c2('0x2a')][_0x31c2('0x2b')]);_0x32cfe3[_0x31c2('0x30')]=_[_0x31c2('0x2f')](_0x36a7be[_0x31c2('0x30')]);_0x32cfe3[_0x31c2('0x31')]=_[_0x31c2('0x32')](_0x32cfe3[_0x31c2('0x33')],_0x32cfe3[_0x31c2('0x30')]);_0x1932b5[_0x31c2('0x36')]=_[_0x31c2('0x32')](_0x32cfe3[_0x31c2('0x33')],qs[_0x31c2('0x34')](_0x36a7be[_0x31c2('0x30')][_0x31c2('0x34')]));_0x1932b5[_0x31c2('0x36')]=_0x1932b5[_0x31c2('0x36')][_0x31c2('0x35')]?_0x1932b5['attributes']:_0x32cfe3[_0x31c2('0x33')];if(_0x36a7be[_0x31c2('0x30')]['includeAll']){_0x1932b5[_0x31c2('0x42')]=[{'all':!![]}];}_0x1932b5=_[_0x31c2('0x3e')]({},_0x1932b5,_0x36a7be[_0x31c2('0x40')]);return db[_0x31c2('0x2a')][_0x31c2('0x46')](_0x1932b5)[_0x31c2('0x24')](handleEntityNotFound(_0x149bd0,null))[_0x31c2('0x24')](respondWithResult(_0x149bd0,null))['catch'](handleError(_0x149bd0,null));};exports['create']=function(_0x583842,_0x29be6f){return db[_0x31c2('0x2a')]['create'](_0x583842['body'],{})[_0x31c2('0x24')](respondWithResult(_0x29be6f,0xc9))[_0x31c2('0x47')](handleError(_0x29be6f,null));};exports['update']=function(_0x2f935d,_0x28f9e7){if(_0x2f935d['body']['id']){delete _0x2f935d[_0x31c2('0x48')]['id'];}return db[_0x31c2('0x2a')]['find']({'where':{'id':_0x2f935d[_0x31c2('0x45')]['id']}})[_0x31c2('0x24')](handleEntityNotFound(_0x28f9e7,null))['then'](saveUpdates(_0x2f935d[_0x31c2('0x48')],null))[_0x31c2('0x24')](respondWithResult(_0x28f9e7,null))[_0x31c2('0x47')](handleError(_0x28f9e7,null));};exports[_0x31c2('0x49')]=function(_0x35d315,_0xa924bd){return db[_0x31c2('0x2a')][_0x31c2('0x46')]({'where':{'id':_0x35d315[_0x31c2('0x45')]['id']}})[_0x31c2('0x24')](handleEntityNotFound(_0xa924bd,null))['then'](removeEntity(_0xa924bd,null))['catch'](handleError(_0xa924bd,null));}; \ No newline at end of file +var _0xc949=['include','find','create','body','params','eml-format','zip-dir','fast-json-patch','request-promise','moment','mustache','util','sox','to-csv','ejs','fs-extra','squel','crypto','jsforce','desk.js','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','sendStatus','status','end','json','undefined','offset','count','limit','set','Content-Range','apply','reject','save','update','then','destroy','stack','name','send','index','map','DeskField','type','key','model','query','keys','attributes','fields','length','hasOwnProperty','nolimit','order','sort','where','filters','pick','filter','merge','includeAll','findAll','catch','rawAttributes','intersection'];(function(_0x14add3,_0x13ce8d){var _0x4a174f=function(_0x2b3ed7){while(--_0x2b3ed7){_0x14add3['push'](_0x14add3['shift']());}};_0x4a174f(++_0x13ce8d);}(_0xc949,0x181));var _0x9c94=function(_0x29b609,_0x19d388){_0x29b609=_0x29b609-0x0;var _0x54c952=_0xc949[_0x29b609];return _0x54c952;};'use strict';var emlformat=require(_0x9c94('0x0'));var rimraf=require('rimraf');var zipdir=require(_0x9c94('0x1'));var jsonpatch=require(_0x9c94('0x2'));var rp=require(_0x9c94('0x3'));var moment=require(_0x9c94('0x4'));var BPromise=require('bluebird');var Mustache=require(_0x9c94('0x5'));var util=require(_0x9c94('0x6'));var path=require('path');var sox=require(_0x9c94('0x7'));var csv=require(_0x9c94('0x8'));var ejs=require(_0x9c94('0x9'));var fs=require('fs');var fs_extra=require(_0x9c94('0xa'));var _=require('lodash');var squel=require(_0x9c94('0xb'));var crypto=require(_0x9c94('0xc'));var jsforce=require(_0x9c94('0xd'));var deskjs=require(_0x9c94('0xe'));var toCsv=require(_0x9c94('0x8'));var querystring=require(_0x9c94('0xf'));var Papa=require(_0x9c94('0x10'));var Redis=require(_0x9c94('0x11'));var authService=require(_0x9c94('0x12'));var qs=require(_0x9c94('0x13'));var as=require('../../components/parsers/advancedSearch');var hardwareService=require(_0x9c94('0x14'));var logger=require(_0x9c94('0x15'))(_0x9c94('0x16'));var utils=require(_0x9c94('0x17'));var config=require(_0x9c94('0x18'));var licenseUtil=require(_0x9c94('0x19'));var db=require(_0x9c94('0x1a'))['db'];function respondWithStatusCode(_0x423adb,_0x30f64e){_0x30f64e=_0x30f64e||0xcc;return function(_0x1e326f){if(_0x1e326f){return _0x423adb[_0x9c94('0x1b')](_0x30f64e);}return _0x423adb[_0x9c94('0x1c')](_0x30f64e)[_0x9c94('0x1d')]();};}function respondWithResult(_0x15c51c,_0x54d956){_0x54d956=_0x54d956||0xc8;return function(_0x9789bc){if(_0x9789bc){return _0x15c51c['status'](_0x54d956)[_0x9c94('0x1e')](_0x9789bc);}};}function respondWithFilteredResult(_0x26e629,_0x4f0013){return function(_0xe52641){if(_0xe52641){var _0x4d6308=typeof _0x4f0013['offset']===_0x9c94('0x1f')&&typeof _0x4f0013['limit']===_0x9c94('0x1f');var _0x33bd19=_0xe52641['count'];var _0x201e04=_0x4d6308?0x0:_0x4f0013[_0x9c94('0x20')];var _0x412804=_0x4d6308?_0xe52641[_0x9c94('0x21')]:_0x4f0013[_0x9c94('0x20')]+_0x4f0013[_0x9c94('0x22')];var _0x3e361c;if(_0x412804>=_0x33bd19){_0x412804=_0x33bd19;_0x3e361c=0xc8;}else{_0x3e361c=0xce;}_0x26e629['status'](_0x3e361c);return _0x26e629[_0x9c94('0x23')](_0x9c94('0x24'),_0x201e04+'-'+_0x412804+'/'+_0x33bd19)['json'](_0xe52641);}return null;};}function patchUpdates(_0x141801){return function(_0x845304){try{jsonpatch[_0x9c94('0x25')](_0x845304,_0x141801,!![]);}catch(_0x326b38){return BPromise[_0x9c94('0x26')](_0x326b38);}return _0x845304[_0x9c94('0x27')]();};}function saveUpdates(_0xadab16,_0x23cdf5){return function(_0x8fe4fb){if(_0x8fe4fb){return _0x8fe4fb[_0x9c94('0x28')](_0xadab16)[_0x9c94('0x29')](function(_0xe9280a){return _0xe9280a;});}return null;};}function removeEntity(_0x44d732,_0x8c0b7f){return function(_0x5b1020){if(_0x5b1020){return _0x5b1020[_0x9c94('0x2a')]()[_0x9c94('0x29')](function(){_0x44d732['status'](0xcc)[_0x9c94('0x1d')]();});}};}function handleEntityNotFound(_0x2c3d25,_0x4795bb){return function(_0x335184){if(!_0x335184){_0x2c3d25[_0x9c94('0x1b')](0x194);}return _0x335184;};}function handleError(_0x4dd38e,_0xc18230){_0xc18230=_0xc18230||0x1f4;return function(_0x45cf4d){logger['error'](_0x45cf4d[_0x9c94('0x2b')]);if(_0x45cf4d['name']){delete _0x45cf4d[_0x9c94('0x2c')];}_0x4dd38e[_0x9c94('0x1c')](_0xc18230)[_0x9c94('0x2d')](_0x45cf4d);};}exports[_0x9c94('0x2e')]=function(_0x1581c0,_0x3f2622){var _0xf30dd1={},_0x561fdc={},_0x5a6b1c={'count':0x0,'rows':[]};var _0xc4a819=_[_0x9c94('0x2f')](db[_0x9c94('0x30')]['rawAttributes'],function(_0x25a6b9){return{'name':_0x25a6b9['fieldName'],'type':_0x25a6b9[_0x9c94('0x31')][_0x9c94('0x32')]};});_0x561fdc[_0x9c94('0x33')]=_['map'](_0xc4a819,'name');_0x561fdc[_0x9c94('0x34')]=_[_0x9c94('0x35')](_0x1581c0[_0x9c94('0x34')]);_0x561fdc['filters']=_['intersection'](_0x561fdc['model'],_0x561fdc['query']);_0xf30dd1[_0x9c94('0x36')]=_['intersection'](_0x561fdc[_0x9c94('0x33')],qs[_0x9c94('0x37')](_0x1581c0['query']['fields']));_0xf30dd1[_0x9c94('0x36')]=_0xf30dd1[_0x9c94('0x36')][_0x9c94('0x38')]?_0xf30dd1[_0x9c94('0x36')]:_0x561fdc[_0x9c94('0x33')];if(!_0x1581c0[_0x9c94('0x34')][_0x9c94('0x39')](_0x9c94('0x3a'))){_0xf30dd1[_0x9c94('0x22')]=qs[_0x9c94('0x22')](_0x1581c0[_0x9c94('0x34')][_0x9c94('0x22')]);_0xf30dd1[_0x9c94('0x20')]=qs[_0x9c94('0x20')](_0x1581c0[_0x9c94('0x34')][_0x9c94('0x20')]);}_0xf30dd1[_0x9c94('0x3b')]=qs[_0x9c94('0x3c')](_0x1581c0['query'][_0x9c94('0x3c')]);_0xf30dd1[_0x9c94('0x3d')]=qs[_0x9c94('0x3e')](_[_0x9c94('0x3f')](_0x1581c0[_0x9c94('0x34')],_0x561fdc[_0x9c94('0x3e')]),_0xc4a819);if(_0x1581c0[_0x9c94('0x34')]['filter']){_0xf30dd1[_0x9c94('0x3d')]=_['merge'](_0xf30dd1[_0x9c94('0x3d')],{'$or':_[_0x9c94('0x2f')](_0xc4a819,function(_0x442d46){if(_0x442d46[_0x9c94('0x31')]!=='VIRTUAL'){var _0x245278={};_0x245278[_0x442d46['name']]={'$like':'%'+_0x1581c0[_0x9c94('0x34')][_0x9c94('0x40')]+'%'};return _0x245278;}})});}_0xf30dd1=_[_0x9c94('0x41')]({},_0xf30dd1,_0x1581c0['options']);var _0x21e9f7={'where':_0xf30dd1['where']};return db[_0x9c94('0x30')]['count'](_0x21e9f7)['then'](function(_0x9a75f0){_0x5a6b1c[_0x9c94('0x21')]=_0x9a75f0;if(_0x1581c0[_0x9c94('0x34')][_0x9c94('0x42')]){_0xf30dd1['include']=[{'all':!![]}];}return db[_0x9c94('0x30')][_0x9c94('0x43')](_0xf30dd1);})[_0x9c94('0x29')](function(_0x360960){_0x5a6b1c['rows']=_0x360960;return _0x5a6b1c;})[_0x9c94('0x29')](respondWithFilteredResult(_0x3f2622,_0xf30dd1))[_0x9c94('0x44')](handleError(_0x3f2622,null));};exports['show']=function(_0x24e74c,_0x3d8b31){var _0x2a5bd5={'raw':!![],'where':{'id':_0x24e74c['params']['id']}},_0x5e6a90={};_0x5e6a90[_0x9c94('0x33')]=_[_0x9c94('0x35')](db[_0x9c94('0x30')][_0x9c94('0x45')]);_0x5e6a90[_0x9c94('0x34')]=_[_0x9c94('0x35')](_0x24e74c[_0x9c94('0x34')]);_0x5e6a90[_0x9c94('0x3e')]=_[_0x9c94('0x46')](_0x5e6a90[_0x9c94('0x33')],_0x5e6a90[_0x9c94('0x34')]);_0x2a5bd5['attributes']=_[_0x9c94('0x46')](_0x5e6a90['model'],qs[_0x9c94('0x37')](_0x24e74c[_0x9c94('0x34')][_0x9c94('0x37')]));_0x2a5bd5[_0x9c94('0x36')]=_0x2a5bd5[_0x9c94('0x36')][_0x9c94('0x38')]?_0x2a5bd5[_0x9c94('0x36')]:_0x5e6a90['model'];if(_0x24e74c['query'][_0x9c94('0x42')]){_0x2a5bd5[_0x9c94('0x47')]=[{'all':!![]}];}_0x2a5bd5=_[_0x9c94('0x41')]({},_0x2a5bd5,_0x24e74c['options']);return db[_0x9c94('0x30')][_0x9c94('0x48')](_0x2a5bd5)['then'](handleEntityNotFound(_0x3d8b31,null))['then'](respondWithResult(_0x3d8b31,null))['catch'](handleError(_0x3d8b31,null));};exports['create']=function(_0x2b94e0,_0x5362f4){return db['DeskField'][_0x9c94('0x49')](_0x2b94e0['body'],{})[_0x9c94('0x29')](respondWithResult(_0x5362f4,0xc9))[_0x9c94('0x44')](handleError(_0x5362f4,null));};exports[_0x9c94('0x28')]=function(_0x205f51,_0x22eaa4){if(_0x205f51['body']['id']){delete _0x205f51[_0x9c94('0x4a')]['id'];}return db[_0x9c94('0x30')][_0x9c94('0x48')]({'where':{'id':_0x205f51[_0x9c94('0x4b')]['id']}})[_0x9c94('0x29')](handleEntityNotFound(_0x22eaa4,null))[_0x9c94('0x29')](saveUpdates(_0x205f51['body'],null))[_0x9c94('0x29')](respondWithResult(_0x22eaa4,null))['catch'](handleError(_0x22eaa4,null));};exports[_0x9c94('0x2a')]=function(_0x38bb48,_0x426c0f){return db['DeskField'][_0x9c94('0x48')]({'where':{'id':_0x38bb48[_0x9c94('0x4b')]['id']}})['then'](handleEntityNotFound(_0x426c0f,null))[_0x9c94('0x29')](removeEntity(_0x426c0f,null))['catch'](handleError(_0x426c0f,null));}; \ No newline at end of file diff --git a/server/api/intDeskField/intDeskField.model.js b/server/api/intDeskField/intDeskField.model.js index e78c661..9b53f92 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 _0x0cbf=['exports','define','DeskField','desk_unique_index','idField','FieldId','lodash','util','../../config/logger','api','moment','bluebird','path','rimraf','../../config/environment','./intDeskField.attributes'];(function(_0x5c45ab,_0x3a3043){var _0x185e8f=function(_0x522287){while(--_0x522287){_0x5c45ab['push'](_0x5c45ab['shift']());}};_0x185e8f(++_0x3a3043);}(_0x0cbf,0x116));var _0xf0cb=function(_0x369b4e,_0x4f678e){_0x369b4e=_0x369b4e-0x0;var _0x4362c2=_0x0cbf[_0x369b4e];return _0x4362c2;};'use strict';var _=require(_0xf0cb('0x0'));var util=require(_0xf0cb('0x1'));var logger=require(_0xf0cb('0x2'))(_0xf0cb('0x3'));var moment=require(_0xf0cb('0x4'));var BPromise=require(_0xf0cb('0x5'));var rp=require('request-promise');var fs=require('fs');var path=require(_0xf0cb('0x6'));var rimraf=require(_0xf0cb('0x7'));var config=require(_0xf0cb('0x8'));var attributes=require(_0xf0cb('0x9'));module[_0xf0cb('0xa')]=function(_0x12e2c2,_0x3f8dfa){return _0x12e2c2[_0xf0cb('0xb')](_0xf0cb('0xc'),attributes,{'tableName':'int_desk_fields','paranoid':![],'indexes':[{'name':_0xf0cb('0xd'),'fields':[_0xf0cb('0xe'),_0xf0cb('0xf')],'unique':!![]}],'timestamps':!![]});}; \ No newline at end of file +var _0x1357=['desk_unique_index','util','../../config/logger','api','bluebird','rimraf','./intDeskField.attributes','define'];(function(_0xc587da,_0x363c48){var _0x4d09ef=function(_0x31f479){while(--_0x31f479){_0xc587da['push'](_0xc587da['shift']());}};_0x4d09ef(++_0x363c48);}(_0x1357,0x141));var _0x7135=function(_0x1b73e6,_0x2c4cf1){_0x1b73e6=_0x1b73e6-0x0;var _0x47f457=_0x1357[_0x1b73e6];return _0x47f457;};'use strict';var _=require('lodash');var util=require(_0x7135('0x0'));var logger=require(_0x7135('0x1'))(_0x7135('0x2'));var moment=require('moment');var BPromise=require(_0x7135('0x3'));var rp=require('request-promise');var fs=require('fs');var path=require('path');var rimraf=require(_0x7135('0x4'));var config=require('../../config/environment');var attributes=require(_0x7135('0x5'));module['exports']=function(_0x2a307a,_0x25dad8){return _0x2a307a[_0x7135('0x6')]('DeskField',attributes,{'tableName':'int_desk_fields','paranoid':![],'indexes':[{'name':_0x7135('0x7'),'fields':['idField','FieldId'],'unique':!![]}],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/intDeskField/intDeskField.rpc.js b/server/api/intDeskField/intDeskField.rpc.js index b000548..33ffd3f 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 _0x9bf3=['code','message','result','catch','lodash','util','moment','../../mysqldb','../../config/utils','../../config/logger','../../config/environment','client','http','request','info','DeskField,\x20%s,\x20%s','request\x20sent','DeskField,\x20%s,\x20%s,\x20%s','error'];(function(_0x4cb8ad,_0x43a9e9){var _0x2549cc=function(_0x287bd5){while(--_0x287bd5){_0x4cb8ad['push'](_0x4cb8ad['shift']());}};_0x2549cc(++_0x43a9e9);}(_0x9bf3,0xaf));var _0x39bf=function(_0x56482c,_0x16118d){_0x56482c=_0x56482c-0x0;var _0x5aae7a=_0x9bf3[_0x56482c];return _0x5aae7a;};'use strict';var _=require(_0x39bf('0x0'));var util=require(_0x39bf('0x1'));var moment=require(_0x39bf('0x2'));var BPromise=require('bluebird');var rs=require('randomstring');var fs=require('fs');var Redis=require('ioredis');var db=require(_0x39bf('0x3'))['db'];var utils=require(_0x39bf('0x4'));var logger=require(_0x39bf('0x5'))('rpc');var config=require(_0x39bf('0x6'));var jayson=require('jayson/promise');var client=jayson[_0x39bf('0x7')][_0x39bf('0x8')]({'port':0x232a});function respondWithRpcPromise(_0x538799,_0x2fa515,_0xc284bf){return new BPromise(function(_0x4a46a2,_0x589e43){return client[_0x39bf('0x9')](_0x538799,_0xc284bf)['then'](function(_0x533170){logger[_0x39bf('0xa')](_0x39bf('0xb'),_0x2fa515,_0x39bf('0xc'));logger['debug'](_0x39bf('0xd'),_0x2fa515,_0x39bf('0xc'),JSON['stringify'](_0x533170));if(_0x533170[_0x39bf('0xe')]){if(_0x533170[_0x39bf('0xe')][_0x39bf('0xf')]===0x1f4){logger[_0x39bf('0xe')](_0x39bf('0xb'),_0x2fa515,_0x533170[_0x39bf('0xe')][_0x39bf('0x10')]);return _0x589e43(_0x533170['error']['message']);}logger['error']('DeskField,\x20%s,\x20%s',_0x2fa515,_0x533170[_0x39bf('0xe')][_0x39bf('0x10')]);return _0x4a46a2(_0x533170[_0x39bf('0xe')][_0x39bf('0x10')]);}else{logger[_0x39bf('0xa')]('DeskField,\x20%s,\x20%s',_0x2fa515,_0x39bf('0xc'));_0x4a46a2(_0x533170[_0x39bf('0x11')]['message']);}})[_0x39bf('0x12')](function(_0x521e9c){logger['error'](_0x39bf('0xb'),_0x2fa515,_0x521e9c);_0x589e43(_0x521e9c);});});} \ No newline at end of file +var _0xc044=['info','DeskField,\x20%s,\x20%s','request\x20sent','debug','DeskField,\x20%s,\x20%s,\x20%s','stringify','error','code','message','catch','lodash','util','moment','bluebird','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','client','http','then'];(function(_0x56922c,_0x347c88){var _0xf896d7=function(_0x214e47){while(--_0x214e47){_0x56922c['push'](_0x56922c['shift']());}};_0xf896d7(++_0x347c88);}(_0xc044,0xb2));var _0x4c04=function(_0x1facfa,_0x1acf7d){_0x1facfa=_0x1facfa-0x0;var _0x9ec701=_0xc044[_0x1facfa];return _0x9ec701;};'use strict';var _=require(_0x4c04('0x0'));var util=require(_0x4c04('0x1'));var moment=require(_0x4c04('0x2'));var BPromise=require(_0x4c04('0x3'));var rs=require('randomstring');var fs=require('fs');var Redis=require(_0x4c04('0x4'));var db=require(_0x4c04('0x5'))['db'];var utils=require(_0x4c04('0x6'));var logger=require(_0x4c04('0x7'))(_0x4c04('0x8'));var config=require(_0x4c04('0x9'));var jayson=require(_0x4c04('0xa'));var client=jayson[_0x4c04('0xb')][_0x4c04('0xc')]({'port':0x232a});function respondWithRpcPromise(_0x19f7f8,_0x1c4ac2,_0x25ca78){return new BPromise(function(_0x4844ec,_0x124e6b){return client['request'](_0x19f7f8,_0x25ca78)[_0x4c04('0xd')](function(_0x303fa6){logger[_0x4c04('0xe')](_0x4c04('0xf'),_0x1c4ac2,_0x4c04('0x10'));logger[_0x4c04('0x11')](_0x4c04('0x12'),_0x1c4ac2,'request\x20sent',JSON[_0x4c04('0x13')](_0x303fa6));if(_0x303fa6['error']){if(_0x303fa6[_0x4c04('0x14')][_0x4c04('0x15')]===0x1f4){logger['error']('DeskField,\x20%s,\x20%s',_0x1c4ac2,_0x303fa6['error'][_0x4c04('0x16')]);return _0x124e6b(_0x303fa6[_0x4c04('0x14')][_0x4c04('0x16')]);}logger[_0x4c04('0x14')](_0x4c04('0xf'),_0x1c4ac2,_0x303fa6[_0x4c04('0x14')][_0x4c04('0x16')]);return _0x4844ec(_0x303fa6[_0x4c04('0x14')][_0x4c04('0x16')]);}else{logger[_0x4c04('0xe')](_0x4c04('0xf'),_0x1c4ac2,_0x4c04('0x10'));_0x4844ec(_0x303fa6['result']['message']);}})[_0x4c04('0x17')](function(_0x429a52){logger['error'](_0x4c04('0xf'),_0x1c4ac2,_0x429a52);_0x124e6b(_0x429a52);});});} \ No newline at end of file diff --git a/server/api/intDynamics365Account/index.js b/server/api/intDynamics365Account/index.js index a7388cb..986fcc0 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 _0xe22b=['show','/:id/configurations','getConfigurations','post','create','addConfiguration','put','update','delete','destroy','multer','path','express','Router','fs-extra','../../components/auth/service','../../config/environment','./intDynamics365Account.controller','get','isAuthenticated','/:id'];(function(_0x3825ed,_0x24290b){var _0x3263b7=function(_0x5d2c80){while(--_0x5d2c80){_0x3825ed['push'](_0x3825ed['shift']());}};_0x3263b7(++_0x24290b);}(_0xe22b,0x9d));var _0xbe22=function(_0x109fd8,_0x81831c){_0x109fd8=_0x109fd8-0x0;var _0x51cefe=_0xe22b[_0x109fd8];return _0x51cefe;};'use strict';var multer=require(_0xbe22('0x0'));var util=require('util');var path=require(_0xbe22('0x1'));var timeout=require('connect-timeout');var express=require(_0xbe22('0x2'));var router=express[_0xbe22('0x3')]();var fs_extra=require(_0xbe22('0x4'));var auth=require(_0xbe22('0x5'));var interaction=require('../../components/interaction/service');var config=require(_0xbe22('0x6'));var controller=require(_0xbe22('0x7'));router[_0xbe22('0x8')]('/',auth[_0xbe22('0x9')](),controller['index']);router[_0xbe22('0x8')](_0xbe22('0xa'),auth['isAuthenticated'](),controller[_0xbe22('0xb')]);router['get'](_0xbe22('0xc'),auth[_0xbe22('0x9')](),controller[_0xbe22('0xd')]);router[_0xbe22('0x8')]('/:id/fields',auth[_0xbe22('0x9')](),controller['getFields']);router[_0xbe22('0xe')]('/',auth[_0xbe22('0x9')](),controller[_0xbe22('0xf')]);router[_0xbe22('0xe')](_0xbe22('0xc'),auth[_0xbe22('0x9')](),controller[_0xbe22('0x10')]);router[_0xbe22('0x11')](_0xbe22('0xa'),auth[_0xbe22('0x9')](),controller[_0xbe22('0x12')]);router[_0xbe22('0x13')]('/:id',auth[_0xbe22('0x9')](),controller[_0xbe22('0x14')]);module['exports']=router; \ No newline at end of file +var _0x44d9=['isAuthenticated','index','get','/:id','show','/:id/configurations','getConfigurations','/:id/fields','getFields','create','post','put','update','destroy','exports','multer','util','path','connect-timeout','express','../../components/interaction/service','../../config/environment','./intDynamics365Account.controller'];(function(_0x5e979d,_0x142d2a){var _0x20391a=function(_0x41604b){while(--_0x41604b){_0x5e979d['push'](_0x5e979d['shift']());}};_0x20391a(++_0x142d2a);}(_0x44d9,0xc7));var _0x944d=function(_0x9abfaf,_0x58f074){_0x9abfaf=_0x9abfaf-0x0;var _0x355a8f=_0x44d9[_0x9abfaf];return _0x355a8f;};'use strict';var multer=require(_0x944d('0x0'));var util=require(_0x944d('0x1'));var path=require(_0x944d('0x2'));var timeout=require(_0x944d('0x3'));var express=require(_0x944d('0x4'));var router=express['Router']();var fs_extra=require('fs-extra');var auth=require('../../components/auth/service');var interaction=require(_0x944d('0x5'));var config=require(_0x944d('0x6'));var controller=require(_0x944d('0x7'));router['get']('/',auth[_0x944d('0x8')](),controller[_0x944d('0x9')]);router[_0x944d('0xa')](_0x944d('0xb'),auth[_0x944d('0x8')](),controller[_0x944d('0xc')]);router[_0x944d('0xa')](_0x944d('0xd'),auth[_0x944d('0x8')](),controller[_0x944d('0xe')]);router['get'](_0x944d('0xf'),auth[_0x944d('0x8')](),controller[_0x944d('0x10')]);router['post']('/',auth[_0x944d('0x8')](),controller[_0x944d('0x11')]);router[_0x944d('0x12')](_0x944d('0xd'),auth[_0x944d('0x8')](),controller['addConfiguration']);router[_0x944d('0x13')](_0x944d('0xb'),auth['isAuthenticated'](),controller[_0x944d('0x14')]);router['delete'](_0x944d('0xb'),auth[_0x944d('0x8')](),controller[_0x944d('0x15')]);module[_0x944d('0x16')]=router; \ No newline at end of file diff --git a/server/api/intDynamics365Account/intDynamics365Account.attributes.js b/server/api/intDynamics365Account/intDynamics365Account.attributes.js index fc898f7..dcf25ef 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 _0x891b=['BOOLEAN','STRING'];(function(_0x282a2c,_0xd5b81e){var _0x4d5a12=function(_0x551cec){while(--_0x551cec){_0x282a2c['push'](_0x282a2c['shift']());}};_0x4d5a12(++_0xd5b81e);}(_0x891b,0xc5));var _0xb891=function(_0x14add3,_0x13ce8d){_0x14add3=_0x14add3-0x0;var _0x4a174f=_0x891b[_0x14add3];return _0x4a174f;};'use strict';var Sequelize=require('sequelize');module['exports']={'name':{'type':Sequelize[_0xb891('0x0')]},'username':{'type':Sequelize[_0xb891('0x0')]},'password':{'type':Sequelize['STRING']},'remoteUri':{'type':Sequelize[_0xb891('0x0')]},'tenantId':{'type':Sequelize[_0xb891('0x0')]},'clientId':{'type':Sequelize[_0xb891('0x0')]},'clientSecret':{'type':Sequelize[_0xb891('0x0')]},'serverUrl':{'type':Sequelize['STRING'],'allowNull':![]},'description':{'type':Sequelize[_0xb891('0x0')]},'modernAuthentication':{'type':Sequelize[_0xb891('0x1')],'defaultValue':!![]}}; \ No newline at end of file +var _0xa63f=['sequelize','exports','STRING'];(function(_0x4b362b,_0xb811a){var _0x5cde92=function(_0x143f21){while(--_0x143f21){_0x4b362b['push'](_0x4b362b['shift']());}};_0x5cde92(++_0xb811a);}(_0xa63f,0x1b6));var _0xfa63=function(_0x4d21ff,_0x19d202){_0x4d21ff=_0x4d21ff-0x0;var _0x22b554=_0xa63f[_0x4d21ff];return _0x22b554;};'use strict';var Sequelize=require(_0xfa63('0x0'));module[_0xfa63('0x1')]={'name':{'type':Sequelize[_0xfa63('0x2')]},'username':{'type':Sequelize[_0xfa63('0x2')]},'password':{'type':Sequelize[_0xfa63('0x2')]},'remoteUri':{'type':Sequelize[_0xfa63('0x2')]},'tenantId':{'type':Sequelize[_0xfa63('0x2')]},'clientId':{'type':Sequelize[_0xfa63('0x2')]},'clientSecret':{'type':Sequelize[_0xfa63('0x2')]},'serverUrl':{'type':Sequelize[_0xfa63('0x2')],'allowNull':![]},'description':{'type':Sequelize['STRING']},'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 c81b8cc..d2438c4 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 _0x0854=['DoubleAttributeMetadata','BigIntAttributeMetadata','IntegerAttributeMetadata','MemoAttributeMetadata','DateTimeAttributeMetadata','StatusAttributeMetadata','EntityNameAttributeMetadata','DecimalAttributeMetadata','statusCode','Wrong\x20credentials','GET',')/Microsoft.Dynamics.CRM.PicklistAttributeMetadata?','$select=DisplayName,LogicalName&$expand=OptionSet($select=Options)','Options','UserLocalizedLabel','Value','DisplayName','Label',')/Microsoft.Dynamics.CRM.BooleanAttributeMetadata?$select=DisplayName,LogicalName&$expand=OptionSet($select=FalseOption,\x20TrueOption)','4.0','OptionSet','TrueOption','true','FalseOption',')/Attributes(',')/Microsoft.Dynamics.CRM.','request-promise','lodash','../../components/parsers/qs','api','../../mysqldb','../../components/integrations/configuration','status','json','offset','undefined','count','set','Content-Range','update','then','destroy','end','error','stack','name','send','map','Dynamics365Account','rawAttributes','fieldName','key','keys','query','filters','intersection','attributes','fields','length','hasOwnProperty','nolimit','limit','order','sort','pick','filter','where','merge','VIRTUAL','options','includeAll','include','findAll','rows','catch','params','model','find','create','body','getConfigurations','findOne','Dynamics365Configuration','addConfiguration','Subjects','getSubjects','channel','type','Descriptions','Dynamics365Field','slice','substring','lastIndexOf','format','%s/api/data/v9.0/','ticketType','Incident','PhoneCall','title','description','customerid','ownerid','caseorigincode','subject','phonenumber','regardingobjectid','phonecall_activity_parties','accountidname','accountidyominame','billedserviceunits','contactidname','contactidyominame','contractdetailidname','contractidname','createdbyexternalpartyname','createdbyyominame','createdon','createdonbehalfbyyominame','customeridname','customeridtype','emailaddress','entityimage_url','escalatedon','firstresponsebykpiidname','followupby','kbarticleidname','lastonholdtime','masteridname','modifiedbyexternalpartyname','modifiedbyexternalpartyyominame','modifiedbyname','modifiedbyyominame','modifiedonbehalfbyyominame','msdyn_incidenttypename','msdyn_iotalertname','numberofchildincidents','onholdtime','overriddencreatedon','owneridname','owneridtype','owneridyominame','parentcaseidname','primarycontactidname','primarycontactidyominame','prioritycodename','productidname','productserialnumber','resolveby','resolvebykpiidname','responseby','responsiblecontactidname','slainvokedidname','socialprofileidname','statecode','subjectidname','ticketnumber','transactioncurrencyidname','traversedpath','utcconversiontimezonecode','versionnumber','concat','username','remoteUri','tenantId','clientId','clientSecret','modernAuthentication','CloudProvider','data5','data7','access_token','/oauth2/token','password','EntityDefinitions?$select=DisplayName,EntitySetName&$filter=SchemaName\x20eq\x20\x27','value','EntityDefinitions(',')?$select=LogicalName&$expand=Attributes($select=LogicalName)','Bearer\x20','Attributes','remove','includes','LogicalName','forEach','@odata.type','PicklistAttributeMetadata','push','MetadataId','all','isNil','BooleanAttributeMetadata','StringAttributeMetadata'];(function(_0x3f46f4,_0x23c501){var _0x2a2763=function(_0x241ef9){while(--_0x241ef9){_0x3f46f4['push'](_0x3f46f4['shift']());}};_0x2a2763(++_0x23c501);}(_0x0854,0xd9));var _0x4085=function(_0x14add3,_0x13ce8d){_0x14add3=_0x14add3-0x0;var _0x4a174f=_0x0854[_0x14add3];return _0x4a174f;};'use strict';var rp=require(_0x4085('0x0'));var util=require('util');var _=require(_0x4085('0x1'));var qs=require(_0x4085('0x2'));var logger=require('../../config/logger')(_0x4085('0x3'));var db=require(_0x4085('0x4'))['db'];var integrations=require(_0x4085('0x5'));function respondWithResult(_0x1018d7,_0x542598){_0x542598=_0x542598||0xc8;return function(_0x354d94){if(_0x354d94){return _0x1018d7[_0x4085('0x6')](_0x542598)[_0x4085('0x7')](_0x354d94);}};}function respondWithFilteredResult(_0x38e5f7,_0x2b3306){return function(_0x3e5db5){if(_0x3e5db5){var _0x511f52=typeof _0x2b3306[_0x4085('0x8')]==='undefined'&&typeof _0x2b3306['limit']===_0x4085('0x9');var _0x23c35f=_0x3e5db5[_0x4085('0xa')];var _0x172119=_0x511f52?0x0:_0x2b3306[_0x4085('0x8')];var _0x1d9ea8=_0x511f52?_0x3e5db5[_0x4085('0xa')]:_0x2b3306[_0x4085('0x8')]+_0x2b3306['limit'];var _0x253c38;if(_0x1d9ea8>=_0x23c35f){_0x1d9ea8=_0x23c35f;_0x253c38=0xc8;}else{_0x253c38=0xce;}_0x38e5f7[_0x4085('0x6')](_0x253c38);return _0x38e5f7[_0x4085('0xb')](_0x4085('0xc'),_0x172119+'-'+_0x1d9ea8+'/'+_0x23c35f)['json'](_0x3e5db5);}return null;};}function saveUpdates(_0x3d5613){return function(_0x8a0a05){if(_0x8a0a05){return _0x8a0a05[_0x4085('0xd')](_0x3d5613)[_0x4085('0xe')](function(_0x595a1f){return _0x595a1f;});}return null;};}function removeEntity(_0x19d460){return function(_0x176ed5){if(_0x176ed5){return _0x176ed5[_0x4085('0xf')]()[_0x4085('0xe')](function(){_0x19d460['status'](0xcc)[_0x4085('0x10')]();});}};}function handleEntityNotFound(_0x150a97){return function(_0x856ff8){if(!_0x856ff8){_0x150a97['sendStatus'](0x194);}return _0x856ff8;};}function handleError(_0x16a43c,_0x29b2fb){_0x29b2fb=_0x29b2fb||0x1f4;return function(_0x3b036f){logger[_0x4085('0x11')](_0x3b036f[_0x4085('0x12')]);if(_0x3b036f[_0x4085('0x13')]){delete _0x3b036f[_0x4085('0x13')];}_0x16a43c[_0x4085('0x6')](_0x29b2fb)[_0x4085('0x14')](_0x3b036f);};}exports['index']=function(_0x3b4602,_0x1a16c8){var _0x3b4c24={},_0x141d28={},_0x489afb={'count':0x0,'rows':[]};var _0x269edf=_[_0x4085('0x15')](db[_0x4085('0x16')][_0x4085('0x17')],function(_0x80fa2){return{'name':_0x80fa2[_0x4085('0x18')],'type':_0x80fa2['type'][_0x4085('0x19')]};});_0x141d28['model']=_['map'](_0x269edf,_0x4085('0x13'));_0x141d28['query']=_[_0x4085('0x1a')](_0x3b4602[_0x4085('0x1b')]);_0x141d28[_0x4085('0x1c')]=_[_0x4085('0x1d')](_0x141d28['model'],_0x141d28['query']);_0x3b4c24[_0x4085('0x1e')]=_['intersection'](_0x141d28['model'],qs[_0x4085('0x1f')](_0x3b4602['query'][_0x4085('0x1f')]));_0x3b4c24[_0x4085('0x1e')]=_0x3b4c24[_0x4085('0x1e')][_0x4085('0x20')]?_0x3b4c24[_0x4085('0x1e')]:_0x141d28['model'];if(!_0x3b4602[_0x4085('0x1b')][_0x4085('0x21')](_0x4085('0x22'))){_0x3b4c24[_0x4085('0x23')]=qs['limit'](_0x3b4602[_0x4085('0x1b')]['limit']);_0x3b4c24[_0x4085('0x8')]=qs[_0x4085('0x8')](_0x3b4602[_0x4085('0x1b')][_0x4085('0x8')]);}_0x3b4c24[_0x4085('0x24')]=qs[_0x4085('0x25')](_0x3b4602[_0x4085('0x1b')][_0x4085('0x25')]);_0x3b4c24['where']=qs['filters'](_[_0x4085('0x26')](_0x3b4602['query'],_0x141d28[_0x4085('0x1c')]),_0x269edf);if(_0x3b4602[_0x4085('0x1b')][_0x4085('0x27')]){_0x3b4c24[_0x4085('0x28')]=_[_0x4085('0x29')](_0x3b4c24['where'],{'$or':_[_0x4085('0x15')](_0x269edf,function(_0x2388dc){if(_0x2388dc['type']!==_0x4085('0x2a')){var _0x409cc={};_0x409cc[_0x2388dc[_0x4085('0x13')]]={'$like':'%'+_0x3b4602[_0x4085('0x1b')]['filter']+'%'};return _0x409cc;}})});}_0x3b4c24=_[_0x4085('0x29')]({},_0x3b4c24,_0x3b4602[_0x4085('0x2b')]);var _0x43474e={'where':_0x3b4c24['where']};return db[_0x4085('0x16')][_0x4085('0xa')](_0x43474e)[_0x4085('0xe')](function(_0x284979){_0x489afb['count']=_0x284979;if(_0x3b4602['query'][_0x4085('0x2c')]){_0x3b4c24[_0x4085('0x2d')]=[{'all':!![]}];}return db[_0x4085('0x16')][_0x4085('0x2e')](_0x3b4c24);})[_0x4085('0xe')](function(_0x3df18b){_0x489afb[_0x4085('0x2f')]=_0x3df18b;return _0x489afb;})[_0x4085('0xe')](respondWithFilteredResult(_0x1a16c8,_0x3b4c24))[_0x4085('0x30')](handleError(_0x1a16c8,null));};exports['show']=function(_0xefad33,_0xdb19b3){var _0xa5db1c={'raw':![],'where':{'id':_0xefad33[_0x4085('0x31')]['id']}},_0x6e1807={};_0x6e1807['model']=_['keys'](db[_0x4085('0x16')][_0x4085('0x17')]);_0x6e1807[_0x4085('0x1b')]=_[_0x4085('0x1a')](_0xefad33[_0x4085('0x1b')]);_0x6e1807[_0x4085('0x1c')]=_[_0x4085('0x1d')](_0x6e1807['model'],_0x6e1807[_0x4085('0x1b')]);_0xa5db1c[_0x4085('0x1e')]=_[_0x4085('0x1d')](_0x6e1807[_0x4085('0x32')],qs['fields'](_0xefad33[_0x4085('0x1b')]['fields']));_0xa5db1c[_0x4085('0x1e')]=_0xa5db1c[_0x4085('0x1e')][_0x4085('0x20')]?_0xa5db1c[_0x4085('0x1e')]:_0x6e1807[_0x4085('0x32')];if(_0xefad33[_0x4085('0x1b')]['includeAll']){_0xa5db1c[_0x4085('0x2d')]=[{'all':!![]}];}_0xa5db1c=_[_0x4085('0x29')]({},_0xa5db1c,_0xefad33[_0x4085('0x2b')]);return db[_0x4085('0x16')][_0x4085('0x33')](_0xa5db1c)[_0x4085('0xe')](handleEntityNotFound(_0xdb19b3,null))[_0x4085('0xe')](respondWithResult(_0xdb19b3,null))[_0x4085('0x30')](handleError(_0xdb19b3,null));};exports[_0x4085('0x34')]=function(_0x35aa19,_0x3f1f2c){return db[_0x4085('0x16')][_0x4085('0x34')](_0x35aa19[_0x4085('0x35')],{})[_0x4085('0xe')](respondWithResult(_0x3f1f2c,0xc9))[_0x4085('0x30')](handleError(_0x3f1f2c,null));};exports[_0x4085('0xd')]=function(_0x1e31d5,_0x2f151b){if(_0x1e31d5[_0x4085('0x35')]['id']){delete _0x1e31d5['body']['id'];}return db[_0x4085('0x16')]['find']({'where':{'id':_0x1e31d5[_0x4085('0x31')]['id']}})[_0x4085('0xe')](handleEntityNotFound(_0x2f151b,null))['then'](saveUpdates(_0x1e31d5[_0x4085('0x35')],null))['then'](respondWithResult(_0x2f151b,null))[_0x4085('0x30')](handleError(_0x2f151b,null));};exports[_0x4085('0xf')]=function(_0x2db3e6,_0x48f9c8){return db['Dynamics365Account'][_0x4085('0x33')]({'where':{'id':_0x2db3e6[_0x4085('0x31')]['id']}})[_0x4085('0xe')](handleEntityNotFound(_0x48f9c8,null))[_0x4085('0xe')](removeEntity(_0x48f9c8,null))[_0x4085('0x30')](handleError(_0x48f9c8,null));};exports[_0x4085('0x36')]=function(_0x47abdd,_0x140d11){var _0x93a264={};var _0x4cd062={};var _0x305b06;var _0x2bec83;return db[_0x4085('0x16')][_0x4085('0x37')]({'where':{'id':_0x47abdd[_0x4085('0x31')]['id']}})[_0x4085('0xe')](handleEntityNotFound(_0x140d11,null))['then'](function(_0xaf27f9){if(_0xaf27f9){_0x305b06=_0xaf27f9;_0x4cd062[_0x4085('0x32')]=_['keys'](db[_0x4085('0x38')][_0x4085('0x17')]);_0x4cd062[_0x4085('0x1b')]=_[_0x4085('0x1a')](_0x47abdd['query']);_0x4cd062['filters']=_[_0x4085('0x1d')](_0x4cd062[_0x4085('0x32')],_0x4cd062[_0x4085('0x1b')]);_0x93a264[_0x4085('0x1e')]=_[_0x4085('0x1d')](_0x4cd062['model'],qs[_0x4085('0x1f')](_0x47abdd[_0x4085('0x1b')][_0x4085('0x1f')]));_0x93a264[_0x4085('0x1e')]=_0x93a264['attributes'][_0x4085('0x20')]?_0x93a264[_0x4085('0x1e')]:_0x4cd062['model'];_0x93a264['order']=qs[_0x4085('0x25')](_0x47abdd[_0x4085('0x1b')][_0x4085('0x25')]);_0x93a264['where']=qs[_0x4085('0x1c')](_['pick'](_0x47abdd[_0x4085('0x1b')],_0x4cd062[_0x4085('0x1c')]));if(_0x47abdd[_0x4085('0x1b')]['filter']){_0x93a264['where']=_[_0x4085('0x29')](_0x93a264[_0x4085('0x28')],{'$or':_[_0x4085('0x15')](_0x93a264['attributes'],function(_0x57760f){var _0x32206c={};_0x32206c[_0x57760f]={'$like':'%'+_0x47abdd['query']['filter']+'%'};return _0x32206c;})});}_0x93a264=_['merge']({},_0x93a264,_0x47abdd[_0x4085('0x2b')]);return _0x305b06['getConfigurations'](_0x93a264);}})[_0x4085('0xe')](function(_0xa875c7){if(_0xa875c7){_0x2bec83=_0xa875c7['length'];if(!_0x47abdd[_0x4085('0x1b')]['hasOwnProperty'](_0x4085('0x22'))){_0x93a264[_0x4085('0x23')]=qs['limit'](_0x47abdd[_0x4085('0x1b')][_0x4085('0x23')]);_0x93a264[_0x4085('0x8')]=qs[_0x4085('0x8')](_0x47abdd[_0x4085('0x1b')][_0x4085('0x8')]);}return _0x305b06[_0x4085('0x36')](_0x93a264);}})[_0x4085('0xe')](function(_0x5914c6){if(_0x5914c6){return _0x5914c6?{'count':_0x2bec83,'rows':_0x5914c6}:null;}})[_0x4085('0xe')](respondWithResult(_0x140d11,null))[_0x4085('0x30')](handleError(_0x140d11,null));};exports[_0x4085('0x39')]=function(_0x409add,_0x38b45a){if(_0x409add['body']['id']){delete _0x409add[_0x4085('0x35')]['id'];}return db[_0x4085('0x16')][_0x4085('0x37')]({'where':{'id':_0x409add[_0x4085('0x31')]['id']}})[_0x4085('0xe')](handleEntityNotFound(_0x38b45a,null))[_0x4085('0xe')](function(_0x1c19b8){if(_0x1c19b8){_0x409add[_0x4085('0x35')]['AccountId']=_0x1c19b8['id'];_0x409add[_0x4085('0x35')][_0x4085('0x3a')]=integrations[_0x4085('0x3b')](_0x409add[_0x4085('0x35')][_0x4085('0x3c')],_0x409add[_0x4085('0x35')][_0x4085('0x3d')]);_0x409add['body'][_0x4085('0x3e')]=integrations['getDescriptions'](_0x409add[_0x4085('0x35')][_0x4085('0x3c')],_0x409add[_0x4085('0x35')][_0x4085('0x3d')]);return db[_0x4085('0x38')]['create'](_0x409add[_0x4085('0x35')],{'include':[{'model':db[_0x4085('0x3f')],'as':'Subjects'},{'model':db[_0x4085('0x3f')],'as':_0x4085('0x3e')}]});}return null;})[_0x4085('0xe')](respondWithResult(_0x38b45a,null))['catch'](handleError(_0x38b45a,null));};function sanitizeRemoteUri(_0x1d05cc){var _0x185b52=_0x1d05cc[_0x4085('0x40')](-0x1);if(_0x185b52==='/')return _0x1d05cc[_0x4085('0x41')](0x0,_0x1d05cc[_0x4085('0x42')](_0x185b52));return _0x1d05cc;}function getWebApiUrl(_0x65743e){return util[_0x4085('0x43')](_0x4085('0x44'),_0x65743e);}exports['getFields']=function(_0x220738,_0x4abd4d){var _0x22e9a1=_0x220738['query'][_0x4085('0x45')];var _0x1b94e2=_0x22e9a1==='incident'?_0x4085('0x46'):_0x4085('0x47');var _0x1750a0='';var _0x25fb95='';var _0x2752e8='';var _0x3965a9='';var _0xa8e46a='';var _0x297f7e='';var _0x225876='';var _0x3d044b='';var _0x2b15f2=[_0x4085('0x48'),_0x4085('0x49'),_0x4085('0x4a'),_0x4085('0x4b'),_0x4085('0x4c'),_0x4085('0x4d'),_0x4085('0x4e'),_0x4085('0x4f'),'directioncode',_0x4085('0x50')];var _0x315a24=[_0x4085('0x51'),_0x4085('0x52'),'actualserviceunits',_0x4085('0x53'),_0x4085('0x54'),_0x4085('0x55'),_0x4085('0x56'),_0x4085('0x57'),_0x4085('0x58'),'createdbyexternalpartyyominame','createdbyname',_0x4085('0x59'),_0x4085('0x5a'),'createdonbehalfbyname',_0x4085('0x5b'),_0x4085('0x5c'),_0x4085('0x5d'),'customeridyominame',_0x4085('0x5e'),'entitlementidname','entityimage_timestamp',_0x4085('0x5f'),_0x4085('0x60'),'exchangerate',_0x4085('0x61'),_0x4085('0x62'),'importsequencenumber','influencescore',_0x4085('0x63'),_0x4085('0x64'),_0x4085('0x65'),_0x4085('0x66'),_0x4085('0x67'),_0x4085('0x68'),_0x4085('0x69'),'modifiedon','modifiedonbehalfbyname',_0x4085('0x6a'),_0x4085('0x6b'),_0x4085('0x6c'),_0x4085('0x6d'),_0x4085('0x6e'),_0x4085('0x6f'),_0x4085('0x70'),_0x4085('0x71'),_0x4085('0x72'),_0x4085('0x73'),_0x4085('0x74'),_0x4085('0x75'),_0x4085('0x76'),_0x4085('0x77'),_0x4085('0x78'),_0x4085('0x79'),_0x4085('0x7a'),_0x4085('0x7b'),_0x4085('0x7c'),'responsiblecontactidyominame','sentimentvalue',_0x4085('0x7d'),'slaname',_0x4085('0x7e'),_0x4085('0x7f'),'statuscode',_0x4085('0x80'),_0x4085('0x81'),'timezoneruleversionnumber',_0x4085('0x82'),_0x4085('0x83'),_0x4085('0x84'),_0x4085('0x85')];var _0x29cf6f=_0x2b15f2[_0x4085('0x86')](_0x315a24);return db[_0x4085('0x16')]['findOne']({'where':{'id':_0x220738['params']['id']},'attributes':['id',_0x4085('0x87'),'password',_0x4085('0x88'),_0x4085('0x89'),_0x4085('0x8a'),_0x4085('0x8b'),_0x4085('0x8c')],'include':[{'model':db[_0x4085('0x8d')],'as':_0x4085('0x8d'),'attributes':['id',_0x4085('0x8e'),_0x4085('0x8f')]}]})[_0x4085('0xe')](handleEntityNotFound(_0x4abd4d,null))[_0x4085('0xe')](function(_0x775a8d){if(_0x775a8d){if(_0x775a8d[_0x4085('0x8c')]){_0x775a8d[_0x4085('0x90')]=_0x775a8d[_0x4085('0x8d')][_0x4085('0x8e')];_0x3d044b=sanitizeRemoteUri(_0x775a8d[_0x4085('0x8d')][_0x4085('0x8f')]);_0x225876=getWebApiUrl(_0x3d044b);return _0x775a8d;}_0x3d044b=sanitizeRemoteUri(_0x775a8d['remoteUri']);_0x225876=getWebApiUrl(_0x3d044b);var _0x3c8ca4={'method':'POST','uri':'https://login.microsoftonline.com/'+_0x775a8d[_0x4085('0x89')]+_0x4085('0x91'),'form':{'client_id':_0x775a8d[_0x4085('0x8a')],'resource':_0x3d044b,'username':_0x775a8d['username'],'password':_0x775a8d[_0x4085('0x92')],'grant_type':_0x4085('0x92'),'client_secret':_0x775a8d[_0x4085('0x8b')]},'json':!![]};return rp(_0x3c8ca4);}})[_0x4085('0xe')](function(_0xdb322c){_0x297f7e=_0xdb322c[_0x4085('0x90')];var _0x2a8f5e={'method':'GET','uri':encodeURI(_0x225876+_0x4085('0x93')+_0x1b94e2+'\x27'),'headers':{'Authorization':'Bearer\x20'+_0x297f7e,'If-None-Match':null,'OData-Version':'4.0'},'json':!![]};return rp(_0x2a8f5e);})[_0x4085('0xe')](function(_0x5a707c){var _0x585f68=_0x5a707c[_0x4085('0x94')][0x0];var _0x1ac88c=_0x585f68['MetadataId'];var _0x1688a8={'method':'GET','uri':_0x225876+_0x4085('0x95')+_0x1ac88c+_0x4085('0x96'),'headers':{'Authorization':_0x4085('0x97')+_0x297f7e,'If-None-Match':null,'OData-Version':'4.0'},'json':!![]};return rp(_0x1688a8);})['then'](function(_0x40a7cf){_0x1750a0=_0x40a7cf;_0x25fb95=_0x1750a0[_0x4085('0x98')];_0x25fb95=_[_0x4085('0x99')](_0x25fb95,function(_0x375765){return!_0x29cf6f[_0x4085('0x9a')](_0x375765[_0x4085('0x9b')]);});var _0x103996=[];var _0x5ca9b2=[];_0x25fb95[_0x4085('0x9c')](function(_0x4d5845){if(_0x4d5845[_0x4085('0x9d')]){var _0x2b2b8b=_0x4d5845[_0x4085('0x9d')]['substring'](_0x4d5845[_0x4085('0x9d')][_0x4085('0x42')]('.')+0x1);if(_0x2b2b8b===_0x4085('0x9e')){_0x103996[_0x4085('0x9f')](getSelectList(_0x225876,_0x22e9a1,_0x5ca9b2,_0x1750a0[_0x4085('0xa0')],_0x4d5845[_0x4085('0xa0')],_0x297f7e));}}});return Promise[_0x4085('0xa1')](_0x103996);})[_0x4085('0xe')](function(_0x1da339){_0x2752e8=_0x1da339[0x0];var _0x1c50ae=[];var _0x1f0904=[];_0x25fb95[_0x4085('0x9c')](function(_0x47077f){if(!_[_0x4085('0xa2')](_0x47077f['@odata.type'])){var _0x2d2130=_0x47077f[_0x4085('0x9d')][_0x4085('0x41')](_0x47077f[_0x4085('0x9d')]['lastIndexOf']('.')+0x1);if(_0x2d2130===_0x4085('0xa3')){_0x1c50ae['push'](getBooleanList(_0x225876,_0x22e9a1,_0x1f0904,_0x1750a0[_0x4085('0xa0')],_0x47077f[_0x4085('0xa0')],_0x297f7e));}}});return Promise[_0x4085('0xa1')](_0x1c50ae);})[_0x4085('0xe')](function(_0x2bd4d2){_0x3965a9=_0x2bd4d2[0x0];var _0x37a4c0=[];var _0x2a11fd=[];_0x25fb95[_0x4085('0x9c')](function(_0x295262){if(_0x295262[_0x4085('0x9d')]){var _0x42b323=_0x295262[_0x4085('0x9d')]['substring'](_0x295262[_0x4085('0x9d')]['lastIndexOf']('.')+0x1);if(_0x42b323===_0x4085('0xa4')||_0x42b323===_0x4085('0xa5')||_0x42b323===_0x4085('0xa6')||_0x42b323===_0x4085('0xa7')||_0x42b323===_0x4085('0xa8')||_0x42b323===_0x4085('0xa9')||_0x42b323===_0x4085('0xaa')||_0x42b323===_0x4085('0xab')||_0x42b323==='StateAttributeMetadata'||_0x42b323===_0x4085('0xac')){_0x37a4c0[_0x4085('0x9f')](getInputList(_0x225876,_0x22e9a1,_0x42b323,_0x2a11fd,_0x1750a0['MetadataId'],_0x295262[_0x4085('0xa0')],_0x297f7e));}}});return Promise[_0x4085('0xa1')](_0x37a4c0);})['then'](function(_0x59a911){_0xa8e46a=_0x59a911[0x0];var _0x3d8c88=_0x2752e8[_0x4085('0x86')](_0x3965a9)[_0x4085('0x86')](_0xa8e46a);var _0x5b404b={'count':_0x3d8c88[_0x4085('0x20')],'rows':_0x3d8c88};return _0x5b404b;})[_0x4085('0xe')](respondWithResult(_0x4abd4d,null))[_0x4085('0x30')](function(_0x89c030){var _0x3f709f=_0x220738['query']['test']?0x1f4:_0x89c030[_0x4085('0xad')]||0x1f4;logger['error'](_0x89c030[_0x4085('0x12')]);delete _0x89c030[_0x4085('0x13')];if(_0x3f709f===0x191){_0x3f709f=0x190;}_0x4abd4d['status'](_0x3f709f)['send'](_0x220738[_0x4085('0x1b')]['test']?{'message':_0x4085('0xae'),'statusCode':_0x89c030[_0x4085('0xad')]}:_0x89c030);});};function getSelectList(_0x50d032,_0x4a81af,_0x15ffb5,_0x239bd2,_0x41db3c,_0x5e265b){var _0xdc2d0f={'method':_0x4085('0xaf'),'uri':_0x50d032+'EntityDefinitions('+_0x239bd2+')/Attributes('+_0x41db3c+_0x4085('0xb0')+_0x4085('0xb1'),'headers':{'Authorization':_0x4085('0x97')+_0x5e265b,'If-None-Match':null,'OData-Version':'4.0'},'json':!![]};return rp(_0xdc2d0f)['then'](function(_0x1e1d84){var _0x4e94e6=[];var _0x30316e=_0x1e1d84['OptionSet'][_0x4085('0xb2')];_0x30316e[_0x4085('0x9c')](function(_0xf444c){_0x4e94e6[_0x4085('0x9f')]({'name':_0xf444c['Label'][_0x4085('0xb3')]['Label'],'value':String(_0xf444c[_0x4085('0xb4')])});});var _0x10d093={'id':_0x4a81af+'_'+_0x1e1d84[_0x4085('0x9b')],'name':_0x1e1d84[_0x4085('0xb5')][_0x4085('0xb3')][_0x4085('0xb6')],'custom':![],'options':_0x4e94e6};_0x15ffb5[_0x4085('0x9f')](_0x10d093);return _0x15ffb5;});}function getBooleanList(_0x496be5,_0x7c020a,_0x17cfb7,_0x326a4b,_0x5a739b,_0x1a3333){var _0x56c64d={'method':_0x4085('0xaf'),'uri':_0x496be5+'EntityDefinitions('+_0x326a4b+')/Attributes('+_0x5a739b+_0x4085('0xb7'),'headers':{'Authorization':_0x4085('0x97')+_0x1a3333,'If-None-Match':null,'OData-Version':_0x4085('0xb8')},'json':!![]};return rp(_0x56c64d)[_0x4085('0xe')](function(_0x4b2f66){var _0x443049=[];_0x443049[_0x4085('0x9f')]({'name':_0x4b2f66[_0x4085('0xb9')][_0x4085('0xba')]['Label'][_0x4085('0xb3')][_0x4085('0xb6')],'value':_0x4085('0xbb')},{'name':_0x4b2f66[_0x4085('0xb9')][_0x4085('0xbc')][_0x4085('0xb6')][_0x4085('0xb3')][_0x4085('0xb6')],'value':'false'});var _0x5025d9={'id':_0x7c020a+'_'+_0x4b2f66[_0x4085('0x9b')],'name':_0x4b2f66[_0x4085('0xb5')][_0x4085('0xb3')][_0x4085('0xb6')],'custom':![],'options':_0x443049};_0x17cfb7['push'](_0x5025d9);return _0x17cfb7;});}function getInputList(_0xe8997c,_0x2435b8,_0x26de21,_0x505539,_0x2b4311,_0x2dce9a,_0x399e03){var _0x31b37a={'method':_0x4085('0xaf'),'uri':_0xe8997c+_0x4085('0x95')+_0x2b4311+_0x4085('0xbd')+_0x2dce9a+_0x4085('0xbe')+_0x26de21+'?$select=DisplayName,LogicalName','headers':{'Authorization':'Bearer\x20'+_0x399e03,'If-None-Match':null,'OData-Version':_0x4085('0xb8')},'json':!![]};return rp(_0x31b37a)[_0x4085('0xe')](function(_0x15c13c){var _0x2c5cef={'id':_0x2435b8+'_'+_0x15c13c['LogicalName'],'name':_0x15c13c[_0x4085('0xb5')][_0x4085('0xb3')]?_0x15c13c[_0x4085('0xb5')][_0x4085('0xb3')][_0x4085('0xb6')]:_0x15c13c[_0x4085('0x9b')],'custom':![],'options':[]};_0x505539[_0x4085('0x9f')](_0x2c5cef);return _0x505539;});} \ No newline at end of file +var _0x9a62=['sentimentvalue','slainvokedidname','socialprofileidname','statecode','statuscode','subjectidname','ticketnumber','traversedpath','utcconversiontimezonecode','versionnumber','concat','username','password','remoteUri','tenantId','clientId','clientSecret','CloudProvider','data5','data7','POST','https://login.microsoftonline.com/','/oauth2/token','access_token','GET','EntityDefinitions?$select=DisplayName,EntitySetName&$filter=SchemaName\x20eq\x20\x27','MetadataId','EntityDefinitions(','Bearer\x20','4.0','Attributes','remove','includes','forEach','@odata.type','substring','PicklistAttributeMetadata','isNil','BooleanAttributeMetadata','push','all','StringAttributeMetadata','DoubleAttributeMetadata','BigIntAttributeMetadata','MemoAttributeMetadata','DateTimeAttributeMetadata','StatusAttributeMetadata','EntityNameAttributeMetadata','StateAttributeMetadata','DecimalAttributeMetadata','statusCode','send','test',')/Microsoft.Dynamics.CRM.PicklistAttributeMetadata?','$select=DisplayName,LogicalName&$expand=OptionSet($select=Options)','OptionSet','Options','UserLocalizedLabel','Label','Value','LogicalName',')/Microsoft.Dynamics.CRM.BooleanAttributeMetadata?$select=DisplayName,LogicalName&$expand=OptionSet($select=FalseOption,\x20TrueOption)','TrueOption','true','FalseOption',')/Attributes(',')/Microsoft.Dynamics.CRM.','DisplayName','util','lodash','../../config/logger','api','status','json','offset','undefined','count','then','destroy','end','error','stack','name','index','fieldName','type','key','model','query','keys','filters','intersection','attributes','fields','hasOwnProperty','nolimit','limit','sort','where','pick','filter','merge','map','options','Dynamics365Account','includeAll','include','rows','catch','show','params','length','find','create','update','body','getConfigurations','Dynamics365Configuration','findOne','AccountId','Subjects','getSubjects','getDescriptions','channel','Dynamics365Field','slice','lastIndexOf','%s/api/data/v9.0/','getFields','ticketType','incident','Incident','PhoneCall','title','description','customerid','ownerid','caseorigincode','subject','phonenumber','regardingobjectid','directioncode','phonecall_activity_parties','contactidyominame','contractdetailidname','contractidname','createdbyexternalpartyname','createdbyexternalpartyyominame','createdbyname','createdbyyominame','createdon','createdonbehalfbyname','createdonbehalfbyyominame','customeridyominame','emailaddress','entitlementidname','entityimage_timestamp','entityimage_url','escalatedon','exchangerate','firstresponsebykpiidname','followupby','influencescore','kbarticleidname','lastonholdtime','masteridname','modifiedbyexternalpartyname','modifiedbyexternalpartyyominame','modifiedbyname','modifiedbyyominame','modifiedon','modifiedonbehalfbyname','msdyn_incidenttypename','numberofchildincidents','onholdtime','owneridname','owneridtype','owneridyominame','parentcaseidname','primarycontactidname','primarycontactidyominame','prioritycodename','productserialnumber','resolveby','resolvebykpiidname','responseby','responsiblecontactidname','responsiblecontactidyominame'];(function(_0x497825,_0x4710c0){var _0x268593=function(_0x1a3752){while(--_0x1a3752){_0x497825['push'](_0x497825['shift']());}};_0x268593(++_0x4710c0);}(_0x9a62,0x1bc));var _0x29a6=function(_0x4a9fb1,_0x273043){_0x4a9fb1=_0x4a9fb1-0x0;var _0x348672=_0x9a62[_0x4a9fb1];return _0x348672;};'use strict';var rp=require('request-promise');var util=require(_0x29a6('0x0'));var _=require(_0x29a6('0x1'));var qs=require('../../components/parsers/qs');var logger=require(_0x29a6('0x2'))(_0x29a6('0x3'));var db=require('../../mysqldb')['db'];var integrations=require('../../components/integrations/configuration');function respondWithResult(_0x19b33c,_0x29f220){_0x29f220=_0x29f220||0xc8;return function(_0x92559f){if(_0x92559f){return _0x19b33c[_0x29a6('0x4')](_0x29f220)[_0x29a6('0x5')](_0x92559f);}};}function respondWithFilteredResult(_0x19127c,_0x316d9e){return function(_0x4a1ea8){if(_0x4a1ea8){var _0x5b325a=typeof _0x316d9e[_0x29a6('0x6')]===_0x29a6('0x7')&&typeof _0x316d9e['limit']==='undefined';var _0x437647=_0x4a1ea8[_0x29a6('0x8')];var _0x1de426=_0x5b325a?0x0:_0x316d9e[_0x29a6('0x6')];var _0x15a67a=_0x5b325a?_0x4a1ea8[_0x29a6('0x8')]:_0x316d9e[_0x29a6('0x6')]+_0x316d9e['limit'];var _0x16b480;if(_0x15a67a>=_0x437647){_0x15a67a=_0x437647;_0x16b480=0xc8;}else{_0x16b480=0xce;}_0x19127c[_0x29a6('0x4')](_0x16b480);return _0x19127c['set']('Content-Range',_0x1de426+'-'+_0x15a67a+'/'+_0x437647)['json'](_0x4a1ea8);}return null;};}function saveUpdates(_0x1d78fa){return function(_0x7acc03){if(_0x7acc03){return _0x7acc03['update'](_0x1d78fa)[_0x29a6('0x9')](function(_0x13251a){return _0x13251a;});}return null;};}function removeEntity(_0x535e3a){return function(_0x50c663){if(_0x50c663){return _0x50c663[_0x29a6('0xa')]()[_0x29a6('0x9')](function(){_0x535e3a['status'](0xcc)[_0x29a6('0xb')]();});}};}function handleEntityNotFound(_0x22378a){return function(_0x307dd9){if(!_0x307dd9){_0x22378a['sendStatus'](0x194);}return _0x307dd9;};}function handleError(_0x862659,_0xf9caee){_0xf9caee=_0xf9caee||0x1f4;return function(_0x695718){logger[_0x29a6('0xc')](_0x695718[_0x29a6('0xd')]);if(_0x695718[_0x29a6('0xe')]){delete _0x695718[_0x29a6('0xe')];}_0x862659[_0x29a6('0x4')](_0xf9caee)['send'](_0x695718);};}exports[_0x29a6('0xf')]=function(_0x53587f,_0x371a28){var _0x35bc3b={},_0xdc0ff6={},_0x54590b={'count':0x0,'rows':[]};var _0x45ea4e=_['map'](db['Dynamics365Account']['rawAttributes'],function(_0x152b00){return{'name':_0x152b00[_0x29a6('0x10')],'type':_0x152b00[_0x29a6('0x11')][_0x29a6('0x12')]};});_0xdc0ff6[_0x29a6('0x13')]=_['map'](_0x45ea4e,_0x29a6('0xe'));_0xdc0ff6[_0x29a6('0x14')]=_[_0x29a6('0x15')](_0x53587f[_0x29a6('0x14')]);_0xdc0ff6[_0x29a6('0x16')]=_[_0x29a6('0x17')](_0xdc0ff6[_0x29a6('0x13')],_0xdc0ff6['query']);_0x35bc3b[_0x29a6('0x18')]=_[_0x29a6('0x17')](_0xdc0ff6[_0x29a6('0x13')],qs[_0x29a6('0x19')](_0x53587f[_0x29a6('0x14')][_0x29a6('0x19')]));_0x35bc3b[_0x29a6('0x18')]=_0x35bc3b['attributes']['length']?_0x35bc3b[_0x29a6('0x18')]:_0xdc0ff6[_0x29a6('0x13')];if(!_0x53587f[_0x29a6('0x14')][_0x29a6('0x1a')](_0x29a6('0x1b'))){_0x35bc3b[_0x29a6('0x1c')]=qs['limit'](_0x53587f['query'][_0x29a6('0x1c')]);_0x35bc3b[_0x29a6('0x6')]=qs[_0x29a6('0x6')](_0x53587f[_0x29a6('0x14')][_0x29a6('0x6')]);}_0x35bc3b['order']=qs['sort'](_0x53587f[_0x29a6('0x14')][_0x29a6('0x1d')]);_0x35bc3b[_0x29a6('0x1e')]=qs[_0x29a6('0x16')](_[_0x29a6('0x1f')](_0x53587f[_0x29a6('0x14')],_0xdc0ff6['filters']),_0x45ea4e);if(_0x53587f['query'][_0x29a6('0x20')]){_0x35bc3b[_0x29a6('0x1e')]=_[_0x29a6('0x21')](_0x35bc3b[_0x29a6('0x1e')],{'$or':_[_0x29a6('0x22')](_0x45ea4e,function(_0x1ddc2d){if(_0x1ddc2d[_0x29a6('0x11')]!=='VIRTUAL'){var _0x68ea1d={};_0x68ea1d[_0x1ddc2d[_0x29a6('0xe')]]={'$like':'%'+_0x53587f[_0x29a6('0x14')][_0x29a6('0x20')]+'%'};return _0x68ea1d;}})});}_0x35bc3b=_[_0x29a6('0x21')]({},_0x35bc3b,_0x53587f[_0x29a6('0x23')]);var _0x391a5={'where':_0x35bc3b[_0x29a6('0x1e')]};return db[_0x29a6('0x24')]['count'](_0x391a5)[_0x29a6('0x9')](function(_0x10fc0a){_0x54590b[_0x29a6('0x8')]=_0x10fc0a;if(_0x53587f[_0x29a6('0x14')][_0x29a6('0x25')]){_0x35bc3b[_0x29a6('0x26')]=[{'all':!![]}];}return db[_0x29a6('0x24')]['findAll'](_0x35bc3b);})['then'](function(_0x567919){_0x54590b[_0x29a6('0x27')]=_0x567919;return _0x54590b;})[_0x29a6('0x9')](respondWithFilteredResult(_0x371a28,_0x35bc3b))[_0x29a6('0x28')](handleError(_0x371a28,null));};exports[_0x29a6('0x29')]=function(_0x37b7d4,_0x21569d){var _0x5ba154={'raw':![],'where':{'id':_0x37b7d4[_0x29a6('0x2a')]['id']}},_0x338eda={};_0x338eda['model']=_[_0x29a6('0x15')](db[_0x29a6('0x24')]['rawAttributes']);_0x338eda[_0x29a6('0x14')]=_[_0x29a6('0x15')](_0x37b7d4[_0x29a6('0x14')]);_0x338eda['filters']=_[_0x29a6('0x17')](_0x338eda[_0x29a6('0x13')],_0x338eda[_0x29a6('0x14')]);_0x5ba154['attributes']=_['intersection'](_0x338eda[_0x29a6('0x13')],qs['fields'](_0x37b7d4[_0x29a6('0x14')][_0x29a6('0x19')]));_0x5ba154['attributes']=_0x5ba154[_0x29a6('0x18')][_0x29a6('0x2b')]?_0x5ba154[_0x29a6('0x18')]:_0x338eda[_0x29a6('0x13')];if(_0x37b7d4[_0x29a6('0x14')][_0x29a6('0x25')]){_0x5ba154[_0x29a6('0x26')]=[{'all':!![]}];}_0x5ba154=_[_0x29a6('0x21')]({},_0x5ba154,_0x37b7d4[_0x29a6('0x23')]);return db[_0x29a6('0x24')][_0x29a6('0x2c')](_0x5ba154)[_0x29a6('0x9')](handleEntityNotFound(_0x21569d,null))[_0x29a6('0x9')](respondWithResult(_0x21569d,null))['catch'](handleError(_0x21569d,null));};exports[_0x29a6('0x2d')]=function(_0x3db3d1,_0x369df3){return db['Dynamics365Account'][_0x29a6('0x2d')](_0x3db3d1['body'],{})[_0x29a6('0x9')](respondWithResult(_0x369df3,0xc9))[_0x29a6('0x28')](handleError(_0x369df3,null));};exports[_0x29a6('0x2e')]=function(_0x228e6a,_0x48ad93){if(_0x228e6a[_0x29a6('0x2f')]['id']){delete _0x228e6a[_0x29a6('0x2f')]['id'];}return db[_0x29a6('0x24')]['find']({'where':{'id':_0x228e6a[_0x29a6('0x2a')]['id']}})[_0x29a6('0x9')](handleEntityNotFound(_0x48ad93,null))['then'](saveUpdates(_0x228e6a[_0x29a6('0x2f')],null))[_0x29a6('0x9')](respondWithResult(_0x48ad93,null))[_0x29a6('0x28')](handleError(_0x48ad93,null));};exports[_0x29a6('0xa')]=function(_0x4cb4f0,_0x4a95d){return db[_0x29a6('0x24')][_0x29a6('0x2c')]({'where':{'id':_0x4cb4f0[_0x29a6('0x2a')]['id']}})[_0x29a6('0x9')](handleEntityNotFound(_0x4a95d,null))[_0x29a6('0x9')](removeEntity(_0x4a95d,null))[_0x29a6('0x28')](handleError(_0x4a95d,null));};exports[_0x29a6('0x30')]=function(_0x12c6cc,_0x2db6c3){var _0xed08e7={};var _0x59f9c9={};var _0x4f7a0b;var _0x593412;return db[_0x29a6('0x24')]['findOne']({'where':{'id':_0x12c6cc[_0x29a6('0x2a')]['id']}})['then'](handleEntityNotFound(_0x2db6c3,null))['then'](function(_0x25995e){if(_0x25995e){_0x4f7a0b=_0x25995e;_0x59f9c9['model']=_[_0x29a6('0x15')](db[_0x29a6('0x31')]['rawAttributes']);_0x59f9c9[_0x29a6('0x14')]=_[_0x29a6('0x15')](_0x12c6cc[_0x29a6('0x14')]);_0x59f9c9[_0x29a6('0x16')]=_[_0x29a6('0x17')](_0x59f9c9[_0x29a6('0x13')],_0x59f9c9[_0x29a6('0x14')]);_0xed08e7[_0x29a6('0x18')]=_[_0x29a6('0x17')](_0x59f9c9[_0x29a6('0x13')],qs['fields'](_0x12c6cc[_0x29a6('0x14')][_0x29a6('0x19')]));_0xed08e7[_0x29a6('0x18')]=_0xed08e7[_0x29a6('0x18')]['length']?_0xed08e7[_0x29a6('0x18')]:_0x59f9c9[_0x29a6('0x13')];_0xed08e7['order']=qs['sort'](_0x12c6cc['query'][_0x29a6('0x1d')]);_0xed08e7[_0x29a6('0x1e')]=qs[_0x29a6('0x16')](_[_0x29a6('0x1f')](_0x12c6cc['query'],_0x59f9c9[_0x29a6('0x16')]));if(_0x12c6cc[_0x29a6('0x14')]['filter']){_0xed08e7[_0x29a6('0x1e')]=_[_0x29a6('0x21')](_0xed08e7[_0x29a6('0x1e')],{'$or':_[_0x29a6('0x22')](_0xed08e7[_0x29a6('0x18')],function(_0x3ef825){var _0x573787={};_0x573787[_0x3ef825]={'$like':'%'+_0x12c6cc[_0x29a6('0x14')][_0x29a6('0x20')]+'%'};return _0x573787;})});}_0xed08e7=_['merge']({},_0xed08e7,_0x12c6cc[_0x29a6('0x23')]);return _0x4f7a0b['getConfigurations'](_0xed08e7);}})[_0x29a6('0x9')](function(_0x5d50cc){if(_0x5d50cc){_0x593412=_0x5d50cc[_0x29a6('0x2b')];if(!_0x12c6cc[_0x29a6('0x14')][_0x29a6('0x1a')](_0x29a6('0x1b'))){_0xed08e7['limit']=qs[_0x29a6('0x1c')](_0x12c6cc[_0x29a6('0x14')][_0x29a6('0x1c')]);_0xed08e7['offset']=qs['offset'](_0x12c6cc['query']['offset']);}return _0x4f7a0b['getConfigurations'](_0xed08e7);}})[_0x29a6('0x9')](function(_0x263127){if(_0x263127){return _0x263127?{'count':_0x593412,'rows':_0x263127}:null;}})['then'](respondWithResult(_0x2db6c3,null))[_0x29a6('0x28')](handleError(_0x2db6c3,null));};exports['addConfiguration']=function(_0x7d73f8,_0x29f320){if(_0x7d73f8[_0x29a6('0x2f')]['id']){delete _0x7d73f8[_0x29a6('0x2f')]['id'];}return db[_0x29a6('0x24')][_0x29a6('0x32')]({'where':{'id':_0x7d73f8[_0x29a6('0x2a')]['id']}})[_0x29a6('0x9')](handleEntityNotFound(_0x29f320,null))[_0x29a6('0x9')](function(_0x5c5ea7){if(_0x5c5ea7){_0x7d73f8[_0x29a6('0x2f')][_0x29a6('0x33')]=_0x5c5ea7['id'];_0x7d73f8['body'][_0x29a6('0x34')]=integrations[_0x29a6('0x35')](_0x7d73f8[_0x29a6('0x2f')]['channel'],_0x7d73f8['body'][_0x29a6('0x11')]);_0x7d73f8[_0x29a6('0x2f')]['Descriptions']=integrations[_0x29a6('0x36')](_0x7d73f8['body'][_0x29a6('0x37')],_0x7d73f8['body'][_0x29a6('0x11')]);return db['Dynamics365Configuration']['create'](_0x7d73f8[_0x29a6('0x2f')],{'include':[{'model':db[_0x29a6('0x38')],'as':'Subjects'},{'model':db[_0x29a6('0x38')],'as':'Descriptions'}]});}return null;})[_0x29a6('0x9')](respondWithResult(_0x29f320,null))['catch'](handleError(_0x29f320,null));};function sanitizeRemoteUri(_0x624475){var _0x4dd2d0=_0x624475[_0x29a6('0x39')](-0x1);if(_0x4dd2d0==='/')return _0x624475['substring'](0x0,_0x624475[_0x29a6('0x3a')](_0x4dd2d0));return _0x624475;}function getWebApiUrl(_0xa88651){return util['format'](_0x29a6('0x3b'),_0xa88651);}exports[_0x29a6('0x3c')]=function(_0x41a9e6,_0x2719c7){var _0x437983=_0x41a9e6[_0x29a6('0x14')][_0x29a6('0x3d')];var _0x206557=_0x437983===_0x29a6('0x3e')?_0x29a6('0x3f'):_0x29a6('0x40');var _0x473742='';var _0x45ca85='';var _0x2915f5='';var _0x1c061f='';var _0x7ff955='';var _0xc5e03d='';var _0x6cae93='';var _0x555684='';var _0x6c45d0=[_0x29a6('0x41'),_0x29a6('0x42'),_0x29a6('0x43'),_0x29a6('0x44'),_0x29a6('0x45'),_0x29a6('0x46'),_0x29a6('0x47'),_0x29a6('0x48'),_0x29a6('0x49'),_0x29a6('0x4a')];var _0x437ec6=['accountidname','accountidyominame','actualserviceunits','billedserviceunits','contactidname',_0x29a6('0x4b'),_0x29a6('0x4c'),_0x29a6('0x4d'),_0x29a6('0x4e'),_0x29a6('0x4f'),_0x29a6('0x50'),_0x29a6('0x51'),_0x29a6('0x52'),_0x29a6('0x53'),_0x29a6('0x54'),'customeridname','customeridtype',_0x29a6('0x55'),_0x29a6('0x56'),_0x29a6('0x57'),_0x29a6('0x58'),_0x29a6('0x59'),_0x29a6('0x5a'),_0x29a6('0x5b'),_0x29a6('0x5c'),_0x29a6('0x5d'),'importsequencenumber',_0x29a6('0x5e'),_0x29a6('0x5f'),_0x29a6('0x60'),_0x29a6('0x61'),_0x29a6('0x62'),_0x29a6('0x63'),_0x29a6('0x64'),_0x29a6('0x65'),_0x29a6('0x66'),_0x29a6('0x67'),'modifiedonbehalfbyyominame',_0x29a6('0x68'),'msdyn_iotalertname',_0x29a6('0x69'),_0x29a6('0x6a'),'overriddencreatedon',_0x29a6('0x6b'),_0x29a6('0x6c'),_0x29a6('0x6d'),_0x29a6('0x6e'),_0x29a6('0x6f'),_0x29a6('0x70'),_0x29a6('0x71'),'productidname',_0x29a6('0x72'),_0x29a6('0x73'),_0x29a6('0x74'),_0x29a6('0x75'),_0x29a6('0x76'),_0x29a6('0x77'),_0x29a6('0x78'),_0x29a6('0x79'),'slaname',_0x29a6('0x7a'),_0x29a6('0x7b'),_0x29a6('0x7c'),_0x29a6('0x7d'),_0x29a6('0x7e'),'timezoneruleversionnumber','transactioncurrencyidname',_0x29a6('0x7f'),_0x29a6('0x80'),_0x29a6('0x81')];var _0x1a6254=_0x6c45d0[_0x29a6('0x82')](_0x437ec6);return db['Dynamics365Account']['findOne']({'where':{'id':_0x41a9e6[_0x29a6('0x2a')]['id']},'attributes':['id',_0x29a6('0x83'),_0x29a6('0x84'),_0x29a6('0x85'),_0x29a6('0x86'),_0x29a6('0x87'),_0x29a6('0x88'),'modernAuthentication'],'include':[{'model':db[_0x29a6('0x89')],'as':_0x29a6('0x89'),'attributes':['id',_0x29a6('0x8a'),_0x29a6('0x8b')]}]})['then'](handleEntityNotFound(_0x2719c7,null))['then'](function(_0xff1334){if(_0xff1334){if(_0xff1334['modernAuthentication']){_0xff1334['access_token']=_0xff1334['CloudProvider'][_0x29a6('0x8a')];_0x555684=sanitizeRemoteUri(_0xff1334['CloudProvider'][_0x29a6('0x8b')]);_0x6cae93=getWebApiUrl(_0x555684);return _0xff1334;}_0x555684=sanitizeRemoteUri(_0xff1334[_0x29a6('0x85')]);_0x6cae93=getWebApiUrl(_0x555684);var _0x4a9498={'method':_0x29a6('0x8c'),'uri':_0x29a6('0x8d')+_0xff1334[_0x29a6('0x86')]+_0x29a6('0x8e'),'form':{'client_id':_0xff1334[_0x29a6('0x87')],'resource':_0x555684,'username':_0xff1334[_0x29a6('0x83')],'password':_0xff1334[_0x29a6('0x84')],'grant_type':_0x29a6('0x84'),'client_secret':_0xff1334[_0x29a6('0x88')]},'json':!![]};return rp(_0x4a9498);}})['then'](function(_0x4d11d8){_0xc5e03d=_0x4d11d8[_0x29a6('0x8f')];var _0x2a61a8={'method':_0x29a6('0x90'),'uri':encodeURI(_0x6cae93+_0x29a6('0x91')+_0x206557+'\x27'),'headers':{'Authorization':'Bearer\x20'+_0xc5e03d,'If-None-Match':null,'OData-Version':'4.0'},'json':!![]};return rp(_0x2a61a8);})[_0x29a6('0x9')](function(_0x307042){var _0x59bd46=_0x307042['value'][0x0];var _0x189d57=_0x59bd46[_0x29a6('0x92')];var _0x5ca92c={'method':_0x29a6('0x90'),'uri':_0x6cae93+_0x29a6('0x93')+_0x189d57+')?$select=LogicalName&$expand=Attributes($select=LogicalName)','headers':{'Authorization':_0x29a6('0x94')+_0xc5e03d,'If-None-Match':null,'OData-Version':_0x29a6('0x95')},'json':!![]};return rp(_0x5ca92c);})[_0x29a6('0x9')](function(_0x1ec3ed){_0x473742=_0x1ec3ed;_0x45ca85=_0x473742[_0x29a6('0x96')];_0x45ca85=_[_0x29a6('0x97')](_0x45ca85,function(_0x3cfc5d){return!_0x1a6254[_0x29a6('0x98')](_0x3cfc5d['LogicalName']);});var _0x19f894=[];var _0x375c91=[];_0x45ca85[_0x29a6('0x99')](function(_0x3b7b3d){if(_0x3b7b3d['@odata.type']){var _0x5b3f26=_0x3b7b3d[_0x29a6('0x9a')][_0x29a6('0x9b')](_0x3b7b3d['@odata.type'][_0x29a6('0x3a')]('.')+0x1);if(_0x5b3f26===_0x29a6('0x9c')){_0x19f894['push'](getSelectList(_0x6cae93,_0x437983,_0x375c91,_0x473742[_0x29a6('0x92')],_0x3b7b3d[_0x29a6('0x92')],_0xc5e03d));}}});return Promise['all'](_0x19f894);})['then'](function(_0xeaae8e){_0x2915f5=_0xeaae8e[0x0];var _0x45d5bf=[];var _0x100044=[];_0x45ca85[_0x29a6('0x99')](function(_0x27c59c){if(!_[_0x29a6('0x9d')](_0x27c59c['@odata.type'])){var _0x1dacd2=_0x27c59c['@odata.type'][_0x29a6('0x9b')](_0x27c59c[_0x29a6('0x9a')]['lastIndexOf']('.')+0x1);if(_0x1dacd2===_0x29a6('0x9e')){_0x45d5bf[_0x29a6('0x9f')](getBooleanList(_0x6cae93,_0x437983,_0x100044,_0x473742[_0x29a6('0x92')],_0x27c59c[_0x29a6('0x92')],_0xc5e03d));}}});return Promise[_0x29a6('0xa0')](_0x45d5bf);})[_0x29a6('0x9')](function(_0x392211){_0x1c061f=_0x392211[0x0];var _0x333d9e=[];var _0x47ab85=[];_0x45ca85[_0x29a6('0x99')](function(_0x1c5f21){if(_0x1c5f21[_0x29a6('0x9a')]){var _0x540985=_0x1c5f21['@odata.type'][_0x29a6('0x9b')](_0x1c5f21[_0x29a6('0x9a')][_0x29a6('0x3a')]('.')+0x1);if(_0x540985===_0x29a6('0xa1')||_0x540985===_0x29a6('0xa2')||_0x540985===_0x29a6('0xa3')||_0x540985==='IntegerAttributeMetadata'||_0x540985===_0x29a6('0xa4')||_0x540985===_0x29a6('0xa5')||_0x540985===_0x29a6('0xa6')||_0x540985===_0x29a6('0xa7')||_0x540985===_0x29a6('0xa8')||_0x540985===_0x29a6('0xa9')){_0x333d9e[_0x29a6('0x9f')](getInputList(_0x6cae93,_0x437983,_0x540985,_0x47ab85,_0x473742['MetadataId'],_0x1c5f21['MetadataId'],_0xc5e03d));}}});return Promise['all'](_0x333d9e);})[_0x29a6('0x9')](function(_0x3a7e91){_0x7ff955=_0x3a7e91[0x0];var _0xb3f51c=_0x2915f5[_0x29a6('0x82')](_0x1c061f)[_0x29a6('0x82')](_0x7ff955);var _0x2c4559={'count':_0xb3f51c[_0x29a6('0x2b')],'rows':_0xb3f51c};return _0x2c4559;})[_0x29a6('0x9')](respondWithResult(_0x2719c7,null))[_0x29a6('0x28')](function(_0x530e1a){var _0x407985=_0x41a9e6[_0x29a6('0x14')]['test']?0x1f4:_0x530e1a[_0x29a6('0xaa')]||0x1f4;logger['error'](_0x530e1a['stack']);delete _0x530e1a[_0x29a6('0xe')];if(_0x407985===0x191){_0x407985=0x190;}_0x2719c7[_0x29a6('0x4')](_0x407985)[_0x29a6('0xab')](_0x41a9e6[_0x29a6('0x14')][_0x29a6('0xac')]?{'message':'Wrong\x20credentials','statusCode':_0x530e1a[_0x29a6('0xaa')]}:_0x530e1a);});};function getSelectList(_0x4108ca,_0x1a58d1,_0x4194a9,_0x3a96f2,_0x3d05fb,_0x16ae95){var _0x2e6795={'method':'GET','uri':_0x4108ca+_0x29a6('0x93')+_0x3a96f2+')/Attributes('+_0x3d05fb+_0x29a6('0xad')+_0x29a6('0xae'),'headers':{'Authorization':_0x29a6('0x94')+_0x16ae95,'If-None-Match':null,'OData-Version':_0x29a6('0x95')},'json':!![]};return rp(_0x2e6795)[_0x29a6('0x9')](function(_0x514763){var _0x495970=[];var _0x2960de=_0x514763[_0x29a6('0xaf')][_0x29a6('0xb0')];_0x2960de[_0x29a6('0x99')](function(_0x194e57){_0x495970[_0x29a6('0x9f')]({'name':_0x194e57['Label'][_0x29a6('0xb1')][_0x29a6('0xb2')],'value':String(_0x194e57[_0x29a6('0xb3')])});});var _0x20d206={'id':_0x1a58d1+'_'+_0x514763[_0x29a6('0xb4')],'name':_0x514763['DisplayName']['UserLocalizedLabel']['Label'],'custom':![],'options':_0x495970};_0x4194a9[_0x29a6('0x9f')](_0x20d206);return _0x4194a9;});}function getBooleanList(_0x2dfe86,_0x2cd884,_0x510b8d,_0x20d597,_0x2c1a6e,_0x2babe4){var _0x20855f={'method':_0x29a6('0x90'),'uri':_0x2dfe86+_0x29a6('0x93')+_0x20d597+')/Attributes('+_0x2c1a6e+_0x29a6('0xb5'),'headers':{'Authorization':_0x29a6('0x94')+_0x2babe4,'If-None-Match':null,'OData-Version':'4.0'},'json':!![]};return rp(_0x20855f)[_0x29a6('0x9')](function(_0x8ab345){var _0x41e3cb=[];_0x41e3cb[_0x29a6('0x9f')]({'name':_0x8ab345[_0x29a6('0xaf')][_0x29a6('0xb6')][_0x29a6('0xb2')]['UserLocalizedLabel'][_0x29a6('0xb2')],'value':_0x29a6('0xb7')},{'name':_0x8ab345[_0x29a6('0xaf')][_0x29a6('0xb8')]['Label'][_0x29a6('0xb1')][_0x29a6('0xb2')],'value':'false'});var _0x3c85fe={'id':_0x2cd884+'_'+_0x8ab345['LogicalName'],'name':_0x8ab345['DisplayName']['UserLocalizedLabel']['Label'],'custom':![],'options':_0x41e3cb};_0x510b8d['push'](_0x3c85fe);return _0x510b8d;});}function getInputList(_0x2f53da,_0x3cef99,_0x292449,_0x35e8ec,_0x33897e,_0x35fa7a,_0x186156){var _0xb08533={'method':_0x29a6('0x90'),'uri':_0x2f53da+_0x29a6('0x93')+_0x33897e+_0x29a6('0xb9')+_0x35fa7a+_0x29a6('0xba')+_0x292449+'?$select=DisplayName,LogicalName','headers':{'Authorization':_0x29a6('0x94')+_0x186156,'If-None-Match':null,'OData-Version':_0x29a6('0x95')},'json':!![]};return rp(_0xb08533)[_0x29a6('0x9')](function(_0x24437b){var _0x1798f7={'id':_0x3cef99+'_'+_0x24437b[_0x29a6('0xb4')],'name':_0x24437b[_0x29a6('0xbb')][_0x29a6('0xb1')]?_0x24437b[_0x29a6('0xbb')][_0x29a6('0xb1')][_0x29a6('0xb2')]:_0x24437b['LogicalName'],'custom':![],'options':[]};_0x35e8ec[_0x29a6('0x9f')](_0x1798f7);return _0x35e8ec;});} \ No newline at end of file diff --git a/server/api/intDynamics365Account/intDynamics365Account.model.js b/server/api/intDynamics365Account/intDynamics365Account.model.js index 90203db..f80ca82 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 _0x757a=['Dynamics365Account','int_dynamics365_accounts','util','../../config/logger','request-promise','path','rimraf','../../config/environment','./intDynamics365Account.attributes','../../components/integrations/configuration'];(function(_0x1a0510,_0x2a22ce){var _0x1d568c=function(_0xee066f){while(--_0xee066f){_0x1a0510['push'](_0x1a0510['shift']());}};_0x1d568c(++_0x2a22ce);}(_0x757a,0xde));var _0xa757=function(_0x35cf36,_0x628a51){_0x35cf36=_0x35cf36-0x0;var _0x30d485=_0x757a[_0x35cf36];return _0x30d485;};'use strict';var _=require('lodash');var util=require(_0xa757('0x0'));var logger=require(_0xa757('0x1'))('api');var moment=require('moment');var BPromise=require('bluebird');var rp=require(_0xa757('0x2'));var fs=require('fs');var path=require(_0xa757('0x3'));var rimraf=require(_0xa757('0x4'));var config=require(_0xa757('0x5'));var attributes=require(_0xa757('0x6'));var integrations=require(_0xa757('0x7'));module['exports']=function(_0xae0e7c,_0x4343b6){return _0xae0e7c['define'](_0xa757('0x8'),attributes,{'tableName':_0xa757('0x9'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0xe706=['../../config/logger','moment','bluebird','request-promise','path','rimraf','../../config/environment','./intDynamics365Account.attributes','../../components/integrations/configuration','exports','define','Dynamics365Account','int_dynamics365_accounts','lodash','util'];(function(_0x25bb0d,_0x3b8812){var _0x569980=function(_0x3f3537){while(--_0x3f3537){_0x25bb0d['push'](_0x25bb0d['shift']());}};_0x569980(++_0x3b8812);}(_0xe706,0xa3));var _0x6e70=function(_0x5a92ad,_0x2219a6){_0x5a92ad=_0x5a92ad-0x0;var _0x2466f8=_0xe706[_0x5a92ad];return _0x2466f8;};'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'));var integrations=require(_0x6e70('0xa'));module[_0x6e70('0xb')]=function(_0x4381d1,_0x36357b){return _0x4381d1[_0x6e70('0xc')](_0x6e70('0xd'),attributes,{'tableName':_0x6e70('0xe'),'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 3ccd972..5512a26 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 _0xd0e0=['catch','Dynamics365Account','findAll','options','raw','where','attributes','limit','include','map','model','GetDynamics365Account','debug','stringify','ShowDynamics365Account','lodash','util','moment','bluebird','randomstring','../../config/logger','rpc','../../config/environment','http','then','Dynamics365Account,\x20%s,\x20%s','request\x20sent','Dynamics365Account,\x20%s,\x20%s,\x20%s','error','message','info','result'];(function(_0x9e6917,_0x270329){var _0x338e2d=function(_0x270838){while(--_0x270838){_0x9e6917['push'](_0x9e6917['shift']());}};_0x338e2d(++_0x270329);}(_0xd0e0,0x1af));var _0x0d0e=function(_0x294a9b,_0x39edf8){_0x294a9b=_0x294a9b-0x0;var _0x46bec0=_0xd0e0[_0x294a9b];return _0x46bec0;};'use strict';var _=require(_0x0d0e('0x0'));var util=require(_0x0d0e('0x1'));var moment=require(_0x0d0e('0x2'));var BPromise=require(_0x0d0e('0x3'));var rs=require(_0x0d0e('0x4'));var fs=require('fs');var Redis=require('ioredis');var db=require('../../mysqldb')['db'];var utils=require('../../config/utils');var logger=require(_0x0d0e('0x5'))(_0x0d0e('0x6'));var config=require(_0x0d0e('0x7'));var jayson=require('jayson/promise');var client=jayson['client'][_0x0d0e('0x8')]({'port':0x232a});function respondWithRpcPromise(_0x278597,_0x5a8d69,_0x2fffc3){return new BPromise(function(_0x48a293,_0x365be5){return client['request'](_0x278597,_0x2fffc3)[_0x0d0e('0x9')](function(_0x2f8eaa){logger['info'](_0x0d0e('0xa'),_0x5a8d69,_0x0d0e('0xb'));logger['debug'](_0x0d0e('0xc'),_0x5a8d69,_0x0d0e('0xb'),JSON['stringify'](_0x2f8eaa));if(_0x2f8eaa[_0x0d0e('0xd')]){if(_0x2f8eaa[_0x0d0e('0xd')]['code']===0x1f4){logger[_0x0d0e('0xd')](_0x0d0e('0xa'),_0x5a8d69,_0x2f8eaa[_0x0d0e('0xd')][_0x0d0e('0xe')]);return _0x365be5(_0x2f8eaa[_0x0d0e('0xd')][_0x0d0e('0xe')]);}logger[_0x0d0e('0xd')](_0x0d0e('0xa'),_0x5a8d69,_0x2f8eaa['error'][_0x0d0e('0xe')]);return _0x48a293(_0x2f8eaa['error'][_0x0d0e('0xe')]);}else{logger[_0x0d0e('0xf')](_0x0d0e('0xa'),_0x5a8d69,_0x0d0e('0xb'));_0x48a293(_0x2f8eaa[_0x0d0e('0x10')][_0x0d0e('0xe')]);}})[_0x0d0e('0x11')](function(_0x573ad5){logger['error'](_0x0d0e('0xa'),_0x5a8d69,_0x573ad5);_0x365be5(_0x573ad5);});});}exports['GetDynamics365Account']=function(_0x8b21e6){var _0xe1e047=this;return new Promise(function(_0x528b01,_0x37e61c){return db[_0x0d0e('0x12')][_0x0d0e('0x13')]({'raw':_0x8b21e6[_0x0d0e('0x14')]?_0x8b21e6[_0x0d0e('0x14')][_0x0d0e('0x15')]===undefined?!![]:![]:!![],'where':_0x8b21e6[_0x0d0e('0x14')]?_0x8b21e6[_0x0d0e('0x14')][_0x0d0e('0x16')]||null:null,'attributes':_0x8b21e6['options']?_0x8b21e6['options'][_0x0d0e('0x17')]||null:null,'limit':_0x8b21e6[_0x0d0e('0x14')]?_0x8b21e6[_0x0d0e('0x14')][_0x0d0e('0x18')]||null:null,'include':_0x8b21e6['options']?_0x8b21e6[_0x0d0e('0x14')][_0x0d0e('0x19')]?_['map'](_0x8b21e6[_0x0d0e('0x14')][_0x0d0e('0x19')],function(_0x1af5b0){return{'model':db[_0x1af5b0['model']],'as':_0x1af5b0['as'],'attributes':_0x1af5b0[_0x0d0e('0x17')],'include':_0x1af5b0[_0x0d0e('0x19')]?_['map'](_0x1af5b0['include'],function(_0x5eaece){return{'model':db[_0x5eaece['model']],'as':_0x5eaece['as'],'attributes':_0x5eaece[_0x0d0e('0x17')],'include':_0x5eaece[_0x0d0e('0x19')]?_[_0x0d0e('0x1a')](_0x5eaece[_0x0d0e('0x19')],function(_0x50f426){return{'model':db[_0x50f426[_0x0d0e('0x1b')]],'as':_0x50f426['as'],'attributes':_0x50f426[_0x0d0e('0x17')]};}):[]};}):[]};}):[]:[]})[_0x0d0e('0x9')](function(_0x59b631){logger[_0x0d0e('0xf')](_0x0d0e('0x1c'),_0x8b21e6);logger[_0x0d0e('0x1d')](_0x0d0e('0x1c'),_0x8b21e6,JSON[_0x0d0e('0x1e')](_0x59b631));_0x528b01(_0x59b631);})[_0x0d0e('0x11')](function(_0x16d891){logger['error']('GetDynamics365Account',_0x16d891[_0x0d0e('0xe')],_0x8b21e6);_0x37e61c(_0xe1e047[_0x0d0e('0xd')](0x1f4,_0x16d891[_0x0d0e('0xe')]));});});};exports[_0x0d0e('0x1f')]=function(_0x313f33){var _0x2fba83=this;return new Promise(function(_0x10c4f7,_0x1a0d94){return db[_0x0d0e('0x12')]['find']({'raw':_0x313f33['options']?_0x313f33[_0x0d0e('0x14')][_0x0d0e('0x15')]===undefined?!![]:![]:!![],'where':_0x313f33[_0x0d0e('0x14')]?_0x313f33[_0x0d0e('0x14')][_0x0d0e('0x16')]||null:null,'attributes':_0x313f33[_0x0d0e('0x14')]?_0x313f33['options']['attributes']||null:null,'include':_0x313f33[_0x0d0e('0x14')]?_0x313f33[_0x0d0e('0x14')][_0x0d0e('0x19')]?_[_0x0d0e('0x1a')](_0x313f33[_0x0d0e('0x14')]['include'],function(_0x2312a7){return{'model':db[_0x2312a7[_0x0d0e('0x1b')]],'as':_0x2312a7['as'],'attributes':_0x2312a7[_0x0d0e('0x17')],'include':_0x2312a7[_0x0d0e('0x19')]?_[_0x0d0e('0x1a')](_0x2312a7['include'],function(_0x140c8f){return{'model':db[_0x140c8f[_0x0d0e('0x1b')]],'as':_0x140c8f['as'],'attributes':_0x140c8f[_0x0d0e('0x17')],'include':_0x140c8f['include']?_[_0x0d0e('0x1a')](_0x140c8f[_0x0d0e('0x19')],function(_0x435794){return{'model':db[_0x435794[_0x0d0e('0x1b')]],'as':_0x435794['as'],'attributes':_0x435794[_0x0d0e('0x17')]};}):[]};}):[]};}):[]:[]})['then'](function(_0x4f88af){logger[_0x0d0e('0xf')](_0x0d0e('0x1f'),_0x313f33);logger['debug'](_0x0d0e('0x1f'),_0x313f33,JSON[_0x0d0e('0x1e')](_0x4f88af));_0x10c4f7(_0x4f88af);})['catch'](function(_0x534812){logger[_0x0d0e('0xd')](_0x0d0e('0x1f'),_0x534812[_0x0d0e('0xe')],_0x313f33);_0x1a0d94(_0x2fba83[_0x0d0e('0xd')](0x1f4,_0x534812[_0x0d0e('0xe')]));});});}; \ No newline at end of file +var _0x23c8=['http','request','info','Dynamics365Account,\x20%s,\x20%s','request\x20sent','debug','Dynamics365Account,\x20%s,\x20%s,\x20%s','stringify','error','code','message','result','catch','GetDynamics365Account','findAll','options','raw','where','attributes','limit','map','include','model','ShowDynamics365Account','find','lodash','util','bluebird','ioredis','../../config/utils','../../config/logger','../../config/environment'];(function(_0x3ca936,_0x44b50c){var _0x2e2b9d=function(_0x58a72f){while(--_0x58a72f){_0x3ca936['push'](_0x3ca936['shift']());}};_0x2e2b9d(++_0x44b50c);}(_0x23c8,0x99));var _0x823c=function(_0x4683fa,_0x40611d){_0x4683fa=_0x4683fa-0x0;var _0x33f5f7=_0x23c8[_0x4683fa];return _0x33f5f7;};'use strict';var _=require(_0x823c('0x0'));var util=require(_0x823c('0x1'));var moment=require('moment');var BPromise=require(_0x823c('0x2'));var rs=require('randomstring');var fs=require('fs');var Redis=require(_0x823c('0x3'));var db=require('../../mysqldb')['db'];var utils=require(_0x823c('0x4'));var logger=require(_0x823c('0x5'))('rpc');var config=require(_0x823c('0x6'));var jayson=require('jayson/promise');var client=jayson['client'][_0x823c('0x7')]({'port':0x232a});function respondWithRpcPromise(_0x33e4c8,_0x122b20,_0x469b57){return new BPromise(function(_0x249f7a,_0x9b79cd){return client[_0x823c('0x8')](_0x33e4c8,_0x469b57)['then'](function(_0x23da52){logger[_0x823c('0x9')](_0x823c('0xa'),_0x122b20,_0x823c('0xb'));logger[_0x823c('0xc')](_0x823c('0xd'),_0x122b20,_0x823c('0xb'),JSON[_0x823c('0xe')](_0x23da52));if(_0x23da52[_0x823c('0xf')]){if(_0x23da52['error'][_0x823c('0x10')]===0x1f4){logger['error'](_0x823c('0xa'),_0x122b20,_0x23da52['error'][_0x823c('0x11')]);return _0x9b79cd(_0x23da52[_0x823c('0xf')][_0x823c('0x11')]);}logger[_0x823c('0xf')](_0x823c('0xa'),_0x122b20,_0x23da52['error'][_0x823c('0x11')]);return _0x249f7a(_0x23da52['error'][_0x823c('0x11')]);}else{logger[_0x823c('0x9')](_0x823c('0xa'),_0x122b20,_0x823c('0xb'));_0x249f7a(_0x23da52[_0x823c('0x12')][_0x823c('0x11')]);}})[_0x823c('0x13')](function(_0x2c6bf2){logger[_0x823c('0xf')](_0x823c('0xa'),_0x122b20,_0x2c6bf2);_0x9b79cd(_0x2c6bf2);});});}exports[_0x823c('0x14')]=function(_0x435280){var _0xb1b6f7=this;return new Promise(function(_0x2def98,_0xbb4de){return db['Dynamics365Account'][_0x823c('0x15')]({'raw':_0x435280[_0x823c('0x16')]?_0x435280['options'][_0x823c('0x17')]===undefined?!![]:![]:!![],'where':_0x435280[_0x823c('0x16')]?_0x435280['options'][_0x823c('0x18')]||null:null,'attributes':_0x435280[_0x823c('0x16')]?_0x435280['options'][_0x823c('0x19')]||null:null,'limit':_0x435280['options']?_0x435280[_0x823c('0x16')][_0x823c('0x1a')]||null:null,'include':_0x435280[_0x823c('0x16')]?_0x435280['options']['include']?_[_0x823c('0x1b')](_0x435280[_0x823c('0x16')][_0x823c('0x1c')],function(_0x5e783a){return{'model':db[_0x5e783a[_0x823c('0x1d')]],'as':_0x5e783a['as'],'attributes':_0x5e783a[_0x823c('0x19')],'include':_0x5e783a[_0x823c('0x1c')]?_[_0x823c('0x1b')](_0x5e783a[_0x823c('0x1c')],function(_0x5a70ab){return{'model':db[_0x5a70ab[_0x823c('0x1d')]],'as':_0x5a70ab['as'],'attributes':_0x5a70ab[_0x823c('0x19')],'include':_0x5a70ab[_0x823c('0x1c')]?_[_0x823c('0x1b')](_0x5a70ab[_0x823c('0x1c')],function(_0x5c56b4){return{'model':db[_0x5c56b4[_0x823c('0x1d')]],'as':_0x5c56b4['as'],'attributes':_0x5c56b4[_0x823c('0x19')]};}):[]};}):[]};}):[]:[]})['then'](function(_0x357ce3){logger[_0x823c('0x9')](_0x823c('0x14'),_0x435280);logger[_0x823c('0xc')]('GetDynamics365Account',_0x435280,JSON[_0x823c('0xe')](_0x357ce3));_0x2def98(_0x357ce3);})[_0x823c('0x13')](function(_0x57ede6){logger['error']('GetDynamics365Account',_0x57ede6[_0x823c('0x11')],_0x435280);_0xbb4de(_0xb1b6f7[_0x823c('0xf')](0x1f4,_0x57ede6[_0x823c('0x11')]));});});};exports[_0x823c('0x1e')]=function(_0x163056){var _0x235dbe=this;return new Promise(function(_0x3a6cb3,_0x3f4144){return db['Dynamics365Account'][_0x823c('0x1f')]({'raw':_0x163056[_0x823c('0x16')]?_0x163056[_0x823c('0x16')][_0x823c('0x17')]===undefined?!![]:![]:!![],'where':_0x163056[_0x823c('0x16')]?_0x163056[_0x823c('0x16')]['where']||null:null,'attributes':_0x163056[_0x823c('0x16')]?_0x163056[_0x823c('0x16')][_0x823c('0x19')]||null:null,'include':_0x163056[_0x823c('0x16')]?_0x163056[_0x823c('0x16')][_0x823c('0x1c')]?_[_0x823c('0x1b')](_0x163056[_0x823c('0x16')][_0x823c('0x1c')],function(_0x58b634){return{'model':db[_0x58b634['model']],'as':_0x58b634['as'],'attributes':_0x58b634[_0x823c('0x19')],'include':_0x58b634['include']?_['map'](_0x58b634[_0x823c('0x1c')],function(_0x261b3b){return{'model':db[_0x261b3b['model']],'as':_0x261b3b['as'],'attributes':_0x261b3b[_0x823c('0x19')],'include':_0x261b3b[_0x823c('0x1c')]?_[_0x823c('0x1b')](_0x261b3b[_0x823c('0x1c')],function(_0x416461){return{'model':db[_0x416461[_0x823c('0x1d')]],'as':_0x416461['as'],'attributes':_0x416461[_0x823c('0x19')]};}):[]};}):[]};}):[]:[]})['then'](function(_0x5c9f13){logger[_0x823c('0x9')](_0x823c('0x1e'),_0x163056);logger[_0x823c('0xc')]('ShowDynamics365Account',_0x163056,JSON[_0x823c('0xe')](_0x5c9f13));_0x3a6cb3(_0x5c9f13);})[_0x823c('0x13')](function(_0x509136){logger[_0x823c('0xf')]('ShowDynamics365Account',_0x509136[_0x823c('0x11')],_0x163056);_0x3f4144(_0x235dbe[_0x823c('0xf')](0x1f4,_0x509136['message']));});});}; \ No newline at end of file diff --git a/server/api/intDynamics365Configuration/index.js b/server/api/intDynamics365Configuration/index.js index 958e67c..7b7781f 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 _0x5080=['update','exports','multer','util','path','express','../../components/interaction/service','./intDynamics365Configuration.controller','get','isAuthenticated','index','/:id','/:id/fields','/:id/subjects','getSubjects','/:id/descriptions','getDescriptions','post','create'];(function(_0x22f8ab,_0x15d8ff){var _0x2a70e5=function(_0x5e6895){while(--_0x5e6895){_0x22f8ab['push'](_0x22f8ab['shift']());}};_0x2a70e5(++_0x15d8ff);}(_0x5080,0x158));var _0x0508=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0x5080[_0x3dd15e];return _0x231fd0;};'use strict';var multer=require(_0x0508('0x0'));var util=require(_0x0508('0x1'));var path=require(_0x0508('0x2'));var timeout=require('connect-timeout');var express=require(_0x0508('0x3'));var router=express['Router']();var fs_extra=require('fs-extra');var auth=require('../../components/auth/service');var interaction=require(_0x0508('0x4'));var config=require('../../config/environment');var controller=require(_0x0508('0x5'));router[_0x0508('0x6')]('/',auth[_0x0508('0x7')](),controller[_0x0508('0x8')]);router[_0x0508('0x6')](_0x0508('0x9'),auth[_0x0508('0x7')](),controller['show']);router[_0x0508('0x6')](_0x0508('0xa'),auth['isAuthenticated'](),controller['getFields']);router[_0x0508('0x6')](_0x0508('0xb'),auth[_0x0508('0x7')](),controller[_0x0508('0xc')]);router['get'](_0x0508('0xd'),auth[_0x0508('0x7')](),controller[_0x0508('0xe')]);router[_0x0508('0xf')]('/',auth[_0x0508('0x7')](),controller[_0x0508('0x10')]);router['put'](_0x0508('0x9'),auth[_0x0508('0x7')](),controller[_0x0508('0x11')]);router['delete']('/:id',auth[_0x0508('0x7')](),controller['destroy']);module[_0x0508('0x12')]=router; \ No newline at end of file +var _0x90d2=['../../components/interaction/service','../../config/environment','./intDynamics365Configuration.controller','get','isAuthenticated','index','show','/:id/fields','/:id/subjects','getSubjects','/:id/descriptions','getDescriptions','create','put','/:id','update','delete','destroy','exports','multer','util','express','fs-extra'];(function(_0x52a941,_0x33ab69){var _0x54bd86=function(_0x1638d9){while(--_0x1638d9){_0x52a941['push'](_0x52a941['shift']());}};_0x54bd86(++_0x33ab69);}(_0x90d2,0x86));var _0x290d=function(_0x4a6979,_0x5f3d1a){_0x4a6979=_0x4a6979-0x0;var _0x226f93=_0x90d2[_0x4a6979];return _0x226f93;};'use strict';var multer=require(_0x290d('0x0'));var util=require(_0x290d('0x1'));var path=require('path');var timeout=require('connect-timeout');var express=require(_0x290d('0x2'));var router=express['Router']();var fs_extra=require(_0x290d('0x3'));var auth=require('../../components/auth/service');var interaction=require(_0x290d('0x4'));var config=require(_0x290d('0x5'));var controller=require(_0x290d('0x6'));router[_0x290d('0x7')]('/',auth[_0x290d('0x8')](),controller[_0x290d('0x9')]);router[_0x290d('0x7')]('/:id',auth[_0x290d('0x8')](),controller[_0x290d('0xa')]);router[_0x290d('0x7')](_0x290d('0xb'),auth['isAuthenticated'](),controller['getFields']);router[_0x290d('0x7')](_0x290d('0xc'),auth[_0x290d('0x8')](),controller[_0x290d('0xd')]);router[_0x290d('0x7')](_0x290d('0xe'),auth['isAuthenticated'](),controller[_0x290d('0xf')]);router['post']('/',auth[_0x290d('0x8')](),controller[_0x290d('0x10')]);router[_0x290d('0x11')](_0x290d('0x12'),auth['isAuthenticated'](),controller[_0x290d('0x13')]);router[_0x290d('0x14')](_0x290d('0x12'),auth[_0x290d('0x8')](),controller[_0x290d('0x15')]);module[_0x290d('0x16')]=router; \ No newline at end of file diff --git a/server/api/intDynamics365Configuration/intDynamics365Configuration.attributes.js b/server/api/intDynamics365Configuration/intDynamics365Configuration.attributes.js index 23efa9d..0d28f50 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 _0x31a5=['exports','STRING','phonecall','incident','nothing','contact','BOOLEAN','sequelize'];(function(_0x1cd4c8,_0x321113){var _0x9d8adb=function(_0x3422d7){while(--_0x3422d7){_0x1cd4c8['push'](_0x1cd4c8['shift']());}};_0x9d8adb(++_0x321113);}(_0x31a5,0xa7));var _0x531a=function(_0x48e773,_0x453de7){_0x48e773=_0x48e773-0x0;var _0x1845a4=_0x31a5[_0x48e773];return _0x1845a4;};'use strict';var Sequelize=require(_0x531a('0x0'));module[_0x531a('0x1')]={'name':{'type':Sequelize[_0x531a('0x2')]},'description':{'type':Sequelize[_0x531a('0x2')]},'ticketType':{'type':Sequelize['ENUM']('incident',_0x531a('0x3')),'defaultValue':_0x531a('0x4')},'moduleCreate':{'type':Sequelize['ENUM']('contact',_0x531a('0x5')),'defaultValue':_0x531a('0x6'),'allowNull':![]},'additionalSearchContact':{'type':Sequelize[_0x531a('0x2')],'allowNull':!![]},'openNewTab':{'type':Sequelize[_0x531a('0x7')],'defaultValue':!![]}}; \ No newline at end of file +var _0x8d9f=['sequelize','exports','nothing','STRING'];(function(_0x2b8c9f,_0x750b65){var _0x30f4fb=function(_0x3bf9ff){while(--_0x3bf9ff){_0x2b8c9f['push'](_0x2b8c9f['shift']());}};_0x30f4fb(++_0x750b65);}(_0x8d9f,0xac));var _0xf8d9=function(_0x58e0a7,_0x3348a0){_0x58e0a7=_0x58e0a7-0x0;var _0x4ab6a5=_0x8d9f[_0x58e0a7];return _0x4ab6a5;};'use strict';var Sequelize=require(_0xf8d9('0x0'));module[_0xf8d9('0x1')]={'name':{'type':Sequelize['STRING']},'description':{'type':Sequelize['STRING']},'ticketType':{'type':Sequelize['ENUM']('incident','phonecall'),'defaultValue':'incident'},'moduleCreate':{'type':Sequelize['ENUM']('contact',_0xf8d9('0x2')),'defaultValue':'contact','allowNull':![]},'additionalSearchContact':{'type':Sequelize[_0xf8d9('0x3')],'allowNull':!![]},'openNewTab':{'type':Sequelize['BOOLEAN'],'defaultValue':!![]}}; \ No newline at end of file diff --git a/server/api/intDynamics365Configuration/intDynamics365Configuration.controller.js b/server/api/intDynamics365Configuration/intDynamics365Configuration.controller.js index 1cd010f..f76a8c9 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 _0xa5d4=['hasOwnProperty','nolimit','getSubjects','getDescriptions','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','bluebird','mustache','util','path','sox','to-csv','ejs','fs-extra','lodash','squel','crypto','desk.js','ioredis','../../components/auth/service','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/environment','../../config/license/util','../../mysqldb','status','end','undefined','limit','count','offset','set','Content-Range','json','apply','save','update','then','sendStatus','error','name','index','map','type','key','model','keys','query','attributes','intersection','fields','length','order','sort','where','filters','filter','VIRTUAL','merge','options','Dynamics365Configuration','includeAll','include','catch','rawAttributes','find','create','body','params','findOne','Dynamics365Field','pick','getFields'];(function(_0x391a41,_0x343c7f){var _0x99e12=function(_0x10d929){while(--_0x10d929){_0x391a41['push'](_0x391a41['shift']());}};_0x99e12(++_0x343c7f);}(_0xa5d4,0x180));var _0x4a5d=function(_0x4ff09b,_0x53f67d){_0x4ff09b=_0x4ff09b-0x0;var _0x3f5c2e=_0xa5d4[_0x4ff09b];return _0x3f5c2e;};'use strict';var emlformat=require(_0x4a5d('0x0'));var rimraf=require(_0x4a5d('0x1'));var zipdir=require(_0x4a5d('0x2'));var jsonpatch=require(_0x4a5d('0x3'));var rp=require(_0x4a5d('0x4'));var moment=require('moment');var BPromise=require(_0x4a5d('0x5'));var Mustache=require(_0x4a5d('0x6'));var util=require(_0x4a5d('0x7'));var path=require(_0x4a5d('0x8'));var sox=require(_0x4a5d('0x9'));var csv=require(_0x4a5d('0xa'));var ejs=require(_0x4a5d('0xb'));var fs=require('fs');var fs_extra=require(_0x4a5d('0xc'));var _=require(_0x4a5d('0xd'));var squel=require(_0x4a5d('0xe'));var crypto=require(_0x4a5d('0xf'));var jsforce=require('jsforce');var deskjs=require(_0x4a5d('0x10'));var toCsv=require(_0x4a5d('0xa'));var querystring=require('querystring');var Papa=require('papaparse');var Redis=require(_0x4a5d('0x11'));var authService=require(_0x4a5d('0x12'));var qs=require('../../components/parsers/qs');var as=require(_0x4a5d('0x13'));var hardwareService=require(_0x4a5d('0x14'));var logger=require('../../config/logger')('api');var utils=require('../../config/utils');var config=require(_0x4a5d('0x15'));var licenseUtil=require(_0x4a5d('0x16'));var db=require(_0x4a5d('0x17'))['db'];function respondWithStatusCode(_0x3d3f6f,_0x3d83eb){_0x3d83eb=_0x3d83eb||0xcc;return function(_0x12461d){if(_0x12461d){return _0x3d3f6f['sendStatus'](_0x3d83eb);}return _0x3d3f6f[_0x4a5d('0x18')](_0x3d83eb)[_0x4a5d('0x19')]();};}function respondWithResult(_0x1e5711,_0xf083d4){_0xf083d4=_0xf083d4||0xc8;return function(_0x34eb34){if(_0x34eb34){return _0x1e5711[_0x4a5d('0x18')](_0xf083d4)['json'](_0x34eb34);}};}function respondWithFilteredResult(_0x1e6906,_0x4d77a2){return function(_0x36160d){if(_0x36160d){var _0x7f3af3=typeof _0x4d77a2['offset']===_0x4a5d('0x1a')&&typeof _0x4d77a2[_0x4a5d('0x1b')]===_0x4a5d('0x1a');var _0xd7e68e=_0x36160d[_0x4a5d('0x1c')];var _0x30a40d=_0x7f3af3?0x0:_0x4d77a2[_0x4a5d('0x1d')];var _0x2e7922=_0x7f3af3?_0x36160d[_0x4a5d('0x1c')]:_0x4d77a2[_0x4a5d('0x1d')]+_0x4d77a2['limit'];var _0x2b57d5;if(_0x2e7922>=_0xd7e68e){_0x2e7922=_0xd7e68e;_0x2b57d5=0xc8;}else{_0x2b57d5=0xce;}_0x1e6906[_0x4a5d('0x18')](_0x2b57d5);return _0x1e6906[_0x4a5d('0x1e')](_0x4a5d('0x1f'),_0x30a40d+'-'+_0x2e7922+'/'+_0xd7e68e)[_0x4a5d('0x20')](_0x36160d);}return null;};}function patchUpdates(_0x18f4a6){return function(_0x41f77b){try{jsonpatch[_0x4a5d('0x21')](_0x41f77b,_0x18f4a6,!![]);}catch(_0x317acc){return BPromise['reject'](_0x317acc);}return _0x41f77b[_0x4a5d('0x22')]();};}function saveUpdates(_0x5970c1,_0x6ed9e4){return function(_0x168b97){if(_0x168b97){return _0x168b97[_0x4a5d('0x23')](_0x5970c1)[_0x4a5d('0x24')](function(_0x59615b){return _0x59615b;});}return null;};}function removeEntity(_0x2bc7c4,_0x46aa92){return function(_0x1a14eb){if(_0x1a14eb){return _0x1a14eb['destroy']()['then'](function(){_0x2bc7c4[_0x4a5d('0x18')](0xcc)[_0x4a5d('0x19')]();});}};}function handleEntityNotFound(_0x500b69,_0x5bf2b0){return function(_0x8d4e88){if(!_0x8d4e88){_0x500b69[_0x4a5d('0x25')](0x194);}return _0x8d4e88;};}function handleError(_0x5c0320,_0x380954){_0x380954=_0x380954||0x1f4;return function(_0x3ff01f){logger[_0x4a5d('0x26')](_0x3ff01f['stack']);if(_0x3ff01f[_0x4a5d('0x27')]){delete _0x3ff01f['name'];}_0x5c0320[_0x4a5d('0x18')](_0x380954)['send'](_0x3ff01f);};}exports[_0x4a5d('0x28')]=function(_0x37412a,_0x3ee8b8){var _0x35acd9={},_0x408a2b={},_0x59942a={'count':0x0,'rows':[]};var _0x4de7c0=_[_0x4a5d('0x29')](db['Dynamics365Configuration']['rawAttributes'],function(_0x93c493){return{'name':_0x93c493['fieldName'],'type':_0x93c493[_0x4a5d('0x2a')][_0x4a5d('0x2b')]};});_0x408a2b[_0x4a5d('0x2c')]=_[_0x4a5d('0x29')](_0x4de7c0,_0x4a5d('0x27'));_0x408a2b['query']=_[_0x4a5d('0x2d')](_0x37412a[_0x4a5d('0x2e')]);_0x408a2b['filters']=_['intersection'](_0x408a2b[_0x4a5d('0x2c')],_0x408a2b[_0x4a5d('0x2e')]);_0x35acd9[_0x4a5d('0x2f')]=_[_0x4a5d('0x30')](_0x408a2b[_0x4a5d('0x2c')],qs[_0x4a5d('0x31')](_0x37412a[_0x4a5d('0x2e')][_0x4a5d('0x31')]));_0x35acd9['attributes']=_0x35acd9[_0x4a5d('0x2f')][_0x4a5d('0x32')]?_0x35acd9[_0x4a5d('0x2f')]:_0x408a2b[_0x4a5d('0x2c')];if(!_0x37412a['query']['hasOwnProperty']('nolimit')){_0x35acd9['limit']=qs['limit'](_0x37412a[_0x4a5d('0x2e')][_0x4a5d('0x1b')]);_0x35acd9[_0x4a5d('0x1d')]=qs[_0x4a5d('0x1d')](_0x37412a[_0x4a5d('0x2e')][_0x4a5d('0x1d')]);}_0x35acd9[_0x4a5d('0x33')]=qs[_0x4a5d('0x34')](_0x37412a[_0x4a5d('0x2e')][_0x4a5d('0x34')]);_0x35acd9[_0x4a5d('0x35')]=qs['filters'](_['pick'](_0x37412a[_0x4a5d('0x2e')],_0x408a2b[_0x4a5d('0x36')]),_0x4de7c0);if(_0x37412a['query'][_0x4a5d('0x37')]){_0x35acd9[_0x4a5d('0x35')]=_['merge'](_0x35acd9[_0x4a5d('0x35')],{'$or':_[_0x4a5d('0x29')](_0x4de7c0,function(_0x49b603){if(_0x49b603[_0x4a5d('0x2a')]!==_0x4a5d('0x38')){var _0x5bd33a={};_0x5bd33a[_0x49b603[_0x4a5d('0x27')]]={'$like':'%'+_0x37412a[_0x4a5d('0x2e')][_0x4a5d('0x37')]+'%'};return _0x5bd33a;}})});}_0x35acd9=_[_0x4a5d('0x39')]({},_0x35acd9,_0x37412a[_0x4a5d('0x3a')]);var _0x2ef627={'where':_0x35acd9[_0x4a5d('0x35')]};return db[_0x4a5d('0x3b')]['count'](_0x2ef627)[_0x4a5d('0x24')](function(_0x193d0b){_0x59942a[_0x4a5d('0x1c')]=_0x193d0b;if(_0x37412a[_0x4a5d('0x2e')][_0x4a5d('0x3c')]){_0x35acd9[_0x4a5d('0x3d')]=[{'all':!![]}];}return db['Dynamics365Configuration']['findAll'](_0x35acd9);})[_0x4a5d('0x24')](function(_0x5cec0f){_0x59942a['rows']=_0x5cec0f;return _0x59942a;})[_0x4a5d('0x24')](respondWithFilteredResult(_0x3ee8b8,_0x35acd9))[_0x4a5d('0x3e')](handleError(_0x3ee8b8,null));};exports['show']=function(_0x516bd8,_0x34d657){var _0x1c0221={'raw':![],'where':{'id':_0x516bd8['params']['id']}},_0x2a6506={};_0x2a6506[_0x4a5d('0x2c')]=_['keys'](db['Dynamics365Configuration'][_0x4a5d('0x3f')]);_0x2a6506[_0x4a5d('0x2e')]=_[_0x4a5d('0x2d')](_0x516bd8['query']);_0x2a6506['filters']=_[_0x4a5d('0x30')](_0x2a6506[_0x4a5d('0x2c')],_0x2a6506[_0x4a5d('0x2e')]);_0x1c0221[_0x4a5d('0x2f')]=_[_0x4a5d('0x30')](_0x2a6506[_0x4a5d('0x2c')],qs[_0x4a5d('0x31')](_0x516bd8['query'][_0x4a5d('0x31')]));_0x1c0221['attributes']=_0x1c0221['attributes'][_0x4a5d('0x32')]?_0x1c0221[_0x4a5d('0x2f')]:_0x2a6506[_0x4a5d('0x2c')];if(_0x516bd8[_0x4a5d('0x2e')][_0x4a5d('0x3c')]){_0x1c0221['include']=[{'all':!![]}];}_0x1c0221=_['merge']({},_0x1c0221,_0x516bd8['options']);return db[_0x4a5d('0x3b')][_0x4a5d('0x40')](_0x1c0221)[_0x4a5d('0x24')](handleEntityNotFound(_0x34d657,null))[_0x4a5d('0x24')](respondWithResult(_0x34d657,null))[_0x4a5d('0x3e')](handleError(_0x34d657,null));};exports[_0x4a5d('0x41')]=function(_0x5f2ae2,_0x35e5f3){return db['Dynamics365Configuration'][_0x4a5d('0x41')](_0x5f2ae2[_0x4a5d('0x42')],{})[_0x4a5d('0x24')](respondWithResult(_0x35e5f3,0xc9))[_0x4a5d('0x3e')](handleError(_0x35e5f3,null));};exports[_0x4a5d('0x23')]=function(_0x3cfc6a,_0x16a87e){if(_0x3cfc6a['body']['id']){delete _0x3cfc6a[_0x4a5d('0x42')]['id'];}return db[_0x4a5d('0x3b')][_0x4a5d('0x40')]({'where':{'id':_0x3cfc6a[_0x4a5d('0x43')]['id']}})[_0x4a5d('0x24')](handleEntityNotFound(_0x16a87e,null))[_0x4a5d('0x24')](saveUpdates(_0x3cfc6a[_0x4a5d('0x42')],null))['then'](respondWithResult(_0x16a87e,null))[_0x4a5d('0x3e')](handleError(_0x16a87e,null));};exports['destroy']=function(_0x32463d,_0x386c3a){return db[_0x4a5d('0x3b')][_0x4a5d('0x40')]({'where':{'id':_0x32463d[_0x4a5d('0x43')]['id']}})[_0x4a5d('0x24')](handleEntityNotFound(_0x386c3a,null))[_0x4a5d('0x24')](removeEntity(_0x386c3a,null))[_0x4a5d('0x3e')](handleError(_0x386c3a,null));};exports['getFields']=function(_0x58e685,_0x50ff69,_0x3a3a91){var _0x284a44={};var _0x27508d={};var _0x5956e0;var _0x513bcb;return db['Dynamics365Configuration'][_0x4a5d('0x44')]({'where':{'id':_0x58e685[_0x4a5d('0x43')]['id']}})['then'](handleEntityNotFound(_0x50ff69,null))[_0x4a5d('0x24')](function(_0x5f1721){if(_0x5f1721){_0x5956e0=_0x5f1721;_0x27508d[_0x4a5d('0x2c')]=_[_0x4a5d('0x2d')](db[_0x4a5d('0x45')]['rawAttributes']);_0x27508d[_0x4a5d('0x2e')]=_[_0x4a5d('0x2d')](_0x58e685[_0x4a5d('0x2e')]);_0x27508d[_0x4a5d('0x36')]=_['intersection'](_0x27508d[_0x4a5d('0x2c')],_0x27508d[_0x4a5d('0x2e')]);_0x284a44[_0x4a5d('0x2f')]=_[_0x4a5d('0x30')](_0x27508d[_0x4a5d('0x2c')],qs['fields'](_0x58e685[_0x4a5d('0x2e')]['fields']));_0x284a44['attributes']=_0x284a44[_0x4a5d('0x2f')][_0x4a5d('0x32')]?_0x284a44[_0x4a5d('0x2f')]:_0x27508d[_0x4a5d('0x2c')];_0x284a44['order']=qs[_0x4a5d('0x34')](_0x58e685['query']['sort']);_0x284a44[_0x4a5d('0x35')]=qs['filters'](_[_0x4a5d('0x46')](_0x58e685[_0x4a5d('0x2e')],_0x27508d[_0x4a5d('0x36')]));if(_0x58e685[_0x4a5d('0x2e')][_0x4a5d('0x37')]){_0x284a44[_0x4a5d('0x35')]=_[_0x4a5d('0x39')](_0x284a44[_0x4a5d('0x35')],{'$or':_[_0x4a5d('0x29')](_0x284a44[_0x4a5d('0x2f')],function(_0x59488a){var _0x324cef={};_0x324cef[_0x59488a]={'$like':'%'+_0x58e685['query'][_0x4a5d('0x37')]+'%'};return _0x324cef;})});}_0x284a44=_[_0x4a5d('0x39')]({},_0x284a44,_0x58e685[_0x4a5d('0x3a')]);return _0x5956e0[_0x4a5d('0x47')](_0x284a44);}})[_0x4a5d('0x24')](function(_0x683e5c){if(_0x683e5c){_0x513bcb=_0x683e5c[_0x4a5d('0x32')];if(!_0x58e685[_0x4a5d('0x2e')][_0x4a5d('0x48')](_0x4a5d('0x49'))){_0x284a44[_0x4a5d('0x1b')]=qs[_0x4a5d('0x1b')](_0x58e685[_0x4a5d('0x2e')][_0x4a5d('0x1b')]);_0x284a44[_0x4a5d('0x1d')]=qs[_0x4a5d('0x1d')](_0x58e685[_0x4a5d('0x2e')][_0x4a5d('0x1d')]);}return _0x5956e0[_0x4a5d('0x47')](_0x284a44);}})[_0x4a5d('0x24')](function(_0x4bd3d6){if(_0x4bd3d6){return _0x4bd3d6?{'count':_0x513bcb,'rows':_0x4bd3d6}:null;}})[_0x4a5d('0x24')](respondWithResult(_0x50ff69,null))[_0x4a5d('0x3e')](handleError(_0x50ff69,null));};exports['getSubjects']=function(_0x4daa02,_0x233ddb,_0x3b77db){var _0x1ed682={};var _0x4a71af={};var _0x4b40a9;var _0x17dfdf;return db[_0x4a5d('0x3b')][_0x4a5d('0x44')]({'where':{'id':_0x4daa02['params']['id']}})[_0x4a5d('0x24')](handleEntityNotFound(_0x233ddb,null))[_0x4a5d('0x24')](function(_0x4af171){if(_0x4af171){_0x4b40a9=_0x4af171;_0x4a71af[_0x4a5d('0x2c')]=_['keys'](db[_0x4a5d('0x45')][_0x4a5d('0x3f')]);_0x4a71af['query']=_[_0x4a5d('0x2d')](_0x4daa02['query']);_0x4a71af[_0x4a5d('0x36')]=_[_0x4a5d('0x30')](_0x4a71af['model'],_0x4a71af[_0x4a5d('0x2e')]);_0x1ed682['attributes']=_[_0x4a5d('0x30')](_0x4a71af[_0x4a5d('0x2c')],qs['fields'](_0x4daa02[_0x4a5d('0x2e')][_0x4a5d('0x31')]));_0x1ed682[_0x4a5d('0x2f')]=_0x1ed682['attributes'][_0x4a5d('0x32')]?_0x1ed682[_0x4a5d('0x2f')]:_0x4a71af[_0x4a5d('0x2c')];_0x1ed682[_0x4a5d('0x33')]=qs[_0x4a5d('0x34')](_0x4daa02[_0x4a5d('0x2e')][_0x4a5d('0x34')]);_0x1ed682['where']=qs[_0x4a5d('0x36')](_[_0x4a5d('0x46')](_0x4daa02[_0x4a5d('0x2e')],_0x4a71af[_0x4a5d('0x36')]));if(_0x4daa02[_0x4a5d('0x2e')][_0x4a5d('0x37')]){_0x1ed682[_0x4a5d('0x35')]=_[_0x4a5d('0x39')](_0x1ed682[_0x4a5d('0x35')],{'$or':_[_0x4a5d('0x29')](_0x1ed682['attributes'],function(_0x740aa7){var _0x5d24a1={};_0x5d24a1[_0x740aa7]={'$like':'%'+_0x4daa02[_0x4a5d('0x2e')][_0x4a5d('0x37')]+'%'};return _0x5d24a1;})});}_0x1ed682=_[_0x4a5d('0x39')]({},_0x1ed682,_0x4daa02[_0x4a5d('0x3a')]);return _0x4b40a9[_0x4a5d('0x4a')](_0x1ed682);}})[_0x4a5d('0x24')](function(_0x519cab){if(_0x519cab){_0x17dfdf=_0x519cab[_0x4a5d('0x32')];if(!_0x4daa02['query'][_0x4a5d('0x48')](_0x4a5d('0x49'))){_0x1ed682[_0x4a5d('0x1b')]=qs[_0x4a5d('0x1b')](_0x4daa02[_0x4a5d('0x2e')][_0x4a5d('0x1b')]);_0x1ed682['offset']=qs[_0x4a5d('0x1d')](_0x4daa02[_0x4a5d('0x2e')]['offset']);}return _0x4b40a9['getSubjects'](_0x1ed682);}})['then'](function(_0x134050){if(_0x134050){return _0x134050?{'count':_0x17dfdf,'rows':_0x134050}:null;}})[_0x4a5d('0x24')](respondWithResult(_0x233ddb,null))[_0x4a5d('0x3e')](handleError(_0x233ddb,null));};exports[_0x4a5d('0x4b')]=function(_0x2fd90b,_0x489b83,_0x48476e){var _0x1ce089={};var _0x3e9943={};var _0x7bd815;var _0x4254d4;return db[_0x4a5d('0x3b')][_0x4a5d('0x44')]({'where':{'id':_0x2fd90b[_0x4a5d('0x43')]['id']}})[_0x4a5d('0x24')](handleEntityNotFound(_0x489b83,null))[_0x4a5d('0x24')](function(_0x34c6b5){if(_0x34c6b5){_0x7bd815=_0x34c6b5;_0x3e9943[_0x4a5d('0x2c')]=_[_0x4a5d('0x2d')](db[_0x4a5d('0x45')]['rawAttributes']);_0x3e9943[_0x4a5d('0x2e')]=_[_0x4a5d('0x2d')](_0x2fd90b['query']);_0x3e9943[_0x4a5d('0x36')]=_[_0x4a5d('0x30')](_0x3e9943[_0x4a5d('0x2c')],_0x3e9943[_0x4a5d('0x2e')]);_0x1ce089[_0x4a5d('0x2f')]=_['intersection'](_0x3e9943[_0x4a5d('0x2c')],qs[_0x4a5d('0x31')](_0x2fd90b[_0x4a5d('0x2e')][_0x4a5d('0x31')]));_0x1ce089[_0x4a5d('0x2f')]=_0x1ce089[_0x4a5d('0x2f')][_0x4a5d('0x32')]?_0x1ce089[_0x4a5d('0x2f')]:_0x3e9943[_0x4a5d('0x2c')];_0x1ce089[_0x4a5d('0x33')]=qs['sort'](_0x2fd90b['query'][_0x4a5d('0x34')]);_0x1ce089['where']=qs[_0x4a5d('0x36')](_[_0x4a5d('0x46')](_0x2fd90b[_0x4a5d('0x2e')],_0x3e9943[_0x4a5d('0x36')]));if(_0x2fd90b['query'][_0x4a5d('0x37')]){_0x1ce089['where']=_[_0x4a5d('0x39')](_0x1ce089[_0x4a5d('0x35')],{'$or':_[_0x4a5d('0x29')](_0x1ce089[_0x4a5d('0x2f')],function(_0x28bf9a){var _0x5201d5={};_0x5201d5[_0x28bf9a]={'$like':'%'+_0x2fd90b[_0x4a5d('0x2e')][_0x4a5d('0x37')]+'%'};return _0x5201d5;})});}_0x1ce089=_['merge']({},_0x1ce089,_0x2fd90b[_0x4a5d('0x3a')]);return _0x7bd815[_0x4a5d('0x4b')](_0x1ce089);}})['then'](function(_0x3ae69d){if(_0x3ae69d){_0x4254d4=_0x3ae69d['length'];if(!_0x2fd90b['query'][_0x4a5d('0x48')](_0x4a5d('0x49'))){_0x1ce089['limit']=qs['limit'](_0x2fd90b[_0x4a5d('0x2e')][_0x4a5d('0x1b')]);_0x1ce089[_0x4a5d('0x1d')]=qs[_0x4a5d('0x1d')](_0x2fd90b[_0x4a5d('0x2e')][_0x4a5d('0x1d')]);}return _0x7bd815[_0x4a5d('0x4b')](_0x1ce089);}})[_0x4a5d('0x24')](function(_0x176bc2){if(_0x176bc2){return _0x176bc2?{'count':_0x4254d4,'rows':_0x176bc2}:null;}})['then'](respondWithResult(_0x489b83,null))[_0x4a5d('0x3e')](handleError(_0x489b83,null));}; \ No newline at end of file +var _0xcfdf=['request-promise','moment','bluebird','mustache','util','sox','ejs','lodash','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','sendStatus','status','offset','undefined','limit','count','set','reject','save','update','then','destroy','end','error','stack','name','send','index','map','Dynamics365Configuration','rawAttributes','type','key','keys','query','filters','model','attributes','intersection','fields','length','hasOwnProperty','nolimit','order','sort','where','pick','filter','merge','VIRTUAL','options','includeAll','include','rows','show','find','body','catch','params','getFields','findOne','Dynamics365Field','getSubjects','getDescriptions','eml-format','rimraf','fast-json-patch'];(function(_0x527f66,_0x16f718){var _0x2d5d62=function(_0x4eea6f){while(--_0x4eea6f){_0x527f66['push'](_0x527f66['shift']());}};_0x2d5d62(++_0x16f718);}(_0xcfdf,0x139));var _0xfcfd=function(_0x5ca8c8,_0x1e4d65){_0x5ca8c8=_0x5ca8c8-0x0;var _0x12fe73=_0xcfdf[_0x5ca8c8];return _0x12fe73;};'use strict';var emlformat=require(_0xfcfd('0x0'));var rimraf=require(_0xfcfd('0x1'));var zipdir=require('zip-dir');var jsonpatch=require(_0xfcfd('0x2'));var rp=require(_0xfcfd('0x3'));var moment=require(_0xfcfd('0x4'));var BPromise=require(_0xfcfd('0x5'));var Mustache=require(_0xfcfd('0x6'));var util=require(_0xfcfd('0x7'));var path=require('path');var sox=require(_0xfcfd('0x8'));var csv=require('to-csv');var ejs=require(_0xfcfd('0x9'));var fs=require('fs');var fs_extra=require('fs-extra');var _=require(_0xfcfd('0xa'));var squel=require('squel');var crypto=require(_0xfcfd('0xb'));var jsforce=require('jsforce');var deskjs=require(_0xfcfd('0xc'));var toCsv=require(_0xfcfd('0xd'));var querystring=require(_0xfcfd('0xe'));var Papa=require(_0xfcfd('0xf'));var Redis=require(_0xfcfd('0x10'));var authService=require(_0xfcfd('0x11'));var qs=require('../../components/parsers/qs');var as=require(_0xfcfd('0x12'));var hardwareService=require(_0xfcfd('0x13'));var logger=require(_0xfcfd('0x14'))(_0xfcfd('0x15'));var utils=require(_0xfcfd('0x16'));var config=require(_0xfcfd('0x17'));var licenseUtil=require(_0xfcfd('0x18'));var db=require('../../mysqldb')['db'];function respondWithStatusCode(_0x771f93,_0x3d4da5){_0x3d4da5=_0x3d4da5||0xcc;return function(_0x186ca4){if(_0x186ca4){return _0x771f93[_0xfcfd('0x19')](_0x3d4da5);}return _0x771f93[_0xfcfd('0x1a')](_0x3d4da5)['end']();};}function respondWithResult(_0xfd8c50,_0x9d5bf){_0x9d5bf=_0x9d5bf||0xc8;return function(_0xacab13){if(_0xacab13){return _0xfd8c50[_0xfcfd('0x1a')](_0x9d5bf)['json'](_0xacab13);}};}function respondWithFilteredResult(_0x439bd7,_0x14d3ca){return function(_0x1cb4ed){if(_0x1cb4ed){var _0x163f9b=typeof _0x14d3ca[_0xfcfd('0x1b')]===_0xfcfd('0x1c')&&typeof _0x14d3ca[_0xfcfd('0x1d')]==='undefined';var _0x18ca1d=_0x1cb4ed[_0xfcfd('0x1e')];var _0x35a54b=_0x163f9b?0x0:_0x14d3ca[_0xfcfd('0x1b')];var _0x9690d7=_0x163f9b?_0x1cb4ed[_0xfcfd('0x1e')]:_0x14d3ca['offset']+_0x14d3ca['limit'];var _0x44bee5;if(_0x9690d7>=_0x18ca1d){_0x9690d7=_0x18ca1d;_0x44bee5=0xc8;}else{_0x44bee5=0xce;}_0x439bd7[_0xfcfd('0x1a')](_0x44bee5);return _0x439bd7[_0xfcfd('0x1f')]('Content-Range',_0x35a54b+'-'+_0x9690d7+'/'+_0x18ca1d)['json'](_0x1cb4ed);}return null;};}function patchUpdates(_0x4ad4fb){return function(_0x1a0f36){try{jsonpatch['apply'](_0x1a0f36,_0x4ad4fb,!![]);}catch(_0x533de2){return BPromise[_0xfcfd('0x20')](_0x533de2);}return _0x1a0f36[_0xfcfd('0x21')]();};}function saveUpdates(_0x51ecda,_0x14ee45){return function(_0x15fc33){if(_0x15fc33){return _0x15fc33[_0xfcfd('0x22')](_0x51ecda)[_0xfcfd('0x23')](function(_0x2d5dfd){return _0x2d5dfd;});}return null;};}function removeEntity(_0x214656,_0x118558){return function(_0x5b6191){if(_0x5b6191){return _0x5b6191[_0xfcfd('0x24')]()[_0xfcfd('0x23')](function(){_0x214656[_0xfcfd('0x1a')](0xcc)[_0xfcfd('0x25')]();});}};}function handleEntityNotFound(_0x30eb85,_0x4684fc){return function(_0x44f8b7){if(!_0x44f8b7){_0x30eb85['sendStatus'](0x194);}return _0x44f8b7;};}function handleError(_0x3d2fd4,_0x4baf46){_0x4baf46=_0x4baf46||0x1f4;return function(_0x502cf0){logger[_0xfcfd('0x26')](_0x502cf0[_0xfcfd('0x27')]);if(_0x502cf0[_0xfcfd('0x28')]){delete _0x502cf0[_0xfcfd('0x28')];}_0x3d2fd4[_0xfcfd('0x1a')](_0x4baf46)[_0xfcfd('0x29')](_0x502cf0);};}exports[_0xfcfd('0x2a')]=function(_0x490e6f,_0x10ebff){var _0x482f2e={},_0xe21bfe={},_0x3d576={'count':0x0,'rows':[]};var _0x5e4937=_[_0xfcfd('0x2b')](db[_0xfcfd('0x2c')][_0xfcfd('0x2d')],function(_0xd2a317){return{'name':_0xd2a317['fieldName'],'type':_0xd2a317[_0xfcfd('0x2e')][_0xfcfd('0x2f')]};});_0xe21bfe['model']=_[_0xfcfd('0x2b')](_0x5e4937,'name');_0xe21bfe['query']=_[_0xfcfd('0x30')](_0x490e6f[_0xfcfd('0x31')]);_0xe21bfe[_0xfcfd('0x32')]=_['intersection'](_0xe21bfe[_0xfcfd('0x33')],_0xe21bfe['query']);_0x482f2e[_0xfcfd('0x34')]=_[_0xfcfd('0x35')](_0xe21bfe['model'],qs['fields'](_0x490e6f[_0xfcfd('0x31')][_0xfcfd('0x36')]));_0x482f2e[_0xfcfd('0x34')]=_0x482f2e[_0xfcfd('0x34')][_0xfcfd('0x37')]?_0x482f2e[_0xfcfd('0x34')]:_0xe21bfe[_0xfcfd('0x33')];if(!_0x490e6f['query'][_0xfcfd('0x38')](_0xfcfd('0x39'))){_0x482f2e[_0xfcfd('0x1d')]=qs[_0xfcfd('0x1d')](_0x490e6f[_0xfcfd('0x31')][_0xfcfd('0x1d')]);_0x482f2e[_0xfcfd('0x1b')]=qs[_0xfcfd('0x1b')](_0x490e6f[_0xfcfd('0x31')]['offset']);}_0x482f2e[_0xfcfd('0x3a')]=qs['sort'](_0x490e6f[_0xfcfd('0x31')][_0xfcfd('0x3b')]);_0x482f2e[_0xfcfd('0x3c')]=qs[_0xfcfd('0x32')](_[_0xfcfd('0x3d')](_0x490e6f[_0xfcfd('0x31')],_0xe21bfe['filters']),_0x5e4937);if(_0x490e6f[_0xfcfd('0x31')][_0xfcfd('0x3e')]){_0x482f2e[_0xfcfd('0x3c')]=_[_0xfcfd('0x3f')](_0x482f2e[_0xfcfd('0x3c')],{'$or':_[_0xfcfd('0x2b')](_0x5e4937,function(_0x12b6a2){if(_0x12b6a2[_0xfcfd('0x2e')]!==_0xfcfd('0x40')){var _0x121aaf={};_0x121aaf[_0x12b6a2[_0xfcfd('0x28')]]={'$like':'%'+_0x490e6f[_0xfcfd('0x31')][_0xfcfd('0x3e')]+'%'};return _0x121aaf;}})});}_0x482f2e=_[_0xfcfd('0x3f')]({},_0x482f2e,_0x490e6f[_0xfcfd('0x41')]);var _0x6747c7={'where':_0x482f2e[_0xfcfd('0x3c')]};return db[_0xfcfd('0x2c')][_0xfcfd('0x1e')](_0x6747c7)[_0xfcfd('0x23')](function(_0x4e44f2){_0x3d576[_0xfcfd('0x1e')]=_0x4e44f2;if(_0x490e6f[_0xfcfd('0x31')][_0xfcfd('0x42')]){_0x482f2e[_0xfcfd('0x43')]=[{'all':!![]}];}return db[_0xfcfd('0x2c')]['findAll'](_0x482f2e);})[_0xfcfd('0x23')](function(_0x5f0093){_0x3d576[_0xfcfd('0x44')]=_0x5f0093;return _0x3d576;})[_0xfcfd('0x23')](respondWithFilteredResult(_0x10ebff,_0x482f2e))['catch'](handleError(_0x10ebff,null));};exports[_0xfcfd('0x45')]=function(_0x24d00e,_0x468845){var _0x126f85={'raw':![],'where':{'id':_0x24d00e['params']['id']}},_0x1ff069={};_0x1ff069[_0xfcfd('0x33')]=_[_0xfcfd('0x30')](db[_0xfcfd('0x2c')][_0xfcfd('0x2d')]);_0x1ff069[_0xfcfd('0x31')]=_[_0xfcfd('0x30')](_0x24d00e['query']);_0x1ff069[_0xfcfd('0x32')]=_[_0xfcfd('0x35')](_0x1ff069[_0xfcfd('0x33')],_0x1ff069[_0xfcfd('0x31')]);_0x126f85[_0xfcfd('0x34')]=_[_0xfcfd('0x35')](_0x1ff069['model'],qs['fields'](_0x24d00e['query'][_0xfcfd('0x36')]));_0x126f85[_0xfcfd('0x34')]=_0x126f85[_0xfcfd('0x34')][_0xfcfd('0x37')]?_0x126f85[_0xfcfd('0x34')]:_0x1ff069['model'];if(_0x24d00e['query'][_0xfcfd('0x42')]){_0x126f85[_0xfcfd('0x43')]=[{'all':!![]}];}_0x126f85=_['merge']({},_0x126f85,_0x24d00e[_0xfcfd('0x41')]);return db[_0xfcfd('0x2c')][_0xfcfd('0x46')](_0x126f85)[_0xfcfd('0x23')](handleEntityNotFound(_0x468845,null))[_0xfcfd('0x23')](respondWithResult(_0x468845,null))['catch'](handleError(_0x468845,null));};exports['create']=function(_0xf88ddb,_0x44ae31){return db[_0xfcfd('0x2c')]['create'](_0xf88ddb[_0xfcfd('0x47')],{})['then'](respondWithResult(_0x44ae31,0xc9))[_0xfcfd('0x48')](handleError(_0x44ae31,null));};exports[_0xfcfd('0x22')]=function(_0x3849c3,_0x199694){if(_0x3849c3[_0xfcfd('0x47')]['id']){delete _0x3849c3[_0xfcfd('0x47')]['id'];}return db[_0xfcfd('0x2c')][_0xfcfd('0x46')]({'where':{'id':_0x3849c3[_0xfcfd('0x49')]['id']}})[_0xfcfd('0x23')](handleEntityNotFound(_0x199694,null))['then'](saveUpdates(_0x3849c3[_0xfcfd('0x47')],null))['then'](respondWithResult(_0x199694,null))[_0xfcfd('0x48')](handleError(_0x199694,null));};exports[_0xfcfd('0x24')]=function(_0x22b462,_0x42605f){return db[_0xfcfd('0x2c')][_0xfcfd('0x46')]({'where':{'id':_0x22b462[_0xfcfd('0x49')]['id']}})['then'](handleEntityNotFound(_0x42605f,null))[_0xfcfd('0x23')](removeEntity(_0x42605f,null))['catch'](handleError(_0x42605f,null));};exports[_0xfcfd('0x4a')]=function(_0x1c586e,_0x3fd35d,_0x310f63){var _0x4986b9={};var _0x5d67ee={};var _0x408b2b;var _0x4c3b43;return db[_0xfcfd('0x2c')][_0xfcfd('0x4b')]({'where':{'id':_0x1c586e['params']['id']}})[_0xfcfd('0x23')](handleEntityNotFound(_0x3fd35d,null))[_0xfcfd('0x23')](function(_0x4790dd){if(_0x4790dd){_0x408b2b=_0x4790dd;_0x5d67ee[_0xfcfd('0x33')]=_['keys'](db[_0xfcfd('0x4c')][_0xfcfd('0x2d')]);_0x5d67ee[_0xfcfd('0x31')]=_['keys'](_0x1c586e[_0xfcfd('0x31')]);_0x5d67ee[_0xfcfd('0x32')]=_[_0xfcfd('0x35')](_0x5d67ee['model'],_0x5d67ee[_0xfcfd('0x31')]);_0x4986b9[_0xfcfd('0x34')]=_[_0xfcfd('0x35')](_0x5d67ee[_0xfcfd('0x33')],qs['fields'](_0x1c586e['query'][_0xfcfd('0x36')]));_0x4986b9[_0xfcfd('0x34')]=_0x4986b9[_0xfcfd('0x34')]['length']?_0x4986b9['attributes']:_0x5d67ee[_0xfcfd('0x33')];_0x4986b9[_0xfcfd('0x3a')]=qs[_0xfcfd('0x3b')](_0x1c586e[_0xfcfd('0x31')][_0xfcfd('0x3b')]);_0x4986b9['where']=qs[_0xfcfd('0x32')](_[_0xfcfd('0x3d')](_0x1c586e[_0xfcfd('0x31')],_0x5d67ee['filters']));if(_0x1c586e[_0xfcfd('0x31')][_0xfcfd('0x3e')]){_0x4986b9['where']=_[_0xfcfd('0x3f')](_0x4986b9[_0xfcfd('0x3c')],{'$or':_['map'](_0x4986b9[_0xfcfd('0x34')],function(_0x5f3207){var _0x18fe3f={};_0x18fe3f[_0x5f3207]={'$like':'%'+_0x1c586e[_0xfcfd('0x31')][_0xfcfd('0x3e')]+'%'};return _0x18fe3f;})});}_0x4986b9=_[_0xfcfd('0x3f')]({},_0x4986b9,_0x1c586e[_0xfcfd('0x41')]);return _0x408b2b[_0xfcfd('0x4a')](_0x4986b9);}})['then'](function(_0x2ee9d8){if(_0x2ee9d8){_0x4c3b43=_0x2ee9d8[_0xfcfd('0x37')];if(!_0x1c586e['query'][_0xfcfd('0x38')](_0xfcfd('0x39'))){_0x4986b9[_0xfcfd('0x1d')]=qs[_0xfcfd('0x1d')](_0x1c586e[_0xfcfd('0x31')][_0xfcfd('0x1d')]);_0x4986b9[_0xfcfd('0x1b')]=qs[_0xfcfd('0x1b')](_0x1c586e[_0xfcfd('0x31')][_0xfcfd('0x1b')]);}return _0x408b2b[_0xfcfd('0x4a')](_0x4986b9);}})[_0xfcfd('0x23')](function(_0x58c156){if(_0x58c156){return _0x58c156?{'count':_0x4c3b43,'rows':_0x58c156}:null;}})[_0xfcfd('0x23')](respondWithResult(_0x3fd35d,null))[_0xfcfd('0x48')](handleError(_0x3fd35d,null));};exports[_0xfcfd('0x4d')]=function(_0x5c2282,_0x54623e,_0x56df0f){var _0x102e99={};var _0x356438={};var _0x4d283e;var _0x29bbf4;return db[_0xfcfd('0x2c')]['findOne']({'where':{'id':_0x5c2282['params']['id']}})[_0xfcfd('0x23')](handleEntityNotFound(_0x54623e,null))[_0xfcfd('0x23')](function(_0x204069){if(_0x204069){_0x4d283e=_0x204069;_0x356438[_0xfcfd('0x33')]=_[_0xfcfd('0x30')](db[_0xfcfd('0x4c')][_0xfcfd('0x2d')]);_0x356438[_0xfcfd('0x31')]=_['keys'](_0x5c2282[_0xfcfd('0x31')]);_0x356438[_0xfcfd('0x32')]=_[_0xfcfd('0x35')](_0x356438[_0xfcfd('0x33')],_0x356438[_0xfcfd('0x31')]);_0x102e99['attributes']=_['intersection'](_0x356438[_0xfcfd('0x33')],qs[_0xfcfd('0x36')](_0x5c2282['query'][_0xfcfd('0x36')]));_0x102e99[_0xfcfd('0x34')]=_0x102e99[_0xfcfd('0x34')][_0xfcfd('0x37')]?_0x102e99[_0xfcfd('0x34')]:_0x356438['model'];_0x102e99[_0xfcfd('0x3a')]=qs['sort'](_0x5c2282['query'][_0xfcfd('0x3b')]);_0x102e99['where']=qs[_0xfcfd('0x32')](_[_0xfcfd('0x3d')](_0x5c2282[_0xfcfd('0x31')],_0x356438[_0xfcfd('0x32')]));if(_0x5c2282['query']['filter']){_0x102e99[_0xfcfd('0x3c')]=_['merge'](_0x102e99[_0xfcfd('0x3c')],{'$or':_[_0xfcfd('0x2b')](_0x102e99['attributes'],function(_0x24089d){var _0x1ac1ac={};_0x1ac1ac[_0x24089d]={'$like':'%'+_0x5c2282['query'][_0xfcfd('0x3e')]+'%'};return _0x1ac1ac;})});}_0x102e99=_[_0xfcfd('0x3f')]({},_0x102e99,_0x5c2282[_0xfcfd('0x41')]);return _0x4d283e[_0xfcfd('0x4d')](_0x102e99);}})['then'](function(_0xed45fd){if(_0xed45fd){_0x29bbf4=_0xed45fd[_0xfcfd('0x37')];if(!_0x5c2282[_0xfcfd('0x31')][_0xfcfd('0x38')]('nolimit')){_0x102e99[_0xfcfd('0x1d')]=qs[_0xfcfd('0x1d')](_0x5c2282[_0xfcfd('0x31')]['limit']);_0x102e99[_0xfcfd('0x1b')]=qs[_0xfcfd('0x1b')](_0x5c2282['query'][_0xfcfd('0x1b')]);}return _0x4d283e[_0xfcfd('0x4d')](_0x102e99);}})['then'](function(_0x4b4ec7){if(_0x4b4ec7){return _0x4b4ec7?{'count':_0x29bbf4,'rows':_0x4b4ec7}:null;}})[_0xfcfd('0x23')](respondWithResult(_0x54623e,null))[_0xfcfd('0x48')](handleError(_0x54623e,null));};exports[_0xfcfd('0x4e')]=function(_0x16a6a0,_0x1b6a99,_0xbc559f){var _0x112e70={};var _0x34bfef={};var _0x58963a;var _0x543f7c;return db[_0xfcfd('0x2c')]['findOne']({'where':{'id':_0x16a6a0[_0xfcfd('0x49')]['id']}})[_0xfcfd('0x23')](handleEntityNotFound(_0x1b6a99,null))[_0xfcfd('0x23')](function(_0x420550){if(_0x420550){_0x58963a=_0x420550;_0x34bfef[_0xfcfd('0x33')]=_[_0xfcfd('0x30')](db[_0xfcfd('0x4c')][_0xfcfd('0x2d')]);_0x34bfef[_0xfcfd('0x31')]=_[_0xfcfd('0x30')](_0x16a6a0[_0xfcfd('0x31')]);_0x34bfef['filters']=_['intersection'](_0x34bfef[_0xfcfd('0x33')],_0x34bfef[_0xfcfd('0x31')]);_0x112e70[_0xfcfd('0x34')]=_[_0xfcfd('0x35')](_0x34bfef[_0xfcfd('0x33')],qs['fields'](_0x16a6a0[_0xfcfd('0x31')][_0xfcfd('0x36')]));_0x112e70[_0xfcfd('0x34')]=_0x112e70[_0xfcfd('0x34')]['length']?_0x112e70['attributes']:_0x34bfef[_0xfcfd('0x33')];_0x112e70[_0xfcfd('0x3a')]=qs[_0xfcfd('0x3b')](_0x16a6a0[_0xfcfd('0x31')][_0xfcfd('0x3b')]);_0x112e70['where']=qs[_0xfcfd('0x32')](_[_0xfcfd('0x3d')](_0x16a6a0[_0xfcfd('0x31')],_0x34bfef[_0xfcfd('0x32')]));if(_0x16a6a0[_0xfcfd('0x31')]['filter']){_0x112e70[_0xfcfd('0x3c')]=_['merge'](_0x112e70[_0xfcfd('0x3c')],{'$or':_['map'](_0x112e70[_0xfcfd('0x34')],function(_0x2199dc){var _0x13e32c={};_0x13e32c[_0x2199dc]={'$like':'%'+_0x16a6a0['query'][_0xfcfd('0x3e')]+'%'};return _0x13e32c;})});}_0x112e70=_[_0xfcfd('0x3f')]({},_0x112e70,_0x16a6a0['options']);return _0x58963a[_0xfcfd('0x4e')](_0x112e70);}})[_0xfcfd('0x23')](function(_0x648924){if(_0x648924){_0x543f7c=_0x648924[_0xfcfd('0x37')];if(!_0x16a6a0[_0xfcfd('0x31')][_0xfcfd('0x38')](_0xfcfd('0x39'))){_0x112e70[_0xfcfd('0x1d')]=qs[_0xfcfd('0x1d')](_0x16a6a0['query'][_0xfcfd('0x1d')]);_0x112e70[_0xfcfd('0x1b')]=qs['offset'](_0x16a6a0[_0xfcfd('0x31')][_0xfcfd('0x1b')]);}return _0x58963a[_0xfcfd('0x4e')](_0x112e70);}})['then'](function(_0x4dd8ec){if(_0x4dd8ec){return _0x4dd8ec?{'count':_0x543f7c,'rows':_0x4dd8ec}:null;}})['then'](respondWithResult(_0x1b6a99,null))[_0xfcfd('0x48')](handleError(_0x1b6a99,null));}; \ No newline at end of file diff --git a/server/api/intDynamics365Configuration/intDynamics365Configuration.model.js b/server/api/intDynamics365Configuration/intDynamics365Configuration.model.js index d1c96ff..74408ce 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 _0xd6d6=['path','rimraf','../../config/environment','./intDynamics365Configuration.attributes','exports','define','Dynamics365Configuration','int_dynamics365_configurations','lodash','util','../../config/logger','api','bluebird','request-promise'];(function(_0x1b46ce,_0x2c81bc){var _0x49f228=function(_0x50b921){while(--_0x50b921){_0x1b46ce['push'](_0x1b46ce['shift']());}};_0x49f228(++_0x2c81bc);}(_0xd6d6,0xbe));var _0x6d6d=function(_0x3da18e,_0x93c53){_0x3da18e=_0x3da18e-0x0;var _0x574140=_0xd6d6[_0x3da18e];return _0x574140;};'use strict';var _=require(_0x6d6d('0x0'));var util=require(_0x6d6d('0x1'));var logger=require(_0x6d6d('0x2'))(_0x6d6d('0x3'));var moment=require('moment');var BPromise=require(_0x6d6d('0x4'));var rp=require(_0x6d6d('0x5'));var fs=require('fs');var path=require(_0x6d6d('0x6'));var rimraf=require(_0x6d6d('0x7'));var config=require(_0x6d6d('0x8'));var attributes=require(_0x6d6d('0x9'));module[_0x6d6d('0xa')]=function(_0x5702dc,_0x210ff7){return _0x5702dc[_0x6d6d('0xb')](_0x6d6d('0xc'),attributes,{'tableName':_0x6d6d('0xd'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x34e8=['int_dynamics365_configurations','lodash','util','../../config/logger','api','bluebird','request-promise','path','rimraf','../../config/environment','./intDynamics365Configuration.attributes','exports','Dynamics365Configuration'];(function(_0x4db031,_0x5ebc63){var _0x348821=function(_0x134b57){while(--_0x134b57){_0x4db031['push'](_0x4db031['shift']());}};_0x348821(++_0x5ebc63);}(_0x34e8,0x12c));var _0x834e=function(_0x5ab01a,_0x3c2642){_0x5ab01a=_0x5ab01a-0x0;var _0x796cf5=_0x34e8[_0x5ab01a];return _0x796cf5;};'use strict';var _=require(_0x834e('0x0'));var util=require(_0x834e('0x1'));var logger=require(_0x834e('0x2'))(_0x834e('0x3'));var moment=require('moment');var BPromise=require(_0x834e('0x4'));var rp=require(_0x834e('0x5'));var fs=require('fs');var path=require(_0x834e('0x6'));var rimraf=require(_0x834e('0x7'));var config=require(_0x834e('0x8'));var attributes=require(_0x834e('0x9'));module[_0x834e('0xa')]=function(_0x4a2018,_0x858aa1){return _0x4a2018['define'](_0x834e('0xb'),attributes,{'tableName':_0x834e('0xc'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/intDynamics365Configuration/intDynamics365Configuration.rpc.js b/server/api/intDynamics365Configuration/intDynamics365Configuration.rpc.js index 82a0564..4e327c1 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 _0x520a=['../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','client','http','request','then','info','request\x20sent','Dynamics365Configuration,\x20%s,\x20%s,\x20%s','stringify','error','code','Dynamics365Configuration,\x20%s,\x20%s','message','result','catch','lodash','util','moment','bluebird','randomstring','ioredis'];(function(_0xa56097,_0x352e05){var _0x3dce5b=function(_0x96917c){while(--_0x96917c){_0xa56097['push'](_0xa56097['shift']());}};_0x3dce5b(++_0x352e05);}(_0x520a,0x126));var _0xa520=function(_0x9f3497,_0x2162dc){_0x9f3497=_0x9f3497-0x0;var _0x2392b5=_0x520a[_0x9f3497];return _0x2392b5;};'use strict';var _=require(_0xa520('0x0'));var util=require(_0xa520('0x1'));var moment=require(_0xa520('0x2'));var BPromise=require(_0xa520('0x3'));var rs=require(_0xa520('0x4'));var fs=require('fs');var Redis=require(_0xa520('0x5'));var db=require(_0xa520('0x6'))['db'];var utils=require(_0xa520('0x7'));var logger=require(_0xa520('0x8'))(_0xa520('0x9'));var config=require(_0xa520('0xa'));var jayson=require('jayson/promise');var client=jayson[_0xa520('0xb')][_0xa520('0xc')]({'port':0x232a});function respondWithRpcPromise(_0x14f3d1,_0x33e51a,_0x4dbb2a){return new BPromise(function(_0x29f468,_0x443540){return client[_0xa520('0xd')](_0x14f3d1,_0x4dbb2a)[_0xa520('0xe')](function(_0x2270fd){logger[_0xa520('0xf')]('Dynamics365Configuration,\x20%s,\x20%s',_0x33e51a,_0xa520('0x10'));logger['debug'](_0xa520('0x11'),_0x33e51a,_0xa520('0x10'),JSON[_0xa520('0x12')](_0x2270fd));if(_0x2270fd[_0xa520('0x13')]){if(_0x2270fd[_0xa520('0x13')][_0xa520('0x14')]===0x1f4){logger[_0xa520('0x13')](_0xa520('0x15'),_0x33e51a,_0x2270fd['error']['message']);return _0x443540(_0x2270fd['error'][_0xa520('0x16')]);}logger[_0xa520('0x13')](_0xa520('0x15'),_0x33e51a,_0x2270fd[_0xa520('0x13')][_0xa520('0x16')]);return _0x29f468(_0x2270fd[_0xa520('0x13')][_0xa520('0x16')]);}else{logger['info'](_0xa520('0x15'),_0x33e51a,'request\x20sent');_0x29f468(_0x2270fd[_0xa520('0x17')][_0xa520('0x16')]);}})[_0xa520('0x18')](function(_0x546cbf){logger[_0xa520('0x13')](_0xa520('0x15'),_0x33e51a,_0x546cbf);_0x443540(_0x546cbf);});});} \ No newline at end of file +var _0xfd85=['moment','randomstring','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','client','http','request','then','info','Dynamics365Configuration,\x20%s,\x20%s','request\x20sent','debug','Dynamics365Configuration,\x20%s,\x20%s,\x20%s','stringify','error','message','catch','lodash'];(function(_0x31062c,_0x27e404){var _0x2789c5=function(_0x43b9c0){while(--_0x43b9c0){_0x31062c['push'](_0x31062c['shift']());}};_0x2789c5(++_0x27e404);}(_0xfd85,0x1e2));var _0x5fd8=function(_0x4ff3f9,_0x202232){_0x4ff3f9=_0x4ff3f9-0x0;var _0x54fe66=_0xfd85[_0x4ff3f9];return _0x54fe66;};'use strict';var _=require(_0x5fd8('0x0'));var util=require('util');var moment=require(_0x5fd8('0x1'));var BPromise=require('bluebird');var rs=require(_0x5fd8('0x2'));var fs=require('fs');var Redis=require('ioredis');var db=require('../../mysqldb')['db'];var utils=require(_0x5fd8('0x3'));var logger=require(_0x5fd8('0x4'))(_0x5fd8('0x5'));var config=require(_0x5fd8('0x6'));var jayson=require(_0x5fd8('0x7'));var client=jayson[_0x5fd8('0x8')][_0x5fd8('0x9')]({'port':0x232a});function respondWithRpcPromise(_0x194047,_0x4f77f4,_0xb37def){return new BPromise(function(_0x16c50a,_0x4dabed){return client[_0x5fd8('0xa')](_0x194047,_0xb37def)[_0x5fd8('0xb')](function(_0x430eea){logger[_0x5fd8('0xc')](_0x5fd8('0xd'),_0x4f77f4,_0x5fd8('0xe'));logger[_0x5fd8('0xf')](_0x5fd8('0x10'),_0x4f77f4,_0x5fd8('0xe'),JSON[_0x5fd8('0x11')](_0x430eea));if(_0x430eea[_0x5fd8('0x12')]){if(_0x430eea['error']['code']===0x1f4){logger[_0x5fd8('0x12')](_0x5fd8('0xd'),_0x4f77f4,_0x430eea['error'][_0x5fd8('0x13')]);return _0x4dabed(_0x430eea[_0x5fd8('0x12')][_0x5fd8('0x13')]);}logger[_0x5fd8('0x12')](_0x5fd8('0xd'),_0x4f77f4,_0x430eea[_0x5fd8('0x12')][_0x5fd8('0x13')]);return _0x16c50a(_0x430eea[_0x5fd8('0x12')]['message']);}else{logger[_0x5fd8('0xc')]('Dynamics365Configuration,\x20%s,\x20%s',_0x4f77f4,_0x5fd8('0xe'));_0x16c50a(_0x430eea['result']['message']);}})[_0x5fd8('0x14')](function(_0x59162f){logger['error'](_0x5fd8('0xd'),_0x4f77f4,_0x59162f);_0x4dabed(_0x59162f);});});} \ No newline at end of file diff --git a/server/api/intDynamics365Field/index.js b/server/api/intDynamics365Field/index.js index 85f0f5a..49ebca5 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 _0x93f3=['/:id','create','put','delete','destroy','multer','util','path','connect-timeout','express','../../components/auth/service','../../components/interaction/service','../../config/environment','./intDynamics365Field.controller','get','isAuthenticated','index'];(function(_0x1caf6a,_0x26a5bf){var _0x1bf493=function(_0x3982f5){while(--_0x3982f5){_0x1caf6a['push'](_0x1caf6a['shift']());}};_0x1bf493(++_0x26a5bf);}(_0x93f3,0x1d0));var _0x393f=function(_0x16e46f,_0x146b7b){_0x16e46f=_0x16e46f-0x0;var _0x48f296=_0x93f3[_0x16e46f];return _0x48f296;};'use strict';var multer=require(_0x393f('0x0'));var util=require(_0x393f('0x1'));var path=require(_0x393f('0x2'));var timeout=require(_0x393f('0x3'));var express=require(_0x393f('0x4'));var router=express['Router']();var fs_extra=require('fs-extra');var auth=require(_0x393f('0x5'));var interaction=require(_0x393f('0x6'));var config=require(_0x393f('0x7'));var controller=require(_0x393f('0x8'));router[_0x393f('0x9')]('/',auth[_0x393f('0xa')](),controller[_0x393f('0xb')]);router[_0x393f('0x9')](_0x393f('0xc'),auth[_0x393f('0xa')](),controller['show']);router['post']('/',auth[_0x393f('0xa')](),controller[_0x393f('0xd')]);router[_0x393f('0xe')]('/:id',auth['isAuthenticated'](),controller['update']);router[_0x393f('0xf')](_0x393f('0xc'),auth[_0x393f('0xa')](),controller[_0x393f('0x10')]);module['exports']=router; \ No newline at end of file +var _0x4406=['path','connect-timeout','express','Router','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','isAuthenticated','index','get','/:id','post','create','put','delete','destroy','multer','util'];(function(_0x36a469,_0x59d84c){var _0x3347fc=function(_0x3860e7){while(--_0x3860e7){_0x36a469['push'](_0x36a469['shift']());}};_0x3347fc(++_0x59d84c);}(_0x4406,0x154));var _0x6440=function(_0x382d8e,_0x2a5761){_0x382d8e=_0x382d8e-0x0;var _0x23993d=_0x4406[_0x382d8e];return _0x23993d;};'use strict';var multer=require(_0x6440('0x0'));var util=require(_0x6440('0x1'));var path=require(_0x6440('0x2'));var timeout=require(_0x6440('0x3'));var express=require(_0x6440('0x4'));var router=express[_0x6440('0x5')]();var fs_extra=require(_0x6440('0x6'));var auth=require(_0x6440('0x7'));var interaction=require(_0x6440('0x8'));var config=require(_0x6440('0x9'));var controller=require('./intDynamics365Field.controller');router['get']('/',auth[_0x6440('0xa')](),controller[_0x6440('0xb')]);router[_0x6440('0xc')](_0x6440('0xd'),auth['isAuthenticated'](),controller['show']);router[_0x6440('0xe')]('/',auth[_0x6440('0xa')](),controller[_0x6440('0xf')]);router[_0x6440('0x10')]('/:id',auth[_0x6440('0xa')](),controller['update']);router[_0x6440('0x11')](_0x6440('0xd'),auth[_0x6440('0xa')](),controller[_0x6440('0x12')]);module['exports']=router; \ No newline at end of file diff --git a/server/api/intDynamics365Field/intDynamics365Field.attributes.js b/server/api/intDynamics365Field/intDynamics365Field.attributes.js index ce7f28b..8b92ee1 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 _0xe5b0=['ENUM','string','variable','customVariable','keyValue','picklist','STRING','BOOLEAN','sequelize','exports'];(function(_0x147010,_0x225eb4){var _0x5654a5=function(_0x544740){while(--_0x544740){_0x147010['push'](_0x147010['shift']());}};_0x5654a5(++_0x225eb4);}(_0xe5b0,0x76));var _0x0e5b=function(_0x4ccea0,_0x5bb935){_0x4ccea0=_0x4ccea0-0x0;var _0x7de42f=_0xe5b0[_0x4ccea0];return _0x7de42f;};'use strict';var Sequelize=require(_0x0e5b('0x0'));module[_0x0e5b('0x1')]={'type':{'type':Sequelize[_0x0e5b('0x2')](_0x0e5b('0x3'),_0x0e5b('0x4'),_0x0e5b('0x5'),_0x0e5b('0x6'),_0x0e5b('0x7')),'defaultValue':'string'},'content':{'type':Sequelize[_0x0e5b('0x8')]},'key':{'type':Sequelize[_0x0e5b('0x8')]},'keyType':{'type':Sequelize[_0x0e5b('0x2')](_0x0e5b('0x3'),_0x0e5b('0x4'),_0x0e5b('0x5'))},'keyContent':{'type':Sequelize[_0x0e5b('0x8')]},'idField':{'type':Sequelize[_0x0e5b('0x8')]},'nameField':{'type':Sequelize['STRING']},'customField':{'type':Sequelize[_0x0e5b('0x9')],'defaultValue':!![]},'variableName':{'type':Sequelize[_0x0e5b('0x8')]}}; \ No newline at end of file +var _0xc7df=['ENUM','string','customVariable','keyValue','STRING','variable','BOOLEAN','sequelize'];(function(_0x27b0e4,_0xfcb896){var _0x5f0d80=function(_0x243091){while(--_0x243091){_0x27b0e4['push'](_0x27b0e4['shift']());}};_0x5f0d80(++_0xfcb896);}(_0xc7df,0x87));var _0xfc7d=function(_0x57915a,_0x3b5c45){_0x57915a=_0x57915a-0x0;var _0x15d7e2=_0xc7df[_0x57915a];return _0x15d7e2;};'use strict';var Sequelize=require(_0xfc7d('0x0'));module['exports']={'type':{'type':Sequelize[_0xfc7d('0x1')](_0xfc7d('0x2'),'variable',_0xfc7d('0x3'),_0xfc7d('0x4'),'picklist'),'defaultValue':'string'},'content':{'type':Sequelize[_0xfc7d('0x5')]},'key':{'type':Sequelize[_0xfc7d('0x5')]},'keyType':{'type':Sequelize['ENUM'](_0xfc7d('0x2'),_0xfc7d('0x6'),_0xfc7d('0x3'))},'keyContent':{'type':Sequelize['STRING']},'idField':{'type':Sequelize[_0xfc7d('0x5')]},'nameField':{'type':Sequelize[_0xfc7d('0x5')]},'customField':{'type':Sequelize[_0xfc7d('0x7')],'defaultValue':!![]},'variableName':{'type':Sequelize[_0xfc7d('0x5')]}}; \ No newline at end of file diff --git a/server/api/intDynamics365Field/intDynamics365Field.controller.js b/server/api/intDynamics365Field/intDynamics365Field.controller.js index 1b031f0..fc926c0 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 _0xafc3=['desk.js','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/advancedSearch','../../config/logger','api','../../config/utils','../../config/environment','../../config/license/util','status','end','undefined','count','offset','limit','set','json','reject','save','update','then','sendStatus','error','name','send','index','map','Dynamics365Field','rawAttributes','fieldName','type','key','model','query','filters','intersection','attributes','fields','length','hasOwnProperty','nolimit','order','sort','where','pick','filter','merge','VIRTUAL','includeAll','include','findAll','rows','catch','show','params','keys','options','body','find','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','bluebird','mustache','util','path','sox','to-csv','ejs','fs-extra','squel'];(function(_0x129c2f,_0x49d0d5){var _0x58b513=function(_0xe1a4c0){while(--_0xe1a4c0){_0x129c2f['push'](_0x129c2f['shift']());}};_0x58b513(++_0x49d0d5);}(_0xafc3,0x88));var _0x3afc=function(_0x58c20f,_0x4cdb1b){_0x58c20f=_0x58c20f-0x0;var _0x3b0318=_0xafc3[_0x58c20f];return _0x3b0318;};'use strict';var emlformat=require(_0x3afc('0x0'));var rimraf=require(_0x3afc('0x1'));var zipdir=require(_0x3afc('0x2'));var jsonpatch=require(_0x3afc('0x3'));var rp=require(_0x3afc('0x4'));var moment=require('moment');var BPromise=require(_0x3afc('0x5'));var Mustache=require(_0x3afc('0x6'));var util=require(_0x3afc('0x7'));var path=require(_0x3afc('0x8'));var sox=require(_0x3afc('0x9'));var csv=require(_0x3afc('0xa'));var ejs=require(_0x3afc('0xb'));var fs=require('fs');var fs_extra=require(_0x3afc('0xc'));var _=require('lodash');var squel=require(_0x3afc('0xd'));var crypto=require('crypto');var jsforce=require('jsforce');var deskjs=require(_0x3afc('0xe'));var toCsv=require('to-csv');var querystring=require(_0x3afc('0xf'));var Papa=require(_0x3afc('0x10'));var Redis=require(_0x3afc('0x11'));var authService=require(_0x3afc('0x12'));var qs=require('../../components/parsers/qs');var as=require(_0x3afc('0x13'));var hardwareService=require('../../config/license/hardware');var logger=require(_0x3afc('0x14'))(_0x3afc('0x15'));var utils=require(_0x3afc('0x16'));var config=require(_0x3afc('0x17'));var licenseUtil=require(_0x3afc('0x18'));var db=require('../../mysqldb')['db'];function respondWithStatusCode(_0x3af05d,_0x2b8c92){_0x2b8c92=_0x2b8c92||0xcc;return function(_0x588e1a){if(_0x588e1a){return _0x3af05d['sendStatus'](_0x2b8c92);}return _0x3af05d[_0x3afc('0x19')](_0x2b8c92)[_0x3afc('0x1a')]();};}function respondWithResult(_0x406b02,_0x85ed71){_0x85ed71=_0x85ed71||0xc8;return function(_0x322eaa){if(_0x322eaa){return _0x406b02[_0x3afc('0x19')](_0x85ed71)['json'](_0x322eaa);}};}function respondWithFilteredResult(_0x47dfab,_0x3b7f68){return function(_0x55cf20){if(_0x55cf20){var _0xe2c981=typeof _0x3b7f68['offset']===_0x3afc('0x1b')&&typeof _0x3b7f68['limit']==='undefined';var _0x5aaada=_0x55cf20[_0x3afc('0x1c')];var _0xa3156=_0xe2c981?0x0:_0x3b7f68['offset'];var _0x1a0ef2=_0xe2c981?_0x55cf20[_0x3afc('0x1c')]:_0x3b7f68[_0x3afc('0x1d')]+_0x3b7f68[_0x3afc('0x1e')];var _0x5126d2;if(_0x1a0ef2>=_0x5aaada){_0x1a0ef2=_0x5aaada;_0x5126d2=0xc8;}else{_0x5126d2=0xce;}_0x47dfab[_0x3afc('0x19')](_0x5126d2);return _0x47dfab[_0x3afc('0x1f')]('Content-Range',_0xa3156+'-'+_0x1a0ef2+'/'+_0x5aaada)[_0x3afc('0x20')](_0x55cf20);}return null;};}function patchUpdates(_0x4a97f3){return function(_0x75fec7){try{jsonpatch['apply'](_0x75fec7,_0x4a97f3,!![]);}catch(_0x4aa50c){return BPromise[_0x3afc('0x21')](_0x4aa50c);}return _0x75fec7[_0x3afc('0x22')]();};}function saveUpdates(_0x288cbb,_0x3d37f4){return function(_0x1e5862){if(_0x1e5862){return _0x1e5862[_0x3afc('0x23')](_0x288cbb)[_0x3afc('0x24')](function(_0x521b76){return _0x521b76;});}return null;};}function removeEntity(_0x5b9e41,_0x330cc9){return function(_0x3cd72f){if(_0x3cd72f){return _0x3cd72f['destroy']()[_0x3afc('0x24')](function(){_0x5b9e41[_0x3afc('0x19')](0xcc)[_0x3afc('0x1a')]();});}};}function handleEntityNotFound(_0x1621d9,_0x56b573){return function(_0x2dac0a){if(!_0x2dac0a){_0x1621d9[_0x3afc('0x25')](0x194);}return _0x2dac0a;};}function handleError(_0x5d8365,_0x3cadb9){_0x3cadb9=_0x3cadb9||0x1f4;return function(_0x4318ef){logger[_0x3afc('0x26')](_0x4318ef['stack']);if(_0x4318ef['name']){delete _0x4318ef[_0x3afc('0x27')];}_0x5d8365[_0x3afc('0x19')](_0x3cadb9)[_0x3afc('0x28')](_0x4318ef);};}exports[_0x3afc('0x29')]=function(_0x20c985,_0x338d46){var _0x4744b4={},_0x181a89={},_0x2bb411={'count':0x0,'rows':[]};var _0x30fdb6=_[_0x3afc('0x2a')](db[_0x3afc('0x2b')][_0x3afc('0x2c')],function(_0x15a7d0){return{'name':_0x15a7d0[_0x3afc('0x2d')],'type':_0x15a7d0[_0x3afc('0x2e')][_0x3afc('0x2f')]};});_0x181a89[_0x3afc('0x30')]=_['map'](_0x30fdb6,_0x3afc('0x27'));_0x181a89[_0x3afc('0x31')]=_['keys'](_0x20c985[_0x3afc('0x31')]);_0x181a89[_0x3afc('0x32')]=_[_0x3afc('0x33')](_0x181a89['model'],_0x181a89[_0x3afc('0x31')]);_0x4744b4[_0x3afc('0x34')]=_[_0x3afc('0x33')](_0x181a89[_0x3afc('0x30')],qs[_0x3afc('0x35')](_0x20c985[_0x3afc('0x31')][_0x3afc('0x35')]));_0x4744b4[_0x3afc('0x34')]=_0x4744b4[_0x3afc('0x34')][_0x3afc('0x36')]?_0x4744b4[_0x3afc('0x34')]:_0x181a89['model'];if(!_0x20c985[_0x3afc('0x31')][_0x3afc('0x37')](_0x3afc('0x38'))){_0x4744b4['limit']=qs[_0x3afc('0x1e')](_0x20c985[_0x3afc('0x31')][_0x3afc('0x1e')]);_0x4744b4['offset']=qs['offset'](_0x20c985[_0x3afc('0x31')]['offset']);}_0x4744b4[_0x3afc('0x39')]=qs[_0x3afc('0x3a')](_0x20c985[_0x3afc('0x31')][_0x3afc('0x3a')]);_0x4744b4[_0x3afc('0x3b')]=qs['filters'](_[_0x3afc('0x3c')](_0x20c985[_0x3afc('0x31')],_0x181a89[_0x3afc('0x32')]),_0x30fdb6);if(_0x20c985['query'][_0x3afc('0x3d')]){_0x4744b4[_0x3afc('0x3b')]=_[_0x3afc('0x3e')](_0x4744b4['where'],{'$or':_[_0x3afc('0x2a')](_0x30fdb6,function(_0x4d7878){if(_0x4d7878['type']!==_0x3afc('0x3f')){var _0x1ea26b={};_0x1ea26b[_0x4d7878[_0x3afc('0x27')]]={'$like':'%'+_0x20c985[_0x3afc('0x31')][_0x3afc('0x3d')]+'%'};return _0x1ea26b;}})});}_0x4744b4=_[_0x3afc('0x3e')]({},_0x4744b4,_0x20c985['options']);var _0x30268e={'where':_0x4744b4[_0x3afc('0x3b')]};return db['Dynamics365Field'][_0x3afc('0x1c')](_0x30268e)[_0x3afc('0x24')](function(_0x34e25b){_0x2bb411[_0x3afc('0x1c')]=_0x34e25b;if(_0x20c985[_0x3afc('0x31')][_0x3afc('0x40')]){_0x4744b4[_0x3afc('0x41')]=[{'all':!![]}];}return db[_0x3afc('0x2b')][_0x3afc('0x42')](_0x4744b4);})[_0x3afc('0x24')](function(_0x4bde72){_0x2bb411[_0x3afc('0x43')]=_0x4bde72;return _0x2bb411;})[_0x3afc('0x24')](respondWithFilteredResult(_0x338d46,_0x4744b4))[_0x3afc('0x44')](handleError(_0x338d46,null));};exports[_0x3afc('0x45')]=function(_0x293aba,_0x44b3b9){var _0x52e692={'raw':!![],'where':{'id':_0x293aba[_0x3afc('0x46')]['id']}},_0x27e4c2={};_0x27e4c2[_0x3afc('0x30')]=_['keys'](db[_0x3afc('0x2b')]['rawAttributes']);_0x27e4c2[_0x3afc('0x31')]=_[_0x3afc('0x47')](_0x293aba['query']);_0x27e4c2[_0x3afc('0x32')]=_['intersection'](_0x27e4c2[_0x3afc('0x30')],_0x27e4c2[_0x3afc('0x31')]);_0x52e692[_0x3afc('0x34')]=_[_0x3afc('0x33')](_0x27e4c2[_0x3afc('0x30')],qs['fields'](_0x293aba[_0x3afc('0x31')][_0x3afc('0x35')]));_0x52e692[_0x3afc('0x34')]=_0x52e692[_0x3afc('0x34')][_0x3afc('0x36')]?_0x52e692[_0x3afc('0x34')]:_0x27e4c2[_0x3afc('0x30')];if(_0x293aba[_0x3afc('0x31')][_0x3afc('0x40')]){_0x52e692[_0x3afc('0x41')]=[{'all':!![]}];}_0x52e692=_[_0x3afc('0x3e')]({},_0x52e692,_0x293aba[_0x3afc('0x48')]);return db[_0x3afc('0x2b')]['find'](_0x52e692)[_0x3afc('0x24')](handleEntityNotFound(_0x44b3b9,null))[_0x3afc('0x24')](respondWithResult(_0x44b3b9,null))[_0x3afc('0x44')](handleError(_0x44b3b9,null));};exports['create']=function(_0x5e9eb3,_0x39017d){return db[_0x3afc('0x2b')]['create'](_0x5e9eb3['body'],{})[_0x3afc('0x24')](respondWithResult(_0x39017d,0xc9))[_0x3afc('0x44')](handleError(_0x39017d,null));};exports[_0x3afc('0x23')]=function(_0x5bb411,_0x284f73){if(_0x5bb411[_0x3afc('0x49')]['id']){delete _0x5bb411['body']['id'];}return db['Dynamics365Field'][_0x3afc('0x4a')]({'where':{'id':_0x5bb411['params']['id']}})[_0x3afc('0x24')](handleEntityNotFound(_0x284f73,null))['then'](saveUpdates(_0x5bb411[_0x3afc('0x49')],null))[_0x3afc('0x24')](respondWithResult(_0x284f73,null))[_0x3afc('0x44')](handleError(_0x284f73,null));};exports['destroy']=function(_0x235d57,_0x2abf4c){return db[_0x3afc('0x2b')][_0x3afc('0x4a')]({'where':{'id':_0x235d57[_0x3afc('0x46')]['id']}})[_0x3afc('0x24')](handleEntityNotFound(_0x2abf4c,null))[_0x3afc('0x24')](removeEntity(_0x2abf4c,null))[_0x3afc('0x44')](handleError(_0x2abf4c,null));}; \ No newline at end of file +var _0xd5b2=['crypto','jsforce','desk.js','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','api','../../config/environment','../../config/license/util','../../mysqldb','sendStatus','status','end','limit','undefined','count','offset','json','apply','reject','save','update','then','destroy','error','stack','name','index','rawAttributes','type','model','query','keys','filters','intersection','attributes','fields','length','hasOwnProperty','nolimit','sort','where','pick','filter','map','merge','Dynamics365Field','include','findAll','rows','show','params','catch','create','body','find','eml-format','fast-json-patch','request-promise','moment','mustache','util','ejs','lodash'];(function(_0x20b6e9,_0x310f1f){var _0x2a7812=function(_0x46a5ac){while(--_0x46a5ac){_0x20b6e9['push'](_0x20b6e9['shift']());}};_0x2a7812(++_0x310f1f);}(_0xd5b2,0x1bf));var _0x2d5b=function(_0x47a7d0,_0x4e182d){_0x47a7d0=_0x47a7d0-0x0;var _0xb9bd08=_0xd5b2[_0x47a7d0];return _0xb9bd08;};'use strict';var emlformat=require(_0x2d5b('0x0'));var rimraf=require('rimraf');var zipdir=require('zip-dir');var jsonpatch=require(_0x2d5b('0x1'));var rp=require(_0x2d5b('0x2'));var moment=require(_0x2d5b('0x3'));var BPromise=require('bluebird');var Mustache=require(_0x2d5b('0x4'));var util=require(_0x2d5b('0x5'));var path=require('path');var sox=require('sox');var csv=require('to-csv');var ejs=require(_0x2d5b('0x6'));var fs=require('fs');var fs_extra=require('fs-extra');var _=require(_0x2d5b('0x7'));var squel=require('squel');var crypto=require(_0x2d5b('0x8'));var jsforce=require(_0x2d5b('0x9'));var deskjs=require(_0x2d5b('0xa'));var toCsv=require('to-csv');var querystring=require('querystring');var Papa=require('papaparse');var Redis=require(_0x2d5b('0xb'));var authService=require(_0x2d5b('0xc'));var qs=require(_0x2d5b('0xd'));var as=require(_0x2d5b('0xe'));var hardwareService=require('../../config/license/hardware');var logger=require('../../config/logger')(_0x2d5b('0xf'));var utils=require('../../config/utils');var config=require(_0x2d5b('0x10'));var licenseUtil=require(_0x2d5b('0x11'));var db=require(_0x2d5b('0x12'))['db'];function respondWithStatusCode(_0x28a191,_0x1fd581){_0x1fd581=_0x1fd581||0xcc;return function(_0x5c317d){if(_0x5c317d){return _0x28a191[_0x2d5b('0x13')](_0x1fd581);}return _0x28a191[_0x2d5b('0x14')](_0x1fd581)[_0x2d5b('0x15')]();};}function respondWithResult(_0x80af1d,_0x3e1498){_0x3e1498=_0x3e1498||0xc8;return function(_0x3a116b){if(_0x3a116b){return _0x80af1d['status'](_0x3e1498)['json'](_0x3a116b);}};}function respondWithFilteredResult(_0x176970,_0xe5bae4){return function(_0xb7f106){if(_0xb7f106){var _0x17d9c5=typeof _0xe5bae4['offset']==='undefined'&&typeof _0xe5bae4[_0x2d5b('0x16')]===_0x2d5b('0x17');var _0x1d1df0=_0xb7f106[_0x2d5b('0x18')];var _0xd4c5f8=_0x17d9c5?0x0:_0xe5bae4[_0x2d5b('0x19')];var _0x2ee6a5=_0x17d9c5?_0xb7f106[_0x2d5b('0x18')]:_0xe5bae4[_0x2d5b('0x19')]+_0xe5bae4[_0x2d5b('0x16')];var _0x259fa7;if(_0x2ee6a5>=_0x1d1df0){_0x2ee6a5=_0x1d1df0;_0x259fa7=0xc8;}else{_0x259fa7=0xce;}_0x176970[_0x2d5b('0x14')](_0x259fa7);return _0x176970['set']('Content-Range',_0xd4c5f8+'-'+_0x2ee6a5+'/'+_0x1d1df0)[_0x2d5b('0x1a')](_0xb7f106);}return null;};}function patchUpdates(_0x474f40){return function(_0x3de8c1){try{jsonpatch[_0x2d5b('0x1b')](_0x3de8c1,_0x474f40,!![]);}catch(_0x320a17){return BPromise[_0x2d5b('0x1c')](_0x320a17);}return _0x3de8c1[_0x2d5b('0x1d')]();};}function saveUpdates(_0x54f172,_0x4582c9){return function(_0x3351f4){if(_0x3351f4){return _0x3351f4[_0x2d5b('0x1e')](_0x54f172)[_0x2d5b('0x1f')](function(_0x42a500){return _0x42a500;});}return null;};}function removeEntity(_0x1c1d4a,_0x2fc640){return function(_0xbc81cf){if(_0xbc81cf){return _0xbc81cf[_0x2d5b('0x20')]()[_0x2d5b('0x1f')](function(){_0x1c1d4a[_0x2d5b('0x14')](0xcc)[_0x2d5b('0x15')]();});}};}function handleEntityNotFound(_0xb09d13,_0x3518ce){return function(_0x3f65e6){if(!_0x3f65e6){_0xb09d13[_0x2d5b('0x13')](0x194);}return _0x3f65e6;};}function handleError(_0x10d272,_0x3937aa){_0x3937aa=_0x3937aa||0x1f4;return function(_0x52f28d){logger[_0x2d5b('0x21')](_0x52f28d[_0x2d5b('0x22')]);if(_0x52f28d[_0x2d5b('0x23')]){delete _0x52f28d[_0x2d5b('0x23')];}_0x10d272[_0x2d5b('0x14')](_0x3937aa)['send'](_0x52f28d);};}exports[_0x2d5b('0x24')]=function(_0x340f3d,_0x44240b){var _0x402565={},_0x14b94d={},_0x4800f5={'count':0x0,'rows':[]};var _0x2ea899=_['map'](db['Dynamics365Field'][_0x2d5b('0x25')],function(_0x4d91ac){return{'name':_0x4d91ac['fieldName'],'type':_0x4d91ac[_0x2d5b('0x26')]['key']};});_0x14b94d[_0x2d5b('0x27')]=_['map'](_0x2ea899,_0x2d5b('0x23'));_0x14b94d[_0x2d5b('0x28')]=_[_0x2d5b('0x29')](_0x340f3d[_0x2d5b('0x28')]);_0x14b94d[_0x2d5b('0x2a')]=_[_0x2d5b('0x2b')](_0x14b94d[_0x2d5b('0x27')],_0x14b94d[_0x2d5b('0x28')]);_0x402565[_0x2d5b('0x2c')]=_[_0x2d5b('0x2b')](_0x14b94d[_0x2d5b('0x27')],qs['fields'](_0x340f3d[_0x2d5b('0x28')][_0x2d5b('0x2d')]));_0x402565[_0x2d5b('0x2c')]=_0x402565[_0x2d5b('0x2c')][_0x2d5b('0x2e')]?_0x402565['attributes']:_0x14b94d[_0x2d5b('0x27')];if(!_0x340f3d[_0x2d5b('0x28')][_0x2d5b('0x2f')](_0x2d5b('0x30'))){_0x402565[_0x2d5b('0x16')]=qs[_0x2d5b('0x16')](_0x340f3d[_0x2d5b('0x28')][_0x2d5b('0x16')]);_0x402565[_0x2d5b('0x19')]=qs[_0x2d5b('0x19')](_0x340f3d[_0x2d5b('0x28')][_0x2d5b('0x19')]);}_0x402565['order']=qs[_0x2d5b('0x31')](_0x340f3d[_0x2d5b('0x28')][_0x2d5b('0x31')]);_0x402565[_0x2d5b('0x32')]=qs[_0x2d5b('0x2a')](_[_0x2d5b('0x33')](_0x340f3d['query'],_0x14b94d[_0x2d5b('0x2a')]),_0x2ea899);if(_0x340f3d[_0x2d5b('0x28')][_0x2d5b('0x34')]){_0x402565[_0x2d5b('0x32')]=_['merge'](_0x402565[_0x2d5b('0x32')],{'$or':_[_0x2d5b('0x35')](_0x2ea899,function(_0x47e7da){if(_0x47e7da[_0x2d5b('0x26')]!=='VIRTUAL'){var _0x7eecc2={};_0x7eecc2[_0x47e7da['name']]={'$like':'%'+_0x340f3d[_0x2d5b('0x28')][_0x2d5b('0x34')]+'%'};return _0x7eecc2;}})});}_0x402565=_[_0x2d5b('0x36')]({},_0x402565,_0x340f3d['options']);var _0xecc1c2={'where':_0x402565[_0x2d5b('0x32')]};return db[_0x2d5b('0x37')]['count'](_0xecc1c2)['then'](function(_0x3450f9){_0x4800f5[_0x2d5b('0x18')]=_0x3450f9;if(_0x340f3d[_0x2d5b('0x28')]['includeAll']){_0x402565[_0x2d5b('0x38')]=[{'all':!![]}];}return db['Dynamics365Field'][_0x2d5b('0x39')](_0x402565);})['then'](function(_0xc162cd){_0x4800f5[_0x2d5b('0x3a')]=_0xc162cd;return _0x4800f5;})[_0x2d5b('0x1f')](respondWithFilteredResult(_0x44240b,_0x402565))['catch'](handleError(_0x44240b,null));};exports[_0x2d5b('0x3b')]=function(_0x397af4,_0x2dc337){var _0x5a54ab={'raw':!![],'where':{'id':_0x397af4[_0x2d5b('0x3c')]['id']}},_0x3e1d9b={};_0x3e1d9b[_0x2d5b('0x27')]=_['keys'](db[_0x2d5b('0x37')][_0x2d5b('0x25')]);_0x3e1d9b[_0x2d5b('0x28')]=_[_0x2d5b('0x29')](_0x397af4[_0x2d5b('0x28')]);_0x3e1d9b[_0x2d5b('0x2a')]=_[_0x2d5b('0x2b')](_0x3e1d9b[_0x2d5b('0x27')],_0x3e1d9b[_0x2d5b('0x28')]);_0x5a54ab[_0x2d5b('0x2c')]=_[_0x2d5b('0x2b')](_0x3e1d9b[_0x2d5b('0x27')],qs[_0x2d5b('0x2d')](_0x397af4[_0x2d5b('0x28')][_0x2d5b('0x2d')]));_0x5a54ab['attributes']=_0x5a54ab['attributes']['length']?_0x5a54ab[_0x2d5b('0x2c')]:_0x3e1d9b[_0x2d5b('0x27')];if(_0x397af4[_0x2d5b('0x28')]['includeAll']){_0x5a54ab['include']=[{'all':!![]}];}_0x5a54ab=_[_0x2d5b('0x36')]({},_0x5a54ab,_0x397af4['options']);return db[_0x2d5b('0x37')]['find'](_0x5a54ab)['then'](handleEntityNotFound(_0x2dc337,null))[_0x2d5b('0x1f')](respondWithResult(_0x2dc337,null))[_0x2d5b('0x3d')](handleError(_0x2dc337,null));};exports['create']=function(_0x2fc54b,_0xe5486e){return db[_0x2d5b('0x37')][_0x2d5b('0x3e')](_0x2fc54b[_0x2d5b('0x3f')],{})['then'](respondWithResult(_0xe5486e,0xc9))[_0x2d5b('0x3d')](handleError(_0xe5486e,null));};exports[_0x2d5b('0x1e')]=function(_0x271641,_0xde57f){if(_0x271641[_0x2d5b('0x3f')]['id']){delete _0x271641[_0x2d5b('0x3f')]['id'];}return db['Dynamics365Field'][_0x2d5b('0x40')]({'where':{'id':_0x271641[_0x2d5b('0x3c')]['id']}})[_0x2d5b('0x1f')](handleEntityNotFound(_0xde57f,null))[_0x2d5b('0x1f')](saveUpdates(_0x271641[_0x2d5b('0x3f')],null))[_0x2d5b('0x1f')](respondWithResult(_0xde57f,null))[_0x2d5b('0x3d')](handleError(_0xde57f,null));};exports[_0x2d5b('0x20')]=function(_0x2782f7,_0x25fb74){return db[_0x2d5b('0x37')][_0x2d5b('0x40')]({'where':{'id':_0x2782f7[_0x2d5b('0x3c')]['id']}})[_0x2d5b('0x1f')](handleEntityNotFound(_0x25fb74,null))[_0x2d5b('0x1f')](removeEntity(_0x25fb74,null))['catch'](handleError(_0x25fb74,null));}; \ No newline at end of file diff --git a/server/api/intDynamics365Field/intDynamics365Field.model.js b/server/api/intDynamics365Field/intDynamics365Field.model.js index 6a460a8..17016fd 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 _0x9d1b=['int_dynamics365_fields','dynamics365_unique_index','FieldId','util','../../config/logger','api','moment','bluebird','request-promise','path','rimraf','./intDynamics365Field.attributes','exports','define','Dynamics365Field'];(function(_0x3727df,_0x42638a){var _0x49203b=function(_0x48c507){while(--_0x48c507){_0x3727df['push'](_0x3727df['shift']());}};_0x49203b(++_0x42638a);}(_0x9d1b,0x1d4));var _0xb9d1=function(_0xe077c0,_0x220fa4){_0xe077c0=_0xe077c0-0x0;var _0x4e724d=_0x9d1b[_0xe077c0];return _0x4e724d;};'use strict';var _=require('lodash');var util=require(_0xb9d1('0x0'));var logger=require(_0xb9d1('0x1'))(_0xb9d1('0x2'));var moment=require(_0xb9d1('0x3'));var BPromise=require(_0xb9d1('0x4'));var rp=require(_0xb9d1('0x5'));var fs=require('fs');var path=require(_0xb9d1('0x6'));var rimraf=require(_0xb9d1('0x7'));var config=require('../../config/environment');var attributes=require(_0xb9d1('0x8'));module[_0xb9d1('0x9')]=function(_0x2571d2,_0x6a3e8b){return _0x2571d2[_0xb9d1('0xa')](_0xb9d1('0xb'),attributes,{'tableName':_0xb9d1('0xc'),'paranoid':![],'indexes':[{'name':_0xb9d1('0xd'),'fields':['idField',_0xb9d1('0xe')],'unique':!![]}],'timestamps':!![]});}; \ No newline at end of file +var _0xc811=['Dynamics365Field','int_dynamics365_fields','dynamics365_unique_index','idField','FieldId','util','../../config/logger','api','moment','bluebird','request-promise','path','rimraf','../../config/environment','./intDynamics365Field.attributes','define'];(function(_0x33c90f,_0x179298){var _0x36006a=function(_0x277d33){while(--_0x277d33){_0x33c90f['push'](_0x33c90f['shift']());}};_0x36006a(++_0x179298);}(_0xc811,0x85));var _0x1c81=function(_0x5b1a86,_0x458f93){_0x5b1a86=_0x5b1a86-0x0;var _0x210b57=_0xc811[_0x5b1a86];return _0x210b57;};'use strict';var _=require('lodash');var util=require(_0x1c81('0x0'));var logger=require(_0x1c81('0x1'))(_0x1c81('0x2'));var moment=require(_0x1c81('0x3'));var BPromise=require(_0x1c81('0x4'));var rp=require(_0x1c81('0x5'));var fs=require('fs');var path=require(_0x1c81('0x6'));var rimraf=require(_0x1c81('0x7'));var config=require(_0x1c81('0x8'));var attributes=require(_0x1c81('0x9'));module['exports']=function(_0x16499a,_0x4dd3d7){return _0x16499a[_0x1c81('0xa')](_0x1c81('0xb'),attributes,{'tableName':_0x1c81('0xc'),'paranoid':![],'indexes':[{'name':_0x1c81('0xd'),'fields':[_0x1c81('0xe'),_0x1c81('0xf')],'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 6661cf2..5e1112d 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 _0x7d27=['randomstring','../../mysqldb','../../config/utils','../../config/logger','../../config/environment','jayson/promise','client','request','then','info','Dynamics365Field,\x20%s,\x20%s','request\x20sent','Dynamics365Field,\x20%s,\x20%s,\x20%s','error','message','result','util'];(function(_0x5cbace,_0x33943c){var _0x6de5b8=function(_0x5aae38){while(--_0x5aae38){_0x5cbace['push'](_0x5cbace['shift']());}};_0x6de5b8(++_0x33943c);}(_0x7d27,0xed));var _0x77d2=function(_0x1ac6a9,_0x155ff5){_0x1ac6a9=_0x1ac6a9-0x0;var _0xc65684=_0x7d27[_0x1ac6a9];return _0xc65684;};'use strict';var _=require('lodash');var util=require(_0x77d2('0x0'));var moment=require('moment');var BPromise=require('bluebird');var rs=require(_0x77d2('0x1'));var fs=require('fs');var Redis=require('ioredis');var db=require(_0x77d2('0x2'))['db'];var utils=require(_0x77d2('0x3'));var logger=require(_0x77d2('0x4'))('rpc');var config=require(_0x77d2('0x5'));var jayson=require(_0x77d2('0x6'));var client=jayson[_0x77d2('0x7')]['http']({'port':0x232a});function respondWithRpcPromise(_0x365afe,_0x14a175,_0x2f7dda){return new BPromise(function(_0x41e058,_0x8db0dd){return client[_0x77d2('0x8')](_0x365afe,_0x2f7dda)[_0x77d2('0x9')](function(_0x3f5e1f){logger[_0x77d2('0xa')](_0x77d2('0xb'),_0x14a175,_0x77d2('0xc'));logger['debug'](_0x77d2('0xd'),_0x14a175,_0x77d2('0xc'),JSON['stringify'](_0x3f5e1f));if(_0x3f5e1f['error']){if(_0x3f5e1f['error']['code']===0x1f4){logger[_0x77d2('0xe')](_0x77d2('0xb'),_0x14a175,_0x3f5e1f['error'][_0x77d2('0xf')]);return _0x8db0dd(_0x3f5e1f['error']['message']);}logger[_0x77d2('0xe')](_0x77d2('0xb'),_0x14a175,_0x3f5e1f[_0x77d2('0xe')][_0x77d2('0xf')]);return _0x41e058(_0x3f5e1f[_0x77d2('0xe')][_0x77d2('0xf')]);}else{logger[_0x77d2('0xa')](_0x77d2('0xb'),_0x14a175,'request\x20sent');_0x41e058(_0x3f5e1f[_0x77d2('0x10')][_0x77d2('0xf')]);}})['catch'](function(_0xbbaf9d){logger[_0x77d2('0xe')](_0x77d2('0xb'),_0x14a175,_0xbbaf9d);_0x8db0dd(_0xbbaf9d);});});} \ No newline at end of file +var _0xdd2d=['result','catch','lodash','util','moment','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','client','request','then','info','Dynamics365Field,\x20%s,\x20%s','debug','Dynamics365Field,\x20%s,\x20%s,\x20%s','stringify','error','code','message','request\x20sent'];(function(_0x47a7d0,_0x4e182d){var _0xb9bd08=function(_0x588ee2){while(--_0x588ee2){_0x47a7d0['push'](_0x47a7d0['shift']());}};_0xb9bd08(++_0x4e182d);}(_0xdd2d,0x115));var _0xddd2=function(_0x45df7e,_0x5bbfe2){_0x45df7e=_0x45df7e-0x0;var _0x5a34e7=_0xdd2d[_0x45df7e];return _0x5a34e7;};'use strict';var _=require(_0xddd2('0x0'));var util=require(_0xddd2('0x1'));var moment=require(_0xddd2('0x2'));var BPromise=require('bluebird');var rs=require(_0xddd2('0x3'));var fs=require('fs');var Redis=require(_0xddd2('0x4'));var db=require(_0xddd2('0x5'))['db'];var utils=require(_0xddd2('0x6'));var logger=require(_0xddd2('0x7'))(_0xddd2('0x8'));var config=require(_0xddd2('0x9'));var jayson=require(_0xddd2('0xa'));var client=jayson[_0xddd2('0xb')]['http']({'port':0x232a});function respondWithRpcPromise(_0x7af901,_0x1ff1a9,_0x10620b){return new BPromise(function(_0x169c19,_0x590ce4){return client[_0xddd2('0xc')](_0x7af901,_0x10620b)[_0xddd2('0xd')](function(_0x3d41bd){logger[_0xddd2('0xe')](_0xddd2('0xf'),_0x1ff1a9,'request\x20sent');logger[_0xddd2('0x10')](_0xddd2('0x11'),_0x1ff1a9,'request\x20sent',JSON[_0xddd2('0x12')](_0x3d41bd));if(_0x3d41bd['error']){if(_0x3d41bd[_0xddd2('0x13')][_0xddd2('0x14')]===0x1f4){logger['error'](_0xddd2('0xf'),_0x1ff1a9,_0x3d41bd[_0xddd2('0x13')][_0xddd2('0x15')]);return _0x590ce4(_0x3d41bd[_0xddd2('0x13')][_0xddd2('0x15')]);}logger['error'](_0xddd2('0xf'),_0x1ff1a9,_0x3d41bd[_0xddd2('0x13')][_0xddd2('0x15')]);return _0x169c19(_0x3d41bd[_0xddd2('0x13')][_0xddd2('0x15')]);}else{logger[_0xddd2('0xe')](_0xddd2('0xf'),_0x1ff1a9,_0xddd2('0x16'));_0x169c19(_0x3d41bd[_0xddd2('0x17')][_0xddd2('0x15')]);}})[_0xddd2('0x18')](function(_0xa629b3){logger[_0xddd2('0x13')](_0xddd2('0xf'),_0x1ff1a9,_0xa629b3);_0x590ce4(_0xa629b3);});});} \ No newline at end of file diff --git a/server/api/intFreshdeskAccount/index.js b/server/api/intFreshdeskAccount/index.js index 399d43a..7a3416b 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 _0x99ef=['addConfiguration','put','update','delete','/:id','destroy','path','connect-timeout','express','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','./intFreshdeskAccount.controller','isAuthenticated','index','get','show','getConfigurations','getFields','post','create','/:id/configurations'];(function(_0x524ff5,_0x22adb1){var _0x356716=function(_0x34a555){while(--_0x34a555){_0x524ff5['push'](_0x524ff5['shift']());}};_0x356716(++_0x22adb1);}(_0x99ef,0xec));var _0xf99e=function(_0x271060,_0x3f86b1){_0x271060=_0x271060-0x0;var _0x40540b=_0x99ef[_0x271060];return _0x40540b;};'use strict';var multer=require('multer');var util=require('util');var path=require(_0xf99e('0x0'));var timeout=require(_0xf99e('0x1'));var express=require(_0xf99e('0x2'));var router=express['Router']();var fs_extra=require(_0xf99e('0x3'));var auth=require(_0xf99e('0x4'));var interaction=require(_0xf99e('0x5'));var config=require(_0xf99e('0x6'));var controller=require(_0xf99e('0x7'));router['get']('/',auth[_0xf99e('0x8')](),controller[_0xf99e('0x9')]);router[_0xf99e('0xa')]('/:id',auth[_0xf99e('0x8')](),controller[_0xf99e('0xb')]);router[_0xf99e('0xa')]('/:id/configurations',auth[_0xf99e('0x8')](),controller[_0xf99e('0xc')]);router['get']('/:id/fields',auth[_0xf99e('0x8')](),controller[_0xf99e('0xd')]);router[_0xf99e('0xe')]('/',auth[_0xf99e('0x8')](),controller[_0xf99e('0xf')]);router[_0xf99e('0xe')](_0xf99e('0x10'),auth[_0xf99e('0x8')](),controller[_0xf99e('0x11')]);router[_0xf99e('0x12')]('/:id',auth[_0xf99e('0x8')](),controller[_0xf99e('0x13')]);router[_0xf99e('0x14')](_0xf99e('0x15'),auth[_0xf99e('0x8')](),controller[_0xf99e('0x16')]);module['exports']=router; \ No newline at end of file +var _0x174c=['update','delete','exports','path','connect-timeout','express','fs-extra','../../components/auth/service','../../config/environment','./intFreshdeskAccount.controller','get','isAuthenticated','index','/:id','show','/:id/fields','getFields','post','create','addConfiguration'];(function(_0x25caef,_0x114517){var _0x4fab18=function(_0x423c42){while(--_0x423c42){_0x25caef['push'](_0x25caef['shift']());}};_0x4fab18(++_0x114517);}(_0x174c,0x143));var _0xc174=function(_0x1aaa57,_0x3b0b60){_0x1aaa57=_0x1aaa57-0x0;var _0x1e33ec=_0x174c[_0x1aaa57];return _0x1e33ec;};'use strict';var multer=require('multer');var util=require('util');var path=require(_0xc174('0x0'));var timeout=require(_0xc174('0x1'));var express=require(_0xc174('0x2'));var router=express['Router']();var fs_extra=require(_0xc174('0x3'));var auth=require(_0xc174('0x4'));var interaction=require('../../components/interaction/service');var config=require(_0xc174('0x5'));var controller=require(_0xc174('0x6'));router[_0xc174('0x7')]('/',auth[_0xc174('0x8')](),controller[_0xc174('0x9')]);router[_0xc174('0x7')](_0xc174('0xa'),auth[_0xc174('0x8')](),controller[_0xc174('0xb')]);router[_0xc174('0x7')]('/:id/configurations',auth[_0xc174('0x8')](),controller['getConfigurations']);router[_0xc174('0x7')](_0xc174('0xc'),auth[_0xc174('0x8')](),controller[_0xc174('0xd')]);router[_0xc174('0xe')]('/',auth[_0xc174('0x8')](),controller[_0xc174('0xf')]);router[_0xc174('0xe')]('/:id/configurations',auth[_0xc174('0x8')](),controller[_0xc174('0x10')]);router['put'](_0xc174('0xa'),auth[_0xc174('0x8')](),controller[_0xc174('0x11')]);router[_0xc174('0x12')](_0xc174('0xa'),auth['isAuthenticated'](),controller['destroy']);module[_0xc174('0x13')]=router; \ No newline at end of file diff --git a/server/api/intFreshdeskAccount/intFreshdeskAccount.attributes.js b/server/api/intFreshdeskAccount/intFreshdeskAccount.attributes.js index 8162baf..84142a9 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 _0xd4a2=['STRING','username','sequelize'];(function(_0x55db49,_0x5d9c5e){var _0x544b89=function(_0x12d172){while(--_0x12d172){_0x55db49['push'](_0x55db49['shift']());}};_0x544b89(++_0x5d9c5e);}(_0xd4a2,0x173));var _0x2d4a=function(_0x56ae9,_0x70b647){_0x56ae9=_0x56ae9-0x0;var _0x15c418=_0xd4a2[_0x56ae9];return _0x15c418;};'use strict';var Sequelize=require(_0x2d4a('0x0'));module['exports']={'name':{'type':Sequelize['STRING']},'description':{'type':Sequelize[_0x2d4a('0x1')]},'username':{'type':Sequelize['STRING'],'unique':_0x2d4a('0x2')},'apiKey':{'type':Sequelize['STRING']},'remoteUri':{'type':Sequelize[_0x2d4a('0x1')],'unique':'remoteUri'},'serverUrl':{'type':Sequelize[_0x2d4a('0x1')],'allowNull':![]}}; \ No newline at end of file +var _0x627e=['STRING','remoteUri','sequelize','exports'];(function(_0x3518f1,_0x8e480e){var _0x39e0b4=function(_0x3b9c4f){while(--_0x3b9c4f){_0x3518f1['push'](_0x3518f1['shift']());}};_0x39e0b4(++_0x8e480e);}(_0x627e,0x14a));var _0xe627=function(_0x5382fd,_0x181629){_0x5382fd=_0x5382fd-0x0;var _0x4f86db=_0x627e[_0x5382fd];return _0x4f86db;};'use strict';var Sequelize=require(_0xe627('0x0'));module[_0xe627('0x1')]={'name':{'type':Sequelize[_0xe627('0x2')]},'description':{'type':Sequelize[_0xe627('0x2')]},'username':{'type':Sequelize[_0xe627('0x2')],'unique':'username'},'apiKey':{'type':Sequelize[_0xe627('0x2')]},'remoteUri':{'type':Sequelize[_0xe627('0x2')],'unique':_0xe627('0x3')},'serverUrl':{'type':Sequelize['STRING'],'allowNull':![]}}; \ No newline at end of file diff --git a/server/api/intFreshdeskAccount/intFreshdeskAccount.controller.js b/server/api/intFreshdeskAccount/intFreshdeskAccount.controller.js index 4ddf336..b3e32e0 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 _0x94df=['fields','options','find','create','body','getConfigurations','findOne','FreshdeskConfiguration','hasOwnProperty','addConfiguration','AccountId','getSubjects','channel','Descriptions','getDescriptions','FreshdeskField','Subjects','getFields','apiKey','slice','lastIndexOf','format','%s/%s','api/v2/ticket_fields','Basic\x20%s','%s:X','base64','requester','subject','agent','description','priority','group','ticket_type','company','includes','default','custom_dropdown','label','choices','capitalize','test','statusCode','getFields,\x20%s,\x20%s,\x20%s','stringify','send','Wrong\x20credentials','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','moment','mustache','util','path','sox','to-csv','ejs','fs-extra','lodash','squel','crypto','jsforce','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/environment','../../components/integrations/configuration','sendStatus','status','json','offset','limit','count','set','Content-Range','reject','save','update','then','destroy','end','error','stack','index','map','rawAttributes','type','model','keys','query','intersection','attributes','length','order','sort','filters','pick','filter','where','merge','VIRTUAL','name','FreshdeskAccount','includeAll','rows','catch','show','params'];(function(_0x4032ec,_0x17f80d){var _0x1d5078=function(_0x509a14){while(--_0x509a14){_0x4032ec['push'](_0x4032ec['shift']());}};_0x1d5078(++_0x17f80d);}(_0x94df,0xa3));var _0xf94d=function(_0x5c66e2,_0x2c18a8){_0x5c66e2=_0x5c66e2-0x0;var _0x78bda3=_0x94df[_0x5c66e2];return _0x78bda3;};'use strict';var emlformat=require(_0xf94d('0x0'));var rimraf=require(_0xf94d('0x1'));var zipdir=require(_0xf94d('0x2'));var jsonpatch=require(_0xf94d('0x3'));var rp=require(_0xf94d('0x4'));var moment=require(_0xf94d('0x5'));var BPromise=require('bluebird');var Mustache=require(_0xf94d('0x6'));var util=require(_0xf94d('0x7'));var path=require(_0xf94d('0x8'));var sox=require(_0xf94d('0x9'));var csv=require(_0xf94d('0xa'));var ejs=require(_0xf94d('0xb'));var fs=require('fs');var fs_extra=require(_0xf94d('0xc'));var _=require(_0xf94d('0xd'));var squel=require(_0xf94d('0xe'));var crypto=require(_0xf94d('0xf'));var jsforce=require(_0xf94d('0x10'));var deskjs=require('desk.js');var toCsv=require(_0xf94d('0xa'));var querystring=require(_0xf94d('0x11'));var Papa=require(_0xf94d('0x12'));var Redis=require(_0xf94d('0x13'));var authService=require(_0xf94d('0x14'));var qs=require(_0xf94d('0x15'));var as=require('../../components/parsers/advancedSearch');var hardwareService=require(_0xf94d('0x16'));var logger=require(_0xf94d('0x17'))(_0xf94d('0x18'));var utils=require(_0xf94d('0x19'));var config=require(_0xf94d('0x1a'));var licenseUtil=require('../../config/license/util');var db=require('../../mysqldb')['db'];var integrations=require(_0xf94d('0x1b'));function respondWithStatusCode(_0x3e6c70,_0x2f5395){_0x2f5395=_0x2f5395||0xcc;return function(_0x28bdf8){if(_0x28bdf8){return _0x3e6c70[_0xf94d('0x1c')](_0x2f5395);}return _0x3e6c70[_0xf94d('0x1d')](_0x2f5395)['end']();};}function respondWithResult(_0x596da8,_0x36ff94){_0x36ff94=_0x36ff94||0xc8;return function(_0x17234f){if(_0x17234f){return _0x596da8[_0xf94d('0x1d')](_0x36ff94)[_0xf94d('0x1e')](_0x17234f);}};}function respondWithFilteredResult(_0x451065,_0x14020b){return function(_0x2c557b){if(_0x2c557b){var _0x4fa8bf=typeof _0x14020b[_0xf94d('0x1f')]==='undefined'&&typeof _0x14020b[_0xf94d('0x20')]==='undefined';var _0x29f4bc=_0x2c557b['count'];var _0x30d231=_0x4fa8bf?0x0:_0x14020b[_0xf94d('0x1f')];var _0x510eef=_0x4fa8bf?_0x2c557b[_0xf94d('0x21')]:_0x14020b['offset']+_0x14020b[_0xf94d('0x20')];var _0x5e0133;if(_0x510eef>=_0x29f4bc){_0x510eef=_0x29f4bc;_0x5e0133=0xc8;}else{_0x5e0133=0xce;}_0x451065[_0xf94d('0x1d')](_0x5e0133);return _0x451065[_0xf94d('0x22')](_0xf94d('0x23'),_0x30d231+'-'+_0x510eef+'/'+_0x29f4bc)[_0xf94d('0x1e')](_0x2c557b);}return null;};}function patchUpdates(_0x5f261c){return function(_0x4325ff){try{jsonpatch['apply'](_0x4325ff,_0x5f261c,!![]);}catch(_0x39f75d){return BPromise[_0xf94d('0x24')](_0x39f75d);}return _0x4325ff[_0xf94d('0x25')]();};}function saveUpdates(_0x56e5f5,_0x3f6b24){return function(_0x8f50){if(_0x8f50){return _0x8f50[_0xf94d('0x26')](_0x56e5f5)[_0xf94d('0x27')](function(_0x47470d){return _0x47470d;});}return null;};}function removeEntity(_0x533714,_0x301d2e){return function(_0x51f7f8){if(_0x51f7f8){return _0x51f7f8[_0xf94d('0x28')]()[_0xf94d('0x27')](function(){_0x533714[_0xf94d('0x1d')](0xcc)[_0xf94d('0x29')]();});}};}function handleEntityNotFound(_0x997b6c,_0x1c4bdf){return function(_0x2804dc){if(!_0x2804dc){_0x997b6c[_0xf94d('0x1c')](0x194);}return _0x2804dc;};}function handleError(_0x3c9fe3,_0x13c229){_0x13c229=_0x13c229||0x1f4;return function(_0x18ccd7){logger[_0xf94d('0x2a')](_0x18ccd7[_0xf94d('0x2b')]);if(_0x18ccd7['name']){delete _0x18ccd7['name'];}_0x3c9fe3['status'](_0x13c229)['send'](_0x18ccd7);};}exports[_0xf94d('0x2c')]=function(_0x1e8242,_0x56ab8c){var _0x167585={},_0x1c123b={},_0x229ff7={'count':0x0,'rows':[]};var _0x59c273=_[_0xf94d('0x2d')](db['FreshdeskAccount'][_0xf94d('0x2e')],function(_0x1d15c5){return{'name':_0x1d15c5['fieldName'],'type':_0x1d15c5[_0xf94d('0x2f')]['key']};});_0x1c123b[_0xf94d('0x30')]=_['map'](_0x59c273,'name');_0x1c123b['query']=_[_0xf94d('0x31')](_0x1e8242[_0xf94d('0x32')]);_0x1c123b['filters']=_[_0xf94d('0x33')](_0x1c123b['model'],_0x1c123b[_0xf94d('0x32')]);_0x167585[_0xf94d('0x34')]=_['intersection'](_0x1c123b[_0xf94d('0x30')],qs['fields'](_0x1e8242[_0xf94d('0x32')]['fields']));_0x167585[_0xf94d('0x34')]=_0x167585['attributes'][_0xf94d('0x35')]?_0x167585[_0xf94d('0x34')]:_0x1c123b[_0xf94d('0x30')];if(!_0x1e8242[_0xf94d('0x32')]['hasOwnProperty']('nolimit')){_0x167585['limit']=qs[_0xf94d('0x20')](_0x1e8242[_0xf94d('0x32')][_0xf94d('0x20')]);_0x167585[_0xf94d('0x1f')]=qs['offset'](_0x1e8242['query']['offset']);}_0x167585[_0xf94d('0x36')]=qs[_0xf94d('0x37')](_0x1e8242[_0xf94d('0x32')][_0xf94d('0x37')]);_0x167585['where']=qs[_0xf94d('0x38')](_[_0xf94d('0x39')](_0x1e8242[_0xf94d('0x32')],_0x1c123b[_0xf94d('0x38')]),_0x59c273);if(_0x1e8242['query'][_0xf94d('0x3a')]){_0x167585[_0xf94d('0x3b')]=_[_0xf94d('0x3c')](_0x167585[_0xf94d('0x3b')],{'$or':_[_0xf94d('0x2d')](_0x59c273,function(_0x288262){if(_0x288262[_0xf94d('0x2f')]!==_0xf94d('0x3d')){var _0xe9510e={};_0xe9510e[_0x288262[_0xf94d('0x3e')]]={'$like':'%'+_0x1e8242['query']['filter']+'%'};return _0xe9510e;}})});}_0x167585=_[_0xf94d('0x3c')]({},_0x167585,_0x1e8242['options']);var _0x1938f8={'where':_0x167585['where']};return db[_0xf94d('0x3f')][_0xf94d('0x21')](_0x1938f8)[_0xf94d('0x27')](function(_0x183f9f){_0x229ff7[_0xf94d('0x21')]=_0x183f9f;if(_0x1e8242['query'][_0xf94d('0x40')]){_0x167585['include']=[{'all':!![]}];}return db[_0xf94d('0x3f')]['findAll'](_0x167585);})[_0xf94d('0x27')](function(_0x40af20){_0x229ff7[_0xf94d('0x41')]=_0x40af20;return _0x229ff7;})[_0xf94d('0x27')](respondWithFilteredResult(_0x56ab8c,_0x167585))[_0xf94d('0x42')](handleError(_0x56ab8c,null));};exports[_0xf94d('0x43')]=function(_0x3a5703,_0x598e2b){var _0x36ac14={'raw':![],'where':{'id':_0x3a5703[_0xf94d('0x44')]['id']}},_0x2df442={};_0x2df442['model']=_[_0xf94d('0x31')](db[_0xf94d('0x3f')][_0xf94d('0x2e')]);_0x2df442[_0xf94d('0x32')]=_[_0xf94d('0x31')](_0x3a5703[_0xf94d('0x32')]);_0x2df442[_0xf94d('0x38')]=_['intersection'](_0x2df442[_0xf94d('0x30')],_0x2df442[_0xf94d('0x32')]);_0x36ac14[_0xf94d('0x34')]=_[_0xf94d('0x33')](_0x2df442[_0xf94d('0x30')],qs[_0xf94d('0x45')](_0x3a5703['query']['fields']));_0x36ac14[_0xf94d('0x34')]=_0x36ac14[_0xf94d('0x34')][_0xf94d('0x35')]?_0x36ac14[_0xf94d('0x34')]:_0x2df442[_0xf94d('0x30')];if(_0x3a5703['query'][_0xf94d('0x40')]){_0x36ac14['include']=[{'all':!![]}];}_0x36ac14=_[_0xf94d('0x3c')]({},_0x36ac14,_0x3a5703[_0xf94d('0x46')]);return db[_0xf94d('0x3f')][_0xf94d('0x47')](_0x36ac14)[_0xf94d('0x27')](handleEntityNotFound(_0x598e2b,null))['then'](respondWithResult(_0x598e2b,null))[_0xf94d('0x42')](handleError(_0x598e2b,null));};exports[_0xf94d('0x48')]=function(_0x676410,_0x3d0df2){return db['FreshdeskAccount'][_0xf94d('0x48')](_0x676410['body'],{})['then'](respondWithResult(_0x3d0df2,0xc9))[_0xf94d('0x42')](handleError(_0x3d0df2,null));};exports[_0xf94d('0x26')]=function(_0x38d70d,_0x5557ee){if(_0x38d70d[_0xf94d('0x49')]['id']){delete _0x38d70d['body']['id'];}return db[_0xf94d('0x3f')][_0xf94d('0x47')]({'where':{'id':_0x38d70d[_0xf94d('0x44')]['id']}})[_0xf94d('0x27')](handleEntityNotFound(_0x5557ee,null))[_0xf94d('0x27')](saveUpdates(_0x38d70d[_0xf94d('0x49')],null))['then'](respondWithResult(_0x5557ee,null))[_0xf94d('0x42')](handleError(_0x5557ee,null));};exports[_0xf94d('0x28')]=function(_0x3b63da,_0x21095d){return db['FreshdeskAccount'][_0xf94d('0x47')]({'where':{'id':_0x3b63da['params']['id']}})[_0xf94d('0x27')](handleEntityNotFound(_0x21095d,null))['then'](removeEntity(_0x21095d,null))[_0xf94d('0x42')](handleError(_0x21095d,null));};exports[_0xf94d('0x4a')]=function(_0x1bfc66,_0x2f675f,_0x2e8f82){var _0x505153={};var _0x4a623b={};var _0x218e25;var _0x3155a4;return db[_0xf94d('0x3f')][_0xf94d('0x4b')]({'where':{'id':_0x1bfc66[_0xf94d('0x44')]['id']}})[_0xf94d('0x27')](handleEntityNotFound(_0x2f675f,null))['then'](function(_0x8b9209){if(_0x8b9209){_0x218e25=_0x8b9209;_0x4a623b[_0xf94d('0x30')]=_[_0xf94d('0x31')](db[_0xf94d('0x4c')]['rawAttributes']);_0x4a623b['query']=_[_0xf94d('0x31')](_0x1bfc66[_0xf94d('0x32')]);_0x4a623b[_0xf94d('0x38')]=_['intersection'](_0x4a623b[_0xf94d('0x30')],_0x4a623b[_0xf94d('0x32')]);_0x505153[_0xf94d('0x34')]=_[_0xf94d('0x33')](_0x4a623b[_0xf94d('0x30')],qs[_0xf94d('0x45')](_0x1bfc66[_0xf94d('0x32')][_0xf94d('0x45')]));_0x505153[_0xf94d('0x34')]=_0x505153['attributes'][_0xf94d('0x35')]?_0x505153['attributes']:_0x4a623b[_0xf94d('0x30')];_0x505153['order']=qs[_0xf94d('0x37')](_0x1bfc66[_0xf94d('0x32')][_0xf94d('0x37')]);_0x505153['where']=qs[_0xf94d('0x38')](_[_0xf94d('0x39')](_0x1bfc66[_0xf94d('0x32')],_0x4a623b[_0xf94d('0x38')]));if(_0x1bfc66['query']['filter']){_0x505153[_0xf94d('0x3b')]=_['merge'](_0x505153['where'],{'$or':_[_0xf94d('0x2d')](_0x505153[_0xf94d('0x34')],function(_0x4e6dd5){var _0xdf395={};_0xdf395[_0x4e6dd5]={'$like':'%'+_0x1bfc66['query']['filter']+'%'};return _0xdf395;})});}_0x505153=_['merge']({},_0x505153,_0x1bfc66[_0xf94d('0x46')]);return _0x218e25['getConfigurations'](_0x505153);}})[_0xf94d('0x27')](function(_0x5caa6e){if(_0x5caa6e){_0x3155a4=_0x5caa6e['length'];if(!_0x1bfc66['query'][_0xf94d('0x4d')]('nolimit')){_0x505153['limit']=qs[_0xf94d('0x20')](_0x1bfc66['query'][_0xf94d('0x20')]);_0x505153[_0xf94d('0x1f')]=qs['offset'](_0x1bfc66[_0xf94d('0x32')]['offset']);}return _0x218e25['getConfigurations'](_0x505153);}})[_0xf94d('0x27')](function(_0x52fca9){if(_0x52fca9){return _0x52fca9?{'count':_0x3155a4,'rows':_0x52fca9}:null;}})[_0xf94d('0x27')](respondWithResult(_0x2f675f,null))[_0xf94d('0x42')](handleError(_0x2f675f,null));};exports[_0xf94d('0x4e')]=function(_0x2db020,_0x4a2dd9,_0x298f33){if(_0x2db020[_0xf94d('0x49')]['id']){delete _0x2db020[_0xf94d('0x49')]['id'];}return db[_0xf94d('0x3f')][_0xf94d('0x4b')]({'where':{'id':_0x2db020[_0xf94d('0x44')]['id']}})['then'](handleEntityNotFound(_0x4a2dd9,null))[_0xf94d('0x27')](function(_0x7f4008){if(_0x7f4008){_0x2db020[_0xf94d('0x49')][_0xf94d('0x4f')]=_0x7f4008['id'];_0x2db020[_0xf94d('0x49')]['Subjects']=integrations[_0xf94d('0x50')](_0x2db020[_0xf94d('0x49')][_0xf94d('0x51')],_0x2db020[_0xf94d('0x49')]['type']);_0x2db020[_0xf94d('0x49')][_0xf94d('0x52')]=integrations[_0xf94d('0x53')](_0x2db020[_0xf94d('0x49')][_0xf94d('0x51')],_0x2db020[_0xf94d('0x49')][_0xf94d('0x2f')]);return db[_0xf94d('0x4c')][_0xf94d('0x48')](_0x2db020[_0xf94d('0x49')],{'include':[{'model':db[_0xf94d('0x54')],'as':_0xf94d('0x55')},{'model':db[_0xf94d('0x54')],'as':_0xf94d('0x52')}]});}return null;})[_0xf94d('0x27')](respondWithResult(_0x4a2dd9,null))[_0xf94d('0x42')](handleError(_0x4a2dd9,null));};exports[_0xf94d('0x56')]=function(_0x362035,_0x39cb6e,_0x34dc96){var _0x1f146d='';return db[_0xf94d('0x3f')][_0xf94d('0x4b')]({'where':{'id':_0x362035['params']['id']},'attributes':['id','remoteUri',_0xf94d('0x57')]})[_0xf94d('0x27')](handleEntityNotFound(_0x39cb6e,null))[_0xf94d('0x27')](function(_0x2ceb4d){if(_0x2ceb4d){_0x1f146d=_0x2ceb4d['remoteUri'];var _0x203e5e=_0x1f146d[_0xf94d('0x58')](-0x1);if(_0x203e5e==='/'){_0x1f146d=_0x1f146d['substring'](0x0,_0x1f146d[_0xf94d('0x59')](_0x203e5e));}return rp({'method':'GET','uri':util[_0xf94d('0x5a')](_0xf94d('0x5b'),_0x1f146d,_0xf94d('0x5c')),'headers':{'Authorization':util[_0xf94d('0x5a')](_0xf94d('0x5d'),new Buffer(util[_0xf94d('0x5a')](_0xf94d('0x5e'),_0x2ceb4d[_0xf94d('0x57')]))['toString'](_0xf94d('0x5f')))},'json':!![]});}})[_0xf94d('0x27')](function(_0x308c2e){if(_0x308c2e){var _0xf9b47e=[_0xf94d('0x60'),_0xf94d('0x61'),_0xf94d('0x62'),_0xf94d('0x63'),'status',_0xf94d('0x64'),_0xf94d('0x65'),'source',_0xf94d('0x66'),_0xf94d('0x65'),_0xf94d('0x67')];_['remove'](_0x308c2e,function(_0x5617ef){return _0xf9b47e[_0xf94d('0x68')](_0x5617ef[_0xf94d('0x3e')])||!_0x5617ef[_0xf94d('0x69')]&&_0x5617ef[_0xf94d('0x2f')]!=='custom_text'&&_0x5617ef[_0xf94d('0x2f')]!==_0xf94d('0x6a');});return{'count':_0x308c2e[_0xf94d('0x35')],'rows':_[_0xf94d('0x2d')](_0x308c2e,function(_0x5162d6){return{'id':_0x5162d6[_0xf94d('0x3e')],'name':_0x5162d6[_0xf94d('0x6b')],'custom':!_0x5162d6[_0xf94d('0x69')],'options':_0x5162d6[_0xf94d('0x6c')]?_[_0xf94d('0x2d')](_0x5162d6['choices'],function(_0x3452e1){return{'name':_[_0xf94d('0x6d')](_0x3452e1),'value':_0x3452e1};}):[]};})};}})['then'](respondWithResult(_0x39cb6e,null))[_0xf94d('0x42')](function(_0x55256b){var _0x19cad4=_0x362035[_0xf94d('0x32')][_0xf94d('0x6e')]?0x1f4:_0x55256b[_0xf94d('0x6f')]||0x1f4;logger[_0xf94d('0x2a')](_0xf94d('0x70'),_0xf94d('0x56'),_0x19cad4,JSON[_0xf94d('0x71')](_0x55256b));delete _0x55256b[_0xf94d('0x3e')];if(_0x19cad4===0x191){_0x19cad4=0x190;}_0x39cb6e[_0xf94d('0x1d')](_0x19cad4)[_0xf94d('0x72')](_0x362035[_0xf94d('0x32')]['test']?{'message':_0xf94d('0x73'),'statusCode':_0x55256b[_0xf94d('0x6f')]}:_0x55256b);});}; \ No newline at end of file +var _0x10b8=['company','remove','includes','custom_text','custom_dropdown','choices','capitalize','getFields,\x20%s,\x20%s,\x20%s','stringify','send','test','Wrong\x20credentials','statusCode','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','moment','mustache','util','path','to-csv','ejs','fs-extra','lodash','squel','crypto','jsforce','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/logger','api','../../config/utils','../../config/environment','../../mysqldb','../../components/integrations/configuration','sendStatus','status','end','json','offset','undefined','limit','count','set','apply','save','update','then','destroy','error','stack','name','map','FreshdeskAccount','rawAttributes','fieldName','type','model','query','keys','filters','intersection','attributes','fields','hasOwnProperty','nolimit','order','sort','where','filter','merge','VIRTUAL','options','includeAll','include','findAll','catch','show','params','find','create','body','getConfigurations','findOne','FreshdeskConfiguration','length','addConfiguration','AccountId','Subjects','getSubjects','channel','Descriptions','getDescriptions','FreshdeskField','getFields','remoteUri','apiKey','slice','substring','GET','format','Basic\x20%s','%s:X','toString','requester','subject','agent','group','source','ticket_type'];(function(_0x502c7d,_0x2f1285){var _0x30b7ed=function(_0x2d92f3){while(--_0x2d92f3){_0x502c7d['push'](_0x502c7d['shift']());}};_0x30b7ed(++_0x2f1285);}(_0x10b8,0x166));var _0x810b=function(_0x19950b,_0x53d0d7){_0x19950b=_0x19950b-0x0;var _0x3c6b41=_0x10b8[_0x19950b];return _0x3c6b41;};'use strict';var emlformat=require(_0x810b('0x0'));var rimraf=require(_0x810b('0x1'));var zipdir=require(_0x810b('0x2'));var jsonpatch=require(_0x810b('0x3'));var rp=require(_0x810b('0x4'));var moment=require(_0x810b('0x5'));var BPromise=require('bluebird');var Mustache=require(_0x810b('0x6'));var util=require(_0x810b('0x7'));var path=require(_0x810b('0x8'));var sox=require('sox');var csv=require(_0x810b('0x9'));var ejs=require(_0x810b('0xa'));var fs=require('fs');var fs_extra=require(_0x810b('0xb'));var _=require(_0x810b('0xc'));var squel=require(_0x810b('0xd'));var crypto=require(_0x810b('0xe'));var jsforce=require(_0x810b('0xf'));var deskjs=require('desk.js');var toCsv=require(_0x810b('0x9'));var querystring=require('querystring');var Papa=require(_0x810b('0x10'));var Redis=require(_0x810b('0x11'));var authService=require(_0x810b('0x12'));var qs=require(_0x810b('0x13'));var as=require(_0x810b('0x14'));var hardwareService=require('../../config/license/hardware');var logger=require(_0x810b('0x15'))(_0x810b('0x16'));var utils=require(_0x810b('0x17'));var config=require(_0x810b('0x18'));var licenseUtil=require('../../config/license/util');var db=require(_0x810b('0x19'))['db'];var integrations=require(_0x810b('0x1a'));function respondWithStatusCode(_0x24bb1d,_0x2069a9){_0x2069a9=_0x2069a9||0xcc;return function(_0x16f727){if(_0x16f727){return _0x24bb1d[_0x810b('0x1b')](_0x2069a9);}return _0x24bb1d[_0x810b('0x1c')](_0x2069a9)[_0x810b('0x1d')]();};}function respondWithResult(_0x26209b,_0x3e3e52){_0x3e3e52=_0x3e3e52||0xc8;return function(_0x4d7dcd){if(_0x4d7dcd){return _0x26209b['status'](_0x3e3e52)[_0x810b('0x1e')](_0x4d7dcd);}};}function respondWithFilteredResult(_0xbbc69b,_0x1f2d52){return function(_0xea1d2a){if(_0xea1d2a){var _0x3a8115=typeof _0x1f2d52[_0x810b('0x1f')]===_0x810b('0x20')&&typeof _0x1f2d52[_0x810b('0x21')]===_0x810b('0x20');var _0x1cdcee=_0xea1d2a['count'];var _0x3424bc=_0x3a8115?0x0:_0x1f2d52['offset'];var _0x10753a=_0x3a8115?_0xea1d2a[_0x810b('0x22')]:_0x1f2d52[_0x810b('0x1f')]+_0x1f2d52['limit'];var _0x350e1f;if(_0x10753a>=_0x1cdcee){_0x10753a=_0x1cdcee;_0x350e1f=0xc8;}else{_0x350e1f=0xce;}_0xbbc69b['status'](_0x350e1f);return _0xbbc69b[_0x810b('0x23')]('Content-Range',_0x3424bc+'-'+_0x10753a+'/'+_0x1cdcee)[_0x810b('0x1e')](_0xea1d2a);}return null;};}function patchUpdates(_0x51b3be){return function(_0x280928){try{jsonpatch[_0x810b('0x24')](_0x280928,_0x51b3be,!![]);}catch(_0x288ceb){return BPromise['reject'](_0x288ceb);}return _0x280928[_0x810b('0x25')]();};}function saveUpdates(_0x483284,_0x121178){return function(_0x214610){if(_0x214610){return _0x214610[_0x810b('0x26')](_0x483284)[_0x810b('0x27')](function(_0x4fdf04){return _0x4fdf04;});}return null;};}function removeEntity(_0x6196a7,_0x525277){return function(_0x6284c7){if(_0x6284c7){return _0x6284c7[_0x810b('0x28')]()[_0x810b('0x27')](function(){_0x6196a7[_0x810b('0x1c')](0xcc)['end']();});}};}function handleEntityNotFound(_0x2cf6e4,_0x4bd4f9){return function(_0x8fa638){if(!_0x8fa638){_0x2cf6e4[_0x810b('0x1b')](0x194);}return _0x8fa638;};}function handleError(_0x46b9d3,_0x550ab8){_0x550ab8=_0x550ab8||0x1f4;return function(_0x1236e0){logger[_0x810b('0x29')](_0x1236e0[_0x810b('0x2a')]);if(_0x1236e0[_0x810b('0x2b')]){delete _0x1236e0[_0x810b('0x2b')];}_0x46b9d3[_0x810b('0x1c')](_0x550ab8)['send'](_0x1236e0);};}exports['index']=function(_0x190f9d,_0x217c0a){var _0x18129d={},_0x51352e={},_0x30ad99={'count':0x0,'rows':[]};var _0x4c6e20=_[_0x810b('0x2c')](db[_0x810b('0x2d')][_0x810b('0x2e')],function(_0x34f72c){return{'name':_0x34f72c[_0x810b('0x2f')],'type':_0x34f72c[_0x810b('0x30')]['key']};});_0x51352e[_0x810b('0x31')]=_['map'](_0x4c6e20,_0x810b('0x2b'));_0x51352e[_0x810b('0x32')]=_[_0x810b('0x33')](_0x190f9d['query']);_0x51352e[_0x810b('0x34')]=_[_0x810b('0x35')](_0x51352e['model'],_0x51352e[_0x810b('0x32')]);_0x18129d[_0x810b('0x36')]=_[_0x810b('0x35')](_0x51352e['model'],qs[_0x810b('0x37')](_0x190f9d[_0x810b('0x32')][_0x810b('0x37')]));_0x18129d['attributes']=_0x18129d[_0x810b('0x36')]['length']?_0x18129d[_0x810b('0x36')]:_0x51352e['model'];if(!_0x190f9d[_0x810b('0x32')][_0x810b('0x38')](_0x810b('0x39'))){_0x18129d['limit']=qs[_0x810b('0x21')](_0x190f9d[_0x810b('0x32')][_0x810b('0x21')]);_0x18129d[_0x810b('0x1f')]=qs[_0x810b('0x1f')](_0x190f9d[_0x810b('0x32')][_0x810b('0x1f')]);}_0x18129d[_0x810b('0x3a')]=qs['sort'](_0x190f9d[_0x810b('0x32')][_0x810b('0x3b')]);_0x18129d[_0x810b('0x3c')]=qs[_0x810b('0x34')](_['pick'](_0x190f9d[_0x810b('0x32')],_0x51352e[_0x810b('0x34')]),_0x4c6e20);if(_0x190f9d[_0x810b('0x32')][_0x810b('0x3d')]){_0x18129d[_0x810b('0x3c')]=_[_0x810b('0x3e')](_0x18129d['where'],{'$or':_[_0x810b('0x2c')](_0x4c6e20,function(_0x1df1fe){if(_0x1df1fe[_0x810b('0x30')]!==_0x810b('0x3f')){var _0x3b1361={};_0x3b1361[_0x1df1fe['name']]={'$like':'%'+_0x190f9d['query'][_0x810b('0x3d')]+'%'};return _0x3b1361;}})});}_0x18129d=_['merge']({},_0x18129d,_0x190f9d[_0x810b('0x40')]);var _0x1a2093={'where':_0x18129d[_0x810b('0x3c')]};return db[_0x810b('0x2d')]['count'](_0x1a2093)[_0x810b('0x27')](function(_0x59bed3){_0x30ad99[_0x810b('0x22')]=_0x59bed3;if(_0x190f9d[_0x810b('0x32')][_0x810b('0x41')]){_0x18129d[_0x810b('0x42')]=[{'all':!![]}];}return db[_0x810b('0x2d')][_0x810b('0x43')](_0x18129d);})[_0x810b('0x27')](function(_0x3e44aa){_0x30ad99['rows']=_0x3e44aa;return _0x30ad99;})[_0x810b('0x27')](respondWithFilteredResult(_0x217c0a,_0x18129d))[_0x810b('0x44')](handleError(_0x217c0a,null));};exports[_0x810b('0x45')]=function(_0x566a67,_0x455e9c){var _0x284260={'raw':![],'where':{'id':_0x566a67[_0x810b('0x46')]['id']}},_0x548d61={};_0x548d61['model']=_[_0x810b('0x33')](db[_0x810b('0x2d')][_0x810b('0x2e')]);_0x548d61[_0x810b('0x32')]=_[_0x810b('0x33')](_0x566a67[_0x810b('0x32')]);_0x548d61[_0x810b('0x34')]=_[_0x810b('0x35')](_0x548d61[_0x810b('0x31')],_0x548d61[_0x810b('0x32')]);_0x284260[_0x810b('0x36')]=_[_0x810b('0x35')](_0x548d61[_0x810b('0x31')],qs['fields'](_0x566a67[_0x810b('0x32')]['fields']));_0x284260[_0x810b('0x36')]=_0x284260[_0x810b('0x36')]['length']?_0x284260[_0x810b('0x36')]:_0x548d61[_0x810b('0x31')];if(_0x566a67[_0x810b('0x32')][_0x810b('0x41')]){_0x284260[_0x810b('0x42')]=[{'all':!![]}];}_0x284260=_[_0x810b('0x3e')]({},_0x284260,_0x566a67[_0x810b('0x40')]);return db[_0x810b('0x2d')][_0x810b('0x47')](_0x284260)['then'](handleEntityNotFound(_0x455e9c,null))[_0x810b('0x27')](respondWithResult(_0x455e9c,null))[_0x810b('0x44')](handleError(_0x455e9c,null));};exports['create']=function(_0x4389a9,_0x4128c8){return db[_0x810b('0x2d')][_0x810b('0x48')](_0x4389a9[_0x810b('0x49')],{})[_0x810b('0x27')](respondWithResult(_0x4128c8,0xc9))[_0x810b('0x44')](handleError(_0x4128c8,null));};exports[_0x810b('0x26')]=function(_0x32db35,_0x1f9b67){if(_0x32db35[_0x810b('0x49')]['id']){delete _0x32db35['body']['id'];}return db['FreshdeskAccount'][_0x810b('0x47')]({'where':{'id':_0x32db35['params']['id']}})['then'](handleEntityNotFound(_0x1f9b67,null))['then'](saveUpdates(_0x32db35[_0x810b('0x49')],null))[_0x810b('0x27')](respondWithResult(_0x1f9b67,null))[_0x810b('0x44')](handleError(_0x1f9b67,null));};exports[_0x810b('0x28')]=function(_0x3146ed,_0x20bd8c){return db['FreshdeskAccount'][_0x810b('0x47')]({'where':{'id':_0x3146ed[_0x810b('0x46')]['id']}})[_0x810b('0x27')](handleEntityNotFound(_0x20bd8c,null))[_0x810b('0x27')](removeEntity(_0x20bd8c,null))[_0x810b('0x44')](handleError(_0x20bd8c,null));};exports[_0x810b('0x4a')]=function(_0x1f1374,_0x581c21,_0x46c925){var _0x3b282e={};var _0x1f5ba4={};var _0x3dcfb7;var _0x4903ac;return db['FreshdeskAccount'][_0x810b('0x4b')]({'where':{'id':_0x1f1374['params']['id']}})[_0x810b('0x27')](handleEntityNotFound(_0x581c21,null))[_0x810b('0x27')](function(_0x1dbc6a){if(_0x1dbc6a){_0x3dcfb7=_0x1dbc6a;_0x1f5ba4[_0x810b('0x31')]=_[_0x810b('0x33')](db[_0x810b('0x4c')][_0x810b('0x2e')]);_0x1f5ba4[_0x810b('0x32')]=_[_0x810b('0x33')](_0x1f1374[_0x810b('0x32')]);_0x1f5ba4[_0x810b('0x34')]=_[_0x810b('0x35')](_0x1f5ba4[_0x810b('0x31')],_0x1f5ba4[_0x810b('0x32')]);_0x3b282e[_0x810b('0x36')]=_[_0x810b('0x35')](_0x1f5ba4[_0x810b('0x31')],qs['fields'](_0x1f1374[_0x810b('0x32')][_0x810b('0x37')]));_0x3b282e['attributes']=_0x3b282e[_0x810b('0x36')]['length']?_0x3b282e['attributes']:_0x1f5ba4[_0x810b('0x31')];_0x3b282e[_0x810b('0x3a')]=qs[_0x810b('0x3b')](_0x1f1374['query'][_0x810b('0x3b')]);_0x3b282e[_0x810b('0x3c')]=qs[_0x810b('0x34')](_['pick'](_0x1f1374['query'],_0x1f5ba4['filters']));if(_0x1f1374[_0x810b('0x32')][_0x810b('0x3d')]){_0x3b282e[_0x810b('0x3c')]=_['merge'](_0x3b282e[_0x810b('0x3c')],{'$or':_[_0x810b('0x2c')](_0x3b282e[_0x810b('0x36')],function(_0x37a3b0){var _0x2280a7={};_0x2280a7[_0x37a3b0]={'$like':'%'+_0x1f1374['query'][_0x810b('0x3d')]+'%'};return _0x2280a7;})});}_0x3b282e=_['merge']({},_0x3b282e,_0x1f1374[_0x810b('0x40')]);return _0x3dcfb7[_0x810b('0x4a')](_0x3b282e);}})[_0x810b('0x27')](function(_0x773a2c){if(_0x773a2c){_0x4903ac=_0x773a2c[_0x810b('0x4d')];if(!_0x1f1374[_0x810b('0x32')][_0x810b('0x38')]('nolimit')){_0x3b282e['limit']=qs[_0x810b('0x21')](_0x1f1374[_0x810b('0x32')][_0x810b('0x21')]);_0x3b282e[_0x810b('0x1f')]=qs['offset'](_0x1f1374[_0x810b('0x32')][_0x810b('0x1f')]);}return _0x3dcfb7[_0x810b('0x4a')](_0x3b282e);}})['then'](function(_0x5be051){if(_0x5be051){return _0x5be051?{'count':_0x4903ac,'rows':_0x5be051}:null;}})[_0x810b('0x27')](respondWithResult(_0x581c21,null))[_0x810b('0x44')](handleError(_0x581c21,null));};exports[_0x810b('0x4e')]=function(_0x5f1aa0,_0x1fbcf7,_0x4a5d6d){if(_0x5f1aa0[_0x810b('0x49')]['id']){delete _0x5f1aa0[_0x810b('0x49')]['id'];}return db[_0x810b('0x2d')][_0x810b('0x4b')]({'where':{'id':_0x5f1aa0[_0x810b('0x46')]['id']}})[_0x810b('0x27')](handleEntityNotFound(_0x1fbcf7,null))['then'](function(_0x778105){if(_0x778105){_0x5f1aa0[_0x810b('0x49')][_0x810b('0x4f')]=_0x778105['id'];_0x5f1aa0[_0x810b('0x49')][_0x810b('0x50')]=integrations[_0x810b('0x51')](_0x5f1aa0[_0x810b('0x49')][_0x810b('0x52')],_0x5f1aa0[_0x810b('0x49')][_0x810b('0x30')]);_0x5f1aa0['body'][_0x810b('0x53')]=integrations[_0x810b('0x54')](_0x5f1aa0[_0x810b('0x49')][_0x810b('0x52')],_0x5f1aa0[_0x810b('0x49')][_0x810b('0x30')]);return db['FreshdeskConfiguration'][_0x810b('0x48')](_0x5f1aa0[_0x810b('0x49')],{'include':[{'model':db[_0x810b('0x55')],'as':_0x810b('0x50')},{'model':db[_0x810b('0x55')],'as':'Descriptions'}]});}return null;})[_0x810b('0x27')](respondWithResult(_0x1fbcf7,null))['catch'](handleError(_0x1fbcf7,null));};exports[_0x810b('0x56')]=function(_0x1f1355,_0x5f4fc4,_0x2570cc){var _0x2a94d9='';return db[_0x810b('0x2d')][_0x810b('0x4b')]({'where':{'id':_0x1f1355[_0x810b('0x46')]['id']},'attributes':['id',_0x810b('0x57'),_0x810b('0x58')]})['then'](handleEntityNotFound(_0x5f4fc4,null))[_0x810b('0x27')](function(_0x3d9d38){if(_0x3d9d38){_0x2a94d9=_0x3d9d38[_0x810b('0x57')];var _0x21185a=_0x2a94d9[_0x810b('0x59')](-0x1);if(_0x21185a==='/'){_0x2a94d9=_0x2a94d9[_0x810b('0x5a')](0x0,_0x2a94d9['lastIndexOf'](_0x21185a));}return rp({'method':_0x810b('0x5b'),'uri':util[_0x810b('0x5c')]('%s/%s',_0x2a94d9,'api/v2/ticket_fields'),'headers':{'Authorization':util[_0x810b('0x5c')](_0x810b('0x5d'),new Buffer(util['format'](_0x810b('0x5e'),_0x3d9d38[_0x810b('0x58')]))[_0x810b('0x5f')]('base64'))},'json':!![]});}})['then'](function(_0x429949){if(_0x429949){var _0x459b4e=[_0x810b('0x60'),_0x810b('0x61'),_0x810b('0x62'),'description','status','priority',_0x810b('0x63'),_0x810b('0x64'),_0x810b('0x65'),_0x810b('0x63'),_0x810b('0x66')];_[_0x810b('0x67')](_0x429949,function(_0xcb2dc0){return _0x459b4e[_0x810b('0x68')](_0xcb2dc0[_0x810b('0x2b')])||!_0xcb2dc0['default']&&_0xcb2dc0[_0x810b('0x30')]!==_0x810b('0x69')&&_0xcb2dc0['type']!==_0x810b('0x6a');});return{'count':_0x429949[_0x810b('0x4d')],'rows':_[_0x810b('0x2c')](_0x429949,function(_0x5e9f6f){return{'id':_0x5e9f6f[_0x810b('0x2b')],'name':_0x5e9f6f['label'],'custom':!_0x5e9f6f['default'],'options':_0x5e9f6f[_0x810b('0x6b')]?_[_0x810b('0x2c')](_0x5e9f6f[_0x810b('0x6b')],function(_0x5767c5){return{'name':_[_0x810b('0x6c')](_0x5767c5),'value':_0x5767c5};}):[]};})};}})[_0x810b('0x27')](respondWithResult(_0x5f4fc4,null))[_0x810b('0x44')](function(_0xe636cd){var _0x38af53=_0x1f1355[_0x810b('0x32')]['test']?0x1f4:_0xe636cd['statusCode']||0x1f4;logger[_0x810b('0x29')](_0x810b('0x6d'),_0x810b('0x56'),_0x38af53,JSON[_0x810b('0x6e')](_0xe636cd));delete _0xe636cd['name'];if(_0x38af53===0x191){_0x38af53=0x190;}_0x5f4fc4[_0x810b('0x1c')](_0x38af53)[_0x810b('0x6f')](_0x1f1355[_0x810b('0x32')][_0x810b('0x70')]?{'message':_0x810b('0x71'),'statusCode':_0xe636cd[_0x810b('0x72')]}:_0xe636cd);});}; \ No newline at end of file diff --git a/server/api/intFreshdeskAccount/intFreshdeskAccount.model.js b/server/api/intFreshdeskAccount/intFreshdeskAccount.model.js index 8147523..96bafe7 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 _0xf12a=['util','../../config/logger','api','moment','bluebird','request-promise','path','rimraf','./intFreshdeskAccount.attributes','exports','define','FreshdeskAccount','int_freshdesk_accounts','lodash'];(function(_0x145ad5,_0x2c4827){var _0x523dec=function(_0x2528a3){while(--_0x2528a3){_0x145ad5['push'](_0x145ad5['shift']());}};_0x523dec(++_0x2c4827);}(_0xf12a,0x141));var _0xaf12=function(_0x318dda,_0x1aa800){_0x318dda=_0x318dda-0x0;var _0x3f97ca=_0xf12a[_0x318dda];return _0x3f97ca;};'use strict';var _=require(_0xaf12('0x0'));var util=require(_0xaf12('0x1'));var logger=require(_0xaf12('0x2'))(_0xaf12('0x3'));var moment=require(_0xaf12('0x4'));var BPromise=require(_0xaf12('0x5'));var rp=require(_0xaf12('0x6'));var fs=require('fs');var path=require(_0xaf12('0x7'));var rimraf=require(_0xaf12('0x8'));var config=require('../../config/environment');var attributes=require(_0xaf12('0x9'));var integrations=require('../../components/integrations/configuration');module[_0xaf12('0xa')]=function(_0x5d6e96,_0x326fb6){return _0x5d6e96[_0xaf12('0xb')](_0xaf12('0xc'),attributes,{'tableName':_0xaf12('0xd'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x93e7=['bluebird','request-promise','path','rimraf','../../config/environment','./intFreshdeskAccount.attributes','exports','define','lodash','util','../../config/logger','api','moment'];(function(_0xed5f9c,_0x5a25cd){var _0x3a1c43=function(_0x251202){while(--_0x251202){_0xed5f9c['push'](_0xed5f9c['shift']());}};_0x3a1c43(++_0x5a25cd);}(_0x93e7,0x140));var _0x793e=function(_0x5abb00,_0x342d70){_0x5abb00=_0x5abb00-0x0;var _0xf9b854=_0x93e7[_0x5abb00];return _0xf9b854;};'use strict';var _=require(_0x793e('0x0'));var util=require(_0x793e('0x1'));var logger=require(_0x793e('0x2'))(_0x793e('0x3'));var moment=require(_0x793e('0x4'));var BPromise=require(_0x793e('0x5'));var rp=require(_0x793e('0x6'));var fs=require('fs');var path=require(_0x793e('0x7'));var rimraf=require(_0x793e('0x8'));var config=require(_0x793e('0x9'));var attributes=require(_0x793e('0xa'));var integrations=require('../../components/integrations/configuration');module[_0x793e('0xb')]=function(_0x8f96b8,_0x42d1a4){return _0x8f96b8[_0x793e('0xc')]('FreshdeskAccount',attributes,{'tableName':'int_freshdesk_accounts','paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/intFreshdeskAccount/intFreshdeskAccount.rpc.js b/server/api/intFreshdeskAccount/intFreshdeskAccount.rpc.js index e9a9c55..f9171e4 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 _0xf377=['catch','FreshdeskAccount','findAll','options','raw','attributes','limit','include','map','model','GetFreshdeskAccount','ShowFreshdeskAccount','find','util','bluebird','randomstring','../../mysqldb','../../config/utils','../../config/logger','rpc','client','http','then','request\x20sent','debug','stringify','error','code','FreshdeskAccount,\x20%s,\x20%s','message','info'];(function(_0x2f413d,_0x11049b){var _0x130675=function(_0x2550c5){while(--_0x2550c5){_0x2f413d['push'](_0x2f413d['shift']());}};_0x130675(++_0x11049b);}(_0xf377,0x89));var _0x7f37=function(_0x47a7d0,_0x4e182d){_0x47a7d0=_0x47a7d0-0x0;var _0xb9bd08=_0xf377[_0x47a7d0];return _0xb9bd08;};'use strict';var _=require('lodash');var util=require(_0x7f37('0x0'));var moment=require('moment');var BPromise=require(_0x7f37('0x1'));var rs=require(_0x7f37('0x2'));var fs=require('fs');var Redis=require('ioredis');var db=require(_0x7f37('0x3'))['db'];var utils=require(_0x7f37('0x4'));var logger=require(_0x7f37('0x5'))(_0x7f37('0x6'));var config=require('../../config/environment');var jayson=require('jayson/promise');var client=jayson[_0x7f37('0x7')][_0x7f37('0x8')]({'port':0x232a});function respondWithRpcPromise(_0xb76f41,_0x59ccda,_0x143aca){return new BPromise(function(_0x3be077,_0x524aff){return client['request'](_0xb76f41,_0x143aca)[_0x7f37('0x9')](function(_0x26f775){logger['info']('FreshdeskAccount,\x20%s,\x20%s',_0x59ccda,_0x7f37('0xa'));logger[_0x7f37('0xb')]('FreshdeskAccount,\x20%s,\x20%s,\x20%s',_0x59ccda,_0x7f37('0xa'),JSON[_0x7f37('0xc')](_0x26f775));if(_0x26f775[_0x7f37('0xd')]){if(_0x26f775['error'][_0x7f37('0xe')]===0x1f4){logger[_0x7f37('0xd')](_0x7f37('0xf'),_0x59ccda,_0x26f775[_0x7f37('0xd')][_0x7f37('0x10')]);return _0x524aff(_0x26f775[_0x7f37('0xd')][_0x7f37('0x10')]);}logger['error']('FreshdeskAccount,\x20%s,\x20%s',_0x59ccda,_0x26f775[_0x7f37('0xd')]['message']);return _0x3be077(_0x26f775[_0x7f37('0xd')]['message']);}else{logger[_0x7f37('0x11')](_0x7f37('0xf'),_0x59ccda,_0x7f37('0xa'));_0x3be077(_0x26f775['result'][_0x7f37('0x10')]);}})[_0x7f37('0x12')](function(_0x1f9a0b){logger['error'](_0x7f37('0xf'),_0x59ccda,_0x1f9a0b);_0x524aff(_0x1f9a0b);});});}exports['GetFreshdeskAccount']=function(_0x1f342d){var _0x59a492=this;return new Promise(function(_0x4249cf,_0x25eadb){return db[_0x7f37('0x13')][_0x7f37('0x14')]({'raw':_0x1f342d[_0x7f37('0x15')]?_0x1f342d[_0x7f37('0x15')][_0x7f37('0x16')]===undefined?!![]:![]:!![],'where':_0x1f342d[_0x7f37('0x15')]?_0x1f342d[_0x7f37('0x15')]['where']||null:null,'attributes':_0x1f342d[_0x7f37('0x15')]?_0x1f342d['options'][_0x7f37('0x17')]||null:null,'limit':_0x1f342d['options']?_0x1f342d[_0x7f37('0x15')][_0x7f37('0x18')]||null:null,'include':_0x1f342d[_0x7f37('0x15')]?_0x1f342d[_0x7f37('0x15')][_0x7f37('0x19')]?_['map'](_0x1f342d[_0x7f37('0x15')]['include'],function(_0x428054){return{'model':db[_0x428054['model']],'as':_0x428054['as'],'attributes':_0x428054['attributes'],'include':_0x428054[_0x7f37('0x19')]?_[_0x7f37('0x1a')](_0x428054[_0x7f37('0x19')],function(_0x8e4855){return{'model':db[_0x8e4855[_0x7f37('0x1b')]],'as':_0x8e4855['as'],'attributes':_0x8e4855[_0x7f37('0x17')],'include':_0x8e4855[_0x7f37('0x19')]?_[_0x7f37('0x1a')](_0x8e4855[_0x7f37('0x19')],function(_0x402320){return{'model':db[_0x402320[_0x7f37('0x1b')]],'as':_0x402320['as'],'attributes':_0x402320[_0x7f37('0x17')]};}):[]};}):[]};}):[]:[]})[_0x7f37('0x9')](function(_0x55eddf){logger[_0x7f37('0x11')]('GetFreshdeskAccount',_0x1f342d);logger[_0x7f37('0xb')](_0x7f37('0x1c'),_0x1f342d,JSON[_0x7f37('0xc')](_0x55eddf));_0x4249cf(_0x55eddf);})['catch'](function(_0x46fc6c){logger[_0x7f37('0xd')](_0x7f37('0x1c'),_0x46fc6c[_0x7f37('0x10')],_0x1f342d);_0x25eadb(_0x59a492[_0x7f37('0xd')](0x1f4,_0x46fc6c['message']));});});};exports[_0x7f37('0x1d')]=function(_0x6d355d){var _0x3716de=this;return new Promise(function(_0x1ebc05,_0x30418b){return db['FreshdeskAccount'][_0x7f37('0x1e')]({'raw':_0x6d355d[_0x7f37('0x15')]?_0x6d355d[_0x7f37('0x15')][_0x7f37('0x16')]===undefined?!![]:![]:!![],'where':_0x6d355d[_0x7f37('0x15')]?_0x6d355d[_0x7f37('0x15')]['where']||null:null,'attributes':_0x6d355d['options']?_0x6d355d[_0x7f37('0x15')][_0x7f37('0x17')]||null:null,'include':_0x6d355d[_0x7f37('0x15')]?_0x6d355d[_0x7f37('0x15')]['include']?_[_0x7f37('0x1a')](_0x6d355d[_0x7f37('0x15')]['include'],function(_0x2a6bf1){return{'model':db[_0x2a6bf1[_0x7f37('0x1b')]],'as':_0x2a6bf1['as'],'attributes':_0x2a6bf1[_0x7f37('0x17')],'include':_0x2a6bf1['include']?_['map'](_0x2a6bf1[_0x7f37('0x19')],function(_0x5c4953){return{'model':db[_0x5c4953[_0x7f37('0x1b')]],'as':_0x5c4953['as'],'attributes':_0x5c4953[_0x7f37('0x17')],'include':_0x5c4953[_0x7f37('0x19')]?_['map'](_0x5c4953[_0x7f37('0x19')],function(_0x1c07c1){return{'model':db[_0x1c07c1[_0x7f37('0x1b')]],'as':_0x1c07c1['as'],'attributes':_0x1c07c1[_0x7f37('0x17')]};}):[]};}):[]};}):[]:[]})[_0x7f37('0x9')](function(_0x182d96){logger['info'](_0x7f37('0x1d'),_0x6d355d);logger[_0x7f37('0xb')]('ShowFreshdeskAccount',_0x6d355d,JSON[_0x7f37('0xc')](_0x182d96));_0x1ebc05(_0x182d96);})['catch'](function(_0xa87885){logger[_0x7f37('0xd')](_0x7f37('0x1d'),_0xa87885['message'],_0x6d355d);_0x30418b(_0x3716de[_0x7f37('0xd')](0x1f4,_0xa87885[_0x7f37('0x10')]));});});}; \ No newline at end of file +var _0xab8f=['stringify','error','code','FreshdeskAccount,\x20%s,\x20%s','message','result','catch','GetFreshdeskAccount','FreshdeskAccount','options','where','limit','include','map','model','attributes','then','ShowFreshdeskAccount','find','lodash','util','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','client','http','info','request\x20sent','debug'];(function(_0xc828fd,_0x1f15e0){var _0x7f43db=function(_0x212db3){while(--_0x212db3){_0xc828fd['push'](_0xc828fd['shift']());}};_0x7f43db(++_0x1f15e0);}(_0xab8f,0x12b));var _0xfab8=function(_0x1b58f4,_0x287cb6){_0x1b58f4=_0x1b58f4-0x0;var _0x1b6cdc=_0xab8f[_0x1b58f4];return _0x1b6cdc;};'use strict';var _=require(_0xfab8('0x0'));var util=require(_0xfab8('0x1'));var moment=require(_0xfab8('0x2'));var BPromise=require(_0xfab8('0x3'));var rs=require(_0xfab8('0x4'));var fs=require('fs');var Redis=require(_0xfab8('0x5'));var db=require(_0xfab8('0x6'))['db'];var utils=require(_0xfab8('0x7'));var logger=require(_0xfab8('0x8'))(_0xfab8('0x9'));var config=require(_0xfab8('0xa'));var jayson=require('jayson/promise');var client=jayson[_0xfab8('0xb')][_0xfab8('0xc')]({'port':0x232a});function respondWithRpcPromise(_0x2ca3c7,_0x2da4ab,_0x378fb6){return new BPromise(function(_0x45ac0e,_0x2c1121){return client['request'](_0x2ca3c7,_0x378fb6)['then'](function(_0x54ad19){logger[_0xfab8('0xd')]('FreshdeskAccount,\x20%s,\x20%s',_0x2da4ab,_0xfab8('0xe'));logger[_0xfab8('0xf')]('FreshdeskAccount,\x20%s,\x20%s,\x20%s',_0x2da4ab,_0xfab8('0xe'),JSON[_0xfab8('0x10')](_0x54ad19));if(_0x54ad19[_0xfab8('0x11')]){if(_0x54ad19[_0xfab8('0x11')][_0xfab8('0x12')]===0x1f4){logger['error'](_0xfab8('0x13'),_0x2da4ab,_0x54ad19['error'][_0xfab8('0x14')]);return _0x2c1121(_0x54ad19[_0xfab8('0x11')][_0xfab8('0x14')]);}logger['error'](_0xfab8('0x13'),_0x2da4ab,_0x54ad19[_0xfab8('0x11')][_0xfab8('0x14')]);return _0x45ac0e(_0x54ad19[_0xfab8('0x11')][_0xfab8('0x14')]);}else{logger[_0xfab8('0xd')](_0xfab8('0x13'),_0x2da4ab,_0xfab8('0xe'));_0x45ac0e(_0x54ad19[_0xfab8('0x15')][_0xfab8('0x14')]);}})[_0xfab8('0x16')](function(_0xdb7559){logger['error'](_0xfab8('0x13'),_0x2da4ab,_0xdb7559);_0x2c1121(_0xdb7559);});});}exports[_0xfab8('0x17')]=function(_0x51ea98){var _0x4040fc=this;return new Promise(function(_0x5f4411,_0x7f92a3){return db[_0xfab8('0x18')]['findAll']({'raw':_0x51ea98['options']?_0x51ea98[_0xfab8('0x19')]['raw']===undefined?!![]:![]:!![],'where':_0x51ea98[_0xfab8('0x19')]?_0x51ea98[_0xfab8('0x19')][_0xfab8('0x1a')]||null:null,'attributes':_0x51ea98['options']?_0x51ea98['options']['attributes']||null:null,'limit':_0x51ea98['options']?_0x51ea98['options'][_0xfab8('0x1b')]||null:null,'include':_0x51ea98['options']?_0x51ea98[_0xfab8('0x19')][_0xfab8('0x1c')]?_[_0xfab8('0x1d')](_0x51ea98[_0xfab8('0x19')]['include'],function(_0x1719de){return{'model':db[_0x1719de[_0xfab8('0x1e')]],'as':_0x1719de['as'],'attributes':_0x1719de['attributes'],'include':_0x1719de[_0xfab8('0x1c')]?_['map'](_0x1719de['include'],function(_0x70f543){return{'model':db[_0x70f543[_0xfab8('0x1e')]],'as':_0x70f543['as'],'attributes':_0x70f543[_0xfab8('0x1f')],'include':_0x70f543[_0xfab8('0x1c')]?_[_0xfab8('0x1d')](_0x70f543['include'],function(_0x42f922){return{'model':db[_0x42f922[_0xfab8('0x1e')]],'as':_0x42f922['as'],'attributes':_0x42f922['attributes']};}):[]};}):[]};}):[]:[]})[_0xfab8('0x20')](function(_0x363eb0){logger[_0xfab8('0xd')](_0xfab8('0x17'),_0x51ea98);logger['debug'](_0xfab8('0x17'),_0x51ea98,JSON[_0xfab8('0x10')](_0x363eb0));_0x5f4411(_0x363eb0);})['catch'](function(_0x5cb3c3){logger[_0xfab8('0x11')](_0xfab8('0x17'),_0x5cb3c3[_0xfab8('0x14')],_0x51ea98);_0x7f92a3(_0x4040fc[_0xfab8('0x11')](0x1f4,_0x5cb3c3[_0xfab8('0x14')]));});});};exports[_0xfab8('0x21')]=function(_0x16e41c){var _0x4443ca=this;return new Promise(function(_0x51387b,_0x4d05f8){return db[_0xfab8('0x18')][_0xfab8('0x22')]({'raw':_0x16e41c[_0xfab8('0x19')]?_0x16e41c[_0xfab8('0x19')]['raw']===undefined?!![]:![]:!![],'where':_0x16e41c['options']?_0x16e41c[_0xfab8('0x19')][_0xfab8('0x1a')]||null:null,'attributes':_0x16e41c[_0xfab8('0x19')]?_0x16e41c[_0xfab8('0x19')][_0xfab8('0x1f')]||null:null,'include':_0x16e41c[_0xfab8('0x19')]?_0x16e41c[_0xfab8('0x19')][_0xfab8('0x1c')]?_['map'](_0x16e41c[_0xfab8('0x19')][_0xfab8('0x1c')],function(_0x49ec6f){return{'model':db[_0x49ec6f[_0xfab8('0x1e')]],'as':_0x49ec6f['as'],'attributes':_0x49ec6f[_0xfab8('0x1f')],'include':_0x49ec6f[_0xfab8('0x1c')]?_[_0xfab8('0x1d')](_0x49ec6f[_0xfab8('0x1c')],function(_0x991660){return{'model':db[_0x991660['model']],'as':_0x991660['as'],'attributes':_0x991660['attributes'],'include':_0x991660[_0xfab8('0x1c')]?_['map'](_0x991660[_0xfab8('0x1c')],function(_0x1c03fb){return{'model':db[_0x1c03fb['model']],'as':_0x1c03fb['as'],'attributes':_0x1c03fb[_0xfab8('0x1f')]};}):[]};}):[]};}):[]:[]})[_0xfab8('0x20')](function(_0xc2c50b){logger['info'](_0xfab8('0x21'),_0x16e41c);logger[_0xfab8('0xf')]('ShowFreshdeskAccount',_0x16e41c,JSON['stringify'](_0xc2c50b));_0x51387b(_0xc2c50b);})[_0xfab8('0x16')](function(_0x86354){logger[_0xfab8('0x11')]('ShowFreshdeskAccount',_0x86354['message'],_0x16e41c);_0x4d05f8(_0x4443ca[_0xfab8('0x11')](0x1f4,_0x86354[_0xfab8('0x14')]));});});}; \ No newline at end of file diff --git a/server/api/intFreshdeskConfiguration/index.js b/server/api/intFreshdeskConfiguration/index.js index 0cc0c4e..89d0f0c 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 _0x85a6=['getDescriptions','/:id/tags','getTags','post','create','setTags','update','delete','/:id','destroy','exports','multer','util','connect-timeout','express','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','./intFreshdeskConfiguration.controller','isAuthenticated','index','get','show','/:id/fields','getFields','/:id/subjects','/:id/descriptions'];(function(_0x45aa72,_0x8af642){var _0x75adaa=function(_0x1f6809){while(--_0x1f6809){_0x45aa72['push'](_0x45aa72['shift']());}};_0x75adaa(++_0x8af642);}(_0x85a6,0x193));var _0x685a=function(_0x358bec,_0x4f9604){_0x358bec=_0x358bec-0x0;var _0x2dda1b=_0x85a6[_0x358bec];return _0x2dda1b;};'use strict';var multer=require(_0x685a('0x0'));var util=require(_0x685a('0x1'));var path=require('path');var timeout=require(_0x685a('0x2'));var express=require(_0x685a('0x3'));var router=express['Router']();var fs_extra=require(_0x685a('0x4'));var auth=require(_0x685a('0x5'));var interaction=require(_0x685a('0x6'));var config=require(_0x685a('0x7'));var controller=require(_0x685a('0x8'));router['get']('/',auth[_0x685a('0x9')](),controller[_0x685a('0xa')]);router[_0x685a('0xb')]('/:id',auth[_0x685a('0x9')](),controller[_0x685a('0xc')]);router[_0x685a('0xb')](_0x685a('0xd'),auth['isAuthenticated'](),controller[_0x685a('0xe')]);router['get'](_0x685a('0xf'),auth[_0x685a('0x9')](),controller['getSubjects']);router[_0x685a('0xb')](_0x685a('0x10'),auth[_0x685a('0x9')](),controller[_0x685a('0x11')]);router['get'](_0x685a('0x12'),auth[_0x685a('0x9')](),controller[_0x685a('0x13')]);router[_0x685a('0x14')]('/',auth[_0x685a('0x9')](),controller[_0x685a('0x15')]);router[_0x685a('0x14')]('/:id/tags',auth[_0x685a('0x9')](),controller[_0x685a('0x16')]);router['put']('/:id',auth['isAuthenticated'](),controller[_0x685a('0x17')]);router[_0x685a('0x18')](_0x685a('0x19'),auth[_0x685a('0x9')](),controller[_0x685a('0x1a')]);module[_0x685a('0x1b')]=router; \ No newline at end of file +var _0xe07c=['post','create','setTags','put','update','delete','destroy','exports','util','path','connect-timeout','express','../../components/auth/service','../../components/interaction/service','./intFreshdeskConfiguration.controller','get','index','/:id','/:id/fields','isAuthenticated','getFields','getSubjects','/:id/descriptions','getDescriptions','getTags'];(function(_0x74c6c6,_0x54d54e){var _0x56ba8b=function(_0x2c885f){while(--_0x2c885f){_0x74c6c6['push'](_0x74c6c6['shift']());}};_0x56ba8b(++_0x54d54e);}(_0xe07c,0xb7));var _0xce07=function(_0x411017,_0x4a8117){_0x411017=_0x411017-0x0;var _0x2adeea=_0xe07c[_0x411017];return _0x2adeea;};'use strict';var multer=require('multer');var util=require(_0xce07('0x0'));var path=require(_0xce07('0x1'));var timeout=require(_0xce07('0x2'));var express=require(_0xce07('0x3'));var router=express['Router']();var fs_extra=require('fs-extra');var auth=require(_0xce07('0x4'));var interaction=require(_0xce07('0x5'));var config=require('../../config/environment');var controller=require(_0xce07('0x6'));router[_0xce07('0x7')]('/',auth['isAuthenticated'](),controller[_0xce07('0x8')]);router[_0xce07('0x7')](_0xce07('0x9'),auth['isAuthenticated'](),controller['show']);router[_0xce07('0x7')](_0xce07('0xa'),auth[_0xce07('0xb')](),controller[_0xce07('0xc')]);router[_0xce07('0x7')]('/:id/subjects',auth[_0xce07('0xb')](),controller[_0xce07('0xd')]);router[_0xce07('0x7')](_0xce07('0xe'),auth[_0xce07('0xb')](),controller[_0xce07('0xf')]);router[_0xce07('0x7')]('/:id/tags',auth['isAuthenticated'](),controller[_0xce07('0x10')]);router[_0xce07('0x11')]('/',auth[_0xce07('0xb')](),controller[_0xce07('0x12')]);router[_0xce07('0x11')]('/:id/tags',auth[_0xce07('0xb')](),controller[_0xce07('0x13')]);router[_0xce07('0x14')]('/:id',auth[_0xce07('0xb')](),controller[_0xce07('0x15')]);router[_0xce07('0x16')]('/:id',auth['isAuthenticated'](),controller[_0xce07('0x17')]);module[_0xce07('0x18')]=router; \ No newline at end of file diff --git a/server/api/intFreshdeskConfiguration/intFreshdeskConfiguration.attributes.js b/server/api/intFreshdeskConfiguration/intFreshdeskConfiguration.attributes.js index d4554aa..ebf27bb 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 _0xb02f=['STRING','sequelize','exports'];(function(_0x569758,_0x47b9ad){var _0x30f4ac=function(_0x5130aa){while(--_0x5130aa){_0x569758['push'](_0x569758['shift']());}};_0x30f4ac(++_0x47b9ad);}(_0xb02f,0x1d2));var _0xfb02=function(_0x40c2e5,_0xb0cbb4){_0x40c2e5=_0x40c2e5-0x0;var _0x10fa77=_0xb02f[_0x40c2e5];return _0x10fa77;};'use strict';var Sequelize=require(_0xfb02('0x0'));module[_0xfb02('0x1')]={'name':{'type':Sequelize[_0xfb02('0x2')]},'description':{'type':Sequelize[_0xfb02('0x2')]}}; \ No newline at end of file +var _0x25d8=['exports','STRING','sequelize'];(function(_0x6a4136,_0x3516cb){var _0x36b1a0=function(_0x56fe90){while(--_0x56fe90){_0x6a4136['push'](_0x6a4136['shift']());}};_0x36b1a0(++_0x3516cb);}(_0x25d8,0x1e2));var _0x825d=function(_0x2c778b,_0x33c04e){_0x2c778b=_0x2c778b-0x0;var _0x59a1c2=_0x25d8[_0x2c778b];return _0x59a1c2;};'use strict';var Sequelize=require(_0x825d('0x0'));module[_0x825d('0x1')]={'name':{'type':Sequelize[_0x825d('0x2')]},'description':{'type':Sequelize['STRING']}}; \ No newline at end of file diff --git a/server/api/intFreshdeskConfiguration/intFreshdeskConfiguration.controller.js b/server/api/intFreshdeskConfiguration/intFreshdeskConfiguration.controller.js index c6bdedb..58e14df 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 _0xdbe2=['include','findAll','rows','show','params','merge','create','body','catch','find','destroy','getFields','FreshdeskField','getSubjects','getDescriptions','findOne','getTags','Tag','setTags','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','moment','bluebird','mustache','util','path','sox','to-csv','ejs','fs-extra','squel','crypto','desk.js','papaparse','ioredis','../../components/auth/service','../../components/parsers/advancedSearch','../../config/license/hardware','api','../../config/utils','../../config/environment','../../mysqldb','sendStatus','end','status','json','offset','undefined','limit','count','set','Content-Range','apply','reject','update','then','name','send','index','map','FreshdeskConfiguration','rawAttributes','type','query','keys','intersection','model','fields','attributes','length','hasOwnProperty','nolimit','order','sort','where','filters','pick','VIRTUAL','filter','options','includeAll'];(function(_0xd1a2c4,_0x53f38d){var _0x2a1d77=function(_0x212f23){while(--_0x212f23){_0xd1a2c4['push'](_0xd1a2c4['shift']());}};_0x2a1d77(++_0x53f38d);}(_0xdbe2,0x10f));var _0x2dbe=function(_0x15f27e,_0x547fea){_0x15f27e=_0x15f27e-0x0;var _0x18da4f=_0xdbe2[_0x15f27e];return _0x18da4f;};'use strict';var emlformat=require(_0x2dbe('0x0'));var rimraf=require(_0x2dbe('0x1'));var zipdir=require(_0x2dbe('0x2'));var jsonpatch=require(_0x2dbe('0x3'));var rp=require(_0x2dbe('0x4'));var moment=require(_0x2dbe('0x5'));var BPromise=require(_0x2dbe('0x6'));var Mustache=require(_0x2dbe('0x7'));var util=require(_0x2dbe('0x8'));var path=require(_0x2dbe('0x9'));var sox=require(_0x2dbe('0xa'));var csv=require(_0x2dbe('0xb'));var ejs=require(_0x2dbe('0xc'));var fs=require('fs');var fs_extra=require(_0x2dbe('0xd'));var _=require('lodash');var squel=require(_0x2dbe('0xe'));var crypto=require(_0x2dbe('0xf'));var jsforce=require('jsforce');var deskjs=require(_0x2dbe('0x10'));var toCsv=require('to-csv');var querystring=require('querystring');var Papa=require(_0x2dbe('0x11'));var Redis=require(_0x2dbe('0x12'));var authService=require(_0x2dbe('0x13'));var qs=require('../../components/parsers/qs');var as=require(_0x2dbe('0x14'));var hardwareService=require(_0x2dbe('0x15'));var logger=require('../../config/logger')(_0x2dbe('0x16'));var utils=require(_0x2dbe('0x17'));var config=require(_0x2dbe('0x18'));var licenseUtil=require('../../config/license/util');var db=require(_0x2dbe('0x19'))['db'];function respondWithStatusCode(_0x5563f6,_0x2b019a){_0x2b019a=_0x2b019a||0xcc;return function(_0x13f938){if(_0x13f938){return _0x5563f6[_0x2dbe('0x1a')](_0x2b019a);}return _0x5563f6['status'](_0x2b019a)[_0x2dbe('0x1b')]();};}function respondWithResult(_0x3b6902,_0x5c1aac){_0x5c1aac=_0x5c1aac||0xc8;return function(_0x13e893){if(_0x13e893){return _0x3b6902[_0x2dbe('0x1c')](_0x5c1aac)[_0x2dbe('0x1d')](_0x13e893);}};}function respondWithFilteredResult(_0x10e817,_0x442723){return function(_0x4dff22){if(_0x4dff22){var _0x57a285=typeof _0x442723[_0x2dbe('0x1e')]===_0x2dbe('0x1f')&&typeof _0x442723[_0x2dbe('0x20')]===_0x2dbe('0x1f');var _0x2c20ce=_0x4dff22[_0x2dbe('0x21')];var _0x30730e=_0x57a285?0x0:_0x442723[_0x2dbe('0x1e')];var _0x8c3406=_0x57a285?_0x4dff22['count']:_0x442723[_0x2dbe('0x1e')]+_0x442723[_0x2dbe('0x20')];var _0x4bbbe5;if(_0x8c3406>=_0x2c20ce){_0x8c3406=_0x2c20ce;_0x4bbbe5=0xc8;}else{_0x4bbbe5=0xce;}_0x10e817['status'](_0x4bbbe5);return _0x10e817[_0x2dbe('0x22')](_0x2dbe('0x23'),_0x30730e+'-'+_0x8c3406+'/'+_0x2c20ce)[_0x2dbe('0x1d')](_0x4dff22);}return null;};}function patchUpdates(_0x10ef86){return function(_0x1b9093){try{jsonpatch[_0x2dbe('0x24')](_0x1b9093,_0x10ef86,!![]);}catch(_0xc3e256){return BPromise[_0x2dbe('0x25')](_0xc3e256);}return _0x1b9093['save']();};}function saveUpdates(_0x8e54ba,_0x2b5c0e){return function(_0x3f05a6){if(_0x3f05a6){return _0x3f05a6[_0x2dbe('0x26')](_0x8e54ba)[_0x2dbe('0x27')](function(_0x3b003c){return _0x3b003c;});}return null;};}function removeEntity(_0x23ce98,_0x4baf6d){return function(_0x337164){if(_0x337164){return _0x337164['destroy']()[_0x2dbe('0x27')](function(){_0x23ce98[_0x2dbe('0x1c')](0xcc)[_0x2dbe('0x1b')]();});}};}function handleEntityNotFound(_0x2dc67e,_0x7d471e){return function(_0x3b6df0){if(!_0x3b6df0){_0x2dc67e[_0x2dbe('0x1a')](0x194);}return _0x3b6df0;};}function handleError(_0x27d856,_0x10c46f){_0x10c46f=_0x10c46f||0x1f4;return function(_0x4908de){logger['error'](_0x4908de['stack']);if(_0x4908de[_0x2dbe('0x28')]){delete _0x4908de[_0x2dbe('0x28')];}_0x27d856[_0x2dbe('0x1c')](_0x10c46f)[_0x2dbe('0x29')](_0x4908de);};}exports[_0x2dbe('0x2a')]=function(_0x54b1a8,_0x42f796){var _0x151aef={},_0x16a6e3={},_0x297d0d={'count':0x0,'rows':[]};var _0x230eb8=_[_0x2dbe('0x2b')](db[_0x2dbe('0x2c')][_0x2dbe('0x2d')],function(_0x484bdc){return{'name':_0x484bdc['fieldName'],'type':_0x484bdc[_0x2dbe('0x2e')]['key']};});_0x16a6e3['model']=_[_0x2dbe('0x2b')](_0x230eb8,_0x2dbe('0x28'));_0x16a6e3[_0x2dbe('0x2f')]=_[_0x2dbe('0x30')](_0x54b1a8[_0x2dbe('0x2f')]);_0x16a6e3['filters']=_[_0x2dbe('0x31')](_0x16a6e3[_0x2dbe('0x32')],_0x16a6e3[_0x2dbe('0x2f')]);_0x151aef['attributes']=_[_0x2dbe('0x31')](_0x16a6e3[_0x2dbe('0x32')],qs[_0x2dbe('0x33')](_0x54b1a8[_0x2dbe('0x2f')][_0x2dbe('0x33')]));_0x151aef[_0x2dbe('0x34')]=_0x151aef[_0x2dbe('0x34')][_0x2dbe('0x35')]?_0x151aef[_0x2dbe('0x34')]:_0x16a6e3[_0x2dbe('0x32')];if(!_0x54b1a8['query'][_0x2dbe('0x36')](_0x2dbe('0x37'))){_0x151aef['limit']=qs['limit'](_0x54b1a8[_0x2dbe('0x2f')][_0x2dbe('0x20')]);_0x151aef[_0x2dbe('0x1e')]=qs[_0x2dbe('0x1e')](_0x54b1a8[_0x2dbe('0x2f')][_0x2dbe('0x1e')]);}_0x151aef[_0x2dbe('0x38')]=qs[_0x2dbe('0x39')](_0x54b1a8[_0x2dbe('0x2f')][_0x2dbe('0x39')]);_0x151aef[_0x2dbe('0x3a')]=qs[_0x2dbe('0x3b')](_[_0x2dbe('0x3c')](_0x54b1a8['query'],_0x16a6e3[_0x2dbe('0x3b')]),_0x230eb8);if(_0x54b1a8[_0x2dbe('0x2f')]['filter']){_0x151aef[_0x2dbe('0x3a')]=_['merge'](_0x151aef[_0x2dbe('0x3a')],{'$or':_[_0x2dbe('0x2b')](_0x230eb8,function(_0xff5e09){if(_0xff5e09[_0x2dbe('0x2e')]!==_0x2dbe('0x3d')){var _0x4bf9da={};_0x4bf9da[_0xff5e09[_0x2dbe('0x28')]]={'$like':'%'+_0x54b1a8[_0x2dbe('0x2f')][_0x2dbe('0x3e')]+'%'};return _0x4bf9da;}})});}_0x151aef=_['merge']({},_0x151aef,_0x54b1a8[_0x2dbe('0x3f')]);var _0x150028={'where':_0x151aef[_0x2dbe('0x3a')]};return db[_0x2dbe('0x2c')]['count'](_0x150028)[_0x2dbe('0x27')](function(_0x3676e4){_0x297d0d[_0x2dbe('0x21')]=_0x3676e4;if(_0x54b1a8['query'][_0x2dbe('0x40')]){_0x151aef[_0x2dbe('0x41')]=[{'all':!![]}];}return db[_0x2dbe('0x2c')][_0x2dbe('0x42')](_0x151aef);})[_0x2dbe('0x27')](function(_0xfaf309){_0x297d0d[_0x2dbe('0x43')]=_0xfaf309;return _0x297d0d;})['then'](respondWithFilteredResult(_0x42f796,_0x151aef))['catch'](handleError(_0x42f796,null));};exports[_0x2dbe('0x44')]=function(_0x101c2b,_0x844e32){var _0x18eb0c={'raw':![],'where':{'id':_0x101c2b[_0x2dbe('0x45')]['id']}},_0x5f5985={};_0x5f5985[_0x2dbe('0x32')]=_[_0x2dbe('0x30')](db[_0x2dbe('0x2c')][_0x2dbe('0x2d')]);_0x5f5985[_0x2dbe('0x2f')]=_[_0x2dbe('0x30')](_0x101c2b[_0x2dbe('0x2f')]);_0x5f5985['filters']=_[_0x2dbe('0x31')](_0x5f5985['model'],_0x5f5985[_0x2dbe('0x2f')]);_0x18eb0c[_0x2dbe('0x34')]=_[_0x2dbe('0x31')](_0x5f5985['model'],qs[_0x2dbe('0x33')](_0x101c2b[_0x2dbe('0x2f')][_0x2dbe('0x33')]));_0x18eb0c[_0x2dbe('0x34')]=_0x18eb0c[_0x2dbe('0x34')][_0x2dbe('0x35')]?_0x18eb0c[_0x2dbe('0x34')]:_0x5f5985[_0x2dbe('0x32')];if(_0x101c2b[_0x2dbe('0x2f')][_0x2dbe('0x40')]){_0x18eb0c[_0x2dbe('0x41')]=[{'all':!![]}];}_0x18eb0c=_[_0x2dbe('0x46')]({},_0x18eb0c,_0x101c2b['options']);return db['FreshdeskConfiguration']['find'](_0x18eb0c)[_0x2dbe('0x27')](handleEntityNotFound(_0x844e32,null))[_0x2dbe('0x27')](respondWithResult(_0x844e32,null))['catch'](handleError(_0x844e32,null));};exports[_0x2dbe('0x47')]=function(_0x162672,_0x5328a3){return db[_0x2dbe('0x2c')]['create'](_0x162672[_0x2dbe('0x48')],{})[_0x2dbe('0x27')](respondWithResult(_0x5328a3,0xc9))[_0x2dbe('0x49')](handleError(_0x5328a3,null));};exports[_0x2dbe('0x26')]=function(_0x3521e1,_0x59499a){if(_0x3521e1[_0x2dbe('0x48')]['id']){delete _0x3521e1[_0x2dbe('0x48')]['id'];}return db['FreshdeskConfiguration'][_0x2dbe('0x4a')]({'where':{'id':_0x3521e1['params']['id']}})['then'](handleEntityNotFound(_0x59499a,null))[_0x2dbe('0x27')](saveUpdates(_0x3521e1[_0x2dbe('0x48')],null))[_0x2dbe('0x27')](respondWithResult(_0x59499a,null))[_0x2dbe('0x49')](handleError(_0x59499a,null));};exports[_0x2dbe('0x4b')]=function(_0x33a16a,_0x3ad8b1){return db[_0x2dbe('0x2c')]['find']({'where':{'id':_0x33a16a['params']['id']}})[_0x2dbe('0x27')](handleEntityNotFound(_0x3ad8b1,null))[_0x2dbe('0x27')](removeEntity(_0x3ad8b1,null))['catch'](handleError(_0x3ad8b1,null));};exports[_0x2dbe('0x4c')]=function(_0x5a87ca,_0x1cddd1,_0x46c5cd){var _0x4bb829={};var _0xfced98={};var _0x1d44de;var _0x2b6e59;return db[_0x2dbe('0x2c')]['findOne']({'where':{'id':_0x5a87ca[_0x2dbe('0x45')]['id']}})[_0x2dbe('0x27')](handleEntityNotFound(_0x1cddd1,null))[_0x2dbe('0x27')](function(_0x4329e1){if(_0x4329e1){_0x1d44de=_0x4329e1;_0xfced98['model']=_[_0x2dbe('0x30')](db[_0x2dbe('0x4d')]['rawAttributes']);_0xfced98[_0x2dbe('0x2f')]=_[_0x2dbe('0x30')](_0x5a87ca[_0x2dbe('0x2f')]);_0xfced98[_0x2dbe('0x3b')]=_[_0x2dbe('0x31')](_0xfced98[_0x2dbe('0x32')],_0xfced98[_0x2dbe('0x2f')]);_0x4bb829[_0x2dbe('0x34')]=_[_0x2dbe('0x31')](_0xfced98[_0x2dbe('0x32')],qs[_0x2dbe('0x33')](_0x5a87ca[_0x2dbe('0x2f')]['fields']));_0x4bb829[_0x2dbe('0x34')]=_0x4bb829['attributes'][_0x2dbe('0x35')]?_0x4bb829[_0x2dbe('0x34')]:_0xfced98[_0x2dbe('0x32')];_0x4bb829[_0x2dbe('0x38')]=qs['sort'](_0x5a87ca[_0x2dbe('0x2f')][_0x2dbe('0x39')]);_0x4bb829[_0x2dbe('0x3a')]=qs['filters'](_[_0x2dbe('0x3c')](_0x5a87ca[_0x2dbe('0x2f')],_0xfced98[_0x2dbe('0x3b')]));if(_0x5a87ca[_0x2dbe('0x2f')][_0x2dbe('0x3e')]){_0x4bb829[_0x2dbe('0x3a')]=_[_0x2dbe('0x46')](_0x4bb829['where'],{'$or':_[_0x2dbe('0x2b')](_0x4bb829[_0x2dbe('0x34')],function(_0x5de97e){var _0x4caeea={};_0x4caeea[_0x5de97e]={'$like':'%'+_0x5a87ca[_0x2dbe('0x2f')]['filter']+'%'};return _0x4caeea;})});}_0x4bb829=_[_0x2dbe('0x46')]({},_0x4bb829,_0x5a87ca['options']);return _0x1d44de['getFields'](_0x4bb829);}})[_0x2dbe('0x27')](function(_0x53375c){if(_0x53375c){_0x2b6e59=_0x53375c[_0x2dbe('0x35')];if(!_0x5a87ca[_0x2dbe('0x2f')][_0x2dbe('0x36')](_0x2dbe('0x37'))){_0x4bb829[_0x2dbe('0x20')]=qs[_0x2dbe('0x20')](_0x5a87ca[_0x2dbe('0x2f')][_0x2dbe('0x20')]);_0x4bb829['offset']=qs[_0x2dbe('0x1e')](_0x5a87ca[_0x2dbe('0x2f')][_0x2dbe('0x1e')]);}return _0x1d44de[_0x2dbe('0x4c')](_0x4bb829);}})[_0x2dbe('0x27')](function(_0x2df1de){if(_0x2df1de){return _0x2df1de?{'count':_0x2b6e59,'rows':_0x2df1de}:null;}})[_0x2dbe('0x27')](respondWithResult(_0x1cddd1,null))[_0x2dbe('0x49')](handleError(_0x1cddd1,null));};exports['getSubjects']=function(_0x58c67e,_0x580dbd,_0x2f3459){var _0x1823ae={};var _0x4b829f={};var _0x58aabb;var _0x83e630;return db[_0x2dbe('0x2c')]['findOne']({'where':{'id':_0x58c67e['params']['id']}})[_0x2dbe('0x27')](handleEntityNotFound(_0x580dbd,null))[_0x2dbe('0x27')](function(_0x585c68){if(_0x585c68){_0x58aabb=_0x585c68;_0x4b829f[_0x2dbe('0x32')]=_[_0x2dbe('0x30')](db[_0x2dbe('0x4d')][_0x2dbe('0x2d')]);_0x4b829f[_0x2dbe('0x2f')]=_[_0x2dbe('0x30')](_0x58c67e[_0x2dbe('0x2f')]);_0x4b829f['filters']=_['intersection'](_0x4b829f[_0x2dbe('0x32')],_0x4b829f['query']);_0x1823ae[_0x2dbe('0x34')]=_['intersection'](_0x4b829f[_0x2dbe('0x32')],qs['fields'](_0x58c67e['query'][_0x2dbe('0x33')]));_0x1823ae[_0x2dbe('0x34')]=_0x1823ae[_0x2dbe('0x34')][_0x2dbe('0x35')]?_0x1823ae[_0x2dbe('0x34')]:_0x4b829f['model'];_0x1823ae[_0x2dbe('0x38')]=qs[_0x2dbe('0x39')](_0x58c67e[_0x2dbe('0x2f')][_0x2dbe('0x39')]);_0x1823ae['where']=qs[_0x2dbe('0x3b')](_[_0x2dbe('0x3c')](_0x58c67e[_0x2dbe('0x2f')],_0x4b829f['filters']));if(_0x58c67e[_0x2dbe('0x2f')][_0x2dbe('0x3e')]){_0x1823ae['where']=_[_0x2dbe('0x46')](_0x1823ae[_0x2dbe('0x3a')],{'$or':_['map'](_0x1823ae['attributes'],function(_0x2dcaa6){var _0x49e92c={};_0x49e92c[_0x2dcaa6]={'$like':'%'+_0x58c67e[_0x2dbe('0x2f')]['filter']+'%'};return _0x49e92c;})});}_0x1823ae=_['merge']({},_0x1823ae,_0x58c67e[_0x2dbe('0x3f')]);return _0x58aabb[_0x2dbe('0x4e')](_0x1823ae);}})[_0x2dbe('0x27')](function(_0x4b9ea3){if(_0x4b9ea3){_0x83e630=_0x4b9ea3[_0x2dbe('0x35')];if(!_0x58c67e[_0x2dbe('0x2f')][_0x2dbe('0x36')](_0x2dbe('0x37'))){_0x1823ae[_0x2dbe('0x20')]=qs[_0x2dbe('0x20')](_0x58c67e['query']['limit']);_0x1823ae[_0x2dbe('0x1e')]=qs[_0x2dbe('0x1e')](_0x58c67e[_0x2dbe('0x2f')]['offset']);}return _0x58aabb[_0x2dbe('0x4e')](_0x1823ae);}})[_0x2dbe('0x27')](function(_0x541fe5){if(_0x541fe5){return _0x541fe5?{'count':_0x83e630,'rows':_0x541fe5}:null;}})[_0x2dbe('0x27')](respondWithResult(_0x580dbd,null))['catch'](handleError(_0x580dbd,null));};exports[_0x2dbe('0x4f')]=function(_0x47dd4c,_0x107cb9,_0x7bb5a7){var _0x401837={};var _0x26fc30={};var _0xa89c68;var _0x294e3e;return db[_0x2dbe('0x2c')][_0x2dbe('0x50')]({'where':{'id':_0x47dd4c[_0x2dbe('0x45')]['id']}})[_0x2dbe('0x27')](handleEntityNotFound(_0x107cb9,null))[_0x2dbe('0x27')](function(_0x382037){if(_0x382037){_0xa89c68=_0x382037;_0x26fc30[_0x2dbe('0x32')]=_[_0x2dbe('0x30')](db[_0x2dbe('0x4d')][_0x2dbe('0x2d')]);_0x26fc30[_0x2dbe('0x2f')]=_['keys'](_0x47dd4c['query']);_0x26fc30['filters']=_['intersection'](_0x26fc30[_0x2dbe('0x32')],_0x26fc30[_0x2dbe('0x2f')]);_0x401837['attributes']=_[_0x2dbe('0x31')](_0x26fc30[_0x2dbe('0x32')],qs[_0x2dbe('0x33')](_0x47dd4c['query'][_0x2dbe('0x33')]));_0x401837[_0x2dbe('0x34')]=_0x401837[_0x2dbe('0x34')]['length']?_0x401837[_0x2dbe('0x34')]:_0x26fc30[_0x2dbe('0x32')];_0x401837[_0x2dbe('0x38')]=qs[_0x2dbe('0x39')](_0x47dd4c[_0x2dbe('0x2f')][_0x2dbe('0x39')]);_0x401837[_0x2dbe('0x3a')]=qs[_0x2dbe('0x3b')](_[_0x2dbe('0x3c')](_0x47dd4c[_0x2dbe('0x2f')],_0x26fc30[_0x2dbe('0x3b')]));if(_0x47dd4c[_0x2dbe('0x2f')][_0x2dbe('0x3e')]){_0x401837['where']=_[_0x2dbe('0x46')](_0x401837[_0x2dbe('0x3a')],{'$or':_['map'](_0x401837['attributes'],function(_0x203228){var _0x1c0b05={};_0x1c0b05[_0x203228]={'$like':'%'+_0x47dd4c['query']['filter']+'%'};return _0x1c0b05;})});}_0x401837=_['merge']({},_0x401837,_0x47dd4c[_0x2dbe('0x3f')]);return _0xa89c68[_0x2dbe('0x4f')](_0x401837);}})['then'](function(_0x2a5517){if(_0x2a5517){_0x294e3e=_0x2a5517[_0x2dbe('0x35')];if(!_0x47dd4c[_0x2dbe('0x2f')]['hasOwnProperty']('nolimit')){_0x401837['limit']=qs[_0x2dbe('0x20')](_0x47dd4c[_0x2dbe('0x2f')][_0x2dbe('0x20')]);_0x401837['offset']=qs[_0x2dbe('0x1e')](_0x47dd4c['query'][_0x2dbe('0x1e')]);}return _0xa89c68[_0x2dbe('0x4f')](_0x401837);}})['then'](function(_0x54208a){if(_0x54208a){return _0x54208a?{'count':_0x294e3e,'rows':_0x54208a}:null;}})['then'](respondWithResult(_0x107cb9,null))[_0x2dbe('0x49')](handleError(_0x107cb9,null));};exports[_0x2dbe('0x51')]=function(_0x28851f,_0x31cddb,_0x35b249){var _0x2d2e17={};var _0x4854c8={};var _0x3c62aa;var _0x199c1c;return db[_0x2dbe('0x2c')][_0x2dbe('0x50')]({'where':{'id':_0x28851f[_0x2dbe('0x45')]['id']}})['then'](handleEntityNotFound(_0x31cddb,null))['then'](function(_0x373bd7){if(_0x373bd7){_0x3c62aa=_0x373bd7;_0x4854c8[_0x2dbe('0x32')]=_[_0x2dbe('0x30')](db[_0x2dbe('0x52')][_0x2dbe('0x2d')]);_0x4854c8[_0x2dbe('0x2f')]=_['keys'](_0x28851f[_0x2dbe('0x2f')]);_0x4854c8[_0x2dbe('0x3b')]=_[_0x2dbe('0x31')](_0x4854c8[_0x2dbe('0x32')],_0x4854c8[_0x2dbe('0x2f')]);_0x2d2e17['attributes']=_[_0x2dbe('0x31')](_0x4854c8[_0x2dbe('0x32')],qs['fields'](_0x28851f[_0x2dbe('0x2f')][_0x2dbe('0x33')]));_0x2d2e17[_0x2dbe('0x34')]=_0x2d2e17[_0x2dbe('0x34')][_0x2dbe('0x35')]?_0x2d2e17[_0x2dbe('0x34')]:_0x4854c8['model'];_0x2d2e17[_0x2dbe('0x38')]=qs['sort'](_0x28851f[_0x2dbe('0x2f')]['sort']);_0x2d2e17[_0x2dbe('0x3a')]=qs['filters'](_[_0x2dbe('0x3c')](_0x28851f[_0x2dbe('0x2f')],_0x4854c8['filters']));if(_0x28851f['query'][_0x2dbe('0x3e')]){_0x2d2e17[_0x2dbe('0x3a')]=_['merge'](_0x2d2e17[_0x2dbe('0x3a')],{'$or':_['map'](_0x2d2e17[_0x2dbe('0x34')],function(_0x18b331){var _0x573019={};_0x573019[_0x18b331]={'$like':'%'+_0x28851f[_0x2dbe('0x2f')][_0x2dbe('0x3e')]+'%'};return _0x573019;})});}_0x2d2e17=_[_0x2dbe('0x46')]({},_0x2d2e17,_0x28851f[_0x2dbe('0x3f')]);return _0x3c62aa[_0x2dbe('0x51')](_0x2d2e17);}})[_0x2dbe('0x27')](function(_0x4e9b75){if(_0x4e9b75){_0x199c1c=_0x4e9b75[_0x2dbe('0x35')];if(!_0x28851f[_0x2dbe('0x2f')][_0x2dbe('0x36')]('nolimit')){_0x2d2e17[_0x2dbe('0x20')]=qs['limit'](_0x28851f[_0x2dbe('0x2f')][_0x2dbe('0x20')]);_0x2d2e17['offset']=qs[_0x2dbe('0x1e')](_0x28851f[_0x2dbe('0x2f')]['offset']);}return _0x3c62aa[_0x2dbe('0x51')](_0x2d2e17);}})[_0x2dbe('0x27')](function(_0x5b41d6){if(_0x5b41d6){return _0x5b41d6?{'count':_0x199c1c,'rows':_0x5b41d6}:null;}})[_0x2dbe('0x27')](respondWithResult(_0x31cddb,null))[_0x2dbe('0x49')](handleError(_0x31cddb,null));};exports[_0x2dbe('0x53')]=function(_0x3c0b3f,_0x35057f,_0x168f9a){if(_0x3c0b3f[_0x2dbe('0x48')]['id']){delete _0x3c0b3f[_0x2dbe('0x48')]['id'];}return db[_0x2dbe('0x2c')][_0x2dbe('0x50')]({'where':{'id':_0x3c0b3f[_0x2dbe('0x45')]['id']}})[_0x2dbe('0x27')](handleEntityNotFound(_0x35057f,null))[_0x2dbe('0x27')](function(_0x35b441){if(_0x35b441){return _0x35b441['setTags'](_0x3c0b3f[_0x2dbe('0x48')]['ids']||[]);}return null;})['then'](respondWithResult(_0x35057f,null))[_0x2dbe('0x49')](handleError(_0x35057f,null));}; \ No newline at end of file +var _0x069a=['getFields','pick','getSubjects','getDescriptions','findOne','Tag','getTags','setTags','ids','eml-format','fast-json-patch','moment','bluebird','util','sox','to-csv','fs-extra','squel','jsforce','desk.js','querystring','ioredis','../../components/auth/service','../../components/parsers/qs','../../config/logger','api','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','status','end','json','offset','limit','count','Content-Range','apply','reject','update','then','sendStatus','error','name','send','index','map','rawAttributes','fieldName','type','key','query','keys','attributes','intersection','model','fields','hasOwnProperty','nolimit','order','sort','where','filter','merge','VIRTUAL','options','FreshdeskConfiguration','include','rows','catch','params','filters','length','find','create','body','destroy','FreshdeskField'];(function(_0x4883cb,_0x3df63c){var _0x33aad7=function(_0x2e901e){while(--_0x2e901e){_0x4883cb['push'](_0x4883cb['shift']());}};_0x33aad7(++_0x3df63c);}(_0x069a,0x1dd));var _0xa069=function(_0xef0047,_0x9e2479){_0xef0047=_0xef0047-0x0;var _0x738f92=_0x069a[_0xef0047];return _0x738f92;};'use strict';var emlformat=require(_0xa069('0x0'));var rimraf=require('rimraf');var zipdir=require('zip-dir');var jsonpatch=require(_0xa069('0x1'));var rp=require('request-promise');var moment=require(_0xa069('0x2'));var BPromise=require(_0xa069('0x3'));var Mustache=require('mustache');var util=require(_0xa069('0x4'));var path=require('path');var sox=require(_0xa069('0x5'));var csv=require(_0xa069('0x6'));var ejs=require('ejs');var fs=require('fs');var fs_extra=require(_0xa069('0x7'));var _=require('lodash');var squel=require(_0xa069('0x8'));var crypto=require('crypto');var jsforce=require(_0xa069('0x9'));var deskjs=require(_0xa069('0xa'));var toCsv=require('to-csv');var querystring=require(_0xa069('0xb'));var Papa=require('papaparse');var Redis=require(_0xa069('0xc'));var authService=require(_0xa069('0xd'));var qs=require(_0xa069('0xe'));var as=require('../../components/parsers/advancedSearch');var hardwareService=require('../../config/license/hardware');var logger=require(_0xa069('0xf'))(_0xa069('0x10'));var utils=require(_0xa069('0x11'));var config=require(_0xa069('0x12'));var licenseUtil=require(_0xa069('0x13'));var db=require(_0xa069('0x14'))['db'];function respondWithStatusCode(_0x3c8903,_0x26071c){_0x26071c=_0x26071c||0xcc;return function(_0x156232){if(_0x156232){return _0x3c8903['sendStatus'](_0x26071c);}return _0x3c8903[_0xa069('0x15')](_0x26071c)[_0xa069('0x16')]();};}function respondWithResult(_0x162127,_0x1e6842){_0x1e6842=_0x1e6842||0xc8;return function(_0x4383a7){if(_0x4383a7){return _0x162127['status'](_0x1e6842)[_0xa069('0x17')](_0x4383a7);}};}function respondWithFilteredResult(_0x5f45f9,_0x44b564){return function(_0x549fd6){if(_0x549fd6){var _0x18ffab=typeof _0x44b564[_0xa069('0x18')]==='undefined'&&typeof _0x44b564[_0xa069('0x19')]==='undefined';var _0x5e26a8=_0x549fd6[_0xa069('0x1a')];var _0x94fad8=_0x18ffab?0x0:_0x44b564[_0xa069('0x18')];var _0x5538b7=_0x18ffab?_0x549fd6[_0xa069('0x1a')]:_0x44b564[_0xa069('0x18')]+_0x44b564[_0xa069('0x19')];var _0x5b3d38;if(_0x5538b7>=_0x5e26a8){_0x5538b7=_0x5e26a8;_0x5b3d38=0xc8;}else{_0x5b3d38=0xce;}_0x5f45f9[_0xa069('0x15')](_0x5b3d38);return _0x5f45f9['set'](_0xa069('0x1b'),_0x94fad8+'-'+_0x5538b7+'/'+_0x5e26a8)[_0xa069('0x17')](_0x549fd6);}return null;};}function patchUpdates(_0x28a272){return function(_0x408891){try{jsonpatch[_0xa069('0x1c')](_0x408891,_0x28a272,!![]);}catch(_0x5adea7){return BPromise[_0xa069('0x1d')](_0x5adea7);}return _0x408891['save']();};}function saveUpdates(_0x502d76,_0x13143f){return function(_0x36db99){if(_0x36db99){return _0x36db99[_0xa069('0x1e')](_0x502d76)[_0xa069('0x1f')](function(_0x50a9bf){return _0x50a9bf;});}return null;};}function removeEntity(_0x1a5300,_0x622229){return function(_0x52d632){if(_0x52d632){return _0x52d632['destroy']()[_0xa069('0x1f')](function(){_0x1a5300[_0xa069('0x15')](0xcc)['end']();});}};}function handleEntityNotFound(_0x523b67,_0x3ed74c){return function(_0x57cb3d){if(!_0x57cb3d){_0x523b67[_0xa069('0x20')](0x194);}return _0x57cb3d;};}function handleError(_0x4314d8,_0x2218b5){_0x2218b5=_0x2218b5||0x1f4;return function(_0x55c907){logger[_0xa069('0x21')](_0x55c907['stack']);if(_0x55c907[_0xa069('0x22')]){delete _0x55c907[_0xa069('0x22')];}_0x4314d8[_0xa069('0x15')](_0x2218b5)[_0xa069('0x23')](_0x55c907);};}exports[_0xa069('0x24')]=function(_0x4a17fa,_0x2ce9f6){var _0x2fac3a={},_0x5df426={},_0x31baf3={'count':0x0,'rows':[]};var _0x8b133f=_[_0xa069('0x25')](db['FreshdeskConfiguration'][_0xa069('0x26')],function(_0x43d597){return{'name':_0x43d597[_0xa069('0x27')],'type':_0x43d597[_0xa069('0x28')][_0xa069('0x29')]};});_0x5df426['model']=_['map'](_0x8b133f,_0xa069('0x22'));_0x5df426[_0xa069('0x2a')]=_[_0xa069('0x2b')](_0x4a17fa[_0xa069('0x2a')]);_0x5df426['filters']=_['intersection'](_0x5df426['model'],_0x5df426[_0xa069('0x2a')]);_0x2fac3a[_0xa069('0x2c')]=_[_0xa069('0x2d')](_0x5df426[_0xa069('0x2e')],qs['fields'](_0x4a17fa[_0xa069('0x2a')][_0xa069('0x2f')]));_0x2fac3a[_0xa069('0x2c')]=_0x2fac3a[_0xa069('0x2c')]['length']?_0x2fac3a[_0xa069('0x2c')]:_0x5df426[_0xa069('0x2e')];if(!_0x4a17fa[_0xa069('0x2a')][_0xa069('0x30')](_0xa069('0x31'))){_0x2fac3a['limit']=qs[_0xa069('0x19')](_0x4a17fa['query'][_0xa069('0x19')]);_0x2fac3a[_0xa069('0x18')]=qs[_0xa069('0x18')](_0x4a17fa['query']['offset']);}_0x2fac3a[_0xa069('0x32')]=qs[_0xa069('0x33')](_0x4a17fa['query'][_0xa069('0x33')]);_0x2fac3a[_0xa069('0x34')]=qs['filters'](_['pick'](_0x4a17fa['query'],_0x5df426['filters']),_0x8b133f);if(_0x4a17fa[_0xa069('0x2a')][_0xa069('0x35')]){_0x2fac3a[_0xa069('0x34')]=_[_0xa069('0x36')](_0x2fac3a[_0xa069('0x34')],{'$or':_[_0xa069('0x25')](_0x8b133f,function(_0x441959){if(_0x441959[_0xa069('0x28')]!==_0xa069('0x37')){var _0x3f5f48={};_0x3f5f48[_0x441959[_0xa069('0x22')]]={'$like':'%'+_0x4a17fa[_0xa069('0x2a')][_0xa069('0x35')]+'%'};return _0x3f5f48;}})});}_0x2fac3a=_['merge']({},_0x2fac3a,_0x4a17fa[_0xa069('0x38')]);var _0x4be785={'where':_0x2fac3a['where']};return db[_0xa069('0x39')]['count'](_0x4be785)[_0xa069('0x1f')](function(_0x532206){_0x31baf3[_0xa069('0x1a')]=_0x532206;if(_0x4a17fa[_0xa069('0x2a')]['includeAll']){_0x2fac3a[_0xa069('0x3a')]=[{'all':!![]}];}return db[_0xa069('0x39')]['findAll'](_0x2fac3a);})[_0xa069('0x1f')](function(_0x4370c0){_0x31baf3[_0xa069('0x3b')]=_0x4370c0;return _0x31baf3;})['then'](respondWithFilteredResult(_0x2ce9f6,_0x2fac3a))[_0xa069('0x3c')](handleError(_0x2ce9f6,null));};exports['show']=function(_0x1c40c9,_0x4dff4d){var _0xcb45bd={'raw':![],'where':{'id':_0x1c40c9[_0xa069('0x3d')]['id']}},_0x3c6b61={};_0x3c6b61[_0xa069('0x2e')]=_['keys'](db[_0xa069('0x39')][_0xa069('0x26')]);_0x3c6b61[_0xa069('0x2a')]=_[_0xa069('0x2b')](_0x1c40c9[_0xa069('0x2a')]);_0x3c6b61[_0xa069('0x3e')]=_[_0xa069('0x2d')](_0x3c6b61[_0xa069('0x2e')],_0x3c6b61[_0xa069('0x2a')]);_0xcb45bd[_0xa069('0x2c')]=_['intersection'](_0x3c6b61[_0xa069('0x2e')],qs[_0xa069('0x2f')](_0x1c40c9[_0xa069('0x2a')]['fields']));_0xcb45bd[_0xa069('0x2c')]=_0xcb45bd['attributes'][_0xa069('0x3f')]?_0xcb45bd[_0xa069('0x2c')]:_0x3c6b61[_0xa069('0x2e')];if(_0x1c40c9[_0xa069('0x2a')]['includeAll']){_0xcb45bd['include']=[{'all':!![]}];}_0xcb45bd=_[_0xa069('0x36')]({},_0xcb45bd,_0x1c40c9['options']);return db[_0xa069('0x39')][_0xa069('0x40')](_0xcb45bd)[_0xa069('0x1f')](handleEntityNotFound(_0x4dff4d,null))[_0xa069('0x1f')](respondWithResult(_0x4dff4d,null))['catch'](handleError(_0x4dff4d,null));};exports[_0xa069('0x41')]=function(_0x44f696,_0x3ddbd5){return db[_0xa069('0x39')]['create'](_0x44f696[_0xa069('0x42')],{})[_0xa069('0x1f')](respondWithResult(_0x3ddbd5,0xc9))[_0xa069('0x3c')](handleError(_0x3ddbd5,null));};exports['update']=function(_0x1f9237,_0x281a34){if(_0x1f9237[_0xa069('0x42')]['id']){delete _0x1f9237[_0xa069('0x42')]['id'];}return db[_0xa069('0x39')]['find']({'where':{'id':_0x1f9237[_0xa069('0x3d')]['id']}})[_0xa069('0x1f')](handleEntityNotFound(_0x281a34,null))['then'](saveUpdates(_0x1f9237['body'],null))[_0xa069('0x1f')](respondWithResult(_0x281a34,null))[_0xa069('0x3c')](handleError(_0x281a34,null));};exports[_0xa069('0x43')]=function(_0x7856c3,_0x1e9f77){return db['FreshdeskConfiguration'][_0xa069('0x40')]({'where':{'id':_0x7856c3[_0xa069('0x3d')]['id']}})[_0xa069('0x1f')](handleEntityNotFound(_0x1e9f77,null))[_0xa069('0x1f')](removeEntity(_0x1e9f77,null))[_0xa069('0x3c')](handleError(_0x1e9f77,null));};exports['getFields']=function(_0x137f0e,_0xa6e2be,_0x2a9b61){var _0x4e2f3d={};var _0x4e695d={};var _0x321b46;var _0x1ce539;return db[_0xa069('0x39')]['findOne']({'where':{'id':_0x137f0e[_0xa069('0x3d')]['id']}})['then'](handleEntityNotFound(_0xa6e2be,null))[_0xa069('0x1f')](function(_0x3b0c87){if(_0x3b0c87){_0x321b46=_0x3b0c87;_0x4e695d[_0xa069('0x2e')]=_[_0xa069('0x2b')](db[_0xa069('0x44')][_0xa069('0x26')]);_0x4e695d[_0xa069('0x2a')]=_[_0xa069('0x2b')](_0x137f0e[_0xa069('0x2a')]);_0x4e695d['filters']=_[_0xa069('0x2d')](_0x4e695d[_0xa069('0x2e')],_0x4e695d[_0xa069('0x2a')]);_0x4e2f3d[_0xa069('0x2c')]=_['intersection'](_0x4e695d[_0xa069('0x2e')],qs[_0xa069('0x2f')](_0x137f0e['query'][_0xa069('0x2f')]));_0x4e2f3d['attributes']=_0x4e2f3d['attributes'][_0xa069('0x3f')]?_0x4e2f3d[_0xa069('0x2c')]:_0x4e695d['model'];_0x4e2f3d[_0xa069('0x32')]=qs['sort'](_0x137f0e[_0xa069('0x2a')]['sort']);_0x4e2f3d[_0xa069('0x34')]=qs[_0xa069('0x3e')](_['pick'](_0x137f0e[_0xa069('0x2a')],_0x4e695d['filters']));if(_0x137f0e['query']['filter']){_0x4e2f3d['where']=_[_0xa069('0x36')](_0x4e2f3d['where'],{'$or':_[_0xa069('0x25')](_0x4e2f3d[_0xa069('0x2c')],function(_0x2e52e1){var _0x353029={};_0x353029[_0x2e52e1]={'$like':'%'+_0x137f0e[_0xa069('0x2a')][_0xa069('0x35')]+'%'};return _0x353029;})});}_0x4e2f3d=_[_0xa069('0x36')]({},_0x4e2f3d,_0x137f0e['options']);return _0x321b46[_0xa069('0x45')](_0x4e2f3d);}})[_0xa069('0x1f')](function(_0x346f0b){if(_0x346f0b){_0x1ce539=_0x346f0b[_0xa069('0x3f')];if(!_0x137f0e[_0xa069('0x2a')][_0xa069('0x30')](_0xa069('0x31'))){_0x4e2f3d[_0xa069('0x19')]=qs[_0xa069('0x19')](_0x137f0e[_0xa069('0x2a')]['limit']);_0x4e2f3d[_0xa069('0x18')]=qs[_0xa069('0x18')](_0x137f0e[_0xa069('0x2a')][_0xa069('0x18')]);}return _0x321b46[_0xa069('0x45')](_0x4e2f3d);}})[_0xa069('0x1f')](function(_0x5594f7){if(_0x5594f7){return _0x5594f7?{'count':_0x1ce539,'rows':_0x5594f7}:null;}})[_0xa069('0x1f')](respondWithResult(_0xa6e2be,null))[_0xa069('0x3c')](handleError(_0xa6e2be,null));};exports['getSubjects']=function(_0x46afb2,_0x5638a0,_0x1c6aa1){var _0x4386ed={};var _0x42d2da={};var _0x5cc8d7;var _0x43b74b;return db['FreshdeskConfiguration']['findOne']({'where':{'id':_0x46afb2[_0xa069('0x3d')]['id']}})[_0xa069('0x1f')](handleEntityNotFound(_0x5638a0,null))[_0xa069('0x1f')](function(_0x6e93cc){if(_0x6e93cc){_0x5cc8d7=_0x6e93cc;_0x42d2da['model']=_[_0xa069('0x2b')](db[_0xa069('0x44')][_0xa069('0x26')]);_0x42d2da['query']=_[_0xa069('0x2b')](_0x46afb2[_0xa069('0x2a')]);_0x42d2da['filters']=_[_0xa069('0x2d')](_0x42d2da[_0xa069('0x2e')],_0x42d2da[_0xa069('0x2a')]);_0x4386ed[_0xa069('0x2c')]=_[_0xa069('0x2d')](_0x42d2da['model'],qs[_0xa069('0x2f')](_0x46afb2[_0xa069('0x2a')][_0xa069('0x2f')]));_0x4386ed[_0xa069('0x2c')]=_0x4386ed[_0xa069('0x2c')]['length']?_0x4386ed[_0xa069('0x2c')]:_0x42d2da[_0xa069('0x2e')];_0x4386ed['order']=qs[_0xa069('0x33')](_0x46afb2[_0xa069('0x2a')][_0xa069('0x33')]);_0x4386ed['where']=qs[_0xa069('0x3e')](_[_0xa069('0x46')](_0x46afb2['query'],_0x42d2da[_0xa069('0x3e')]));if(_0x46afb2['query'][_0xa069('0x35')]){_0x4386ed[_0xa069('0x34')]=_[_0xa069('0x36')](_0x4386ed[_0xa069('0x34')],{'$or':_['map'](_0x4386ed['attributes'],function(_0x254c4f){var _0x432038={};_0x432038[_0x254c4f]={'$like':'%'+_0x46afb2[_0xa069('0x2a')]['filter']+'%'};return _0x432038;})});}_0x4386ed=_['merge']({},_0x4386ed,_0x46afb2[_0xa069('0x38')]);return _0x5cc8d7[_0xa069('0x47')](_0x4386ed);}})[_0xa069('0x1f')](function(_0x80aa87){if(_0x80aa87){_0x43b74b=_0x80aa87[_0xa069('0x3f')];if(!_0x46afb2[_0xa069('0x2a')][_0xa069('0x30')](_0xa069('0x31'))){_0x4386ed[_0xa069('0x19')]=qs[_0xa069('0x19')](_0x46afb2['query'][_0xa069('0x19')]);_0x4386ed[_0xa069('0x18')]=qs[_0xa069('0x18')](_0x46afb2[_0xa069('0x2a')][_0xa069('0x18')]);}return _0x5cc8d7[_0xa069('0x47')](_0x4386ed);}})['then'](function(_0x33c988){if(_0x33c988){return _0x33c988?{'count':_0x43b74b,'rows':_0x33c988}:null;}})[_0xa069('0x1f')](respondWithResult(_0x5638a0,null))[_0xa069('0x3c')](handleError(_0x5638a0,null));};exports['getDescriptions']=function(_0x576de7,_0x1b7f55,_0x1abc15){var _0x14213b={};var _0x56c300={};var _0x26b963;var _0x1772e9;return db[_0xa069('0x39')]['findOne']({'where':{'id':_0x576de7[_0xa069('0x3d')]['id']}})[_0xa069('0x1f')](handleEntityNotFound(_0x1b7f55,null))['then'](function(_0x278660){if(_0x278660){_0x26b963=_0x278660;_0x56c300['model']=_['keys'](db[_0xa069('0x44')][_0xa069('0x26')]);_0x56c300[_0xa069('0x2a')]=_[_0xa069('0x2b')](_0x576de7[_0xa069('0x2a')]);_0x56c300[_0xa069('0x3e')]=_[_0xa069('0x2d')](_0x56c300[_0xa069('0x2e')],_0x56c300[_0xa069('0x2a')]);_0x14213b[_0xa069('0x2c')]=_['intersection'](_0x56c300[_0xa069('0x2e')],qs[_0xa069('0x2f')](_0x576de7[_0xa069('0x2a')][_0xa069('0x2f')]));_0x14213b[_0xa069('0x2c')]=_0x14213b['attributes'][_0xa069('0x3f')]?_0x14213b['attributes']:_0x56c300['model'];_0x14213b[_0xa069('0x32')]=qs[_0xa069('0x33')](_0x576de7['query'][_0xa069('0x33')]);_0x14213b[_0xa069('0x34')]=qs[_0xa069('0x3e')](_[_0xa069('0x46')](_0x576de7[_0xa069('0x2a')],_0x56c300[_0xa069('0x3e')]));if(_0x576de7[_0xa069('0x2a')][_0xa069('0x35')]){_0x14213b['where']=_[_0xa069('0x36')](_0x14213b['where'],{'$or':_['map'](_0x14213b[_0xa069('0x2c')],function(_0x447d71){var _0x58ec75={};_0x58ec75[_0x447d71]={'$like':'%'+_0x576de7[_0xa069('0x2a')]['filter']+'%'};return _0x58ec75;})});}_0x14213b=_[_0xa069('0x36')]({},_0x14213b,_0x576de7['options']);return _0x26b963[_0xa069('0x48')](_0x14213b);}})[_0xa069('0x1f')](function(_0x519649){if(_0x519649){_0x1772e9=_0x519649[_0xa069('0x3f')];if(!_0x576de7[_0xa069('0x2a')][_0xa069('0x30')]('nolimit')){_0x14213b[_0xa069('0x19')]=qs[_0xa069('0x19')](_0x576de7[_0xa069('0x2a')][_0xa069('0x19')]);_0x14213b[_0xa069('0x18')]=qs[_0xa069('0x18')](_0x576de7['query'][_0xa069('0x18')]);}return _0x26b963[_0xa069('0x48')](_0x14213b);}})[_0xa069('0x1f')](function(_0x1c009e){if(_0x1c009e){return _0x1c009e?{'count':_0x1772e9,'rows':_0x1c009e}:null;}})[_0xa069('0x1f')](respondWithResult(_0x1b7f55,null))[_0xa069('0x3c')](handleError(_0x1b7f55,null));};exports['getTags']=function(_0x47070a,_0x334391,_0x57c617){var _0x2f6e22={};var _0x39fd12={};var _0x465946;var _0x41c779;return db[_0xa069('0x39')][_0xa069('0x49')]({'where':{'id':_0x47070a['params']['id']}})[_0xa069('0x1f')](handleEntityNotFound(_0x334391,null))[_0xa069('0x1f')](function(_0x58cba2){if(_0x58cba2){_0x465946=_0x58cba2;_0x39fd12[_0xa069('0x2e')]=_['keys'](db[_0xa069('0x4a')][_0xa069('0x26')]);_0x39fd12[_0xa069('0x2a')]=_[_0xa069('0x2b')](_0x47070a[_0xa069('0x2a')]);_0x39fd12[_0xa069('0x3e')]=_[_0xa069('0x2d')](_0x39fd12['model'],_0x39fd12[_0xa069('0x2a')]);_0x2f6e22[_0xa069('0x2c')]=_[_0xa069('0x2d')](_0x39fd12[_0xa069('0x2e')],qs[_0xa069('0x2f')](_0x47070a[_0xa069('0x2a')][_0xa069('0x2f')]));_0x2f6e22[_0xa069('0x2c')]=_0x2f6e22[_0xa069('0x2c')][_0xa069('0x3f')]?_0x2f6e22[_0xa069('0x2c')]:_0x39fd12[_0xa069('0x2e')];_0x2f6e22[_0xa069('0x32')]=qs[_0xa069('0x33')](_0x47070a[_0xa069('0x2a')][_0xa069('0x33')]);_0x2f6e22[_0xa069('0x34')]=qs[_0xa069('0x3e')](_['pick'](_0x47070a[_0xa069('0x2a')],_0x39fd12[_0xa069('0x3e')]));if(_0x47070a[_0xa069('0x2a')]['filter']){_0x2f6e22[_0xa069('0x34')]=_[_0xa069('0x36')](_0x2f6e22[_0xa069('0x34')],{'$or':_['map'](_0x2f6e22[_0xa069('0x2c')],function(_0x5a4655){var _0x31e50={};_0x31e50[_0x5a4655]={'$like':'%'+_0x47070a['query'][_0xa069('0x35')]+'%'};return _0x31e50;})});}_0x2f6e22=_['merge']({},_0x2f6e22,_0x47070a[_0xa069('0x38')]);return _0x465946[_0xa069('0x4b')](_0x2f6e22);}})[_0xa069('0x1f')](function(_0x4b9b27){if(_0x4b9b27){_0x41c779=_0x4b9b27[_0xa069('0x3f')];if(!_0x47070a[_0xa069('0x2a')]['hasOwnProperty']('nolimit')){_0x2f6e22[_0xa069('0x19')]=qs[_0xa069('0x19')](_0x47070a['query']['limit']);_0x2f6e22[_0xa069('0x18')]=qs[_0xa069('0x18')](_0x47070a[_0xa069('0x2a')]['offset']);}return _0x465946['getTags'](_0x2f6e22);}})['then'](function(_0x2fa8ce){if(_0x2fa8ce){return _0x2fa8ce?{'count':_0x41c779,'rows':_0x2fa8ce}:null;}})['then'](respondWithResult(_0x334391,null))[_0xa069('0x3c')](handleError(_0x334391,null));};exports[_0xa069('0x4c')]=function(_0x5ce69c,_0x485073,_0x18476f){if(_0x5ce69c['body']['id']){delete _0x5ce69c[_0xa069('0x42')]['id'];}return db[_0xa069('0x39')][_0xa069('0x49')]({'where':{'id':_0x5ce69c[_0xa069('0x3d')]['id']}})['then'](handleEntityNotFound(_0x485073,null))['then'](function(_0x5ea4bb){if(_0x5ea4bb){return _0x5ea4bb[_0xa069('0x4c')](_0x5ce69c['body'][_0xa069('0x4d')]||[]);}return null;})[_0xa069('0x1f')](respondWithResult(_0x485073,null))[_0xa069('0x3c')](handleError(_0x485073,null));}; \ No newline at end of file diff --git a/server/api/intFreshdeskConfiguration/intFreshdeskConfiguration.model.js b/server/api/intFreshdeskConfiguration/intFreshdeskConfiguration.model.js index 002c11b..163a8ec 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 _0x04c7=['int_freshdesk_configurations','api','moment','bluebird','request-promise','rimraf','../../config/environment','./intFreshdeskConfiguration.attributes','exports','define','FreshdeskConfiguration'];(function(_0x37ea44,_0x3ca1a5){var _0x47c3d9=function(_0x539a1e){while(--_0x539a1e){_0x37ea44['push'](_0x37ea44['shift']());}};_0x47c3d9(++_0x3ca1a5);}(_0x04c7,0x1da));var _0x704c=function(_0x202c61,_0x3673e0){_0x202c61=_0x202c61-0x0;var _0x540691=_0x04c7[_0x202c61];return _0x540691;};'use strict';var _=require('lodash');var util=require('util');var logger=require('../../config/logger')(_0x704c('0x0'));var moment=require(_0x704c('0x1'));var BPromise=require(_0x704c('0x2'));var rp=require(_0x704c('0x3'));var fs=require('fs');var path=require('path');var rimraf=require(_0x704c('0x4'));var config=require(_0x704c('0x5'));var attributes=require(_0x704c('0x6'));module[_0x704c('0x7')]=function(_0x505865,_0x18393d){return _0x505865[_0x704c('0x8')](_0x704c('0x9'),attributes,{'tableName':_0x704c('0xa'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0xfcf0=['util','../../config/logger','api','moment','bluebird','request-promise','path','../../config/environment','./intFreshdeskConfiguration.attributes','exports','define','FreshdeskConfiguration','int_freshdesk_configurations','lodash'];(function(_0x562456,_0x9ad741){var _0x46d4a9=function(_0x3e9f18){while(--_0x3e9f18){_0x562456['push'](_0x562456['shift']());}};_0x46d4a9(++_0x9ad741);}(_0xfcf0,0xc3));var _0x0fcf=function(_0x208505,_0x241a77){_0x208505=_0x208505-0x0;var _0x1a985f=_0xfcf0[_0x208505];return _0x1a985f;};'use strict';var _=require(_0x0fcf('0x0'));var util=require(_0x0fcf('0x1'));var logger=require(_0x0fcf('0x2'))(_0x0fcf('0x3'));var moment=require(_0x0fcf('0x4'));var BPromise=require(_0x0fcf('0x5'));var rp=require(_0x0fcf('0x6'));var fs=require('fs');var path=require(_0x0fcf('0x7'));var rimraf=require('rimraf');var config=require(_0x0fcf('0x8'));var attributes=require(_0x0fcf('0x9'));module[_0x0fcf('0xa')]=function(_0x34871c,_0x3103f9){return _0x34871c[_0x0fcf('0xb')](_0x0fcf('0xc'),attributes,{'tableName':_0x0fcf('0xd'),'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 f21e281..92649e5 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 _0x9b4d=['request\x20sent','FreshdeskConfiguration,\x20%s,\x20%s,\x20%s','error','message','info','result','util','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','rpc','../../config/environment','client','request','then','FreshdeskConfiguration,\x20%s,\x20%s'];(function(_0x3dd15e,_0x1f0015){var _0x231fd0=function(_0x4f680a){while(--_0x4f680a){_0x3dd15e['push'](_0x3dd15e['shift']());}};_0x231fd0(++_0x1f0015);}(_0x9b4d,0x96));var _0xd9b4=function(_0x2cf37f,_0x2217b7){_0x2cf37f=_0x2cf37f-0x0;var _0x1bd369=_0x9b4d[_0x2cf37f];return _0x1bd369;};'use strict';var _=require('lodash');var util=require(_0xd9b4('0x0'));var moment=require('moment');var BPromise=require(_0xd9b4('0x1'));var rs=require(_0xd9b4('0x2'));var fs=require('fs');var Redis=require(_0xd9b4('0x3'));var db=require(_0xd9b4('0x4'))['db'];var utils=require(_0xd9b4('0x5'));var logger=require('../../config/logger')(_0xd9b4('0x6'));var config=require(_0xd9b4('0x7'));var jayson=require('jayson/promise');var client=jayson[_0xd9b4('0x8')]['http']({'port':0x232a});function respondWithRpcPromise(_0x361c20,_0x13462a,_0x23588f){return new BPromise(function(_0x5fce27,_0x43da2d){return client[_0xd9b4('0x9')](_0x361c20,_0x23588f)[_0xd9b4('0xa')](function(_0x52aa5f){logger['info'](_0xd9b4('0xb'),_0x13462a,_0xd9b4('0xc'));logger['debug'](_0xd9b4('0xd'),_0x13462a,_0xd9b4('0xc'),JSON['stringify'](_0x52aa5f));if(_0x52aa5f['error']){if(_0x52aa5f[_0xd9b4('0xe')]['code']===0x1f4){logger[_0xd9b4('0xe')](_0xd9b4('0xb'),_0x13462a,_0x52aa5f[_0xd9b4('0xe')][_0xd9b4('0xf')]);return _0x43da2d(_0x52aa5f['error'][_0xd9b4('0xf')]);}logger[_0xd9b4('0xe')](_0xd9b4('0xb'),_0x13462a,_0x52aa5f[_0xd9b4('0xe')][_0xd9b4('0xf')]);return _0x5fce27(_0x52aa5f[_0xd9b4('0xe')][_0xd9b4('0xf')]);}else{logger[_0xd9b4('0x10')](_0xd9b4('0xb'),_0x13462a,_0xd9b4('0xc'));_0x5fce27(_0x52aa5f[_0xd9b4('0x11')][_0xd9b4('0xf')]);}})['catch'](function(_0x5a3e2a){logger[_0xd9b4('0xe')](_0xd9b4('0xb'),_0x13462a,_0x5a3e2a);_0x43da2d(_0x5a3e2a);});});} \ No newline at end of file +var _0xbe9d=['FreshdeskConfiguration,\x20%s,\x20%s,\x20%s','stringify','error','code','message','result','catch','lodash','util','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','../../config/environment','client','http','request','then','info','FreshdeskConfiguration,\x20%s,\x20%s','request\x20sent','debug'];(function(_0x1e5317,_0x29e296){var _0x44953a=function(_0x2c857e){while(--_0x2c857e){_0x1e5317['push'](_0x1e5317['shift']());}};_0x44953a(++_0x29e296);}(_0xbe9d,0x13f));var _0xdbe9=function(_0x513aa5,_0x1fba79){_0x513aa5=_0x513aa5-0x0;var _0x1a1a7c=_0xbe9d[_0x513aa5];return _0x1a1a7c;};'use strict';var _=require(_0xdbe9('0x0'));var util=require(_0xdbe9('0x1'));var moment=require('moment');var BPromise=require(_0xdbe9('0x2'));var rs=require(_0xdbe9('0x3'));var fs=require('fs');var Redis=require(_0xdbe9('0x4'));var db=require(_0xdbe9('0x5'))['db'];var utils=require(_0xdbe9('0x6'));var logger=require(_0xdbe9('0x7'))('rpc');var config=require(_0xdbe9('0x8'));var jayson=require('jayson/promise');var client=jayson[_0xdbe9('0x9')][_0xdbe9('0xa')]({'port':0x232a});function respondWithRpcPromise(_0x4cb342,_0x411915,_0x381d2e){return new BPromise(function(_0x15ca60,_0x27f624){return client[_0xdbe9('0xb')](_0x4cb342,_0x381d2e)[_0xdbe9('0xc')](function(_0x2ea786){logger[_0xdbe9('0xd')](_0xdbe9('0xe'),_0x411915,_0xdbe9('0xf'));logger[_0xdbe9('0x10')](_0xdbe9('0x11'),_0x411915,'request\x20sent',JSON[_0xdbe9('0x12')](_0x2ea786));if(_0x2ea786[_0xdbe9('0x13')]){if(_0x2ea786[_0xdbe9('0x13')][_0xdbe9('0x14')]===0x1f4){logger['error'](_0xdbe9('0xe'),_0x411915,_0x2ea786[_0xdbe9('0x13')][_0xdbe9('0x15')]);return _0x27f624(_0x2ea786[_0xdbe9('0x13')]['message']);}logger[_0xdbe9('0x13')](_0xdbe9('0xe'),_0x411915,_0x2ea786[_0xdbe9('0x13')][_0xdbe9('0x15')]);return _0x15ca60(_0x2ea786['error'][_0xdbe9('0x15')]);}else{logger[_0xdbe9('0xd')](_0xdbe9('0xe'),_0x411915,_0xdbe9('0xf'));_0x15ca60(_0x2ea786[_0xdbe9('0x16')][_0xdbe9('0x15')]);}})[_0xdbe9('0x17')](function(_0x59a7e8){logger['error'](_0xdbe9('0xe'),_0x411915,_0x59a7e8);_0x27f624(_0x59a7e8);});});} \ No newline at end of file diff --git a/server/api/intFreshdeskField/index.js b/server/api/intFreshdeskField/index.js index ad0b81a..6d6f577 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 _0xa054=['../../components/interaction/service','../../config/environment','./intFreshdeskField.controller','isAuthenticated','index','get','/:id','show','post','create','update','destroy','exports','multer','util','path','connect-timeout','Router','fs-extra','../../components/auth/service'];(function(_0x1f4976,_0x6bce6b){var _0x2842a7=function(_0x42a4f7){while(--_0x42a4f7){_0x1f4976['push'](_0x1f4976['shift']());}};_0x2842a7(++_0x6bce6b);}(_0xa054,0x1c5));var _0x4a05=function(_0x22cc16,_0x1f4fa2){_0x22cc16=_0x22cc16-0x0;var _0x399b70=_0xa054[_0x22cc16];return _0x399b70;};'use strict';var multer=require(_0x4a05('0x0'));var util=require(_0x4a05('0x1'));var path=require(_0x4a05('0x2'));var timeout=require(_0x4a05('0x3'));var express=require('express');var router=express[_0x4a05('0x4')]();var fs_extra=require(_0x4a05('0x5'));var auth=require(_0x4a05('0x6'));var interaction=require(_0x4a05('0x7'));var config=require(_0x4a05('0x8'));var controller=require(_0x4a05('0x9'));router['get']('/',auth[_0x4a05('0xa')](),controller[_0x4a05('0xb')]);router[_0x4a05('0xc')](_0x4a05('0xd'),auth[_0x4a05('0xa')](),controller[_0x4a05('0xe')]);router[_0x4a05('0xf')]('/',auth['isAuthenticated'](),controller[_0x4a05('0x10')]);router['put']('/:id',auth[_0x4a05('0xa')](),controller[_0x4a05('0x11')]);router['delete']('/:id',auth['isAuthenticated'](),controller[_0x4a05('0x12')]);module[_0x4a05('0x13')]=router; \ No newline at end of file +var _0x60d7=['destroy','exports','util','path','express','fs-extra','../../components/auth/service','../../config/environment','./intFreshdeskField.controller','get','isAuthenticated','index','/:id','show','create','put','update','delete'];(function(_0x1c413c,_0x3586ea){var _0x6bbe24=function(_0x154436){while(--_0x154436){_0x1c413c['push'](_0x1c413c['shift']());}};_0x6bbe24(++_0x3586ea);}(_0x60d7,0xa4));var _0x760d=function(_0x2e6ab4,_0x2bb998){_0x2e6ab4=_0x2e6ab4-0x0;var _0x3b8e4e=_0x60d7[_0x2e6ab4];return _0x3b8e4e;};'use strict';var multer=require('multer');var util=require(_0x760d('0x0'));var path=require(_0x760d('0x1'));var timeout=require('connect-timeout');var express=require(_0x760d('0x2'));var router=express['Router']();var fs_extra=require(_0x760d('0x3'));var auth=require(_0x760d('0x4'));var interaction=require('../../components/interaction/service');var config=require(_0x760d('0x5'));var controller=require(_0x760d('0x6'));router[_0x760d('0x7')]('/',auth[_0x760d('0x8')](),controller[_0x760d('0x9')]);router[_0x760d('0x7')](_0x760d('0xa'),auth[_0x760d('0x8')](),controller[_0x760d('0xb')]);router['post']('/',auth[_0x760d('0x8')](),controller[_0x760d('0xc')]);router[_0x760d('0xd')](_0x760d('0xa'),auth[_0x760d('0x8')](),controller[_0x760d('0xe')]);router[_0x760d('0xf')](_0x760d('0xa'),auth[_0x760d('0x8')](),controller[_0x760d('0x10')]);module[_0x760d('0x11')]=router; \ No newline at end of file diff --git a/server/api/intFreshdeskField/intFreshdeskField.attributes.js b/server/api/intFreshdeskField/intFreshdeskField.attributes.js index 89b6fb7..c4bd12b 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 _0x28fe=['string','customVariable','keyValue','picklist','STRING','variable','BOOLEAN','sequelize','exports','ENUM'];(function(_0x624ffa,_0x30537d){var _0x5c1cc4=function(_0x36048e){while(--_0x36048e){_0x624ffa['push'](_0x624ffa['shift']());}};_0x5c1cc4(++_0x30537d);}(_0x28fe,0x1f1));var _0xe28f=function(_0x1589dd,_0x2b9d22){_0x1589dd=_0x1589dd-0x0;var _0x1bddd1=_0x28fe[_0x1589dd];return _0x1bddd1;};'use strict';var Sequelize=require(_0xe28f('0x0'));module[_0xe28f('0x1')]={'type':{'type':Sequelize[_0xe28f('0x2')](_0xe28f('0x3'),'variable',_0xe28f('0x4'),_0xe28f('0x5'),_0xe28f('0x6')),'defaultValue':_0xe28f('0x3')},'content':{'type':Sequelize[_0xe28f('0x7')]},'key':{'type':Sequelize['STRING']},'keyType':{'type':Sequelize['ENUM'](_0xe28f('0x3'),_0xe28f('0x8'),_0xe28f('0x4'))},'keyContent':{'type':Sequelize[_0xe28f('0x7')]},'idField':{'type':Sequelize[_0xe28f('0x7')]},'nameField':{'type':Sequelize[_0xe28f('0x7')]},'customField':{'type':Sequelize[_0xe28f('0x9')],'defaultValue':!![]},'variableName':{'type':Sequelize[_0xe28f('0x7')]}}; \ No newline at end of file +var _0xb004=['keyValue','picklist','STRING','ENUM','BOOLEAN','sequelize','string','variable','customVariable'];(function(_0x19a1b6,_0x61a6b5){var _0x5d94d6=function(_0x37bb7f){while(--_0x37bb7f){_0x19a1b6['push'](_0x19a1b6['shift']());}};_0x5d94d6(++_0x61a6b5);}(_0xb004,0x164));var _0x4b00=function(_0xa4ea3b,_0x427314){_0xa4ea3b=_0xa4ea3b-0x0;var _0x167e31=_0xb004[_0xa4ea3b];return _0x167e31;};'use strict';var Sequelize=require(_0x4b00('0x0'));module['exports']={'type':{'type':Sequelize['ENUM'](_0x4b00('0x1'),_0x4b00('0x2'),_0x4b00('0x3'),_0x4b00('0x4'),_0x4b00('0x5')),'defaultValue':_0x4b00('0x1')},'content':{'type':Sequelize[_0x4b00('0x6')]},'key':{'type':Sequelize[_0x4b00('0x6')]},'keyType':{'type':Sequelize[_0x4b00('0x7')](_0x4b00('0x1'),_0x4b00('0x2'),'customVariable')},'keyContent':{'type':Sequelize['STRING']},'idField':{'type':Sequelize[_0x4b00('0x6')]},'nameField':{'type':Sequelize['STRING']},'customField':{'type':Sequelize[_0x4b00('0x8')],'defaultValue':!![]},'variableName':{'type':Sequelize[_0x4b00('0x6')]}}; \ No newline at end of file diff --git a/server/api/intFreshdeskField/intFreshdeskField.controller.js b/server/api/intFreshdeskField/intFreshdeskField.controller.js index 328bc41..556db32 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 _0xb248=['../../mysqldb','end','status','json','undefined','count','offset','limit','set','Content-Range','apply','reject','save','update','then','destroy','sendStatus','error','stack','name','send','index','map','FreshdeskField','rawAttributes','type','key','model','keys','query','filters','intersection','attributes','fields','length','hasOwnProperty','nolimit','order','sort','where','filter','merge','VIRTUAL','options','includeAll','include','params','find','catch','body','eml-format','zip-dir','fast-json-patch','request-promise','moment','mustache','util','sox','to-csv','fs-extra','lodash','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'];(function(_0x2c85c0,_0x32ed86){var _0x524768=function(_0x34cb08){while(--_0x34cb08){_0x2c85c0['push'](_0x2c85c0['shift']());}};_0x524768(++_0x32ed86);}(_0xb248,0xc6));var _0x8b24=function(_0x3b0731,_0xcf9925){_0x3b0731=_0x3b0731-0x0;var _0x4204d7=_0xb248[_0x3b0731];return _0x4204d7;};'use strict';var emlformat=require(_0x8b24('0x0'));var rimraf=require('rimraf');var zipdir=require(_0x8b24('0x1'));var jsonpatch=require(_0x8b24('0x2'));var rp=require(_0x8b24('0x3'));var moment=require(_0x8b24('0x4'));var BPromise=require('bluebird');var Mustache=require(_0x8b24('0x5'));var util=require(_0x8b24('0x6'));var path=require('path');var sox=require(_0x8b24('0x7'));var csv=require(_0x8b24('0x8'));var ejs=require('ejs');var fs=require('fs');var fs_extra=require(_0x8b24('0x9'));var _=require(_0x8b24('0xa'));var squel=require('squel');var crypto=require(_0x8b24('0xb'));var jsforce=require('jsforce');var deskjs=require(_0x8b24('0xc'));var toCsv=require(_0x8b24('0x8'));var querystring=require(_0x8b24('0xd'));var Papa=require('papaparse');var Redis=require(_0x8b24('0xe'));var authService=require(_0x8b24('0xf'));var qs=require(_0x8b24('0x10'));var as=require(_0x8b24('0x11'));var hardwareService=require(_0x8b24('0x12'));var logger=require(_0x8b24('0x13'))(_0x8b24('0x14'));var utils=require(_0x8b24('0x15'));var config=require(_0x8b24('0x16'));var licenseUtil=require(_0x8b24('0x17'));var db=require(_0x8b24('0x18'))['db'];function respondWithStatusCode(_0x3d3450,_0x40c1e6){_0x40c1e6=_0x40c1e6||0xcc;return function(_0x40ea49){if(_0x40ea49){return _0x3d3450['sendStatus'](_0x40c1e6);}return _0x3d3450['status'](_0x40c1e6)[_0x8b24('0x19')]();};}function respondWithResult(_0x4433c0,_0xf92148){_0xf92148=_0xf92148||0xc8;return function(_0x32a451){if(_0x32a451){return _0x4433c0[_0x8b24('0x1a')](_0xf92148)[_0x8b24('0x1b')](_0x32a451);}};}function respondWithFilteredResult(_0x11d2ee,_0x3cd934){return function(_0x4e66ae){if(_0x4e66ae){var _0x5a5745=typeof _0x3cd934['offset']===_0x8b24('0x1c')&&typeof _0x3cd934['limit']==='undefined';var _0xafc423=_0x4e66ae[_0x8b24('0x1d')];var _0x527af7=_0x5a5745?0x0:_0x3cd934[_0x8b24('0x1e')];var _0x5e3c52=_0x5a5745?_0x4e66ae[_0x8b24('0x1d')]:_0x3cd934['offset']+_0x3cd934[_0x8b24('0x1f')];var _0x521f5c;if(_0x5e3c52>=_0xafc423){_0x5e3c52=_0xafc423;_0x521f5c=0xc8;}else{_0x521f5c=0xce;}_0x11d2ee[_0x8b24('0x1a')](_0x521f5c);return _0x11d2ee[_0x8b24('0x20')](_0x8b24('0x21'),_0x527af7+'-'+_0x5e3c52+'/'+_0xafc423)[_0x8b24('0x1b')](_0x4e66ae);}return null;};}function patchUpdates(_0x2a4f2d){return function(_0x44aae9){try{jsonpatch[_0x8b24('0x22')](_0x44aae9,_0x2a4f2d,!![]);}catch(_0x5c9c38){return BPromise[_0x8b24('0x23')](_0x5c9c38);}return _0x44aae9[_0x8b24('0x24')]();};}function saveUpdates(_0x4fff3c,_0xd9b96){return function(_0x13dd68){if(_0x13dd68){return _0x13dd68[_0x8b24('0x25')](_0x4fff3c)[_0x8b24('0x26')](function(_0x12a9f4){return _0x12a9f4;});}return null;};}function removeEntity(_0x10b721,_0x347591){return function(_0x3fddf8){if(_0x3fddf8){return _0x3fddf8[_0x8b24('0x27')]()[_0x8b24('0x26')](function(){_0x10b721[_0x8b24('0x1a')](0xcc)[_0x8b24('0x19')]();});}};}function handleEntityNotFound(_0x2cfb27,_0x3d541e){return function(_0x19600a){if(!_0x19600a){_0x2cfb27[_0x8b24('0x28')](0x194);}return _0x19600a;};}function handleError(_0x1fe79f,_0x1a62e9){_0x1a62e9=_0x1a62e9||0x1f4;return function(_0x44ee85){logger[_0x8b24('0x29')](_0x44ee85[_0x8b24('0x2a')]);if(_0x44ee85[_0x8b24('0x2b')]){delete _0x44ee85[_0x8b24('0x2b')];}_0x1fe79f[_0x8b24('0x1a')](_0x1a62e9)[_0x8b24('0x2c')](_0x44ee85);};}exports[_0x8b24('0x2d')]=function(_0x267f1e,_0x140a50){var _0x5d3958={},_0x36ff89={},_0x59d6e1={'count':0x0,'rows':[]};var _0xadbba0=_[_0x8b24('0x2e')](db[_0x8b24('0x2f')][_0x8b24('0x30')],function(_0x1ab949){return{'name':_0x1ab949['fieldName'],'type':_0x1ab949[_0x8b24('0x31')][_0x8b24('0x32')]};});_0x36ff89[_0x8b24('0x33')]=_['map'](_0xadbba0,'name');_0x36ff89['query']=_[_0x8b24('0x34')](_0x267f1e[_0x8b24('0x35')]);_0x36ff89[_0x8b24('0x36')]=_[_0x8b24('0x37')](_0x36ff89[_0x8b24('0x33')],_0x36ff89[_0x8b24('0x35')]);_0x5d3958[_0x8b24('0x38')]=_[_0x8b24('0x37')](_0x36ff89[_0x8b24('0x33')],qs['fields'](_0x267f1e[_0x8b24('0x35')][_0x8b24('0x39')]));_0x5d3958[_0x8b24('0x38')]=_0x5d3958['attributes'][_0x8b24('0x3a')]?_0x5d3958[_0x8b24('0x38')]:_0x36ff89[_0x8b24('0x33')];if(!_0x267f1e[_0x8b24('0x35')][_0x8b24('0x3b')](_0x8b24('0x3c'))){_0x5d3958[_0x8b24('0x1f')]=qs[_0x8b24('0x1f')](_0x267f1e[_0x8b24('0x35')]['limit']);_0x5d3958[_0x8b24('0x1e')]=qs[_0x8b24('0x1e')](_0x267f1e['query'][_0x8b24('0x1e')]);}_0x5d3958[_0x8b24('0x3d')]=qs['sort'](_0x267f1e[_0x8b24('0x35')][_0x8b24('0x3e')]);_0x5d3958[_0x8b24('0x3f')]=qs[_0x8b24('0x36')](_['pick'](_0x267f1e[_0x8b24('0x35')],_0x36ff89[_0x8b24('0x36')]),_0xadbba0);if(_0x267f1e[_0x8b24('0x35')][_0x8b24('0x40')]){_0x5d3958[_0x8b24('0x3f')]=_[_0x8b24('0x41')](_0x5d3958['where'],{'$or':_[_0x8b24('0x2e')](_0xadbba0,function(_0x30ef3e){if(_0x30ef3e[_0x8b24('0x31')]!==_0x8b24('0x42')){var _0x223faa={};_0x223faa[_0x30ef3e[_0x8b24('0x2b')]]={'$like':'%'+_0x267f1e[_0x8b24('0x35')][_0x8b24('0x40')]+'%'};return _0x223faa;}})});}_0x5d3958=_[_0x8b24('0x41')]({},_0x5d3958,_0x267f1e[_0x8b24('0x43')]);var _0x24f0d6={'where':_0x5d3958['where']};return db[_0x8b24('0x2f')]['count'](_0x24f0d6)[_0x8b24('0x26')](function(_0x6db741){_0x59d6e1[_0x8b24('0x1d')]=_0x6db741;if(_0x267f1e['query'][_0x8b24('0x44')]){_0x5d3958[_0x8b24('0x45')]=[{'all':!![]}];}return db[_0x8b24('0x2f')]['findAll'](_0x5d3958);})[_0x8b24('0x26')](function(_0x4f8da5){_0x59d6e1['rows']=_0x4f8da5;return _0x59d6e1;})[_0x8b24('0x26')](respondWithFilteredResult(_0x140a50,_0x5d3958))['catch'](handleError(_0x140a50,null));};exports['show']=function(_0x32d752,_0xd3f68){var _0x3ee117={'raw':!![],'where':{'id':_0x32d752[_0x8b24('0x46')]['id']}},_0x3c6dc2={};_0x3c6dc2[_0x8b24('0x33')]=_[_0x8b24('0x34')](db['FreshdeskField']['rawAttributes']);_0x3c6dc2[_0x8b24('0x35')]=_[_0x8b24('0x34')](_0x32d752[_0x8b24('0x35')]);_0x3c6dc2[_0x8b24('0x36')]=_['intersection'](_0x3c6dc2[_0x8b24('0x33')],_0x3c6dc2[_0x8b24('0x35')]);_0x3ee117[_0x8b24('0x38')]=_['intersection'](_0x3c6dc2[_0x8b24('0x33')],qs['fields'](_0x32d752[_0x8b24('0x35')][_0x8b24('0x39')]));_0x3ee117['attributes']=_0x3ee117[_0x8b24('0x38')][_0x8b24('0x3a')]?_0x3ee117[_0x8b24('0x38')]:_0x3c6dc2[_0x8b24('0x33')];if(_0x32d752[_0x8b24('0x35')][_0x8b24('0x44')]){_0x3ee117[_0x8b24('0x45')]=[{'all':!![]}];}_0x3ee117=_[_0x8b24('0x41')]({},_0x3ee117,_0x32d752[_0x8b24('0x43')]);return db[_0x8b24('0x2f')][_0x8b24('0x47')](_0x3ee117)[_0x8b24('0x26')](handleEntityNotFound(_0xd3f68,null))['then'](respondWithResult(_0xd3f68,null))[_0x8b24('0x48')](handleError(_0xd3f68,null));};exports['create']=function(_0x245a02,_0x43cd46){return db['FreshdeskField']['create'](_0x245a02[_0x8b24('0x49')],{})[_0x8b24('0x26')](respondWithResult(_0x43cd46,0xc9))[_0x8b24('0x48')](handleError(_0x43cd46,null));};exports[_0x8b24('0x25')]=function(_0x407b2f,_0x22619e){if(_0x407b2f[_0x8b24('0x49')]['id']){delete _0x407b2f[_0x8b24('0x49')]['id'];}return db['FreshdeskField']['find']({'where':{'id':_0x407b2f['params']['id']}})[_0x8b24('0x26')](handleEntityNotFound(_0x22619e,null))['then'](saveUpdates(_0x407b2f[_0x8b24('0x49')],null))[_0x8b24('0x26')](respondWithResult(_0x22619e,null))[_0x8b24('0x48')](handleError(_0x22619e,null));};exports[_0x8b24('0x27')]=function(_0x58a26d,_0x3bc90a){return db[_0x8b24('0x2f')][_0x8b24('0x47')]({'where':{'id':_0x58a26d[_0x8b24('0x46')]['id']}})[_0x8b24('0x26')](handleEntityNotFound(_0x3bc90a,null))[_0x8b24('0x26')](removeEntity(_0x3bc90a,null))[_0x8b24('0x48')](handleError(_0x3bc90a,null));}; \ No newline at end of file +var _0x402f=['Content-Range','json','apply','reject','update','then','destroy','end','sendStatus','stack','name','send','map','rawAttributes','fieldName','model','query','keys','filters','intersection','attributes','fields','length','hasOwnProperty','nolimit','order','sort','where','filter','type','VIRTUAL','merge','options','FreshdeskField','includeAll','include','findAll','catch','show','params','create','body','find','eml-format','zip-dir','moment','bluebird','mustache','path','to-csv','ejs','fs-extra','lodash','squel','desk.js','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/logger','status','limit','undefined','count','offset','set'];(function(_0x3ee21f,_0x4edd0a){var _0x29c36a=function(_0x201d43){while(--_0x201d43){_0x3ee21f['push'](_0x3ee21f['shift']());}};_0x29c36a(++_0x4edd0a);}(_0x402f,0x6f));var _0xf402=function(_0x4cfa4b,_0x1bb51d){_0x4cfa4b=_0x4cfa4b-0x0;var _0x502fe6=_0x402f[_0x4cfa4b];return _0x502fe6;};'use strict';var emlformat=require(_0xf402('0x0'));var rimraf=require('rimraf');var zipdir=require(_0xf402('0x1'));var jsonpatch=require('fast-json-patch');var rp=require('request-promise');var moment=require(_0xf402('0x2'));var BPromise=require(_0xf402('0x3'));var Mustache=require(_0xf402('0x4'));var util=require('util');var path=require(_0xf402('0x5'));var sox=require('sox');var csv=require(_0xf402('0x6'));var ejs=require(_0xf402('0x7'));var fs=require('fs');var fs_extra=require(_0xf402('0x8'));var _=require(_0xf402('0x9'));var squel=require(_0xf402('0xa'));var crypto=require('crypto');var jsforce=require('jsforce');var deskjs=require(_0xf402('0xb'));var toCsv=require(_0xf402('0x6'));var querystring=require(_0xf402('0xc'));var Papa=require(_0xf402('0xd'));var Redis=require(_0xf402('0xe'));var authService=require(_0xf402('0xf'));var qs=require(_0xf402('0x10'));var as=require(_0xf402('0x11'));var hardwareService=require('../../config/license/hardware');var logger=require(_0xf402('0x12'))('api');var utils=require('../../config/utils');var config=require('../../config/environment');var licenseUtil=require('../../config/license/util');var db=require('../../mysqldb')['db'];function respondWithStatusCode(_0x46758d,_0x4f8073){_0x4f8073=_0x4f8073||0xcc;return function(_0x5c127f){if(_0x5c127f){return _0x46758d['sendStatus'](_0x4f8073);}return _0x46758d[_0xf402('0x13')](_0x4f8073)['end']();};}function respondWithResult(_0x2ff50e,_0xb3deb6){_0xb3deb6=_0xb3deb6||0xc8;return function(_0x1ce72a){if(_0x1ce72a){return _0x2ff50e[_0xf402('0x13')](_0xb3deb6)['json'](_0x1ce72a);}};}function respondWithFilteredResult(_0x16767b,_0x4baaec){return function(_0x3af9e3){if(_0x3af9e3){var _0x5e38d8=typeof _0x4baaec['offset']==='undefined'&&typeof _0x4baaec[_0xf402('0x14')]===_0xf402('0x15');var _0xd406bf=_0x3af9e3[_0xf402('0x16')];var _0x2fbe36=_0x5e38d8?0x0:_0x4baaec[_0xf402('0x17')];var _0x3ed3eb=_0x5e38d8?_0x3af9e3[_0xf402('0x16')]:_0x4baaec[_0xf402('0x17')]+_0x4baaec[_0xf402('0x14')];var _0x5bb928;if(_0x3ed3eb>=_0xd406bf){_0x3ed3eb=_0xd406bf;_0x5bb928=0xc8;}else{_0x5bb928=0xce;}_0x16767b[_0xf402('0x13')](_0x5bb928);return _0x16767b[_0xf402('0x18')](_0xf402('0x19'),_0x2fbe36+'-'+_0x3ed3eb+'/'+_0xd406bf)[_0xf402('0x1a')](_0x3af9e3);}return null;};}function patchUpdates(_0x3d3ed4){return function(_0x30f661){try{jsonpatch[_0xf402('0x1b')](_0x30f661,_0x3d3ed4,!![]);}catch(_0xf52248){return BPromise[_0xf402('0x1c')](_0xf52248);}return _0x30f661['save']();};}function saveUpdates(_0x3cfe38,_0x4ffe46){return function(_0x297a68){if(_0x297a68){return _0x297a68[_0xf402('0x1d')](_0x3cfe38)[_0xf402('0x1e')](function(_0x477709){return _0x477709;});}return null;};}function removeEntity(_0x20dca1,_0x9cbd83){return function(_0x1b8064){if(_0x1b8064){return _0x1b8064[_0xf402('0x1f')]()[_0xf402('0x1e')](function(){_0x20dca1[_0xf402('0x13')](0xcc)[_0xf402('0x20')]();});}};}function handleEntityNotFound(_0xfad629,_0x5ddae3){return function(_0x3285bd){if(!_0x3285bd){_0xfad629[_0xf402('0x21')](0x194);}return _0x3285bd;};}function handleError(_0x28fc75,_0x35543b){_0x35543b=_0x35543b||0x1f4;return function(_0x566a3d){logger['error'](_0x566a3d[_0xf402('0x22')]);if(_0x566a3d[_0xf402('0x23')]){delete _0x566a3d[_0xf402('0x23')];}_0x28fc75[_0xf402('0x13')](_0x35543b)[_0xf402('0x24')](_0x566a3d);};}exports['index']=function(_0x39a38a,_0x47c0fb){var _0x1574e3={},_0xe3dc2f={},_0x45ead3={'count':0x0,'rows':[]};var _0xb28d88=_[_0xf402('0x25')](db['FreshdeskField'][_0xf402('0x26')],function(_0x3720c6){return{'name':_0x3720c6[_0xf402('0x27')],'type':_0x3720c6['type']['key']};});_0xe3dc2f[_0xf402('0x28')]=_[_0xf402('0x25')](_0xb28d88,_0xf402('0x23'));_0xe3dc2f[_0xf402('0x29')]=_[_0xf402('0x2a')](_0x39a38a['query']);_0xe3dc2f[_0xf402('0x2b')]=_[_0xf402('0x2c')](_0xe3dc2f[_0xf402('0x28')],_0xe3dc2f[_0xf402('0x29')]);_0x1574e3[_0xf402('0x2d')]=_[_0xf402('0x2c')](_0xe3dc2f['model'],qs[_0xf402('0x2e')](_0x39a38a[_0xf402('0x29')][_0xf402('0x2e')]));_0x1574e3['attributes']=_0x1574e3['attributes'][_0xf402('0x2f')]?_0x1574e3[_0xf402('0x2d')]:_0xe3dc2f[_0xf402('0x28')];if(!_0x39a38a['query'][_0xf402('0x30')](_0xf402('0x31'))){_0x1574e3[_0xf402('0x14')]=qs[_0xf402('0x14')](_0x39a38a[_0xf402('0x29')][_0xf402('0x14')]);_0x1574e3['offset']=qs[_0xf402('0x17')](_0x39a38a[_0xf402('0x29')][_0xf402('0x17')]);}_0x1574e3[_0xf402('0x32')]=qs[_0xf402('0x33')](_0x39a38a['query'][_0xf402('0x33')]);_0x1574e3[_0xf402('0x34')]=qs[_0xf402('0x2b')](_['pick'](_0x39a38a['query'],_0xe3dc2f[_0xf402('0x2b')]),_0xb28d88);if(_0x39a38a['query'][_0xf402('0x35')]){_0x1574e3[_0xf402('0x34')]=_['merge'](_0x1574e3[_0xf402('0x34')],{'$or':_[_0xf402('0x25')](_0xb28d88,function(_0x2bb0b1){if(_0x2bb0b1[_0xf402('0x36')]!==_0xf402('0x37')){var _0x1f224e={};_0x1f224e[_0x2bb0b1[_0xf402('0x23')]]={'$like':'%'+_0x39a38a[_0xf402('0x29')]['filter']+'%'};return _0x1f224e;}})});}_0x1574e3=_[_0xf402('0x38')]({},_0x1574e3,_0x39a38a[_0xf402('0x39')]);var _0xc36243={'where':_0x1574e3[_0xf402('0x34')]};return db[_0xf402('0x3a')]['count'](_0xc36243)[_0xf402('0x1e')](function(_0x5de8c5){_0x45ead3[_0xf402('0x16')]=_0x5de8c5;if(_0x39a38a[_0xf402('0x29')][_0xf402('0x3b')]){_0x1574e3[_0xf402('0x3c')]=[{'all':!![]}];}return db[_0xf402('0x3a')][_0xf402('0x3d')](_0x1574e3);})[_0xf402('0x1e')](function(_0x5d8a26){_0x45ead3['rows']=_0x5d8a26;return _0x45ead3;})[_0xf402('0x1e')](respondWithFilteredResult(_0x47c0fb,_0x1574e3))[_0xf402('0x3e')](handleError(_0x47c0fb,null));};exports[_0xf402('0x3f')]=function(_0x350d71,_0x14fa65){var _0x1fe222={'raw':!![],'where':{'id':_0x350d71[_0xf402('0x40')]['id']}},_0x488587={};_0x488587[_0xf402('0x28')]=_[_0xf402('0x2a')](db[_0xf402('0x3a')]['rawAttributes']);_0x488587[_0xf402('0x29')]=_[_0xf402('0x2a')](_0x350d71[_0xf402('0x29')]);_0x488587[_0xf402('0x2b')]=_[_0xf402('0x2c')](_0x488587[_0xf402('0x28')],_0x488587['query']);_0x1fe222[_0xf402('0x2d')]=_[_0xf402('0x2c')](_0x488587['model'],qs['fields'](_0x350d71[_0xf402('0x29')][_0xf402('0x2e')]));_0x1fe222['attributes']=_0x1fe222[_0xf402('0x2d')][_0xf402('0x2f')]?_0x1fe222[_0xf402('0x2d')]:_0x488587['model'];if(_0x350d71[_0xf402('0x29')]['includeAll']){_0x1fe222[_0xf402('0x3c')]=[{'all':!![]}];}_0x1fe222=_['merge']({},_0x1fe222,_0x350d71[_0xf402('0x39')]);return db[_0xf402('0x3a')]['find'](_0x1fe222)['then'](handleEntityNotFound(_0x14fa65,null))[_0xf402('0x1e')](respondWithResult(_0x14fa65,null))[_0xf402('0x3e')](handleError(_0x14fa65,null));};exports['create']=function(_0x4afd40,_0x213c51){return db[_0xf402('0x3a')][_0xf402('0x41')](_0x4afd40[_0xf402('0x42')],{})[_0xf402('0x1e')](respondWithResult(_0x213c51,0xc9))[_0xf402('0x3e')](handleError(_0x213c51,null));};exports[_0xf402('0x1d')]=function(_0xf91b26,_0x48dc6){if(_0xf91b26['body']['id']){delete _0xf91b26[_0xf402('0x42')]['id'];}return db[_0xf402('0x3a')][_0xf402('0x43')]({'where':{'id':_0xf91b26['params']['id']}})[_0xf402('0x1e')](handleEntityNotFound(_0x48dc6,null))[_0xf402('0x1e')](saveUpdates(_0xf91b26[_0xf402('0x42')],null))[_0xf402('0x1e')](respondWithResult(_0x48dc6,null))['catch'](handleError(_0x48dc6,null));};exports[_0xf402('0x1f')]=function(_0x411fa3,_0x206601){return db[_0xf402('0x3a')][_0xf402('0x43')]({'where':{'id':_0x411fa3[_0xf402('0x40')]['id']}})[_0xf402('0x1e')](handleEntityNotFound(_0x206601,null))[_0xf402('0x1e')](removeEntity(_0x206601,null))[_0xf402('0x3e')](handleError(_0x206601,null));}; \ No newline at end of file diff --git a/server/api/intFreshdeskField/intFreshdeskField.model.js b/server/api/intFreshdeskField/intFreshdeskField.model.js index d509273..34eb89c 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 _0x6315=['freshdesk_unique_index','idField','FieldId','lodash','../../config/logger','api','moment','bluebird','request-promise','path','rimraf','../../config/environment','./intFreshdeskField.attributes','define'];(function(_0x563b86,_0x326c58){var _0x3e6478=function(_0x27ba2b){while(--_0x27ba2b){_0x563b86['push'](_0x563b86['shift']());}};_0x3e6478(++_0x326c58);}(_0x6315,0xc7));var _0x5631=function(_0x8751a7,_0xcba0b8){_0x8751a7=_0x8751a7-0x0;var _0x2706dd=_0x6315[_0x8751a7];return _0x2706dd;};'use strict';var _=require(_0x5631('0x0'));var util=require('util');var logger=require(_0x5631('0x1'))(_0x5631('0x2'));var moment=require(_0x5631('0x3'));var BPromise=require(_0x5631('0x4'));var rp=require(_0x5631('0x5'));var fs=require('fs');var path=require(_0x5631('0x6'));var rimraf=require(_0x5631('0x7'));var config=require(_0x5631('0x8'));var attributes=require(_0x5631('0x9'));module['exports']=function(_0x45eb22,_0x6628aa){return _0x45eb22[_0x5631('0xa')]('FreshdeskField',attributes,{'tableName':'int_freshdesk_fields','paranoid':![],'indexes':[{'name':_0x5631('0xb'),'fields':[_0x5631('0xc'),_0x5631('0xd')],'unique':!![]}],'timestamps':!![]});}; \ No newline at end of file +var _0x097c=['FieldId','lodash','util','../../config/logger','moment','bluebird','request-promise','path','../../config/environment','exports','define','int_freshdesk_fields'];(function(_0x3b380d,_0x4bf247){var _0x54502b=function(_0x35d207){while(--_0x35d207){_0x3b380d['push'](_0x3b380d['shift']());}};_0x54502b(++_0x4bf247);}(_0x097c,0x1d5));var _0xc097=function(_0x110158,_0x3b6120){_0x110158=_0x110158-0x0;var _0x5059fe=_0x097c[_0x110158];return _0x5059fe;};'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('./intFreshdeskField.attributes');module[_0xc097('0x8')]=function(_0x3c9603,_0x31bc9a){return _0x3c9603[_0xc097('0x9')]('FreshdeskField',attributes,{'tableName':_0xc097('0xa'),'paranoid':![],'indexes':[{'name':'freshdesk_unique_index','fields':['idField',_0xc097('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 e19c51f..de3f57b 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 _0x0746=['ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','client','http','then','info','FreshdeskField,\x20%s,\x20%s','debug','FreshdeskField,\x20%s,\x20%s,\x20%s','request\x20sent','error','code','message','catch','util','moment','bluebird'];(function(_0x29abd3,_0x1abf0a){var _0x24eda0=function(_0x1851dd){while(--_0x1851dd){_0x29abd3['push'](_0x29abd3['shift']());}};_0x24eda0(++_0x1abf0a);}(_0x0746,0x173));var _0x6074=function(_0x739fa8,_0x14813a){_0x739fa8=_0x739fa8-0x0;var _0x809885=_0x0746[_0x739fa8];return _0x809885;};'use strict';var _=require('lodash');var util=require(_0x6074('0x0'));var moment=require(_0x6074('0x1'));var BPromise=require(_0x6074('0x2'));var rs=require('randomstring');var fs=require('fs');var Redis=require(_0x6074('0x3'));var db=require(_0x6074('0x4'))['db'];var utils=require(_0x6074('0x5'));var logger=require(_0x6074('0x6'))(_0x6074('0x7'));var config=require(_0x6074('0x8'));var jayson=require(_0x6074('0x9'));var client=jayson[_0x6074('0xa')][_0x6074('0xb')]({'port':0x232a});function respondWithRpcPromise(_0x5b5913,_0x137523,_0x1ed3a3){return new BPromise(function(_0xdab97e,_0x1de809){return client['request'](_0x5b5913,_0x1ed3a3)[_0x6074('0xc')](function(_0x847d3a){logger[_0x6074('0xd')](_0x6074('0xe'),_0x137523,'request\x20sent');logger[_0x6074('0xf')](_0x6074('0x10'),_0x137523,_0x6074('0x11'),JSON['stringify'](_0x847d3a));if(_0x847d3a[_0x6074('0x12')]){if(_0x847d3a['error'][_0x6074('0x13')]===0x1f4){logger['error'](_0x6074('0xe'),_0x137523,_0x847d3a[_0x6074('0x12')][_0x6074('0x14')]);return _0x1de809(_0x847d3a['error'][_0x6074('0x14')]);}logger[_0x6074('0x12')](_0x6074('0xe'),_0x137523,_0x847d3a[_0x6074('0x12')][_0x6074('0x14')]);return _0xdab97e(_0x847d3a[_0x6074('0x12')][_0x6074('0x14')]);}else{logger[_0x6074('0xd')]('FreshdeskField,\x20%s,\x20%s',_0x137523,_0x6074('0x11'));_0xdab97e(_0x847d3a['result']['message']);}})[_0x6074('0x15')](function(_0x2a7893){logger[_0x6074('0x12')](_0x6074('0xe'),_0x137523,_0x2a7893);_0x1de809(_0x2a7893);});});} \ No newline at end of file +var _0x933c=['result','catch','lodash','moment','bluebird','randomstring','../../mysqldb','../../config/utils','../../config/logger','../../config/environment','jayson/promise','client','http','request','then','FreshdeskField,\x20%s,\x20%s','request\x20sent','debug','FreshdeskField,\x20%s,\x20%s,\x20%s','error','code','message'];(function(_0x718d5f,_0x48a5fe){var _0x3b3f34=function(_0x3b952d){while(--_0x3b952d){_0x718d5f['push'](_0x718d5f['shift']());}};_0x3b3f34(++_0x48a5fe);}(_0x933c,0xf4));var _0xc933=function(_0x13bb0b,_0xc6d339){_0x13bb0b=_0x13bb0b-0x0;var _0x25f81d=_0x933c[_0x13bb0b];return _0x25f81d;};'use strict';var _=require(_0xc933('0x0'));var util=require('util');var moment=require(_0xc933('0x1'));var BPromise=require(_0xc933('0x2'));var rs=require(_0xc933('0x3'));var fs=require('fs');var Redis=require('ioredis');var db=require(_0xc933('0x4'))['db'];var utils=require(_0xc933('0x5'));var logger=require(_0xc933('0x6'))('rpc');var config=require(_0xc933('0x7'));var jayson=require(_0xc933('0x8'));var client=jayson[_0xc933('0x9')][_0xc933('0xa')]({'port':0x232a});function respondWithRpcPromise(_0x239ea6,_0x3e2556,_0x2dd27a){return new BPromise(function(_0x372bd7,_0x53383c){return client[_0xc933('0xb')](_0x239ea6,_0x2dd27a)[_0xc933('0xc')](function(_0x1b2879){logger['info'](_0xc933('0xd'),_0x3e2556,_0xc933('0xe'));logger[_0xc933('0xf')](_0xc933('0x10'),_0x3e2556,_0xc933('0xe'),JSON['stringify'](_0x1b2879));if(_0x1b2879[_0xc933('0x11')]){if(_0x1b2879[_0xc933('0x11')][_0xc933('0x12')]===0x1f4){logger[_0xc933('0x11')](_0xc933('0xd'),_0x3e2556,_0x1b2879[_0xc933('0x11')][_0xc933('0x13')]);return _0x53383c(_0x1b2879[_0xc933('0x11')][_0xc933('0x13')]);}logger[_0xc933('0x11')](_0xc933('0xd'),_0x3e2556,_0x1b2879[_0xc933('0x11')][_0xc933('0x13')]);return _0x372bd7(_0x1b2879[_0xc933('0x11')]['message']);}else{logger['info'](_0xc933('0xd'),_0x3e2556,_0xc933('0xe'));_0x372bd7(_0x1b2879[_0xc933('0x14')][_0xc933('0x13')]);}})[_0xc933('0x15')](function(_0x4740da){logger[_0xc933('0x11')]('FreshdeskField,\x20%s,\x20%s',_0x3e2556,_0x4740da);_0x53383c(_0x4740da);});});} \ No newline at end of file diff --git a/server/api/intFreshsalesAccount/index.js b/server/api/intFreshsalesAccount/index.js index f0a18b8..f62c5a6 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 _0x36ee=['index','/:id','show','/:id/configurations','getConfigurations','/:id/fields','getFields','post','create','addConfiguration','update','delete','path','express','Router','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','./intFreshsalesAccount.controller','get','isAuthenticated'];(function(_0x4aea3e,_0x2135cc){var _0x556a40=function(_0x26ef56){while(--_0x26ef56){_0x4aea3e['push'](_0x4aea3e['shift']());}};_0x556a40(++_0x2135cc);}(_0x36ee,0xe8));var _0xe36e=function(_0x397e5f,_0x454c8f){_0x397e5f=_0x397e5f-0x0;var _0x5302b8=_0x36ee[_0x397e5f];return _0x5302b8;};'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('0x11')]('/',auth[_0xe36e('0x9')](),controller[_0xe36e('0x12')]);router[_0xe36e('0x11')](_0xe36e('0xd'),auth[_0xe36e('0x9')](),controller[_0xe36e('0x13')]);router['put'](_0xe36e('0xb'),auth[_0xe36e('0x9')](),controller[_0xe36e('0x14')]);router[_0xe36e('0x15')]('/:id',auth[_0xe36e('0x9')](),controller['destroy']);module['exports']=router; \ No newline at end of file +var _0x351d=['index','/:id','/:id/configurations','getFields','create','put','update','exports','multer','path','connect-timeout','express','fs-extra','../../components/interaction/service','../../config/environment','get','isAuthenticated'];(function(_0x22b39b,_0x2b7d63){var _0x280e1d=function(_0xc74635){while(--_0xc74635){_0x22b39b['push'](_0x22b39b['shift']());}};_0x280e1d(++_0x2b7d63);}(_0x351d,0x90));var _0xd351=function(_0x28d88f,_0x587aad){_0x28d88f=_0x28d88f-0x0;var _0x4a80f5=_0x351d[_0x28d88f];return _0x4a80f5;};'use strict';var multer=require(_0xd351('0x0'));var util=require('util');var path=require(_0xd351('0x1'));var timeout=require(_0xd351('0x2'));var express=require(_0xd351('0x3'));var router=express['Router']();var fs_extra=require(_0xd351('0x4'));var auth=require('../../components/auth/service');var interaction=require(_0xd351('0x5'));var config=require(_0xd351('0x6'));var controller=require('./intFreshsalesAccount.controller');router[_0xd351('0x7')]('/',auth[_0xd351('0x8')](),controller[_0xd351('0x9')]);router['get'](_0xd351('0xa'),auth[_0xd351('0x8')](),controller['show']);router[_0xd351('0x7')](_0xd351('0xb'),auth['isAuthenticated'](),controller['getConfigurations']);router[_0xd351('0x7')]('/:id/fields',auth[_0xd351('0x8')](),controller[_0xd351('0xc')]);router['post']('/',auth[_0xd351('0x8')](),controller[_0xd351('0xd')]);router['post'](_0xd351('0xb'),auth['isAuthenticated'](),controller['addConfiguration']);router[_0xd351('0xe')](_0xd351('0xa'),auth[_0xd351('0x8')](),controller[_0xd351('0xf')]);router['delete'](_0xd351('0xa'),auth[_0xd351('0x8')](),controller['destroy']);module[_0xd351('0x10')]=router; \ No newline at end of file diff --git a/server/api/intFreshsalesAccount/intFreshsalesAccount.attributes.js b/server/api/intFreshsalesAccount/intFreshsalesAccount.attributes.js index a4c8a98..bb0bb8f 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 _0x1775=['STRING','username','remoteUri','exports'];(function(_0x2b0f8d,_0x4383a5){var _0x1fa020=function(_0x412b6b){while(--_0x412b6b){_0x2b0f8d['push'](_0x2b0f8d['shift']());}};_0x1fa020(++_0x4383a5);}(_0x1775,0x1db));var _0x5177=function(_0xa464c9,_0x7c86d8){_0xa464c9=_0xa464c9-0x0;var _0x3d73c4=_0x1775[_0xa464c9];return _0x3d73c4;};'use strict';var Sequelize=require('sequelize');module[_0x5177('0x0')]={'name':{'type':Sequelize[_0x5177('0x1')]},'description':{'type':Sequelize[_0x5177('0x1')]},'username':{'type':Sequelize[_0x5177('0x1')],'unique':_0x5177('0x2')},'apiKey':{'type':Sequelize[_0x5177('0x1')]},'remoteUri':{'type':Sequelize[_0x5177('0x1')],'unique':_0x5177('0x3')},'serverUrl':{'type':Sequelize[_0x5177('0x1')],'allowNull':![]}}; \ No newline at end of file +var _0xf61e=['remoteUri','sequelize','exports','STRING','username'];(function(_0x16b122,_0x4af765){var _0x4badb5=function(_0x59317a){while(--_0x59317a){_0x16b122['push'](_0x16b122['shift']());}};_0x4badb5(++_0x4af765);}(_0xf61e,0x191));var _0xef61=function(_0x4880ca,_0x52a61d){_0x4880ca=_0x4880ca-0x0;var _0x2833e7=_0xf61e[_0x4880ca];return _0x2833e7;};'use strict';var Sequelize=require(_0xef61('0x0'));module[_0xef61('0x1')]={'name':{'type':Sequelize[_0xef61('0x2')]},'description':{'type':Sequelize[_0xef61('0x2')]},'username':{'type':Sequelize[_0xef61('0x2')],'unique':_0xef61('0x3')},'apiKey':{'type':Sequelize[_0xef61('0x2')]},'remoteUri':{'type':Sequelize[_0xef61('0x2')],'unique':_0xef61('0x4')},'serverUrl':{'type':Sequelize[_0xef61('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 56bd42a..86a5c29 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 _0xcb58=['channel','FreshsalesField','Descriptions','remoteUri','username','substring','lastIndexOf','GET','%s%s','/api/selector/owners','Token\x20token=','apiKey','users','Requested\x20Resource\x20not\x20Found','test','statusCode','getFields','stringify','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','moment','mustache','util','path','sox','fs-extra','lodash','squel','crypto','to-csv','querystring','papaparse','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/environment','../../config/license/util','sendStatus','status','end','json','undefined','count','offset','limit','set','reject','save','update','then','error','stack','name','send','index','map','FreshsalesAccount','rawAttributes','fieldName','type','key','keys','query','intersection','attributes','model','fields','length','hasOwnProperty','nolimit','order','sort','where','filters','pick','merge','VIRTUAL','filter','includeAll','findAll','rows','catch','show','params','include','create','body','find','destroy','getConfigurations','findOne','FreshsalesConfiguration','options','Subjects'];(function(_0x245f76,_0x5ae175){var _0x2f908b=function(_0x1ada93){while(--_0x1ada93){_0x245f76['push'](_0x245f76['shift']());}};_0x2f908b(++_0x5ae175);}(_0xcb58,0x77));var _0x8cb5=function(_0x357273,_0x30bda0){_0x357273=_0x357273-0x0;var _0x5a3590=_0xcb58[_0x357273];return _0x5a3590;};'use strict';var emlformat=require(_0x8cb5('0x0'));var rimraf=require(_0x8cb5('0x1'));var zipdir=require(_0x8cb5('0x2'));var jsonpatch=require(_0x8cb5('0x3'));var rp=require(_0x8cb5('0x4'));var moment=require(_0x8cb5('0x5'));var BPromise=require('bluebird');var Mustache=require(_0x8cb5('0x6'));var util=require(_0x8cb5('0x7'));var path=require(_0x8cb5('0x8'));var sox=require(_0x8cb5('0x9'));var csv=require('to-csv');var ejs=require('ejs');var fs=require('fs');var fs_extra=require(_0x8cb5('0xa'));var _=require(_0x8cb5('0xb'));var squel=require(_0x8cb5('0xc'));var crypto=require(_0x8cb5('0xd'));var jsforce=require('jsforce');var deskjs=require('desk.js');var toCsv=require(_0x8cb5('0xe'));var querystring=require(_0x8cb5('0xf'));var Papa=require(_0x8cb5('0x10'));var Redis=require('ioredis');var authService=require(_0x8cb5('0x11'));var qs=require(_0x8cb5('0x12'));var as=require(_0x8cb5('0x13'));var hardwareService=require(_0x8cb5('0x14'));var logger=require(_0x8cb5('0x15'))(_0x8cb5('0x16'));var utils=require(_0x8cb5('0x17'));var config=require(_0x8cb5('0x18'));var licenseUtil=require(_0x8cb5('0x19'));var db=require('../../mysqldb')['db'];var integrations=require('../../components/integrations/configuration');function respondWithStatusCode(_0x644a07,_0x1b1cee){_0x1b1cee=_0x1b1cee||0xcc;return function(_0x119e39){if(_0x119e39){return _0x644a07[_0x8cb5('0x1a')](_0x1b1cee);}return _0x644a07[_0x8cb5('0x1b')](_0x1b1cee)[_0x8cb5('0x1c')]();};}function respondWithResult(_0x5b2932,_0x93b235){_0x93b235=_0x93b235||0xc8;return function(_0x1d2649){if(_0x1d2649){return _0x5b2932['status'](_0x93b235)[_0x8cb5('0x1d')](_0x1d2649);}};}function respondWithFilteredResult(_0x2330de,_0x5f0073){return function(_0x126cf5){if(_0x126cf5){var _0x20e268=typeof _0x5f0073['offset']===_0x8cb5('0x1e')&&typeof _0x5f0073['limit']===_0x8cb5('0x1e');var _0x2ecf97=_0x126cf5[_0x8cb5('0x1f')];var _0x47e35a=_0x20e268?0x0:_0x5f0073[_0x8cb5('0x20')];var _0x208aba=_0x20e268?_0x126cf5[_0x8cb5('0x1f')]:_0x5f0073[_0x8cb5('0x20')]+_0x5f0073[_0x8cb5('0x21')];var _0x4eed8c;if(_0x208aba>=_0x2ecf97){_0x208aba=_0x2ecf97;_0x4eed8c=0xc8;}else{_0x4eed8c=0xce;}_0x2330de['status'](_0x4eed8c);return _0x2330de[_0x8cb5('0x22')]('Content-Range',_0x47e35a+'-'+_0x208aba+'/'+_0x2ecf97)[_0x8cb5('0x1d')](_0x126cf5);}return null;};}function patchUpdates(_0x4db7b2){return function(_0xec4aae){try{jsonpatch['apply'](_0xec4aae,_0x4db7b2,!![]);}catch(_0x270fa9){return BPromise[_0x8cb5('0x23')](_0x270fa9);}return _0xec4aae[_0x8cb5('0x24')]();};}function saveUpdates(_0x3415fe,_0x111e84){return function(_0xca931){if(_0xca931){return _0xca931[_0x8cb5('0x25')](_0x3415fe)[_0x8cb5('0x26')](function(_0x22f739){return _0x22f739;});}return null;};}function removeEntity(_0x5807f9,_0x1723a3){return function(_0x114d69){if(_0x114d69){return _0x114d69['destroy']()[_0x8cb5('0x26')](function(){_0x5807f9[_0x8cb5('0x1b')](0xcc)[_0x8cb5('0x1c')]();});}};}function handleEntityNotFound(_0x3d8bc5,_0xae2fc5){return function(_0x30b881){if(!_0x30b881){_0x3d8bc5[_0x8cb5('0x1a')](0x194);}return _0x30b881;};}function handleError(_0x37c77a,_0x2bdbf7){_0x2bdbf7=_0x2bdbf7||0x1f4;return function(_0x364873){logger[_0x8cb5('0x27')](_0x364873[_0x8cb5('0x28')]);if(_0x364873[_0x8cb5('0x29')]){delete _0x364873[_0x8cb5('0x29')];}_0x37c77a[_0x8cb5('0x1b')](_0x2bdbf7)[_0x8cb5('0x2a')](_0x364873);};}exports[_0x8cb5('0x2b')]=function(_0xb0712e,_0x10a1fe){var _0x354e05={},_0x4dc22c={},_0x15bf0c={'count':0x0,'rows':[]};var _0x33ee41=_[_0x8cb5('0x2c')](db[_0x8cb5('0x2d')][_0x8cb5('0x2e')],function(_0x4248ab){return{'name':_0x4248ab[_0x8cb5('0x2f')],'type':_0x4248ab[_0x8cb5('0x30')][_0x8cb5('0x31')]};});_0x4dc22c['model']=_[_0x8cb5('0x2c')](_0x33ee41,_0x8cb5('0x29'));_0x4dc22c['query']=_[_0x8cb5('0x32')](_0xb0712e[_0x8cb5('0x33')]);_0x4dc22c['filters']=_[_0x8cb5('0x34')](_0x4dc22c['model'],_0x4dc22c[_0x8cb5('0x33')]);_0x354e05[_0x8cb5('0x35')]=_[_0x8cb5('0x34')](_0x4dc22c[_0x8cb5('0x36')],qs[_0x8cb5('0x37')](_0xb0712e['query'][_0x8cb5('0x37')]));_0x354e05['attributes']=_0x354e05['attributes'][_0x8cb5('0x38')]?_0x354e05[_0x8cb5('0x35')]:_0x4dc22c[_0x8cb5('0x36')];if(!_0xb0712e[_0x8cb5('0x33')][_0x8cb5('0x39')](_0x8cb5('0x3a'))){_0x354e05[_0x8cb5('0x21')]=qs[_0x8cb5('0x21')](_0xb0712e['query']['limit']);_0x354e05[_0x8cb5('0x20')]=qs[_0x8cb5('0x20')](_0xb0712e[_0x8cb5('0x33')][_0x8cb5('0x20')]);}_0x354e05[_0x8cb5('0x3b')]=qs['sort'](_0xb0712e[_0x8cb5('0x33')][_0x8cb5('0x3c')]);_0x354e05[_0x8cb5('0x3d')]=qs[_0x8cb5('0x3e')](_[_0x8cb5('0x3f')](_0xb0712e[_0x8cb5('0x33')],_0x4dc22c[_0x8cb5('0x3e')]),_0x33ee41);if(_0xb0712e[_0x8cb5('0x33')]['filter']){_0x354e05[_0x8cb5('0x3d')]=_[_0x8cb5('0x40')](_0x354e05[_0x8cb5('0x3d')],{'$or':_['map'](_0x33ee41,function(_0xba528d){if(_0xba528d[_0x8cb5('0x30')]!==_0x8cb5('0x41')){var _0x2b383f={};_0x2b383f[_0xba528d['name']]={'$like':'%'+_0xb0712e['query'][_0x8cb5('0x42')]+'%'};return _0x2b383f;}})});}_0x354e05=_[_0x8cb5('0x40')]({},_0x354e05,_0xb0712e['options']);var _0x2b4317={'where':_0x354e05[_0x8cb5('0x3d')]};return db['FreshsalesAccount'][_0x8cb5('0x1f')](_0x2b4317)[_0x8cb5('0x26')](function(_0x2ad8cb){_0x15bf0c[_0x8cb5('0x1f')]=_0x2ad8cb;if(_0xb0712e[_0x8cb5('0x33')][_0x8cb5('0x43')]){_0x354e05['include']=[{'all':!![]}];}return db[_0x8cb5('0x2d')][_0x8cb5('0x44')](_0x354e05);})[_0x8cb5('0x26')](function(_0x465892){_0x15bf0c[_0x8cb5('0x45')]=_0x465892;return _0x15bf0c;})[_0x8cb5('0x26')](respondWithFilteredResult(_0x10a1fe,_0x354e05))[_0x8cb5('0x46')](handleError(_0x10a1fe,null));};exports[_0x8cb5('0x47')]=function(_0x2c6adc,_0x179aa9){var _0x28135e={'raw':![],'where':{'id':_0x2c6adc[_0x8cb5('0x48')]['id']}},_0x20f9c9={};_0x20f9c9[_0x8cb5('0x36')]=_[_0x8cb5('0x32')](db[_0x8cb5('0x2d')][_0x8cb5('0x2e')]);_0x20f9c9[_0x8cb5('0x33')]=_[_0x8cb5('0x32')](_0x2c6adc[_0x8cb5('0x33')]);_0x20f9c9[_0x8cb5('0x3e')]=_['intersection'](_0x20f9c9[_0x8cb5('0x36')],_0x20f9c9[_0x8cb5('0x33')]);_0x28135e[_0x8cb5('0x35')]=_[_0x8cb5('0x34')](_0x20f9c9[_0x8cb5('0x36')],qs[_0x8cb5('0x37')](_0x2c6adc[_0x8cb5('0x33')][_0x8cb5('0x37')]));_0x28135e[_0x8cb5('0x35')]=_0x28135e['attributes'][_0x8cb5('0x38')]?_0x28135e[_0x8cb5('0x35')]:_0x20f9c9[_0x8cb5('0x36')];if(_0x2c6adc[_0x8cb5('0x33')]['includeAll']){_0x28135e[_0x8cb5('0x49')]=[{'all':!![]}];}_0x28135e=_[_0x8cb5('0x40')]({},_0x28135e,_0x2c6adc['options']);return db[_0x8cb5('0x2d')]['find'](_0x28135e)[_0x8cb5('0x26')](handleEntityNotFound(_0x179aa9,null))[_0x8cb5('0x26')](respondWithResult(_0x179aa9,null))[_0x8cb5('0x46')](handleError(_0x179aa9,null));};exports[_0x8cb5('0x4a')]=function(_0x531dc6,_0x5de867){return db[_0x8cb5('0x2d')][_0x8cb5('0x4a')](_0x531dc6[_0x8cb5('0x4b')],{})[_0x8cb5('0x26')](respondWithResult(_0x5de867,0xc9))[_0x8cb5('0x46')](handleError(_0x5de867,null));};exports['update']=function(_0x49dddc,_0x42fb3a){if(_0x49dddc['body']['id']){delete _0x49dddc[_0x8cb5('0x4b')]['id'];}return db['FreshsalesAccount'][_0x8cb5('0x4c')]({'where':{'id':_0x49dddc[_0x8cb5('0x48')]['id']}})[_0x8cb5('0x26')](handleEntityNotFound(_0x42fb3a,null))['then'](saveUpdates(_0x49dddc['body'],null))[_0x8cb5('0x26')](respondWithResult(_0x42fb3a,null))[_0x8cb5('0x46')](handleError(_0x42fb3a,null));};exports[_0x8cb5('0x4d')]=function(_0x361f37,_0x24239b){return db[_0x8cb5('0x2d')][_0x8cb5('0x4c')]({'where':{'id':_0x361f37[_0x8cb5('0x48')]['id']}})['then'](handleEntityNotFound(_0x24239b,null))['then'](removeEntity(_0x24239b,null))['catch'](handleError(_0x24239b,null));};exports[_0x8cb5('0x4e')]=function(_0x530e9e,_0x1984a9,_0x4d0a5a){var _0x309f47={};var _0x20254c={};var _0x464f66;var _0x230cd2;return db[_0x8cb5('0x2d')][_0x8cb5('0x4f')]({'where':{'id':_0x530e9e[_0x8cb5('0x48')]['id']}})['then'](handleEntityNotFound(_0x1984a9,null))['then'](function(_0x55385a){if(_0x55385a){_0x464f66=_0x55385a;_0x20254c[_0x8cb5('0x36')]=_['keys'](db[_0x8cb5('0x50')][_0x8cb5('0x2e')]);_0x20254c[_0x8cb5('0x33')]=_[_0x8cb5('0x32')](_0x530e9e[_0x8cb5('0x33')]);_0x20254c[_0x8cb5('0x3e')]=_[_0x8cb5('0x34')](_0x20254c['model'],_0x20254c[_0x8cb5('0x33')]);_0x309f47[_0x8cb5('0x35')]=_[_0x8cb5('0x34')](_0x20254c[_0x8cb5('0x36')],qs[_0x8cb5('0x37')](_0x530e9e[_0x8cb5('0x33')]['fields']));_0x309f47[_0x8cb5('0x35')]=_0x309f47[_0x8cb5('0x35')][_0x8cb5('0x38')]?_0x309f47['attributes']:_0x20254c['model'];_0x309f47[_0x8cb5('0x3b')]=qs[_0x8cb5('0x3c')](_0x530e9e[_0x8cb5('0x33')][_0x8cb5('0x3c')]);_0x309f47[_0x8cb5('0x3d')]=qs[_0x8cb5('0x3e')](_[_0x8cb5('0x3f')](_0x530e9e[_0x8cb5('0x33')],_0x20254c['filters']));if(_0x530e9e[_0x8cb5('0x33')][_0x8cb5('0x42')]){_0x309f47[_0x8cb5('0x3d')]=_[_0x8cb5('0x40')](_0x309f47[_0x8cb5('0x3d')],{'$or':_[_0x8cb5('0x2c')](_0x309f47[_0x8cb5('0x35')],function(_0x177ec2){var _0x3d400b={};_0x3d400b[_0x177ec2]={'$like':'%'+_0x530e9e[_0x8cb5('0x33')][_0x8cb5('0x42')]+'%'};return _0x3d400b;})});}_0x309f47=_[_0x8cb5('0x40')]({},_0x309f47,_0x530e9e[_0x8cb5('0x51')]);return _0x464f66[_0x8cb5('0x4e')](_0x309f47);}})[_0x8cb5('0x26')](function(_0x113500){if(_0x113500){_0x230cd2=_0x113500[_0x8cb5('0x38')];if(!_0x530e9e[_0x8cb5('0x33')][_0x8cb5('0x39')](_0x8cb5('0x3a'))){_0x309f47[_0x8cb5('0x21')]=qs[_0x8cb5('0x21')](_0x530e9e[_0x8cb5('0x33')][_0x8cb5('0x21')]);_0x309f47[_0x8cb5('0x20')]=qs['offset'](_0x530e9e[_0x8cb5('0x33')]['offset']);}return _0x464f66[_0x8cb5('0x4e')](_0x309f47);}})[_0x8cb5('0x26')](function(_0x296327){if(_0x296327){return _0x296327?{'count':_0x230cd2,'rows':_0x296327}:null;}})[_0x8cb5('0x26')](respondWithResult(_0x1984a9,null))['catch'](handleError(_0x1984a9,null));};exports['addConfiguration']=function(_0x2eeda2,_0x44da35,_0x147edf){if(_0x2eeda2[_0x8cb5('0x4b')]['id']){delete _0x2eeda2[_0x8cb5('0x4b')]['id'];}return db['FreshsalesAccount'][_0x8cb5('0x4f')]({'where':{'id':_0x2eeda2[_0x8cb5('0x48')]['id']}})[_0x8cb5('0x26')](handleEntityNotFound(_0x44da35,null))['then'](function(_0x331784){if(_0x331784){_0x2eeda2[_0x8cb5('0x4b')]['AccountId']=_0x331784['id'];_0x2eeda2[_0x8cb5('0x4b')][_0x8cb5('0x52')]=integrations['getSubjects'](_0x2eeda2[_0x8cb5('0x4b')]['channel'],_0x2eeda2['body'][_0x8cb5('0x30')]);_0x2eeda2[_0x8cb5('0x4b')]['Descriptions']=integrations['getDescriptions'](_0x2eeda2[_0x8cb5('0x4b')][_0x8cb5('0x53')],_0x2eeda2[_0x8cb5('0x4b')][_0x8cb5('0x30')]);return db[_0x8cb5('0x50')][_0x8cb5('0x4a')](_0x2eeda2[_0x8cb5('0x4b')],{'include':[{'model':db['FreshsalesField'],'as':'Subjects'},{'model':db[_0x8cb5('0x54')],'as':_0x8cb5('0x55')}]});}return null;})[_0x8cb5('0x26')](respondWithResult(_0x44da35,null))[_0x8cb5('0x46')](handleError(_0x44da35,null));};exports['getFields']=function(_0x2bc63b,_0x5cb557,_0x5e0f8b){var _0x22f9d5='';var _0x355df2='';return db[_0x8cb5('0x2d')]['findOne']({'where':{'id':_0x2bc63b[_0x8cb5('0x48')]['id']},'attributes':['id','username',_0x8cb5('0x56'),'apiKey']})[_0x8cb5('0x26')](handleEntityNotFound(_0x5cb557,null))[_0x8cb5('0x26')](function(_0x49ddfc){if(_0x49ddfc){_0x355df2=_0x49ddfc[_0x8cb5('0x57')];_0x22f9d5=_0x49ddfc[_0x8cb5('0x56')];var _0x2d1207=_0x49ddfc[_0x8cb5('0x56')]['slice'](-0x1);if(_0x2d1207==='/'){_0x22f9d5=_0x22f9d5[_0x8cb5('0x58')](0x0,_0x22f9d5[_0x8cb5('0x59')](_0x2d1207));}return rp({'method':_0x8cb5('0x5a'),'uri':util['format'](_0x8cb5('0x5b'),_0x22f9d5,_0x8cb5('0x5c')),'headers':{'Authorization':_0x8cb5('0x5d')+_0x49ddfc[_0x8cb5('0x5e')]},'json':!![]});}})[_0x8cb5('0x26')](function(_0x95c056){if(_0x95c056){var _0x2d212f=_0x95c056[_0x8cb5('0x5f')];var _0x29aef6=![];var _0x58c2cb=null;for(_0x58c2cb=0x0;_0x58c2cb<_0x2d212f[_0x8cb5('0x38')];_0x58c2cb++){if(_0x2d212f[_0x58c2cb]['email']===_0x355df2){_0x29aef6=!![];}}if(_0x29aef6){return!![];}else{throw new Error({'statusCode':0x194,'message':_0x8cb5('0x60')});}}})[_0x8cb5('0x26')](respondWithResult(_0x5cb557,null))['catch'](function(_0x52e8df){var _0x31eccd=_0x2bc63b[_0x8cb5('0x33')][_0x8cb5('0x61')]?0x1f4:_0x52e8df[_0x8cb5('0x62')]||0x1f4;logger['error']('getFields,\x20%s,\x20%s,\x20%s',_0x8cb5('0x63'),_0x31eccd,JSON[_0x8cb5('0x64')](_0x52e8df));delete _0x52e8df[_0x8cb5('0x29')];if(_0x31eccd===0x191){_0x31eccd=0x190;}_0x5cb557[_0x8cb5('0x1b')](_0x31eccd)[_0x8cb5('0x2a')](_0x2bc63b['query'][_0x8cb5('0x61')]?{'message':'Wrong\x20credentials','statusCode':_0x52e8df[_0x8cb5('0x62')]}:_0x52e8df);});}; \ No newline at end of file +var _0xf213=['includeAll','include','findAll','rows','catch','params','fields','find','create','body','getConfigurations','FreshsalesConfiguration','hasOwnProperty','addConfiguration','findOne','AccountId','Subjects','getSubjects','channel','getDescriptions','FreshsalesField','Descriptions','getFields','username','remoteUri','apiKey','substring','lastIndexOf','GET','format','%s%s','Token\x20token=','users','email','Requested\x20Resource\x20not\x20Found','test','statusCode','getFields,\x20%s,\x20%s,\x20%s','stringify','Wrong\x20credentials','zip-dir','fast-json-patch','request-promise','bluebird','sox','lodash','squel','crypto','jsforce','desk.js','to-csv','querystring','papaparse','../../components/auth/service','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/environment','../../config/license/util','../../components/integrations/configuration','sendStatus','end','offset','undefined','limit','count','status','Content-Range','json','reject','save','update','then','destroy','error','stack','name','send','index','map','FreshsalesAccount','rawAttributes','fieldName','type','key','model','keys','filters','intersection','query','attributes','length','nolimit','order','sort','where','pick','filter','merge','VIRTUAL','options'];(function(_0x5a4a54,_0x55bb0a){var _0x40b849=function(_0x5eee11){while(--_0x5eee11){_0x5a4a54['push'](_0x5a4a54['shift']());}};_0x40b849(++_0x55bb0a);}(_0xf213,0x8e));var _0x3f21=function(_0x31aa33,_0x4a236b){_0x31aa33=_0x31aa33-0x0;var _0x444255=_0xf213[_0x31aa33];return _0x444255;};'use strict';var emlformat=require('eml-format');var rimraf=require('rimraf');var zipdir=require(_0x3f21('0x0'));var jsonpatch=require(_0x3f21('0x1'));var rp=require(_0x3f21('0x2'));var moment=require('moment');var BPromise=require(_0x3f21('0x3'));var Mustache=require('mustache');var util=require('util');var path=require('path');var sox=require(_0x3f21('0x4'));var csv=require('to-csv');var ejs=require('ejs');var fs=require('fs');var fs_extra=require('fs-extra');var _=require(_0x3f21('0x5'));var squel=require(_0x3f21('0x6'));var crypto=require(_0x3f21('0x7'));var jsforce=require(_0x3f21('0x8'));var deskjs=require(_0x3f21('0x9'));var toCsv=require(_0x3f21('0xa'));var querystring=require(_0x3f21('0xb'));var Papa=require(_0x3f21('0xc'));var Redis=require('ioredis');var authService=require(_0x3f21('0xd'));var qs=require('../../components/parsers/qs');var as=require('../../components/parsers/advancedSearch');var hardwareService=require(_0x3f21('0xe'));var logger=require(_0x3f21('0xf'))(_0x3f21('0x10'));var utils=require(_0x3f21('0x11'));var config=require(_0x3f21('0x12'));var licenseUtil=require(_0x3f21('0x13'));var db=require('../../mysqldb')['db'];var integrations=require(_0x3f21('0x14'));function respondWithStatusCode(_0x4093d2,_0x4f8c85){_0x4f8c85=_0x4f8c85||0xcc;return function(_0x3e3e65){if(_0x3e3e65){return _0x4093d2[_0x3f21('0x15')](_0x4f8c85);}return _0x4093d2['status'](_0x4f8c85)[_0x3f21('0x16')]();};}function respondWithResult(_0x2d7de0,_0x26e57f){_0x26e57f=_0x26e57f||0xc8;return function(_0x1e1e56){if(_0x1e1e56){return _0x2d7de0['status'](_0x26e57f)['json'](_0x1e1e56);}};}function respondWithFilteredResult(_0xc0adf7,_0x33b814){return function(_0x33585b){if(_0x33585b){var _0x17d386=typeof _0x33b814[_0x3f21('0x17')]===_0x3f21('0x18')&&typeof _0x33b814[_0x3f21('0x19')]===_0x3f21('0x18');var _0x20850f=_0x33585b[_0x3f21('0x1a')];var _0x4adaef=_0x17d386?0x0:_0x33b814[_0x3f21('0x17')];var _0xd27223=_0x17d386?_0x33585b[_0x3f21('0x1a')]:_0x33b814[_0x3f21('0x17')]+_0x33b814[_0x3f21('0x19')];var _0x12d4b1;if(_0xd27223>=_0x20850f){_0xd27223=_0x20850f;_0x12d4b1=0xc8;}else{_0x12d4b1=0xce;}_0xc0adf7[_0x3f21('0x1b')](_0x12d4b1);return _0xc0adf7['set'](_0x3f21('0x1c'),_0x4adaef+'-'+_0xd27223+'/'+_0x20850f)[_0x3f21('0x1d')](_0x33585b);}return null;};}function patchUpdates(_0x3224cd){return function(_0x360fd2){try{jsonpatch['apply'](_0x360fd2,_0x3224cd,!![]);}catch(_0x32610b){return BPromise[_0x3f21('0x1e')](_0x32610b);}return _0x360fd2[_0x3f21('0x1f')]();};}function saveUpdates(_0x17022f,_0x4b790d){return function(_0x2b8180){if(_0x2b8180){return _0x2b8180[_0x3f21('0x20')](_0x17022f)[_0x3f21('0x21')](function(_0xa1ed81){return _0xa1ed81;});}return null;};}function removeEntity(_0x1c9112,_0x43c74d){return function(_0x215ff2){if(_0x215ff2){return _0x215ff2[_0x3f21('0x22')]()[_0x3f21('0x21')](function(){_0x1c9112[_0x3f21('0x1b')](0xcc)[_0x3f21('0x16')]();});}};}function handleEntityNotFound(_0x10b802,_0x52ce38){return function(_0x143cf5){if(!_0x143cf5){_0x10b802[_0x3f21('0x15')](0x194);}return _0x143cf5;};}function handleError(_0x45a837,_0x18ef9a){_0x18ef9a=_0x18ef9a||0x1f4;return function(_0x3ca7a3){logger[_0x3f21('0x23')](_0x3ca7a3[_0x3f21('0x24')]);if(_0x3ca7a3['name']){delete _0x3ca7a3[_0x3f21('0x25')];}_0x45a837['status'](_0x18ef9a)[_0x3f21('0x26')](_0x3ca7a3);};}exports[_0x3f21('0x27')]=function(_0x14acba,_0x570eb7){var _0x30c308={},_0x11b798={},_0x4f0077={'count':0x0,'rows':[]};var _0x803eea=_[_0x3f21('0x28')](db[_0x3f21('0x29')][_0x3f21('0x2a')],function(_0x441705){return{'name':_0x441705[_0x3f21('0x2b')],'type':_0x441705[_0x3f21('0x2c')][_0x3f21('0x2d')]};});_0x11b798[_0x3f21('0x2e')]=_[_0x3f21('0x28')](_0x803eea,_0x3f21('0x25'));_0x11b798['query']=_[_0x3f21('0x2f')](_0x14acba['query']);_0x11b798[_0x3f21('0x30')]=_[_0x3f21('0x31')](_0x11b798[_0x3f21('0x2e')],_0x11b798[_0x3f21('0x32')]);_0x30c308[_0x3f21('0x33')]=_['intersection'](_0x11b798[_0x3f21('0x2e')],qs['fields'](_0x14acba['query']['fields']));_0x30c308[_0x3f21('0x33')]=_0x30c308[_0x3f21('0x33')][_0x3f21('0x34')]?_0x30c308[_0x3f21('0x33')]:_0x11b798[_0x3f21('0x2e')];if(!_0x14acba[_0x3f21('0x32')]['hasOwnProperty'](_0x3f21('0x35'))){_0x30c308[_0x3f21('0x19')]=qs[_0x3f21('0x19')](_0x14acba[_0x3f21('0x32')][_0x3f21('0x19')]);_0x30c308[_0x3f21('0x17')]=qs['offset'](_0x14acba[_0x3f21('0x32')][_0x3f21('0x17')]);}_0x30c308[_0x3f21('0x36')]=qs[_0x3f21('0x37')](_0x14acba[_0x3f21('0x32')][_0x3f21('0x37')]);_0x30c308[_0x3f21('0x38')]=qs['filters'](_[_0x3f21('0x39')](_0x14acba[_0x3f21('0x32')],_0x11b798['filters']),_0x803eea);if(_0x14acba[_0x3f21('0x32')][_0x3f21('0x3a')]){_0x30c308['where']=_[_0x3f21('0x3b')](_0x30c308['where'],{'$or':_[_0x3f21('0x28')](_0x803eea,function(_0x4e5826){if(_0x4e5826[_0x3f21('0x2c')]!==_0x3f21('0x3c')){var _0x561743={};_0x561743[_0x4e5826['name']]={'$like':'%'+_0x14acba['query'][_0x3f21('0x3a')]+'%'};return _0x561743;}})});}_0x30c308=_[_0x3f21('0x3b')]({},_0x30c308,_0x14acba[_0x3f21('0x3d')]);var _0x184d1f={'where':_0x30c308['where']};return db[_0x3f21('0x29')][_0x3f21('0x1a')](_0x184d1f)['then'](function(_0xcf2c73){_0x4f0077[_0x3f21('0x1a')]=_0xcf2c73;if(_0x14acba[_0x3f21('0x32')][_0x3f21('0x3e')]){_0x30c308[_0x3f21('0x3f')]=[{'all':!![]}];}return db[_0x3f21('0x29')][_0x3f21('0x40')](_0x30c308);})[_0x3f21('0x21')](function(_0x15366c){_0x4f0077[_0x3f21('0x41')]=_0x15366c;return _0x4f0077;})[_0x3f21('0x21')](respondWithFilteredResult(_0x570eb7,_0x30c308))[_0x3f21('0x42')](handleError(_0x570eb7,null));};exports['show']=function(_0x4d606f,_0xb1d0b5){var _0x982509={'raw':![],'where':{'id':_0x4d606f[_0x3f21('0x43')]['id']}},_0x2b414a={};_0x2b414a['model']=_[_0x3f21('0x2f')](db[_0x3f21('0x29')][_0x3f21('0x2a')]);_0x2b414a[_0x3f21('0x32')]=_[_0x3f21('0x2f')](_0x4d606f['query']);_0x2b414a[_0x3f21('0x30')]=_[_0x3f21('0x31')](_0x2b414a[_0x3f21('0x2e')],_0x2b414a[_0x3f21('0x32')]);_0x982509['attributes']=_['intersection'](_0x2b414a['model'],qs[_0x3f21('0x44')](_0x4d606f[_0x3f21('0x32')]['fields']));_0x982509[_0x3f21('0x33')]=_0x982509[_0x3f21('0x33')]['length']?_0x982509['attributes']:_0x2b414a[_0x3f21('0x2e')];if(_0x4d606f[_0x3f21('0x32')]['includeAll']){_0x982509[_0x3f21('0x3f')]=[{'all':!![]}];}_0x982509=_[_0x3f21('0x3b')]({},_0x982509,_0x4d606f[_0x3f21('0x3d')]);return db['FreshsalesAccount'][_0x3f21('0x45')](_0x982509)['then'](handleEntityNotFound(_0xb1d0b5,null))[_0x3f21('0x21')](respondWithResult(_0xb1d0b5,null))['catch'](handleError(_0xb1d0b5,null));};exports['create']=function(_0x49d142,_0x3ed20d){return db[_0x3f21('0x29')][_0x3f21('0x46')](_0x49d142['body'],{})[_0x3f21('0x21')](respondWithResult(_0x3ed20d,0xc9))[_0x3f21('0x42')](handleError(_0x3ed20d,null));};exports['update']=function(_0x1983f2,_0xae354f){if(_0x1983f2[_0x3f21('0x47')]['id']){delete _0x1983f2[_0x3f21('0x47')]['id'];}return db[_0x3f21('0x29')][_0x3f21('0x45')]({'where':{'id':_0x1983f2[_0x3f21('0x43')]['id']}})['then'](handleEntityNotFound(_0xae354f,null))['then'](saveUpdates(_0x1983f2[_0x3f21('0x47')],null))['then'](respondWithResult(_0xae354f,null))[_0x3f21('0x42')](handleError(_0xae354f,null));};exports[_0x3f21('0x22')]=function(_0x641c1f,_0x3656db){return db[_0x3f21('0x29')][_0x3f21('0x45')]({'where':{'id':_0x641c1f[_0x3f21('0x43')]['id']}})['then'](handleEntityNotFound(_0x3656db,null))[_0x3f21('0x21')](removeEntity(_0x3656db,null))[_0x3f21('0x42')](handleError(_0x3656db,null));};exports[_0x3f21('0x48')]=function(_0x5d472a,_0x22a87c,_0x4a0311){var _0x55975c={};var _0x4ac34a={};var _0x2aa14a;var _0x57601b;return db[_0x3f21('0x29')]['findOne']({'where':{'id':_0x5d472a['params']['id']}})[_0x3f21('0x21')](handleEntityNotFound(_0x22a87c,null))[_0x3f21('0x21')](function(_0x48341b){if(_0x48341b){_0x2aa14a=_0x48341b;_0x4ac34a[_0x3f21('0x2e')]=_['keys'](db[_0x3f21('0x49')][_0x3f21('0x2a')]);_0x4ac34a['query']=_[_0x3f21('0x2f')](_0x5d472a[_0x3f21('0x32')]);_0x4ac34a['filters']=_['intersection'](_0x4ac34a['model'],_0x4ac34a[_0x3f21('0x32')]);_0x55975c['attributes']=_[_0x3f21('0x31')](_0x4ac34a[_0x3f21('0x2e')],qs[_0x3f21('0x44')](_0x5d472a[_0x3f21('0x32')][_0x3f21('0x44')]));_0x55975c[_0x3f21('0x33')]=_0x55975c[_0x3f21('0x33')][_0x3f21('0x34')]?_0x55975c[_0x3f21('0x33')]:_0x4ac34a[_0x3f21('0x2e')];_0x55975c['order']=qs['sort'](_0x5d472a[_0x3f21('0x32')]['sort']);_0x55975c[_0x3f21('0x38')]=qs['filters'](_['pick'](_0x5d472a[_0x3f21('0x32')],_0x4ac34a[_0x3f21('0x30')]));if(_0x5d472a[_0x3f21('0x32')][_0x3f21('0x3a')]){_0x55975c[_0x3f21('0x38')]=_['merge'](_0x55975c['where'],{'$or':_['map'](_0x55975c[_0x3f21('0x33')],function(_0x21cb78){var _0x2e443f={};_0x2e443f[_0x21cb78]={'$like':'%'+_0x5d472a[_0x3f21('0x32')][_0x3f21('0x3a')]+'%'};return _0x2e443f;})});}_0x55975c=_[_0x3f21('0x3b')]({},_0x55975c,_0x5d472a[_0x3f21('0x3d')]);return _0x2aa14a[_0x3f21('0x48')](_0x55975c);}})[_0x3f21('0x21')](function(_0x455202){if(_0x455202){_0x57601b=_0x455202[_0x3f21('0x34')];if(!_0x5d472a[_0x3f21('0x32')][_0x3f21('0x4a')]('nolimit')){_0x55975c[_0x3f21('0x19')]=qs[_0x3f21('0x19')](_0x5d472a['query']['limit']);_0x55975c[_0x3f21('0x17')]=qs[_0x3f21('0x17')](_0x5d472a[_0x3f21('0x32')][_0x3f21('0x17')]);}return _0x2aa14a['getConfigurations'](_0x55975c);}})['then'](function(_0x328b29){if(_0x328b29){return _0x328b29?{'count':_0x57601b,'rows':_0x328b29}:null;}})['then'](respondWithResult(_0x22a87c,null))['catch'](handleError(_0x22a87c,null));};exports[_0x3f21('0x4b')]=function(_0x4197a8,_0xd5780b,_0x42ca98){if(_0x4197a8[_0x3f21('0x47')]['id']){delete _0x4197a8[_0x3f21('0x47')]['id'];}return db[_0x3f21('0x29')][_0x3f21('0x4c')]({'where':{'id':_0x4197a8['params']['id']}})[_0x3f21('0x21')](handleEntityNotFound(_0xd5780b,null))['then'](function(_0x8399ac){if(_0x8399ac){_0x4197a8[_0x3f21('0x47')][_0x3f21('0x4d')]=_0x8399ac['id'];_0x4197a8[_0x3f21('0x47')][_0x3f21('0x4e')]=integrations[_0x3f21('0x4f')](_0x4197a8[_0x3f21('0x47')][_0x3f21('0x50')],_0x4197a8[_0x3f21('0x47')][_0x3f21('0x2c')]);_0x4197a8[_0x3f21('0x47')]['Descriptions']=integrations[_0x3f21('0x51')](_0x4197a8['body'][_0x3f21('0x50')],_0x4197a8[_0x3f21('0x47')]['type']);return db[_0x3f21('0x49')][_0x3f21('0x46')](_0x4197a8[_0x3f21('0x47')],{'include':[{'model':db['FreshsalesField'],'as':_0x3f21('0x4e')},{'model':db[_0x3f21('0x52')],'as':_0x3f21('0x53')}]});}return null;})[_0x3f21('0x21')](respondWithResult(_0xd5780b,null))[_0x3f21('0x42')](handleError(_0xd5780b,null));};exports[_0x3f21('0x54')]=function(_0x3de69b,_0x57083e,_0x333ec0){var _0x1d0d8d='';var _0x1ee399='';return db['FreshsalesAccount']['findOne']({'where':{'id':_0x3de69b[_0x3f21('0x43')]['id']},'attributes':['id',_0x3f21('0x55'),_0x3f21('0x56'),_0x3f21('0x57')]})[_0x3f21('0x21')](handleEntityNotFound(_0x57083e,null))[_0x3f21('0x21')](function(_0x9d553c){if(_0x9d553c){_0x1ee399=_0x9d553c[_0x3f21('0x55')];_0x1d0d8d=_0x9d553c[_0x3f21('0x56')];var _0x21fc8c=_0x9d553c['remoteUri']['slice'](-0x1);if(_0x21fc8c==='/'){_0x1d0d8d=_0x1d0d8d[_0x3f21('0x58')](0x0,_0x1d0d8d[_0x3f21('0x59')](_0x21fc8c));}return rp({'method':_0x3f21('0x5a'),'uri':util[_0x3f21('0x5b')](_0x3f21('0x5c'),_0x1d0d8d,'/api/selector/owners'),'headers':{'Authorization':_0x3f21('0x5d')+_0x9d553c[_0x3f21('0x57')]},'json':!![]});}})['then'](function(_0x3a7330){if(_0x3a7330){var _0x5bbf8b=_0x3a7330[_0x3f21('0x5e')];var _0x3987e6=![];var _0xaa07f9=null;for(_0xaa07f9=0x0;_0xaa07f9<_0x5bbf8b[_0x3f21('0x34')];_0xaa07f9++){if(_0x5bbf8b[_0xaa07f9][_0x3f21('0x5f')]===_0x1ee399){_0x3987e6=!![];}}if(_0x3987e6){return!![];}else{throw new Error({'statusCode':0x194,'message':_0x3f21('0x60')});}}})[_0x3f21('0x21')](respondWithResult(_0x57083e,null))[_0x3f21('0x42')](function(_0x535794){var _0x6f6f6b=_0x3de69b[_0x3f21('0x32')][_0x3f21('0x61')]?0x1f4:_0x535794[_0x3f21('0x62')]||0x1f4;logger[_0x3f21('0x23')](_0x3f21('0x63'),_0x3f21('0x54'),_0x6f6f6b,JSON[_0x3f21('0x64')](_0x535794));delete _0x535794[_0x3f21('0x25')];if(_0x6f6f6b===0x191){_0x6f6f6b=0x190;}_0x57083e[_0x3f21('0x1b')](_0x6f6f6b)[_0x3f21('0x26')](_0x3de69b[_0x3f21('0x32')][_0x3f21('0x61')]?{'message':_0x3f21('0x65'),'statusCode':_0x535794[_0x3f21('0x62')]}:_0x535794);});}; \ No newline at end of file diff --git a/server/api/intFreshsalesAccount/intFreshsalesAccount.model.js b/server/api/intFreshsalesAccount/intFreshsalesAccount.model.js index e23af59..78ef591 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 _0x6455=['request-promise','path','../../config/environment','./intFreshsalesAccount.attributes','../../components/integrations/configuration','exports','define','FreshsalesAccount','lodash','../../config/logger','api','moment','bluebird'];(function(_0x45d55e,_0x2fede3){var _0x29812a=function(_0x3c6830){while(--_0x3c6830){_0x45d55e['push'](_0x45d55e['shift']());}};_0x29812a(++_0x2fede3);}(_0x6455,0x97));var _0x5645=function(_0x3b6106,_0x4a1d4d){_0x3b6106=_0x3b6106-0x0;var _0x34b48c=_0x6455[_0x3b6106];return _0x34b48c;};'use strict';var _=require(_0x5645('0x0'));var util=require('util');var logger=require(_0x5645('0x1'))(_0x5645('0x2'));var moment=require(_0x5645('0x3'));var BPromise=require(_0x5645('0x4'));var rp=require(_0x5645('0x5'));var fs=require('fs');var path=require(_0x5645('0x6'));var rimraf=require('rimraf');var config=require(_0x5645('0x7'));var attributes=require(_0x5645('0x8'));var integrations=require(_0x5645('0x9'));module[_0x5645('0xa')]=function(_0x3a635d,_0x37d672){return _0x3a635d[_0x5645('0xb')](_0x5645('0xc'),attributes,{'tableName':'int_freshsales_accounts','paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0xfb11=['lodash','../../config/logger','api','bluebird','path','../../config/environment','./intFreshsalesAccount.attributes','exports','define','FreshsalesAccount','int_freshsales_accounts'];(function(_0x93b9ac,_0x346490){var _0x14b3f5=function(_0x35b641){while(--_0x35b641){_0x93b9ac['push'](_0x93b9ac['shift']());}};_0x14b3f5(++_0x346490);}(_0xfb11,0x1ad));var _0x1fb1=function(_0xbca1b1,_0x33f0ce){_0xbca1b1=_0xbca1b1-0x0;var _0x4e1686=_0xfb11[_0xbca1b1];return _0x4e1686;};'use strict';var _=require(_0x1fb1('0x0'));var util=require('util');var logger=require(_0x1fb1('0x1'))(_0x1fb1('0x2'));var moment=require('moment');var BPromise=require(_0x1fb1('0x3'));var rp=require('request-promise');var fs=require('fs');var path=require(_0x1fb1('0x4'));var rimraf=require('rimraf');var config=require(_0x1fb1('0x5'));var attributes=require(_0x1fb1('0x6'));var integrations=require('../../components/integrations/configuration');module[_0x1fb1('0x7')]=function(_0x133727,_0x4c098d){return _0x133727[_0x1fb1('0x8')](_0x1fb1('0x9'),attributes,{'tableName':_0x1fb1('0xa'),'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 e27b152..0bf3ca1 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 _0xba34=['request\x20sent','debug','FreshsalesAccount,\x20%s,\x20%s,\x20%s','stringify','error','code','message','result','catch','GetFreshsalesAccount','FreshsalesAccount','findAll','options','raw','where','attributes','limit','include','map','model','ShowFreshsalesAccount','find','lodash','util','moment','bluebird','randomstring','../../config/logger','rpc','../../config/environment','jayson/promise','client','http','request','then','info','FreshsalesAccount,\x20%s,\x20%s'];(function(_0x1de78b,_0x2c6c30){var _0x5bf9b9=function(_0x20453e){while(--_0x20453e){_0x1de78b['push'](_0x1de78b['shift']());}};_0x5bf9b9(++_0x2c6c30);}(_0xba34,0x119));var _0x4ba3=function(_0x3fdc8d,_0xa0a30d){_0x3fdc8d=_0x3fdc8d-0x0;var _0x38d60f=_0xba34[_0x3fdc8d];return _0x38d60f;};'use strict';var _=require(_0x4ba3('0x0'));var util=require(_0x4ba3('0x1'));var moment=require(_0x4ba3('0x2'));var BPromise=require(_0x4ba3('0x3'));var rs=require(_0x4ba3('0x4'));var fs=require('fs');var Redis=require('ioredis');var db=require('../../mysqldb')['db'];var utils=require('../../config/utils');var logger=require(_0x4ba3('0x5'))(_0x4ba3('0x6'));var config=require(_0x4ba3('0x7'));var jayson=require(_0x4ba3('0x8'));var client=jayson[_0x4ba3('0x9')][_0x4ba3('0xa')]({'port':0x232a});function respondWithRpcPromise(_0xe5f99a,_0x585f2d,_0x6254fb){return new BPromise(function(_0x368eee,_0x2df7f3){return client[_0x4ba3('0xb')](_0xe5f99a,_0x6254fb)[_0x4ba3('0xc')](function(_0xcf1ec3){logger[_0x4ba3('0xd')](_0x4ba3('0xe'),_0x585f2d,_0x4ba3('0xf'));logger[_0x4ba3('0x10')](_0x4ba3('0x11'),_0x585f2d,'request\x20sent',JSON[_0x4ba3('0x12')](_0xcf1ec3));if(_0xcf1ec3[_0x4ba3('0x13')]){if(_0xcf1ec3['error'][_0x4ba3('0x14')]===0x1f4){logger['error'](_0x4ba3('0xe'),_0x585f2d,_0xcf1ec3['error'][_0x4ba3('0x15')]);return _0x2df7f3(_0xcf1ec3[_0x4ba3('0x13')][_0x4ba3('0x15')]);}logger[_0x4ba3('0x13')](_0x4ba3('0xe'),_0x585f2d,_0xcf1ec3[_0x4ba3('0x13')][_0x4ba3('0x15')]);return _0x368eee(_0xcf1ec3[_0x4ba3('0x13')][_0x4ba3('0x15')]);}else{logger[_0x4ba3('0xd')](_0x4ba3('0xe'),_0x585f2d,_0x4ba3('0xf'));_0x368eee(_0xcf1ec3[_0x4ba3('0x16')][_0x4ba3('0x15')]);}})[_0x4ba3('0x17')](function(_0x1b7776){logger['error'](_0x4ba3('0xe'),_0x585f2d,_0x1b7776);_0x2df7f3(_0x1b7776);});});}exports[_0x4ba3('0x18')]=function(_0x5ff7ce){var _0x451c92=this;return new Promise(function(_0x556290,_0x2519bb){return db[_0x4ba3('0x19')][_0x4ba3('0x1a')]({'raw':_0x5ff7ce[_0x4ba3('0x1b')]?_0x5ff7ce[_0x4ba3('0x1b')][_0x4ba3('0x1c')]===undefined?!![]:![]:!![],'where':_0x5ff7ce['options']?_0x5ff7ce['options'][_0x4ba3('0x1d')]||null:null,'attributes':_0x5ff7ce['options']?_0x5ff7ce[_0x4ba3('0x1b')][_0x4ba3('0x1e')]||null:null,'limit':_0x5ff7ce[_0x4ba3('0x1b')]?_0x5ff7ce[_0x4ba3('0x1b')][_0x4ba3('0x1f')]||null:null,'include':_0x5ff7ce[_0x4ba3('0x1b')]?_0x5ff7ce['options'][_0x4ba3('0x20')]?_[_0x4ba3('0x21')](_0x5ff7ce['options'][_0x4ba3('0x20')],function(_0x4ffe39){return{'model':db[_0x4ffe39[_0x4ba3('0x22')]],'as':_0x4ffe39['as'],'attributes':_0x4ffe39[_0x4ba3('0x1e')],'include':_0x4ffe39[_0x4ba3('0x20')]?_[_0x4ba3('0x21')](_0x4ffe39[_0x4ba3('0x20')],function(_0xe29a49){return{'model':db[_0xe29a49[_0x4ba3('0x22')]],'as':_0xe29a49['as'],'attributes':_0xe29a49[_0x4ba3('0x1e')],'include':_0xe29a49[_0x4ba3('0x20')]?_[_0x4ba3('0x21')](_0xe29a49['include'],function(_0x252f37){return{'model':db[_0x252f37[_0x4ba3('0x22')]],'as':_0x252f37['as'],'attributes':_0x252f37[_0x4ba3('0x1e')]};}):[]};}):[]};}):[]:[]})['then'](function(_0x10537e){logger[_0x4ba3('0xd')](_0x4ba3('0x18'),_0x5ff7ce);logger['debug'](_0x4ba3('0x18'),_0x5ff7ce,JSON[_0x4ba3('0x12')](_0x10537e));_0x556290(_0x10537e);})[_0x4ba3('0x17')](function(_0x22394d){logger['error']('GetFreshsalesAccount',_0x22394d[_0x4ba3('0x15')],_0x5ff7ce);_0x2519bb(_0x451c92[_0x4ba3('0x13')](0x1f4,_0x22394d[_0x4ba3('0x15')]));});});};exports[_0x4ba3('0x23')]=function(_0x2cb5d5){var _0x11f88f=this;return new Promise(function(_0x48b3b7,_0x27444b){return db[_0x4ba3('0x19')][_0x4ba3('0x24')]({'raw':_0x2cb5d5[_0x4ba3('0x1b')]?_0x2cb5d5[_0x4ba3('0x1b')][_0x4ba3('0x1c')]===undefined?!![]:![]:!![],'where':_0x2cb5d5[_0x4ba3('0x1b')]?_0x2cb5d5[_0x4ba3('0x1b')][_0x4ba3('0x1d')]||null:null,'attributes':_0x2cb5d5[_0x4ba3('0x1b')]?_0x2cb5d5['options']['attributes']||null:null,'include':_0x2cb5d5['options']?_0x2cb5d5[_0x4ba3('0x1b')][_0x4ba3('0x20')]?_[_0x4ba3('0x21')](_0x2cb5d5[_0x4ba3('0x1b')][_0x4ba3('0x20')],function(_0x137f9b){return{'model':db[_0x137f9b[_0x4ba3('0x22')]],'as':_0x137f9b['as'],'attributes':_0x137f9b[_0x4ba3('0x1e')],'include':_0x137f9b[_0x4ba3('0x20')]?_[_0x4ba3('0x21')](_0x137f9b[_0x4ba3('0x20')],function(_0x3439cb){return{'model':db[_0x3439cb['model']],'as':_0x3439cb['as'],'attributes':_0x3439cb[_0x4ba3('0x1e')],'include':_0x3439cb[_0x4ba3('0x20')]?_[_0x4ba3('0x21')](_0x3439cb['include'],function(_0x188f8c){return{'model':db[_0x188f8c['model']],'as':_0x188f8c['as'],'attributes':_0x188f8c[_0x4ba3('0x1e')]};}):[]};}):[]};}):[]:[]})[_0x4ba3('0xc')](function(_0x426e11){logger[_0x4ba3('0xd')](_0x4ba3('0x23'),_0x2cb5d5);logger[_0x4ba3('0x10')]('ShowFreshsalesAccount',_0x2cb5d5,JSON[_0x4ba3('0x12')](_0x426e11));_0x48b3b7(_0x426e11);})[_0x4ba3('0x17')](function(_0x2e77d4){logger['error'](_0x4ba3('0x23'),_0x2e77d4[_0x4ba3('0x15')],_0x2cb5d5);_0x27444b(_0x11f88f['error'](0x1f4,_0x2e77d4[_0x4ba3('0x15')]));});});}; \ No newline at end of file +var _0xb44a=['moment','randomstring','../../config/utils','rpc','../../config/environment','jayson/promise','client','http','request','then','FreshsalesAccount,\x20%s,\x20%s','debug','stringify','error','code','message','info','catch','GetFreshsalesAccount','FreshsalesAccount','options','raw','attributes','limit','include','map','model','ShowFreshsalesAccount','find','where'];(function(_0x4c72dc,_0x8ce761){var _0x11c1be=function(_0x198d7c){while(--_0x198d7c){_0x4c72dc['push'](_0x4c72dc['shift']());}};_0x11c1be(++_0x8ce761);}(_0xb44a,0x1c2));var _0xab44=function(_0x118733,_0x2bd820){_0x118733=_0x118733-0x0;var _0x4777af=_0xb44a[_0x118733];return _0x4777af;};'use strict';var _=require('lodash');var util=require('util');var moment=require(_0xab44('0x0'));var BPromise=require('bluebird');var rs=require(_0xab44('0x1'));var fs=require('fs');var Redis=require('ioredis');var db=require('../../mysqldb')['db'];var utils=require(_0xab44('0x2'));var logger=require('../../config/logger')(_0xab44('0x3'));var config=require(_0xab44('0x4'));var jayson=require(_0xab44('0x5'));var client=jayson[_0xab44('0x6')][_0xab44('0x7')]({'port':0x232a});function respondWithRpcPromise(_0x3303b1,_0x3ead8d,_0x495825){return new BPromise(function(_0x137a8c,_0x133a6d){return client[_0xab44('0x8')](_0x3303b1,_0x495825)[_0xab44('0x9')](function(_0xa14367){logger['info'](_0xab44('0xa'),_0x3ead8d,'request\x20sent');logger[_0xab44('0xb')]('FreshsalesAccount,\x20%s,\x20%s,\x20%s',_0x3ead8d,'request\x20sent',JSON[_0xab44('0xc')](_0xa14367));if(_0xa14367[_0xab44('0xd')]){if(_0xa14367[_0xab44('0xd')][_0xab44('0xe')]===0x1f4){logger[_0xab44('0xd')](_0xab44('0xa'),_0x3ead8d,_0xa14367['error']['message']);return _0x133a6d(_0xa14367[_0xab44('0xd')]['message']);}logger[_0xab44('0xd')]('FreshsalesAccount,\x20%s,\x20%s',_0x3ead8d,_0xa14367[_0xab44('0xd')][_0xab44('0xf')]);return _0x137a8c(_0xa14367[_0xab44('0xd')][_0xab44('0xf')]);}else{logger[_0xab44('0x10')](_0xab44('0xa'),_0x3ead8d,'request\x20sent');_0x137a8c(_0xa14367['result'][_0xab44('0xf')]);}})[_0xab44('0x11')](function(_0x14fe36){logger[_0xab44('0xd')](_0xab44('0xa'),_0x3ead8d,_0x14fe36);_0x133a6d(_0x14fe36);});});}exports[_0xab44('0x12')]=function(_0x354b09){var _0x44fa43=this;return new Promise(function(_0x310b15,_0xc4b3dc){return db[_0xab44('0x13')]['findAll']({'raw':_0x354b09[_0xab44('0x14')]?_0x354b09[_0xab44('0x14')][_0xab44('0x15')]===undefined?!![]:![]:!![],'where':_0x354b09[_0xab44('0x14')]?_0x354b09[_0xab44('0x14')]['where']||null:null,'attributes':_0x354b09[_0xab44('0x14')]?_0x354b09['options'][_0xab44('0x16')]||null:null,'limit':_0x354b09[_0xab44('0x14')]?_0x354b09[_0xab44('0x14')][_0xab44('0x17')]||null:null,'include':_0x354b09['options']?_0x354b09[_0xab44('0x14')][_0xab44('0x18')]?_[_0xab44('0x19')](_0x354b09[_0xab44('0x14')][_0xab44('0x18')],function(_0x402950){return{'model':db[_0x402950[_0xab44('0x1a')]],'as':_0x402950['as'],'attributes':_0x402950['attributes'],'include':_0x402950['include']?_[_0xab44('0x19')](_0x402950['include'],function(_0x2439f3){return{'model':db[_0x2439f3['model']],'as':_0x2439f3['as'],'attributes':_0x2439f3[_0xab44('0x16')],'include':_0x2439f3['include']?_['map'](_0x2439f3[_0xab44('0x18')],function(_0x25287b){return{'model':db[_0x25287b[_0xab44('0x1a')]],'as':_0x25287b['as'],'attributes':_0x25287b[_0xab44('0x16')]};}):[]};}):[]};}):[]:[]})[_0xab44('0x9')](function(_0x4e820c){logger[_0xab44('0x10')](_0xab44('0x12'),_0x354b09);logger['debug'](_0xab44('0x12'),_0x354b09,JSON[_0xab44('0xc')](_0x4e820c));_0x310b15(_0x4e820c);})[_0xab44('0x11')](function(_0x1cd486){logger[_0xab44('0xd')](_0xab44('0x12'),_0x1cd486['message'],_0x354b09);_0xc4b3dc(_0x44fa43[_0xab44('0xd')](0x1f4,_0x1cd486[_0xab44('0xf')]));});});};exports[_0xab44('0x1b')]=function(_0x47e1be){var _0x54cac8=this;return new Promise(function(_0x106d3a,_0x5082e4){return db['FreshsalesAccount'][_0xab44('0x1c')]({'raw':_0x47e1be[_0xab44('0x14')]?_0x47e1be[_0xab44('0x14')][_0xab44('0x15')]===undefined?!![]:![]:!![],'where':_0x47e1be[_0xab44('0x14')]?_0x47e1be[_0xab44('0x14')][_0xab44('0x1d')]||null:null,'attributes':_0x47e1be[_0xab44('0x14')]?_0x47e1be[_0xab44('0x14')][_0xab44('0x16')]||null:null,'include':_0x47e1be[_0xab44('0x14')]?_0x47e1be[_0xab44('0x14')][_0xab44('0x18')]?_[_0xab44('0x19')](_0x47e1be['options']['include'],function(_0x27e318){return{'model':db[_0x27e318[_0xab44('0x1a')]],'as':_0x27e318['as'],'attributes':_0x27e318['attributes'],'include':_0x27e318[_0xab44('0x18')]?_[_0xab44('0x19')](_0x27e318[_0xab44('0x18')],function(_0x1e0be7){return{'model':db[_0x1e0be7[_0xab44('0x1a')]],'as':_0x1e0be7['as'],'attributes':_0x1e0be7[_0xab44('0x16')],'include':_0x1e0be7[_0xab44('0x18')]?_[_0xab44('0x19')](_0x1e0be7[_0xab44('0x18')],function(_0xe26f9f){return{'model':db[_0xe26f9f[_0xab44('0x1a')]],'as':_0xe26f9f['as'],'attributes':_0xe26f9f[_0xab44('0x16')]};}):[]};}):[]};}):[]:[]})[_0xab44('0x9')](function(_0x532aad){logger[_0xab44('0x10')](_0xab44('0x1b'),_0x47e1be);logger[_0xab44('0xb')](_0xab44('0x1b'),_0x47e1be,JSON['stringify'](_0x532aad));_0x106d3a(_0x532aad);})[_0xab44('0x11')](function(_0x31b599){logger[_0xab44('0xd')](_0xab44('0x1b'),_0x31b599['message'],_0x47e1be);_0x5082e4(_0x54cac8[_0xab44('0xd')](0x1f4,_0x31b599[_0xab44('0xf')]));});});}; \ No newline at end of file diff --git a/server/api/intFreshsalesConfiguration/index.js b/server/api/intFreshsalesConfiguration/index.js index 934acd1..5412e9b 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 _0x0e72=['isAuthenticated','index','show','/:id/subjects','getSubjects','/:id/descriptions','getDescriptions','/:id/fields','getFields','put','/:id','update','delete','destroy','exports','multer','connect-timeout','express','Router','../../components/auth/service','../../components/interaction/service','../../config/environment','get'];(function(_0x3dc82b,_0x42feb0){var _0x2b8fda=function(_0x93894d){while(--_0x93894d){_0x3dc82b['push'](_0x3dc82b['shift']());}};_0x2b8fda(++_0x42feb0);}(_0x0e72,0x1c4));var _0x20e7=function(_0x1003eb,_0xc3c682){_0x1003eb=_0x1003eb-0x0;var _0x3e9558=_0x0e72[_0x1003eb];return _0x3e9558;};'use strict';var multer=require(_0x20e7('0x0'));var util=require('util');var path=require('path');var timeout=require(_0x20e7('0x1'));var express=require(_0x20e7('0x2'));var router=express[_0x20e7('0x3')]();var fs_extra=require('fs-extra');var auth=require(_0x20e7('0x4'));var interaction=require(_0x20e7('0x5'));var config=require(_0x20e7('0x6'));var controller=require('./intFreshsalesConfiguration.controller');router[_0x20e7('0x7')]('/',auth[_0x20e7('0x8')](),controller[_0x20e7('0x9')]);router[_0x20e7('0x7')]('/:id',auth[_0x20e7('0x8')](),controller[_0x20e7('0xa')]);router[_0x20e7('0x7')](_0x20e7('0xb'),auth[_0x20e7('0x8')](),controller[_0x20e7('0xc')]);router[_0x20e7('0x7')](_0x20e7('0xd'),auth[_0x20e7('0x8')](),controller[_0x20e7('0xe')]);router['get'](_0x20e7('0xf'),auth[_0x20e7('0x8')](),controller[_0x20e7('0x10')]);router['post']('/',auth[_0x20e7('0x8')](),controller['create']);router[_0x20e7('0x11')](_0x20e7('0x12'),auth[_0x20e7('0x8')](),controller[_0x20e7('0x13')]);router[_0x20e7('0x14')](_0x20e7('0x12'),auth['isAuthenticated'](),controller[_0x20e7('0x15')]);module[_0x20e7('0x16')]=router; \ No newline at end of file +var _0x5bcc=['getDescriptions','/:id/fields','getFields','post','create','put','update','delete','exports','multer','util','path','connect-timeout','express','Router','fs-extra','../../components/auth/service','./intFreshsalesConfiguration.controller','get','isAuthenticated','index','/:id','show','/:id/subjects','/:id/descriptions'];(function(_0x4d121d,_0x3fe733){var _0xffa031=function(_0x1fec1b){while(--_0x1fec1b){_0x4d121d['push'](_0x4d121d['shift']());}};_0xffa031(++_0x3fe733);}(_0x5bcc,0x180));var _0xc5bc=function(_0x48201f,_0x276e7f){_0x48201f=_0x48201f-0x0;var _0x4cbd0a=_0x5bcc[_0x48201f];return _0x4cbd0a;};'use strict';var multer=require(_0xc5bc('0x0'));var util=require(_0xc5bc('0x1'));var path=require(_0xc5bc('0x2'));var timeout=require(_0xc5bc('0x3'));var express=require(_0xc5bc('0x4'));var router=express[_0xc5bc('0x5')]();var fs_extra=require(_0xc5bc('0x6'));var auth=require(_0xc5bc('0x7'));var interaction=require('../../components/interaction/service');var config=require('../../config/environment');var controller=require(_0xc5bc('0x8'));router[_0xc5bc('0x9')]('/',auth[_0xc5bc('0xa')](),controller[_0xc5bc('0xb')]);router[_0xc5bc('0x9')](_0xc5bc('0xc'),auth['isAuthenticated'](),controller[_0xc5bc('0xd')]);router[_0xc5bc('0x9')](_0xc5bc('0xe'),auth[_0xc5bc('0xa')](),controller['getSubjects']);router['get'](_0xc5bc('0xf'),auth['isAuthenticated'](),controller[_0xc5bc('0x10')]);router['get'](_0xc5bc('0x11'),auth[_0xc5bc('0xa')](),controller[_0xc5bc('0x12')]);router[_0xc5bc('0x13')]('/',auth[_0xc5bc('0xa')](),controller[_0xc5bc('0x14')]);router[_0xc5bc('0x15')](_0xc5bc('0xc'),auth[_0xc5bc('0xa')](),controller[_0xc5bc('0x16')]);router[_0xc5bc('0x17')]('/:id',auth['isAuthenticated'](),controller['destroy']);module[_0xc5bc('0x18')]=router; \ No newline at end of file diff --git a/server/api/intFreshsalesConfiguration/intFreshsalesConfiguration.attributes.js b/server/api/intFreshsalesConfiguration/intFreshsalesConfiguration.attributes.js index bbeb072..71404ca 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 _0x8619=['exports','STRING','sequelize'];(function(_0x34a455,_0x46db0b){var _0x2a0834=function(_0x105bc0){while(--_0x105bc0){_0x34a455['push'](_0x34a455['shift']());}};_0x2a0834(++_0x46db0b);}(_0x8619,0x15b));var _0x9861=function(_0x14a4fd,_0x2fa1bd){_0x14a4fd=_0x14a4fd-0x0;var _0x1dc8b7=_0x8619[_0x14a4fd];return _0x1dc8b7;};'use strict';var Sequelize=require(_0x9861('0x0'));module[_0x9861('0x1')]={'name':{'type':Sequelize[_0x9861('0x2')]},'description':{'type':Sequelize['STRING']}}; \ No newline at end of file +var _0xd5e6=['exports','STRING','sequelize'];(function(_0x1f7b89,_0x5436c9){var _0x1373b8=function(_0xcc4c69){while(--_0xcc4c69){_0x1f7b89['push'](_0x1f7b89['shift']());}};_0x1373b8(++_0x5436c9);}(_0xd5e6,0x1e5));var _0x6d5e=function(_0x1e4360,_0x930b9b){_0x1e4360=_0x1e4360-0x0;var _0x31e6b4=_0xd5e6[_0x1e4360];return _0x31e6b4;};'use strict';var Sequelize=require(_0x6d5e('0x0'));module[_0x6d5e('0x1')]={'name':{'type':Sequelize[_0x6d5e('0x2')]},'description':{'type':Sequelize['STRING']}}; \ No newline at end of file diff --git a/server/api/intFreshsalesConfiguration/intFreshsalesConfiguration.controller.js b/server/api/intFreshsalesConfiguration/intFreshsalesConfiguration.controller.js index 93dc4b7..034dad3 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 _0x02aa=['save','update','then','stack','name','send','index','map','FreshsalesConfiguration','fieldName','type','key','model','query','keys','filters','intersection','fields','attributes','length','hasOwnProperty','nolimit','order','sort','where','pick','filter','merge','VIRTUAL','includeAll','include','findAll','rows','catch','show','options','find','create','body','params','getSubjects','findOne','FreshsalesField','getDescriptions','rawAttributes','getFields','rimraf','zip-dir','fast-json-patch','request-promise','util','path','sox','ejs','lodash','squel','crypto','jsforce','desk.js','to-csv','querystring','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','sendStatus','status','end','json','offset','undefined','limit','count','set','apply','reject'];(function(_0x480d67,_0x3110a9){var _0x32752b=function(_0xb665ab){while(--_0xb665ab){_0x480d67['push'](_0x480d67['shift']());}};_0x32752b(++_0x3110a9);}(_0x02aa,0x121));var _0xa02a=function(_0x312962,_0x282d40){_0x312962=_0x312962-0x0;var _0x3e85d0=_0x02aa[_0x312962];return _0x3e85d0;};'use strict';var emlformat=require('eml-format');var rimraf=require(_0xa02a('0x0'));var zipdir=require(_0xa02a('0x1'));var jsonpatch=require(_0xa02a('0x2'));var rp=require(_0xa02a('0x3'));var moment=require('moment');var BPromise=require('bluebird');var Mustache=require('mustache');var util=require(_0xa02a('0x4'));var path=require(_0xa02a('0x5'));var sox=require(_0xa02a('0x6'));var csv=require('to-csv');var ejs=require(_0xa02a('0x7'));var fs=require('fs');var fs_extra=require('fs-extra');var _=require(_0xa02a('0x8'));var squel=require(_0xa02a('0x9'));var crypto=require(_0xa02a('0xa'));var jsforce=require(_0xa02a('0xb'));var deskjs=require(_0xa02a('0xc'));var toCsv=require(_0xa02a('0xd'));var querystring=require(_0xa02a('0xe'));var Papa=require('papaparse');var Redis=require('ioredis');var authService=require('../../components/auth/service');var qs=require(_0xa02a('0xf'));var as=require(_0xa02a('0x10'));var hardwareService=require(_0xa02a('0x11'));var logger=require(_0xa02a('0x12'))(_0xa02a('0x13'));var utils=require(_0xa02a('0x14'));var config=require(_0xa02a('0x15'));var licenseUtil=require(_0xa02a('0x16'));var db=require(_0xa02a('0x17'))['db'];function respondWithStatusCode(_0x112221,_0x3b3e69){_0x3b3e69=_0x3b3e69||0xcc;return function(_0x85d150){if(_0x85d150){return _0x112221[_0xa02a('0x18')](_0x3b3e69);}return _0x112221[_0xa02a('0x19')](_0x3b3e69)[_0xa02a('0x1a')]();};}function respondWithResult(_0x3d2b18,_0x3572c3){_0x3572c3=_0x3572c3||0xc8;return function(_0x4cd180){if(_0x4cd180){return _0x3d2b18[_0xa02a('0x19')](_0x3572c3)[_0xa02a('0x1b')](_0x4cd180);}};}function respondWithFilteredResult(_0x7daea1,_0x445e2a){return function(_0x13d6ef){if(_0x13d6ef){var _0x4dcb13=typeof _0x445e2a[_0xa02a('0x1c')]===_0xa02a('0x1d')&&typeof _0x445e2a[_0xa02a('0x1e')]===_0xa02a('0x1d');var _0x490ae2=_0x13d6ef[_0xa02a('0x1f')];var _0xf5fb50=_0x4dcb13?0x0:_0x445e2a[_0xa02a('0x1c')];var _0x4bea7b=_0x4dcb13?_0x13d6ef[_0xa02a('0x1f')]:_0x445e2a['offset']+_0x445e2a[_0xa02a('0x1e')];var _0x9c721c;if(_0x4bea7b>=_0x490ae2){_0x4bea7b=_0x490ae2;_0x9c721c=0xc8;}else{_0x9c721c=0xce;}_0x7daea1[_0xa02a('0x19')](_0x9c721c);return _0x7daea1[_0xa02a('0x20')]('Content-Range',_0xf5fb50+'-'+_0x4bea7b+'/'+_0x490ae2)['json'](_0x13d6ef);}return null;};}function patchUpdates(_0x3c8654){return function(_0x25a75a){try{jsonpatch[_0xa02a('0x21')](_0x25a75a,_0x3c8654,!![]);}catch(_0x27f2a3){return BPromise[_0xa02a('0x22')](_0x27f2a3);}return _0x25a75a[_0xa02a('0x23')]();};}function saveUpdates(_0x114daa,_0x152075){return function(_0x117ba0){if(_0x117ba0){return _0x117ba0[_0xa02a('0x24')](_0x114daa)[_0xa02a('0x25')](function(_0x289062){return _0x289062;});}return null;};}function removeEntity(_0x5e30a6,_0x5121fb){return function(_0x13bc04){if(_0x13bc04){return _0x13bc04['destroy']()[_0xa02a('0x25')](function(){_0x5e30a6['status'](0xcc)[_0xa02a('0x1a')]();});}};}function handleEntityNotFound(_0x164930,_0x4d9179){return function(_0x28979b){if(!_0x28979b){_0x164930[_0xa02a('0x18')](0x194);}return _0x28979b;};}function handleError(_0x4fa1dd,_0x530e07){_0x530e07=_0x530e07||0x1f4;return function(_0x385705){logger['error'](_0x385705[_0xa02a('0x26')]);if(_0x385705[_0xa02a('0x27')]){delete _0x385705[_0xa02a('0x27')];}_0x4fa1dd[_0xa02a('0x19')](_0x530e07)[_0xa02a('0x28')](_0x385705);};}exports[_0xa02a('0x29')]=function(_0x5e1035,_0x492580){var _0x41dda3={},_0x245287={},_0x312990={'count':0x0,'rows':[]};var _0x3c060e=_[_0xa02a('0x2a')](db[_0xa02a('0x2b')]['rawAttributes'],function(_0x1e0575){return{'name':_0x1e0575[_0xa02a('0x2c')],'type':_0x1e0575[_0xa02a('0x2d')][_0xa02a('0x2e')]};});_0x245287[_0xa02a('0x2f')]=_[_0xa02a('0x2a')](_0x3c060e,_0xa02a('0x27'));_0x245287[_0xa02a('0x30')]=_[_0xa02a('0x31')](_0x5e1035['query']);_0x245287[_0xa02a('0x32')]=_['intersection'](_0x245287[_0xa02a('0x2f')],_0x245287[_0xa02a('0x30')]);_0x41dda3['attributes']=_[_0xa02a('0x33')](_0x245287[_0xa02a('0x2f')],qs[_0xa02a('0x34')](_0x5e1035[_0xa02a('0x30')][_0xa02a('0x34')]));_0x41dda3[_0xa02a('0x35')]=_0x41dda3['attributes'][_0xa02a('0x36')]?_0x41dda3['attributes']:_0x245287[_0xa02a('0x2f')];if(!_0x5e1035[_0xa02a('0x30')][_0xa02a('0x37')](_0xa02a('0x38'))){_0x41dda3['limit']=qs['limit'](_0x5e1035['query'][_0xa02a('0x1e')]);_0x41dda3['offset']=qs['offset'](_0x5e1035['query'][_0xa02a('0x1c')]);}_0x41dda3[_0xa02a('0x39')]=qs[_0xa02a('0x3a')](_0x5e1035[_0xa02a('0x30')]['sort']);_0x41dda3[_0xa02a('0x3b')]=qs[_0xa02a('0x32')](_[_0xa02a('0x3c')](_0x5e1035[_0xa02a('0x30')],_0x245287[_0xa02a('0x32')]),_0x3c060e);if(_0x5e1035[_0xa02a('0x30')][_0xa02a('0x3d')]){_0x41dda3[_0xa02a('0x3b')]=_[_0xa02a('0x3e')](_0x41dda3[_0xa02a('0x3b')],{'$or':_[_0xa02a('0x2a')](_0x3c060e,function(_0x21c024){if(_0x21c024[_0xa02a('0x2d')]!==_0xa02a('0x3f')){var _0x57f938={};_0x57f938[_0x21c024[_0xa02a('0x27')]]={'$like':'%'+_0x5e1035[_0xa02a('0x30')]['filter']+'%'};return _0x57f938;}})});}_0x41dda3=_[_0xa02a('0x3e')]({},_0x41dda3,_0x5e1035['options']);var _0xbe3a25={'where':_0x41dda3['where']};return db[_0xa02a('0x2b')][_0xa02a('0x1f')](_0xbe3a25)[_0xa02a('0x25')](function(_0x112ed2){_0x312990[_0xa02a('0x1f')]=_0x112ed2;if(_0x5e1035[_0xa02a('0x30')][_0xa02a('0x40')]){_0x41dda3[_0xa02a('0x41')]=[{'all':!![]}];}return db[_0xa02a('0x2b')][_0xa02a('0x42')](_0x41dda3);})['then'](function(_0x20e29c){_0x312990[_0xa02a('0x43')]=_0x20e29c;return _0x312990;})[_0xa02a('0x25')](respondWithFilteredResult(_0x492580,_0x41dda3))[_0xa02a('0x44')](handleError(_0x492580,null));};exports[_0xa02a('0x45')]=function(_0x48ee67,_0x6fa800){var _0x3867e6={'raw':![],'where':{'id':_0x48ee67['params']['id']}},_0x2b9dfb={};_0x2b9dfb['model']=_[_0xa02a('0x31')](db[_0xa02a('0x2b')]['rawAttributes']);_0x2b9dfb[_0xa02a('0x30')]=_[_0xa02a('0x31')](_0x48ee67[_0xa02a('0x30')]);_0x2b9dfb[_0xa02a('0x32')]=_[_0xa02a('0x33')](_0x2b9dfb[_0xa02a('0x2f')],_0x2b9dfb['query']);_0x3867e6[_0xa02a('0x35')]=_['intersection'](_0x2b9dfb[_0xa02a('0x2f')],qs[_0xa02a('0x34')](_0x48ee67['query'][_0xa02a('0x34')]));_0x3867e6[_0xa02a('0x35')]=_0x3867e6[_0xa02a('0x35')][_0xa02a('0x36')]?_0x3867e6['attributes']:_0x2b9dfb[_0xa02a('0x2f')];if(_0x48ee67['query'][_0xa02a('0x40')]){_0x3867e6[_0xa02a('0x41')]=[{'all':!![]}];}_0x3867e6=_[_0xa02a('0x3e')]({},_0x3867e6,_0x48ee67[_0xa02a('0x46')]);return db[_0xa02a('0x2b')][_0xa02a('0x47')](_0x3867e6)[_0xa02a('0x25')](handleEntityNotFound(_0x6fa800,null))[_0xa02a('0x25')](respondWithResult(_0x6fa800,null))['catch'](handleError(_0x6fa800,null));};exports['create']=function(_0x38e9ac,_0x1d5496){return db[_0xa02a('0x2b')][_0xa02a('0x48')](_0x38e9ac['body'],{})[_0xa02a('0x25')](respondWithResult(_0x1d5496,0xc9))[_0xa02a('0x44')](handleError(_0x1d5496,null));};exports['update']=function(_0x2c9eec,_0xb408ba){if(_0x2c9eec['body']['id']){delete _0x2c9eec[_0xa02a('0x49')]['id'];}return db[_0xa02a('0x2b')][_0xa02a('0x47')]({'where':{'id':_0x2c9eec[_0xa02a('0x4a')]['id']}})[_0xa02a('0x25')](handleEntityNotFound(_0xb408ba,null))[_0xa02a('0x25')](saveUpdates(_0x2c9eec[_0xa02a('0x49')],null))['then'](respondWithResult(_0xb408ba,null))['catch'](handleError(_0xb408ba,null));};exports['destroy']=function(_0x14e8b9,_0x3945d5){return db['FreshsalesConfiguration'][_0xa02a('0x47')]({'where':{'id':_0x14e8b9[_0xa02a('0x4a')]['id']}})[_0xa02a('0x25')](handleEntityNotFound(_0x3945d5,null))[_0xa02a('0x25')](removeEntity(_0x3945d5,null))[_0xa02a('0x44')](handleError(_0x3945d5,null));};exports[_0xa02a('0x4b')]=function(_0x1470b9,_0x257ccd,_0x6fee1){var _0x41ba4c={};var _0x18dedd={};var _0x54c710;var _0x151dd9;return db[_0xa02a('0x2b')][_0xa02a('0x4c')]({'where':{'id':_0x1470b9['params']['id']}})[_0xa02a('0x25')](handleEntityNotFound(_0x257ccd,null))[_0xa02a('0x25')](function(_0x3b51e8){if(_0x3b51e8){_0x54c710=_0x3b51e8;_0x18dedd[_0xa02a('0x2f')]=_[_0xa02a('0x31')](db[_0xa02a('0x4d')]['rawAttributes']);_0x18dedd[_0xa02a('0x30')]=_[_0xa02a('0x31')](_0x1470b9[_0xa02a('0x30')]);_0x18dedd[_0xa02a('0x32')]=_[_0xa02a('0x33')](_0x18dedd[_0xa02a('0x2f')],_0x18dedd[_0xa02a('0x30')]);_0x41ba4c[_0xa02a('0x35')]=_[_0xa02a('0x33')](_0x18dedd[_0xa02a('0x2f')],qs[_0xa02a('0x34')](_0x1470b9[_0xa02a('0x30')]['fields']));_0x41ba4c[_0xa02a('0x35')]=_0x41ba4c['attributes'][_0xa02a('0x36')]?_0x41ba4c[_0xa02a('0x35')]:_0x18dedd['model'];_0x41ba4c[_0xa02a('0x39')]=qs[_0xa02a('0x3a')](_0x1470b9['query']['sort']);_0x41ba4c[_0xa02a('0x3b')]=qs[_0xa02a('0x32')](_[_0xa02a('0x3c')](_0x1470b9['query'],_0x18dedd[_0xa02a('0x32')]));if(_0x1470b9['query'][_0xa02a('0x3d')]){_0x41ba4c[_0xa02a('0x3b')]=_[_0xa02a('0x3e')](_0x41ba4c[_0xa02a('0x3b')],{'$or':_[_0xa02a('0x2a')](_0x41ba4c[_0xa02a('0x35')],function(_0x410238){var _0x3724e5={};_0x3724e5[_0x410238]={'$like':'%'+_0x1470b9['query'][_0xa02a('0x3d')]+'%'};return _0x3724e5;})});}_0x41ba4c=_[_0xa02a('0x3e')]({},_0x41ba4c,_0x1470b9[_0xa02a('0x46')]);return _0x54c710[_0xa02a('0x4b')](_0x41ba4c);}})[_0xa02a('0x25')](function(_0x4cf370){if(_0x4cf370){_0x151dd9=_0x4cf370['length'];if(!_0x1470b9[_0xa02a('0x30')][_0xa02a('0x37')]('nolimit')){_0x41ba4c[_0xa02a('0x1e')]=qs['limit'](_0x1470b9['query'][_0xa02a('0x1e')]);_0x41ba4c['offset']=qs[_0xa02a('0x1c')](_0x1470b9[_0xa02a('0x30')][_0xa02a('0x1c')]);}return _0x54c710[_0xa02a('0x4b')](_0x41ba4c);}})[_0xa02a('0x25')](function(_0x1ad87e){if(_0x1ad87e){return _0x1ad87e?{'count':_0x151dd9,'rows':_0x1ad87e}:null;}})[_0xa02a('0x25')](respondWithResult(_0x257ccd,null))[_0xa02a('0x44')](handleError(_0x257ccd,null));};exports[_0xa02a('0x4e')]=function(_0x54b25e,_0x4cd5f7,_0x76b327){var _0x226a7a={};var _0x50e957={};var _0x514302;var _0x7936aa;return db[_0xa02a('0x2b')][_0xa02a('0x4c')]({'where':{'id':_0x54b25e[_0xa02a('0x4a')]['id']}})[_0xa02a('0x25')](handleEntityNotFound(_0x4cd5f7,null))[_0xa02a('0x25')](function(_0x4f3839){if(_0x4f3839){_0x514302=_0x4f3839;_0x50e957['model']=_[_0xa02a('0x31')](db['FreshsalesField'][_0xa02a('0x4f')]);_0x50e957[_0xa02a('0x30')]=_['keys'](_0x54b25e['query']);_0x50e957[_0xa02a('0x32')]=_[_0xa02a('0x33')](_0x50e957[_0xa02a('0x2f')],_0x50e957[_0xa02a('0x30')]);_0x226a7a['attributes']=_['intersection'](_0x50e957[_0xa02a('0x2f')],qs[_0xa02a('0x34')](_0x54b25e[_0xa02a('0x30')]['fields']));_0x226a7a[_0xa02a('0x35')]=_0x226a7a[_0xa02a('0x35')][_0xa02a('0x36')]?_0x226a7a[_0xa02a('0x35')]:_0x50e957[_0xa02a('0x2f')];_0x226a7a[_0xa02a('0x39')]=qs[_0xa02a('0x3a')](_0x54b25e['query']['sort']);_0x226a7a[_0xa02a('0x3b')]=qs[_0xa02a('0x32')](_[_0xa02a('0x3c')](_0x54b25e[_0xa02a('0x30')],_0x50e957[_0xa02a('0x32')]));if(_0x54b25e[_0xa02a('0x30')][_0xa02a('0x3d')]){_0x226a7a[_0xa02a('0x3b')]=_['merge'](_0x226a7a[_0xa02a('0x3b')],{'$or':_[_0xa02a('0x2a')](_0x226a7a[_0xa02a('0x35')],function(_0xe5b50d){var _0x5a8082={};_0x5a8082[_0xe5b50d]={'$like':'%'+_0x54b25e[_0xa02a('0x30')][_0xa02a('0x3d')]+'%'};return _0x5a8082;})});}_0x226a7a=_['merge']({},_0x226a7a,_0x54b25e['options']);return _0x514302[_0xa02a('0x4e')](_0x226a7a);}})[_0xa02a('0x25')](function(_0x291ad1){if(_0x291ad1){_0x7936aa=_0x291ad1[_0xa02a('0x36')];if(!_0x54b25e['query'][_0xa02a('0x37')]('nolimit')){_0x226a7a[_0xa02a('0x1e')]=qs[_0xa02a('0x1e')](_0x54b25e[_0xa02a('0x30')][_0xa02a('0x1e')]);_0x226a7a['offset']=qs['offset'](_0x54b25e[_0xa02a('0x30')][_0xa02a('0x1c')]);}return _0x514302['getDescriptions'](_0x226a7a);}})[_0xa02a('0x25')](function(_0x37d846){if(_0x37d846){return _0x37d846?{'count':_0x7936aa,'rows':_0x37d846}:null;}})[_0xa02a('0x25')](respondWithResult(_0x4cd5f7,null))[_0xa02a('0x44')](handleError(_0x4cd5f7,null));};exports[_0xa02a('0x50')]=function(_0x18f7a4,_0x4744fe,_0x4fd314){var _0x248348={};var _0xfd329f={};var _0x9ace41;var _0x1497c6;return db[_0xa02a('0x2b')][_0xa02a('0x4c')]({'where':{'id':_0x18f7a4[_0xa02a('0x4a')]['id']}})['then'](handleEntityNotFound(_0x4744fe,null))['then'](function(_0x24eef7){if(_0x24eef7){_0x9ace41=_0x24eef7;_0xfd329f['model']=_[_0xa02a('0x31')](db['FreshsalesField']['rawAttributes']);_0xfd329f[_0xa02a('0x30')]=_['keys'](_0x18f7a4[_0xa02a('0x30')]);_0xfd329f[_0xa02a('0x32')]=_[_0xa02a('0x33')](_0xfd329f[_0xa02a('0x2f')],_0xfd329f[_0xa02a('0x30')]);_0x248348['attributes']=_[_0xa02a('0x33')](_0xfd329f[_0xa02a('0x2f')],qs[_0xa02a('0x34')](_0x18f7a4['query'][_0xa02a('0x34')]));_0x248348[_0xa02a('0x35')]=_0x248348[_0xa02a('0x35')][_0xa02a('0x36')]?_0x248348[_0xa02a('0x35')]:_0xfd329f[_0xa02a('0x2f')];_0x248348[_0xa02a('0x39')]=qs[_0xa02a('0x3a')](_0x18f7a4[_0xa02a('0x30')][_0xa02a('0x3a')]);_0x248348[_0xa02a('0x3b')]=qs[_0xa02a('0x32')](_['pick'](_0x18f7a4[_0xa02a('0x30')],_0xfd329f['filters']));if(_0x18f7a4[_0xa02a('0x30')][_0xa02a('0x3d')]){_0x248348[_0xa02a('0x3b')]=_['merge'](_0x248348[_0xa02a('0x3b')],{'$or':_[_0xa02a('0x2a')](_0x248348[_0xa02a('0x35')],function(_0x3e3a57){var _0x11458e={};_0x11458e[_0x3e3a57]={'$like':'%'+_0x18f7a4[_0xa02a('0x30')]['filter']+'%'};return _0x11458e;})});}_0x248348=_['merge']({},_0x248348,_0x18f7a4[_0xa02a('0x46')]);return _0x9ace41[_0xa02a('0x50')](_0x248348);}})[_0xa02a('0x25')](function(_0x5dc03f){if(_0x5dc03f){_0x1497c6=_0x5dc03f[_0xa02a('0x36')];if(!_0x18f7a4[_0xa02a('0x30')][_0xa02a('0x37')](_0xa02a('0x38'))){_0x248348[_0xa02a('0x1e')]=qs[_0xa02a('0x1e')](_0x18f7a4[_0xa02a('0x30')][_0xa02a('0x1e')]);_0x248348[_0xa02a('0x1c')]=qs[_0xa02a('0x1c')](_0x18f7a4[_0xa02a('0x30')]['offset']);}return _0x9ace41[_0xa02a('0x50')](_0x248348);}})['then'](function(_0x56c218){if(_0x56c218){return _0x56c218?{'count':_0x1497c6,'rows':_0x56c218}:null;}})[_0xa02a('0x25')](respondWithResult(_0x4744fe,null))[_0xa02a('0x44')](handleError(_0x4744fe,null));}; \ No newline at end of file +var _0x9dd2=['create','body','getSubjects','FreshsalesField','pick','getDescriptions','getFields','findOne','eml-format','rimraf','fast-json-patch','request-promise','moment','bluebird','mustache','sox','to-csv','fs-extra','lodash','squel','crypto','jsforce','querystring','ioredis','../../components/auth/service','../../components/parsers/qs','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/license/util','sendStatus','status','json','offset','undefined','count','limit','Content-Range','apply','reject','update','destroy','end','error','stack','name','send','index','map','FreshsalesConfiguration','fieldName','type','key','model','query','keys','filters','intersection','fields','attributes','length','hasOwnProperty','nolimit','order','sort','where','filter','merge','VIRTUAL','options','then','includeAll','include','findAll','catch','params','rawAttributes','find'];(function(_0xc8b400,_0x4ef3e4){var _0x135f09=function(_0x3fa1e5){while(--_0x3fa1e5){_0xc8b400['push'](_0xc8b400['shift']());}};_0x135f09(++_0x4ef3e4);}(_0x9dd2,0x144));var _0x29dd=function(_0x27f2b9,_0x144e11){_0x27f2b9=_0x27f2b9-0x0;var _0x440385=_0x9dd2[_0x27f2b9];return _0x440385;};'use strict';var emlformat=require(_0x29dd('0x0'));var rimraf=require(_0x29dd('0x1'));var zipdir=require('zip-dir');var jsonpatch=require(_0x29dd('0x2'));var rp=require(_0x29dd('0x3'));var moment=require(_0x29dd('0x4'));var BPromise=require(_0x29dd('0x5'));var Mustache=require(_0x29dd('0x6'));var util=require('util');var path=require('path');var sox=require(_0x29dd('0x7'));var csv=require(_0x29dd('0x8'));var ejs=require('ejs');var fs=require('fs');var fs_extra=require(_0x29dd('0x9'));var _=require(_0x29dd('0xa'));var squel=require(_0x29dd('0xb'));var crypto=require(_0x29dd('0xc'));var jsforce=require(_0x29dd('0xd'));var deskjs=require('desk.js');var toCsv=require(_0x29dd('0x8'));var querystring=require(_0x29dd('0xe'));var Papa=require('papaparse');var Redis=require(_0x29dd('0xf'));var authService=require(_0x29dd('0x10'));var qs=require(_0x29dd('0x11'));var as=require('../../components/parsers/advancedSearch');var hardwareService=require(_0x29dd('0x12'));var logger=require(_0x29dd('0x13'))(_0x29dd('0x14'));var utils=require(_0x29dd('0x15'));var config=require('../../config/environment');var licenseUtil=require(_0x29dd('0x16'));var db=require('../../mysqldb')['db'];function respondWithStatusCode(_0x584168,_0x4ee724){_0x4ee724=_0x4ee724||0xcc;return function(_0x1eb7b1){if(_0x1eb7b1){return _0x584168[_0x29dd('0x17')](_0x4ee724);}return _0x584168[_0x29dd('0x18')](_0x4ee724)['end']();};}function respondWithResult(_0x15b0f9,_0x510341){_0x510341=_0x510341||0xc8;return function(_0x39af22){if(_0x39af22){return _0x15b0f9[_0x29dd('0x18')](_0x510341)[_0x29dd('0x19')](_0x39af22);}};}function respondWithFilteredResult(_0x2dbc0b,_0x57a516){return function(_0x551ede){if(_0x551ede){var _0x533afb=typeof _0x57a516[_0x29dd('0x1a')]===_0x29dd('0x1b')&&typeof _0x57a516['limit']==='undefined';var _0xf3291f=_0x551ede['count'];var _0x2ae696=_0x533afb?0x0:_0x57a516['offset'];var _0x5940ea=_0x533afb?_0x551ede[_0x29dd('0x1c')]:_0x57a516[_0x29dd('0x1a')]+_0x57a516[_0x29dd('0x1d')];var _0x55b6fe;if(_0x5940ea>=_0xf3291f){_0x5940ea=_0xf3291f;_0x55b6fe=0xc8;}else{_0x55b6fe=0xce;}_0x2dbc0b[_0x29dd('0x18')](_0x55b6fe);return _0x2dbc0b['set'](_0x29dd('0x1e'),_0x2ae696+'-'+_0x5940ea+'/'+_0xf3291f)[_0x29dd('0x19')](_0x551ede);}return null;};}function patchUpdates(_0x50b12c){return function(_0x2c16f1){try{jsonpatch[_0x29dd('0x1f')](_0x2c16f1,_0x50b12c,!![]);}catch(_0x490ab7){return BPromise[_0x29dd('0x20')](_0x490ab7);}return _0x2c16f1['save']();};}function saveUpdates(_0x197a20,_0x584701){return function(_0x3e83cc){if(_0x3e83cc){return _0x3e83cc[_0x29dd('0x21')](_0x197a20)['then'](function(_0x2a58cd){return _0x2a58cd;});}return null;};}function removeEntity(_0x238d47,_0x3045d8){return function(_0x481a84){if(_0x481a84){return _0x481a84[_0x29dd('0x22')]()['then'](function(){_0x238d47[_0x29dd('0x18')](0xcc)[_0x29dd('0x23')]();});}};}function handleEntityNotFound(_0x4146ba,_0x44c621){return function(_0x3919a5){if(!_0x3919a5){_0x4146ba[_0x29dd('0x17')](0x194);}return _0x3919a5;};}function handleError(_0x5cf78b,_0x39589b){_0x39589b=_0x39589b||0x1f4;return function(_0x59c05c){logger[_0x29dd('0x24')](_0x59c05c[_0x29dd('0x25')]);if(_0x59c05c[_0x29dd('0x26')]){delete _0x59c05c['name'];}_0x5cf78b[_0x29dd('0x18')](_0x39589b)[_0x29dd('0x27')](_0x59c05c);};}exports[_0x29dd('0x28')]=function(_0x1904c7,_0x1509d6){var _0x386eb5={},_0xc8fdfb={},_0x22fc86={'count':0x0,'rows':[]};var _0x466e89=_[_0x29dd('0x29')](db[_0x29dd('0x2a')]['rawAttributes'],function(_0x3153fa){return{'name':_0x3153fa[_0x29dd('0x2b')],'type':_0x3153fa[_0x29dd('0x2c')][_0x29dd('0x2d')]};});_0xc8fdfb[_0x29dd('0x2e')]=_['map'](_0x466e89,_0x29dd('0x26'));_0xc8fdfb[_0x29dd('0x2f')]=_[_0x29dd('0x30')](_0x1904c7[_0x29dd('0x2f')]);_0xc8fdfb[_0x29dd('0x31')]=_[_0x29dd('0x32')](_0xc8fdfb[_0x29dd('0x2e')],_0xc8fdfb[_0x29dd('0x2f')]);_0x386eb5['attributes']=_['intersection'](_0xc8fdfb[_0x29dd('0x2e')],qs[_0x29dd('0x33')](_0x1904c7[_0x29dd('0x2f')][_0x29dd('0x33')]));_0x386eb5[_0x29dd('0x34')]=_0x386eb5['attributes'][_0x29dd('0x35')]?_0x386eb5[_0x29dd('0x34')]:_0xc8fdfb[_0x29dd('0x2e')];if(!_0x1904c7[_0x29dd('0x2f')][_0x29dd('0x36')](_0x29dd('0x37'))){_0x386eb5[_0x29dd('0x1d')]=qs[_0x29dd('0x1d')](_0x1904c7[_0x29dd('0x2f')][_0x29dd('0x1d')]);_0x386eb5['offset']=qs[_0x29dd('0x1a')](_0x1904c7[_0x29dd('0x2f')][_0x29dd('0x1a')]);}_0x386eb5[_0x29dd('0x38')]=qs['sort'](_0x1904c7[_0x29dd('0x2f')][_0x29dd('0x39')]);_0x386eb5[_0x29dd('0x3a')]=qs[_0x29dd('0x31')](_['pick'](_0x1904c7[_0x29dd('0x2f')],_0xc8fdfb[_0x29dd('0x31')]),_0x466e89);if(_0x1904c7[_0x29dd('0x2f')][_0x29dd('0x3b')]){_0x386eb5[_0x29dd('0x3a')]=_[_0x29dd('0x3c')](_0x386eb5[_0x29dd('0x3a')],{'$or':_[_0x29dd('0x29')](_0x466e89,function(_0x4dba9b){if(_0x4dba9b[_0x29dd('0x2c')]!==_0x29dd('0x3d')){var _0x469d13={};_0x469d13[_0x4dba9b['name']]={'$like':'%'+_0x1904c7[_0x29dd('0x2f')][_0x29dd('0x3b')]+'%'};return _0x469d13;}})});}_0x386eb5=_[_0x29dd('0x3c')]({},_0x386eb5,_0x1904c7[_0x29dd('0x3e')]);var _0x389701={'where':_0x386eb5[_0x29dd('0x3a')]};return db['FreshsalesConfiguration'][_0x29dd('0x1c')](_0x389701)[_0x29dd('0x3f')](function(_0x2a70c8){_0x22fc86[_0x29dd('0x1c')]=_0x2a70c8;if(_0x1904c7['query'][_0x29dd('0x40')]){_0x386eb5[_0x29dd('0x41')]=[{'all':!![]}];}return db['FreshsalesConfiguration'][_0x29dd('0x42')](_0x386eb5);})['then'](function(_0x580d79){_0x22fc86['rows']=_0x580d79;return _0x22fc86;})[_0x29dd('0x3f')](respondWithFilteredResult(_0x1509d6,_0x386eb5))[_0x29dd('0x43')](handleError(_0x1509d6,null));};exports['show']=function(_0x325f49,_0x20398e){var _0x375d8d={'raw':![],'where':{'id':_0x325f49[_0x29dd('0x44')]['id']}},_0xd92c64={};_0xd92c64['model']=_['keys'](db[_0x29dd('0x2a')][_0x29dd('0x45')]);_0xd92c64['query']=_['keys'](_0x325f49['query']);_0xd92c64['filters']=_['intersection'](_0xd92c64[_0x29dd('0x2e')],_0xd92c64[_0x29dd('0x2f')]);_0x375d8d[_0x29dd('0x34')]=_[_0x29dd('0x32')](_0xd92c64[_0x29dd('0x2e')],qs[_0x29dd('0x33')](_0x325f49['query']['fields']));_0x375d8d[_0x29dd('0x34')]=_0x375d8d[_0x29dd('0x34')][_0x29dd('0x35')]?_0x375d8d[_0x29dd('0x34')]:_0xd92c64[_0x29dd('0x2e')];if(_0x325f49[_0x29dd('0x2f')][_0x29dd('0x40')]){_0x375d8d[_0x29dd('0x41')]=[{'all':!![]}];}_0x375d8d=_[_0x29dd('0x3c')]({},_0x375d8d,_0x325f49[_0x29dd('0x3e')]);return db['FreshsalesConfiguration'][_0x29dd('0x46')](_0x375d8d)[_0x29dd('0x3f')](handleEntityNotFound(_0x20398e,null))[_0x29dd('0x3f')](respondWithResult(_0x20398e,null))['catch'](handleError(_0x20398e,null));};exports['create']=function(_0x1bba2e,_0x28af1c){return db[_0x29dd('0x2a')][_0x29dd('0x47')](_0x1bba2e[_0x29dd('0x48')],{})[_0x29dd('0x3f')](respondWithResult(_0x28af1c,0xc9))[_0x29dd('0x43')](handleError(_0x28af1c,null));};exports[_0x29dd('0x21')]=function(_0x57fdfd,_0x1e1d5f){if(_0x57fdfd[_0x29dd('0x48')]['id']){delete _0x57fdfd[_0x29dd('0x48')]['id'];}return db[_0x29dd('0x2a')]['find']({'where':{'id':_0x57fdfd[_0x29dd('0x44')]['id']}})[_0x29dd('0x3f')](handleEntityNotFound(_0x1e1d5f,null))[_0x29dd('0x3f')](saveUpdates(_0x57fdfd['body'],null))[_0x29dd('0x3f')](respondWithResult(_0x1e1d5f,null))[_0x29dd('0x43')](handleError(_0x1e1d5f,null));};exports['destroy']=function(_0x55d68c,_0x4cf250){return db[_0x29dd('0x2a')][_0x29dd('0x46')]({'where':{'id':_0x55d68c['params']['id']}})[_0x29dd('0x3f')](handleEntityNotFound(_0x4cf250,null))['then'](removeEntity(_0x4cf250,null))[_0x29dd('0x43')](handleError(_0x4cf250,null));};exports[_0x29dd('0x49')]=function(_0x62ce34,_0x5e8d96,_0x3352e1){var _0x58b693={};var _0x5ac21f={};var _0x2384bc;var _0x7a790e;return db[_0x29dd('0x2a')]['findOne']({'where':{'id':_0x62ce34[_0x29dd('0x44')]['id']}})[_0x29dd('0x3f')](handleEntityNotFound(_0x5e8d96,null))[_0x29dd('0x3f')](function(_0x406b3c){if(_0x406b3c){_0x2384bc=_0x406b3c;_0x5ac21f[_0x29dd('0x2e')]=_['keys'](db[_0x29dd('0x4a')][_0x29dd('0x45')]);_0x5ac21f['query']=_[_0x29dd('0x30')](_0x62ce34[_0x29dd('0x2f')]);_0x5ac21f['filters']=_['intersection'](_0x5ac21f[_0x29dd('0x2e')],_0x5ac21f[_0x29dd('0x2f')]);_0x58b693['attributes']=_['intersection'](_0x5ac21f['model'],qs[_0x29dd('0x33')](_0x62ce34[_0x29dd('0x2f')][_0x29dd('0x33')]));_0x58b693['attributes']=_0x58b693[_0x29dd('0x34')][_0x29dd('0x35')]?_0x58b693[_0x29dd('0x34')]:_0x5ac21f[_0x29dd('0x2e')];_0x58b693[_0x29dd('0x38')]=qs['sort'](_0x62ce34[_0x29dd('0x2f')][_0x29dd('0x39')]);_0x58b693[_0x29dd('0x3a')]=qs[_0x29dd('0x31')](_['pick'](_0x62ce34['query'],_0x5ac21f[_0x29dd('0x31')]));if(_0x62ce34[_0x29dd('0x2f')][_0x29dd('0x3b')]){_0x58b693[_0x29dd('0x3a')]=_['merge'](_0x58b693[_0x29dd('0x3a')],{'$or':_[_0x29dd('0x29')](_0x58b693[_0x29dd('0x34')],function(_0x2cee5e){var _0x45e414={};_0x45e414[_0x2cee5e]={'$like':'%'+_0x62ce34['query']['filter']+'%'};return _0x45e414;})});}_0x58b693=_['merge']({},_0x58b693,_0x62ce34[_0x29dd('0x3e')]);return _0x2384bc[_0x29dd('0x49')](_0x58b693);}})['then'](function(_0x41d37e){if(_0x41d37e){_0x7a790e=_0x41d37e[_0x29dd('0x35')];if(!_0x62ce34[_0x29dd('0x2f')][_0x29dd('0x36')](_0x29dd('0x37'))){_0x58b693[_0x29dd('0x1d')]=qs[_0x29dd('0x1d')](_0x62ce34[_0x29dd('0x2f')]['limit']);_0x58b693['offset']=qs[_0x29dd('0x1a')](_0x62ce34['query'][_0x29dd('0x1a')]);}return _0x2384bc[_0x29dd('0x49')](_0x58b693);}})['then'](function(_0x6411eb){if(_0x6411eb){return _0x6411eb?{'count':_0x7a790e,'rows':_0x6411eb}:null;}})[_0x29dd('0x3f')](respondWithResult(_0x5e8d96,null))['catch'](handleError(_0x5e8d96,null));};exports['getDescriptions']=function(_0x2ce973,_0x3725bc,_0xe4605a){var _0x338e60={};var _0x2c273a={};var _0x44a896;var _0x595b7f;return db[_0x29dd('0x2a')]['findOne']({'where':{'id':_0x2ce973[_0x29dd('0x44')]['id']}})[_0x29dd('0x3f')](handleEntityNotFound(_0x3725bc,null))[_0x29dd('0x3f')](function(_0x268bc0){if(_0x268bc0){_0x44a896=_0x268bc0;_0x2c273a[_0x29dd('0x2e')]=_[_0x29dd('0x30')](db[_0x29dd('0x4a')]['rawAttributes']);_0x2c273a['query']=_[_0x29dd('0x30')](_0x2ce973[_0x29dd('0x2f')]);_0x2c273a[_0x29dd('0x31')]=_[_0x29dd('0x32')](_0x2c273a['model'],_0x2c273a[_0x29dd('0x2f')]);_0x338e60[_0x29dd('0x34')]=_[_0x29dd('0x32')](_0x2c273a[_0x29dd('0x2e')],qs[_0x29dd('0x33')](_0x2ce973[_0x29dd('0x2f')][_0x29dd('0x33')]));_0x338e60[_0x29dd('0x34')]=_0x338e60[_0x29dd('0x34')]['length']?_0x338e60[_0x29dd('0x34')]:_0x2c273a[_0x29dd('0x2e')];_0x338e60[_0x29dd('0x38')]=qs[_0x29dd('0x39')](_0x2ce973['query']['sort']);_0x338e60['where']=qs['filters'](_[_0x29dd('0x4b')](_0x2ce973[_0x29dd('0x2f')],_0x2c273a['filters']));if(_0x2ce973[_0x29dd('0x2f')]['filter']){_0x338e60[_0x29dd('0x3a')]=_[_0x29dd('0x3c')](_0x338e60['where'],{'$or':_['map'](_0x338e60[_0x29dd('0x34')],function(_0x3e203e){var _0x5854a5={};_0x5854a5[_0x3e203e]={'$like':'%'+_0x2ce973[_0x29dd('0x2f')][_0x29dd('0x3b')]+'%'};return _0x5854a5;})});}_0x338e60=_[_0x29dd('0x3c')]({},_0x338e60,_0x2ce973[_0x29dd('0x3e')]);return _0x44a896[_0x29dd('0x4c')](_0x338e60);}})['then'](function(_0x2c54a3){if(_0x2c54a3){_0x595b7f=_0x2c54a3[_0x29dd('0x35')];if(!_0x2ce973[_0x29dd('0x2f')][_0x29dd('0x36')](_0x29dd('0x37'))){_0x338e60[_0x29dd('0x1d')]=qs[_0x29dd('0x1d')](_0x2ce973['query'][_0x29dd('0x1d')]);_0x338e60[_0x29dd('0x1a')]=qs['offset'](_0x2ce973[_0x29dd('0x2f')][_0x29dd('0x1a')]);}return _0x44a896['getDescriptions'](_0x338e60);}})[_0x29dd('0x3f')](function(_0x2f46cb){if(_0x2f46cb){return _0x2f46cb?{'count':_0x595b7f,'rows':_0x2f46cb}:null;}})[_0x29dd('0x3f')](respondWithResult(_0x3725bc,null))[_0x29dd('0x43')](handleError(_0x3725bc,null));};exports[_0x29dd('0x4d')]=function(_0x4010d1,_0x36c847,_0x17a872){var _0x1d9cb3={};var _0x3f9d4b={};var _0xd646e0;var _0x25cd2d;return db[_0x29dd('0x2a')][_0x29dd('0x4e')]({'where':{'id':_0x4010d1[_0x29dd('0x44')]['id']}})['then'](handleEntityNotFound(_0x36c847,null))[_0x29dd('0x3f')](function(_0x432ee8){if(_0x432ee8){_0xd646e0=_0x432ee8;_0x3f9d4b[_0x29dd('0x2e')]=_['keys'](db[_0x29dd('0x4a')][_0x29dd('0x45')]);_0x3f9d4b[_0x29dd('0x2f')]=_[_0x29dd('0x30')](_0x4010d1[_0x29dd('0x2f')]);_0x3f9d4b[_0x29dd('0x31')]=_[_0x29dd('0x32')](_0x3f9d4b[_0x29dd('0x2e')],_0x3f9d4b[_0x29dd('0x2f')]);_0x1d9cb3[_0x29dd('0x34')]=_['intersection'](_0x3f9d4b[_0x29dd('0x2e')],qs[_0x29dd('0x33')](_0x4010d1[_0x29dd('0x2f')][_0x29dd('0x33')]));_0x1d9cb3[_0x29dd('0x34')]=_0x1d9cb3[_0x29dd('0x34')]['length']?_0x1d9cb3['attributes']:_0x3f9d4b[_0x29dd('0x2e')];_0x1d9cb3[_0x29dd('0x38')]=qs['sort'](_0x4010d1[_0x29dd('0x2f')][_0x29dd('0x39')]);_0x1d9cb3[_0x29dd('0x3a')]=qs[_0x29dd('0x31')](_[_0x29dd('0x4b')](_0x4010d1['query'],_0x3f9d4b[_0x29dd('0x31')]));if(_0x4010d1[_0x29dd('0x2f')]['filter']){_0x1d9cb3['where']=_[_0x29dd('0x3c')](_0x1d9cb3[_0x29dd('0x3a')],{'$or':_[_0x29dd('0x29')](_0x1d9cb3[_0x29dd('0x34')],function(_0x1faeb7){var _0x1d3f70={};_0x1d3f70[_0x1faeb7]={'$like':'%'+_0x4010d1[_0x29dd('0x2f')]['filter']+'%'};return _0x1d3f70;})});}_0x1d9cb3=_[_0x29dd('0x3c')]({},_0x1d9cb3,_0x4010d1[_0x29dd('0x3e')]);return _0xd646e0['getFields'](_0x1d9cb3);}})[_0x29dd('0x3f')](function(_0x23e83d){if(_0x23e83d){_0x25cd2d=_0x23e83d[_0x29dd('0x35')];if(!_0x4010d1[_0x29dd('0x2f')][_0x29dd('0x36')](_0x29dd('0x37'))){_0x1d9cb3[_0x29dd('0x1d')]=qs[_0x29dd('0x1d')](_0x4010d1[_0x29dd('0x2f')][_0x29dd('0x1d')]);_0x1d9cb3[_0x29dd('0x1a')]=qs['offset'](_0x4010d1[_0x29dd('0x2f')][_0x29dd('0x1a')]);}return _0xd646e0[_0x29dd('0x4d')](_0x1d9cb3);}})[_0x29dd('0x3f')](function(_0x59ef31){if(_0x59ef31){return _0x59ef31?{'count':_0x25cd2d,'rows':_0x59ef31}:null;}})[_0x29dd('0x3f')](respondWithResult(_0x36c847,null))['catch'](handleError(_0x36c847,null));}; \ No newline at end of file diff --git a/server/api/intFreshsalesConfiguration/intFreshsalesConfiguration.model.js b/server/api/intFreshsalesConfiguration/intFreshsalesConfiguration.model.js index e854da8..0a8ef75 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 _0x64f6=['rimraf','../../config/environment','exports','define','FreshsalesConfiguration','lodash','util','api','moment','bluebird','request-promise'];(function(_0x90d843,_0x5902fe){var _0x1963b1=function(_0x19100d){while(--_0x19100d){_0x90d843['push'](_0x90d843['shift']());}};_0x1963b1(++_0x5902fe);}(_0x64f6,0x118));var _0x664f=function(_0x27e7e2,_0x3ddb8a){_0x27e7e2=_0x27e7e2-0x0;var _0x55431f=_0x64f6[_0x27e7e2];return _0x55431f;};'use strict';var _=require(_0x664f('0x0'));var util=require(_0x664f('0x1'));var logger=require('../../config/logger')(_0x664f('0x2'));var moment=require(_0x664f('0x3'));var BPromise=require(_0x664f('0x4'));var rp=require(_0x664f('0x5'));var fs=require('fs');var path=require('path');var rimraf=require(_0x664f('0x6'));var config=require(_0x664f('0x7'));var attributes=require('./intFreshsalesConfiguration.attributes');module[_0x664f('0x8')]=function(_0x22fd26,_0x206afc){return _0x22fd26[_0x664f('0x9')](_0x664f('0xa'),attributes,{'tableName':'int_freshsales_configurations','paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0xcb17=['../../config/environment','./intFreshsalesConfiguration.attributes','define','FreshsalesConfiguration','int_freshsales_configurations','util','../../config/logger','api','moment','request-promise'];(function(_0x1b92c8,_0x2910dd){var _0x21e676=function(_0x3ea334){while(--_0x3ea334){_0x1b92c8['push'](_0x1b92c8['shift']());}};_0x21e676(++_0x2910dd);}(_0xcb17,0xa5));var _0x7cb1=function(_0x51111b,_0x222117){_0x51111b=_0x51111b-0x0;var _0x2e8b0b=_0xcb17[_0x51111b];return _0x2e8b0b;};'use strict';var _=require('lodash');var util=require(_0x7cb1('0x0'));var logger=require(_0x7cb1('0x1'))(_0x7cb1('0x2'));var moment=require(_0x7cb1('0x3'));var BPromise=require('bluebird');var rp=require(_0x7cb1('0x4'));var fs=require('fs');var path=require('path');var rimraf=require('rimraf');var config=require(_0x7cb1('0x5'));var attributes=require(_0x7cb1('0x6'));module['exports']=function(_0x2d8ff2,_0x1fcfd4){return _0x2d8ff2[_0x7cb1('0x7')](_0x7cb1('0x8'),attributes,{'tableName':_0x7cb1('0x9'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/intFreshsalesConfiguration/intFreshsalesConfiguration.rpc.js b/server/api/intFreshsalesConfiguration/intFreshsalesConfiguration.rpc.js index 9a34940..02bb057 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 _0xfc1b=['then','info','request\x20sent','debug','FreshsalesConfiguration,\x20%s,\x20%s,\x20%s','error','message','FreshsalesConfiguration,\x20%s,\x20%s','result','catch','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','jayson/promise','client','request'];(function(_0x618414,_0x1a7a60){var _0x21c19a=function(_0x507b17){while(--_0x507b17){_0x618414['push'](_0x618414['shift']());}};_0x21c19a(++_0x1a7a60);}(_0xfc1b,0x73));var _0xbfc1=function(_0x441c37,_0x394dc9){_0x441c37=_0x441c37-0x0;var _0x45cb8e=_0xfc1b[_0x441c37];return _0x45cb8e;};'use strict';var _=require('lodash');var util=require('util');var moment=require(_0xbfc1('0x0'));var BPromise=require(_0xbfc1('0x1'));var rs=require(_0xbfc1('0x2'));var fs=require('fs');var Redis=require(_0xbfc1('0x3'));var db=require(_0xbfc1('0x4'))['db'];var utils=require(_0xbfc1('0x5'));var logger=require(_0xbfc1('0x6'))(_0xbfc1('0x7'));var config=require('../../config/environment');var jayson=require(_0xbfc1('0x8'));var client=jayson[_0xbfc1('0x9')]['http']({'port':0x232a});function respondWithRpcPromise(_0x3503d8,_0x29f406,_0x35ea60){return new BPromise(function(_0x63bfdc,_0x5e3535){return client[_0xbfc1('0xa')](_0x3503d8,_0x35ea60)[_0xbfc1('0xb')](function(_0x264209){logger[_0xbfc1('0xc')]('FreshsalesConfiguration,\x20%s,\x20%s',_0x29f406,_0xbfc1('0xd'));logger[_0xbfc1('0xe')](_0xbfc1('0xf'),_0x29f406,_0xbfc1('0xd'),JSON['stringify'](_0x264209));if(_0x264209['error']){if(_0x264209[_0xbfc1('0x10')]['code']===0x1f4){logger['error']('FreshsalesConfiguration,\x20%s,\x20%s',_0x29f406,_0x264209[_0xbfc1('0x10')][_0xbfc1('0x11')]);return _0x5e3535(_0x264209[_0xbfc1('0x10')][_0xbfc1('0x11')]);}logger[_0xbfc1('0x10')](_0xbfc1('0x12'),_0x29f406,_0x264209[_0xbfc1('0x10')][_0xbfc1('0x11')]);return _0x63bfdc(_0x264209[_0xbfc1('0x10')][_0xbfc1('0x11')]);}else{logger[_0xbfc1('0xc')](_0xbfc1('0x12'),_0x29f406,_0xbfc1('0xd'));_0x63bfdc(_0x264209[_0xbfc1('0x13')][_0xbfc1('0x11')]);}})[_0xbfc1('0x14')](function(_0xd7febb){logger['error'](_0xbfc1('0x12'),_0x29f406,_0xd7febb);_0x5e3535(_0xd7febb);});});} \ No newline at end of file +var _0x7cd3=['message','result','util','bluebird','randomstring','ioredis','../../mysqldb','../../config/logger','rpc','../../config/environment','client','http','info','FreshsalesConfiguration,\x20%s,\x20%s','request\x20sent','debug','FreshsalesConfiguration,\x20%s,\x20%s,\x20%s','stringify','error','code'];(function(_0x12c0c8,_0x358415){var _0x15f8b6=function(_0x1c9d7a){while(--_0x1c9d7a){_0x12c0c8['push'](_0x12c0c8['shift']());}};_0x15f8b6(++_0x358415);}(_0x7cd3,0xa2));var _0x37cd=function(_0x145aa,_0x3e8219){_0x145aa=_0x145aa-0x0;var _0x4628f7=_0x7cd3[_0x145aa];return _0x4628f7;};'use strict';var _=require('lodash');var util=require(_0x37cd('0x0'));var moment=require('moment');var BPromise=require(_0x37cd('0x1'));var rs=require(_0x37cd('0x2'));var fs=require('fs');var Redis=require(_0x37cd('0x3'));var db=require(_0x37cd('0x4'))['db'];var utils=require('../../config/utils');var logger=require(_0x37cd('0x5'))(_0x37cd('0x6'));var config=require(_0x37cd('0x7'));var jayson=require('jayson/promise');var client=jayson[_0x37cd('0x8')][_0x37cd('0x9')]({'port':0x232a});function respondWithRpcPromise(_0x356228,_0x5c9835,_0x11a970){return new BPromise(function(_0x186cdd,_0x2cc7d1){return client['request'](_0x356228,_0x11a970)['then'](function(_0x369b65){logger[_0x37cd('0xa')](_0x37cd('0xb'),_0x5c9835,_0x37cd('0xc'));logger[_0x37cd('0xd')](_0x37cd('0xe'),_0x5c9835,_0x37cd('0xc'),JSON[_0x37cd('0xf')](_0x369b65));if(_0x369b65[_0x37cd('0x10')]){if(_0x369b65[_0x37cd('0x10')][_0x37cd('0x11')]===0x1f4){logger[_0x37cd('0x10')](_0x37cd('0xb'),_0x5c9835,_0x369b65[_0x37cd('0x10')][_0x37cd('0x12')]);return _0x2cc7d1(_0x369b65[_0x37cd('0x10')]['message']);}logger[_0x37cd('0x10')](_0x37cd('0xb'),_0x5c9835,_0x369b65[_0x37cd('0x10')][_0x37cd('0x12')]);return _0x186cdd(_0x369b65[_0x37cd('0x10')][_0x37cd('0x12')]);}else{logger['info'](_0x37cd('0xb'),_0x5c9835,_0x37cd('0xc'));_0x186cdd(_0x369b65[_0x37cd('0x13')][_0x37cd('0x12')]);}})['catch'](function(_0x55afcc){logger[_0x37cd('0x10')](_0x37cd('0xb'),_0x5c9835,_0x55afcc);_0x2cc7d1(_0x55afcc);});});} \ No newline at end of file diff --git a/server/api/intFreshsalesField/index.js b/server/api/intFreshsalesField/index.js index 6265a45..007dc9e 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 _0xfa7c=['create','put','update','delete','/:id','multer','path','connect-timeout','express','Router','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','get','isAuthenticated','index','show','post'];(function(_0x549278,_0x450754){var _0x1ea9a1=function(_0x2e559d){while(--_0x2e559d){_0x549278['push'](_0x549278['shift']());}};_0x1ea9a1(++_0x450754);}(_0xfa7c,0x15b));var _0xcfa7=function(_0x70ec9,_0x361972){_0x70ec9=_0x70ec9-0x0;var _0x447e15=_0xfa7c[_0x70ec9];return _0x447e15;};'use strict';var multer=require(_0xcfa7('0x0'));var util=require('util');var path=require(_0xcfa7('0x1'));var timeout=require(_0xcfa7('0x2'));var express=require(_0xcfa7('0x3'));var router=express[_0xcfa7('0x4')]();var fs_extra=require(_0xcfa7('0x5'));var auth=require(_0xcfa7('0x6'));var interaction=require(_0xcfa7('0x7'));var config=require(_0xcfa7('0x8'));var controller=require('./intFreshsalesField.controller');router[_0xcfa7('0x9')]('/',auth[_0xcfa7('0xa')](),controller[_0xcfa7('0xb')]);router[_0xcfa7('0x9')]('/:id',auth[_0xcfa7('0xa')](),controller[_0xcfa7('0xc')]);router[_0xcfa7('0xd')]('/',auth[_0xcfa7('0xa')](),controller[_0xcfa7('0xe')]);router[_0xcfa7('0xf')]('/:id',auth[_0xcfa7('0xa')](),controller[_0xcfa7('0x10')]);router[_0xcfa7('0x11')](_0xcfa7('0x12'),auth[_0xcfa7('0xa')](),controller['destroy']);module['exports']=router; \ No newline at end of file +var _0xc68d=['util','path','Router','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','./intFreshsalesField.controller','isAuthenticated','index','get','show','post','put','/:id','update','destroy','exports'];(function(_0xaf25ae,_0x2001c1){var _0x49732d=function(_0x5b764d){while(--_0x5b764d){_0xaf25ae['push'](_0xaf25ae['shift']());}};_0x49732d(++_0x2001c1);}(_0xc68d,0x17a));var _0xdc68=function(_0x4416ea,_0x5f0207){_0x4416ea=_0x4416ea-0x0;var _0x280510=_0xc68d[_0x4416ea];return _0x280510;};'use strict';var multer=require('multer');var util=require(_0xdc68('0x0'));var path=require(_0xdc68('0x1'));var timeout=require('connect-timeout');var express=require('express');var router=express[_0xdc68('0x2')]();var fs_extra=require(_0xdc68('0x3'));var auth=require(_0xdc68('0x4'));var interaction=require(_0xdc68('0x5'));var config=require(_0xdc68('0x6'));var controller=require(_0xdc68('0x7'));router['get']('/',auth[_0xdc68('0x8')](),controller[_0xdc68('0x9')]);router[_0xdc68('0xa')]('/:id',auth[_0xdc68('0x8')](),controller[_0xdc68('0xb')]);router[_0xdc68('0xc')]('/',auth['isAuthenticated'](),controller['create']);router[_0xdc68('0xd')](_0xdc68('0xe'),auth[_0xdc68('0x8')](),controller[_0xdc68('0xf')]);router['delete'](_0xdc68('0xe'),auth[_0xdc68('0x8')](),controller[_0xdc68('0x10')]);module[_0xdc68('0x11')]=router; \ No newline at end of file diff --git a/server/api/intFreshsalesField/intFreshsalesField.attributes.js b/server/api/intFreshsalesField/intFreshsalesField.attributes.js index 9696e88..974fdff 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 _0x1ca1=['customVariable','BOOLEAN','sequelize','exports','ENUM','string','variable','keyValue','picklist','STRING'];(function(_0x2c1b04,_0x3c25fe){var _0x45e654=function(_0xb765da){while(--_0xb765da){_0x2c1b04['push'](_0x2c1b04['shift']());}};_0x45e654(++_0x3c25fe);}(_0x1ca1,0x66));var _0x11ca=function(_0xfc3b7e,_0x4df801){_0xfc3b7e=_0xfc3b7e-0x0;var _0x4396d4=_0x1ca1[_0xfc3b7e];return _0x4396d4;};'use strict';var Sequelize=require(_0x11ca('0x0'));module[_0x11ca('0x1')]={'type':{'type':Sequelize[_0x11ca('0x2')](_0x11ca('0x3'),_0x11ca('0x4'),'customVariable',_0x11ca('0x5'),_0x11ca('0x6')),'defaultValue':_0x11ca('0x3')},'content':{'type':Sequelize[_0x11ca('0x7')]},'key':{'type':Sequelize['STRING']},'keyType':{'type':Sequelize['ENUM'](_0x11ca('0x3'),'variable',_0x11ca('0x8'))},'keyContent':{'type':Sequelize['STRING']},'idField':{'type':Sequelize[_0x11ca('0x7')]},'nameField':{'type':Sequelize[_0x11ca('0x7')]},'customField':{'type':Sequelize[_0x11ca('0x9')],'defaultValue':!![]},'variableName':{'type':Sequelize[_0x11ca('0x7')]}}; \ No newline at end of file +var _0x6eeb=['BOOLEAN','exports','variable','customVariable','keyValue','picklist','string','STRING','ENUM'];(function(_0x406459,_0x2a5eae){var _0x6895c3=function(_0x52bbf7){while(--_0x52bbf7){_0x406459['push'](_0x406459['shift']());}};_0x6895c3(++_0x2a5eae);}(_0x6eeb,0x64));var _0xb6ee=function(_0x173fdf,_0x1ba573){_0x173fdf=_0x173fdf-0x0;var _0x147b6d=_0x6eeb[_0x173fdf];return _0x147b6d;};'use strict';var Sequelize=require('sequelize');module[_0xb6ee('0x0')]={'type':{'type':Sequelize['ENUM']('string',_0xb6ee('0x1'),_0xb6ee('0x2'),_0xb6ee('0x3'),_0xb6ee('0x4')),'defaultValue':_0xb6ee('0x5')},'content':{'type':Sequelize[_0xb6ee('0x6')]},'key':{'type':Sequelize[_0xb6ee('0x6')]},'keyType':{'type':Sequelize[_0xb6ee('0x7')](_0xb6ee('0x5'),_0xb6ee('0x1'),_0xb6ee('0x2'))},'keyContent':{'type':Sequelize[_0xb6ee('0x6')]},'idField':{'type':Sequelize['STRING']},'nameField':{'type':Sequelize[_0xb6ee('0x6')]},'customField':{'type':Sequelize[_0xb6ee('0x8')],'defaultValue':!![]},'variableName':{'type':Sequelize[_0xb6ee('0x6')]}}; \ No newline at end of file diff --git a/server/api/intFreshsalesField/intFreshsalesField.controller.js b/server/api/intFreshsalesField/intFreshsalesField.controller.js index 4815fb0..3d357be 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 _0xb941=['create','body','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','util','path','sox','to-csv','ejs','fs-extra','lodash','squel','crypto','jsforce','desk.js','querystring','papaparse','ioredis','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/environment','../../mysqldb','sendStatus','json','offset','limit','undefined','count','status','set','apply','reject','save','update','destroy','then','end','error','stack','name','index','map','FreshsalesField','rawAttributes','type','key','model','query','filters','intersection','attributes','fields','order','sort','pick','where','merge','filter','options','includeAll','include','findAll','catch','params','keys','length','find'];(function(_0x3658bf,_0x33e4f8){var _0x114f34=function(_0x40d62d){while(--_0x40d62d){_0x3658bf['push'](_0x3658bf['shift']());}};_0x114f34(++_0x33e4f8);}(_0xb941,0x174));var _0x1b94=function(_0x27dc8d,_0x1f0639){_0x27dc8d=_0x27dc8d-0x0;var _0x3f7fd4=_0xb941[_0x27dc8d];return _0x3f7fd4;};'use strict';var emlformat=require(_0x1b94('0x0'));var rimraf=require(_0x1b94('0x1'));var zipdir=require(_0x1b94('0x2'));var jsonpatch=require(_0x1b94('0x3'));var rp=require(_0x1b94('0x4'));var moment=require('moment');var BPromise=require('bluebird');var Mustache=require('mustache');var util=require(_0x1b94('0x5'));var path=require(_0x1b94('0x6'));var sox=require(_0x1b94('0x7'));var csv=require(_0x1b94('0x8'));var ejs=require(_0x1b94('0x9'));var fs=require('fs');var fs_extra=require(_0x1b94('0xa'));var _=require(_0x1b94('0xb'));var squel=require(_0x1b94('0xc'));var crypto=require(_0x1b94('0xd'));var jsforce=require(_0x1b94('0xe'));var deskjs=require(_0x1b94('0xf'));var toCsv=require(_0x1b94('0x8'));var querystring=require(_0x1b94('0x10'));var Papa=require(_0x1b94('0x11'));var Redis=require(_0x1b94('0x12'));var authService=require('../../components/auth/service');var qs=require(_0x1b94('0x13'));var as=require(_0x1b94('0x14'));var hardwareService=require(_0x1b94('0x15'));var logger=require(_0x1b94('0x16'))(_0x1b94('0x17'));var utils=require(_0x1b94('0x18'));var config=require(_0x1b94('0x19'));var licenseUtil=require('../../config/license/util');var db=require(_0x1b94('0x1a'))['db'];function respondWithStatusCode(_0x443f91,_0x36ad85){_0x36ad85=_0x36ad85||0xcc;return function(_0x2b5a64){if(_0x2b5a64){return _0x443f91[_0x1b94('0x1b')](_0x36ad85);}return _0x443f91['status'](_0x36ad85)['end']();};}function respondWithResult(_0x5f4c82,_0x181185){_0x181185=_0x181185||0xc8;return function(_0x23c6ab){if(_0x23c6ab){return _0x5f4c82['status'](_0x181185)[_0x1b94('0x1c')](_0x23c6ab);}};}function respondWithFilteredResult(_0xa47a75,_0x516df2){return function(_0xe2f161){if(_0xe2f161){var _0x3ccfea=typeof _0x516df2[_0x1b94('0x1d')]==='undefined'&&typeof _0x516df2[_0x1b94('0x1e')]===_0x1b94('0x1f');var _0x3aa8d8=_0xe2f161['count'];var _0x48b143=_0x3ccfea?0x0:_0x516df2[_0x1b94('0x1d')];var _0x541168=_0x3ccfea?_0xe2f161[_0x1b94('0x20')]:_0x516df2[_0x1b94('0x1d')]+_0x516df2[_0x1b94('0x1e')];var _0x273a5b;if(_0x541168>=_0x3aa8d8){_0x541168=_0x3aa8d8;_0x273a5b=0xc8;}else{_0x273a5b=0xce;}_0xa47a75[_0x1b94('0x21')](_0x273a5b);return _0xa47a75[_0x1b94('0x22')]('Content-Range',_0x48b143+'-'+_0x541168+'/'+_0x3aa8d8)[_0x1b94('0x1c')](_0xe2f161);}return null;};}function patchUpdates(_0x43a8d1){return function(_0x55d9ae){try{jsonpatch[_0x1b94('0x23')](_0x55d9ae,_0x43a8d1,!![]);}catch(_0x57fabb){return BPromise[_0x1b94('0x24')](_0x57fabb);}return _0x55d9ae[_0x1b94('0x25')]();};}function saveUpdates(_0x20a427,_0x2885fa){return function(_0x14e21e){if(_0x14e21e){return _0x14e21e[_0x1b94('0x26')](_0x20a427)['then'](function(_0x48fe5d){return _0x48fe5d;});}return null;};}function removeEntity(_0x4f56f0,_0x3bd44e){return function(_0x25af0f){if(_0x25af0f){return _0x25af0f[_0x1b94('0x27')]()[_0x1b94('0x28')](function(){_0x4f56f0['status'](0xcc)[_0x1b94('0x29')]();});}};}function handleEntityNotFound(_0x1abe0b,_0x10f537){return function(_0x3c6801){if(!_0x3c6801){_0x1abe0b[_0x1b94('0x1b')](0x194);}return _0x3c6801;};}function handleError(_0x4d0d75,_0x54d49b){_0x54d49b=_0x54d49b||0x1f4;return function(_0x19b238){logger[_0x1b94('0x2a')](_0x19b238[_0x1b94('0x2b')]);if(_0x19b238[_0x1b94('0x2c')]){delete _0x19b238[_0x1b94('0x2c')];}_0x4d0d75[_0x1b94('0x21')](_0x54d49b)['send'](_0x19b238);};}exports[_0x1b94('0x2d')]=function(_0x3b141a,_0x17ab9a){var _0x4a715c={},_0x2666de={},_0x2369f7={'count':0x0,'rows':[]};var _0x4f50b9=_[_0x1b94('0x2e')](db[_0x1b94('0x2f')][_0x1b94('0x30')],function(_0x40af82){return{'name':_0x40af82['fieldName'],'type':_0x40af82[_0x1b94('0x31')][_0x1b94('0x32')]};});_0x2666de[_0x1b94('0x33')]=_['map'](_0x4f50b9,'name');_0x2666de[_0x1b94('0x34')]=_['keys'](_0x3b141a[_0x1b94('0x34')]);_0x2666de[_0x1b94('0x35')]=_[_0x1b94('0x36')](_0x2666de['model'],_0x2666de[_0x1b94('0x34')]);_0x4a715c[_0x1b94('0x37')]=_[_0x1b94('0x36')](_0x2666de[_0x1b94('0x33')],qs[_0x1b94('0x38')](_0x3b141a['query']['fields']));_0x4a715c[_0x1b94('0x37')]=_0x4a715c['attributes']['length']?_0x4a715c[_0x1b94('0x37')]:_0x2666de['model'];if(!_0x3b141a['query']['hasOwnProperty']('nolimit')){_0x4a715c[_0x1b94('0x1e')]=qs[_0x1b94('0x1e')](_0x3b141a[_0x1b94('0x34')][_0x1b94('0x1e')]);_0x4a715c[_0x1b94('0x1d')]=qs['offset'](_0x3b141a[_0x1b94('0x34')][_0x1b94('0x1d')]);}_0x4a715c[_0x1b94('0x39')]=qs[_0x1b94('0x3a')](_0x3b141a[_0x1b94('0x34')][_0x1b94('0x3a')]);_0x4a715c['where']=qs[_0x1b94('0x35')](_[_0x1b94('0x3b')](_0x3b141a['query'],_0x2666de[_0x1b94('0x35')]),_0x4f50b9);if(_0x3b141a[_0x1b94('0x34')]['filter']){_0x4a715c[_0x1b94('0x3c')]=_[_0x1b94('0x3d')](_0x4a715c[_0x1b94('0x3c')],{'$or':_[_0x1b94('0x2e')](_0x4f50b9,function(_0x4b8d85){if(_0x4b8d85[_0x1b94('0x31')]!=='VIRTUAL'){var _0x179fe2={};_0x179fe2[_0x4b8d85[_0x1b94('0x2c')]]={'$like':'%'+_0x3b141a[_0x1b94('0x34')][_0x1b94('0x3e')]+'%'};return _0x179fe2;}})});}_0x4a715c=_[_0x1b94('0x3d')]({},_0x4a715c,_0x3b141a[_0x1b94('0x3f')]);var _0x44f223={'where':_0x4a715c[_0x1b94('0x3c')]};return db[_0x1b94('0x2f')][_0x1b94('0x20')](_0x44f223)[_0x1b94('0x28')](function(_0x5812f2){_0x2369f7[_0x1b94('0x20')]=_0x5812f2;if(_0x3b141a[_0x1b94('0x34')][_0x1b94('0x40')]){_0x4a715c[_0x1b94('0x41')]=[{'all':!![]}];}return db[_0x1b94('0x2f')][_0x1b94('0x42')](_0x4a715c);})[_0x1b94('0x28')](function(_0x3a7a77){_0x2369f7['rows']=_0x3a7a77;return _0x2369f7;})[_0x1b94('0x28')](respondWithFilteredResult(_0x17ab9a,_0x4a715c))[_0x1b94('0x43')](handleError(_0x17ab9a,null));};exports['show']=function(_0x402fbf,_0x4aa25f){var _0x432455={'raw':!![],'where':{'id':_0x402fbf[_0x1b94('0x44')]['id']}},_0x37df45={};_0x37df45[_0x1b94('0x33')]=_[_0x1b94('0x45')](db[_0x1b94('0x2f')][_0x1b94('0x30')]);_0x37df45[_0x1b94('0x34')]=_['keys'](_0x402fbf[_0x1b94('0x34')]);_0x37df45[_0x1b94('0x35')]=_[_0x1b94('0x36')](_0x37df45[_0x1b94('0x33')],_0x37df45['query']);_0x432455[_0x1b94('0x37')]=_[_0x1b94('0x36')](_0x37df45[_0x1b94('0x33')],qs['fields'](_0x402fbf['query'][_0x1b94('0x38')]));_0x432455[_0x1b94('0x37')]=_0x432455[_0x1b94('0x37')][_0x1b94('0x46')]?_0x432455[_0x1b94('0x37')]:_0x37df45[_0x1b94('0x33')];if(_0x402fbf['query'][_0x1b94('0x40')]){_0x432455[_0x1b94('0x41')]=[{'all':!![]}];}_0x432455=_['merge']({},_0x432455,_0x402fbf[_0x1b94('0x3f')]);return db[_0x1b94('0x2f')][_0x1b94('0x47')](_0x432455)[_0x1b94('0x28')](handleEntityNotFound(_0x4aa25f,null))['then'](respondWithResult(_0x4aa25f,null))['catch'](handleError(_0x4aa25f,null));};exports['create']=function(_0x25385a,_0x35c906){return db[_0x1b94('0x2f')][_0x1b94('0x48')](_0x25385a[_0x1b94('0x49')],{})[_0x1b94('0x28')](respondWithResult(_0x35c906,0xc9))['catch'](handleError(_0x35c906,null));};exports['update']=function(_0x1e4f72,_0x51d2be){if(_0x1e4f72[_0x1b94('0x49')]['id']){delete _0x1e4f72[_0x1b94('0x49')]['id'];}return db[_0x1b94('0x2f')]['find']({'where':{'id':_0x1e4f72['params']['id']}})[_0x1b94('0x28')](handleEntityNotFound(_0x51d2be,null))[_0x1b94('0x28')](saveUpdates(_0x1e4f72[_0x1b94('0x49')],null))[_0x1b94('0x28')](respondWithResult(_0x51d2be,null))[_0x1b94('0x43')](handleError(_0x51d2be,null));};exports[_0x1b94('0x27')]=function(_0x10fc9b,_0x1bbea7){return db[_0x1b94('0x2f')][_0x1b94('0x47')]({'where':{'id':_0x10fc9b[_0x1b94('0x44')]['id']}})[_0x1b94('0x28')](handleEntityNotFound(_0x1bbea7,null))[_0x1b94('0x28')](removeEntity(_0x1bbea7,null))[_0x1b94('0x43')](handleError(_0x1bbea7,null));}; \ No newline at end of file +var _0x4ffc=['catch','show','rawAttributes','includeAll','find','create','body','zip-dir','fast-json-patch','request-promise','mustache','util','path','sox','fs-extra','lodash','squel','crypto','jsforce','to-csv','querystring','ioredis','../../components/auth/service','../../config/logger','api','../../config/utils','../../config/license/util','../../mysqldb','end','json','offset','undefined','limit','count','status','Content-Range','apply','save','update','then','destroy','sendStatus','error','stack','name','send','index','fieldName','type','model','query','keys','filters','intersection','attributes','fields','length','nolimit','order','sort','where','pick','filter','merge','map','options','include','FreshsalesField','findAll'];(function(_0x14add3,_0x13ce8d){var _0x4a174f=function(_0x2b3ed7){while(--_0x2b3ed7){_0x14add3['push'](_0x14add3['shift']());}};_0x4a174f(++_0x13ce8d);}(_0x4ffc,0x1a5));var _0xc4ff=function(_0x5f09e4,_0x51ef3c){_0x5f09e4=_0x5f09e4-0x0;var _0x46d404=_0x4ffc[_0x5f09e4];return _0x46d404;};'use strict';var emlformat=require('eml-format');var rimraf=require('rimraf');var zipdir=require(_0xc4ff('0x0'));var jsonpatch=require(_0xc4ff('0x1'));var rp=require(_0xc4ff('0x2'));var moment=require('moment');var BPromise=require('bluebird');var Mustache=require(_0xc4ff('0x3'));var util=require(_0xc4ff('0x4'));var path=require(_0xc4ff('0x5'));var sox=require(_0xc4ff('0x6'));var csv=require('to-csv');var ejs=require('ejs');var fs=require('fs');var fs_extra=require(_0xc4ff('0x7'));var _=require(_0xc4ff('0x8'));var squel=require(_0xc4ff('0x9'));var crypto=require(_0xc4ff('0xa'));var jsforce=require(_0xc4ff('0xb'));var deskjs=require('desk.js');var toCsv=require(_0xc4ff('0xc'));var querystring=require(_0xc4ff('0xd'));var Papa=require('papaparse');var Redis=require(_0xc4ff('0xe'));var authService=require(_0xc4ff('0xf'));var qs=require('../../components/parsers/qs');var as=require('../../components/parsers/advancedSearch');var hardwareService=require('../../config/license/hardware');var logger=require(_0xc4ff('0x10'))(_0xc4ff('0x11'));var utils=require(_0xc4ff('0x12'));var config=require('../../config/environment');var licenseUtil=require(_0xc4ff('0x13'));var db=require(_0xc4ff('0x14'))['db'];function respondWithStatusCode(_0x36fa5a,_0x341ea4){_0x341ea4=_0x341ea4||0xcc;return function(_0x911a33){if(_0x911a33){return _0x36fa5a['sendStatus'](_0x341ea4);}return _0x36fa5a['status'](_0x341ea4)[_0xc4ff('0x15')]();};}function respondWithResult(_0x32b788,_0x14a26c){_0x14a26c=_0x14a26c||0xc8;return function(_0x421402){if(_0x421402){return _0x32b788['status'](_0x14a26c)[_0xc4ff('0x16')](_0x421402);}};}function respondWithFilteredResult(_0x154354,_0x10969b){return function(_0xe33e2b){if(_0xe33e2b){var _0x439ba5=typeof _0x10969b[_0xc4ff('0x17')]===_0xc4ff('0x18')&&typeof _0x10969b[_0xc4ff('0x19')]===_0xc4ff('0x18');var _0x5c9ac6=_0xe33e2b[_0xc4ff('0x1a')];var _0x53313d=_0x439ba5?0x0:_0x10969b[_0xc4ff('0x17')];var _0x11f963=_0x439ba5?_0xe33e2b[_0xc4ff('0x1a')]:_0x10969b[_0xc4ff('0x17')]+_0x10969b[_0xc4ff('0x19')];var _0x3f5dc6;if(_0x11f963>=_0x5c9ac6){_0x11f963=_0x5c9ac6;_0x3f5dc6=0xc8;}else{_0x3f5dc6=0xce;}_0x154354[_0xc4ff('0x1b')](_0x3f5dc6);return _0x154354['set'](_0xc4ff('0x1c'),_0x53313d+'-'+_0x11f963+'/'+_0x5c9ac6)[_0xc4ff('0x16')](_0xe33e2b);}return null;};}function patchUpdates(_0x451b58){return function(_0x4cd54d){try{jsonpatch[_0xc4ff('0x1d')](_0x4cd54d,_0x451b58,!![]);}catch(_0x3aa4af){return BPromise['reject'](_0x3aa4af);}return _0x4cd54d[_0xc4ff('0x1e')]();};}function saveUpdates(_0x4ac851,_0x2e219c){return function(_0x47fe45){if(_0x47fe45){return _0x47fe45[_0xc4ff('0x1f')](_0x4ac851)[_0xc4ff('0x20')](function(_0x56d32e){return _0x56d32e;});}return null;};}function removeEntity(_0xbab9c8,_0x1000c0){return function(_0x302202){if(_0x302202){return _0x302202[_0xc4ff('0x21')]()['then'](function(){_0xbab9c8[_0xc4ff('0x1b')](0xcc)[_0xc4ff('0x15')]();});}};}function handleEntityNotFound(_0x1608fe,_0x7dcb09){return function(_0x15fa6d){if(!_0x15fa6d){_0x1608fe[_0xc4ff('0x22')](0x194);}return _0x15fa6d;};}function handleError(_0x24caee,_0x101449){_0x101449=_0x101449||0x1f4;return function(_0x38cc47){logger[_0xc4ff('0x23')](_0x38cc47[_0xc4ff('0x24')]);if(_0x38cc47[_0xc4ff('0x25')]){delete _0x38cc47[_0xc4ff('0x25')];}_0x24caee[_0xc4ff('0x1b')](_0x101449)[_0xc4ff('0x26')](_0x38cc47);};}exports[_0xc4ff('0x27')]=function(_0x1371a6,_0x3e6461){var _0x2e3ec7={},_0x3aeabd={},_0x134cf4={'count':0x0,'rows':[]};var _0x3f8b67=_['map'](db['FreshsalesField']['rawAttributes'],function(_0x5028d5){return{'name':_0x5028d5[_0xc4ff('0x28')],'type':_0x5028d5[_0xc4ff('0x29')]['key']};});_0x3aeabd[_0xc4ff('0x2a')]=_['map'](_0x3f8b67,'name');_0x3aeabd[_0xc4ff('0x2b')]=_[_0xc4ff('0x2c')](_0x1371a6[_0xc4ff('0x2b')]);_0x3aeabd[_0xc4ff('0x2d')]=_[_0xc4ff('0x2e')](_0x3aeabd[_0xc4ff('0x2a')],_0x3aeabd['query']);_0x2e3ec7[_0xc4ff('0x2f')]=_[_0xc4ff('0x2e')](_0x3aeabd[_0xc4ff('0x2a')],qs[_0xc4ff('0x30')](_0x1371a6['query'][_0xc4ff('0x30')]));_0x2e3ec7['attributes']=_0x2e3ec7[_0xc4ff('0x2f')][_0xc4ff('0x31')]?_0x2e3ec7[_0xc4ff('0x2f')]:_0x3aeabd[_0xc4ff('0x2a')];if(!_0x1371a6['query']['hasOwnProperty'](_0xc4ff('0x32'))){_0x2e3ec7[_0xc4ff('0x19')]=qs['limit'](_0x1371a6[_0xc4ff('0x2b')][_0xc4ff('0x19')]);_0x2e3ec7['offset']=qs[_0xc4ff('0x17')](_0x1371a6[_0xc4ff('0x2b')]['offset']);}_0x2e3ec7[_0xc4ff('0x33')]=qs[_0xc4ff('0x34')](_0x1371a6[_0xc4ff('0x2b')][_0xc4ff('0x34')]);_0x2e3ec7[_0xc4ff('0x35')]=qs['filters'](_[_0xc4ff('0x36')](_0x1371a6[_0xc4ff('0x2b')],_0x3aeabd[_0xc4ff('0x2d')]),_0x3f8b67);if(_0x1371a6[_0xc4ff('0x2b')][_0xc4ff('0x37')]){_0x2e3ec7[_0xc4ff('0x35')]=_[_0xc4ff('0x38')](_0x2e3ec7[_0xc4ff('0x35')],{'$or':_[_0xc4ff('0x39')](_0x3f8b67,function(_0x181f2c){if(_0x181f2c[_0xc4ff('0x29')]!=='VIRTUAL'){var _0x3e95e6={};_0x3e95e6[_0x181f2c[_0xc4ff('0x25')]]={'$like':'%'+_0x1371a6['query']['filter']+'%'};return _0x3e95e6;}})});}_0x2e3ec7=_[_0xc4ff('0x38')]({},_0x2e3ec7,_0x1371a6[_0xc4ff('0x3a')]);var _0x5391d2={'where':_0x2e3ec7[_0xc4ff('0x35')]};return db['FreshsalesField']['count'](_0x5391d2)[_0xc4ff('0x20')](function(_0x10f40c){_0x134cf4[_0xc4ff('0x1a')]=_0x10f40c;if(_0x1371a6[_0xc4ff('0x2b')]['includeAll']){_0x2e3ec7[_0xc4ff('0x3b')]=[{'all':!![]}];}return db[_0xc4ff('0x3c')][_0xc4ff('0x3d')](_0x2e3ec7);})[_0xc4ff('0x20')](function(_0x17d6c8){_0x134cf4['rows']=_0x17d6c8;return _0x134cf4;})[_0xc4ff('0x20')](respondWithFilteredResult(_0x3e6461,_0x2e3ec7))[_0xc4ff('0x3e')](handleError(_0x3e6461,null));};exports[_0xc4ff('0x3f')]=function(_0x4066c6,_0xc2e4ab){var _0x50c0c5={'raw':!![],'where':{'id':_0x4066c6['params']['id']}},_0x4e87b0={};_0x4e87b0[_0xc4ff('0x2a')]=_['keys'](db['FreshsalesField'][_0xc4ff('0x40')]);_0x4e87b0[_0xc4ff('0x2b')]=_['keys'](_0x4066c6[_0xc4ff('0x2b')]);_0x4e87b0[_0xc4ff('0x2d')]=_[_0xc4ff('0x2e')](_0x4e87b0[_0xc4ff('0x2a')],_0x4e87b0[_0xc4ff('0x2b')]);_0x50c0c5[_0xc4ff('0x2f')]=_[_0xc4ff('0x2e')](_0x4e87b0['model'],qs[_0xc4ff('0x30')](_0x4066c6[_0xc4ff('0x2b')]['fields']));_0x50c0c5['attributes']=_0x50c0c5[_0xc4ff('0x2f')][_0xc4ff('0x31')]?_0x50c0c5[_0xc4ff('0x2f')]:_0x4e87b0[_0xc4ff('0x2a')];if(_0x4066c6['query'][_0xc4ff('0x41')]){_0x50c0c5['include']=[{'all':!![]}];}_0x50c0c5=_[_0xc4ff('0x38')]({},_0x50c0c5,_0x4066c6[_0xc4ff('0x3a')]);return db['FreshsalesField'][_0xc4ff('0x42')](_0x50c0c5)[_0xc4ff('0x20')](handleEntityNotFound(_0xc2e4ab,null))[_0xc4ff('0x20')](respondWithResult(_0xc2e4ab,null))[_0xc4ff('0x3e')](handleError(_0xc2e4ab,null));};exports[_0xc4ff('0x43')]=function(_0x1553d0,_0x5866bf){return db[_0xc4ff('0x3c')][_0xc4ff('0x43')](_0x1553d0[_0xc4ff('0x44')],{})[_0xc4ff('0x20')](respondWithResult(_0x5866bf,0xc9))[_0xc4ff('0x3e')](handleError(_0x5866bf,null));};exports[_0xc4ff('0x1f')]=function(_0xe97e82,_0xe7c716){if(_0xe97e82[_0xc4ff('0x44')]['id']){delete _0xe97e82['body']['id'];}return db[_0xc4ff('0x3c')][_0xc4ff('0x42')]({'where':{'id':_0xe97e82['params']['id']}})[_0xc4ff('0x20')](handleEntityNotFound(_0xe7c716,null))[_0xc4ff('0x20')](saveUpdates(_0xe97e82[_0xc4ff('0x44')],null))['then'](respondWithResult(_0xe7c716,null))[_0xc4ff('0x3e')](handleError(_0xe7c716,null));};exports[_0xc4ff('0x21')]=function(_0x1135b2,_0x5e0d29){return db[_0xc4ff('0x3c')][_0xc4ff('0x42')]({'where':{'id':_0x1135b2['params']['id']}})[_0xc4ff('0x20')](handleEntityNotFound(_0x5e0d29,null))[_0xc4ff('0x20')](removeEntity(_0x5e0d29,null))[_0xc4ff('0x3e')](handleError(_0x5e0d29,null));}; \ No newline at end of file diff --git a/server/api/intFreshsalesField/intFreshsalesField.model.js b/server/api/intFreshsalesField/intFreshsalesField.model.js index f11bc57..9b1f370 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 _0x7d8a=['util','../../config/logger','api','moment','bluebird','request-promise','path','rimraf','../../config/environment','./intFreshsalesField.attributes','exports','FreshsalesField','int_freshsales_fields','freshsales_unique_index','idField','FieldId','lodash'];(function(_0x382a62,_0x1baa5e){var _0x490a25=function(_0x1b3427){while(--_0x1b3427){_0x382a62['push'](_0x382a62['shift']());}};_0x490a25(++_0x1baa5e);}(_0x7d8a,0x1ca));var _0xa7d8=function(_0x562f3b,_0x4c65ae){_0x562f3b=_0x562f3b-0x0;var _0x1edd55=_0x7d8a[_0x562f3b];return _0x1edd55;};'use strict';var _=require(_0xa7d8('0x0'));var util=require(_0xa7d8('0x1'));var logger=require(_0xa7d8('0x2'))(_0xa7d8('0x3'));var moment=require(_0xa7d8('0x4'));var BPromise=require(_0xa7d8('0x5'));var rp=require(_0xa7d8('0x6'));var fs=require('fs');var path=require(_0xa7d8('0x7'));var rimraf=require(_0xa7d8('0x8'));var config=require(_0xa7d8('0x9'));var attributes=require(_0xa7d8('0xa'));module[_0xa7d8('0xb')]=function(_0x3f35c9,_0x44660b){return _0x3f35c9['define'](_0xa7d8('0xc'),attributes,{'tableName':_0xa7d8('0xd'),'paranoid':![],'indexes':[{'name':_0xa7d8('0xe'),'fields':[_0xa7d8('0xf'),_0xa7d8('0x10')],'unique':!![]}],'timestamps':!![]});}; \ No newline at end of file +var _0x57ef=['path','../../config/environment','./intFreshsalesField.attributes','exports','define','FreshsalesField','int_freshsales_fields','idField','FieldId','util','../../config/logger','api','moment','bluebird','request-promise'];(function(_0x55fce4,_0x4e8aa1){var _0x40b4fb=function(_0x10c834){while(--_0x10c834){_0x55fce4['push'](_0x55fce4['shift']());}};_0x40b4fb(++_0x4e8aa1);}(_0x57ef,0xdb));var _0xf57e=function(_0x39b6fe,_0x2917e3){_0x39b6fe=_0x39b6fe-0x0;var _0x17e474=_0x57ef[_0x39b6fe];return _0x17e474;};'use strict';var _=require('lodash');var util=require(_0xf57e('0x0'));var logger=require(_0xf57e('0x1'))(_0xf57e('0x2'));var moment=require(_0xf57e('0x3'));var BPromise=require(_0xf57e('0x4'));var rp=require(_0xf57e('0x5'));var fs=require('fs');var path=require(_0xf57e('0x6'));var rimraf=require('rimraf');var config=require(_0xf57e('0x7'));var attributes=require(_0xf57e('0x8'));module[_0xf57e('0x9')]=function(_0xf9d112,_0x31d997){return _0xf9d112[_0xf57e('0xa')](_0xf57e('0xb'),attributes,{'tableName':_0xf57e('0xc'),'paranoid':![],'indexes':[{'name':'freshsales_unique_index','fields':[_0xf57e('0xd'),_0xf57e('0xe')],'unique':!![]}],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/intFreshsalesField/intFreshsalesField.rpc.js b/server/api/intFreshsalesField/intFreshsalesField.rpc.js index 3404e39..f7d3053 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 _0x1967=['then','info','FreshsalesField,\x20%s,\x20%s','FreshsalesField,\x20%s,\x20%s,\x20%s','request\x20sent','stringify','error','code','message','result','catch','util','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','client','http','request'];(function(_0x5d8018,_0x588592){var _0x151ac4=function(_0x548679){while(--_0x548679){_0x5d8018['push'](_0x5d8018['shift']());}};_0x151ac4(++_0x588592);}(_0x1967,0x173));var _0x7196=function(_0x14fc65,_0x45ddc0){_0x14fc65=_0x14fc65-0x0;var _0x37b6e6=_0x1967[_0x14fc65];return _0x37b6e6;};'use strict';var _=require('lodash');var util=require(_0x7196('0x0'));var moment=require(_0x7196('0x1'));var BPromise=require(_0x7196('0x2'));var rs=require(_0x7196('0x3'));var fs=require('fs');var Redis=require(_0x7196('0x4'));var db=require(_0x7196('0x5'))['db'];var utils=require(_0x7196('0x6'));var logger=require(_0x7196('0x7'))(_0x7196('0x8'));var config=require(_0x7196('0x9'));var jayson=require('jayson/promise');var client=jayson[_0x7196('0xa')][_0x7196('0xb')]({'port':0x232a});function respondWithRpcPromise(_0x194746,_0x40e0af,_0x266a6e){return new BPromise(function(_0xad78a,_0x510c72){return client[_0x7196('0xc')](_0x194746,_0x266a6e)[_0x7196('0xd')](function(_0x3f846e){logger[_0x7196('0xe')](_0x7196('0xf'),_0x40e0af,'request\x20sent');logger['debug'](_0x7196('0x10'),_0x40e0af,_0x7196('0x11'),JSON[_0x7196('0x12')](_0x3f846e));if(_0x3f846e[_0x7196('0x13')]){if(_0x3f846e[_0x7196('0x13')][_0x7196('0x14')]===0x1f4){logger[_0x7196('0x13')](_0x7196('0xf'),_0x40e0af,_0x3f846e[_0x7196('0x13')][_0x7196('0x15')]);return _0x510c72(_0x3f846e[_0x7196('0x13')]['message']);}logger[_0x7196('0x13')](_0x7196('0xf'),_0x40e0af,_0x3f846e[_0x7196('0x13')][_0x7196('0x15')]);return _0xad78a(_0x3f846e['error'][_0x7196('0x15')]);}else{logger['info'](_0x7196('0xf'),_0x40e0af,_0x7196('0x11'));_0xad78a(_0x3f846e[_0x7196('0x16')][_0x7196('0x15')]);}})[_0x7196('0x17')](function(_0x2e3e0e){logger[_0x7196('0x13')](_0x7196('0xf'),_0x40e0af,_0x2e3e0e);_0x510c72(_0x2e3e0e);});});} \ No newline at end of file +var _0xb4c7=['client','http','request','then','info','FreshsalesField,\x20%s,\x20%s','request\x20sent','debug','FreshsalesField,\x20%s,\x20%s,\x20%s','stringify','code','error','message','result','catch','lodash','util','moment','bluebird','randomstring','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment'];(function(_0x519e53,_0x20a92e){var _0x4c7f63=function(_0x3a2247){while(--_0x3a2247){_0x519e53['push'](_0x519e53['shift']());}};_0x4c7f63(++_0x20a92e);}(_0xb4c7,0x1ea));var _0x7b4c=function(_0x154c66,_0x4d108c){_0x154c66=_0x154c66-0x0;var _0x348773=_0xb4c7[_0x154c66];return _0x348773;};'use strict';var _=require(_0x7b4c('0x0'));var util=require(_0x7b4c('0x1'));var moment=require(_0x7b4c('0x2'));var BPromise=require(_0x7b4c('0x3'));var rs=require(_0x7b4c('0x4'));var fs=require('fs');var Redis=require('ioredis');var db=require(_0x7b4c('0x5'))['db'];var utils=require(_0x7b4c('0x6'));var logger=require(_0x7b4c('0x7'))(_0x7b4c('0x8'));var config=require(_0x7b4c('0x9'));var jayson=require('jayson/promise');var client=jayson[_0x7b4c('0xa')][_0x7b4c('0xb')]({'port':0x232a});function respondWithRpcPromise(_0x2dd5c7,_0x4bf85d,_0x2d7b7e){return new BPromise(function(_0x21687f,_0x570daa){return client[_0x7b4c('0xc')](_0x2dd5c7,_0x2d7b7e)[_0x7b4c('0xd')](function(_0x28e902){logger[_0x7b4c('0xe')](_0x7b4c('0xf'),_0x4bf85d,_0x7b4c('0x10'));logger[_0x7b4c('0x11')](_0x7b4c('0x12'),_0x4bf85d,_0x7b4c('0x10'),JSON[_0x7b4c('0x13')](_0x28e902));if(_0x28e902['error']){if(_0x28e902['error'][_0x7b4c('0x14')]===0x1f4){logger[_0x7b4c('0x15')](_0x7b4c('0xf'),_0x4bf85d,_0x28e902[_0x7b4c('0x15')][_0x7b4c('0x16')]);return _0x570daa(_0x28e902[_0x7b4c('0x15')][_0x7b4c('0x16')]);}logger[_0x7b4c('0x15')](_0x7b4c('0xf'),_0x4bf85d,_0x28e902[_0x7b4c('0x15')]['message']);return _0x21687f(_0x28e902[_0x7b4c('0x15')][_0x7b4c('0x16')]);}else{logger[_0x7b4c('0xe')](_0x7b4c('0xf'),_0x4bf85d,_0x7b4c('0x10'));_0x21687f(_0x28e902[_0x7b4c('0x17')][_0x7b4c('0x16')]);}})[_0x7b4c('0x18')](function(_0x4d3f5e){logger[_0x7b4c('0x15')](_0x7b4c('0xf'),_0x4bf85d,_0x4d3f5e);_0x570daa(_0x4d3f5e);});});} \ No newline at end of file diff --git a/server/api/intSalesforceAccount/index.js b/server/api/intSalesforceAccount/index.js index b5c9943..01d552f 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 _0xa9e0=['Router','../../components/auth/service','../../components/interaction/service','../../config/environment','./intSalesforceAccount.controller','get','index','/:id','getConfigurations','/:id/fields','isAuthenticated','getFields','post','addConfiguration','put','update','destroy','exports','multer','util','path'];(function(_0x5a8f0a,_0x3ad278){var _0x4d3eae=function(_0x705bba){while(--_0x705bba){_0x5a8f0a['push'](_0x5a8f0a['shift']());}};_0x4d3eae(++_0x3ad278);}(_0xa9e0,0x123));var _0x0a9e=function(_0x43d11d,_0xccff91){_0x43d11d=_0x43d11d-0x0;var _0x38cd08=_0xa9e0[_0x43d11d];return _0x38cd08;};'use strict';var multer=require(_0x0a9e('0x0'));var util=require(_0x0a9e('0x1'));var path=require(_0x0a9e('0x2'));var timeout=require('connect-timeout');var express=require('express');var router=express[_0x0a9e('0x3')]();var fs_extra=require('fs-extra');var auth=require(_0x0a9e('0x4'));var interaction=require(_0x0a9e('0x5'));var config=require(_0x0a9e('0x6'));var controller=require(_0x0a9e('0x7'));router[_0x0a9e('0x8')]('/',auth['isAuthenticated'](),controller[_0x0a9e('0x9')]);router[_0x0a9e('0x8')](_0x0a9e('0xa'),auth['isAuthenticated'](),controller['show']);router[_0x0a9e('0x8')]('/:id/configurations',auth['isAuthenticated'](),controller[_0x0a9e('0xb')]);router[_0x0a9e('0x8')](_0x0a9e('0xc'),auth[_0x0a9e('0xd')](),controller[_0x0a9e('0xe')]);router[_0x0a9e('0xf')]('/',auth['isAuthenticated'](),controller['create']);router['post']('/:id/configurations',auth[_0x0a9e('0xd')](),controller[_0x0a9e('0x10')]);router[_0x0a9e('0x11')](_0x0a9e('0xa'),auth[_0x0a9e('0xd')](),controller[_0x0a9e('0x12')]);router['delete'](_0x0a9e('0xa'),auth[_0x0a9e('0xd')](),controller[_0x0a9e('0x13')]);module[_0x0a9e('0x14')]=router; \ No newline at end of file +var _0xa9e0=['Router','../../components/auth/service','../../components/interaction/service','../../config/environment','./intSalesforceAccount.controller','get','index','/:id','getConfigurations','/:id/fields','isAuthenticated','getFields','post','addConfiguration','put','update','destroy','exports','multer','util','path'];(function(_0x655065,_0x258776){var _0x543789=function(_0x4c2a77){while(--_0x4c2a77){_0x655065['push'](_0x655065['shift']());}};_0x543789(++_0x258776);}(_0xa9e0,0x123));var _0x0a9e=function(_0x38a7ac,_0x45514b){_0x38a7ac=_0x38a7ac-0x0;var _0x53061a=_0xa9e0[_0x38a7ac];return _0x53061a;};'use strict';var multer=require(_0x0a9e('0x0'));var util=require(_0x0a9e('0x1'));var path=require(_0x0a9e('0x2'));var timeout=require('connect-timeout');var express=require('express');var router=express[_0x0a9e('0x3')]();var fs_extra=require('fs-extra');var auth=require(_0x0a9e('0x4'));var interaction=require(_0x0a9e('0x5'));var config=require(_0x0a9e('0x6'));var controller=require(_0x0a9e('0x7'));router[_0x0a9e('0x8')]('/',auth['isAuthenticated'](),controller[_0x0a9e('0x9')]);router[_0x0a9e('0x8')](_0x0a9e('0xa'),auth['isAuthenticated'](),controller['show']);router[_0x0a9e('0x8')]('/:id/configurations',auth['isAuthenticated'](),controller[_0x0a9e('0xb')]);router[_0x0a9e('0x8')](_0x0a9e('0xc'),auth[_0x0a9e('0xd')](),controller[_0x0a9e('0xe')]);router[_0x0a9e('0xf')]('/',auth['isAuthenticated'](),controller['create']);router['post']('/:id/configurations',auth[_0x0a9e('0xd')](),controller[_0x0a9e('0x10')]);router[_0x0a9e('0x11')](_0x0a9e('0xa'),auth[_0x0a9e('0xd')](),controller[_0x0a9e('0x12')]);router['delete'](_0x0a9e('0xa'),auth[_0x0a9e('0xd')](),controller[_0x0a9e('0x13')]);module[_0x0a9e('0x14')]=router; \ No newline at end of file diff --git a/server/api/intSalesforceAccount/intSalesforceAccount.attributes.js b/server/api/intSalesforceAccount/intSalesforceAccount.attributes.js index bdadf8b..20e799b 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 _0x72e4=['exports','STRING','username','ENUM','newTab','integrationTab','sequelize'];(function(_0x3f9caf,_0x6289e){var _0x3f96ea=function(_0x579f9e){while(--_0x579f9e){_0x3f9caf['push'](_0x3f9caf['shift']());}};_0x3f96ea(++_0x6289e);}(_0x72e4,0xae));var _0x472e=function(_0x21fb4d,_0xcc8412){_0x21fb4d=_0x21fb4d-0x0;var _0x522758=_0x72e4[_0x21fb4d];return _0x522758;};'use strict';var Sequelize=require(_0x472e('0x0'));module[_0x472e('0x1')]={'name':{'type':Sequelize[_0x472e('0x2')]},'description':{'type':Sequelize[_0x472e('0x2')]},'username':{'type':Sequelize['STRING'],'unique':_0x472e('0x3')},'remoteUri':{'type':Sequelize['STRING']},'password':{'type':Sequelize['STRING']},'clientId':{'type':Sequelize[_0x472e('0x2')]},'clientSecret':{'type':Sequelize['STRING']},'securityToken':{'type':Sequelize[_0x472e('0x2')]},'serverUrl':{'type':Sequelize[_0x472e('0x2')],'allowNull':![]},'type':{'type':Sequelize[_0x472e('0x4')]('integrationTab',_0x472e('0x5')),'defaultValue':_0x472e('0x6')}}; \ No newline at end of file +var _0xdf8d=['sequelize','exports','STRING','ENUM','integrationTab','newTab'];(function(_0x513aa5,_0x1fba79){var _0x1a1a7c=function(_0x240e3f){while(--_0x240e3f){_0x513aa5['push'](_0x513aa5['shift']());}};_0x1a1a7c(++_0x1fba79);}(_0xdf8d,0x1e0));var _0xddf8=function(_0x2aecb2,_0x343312){_0x2aecb2=_0x2aecb2-0x0;var _0x3ebb80=_0xdf8d[_0x2aecb2];return _0x3ebb80;};'use strict';var Sequelize=require(_0xddf8('0x0'));module[_0xddf8('0x1')]={'name':{'type':Sequelize['STRING']},'description':{'type':Sequelize[_0xddf8('0x2')]},'username':{'type':Sequelize[_0xddf8('0x2')],'unique':'username'},'remoteUri':{'type':Sequelize[_0xddf8('0x2')]},'password':{'type':Sequelize[_0xddf8('0x2')]},'clientId':{'type':Sequelize[_0xddf8('0x2')]},'clientSecret':{'type':Sequelize[_0xddf8('0x2')]},'securityToken':{'type':Sequelize['STRING']},'serverUrl':{'type':Sequelize[_0xddf8('0x2')],'allowNull':![]},'type':{'type':Sequelize[_0xddf8('0x3')](_0xddf8('0x4'),_0xddf8('0x5')),'defaultValue':'integrationTab'}}; \ No newline at end of file diff --git a/server/api/intSalesforceAccount/intSalesforceAccount.controller.js b/server/api/intSalesforceAccount/intSalesforceAccount.controller.js index d6dfba1..ad6c09b 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 _0x9b98=['getFields,\x20%s,\x20%s,\x20%s','stringify','send','Wrong\x20credentials','eml-format','rimraf','fast-json-patch','moment','mustache','util','path','fs-extra','lodash','squel','crypto','jsforce','to-csv','querystring','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/environment','../../config/license/util','../../mysqldb','../../components/integrations/configuration','sendStatus','status','json','offset','undefined','limit','count','set','Content-Range','apply','reject','save','update','then','destroy','end','stack','name','map','SalesforceAccount','fieldName','type','key','model','query','keys','intersection','attributes','fields','length','hasOwnProperty','nolimit','order','sort','pick','filters','filter','merge','options','where','includeAll','include','findAll','catch','show','find','create','body','params','getConfigurations','findOne','SalesforceConfiguration','addConfiguration','AccountId','Subjects','getSubjects','channel','Descriptions','getDescriptions','SalesforceField','getFields','remoteUri','clientId','username','password','securityToken','slice','substring','lastIndexOf','clientSecret','login','concat','isNil','ticketType','describe','OwnerId','ActivityDate','IsReminderSet','IsRecurrence','string','int','picklist','boolean','textarea','phone','remove','includes','label','picklistValues','value','True','true','false','test','statusCode','error'];(function(_0xfb0281,_0x3ff38b){var _0x408dd3=function(_0x5d8017){while(--_0x5d8017){_0xfb0281['push'](_0xfb0281['shift']());}};_0x408dd3(++_0x3ff38b);}(_0x9b98,0xfc));var _0x89b9=function(_0x3e5086,_0x48f4a2){_0x3e5086=_0x3e5086-0x0;var _0xfeb102=_0x9b98[_0x3e5086];return _0xfeb102;};'use strict';var emlformat=require(_0x89b9('0x0'));var rimraf=require(_0x89b9('0x1'));var zipdir=require('zip-dir');var jsonpatch=require(_0x89b9('0x2'));var rp=require('request-promise');var moment=require(_0x89b9('0x3'));var BPromise=require('bluebird');var Mustache=require(_0x89b9('0x4'));var util=require(_0x89b9('0x5'));var path=require(_0x89b9('0x6'));var sox=require('sox');var csv=require('to-csv');var ejs=require('ejs');var fs=require('fs');var fs_extra=require(_0x89b9('0x7'));var _=require(_0x89b9('0x8'));var squel=require(_0x89b9('0x9'));var crypto=require(_0x89b9('0xa'));var jsforce=require(_0x89b9('0xb'));var deskjs=require('desk.js');var toCsv=require(_0x89b9('0xc'));var querystring=require(_0x89b9('0xd'));var Papa=require('papaparse');var Redis=require('ioredis');var authService=require(_0x89b9('0xe'));var qs=require(_0x89b9('0xf'));var as=require(_0x89b9('0x10'));var hardwareService=require(_0x89b9('0x11'));var logger=require(_0x89b9('0x12'))(_0x89b9('0x13'));var utils=require('../../config/utils');var config=require(_0x89b9('0x14'));var licenseUtil=require(_0x89b9('0x15'));var db=require(_0x89b9('0x16'))['db'];var integrations=require(_0x89b9('0x17'));function respondWithStatusCode(_0x52b7cc,_0x1220ec){_0x1220ec=_0x1220ec||0xcc;return function(_0x15f2b0){if(_0x15f2b0){return _0x52b7cc[_0x89b9('0x18')](_0x1220ec);}return _0x52b7cc[_0x89b9('0x19')](_0x1220ec)['end']();};}function respondWithResult(_0x23ca2f,_0x3f05f1){_0x3f05f1=_0x3f05f1||0xc8;return function(_0x2c5016){if(_0x2c5016){return _0x23ca2f[_0x89b9('0x19')](_0x3f05f1)[_0x89b9('0x1a')](_0x2c5016);}};}function respondWithFilteredResult(_0x3e02d8,_0x171430){return function(_0x2bdb83){if(_0x2bdb83){var _0x34f6f2=typeof _0x171430[_0x89b9('0x1b')]===_0x89b9('0x1c')&&typeof _0x171430[_0x89b9('0x1d')]===_0x89b9('0x1c');var _0x3de006=_0x2bdb83[_0x89b9('0x1e')];var _0x5a537b=_0x34f6f2?0x0:_0x171430['offset'];var _0x5ca6f5=_0x34f6f2?_0x2bdb83[_0x89b9('0x1e')]:_0x171430[_0x89b9('0x1b')]+_0x171430[_0x89b9('0x1d')];var _0x2c8cde;if(_0x5ca6f5>=_0x3de006){_0x5ca6f5=_0x3de006;_0x2c8cde=0xc8;}else{_0x2c8cde=0xce;}_0x3e02d8[_0x89b9('0x19')](_0x2c8cde);return _0x3e02d8[_0x89b9('0x1f')](_0x89b9('0x20'),_0x5a537b+'-'+_0x5ca6f5+'/'+_0x3de006)[_0x89b9('0x1a')](_0x2bdb83);}return null;};}function patchUpdates(_0xe63106){return function(_0x1b013d){try{jsonpatch[_0x89b9('0x21')](_0x1b013d,_0xe63106,!![]);}catch(_0x374829){return BPromise[_0x89b9('0x22')](_0x374829);}return _0x1b013d[_0x89b9('0x23')]();};}function saveUpdates(_0x45b841,_0x3183ae){return function(_0x1918cf){if(_0x1918cf){return _0x1918cf[_0x89b9('0x24')](_0x45b841)[_0x89b9('0x25')](function(_0x37391c){return _0x37391c;});}return null;};}function removeEntity(_0x2df4ae,_0x4a93ec){return function(_0x4b9384){if(_0x4b9384){return _0x4b9384[_0x89b9('0x26')]()[_0x89b9('0x25')](function(){_0x2df4ae[_0x89b9('0x19')](0xcc)[_0x89b9('0x27')]();});}};}function handleEntityNotFound(_0x3d5bff,_0x94fd8b){return function(_0x16c0f6){if(!_0x16c0f6){_0x3d5bff['sendStatus'](0x194);}return _0x16c0f6;};}function handleError(_0x287bf0,_0x7bfab1){_0x7bfab1=_0x7bfab1||0x1f4;return function(_0x2b3455){logger['error'](_0x2b3455[_0x89b9('0x28')]);if(_0x2b3455[_0x89b9('0x29')]){delete _0x2b3455[_0x89b9('0x29')];}_0x287bf0['status'](_0x7bfab1)['send'](_0x2b3455);};}exports['index']=function(_0x16df2f,_0x211806){var _0x5cc879={},_0x52d2b4={},_0x3ea59b={'count':0x0,'rows':[]};var _0x51766a=_[_0x89b9('0x2a')](db[_0x89b9('0x2b')]['rawAttributes'],function(_0x58e89a){return{'name':_0x58e89a[_0x89b9('0x2c')],'type':_0x58e89a[_0x89b9('0x2d')][_0x89b9('0x2e')]};});_0x52d2b4[_0x89b9('0x2f')]=_[_0x89b9('0x2a')](_0x51766a,_0x89b9('0x29'));_0x52d2b4[_0x89b9('0x30')]=_[_0x89b9('0x31')](_0x16df2f[_0x89b9('0x30')]);_0x52d2b4['filters']=_[_0x89b9('0x32')](_0x52d2b4[_0x89b9('0x2f')],_0x52d2b4[_0x89b9('0x30')]);_0x5cc879[_0x89b9('0x33')]=_['intersection'](_0x52d2b4[_0x89b9('0x2f')],qs[_0x89b9('0x34')](_0x16df2f[_0x89b9('0x30')][_0x89b9('0x34')]));_0x5cc879['attributes']=_0x5cc879[_0x89b9('0x33')][_0x89b9('0x35')]?_0x5cc879[_0x89b9('0x33')]:_0x52d2b4[_0x89b9('0x2f')];if(!_0x16df2f[_0x89b9('0x30')][_0x89b9('0x36')](_0x89b9('0x37'))){_0x5cc879[_0x89b9('0x1d')]=qs[_0x89b9('0x1d')](_0x16df2f[_0x89b9('0x30')][_0x89b9('0x1d')]);_0x5cc879[_0x89b9('0x1b')]=qs[_0x89b9('0x1b')](_0x16df2f['query'][_0x89b9('0x1b')]);}_0x5cc879[_0x89b9('0x38')]=qs[_0x89b9('0x39')](_0x16df2f[_0x89b9('0x30')][_0x89b9('0x39')]);_0x5cc879['where']=qs['filters'](_[_0x89b9('0x3a')](_0x16df2f[_0x89b9('0x30')],_0x52d2b4[_0x89b9('0x3b')]),_0x51766a);if(_0x16df2f[_0x89b9('0x30')][_0x89b9('0x3c')]){_0x5cc879['where']=_[_0x89b9('0x3d')](_0x5cc879['where'],{'$or':_['map'](_0x51766a,function(_0x2e7fcf){if(_0x2e7fcf[_0x89b9('0x2d')]!=='VIRTUAL'){var _0x27c29e={};_0x27c29e[_0x2e7fcf[_0x89b9('0x29')]]={'$like':'%'+_0x16df2f[_0x89b9('0x30')][_0x89b9('0x3c')]+'%'};return _0x27c29e;}})});}_0x5cc879=_[_0x89b9('0x3d')]({},_0x5cc879,_0x16df2f[_0x89b9('0x3e')]);var _0x238e8d={'where':_0x5cc879[_0x89b9('0x3f')]};return db[_0x89b9('0x2b')][_0x89b9('0x1e')](_0x238e8d)['then'](function(_0x5e5ce0){_0x3ea59b['count']=_0x5e5ce0;if(_0x16df2f[_0x89b9('0x30')][_0x89b9('0x40')]){_0x5cc879[_0x89b9('0x41')]=[{'all':!![]}];}return db[_0x89b9('0x2b')][_0x89b9('0x42')](_0x5cc879);})[_0x89b9('0x25')](function(_0x5eb9c9){_0x3ea59b['rows']=_0x5eb9c9;return _0x3ea59b;})[_0x89b9('0x25')](respondWithFilteredResult(_0x211806,_0x5cc879))[_0x89b9('0x43')](handleError(_0x211806,null));};exports[_0x89b9('0x44')]=function(_0x3ef49e,_0x357cea){var _0x285bac={'raw':![],'where':{'id':_0x3ef49e['params']['id']}},_0x5af2b0={};_0x5af2b0[_0x89b9('0x2f')]=_['keys'](db[_0x89b9('0x2b')]['rawAttributes']);_0x5af2b0[_0x89b9('0x30')]=_[_0x89b9('0x31')](_0x3ef49e[_0x89b9('0x30')]);_0x5af2b0[_0x89b9('0x3b')]=_['intersection'](_0x5af2b0[_0x89b9('0x2f')],_0x5af2b0['query']);_0x285bac[_0x89b9('0x33')]=_[_0x89b9('0x32')](_0x5af2b0[_0x89b9('0x2f')],qs[_0x89b9('0x34')](_0x3ef49e[_0x89b9('0x30')][_0x89b9('0x34')]));_0x285bac[_0x89b9('0x33')]=_0x285bac[_0x89b9('0x33')][_0x89b9('0x35')]?_0x285bac['attributes']:_0x5af2b0[_0x89b9('0x2f')];if(_0x3ef49e[_0x89b9('0x30')]['includeAll']){_0x285bac[_0x89b9('0x41')]=[{'all':!![]}];}_0x285bac=_[_0x89b9('0x3d')]({},_0x285bac,_0x3ef49e[_0x89b9('0x3e')]);return db['SalesforceAccount'][_0x89b9('0x45')](_0x285bac)[_0x89b9('0x25')](handleEntityNotFound(_0x357cea,null))['then'](respondWithResult(_0x357cea,null))[_0x89b9('0x43')](handleError(_0x357cea,null));};exports[_0x89b9('0x46')]=function(_0x5769e3,_0x2ab57e){return db[_0x89b9('0x2b')][_0x89b9('0x46')](_0x5769e3[_0x89b9('0x47')],{})[_0x89b9('0x25')](respondWithResult(_0x2ab57e,0xc9))[_0x89b9('0x43')](handleError(_0x2ab57e,null));};exports[_0x89b9('0x24')]=function(_0x5d762a,_0x54f8d1){if(_0x5d762a[_0x89b9('0x47')]['id']){delete _0x5d762a['body']['id'];}return db[_0x89b9('0x2b')][_0x89b9('0x45')]({'where':{'id':_0x5d762a['params']['id']}})[_0x89b9('0x25')](handleEntityNotFound(_0x54f8d1,null))['then'](saveUpdates(_0x5d762a[_0x89b9('0x47')],null))['then'](respondWithResult(_0x54f8d1,null))['catch'](handleError(_0x54f8d1,null));};exports[_0x89b9('0x26')]=function(_0xddb36c,_0x38deb3){return db[_0x89b9('0x2b')]['find']({'where':{'id':_0xddb36c[_0x89b9('0x48')]['id']}})[_0x89b9('0x25')](handleEntityNotFound(_0x38deb3,null))[_0x89b9('0x25')](removeEntity(_0x38deb3,null))['catch'](handleError(_0x38deb3,null));};exports[_0x89b9('0x49')]=function(_0x24f571,_0x548abb,_0x48d447){var _0x1b7d4b={};var _0x1ddc7f={};var _0x393460;var _0x490994;return db[_0x89b9('0x2b')][_0x89b9('0x4a')]({'where':{'id':_0x24f571[_0x89b9('0x48')]['id']}})[_0x89b9('0x25')](handleEntityNotFound(_0x548abb,null))[_0x89b9('0x25')](function(_0x1e771d){if(_0x1e771d){_0x393460=_0x1e771d;_0x1ddc7f[_0x89b9('0x2f')]=_[_0x89b9('0x31')](db[_0x89b9('0x4b')]['rawAttributes']);_0x1ddc7f[_0x89b9('0x30')]=_['keys'](_0x24f571[_0x89b9('0x30')]);_0x1ddc7f[_0x89b9('0x3b')]=_[_0x89b9('0x32')](_0x1ddc7f[_0x89b9('0x2f')],_0x1ddc7f['query']);_0x1b7d4b[_0x89b9('0x33')]=_[_0x89b9('0x32')](_0x1ddc7f[_0x89b9('0x2f')],qs['fields'](_0x24f571[_0x89b9('0x30')][_0x89b9('0x34')]));_0x1b7d4b[_0x89b9('0x33')]=_0x1b7d4b[_0x89b9('0x33')]['length']?_0x1b7d4b['attributes']:_0x1ddc7f[_0x89b9('0x2f')];_0x1b7d4b[_0x89b9('0x38')]=qs['sort'](_0x24f571[_0x89b9('0x30')][_0x89b9('0x39')]);_0x1b7d4b['where']=qs[_0x89b9('0x3b')](_[_0x89b9('0x3a')](_0x24f571[_0x89b9('0x30')],_0x1ddc7f[_0x89b9('0x3b')]));if(_0x24f571[_0x89b9('0x30')][_0x89b9('0x3c')]){_0x1b7d4b['where']=_[_0x89b9('0x3d')](_0x1b7d4b[_0x89b9('0x3f')],{'$or':_[_0x89b9('0x2a')](_0x1b7d4b[_0x89b9('0x33')],function(_0x259f80){var _0x3d62eb={};_0x3d62eb[_0x259f80]={'$like':'%'+_0x24f571[_0x89b9('0x30')]['filter']+'%'};return _0x3d62eb;})});}_0x1b7d4b=_[_0x89b9('0x3d')]({},_0x1b7d4b,_0x24f571['options']);return _0x393460[_0x89b9('0x49')](_0x1b7d4b);}})[_0x89b9('0x25')](function(_0xebcd99){if(_0xebcd99){_0x490994=_0xebcd99[_0x89b9('0x35')];if(!_0x24f571[_0x89b9('0x30')][_0x89b9('0x36')](_0x89b9('0x37'))){_0x1b7d4b[_0x89b9('0x1d')]=qs[_0x89b9('0x1d')](_0x24f571[_0x89b9('0x30')][_0x89b9('0x1d')]);_0x1b7d4b[_0x89b9('0x1b')]=qs[_0x89b9('0x1b')](_0x24f571[_0x89b9('0x30')][_0x89b9('0x1b')]);}return _0x393460[_0x89b9('0x49')](_0x1b7d4b);}})[_0x89b9('0x25')](function(_0x1e8e6a){if(_0x1e8e6a){return _0x1e8e6a?{'count':_0x490994,'rows':_0x1e8e6a}:null;}})[_0x89b9('0x25')](respondWithResult(_0x548abb,null))[_0x89b9('0x43')](handleError(_0x548abb,null));};exports[_0x89b9('0x4c')]=function(_0xd4e634,_0x564a1c,_0x38f673){if(_0xd4e634[_0x89b9('0x47')]['id']){delete _0xd4e634[_0x89b9('0x47')]['id'];}return db[_0x89b9('0x2b')][_0x89b9('0x4a')]({'where':{'id':_0xd4e634['params']['id']}})['then'](handleEntityNotFound(_0x564a1c,null))[_0x89b9('0x25')](function(_0x4168b3){if(_0x4168b3){_0xd4e634['body'][_0x89b9('0x4d')]=_0x4168b3['id'];_0xd4e634[_0x89b9('0x47')][_0x89b9('0x4e')]=integrations[_0x89b9('0x4f')](_0xd4e634[_0x89b9('0x47')][_0x89b9('0x50')],_0xd4e634[_0x89b9('0x47')][_0x89b9('0x2d')]);_0xd4e634['body'][_0x89b9('0x51')]=integrations[_0x89b9('0x52')](_0xd4e634['body'][_0x89b9('0x50')],_0xd4e634[_0x89b9('0x47')][_0x89b9('0x2d')]);return db[_0x89b9('0x4b')]['create'](_0xd4e634[_0x89b9('0x47')],{'include':[{'model':db[_0x89b9('0x53')],'as':_0x89b9('0x4e')},{'model':db[_0x89b9('0x53')],'as':'Descriptions'}]});}return null;})[_0x89b9('0x25')](respondWithResult(_0x564a1c,null))[_0x89b9('0x43')](handleError(_0x564a1c,null));};exports[_0x89b9('0x54')]=function(_0x34b268,_0x41ea64,_0x1313ae){var _0x44d27b;var _0x418c3d='';var _0x7eafff='Task';return db[_0x89b9('0x2b')]['findOne']({'where':{'id':_0x34b268[_0x89b9('0x48')]['id']},'attributes':['id',_0x89b9('0x55'),_0x89b9('0x56'),'clientSecret',_0x89b9('0x57'),_0x89b9('0x58'),_0x89b9('0x59')]})['then'](handleEntityNotFound(_0x41ea64,null))[_0x89b9('0x25')](function(_0x312ccd){if(_0x312ccd){_0x418c3d=_0x312ccd['remoteUri'];var _0x22b294=_0x418c3d[_0x89b9('0x5a')](-0x1);if(_0x22b294==='/'){_0x418c3d=_0x418c3d[_0x89b9('0x5b')](0x0,_0x418c3d[_0x89b9('0x5c')](_0x22b294));}_0x44d27b=new jsforce['Connection']({'oauth2':{'loginUrl':_0x418c3d,'clientId':_0x312ccd[_0x89b9('0x56')],'clientSecret':_0x312ccd[_0x89b9('0x5d')]}});return _0x44d27b[_0x89b9('0x5e')](_0x312ccd[_0x89b9('0x57')],_0x312ccd[_0x89b9('0x58')][_0x89b9('0x5f')](_0x312ccd[_0x89b9('0x59')]));}})[_0x89b9('0x25')](function(_0xdca9af){if(_0xdca9af){if(!_[_0x89b9('0x60')](_0x34b268[_0x89b9('0x30')][_0x89b9('0x61')])){_0x7eafff=_0x34b268[_0x89b9('0x30')][_0x89b9('0x61')];}return _0x44d27b['sobject'](_0x7eafff)[_0x89b9('0x62')]();}})[_0x89b9('0x25')](function(_0x46300a){var _0x525aed=[_0x89b9('0x63'),_0x89b9('0x64'),_0x89b9('0x65'),_0x89b9('0x66'),'Subject','Description'];var _0x1169f7=[_0x89b9('0x67'),_0x89b9('0x68'),_0x89b9('0x69'),_0x89b9('0x6a'),'email',_0x89b9('0x6b'),_0x89b9('0x6c')];if(_0x46300a){_[_0x89b9('0x6d')](_0x46300a['fields'],function(_0x37b938){return _0x525aed[_0x89b9('0x6e')](_0x37b938[_0x89b9('0x29')])||!_0x1169f7['includes'](_0x37b938[_0x89b9('0x2d')]);});return{'count':_0x46300a['fields'][_0x89b9('0x35')],'rows':_[_0x89b9('0x2a')](_0x46300a[_0x89b9('0x34')],function(_0x38cb8d){return{'id':_0x38cb8d[_0x89b9('0x29')],'name':_0x38cb8d[_0x89b9('0x6f')],'custom':_0x38cb8d['custom'],'options':_0x38cb8d[_0x89b9('0x70')][_0x89b9('0x35')]>0x0?_[_0x89b9('0x2a')](_0x38cb8d['picklistValues'],function(_0x52cf1e){return{'name':_0x52cf1e['label'],'value':_0x52cf1e[_0x89b9('0x71')]};}):_0x38cb8d[_0x89b9('0x2d')]=='boolean'?[{'name':_0x89b9('0x72'),'value':_0x89b9('0x73')},{'name':'False','value':_0x89b9('0x74')}]:[]};})};}})['then'](respondWithResult(_0x41ea64,null))[_0x89b9('0x43')](function(_0x46cc5d){var _0x5228a1=_0x34b268[_0x89b9('0x30')][_0x89b9('0x75')]?0x1f4:_0x46cc5d[_0x89b9('0x76')]||0x1f4;logger[_0x89b9('0x77')](_0x89b9('0x78'),_0x89b9('0x54'),_0x5228a1,JSON[_0x89b9('0x79')](_0x46cc5d));delete _0x46cc5d[_0x89b9('0x29')];if(_0x5228a1===0x191){_0x5228a1=0x190;}_0x41ea64[_0x89b9('0x19')](_0x5228a1)[_0x89b9('0x7a')](_0x34b268[_0x89b9('0x30')][_0x89b9('0x75')]?{'message':_0x89b9('0x7b'),'statusCode':_0x46cc5d['statusCode']}:_0x46cc5d);});}; \ No newline at end of file +var _0x06f2=['securityToken','Connection','clientId','login','ticketType','describe','OwnerId','IsReminderSet','Subject','Description','string','int','picklist','boolean','email','textarea','phone','includes','label','custom','picklistValues','True','true','False','false','test','getFields,\x20%s,\x20%s,\x20%s','Wrong\x20credentials','statusCode','rimraf','zip-dir','fast-json-patch','request-promise','moment','mustache','util','path','sox','to-csv','fs-extra','squel','crypto','jsforce','desk.js','querystring','papaparse','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/logger','api','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','../../components/integrations/configuration','status','end','json','offset','limit','undefined','count','apply','reject','save','update','then','error','stack','name','send','map','fieldName','key','model','query','keys','filters','intersection','attributes','fields','length','hasOwnProperty','order','sort','where','pick','merge','type','VIRTUAL','filter','SalesforceAccount','include','rows','show','params','rawAttributes','includeAll','find','catch','create','body','destroy','SalesforceConfiguration','options','addConfiguration','findOne','AccountId','Subjects','getSubjects','channel','Descriptions','getDescriptions','SalesforceField','getFields','Task','remoteUri','clientSecret','username','password'];(function(_0x59d89e,_0x55edf5){var _0x554e93=function(_0x3d40bc){while(--_0x3d40bc){_0x59d89e['push'](_0x59d89e['shift']());}};_0x554e93(++_0x55edf5);}(_0x06f2,0x96));var _0x206f=function(_0x3eeddf,_0x1d7042){_0x3eeddf=_0x3eeddf-0x0;var _0x52d1e9=_0x06f2[_0x3eeddf];return _0x52d1e9;};'use strict';var emlformat=require('eml-format');var rimraf=require(_0x206f('0x0'));var zipdir=require(_0x206f('0x1'));var jsonpatch=require(_0x206f('0x2'));var rp=require(_0x206f('0x3'));var moment=require(_0x206f('0x4'));var BPromise=require('bluebird');var Mustache=require(_0x206f('0x5'));var util=require(_0x206f('0x6'));var path=require(_0x206f('0x7'));var sox=require(_0x206f('0x8'));var csv=require(_0x206f('0x9'));var ejs=require('ejs');var fs=require('fs');var fs_extra=require(_0x206f('0xa'));var _=require('lodash');var squel=require(_0x206f('0xb'));var crypto=require(_0x206f('0xc'));var jsforce=require(_0x206f('0xd'));var deskjs=require(_0x206f('0xe'));var toCsv=require(_0x206f('0x9'));var querystring=require(_0x206f('0xf'));var Papa=require(_0x206f('0x10'));var Redis=require('ioredis');var authService=require(_0x206f('0x11'));var qs=require(_0x206f('0x12'));var as=require(_0x206f('0x13'));var hardwareService=require('../../config/license/hardware');var logger=require(_0x206f('0x14'))(_0x206f('0x15'));var utils=require(_0x206f('0x16'));var config=require(_0x206f('0x17'));var licenseUtil=require(_0x206f('0x18'));var db=require(_0x206f('0x19'))['db'];var integrations=require(_0x206f('0x1a'));function respondWithStatusCode(_0x53b191,_0x5aef6f){_0x5aef6f=_0x5aef6f||0xcc;return function(_0x164dad){if(_0x164dad){return _0x53b191['sendStatus'](_0x5aef6f);}return _0x53b191[_0x206f('0x1b')](_0x5aef6f)[_0x206f('0x1c')]();};}function respondWithResult(_0x26da15,_0x1a08bc){_0x1a08bc=_0x1a08bc||0xc8;return function(_0x2ec01e){if(_0x2ec01e){return _0x26da15['status'](_0x1a08bc)[_0x206f('0x1d')](_0x2ec01e);}};}function respondWithFilteredResult(_0x526857,_0x57a423){return function(_0x286bee){if(_0x286bee){var _0x19b61e=typeof _0x57a423[_0x206f('0x1e')]==='undefined'&&typeof _0x57a423[_0x206f('0x1f')]===_0x206f('0x20');var _0x541808=_0x286bee[_0x206f('0x21')];var _0xb438f9=_0x19b61e?0x0:_0x57a423[_0x206f('0x1e')];var _0x35ddb3=_0x19b61e?_0x286bee[_0x206f('0x21')]:_0x57a423['offset']+_0x57a423['limit'];var _0x5b2055;if(_0x35ddb3>=_0x541808){_0x35ddb3=_0x541808;_0x5b2055=0xc8;}else{_0x5b2055=0xce;}_0x526857[_0x206f('0x1b')](_0x5b2055);return _0x526857['set']('Content-Range',_0xb438f9+'-'+_0x35ddb3+'/'+_0x541808)[_0x206f('0x1d')](_0x286bee);}return null;};}function patchUpdates(_0x1fc545){return function(_0x19c7ea){try{jsonpatch[_0x206f('0x22')](_0x19c7ea,_0x1fc545,!![]);}catch(_0x4a53b4){return BPromise[_0x206f('0x23')](_0x4a53b4);}return _0x19c7ea[_0x206f('0x24')]();};}function saveUpdates(_0x312f56,_0x5ed021){return function(_0x48e90a){if(_0x48e90a){return _0x48e90a[_0x206f('0x25')](_0x312f56)[_0x206f('0x26')](function(_0x3558ff){return _0x3558ff;});}return null;};}function removeEntity(_0x33ef80,_0x1ef888){return function(_0xa74d6b){if(_0xa74d6b){return _0xa74d6b['destroy']()[_0x206f('0x26')](function(){_0x33ef80[_0x206f('0x1b')](0xcc)[_0x206f('0x1c')]();});}};}function handleEntityNotFound(_0x22a84a,_0x46b62a){return function(_0x420fa1){if(!_0x420fa1){_0x22a84a['sendStatus'](0x194);}return _0x420fa1;};}function handleError(_0x4d535e,_0x425caf){_0x425caf=_0x425caf||0x1f4;return function(_0x3c20b6){logger[_0x206f('0x27')](_0x3c20b6[_0x206f('0x28')]);if(_0x3c20b6[_0x206f('0x29')]){delete _0x3c20b6[_0x206f('0x29')];}_0x4d535e[_0x206f('0x1b')](_0x425caf)[_0x206f('0x2a')](_0x3c20b6);};}exports['index']=function(_0x8e16ce,_0x334920){var _0x75936d={},_0x44c4f9={},_0x30585d={'count':0x0,'rows':[]};var _0x1c1a33=_[_0x206f('0x2b')](db['SalesforceAccount']['rawAttributes'],function(_0x10e74d){return{'name':_0x10e74d[_0x206f('0x2c')],'type':_0x10e74d['type'][_0x206f('0x2d')]};});_0x44c4f9[_0x206f('0x2e')]=_[_0x206f('0x2b')](_0x1c1a33,_0x206f('0x29'));_0x44c4f9[_0x206f('0x2f')]=_[_0x206f('0x30')](_0x8e16ce[_0x206f('0x2f')]);_0x44c4f9[_0x206f('0x31')]=_[_0x206f('0x32')](_0x44c4f9[_0x206f('0x2e')],_0x44c4f9[_0x206f('0x2f')]);_0x75936d[_0x206f('0x33')]=_['intersection'](_0x44c4f9['model'],qs[_0x206f('0x34')](_0x8e16ce[_0x206f('0x2f')][_0x206f('0x34')]));_0x75936d[_0x206f('0x33')]=_0x75936d[_0x206f('0x33')][_0x206f('0x35')]?_0x75936d['attributes']:_0x44c4f9[_0x206f('0x2e')];if(!_0x8e16ce[_0x206f('0x2f')][_0x206f('0x36')]('nolimit')){_0x75936d[_0x206f('0x1f')]=qs[_0x206f('0x1f')](_0x8e16ce[_0x206f('0x2f')][_0x206f('0x1f')]);_0x75936d['offset']=qs[_0x206f('0x1e')](_0x8e16ce['query']['offset']);}_0x75936d[_0x206f('0x37')]=qs[_0x206f('0x38')](_0x8e16ce[_0x206f('0x2f')][_0x206f('0x38')]);_0x75936d[_0x206f('0x39')]=qs[_0x206f('0x31')](_[_0x206f('0x3a')](_0x8e16ce[_0x206f('0x2f')],_0x44c4f9['filters']),_0x1c1a33);if(_0x8e16ce[_0x206f('0x2f')]['filter']){_0x75936d['where']=_[_0x206f('0x3b')](_0x75936d[_0x206f('0x39')],{'$or':_[_0x206f('0x2b')](_0x1c1a33,function(_0x37898f){if(_0x37898f[_0x206f('0x3c')]!==_0x206f('0x3d')){var _0x30075f={};_0x30075f[_0x37898f[_0x206f('0x29')]]={'$like':'%'+_0x8e16ce[_0x206f('0x2f')][_0x206f('0x3e')]+'%'};return _0x30075f;}})});}_0x75936d=_[_0x206f('0x3b')]({},_0x75936d,_0x8e16ce['options']);var _0x42c43d={'where':_0x75936d[_0x206f('0x39')]};return db[_0x206f('0x3f')][_0x206f('0x21')](_0x42c43d)[_0x206f('0x26')](function(_0x24cc9d){_0x30585d[_0x206f('0x21')]=_0x24cc9d;if(_0x8e16ce[_0x206f('0x2f')]['includeAll']){_0x75936d[_0x206f('0x40')]=[{'all':!![]}];}return db[_0x206f('0x3f')]['findAll'](_0x75936d);})['then'](function(_0x9050ca){_0x30585d[_0x206f('0x41')]=_0x9050ca;return _0x30585d;})[_0x206f('0x26')](respondWithFilteredResult(_0x334920,_0x75936d))['catch'](handleError(_0x334920,null));};exports[_0x206f('0x42')]=function(_0x3d891e,_0x208ea6){var _0x1a845d={'raw':![],'where':{'id':_0x3d891e[_0x206f('0x43')]['id']}},_0x492111={};_0x492111[_0x206f('0x2e')]=_['keys'](db[_0x206f('0x3f')][_0x206f('0x44')]);_0x492111[_0x206f('0x2f')]=_['keys'](_0x3d891e['query']);_0x492111[_0x206f('0x31')]=_[_0x206f('0x32')](_0x492111[_0x206f('0x2e')],_0x492111[_0x206f('0x2f')]);_0x1a845d[_0x206f('0x33')]=_[_0x206f('0x32')](_0x492111[_0x206f('0x2e')],qs[_0x206f('0x34')](_0x3d891e['query'][_0x206f('0x34')]));_0x1a845d[_0x206f('0x33')]=_0x1a845d[_0x206f('0x33')]['length']?_0x1a845d[_0x206f('0x33')]:_0x492111[_0x206f('0x2e')];if(_0x3d891e[_0x206f('0x2f')][_0x206f('0x45')]){_0x1a845d[_0x206f('0x40')]=[{'all':!![]}];}_0x1a845d=_[_0x206f('0x3b')]({},_0x1a845d,_0x3d891e['options']);return db[_0x206f('0x3f')][_0x206f('0x46')](_0x1a845d)[_0x206f('0x26')](handleEntityNotFound(_0x208ea6,null))[_0x206f('0x26')](respondWithResult(_0x208ea6,null))[_0x206f('0x47')](handleError(_0x208ea6,null));};exports[_0x206f('0x48')]=function(_0x3b89dd,_0x2788da){return db[_0x206f('0x3f')][_0x206f('0x48')](_0x3b89dd['body'],{})[_0x206f('0x26')](respondWithResult(_0x2788da,0xc9))['catch'](handleError(_0x2788da,null));};exports[_0x206f('0x25')]=function(_0xff312a,_0x4d91eb){if(_0xff312a[_0x206f('0x49')]['id']){delete _0xff312a['body']['id'];}return db[_0x206f('0x3f')][_0x206f('0x46')]({'where':{'id':_0xff312a['params']['id']}})[_0x206f('0x26')](handleEntityNotFound(_0x4d91eb,null))[_0x206f('0x26')](saveUpdates(_0xff312a[_0x206f('0x49')],null))[_0x206f('0x26')](respondWithResult(_0x4d91eb,null))['catch'](handleError(_0x4d91eb,null));};exports[_0x206f('0x4a')]=function(_0x3ccfb1,_0x59f4ab){return db['SalesforceAccount'][_0x206f('0x46')]({'where':{'id':_0x3ccfb1['params']['id']}})[_0x206f('0x26')](handleEntityNotFound(_0x59f4ab,null))[_0x206f('0x26')](removeEntity(_0x59f4ab,null))[_0x206f('0x47')](handleError(_0x59f4ab,null));};exports['getConfigurations']=function(_0x3de406,_0x3d81ee,_0x71e03b){var _0x493a65={};var _0x1b87bf={};var _0x154535;var _0xb873ef;return db[_0x206f('0x3f')]['findOne']({'where':{'id':_0x3de406['params']['id']}})[_0x206f('0x26')](handleEntityNotFound(_0x3d81ee,null))['then'](function(_0x2709b0){if(_0x2709b0){_0x154535=_0x2709b0;_0x1b87bf[_0x206f('0x2e')]=_[_0x206f('0x30')](db[_0x206f('0x4b')]['rawAttributes']);_0x1b87bf['query']=_[_0x206f('0x30')](_0x3de406[_0x206f('0x2f')]);_0x1b87bf[_0x206f('0x31')]=_[_0x206f('0x32')](_0x1b87bf['model'],_0x1b87bf['query']);_0x493a65[_0x206f('0x33')]=_[_0x206f('0x32')](_0x1b87bf[_0x206f('0x2e')],qs['fields'](_0x3de406['query'][_0x206f('0x34')]));_0x493a65['attributes']=_0x493a65[_0x206f('0x33')]['length']?_0x493a65['attributes']:_0x1b87bf['model'];_0x493a65['order']=qs[_0x206f('0x38')](_0x3de406[_0x206f('0x2f')][_0x206f('0x38')]);_0x493a65[_0x206f('0x39')]=qs[_0x206f('0x31')](_[_0x206f('0x3a')](_0x3de406['query'],_0x1b87bf[_0x206f('0x31')]));if(_0x3de406[_0x206f('0x2f')][_0x206f('0x3e')]){_0x493a65[_0x206f('0x39')]=_[_0x206f('0x3b')](_0x493a65[_0x206f('0x39')],{'$or':_['map'](_0x493a65[_0x206f('0x33')],function(_0x4e0e61){var _0x4ef98f={};_0x4ef98f[_0x4e0e61]={'$like':'%'+_0x3de406[_0x206f('0x2f')][_0x206f('0x3e')]+'%'};return _0x4ef98f;})});}_0x493a65=_[_0x206f('0x3b')]({},_0x493a65,_0x3de406[_0x206f('0x4c')]);return _0x154535['getConfigurations'](_0x493a65);}})[_0x206f('0x26')](function(_0x35f41f){if(_0x35f41f){_0xb873ef=_0x35f41f[_0x206f('0x35')];if(!_0x3de406['query'][_0x206f('0x36')]('nolimit')){_0x493a65[_0x206f('0x1f')]=qs['limit'](_0x3de406[_0x206f('0x2f')][_0x206f('0x1f')]);_0x493a65[_0x206f('0x1e')]=qs[_0x206f('0x1e')](_0x3de406[_0x206f('0x2f')][_0x206f('0x1e')]);}return _0x154535['getConfigurations'](_0x493a65);}})[_0x206f('0x26')](function(_0x3c9651){if(_0x3c9651){return _0x3c9651?{'count':_0xb873ef,'rows':_0x3c9651}:null;}})[_0x206f('0x26')](respondWithResult(_0x3d81ee,null))[_0x206f('0x47')](handleError(_0x3d81ee,null));};exports[_0x206f('0x4d')]=function(_0x868f2a,_0x1c1e5f,_0x261bc5){if(_0x868f2a[_0x206f('0x49')]['id']){delete _0x868f2a[_0x206f('0x49')]['id'];}return db[_0x206f('0x3f')][_0x206f('0x4e')]({'where':{'id':_0x868f2a[_0x206f('0x43')]['id']}})['then'](handleEntityNotFound(_0x1c1e5f,null))[_0x206f('0x26')](function(_0xe0ab9e){if(_0xe0ab9e){_0x868f2a['body'][_0x206f('0x4f')]=_0xe0ab9e['id'];_0x868f2a[_0x206f('0x49')][_0x206f('0x50')]=integrations[_0x206f('0x51')](_0x868f2a[_0x206f('0x49')][_0x206f('0x52')],_0x868f2a['body'][_0x206f('0x3c')]);_0x868f2a['body'][_0x206f('0x53')]=integrations[_0x206f('0x54')](_0x868f2a[_0x206f('0x49')][_0x206f('0x52')],_0x868f2a[_0x206f('0x49')][_0x206f('0x3c')]);return db[_0x206f('0x4b')][_0x206f('0x48')](_0x868f2a[_0x206f('0x49')],{'include':[{'model':db[_0x206f('0x55')],'as':_0x206f('0x50')},{'model':db[_0x206f('0x55')],'as':_0x206f('0x53')}]});}return null;})[_0x206f('0x26')](respondWithResult(_0x1c1e5f,null))[_0x206f('0x47')](handleError(_0x1c1e5f,null));};exports[_0x206f('0x56')]=function(_0x100cf9,_0x5b391f,_0x507936){var _0x16d76d;var _0x56bcae='';var _0x2f56bb=_0x206f('0x57');return db[_0x206f('0x3f')]['findOne']({'where':{'id':_0x100cf9[_0x206f('0x43')]['id']},'attributes':['id',_0x206f('0x58'),'clientId',_0x206f('0x59'),_0x206f('0x5a'),_0x206f('0x5b'),_0x206f('0x5c')]})[_0x206f('0x26')](handleEntityNotFound(_0x5b391f,null))[_0x206f('0x26')](function(_0x27ff27){if(_0x27ff27){_0x56bcae=_0x27ff27[_0x206f('0x58')];var _0x475941=_0x56bcae['slice'](-0x1);if(_0x475941==='/'){_0x56bcae=_0x56bcae['substring'](0x0,_0x56bcae['lastIndexOf'](_0x475941));}_0x16d76d=new jsforce[(_0x206f('0x5d'))]({'oauth2':{'loginUrl':_0x56bcae,'clientId':_0x27ff27[_0x206f('0x5e')],'clientSecret':_0x27ff27[_0x206f('0x59')]}});return _0x16d76d[_0x206f('0x5f')](_0x27ff27[_0x206f('0x5a')],_0x27ff27[_0x206f('0x5b')]['concat'](_0x27ff27[_0x206f('0x5c')]));}})[_0x206f('0x26')](function(_0x226489){if(_0x226489){if(!_['isNil'](_0x100cf9[_0x206f('0x2f')]['ticketType'])){_0x2f56bb=_0x100cf9[_0x206f('0x2f')][_0x206f('0x60')];}return _0x16d76d['sobject'](_0x2f56bb)[_0x206f('0x61')]();}})['then'](function(_0x489624){var _0x425275=[_0x206f('0x62'),'ActivityDate',_0x206f('0x63'),'IsRecurrence',_0x206f('0x64'),_0x206f('0x65')];var _0xa82d01=[_0x206f('0x66'),_0x206f('0x67'),_0x206f('0x68'),_0x206f('0x69'),_0x206f('0x6a'),_0x206f('0x6b'),_0x206f('0x6c')];if(_0x489624){_['remove'](_0x489624[_0x206f('0x34')],function(_0x418bd1){return _0x425275[_0x206f('0x6d')](_0x418bd1[_0x206f('0x29')])||!_0xa82d01[_0x206f('0x6d')](_0x418bd1[_0x206f('0x3c')]);});return{'count':_0x489624[_0x206f('0x34')][_0x206f('0x35')],'rows':_[_0x206f('0x2b')](_0x489624[_0x206f('0x34')],function(_0x211661){return{'id':_0x211661['name'],'name':_0x211661[_0x206f('0x6e')],'custom':_0x211661[_0x206f('0x6f')],'options':_0x211661['picklistValues'][_0x206f('0x35')]>0x0?_[_0x206f('0x2b')](_0x211661[_0x206f('0x70')],function(_0x48dd3a){return{'name':_0x48dd3a[_0x206f('0x6e')],'value':_0x48dd3a['value']};}):_0x211661[_0x206f('0x3c')]=='boolean'?[{'name':_0x206f('0x71'),'value':_0x206f('0x72')},{'name':_0x206f('0x73'),'value':_0x206f('0x74')}]:[]};})};}})[_0x206f('0x26')](respondWithResult(_0x5b391f,null))[_0x206f('0x47')](function(_0x2433b7){var _0x227fe2=_0x100cf9[_0x206f('0x2f')][_0x206f('0x75')]?0x1f4:_0x2433b7['statusCode']||0x1f4;logger[_0x206f('0x27')](_0x206f('0x76'),_0x206f('0x56'),_0x227fe2,JSON['stringify'](_0x2433b7));delete _0x2433b7[_0x206f('0x29')];if(_0x227fe2===0x191){_0x227fe2=0x190;}_0x5b391f[_0x206f('0x1b')](_0x227fe2)[_0x206f('0x2a')](_0x100cf9[_0x206f('0x2f')]['test']?{'message':_0x206f('0x77'),'statusCode':_0x2433b7[_0x206f('0x78')]}:_0x2433b7);});}; \ No newline at end of file diff --git a/server/api/intSalesforceAccount/intSalesforceAccount.model.js b/server/api/intSalesforceAccount/intSalesforceAccount.model.js index 3dfced6..962c2aa 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 _0x9a77=['bluebird','request-promise','path','rimraf','./intSalesforceAccount.attributes','exports','define','SalesforceAccount','int_salesforce_accounts','lodash','util','../../config/logger','moment'];(function(_0xbb0ce8,_0xb63549){var _0x1a1b17=function(_0x171af3){while(--_0x171af3){_0xbb0ce8['push'](_0xbb0ce8['shift']());}};_0x1a1b17(++_0xb63549);}(_0x9a77,0x100));var _0x79a7=function(_0x10ab8b,_0x430c55){_0x10ab8b=_0x10ab8b-0x0;var _0x47e390=_0x9a77[_0x10ab8b];return _0x47e390;};'use strict';var _=require(_0x79a7('0x0'));var util=require(_0x79a7('0x1'));var logger=require(_0x79a7('0x2'))('api');var moment=require(_0x79a7('0x3'));var BPromise=require(_0x79a7('0x4'));var rp=require(_0x79a7('0x5'));var fs=require('fs');var path=require(_0x79a7('0x6'));var rimraf=require(_0x79a7('0x7'));var config=require('../../config/environment');var attributes=require(_0x79a7('0x8'));var integrations=require('../../components/integrations/configuration');module[_0x79a7('0x9')]=function(_0x3f235c,_0x3fe034){return _0x3f235c[_0x79a7('0xa')](_0x79a7('0xb'),attributes,{'tableName':_0x79a7('0xc'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0xf684=['exports','define','int_salesforce_accounts','lodash','../../config/logger','moment','path','rimraf','./intSalesforceAccount.attributes','../../components/integrations/configuration'];(function(_0x3dd15e,_0x1f0015){var _0x231fd0=function(_0x4f680a){while(--_0x4f680a){_0x3dd15e['push'](_0x3dd15e['shift']());}};_0x231fd0(++_0x1f0015);}(_0xf684,0x1d9));var _0x4f68=function(_0x94eecc,_0x57ad55){_0x94eecc=_0x94eecc-0x0;var _0x5cf0ae=_0xf684[_0x94eecc];return _0x5cf0ae;};'use strict';var _=require(_0x4f68('0x0'));var util=require('util');var logger=require(_0x4f68('0x1'))('api');var moment=require(_0x4f68('0x2'));var BPromise=require('bluebird');var rp=require('request-promise');var fs=require('fs');var path=require(_0x4f68('0x3'));var rimraf=require(_0x4f68('0x4'));var config=require('../../config/environment');var attributes=require(_0x4f68('0x5'));var integrations=require(_0x4f68('0x6'));module[_0x4f68('0x7')]=function(_0x2173b7,_0x2ffcbc){return _0x2173b7[_0x4f68('0x8')]('SalesforceAccount',attributes,{'tableName':_0x4f68('0x9'),'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 862371e..fad2a0d 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 _0x73ab=['request','info','SalesforceAccount,\x20%s,\x20%s','request\x20sent','debug','stringify','error','code','message','catch','GetSalesforceAccount','SalesforceAccount','options','raw','where','attributes','limit','map','include','model','ShowSalesforceAccount','find','then','lodash','util','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','http'];(function(_0x503ece,_0x1de672){var _0x5dcbf0=function(_0x1b27e3){while(--_0x1b27e3){_0x503ece['push'](_0x503ece['shift']());}};_0x5dcbf0(++_0x1de672);}(_0x73ab,0xef));var _0xb73a=function(_0x35fb56,_0x5dadff){_0x35fb56=_0x35fb56-0x0;var _0x2fd52c=_0x73ab[_0x35fb56];return _0x2fd52c;};'use strict';var _=require(_0xb73a('0x0'));var util=require(_0xb73a('0x1'));var moment=require(_0xb73a('0x2'));var BPromise=require(_0xb73a('0x3'));var rs=require(_0xb73a('0x4'));var fs=require('fs');var Redis=require(_0xb73a('0x5'));var db=require(_0xb73a('0x6'))['db'];var utils=require(_0xb73a('0x7'));var logger=require(_0xb73a('0x8'))(_0xb73a('0x9'));var config=require(_0xb73a('0xa'));var jayson=require(_0xb73a('0xb'));var client=jayson['client'][_0xb73a('0xc')]({'port':0x232a});function respondWithRpcPromise(_0x3073c8,_0x4eb7d9,_0x39b199){return new BPromise(function(_0x2ed644,_0x23ca2a){return client[_0xb73a('0xd')](_0x3073c8,_0x39b199)['then'](function(_0x37f9d5){logger[_0xb73a('0xe')](_0xb73a('0xf'),_0x4eb7d9,_0xb73a('0x10'));logger[_0xb73a('0x11')]('SalesforceAccount,\x20%s,\x20%s,\x20%s',_0x4eb7d9,_0xb73a('0x10'),JSON[_0xb73a('0x12')](_0x37f9d5));if(_0x37f9d5[_0xb73a('0x13')]){if(_0x37f9d5[_0xb73a('0x13')][_0xb73a('0x14')]===0x1f4){logger[_0xb73a('0x13')](_0xb73a('0xf'),_0x4eb7d9,_0x37f9d5[_0xb73a('0x13')][_0xb73a('0x15')]);return _0x23ca2a(_0x37f9d5[_0xb73a('0x13')][_0xb73a('0x15')]);}logger[_0xb73a('0x13')](_0xb73a('0xf'),_0x4eb7d9,_0x37f9d5[_0xb73a('0x13')][_0xb73a('0x15')]);return _0x2ed644(_0x37f9d5[_0xb73a('0x13')][_0xb73a('0x15')]);}else{logger[_0xb73a('0xe')]('SalesforceAccount,\x20%s,\x20%s',_0x4eb7d9,_0xb73a('0x10'));_0x2ed644(_0x37f9d5['result'][_0xb73a('0x15')]);}})[_0xb73a('0x16')](function(_0x1d2ca6){logger[_0xb73a('0x13')]('SalesforceAccount,\x20%s,\x20%s',_0x4eb7d9,_0x1d2ca6);_0x23ca2a(_0x1d2ca6);});});}exports[_0xb73a('0x17')]=function(_0xd71686){var _0x12b115=this;return new Promise(function(_0x14f3b1,_0x5dc64c){return db[_0xb73a('0x18')]['findAll']({'raw':_0xd71686[_0xb73a('0x19')]?_0xd71686[_0xb73a('0x19')][_0xb73a('0x1a')]===undefined?!![]:![]:!![],'where':_0xd71686['options']?_0xd71686[_0xb73a('0x19')][_0xb73a('0x1b')]||null:null,'attributes':_0xd71686['options']?_0xd71686[_0xb73a('0x19')][_0xb73a('0x1c')]||null:null,'limit':_0xd71686[_0xb73a('0x19')]?_0xd71686[_0xb73a('0x19')][_0xb73a('0x1d')]||null:null,'include':_0xd71686['options']?_0xd71686[_0xb73a('0x19')]['include']?_[_0xb73a('0x1e')](_0xd71686[_0xb73a('0x19')][_0xb73a('0x1f')],function(_0x4ff4fb){return{'model':db[_0x4ff4fb[_0xb73a('0x20')]],'as':_0x4ff4fb['as'],'attributes':_0x4ff4fb[_0xb73a('0x1c')],'include':_0x4ff4fb[_0xb73a('0x1f')]?_[_0xb73a('0x1e')](_0x4ff4fb[_0xb73a('0x1f')],function(_0x1818f3){return{'model':db[_0x1818f3[_0xb73a('0x20')]],'as':_0x1818f3['as'],'attributes':_0x1818f3[_0xb73a('0x1c')],'include':_0x1818f3[_0xb73a('0x1f')]?_[_0xb73a('0x1e')](_0x1818f3[_0xb73a('0x1f')],function(_0x2d1866){return{'model':db[_0x2d1866['model']],'as':_0x2d1866['as'],'attributes':_0x2d1866[_0xb73a('0x1c')]};}):[]};}):[]};}):[]:[]})['then'](function(_0x5fdf30){logger[_0xb73a('0xe')]('GetSalesforceAccount',_0xd71686);logger['debug'](_0xb73a('0x17'),_0xd71686,JSON['stringify'](_0x5fdf30));_0x14f3b1(_0x5fdf30);})[_0xb73a('0x16')](function(_0x6b96c6){logger[_0xb73a('0x13')](_0xb73a('0x17'),_0x6b96c6[_0xb73a('0x15')],_0xd71686);_0x5dc64c(_0x12b115[_0xb73a('0x13')](0x1f4,_0x6b96c6[_0xb73a('0x15')]));});});};exports[_0xb73a('0x21')]=function(_0x262b66){var _0x3ec373=this;return new Promise(function(_0x5bba5c,_0x2e4dcf){return db[_0xb73a('0x18')][_0xb73a('0x22')]({'raw':_0x262b66[_0xb73a('0x19')]?_0x262b66[_0xb73a('0x19')][_0xb73a('0x1a')]===undefined?!![]:![]:!![],'where':_0x262b66[_0xb73a('0x19')]?_0x262b66[_0xb73a('0x19')]['where']||null:null,'attributes':_0x262b66[_0xb73a('0x19')]?_0x262b66['options']['attributes']||null:null,'include':_0x262b66[_0xb73a('0x19')]?_0x262b66[_0xb73a('0x19')]['include']?_[_0xb73a('0x1e')](_0x262b66[_0xb73a('0x19')][_0xb73a('0x1f')],function(_0x4083ff){return{'model':db[_0x4083ff[_0xb73a('0x20')]],'as':_0x4083ff['as'],'attributes':_0x4083ff[_0xb73a('0x1c')],'include':_0x4083ff[_0xb73a('0x1f')]?_[_0xb73a('0x1e')](_0x4083ff[_0xb73a('0x1f')],function(_0x4b4b44){return{'model':db[_0x4b4b44[_0xb73a('0x20')]],'as':_0x4b4b44['as'],'attributes':_0x4b4b44[_0xb73a('0x1c')],'include':_0x4b4b44[_0xb73a('0x1f')]?_[_0xb73a('0x1e')](_0x4b4b44['include'],function(_0x4e713e){return{'model':db[_0x4e713e[_0xb73a('0x20')]],'as':_0x4e713e['as'],'attributes':_0x4e713e['attributes']};}):[]};}):[]};}):[]:[]})[_0xb73a('0x23')](function(_0x158b41){logger[_0xb73a('0xe')](_0xb73a('0x21'),_0x262b66);logger[_0xb73a('0x11')](_0xb73a('0x21'),_0x262b66,JSON[_0xb73a('0x12')](_0x158b41));_0x5bba5c(_0x158b41);})[_0xb73a('0x16')](function(_0x4c3f92){logger[_0xb73a('0x13')](_0xb73a('0x21'),_0x4c3f92['message'],_0x262b66);_0x2e4dcf(_0x3ec373['error'](0x1f4,_0x4c3f92[_0xb73a('0x15')]));});});}; \ No newline at end of file +var _0xbe4a=['ShowSalesforceAccount','find','where','catch','lodash','util','moment','bluebird','ioredis','../../mysqldb','../../config/utils','../../config/logger','../../config/environment','jayson/promise','request','then','info','SalesforceAccount,\x20%s,\x20%s','request\x20sent','SalesforceAccount,\x20%s,\x20%s,\x20%s','error','code','message','result','GetSalesforceAccount','SalesforceAccount','findAll','options','raw','attributes','limit','include','map','model','debug','stringify'];(function(_0x17cded,_0xa51b6b){var _0x41b11f=function(_0xa647a){while(--_0xa647a){_0x17cded['push'](_0x17cded['shift']());}};_0x41b11f(++_0xa51b6b);}(_0xbe4a,0x1d8));var _0xabe4=function(_0x54e4fd,_0x4059d4){_0x54e4fd=_0x54e4fd-0x0;var _0x50cbb2=_0xbe4a[_0x54e4fd];return _0x50cbb2;};'use strict';var _=require(_0xabe4('0x0'));var util=require(_0xabe4('0x1'));var moment=require(_0xabe4('0x2'));var BPromise=require(_0xabe4('0x3'));var rs=require('randomstring');var fs=require('fs');var Redis=require(_0xabe4('0x4'));var db=require(_0xabe4('0x5'))['db'];var utils=require(_0xabe4('0x6'));var logger=require(_0xabe4('0x7'))('rpc');var config=require(_0xabe4('0x8'));var jayson=require(_0xabe4('0x9'));var client=jayson['client']['http']({'port':0x232a});function respondWithRpcPromise(_0x18f918,_0x4477b7,_0xa3fb88){return new BPromise(function(_0x2a3d67,_0x15f02c){return client[_0xabe4('0xa')](_0x18f918,_0xa3fb88)[_0xabe4('0xb')](function(_0x3c1a16){logger[_0xabe4('0xc')](_0xabe4('0xd'),_0x4477b7,_0xabe4('0xe'));logger['debug'](_0xabe4('0xf'),_0x4477b7,'request\x20sent',JSON['stringify'](_0x3c1a16));if(_0x3c1a16[_0xabe4('0x10')]){if(_0x3c1a16['error'][_0xabe4('0x11')]===0x1f4){logger['error'](_0xabe4('0xd'),_0x4477b7,_0x3c1a16[_0xabe4('0x10')][_0xabe4('0x12')]);return _0x15f02c(_0x3c1a16['error']['message']);}logger[_0xabe4('0x10')](_0xabe4('0xd'),_0x4477b7,_0x3c1a16[_0xabe4('0x10')]['message']);return _0x2a3d67(_0x3c1a16['error'][_0xabe4('0x12')]);}else{logger[_0xabe4('0xc')]('SalesforceAccount,\x20%s,\x20%s',_0x4477b7,'request\x20sent');_0x2a3d67(_0x3c1a16[_0xabe4('0x13')]['message']);}})['catch'](function(_0x47a103){logger[_0xabe4('0x10')]('SalesforceAccount,\x20%s,\x20%s',_0x4477b7,_0x47a103);_0x15f02c(_0x47a103);});});}exports[_0xabe4('0x14')]=function(_0x2bbb8c){var _0x23813b=this;return new Promise(function(_0x1f2568,_0x42d3a0){return db[_0xabe4('0x15')][_0xabe4('0x16')]({'raw':_0x2bbb8c['options']?_0x2bbb8c[_0xabe4('0x17')][_0xabe4('0x18')]===undefined?!![]:![]:!![],'where':_0x2bbb8c[_0xabe4('0x17')]?_0x2bbb8c[_0xabe4('0x17')]['where']||null:null,'attributes':_0x2bbb8c['options']?_0x2bbb8c[_0xabe4('0x17')][_0xabe4('0x19')]||null:null,'limit':_0x2bbb8c[_0xabe4('0x17')]?_0x2bbb8c['options'][_0xabe4('0x1a')]||null:null,'include':_0x2bbb8c[_0xabe4('0x17')]?_0x2bbb8c['options'][_0xabe4('0x1b')]?_[_0xabe4('0x1c')](_0x2bbb8c[_0xabe4('0x17')][_0xabe4('0x1b')],function(_0x452589){return{'model':db[_0x452589[_0xabe4('0x1d')]],'as':_0x452589['as'],'attributes':_0x452589[_0xabe4('0x19')],'include':_0x452589[_0xabe4('0x1b')]?_['map'](_0x452589[_0xabe4('0x1b')],function(_0x346ae3){return{'model':db[_0x346ae3[_0xabe4('0x1d')]],'as':_0x346ae3['as'],'attributes':_0x346ae3[_0xabe4('0x19')],'include':_0x346ae3[_0xabe4('0x1b')]?_['map'](_0x346ae3[_0xabe4('0x1b')],function(_0x530035){return{'model':db[_0x530035[_0xabe4('0x1d')]],'as':_0x530035['as'],'attributes':_0x530035[_0xabe4('0x19')]};}):[]};}):[]};}):[]:[]})[_0xabe4('0xb')](function(_0x55d06c){logger[_0xabe4('0xc')](_0xabe4('0x14'),_0x2bbb8c);logger[_0xabe4('0x1e')]('GetSalesforceAccount',_0x2bbb8c,JSON[_0xabe4('0x1f')](_0x55d06c));_0x1f2568(_0x55d06c);})['catch'](function(_0x4f3d65){logger[_0xabe4('0x10')]('GetSalesforceAccount',_0x4f3d65[_0xabe4('0x12')],_0x2bbb8c);_0x42d3a0(_0x23813b['error'](0x1f4,_0x4f3d65[_0xabe4('0x12')]));});});};exports[_0xabe4('0x20')]=function(_0x29ed0d){var _0x1a6ce9=this;return new Promise(function(_0x120d7d,_0x292bc1){return db[_0xabe4('0x15')][_0xabe4('0x21')]({'raw':_0x29ed0d[_0xabe4('0x17')]?_0x29ed0d[_0xabe4('0x17')][_0xabe4('0x18')]===undefined?!![]:![]:!![],'where':_0x29ed0d[_0xabe4('0x17')]?_0x29ed0d[_0xabe4('0x17')][_0xabe4('0x22')]||null:null,'attributes':_0x29ed0d['options']?_0x29ed0d['options'][_0xabe4('0x19')]||null:null,'include':_0x29ed0d['options']?_0x29ed0d[_0xabe4('0x17')][_0xabe4('0x1b')]?_[_0xabe4('0x1c')](_0x29ed0d[_0xabe4('0x17')]['include'],function(_0x55bbbd){return{'model':db[_0x55bbbd[_0xabe4('0x1d')]],'as':_0x55bbbd['as'],'attributes':_0x55bbbd[_0xabe4('0x19')],'include':_0x55bbbd[_0xabe4('0x1b')]?_[_0xabe4('0x1c')](_0x55bbbd[_0xabe4('0x1b')],function(_0x365575){return{'model':db[_0x365575[_0xabe4('0x1d')]],'as':_0x365575['as'],'attributes':_0x365575[_0xabe4('0x19')],'include':_0x365575['include']?_[_0xabe4('0x1c')](_0x365575[_0xabe4('0x1b')],function(_0x428d48){return{'model':db[_0x428d48['model']],'as':_0x428d48['as'],'attributes':_0x428d48['attributes']};}):[]};}):[]};}):[]:[]})['then'](function(_0x77e399){logger[_0xabe4('0xc')](_0xabe4('0x20'),_0x29ed0d);logger[_0xabe4('0x1e')]('ShowSalesforceAccount',_0x29ed0d,JSON[_0xabe4('0x1f')](_0x77e399));_0x120d7d(_0x77e399);})[_0xabe4('0x23')](function(_0x2bfe07){logger['error'](_0xabe4('0x20'),_0x2bfe07[_0xabe4('0x12')],_0x29ed0d);_0x292bc1(_0x1a6ce9[_0xabe4('0x10')](0x1f4,_0x2bfe07['message']));});});}; \ No newline at end of file diff --git a/server/api/intSalesforceConfiguration/index.js b/server/api/intSalesforceConfiguration/index.js index 6ba5415..cf91c04 100644 --- a/server/api/intSalesforceConfiguration/index.js +++ b/server/api/intSalesforceConfiguration/index.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0xdb28=['path','connect-timeout','Router','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','get','isAuthenticated','/:id','show','/:id/fields','getFields','/:id/subjects','getSubjects','/:id/descriptions','post','create','put','delete','destroy','exports','multer','util'];(function(_0x4b2863,_0x494899){var _0x567d67=function(_0x751f03){while(--_0x751f03){_0x4b2863['push'](_0x4b2863['shift']());}};_0x567d67(++_0x494899);}(_0xdb28,0x106));var _0x8db2=function(_0xb0dc60,_0x2f5001){_0xb0dc60=_0xb0dc60-0x0;var _0x2fdaed=_0xdb28[_0xb0dc60];return _0x2fdaed;};'use strict';var multer=require(_0x8db2('0x0'));var util=require(_0x8db2('0x1'));var path=require(_0x8db2('0x2'));var timeout=require(_0x8db2('0x3'));var express=require('express');var router=express[_0x8db2('0x4')]();var fs_extra=require(_0x8db2('0x5'));var auth=require(_0x8db2('0x6'));var interaction=require(_0x8db2('0x7'));var config=require(_0x8db2('0x8'));var controller=require('./intSalesforceConfiguration.controller');router[_0x8db2('0x9')]('/',auth[_0x8db2('0xa')](),controller['index']);router['get'](_0x8db2('0xb'),auth[_0x8db2('0xa')](),controller[_0x8db2('0xc')]);router[_0x8db2('0x9')](_0x8db2('0xd'),auth[_0x8db2('0xa')](),controller[_0x8db2('0xe')]);router['get'](_0x8db2('0xf'),auth[_0x8db2('0xa')](),controller[_0x8db2('0x10')]);router['get'](_0x8db2('0x11'),auth[_0x8db2('0xa')](),controller['getDescriptions']);router[_0x8db2('0x12')]('/',auth[_0x8db2('0xa')](),controller[_0x8db2('0x13')]);router[_0x8db2('0x14')](_0x8db2('0xb'),auth['isAuthenticated'](),controller['update']);router[_0x8db2('0x15')](_0x8db2('0xb'),auth[_0x8db2('0xa')](),controller[_0x8db2('0x16')]);module[_0x8db2('0x17')]=router; \ No newline at end of file +var _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(_0x382652,_0x28e233){var _0xd3a7e3=function(_0x1cf426){while(--_0x1cf426){_0x382652['push'](_0x382652['shift']());}};_0xd3a7e3(++_0x28e233);}(_0x2ef3,0xba));var _0x32ef=function(_0xe512d3,_0x132bf4){_0xe512d3=_0xe512d3-0x0;var _0x200551=_0x2ef3[_0xe512d3];return _0x200551;};'use strict';var multer=require(_0x32ef('0x0'));var util=require(_0x32ef('0x1'));var path=require(_0x32ef('0x2'));var timeout=require(_0x32ef('0x3'));var express=require(_0x32ef('0x4'));var router=express[_0x32ef('0x5')]();var fs_extra=require('fs-extra');var auth=require(_0x32ef('0x6'));var interaction=require(_0x32ef('0x7'));var config=require('../../config/environment');var controller=require(_0x32ef('0x8'));router[_0x32ef('0x9')]('/',auth['isAuthenticated'](),controller['index']);router[_0x32ef('0x9')](_0x32ef('0xa'),auth[_0x32ef('0xb')](),controller[_0x32ef('0xc')]);router[_0x32ef('0x9')](_0x32ef('0xd'),auth[_0x32ef('0xb')](),controller[_0x32ef('0xe')]);router[_0x32ef('0x9')](_0x32ef('0xf'),auth['isAuthenticated'](),controller['getSubjects']);router[_0x32ef('0x9')](_0x32ef('0x10'),auth[_0x32ef('0xb')](),controller[_0x32ef('0x11')]);router['post']('/',auth[_0x32ef('0xb')](),controller['create']);router[_0x32ef('0x12')]('/:id',auth[_0x32ef('0xb')](),controller[_0x32ef('0x13')]);router['delete']('/:id',auth[_0x32ef('0xb')](),controller['destroy']);module[_0x32ef('0x14')]=router; \ No newline at end of file diff --git a/server/api/intSalesforceConfiguration/intSalesforceConfiguration.attributes.js b/server/api/intSalesforceConfiguration/intSalesforceConfiguration.attributes.js index 37c5b07..1bfa6b2 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 _0xa953=['Case','lead','account_contact_lead','account','contact_lead','ENUM','nothing','contact','sequelize','exports','STRING','Task'];(function(_0x3dd15e,_0x1f0015){var _0x231fd0=function(_0x4f680a){while(--_0x4f680a){_0x3dd15e['push'](_0x3dd15e['shift']());}};_0x231fd0(++_0x1f0015);}(_0xa953,0x1d0));var _0x3a95=function(_0x2bebb2,_0x321313){_0x2bebb2=_0x2bebb2-0x0;var _0x277503=_0xa953[_0x2bebb2];return _0x277503;};'use strict';var Sequelize=require(_0x3a95('0x0'));module[_0x3a95('0x1')]={'name':{'type':Sequelize[_0x3a95('0x2')]},'description':{'type':Sequelize[_0x3a95('0x2')]},'ticketType':{'type':Sequelize['ENUM'](_0x3a95('0x3'),_0x3a95('0x4')),'defaultValue':_0x3a95('0x3')},'moduleSearch':{'type':Sequelize['ENUM']('contact_lead','contact',_0x3a95('0x5'),_0x3a95('0x6'),_0x3a95('0x7')),'defaultValue':_0x3a95('0x8')},'moduleCreate':{'type':Sequelize[_0x3a95('0x9')](_0x3a95('0xa'),_0x3a95('0xb'),'lead','account'),'defaultValue':_0x3a95('0x5')},'leadId':{'type':Sequelize['STRING']},'additionalSearchAccount':{'type':Sequelize['STRING']},'additionalSearchContact':{'type':Sequelize[_0x3a95('0x2')]},'additionalSearchLead':{'type':Sequelize['STRING']}}; \ No newline at end of file +var _0x87bc=['contact_lead','nothing','contact','lead','sequelize','exports','STRING','ENUM','Task','Case','account'];(function(_0x21d982,_0x1c6cf5){var _0x1b045d=function(_0x2126fb){while(--_0x2126fb){_0x21d982['push'](_0x21d982['shift']());}};_0x1b045d(++_0x1c6cf5);}(_0x87bc,0x159));var _0xc87b=function(_0xbe8a8f,_0x2660f0){_0xbe8a8f=_0xbe8a8f-0x0;var _0x269693=_0x87bc[_0xbe8a8f];return _0x269693;};'use strict';var Sequelize=require(_0xc87b('0x0'));module[_0xc87b('0x1')]={'name':{'type':Sequelize[_0xc87b('0x2')]},'description':{'type':Sequelize['STRING']},'ticketType':{'type':Sequelize[_0xc87b('0x3')](_0xc87b('0x4'),_0xc87b('0x5')),'defaultValue':'Task'},'moduleSearch':{'type':Sequelize[_0xc87b('0x3')]('contact_lead','contact','lead','account_contact_lead',_0xc87b('0x6')),'defaultValue':_0xc87b('0x7')},'moduleCreate':{'type':Sequelize[_0xc87b('0x3')](_0xc87b('0x8'),_0xc87b('0x9'),_0xc87b('0xa'),_0xc87b('0x6')),'defaultValue':_0xc87b('0xa')},'leadId':{'type':Sequelize['STRING']},'additionalSearchAccount':{'type':Sequelize[_0xc87b('0x2')]},'additionalSearchContact':{'type':Sequelize['STRING']},'additionalSearchLead':{'type':Sequelize[_0xc87b('0x2')]}}; \ No newline at end of file diff --git a/server/api/intSalesforceConfiguration/intSalesforceConfiguration.controller.js b/server/api/intSalesforceConfiguration/intSalesforceConfiguration.controller.js index 3762da0..fd7b20e 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 _0xb70c=['undefined','limit','count','set','Content-Range','apply','reject','save','update','then','destroy','end','error','stack','name','send','map','SalesforceConfiguration','fieldName','type','key','model','query','keys','filters','attributes','intersection','fields','length','hasOwnProperty','nolimit','offset','order','sort','where','pick','VIRTUAL','filter','merge','includeAll','rows','catch','show','params','rawAttributes','include','options','find','create','body','getFields','SalesforceField','getSubjects','getDescriptions','findOne','eml-format','rimraf','zip-dir','fast-json-patch','moment','bluebird','mustache','util','path','sox','to-csv','ejs','fs-extra','lodash','squel','crypto','jsforce','querystring','papaparse','ioredis','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','sendStatus','status','json'];(function(_0x122ef9,_0x451d2a){var _0x42fba0=function(_0x17c9d3){while(--_0x17c9d3){_0x122ef9['push'](_0x122ef9['shift']());}};_0x42fba0(++_0x451d2a);}(_0xb70c,0x1e0));var _0xcb70=function(_0x68c979,_0x431cff){_0x68c979=_0x68c979-0x0;var _0x4f0001=_0xb70c[_0x68c979];return _0x4f0001;};'use strict';var emlformat=require(_0xcb70('0x0'));var rimraf=require(_0xcb70('0x1'));var zipdir=require(_0xcb70('0x2'));var jsonpatch=require(_0xcb70('0x3'));var rp=require('request-promise');var moment=require(_0xcb70('0x4'));var BPromise=require(_0xcb70('0x5'));var Mustache=require(_0xcb70('0x6'));var util=require(_0xcb70('0x7'));var path=require(_0xcb70('0x8'));var sox=require(_0xcb70('0x9'));var csv=require(_0xcb70('0xa'));var ejs=require(_0xcb70('0xb'));var fs=require('fs');var fs_extra=require(_0xcb70('0xc'));var _=require(_0xcb70('0xd'));var squel=require(_0xcb70('0xe'));var crypto=require(_0xcb70('0xf'));var jsforce=require(_0xcb70('0x10'));var deskjs=require('desk.js');var toCsv=require(_0xcb70('0xa'));var querystring=require(_0xcb70('0x11'));var Papa=require(_0xcb70('0x12'));var Redis=require(_0xcb70('0x13'));var authService=require('../../components/auth/service');var qs=require('../../components/parsers/qs');var as=require(_0xcb70('0x14'));var hardwareService=require(_0xcb70('0x15'));var logger=require(_0xcb70('0x16'))('api');var utils=require(_0xcb70('0x17'));var config=require(_0xcb70('0x18'));var licenseUtil=require(_0xcb70('0x19'));var db=require(_0xcb70('0x1a'))['db'];function respondWithStatusCode(_0x2874f8,_0x556264){_0x556264=_0x556264||0xcc;return function(_0x89c2fb){if(_0x89c2fb){return _0x2874f8[_0xcb70('0x1b')](_0x556264);}return _0x2874f8[_0xcb70('0x1c')](_0x556264)['end']();};}function respondWithResult(_0x263cd9,_0x87caec){_0x87caec=_0x87caec||0xc8;return function(_0x1d6a6f){if(_0x1d6a6f){return _0x263cd9[_0xcb70('0x1c')](_0x87caec)[_0xcb70('0x1d')](_0x1d6a6f);}};}function respondWithFilteredResult(_0x451784,_0x37b116){return function(_0x13ea81){if(_0x13ea81){var _0x13fbb2=typeof _0x37b116['offset']===_0xcb70('0x1e')&&typeof _0x37b116[_0xcb70('0x1f')]===_0xcb70('0x1e');var _0x72ec3c=_0x13ea81[_0xcb70('0x20')];var _0x97b0dd=_0x13fbb2?0x0:_0x37b116['offset'];var _0x403b45=_0x13fbb2?_0x13ea81[_0xcb70('0x20')]:_0x37b116['offset']+_0x37b116[_0xcb70('0x1f')];var _0x457d8c;if(_0x403b45>=_0x72ec3c){_0x403b45=_0x72ec3c;_0x457d8c=0xc8;}else{_0x457d8c=0xce;}_0x451784[_0xcb70('0x1c')](_0x457d8c);return _0x451784[_0xcb70('0x21')](_0xcb70('0x22'),_0x97b0dd+'-'+_0x403b45+'/'+_0x72ec3c)['json'](_0x13ea81);}return null;};}function patchUpdates(_0x5c5ee1){return function(_0x2b5dc6){try{jsonpatch[_0xcb70('0x23')](_0x2b5dc6,_0x5c5ee1,!![]);}catch(_0x271ca8){return BPromise[_0xcb70('0x24')](_0x271ca8);}return _0x2b5dc6[_0xcb70('0x25')]();};}function saveUpdates(_0x5aa438,_0x2ce9a9){return function(_0x2278c6){if(_0x2278c6){return _0x2278c6[_0xcb70('0x26')](_0x5aa438)[_0xcb70('0x27')](function(_0x453fe0){return _0x453fe0;});}return null;};}function removeEntity(_0x242aaf,_0x560c15){return function(_0x416b1c){if(_0x416b1c){return _0x416b1c[_0xcb70('0x28')]()['then'](function(){_0x242aaf[_0xcb70('0x1c')](0xcc)[_0xcb70('0x29')]();});}};}function handleEntityNotFound(_0x385603,_0x1c34f1){return function(_0x4c66fc){if(!_0x4c66fc){_0x385603[_0xcb70('0x1b')](0x194);}return _0x4c66fc;};}function handleError(_0x132e1c,_0x2374ae){_0x2374ae=_0x2374ae||0x1f4;return function(_0x4fd3ae){logger[_0xcb70('0x2a')](_0x4fd3ae[_0xcb70('0x2b')]);if(_0x4fd3ae[_0xcb70('0x2c')]){delete _0x4fd3ae[_0xcb70('0x2c')];}_0x132e1c[_0xcb70('0x1c')](_0x2374ae)[_0xcb70('0x2d')](_0x4fd3ae);};}exports['index']=function(_0x26e59d,_0x8c5282){var _0x25b709={},_0x5593f2={},_0x5e7c28={'count':0x0,'rows':[]};var _0x5385a1=_[_0xcb70('0x2e')](db[_0xcb70('0x2f')]['rawAttributes'],function(_0x3a0de5){return{'name':_0x3a0de5[_0xcb70('0x30')],'type':_0x3a0de5[_0xcb70('0x31')][_0xcb70('0x32')]};});_0x5593f2[_0xcb70('0x33')]=_['map'](_0x5385a1,_0xcb70('0x2c'));_0x5593f2[_0xcb70('0x34')]=_[_0xcb70('0x35')](_0x26e59d[_0xcb70('0x34')]);_0x5593f2[_0xcb70('0x36')]=_['intersection'](_0x5593f2['model'],_0x5593f2[_0xcb70('0x34')]);_0x25b709[_0xcb70('0x37')]=_[_0xcb70('0x38')](_0x5593f2[_0xcb70('0x33')],qs[_0xcb70('0x39')](_0x26e59d[_0xcb70('0x34')][_0xcb70('0x39')]));_0x25b709[_0xcb70('0x37')]=_0x25b709[_0xcb70('0x37')][_0xcb70('0x3a')]?_0x25b709[_0xcb70('0x37')]:_0x5593f2['model'];if(!_0x26e59d[_0xcb70('0x34')][_0xcb70('0x3b')](_0xcb70('0x3c'))){_0x25b709['limit']=qs[_0xcb70('0x1f')](_0x26e59d[_0xcb70('0x34')][_0xcb70('0x1f')]);_0x25b709[_0xcb70('0x3d')]=qs[_0xcb70('0x3d')](_0x26e59d[_0xcb70('0x34')][_0xcb70('0x3d')]);}_0x25b709[_0xcb70('0x3e')]=qs['sort'](_0x26e59d[_0xcb70('0x34')][_0xcb70('0x3f')]);_0x25b709[_0xcb70('0x40')]=qs[_0xcb70('0x36')](_[_0xcb70('0x41')](_0x26e59d[_0xcb70('0x34')],_0x5593f2[_0xcb70('0x36')]),_0x5385a1);if(_0x26e59d[_0xcb70('0x34')]['filter']){_0x25b709[_0xcb70('0x40')]=_['merge'](_0x25b709[_0xcb70('0x40')],{'$or':_[_0xcb70('0x2e')](_0x5385a1,function(_0xbb923f){if(_0xbb923f[_0xcb70('0x31')]!==_0xcb70('0x42')){var _0x51bb8d={};_0x51bb8d[_0xbb923f[_0xcb70('0x2c')]]={'$like':'%'+_0x26e59d[_0xcb70('0x34')][_0xcb70('0x43')]+'%'};return _0x51bb8d;}})});}_0x25b709=_[_0xcb70('0x44')]({},_0x25b709,_0x26e59d['options']);var _0x2e8075={'where':_0x25b709[_0xcb70('0x40')]};return db['SalesforceConfiguration'][_0xcb70('0x20')](_0x2e8075)[_0xcb70('0x27')](function(_0x36923f){_0x5e7c28[_0xcb70('0x20')]=_0x36923f;if(_0x26e59d[_0xcb70('0x34')][_0xcb70('0x45')]){_0x25b709['include']=[{'all':!![]}];}return db[_0xcb70('0x2f')]['findAll'](_0x25b709);})['then'](function(_0x31ffd6){_0x5e7c28[_0xcb70('0x46')]=_0x31ffd6;return _0x5e7c28;})[_0xcb70('0x27')](respondWithFilteredResult(_0x8c5282,_0x25b709))[_0xcb70('0x47')](handleError(_0x8c5282,null));};exports[_0xcb70('0x48')]=function(_0x2723f0,_0x5bd3cb){var _0xb43bf3={'raw':![],'where':{'id':_0x2723f0[_0xcb70('0x49')]['id']}},_0x2ed921={};_0x2ed921[_0xcb70('0x33')]=_[_0xcb70('0x35')](db[_0xcb70('0x2f')][_0xcb70('0x4a')]);_0x2ed921[_0xcb70('0x34')]=_[_0xcb70('0x35')](_0x2723f0['query']);_0x2ed921[_0xcb70('0x36')]=_[_0xcb70('0x38')](_0x2ed921[_0xcb70('0x33')],_0x2ed921[_0xcb70('0x34')]);_0xb43bf3['attributes']=_['intersection'](_0x2ed921[_0xcb70('0x33')],qs['fields'](_0x2723f0['query'][_0xcb70('0x39')]));_0xb43bf3[_0xcb70('0x37')]=_0xb43bf3[_0xcb70('0x37')][_0xcb70('0x3a')]?_0xb43bf3[_0xcb70('0x37')]:_0x2ed921[_0xcb70('0x33')];if(_0x2723f0[_0xcb70('0x34')][_0xcb70('0x45')]){_0xb43bf3[_0xcb70('0x4b')]=[{'all':!![]}];}_0xb43bf3=_[_0xcb70('0x44')]({},_0xb43bf3,_0x2723f0[_0xcb70('0x4c')]);return db[_0xcb70('0x2f')][_0xcb70('0x4d')](_0xb43bf3)[_0xcb70('0x27')](handleEntityNotFound(_0x5bd3cb,null))[_0xcb70('0x27')](respondWithResult(_0x5bd3cb,null))['catch'](handleError(_0x5bd3cb,null));};exports[_0xcb70('0x4e')]=function(_0x9fbc3e,_0x5c563e){return db['SalesforceConfiguration']['create'](_0x9fbc3e[_0xcb70('0x4f')],{})[_0xcb70('0x27')](respondWithResult(_0x5c563e,0xc9))[_0xcb70('0x47')](handleError(_0x5c563e,null));};exports[_0xcb70('0x26')]=function(_0x2f21f0,_0x256afe){if(_0x2f21f0[_0xcb70('0x4f')]['id']){delete _0x2f21f0['body']['id'];}return db[_0xcb70('0x2f')][_0xcb70('0x4d')]({'where':{'id':_0x2f21f0[_0xcb70('0x49')]['id']}})[_0xcb70('0x27')](handleEntityNotFound(_0x256afe,null))[_0xcb70('0x27')](saveUpdates(_0x2f21f0[_0xcb70('0x4f')],null))[_0xcb70('0x27')](respondWithResult(_0x256afe,null))[_0xcb70('0x47')](handleError(_0x256afe,null));};exports[_0xcb70('0x28')]=function(_0x2d4735,_0x222b36){return db['SalesforceConfiguration'][_0xcb70('0x4d')]({'where':{'id':_0x2d4735[_0xcb70('0x49')]['id']}})['then'](handleEntityNotFound(_0x222b36,null))['then'](removeEntity(_0x222b36,null))[_0xcb70('0x47')](handleError(_0x222b36,null));};exports[_0xcb70('0x50')]=function(_0x26f958,_0xfcc0c4,_0x3f4d8b){var _0x2702fb={};var _0x41a606={};var _0x1c077;var _0x4e0246;return db['SalesforceConfiguration']['findOne']({'where':{'id':_0x26f958[_0xcb70('0x49')]['id']}})[_0xcb70('0x27')](handleEntityNotFound(_0xfcc0c4,null))['then'](function(_0x2275ae){if(_0x2275ae){_0x1c077=_0x2275ae;_0x41a606[_0xcb70('0x33')]=_[_0xcb70('0x35')](db[_0xcb70('0x51')][_0xcb70('0x4a')]);_0x41a606[_0xcb70('0x34')]=_['keys'](_0x26f958[_0xcb70('0x34')]);_0x41a606[_0xcb70('0x36')]=_[_0xcb70('0x38')](_0x41a606[_0xcb70('0x33')],_0x41a606[_0xcb70('0x34')]);_0x2702fb[_0xcb70('0x37')]=_['intersection'](_0x41a606[_0xcb70('0x33')],qs[_0xcb70('0x39')](_0x26f958[_0xcb70('0x34')][_0xcb70('0x39')]));_0x2702fb[_0xcb70('0x37')]=_0x2702fb[_0xcb70('0x37')][_0xcb70('0x3a')]?_0x2702fb[_0xcb70('0x37')]:_0x41a606[_0xcb70('0x33')];_0x2702fb[_0xcb70('0x3e')]=qs[_0xcb70('0x3f')](_0x26f958['query'][_0xcb70('0x3f')]);_0x2702fb[_0xcb70('0x40')]=qs[_0xcb70('0x36')](_['pick'](_0x26f958['query'],_0x41a606[_0xcb70('0x36')]));if(_0x26f958['query']['filter']){_0x2702fb['where']=_[_0xcb70('0x44')](_0x2702fb['where'],{'$or':_['map'](_0x2702fb[_0xcb70('0x37')],function(_0x260d73){var _0x3aa987={};_0x3aa987[_0x260d73]={'$like':'%'+_0x26f958[_0xcb70('0x34')]['filter']+'%'};return _0x3aa987;})});}_0x2702fb=_[_0xcb70('0x44')]({},_0x2702fb,_0x26f958['options']);return _0x1c077[_0xcb70('0x50')](_0x2702fb);}})[_0xcb70('0x27')](function(_0x108a77){if(_0x108a77){_0x4e0246=_0x108a77[_0xcb70('0x3a')];if(!_0x26f958[_0xcb70('0x34')][_0xcb70('0x3b')]('nolimit')){_0x2702fb['limit']=qs[_0xcb70('0x1f')](_0x26f958[_0xcb70('0x34')]['limit']);_0x2702fb[_0xcb70('0x3d')]=qs[_0xcb70('0x3d')](_0x26f958[_0xcb70('0x34')][_0xcb70('0x3d')]);}return _0x1c077[_0xcb70('0x50')](_0x2702fb);}})[_0xcb70('0x27')](function(_0x1a38dc){if(_0x1a38dc){return _0x1a38dc?{'count':_0x4e0246,'rows':_0x1a38dc}:null;}})['then'](respondWithResult(_0xfcc0c4,null))['catch'](handleError(_0xfcc0c4,null));};exports[_0xcb70('0x52')]=function(_0x4c9005,_0x43e773,_0x236c10){var _0x359fe7={};var _0x3011ab={};var _0x92f3f4;var _0x5ca9de;return db['SalesforceConfiguration']['findOne']({'where':{'id':_0x4c9005[_0xcb70('0x49')]['id']}})[_0xcb70('0x27')](handleEntityNotFound(_0x43e773,null))[_0xcb70('0x27')](function(_0x3f531d){if(_0x3f531d){_0x92f3f4=_0x3f531d;_0x3011ab[_0xcb70('0x33')]=_[_0xcb70('0x35')](db[_0xcb70('0x51')][_0xcb70('0x4a')]);_0x3011ab[_0xcb70('0x34')]=_[_0xcb70('0x35')](_0x4c9005[_0xcb70('0x34')]);_0x3011ab[_0xcb70('0x36')]=_[_0xcb70('0x38')](_0x3011ab[_0xcb70('0x33')],_0x3011ab[_0xcb70('0x34')]);_0x359fe7[_0xcb70('0x37')]=_[_0xcb70('0x38')](_0x3011ab[_0xcb70('0x33')],qs[_0xcb70('0x39')](_0x4c9005['query']['fields']));_0x359fe7[_0xcb70('0x37')]=_0x359fe7['attributes'][_0xcb70('0x3a')]?_0x359fe7[_0xcb70('0x37')]:_0x3011ab[_0xcb70('0x33')];_0x359fe7[_0xcb70('0x3e')]=qs[_0xcb70('0x3f')](_0x4c9005[_0xcb70('0x34')][_0xcb70('0x3f')]);_0x359fe7[_0xcb70('0x40')]=qs[_0xcb70('0x36')](_[_0xcb70('0x41')](_0x4c9005['query'],_0x3011ab['filters']));if(_0x4c9005['query'][_0xcb70('0x43')]){_0x359fe7[_0xcb70('0x40')]=_['merge'](_0x359fe7[_0xcb70('0x40')],{'$or':_[_0xcb70('0x2e')](_0x359fe7['attributes'],function(_0x822650){var _0x2879bd={};_0x2879bd[_0x822650]={'$like':'%'+_0x4c9005[_0xcb70('0x34')]['filter']+'%'};return _0x2879bd;})});}_0x359fe7=_['merge']({},_0x359fe7,_0x4c9005[_0xcb70('0x4c')]);return _0x92f3f4[_0xcb70('0x52')](_0x359fe7);}})['then'](function(_0x208631){if(_0x208631){_0x5ca9de=_0x208631[_0xcb70('0x3a')];if(!_0x4c9005[_0xcb70('0x34')]['hasOwnProperty'](_0xcb70('0x3c'))){_0x359fe7[_0xcb70('0x1f')]=qs[_0xcb70('0x1f')](_0x4c9005[_0xcb70('0x34')][_0xcb70('0x1f')]);_0x359fe7[_0xcb70('0x3d')]=qs[_0xcb70('0x3d')](_0x4c9005[_0xcb70('0x34')][_0xcb70('0x3d')]);}return _0x92f3f4[_0xcb70('0x52')](_0x359fe7);}})[_0xcb70('0x27')](function(_0x2f3db2){if(_0x2f3db2){return _0x2f3db2?{'count':_0x5ca9de,'rows':_0x2f3db2}:null;}})[_0xcb70('0x27')](respondWithResult(_0x43e773,null))[_0xcb70('0x47')](handleError(_0x43e773,null));};exports[_0xcb70('0x53')]=function(_0x31038e,_0x21993d,_0x184cc7){var _0x4b9f75={};var _0x55ee19={};var _0x1811d4;var _0x2ab269;return db['SalesforceConfiguration'][_0xcb70('0x54')]({'where':{'id':_0x31038e[_0xcb70('0x49')]['id']}})[_0xcb70('0x27')](handleEntityNotFound(_0x21993d,null))[_0xcb70('0x27')](function(_0x5a102f){if(_0x5a102f){_0x1811d4=_0x5a102f;_0x55ee19[_0xcb70('0x33')]=_['keys'](db[_0xcb70('0x51')][_0xcb70('0x4a')]);_0x55ee19[_0xcb70('0x34')]=_[_0xcb70('0x35')](_0x31038e['query']);_0x55ee19[_0xcb70('0x36')]=_['intersection'](_0x55ee19[_0xcb70('0x33')],_0x55ee19['query']);_0x4b9f75[_0xcb70('0x37')]=_['intersection'](_0x55ee19[_0xcb70('0x33')],qs[_0xcb70('0x39')](_0x31038e['query'][_0xcb70('0x39')]));_0x4b9f75['attributes']=_0x4b9f75[_0xcb70('0x37')][_0xcb70('0x3a')]?_0x4b9f75[_0xcb70('0x37')]:_0x55ee19[_0xcb70('0x33')];_0x4b9f75[_0xcb70('0x3e')]=qs[_0xcb70('0x3f')](_0x31038e['query'][_0xcb70('0x3f')]);_0x4b9f75[_0xcb70('0x40')]=qs[_0xcb70('0x36')](_['pick'](_0x31038e[_0xcb70('0x34')],_0x55ee19[_0xcb70('0x36')]));if(_0x31038e[_0xcb70('0x34')][_0xcb70('0x43')]){_0x4b9f75[_0xcb70('0x40')]=_['merge'](_0x4b9f75[_0xcb70('0x40')],{'$or':_[_0xcb70('0x2e')](_0x4b9f75[_0xcb70('0x37')],function(_0x4a9931){var _0x60d625={};_0x60d625[_0x4a9931]={'$like':'%'+_0x31038e[_0xcb70('0x34')][_0xcb70('0x43')]+'%'};return _0x60d625;})});}_0x4b9f75=_['merge']({},_0x4b9f75,_0x31038e[_0xcb70('0x4c')]);return _0x1811d4['getDescriptions'](_0x4b9f75);}})['then'](function(_0x3092f8){if(_0x3092f8){_0x2ab269=_0x3092f8['length'];if(!_0x31038e[_0xcb70('0x34')]['hasOwnProperty']('nolimit')){_0x4b9f75[_0xcb70('0x1f')]=qs[_0xcb70('0x1f')](_0x31038e[_0xcb70('0x34')][_0xcb70('0x1f')]);_0x4b9f75['offset']=qs[_0xcb70('0x3d')](_0x31038e[_0xcb70('0x34')]['offset']);}return _0x1811d4[_0xcb70('0x53')](_0x4b9f75);}})[_0xcb70('0x27')](function(_0x1af9e4){if(_0x1af9e4){return _0x1af9e4?{'count':_0x2ab269,'rows':_0x1af9e4}:null;}})[_0xcb70('0x27')](respondWithResult(_0x21993d,null))[_0xcb70('0x47')](handleError(_0x21993d,null));}; \ No newline at end of file +var _0x3836=['lodash','squel','crypto','jsforce','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','end','status','json','undefined','count','offset','limit','set','Content-Range','apply','save','then','destroy','sendStatus','error','stack','name','send','index','map','rawAttributes','fieldName','key','query','keys','filters','intersection','model','attributes','fields','length','hasOwnProperty','nolimit','order','sort','where','merge','type','VIRTUAL','filter','options','includeAll','include','SalesforceConfiguration','catch','params','find','create','body','update','getFields','findOne','SalesforceField','pick','getSubjects','getDescriptions','eml-format','zip-dir','fast-json-patch','request-promise','moment','bluebird','mustache','path','sox','to-csv','ejs','fs-extra'];(function(_0x5f4c15,_0x168f72){var _0x5b0c68=function(_0x8d1891){while(--_0x8d1891){_0x5f4c15['push'](_0x5f4c15['shift']());}};_0x5b0c68(++_0x168f72);}(_0x3836,0x140));var _0x6383=function(_0x5a2162,_0x5a90a3){_0x5a2162=_0x5a2162-0x0;var _0x4561a7=_0x3836[_0x5a2162];return _0x4561a7;};'use strict';var emlformat=require(_0x6383('0x0'));var rimraf=require('rimraf');var zipdir=require(_0x6383('0x1'));var jsonpatch=require(_0x6383('0x2'));var rp=require(_0x6383('0x3'));var moment=require(_0x6383('0x4'));var BPromise=require(_0x6383('0x5'));var Mustache=require(_0x6383('0x6'));var util=require('util');var path=require(_0x6383('0x7'));var sox=require(_0x6383('0x8'));var csv=require(_0x6383('0x9'));var ejs=require(_0x6383('0xa'));var fs=require('fs');var fs_extra=require(_0x6383('0xb'));var _=require(_0x6383('0xc'));var squel=require(_0x6383('0xd'));var crypto=require(_0x6383('0xe'));var jsforce=require(_0x6383('0xf'));var deskjs=require('desk.js');var toCsv=require('to-csv');var querystring=require(_0x6383('0x10'));var Papa=require(_0x6383('0x11'));var Redis=require(_0x6383('0x12'));var authService=require(_0x6383('0x13'));var qs=require(_0x6383('0x14'));var as=require(_0x6383('0x15'));var hardwareService=require(_0x6383('0x16'));var logger=require('../../config/logger')('api');var utils=require(_0x6383('0x17'));var config=require(_0x6383('0x18'));var licenseUtil=require(_0x6383('0x19'));var db=require(_0x6383('0x1a'))['db'];function respondWithStatusCode(_0x3f6f55,_0x142090){_0x142090=_0x142090||0xcc;return function(_0x18ca5b){if(_0x18ca5b){return _0x3f6f55['sendStatus'](_0x142090);}return _0x3f6f55['status'](_0x142090)[_0x6383('0x1b')]();};}function respondWithResult(_0x26fcf7,_0x2c8122){_0x2c8122=_0x2c8122||0xc8;return function(_0xe08113){if(_0xe08113){return _0x26fcf7[_0x6383('0x1c')](_0x2c8122)[_0x6383('0x1d')](_0xe08113);}};}function respondWithFilteredResult(_0x3683ce,_0x214114){return function(_0x231b67){if(_0x231b67){var _0x20ddd7=typeof _0x214114['offset']===_0x6383('0x1e')&&typeof _0x214114['limit']===_0x6383('0x1e');var _0x37ad4e=_0x231b67[_0x6383('0x1f')];var _0x2df08f=_0x20ddd7?0x0:_0x214114[_0x6383('0x20')];var _0x94adf5=_0x20ddd7?_0x231b67[_0x6383('0x1f')]:_0x214114[_0x6383('0x20')]+_0x214114[_0x6383('0x21')];var _0x470b38;if(_0x94adf5>=_0x37ad4e){_0x94adf5=_0x37ad4e;_0x470b38=0xc8;}else{_0x470b38=0xce;}_0x3683ce[_0x6383('0x1c')](_0x470b38);return _0x3683ce[_0x6383('0x22')](_0x6383('0x23'),_0x2df08f+'-'+_0x94adf5+'/'+_0x37ad4e)['json'](_0x231b67);}return null;};}function patchUpdates(_0xaa9df){return function(_0x375c42){try{jsonpatch[_0x6383('0x24')](_0x375c42,_0xaa9df,!![]);}catch(_0x1de609){return BPromise['reject'](_0x1de609);}return _0x375c42[_0x6383('0x25')]();};}function saveUpdates(_0x508233,_0x4487c3){return function(_0x5474e4){if(_0x5474e4){return _0x5474e4['update'](_0x508233)[_0x6383('0x26')](function(_0x15db03){return _0x15db03;});}return null;};}function removeEntity(_0x1fb881,_0x1b2260){return function(_0x15d79e){if(_0x15d79e){return _0x15d79e[_0x6383('0x27')]()[_0x6383('0x26')](function(){_0x1fb881['status'](0xcc)[_0x6383('0x1b')]();});}};}function handleEntityNotFound(_0x14b57c,_0x3624d0){return function(_0x2d5acf){if(!_0x2d5acf){_0x14b57c[_0x6383('0x28')](0x194);}return _0x2d5acf;};}function handleError(_0x35ab2e,_0x5bade1){_0x5bade1=_0x5bade1||0x1f4;return function(_0x4f95f6){logger[_0x6383('0x29')](_0x4f95f6[_0x6383('0x2a')]);if(_0x4f95f6[_0x6383('0x2b')]){delete _0x4f95f6[_0x6383('0x2b')];}_0x35ab2e['status'](_0x5bade1)[_0x6383('0x2c')](_0x4f95f6);};}exports[_0x6383('0x2d')]=function(_0xac5ec8,_0x3f2032){var _0x3dbb35={},_0x4869ee={},_0x26baf1={'count':0x0,'rows':[]};var _0x2edb5f=_[_0x6383('0x2e')](db['SalesforceConfiguration'][_0x6383('0x2f')],function(_0x439ee7){return{'name':_0x439ee7[_0x6383('0x30')],'type':_0x439ee7['type'][_0x6383('0x31')]};});_0x4869ee['model']=_[_0x6383('0x2e')](_0x2edb5f,'name');_0x4869ee[_0x6383('0x32')]=_[_0x6383('0x33')](_0xac5ec8['query']);_0x4869ee[_0x6383('0x34')]=_[_0x6383('0x35')](_0x4869ee[_0x6383('0x36')],_0x4869ee[_0x6383('0x32')]);_0x3dbb35[_0x6383('0x37')]=_['intersection'](_0x4869ee['model'],qs[_0x6383('0x38')](_0xac5ec8[_0x6383('0x32')][_0x6383('0x38')]));_0x3dbb35[_0x6383('0x37')]=_0x3dbb35['attributes'][_0x6383('0x39')]?_0x3dbb35[_0x6383('0x37')]:_0x4869ee[_0x6383('0x36')];if(!_0xac5ec8[_0x6383('0x32')][_0x6383('0x3a')](_0x6383('0x3b'))){_0x3dbb35[_0x6383('0x21')]=qs[_0x6383('0x21')](_0xac5ec8['query'][_0x6383('0x21')]);_0x3dbb35[_0x6383('0x20')]=qs[_0x6383('0x20')](_0xac5ec8['query'][_0x6383('0x20')]);}_0x3dbb35[_0x6383('0x3c')]=qs[_0x6383('0x3d')](_0xac5ec8['query']['sort']);_0x3dbb35[_0x6383('0x3e')]=qs[_0x6383('0x34')](_['pick'](_0xac5ec8[_0x6383('0x32')],_0x4869ee['filters']),_0x2edb5f);if(_0xac5ec8[_0x6383('0x32')]['filter']){_0x3dbb35['where']=_[_0x6383('0x3f')](_0x3dbb35[_0x6383('0x3e')],{'$or':_[_0x6383('0x2e')](_0x2edb5f,function(_0x5e37b7){if(_0x5e37b7[_0x6383('0x40')]!==_0x6383('0x41')){var _0x52bcbf={};_0x52bcbf[_0x5e37b7[_0x6383('0x2b')]]={'$like':'%'+_0xac5ec8[_0x6383('0x32')][_0x6383('0x42')]+'%'};return _0x52bcbf;}})});}_0x3dbb35=_['merge']({},_0x3dbb35,_0xac5ec8[_0x6383('0x43')]);var _0x21a03f={'where':_0x3dbb35[_0x6383('0x3e')]};return db['SalesforceConfiguration'][_0x6383('0x1f')](_0x21a03f)[_0x6383('0x26')](function(_0x137db5){_0x26baf1[_0x6383('0x1f')]=_0x137db5;if(_0xac5ec8[_0x6383('0x32')][_0x6383('0x44')]){_0x3dbb35[_0x6383('0x45')]=[{'all':!![]}];}return db[_0x6383('0x46')]['findAll'](_0x3dbb35);})[_0x6383('0x26')](function(_0x4306e4){_0x26baf1['rows']=_0x4306e4;return _0x26baf1;})[_0x6383('0x26')](respondWithFilteredResult(_0x3f2032,_0x3dbb35))[_0x6383('0x47')](handleError(_0x3f2032,null));};exports['show']=function(_0x33c85f,_0x28d3c4){var _0x270061={'raw':![],'where':{'id':_0x33c85f[_0x6383('0x48')]['id']}},_0x4fad5f={};_0x4fad5f[_0x6383('0x36')]=_[_0x6383('0x33')](db[_0x6383('0x46')][_0x6383('0x2f')]);_0x4fad5f['query']=_['keys'](_0x33c85f[_0x6383('0x32')]);_0x4fad5f[_0x6383('0x34')]=_['intersection'](_0x4fad5f[_0x6383('0x36')],_0x4fad5f['query']);_0x270061[_0x6383('0x37')]=_[_0x6383('0x35')](_0x4fad5f['model'],qs[_0x6383('0x38')](_0x33c85f[_0x6383('0x32')][_0x6383('0x38')]));_0x270061['attributes']=_0x270061[_0x6383('0x37')][_0x6383('0x39')]?_0x270061[_0x6383('0x37')]:_0x4fad5f['model'];if(_0x33c85f[_0x6383('0x32')][_0x6383('0x44')]){_0x270061['include']=[{'all':!![]}];}_0x270061=_[_0x6383('0x3f')]({},_0x270061,_0x33c85f['options']);return db[_0x6383('0x46')][_0x6383('0x49')](_0x270061)[_0x6383('0x26')](handleEntityNotFound(_0x28d3c4,null))[_0x6383('0x26')](respondWithResult(_0x28d3c4,null))[_0x6383('0x47')](handleError(_0x28d3c4,null));};exports['create']=function(_0x49a08d,_0x21dceb){return db[_0x6383('0x46')][_0x6383('0x4a')](_0x49a08d[_0x6383('0x4b')],{})[_0x6383('0x26')](respondWithResult(_0x21dceb,0xc9))[_0x6383('0x47')](handleError(_0x21dceb,null));};exports[_0x6383('0x4c')]=function(_0x1a3862,_0x4a88bf){if(_0x1a3862[_0x6383('0x4b')]['id']){delete _0x1a3862['body']['id'];}return db[_0x6383('0x46')]['find']({'where':{'id':_0x1a3862[_0x6383('0x48')]['id']}})['then'](handleEntityNotFound(_0x4a88bf,null))[_0x6383('0x26')](saveUpdates(_0x1a3862['body'],null))['then'](respondWithResult(_0x4a88bf,null))[_0x6383('0x47')](handleError(_0x4a88bf,null));};exports[_0x6383('0x27')]=function(_0x72821a,_0x16554c){return db[_0x6383('0x46')][_0x6383('0x49')]({'where':{'id':_0x72821a[_0x6383('0x48')]['id']}})[_0x6383('0x26')](handleEntityNotFound(_0x16554c,null))[_0x6383('0x26')](removeEntity(_0x16554c,null))[_0x6383('0x47')](handleError(_0x16554c,null));};exports[_0x6383('0x4d')]=function(_0x5d63f9,_0x7923c1,_0x635be2){var _0x237786={};var _0x3cdfe3={};var _0x2abdd0;var _0x502d8a;return db['SalesforceConfiguration'][_0x6383('0x4e')]({'where':{'id':_0x5d63f9[_0x6383('0x48')]['id']}})[_0x6383('0x26')](handleEntityNotFound(_0x7923c1,null))[_0x6383('0x26')](function(_0x5483b7){if(_0x5483b7){_0x2abdd0=_0x5483b7;_0x3cdfe3[_0x6383('0x36')]=_[_0x6383('0x33')](db[_0x6383('0x4f')][_0x6383('0x2f')]);_0x3cdfe3[_0x6383('0x32')]=_['keys'](_0x5d63f9['query']);_0x3cdfe3[_0x6383('0x34')]=_[_0x6383('0x35')](_0x3cdfe3[_0x6383('0x36')],_0x3cdfe3[_0x6383('0x32')]);_0x237786[_0x6383('0x37')]=_[_0x6383('0x35')](_0x3cdfe3['model'],qs[_0x6383('0x38')](_0x5d63f9[_0x6383('0x32')][_0x6383('0x38')]));_0x237786[_0x6383('0x37')]=_0x237786[_0x6383('0x37')][_0x6383('0x39')]?_0x237786[_0x6383('0x37')]:_0x3cdfe3[_0x6383('0x36')];_0x237786[_0x6383('0x3c')]=qs[_0x6383('0x3d')](_0x5d63f9[_0x6383('0x32')]['sort']);_0x237786['where']=qs[_0x6383('0x34')](_[_0x6383('0x50')](_0x5d63f9[_0x6383('0x32')],_0x3cdfe3[_0x6383('0x34')]));if(_0x5d63f9[_0x6383('0x32')]['filter']){_0x237786[_0x6383('0x3e')]=_['merge'](_0x237786[_0x6383('0x3e')],{'$or':_['map'](_0x237786[_0x6383('0x37')],function(_0x130282){var _0x16e67c={};_0x16e67c[_0x130282]={'$like':'%'+_0x5d63f9['query'][_0x6383('0x42')]+'%'};return _0x16e67c;})});}_0x237786=_[_0x6383('0x3f')]({},_0x237786,_0x5d63f9[_0x6383('0x43')]);return _0x2abdd0[_0x6383('0x4d')](_0x237786);}})['then'](function(_0x1a0b76){if(_0x1a0b76){_0x502d8a=_0x1a0b76[_0x6383('0x39')];if(!_0x5d63f9[_0x6383('0x32')][_0x6383('0x3a')](_0x6383('0x3b'))){_0x237786['limit']=qs[_0x6383('0x21')](_0x5d63f9[_0x6383('0x32')][_0x6383('0x21')]);_0x237786[_0x6383('0x20')]=qs[_0x6383('0x20')](_0x5d63f9[_0x6383('0x32')]['offset']);}return _0x2abdd0[_0x6383('0x4d')](_0x237786);}})[_0x6383('0x26')](function(_0x42c6e3){if(_0x42c6e3){return _0x42c6e3?{'count':_0x502d8a,'rows':_0x42c6e3}:null;}})[_0x6383('0x26')](respondWithResult(_0x7923c1,null))['catch'](handleError(_0x7923c1,null));};exports[_0x6383('0x51')]=function(_0x351fc7,_0x2e7d9e,_0x435c75){var _0x321b70={};var _0x32b045={};var _0x2df5aa;var _0x3b5219;return db[_0x6383('0x46')][_0x6383('0x4e')]({'where':{'id':_0x351fc7[_0x6383('0x48')]['id']}})['then'](handleEntityNotFound(_0x2e7d9e,null))[_0x6383('0x26')](function(_0x16b790){if(_0x16b790){_0x2df5aa=_0x16b790;_0x32b045['model']=_['keys'](db[_0x6383('0x4f')]['rawAttributes']);_0x32b045['query']=_[_0x6383('0x33')](_0x351fc7[_0x6383('0x32')]);_0x32b045[_0x6383('0x34')]=_[_0x6383('0x35')](_0x32b045[_0x6383('0x36')],_0x32b045['query']);_0x321b70['attributes']=_[_0x6383('0x35')](_0x32b045[_0x6383('0x36')],qs[_0x6383('0x38')](_0x351fc7[_0x6383('0x32')][_0x6383('0x38')]));_0x321b70[_0x6383('0x37')]=_0x321b70[_0x6383('0x37')]['length']?_0x321b70[_0x6383('0x37')]:_0x32b045[_0x6383('0x36')];_0x321b70[_0x6383('0x3c')]=qs[_0x6383('0x3d')](_0x351fc7['query']['sort']);_0x321b70[_0x6383('0x3e')]=qs['filters'](_[_0x6383('0x50')](_0x351fc7[_0x6383('0x32')],_0x32b045[_0x6383('0x34')]));if(_0x351fc7[_0x6383('0x32')][_0x6383('0x42')]){_0x321b70['where']=_[_0x6383('0x3f')](_0x321b70['where'],{'$or':_[_0x6383('0x2e')](_0x321b70[_0x6383('0x37')],function(_0x493423){var _0x272fec={};_0x272fec[_0x493423]={'$like':'%'+_0x351fc7[_0x6383('0x32')]['filter']+'%'};return _0x272fec;})});}_0x321b70=_[_0x6383('0x3f')]({},_0x321b70,_0x351fc7[_0x6383('0x43')]);return _0x2df5aa[_0x6383('0x51')](_0x321b70);}})[_0x6383('0x26')](function(_0x6ea2bb){if(_0x6ea2bb){_0x3b5219=_0x6ea2bb[_0x6383('0x39')];if(!_0x351fc7['query'][_0x6383('0x3a')](_0x6383('0x3b'))){_0x321b70[_0x6383('0x21')]=qs[_0x6383('0x21')](_0x351fc7[_0x6383('0x32')][_0x6383('0x21')]);_0x321b70['offset']=qs['offset'](_0x351fc7[_0x6383('0x32')][_0x6383('0x20')]);}return _0x2df5aa['getSubjects'](_0x321b70);}})['then'](function(_0xeecf07){if(_0xeecf07){return _0xeecf07?{'count':_0x3b5219,'rows':_0xeecf07}:null;}})['then'](respondWithResult(_0x2e7d9e,null))['catch'](handleError(_0x2e7d9e,null));};exports[_0x6383('0x52')]=function(_0x3cc7f0,_0x320cba,_0x4e86eb){var _0x275213={};var _0x286eda={};var _0x1ec4cf;var _0x394696;return db['SalesforceConfiguration'][_0x6383('0x4e')]({'where':{'id':_0x3cc7f0[_0x6383('0x48')]['id']}})[_0x6383('0x26')](handleEntityNotFound(_0x320cba,null))[_0x6383('0x26')](function(_0x27c30e){if(_0x27c30e){_0x1ec4cf=_0x27c30e;_0x286eda['model']=_['keys'](db[_0x6383('0x4f')][_0x6383('0x2f')]);_0x286eda[_0x6383('0x32')]=_[_0x6383('0x33')](_0x3cc7f0[_0x6383('0x32')]);_0x286eda[_0x6383('0x34')]=_[_0x6383('0x35')](_0x286eda['model'],_0x286eda['query']);_0x275213[_0x6383('0x37')]=_[_0x6383('0x35')](_0x286eda[_0x6383('0x36')],qs['fields'](_0x3cc7f0[_0x6383('0x32')][_0x6383('0x38')]));_0x275213[_0x6383('0x37')]=_0x275213['attributes'][_0x6383('0x39')]?_0x275213[_0x6383('0x37')]:_0x286eda[_0x6383('0x36')];_0x275213[_0x6383('0x3c')]=qs['sort'](_0x3cc7f0[_0x6383('0x32')][_0x6383('0x3d')]);_0x275213['where']=qs['filters'](_[_0x6383('0x50')](_0x3cc7f0[_0x6383('0x32')],_0x286eda[_0x6383('0x34')]));if(_0x3cc7f0[_0x6383('0x32')]['filter']){_0x275213[_0x6383('0x3e')]=_['merge'](_0x275213[_0x6383('0x3e')],{'$or':_['map'](_0x275213[_0x6383('0x37')],function(_0xb72702){var _0xc63d03={};_0xc63d03[_0xb72702]={'$like':'%'+_0x3cc7f0['query'][_0x6383('0x42')]+'%'};return _0xc63d03;})});}_0x275213=_['merge']({},_0x275213,_0x3cc7f0[_0x6383('0x43')]);return _0x1ec4cf[_0x6383('0x52')](_0x275213);}})[_0x6383('0x26')](function(_0x3fce30){if(_0x3fce30){_0x394696=_0x3fce30['length'];if(!_0x3cc7f0['query'][_0x6383('0x3a')](_0x6383('0x3b'))){_0x275213[_0x6383('0x21')]=qs[_0x6383('0x21')](_0x3cc7f0['query'][_0x6383('0x21')]);_0x275213['offset']=qs['offset'](_0x3cc7f0['query']['offset']);}return _0x1ec4cf[_0x6383('0x52')](_0x275213);}})[_0x6383('0x26')](function(_0x38cf89){if(_0x38cf89){return _0x38cf89?{'count':_0x394696,'rows':_0x38cf89}:null;}})['then'](respondWithResult(_0x320cba,null))[_0x6383('0x47')](handleError(_0x320cba,null));}; \ No newline at end of file diff --git a/server/api/intSalesforceConfiguration/intSalesforceConfiguration.model.js b/server/api/intSalesforceConfiguration/intSalesforceConfiguration.model.js index 6472476..9665d9e 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 _0x527e=['request-promise','path','../../config/environment','./intSalesforceConfiguration.attributes','define','SalesforceConfiguration','int_salesforce_configurations','lodash','util','api','bluebird'];(function(_0xf800a9,_0x1ea292){var _0x476076=function(_0x48875f){while(--_0x48875f){_0xf800a9['push'](_0xf800a9['shift']());}};_0x476076(++_0x1ea292);}(_0x527e,0x96));var _0xe527=function(_0x1afea4,_0x106601){_0x1afea4=_0x1afea4-0x0;var _0x3df48a=_0x527e[_0x1afea4];return _0x3df48a;};'use strict';var _=require(_0xe527('0x0'));var util=require(_0xe527('0x1'));var logger=require('../../config/logger')(_0xe527('0x2'));var moment=require('moment');var BPromise=require(_0xe527('0x3'));var rp=require(_0xe527('0x4'));var fs=require('fs');var path=require(_0xe527('0x5'));var rimraf=require('rimraf');var config=require(_0xe527('0x6'));var attributes=require(_0xe527('0x7'));module['exports']=function(_0x400cb2,_0x332c2b){return _0x400cb2[_0xe527('0x8')](_0xe527('0x9'),attributes,{'tableName':_0xe527('0xa'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0xde42=['define','SalesforceConfiguration','int_salesforce_configurations','lodash','util','../../config/logger','api','moment','bluebird','request-promise','path','rimraf','../../config/environment','./intSalesforceConfiguration.attributes','exports'];(function(_0x1a2ca6,_0xf31166){var _0x831dfe=function(_0x2069bf){while(--_0x2069bf){_0x1a2ca6['push'](_0x1a2ca6['shift']());}};_0x831dfe(++_0xf31166);}(_0xde42,0x111));var _0x2de4=function(_0x3d93c6,_0x5b9eaa){_0x3d93c6=_0x3d93c6-0x0;var _0x4c31a6=_0xde42[_0x3d93c6];return _0x4c31a6;};'use strict';var _=require(_0x2de4('0x0'));var util=require(_0x2de4('0x1'));var logger=require(_0x2de4('0x2'))(_0x2de4('0x3'));var moment=require(_0x2de4('0x4'));var BPromise=require(_0x2de4('0x5'));var rp=require(_0x2de4('0x6'));var fs=require('fs');var path=require(_0x2de4('0x7'));var rimraf=require(_0x2de4('0x8'));var config=require(_0x2de4('0x9'));var attributes=require(_0x2de4('0xa'));module[_0x2de4('0xb')]=function(_0x732276,_0x1f4fa4){return _0x732276[_0x2de4('0xc')](_0x2de4('0xd'),attributes,{'tableName':_0x2de4('0xe'),'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 ea9f752..18f9e0e 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 _0xb3bb=['request\x20sent','stringify','error','message','result','lodash','util','moment','bluebird','randomstring','ioredis','../../config/utils','../../config/logger','rpc','../../config/environment','client','http','request','then','SalesforceConfiguration,\x20%s,\x20%s','debug','SalesforceConfiguration,\x20%s,\x20%s,\x20%s'];(function(_0x149222,_0xcad111){var _0x2fa1e6=function(_0x1b6dd1){while(--_0x1b6dd1){_0x149222['push'](_0x149222['shift']());}};_0x2fa1e6(++_0xcad111);}(_0xb3bb,0x123));var _0xbb3b=function(_0x495652,_0x3e3bfc){_0x495652=_0x495652-0x0;var _0xfefe99=_0xb3bb[_0x495652];return _0xfefe99;};'use strict';var _=require(_0xbb3b('0x0'));var util=require(_0xbb3b('0x1'));var moment=require(_0xbb3b('0x2'));var BPromise=require(_0xbb3b('0x3'));var rs=require(_0xbb3b('0x4'));var fs=require('fs');var Redis=require(_0xbb3b('0x5'));var db=require('../../mysqldb')['db'];var utils=require(_0xbb3b('0x6'));var logger=require(_0xbb3b('0x7'))(_0xbb3b('0x8'));var config=require(_0xbb3b('0x9'));var jayson=require('jayson/promise');var client=jayson[_0xbb3b('0xa')][_0xbb3b('0xb')]({'port':0x232a});function respondWithRpcPromise(_0x5e5afc,_0x2c293c,_0xa677bc){return new BPromise(function(_0x16a2ee,_0x38a23b){return client[_0xbb3b('0xc')](_0x5e5afc,_0xa677bc)[_0xbb3b('0xd')](function(_0x549c99){logger['info'](_0xbb3b('0xe'),_0x2c293c,'request\x20sent');logger[_0xbb3b('0xf')](_0xbb3b('0x10'),_0x2c293c,_0xbb3b('0x11'),JSON[_0xbb3b('0x12')](_0x549c99));if(_0x549c99[_0xbb3b('0x13')]){if(_0x549c99[_0xbb3b('0x13')]['code']===0x1f4){logger['error'](_0xbb3b('0xe'),_0x2c293c,_0x549c99[_0xbb3b('0x13')][_0xbb3b('0x14')]);return _0x38a23b(_0x549c99[_0xbb3b('0x13')]['message']);}logger[_0xbb3b('0x13')]('SalesforceConfiguration,\x20%s,\x20%s',_0x2c293c,_0x549c99['error'][_0xbb3b('0x14')]);return _0x16a2ee(_0x549c99[_0xbb3b('0x13')]['message']);}else{logger['info'](_0xbb3b('0xe'),_0x2c293c,_0xbb3b('0x11'));_0x16a2ee(_0x549c99[_0xbb3b('0x15')][_0xbb3b('0x14')]);}})['catch'](function(_0x92201f){logger[_0xbb3b('0x13')](_0xbb3b('0xe'),_0x2c293c,_0x92201f);_0x38a23b(_0x92201f);});});} \ No newline at end of file +var _0x97ea=['SalesforceConfiguration,\x20%s,\x20%s,\x20%s','error','message','result','catch','lodash','randomstring','ioredis','../../mysqldb','../../config/utils','rpc','../../config/environment','jayson/promise','client','http','then','info','SalesforceConfiguration,\x20%s,\x20%s','request\x20sent','debug'];(function(_0x27127c,_0x1b5fdd){var _0x4d8e8b=function(_0x5f4091){while(--_0x5f4091){_0x27127c['push'](_0x27127c['shift']());}};_0x4d8e8b(++_0x1b5fdd);}(_0x97ea,0x1a9));var _0xa97e=function(_0x1d8661,_0x36ea9d){_0x1d8661=_0x1d8661-0x0;var _0x558d6a=_0x97ea[_0x1d8661];return _0x558d6a;};'use strict';var _=require(_0xa97e('0x0'));var util=require('util');var moment=require('moment');var BPromise=require('bluebird');var rs=require(_0xa97e('0x1'));var fs=require('fs');var Redis=require(_0xa97e('0x2'));var db=require(_0xa97e('0x3'))['db'];var utils=require(_0xa97e('0x4'));var logger=require('../../config/logger')(_0xa97e('0x5'));var config=require(_0xa97e('0x6'));var jayson=require(_0xa97e('0x7'));var client=jayson[_0xa97e('0x8')][_0xa97e('0x9')]({'port':0x232a});function respondWithRpcPromise(_0x2574dc,_0x138ca1,_0x2458fb){return new BPromise(function(_0xb5e56e,_0x26c735){return client['request'](_0x2574dc,_0x2458fb)[_0xa97e('0xa')](function(_0x17c972){logger[_0xa97e('0xb')](_0xa97e('0xc'),_0x138ca1,_0xa97e('0xd'));logger[_0xa97e('0xe')](_0xa97e('0xf'),_0x138ca1,_0xa97e('0xd'),JSON['stringify'](_0x17c972));if(_0x17c972['error']){if(_0x17c972['error']['code']===0x1f4){logger[_0xa97e('0x10')](_0xa97e('0xc'),_0x138ca1,_0x17c972['error']['message']);return _0x26c735(_0x17c972['error']['message']);}logger[_0xa97e('0x10')](_0xa97e('0xc'),_0x138ca1,_0x17c972[_0xa97e('0x10')][_0xa97e('0x11')]);return _0xb5e56e(_0x17c972['error'][_0xa97e('0x11')]);}else{logger[_0xa97e('0xb')](_0xa97e('0xc'),_0x138ca1,_0xa97e('0xd'));_0xb5e56e(_0x17c972[_0xa97e('0x12')][_0xa97e('0x11')]);}})[_0xa97e('0x13')](function(_0x39d44a){logger['error'](_0xa97e('0xc'),_0x138ca1,_0x39d44a);_0x26c735(_0x39d44a);});});} \ No newline at end of file diff --git a/server/api/intSalesforceField/index.js b/server/api/intSalesforceField/index.js index 657b6ef..e6ca1ad 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 _0x35d6=['../../config/environment','./intSalesforceField.controller','get','isAuthenticated','index','/:id','show','post','create','delete','exports','multer','util','path','connect-timeout','express','Router','fs-extra','../../components/auth/service'];(function(_0xa6cc5c,_0x239c99){var _0x44803d=function(_0x515b6e){while(--_0x515b6e){_0xa6cc5c['push'](_0xa6cc5c['shift']());}};_0x44803d(++_0x239c99);}(_0x35d6,0x174));var _0x635d=function(_0x483791,_0x584b6e){_0x483791=_0x483791-0x0;var _0x5de89f=_0x35d6[_0x483791];return _0x5de89f;};'use strict';var multer=require(_0x635d('0x0'));var util=require(_0x635d('0x1'));var path=require(_0x635d('0x2'));var timeout=require(_0x635d('0x3'));var express=require(_0x635d('0x4'));var router=express[_0x635d('0x5')]();var fs_extra=require(_0x635d('0x6'));var auth=require(_0x635d('0x7'));var interaction=require('../../components/interaction/service');var config=require(_0x635d('0x8'));var controller=require(_0x635d('0x9'));router[_0x635d('0xa')]('/',auth[_0x635d('0xb')](),controller[_0x635d('0xc')]);router['get'](_0x635d('0xd'),auth[_0x635d('0xb')](),controller[_0x635d('0xe')]);router[_0x635d('0xf')]('/',auth[_0x635d('0xb')](),controller[_0x635d('0x10')]);router['put'](_0x635d('0xd'),auth[_0x635d('0xb')](),controller['update']);router[_0x635d('0x11')]('/:id',auth['isAuthenticated'](),controller['destroy']);module[_0x635d('0x12')]=router; \ No newline at end of file +var _0xd91a=['../../components/auth/service','../../components/interaction/service','../../config/environment','./intSalesforceField.controller','get','index','/:id','isAuthenticated','show','create','put','update','delete','destroy','exports','multer','util','express','fs-extra'];(function(_0x33a9d0,_0x33c53b){var _0x32ba15=function(_0x30e6d0){while(--_0x30e6d0){_0x33a9d0['push'](_0x33a9d0['shift']());}};_0x32ba15(++_0x33c53b);}(_0xd91a,0x94));var _0xad91=function(_0x20a584,_0xe384a5){_0x20a584=_0x20a584-0x0;var _0x4b41a8=_0xd91a[_0x20a584];return _0x4b41a8;};'use strict';var multer=require(_0xad91('0x0'));var util=require(_0xad91('0x1'));var path=require('path');var timeout=require('connect-timeout');var express=require(_0xad91('0x2'));var router=express['Router']();var fs_extra=require(_0xad91('0x3'));var auth=require(_0xad91('0x4'));var interaction=require(_0xad91('0x5'));var config=require(_0xad91('0x6'));var controller=require(_0xad91('0x7'));router[_0xad91('0x8')]('/',auth['isAuthenticated'](),controller[_0xad91('0x9')]);router[_0xad91('0x8')](_0xad91('0xa'),auth[_0xad91('0xb')](),controller[_0xad91('0xc')]);router['post']('/',auth[_0xad91('0xb')](),controller[_0xad91('0xd')]);router[_0xad91('0xe')](_0xad91('0xa'),auth['isAuthenticated'](),controller[_0xad91('0xf')]);router[_0xad91('0x10')](_0xad91('0xa'),auth[_0xad91('0xb')](),controller[_0xad91('0x11')]);module[_0xad91('0x12')]=router; \ No newline at end of file diff --git a/server/api/intSalesforceField/intSalesforceField.attributes.js b/server/api/intSalesforceField/intSalesforceField.attributes.js index c02cb8d..5dfbd83 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 _0xb2f6=['string','variable','customVariable','picklist','STRING','sequelize','exports','ENUM'];(function(_0x3e6b2f,_0x1ffa07){var _0x323215=function(_0x5c4d82){while(--_0x5c4d82){_0x3e6b2f['push'](_0x3e6b2f['shift']());}};_0x323215(++_0x1ffa07);}(_0xb2f6,0x75));var _0x6b2f=function(_0x5ada8b,_0x42cb98){_0x5ada8b=_0x5ada8b-0x0;var _0x1778f5=_0xb2f6[_0x5ada8b];return _0x1778f5;};'use strict';var Sequelize=require(_0x6b2f('0x0'));module[_0x6b2f('0x1')]={'type':{'type':Sequelize[_0x6b2f('0x2')](_0x6b2f('0x3'),_0x6b2f('0x4'),_0x6b2f('0x5'),'keyValue',_0x6b2f('0x6')),'defaultValue':_0x6b2f('0x3')},'content':{'type':Sequelize[_0x6b2f('0x7')]},'key':{'type':Sequelize['STRING']},'keyType':{'type':Sequelize[_0x6b2f('0x2')](_0x6b2f('0x3'),_0x6b2f('0x4'),_0x6b2f('0x5'))},'keyContent':{'type':Sequelize[_0x6b2f('0x7')]},'idField':{'type':Sequelize[_0x6b2f('0x7')]},'variableName':{'type':Sequelize[_0x6b2f('0x7')]}}; \ No newline at end of file +var _0xa085=['keyValue','picklist','STRING','exports','ENUM','string','variable','customVariable'];(function(_0x4af01e,_0x543f5c){var _0x178c11=function(_0x2c2f76){while(--_0x2c2f76){_0x4af01e['push'](_0x4af01e['shift']());}};_0x178c11(++_0x543f5c);}(_0xa085,0xeb));var _0x5a08=function(_0x1fdc18,_0x48f402){_0x1fdc18=_0x1fdc18-0x0;var _0x3fe3ca=_0xa085[_0x1fdc18];return _0x3fe3ca;};'use strict';var Sequelize=require('sequelize');module[_0x5a08('0x0')]={'type':{'type':Sequelize[_0x5a08('0x1')](_0x5a08('0x2'),_0x5a08('0x3'),_0x5a08('0x4'),_0x5a08('0x5'),_0x5a08('0x6')),'defaultValue':_0x5a08('0x2')},'content':{'type':Sequelize[_0x5a08('0x7')]},'key':{'type':Sequelize[_0x5a08('0x7')]},'keyType':{'type':Sequelize[_0x5a08('0x1')](_0x5a08('0x2'),_0x5a08('0x3'),_0x5a08('0x4'))},'keyContent':{'type':Sequelize[_0x5a08('0x7')]},'idField':{'type':Sequelize['STRING']},'variableName':{'type':Sequelize['STRING']}}; \ No newline at end of file diff --git a/server/api/intSalesforceField/intSalesforceField.controller.js b/server/api/intSalesforceField/intSalesforceField.controller.js index 8b65545..369d938 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 _0x8d50=['../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/logger','../../config/utils','../../config/environment','../../mysqldb','sendStatus','status','end','json','offset','undefined','count','limit','set','Content-Range','apply','reject','save','update','then','destroy','error','stack','name','send','SalesforceField','fieldName','type','model','query','keys','filters','attributes','intersection','fields','nolimit','order','sort','pick','filter','where','merge','map','VIRTUAL','options','includeAll','include','findAll','catch','show','rawAttributes','length','find','create','body','params','eml-format','rimraf','zip-dir','request-promise','moment','mustache','util','path','sox','to-csv','ejs','fs-extra','crypto','jsforce','papaparse','ioredis','../../components/auth/service'];(function(_0x25ffd4,_0x16b31d){var _0x414452=function(_0x4440d2){while(--_0x4440d2){_0x25ffd4['push'](_0x25ffd4['shift']());}};_0x414452(++_0x16b31d);}(_0x8d50,0x117));var _0x08d5=function(_0x3028fb,_0x464dc6){_0x3028fb=_0x3028fb-0x0;var _0x33750b=_0x8d50[_0x3028fb];return _0x33750b;};'use strict';var emlformat=require(_0x08d5('0x0'));var rimraf=require(_0x08d5('0x1'));var zipdir=require(_0x08d5('0x2'));var jsonpatch=require('fast-json-patch');var rp=require(_0x08d5('0x3'));var moment=require(_0x08d5('0x4'));var BPromise=require('bluebird');var Mustache=require(_0x08d5('0x5'));var util=require(_0x08d5('0x6'));var path=require(_0x08d5('0x7'));var sox=require(_0x08d5('0x8'));var csv=require(_0x08d5('0x9'));var ejs=require(_0x08d5('0xa'));var fs=require('fs');var fs_extra=require(_0x08d5('0xb'));var _=require('lodash');var squel=require('squel');var crypto=require(_0x08d5('0xc'));var jsforce=require(_0x08d5('0xd'));var deskjs=require('desk.js');var toCsv=require(_0x08d5('0x9'));var querystring=require('querystring');var Papa=require(_0x08d5('0xe'));var Redis=require(_0x08d5('0xf'));var authService=require(_0x08d5('0x10'));var qs=require(_0x08d5('0x11'));var as=require(_0x08d5('0x12'));var hardwareService=require('../../config/license/hardware');var logger=require(_0x08d5('0x13'))('api');var utils=require(_0x08d5('0x14'));var config=require(_0x08d5('0x15'));var licenseUtil=require('../../config/license/util');var db=require(_0x08d5('0x16'))['db'];function respondWithStatusCode(_0x37a721,_0x5007c3){_0x5007c3=_0x5007c3||0xcc;return function(_0x2f6cd4){if(_0x2f6cd4){return _0x37a721[_0x08d5('0x17')](_0x5007c3);}return _0x37a721[_0x08d5('0x18')](_0x5007c3)[_0x08d5('0x19')]();};}function respondWithResult(_0x3dac2c,_0x23f30b){_0x23f30b=_0x23f30b||0xc8;return function(_0xffba76){if(_0xffba76){return _0x3dac2c[_0x08d5('0x18')](_0x23f30b)[_0x08d5('0x1a')](_0xffba76);}};}function respondWithFilteredResult(_0x255445,_0x493139){return function(_0x26e3e2){if(_0x26e3e2){var _0x1894c5=typeof _0x493139[_0x08d5('0x1b')]===_0x08d5('0x1c')&&typeof _0x493139['limit']===_0x08d5('0x1c');var _0x1e34f4=_0x26e3e2[_0x08d5('0x1d')];var _0x4c34ff=_0x1894c5?0x0:_0x493139[_0x08d5('0x1b')];var _0x18d504=_0x1894c5?_0x26e3e2['count']:_0x493139[_0x08d5('0x1b')]+_0x493139[_0x08d5('0x1e')];var _0x2b0e4b;if(_0x18d504>=_0x1e34f4){_0x18d504=_0x1e34f4;_0x2b0e4b=0xc8;}else{_0x2b0e4b=0xce;}_0x255445[_0x08d5('0x18')](_0x2b0e4b);return _0x255445[_0x08d5('0x1f')](_0x08d5('0x20'),_0x4c34ff+'-'+_0x18d504+'/'+_0x1e34f4)[_0x08d5('0x1a')](_0x26e3e2);}return null;};}function patchUpdates(_0x3e6818){return function(_0x55325e){try{jsonpatch[_0x08d5('0x21')](_0x55325e,_0x3e6818,!![]);}catch(_0x3f4331){return BPromise[_0x08d5('0x22')](_0x3f4331);}return _0x55325e[_0x08d5('0x23')]();};}function saveUpdates(_0x4d825f,_0x43f46d){return function(_0x4fbeca){if(_0x4fbeca){return _0x4fbeca[_0x08d5('0x24')](_0x4d825f)[_0x08d5('0x25')](function(_0x39a2ed){return _0x39a2ed;});}return null;};}function removeEntity(_0x3653e1,_0x1d915d){return function(_0x36d25b){if(_0x36d25b){return _0x36d25b[_0x08d5('0x26')]()[_0x08d5('0x25')](function(){_0x3653e1[_0x08d5('0x18')](0xcc)[_0x08d5('0x19')]();});}};}function handleEntityNotFound(_0x49a9f8,_0x37115c){return function(_0x492491){if(!_0x492491){_0x49a9f8[_0x08d5('0x17')](0x194);}return _0x492491;};}function handleError(_0x4ef62c,_0x53d673){_0x53d673=_0x53d673||0x1f4;return function(_0x3dd815){logger[_0x08d5('0x27')](_0x3dd815[_0x08d5('0x28')]);if(_0x3dd815['name']){delete _0x3dd815[_0x08d5('0x29')];}_0x4ef62c['status'](_0x53d673)[_0x08d5('0x2a')](_0x3dd815);};}exports['index']=function(_0x22f966,_0x4af9ab){var _0x283d32={},_0x679b4a={},_0x128783={'count':0x0,'rows':[]};var _0x4fe45a=_['map'](db[_0x08d5('0x2b')]['rawAttributes'],function(_0x144d75){return{'name':_0x144d75[_0x08d5('0x2c')],'type':_0x144d75[_0x08d5('0x2d')]['key']};});_0x679b4a[_0x08d5('0x2e')]=_['map'](_0x4fe45a,_0x08d5('0x29'));_0x679b4a[_0x08d5('0x2f')]=_[_0x08d5('0x30')](_0x22f966[_0x08d5('0x2f')]);_0x679b4a[_0x08d5('0x31')]=_['intersection'](_0x679b4a[_0x08d5('0x2e')],_0x679b4a['query']);_0x283d32[_0x08d5('0x32')]=_[_0x08d5('0x33')](_0x679b4a[_0x08d5('0x2e')],qs[_0x08d5('0x34')](_0x22f966[_0x08d5('0x2f')][_0x08d5('0x34')]));_0x283d32[_0x08d5('0x32')]=_0x283d32[_0x08d5('0x32')]['length']?_0x283d32[_0x08d5('0x32')]:_0x679b4a[_0x08d5('0x2e')];if(!_0x22f966[_0x08d5('0x2f')]['hasOwnProperty'](_0x08d5('0x35'))){_0x283d32[_0x08d5('0x1e')]=qs[_0x08d5('0x1e')](_0x22f966['query'][_0x08d5('0x1e')]);_0x283d32[_0x08d5('0x1b')]=qs[_0x08d5('0x1b')](_0x22f966[_0x08d5('0x2f')][_0x08d5('0x1b')]);}_0x283d32[_0x08d5('0x36')]=qs[_0x08d5('0x37')](_0x22f966[_0x08d5('0x2f')][_0x08d5('0x37')]);_0x283d32['where']=qs[_0x08d5('0x31')](_[_0x08d5('0x38')](_0x22f966['query'],_0x679b4a[_0x08d5('0x31')]),_0x4fe45a);if(_0x22f966[_0x08d5('0x2f')][_0x08d5('0x39')]){_0x283d32[_0x08d5('0x3a')]=_[_0x08d5('0x3b')](_0x283d32[_0x08d5('0x3a')],{'$or':_[_0x08d5('0x3c')](_0x4fe45a,function(_0x553f2b){if(_0x553f2b[_0x08d5('0x2d')]!==_0x08d5('0x3d')){var _0x37cded={};_0x37cded[_0x553f2b['name']]={'$like':'%'+_0x22f966[_0x08d5('0x2f')][_0x08d5('0x39')]+'%'};return _0x37cded;}})});}_0x283d32=_[_0x08d5('0x3b')]({},_0x283d32,_0x22f966[_0x08d5('0x3e')]);var _0x2a4b3d={'where':_0x283d32['where']};return db[_0x08d5('0x2b')][_0x08d5('0x1d')](_0x2a4b3d)[_0x08d5('0x25')](function(_0x2d015c){_0x128783[_0x08d5('0x1d')]=_0x2d015c;if(_0x22f966[_0x08d5('0x2f')][_0x08d5('0x3f')]){_0x283d32[_0x08d5('0x40')]=[{'all':!![]}];}return db['SalesforceField'][_0x08d5('0x41')](_0x283d32);})['then'](function(_0x2b1b87){_0x128783['rows']=_0x2b1b87;return _0x128783;})[_0x08d5('0x25')](respondWithFilteredResult(_0x4af9ab,_0x283d32))[_0x08d5('0x42')](handleError(_0x4af9ab,null));};exports[_0x08d5('0x43')]=function(_0x3efa91,_0x4eebcd){var _0x48a81c={'raw':!![],'where':{'id':_0x3efa91['params']['id']}},_0x3cb890={};_0x3cb890[_0x08d5('0x2e')]=_[_0x08d5('0x30')](db[_0x08d5('0x2b')][_0x08d5('0x44')]);_0x3cb890['query']=_[_0x08d5('0x30')](_0x3efa91[_0x08d5('0x2f')]);_0x3cb890[_0x08d5('0x31')]=_[_0x08d5('0x33')](_0x3cb890[_0x08d5('0x2e')],_0x3cb890[_0x08d5('0x2f')]);_0x48a81c[_0x08d5('0x32')]=_[_0x08d5('0x33')](_0x3cb890[_0x08d5('0x2e')],qs[_0x08d5('0x34')](_0x3efa91['query'][_0x08d5('0x34')]));_0x48a81c[_0x08d5('0x32')]=_0x48a81c[_0x08d5('0x32')][_0x08d5('0x45')]?_0x48a81c['attributes']:_0x3cb890['model'];if(_0x3efa91[_0x08d5('0x2f')][_0x08d5('0x3f')]){_0x48a81c[_0x08d5('0x40')]=[{'all':!![]}];}_0x48a81c=_[_0x08d5('0x3b')]({},_0x48a81c,_0x3efa91[_0x08d5('0x3e')]);return db['SalesforceField'][_0x08d5('0x46')](_0x48a81c)[_0x08d5('0x25')](handleEntityNotFound(_0x4eebcd,null))['then'](respondWithResult(_0x4eebcd,null))['catch'](handleError(_0x4eebcd,null));};exports['create']=function(_0x19ff58,_0x2dacd2){return db[_0x08d5('0x2b')][_0x08d5('0x47')](_0x19ff58[_0x08d5('0x48')],{})[_0x08d5('0x25')](respondWithResult(_0x2dacd2,0xc9))[_0x08d5('0x42')](handleError(_0x2dacd2,null));};exports[_0x08d5('0x24')]=function(_0x2765eb,_0x533400){if(_0x2765eb[_0x08d5('0x48')]['id']){delete _0x2765eb['body']['id'];}return db['SalesforceField'][_0x08d5('0x46')]({'where':{'id':_0x2765eb['params']['id']}})[_0x08d5('0x25')](handleEntityNotFound(_0x533400,null))[_0x08d5('0x25')](saveUpdates(_0x2765eb[_0x08d5('0x48')],null))['then'](respondWithResult(_0x533400,null))[_0x08d5('0x42')](handleError(_0x533400,null));};exports[_0x08d5('0x26')]=function(_0x471a7a,_0xa03b5a){return db['SalesforceField'][_0x08d5('0x46')]({'where':{'id':_0x471a7a[_0x08d5('0x49')]['id']}})['then'](handleEntityNotFound(_0xa03b5a,null))[_0x08d5('0x25')](removeEntity(_0xa03b5a,null))[_0x08d5('0x42')](handleError(_0xa03b5a,null));}; \ No newline at end of file +var _0xfdb0=['end','stack','name','send','map','SalesforceField','rawAttributes','fieldName','model','query','keys','filters','intersection','attributes','fields','length','hasOwnProperty','nolimit','order','sort','where','pick','filter','merge','type','VIRTUAL','options','findAll','rows','catch','show','params','includeAll','include','create','body','find','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','moment','bluebird','mustache','path','sox','to-csv','ejs','fs-extra','lodash','squel','crypto','jsforce','desk.js','papaparse','ioredis','../../components/auth/service','../../components/parsers/advancedSearch','../../config/license/hardware','api','../../mysqldb','sendStatus','status','json','offset','undefined','limit','count','Content-Range','apply','reject','save','update','destroy','then'];(function(_0x4454d3,_0x54bb0e){var _0x222ab9=function(_0x4b5fea){while(--_0x4b5fea){_0x4454d3['push'](_0x4454d3['shift']());}};_0x222ab9(++_0x54bb0e);}(_0xfdb0,0xbd));var _0x0fdb=function(_0x572224,_0x1ff3d7){_0x572224=_0x572224-0x0;var _0x4cbec5=_0xfdb0[_0x572224];return _0x4cbec5;};'use strict';var emlformat=require(_0x0fdb('0x0'));var rimraf=require(_0x0fdb('0x1'));var zipdir=require(_0x0fdb('0x2'));var jsonpatch=require(_0x0fdb('0x3'));var rp=require(_0x0fdb('0x4'));var moment=require(_0x0fdb('0x5'));var BPromise=require(_0x0fdb('0x6'));var Mustache=require(_0x0fdb('0x7'));var util=require('util');var path=require(_0x0fdb('0x8'));var sox=require(_0x0fdb('0x9'));var csv=require(_0x0fdb('0xa'));var ejs=require(_0x0fdb('0xb'));var fs=require('fs');var fs_extra=require(_0x0fdb('0xc'));var _=require(_0x0fdb('0xd'));var squel=require(_0x0fdb('0xe'));var crypto=require(_0x0fdb('0xf'));var jsforce=require(_0x0fdb('0x10'));var deskjs=require(_0x0fdb('0x11'));var toCsv=require(_0x0fdb('0xa'));var querystring=require('querystring');var Papa=require(_0x0fdb('0x12'));var Redis=require(_0x0fdb('0x13'));var authService=require(_0x0fdb('0x14'));var qs=require('../../components/parsers/qs');var as=require(_0x0fdb('0x15'));var hardwareService=require(_0x0fdb('0x16'));var logger=require('../../config/logger')(_0x0fdb('0x17'));var utils=require('../../config/utils');var config=require('../../config/environment');var licenseUtil=require('../../config/license/util');var db=require(_0x0fdb('0x18'))['db'];function respondWithStatusCode(_0x209f43,_0x29af2b){_0x29af2b=_0x29af2b||0xcc;return function(_0x44c0d1){if(_0x44c0d1){return _0x209f43[_0x0fdb('0x19')](_0x29af2b);}return _0x209f43[_0x0fdb('0x1a')](_0x29af2b)['end']();};}function respondWithResult(_0x2b989d,_0x2cdfba){_0x2cdfba=_0x2cdfba||0xc8;return function(_0x22c6aa){if(_0x22c6aa){return _0x2b989d[_0x0fdb('0x1a')](_0x2cdfba)[_0x0fdb('0x1b')](_0x22c6aa);}};}function respondWithFilteredResult(_0x2c854c,_0x28e267){return function(_0xae7d61){if(_0xae7d61){var _0x350410=typeof _0x28e267[_0x0fdb('0x1c')]===_0x0fdb('0x1d')&&typeof _0x28e267[_0x0fdb('0x1e')]===_0x0fdb('0x1d');var _0x3e1e8c=_0xae7d61[_0x0fdb('0x1f')];var _0x2105dc=_0x350410?0x0:_0x28e267['offset'];var _0x1bdb13=_0x350410?_0xae7d61[_0x0fdb('0x1f')]:_0x28e267[_0x0fdb('0x1c')]+_0x28e267[_0x0fdb('0x1e')];var _0x4b2bb7;if(_0x1bdb13>=_0x3e1e8c){_0x1bdb13=_0x3e1e8c;_0x4b2bb7=0xc8;}else{_0x4b2bb7=0xce;}_0x2c854c[_0x0fdb('0x1a')](_0x4b2bb7);return _0x2c854c['set'](_0x0fdb('0x20'),_0x2105dc+'-'+_0x1bdb13+'/'+_0x3e1e8c)[_0x0fdb('0x1b')](_0xae7d61);}return null;};}function patchUpdates(_0x33a4f0){return function(_0x79e43f){try{jsonpatch[_0x0fdb('0x21')](_0x79e43f,_0x33a4f0,!![]);}catch(_0x46953d){return BPromise[_0x0fdb('0x22')](_0x46953d);}return _0x79e43f[_0x0fdb('0x23')]();};}function saveUpdates(_0x5ea6cc,_0x543c6b){return function(_0x384d99){if(_0x384d99){return _0x384d99[_0x0fdb('0x24')](_0x5ea6cc)['then'](function(_0x2501f3){return _0x2501f3;});}return null;};}function removeEntity(_0x51adde,_0x3ec866){return function(_0x1f1729){if(_0x1f1729){return _0x1f1729[_0x0fdb('0x25')]()[_0x0fdb('0x26')](function(){_0x51adde['status'](0xcc)[_0x0fdb('0x27')]();});}};}function handleEntityNotFound(_0x1c9124,_0x211ffa){return function(_0x441579){if(!_0x441579){_0x1c9124[_0x0fdb('0x19')](0x194);}return _0x441579;};}function handleError(_0x20d38d,_0x99614b){_0x99614b=_0x99614b||0x1f4;return function(_0x1629df){logger['error'](_0x1629df[_0x0fdb('0x28')]);if(_0x1629df[_0x0fdb('0x29')]){delete _0x1629df['name'];}_0x20d38d[_0x0fdb('0x1a')](_0x99614b)[_0x0fdb('0x2a')](_0x1629df);};}exports['index']=function(_0x34d446,_0x5c1acb){var _0x67d910={},_0x3441cb={},_0x5c4228={'count':0x0,'rows':[]};var _0x2e2ed5=_[_0x0fdb('0x2b')](db[_0x0fdb('0x2c')][_0x0fdb('0x2d')],function(_0x362def){return{'name':_0x362def[_0x0fdb('0x2e')],'type':_0x362def['type']['key']};});_0x3441cb[_0x0fdb('0x2f')]=_[_0x0fdb('0x2b')](_0x2e2ed5,_0x0fdb('0x29'));_0x3441cb[_0x0fdb('0x30')]=_[_0x0fdb('0x31')](_0x34d446[_0x0fdb('0x30')]);_0x3441cb[_0x0fdb('0x32')]=_[_0x0fdb('0x33')](_0x3441cb['model'],_0x3441cb['query']);_0x67d910[_0x0fdb('0x34')]=_[_0x0fdb('0x33')](_0x3441cb[_0x0fdb('0x2f')],qs[_0x0fdb('0x35')](_0x34d446[_0x0fdb('0x30')][_0x0fdb('0x35')]));_0x67d910['attributes']=_0x67d910['attributes'][_0x0fdb('0x36')]?_0x67d910[_0x0fdb('0x34')]:_0x3441cb[_0x0fdb('0x2f')];if(!_0x34d446[_0x0fdb('0x30')][_0x0fdb('0x37')](_0x0fdb('0x38'))){_0x67d910['limit']=qs[_0x0fdb('0x1e')](_0x34d446[_0x0fdb('0x30')][_0x0fdb('0x1e')]);_0x67d910[_0x0fdb('0x1c')]=qs[_0x0fdb('0x1c')](_0x34d446[_0x0fdb('0x30')]['offset']);}_0x67d910[_0x0fdb('0x39')]=qs[_0x0fdb('0x3a')](_0x34d446[_0x0fdb('0x30')][_0x0fdb('0x3a')]);_0x67d910[_0x0fdb('0x3b')]=qs['filters'](_[_0x0fdb('0x3c')](_0x34d446[_0x0fdb('0x30')],_0x3441cb[_0x0fdb('0x32')]),_0x2e2ed5);if(_0x34d446[_0x0fdb('0x30')][_0x0fdb('0x3d')]){_0x67d910[_0x0fdb('0x3b')]=_[_0x0fdb('0x3e')](_0x67d910[_0x0fdb('0x3b')],{'$or':_['map'](_0x2e2ed5,function(_0xc84664){if(_0xc84664[_0x0fdb('0x3f')]!==_0x0fdb('0x40')){var _0x48a5ff={};_0x48a5ff[_0xc84664[_0x0fdb('0x29')]]={'$like':'%'+_0x34d446[_0x0fdb('0x30')]['filter']+'%'};return _0x48a5ff;}})});}_0x67d910=_[_0x0fdb('0x3e')]({},_0x67d910,_0x34d446[_0x0fdb('0x41')]);var _0x3a499c={'where':_0x67d910['where']};return db[_0x0fdb('0x2c')][_0x0fdb('0x1f')](_0x3a499c)['then'](function(_0x30f585){_0x5c4228[_0x0fdb('0x1f')]=_0x30f585;if(_0x34d446['query']['includeAll']){_0x67d910['include']=[{'all':!![]}];}return db['SalesforceField'][_0x0fdb('0x42')](_0x67d910);})[_0x0fdb('0x26')](function(_0x5e20d3){_0x5c4228[_0x0fdb('0x43')]=_0x5e20d3;return _0x5c4228;})['then'](respondWithFilteredResult(_0x5c1acb,_0x67d910))[_0x0fdb('0x44')](handleError(_0x5c1acb,null));};exports[_0x0fdb('0x45')]=function(_0x16a6b3,_0x1b2954){var _0x1904ab={'raw':!![],'where':{'id':_0x16a6b3[_0x0fdb('0x46')]['id']}},_0x1c9c0d={};_0x1c9c0d['model']=_[_0x0fdb('0x31')](db[_0x0fdb('0x2c')][_0x0fdb('0x2d')]);_0x1c9c0d['query']=_[_0x0fdb('0x31')](_0x16a6b3[_0x0fdb('0x30')]);_0x1c9c0d[_0x0fdb('0x32')]=_['intersection'](_0x1c9c0d[_0x0fdb('0x2f')],_0x1c9c0d[_0x0fdb('0x30')]);_0x1904ab[_0x0fdb('0x34')]=_[_0x0fdb('0x33')](_0x1c9c0d['model'],qs[_0x0fdb('0x35')](_0x16a6b3[_0x0fdb('0x30')][_0x0fdb('0x35')]));_0x1904ab['attributes']=_0x1904ab[_0x0fdb('0x34')][_0x0fdb('0x36')]?_0x1904ab[_0x0fdb('0x34')]:_0x1c9c0d[_0x0fdb('0x2f')];if(_0x16a6b3[_0x0fdb('0x30')][_0x0fdb('0x47')]){_0x1904ab[_0x0fdb('0x48')]=[{'all':!![]}];}_0x1904ab=_['merge']({},_0x1904ab,_0x16a6b3['options']);return db[_0x0fdb('0x2c')]['find'](_0x1904ab)['then'](handleEntityNotFound(_0x1b2954,null))[_0x0fdb('0x26')](respondWithResult(_0x1b2954,null))[_0x0fdb('0x44')](handleError(_0x1b2954,null));};exports[_0x0fdb('0x49')]=function(_0x3557a5,_0x4bb805){return db['SalesforceField'][_0x0fdb('0x49')](_0x3557a5[_0x0fdb('0x4a')],{})['then'](respondWithResult(_0x4bb805,0xc9))[_0x0fdb('0x44')](handleError(_0x4bb805,null));};exports[_0x0fdb('0x24')]=function(_0x426ed7,_0x158966){if(_0x426ed7[_0x0fdb('0x4a')]['id']){delete _0x426ed7[_0x0fdb('0x4a')]['id'];}return db[_0x0fdb('0x2c')][_0x0fdb('0x4b')]({'where':{'id':_0x426ed7[_0x0fdb('0x46')]['id']}})['then'](handleEntityNotFound(_0x158966,null))[_0x0fdb('0x26')](saveUpdates(_0x426ed7[_0x0fdb('0x4a')],null))[_0x0fdb('0x26')](respondWithResult(_0x158966,null))[_0x0fdb('0x44')](handleError(_0x158966,null));};exports[_0x0fdb('0x25')]=function(_0x23cb99,_0xf4b677){return db['SalesforceField']['find']({'where':{'id':_0x23cb99[_0x0fdb('0x46')]['id']}})[_0x0fdb('0x26')](handleEntityNotFound(_0xf4b677,null))[_0x0fdb('0x26')](removeEntity(_0xf4b677,null))[_0x0fdb('0x44')](handleError(_0xf4b677,null));}; \ No newline at end of file diff --git a/server/api/intSalesforceField/intSalesforceField.model.js b/server/api/intSalesforceField/intSalesforceField.model.js index 33d5db7..0b37329 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 _0x1462=['path','../../config/environment','./intSalesforceField.attributes','define','SalesforceField','int_salesforce_fields','FieldId','lodash','../../config/logger','moment','bluebird'];(function(_0x34e73f,_0x2455fa){var _0x261b93=function(_0x282044){while(--_0x282044){_0x34e73f['push'](_0x34e73f['shift']());}};_0x261b93(++_0x2455fa);}(_0x1462,0x151));var _0x2146=function(_0x2581f5,_0x24559f){_0x2581f5=_0x2581f5-0x0;var _0x360d69=_0x1462[_0x2581f5];return _0x360d69;};'use strict';var _=require(_0x2146('0x0'));var util=require('util');var logger=require(_0x2146('0x1'))('api');var moment=require(_0x2146('0x2'));var BPromise=require(_0x2146('0x3'));var rp=require('request-promise');var fs=require('fs');var path=require(_0x2146('0x4'));var rimraf=require('rimraf');var config=require(_0x2146('0x5'));var attributes=require(_0x2146('0x6'));module['exports']=function(_0x339064,_0x1c9f13){return _0x339064[_0x2146('0x7')](_0x2146('0x8'),attributes,{'tableName':_0x2146('0x9'),'paranoid':![],'indexes':[{'name':'salesforce_unique_index','fields':['idField',_0x2146('0xa')],'unique':!![]}],'timestamps':!![]});}; \ No newline at end of file +var _0x189b=['util','../../config/logger','api','moment','request-promise','../../config/environment','./intSalesforceField.attributes','exports','define','SalesforceField','int_salesforce_fields','salesforce_unique_index','idField','lodash'];(function(_0x20d964,_0x3752c1){var _0x1f9f1f=function(_0x4493e7){while(--_0x4493e7){_0x20d964['push'](_0x20d964['shift']());}};_0x1f9f1f(++_0x3752c1);}(_0x189b,0xa7));var _0xb189=function(_0x49c550,_0xa9cdcd){_0x49c550=_0x49c550-0x0;var _0x39da96=_0x189b[_0x49c550];return _0x39da96;};'use strict';var _=require(_0xb189('0x0'));var util=require(_0xb189('0x1'));var logger=require(_0xb189('0x2'))(_0xb189('0x3'));var moment=require(_0xb189('0x4'));var BPromise=require('bluebird');var rp=require(_0xb189('0x5'));var fs=require('fs');var path=require('path');var rimraf=require('rimraf');var config=require(_0xb189('0x6'));var attributes=require(_0xb189('0x7'));module[_0xb189('0x8')]=function(_0x4434d6,_0x1d2401){return _0x4434d6[_0xb189('0x9')](_0xb189('0xa'),attributes,{'tableName':_0xb189('0xb'),'paranoid':![],'indexes':[{'name':_0xb189('0xc'),'fields':[_0xb189('0xd'),'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 66bb65a..d9d1360 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 _0x8740=['ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','jayson/promise','client','http','info','SalesforceField,\x20%s,\x20%s','debug','SalesforceField,\x20%s,\x20%s,\x20%s','request\x20sent','error','message','result','lodash','util','moment','bluebird','randomstring'];(function(_0x20a584,_0xe384a5){var _0x4b41a8=function(_0x2127c6){while(--_0x2127c6){_0x20a584['push'](_0x20a584['shift']());}};_0x4b41a8(++_0xe384a5);}(_0x8740,0x19f));var _0x0874=function(_0x411017,_0x4a8117){_0x411017=_0x411017-0x0;var _0x2adeea=_0x8740[_0x411017];return _0x2adeea;};'use strict';var _=require(_0x0874('0x0'));var util=require(_0x0874('0x1'));var moment=require(_0x0874('0x2'));var BPromise=require(_0x0874('0x3'));var rs=require(_0x0874('0x4'));var fs=require('fs');var Redis=require(_0x0874('0x5'));var db=require(_0x0874('0x6'))['db'];var utils=require(_0x0874('0x7'));var logger=require(_0x0874('0x8'))(_0x0874('0x9'));var config=require('../../config/environment');var jayson=require(_0x0874('0xa'));var client=jayson[_0x0874('0xb')][_0x0874('0xc')]({'port':0x232a});function respondWithRpcPromise(_0x155c23,_0x35057c,_0x2ce617){return new BPromise(function(_0x2a389d,_0x59c399){return client['request'](_0x155c23,_0x2ce617)['then'](function(_0x2ee72e){logger[_0x0874('0xd')](_0x0874('0xe'),_0x35057c,'request\x20sent');logger[_0x0874('0xf')](_0x0874('0x10'),_0x35057c,_0x0874('0x11'),JSON['stringify'](_0x2ee72e));if(_0x2ee72e['error']){if(_0x2ee72e[_0x0874('0x12')]['code']===0x1f4){logger[_0x0874('0x12')](_0x0874('0xe'),_0x35057c,_0x2ee72e[_0x0874('0x12')][_0x0874('0x13')]);return _0x59c399(_0x2ee72e[_0x0874('0x12')][_0x0874('0x13')]);}logger[_0x0874('0x12')](_0x0874('0xe'),_0x35057c,_0x2ee72e[_0x0874('0x12')][_0x0874('0x13')]);return _0x2a389d(_0x2ee72e[_0x0874('0x12')][_0x0874('0x13')]);}else{logger[_0x0874('0xd')](_0x0874('0xe'),_0x35057c,_0x0874('0x11'));_0x2a389d(_0x2ee72e[_0x0874('0x14')][_0x0874('0x13')]);}})['catch'](function(_0x1e7315){logger[_0x0874('0x12')](_0x0874('0xe'),_0x35057c,_0x1e7315);_0x59c399(_0x1e7315);});});} \ No newline at end of file +var _0x4260=['../../config/environment','jayson/promise','info','SalesforceField,\x20%s,\x20%s','request\x20sent','debug','error','code','message','catch','util','bluebird','../../mysqldb','../../config/utils','../../config/logger'];(function(_0x19950b,_0x53d0d7){var _0x3c6b41=function(_0x3924ad){while(--_0x3924ad){_0x19950b['push'](_0x19950b['shift']());}};_0x3c6b41(++_0x53d0d7);}(_0x4260,0xfa));var _0x0426=function(_0xb87061,_0x5d2711){_0xb87061=_0xb87061-0x0;var _0x236ee4=_0x4260[_0xb87061];return _0x236ee4;};'use strict';var _=require('lodash');var util=require(_0x0426('0x0'));var moment=require('moment');var BPromise=require(_0x0426('0x1'));var rs=require('randomstring');var fs=require('fs');var Redis=require('ioredis');var db=require(_0x0426('0x2'))['db'];var utils=require(_0x0426('0x3'));var logger=require(_0x0426('0x4'))('rpc');var config=require(_0x0426('0x5'));var jayson=require(_0x0426('0x6'));var client=jayson['client']['http']({'port':0x232a});function respondWithRpcPromise(_0x18ec80,_0x32994d,_0x472047){return new BPromise(function(_0x2ab9d5,_0x55b139){return client['request'](_0x18ec80,_0x472047)['then'](function(_0x51e93a){logger[_0x0426('0x7')](_0x0426('0x8'),_0x32994d,_0x0426('0x9'));logger[_0x0426('0xa')]('SalesforceField,\x20%s,\x20%s,\x20%s',_0x32994d,'request\x20sent',JSON['stringify'](_0x51e93a));if(_0x51e93a[_0x0426('0xb')]){if(_0x51e93a[_0x0426('0xb')][_0x0426('0xc')]===0x1f4){logger[_0x0426('0xb')](_0x0426('0x8'),_0x32994d,_0x51e93a[_0x0426('0xb')][_0x0426('0xd')]);return _0x55b139(_0x51e93a[_0x0426('0xb')]['message']);}logger[_0x0426('0xb')](_0x0426('0x8'),_0x32994d,_0x51e93a[_0x0426('0xb')][_0x0426('0xd')]);return _0x2ab9d5(_0x51e93a[_0x0426('0xb')][_0x0426('0xd')]);}else{logger[_0x0426('0x7')](_0x0426('0x8'),_0x32994d,_0x0426('0x9'));_0x2ab9d5(_0x51e93a['result'][_0x0426('0xd')]);}})[_0x0426('0xe')](function(_0x127a43){logger['error'](_0x0426('0x8'),_0x32994d,_0x127a43);_0x55b139(_0x127a43);});});} \ No newline at end of file diff --git a/server/api/intServicenowAccount/index.js b/server/api/intServicenowAccount/index.js index e2cb95a..d00096d 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 _0xb406=['create','post','addConfiguration','put','/:id','update','delete','destroy','multer','util','path','connect-timeout','express','Router','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','get','isAuthenticated','index','show','/:id/configurations','getConfigurations','/:id/fields','getFields'];(function(_0x40db18,_0x55f302){var _0x489130=function(_0x330ea8){while(--_0x330ea8){_0x40db18['push'](_0x40db18['shift']());}};_0x489130(++_0x55f302);}(_0xb406,0x10c));var _0x6b40=function(_0x1fabf8,_0x2351a3){_0x1fabf8=_0x1fabf8-0x0;var _0x188709=_0xb406[_0x1fabf8];return _0x188709;};'use strict';var multer=require(_0x6b40('0x0'));var util=require(_0x6b40('0x1'));var path=require(_0x6b40('0x2'));var timeout=require(_0x6b40('0x3'));var express=require(_0x6b40('0x4'));var router=express[_0x6b40('0x5')]();var fs_extra=require(_0x6b40('0x6'));var auth=require(_0x6b40('0x7'));var interaction=require(_0x6b40('0x8'));var config=require(_0x6b40('0x9'));var controller=require('./intServicenowAccount.controller');router[_0x6b40('0xa')]('/',auth[_0x6b40('0xb')](),controller[_0x6b40('0xc')]);router[_0x6b40('0xa')]('/:id',auth['isAuthenticated'](),controller[_0x6b40('0xd')]);router[_0x6b40('0xa')](_0x6b40('0xe'),auth['isAuthenticated'](),controller[_0x6b40('0xf')]);router[_0x6b40('0xa')](_0x6b40('0x10'),auth[_0x6b40('0xb')](),controller[_0x6b40('0x11')]);router['post']('/',auth[_0x6b40('0xb')](),controller[_0x6b40('0x12')]);router[_0x6b40('0x13')](_0x6b40('0xe'),auth['isAuthenticated'](),controller[_0x6b40('0x14')]);router[_0x6b40('0x15')](_0x6b40('0x16'),auth[_0x6b40('0xb')](),controller[_0x6b40('0x17')]);router[_0x6b40('0x18')](_0x6b40('0x16'),auth['isAuthenticated'](),controller[_0x6b40('0x19')]);module['exports']=router; \ No newline at end of file +var _0x5451=['getConfigurations','getFields','post','create','addConfiguration','put','/:id','update','delete','destroy','util','path','Router','../../components/auth/service','../../config/environment','./intServicenowAccount.controller','isAuthenticated','index','get','show','/:id/configurations'];(function(_0x1e2c84,_0x15833f){var _0x22311a=function(_0x17c3ae){while(--_0x17c3ae){_0x1e2c84['push'](_0x1e2c84['shift']());}};_0x22311a(++_0x15833f);}(_0x5451,0x16f));var _0x1545=function(_0x1956c7,_0x55294f){_0x1956c7=_0x1956c7-0x0;var _0xcfd37d=_0x5451[_0x1956c7];return _0xcfd37d;};'use strict';var multer=require('multer');var util=require(_0x1545('0x0'));var path=require(_0x1545('0x1'));var timeout=require('connect-timeout');var express=require('express');var router=express[_0x1545('0x2')]();var fs_extra=require('fs-extra');var auth=require(_0x1545('0x3'));var interaction=require('../../components/interaction/service');var config=require(_0x1545('0x4'));var controller=require(_0x1545('0x5'));router['get']('/',auth[_0x1545('0x6')](),controller[_0x1545('0x7')]);router[_0x1545('0x8')]('/:id',auth[_0x1545('0x6')](),controller[_0x1545('0x9')]);router['get'](_0x1545('0xa'),auth[_0x1545('0x6')](),controller[_0x1545('0xb')]);router['get']('/:id/fields',auth[_0x1545('0x6')](),controller[_0x1545('0xc')]);router[_0x1545('0xd')]('/',auth[_0x1545('0x6')](),controller[_0x1545('0xe')]);router[_0x1545('0xd')](_0x1545('0xa'),auth[_0x1545('0x6')](),controller[_0x1545('0xf')]);router[_0x1545('0x10')](_0x1545('0x11'),auth[_0x1545('0x6')](),controller[_0x1545('0x12')]);router[_0x1545('0x13')](_0x1545('0x11'),auth[_0x1545('0x6')](),controller[_0x1545('0x14')]);module['exports']=router; \ No newline at end of file diff --git a/server/api/intServicenowAccount/intServicenowAccount.attributes.js b/server/api/intServicenowAccount/intServicenowAccount.attributes.js index e144ab0..34ba7cc 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 _0xddae=['sequelize','exports','username','STRING','remoteUri'];(function(_0x122f3b,_0x3993c4){var _0x3be191=function(_0x4dfb4f){while(--_0x4dfb4f){_0x122f3b['push'](_0x122f3b['shift']());}};_0x3be191(++_0x3993c4);}(_0xddae,0x1cc));var _0xedda=function(_0x502061,_0x3eed86){_0x502061=_0x502061-0x0;var _0x5b248c=_0xddae[_0x502061];return _0x5b248c;};'use strict';var Sequelize=require(_0xedda('0x0'));module[_0xedda('0x1')]={'name':{'type':Sequelize['STRING']},'description':{'type':Sequelize['STRING']},'username':{'type':Sequelize['STRING'],'unique':_0xedda('0x2')},'password':{'type':Sequelize[_0xedda('0x3')]},'email':{'type':Sequelize['STRING']},'remoteUri':{'type':Sequelize['STRING'],'unique':_0xedda('0x4')},'serverUrl':{'type':Sequelize['STRING'],'allowNull':![]}}; \ No newline at end of file +var _0x94b8=['STRING','remoteUri','exports'];(function(_0x313927,_0x2b3a6d){var _0x545b28=function(_0x1be96e){while(--_0x1be96e){_0x313927['push'](_0x313927['shift']());}};_0x545b28(++_0x2b3a6d);}(_0x94b8,0x16d));var _0x894b=function(_0x5440ce,_0x1a9b03){_0x5440ce=_0x5440ce-0x0;var _0x2a10ea=_0x94b8[_0x5440ce];return _0x2a10ea;};'use strict';var Sequelize=require('sequelize');module[_0x894b('0x0')]={'name':{'type':Sequelize[_0x894b('0x1')]},'description':{'type':Sequelize[_0x894b('0x1')]},'username':{'type':Sequelize['STRING'],'unique':'username'},'password':{'type':Sequelize[_0x894b('0x1')]},'email':{'type':Sequelize[_0x894b('0x1')]},'remoteUri':{'type':Sequelize['STRING'],'unique':_0x894b('0x2')},'serverUrl':{'type':Sequelize[_0x894b('0x1')],'allowNull':![]}}; \ No newline at end of file diff --git a/server/api/intServicenowAccount/intServicenowAccount.controller.js b/server/api/intServicenowAccount/intServicenowAccount.controller.js index a9a8a01..ef7b0e7 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 _0x32cd=['findOne','AccountId','getSubjects','channel','Descriptions','ServicenowField','Subjects','getFields','made_sla','knowledge','subcategory','notify','incident_state','category','parent','caused_by','hold_reason','number','resolved_by','sys_updated_by','opened_by','user_input','sys_created_on','sys_domain','state','sys_created_by','calendar_stc','cmdb_ci','delivery_plan','impact','active','work_notes_list','business_service','sys_domain_path','rfc','expected_start','opened_at','business_duration','group_list','work_end','reopened_time','resolved_at','approval_set','work_notes','close_code','correlation_display','work_start','assignment_group','business_stc','calendar_duration','sys_class_name','close_notes','closed_by','follow_up','parent_incident','sys_id','reopened_by','urgency','problem_id','reassignment_count','activity_due','assigned_to','severity','comments','approval','comments_and_work_notes','due_date','sys_mod_count','reopen_count','sys_tags','escalation','upon_approval','username','password','email','remoteUri','serverUrl','slice','substring','format','incident?sysparm_display_value=all','result','log','incident\x20table\x20objects','assign','remove','forEach','internalType','label','push','all','concat','ServiceNow\x20error:\x20','send','Wrong\x20credentials','statusCode','boolean','True','true','False','GET','sys_choice?sysparm_query=name=incident^element=','inactive','false','value','eml-format','rimraf','fast-json-patch','request-promise','moment','bluebird','mustache','util','path','to-csv','lodash','squel','crypto','jsforce','desk.js','papaparse','ioredis','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/environment','../../config/license/util','../../components/integrations/configuration','sendStatus','status','json','undefined','limit','offset','count','set','Content-Range','apply','reject','save','then','destroy','end','error','stack','name','index','map','rawAttributes','fieldName','type','key','query','filters','intersection','attributes','fields','model','hasOwnProperty','order','sort','pick','filter','where','merge','VIRTUAL','options','ServicenowAccount','includeAll','include','findAll','rows','catch','params','keys','length','create','update','body','find','getConfigurations','ServicenowConfiguration','nolimit','addConfiguration'];(function(_0x14f265,_0x5ef114){var _0x58b2a3=function(_0x3e6e53){while(--_0x3e6e53){_0x14f265['push'](_0x14f265['shift']());}};_0x58b2a3(++_0x5ef114);}(_0x32cd,0x69));var _0xd32c=function(_0x339c5e,_0x2a375c){_0x339c5e=_0x339c5e-0x0;var _0x27be6c=_0x32cd[_0x339c5e];return _0x27be6c;};'use strict';var emlformat=require(_0xd32c('0x0'));var rimraf=require(_0xd32c('0x1'));var zipdir=require('zip-dir');var jsonpatch=require(_0xd32c('0x2'));var rp=require(_0xd32c('0x3'));var moment=require(_0xd32c('0x4'));var BPromise=require(_0xd32c('0x5'));var Mustache=require(_0xd32c('0x6'));var util=require(_0xd32c('0x7'));var path=require(_0xd32c('0x8'));var sox=require('sox');var csv=require(_0xd32c('0x9'));var ejs=require('ejs');var fs=require('fs');var fs_extra=require('fs-extra');var _=require(_0xd32c('0xa'));var squel=require(_0xd32c('0xb'));var crypto=require(_0xd32c('0xc'));var jsforce=require(_0xd32c('0xd'));var deskjs=require(_0xd32c('0xe'));var toCsv=require(_0xd32c('0x9'));var querystring=require('querystring');var Papa=require(_0xd32c('0xf'));var Redis=require(_0xd32c('0x10'));var authService=require('../../components/auth/service');var qs=require(_0xd32c('0x11'));var as=require(_0xd32c('0x12'));var hardwareService=require(_0xd32c('0x13'));var logger=require(_0xd32c('0x14'))(_0xd32c('0x15'));var utils=require(_0xd32c('0x16'));var config=require(_0xd32c('0x17'));var licenseUtil=require(_0xd32c('0x18'));var db=require('../../mysqldb')['db'];var integrations=require(_0xd32c('0x19'));function respondWithStatusCode(_0x25c425,_0x2ebb26){_0x2ebb26=_0x2ebb26||0xcc;return function(_0x3a1525){if(_0x3a1525){return _0x25c425[_0xd32c('0x1a')](_0x2ebb26);}return _0x25c425[_0xd32c('0x1b')](_0x2ebb26)['end']();};}function respondWithResult(_0x2114e3,_0xaf13c4){_0xaf13c4=_0xaf13c4||0xc8;return function(_0x48e67c){if(_0x48e67c){return _0x2114e3['status'](_0xaf13c4)[_0xd32c('0x1c')](_0x48e67c);}};}function respondWithFilteredResult(_0x3ca4d1,_0x1866ee){return function(_0x4a7edd){if(_0x4a7edd){var _0x33db17=typeof _0x1866ee['offset']===_0xd32c('0x1d')&&typeof _0x1866ee[_0xd32c('0x1e')]===_0xd32c('0x1d');var _0x520cf9=_0x4a7edd['count'];var _0x2a8a4c=_0x33db17?0x0:_0x1866ee[_0xd32c('0x1f')];var _0x3cd853=_0x33db17?_0x4a7edd[_0xd32c('0x20')]:_0x1866ee[_0xd32c('0x1f')]+_0x1866ee[_0xd32c('0x1e')];var _0x340026;if(_0x3cd853>=_0x520cf9){_0x3cd853=_0x520cf9;_0x340026=0xc8;}else{_0x340026=0xce;}_0x3ca4d1[_0xd32c('0x1b')](_0x340026);return _0x3ca4d1[_0xd32c('0x21')](_0xd32c('0x22'),_0x2a8a4c+'-'+_0x3cd853+'/'+_0x520cf9)['json'](_0x4a7edd);}return null;};}function patchUpdates(_0x2a424d){return function(_0x275420){try{jsonpatch[_0xd32c('0x23')](_0x275420,_0x2a424d,!![]);}catch(_0x32cd1f){return BPromise[_0xd32c('0x24')](_0x32cd1f);}return _0x275420[_0xd32c('0x25')]();};}function saveUpdates(_0x4ba946,_0x5b98d2){return function(_0x453540){if(_0x453540){return _0x453540['update'](_0x4ba946)[_0xd32c('0x26')](function(_0x5cd57a){return _0x5cd57a;});}return null;};}function removeEntity(_0x54823b,_0x9b283d){return function(_0x84fd8c){if(_0x84fd8c){return _0x84fd8c[_0xd32c('0x27')]()[_0xd32c('0x26')](function(){_0x54823b[_0xd32c('0x1b')](0xcc)[_0xd32c('0x28')]();});}};}function handleEntityNotFound(_0x23d799,_0x7d58fd){return function(_0x4805ad){if(!_0x4805ad){_0x23d799[_0xd32c('0x1a')](0x194);}return _0x4805ad;};}function handleError(_0x395724,_0x2b6c21){_0x2b6c21=_0x2b6c21||0x1f4;return function(_0x14bf7c){logger[_0xd32c('0x29')](_0x14bf7c[_0xd32c('0x2a')]);if(_0x14bf7c[_0xd32c('0x2b')]){delete _0x14bf7c[_0xd32c('0x2b')];}_0x395724[_0xd32c('0x1b')](_0x2b6c21)['send'](_0x14bf7c);};}exports[_0xd32c('0x2c')]=function(_0xf06ff2,_0x11b5ac){var _0x2033bb={},_0x272577={},_0x1e84e8={'count':0x0,'rows':[]};var _0x5ad322=_[_0xd32c('0x2d')](db['ServicenowAccount'][_0xd32c('0x2e')],function(_0x4745f3){return{'name':_0x4745f3[_0xd32c('0x2f')],'type':_0x4745f3[_0xd32c('0x30')][_0xd32c('0x31')]};});_0x272577['model']=_[_0xd32c('0x2d')](_0x5ad322,_0xd32c('0x2b'));_0x272577[_0xd32c('0x32')]=_['keys'](_0xf06ff2[_0xd32c('0x32')]);_0x272577[_0xd32c('0x33')]=_[_0xd32c('0x34')](_0x272577['model'],_0x272577[_0xd32c('0x32')]);_0x2033bb[_0xd32c('0x35')]=_[_0xd32c('0x34')](_0x272577['model'],qs['fields'](_0xf06ff2[_0xd32c('0x32')][_0xd32c('0x36')]));_0x2033bb[_0xd32c('0x35')]=_0x2033bb[_0xd32c('0x35')]['length']?_0x2033bb[_0xd32c('0x35')]:_0x272577[_0xd32c('0x37')];if(!_0xf06ff2[_0xd32c('0x32')][_0xd32c('0x38')]('nolimit')){_0x2033bb['limit']=qs[_0xd32c('0x1e')](_0xf06ff2[_0xd32c('0x32')][_0xd32c('0x1e')]);_0x2033bb['offset']=qs[_0xd32c('0x1f')](_0xf06ff2[_0xd32c('0x32')][_0xd32c('0x1f')]);}_0x2033bb[_0xd32c('0x39')]=qs[_0xd32c('0x3a')](_0xf06ff2['query']['sort']);_0x2033bb['where']=qs[_0xd32c('0x33')](_[_0xd32c('0x3b')](_0xf06ff2['query'],_0x272577[_0xd32c('0x33')]),_0x5ad322);if(_0xf06ff2[_0xd32c('0x32')][_0xd32c('0x3c')]){_0x2033bb[_0xd32c('0x3d')]=_[_0xd32c('0x3e')](_0x2033bb[_0xd32c('0x3d')],{'$or':_[_0xd32c('0x2d')](_0x5ad322,function(_0x506854){if(_0x506854[_0xd32c('0x30')]!==_0xd32c('0x3f')){var _0x718925={};_0x718925[_0x506854[_0xd32c('0x2b')]]={'$like':'%'+_0xf06ff2['query'][_0xd32c('0x3c')]+'%'};return _0x718925;}})});}_0x2033bb=_['merge']({},_0x2033bb,_0xf06ff2[_0xd32c('0x40')]);var _0x51f952={'where':_0x2033bb[_0xd32c('0x3d')]};return db[_0xd32c('0x41')]['count'](_0x51f952)[_0xd32c('0x26')](function(_0xfe8020){_0x1e84e8[_0xd32c('0x20')]=_0xfe8020;if(_0xf06ff2[_0xd32c('0x32')][_0xd32c('0x42')]){_0x2033bb[_0xd32c('0x43')]=[{'all':!![]}];}return db[_0xd32c('0x41')][_0xd32c('0x44')](_0x2033bb);})['then'](function(_0x124e62){_0x1e84e8[_0xd32c('0x45')]=_0x124e62;return _0x1e84e8;})[_0xd32c('0x26')](respondWithFilteredResult(_0x11b5ac,_0x2033bb))[_0xd32c('0x46')](handleError(_0x11b5ac,null));};exports['show']=function(_0x55b430,_0x45cd52){var _0x513365={'raw':![],'where':{'id':_0x55b430[_0xd32c('0x47')]['id']}},_0x5b84f9={};_0x5b84f9[_0xd32c('0x37')]=_[_0xd32c('0x48')](db[_0xd32c('0x41')][_0xd32c('0x2e')]);_0x5b84f9['query']=_[_0xd32c('0x48')](_0x55b430[_0xd32c('0x32')]);_0x5b84f9['filters']=_['intersection'](_0x5b84f9[_0xd32c('0x37')],_0x5b84f9['query']);_0x513365[_0xd32c('0x35')]=_[_0xd32c('0x34')](_0x5b84f9[_0xd32c('0x37')],qs[_0xd32c('0x36')](_0x55b430['query'][_0xd32c('0x36')]));_0x513365[_0xd32c('0x35')]=_0x513365[_0xd32c('0x35')][_0xd32c('0x49')]?_0x513365[_0xd32c('0x35')]:_0x5b84f9[_0xd32c('0x37')];if(_0x55b430['query'][_0xd32c('0x42')]){_0x513365[_0xd32c('0x43')]=[{'all':!![]}];}_0x513365=_[_0xd32c('0x3e')]({},_0x513365,_0x55b430['options']);return db[_0xd32c('0x41')]['find'](_0x513365)[_0xd32c('0x26')](handleEntityNotFound(_0x45cd52,null))[_0xd32c('0x26')](respondWithResult(_0x45cd52,null))[_0xd32c('0x46')](handleError(_0x45cd52,null));};exports[_0xd32c('0x4a')]=function(_0xd7ec,_0x2b2609){return db[_0xd32c('0x41')][_0xd32c('0x4a')](_0xd7ec['body'],{})[_0xd32c('0x26')](respondWithResult(_0x2b2609,0xc9))[_0xd32c('0x46')](handleError(_0x2b2609,null));};exports[_0xd32c('0x4b')]=function(_0x574980,_0x1866f8){if(_0x574980['body']['id']){delete _0x574980[_0xd32c('0x4c')]['id'];}return db[_0xd32c('0x41')][_0xd32c('0x4d')]({'where':{'id':_0x574980['params']['id']}})['then'](handleEntityNotFound(_0x1866f8,null))[_0xd32c('0x26')](saveUpdates(_0x574980['body'],null))[_0xd32c('0x26')](respondWithResult(_0x1866f8,null))['catch'](handleError(_0x1866f8,null));};exports[_0xd32c('0x27')]=function(_0x5c3785,_0x1640fa){return db[_0xd32c('0x41')]['find']({'where':{'id':_0x5c3785[_0xd32c('0x47')]['id']}})['then'](handleEntityNotFound(_0x1640fa,null))['then'](removeEntity(_0x1640fa,null))['catch'](handleError(_0x1640fa,null));};exports[_0xd32c('0x4e')]=function(_0x39c3f9,_0x34d671,_0x4b48cc){var _0x5311f1={};var _0x11110b={};var _0xa70a11;var _0x5bc9f0;return db[_0xd32c('0x41')]['findOne']({'where':{'id':_0x39c3f9['params']['id']}})[_0xd32c('0x26')](handleEntityNotFound(_0x34d671,null))[_0xd32c('0x26')](function(_0x4da839){if(_0x4da839){_0xa70a11=_0x4da839;_0x11110b['model']=_['keys'](db[_0xd32c('0x4f')][_0xd32c('0x2e')]);_0x11110b[_0xd32c('0x32')]=_[_0xd32c('0x48')](_0x39c3f9[_0xd32c('0x32')]);_0x11110b['filters']=_[_0xd32c('0x34')](_0x11110b['model'],_0x11110b[_0xd32c('0x32')]);_0x5311f1[_0xd32c('0x35')]=_[_0xd32c('0x34')](_0x11110b[_0xd32c('0x37')],qs[_0xd32c('0x36')](_0x39c3f9[_0xd32c('0x32')][_0xd32c('0x36')]));_0x5311f1[_0xd32c('0x35')]=_0x5311f1[_0xd32c('0x35')][_0xd32c('0x49')]?_0x5311f1['attributes']:_0x11110b[_0xd32c('0x37')];_0x5311f1[_0xd32c('0x39')]=qs[_0xd32c('0x3a')](_0x39c3f9[_0xd32c('0x32')][_0xd32c('0x3a')]);_0x5311f1[_0xd32c('0x3d')]=qs[_0xd32c('0x33')](_['pick'](_0x39c3f9[_0xd32c('0x32')],_0x11110b['filters']));if(_0x39c3f9['query'][_0xd32c('0x3c')]){_0x5311f1[_0xd32c('0x3d')]=_[_0xd32c('0x3e')](_0x5311f1['where'],{'$or':_[_0xd32c('0x2d')](_0x5311f1[_0xd32c('0x35')],function(_0x3be68d){var _0x2fc87e={};_0x2fc87e[_0x3be68d]={'$like':'%'+_0x39c3f9[_0xd32c('0x32')][_0xd32c('0x3c')]+'%'};return _0x2fc87e;})});}_0x5311f1=_[_0xd32c('0x3e')]({},_0x5311f1,_0x39c3f9[_0xd32c('0x40')]);return _0xa70a11[_0xd32c('0x4e')](_0x5311f1);}})[_0xd32c('0x26')](function(_0x107e17){if(_0x107e17){_0x5bc9f0=_0x107e17['length'];if(!_0x39c3f9[_0xd32c('0x32')][_0xd32c('0x38')](_0xd32c('0x50'))){_0x5311f1[_0xd32c('0x1e')]=qs[_0xd32c('0x1e')](_0x39c3f9[_0xd32c('0x32')][_0xd32c('0x1e')]);_0x5311f1[_0xd32c('0x1f')]=qs[_0xd32c('0x1f')](_0x39c3f9[_0xd32c('0x32')]['offset']);}return _0xa70a11[_0xd32c('0x4e')](_0x5311f1);}})['then'](function(_0x20e1dd){if(_0x20e1dd){return _0x20e1dd?{'count':_0x5bc9f0,'rows':_0x20e1dd}:null;}})[_0xd32c('0x26')](respondWithResult(_0x34d671,null))[_0xd32c('0x46')](handleError(_0x34d671,null));};exports[_0xd32c('0x51')]=function(_0x1da3d3,_0x588a36,_0x522417){if(_0x1da3d3[_0xd32c('0x4c')]['id']){delete _0x1da3d3[_0xd32c('0x4c')]['id'];}return db[_0xd32c('0x41')][_0xd32c('0x52')]({'where':{'id':_0x1da3d3['params']['id']}})[_0xd32c('0x26')](handleEntityNotFound(_0x588a36,null))[_0xd32c('0x26')](function(_0xb3a597){if(_0xb3a597){_0x1da3d3['body'][_0xd32c('0x53')]=_0xb3a597['id'];_0x1da3d3['body']['Subjects']=integrations[_0xd32c('0x54')](_0x1da3d3[_0xd32c('0x4c')][_0xd32c('0x55')],_0x1da3d3[_0xd32c('0x4c')][_0xd32c('0x30')]);_0x1da3d3[_0xd32c('0x4c')][_0xd32c('0x56')]=integrations['getDescriptions'](_0x1da3d3[_0xd32c('0x4c')]['channel'],_0x1da3d3['body'][_0xd32c('0x30')]);return db['ServicenowConfiguration'][_0xd32c('0x4a')](_0x1da3d3[_0xd32c('0x4c')],{'include':[{'model':db[_0xd32c('0x57')],'as':_0xd32c('0x58')},{'model':db[_0xd32c('0x57')],'as':_0xd32c('0x56')}]});}return null;})[_0xd32c('0x26')](respondWithResult(_0x588a36,null))[_0xd32c('0x46')](handleError(_0x588a36,null));};exports[_0xd32c('0x59')]=function(_0x12dedc,_0x2993f2,_0x54c442){var _0x34b83d=[_0xd32c('0x5a'),'hold_reason',_0xd32c('0x5b'),_0xd32c('0x5c'),'close_code',_0xd32c('0x5d'),_0xd32c('0x5e'),'severity',_0xd32c('0x5f')];var _0x246d3c=[_0xd32c('0x60'),'made_sla',_0xd32c('0x61'),'watch_list','upon_reject','sys_updated_on','child_incidents',_0xd32c('0x62'),'approval_history',_0xd32c('0x63'),_0xd32c('0x64'),_0xd32c('0x65'),_0xd32c('0x66'),_0xd32c('0x67'),_0xd32c('0x68'),_0xd32c('0x69'),_0xd32c('0x6a'),_0xd32c('0x6b'),_0xd32c('0x5b'),_0xd32c('0x39'),_0xd32c('0x6c'),'closed_at',_0xd32c('0x6d'),_0xd32c('0x6e'),_0xd32c('0x6f'),_0xd32c('0x70'),_0xd32c('0x71'),_0xd32c('0x72'),'priority',_0xd32c('0x73'),_0xd32c('0x74'),'time_worked',_0xd32c('0x75'),_0xd32c('0x76'),_0xd32c('0x77'),_0xd32c('0x78'),_0xd32c('0x79'),_0xd32c('0x7a'),_0xd32c('0x7b'),'caller_id',_0xd32c('0x7c'),'subcategory',_0xd32c('0x7d'),'short_description',_0xd32c('0x7e'),_0xd32c('0x7f'),'delivery_task',_0xd32c('0x80'),_0xd32c('0x81'),_0xd32c('0x82'),'additional_assignee_list','description',_0xd32c('0x83'),_0xd32c('0x5d'),_0xd32c('0x84'),_0xd32c('0x85'),_0xd32c('0x86'),_0xd32c('0x87'),_0xd32c('0x88'),_0xd32c('0x89'),'contact_type',_0xd32c('0x8a'),'incident_state',_0xd32c('0x8b'),_0xd32c('0x8c'),'company',_0xd32c('0x8d'),_0xd32c('0x8e'),_0xd32c('0x8f'),_0xd32c('0x90'),_0xd32c('0x91'),'sla_due',_0xd32c('0x92'),_0xd32c('0x93'),_0xd32c('0x94'),_0xd32c('0x95'),_0xd32c('0x96'),_0xd32c('0x97'),_0xd32c('0x98'),_0xd32c('0x99'),'correlation_id','location',_0xd32c('0x5f')];var _0x2c4959='';var _0x59c6f2='';var _0xfeeef1=[];var _0x53e200='';var _0x2ab7cc='';var _0x5c36b9=[];var _0x245016='';var _0x984153='';var _0x164f09={};var _0x14182e='';return db[_0xd32c('0x41')][_0xd32c('0x52')]({'where':{'id':_0x12dedc[_0xd32c('0x47')]['id']},'attributes':['id',_0xd32c('0x9a'),_0xd32c('0x9b'),_0xd32c('0x9c'),_0xd32c('0x9d'),_0xd32c('0x9e')]})[_0xd32c('0x26')](handleEntityNotFound(_0x2993f2,null))[_0xd32c('0x26')](function(_0x2b7b90){if(_0x2b7b90){_0x14182e=_0x2b7b90[_0xd32c('0x9d')];var _0x14dd33=_0x14182e[_0xd32c('0x9f')](-0x1);if(_0x14dd33==='/'){_0x14182e=_0x14182e[_0xd32c('0xa0')](0x0,_0x14182e['lastIndexOf'](_0x14dd33));}_0x984153=util[_0xd32c('0xa1')]('%s/api/now/doc/table/schema/',_0x14182e);_0x245016=util[_0xd32c('0xa1')]('%s/api/now/table/',_0x14182e);_0x164f09={'user':_0x2b7b90[_0xd32c('0x9a')],'pass':_0x2b7b90[_0xd32c('0x9b')]};var _0x57653c={'method':'GET','uri':_0x984153+_0xd32c('0xa2'),'auth':_0x164f09,'json':!![]};return rp(_0x57653c);}})[_0xd32c('0x26')](function(_0x2446ab){if(_0x2446ab[_0xd32c('0xa3')][_0xd32c('0x49')]>0x0){_0x2c4959=_0x2446ab[_0xd32c('0xa3')];}console[_0xd32c('0xa4')](_0xd32c('0xa5'),_0x2c4959);_0x5c36b9=[];_0x59c6f2=Object[_0xd32c('0xa6')]([],_0x2c4959);_[_0xd32c('0xa7')](_0x59c6f2,function(_0x2ec1fe){return!_0x34b83d['includes'](_0x2ec1fe[_0xd32c('0x2b')]);});_0x59c6f2[_0xd32c('0xa8')](function(_0xe9646a){var _0x192135=createFieldObject(_0x245016,_0x164f09,_0xe9646a[_0xd32c('0xa9')],_0xe9646a[_0xd32c('0x2b')],_0xe9646a[_0xd32c('0xaa')],![]);_0x5c36b9[_0xd32c('0xab')](_0x192135);});return Promise[_0xd32c('0xac')](_0x5c36b9);})[_0xd32c('0x26')](function(_0x38e578){_0xfeeef1=_0x38e578;_0x53e200=Object[_0xd32c('0xa6')]([],_0x2c4959);console[_0xd32c('0xa4')]('TCL:\x20_object',_0x2c4959);_[_0xd32c('0xa7')](_0x53e200,function(_0x3e24bd){return _0x246d3c['includes'](_0x3e24bd[_0xd32c('0x2b')]);});console[_0xd32c('0xa4')]('TCL:\x20exports.getEntityFields\x20->\x20_objectsCustom',_0x53e200);_0x5c36b9=[];_0x53e200['forEach'](function(_0x3723c9){var _0x211f54=createFieldObject(_0x245016,_0x164f09,_0x3723c9[_0xd32c('0xa9')],_0x3723c9['name'],_0x3723c9['label'],!![]);_0x5c36b9['push'](_0x211f54);});return Promise['all'](_0x5c36b9);})[_0xd32c('0x26')](function(_0x36dec0){_0x2ab7cc=_0x36dec0;var _0x2bd50d=_0xfeeef1[_0xd32c('0xad')](_0x2ab7cc);return{'count':_0x2bd50d['length'],'rows':_0x2bd50d};})['then'](respondWithResult(_0x2993f2,null))['catch'](function(_0x2d0491){console['log'](_0xd32c('0xae')+_0x2d0491);var _0x4e46bd=_0x12dedc[_0xd32c('0x32')]['test']?0x1f4:_0x2d0491['statusCode']||0x1f4;logger[_0xd32c('0x29')](_0x2d0491[_0xd32c('0x2a')]);delete _0x2d0491[_0xd32c('0x2b')];if(_0x4e46bd===0x191){_0x4e46bd=0x190;}_0x2993f2[_0xd32c('0x1b')](_0x4e46bd)[_0xd32c('0xaf')](_0x12dedc[_0xd32c('0x32')]['test']?{'message':_0xd32c('0xb0'),'statusCode':_0x2d0491[_0xd32c('0xb1')]}:_0x2d0491);});};function createFieldObject(_0x57e45e,_0x41d6be,_0x2709a9,_0x53fa84,_0x3bdeb4,_0x28349e){return new Promise(function(_0x4eb485,_0x45b0a0){var _0x2734d1={'id':_0x53fa84,'name':_0x3bdeb4,'custom':_0x28349e};if(_0x2709a9===_0xd32c('0xb2')){_0x2734d1[_0xd32c('0x40')]=[{'name':_0xd32c('0xb3'),'value':_0xd32c('0xb4')},{'name':_0xd32c('0xb5'),'value':'false'}];_0x4eb485(_0x2734d1);}else{var _0xca2532={'method':_0xd32c('0xb6'),'uri':_0x57e45e+_0xd32c('0xb7')+_0x53fa84,'auth':_0x41d6be,'json':!![]};return rp(_0xca2532)[_0xd32c('0x26')](function(_0x3eb3f0){var _0x424e82=[];if(_0x3eb3f0[_0xd32c('0xa3')][_0xd32c('0x49')]>0x0){_0x3eb3f0[_0xd32c('0xa3')][_0xd32c('0xa8')](function(_0x1006f9){if(_0x1006f9[_0xd32c('0xb8')]===_0xd32c('0xb9')){var _0x4541c6={'name':_0x1006f9[_0xd32c('0xaa')],'value':_0x1006f9[_0xd32c('0xba')]};_0x424e82['push'](_0x4541c6);}});}_0x2734d1[_0xd32c('0x40')]=_0x424e82;if(_0x2734d1[_0xd32c('0x40')]['length']>0x0){_0x4eb485(_0x2734d1);}else{if(_0x28349e==![]){_0x4eb485();}else{_0x4eb485(_0x2734d1);}}});}});} \ No newline at end of file +var _0x9652=['moment','mustache','util','path','sox','to-csv','fs-extra','lodash','squel','crypto','jsforce','desk.js','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/logger','../../config/utils','../../config/license/util','../../mysqldb','../../components/integrations/configuration','status','end','json','offset','undefined','limit','count','apply','reject','save','then','destroy','sendStatus','name','send','index','fieldName','key','model','query','keys','filters','intersection','fields','attributes','length','hasOwnProperty','nolimit','order','sort','where','pick','map','type','filter','merge','ServicenowAccount','include','findAll','rows','catch','show','params','rawAttributes','includeAll','options','find','create','body','update','getConfigurations','findOne','AccountId','Subjects','getSubjects','channel','ServicenowField','Descriptions','hold_reason','knowledge','close_code','incident_state','severity','category','made_sla','caused_by','watch_list','upon_reject','sys_updated_on','child_incidents','approval_history','resolved_by','sys_updated_by','opened_by','sys_created_on','sys_domain','state','sys_created_by','calendar_stc','closed_at','impact','active','work_notes_list','priority','rfc','time_worked','expected_start','business_duration','group_list','work_end','reopened_time','resolved_at','caller_id','approval_set','short_description','delivery_task','additional_assignee_list','description','sys_class_name','close_notes','closed_by','follow_up','sys_id','contact_type','reopened_by','urgency','problem_id','company','reassignment_count','activity_due','approval','due_date','sys_mod_count','sys_tags','correlation_id','password','email','remoteUri','slice','substring','format','%s/api/now/doc/table/schema/','%s/api/now/table/','username','incident?sysparm_display_value=all','result','log','incident\x20table\x20objects','assign','remove','internalType','label','push','all','TCL:\x20_object','includes','forEach','concat','ServiceNow\x20error:\x20','test','error','stack','Wrong\x20credentials','statusCode','boolean','GET','sys_choice?sysparm_query=name=incident^element=','inactive','value','eml-format','rimraf','zip-dir','fast-json-patch'];(function(_0x103312,_0x5ed827){var _0x11651d=function(_0xd6a9a8){while(--_0xd6a9a8){_0x103312['push'](_0x103312['shift']());}};_0x11651d(++_0x5ed827);}(_0x9652,0xab));var _0x2965=function(_0x4745d9,_0x411b00){_0x4745d9=_0x4745d9-0x0;var _0x38f2ac=_0x9652[_0x4745d9];return _0x38f2ac;};'use strict';var emlformat=require(_0x2965('0x0'));var rimraf=require(_0x2965('0x1'));var zipdir=require(_0x2965('0x2'));var jsonpatch=require(_0x2965('0x3'));var rp=require('request-promise');var moment=require(_0x2965('0x4'));var BPromise=require('bluebird');var Mustache=require(_0x2965('0x5'));var util=require(_0x2965('0x6'));var path=require(_0x2965('0x7'));var sox=require(_0x2965('0x8'));var csv=require(_0x2965('0x9'));var ejs=require('ejs');var fs=require('fs');var fs_extra=require(_0x2965('0xa'));var _=require(_0x2965('0xb'));var squel=require(_0x2965('0xc'));var crypto=require(_0x2965('0xd'));var jsforce=require(_0x2965('0xe'));var deskjs=require(_0x2965('0xf'));var toCsv=require(_0x2965('0x9'));var querystring=require('querystring');var Papa=require(_0x2965('0x10'));var Redis=require(_0x2965('0x11'));var authService=require(_0x2965('0x12'));var qs=require(_0x2965('0x13'));var as=require(_0x2965('0x14'));var hardwareService=require('../../config/license/hardware');var logger=require(_0x2965('0x15'))('api');var utils=require(_0x2965('0x16'));var config=require('../../config/environment');var licenseUtil=require(_0x2965('0x17'));var db=require(_0x2965('0x18'))['db'];var integrations=require(_0x2965('0x19'));function respondWithStatusCode(_0x4f693c,_0x2d6beb){_0x2d6beb=_0x2d6beb||0xcc;return function(_0x342672){if(_0x342672){return _0x4f693c['sendStatus'](_0x2d6beb);}return _0x4f693c[_0x2965('0x1a')](_0x2d6beb)[_0x2965('0x1b')]();};}function respondWithResult(_0x56f80f,_0x51b8a2){_0x51b8a2=_0x51b8a2||0xc8;return function(_0x596dcd){if(_0x596dcd){return _0x56f80f[_0x2965('0x1a')](_0x51b8a2)[_0x2965('0x1c')](_0x596dcd);}};}function respondWithFilteredResult(_0x27ee34,_0x435c4b){return function(_0x418eed){if(_0x418eed){var _0x3c27e6=typeof _0x435c4b[_0x2965('0x1d')]===_0x2965('0x1e')&&typeof _0x435c4b[_0x2965('0x1f')]===_0x2965('0x1e');var _0x57a7bc=_0x418eed[_0x2965('0x20')];var _0x2c3df8=_0x3c27e6?0x0:_0x435c4b[_0x2965('0x1d')];var _0x57a73d=_0x3c27e6?_0x418eed[_0x2965('0x20')]:_0x435c4b['offset']+_0x435c4b[_0x2965('0x1f')];var _0x1f46a1;if(_0x57a73d>=_0x57a7bc){_0x57a73d=_0x57a7bc;_0x1f46a1=0xc8;}else{_0x1f46a1=0xce;}_0x27ee34[_0x2965('0x1a')](_0x1f46a1);return _0x27ee34['set']('Content-Range',_0x2c3df8+'-'+_0x57a73d+'/'+_0x57a7bc)[_0x2965('0x1c')](_0x418eed);}return null;};}function patchUpdates(_0x341123){return function(_0x223167){try{jsonpatch[_0x2965('0x21')](_0x223167,_0x341123,!![]);}catch(_0xdfabd1){return BPromise[_0x2965('0x22')](_0xdfabd1);}return _0x223167[_0x2965('0x23')]();};}function saveUpdates(_0x192474,_0x40daed){return function(_0x390ea3){if(_0x390ea3){return _0x390ea3['update'](_0x192474)[_0x2965('0x24')](function(_0x243495){return _0x243495;});}return null;};}function removeEntity(_0x143cbb,_0x4a922e){return function(_0x105cc8){if(_0x105cc8){return _0x105cc8[_0x2965('0x25')]()[_0x2965('0x24')](function(){_0x143cbb[_0x2965('0x1a')](0xcc)[_0x2965('0x1b')]();});}};}function handleEntityNotFound(_0x2159ab,_0x5d4e10){return function(_0x5bdab5){if(!_0x5bdab5){_0x2159ab[_0x2965('0x26')](0x194);}return _0x5bdab5;};}function handleError(_0x218a18,_0x87d314){_0x87d314=_0x87d314||0x1f4;return function(_0x19af82){logger['error'](_0x19af82['stack']);if(_0x19af82[_0x2965('0x27')]){delete _0x19af82[_0x2965('0x27')];}_0x218a18[_0x2965('0x1a')](_0x87d314)[_0x2965('0x28')](_0x19af82);};}exports[_0x2965('0x29')]=function(_0x5c7f79,_0x416ba8){var _0xcc5f0a={},_0x10c0a8={},_0x406854={'count':0x0,'rows':[]};var _0x237f3a=_['map'](db['ServicenowAccount']['rawAttributes'],function(_0x489170){return{'name':_0x489170[_0x2965('0x2a')],'type':_0x489170['type'][_0x2965('0x2b')]};});_0x10c0a8[_0x2965('0x2c')]=_['map'](_0x237f3a,_0x2965('0x27'));_0x10c0a8[_0x2965('0x2d')]=_[_0x2965('0x2e')](_0x5c7f79['query']);_0x10c0a8[_0x2965('0x2f')]=_['intersection'](_0x10c0a8[_0x2965('0x2c')],_0x10c0a8[_0x2965('0x2d')]);_0xcc5f0a['attributes']=_[_0x2965('0x30')](_0x10c0a8[_0x2965('0x2c')],qs[_0x2965('0x31')](_0x5c7f79[_0x2965('0x2d')][_0x2965('0x31')]));_0xcc5f0a['attributes']=_0xcc5f0a[_0x2965('0x32')][_0x2965('0x33')]?_0xcc5f0a[_0x2965('0x32')]:_0x10c0a8[_0x2965('0x2c')];if(!_0x5c7f79[_0x2965('0x2d')][_0x2965('0x34')](_0x2965('0x35'))){_0xcc5f0a[_0x2965('0x1f')]=qs[_0x2965('0x1f')](_0x5c7f79[_0x2965('0x2d')][_0x2965('0x1f')]);_0xcc5f0a[_0x2965('0x1d')]=qs[_0x2965('0x1d')](_0x5c7f79[_0x2965('0x2d')][_0x2965('0x1d')]);}_0xcc5f0a[_0x2965('0x36')]=qs[_0x2965('0x37')](_0x5c7f79[_0x2965('0x2d')][_0x2965('0x37')]);_0xcc5f0a[_0x2965('0x38')]=qs[_0x2965('0x2f')](_[_0x2965('0x39')](_0x5c7f79[_0x2965('0x2d')],_0x10c0a8[_0x2965('0x2f')]),_0x237f3a);if(_0x5c7f79[_0x2965('0x2d')]['filter']){_0xcc5f0a['where']=_['merge'](_0xcc5f0a[_0x2965('0x38')],{'$or':_[_0x2965('0x3a')](_0x237f3a,function(_0x160335){if(_0x160335[_0x2965('0x3b')]!=='VIRTUAL'){var _0x130ec4={};_0x130ec4[_0x160335['name']]={'$like':'%'+_0x5c7f79['query'][_0x2965('0x3c')]+'%'};return _0x130ec4;}})});}_0xcc5f0a=_[_0x2965('0x3d')]({},_0xcc5f0a,_0x5c7f79['options']);var _0x21db3e={'where':_0xcc5f0a['where']};return db[_0x2965('0x3e')][_0x2965('0x20')](_0x21db3e)[_0x2965('0x24')](function(_0xddd987){_0x406854[_0x2965('0x20')]=_0xddd987;if(_0x5c7f79['query']['includeAll']){_0xcc5f0a[_0x2965('0x3f')]=[{'all':!![]}];}return db[_0x2965('0x3e')][_0x2965('0x40')](_0xcc5f0a);})[_0x2965('0x24')](function(_0x138f49){_0x406854[_0x2965('0x41')]=_0x138f49;return _0x406854;})[_0x2965('0x24')](respondWithFilteredResult(_0x416ba8,_0xcc5f0a))[_0x2965('0x42')](handleError(_0x416ba8,null));};exports[_0x2965('0x43')]=function(_0x2803ea,_0x484a44){var _0x2c77ce={'raw':![],'where':{'id':_0x2803ea[_0x2965('0x44')]['id']}},_0x27153f={};_0x27153f[_0x2965('0x2c')]=_['keys'](db[_0x2965('0x3e')][_0x2965('0x45')]);_0x27153f['query']=_[_0x2965('0x2e')](_0x2803ea[_0x2965('0x2d')]);_0x27153f['filters']=_[_0x2965('0x30')](_0x27153f[_0x2965('0x2c')],_0x27153f[_0x2965('0x2d')]);_0x2c77ce[_0x2965('0x32')]=_[_0x2965('0x30')](_0x27153f[_0x2965('0x2c')],qs[_0x2965('0x31')](_0x2803ea[_0x2965('0x2d')][_0x2965('0x31')]));_0x2c77ce[_0x2965('0x32')]=_0x2c77ce[_0x2965('0x32')][_0x2965('0x33')]?_0x2c77ce['attributes']:_0x27153f[_0x2965('0x2c')];if(_0x2803ea['query'][_0x2965('0x46')]){_0x2c77ce[_0x2965('0x3f')]=[{'all':!![]}];}_0x2c77ce=_['merge']({},_0x2c77ce,_0x2803ea[_0x2965('0x47')]);return db[_0x2965('0x3e')][_0x2965('0x48')](_0x2c77ce)['then'](handleEntityNotFound(_0x484a44,null))['then'](respondWithResult(_0x484a44,null))[_0x2965('0x42')](handleError(_0x484a44,null));};exports[_0x2965('0x49')]=function(_0x1238b4,_0x8aea5b){return db[_0x2965('0x3e')][_0x2965('0x49')](_0x1238b4[_0x2965('0x4a')],{})['then'](respondWithResult(_0x8aea5b,0xc9))[_0x2965('0x42')](handleError(_0x8aea5b,null));};exports[_0x2965('0x4b')]=function(_0xbff15b,_0x2fdc83){if(_0xbff15b[_0x2965('0x4a')]['id']){delete _0xbff15b['body']['id'];}return db['ServicenowAccount']['find']({'where':{'id':_0xbff15b[_0x2965('0x44')]['id']}})[_0x2965('0x24')](handleEntityNotFound(_0x2fdc83,null))['then'](saveUpdates(_0xbff15b['body'],null))[_0x2965('0x24')](respondWithResult(_0x2fdc83,null))['catch'](handleError(_0x2fdc83,null));};exports[_0x2965('0x25')]=function(_0x35c7a5,_0xe78dd7){return db[_0x2965('0x3e')][_0x2965('0x48')]({'where':{'id':_0x35c7a5[_0x2965('0x44')]['id']}})['then'](handleEntityNotFound(_0xe78dd7,null))['then'](removeEntity(_0xe78dd7,null))['catch'](handleError(_0xe78dd7,null));};exports[_0x2965('0x4c')]=function(_0x2bc877,_0x50ba97,_0x2a5ead){var _0xb494c1={};var _0x3ed74d={};var _0x46920a;var _0x5c172e;return db[_0x2965('0x3e')][_0x2965('0x4d')]({'where':{'id':_0x2bc877['params']['id']}})[_0x2965('0x24')](handleEntityNotFound(_0x50ba97,null))[_0x2965('0x24')](function(_0x10c484){if(_0x10c484){_0x46920a=_0x10c484;_0x3ed74d[_0x2965('0x2c')]=_[_0x2965('0x2e')](db['ServicenowConfiguration'][_0x2965('0x45')]);_0x3ed74d[_0x2965('0x2d')]=_[_0x2965('0x2e')](_0x2bc877[_0x2965('0x2d')]);_0x3ed74d[_0x2965('0x2f')]=_[_0x2965('0x30')](_0x3ed74d[_0x2965('0x2c')],_0x3ed74d[_0x2965('0x2d')]);_0xb494c1[_0x2965('0x32')]=_[_0x2965('0x30')](_0x3ed74d[_0x2965('0x2c')],qs[_0x2965('0x31')](_0x2bc877['query']['fields']));_0xb494c1[_0x2965('0x32')]=_0xb494c1['attributes'][_0x2965('0x33')]?_0xb494c1['attributes']:_0x3ed74d[_0x2965('0x2c')];_0xb494c1[_0x2965('0x36')]=qs[_0x2965('0x37')](_0x2bc877['query'][_0x2965('0x37')]);_0xb494c1['where']=qs[_0x2965('0x2f')](_[_0x2965('0x39')](_0x2bc877[_0x2965('0x2d')],_0x3ed74d[_0x2965('0x2f')]));if(_0x2bc877['query'][_0x2965('0x3c')]){_0xb494c1[_0x2965('0x38')]=_['merge'](_0xb494c1['where'],{'$or':_[_0x2965('0x3a')](_0xb494c1[_0x2965('0x32')],function(_0x36e036){var _0x9a4df8={};_0x9a4df8[_0x36e036]={'$like':'%'+_0x2bc877[_0x2965('0x2d')][_0x2965('0x3c')]+'%'};return _0x9a4df8;})});}_0xb494c1=_[_0x2965('0x3d')]({},_0xb494c1,_0x2bc877[_0x2965('0x47')]);return _0x46920a[_0x2965('0x4c')](_0xb494c1);}})[_0x2965('0x24')](function(_0x298745){if(_0x298745){_0x5c172e=_0x298745[_0x2965('0x33')];if(!_0x2bc877[_0x2965('0x2d')]['hasOwnProperty'](_0x2965('0x35'))){_0xb494c1[_0x2965('0x1f')]=qs['limit'](_0x2bc877[_0x2965('0x2d')][_0x2965('0x1f')]);_0xb494c1[_0x2965('0x1d')]=qs[_0x2965('0x1d')](_0x2bc877[_0x2965('0x2d')][_0x2965('0x1d')]);}return _0x46920a[_0x2965('0x4c')](_0xb494c1);}})[_0x2965('0x24')](function(_0x1a1495){if(_0x1a1495){return _0x1a1495?{'count':_0x5c172e,'rows':_0x1a1495}:null;}})[_0x2965('0x24')](respondWithResult(_0x50ba97,null))[_0x2965('0x42')](handleError(_0x50ba97,null));};exports['addConfiguration']=function(_0x2e7636,_0x867bd7,_0x2015c2){if(_0x2e7636['body']['id']){delete _0x2e7636[_0x2965('0x4a')]['id'];}return db[_0x2965('0x3e')][_0x2965('0x4d')]({'where':{'id':_0x2e7636[_0x2965('0x44')]['id']}})[_0x2965('0x24')](handleEntityNotFound(_0x867bd7,null))['then'](function(_0x3bb9e7){if(_0x3bb9e7){_0x2e7636['body'][_0x2965('0x4e')]=_0x3bb9e7['id'];_0x2e7636[_0x2965('0x4a')][_0x2965('0x4f')]=integrations[_0x2965('0x50')](_0x2e7636[_0x2965('0x4a')][_0x2965('0x51')],_0x2e7636[_0x2965('0x4a')][_0x2965('0x3b')]);_0x2e7636[_0x2965('0x4a')]['Descriptions']=integrations['getDescriptions'](_0x2e7636['body'][_0x2965('0x51')],_0x2e7636['body'][_0x2965('0x3b')]);return db['ServicenowConfiguration'][_0x2965('0x49')](_0x2e7636[_0x2965('0x4a')],{'include':[{'model':db[_0x2965('0x52')],'as':'Subjects'},{'model':db['ServicenowField'],'as':_0x2965('0x53')}]});}return null;})[_0x2965('0x24')](respondWithResult(_0x867bd7,null))['catch'](handleError(_0x867bd7,null));};exports['getFields']=function(_0x488dd0,_0x5d6d6b,_0x27dd8d){var _0x536a3a=['made_sla',_0x2965('0x54'),_0x2965('0x55'),'subcategory',_0x2965('0x56'),'notify',_0x2965('0x57'),_0x2965('0x58'),_0x2965('0x59')];var _0xf7e925=['parent',_0x2965('0x5a'),_0x2965('0x5b'),_0x2965('0x5c'),_0x2965('0x5d'),_0x2965('0x5e'),_0x2965('0x5f'),'hold_reason',_0x2965('0x60'),'number',_0x2965('0x61'),_0x2965('0x62'),_0x2965('0x63'),'user_input',_0x2965('0x64'),_0x2965('0x65'),_0x2965('0x66'),_0x2965('0x67'),'knowledge',_0x2965('0x36'),_0x2965('0x68'),_0x2965('0x69'),'cmdb_ci','delivery_plan',_0x2965('0x6a'),_0x2965('0x6b'),_0x2965('0x6c'),'business_service',_0x2965('0x6d'),'sys_domain_path',_0x2965('0x6e'),_0x2965('0x6f'),_0x2965('0x70'),'opened_at',_0x2965('0x71'),_0x2965('0x72'),_0x2965('0x73'),_0x2965('0x74'),_0x2965('0x75'),_0x2965('0x76'),_0x2965('0x77'),'subcategory','work_notes',_0x2965('0x78'),_0x2965('0x56'),'correlation_display',_0x2965('0x79'),'work_start','assignment_group','business_stc',_0x2965('0x7a'),_0x2965('0x7b'),'calendar_duration','notify',_0x2965('0x7c'),_0x2965('0x7d'),_0x2965('0x7e'),_0x2965('0x7f'),'parent_incident',_0x2965('0x80'),_0x2965('0x81'),_0x2965('0x82'),'incident_state',_0x2965('0x83'),_0x2965('0x84'),_0x2965('0x85'),_0x2965('0x86'),_0x2965('0x87'),'assigned_to',_0x2965('0x58'),'comments','sla_due',_0x2965('0x88'),'comments_and_work_notes',_0x2965('0x89'),_0x2965('0x8a'),'reopen_count',_0x2965('0x8b'),'escalation','upon_approval',_0x2965('0x8c'),'location',_0x2965('0x59')];var _0x1e416a='';var _0x5a549b='';var _0x36976c=[];var _0x41b800='';var _0xe0acea='';var _0x3e24fc=[];var _0x34d48a='';var _0x46229e='';var _0x3e4523={};var _0x2e6d96='';return db[_0x2965('0x3e')]['findOne']({'where':{'id':_0x488dd0[_0x2965('0x44')]['id']},'attributes':['id','username',_0x2965('0x8d'),_0x2965('0x8e'),'remoteUri','serverUrl']})[_0x2965('0x24')](handleEntityNotFound(_0x5d6d6b,null))[_0x2965('0x24')](function(_0xd6d905){if(_0xd6d905){_0x2e6d96=_0xd6d905[_0x2965('0x8f')];var _0x58a5ec=_0x2e6d96[_0x2965('0x90')](-0x1);if(_0x58a5ec==='/'){_0x2e6d96=_0x2e6d96[_0x2965('0x91')](0x0,_0x2e6d96['lastIndexOf'](_0x58a5ec));}_0x46229e=util[_0x2965('0x92')](_0x2965('0x93'),_0x2e6d96);_0x34d48a=util[_0x2965('0x92')](_0x2965('0x94'),_0x2e6d96);_0x3e4523={'user':_0xd6d905[_0x2965('0x95')],'pass':_0xd6d905[_0x2965('0x8d')]};var _0x2b3a2c={'method':'GET','uri':_0x46229e+_0x2965('0x96'),'auth':_0x3e4523,'json':!![]};return rp(_0x2b3a2c);}})[_0x2965('0x24')](function(_0x2fb510){if(_0x2fb510[_0x2965('0x97')][_0x2965('0x33')]>0x0){_0x1e416a=_0x2fb510[_0x2965('0x97')];}console[_0x2965('0x98')](_0x2965('0x99'),_0x1e416a);_0x3e24fc=[];_0x5a549b=Object[_0x2965('0x9a')]([],_0x1e416a);_[_0x2965('0x9b')](_0x5a549b,function(_0xaf3418){return!_0x536a3a['includes'](_0xaf3418['name']);});_0x5a549b['forEach'](function(_0xfdee8d){var _0x43c96b=createFieldObject(_0x34d48a,_0x3e4523,_0xfdee8d[_0x2965('0x9c')],_0xfdee8d[_0x2965('0x27')],_0xfdee8d[_0x2965('0x9d')],![]);_0x3e24fc[_0x2965('0x9e')](_0x43c96b);});return Promise[_0x2965('0x9f')](_0x3e24fc);})['then'](function(_0x3cefcb){_0x36976c=_0x3cefcb;_0x41b800=Object[_0x2965('0x9a')]([],_0x1e416a);console['log'](_0x2965('0xa0'),_0x1e416a);_[_0x2965('0x9b')](_0x41b800,function(_0x3b0cf3){return _0xf7e925[_0x2965('0xa1')](_0x3b0cf3[_0x2965('0x27')]);});console[_0x2965('0x98')]('TCL:\x20exports.getEntityFields\x20->\x20_objectsCustom',_0x41b800);_0x3e24fc=[];_0x41b800[_0x2965('0xa2')](function(_0x51d4e9){var _0x2a7976=createFieldObject(_0x34d48a,_0x3e4523,_0x51d4e9['internalType'],_0x51d4e9[_0x2965('0x27')],_0x51d4e9[_0x2965('0x9d')],!![]);_0x3e24fc[_0x2965('0x9e')](_0x2a7976);});return Promise[_0x2965('0x9f')](_0x3e24fc);})[_0x2965('0x24')](function(_0x2d22bb){_0xe0acea=_0x2d22bb;var _0x16abac=_0x36976c[_0x2965('0xa3')](_0xe0acea);return{'count':_0x16abac[_0x2965('0x33')],'rows':_0x16abac};})[_0x2965('0x24')](respondWithResult(_0x5d6d6b,null))['catch'](function(_0x3ee107){console['log'](_0x2965('0xa4')+_0x3ee107);var _0x16d85b=_0x488dd0[_0x2965('0x2d')][_0x2965('0xa5')]?0x1f4:_0x3ee107['statusCode']||0x1f4;logger[_0x2965('0xa6')](_0x3ee107[_0x2965('0xa7')]);delete _0x3ee107[_0x2965('0x27')];if(_0x16d85b===0x191){_0x16d85b=0x190;}_0x5d6d6b[_0x2965('0x1a')](_0x16d85b)['send'](_0x488dd0[_0x2965('0x2d')][_0x2965('0xa5')]?{'message':_0x2965('0xa8'),'statusCode':_0x3ee107[_0x2965('0xa9')]}:_0x3ee107);});};function createFieldObject(_0x55b495,_0x5b0275,_0x35f0f2,_0xa64666,_0x54b13c,_0x2c4217){return new Promise(function(_0xc89d87,_0x29b497){var _0xbb7291={'id':_0xa64666,'name':_0x54b13c,'custom':_0x2c4217};if(_0x35f0f2===_0x2965('0xaa')){_0xbb7291[_0x2965('0x47')]=[{'name':'True','value':'true'},{'name':'False','value':'false'}];_0xc89d87(_0xbb7291);}else{var _0x24991b={'method':_0x2965('0xab'),'uri':_0x55b495+_0x2965('0xac')+_0xa64666,'auth':_0x5b0275,'json':!![]};return rp(_0x24991b)['then'](function(_0x3039eb){var _0x554ab7=[];if(_0x3039eb['result'][_0x2965('0x33')]>0x0){_0x3039eb[_0x2965('0x97')][_0x2965('0xa2')](function(_0x47778e){if(_0x47778e[_0x2965('0xad')]==='false'){var _0xb014f0={'name':_0x47778e[_0x2965('0x9d')],'value':_0x47778e[_0x2965('0xae')]};_0x554ab7[_0x2965('0x9e')](_0xb014f0);}});}_0xbb7291['options']=_0x554ab7;if(_0xbb7291[_0x2965('0x47')]['length']>0x0){_0xc89d87(_0xbb7291);}else{if(_0x2c4217==![]){_0xc89d87();}else{_0xc89d87(_0xbb7291);}}});}});} \ No newline at end of file diff --git a/server/api/intServicenowAccount/intServicenowAccount.model.js b/server/api/intServicenowAccount/intServicenowAccount.model.js index 58670f6..3ca7647 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 _0x2eb2=['request-promise','rimraf','../../components/integrations/configuration','exports','define','ServicenowAccount','int_servicenow_accounts','util','../../config/logger','api','moment','bluebird'];(function(_0x1cdcb7,_0x2c617a){var _0x592433=function(_0x1546cc){while(--_0x1546cc){_0x1cdcb7['push'](_0x1cdcb7['shift']());}};_0x592433(++_0x2c617a);}(_0x2eb2,0x19f));var _0x22eb=function(_0x4d07cc,_0x587613){_0x4d07cc=_0x4d07cc-0x0;var _0x42de3b=_0x2eb2[_0x4d07cc];return _0x42de3b;};'use strict';var _=require('lodash');var util=require(_0x22eb('0x0'));var logger=require(_0x22eb('0x1'))(_0x22eb('0x2'));var moment=require(_0x22eb('0x3'));var BPromise=require(_0x22eb('0x4'));var rp=require(_0x22eb('0x5'));var fs=require('fs');var path=require('path');var rimraf=require(_0x22eb('0x6'));var config=require('../../config/environment');var attributes=require('./intServicenowAccount.attributes');var integrations=require(_0x22eb('0x7'));module[_0x22eb('0x8')]=function(_0x35dd5b,_0x2a9850){return _0x35dd5b[_0x22eb('0x9')](_0x22eb('0xa'),attributes,{'tableName':_0x22eb('0xb'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x1883=['../../config/environment','./intServicenowAccount.attributes','../../components/integrations/configuration','exports','define','ServicenowAccount','lodash','util','../../config/logger','api','moment','bluebird','request-promise','path','rimraf'];(function(_0x40e5d9,_0x36f0ce){var _0x4c395d=function(_0x113725){while(--_0x113725){_0x40e5d9['push'](_0x40e5d9['shift']());}};_0x4c395d(++_0x36f0ce);}(_0x1883,0xab));var _0x3188=function(_0x33bfd0,_0x3a0d64){_0x33bfd0=_0x33bfd0-0x0;var _0xac2810=_0x1883[_0x33bfd0];return _0xac2810;};'use strict';var _=require(_0x3188('0x0'));var util=require(_0x3188('0x1'));var logger=require(_0x3188('0x2'))(_0x3188('0x3'));var moment=require(_0x3188('0x4'));var BPromise=require(_0x3188('0x5'));var rp=require(_0x3188('0x6'));var fs=require('fs');var path=require(_0x3188('0x7'));var rimraf=require(_0x3188('0x8'));var config=require(_0x3188('0x9'));var attributes=require(_0x3188('0xa'));var integrations=require(_0x3188('0xb'));module[_0x3188('0xc')]=function(_0x33b62d,_0x24f2f1){return _0x33b62d[_0x3188('0xd')](_0x3188('0xe'),attributes,{'tableName':'int_servicenow_accounts','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 6fadda1..0e415e9 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 _0x1251=['request','then','ServicenowAccount,\x20%s,\x20%s','request\x20sent','debug','ServicenowAccount,\x20%s,\x20%s,\x20%s','error','message','info','result','catch','ServicenowAccount','findAll','options','where','attributes','limit','include','map','model','GetServicenowAccount','stringify','ShowServicenowAccount','find','raw','util','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/environment','jayson/promise','client','http'];(function(_0x126558,_0x143c9a){var _0x1f6d14=function(_0x2b0eea){while(--_0x2b0eea){_0x126558['push'](_0x126558['shift']());}};_0x1f6d14(++_0x143c9a);}(_0x1251,0x1a5));var _0x1125=function(_0xd4fbec,_0x36794b){_0xd4fbec=_0xd4fbec-0x0;var _0x32c361=_0x1251[_0xd4fbec];return _0x32c361;};'use strict';var _=require('lodash');var util=require(_0x1125('0x0'));var moment=require(_0x1125('0x1'));var BPromise=require(_0x1125('0x2'));var rs=require(_0x1125('0x3'));var fs=require('fs');var Redis=require(_0x1125('0x4'));var db=require(_0x1125('0x5'))['db'];var utils=require(_0x1125('0x6'));var logger=require('../../config/logger')('rpc');var config=require(_0x1125('0x7'));var jayson=require(_0x1125('0x8'));var client=jayson[_0x1125('0x9')][_0x1125('0xa')]({'port':0x232a});function respondWithRpcPromise(_0x117c3b,_0x3e7ceb,_0x546660){return new BPromise(function(_0xa5eddc,_0x13cf7c){return client[_0x1125('0xb')](_0x117c3b,_0x546660)[_0x1125('0xc')](function(_0x50ecfc){logger['info'](_0x1125('0xd'),_0x3e7ceb,_0x1125('0xe'));logger[_0x1125('0xf')](_0x1125('0x10'),_0x3e7ceb,_0x1125('0xe'),JSON['stringify'](_0x50ecfc));if(_0x50ecfc[_0x1125('0x11')]){if(_0x50ecfc[_0x1125('0x11')]['code']===0x1f4){logger[_0x1125('0x11')](_0x1125('0xd'),_0x3e7ceb,_0x50ecfc['error']['message']);return _0x13cf7c(_0x50ecfc[_0x1125('0x11')][_0x1125('0x12')]);}logger['error'](_0x1125('0xd'),_0x3e7ceb,_0x50ecfc['error']['message']);return _0xa5eddc(_0x50ecfc[_0x1125('0x11')][_0x1125('0x12')]);}else{logger[_0x1125('0x13')](_0x1125('0xd'),_0x3e7ceb,_0x1125('0xe'));_0xa5eddc(_0x50ecfc[_0x1125('0x14')][_0x1125('0x12')]);}})[_0x1125('0x15')](function(_0x453cd1){logger['error']('ServicenowAccount,\x20%s,\x20%s',_0x3e7ceb,_0x453cd1);_0x13cf7c(_0x453cd1);});});}exports['GetServicenowAccount']=function(_0x3c17b6){var _0x315b79=this;return new Promise(function(_0x59d4ac,_0x3f41d1){return db[_0x1125('0x16')][_0x1125('0x17')]({'raw':_0x3c17b6[_0x1125('0x18')]?_0x3c17b6['options']['raw']===undefined?!![]:![]:!![],'where':_0x3c17b6['options']?_0x3c17b6[_0x1125('0x18')][_0x1125('0x19')]||null:null,'attributes':_0x3c17b6[_0x1125('0x18')]?_0x3c17b6[_0x1125('0x18')][_0x1125('0x1a')]||null:null,'limit':_0x3c17b6['options']?_0x3c17b6[_0x1125('0x18')][_0x1125('0x1b')]||null:null,'include':_0x3c17b6[_0x1125('0x18')]?_0x3c17b6[_0x1125('0x18')][_0x1125('0x1c')]?_['map'](_0x3c17b6[_0x1125('0x18')][_0x1125('0x1c')],function(_0x1c0ecf){return{'model':db[_0x1c0ecf['model']],'as':_0x1c0ecf['as'],'attributes':_0x1c0ecf[_0x1125('0x1a')],'include':_0x1c0ecf['include']?_[_0x1125('0x1d')](_0x1c0ecf[_0x1125('0x1c')],function(_0x412e53){return{'model':db[_0x412e53[_0x1125('0x1e')]],'as':_0x412e53['as'],'attributes':_0x412e53[_0x1125('0x1a')],'include':_0x412e53['include']?_['map'](_0x412e53['include'],function(_0x40a0ef){return{'model':db[_0x40a0ef[_0x1125('0x1e')]],'as':_0x40a0ef['as'],'attributes':_0x40a0ef[_0x1125('0x1a')]};}):[]};}):[]};}):[]:[]})[_0x1125('0xc')](function(_0x26e4b3){logger[_0x1125('0x13')](_0x1125('0x1f'),_0x3c17b6);logger['debug'](_0x1125('0x1f'),_0x3c17b6,JSON[_0x1125('0x20')](_0x26e4b3));_0x59d4ac(_0x26e4b3);})['catch'](function(_0x3b2317){logger[_0x1125('0x11')](_0x1125('0x1f'),_0x3b2317['message'],_0x3c17b6);_0x3f41d1(_0x315b79[_0x1125('0x11')](0x1f4,_0x3b2317['message']));});});};exports[_0x1125('0x21')]=function(_0x1bbd9e){var _0x4acb05=this;return new Promise(function(_0x1573ad,_0x5e20d2){return db[_0x1125('0x16')][_0x1125('0x22')]({'raw':_0x1bbd9e[_0x1125('0x18')]?_0x1bbd9e[_0x1125('0x18')][_0x1125('0x23')]===undefined?!![]:![]:!![],'where':_0x1bbd9e[_0x1125('0x18')]?_0x1bbd9e[_0x1125('0x18')][_0x1125('0x19')]||null:null,'attributes':_0x1bbd9e[_0x1125('0x18')]?_0x1bbd9e[_0x1125('0x18')][_0x1125('0x1a')]||null:null,'include':_0x1bbd9e[_0x1125('0x18')]?_0x1bbd9e[_0x1125('0x18')][_0x1125('0x1c')]?_[_0x1125('0x1d')](_0x1bbd9e[_0x1125('0x18')][_0x1125('0x1c')],function(_0x9e7f39){return{'model':db[_0x9e7f39[_0x1125('0x1e')]],'as':_0x9e7f39['as'],'attributes':_0x9e7f39[_0x1125('0x1a')],'include':_0x9e7f39[_0x1125('0x1c')]?_[_0x1125('0x1d')](_0x9e7f39['include'],function(_0x2e4c58){return{'model':db[_0x2e4c58[_0x1125('0x1e')]],'as':_0x2e4c58['as'],'attributes':_0x2e4c58[_0x1125('0x1a')],'include':_0x2e4c58[_0x1125('0x1c')]?_[_0x1125('0x1d')](_0x2e4c58[_0x1125('0x1c')],function(_0x308eca){return{'model':db[_0x308eca[_0x1125('0x1e')]],'as':_0x308eca['as'],'attributes':_0x308eca['attributes']};}):[]};}):[]};}):[]:[]})['then'](function(_0x7e394){logger[_0x1125('0x13')](_0x1125('0x21'),_0x1bbd9e);logger[_0x1125('0xf')]('ShowServicenowAccount',_0x1bbd9e,JSON[_0x1125('0x20')](_0x7e394));_0x1573ad(_0x7e394);})[_0x1125('0x15')](function(_0x58fc8f){logger[_0x1125('0x11')](_0x1125('0x21'),_0x58fc8f[_0x1125('0x12')],_0x1bbd9e);_0x5e20d2(_0x4acb05[_0x1125('0x11')](0x1f4,_0x58fc8f['message']));});});}; \ No newline at end of file +var _0xe8f2=['ShowServicenowAccount','find','lodash','util','moment','bluebird','ioredis','../../config/utils','../../config/logger','rpc','http','request','then','ServicenowAccount,\x20%s,\x20%s','ServicenowAccount,\x20%s,\x20%s,\x20%s','error','code','message','info','request\x20sent','catch','GetServicenowAccount','ServicenowAccount','findAll','options','raw','where','attributes','limit','include','map','model','debug','stringify'];(function(_0x1dd63f,_0x23475c){var _0x3cf1fc=function(_0x488c20){while(--_0x488c20){_0x1dd63f['push'](_0x1dd63f['shift']());}};_0x3cf1fc(++_0x23475c);}(_0xe8f2,0xf0));var _0x2e8f=function(_0x1e9e54,_0x56bf22){_0x1e9e54=_0x1e9e54-0x0;var _0x259995=_0xe8f2[_0x1e9e54];return _0x259995;};'use strict';var _=require(_0x2e8f('0x0'));var util=require(_0x2e8f('0x1'));var moment=require(_0x2e8f('0x2'));var BPromise=require(_0x2e8f('0x3'));var rs=require('randomstring');var fs=require('fs');var Redis=require(_0x2e8f('0x4'));var db=require('../../mysqldb')['db'];var utils=require(_0x2e8f('0x5'));var logger=require(_0x2e8f('0x6'))(_0x2e8f('0x7'));var config=require('../../config/environment');var jayson=require('jayson/promise');var client=jayson['client'][_0x2e8f('0x8')]({'port':0x232a});function respondWithRpcPromise(_0x142aff,_0x5e2593,_0x10d1c9){return new BPromise(function(_0x28fadf,_0x518b79){return client[_0x2e8f('0x9')](_0x142aff,_0x10d1c9)[_0x2e8f('0xa')](function(_0x56719f){logger['info'](_0x2e8f('0xb'),_0x5e2593,'request\x20sent');logger['debug'](_0x2e8f('0xc'),_0x5e2593,'request\x20sent',JSON['stringify'](_0x56719f));if(_0x56719f[_0x2e8f('0xd')]){if(_0x56719f['error'][_0x2e8f('0xe')]===0x1f4){logger[_0x2e8f('0xd')](_0x2e8f('0xb'),_0x5e2593,_0x56719f[_0x2e8f('0xd')][_0x2e8f('0xf')]);return _0x518b79(_0x56719f['error'][_0x2e8f('0xf')]);}logger['error']('ServicenowAccount,\x20%s,\x20%s',_0x5e2593,_0x56719f[_0x2e8f('0xd')][_0x2e8f('0xf')]);return _0x28fadf(_0x56719f['error'][_0x2e8f('0xf')]);}else{logger[_0x2e8f('0x10')](_0x2e8f('0xb'),_0x5e2593,_0x2e8f('0x11'));_0x28fadf(_0x56719f['result']['message']);}})[_0x2e8f('0x12')](function(_0x18a021){logger[_0x2e8f('0xd')](_0x2e8f('0xb'),_0x5e2593,_0x18a021);_0x518b79(_0x18a021);});});}exports[_0x2e8f('0x13')]=function(_0x422b69){var _0x58981c=this;return new Promise(function(_0x3ccc42,_0x599916){return db[_0x2e8f('0x14')][_0x2e8f('0x15')]({'raw':_0x422b69[_0x2e8f('0x16')]?_0x422b69[_0x2e8f('0x16')][_0x2e8f('0x17')]===undefined?!![]:![]:!![],'where':_0x422b69[_0x2e8f('0x16')]?_0x422b69[_0x2e8f('0x16')][_0x2e8f('0x18')]||null:null,'attributes':_0x422b69[_0x2e8f('0x16')]?_0x422b69[_0x2e8f('0x16')][_0x2e8f('0x19')]||null:null,'limit':_0x422b69['options']?_0x422b69['options'][_0x2e8f('0x1a')]||null:null,'include':_0x422b69[_0x2e8f('0x16')]?_0x422b69[_0x2e8f('0x16')][_0x2e8f('0x1b')]?_[_0x2e8f('0x1c')](_0x422b69[_0x2e8f('0x16')][_0x2e8f('0x1b')],function(_0x57c99a){return{'model':db[_0x57c99a[_0x2e8f('0x1d')]],'as':_0x57c99a['as'],'attributes':_0x57c99a[_0x2e8f('0x19')],'include':_0x57c99a[_0x2e8f('0x1b')]?_['map'](_0x57c99a[_0x2e8f('0x1b')],function(_0x17b589){return{'model':db[_0x17b589['model']],'as':_0x17b589['as'],'attributes':_0x17b589['attributes'],'include':_0x17b589[_0x2e8f('0x1b')]?_['map'](_0x17b589['include'],function(_0x224da4){return{'model':db[_0x224da4['model']],'as':_0x224da4['as'],'attributes':_0x224da4['attributes']};}):[]};}):[]};}):[]:[]})['then'](function(_0x452022){logger[_0x2e8f('0x10')](_0x2e8f('0x13'),_0x422b69);logger[_0x2e8f('0x1e')]('GetServicenowAccount',_0x422b69,JSON[_0x2e8f('0x1f')](_0x452022));_0x3ccc42(_0x452022);})[_0x2e8f('0x12')](function(_0x55be37){logger[_0x2e8f('0xd')](_0x2e8f('0x13'),_0x55be37[_0x2e8f('0xf')],_0x422b69);_0x599916(_0x58981c[_0x2e8f('0xd')](0x1f4,_0x55be37[_0x2e8f('0xf')]));});});};exports[_0x2e8f('0x20')]=function(_0x590087){var _0x455059=this;return new Promise(function(_0xc562b8,_0x55c52e){return db[_0x2e8f('0x14')][_0x2e8f('0x21')]({'raw':_0x590087[_0x2e8f('0x16')]?_0x590087[_0x2e8f('0x16')][_0x2e8f('0x17')]===undefined?!![]:![]:!![],'where':_0x590087[_0x2e8f('0x16')]?_0x590087['options'][_0x2e8f('0x18')]||null:null,'attributes':_0x590087[_0x2e8f('0x16')]?_0x590087[_0x2e8f('0x16')]['attributes']||null:null,'include':_0x590087[_0x2e8f('0x16')]?_0x590087[_0x2e8f('0x16')][_0x2e8f('0x1b')]?_[_0x2e8f('0x1c')](_0x590087[_0x2e8f('0x16')][_0x2e8f('0x1b')],function(_0x200103){return{'model':db[_0x200103[_0x2e8f('0x1d')]],'as':_0x200103['as'],'attributes':_0x200103[_0x2e8f('0x19')],'include':_0x200103[_0x2e8f('0x1b')]?_['map'](_0x200103[_0x2e8f('0x1b')],function(_0x3b074c){return{'model':db[_0x3b074c[_0x2e8f('0x1d')]],'as':_0x3b074c['as'],'attributes':_0x3b074c[_0x2e8f('0x19')],'include':_0x3b074c[_0x2e8f('0x1b')]?_[_0x2e8f('0x1c')](_0x3b074c[_0x2e8f('0x1b')],function(_0x2b511c){return{'model':db[_0x2b511c['model']],'as':_0x2b511c['as'],'attributes':_0x2b511c[_0x2e8f('0x19')]};}):[]};}):[]};}):[]:[]})[_0x2e8f('0xa')](function(_0x55611e){logger[_0x2e8f('0x10')](_0x2e8f('0x20'),_0x590087);logger[_0x2e8f('0x1e')]('ShowServicenowAccount',_0x590087,JSON[_0x2e8f('0x1f')](_0x55611e));_0xc562b8(_0x55611e);})[_0x2e8f('0x12')](function(_0x4946f2){logger[_0x2e8f('0xd')](_0x2e8f('0x20'),_0x4946f2['message'],_0x590087);_0x55c52e(_0x455059['error'](0x1f4,_0x4946f2[_0x2e8f('0xf')]));});});}; \ No newline at end of file diff --git a/server/api/intServicenowConfiguration/index.js b/server/api/intServicenowConfiguration/index.js index 3186595..370a5d0 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 _0xe98c=['getDescriptions','post','create','update','delete','exports','util','connect-timeout','express','Router','../../components/auth/service','../../components/interaction/service','../../config/environment','./intServicenowConfiguration.controller','get','isAuthenticated','index','/:id','show','/:id/fields','getFields','/:id/subjects','getSubjects','/:id/descriptions'];(function(_0xa464c9,_0x7c86d8){var _0x3d73c4=function(_0x5c2056){while(--_0x5c2056){_0xa464c9['push'](_0xa464c9['shift']());}};_0x3d73c4(++_0x7c86d8);}(_0xe98c,0x19e));var _0xce98=function(_0x122215,_0x1781ff){_0x122215=_0x122215-0x0;var _0x5636d2=_0xe98c[_0x122215];return _0x5636d2;};'use strict';var multer=require('multer');var util=require(_0xce98('0x0'));var path=require('path');var timeout=require(_0xce98('0x1'));var express=require(_0xce98('0x2'));var router=express[_0xce98('0x3')]();var fs_extra=require('fs-extra');var auth=require(_0xce98('0x4'));var interaction=require(_0xce98('0x5'));var config=require(_0xce98('0x6'));var controller=require(_0xce98('0x7'));router[_0xce98('0x8')]('/',auth[_0xce98('0x9')](),controller[_0xce98('0xa')]);router[_0xce98('0x8')](_0xce98('0xb'),auth[_0xce98('0x9')](),controller[_0xce98('0xc')]);router[_0xce98('0x8')](_0xce98('0xd'),auth['isAuthenticated'](),controller[_0xce98('0xe')]);router[_0xce98('0x8')](_0xce98('0xf'),auth[_0xce98('0x9')](),controller[_0xce98('0x10')]);router[_0xce98('0x8')](_0xce98('0x11'),auth[_0xce98('0x9')](),controller[_0xce98('0x12')]);router[_0xce98('0x13')]('/',auth[_0xce98('0x9')](),controller[_0xce98('0x14')]);router['put'](_0xce98('0xb'),auth[_0xce98('0x9')](),controller[_0xce98('0x15')]);router[_0xce98('0x16')]('/:id',auth[_0xce98('0x9')](),controller['destroy']);module[_0xce98('0x17')]=router; \ No newline at end of file +var _0x1b9f=['delete','destroy','exports','util','path','connect-timeout','express','Router','fs-extra','../../config/environment','./intServicenowConfiguration.controller','isAuthenticated','index','get','/:id','show','getFields','getSubjects','/:id/descriptions','update'];(function(_0xe1e2e8,_0x2bbfba){var _0x21f484=function(_0xc7c9aa){while(--_0xc7c9aa){_0xe1e2e8['push'](_0xe1e2e8['shift']());}};_0x21f484(++_0x2bbfba);}(_0x1b9f,0x11b));var _0xf1b9=function(_0x540aa2,_0x21f488){_0x540aa2=_0x540aa2-0x0;var _0x3b4770=_0x1b9f[_0x540aa2];return _0x3b4770;};'use strict';var multer=require('multer');var util=require(_0xf1b9('0x0'));var path=require(_0xf1b9('0x1'));var timeout=require(_0xf1b9('0x2'));var express=require(_0xf1b9('0x3'));var router=express[_0xf1b9('0x4')]();var fs_extra=require(_0xf1b9('0x5'));var auth=require('../../components/auth/service');var interaction=require('../../components/interaction/service');var config=require(_0xf1b9('0x6'));var controller=require(_0xf1b9('0x7'));router['get']('/',auth[_0xf1b9('0x8')](),controller[_0xf1b9('0x9')]);router[_0xf1b9('0xa')](_0xf1b9('0xb'),auth['isAuthenticated'](),controller[_0xf1b9('0xc')]);router[_0xf1b9('0xa')]('/:id/fields',auth['isAuthenticated'](),controller[_0xf1b9('0xd')]);router['get']('/:id/subjects',auth[_0xf1b9('0x8')](),controller[_0xf1b9('0xe')]);router[_0xf1b9('0xa')](_0xf1b9('0xf'),auth[_0xf1b9('0x8')](),controller['getDescriptions']);router['post']('/',auth[_0xf1b9('0x8')](),controller['create']);router['put']('/:id',auth['isAuthenticated'](),controller[_0xf1b9('0x10')]);router[_0xf1b9('0x11')]('/:id',auth['isAuthenticated'](),controller[_0xf1b9('0x12')]);module[_0xf1b9('0x13')]=router; \ No newline at end of file diff --git a/server/api/intServicenowConfiguration/intServicenowConfiguration.attributes.js b/server/api/intServicenowConfiguration/intServicenowConfiguration.attributes.js index 7c9395e..3df1251 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 _0xac19=['sequelize','exports'];(function(_0x565c49,_0x54acd0){var _0x20ca34=function(_0x42f7e1){while(--_0x42f7e1){_0x565c49['push'](_0x565c49['shift']());}};_0x20ca34(++_0x54acd0);}(_0xac19,0xb4));var _0x9ac1=function(_0x256011,_0x28bb88){_0x256011=_0x256011-0x0;var _0xcb704f=_0xac19[_0x256011];return _0xcb704f;};'use strict';var Sequelize=require(_0x9ac1('0x0'));module[_0x9ac1('0x1')]={'name':{'type':Sequelize['STRING']},'description':{'type':Sequelize['STRING']}}; \ No newline at end of file +var _0x23fe=['exports','STRING'];(function(_0x2a25eb,_0x131fe3){var _0x23e20a=function(_0x3524ad){while(--_0x3524ad){_0x2a25eb['push'](_0x2a25eb['shift']());}};_0x23e20a(++_0x131fe3);}(_0x23fe,0x10a));var _0xe23f=function(_0x17d9e3,_0x1f969c){_0x17d9e3=_0x17d9e3-0x0;var _0x14192d=_0x23fe[_0x17d9e3];return _0x14192d;};'use strict';var Sequelize=require('sequelize');module[_0xe23f('0x0')]={'name':{'type':Sequelize[_0xe23f('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 f723739..fc44616 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 _0x7868=['status','json','offset','limit','count','apply','save','update','then','destroy','error','stack','name','send','map','ServicenowConfiguration','rawAttributes','fieldName','key','model','query','keys','filters','intersection','attributes','fields','nolimit','order','sort','where','pick','filter','type','merge','options','include','findAll','rows','show','params','includeAll','find','catch','create','body','getFields','findOne','ServicenowField','length','hasOwnProperty','getSubjects','getDescriptions','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','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','sendStatus','end'];(function(_0x3b68d9,_0x4523de){var _0x479cd4=function(_0x1a006d){while(--_0x1a006d){_0x3b68d9['push'](_0x3b68d9['shift']());}};_0x479cd4(++_0x4523de);}(_0x7868,0x1ce));var _0x8786=function(_0x1e94fd,_0x2a3eed){_0x1e94fd=_0x1e94fd-0x0;var _0x41f3f=_0x7868[_0x1e94fd];return _0x41f3f;};'use strict';var emlformat=require('eml-format');var rimraf=require(_0x8786('0x0'));var zipdir=require(_0x8786('0x1'));var jsonpatch=require(_0x8786('0x2'));var rp=require(_0x8786('0x3'));var moment=require(_0x8786('0x4'));var BPromise=require(_0x8786('0x5'));var Mustache=require(_0x8786('0x6'));var util=require(_0x8786('0x7'));var path=require(_0x8786('0x8'));var sox=require(_0x8786('0x9'));var csv=require(_0x8786('0xa'));var ejs=require('ejs');var fs=require('fs');var fs_extra=require(_0x8786('0xb'));var _=require(_0x8786('0xc'));var squel=require(_0x8786('0xd'));var crypto=require(_0x8786('0xe'));var jsforce=require(_0x8786('0xf'));var deskjs=require(_0x8786('0x10'));var toCsv=require(_0x8786('0xa'));var querystring=require('querystring');var Papa=require(_0x8786('0x11'));var Redis=require(_0x8786('0x12'));var authService=require(_0x8786('0x13'));var qs=require(_0x8786('0x14'));var as=require(_0x8786('0x15'));var hardwareService=require(_0x8786('0x16'));var logger=require(_0x8786('0x17'))('api');var utils=require(_0x8786('0x18'));var config=require(_0x8786('0x19'));var licenseUtil=require(_0x8786('0x1a'));var db=require(_0x8786('0x1b'))['db'];function respondWithStatusCode(_0xb5f0fb,_0x278b9c){_0x278b9c=_0x278b9c||0xcc;return function(_0x29a02b){if(_0x29a02b){return _0xb5f0fb[_0x8786('0x1c')](_0x278b9c);}return _0xb5f0fb['status'](_0x278b9c)[_0x8786('0x1d')]();};}function respondWithResult(_0x4f4b04,_0x1d8655){_0x1d8655=_0x1d8655||0xc8;return function(_0x3523cc){if(_0x3523cc){return _0x4f4b04[_0x8786('0x1e')](_0x1d8655)[_0x8786('0x1f')](_0x3523cc);}};}function respondWithFilteredResult(_0x15a27a,_0xed8282){return function(_0x19f675){if(_0x19f675){var _0x4cfb18=typeof _0xed8282[_0x8786('0x20')]==='undefined'&&typeof _0xed8282[_0x8786('0x21')]==='undefined';var _0x1a574d=_0x19f675[_0x8786('0x22')];var _0x37af9a=_0x4cfb18?0x0:_0xed8282[_0x8786('0x20')];var _0x451cf1=_0x4cfb18?_0x19f675[_0x8786('0x22')]:_0xed8282[_0x8786('0x20')]+_0xed8282[_0x8786('0x21')];var _0x546ec1;if(_0x451cf1>=_0x1a574d){_0x451cf1=_0x1a574d;_0x546ec1=0xc8;}else{_0x546ec1=0xce;}_0x15a27a[_0x8786('0x1e')](_0x546ec1);return _0x15a27a['set']('Content-Range',_0x37af9a+'-'+_0x451cf1+'/'+_0x1a574d)[_0x8786('0x1f')](_0x19f675);}return null;};}function patchUpdates(_0x45842a){return function(_0x43ae2c){try{jsonpatch[_0x8786('0x23')](_0x43ae2c,_0x45842a,!![]);}catch(_0x324d5e){return BPromise['reject'](_0x324d5e);}return _0x43ae2c[_0x8786('0x24')]();};}function saveUpdates(_0x251929,_0x5afce5){return function(_0x27309d){if(_0x27309d){return _0x27309d[_0x8786('0x25')](_0x251929)[_0x8786('0x26')](function(_0x1a992f){return _0x1a992f;});}return null;};}function removeEntity(_0x4bceda,_0x42a71b){return function(_0x239a2e){if(_0x239a2e){return _0x239a2e[_0x8786('0x27')]()[_0x8786('0x26')](function(){_0x4bceda[_0x8786('0x1e')](0xcc)[_0x8786('0x1d')]();});}};}function handleEntityNotFound(_0x48b27f,_0x2340f9){return function(_0x4d2e22){if(!_0x4d2e22){_0x48b27f[_0x8786('0x1c')](0x194);}return _0x4d2e22;};}function handleError(_0x1a44db,_0x15b204){_0x15b204=_0x15b204||0x1f4;return function(_0x520308){logger[_0x8786('0x28')](_0x520308[_0x8786('0x29')]);if(_0x520308['name']){delete _0x520308[_0x8786('0x2a')];}_0x1a44db['status'](_0x15b204)[_0x8786('0x2b')](_0x520308);};}exports['index']=function(_0x210f29,_0x196af0){var _0xc0659a={},_0x30ae33={},_0x3581a0={'count':0x0,'rows':[]};var _0x403a9c=_[_0x8786('0x2c')](db[_0x8786('0x2d')][_0x8786('0x2e')],function(_0x4b9c58){return{'name':_0x4b9c58[_0x8786('0x2f')],'type':_0x4b9c58['type'][_0x8786('0x30')]};});_0x30ae33[_0x8786('0x31')]=_['map'](_0x403a9c,'name');_0x30ae33[_0x8786('0x32')]=_[_0x8786('0x33')](_0x210f29[_0x8786('0x32')]);_0x30ae33[_0x8786('0x34')]=_[_0x8786('0x35')](_0x30ae33['model'],_0x30ae33[_0x8786('0x32')]);_0xc0659a[_0x8786('0x36')]=_[_0x8786('0x35')](_0x30ae33[_0x8786('0x31')],qs[_0x8786('0x37')](_0x210f29[_0x8786('0x32')][_0x8786('0x37')]));_0xc0659a[_0x8786('0x36')]=_0xc0659a[_0x8786('0x36')]['length']?_0xc0659a['attributes']:_0x30ae33[_0x8786('0x31')];if(!_0x210f29['query']['hasOwnProperty'](_0x8786('0x38'))){_0xc0659a['limit']=qs['limit'](_0x210f29[_0x8786('0x32')][_0x8786('0x21')]);_0xc0659a[_0x8786('0x20')]=qs[_0x8786('0x20')](_0x210f29[_0x8786('0x32')][_0x8786('0x20')]);}_0xc0659a[_0x8786('0x39')]=qs[_0x8786('0x3a')](_0x210f29[_0x8786('0x32')]['sort']);_0xc0659a[_0x8786('0x3b')]=qs['filters'](_[_0x8786('0x3c')](_0x210f29[_0x8786('0x32')],_0x30ae33[_0x8786('0x34')]),_0x403a9c);if(_0x210f29[_0x8786('0x32')][_0x8786('0x3d')]){_0xc0659a[_0x8786('0x3b')]=_['merge'](_0xc0659a[_0x8786('0x3b')],{'$or':_[_0x8786('0x2c')](_0x403a9c,function(_0x275261){if(_0x275261[_0x8786('0x3e')]!=='VIRTUAL'){var _0x20648b={};_0x20648b[_0x275261['name']]={'$like':'%'+_0x210f29[_0x8786('0x32')][_0x8786('0x3d')]+'%'};return _0x20648b;}})});}_0xc0659a=_[_0x8786('0x3f')]({},_0xc0659a,_0x210f29[_0x8786('0x40')]);var _0x26722e={'where':_0xc0659a[_0x8786('0x3b')]};return db[_0x8786('0x2d')][_0x8786('0x22')](_0x26722e)[_0x8786('0x26')](function(_0x564927){_0x3581a0[_0x8786('0x22')]=_0x564927;if(_0x210f29[_0x8786('0x32')]['includeAll']){_0xc0659a[_0x8786('0x41')]=[{'all':!![]}];}return db['ServicenowConfiguration'][_0x8786('0x42')](_0xc0659a);})['then'](function(_0x1bebcc){_0x3581a0[_0x8786('0x43')]=_0x1bebcc;return _0x3581a0;})[_0x8786('0x26')](respondWithFilteredResult(_0x196af0,_0xc0659a))['catch'](handleError(_0x196af0,null));};exports[_0x8786('0x44')]=function(_0x14db96,_0x4e653a){var _0x4130f1={'raw':![],'where':{'id':_0x14db96[_0x8786('0x45')]['id']}},_0x366c27={};_0x366c27['model']=_['keys'](db[_0x8786('0x2d')]['rawAttributes']);_0x366c27[_0x8786('0x32')]=_['keys'](_0x14db96[_0x8786('0x32')]);_0x366c27['filters']=_['intersection'](_0x366c27[_0x8786('0x31')],_0x366c27['query']);_0x4130f1[_0x8786('0x36')]=_['intersection'](_0x366c27[_0x8786('0x31')],qs[_0x8786('0x37')](_0x14db96[_0x8786('0x32')][_0x8786('0x37')]));_0x4130f1['attributes']=_0x4130f1[_0x8786('0x36')]['length']?_0x4130f1[_0x8786('0x36')]:_0x366c27[_0x8786('0x31')];if(_0x14db96[_0x8786('0x32')][_0x8786('0x46')]){_0x4130f1[_0x8786('0x41')]=[{'all':!![]}];}_0x4130f1=_[_0x8786('0x3f')]({},_0x4130f1,_0x14db96[_0x8786('0x40')]);return db[_0x8786('0x2d')][_0x8786('0x47')](_0x4130f1)[_0x8786('0x26')](handleEntityNotFound(_0x4e653a,null))['then'](respondWithResult(_0x4e653a,null))[_0x8786('0x48')](handleError(_0x4e653a,null));};exports[_0x8786('0x49')]=function(_0x35f886,_0x31d67f){return db[_0x8786('0x2d')]['create'](_0x35f886[_0x8786('0x4a')],{})['then'](respondWithResult(_0x31d67f,0xc9))['catch'](handleError(_0x31d67f,null));};exports['update']=function(_0x380299,_0x3bcb47){if(_0x380299['body']['id']){delete _0x380299[_0x8786('0x4a')]['id'];}return db[_0x8786('0x2d')][_0x8786('0x47')]({'where':{'id':_0x380299['params']['id']}})['then'](handleEntityNotFound(_0x3bcb47,null))[_0x8786('0x26')](saveUpdates(_0x380299[_0x8786('0x4a')],null))[_0x8786('0x26')](respondWithResult(_0x3bcb47,null))['catch'](handleError(_0x3bcb47,null));};exports[_0x8786('0x27')]=function(_0x43d476,_0x3bc2d5){return db['ServicenowConfiguration'][_0x8786('0x47')]({'where':{'id':_0x43d476[_0x8786('0x45')]['id']}})[_0x8786('0x26')](handleEntityNotFound(_0x3bc2d5,null))[_0x8786('0x26')](removeEntity(_0x3bc2d5,null))[_0x8786('0x48')](handleError(_0x3bc2d5,null));};exports[_0x8786('0x4b')]=function(_0xa04c14,_0xcf0921,_0x5a104c){var _0x561843={};var _0x2afb7d={};var _0x2c5c70;var _0x40d793;return db[_0x8786('0x2d')][_0x8786('0x4c')]({'where':{'id':_0xa04c14[_0x8786('0x45')]['id']}})[_0x8786('0x26')](handleEntityNotFound(_0xcf0921,null))[_0x8786('0x26')](function(_0x56b8cc){if(_0x56b8cc){_0x2c5c70=_0x56b8cc;_0x2afb7d[_0x8786('0x31')]=_[_0x8786('0x33')](db[_0x8786('0x4d')]['rawAttributes']);_0x2afb7d['query']=_[_0x8786('0x33')](_0xa04c14['query']);_0x2afb7d[_0x8786('0x34')]=_[_0x8786('0x35')](_0x2afb7d[_0x8786('0x31')],_0x2afb7d[_0x8786('0x32')]);_0x561843[_0x8786('0x36')]=_[_0x8786('0x35')](_0x2afb7d['model'],qs[_0x8786('0x37')](_0xa04c14[_0x8786('0x32')][_0x8786('0x37')]));_0x561843[_0x8786('0x36')]=_0x561843[_0x8786('0x36')]['length']?_0x561843[_0x8786('0x36')]:_0x2afb7d['model'];_0x561843[_0x8786('0x39')]=qs[_0x8786('0x3a')](_0xa04c14[_0x8786('0x32')]['sort']);_0x561843[_0x8786('0x3b')]=qs[_0x8786('0x34')](_[_0x8786('0x3c')](_0xa04c14[_0x8786('0x32')],_0x2afb7d[_0x8786('0x34')]));if(_0xa04c14[_0x8786('0x32')][_0x8786('0x3d')]){_0x561843[_0x8786('0x3b')]=_[_0x8786('0x3f')](_0x561843['where'],{'$or':_['map'](_0x561843[_0x8786('0x36')],function(_0x17cb62){var _0x1195b2={};_0x1195b2[_0x17cb62]={'$like':'%'+_0xa04c14[_0x8786('0x32')]['filter']+'%'};return _0x1195b2;})});}_0x561843=_[_0x8786('0x3f')]({},_0x561843,_0xa04c14[_0x8786('0x40')]);return _0x2c5c70[_0x8786('0x4b')](_0x561843);}})[_0x8786('0x26')](function(_0x1cae3e){if(_0x1cae3e){_0x40d793=_0x1cae3e[_0x8786('0x4e')];if(!_0xa04c14[_0x8786('0x32')][_0x8786('0x4f')](_0x8786('0x38'))){_0x561843[_0x8786('0x21')]=qs[_0x8786('0x21')](_0xa04c14[_0x8786('0x32')][_0x8786('0x21')]);_0x561843['offset']=qs[_0x8786('0x20')](_0xa04c14['query'][_0x8786('0x20')]);}return _0x2c5c70['getFields'](_0x561843);}})['then'](function(_0x483284){if(_0x483284){return _0x483284?{'count':_0x40d793,'rows':_0x483284}:null;}})[_0x8786('0x26')](respondWithResult(_0xcf0921,null))['catch'](handleError(_0xcf0921,null));};exports['getSubjects']=function(_0x692f33,_0x2a2291,_0x59aa3d){var _0x4c1839={};var _0x53d4c9={};var _0x3565f9;var _0x292c87;return db['ServicenowConfiguration'][_0x8786('0x4c')]({'where':{'id':_0x692f33[_0x8786('0x45')]['id']}})[_0x8786('0x26')](handleEntityNotFound(_0x2a2291,null))[_0x8786('0x26')](function(_0x4dbca5){if(_0x4dbca5){_0x3565f9=_0x4dbca5;_0x53d4c9[_0x8786('0x31')]=_[_0x8786('0x33')](db['ServicenowField'][_0x8786('0x2e')]);_0x53d4c9['query']=_['keys'](_0x692f33[_0x8786('0x32')]);_0x53d4c9[_0x8786('0x34')]=_[_0x8786('0x35')](_0x53d4c9[_0x8786('0x31')],_0x53d4c9[_0x8786('0x32')]);_0x4c1839[_0x8786('0x36')]=_[_0x8786('0x35')](_0x53d4c9[_0x8786('0x31')],qs[_0x8786('0x37')](_0x692f33['query'][_0x8786('0x37')]));_0x4c1839[_0x8786('0x36')]=_0x4c1839[_0x8786('0x36')]['length']?_0x4c1839['attributes']:_0x53d4c9[_0x8786('0x31')];_0x4c1839['order']=qs[_0x8786('0x3a')](_0x692f33[_0x8786('0x32')][_0x8786('0x3a')]);_0x4c1839[_0x8786('0x3b')]=qs[_0x8786('0x34')](_[_0x8786('0x3c')](_0x692f33['query'],_0x53d4c9[_0x8786('0x34')]));if(_0x692f33[_0x8786('0x32')]['filter']){_0x4c1839['where']=_[_0x8786('0x3f')](_0x4c1839['where'],{'$or':_['map'](_0x4c1839['attributes'],function(_0x3c9c67){var _0x195925={};_0x195925[_0x3c9c67]={'$like':'%'+_0x692f33[_0x8786('0x32')]['filter']+'%'};return _0x195925;})});}_0x4c1839=_[_0x8786('0x3f')]({},_0x4c1839,_0x692f33[_0x8786('0x40')]);return _0x3565f9[_0x8786('0x50')](_0x4c1839);}})[_0x8786('0x26')](function(_0x4c6904){if(_0x4c6904){_0x292c87=_0x4c6904[_0x8786('0x4e')];if(!_0x692f33[_0x8786('0x32')][_0x8786('0x4f')](_0x8786('0x38'))){_0x4c1839['limit']=qs[_0x8786('0x21')](_0x692f33[_0x8786('0x32')][_0x8786('0x21')]);_0x4c1839[_0x8786('0x20')]=qs[_0x8786('0x20')](_0x692f33['query'][_0x8786('0x20')]);}return _0x3565f9[_0x8786('0x50')](_0x4c1839);}})[_0x8786('0x26')](function(_0x3cd406){if(_0x3cd406){return _0x3cd406?{'count':_0x292c87,'rows':_0x3cd406}:null;}})[_0x8786('0x26')](respondWithResult(_0x2a2291,null))[_0x8786('0x48')](handleError(_0x2a2291,null));};exports[_0x8786('0x51')]=function(_0x559c9f,_0xca507b,_0x9c2868){var _0x549f61={};var _0x3f2e4c={};var _0x19305b;var _0x8b622;return db['ServicenowConfiguration'][_0x8786('0x4c')]({'where':{'id':_0x559c9f['params']['id']}})[_0x8786('0x26')](handleEntityNotFound(_0xca507b,null))[_0x8786('0x26')](function(_0x32b3e0){if(_0x32b3e0){_0x19305b=_0x32b3e0;_0x3f2e4c[_0x8786('0x31')]=_['keys'](db[_0x8786('0x4d')][_0x8786('0x2e')]);_0x3f2e4c['query']=_[_0x8786('0x33')](_0x559c9f['query']);_0x3f2e4c[_0x8786('0x34')]=_[_0x8786('0x35')](_0x3f2e4c[_0x8786('0x31')],_0x3f2e4c[_0x8786('0x32')]);_0x549f61['attributes']=_[_0x8786('0x35')](_0x3f2e4c[_0x8786('0x31')],qs[_0x8786('0x37')](_0x559c9f[_0x8786('0x32')][_0x8786('0x37')]));_0x549f61[_0x8786('0x36')]=_0x549f61[_0x8786('0x36')][_0x8786('0x4e')]?_0x549f61[_0x8786('0x36')]:_0x3f2e4c[_0x8786('0x31')];_0x549f61[_0x8786('0x39')]=qs[_0x8786('0x3a')](_0x559c9f['query']['sort']);_0x549f61[_0x8786('0x3b')]=qs[_0x8786('0x34')](_[_0x8786('0x3c')](_0x559c9f[_0x8786('0x32')],_0x3f2e4c['filters']));if(_0x559c9f[_0x8786('0x32')][_0x8786('0x3d')]){_0x549f61[_0x8786('0x3b')]=_['merge'](_0x549f61['where'],{'$or':_[_0x8786('0x2c')](_0x549f61[_0x8786('0x36')],function(_0x40dae5){var _0x55463e={};_0x55463e[_0x40dae5]={'$like':'%'+_0x559c9f['query']['filter']+'%'};return _0x55463e;})});}_0x549f61=_[_0x8786('0x3f')]({},_0x549f61,_0x559c9f[_0x8786('0x40')]);return _0x19305b[_0x8786('0x51')](_0x549f61);}})[_0x8786('0x26')](function(_0x11ef5b){if(_0x11ef5b){_0x8b622=_0x11ef5b[_0x8786('0x4e')];if(!_0x559c9f[_0x8786('0x32')][_0x8786('0x4f')](_0x8786('0x38'))){_0x549f61[_0x8786('0x21')]=qs['limit'](_0x559c9f[_0x8786('0x32')][_0x8786('0x21')]);_0x549f61[_0x8786('0x20')]=qs[_0x8786('0x20')](_0x559c9f['query'][_0x8786('0x20')]);}return _0x19305b[_0x8786('0x51')](_0x549f61);}})[_0x8786('0x26')](function(_0x1e5a41){if(_0x1e5a41){return _0x1e5a41?{'count':_0x8b622,'rows':_0x1e5a41}:null;}})[_0x8786('0x26')](respondWithResult(_0xca507b,null))[_0x8786('0x48')](handleError(_0xca507b,null));}; \ No newline at end of file +var _0x2cdf=['then','destroy','stack','name','send','map','ServicenowConfiguration','rawAttributes','fieldName','type','key','model','query','keys','filters','intersection','attributes','fields','length','hasOwnProperty','nolimit','order','sort','where','pick','filter','merge','VIRTUAL','options','includeAll','findAll','rows','params','find','catch','body','getFields','findOne','ServicenowField','getSubjects','getDescriptions','eml-format','rimraf','fast-json-patch','request-promise','moment','bluebird','mustache','util','path','sox','to-csv','ejs','fs-extra','lodash','squel','crypto','jsforce','desk.js','querystring','papaparse','ioredis','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/environment','status','end','json','offset','undefined','limit','count','Content-Range','save','update'];(function(_0x4dfc2c,_0x14aee4){var _0x463fdb=function(_0x9d87ef){while(--_0x9d87ef){_0x4dfc2c['push'](_0x4dfc2c['shift']());}};_0x463fdb(++_0x14aee4);}(_0x2cdf,0x1b4));var _0xf2cd=function(_0x1f9f37,_0x18776e){_0x1f9f37=_0x1f9f37-0x0;var _0x21c080=_0x2cdf[_0x1f9f37];return _0x21c080;};'use strict';var emlformat=require(_0xf2cd('0x0'));var rimraf=require(_0xf2cd('0x1'));var zipdir=require('zip-dir');var jsonpatch=require(_0xf2cd('0x2'));var rp=require(_0xf2cd('0x3'));var moment=require(_0xf2cd('0x4'));var BPromise=require(_0xf2cd('0x5'));var Mustache=require(_0xf2cd('0x6'));var util=require(_0xf2cd('0x7'));var path=require(_0xf2cd('0x8'));var sox=require(_0xf2cd('0x9'));var csv=require(_0xf2cd('0xa'));var ejs=require(_0xf2cd('0xb'));var fs=require('fs');var fs_extra=require(_0xf2cd('0xc'));var _=require(_0xf2cd('0xd'));var squel=require(_0xf2cd('0xe'));var crypto=require(_0xf2cd('0xf'));var jsforce=require(_0xf2cd('0x10'));var deskjs=require(_0xf2cd('0x11'));var toCsv=require(_0xf2cd('0xa'));var querystring=require(_0xf2cd('0x12'));var Papa=require(_0xf2cd('0x13'));var Redis=require(_0xf2cd('0x14'));var authService=require('../../components/auth/service');var qs=require(_0xf2cd('0x15'));var as=require(_0xf2cd('0x16'));var hardwareService=require(_0xf2cd('0x17'));var logger=require(_0xf2cd('0x18'))(_0xf2cd('0x19'));var utils=require(_0xf2cd('0x1a'));var config=require(_0xf2cd('0x1b'));var licenseUtil=require('../../config/license/util');var db=require('../../mysqldb')['db'];function respondWithStatusCode(_0x20bffb,_0x3cedb2){_0x3cedb2=_0x3cedb2||0xcc;return function(_0x3f0cc6){if(_0x3f0cc6){return _0x20bffb['sendStatus'](_0x3cedb2);}return _0x20bffb[_0xf2cd('0x1c')](_0x3cedb2)[_0xf2cd('0x1d')]();};}function respondWithResult(_0x101517,_0x4d04d8){_0x4d04d8=_0x4d04d8||0xc8;return function(_0x1d359b){if(_0x1d359b){return _0x101517[_0xf2cd('0x1c')](_0x4d04d8)[_0xf2cd('0x1e')](_0x1d359b);}};}function respondWithFilteredResult(_0x5e534d,_0x116934){return function(_0x1b2fb5){if(_0x1b2fb5){var _0x48ebf6=typeof _0x116934[_0xf2cd('0x1f')]===_0xf2cd('0x20')&&typeof _0x116934[_0xf2cd('0x21')]===_0xf2cd('0x20');var _0xed3555=_0x1b2fb5[_0xf2cd('0x22')];var _0x38712b=_0x48ebf6?0x0:_0x116934[_0xf2cd('0x1f')];var _0x14342b=_0x48ebf6?_0x1b2fb5['count']:_0x116934[_0xf2cd('0x1f')]+_0x116934[_0xf2cd('0x21')];var _0x5b35af;if(_0x14342b>=_0xed3555){_0x14342b=_0xed3555;_0x5b35af=0xc8;}else{_0x5b35af=0xce;}_0x5e534d[_0xf2cd('0x1c')](_0x5b35af);return _0x5e534d['set'](_0xf2cd('0x23'),_0x38712b+'-'+_0x14342b+'/'+_0xed3555)[_0xf2cd('0x1e')](_0x1b2fb5);}return null;};}function patchUpdates(_0x22623e){return function(_0x3b9da5){try{jsonpatch['apply'](_0x3b9da5,_0x22623e,!![]);}catch(_0x3605ac){return BPromise['reject'](_0x3605ac);}return _0x3b9da5[_0xf2cd('0x24')]();};}function saveUpdates(_0x5916a0,_0x3a807c){return function(_0x17d405){if(_0x17d405){return _0x17d405[_0xf2cd('0x25')](_0x5916a0)[_0xf2cd('0x26')](function(_0x43d267){return _0x43d267;});}return null;};}function removeEntity(_0x160dec,_0x4f688c){return function(_0x108820){if(_0x108820){return _0x108820[_0xf2cd('0x27')]()[_0xf2cd('0x26')](function(){_0x160dec[_0xf2cd('0x1c')](0xcc)['end']();});}};}function handleEntityNotFound(_0x2b4b32,_0x37104b){return function(_0x3193fb){if(!_0x3193fb){_0x2b4b32['sendStatus'](0x194);}return _0x3193fb;};}function handleError(_0x17333f,_0x5af3fa){_0x5af3fa=_0x5af3fa||0x1f4;return function(_0x332de0){logger['error'](_0x332de0[_0xf2cd('0x28')]);if(_0x332de0[_0xf2cd('0x29')]){delete _0x332de0[_0xf2cd('0x29')];}_0x17333f['status'](_0x5af3fa)[_0xf2cd('0x2a')](_0x332de0);};}exports['index']=function(_0x1c05fc,_0x1d9216){var _0x193b61={},_0x153734={},_0x5bcc1e={'count':0x0,'rows':[]};var _0x158c24=_[_0xf2cd('0x2b')](db[_0xf2cd('0x2c')][_0xf2cd('0x2d')],function(_0x15b115){return{'name':_0x15b115[_0xf2cd('0x2e')],'type':_0x15b115[_0xf2cd('0x2f')][_0xf2cd('0x30')]};});_0x153734[_0xf2cd('0x31')]=_[_0xf2cd('0x2b')](_0x158c24,'name');_0x153734[_0xf2cd('0x32')]=_[_0xf2cd('0x33')](_0x1c05fc[_0xf2cd('0x32')]);_0x153734[_0xf2cd('0x34')]=_[_0xf2cd('0x35')](_0x153734['model'],_0x153734[_0xf2cd('0x32')]);_0x193b61[_0xf2cd('0x36')]=_[_0xf2cd('0x35')](_0x153734[_0xf2cd('0x31')],qs[_0xf2cd('0x37')](_0x1c05fc[_0xf2cd('0x32')]['fields']));_0x193b61['attributes']=_0x193b61[_0xf2cd('0x36')][_0xf2cd('0x38')]?_0x193b61[_0xf2cd('0x36')]:_0x153734[_0xf2cd('0x31')];if(!_0x1c05fc[_0xf2cd('0x32')][_0xf2cd('0x39')](_0xf2cd('0x3a'))){_0x193b61[_0xf2cd('0x21')]=qs[_0xf2cd('0x21')](_0x1c05fc[_0xf2cd('0x32')][_0xf2cd('0x21')]);_0x193b61[_0xf2cd('0x1f')]=qs[_0xf2cd('0x1f')](_0x1c05fc[_0xf2cd('0x32')][_0xf2cd('0x1f')]);}_0x193b61[_0xf2cd('0x3b')]=qs[_0xf2cd('0x3c')](_0x1c05fc[_0xf2cd('0x32')][_0xf2cd('0x3c')]);_0x193b61[_0xf2cd('0x3d')]=qs[_0xf2cd('0x34')](_[_0xf2cd('0x3e')](_0x1c05fc[_0xf2cd('0x32')],_0x153734[_0xf2cd('0x34')]),_0x158c24);if(_0x1c05fc[_0xf2cd('0x32')][_0xf2cd('0x3f')]){_0x193b61['where']=_[_0xf2cd('0x40')](_0x193b61[_0xf2cd('0x3d')],{'$or':_[_0xf2cd('0x2b')](_0x158c24,function(_0x6825de){if(_0x6825de[_0xf2cd('0x2f')]!==_0xf2cd('0x41')){var _0x375622={};_0x375622[_0x6825de[_0xf2cd('0x29')]]={'$like':'%'+_0x1c05fc[_0xf2cd('0x32')]['filter']+'%'};return _0x375622;}})});}_0x193b61=_[_0xf2cd('0x40')]({},_0x193b61,_0x1c05fc[_0xf2cd('0x42')]);var _0x278b82={'where':_0x193b61[_0xf2cd('0x3d')]};return db[_0xf2cd('0x2c')][_0xf2cd('0x22')](_0x278b82)[_0xf2cd('0x26')](function(_0x4ddc24){_0x5bcc1e['count']=_0x4ddc24;if(_0x1c05fc['query'][_0xf2cd('0x43')]){_0x193b61['include']=[{'all':!![]}];}return db[_0xf2cd('0x2c')][_0xf2cd('0x44')](_0x193b61);})[_0xf2cd('0x26')](function(_0x34cc7b){_0x5bcc1e[_0xf2cd('0x45')]=_0x34cc7b;return _0x5bcc1e;})[_0xf2cd('0x26')](respondWithFilteredResult(_0x1d9216,_0x193b61))['catch'](handleError(_0x1d9216,null));};exports['show']=function(_0x8d08da,_0xb27a8e){var _0x197f6e={'raw':![],'where':{'id':_0x8d08da[_0xf2cd('0x46')]['id']}},_0x2ebc76={};_0x2ebc76[_0xf2cd('0x31')]=_[_0xf2cd('0x33')](db[_0xf2cd('0x2c')]['rawAttributes']);_0x2ebc76[_0xf2cd('0x32')]=_[_0xf2cd('0x33')](_0x8d08da['query']);_0x2ebc76['filters']=_[_0xf2cd('0x35')](_0x2ebc76[_0xf2cd('0x31')],_0x2ebc76['query']);_0x197f6e[_0xf2cd('0x36')]=_[_0xf2cd('0x35')](_0x2ebc76[_0xf2cd('0x31')],qs['fields'](_0x8d08da[_0xf2cd('0x32')][_0xf2cd('0x37')]));_0x197f6e[_0xf2cd('0x36')]=_0x197f6e[_0xf2cd('0x36')][_0xf2cd('0x38')]?_0x197f6e[_0xf2cd('0x36')]:_0x2ebc76[_0xf2cd('0x31')];if(_0x8d08da[_0xf2cd('0x32')]['includeAll']){_0x197f6e['include']=[{'all':!![]}];}_0x197f6e=_[_0xf2cd('0x40')]({},_0x197f6e,_0x8d08da[_0xf2cd('0x42')]);return db['ServicenowConfiguration'][_0xf2cd('0x47')](_0x197f6e)[_0xf2cd('0x26')](handleEntityNotFound(_0xb27a8e,null))[_0xf2cd('0x26')](respondWithResult(_0xb27a8e,null))[_0xf2cd('0x48')](handleError(_0xb27a8e,null));};exports['create']=function(_0x1e0f29,_0x317923){return db['ServicenowConfiguration']['create'](_0x1e0f29[_0xf2cd('0x49')],{})[_0xf2cd('0x26')](respondWithResult(_0x317923,0xc9))[_0xf2cd('0x48')](handleError(_0x317923,null));};exports[_0xf2cd('0x25')]=function(_0x41bbf1,_0x22f417){if(_0x41bbf1[_0xf2cd('0x49')]['id']){delete _0x41bbf1[_0xf2cd('0x49')]['id'];}return db[_0xf2cd('0x2c')][_0xf2cd('0x47')]({'where':{'id':_0x41bbf1['params']['id']}})[_0xf2cd('0x26')](handleEntityNotFound(_0x22f417,null))[_0xf2cd('0x26')](saveUpdates(_0x41bbf1[_0xf2cd('0x49')],null))[_0xf2cd('0x26')](respondWithResult(_0x22f417,null))[_0xf2cd('0x48')](handleError(_0x22f417,null));};exports['destroy']=function(_0x4a8439,_0x5d97db){return db[_0xf2cd('0x2c')]['find']({'where':{'id':_0x4a8439[_0xf2cd('0x46')]['id']}})[_0xf2cd('0x26')](handleEntityNotFound(_0x5d97db,null))[_0xf2cd('0x26')](removeEntity(_0x5d97db,null))[_0xf2cd('0x48')](handleError(_0x5d97db,null));};exports[_0xf2cd('0x4a')]=function(_0x27f086,_0x4e9805,_0x138909){var _0x5d5b47={};var _0x419ec5={};var _0x17bc2e;var _0x4472fa;return db[_0xf2cd('0x2c')][_0xf2cd('0x4b')]({'where':{'id':_0x27f086[_0xf2cd('0x46')]['id']}})[_0xf2cd('0x26')](handleEntityNotFound(_0x4e9805,null))[_0xf2cd('0x26')](function(_0x41d33e){if(_0x41d33e){_0x17bc2e=_0x41d33e;_0x419ec5['model']=_[_0xf2cd('0x33')](db[_0xf2cd('0x4c')][_0xf2cd('0x2d')]);_0x419ec5[_0xf2cd('0x32')]=_[_0xf2cd('0x33')](_0x27f086[_0xf2cd('0x32')]);_0x419ec5[_0xf2cd('0x34')]=_['intersection'](_0x419ec5['model'],_0x419ec5['query']);_0x5d5b47[_0xf2cd('0x36')]=_['intersection'](_0x419ec5[_0xf2cd('0x31')],qs['fields'](_0x27f086[_0xf2cd('0x32')][_0xf2cd('0x37')]));_0x5d5b47[_0xf2cd('0x36')]=_0x5d5b47[_0xf2cd('0x36')][_0xf2cd('0x38')]?_0x5d5b47[_0xf2cd('0x36')]:_0x419ec5['model'];_0x5d5b47[_0xf2cd('0x3b')]=qs[_0xf2cd('0x3c')](_0x27f086[_0xf2cd('0x32')][_0xf2cd('0x3c')]);_0x5d5b47[_0xf2cd('0x3d')]=qs[_0xf2cd('0x34')](_[_0xf2cd('0x3e')](_0x27f086[_0xf2cd('0x32')],_0x419ec5[_0xf2cd('0x34')]));if(_0x27f086[_0xf2cd('0x32')]['filter']){_0x5d5b47[_0xf2cd('0x3d')]=_[_0xf2cd('0x40')](_0x5d5b47[_0xf2cd('0x3d')],{'$or':_[_0xf2cd('0x2b')](_0x5d5b47[_0xf2cd('0x36')],function(_0x121147){var _0x4a78d4={};_0x4a78d4[_0x121147]={'$like':'%'+_0x27f086[_0xf2cd('0x32')][_0xf2cd('0x3f')]+'%'};return _0x4a78d4;})});}_0x5d5b47=_[_0xf2cd('0x40')]({},_0x5d5b47,_0x27f086[_0xf2cd('0x42')]);return _0x17bc2e[_0xf2cd('0x4a')](_0x5d5b47);}})[_0xf2cd('0x26')](function(_0x30d363){if(_0x30d363){_0x4472fa=_0x30d363[_0xf2cd('0x38')];if(!_0x27f086[_0xf2cd('0x32')][_0xf2cd('0x39')](_0xf2cd('0x3a'))){_0x5d5b47[_0xf2cd('0x21')]=qs['limit'](_0x27f086[_0xf2cd('0x32')][_0xf2cd('0x21')]);_0x5d5b47[_0xf2cd('0x1f')]=qs[_0xf2cd('0x1f')](_0x27f086[_0xf2cd('0x32')]['offset']);}return _0x17bc2e[_0xf2cd('0x4a')](_0x5d5b47);}})[_0xf2cd('0x26')](function(_0x292fc5){if(_0x292fc5){return _0x292fc5?{'count':_0x4472fa,'rows':_0x292fc5}:null;}})[_0xf2cd('0x26')](respondWithResult(_0x4e9805,null))['catch'](handleError(_0x4e9805,null));};exports[_0xf2cd('0x4d')]=function(_0x5e6d2a,_0x3d99f0,_0x248c90){var _0x28639f={};var _0x1054e3={};var _0x3432e0;var _0x3d9837;return db[_0xf2cd('0x2c')]['findOne']({'where':{'id':_0x5e6d2a[_0xf2cd('0x46')]['id']}})[_0xf2cd('0x26')](handleEntityNotFound(_0x3d99f0,null))[_0xf2cd('0x26')](function(_0x326097){if(_0x326097){_0x3432e0=_0x326097;_0x1054e3['model']=_[_0xf2cd('0x33')](db[_0xf2cd('0x4c')][_0xf2cd('0x2d')]);_0x1054e3[_0xf2cd('0x32')]=_['keys'](_0x5e6d2a[_0xf2cd('0x32')]);_0x1054e3[_0xf2cd('0x34')]=_[_0xf2cd('0x35')](_0x1054e3[_0xf2cd('0x31')],_0x1054e3[_0xf2cd('0x32')]);_0x28639f[_0xf2cd('0x36')]=_[_0xf2cd('0x35')](_0x1054e3['model'],qs[_0xf2cd('0x37')](_0x5e6d2a['query']['fields']));_0x28639f[_0xf2cd('0x36')]=_0x28639f[_0xf2cd('0x36')][_0xf2cd('0x38')]?_0x28639f[_0xf2cd('0x36')]:_0x1054e3['model'];_0x28639f[_0xf2cd('0x3b')]=qs[_0xf2cd('0x3c')](_0x5e6d2a[_0xf2cd('0x32')]['sort']);_0x28639f['where']=qs[_0xf2cd('0x34')](_[_0xf2cd('0x3e')](_0x5e6d2a[_0xf2cd('0x32')],_0x1054e3['filters']));if(_0x5e6d2a[_0xf2cd('0x32')][_0xf2cd('0x3f')]){_0x28639f[_0xf2cd('0x3d')]=_[_0xf2cd('0x40')](_0x28639f[_0xf2cd('0x3d')],{'$or':_[_0xf2cd('0x2b')](_0x28639f[_0xf2cd('0x36')],function(_0x20504c){var _0x527091={};_0x527091[_0x20504c]={'$like':'%'+_0x5e6d2a[_0xf2cd('0x32')][_0xf2cd('0x3f')]+'%'};return _0x527091;})});}_0x28639f=_[_0xf2cd('0x40')]({},_0x28639f,_0x5e6d2a[_0xf2cd('0x42')]);return _0x3432e0[_0xf2cd('0x4d')](_0x28639f);}})['then'](function(_0x197860){if(_0x197860){_0x3d9837=_0x197860[_0xf2cd('0x38')];if(!_0x5e6d2a[_0xf2cd('0x32')][_0xf2cd('0x39')](_0xf2cd('0x3a'))){_0x28639f[_0xf2cd('0x21')]=qs[_0xf2cd('0x21')](_0x5e6d2a[_0xf2cd('0x32')][_0xf2cd('0x21')]);_0x28639f['offset']=qs[_0xf2cd('0x1f')](_0x5e6d2a[_0xf2cd('0x32')]['offset']);}return _0x3432e0[_0xf2cd('0x4d')](_0x28639f);}})['then'](function(_0x1fd850){if(_0x1fd850){return _0x1fd850?{'count':_0x3d9837,'rows':_0x1fd850}:null;}})[_0xf2cd('0x26')](respondWithResult(_0x3d99f0,null))[_0xf2cd('0x48')](handleError(_0x3d99f0,null));};exports[_0xf2cd('0x4e')]=function(_0x26bcd2,_0x2fec66,_0x41b5b3){var _0x3ec296={};var _0x126d95={};var _0x3ea7e6;var _0x730c51;return db[_0xf2cd('0x2c')]['findOne']({'where':{'id':_0x26bcd2['params']['id']}})['then'](handleEntityNotFound(_0x2fec66,null))['then'](function(_0x3638cc){if(_0x3638cc){_0x3ea7e6=_0x3638cc;_0x126d95[_0xf2cd('0x31')]=_[_0xf2cd('0x33')](db['ServicenowField'][_0xf2cd('0x2d')]);_0x126d95[_0xf2cd('0x32')]=_[_0xf2cd('0x33')](_0x26bcd2[_0xf2cd('0x32')]);_0x126d95[_0xf2cd('0x34')]=_[_0xf2cd('0x35')](_0x126d95[_0xf2cd('0x31')],_0x126d95[_0xf2cd('0x32')]);_0x3ec296[_0xf2cd('0x36')]=_[_0xf2cd('0x35')](_0x126d95[_0xf2cd('0x31')],qs[_0xf2cd('0x37')](_0x26bcd2['query'][_0xf2cd('0x37')]));_0x3ec296[_0xf2cd('0x36')]=_0x3ec296[_0xf2cd('0x36')][_0xf2cd('0x38')]?_0x3ec296['attributes']:_0x126d95[_0xf2cd('0x31')];_0x3ec296[_0xf2cd('0x3b')]=qs['sort'](_0x26bcd2[_0xf2cd('0x32')]['sort']);_0x3ec296[_0xf2cd('0x3d')]=qs[_0xf2cd('0x34')](_[_0xf2cd('0x3e')](_0x26bcd2['query'],_0x126d95['filters']));if(_0x26bcd2[_0xf2cd('0x32')][_0xf2cd('0x3f')]){_0x3ec296[_0xf2cd('0x3d')]=_[_0xf2cd('0x40')](_0x3ec296[_0xf2cd('0x3d')],{'$or':_['map'](_0x3ec296[_0xf2cd('0x36')],function(_0x1ad17e){var _0x50a024={};_0x50a024[_0x1ad17e]={'$like':'%'+_0x26bcd2[_0xf2cd('0x32')][_0xf2cd('0x3f')]+'%'};return _0x50a024;})});}_0x3ec296=_[_0xf2cd('0x40')]({},_0x3ec296,_0x26bcd2[_0xf2cd('0x42')]);return _0x3ea7e6['getDescriptions'](_0x3ec296);}})['then'](function(_0x594517){if(_0x594517){_0x730c51=_0x594517[_0xf2cd('0x38')];if(!_0x26bcd2[_0xf2cd('0x32')][_0xf2cd('0x39')](_0xf2cd('0x3a'))){_0x3ec296[_0xf2cd('0x21')]=qs[_0xf2cd('0x21')](_0x26bcd2['query']['limit']);_0x3ec296[_0xf2cd('0x1f')]=qs[_0xf2cd('0x1f')](_0x26bcd2[_0xf2cd('0x32')][_0xf2cd('0x1f')]);}return _0x3ea7e6[_0xf2cd('0x4e')](_0x3ec296);}})[_0xf2cd('0x26')](function(_0x40f8f9){if(_0x40f8f9){return _0x40f8f9?{'count':_0x730c51,'rows':_0x40f8f9}:null;}})['then'](respondWithResult(_0x2fec66,null))[_0xf2cd('0x48')](handleError(_0x2fec66,null));}; \ No newline at end of file diff --git a/server/api/intServicenowConfiguration/intServicenowConfiguration.model.js b/server/api/intServicenowConfiguration/intServicenowConfiguration.model.js index e71d7fc..54cb10f 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 _0x24e9=['ServicenowConfiguration','lodash','../../config/logger','api','moment','bluebird','request-promise','path','rimraf','../../config/environment','exports','define'];(function(_0x50a375,_0x12fe21){var _0x5a6c67=function(_0x3d2e1d){while(--_0x3d2e1d){_0x50a375['push'](_0x50a375['shift']());}};_0x5a6c67(++_0x12fe21);}(_0x24e9,0x85));var _0x924e=function(_0x313c96,_0x3cee6e){_0x313c96=_0x313c96-0x0;var _0x522f53=_0x24e9[_0x313c96];return _0x522f53;};'use strict';var _=require(_0x924e('0x0'));var util=require('util');var logger=require(_0x924e('0x1'))(_0x924e('0x2'));var moment=require(_0x924e('0x3'));var BPromise=require(_0x924e('0x4'));var rp=require(_0x924e('0x5'));var fs=require('fs');var path=require(_0x924e('0x6'));var rimraf=require(_0x924e('0x7'));var config=require(_0x924e('0x8'));var attributes=require('./intServicenowConfiguration.attributes');module[_0x924e('0x9')]=function(_0x31f0c3,_0x13accc){return _0x31f0c3[_0x924e('0xa')](_0x924e('0xb'),attributes,{'tableName':'int_servicenow_configurations','paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x9656=['api','bluebird','../../config/environment','exports','ServicenowConfiguration','int_servicenow_configurations','lodash','../../config/logger'];(function(_0x34843e,_0x4c4224){var _0x598f7f=function(_0x12a44c){while(--_0x12a44c){_0x34843e['push'](_0x34843e['shift']());}};_0x598f7f(++_0x4c4224);}(_0x9656,0x15e));var _0x6965=function(_0x659846,_0x5a2df0){_0x659846=_0x659846-0x0;var _0x5357ec=_0x9656[_0x659846];return _0x5357ec;};'use strict';var _=require(_0x6965('0x0'));var util=require('util');var logger=require(_0x6965('0x1'))(_0x6965('0x2'));var moment=require('moment');var BPromise=require(_0x6965('0x3'));var rp=require('request-promise');var fs=require('fs');var path=require('path');var rimraf=require('rimraf');var config=require(_0x6965('0x4'));var attributes=require('./intServicenowConfiguration.attributes');module[_0x6965('0x5')]=function(_0x563cc2,_0xc5e807){return _0x563cc2['define'](_0x6965('0x6'),attributes,{'tableName':_0x6965('0x7'),'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 4839007..56d640e 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 _0x6f54=['lodash','util','moment','bluebird','randomstring','ioredis','../../config/utils','../../config/logger','client','http','request','info','debug','ServicenowConfiguration,\x20%s,\x20%s,\x20%s','request\x20sent','stringify','code','ServicenowConfiguration,\x20%s,\x20%s','error','message','result','catch'];(function(_0x487b0c,_0x14ff74){var _0x1adbdc=function(_0x2e7b9d){while(--_0x2e7b9d){_0x487b0c['push'](_0x487b0c['shift']());}};_0x1adbdc(++_0x14ff74);}(_0x6f54,0xc6));var _0x46f5=function(_0xd7f8e8,_0x4c7628){_0xd7f8e8=_0xd7f8e8-0x0;var _0x5935ef=_0x6f54[_0xd7f8e8];return _0x5935ef;};'use strict';var _=require(_0x46f5('0x0'));var util=require(_0x46f5('0x1'));var moment=require(_0x46f5('0x2'));var BPromise=require(_0x46f5('0x3'));var rs=require(_0x46f5('0x4'));var fs=require('fs');var Redis=require(_0x46f5('0x5'));var db=require('../../mysqldb')['db'];var utils=require(_0x46f5('0x6'));var logger=require(_0x46f5('0x7'))('rpc');var config=require('../../config/environment');var jayson=require('jayson/promise');var client=jayson[_0x46f5('0x8')][_0x46f5('0x9')]({'port':0x232a});function respondWithRpcPromise(_0x5a56c2,_0x32101b,_0x1c810c){return new BPromise(function(_0x2bcb74,_0x3e3fa8){return client[_0x46f5('0xa')](_0x5a56c2,_0x1c810c)['then'](function(_0x1fb42e){logger[_0x46f5('0xb')]('ServicenowConfiguration,\x20%s,\x20%s',_0x32101b,'request\x20sent');logger[_0x46f5('0xc')](_0x46f5('0xd'),_0x32101b,_0x46f5('0xe'),JSON[_0x46f5('0xf')](_0x1fb42e));if(_0x1fb42e['error']){if(_0x1fb42e['error'][_0x46f5('0x10')]===0x1f4){logger['error'](_0x46f5('0x11'),_0x32101b,_0x1fb42e[_0x46f5('0x12')][_0x46f5('0x13')]);return _0x3e3fa8(_0x1fb42e[_0x46f5('0x12')][_0x46f5('0x13')]);}logger[_0x46f5('0x12')](_0x46f5('0x11'),_0x32101b,_0x1fb42e[_0x46f5('0x12')][_0x46f5('0x13')]);return _0x2bcb74(_0x1fb42e[_0x46f5('0x12')][_0x46f5('0x13')]);}else{logger[_0x46f5('0xb')](_0x46f5('0x11'),_0x32101b,_0x46f5('0xe'));_0x2bcb74(_0x1fb42e[_0x46f5('0x14')][_0x46f5('0x13')]);}})[_0x46f5('0x15')](function(_0x1ee391){logger[_0x46f5('0x12')]('ServicenowConfiguration,\x20%s,\x20%s',_0x32101b,_0x1ee391);_0x3e3fa8(_0x1ee391);});});} \ No newline at end of file +var _0x647c=['ServicenowConfiguration,\x20%s,\x20%s,\x20%s','stringify','error','code','message','info','catch','lodash','moment','bluebird','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','jayson/promise','client','http','request','then','ServicenowConfiguration,\x20%s,\x20%s','request\x20sent','debug'];(function(_0x31826c,_0x1995c5){var _0x20bbd7=function(_0x2a98ab){while(--_0x2a98ab){_0x31826c['push'](_0x31826c['shift']());}};_0x20bbd7(++_0x1995c5);}(_0x647c,0x1d3));var _0xc647=function(_0x2f2cb8,_0x417d38){_0x2f2cb8=_0x2f2cb8-0x0;var _0x5a7add=_0x647c[_0x2f2cb8];return _0x5a7add;};'use strict';var _=require(_0xc647('0x0'));var util=require('util');var moment=require(_0xc647('0x1'));var BPromise=require(_0xc647('0x2'));var rs=require('randomstring');var fs=require('fs');var Redis=require(_0xc647('0x3'));var db=require(_0xc647('0x4'))['db'];var utils=require(_0xc647('0x5'));var logger=require(_0xc647('0x6'))(_0xc647('0x7'));var config=require('../../config/environment');var jayson=require(_0xc647('0x8'));var client=jayson[_0xc647('0x9')][_0xc647('0xa')]({'port':0x232a});function respondWithRpcPromise(_0x22bcc1,_0x119c36,_0x2d63e8){return new BPromise(function(_0x59158c,_0x5b91af){return client[_0xc647('0xb')](_0x22bcc1,_0x2d63e8)[_0xc647('0xc')](function(_0x4494d1){logger['info'](_0xc647('0xd'),_0x119c36,_0xc647('0xe'));logger[_0xc647('0xf')](_0xc647('0x10'),_0x119c36,_0xc647('0xe'),JSON[_0xc647('0x11')](_0x4494d1));if(_0x4494d1[_0xc647('0x12')]){if(_0x4494d1['error'][_0xc647('0x13')]===0x1f4){logger[_0xc647('0x12')](_0xc647('0xd'),_0x119c36,_0x4494d1[_0xc647('0x12')][_0xc647('0x14')]);return _0x5b91af(_0x4494d1[_0xc647('0x12')][_0xc647('0x14')]);}logger['error']('ServicenowConfiguration,\x20%s,\x20%s',_0x119c36,_0x4494d1[_0xc647('0x12')]['message']);return _0x59158c(_0x4494d1[_0xc647('0x12')]['message']);}else{logger[_0xc647('0x15')](_0xc647('0xd'),_0x119c36,_0xc647('0xe'));_0x59158c(_0x4494d1['result'][_0xc647('0x14')]);}})[_0xc647('0x16')](function(_0x564f2b){logger[_0xc647('0x12')](_0xc647('0xd'),_0x119c36,_0x564f2b);_0x5b91af(_0x564f2b);});});} \ No newline at end of file diff --git a/server/api/intServicenowField/index.js b/server/api/intServicenowField/index.js index 05930bb..68a2852 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 _0x338b=['../../components/interaction/service','../../config/environment','get','isAuthenticated','index','post','create','put','/:id','update','delete','destroy','exports','multer','util','path','fs-extra','../../components/auth/service'];(function(_0x1795df,_0xcb261e){var _0x3f13c0=function(_0x52c5cf){while(--_0x52c5cf){_0x1795df['push'](_0x1795df['shift']());}};_0x3f13c0(++_0xcb261e);}(_0x338b,0x13f));var _0xb338=function(_0x49879b,_0x24ce62){_0x49879b=_0x49879b-0x0;var _0x287b1e=_0x338b[_0x49879b];return _0x287b1e;};'use strict';var multer=require(_0xb338('0x0'));var util=require(_0xb338('0x1'));var path=require(_0xb338('0x2'));var timeout=require('connect-timeout');var express=require('express');var router=express['Router']();var fs_extra=require(_0xb338('0x3'));var auth=require(_0xb338('0x4'));var interaction=require(_0xb338('0x5'));var config=require(_0xb338('0x6'));var controller=require('./intServicenowField.controller');router[_0xb338('0x7')]('/',auth[_0xb338('0x8')](),controller[_0xb338('0x9')]);router[_0xb338('0x7')]('/:id',auth[_0xb338('0x8')](),controller['show']);router[_0xb338('0xa')]('/',auth[_0xb338('0x8')](),controller[_0xb338('0xb')]);router[_0xb338('0xc')](_0xb338('0xd'),auth[_0xb338('0x8')](),controller[_0xb338('0xe')]);router[_0xb338('0xf')]('/:id',auth[_0xb338('0x8')](),controller[_0xb338('0x10')]);module[_0xb338('0x11')]=router; \ No newline at end of file +var _0xa5fe=['Router','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','isAuthenticated','index','get','/:id','show','create','update','delete','exports','multer','util','path','connect-timeout','express'];(function(_0x396611,_0x4664f3){var _0x4d71fc=function(_0x2ee027){while(--_0x2ee027){_0x396611['push'](_0x396611['shift']());}};_0x4d71fc(++_0x4664f3);}(_0xa5fe,0x1d6));var _0xea5f=function(_0x16bb4b,_0x5fe431){_0x16bb4b=_0x16bb4b-0x0;var _0x8aeb84=_0xa5fe[_0x16bb4b];return _0x8aeb84;};'use strict';var multer=require(_0xea5f('0x0'));var util=require(_0xea5f('0x1'));var path=require(_0xea5f('0x2'));var timeout=require(_0xea5f('0x3'));var express=require(_0xea5f('0x4'));var router=express[_0xea5f('0x5')]();var fs_extra=require(_0xea5f('0x6'));var auth=require(_0xea5f('0x7'));var interaction=require(_0xea5f('0x8'));var config=require(_0xea5f('0x9'));var controller=require('./intServicenowField.controller');router['get']('/',auth[_0xea5f('0xa')](),controller[_0xea5f('0xb')]);router[_0xea5f('0xc')](_0xea5f('0xd'),auth[_0xea5f('0xa')](),controller[_0xea5f('0xe')]);router['post']('/',auth[_0xea5f('0xa')](),controller[_0xea5f('0xf')]);router['put'](_0xea5f('0xd'),auth[_0xea5f('0xa')](),controller[_0xea5f('0x10')]);router[_0xea5f('0x11')]('/:id',auth[_0xea5f('0xa')](),controller['destroy']);module[_0xea5f('0x12')]=router; \ No newline at end of file diff --git a/server/api/intServicenowField/intServicenowField.attributes.js b/server/api/intServicenowField/intServicenowField.attributes.js index 37c2915..376eb37 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 _0x35ff=['customVariable','BOOLEAN','exports','ENUM','variable','picklist','string','STRING'];(function(_0x3dd15e,_0x1f0015){var _0x231fd0=function(_0x4f680a){while(--_0x4f680a){_0x3dd15e['push'](_0x3dd15e['shift']());}};_0x231fd0(++_0x1f0015);}(_0x35ff,0x92));var _0xf35f=function(_0x1b2d7b,_0x491ae2){_0x1b2d7b=_0x1b2d7b-0x0;var _0x27a181=_0x35ff[_0x1b2d7b];return _0x27a181;};'use strict';var Sequelize=require('sequelize');module[_0xf35f('0x0')]={'type':{'type':Sequelize[_0xf35f('0x1')]('string',_0xf35f('0x2'),'customVariable','keyValue',_0xf35f('0x3')),'defaultValue':_0xf35f('0x4')},'content':{'type':Sequelize[_0xf35f('0x5')]},'key':{'type':Sequelize[_0xf35f('0x5')]},'keyType':{'type':Sequelize[_0xf35f('0x1')](_0xf35f('0x4'),'variable',_0xf35f('0x6'))},'keyContent':{'type':Sequelize[_0xf35f('0x5')]},'idField':{'type':Sequelize[_0xf35f('0x5')]},'nameField':{'type':Sequelize[_0xf35f('0x5')]},'customField':{'type':Sequelize[_0xf35f('0x7')],'defaultValue':!![]},'variableName':{'type':Sequelize['STRING']}}; \ No newline at end of file +var _0xd039=['string','customVariable','keyValue','picklist','STRING','sequelize','exports','ENUM'];(function(_0x9eacff,_0x494a23){var _0x14d87c=function(_0x6a02cc){while(--_0x6a02cc){_0x9eacff['push'](_0x9eacff['shift']());}};_0x14d87c(++_0x494a23);}(_0xd039,0x175));var _0x9d03=function(_0x3cb545,_0x4e249b){_0x3cb545=_0x3cb545-0x0;var _0x2f98e9=_0xd039[_0x3cb545];return _0x2f98e9;};'use strict';var Sequelize=require(_0x9d03('0x0'));module[_0x9d03('0x1')]={'type':{'type':Sequelize[_0x9d03('0x2')](_0x9d03('0x3'),'variable',_0x9d03('0x4'),_0x9d03('0x5'),_0x9d03('0x6')),'defaultValue':'string'},'content':{'type':Sequelize[_0x9d03('0x7')]},'key':{'type':Sequelize[_0x9d03('0x7')]},'keyType':{'type':Sequelize[_0x9d03('0x2')](_0x9d03('0x3'),'variable',_0x9d03('0x4'))},'keyContent':{'type':Sequelize['STRING']},'idField':{'type':Sequelize[_0x9d03('0x7')]},'nameField':{'type':Sequelize['STRING']},'customField':{'type':Sequelize['BOOLEAN'],'defaultValue':!![]},'variableName':{'type':Sequelize[_0x9d03('0x7')]}}; \ No newline at end of file diff --git a/server/api/intServicenowField/intServicenowField.controller.js b/server/api/intServicenowField/intServicenowField.controller.js index 19db125..7d0cd5c 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 _0xe259=['sendStatus','status','end','offset','limit','undefined','count','Content-Range','json','reject','save','destroy','error','name','send','index','ServicenowField','rawAttributes','fieldName','type','key','map','keys','query','filters','intersection','attributes','model','fields','length','hasOwnProperty','order','sort','pick','filter','merge','where','VIRTUAL','options','then','includeAll','include','findAll','catch','show','params','find','create','body','update','eml-format','rimraf','fast-json-patch','request-promise','moment','bluebird','util','path','sox','ejs','squel','crypto','jsforce','desk.js','to-csv','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../config/license/hardware','../../config/logger','api','../../config/environment','../../config/license/util','../../mysqldb'];(function(_0x321bb2,_0x202794){var _0x9c12ed=function(_0x263dd3){while(--_0x263dd3){_0x321bb2['push'](_0x321bb2['shift']());}};_0x9c12ed(++_0x202794);}(_0xe259,0x7e));var _0x9e25=function(_0x90c301,_0x4a1fbd){_0x90c301=_0x90c301-0x0;var _0x4ad790=_0xe259[_0x90c301];return _0x4ad790;};'use strict';var emlformat=require(_0x9e25('0x0'));var rimraf=require(_0x9e25('0x1'));var zipdir=require('zip-dir');var jsonpatch=require(_0x9e25('0x2'));var rp=require(_0x9e25('0x3'));var moment=require(_0x9e25('0x4'));var BPromise=require(_0x9e25('0x5'));var Mustache=require('mustache');var util=require(_0x9e25('0x6'));var path=require(_0x9e25('0x7'));var sox=require(_0x9e25('0x8'));var csv=require('to-csv');var ejs=require(_0x9e25('0x9'));var fs=require('fs');var fs_extra=require('fs-extra');var _=require('lodash');var squel=require(_0x9e25('0xa'));var crypto=require(_0x9e25('0xb'));var jsforce=require(_0x9e25('0xc'));var deskjs=require(_0x9e25('0xd'));var toCsv=require(_0x9e25('0xe'));var querystring=require(_0x9e25('0xf'));var Papa=require(_0x9e25('0x10'));var Redis=require(_0x9e25('0x11'));var authService=require(_0x9e25('0x12'));var qs=require(_0x9e25('0x13'));var as=require('../../components/parsers/advancedSearch');var hardwareService=require(_0x9e25('0x14'));var logger=require(_0x9e25('0x15'))(_0x9e25('0x16'));var utils=require('../../config/utils');var config=require(_0x9e25('0x17'));var licenseUtil=require(_0x9e25('0x18'));var db=require(_0x9e25('0x19'))['db'];function respondWithStatusCode(_0x294d41,_0x31bde7){_0x31bde7=_0x31bde7||0xcc;return function(_0x45914b){if(_0x45914b){return _0x294d41[_0x9e25('0x1a')](_0x31bde7);}return _0x294d41[_0x9e25('0x1b')](_0x31bde7)[_0x9e25('0x1c')]();};}function respondWithResult(_0x2868d2,_0x3f3c43){_0x3f3c43=_0x3f3c43||0xc8;return function(_0xd8750e){if(_0xd8750e){return _0x2868d2[_0x9e25('0x1b')](_0x3f3c43)['json'](_0xd8750e);}};}function respondWithFilteredResult(_0xbac1b4,_0x28e10e){return function(_0x110736){if(_0x110736){var _0x42c017=typeof _0x28e10e[_0x9e25('0x1d')]==='undefined'&&typeof _0x28e10e[_0x9e25('0x1e')]===_0x9e25('0x1f');var _0x4c17b2=_0x110736['count'];var _0x46ea60=_0x42c017?0x0:_0x28e10e[_0x9e25('0x1d')];var _0xb875c7=_0x42c017?_0x110736[_0x9e25('0x20')]:_0x28e10e[_0x9e25('0x1d')]+_0x28e10e[_0x9e25('0x1e')];var _0xde15;if(_0xb875c7>=_0x4c17b2){_0xb875c7=_0x4c17b2;_0xde15=0xc8;}else{_0xde15=0xce;}_0xbac1b4['status'](_0xde15);return _0xbac1b4['set'](_0x9e25('0x21'),_0x46ea60+'-'+_0xb875c7+'/'+_0x4c17b2)[_0x9e25('0x22')](_0x110736);}return null;};}function patchUpdates(_0x52c990){return function(_0x32d776){try{jsonpatch['apply'](_0x32d776,_0x52c990,!![]);}catch(_0x2aad1f){return BPromise[_0x9e25('0x23')](_0x2aad1f);}return _0x32d776[_0x9e25('0x24')]();};}function saveUpdates(_0x4672f1,_0x22d8e3){return function(_0x22885d){if(_0x22885d){return _0x22885d['update'](_0x4672f1)['then'](function(_0x400e75){return _0x400e75;});}return null;};}function removeEntity(_0x1e3eb4,_0x4b8bca){return function(_0x38a4ee){if(_0x38a4ee){return _0x38a4ee[_0x9e25('0x25')]()['then'](function(){_0x1e3eb4[_0x9e25('0x1b')](0xcc)['end']();});}};}function handleEntityNotFound(_0x5a8b90,_0x180089){return function(_0x1f587e){if(!_0x1f587e){_0x5a8b90[_0x9e25('0x1a')](0x194);}return _0x1f587e;};}function handleError(_0x3fd0da,_0x80b52){_0x80b52=_0x80b52||0x1f4;return function(_0x13c6de){logger[_0x9e25('0x26')](_0x13c6de['stack']);if(_0x13c6de['name']){delete _0x13c6de[_0x9e25('0x27')];}_0x3fd0da[_0x9e25('0x1b')](_0x80b52)[_0x9e25('0x28')](_0x13c6de);};}exports[_0x9e25('0x29')]=function(_0x62a58b,_0x3eefbf){var _0x441921={},_0x5b74e5={},_0x319afb={'count':0x0,'rows':[]};var _0x861419=_['map'](db[_0x9e25('0x2a')][_0x9e25('0x2b')],function(_0x368f3d){return{'name':_0x368f3d[_0x9e25('0x2c')],'type':_0x368f3d[_0x9e25('0x2d')][_0x9e25('0x2e')]};});_0x5b74e5['model']=_[_0x9e25('0x2f')](_0x861419,'name');_0x5b74e5['query']=_[_0x9e25('0x30')](_0x62a58b[_0x9e25('0x31')]);_0x5b74e5[_0x9e25('0x32')]=_[_0x9e25('0x33')](_0x5b74e5['model'],_0x5b74e5[_0x9e25('0x31')]);_0x441921[_0x9e25('0x34')]=_[_0x9e25('0x33')](_0x5b74e5[_0x9e25('0x35')],qs['fields'](_0x62a58b[_0x9e25('0x31')][_0x9e25('0x36')]));_0x441921[_0x9e25('0x34')]=_0x441921['attributes'][_0x9e25('0x37')]?_0x441921[_0x9e25('0x34')]:_0x5b74e5[_0x9e25('0x35')];if(!_0x62a58b['query'][_0x9e25('0x38')]('nolimit')){_0x441921[_0x9e25('0x1e')]=qs[_0x9e25('0x1e')](_0x62a58b[_0x9e25('0x31')][_0x9e25('0x1e')]);_0x441921[_0x9e25('0x1d')]=qs[_0x9e25('0x1d')](_0x62a58b[_0x9e25('0x31')][_0x9e25('0x1d')]);}_0x441921[_0x9e25('0x39')]=qs[_0x9e25('0x3a')](_0x62a58b['query'][_0x9e25('0x3a')]);_0x441921['where']=qs[_0x9e25('0x32')](_[_0x9e25('0x3b')](_0x62a58b[_0x9e25('0x31')],_0x5b74e5[_0x9e25('0x32')]),_0x861419);if(_0x62a58b[_0x9e25('0x31')][_0x9e25('0x3c')]){_0x441921['where']=_[_0x9e25('0x3d')](_0x441921[_0x9e25('0x3e')],{'$or':_[_0x9e25('0x2f')](_0x861419,function(_0x133c62){if(_0x133c62['type']!==_0x9e25('0x3f')){var _0x450f96={};_0x450f96[_0x133c62[_0x9e25('0x27')]]={'$like':'%'+_0x62a58b[_0x9e25('0x31')]['filter']+'%'};return _0x450f96;}})});}_0x441921=_[_0x9e25('0x3d')]({},_0x441921,_0x62a58b[_0x9e25('0x40')]);var _0x1fb7e9={'where':_0x441921[_0x9e25('0x3e')]};return db[_0x9e25('0x2a')][_0x9e25('0x20')](_0x1fb7e9)[_0x9e25('0x41')](function(_0x21f42f){_0x319afb[_0x9e25('0x20')]=_0x21f42f;if(_0x62a58b[_0x9e25('0x31')][_0x9e25('0x42')]){_0x441921[_0x9e25('0x43')]=[{'all':!![]}];}return db[_0x9e25('0x2a')][_0x9e25('0x44')](_0x441921);})[_0x9e25('0x41')](function(_0x48cce7){_0x319afb['rows']=_0x48cce7;return _0x319afb;})[_0x9e25('0x41')](respondWithFilteredResult(_0x3eefbf,_0x441921))[_0x9e25('0x45')](handleError(_0x3eefbf,null));};exports[_0x9e25('0x46')]=function(_0x510ab2,_0x3671aa){var _0xff3c21={'raw':!![],'where':{'id':_0x510ab2[_0x9e25('0x47')]['id']}},_0x23b72c={};_0x23b72c[_0x9e25('0x35')]=_[_0x9e25('0x30')](db[_0x9e25('0x2a')]['rawAttributes']);_0x23b72c[_0x9e25('0x31')]=_[_0x9e25('0x30')](_0x510ab2['query']);_0x23b72c['filters']=_['intersection'](_0x23b72c['model'],_0x23b72c[_0x9e25('0x31')]);_0xff3c21[_0x9e25('0x34')]=_[_0x9e25('0x33')](_0x23b72c[_0x9e25('0x35')],qs[_0x9e25('0x36')](_0x510ab2[_0x9e25('0x31')][_0x9e25('0x36')]));_0xff3c21[_0x9e25('0x34')]=_0xff3c21[_0x9e25('0x34')][_0x9e25('0x37')]?_0xff3c21[_0x9e25('0x34')]:_0x23b72c['model'];if(_0x510ab2['query']['includeAll']){_0xff3c21[_0x9e25('0x43')]=[{'all':!![]}];}_0xff3c21=_[_0x9e25('0x3d')]({},_0xff3c21,_0x510ab2['options']);return db['ServicenowField'][_0x9e25('0x48')](_0xff3c21)[_0x9e25('0x41')](handleEntityNotFound(_0x3671aa,null))[_0x9e25('0x41')](respondWithResult(_0x3671aa,null))['catch'](handleError(_0x3671aa,null));};exports[_0x9e25('0x49')]=function(_0x563c9c,_0xaeb386){return db['ServicenowField'][_0x9e25('0x49')](_0x563c9c[_0x9e25('0x4a')],{})[_0x9e25('0x41')](respondWithResult(_0xaeb386,0xc9))[_0x9e25('0x45')](handleError(_0xaeb386,null));};exports[_0x9e25('0x4b')]=function(_0x4caa31,_0x2d1d78){if(_0x4caa31[_0x9e25('0x4a')]['id']){delete _0x4caa31[_0x9e25('0x4a')]['id'];}return db[_0x9e25('0x2a')]['find']({'where':{'id':_0x4caa31[_0x9e25('0x47')]['id']}})[_0x9e25('0x41')](handleEntityNotFound(_0x2d1d78,null))[_0x9e25('0x41')](saveUpdates(_0x4caa31[_0x9e25('0x4a')],null))[_0x9e25('0x41')](respondWithResult(_0x2d1d78,null))[_0x9e25('0x45')](handleError(_0x2d1d78,null));};exports[_0x9e25('0x25')]=function(_0x43c1fa,_0x46fa20){return db[_0x9e25('0x2a')]['find']({'where':{'id':_0x43c1fa['params']['id']}})[_0x9e25('0x41')](handleEntityNotFound(_0x46fa20,null))[_0x9e25('0x41')](removeEntity(_0x46fa20,null))['catch'](handleError(_0x46fa20,null));}; \ No newline at end of file +var _0xa632=['../../mysqldb','sendStatus','status','end','json','offset','limit','undefined','count','set','apply','reject','save','update','then','error','stack','name','send','index','map','ServicenowField','fieldName','type','key','keys','query','filters','attributes','intersection','model','fields','length','hasOwnProperty','sort','where','merge','VIRTUAL','options','includeAll','include','rows','show','params','rawAttributes','find','catch','create','body','destroy','eml-format','rimraf','zip-dir','moment','mustache','sox','to-csv','ejs','fs-extra','lodash','squel','crypto','desk.js','querystring','papaparse','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/logger','../../config/utils','../../config/environment','../../config/license/util'];(function(_0x2bfc60,_0xa254ab){var _0x44ea2c=function(_0x57ca7a){while(--_0x57ca7a){_0x2bfc60['push'](_0x2bfc60['shift']());}};_0x44ea2c(++_0xa254ab);}(_0xa632,0x195));var _0x2a63=function(_0x13ce0c,_0x3f2a0d){_0x13ce0c=_0x13ce0c-0x0;var _0x4388fb=_0xa632[_0x13ce0c];return _0x4388fb;};'use strict';var emlformat=require(_0x2a63('0x0'));var rimraf=require(_0x2a63('0x1'));var zipdir=require(_0x2a63('0x2'));var jsonpatch=require('fast-json-patch');var rp=require('request-promise');var moment=require(_0x2a63('0x3'));var BPromise=require('bluebird');var Mustache=require(_0x2a63('0x4'));var util=require('util');var path=require('path');var sox=require(_0x2a63('0x5'));var csv=require(_0x2a63('0x6'));var ejs=require(_0x2a63('0x7'));var fs=require('fs');var fs_extra=require(_0x2a63('0x8'));var _=require(_0x2a63('0x9'));var squel=require(_0x2a63('0xa'));var crypto=require(_0x2a63('0xb'));var jsforce=require('jsforce');var deskjs=require(_0x2a63('0xc'));var toCsv=require(_0x2a63('0x6'));var querystring=require(_0x2a63('0xd'));var Papa=require(_0x2a63('0xe'));var Redis=require('ioredis');var authService=require('../../components/auth/service');var qs=require(_0x2a63('0xf'));var as=require(_0x2a63('0x10'));var hardwareService=require('../../config/license/hardware');var logger=require(_0x2a63('0x11'))('api');var utils=require(_0x2a63('0x12'));var config=require(_0x2a63('0x13'));var licenseUtil=require(_0x2a63('0x14'));var db=require(_0x2a63('0x15'))['db'];function respondWithStatusCode(_0x22434a,_0x515792){_0x515792=_0x515792||0xcc;return function(_0x26a464){if(_0x26a464){return _0x22434a[_0x2a63('0x16')](_0x515792);}return _0x22434a[_0x2a63('0x17')](_0x515792)[_0x2a63('0x18')]();};}function respondWithResult(_0x31e057,_0x659e95){_0x659e95=_0x659e95||0xc8;return function(_0x32bd24){if(_0x32bd24){return _0x31e057[_0x2a63('0x17')](_0x659e95)[_0x2a63('0x19')](_0x32bd24);}};}function respondWithFilteredResult(_0x13d555,_0x40190d){return function(_0x2df252){if(_0x2df252){var _0x29fead=typeof _0x40190d[_0x2a63('0x1a')]==='undefined'&&typeof _0x40190d[_0x2a63('0x1b')]===_0x2a63('0x1c');var _0x5f2905=_0x2df252[_0x2a63('0x1d')];var _0x31c475=_0x29fead?0x0:_0x40190d[_0x2a63('0x1a')];var _0x21549d=_0x29fead?_0x2df252[_0x2a63('0x1d')]:_0x40190d[_0x2a63('0x1a')]+_0x40190d[_0x2a63('0x1b')];var _0x169de6;if(_0x21549d>=_0x5f2905){_0x21549d=_0x5f2905;_0x169de6=0xc8;}else{_0x169de6=0xce;}_0x13d555[_0x2a63('0x17')](_0x169de6);return _0x13d555[_0x2a63('0x1e')]('Content-Range',_0x31c475+'-'+_0x21549d+'/'+_0x5f2905)[_0x2a63('0x19')](_0x2df252);}return null;};}function patchUpdates(_0xb0208c){return function(_0x516f24){try{jsonpatch[_0x2a63('0x1f')](_0x516f24,_0xb0208c,!![]);}catch(_0x4f5f46){return BPromise[_0x2a63('0x20')](_0x4f5f46);}return _0x516f24[_0x2a63('0x21')]();};}function saveUpdates(_0xea4ab5,_0x16641b){return function(_0x50a1e8){if(_0x50a1e8){return _0x50a1e8[_0x2a63('0x22')](_0xea4ab5)[_0x2a63('0x23')](function(_0x3466c7){return _0x3466c7;});}return null;};}function removeEntity(_0x4bcfd2,_0x58436d){return function(_0x23247d){if(_0x23247d){return _0x23247d['destroy']()['then'](function(){_0x4bcfd2['status'](0xcc)[_0x2a63('0x18')]();});}};}function handleEntityNotFound(_0x414cec,_0x407371){return function(_0x5d410e){if(!_0x5d410e){_0x414cec[_0x2a63('0x16')](0x194);}return _0x5d410e;};}function handleError(_0x4bff5e,_0x12df3c){_0x12df3c=_0x12df3c||0x1f4;return function(_0x56b029){logger[_0x2a63('0x24')](_0x56b029[_0x2a63('0x25')]);if(_0x56b029[_0x2a63('0x26')]){delete _0x56b029['name'];}_0x4bff5e[_0x2a63('0x17')](_0x12df3c)[_0x2a63('0x27')](_0x56b029);};}exports[_0x2a63('0x28')]=function(_0x13c921,_0xc4a398){var _0x5f3caa={},_0x1ad30d={},_0x4b7b4a={'count':0x0,'rows':[]};var _0x256151=_[_0x2a63('0x29')](db[_0x2a63('0x2a')]['rawAttributes'],function(_0x4af384){return{'name':_0x4af384[_0x2a63('0x2b')],'type':_0x4af384[_0x2a63('0x2c')][_0x2a63('0x2d')]};});_0x1ad30d['model']=_[_0x2a63('0x29')](_0x256151,'name');_0x1ad30d['query']=_[_0x2a63('0x2e')](_0x13c921[_0x2a63('0x2f')]);_0x1ad30d[_0x2a63('0x30')]=_['intersection'](_0x1ad30d['model'],_0x1ad30d[_0x2a63('0x2f')]);_0x5f3caa[_0x2a63('0x31')]=_[_0x2a63('0x32')](_0x1ad30d[_0x2a63('0x33')],qs[_0x2a63('0x34')](_0x13c921['query'][_0x2a63('0x34')]));_0x5f3caa[_0x2a63('0x31')]=_0x5f3caa[_0x2a63('0x31')][_0x2a63('0x35')]?_0x5f3caa[_0x2a63('0x31')]:_0x1ad30d['model'];if(!_0x13c921[_0x2a63('0x2f')][_0x2a63('0x36')]('nolimit')){_0x5f3caa[_0x2a63('0x1b')]=qs[_0x2a63('0x1b')](_0x13c921[_0x2a63('0x2f')]['limit']);_0x5f3caa['offset']=qs[_0x2a63('0x1a')](_0x13c921[_0x2a63('0x2f')][_0x2a63('0x1a')]);}_0x5f3caa['order']=qs[_0x2a63('0x37')](_0x13c921[_0x2a63('0x2f')][_0x2a63('0x37')]);_0x5f3caa[_0x2a63('0x38')]=qs['filters'](_['pick'](_0x13c921['query'],_0x1ad30d[_0x2a63('0x30')]),_0x256151);if(_0x13c921[_0x2a63('0x2f')]['filter']){_0x5f3caa[_0x2a63('0x38')]=_[_0x2a63('0x39')](_0x5f3caa[_0x2a63('0x38')],{'$or':_[_0x2a63('0x29')](_0x256151,function(_0x4f41cf){if(_0x4f41cf['type']!==_0x2a63('0x3a')){var _0x26fdc3={};_0x26fdc3[_0x4f41cf['name']]={'$like':'%'+_0x13c921[_0x2a63('0x2f')]['filter']+'%'};return _0x26fdc3;}})});}_0x5f3caa=_['merge']({},_0x5f3caa,_0x13c921[_0x2a63('0x3b')]);var _0x2ca857={'where':_0x5f3caa[_0x2a63('0x38')]};return db[_0x2a63('0x2a')]['count'](_0x2ca857)['then'](function(_0x3ca5b4){_0x4b7b4a[_0x2a63('0x1d')]=_0x3ca5b4;if(_0x13c921[_0x2a63('0x2f')][_0x2a63('0x3c')]){_0x5f3caa[_0x2a63('0x3d')]=[{'all':!![]}];}return db['ServicenowField']['findAll'](_0x5f3caa);})['then'](function(_0x4e0bd1){_0x4b7b4a[_0x2a63('0x3e')]=_0x4e0bd1;return _0x4b7b4a;})[_0x2a63('0x23')](respondWithFilteredResult(_0xc4a398,_0x5f3caa))['catch'](handleError(_0xc4a398,null));};exports[_0x2a63('0x3f')]=function(_0x42a399,_0x457ea3){var _0x32f739={'raw':!![],'where':{'id':_0x42a399[_0x2a63('0x40')]['id']}},_0xc7d998={};_0xc7d998[_0x2a63('0x33')]=_[_0x2a63('0x2e')](db[_0x2a63('0x2a')][_0x2a63('0x41')]);_0xc7d998[_0x2a63('0x2f')]=_[_0x2a63('0x2e')](_0x42a399[_0x2a63('0x2f')]);_0xc7d998[_0x2a63('0x30')]=_['intersection'](_0xc7d998[_0x2a63('0x33')],_0xc7d998['query']);_0x32f739[_0x2a63('0x31')]=_[_0x2a63('0x32')](_0xc7d998['model'],qs[_0x2a63('0x34')](_0x42a399['query'][_0x2a63('0x34')]));_0x32f739[_0x2a63('0x31')]=_0x32f739[_0x2a63('0x31')]['length']?_0x32f739[_0x2a63('0x31')]:_0xc7d998[_0x2a63('0x33')];if(_0x42a399[_0x2a63('0x2f')][_0x2a63('0x3c')]){_0x32f739[_0x2a63('0x3d')]=[{'all':!![]}];}_0x32f739=_['merge']({},_0x32f739,_0x42a399[_0x2a63('0x3b')]);return db[_0x2a63('0x2a')][_0x2a63('0x42')](_0x32f739)['then'](handleEntityNotFound(_0x457ea3,null))[_0x2a63('0x23')](respondWithResult(_0x457ea3,null))[_0x2a63('0x43')](handleError(_0x457ea3,null));};exports[_0x2a63('0x44')]=function(_0x4e05be,_0x3f303a){return db[_0x2a63('0x2a')][_0x2a63('0x44')](_0x4e05be[_0x2a63('0x45')],{})['then'](respondWithResult(_0x3f303a,0xc9))[_0x2a63('0x43')](handleError(_0x3f303a,null));};exports[_0x2a63('0x22')]=function(_0x5c9dc7,_0x129794){if(_0x5c9dc7[_0x2a63('0x45')]['id']){delete _0x5c9dc7['body']['id'];}return db[_0x2a63('0x2a')][_0x2a63('0x42')]({'where':{'id':_0x5c9dc7['params']['id']}})[_0x2a63('0x23')](handleEntityNotFound(_0x129794,null))['then'](saveUpdates(_0x5c9dc7[_0x2a63('0x45')],null))[_0x2a63('0x23')](respondWithResult(_0x129794,null))[_0x2a63('0x43')](handleError(_0x129794,null));};exports[_0x2a63('0x46')]=function(_0x15b268,_0x214d08){return db[_0x2a63('0x2a')][_0x2a63('0x42')]({'where':{'id':_0x15b268[_0x2a63('0x40')]['id']}})[_0x2a63('0x23')](handleEntityNotFound(_0x214d08,null))['then'](removeEntity(_0x214d08,null))['catch'](handleError(_0x214d08,null));}; \ No newline at end of file diff --git a/server/api/intServicenowField/intServicenowField.model.js b/server/api/intServicenowField/intServicenowField.model.js index 9278e38..4a5af7d 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 _0x5790=['path','rimraf','../../config/environment','./intServicenowField.attributes','exports','define','ServicenowField','int_servicenow_fields','servicenow_unique_index','idField','../../config/logger','api','moment'];(function(_0x5a35fe,_0x3a72c3){var _0x5933d4=function(_0x23c3e0){while(--_0x23c3e0){_0x5a35fe['push'](_0x5a35fe['shift']());}};_0x5933d4(++_0x3a72c3);}(_0x5790,0x1b7));var _0x0579=function(_0x167cc1,_0x56ef5a){_0x167cc1=_0x167cc1-0x0;var _0x10bc4b=_0x5790[_0x167cc1];return _0x10bc4b;};'use strict';var _=require('lodash');var util=require('util');var logger=require(_0x0579('0x0'))(_0x0579('0x1'));var moment=require(_0x0579('0x2'));var BPromise=require('bluebird');var rp=require('request-promise');var fs=require('fs');var path=require(_0x0579('0x3'));var rimraf=require(_0x0579('0x4'));var config=require(_0x0579('0x5'));var attributes=require(_0x0579('0x6'));module[_0x0579('0x7')]=function(_0x3fb6b7,_0xca0ee4){return _0x3fb6b7[_0x0579('0x8')](_0x0579('0x9'),attributes,{'tableName':_0x0579('0xa'),'paranoid':![],'indexes':[{'name':_0x0579('0xb'),'fields':[_0x0579('0xc'),'FieldId'],'unique':!![]}],'timestamps':!![]});}; \ No newline at end of file +var _0xc831=['lodash','util','moment','path','../../config/environment','./intServicenowField.attributes','exports','define','ServicenowField','int_servicenow_fields','servicenow_unique_index','idField'];(function(_0x1b6b42,_0x47dc90){var _0x19b5a2=function(_0x4798df){while(--_0x4798df){_0x1b6b42['push'](_0x1b6b42['shift']());}};_0x19b5a2(++_0x47dc90);}(_0xc831,0xe4));var _0x1c83=function(_0x2e62e5,_0x460623){_0x2e62e5=_0x2e62e5-0x0;var _0x985f1f=_0xc831[_0x2e62e5];return _0x985f1f;};'use strict';var _=require(_0x1c83('0x0'));var util=require(_0x1c83('0x1'));var logger=require('../../config/logger')('api');var moment=require(_0x1c83('0x2'));var BPromise=require('bluebird');var rp=require('request-promise');var fs=require('fs');var path=require(_0x1c83('0x3'));var rimraf=require('rimraf');var config=require(_0x1c83('0x4'));var attributes=require(_0x1c83('0x5'));module[_0x1c83('0x6')]=function(_0x3be5fb,_0x2f0bf5){return _0x3be5fb[_0x1c83('0x7')](_0x1c83('0x8'),attributes,{'tableName':_0x1c83('0x9'),'paranoid':![],'indexes':[{'name':_0x1c83('0xa'),'fields':[_0x1c83('0xb'),'FieldId'],'unique':!![]}],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/intServicenowField/intServicenowField.rpc.js b/server/api/intServicenowField/intServicenowField.rpc.js index af2f3c6..31ec36b 100644 --- a/server/api/intServicenowField/intServicenowField.rpc.js +++ b/server/api/intServicenowField/intServicenowField.rpc.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0xa9e0=['http','info','ServicenowField,\x20%s,\x20%s','request\x20sent','debug','ServicenowField,\x20%s,\x20%s,\x20%s','code','error','message','result','catch','lodash','util','moment','ioredis','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise'];(function(_0x4d9f9e,_0x45f0da){var _0x56a396=function(_0x4b0006){while(--_0x4b0006){_0x4d9f9e['push'](_0x4d9f9e['shift']());}};_0x56a396(++_0x45f0da);}(_0xa9e0,0x123));var _0x0a9e=function(_0x491a7f,_0x28bb80){_0x491a7f=_0x491a7f-0x0;var _0x3d8f44=_0xa9e0[_0x491a7f];return _0x3d8f44;};'use strict';var _=require(_0x0a9e('0x0'));var util=require(_0x0a9e('0x1'));var 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 _0xbdb7=['request\x20sent','debug','ServicenowField,\x20%s,\x20%s,\x20%s','stringify','error','message','result','catch','lodash','util','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','../../config/environment','http','info','ServicenowField,\x20%s,\x20%s'];(function(_0x321bb2,_0x202794){var _0x9c12ed=function(_0x263dd3){while(--_0x263dd3){_0x321bb2['push'](_0x321bb2['shift']());}};_0x9c12ed(++_0x202794);}(_0xbdb7,0x12e));var _0x7bdb=function(_0x77d310,_0x2b2fe7){_0x77d310=_0x77d310-0x0;var _0x2cdce4=_0xbdb7[_0x77d310];return _0x2cdce4;};'use strict';var _=require(_0x7bdb('0x0'));var util=require(_0x7bdb('0x1'));var moment=require(_0x7bdb('0x2'));var BPromise=require(_0x7bdb('0x3'));var rs=require(_0x7bdb('0x4'));var fs=require('fs');var Redis=require(_0x7bdb('0x5'));var db=require(_0x7bdb('0x6'))['db'];var utils=require(_0x7bdb('0x7'));var logger=require(_0x7bdb('0x8'))('rpc');var config=require(_0x7bdb('0x9'));var jayson=require('jayson/promise');var client=jayson['client'][_0x7bdb('0xa')]({'port':0x232a});function respondWithRpcPromise(_0x1e23a3,_0x493bde,_0x513cba){return new BPromise(function(_0x468041,_0x11a877){return client['request'](_0x1e23a3,_0x513cba)['then'](function(_0xdc2ffc){logger[_0x7bdb('0xb')](_0x7bdb('0xc'),_0x493bde,_0x7bdb('0xd'));logger[_0x7bdb('0xe')](_0x7bdb('0xf'),_0x493bde,_0x7bdb('0xd'),JSON[_0x7bdb('0x10')](_0xdc2ffc));if(_0xdc2ffc['error']){if(_0xdc2ffc['error']['code']===0x1f4){logger[_0x7bdb('0x11')](_0x7bdb('0xc'),_0x493bde,_0xdc2ffc['error'][_0x7bdb('0x12')]);return _0x11a877(_0xdc2ffc['error']['message']);}logger[_0x7bdb('0x11')](_0x7bdb('0xc'),_0x493bde,_0xdc2ffc['error']['message']);return _0x468041(_0xdc2ffc['error'][_0x7bdb('0x12')]);}else{logger[_0x7bdb('0xb')](_0x7bdb('0xc'),_0x493bde,_0x7bdb('0xd'));_0x468041(_0xdc2ffc[_0x7bdb('0x13')][_0x7bdb('0x12')]);}})[_0x7bdb('0x14')](function(_0x1b2d9b){logger['error'](_0x7bdb('0xc'),_0x493bde,_0x1b2d9b);_0x11a877(_0x1b2d9b);});});} \ No newline at end of file diff --git a/server/api/intSugarcrmAccount/index.js b/server/api/intSugarcrmAccount/index.js index af60a9e..613efc0 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(_0x31315f,_0xecf007){var _0x3de47c=function(_0x498c34){while(--_0x498c34){_0x31315f['push'](_0x31315f['shift']());}};_0x3de47c(++_0xecf007);}(_0x9957,0x93));var _0x7995=function(_0x618414,_0x1a7a60){_0x618414=_0x618414-0x0;var _0x21c19a=_0x9957[_0x618414];return _0x21c19a;};'use strict';var multer=require(_0x7995('0x0'));var util=require(_0x7995('0x1'));var path=require(_0x7995('0x2'));var timeout=require(_0x7995('0x3'));var express=require('express');var router=express[_0x7995('0x4')]();var fs_extra=require(_0x7995('0x5'));var auth=require(_0x7995('0x6'));var interaction=require(_0x7995('0x7'));var config=require('../../config/environment');var controller=require(_0x7995('0x8'));router[_0x7995('0x9')]('/',auth[_0x7995('0xa')](),controller[_0x7995('0xb')]);router[_0x7995('0x9')](_0x7995('0xc'),auth['isAuthenticated'](),controller[_0x7995('0xd')]);router[_0x7995('0x9')]('/:id/configurations',auth[_0x7995('0xa')](),controller[_0x7995('0xe')]);router[_0x7995('0x9')](_0x7995('0xf'),auth[_0x7995('0xa')](),controller[_0x7995('0x10')]);router[_0x7995('0x11')]('/',auth['isAuthenticated'](),controller[_0x7995('0x12')]);router[_0x7995('0x11')]('/:id/configurations',auth[_0x7995('0xa')](),controller[_0x7995('0x13')]);router[_0x7995('0x14')](_0x7995('0xc'),auth[_0x7995('0xa')](),controller[_0x7995('0x15')]);router[_0x7995('0x16')]('/:id',auth['isAuthenticated'](),controller[_0x7995('0x17')]);module[_0x7995('0x18')]=router; \ No newline at end of file +var _0xa9e0=['Router','../../components/auth/service','../../components/interaction/service','../../config/environment','./intSugarcrmAccount.controller','get','index','/:id','getConfigurations','/:id/fields','isAuthenticated','getFields','post','addConfiguration','put','update','destroy','exports','multer','util','path'];(function(_0x71e58f,_0x4d233b){var _0x47471a=function(_0x350bc1){while(--_0x350bc1){_0x71e58f['push'](_0x71e58f['shift']());}};_0x47471a(++_0x4d233b);}(_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['show']);router[_0x0a9e('0x8')]('/:id/configurations',auth['isAuthenticated'](),controller[_0x0a9e('0xb')]);router[_0x0a9e('0x8')](_0x0a9e('0xc'),auth[_0x0a9e('0xd')](),controller[_0x0a9e('0xe')]);router[_0x0a9e('0xf')]('/',auth['isAuthenticated'](),controller['create']);router['post']('/:id/configurations',auth[_0x0a9e('0xd')](),controller[_0x0a9e('0x10')]);router[_0x0a9e('0x11')](_0x0a9e('0xa'),auth[_0x0a9e('0xd')](),controller[_0x0a9e('0x12')]);router['delete'](_0x0a9e('0xa'),auth[_0x0a9e('0xd')](),controller[_0x0a9e('0x13')]);module[_0x0a9e('0x14')]=router; \ No newline at end of file diff --git a/server/api/intSugarcrmAccount/intSugarcrmAccount.attributes.js b/server/api/intSugarcrmAccount/intSugarcrmAccount.attributes.js index f4cf7d6..6df232b 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(_0x5dbdcb,_0xb3aefa){var _0x50744b=function(_0x5cf9c0){while(--_0x5cf9c0){_0x5dbdcb['push'](_0x5dbdcb['shift']());}};_0x50744b(++_0xb3aefa);}(_0xa9e0,0x123));var _0x0a9e=function(_0x32d457,_0x1a39c9){_0x32d457=_0x32d457-0x0;var _0x338386=_0xa9e0[_0x32d457];return _0x338386;};'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(_0x120fcb,_0x26bc22){var _0x15c0c5=function(_0x33777e){while(--_0x33777e){_0x120fcb['push'](_0x120fcb['shift']());}};_0x15c0c5(++_0x26bc22);}(_0xa9e0,0x123));var _0x0a9e=function(_0x2b4411,_0x2625ed){_0x2b4411=_0x2b4411-0x0;var _0x8e41ef=_0xa9e0[_0x2b4411];return _0x8e41ef;};'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 8aa1f93..8f1ab98 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 _0x951b=['sendStatus','status','end','offset','undefined','count','limit','Content-Range','apply','reject','save','update','destroy','then','error','stack','name','send','index','map','SugarcrmAccount','rawAttributes','fieldName','key','model','query','keys','filters','intersection','attributes','hasOwnProperty','order','sort','where','filter','merge','VIRTUAL','options','includeAll','include','findAll','catch','show','params','fields','length','find','create','body','findOne','SugarcrmConfiguration','pick','nolimit','getConfigurations','addConfiguration','AccountId','Subjects','channel','Descriptions','getDescriptions','SugarcrmField','getFields','assigned_user_id','created_by','description','date_start','duration_hours','duration_minutes','parent_id','parent_type','parent_name','direction','username','password','remoteUri','substring','lastIndexOf','format','%s%s','/service/v4_1/rest.php','login','JSON','stringify','xCALLY\x20Motion\x20Integration','Invalid\x20Login','Password\x20Expired','POST','get_module_fields','Calls','remove','includes','values','value','test','statusCode','getFields,\x20%s,\x20%s,\x20%s','eml-format','rimraf','zip-dir','bluebird','mustache','util','path','to-csv','ejs','fs-extra','lodash','squel','jsforce','desk.js','papaparse','ioredis','../../components/auth/service','../../components/parsers/advancedSearch','../../config/logger','api','../../config/utils','../../config/environment'];(function(_0xc1d71a,_0x4d1fec){var _0x1a4880=function(_0x5c0772){while(--_0x5c0772){_0xc1d71a['push'](_0xc1d71a['shift']());}};_0x1a4880(++_0x4d1fec);}(_0x951b,0x14c));var _0xb951=function(_0x3d3f7c,_0x1dd5bf){_0x3d3f7c=_0x3d3f7c-0x0;var _0x3da7bc=_0x951b[_0x3d3f7c];return _0x3da7bc;};'use strict';var emlformat=require(_0xb951('0x0'));var rimraf=require(_0xb951('0x1'));var zipdir=require(_0xb951('0x2'));var jsonpatch=require('fast-json-patch');var rp=require('request-promise');var moment=require('moment');var BPromise=require(_0xb951('0x3'));var Mustache=require(_0xb951('0x4'));var util=require(_0xb951('0x5'));var path=require(_0xb951('0x6'));var sox=require('sox');var csv=require(_0xb951('0x7'));var ejs=require(_0xb951('0x8'));var fs=require('fs');var fs_extra=require(_0xb951('0x9'));var _=require(_0xb951('0xa'));var squel=require(_0xb951('0xb'));var crypto=require('crypto');var jsforce=require(_0xb951('0xc'));var deskjs=require(_0xb951('0xd'));var toCsv=require('to-csv');var querystring=require('querystring');var Papa=require(_0xb951('0xe'));var Redis=require(_0xb951('0xf'));var authService=require(_0xb951('0x10'));var qs=require('../../components/parsers/qs');var as=require(_0xb951('0x11'));var hardwareService=require('../../config/license/hardware');var logger=require(_0xb951('0x12'))(_0xb951('0x13'));var utils=require(_0xb951('0x14'));var config=require(_0xb951('0x15'));var licenseUtil=require('../../config/license/util');var db=require('../../mysqldb')['db'];var integrations=require('../../components/integrations/configuration');function respondWithStatusCode(_0x299b30,_0x2827cd){_0x2827cd=_0x2827cd||0xcc;return function(_0x12c18e){if(_0x12c18e){return _0x299b30[_0xb951('0x16')](_0x2827cd);}return _0x299b30[_0xb951('0x17')](_0x2827cd)[_0xb951('0x18')]();};}function respondWithResult(_0x54b4ba,_0x371139){_0x371139=_0x371139||0xc8;return function(_0x149df4){if(_0x149df4){return _0x54b4ba['status'](_0x371139)['json'](_0x149df4);}};}function respondWithFilteredResult(_0x17b3c6,_0x2469d3){return function(_0x1ac3f9){if(_0x1ac3f9){var _0x17004a=typeof _0x2469d3[_0xb951('0x19')]===_0xb951('0x1a')&&typeof _0x2469d3['limit']===_0xb951('0x1a');var _0x449de6=_0x1ac3f9[_0xb951('0x1b')];var _0x382092=_0x17004a?0x0:_0x2469d3[_0xb951('0x19')];var _0x26c18=_0x17004a?_0x1ac3f9[_0xb951('0x1b')]:_0x2469d3[_0xb951('0x19')]+_0x2469d3[_0xb951('0x1c')];var _0x5b0e09;if(_0x26c18>=_0x449de6){_0x26c18=_0x449de6;_0x5b0e09=0xc8;}else{_0x5b0e09=0xce;}_0x17b3c6[_0xb951('0x17')](_0x5b0e09);return _0x17b3c6['set'](_0xb951('0x1d'),_0x382092+'-'+_0x26c18+'/'+_0x449de6)['json'](_0x1ac3f9);}return null;};}function patchUpdates(_0x546bf5){return function(_0x4b43cf){try{jsonpatch[_0xb951('0x1e')](_0x4b43cf,_0x546bf5,!![]);}catch(_0x32b7d7){return BPromise[_0xb951('0x1f')](_0x32b7d7);}return _0x4b43cf[_0xb951('0x20')]();};}function saveUpdates(_0x1d89df,_0x1c17a1){return function(_0x3e6e7f){if(_0x3e6e7f){return _0x3e6e7f[_0xb951('0x21')](_0x1d89df)['then'](function(_0x2edf56){return _0x2edf56;});}return null;};}function removeEntity(_0x5a69d2,_0x1e92e1){return function(_0x41a344){if(_0x41a344){return _0x41a344[_0xb951('0x22')]()[_0xb951('0x23')](function(){_0x5a69d2[_0xb951('0x17')](0xcc)[_0xb951('0x18')]();});}};}function handleEntityNotFound(_0x3b378c,_0x38c73d){return function(_0x4aee98){if(!_0x4aee98){_0x3b378c[_0xb951('0x16')](0x194);}return _0x4aee98;};}function handleError(_0x3619dd,_0x30fedc){_0x30fedc=_0x30fedc||0x1f4;return function(_0x1cd39e){logger[_0xb951('0x24')](_0x1cd39e[_0xb951('0x25')]);if(_0x1cd39e[_0xb951('0x26')]){delete _0x1cd39e[_0xb951('0x26')];}_0x3619dd[_0xb951('0x17')](_0x30fedc)[_0xb951('0x27')](_0x1cd39e);};}exports[_0xb951('0x28')]=function(_0xb9c68c,_0x1c915b){var _0x549f1f={},_0x98452b={},_0x335d8b={'count':0x0,'rows':[]};var _0x4faef0=_[_0xb951('0x29')](db[_0xb951('0x2a')][_0xb951('0x2b')],function(_0x1d1c07){return{'name':_0x1d1c07[_0xb951('0x2c')],'type':_0x1d1c07['type'][_0xb951('0x2d')]};});_0x98452b[_0xb951('0x2e')]=_[_0xb951('0x29')](_0x4faef0,_0xb951('0x26'));_0x98452b[_0xb951('0x2f')]=_[_0xb951('0x30')](_0xb9c68c[_0xb951('0x2f')]);_0x98452b[_0xb951('0x31')]=_[_0xb951('0x32')](_0x98452b['model'],_0x98452b[_0xb951('0x2f')]);_0x549f1f['attributes']=_[_0xb951('0x32')](_0x98452b[_0xb951('0x2e')],qs['fields'](_0xb9c68c[_0xb951('0x2f')]['fields']));_0x549f1f[_0xb951('0x33')]=_0x549f1f['attributes']['length']?_0x549f1f[_0xb951('0x33')]:_0x98452b[_0xb951('0x2e')];if(!_0xb9c68c['query'][_0xb951('0x34')]('nolimit')){_0x549f1f[_0xb951('0x1c')]=qs[_0xb951('0x1c')](_0xb9c68c[_0xb951('0x2f')]['limit']);_0x549f1f['offset']=qs[_0xb951('0x19')](_0xb9c68c[_0xb951('0x2f')][_0xb951('0x19')]);}_0x549f1f[_0xb951('0x35')]=qs['sort'](_0xb9c68c[_0xb951('0x2f')][_0xb951('0x36')]);_0x549f1f[_0xb951('0x37')]=qs[_0xb951('0x31')](_['pick'](_0xb9c68c[_0xb951('0x2f')],_0x98452b[_0xb951('0x31')]),_0x4faef0);if(_0xb9c68c[_0xb951('0x2f')][_0xb951('0x38')]){_0x549f1f[_0xb951('0x37')]=_[_0xb951('0x39')](_0x549f1f[_0xb951('0x37')],{'$or':_[_0xb951('0x29')](_0x4faef0,function(_0x47a67f){if(_0x47a67f['type']!==_0xb951('0x3a')){var _0x38b9f3={};_0x38b9f3[_0x47a67f[_0xb951('0x26')]]={'$like':'%'+_0xb9c68c['query'][_0xb951('0x38')]+'%'};return _0x38b9f3;}})});}_0x549f1f=_[_0xb951('0x39')]({},_0x549f1f,_0xb9c68c[_0xb951('0x3b')]);var _0x26c621={'where':_0x549f1f['where']};return db[_0xb951('0x2a')]['count'](_0x26c621)[_0xb951('0x23')](function(_0x22952c){_0x335d8b['count']=_0x22952c;if(_0xb9c68c[_0xb951('0x2f')][_0xb951('0x3c')]){_0x549f1f[_0xb951('0x3d')]=[{'all':!![]}];}return db[_0xb951('0x2a')][_0xb951('0x3e')](_0x549f1f);})[_0xb951('0x23')](function(_0x2d2133){_0x335d8b['rows']=_0x2d2133;return _0x335d8b;})[_0xb951('0x23')](respondWithFilteredResult(_0x1c915b,_0x549f1f))[_0xb951('0x3f')](handleError(_0x1c915b,null));};exports[_0xb951('0x40')]=function(_0x47cb34,_0x129ab5){var _0xd658e9={'raw':![],'where':{'id':_0x47cb34[_0xb951('0x41')]['id']}},_0x4fbe70={};_0x4fbe70[_0xb951('0x2e')]=_[_0xb951('0x30')](db['SugarcrmAccount'][_0xb951('0x2b')]);_0x4fbe70['query']=_['keys'](_0x47cb34[_0xb951('0x2f')]);_0x4fbe70[_0xb951('0x31')]=_['intersection'](_0x4fbe70[_0xb951('0x2e')],_0x4fbe70['query']);_0xd658e9['attributes']=_[_0xb951('0x32')](_0x4fbe70[_0xb951('0x2e')],qs[_0xb951('0x42')](_0x47cb34[_0xb951('0x2f')][_0xb951('0x42')]));_0xd658e9[_0xb951('0x33')]=_0xd658e9[_0xb951('0x33')][_0xb951('0x43')]?_0xd658e9[_0xb951('0x33')]:_0x4fbe70['model'];if(_0x47cb34[_0xb951('0x2f')][_0xb951('0x3c')]){_0xd658e9[_0xb951('0x3d')]=[{'all':!![]}];}_0xd658e9=_[_0xb951('0x39')]({},_0xd658e9,_0x47cb34['options']);return db[_0xb951('0x2a')][_0xb951('0x44')](_0xd658e9)[_0xb951('0x23')](handleEntityNotFound(_0x129ab5,null))['then'](respondWithResult(_0x129ab5,null))[_0xb951('0x3f')](handleError(_0x129ab5,null));};exports[_0xb951('0x45')]=function(_0x225bde,_0x597c8a){return db[_0xb951('0x2a')][_0xb951('0x45')](_0x225bde['body'],{})[_0xb951('0x23')](respondWithResult(_0x597c8a,0xc9))[_0xb951('0x3f')](handleError(_0x597c8a,null));};exports[_0xb951('0x21')]=function(_0x78aa7,_0x2408ea){if(_0x78aa7[_0xb951('0x46')]['id']){delete _0x78aa7['body']['id'];}return db[_0xb951('0x2a')][_0xb951('0x44')]({'where':{'id':_0x78aa7[_0xb951('0x41')]['id']}})['then'](handleEntityNotFound(_0x2408ea,null))['then'](saveUpdates(_0x78aa7[_0xb951('0x46')],null))[_0xb951('0x23')](respondWithResult(_0x2408ea,null))[_0xb951('0x3f')](handleError(_0x2408ea,null));};exports[_0xb951('0x22')]=function(_0x4d100c,_0x6bc830){return db[_0xb951('0x2a')][_0xb951('0x44')]({'where':{'id':_0x4d100c[_0xb951('0x41')]['id']}})[_0xb951('0x23')](handleEntityNotFound(_0x6bc830,null))[_0xb951('0x23')](removeEntity(_0x6bc830,null))[_0xb951('0x3f')](handleError(_0x6bc830,null));};exports['getConfigurations']=function(_0x18c017,_0x522e47,_0x5bf9c2){var _0x529fc9={};var _0x4ca4b7={};var _0x547a15;var _0x18721b;return db['SugarcrmAccount'][_0xb951('0x47')]({'where':{'id':_0x18c017['params']['id']}})[_0xb951('0x23')](handleEntityNotFound(_0x522e47,null))[_0xb951('0x23')](function(_0x2d6074){if(_0x2d6074){_0x547a15=_0x2d6074;_0x4ca4b7[_0xb951('0x2e')]=_['keys'](db[_0xb951('0x48')][_0xb951('0x2b')]);_0x4ca4b7['query']=_[_0xb951('0x30')](_0x18c017[_0xb951('0x2f')]);_0x4ca4b7[_0xb951('0x31')]=_[_0xb951('0x32')](_0x4ca4b7[_0xb951('0x2e')],_0x4ca4b7[_0xb951('0x2f')]);_0x529fc9[_0xb951('0x33')]=_[_0xb951('0x32')](_0x4ca4b7[_0xb951('0x2e')],qs[_0xb951('0x42')](_0x18c017[_0xb951('0x2f')][_0xb951('0x42')]));_0x529fc9[_0xb951('0x33')]=_0x529fc9[_0xb951('0x33')]['length']?_0x529fc9['attributes']:_0x4ca4b7['model'];_0x529fc9[_0xb951('0x35')]=qs['sort'](_0x18c017['query'][_0xb951('0x36')]);_0x529fc9[_0xb951('0x37')]=qs['filters'](_[_0xb951('0x49')](_0x18c017[_0xb951('0x2f')],_0x4ca4b7[_0xb951('0x31')]));if(_0x18c017[_0xb951('0x2f')][_0xb951('0x38')]){_0x529fc9[_0xb951('0x37')]=_[_0xb951('0x39')](_0x529fc9[_0xb951('0x37')],{'$or':_[_0xb951('0x29')](_0x529fc9[_0xb951('0x33')],function(_0x12a11d){var _0x329350={};_0x329350[_0x12a11d]={'$like':'%'+_0x18c017[_0xb951('0x2f')]['filter']+'%'};return _0x329350;})});}_0x529fc9=_['merge']({},_0x529fc9,_0x18c017[_0xb951('0x3b')]);return _0x547a15['getConfigurations'](_0x529fc9);}})[_0xb951('0x23')](function(_0xc5801f){if(_0xc5801f){_0x18721b=_0xc5801f[_0xb951('0x43')];if(!_0x18c017[_0xb951('0x2f')]['hasOwnProperty'](_0xb951('0x4a'))){_0x529fc9[_0xb951('0x1c')]=qs[_0xb951('0x1c')](_0x18c017[_0xb951('0x2f')]['limit']);_0x529fc9[_0xb951('0x19')]=qs[_0xb951('0x19')](_0x18c017[_0xb951('0x2f')][_0xb951('0x19')]);}return _0x547a15[_0xb951('0x4b')](_0x529fc9);}})['then'](function(_0x1910fa){if(_0x1910fa){return _0x1910fa?{'count':_0x18721b,'rows':_0x1910fa}:null;}})[_0xb951('0x23')](respondWithResult(_0x522e47,null))['catch'](handleError(_0x522e47,null));};exports[_0xb951('0x4c')]=function(_0x440fbd,_0x63fa99,_0x547d39){if(_0x440fbd[_0xb951('0x46')]['id']){delete _0x440fbd[_0xb951('0x46')]['id'];}return db[_0xb951('0x2a')]['findOne']({'where':{'id':_0x440fbd[_0xb951('0x41')]['id']}})[_0xb951('0x23')](handleEntityNotFound(_0x63fa99,null))['then'](function(_0x58fdf2){if(_0x58fdf2){_0x440fbd[_0xb951('0x46')][_0xb951('0x4d')]=_0x58fdf2['id'];_0x440fbd[_0xb951('0x46')][_0xb951('0x4e')]=integrations['getSubjects'](_0x440fbd[_0xb951('0x46')][_0xb951('0x4f')],_0x440fbd[_0xb951('0x46')]['type']);_0x440fbd['body'][_0xb951('0x50')]=integrations[_0xb951('0x51')](_0x440fbd['body'][_0xb951('0x4f')],_0x440fbd['body']['type']);return db['SugarcrmConfiguration'][_0xb951('0x45')](_0x440fbd[_0xb951('0x46')],{'include':[{'model':db[_0xb951('0x52')],'as':_0xb951('0x4e')},{'model':db[_0xb951('0x52')],'as':_0xb951('0x50')}]});}return null;})[_0xb951('0x23')](respondWithResult(_0x63fa99,null))[_0xb951('0x3f')](handleError(_0x63fa99,null));};exports[_0xb951('0x53')]=function(_0x1e095a,_0xf277ad,_0xf9a6f7){var _0x52bb3d='';var _0x17cfa6=['id',_0xb951('0x26'),_0xb951('0x54'),_0xb951('0x55'),_0xb951('0x56'),_0xb951('0x57'),_0xb951('0x58'),_0xb951('0x59'),_0xb951('0x5a'),_0xb951('0x5b'),_0xb951('0x5c'),_0xb951('0x5d')];return db['SugarcrmAccount'][_0xb951('0x47')]({'where':{'id':_0x1e095a['params']['id']},'attributes':['id',_0xb951('0x5e'),_0xb951('0x5f'),_0xb951('0x60')]})['then'](handleEntityNotFound(_0xf277ad,null))[_0xb951('0x23')](function(_0x30befc){if(_0x30befc){_0x52bb3d=_0x30befc[_0xb951('0x60')];var _0x212bf5=_0x52bb3d['slice'](-0x1);if(_0x212bf5==='/'){_0x52bb3d=_0x52bb3d[_0xb951('0x61')](0x0,_0x52bb3d[_0xb951('0x62')](_0x212bf5));}return rp({'method':'POST','uri':util[_0xb951('0x63')](_0xb951('0x64'),_0x52bb3d,_0xb951('0x65')),'json':!![],'form':{'method':_0xb951('0x66'),'input_type':_0xb951('0x67'),'response_type':_0xb951('0x67'),'rest_data':JSON[_0xb951('0x68')]({'user_auth':{'user_name':_0x30befc[_0xb951('0x5e')],'password':_0x30befc['password'],'encryption':'PLAIN'},'application':_0xb951('0x69')})}});}})[_0xb951('0x23')](function(_0x414467){if(_0x414467&&_0x414467[_0xb951('0x26')]!==_0xb951('0x6a')&&_0x414467['name']!==_0xb951('0x6b')){return rp({'method':_0xb951('0x6c'),'uri':util['format'](_0xb951('0x64'),_0x52bb3d,'/service/v4_1/rest.php'),'json':!![],'form':{'method':_0xb951('0x6d'),'input_type':_0xb951('0x67'),'response_type':'JSON','rest_data':JSON[_0xb951('0x68')]({'session':_0x414467['id'],'module_name':_0xb951('0x6e')})}})['then'](function(_0x55a138){if(_0x55a138){var _0x41f812=_['values'](_0x55a138['module_fields']);_[_0xb951('0x6f')](_0x41f812,function(_0x457a47){return _0x17cfa6[_0xb951('0x70')](_0x457a47[_0xb951('0x26')]);});return{'count':_0x41f812[_0xb951('0x43')],'rows':_['map'](_0x41f812,function(_0x527e33){return{'id':_0x527e33[_0xb951('0x26')],'name':_0x527e33['label'],'custom':_['endsWith'](_0x527e33[_0xb951('0x26')],'_c')?!![]:![],'options':_0x527e33[_0xb951('0x3b')]?_[_0xb951('0x29')](_[_0xb951('0x71')](_0x527e33[_0xb951('0x3b')]),function(_0x1f90e9){return{'name':_0x1f90e9[_0xb951('0x72')],'value':_0x1f90e9[_0xb951('0x26')]};}):[]};})};}})[_0xb951('0x23')](respondWithResult(_0xf277ad,null))['catch'](function(_0x3fc1dd){var _0x2154e4=_0x1e095a[_0xb951('0x2f')][_0xb951('0x73')]?0x1f4:_0x3fc1dd[_0xb951('0x74')]||0x1f4;logger[_0xb951('0x24')](_0xb951('0x75'),_0xb951('0x53'),_0x2154e4,JSON[_0xb951('0x68')](_0x3fc1dd));delete _0x3fc1dd[_0xb951('0x26')];if(_0x2154e4===0x191){_0x2154e4=0x190;}_0xf277ad[_0xb951('0x17')](_0x2154e4)[_0xb951('0x27')](_0x1e095a['query'][_0xb951('0x73')]?{'message':'Wrong\x20credentials','statusCode':_0x3fc1dd[_0xb951('0x74')]}:_0x3fc1dd);});}else{var _0x27ef35=0x1f4;_0xf277ad[_0xb951('0x17')](_0x27ef35)[_0xb951('0x27')]({'message':'Wrong\x20credentials','statusCode':0x190});}});}; \ No newline at end of file +var _0x4fde=['%s%s','Calls','values','module_fields','remove','includes','label','value','test','getFields,\x20%s,\x20%s,\x20%s','getFields','Wrong\x20credentials','statusCode','eml-format','rimraf','fast-json-patch','request-promise','moment','mustache','path','to-csv','ejs','fs-extra','lodash','squel','crypto','papaparse','ioredis','../../components/auth/service','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','../../components/integrations/configuration','end','status','json','undefined','offset','apply','reject','save','then','sendStatus','error','stack','name','send','index','map','fieldName','type','key','model','query','keys','filters','intersection','fields','attributes','hasOwnProperty','limit','order','sort','where','pick','merge','VIRTUAL','options','SugarcrmAccount','count','includeAll','findAll','rows','catch','show','params','rawAttributes','length','include','find','create','body','destroy','getConfigurations','findOne','SugarcrmConfiguration','nolimit','addConfiguration','AccountId','channel','Descriptions','getDescriptions','SugarcrmField','Subjects','assigned_user_id','created_by','description','date_start','parent_id','parent_type','direction','password','remoteUri','slice','substring','lastIndexOf','POST','format','/service/v4_1/rest.php','login','JSON','stringify','PLAIN','xCALLY\x20Motion\x20Integration','Invalid\x20Login'];(function(_0x2d3867,_0x4faf88){var _0xc76525=function(_0x595e6e){while(--_0x595e6e){_0x2d3867['push'](_0x2d3867['shift']());}};_0xc76525(++_0x4faf88);}(_0x4fde,0xfb));var _0xe4fd=function(_0x256b72,_0x340985){_0x256b72=_0x256b72-0x0;var _0x2183e3=_0x4fde[_0x256b72];return _0x2183e3;};'use strict';var emlformat=require(_0xe4fd('0x0'));var rimraf=require(_0xe4fd('0x1'));var zipdir=require('zip-dir');var jsonpatch=require(_0xe4fd('0x2'));var rp=require(_0xe4fd('0x3'));var moment=require(_0xe4fd('0x4'));var BPromise=require('bluebird');var Mustache=require(_0xe4fd('0x5'));var util=require('util');var path=require(_0xe4fd('0x6'));var sox=require('sox');var csv=require(_0xe4fd('0x7'));var ejs=require(_0xe4fd('0x8'));var fs=require('fs');var fs_extra=require(_0xe4fd('0x9'));var _=require(_0xe4fd('0xa'));var squel=require(_0xe4fd('0xb'));var crypto=require(_0xe4fd('0xc'));var jsforce=require('jsforce');var deskjs=require('desk.js');var toCsv=require(_0xe4fd('0x7'));var querystring=require('querystring');var Papa=require(_0xe4fd('0xd'));var Redis=require(_0xe4fd('0xe'));var authService=require(_0xe4fd('0xf'));var qs=require('../../components/parsers/qs');var as=require(_0xe4fd('0x10'));var hardwareService=require(_0xe4fd('0x11'));var logger=require(_0xe4fd('0x12'))('api');var utils=require(_0xe4fd('0x13'));var config=require(_0xe4fd('0x14'));var licenseUtil=require(_0xe4fd('0x15'));var db=require(_0xe4fd('0x16'))['db'];var integrations=require(_0xe4fd('0x17'));function respondWithStatusCode(_0x1390b6,_0x15148d){_0x15148d=_0x15148d||0xcc;return function(_0x5702a5){if(_0x5702a5){return _0x1390b6['sendStatus'](_0x15148d);}return _0x1390b6['status'](_0x15148d)[_0xe4fd('0x18')]();};}function respondWithResult(_0x42e80f,_0x43816a){_0x43816a=_0x43816a||0xc8;return function(_0x1dbaa8){if(_0x1dbaa8){return _0x42e80f[_0xe4fd('0x19')](_0x43816a)[_0xe4fd('0x1a')](_0x1dbaa8);}};}function respondWithFilteredResult(_0x476ac7,_0x39b672){return function(_0x32a51d){if(_0x32a51d){var _0x4f9396=typeof _0x39b672['offset']===_0xe4fd('0x1b')&&typeof _0x39b672['limit']==='undefined';var _0x58c8b4=_0x32a51d['count'];var _0x43826d=_0x4f9396?0x0:_0x39b672[_0xe4fd('0x1c')];var _0x5baeb3=_0x4f9396?_0x32a51d['count']:_0x39b672[_0xe4fd('0x1c')]+_0x39b672['limit'];var _0x3a32a2;if(_0x5baeb3>=_0x58c8b4){_0x5baeb3=_0x58c8b4;_0x3a32a2=0xc8;}else{_0x3a32a2=0xce;}_0x476ac7[_0xe4fd('0x19')](_0x3a32a2);return _0x476ac7['set']('Content-Range',_0x43826d+'-'+_0x5baeb3+'/'+_0x58c8b4)[_0xe4fd('0x1a')](_0x32a51d);}return null;};}function patchUpdates(_0x4b7620){return function(_0x404ade){try{jsonpatch[_0xe4fd('0x1d')](_0x404ade,_0x4b7620,!![]);}catch(_0x50c5a4){return BPromise[_0xe4fd('0x1e')](_0x50c5a4);}return _0x404ade[_0xe4fd('0x1f')]();};}function saveUpdates(_0x513a5a,_0x40d633){return function(_0x423109){if(_0x423109){return _0x423109['update'](_0x513a5a)[_0xe4fd('0x20')](function(_0xd792e6){return _0xd792e6;});}return null;};}function removeEntity(_0x19d94f,_0x3a14e1){return function(_0x4018a5){if(_0x4018a5){return _0x4018a5['destroy']()[_0xe4fd('0x20')](function(){_0x19d94f['status'](0xcc)[_0xe4fd('0x18')]();});}};}function handleEntityNotFound(_0x41ff28,_0x1c8bb3){return function(_0x5682d2){if(!_0x5682d2){_0x41ff28[_0xe4fd('0x21')](0x194);}return _0x5682d2;};}function handleError(_0x162daf,_0xad2cdd){_0xad2cdd=_0xad2cdd||0x1f4;return function(_0x54d299){logger[_0xe4fd('0x22')](_0x54d299[_0xe4fd('0x23')]);if(_0x54d299[_0xe4fd('0x24')]){delete _0x54d299[_0xe4fd('0x24')];}_0x162daf[_0xe4fd('0x19')](_0xad2cdd)[_0xe4fd('0x25')](_0x54d299);};}exports[_0xe4fd('0x26')]=function(_0x3169e6,_0x36277a){var _0x2859ab={},_0x1d4afd={},_0x24ab0b={'count':0x0,'rows':[]};var _0x21c2a2=_[_0xe4fd('0x27')](db['SugarcrmAccount']['rawAttributes'],function(_0x5ee1fd){return{'name':_0x5ee1fd[_0xe4fd('0x28')],'type':_0x5ee1fd[_0xe4fd('0x29')][_0xe4fd('0x2a')]};});_0x1d4afd[_0xe4fd('0x2b')]=_[_0xe4fd('0x27')](_0x21c2a2,_0xe4fd('0x24'));_0x1d4afd[_0xe4fd('0x2c')]=_[_0xe4fd('0x2d')](_0x3169e6[_0xe4fd('0x2c')]);_0x1d4afd[_0xe4fd('0x2e')]=_[_0xe4fd('0x2f')](_0x1d4afd[_0xe4fd('0x2b')],_0x1d4afd[_0xe4fd('0x2c')]);_0x2859ab['attributes']=_[_0xe4fd('0x2f')](_0x1d4afd[_0xe4fd('0x2b')],qs[_0xe4fd('0x30')](_0x3169e6[_0xe4fd('0x2c')][_0xe4fd('0x30')]));_0x2859ab[_0xe4fd('0x31')]=_0x2859ab['attributes']['length']?_0x2859ab[_0xe4fd('0x31')]:_0x1d4afd['model'];if(!_0x3169e6[_0xe4fd('0x2c')][_0xe4fd('0x32')]('nolimit')){_0x2859ab['limit']=qs[_0xe4fd('0x33')](_0x3169e6[_0xe4fd('0x2c')][_0xe4fd('0x33')]);_0x2859ab[_0xe4fd('0x1c')]=qs['offset'](_0x3169e6[_0xe4fd('0x2c')][_0xe4fd('0x1c')]);}_0x2859ab[_0xe4fd('0x34')]=qs['sort'](_0x3169e6[_0xe4fd('0x2c')][_0xe4fd('0x35')]);_0x2859ab[_0xe4fd('0x36')]=qs[_0xe4fd('0x2e')](_[_0xe4fd('0x37')](_0x3169e6[_0xe4fd('0x2c')],_0x1d4afd['filters']),_0x21c2a2);if(_0x3169e6[_0xe4fd('0x2c')]['filter']){_0x2859ab[_0xe4fd('0x36')]=_[_0xe4fd('0x38')](_0x2859ab[_0xe4fd('0x36')],{'$or':_[_0xe4fd('0x27')](_0x21c2a2,function(_0x5a1711){if(_0x5a1711[_0xe4fd('0x29')]!==_0xe4fd('0x39')){var _0x1ed95d={};_0x1ed95d[_0x5a1711[_0xe4fd('0x24')]]={'$like':'%'+_0x3169e6[_0xe4fd('0x2c')]['filter']+'%'};return _0x1ed95d;}})});}_0x2859ab=_['merge']({},_0x2859ab,_0x3169e6[_0xe4fd('0x3a')]);var _0x3f15cf={'where':_0x2859ab[_0xe4fd('0x36')]};return db[_0xe4fd('0x3b')][_0xe4fd('0x3c')](_0x3f15cf)['then'](function(_0x258466){_0x24ab0b[_0xe4fd('0x3c')]=_0x258466;if(_0x3169e6[_0xe4fd('0x2c')][_0xe4fd('0x3d')]){_0x2859ab['include']=[{'all':!![]}];}return db[_0xe4fd('0x3b')][_0xe4fd('0x3e')](_0x2859ab);})[_0xe4fd('0x20')](function(_0x2e7445){_0x24ab0b[_0xe4fd('0x3f')]=_0x2e7445;return _0x24ab0b;})['then'](respondWithFilteredResult(_0x36277a,_0x2859ab))[_0xe4fd('0x40')](handleError(_0x36277a,null));};exports[_0xe4fd('0x41')]=function(_0x54af09,_0x3815ac){var _0x5acf5a={'raw':![],'where':{'id':_0x54af09[_0xe4fd('0x42')]['id']}},_0x563e73={};_0x563e73['model']=_[_0xe4fd('0x2d')](db[_0xe4fd('0x3b')][_0xe4fd('0x43')]);_0x563e73['query']=_[_0xe4fd('0x2d')](_0x54af09[_0xe4fd('0x2c')]);_0x563e73[_0xe4fd('0x2e')]=_[_0xe4fd('0x2f')](_0x563e73['model'],_0x563e73[_0xe4fd('0x2c')]);_0x5acf5a[_0xe4fd('0x31')]=_[_0xe4fd('0x2f')](_0x563e73['model'],qs[_0xe4fd('0x30')](_0x54af09[_0xe4fd('0x2c')][_0xe4fd('0x30')]));_0x5acf5a[_0xe4fd('0x31')]=_0x5acf5a[_0xe4fd('0x31')][_0xe4fd('0x44')]?_0x5acf5a[_0xe4fd('0x31')]:_0x563e73[_0xe4fd('0x2b')];if(_0x54af09['query'][_0xe4fd('0x3d')]){_0x5acf5a[_0xe4fd('0x45')]=[{'all':!![]}];}_0x5acf5a=_[_0xe4fd('0x38')]({},_0x5acf5a,_0x54af09['options']);return db['SugarcrmAccount'][_0xe4fd('0x46')](_0x5acf5a)[_0xe4fd('0x20')](handleEntityNotFound(_0x3815ac,null))[_0xe4fd('0x20')](respondWithResult(_0x3815ac,null))['catch'](handleError(_0x3815ac,null));};exports[_0xe4fd('0x47')]=function(_0x86179,_0x4947a2){return db[_0xe4fd('0x3b')][_0xe4fd('0x47')](_0x86179[_0xe4fd('0x48')],{})[_0xe4fd('0x20')](respondWithResult(_0x4947a2,0xc9))['catch'](handleError(_0x4947a2,null));};exports['update']=function(_0x4f3033,_0x14452b){if(_0x4f3033['body']['id']){delete _0x4f3033[_0xe4fd('0x48')]['id'];}return db[_0xe4fd('0x3b')][_0xe4fd('0x46')]({'where':{'id':_0x4f3033[_0xe4fd('0x42')]['id']}})['then'](handleEntityNotFound(_0x14452b,null))[_0xe4fd('0x20')](saveUpdates(_0x4f3033['body'],null))['then'](respondWithResult(_0x14452b,null))[_0xe4fd('0x40')](handleError(_0x14452b,null));};exports[_0xe4fd('0x49')]=function(_0x20d56b,_0x23b924){return db[_0xe4fd('0x3b')][_0xe4fd('0x46')]({'where':{'id':_0x20d56b[_0xe4fd('0x42')]['id']}})[_0xe4fd('0x20')](handleEntityNotFound(_0x23b924,null))[_0xe4fd('0x20')](removeEntity(_0x23b924,null))['catch'](handleError(_0x23b924,null));};exports[_0xe4fd('0x4a')]=function(_0x168fe1,_0x17ad7c,_0x1839c7){var _0x417bb4={};var _0xb3e2f1={};var _0x14bc50;var _0x51f6e5;return db[_0xe4fd('0x3b')][_0xe4fd('0x4b')]({'where':{'id':_0x168fe1[_0xe4fd('0x42')]['id']}})[_0xe4fd('0x20')](handleEntityNotFound(_0x17ad7c,null))[_0xe4fd('0x20')](function(_0x2b7311){if(_0x2b7311){_0x14bc50=_0x2b7311;_0xb3e2f1[_0xe4fd('0x2b')]=_[_0xe4fd('0x2d')](db[_0xe4fd('0x4c')][_0xe4fd('0x43')]);_0xb3e2f1[_0xe4fd('0x2c')]=_[_0xe4fd('0x2d')](_0x168fe1[_0xe4fd('0x2c')]);_0xb3e2f1[_0xe4fd('0x2e')]=_[_0xe4fd('0x2f')](_0xb3e2f1[_0xe4fd('0x2b')],_0xb3e2f1[_0xe4fd('0x2c')]);_0x417bb4[_0xe4fd('0x31')]=_[_0xe4fd('0x2f')](_0xb3e2f1['model'],qs[_0xe4fd('0x30')](_0x168fe1[_0xe4fd('0x2c')][_0xe4fd('0x30')]));_0x417bb4[_0xe4fd('0x31')]=_0x417bb4['attributes'][_0xe4fd('0x44')]?_0x417bb4[_0xe4fd('0x31')]:_0xb3e2f1[_0xe4fd('0x2b')];_0x417bb4[_0xe4fd('0x34')]=qs[_0xe4fd('0x35')](_0x168fe1[_0xe4fd('0x2c')][_0xe4fd('0x35')]);_0x417bb4[_0xe4fd('0x36')]=qs['filters'](_['pick'](_0x168fe1['query'],_0xb3e2f1[_0xe4fd('0x2e')]));if(_0x168fe1[_0xe4fd('0x2c')]['filter']){_0x417bb4[_0xe4fd('0x36')]=_['merge'](_0x417bb4[_0xe4fd('0x36')],{'$or':_[_0xe4fd('0x27')](_0x417bb4[_0xe4fd('0x31')],function(_0x365642){var _0x1e2df9={};_0x1e2df9[_0x365642]={'$like':'%'+_0x168fe1[_0xe4fd('0x2c')]['filter']+'%'};return _0x1e2df9;})});}_0x417bb4=_[_0xe4fd('0x38')]({},_0x417bb4,_0x168fe1[_0xe4fd('0x3a')]);return _0x14bc50[_0xe4fd('0x4a')](_0x417bb4);}})['then'](function(_0x449ed6){if(_0x449ed6){_0x51f6e5=_0x449ed6[_0xe4fd('0x44')];if(!_0x168fe1[_0xe4fd('0x2c')]['hasOwnProperty'](_0xe4fd('0x4d'))){_0x417bb4[_0xe4fd('0x33')]=qs[_0xe4fd('0x33')](_0x168fe1[_0xe4fd('0x2c')][_0xe4fd('0x33')]);_0x417bb4[_0xe4fd('0x1c')]=qs[_0xe4fd('0x1c')](_0x168fe1[_0xe4fd('0x2c')][_0xe4fd('0x1c')]);}return _0x14bc50[_0xe4fd('0x4a')](_0x417bb4);}})[_0xe4fd('0x20')](function(_0xddb331){if(_0xddb331){return _0xddb331?{'count':_0x51f6e5,'rows':_0xddb331}:null;}})[_0xe4fd('0x20')](respondWithResult(_0x17ad7c,null))[_0xe4fd('0x40')](handleError(_0x17ad7c,null));};exports[_0xe4fd('0x4e')]=function(_0x71466f,_0x13ebff,_0xf59c6f){if(_0x71466f['body']['id']){delete _0x71466f[_0xe4fd('0x48')]['id'];}return db[_0xe4fd('0x3b')][_0xe4fd('0x4b')]({'where':{'id':_0x71466f['params']['id']}})[_0xe4fd('0x20')](handleEntityNotFound(_0x13ebff,null))['then'](function(_0x38a8cb){if(_0x38a8cb){_0x71466f[_0xe4fd('0x48')][_0xe4fd('0x4f')]=_0x38a8cb['id'];_0x71466f[_0xe4fd('0x48')]['Subjects']=integrations['getSubjects'](_0x71466f['body'][_0xe4fd('0x50')],_0x71466f[_0xe4fd('0x48')]['type']);_0x71466f[_0xe4fd('0x48')][_0xe4fd('0x51')]=integrations[_0xe4fd('0x52')](_0x71466f[_0xe4fd('0x48')][_0xe4fd('0x50')],_0x71466f[_0xe4fd('0x48')][_0xe4fd('0x29')]);return db[_0xe4fd('0x4c')][_0xe4fd('0x47')](_0x71466f[_0xe4fd('0x48')],{'include':[{'model':db[_0xe4fd('0x53')],'as':_0xe4fd('0x54')},{'model':db[_0xe4fd('0x53')],'as':_0xe4fd('0x51')}]});}return null;})['then'](respondWithResult(_0x13ebff,null))[_0xe4fd('0x40')](handleError(_0x13ebff,null));};exports['getFields']=function(_0x1854b4,_0x2c32d0,_0x50e4f1){var _0x42c382='';var _0x5ec290=['id','name',_0xe4fd('0x55'),_0xe4fd('0x56'),_0xe4fd('0x57'),_0xe4fd('0x58'),'duration_hours','duration_minutes',_0xe4fd('0x59'),_0xe4fd('0x5a'),'parent_name',_0xe4fd('0x5b')];return db[_0xe4fd('0x3b')]['findOne']({'where':{'id':_0x1854b4[_0xe4fd('0x42')]['id']},'attributes':['id','username',_0xe4fd('0x5c'),_0xe4fd('0x5d')]})[_0xe4fd('0x20')](handleEntityNotFound(_0x2c32d0,null))[_0xe4fd('0x20')](function(_0x443b8c){if(_0x443b8c){_0x42c382=_0x443b8c[_0xe4fd('0x5d')];var _0x4b974e=_0x42c382[_0xe4fd('0x5e')](-0x1);if(_0x4b974e==='/'){_0x42c382=_0x42c382[_0xe4fd('0x5f')](0x0,_0x42c382[_0xe4fd('0x60')](_0x4b974e));}return rp({'method':_0xe4fd('0x61'),'uri':util[_0xe4fd('0x62')]('%s%s',_0x42c382,_0xe4fd('0x63')),'json':!![],'form':{'method':_0xe4fd('0x64'),'input_type':_0xe4fd('0x65'),'response_type':_0xe4fd('0x65'),'rest_data':JSON[_0xe4fd('0x66')]({'user_auth':{'user_name':_0x443b8c['username'],'password':_0x443b8c[_0xe4fd('0x5c')],'encryption':_0xe4fd('0x67')},'application':_0xe4fd('0x68')})}});}})[_0xe4fd('0x20')](function(_0x14f0d6){if(_0x14f0d6&&_0x14f0d6[_0xe4fd('0x24')]!==_0xe4fd('0x69')&&_0x14f0d6[_0xe4fd('0x24')]!=='Password\x20Expired'){return rp({'method':_0xe4fd('0x61'),'uri':util[_0xe4fd('0x62')](_0xe4fd('0x6a'),_0x42c382,'/service/v4_1/rest.php'),'json':!![],'form':{'method':'get_module_fields','input_type':_0xe4fd('0x65'),'response_type':_0xe4fd('0x65'),'rest_data':JSON['stringify']({'session':_0x14f0d6['id'],'module_name':_0xe4fd('0x6b')})}})[_0xe4fd('0x20')](function(_0x4125e0){if(_0x4125e0){var _0x3ba157=_[_0xe4fd('0x6c')](_0x4125e0[_0xe4fd('0x6d')]);_[_0xe4fd('0x6e')](_0x3ba157,function(_0x50631f){return _0x5ec290[_0xe4fd('0x6f')](_0x50631f[_0xe4fd('0x24')]);});return{'count':_0x3ba157['length'],'rows':_['map'](_0x3ba157,function(_0x5ac694){return{'id':_0x5ac694[_0xe4fd('0x24')],'name':_0x5ac694[_0xe4fd('0x70')],'custom':_['endsWith'](_0x5ac694[_0xe4fd('0x24')],'_c')?!![]:![],'options':_0x5ac694[_0xe4fd('0x3a')]?_[_0xe4fd('0x27')](_['values'](_0x5ac694[_0xe4fd('0x3a')]),function(_0x5a55ca){return{'name':_0x5a55ca[_0xe4fd('0x71')],'value':_0x5a55ca[_0xe4fd('0x24')]};}):[]};})};}})['then'](respondWithResult(_0x2c32d0,null))[_0xe4fd('0x40')](function(_0x35ecc0){var _0x1aa4d5=_0x1854b4[_0xe4fd('0x2c')][_0xe4fd('0x72')]?0x1f4:_0x35ecc0['statusCode']||0x1f4;logger[_0xe4fd('0x22')](_0xe4fd('0x73'),_0xe4fd('0x74'),_0x1aa4d5,JSON[_0xe4fd('0x66')](_0x35ecc0));delete _0x35ecc0[_0xe4fd('0x24')];if(_0x1aa4d5===0x191){_0x1aa4d5=0x190;}_0x2c32d0['status'](_0x1aa4d5)[_0xe4fd('0x25')](_0x1854b4['query'][_0xe4fd('0x72')]?{'message':_0xe4fd('0x75'),'statusCode':_0x35ecc0[_0xe4fd('0x76')]}:_0x35ecc0);});}else{var _0x2a1f30=0x1f4;_0x2c32d0['status'](_0x2a1f30)[_0xe4fd('0x25')]({'message':'Wrong\x20credentials','statusCode':0x190});}});}; \ No newline at end of file diff --git a/server/api/intSugarcrmAccount/intSugarcrmAccount.model.js b/server/api/intSugarcrmAccount/intSugarcrmAccount.model.js index a0d0668..ae75ad7 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 _0xa5ab=['rimraf','../../config/environment','./intSugarcrmAccount.attributes','../../components/integrations/configuration','define','SugarcrmAccount','int_sugarcrm_accounts','lodash','util','../../config/logger','moment','request-promise','path'];(function(_0x36240b,_0x29f8ef){var _0x2328bd=function(_0x48994c){while(--_0x48994c){_0x36240b['push'](_0x36240b['shift']());}};_0x2328bd(++_0x29f8ef);}(_0xa5ab,0xca));var _0xba5a=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0xa5ab[_0x3dd15e];return _0x231fd0;};'use strict';var _=require(_0xba5a('0x0'));var util=require(_0xba5a('0x1'));var logger=require(_0xba5a('0x2'))('api');var moment=require(_0xba5a('0x3'));var BPromise=require('bluebird');var rp=require(_0xba5a('0x4'));var fs=require('fs');var path=require(_0xba5a('0x5'));var rimraf=require(_0xba5a('0x6'));var config=require(_0xba5a('0x7'));var attributes=require(_0xba5a('0x8'));var integrations=require(_0xba5a('0x9'));module['exports']=function(_0x22c2b7,_0x101003){return _0x22c2b7[_0xba5a('0xa')](_0xba5a('0xb'),attributes,{'tableName':_0xba5a('0xc'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x6b9d=['exports','define','SugarcrmAccount','int_sugarcrm_accounts','lodash','util','../../config/logger','api','moment','bluebird','request-promise','path','rimraf','../../config/environment','../../components/integrations/configuration'];(function(_0x488a61,_0x3ade61){var _0x5b0906=function(_0x2f0438){while(--_0x2f0438){_0x488a61['push'](_0x488a61['shift']());}};_0x5b0906(++_0x3ade61);}(_0x6b9d,0x1e4));var _0xd6b9=function(_0x58ae8a,_0x3c619e){_0x58ae8a=_0x58ae8a-0x0;var _0x2f0b6b=_0x6b9d[_0x58ae8a];return _0x2f0b6b;};'use strict';var _=require(_0xd6b9('0x0'));var util=require(_0xd6b9('0x1'));var logger=require(_0xd6b9('0x2'))(_0xd6b9('0x3'));var moment=require(_0xd6b9('0x4'));var BPromise=require(_0xd6b9('0x5'));var rp=require(_0xd6b9('0x6'));var fs=require('fs');var path=require(_0xd6b9('0x7'));var rimraf=require(_0xd6b9('0x8'));var config=require(_0xd6b9('0x9'));var attributes=require('./intSugarcrmAccount.attributes');var integrations=require(_0xd6b9('0xa'));module[_0xd6b9('0xb')]=function(_0x394962,_0x1b4f81){return _0x394962[_0xd6b9('0xc')](_0xd6b9('0xd'),attributes,{'tableName':_0xd6b9('0xe'),'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 5999b8b..061563a 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 _0x0c28=['client','http','request','then','info','SugarcrmAccount,\x20%s,\x20%s','request\x20sent','debug','SugarcrmAccount,\x20%s,\x20%s,\x20%s','stringify','error','code','message','result','catch','GetSugarcrmAccount','findAll','options','raw','where','attributes','limit','include','map','model','SugarcrmAccount','ShowSugarcrmAccount','lodash','moment','randomstring','ioredis','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise'];(function(_0x4250cf,_0x1166c9){var _0x59678e=function(_0x2d3fef){while(--_0x2d3fef){_0x4250cf['push'](_0x4250cf['shift']());}};_0x59678e(++_0x1166c9);}(_0x0c28,0xab));var _0x80c2=function(_0x4c00f3,_0x343f94){_0x4c00f3=_0x4c00f3-0x0;var _0x5a7b6f=_0x0c28[_0x4c00f3];return _0x5a7b6f;};'use strict';var _=require(_0x80c2('0x0'));var util=require('util');var moment=require(_0x80c2('0x1'));var BPromise=require('bluebird');var rs=require(_0x80c2('0x2'));var fs=require('fs');var Redis=require(_0x80c2('0x3'));var db=require('../../mysqldb')['db'];var utils=require(_0x80c2('0x4'));var logger=require(_0x80c2('0x5'))(_0x80c2('0x6'));var config=require(_0x80c2('0x7'));var jayson=require(_0x80c2('0x8'));var client=jayson[_0x80c2('0x9')][_0x80c2('0xa')]({'port':0x232a});function respondWithRpcPromise(_0x47f715,_0x942aff,_0x413cdc){return new BPromise(function(_0x2e949c,_0x4f30a3){return client[_0x80c2('0xb')](_0x47f715,_0x413cdc)[_0x80c2('0xc')](function(_0x399662){logger[_0x80c2('0xd')](_0x80c2('0xe'),_0x942aff,_0x80c2('0xf'));logger[_0x80c2('0x10')](_0x80c2('0x11'),_0x942aff,_0x80c2('0xf'),JSON[_0x80c2('0x12')](_0x399662));if(_0x399662[_0x80c2('0x13')]){if(_0x399662[_0x80c2('0x13')][_0x80c2('0x14')]===0x1f4){logger[_0x80c2('0x13')](_0x80c2('0xe'),_0x942aff,_0x399662[_0x80c2('0x13')][_0x80c2('0x15')]);return _0x4f30a3(_0x399662[_0x80c2('0x13')][_0x80c2('0x15')]);}logger[_0x80c2('0x13')](_0x80c2('0xe'),_0x942aff,_0x399662[_0x80c2('0x13')][_0x80c2('0x15')]);return _0x2e949c(_0x399662[_0x80c2('0x13')][_0x80c2('0x15')]);}else{logger[_0x80c2('0xd')](_0x80c2('0xe'),_0x942aff,'request\x20sent');_0x2e949c(_0x399662[_0x80c2('0x16')][_0x80c2('0x15')]);}})[_0x80c2('0x17')](function(_0x3f8fbb){logger[_0x80c2('0x13')](_0x80c2('0xe'),_0x942aff,_0x3f8fbb);_0x4f30a3(_0x3f8fbb);});});}exports[_0x80c2('0x18')]=function(_0x3a6909){var _0x44cb00=this;return new Promise(function(_0x5b8357,_0x42c62c){return db['SugarcrmAccount'][_0x80c2('0x19')]({'raw':_0x3a6909[_0x80c2('0x1a')]?_0x3a6909['options'][_0x80c2('0x1b')]===undefined?!![]:![]:!![],'where':_0x3a6909['options']?_0x3a6909[_0x80c2('0x1a')][_0x80c2('0x1c')]||null:null,'attributes':_0x3a6909[_0x80c2('0x1a')]?_0x3a6909[_0x80c2('0x1a')][_0x80c2('0x1d')]||null:null,'limit':_0x3a6909[_0x80c2('0x1a')]?_0x3a6909[_0x80c2('0x1a')][_0x80c2('0x1e')]||null:null,'include':_0x3a6909[_0x80c2('0x1a')]?_0x3a6909[_0x80c2('0x1a')][_0x80c2('0x1f')]?_[_0x80c2('0x20')](_0x3a6909[_0x80c2('0x1a')]['include'],function(_0x5d6119){return{'model':db[_0x5d6119[_0x80c2('0x21')]],'as':_0x5d6119['as'],'attributes':_0x5d6119[_0x80c2('0x1d')],'include':_0x5d6119[_0x80c2('0x1f')]?_[_0x80c2('0x20')](_0x5d6119[_0x80c2('0x1f')],function(_0x359936){return{'model':db[_0x359936[_0x80c2('0x21')]],'as':_0x359936['as'],'attributes':_0x359936[_0x80c2('0x1d')],'include':_0x359936[_0x80c2('0x1f')]?_['map'](_0x359936[_0x80c2('0x1f')],function(_0x5c390e){return{'model':db[_0x5c390e[_0x80c2('0x21')]],'as':_0x5c390e['as'],'attributes':_0x5c390e[_0x80c2('0x1d')]};}):[]};}):[]};}):[]:[]})[_0x80c2('0xc')](function(_0xb92b9b){logger[_0x80c2('0xd')]('GetSugarcrmAccount',_0x3a6909);logger[_0x80c2('0x10')]('GetSugarcrmAccount',_0x3a6909,JSON[_0x80c2('0x12')](_0xb92b9b));_0x5b8357(_0xb92b9b);})['catch'](function(_0xaab678){logger[_0x80c2('0x13')]('GetSugarcrmAccount',_0xaab678[_0x80c2('0x15')],_0x3a6909);_0x42c62c(_0x44cb00[_0x80c2('0x13')](0x1f4,_0xaab678[_0x80c2('0x15')]));});});};exports['ShowSugarcrmAccount']=function(_0x2618a9){var _0x2da5c4=this;return new Promise(function(_0x4db44a,_0x47b2cd){return db[_0x80c2('0x22')]['find']({'raw':_0x2618a9[_0x80c2('0x1a')]?_0x2618a9[_0x80c2('0x1a')][_0x80c2('0x1b')]===undefined?!![]:![]:!![],'where':_0x2618a9[_0x80c2('0x1a')]?_0x2618a9[_0x80c2('0x1a')][_0x80c2('0x1c')]||null:null,'attributes':_0x2618a9[_0x80c2('0x1a')]?_0x2618a9[_0x80c2('0x1a')][_0x80c2('0x1d')]||null:null,'include':_0x2618a9[_0x80c2('0x1a')]?_0x2618a9[_0x80c2('0x1a')][_0x80c2('0x1f')]?_['map'](_0x2618a9[_0x80c2('0x1a')][_0x80c2('0x1f')],function(_0x487b27){return{'model':db[_0x487b27[_0x80c2('0x21')]],'as':_0x487b27['as'],'attributes':_0x487b27[_0x80c2('0x1d')],'include':_0x487b27[_0x80c2('0x1f')]?_[_0x80c2('0x20')](_0x487b27[_0x80c2('0x1f')],function(_0x561177){return{'model':db[_0x561177[_0x80c2('0x21')]],'as':_0x561177['as'],'attributes':_0x561177[_0x80c2('0x1d')],'include':_0x561177['include']?_['map'](_0x561177['include'],function(_0xa0c8f9){return{'model':db[_0xa0c8f9[_0x80c2('0x21')]],'as':_0xa0c8f9['as'],'attributes':_0xa0c8f9[_0x80c2('0x1d')]};}):[]};}):[]};}):[]:[]})[_0x80c2('0xc')](function(_0x27debc){logger[_0x80c2('0xd')](_0x80c2('0x23'),_0x2618a9);logger[_0x80c2('0x10')](_0x80c2('0x23'),_0x2618a9,JSON[_0x80c2('0x12')](_0x27debc));_0x4db44a(_0x27debc);})[_0x80c2('0x17')](function(_0x1c4b6a){logger[_0x80c2('0x13')](_0x80c2('0x23'),_0x1c4b6a[_0x80c2('0x15')],_0x2618a9);_0x47b2cd(_0x2da5c4[_0x80c2('0x13')](0x1f4,_0x1c4b6a[_0x80c2('0x15')]));});});}; \ No newline at end of file +var _0x6242=['findAll','options','raw','where','attributes','map','include','debug','ShowSugarcrmAccount','find','model','util','moment','bluebird','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','client','request','then','info','SugarcrmAccount,\x20%s,\x20%s','request\x20sent','SugarcrmAccount,\x20%s,\x20%s,\x20%s','stringify','error','code','message','catch','SugarcrmAccount'];(function(_0x3dd15e,_0x1f0015){var _0x231fd0=function(_0x4f680a){while(--_0x4f680a){_0x3dd15e['push'](_0x3dd15e['shift']());}};_0x231fd0(++_0x1f0015);}(_0x6242,0x1b8));var _0x2624=function(_0x460dbf,_0xcf81c7){_0x460dbf=_0x460dbf-0x0;var _0x282fe3=_0x6242[_0x460dbf];return _0x282fe3;};'use strict';var _=require('lodash');var util=require(_0x2624('0x0'));var moment=require(_0x2624('0x1'));var BPromise=require(_0x2624('0x2'));var rs=require('randomstring');var fs=require('fs');var Redis=require('ioredis');var db=require(_0x2624('0x3'))['db'];var utils=require(_0x2624('0x4'));var logger=require(_0x2624('0x5'))(_0x2624('0x6'));var config=require(_0x2624('0x7'));var jayson=require(_0x2624('0x8'));var client=jayson[_0x2624('0x9')]['http']({'port':0x232a});function respondWithRpcPromise(_0x3da13f,_0x58b51c,_0x3c9202){return new BPromise(function(_0x1effd4,_0x1a3cc1){return client[_0x2624('0xa')](_0x3da13f,_0x3c9202)[_0x2624('0xb')](function(_0x3bcddf){logger[_0x2624('0xc')](_0x2624('0xd'),_0x58b51c,_0x2624('0xe'));logger['debug'](_0x2624('0xf'),_0x58b51c,_0x2624('0xe'),JSON[_0x2624('0x10')](_0x3bcddf));if(_0x3bcddf['error']){if(_0x3bcddf[_0x2624('0x11')][_0x2624('0x12')]===0x1f4){logger[_0x2624('0x11')]('SugarcrmAccount,\x20%s,\x20%s',_0x58b51c,_0x3bcddf[_0x2624('0x11')][_0x2624('0x13')]);return _0x1a3cc1(_0x3bcddf[_0x2624('0x11')][_0x2624('0x13')]);}logger['error'](_0x2624('0xd'),_0x58b51c,_0x3bcddf[_0x2624('0x11')][_0x2624('0x13')]);return _0x1effd4(_0x3bcddf[_0x2624('0x11')]['message']);}else{logger[_0x2624('0xc')](_0x2624('0xd'),_0x58b51c,'request\x20sent');_0x1effd4(_0x3bcddf['result']['message']);}})[_0x2624('0x14')](function(_0x3536e9){logger['error'](_0x2624('0xd'),_0x58b51c,_0x3536e9);_0x1a3cc1(_0x3536e9);});});}exports['GetSugarcrmAccount']=function(_0xb9fc4a){var _0x57f747=this;return new Promise(function(_0x1d5b97,_0x142b5b){return db[_0x2624('0x15')][_0x2624('0x16')]({'raw':_0xb9fc4a['options']?_0xb9fc4a[_0x2624('0x17')][_0x2624('0x18')]===undefined?!![]:![]:!![],'where':_0xb9fc4a[_0x2624('0x17')]?_0xb9fc4a[_0x2624('0x17')][_0x2624('0x19')]||null:null,'attributes':_0xb9fc4a[_0x2624('0x17')]?_0xb9fc4a[_0x2624('0x17')][_0x2624('0x1a')]||null:null,'limit':_0xb9fc4a[_0x2624('0x17')]?_0xb9fc4a['options']['limit']||null:null,'include':_0xb9fc4a[_0x2624('0x17')]?_0xb9fc4a[_0x2624('0x17')]['include']?_[_0x2624('0x1b')](_0xb9fc4a[_0x2624('0x17')][_0x2624('0x1c')],function(_0x4fcfa4){return{'model':db[_0x4fcfa4['model']],'as':_0x4fcfa4['as'],'attributes':_0x4fcfa4[_0x2624('0x1a')],'include':_0x4fcfa4['include']?_[_0x2624('0x1b')](_0x4fcfa4[_0x2624('0x1c')],function(_0xaf7161){return{'model':db[_0xaf7161['model']],'as':_0xaf7161['as'],'attributes':_0xaf7161[_0x2624('0x1a')],'include':_0xaf7161[_0x2624('0x1c')]?_[_0x2624('0x1b')](_0xaf7161[_0x2624('0x1c')],function(_0x565c18){return{'model':db[_0x565c18['model']],'as':_0x565c18['as'],'attributes':_0x565c18['attributes']};}):[]};}):[]};}):[]:[]})[_0x2624('0xb')](function(_0x4bfcd6){logger[_0x2624('0xc')]('GetSugarcrmAccount',_0xb9fc4a);logger[_0x2624('0x1d')]('GetSugarcrmAccount',_0xb9fc4a,JSON['stringify'](_0x4bfcd6));_0x1d5b97(_0x4bfcd6);})[_0x2624('0x14')](function(_0x441e25){logger[_0x2624('0x11')]('GetSugarcrmAccount',_0x441e25[_0x2624('0x13')],_0xb9fc4a);_0x142b5b(_0x57f747['error'](0x1f4,_0x441e25['message']));});});};exports[_0x2624('0x1e')]=function(_0x39aea4){var _0x3eafa6=this;return new Promise(function(_0x5dc5b5,_0x2d9273){return db[_0x2624('0x15')][_0x2624('0x1f')]({'raw':_0x39aea4[_0x2624('0x17')]?_0x39aea4[_0x2624('0x17')][_0x2624('0x18')]===undefined?!![]:![]:!![],'where':_0x39aea4[_0x2624('0x17')]?_0x39aea4[_0x2624('0x17')]['where']||null:null,'attributes':_0x39aea4['options']?_0x39aea4[_0x2624('0x17')][_0x2624('0x1a')]||null:null,'include':_0x39aea4['options']?_0x39aea4[_0x2624('0x17')][_0x2624('0x1c')]?_[_0x2624('0x1b')](_0x39aea4[_0x2624('0x17')][_0x2624('0x1c')],function(_0x14f48f){return{'model':db[_0x14f48f[_0x2624('0x20')]],'as':_0x14f48f['as'],'attributes':_0x14f48f[_0x2624('0x1a')],'include':_0x14f48f[_0x2624('0x1c')]?_[_0x2624('0x1b')](_0x14f48f[_0x2624('0x1c')],function(_0x55c9ec){return{'model':db[_0x55c9ec[_0x2624('0x20')]],'as':_0x55c9ec['as'],'attributes':_0x55c9ec[_0x2624('0x1a')],'include':_0x55c9ec[_0x2624('0x1c')]?_['map'](_0x55c9ec[_0x2624('0x1c')],function(_0x4c02a9){return{'model':db[_0x4c02a9['model']],'as':_0x4c02a9['as'],'attributes':_0x4c02a9['attributes']};}):[]};}):[]};}):[]:[]})[_0x2624('0xb')](function(_0x2e811f){logger[_0x2624('0xc')](_0x2624('0x1e'),_0x39aea4);logger['debug'](_0x2624('0x1e'),_0x39aea4,JSON[_0x2624('0x10')](_0x2e811f));_0x5dc5b5(_0x2e811f);})[_0x2624('0x14')](function(_0x3d58d9){logger['error'](_0x2624('0x1e'),_0x3d58d9[_0x2624('0x13')],_0x39aea4);_0x2d9273(_0x3eafa6[_0x2624('0x11')](0x1f4,_0x3d58d9['message']));});});}; \ No newline at end of file diff --git a/server/api/intSugarcrmConfiguration/index.js b/server/api/intSugarcrmConfiguration/index.js index 720c530..dba5020 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 _0x2ba1=['../../components/interaction/service','../../config/environment','get','isAuthenticated','index','/:id','show','getFields','/:id/subjects','getSubjects','/:id/descriptions','getDescriptions','post','create','put','update','delete','destroy','exports','multer','util','path','connect-timeout','Router','fs-extra'];(function(_0x4fab5b,_0x37efbb){var _0x1be212=function(_0x152634){while(--_0x152634){_0x4fab5b['push'](_0x4fab5b['shift']());}};_0x1be212(++_0x37efbb);}(_0x2ba1,0x77));var _0x12ba=function(_0x5015c8,_0x1b14a4){_0x5015c8=_0x5015c8-0x0;var _0x54121f=_0x2ba1[_0x5015c8];return _0x54121f;};'use strict';var multer=require(_0x12ba('0x0'));var util=require(_0x12ba('0x1'));var path=require(_0x12ba('0x2'));var timeout=require(_0x12ba('0x3'));var express=require('express');var router=express[_0x12ba('0x4')]();var fs_extra=require(_0x12ba('0x5'));var auth=require('../../components/auth/service');var interaction=require(_0x12ba('0x6'));var config=require(_0x12ba('0x7'));var controller=require('./intSugarcrmConfiguration.controller');router[_0x12ba('0x8')]('/',auth[_0x12ba('0x9')](),controller[_0x12ba('0xa')]);router[_0x12ba('0x8')](_0x12ba('0xb'),auth['isAuthenticated'](),controller[_0x12ba('0xc')]);router[_0x12ba('0x8')]('/:id/fields',auth[_0x12ba('0x9')](),controller[_0x12ba('0xd')]);router[_0x12ba('0x8')](_0x12ba('0xe'),auth['isAuthenticated'](),controller[_0x12ba('0xf')]);router[_0x12ba('0x8')](_0x12ba('0x10'),auth[_0x12ba('0x9')](),controller[_0x12ba('0x11')]);router[_0x12ba('0x12')]('/',auth[_0x12ba('0x9')](),controller[_0x12ba('0x13')]);router[_0x12ba('0x14')](_0x12ba('0xb'),auth[_0x12ba('0x9')](),controller[_0x12ba('0x15')]);router[_0x12ba('0x16')](_0x12ba('0xb'),auth[_0x12ba('0x9')](),controller[_0x12ba('0x17')]);module[_0x12ba('0x18')]=router; \ No newline at end of file +var _0x9660=['express','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','./intSugarcrmConfiguration.controller','isAuthenticated','index','get','/:id','show','getFields','/:id/subjects','getSubjects','/:id/descriptions','getDescriptions','create','put','update','delete','destroy','exports','multer','path','connect-timeout'];(function(_0x497d,_0x55c412){var _0x4fe364=function(_0x1bafe6){while(--_0x1bafe6){_0x497d['push'](_0x497d['shift']());}};_0x4fe364(++_0x55c412);}(_0x9660,0x1f1));var _0x0966=function(_0x2aaa12,_0x2c36df){_0x2aaa12=_0x2aaa12-0x0;var _0xeb48ff=_0x9660[_0x2aaa12];return _0xeb48ff;};'use strict';var multer=require(_0x0966('0x0'));var util=require('util');var path=require(_0x0966('0x1'));var timeout=require(_0x0966('0x2'));var express=require(_0x0966('0x3'));var router=express['Router']();var fs_extra=require(_0x0966('0x4'));var auth=require(_0x0966('0x5'));var interaction=require(_0x0966('0x6'));var config=require(_0x0966('0x7'));var controller=require(_0x0966('0x8'));router['get']('/',auth[_0x0966('0x9')](),controller[_0x0966('0xa')]);router[_0x0966('0xb')](_0x0966('0xc'),auth[_0x0966('0x9')](),controller[_0x0966('0xd')]);router[_0x0966('0xb')]('/:id/fields',auth[_0x0966('0x9')](),controller[_0x0966('0xe')]);router[_0x0966('0xb')](_0x0966('0xf'),auth[_0x0966('0x9')](),controller[_0x0966('0x10')]);router[_0x0966('0xb')](_0x0966('0x11'),auth[_0x0966('0x9')](),controller[_0x0966('0x12')]);router['post']('/',auth[_0x0966('0x9')](),controller[_0x0966('0x13')]);router[_0x0966('0x14')]('/:id',auth['isAuthenticated'](),controller[_0x0966('0x15')]);router[_0x0966('0x16')](_0x0966('0xc'),auth[_0x0966('0x9')](),controller[_0x0966('0x17')]);module[_0x0966('0x18')]=router; \ No newline at end of file diff --git a/server/api/intSugarcrmConfiguration/intSugarcrmConfiguration.attributes.js b/server/api/intSugarcrmConfiguration/intSugarcrmConfiguration.attributes.js index 6335328..c6047f5 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 _0x9eae=['sequelize','exports','STRING'];(function(_0x410c37,_0xec1b17){var _0x4ce602=function(_0x317b5e){while(--_0x317b5e){_0x410c37['push'](_0x410c37['shift']());}};_0x4ce602(++_0xec1b17);}(_0x9eae,0x11d));var _0xe9ea=function(_0x5d6456,_0x58ecc7){_0x5d6456=_0x5d6456-0x0;var _0x4d66c1=_0x9eae[_0x5d6456];return _0x4d66c1;};'use strict';var Sequelize=require(_0xe9ea('0x0'));module[_0xe9ea('0x1')]={'name':{'type':Sequelize[_0xe9ea('0x2')]},'description':{'type':Sequelize['STRING']}}; \ No newline at end of file +var _0xd8b9=['sequelize','exports','STRING'];(function(_0x56e075,_0x3e17fe){var _0x1d38aa=function(_0x157c71){while(--_0x157c71){_0x56e075['push'](_0x56e075['shift']());}};_0x1d38aa(++_0x3e17fe);}(_0xd8b9,0x1b6));var _0x9d8b=function(_0x5d25ad,_0x22ea77){_0x5d25ad=_0x5d25ad-0x0;var _0xcc7cba=_0xd8b9[_0x5d25ad];return _0xcc7cba;};'use strict';var Sequelize=require(_0x9d8b('0x0'));module[_0x9d8b('0x1')]={'name':{'type':Sequelize['STRING']},'description':{'type':Sequelize[_0x9d8b('0x2')]}}; \ No newline at end of file diff --git a/server/api/intSugarcrmConfiguration/intSugarcrmConfiguration.controller.js b/server/api/intSugarcrmConfiguration/intSugarcrmConfiguration.controller.js index 5c00d5e..05f2a9d 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 _0x8b4b=['undefined','limit','offset','status','set','Content-Range','apply','reject','save','update','destroy','then','error','stack','name','send','index','map','SugarcrmConfiguration','rawAttributes','fieldName','key','query','filters','intersection','attributes','fields','length','model','nolimit','order','sort','where','pick','filter','merge','type','VIRTUAL','options','count','includeAll','findAll','rows','catch','keys','include','find','create','body','params','getFields','SugarcrmField','getSubjects','hasOwnProperty','getDescriptions','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','mustache','path','sox','to-csv','ejs','fs-extra','lodash','squel','crypto','desk.js','querystring','../../components/auth/service','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/environment','../../mysqldb','sendStatus','end'];(function(_0x56aad3,_0x3d48bc){var _0x1d165a=function(_0x1d4e95){while(--_0x1d4e95){_0x56aad3['push'](_0x56aad3['shift']());}};_0x1d165a(++_0x3d48bc);}(_0x8b4b,0x1cc));var _0xb8b4=function(_0xad6ee0,_0xf9d37){_0xad6ee0=_0xad6ee0-0x0;var _0x4aaa6a=_0x8b4b[_0xad6ee0];return _0x4aaa6a;};'use strict';var emlformat=require(_0xb8b4('0x0'));var rimraf=require(_0xb8b4('0x1'));var zipdir=require(_0xb8b4('0x2'));var jsonpatch=require(_0xb8b4('0x3'));var rp=require(_0xb8b4('0x4'));var moment=require('moment');var BPromise=require('bluebird');var Mustache=require(_0xb8b4('0x5'));var util=require('util');var path=require(_0xb8b4('0x6'));var sox=require(_0xb8b4('0x7'));var csv=require(_0xb8b4('0x8'));var ejs=require(_0xb8b4('0x9'));var fs=require('fs');var fs_extra=require(_0xb8b4('0xa'));var _=require(_0xb8b4('0xb'));var squel=require(_0xb8b4('0xc'));var crypto=require(_0xb8b4('0xd'));var jsforce=require('jsforce');var deskjs=require(_0xb8b4('0xe'));var toCsv=require('to-csv');var querystring=require(_0xb8b4('0xf'));var Papa=require('papaparse');var Redis=require('ioredis');var authService=require(_0xb8b4('0x10'));var qs=require('../../components/parsers/qs');var as=require(_0xb8b4('0x11'));var hardwareService=require(_0xb8b4('0x12'));var logger=require(_0xb8b4('0x13'))(_0xb8b4('0x14'));var utils=require(_0xb8b4('0x15'));var config=require(_0xb8b4('0x16'));var licenseUtil=require('../../config/license/util');var db=require(_0xb8b4('0x17'))['db'];function respondWithStatusCode(_0x11bc0c,_0x1ba3db){_0x1ba3db=_0x1ba3db||0xcc;return function(_0x19ed2d){if(_0x19ed2d){return _0x11bc0c[_0xb8b4('0x18')](_0x1ba3db);}return _0x11bc0c['status'](_0x1ba3db)[_0xb8b4('0x19')]();};}function respondWithResult(_0x40ff47,_0x468246){_0x468246=_0x468246||0xc8;return function(_0x5e5af7){if(_0x5e5af7){return _0x40ff47['status'](_0x468246)['json'](_0x5e5af7);}};}function respondWithFilteredResult(_0x479607,_0xde0eda){return function(_0x50d9d4){if(_0x50d9d4){var _0x4c178a=typeof _0xde0eda['offset']===_0xb8b4('0x1a')&&typeof _0xde0eda[_0xb8b4('0x1b')]===_0xb8b4('0x1a');var _0x1cc7dd=_0x50d9d4['count'];var _0x553a0c=_0x4c178a?0x0:_0xde0eda[_0xb8b4('0x1c')];var _0x4dd4e3=_0x4c178a?_0x50d9d4['count']:_0xde0eda[_0xb8b4('0x1c')]+_0xde0eda[_0xb8b4('0x1b')];var _0x34df2a;if(_0x4dd4e3>=_0x1cc7dd){_0x4dd4e3=_0x1cc7dd;_0x34df2a=0xc8;}else{_0x34df2a=0xce;}_0x479607[_0xb8b4('0x1d')](_0x34df2a);return _0x479607[_0xb8b4('0x1e')](_0xb8b4('0x1f'),_0x553a0c+'-'+_0x4dd4e3+'/'+_0x1cc7dd)['json'](_0x50d9d4);}return null;};}function patchUpdates(_0x3a0bde){return function(_0x17fa15){try{jsonpatch[_0xb8b4('0x20')](_0x17fa15,_0x3a0bde,!![]);}catch(_0xa52cf6){return BPromise[_0xb8b4('0x21')](_0xa52cf6);}return _0x17fa15[_0xb8b4('0x22')]();};}function saveUpdates(_0x2d5c91,_0x4f37ee){return function(_0xd45011){if(_0xd45011){return _0xd45011[_0xb8b4('0x23')](_0x2d5c91)['then'](function(_0x184b44){return _0x184b44;});}return null;};}function removeEntity(_0x211ac0,_0x4493ad){return function(_0x452edb){if(_0x452edb){return _0x452edb[_0xb8b4('0x24')]()[_0xb8b4('0x25')](function(){_0x211ac0['status'](0xcc)[_0xb8b4('0x19')]();});}};}function handleEntityNotFound(_0x5daeef,_0x1023a9){return function(_0xeb4e90){if(!_0xeb4e90){_0x5daeef['sendStatus'](0x194);}return _0xeb4e90;};}function handleError(_0x35489b,_0x4a5e86){_0x4a5e86=_0x4a5e86||0x1f4;return function(_0x3c821c){logger[_0xb8b4('0x26')](_0x3c821c[_0xb8b4('0x27')]);if(_0x3c821c[_0xb8b4('0x28')]){delete _0x3c821c['name'];}_0x35489b[_0xb8b4('0x1d')](_0x4a5e86)[_0xb8b4('0x29')](_0x3c821c);};}exports[_0xb8b4('0x2a')]=function(_0x2032a7,_0x31fb48){var _0x355ee2={},_0x11499a={},_0x2560e7={'count':0x0,'rows':[]};var _0xd721df=_[_0xb8b4('0x2b')](db[_0xb8b4('0x2c')][_0xb8b4('0x2d')],function(_0x1c910e){return{'name':_0x1c910e[_0xb8b4('0x2e')],'type':_0x1c910e['type'][_0xb8b4('0x2f')]};});_0x11499a['model']=_[_0xb8b4('0x2b')](_0xd721df,_0xb8b4('0x28'));_0x11499a['query']=_['keys'](_0x2032a7[_0xb8b4('0x30')]);_0x11499a[_0xb8b4('0x31')]=_[_0xb8b4('0x32')](_0x11499a['model'],_0x11499a['query']);_0x355ee2[_0xb8b4('0x33')]=_[_0xb8b4('0x32')](_0x11499a['model'],qs[_0xb8b4('0x34')](_0x2032a7['query']['fields']));_0x355ee2[_0xb8b4('0x33')]=_0x355ee2[_0xb8b4('0x33')][_0xb8b4('0x35')]?_0x355ee2[_0xb8b4('0x33')]:_0x11499a[_0xb8b4('0x36')];if(!_0x2032a7[_0xb8b4('0x30')]['hasOwnProperty'](_0xb8b4('0x37'))){_0x355ee2[_0xb8b4('0x1b')]=qs['limit'](_0x2032a7['query'][_0xb8b4('0x1b')]);_0x355ee2[_0xb8b4('0x1c')]=qs[_0xb8b4('0x1c')](_0x2032a7['query'][_0xb8b4('0x1c')]);}_0x355ee2[_0xb8b4('0x38')]=qs[_0xb8b4('0x39')](_0x2032a7['query'][_0xb8b4('0x39')]);_0x355ee2[_0xb8b4('0x3a')]=qs[_0xb8b4('0x31')](_[_0xb8b4('0x3b')](_0x2032a7[_0xb8b4('0x30')],_0x11499a['filters']),_0xd721df);if(_0x2032a7['query'][_0xb8b4('0x3c')]){_0x355ee2[_0xb8b4('0x3a')]=_[_0xb8b4('0x3d')](_0x355ee2[_0xb8b4('0x3a')],{'$or':_[_0xb8b4('0x2b')](_0xd721df,function(_0x4983ce){if(_0x4983ce[_0xb8b4('0x3e')]!==_0xb8b4('0x3f')){var _0x3b276e={};_0x3b276e[_0x4983ce[_0xb8b4('0x28')]]={'$like':'%'+_0x2032a7[_0xb8b4('0x30')]['filter']+'%'};return _0x3b276e;}})});}_0x355ee2=_[_0xb8b4('0x3d')]({},_0x355ee2,_0x2032a7[_0xb8b4('0x40')]);var _0x27cfce={'where':_0x355ee2[_0xb8b4('0x3a')]};return db[_0xb8b4('0x2c')][_0xb8b4('0x41')](_0x27cfce)['then'](function(_0xbf6379){_0x2560e7[_0xb8b4('0x41')]=_0xbf6379;if(_0x2032a7[_0xb8b4('0x30')][_0xb8b4('0x42')]){_0x355ee2['include']=[{'all':!![]}];}return db[_0xb8b4('0x2c')][_0xb8b4('0x43')](_0x355ee2);})[_0xb8b4('0x25')](function(_0x49e871){_0x2560e7[_0xb8b4('0x44')]=_0x49e871;return _0x2560e7;})[_0xb8b4('0x25')](respondWithFilteredResult(_0x31fb48,_0x355ee2))[_0xb8b4('0x45')](handleError(_0x31fb48,null));};exports['show']=function(_0x21530c,_0x5f470c){var _0x27308a={'raw':![],'where':{'id':_0x21530c['params']['id']}},_0x2c1290={};_0x2c1290[_0xb8b4('0x36')]=_[_0xb8b4('0x46')](db[_0xb8b4('0x2c')][_0xb8b4('0x2d')]);_0x2c1290[_0xb8b4('0x30')]=_['keys'](_0x21530c[_0xb8b4('0x30')]);_0x2c1290['filters']=_[_0xb8b4('0x32')](_0x2c1290[_0xb8b4('0x36')],_0x2c1290[_0xb8b4('0x30')]);_0x27308a[_0xb8b4('0x33')]=_[_0xb8b4('0x32')](_0x2c1290['model'],qs[_0xb8b4('0x34')](_0x21530c[_0xb8b4('0x30')][_0xb8b4('0x34')]));_0x27308a['attributes']=_0x27308a[_0xb8b4('0x33')]['length']?_0x27308a[_0xb8b4('0x33')]:_0x2c1290['model'];if(_0x21530c[_0xb8b4('0x30')][_0xb8b4('0x42')]){_0x27308a[_0xb8b4('0x47')]=[{'all':!![]}];}_0x27308a=_[_0xb8b4('0x3d')]({},_0x27308a,_0x21530c['options']);return db[_0xb8b4('0x2c')][_0xb8b4('0x48')](_0x27308a)[_0xb8b4('0x25')](handleEntityNotFound(_0x5f470c,null))[_0xb8b4('0x25')](respondWithResult(_0x5f470c,null))[_0xb8b4('0x45')](handleError(_0x5f470c,null));};exports[_0xb8b4('0x49')]=function(_0x28de1a,_0x1d987e){return db[_0xb8b4('0x2c')]['create'](_0x28de1a[_0xb8b4('0x4a')],{})['then'](respondWithResult(_0x1d987e,0xc9))[_0xb8b4('0x45')](handleError(_0x1d987e,null));};exports['update']=function(_0x596555,_0x4b52e1){if(_0x596555['body']['id']){delete _0x596555[_0xb8b4('0x4a')]['id'];}return db['SugarcrmConfiguration']['find']({'where':{'id':_0x596555[_0xb8b4('0x4b')]['id']}})[_0xb8b4('0x25')](handleEntityNotFound(_0x4b52e1,null))[_0xb8b4('0x25')](saveUpdates(_0x596555[_0xb8b4('0x4a')],null))[_0xb8b4('0x25')](respondWithResult(_0x4b52e1,null))[_0xb8b4('0x45')](handleError(_0x4b52e1,null));};exports[_0xb8b4('0x24')]=function(_0x26c287,_0x4b8386){return db[_0xb8b4('0x2c')][_0xb8b4('0x48')]({'where':{'id':_0x26c287[_0xb8b4('0x4b')]['id']}})[_0xb8b4('0x25')](handleEntityNotFound(_0x4b8386,null))['then'](removeEntity(_0x4b8386,null))[_0xb8b4('0x45')](handleError(_0x4b8386,null));};exports[_0xb8b4('0x4c')]=function(_0x31b5bd,_0x66ffff,_0x1835a0){var _0x222fb4={};var _0x147638={};var _0x2da3cd;var _0x3f30d6;return db[_0xb8b4('0x2c')]['findOne']({'where':{'id':_0x31b5bd[_0xb8b4('0x4b')]['id']}})[_0xb8b4('0x25')](handleEntityNotFound(_0x66ffff,null))[_0xb8b4('0x25')](function(_0x332bf0){if(_0x332bf0){_0x2da3cd=_0x332bf0;_0x147638['model']=_[_0xb8b4('0x46')](db[_0xb8b4('0x4d')][_0xb8b4('0x2d')]);_0x147638[_0xb8b4('0x30')]=_[_0xb8b4('0x46')](_0x31b5bd['query']);_0x147638['filters']=_[_0xb8b4('0x32')](_0x147638[_0xb8b4('0x36')],_0x147638[_0xb8b4('0x30')]);_0x222fb4[_0xb8b4('0x33')]=_[_0xb8b4('0x32')](_0x147638[_0xb8b4('0x36')],qs['fields'](_0x31b5bd[_0xb8b4('0x30')][_0xb8b4('0x34')]));_0x222fb4[_0xb8b4('0x33')]=_0x222fb4[_0xb8b4('0x33')][_0xb8b4('0x35')]?_0x222fb4[_0xb8b4('0x33')]:_0x147638['model'];_0x222fb4[_0xb8b4('0x38')]=qs[_0xb8b4('0x39')](_0x31b5bd[_0xb8b4('0x30')][_0xb8b4('0x39')]);_0x222fb4[_0xb8b4('0x3a')]=qs[_0xb8b4('0x31')](_[_0xb8b4('0x3b')](_0x31b5bd[_0xb8b4('0x30')],_0x147638['filters']));if(_0x31b5bd[_0xb8b4('0x30')]['filter']){_0x222fb4[_0xb8b4('0x3a')]=_[_0xb8b4('0x3d')](_0x222fb4[_0xb8b4('0x3a')],{'$or':_[_0xb8b4('0x2b')](_0x222fb4['attributes'],function(_0x35154e){var _0x2dd9b5={};_0x2dd9b5[_0x35154e]={'$like':'%'+_0x31b5bd[_0xb8b4('0x30')][_0xb8b4('0x3c')]+'%'};return _0x2dd9b5;})});}_0x222fb4=_[_0xb8b4('0x3d')]({},_0x222fb4,_0x31b5bd[_0xb8b4('0x40')]);return _0x2da3cd[_0xb8b4('0x4c')](_0x222fb4);}})[_0xb8b4('0x25')](function(_0x19d8e7){if(_0x19d8e7){_0x3f30d6=_0x19d8e7['length'];if(!_0x31b5bd['query']['hasOwnProperty'](_0xb8b4('0x37'))){_0x222fb4['limit']=qs['limit'](_0x31b5bd[_0xb8b4('0x30')][_0xb8b4('0x1b')]);_0x222fb4[_0xb8b4('0x1c')]=qs['offset'](_0x31b5bd[_0xb8b4('0x30')][_0xb8b4('0x1c')]);}return _0x2da3cd[_0xb8b4('0x4c')](_0x222fb4);}})['then'](function(_0x156db9){if(_0x156db9){return _0x156db9?{'count':_0x3f30d6,'rows':_0x156db9}:null;}})['then'](respondWithResult(_0x66ffff,null))['catch'](handleError(_0x66ffff,null));};exports[_0xb8b4('0x4e')]=function(_0x5cd956,_0x55ccc1,_0x17a326){var _0x568655={};var _0x16310f={};var _0x4efe27;var _0x11ee90;return db[_0xb8b4('0x2c')]['findOne']({'where':{'id':_0x5cd956[_0xb8b4('0x4b')]['id']}})[_0xb8b4('0x25')](handleEntityNotFound(_0x55ccc1,null))['then'](function(_0x197d76){if(_0x197d76){_0x4efe27=_0x197d76;_0x16310f[_0xb8b4('0x36')]=_[_0xb8b4('0x46')](db[_0xb8b4('0x4d')][_0xb8b4('0x2d')]);_0x16310f[_0xb8b4('0x30')]=_[_0xb8b4('0x46')](_0x5cd956['query']);_0x16310f['filters']=_[_0xb8b4('0x32')](_0x16310f[_0xb8b4('0x36')],_0x16310f[_0xb8b4('0x30')]);_0x568655[_0xb8b4('0x33')]=_[_0xb8b4('0x32')](_0x16310f['model'],qs[_0xb8b4('0x34')](_0x5cd956[_0xb8b4('0x30')][_0xb8b4('0x34')]));_0x568655[_0xb8b4('0x33')]=_0x568655[_0xb8b4('0x33')][_0xb8b4('0x35')]?_0x568655[_0xb8b4('0x33')]:_0x16310f[_0xb8b4('0x36')];_0x568655[_0xb8b4('0x38')]=qs[_0xb8b4('0x39')](_0x5cd956[_0xb8b4('0x30')][_0xb8b4('0x39')]);_0x568655[_0xb8b4('0x3a')]=qs[_0xb8b4('0x31')](_[_0xb8b4('0x3b')](_0x5cd956[_0xb8b4('0x30')],_0x16310f[_0xb8b4('0x31')]));if(_0x5cd956['query']['filter']){_0x568655['where']=_[_0xb8b4('0x3d')](_0x568655[_0xb8b4('0x3a')],{'$or':_['map'](_0x568655['attributes'],function(_0x244429){var _0x409500={};_0x409500[_0x244429]={'$like':'%'+_0x5cd956[_0xb8b4('0x30')][_0xb8b4('0x3c')]+'%'};return _0x409500;})});}_0x568655=_['merge']({},_0x568655,_0x5cd956[_0xb8b4('0x40')]);return _0x4efe27[_0xb8b4('0x4e')](_0x568655);}})[_0xb8b4('0x25')](function(_0x3ffc90){if(_0x3ffc90){_0x11ee90=_0x3ffc90['length'];if(!_0x5cd956[_0xb8b4('0x30')][_0xb8b4('0x4f')](_0xb8b4('0x37'))){_0x568655[_0xb8b4('0x1b')]=qs[_0xb8b4('0x1b')](_0x5cd956['query'][_0xb8b4('0x1b')]);_0x568655[_0xb8b4('0x1c')]=qs[_0xb8b4('0x1c')](_0x5cd956[_0xb8b4('0x30')]['offset']);}return _0x4efe27[_0xb8b4('0x4e')](_0x568655);}})['then'](function(_0x231e4f){if(_0x231e4f){return _0x231e4f?{'count':_0x11ee90,'rows':_0x231e4f}:null;}})[_0xb8b4('0x25')](respondWithResult(_0x55ccc1,null))[_0xb8b4('0x45')](handleError(_0x55ccc1,null));};exports[_0xb8b4('0x50')]=function(_0x4d52a0,_0x35c2a6,_0x95e713){var _0x59e1b7={};var _0x12d1dd={};var _0xc4576f;var _0x30b9c3;return db['SugarcrmConfiguration']['findOne']({'where':{'id':_0x4d52a0[_0xb8b4('0x4b')]['id']}})['then'](handleEntityNotFound(_0x35c2a6,null))[_0xb8b4('0x25')](function(_0x992be3){if(_0x992be3){_0xc4576f=_0x992be3;_0x12d1dd[_0xb8b4('0x36')]=_['keys'](db['SugarcrmField'][_0xb8b4('0x2d')]);_0x12d1dd['query']=_[_0xb8b4('0x46')](_0x4d52a0[_0xb8b4('0x30')]);_0x12d1dd[_0xb8b4('0x31')]=_['intersection'](_0x12d1dd['model'],_0x12d1dd[_0xb8b4('0x30')]);_0x59e1b7[_0xb8b4('0x33')]=_['intersection'](_0x12d1dd[_0xb8b4('0x36')],qs[_0xb8b4('0x34')](_0x4d52a0['query'][_0xb8b4('0x34')]));_0x59e1b7[_0xb8b4('0x33')]=_0x59e1b7['attributes'][_0xb8b4('0x35')]?_0x59e1b7['attributes']:_0x12d1dd[_0xb8b4('0x36')];_0x59e1b7[_0xb8b4('0x38')]=qs['sort'](_0x4d52a0['query'][_0xb8b4('0x39')]);_0x59e1b7['where']=qs[_0xb8b4('0x31')](_['pick'](_0x4d52a0[_0xb8b4('0x30')],_0x12d1dd[_0xb8b4('0x31')]));if(_0x4d52a0[_0xb8b4('0x30')][_0xb8b4('0x3c')]){_0x59e1b7[_0xb8b4('0x3a')]=_['merge'](_0x59e1b7[_0xb8b4('0x3a')],{'$or':_[_0xb8b4('0x2b')](_0x59e1b7[_0xb8b4('0x33')],function(_0x8dac64){var _0x2d3aff={};_0x2d3aff[_0x8dac64]={'$like':'%'+_0x4d52a0[_0xb8b4('0x30')][_0xb8b4('0x3c')]+'%'};return _0x2d3aff;})});}_0x59e1b7=_[_0xb8b4('0x3d')]({},_0x59e1b7,_0x4d52a0['options']);return _0xc4576f['getDescriptions'](_0x59e1b7);}})[_0xb8b4('0x25')](function(_0xa39745){if(_0xa39745){_0x30b9c3=_0xa39745[_0xb8b4('0x35')];if(!_0x4d52a0[_0xb8b4('0x30')][_0xb8b4('0x4f')]('nolimit')){_0x59e1b7[_0xb8b4('0x1b')]=qs[_0xb8b4('0x1b')](_0x4d52a0[_0xb8b4('0x30')]['limit']);_0x59e1b7[_0xb8b4('0x1c')]=qs[_0xb8b4('0x1c')](_0x4d52a0[_0xb8b4('0x30')][_0xb8b4('0x1c')]);}return _0xc4576f[_0xb8b4('0x50')](_0x59e1b7);}})[_0xb8b4('0x25')](function(_0xbfdcda){if(_0xbfdcda){return _0xbfdcda?{'count':_0x30b9c3,'rows':_0xbfdcda}:null;}})[_0xb8b4('0x25')](respondWithResult(_0x35c2a6,null))['catch'](handleError(_0x35c2a6,null));}; \ No newline at end of file +var _0x4170=['catch','params','include','find','create','body','getFields','SugarcrmField','nolimit','getSubjects','getDescriptions','findOne','zip-dir','fast-json-patch','request-promise','moment','bluebird','util','sox','to-csv','lodash','squel','crypto','jsforce','desk.js','querystring','papaparse','../../config/license/hardware','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','sendStatus','status','end','json','offset','undefined','count','limit','Content-Range','reject','save','update','then','destroy','error','stack','name','send','index','map','SugarcrmConfiguration','rawAttributes','fieldName','type','query','keys','intersection','attributes','model','fields','length','hasOwnProperty','order','sort','filters','pick','filter','where','merge','options','includeAll','rows'];(function(_0x1635fe,_0x5f1d9f){var _0x3c512a=function(_0x26b53d){while(--_0x26b53d){_0x1635fe['push'](_0x1635fe['shift']());}};_0x3c512a(++_0x5f1d9f);}(_0x4170,0x134));var _0x0417=function(_0x4a342e,_0x839a34){_0x4a342e=_0x4a342e-0x0;var _0x2b0981=_0x4170[_0x4a342e];return _0x2b0981;};'use strict';var emlformat=require('eml-format');var rimraf=require('rimraf');var zipdir=require(_0x0417('0x0'));var jsonpatch=require(_0x0417('0x1'));var rp=require(_0x0417('0x2'));var moment=require(_0x0417('0x3'));var BPromise=require(_0x0417('0x4'));var Mustache=require('mustache');var util=require(_0x0417('0x5'));var path=require('path');var sox=require(_0x0417('0x6'));var csv=require(_0x0417('0x7'));var ejs=require('ejs');var fs=require('fs');var fs_extra=require('fs-extra');var _=require(_0x0417('0x8'));var squel=require(_0x0417('0x9'));var crypto=require(_0x0417('0xa'));var jsforce=require(_0x0417('0xb'));var deskjs=require(_0x0417('0xc'));var toCsv=require(_0x0417('0x7'));var querystring=require(_0x0417('0xd'));var Papa=require(_0x0417('0xe'));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(_0x0417('0xf'));var logger=require('../../config/logger')('api');var utils=require(_0x0417('0x10'));var config=require(_0x0417('0x11'));var licenseUtil=require(_0x0417('0x12'));var db=require(_0x0417('0x13'))['db'];function respondWithStatusCode(_0x2aa1e4,_0x1917c1){_0x1917c1=_0x1917c1||0xcc;return function(_0x202223){if(_0x202223){return _0x2aa1e4[_0x0417('0x14')](_0x1917c1);}return _0x2aa1e4[_0x0417('0x15')](_0x1917c1)[_0x0417('0x16')]();};}function respondWithResult(_0x20fdd8,_0x5a1a87){_0x5a1a87=_0x5a1a87||0xc8;return function(_0x5e4d8f){if(_0x5e4d8f){return _0x20fdd8[_0x0417('0x15')](_0x5a1a87)[_0x0417('0x17')](_0x5e4d8f);}};}function respondWithFilteredResult(_0x47e04b,_0x4d6879){return function(_0x2a8cc1){if(_0x2a8cc1){var _0x14f5a8=typeof _0x4d6879[_0x0417('0x18')]===_0x0417('0x19')&&typeof _0x4d6879['limit']==='undefined';var _0x4a1a86=_0x2a8cc1[_0x0417('0x1a')];var _0x283e0d=_0x14f5a8?0x0:_0x4d6879[_0x0417('0x18')];var _0x2fb3e2=_0x14f5a8?_0x2a8cc1[_0x0417('0x1a')]:_0x4d6879[_0x0417('0x18')]+_0x4d6879[_0x0417('0x1b')];var _0x356122;if(_0x2fb3e2>=_0x4a1a86){_0x2fb3e2=_0x4a1a86;_0x356122=0xc8;}else{_0x356122=0xce;}_0x47e04b[_0x0417('0x15')](_0x356122);return _0x47e04b['set'](_0x0417('0x1c'),_0x283e0d+'-'+_0x2fb3e2+'/'+_0x4a1a86)[_0x0417('0x17')](_0x2a8cc1);}return null;};}function patchUpdates(_0x4007a3){return function(_0x2a701b){try{jsonpatch['apply'](_0x2a701b,_0x4007a3,!![]);}catch(_0x49ab22){return BPromise[_0x0417('0x1d')](_0x49ab22);}return _0x2a701b[_0x0417('0x1e')]();};}function saveUpdates(_0x56cace,_0x3bfb50){return function(_0x1ecdf7){if(_0x1ecdf7){return _0x1ecdf7[_0x0417('0x1f')](_0x56cace)[_0x0417('0x20')](function(_0x3249a6){return _0x3249a6;});}return null;};}function removeEntity(_0x355559,_0x391017){return function(_0x44eb07){if(_0x44eb07){return _0x44eb07[_0x0417('0x21')]()[_0x0417('0x20')](function(){_0x355559['status'](0xcc)[_0x0417('0x16')]();});}};}function handleEntityNotFound(_0x4a07a5,_0x1e0038){return function(_0x2e547f){if(!_0x2e547f){_0x4a07a5[_0x0417('0x14')](0x194);}return _0x2e547f;};}function handleError(_0x3a1a1b,_0x5f6e93){_0x5f6e93=_0x5f6e93||0x1f4;return function(_0x1e7e20){logger[_0x0417('0x22')](_0x1e7e20[_0x0417('0x23')]);if(_0x1e7e20[_0x0417('0x24')]){delete _0x1e7e20[_0x0417('0x24')];}_0x3a1a1b[_0x0417('0x15')](_0x5f6e93)[_0x0417('0x25')](_0x1e7e20);};}exports[_0x0417('0x26')]=function(_0x513575,_0x1d1d3a){var _0x910757={},_0x37539e={},_0x543e1b={'count':0x0,'rows':[]};var _0xa209d1=_[_0x0417('0x27')](db[_0x0417('0x28')][_0x0417('0x29')],function(_0xef9ef6){return{'name':_0xef9ef6[_0x0417('0x2a')],'type':_0xef9ef6[_0x0417('0x2b')]['key']};});_0x37539e['model']=_[_0x0417('0x27')](_0xa209d1,_0x0417('0x24'));_0x37539e[_0x0417('0x2c')]=_[_0x0417('0x2d')](_0x513575[_0x0417('0x2c')]);_0x37539e['filters']=_[_0x0417('0x2e')](_0x37539e['model'],_0x37539e[_0x0417('0x2c')]);_0x910757[_0x0417('0x2f')]=_['intersection'](_0x37539e[_0x0417('0x30')],qs['fields'](_0x513575[_0x0417('0x2c')][_0x0417('0x31')]));_0x910757[_0x0417('0x2f')]=_0x910757[_0x0417('0x2f')][_0x0417('0x32')]?_0x910757[_0x0417('0x2f')]:_0x37539e[_0x0417('0x30')];if(!_0x513575[_0x0417('0x2c')][_0x0417('0x33')]('nolimit')){_0x910757[_0x0417('0x1b')]=qs[_0x0417('0x1b')](_0x513575['query'][_0x0417('0x1b')]);_0x910757['offset']=qs[_0x0417('0x18')](_0x513575[_0x0417('0x2c')]['offset']);}_0x910757[_0x0417('0x34')]=qs[_0x0417('0x35')](_0x513575['query']['sort']);_0x910757['where']=qs[_0x0417('0x36')](_[_0x0417('0x37')](_0x513575['query'],_0x37539e['filters']),_0xa209d1);if(_0x513575[_0x0417('0x2c')][_0x0417('0x38')]){_0x910757[_0x0417('0x39')]=_['merge'](_0x910757[_0x0417('0x39')],{'$or':_[_0x0417('0x27')](_0xa209d1,function(_0x111a80){if(_0x111a80[_0x0417('0x2b')]!=='VIRTUAL'){var _0x1f6eb4={};_0x1f6eb4[_0x111a80[_0x0417('0x24')]]={'$like':'%'+_0x513575[_0x0417('0x2c')][_0x0417('0x38')]+'%'};return _0x1f6eb4;}})});}_0x910757=_[_0x0417('0x3a')]({},_0x910757,_0x513575[_0x0417('0x3b')]);var _0x39439b={'where':_0x910757[_0x0417('0x39')]};return db[_0x0417('0x28')]['count'](_0x39439b)[_0x0417('0x20')](function(_0x5984d0){_0x543e1b[_0x0417('0x1a')]=_0x5984d0;if(_0x513575['query'][_0x0417('0x3c')]){_0x910757['include']=[{'all':!![]}];}return db[_0x0417('0x28')]['findAll'](_0x910757);})[_0x0417('0x20')](function(_0x3ea0b2){_0x543e1b[_0x0417('0x3d')]=_0x3ea0b2;return _0x543e1b;})['then'](respondWithFilteredResult(_0x1d1d3a,_0x910757))[_0x0417('0x3e')](handleError(_0x1d1d3a,null));};exports['show']=function(_0x4073f4,_0x5c7211){var _0x21274a={'raw':![],'where':{'id':_0x4073f4[_0x0417('0x3f')]['id']}},_0x411f42={};_0x411f42['model']=_[_0x0417('0x2d')](db['SugarcrmConfiguration'][_0x0417('0x29')]);_0x411f42[_0x0417('0x2c')]=_[_0x0417('0x2d')](_0x4073f4[_0x0417('0x2c')]);_0x411f42[_0x0417('0x36')]=_[_0x0417('0x2e')](_0x411f42[_0x0417('0x30')],_0x411f42[_0x0417('0x2c')]);_0x21274a['attributes']=_[_0x0417('0x2e')](_0x411f42[_0x0417('0x30')],qs[_0x0417('0x31')](_0x4073f4[_0x0417('0x2c')][_0x0417('0x31')]));_0x21274a[_0x0417('0x2f')]=_0x21274a[_0x0417('0x2f')]['length']?_0x21274a['attributes']:_0x411f42[_0x0417('0x30')];if(_0x4073f4[_0x0417('0x2c')][_0x0417('0x3c')]){_0x21274a[_0x0417('0x40')]=[{'all':!![]}];}_0x21274a=_['merge']({},_0x21274a,_0x4073f4[_0x0417('0x3b')]);return db[_0x0417('0x28')][_0x0417('0x41')](_0x21274a)[_0x0417('0x20')](handleEntityNotFound(_0x5c7211,null))['then'](respondWithResult(_0x5c7211,null))[_0x0417('0x3e')](handleError(_0x5c7211,null));};exports[_0x0417('0x42')]=function(_0x252df4,_0x325521){return db['SugarcrmConfiguration'][_0x0417('0x42')](_0x252df4['body'],{})['then'](respondWithResult(_0x325521,0xc9))[_0x0417('0x3e')](handleError(_0x325521,null));};exports[_0x0417('0x1f')]=function(_0x244a4a,_0x59b056){if(_0x244a4a['body']['id']){delete _0x244a4a['body']['id'];}return db[_0x0417('0x28')][_0x0417('0x41')]({'where':{'id':_0x244a4a[_0x0417('0x3f')]['id']}})[_0x0417('0x20')](handleEntityNotFound(_0x59b056,null))[_0x0417('0x20')](saveUpdates(_0x244a4a[_0x0417('0x43')],null))[_0x0417('0x20')](respondWithResult(_0x59b056,null))['catch'](handleError(_0x59b056,null));};exports['destroy']=function(_0x53adef,_0x160ccd){return db[_0x0417('0x28')][_0x0417('0x41')]({'where':{'id':_0x53adef[_0x0417('0x3f')]['id']}})[_0x0417('0x20')](handleEntityNotFound(_0x160ccd,null))[_0x0417('0x20')](removeEntity(_0x160ccd,null))[_0x0417('0x3e')](handleError(_0x160ccd,null));};exports[_0x0417('0x44')]=function(_0x3fab36,_0x28a290,_0x4f80bb){var _0x4ed3ab={};var _0x300c43={};var _0x9d24fd;var _0x4de5bd;return db[_0x0417('0x28')]['findOne']({'where':{'id':_0x3fab36[_0x0417('0x3f')]['id']}})[_0x0417('0x20')](handleEntityNotFound(_0x28a290,null))[_0x0417('0x20')](function(_0x10b110){if(_0x10b110){_0x9d24fd=_0x10b110;_0x300c43['model']=_[_0x0417('0x2d')](db[_0x0417('0x45')][_0x0417('0x29')]);_0x300c43['query']=_[_0x0417('0x2d')](_0x3fab36[_0x0417('0x2c')]);_0x300c43[_0x0417('0x36')]=_[_0x0417('0x2e')](_0x300c43[_0x0417('0x30')],_0x300c43['query']);_0x4ed3ab[_0x0417('0x2f')]=_[_0x0417('0x2e')](_0x300c43[_0x0417('0x30')],qs[_0x0417('0x31')](_0x3fab36['query'][_0x0417('0x31')]));_0x4ed3ab[_0x0417('0x2f')]=_0x4ed3ab[_0x0417('0x2f')]['length']?_0x4ed3ab[_0x0417('0x2f')]:_0x300c43[_0x0417('0x30')];_0x4ed3ab['order']=qs[_0x0417('0x35')](_0x3fab36[_0x0417('0x2c')][_0x0417('0x35')]);_0x4ed3ab[_0x0417('0x39')]=qs[_0x0417('0x36')](_[_0x0417('0x37')](_0x3fab36[_0x0417('0x2c')],_0x300c43[_0x0417('0x36')]));if(_0x3fab36[_0x0417('0x2c')][_0x0417('0x38')]){_0x4ed3ab[_0x0417('0x39')]=_[_0x0417('0x3a')](_0x4ed3ab[_0x0417('0x39')],{'$or':_['map'](_0x4ed3ab[_0x0417('0x2f')],function(_0x39fca9){var _0x539435={};_0x539435[_0x39fca9]={'$like':'%'+_0x3fab36[_0x0417('0x2c')]['filter']+'%'};return _0x539435;})});}_0x4ed3ab=_[_0x0417('0x3a')]({},_0x4ed3ab,_0x3fab36[_0x0417('0x3b')]);return _0x9d24fd[_0x0417('0x44')](_0x4ed3ab);}})[_0x0417('0x20')](function(_0x4399f9){if(_0x4399f9){_0x4de5bd=_0x4399f9['length'];if(!_0x3fab36[_0x0417('0x2c')]['hasOwnProperty'](_0x0417('0x46'))){_0x4ed3ab['limit']=qs[_0x0417('0x1b')](_0x3fab36['query']['limit']);_0x4ed3ab[_0x0417('0x18')]=qs[_0x0417('0x18')](_0x3fab36[_0x0417('0x2c')]['offset']);}return _0x9d24fd[_0x0417('0x44')](_0x4ed3ab);}})[_0x0417('0x20')](function(_0x2b4cdc){if(_0x2b4cdc){return _0x2b4cdc?{'count':_0x4de5bd,'rows':_0x2b4cdc}:null;}})[_0x0417('0x20')](respondWithResult(_0x28a290,null))[_0x0417('0x3e')](handleError(_0x28a290,null));};exports[_0x0417('0x47')]=function(_0x5c841a,_0x435aba,_0x3bfbd1){var _0x3bdc9d={};var _0x23725f={};var _0x490ce4;var _0x41c4ed;return db[_0x0417('0x28')]['findOne']({'where':{'id':_0x5c841a[_0x0417('0x3f')]['id']}})[_0x0417('0x20')](handleEntityNotFound(_0x435aba,null))[_0x0417('0x20')](function(_0x2f8f81){if(_0x2f8f81){_0x490ce4=_0x2f8f81;_0x23725f['model']=_['keys'](db['SugarcrmField']['rawAttributes']);_0x23725f[_0x0417('0x2c')]=_[_0x0417('0x2d')](_0x5c841a['query']);_0x23725f[_0x0417('0x36')]=_[_0x0417('0x2e')](_0x23725f['model'],_0x23725f[_0x0417('0x2c')]);_0x3bdc9d[_0x0417('0x2f')]=_[_0x0417('0x2e')](_0x23725f[_0x0417('0x30')],qs[_0x0417('0x31')](_0x5c841a[_0x0417('0x2c')]['fields']));_0x3bdc9d[_0x0417('0x2f')]=_0x3bdc9d[_0x0417('0x2f')]['length']?_0x3bdc9d[_0x0417('0x2f')]:_0x23725f[_0x0417('0x30')];_0x3bdc9d['order']=qs[_0x0417('0x35')](_0x5c841a[_0x0417('0x2c')][_0x0417('0x35')]);_0x3bdc9d[_0x0417('0x39')]=qs[_0x0417('0x36')](_[_0x0417('0x37')](_0x5c841a['query'],_0x23725f[_0x0417('0x36')]));if(_0x5c841a[_0x0417('0x2c')][_0x0417('0x38')]){_0x3bdc9d['where']=_['merge'](_0x3bdc9d[_0x0417('0x39')],{'$or':_[_0x0417('0x27')](_0x3bdc9d[_0x0417('0x2f')],function(_0x4fec0d){var _0x169c86={};_0x169c86[_0x4fec0d]={'$like':'%'+_0x5c841a[_0x0417('0x2c')]['filter']+'%'};return _0x169c86;})});}_0x3bdc9d=_[_0x0417('0x3a')]({},_0x3bdc9d,_0x5c841a['options']);return _0x490ce4[_0x0417('0x47')](_0x3bdc9d);}})['then'](function(_0x2ebd09){if(_0x2ebd09){_0x41c4ed=_0x2ebd09[_0x0417('0x32')];if(!_0x5c841a[_0x0417('0x2c')][_0x0417('0x33')](_0x0417('0x46'))){_0x3bdc9d[_0x0417('0x1b')]=qs['limit'](_0x5c841a[_0x0417('0x2c')][_0x0417('0x1b')]);_0x3bdc9d['offset']=qs[_0x0417('0x18')](_0x5c841a[_0x0417('0x2c')][_0x0417('0x18')]);}return _0x490ce4[_0x0417('0x47')](_0x3bdc9d);}})['then'](function(_0x5d8bbf){if(_0x5d8bbf){return _0x5d8bbf?{'count':_0x41c4ed,'rows':_0x5d8bbf}:null;}})[_0x0417('0x20')](respondWithResult(_0x435aba,null))[_0x0417('0x3e')](handleError(_0x435aba,null));};exports[_0x0417('0x48')]=function(_0x1e64cd,_0x1b0f42,_0x529115){var _0x2cd1fa={};var _0x531164={};var _0x4dc7ab;var _0xe448ee;return db[_0x0417('0x28')][_0x0417('0x49')]({'where':{'id':_0x1e64cd[_0x0417('0x3f')]['id']}})[_0x0417('0x20')](handleEntityNotFound(_0x1b0f42,null))[_0x0417('0x20')](function(_0x2b5d88){if(_0x2b5d88){_0x4dc7ab=_0x2b5d88;_0x531164[_0x0417('0x30')]=_['keys'](db[_0x0417('0x45')][_0x0417('0x29')]);_0x531164[_0x0417('0x2c')]=_[_0x0417('0x2d')](_0x1e64cd[_0x0417('0x2c')]);_0x531164[_0x0417('0x36')]=_['intersection'](_0x531164['model'],_0x531164['query']);_0x2cd1fa['attributes']=_[_0x0417('0x2e')](_0x531164[_0x0417('0x30')],qs['fields'](_0x1e64cd[_0x0417('0x2c')][_0x0417('0x31')]));_0x2cd1fa[_0x0417('0x2f')]=_0x2cd1fa[_0x0417('0x2f')]['length']?_0x2cd1fa[_0x0417('0x2f')]:_0x531164[_0x0417('0x30')];_0x2cd1fa[_0x0417('0x34')]=qs[_0x0417('0x35')](_0x1e64cd[_0x0417('0x2c')][_0x0417('0x35')]);_0x2cd1fa[_0x0417('0x39')]=qs[_0x0417('0x36')](_[_0x0417('0x37')](_0x1e64cd[_0x0417('0x2c')],_0x531164['filters']));if(_0x1e64cd[_0x0417('0x2c')][_0x0417('0x38')]){_0x2cd1fa['where']=_[_0x0417('0x3a')](_0x2cd1fa[_0x0417('0x39')],{'$or':_['map'](_0x2cd1fa[_0x0417('0x2f')],function(_0x3ce50f){var _0x1aa5df={};_0x1aa5df[_0x3ce50f]={'$like':'%'+_0x1e64cd[_0x0417('0x2c')][_0x0417('0x38')]+'%'};return _0x1aa5df;})});}_0x2cd1fa=_[_0x0417('0x3a')]({},_0x2cd1fa,_0x1e64cd[_0x0417('0x3b')]);return _0x4dc7ab[_0x0417('0x48')](_0x2cd1fa);}})[_0x0417('0x20')](function(_0x3370a8){if(_0x3370a8){_0xe448ee=_0x3370a8[_0x0417('0x32')];if(!_0x1e64cd[_0x0417('0x2c')][_0x0417('0x33')](_0x0417('0x46'))){_0x2cd1fa[_0x0417('0x1b')]=qs[_0x0417('0x1b')](_0x1e64cd[_0x0417('0x2c')][_0x0417('0x1b')]);_0x2cd1fa[_0x0417('0x18')]=qs[_0x0417('0x18')](_0x1e64cd['query'][_0x0417('0x18')]);}return _0x4dc7ab[_0x0417('0x48')](_0x2cd1fa);}})['then'](function(_0x350863){if(_0x350863){return _0x350863?{'count':_0xe448ee,'rows':_0x350863}:null;}})[_0x0417('0x20')](respondWithResult(_0x1b0f42,null))[_0x0417('0x3e')](handleError(_0x1b0f42,null));}; \ No newline at end of file diff --git a/server/api/intSugarcrmConfiguration/intSugarcrmConfiguration.model.js b/server/api/intSugarcrmConfiguration/intSugarcrmConfiguration.model.js index 4296051..ff4c541 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 _0x64f3=['int_sugarcrm_configurations','lodash','util','../../config/logger','api','moment','bluebird','request-promise','path','rimraf','../../config/environment','./intSugarcrmConfiguration.attributes','exports'];(function(_0x45f951,_0x2750c8){var _0x24756c=function(_0x31c931){while(--_0x31c931){_0x45f951['push'](_0x45f951['shift']());}};_0x24756c(++_0x2750c8);}(_0x64f3,0x83));var _0x364f=function(_0x1d60db,_0x1b4492){_0x1d60db=_0x1d60db-0x0;var _0x5dd2c2=_0x64f3[_0x1d60db];return _0x5dd2c2;};'use strict';var _=require(_0x364f('0x0'));var util=require(_0x364f('0x1'));var logger=require(_0x364f('0x2'))(_0x364f('0x3'));var moment=require(_0x364f('0x4'));var BPromise=require(_0x364f('0x5'));var rp=require(_0x364f('0x6'));var fs=require('fs');var path=require(_0x364f('0x7'));var rimraf=require(_0x364f('0x8'));var config=require(_0x364f('0x9'));var attributes=require(_0x364f('0xa'));module[_0x364f('0xb')]=function(_0x5ad30c,_0x297911){return _0x5ad30c['define']('SugarcrmConfiguration',attributes,{'tableName':_0x364f('0xc'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x7262=['../../config/logger','api','bluebird','request-promise','path','rimraf','exports','define','SugarcrmConfiguration','int_sugarcrm_configurations','util'];(function(_0x4e40e4,_0xe34b01){var _0x33870c=function(_0x2aed03){while(--_0x2aed03){_0x4e40e4['push'](_0x4e40e4['shift']());}};_0x33870c(++_0xe34b01);}(_0x7262,0x180));var _0x2726=function(_0x514f33,_0x31451b){_0x514f33=_0x514f33-0x0;var _0x1b945c=_0x7262[_0x514f33];return _0x1b945c;};'use strict';var _=require('lodash');var util=require(_0x2726('0x0'));var logger=require(_0x2726('0x1'))(_0x2726('0x2'));var moment=require('moment');var BPromise=require(_0x2726('0x3'));var rp=require(_0x2726('0x4'));var fs=require('fs');var path=require(_0x2726('0x5'));var rimraf=require(_0x2726('0x6'));var config=require('../../config/environment');var attributes=require('./intSugarcrmConfiguration.attributes');module[_0x2726('0x7')]=function(_0x3d1d79,_0x1e6c43){return _0x3d1d79[_0x2726('0x8')](_0x2726('0x9'),attributes,{'tableName':_0x2726('0xa'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/intSugarcrmConfiguration/intSugarcrmConfiguration.rpc.js b/server/api/intSugarcrmConfiguration/intSugarcrmConfiguration.rpc.js index d8c1faf..4e1265f 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 _0x5530=['util','moment','bluebird','ioredis','../../mysqldb','../../config/utils','../../config/environment','jayson/promise','client','request','then','SugarcrmConfiguration,\x20%s,\x20%s','request\x20sent','debug','SugarcrmConfiguration,\x20%s,\x20%s,\x20%s','error','code','message','info'];(function(_0xe7c3f1,_0x12326f){var _0x1a0934=function(_0x2c3300){while(--_0x2c3300){_0xe7c3f1['push'](_0xe7c3f1['shift']());}};_0x1a0934(++_0x12326f);}(_0x5530,0xab));var _0x0553=function(_0x59383d,_0x1ea4ad){_0x59383d=_0x59383d-0x0;var _0x1fdd39=_0x5530[_0x59383d];return _0x1fdd39;};'use strict';var _=require('lodash');var util=require(_0x0553('0x0'));var moment=require(_0x0553('0x1'));var BPromise=require(_0x0553('0x2'));var rs=require('randomstring');var fs=require('fs');var Redis=require(_0x0553('0x3'));var db=require(_0x0553('0x4'))['db'];var utils=require(_0x0553('0x5'));var logger=require('../../config/logger')('rpc');var config=require(_0x0553('0x6'));var jayson=require(_0x0553('0x7'));var client=jayson[_0x0553('0x8')]['http']({'port':0x232a});function respondWithRpcPromise(_0x2db649,_0x2b11fb,_0x542070){return new BPromise(function(_0x2ade14,_0x58300b){return client[_0x0553('0x9')](_0x2db649,_0x542070)[_0x0553('0xa')](function(_0x3ba630){logger['info'](_0x0553('0xb'),_0x2b11fb,_0x0553('0xc'));logger[_0x0553('0xd')](_0x0553('0xe'),_0x2b11fb,'request\x20sent',JSON['stringify'](_0x3ba630));if(_0x3ba630['error']){if(_0x3ba630[_0x0553('0xf')][_0x0553('0x10')]===0x1f4){logger['error'](_0x0553('0xb'),_0x2b11fb,_0x3ba630['error']['message']);return _0x58300b(_0x3ba630['error'][_0x0553('0x11')]);}logger[_0x0553('0xf')](_0x0553('0xb'),_0x2b11fb,_0x3ba630[_0x0553('0xf')][_0x0553('0x11')]);return _0x2ade14(_0x3ba630['error'][_0x0553('0x11')]);}else{logger[_0x0553('0x12')](_0x0553('0xb'),_0x2b11fb,_0x0553('0xc'));_0x2ade14(_0x3ba630['result']['message']);}})['catch'](function(_0xbaa640){logger['error']('SugarcrmConfiguration,\x20%s,\x20%s',_0x2b11fb,_0xbaa640);_0x58300b(_0xbaa640);});});} \ No newline at end of file +var _0x13e1=['../../config/utils','rpc','../../config/environment','jayson/promise','client','http','request','then','info','SugarcrmConfiguration,\x20%s,\x20%s','request\x20sent','debug','SugarcrmConfiguration,\x20%s,\x20%s,\x20%s','stringify','error','code','message','lodash','util','moment','bluebird','randomstring','ioredis','../../mysqldb'];(function(_0x3fe717,_0x215ded){var _0x24ba6e=function(_0x5bc4ab){while(--_0x5bc4ab){_0x3fe717['push'](_0x3fe717['shift']());}};_0x24ba6e(++_0x215ded);}(_0x13e1,0x179));var _0x113e=function(_0x568d5b,_0x1fde4f){_0x568d5b=_0x568d5b-0x0;var _0x1b2222=_0x13e1[_0x568d5b];return _0x1b2222;};'use strict';var _=require(_0x113e('0x0'));var util=require(_0x113e('0x1'));var moment=require(_0x113e('0x2'));var BPromise=require(_0x113e('0x3'));var rs=require(_0x113e('0x4'));var fs=require('fs');var Redis=require(_0x113e('0x5'));var db=require(_0x113e('0x6'))['db'];var utils=require(_0x113e('0x7'));var logger=require('../../config/logger')(_0x113e('0x8'));var config=require(_0x113e('0x9'));var jayson=require(_0x113e('0xa'));var client=jayson[_0x113e('0xb')][_0x113e('0xc')]({'port':0x232a});function respondWithRpcPromise(_0xf09a2,_0x3cbd8d,_0x185e54){return new BPromise(function(_0x6756a1,_0x5a3d8c){return client[_0x113e('0xd')](_0xf09a2,_0x185e54)[_0x113e('0xe')](function(_0xfb0dbe){logger[_0x113e('0xf')](_0x113e('0x10'),_0x3cbd8d,_0x113e('0x11'));logger[_0x113e('0x12')](_0x113e('0x13'),_0x3cbd8d,'request\x20sent',JSON[_0x113e('0x14')](_0xfb0dbe));if(_0xfb0dbe[_0x113e('0x15')]){if(_0xfb0dbe[_0x113e('0x15')][_0x113e('0x16')]===0x1f4){logger[_0x113e('0x15')](_0x113e('0x10'),_0x3cbd8d,_0xfb0dbe[_0x113e('0x15')]['message']);return _0x5a3d8c(_0xfb0dbe['error']['message']);}logger[_0x113e('0x15')](_0x113e('0x10'),_0x3cbd8d,_0xfb0dbe[_0x113e('0x15')][_0x113e('0x17')]);return _0x6756a1(_0xfb0dbe[_0x113e('0x15')]['message']);}else{logger[_0x113e('0xf')](_0x113e('0x10'),_0x3cbd8d,'request\x20sent');_0x6756a1(_0xfb0dbe['result'][_0x113e('0x17')]);}})['catch'](function(_0x9357d4){logger[_0x113e('0x15')](_0x113e('0x10'),_0x3cbd8d,_0x9357d4);_0x5a3d8c(_0x9357d4);});});} \ No newline at end of file diff --git a/server/api/intSugarcrmField/index.js b/server/api/intSugarcrmField/index.js index ef7dff4..4080e74 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 _0x0d3b=['create','put','/:id','update','delete','destroy','exports','multer','express','../../components/auth/service','../../config/environment','get','isAuthenticated','index','show','post'];(function(_0x480298,_0x1ddc0b){var _0x186289=function(_0x2a6f74){while(--_0x2a6f74){_0x480298['push'](_0x480298['shift']());}};_0x186289(++_0x1ddc0b);}(_0x0d3b,0x157));var _0xb0d3=function(_0x14d45f,_0x475581){_0x14d45f=_0x14d45f-0x0;var _0x4ffa35=_0x0d3b[_0x14d45f];return _0x4ffa35;};'use strict';var multer=require(_0xb0d3('0x0'));var util=require('util');var path=require('path');var timeout=require('connect-timeout');var express=require(_0xb0d3('0x1'));var router=express['Router']();var fs_extra=require('fs-extra');var auth=require(_0xb0d3('0x2'));var interaction=require('../../components/interaction/service');var config=require(_0xb0d3('0x3'));var controller=require('./intSugarcrmField.controller');router[_0xb0d3('0x4')]('/',auth[_0xb0d3('0x5')](),controller[_0xb0d3('0x6')]);router[_0xb0d3('0x4')]('/:id',auth[_0xb0d3('0x5')](),controller[_0xb0d3('0x7')]);router[_0xb0d3('0x8')]('/',auth['isAuthenticated'](),controller[_0xb0d3('0x9')]);router[_0xb0d3('0xa')](_0xb0d3('0xb'),auth[_0xb0d3('0x5')](),controller[_0xb0d3('0xc')]);router[_0xb0d3('0xd')](_0xb0d3('0xb'),auth[_0xb0d3('0x5')](),controller[_0xb0d3('0xe')]);module[_0xb0d3('0xf')]=router; \ No newline at end of file +var _0x5865=['create','update','delete','destroy','exports','multer','util','express','Router','../../config/environment','isAuthenticated','get','/:id','show','post'];(function(_0x4b6ad7,_0xde57a1){var _0x5d30a0=function(_0x20f280){while(--_0x20f280){_0x4b6ad7['push'](_0x4b6ad7['shift']());}};_0x5d30a0(++_0xde57a1);}(_0x5865,0x104));var _0x5586=function(_0x3d4fa6,_0x5d2c63){_0x3d4fa6=_0x3d4fa6-0x0;var _0x5f46fd=_0x5865[_0x3d4fa6];return _0x5f46fd;};'use strict';var multer=require(_0x5586('0x0'));var util=require(_0x5586('0x1'));var path=require('path');var timeout=require('connect-timeout');var express=require(_0x5586('0x2'));var router=express[_0x5586('0x3')]();var fs_extra=require('fs-extra');var auth=require('../../components/auth/service');var interaction=require('../../components/interaction/service');var config=require(_0x5586('0x4'));var controller=require('./intSugarcrmField.controller');router['get']('/',auth[_0x5586('0x5')](),controller['index']);router[_0x5586('0x6')](_0x5586('0x7'),auth[_0x5586('0x5')](),controller[_0x5586('0x8')]);router[_0x5586('0x9')]('/',auth[_0x5586('0x5')](),controller[_0x5586('0xa')]);router['put']('/:id',auth[_0x5586('0x5')](),controller[_0x5586('0xb')]);router[_0x5586('0xc')](_0x5586('0x7'),auth['isAuthenticated'](),controller[_0x5586('0xd')]);module[_0x5586('0xe')]=router; \ No newline at end of file diff --git a/server/api/intSugarcrmField/intSugarcrmField.attributes.js b/server/api/intSugarcrmField/intSugarcrmField.attributes.js index 336beb0..0181075 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 _0xf881=['sequelize','exports','ENUM','variable','customVariable','keyValue','string','STRING'];(function(_0xcc3d40,_0x3c0f3c){var _0x4160a3=function(_0x6289e0){while(--_0x6289e0){_0xcc3d40['push'](_0xcc3d40['shift']());}};_0x4160a3(++_0x3c0f3c);}(_0xf881,0x108));var _0x1f88=function(_0x17c29f,_0x12fa1a){_0x17c29f=_0x17c29f-0x0;var _0x49a0a8=_0xf881[_0x17c29f];return _0x49a0a8;};'use strict';var Sequelize=require(_0x1f88('0x0'));module[_0x1f88('0x1')]={'type':{'type':Sequelize[_0x1f88('0x2')]('string',_0x1f88('0x3'),_0x1f88('0x4'),_0x1f88('0x5'),'picklist'),'defaultValue':_0x1f88('0x6')},'content':{'type':Sequelize[_0x1f88('0x7')]},'key':{'type':Sequelize[_0x1f88('0x7')]},'keyType':{'type':Sequelize['ENUM'](_0x1f88('0x6'),_0x1f88('0x3'),_0x1f88('0x4'))},'keyContent':{'type':Sequelize['STRING']},'idField':{'type':Sequelize[_0x1f88('0x7')]},'nameField':{'type':Sequelize['STRING']},'customField':{'type':Sequelize['BOOLEAN'],'defaultValue':!![]},'variableName':{'type':Sequelize['STRING']}}; \ No newline at end of file +var _0x15f1=['picklist','STRING','ENUM','string','variable','customVariable','keyValue'];(function(_0xc28591,_0xc61732){var _0x5b3a05=function(_0x28d497){while(--_0x28d497){_0xc28591['push'](_0xc28591['shift']());}};_0x5b3a05(++_0xc61732);}(_0x15f1,0xdb));var _0x115f=function(_0x85117b,_0x139034){_0x85117b=_0x85117b-0x0;var _0x31eec3=_0x15f1[_0x85117b];return _0x31eec3;};'use strict';var Sequelize=require('sequelize');module['exports']={'type':{'type':Sequelize[_0x115f('0x0')](_0x115f('0x1'),_0x115f('0x2'),_0x115f('0x3'),_0x115f('0x4'),_0x115f('0x5')),'defaultValue':'string'},'content':{'type':Sequelize[_0x115f('0x6')]},'key':{'type':Sequelize[_0x115f('0x6')]},'keyType':{'type':Sequelize[_0x115f('0x0')](_0x115f('0x1'),_0x115f('0x2'),_0x115f('0x3'))},'keyContent':{'type':Sequelize[_0x115f('0x6')]},'idField':{'type':Sequelize['STRING']},'nameField':{'type':Sequelize[_0x115f('0x6')]},'customField':{'type':Sequelize['BOOLEAN'],'defaultValue':!![]},'variableName':{'type':Sequelize[_0x115f('0x6')]}}; \ No newline at end of file diff --git a/server/api/intSugarcrmField/intSugarcrmField.controller.js b/server/api/intSugarcrmField/intSugarcrmField.controller.js index 7c782a7..ca26b95 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 _0x89e4=['type','model','query','filters','intersection','fields','attributes','hasOwnProperty','nolimit','limit','order','sort','where','filter','merge','options','includeAll','include','findAll','show','keys','length','find','catch','create','body','params','rimraf','zip-dir','request-promise','bluebird','util','path','to-csv','ejs','lodash','squel','crypto','jsforce','desk.js','querystring','papaparse','ioredis','../../components/parsers/advancedSearch','api','../../config/utils','../../config/license/util','status','json','offset','undefined','count','Content-Range','apply','reject','save','update','then','destroy','sendStatus','error','stack','name','send','map','SugarcrmField','rawAttributes'];(function(_0x20cbd2,_0xf0044c){var _0x396545=function(_0x5265f3){while(--_0x5265f3){_0x20cbd2['push'](_0x20cbd2['shift']());}};_0x396545(++_0xf0044c);}(_0x89e4,0x1ad));var _0x489e=function(_0x13c090,_0x244e5f){_0x13c090=_0x13c090-0x0;var _0x4ac72a=_0x89e4[_0x13c090];return _0x4ac72a;};'use strict';var emlformat=require('eml-format');var rimraf=require(_0x489e('0x0'));var zipdir=require(_0x489e('0x1'));var jsonpatch=require('fast-json-patch');var rp=require(_0x489e('0x2'));var moment=require('moment');var BPromise=require(_0x489e('0x3'));var Mustache=require('mustache');var util=require(_0x489e('0x4'));var path=require(_0x489e('0x5'));var sox=require('sox');var csv=require(_0x489e('0x6'));var ejs=require(_0x489e('0x7'));var fs=require('fs');var fs_extra=require('fs-extra');var _=require(_0x489e('0x8'));var squel=require(_0x489e('0x9'));var crypto=require(_0x489e('0xa'));var jsforce=require(_0x489e('0xb'));var deskjs=require(_0x489e('0xc'));var toCsv=require('to-csv');var querystring=require(_0x489e('0xd'));var Papa=require(_0x489e('0xe'));var Redis=require(_0x489e('0xf'));var authService=require('../../components/auth/service');var qs=require('../../components/parsers/qs');var as=require(_0x489e('0x10'));var hardwareService=require('../../config/license/hardware');var logger=require('../../config/logger')(_0x489e('0x11'));var utils=require(_0x489e('0x12'));var config=require('../../config/environment');var licenseUtil=require(_0x489e('0x13'));var db=require('../../mysqldb')['db'];function respondWithStatusCode(_0x3baae8,_0x596b79){_0x596b79=_0x596b79||0xcc;return function(_0x34bdb3){if(_0x34bdb3){return _0x3baae8['sendStatus'](_0x596b79);}return _0x3baae8[_0x489e('0x14')](_0x596b79)['end']();};}function respondWithResult(_0x237835,_0x49520f){_0x49520f=_0x49520f||0xc8;return function(_0x40b8be){if(_0x40b8be){return _0x237835[_0x489e('0x14')](_0x49520f)[_0x489e('0x15')](_0x40b8be);}};}function respondWithFilteredResult(_0x432130,_0x3d56ae){return function(_0x1cd602){if(_0x1cd602){var _0x33a194=typeof _0x3d56ae[_0x489e('0x16')]===_0x489e('0x17')&&typeof _0x3d56ae['limit']===_0x489e('0x17');var _0x3effd8=_0x1cd602[_0x489e('0x18')];var _0x17ae01=_0x33a194?0x0:_0x3d56ae['offset'];var _0x2a4cc1=_0x33a194?_0x1cd602[_0x489e('0x18')]:_0x3d56ae[_0x489e('0x16')]+_0x3d56ae['limit'];var _0x11ec7b;if(_0x2a4cc1>=_0x3effd8){_0x2a4cc1=_0x3effd8;_0x11ec7b=0xc8;}else{_0x11ec7b=0xce;}_0x432130[_0x489e('0x14')](_0x11ec7b);return _0x432130['set'](_0x489e('0x19'),_0x17ae01+'-'+_0x2a4cc1+'/'+_0x3effd8)[_0x489e('0x15')](_0x1cd602);}return null;};}function patchUpdates(_0x2fa0a7){return function(_0xfa8e3e){try{jsonpatch[_0x489e('0x1a')](_0xfa8e3e,_0x2fa0a7,!![]);}catch(_0x3735d4){return BPromise[_0x489e('0x1b')](_0x3735d4);}return _0xfa8e3e[_0x489e('0x1c')]();};}function saveUpdates(_0x2dbfc8,_0x49c390){return function(_0x55367b){if(_0x55367b){return _0x55367b[_0x489e('0x1d')](_0x2dbfc8)[_0x489e('0x1e')](function(_0x2f0709){return _0x2f0709;});}return null;};}function removeEntity(_0x202f3f,_0x136948){return function(_0x2e558d){if(_0x2e558d){return _0x2e558d[_0x489e('0x1f')]()[_0x489e('0x1e')](function(){_0x202f3f[_0x489e('0x14')](0xcc)['end']();});}};}function handleEntityNotFound(_0x2b80da,_0x2f0a60){return function(_0x524759){if(!_0x524759){_0x2b80da[_0x489e('0x20')](0x194);}return _0x524759;};}function handleError(_0xd3fe41,_0x78f082){_0x78f082=_0x78f082||0x1f4;return function(_0x1fddd1){logger[_0x489e('0x21')](_0x1fddd1[_0x489e('0x22')]);if(_0x1fddd1['name']){delete _0x1fddd1[_0x489e('0x23')];}_0xd3fe41['status'](_0x78f082)[_0x489e('0x24')](_0x1fddd1);};}exports['index']=function(_0x1a6e0b,_0x328d75){var _0x67d7f4={},_0x5726c2={},_0x23f7e5={'count':0x0,'rows':[]};var _0x3b7a00=_[_0x489e('0x25')](db[_0x489e('0x26')][_0x489e('0x27')],function(_0x195c1b){return{'name':_0x195c1b['fieldName'],'type':_0x195c1b[_0x489e('0x28')]['key']};});_0x5726c2[_0x489e('0x29')]=_[_0x489e('0x25')](_0x3b7a00,'name');_0x5726c2[_0x489e('0x2a')]=_['keys'](_0x1a6e0b['query']);_0x5726c2[_0x489e('0x2b')]=_[_0x489e('0x2c')](_0x5726c2['model'],_0x5726c2['query']);_0x67d7f4['attributes']=_[_0x489e('0x2c')](_0x5726c2[_0x489e('0x29')],qs['fields'](_0x1a6e0b[_0x489e('0x2a')][_0x489e('0x2d')]));_0x67d7f4['attributes']=_0x67d7f4[_0x489e('0x2e')]['length']?_0x67d7f4[_0x489e('0x2e')]:_0x5726c2['model'];if(!_0x1a6e0b['query'][_0x489e('0x2f')](_0x489e('0x30'))){_0x67d7f4['limit']=qs[_0x489e('0x31')](_0x1a6e0b[_0x489e('0x2a')][_0x489e('0x31')]);_0x67d7f4['offset']=qs[_0x489e('0x16')](_0x1a6e0b[_0x489e('0x2a')][_0x489e('0x16')]);}_0x67d7f4[_0x489e('0x32')]=qs[_0x489e('0x33')](_0x1a6e0b[_0x489e('0x2a')]['sort']);_0x67d7f4[_0x489e('0x34')]=qs[_0x489e('0x2b')](_['pick'](_0x1a6e0b[_0x489e('0x2a')],_0x5726c2[_0x489e('0x2b')]),_0x3b7a00);if(_0x1a6e0b[_0x489e('0x2a')][_0x489e('0x35')]){_0x67d7f4[_0x489e('0x34')]=_['merge'](_0x67d7f4['where'],{'$or':_[_0x489e('0x25')](_0x3b7a00,function(_0x4eff50){if(_0x4eff50[_0x489e('0x28')]!=='VIRTUAL'){var _0x339de8={};_0x339de8[_0x4eff50[_0x489e('0x23')]]={'$like':'%'+_0x1a6e0b[_0x489e('0x2a')][_0x489e('0x35')]+'%'};return _0x339de8;}})});}_0x67d7f4=_[_0x489e('0x36')]({},_0x67d7f4,_0x1a6e0b[_0x489e('0x37')]);var _0x9db3c4={'where':_0x67d7f4[_0x489e('0x34')]};return db['SugarcrmField'][_0x489e('0x18')](_0x9db3c4)[_0x489e('0x1e')](function(_0x52ed37){_0x23f7e5[_0x489e('0x18')]=_0x52ed37;if(_0x1a6e0b[_0x489e('0x2a')][_0x489e('0x38')]){_0x67d7f4[_0x489e('0x39')]=[{'all':!![]}];}return db[_0x489e('0x26')][_0x489e('0x3a')](_0x67d7f4);})[_0x489e('0x1e')](function(_0x4d3ca8){_0x23f7e5['rows']=_0x4d3ca8;return _0x23f7e5;})[_0x489e('0x1e')](respondWithFilteredResult(_0x328d75,_0x67d7f4))['catch'](handleError(_0x328d75,null));};exports[_0x489e('0x3b')]=function(_0x51fa88,_0x13cfef){var _0x42b611={'raw':!![],'where':{'id':_0x51fa88['params']['id']}},_0x19a3af={};_0x19a3af[_0x489e('0x29')]=_['keys'](db['SugarcrmField'][_0x489e('0x27')]);_0x19a3af['query']=_[_0x489e('0x3c')](_0x51fa88[_0x489e('0x2a')]);_0x19a3af[_0x489e('0x2b')]=_[_0x489e('0x2c')](_0x19a3af[_0x489e('0x29')],_0x19a3af[_0x489e('0x2a')]);_0x42b611[_0x489e('0x2e')]=_[_0x489e('0x2c')](_0x19a3af[_0x489e('0x29')],qs[_0x489e('0x2d')](_0x51fa88['query']['fields']));_0x42b611[_0x489e('0x2e')]=_0x42b611[_0x489e('0x2e')][_0x489e('0x3d')]?_0x42b611[_0x489e('0x2e')]:_0x19a3af[_0x489e('0x29')];if(_0x51fa88[_0x489e('0x2a')]['includeAll']){_0x42b611[_0x489e('0x39')]=[{'all':!![]}];}_0x42b611=_[_0x489e('0x36')]({},_0x42b611,_0x51fa88[_0x489e('0x37')]);return db['SugarcrmField'][_0x489e('0x3e')](_0x42b611)[_0x489e('0x1e')](handleEntityNotFound(_0x13cfef,null))['then'](respondWithResult(_0x13cfef,null))[_0x489e('0x3f')](handleError(_0x13cfef,null));};exports[_0x489e('0x40')]=function(_0x59aa7b,_0x4b067f){return db['SugarcrmField']['create'](_0x59aa7b[_0x489e('0x41')],{})['then'](respondWithResult(_0x4b067f,0xc9))[_0x489e('0x3f')](handleError(_0x4b067f,null));};exports['update']=function(_0x2a373d,_0x3c0168){if(_0x2a373d[_0x489e('0x41')]['id']){delete _0x2a373d['body']['id'];}return db['SugarcrmField'][_0x489e('0x3e')]({'where':{'id':_0x2a373d['params']['id']}})[_0x489e('0x1e')](handleEntityNotFound(_0x3c0168,null))[_0x489e('0x1e')](saveUpdates(_0x2a373d['body'],null))[_0x489e('0x1e')](respondWithResult(_0x3c0168,null))[_0x489e('0x3f')](handleError(_0x3c0168,null));};exports[_0x489e('0x1f')]=function(_0xdb6af5,_0x379d4b){return db['SugarcrmField'][_0x489e('0x3e')]({'where':{'id':_0xdb6af5[_0x489e('0x42')]['id']}})[_0x489e('0x1e')](handleEntityNotFound(_0x379d4b,null))[_0x489e('0x1e')](removeEntity(_0x379d4b,null))['catch'](handleError(_0x379d4b,null));}; \ No newline at end of file +var _0xf604=['lodash','squel','crypto','jsforce','desk.js','to-csv','querystring','papaparse','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/environment','../../mysqldb','status','end','json','offset','undefined','limit','count','set','apply','reject','save','update','then','error','stack','name','send','index','map','SugarcrmField','rawAttributes','fieldName','query','keys','filters','intersection','model','attributes','fields','length','hasOwnProperty','order','pick','filter','where','merge','type','VIRTUAL','options','findAll','catch','show','params','includeAll','include','create','body','find','destroy','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','bluebird','mustache','sox','ejs','fs-extra'];(function(_0x3f670b,_0x168bf5){var _0x526c1a=function(_0x4fec2b){while(--_0x4fec2b){_0x3f670b['push'](_0x3f670b['shift']());}};_0x526c1a(++_0x168bf5);}(_0xf604,0x122));var _0x4f60=function(_0x547bb6,_0x2d6f27){_0x547bb6=_0x547bb6-0x0;var _0x1a9154=_0xf604[_0x547bb6];return _0x1a9154;};'use strict';var emlformat=require(_0x4f60('0x0'));var rimraf=require(_0x4f60('0x1'));var zipdir=require(_0x4f60('0x2'));var jsonpatch=require(_0x4f60('0x3'));var rp=require(_0x4f60('0x4'));var moment=require('moment');var BPromise=require(_0x4f60('0x5'));var Mustache=require(_0x4f60('0x6'));var util=require('util');var path=require('path');var sox=require(_0x4f60('0x7'));var csv=require('to-csv');var ejs=require(_0x4f60('0x8'));var fs=require('fs');var fs_extra=require(_0x4f60('0x9'));var _=require(_0x4f60('0xa'));var squel=require(_0x4f60('0xb'));var crypto=require(_0x4f60('0xc'));var jsforce=require(_0x4f60('0xd'));var deskjs=require(_0x4f60('0xe'));var toCsv=require(_0x4f60('0xf'));var querystring=require(_0x4f60('0x10'));var Papa=require(_0x4f60('0x11'));var Redis=require('ioredis');var authService=require(_0x4f60('0x12'));var qs=require(_0x4f60('0x13'));var as=require(_0x4f60('0x14'));var hardwareService=require(_0x4f60('0x15'));var logger=require(_0x4f60('0x16'))(_0x4f60('0x17'));var utils=require('../../config/utils');var config=require(_0x4f60('0x18'));var licenseUtil=require('../../config/license/util');var db=require(_0x4f60('0x19'))['db'];function respondWithStatusCode(_0x20ff90,_0x441bad){_0x441bad=_0x441bad||0xcc;return function(_0x413e83){if(_0x413e83){return _0x20ff90['sendStatus'](_0x441bad);}return _0x20ff90[_0x4f60('0x1a')](_0x441bad)[_0x4f60('0x1b')]();};}function respondWithResult(_0x296ad1,_0x40332f){_0x40332f=_0x40332f||0xc8;return function(_0x2084e9){if(_0x2084e9){return _0x296ad1['status'](_0x40332f)[_0x4f60('0x1c')](_0x2084e9);}};}function respondWithFilteredResult(_0x38bad1,_0x307e4f){return function(_0x58436b){if(_0x58436b){var _0x54a98d=typeof _0x307e4f[_0x4f60('0x1d')]===_0x4f60('0x1e')&&typeof _0x307e4f[_0x4f60('0x1f')]==='undefined';var _0x1ce539=_0x58436b[_0x4f60('0x20')];var _0x171c10=_0x54a98d?0x0:_0x307e4f[_0x4f60('0x1d')];var _0x39529c=_0x54a98d?_0x58436b[_0x4f60('0x20')]:_0x307e4f['offset']+_0x307e4f[_0x4f60('0x1f')];var _0x34b592;if(_0x39529c>=_0x1ce539){_0x39529c=_0x1ce539;_0x34b592=0xc8;}else{_0x34b592=0xce;}_0x38bad1['status'](_0x34b592);return _0x38bad1[_0x4f60('0x21')]('Content-Range',_0x171c10+'-'+_0x39529c+'/'+_0x1ce539)[_0x4f60('0x1c')](_0x58436b);}return null;};}function patchUpdates(_0x14c57f){return function(_0x3c797d){try{jsonpatch[_0x4f60('0x22')](_0x3c797d,_0x14c57f,!![]);}catch(_0x54abfc){return BPromise[_0x4f60('0x23')](_0x54abfc);}return _0x3c797d[_0x4f60('0x24')]();};}function saveUpdates(_0x9a5982,_0x5951c8){return function(_0x5f08be){if(_0x5f08be){return _0x5f08be[_0x4f60('0x25')](_0x9a5982)[_0x4f60('0x26')](function(_0x300397){return _0x300397;});}return null;};}function removeEntity(_0x36ea2a,_0xa8e2af){return function(_0x42561c){if(_0x42561c){return _0x42561c['destroy']()[_0x4f60('0x26')](function(){_0x36ea2a[_0x4f60('0x1a')](0xcc)[_0x4f60('0x1b')]();});}};}function handleEntityNotFound(_0x503006,_0x38ef90){return function(_0x3f3e93){if(!_0x3f3e93){_0x503006['sendStatus'](0x194);}return _0x3f3e93;};}function handleError(_0x49c3e2,_0x44fbde){_0x44fbde=_0x44fbde||0x1f4;return function(_0x3f2784){logger[_0x4f60('0x27')](_0x3f2784[_0x4f60('0x28')]);if(_0x3f2784[_0x4f60('0x29')]){delete _0x3f2784[_0x4f60('0x29')];}_0x49c3e2[_0x4f60('0x1a')](_0x44fbde)[_0x4f60('0x2a')](_0x3f2784);};}exports[_0x4f60('0x2b')]=function(_0x360036,_0x3ae11e){var _0x8c25f3={},_0x45606a={},_0x3d287c={'count':0x0,'rows':[]};var _0x24f060=_[_0x4f60('0x2c')](db[_0x4f60('0x2d')][_0x4f60('0x2e')],function(_0x365ebf){return{'name':_0x365ebf[_0x4f60('0x2f')],'type':_0x365ebf['type']['key']};});_0x45606a['model']=_[_0x4f60('0x2c')](_0x24f060,'name');_0x45606a[_0x4f60('0x30')]=_[_0x4f60('0x31')](_0x360036[_0x4f60('0x30')]);_0x45606a[_0x4f60('0x32')]=_[_0x4f60('0x33')](_0x45606a[_0x4f60('0x34')],_0x45606a[_0x4f60('0x30')]);_0x8c25f3[_0x4f60('0x35')]=_[_0x4f60('0x33')](_0x45606a[_0x4f60('0x34')],qs[_0x4f60('0x36')](_0x360036['query']['fields']));_0x8c25f3[_0x4f60('0x35')]=_0x8c25f3['attributes'][_0x4f60('0x37')]?_0x8c25f3[_0x4f60('0x35')]:_0x45606a[_0x4f60('0x34')];if(!_0x360036[_0x4f60('0x30')][_0x4f60('0x38')]('nolimit')){_0x8c25f3[_0x4f60('0x1f')]=qs[_0x4f60('0x1f')](_0x360036[_0x4f60('0x30')][_0x4f60('0x1f')]);_0x8c25f3[_0x4f60('0x1d')]=qs[_0x4f60('0x1d')](_0x360036['query'][_0x4f60('0x1d')]);}_0x8c25f3[_0x4f60('0x39')]=qs['sort'](_0x360036[_0x4f60('0x30')]['sort']);_0x8c25f3['where']=qs[_0x4f60('0x32')](_[_0x4f60('0x3a')](_0x360036[_0x4f60('0x30')],_0x45606a[_0x4f60('0x32')]),_0x24f060);if(_0x360036['query'][_0x4f60('0x3b')]){_0x8c25f3[_0x4f60('0x3c')]=_[_0x4f60('0x3d')](_0x8c25f3['where'],{'$or':_['map'](_0x24f060,function(_0x24198d){if(_0x24198d[_0x4f60('0x3e')]!==_0x4f60('0x3f')){var _0x1d2e6c={};_0x1d2e6c[_0x24198d[_0x4f60('0x29')]]={'$like':'%'+_0x360036[_0x4f60('0x30')][_0x4f60('0x3b')]+'%'};return _0x1d2e6c;}})});}_0x8c25f3=_[_0x4f60('0x3d')]({},_0x8c25f3,_0x360036[_0x4f60('0x40')]);var _0x4bb855={'where':_0x8c25f3[_0x4f60('0x3c')]};return db[_0x4f60('0x2d')]['count'](_0x4bb855)['then'](function(_0x81febb){_0x3d287c[_0x4f60('0x20')]=_0x81febb;if(_0x360036[_0x4f60('0x30')]['includeAll']){_0x8c25f3['include']=[{'all':!![]}];}return db[_0x4f60('0x2d')][_0x4f60('0x41')](_0x8c25f3);})[_0x4f60('0x26')](function(_0x35ead9){_0x3d287c['rows']=_0x35ead9;return _0x3d287c;})[_0x4f60('0x26')](respondWithFilteredResult(_0x3ae11e,_0x8c25f3))[_0x4f60('0x42')](handleError(_0x3ae11e,null));};exports[_0x4f60('0x43')]=function(_0x5c5091,_0xaa9196){var _0x1dab17={'raw':!![],'where':{'id':_0x5c5091[_0x4f60('0x44')]['id']}},_0xbddea2={};_0xbddea2[_0x4f60('0x34')]=_[_0x4f60('0x31')](db['SugarcrmField'][_0x4f60('0x2e')]);_0xbddea2[_0x4f60('0x30')]=_[_0x4f60('0x31')](_0x5c5091['query']);_0xbddea2['filters']=_[_0x4f60('0x33')](_0xbddea2[_0x4f60('0x34')],_0xbddea2[_0x4f60('0x30')]);_0x1dab17[_0x4f60('0x35')]=_[_0x4f60('0x33')](_0xbddea2[_0x4f60('0x34')],qs['fields'](_0x5c5091[_0x4f60('0x30')][_0x4f60('0x36')]));_0x1dab17[_0x4f60('0x35')]=_0x1dab17[_0x4f60('0x35')][_0x4f60('0x37')]?_0x1dab17[_0x4f60('0x35')]:_0xbddea2[_0x4f60('0x34')];if(_0x5c5091[_0x4f60('0x30')][_0x4f60('0x45')]){_0x1dab17[_0x4f60('0x46')]=[{'all':!![]}];}_0x1dab17=_['merge']({},_0x1dab17,_0x5c5091[_0x4f60('0x40')]);return db['SugarcrmField']['find'](_0x1dab17)[_0x4f60('0x26')](handleEntityNotFound(_0xaa9196,null))['then'](respondWithResult(_0xaa9196,null))[_0x4f60('0x42')](handleError(_0xaa9196,null));};exports[_0x4f60('0x47')]=function(_0x1be0a0,_0x3bee19){return db[_0x4f60('0x2d')][_0x4f60('0x47')](_0x1be0a0[_0x4f60('0x48')],{})['then'](respondWithResult(_0x3bee19,0xc9))['catch'](handleError(_0x3bee19,null));};exports[_0x4f60('0x25')]=function(_0x1cd2b5,_0xd61717){if(_0x1cd2b5[_0x4f60('0x48')]['id']){delete _0x1cd2b5['body']['id'];}return db[_0x4f60('0x2d')][_0x4f60('0x49')]({'where':{'id':_0x1cd2b5[_0x4f60('0x44')]['id']}})[_0x4f60('0x26')](handleEntityNotFound(_0xd61717,null))[_0x4f60('0x26')](saveUpdates(_0x1cd2b5['body'],null))[_0x4f60('0x26')](respondWithResult(_0xd61717,null))[_0x4f60('0x42')](handleError(_0xd61717,null));};exports[_0x4f60('0x4a')]=function(_0x2844e5,_0x2ac2f2){return db['SugarcrmField']['find']({'where':{'id':_0x2844e5[_0x4f60('0x44')]['id']}})[_0x4f60('0x26')](handleEntityNotFound(_0x2ac2f2,null))[_0x4f60('0x26')](removeEntity(_0x2ac2f2,null))['catch'](handleError(_0x2ac2f2,null));}; \ No newline at end of file diff --git a/server/api/intSugarcrmField/intSugarcrmField.model.js b/server/api/intSugarcrmField/intSugarcrmField.model.js index e69e99a..c55630f 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 _0xb0c7=['../../config/environment','./intSugarcrmField.attributes','exports','define','SugarcrmField','int_sugarcrm_fields','sugarcrm_unique_index','FieldId','util','api','moment','bluebird','request-promise','rimraf'];(function(_0x42cae2,_0x284ef8){var _0x5f256f=function(_0x41abc8){while(--_0x41abc8){_0x42cae2['push'](_0x42cae2['shift']());}};_0x5f256f(++_0x284ef8);}(_0xb0c7,0xe8));var _0x7b0c=function(_0x183b97,_0x2d297c){_0x183b97=_0x183b97-0x0;var _0x629cf7=_0xb0c7[_0x183b97];return _0x629cf7;};'use strict';var _=require('lodash');var util=require(_0x7b0c('0x0'));var logger=require('../../config/logger')(_0x7b0c('0x1'));var moment=require(_0x7b0c('0x2'));var BPromise=require(_0x7b0c('0x3'));var rp=require(_0x7b0c('0x4'));var fs=require('fs');var path=require('path');var rimraf=require(_0x7b0c('0x5'));var config=require(_0x7b0c('0x6'));var attributes=require(_0x7b0c('0x7'));module[_0x7b0c('0x8')]=function(_0x35f4b0,_0x3e3dc7){return _0x35f4b0[_0x7b0c('0x9')](_0x7b0c('0xa'),attributes,{'tableName':_0x7b0c('0xb'),'paranoid':![],'indexes':[{'name':_0x7b0c('0xc'),'fields':['idField',_0x7b0c('0xd')],'unique':!![]}],'timestamps':!![]});}; \ No newline at end of file +var _0xc6fe=['exports','define','int_sugarcrm_fields','sugarcrm_unique_index','idField','FieldId','util','../../config/logger','api','moment','bluebird','request-promise','path','rimraf','../../config/environment'];(function(_0x331663,_0x56b338){var _0x1d7e64=function(_0xc6c075){while(--_0xc6c075){_0x331663['push'](_0x331663['shift']());}};_0x1d7e64(++_0x56b338);}(_0xc6fe,0xab));var _0xec6f=function(_0x46118a,_0x27d887){_0x46118a=_0x46118a-0x0;var _0x1b076c=_0xc6fe[_0x46118a];return _0x1b076c;};'use strict';var _=require('lodash');var util=require(_0xec6f('0x0'));var logger=require(_0xec6f('0x1'))(_0xec6f('0x2'));var moment=require(_0xec6f('0x3'));var BPromise=require(_0xec6f('0x4'));var rp=require(_0xec6f('0x5'));var fs=require('fs');var path=require(_0xec6f('0x6'));var rimraf=require(_0xec6f('0x7'));var config=require(_0xec6f('0x8'));var attributes=require('./intSugarcrmField.attributes');module[_0xec6f('0x9')]=function(_0x2a69e8,_0x2e36fa){return _0x2a69e8[_0xec6f('0xa')]('SugarcrmField',attributes,{'tableName':_0xec6f('0xb'),'paranoid':![],'indexes':[{'name':_0xec6f('0xc'),'fields':[_0xec6f('0xd'),_0xec6f('0xe')],'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 c7652a0..dbbb07c 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 _0x6c63=['then','info','SugarcrmField,\x20%s,\x20%s','request\x20sent','SugarcrmField,\x20%s,\x20%s,\x20%s','error','code','message','catch','util','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','rpc','../../config/environment','jayson/promise','http','request'];(function(_0x201464,_0x48ce10){var _0x2672c6=function(_0x1a35d4){while(--_0x1a35d4){_0x201464['push'](_0x201464['shift']());}};_0x2672c6(++_0x48ce10);}(_0x6c63,0x198));var _0x36c6=function(_0x4719c6,_0x555702){_0x4719c6=_0x4719c6-0x0;var _0x288d2a=_0x6c63[_0x4719c6];return _0x288d2a;};'use strict';var _=require('lodash');var util=require(_0x36c6('0x0'));var moment=require(_0x36c6('0x1'));var BPromise=require(_0x36c6('0x2'));var rs=require(_0x36c6('0x3'));var fs=require('fs');var Redis=require(_0x36c6('0x4'));var db=require(_0x36c6('0x5'))['db'];var utils=require(_0x36c6('0x6'));var logger=require('../../config/logger')(_0x36c6('0x7'));var config=require(_0x36c6('0x8'));var jayson=require(_0x36c6('0x9'));var client=jayson['client'][_0x36c6('0xa')]({'port':0x232a});function respondWithRpcPromise(_0x1c4f98,_0x3718aa,_0x225f78){return new BPromise(function(_0x3421d6,_0x5dd8f4){return client[_0x36c6('0xb')](_0x1c4f98,_0x225f78)[_0x36c6('0xc')](function(_0x5e5765){logger[_0x36c6('0xd')](_0x36c6('0xe'),_0x3718aa,_0x36c6('0xf'));logger['debug'](_0x36c6('0x10'),_0x3718aa,_0x36c6('0xf'),JSON['stringify'](_0x5e5765));if(_0x5e5765[_0x36c6('0x11')]){if(_0x5e5765[_0x36c6('0x11')][_0x36c6('0x12')]===0x1f4){logger[_0x36c6('0x11')](_0x36c6('0xe'),_0x3718aa,_0x5e5765[_0x36c6('0x11')][_0x36c6('0x13')]);return _0x5dd8f4(_0x5e5765[_0x36c6('0x11')][_0x36c6('0x13')]);}logger[_0x36c6('0x11')]('SugarcrmField,\x20%s,\x20%s',_0x3718aa,_0x5e5765[_0x36c6('0x11')][_0x36c6('0x13')]);return _0x3421d6(_0x5e5765[_0x36c6('0x11')][_0x36c6('0x13')]);}else{logger['info'](_0x36c6('0xe'),_0x3718aa,_0x36c6('0xf'));_0x3421d6(_0x5e5765['result'][_0x36c6('0x13')]);}})[_0x36c6('0x14')](function(_0x54c380){logger[_0x36c6('0x11')](_0x36c6('0xe'),_0x3718aa,_0x54c380);_0x5dd8f4(_0x54c380);});});} \ No newline at end of file +var _0xde6c=['bluebird','randomstring','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','client','http','request','info','request\x20sent','debug','stringify','error','code','SugarcrmField,\x20%s,\x20%s','message','result','catch','lodash','util','moment'];(function(_0x3c36fd,_0x1104bc){var _0x3fd265=function(_0x38bee6){while(--_0x38bee6){_0x3c36fd['push'](_0x3c36fd['shift']());}};_0x3fd265(++_0x1104bc);}(_0xde6c,0x9e));var _0xcde6=function(_0x5265d5,_0x51a837){_0x5265d5=_0x5265d5-0x0;var _0x44899d=_0xde6c[_0x5265d5];return _0x44899d;};'use strict';var _=require(_0xcde6('0x0'));var util=require(_0xcde6('0x1'));var moment=require(_0xcde6('0x2'));var BPromise=require(_0xcde6('0x3'));var rs=require(_0xcde6('0x4'));var fs=require('fs');var Redis=require('ioredis');var db=require(_0xcde6('0x5'))['db'];var utils=require(_0xcde6('0x6'));var logger=require(_0xcde6('0x7'))(_0xcde6('0x8'));var config=require(_0xcde6('0x9'));var jayson=require('jayson/promise');var client=jayson[_0xcde6('0xa')][_0xcde6('0xb')]({'port':0x232a});function respondWithRpcPromise(_0x4ab364,_0x63cff5,_0x38a0dc){return new BPromise(function(_0x34a10a,_0x45e950){return client[_0xcde6('0xc')](_0x4ab364,_0x38a0dc)['then'](function(_0x7594fd){logger[_0xcde6('0xd')]('SugarcrmField,\x20%s,\x20%s',_0x63cff5,_0xcde6('0xe'));logger[_0xcde6('0xf')]('SugarcrmField,\x20%s,\x20%s,\x20%s',_0x63cff5,_0xcde6('0xe'),JSON[_0xcde6('0x10')](_0x7594fd));if(_0x7594fd[_0xcde6('0x11')]){if(_0x7594fd[_0xcde6('0x11')][_0xcde6('0x12')]===0x1f4){logger['error'](_0xcde6('0x13'),_0x63cff5,_0x7594fd['error'][_0xcde6('0x14')]);return _0x45e950(_0x7594fd[_0xcde6('0x11')]['message']);}logger[_0xcde6('0x11')]('SugarcrmField,\x20%s,\x20%s',_0x63cff5,_0x7594fd[_0xcde6('0x11')]['message']);return _0x34a10a(_0x7594fd[_0xcde6('0x11')]['message']);}else{logger[_0xcde6('0xd')](_0xcde6('0x13'),_0x63cff5,_0xcde6('0xe'));_0x34a10a(_0x7594fd[_0xcde6('0x15')][_0xcde6('0x14')]);}})[_0xcde6('0x16')](function(_0x241c7a){logger['error'](_0xcde6('0x13'),_0x63cff5,_0x241c7a);_0x45e950(_0x241c7a);});});} \ No newline at end of file diff --git a/server/api/intVtigerAccount/index.js b/server/api/intVtigerAccount/index.js index 43a9667..713c656 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 _0xbe83=['connect-timeout','express','Router','../../components/auth/service','../../components/interaction/service','../../config/environment','./intVtigerAccount.controller','isAuthenticated','index','get','show','/:id/configurations','getConfigurations','getFields','create','post','addConfiguration','put','update','delete','/:id','destroy','multer','path'];(function(_0x2c562c,_0x564b18){var _0x2ef340=function(_0x5f507b){while(--_0x5f507b){_0x2c562c['push'](_0x2c562c['shift']());}};_0x2ef340(++_0x564b18);}(_0xbe83,0xee));var _0x3be8=function(_0x18b8ad,_0x1fd4b4){_0x18b8ad=_0x18b8ad-0x0;var _0x12a83d=_0xbe83[_0x18b8ad];return _0x12a83d;};'use strict';var multer=require(_0x3be8('0x0'));var util=require('util');var path=require(_0x3be8('0x1'));var timeout=require(_0x3be8('0x2'));var express=require(_0x3be8('0x3'));var router=express[_0x3be8('0x4')]();var fs_extra=require('fs-extra');var auth=require(_0x3be8('0x5'));var interaction=require(_0x3be8('0x6'));var config=require(_0x3be8('0x7'));var controller=require(_0x3be8('0x8'));router['get']('/',auth[_0x3be8('0x9')](),controller[_0x3be8('0xa')]);router[_0x3be8('0xb')]('/:id',auth[_0x3be8('0x9')](),controller[_0x3be8('0xc')]);router[_0x3be8('0xb')](_0x3be8('0xd'),auth[_0x3be8('0x9')](),controller[_0x3be8('0xe')]);router[_0x3be8('0xb')]('/:id/fields',auth[_0x3be8('0x9')](),controller[_0x3be8('0xf')]);router['post']('/',auth[_0x3be8('0x9')](),controller[_0x3be8('0x10')]);router[_0x3be8('0x11')]('/:id/configurations',auth[_0x3be8('0x9')](),controller[_0x3be8('0x12')]);router[_0x3be8('0x13')]('/:id',auth[_0x3be8('0x9')](),controller[_0x3be8('0x14')]);router[_0x3be8('0x15')](_0x3be8('0x16'),auth[_0x3be8('0x9')](),controller[_0x3be8('0x17')]);module['exports']=router; \ No newline at end of file +var _0xc18a=['exports','multer','util','path','connect-timeout','Router','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','./intVtigerAccount.controller','get','isAuthenticated','/:id','show','/:id/configurations','getConfigurations','/:id/fields','getFields','post','delete','destroy'];(function(_0x29bd13,_0x32c008){var _0xec311e=function(_0x9f6505){while(--_0x9f6505){_0x29bd13['push'](_0x29bd13['shift']());}};_0xec311e(++_0x32c008);}(_0xc18a,0x1cf));var _0xac18=function(_0x1ed555,_0x163bb2){_0x1ed555=_0x1ed555-0x0;var _0x2ade3d=_0xc18a[_0x1ed555];return _0x2ade3d;};'use strict';var multer=require(_0xac18('0x0'));var util=require(_0xac18('0x1'));var path=require(_0xac18('0x2'));var timeout=require(_0xac18('0x3'));var express=require('express');var router=express[_0xac18('0x4')]();var fs_extra=require(_0xac18('0x5'));var auth=require(_0xac18('0x6'));var interaction=require(_0xac18('0x7'));var config=require(_0xac18('0x8'));var controller=require(_0xac18('0x9'));router[_0xac18('0xa')]('/',auth[_0xac18('0xb')](),controller['index']);router[_0xac18('0xa')](_0xac18('0xc'),auth[_0xac18('0xb')](),controller[_0xac18('0xd')]);router[_0xac18('0xa')](_0xac18('0xe'),auth[_0xac18('0xb')](),controller[_0xac18('0xf')]);router[_0xac18('0xa')](_0xac18('0x10'),auth[_0xac18('0xb')](),controller[_0xac18('0x11')]);router[_0xac18('0x12')]('/',auth[_0xac18('0xb')](),controller['create']);router[_0xac18('0x12')]('/:id/configurations',auth[_0xac18('0xb')](),controller['addConfiguration']);router['put'](_0xac18('0xc'),auth['isAuthenticated'](),controller['update']);router[_0xac18('0x13')](_0xac18('0xc'),auth['isAuthenticated'](),controller[_0xac18('0x14')]);module[_0xac18('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 ede656b..0f50313 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 _0x826d=['sequelize','STRING','HelpDesk'];(function(_0x11acdb,_0x4b0b11){var _0x4783f1=function(_0xd94735){while(--_0xd94735){_0x11acdb['push'](_0x11acdb['shift']());}};_0x4783f1(++_0x4b0b11);}(_0x826d,0x10b));var _0xd826=function(_0x2776c0,_0x3bdc05){_0x2776c0=_0x2776c0-0x0;var _0x42b7b7=_0x826d[_0x2776c0];return _0x42b7b7;};'use strict';var Sequelize=require(_0xd826('0x0'));module['exports']={'name':{'type':Sequelize['STRING'],'allowNull':![]},'description':{'type':Sequelize[_0xd826('0x1')]},'username':{'type':Sequelize[_0xd826('0x1')],'allowNull':![]},'moduleName':{'type':Sequelize['STRING'],'allowNull':![],'defaultValue':_0xd826('0x2')},'remoteUri':{'type':Sequelize[_0xd826('0x1')],'allowNull':![]},'serverUrl':{'type':Sequelize[_0xd826('0x1')],'allowNull':![]},'accessKey':{'type':Sequelize[_0xd826('0x1')],'allowNull':![]}}; \ No newline at end of file +var _0xc177=['exports','STRING','HelpDesk','sequelize'];(function(_0x14add3,_0x13ce8d){var _0x4a174f=function(_0x2b3ed7){while(--_0x2b3ed7){_0x14add3['push'](_0x14add3['shift']());}};_0x4a174f(++_0x13ce8d);}(_0xc177,0x17f));var _0x7c17=function(_0x471231,_0x534b9b){_0x471231=_0x471231-0x0;var _0x2ad89e=_0xc177[_0x471231];return _0x2ad89e;};'use strict';var Sequelize=require(_0x7c17('0x0'));module[_0x7c17('0x1')]={'name':{'type':Sequelize['STRING'],'allowNull':![]},'description':{'type':Sequelize[_0x7c17('0x2')]},'username':{'type':Sequelize['STRING'],'allowNull':![]},'moduleName':{'type':Sequelize[_0x7c17('0x2')],'allowNull':![],'defaultValue':_0x7c17('0x3')},'remoteUri':{'type':Sequelize[_0x7c17('0x2')],'allowNull':![]},'serverUrl':{'type':Sequelize[_0x7c17('0x2')],'allowNull':![]},'accessKey':{'type':Sequelize[_0x7c17('0x2')],'allowNull':![]}}; \ No newline at end of file diff --git a/server/api/intVtigerAccount/intVtigerAccount.controller.js b/server/api/intVtigerAccount/intVtigerAccount.controller.js index e3729fe..5582228 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 _0xcb2f=['description','moduleName','remoteUri','serverUrl','accessKey','slice','substring','lastIndexOf','format','%s/webservice.php','GET','getchallenge','success','POST','login','token','describe','result','sessionName','autogenerated','reference','owner','remove','includes','editable','label','startsWith','cf_','picklist','picklistValues','value','log','vTiger\x20error:\x20','test','statusCode','error','getFields,\x20%s,\x20%s,\x20%s','stringify','send','Wrong\x20credentials','rimraf','fast-json-patch','request-promise','moment','bluebird','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','api','../../config/utils','../../config/license/util','../../mysqldb','../../components/integrations/configuration','sendStatus','status','end','json','offset','undefined','limit','count','set','Content-Range','reject','save','update','then','destroy','stack','name','map','VtigerAccount','rawAttributes','fieldName','model','keys','query','filters','intersection','attributes','fields','length','hasOwnProperty','nolimit','order','sort','where','pick','merge','type','filter','options','includeAll','include','findAll','rows','catch','show','params','find','create','body','getConfigurations','addConfiguration','findOne','AccountId','Subjects','getSubjects','Descriptions','getDescriptions','channel','VtigerConfiguration','VtigerField','md5','getFields','username'];(function(_0x40a045,_0x516f0e){var _0x1a687c=function(_0x48c9fe){while(--_0x48c9fe){_0x40a045['push'](_0x40a045['shift']());}};_0x1a687c(++_0x516f0e);}(_0xcb2f,0x12a));var _0xfcb2=function(_0x241bdd,_0x2d0fd2){_0x241bdd=_0x241bdd-0x0;var _0x45ccfd=_0xcb2f[_0x241bdd];return _0x45ccfd;};'use strict';var emlformat=require('eml-format');var rimraf=require(_0xfcb2('0x0'));var zipdir=require('zip-dir');var jsonpatch=require(_0xfcb2('0x1'));var rp=require(_0xfcb2('0x2'));var moment=require(_0xfcb2('0x3'));var BPromise=require(_0xfcb2('0x4'));var Mustache=require('mustache');var util=require('util');var path=require(_0xfcb2('0x5'));var sox=require('sox');var csv=require(_0xfcb2('0x6'));var ejs=require(_0xfcb2('0x7'));var fs=require('fs');var fs_extra=require(_0xfcb2('0x8'));var _=require(_0xfcb2('0x9'));var squel=require(_0xfcb2('0xa'));var crypto=require(_0xfcb2('0xb'));var jsforce=require(_0xfcb2('0xc'));var deskjs=require(_0xfcb2('0xd'));var toCsv=require(_0xfcb2('0x6'));var querystring=require(_0xfcb2('0xe'));var Papa=require(_0xfcb2('0xf'));var Redis=require(_0xfcb2('0x10'));var authService=require(_0xfcb2('0x11'));var qs=require(_0xfcb2('0x12'));var as=require(_0xfcb2('0x13'));var hardwareService=require(_0xfcb2('0x14'));var logger=require('../../config/logger')(_0xfcb2('0x15'));var utils=require(_0xfcb2('0x16'));var config=require('../../config/environment');var licenseUtil=require(_0xfcb2('0x17'));var db=require(_0xfcb2('0x18'))['db'];var integrations=require(_0xfcb2('0x19'));function respondWithStatusCode(_0x142641,_0x3707e1){_0x3707e1=_0x3707e1||0xcc;return function(_0x5a50f2){if(_0x5a50f2){return _0x142641[_0xfcb2('0x1a')](_0x3707e1);}return _0x142641[_0xfcb2('0x1b')](_0x3707e1)[_0xfcb2('0x1c')]();};}function respondWithResult(_0x4a5149,_0x2d260b){_0x2d260b=_0x2d260b||0xc8;return function(_0x5bef67){if(_0x5bef67){return _0x4a5149[_0xfcb2('0x1b')](_0x2d260b)[_0xfcb2('0x1d')](_0x5bef67);}};}function respondWithFilteredResult(_0x182db5,_0x454eb1){return function(_0x33160d){if(_0x33160d){var _0x388e89=typeof _0x454eb1[_0xfcb2('0x1e')]===_0xfcb2('0x1f')&&typeof _0x454eb1[_0xfcb2('0x20')]===_0xfcb2('0x1f');var _0x23925d=_0x33160d['count'];var _0x36b23f=_0x388e89?0x0:_0x454eb1[_0xfcb2('0x1e')];var _0x338a44=_0x388e89?_0x33160d[_0xfcb2('0x21')]:_0x454eb1[_0xfcb2('0x1e')]+_0x454eb1[_0xfcb2('0x20')];var _0x50bc2e;if(_0x338a44>=_0x23925d){_0x338a44=_0x23925d;_0x50bc2e=0xc8;}else{_0x50bc2e=0xce;}_0x182db5[_0xfcb2('0x1b')](_0x50bc2e);return _0x182db5[_0xfcb2('0x22')](_0xfcb2('0x23'),_0x36b23f+'-'+_0x338a44+'/'+_0x23925d)[_0xfcb2('0x1d')](_0x33160d);}return null;};}function patchUpdates(_0x22674d){return function(_0x4753d3){try{jsonpatch['apply'](_0x4753d3,_0x22674d,!![]);}catch(_0xd82dc1){return BPromise[_0xfcb2('0x24')](_0xd82dc1);}return _0x4753d3[_0xfcb2('0x25')]();};}function saveUpdates(_0x7ec579,_0x157cc0){return function(_0x437392){if(_0x437392){return _0x437392[_0xfcb2('0x26')](_0x7ec579)[_0xfcb2('0x27')](function(_0x348819){return _0x348819;});}return null;};}function removeEntity(_0x521c3f,_0x28da73){return function(_0x25634b){if(_0x25634b){return _0x25634b[_0xfcb2('0x28')]()[_0xfcb2('0x27')](function(){_0x521c3f[_0xfcb2('0x1b')](0xcc)['end']();});}};}function handleEntityNotFound(_0x5a360c,_0x2602c1){return function(_0x1c432f){if(!_0x1c432f){_0x5a360c[_0xfcb2('0x1a')](0x194);}return _0x1c432f;};}function handleError(_0x13dd25,_0x563abd){_0x563abd=_0x563abd||0x1f4;return function(_0x46aece){logger['error'](_0x46aece[_0xfcb2('0x29')]);if(_0x46aece[_0xfcb2('0x2a')]){delete _0x46aece[_0xfcb2('0x2a')];}_0x13dd25[_0xfcb2('0x1b')](_0x563abd)['send'](_0x46aece);};}exports['index']=function(_0x3aa038,_0x4c8c9b){var _0xcb846f={},_0x3ea517={},_0x267764={'count':0x0,'rows':[]};var _0x3112ca=_[_0xfcb2('0x2b')](db[_0xfcb2('0x2c')][_0xfcb2('0x2d')],function(_0x14a126){return{'name':_0x14a126[_0xfcb2('0x2e')],'type':_0x14a126['type']['key']};});_0x3ea517[_0xfcb2('0x2f')]=_[_0xfcb2('0x2b')](_0x3112ca,_0xfcb2('0x2a'));_0x3ea517['query']=_[_0xfcb2('0x30')](_0x3aa038[_0xfcb2('0x31')]);_0x3ea517[_0xfcb2('0x32')]=_[_0xfcb2('0x33')](_0x3ea517['model'],_0x3ea517[_0xfcb2('0x31')]);_0xcb846f[_0xfcb2('0x34')]=_[_0xfcb2('0x33')](_0x3ea517[_0xfcb2('0x2f')],qs[_0xfcb2('0x35')](_0x3aa038[_0xfcb2('0x31')][_0xfcb2('0x35')]));_0xcb846f[_0xfcb2('0x34')]=_0xcb846f[_0xfcb2('0x34')][_0xfcb2('0x36')]?_0xcb846f['attributes']:_0x3ea517[_0xfcb2('0x2f')];if(!_0x3aa038['query'][_0xfcb2('0x37')](_0xfcb2('0x38'))){_0xcb846f[_0xfcb2('0x20')]=qs[_0xfcb2('0x20')](_0x3aa038['query'][_0xfcb2('0x20')]);_0xcb846f[_0xfcb2('0x1e')]=qs[_0xfcb2('0x1e')](_0x3aa038[_0xfcb2('0x31')]['offset']);}_0xcb846f[_0xfcb2('0x39')]=qs[_0xfcb2('0x3a')](_0x3aa038[_0xfcb2('0x31')][_0xfcb2('0x3a')]);_0xcb846f[_0xfcb2('0x3b')]=qs[_0xfcb2('0x32')](_[_0xfcb2('0x3c')](_0x3aa038['query'],_0x3ea517['filters']),_0x3112ca);if(_0x3aa038[_0xfcb2('0x31')]['filter']){_0xcb846f[_0xfcb2('0x3b')]=_[_0xfcb2('0x3d')](_0xcb846f[_0xfcb2('0x3b')],{'$or':_[_0xfcb2('0x2b')](_0x3112ca,function(_0x5cb9b2){if(_0x5cb9b2[_0xfcb2('0x3e')]!=='VIRTUAL'){var _0x46b6c8={};_0x46b6c8[_0x5cb9b2['name']]={'$like':'%'+_0x3aa038[_0xfcb2('0x31')][_0xfcb2('0x3f')]+'%'};return _0x46b6c8;}})});}_0xcb846f=_[_0xfcb2('0x3d')]({},_0xcb846f,_0x3aa038[_0xfcb2('0x40')]);var _0x41395a={'where':_0xcb846f[_0xfcb2('0x3b')]};return db[_0xfcb2('0x2c')][_0xfcb2('0x21')](_0x41395a)['then'](function(_0x4315c9){_0x267764[_0xfcb2('0x21')]=_0x4315c9;if(_0x3aa038[_0xfcb2('0x31')][_0xfcb2('0x41')]){_0xcb846f[_0xfcb2('0x42')]=[{'all':!![]}];}return db[_0xfcb2('0x2c')][_0xfcb2('0x43')](_0xcb846f);})[_0xfcb2('0x27')](function(_0x3fa753){_0x267764[_0xfcb2('0x44')]=_0x3fa753;return _0x267764;})['then'](respondWithFilteredResult(_0x4c8c9b,_0xcb846f))[_0xfcb2('0x45')](handleError(_0x4c8c9b,null));};exports[_0xfcb2('0x46')]=function(_0x48499b,_0x33eaa0){var _0x3d1683={'raw':![],'where':{'id':_0x48499b[_0xfcb2('0x47')]['id']}},_0xad7a32={};_0xad7a32[_0xfcb2('0x2f')]=_[_0xfcb2('0x30')](db[_0xfcb2('0x2c')][_0xfcb2('0x2d')]);_0xad7a32[_0xfcb2('0x31')]=_[_0xfcb2('0x30')](_0x48499b[_0xfcb2('0x31')]);_0xad7a32[_0xfcb2('0x32')]=_[_0xfcb2('0x33')](_0xad7a32['model'],_0xad7a32['query']);_0x3d1683['attributes']=_[_0xfcb2('0x33')](_0xad7a32[_0xfcb2('0x2f')],qs[_0xfcb2('0x35')](_0x48499b[_0xfcb2('0x31')]['fields']));_0x3d1683['attributes']=_0x3d1683[_0xfcb2('0x34')]['length']?_0x3d1683[_0xfcb2('0x34')]:_0xad7a32[_0xfcb2('0x2f')];if(_0x48499b[_0xfcb2('0x31')][_0xfcb2('0x41')]){_0x3d1683[_0xfcb2('0x42')]=[{'all':!![]}];}_0x3d1683=_['merge']({},_0x3d1683,_0x48499b['options']);return db['VtigerAccount'][_0xfcb2('0x48')](_0x3d1683)['then'](handleEntityNotFound(_0x33eaa0,null))['then'](respondWithResult(_0x33eaa0,null))[_0xfcb2('0x45')](handleError(_0x33eaa0,null));};exports[_0xfcb2('0x49')]=function(_0x233c2a,_0x20a038){return db[_0xfcb2('0x2c')]['create'](_0x233c2a[_0xfcb2('0x4a')],{})[_0xfcb2('0x27')](respondWithResult(_0x20a038,0xc9))['catch'](handleError(_0x20a038,null));};exports[_0xfcb2('0x26')]=function(_0xceea66,_0x25871d){if(_0xceea66['body']['id']){delete _0xceea66[_0xfcb2('0x4a')]['id'];}return db[_0xfcb2('0x2c')]['find']({'where':{'id':_0xceea66[_0xfcb2('0x47')]['id']}})['then'](handleEntityNotFound(_0x25871d,null))[_0xfcb2('0x27')](saveUpdates(_0xceea66[_0xfcb2('0x4a')],null))['then'](respondWithResult(_0x25871d,null))['catch'](handleError(_0x25871d,null));};exports[_0xfcb2('0x28')]=function(_0x9baca9,_0x12e040){return db[_0xfcb2('0x2c')]['find']({'where':{'id':_0x9baca9[_0xfcb2('0x47')]['id']}})[_0xfcb2('0x27')](handleEntityNotFound(_0x12e040,null))[_0xfcb2('0x27')](removeEntity(_0x12e040,null))[_0xfcb2('0x45')](handleError(_0x12e040,null));};exports[_0xfcb2('0x4b')]=function(_0x542094,_0xbf5154,_0x367199){var _0x54df2c={};var _0x45a5fe={};var _0x3087cd;var _0x272172;return db[_0xfcb2('0x2c')]['findOne']({'where':{'id':_0x542094['params']['id']}})[_0xfcb2('0x27')](handleEntityNotFound(_0xbf5154,null))[_0xfcb2('0x27')](function(_0x2310fa){if(_0x2310fa){_0x3087cd=_0x2310fa;_0x45a5fe[_0xfcb2('0x2f')]=_['keys'](db['VtigerConfiguration']['rawAttributes']);_0x45a5fe[_0xfcb2('0x31')]=_['keys'](_0x542094[_0xfcb2('0x31')]);_0x45a5fe[_0xfcb2('0x32')]=_[_0xfcb2('0x33')](_0x45a5fe[_0xfcb2('0x2f')],_0x45a5fe[_0xfcb2('0x31')]);_0x54df2c['attributes']=_[_0xfcb2('0x33')](_0x45a5fe[_0xfcb2('0x2f')],qs[_0xfcb2('0x35')](_0x542094[_0xfcb2('0x31')][_0xfcb2('0x35')]));_0x54df2c[_0xfcb2('0x34')]=_0x54df2c[_0xfcb2('0x34')][_0xfcb2('0x36')]?_0x54df2c[_0xfcb2('0x34')]:_0x45a5fe[_0xfcb2('0x2f')];_0x54df2c['order']=qs[_0xfcb2('0x3a')](_0x542094[_0xfcb2('0x31')][_0xfcb2('0x3a')]);_0x54df2c[_0xfcb2('0x3b')]=qs[_0xfcb2('0x32')](_[_0xfcb2('0x3c')](_0x542094[_0xfcb2('0x31')],_0x45a5fe['filters']));if(_0x542094[_0xfcb2('0x31')]['filter']){_0x54df2c['where']=_[_0xfcb2('0x3d')](_0x54df2c[_0xfcb2('0x3b')],{'$or':_[_0xfcb2('0x2b')](_0x54df2c[_0xfcb2('0x34')],function(_0x3f626c){var _0x158a68={};_0x158a68[_0x3f626c]={'$like':'%'+_0x542094[_0xfcb2('0x31')][_0xfcb2('0x3f')]+'%'};return _0x158a68;})});}_0x54df2c=_[_0xfcb2('0x3d')]({},_0x54df2c,_0x542094[_0xfcb2('0x40')]);return _0x3087cd[_0xfcb2('0x4b')](_0x54df2c);}})[_0xfcb2('0x27')](function(_0x1e76d1){if(_0x1e76d1){_0x272172=_0x1e76d1[_0xfcb2('0x36')];if(!_0x542094[_0xfcb2('0x31')][_0xfcb2('0x37')](_0xfcb2('0x38'))){_0x54df2c[_0xfcb2('0x20')]=qs[_0xfcb2('0x20')](_0x542094[_0xfcb2('0x31')][_0xfcb2('0x20')]);_0x54df2c[_0xfcb2('0x1e')]=qs[_0xfcb2('0x1e')](_0x542094['query'][_0xfcb2('0x1e')]);}return _0x3087cd[_0xfcb2('0x4b')](_0x54df2c);}})[_0xfcb2('0x27')](function(_0x19e96e){if(_0x19e96e){return _0x19e96e?{'count':_0x272172,'rows':_0x19e96e}:null;}})[_0xfcb2('0x27')](respondWithResult(_0xbf5154,null))['catch'](handleError(_0xbf5154,null));};exports[_0xfcb2('0x4c')]=function(_0x58323d,_0x21c2f8,_0x3875c9){if(_0x58323d[_0xfcb2('0x4a')]['id']){delete _0x58323d[_0xfcb2('0x4a')]['id'];}return db[_0xfcb2('0x2c')][_0xfcb2('0x4d')]({'where':{'id':_0x58323d[_0xfcb2('0x47')]['id']}})[_0xfcb2('0x27')](handleEntityNotFound(_0x21c2f8,null))['then'](function(_0x4325cc){if(_0x4325cc){_0x58323d[_0xfcb2('0x4a')][_0xfcb2('0x4e')]=_0x4325cc['id'];_0x58323d[_0xfcb2('0x4a')][_0xfcb2('0x4f')]=integrations[_0xfcb2('0x50')](_0x58323d[_0xfcb2('0x4a')]['channel'],_0x58323d[_0xfcb2('0x4a')][_0xfcb2('0x3e')]);_0x58323d[_0xfcb2('0x4a')][_0xfcb2('0x51')]=integrations[_0xfcb2('0x52')](_0x58323d[_0xfcb2('0x4a')][_0xfcb2('0x53')],_0x58323d[_0xfcb2('0x4a')][_0xfcb2('0x3e')]);return db[_0xfcb2('0x54')][_0xfcb2('0x49')](_0x58323d[_0xfcb2('0x4a')],{'include':[{'model':db[_0xfcb2('0x55')],'as':_0xfcb2('0x4f')},{'model':db[_0xfcb2('0x55')],'as':_0xfcb2('0x51')}]});}return null;})[_0xfcb2('0x27')](respondWithResult(_0x21c2f8,null))[_0xfcb2('0x45')](handleError(_0x21c2f8,null));};var md5=require(_0xfcb2('0x56'));exports[_0xfcb2('0x57')]=function(_0xa8b142,_0x5cc5e4,_0x446ba1){var _0x592f4e=null;var _0x188ee1=null;var _0x5acb3d=null;var _0x55487b=null;var _0x2853f3='';return db[_0xfcb2('0x2c')][_0xfcb2('0x4d')]({'where':{'id':_0xa8b142[_0xfcb2('0x47')]['id']},'attributes':['id',_0xfcb2('0x2a'),_0xfcb2('0x58'),_0xfcb2('0x59'),_0xfcb2('0x5a'),_0xfcb2('0x5b'),_0xfcb2('0x5c'),_0xfcb2('0x5d')]})[_0xfcb2('0x27')](handleEntityNotFound(_0x5cc5e4,null))[_0xfcb2('0x27')](function(_0x29a21b){if(_0x29a21b){_0x592f4e=_0x29a21b[_0xfcb2('0x58')];_0x188ee1=_0x29a21b[_0xfcb2('0x5d')];_0x5acb3d=_0x29a21b[_0xfcb2('0x5a')];_0x2853f3=_0x29a21b[_0xfcb2('0x5b')];var _0x2b5216=_0x2853f3[_0xfcb2('0x5e')](-0x1);if(_0x2b5216==='/'){_0x2853f3=_0x2853f3[_0xfcb2('0x5f')](0x0,_0x2853f3[_0xfcb2('0x60')](_0x2b5216));}_0x55487b=util[_0xfcb2('0x61')](_0xfcb2('0x62'),_0x2853f3);var _0xf109d3={'method':_0xfcb2('0x63'),'uri':_0x55487b,'qs':{'operation':_0xfcb2('0x64'),'username':_0x29a21b[_0xfcb2('0x58')]},'json':!![]};return rp(_0xf109d3);}})['then'](function(_0x54f359){if(_0x54f359[_0xfcb2('0x65')]){var _0x35a94d={'method':_0xfcb2('0x66'),'uri':_0x55487b,'form':{'operation':_0xfcb2('0x67'),'username':_0x592f4e,'accessKey':md5(_0x54f359['result'][_0xfcb2('0x68')]+_0x188ee1)},'json':!![]};return rp(_0x35a94d);}})['then'](function(_0x2b488a){if(_0x2b488a[_0xfcb2('0x65')]){var _0x12a9e9={'method':_0xfcb2('0x63'),'uri':_0x55487b,'qs':{'operation':_0xfcb2('0x69'),'username':_0x592f4e,'sessionName':_0x2b488a[_0xfcb2('0x6a')][_0xfcb2('0x6b')],'elementType':_0x5acb3d},'json':!![]};return rp(_0x12a9e9);}})['then'](function(_0x579a04){if(_0x579a04['success']){var _0x3e7d3d=[_0xfcb2('0x6c'),_0xfcb2('0x6d'),_0xfcb2('0x6e')];_[_0xfcb2('0x6f')](_0x579a04[_0xfcb2('0x6a')][_0xfcb2('0x35')],function(_0xa356c7){return _0x3e7d3d[_0xfcb2('0x70')](_0xa356c7[_0xfcb2('0x3e')][_0xfcb2('0x2a')]);});_[_0xfcb2('0x6f')](_0x579a04['result'][_0xfcb2('0x35')],function(_0x5c8c0f){return _0x5c8c0f[_0xfcb2('0x71')]==='false';});return{'count':_0x579a04['result'][_0xfcb2('0x35')][_0xfcb2('0x36')],'rows':_[_0xfcb2('0x2b')](_0x579a04[_0xfcb2('0x6a')][_0xfcb2('0x35')],function(_0x27ee68){return{'id':_0x27ee68[_0xfcb2('0x2a')],'name':_0x27ee68[_0xfcb2('0x72')],'custom':_[_0xfcb2('0x73')](_0x27ee68['name'],_0xfcb2('0x74'))?!![]:![],'options':_0x27ee68['type'][_0xfcb2('0x2a')]===_0xfcb2('0x75')&&_0x27ee68['type'][_0xfcb2('0x76')][_0xfcb2('0x36')]>0x0?_[_0xfcb2('0x2b')](_0x27ee68[_0xfcb2('0x3e')][_0xfcb2('0x76')],function(_0x803bcb){return{'name':_0x803bcb[_0xfcb2('0x72')],'value':_0x803bcb[_0xfcb2('0x77')]};}):[]};})};}})[_0xfcb2('0x27')](respondWithResult(_0x5cc5e4,null))[_0xfcb2('0x45')](function(_0x109353){console[_0xfcb2('0x78')](_0xfcb2('0x79')+_0x109353);var _0x3461bd=_0xa8b142[_0xfcb2('0x31')][_0xfcb2('0x7a')]?0x1f4:_0x109353[_0xfcb2('0x7b')]||0x1f4;logger[_0xfcb2('0x7c')](_0xfcb2('0x7d'),_0xfcb2('0x57'),_0x3461bd,JSON[_0xfcb2('0x7e')](_0x109353));delete _0x109353['name'];if(_0x3461bd===0x191){_0x3461bd=0x190;}_0x5cc5e4[_0xfcb2('0x1b')](_0x3461bd)[_0xfcb2('0x7f')](_0xa8b142[_0xfcb2('0x31')]['test']?{'message':_0xfcb2('0x80'),'statusCode':_0x109353[_0xfcb2('0x7b')]}:_0x109353);});}; \ No newline at end of file +var _0xb9e1=['api','../../config/utils','../../mysqldb','../../components/integrations/configuration','sendStatus','status','end','json','offset','undefined','limit','count','set','Content-Range','apply','reject','save','update','then','destroy','error','name','index','map','VtigerAccount','rawAttributes','fieldName','type','key','keys','query','filters','intersection','model','fields','attributes','length','nolimit','order','sort','where','pick','filter','merge','VIRTUAL','options','include','findAll','rows','catch','show','params','includeAll','find','create','getConfigurations','VtigerConfiguration','hasOwnProperty','addConfiguration','body','findOne','getSubjects','Descriptions','getDescriptions','Subjects','md5','getFields','username','description','remoteUri','serverUrl','accessKey','moduleName','substring','lastIndexOf','format','GET','success','login','result','token','describe','reference','owner','remove','includes','editable','false','label','startsWith','cf_','picklist','picklistValues','log','vTiger\x20error:\x20','test','stringify','send','statusCode','rimraf','fast-json-patch','request-promise','moment','bluebird','mustache','util','path','sox','ejs','lodash','squel','crypto','jsforce','desk.js','to-csv','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/logger'];(function(_0x20463f,_0x37afe7){var _0x27171b=function(_0x50e24e){while(--_0x50e24e){_0x20463f['push'](_0x20463f['shift']());}};_0x27171b(++_0x37afe7);}(_0xb9e1,0x157));var _0x1b9e=function(_0x361026,_0x2375e2){_0x361026=_0x361026-0x0;var _0x37028e=_0xb9e1[_0x361026];return _0x37028e;};'use strict';var emlformat=require('eml-format');var rimraf=require(_0x1b9e('0x0'));var zipdir=require('zip-dir');var jsonpatch=require(_0x1b9e('0x1'));var rp=require(_0x1b9e('0x2'));var moment=require(_0x1b9e('0x3'));var BPromise=require(_0x1b9e('0x4'));var Mustache=require(_0x1b9e('0x5'));var util=require(_0x1b9e('0x6'));var path=require(_0x1b9e('0x7'));var sox=require(_0x1b9e('0x8'));var csv=require('to-csv');var ejs=require(_0x1b9e('0x9'));var fs=require('fs');var fs_extra=require('fs-extra');var _=require(_0x1b9e('0xa'));var squel=require(_0x1b9e('0xb'));var crypto=require(_0x1b9e('0xc'));var jsforce=require(_0x1b9e('0xd'));var deskjs=require(_0x1b9e('0xe'));var toCsv=require(_0x1b9e('0xf'));var querystring=require(_0x1b9e('0x10'));var Papa=require(_0x1b9e('0x11'));var Redis=require(_0x1b9e('0x12'));var authService=require(_0x1b9e('0x13'));var qs=require(_0x1b9e('0x14'));var as=require(_0x1b9e('0x15'));var hardwareService=require('../../config/license/hardware');var logger=require(_0x1b9e('0x16'))(_0x1b9e('0x17'));var utils=require(_0x1b9e('0x18'));var config=require('../../config/environment');var licenseUtil=require('../../config/license/util');var db=require(_0x1b9e('0x19'))['db'];var integrations=require(_0x1b9e('0x1a'));function respondWithStatusCode(_0x545db0,_0x3c440c){_0x3c440c=_0x3c440c||0xcc;return function(_0x278867){if(_0x278867){return _0x545db0[_0x1b9e('0x1b')](_0x3c440c);}return _0x545db0[_0x1b9e('0x1c')](_0x3c440c)[_0x1b9e('0x1d')]();};}function respondWithResult(_0x207b58,_0x1266a0){_0x1266a0=_0x1266a0||0xc8;return function(_0x54e5de){if(_0x54e5de){return _0x207b58[_0x1b9e('0x1c')](_0x1266a0)[_0x1b9e('0x1e')](_0x54e5de);}};}function respondWithFilteredResult(_0x4ff5d7,_0x5e8077){return function(_0xedabd0){if(_0xedabd0){var _0x1d9cb8=typeof _0x5e8077[_0x1b9e('0x1f')]===_0x1b9e('0x20')&&typeof _0x5e8077[_0x1b9e('0x21')]==='undefined';var _0x211bc9=_0xedabd0[_0x1b9e('0x22')];var _0x1e6d92=_0x1d9cb8?0x0:_0x5e8077[_0x1b9e('0x1f')];var _0x20e492=_0x1d9cb8?_0xedabd0[_0x1b9e('0x22')]:_0x5e8077[_0x1b9e('0x1f')]+_0x5e8077[_0x1b9e('0x21')];var _0x4cd44d;if(_0x20e492>=_0x211bc9){_0x20e492=_0x211bc9;_0x4cd44d=0xc8;}else{_0x4cd44d=0xce;}_0x4ff5d7[_0x1b9e('0x1c')](_0x4cd44d);return _0x4ff5d7[_0x1b9e('0x23')](_0x1b9e('0x24'),_0x1e6d92+'-'+_0x20e492+'/'+_0x211bc9)[_0x1b9e('0x1e')](_0xedabd0);}return null;};}function patchUpdates(_0x4c9242){return function(_0x237bf2){try{jsonpatch[_0x1b9e('0x25')](_0x237bf2,_0x4c9242,!![]);}catch(_0x1c46c3){return BPromise[_0x1b9e('0x26')](_0x1c46c3);}return _0x237bf2[_0x1b9e('0x27')]();};}function saveUpdates(_0x3ae86a,_0x4c8b19){return function(_0x380756){if(_0x380756){return _0x380756[_0x1b9e('0x28')](_0x3ae86a)[_0x1b9e('0x29')](function(_0xdb6383){return _0xdb6383;});}return null;};}function removeEntity(_0x5bef05,_0xc6b0d8){return function(_0x5d7854){if(_0x5d7854){return _0x5d7854[_0x1b9e('0x2a')]()[_0x1b9e('0x29')](function(){_0x5bef05[_0x1b9e('0x1c')](0xcc)[_0x1b9e('0x1d')]();});}};}function handleEntityNotFound(_0x52b5b0,_0xfddcbd){return function(_0x5ba009){if(!_0x5ba009){_0x52b5b0[_0x1b9e('0x1b')](0x194);}return _0x5ba009;};}function handleError(_0x41753d,_0x4562c5){_0x4562c5=_0x4562c5||0x1f4;return function(_0x143d83){logger[_0x1b9e('0x2b')](_0x143d83['stack']);if(_0x143d83['name']){delete _0x143d83[_0x1b9e('0x2c')];}_0x41753d[_0x1b9e('0x1c')](_0x4562c5)['send'](_0x143d83);};}exports[_0x1b9e('0x2d')]=function(_0x186f04,_0x6790e3){var _0x5bbf05={},_0x1b6d04={},_0x14132d={'count':0x0,'rows':[]};var _0x351a2a=_[_0x1b9e('0x2e')](db[_0x1b9e('0x2f')][_0x1b9e('0x30')],function(_0x19e701){return{'name':_0x19e701[_0x1b9e('0x31')],'type':_0x19e701[_0x1b9e('0x32')][_0x1b9e('0x33')]};});_0x1b6d04['model']=_[_0x1b9e('0x2e')](_0x351a2a,'name');_0x1b6d04['query']=_[_0x1b9e('0x34')](_0x186f04[_0x1b9e('0x35')]);_0x1b6d04[_0x1b9e('0x36')]=_[_0x1b9e('0x37')](_0x1b6d04[_0x1b9e('0x38')],_0x1b6d04[_0x1b9e('0x35')]);_0x5bbf05['attributes']=_['intersection'](_0x1b6d04[_0x1b9e('0x38')],qs[_0x1b9e('0x39')](_0x186f04[_0x1b9e('0x35')][_0x1b9e('0x39')]));_0x5bbf05[_0x1b9e('0x3a')]=_0x5bbf05[_0x1b9e('0x3a')][_0x1b9e('0x3b')]?_0x5bbf05[_0x1b9e('0x3a')]:_0x1b6d04['model'];if(!_0x186f04[_0x1b9e('0x35')]['hasOwnProperty'](_0x1b9e('0x3c'))){_0x5bbf05[_0x1b9e('0x21')]=qs[_0x1b9e('0x21')](_0x186f04[_0x1b9e('0x35')][_0x1b9e('0x21')]);_0x5bbf05[_0x1b9e('0x1f')]=qs['offset'](_0x186f04['query'][_0x1b9e('0x1f')]);}_0x5bbf05[_0x1b9e('0x3d')]=qs[_0x1b9e('0x3e')](_0x186f04[_0x1b9e('0x35')][_0x1b9e('0x3e')]);_0x5bbf05[_0x1b9e('0x3f')]=qs[_0x1b9e('0x36')](_[_0x1b9e('0x40')](_0x186f04[_0x1b9e('0x35')],_0x1b6d04[_0x1b9e('0x36')]),_0x351a2a);if(_0x186f04[_0x1b9e('0x35')][_0x1b9e('0x41')]){_0x5bbf05[_0x1b9e('0x3f')]=_[_0x1b9e('0x42')](_0x5bbf05[_0x1b9e('0x3f')],{'$or':_[_0x1b9e('0x2e')](_0x351a2a,function(_0x4cee48){if(_0x4cee48[_0x1b9e('0x32')]!==_0x1b9e('0x43')){var _0x16aa16={};_0x16aa16[_0x4cee48['name']]={'$like':'%'+_0x186f04[_0x1b9e('0x35')][_0x1b9e('0x41')]+'%'};return _0x16aa16;}})});}_0x5bbf05=_[_0x1b9e('0x42')]({},_0x5bbf05,_0x186f04[_0x1b9e('0x44')]);var _0x362cd2={'where':_0x5bbf05['where']};return db[_0x1b9e('0x2f')][_0x1b9e('0x22')](_0x362cd2)[_0x1b9e('0x29')](function(_0x3e550b){_0x14132d['count']=_0x3e550b;if(_0x186f04['query']['includeAll']){_0x5bbf05[_0x1b9e('0x45')]=[{'all':!![]}];}return db[_0x1b9e('0x2f')][_0x1b9e('0x46')](_0x5bbf05);})[_0x1b9e('0x29')](function(_0x4e07c3){_0x14132d[_0x1b9e('0x47')]=_0x4e07c3;return _0x14132d;})[_0x1b9e('0x29')](respondWithFilteredResult(_0x6790e3,_0x5bbf05))[_0x1b9e('0x48')](handleError(_0x6790e3,null));};exports[_0x1b9e('0x49')]=function(_0x29d633,_0x554a9b){var _0x1c5dfe={'raw':![],'where':{'id':_0x29d633[_0x1b9e('0x4a')]['id']}},_0x4b4bfc={};_0x4b4bfc[_0x1b9e('0x38')]=_[_0x1b9e('0x34')](db['VtigerAccount'][_0x1b9e('0x30')]);_0x4b4bfc['query']=_['keys'](_0x29d633[_0x1b9e('0x35')]);_0x4b4bfc[_0x1b9e('0x36')]=_[_0x1b9e('0x37')](_0x4b4bfc[_0x1b9e('0x38')],_0x4b4bfc[_0x1b9e('0x35')]);_0x1c5dfe[_0x1b9e('0x3a')]=_['intersection'](_0x4b4bfc[_0x1b9e('0x38')],qs['fields'](_0x29d633[_0x1b9e('0x35')][_0x1b9e('0x39')]));_0x1c5dfe[_0x1b9e('0x3a')]=_0x1c5dfe[_0x1b9e('0x3a')][_0x1b9e('0x3b')]?_0x1c5dfe[_0x1b9e('0x3a')]:_0x4b4bfc[_0x1b9e('0x38')];if(_0x29d633[_0x1b9e('0x35')][_0x1b9e('0x4b')]){_0x1c5dfe[_0x1b9e('0x45')]=[{'all':!![]}];}_0x1c5dfe=_[_0x1b9e('0x42')]({},_0x1c5dfe,_0x29d633['options']);return db['VtigerAccount'][_0x1b9e('0x4c')](_0x1c5dfe)[_0x1b9e('0x29')](handleEntityNotFound(_0x554a9b,null))['then'](respondWithResult(_0x554a9b,null))[_0x1b9e('0x48')](handleError(_0x554a9b,null));};exports['create']=function(_0x29abac,_0x5b10a4){return db['VtigerAccount'][_0x1b9e('0x4d')](_0x29abac['body'],{})[_0x1b9e('0x29')](respondWithResult(_0x5b10a4,0xc9))[_0x1b9e('0x48')](handleError(_0x5b10a4,null));};exports[_0x1b9e('0x28')]=function(_0x3232a7,_0x13263b){if(_0x3232a7['body']['id']){delete _0x3232a7['body']['id'];}return db[_0x1b9e('0x2f')][_0x1b9e('0x4c')]({'where':{'id':_0x3232a7[_0x1b9e('0x4a')]['id']}})[_0x1b9e('0x29')](handleEntityNotFound(_0x13263b,null))['then'](saveUpdates(_0x3232a7['body'],null))['then'](respondWithResult(_0x13263b,null))[_0x1b9e('0x48')](handleError(_0x13263b,null));};exports[_0x1b9e('0x2a')]=function(_0x5f1a9d,_0x3c3393){return db[_0x1b9e('0x2f')]['find']({'where':{'id':_0x5f1a9d[_0x1b9e('0x4a')]['id']}})[_0x1b9e('0x29')](handleEntityNotFound(_0x3c3393,null))[_0x1b9e('0x29')](removeEntity(_0x3c3393,null))[_0x1b9e('0x48')](handleError(_0x3c3393,null));};exports[_0x1b9e('0x4e')]=function(_0x1e3394,_0x30e860,_0x62295a){var _0x271ba={};var _0x140989={};var _0x504080;var _0x1f8b0f;return db[_0x1b9e('0x2f')]['findOne']({'where':{'id':_0x1e3394[_0x1b9e('0x4a')]['id']}})[_0x1b9e('0x29')](handleEntityNotFound(_0x30e860,null))[_0x1b9e('0x29')](function(_0x272b6b){if(_0x272b6b){_0x504080=_0x272b6b;_0x140989[_0x1b9e('0x38')]=_[_0x1b9e('0x34')](db[_0x1b9e('0x4f')][_0x1b9e('0x30')]);_0x140989[_0x1b9e('0x35')]=_[_0x1b9e('0x34')](_0x1e3394[_0x1b9e('0x35')]);_0x140989[_0x1b9e('0x36')]=_['intersection'](_0x140989[_0x1b9e('0x38')],_0x140989[_0x1b9e('0x35')]);_0x271ba[_0x1b9e('0x3a')]=_[_0x1b9e('0x37')](_0x140989[_0x1b9e('0x38')],qs[_0x1b9e('0x39')](_0x1e3394[_0x1b9e('0x35')][_0x1b9e('0x39')]));_0x271ba[_0x1b9e('0x3a')]=_0x271ba['attributes']['length']?_0x271ba[_0x1b9e('0x3a')]:_0x140989[_0x1b9e('0x38')];_0x271ba[_0x1b9e('0x3d')]=qs[_0x1b9e('0x3e')](_0x1e3394['query'][_0x1b9e('0x3e')]);_0x271ba[_0x1b9e('0x3f')]=qs[_0x1b9e('0x36')](_[_0x1b9e('0x40')](_0x1e3394[_0x1b9e('0x35')],_0x140989['filters']));if(_0x1e3394['query']['filter']){_0x271ba[_0x1b9e('0x3f')]=_[_0x1b9e('0x42')](_0x271ba[_0x1b9e('0x3f')],{'$or':_['map'](_0x271ba['attributes'],function(_0x4a5424){var _0x519c73={};_0x519c73[_0x4a5424]={'$like':'%'+_0x1e3394[_0x1b9e('0x35')][_0x1b9e('0x41')]+'%'};return _0x519c73;})});}_0x271ba=_[_0x1b9e('0x42')]({},_0x271ba,_0x1e3394[_0x1b9e('0x44')]);return _0x504080[_0x1b9e('0x4e')](_0x271ba);}})[_0x1b9e('0x29')](function(_0x56ce6f){if(_0x56ce6f){_0x1f8b0f=_0x56ce6f[_0x1b9e('0x3b')];if(!_0x1e3394[_0x1b9e('0x35')][_0x1b9e('0x50')](_0x1b9e('0x3c'))){_0x271ba['limit']=qs[_0x1b9e('0x21')](_0x1e3394[_0x1b9e('0x35')][_0x1b9e('0x21')]);_0x271ba[_0x1b9e('0x1f')]=qs['offset'](_0x1e3394['query'][_0x1b9e('0x1f')]);}return _0x504080['getConfigurations'](_0x271ba);}})[_0x1b9e('0x29')](function(_0x18b491){if(_0x18b491){return _0x18b491?{'count':_0x1f8b0f,'rows':_0x18b491}:null;}})[_0x1b9e('0x29')](respondWithResult(_0x30e860,null))['catch'](handleError(_0x30e860,null));};exports[_0x1b9e('0x51')]=function(_0x501191,_0x3e8dc3,_0xce0464){if(_0x501191[_0x1b9e('0x52')]['id']){delete _0x501191[_0x1b9e('0x52')]['id'];}return db['VtigerAccount'][_0x1b9e('0x53')]({'where':{'id':_0x501191[_0x1b9e('0x4a')]['id']}})['then'](handleEntityNotFound(_0x3e8dc3,null))['then'](function(_0x1e85a2){if(_0x1e85a2){_0x501191[_0x1b9e('0x52')]['AccountId']=_0x1e85a2['id'];_0x501191['body']['Subjects']=integrations[_0x1b9e('0x54')](_0x501191[_0x1b9e('0x52')]['channel'],_0x501191[_0x1b9e('0x52')]['type']);_0x501191[_0x1b9e('0x52')][_0x1b9e('0x55')]=integrations[_0x1b9e('0x56')](_0x501191[_0x1b9e('0x52')]['channel'],_0x501191[_0x1b9e('0x52')]['type']);return db[_0x1b9e('0x4f')]['create'](_0x501191[_0x1b9e('0x52')],{'include':[{'model':db['VtigerField'],'as':_0x1b9e('0x57')},{'model':db['VtigerField'],'as':_0x1b9e('0x55')}]});}return null;})['then'](respondWithResult(_0x3e8dc3,null))[_0x1b9e('0x48')](handleError(_0x3e8dc3,null));};var md5=require(_0x1b9e('0x58'));exports[_0x1b9e('0x59')]=function(_0x3d46d0,_0x1d6602,_0x1648d6){var _0x3ddb57=null;var _0x3e1fee=null;var _0x142868=null;var _0x51d3e6=null;var _0x994e15='';return db[_0x1b9e('0x2f')][_0x1b9e('0x53')]({'where':{'id':_0x3d46d0['params']['id']},'attributes':['id',_0x1b9e('0x2c'),_0x1b9e('0x5a'),_0x1b9e('0x5b'),'moduleName',_0x1b9e('0x5c'),_0x1b9e('0x5d'),_0x1b9e('0x5e')]})[_0x1b9e('0x29')](handleEntityNotFound(_0x1d6602,null))[_0x1b9e('0x29')](function(_0x5bbe86){if(_0x5bbe86){_0x3ddb57=_0x5bbe86['username'];_0x3e1fee=_0x5bbe86[_0x1b9e('0x5e')];_0x142868=_0x5bbe86[_0x1b9e('0x5f')];_0x994e15=_0x5bbe86[_0x1b9e('0x5c')];var _0x25980f=_0x994e15['slice'](-0x1);if(_0x25980f==='/'){_0x994e15=_0x994e15[_0x1b9e('0x60')](0x0,_0x994e15[_0x1b9e('0x61')](_0x25980f));}_0x51d3e6=util[_0x1b9e('0x62')]('%s/webservice.php',_0x994e15);var _0x182d0e={'method':_0x1b9e('0x63'),'uri':_0x51d3e6,'qs':{'operation':'getchallenge','username':_0x5bbe86[_0x1b9e('0x5a')]},'json':!![]};return rp(_0x182d0e);}})[_0x1b9e('0x29')](function(_0xb6c0c3){if(_0xb6c0c3[_0x1b9e('0x64')]){var _0x3d891a={'method':'POST','uri':_0x51d3e6,'form':{'operation':_0x1b9e('0x65'),'username':_0x3ddb57,'accessKey':md5(_0xb6c0c3[_0x1b9e('0x66')][_0x1b9e('0x67')]+_0x3e1fee)},'json':!![]};return rp(_0x3d891a);}})[_0x1b9e('0x29')](function(_0x211b76){if(_0x211b76['success']){var _0x295cc0={'method':'GET','uri':_0x51d3e6,'qs':{'operation':_0x1b9e('0x68'),'username':_0x3ddb57,'sessionName':_0x211b76[_0x1b9e('0x66')]['sessionName'],'elementType':_0x142868},'json':!![]};return rp(_0x295cc0);}})[_0x1b9e('0x29')](function(_0x200ee3){if(_0x200ee3[_0x1b9e('0x64')]){var _0x162bc9=['autogenerated',_0x1b9e('0x69'),_0x1b9e('0x6a')];_[_0x1b9e('0x6b')](_0x200ee3[_0x1b9e('0x66')][_0x1b9e('0x39')],function(_0x26060f){return _0x162bc9[_0x1b9e('0x6c')](_0x26060f[_0x1b9e('0x32')][_0x1b9e('0x2c')]);});_['remove'](_0x200ee3[_0x1b9e('0x66')][_0x1b9e('0x39')],function(_0x43a139){return _0x43a139[_0x1b9e('0x6d')]===_0x1b9e('0x6e');});return{'count':_0x200ee3[_0x1b9e('0x66')][_0x1b9e('0x39')][_0x1b9e('0x3b')],'rows':_[_0x1b9e('0x2e')](_0x200ee3[_0x1b9e('0x66')][_0x1b9e('0x39')],function(_0x4dbd9d){return{'id':_0x4dbd9d[_0x1b9e('0x2c')],'name':_0x4dbd9d[_0x1b9e('0x6f')],'custom':_[_0x1b9e('0x70')](_0x4dbd9d[_0x1b9e('0x2c')],_0x1b9e('0x71'))?!![]:![],'options':_0x4dbd9d[_0x1b9e('0x32')][_0x1b9e('0x2c')]===_0x1b9e('0x72')&&_0x4dbd9d[_0x1b9e('0x32')][_0x1b9e('0x73')][_0x1b9e('0x3b')]>0x0?_['map'](_0x4dbd9d[_0x1b9e('0x32')][_0x1b9e('0x73')],function(_0x555d2f){return{'name':_0x555d2f[_0x1b9e('0x6f')],'value':_0x555d2f['value']};}):[]};})};}})[_0x1b9e('0x29')](respondWithResult(_0x1d6602,null))[_0x1b9e('0x48')](function(_0x45c894){console[_0x1b9e('0x74')](_0x1b9e('0x75')+_0x45c894);var _0x37eec2=_0x3d46d0[_0x1b9e('0x35')][_0x1b9e('0x76')]?0x1f4:_0x45c894['statusCode']||0x1f4;logger[_0x1b9e('0x2b')]('getFields,\x20%s,\x20%s,\x20%s','getFields',_0x37eec2,JSON[_0x1b9e('0x77')](_0x45c894));delete _0x45c894[_0x1b9e('0x2c')];if(_0x37eec2===0x191){_0x37eec2=0x190;}_0x1d6602[_0x1b9e('0x1c')](_0x37eec2)[_0x1b9e('0x78')](_0x3d46d0['query']['test']?{'message':'Wrong\x20credentials','statusCode':_0x45c894[_0x1b9e('0x79')]}:_0x45c894);});}; \ No newline at end of file diff --git a/server/api/intVtigerAccount/intVtigerAccount.model.js b/server/api/intVtigerAccount/intVtigerAccount.model.js index bde2fdd..01cf9fe 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 _0x474b=['VtigerAccount','lodash','util','../../config/logger','api','request-promise','rimraf','../../config/environment','../../components/integrations/configuration','exports','define'];(function(_0x43c771,_0x1cfc42){var _0x874ae7=function(_0x5be2d5){while(--_0x5be2d5){_0x43c771['push'](_0x43c771['shift']());}};_0x874ae7(++_0x1cfc42);}(_0x474b,0x177));var _0xb474=function(_0x1337bd,_0x464043){_0x1337bd=_0x1337bd-0x0;var _0x5c3ad2=_0x474b[_0x1337bd];return _0x5c3ad2;};'use strict';var _=require(_0xb474('0x0'));var util=require(_0xb474('0x1'));var logger=require(_0xb474('0x2'))(_0xb474('0x3'));var moment=require('moment');var BPromise=require('bluebird');var rp=require(_0xb474('0x4'));var fs=require('fs');var path=require('path');var rimraf=require(_0xb474('0x5'));var config=require(_0xb474('0x6'));var attributes=require('./intVtigerAccount.attributes');var integrations=require(_0xb474('0x7'));module[_0xb474('0x8')]=function(_0x462560,_0x4c1658){return _0x462560[_0xb474('0x9')](_0xb474('0xa'),attributes,{'tableName':'int_vtiger_accounts','paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x5b92=['lodash','util','../../config/logger','api','moment','request-promise','path','../../config/environment','./intVtigerAccount.attributes','exports','define','VtigerAccount','int_vtiger_accounts'];(function(_0x6324b5,_0x2509ab){var _0x273723=function(_0x3fb8c7){while(--_0x3fb8c7){_0x6324b5['push'](_0x6324b5['shift']());}};_0x273723(++_0x2509ab);}(_0x5b92,0x1a0));var _0x25b9=function(_0x2b10c6,_0x185590){_0x2b10c6=_0x2b10c6-0x0;var _0x3789d2=_0x5b92[_0x2b10c6];return _0x3789d2;};'use strict';var _=require(_0x25b9('0x0'));var util=require(_0x25b9('0x1'));var logger=require(_0x25b9('0x2'))(_0x25b9('0x3'));var moment=require(_0x25b9('0x4'));var BPromise=require('bluebird');var rp=require(_0x25b9('0x5'));var fs=require('fs');var path=require(_0x25b9('0x6'));var rimraf=require('rimraf');var config=require(_0x25b9('0x7'));var attributes=require(_0x25b9('0x8'));var integrations=require('../../components/integrations/configuration');module[_0x25b9('0x9')]=function(_0x23c328,_0x4ee3c7){return _0x23c328[_0x25b9('0xa')](_0x25b9('0xb'),attributes,{'tableName':_0x25b9('0xc'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/intVtigerAccount/intVtigerAccount.rpc.js b/server/api/intVtigerAccount/intVtigerAccount.rpc.js index 1593f24..e523483 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 _0x6324=['message','info','result','catch','GetVtigerAccount','options','raw','where','attributes','limit','include','map','model','VtigerAccount','find','ShowVtigerAccount','lodash','util','moment','bluebird','ioredis','../../config/utils','rpc','jayson/promise','client','http','then','request\x20sent','debug','VtigerAccount,\x20%s,\x20%s,\x20%s','stringify','error','code','VtigerAccount,\x20%s,\x20%s'];(function(_0x36628b,_0x9e370a){var _0x5680fe=function(_0x5605e5){while(--_0x5605e5){_0x36628b['push'](_0x36628b['shift']());}};_0x5680fe(++_0x9e370a);}(_0x6324,0x142));var _0x4632=function(_0x3a08e3,_0x6812cb){_0x3a08e3=_0x3a08e3-0x0;var _0xb2d69e=_0x6324[_0x3a08e3];return _0xb2d69e;};'use strict';var _=require(_0x4632('0x0'));var util=require(_0x4632('0x1'));var moment=require(_0x4632('0x2'));var BPromise=require(_0x4632('0x3'));var rs=require('randomstring');var fs=require('fs');var Redis=require(_0x4632('0x4'));var db=require('../../mysqldb')['db'];var utils=require(_0x4632('0x5'));var logger=require('../../config/logger')(_0x4632('0x6'));var config=require('../../config/environment');var jayson=require(_0x4632('0x7'));var client=jayson[_0x4632('0x8')][_0x4632('0x9')]({'port':0x232a});function respondWithRpcPromise(_0x126e9a,_0x4a15b2,_0x17e860){return new BPromise(function(_0x44dd6d,_0x390a46){return client['request'](_0x126e9a,_0x17e860)[_0x4632('0xa')](function(_0x47824c){logger['info']('VtigerAccount,\x20%s,\x20%s',_0x4a15b2,_0x4632('0xb'));logger[_0x4632('0xc')](_0x4632('0xd'),_0x4a15b2,_0x4632('0xb'),JSON[_0x4632('0xe')](_0x47824c));if(_0x47824c[_0x4632('0xf')]){if(_0x47824c[_0x4632('0xf')][_0x4632('0x10')]===0x1f4){logger['error'](_0x4632('0x11'),_0x4a15b2,_0x47824c['error'][_0x4632('0x12')]);return _0x390a46(_0x47824c[_0x4632('0xf')][_0x4632('0x12')]);}logger[_0x4632('0xf')]('VtigerAccount,\x20%s,\x20%s',_0x4a15b2,_0x47824c[_0x4632('0xf')][_0x4632('0x12')]);return _0x44dd6d(_0x47824c[_0x4632('0xf')][_0x4632('0x12')]);}else{logger[_0x4632('0x13')]('VtigerAccount,\x20%s,\x20%s',_0x4a15b2,'request\x20sent');_0x44dd6d(_0x47824c[_0x4632('0x14')][_0x4632('0x12')]);}})[_0x4632('0x15')](function(_0x125eb9){logger['error'](_0x4632('0x11'),_0x4a15b2,_0x125eb9);_0x390a46(_0x125eb9);});});}exports[_0x4632('0x16')]=function(_0x1a94c0){var _0x5b28b7=this;return new Promise(function(_0x3cddfa,_0x1894bb){return db['VtigerAccount']['findAll']({'raw':_0x1a94c0[_0x4632('0x17')]?_0x1a94c0[_0x4632('0x17')][_0x4632('0x18')]===undefined?!![]:![]:!![],'where':_0x1a94c0[_0x4632('0x17')]?_0x1a94c0[_0x4632('0x17')][_0x4632('0x19')]||null:null,'attributes':_0x1a94c0[_0x4632('0x17')]?_0x1a94c0[_0x4632('0x17')][_0x4632('0x1a')]||null:null,'limit':_0x1a94c0[_0x4632('0x17')]?_0x1a94c0[_0x4632('0x17')][_0x4632('0x1b')]||null:null,'include':_0x1a94c0[_0x4632('0x17')]?_0x1a94c0[_0x4632('0x17')][_0x4632('0x1c')]?_[_0x4632('0x1d')](_0x1a94c0[_0x4632('0x17')][_0x4632('0x1c')],function(_0x380a9f){return{'model':db[_0x380a9f[_0x4632('0x1e')]],'as':_0x380a9f['as'],'attributes':_0x380a9f[_0x4632('0x1a')],'include':_0x380a9f[_0x4632('0x1c')]?_[_0x4632('0x1d')](_0x380a9f[_0x4632('0x1c')],function(_0xb074d){return{'model':db[_0xb074d[_0x4632('0x1e')]],'as':_0xb074d['as'],'attributes':_0xb074d[_0x4632('0x1a')],'include':_0xb074d[_0x4632('0x1c')]?_[_0x4632('0x1d')](_0xb074d[_0x4632('0x1c')],function(_0x22d0f5){return{'model':db[_0x22d0f5[_0x4632('0x1e')]],'as':_0x22d0f5['as'],'attributes':_0x22d0f5[_0x4632('0x1a')]};}):[]};}):[]};}):[]:[]})['then'](function(_0x57798a){logger[_0x4632('0x13')](_0x4632('0x16'),_0x1a94c0);logger[_0x4632('0xc')](_0x4632('0x16'),_0x1a94c0,JSON[_0x4632('0xe')](_0x57798a));_0x3cddfa(_0x57798a);})[_0x4632('0x15')](function(_0x3570b2){logger['error'](_0x4632('0x16'),_0x3570b2[_0x4632('0x12')],_0x1a94c0);_0x1894bb(_0x5b28b7['error'](0x1f4,_0x3570b2[_0x4632('0x12')]));});});};exports['ShowVtigerAccount']=function(_0x6599ad){var _0x4cb661=this;return new Promise(function(_0x4fda35,_0x1973eb){return db[_0x4632('0x1f')][_0x4632('0x20')]({'raw':_0x6599ad['options']?_0x6599ad['options'][_0x4632('0x18')]===undefined?!![]:![]:!![],'where':_0x6599ad[_0x4632('0x17')]?_0x6599ad['options']['where']||null:null,'attributes':_0x6599ad[_0x4632('0x17')]?_0x6599ad[_0x4632('0x17')]['attributes']||null:null,'include':_0x6599ad[_0x4632('0x17')]?_0x6599ad[_0x4632('0x17')][_0x4632('0x1c')]?_[_0x4632('0x1d')](_0x6599ad[_0x4632('0x17')]['include'],function(_0x5f0382){return{'model':db[_0x5f0382[_0x4632('0x1e')]],'as':_0x5f0382['as'],'attributes':_0x5f0382['attributes'],'include':_0x5f0382['include']?_[_0x4632('0x1d')](_0x5f0382['include'],function(_0x49355c){return{'model':db[_0x49355c[_0x4632('0x1e')]],'as':_0x49355c['as'],'attributes':_0x49355c['attributes'],'include':_0x49355c[_0x4632('0x1c')]?_[_0x4632('0x1d')](_0x49355c[_0x4632('0x1c')],function(_0x52dd7f){return{'model':db[_0x52dd7f[_0x4632('0x1e')]],'as':_0x52dd7f['as'],'attributes':_0x52dd7f[_0x4632('0x1a')]};}):[]};}):[]};}):[]:[]})[_0x4632('0xa')](function(_0xca07f5){logger[_0x4632('0x13')]('ShowVtigerAccount',_0x6599ad);logger['debug'](_0x4632('0x21'),_0x6599ad,JSON[_0x4632('0xe')](_0xca07f5));_0x4fda35(_0xca07f5);})[_0x4632('0x15')](function(_0x4f40af){logger['error']('ShowVtigerAccount',_0x4f40af[_0x4632('0x12')],_0x6599ad);_0x1973eb(_0x4cb661[_0x4632('0xf')](0x1f4,_0x4f40af['message']));});});}; \ No newline at end of file +var _0x2e54=['error','message','result','catch','GetVtigerAccount','VtigerAccount','options','raw','where','attributes','map','include','model','ShowVtigerAccount','stringify','lodash','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','jayson/promise','client','http','request','then','info','VtigerAccount,\x20%s,\x20%s','request\x20sent','debug','VtigerAccount,\x20%s,\x20%s,\x20%s'];(function(_0x433a8c,_0x45d79a){var _0x38fe59=function(_0x383efc){while(--_0x383efc){_0x433a8c['push'](_0x433a8c['shift']());}};_0x38fe59(++_0x45d79a);}(_0x2e54,0x1dd));var _0x42e5=function(_0x4cdcc1,_0x577725){_0x4cdcc1=_0x4cdcc1-0x0;var _0x5d019a=_0x2e54[_0x4cdcc1];return _0x5d019a;};'use strict';var _=require(_0x42e5('0x0'));var util=require('util');var moment=require('moment');var BPromise=require(_0x42e5('0x1'));var rs=require(_0x42e5('0x2'));var fs=require('fs');var Redis=require(_0x42e5('0x3'));var db=require(_0x42e5('0x4'))['db'];var utils=require(_0x42e5('0x5'));var logger=require(_0x42e5('0x6'))(_0x42e5('0x7'));var config=require('../../config/environment');var jayson=require(_0x42e5('0x8'));var client=jayson[_0x42e5('0x9')][_0x42e5('0xa')]({'port':0x232a});function respondWithRpcPromise(_0x4bed10,_0x2af5bb,_0x56be20){return new BPromise(function(_0x335b92,_0x490b99){return client[_0x42e5('0xb')](_0x4bed10,_0x56be20)[_0x42e5('0xc')](function(_0x10ee5a){logger[_0x42e5('0xd')](_0x42e5('0xe'),_0x2af5bb,_0x42e5('0xf'));logger[_0x42e5('0x10')](_0x42e5('0x11'),_0x2af5bb,_0x42e5('0xf'),JSON['stringify'](_0x10ee5a));if(_0x10ee5a[_0x42e5('0x12')]){if(_0x10ee5a[_0x42e5('0x12')]['code']===0x1f4){logger[_0x42e5('0x12')](_0x42e5('0xe'),_0x2af5bb,_0x10ee5a[_0x42e5('0x12')][_0x42e5('0x13')]);return _0x490b99(_0x10ee5a[_0x42e5('0x12')][_0x42e5('0x13')]);}logger[_0x42e5('0x12')](_0x42e5('0xe'),_0x2af5bb,_0x10ee5a[_0x42e5('0x12')][_0x42e5('0x13')]);return _0x335b92(_0x10ee5a['error'][_0x42e5('0x13')]);}else{logger[_0x42e5('0xd')](_0x42e5('0xe'),_0x2af5bb,_0x42e5('0xf'));_0x335b92(_0x10ee5a[_0x42e5('0x14')][_0x42e5('0x13')]);}})[_0x42e5('0x15')](function(_0x3abe3d){logger[_0x42e5('0x12')](_0x42e5('0xe'),_0x2af5bb,_0x3abe3d);_0x490b99(_0x3abe3d);});});}exports[_0x42e5('0x16')]=function(_0x38282d){var _0x11550e=this;return new Promise(function(_0x23fe09,_0x54fcfc){return db[_0x42e5('0x17')]['findAll']({'raw':_0x38282d['options']?_0x38282d[_0x42e5('0x18')][_0x42e5('0x19')]===undefined?!![]:![]:!![],'where':_0x38282d['options']?_0x38282d[_0x42e5('0x18')][_0x42e5('0x1a')]||null:null,'attributes':_0x38282d[_0x42e5('0x18')]?_0x38282d[_0x42e5('0x18')][_0x42e5('0x1b')]||null:null,'limit':_0x38282d[_0x42e5('0x18')]?_0x38282d[_0x42e5('0x18')]['limit']||null:null,'include':_0x38282d['options']?_0x38282d[_0x42e5('0x18')]['include']?_[_0x42e5('0x1c')](_0x38282d[_0x42e5('0x18')][_0x42e5('0x1d')],function(_0x49490f){return{'model':db[_0x49490f[_0x42e5('0x1e')]],'as':_0x49490f['as'],'attributes':_0x49490f['attributes'],'include':_0x49490f[_0x42e5('0x1d')]?_[_0x42e5('0x1c')](_0x49490f[_0x42e5('0x1d')],function(_0x275c80){return{'model':db[_0x275c80[_0x42e5('0x1e')]],'as':_0x275c80['as'],'attributes':_0x275c80['attributes'],'include':_0x275c80['include']?_[_0x42e5('0x1c')](_0x275c80['include'],function(_0x56f812){return{'model':db[_0x56f812[_0x42e5('0x1e')]],'as':_0x56f812['as'],'attributes':_0x56f812['attributes']};}):[]};}):[]};}):[]:[]})[_0x42e5('0xc')](function(_0x2d9e65){logger[_0x42e5('0xd')](_0x42e5('0x16'),_0x38282d);logger[_0x42e5('0x10')](_0x42e5('0x16'),_0x38282d,JSON['stringify'](_0x2d9e65));_0x23fe09(_0x2d9e65);})[_0x42e5('0x15')](function(_0x201d9e){logger[_0x42e5('0x12')](_0x42e5('0x16'),_0x201d9e[_0x42e5('0x13')],_0x38282d);_0x54fcfc(_0x11550e[_0x42e5('0x12')](0x1f4,_0x201d9e[_0x42e5('0x13')]));});});};exports[_0x42e5('0x1f')]=function(_0x5a4930){var _0x2ba9ef=this;return new Promise(function(_0x2c7542,_0x3d9e8b){return db[_0x42e5('0x17')]['find']({'raw':_0x5a4930[_0x42e5('0x18')]?_0x5a4930[_0x42e5('0x18')][_0x42e5('0x19')]===undefined?!![]:![]:!![],'where':_0x5a4930[_0x42e5('0x18')]?_0x5a4930['options']['where']||null:null,'attributes':_0x5a4930[_0x42e5('0x18')]?_0x5a4930['options'][_0x42e5('0x1b')]||null:null,'include':_0x5a4930['options']?_0x5a4930[_0x42e5('0x18')][_0x42e5('0x1d')]?_[_0x42e5('0x1c')](_0x5a4930['options'][_0x42e5('0x1d')],function(_0x3a8d1c){return{'model':db[_0x3a8d1c['model']],'as':_0x3a8d1c['as'],'attributes':_0x3a8d1c[_0x42e5('0x1b')],'include':_0x3a8d1c['include']?_[_0x42e5('0x1c')](_0x3a8d1c[_0x42e5('0x1d')],function(_0x25a040){return{'model':db[_0x25a040[_0x42e5('0x1e')]],'as':_0x25a040['as'],'attributes':_0x25a040[_0x42e5('0x1b')],'include':_0x25a040[_0x42e5('0x1d')]?_[_0x42e5('0x1c')](_0x25a040['include'],function(_0x5a18cc){return{'model':db[_0x5a18cc[_0x42e5('0x1e')]],'as':_0x5a18cc['as'],'attributes':_0x5a18cc[_0x42e5('0x1b')]};}):[]};}):[]};}):[]:[]})[_0x42e5('0xc')](function(_0x4a1a8a){logger['info']('ShowVtigerAccount',_0x5a4930);logger['debug'](_0x42e5('0x1f'),_0x5a4930,JSON[_0x42e5('0x20')](_0x4a1a8a));_0x2c7542(_0x4a1a8a);})[_0x42e5('0x15')](function(_0xedb7bc){logger[_0x42e5('0x12')](_0x42e5('0x1f'),_0xedb7bc[_0x42e5('0x13')],_0x5a4930);_0x3d9e8b(_0x2ba9ef[_0x42e5('0x12')](0x1f4,_0xedb7bc['message']));});});}; \ No newline at end of file diff --git a/server/api/intVtigerConfiguration/index.js b/server/api/intVtigerConfiguration/index.js index 720c203..03fe549 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 _0x004a=['isAuthenticated','index','show','/:id/fields','getSubjects','getDescriptions','create','/:id','delete','destroy','exports','multer','util','path','Router','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','get'];(function(_0x155952,_0x39309){var _0x4b0538=function(_0x3c7adc){while(--_0x3c7adc){_0x155952['push'](_0x155952['shift']());}};_0x4b0538(++_0x39309);}(_0x004a,0xe7));var _0xa004=function(_0xe101be,_0x137048){_0xe101be=_0xe101be-0x0;var _0x245749=_0x004a[_0xe101be];return _0x245749;};'use strict';var multer=require(_0xa004('0x0'));var util=require(_0xa004('0x1'));var path=require(_0xa004('0x2'));var timeout=require('connect-timeout');var express=require('express');var router=express[_0xa004('0x3')]();var fs_extra=require(_0xa004('0x4'));var auth=require(_0xa004('0x5'));var interaction=require(_0xa004('0x6'));var config=require(_0xa004('0x7'));var controller=require('./intVtigerConfiguration.controller');router[_0xa004('0x8')]('/',auth[_0xa004('0x9')](),controller[_0xa004('0xa')]);router[_0xa004('0x8')]('/:id',auth[_0xa004('0x9')](),controller[_0xa004('0xb')]);router[_0xa004('0x8')](_0xa004('0xc'),auth[_0xa004('0x9')](),controller['getFields']);router[_0xa004('0x8')]('/:id/subjects',auth[_0xa004('0x9')](),controller[_0xa004('0xd')]);router[_0xa004('0x8')]('/:id/descriptions',auth[_0xa004('0x9')](),controller[_0xa004('0xe')]);router['post']('/',auth[_0xa004('0x9')](),controller[_0xa004('0xf')]);router['put'](_0xa004('0x10'),auth['isAuthenticated'](),controller['update']);router[_0xa004('0x11')]('/:id',auth[_0xa004('0x9')](),controller[_0xa004('0x12')]);module[_0xa004('0x13')]=router; \ No newline at end of file +var _0x6aa5=['destroy','exports','multer','util','path','connect-timeout','express','Router','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','./intVtigerConfiguration.controller','get','isAuthenticated','index','show','/:id/fields','getFields','getSubjects','/:id/descriptions','getDescriptions','post','create','put','/:id','update','delete'];(function(_0x1efae4,_0x561358){var _0x15bab1=function(_0x3a5e22){while(--_0x3a5e22){_0x1efae4['push'](_0x1efae4['shift']());}};_0x15bab1(++_0x561358);}(_0x6aa5,0x136));var _0x56aa=function(_0xea2f6,_0xae7361){_0xea2f6=_0xea2f6-0x0;var _0x4b113c=_0x6aa5[_0xea2f6];return _0x4b113c;};'use strict';var multer=require(_0x56aa('0x0'));var util=require(_0x56aa('0x1'));var path=require(_0x56aa('0x2'));var timeout=require(_0x56aa('0x3'));var express=require(_0x56aa('0x4'));var router=express[_0x56aa('0x5')]();var fs_extra=require(_0x56aa('0x6'));var auth=require(_0x56aa('0x7'));var interaction=require(_0x56aa('0x8'));var config=require(_0x56aa('0x9'));var controller=require(_0x56aa('0xa'));router[_0x56aa('0xb')]('/',auth[_0x56aa('0xc')](),controller[_0x56aa('0xd')]);router[_0x56aa('0xb')]('/:id',auth[_0x56aa('0xc')](),controller[_0x56aa('0xe')]);router[_0x56aa('0xb')](_0x56aa('0xf'),auth[_0x56aa('0xc')](),controller[_0x56aa('0x10')]);router[_0x56aa('0xb')]('/:id/subjects',auth['isAuthenticated'](),controller[_0x56aa('0x11')]);router[_0x56aa('0xb')](_0x56aa('0x12'),auth[_0x56aa('0xc')](),controller[_0x56aa('0x13')]);router[_0x56aa('0x14')]('/',auth[_0x56aa('0xc')](),controller[_0x56aa('0x15')]);router[_0x56aa('0x16')](_0x56aa('0x17'),auth['isAuthenticated'](),controller[_0x56aa('0x18')]);router[_0x56aa('0x19')](_0x56aa('0x17'),auth[_0x56aa('0xc')](),controller[_0x56aa('0x1a')]);module[_0x56aa('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 ac76de9..085df65 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 _0x2fd7=['STRING','exports'];(function(_0x1505d8,_0x124aa6){var _0x4de523=function(_0x10ab0c){while(--_0x10ab0c){_0x1505d8['push'](_0x1505d8['shift']());}};_0x4de523(++_0x124aa6);}(_0x2fd7,0xaf));var _0x72fd=function(_0x5f3b71,_0x239e06){_0x5f3b71=_0x5f3b71-0x0;var _0x3ac2c4=_0x2fd7[_0x5f3b71];return _0x3ac2c4;};'use strict';var Sequelize=require('sequelize');module[_0x72fd('0x0')]={'name':{'type':Sequelize[_0x72fd('0x1')]},'description':{'type':Sequelize[_0x72fd('0x1')]}}; \ No newline at end of file +var _0xa9ee=['STRING','sequelize','exports'];(function(_0x5b561d,_0x422b7c){var _0x431060=function(_0x401409){while(--_0x401409){_0x5b561d['push'](_0x5b561d['shift']());}};_0x431060(++_0x422b7c);}(_0xa9ee,0x10f));var _0xea9e=function(_0x365139,_0x5a837b){_0x365139=_0x365139-0x0;var _0x541c8a=_0xa9ee[_0x365139];return _0x541c8a;};'use strict';var Sequelize=require(_0xea9e('0x0'));module[_0xea9e('0x1')]={'name':{'type':Sequelize[_0xea9e('0x2')]},'description':{'type':Sequelize[_0xea9e('0x2')]}}; \ No newline at end of file diff --git a/server/api/intVtigerConfiguration/intVtigerConfiguration.controller.js b/server/api/intVtigerConfiguration/intVtigerConfiguration.controller.js index 2135933..ad4d2f4 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 _0x3571=['getSubjects','findOne','getDescriptions','zip-dir','fast-json-patch','request-promise','moment','util','path','sox','fs-extra','lodash','crypto','desk.js','to-csv','querystring','ioredis','../../components/auth/service','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','../../config/utils','../../config/environment','../../mysqldb','sendStatus','status','end','offset','undefined','limit','count','set','json','reject','update','destroy','then','error','send','index','VtigerConfiguration','rawAttributes','fieldName','model','map','query','keys','filters','intersection','attributes','fields','length','hasOwnProperty','nolimit','order','sort','where','pick','filter','merge','VIRTUAL','options','includeAll','include','rows','catch','show','find','create','body','params','getFields','VtigerField'];(function(_0x20a584,_0xe384a5){var _0x4b41a8=function(_0x2127c6){while(--_0x2127c6){_0x20a584['push'](_0x20a584['shift']());}};_0x4b41a8(++_0xe384a5);}(_0x3571,0xde));var _0x1357=function(_0x3f3bad,_0x193f06){_0x3f3bad=_0x3f3bad-0x0;var _0x4f0801=_0x3571[_0x3f3bad];return _0x4f0801;};'use strict';var emlformat=require('eml-format');var rimraf=require('rimraf');var zipdir=require(_0x1357('0x0'));var jsonpatch=require(_0x1357('0x1'));var rp=require(_0x1357('0x2'));var moment=require(_0x1357('0x3'));var BPromise=require('bluebird');var Mustache=require('mustache');var util=require(_0x1357('0x4'));var path=require(_0x1357('0x5'));var sox=require(_0x1357('0x6'));var csv=require('to-csv');var ejs=require('ejs');var fs=require('fs');var fs_extra=require(_0x1357('0x7'));var _=require(_0x1357('0x8'));var squel=require('squel');var crypto=require(_0x1357('0x9'));var jsforce=require('jsforce');var deskjs=require(_0x1357('0xa'));var toCsv=require(_0x1357('0xb'));var querystring=require(_0x1357('0xc'));var Papa=require('papaparse');var Redis=require(_0x1357('0xd'));var authService=require(_0x1357('0xe'));var qs=require('../../components/parsers/qs');var as=require(_0x1357('0xf'));var hardwareService=require(_0x1357('0x10'));var logger=require(_0x1357('0x11'))('api');var utils=require(_0x1357('0x12'));var config=require(_0x1357('0x13'));var licenseUtil=require('../../config/license/util');var db=require(_0x1357('0x14'))['db'];function respondWithStatusCode(_0x515ad9,_0x55f086){_0x55f086=_0x55f086||0xcc;return function(_0x38b786){if(_0x38b786){return _0x515ad9[_0x1357('0x15')](_0x55f086);}return _0x515ad9[_0x1357('0x16')](_0x55f086)[_0x1357('0x17')]();};}function respondWithResult(_0x3228a4,_0x2fe454){_0x2fe454=_0x2fe454||0xc8;return function(_0x5eccfc){if(_0x5eccfc){return _0x3228a4['status'](_0x2fe454)['json'](_0x5eccfc);}};}function respondWithFilteredResult(_0x2a3f9f,_0xecda04){return function(_0x2730a7){if(_0x2730a7){var _0x22da25=typeof _0xecda04[_0x1357('0x18')]===_0x1357('0x19')&&typeof _0xecda04[_0x1357('0x1a')]===_0x1357('0x19');var _0x50b423=_0x2730a7[_0x1357('0x1b')];var _0x222cae=_0x22da25?0x0:_0xecda04[_0x1357('0x18')];var _0x15b238=_0x22da25?_0x2730a7[_0x1357('0x1b')]:_0xecda04[_0x1357('0x18')]+_0xecda04[_0x1357('0x1a')];var _0x53c857;if(_0x15b238>=_0x50b423){_0x15b238=_0x50b423;_0x53c857=0xc8;}else{_0x53c857=0xce;}_0x2a3f9f[_0x1357('0x16')](_0x53c857);return _0x2a3f9f[_0x1357('0x1c')]('Content-Range',_0x222cae+'-'+_0x15b238+'/'+_0x50b423)[_0x1357('0x1d')](_0x2730a7);}return null;};}function patchUpdates(_0x9f3ccc){return function(_0x353b07){try{jsonpatch['apply'](_0x353b07,_0x9f3ccc,!![]);}catch(_0x459e21){return BPromise[_0x1357('0x1e')](_0x459e21);}return _0x353b07['save']();};}function saveUpdates(_0xe8b73e,_0x5789ee){return function(_0x465bcc){if(_0x465bcc){return _0x465bcc[_0x1357('0x1f')](_0xe8b73e)['then'](function(_0x5c596a){return _0x5c596a;});}return null;};}function removeEntity(_0x18443c,_0x2f521f){return function(_0x593426){if(_0x593426){return _0x593426[_0x1357('0x20')]()[_0x1357('0x21')](function(){_0x18443c[_0x1357('0x16')](0xcc)[_0x1357('0x17')]();});}};}function handleEntityNotFound(_0x53738a,_0x370c9c){return function(_0x2b66d5){if(!_0x2b66d5){_0x53738a[_0x1357('0x15')](0x194);}return _0x2b66d5;};}function handleError(_0x2a67df,_0x27accf){_0x27accf=_0x27accf||0x1f4;return function(_0x49af3c){logger[_0x1357('0x22')](_0x49af3c['stack']);if(_0x49af3c['name']){delete _0x49af3c['name'];}_0x2a67df[_0x1357('0x16')](_0x27accf)[_0x1357('0x23')](_0x49af3c);};}exports[_0x1357('0x24')]=function(_0x10e113,_0x134479){var _0x5e09be={},_0x295d03={},_0x5b955b={'count':0x0,'rows':[]};var _0x3d9dce=_['map'](db[_0x1357('0x25')][_0x1357('0x26')],function(_0x48118b){return{'name':_0x48118b[_0x1357('0x27')],'type':_0x48118b['type']['key']};});_0x295d03[_0x1357('0x28')]=_[_0x1357('0x29')](_0x3d9dce,'name');_0x295d03[_0x1357('0x2a')]=_[_0x1357('0x2b')](_0x10e113[_0x1357('0x2a')]);_0x295d03[_0x1357('0x2c')]=_[_0x1357('0x2d')](_0x295d03[_0x1357('0x28')],_0x295d03[_0x1357('0x2a')]);_0x5e09be[_0x1357('0x2e')]=_[_0x1357('0x2d')](_0x295d03[_0x1357('0x28')],qs[_0x1357('0x2f')](_0x10e113['query'][_0x1357('0x2f')]));_0x5e09be[_0x1357('0x2e')]=_0x5e09be[_0x1357('0x2e')][_0x1357('0x30')]?_0x5e09be[_0x1357('0x2e')]:_0x295d03[_0x1357('0x28')];if(!_0x10e113['query'][_0x1357('0x31')](_0x1357('0x32'))){_0x5e09be[_0x1357('0x1a')]=qs[_0x1357('0x1a')](_0x10e113[_0x1357('0x2a')][_0x1357('0x1a')]);_0x5e09be['offset']=qs[_0x1357('0x18')](_0x10e113['query'][_0x1357('0x18')]);}_0x5e09be[_0x1357('0x33')]=qs['sort'](_0x10e113[_0x1357('0x2a')][_0x1357('0x34')]);_0x5e09be[_0x1357('0x35')]=qs[_0x1357('0x2c')](_[_0x1357('0x36')](_0x10e113[_0x1357('0x2a')],_0x295d03[_0x1357('0x2c')]),_0x3d9dce);if(_0x10e113[_0x1357('0x2a')][_0x1357('0x37')]){_0x5e09be[_0x1357('0x35')]=_[_0x1357('0x38')](_0x5e09be[_0x1357('0x35')],{'$or':_[_0x1357('0x29')](_0x3d9dce,function(_0x94d1ab){if(_0x94d1ab['type']!==_0x1357('0x39')){var _0x49ecf7={};_0x49ecf7[_0x94d1ab['name']]={'$like':'%'+_0x10e113['query'][_0x1357('0x37')]+'%'};return _0x49ecf7;}})});}_0x5e09be=_[_0x1357('0x38')]({},_0x5e09be,_0x10e113[_0x1357('0x3a')]);var _0x136b40={'where':_0x5e09be[_0x1357('0x35')]};return db[_0x1357('0x25')][_0x1357('0x1b')](_0x136b40)[_0x1357('0x21')](function(_0x5d9b17){_0x5b955b['count']=_0x5d9b17;if(_0x10e113['query'][_0x1357('0x3b')]){_0x5e09be[_0x1357('0x3c')]=[{'all':!![]}];}return db[_0x1357('0x25')]['findAll'](_0x5e09be);})['then'](function(_0x6e19c6){_0x5b955b[_0x1357('0x3d')]=_0x6e19c6;return _0x5b955b;})[_0x1357('0x21')](respondWithFilteredResult(_0x134479,_0x5e09be))[_0x1357('0x3e')](handleError(_0x134479,null));};exports[_0x1357('0x3f')]=function(_0x4f471e,_0xa50110){var _0x2d2d1b={'raw':![],'where':{'id':_0x4f471e['params']['id']}},_0x193b14={};_0x193b14[_0x1357('0x28')]=_[_0x1357('0x2b')](db[_0x1357('0x25')][_0x1357('0x26')]);_0x193b14[_0x1357('0x2a')]=_[_0x1357('0x2b')](_0x4f471e[_0x1357('0x2a')]);_0x193b14['filters']=_[_0x1357('0x2d')](_0x193b14[_0x1357('0x28')],_0x193b14[_0x1357('0x2a')]);_0x2d2d1b['attributes']=_[_0x1357('0x2d')](_0x193b14[_0x1357('0x28')],qs[_0x1357('0x2f')](_0x4f471e['query']['fields']));_0x2d2d1b[_0x1357('0x2e')]=_0x2d2d1b[_0x1357('0x2e')][_0x1357('0x30')]?_0x2d2d1b[_0x1357('0x2e')]:_0x193b14[_0x1357('0x28')];if(_0x4f471e[_0x1357('0x2a')][_0x1357('0x3b')]){_0x2d2d1b[_0x1357('0x3c')]=[{'all':!![]}];}_0x2d2d1b=_[_0x1357('0x38')]({},_0x2d2d1b,_0x4f471e['options']);return db[_0x1357('0x25')][_0x1357('0x40')](_0x2d2d1b)[_0x1357('0x21')](handleEntityNotFound(_0xa50110,null))['then'](respondWithResult(_0xa50110,null))[_0x1357('0x3e')](handleError(_0xa50110,null));};exports[_0x1357('0x41')]=function(_0x2136a7,_0x922818){return db[_0x1357('0x25')][_0x1357('0x41')](_0x2136a7[_0x1357('0x42')],{})[_0x1357('0x21')](respondWithResult(_0x922818,0xc9))[_0x1357('0x3e')](handleError(_0x922818,null));};exports[_0x1357('0x1f')]=function(_0x53e84f,_0x490b2d){if(_0x53e84f[_0x1357('0x42')]['id']){delete _0x53e84f[_0x1357('0x42')]['id'];}return db[_0x1357('0x25')][_0x1357('0x40')]({'where':{'id':_0x53e84f[_0x1357('0x43')]['id']}})[_0x1357('0x21')](handleEntityNotFound(_0x490b2d,null))[_0x1357('0x21')](saveUpdates(_0x53e84f['body'],null))[_0x1357('0x21')](respondWithResult(_0x490b2d,null))[_0x1357('0x3e')](handleError(_0x490b2d,null));};exports[_0x1357('0x20')]=function(_0x1bbb4d,_0x487ac5){return db[_0x1357('0x25')][_0x1357('0x40')]({'where':{'id':_0x1bbb4d[_0x1357('0x43')]['id']}})[_0x1357('0x21')](handleEntityNotFound(_0x487ac5,null))[_0x1357('0x21')](removeEntity(_0x487ac5,null))['catch'](handleError(_0x487ac5,null));};exports[_0x1357('0x44')]=function(_0x452978,_0x32d4ec,_0x20eefc){var _0x30825a={};var _0x45274b={};var _0x256907;var _0x1e4387;return db['VtigerConfiguration']['findOne']({'where':{'id':_0x452978['params']['id']}})['then'](handleEntityNotFound(_0x32d4ec,null))['then'](function(_0x1dc703){if(_0x1dc703){_0x256907=_0x1dc703;_0x45274b[_0x1357('0x28')]=_['keys'](db[_0x1357('0x45')][_0x1357('0x26')]);_0x45274b[_0x1357('0x2a')]=_['keys'](_0x452978[_0x1357('0x2a')]);_0x45274b[_0x1357('0x2c')]=_[_0x1357('0x2d')](_0x45274b['model'],_0x45274b[_0x1357('0x2a')]);_0x30825a[_0x1357('0x2e')]=_['intersection'](_0x45274b['model'],qs[_0x1357('0x2f')](_0x452978['query'][_0x1357('0x2f')]));_0x30825a['attributes']=_0x30825a[_0x1357('0x2e')][_0x1357('0x30')]?_0x30825a[_0x1357('0x2e')]:_0x45274b[_0x1357('0x28')];_0x30825a[_0x1357('0x33')]=qs[_0x1357('0x34')](_0x452978[_0x1357('0x2a')]['sort']);_0x30825a[_0x1357('0x35')]=qs[_0x1357('0x2c')](_[_0x1357('0x36')](_0x452978[_0x1357('0x2a')],_0x45274b[_0x1357('0x2c')]));if(_0x452978[_0x1357('0x2a')][_0x1357('0x37')]){_0x30825a[_0x1357('0x35')]=_[_0x1357('0x38')](_0x30825a[_0x1357('0x35')],{'$or':_[_0x1357('0x29')](_0x30825a['attributes'],function(_0xbd5fae){var _0x2ff0fb={};_0x2ff0fb[_0xbd5fae]={'$like':'%'+_0x452978[_0x1357('0x2a')][_0x1357('0x37')]+'%'};return _0x2ff0fb;})});}_0x30825a=_['merge']({},_0x30825a,_0x452978[_0x1357('0x3a')]);return _0x256907[_0x1357('0x44')](_0x30825a);}})['then'](function(_0x2490af){if(_0x2490af){_0x1e4387=_0x2490af[_0x1357('0x30')];if(!_0x452978[_0x1357('0x2a')][_0x1357('0x31')]('nolimit')){_0x30825a[_0x1357('0x1a')]=qs['limit'](_0x452978[_0x1357('0x2a')][_0x1357('0x1a')]);_0x30825a[_0x1357('0x18')]=qs[_0x1357('0x18')](_0x452978[_0x1357('0x2a')]['offset']);}return _0x256907[_0x1357('0x44')](_0x30825a);}})['then'](function(_0x5a4233){if(_0x5a4233){return _0x5a4233?{'count':_0x1e4387,'rows':_0x5a4233}:null;}})[_0x1357('0x21')](respondWithResult(_0x32d4ec,null))[_0x1357('0x3e')](handleError(_0x32d4ec,null));};exports[_0x1357('0x46')]=function(_0x38d38b,_0x1ca57f,_0x58df8b){var _0x32992d={};var _0x2068a9={};var _0x1e4a07;var _0x3c3c7e;return db[_0x1357('0x25')][_0x1357('0x47')]({'where':{'id':_0x38d38b['params']['id']}})[_0x1357('0x21')](handleEntityNotFound(_0x1ca57f,null))[_0x1357('0x21')](function(_0x2fd5b5){if(_0x2fd5b5){_0x1e4a07=_0x2fd5b5;_0x2068a9[_0x1357('0x28')]=_[_0x1357('0x2b')](db['VtigerField'][_0x1357('0x26')]);_0x2068a9[_0x1357('0x2a')]=_[_0x1357('0x2b')](_0x38d38b[_0x1357('0x2a')]);_0x2068a9[_0x1357('0x2c')]=_['intersection'](_0x2068a9[_0x1357('0x28')],_0x2068a9['query']);_0x32992d[_0x1357('0x2e')]=_[_0x1357('0x2d')](_0x2068a9['model'],qs[_0x1357('0x2f')](_0x38d38b[_0x1357('0x2a')][_0x1357('0x2f')]));_0x32992d[_0x1357('0x2e')]=_0x32992d[_0x1357('0x2e')][_0x1357('0x30')]?_0x32992d['attributes']:_0x2068a9['model'];_0x32992d[_0x1357('0x33')]=qs[_0x1357('0x34')](_0x38d38b[_0x1357('0x2a')][_0x1357('0x34')]);_0x32992d[_0x1357('0x35')]=qs[_0x1357('0x2c')](_[_0x1357('0x36')](_0x38d38b[_0x1357('0x2a')],_0x2068a9[_0x1357('0x2c')]));if(_0x38d38b['query'][_0x1357('0x37')]){_0x32992d[_0x1357('0x35')]=_[_0x1357('0x38')](_0x32992d[_0x1357('0x35')],{'$or':_['map'](_0x32992d[_0x1357('0x2e')],function(_0x35d8f1){var _0xc1ac0a={};_0xc1ac0a[_0x35d8f1]={'$like':'%'+_0x38d38b[_0x1357('0x2a')][_0x1357('0x37')]+'%'};return _0xc1ac0a;})});}_0x32992d=_['merge']({},_0x32992d,_0x38d38b[_0x1357('0x3a')]);return _0x1e4a07[_0x1357('0x46')](_0x32992d);}})['then'](function(_0x1569e3){if(_0x1569e3){_0x3c3c7e=_0x1569e3[_0x1357('0x30')];if(!_0x38d38b[_0x1357('0x2a')][_0x1357('0x31')]('nolimit')){_0x32992d['limit']=qs[_0x1357('0x1a')](_0x38d38b[_0x1357('0x2a')][_0x1357('0x1a')]);_0x32992d[_0x1357('0x18')]=qs[_0x1357('0x18')](_0x38d38b[_0x1357('0x2a')]['offset']);}return _0x1e4a07[_0x1357('0x46')](_0x32992d);}})[_0x1357('0x21')](function(_0x135aec){if(_0x135aec){return _0x135aec?{'count':_0x3c3c7e,'rows':_0x135aec}:null;}})[_0x1357('0x21')](respondWithResult(_0x1ca57f,null))['catch'](handleError(_0x1ca57f,null));};exports[_0x1357('0x48')]=function(_0x5dac5d,_0x3cfaaa,_0x390c7e){var _0x515b0f={};var _0x47af94={};var _0x3f68ec;var _0x58b097;return db[_0x1357('0x25')][_0x1357('0x47')]({'where':{'id':_0x5dac5d[_0x1357('0x43')]['id']}})[_0x1357('0x21')](handleEntityNotFound(_0x3cfaaa,null))['then'](function(_0x215a8d){if(_0x215a8d){_0x3f68ec=_0x215a8d;_0x47af94[_0x1357('0x28')]=_[_0x1357('0x2b')](db[_0x1357('0x45')][_0x1357('0x26')]);_0x47af94[_0x1357('0x2a')]=_[_0x1357('0x2b')](_0x5dac5d[_0x1357('0x2a')]);_0x47af94[_0x1357('0x2c')]=_[_0x1357('0x2d')](_0x47af94['model'],_0x47af94[_0x1357('0x2a')]);_0x515b0f['attributes']=_[_0x1357('0x2d')](_0x47af94[_0x1357('0x28')],qs[_0x1357('0x2f')](_0x5dac5d[_0x1357('0x2a')][_0x1357('0x2f')]));_0x515b0f['attributes']=_0x515b0f[_0x1357('0x2e')][_0x1357('0x30')]?_0x515b0f['attributes']:_0x47af94['model'];_0x515b0f['order']=qs[_0x1357('0x34')](_0x5dac5d[_0x1357('0x2a')][_0x1357('0x34')]);_0x515b0f[_0x1357('0x35')]=qs[_0x1357('0x2c')](_[_0x1357('0x36')](_0x5dac5d['query'],_0x47af94['filters']));if(_0x5dac5d['query']['filter']){_0x515b0f[_0x1357('0x35')]=_[_0x1357('0x38')](_0x515b0f[_0x1357('0x35')],{'$or':_['map'](_0x515b0f[_0x1357('0x2e')],function(_0x3f85a7){var _0x10d48b={};_0x10d48b[_0x3f85a7]={'$like':'%'+_0x5dac5d[_0x1357('0x2a')]['filter']+'%'};return _0x10d48b;})});}_0x515b0f=_[_0x1357('0x38')]({},_0x515b0f,_0x5dac5d[_0x1357('0x3a')]);return _0x3f68ec['getDescriptions'](_0x515b0f);}})[_0x1357('0x21')](function(_0x436b94){if(_0x436b94){_0x58b097=_0x436b94[_0x1357('0x30')];if(!_0x5dac5d[_0x1357('0x2a')][_0x1357('0x31')](_0x1357('0x32'))){_0x515b0f[_0x1357('0x1a')]=qs['limit'](_0x5dac5d['query']['limit']);_0x515b0f[_0x1357('0x18')]=qs[_0x1357('0x18')](_0x5dac5d[_0x1357('0x2a')][_0x1357('0x18')]);}return _0x3f68ec[_0x1357('0x48')](_0x515b0f);}})[_0x1357('0x21')](function(_0xfecc90){if(_0xfecc90){return _0xfecc90?{'count':_0x58b097,'rows':_0xfecc90}:null;}})[_0x1357('0x21')](respondWithResult(_0x3cfaaa,null))[_0x1357('0x3e')](handleError(_0x3cfaaa,null));}; \ No newline at end of file +var _0xb76c=['sendStatus','error','stack','name','send','map','VtigerConfiguration','rawAttributes','fieldName','model','query','keys','filters','intersection','fields','attributes','length','nolimit','where','pick','merge','VIRTUAL','filter','options','include','catch','show','params','includeAll','find','create','body','getFields','findOne','VtigerField','sort','hasOwnProperty','getSubjects','order','getDescriptions','rimraf','zip-dir','fast-json-patch','request-promise','moment','bluebird','mustache','util','sox','to-csv','ejs','fs-extra','lodash','squel','crypto','jsforce','desk.js','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../config/license/hardware','../../config/environment','status','end','json','count','offset','limit','set','Content-Range','reject','save','update','destroy','then'];(function(_0x2763f2,_0x416af8){var _0x3ef471=function(_0x288aa2){while(--_0x288aa2){_0x2763f2['push'](_0x2763f2['shift']());}};_0x3ef471(++_0x416af8);}(_0xb76c,0x74));var _0xcb76=function(_0x213518,_0x51e022){_0x213518=_0x213518-0x0;var _0x1baf75=_0xb76c[_0x213518];return _0x1baf75;};'use strict';var emlformat=require('eml-format');var rimraf=require(_0xcb76('0x0'));var zipdir=require(_0xcb76('0x1'));var jsonpatch=require(_0xcb76('0x2'));var rp=require(_0xcb76('0x3'));var moment=require(_0xcb76('0x4'));var BPromise=require(_0xcb76('0x5'));var Mustache=require(_0xcb76('0x6'));var util=require(_0xcb76('0x7'));var path=require('path');var sox=require(_0xcb76('0x8'));var csv=require(_0xcb76('0x9'));var ejs=require(_0xcb76('0xa'));var fs=require('fs');var fs_extra=require(_0xcb76('0xb'));var _=require(_0xcb76('0xc'));var squel=require(_0xcb76('0xd'));var crypto=require(_0xcb76('0xe'));var jsforce=require(_0xcb76('0xf'));var deskjs=require(_0xcb76('0x10'));var toCsv=require(_0xcb76('0x9'));var querystring=require('querystring');var Papa=require(_0xcb76('0x11'));var Redis=require(_0xcb76('0x12'));var authService=require(_0xcb76('0x13'));var qs=require(_0xcb76('0x14'));var as=require('../../components/parsers/advancedSearch');var hardwareService=require(_0xcb76('0x15'));var logger=require('../../config/logger')('api');var utils=require('../../config/utils');var config=require(_0xcb76('0x16'));var licenseUtil=require('../../config/license/util');var db=require('../../mysqldb')['db'];function respondWithStatusCode(_0x1534a2,_0x20d300){_0x20d300=_0x20d300||0xcc;return function(_0x254504){if(_0x254504){return _0x1534a2['sendStatus'](_0x20d300);}return _0x1534a2[_0xcb76('0x17')](_0x20d300)[_0xcb76('0x18')]();};}function respondWithResult(_0x191333,_0x5b0278){_0x5b0278=_0x5b0278||0xc8;return function(_0x7d7fe6){if(_0x7d7fe6){return _0x191333[_0xcb76('0x17')](_0x5b0278)[_0xcb76('0x19')](_0x7d7fe6);}};}function respondWithFilteredResult(_0x3f9b22,_0x2e27a6){return function(_0x16ceb9){if(_0x16ceb9){var _0x1066c6=typeof _0x2e27a6['offset']==='undefined'&&typeof _0x2e27a6['limit']==='undefined';var _0x28a3e6=_0x16ceb9[_0xcb76('0x1a')];var _0x3e3d9d=_0x1066c6?0x0:_0x2e27a6['offset'];var _0x4f38e4=_0x1066c6?_0x16ceb9[_0xcb76('0x1a')]:_0x2e27a6[_0xcb76('0x1b')]+_0x2e27a6[_0xcb76('0x1c')];var _0x35626a;if(_0x4f38e4>=_0x28a3e6){_0x4f38e4=_0x28a3e6;_0x35626a=0xc8;}else{_0x35626a=0xce;}_0x3f9b22[_0xcb76('0x17')](_0x35626a);return _0x3f9b22[_0xcb76('0x1d')](_0xcb76('0x1e'),_0x3e3d9d+'-'+_0x4f38e4+'/'+_0x28a3e6)[_0xcb76('0x19')](_0x16ceb9);}return null;};}function patchUpdates(_0x41704c){return function(_0x35c922){try{jsonpatch['apply'](_0x35c922,_0x41704c,!![]);}catch(_0x9bf589){return BPromise[_0xcb76('0x1f')](_0x9bf589);}return _0x35c922[_0xcb76('0x20')]();};}function saveUpdates(_0x3193db,_0x174b8c){return function(_0x317f05){if(_0x317f05){return _0x317f05[_0xcb76('0x21')](_0x3193db)['then'](function(_0x4a44ad){return _0x4a44ad;});}return null;};}function removeEntity(_0x677479,_0x2e359d){return function(_0x197127){if(_0x197127){return _0x197127[_0xcb76('0x22')]()[_0xcb76('0x23')](function(){_0x677479[_0xcb76('0x17')](0xcc)['end']();});}};}function handleEntityNotFound(_0x4f5c01,_0x141ddb){return function(_0x4085e2){if(!_0x4085e2){_0x4f5c01[_0xcb76('0x24')](0x194);}return _0x4085e2;};}function handleError(_0x3fa809,_0x231c0d){_0x231c0d=_0x231c0d||0x1f4;return function(_0x5cbb10){logger[_0xcb76('0x25')](_0x5cbb10[_0xcb76('0x26')]);if(_0x5cbb10[_0xcb76('0x27')]){delete _0x5cbb10[_0xcb76('0x27')];}_0x3fa809[_0xcb76('0x17')](_0x231c0d)[_0xcb76('0x28')](_0x5cbb10);};}exports['index']=function(_0x662e26,_0x4b2a32){var _0x558fb2={},_0x1fee3f={},_0x363aab={'count':0x0,'rows':[]};var _0x108954=_[_0xcb76('0x29')](db[_0xcb76('0x2a')][_0xcb76('0x2b')],function(_0x1104fa){return{'name':_0x1104fa[_0xcb76('0x2c')],'type':_0x1104fa['type']['key']};});_0x1fee3f[_0xcb76('0x2d')]=_[_0xcb76('0x29')](_0x108954,_0xcb76('0x27'));_0x1fee3f[_0xcb76('0x2e')]=_[_0xcb76('0x2f')](_0x662e26[_0xcb76('0x2e')]);_0x1fee3f[_0xcb76('0x30')]=_[_0xcb76('0x31')](_0x1fee3f['model'],_0x1fee3f['query']);_0x558fb2['attributes']=_[_0xcb76('0x31')](_0x1fee3f[_0xcb76('0x2d')],qs[_0xcb76('0x32')](_0x662e26['query'][_0xcb76('0x32')]));_0x558fb2[_0xcb76('0x33')]=_0x558fb2[_0xcb76('0x33')][_0xcb76('0x34')]?_0x558fb2['attributes']:_0x1fee3f[_0xcb76('0x2d')];if(!_0x662e26[_0xcb76('0x2e')]['hasOwnProperty'](_0xcb76('0x35'))){_0x558fb2[_0xcb76('0x1c')]=qs['limit'](_0x662e26[_0xcb76('0x2e')][_0xcb76('0x1c')]);_0x558fb2[_0xcb76('0x1b')]=qs['offset'](_0x662e26['query'][_0xcb76('0x1b')]);}_0x558fb2['order']=qs['sort'](_0x662e26[_0xcb76('0x2e')]['sort']);_0x558fb2[_0xcb76('0x36')]=qs[_0xcb76('0x30')](_[_0xcb76('0x37')](_0x662e26['query'],_0x1fee3f['filters']),_0x108954);if(_0x662e26[_0xcb76('0x2e')]['filter']){_0x558fb2[_0xcb76('0x36')]=_[_0xcb76('0x38')](_0x558fb2[_0xcb76('0x36')],{'$or':_[_0xcb76('0x29')](_0x108954,function(_0x3a5b79){if(_0x3a5b79['type']!==_0xcb76('0x39')){var _0x159cbf={};_0x159cbf[_0x3a5b79[_0xcb76('0x27')]]={'$like':'%'+_0x662e26[_0xcb76('0x2e')][_0xcb76('0x3a')]+'%'};return _0x159cbf;}})});}_0x558fb2=_[_0xcb76('0x38')]({},_0x558fb2,_0x662e26[_0xcb76('0x3b')]);var _0x4ba7a8={'where':_0x558fb2['where']};return db[_0xcb76('0x2a')][_0xcb76('0x1a')](_0x4ba7a8)[_0xcb76('0x23')](function(_0x4364a9){_0x363aab['count']=_0x4364a9;if(_0x662e26[_0xcb76('0x2e')]['includeAll']){_0x558fb2[_0xcb76('0x3c')]=[{'all':!![]}];}return db['VtigerConfiguration']['findAll'](_0x558fb2);})[_0xcb76('0x23')](function(_0x336bb6){_0x363aab['rows']=_0x336bb6;return _0x363aab;})[_0xcb76('0x23')](respondWithFilteredResult(_0x4b2a32,_0x558fb2))[_0xcb76('0x3d')](handleError(_0x4b2a32,null));};exports[_0xcb76('0x3e')]=function(_0x598801,_0x1f9a0f){var _0xd057ec={'raw':![],'where':{'id':_0x598801[_0xcb76('0x3f')]['id']}},_0x2bfdd0={};_0x2bfdd0[_0xcb76('0x2d')]=_[_0xcb76('0x2f')](db[_0xcb76('0x2a')]['rawAttributes']);_0x2bfdd0[_0xcb76('0x2e')]=_['keys'](_0x598801[_0xcb76('0x2e')]);_0x2bfdd0[_0xcb76('0x30')]=_[_0xcb76('0x31')](_0x2bfdd0[_0xcb76('0x2d')],_0x2bfdd0[_0xcb76('0x2e')]);_0xd057ec[_0xcb76('0x33')]=_[_0xcb76('0x31')](_0x2bfdd0['model'],qs[_0xcb76('0x32')](_0x598801[_0xcb76('0x2e')][_0xcb76('0x32')]));_0xd057ec['attributes']=_0xd057ec[_0xcb76('0x33')][_0xcb76('0x34')]?_0xd057ec['attributes']:_0x2bfdd0['model'];if(_0x598801[_0xcb76('0x2e')][_0xcb76('0x40')]){_0xd057ec[_0xcb76('0x3c')]=[{'all':!![]}];}_0xd057ec=_[_0xcb76('0x38')]({},_0xd057ec,_0x598801[_0xcb76('0x3b')]);return db[_0xcb76('0x2a')][_0xcb76('0x41')](_0xd057ec)['then'](handleEntityNotFound(_0x1f9a0f,null))[_0xcb76('0x23')](respondWithResult(_0x1f9a0f,null))[_0xcb76('0x3d')](handleError(_0x1f9a0f,null));};exports[_0xcb76('0x42')]=function(_0x4466fa,_0x35d26e){return db[_0xcb76('0x2a')][_0xcb76('0x42')](_0x4466fa['body'],{})[_0xcb76('0x23')](respondWithResult(_0x35d26e,0xc9))[_0xcb76('0x3d')](handleError(_0x35d26e,null));};exports['update']=function(_0x3d8d49,_0xc485b7){if(_0x3d8d49[_0xcb76('0x43')]['id']){delete _0x3d8d49['body']['id'];}return db['VtigerConfiguration']['find']({'where':{'id':_0x3d8d49[_0xcb76('0x3f')]['id']}})['then'](handleEntityNotFound(_0xc485b7,null))['then'](saveUpdates(_0x3d8d49['body'],null))[_0xcb76('0x23')](respondWithResult(_0xc485b7,null))[_0xcb76('0x3d')](handleError(_0xc485b7,null));};exports[_0xcb76('0x22')]=function(_0x4a5acf,_0x36f67f){return db['VtigerConfiguration'][_0xcb76('0x41')]({'where':{'id':_0x4a5acf['params']['id']}})['then'](handleEntityNotFound(_0x36f67f,null))[_0xcb76('0x23')](removeEntity(_0x36f67f,null))[_0xcb76('0x3d')](handleError(_0x36f67f,null));};exports[_0xcb76('0x44')]=function(_0x56e106,_0x570191,_0x45b0a3){var _0x26af38={};var _0x371c6b={};var _0x314f43;var _0x3fa88;return db['VtigerConfiguration'][_0xcb76('0x45')]({'where':{'id':_0x56e106[_0xcb76('0x3f')]['id']}})[_0xcb76('0x23')](handleEntityNotFound(_0x570191,null))[_0xcb76('0x23')](function(_0xf380e0){if(_0xf380e0){_0x314f43=_0xf380e0;_0x371c6b['model']=_[_0xcb76('0x2f')](db[_0xcb76('0x46')][_0xcb76('0x2b')]);_0x371c6b['query']=_[_0xcb76('0x2f')](_0x56e106['query']);_0x371c6b[_0xcb76('0x30')]=_[_0xcb76('0x31')](_0x371c6b[_0xcb76('0x2d')],_0x371c6b[_0xcb76('0x2e')]);_0x26af38[_0xcb76('0x33')]=_[_0xcb76('0x31')](_0x371c6b[_0xcb76('0x2d')],qs[_0xcb76('0x32')](_0x56e106[_0xcb76('0x2e')]['fields']));_0x26af38[_0xcb76('0x33')]=_0x26af38['attributes'][_0xcb76('0x34')]?_0x26af38[_0xcb76('0x33')]:_0x371c6b[_0xcb76('0x2d')];_0x26af38['order']=qs[_0xcb76('0x47')](_0x56e106['query']['sort']);_0x26af38['where']=qs[_0xcb76('0x30')](_[_0xcb76('0x37')](_0x56e106[_0xcb76('0x2e')],_0x371c6b[_0xcb76('0x30')]));if(_0x56e106[_0xcb76('0x2e')][_0xcb76('0x3a')]){_0x26af38[_0xcb76('0x36')]=_[_0xcb76('0x38')](_0x26af38[_0xcb76('0x36')],{'$or':_[_0xcb76('0x29')](_0x26af38['attributes'],function(_0xf87b40){var _0x5a6b17={};_0x5a6b17[_0xf87b40]={'$like':'%'+_0x56e106[_0xcb76('0x2e')]['filter']+'%'};return _0x5a6b17;})});}_0x26af38=_['merge']({},_0x26af38,_0x56e106[_0xcb76('0x3b')]);return _0x314f43[_0xcb76('0x44')](_0x26af38);}})[_0xcb76('0x23')](function(_0x499d71){if(_0x499d71){_0x3fa88=_0x499d71[_0xcb76('0x34')];if(!_0x56e106[_0xcb76('0x2e')][_0xcb76('0x48')](_0xcb76('0x35'))){_0x26af38[_0xcb76('0x1c')]=qs[_0xcb76('0x1c')](_0x56e106[_0xcb76('0x2e')]['limit']);_0x26af38['offset']=qs[_0xcb76('0x1b')](_0x56e106[_0xcb76('0x2e')][_0xcb76('0x1b')]);}return _0x314f43[_0xcb76('0x44')](_0x26af38);}})['then'](function(_0x337a67){if(_0x337a67){return _0x337a67?{'count':_0x3fa88,'rows':_0x337a67}:null;}})[_0xcb76('0x23')](respondWithResult(_0x570191,null))['catch'](handleError(_0x570191,null));};exports[_0xcb76('0x49')]=function(_0x104ce9,_0x2ebebc,_0x13e567){var _0x22d223={};var _0x653c64={};var _0x5d1548;var _0xbafbeb;return db[_0xcb76('0x2a')][_0xcb76('0x45')]({'where':{'id':_0x104ce9[_0xcb76('0x3f')]['id']}})['then'](handleEntityNotFound(_0x2ebebc,null))['then'](function(_0x353bb5){if(_0x353bb5){_0x5d1548=_0x353bb5;_0x653c64['model']=_[_0xcb76('0x2f')](db[_0xcb76('0x46')][_0xcb76('0x2b')]);_0x653c64['query']=_[_0xcb76('0x2f')](_0x104ce9[_0xcb76('0x2e')]);_0x653c64[_0xcb76('0x30')]=_[_0xcb76('0x31')](_0x653c64[_0xcb76('0x2d')],_0x653c64[_0xcb76('0x2e')]);_0x22d223['attributes']=_[_0xcb76('0x31')](_0x653c64[_0xcb76('0x2d')],qs[_0xcb76('0x32')](_0x104ce9[_0xcb76('0x2e')]['fields']));_0x22d223[_0xcb76('0x33')]=_0x22d223['attributes'][_0xcb76('0x34')]?_0x22d223[_0xcb76('0x33')]:_0x653c64[_0xcb76('0x2d')];_0x22d223[_0xcb76('0x4a')]=qs[_0xcb76('0x47')](_0x104ce9[_0xcb76('0x2e')]['sort']);_0x22d223[_0xcb76('0x36')]=qs['filters'](_[_0xcb76('0x37')](_0x104ce9[_0xcb76('0x2e')],_0x653c64[_0xcb76('0x30')]));if(_0x104ce9[_0xcb76('0x2e')]['filter']){_0x22d223[_0xcb76('0x36')]=_[_0xcb76('0x38')](_0x22d223[_0xcb76('0x36')],{'$or':_['map'](_0x22d223[_0xcb76('0x33')],function(_0x277c23){var _0x1c0684={};_0x1c0684[_0x277c23]={'$like':'%'+_0x104ce9[_0xcb76('0x2e')][_0xcb76('0x3a')]+'%'};return _0x1c0684;})});}_0x22d223=_[_0xcb76('0x38')]({},_0x22d223,_0x104ce9[_0xcb76('0x3b')]);return _0x5d1548[_0xcb76('0x49')](_0x22d223);}})[_0xcb76('0x23')](function(_0x19d67a){if(_0x19d67a){_0xbafbeb=_0x19d67a[_0xcb76('0x34')];if(!_0x104ce9[_0xcb76('0x2e')]['hasOwnProperty'](_0xcb76('0x35'))){_0x22d223[_0xcb76('0x1c')]=qs[_0xcb76('0x1c')](_0x104ce9['query']['limit']);_0x22d223[_0xcb76('0x1b')]=qs['offset'](_0x104ce9[_0xcb76('0x2e')][_0xcb76('0x1b')]);}return _0x5d1548[_0xcb76('0x49')](_0x22d223);}})[_0xcb76('0x23')](function(_0x254229){if(_0x254229){return _0x254229?{'count':_0xbafbeb,'rows':_0x254229}:null;}})[_0xcb76('0x23')](respondWithResult(_0x2ebebc,null))['catch'](handleError(_0x2ebebc,null));};exports[_0xcb76('0x4b')]=function(_0x50d632,_0x808ddf,_0x50e2b8){var _0xeb11f6={};var _0x8b2c3b={};var _0x2a2b17;var _0x1d3702;return db[_0xcb76('0x2a')][_0xcb76('0x45')]({'where':{'id':_0x50d632[_0xcb76('0x3f')]['id']}})['then'](handleEntityNotFound(_0x808ddf,null))[_0xcb76('0x23')](function(_0x501b82){if(_0x501b82){_0x2a2b17=_0x501b82;_0x8b2c3b[_0xcb76('0x2d')]=_[_0xcb76('0x2f')](db['VtigerField'][_0xcb76('0x2b')]);_0x8b2c3b[_0xcb76('0x2e')]=_[_0xcb76('0x2f')](_0x50d632['query']);_0x8b2c3b[_0xcb76('0x30')]=_[_0xcb76('0x31')](_0x8b2c3b[_0xcb76('0x2d')],_0x8b2c3b[_0xcb76('0x2e')]);_0xeb11f6['attributes']=_['intersection'](_0x8b2c3b[_0xcb76('0x2d')],qs[_0xcb76('0x32')](_0x50d632[_0xcb76('0x2e')][_0xcb76('0x32')]));_0xeb11f6[_0xcb76('0x33')]=_0xeb11f6[_0xcb76('0x33')][_0xcb76('0x34')]?_0xeb11f6[_0xcb76('0x33')]:_0x8b2c3b['model'];_0xeb11f6[_0xcb76('0x4a')]=qs[_0xcb76('0x47')](_0x50d632[_0xcb76('0x2e')]['sort']);_0xeb11f6[_0xcb76('0x36')]=qs[_0xcb76('0x30')](_[_0xcb76('0x37')](_0x50d632[_0xcb76('0x2e')],_0x8b2c3b[_0xcb76('0x30')]));if(_0x50d632[_0xcb76('0x2e')]['filter']){_0xeb11f6['where']=_[_0xcb76('0x38')](_0xeb11f6[_0xcb76('0x36')],{'$or':_['map'](_0xeb11f6[_0xcb76('0x33')],function(_0x5a27f6){var _0x4cb040={};_0x4cb040[_0x5a27f6]={'$like':'%'+_0x50d632[_0xcb76('0x2e')]['filter']+'%'};return _0x4cb040;})});}_0xeb11f6=_[_0xcb76('0x38')]({},_0xeb11f6,_0x50d632[_0xcb76('0x3b')]);return _0x2a2b17[_0xcb76('0x4b')](_0xeb11f6);}})[_0xcb76('0x23')](function(_0x669495){if(_0x669495){_0x1d3702=_0x669495['length'];if(!_0x50d632[_0xcb76('0x2e')][_0xcb76('0x48')](_0xcb76('0x35'))){_0xeb11f6['limit']=qs['limit'](_0x50d632[_0xcb76('0x2e')][_0xcb76('0x1c')]);_0xeb11f6['offset']=qs[_0xcb76('0x1b')](_0x50d632[_0xcb76('0x2e')][_0xcb76('0x1b')]);}return _0x2a2b17[_0xcb76('0x4b')](_0xeb11f6);}})['then'](function(_0x220872){if(_0x220872){return _0x220872?{'count':_0x1d3702,'rows':_0x220872}:null;}})[_0xcb76('0x23')](respondWithResult(_0x808ddf,null))['catch'](handleError(_0x808ddf,null));}; \ No newline at end of file diff --git a/server/api/intVtigerConfiguration/intVtigerConfiguration.model.js b/server/api/intVtigerConfiguration/intVtigerConfiguration.model.js index 6db0dca..b07b388 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 _0xcb41=['request-promise','path','rimraf','./intVtigerConfiguration.attributes','define','lodash','util','../../config/logger','moment','bluebird'];(function(_0x3fda28,_0x1dd370){var _0x4eb299=function(_0x45579d){while(--_0x45579d){_0x3fda28['push'](_0x3fda28['shift']());}};_0x4eb299(++_0x1dd370);}(_0xcb41,0x11d));var _0x1cb4=function(_0x1ab01e,_0x4b5914){_0x1ab01e=_0x1ab01e-0x0;var _0x79edeb=_0xcb41[_0x1ab01e];return _0x79edeb;};'use strict';var _=require(_0x1cb4('0x0'));var util=require(_0x1cb4('0x1'));var logger=require(_0x1cb4('0x2'))('api');var moment=require(_0x1cb4('0x3'));var BPromise=require(_0x1cb4('0x4'));var rp=require(_0x1cb4('0x5'));var fs=require('fs');var path=require(_0x1cb4('0x6'));var rimraf=require(_0x1cb4('0x7'));var config=require('../../config/environment');var attributes=require(_0x1cb4('0x8'));module['exports']=function(_0x20afd3,_0x4e69a5){return _0x20afd3[_0x1cb4('0x9')]('VtigerConfiguration',attributes,{'tableName':'int_vtiger_configurations','paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x2b68=['lodash','../../config/logger','api','bluebird','path','rimraf','../../config/environment','./intVtigerConfiguration.attributes','exports','define','VtigerConfiguration'];(function(_0x460cf2,_0x340c44){var _0x2d9834=function(_0x439063){while(--_0x439063){_0x460cf2['push'](_0x460cf2['shift']());}};_0x2d9834(++_0x340c44);}(_0x2b68,0x14a));var _0x82b6=function(_0x5388f6,_0x545fee){_0x5388f6=_0x5388f6-0x0;var _0x173721=_0x2b68[_0x5388f6];return _0x173721;};'use strict';var _=require(_0x82b6('0x0'));var util=require('util');var logger=require(_0x82b6('0x1'))(_0x82b6('0x2'));var moment=require('moment');var BPromise=require(_0x82b6('0x3'));var rp=require('request-promise');var fs=require('fs');var path=require(_0x82b6('0x4'));var rimraf=require(_0x82b6('0x5'));var config=require(_0x82b6('0x6'));var attributes=require(_0x82b6('0x7'));module[_0x82b6('0x8')]=function(_0x2f545d,_0x5633c4){return _0x2f545d[_0x82b6('0x9')](_0x82b6('0xa'),attributes,{'tableName':'int_vtiger_configurations','paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/intVtigerConfiguration/intVtigerConfiguration.rpc.js b/server/api/intVtigerConfiguration/intVtigerConfiguration.rpc.js index fcf76ac..7ac94c9 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 _0x175e=['jayson/promise','client','http','then','VtigerConfiguration,\x20%s,\x20%s','request\x20sent','VtigerConfiguration,\x20%s,\x20%s,\x20%s','stringify','error','code','message','info','catch','util','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/logger','rpc'];(function(_0x3b8823,_0x36eed1){var _0x813097=function(_0x1524a5){while(--_0x1524a5){_0x3b8823['push'](_0x3b8823['shift']());}};_0x813097(++_0x36eed1);}(_0x175e,0x15d));var _0xe175=function(_0x151cf0,_0x12155e){_0x151cf0=_0x151cf0-0x0;var _0x148f53=_0x175e[_0x151cf0];return _0x148f53;};'use strict';var _=require('lodash');var util=require(_0xe175('0x0'));var moment=require(_0xe175('0x1'));var BPromise=require(_0xe175('0x2'));var rs=require(_0xe175('0x3'));var fs=require('fs');var Redis=require(_0xe175('0x4'));var db=require(_0xe175('0x5'))['db'];var utils=require('../../config/utils');var logger=require(_0xe175('0x6'))(_0xe175('0x7'));var config=require('../../config/environment');var jayson=require(_0xe175('0x8'));var client=jayson[_0xe175('0x9')][_0xe175('0xa')]({'port':0x232a});function respondWithRpcPromise(_0x18641d,_0x1577e1,_0x4a336f){return new BPromise(function(_0x50b707,_0x49979b){return client['request'](_0x18641d,_0x4a336f)[_0xe175('0xb')](function(_0x3850a9){logger['info'](_0xe175('0xc'),_0x1577e1,_0xe175('0xd'));logger['debug'](_0xe175('0xe'),_0x1577e1,_0xe175('0xd'),JSON[_0xe175('0xf')](_0x3850a9));if(_0x3850a9['error']){if(_0x3850a9[_0xe175('0x10')][_0xe175('0x11')]===0x1f4){logger[_0xe175('0x10')]('VtigerConfiguration,\x20%s,\x20%s',_0x1577e1,_0x3850a9['error'][_0xe175('0x12')]);return _0x49979b(_0x3850a9['error'][_0xe175('0x12')]);}logger[_0xe175('0x10')](_0xe175('0xc'),_0x1577e1,_0x3850a9['error']['message']);return _0x50b707(_0x3850a9[_0xe175('0x10')]['message']);}else{logger[_0xe175('0x13')](_0xe175('0xc'),_0x1577e1,_0xe175('0xd'));_0x50b707(_0x3850a9['result']['message']);}})[_0xe175('0x14')](function(_0x3b5aeb){logger[_0xe175('0x10')](_0xe175('0xc'),_0x1577e1,_0x3b5aeb);_0x49979b(_0x3b5aeb);});});} \ No newline at end of file +var _0x4118=['info','catch','lodash','util','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/logger','rpc','../../config/environment','http','request','VtigerConfiguration,\x20%s,\x20%s','request\x20sent','debug','VtigerConfiguration,\x20%s,\x20%s,\x20%s','error','code','message'];(function(_0x13e902,_0x2b7257){var _0x36bae1=function(_0x423dbe){while(--_0x423dbe){_0x13e902['push'](_0x13e902['shift']());}};_0x36bae1(++_0x2b7257);}(_0x4118,0xbf));var _0x8411=function(_0x397cfb,_0xb8f317){_0x397cfb=_0x397cfb-0x0;var _0x15fed9=_0x4118[_0x397cfb];return _0x15fed9;};'use strict';var _=require(_0x8411('0x0'));var util=require(_0x8411('0x1'));var moment=require(_0x8411('0x2'));var BPromise=require(_0x8411('0x3'));var rs=require(_0x8411('0x4'));var fs=require('fs');var Redis=require(_0x8411('0x5'));var db=require(_0x8411('0x6'))['db'];var utils=require('../../config/utils');var logger=require(_0x8411('0x7'))(_0x8411('0x8'));var config=require(_0x8411('0x9'));var jayson=require('jayson/promise');var client=jayson['client'][_0x8411('0xa')]({'port':0x232a});function respondWithRpcPromise(_0x5e96fb,_0x34018d,_0x28e95b){return new BPromise(function(_0x217899,_0x2382a5){return client[_0x8411('0xb')](_0x5e96fb,_0x28e95b)['then'](function(_0x5f14ac){logger['info'](_0x8411('0xc'),_0x34018d,_0x8411('0xd'));logger[_0x8411('0xe')](_0x8411('0xf'),_0x34018d,_0x8411('0xd'),JSON['stringify'](_0x5f14ac));if(_0x5f14ac[_0x8411('0x10')]){if(_0x5f14ac[_0x8411('0x10')][_0x8411('0x11')]===0x1f4){logger[_0x8411('0x10')](_0x8411('0xc'),_0x34018d,_0x5f14ac[_0x8411('0x10')][_0x8411('0x12')]);return _0x2382a5(_0x5f14ac[_0x8411('0x10')]['message']);}logger['error'](_0x8411('0xc'),_0x34018d,_0x5f14ac[_0x8411('0x10')][_0x8411('0x12')]);return _0x217899(_0x5f14ac[_0x8411('0x10')]['message']);}else{logger[_0x8411('0x13')](_0x8411('0xc'),_0x34018d,'request\x20sent');_0x217899(_0x5f14ac['result'][_0x8411('0x12')]);}})[_0x8411('0x14')](function(_0x15eff8){logger[_0x8411('0x10')](_0x8411('0xc'),_0x34018d,_0x15eff8);_0x2382a5(_0x15eff8);});});} \ No newline at end of file diff --git a/server/api/intVtigerField/index.js b/server/api/intVtigerField/index.js index 38e40b6..75ebfc6 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 _0x8420=['express','Router','fs-extra','../../components/auth/service','../../components/interaction/service','get','isAuthenticated','show','post','create','/:id','update','delete','multer','path','connect-timeout'];(function(_0x5f0e14,_0x373cbb){var _0x3ed494=function(_0xa9785d){while(--_0xa9785d){_0x5f0e14['push'](_0x5f0e14['shift']());}};_0x3ed494(++_0x373cbb);}(_0x8420,0x7d));var _0x0842=function(_0x2ffe71,_0x218f25){_0x2ffe71=_0x2ffe71-0x0;var _0x386caa=_0x8420[_0x2ffe71];return _0x386caa;};'use strict';var multer=require(_0x0842('0x0'));var util=require('util');var path=require(_0x0842('0x1'));var timeout=require(_0x0842('0x2'));var express=require(_0x0842('0x3'));var router=express[_0x0842('0x4')]();var fs_extra=require(_0x0842('0x5'));var auth=require(_0x0842('0x6'));var interaction=require(_0x0842('0x7'));var config=require('../../config/environment');var controller=require('./intVtigerField.controller');router[_0x0842('0x8')]('/',auth[_0x0842('0x9')](),controller['index']);router['get']('/:id',auth[_0x0842('0x9')](),controller[_0x0842('0xa')]);router[_0x0842('0xb')]('/',auth[_0x0842('0x9')](),controller[_0x0842('0xc')]);router['put'](_0x0842('0xd'),auth[_0x0842('0x9')](),controller[_0x0842('0xe')]);router[_0x0842('0xf')](_0x0842('0xd'),auth[_0x0842('0x9')](),controller['destroy']);module['exports']=router; \ No newline at end of file +var _0x2c7e=['../../config/environment','./intVtigerField.controller','get','isAuthenticated','index','/:id','post','put','update','delete','exports','multer','util','connect-timeout','express','Router','fs-extra','../../components/auth/service','../../components/interaction/service'];(function(_0x2efd87,_0x5b2773){var _0x3fc329=function(_0x3b7430){while(--_0x3b7430){_0x2efd87['push'](_0x2efd87['shift']());}};_0x3fc329(++_0x5b2773);}(_0x2c7e,0x102));var _0xe2c7=function(_0x15143d,_0x2324db){_0x15143d=_0x15143d-0x0;var _0x2f5c4a=_0x2c7e[_0x15143d];return _0x2f5c4a;};'use strict';var multer=require(_0xe2c7('0x0'));var util=require(_0xe2c7('0x1'));var path=require('path');var timeout=require(_0xe2c7('0x2'));var express=require(_0xe2c7('0x3'));var router=express[_0xe2c7('0x4')]();var fs_extra=require(_0xe2c7('0x5'));var auth=require(_0xe2c7('0x6'));var interaction=require(_0xe2c7('0x7'));var config=require(_0xe2c7('0x8'));var controller=require(_0xe2c7('0x9'));router[_0xe2c7('0xa')]('/',auth[_0xe2c7('0xb')](),controller[_0xe2c7('0xc')]);router[_0xe2c7('0xa')](_0xe2c7('0xd'),auth[_0xe2c7('0xb')](),controller['show']);router[_0xe2c7('0xe')]('/',auth[_0xe2c7('0xb')](),controller['create']);router[_0xe2c7('0xf')](_0xe2c7('0xd'),auth[_0xe2c7('0xb')](),controller[_0xe2c7('0x10')]);router[_0xe2c7('0x11')](_0xe2c7('0xd'),auth[_0xe2c7('0xb')](),controller['destroy']);module[_0xe2c7('0x12')]=router; \ No newline at end of file diff --git a/server/api/intVtigerField/intVtigerField.attributes.js b/server/api/intVtigerField/intVtigerField.attributes.js index b6f3150..ffb7b46 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 _0xa7e3=['BOOLEAN','sequelize','variable','customVariable','keyValue','picklist','STRING','ENUM','string'];(function(_0x5bf031,_0xb5a232){var _0x11d780=function(_0xe7afc2){while(--_0xe7afc2){_0x5bf031['push'](_0x5bf031['shift']());}};_0x11d780(++_0xb5a232);}(_0xa7e3,0x1e7));var _0x3a7e=function(_0x274725,_0x3ae6c8){_0x274725=_0x274725-0x0;var _0x36215e=_0xa7e3[_0x274725];return _0x36215e;};'use strict';var Sequelize=require(_0x3a7e('0x0'));module['exports']={'type':{'type':Sequelize['ENUM']('string',_0x3a7e('0x1'),_0x3a7e('0x2'),_0x3a7e('0x3'),_0x3a7e('0x4')),'defaultValue':'string'},'content':{'type':Sequelize[_0x3a7e('0x5')]},'key':{'type':Sequelize[_0x3a7e('0x5')]},'keyType':{'type':Sequelize[_0x3a7e('0x6')](_0x3a7e('0x7'),_0x3a7e('0x1'),_0x3a7e('0x2'))},'keyContent':{'type':Sequelize[_0x3a7e('0x5')]},'idField':{'type':Sequelize[_0x3a7e('0x5')]},'nameField':{'type':Sequelize[_0x3a7e('0x5')]},'customField':{'type':Sequelize[_0x3a7e('0x8')],'defaultValue':!![]},'variableName':{'type':Sequelize['STRING']}}; \ No newline at end of file +var _0xeec2=['variable','customVariable','keyValue','picklist','STRING','BOOLEAN','sequelize','ENUM','string'];(function(_0x14add3,_0x13ce8d){var _0x4a174f=function(_0x2b3ed7){while(--_0x2b3ed7){_0x14add3['push'](_0x14add3['shift']());}};_0x4a174f(++_0x13ce8d);}(_0xeec2,0x165));var _0x2eec=function(_0x396140,_0x296c98){_0x396140=_0x396140-0x0;var _0x562c0b=_0xeec2[_0x396140];return _0x562c0b;};'use strict';var Sequelize=require(_0x2eec('0x0'));module['exports']={'type':{'type':Sequelize[_0x2eec('0x1')](_0x2eec('0x2'),_0x2eec('0x3'),_0x2eec('0x4'),_0x2eec('0x5'),_0x2eec('0x6')),'defaultValue':'string'},'content':{'type':Sequelize[_0x2eec('0x7')]},'key':{'type':Sequelize[_0x2eec('0x7')]},'keyType':{'type':Sequelize[_0x2eec('0x1')](_0x2eec('0x2'),_0x2eec('0x3'),'customVariable')},'keyContent':{'type':Sequelize[_0x2eec('0x7')]},'idField':{'type':Sequelize['STRING']},'nameField':{'type':Sequelize['STRING']},'customField':{'type':Sequelize[_0x2eec('0x8')],'defaultValue':!![]},'variableName':{'type':Sequelize[_0x2eec('0x7')]}}; \ No newline at end of file diff --git a/server/api/intVtigerField/intVtigerField.controller.js b/server/api/intVtigerField/intVtigerField.controller.js index 5c0105c..93c443b 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 _0x1127=['then','error','stack','name','send','index','map','VtigerField','fieldName','type','key','model','query','keys','filters','intersection','attributes','fields','length','hasOwnProperty','nolimit','order','sort','where','merge','VIRTUAL','filter','options','includeAll','include','findAll','show','params','rawAttributes','find','create','body','catch','update','destroy','eml-format','zip-dir','fast-json-patch','bluebird','util','sox','ejs','lodash','squel','crypto','jsforce','desk.js','to-csv','querystring','papaparse','ioredis','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/logger','api','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','sendStatus','end','status','offset','undefined','limit','count','reject','save'];(function(_0xce39ea,_0x1d2fca){var _0x38543f=function(_0x5521fc){while(--_0x5521fc){_0xce39ea['push'](_0xce39ea['shift']());}};_0x38543f(++_0x1d2fca);}(_0x1127,0x195));var _0x7112=function(_0x130dac,_0x4799d4){_0x130dac=_0x130dac-0x0;var _0x4d2555=_0x1127[_0x130dac];return _0x4d2555;};'use strict';var emlformat=require(_0x7112('0x0'));var rimraf=require('rimraf');var zipdir=require(_0x7112('0x1'));var jsonpatch=require(_0x7112('0x2'));var rp=require('request-promise');var moment=require('moment');var BPromise=require(_0x7112('0x3'));var Mustache=require('mustache');var util=require(_0x7112('0x4'));var path=require('path');var sox=require(_0x7112('0x5'));var csv=require('to-csv');var ejs=require(_0x7112('0x6'));var fs=require('fs');var fs_extra=require('fs-extra');var _=require(_0x7112('0x7'));var squel=require(_0x7112('0x8'));var crypto=require(_0x7112('0x9'));var jsforce=require(_0x7112('0xa'));var deskjs=require(_0x7112('0xb'));var toCsv=require(_0x7112('0xc'));var querystring=require(_0x7112('0xd'));var Papa=require(_0x7112('0xe'));var Redis=require(_0x7112('0xf'));var authService=require('../../components/auth/service');var qs=require(_0x7112('0x10'));var as=require(_0x7112('0x11'));var hardwareService=require('../../config/license/hardware');var logger=require(_0x7112('0x12'))(_0x7112('0x13'));var utils=require(_0x7112('0x14'));var config=require(_0x7112('0x15'));var licenseUtil=require(_0x7112('0x16'));var db=require(_0x7112('0x17'))['db'];function respondWithStatusCode(_0x2aa7a7,_0x4a75d9){_0x4a75d9=_0x4a75d9||0xcc;return function(_0x224e29){if(_0x224e29){return _0x2aa7a7[_0x7112('0x18')](_0x4a75d9);}return _0x2aa7a7['status'](_0x4a75d9)[_0x7112('0x19')]();};}function respondWithResult(_0x1f9ccb,_0x333ea6){_0x333ea6=_0x333ea6||0xc8;return function(_0x1485b4){if(_0x1485b4){return _0x1f9ccb[_0x7112('0x1a')](_0x333ea6)['json'](_0x1485b4);}};}function respondWithFilteredResult(_0x1cb291,_0x4bc08f){return function(_0x7a12ae){if(_0x7a12ae){var _0x17f861=typeof _0x4bc08f[_0x7112('0x1b')]===_0x7112('0x1c')&&typeof _0x4bc08f[_0x7112('0x1d')]===_0x7112('0x1c');var _0x55e911=_0x7a12ae[_0x7112('0x1e')];var _0x44cd78=_0x17f861?0x0:_0x4bc08f[_0x7112('0x1b')];var _0x5be157=_0x17f861?_0x7a12ae['count']:_0x4bc08f[_0x7112('0x1b')]+_0x4bc08f[_0x7112('0x1d')];var _0x816052;if(_0x5be157>=_0x55e911){_0x5be157=_0x55e911;_0x816052=0xc8;}else{_0x816052=0xce;}_0x1cb291[_0x7112('0x1a')](_0x816052);return _0x1cb291['set']('Content-Range',_0x44cd78+'-'+_0x5be157+'/'+_0x55e911)['json'](_0x7a12ae);}return null;};}function patchUpdates(_0x2887bd){return function(_0x460bc5){try{jsonpatch['apply'](_0x460bc5,_0x2887bd,!![]);}catch(_0x15d29f){return BPromise[_0x7112('0x1f')](_0x15d29f);}return _0x460bc5[_0x7112('0x20')]();};}function saveUpdates(_0x48b4e5,_0x30ebdf){return function(_0x3c451f){if(_0x3c451f){return _0x3c451f['update'](_0x48b4e5)[_0x7112('0x21')](function(_0x55b572){return _0x55b572;});}return null;};}function removeEntity(_0x236f9f,_0x3322e9){return function(_0x4ec572){if(_0x4ec572){return _0x4ec572['destroy']()[_0x7112('0x21')](function(){_0x236f9f[_0x7112('0x1a')](0xcc)[_0x7112('0x19')]();});}};}function handleEntityNotFound(_0x1915d9,_0x224459){return function(_0x3dd17f){if(!_0x3dd17f){_0x1915d9['sendStatus'](0x194);}return _0x3dd17f;};}function handleError(_0x2aa9f2,_0x326f83){_0x326f83=_0x326f83||0x1f4;return function(_0x2c738a){logger[_0x7112('0x22')](_0x2c738a[_0x7112('0x23')]);if(_0x2c738a[_0x7112('0x24')]){delete _0x2c738a[_0x7112('0x24')];}_0x2aa9f2['status'](_0x326f83)[_0x7112('0x25')](_0x2c738a);};}exports[_0x7112('0x26')]=function(_0x176bec,_0xe06329){var _0x194da4={},_0x46db11={},_0x18ba02={'count':0x0,'rows':[]};var _0x302db3=_[_0x7112('0x27')](db[_0x7112('0x28')]['rawAttributes'],function(_0x34e88c){return{'name':_0x34e88c[_0x7112('0x29')],'type':_0x34e88c[_0x7112('0x2a')][_0x7112('0x2b')]};});_0x46db11[_0x7112('0x2c')]=_[_0x7112('0x27')](_0x302db3,_0x7112('0x24'));_0x46db11[_0x7112('0x2d')]=_[_0x7112('0x2e')](_0x176bec[_0x7112('0x2d')]);_0x46db11[_0x7112('0x2f')]=_[_0x7112('0x30')](_0x46db11[_0x7112('0x2c')],_0x46db11[_0x7112('0x2d')]);_0x194da4[_0x7112('0x31')]=_[_0x7112('0x30')](_0x46db11[_0x7112('0x2c')],qs[_0x7112('0x32')](_0x176bec[_0x7112('0x2d')]['fields']));_0x194da4[_0x7112('0x31')]=_0x194da4[_0x7112('0x31')][_0x7112('0x33')]?_0x194da4['attributes']:_0x46db11['model'];if(!_0x176bec[_0x7112('0x2d')][_0x7112('0x34')](_0x7112('0x35'))){_0x194da4['limit']=qs['limit'](_0x176bec[_0x7112('0x2d')][_0x7112('0x1d')]);_0x194da4[_0x7112('0x1b')]=qs['offset'](_0x176bec['query'][_0x7112('0x1b')]);}_0x194da4[_0x7112('0x36')]=qs[_0x7112('0x37')](_0x176bec[_0x7112('0x2d')]['sort']);_0x194da4[_0x7112('0x38')]=qs['filters'](_['pick'](_0x176bec[_0x7112('0x2d')],_0x46db11[_0x7112('0x2f')]),_0x302db3);if(_0x176bec['query']['filter']){_0x194da4[_0x7112('0x38')]=_[_0x7112('0x39')](_0x194da4[_0x7112('0x38')],{'$or':_[_0x7112('0x27')](_0x302db3,function(_0x5ad421){if(_0x5ad421[_0x7112('0x2a')]!==_0x7112('0x3a')){var _0x4b3f64={};_0x4b3f64[_0x5ad421[_0x7112('0x24')]]={'$like':'%'+_0x176bec[_0x7112('0x2d')][_0x7112('0x3b')]+'%'};return _0x4b3f64;}})});}_0x194da4=_[_0x7112('0x39')]({},_0x194da4,_0x176bec[_0x7112('0x3c')]);var _0x2b5750={'where':_0x194da4[_0x7112('0x38')]};return db[_0x7112('0x28')][_0x7112('0x1e')](_0x2b5750)['then'](function(_0x1fc925){_0x18ba02[_0x7112('0x1e')]=_0x1fc925;if(_0x176bec[_0x7112('0x2d')][_0x7112('0x3d')]){_0x194da4[_0x7112('0x3e')]=[{'all':!![]}];}return db[_0x7112('0x28')][_0x7112('0x3f')](_0x194da4);})['then'](function(_0x1708f8){_0x18ba02['rows']=_0x1708f8;return _0x18ba02;})[_0x7112('0x21')](respondWithFilteredResult(_0xe06329,_0x194da4))['catch'](handleError(_0xe06329,null));};exports[_0x7112('0x40')]=function(_0x1f7dcc,_0x3c1b60){var _0x2d6c42={'raw':!![],'where':{'id':_0x1f7dcc[_0x7112('0x41')]['id']}},_0x174b84={};_0x174b84[_0x7112('0x2c')]=_['keys'](db['VtigerField'][_0x7112('0x42')]);_0x174b84[_0x7112('0x2d')]=_[_0x7112('0x2e')](_0x1f7dcc[_0x7112('0x2d')]);_0x174b84[_0x7112('0x2f')]=_['intersection'](_0x174b84[_0x7112('0x2c')],_0x174b84[_0x7112('0x2d')]);_0x2d6c42[_0x7112('0x31')]=_[_0x7112('0x30')](_0x174b84[_0x7112('0x2c')],qs[_0x7112('0x32')](_0x1f7dcc[_0x7112('0x2d')]['fields']));_0x2d6c42[_0x7112('0x31')]=_0x2d6c42[_0x7112('0x31')][_0x7112('0x33')]?_0x2d6c42['attributes']:_0x174b84['model'];if(_0x1f7dcc[_0x7112('0x2d')]['includeAll']){_0x2d6c42[_0x7112('0x3e')]=[{'all':!![]}];}_0x2d6c42=_[_0x7112('0x39')]({},_0x2d6c42,_0x1f7dcc[_0x7112('0x3c')]);return db[_0x7112('0x28')][_0x7112('0x43')](_0x2d6c42)['then'](handleEntityNotFound(_0x3c1b60,null))[_0x7112('0x21')](respondWithResult(_0x3c1b60,null))['catch'](handleError(_0x3c1b60,null));};exports[_0x7112('0x44')]=function(_0xb52b24,_0x2a535c){return db[_0x7112('0x28')][_0x7112('0x44')](_0xb52b24[_0x7112('0x45')],{})[_0x7112('0x21')](respondWithResult(_0x2a535c,0xc9))[_0x7112('0x46')](handleError(_0x2a535c,null));};exports[_0x7112('0x47')]=function(_0x20e5a0,_0xbda84b){if(_0x20e5a0[_0x7112('0x45')]['id']){delete _0x20e5a0['body']['id'];}return db[_0x7112('0x28')][_0x7112('0x43')]({'where':{'id':_0x20e5a0['params']['id']}})['then'](handleEntityNotFound(_0xbda84b,null))[_0x7112('0x21')](saveUpdates(_0x20e5a0['body'],null))[_0x7112('0x21')](respondWithResult(_0xbda84b,null))[_0x7112('0x46')](handleError(_0xbda84b,null));};exports[_0x7112('0x48')]=function(_0x32a7f8,_0x4ec0a8){return db[_0x7112('0x28')][_0x7112('0x43')]({'where':{'id':_0x32a7f8[_0x7112('0x41')]['id']}})[_0x7112('0x21')](handleEntityNotFound(_0x4ec0a8,null))['then'](removeEntity(_0x4ec0a8,null))[_0x7112('0x46')](handleError(_0x4ec0a8,null));}; \ No newline at end of file +var _0xbcee=['fields','length','hasOwnProperty','nolimit','order','sort','pick','filter','where','merge','VIRTUAL','name','options','includeAll','include','findAll','rows','show','params','find','create','body','catch','update','eml-format','rimraf','zip-dir','fast-json-patch','bluebird','mustache','util','path','sox','to-csv','ejs','fs-extra','lodash','squel','crypto','querystring','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/environment','../../config/license/util','sendStatus','status','end','json','undefined','limit','count','offset','Content-Range','apply','save','then','destroy','error','stack','send','index','map','VtigerField','rawAttributes','fieldName','type','query','keys','filters','intersection','model','attributes'];(function(_0x57ee9f,_0x5a3d41){var _0xa69e05=function(_0x4539d7){while(--_0x4539d7){_0x57ee9f['push'](_0x57ee9f['shift']());}};_0xa69e05(++_0x5a3d41);}(_0xbcee,0x1e6));var _0xebce=function(_0x16a684,_0x214b26){_0x16a684=_0x16a684-0x0;var _0x1e6d34=_0xbcee[_0x16a684];return _0x1e6d34;};'use strict';var emlformat=require(_0xebce('0x0'));var rimraf=require(_0xebce('0x1'));var zipdir=require(_0xebce('0x2'));var jsonpatch=require(_0xebce('0x3'));var rp=require('request-promise');var moment=require('moment');var BPromise=require(_0xebce('0x4'));var Mustache=require(_0xebce('0x5'));var util=require(_0xebce('0x6'));var path=require(_0xebce('0x7'));var sox=require(_0xebce('0x8'));var csv=require(_0xebce('0x9'));var ejs=require(_0xebce('0xa'));var fs=require('fs');var fs_extra=require(_0xebce('0xb'));var _=require(_0xebce('0xc'));var squel=require(_0xebce('0xd'));var crypto=require(_0xebce('0xe'));var jsforce=require('jsforce');var deskjs=require('desk.js');var toCsv=require(_0xebce('0x9'));var querystring=require(_0xebce('0xf'));var Papa=require('papaparse');var Redis=require('ioredis');var authService=require(_0xebce('0x10'));var qs=require(_0xebce('0x11'));var as=require(_0xebce('0x12'));var hardwareService=require(_0xebce('0x13'));var logger=require(_0xebce('0x14'))(_0xebce('0x15'));var utils=require(_0xebce('0x16'));var config=require(_0xebce('0x17'));var licenseUtil=require(_0xebce('0x18'));var db=require('../../mysqldb')['db'];function respondWithStatusCode(_0x2c4c58,_0x30f423){_0x30f423=_0x30f423||0xcc;return function(_0x5176f0){if(_0x5176f0){return _0x2c4c58[_0xebce('0x19')](_0x30f423);}return _0x2c4c58[_0xebce('0x1a')](_0x30f423)[_0xebce('0x1b')]();};}function respondWithResult(_0xe180cf,_0x399eff){_0x399eff=_0x399eff||0xc8;return function(_0x97744a){if(_0x97744a){return _0xe180cf[_0xebce('0x1a')](_0x399eff)[_0xebce('0x1c')](_0x97744a);}};}function respondWithFilteredResult(_0x5f5ba1,_0xcf572){return function(_0x4f4a2c){if(_0x4f4a2c){var _0x4a0aed=typeof _0xcf572['offset']===_0xebce('0x1d')&&typeof _0xcf572[_0xebce('0x1e')]===_0xebce('0x1d');var _0x88c397=_0x4f4a2c['count'];var _0x509bc7=_0x4a0aed?0x0:_0xcf572['offset'];var _0x143603=_0x4a0aed?_0x4f4a2c[_0xebce('0x1f')]:_0xcf572[_0xebce('0x20')]+_0xcf572[_0xebce('0x1e')];var _0x53151f;if(_0x143603>=_0x88c397){_0x143603=_0x88c397;_0x53151f=0xc8;}else{_0x53151f=0xce;}_0x5f5ba1[_0xebce('0x1a')](_0x53151f);return _0x5f5ba1['set'](_0xebce('0x21'),_0x509bc7+'-'+_0x143603+'/'+_0x88c397)['json'](_0x4f4a2c);}return null;};}function patchUpdates(_0x48418d){return function(_0x4e4eed){try{jsonpatch[_0xebce('0x22')](_0x4e4eed,_0x48418d,!![]);}catch(_0x239d45){return BPromise['reject'](_0x239d45);}return _0x4e4eed[_0xebce('0x23')]();};}function saveUpdates(_0x95688c,_0x34642b){return function(_0x856051){if(_0x856051){return _0x856051['update'](_0x95688c)[_0xebce('0x24')](function(_0x815a18){return _0x815a18;});}return null;};}function removeEntity(_0x59a98f,_0x3ae1a3){return function(_0x4f248b){if(_0x4f248b){return _0x4f248b[_0xebce('0x25')]()[_0xebce('0x24')](function(){_0x59a98f[_0xebce('0x1a')](0xcc)[_0xebce('0x1b')]();});}};}function handleEntityNotFound(_0x270dde,_0xbda509){return function(_0x529d18){if(!_0x529d18){_0x270dde[_0xebce('0x19')](0x194);}return _0x529d18;};}function handleError(_0x278d92,_0x2104c2){_0x2104c2=_0x2104c2||0x1f4;return function(_0xe32b3d){logger[_0xebce('0x26')](_0xe32b3d[_0xebce('0x27')]);if(_0xe32b3d['name']){delete _0xe32b3d['name'];}_0x278d92[_0xebce('0x1a')](_0x2104c2)[_0xebce('0x28')](_0xe32b3d);};}exports[_0xebce('0x29')]=function(_0x585bb0,_0x466ca2){var _0x302268={},_0x5721b0={},_0x488c6b={'count':0x0,'rows':[]};var _0x2b7b8d=_[_0xebce('0x2a')](db[_0xebce('0x2b')][_0xebce('0x2c')],function(_0x268b78){return{'name':_0x268b78[_0xebce('0x2d')],'type':_0x268b78[_0xebce('0x2e')]['key']};});_0x5721b0['model']=_[_0xebce('0x2a')](_0x2b7b8d,'name');_0x5721b0[_0xebce('0x2f')]=_[_0xebce('0x30')](_0x585bb0[_0xebce('0x2f')]);_0x5721b0[_0xebce('0x31')]=_[_0xebce('0x32')](_0x5721b0[_0xebce('0x33')],_0x5721b0[_0xebce('0x2f')]);_0x302268[_0xebce('0x34')]=_[_0xebce('0x32')](_0x5721b0[_0xebce('0x33')],qs[_0xebce('0x35')](_0x585bb0[_0xebce('0x2f')]['fields']));_0x302268['attributes']=_0x302268['attributes'][_0xebce('0x36')]?_0x302268[_0xebce('0x34')]:_0x5721b0[_0xebce('0x33')];if(!_0x585bb0[_0xebce('0x2f')][_0xebce('0x37')](_0xebce('0x38'))){_0x302268[_0xebce('0x1e')]=qs[_0xebce('0x1e')](_0x585bb0['query']['limit']);_0x302268[_0xebce('0x20')]=qs[_0xebce('0x20')](_0x585bb0['query'][_0xebce('0x20')]);}_0x302268[_0xebce('0x39')]=qs[_0xebce('0x3a')](_0x585bb0['query'][_0xebce('0x3a')]);_0x302268['where']=qs[_0xebce('0x31')](_[_0xebce('0x3b')](_0x585bb0[_0xebce('0x2f')],_0x5721b0[_0xebce('0x31')]),_0x2b7b8d);if(_0x585bb0['query'][_0xebce('0x3c')]){_0x302268[_0xebce('0x3d')]=_[_0xebce('0x3e')](_0x302268[_0xebce('0x3d')],{'$or':_['map'](_0x2b7b8d,function(_0x3b6c1c){if(_0x3b6c1c[_0xebce('0x2e')]!==_0xebce('0x3f')){var _0x38ae48={};_0x38ae48[_0x3b6c1c[_0xebce('0x40')]]={'$like':'%'+_0x585bb0[_0xebce('0x2f')][_0xebce('0x3c')]+'%'};return _0x38ae48;}})});}_0x302268=_[_0xebce('0x3e')]({},_0x302268,_0x585bb0[_0xebce('0x41')]);var _0x852371={'where':_0x302268[_0xebce('0x3d')]};return db[_0xebce('0x2b')][_0xebce('0x1f')](_0x852371)[_0xebce('0x24')](function(_0x14cf14){_0x488c6b[_0xebce('0x1f')]=_0x14cf14;if(_0x585bb0['query'][_0xebce('0x42')]){_0x302268[_0xebce('0x43')]=[{'all':!![]}];}return db['VtigerField'][_0xebce('0x44')](_0x302268);})[_0xebce('0x24')](function(_0x3e6567){_0x488c6b[_0xebce('0x45')]=_0x3e6567;return _0x488c6b;})[_0xebce('0x24')](respondWithFilteredResult(_0x466ca2,_0x302268))['catch'](handleError(_0x466ca2,null));};exports[_0xebce('0x46')]=function(_0x898b39,_0xc518bc){var _0x14f7ce={'raw':!![],'where':{'id':_0x898b39[_0xebce('0x47')]['id']}},_0x60d67c={};_0x60d67c[_0xebce('0x33')]=_[_0xebce('0x30')](db['VtigerField']['rawAttributes']);_0x60d67c[_0xebce('0x2f')]=_[_0xebce('0x30')](_0x898b39[_0xebce('0x2f')]);_0x60d67c['filters']=_[_0xebce('0x32')](_0x60d67c[_0xebce('0x33')],_0x60d67c[_0xebce('0x2f')]);_0x14f7ce[_0xebce('0x34')]=_[_0xebce('0x32')](_0x60d67c[_0xebce('0x33')],qs[_0xebce('0x35')](_0x898b39[_0xebce('0x2f')][_0xebce('0x35')]));_0x14f7ce[_0xebce('0x34')]=_0x14f7ce[_0xebce('0x34')][_0xebce('0x36')]?_0x14f7ce[_0xebce('0x34')]:_0x60d67c[_0xebce('0x33')];if(_0x898b39[_0xebce('0x2f')][_0xebce('0x42')]){_0x14f7ce[_0xebce('0x43')]=[{'all':!![]}];}_0x14f7ce=_[_0xebce('0x3e')]({},_0x14f7ce,_0x898b39[_0xebce('0x41')]);return db[_0xebce('0x2b')][_0xebce('0x48')](_0x14f7ce)[_0xebce('0x24')](handleEntityNotFound(_0xc518bc,null))[_0xebce('0x24')](respondWithResult(_0xc518bc,null))['catch'](handleError(_0xc518bc,null));};exports[_0xebce('0x49')]=function(_0x39e6a7,_0x395973){return db[_0xebce('0x2b')][_0xebce('0x49')](_0x39e6a7[_0xebce('0x4a')],{})[_0xebce('0x24')](respondWithResult(_0x395973,0xc9))[_0xebce('0x4b')](handleError(_0x395973,null));};exports[_0xebce('0x4c')]=function(_0x52d3fc,_0x3a6d00){if(_0x52d3fc[_0xebce('0x4a')]['id']){delete _0x52d3fc[_0xebce('0x4a')]['id'];}return db[_0xebce('0x2b')][_0xebce('0x48')]({'where':{'id':_0x52d3fc[_0xebce('0x47')]['id']}})[_0xebce('0x24')](handleEntityNotFound(_0x3a6d00,null))[_0xebce('0x24')](saveUpdates(_0x52d3fc[_0xebce('0x4a')],null))[_0xebce('0x24')](respondWithResult(_0x3a6d00,null))[_0xebce('0x4b')](handleError(_0x3a6d00,null));};exports[_0xebce('0x25')]=function(_0x35bd2f,_0x833417){return db[_0xebce('0x2b')][_0xebce('0x48')]({'where':{'id':_0x35bd2f['params']['id']}})[_0xebce('0x24')](handleEntityNotFound(_0x833417,null))[_0xebce('0x24')](removeEntity(_0x833417,null))['catch'](handleError(_0x833417,null));}; \ No newline at end of file diff --git a/server/api/intVtigerField/intVtigerField.model.js b/server/api/intVtigerField/intVtigerField.model.js index 474a462..3b132da 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 _0xbe16=['exports','define','VtigerField','idField','FieldId','lodash','util','../../config/logger','api','bluebird','rimraf','./intVtigerField.attributes'];(function(_0x3dd15e,_0x1f0015){var _0x231fd0=function(_0x4f680a){while(--_0x4f680a){_0x3dd15e['push'](_0x3dd15e['shift']());}};_0x231fd0(++_0x1f0015);}(_0xbe16,0x89));var _0x6be1=function(_0x25e7cb,_0x3579b7){_0x25e7cb=_0x25e7cb-0x0;var _0x375d92=_0xbe16[_0x25e7cb];return _0x375d92;};'use strict';var _=require(_0x6be1('0x0'));var util=require(_0x6be1('0x1'));var logger=require(_0x6be1('0x2'))(_0x6be1('0x3'));var moment=require('moment');var BPromise=require(_0x6be1('0x4'));var rp=require('request-promise');var fs=require('fs');var path=require('path');var rimraf=require(_0x6be1('0x5'));var config=require('../../config/environment');var attributes=require(_0x6be1('0x6'));module[_0x6be1('0x7')]=function(_0x1da87c,_0x226387){return _0x1da87c[_0x6be1('0x8')](_0x6be1('0x9'),attributes,{'tableName':'int_vtiger_fields','paranoid':![],'indexes':[{'name':'vtiger_unique_index','fields':[_0x6be1('0xa'),_0x6be1('0xb')],'unique':!![]}],'timestamps':!![]});}; \ No newline at end of file +var _0x25b8=['int_vtiger_fields','vtiger_unique_index','idField','FieldId','lodash','util','../../config/logger','api','moment','bluebird','request-promise','rimraf','../../config/environment','./intVtigerField.attributes','define','VtigerField'];(function(_0x4e3775,_0x14bcc4){var _0x2cbd7e=function(_0xd3a7bc){while(--_0xd3a7bc){_0x4e3775['push'](_0x4e3775['shift']());}};_0x2cbd7e(++_0x14bcc4);}(_0x25b8,0x134));var _0x825b=function(_0x14add3,_0x13ce8d){_0x14add3=_0x14add3-0x0;var _0x4a174f=_0x25b8[_0x14add3];return _0x4a174f;};'use strict';var _=require(_0x825b('0x0'));var util=require(_0x825b('0x1'));var logger=require(_0x825b('0x2'))(_0x825b('0x3'));var moment=require(_0x825b('0x4'));var BPromise=require(_0x825b('0x5'));var rp=require(_0x825b('0x6'));var fs=require('fs');var path=require('path');var rimraf=require(_0x825b('0x7'));var config=require(_0x825b('0x8'));var attributes=require(_0x825b('0x9'));module['exports']=function(_0x257d2d,_0x55ec6f){return _0x257d2d[_0x825b('0xa')](_0x825b('0xb'),attributes,{'tableName':_0x825b('0xc'),'paranoid':![],'indexes':[{'name':_0x825b('0xd'),'fields':[_0x825b('0xe'),_0x825b('0xf')],'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 5b521f4..5a7a8e2 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 _0x6e16=['VtigerField,\x20%s,\x20%s','message','error','result','catch','lodash','util','bluebird','../../mysqldb','../../config/utils','../../config/logger','rpc','jayson/promise','client','http','request','then','info','debug','VtigerField,\x20%s,\x20%s,\x20%s','request\x20sent','code'];(function(_0x300ed4,_0x2eae12){var _0x302804=function(_0x103ddb){while(--_0x103ddb){_0x300ed4['push'](_0x300ed4['shift']());}};_0x302804(++_0x2eae12);}(_0x6e16,0x17b));var _0x66e1=function(_0x222628,_0x56ecf6){_0x222628=_0x222628-0x0;var _0x4236c9=_0x6e16[_0x222628];return _0x4236c9;};'use strict';var _=require(_0x66e1('0x0'));var util=require(_0x66e1('0x1'));var moment=require('moment');var BPromise=require(_0x66e1('0x2'));var rs=require('randomstring');var fs=require('fs');var Redis=require('ioredis');var db=require(_0x66e1('0x3'))['db'];var utils=require(_0x66e1('0x4'));var logger=require(_0x66e1('0x5'))(_0x66e1('0x6'));var config=require('../../config/environment');var jayson=require(_0x66e1('0x7'));var client=jayson[_0x66e1('0x8')][_0x66e1('0x9')]({'port':0x232a});function respondWithRpcPromise(_0x570305,_0x4287ec,_0x28abe7){return new BPromise(function(_0x4e7b9d,_0x1ee470){return client[_0x66e1('0xa')](_0x570305,_0x28abe7)[_0x66e1('0xb')](function(_0x55b32f){logger[_0x66e1('0xc')]('VtigerField,\x20%s,\x20%s',_0x4287ec,'request\x20sent');logger[_0x66e1('0xd')](_0x66e1('0xe'),_0x4287ec,_0x66e1('0xf'),JSON['stringify'](_0x55b32f));if(_0x55b32f['error']){if(_0x55b32f['error'][_0x66e1('0x10')]===0x1f4){logger['error'](_0x66e1('0x11'),_0x4287ec,_0x55b32f['error'][_0x66e1('0x12')]);return _0x1ee470(_0x55b32f['error'][_0x66e1('0x12')]);}logger[_0x66e1('0x13')](_0x66e1('0x11'),_0x4287ec,_0x55b32f['error']['message']);return _0x4e7b9d(_0x55b32f['error'][_0x66e1('0x12')]);}else{logger['info'](_0x66e1('0x11'),_0x4287ec,'request\x20sent');_0x4e7b9d(_0x55b32f[_0x66e1('0x14')]['message']);}})[_0x66e1('0x15')](function(_0x4aa2e9){logger[_0x66e1('0x13')]('VtigerField,\x20%s,\x20%s',_0x4287ec,_0x4aa2e9);_0x1ee470(_0x4aa2e9);});});} \ No newline at end of file +var _0xd4e2=['lodash','util','moment','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','request','then','info','request\x20sent','VtigerField,\x20%s,\x20%s,\x20%s','stringify','error','code','VtigerField,\x20%s,\x20%s','message','result'];(function(_0x203375,_0x33ced3){var _0x4616c0=function(_0x51ea41){while(--_0x51ea41){_0x203375['push'](_0x203375['shift']());}};_0x4616c0(++_0x33ced3);}(_0xd4e2,0xdc));var _0x2d4e=function(_0x2dafbe,_0x5d04de){_0x2dafbe=_0x2dafbe-0x0;var _0x58a45a=_0xd4e2[_0x2dafbe];return _0x58a45a;};'use strict';var _=require(_0x2d4e('0x0'));var util=require(_0x2d4e('0x1'));var moment=require(_0x2d4e('0x2'));var BPromise=require('bluebird');var rs=require(_0x2d4e('0x3'));var fs=require('fs');var Redis=require(_0x2d4e('0x4'));var db=require(_0x2d4e('0x5'))['db'];var utils=require(_0x2d4e('0x6'));var logger=require(_0x2d4e('0x7'))(_0x2d4e('0x8'));var config=require(_0x2d4e('0x9'));var jayson=require(_0x2d4e('0xa'));var client=jayson['client']['http']({'port':0x232a});function respondWithRpcPromise(_0x1408d1,_0x3ec502,_0x283918){return new BPromise(function(_0x508966,_0x57fd1d){return client[_0x2d4e('0xb')](_0x1408d1,_0x283918)[_0x2d4e('0xc')](function(_0x25fe81){logger[_0x2d4e('0xd')]('VtigerField,\x20%s,\x20%s',_0x3ec502,_0x2d4e('0xe'));logger['debug'](_0x2d4e('0xf'),_0x3ec502,_0x2d4e('0xe'),JSON[_0x2d4e('0x10')](_0x25fe81));if(_0x25fe81[_0x2d4e('0x11')]){if(_0x25fe81[_0x2d4e('0x11')][_0x2d4e('0x12')]===0x1f4){logger[_0x2d4e('0x11')](_0x2d4e('0x13'),_0x3ec502,_0x25fe81[_0x2d4e('0x11')][_0x2d4e('0x14')]);return _0x57fd1d(_0x25fe81[_0x2d4e('0x11')][_0x2d4e('0x14')]);}logger['error'](_0x2d4e('0x13'),_0x3ec502,_0x25fe81[_0x2d4e('0x11')][_0x2d4e('0x14')]);return _0x508966(_0x25fe81[_0x2d4e('0x11')][_0x2d4e('0x14')]);}else{logger[_0x2d4e('0xd')](_0x2d4e('0x13'),_0x3ec502,_0x2d4e('0xe'));_0x508966(_0x25fe81[_0x2d4e('0x15')]['message']);}})['catch'](function(_0x2b25ae){logger[_0x2d4e('0x11')](_0x2d4e('0x13'),_0x3ec502,_0x2b25ae);_0x57fd1d(_0x2b25ae);});});} \ No newline at end of file diff --git a/server/api/intZendeskAccount/index.js b/server/api/intZendeskAccount/index.js index 065f83e..730f945 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 _0x1f7a=['../../config/environment','./intZendeskAccount.controller','get','isAuthenticated','/:id','show','/:id/configurations','getConfigurations','post','create','put','update','delete','destroy','multer','path','connect-timeout','Router','fs-extra','../../components/auth/service'];(function(_0x48b5e0,_0xb3826){var _0x4287ea=function(_0x14519e){while(--_0x14519e){_0x48b5e0['push'](_0x48b5e0['shift']());}};_0x4287ea(++_0xb3826);}(_0x1f7a,0xc2));var _0xa1f7=function(_0x45b049,_0x35204c){_0x45b049=_0x45b049-0x0;var _0x92c66b=_0x1f7a[_0x45b049];return _0x92c66b;};'use strict';var multer=require(_0xa1f7('0x0'));var util=require('util');var path=require(_0xa1f7('0x1'));var timeout=require(_0xa1f7('0x2'));var express=require('express');var router=express[_0xa1f7('0x3')]();var fs_extra=require(_0xa1f7('0x4'));var auth=require(_0xa1f7('0x5'));var interaction=require('../../components/interaction/service');var config=require(_0xa1f7('0x6'));var controller=require(_0xa1f7('0x7'));router[_0xa1f7('0x8')]('/',auth[_0xa1f7('0x9')](),controller['index']);router[_0xa1f7('0x8')](_0xa1f7('0xa'),auth[_0xa1f7('0x9')](),controller[_0xa1f7('0xb')]);router[_0xa1f7('0x8')](_0xa1f7('0xc'),auth[_0xa1f7('0x9')](),controller[_0xa1f7('0xd')]);router[_0xa1f7('0x8')]('/:id/fields',auth[_0xa1f7('0x9')](),controller['getFields']);router[_0xa1f7('0xe')]('/',auth[_0xa1f7('0x9')](),controller[_0xa1f7('0xf')]);router['post']('/:id/configurations',auth[_0xa1f7('0x9')](),controller['addConfiguration']);router[_0xa1f7('0x10')](_0xa1f7('0xa'),auth['isAuthenticated'](),controller[_0xa1f7('0x11')]);router[_0xa1f7('0x12')](_0xa1f7('0xa'),auth[_0xa1f7('0x9')](),controller[_0xa1f7('0x13')]);module['exports']=router; \ No newline at end of file +var _0x47d3=['create','addConfiguration','put','delete','destroy','exports','path','connect-timeout','express','Router','fs-extra','./intZendeskAccount.controller','get','isAuthenticated','index','/:id','show','/:id/configurations','getConfigurations','/:id/fields','post'];(function(_0x2550e3,_0x37591f){var _0x14697e=function(_0x46c7bc){while(--_0x46c7bc){_0x2550e3['push'](_0x2550e3['shift']());}};_0x14697e(++_0x37591f);}(_0x47d3,0x117));var _0x347d=function(_0x122ef9,_0x451d2a){_0x122ef9=_0x122ef9-0x0;var _0x42fba0=_0x47d3[_0x122ef9];return _0x42fba0;};'use strict';var multer=require('multer');var util=require('util');var path=require(_0x347d('0x0'));var timeout=require(_0x347d('0x1'));var express=require(_0x347d('0x2'));var router=express[_0x347d('0x3')]();var fs_extra=require(_0x347d('0x4'));var auth=require('../../components/auth/service');var interaction=require('../../components/interaction/service');var config=require('../../config/environment');var controller=require(_0x347d('0x5'));router[_0x347d('0x6')]('/',auth[_0x347d('0x7')](),controller[_0x347d('0x8')]);router[_0x347d('0x6')](_0x347d('0x9'),auth['isAuthenticated'](),controller[_0x347d('0xa')]);router['get'](_0x347d('0xb'),auth[_0x347d('0x7')](),controller[_0x347d('0xc')]);router[_0x347d('0x6')](_0x347d('0xd'),auth[_0x347d('0x7')](),controller['getFields']);router[_0x347d('0xe')]('/',auth['isAuthenticated'](),controller[_0x347d('0xf')]);router['post']('/:id/configurations',auth[_0x347d('0x7')](),controller[_0x347d('0x10')]);router[_0x347d('0x11')](_0x347d('0x9'),auth['isAuthenticated'](),controller['update']);router[_0x347d('0x12')](_0x347d('0x9'),auth[_0x347d('0x7')](),controller[_0x347d('0x13')]);module[_0x347d('0x14')]=router; \ No newline at end of file diff --git a/server/api/intZendeskAccount/intZendeskAccount.attributes.js b/server/api/intZendeskAccount/intZendeskAccount.attributes.js index 1cc1b42..2b91f8d 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 _0xe260=['ENUM','password','integrationTab','newTab','sequelize','STRING','username','remoteUri'];(function(_0x3ab51d,_0x2fa01d){var _0x29a04e=function(_0x7807b0){while(--_0x7807b0){_0x3ab51d['push'](_0x3ab51d['shift']());}};_0x29a04e(++_0x2fa01d);}(_0xe260,0x94));var _0x0e26=function(_0x33d7b2,_0x12200c){_0x33d7b2=_0x33d7b2-0x0;var _0x359f87=_0xe260[_0x33d7b2];return _0x359f87;};'use strict';var Sequelize=require(_0x0e26('0x0'));module['exports']={'name':{'type':Sequelize[_0x0e26('0x1')]},'description':{'type':Sequelize[_0x0e26('0x1')]},'username':{'type':Sequelize[_0x0e26('0x1')],'unique':_0x0e26('0x2')},'password':{'type':Sequelize[_0x0e26('0x1')]},'token':{'type':Sequelize[_0x0e26('0x1')]},'remoteUri':{'type':Sequelize[_0x0e26('0x1')],'unique':_0x0e26('0x3')},'authType':{'type':Sequelize[_0x0e26('0x4')](_0x0e26('0x5'),'token'),'defaultValue':'password'},'serverUrl':{'type':Sequelize[_0x0e26('0x1')],'allowNull':![]},'type':{'type':Sequelize[_0x0e26('0x4')](_0x0e26('0x6'),_0x0e26('0x7')),'defaultValue':_0x0e26('0x6')}}; \ No newline at end of file +var _0xd1f8=['STRING','username','remoteUri','password','token','ENUM','integrationTab','newTab','sequelize','exports'];(function(_0x1b2ff7,_0x12a034){var _0x31656a=function(_0x1165a5){while(--_0x1165a5){_0x1b2ff7['push'](_0x1b2ff7['shift']());}};_0x31656a(++_0x12a034);}(_0xd1f8,0x18e));var _0x8d1f=function(_0x511b76,_0x4727fa){_0x511b76=_0x511b76-0x0;var _0x5424ff=_0xd1f8[_0x511b76];return _0x5424ff;};'use strict';var Sequelize=require(_0x8d1f('0x0'));module[_0x8d1f('0x1')]={'name':{'type':Sequelize[_0x8d1f('0x2')]},'description':{'type':Sequelize[_0x8d1f('0x2')]},'username':{'type':Sequelize['STRING'],'unique':_0x8d1f('0x3')},'password':{'type':Sequelize['STRING']},'token':{'type':Sequelize[_0x8d1f('0x2')]},'remoteUri':{'type':Sequelize['STRING'],'unique':_0x8d1f('0x4')},'authType':{'type':Sequelize['ENUM'](_0x8d1f('0x5'),_0x8d1f('0x6')),'defaultValue':'password'},'serverUrl':{'type':Sequelize[_0x8d1f('0x2')],'allowNull':![]},'type':{'type':Sequelize[_0x8d1f('0x7')](_0x8d1f('0x8'),_0x8d1f('0x9')),'defaultValue':_0x8d1f('0x8')}}; \ No newline at end of file diff --git a/server/api/intZendeskAccount/intZendeskAccount.controller.js b/server/api/intZendeskAccount/intZendeskAccount.controller.js index 042ac6f..4b07afc 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 _0x373d=['ZendeskField','username','password','authType','remoteUri','slice','substring','lastIndexOf','GET','format','%s/%s','ticket_fields','headers','Basic\x20%s','%s:%s','base64','toString','Sequelize','ValidationError','Unknown\x20authentication\x20type','description','remove','includes','position','title','system_field_options','custom_field_options','test','stringify','statusCode','eml-format','zip-dir','fast-json-patch','request-promise','moment','mustache','util','path','ejs','fs-extra','lodash','squel','jsforce','papaparse','ioredis','../../components/parsers/qs','../../components/parsers/advancedSearch','api','../../config/utils','../../config/environment','../../config/license/util','status','end','json','offset','undefined','count','limit','set','Content-Range','apply','reject','save','update','then','destroy','sendStatus','error','stack','name','send','index','map','fieldName','type','key','model','query','filters','intersection','attributes','fields','length','hasOwnProperty','nolimit','order','sort','where','pick','merge','filter','includeAll','include','ZendeskAccount','rows','catch','show','keys','rawAttributes','find','create','body','params','findOne','options','getConfigurations','addConfiguration','AccountId','Subjects','getSubjects','channel','Descriptions','getDescriptions'];(function(_0x56825b,_0x172b8d){var _0x69ce77=function(_0x348a1c){while(--_0x348a1c){_0x56825b['push'](_0x56825b['shift']());}};_0x69ce77(++_0x172b8d);}(_0x373d,0x1e2));var _0xd373=function(_0x49595c,_0x86f44e){_0x49595c=_0x49595c-0x0;var _0x259ca0=_0x373d[_0x49595c];return _0x259ca0;};'use strict';var emlformat=require(_0xd373('0x0'));var rimraf=require('rimraf');var zipdir=require(_0xd373('0x1'));var jsonpatch=require(_0xd373('0x2'));var rp=require(_0xd373('0x3'));var moment=require(_0xd373('0x4'));var BPromise=require('bluebird');var Mustache=require(_0xd373('0x5'));var util=require(_0xd373('0x6'));var path=require(_0xd373('0x7'));var sox=require('sox');var csv=require('to-csv');var ejs=require(_0xd373('0x8'));var fs=require('fs');var fs_extra=require(_0xd373('0x9'));var _=require(_0xd373('0xa'));var squel=require(_0xd373('0xb'));var crypto=require('crypto');var jsforce=require(_0xd373('0xc'));var deskjs=require('desk.js');var toCsv=require('to-csv');var querystring=require('querystring');var Papa=require(_0xd373('0xd'));var Redis=require(_0xd373('0xe'));var authService=require('../../components/auth/service');var qs=require(_0xd373('0xf'));var as=require(_0xd373('0x10'));var hardwareService=require('../../config/license/hardware');var logger=require('../../config/logger')(_0xd373('0x11'));var utils=require(_0xd373('0x12'));var config=require(_0xd373('0x13'));var licenseUtil=require(_0xd373('0x14'));var db=require('../../mysqldb')['db'];var integrations=require('../../components/integrations/configuration');function respondWithStatusCode(_0x5ab89c,_0xcd9b8c){_0xcd9b8c=_0xcd9b8c||0xcc;return function(_0x14a0ee){if(_0x14a0ee){return _0x5ab89c['sendStatus'](_0xcd9b8c);}return _0x5ab89c[_0xd373('0x15')](_0xcd9b8c)[_0xd373('0x16')]();};}function respondWithResult(_0x27c161,_0x23ed86){_0x23ed86=_0x23ed86||0xc8;return function(_0x28b2bf){if(_0x28b2bf){return _0x27c161[_0xd373('0x15')](_0x23ed86)[_0xd373('0x17')](_0x28b2bf);}};}function respondWithFilteredResult(_0x2eacb1,_0x5a286a){return function(_0x2c5854){if(_0x2c5854){var _0x3a5316=typeof _0x5a286a[_0xd373('0x18')]===_0xd373('0x19')&&typeof _0x5a286a['limit']===_0xd373('0x19');var _0x5eab00=_0x2c5854[_0xd373('0x1a')];var _0x36d47a=_0x3a5316?0x0:_0x5a286a['offset'];var _0x1bbdbd=_0x3a5316?_0x2c5854['count']:_0x5a286a['offset']+_0x5a286a[_0xd373('0x1b')];var _0x186fdd;if(_0x1bbdbd>=_0x5eab00){_0x1bbdbd=_0x5eab00;_0x186fdd=0xc8;}else{_0x186fdd=0xce;}_0x2eacb1[_0xd373('0x15')](_0x186fdd);return _0x2eacb1[_0xd373('0x1c')](_0xd373('0x1d'),_0x36d47a+'-'+_0x1bbdbd+'/'+_0x5eab00)[_0xd373('0x17')](_0x2c5854);}return null;};}function patchUpdates(_0x4ba510){return function(_0x18b681){try{jsonpatch[_0xd373('0x1e')](_0x18b681,_0x4ba510,!![]);}catch(_0x1378a0){return BPromise[_0xd373('0x1f')](_0x1378a0);}return _0x18b681[_0xd373('0x20')]();};}function saveUpdates(_0x3aa1c5,_0x4f64bd){return function(_0x355fca){if(_0x355fca){return _0x355fca[_0xd373('0x21')](_0x3aa1c5)[_0xd373('0x22')](function(_0x209ca7){return _0x209ca7;});}return null;};}function removeEntity(_0x217ee7,_0x238ffd){return function(_0x466a03){if(_0x466a03){return _0x466a03[_0xd373('0x23')]()[_0xd373('0x22')](function(){_0x217ee7[_0xd373('0x15')](0xcc)[_0xd373('0x16')]();});}};}function handleEntityNotFound(_0x34f05a,_0x388182){return function(_0x420a30){if(!_0x420a30){_0x34f05a[_0xd373('0x24')](0x194);}return _0x420a30;};}function handleError(_0x38ba50,_0x50b987){_0x50b987=_0x50b987||0x1f4;return function(_0x13a012){logger[_0xd373('0x25')](_0x13a012[_0xd373('0x26')]);if(_0x13a012[_0xd373('0x27')]){delete _0x13a012[_0xd373('0x27')];}_0x38ba50[_0xd373('0x15')](_0x50b987)[_0xd373('0x28')](_0x13a012);};}exports[_0xd373('0x29')]=function(_0x2869e5,_0x158825){var _0xbc420b={},_0x2ee37c={},_0x7dad3e={'count':0x0,'rows':[]};var _0x5287e7=_[_0xd373('0x2a')](db['ZendeskAccount']['rawAttributes'],function(_0xedc8f3){return{'name':_0xedc8f3[_0xd373('0x2b')],'type':_0xedc8f3[_0xd373('0x2c')][_0xd373('0x2d')]};});_0x2ee37c[_0xd373('0x2e')]=_['map'](_0x5287e7,_0xd373('0x27'));_0x2ee37c[_0xd373('0x2f')]=_['keys'](_0x2869e5[_0xd373('0x2f')]);_0x2ee37c[_0xd373('0x30')]=_[_0xd373('0x31')](_0x2ee37c[_0xd373('0x2e')],_0x2ee37c[_0xd373('0x2f')]);_0xbc420b[_0xd373('0x32')]=_[_0xd373('0x31')](_0x2ee37c[_0xd373('0x2e')],qs[_0xd373('0x33')](_0x2869e5['query'][_0xd373('0x33')]));_0xbc420b[_0xd373('0x32')]=_0xbc420b[_0xd373('0x32')][_0xd373('0x34')]?_0xbc420b[_0xd373('0x32')]:_0x2ee37c[_0xd373('0x2e')];if(!_0x2869e5[_0xd373('0x2f')][_0xd373('0x35')](_0xd373('0x36'))){_0xbc420b[_0xd373('0x1b')]=qs[_0xd373('0x1b')](_0x2869e5[_0xd373('0x2f')][_0xd373('0x1b')]);_0xbc420b[_0xd373('0x18')]=qs[_0xd373('0x18')](_0x2869e5['query'][_0xd373('0x18')]);}_0xbc420b[_0xd373('0x37')]=qs[_0xd373('0x38')](_0x2869e5[_0xd373('0x2f')]['sort']);_0xbc420b[_0xd373('0x39')]=qs[_0xd373('0x30')](_[_0xd373('0x3a')](_0x2869e5[_0xd373('0x2f')],_0x2ee37c[_0xd373('0x30')]),_0x5287e7);if(_0x2869e5[_0xd373('0x2f')]['filter']){_0xbc420b['where']=_[_0xd373('0x3b')](_0xbc420b['where'],{'$or':_[_0xd373('0x2a')](_0x5287e7,function(_0xe19d5b){if(_0xe19d5b[_0xd373('0x2c')]!=='VIRTUAL'){var _0x287136={};_0x287136[_0xe19d5b[_0xd373('0x27')]]={'$like':'%'+_0x2869e5[_0xd373('0x2f')][_0xd373('0x3c')]+'%'};return _0x287136;}})});}_0xbc420b=_['merge']({},_0xbc420b,_0x2869e5['options']);var _0x5de74e={'where':_0xbc420b[_0xd373('0x39')]};return db['ZendeskAccount'][_0xd373('0x1a')](_0x5de74e)[_0xd373('0x22')](function(_0x4e5e80){_0x7dad3e['count']=_0x4e5e80;if(_0x2869e5['query'][_0xd373('0x3d')]){_0xbc420b[_0xd373('0x3e')]=[{'all':!![]}];}return db[_0xd373('0x3f')]['findAll'](_0xbc420b);})['then'](function(_0xb87e16){_0x7dad3e[_0xd373('0x40')]=_0xb87e16;return _0x7dad3e;})['then'](respondWithFilteredResult(_0x158825,_0xbc420b))[_0xd373('0x41')](handleError(_0x158825,null));};exports[_0xd373('0x42')]=function(_0x1e3de1,_0x9989e4){var _0x2d8c7d={'raw':![],'where':{'id':_0x1e3de1['params']['id']}},_0x4e8bc6={};_0x4e8bc6[_0xd373('0x2e')]=_[_0xd373('0x43')](db[_0xd373('0x3f')][_0xd373('0x44')]);_0x4e8bc6['query']=_[_0xd373('0x43')](_0x1e3de1['query']);_0x4e8bc6[_0xd373('0x30')]=_[_0xd373('0x31')](_0x4e8bc6[_0xd373('0x2e')],_0x4e8bc6[_0xd373('0x2f')]);_0x2d8c7d[_0xd373('0x32')]=_['intersection'](_0x4e8bc6[_0xd373('0x2e')],qs[_0xd373('0x33')](_0x1e3de1['query'][_0xd373('0x33')]));_0x2d8c7d[_0xd373('0x32')]=_0x2d8c7d[_0xd373('0x32')][_0xd373('0x34')]?_0x2d8c7d[_0xd373('0x32')]:_0x4e8bc6[_0xd373('0x2e')];if(_0x1e3de1[_0xd373('0x2f')][_0xd373('0x3d')]){_0x2d8c7d[_0xd373('0x3e')]=[{'all':!![]}];}_0x2d8c7d=_[_0xd373('0x3b')]({},_0x2d8c7d,_0x1e3de1['options']);return db['ZendeskAccount'][_0xd373('0x45')](_0x2d8c7d)['then'](handleEntityNotFound(_0x9989e4,null))[_0xd373('0x22')](respondWithResult(_0x9989e4,null))['catch'](handleError(_0x9989e4,null));};exports['create']=function(_0x5cbc16,_0x280598){return db[_0xd373('0x3f')][_0xd373('0x46')](_0x5cbc16[_0xd373('0x47')],{})[_0xd373('0x22')](respondWithResult(_0x280598,0xc9))[_0xd373('0x41')](handleError(_0x280598,null));};exports[_0xd373('0x21')]=function(_0x4d1088,_0x28ec3e){if(_0x4d1088['body']['id']){delete _0x4d1088[_0xd373('0x47')]['id'];}return db[_0xd373('0x3f')]['find']({'where':{'id':_0x4d1088[_0xd373('0x48')]['id']}})['then'](handleEntityNotFound(_0x28ec3e,null))[_0xd373('0x22')](saveUpdates(_0x4d1088[_0xd373('0x47')],null))[_0xd373('0x22')](respondWithResult(_0x28ec3e,null))[_0xd373('0x41')](handleError(_0x28ec3e,null));};exports[_0xd373('0x23')]=function(_0x4bc631,_0x4971a0){return db['ZendeskAccount'][_0xd373('0x45')]({'where':{'id':_0x4bc631[_0xd373('0x48')]['id']}})['then'](handleEntityNotFound(_0x4971a0,null))[_0xd373('0x22')](removeEntity(_0x4971a0,null))[_0xd373('0x41')](handleError(_0x4971a0,null));};exports['getConfigurations']=function(_0xae7067,_0xb6b583,_0x102101){var _0x473af2={};var _0x3b5e70={};var _0xa2758;var _0xc255ec;return db[_0xd373('0x3f')][_0xd373('0x49')]({'where':{'id':_0xae7067[_0xd373('0x48')]['id']}})[_0xd373('0x22')](handleEntityNotFound(_0xb6b583,null))['then'](function(_0x4b2645){if(_0x4b2645){_0xa2758=_0x4b2645;_0x3b5e70['model']=_['keys'](db['ZendeskConfiguration']['rawAttributes']);_0x3b5e70[_0xd373('0x2f')]=_[_0xd373('0x43')](_0xae7067['query']);_0x3b5e70['filters']=_['intersection'](_0x3b5e70[_0xd373('0x2e')],_0x3b5e70[_0xd373('0x2f')]);_0x473af2['attributes']=_['intersection'](_0x3b5e70[_0xd373('0x2e')],qs[_0xd373('0x33')](_0xae7067[_0xd373('0x2f')][_0xd373('0x33')]));_0x473af2[_0xd373('0x32')]=_0x473af2['attributes'][_0xd373('0x34')]?_0x473af2[_0xd373('0x32')]:_0x3b5e70[_0xd373('0x2e')];_0x473af2[_0xd373('0x37')]=qs[_0xd373('0x38')](_0xae7067[_0xd373('0x2f')][_0xd373('0x38')]);_0x473af2[_0xd373('0x39')]=qs[_0xd373('0x30')](_[_0xd373('0x3a')](_0xae7067[_0xd373('0x2f')],_0x3b5e70[_0xd373('0x30')]));if(_0xae7067[_0xd373('0x2f')][_0xd373('0x3c')]){_0x473af2[_0xd373('0x39')]=_['merge'](_0x473af2[_0xd373('0x39')],{'$or':_[_0xd373('0x2a')](_0x473af2[_0xd373('0x32')],function(_0x4dba1d){var _0x2bdadf={};_0x2bdadf[_0x4dba1d]={'$like':'%'+_0xae7067['query'][_0xd373('0x3c')]+'%'};return _0x2bdadf;})});}_0x473af2=_['merge']({},_0x473af2,_0xae7067[_0xd373('0x4a')]);return _0xa2758[_0xd373('0x4b')](_0x473af2);}})[_0xd373('0x22')](function(_0x19924a){if(_0x19924a){_0xc255ec=_0x19924a[_0xd373('0x34')];if(!_0xae7067[_0xd373('0x2f')][_0xd373('0x35')](_0xd373('0x36'))){_0x473af2[_0xd373('0x1b')]=qs[_0xd373('0x1b')](_0xae7067[_0xd373('0x2f')][_0xd373('0x1b')]);_0x473af2[_0xd373('0x18')]=qs[_0xd373('0x18')](_0xae7067[_0xd373('0x2f')][_0xd373('0x18')]);}return _0xa2758[_0xd373('0x4b')](_0x473af2);}})[_0xd373('0x22')](function(_0x209e76){if(_0x209e76){return _0x209e76?{'count':_0xc255ec,'rows':_0x209e76}:null;}})[_0xd373('0x22')](respondWithResult(_0xb6b583,null))[_0xd373('0x41')](handleError(_0xb6b583,null));};exports[_0xd373('0x4c')]=function(_0x296242,_0x5133,_0x2ada2f){if(_0x296242[_0xd373('0x47')]['id']){delete _0x296242['body']['id'];}return db[_0xd373('0x3f')][_0xd373('0x49')]({'where':{'id':_0x296242[_0xd373('0x48')]['id']}})['then'](handleEntityNotFound(_0x5133,null))[_0xd373('0x22')](function(_0x2d9019){if(_0x2d9019){_0x296242[_0xd373('0x47')][_0xd373('0x4d')]=_0x2d9019['id'];_0x296242[_0xd373('0x47')][_0xd373('0x4e')]=integrations[_0xd373('0x4f')](_0x296242['body'][_0xd373('0x50')],_0x296242[_0xd373('0x47')][_0xd373('0x2c')]);_0x296242[_0xd373('0x47')][_0xd373('0x51')]=integrations[_0xd373('0x52')](_0x296242[_0xd373('0x47')][_0xd373('0x50')],_0x296242['body'][_0xd373('0x2c')]);return db['ZendeskConfiguration'][_0xd373('0x46')](_0x296242[_0xd373('0x47')],{'include':[{'model':db[_0xd373('0x53')],'as':_0xd373('0x4e')},{'model':db[_0xd373('0x53')],'as':_0xd373('0x51')}]});}return null;})[_0xd373('0x22')](respondWithResult(_0x5133,null))[_0xd373('0x41')](handleError(_0x5133,null));};exports['getFields']=function(_0x237f15,_0x5c5855,_0x40f5ad){var _0x27fcbe='';return db[_0xd373('0x3f')][_0xd373('0x49')]({'where':{'id':_0x237f15[_0xd373('0x48')]['id']},'attributes':['id',_0xd373('0x54'),_0xd373('0x55'),'token',_0xd373('0x56'),_0xd373('0x57')]})[_0xd373('0x22')](handleEntityNotFound(_0x5c5855,null))['then'](function(_0x4035d4){if(_0x4035d4){_0x27fcbe=_0x4035d4[_0xd373('0x57')];var _0xaf9102=_0x27fcbe[_0xd373('0x58')](-0x1);if(_0xaf9102==='/'){_0x27fcbe=_0x27fcbe[_0xd373('0x59')](0x0,_0x27fcbe[_0xd373('0x5a')](_0xaf9102));}var _0x6c7c8d={'method':_0xd373('0x5b'),'uri':util[_0xd373('0x5c')](_0xd373('0x5d'),_0x27fcbe,_0xd373('0x5e')),'json':!![]};switch(_0x4035d4[_0xd373('0x56')]){case'password':_0x6c7c8d[_0xd373('0x5f')]={'Authorization':util[_0xd373('0x5c')](_0xd373('0x60'),new Buffer(util['format'](_0xd373('0x61'),_0x4035d4[_0xd373('0x54')],_0x4035d4[_0xd373('0x55')]))['toString'](_0xd373('0x62')))};break;case'token':_0x6c7c8d[_0xd373('0x5f')]={'Authorization':util[_0xd373('0x5c')](_0xd373('0x60'),new Buffer(util[_0xd373('0x5c')]('%s/token:%s',_0x4035d4[_0xd373('0x54')],_0x4035d4['token']))[_0xd373('0x63')](_0xd373('0x62')))};break;default:throw new db[(_0xd373('0x64'))][(_0xd373('0x65'))](_0xd373('0x66'));}return rp(_0x6c7c8d);}})[_0xd373('0x22')](function(_0x53c0a7){if(_0x53c0a7){var _0xb01a00=['subject',_0xd373('0x67'),'group','assignee'];_[_0xd373('0x68')](_0x53c0a7[_0xd373('0x5e')],function(_0x1cff58){return _0xb01a00[_0xd373('0x69')](_0x1cff58['type']);});return{'count':_0x53c0a7['ticket_fields'][_0xd373('0x34')],'rows':_[_0xd373('0x2a')](_0x53c0a7[_0xd373('0x5e')],function(_0x25bf55){return{'id':_0x25bf55['id'],'name':_0x25bf55[_0xd373('0x6a')]>0x7?_0x25bf55[_0xd373('0x6b')]:_0x25bf55[_0xd373('0x2c')],'custom':_0x25bf55[_0xd373('0x6a')]>0x7?!![]:![],'options':_0x25bf55[_0xd373('0x6c')]?_0x25bf55[_0xd373('0x6c')]:_0x25bf55['custom_field_options']?_0x25bf55[_0xd373('0x6d')]:[]};})};}})[_0xd373('0x22')](respondWithResult(_0x5c5855,null))[_0xd373('0x41')](function(_0xa77a42){var _0x9bdd39=_0x237f15[_0xd373('0x2f')][_0xd373('0x6e')]?0x1f4:_0xa77a42['statusCode']||0x1f4;logger[_0xd373('0x25')]('getFields,\x20%s,\x20%s,\x20%s','getFields',_0x9bdd39,JSON[_0xd373('0x6f')](_0xa77a42));delete _0xa77a42[_0xd373('0x27')];if(_0x9bdd39===0x191){_0x9bdd39=0x190;}_0x5c5855[_0xd373('0x15')](_0x9bdd39)[_0xd373('0x28')](_0x237f15[_0xd373('0x2f')][_0xd373('0x6e')]?{'message':'Wrong\x20credentials','statusCode':_0xa77a42[_0xd373('0x70')]}:_0xa77a42);});}; \ No newline at end of file +var _0x5eb8=['sort','where','filter','merge','type','options','includeAll','findAll','catch','show','params','keys','length','include','find','create','body','update','getConfigurations','findOne','ZendeskConfiguration','pick','addConfiguration','AccountId','Subjects','getSubjects','channel','getDescriptions','ZendeskField','getFields','username','password','token','authType','remoteUri','slice','substring','lastIndexOf','format','ticket_fields','headers','Basic\x20%s','%s:%s','toString','base64','Sequelize','ValidationError','Unknown\x20authentication\x20type','subject','description','group','remove','includes','title','position','system_field_options','custom_field_options','send','Wrong\x20credentials','statusCode','zip-dir','fast-json-patch','request-promise','moment','bluebird','mustache','util','path','sox','to-csv','ejs','fs-extra','squel','crypto','jsforce','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','../../config/utils','../../config/environment','../../mysqldb','../../components/integrations/configuration','status','json','offset','undefined','limit','count','set','Content-Range','reject','save','destroy','then','sendStatus','error','stack','name','map','ZendeskAccount','rawAttributes','fieldName','key','model','query','filters','intersection','attributes','fields','hasOwnProperty','nolimit','order'];(function(_0x2afb44,_0x249a57){var _0x15ccc2=function(_0x180748){while(--_0x180748){_0x2afb44['push'](_0x2afb44['shift']());}};_0x15ccc2(++_0x249a57);}(_0x5eb8,0xb0));var _0x85eb=function(_0x39479f,_0x822ae4){_0x39479f=_0x39479f-0x0;var _0x4a6d96=_0x5eb8[_0x39479f];return _0x4a6d96;};'use strict';var emlformat=require('eml-format');var rimraf=require('rimraf');var zipdir=require(_0x85eb('0x0'));var jsonpatch=require(_0x85eb('0x1'));var rp=require(_0x85eb('0x2'));var moment=require(_0x85eb('0x3'));var BPromise=require(_0x85eb('0x4'));var Mustache=require(_0x85eb('0x5'));var util=require(_0x85eb('0x6'));var path=require(_0x85eb('0x7'));var sox=require(_0x85eb('0x8'));var csv=require(_0x85eb('0x9'));var ejs=require(_0x85eb('0xa'));var fs=require('fs');var fs_extra=require(_0x85eb('0xb'));var _=require('lodash');var squel=require(_0x85eb('0xc'));var crypto=require(_0x85eb('0xd'));var jsforce=require(_0x85eb('0xe'));var deskjs=require('desk.js');var toCsv=require(_0x85eb('0x9'));var querystring=require('querystring');var Papa=require(_0x85eb('0xf'));var Redis=require(_0x85eb('0x10'));var authService=require(_0x85eb('0x11'));var qs=require(_0x85eb('0x12'));var as=require(_0x85eb('0x13'));var hardwareService=require(_0x85eb('0x14'));var logger=require(_0x85eb('0x15'))('api');var utils=require(_0x85eb('0x16'));var config=require(_0x85eb('0x17'));var licenseUtil=require('../../config/license/util');var db=require(_0x85eb('0x18'))['db'];var integrations=require(_0x85eb('0x19'));function respondWithStatusCode(_0x2f42ba,_0x259f72){_0x259f72=_0x259f72||0xcc;return function(_0x4db167){if(_0x4db167){return _0x2f42ba['sendStatus'](_0x259f72);}return _0x2f42ba[_0x85eb('0x1a')](_0x259f72)['end']();};}function respondWithResult(_0x18ca53,_0x23a82a){_0x23a82a=_0x23a82a||0xc8;return function(_0x600a7f){if(_0x600a7f){return _0x18ca53[_0x85eb('0x1a')](_0x23a82a)[_0x85eb('0x1b')](_0x600a7f);}};}function respondWithFilteredResult(_0x49efdf,_0x2e5c0a){return function(_0x59237b){if(_0x59237b){var _0x17140b=typeof _0x2e5c0a[_0x85eb('0x1c')]===_0x85eb('0x1d')&&typeof _0x2e5c0a[_0x85eb('0x1e')]==='undefined';var _0x5c5cbb=_0x59237b['count'];var _0xe198ca=_0x17140b?0x0:_0x2e5c0a[_0x85eb('0x1c')];var _0x10cf2f=_0x17140b?_0x59237b[_0x85eb('0x1f')]:_0x2e5c0a[_0x85eb('0x1c')]+_0x2e5c0a[_0x85eb('0x1e')];var _0x5acd3d;if(_0x10cf2f>=_0x5c5cbb){_0x10cf2f=_0x5c5cbb;_0x5acd3d=0xc8;}else{_0x5acd3d=0xce;}_0x49efdf[_0x85eb('0x1a')](_0x5acd3d);return _0x49efdf[_0x85eb('0x20')](_0x85eb('0x21'),_0xe198ca+'-'+_0x10cf2f+'/'+_0x5c5cbb)['json'](_0x59237b);}return null;};}function patchUpdates(_0x4b4b38){return function(_0x48bd86){try{jsonpatch['apply'](_0x48bd86,_0x4b4b38,!![]);}catch(_0x244667){return BPromise[_0x85eb('0x22')](_0x244667);}return _0x48bd86[_0x85eb('0x23')]();};}function saveUpdates(_0x255ca7,_0x465c74){return function(_0x3fc6da){if(_0x3fc6da){return _0x3fc6da['update'](_0x255ca7)['then'](function(_0x5b48d9){return _0x5b48d9;});}return null;};}function removeEntity(_0x298e84,_0x1426c8){return function(_0x3f7a4d){if(_0x3f7a4d){return _0x3f7a4d[_0x85eb('0x24')]()[_0x85eb('0x25')](function(){_0x298e84[_0x85eb('0x1a')](0xcc)['end']();});}};}function handleEntityNotFound(_0x39d3fe,_0x3453cd){return function(_0x4709ad){if(!_0x4709ad){_0x39d3fe[_0x85eb('0x26')](0x194);}return _0x4709ad;};}function handleError(_0x3e2326,_0x57a03c){_0x57a03c=_0x57a03c||0x1f4;return function(_0x2e5aa3){logger[_0x85eb('0x27')](_0x2e5aa3[_0x85eb('0x28')]);if(_0x2e5aa3[_0x85eb('0x29')]){delete _0x2e5aa3[_0x85eb('0x29')];}_0x3e2326[_0x85eb('0x1a')](_0x57a03c)['send'](_0x2e5aa3);};}exports['index']=function(_0x37515c,_0x585f2a){var _0xa9b14f={},_0x5255eb={},_0x4229e9={'count':0x0,'rows':[]};var _0x3570f7=_[_0x85eb('0x2a')](db[_0x85eb('0x2b')][_0x85eb('0x2c')],function(_0xf4ac13){return{'name':_0xf4ac13[_0x85eb('0x2d')],'type':_0xf4ac13['type'][_0x85eb('0x2e')]};});_0x5255eb[_0x85eb('0x2f')]=_['map'](_0x3570f7,_0x85eb('0x29'));_0x5255eb['query']=_['keys'](_0x37515c[_0x85eb('0x30')]);_0x5255eb[_0x85eb('0x31')]=_[_0x85eb('0x32')](_0x5255eb[_0x85eb('0x2f')],_0x5255eb[_0x85eb('0x30')]);_0xa9b14f[_0x85eb('0x33')]=_[_0x85eb('0x32')](_0x5255eb[_0x85eb('0x2f')],qs[_0x85eb('0x34')](_0x37515c[_0x85eb('0x30')]['fields']));_0xa9b14f[_0x85eb('0x33')]=_0xa9b14f[_0x85eb('0x33')]['length']?_0xa9b14f['attributes']:_0x5255eb[_0x85eb('0x2f')];if(!_0x37515c[_0x85eb('0x30')][_0x85eb('0x35')](_0x85eb('0x36'))){_0xa9b14f[_0x85eb('0x1e')]=qs[_0x85eb('0x1e')](_0x37515c[_0x85eb('0x30')][_0x85eb('0x1e')]);_0xa9b14f[_0x85eb('0x1c')]=qs[_0x85eb('0x1c')](_0x37515c[_0x85eb('0x30')][_0x85eb('0x1c')]);}_0xa9b14f[_0x85eb('0x37')]=qs[_0x85eb('0x38')](_0x37515c['query'][_0x85eb('0x38')]);_0xa9b14f[_0x85eb('0x39')]=qs['filters'](_['pick'](_0x37515c[_0x85eb('0x30')],_0x5255eb[_0x85eb('0x31')]),_0x3570f7);if(_0x37515c['query'][_0x85eb('0x3a')]){_0xa9b14f['where']=_[_0x85eb('0x3b')](_0xa9b14f['where'],{'$or':_[_0x85eb('0x2a')](_0x3570f7,function(_0x5ce7e4){if(_0x5ce7e4[_0x85eb('0x3c')]!=='VIRTUAL'){var _0x38ab0f={};_0x38ab0f[_0x5ce7e4[_0x85eb('0x29')]]={'$like':'%'+_0x37515c['query'][_0x85eb('0x3a')]+'%'};return _0x38ab0f;}})});}_0xa9b14f=_['merge']({},_0xa9b14f,_0x37515c[_0x85eb('0x3d')]);var _0x331260={'where':_0xa9b14f['where']};return db[_0x85eb('0x2b')]['count'](_0x331260)['then'](function(_0x1b8a71){_0x4229e9['count']=_0x1b8a71;if(_0x37515c[_0x85eb('0x30')][_0x85eb('0x3e')]){_0xa9b14f['include']=[{'all':!![]}];}return db['ZendeskAccount'][_0x85eb('0x3f')](_0xa9b14f);})[_0x85eb('0x25')](function(_0x48160e){_0x4229e9['rows']=_0x48160e;return _0x4229e9;})[_0x85eb('0x25')](respondWithFilteredResult(_0x585f2a,_0xa9b14f))[_0x85eb('0x40')](handleError(_0x585f2a,null));};exports[_0x85eb('0x41')]=function(_0x202681,_0x3be961){var _0x5b7411={'raw':![],'where':{'id':_0x202681[_0x85eb('0x42')]['id']}},_0x5ccf8a={};_0x5ccf8a[_0x85eb('0x2f')]=_[_0x85eb('0x43')](db[_0x85eb('0x2b')][_0x85eb('0x2c')]);_0x5ccf8a[_0x85eb('0x30')]=_[_0x85eb('0x43')](_0x202681[_0x85eb('0x30')]);_0x5ccf8a['filters']=_[_0x85eb('0x32')](_0x5ccf8a[_0x85eb('0x2f')],_0x5ccf8a['query']);_0x5b7411[_0x85eb('0x33')]=_[_0x85eb('0x32')](_0x5ccf8a[_0x85eb('0x2f')],qs[_0x85eb('0x34')](_0x202681[_0x85eb('0x30')][_0x85eb('0x34')]));_0x5b7411['attributes']=_0x5b7411[_0x85eb('0x33')][_0x85eb('0x44')]?_0x5b7411[_0x85eb('0x33')]:_0x5ccf8a[_0x85eb('0x2f')];if(_0x202681[_0x85eb('0x30')][_0x85eb('0x3e')]){_0x5b7411[_0x85eb('0x45')]=[{'all':!![]}];}_0x5b7411=_[_0x85eb('0x3b')]({},_0x5b7411,_0x202681['options']);return db[_0x85eb('0x2b')][_0x85eb('0x46')](_0x5b7411)[_0x85eb('0x25')](handleEntityNotFound(_0x3be961,null))[_0x85eb('0x25')](respondWithResult(_0x3be961,null))[_0x85eb('0x40')](handleError(_0x3be961,null));};exports[_0x85eb('0x47')]=function(_0x3c387a,_0x77fdc4){return db[_0x85eb('0x2b')][_0x85eb('0x47')](_0x3c387a[_0x85eb('0x48')],{})[_0x85eb('0x25')](respondWithResult(_0x77fdc4,0xc9))['catch'](handleError(_0x77fdc4,null));};exports[_0x85eb('0x49')]=function(_0x2c951b,_0x22d9d6){if(_0x2c951b['body']['id']){delete _0x2c951b[_0x85eb('0x48')]['id'];}return db[_0x85eb('0x2b')][_0x85eb('0x46')]({'where':{'id':_0x2c951b[_0x85eb('0x42')]['id']}})[_0x85eb('0x25')](handleEntityNotFound(_0x22d9d6,null))['then'](saveUpdates(_0x2c951b[_0x85eb('0x48')],null))[_0x85eb('0x25')](respondWithResult(_0x22d9d6,null))[_0x85eb('0x40')](handleError(_0x22d9d6,null));};exports['destroy']=function(_0xc5cb43,_0x4550fd){return db[_0x85eb('0x2b')]['find']({'where':{'id':_0xc5cb43['params']['id']}})[_0x85eb('0x25')](handleEntityNotFound(_0x4550fd,null))['then'](removeEntity(_0x4550fd,null))['catch'](handleError(_0x4550fd,null));};exports[_0x85eb('0x4a')]=function(_0x593723,_0x39316d,_0xfb0ac){var _0x4e3d96={};var _0x4abe5e={};var _0x27ce2a;var _0x249511;return db[_0x85eb('0x2b')][_0x85eb('0x4b')]({'where':{'id':_0x593723[_0x85eb('0x42')]['id']}})['then'](handleEntityNotFound(_0x39316d,null))[_0x85eb('0x25')](function(_0x30062e){if(_0x30062e){_0x27ce2a=_0x30062e;_0x4abe5e[_0x85eb('0x2f')]=_[_0x85eb('0x43')](db[_0x85eb('0x4c')]['rawAttributes']);_0x4abe5e[_0x85eb('0x30')]=_['keys'](_0x593723[_0x85eb('0x30')]);_0x4abe5e[_0x85eb('0x31')]=_['intersection'](_0x4abe5e[_0x85eb('0x2f')],_0x4abe5e[_0x85eb('0x30')]);_0x4e3d96[_0x85eb('0x33')]=_[_0x85eb('0x32')](_0x4abe5e[_0x85eb('0x2f')],qs[_0x85eb('0x34')](_0x593723['query'][_0x85eb('0x34')]));_0x4e3d96['attributes']=_0x4e3d96[_0x85eb('0x33')][_0x85eb('0x44')]?_0x4e3d96['attributes']:_0x4abe5e[_0x85eb('0x2f')];_0x4e3d96[_0x85eb('0x37')]=qs['sort'](_0x593723[_0x85eb('0x30')]['sort']);_0x4e3d96[_0x85eb('0x39')]=qs[_0x85eb('0x31')](_[_0x85eb('0x4d')](_0x593723[_0x85eb('0x30')],_0x4abe5e[_0x85eb('0x31')]));if(_0x593723[_0x85eb('0x30')]['filter']){_0x4e3d96[_0x85eb('0x39')]=_[_0x85eb('0x3b')](_0x4e3d96[_0x85eb('0x39')],{'$or':_[_0x85eb('0x2a')](_0x4e3d96[_0x85eb('0x33')],function(_0x1529dd){var _0x2024df={};_0x2024df[_0x1529dd]={'$like':'%'+_0x593723[_0x85eb('0x30')][_0x85eb('0x3a')]+'%'};return _0x2024df;})});}_0x4e3d96=_[_0x85eb('0x3b')]({},_0x4e3d96,_0x593723[_0x85eb('0x3d')]);return _0x27ce2a['getConfigurations'](_0x4e3d96);}})[_0x85eb('0x25')](function(_0x21b873){if(_0x21b873){_0x249511=_0x21b873[_0x85eb('0x44')];if(!_0x593723[_0x85eb('0x30')][_0x85eb('0x35')](_0x85eb('0x36'))){_0x4e3d96['limit']=qs[_0x85eb('0x1e')](_0x593723['query'][_0x85eb('0x1e')]);_0x4e3d96[_0x85eb('0x1c')]=qs[_0x85eb('0x1c')](_0x593723[_0x85eb('0x30')][_0x85eb('0x1c')]);}return _0x27ce2a['getConfigurations'](_0x4e3d96);}})[_0x85eb('0x25')](function(_0x143d65){if(_0x143d65){return _0x143d65?{'count':_0x249511,'rows':_0x143d65}:null;}})[_0x85eb('0x25')](respondWithResult(_0x39316d,null))[_0x85eb('0x40')](handleError(_0x39316d,null));};exports[_0x85eb('0x4e')]=function(_0x14cab8,_0x23fcf9,_0x5de716){if(_0x14cab8['body']['id']){delete _0x14cab8[_0x85eb('0x48')]['id'];}return db['ZendeskAccount'][_0x85eb('0x4b')]({'where':{'id':_0x14cab8[_0x85eb('0x42')]['id']}})[_0x85eb('0x25')](handleEntityNotFound(_0x23fcf9,null))[_0x85eb('0x25')](function(_0x259ee3){if(_0x259ee3){_0x14cab8['body'][_0x85eb('0x4f')]=_0x259ee3['id'];_0x14cab8[_0x85eb('0x48')][_0x85eb('0x50')]=integrations[_0x85eb('0x51')](_0x14cab8[_0x85eb('0x48')][_0x85eb('0x52')],_0x14cab8['body']['type']);_0x14cab8[_0x85eb('0x48')]['Descriptions']=integrations[_0x85eb('0x53')](_0x14cab8[_0x85eb('0x48')][_0x85eb('0x52')],_0x14cab8[_0x85eb('0x48')][_0x85eb('0x3c')]);return db[_0x85eb('0x4c')]['create'](_0x14cab8[_0x85eb('0x48')],{'include':[{'model':db[_0x85eb('0x54')],'as':_0x85eb('0x50')},{'model':db[_0x85eb('0x54')],'as':'Descriptions'}]});}return null;})[_0x85eb('0x25')](respondWithResult(_0x23fcf9,null))[_0x85eb('0x40')](handleError(_0x23fcf9,null));};exports[_0x85eb('0x55')]=function(_0x14bf0e,_0x5037c7,_0x459317){var _0x2e6734='';return db[_0x85eb('0x2b')][_0x85eb('0x4b')]({'where':{'id':_0x14bf0e[_0x85eb('0x42')]['id']},'attributes':['id',_0x85eb('0x56'),_0x85eb('0x57'),_0x85eb('0x58'),_0x85eb('0x59'),_0x85eb('0x5a')]})[_0x85eb('0x25')](handleEntityNotFound(_0x5037c7,null))[_0x85eb('0x25')](function(_0x1d9d3a){if(_0x1d9d3a){_0x2e6734=_0x1d9d3a[_0x85eb('0x5a')];var _0x2f2464=_0x2e6734[_0x85eb('0x5b')](-0x1);if(_0x2f2464==='/'){_0x2e6734=_0x2e6734[_0x85eb('0x5c')](0x0,_0x2e6734[_0x85eb('0x5d')](_0x2f2464));}var _0x106caa={'method':'GET','uri':util[_0x85eb('0x5e')]('%s/%s',_0x2e6734,_0x85eb('0x5f')),'json':!![]};switch(_0x1d9d3a[_0x85eb('0x59')]){case _0x85eb('0x57'):_0x106caa[_0x85eb('0x60')]={'Authorization':util[_0x85eb('0x5e')](_0x85eb('0x61'),new Buffer(util[_0x85eb('0x5e')](_0x85eb('0x62'),_0x1d9d3a[_0x85eb('0x56')],_0x1d9d3a['password']))[_0x85eb('0x63')](_0x85eb('0x64')))};break;case _0x85eb('0x58'):_0x106caa[_0x85eb('0x60')]={'Authorization':util[_0x85eb('0x5e')]('Basic\x20%s',new Buffer(util[_0x85eb('0x5e')]('%s/token:%s',_0x1d9d3a[_0x85eb('0x56')],_0x1d9d3a[_0x85eb('0x58')]))[_0x85eb('0x63')]('base64'))};break;default:throw new db[(_0x85eb('0x65'))][(_0x85eb('0x66'))](_0x85eb('0x67'));}return rp(_0x106caa);}})['then'](function(_0x588c72){if(_0x588c72){var _0x45a1ef=[_0x85eb('0x68'),_0x85eb('0x69'),_0x85eb('0x6a'),'assignee'];_[_0x85eb('0x6b')](_0x588c72['ticket_fields'],function(_0x11a3bd){return _0x45a1ef[_0x85eb('0x6c')](_0x11a3bd[_0x85eb('0x3c')]);});return{'count':_0x588c72[_0x85eb('0x5f')][_0x85eb('0x44')],'rows':_[_0x85eb('0x2a')](_0x588c72['ticket_fields'],function(_0x9a80a1){return{'id':_0x9a80a1['id'],'name':_0x9a80a1['position']>0x7?_0x9a80a1[_0x85eb('0x6d')]:_0x9a80a1[_0x85eb('0x3c')],'custom':_0x9a80a1[_0x85eb('0x6e')]>0x7?!![]:![],'options':_0x9a80a1[_0x85eb('0x6f')]?_0x9a80a1[_0x85eb('0x6f')]:_0x9a80a1[_0x85eb('0x70')]?_0x9a80a1[_0x85eb('0x70')]:[]};})};}})[_0x85eb('0x25')](respondWithResult(_0x5037c7,null))[_0x85eb('0x40')](function(_0x543146){var _0x3358c8=_0x14bf0e[_0x85eb('0x30')]['test']?0x1f4:_0x543146['statusCode']||0x1f4;logger[_0x85eb('0x27')]('getFields,\x20%s,\x20%s,\x20%s',_0x85eb('0x55'),_0x3358c8,JSON['stringify'](_0x543146));delete _0x543146[_0x85eb('0x29')];if(_0x3358c8===0x191){_0x3358c8=0x190;}_0x5037c7['status'](_0x3358c8)[_0x85eb('0x71')](_0x14bf0e[_0x85eb('0x30')]['test']?{'message':_0x85eb('0x72'),'statusCode':_0x543146[_0x85eb('0x73')]}:_0x543146);});}; \ No newline at end of file diff --git a/server/api/intZendeskAccount/intZendeskAccount.model.js b/server/api/intZendeskAccount/intZendeskAccount.model.js index 8cbb8ff..148d02e 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 _0x0cf7=['request-promise','path','../../config/environment','./intZendeskAccount.attributes','../../components/integrations/configuration','ZendeskAccount','int_zendesk_accounts','lodash','util','../../config/logger','api','moment','bluebird'];(function(_0x2876e2,_0x24c5bc){var _0xd9e8a1=function(_0x49b85e){while(--_0x49b85e){_0x2876e2['push'](_0x2876e2['shift']());}};_0xd9e8a1(++_0x24c5bc);}(_0x0cf7,0x1c1));var _0x70cf=function(_0x162b2c,_0xe038f4){_0x162b2c=_0x162b2c-0x0;var _0xa5edbb=_0x0cf7[_0x162b2c];return _0xa5edbb;};'use strict';var _=require(_0x70cf('0x0'));var util=require(_0x70cf('0x1'));var logger=require(_0x70cf('0x2'))(_0x70cf('0x3'));var moment=require(_0x70cf('0x4'));var BPromise=require(_0x70cf('0x5'));var rp=require(_0x70cf('0x6'));var fs=require('fs');var path=require(_0x70cf('0x7'));var rimraf=require('rimraf');var config=require(_0x70cf('0x8'));var attributes=require(_0x70cf('0x9'));var integrations=require(_0x70cf('0xa'));module['exports']=function(_0x446e61,_0x1a9825){return _0x446e61['define'](_0x70cf('0xb'),attributes,{'tableName':_0x70cf('0xc'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0xa88c=['lodash','util','../../config/logger','moment','bluebird','path','./intZendeskAccount.attributes'];(function(_0x304300,_0x5b91fa){var _0x200aaa=function(_0x57b548){while(--_0x57b548){_0x304300['push'](_0x304300['shift']());}};_0x200aaa(++_0x5b91fa);}(_0xa88c,0xaf));var _0xca88=function(_0x322fc4,_0x4946a8){_0x322fc4=_0x322fc4-0x0;var _0x34ffd0=_0xa88c[_0x322fc4];return _0x34ffd0;};'use strict';var _=require(_0xca88('0x0'));var util=require(_0xca88('0x1'));var logger=require(_0xca88('0x2'))('api');var moment=require(_0xca88('0x3'));var BPromise=require(_0xca88('0x4'));var rp=require('request-promise');var fs=require('fs');var path=require(_0xca88('0x5'));var rimraf=require('rimraf');var config=require('../../config/environment');var attributes=require(_0xca88('0x6'));var integrations=require('../../components/integrations/configuration');module['exports']=function(_0x4269b3,_0x1119e6){return _0x4269b3['define']('ZendeskAccount',attributes,{'tableName':'int_zendesk_accounts','paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/intZendeskAccount/intZendeskAccount.rpc.js b/server/api/intZendeskAccount/intZendeskAccount.rpc.js index d5929c4..a0a9f92 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 _0x71ba=['../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','http','then','ZendeskAccount,\x20%s,\x20%s','debug','ZendeskAccount,\x20%s,\x20%s,\x20%s','error','code','message','info','request\x20sent','result','ZendeskAccount','findAll','options','raw','where','attributes','limit','include','map','model','GetZendeskAccount','catch','find','ShowZendeskAccount','lodash','util','moment','bluebird','randomstring'];(function(_0x1b7368,_0x3286ed){var _0x25d54c=function(_0x2366da){while(--_0x2366da){_0x1b7368['push'](_0x1b7368['shift']());}};_0x25d54c(++_0x3286ed);}(_0x71ba,0x1c2));var _0xa71b=function(_0x100e0c,_0x5523b8){_0x100e0c=_0x100e0c-0x0;var _0x4db1aa=_0x71ba[_0x100e0c];return _0x4db1aa;};'use strict';var _=require(_0xa71b('0x0'));var util=require(_0xa71b('0x1'));var moment=require(_0xa71b('0x2'));var BPromise=require(_0xa71b('0x3'));var rs=require(_0xa71b('0x4'));var fs=require('fs');var Redis=require('ioredis');var db=require(_0xa71b('0x5'))['db'];var utils=require(_0xa71b('0x6'));var logger=require(_0xa71b('0x7'))(_0xa71b('0x8'));var config=require(_0xa71b('0x9'));var jayson=require('jayson/promise');var client=jayson['client'][_0xa71b('0xa')]({'port':0x232a});function respondWithRpcPromise(_0x5a3c99,_0x49a2f0,_0x24b6e1){return new BPromise(function(_0xbdbbc1,_0x3244f9){return client['request'](_0x5a3c99,_0x24b6e1)[_0xa71b('0xb')](function(_0x163f4a){logger['info'](_0xa71b('0xc'),_0x49a2f0,'request\x20sent');logger[_0xa71b('0xd')](_0xa71b('0xe'),_0x49a2f0,'request\x20sent',JSON['stringify'](_0x163f4a));if(_0x163f4a[_0xa71b('0xf')]){if(_0x163f4a[_0xa71b('0xf')][_0xa71b('0x10')]===0x1f4){logger[_0xa71b('0xf')](_0xa71b('0xc'),_0x49a2f0,_0x163f4a[_0xa71b('0xf')][_0xa71b('0x11')]);return _0x3244f9(_0x163f4a['error'][_0xa71b('0x11')]);}logger['error'](_0xa71b('0xc'),_0x49a2f0,_0x163f4a[_0xa71b('0xf')][_0xa71b('0x11')]);return _0xbdbbc1(_0x163f4a['error'][_0xa71b('0x11')]);}else{logger[_0xa71b('0x12')](_0xa71b('0xc'),_0x49a2f0,_0xa71b('0x13'));_0xbdbbc1(_0x163f4a[_0xa71b('0x14')][_0xa71b('0x11')]);}})['catch'](function(_0x437530){logger[_0xa71b('0xf')](_0xa71b('0xc'),_0x49a2f0,_0x437530);_0x3244f9(_0x437530);});});}exports['GetZendeskAccount']=function(_0x5db75e){var _0x955fae=this;return new Promise(function(_0x83abe3,_0x45e02f){return db[_0xa71b('0x15')][_0xa71b('0x16')]({'raw':_0x5db75e['options']?_0x5db75e[_0xa71b('0x17')][_0xa71b('0x18')]===undefined?!![]:![]:!![],'where':_0x5db75e[_0xa71b('0x17')]?_0x5db75e['options'][_0xa71b('0x19')]||null:null,'attributes':_0x5db75e['options']?_0x5db75e[_0xa71b('0x17')][_0xa71b('0x1a')]||null:null,'limit':_0x5db75e[_0xa71b('0x17')]?_0x5db75e['options'][_0xa71b('0x1b')]||null:null,'include':_0x5db75e[_0xa71b('0x17')]?_0x5db75e[_0xa71b('0x17')][_0xa71b('0x1c')]?_[_0xa71b('0x1d')](_0x5db75e[_0xa71b('0x17')]['include'],function(_0x3863e5){return{'model':db[_0x3863e5[_0xa71b('0x1e')]],'as':_0x3863e5['as'],'attributes':_0x3863e5['attributes'],'include':_0x3863e5[_0xa71b('0x1c')]?_[_0xa71b('0x1d')](_0x3863e5[_0xa71b('0x1c')],function(_0x2c0b58){return{'model':db[_0x2c0b58[_0xa71b('0x1e')]],'as':_0x2c0b58['as'],'attributes':_0x2c0b58[_0xa71b('0x1a')],'include':_0x2c0b58[_0xa71b('0x1c')]?_[_0xa71b('0x1d')](_0x2c0b58[_0xa71b('0x1c')],function(_0x37b6d6){return{'model':db[_0x37b6d6[_0xa71b('0x1e')]],'as':_0x37b6d6['as'],'attributes':_0x37b6d6[_0xa71b('0x1a')]};}):[]};}):[]};}):[]:[]})[_0xa71b('0xb')](function(_0x585106){logger[_0xa71b('0x12')](_0xa71b('0x1f'),_0x5db75e);logger[_0xa71b('0xd')](_0xa71b('0x1f'),_0x5db75e,JSON['stringify'](_0x585106));_0x83abe3(_0x585106);})[_0xa71b('0x20')](function(_0x216197){logger[_0xa71b('0xf')](_0xa71b('0x1f'),_0x216197['message'],_0x5db75e);_0x45e02f(_0x955fae[_0xa71b('0xf')](0x1f4,_0x216197[_0xa71b('0x11')]));});});};exports['ShowZendeskAccount']=function(_0x4dcc54){var _0x3a0fa5=this;return new Promise(function(_0x26868f,_0x117841){return db[_0xa71b('0x15')][_0xa71b('0x21')]({'raw':_0x4dcc54[_0xa71b('0x17')]?_0x4dcc54[_0xa71b('0x17')][_0xa71b('0x18')]===undefined?!![]:![]:!![],'where':_0x4dcc54[_0xa71b('0x17')]?_0x4dcc54['options'][_0xa71b('0x19')]||null:null,'attributes':_0x4dcc54[_0xa71b('0x17')]?_0x4dcc54['options'][_0xa71b('0x1a')]||null:null,'include':_0x4dcc54[_0xa71b('0x17')]?_0x4dcc54[_0xa71b('0x17')]['include']?_[_0xa71b('0x1d')](_0x4dcc54[_0xa71b('0x17')][_0xa71b('0x1c')],function(_0x3d6e8a){return{'model':db[_0x3d6e8a[_0xa71b('0x1e')]],'as':_0x3d6e8a['as'],'attributes':_0x3d6e8a[_0xa71b('0x1a')],'include':_0x3d6e8a[_0xa71b('0x1c')]?_[_0xa71b('0x1d')](_0x3d6e8a['include'],function(_0xb22770){return{'model':db[_0xb22770['model']],'as':_0xb22770['as'],'attributes':_0xb22770['attributes'],'include':_0xb22770[_0xa71b('0x1c')]?_[_0xa71b('0x1d')](_0xb22770[_0xa71b('0x1c')],function(_0x1c37f5){return{'model':db[_0x1c37f5[_0xa71b('0x1e')]],'as':_0x1c37f5['as'],'attributes':_0x1c37f5[_0xa71b('0x1a')]};}):[]};}):[]};}):[]:[]})[_0xa71b('0xb')](function(_0x46f8cc){logger[_0xa71b('0x12')](_0xa71b('0x22'),_0x4dcc54);logger[_0xa71b('0xd')](_0xa71b('0x22'),_0x4dcc54,JSON['stringify'](_0x46f8cc));_0x26868f(_0x46f8cc);})['catch'](function(_0x2cd122){logger[_0xa71b('0xf')](_0xa71b('0x22'),_0x2cd122[_0xa71b('0x11')],_0x4dcc54);_0x117841(_0x3a0fa5[_0xa71b('0xf')](0x1f4,_0x2cd122[_0xa71b('0x11')]));});});}; \ No newline at end of file +var _0x0505=['model','catch','ShowZendeskAccount','find','where','util','bluebird','randomstring','ioredis','../../config/utils','../../config/logger','../../config/environment','jayson/promise','client','http','request','then','request\x20sent','stringify','error','code','ZendeskAccount,\x20%s,\x20%s','message','info','result','GetZendeskAccount','ZendeskAccount','options','raw','attributes','limit','map','include'];(function(_0x326f83,_0x503610){var _0x5b0ba5=function(_0x11b804){while(--_0x11b804){_0x326f83['push'](_0x326f83['shift']());}};_0x5b0ba5(++_0x503610);}(_0x0505,0x14f));var _0x5050=function(_0x273c39,_0x1052e6){_0x273c39=_0x273c39-0x0;var _0x46d6b5=_0x0505[_0x273c39];return _0x46d6b5;};'use strict';var _=require('lodash');var util=require(_0x5050('0x0'));var moment=require('moment');var BPromise=require(_0x5050('0x1'));var rs=require(_0x5050('0x2'));var fs=require('fs');var Redis=require(_0x5050('0x3'));var db=require('../../mysqldb')['db'];var utils=require(_0x5050('0x4'));var logger=require(_0x5050('0x5'))('rpc');var config=require(_0x5050('0x6'));var jayson=require(_0x5050('0x7'));var client=jayson[_0x5050('0x8')][_0x5050('0x9')]({'port':0x232a});function respondWithRpcPromise(_0x97d131,_0x58181f,_0x4ed295){return new BPromise(function(_0x5dc4c2,_0x4b2529){return client[_0x5050('0xa')](_0x97d131,_0x4ed295)[_0x5050('0xb')](function(_0x4087e8){logger['info']('ZendeskAccount,\x20%s,\x20%s',_0x58181f,_0x5050('0xc'));logger['debug']('ZendeskAccount,\x20%s,\x20%s,\x20%s',_0x58181f,_0x5050('0xc'),JSON[_0x5050('0xd')](_0x4087e8));if(_0x4087e8[_0x5050('0xe')]){if(_0x4087e8['error'][_0x5050('0xf')]===0x1f4){logger[_0x5050('0xe')](_0x5050('0x10'),_0x58181f,_0x4087e8['error'][_0x5050('0x11')]);return _0x4b2529(_0x4087e8[_0x5050('0xe')][_0x5050('0x11')]);}logger[_0x5050('0xe')]('ZendeskAccount,\x20%s,\x20%s',_0x58181f,_0x4087e8[_0x5050('0xe')][_0x5050('0x11')]);return _0x5dc4c2(_0x4087e8[_0x5050('0xe')][_0x5050('0x11')]);}else{logger[_0x5050('0x12')](_0x5050('0x10'),_0x58181f,'request\x20sent');_0x5dc4c2(_0x4087e8[_0x5050('0x13')][_0x5050('0x11')]);}})['catch'](function(_0x5aa392){logger[_0x5050('0xe')]('ZendeskAccount,\x20%s,\x20%s',_0x58181f,_0x5aa392);_0x4b2529(_0x5aa392);});});}exports[_0x5050('0x14')]=function(_0x543765){var _0x3501ce=this;return new Promise(function(_0x361728,_0x26994a){return db[_0x5050('0x15')]['findAll']({'raw':_0x543765['options']?_0x543765[_0x5050('0x16')][_0x5050('0x17')]===undefined?!![]:![]:!![],'where':_0x543765[_0x5050('0x16')]?_0x543765[_0x5050('0x16')]['where']||null:null,'attributes':_0x543765[_0x5050('0x16')]?_0x543765['options'][_0x5050('0x18')]||null:null,'limit':_0x543765[_0x5050('0x16')]?_0x543765[_0x5050('0x16')][_0x5050('0x19')]||null:null,'include':_0x543765['options']?_0x543765[_0x5050('0x16')]['include']?_[_0x5050('0x1a')](_0x543765['options'][_0x5050('0x1b')],function(_0xe6106){return{'model':db[_0xe6106[_0x5050('0x1c')]],'as':_0xe6106['as'],'attributes':_0xe6106[_0x5050('0x18')],'include':_0xe6106[_0x5050('0x1b')]?_[_0x5050('0x1a')](_0xe6106['include'],function(_0xbea4cc){return{'model':db[_0xbea4cc['model']],'as':_0xbea4cc['as'],'attributes':_0xbea4cc[_0x5050('0x18')],'include':_0xbea4cc[_0x5050('0x1b')]?_[_0x5050('0x1a')](_0xbea4cc[_0x5050('0x1b')],function(_0x1a0fb5){return{'model':db[_0x1a0fb5[_0x5050('0x1c')]],'as':_0x1a0fb5['as'],'attributes':_0x1a0fb5[_0x5050('0x18')]};}):[]};}):[]};}):[]:[]})[_0x5050('0xb')](function(_0x4ee077){logger[_0x5050('0x12')](_0x5050('0x14'),_0x543765);logger['debug'](_0x5050('0x14'),_0x543765,JSON['stringify'](_0x4ee077));_0x361728(_0x4ee077);})[_0x5050('0x1d')](function(_0x590045){logger['error'](_0x5050('0x14'),_0x590045[_0x5050('0x11')],_0x543765);_0x26994a(_0x3501ce['error'](0x1f4,_0x590045[_0x5050('0x11')]));});});};exports[_0x5050('0x1e')]=function(_0x4cc47d){var _0xa53120=this;return new Promise(function(_0x23ff0f,_0x1b38bd){return db[_0x5050('0x15')][_0x5050('0x1f')]({'raw':_0x4cc47d[_0x5050('0x16')]?_0x4cc47d[_0x5050('0x16')][_0x5050('0x17')]===undefined?!![]:![]:!![],'where':_0x4cc47d[_0x5050('0x16')]?_0x4cc47d[_0x5050('0x16')][_0x5050('0x20')]||null:null,'attributes':_0x4cc47d[_0x5050('0x16')]?_0x4cc47d[_0x5050('0x16')][_0x5050('0x18')]||null:null,'include':_0x4cc47d[_0x5050('0x16')]?_0x4cc47d[_0x5050('0x16')][_0x5050('0x1b')]?_['map'](_0x4cc47d['options'][_0x5050('0x1b')],function(_0x478b4f){return{'model':db[_0x478b4f[_0x5050('0x1c')]],'as':_0x478b4f['as'],'attributes':_0x478b4f['attributes'],'include':_0x478b4f[_0x5050('0x1b')]?_[_0x5050('0x1a')](_0x478b4f[_0x5050('0x1b')],function(_0x1d244a){return{'model':db[_0x1d244a[_0x5050('0x1c')]],'as':_0x1d244a['as'],'attributes':_0x1d244a['attributes'],'include':_0x1d244a[_0x5050('0x1b')]?_[_0x5050('0x1a')](_0x1d244a[_0x5050('0x1b')],function(_0x8b8384){return{'model':db[_0x8b8384['model']],'as':_0x8b8384['as'],'attributes':_0x8b8384['attributes']};}):[]};}):[]};}):[]:[]})[_0x5050('0xb')](function(_0x14f9de){logger[_0x5050('0x12')](_0x5050('0x1e'),_0x4cc47d);logger['debug'](_0x5050('0x1e'),_0x4cc47d,JSON[_0x5050('0xd')](_0x14f9de));_0x23ff0f(_0x14f9de);})[_0x5050('0x1d')](function(_0x8b0e98){logger[_0x5050('0xe')](_0x5050('0x1e'),_0x8b0e98['message'],_0x4cc47d);_0x1b38bd(_0xa53120[_0x5050('0xe')](0x1f4,_0x8b0e98[_0x5050('0x11')]));});});}; \ No newline at end of file diff --git a/server/api/intZendeskConfiguration/index.js b/server/api/intZendeskConfiguration/index.js index 7dfd1fb..524dca2 100644 --- a/server/api/intZendeskConfiguration/index.js +++ b/server/api/intZendeskConfiguration/index.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0xac4a=['../../components/interaction/service','../../config/environment','./intZendeskConfiguration.controller','isAuthenticated','get','show','getSubjects','/:id/descriptions','getDescriptions','getTags','post','create','setTags','put','/:id','update','delete','destroy','exports','multer','util','path','connect-timeout','express','Router'];(function(_0x5aab27,_0x32a9ab){var _0x22dddd=function(_0x21367e){while(--_0x21367e){_0x5aab27['push'](_0x5aab27['shift']());}};_0x22dddd(++_0x32a9ab);}(_0xac4a,0x13f));var _0xaac4=function(_0x15500d,_0x1b230b){_0x15500d=_0x15500d-0x0;var _0x403293=_0xac4a[_0x15500d];return _0x403293;};'use strict';var multer=require(_0xaac4('0x0'));var util=require(_0xaac4('0x1'));var path=require(_0xaac4('0x2'));var timeout=require(_0xaac4('0x3'));var express=require(_0xaac4('0x4'));var router=express[_0xaac4('0x5')]();var fs_extra=require('fs-extra');var auth=require('../../components/auth/service');var interaction=require(_0xaac4('0x6'));var config=require(_0xaac4('0x7'));var controller=require(_0xaac4('0x8'));router['get']('/',auth[_0xaac4('0x9')](),controller['index']);router[_0xaac4('0xa')]('/:id',auth[_0xaac4('0x9')](),controller[_0xaac4('0xb')]);router['get']('/:id/fields',auth[_0xaac4('0x9')](),controller['getFields']);router[_0xaac4('0xa')]('/:id/subjects',auth['isAuthenticated'](),controller[_0xaac4('0xc')]);router[_0xaac4('0xa')](_0xaac4('0xd'),auth[_0xaac4('0x9')](),controller[_0xaac4('0xe')]);router['get']('/:id/tags',auth[_0xaac4('0x9')](),controller[_0xaac4('0xf')]);router[_0xaac4('0x10')]('/',auth['isAuthenticated'](),controller[_0xaac4('0x11')]);router[_0xaac4('0x10')]('/:id/tags',auth[_0xaac4('0x9')](),controller[_0xaac4('0x12')]);router[_0xaac4('0x13')](_0xaac4('0x14'),auth[_0xaac4('0x9')](),controller[_0xaac4('0x15')]);router[_0xaac4('0x16')](_0xaac4('0x14'),auth[_0xaac4('0x9')](),controller[_0xaac4('0x17')]);module[_0xaac4('0x18')]=router; \ No newline at end of file +var _0xcb91=['get','index','isAuthenticated','show','/:id/fields','/:id/subjects','getSubjects','getDescriptions','/:id/tags','create','post','put','/:id','update','delete','destroy','exports','path','connect-timeout','express','Router','../../components/auth/service','../../components/interaction/service','./intZendeskConfiguration.controller'];(function(_0x3070d5,_0x1d3284){var _0x2067e6=function(_0x15fe16){while(--_0x15fe16){_0x3070d5['push'](_0x3070d5['shift']());}};_0x2067e6(++_0x1d3284);}(_0xcb91,0x1a9));var _0x1cb9=function(_0x325501,_0x5242f6){_0x325501=_0x325501-0x0;var _0x2c1626=_0xcb91[_0x325501];return _0x2c1626;};'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['get'](_0x1cb9('0xb'),auth['isAuthenticated'](),controller['getFields']);router[_0x1cb9('0x7')](_0x1cb9('0xc'),auth[_0x1cb9('0x9')](),controller[_0x1cb9('0xd')]);router[_0x1cb9('0x7')]('/:id/descriptions',auth[_0x1cb9('0x9')](),controller[_0x1cb9('0xe')]);router[_0x1cb9('0x7')](_0x1cb9('0xf'),auth[_0x1cb9('0x9')](),controller['getTags']);router['post']('/',auth['isAuthenticated'](),controller[_0x1cb9('0x10')]);router[_0x1cb9('0x11')](_0x1cb9('0xf'),auth[_0x1cb9('0x9')](),controller['setTags']);router[_0x1cb9('0x12')](_0x1cb9('0x13'),auth[_0x1cb9('0x9')](),controller[_0x1cb9('0x14')]);router[_0x1cb9('0x15')]('/:id',auth['isAuthenticated'](),controller[_0x1cb9('0x16')]);module[_0x1cb9('0x17')]=router; \ No newline at end of file diff --git a/server/api/intZendeskConfiguration/intZendeskConfiguration.attributes.js b/server/api/intZendeskConfiguration/intZendeskConfiguration.attributes.js index 1e57a73..d2d7924 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 _0x136b=['STRING','exports'];(function(_0x6acb3c,_0x5923a2){var _0x48d743=function(_0x1d838f){while(--_0x1d838f){_0x6acb3c['push'](_0x6acb3c['shift']());}};_0x48d743(++_0x5923a2);}(_0x136b,0x127));var _0xb136=function(_0x1facfa,_0x1acf7d){_0x1facfa=_0x1facfa-0x0;var _0x9ec701=_0x136b[_0x1facfa];return _0x9ec701;};'use strict';var Sequelize=require('sequelize');module[_0xb136('0x0')]={'name':{'type':Sequelize['STRING']},'description':{'type':Sequelize[_0xb136('0x1')]}}; \ No newline at end of file +var _0x239f=['STRING','sequelize'];(function(_0x2d9f26,_0x31e445){var _0x26d606=function(_0xe70027){while(--_0xe70027){_0x2d9f26['push'](_0x2d9f26['shift']());}};_0x26d606(++_0x31e445);}(_0x239f,0x69));var _0xf239=function(_0x3759cc,_0x3b35a4){_0x3759cc=_0x3759cc-0x0;var _0xc9a514=_0x239f[_0x3759cc];return _0xc9a514;};'use strict';var Sequelize=require(_0xf239('0x0'));module['exports']={'name':{'type':Sequelize[_0xf239('0x1')]},'description':{'type':Sequelize['STRING']}}; \ No newline at end of file diff --git a/server/api/intZendeskConfiguration/intZendeskConfiguration.controller.js b/server/api/intZendeskConfiguration/intZendeskConfiguration.controller.js index 7162263..d5f416f 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 _0xeab1=['type','key','model','query','intersection','attributes','fields','hasOwnProperty','nolimit','order','sort','where','filters','filter','VIRTUAL','name','merge','options','includeAll','include','findAll','rows','show','params','keys','find','catch','create','body','getFields','findOne','ZendeskField','rawAttributes','length','pick','getSubjects','getDescriptions','getTags','Tag','setTags','rimraf','zip-dir','fast-json-patch','request-promise','bluebird','mustache','util','sox','to-csv','ejs','fs-extra','lodash','squel','jsforce','desk.js','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/advancedSearch','../../config/license/hardware','api','../../config/utils','../../config/environment','../../mysqldb','sendStatus','status','end','json','offset','undefined','limit','count','Content-Range','apply','reject','save','update','then','destroy','error','index','map','ZendeskConfiguration','fieldName'];(function(_0x49ca18,_0x5e6d05){var _0x145d54=function(_0x30b9be){while(--_0x30b9be){_0x49ca18['push'](_0x49ca18['shift']());}};_0x145d54(++_0x5e6d05);}(_0xeab1,0xd2));var _0x1eab=function(_0xecc0b9,_0x14aee7){_0xecc0b9=_0xecc0b9-0x0;var _0x5be2d7=_0xeab1[_0xecc0b9];return _0x5be2d7;};'use strict';var emlformat=require('eml-format');var rimraf=require(_0x1eab('0x0'));var zipdir=require(_0x1eab('0x1'));var jsonpatch=require(_0x1eab('0x2'));var rp=require(_0x1eab('0x3'));var moment=require('moment');var BPromise=require(_0x1eab('0x4'));var Mustache=require(_0x1eab('0x5'));var util=require(_0x1eab('0x6'));var path=require('path');var sox=require(_0x1eab('0x7'));var csv=require(_0x1eab('0x8'));var ejs=require(_0x1eab('0x9'));var fs=require('fs');var fs_extra=require(_0x1eab('0xa'));var _=require(_0x1eab('0xb'));var squel=require(_0x1eab('0xc'));var crypto=require('crypto');var jsforce=require(_0x1eab('0xd'));var deskjs=require(_0x1eab('0xe'));var toCsv=require(_0x1eab('0x8'));var querystring=require(_0x1eab('0xf'));var Papa=require(_0x1eab('0x10'));var Redis=require(_0x1eab('0x11'));var authService=require(_0x1eab('0x12'));var qs=require('../../components/parsers/qs');var as=require(_0x1eab('0x13'));var hardwareService=require(_0x1eab('0x14'));var logger=require('../../config/logger')(_0x1eab('0x15'));var utils=require(_0x1eab('0x16'));var config=require(_0x1eab('0x17'));var licenseUtil=require('../../config/license/util');var db=require(_0x1eab('0x18'))['db'];function respondWithStatusCode(_0x642318,_0x263ea2){_0x263ea2=_0x263ea2||0xcc;return function(_0x5d7aea){if(_0x5d7aea){return _0x642318[_0x1eab('0x19')](_0x263ea2);}return _0x642318[_0x1eab('0x1a')](_0x263ea2)[_0x1eab('0x1b')]();};}function respondWithResult(_0x548433,_0x48bb0d){_0x48bb0d=_0x48bb0d||0xc8;return function(_0x80a8db){if(_0x80a8db){return _0x548433[_0x1eab('0x1a')](_0x48bb0d)[_0x1eab('0x1c')](_0x80a8db);}};}function respondWithFilteredResult(_0xb07e4,_0x17c854){return function(_0xec3041){if(_0xec3041){var _0x198ea4=typeof _0x17c854[_0x1eab('0x1d')]===_0x1eab('0x1e')&&typeof _0x17c854[_0x1eab('0x1f')]===_0x1eab('0x1e');var _0x47be8b=_0xec3041[_0x1eab('0x20')];var _0x1ec8d6=_0x198ea4?0x0:_0x17c854[_0x1eab('0x1d')];var _0x1295b3=_0x198ea4?_0xec3041[_0x1eab('0x20')]:_0x17c854[_0x1eab('0x1d')]+_0x17c854[_0x1eab('0x1f')];var _0x38cb8d;if(_0x1295b3>=_0x47be8b){_0x1295b3=_0x47be8b;_0x38cb8d=0xc8;}else{_0x38cb8d=0xce;}_0xb07e4[_0x1eab('0x1a')](_0x38cb8d);return _0xb07e4['set'](_0x1eab('0x21'),_0x1ec8d6+'-'+_0x1295b3+'/'+_0x47be8b)['json'](_0xec3041);}return null;};}function patchUpdates(_0x2f0b52){return function(_0x1b5fac){try{jsonpatch[_0x1eab('0x22')](_0x1b5fac,_0x2f0b52,!![]);}catch(_0x114a86){return BPromise[_0x1eab('0x23')](_0x114a86);}return _0x1b5fac[_0x1eab('0x24')]();};}function saveUpdates(_0x398c2e,_0x4c233f){return function(_0xdfae25){if(_0xdfae25){return _0xdfae25[_0x1eab('0x25')](_0x398c2e)[_0x1eab('0x26')](function(_0x283618){return _0x283618;});}return null;};}function removeEntity(_0x56c932,_0x2ba3cb){return function(_0x291868){if(_0x291868){return _0x291868[_0x1eab('0x27')]()['then'](function(){_0x56c932[_0x1eab('0x1a')](0xcc)['end']();});}};}function handleEntityNotFound(_0x1eee4e,_0x380970){return function(_0x365b02){if(!_0x365b02){_0x1eee4e[_0x1eab('0x19')](0x194);}return _0x365b02;};}function handleError(_0x15fd84,_0x12c7f4){_0x12c7f4=_0x12c7f4||0x1f4;return function(_0x5eb1b2){logger[_0x1eab('0x28')](_0x5eb1b2['stack']);if(_0x5eb1b2['name']){delete _0x5eb1b2['name'];}_0x15fd84[_0x1eab('0x1a')](_0x12c7f4)['send'](_0x5eb1b2);};}exports[_0x1eab('0x29')]=function(_0x32e229,_0x4cd8e6){var _0x21c3c2={},_0x3f1ebd={},_0x49a39a={'count':0x0,'rows':[]};var _0x87a9b9=_[_0x1eab('0x2a')](db[_0x1eab('0x2b')]['rawAttributes'],function(_0x124741){return{'name':_0x124741[_0x1eab('0x2c')],'type':_0x124741[_0x1eab('0x2d')][_0x1eab('0x2e')]};});_0x3f1ebd[_0x1eab('0x2f')]=_[_0x1eab('0x2a')](_0x87a9b9,'name');_0x3f1ebd[_0x1eab('0x30')]=_['keys'](_0x32e229['query']);_0x3f1ebd['filters']=_[_0x1eab('0x31')](_0x3f1ebd[_0x1eab('0x2f')],_0x3f1ebd[_0x1eab('0x30')]);_0x21c3c2[_0x1eab('0x32')]=_[_0x1eab('0x31')](_0x3f1ebd[_0x1eab('0x2f')],qs[_0x1eab('0x33')](_0x32e229[_0x1eab('0x30')]['fields']));_0x21c3c2[_0x1eab('0x32')]=_0x21c3c2[_0x1eab('0x32')]['length']?_0x21c3c2['attributes']:_0x3f1ebd[_0x1eab('0x2f')];if(!_0x32e229['query'][_0x1eab('0x34')](_0x1eab('0x35'))){_0x21c3c2['limit']=qs[_0x1eab('0x1f')](_0x32e229[_0x1eab('0x30')]['limit']);_0x21c3c2['offset']=qs['offset'](_0x32e229['query'][_0x1eab('0x1d')]);}_0x21c3c2[_0x1eab('0x36')]=qs[_0x1eab('0x37')](_0x32e229['query'][_0x1eab('0x37')]);_0x21c3c2[_0x1eab('0x38')]=qs['filters'](_['pick'](_0x32e229[_0x1eab('0x30')],_0x3f1ebd[_0x1eab('0x39')]),_0x87a9b9);if(_0x32e229[_0x1eab('0x30')][_0x1eab('0x3a')]){_0x21c3c2[_0x1eab('0x38')]=_['merge'](_0x21c3c2['where'],{'$or':_[_0x1eab('0x2a')](_0x87a9b9,function(_0xaedb54){if(_0xaedb54['type']!==_0x1eab('0x3b')){var _0x279095={};_0x279095[_0xaedb54[_0x1eab('0x3c')]]={'$like':'%'+_0x32e229[_0x1eab('0x30')][_0x1eab('0x3a')]+'%'};return _0x279095;}})});}_0x21c3c2=_[_0x1eab('0x3d')]({},_0x21c3c2,_0x32e229[_0x1eab('0x3e')]);var _0x1f9e8a={'where':_0x21c3c2['where']};return db[_0x1eab('0x2b')][_0x1eab('0x20')](_0x1f9e8a)[_0x1eab('0x26')](function(_0x480ddb){_0x49a39a[_0x1eab('0x20')]=_0x480ddb;if(_0x32e229['query'][_0x1eab('0x3f')]){_0x21c3c2[_0x1eab('0x40')]=[{'all':!![]}];}return db['ZendeskConfiguration'][_0x1eab('0x41')](_0x21c3c2);})[_0x1eab('0x26')](function(_0x1a5492){_0x49a39a[_0x1eab('0x42')]=_0x1a5492;return _0x49a39a;})[_0x1eab('0x26')](respondWithFilteredResult(_0x4cd8e6,_0x21c3c2))['catch'](handleError(_0x4cd8e6,null));};exports[_0x1eab('0x43')]=function(_0x598f6e,_0x17e361){var _0x8131b4={'raw':![],'where':{'id':_0x598f6e[_0x1eab('0x44')]['id']}},_0x50c371={};_0x50c371[_0x1eab('0x2f')]=_[_0x1eab('0x45')](db[_0x1eab('0x2b')]['rawAttributes']);_0x50c371[_0x1eab('0x30')]=_[_0x1eab('0x45')](_0x598f6e[_0x1eab('0x30')]);_0x50c371['filters']=_[_0x1eab('0x31')](_0x50c371['model'],_0x50c371['query']);_0x8131b4[_0x1eab('0x32')]=_[_0x1eab('0x31')](_0x50c371['model'],qs[_0x1eab('0x33')](_0x598f6e[_0x1eab('0x30')][_0x1eab('0x33')]));_0x8131b4[_0x1eab('0x32')]=_0x8131b4['attributes']['length']?_0x8131b4[_0x1eab('0x32')]:_0x50c371['model'];if(_0x598f6e[_0x1eab('0x30')][_0x1eab('0x3f')]){_0x8131b4[_0x1eab('0x40')]=[{'all':!![]}];}_0x8131b4=_[_0x1eab('0x3d')]({},_0x8131b4,_0x598f6e[_0x1eab('0x3e')]);return db[_0x1eab('0x2b')][_0x1eab('0x46')](_0x8131b4)[_0x1eab('0x26')](handleEntityNotFound(_0x17e361,null))[_0x1eab('0x26')](respondWithResult(_0x17e361,null))[_0x1eab('0x47')](handleError(_0x17e361,null));};exports[_0x1eab('0x48')]=function(_0x1d6ec8,_0x3f3aa6){return db['ZendeskConfiguration'][_0x1eab('0x48')](_0x1d6ec8['body'],{})[_0x1eab('0x26')](respondWithResult(_0x3f3aa6,0xc9))[_0x1eab('0x47')](handleError(_0x3f3aa6,null));};exports[_0x1eab('0x25')]=function(_0x394899,_0x29b564){if(_0x394899['body']['id']){delete _0x394899[_0x1eab('0x49')]['id'];}return db[_0x1eab('0x2b')][_0x1eab('0x46')]({'where':{'id':_0x394899[_0x1eab('0x44')]['id']}})['then'](handleEntityNotFound(_0x29b564,null))[_0x1eab('0x26')](saveUpdates(_0x394899[_0x1eab('0x49')],null))[_0x1eab('0x26')](respondWithResult(_0x29b564,null))[_0x1eab('0x47')](handleError(_0x29b564,null));};exports[_0x1eab('0x27')]=function(_0x3b1aa6,_0x1cefe4){return db[_0x1eab('0x2b')][_0x1eab('0x46')]({'where':{'id':_0x3b1aa6[_0x1eab('0x44')]['id']}})['then'](handleEntityNotFound(_0x1cefe4,null))['then'](removeEntity(_0x1cefe4,null))[_0x1eab('0x47')](handleError(_0x1cefe4,null));};exports[_0x1eab('0x4a')]=function(_0x119c86,_0x451c24,_0x27c34a){var _0x14f9a2={};var _0x82b775={};var _0x35938f;var _0x12f641;return db[_0x1eab('0x2b')][_0x1eab('0x4b')]({'where':{'id':_0x119c86[_0x1eab('0x44')]['id']}})[_0x1eab('0x26')](handleEntityNotFound(_0x451c24,null))['then'](function(_0x16ed15){if(_0x16ed15){_0x35938f=_0x16ed15;_0x82b775[_0x1eab('0x2f')]=_[_0x1eab('0x45')](db[_0x1eab('0x4c')][_0x1eab('0x4d')]);_0x82b775[_0x1eab('0x30')]=_[_0x1eab('0x45')](_0x119c86[_0x1eab('0x30')]);_0x82b775['filters']=_[_0x1eab('0x31')](_0x82b775[_0x1eab('0x2f')],_0x82b775[_0x1eab('0x30')]);_0x14f9a2[_0x1eab('0x32')]=_['intersection'](_0x82b775['model'],qs[_0x1eab('0x33')](_0x119c86[_0x1eab('0x30')][_0x1eab('0x33')]));_0x14f9a2[_0x1eab('0x32')]=_0x14f9a2['attributes'][_0x1eab('0x4e')]?_0x14f9a2['attributes']:_0x82b775['model'];_0x14f9a2['order']=qs['sort'](_0x119c86[_0x1eab('0x30')][_0x1eab('0x37')]);_0x14f9a2[_0x1eab('0x38')]=qs[_0x1eab('0x39')](_[_0x1eab('0x4f')](_0x119c86['query'],_0x82b775['filters']));if(_0x119c86[_0x1eab('0x30')][_0x1eab('0x3a')]){_0x14f9a2['where']=_[_0x1eab('0x3d')](_0x14f9a2[_0x1eab('0x38')],{'$or':_['map'](_0x14f9a2['attributes'],function(_0x4952d5){var _0x1ed486={};_0x1ed486[_0x4952d5]={'$like':'%'+_0x119c86['query'][_0x1eab('0x3a')]+'%'};return _0x1ed486;})});}_0x14f9a2=_[_0x1eab('0x3d')]({},_0x14f9a2,_0x119c86['options']);return _0x35938f[_0x1eab('0x4a')](_0x14f9a2);}})['then'](function(_0x472d93){if(_0x472d93){_0x12f641=_0x472d93['length'];if(!_0x119c86[_0x1eab('0x30')][_0x1eab('0x34')](_0x1eab('0x35'))){_0x14f9a2['limit']=qs[_0x1eab('0x1f')](_0x119c86[_0x1eab('0x30')][_0x1eab('0x1f')]);_0x14f9a2[_0x1eab('0x1d')]=qs[_0x1eab('0x1d')](_0x119c86[_0x1eab('0x30')]['offset']);}return _0x35938f[_0x1eab('0x4a')](_0x14f9a2);}})[_0x1eab('0x26')](function(_0x4d5421){if(_0x4d5421){return _0x4d5421?{'count':_0x12f641,'rows':_0x4d5421}:null;}})['then'](respondWithResult(_0x451c24,null))[_0x1eab('0x47')](handleError(_0x451c24,null));};exports[_0x1eab('0x50')]=function(_0x5dd3d3,_0x3a2f32,_0x3d19f5){var _0x6d766d={};var _0x450ca2={};var _0x25bc30;var _0x291859;return db[_0x1eab('0x2b')][_0x1eab('0x4b')]({'where':{'id':_0x5dd3d3[_0x1eab('0x44')]['id']}})[_0x1eab('0x26')](handleEntityNotFound(_0x3a2f32,null))[_0x1eab('0x26')](function(_0x1f656c){if(_0x1f656c){_0x25bc30=_0x1f656c;_0x450ca2['model']=_['keys'](db[_0x1eab('0x4c')]['rawAttributes']);_0x450ca2[_0x1eab('0x30')]=_[_0x1eab('0x45')](_0x5dd3d3[_0x1eab('0x30')]);_0x450ca2[_0x1eab('0x39')]=_['intersection'](_0x450ca2['model'],_0x450ca2['query']);_0x6d766d[_0x1eab('0x32')]=_['intersection'](_0x450ca2[_0x1eab('0x2f')],qs[_0x1eab('0x33')](_0x5dd3d3[_0x1eab('0x30')][_0x1eab('0x33')]));_0x6d766d[_0x1eab('0x32')]=_0x6d766d[_0x1eab('0x32')][_0x1eab('0x4e')]?_0x6d766d[_0x1eab('0x32')]:_0x450ca2['model'];_0x6d766d[_0x1eab('0x36')]=qs['sort'](_0x5dd3d3[_0x1eab('0x30')][_0x1eab('0x37')]);_0x6d766d[_0x1eab('0x38')]=qs[_0x1eab('0x39')](_['pick'](_0x5dd3d3[_0x1eab('0x30')],_0x450ca2[_0x1eab('0x39')]));if(_0x5dd3d3[_0x1eab('0x30')]['filter']){_0x6d766d['where']=_[_0x1eab('0x3d')](_0x6d766d['where'],{'$or':_['map'](_0x6d766d[_0x1eab('0x32')],function(_0x367cb2){var _0x1a2a9f={};_0x1a2a9f[_0x367cb2]={'$like':'%'+_0x5dd3d3[_0x1eab('0x30')][_0x1eab('0x3a')]+'%'};return _0x1a2a9f;})});}_0x6d766d=_['merge']({},_0x6d766d,_0x5dd3d3[_0x1eab('0x3e')]);return _0x25bc30['getSubjects'](_0x6d766d);}})[_0x1eab('0x26')](function(_0x3d22cf){if(_0x3d22cf){_0x291859=_0x3d22cf['length'];if(!_0x5dd3d3[_0x1eab('0x30')][_0x1eab('0x34')](_0x1eab('0x35'))){_0x6d766d[_0x1eab('0x1f')]=qs[_0x1eab('0x1f')](_0x5dd3d3['query'][_0x1eab('0x1f')]);_0x6d766d[_0x1eab('0x1d')]=qs[_0x1eab('0x1d')](_0x5dd3d3[_0x1eab('0x30')][_0x1eab('0x1d')]);}return _0x25bc30[_0x1eab('0x50')](_0x6d766d);}})[_0x1eab('0x26')](function(_0xd49ac){if(_0xd49ac){return _0xd49ac?{'count':_0x291859,'rows':_0xd49ac}:null;}})[_0x1eab('0x26')](respondWithResult(_0x3a2f32,null))[_0x1eab('0x47')](handleError(_0x3a2f32,null));};exports['getDescriptions']=function(_0x573f97,_0x467c6a,_0x356622){var _0x2e28a9={};var _0x2745cd={};var _0x561258;var _0x402930;return db[_0x1eab('0x2b')]['findOne']({'where':{'id':_0x573f97[_0x1eab('0x44')]['id']}})['then'](handleEntityNotFound(_0x467c6a,null))[_0x1eab('0x26')](function(_0x244c8f){if(_0x244c8f){_0x561258=_0x244c8f;_0x2745cd[_0x1eab('0x2f')]=_[_0x1eab('0x45')](db[_0x1eab('0x4c')]['rawAttributes']);_0x2745cd[_0x1eab('0x30')]=_['keys'](_0x573f97['query']);_0x2745cd[_0x1eab('0x39')]=_[_0x1eab('0x31')](_0x2745cd['model'],_0x2745cd[_0x1eab('0x30')]);_0x2e28a9['attributes']=_[_0x1eab('0x31')](_0x2745cd[_0x1eab('0x2f')],qs[_0x1eab('0x33')](_0x573f97['query'][_0x1eab('0x33')]));_0x2e28a9[_0x1eab('0x32')]=_0x2e28a9['attributes'][_0x1eab('0x4e')]?_0x2e28a9[_0x1eab('0x32')]:_0x2745cd['model'];_0x2e28a9['order']=qs[_0x1eab('0x37')](_0x573f97[_0x1eab('0x30')]['sort']);_0x2e28a9[_0x1eab('0x38')]=qs['filters'](_[_0x1eab('0x4f')](_0x573f97[_0x1eab('0x30')],_0x2745cd[_0x1eab('0x39')]));if(_0x573f97[_0x1eab('0x30')]['filter']){_0x2e28a9[_0x1eab('0x38')]=_[_0x1eab('0x3d')](_0x2e28a9['where'],{'$or':_['map'](_0x2e28a9['attributes'],function(_0x239512){var _0x35f8c0={};_0x35f8c0[_0x239512]={'$like':'%'+_0x573f97['query']['filter']+'%'};return _0x35f8c0;})});}_0x2e28a9=_['merge']({},_0x2e28a9,_0x573f97[_0x1eab('0x3e')]);return _0x561258[_0x1eab('0x51')](_0x2e28a9);}})[_0x1eab('0x26')](function(_0x5a45bd){if(_0x5a45bd){_0x402930=_0x5a45bd[_0x1eab('0x4e')];if(!_0x573f97[_0x1eab('0x30')]['hasOwnProperty'](_0x1eab('0x35'))){_0x2e28a9[_0x1eab('0x1f')]=qs['limit'](_0x573f97['query'][_0x1eab('0x1f')]);_0x2e28a9[_0x1eab('0x1d')]=qs['offset'](_0x573f97[_0x1eab('0x30')][_0x1eab('0x1d')]);}return _0x561258[_0x1eab('0x51')](_0x2e28a9);}})['then'](function(_0xccaa2e){if(_0xccaa2e){return _0xccaa2e?{'count':_0x402930,'rows':_0xccaa2e}:null;}})[_0x1eab('0x26')](respondWithResult(_0x467c6a,null))[_0x1eab('0x47')](handleError(_0x467c6a,null));};exports[_0x1eab('0x52')]=function(_0x1570bf,_0x3b5038,_0xd42885){var _0x39088f={};var _0x38f951={};var _0x1ba5b2;var _0x1afbde;return db[_0x1eab('0x2b')][_0x1eab('0x4b')]({'where':{'id':_0x1570bf['params']['id']}})['then'](handleEntityNotFound(_0x3b5038,null))[_0x1eab('0x26')](function(_0x4b469e){if(_0x4b469e){_0x1ba5b2=_0x4b469e;_0x38f951[_0x1eab('0x2f')]=_[_0x1eab('0x45')](db[_0x1eab('0x53')]['rawAttributes']);_0x38f951[_0x1eab('0x30')]=_['keys'](_0x1570bf[_0x1eab('0x30')]);_0x38f951[_0x1eab('0x39')]=_[_0x1eab('0x31')](_0x38f951[_0x1eab('0x2f')],_0x38f951['query']);_0x39088f[_0x1eab('0x32')]=_[_0x1eab('0x31')](_0x38f951[_0x1eab('0x2f')],qs[_0x1eab('0x33')](_0x1570bf[_0x1eab('0x30')]['fields']));_0x39088f[_0x1eab('0x32')]=_0x39088f[_0x1eab('0x32')]['length']?_0x39088f['attributes']:_0x38f951[_0x1eab('0x2f')];_0x39088f[_0x1eab('0x36')]=qs[_0x1eab('0x37')](_0x1570bf['query'][_0x1eab('0x37')]);_0x39088f[_0x1eab('0x38')]=qs['filters'](_[_0x1eab('0x4f')](_0x1570bf[_0x1eab('0x30')],_0x38f951[_0x1eab('0x39')]));if(_0x1570bf['query'][_0x1eab('0x3a')]){_0x39088f[_0x1eab('0x38')]=_[_0x1eab('0x3d')](_0x39088f[_0x1eab('0x38')],{'$or':_[_0x1eab('0x2a')](_0x39088f['attributes'],function(_0x2eac0f){var _0xd6ab58={};_0xd6ab58[_0x2eac0f]={'$like':'%'+_0x1570bf[_0x1eab('0x30')][_0x1eab('0x3a')]+'%'};return _0xd6ab58;})});}_0x39088f=_[_0x1eab('0x3d')]({},_0x39088f,_0x1570bf[_0x1eab('0x3e')]);return _0x1ba5b2[_0x1eab('0x52')](_0x39088f);}})[_0x1eab('0x26')](function(_0x3bc853){if(_0x3bc853){_0x1afbde=_0x3bc853['length'];if(!_0x1570bf[_0x1eab('0x30')][_0x1eab('0x34')](_0x1eab('0x35'))){_0x39088f['limit']=qs[_0x1eab('0x1f')](_0x1570bf['query'][_0x1eab('0x1f')]);_0x39088f[_0x1eab('0x1d')]=qs[_0x1eab('0x1d')](_0x1570bf[_0x1eab('0x30')]['offset']);}return _0x1ba5b2['getTags'](_0x39088f);}})['then'](function(_0x3dac9b){if(_0x3dac9b){return _0x3dac9b?{'count':_0x1afbde,'rows':_0x3dac9b}:null;}})['then'](respondWithResult(_0x3b5038,null))[_0x1eab('0x47')](handleError(_0x3b5038,null));};exports[_0x1eab('0x54')]=function(_0x330aff,_0x1a55d9,_0x5171eb){if(_0x330aff[_0x1eab('0x49')]['id']){delete _0x330aff[_0x1eab('0x49')]['id'];}return db['ZendeskConfiguration'][_0x1eab('0x4b')]({'where':{'id':_0x330aff[_0x1eab('0x44')]['id']}})[_0x1eab('0x26')](handleEntityNotFound(_0x1a55d9,null))[_0x1eab('0x26')](function(_0x2ffb2c){if(_0x2ffb2c){return _0x2ffb2c['setTags'](_0x330aff[_0x1eab('0x49')]['ids']||[]);}return null;})[_0x1eab('0x26')](respondWithResult(_0x1a55d9,null))[_0x1eab('0x47')](handleError(_0x1a55d9,null));}; \ No newline at end of file +var _0x91bb=['where','filters','pick','filter','merge','options','ZendeskConfiguration','then','includeAll','include','findAll','rows','catch','params','find','create','body','getFields','findOne','hasOwnProperty','nolimit','getSubjects','order','getDescriptions','Tag','getTags','setTags','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','moment','mustache','path','to-csv','ejs','lodash','squel','crypto','jsforce','desk.js','querystring','papaparse','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/environment','../../config/license/util','sendStatus','status','end','json','limit','undefined','count','offset','set','apply','save','update','destroy','name','send','map','rawAttributes','fieldName','type','key','model','query','keys','intersection','attributes','fields','length','sort'];(function(_0x1b7368,_0x3286ed){var _0x25d54c=function(_0x2366da){while(--_0x2366da){_0x1b7368['push'](_0x1b7368['shift']());}};_0x25d54c(++_0x3286ed);}(_0x91bb,0xbd));var _0xb91b=function(_0x166294,_0x175bc9){_0x166294=_0x166294-0x0;var _0x304968=_0x91bb[_0x166294];return _0x304968;};'use strict';var emlformat=require(_0xb91b('0x0'));var rimraf=require(_0xb91b('0x1'));var zipdir=require(_0xb91b('0x2'));var jsonpatch=require(_0xb91b('0x3'));var rp=require(_0xb91b('0x4'));var moment=require(_0xb91b('0x5'));var BPromise=require('bluebird');var Mustache=require(_0xb91b('0x6'));var util=require('util');var path=require(_0xb91b('0x7'));var sox=require('sox');var csv=require(_0xb91b('0x8'));var ejs=require(_0xb91b('0x9'));var fs=require('fs');var fs_extra=require('fs-extra');var _=require(_0xb91b('0xa'));var squel=require(_0xb91b('0xb'));var crypto=require(_0xb91b('0xc'));var jsforce=require(_0xb91b('0xd'));var deskjs=require(_0xb91b('0xe'));var toCsv=require(_0xb91b('0x8'));var querystring=require(_0xb91b('0xf'));var Papa=require(_0xb91b('0x10'));var Redis=require('ioredis');var authService=require(_0xb91b('0x11'));var qs=require(_0xb91b('0x12'));var as=require(_0xb91b('0x13'));var hardwareService=require(_0xb91b('0x14'));var logger=require(_0xb91b('0x15'))(_0xb91b('0x16'));var utils=require(_0xb91b('0x17'));var config=require(_0xb91b('0x18'));var licenseUtil=require(_0xb91b('0x19'));var db=require('../../mysqldb')['db'];function respondWithStatusCode(_0x2a370c,_0x481f0a){_0x481f0a=_0x481f0a||0xcc;return function(_0x235f46){if(_0x235f46){return _0x2a370c[_0xb91b('0x1a')](_0x481f0a);}return _0x2a370c[_0xb91b('0x1b')](_0x481f0a)[_0xb91b('0x1c')]();};}function respondWithResult(_0x42c71b,_0x33d63b){_0x33d63b=_0x33d63b||0xc8;return function(_0x1baafd){if(_0x1baafd){return _0x42c71b[_0xb91b('0x1b')](_0x33d63b)[_0xb91b('0x1d')](_0x1baafd);}};}function respondWithFilteredResult(_0x8d9d64,_0x48ea2a){return function(_0xed5c8e){if(_0xed5c8e){var _0x3db5df=typeof _0x48ea2a['offset']==='undefined'&&typeof _0x48ea2a[_0xb91b('0x1e')]===_0xb91b('0x1f');var _0x14ed2d=_0xed5c8e[_0xb91b('0x20')];var _0x3b3542=_0x3db5df?0x0:_0x48ea2a[_0xb91b('0x21')];var _0x3b4621=_0x3db5df?_0xed5c8e[_0xb91b('0x20')]:_0x48ea2a[_0xb91b('0x21')]+_0x48ea2a[_0xb91b('0x1e')];var _0x24a991;if(_0x3b4621>=_0x14ed2d){_0x3b4621=_0x14ed2d;_0x24a991=0xc8;}else{_0x24a991=0xce;}_0x8d9d64[_0xb91b('0x1b')](_0x24a991);return _0x8d9d64[_0xb91b('0x22')]('Content-Range',_0x3b3542+'-'+_0x3b4621+'/'+_0x14ed2d)[_0xb91b('0x1d')](_0xed5c8e);}return null;};}function patchUpdates(_0x2aecfa){return function(_0x5b440a){try{jsonpatch[_0xb91b('0x23')](_0x5b440a,_0x2aecfa,!![]);}catch(_0xcb9a47){return BPromise['reject'](_0xcb9a47);}return _0x5b440a[_0xb91b('0x24')]();};}function saveUpdates(_0x557a1f,_0x2de989){return function(_0x2729ad){if(_0x2729ad){return _0x2729ad[_0xb91b('0x25')](_0x557a1f)['then'](function(_0x344dee){return _0x344dee;});}return null;};}function removeEntity(_0x113f21,_0x373a08){return function(_0x1bc3a9){if(_0x1bc3a9){return _0x1bc3a9[_0xb91b('0x26')]()['then'](function(){_0x113f21[_0xb91b('0x1b')](0xcc)[_0xb91b('0x1c')]();});}};}function handleEntityNotFound(_0xb1cfcc,_0x2370d0){return function(_0x2fe78f){if(!_0x2fe78f){_0xb1cfcc[_0xb91b('0x1a')](0x194);}return _0x2fe78f;};}function handleError(_0x329ebc,_0x4d8f21){_0x4d8f21=_0x4d8f21||0x1f4;return function(_0x41ed11){logger['error'](_0x41ed11['stack']);if(_0x41ed11['name']){delete _0x41ed11[_0xb91b('0x27')];}_0x329ebc[_0xb91b('0x1b')](_0x4d8f21)[_0xb91b('0x28')](_0x41ed11);};}exports['index']=function(_0x489c95,_0x2403b2){var _0x2e84da={},_0x376c12={},_0x383414={'count':0x0,'rows':[]};var _0x43af3a=_[_0xb91b('0x29')](db['ZendeskConfiguration'][_0xb91b('0x2a')],function(_0x119a04){return{'name':_0x119a04[_0xb91b('0x2b')],'type':_0x119a04[_0xb91b('0x2c')][_0xb91b('0x2d')]};});_0x376c12[_0xb91b('0x2e')]=_['map'](_0x43af3a,_0xb91b('0x27'));_0x376c12[_0xb91b('0x2f')]=_[_0xb91b('0x30')](_0x489c95[_0xb91b('0x2f')]);_0x376c12['filters']=_[_0xb91b('0x31')](_0x376c12['model'],_0x376c12[_0xb91b('0x2f')]);_0x2e84da[_0xb91b('0x32')]=_[_0xb91b('0x31')](_0x376c12[_0xb91b('0x2e')],qs['fields'](_0x489c95['query'][_0xb91b('0x33')]));_0x2e84da[_0xb91b('0x32')]=_0x2e84da['attributes'][_0xb91b('0x34')]?_0x2e84da[_0xb91b('0x32')]:_0x376c12['model'];if(!_0x489c95['query']['hasOwnProperty']('nolimit')){_0x2e84da[_0xb91b('0x1e')]=qs[_0xb91b('0x1e')](_0x489c95[_0xb91b('0x2f')][_0xb91b('0x1e')]);_0x2e84da['offset']=qs[_0xb91b('0x21')](_0x489c95['query'][_0xb91b('0x21')]);}_0x2e84da['order']=qs[_0xb91b('0x35')](_0x489c95[_0xb91b('0x2f')]['sort']);_0x2e84da[_0xb91b('0x36')]=qs[_0xb91b('0x37')](_[_0xb91b('0x38')](_0x489c95['query'],_0x376c12[_0xb91b('0x37')]),_0x43af3a);if(_0x489c95[_0xb91b('0x2f')][_0xb91b('0x39')]){_0x2e84da[_0xb91b('0x36')]=_[_0xb91b('0x3a')](_0x2e84da[_0xb91b('0x36')],{'$or':_[_0xb91b('0x29')](_0x43af3a,function(_0x4f0a49){if(_0x4f0a49[_0xb91b('0x2c')]!=='VIRTUAL'){var _0x3dd475={};_0x3dd475[_0x4f0a49[_0xb91b('0x27')]]={'$like':'%'+_0x489c95[_0xb91b('0x2f')][_0xb91b('0x39')]+'%'};return _0x3dd475;}})});}_0x2e84da=_[_0xb91b('0x3a')]({},_0x2e84da,_0x489c95[_0xb91b('0x3b')]);var _0x516ac7={'where':_0x2e84da[_0xb91b('0x36')]};return db[_0xb91b('0x3c')][_0xb91b('0x20')](_0x516ac7)[_0xb91b('0x3d')](function(_0x2cd062){_0x383414['count']=_0x2cd062;if(_0x489c95[_0xb91b('0x2f')][_0xb91b('0x3e')]){_0x2e84da[_0xb91b('0x3f')]=[{'all':!![]}];}return db['ZendeskConfiguration'][_0xb91b('0x40')](_0x2e84da);})[_0xb91b('0x3d')](function(_0x2b6655){_0x383414[_0xb91b('0x41')]=_0x2b6655;return _0x383414;})[_0xb91b('0x3d')](respondWithFilteredResult(_0x2403b2,_0x2e84da))[_0xb91b('0x42')](handleError(_0x2403b2,null));};exports['show']=function(_0x549339,_0x3a915d){var _0x2ea547={'raw':![],'where':{'id':_0x549339[_0xb91b('0x43')]['id']}},_0x3bcd2d={};_0x3bcd2d['model']=_[_0xb91b('0x30')](db[_0xb91b('0x3c')][_0xb91b('0x2a')]);_0x3bcd2d[_0xb91b('0x2f')]=_['keys'](_0x549339['query']);_0x3bcd2d[_0xb91b('0x37')]=_[_0xb91b('0x31')](_0x3bcd2d[_0xb91b('0x2e')],_0x3bcd2d[_0xb91b('0x2f')]);_0x2ea547['attributes']=_[_0xb91b('0x31')](_0x3bcd2d['model'],qs[_0xb91b('0x33')](_0x549339[_0xb91b('0x2f')][_0xb91b('0x33')]));_0x2ea547[_0xb91b('0x32')]=_0x2ea547[_0xb91b('0x32')][_0xb91b('0x34')]?_0x2ea547[_0xb91b('0x32')]:_0x3bcd2d[_0xb91b('0x2e')];if(_0x549339[_0xb91b('0x2f')][_0xb91b('0x3e')]){_0x2ea547['include']=[{'all':!![]}];}_0x2ea547=_['merge']({},_0x2ea547,_0x549339[_0xb91b('0x3b')]);return db[_0xb91b('0x3c')][_0xb91b('0x44')](_0x2ea547)[_0xb91b('0x3d')](handleEntityNotFound(_0x3a915d,null))[_0xb91b('0x3d')](respondWithResult(_0x3a915d,null))[_0xb91b('0x42')](handleError(_0x3a915d,null));};exports[_0xb91b('0x45')]=function(_0xc71219,_0x3824cf){return db[_0xb91b('0x3c')][_0xb91b('0x45')](_0xc71219[_0xb91b('0x46')],{})[_0xb91b('0x3d')](respondWithResult(_0x3824cf,0xc9))[_0xb91b('0x42')](handleError(_0x3824cf,null));};exports[_0xb91b('0x25')]=function(_0x3309be,_0x43b0b4){if(_0x3309be['body']['id']){delete _0x3309be['body']['id'];}return db['ZendeskConfiguration']['find']({'where':{'id':_0x3309be[_0xb91b('0x43')]['id']}})['then'](handleEntityNotFound(_0x43b0b4,null))['then'](saveUpdates(_0x3309be[_0xb91b('0x46')],null))[_0xb91b('0x3d')](respondWithResult(_0x43b0b4,null))['catch'](handleError(_0x43b0b4,null));};exports[_0xb91b('0x26')]=function(_0x36518b,_0x1016fb){return db['ZendeskConfiguration'][_0xb91b('0x44')]({'where':{'id':_0x36518b[_0xb91b('0x43')]['id']}})[_0xb91b('0x3d')](handleEntityNotFound(_0x1016fb,null))[_0xb91b('0x3d')](removeEntity(_0x1016fb,null))[_0xb91b('0x42')](handleError(_0x1016fb,null));};exports[_0xb91b('0x47')]=function(_0x1834d9,_0x52c3aa,_0x40aa52){var _0x4ea8df={};var _0x198247={};var _0x38bc27;var _0x5a10f4;return db[_0xb91b('0x3c')][_0xb91b('0x48')]({'where':{'id':_0x1834d9[_0xb91b('0x43')]['id']}})[_0xb91b('0x3d')](handleEntityNotFound(_0x52c3aa,null))[_0xb91b('0x3d')](function(_0x5d1fc1){if(_0x5d1fc1){_0x38bc27=_0x5d1fc1;_0x198247['model']=_['keys'](db['ZendeskField'][_0xb91b('0x2a')]);_0x198247[_0xb91b('0x2f')]=_['keys'](_0x1834d9['query']);_0x198247[_0xb91b('0x37')]=_[_0xb91b('0x31')](_0x198247['model'],_0x198247['query']);_0x4ea8df[_0xb91b('0x32')]=_[_0xb91b('0x31')](_0x198247['model'],qs[_0xb91b('0x33')](_0x1834d9[_0xb91b('0x2f')][_0xb91b('0x33')]));_0x4ea8df[_0xb91b('0x32')]=_0x4ea8df[_0xb91b('0x32')]['length']?_0x4ea8df[_0xb91b('0x32')]:_0x198247[_0xb91b('0x2e')];_0x4ea8df['order']=qs[_0xb91b('0x35')](_0x1834d9[_0xb91b('0x2f')][_0xb91b('0x35')]);_0x4ea8df[_0xb91b('0x36')]=qs[_0xb91b('0x37')](_[_0xb91b('0x38')](_0x1834d9[_0xb91b('0x2f')],_0x198247[_0xb91b('0x37')]));if(_0x1834d9['query']['filter']){_0x4ea8df[_0xb91b('0x36')]=_[_0xb91b('0x3a')](_0x4ea8df['where'],{'$or':_[_0xb91b('0x29')](_0x4ea8df[_0xb91b('0x32')],function(_0x2d7608){var _0x4eadbf={};_0x4eadbf[_0x2d7608]={'$like':'%'+_0x1834d9[_0xb91b('0x2f')][_0xb91b('0x39')]+'%'};return _0x4eadbf;})});}_0x4ea8df=_[_0xb91b('0x3a')]({},_0x4ea8df,_0x1834d9[_0xb91b('0x3b')]);return _0x38bc27['getFields'](_0x4ea8df);}})[_0xb91b('0x3d')](function(_0x57fe05){if(_0x57fe05){_0x5a10f4=_0x57fe05[_0xb91b('0x34')];if(!_0x1834d9[_0xb91b('0x2f')][_0xb91b('0x49')](_0xb91b('0x4a'))){_0x4ea8df['limit']=qs[_0xb91b('0x1e')](_0x1834d9['query'][_0xb91b('0x1e')]);_0x4ea8df[_0xb91b('0x21')]=qs[_0xb91b('0x21')](_0x1834d9[_0xb91b('0x2f')][_0xb91b('0x21')]);}return _0x38bc27[_0xb91b('0x47')](_0x4ea8df);}})[_0xb91b('0x3d')](function(_0x30ffc9){if(_0x30ffc9){return _0x30ffc9?{'count':_0x5a10f4,'rows':_0x30ffc9}:null;}})['then'](respondWithResult(_0x52c3aa,null))['catch'](handleError(_0x52c3aa,null));};exports[_0xb91b('0x4b')]=function(_0x1b0702,_0x2661ac,_0x27b869){var _0x55ac01={};var _0x1cbb51={};var _0x323a6b;var _0x1ff1be;return db[_0xb91b('0x3c')][_0xb91b('0x48')]({'where':{'id':_0x1b0702[_0xb91b('0x43')]['id']}})[_0xb91b('0x3d')](handleEntityNotFound(_0x2661ac,null))[_0xb91b('0x3d')](function(_0x476fed){if(_0x476fed){_0x323a6b=_0x476fed;_0x1cbb51['model']=_['keys'](db['ZendeskField'][_0xb91b('0x2a')]);_0x1cbb51[_0xb91b('0x2f')]=_['keys'](_0x1b0702[_0xb91b('0x2f')]);_0x1cbb51['filters']=_[_0xb91b('0x31')](_0x1cbb51[_0xb91b('0x2e')],_0x1cbb51[_0xb91b('0x2f')]);_0x55ac01[_0xb91b('0x32')]=_[_0xb91b('0x31')](_0x1cbb51[_0xb91b('0x2e')],qs[_0xb91b('0x33')](_0x1b0702[_0xb91b('0x2f')][_0xb91b('0x33')]));_0x55ac01[_0xb91b('0x32')]=_0x55ac01[_0xb91b('0x32')][_0xb91b('0x34')]?_0x55ac01[_0xb91b('0x32')]:_0x1cbb51['model'];_0x55ac01[_0xb91b('0x4c')]=qs[_0xb91b('0x35')](_0x1b0702[_0xb91b('0x2f')][_0xb91b('0x35')]);_0x55ac01['where']=qs[_0xb91b('0x37')](_[_0xb91b('0x38')](_0x1b0702['query'],_0x1cbb51[_0xb91b('0x37')]));if(_0x1b0702[_0xb91b('0x2f')][_0xb91b('0x39')]){_0x55ac01[_0xb91b('0x36')]=_[_0xb91b('0x3a')](_0x55ac01[_0xb91b('0x36')],{'$or':_['map'](_0x55ac01[_0xb91b('0x32')],function(_0x48d401){var _0x59395d={};_0x59395d[_0x48d401]={'$like':'%'+_0x1b0702['query'][_0xb91b('0x39')]+'%'};return _0x59395d;})});}_0x55ac01=_[_0xb91b('0x3a')]({},_0x55ac01,_0x1b0702['options']);return _0x323a6b[_0xb91b('0x4b')](_0x55ac01);}})[_0xb91b('0x3d')](function(_0x471f69){if(_0x471f69){_0x1ff1be=_0x471f69[_0xb91b('0x34')];if(!_0x1b0702[_0xb91b('0x2f')][_0xb91b('0x49')]('nolimit')){_0x55ac01['limit']=qs[_0xb91b('0x1e')](_0x1b0702[_0xb91b('0x2f')]['limit']);_0x55ac01[_0xb91b('0x21')]=qs[_0xb91b('0x21')](_0x1b0702[_0xb91b('0x2f')][_0xb91b('0x21')]);}return _0x323a6b['getSubjects'](_0x55ac01);}})['then'](function(_0x14414b){if(_0x14414b){return _0x14414b?{'count':_0x1ff1be,'rows':_0x14414b}:null;}})[_0xb91b('0x3d')](respondWithResult(_0x2661ac,null))[_0xb91b('0x42')](handleError(_0x2661ac,null));};exports[_0xb91b('0x4d')]=function(_0x223415,_0x53147c,_0x4811c4){var _0x22a399={};var _0x2beb39={};var _0x40f8be;var _0xf4b247;return db[_0xb91b('0x3c')][_0xb91b('0x48')]({'where':{'id':_0x223415[_0xb91b('0x43')]['id']}})[_0xb91b('0x3d')](handleEntityNotFound(_0x53147c,null))['then'](function(_0xe61bad){if(_0xe61bad){_0x40f8be=_0xe61bad;_0x2beb39[_0xb91b('0x2e')]=_[_0xb91b('0x30')](db['ZendeskField'][_0xb91b('0x2a')]);_0x2beb39[_0xb91b('0x2f')]=_[_0xb91b('0x30')](_0x223415[_0xb91b('0x2f')]);_0x2beb39[_0xb91b('0x37')]=_['intersection'](_0x2beb39[_0xb91b('0x2e')],_0x2beb39[_0xb91b('0x2f')]);_0x22a399[_0xb91b('0x32')]=_[_0xb91b('0x31')](_0x2beb39[_0xb91b('0x2e')],qs[_0xb91b('0x33')](_0x223415[_0xb91b('0x2f')][_0xb91b('0x33')]));_0x22a399[_0xb91b('0x32')]=_0x22a399[_0xb91b('0x32')]['length']?_0x22a399[_0xb91b('0x32')]:_0x2beb39['model'];_0x22a399[_0xb91b('0x4c')]=qs[_0xb91b('0x35')](_0x223415[_0xb91b('0x2f')][_0xb91b('0x35')]);_0x22a399['where']=qs[_0xb91b('0x37')](_[_0xb91b('0x38')](_0x223415['query'],_0x2beb39[_0xb91b('0x37')]));if(_0x223415['query'][_0xb91b('0x39')]){_0x22a399['where']=_[_0xb91b('0x3a')](_0x22a399[_0xb91b('0x36')],{'$or':_[_0xb91b('0x29')](_0x22a399[_0xb91b('0x32')],function(_0x2a5885){var _0x29f2e5={};_0x29f2e5[_0x2a5885]={'$like':'%'+_0x223415[_0xb91b('0x2f')][_0xb91b('0x39')]+'%'};return _0x29f2e5;})});}_0x22a399=_[_0xb91b('0x3a')]({},_0x22a399,_0x223415[_0xb91b('0x3b')]);return _0x40f8be[_0xb91b('0x4d')](_0x22a399);}})['then'](function(_0x457ec2){if(_0x457ec2){_0xf4b247=_0x457ec2[_0xb91b('0x34')];if(!_0x223415[_0xb91b('0x2f')][_0xb91b('0x49')](_0xb91b('0x4a'))){_0x22a399[_0xb91b('0x1e')]=qs[_0xb91b('0x1e')](_0x223415[_0xb91b('0x2f')][_0xb91b('0x1e')]);_0x22a399['offset']=qs[_0xb91b('0x21')](_0x223415[_0xb91b('0x2f')]['offset']);}return _0x40f8be[_0xb91b('0x4d')](_0x22a399);}})[_0xb91b('0x3d')](function(_0x2d86d9){if(_0x2d86d9){return _0x2d86d9?{'count':_0xf4b247,'rows':_0x2d86d9}:null;}})[_0xb91b('0x3d')](respondWithResult(_0x53147c,null))[_0xb91b('0x42')](handleError(_0x53147c,null));};exports['getTags']=function(_0x23b8fe,_0x455365,_0x62d287){var _0x596ce9={};var _0x214ea0={};var _0x1c0e3b;var _0x538da8;return db[_0xb91b('0x3c')][_0xb91b('0x48')]({'where':{'id':_0x23b8fe[_0xb91b('0x43')]['id']}})[_0xb91b('0x3d')](handleEntityNotFound(_0x455365,null))[_0xb91b('0x3d')](function(_0x63e192){if(_0x63e192){_0x1c0e3b=_0x63e192;_0x214ea0[_0xb91b('0x2e')]=_[_0xb91b('0x30')](db[_0xb91b('0x4e')][_0xb91b('0x2a')]);_0x214ea0[_0xb91b('0x2f')]=_['keys'](_0x23b8fe[_0xb91b('0x2f')]);_0x214ea0[_0xb91b('0x37')]=_['intersection'](_0x214ea0[_0xb91b('0x2e')],_0x214ea0[_0xb91b('0x2f')]);_0x596ce9[_0xb91b('0x32')]=_[_0xb91b('0x31')](_0x214ea0['model'],qs['fields'](_0x23b8fe[_0xb91b('0x2f')][_0xb91b('0x33')]));_0x596ce9[_0xb91b('0x32')]=_0x596ce9[_0xb91b('0x32')][_0xb91b('0x34')]?_0x596ce9['attributes']:_0x214ea0[_0xb91b('0x2e')];_0x596ce9[_0xb91b('0x4c')]=qs[_0xb91b('0x35')](_0x23b8fe[_0xb91b('0x2f')][_0xb91b('0x35')]);_0x596ce9[_0xb91b('0x36')]=qs['filters'](_[_0xb91b('0x38')](_0x23b8fe['query'],_0x214ea0['filters']));if(_0x23b8fe['query'][_0xb91b('0x39')]){_0x596ce9['where']=_[_0xb91b('0x3a')](_0x596ce9[_0xb91b('0x36')],{'$or':_[_0xb91b('0x29')](_0x596ce9[_0xb91b('0x32')],function(_0x219d59){var _0x49d8c1={};_0x49d8c1[_0x219d59]={'$like':'%'+_0x23b8fe[_0xb91b('0x2f')][_0xb91b('0x39')]+'%'};return _0x49d8c1;})});}_0x596ce9=_[_0xb91b('0x3a')]({},_0x596ce9,_0x23b8fe[_0xb91b('0x3b')]);return _0x1c0e3b[_0xb91b('0x4f')](_0x596ce9);}})['then'](function(_0x3d68e7){if(_0x3d68e7){_0x538da8=_0x3d68e7[_0xb91b('0x34')];if(!_0x23b8fe['query']['hasOwnProperty'](_0xb91b('0x4a'))){_0x596ce9[_0xb91b('0x1e')]=qs[_0xb91b('0x1e')](_0x23b8fe[_0xb91b('0x2f')][_0xb91b('0x1e')]);_0x596ce9['offset']=qs[_0xb91b('0x21')](_0x23b8fe[_0xb91b('0x2f')][_0xb91b('0x21')]);}return _0x1c0e3b['getTags'](_0x596ce9);}})['then'](function(_0x34db72){if(_0x34db72){return _0x34db72?{'count':_0x538da8,'rows':_0x34db72}:null;}})[_0xb91b('0x3d')](respondWithResult(_0x455365,null))['catch'](handleError(_0x455365,null));};exports[_0xb91b('0x50')]=function(_0x42dec3,_0x2d0881,_0x58c8b3){if(_0x42dec3['body']['id']){delete _0x42dec3[_0xb91b('0x46')]['id'];}return db[_0xb91b('0x3c')]['findOne']({'where':{'id':_0x42dec3['params']['id']}})[_0xb91b('0x3d')](handleEntityNotFound(_0x2d0881,null))[_0xb91b('0x3d')](function(_0x5d77c0){if(_0x5d77c0){return _0x5d77c0[_0xb91b('0x50')](_0x42dec3[_0xb91b('0x46')]['ids']||[]);}return null;})[_0xb91b('0x3d')](respondWithResult(_0x2d0881,null))['catch'](handleError(_0x2d0881,null));}; \ No newline at end of file diff --git a/server/api/intZendeskConfiguration/intZendeskConfiguration.model.js b/server/api/intZendeskConfiguration/intZendeskConfiguration.model.js index 3c72c4b..73fe24c 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 _0x4fc2=['../../config/logger','api','bluebird','request-promise','path','../../config/environment','./intZendeskConfiguration.attributes','ZendeskConfiguration','int_zendesk_configurations','lodash','util'];(function(_0x36ed3c,_0x44a00a){var _0x52a2e0=function(_0x3f7af9){while(--_0x3f7af9){_0x36ed3c['push'](_0x36ed3c['shift']());}};_0x52a2e0(++_0x44a00a);}(_0x4fc2,0x111));var _0x24fc=function(_0x49d114,_0x4fdf4b){_0x49d114=_0x49d114-0x0;var _0x3006c1=_0x4fc2[_0x49d114];return _0x3006c1;};'use strict';var _=require(_0x24fc('0x0'));var util=require(_0x24fc('0x1'));var logger=require(_0x24fc('0x2'))(_0x24fc('0x3'));var moment=require('moment');var BPromise=require(_0x24fc('0x4'));var rp=require(_0x24fc('0x5'));var fs=require('fs');var path=require(_0x24fc('0x6'));var rimraf=require('rimraf');var config=require(_0x24fc('0x7'));var attributes=require(_0x24fc('0x8'));module['exports']=function(_0x26fcc6,_0x12d602){return _0x26fcc6['define'](_0x24fc('0x9'),attributes,{'tableName':_0x24fc('0xa'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x7334=['exports','define','ZendeskConfiguration','int_zendesk_configurations','lodash','util','../../config/logger','bluebird','path','rimraf','../../config/environment','./intZendeskConfiguration.attributes'];(function(_0x44216d,_0x4938a7){var _0xeca523=function(_0x11faf1){while(--_0x11faf1){_0x44216d['push'](_0x44216d['shift']());}};_0xeca523(++_0x4938a7);}(_0x7334,0x184));var _0x4733=function(_0x320c0a,_0x2f7ffa){_0x320c0a=_0x320c0a-0x0;var _0x5ae43a=_0x7334[_0x320c0a];return _0x5ae43a;};'use strict';var _=require(_0x4733('0x0'));var util=require(_0x4733('0x1'));var logger=require(_0x4733('0x2'))('api');var moment=require('moment');var BPromise=require(_0x4733('0x3'));var rp=require('request-promise');var fs=require('fs');var path=require(_0x4733('0x4'));var rimraf=require(_0x4733('0x5'));var config=require(_0x4733('0x6'));var attributes=require(_0x4733('0x7'));module[_0x4733('0x8')]=function(_0x449ead,_0x16d7cc){return _0x449ead[_0x4733('0x9')](_0x4733('0xa'),attributes,{'tableName':_0x4733('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 2ed56fc..c39ca67 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 _0x047b=['result','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/logger','rpc','jayson/promise','client','http','request','then','ZendeskConfiguration,\x20%s,\x20%s','debug','ZendeskConfiguration,\x20%s,\x20%s,\x20%s','request\x20sent','stringify','error','message','info'];(function(_0x1d842c,_0x488580){var _0x4ddb8f=function(_0x28072f){while(--_0x28072f){_0x1d842c['push'](_0x1d842c['shift']());}};_0x4ddb8f(++_0x488580);}(_0x047b,0xe8));var _0xb047=function(_0x58afd5,_0x534a48){_0x58afd5=_0x58afd5-0x0;var _0x3e503b=_0x047b[_0x58afd5];return _0x3e503b;};'use strict';var _=require('lodash');var util=require('util');var moment=require(_0xb047('0x0'));var BPromise=require(_0xb047('0x1'));var rs=require(_0xb047('0x2'));var fs=require('fs');var Redis=require(_0xb047('0x3'));var db=require(_0xb047('0x4'))['db'];var utils=require('../../config/utils');var logger=require(_0xb047('0x5'))(_0xb047('0x6'));var config=require('../../config/environment');var jayson=require(_0xb047('0x7'));var client=jayson[_0xb047('0x8')][_0xb047('0x9')]({'port':0x232a});function respondWithRpcPromise(_0x563547,_0x5d0ae4,_0x176a25){return new BPromise(function(_0x100d46,_0x48ff35){return client[_0xb047('0xa')](_0x563547,_0x176a25)[_0xb047('0xb')](function(_0x665d38){logger['info'](_0xb047('0xc'),_0x5d0ae4,'request\x20sent');logger[_0xb047('0xd')](_0xb047('0xe'),_0x5d0ae4,_0xb047('0xf'),JSON[_0xb047('0x10')](_0x665d38));if(_0x665d38['error']){if(_0x665d38['error']['code']===0x1f4){logger[_0xb047('0x11')]('ZendeskConfiguration,\x20%s,\x20%s',_0x5d0ae4,_0x665d38[_0xb047('0x11')][_0xb047('0x12')]);return _0x48ff35(_0x665d38['error'][_0xb047('0x12')]);}logger[_0xb047('0x11')](_0xb047('0xc'),_0x5d0ae4,_0x665d38['error'][_0xb047('0x12')]);return _0x100d46(_0x665d38[_0xb047('0x11')]['message']);}else{logger[_0xb047('0x13')](_0xb047('0xc'),_0x5d0ae4,_0xb047('0xf'));_0x100d46(_0x665d38[_0xb047('0x14')]['message']);}})['catch'](function(_0x5d2403){logger[_0xb047('0x11')](_0xb047('0xc'),_0x5d0ae4,_0x5d2403);_0x48ff35(_0x5d2403);});});} \ No newline at end of file +var _0xf4a8=['ZendeskConfiguration,\x20%s,\x20%s','debug','ZendeskConfiguration,\x20%s,\x20%s,\x20%s','stringify','error','code','message','request\x20sent','result','lodash','util','bluebird','randomstring','ioredis','../../config/logger','rpc','jayson/promise','http','request','then','info'];(function(_0xb71f91,_0x135394){var _0x1c11ff=function(_0x1a2f1a){while(--_0x1a2f1a){_0xb71f91['push'](_0xb71f91['shift']());}};_0x1c11ff(++_0x135394);}(_0xf4a8,0x11a));var _0x8f4a=function(_0x5ee3d3,_0x537c30){_0x5ee3d3=_0x5ee3d3-0x0;var _0x4b272f=_0xf4a8[_0x5ee3d3];return _0x4b272f;};'use strict';var _=require(_0x8f4a('0x0'));var util=require(_0x8f4a('0x1'));var moment=require('moment');var BPromise=require(_0x8f4a('0x2'));var rs=require(_0x8f4a('0x3'));var fs=require('fs');var Redis=require(_0x8f4a('0x4'));var db=require('../../mysqldb')['db'];var utils=require('../../config/utils');var logger=require(_0x8f4a('0x5'))(_0x8f4a('0x6'));var config=require('../../config/environment');var jayson=require(_0x8f4a('0x7'));var client=jayson['client'][_0x8f4a('0x8')]({'port':0x232a});function respondWithRpcPromise(_0x32d54b,_0x37810a,_0x284a2b){return new BPromise(function(_0x38096f,_0x260845){return client[_0x8f4a('0x9')](_0x32d54b,_0x284a2b)[_0x8f4a('0xa')](function(_0x5f20d8){logger[_0x8f4a('0xb')](_0x8f4a('0xc'),_0x37810a,'request\x20sent');logger[_0x8f4a('0xd')](_0x8f4a('0xe'),_0x37810a,'request\x20sent',JSON[_0x8f4a('0xf')](_0x5f20d8));if(_0x5f20d8['error']){if(_0x5f20d8[_0x8f4a('0x10')][_0x8f4a('0x11')]===0x1f4){logger[_0x8f4a('0x10')](_0x8f4a('0xc'),_0x37810a,_0x5f20d8['error']['message']);return _0x260845(_0x5f20d8[_0x8f4a('0x10')][_0x8f4a('0x12')]);}logger[_0x8f4a('0x10')](_0x8f4a('0xc'),_0x37810a,_0x5f20d8[_0x8f4a('0x10')][_0x8f4a('0x12')]);return _0x38096f(_0x5f20d8[_0x8f4a('0x10')][_0x8f4a('0x12')]);}else{logger[_0x8f4a('0xb')]('ZendeskConfiguration,\x20%s,\x20%s',_0x37810a,_0x8f4a('0x13'));_0x38096f(_0x5f20d8[_0x8f4a('0x14')][_0x8f4a('0x12')]);}})['catch'](function(_0x24741b){logger[_0x8f4a('0x10')](_0x8f4a('0xc'),_0x37810a,_0x24741b);_0x260845(_0x24741b);});});} \ No newline at end of file diff --git a/server/api/intZendeskField/index.js b/server/api/intZendeskField/index.js index d083d78..bedcad6 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 _0x8c6e=['../../components/auth/service','../../components/interaction/service','../../config/environment','get','index','/:id','isAuthenticated','show','post','put','update','delete','destroy','exports','multer','util','connect-timeout','express','Router'];(function(_0x1a1787,_0x4de10a){var _0x35d892=function(_0xfa70aa){while(--_0xfa70aa){_0x1a1787['push'](_0x1a1787['shift']());}};_0x35d892(++_0x4de10a);}(_0x8c6e,0x1c3));var _0xe8c6=function(_0x408351,_0x1b2ec6){_0x408351=_0x408351-0x0;var _0x5248c7=_0x8c6e[_0x408351];return _0x5248c7;};'use strict';var multer=require(_0xe8c6('0x0'));var util=require(_0xe8c6('0x1'));var path=require('path');var timeout=require(_0xe8c6('0x2'));var express=require(_0xe8c6('0x3'));var router=express[_0xe8c6('0x4')]();var fs_extra=require('fs-extra');var auth=require(_0xe8c6('0x5'));var interaction=require(_0xe8c6('0x6'));var config=require(_0xe8c6('0x7'));var controller=require('./intZendeskField.controller');router[_0xe8c6('0x8')]('/',auth['isAuthenticated'](),controller[_0xe8c6('0x9')]);router[_0xe8c6('0x8')](_0xe8c6('0xa'),auth[_0xe8c6('0xb')](),controller[_0xe8c6('0xc')]);router[_0xe8c6('0xd')]('/',auth[_0xe8c6('0xb')](),controller['create']);router[_0xe8c6('0xe')](_0xe8c6('0xa'),auth['isAuthenticated'](),controller[_0xe8c6('0xf')]);router[_0xe8c6('0x10')](_0xe8c6('0xa'),auth[_0xe8c6('0xb')](),controller[_0xe8c6('0x11')]);module[_0xe8c6('0x12')]=router; \ No newline at end of file +var _0x8b0f=['delete','destroy','exports','util','connect-timeout','Router','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','./intZendeskField.controller','get','isAuthenticated','index','/:id','show','post','create'];(function(_0x3e6bc9,_0x179dc3){var _0x207548=function(_0x539871){while(--_0x539871){_0x3e6bc9['push'](_0x3e6bc9['shift']());}};_0x207548(++_0x179dc3);}(_0x8b0f,0x135));var _0xf8b0=function(_0x3bc37d,_0x170644){_0x3bc37d=_0x3bc37d-0x0;var _0x541418=_0x8b0f[_0x3bc37d];return _0x541418;};'use strict';var multer=require('multer');var util=require(_0xf8b0('0x0'));var path=require('path');var timeout=require(_0xf8b0('0x1'));var express=require('express');var router=express[_0xf8b0('0x2')]();var fs_extra=require(_0xf8b0('0x3'));var auth=require(_0xf8b0('0x4'));var interaction=require(_0xf8b0('0x5'));var config=require(_0xf8b0('0x6'));var controller=require(_0xf8b0('0x7'));router[_0xf8b0('0x8')]('/',auth[_0xf8b0('0x9')](),controller[_0xf8b0('0xa')]);router[_0xf8b0('0x8')](_0xf8b0('0xb'),auth[_0xf8b0('0x9')](),controller[_0xf8b0('0xc')]);router[_0xf8b0('0xd')]('/',auth[_0xf8b0('0x9')](),controller[_0xf8b0('0xe')]);router['put'](_0xf8b0('0xb'),auth[_0xf8b0('0x9')](),controller['update']);router[_0xf8b0('0xf')](_0xf8b0('0xb'),auth[_0xf8b0('0x9')](),controller[_0xf8b0('0x10')]);module[_0xf8b0('0x11')]=router; \ No newline at end of file diff --git a/server/api/intZendeskField/intZendeskField.attributes.js b/server/api/intZendeskField/intZendeskField.attributes.js index 68647f1..e27594d 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 _0xb231=['customVariable','keyValue','STRING','BOOLEAN','sequelize','exports','ENUM','string','variable'];(function(_0x21d9db,_0x31b1a2){var _0x1c36e7=function(_0x27741b){while(--_0x27741b){_0x21d9db['push'](_0x21d9db['shift']());}};_0x1c36e7(++_0x31b1a2);}(_0xb231,0x1a2));var _0x1b23=function(_0x1dc61a,_0x3a36ad){_0x1dc61a=_0x1dc61a-0x0;var _0x38f7f6=_0xb231[_0x1dc61a];return _0x38f7f6;};'use strict';var Sequelize=require(_0x1b23('0x0'));module[_0x1b23('0x1')]={'type':{'type':Sequelize[_0x1b23('0x2')](_0x1b23('0x3'),_0x1b23('0x4'),_0x1b23('0x5'),_0x1b23('0x6'),'picklist'),'defaultValue':'string'},'content':{'type':Sequelize[_0x1b23('0x7')]},'key':{'type':Sequelize[_0x1b23('0x7')]},'keyType':{'type':Sequelize[_0x1b23('0x2')](_0x1b23('0x3'),_0x1b23('0x4'),'customVariable')},'keyContent':{'type':Sequelize[_0x1b23('0x7')]},'idField':{'type':Sequelize['STRING']},'nameField':{'type':Sequelize[_0x1b23('0x7')]},'customField':{'type':Sequelize[_0x1b23('0x8')],'defaultValue':!![]},'variableName':{'type':Sequelize[_0x1b23('0x7')]}}; \ No newline at end of file +var _0xe4af=['keyValue','picklist','ENUM','STRING','exports','string','variable','customVariable'];(function(_0xbf0052,_0x1ac386){var _0x3ee4ff=function(_0x31ecdb){while(--_0x31ecdb){_0xbf0052['push'](_0xbf0052['shift']());}};_0x3ee4ff(++_0x1ac386);}(_0xe4af,0x124));var _0xfe4a=function(_0x3fe3fb,_0x267ad6){_0x3fe3fb=_0x3fe3fb-0x0;var _0x32ed25=_0xe4af[_0x3fe3fb];return _0x32ed25;};'use strict';var Sequelize=require('sequelize');module[_0xfe4a('0x0')]={'type':{'type':Sequelize['ENUM'](_0xfe4a('0x1'),_0xfe4a('0x2'),_0xfe4a('0x3'),_0xfe4a('0x4'),_0xfe4a('0x5')),'defaultValue':_0xfe4a('0x1')},'content':{'type':Sequelize['STRING']},'key':{'type':Sequelize['STRING']},'keyType':{'type':Sequelize[_0xfe4a('0x6')](_0xfe4a('0x1'),_0xfe4a('0x2'),_0xfe4a('0x3'))},'keyContent':{'type':Sequelize[_0xfe4a('0x7')]},'idField':{'type':Sequelize['STRING']},'nameField':{'type':Sequelize[_0xfe4a('0x7')]},'customField':{'type':Sequelize['BOOLEAN'],'defaultValue':!![]},'variableName':{'type':Sequelize[_0xfe4a('0x7')]}}; \ No newline at end of file diff --git a/server/api/intZendeskField/intZendeskField.controller.js b/server/api/intZendeskField/intZendeskField.controller.js index 032c079..1bb954b 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 _0x13ec=['../../config/utils','../../config/environment','../../mysqldb','sendStatus','status','end','json','offset','undefined','count','limit','set','apply','reject','save','update','destroy','then','stack','name','send','index','ZendeskField','rawAttributes','fieldName','type','key','model','keys','query','filters','intersection','attributes','fields','length','hasOwnProperty','sort','where','pick','merge','map','filter','options','includeAll','include','rows','show','params','find','create','body','catch','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','moment','mustache','util','path','sox','ejs','fs-extra','squel','crypto','jsforce','desk.js','querystring','papaparse','../../components/parsers/qs','../../config/license/hardware','../../config/logger','api'];(function(_0xe24355,_0xb7fc0c){var _0x24a7f4=function(_0x5bd6dc){while(--_0x5bd6dc){_0xe24355['push'](_0xe24355['shift']());}};_0x24a7f4(++_0xb7fc0c);}(_0x13ec,0x15c));var _0xc13e=function(_0x4e1911,_0x12bc71){_0x4e1911=_0x4e1911-0x0;var _0x21802c=_0x13ec[_0x4e1911];return _0x21802c;};'use strict';var emlformat=require(_0xc13e('0x0'));var rimraf=require(_0xc13e('0x1'));var zipdir=require(_0xc13e('0x2'));var jsonpatch=require(_0xc13e('0x3'));var rp=require(_0xc13e('0x4'));var moment=require(_0xc13e('0x5'));var BPromise=require('bluebird');var Mustache=require(_0xc13e('0x6'));var util=require(_0xc13e('0x7'));var path=require(_0xc13e('0x8'));var sox=require(_0xc13e('0x9'));var csv=require('to-csv');var ejs=require(_0xc13e('0xa'));var fs=require('fs');var fs_extra=require(_0xc13e('0xb'));var _=require('lodash');var squel=require(_0xc13e('0xc'));var crypto=require(_0xc13e('0xd'));var jsforce=require(_0xc13e('0xe'));var deskjs=require(_0xc13e('0xf'));var toCsv=require('to-csv');var querystring=require(_0xc13e('0x10'));var Papa=require(_0xc13e('0x11'));var Redis=require('ioredis');var authService=require('../../components/auth/service');var qs=require(_0xc13e('0x12'));var as=require('../../components/parsers/advancedSearch');var hardwareService=require(_0xc13e('0x13'));var logger=require(_0xc13e('0x14'))(_0xc13e('0x15'));var utils=require(_0xc13e('0x16'));var config=require(_0xc13e('0x17'));var licenseUtil=require('../../config/license/util');var db=require(_0xc13e('0x18'))['db'];function respondWithStatusCode(_0x2a9f46,_0x25616e){_0x25616e=_0x25616e||0xcc;return function(_0x41fb85){if(_0x41fb85){return _0x2a9f46[_0xc13e('0x19')](_0x25616e);}return _0x2a9f46[_0xc13e('0x1a')](_0x25616e)[_0xc13e('0x1b')]();};}function respondWithResult(_0x48a507,_0x5cb343){_0x5cb343=_0x5cb343||0xc8;return function(_0x4a7878){if(_0x4a7878){return _0x48a507[_0xc13e('0x1a')](_0x5cb343)[_0xc13e('0x1c')](_0x4a7878);}};}function respondWithFilteredResult(_0x597044,_0x280e31){return function(_0x385030){if(_0x385030){var _0x37206b=typeof _0x280e31[_0xc13e('0x1d')]===_0xc13e('0x1e')&&typeof _0x280e31['limit']===_0xc13e('0x1e');var _0x19fab3=_0x385030[_0xc13e('0x1f')];var _0x1059b4=_0x37206b?0x0:_0x280e31[_0xc13e('0x1d')];var _0xc09a77=_0x37206b?_0x385030[_0xc13e('0x1f')]:_0x280e31[_0xc13e('0x1d')]+_0x280e31[_0xc13e('0x20')];var _0x3cd971;if(_0xc09a77>=_0x19fab3){_0xc09a77=_0x19fab3;_0x3cd971=0xc8;}else{_0x3cd971=0xce;}_0x597044['status'](_0x3cd971);return _0x597044[_0xc13e('0x21')]('Content-Range',_0x1059b4+'-'+_0xc09a77+'/'+_0x19fab3)[_0xc13e('0x1c')](_0x385030);}return null;};}function patchUpdates(_0x4eb382){return function(_0x19c0b1){try{jsonpatch[_0xc13e('0x22')](_0x19c0b1,_0x4eb382,!![]);}catch(_0x3b1b09){return BPromise[_0xc13e('0x23')](_0x3b1b09);}return _0x19c0b1[_0xc13e('0x24')]();};}function saveUpdates(_0x398364,_0x52d42b){return function(_0x59f95c){if(_0x59f95c){return _0x59f95c[_0xc13e('0x25')](_0x398364)['then'](function(_0x629397){return _0x629397;});}return null;};}function removeEntity(_0x24fe86,_0x249b61){return function(_0x5945a2){if(_0x5945a2){return _0x5945a2[_0xc13e('0x26')]()[_0xc13e('0x27')](function(){_0x24fe86['status'](0xcc)[_0xc13e('0x1b')]();});}};}function handleEntityNotFound(_0xb4bd63,_0x4bfea8){return function(_0x370f10){if(!_0x370f10){_0xb4bd63[_0xc13e('0x19')](0x194);}return _0x370f10;};}function handleError(_0x6898d9,_0x41df1e){_0x41df1e=_0x41df1e||0x1f4;return function(_0x483a51){logger['error'](_0x483a51[_0xc13e('0x28')]);if(_0x483a51['name']){delete _0x483a51[_0xc13e('0x29')];}_0x6898d9[_0xc13e('0x1a')](_0x41df1e)[_0xc13e('0x2a')](_0x483a51);};}exports[_0xc13e('0x2b')]=function(_0x324957,_0x3fd9aa){var _0x214be8={},_0x1414e7={},_0xf664d4={'count':0x0,'rows':[]};var _0x3ff91b=_['map'](db[_0xc13e('0x2c')][_0xc13e('0x2d')],function(_0x42882a){return{'name':_0x42882a[_0xc13e('0x2e')],'type':_0x42882a[_0xc13e('0x2f')][_0xc13e('0x30')]};});_0x1414e7[_0xc13e('0x31')]=_['map'](_0x3ff91b,_0xc13e('0x29'));_0x1414e7['query']=_[_0xc13e('0x32')](_0x324957[_0xc13e('0x33')]);_0x1414e7[_0xc13e('0x34')]=_[_0xc13e('0x35')](_0x1414e7[_0xc13e('0x31')],_0x1414e7[_0xc13e('0x33')]);_0x214be8[_0xc13e('0x36')]=_[_0xc13e('0x35')](_0x1414e7[_0xc13e('0x31')],qs[_0xc13e('0x37')](_0x324957[_0xc13e('0x33')][_0xc13e('0x37')]));_0x214be8['attributes']=_0x214be8['attributes'][_0xc13e('0x38')]?_0x214be8[_0xc13e('0x36')]:_0x1414e7[_0xc13e('0x31')];if(!_0x324957[_0xc13e('0x33')][_0xc13e('0x39')]('nolimit')){_0x214be8['limit']=qs['limit'](_0x324957[_0xc13e('0x33')][_0xc13e('0x20')]);_0x214be8[_0xc13e('0x1d')]=qs['offset'](_0x324957[_0xc13e('0x33')][_0xc13e('0x1d')]);}_0x214be8['order']=qs['sort'](_0x324957['query'][_0xc13e('0x3a')]);_0x214be8[_0xc13e('0x3b')]=qs[_0xc13e('0x34')](_[_0xc13e('0x3c')](_0x324957['query'],_0x1414e7[_0xc13e('0x34')]),_0x3ff91b);if(_0x324957[_0xc13e('0x33')]['filter']){_0x214be8['where']=_[_0xc13e('0x3d')](_0x214be8[_0xc13e('0x3b')],{'$or':_[_0xc13e('0x3e')](_0x3ff91b,function(_0x4b9dca){if(_0x4b9dca[_0xc13e('0x2f')]!=='VIRTUAL'){var _0x58f2c8={};_0x58f2c8[_0x4b9dca[_0xc13e('0x29')]]={'$like':'%'+_0x324957[_0xc13e('0x33')][_0xc13e('0x3f')]+'%'};return _0x58f2c8;}})});}_0x214be8=_[_0xc13e('0x3d')]({},_0x214be8,_0x324957[_0xc13e('0x40')]);var _0x256ad7={'where':_0x214be8[_0xc13e('0x3b')]};return db['ZendeskField'][_0xc13e('0x1f')](_0x256ad7)[_0xc13e('0x27')](function(_0x14523e){_0xf664d4['count']=_0x14523e;if(_0x324957['query'][_0xc13e('0x41')]){_0x214be8[_0xc13e('0x42')]=[{'all':!![]}];}return db[_0xc13e('0x2c')]['findAll'](_0x214be8);})[_0xc13e('0x27')](function(_0x1c88e8){_0xf664d4[_0xc13e('0x43')]=_0x1c88e8;return _0xf664d4;})[_0xc13e('0x27')](respondWithFilteredResult(_0x3fd9aa,_0x214be8))['catch'](handleError(_0x3fd9aa,null));};exports[_0xc13e('0x44')]=function(_0x2d4c76,_0x2ef2e8){var _0x1b18a7={'raw':!![],'where':{'id':_0x2d4c76[_0xc13e('0x45')]['id']}},_0x396f3c={};_0x396f3c[_0xc13e('0x31')]=_[_0xc13e('0x32')](db[_0xc13e('0x2c')]['rawAttributes']);_0x396f3c['query']=_[_0xc13e('0x32')](_0x2d4c76[_0xc13e('0x33')]);_0x396f3c['filters']=_[_0xc13e('0x35')](_0x396f3c['model'],_0x396f3c[_0xc13e('0x33')]);_0x1b18a7[_0xc13e('0x36')]=_[_0xc13e('0x35')](_0x396f3c['model'],qs['fields'](_0x2d4c76[_0xc13e('0x33')][_0xc13e('0x37')]));_0x1b18a7[_0xc13e('0x36')]=_0x1b18a7[_0xc13e('0x36')][_0xc13e('0x38')]?_0x1b18a7[_0xc13e('0x36')]:_0x396f3c[_0xc13e('0x31')];if(_0x2d4c76[_0xc13e('0x33')]['includeAll']){_0x1b18a7[_0xc13e('0x42')]=[{'all':!![]}];}_0x1b18a7=_[_0xc13e('0x3d')]({},_0x1b18a7,_0x2d4c76['options']);return db[_0xc13e('0x2c')][_0xc13e('0x46')](_0x1b18a7)[_0xc13e('0x27')](handleEntityNotFound(_0x2ef2e8,null))[_0xc13e('0x27')](respondWithResult(_0x2ef2e8,null))['catch'](handleError(_0x2ef2e8,null));};exports[_0xc13e('0x47')]=function(_0x32d894,_0x4994c9){return db['ZendeskField']['create'](_0x32d894[_0xc13e('0x48')],{})[_0xc13e('0x27')](respondWithResult(_0x4994c9,0xc9))['catch'](handleError(_0x4994c9,null));};exports[_0xc13e('0x25')]=function(_0x4a4dd2,_0x47d04d){if(_0x4a4dd2[_0xc13e('0x48')]['id']){delete _0x4a4dd2[_0xc13e('0x48')]['id'];}return db[_0xc13e('0x2c')][_0xc13e('0x46')]({'where':{'id':_0x4a4dd2[_0xc13e('0x45')]['id']}})[_0xc13e('0x27')](handleEntityNotFound(_0x47d04d,null))['then'](saveUpdates(_0x4a4dd2[_0xc13e('0x48')],null))[_0xc13e('0x27')](respondWithResult(_0x47d04d,null))[_0xc13e('0x49')](handleError(_0x47d04d,null));};exports['destroy']=function(_0x175b30,_0x10425b){return db[_0xc13e('0x2c')][_0xc13e('0x46')]({'where':{'id':_0x175b30[_0xc13e('0x45')]['id']}})[_0xc13e('0x27')](handleEntityNotFound(_0x10425b,null))[_0xc13e('0x27')](removeEntity(_0x10425b,null))[_0xc13e('0x49')](handleError(_0x10425b,null));}; \ No newline at end of file +var _0xc23d=['../../config/license/util','../../mysqldb','sendStatus','status','end','json','offset','undefined','count','Content-Range','reject','save','then','destroy','error','name','send','index','map','ZendeskField','rawAttributes','type','key','model','query','filters','intersection','attributes','fields','length','hasOwnProperty','nolimit','limit','order','sort','where','pick','filter','merge','VIRTUAL','options','include','findAll','catch','params','keys','includeAll','find','create','body','update','eml-format','rimraf','fast-json-patch','request-promise','moment','mustache','path','sox','to-csv','ejs','lodash','crypto','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','api','../../config/utils','../../config/environment'];(function(_0x55cf47,_0x3d037b){var _0x42bf2b=function(_0x2edd84){while(--_0x2edd84){_0x55cf47['push'](_0x55cf47['shift']());}};_0x42bf2b(++_0x3d037b);}(_0xc23d,0x1e3));var _0xdc23=function(_0x49b207,_0x408ade){_0x49b207=_0x49b207-0x0;var _0x2dc8fa=_0xc23d[_0x49b207];return _0x2dc8fa;};'use strict';var emlformat=require(_0xdc23('0x0'));var rimraf=require(_0xdc23('0x1'));var zipdir=require('zip-dir');var jsonpatch=require(_0xdc23('0x2'));var rp=require(_0xdc23('0x3'));var moment=require(_0xdc23('0x4'));var BPromise=require('bluebird');var Mustache=require(_0xdc23('0x5'));var util=require('util');var path=require(_0xdc23('0x6'));var sox=require(_0xdc23('0x7'));var csv=require(_0xdc23('0x8'));var ejs=require(_0xdc23('0x9'));var fs=require('fs');var fs_extra=require('fs-extra');var _=require(_0xdc23('0xa'));var squel=require('squel');var crypto=require(_0xdc23('0xb'));var jsforce=require('jsforce');var deskjs=require('desk.js');var toCsv=require(_0xdc23('0x8'));var querystring=require('querystring');var Papa=require(_0xdc23('0xc'));var Redis=require(_0xdc23('0xd'));var authService=require(_0xdc23('0xe'));var qs=require(_0xdc23('0xf'));var as=require(_0xdc23('0x10'));var hardwareService=require(_0xdc23('0x11'));var logger=require('../../config/logger')(_0xdc23('0x12'));var utils=require(_0xdc23('0x13'));var config=require(_0xdc23('0x14'));var licenseUtil=require(_0xdc23('0x15'));var db=require(_0xdc23('0x16'))['db'];function respondWithStatusCode(_0x1f0965,_0xf74171){_0xf74171=_0xf74171||0xcc;return function(_0x5b8fea){if(_0x5b8fea){return _0x1f0965[_0xdc23('0x17')](_0xf74171);}return _0x1f0965[_0xdc23('0x18')](_0xf74171)[_0xdc23('0x19')]();};}function respondWithResult(_0x2df733,_0x557699){_0x557699=_0x557699||0xc8;return function(_0x3a7588){if(_0x3a7588){return _0x2df733[_0xdc23('0x18')](_0x557699)[_0xdc23('0x1a')](_0x3a7588);}};}function respondWithFilteredResult(_0x24293f,_0x344819){return function(_0x182cab){if(_0x182cab){var _0x4e65d7=typeof _0x344819[_0xdc23('0x1b')]===_0xdc23('0x1c')&&typeof _0x344819['limit']==='undefined';var _0x4ccd81=_0x182cab[_0xdc23('0x1d')];var _0x3f41cd=_0x4e65d7?0x0:_0x344819[_0xdc23('0x1b')];var _0x279312=_0x4e65d7?_0x182cab[_0xdc23('0x1d')]:_0x344819[_0xdc23('0x1b')]+_0x344819['limit'];var _0x464116;if(_0x279312>=_0x4ccd81){_0x279312=_0x4ccd81;_0x464116=0xc8;}else{_0x464116=0xce;}_0x24293f['status'](_0x464116);return _0x24293f['set'](_0xdc23('0x1e'),_0x3f41cd+'-'+_0x279312+'/'+_0x4ccd81)['json'](_0x182cab);}return null;};}function patchUpdates(_0x4f2180){return function(_0x10bd03){try{jsonpatch['apply'](_0x10bd03,_0x4f2180,!![]);}catch(_0x3bbc36){return BPromise[_0xdc23('0x1f')](_0x3bbc36);}return _0x10bd03[_0xdc23('0x20')]();};}function saveUpdates(_0x2296e8,_0x46a35b){return function(_0x3d8950){if(_0x3d8950){return _0x3d8950['update'](_0x2296e8)[_0xdc23('0x21')](function(_0x405123){return _0x405123;});}return null;};}function removeEntity(_0x1ef538,_0x322d14){return function(_0x29154c){if(_0x29154c){return _0x29154c[_0xdc23('0x22')]()[_0xdc23('0x21')](function(){_0x1ef538[_0xdc23('0x18')](0xcc)[_0xdc23('0x19')]();});}};}function handleEntityNotFound(_0x874416,_0x10178e){return function(_0x26d0bd){if(!_0x26d0bd){_0x874416['sendStatus'](0x194);}return _0x26d0bd;};}function handleError(_0x3ae348,_0x2f2929){_0x2f2929=_0x2f2929||0x1f4;return function(_0x224a42){logger[_0xdc23('0x23')](_0x224a42['stack']);if(_0x224a42[_0xdc23('0x24')]){delete _0x224a42[_0xdc23('0x24')];}_0x3ae348['status'](_0x2f2929)[_0xdc23('0x25')](_0x224a42);};}exports[_0xdc23('0x26')]=function(_0x509ef1,_0xef5564){var _0x348a2f={},_0x328f12={},_0x7ef0e0={'count':0x0,'rows':[]};var _0x47d47f=_[_0xdc23('0x27')](db[_0xdc23('0x28')][_0xdc23('0x29')],function(_0x13c59a){return{'name':_0x13c59a['fieldName'],'type':_0x13c59a[_0xdc23('0x2a')][_0xdc23('0x2b')]};});_0x328f12[_0xdc23('0x2c')]=_[_0xdc23('0x27')](_0x47d47f,'name');_0x328f12[_0xdc23('0x2d')]=_['keys'](_0x509ef1[_0xdc23('0x2d')]);_0x328f12[_0xdc23('0x2e')]=_[_0xdc23('0x2f')](_0x328f12['model'],_0x328f12[_0xdc23('0x2d')]);_0x348a2f[_0xdc23('0x30')]=_['intersection'](_0x328f12[_0xdc23('0x2c')],qs[_0xdc23('0x31')](_0x509ef1[_0xdc23('0x2d')][_0xdc23('0x31')]));_0x348a2f['attributes']=_0x348a2f[_0xdc23('0x30')][_0xdc23('0x32')]?_0x348a2f[_0xdc23('0x30')]:_0x328f12[_0xdc23('0x2c')];if(!_0x509ef1['query'][_0xdc23('0x33')](_0xdc23('0x34'))){_0x348a2f[_0xdc23('0x35')]=qs['limit'](_0x509ef1[_0xdc23('0x2d')][_0xdc23('0x35')]);_0x348a2f['offset']=qs['offset'](_0x509ef1[_0xdc23('0x2d')][_0xdc23('0x1b')]);}_0x348a2f[_0xdc23('0x36')]=qs[_0xdc23('0x37')](_0x509ef1[_0xdc23('0x2d')][_0xdc23('0x37')]);_0x348a2f[_0xdc23('0x38')]=qs[_0xdc23('0x2e')](_[_0xdc23('0x39')](_0x509ef1[_0xdc23('0x2d')],_0x328f12[_0xdc23('0x2e')]),_0x47d47f);if(_0x509ef1['query'][_0xdc23('0x3a')]){_0x348a2f[_0xdc23('0x38')]=_[_0xdc23('0x3b')](_0x348a2f['where'],{'$or':_[_0xdc23('0x27')](_0x47d47f,function(_0x47bc10){if(_0x47bc10[_0xdc23('0x2a')]!==_0xdc23('0x3c')){var _0x241374={};_0x241374[_0x47bc10['name']]={'$like':'%'+_0x509ef1['query'][_0xdc23('0x3a')]+'%'};return _0x241374;}})});}_0x348a2f=_[_0xdc23('0x3b')]({},_0x348a2f,_0x509ef1[_0xdc23('0x3d')]);var _0xba8be7={'where':_0x348a2f[_0xdc23('0x38')]};return db['ZendeskField']['count'](_0xba8be7)[_0xdc23('0x21')](function(_0x47cb1a){_0x7ef0e0[_0xdc23('0x1d')]=_0x47cb1a;if(_0x509ef1[_0xdc23('0x2d')]['includeAll']){_0x348a2f[_0xdc23('0x3e')]=[{'all':!![]}];}return db[_0xdc23('0x28')][_0xdc23('0x3f')](_0x348a2f);})[_0xdc23('0x21')](function(_0x2de409){_0x7ef0e0['rows']=_0x2de409;return _0x7ef0e0;})[_0xdc23('0x21')](respondWithFilteredResult(_0xef5564,_0x348a2f))[_0xdc23('0x40')](handleError(_0xef5564,null));};exports['show']=function(_0x41cda2,_0x52c4c8){var _0x137b97={'raw':!![],'where':{'id':_0x41cda2[_0xdc23('0x41')]['id']}},_0x5496ca={};_0x5496ca[_0xdc23('0x2c')]=_[_0xdc23('0x42')](db[_0xdc23('0x28')][_0xdc23('0x29')]);_0x5496ca['query']=_[_0xdc23('0x42')](_0x41cda2[_0xdc23('0x2d')]);_0x5496ca[_0xdc23('0x2e')]=_['intersection'](_0x5496ca[_0xdc23('0x2c')],_0x5496ca['query']);_0x137b97[_0xdc23('0x30')]=_['intersection'](_0x5496ca[_0xdc23('0x2c')],qs[_0xdc23('0x31')](_0x41cda2['query'][_0xdc23('0x31')]));_0x137b97[_0xdc23('0x30')]=_0x137b97[_0xdc23('0x30')][_0xdc23('0x32')]?_0x137b97[_0xdc23('0x30')]:_0x5496ca[_0xdc23('0x2c')];if(_0x41cda2['query'][_0xdc23('0x43')]){_0x137b97['include']=[{'all':!![]}];}_0x137b97=_['merge']({},_0x137b97,_0x41cda2[_0xdc23('0x3d')]);return db['ZendeskField'][_0xdc23('0x44')](_0x137b97)[_0xdc23('0x21')](handleEntityNotFound(_0x52c4c8,null))[_0xdc23('0x21')](respondWithResult(_0x52c4c8,null))['catch'](handleError(_0x52c4c8,null));};exports[_0xdc23('0x45')]=function(_0x3b8afc,_0x3018d6){return db['ZendeskField'][_0xdc23('0x45')](_0x3b8afc[_0xdc23('0x46')],{})[_0xdc23('0x21')](respondWithResult(_0x3018d6,0xc9))[_0xdc23('0x40')](handleError(_0x3018d6,null));};exports[_0xdc23('0x47')]=function(_0x3da18a,_0x3d282a){if(_0x3da18a[_0xdc23('0x46')]['id']){delete _0x3da18a[_0xdc23('0x46')]['id'];}return db['ZendeskField'][_0xdc23('0x44')]({'where':{'id':_0x3da18a[_0xdc23('0x41')]['id']}})[_0xdc23('0x21')](handleEntityNotFound(_0x3d282a,null))[_0xdc23('0x21')](saveUpdates(_0x3da18a['body'],null))[_0xdc23('0x21')](respondWithResult(_0x3d282a,null))[_0xdc23('0x40')](handleError(_0x3d282a,null));};exports[_0xdc23('0x22')]=function(_0x5b4d52,_0x11ffda){return db[_0xdc23('0x28')]['find']({'where':{'id':_0x5b4d52[_0xdc23('0x41')]['id']}})[_0xdc23('0x21')](handleEntityNotFound(_0x11ffda,null))[_0xdc23('0x21')](removeEntity(_0x11ffda,null))[_0xdc23('0x40')](handleError(_0x11ffda,null));}; \ No newline at end of file diff --git a/server/api/intZendeskField/intZendeskField.model.js b/server/api/intZendeskField/intZendeskField.model.js index 175ad4c..320255c 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 _0xeba3=['./intZendeskField.attributes','exports','ZendeskField','zendesk_unique_index','idField','FieldId','lodash','util','api','moment','bluebird','request-promise','path','rimraf','../../config/environment'];(function(_0x5e96c2,_0x12507b){var _0x294000=function(_0x3b0454){while(--_0x3b0454){_0x5e96c2['push'](_0x5e96c2['shift']());}};_0x294000(++_0x12507b);}(_0xeba3,0x123));var _0x3eba=function(_0x164eca,_0x555e28){_0x164eca=_0x164eca-0x0;var _0x2ce562=_0xeba3[_0x164eca];return _0x2ce562;};'use strict';var _=require(_0x3eba('0x0'));var util=require(_0x3eba('0x1'));var logger=require('../../config/logger')(_0x3eba('0x2'));var moment=require(_0x3eba('0x3'));var BPromise=require(_0x3eba('0x4'));var rp=require(_0x3eba('0x5'));var fs=require('fs');var path=require(_0x3eba('0x6'));var rimraf=require(_0x3eba('0x7'));var config=require(_0x3eba('0x8'));var attributes=require(_0x3eba('0x9'));module[_0x3eba('0xa')]=function(_0x4e2a5d,_0x3c9cff){return _0x4e2a5d['define'](_0x3eba('0xb'),attributes,{'tableName':'int_zendesk_fields','paranoid':![],'indexes':[{'name':_0x3eba('0xc'),'fields':[_0x3eba('0xd'),_0x3eba('0xe')],'unique':!![]}],'timestamps':!![]});}; \ No newline at end of file +var _0xcd53=['../../config/logger','moment','bluebird','request-promise','rimraf','../../config/environment','./intZendeskField.attributes','exports','define','ZendeskField','int_zendesk_fields','idField','FieldId','util'];(function(_0x1c7cd6,_0x384467){var _0x2a7adf=function(_0x554adf){while(--_0x554adf){_0x1c7cd6['push'](_0x1c7cd6['shift']());}};_0x2a7adf(++_0x384467);}(_0xcd53,0x179));var _0x3cd5=function(_0x8a30cf,_0x40f19b){_0x8a30cf=_0x8a30cf-0x0;var _0x20f439=_0xcd53[_0x8a30cf];return _0x20f439;};'use strict';var _=require('lodash');var util=require(_0x3cd5('0x0'));var logger=require(_0x3cd5('0x1'))('api');var moment=require(_0x3cd5('0x2'));var BPromise=require(_0x3cd5('0x3'));var rp=require(_0x3cd5('0x4'));var fs=require('fs');var path=require('path');var rimraf=require(_0x3cd5('0x5'));var config=require(_0x3cd5('0x6'));var attributes=require(_0x3cd5('0x7'));module[_0x3cd5('0x8')]=function(_0x50eb6d,_0x5a89b1){return _0x50eb6d[_0x3cd5('0x9')](_0x3cd5('0xa'),attributes,{'tableName':_0x3cd5('0xb'),'paranoid':![],'indexes':[{'name':'zendesk_unique_index','fields':[_0x3cd5('0xc'),_0x3cd5('0xd')],'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 6a8625c..073f8c4 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 _0xa7c3=['util','moment','../../config/logger','rpc','../../config/environment','jayson/promise','client','http','request','then','info','ZendeskField,\x20%s,\x20%s','request\x20sent','debug','ZendeskField,\x20%s,\x20%s,\x20%s','stringify','error','code','message','result','catch','lodash'];(function(_0x499099,_0x4139dd){var _0x2c6bd4=function(_0x4f81ac){while(--_0x4f81ac){_0x499099['push'](_0x499099['shift']());}};_0x2c6bd4(++_0x4139dd);}(_0xa7c3,0x83));var _0x3a7c=function(_0x59ee6f,_0x450239){_0x59ee6f=_0x59ee6f-0x0;var _0x4c0979=_0xa7c3[_0x59ee6f];return _0x4c0979;};'use strict';var _=require(_0x3a7c('0x0'));var util=require(_0x3a7c('0x1'));var moment=require(_0x3a7c('0x2'));var BPromise=require('bluebird');var rs=require('randomstring');var fs=require('fs');var Redis=require('ioredis');var db=require('../../mysqldb')['db'];var utils=require('../../config/utils');var logger=require(_0x3a7c('0x3'))(_0x3a7c('0x4'));var config=require(_0x3a7c('0x5'));var jayson=require(_0x3a7c('0x6'));var client=jayson[_0x3a7c('0x7')][_0x3a7c('0x8')]({'port':0x232a});function respondWithRpcPromise(_0x25775c,_0x5c2281,_0x2524a9){return new BPromise(function(_0x108b25,_0x44b129){return client[_0x3a7c('0x9')](_0x25775c,_0x2524a9)[_0x3a7c('0xa')](function(_0x13569f){logger[_0x3a7c('0xb')](_0x3a7c('0xc'),_0x5c2281,_0x3a7c('0xd'));logger[_0x3a7c('0xe')](_0x3a7c('0xf'),_0x5c2281,_0x3a7c('0xd'),JSON[_0x3a7c('0x10')](_0x13569f));if(_0x13569f['error']){if(_0x13569f[_0x3a7c('0x11')][_0x3a7c('0x12')]===0x1f4){logger[_0x3a7c('0x11')](_0x3a7c('0xc'),_0x5c2281,_0x13569f['error']['message']);return _0x44b129(_0x13569f[_0x3a7c('0x11')][_0x3a7c('0x13')]);}logger[_0x3a7c('0x11')](_0x3a7c('0xc'),_0x5c2281,_0x13569f[_0x3a7c('0x11')][_0x3a7c('0x13')]);return _0x108b25(_0x13569f[_0x3a7c('0x11')][_0x3a7c('0x13')]);}else{logger[_0x3a7c('0xb')]('ZendeskField,\x20%s,\x20%s',_0x5c2281,_0x3a7c('0xd'));_0x108b25(_0x13569f[_0x3a7c('0x14')][_0x3a7c('0x13')]);}})[_0x3a7c('0x15')](function(_0x226173){logger['error']('ZendeskField,\x20%s,\x20%s',_0x5c2281,_0x226173);_0x44b129(_0x226173);});});} \ No newline at end of file +var _0x0419=['ZendeskField,\x20%s,\x20%s','request\x20sent','ZendeskField,\x20%s,\x20%s,\x20%s','stringify','error','message','catch','lodash','util','moment','randomstring','ioredis','../../mysqldb','../../config/logger','http','request','then','info'];(function(_0x17fd65,_0x556d01){var _0x27d033=function(_0x466323){while(--_0x466323){_0x17fd65['push'](_0x17fd65['shift']());}};_0x27d033(++_0x556d01);}(_0x0419,0x15d));var _0x9041=function(_0x38cb7c,_0xf33f42){_0x38cb7c=_0x38cb7c-0x0;var _0x2a5f5e=_0x0419[_0x38cb7c];return _0x2a5f5e;};'use strict';var _=require(_0x9041('0x0'));var util=require(_0x9041('0x1'));var moment=require(_0x9041('0x2'));var BPromise=require('bluebird');var rs=require(_0x9041('0x3'));var fs=require('fs');var Redis=require(_0x9041('0x4'));var db=require(_0x9041('0x5'))['db'];var utils=require('../../config/utils');var logger=require(_0x9041('0x6'))('rpc');var config=require('../../config/environment');var jayson=require('jayson/promise');var client=jayson['client'][_0x9041('0x7')]({'port':0x232a});function respondWithRpcPromise(_0x101893,_0x27160f,_0x35fca7){return new BPromise(function(_0x514270,_0x566fa2){return client[_0x9041('0x8')](_0x101893,_0x35fca7)[_0x9041('0x9')](function(_0x2bfb2e){logger[_0x9041('0xa')](_0x9041('0xb'),_0x27160f,_0x9041('0xc'));logger['debug'](_0x9041('0xd'),_0x27160f,_0x9041('0xc'),JSON[_0x9041('0xe')](_0x2bfb2e));if(_0x2bfb2e['error']){if(_0x2bfb2e[_0x9041('0xf')]['code']===0x1f4){logger[_0x9041('0xf')](_0x9041('0xb'),_0x27160f,_0x2bfb2e[_0x9041('0xf')][_0x9041('0x10')]);return _0x566fa2(_0x2bfb2e['error'][_0x9041('0x10')]);}logger['error'](_0x9041('0xb'),_0x27160f,_0x2bfb2e[_0x9041('0xf')][_0x9041('0x10')]);return _0x514270(_0x2bfb2e['error'][_0x9041('0x10')]);}else{logger[_0x9041('0xa')](_0x9041('0xb'),_0x27160f,_0x9041('0xc'));_0x514270(_0x2bfb2e['result'][_0x9041('0x10')]);}})[_0x9041('0x11')](function(_0x23842c){logger[_0x9041('0xf')](_0x9041('0xb'),_0x27160f,_0x23842c);_0x566fa2(_0x23842c);});});} \ No newline at end of file diff --git a/server/api/intZohoAccount/index.js b/server/api/intZohoAccount/index.js index 56bfa62..c7a4027 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 _0xf534=['getConfigurations','getFields','post','create','put','/:id','update','delete','destroy','exports','util','path','express','Router','fs-extra','../../components/interaction/service','../../config/environment','./intZohoAccount.controller','get','isAuthenticated','index','show','/:id/configurations'];(function(_0x1e21bc,_0x5a5e48){var _0x53d0df=function(_0x5ea2d5){while(--_0x5ea2d5){_0x1e21bc['push'](_0x1e21bc['shift']());}};_0x53d0df(++_0x5a5e48);}(_0xf534,0x191));var _0x4f53=function(_0x14add3,_0x13ce8d){_0x14add3=_0x14add3-0x0;var _0x4a174f=_0xf534[_0x14add3];return _0x4a174f;};'use strict';var multer=require('multer');var util=require(_0x4f53('0x0'));var path=require(_0x4f53('0x1'));var timeout=require('connect-timeout');var express=require(_0x4f53('0x2'));var router=express[_0x4f53('0x3')]();var fs_extra=require(_0x4f53('0x4'));var auth=require('../../components/auth/service');var interaction=require(_0x4f53('0x5'));var config=require(_0x4f53('0x6'));var controller=require(_0x4f53('0x7'));router[_0x4f53('0x8')]('/',auth[_0x4f53('0x9')](),controller[_0x4f53('0xa')]);router[_0x4f53('0x8')]('/:id',auth[_0x4f53('0x9')](),controller[_0x4f53('0xb')]);router[_0x4f53('0x8')](_0x4f53('0xc'),auth[_0x4f53('0x9')](),controller[_0x4f53('0xd')]);router[_0x4f53('0x8')]('/:id/fields',auth['isAuthenticated'](),controller[_0x4f53('0xe')]);router[_0x4f53('0xf')]('/',auth[_0x4f53('0x9')](),controller[_0x4f53('0x10')]);router[_0x4f53('0xf')](_0x4f53('0xc'),auth[_0x4f53('0x9')](),controller['addConfiguration']);router[_0x4f53('0x11')](_0x4f53('0x12'),auth[_0x4f53('0x9')](),controller[_0x4f53('0x13')]);router[_0x4f53('0x14')](_0x4f53('0x12'),auth[_0x4f53('0x9')](),controller[_0x4f53('0x15')]);module[_0x4f53('0x16')]=router; \ No newline at end of file +var _0xe093=['getConfigurations','/:id/fields','getFields','post','create','addConfiguration','update','multer','util','express','../../components/auth/service','../../components/interaction/service','./intZohoAccount.controller','get','isAuthenticated','index','/:id','show','/:id/configurations'];(function(_0x3f912b,_0x47db94){var _0x5b9f8c=function(_0x41284f){while(--_0x41284f){_0x3f912b['push'](_0x3f912b['shift']());}};_0x5b9f8c(++_0x47db94);}(_0xe093,0x1bc));var _0x3e09=function(_0x3ab9ee,_0x4a74b8){_0x3ab9ee=_0x3ab9ee-0x0;var _0x82ee88=_0xe093[_0x3ab9ee];return _0x82ee88;};'use strict';var multer=require(_0x3e09('0x0'));var util=require(_0x3e09('0x1'));var path=require('path');var timeout=require('connect-timeout');var express=require(_0x3e09('0x2'));var router=express['Router']();var fs_extra=require('fs-extra');var auth=require(_0x3e09('0x3'));var interaction=require(_0x3e09('0x4'));var config=require('../../config/environment');var controller=require(_0x3e09('0x5'));router[_0x3e09('0x6')]('/',auth[_0x3e09('0x7')](),controller[_0x3e09('0x8')]);router['get'](_0x3e09('0x9'),auth[_0x3e09('0x7')](),controller[_0x3e09('0xa')]);router[_0x3e09('0x6')](_0x3e09('0xb'),auth[_0x3e09('0x7')](),controller[_0x3e09('0xc')]);router[_0x3e09('0x6')](_0x3e09('0xd'),auth[_0x3e09('0x7')](),controller[_0x3e09('0xe')]);router[_0x3e09('0xf')]('/',auth[_0x3e09('0x7')](),controller[_0x3e09('0x10')]);router[_0x3e09('0xf')](_0x3e09('0xb'),auth[_0x3e09('0x7')](),controller[_0x3e09('0x11')]);router['put'](_0x3e09('0x9'),auth[_0x3e09('0x7')](),controller[_0x3e09('0x12')]);router['delete'](_0x3e09('0x9'),auth['isAuthenticated'](),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 e62737a..6a68593 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 _0x17ba=['sequelize','exports','STRING'];(function(_0x5c027f,_0xa40135){var _0x5392f3=function(_0x581c3b){while(--_0x581c3b){_0x5c027f['push'](_0x5c027f['shift']());}};_0x5392f3(++_0xa40135);}(_0x17ba,0xab));var _0xa17b=function(_0x41022e,_0x22207b){_0x41022e=_0x41022e-0x0;var _0x3ebbe0=_0x17ba[_0x41022e];return _0x3ebbe0;};'use strict';var Sequelize=require(_0xa17b('0x0'));module[_0xa17b('0x1')]={'name':{'type':Sequelize['STRING']},'description':{'type':Sequelize[_0xa17b('0x2')]},'host':{'type':Sequelize[_0xa17b('0x2')]},'zone':{'type':Sequelize[_0xa17b('0x2')]},'clientId':{'type':Sequelize[_0xa17b('0x2')]},'clientSecret':{'type':Sequelize[_0xa17b('0x2')]},'serverUrl':{'type':Sequelize[_0xa17b('0x2')],'allowNull':![]},'code':{'type':Sequelize[_0xa17b('0x2')]},'refreshToken':{'type':Sequelize[_0xa17b('0x2')]}}; \ No newline at end of file +var _0x668b=['exports','STRING','sequelize'];(function(_0x50cfc3,_0x526cc6){var _0x5c11ef=function(_0xeaf96a){while(--_0xeaf96a){_0x50cfc3['push'](_0x50cfc3['shift']());}};_0x5c11ef(++_0x526cc6);}(_0x668b,0x140));var _0xb668=function(_0x45ce08,_0x59dcc7){_0x45ce08=_0x45ce08-0x0;var _0x23dff2=_0x668b[_0x45ce08];return _0x23dff2;};'use strict';var Sequelize=require(_0xb668('0x0'));module[_0xb668('0x1')]={'name':{'type':Sequelize['STRING']},'description':{'type':Sequelize[_0xb668('0x2')]},'host':{'type':Sequelize[_0xb668('0x2')]},'zone':{'type':Sequelize['STRING']},'clientId':{'type':Sequelize[_0xb668('0x2')]},'clientSecret':{'type':Sequelize['STRING']},'serverUrl':{'type':Sequelize[_0xb668('0x2')],'allowNull':![]},'code':{'type':Sequelize[_0xb668('0x2')]},'refreshToken':{'type':Sequelize[_0xb668('0x2')]}}; \ No newline at end of file diff --git a/server/api/intZohoAccount/intZohoAccount.controller.js b/server/api/intZohoAccount/intZohoAccount.controller.js index 31b75d5..12e9f32 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 _0xd4ab=['api','../../config/utils','../../config/license/util','../../mysqldb','../../components/integrations/configuration','sendStatus','status','offset','undefined','limit','set','Content-Range','json','apply','reject','save','update','then','destroy','end','stack','name','index','map','ZohoAccount','rawAttributes','fieldName','type','key','keys','intersection','query','model','fields','attributes','length','hasOwnProperty','nolimit','order','sort','where','filters','pick','merge','count','includeAll','findAll','catch','show','include','options','find','create','body','params','findOne','filter','getConfigurations','AccountId','Subjects','getSubjects','channel','getDescriptions','ZohoField','Descriptions','https://accounts.zoho.com','https://accounts.zoho.com.au','https://accounts.zoho.eu','/oauth/v2/token','clientSecret','refresh_token','access_token','host','zone','serverUrl','code','zoho.eu','com','substring','refreshToken','GET','format','https://www.zohoapis.%s/crm/v2/settings/fields','Zoho-oauthtoken\x20','response','error','message','Owner','Subject','Description','WhoId','Call_Duration','Call_Result','Call_Start_Time','Call_Type','remove','api_name','system_mandatory','push','display_label','picklist','test','statusCode','getFields','Wrong\x20credentials','eml-format','rimraf','zip-dir','request-promise','moment','util','path','sox','to-csv','ejs','fs-extra','lodash','jsforce','desk.js','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger'];(function(_0x31e29a,_0x349c9b){var _0x32d892=function(_0x41cc86){while(--_0x41cc86){_0x31e29a['push'](_0x31e29a['shift']());}};_0x32d892(++_0x349c9b);}(_0xd4ab,0x1e6));var _0xbd4a=function(_0x27a592,_0x380048){_0x27a592=_0x27a592-0x0;var _0x59ef50=_0xd4ab[_0x27a592];return _0x59ef50;};'use strict';var emlformat=require(_0xbd4a('0x0'));var rimraf=require(_0xbd4a('0x1'));var zipdir=require(_0xbd4a('0x2'));var jsonpatch=require('fast-json-patch');var rp=require(_0xbd4a('0x3'));var moment=require(_0xbd4a('0x4'));var BPromise=require('bluebird');var Mustache=require('mustache');var util=require(_0xbd4a('0x5'));var path=require(_0xbd4a('0x6'));var sox=require(_0xbd4a('0x7'));var csv=require(_0xbd4a('0x8'));var ejs=require(_0xbd4a('0x9'));var fs=require('fs');var fs_extra=require(_0xbd4a('0xa'));var _=require(_0xbd4a('0xb'));var squel=require('squel');var crypto=require('crypto');var jsforce=require(_0xbd4a('0xc'));var deskjs=require(_0xbd4a('0xd'));var toCsv=require(_0xbd4a('0x8'));var querystring=require(_0xbd4a('0xe'));var Papa=require(_0xbd4a('0xf'));var Redis=require(_0xbd4a('0x10'));var authService=require(_0xbd4a('0x11'));var qs=require(_0xbd4a('0x12'));var as=require(_0xbd4a('0x13'));var hardwareService=require(_0xbd4a('0x14'));var logger=require(_0xbd4a('0x15'))(_0xbd4a('0x16'));var utils=require(_0xbd4a('0x17'));var config=require('../../config/environment');var licenseUtil=require(_0xbd4a('0x18'));var db=require(_0xbd4a('0x19'))['db'];var integrations=require(_0xbd4a('0x1a'));function respondWithStatusCode(_0x4498e5,_0x571655){_0x571655=_0x571655||0xcc;return function(_0x1ef9bf){if(_0x1ef9bf){return _0x4498e5[_0xbd4a('0x1b')](_0x571655);}return _0x4498e5[_0xbd4a('0x1c')](_0x571655)['end']();};}function respondWithResult(_0x1d04ea,_0xdcc811){_0xdcc811=_0xdcc811||0xc8;return function(_0x44ffc0){if(_0x44ffc0){return _0x1d04ea['status'](_0xdcc811)['json'](_0x44ffc0);}};}function respondWithFilteredResult(_0x24d285,_0x2a411d){return function(_0x5d0f70){if(_0x5d0f70){var _0x173489=typeof _0x2a411d[_0xbd4a('0x1d')]===_0xbd4a('0x1e')&&typeof _0x2a411d['limit']===_0xbd4a('0x1e');var _0x533e07=_0x5d0f70['count'];var _0x599751=_0x173489?0x0:_0x2a411d[_0xbd4a('0x1d')];var _0x2d3858=_0x173489?_0x5d0f70['count']:_0x2a411d[_0xbd4a('0x1d')]+_0x2a411d[_0xbd4a('0x1f')];var _0x1a4b51;if(_0x2d3858>=_0x533e07){_0x2d3858=_0x533e07;_0x1a4b51=0xc8;}else{_0x1a4b51=0xce;}_0x24d285[_0xbd4a('0x1c')](_0x1a4b51);return _0x24d285[_0xbd4a('0x20')](_0xbd4a('0x21'),_0x599751+'-'+_0x2d3858+'/'+_0x533e07)[_0xbd4a('0x22')](_0x5d0f70);}return null;};}function patchUpdates(_0x13e01f){return function(_0x35fd42){try{jsonpatch[_0xbd4a('0x23')](_0x35fd42,_0x13e01f,!![]);}catch(_0x1c492a){return BPromise[_0xbd4a('0x24')](_0x1c492a);}return _0x35fd42[_0xbd4a('0x25')]();};}function saveUpdates(_0x22c1d6,_0x375c52){return function(_0x4a063e){if(_0x4a063e){return _0x4a063e[_0xbd4a('0x26')](_0x22c1d6)[_0xbd4a('0x27')](function(_0x8e6037){return _0x8e6037;});}return null;};}function removeEntity(_0x25ff9f,_0xe9ec8a){return function(_0x1db5c3){if(_0x1db5c3){return _0x1db5c3[_0xbd4a('0x28')]()[_0xbd4a('0x27')](function(){_0x25ff9f[_0xbd4a('0x1c')](0xcc)[_0xbd4a('0x29')]();});}};}function handleEntityNotFound(_0x3dbac3,_0x4f1fea){return function(_0x4ecf0c){if(!_0x4ecf0c){_0x3dbac3[_0xbd4a('0x1b')](0x194);}return _0x4ecf0c;};}function handleError(_0x1c7771,_0x17900e){_0x17900e=_0x17900e||0x1f4;return function(_0x41bc23){logger['error'](_0x41bc23[_0xbd4a('0x2a')]);if(_0x41bc23[_0xbd4a('0x2b')]){delete _0x41bc23[_0xbd4a('0x2b')];}_0x1c7771[_0xbd4a('0x1c')](_0x17900e)['send'](_0x41bc23);};}exports[_0xbd4a('0x2c')]=function(_0x3c46ff,_0x419ae3){var _0x311262={},_0x232464={},_0x3e95a3={'count':0x0,'rows':[]};var _0x1352ed=_[_0xbd4a('0x2d')](db[_0xbd4a('0x2e')][_0xbd4a('0x2f')],function(_0x25620d){return{'name':_0x25620d[_0xbd4a('0x30')],'type':_0x25620d[_0xbd4a('0x31')][_0xbd4a('0x32')]};});_0x232464['model']=_[_0xbd4a('0x2d')](_0x1352ed,'name');_0x232464['query']=_[_0xbd4a('0x33')](_0x3c46ff['query']);_0x232464['filters']=_[_0xbd4a('0x34')](_0x232464['model'],_0x232464[_0xbd4a('0x35')]);_0x311262['attributes']=_['intersection'](_0x232464[_0xbd4a('0x36')],qs['fields'](_0x3c46ff['query'][_0xbd4a('0x37')]));_0x311262[_0xbd4a('0x38')]=_0x311262[_0xbd4a('0x38')][_0xbd4a('0x39')]?_0x311262[_0xbd4a('0x38')]:_0x232464[_0xbd4a('0x36')];if(!_0x3c46ff[_0xbd4a('0x35')][_0xbd4a('0x3a')](_0xbd4a('0x3b'))){_0x311262['limit']=qs[_0xbd4a('0x1f')](_0x3c46ff[_0xbd4a('0x35')]['limit']);_0x311262[_0xbd4a('0x1d')]=qs[_0xbd4a('0x1d')](_0x3c46ff[_0xbd4a('0x35')][_0xbd4a('0x1d')]);}_0x311262[_0xbd4a('0x3c')]=qs[_0xbd4a('0x3d')](_0x3c46ff[_0xbd4a('0x35')]['sort']);_0x311262[_0xbd4a('0x3e')]=qs[_0xbd4a('0x3f')](_[_0xbd4a('0x40')](_0x3c46ff[_0xbd4a('0x35')],_0x232464['filters']),_0x1352ed);if(_0x3c46ff[_0xbd4a('0x35')]['filter']){_0x311262[_0xbd4a('0x3e')]=_['merge'](_0x311262['where'],{'$or':_[_0xbd4a('0x2d')](_0x1352ed,function(_0xbe093f){if(_0xbe093f[_0xbd4a('0x31')]!=='VIRTUAL'){var _0x8ec201={};_0x8ec201[_0xbe093f['name']]={'$like':'%'+_0x3c46ff['query']['filter']+'%'};return _0x8ec201;}})});}_0x311262=_[_0xbd4a('0x41')]({},_0x311262,_0x3c46ff['options']);var _0x191b45={'where':_0x311262[_0xbd4a('0x3e')]};return db[_0xbd4a('0x2e')][_0xbd4a('0x42')](_0x191b45)[_0xbd4a('0x27')](function(_0x5ec123){_0x3e95a3[_0xbd4a('0x42')]=_0x5ec123;if(_0x3c46ff[_0xbd4a('0x35')][_0xbd4a('0x43')]){_0x311262['include']=[{'all':!![]}];}return db[_0xbd4a('0x2e')][_0xbd4a('0x44')](_0x311262);})[_0xbd4a('0x27')](function(_0x3678b4){_0x3e95a3['rows']=_0x3678b4;return _0x3e95a3;})[_0xbd4a('0x27')](respondWithFilteredResult(_0x419ae3,_0x311262))[_0xbd4a('0x45')](handleError(_0x419ae3,null));};exports[_0xbd4a('0x46')]=function(_0x36d7d4,_0x53831c){var _0x83729e={'raw':![],'where':{'id':_0x36d7d4['params']['id']}},_0x4ee8a0={};_0x4ee8a0[_0xbd4a('0x36')]=_[_0xbd4a('0x33')](db['ZohoAccount'][_0xbd4a('0x2f')]);_0x4ee8a0[_0xbd4a('0x35')]=_[_0xbd4a('0x33')](_0x36d7d4[_0xbd4a('0x35')]);_0x4ee8a0[_0xbd4a('0x3f')]=_[_0xbd4a('0x34')](_0x4ee8a0[_0xbd4a('0x36')],_0x4ee8a0['query']);_0x83729e[_0xbd4a('0x38')]=_['intersection'](_0x4ee8a0[_0xbd4a('0x36')],qs[_0xbd4a('0x37')](_0x36d7d4['query'][_0xbd4a('0x37')]));_0x83729e[_0xbd4a('0x38')]=_0x83729e[_0xbd4a('0x38')]['length']?_0x83729e[_0xbd4a('0x38')]:_0x4ee8a0[_0xbd4a('0x36')];if(_0x36d7d4['query'][_0xbd4a('0x43')]){_0x83729e[_0xbd4a('0x47')]=[{'all':!![]}];}_0x83729e=_[_0xbd4a('0x41')]({},_0x83729e,_0x36d7d4[_0xbd4a('0x48')]);return db['ZohoAccount'][_0xbd4a('0x49')](_0x83729e)[_0xbd4a('0x27')](handleEntityNotFound(_0x53831c,null))['then'](respondWithResult(_0x53831c,null))[_0xbd4a('0x45')](handleError(_0x53831c,null));};exports[_0xbd4a('0x4a')]=function(_0x48ed75,_0x490035){return db['ZohoAccount']['create'](_0x48ed75[_0xbd4a('0x4b')],{})[_0xbd4a('0x27')](respondWithResult(_0x490035,0xc9))['catch'](handleError(_0x490035,null));};exports[_0xbd4a('0x26')]=function(_0x3d3ab0,_0x5799b8){if(_0x3d3ab0[_0xbd4a('0x4b')]['id']){delete _0x3d3ab0[_0xbd4a('0x4b')]['id'];}return db[_0xbd4a('0x2e')]['find']({'where':{'id':_0x3d3ab0[_0xbd4a('0x4c')]['id']}})[_0xbd4a('0x27')](handleEntityNotFound(_0x5799b8,null))['then'](saveUpdates(_0x3d3ab0[_0xbd4a('0x4b')],null))['then'](respondWithResult(_0x5799b8,null))['catch'](handleError(_0x5799b8,null));};exports[_0xbd4a('0x28')]=function(_0x514632,_0x4ef5d4){return db[_0xbd4a('0x2e')][_0xbd4a('0x49')]({'where':{'id':_0x514632[_0xbd4a('0x4c')]['id']}})['then'](handleEntityNotFound(_0x4ef5d4,null))[_0xbd4a('0x27')](removeEntity(_0x4ef5d4,null))['catch'](handleError(_0x4ef5d4,null));};exports['getConfigurations']=function(_0x5dbbb5,_0x473096,_0x47fce6){var _0x2b78d7={};var _0x35531d={};var _0x111475;var _0x29b651;return db[_0xbd4a('0x2e')][_0xbd4a('0x4d')]({'where':{'id':_0x5dbbb5['params']['id']}})[_0xbd4a('0x27')](handleEntityNotFound(_0x473096,null))[_0xbd4a('0x27')](function(_0x41cd82){if(_0x41cd82){_0x111475=_0x41cd82;_0x35531d['model']=_[_0xbd4a('0x33')](db['ZohoConfiguration'][_0xbd4a('0x2f')]);_0x35531d[_0xbd4a('0x35')]=_['keys'](_0x5dbbb5[_0xbd4a('0x35')]);_0x35531d['filters']=_[_0xbd4a('0x34')](_0x35531d[_0xbd4a('0x36')],_0x35531d[_0xbd4a('0x35')]);_0x2b78d7[_0xbd4a('0x38')]=_[_0xbd4a('0x34')](_0x35531d[_0xbd4a('0x36')],qs['fields'](_0x5dbbb5['query'][_0xbd4a('0x37')]));_0x2b78d7[_0xbd4a('0x38')]=_0x2b78d7[_0xbd4a('0x38')][_0xbd4a('0x39')]?_0x2b78d7[_0xbd4a('0x38')]:_0x35531d['model'];_0x2b78d7[_0xbd4a('0x3c')]=qs[_0xbd4a('0x3d')](_0x5dbbb5[_0xbd4a('0x35')][_0xbd4a('0x3d')]);_0x2b78d7[_0xbd4a('0x3e')]=qs[_0xbd4a('0x3f')](_[_0xbd4a('0x40')](_0x5dbbb5['query'],_0x35531d['filters']));if(_0x5dbbb5[_0xbd4a('0x35')]['filter']){_0x2b78d7[_0xbd4a('0x3e')]=_[_0xbd4a('0x41')](_0x2b78d7[_0xbd4a('0x3e')],{'$or':_[_0xbd4a('0x2d')](_0x2b78d7[_0xbd4a('0x38')],function(_0x3a9b65){var _0x19d581={};_0x19d581[_0x3a9b65]={'$like':'%'+_0x5dbbb5[_0xbd4a('0x35')][_0xbd4a('0x4e')]+'%'};return _0x19d581;})});}_0x2b78d7=_[_0xbd4a('0x41')]({},_0x2b78d7,_0x5dbbb5[_0xbd4a('0x48')]);return _0x111475[_0xbd4a('0x4f')](_0x2b78d7);}})[_0xbd4a('0x27')](function(_0x4d3577){if(_0x4d3577){_0x29b651=_0x4d3577['length'];if(!_0x5dbbb5[_0xbd4a('0x35')][_0xbd4a('0x3a')](_0xbd4a('0x3b'))){_0x2b78d7['limit']=qs[_0xbd4a('0x1f')](_0x5dbbb5[_0xbd4a('0x35')][_0xbd4a('0x1f')]);_0x2b78d7[_0xbd4a('0x1d')]=qs[_0xbd4a('0x1d')](_0x5dbbb5['query'][_0xbd4a('0x1d')]);}return _0x111475['getConfigurations'](_0x2b78d7);}})[_0xbd4a('0x27')](function(_0x40a708){if(_0x40a708){return _0x40a708?{'count':_0x29b651,'rows':_0x40a708}:null;}})[_0xbd4a('0x27')](respondWithResult(_0x473096,null))['catch'](handleError(_0x473096,null));};exports['addConfiguration']=function(_0x4a79cb,_0x3f2402,_0x553fa1){if(_0x4a79cb[_0xbd4a('0x4b')]['id']){delete _0x4a79cb[_0xbd4a('0x4b')]['id'];}return db[_0xbd4a('0x2e')][_0xbd4a('0x4d')]({'where':{'id':_0x4a79cb[_0xbd4a('0x4c')]['id']}})['then'](handleEntityNotFound(_0x3f2402,null))['then'](function(_0x192ca1){if(_0x192ca1){_0x4a79cb[_0xbd4a('0x4b')][_0xbd4a('0x50')]=_0x192ca1['id'];_0x4a79cb[_0xbd4a('0x4b')][_0xbd4a('0x51')]=integrations[_0xbd4a('0x52')](_0x4a79cb[_0xbd4a('0x4b')][_0xbd4a('0x53')],_0x4a79cb[_0xbd4a('0x4b')][_0xbd4a('0x31')]);_0x4a79cb[_0xbd4a('0x4b')]['Descriptions']=integrations[_0xbd4a('0x54')](_0x4a79cb[_0xbd4a('0x4b')][_0xbd4a('0x53')],_0x4a79cb[_0xbd4a('0x4b')][_0xbd4a('0x31')]);return db['ZohoConfiguration'][_0xbd4a('0x4a')](_0x4a79cb[_0xbd4a('0x4b')],{'include':[{'model':db[_0xbd4a('0x55')],'as':'Subjects'},{'model':db['ZohoField'],'as':_0xbd4a('0x56')}]});}return null;})[_0xbd4a('0x27')](respondWithResult(_0x3f2402,null))[_0xbd4a('0x45')](handleError(_0x3f2402,null));};function getAccessToken(_0x479c10){return new Promise(function(_0x2770b0,_0x4f61a1){var _0x2a7bb1;switch(_0x479c10['zone']){case'US':_0x2a7bb1=_0xbd4a('0x57');break;case'AU':_0x2a7bb1=_0xbd4a('0x58');break;case'EU':_0x2a7bb1=_0xbd4a('0x59');break;case'IN':_0x2a7bb1='https://accounts.zoho.in';break;case'CN':_0x2a7bb1='https://accounts.zoho.com.cn';break;default:_0x2a7bb1=_0xbd4a('0x59');break;}var _0x201204={'method':'POST','uri':_0x2a7bb1+_0xbd4a('0x5a'),'qs':{'refresh_token':_0x479c10['refreshToken'],'client_id':_0x479c10['clientId'],'client_secret':_0x479c10[_0xbd4a('0x5b')],'grant_type':_0xbd4a('0x5c')},'json':!![]};return rp(_0x201204)[_0xbd4a('0x27')](function(_0x3517c4){if(_0x3517c4[_0xbd4a('0x5d')]){_0x2770b0(_0x3517c4[_0xbd4a('0x5d')]);}else{_0x4f61a1('Unable\x20to\x20retrieve\x20the\x20access\x20token');}})[_0xbd4a('0x45')](function(_0x2b5b51){_0x4f61a1(_0x2b5b51);});});}exports['getFields']=function(_0x74bba,_0x1c538a,_0x447ee9){var _0x4794aa,_0x3a6a5e,_0x47f2ab,_0x171f91,_0x221447;return db['ZohoAccount'][_0xbd4a('0x4d')]({'where':{'id':_0x74bba[_0xbd4a('0x4c')]['id']},'attributes':['id',_0xbd4a('0x5e'),_0xbd4a('0x5f'),'clientId',_0xbd4a('0x5b'),_0xbd4a('0x60'),_0xbd4a('0x61'),'refreshToken']})[_0xbd4a('0x27')](handleEntityNotFound(_0x1c538a,null))[_0xbd4a('0x27')](function(_0x3b0287){_0x221447=_0x3b0287;_0x4794aa=_0x221447[_0xbd4a('0x5e')];_0x3a6a5e=_0x4794aa===_0xbd4a('0x62')?'eu':_0xbd4a('0x63');_0x47f2ab=_0x221447[_0xbd4a('0x60')];var _0x3e608d=_0x47f2ab['slice'](-0x1);if(_0x3e608d==='/'||_0x3e608d==='\x5c'||_0x3e608d===':'){_0x47f2ab=_0x47f2ab[_0xbd4a('0x64')](0x0,_0x47f2ab['lastIndexOf'](_0x3e608d));}if(!_0x221447[_0xbd4a('0x65')]){throw new Error('Refresh\x20Token\x20not\x20available\x20for\x20the\x20account');}return getAccessToken(_0x221447);})['then'](function(_0x306f96){if(_0x306f96){return rp({'method':_0xbd4a('0x66'),'uri':util[_0xbd4a('0x67')](_0xbd4a('0x68'),_0x3a6a5e),'qs':{'module':'Calls'},'headers':{'Authorization':_0xbd4a('0x69')+_0x306f96},'json':!![]});}})[_0xbd4a('0x27')](function(_0x4791b7){if(_0x4791b7){if(_0x4791b7['response']&&_0x4791b7[_0xbd4a('0x6a')][_0xbd4a('0x6b')]){throw new Error(_0x4791b7[_0xbd4a('0x6a')][_0xbd4a('0x6b')][_0xbd4a('0x6c')]);}var _0x39f15d=[];var _0x4459fb=[];var _0x1da15c=[_0xbd4a('0x6d'),_0xbd4a('0x6e'),_0xbd4a('0x6f'),_0xbd4a('0x70'),_0xbd4a('0x71'),_0xbd4a('0x72'),_0xbd4a('0x73'),_0xbd4a('0x74')];_0x4459fb=_[_0xbd4a('0x75')](_0x4791b7[_0xbd4a('0x37')],function(_0x1c9574){return _0x1da15c['includes'](_0x1c9574[_0xbd4a('0x76')]);});for(var _0x59bcb3=0x0;_0x59bcb3<_0x4459fb['length'];_0x59bcb3++){if(_0x4459fb[_0x59bcb3][_0xbd4a('0x77')]===![]){_0x39f15d[_0xbd4a('0x78')]({'id':_0x4459fb[_0x59bcb3]['id'],'name':_0x4459fb[_0x59bcb3][_0xbd4a('0x79')],'custom':_0x4459fb[_0x59bcb3]['custom_field'],'options':_0x4459fb[_0x59bcb3]['data_type']===_0xbd4a('0x7a')&&_0x4459fb[_0x59bcb3]['pick_list_values'][_0xbd4a('0x39')]>-0x1?_['map'](_0x4459fb[_0x59bcb3]['pick_list_values'],function(_0x39f452){return{'name':_0x39f452,'value':_0x39f452};}):[]});}}return{'count':_0x39f15d[_0xbd4a('0x39')],'rows':_0x39f15d};}else{return{'count':0x0,'rows':[]};}})[_0xbd4a('0x27')](respondWithResult(_0x1c538a,null))[_0xbd4a('0x45')](function(_0x281e67){var _0x5770f8=_0x74bba[_0xbd4a('0x35')][_0xbd4a('0x7b')]?0x1f4:_0x281e67[_0xbd4a('0x7c')]||0x1f4;logger[_0xbd4a('0x6b')]('getFields,\x20%s,\x20%s,\x20%s',_0xbd4a('0x7d'),_0x5770f8,JSON['stringify'](_0x281e67));delete _0x281e67[_0xbd4a('0x2b')];if(_0x5770f8===0x191){_0x5770f8=0x190;}_0x1c538a[_0xbd4a('0x1c')](_0x5770f8)['send'](_0x74bba['query'][_0xbd4a('0x7b')]?{'message':_0xbd4a('0x7e'),'statusCode':_0x281e67[_0xbd4a('0x7c')]}:_0x281e67);});}; \ No newline at end of file +var _0x21d6=['../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/environment','../../mysqldb','../../components/integrations/configuration','sendStatus','status','json','offset','limit','undefined','count','reject','save','update','destroy','then','end','error','name','index','ZohoAccount','rawAttributes','key','model','map','query','keys','filters','attributes','intersection','fields','length','hasOwnProperty','nolimit','sort','where','pick','VIRTUAL','filter','options','includeAll','include','findAll','rows','catch','show','params','merge','find','create','body','getConfigurations','order','Subjects','getSubjects','channel','type','Descriptions','getDescriptions','ZohoConfiguration','ZohoField','zone','https://accounts.zoho.com','https://accounts.zoho.com.au','https://accounts.zoho.eu','https://accounts.zoho.in','https://accounts.zoho.com.cn','POST','refreshToken','clientId','clientSecret','refresh_token','access_token','Unable\x20to\x20retrieve\x20the\x20access\x20token','getFields','findOne','serverUrl','code','host','zoho.eu','com','slice','lastIndexOf','Refresh\x20Token\x20not\x20available\x20for\x20the\x20account','GET','format','https://www.zohoapis.%s/crm/v2/settings/fields','Calls','Zoho-oauthtoken\x20','response','message','Owner','Subject','Description','Call_Result','Call_Type','remove','includes','api_name','data_type','pick_list_values','test','statusCode','getFields,\x20%s,\x20%s,\x20%s','stringify','send','eml-format','rimraf','zip-dir','fast-json-patch','moment','bluebird','mustache','util','path','sox','to-csv','fs-extra','lodash','crypto','jsforce','desk.js','querystring','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch'];(function(_0x415a45,_0x573871){var _0x56a63a=function(_0x4c323b){while(--_0x4c323b){_0x415a45['push'](_0x415a45['shift']());}};_0x56a63a(++_0x573871);}(_0x21d6,0xee));var _0x621d=function(_0x178e48,_0x3c9509){_0x178e48=_0x178e48-0x0;var _0x440d7e=_0x21d6[_0x178e48];return _0x440d7e;};'use strict';var emlformat=require(_0x621d('0x0'));var rimraf=require(_0x621d('0x1'));var zipdir=require(_0x621d('0x2'));var jsonpatch=require(_0x621d('0x3'));var rp=require('request-promise');var moment=require(_0x621d('0x4'));var BPromise=require(_0x621d('0x5'));var Mustache=require(_0x621d('0x6'));var util=require(_0x621d('0x7'));var path=require(_0x621d('0x8'));var sox=require(_0x621d('0x9'));var csv=require(_0x621d('0xa'));var ejs=require('ejs');var fs=require('fs');var fs_extra=require(_0x621d('0xb'));var _=require(_0x621d('0xc'));var squel=require('squel');var crypto=require(_0x621d('0xd'));var jsforce=require(_0x621d('0xe'));var deskjs=require(_0x621d('0xf'));var toCsv=require(_0x621d('0xa'));var querystring=require(_0x621d('0x10'));var Papa=require('papaparse');var Redis=require('ioredis');var authService=require(_0x621d('0x11'));var qs=require(_0x621d('0x12'));var as=require(_0x621d('0x13'));var hardwareService=require(_0x621d('0x14'));var logger=require(_0x621d('0x15'))(_0x621d('0x16'));var utils=require(_0x621d('0x17'));var config=require(_0x621d('0x18'));var licenseUtil=require('../../config/license/util');var db=require(_0x621d('0x19'))['db'];var integrations=require(_0x621d('0x1a'));function respondWithStatusCode(_0x227c11,_0x5e949f){_0x5e949f=_0x5e949f||0xcc;return function(_0x533bfb){if(_0x533bfb){return _0x227c11[_0x621d('0x1b')](_0x5e949f);}return _0x227c11['status'](_0x5e949f)['end']();};}function respondWithResult(_0x260cfa,_0x14e6de){_0x14e6de=_0x14e6de||0xc8;return function(_0x221ce9){if(_0x221ce9){return _0x260cfa[_0x621d('0x1c')](_0x14e6de)[_0x621d('0x1d')](_0x221ce9);}};}function respondWithFilteredResult(_0xd66ab3,_0x122a0f){return function(_0x5b69fa){if(_0x5b69fa){var _0x4e4fd7=typeof _0x122a0f[_0x621d('0x1e')]==='undefined'&&typeof _0x122a0f[_0x621d('0x1f')]===_0x621d('0x20');var _0x2a3db8=_0x5b69fa[_0x621d('0x21')];var _0x53d8a0=_0x4e4fd7?0x0:_0x122a0f[_0x621d('0x1e')];var _0x1a0feb=_0x4e4fd7?_0x5b69fa[_0x621d('0x21')]:_0x122a0f[_0x621d('0x1e')]+_0x122a0f[_0x621d('0x1f')];var _0x3600f2;if(_0x1a0feb>=_0x2a3db8){_0x1a0feb=_0x2a3db8;_0x3600f2=0xc8;}else{_0x3600f2=0xce;}_0xd66ab3['status'](_0x3600f2);return _0xd66ab3['set']('Content-Range',_0x53d8a0+'-'+_0x1a0feb+'/'+_0x2a3db8)[_0x621d('0x1d')](_0x5b69fa);}return null;};}function patchUpdates(_0x57775c){return function(_0x3b11ed){try{jsonpatch['apply'](_0x3b11ed,_0x57775c,!![]);}catch(_0x2bb212){return BPromise[_0x621d('0x22')](_0x2bb212);}return _0x3b11ed[_0x621d('0x23')]();};}function saveUpdates(_0x44d218,_0x163223){return function(_0x1e53da){if(_0x1e53da){return _0x1e53da[_0x621d('0x24')](_0x44d218)['then'](function(_0x29ab77){return _0x29ab77;});}return null;};}function removeEntity(_0x1a4f74,_0x1262b5){return function(_0x4af6e1){if(_0x4af6e1){return _0x4af6e1[_0x621d('0x25')]()[_0x621d('0x26')](function(){_0x1a4f74[_0x621d('0x1c')](0xcc)[_0x621d('0x27')]();});}};}function handleEntityNotFound(_0x2fba32,_0x539678){return function(_0x3f5c02){if(!_0x3f5c02){_0x2fba32[_0x621d('0x1b')](0x194);}return _0x3f5c02;};}function handleError(_0x101f98,_0x10fe42){_0x10fe42=_0x10fe42||0x1f4;return function(_0x577d1e){logger[_0x621d('0x28')](_0x577d1e['stack']);if(_0x577d1e['name']){delete _0x577d1e[_0x621d('0x29')];}_0x101f98[_0x621d('0x1c')](_0x10fe42)['send'](_0x577d1e);};}exports[_0x621d('0x2a')]=function(_0x2cf942,_0x2c74d8){var _0x5eae41={},_0x53837c={},_0xbbb4ea={'count':0x0,'rows':[]};var _0x24321d=_['map'](db[_0x621d('0x2b')][_0x621d('0x2c')],function(_0x4a9c20){return{'name':_0x4a9c20['fieldName'],'type':_0x4a9c20['type'][_0x621d('0x2d')]};});_0x53837c[_0x621d('0x2e')]=_[_0x621d('0x2f')](_0x24321d,_0x621d('0x29'));_0x53837c[_0x621d('0x30')]=_[_0x621d('0x31')](_0x2cf942[_0x621d('0x30')]);_0x53837c[_0x621d('0x32')]=_['intersection'](_0x53837c[_0x621d('0x2e')],_0x53837c['query']);_0x5eae41[_0x621d('0x33')]=_[_0x621d('0x34')](_0x53837c[_0x621d('0x2e')],qs['fields'](_0x2cf942[_0x621d('0x30')][_0x621d('0x35')]));_0x5eae41['attributes']=_0x5eae41[_0x621d('0x33')][_0x621d('0x36')]?_0x5eae41[_0x621d('0x33')]:_0x53837c[_0x621d('0x2e')];if(!_0x2cf942[_0x621d('0x30')][_0x621d('0x37')](_0x621d('0x38'))){_0x5eae41['limit']=qs[_0x621d('0x1f')](_0x2cf942[_0x621d('0x30')]['limit']);_0x5eae41['offset']=qs[_0x621d('0x1e')](_0x2cf942['query']['offset']);}_0x5eae41['order']=qs[_0x621d('0x39')](_0x2cf942[_0x621d('0x30')][_0x621d('0x39')]);_0x5eae41[_0x621d('0x3a')]=qs[_0x621d('0x32')](_[_0x621d('0x3b')](_0x2cf942['query'],_0x53837c['filters']),_0x24321d);if(_0x2cf942[_0x621d('0x30')]['filter']){_0x5eae41[_0x621d('0x3a')]=_['merge'](_0x5eae41['where'],{'$or':_[_0x621d('0x2f')](_0x24321d,function(_0x5108f8){if(_0x5108f8['type']!==_0x621d('0x3c')){var _0x27e0ff={};_0x27e0ff[_0x5108f8['name']]={'$like':'%'+_0x2cf942[_0x621d('0x30')][_0x621d('0x3d')]+'%'};return _0x27e0ff;}})});}_0x5eae41=_['merge']({},_0x5eae41,_0x2cf942[_0x621d('0x3e')]);var _0x27807a={'where':_0x5eae41[_0x621d('0x3a')]};return db['ZohoAccount'][_0x621d('0x21')](_0x27807a)[_0x621d('0x26')](function(_0x5b218f){_0xbbb4ea[_0x621d('0x21')]=_0x5b218f;if(_0x2cf942[_0x621d('0x30')][_0x621d('0x3f')]){_0x5eae41[_0x621d('0x40')]=[{'all':!![]}];}return db[_0x621d('0x2b')][_0x621d('0x41')](_0x5eae41);})[_0x621d('0x26')](function(_0x58789d){_0xbbb4ea[_0x621d('0x42')]=_0x58789d;return _0xbbb4ea;})['then'](respondWithFilteredResult(_0x2c74d8,_0x5eae41))[_0x621d('0x43')](handleError(_0x2c74d8,null));};exports[_0x621d('0x44')]=function(_0x39fd9d,_0x5fb29){var _0x570d8d={'raw':![],'where':{'id':_0x39fd9d[_0x621d('0x45')]['id']}},_0x2d1715={};_0x2d1715[_0x621d('0x2e')]=_[_0x621d('0x31')](db[_0x621d('0x2b')][_0x621d('0x2c')]);_0x2d1715['query']=_['keys'](_0x39fd9d[_0x621d('0x30')]);_0x2d1715[_0x621d('0x32')]=_['intersection'](_0x2d1715[_0x621d('0x2e')],_0x2d1715[_0x621d('0x30')]);_0x570d8d[_0x621d('0x33')]=_[_0x621d('0x34')](_0x2d1715[_0x621d('0x2e')],qs[_0x621d('0x35')](_0x39fd9d[_0x621d('0x30')]['fields']));_0x570d8d[_0x621d('0x33')]=_0x570d8d[_0x621d('0x33')][_0x621d('0x36')]?_0x570d8d[_0x621d('0x33')]:_0x2d1715[_0x621d('0x2e')];if(_0x39fd9d['query'][_0x621d('0x3f')]){_0x570d8d[_0x621d('0x40')]=[{'all':!![]}];}_0x570d8d=_[_0x621d('0x46')]({},_0x570d8d,_0x39fd9d[_0x621d('0x3e')]);return db[_0x621d('0x2b')][_0x621d('0x47')](_0x570d8d)[_0x621d('0x26')](handleEntityNotFound(_0x5fb29,null))[_0x621d('0x26')](respondWithResult(_0x5fb29,null))[_0x621d('0x43')](handleError(_0x5fb29,null));};exports[_0x621d('0x48')]=function(_0x66d970,_0x2b818d){return db['ZohoAccount']['create'](_0x66d970['body'],{})[_0x621d('0x26')](respondWithResult(_0x2b818d,0xc9))[_0x621d('0x43')](handleError(_0x2b818d,null));};exports['update']=function(_0xbf11e0,_0x1a3fbb){if(_0xbf11e0['body']['id']){delete _0xbf11e0['body']['id'];}return db[_0x621d('0x2b')][_0x621d('0x47')]({'where':{'id':_0xbf11e0[_0x621d('0x45')]['id']}})[_0x621d('0x26')](handleEntityNotFound(_0x1a3fbb,null))[_0x621d('0x26')](saveUpdates(_0xbf11e0[_0x621d('0x49')],null))[_0x621d('0x26')](respondWithResult(_0x1a3fbb,null))[_0x621d('0x43')](handleError(_0x1a3fbb,null));};exports[_0x621d('0x25')]=function(_0x315ae2,_0xc85b71){return db[_0x621d('0x2b')]['find']({'where':{'id':_0x315ae2[_0x621d('0x45')]['id']}})[_0x621d('0x26')](handleEntityNotFound(_0xc85b71,null))[_0x621d('0x26')](removeEntity(_0xc85b71,null))[_0x621d('0x43')](handleError(_0xc85b71,null));};exports[_0x621d('0x4a')]=function(_0x143d55,_0x57afed,_0x8a751c){var _0xd2aaac={};var _0x2ed0e5={};var _0x11c682;var _0x47a2e6;return db[_0x621d('0x2b')]['findOne']({'where':{'id':_0x143d55['params']['id']}})[_0x621d('0x26')](handleEntityNotFound(_0x57afed,null))['then'](function(_0x3942bc){if(_0x3942bc){_0x11c682=_0x3942bc;_0x2ed0e5[_0x621d('0x2e')]=_['keys'](db['ZohoConfiguration']['rawAttributes']);_0x2ed0e5[_0x621d('0x30')]=_[_0x621d('0x31')](_0x143d55[_0x621d('0x30')]);_0x2ed0e5['filters']=_[_0x621d('0x34')](_0x2ed0e5[_0x621d('0x2e')],_0x2ed0e5[_0x621d('0x30')]);_0xd2aaac[_0x621d('0x33')]=_[_0x621d('0x34')](_0x2ed0e5[_0x621d('0x2e')],qs[_0x621d('0x35')](_0x143d55[_0x621d('0x30')]['fields']));_0xd2aaac['attributes']=_0xd2aaac['attributes']['length']?_0xd2aaac[_0x621d('0x33')]:_0x2ed0e5['model'];_0xd2aaac[_0x621d('0x4b')]=qs[_0x621d('0x39')](_0x143d55[_0x621d('0x30')][_0x621d('0x39')]);_0xd2aaac['where']=qs[_0x621d('0x32')](_['pick'](_0x143d55[_0x621d('0x30')],_0x2ed0e5[_0x621d('0x32')]));if(_0x143d55[_0x621d('0x30')][_0x621d('0x3d')]){_0xd2aaac['where']=_[_0x621d('0x46')](_0xd2aaac[_0x621d('0x3a')],{'$or':_[_0x621d('0x2f')](_0xd2aaac[_0x621d('0x33')],function(_0x4d02ee){var _0x32f61a={};_0x32f61a[_0x4d02ee]={'$like':'%'+_0x143d55[_0x621d('0x30')][_0x621d('0x3d')]+'%'};return _0x32f61a;})});}_0xd2aaac=_['merge']({},_0xd2aaac,_0x143d55['options']);return _0x11c682[_0x621d('0x4a')](_0xd2aaac);}})['then'](function(_0x16056d){if(_0x16056d){_0x47a2e6=_0x16056d[_0x621d('0x36')];if(!_0x143d55[_0x621d('0x30')][_0x621d('0x37')]('nolimit')){_0xd2aaac['limit']=qs[_0x621d('0x1f')](_0x143d55[_0x621d('0x30')][_0x621d('0x1f')]);_0xd2aaac[_0x621d('0x1e')]=qs[_0x621d('0x1e')](_0x143d55[_0x621d('0x30')][_0x621d('0x1e')]);}return _0x11c682[_0x621d('0x4a')](_0xd2aaac);}})[_0x621d('0x26')](function(_0xa3d1d7){if(_0xa3d1d7){return _0xa3d1d7?{'count':_0x47a2e6,'rows':_0xa3d1d7}:null;}})[_0x621d('0x26')](respondWithResult(_0x57afed,null))[_0x621d('0x43')](handleError(_0x57afed,null));};exports['addConfiguration']=function(_0x1e66d4,_0x5e5da2,_0x23d7fa){if(_0x1e66d4['body']['id']){delete _0x1e66d4[_0x621d('0x49')]['id'];}return db['ZohoAccount']['findOne']({'where':{'id':_0x1e66d4[_0x621d('0x45')]['id']}})['then'](handleEntityNotFound(_0x5e5da2,null))[_0x621d('0x26')](function(_0x9ff151){if(_0x9ff151){_0x1e66d4[_0x621d('0x49')]['AccountId']=_0x9ff151['id'];_0x1e66d4[_0x621d('0x49')][_0x621d('0x4c')]=integrations[_0x621d('0x4d')](_0x1e66d4[_0x621d('0x49')][_0x621d('0x4e')],_0x1e66d4[_0x621d('0x49')][_0x621d('0x4f')]);_0x1e66d4[_0x621d('0x49')][_0x621d('0x50')]=integrations[_0x621d('0x51')](_0x1e66d4[_0x621d('0x49')][_0x621d('0x4e')],_0x1e66d4[_0x621d('0x49')][_0x621d('0x4f')]);return db[_0x621d('0x52')]['create'](_0x1e66d4[_0x621d('0x49')],{'include':[{'model':db[_0x621d('0x53')],'as':'Subjects'},{'model':db[_0x621d('0x53')],'as':_0x621d('0x50')}]});}return null;})['then'](respondWithResult(_0x5e5da2,null))[_0x621d('0x43')](handleError(_0x5e5da2,null));};function getAccessToken(_0x5207b2){return new Promise(function(_0xc61d28,_0x27ff4c){var _0xe8deff;switch(_0x5207b2[_0x621d('0x54')]){case'US':_0xe8deff=_0x621d('0x55');break;case'AU':_0xe8deff=_0x621d('0x56');break;case'EU':_0xe8deff=_0x621d('0x57');break;case'IN':_0xe8deff=_0x621d('0x58');break;case'CN':_0xe8deff=_0x621d('0x59');break;default:_0xe8deff=_0x621d('0x57');break;}var _0x19de6f={'method':_0x621d('0x5a'),'uri':_0xe8deff+'/oauth/v2/token','qs':{'refresh_token':_0x5207b2[_0x621d('0x5b')],'client_id':_0x5207b2[_0x621d('0x5c')],'client_secret':_0x5207b2[_0x621d('0x5d')],'grant_type':_0x621d('0x5e')},'json':!![]};return rp(_0x19de6f)[_0x621d('0x26')](function(_0x53e88d){if(_0x53e88d['access_token']){_0xc61d28(_0x53e88d[_0x621d('0x5f')]);}else{_0x27ff4c(_0x621d('0x60'));}})[_0x621d('0x43')](function(_0x1e512e){_0x27ff4c(_0x1e512e);});});}exports[_0x621d('0x61')]=function(_0x4c35cf,_0x3a345d,_0x3d6960){var _0x308849,_0x3d9cd3,_0x331e0e,_0x3dc473,_0x3e59b7;return db[_0x621d('0x2b')][_0x621d('0x62')]({'where':{'id':_0x4c35cf[_0x621d('0x45')]['id']},'attributes':['id','host','zone','clientId',_0x621d('0x5d'),_0x621d('0x63'),_0x621d('0x64'),_0x621d('0x5b')]})['then'](handleEntityNotFound(_0x3a345d,null))[_0x621d('0x26')](function(_0x3e6f29){_0x3e59b7=_0x3e6f29;_0x308849=_0x3e59b7[_0x621d('0x65')];_0x3d9cd3=_0x308849===_0x621d('0x66')?'eu':_0x621d('0x67');_0x331e0e=_0x3e59b7[_0x621d('0x63')];var _0x240d7d=_0x331e0e[_0x621d('0x68')](-0x1);if(_0x240d7d==='/'||_0x240d7d==='\x5c'||_0x240d7d===':'){_0x331e0e=_0x331e0e['substring'](0x0,_0x331e0e[_0x621d('0x69')](_0x240d7d));}if(!_0x3e59b7[_0x621d('0x5b')]){throw new Error(_0x621d('0x6a'));}return getAccessToken(_0x3e59b7);})[_0x621d('0x26')](function(_0x53c48b){if(_0x53c48b){return rp({'method':_0x621d('0x6b'),'uri':util[_0x621d('0x6c')](_0x621d('0x6d'),_0x3d9cd3),'qs':{'module':_0x621d('0x6e')},'headers':{'Authorization':_0x621d('0x6f')+_0x53c48b},'json':!![]});}})[_0x621d('0x26')](function(_0x1dcbd1){if(_0x1dcbd1){if(_0x1dcbd1[_0x621d('0x70')]&&_0x1dcbd1[_0x621d('0x70')][_0x621d('0x28')]){throw new Error(_0x1dcbd1['response'][_0x621d('0x28')][_0x621d('0x71')]);}var _0x2a5176=[];var _0x53f84a=[];var _0x32cd1a=[_0x621d('0x72'),_0x621d('0x73'),_0x621d('0x74'),'WhoId','Call_Duration',_0x621d('0x75'),'Call_Start_Time',_0x621d('0x76')];_0x53f84a=_[_0x621d('0x77')](_0x1dcbd1[_0x621d('0x35')],function(_0x1a93f2){return _0x32cd1a[_0x621d('0x78')](_0x1a93f2[_0x621d('0x79')]);});for(var _0x3b8b39=0x0;_0x3b8b39<_0x53f84a[_0x621d('0x36')];_0x3b8b39++){if(_0x53f84a[_0x3b8b39]['system_mandatory']===![]){_0x2a5176['push']({'id':_0x53f84a[_0x3b8b39]['id'],'name':_0x53f84a[_0x3b8b39]['display_label'],'custom':_0x53f84a[_0x3b8b39]['custom_field'],'options':_0x53f84a[_0x3b8b39][_0x621d('0x7a')]==='picklist'&&_0x53f84a[_0x3b8b39][_0x621d('0x7b')]['length']>-0x1?_[_0x621d('0x2f')](_0x53f84a[_0x3b8b39]['pick_list_values'],function(_0x31c765){return{'name':_0x31c765,'value':_0x31c765};}):[]});}}return{'count':_0x2a5176[_0x621d('0x36')],'rows':_0x2a5176};}else{return{'count':0x0,'rows':[]};}})[_0x621d('0x26')](respondWithResult(_0x3a345d,null))[_0x621d('0x43')](function(_0x87a2e3){var _0x44c0a0=_0x4c35cf[_0x621d('0x30')][_0x621d('0x7c')]?0x1f4:_0x87a2e3[_0x621d('0x7d')]||0x1f4;logger[_0x621d('0x28')](_0x621d('0x7e'),'getFields',_0x44c0a0,JSON[_0x621d('0x7f')](_0x87a2e3));delete _0x87a2e3['name'];if(_0x44c0a0===0x191){_0x44c0a0=0x190;}_0x3a345d[_0x621d('0x1c')](_0x44c0a0)[_0x621d('0x80')](_0x4c35cf['query'][_0x621d('0x7c')]?{'message':'Wrong\x20credentials','statusCode':_0x87a2e3[_0x621d('0x7d')]}:_0x87a2e3);});}; \ No newline at end of file diff --git a/server/api/intZohoAccount/intZohoAccount.model.js b/server/api/intZohoAccount/intZohoAccount.model.js index 9f93687..34fa7b5 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 _0x739e=['host','slice','substring','https://accounts.zoho.com.au','https://accounts.zoho.in','https://accounts.zoho.com.cn','https://accounts.zoho.eu','/oauth/v2/token','authorization_code','application/x-www-form-urlencoded','then','refreshToken','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','lastIndexOf','https://accounts.zoho.com','POST','parse','info','lodash','util','../../config/logger','api','request-promise','path','../../config/environment','./intZohoAccount.attributes','../../components/integrations/configuration','exports','define','int_zoho_accounts','zone','changed','serverUrl','clientId','clientSecret','code'];(function(_0x204340,_0x420056){var _0x1d22e7=function(_0x1aab6c){while(--_0x1aab6c){_0x204340['push'](_0x204340['shift']());}};_0x1d22e7(++_0x420056);}(_0x739e,0x1c7));var _0xe739=function(_0x23843b,_0x48422f){_0x23843b=_0x23843b-0x0;var _0x2b9933=_0x739e[_0x23843b];return _0x2b9933;};'use strict';var _=require(_0xe739('0x0'));var util=require(_0xe739('0x1'));var logger=require(_0xe739('0x2'))(_0xe739('0x3'));var moment=require('moment');var BPromise=require('bluebird');var rp=require(_0xe739('0x4'));var fs=require('fs');var path=require(_0xe739('0x5'));var rimraf=require('rimraf');var config=require(_0xe739('0x6'));var attributes=require(_0xe739('0x7'));var integrations=require(_0xe739('0x8'));module[_0xe739('0x9')]=function(_0x21b76a,_0x2a5e12){return _0x21b76a[_0xe739('0xa')]('ZohoAccount',attributes,{'tableName':_0xe739('0xb'),'paranoid':![],'indexes':[],'timestamps':!![],'hooks':{'beforeCreate':function(_0x1931c4,_0x193b44,_0x1bb259){if(_0x1931c4['changed'](_0xe739('0xc'))||_0x1931c4[_0xe739('0xd')](_0xe739('0xe'))||_0x1931c4[_0xe739('0xd')](_0xe739('0xf'))||_0x1931c4[_0xe739('0xd')](_0xe739('0x10'))||_0x1931c4[_0xe739('0xd')](_0xe739('0x11'))||_0x1931c4[_0xe739('0xd')](_0xe739('0x12'))){var _0x2215fa,_0x99641e;_0x2215fa=_0x1931c4[_0xe739('0xe')];var _0x11bc83=_0x2215fa[_0xe739('0x13')](-0x1);if(_0x11bc83==='/'||_0x11bc83==='\x5c'||_0x11bc83===':'){_0x2215fa=_0x2215fa[_0xe739('0x14')](0x0,_0x2215fa['lastIndexOf'](_0x11bc83));}switch(_0x1931c4[_0xe739('0xc')]){case'US':_0x99641e='https://accounts.zoho.com';break;case'AU':_0x99641e=_0xe739('0x15');break;case'IN':_0x99641e=_0xe739('0x16');break;case'CN':_0x99641e=_0xe739('0x17');break;default:_0x99641e=_0xe739('0x18');break;}var _0x28df64={'method':'POST','uri':_0x99641e+_0xe739('0x19'),'form':{'grant_type':_0xe739('0x1a'),'client_id':_0x1931c4[_0xe739('0xf')],'client_secret':_0x1931c4[_0xe739('0x10')],'redirect_uri':_0x1931c4[_0xe739('0xe')],'code':_0x1931c4[_0xe739('0x11')]},'headers':{'Content-Type':_0xe739('0x1b')}};return rp(_0x28df64)[_0xe739('0x1c')](function(_0x47ee9c){var _0x4d40ac=JSON['parse'](_0x47ee9c);if(_0x4d40ac['refresh_token']){_0x1931c4[_0xe739('0x1d')]=_0x4d40ac[_0xe739('0x1e')];logger['info'](util[_0xe739('0x1f')](_0xe739('0x20'),_0x1931c4[_0xe739('0x21')],_0x1931c4['id']));}else{logger[_0xe739('0x22')](util[_0xe739('0x1f')](_0xe739('0x23'),_0x1931c4[_0xe739('0x21')],_0x1931c4['id']),util[_0xe739('0x24')](_0x4d40ac,{'showHidden':![],'depth':null}));}return _0x1bb259(null,_0x193b44);})[_0xe739('0x25')](function(_0x2ea96d){logger[_0xe739('0x22')](util['format'](_0xe739('0x23'),_0x1931c4[_0xe739('0x21')],_0x1931c4['id']),util['inspect'](parsedResult,{'showHidden':![],'depth':null}));return _0x1bb259(_0x2ea96d);});}else{return _0x1bb259(null,_0x193b44);}},'beforeUpdate':function(_0x302efa,_0x2479b4,_0x129a6a){if(_0x302efa['changed']('zone')||_0x302efa[_0xe739('0xd')](_0xe739('0xe'))||_0x302efa[_0xe739('0xd')]('clientId')||_0x302efa[_0xe739('0xd')](_0xe739('0x10'))||_0x302efa[_0xe739('0xd')](_0xe739('0x11'))||_0x302efa[_0xe739('0xd')]('host')){var _0x263647,_0x3199e0;_0x263647=_0x302efa[_0xe739('0xe')];var _0x2316b2=_0x263647[_0xe739('0x13')](-0x1);if(_0x2316b2==='/'||_0x2316b2==='\x5c'||_0x2316b2===':'){_0x263647=_0x263647[_0xe739('0x14')](0x0,_0x263647[_0xe739('0x26')](_0x2316b2));}switch(_0x302efa['zone']){case'US':_0x3199e0=_0xe739('0x27');break;case'AU':_0x3199e0='https://accounts.zoho.com.au';break;case'IN':_0x3199e0=_0xe739('0x16');break;case'CN':_0x3199e0=_0xe739('0x17');break;default:_0x3199e0=_0xe739('0x18');break;}var _0x2baca5={'method':_0xe739('0x28'),'uri':_0x3199e0+_0xe739('0x19'),'form':{'grant_type':'authorization_code','client_id':_0x302efa['clientId'],'client_secret':_0x302efa[_0xe739('0x10')],'redirect_uri':_0x302efa['serverUrl'],'code':_0x302efa[_0xe739('0x11')]},'headers':{'Content-Type':_0xe739('0x1b')}};return rp(_0x2baca5)['then'](function(_0x386865){var _0x442a08=JSON[_0xe739('0x29')](_0x386865);if(_0x442a08['refresh_token']){_0x302efa[_0xe739('0x1d')]=_0x442a08[_0xe739('0x1e')];logger[_0xe739('0x2a')](util['format'](_0xe739('0x20'),_0x302efa[_0xe739('0x21')],_0x302efa['id']));}else{logger[_0xe739('0x22')](util[_0xe739('0x1f')](_0xe739('0x23'),_0x302efa[_0xe739('0x21')],_0x302efa['id']),util[_0xe739('0x24')](_0x442a08,{'showHidden':![],'depth':null}));}return _0x129a6a(null,_0x2479b4);})['catch'](function(_0x20e465){logger[_0xe739('0x22')](util['format'](_0xe739('0x23'),_0x302efa['name'],_0x302efa['id']),util['inspect'](parsedResult,{'showHidden':![],'depth':null}));return _0x129a6a(_0x20e465);});}else{return _0x129a6a(null,_0x2479b4);}}}});}; \ No newline at end of file +var _0x2819=['exports','define','ZohoAccount','zone','changed','serverUrl','clientSecret','code','host','slice','substring','lastIndexOf','https://accounts.zoho.com','https://accounts.zoho.com.au','https://accounts.zoho.in','https://accounts.zoho.com.cn','POST','authorization_code','clientId','application/x-www-form-urlencoded','then','parse','refreshToken','refresh_token','info','ZohoAccount,\x20Refresh\x20token\x20successfully\x20generated\x20for\x20account\x20\x22%s\x22\x20#%d','name','error','format','catch','ZohoAccount,\x20Unable\x20to\x20generate\x20the\x20refresh\x20token\x20for\x20account\x20\x22%s\x22\x20#%d','inspect','https://accounts.zoho.eu','/oauth/v2/token','../../config/logger','api','moment','bluebird','path','rimraf','../../config/environment','./intZohoAccount.attributes','../../components/integrations/configuration'];(function(_0x2b5a96,_0x436cb6){var _0x4f4a6c=function(_0x3c62bc){while(--_0x3c62bc){_0x2b5a96['push'](_0x2b5a96['shift']());}};_0x4f4a6c(++_0x436cb6);}(_0x2819,0x14f));var _0x9281=function(_0x465d81,_0xf39305){_0x465d81=_0x465d81-0x0;var _0x2eb437=_0x2819[_0x465d81];return _0x2eb437;};'use strict';var _=require('lodash');var util=require('util');var logger=require(_0x9281('0x0'))(_0x9281('0x1'));var moment=require(_0x9281('0x2'));var BPromise=require(_0x9281('0x3'));var rp=require('request-promise');var fs=require('fs');var path=require(_0x9281('0x4'));var rimraf=require(_0x9281('0x5'));var config=require(_0x9281('0x6'));var attributes=require(_0x9281('0x7'));var integrations=require(_0x9281('0x8'));module[_0x9281('0x9')]=function(_0x47f763,_0x32a121){return _0x47f763[_0x9281('0xa')](_0x9281('0xb'),attributes,{'tableName':'int_zoho_accounts','paranoid':![],'indexes':[],'timestamps':!![],'hooks':{'beforeCreate':function(_0x280d2c,_0x12c732,_0x2d5f5c){if(_0x280d2c['changed'](_0x9281('0xc'))||_0x280d2c[_0x9281('0xd')](_0x9281('0xe'))||_0x280d2c[_0x9281('0xd')]('clientId')||_0x280d2c[_0x9281('0xd')](_0x9281('0xf'))||_0x280d2c[_0x9281('0xd')](_0x9281('0x10'))||_0x280d2c[_0x9281('0xd')](_0x9281('0x11'))){var _0x26e0a5,_0x1e16b5;_0x26e0a5=_0x280d2c['serverUrl'];var _0xadb3dd=_0x26e0a5[_0x9281('0x12')](-0x1);if(_0xadb3dd==='/'||_0xadb3dd==='\x5c'||_0xadb3dd===':'){_0x26e0a5=_0x26e0a5[_0x9281('0x13')](0x0,_0x26e0a5[_0x9281('0x14')](_0xadb3dd));}switch(_0x280d2c[_0x9281('0xc')]){case'US':_0x1e16b5=_0x9281('0x15');break;case'AU':_0x1e16b5=_0x9281('0x16');break;case'IN':_0x1e16b5=_0x9281('0x17');break;case'CN':_0x1e16b5=_0x9281('0x18');break;default:_0x1e16b5='https://accounts.zoho.eu';break;}var _0xe74414={'method':_0x9281('0x19'),'uri':_0x1e16b5+'/oauth/v2/token','form':{'grant_type':_0x9281('0x1a'),'client_id':_0x280d2c[_0x9281('0x1b')],'client_secret':_0x280d2c['clientSecret'],'redirect_uri':_0x280d2c[_0x9281('0xe')],'code':_0x280d2c[_0x9281('0x10')]},'headers':{'Content-Type':_0x9281('0x1c')}};return rp(_0xe74414)[_0x9281('0x1d')](function(_0x121cd4){var _0x58bb77=JSON[_0x9281('0x1e')](_0x121cd4);if(_0x58bb77['refresh_token']){_0x280d2c[_0x9281('0x1f')]=_0x58bb77[_0x9281('0x20')];logger[_0x9281('0x21')](util['format'](_0x9281('0x22'),_0x280d2c[_0x9281('0x23')],_0x280d2c['id']));}else{logger[_0x9281('0x24')](util[_0x9281('0x25')]('ZohoAccount,\x20Unable\x20to\x20generate\x20the\x20refresh\x20token\x20for\x20account\x20\x22%s\x22\x20#%d',_0x280d2c['name'],_0x280d2c['id']),util['inspect'](_0x58bb77,{'showHidden':![],'depth':null}));}return _0x2d5f5c(null,_0x12c732);})[_0x9281('0x26')](function(_0x3bf9f0){logger[_0x9281('0x24')](util['format'](_0x9281('0x27'),_0x280d2c['name'],_0x280d2c['id']),util[_0x9281('0x28')](parsedResult,{'showHidden':![],'depth':null}));return _0x2d5f5c(_0x3bf9f0);});}else{return _0x2d5f5c(null,_0x12c732);}},'beforeUpdate':function(_0xafaa9d,_0x2396c8,_0x3adfef){if(_0xafaa9d[_0x9281('0xd')](_0x9281('0xc'))||_0xafaa9d['changed'](_0x9281('0xe'))||_0xafaa9d[_0x9281('0xd')]('clientId')||_0xafaa9d[_0x9281('0xd')](_0x9281('0xf'))||_0xafaa9d[_0x9281('0xd')](_0x9281('0x10'))||_0xafaa9d[_0x9281('0xd')](_0x9281('0x11'))){var _0x1df6b5,_0x248faf;_0x1df6b5=_0xafaa9d[_0x9281('0xe')];var _0xb7162d=_0x1df6b5[_0x9281('0x12')](-0x1);if(_0xb7162d==='/'||_0xb7162d==='\x5c'||_0xb7162d===':'){_0x1df6b5=_0x1df6b5[_0x9281('0x13')](0x0,_0x1df6b5[_0x9281('0x14')](_0xb7162d));}switch(_0xafaa9d[_0x9281('0xc')]){case'US':_0x248faf=_0x9281('0x15');break;case'AU':_0x248faf=_0x9281('0x16');break;case'IN':_0x248faf=_0x9281('0x17');break;case'CN':_0x248faf='https://accounts.zoho.com.cn';break;default:_0x248faf=_0x9281('0x29');break;}var _0x3db566={'method':'POST','uri':_0x248faf+_0x9281('0x2a'),'form':{'grant_type':'authorization_code','client_id':_0xafaa9d[_0x9281('0x1b')],'client_secret':_0xafaa9d[_0x9281('0xf')],'redirect_uri':_0xafaa9d['serverUrl'],'code':_0xafaa9d['code']},'headers':{'Content-Type':_0x9281('0x1c')}};return rp(_0x3db566)[_0x9281('0x1d')](function(_0x1b616e){var _0x510590=JSON[_0x9281('0x1e')](_0x1b616e);if(_0x510590[_0x9281('0x20')]){_0xafaa9d[_0x9281('0x1f')]=_0x510590['refresh_token'];logger[_0x9281('0x21')](util[_0x9281('0x25')]('ZohoAccount,\x20Refresh\x20token\x20successfully\x20generated\x20for\x20account\x20\x22%s\x22\x20#%d',_0xafaa9d[_0x9281('0x23')],_0xafaa9d['id']));}else{logger[_0x9281('0x24')](util[_0x9281('0x25')]('ZohoAccount,\x20Unable\x20to\x20generate\x20the\x20refresh\x20token\x20for\x20account\x20\x22%s\x22\x20#%d',_0xafaa9d['name'],_0xafaa9d['id']),util['inspect'](_0x510590,{'showHidden':![],'depth':null}));}return _0x3adfef(null,_0x2396c8);})[_0x9281('0x26')](function(_0x283305){logger[_0x9281('0x24')](util[_0x9281('0x25')](_0x9281('0x27'),_0xafaa9d[_0x9281('0x23')],_0xafaa9d['id']),util[_0x9281('0x28')](parsedResult,{'showHidden':![],'depth':null}));return _0x3adfef(_0x283305);});}else{return _0x3adfef(null,_0x2396c8);}}}});}; \ No newline at end of file diff --git a/server/api/intZohoAccount/intZohoAccount.rpc.js b/server/api/intZohoAccount/intZohoAccount.rpc.js index cc4b8d8..0a4fdd7 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 _0x19e1=['client','request','then','request\x20sent','debug','ZohoAccount,\x20%s,\x20%s,\x20%s','stringify','error','ZohoAccount,\x20%s,\x20%s','message','info','result','catch','GetZohoAccount','ZohoAccount','findAll','options','where','attributes','limit','model','map','include','find','ShowZohoAccount','lodash','util','moment','bluebird','../../mysqldb','../../config/utils','rpc','../../config/environment'];(function(_0x4847e9,_0x2eaf42){var _0x620a7d=function(_0x17a72c){while(--_0x17a72c){_0x4847e9['push'](_0x4847e9['shift']());}};_0x620a7d(++_0x2eaf42);}(_0x19e1,0x163));var _0x119e=function(_0x1e7b16,_0x4607a1){_0x1e7b16=_0x1e7b16-0x0;var _0x37fadc=_0x19e1[_0x1e7b16];return _0x37fadc;};'use strict';var _=require(_0x119e('0x0'));var util=require(_0x119e('0x1'));var moment=require(_0x119e('0x2'));var BPromise=require(_0x119e('0x3'));var rs=require('randomstring');var fs=require('fs');var Redis=require('ioredis');var db=require(_0x119e('0x4'))['db'];var utils=require(_0x119e('0x5'));var logger=require('../../config/logger')(_0x119e('0x6'));var config=require(_0x119e('0x7'));var jayson=require('jayson/promise');var client=jayson[_0x119e('0x8')]['http']({'port':0x232a});function respondWithRpcPromise(_0x1b5306,_0x25e166,_0x16a2ee){return new BPromise(function(_0x1b3797,_0x53d5b7){return client[_0x119e('0x9')](_0x1b5306,_0x16a2ee)[_0x119e('0xa')](function(_0x1a6747){logger['info']('ZohoAccount,\x20%s,\x20%s',_0x25e166,_0x119e('0xb'));logger[_0x119e('0xc')](_0x119e('0xd'),_0x25e166,_0x119e('0xb'),JSON[_0x119e('0xe')](_0x1a6747));if(_0x1a6747[_0x119e('0xf')]){if(_0x1a6747[_0x119e('0xf')]['code']===0x1f4){logger[_0x119e('0xf')](_0x119e('0x10'),_0x25e166,_0x1a6747[_0x119e('0xf')][_0x119e('0x11')]);return _0x53d5b7(_0x1a6747[_0x119e('0xf')][_0x119e('0x11')]);}logger['error'](_0x119e('0x10'),_0x25e166,_0x1a6747[_0x119e('0xf')][_0x119e('0x11')]);return _0x1b3797(_0x1a6747[_0x119e('0xf')][_0x119e('0x11')]);}else{logger[_0x119e('0x12')](_0x119e('0x10'),_0x25e166,_0x119e('0xb'));_0x1b3797(_0x1a6747[_0x119e('0x13')][_0x119e('0x11')]);}})[_0x119e('0x14')](function(_0x54c326){logger[_0x119e('0xf')](_0x119e('0x10'),_0x25e166,_0x54c326);_0x53d5b7(_0x54c326);});});}exports[_0x119e('0x15')]=function(_0xb3375c){var _0x348ae3=this;return new Promise(function(_0xedc945,_0x2848fa){return db[_0x119e('0x16')][_0x119e('0x17')]({'raw':_0xb3375c[_0x119e('0x18')]?_0xb3375c[_0x119e('0x18')]['raw']===undefined?!![]:![]:!![],'where':_0xb3375c[_0x119e('0x18')]?_0xb3375c['options'][_0x119e('0x19')]||null:null,'attributes':_0xb3375c['options']?_0xb3375c[_0x119e('0x18')][_0x119e('0x1a')]||null:null,'limit':_0xb3375c['options']?_0xb3375c['options'][_0x119e('0x1b')]||null:null,'include':_0xb3375c[_0x119e('0x18')]?_0xb3375c[_0x119e('0x18')]['include']?_['map'](_0xb3375c[_0x119e('0x18')]['include'],function(_0x1a8a24){return{'model':db[_0x1a8a24[_0x119e('0x1c')]],'as':_0x1a8a24['as'],'attributes':_0x1a8a24[_0x119e('0x1a')],'include':_0x1a8a24['include']?_[_0x119e('0x1d')](_0x1a8a24['include'],function(_0x1e2dd8){return{'model':db[_0x1e2dd8['model']],'as':_0x1e2dd8['as'],'attributes':_0x1e2dd8['attributes'],'include':_0x1e2dd8[_0x119e('0x1e')]?_[_0x119e('0x1d')](_0x1e2dd8[_0x119e('0x1e')],function(_0x2770ac){return{'model':db[_0x2770ac[_0x119e('0x1c')]],'as':_0x2770ac['as'],'attributes':_0x2770ac[_0x119e('0x1a')]};}):[]};}):[]};}):[]:[]})['then'](function(_0xc23289){logger[_0x119e('0x12')]('GetZohoAccount',_0xb3375c);logger[_0x119e('0xc')](_0x119e('0x15'),_0xb3375c,JSON['stringify'](_0xc23289));_0xedc945(_0xc23289);})[_0x119e('0x14')](function(_0x513843){logger[_0x119e('0xf')](_0x119e('0x15'),_0x513843[_0x119e('0x11')],_0xb3375c);_0x2848fa(_0x348ae3[_0x119e('0xf')](0x1f4,_0x513843[_0x119e('0x11')]));});});};exports['ShowZohoAccount']=function(_0x1853f9){var _0x51f157=this;return new Promise(function(_0x2743d9,_0x1e7205){return db[_0x119e('0x16')][_0x119e('0x1f')]({'raw':_0x1853f9['options']?_0x1853f9['options']['raw']===undefined?!![]:![]:!![],'where':_0x1853f9['options']?_0x1853f9[_0x119e('0x18')][_0x119e('0x19')]||null:null,'attributes':_0x1853f9['options']?_0x1853f9['options'][_0x119e('0x1a')]||null:null,'include':_0x1853f9[_0x119e('0x18')]?_0x1853f9['options'][_0x119e('0x1e')]?_[_0x119e('0x1d')](_0x1853f9['options'][_0x119e('0x1e')],function(_0x2a196d){return{'model':db[_0x2a196d[_0x119e('0x1c')]],'as':_0x2a196d['as'],'attributes':_0x2a196d[_0x119e('0x1a')],'include':_0x2a196d[_0x119e('0x1e')]?_[_0x119e('0x1d')](_0x2a196d[_0x119e('0x1e')],function(_0x3af549){return{'model':db[_0x3af549[_0x119e('0x1c')]],'as':_0x3af549['as'],'attributes':_0x3af549[_0x119e('0x1a')],'include':_0x3af549[_0x119e('0x1e')]?_[_0x119e('0x1d')](_0x3af549[_0x119e('0x1e')],function(_0x14e67a){return{'model':db[_0x14e67a[_0x119e('0x1c')]],'as':_0x14e67a['as'],'attributes':_0x14e67a['attributes']};}):[]};}):[]};}):[]:[]})[_0x119e('0xa')](function(_0x247826){logger[_0x119e('0x12')]('ShowZohoAccount',_0x1853f9);logger[_0x119e('0xc')](_0x119e('0x20'),_0x1853f9,JSON[_0x119e('0xe')](_0x247826));_0x2743d9(_0x247826);})[_0x119e('0x14')](function(_0x20c2bd){logger['error']('ShowZohoAccount',_0x20c2bd[_0x119e('0x11')],_0x1853f9);_0x1e7205(_0x51f157[_0x119e('0xf')](0x1f4,_0x20c2bd[_0x119e('0x11')]));});});}; \ No newline at end of file +var _0xedf1=['attributes','limit','include','map','model','catch','ShowZohoAccount','find','lodash','util','randomstring','ioredis','../../mysqldb','../../config/logger','rpc','../../config/environment','http','request','then','ZohoAccount,\x20%s,\x20%s','request\x20sent','debug','ZohoAccount,\x20%s,\x20%s,\x20%s','stringify','error','code','message','info','result','GetZohoAccount','findAll','options','raw','where'];(function(_0x2a2b4,_0xcc17b){var _0x16bec5=function(_0x5d5e08){while(--_0x5d5e08){_0x2a2b4['push'](_0x2a2b4['shift']());}};_0x16bec5(++_0xcc17b);}(_0xedf1,0xb2));var _0x1edf=function(_0x2c723a,_0x494ea4){_0x2c723a=_0x2c723a-0x0;var _0x4cea76=_0xedf1[_0x2c723a];return _0x4cea76;};'use strict';var _=require(_0x1edf('0x0'));var util=require(_0x1edf('0x1'));var moment=require('moment');var BPromise=require('bluebird');var rs=require(_0x1edf('0x2'));var fs=require('fs');var Redis=require(_0x1edf('0x3'));var db=require(_0x1edf('0x4'))['db'];var utils=require('../../config/utils');var logger=require(_0x1edf('0x5'))(_0x1edf('0x6'));var config=require(_0x1edf('0x7'));var jayson=require('jayson/promise');var client=jayson['client'][_0x1edf('0x8')]({'port':0x232a});function respondWithRpcPromise(_0x1615b2,_0x1029fe,_0x20b629){return new BPromise(function(_0x12293b,_0x206f63){return client[_0x1edf('0x9')](_0x1615b2,_0x20b629)[_0x1edf('0xa')](function(_0x30a13f){logger['info'](_0x1edf('0xb'),_0x1029fe,_0x1edf('0xc'));logger[_0x1edf('0xd')](_0x1edf('0xe'),_0x1029fe,'request\x20sent',JSON[_0x1edf('0xf')](_0x30a13f));if(_0x30a13f['error']){if(_0x30a13f[_0x1edf('0x10')][_0x1edf('0x11')]===0x1f4){logger[_0x1edf('0x10')](_0x1edf('0xb'),_0x1029fe,_0x30a13f[_0x1edf('0x10')][_0x1edf('0x12')]);return _0x206f63(_0x30a13f[_0x1edf('0x10')][_0x1edf('0x12')]);}logger[_0x1edf('0x10')]('ZohoAccount,\x20%s,\x20%s',_0x1029fe,_0x30a13f[_0x1edf('0x10')][_0x1edf('0x12')]);return _0x12293b(_0x30a13f['error'][_0x1edf('0x12')]);}else{logger[_0x1edf('0x13')](_0x1edf('0xb'),_0x1029fe,_0x1edf('0xc'));_0x12293b(_0x30a13f[_0x1edf('0x14')][_0x1edf('0x12')]);}})['catch'](function(_0x4f2584){logger[_0x1edf('0x10')](_0x1edf('0xb'),_0x1029fe,_0x4f2584);_0x206f63(_0x4f2584);});});}exports[_0x1edf('0x15')]=function(_0x280c4c){var _0x4bf06=this;return new Promise(function(_0x5e2c1c,_0x2daf2f){return db['ZohoAccount'][_0x1edf('0x16')]({'raw':_0x280c4c[_0x1edf('0x17')]?_0x280c4c[_0x1edf('0x17')][_0x1edf('0x18')]===undefined?!![]:![]:!![],'where':_0x280c4c[_0x1edf('0x17')]?_0x280c4c[_0x1edf('0x17')][_0x1edf('0x19')]||null:null,'attributes':_0x280c4c[_0x1edf('0x17')]?_0x280c4c[_0x1edf('0x17')][_0x1edf('0x1a')]||null:null,'limit':_0x280c4c[_0x1edf('0x17')]?_0x280c4c[_0x1edf('0x17')][_0x1edf('0x1b')]||null:null,'include':_0x280c4c['options']?_0x280c4c[_0x1edf('0x17')][_0x1edf('0x1c')]?_[_0x1edf('0x1d')](_0x280c4c['options'][_0x1edf('0x1c')],function(_0x44e7de){return{'model':db[_0x44e7de[_0x1edf('0x1e')]],'as':_0x44e7de['as'],'attributes':_0x44e7de[_0x1edf('0x1a')],'include':_0x44e7de[_0x1edf('0x1c')]?_[_0x1edf('0x1d')](_0x44e7de[_0x1edf('0x1c')],function(_0x2865ca){return{'model':db[_0x2865ca[_0x1edf('0x1e')]],'as':_0x2865ca['as'],'attributes':_0x2865ca[_0x1edf('0x1a')],'include':_0x2865ca[_0x1edf('0x1c')]?_[_0x1edf('0x1d')](_0x2865ca[_0x1edf('0x1c')],function(_0x532e36){return{'model':db[_0x532e36['model']],'as':_0x532e36['as'],'attributes':_0x532e36[_0x1edf('0x1a')]};}):[]};}):[]};}):[]:[]})[_0x1edf('0xa')](function(_0xd8bb8c){logger[_0x1edf('0x13')](_0x1edf('0x15'),_0x280c4c);logger[_0x1edf('0xd')](_0x1edf('0x15'),_0x280c4c,JSON[_0x1edf('0xf')](_0xd8bb8c));_0x5e2c1c(_0xd8bb8c);})[_0x1edf('0x1f')](function(_0x184d70){logger[_0x1edf('0x10')](_0x1edf('0x15'),_0x184d70[_0x1edf('0x12')],_0x280c4c);_0x2daf2f(_0x4bf06[_0x1edf('0x10')](0x1f4,_0x184d70['message']));});});};exports[_0x1edf('0x20')]=function(_0x4f7a50){var _0x942631=this;return new Promise(function(_0x2c5dec,_0x3e13c9){return db['ZohoAccount'][_0x1edf('0x21')]({'raw':_0x4f7a50['options']?_0x4f7a50[_0x1edf('0x17')][_0x1edf('0x18')]===undefined?!![]:![]:!![],'where':_0x4f7a50['options']?_0x4f7a50[_0x1edf('0x17')][_0x1edf('0x19')]||null:null,'attributes':_0x4f7a50[_0x1edf('0x17')]?_0x4f7a50[_0x1edf('0x17')][_0x1edf('0x1a')]||null:null,'include':_0x4f7a50[_0x1edf('0x17')]?_0x4f7a50[_0x1edf('0x17')][_0x1edf('0x1c')]?_[_0x1edf('0x1d')](_0x4f7a50[_0x1edf('0x17')][_0x1edf('0x1c')],function(_0x49cabe){return{'model':db[_0x49cabe[_0x1edf('0x1e')]],'as':_0x49cabe['as'],'attributes':_0x49cabe[_0x1edf('0x1a')],'include':_0x49cabe[_0x1edf('0x1c')]?_[_0x1edf('0x1d')](_0x49cabe[_0x1edf('0x1c')],function(_0x1115ad){return{'model':db[_0x1115ad[_0x1edf('0x1e')]],'as':_0x1115ad['as'],'attributes':_0x1115ad[_0x1edf('0x1a')],'include':_0x1115ad[_0x1edf('0x1c')]?_[_0x1edf('0x1d')](_0x1115ad[_0x1edf('0x1c')],function(_0x2be392){return{'model':db[_0x2be392['model']],'as':_0x2be392['as'],'attributes':_0x2be392[_0x1edf('0x1a')]};}):[]};}):[]};}):[]:[]})[_0x1edf('0xa')](function(_0x4cd819){logger['info'](_0x1edf('0x20'),_0x4f7a50);logger[_0x1edf('0xd')](_0x1edf('0x20'),_0x4f7a50,JSON[_0x1edf('0xf')](_0x4cd819));_0x2c5dec(_0x4cd819);})[_0x1edf('0x1f')](function(_0x4243cb){logger[_0x1edf('0x10')]('ShowZohoAccount',_0x4243cb[_0x1edf('0x12')],_0x4f7a50);_0x3e13c9(_0x942631[_0x1edf('0x10')](0x1f4,_0x4243cb[_0x1edf('0x12')]));});});}; \ No newline at end of file diff --git a/server/api/intZohoConfiguration/index.js b/server/api/intZohoConfiguration/index.js index 2170911..bdc348f 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 _0x5635=['delete','destroy','exports','multer','util','connect-timeout','Router','../../components/interaction/service','get','isAuthenticated','index','show','/:id/fields','getFields','getSubjects','/:id/descriptions','getDescriptions','post','create','put','/:id'];(function(_0x143df1,_0x4f841f){var _0x2df74f=function(_0x3512b2){while(--_0x3512b2){_0x143df1['push'](_0x143df1['shift']());}};_0x2df74f(++_0x4f841f);}(_0x5635,0xea));var _0x5563=function(_0x4961a3,_0x4902a4){_0x4961a3=_0x4961a3-0x0;var _0x1b552d=_0x5635[_0x4961a3];return _0x1b552d;};'use strict';var multer=require(_0x5563('0x0'));var util=require(_0x5563('0x1'));var path=require('path');var timeout=require(_0x5563('0x2'));var express=require('express');var router=express[_0x5563('0x3')]();var fs_extra=require('fs-extra');var auth=require('../../components/auth/service');var interaction=require(_0x5563('0x4'));var config=require('../../config/environment');var controller=require('./intZohoConfiguration.controller');router[_0x5563('0x5')]('/',auth[_0x5563('0x6')](),controller[_0x5563('0x7')]);router[_0x5563('0x5')]('/:id',auth[_0x5563('0x6')](),controller[_0x5563('0x8')]);router[_0x5563('0x5')](_0x5563('0x9'),auth[_0x5563('0x6')](),controller[_0x5563('0xa')]);router[_0x5563('0x5')]('/:id/subjects',auth[_0x5563('0x6')](),controller[_0x5563('0xb')]);router[_0x5563('0x5')](_0x5563('0xc'),auth['isAuthenticated'](),controller[_0x5563('0xd')]);router[_0x5563('0xe')]('/',auth[_0x5563('0x6')](),controller[_0x5563('0xf')]);router[_0x5563('0x10')](_0x5563('0x11'),auth[_0x5563('0x6')](),controller['update']);router[_0x5563('0x12')](_0x5563('0x11'),auth['isAuthenticated'](),controller[_0x5563('0x13')]);module[_0x5563('0x14')]=router; \ No newline at end of file +var _0x5848=['put','update','delete','exports','multer','connect-timeout','express','Router','../../components/auth/service','../../config/environment','get','index','/:id','isAuthenticated','show','/:id/fields','/:id/subjects','getSubjects','/:id/descriptions','getDescriptions','post','create'];(function(_0x24487f,_0x9b3ea0){var _0x456456=function(_0x2ba373){while(--_0x2ba373){_0x24487f['push'](_0x24487f['shift']());}};_0x456456(++_0x9b3ea0);}(_0x5848,0x1a6));var _0x8584=function(_0x5ecd40,_0xa56393){_0x5ecd40=_0x5ecd40-0x0;var _0x1ba255=_0x5848[_0x5ecd40];return _0x1ba255;};'use strict';var multer=require(_0x8584('0x0'));var util=require('util');var path=require('path');var timeout=require(_0x8584('0x1'));var express=require(_0x8584('0x2'));var router=express[_0x8584('0x3')]();var fs_extra=require('fs-extra');var auth=require(_0x8584('0x4'));var interaction=require('../../components/interaction/service');var config=require(_0x8584('0x5'));var controller=require('./intZohoConfiguration.controller');router[_0x8584('0x6')]('/',auth['isAuthenticated'](),controller[_0x8584('0x7')]);router[_0x8584('0x6')](_0x8584('0x8'),auth[_0x8584('0x9')](),controller[_0x8584('0xa')]);router['get'](_0x8584('0xb'),auth['isAuthenticated'](),controller['getFields']);router['get'](_0x8584('0xc'),auth[_0x8584('0x9')](),controller[_0x8584('0xd')]);router['get'](_0x8584('0xe'),auth[_0x8584('0x9')](),controller[_0x8584('0xf')]);router[_0x8584('0x10')]('/',auth[_0x8584('0x9')](),controller[_0x8584('0x11')]);router[_0x8584('0x12')](_0x8584('0x8'),auth[_0x8584('0x9')](),controller[_0x8584('0x13')]);router[_0x8584('0x14')]('/:id',auth[_0x8584('0x9')](),controller['destroy']);module[_0x8584('0x15')]=router; \ No newline at end of file diff --git a/server/api/intZohoConfiguration/intZohoConfiguration.attributes.js b/server/api/intZohoConfiguration/intZohoConfiguration.attributes.js index 5d27857..1a8175d 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 _0x545e=['nothing','ENUM','contact_lead','STRING','lead','contact'];(function(_0x6131cd,_0x4c26a1){var _0x47e916=function(_0x1f2bce){while(--_0x1f2bce){_0x6131cd['push'](_0x6131cd['shift']());}};_0x47e916(++_0x4c26a1);}(_0x545e,0x10b));var _0xe545=function(_0x455014,_0x3c6c13){_0x455014=_0x455014-0x0;var _0x2243ec=_0x545e[_0x455014];return _0x2243ec;};'use strict';var Sequelize=require('sequelize');module['exports']={'name':{'type':Sequelize[_0xe545('0x0')]},'moduleCreate':{'type':Sequelize['ENUM'](_0xe545('0x1'),_0xe545('0x2'),_0xe545('0x3')),'defaultValue':_0xe545('0x1')},'moduleSearch':{'type':Sequelize[_0xe545('0x4')](_0xe545('0x5'),'contact',_0xe545('0x1')),'defaultValue':_0xe545('0x5')},'description':{'type':Sequelize[_0xe545('0x0')]}}; \ No newline at end of file +var _0x3c17=['contact','sequelize','STRING','ENUM','lead','nothing','contact_lead'];(function(_0x37806d,_0x12bcc7){var _0x447ed7=function(_0x48d5d0){while(--_0x48d5d0){_0x37806d['push'](_0x37806d['shift']());}};_0x447ed7(++_0x12bcc7);}(_0x3c17,0xe1));var _0x73c1=function(_0x2dafbe,_0x5d04de){_0x2dafbe=_0x2dafbe-0x0;var _0x58a45a=_0x3c17[_0x2dafbe];return _0x58a45a;};'use strict';var Sequelize=require(_0x73c1('0x0'));module['exports']={'name':{'type':Sequelize[_0x73c1('0x1')]},'moduleCreate':{'type':Sequelize[_0x73c1('0x2')](_0x73c1('0x3'),'contact',_0x73c1('0x4')),'defaultValue':'lead'},'moduleSearch':{'type':Sequelize['ENUM'](_0x73c1('0x5'),_0x73c1('0x6'),_0x73c1('0x3')),'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 01bc281..25a7fa7 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 _0x2848=['set','Content-Range','apply','reject','save','update','then','destroy','error','stack','name','send','map','ZohoConfiguration','rawAttributes','fieldName','type','model','query','keys','filters','intersection','attributes','fields','hasOwnProperty','nolimit','order','sort','where','pick','filter','merge','VIRTUAL','options','includeAll','include','findAll','rows','catch','show','params','length','create','body','find','findOne','getFields','getSubjects','ZohoField','getDescriptions','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','moment','bluebird','mustache','util','path','sox','to-csv','ejs','lodash','squel','crypto','jsforce','desk.js','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','api','../../config/utils','../../config/environment','../../mysqldb','sendStatus','status','end','json','offset','undefined','count','limit'];(function(_0x4486d1,_0x1bcd94){var _0x31f3d4=function(_0x27916d){while(--_0x27916d){_0x4486d1['push'](_0x4486d1['shift']());}};_0x31f3d4(++_0x1bcd94);}(_0x2848,0x137));var _0x8284=function(_0x433542,_0x515c08){_0x433542=_0x433542-0x0;var _0x3d67e2=_0x2848[_0x433542];return _0x3d67e2;};'use strict';var emlformat=require(_0x8284('0x0'));var rimraf=require(_0x8284('0x1'));var zipdir=require(_0x8284('0x2'));var jsonpatch=require(_0x8284('0x3'));var rp=require(_0x8284('0x4'));var moment=require(_0x8284('0x5'));var BPromise=require(_0x8284('0x6'));var Mustache=require(_0x8284('0x7'));var util=require(_0x8284('0x8'));var path=require(_0x8284('0x9'));var sox=require(_0x8284('0xa'));var csv=require(_0x8284('0xb'));var ejs=require(_0x8284('0xc'));var fs=require('fs');var fs_extra=require('fs-extra');var _=require(_0x8284('0xd'));var squel=require(_0x8284('0xe'));var crypto=require(_0x8284('0xf'));var jsforce=require(_0x8284('0x10'));var deskjs=require(_0x8284('0x11'));var toCsv=require(_0x8284('0xb'));var querystring=require(_0x8284('0x12'));var Papa=require(_0x8284('0x13'));var Redis=require(_0x8284('0x14'));var authService=require(_0x8284('0x15'));var qs=require(_0x8284('0x16'));var as=require(_0x8284('0x17'));var hardwareService=require(_0x8284('0x18'));var logger=require('../../config/logger')(_0x8284('0x19'));var utils=require(_0x8284('0x1a'));var config=require(_0x8284('0x1b'));var licenseUtil=require('../../config/license/util');var db=require(_0x8284('0x1c'))['db'];function respondWithStatusCode(_0x643a90,_0x188327){_0x188327=_0x188327||0xcc;return function(_0x2a38c0){if(_0x2a38c0){return _0x643a90[_0x8284('0x1d')](_0x188327);}return _0x643a90[_0x8284('0x1e')](_0x188327)[_0x8284('0x1f')]();};}function respondWithResult(_0x70d950,_0x487281){_0x487281=_0x487281||0xc8;return function(_0x1c0556){if(_0x1c0556){return _0x70d950[_0x8284('0x1e')](_0x487281)[_0x8284('0x20')](_0x1c0556);}};}function respondWithFilteredResult(_0x450aac,_0x50a776){return function(_0x820651){if(_0x820651){var _0x4fe113=typeof _0x50a776[_0x8284('0x21')]===_0x8284('0x22')&&typeof _0x50a776['limit']==='undefined';var _0x596bf=_0x820651[_0x8284('0x23')];var _0x1d00e1=_0x4fe113?0x0:_0x50a776['offset'];var _0x1fee8b=_0x4fe113?_0x820651[_0x8284('0x23')]:_0x50a776['offset']+_0x50a776[_0x8284('0x24')];var _0x272c5c;if(_0x1fee8b>=_0x596bf){_0x1fee8b=_0x596bf;_0x272c5c=0xc8;}else{_0x272c5c=0xce;}_0x450aac[_0x8284('0x1e')](_0x272c5c);return _0x450aac[_0x8284('0x25')](_0x8284('0x26'),_0x1d00e1+'-'+_0x1fee8b+'/'+_0x596bf)[_0x8284('0x20')](_0x820651);}return null;};}function patchUpdates(_0x403a2f){return function(_0x5022f7){try{jsonpatch[_0x8284('0x27')](_0x5022f7,_0x403a2f,!![]);}catch(_0x41581b){return BPromise[_0x8284('0x28')](_0x41581b);}return _0x5022f7[_0x8284('0x29')]();};}function saveUpdates(_0x4a2578,_0x38972f){return function(_0x2a2052){if(_0x2a2052){return _0x2a2052[_0x8284('0x2a')](_0x4a2578)[_0x8284('0x2b')](function(_0x192478){return _0x192478;});}return null;};}function removeEntity(_0x2a8eee,_0x3e6e17){return function(_0x4c3d92){if(_0x4c3d92){return _0x4c3d92[_0x8284('0x2c')]()[_0x8284('0x2b')](function(){_0x2a8eee[_0x8284('0x1e')](0xcc)[_0x8284('0x1f')]();});}};}function handleEntityNotFound(_0x44d108,_0x37ba52){return function(_0x28791c){if(!_0x28791c){_0x44d108[_0x8284('0x1d')](0x194);}return _0x28791c;};}function handleError(_0x1d38eb,_0x5db3b6){_0x5db3b6=_0x5db3b6||0x1f4;return function(_0x4d6f0f){logger[_0x8284('0x2d')](_0x4d6f0f[_0x8284('0x2e')]);if(_0x4d6f0f[_0x8284('0x2f')]){delete _0x4d6f0f[_0x8284('0x2f')];}_0x1d38eb[_0x8284('0x1e')](_0x5db3b6)[_0x8284('0x30')](_0x4d6f0f);};}exports['index']=function(_0x554784,_0x23db40){var _0x4e7da8={},_0x4427df={},_0x1319a8={'count':0x0,'rows':[]};var _0x597036=_[_0x8284('0x31')](db[_0x8284('0x32')][_0x8284('0x33')],function(_0x260f92){return{'name':_0x260f92[_0x8284('0x34')],'type':_0x260f92[_0x8284('0x35')]['key']};});_0x4427df[_0x8284('0x36')]=_[_0x8284('0x31')](_0x597036,_0x8284('0x2f'));_0x4427df[_0x8284('0x37')]=_[_0x8284('0x38')](_0x554784[_0x8284('0x37')]);_0x4427df[_0x8284('0x39')]=_[_0x8284('0x3a')](_0x4427df[_0x8284('0x36')],_0x4427df[_0x8284('0x37')]);_0x4e7da8[_0x8284('0x3b')]=_[_0x8284('0x3a')](_0x4427df[_0x8284('0x36')],qs[_0x8284('0x3c')](_0x554784[_0x8284('0x37')]['fields']));_0x4e7da8['attributes']=_0x4e7da8[_0x8284('0x3b')]['length']?_0x4e7da8[_0x8284('0x3b')]:_0x4427df['model'];if(!_0x554784[_0x8284('0x37')][_0x8284('0x3d')](_0x8284('0x3e'))){_0x4e7da8['limit']=qs['limit'](_0x554784['query'][_0x8284('0x24')]);_0x4e7da8[_0x8284('0x21')]=qs['offset'](_0x554784['query'][_0x8284('0x21')]);}_0x4e7da8[_0x8284('0x3f')]=qs[_0x8284('0x40')](_0x554784['query'][_0x8284('0x40')]);_0x4e7da8[_0x8284('0x41')]=qs['filters'](_[_0x8284('0x42')](_0x554784[_0x8284('0x37')],_0x4427df[_0x8284('0x39')]),_0x597036);if(_0x554784['query'][_0x8284('0x43')]){_0x4e7da8[_0x8284('0x41')]=_[_0x8284('0x44')](_0x4e7da8[_0x8284('0x41')],{'$or':_['map'](_0x597036,function(_0x5a7c1c){if(_0x5a7c1c['type']!==_0x8284('0x45')){var _0x368a3b={};_0x368a3b[_0x5a7c1c[_0x8284('0x2f')]]={'$like':'%'+_0x554784[_0x8284('0x37')][_0x8284('0x43')]+'%'};return _0x368a3b;}})});}_0x4e7da8=_[_0x8284('0x44')]({},_0x4e7da8,_0x554784[_0x8284('0x46')]);var _0x196392={'where':_0x4e7da8[_0x8284('0x41')]};return db[_0x8284('0x32')]['count'](_0x196392)[_0x8284('0x2b')](function(_0x139390){_0x1319a8[_0x8284('0x23')]=_0x139390;if(_0x554784['query'][_0x8284('0x47')]){_0x4e7da8[_0x8284('0x48')]=[{'all':!![]}];}return db['ZohoConfiguration'][_0x8284('0x49')](_0x4e7da8);})['then'](function(_0x424ab1){_0x1319a8[_0x8284('0x4a')]=_0x424ab1;return _0x1319a8;})[_0x8284('0x2b')](respondWithFilteredResult(_0x23db40,_0x4e7da8))[_0x8284('0x4b')](handleError(_0x23db40,null));};exports[_0x8284('0x4c')]=function(_0x36351a,_0x45c823){var _0x9e49c1={'raw':![],'where':{'id':_0x36351a[_0x8284('0x4d')]['id']}},_0x5cde5a={};_0x5cde5a[_0x8284('0x36')]=_[_0x8284('0x38')](db['ZohoConfiguration'][_0x8284('0x33')]);_0x5cde5a[_0x8284('0x37')]=_[_0x8284('0x38')](_0x36351a[_0x8284('0x37')]);_0x5cde5a[_0x8284('0x39')]=_[_0x8284('0x3a')](_0x5cde5a[_0x8284('0x36')],_0x5cde5a['query']);_0x9e49c1[_0x8284('0x3b')]=_['intersection'](_0x5cde5a[_0x8284('0x36')],qs['fields'](_0x36351a['query'][_0x8284('0x3c')]));_0x9e49c1['attributes']=_0x9e49c1[_0x8284('0x3b')][_0x8284('0x4e')]?_0x9e49c1[_0x8284('0x3b')]:_0x5cde5a[_0x8284('0x36')];if(_0x36351a['query'][_0x8284('0x47')]){_0x9e49c1[_0x8284('0x48')]=[{'all':!![]}];}_0x9e49c1=_['merge']({},_0x9e49c1,_0x36351a['options']);return db[_0x8284('0x32')]['find'](_0x9e49c1)[_0x8284('0x2b')](handleEntityNotFound(_0x45c823,null))[_0x8284('0x2b')](respondWithResult(_0x45c823,null))['catch'](handleError(_0x45c823,null));};exports[_0x8284('0x4f')]=function(_0x10edbf,_0x5e8675){return db[_0x8284('0x32')][_0x8284('0x4f')](_0x10edbf['body'],{})['then'](respondWithResult(_0x5e8675,0xc9))[_0x8284('0x4b')](handleError(_0x5e8675,null));};exports[_0x8284('0x2a')]=function(_0x11652c,_0x3980c8){if(_0x11652c[_0x8284('0x50')]['id']){delete _0x11652c['body']['id'];}return db['ZohoConfiguration'][_0x8284('0x51')]({'where':{'id':_0x11652c[_0x8284('0x4d')]['id']}})[_0x8284('0x2b')](handleEntityNotFound(_0x3980c8,null))[_0x8284('0x2b')](saveUpdates(_0x11652c[_0x8284('0x50')],null))['then'](respondWithResult(_0x3980c8,null))[_0x8284('0x4b')](handleError(_0x3980c8,null));};exports[_0x8284('0x2c')]=function(_0x4739a3,_0x29a65d){return db[_0x8284('0x32')]['find']({'where':{'id':_0x4739a3[_0x8284('0x4d')]['id']}})['then'](handleEntityNotFound(_0x29a65d,null))['then'](removeEntity(_0x29a65d,null))['catch'](handleError(_0x29a65d,null));};exports['getFields']=function(_0x1a09a0,_0x12e525,_0x43d1f3){var _0x4b136e={};var _0x86f439={};var _0x430677;var _0x52377e;return db[_0x8284('0x32')][_0x8284('0x52')]({'where':{'id':_0x1a09a0[_0x8284('0x4d')]['id']}})['then'](handleEntityNotFound(_0x12e525,null))[_0x8284('0x2b')](function(_0xe9b3fb){if(_0xe9b3fb){_0x430677=_0xe9b3fb;_0x86f439[_0x8284('0x36')]=_[_0x8284('0x38')](db['ZohoField'][_0x8284('0x33')]);_0x86f439[_0x8284('0x37')]=_[_0x8284('0x38')](_0x1a09a0[_0x8284('0x37')]);_0x86f439['filters']=_[_0x8284('0x3a')](_0x86f439[_0x8284('0x36')],_0x86f439['query']);_0x4b136e[_0x8284('0x3b')]=_[_0x8284('0x3a')](_0x86f439[_0x8284('0x36')],qs[_0x8284('0x3c')](_0x1a09a0['query'][_0x8284('0x3c')]));_0x4b136e[_0x8284('0x3b')]=_0x4b136e[_0x8284('0x3b')]['length']?_0x4b136e[_0x8284('0x3b')]:_0x86f439[_0x8284('0x36')];_0x4b136e[_0x8284('0x3f')]=qs[_0x8284('0x40')](_0x1a09a0[_0x8284('0x37')][_0x8284('0x40')]);_0x4b136e[_0x8284('0x41')]=qs['filters'](_[_0x8284('0x42')](_0x1a09a0['query'],_0x86f439[_0x8284('0x39')]));if(_0x1a09a0[_0x8284('0x37')][_0x8284('0x43')]){_0x4b136e[_0x8284('0x41')]=_[_0x8284('0x44')](_0x4b136e[_0x8284('0x41')],{'$or':_['map'](_0x4b136e['attributes'],function(_0x44bf14){var _0x5c3325={};_0x5c3325[_0x44bf14]={'$like':'%'+_0x1a09a0[_0x8284('0x37')][_0x8284('0x43')]+'%'};return _0x5c3325;})});}_0x4b136e=_[_0x8284('0x44')]({},_0x4b136e,_0x1a09a0['options']);return _0x430677[_0x8284('0x53')](_0x4b136e);}})[_0x8284('0x2b')](function(_0x3e432e){if(_0x3e432e){_0x52377e=_0x3e432e[_0x8284('0x4e')];if(!_0x1a09a0[_0x8284('0x37')]['hasOwnProperty'](_0x8284('0x3e'))){_0x4b136e[_0x8284('0x24')]=qs[_0x8284('0x24')](_0x1a09a0['query'][_0x8284('0x24')]);_0x4b136e[_0x8284('0x21')]=qs[_0x8284('0x21')](_0x1a09a0[_0x8284('0x37')][_0x8284('0x21')]);}return _0x430677['getFields'](_0x4b136e);}})[_0x8284('0x2b')](function(_0x3f5c42){if(_0x3f5c42){return _0x3f5c42?{'count':_0x52377e,'rows':_0x3f5c42}:null;}})[_0x8284('0x2b')](respondWithResult(_0x12e525,null))[_0x8284('0x4b')](handleError(_0x12e525,null));};exports[_0x8284('0x54')]=function(_0x445034,_0x1af35b,_0x42b424){var _0x284ac5={};var _0x1c9515={};var _0x3975df;var _0x187877;return db[_0x8284('0x32')][_0x8284('0x52')]({'where':{'id':_0x445034[_0x8284('0x4d')]['id']}})['then'](handleEntityNotFound(_0x1af35b,null))[_0x8284('0x2b')](function(_0x1016b8){if(_0x1016b8){_0x3975df=_0x1016b8;_0x1c9515[_0x8284('0x36')]=_['keys'](db[_0x8284('0x55')][_0x8284('0x33')]);_0x1c9515[_0x8284('0x37')]=_[_0x8284('0x38')](_0x445034['query']);_0x1c9515[_0x8284('0x39')]=_[_0x8284('0x3a')](_0x1c9515[_0x8284('0x36')],_0x1c9515[_0x8284('0x37')]);_0x284ac5[_0x8284('0x3b')]=_['intersection'](_0x1c9515[_0x8284('0x36')],qs[_0x8284('0x3c')](_0x445034[_0x8284('0x37')][_0x8284('0x3c')]));_0x284ac5[_0x8284('0x3b')]=_0x284ac5[_0x8284('0x3b')][_0x8284('0x4e')]?_0x284ac5[_0x8284('0x3b')]:_0x1c9515[_0x8284('0x36')];_0x284ac5[_0x8284('0x3f')]=qs[_0x8284('0x40')](_0x445034['query'][_0x8284('0x40')]);_0x284ac5[_0x8284('0x41')]=qs['filters'](_[_0x8284('0x42')](_0x445034[_0x8284('0x37')],_0x1c9515[_0x8284('0x39')]));if(_0x445034[_0x8284('0x37')]['filter']){_0x284ac5[_0x8284('0x41')]=_[_0x8284('0x44')](_0x284ac5[_0x8284('0x41')],{'$or':_[_0x8284('0x31')](_0x284ac5[_0x8284('0x3b')],function(_0x1358f2){var _0xe76d82={};_0xe76d82[_0x1358f2]={'$like':'%'+_0x445034[_0x8284('0x37')][_0x8284('0x43')]+'%'};return _0xe76d82;})});}_0x284ac5=_[_0x8284('0x44')]({},_0x284ac5,_0x445034[_0x8284('0x46')]);return _0x3975df[_0x8284('0x54')](_0x284ac5);}})['then'](function(_0x1e6ee1){if(_0x1e6ee1){_0x187877=_0x1e6ee1[_0x8284('0x4e')];if(!_0x445034[_0x8284('0x37')][_0x8284('0x3d')](_0x8284('0x3e'))){_0x284ac5[_0x8284('0x24')]=qs[_0x8284('0x24')](_0x445034[_0x8284('0x37')]['limit']);_0x284ac5['offset']=qs[_0x8284('0x21')](_0x445034[_0x8284('0x37')][_0x8284('0x21')]);}return _0x3975df[_0x8284('0x54')](_0x284ac5);}})[_0x8284('0x2b')](function(_0x580386){if(_0x580386){return _0x580386?{'count':_0x187877,'rows':_0x580386}:null;}})[_0x8284('0x2b')](respondWithResult(_0x1af35b,null))[_0x8284('0x4b')](handleError(_0x1af35b,null));};exports[_0x8284('0x56')]=function(_0x4cceaf,_0x5b09bb,_0x317103){var _0x2124dc={};var _0x52eef5={};var _0x2ca4d3;var _0x423110;return db[_0x8284('0x32')][_0x8284('0x52')]({'where':{'id':_0x4cceaf[_0x8284('0x4d')]['id']}})[_0x8284('0x2b')](handleEntityNotFound(_0x5b09bb,null))[_0x8284('0x2b')](function(_0x3be5d4){if(_0x3be5d4){_0x2ca4d3=_0x3be5d4;_0x52eef5[_0x8284('0x36')]=_[_0x8284('0x38')](db[_0x8284('0x55')][_0x8284('0x33')]);_0x52eef5[_0x8284('0x37')]=_['keys'](_0x4cceaf[_0x8284('0x37')]);_0x52eef5[_0x8284('0x39')]=_[_0x8284('0x3a')](_0x52eef5[_0x8284('0x36')],_0x52eef5[_0x8284('0x37')]);_0x2124dc[_0x8284('0x3b')]=_[_0x8284('0x3a')](_0x52eef5[_0x8284('0x36')],qs[_0x8284('0x3c')](_0x4cceaf['query']['fields']));_0x2124dc[_0x8284('0x3b')]=_0x2124dc['attributes'][_0x8284('0x4e')]?_0x2124dc[_0x8284('0x3b')]:_0x52eef5[_0x8284('0x36')];_0x2124dc[_0x8284('0x3f')]=qs[_0x8284('0x40')](_0x4cceaf[_0x8284('0x37')][_0x8284('0x40')]);_0x2124dc[_0x8284('0x41')]=qs[_0x8284('0x39')](_[_0x8284('0x42')](_0x4cceaf[_0x8284('0x37')],_0x52eef5[_0x8284('0x39')]));if(_0x4cceaf[_0x8284('0x37')]['filter']){_0x2124dc['where']=_[_0x8284('0x44')](_0x2124dc[_0x8284('0x41')],{'$or':_[_0x8284('0x31')](_0x2124dc[_0x8284('0x3b')],function(_0x55acba){var _0x2eb47b={};_0x2eb47b[_0x55acba]={'$like':'%'+_0x4cceaf[_0x8284('0x37')][_0x8284('0x43')]+'%'};return _0x2eb47b;})});}_0x2124dc=_['merge']({},_0x2124dc,_0x4cceaf['options']);return _0x2ca4d3[_0x8284('0x56')](_0x2124dc);}})[_0x8284('0x2b')](function(_0x4e4d4f){if(_0x4e4d4f){_0x423110=_0x4e4d4f['length'];if(!_0x4cceaf[_0x8284('0x37')]['hasOwnProperty'](_0x8284('0x3e'))){_0x2124dc[_0x8284('0x24')]=qs['limit'](_0x4cceaf[_0x8284('0x37')][_0x8284('0x24')]);_0x2124dc[_0x8284('0x21')]=qs['offset'](_0x4cceaf[_0x8284('0x37')][_0x8284('0x21')]);}return _0x2ca4d3['getDescriptions'](_0x2124dc);}})[_0x8284('0x2b')](function(_0x4c1388){if(_0x4c1388){return _0x4c1388?{'count':_0x423110,'rows':_0x4c1388}:null;}})[_0x8284('0x2b')](respondWithResult(_0x5b09bb,null))[_0x8284('0x4b')](handleError(_0x5b09bb,null));}; \ No newline at end of file +var _0xd827=['bluebird','mustache','util','path','to-csv','ejs','squel','crypto','jsforce','desk.js','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/environment','../../mysqldb','sendStatus','end','status','json','offset','undefined','count','limit','Content-Range','reject','save','update','then','destroy','error','stack','name','send','index','map','rawAttributes','fieldName','key','model','query','filters','intersection','attributes','fields','hasOwnProperty','nolimit','where','pick','filter','merge','type','VIRTUAL','options','ZohoConfiguration','includeAll','include','catch','show','params','keys','length','create','body','find','findOne','sort','getFields','ZohoField','order','getSubjects','getDescriptions','zip-dir','fast-json-patch','request-promise','moment'];(function(_0x3dd15e,_0x1f0015){var _0x231fd0=function(_0x4f680a){while(--_0x4f680a){_0x3dd15e['push'](_0x3dd15e['shift']());}};_0x231fd0(++_0x1f0015);}(_0xd827,0x191));var _0x7d82=function(_0x280221,_0x2d0576){_0x280221=_0x280221-0x0;var _0x11abd3=_0xd827[_0x280221];return _0x11abd3;};'use strict';var emlformat=require('eml-format');var rimraf=require('rimraf');var zipdir=require(_0x7d82('0x0'));var jsonpatch=require(_0x7d82('0x1'));var rp=require(_0x7d82('0x2'));var moment=require(_0x7d82('0x3'));var BPromise=require(_0x7d82('0x4'));var Mustache=require(_0x7d82('0x5'));var util=require(_0x7d82('0x6'));var path=require(_0x7d82('0x7'));var sox=require('sox');var csv=require(_0x7d82('0x8'));var ejs=require(_0x7d82('0x9'));var fs=require('fs');var fs_extra=require('fs-extra');var _=require('lodash');var squel=require(_0x7d82('0xa'));var crypto=require(_0x7d82('0xb'));var jsforce=require(_0x7d82('0xc'));var deskjs=require(_0x7d82('0xd'));var toCsv=require(_0x7d82('0x8'));var querystring=require(_0x7d82('0xe'));var Papa=require(_0x7d82('0xf'));var Redis=require(_0x7d82('0x10'));var authService=require(_0x7d82('0x11'));var qs=require(_0x7d82('0x12'));var as=require('../../components/parsers/advancedSearch');var hardwareService=require(_0x7d82('0x13'));var logger=require(_0x7d82('0x14'))(_0x7d82('0x15'));var utils=require(_0x7d82('0x16'));var config=require(_0x7d82('0x17'));var licenseUtil=require('../../config/license/util');var db=require(_0x7d82('0x18'))['db'];function respondWithStatusCode(_0x1f7459,_0x4fcd54){_0x4fcd54=_0x4fcd54||0xcc;return function(_0x433277){if(_0x433277){return _0x1f7459[_0x7d82('0x19')](_0x4fcd54);}return _0x1f7459['status'](_0x4fcd54)[_0x7d82('0x1a')]();};}function respondWithResult(_0x84971e,_0x337b7f){_0x337b7f=_0x337b7f||0xc8;return function(_0x1dd0de){if(_0x1dd0de){return _0x84971e[_0x7d82('0x1b')](_0x337b7f)[_0x7d82('0x1c')](_0x1dd0de);}};}function respondWithFilteredResult(_0x51c6ca,_0x183008){return function(_0x2f6d81){if(_0x2f6d81){var _0x412725=typeof _0x183008[_0x7d82('0x1d')]===_0x7d82('0x1e')&&typeof _0x183008['limit']==='undefined';var _0x58f826=_0x2f6d81[_0x7d82('0x1f')];var _0x28587e=_0x412725?0x0:_0x183008[_0x7d82('0x1d')];var _0x598f2d=_0x412725?_0x2f6d81[_0x7d82('0x1f')]:_0x183008[_0x7d82('0x1d')]+_0x183008[_0x7d82('0x20')];var _0x48b769;if(_0x598f2d>=_0x58f826){_0x598f2d=_0x58f826;_0x48b769=0xc8;}else{_0x48b769=0xce;}_0x51c6ca['status'](_0x48b769);return _0x51c6ca['set'](_0x7d82('0x21'),_0x28587e+'-'+_0x598f2d+'/'+_0x58f826)[_0x7d82('0x1c')](_0x2f6d81);}return null;};}function patchUpdates(_0x37d55d){return function(_0x4b743c){try{jsonpatch['apply'](_0x4b743c,_0x37d55d,!![]);}catch(_0x2b9951){return BPromise[_0x7d82('0x22')](_0x2b9951);}return _0x4b743c[_0x7d82('0x23')]();};}function saveUpdates(_0x2c712b,_0x7725db){return function(_0x47fecb){if(_0x47fecb){return _0x47fecb[_0x7d82('0x24')](_0x2c712b)[_0x7d82('0x25')](function(_0x4d8745){return _0x4d8745;});}return null;};}function removeEntity(_0x1763be,_0x5bee57){return function(_0x487b3c){if(_0x487b3c){return _0x487b3c[_0x7d82('0x26')]()[_0x7d82('0x25')](function(){_0x1763be['status'](0xcc)[_0x7d82('0x1a')]();});}};}function handleEntityNotFound(_0x240065,_0x15922f){return function(_0x342b5a){if(!_0x342b5a){_0x240065[_0x7d82('0x19')](0x194);}return _0x342b5a;};}function handleError(_0x1e079d,_0x13c183){_0x13c183=_0x13c183||0x1f4;return function(_0xd596d3){logger[_0x7d82('0x27')](_0xd596d3[_0x7d82('0x28')]);if(_0xd596d3[_0x7d82('0x29')]){delete _0xd596d3[_0x7d82('0x29')];}_0x1e079d[_0x7d82('0x1b')](_0x13c183)[_0x7d82('0x2a')](_0xd596d3);};}exports[_0x7d82('0x2b')]=function(_0x2b9f29,_0x24cf36){var _0x5eef17={},_0x256adb={},_0x2747ab={'count':0x0,'rows':[]};var _0x10980b=_[_0x7d82('0x2c')](db['ZohoConfiguration'][_0x7d82('0x2d')],function(_0xd27ef7){return{'name':_0xd27ef7[_0x7d82('0x2e')],'type':_0xd27ef7['type'][_0x7d82('0x2f')]};});_0x256adb[_0x7d82('0x30')]=_[_0x7d82('0x2c')](_0x10980b,_0x7d82('0x29'));_0x256adb['query']=_['keys'](_0x2b9f29[_0x7d82('0x31')]);_0x256adb[_0x7d82('0x32')]=_[_0x7d82('0x33')](_0x256adb[_0x7d82('0x30')],_0x256adb['query']);_0x5eef17[_0x7d82('0x34')]=_[_0x7d82('0x33')](_0x256adb[_0x7d82('0x30')],qs['fields'](_0x2b9f29[_0x7d82('0x31')][_0x7d82('0x35')]));_0x5eef17[_0x7d82('0x34')]=_0x5eef17[_0x7d82('0x34')]['length']?_0x5eef17[_0x7d82('0x34')]:_0x256adb['model'];if(!_0x2b9f29['query'][_0x7d82('0x36')](_0x7d82('0x37'))){_0x5eef17[_0x7d82('0x20')]=qs[_0x7d82('0x20')](_0x2b9f29[_0x7d82('0x31')][_0x7d82('0x20')]);_0x5eef17[_0x7d82('0x1d')]=qs[_0x7d82('0x1d')](_0x2b9f29[_0x7d82('0x31')][_0x7d82('0x1d')]);}_0x5eef17['order']=qs['sort'](_0x2b9f29[_0x7d82('0x31')]['sort']);_0x5eef17[_0x7d82('0x38')]=qs[_0x7d82('0x32')](_[_0x7d82('0x39')](_0x2b9f29[_0x7d82('0x31')],_0x256adb[_0x7d82('0x32')]),_0x10980b);if(_0x2b9f29['query'][_0x7d82('0x3a')]){_0x5eef17[_0x7d82('0x38')]=_[_0x7d82('0x3b')](_0x5eef17[_0x7d82('0x38')],{'$or':_[_0x7d82('0x2c')](_0x10980b,function(_0x43e01e){if(_0x43e01e[_0x7d82('0x3c')]!==_0x7d82('0x3d')){var _0x48e468={};_0x48e468[_0x43e01e[_0x7d82('0x29')]]={'$like':'%'+_0x2b9f29[_0x7d82('0x31')][_0x7d82('0x3a')]+'%'};return _0x48e468;}})});}_0x5eef17=_[_0x7d82('0x3b')]({},_0x5eef17,_0x2b9f29[_0x7d82('0x3e')]);var _0x255c1c={'where':_0x5eef17[_0x7d82('0x38')]};return db[_0x7d82('0x3f')][_0x7d82('0x1f')](_0x255c1c)[_0x7d82('0x25')](function(_0x1e50f5){_0x2747ab[_0x7d82('0x1f')]=_0x1e50f5;if(_0x2b9f29['query'][_0x7d82('0x40')]){_0x5eef17[_0x7d82('0x41')]=[{'all':!![]}];}return db[_0x7d82('0x3f')]['findAll'](_0x5eef17);})[_0x7d82('0x25')](function(_0x2ffda0){_0x2747ab['rows']=_0x2ffda0;return _0x2747ab;})[_0x7d82('0x25')](respondWithFilteredResult(_0x24cf36,_0x5eef17))[_0x7d82('0x42')](handleError(_0x24cf36,null));};exports[_0x7d82('0x43')]=function(_0x132802,_0x3ac87a){var _0x44686b={'raw':![],'where':{'id':_0x132802[_0x7d82('0x44')]['id']}},_0x3da435={};_0x3da435[_0x7d82('0x30')]=_[_0x7d82('0x45')](db[_0x7d82('0x3f')][_0x7d82('0x2d')]);_0x3da435[_0x7d82('0x31')]=_['keys'](_0x132802[_0x7d82('0x31')]);_0x3da435['filters']=_[_0x7d82('0x33')](_0x3da435[_0x7d82('0x30')],_0x3da435[_0x7d82('0x31')]);_0x44686b[_0x7d82('0x34')]=_[_0x7d82('0x33')](_0x3da435[_0x7d82('0x30')],qs[_0x7d82('0x35')](_0x132802['query'][_0x7d82('0x35')]));_0x44686b['attributes']=_0x44686b[_0x7d82('0x34')][_0x7d82('0x46')]?_0x44686b[_0x7d82('0x34')]:_0x3da435[_0x7d82('0x30')];if(_0x132802[_0x7d82('0x31')]['includeAll']){_0x44686b['include']=[{'all':!![]}];}_0x44686b=_[_0x7d82('0x3b')]({},_0x44686b,_0x132802[_0x7d82('0x3e')]);return db[_0x7d82('0x3f')]['find'](_0x44686b)[_0x7d82('0x25')](handleEntityNotFound(_0x3ac87a,null))[_0x7d82('0x25')](respondWithResult(_0x3ac87a,null))['catch'](handleError(_0x3ac87a,null));};exports[_0x7d82('0x47')]=function(_0x549670,_0x18eebc){return db[_0x7d82('0x3f')]['create'](_0x549670[_0x7d82('0x48')],{})['then'](respondWithResult(_0x18eebc,0xc9))[_0x7d82('0x42')](handleError(_0x18eebc,null));};exports[_0x7d82('0x24')]=function(_0x269545,_0x1ed672){if(_0x269545[_0x7d82('0x48')]['id']){delete _0x269545[_0x7d82('0x48')]['id'];}return db[_0x7d82('0x3f')][_0x7d82('0x49')]({'where':{'id':_0x269545[_0x7d82('0x44')]['id']}})[_0x7d82('0x25')](handleEntityNotFound(_0x1ed672,null))[_0x7d82('0x25')](saveUpdates(_0x269545[_0x7d82('0x48')],null))[_0x7d82('0x25')](respondWithResult(_0x1ed672,null))['catch'](handleError(_0x1ed672,null));};exports[_0x7d82('0x26')]=function(_0x35fd75,_0x35ee8d){return db[_0x7d82('0x3f')][_0x7d82('0x49')]({'where':{'id':_0x35fd75[_0x7d82('0x44')]['id']}})[_0x7d82('0x25')](handleEntityNotFound(_0x35ee8d,null))['then'](removeEntity(_0x35ee8d,null))[_0x7d82('0x42')](handleError(_0x35ee8d,null));};exports['getFields']=function(_0x1d7c2c,_0x4863ab,_0x18491d){var _0x3153fa={};var _0x36c1e3={};var _0x44a680;var _0x4d3dd1;return db[_0x7d82('0x3f')][_0x7d82('0x4a')]({'where':{'id':_0x1d7c2c['params']['id']}})[_0x7d82('0x25')](handleEntityNotFound(_0x4863ab,null))['then'](function(_0x41d3f0){if(_0x41d3f0){_0x44a680=_0x41d3f0;_0x36c1e3[_0x7d82('0x30')]=_['keys'](db['ZohoField']['rawAttributes']);_0x36c1e3['query']=_[_0x7d82('0x45')](_0x1d7c2c[_0x7d82('0x31')]);_0x36c1e3[_0x7d82('0x32')]=_[_0x7d82('0x33')](_0x36c1e3[_0x7d82('0x30')],_0x36c1e3[_0x7d82('0x31')]);_0x3153fa['attributes']=_['intersection'](_0x36c1e3[_0x7d82('0x30')],qs[_0x7d82('0x35')](_0x1d7c2c[_0x7d82('0x31')][_0x7d82('0x35')]));_0x3153fa[_0x7d82('0x34')]=_0x3153fa[_0x7d82('0x34')][_0x7d82('0x46')]?_0x3153fa[_0x7d82('0x34')]:_0x36c1e3[_0x7d82('0x30')];_0x3153fa['order']=qs[_0x7d82('0x4b')](_0x1d7c2c[_0x7d82('0x31')][_0x7d82('0x4b')]);_0x3153fa[_0x7d82('0x38')]=qs['filters'](_['pick'](_0x1d7c2c[_0x7d82('0x31')],_0x36c1e3[_0x7d82('0x32')]));if(_0x1d7c2c['query'][_0x7d82('0x3a')]){_0x3153fa[_0x7d82('0x38')]=_[_0x7d82('0x3b')](_0x3153fa[_0x7d82('0x38')],{'$or':_[_0x7d82('0x2c')](_0x3153fa['attributes'],function(_0x1ec98b){var _0x17b72f={};_0x17b72f[_0x1ec98b]={'$like':'%'+_0x1d7c2c[_0x7d82('0x31')][_0x7d82('0x3a')]+'%'};return _0x17b72f;})});}_0x3153fa=_['merge']({},_0x3153fa,_0x1d7c2c[_0x7d82('0x3e')]);return _0x44a680[_0x7d82('0x4c')](_0x3153fa);}})['then'](function(_0xae488a){if(_0xae488a){_0x4d3dd1=_0xae488a[_0x7d82('0x46')];if(!_0x1d7c2c[_0x7d82('0x31')]['hasOwnProperty'](_0x7d82('0x37'))){_0x3153fa[_0x7d82('0x20')]=qs[_0x7d82('0x20')](_0x1d7c2c[_0x7d82('0x31')]['limit']);_0x3153fa[_0x7d82('0x1d')]=qs[_0x7d82('0x1d')](_0x1d7c2c['query'][_0x7d82('0x1d')]);}return _0x44a680[_0x7d82('0x4c')](_0x3153fa);}})[_0x7d82('0x25')](function(_0x2bb5e6){if(_0x2bb5e6){return _0x2bb5e6?{'count':_0x4d3dd1,'rows':_0x2bb5e6}:null;}})['then'](respondWithResult(_0x4863ab,null))[_0x7d82('0x42')](handleError(_0x4863ab,null));};exports['getSubjects']=function(_0x3afb60,_0x23a3ac,_0x5b1700){var _0x243255={};var _0x19ce6b={};var _0x1c50ec;var _0x59f021;return db['ZohoConfiguration']['findOne']({'where':{'id':_0x3afb60[_0x7d82('0x44')]['id']}})[_0x7d82('0x25')](handleEntityNotFound(_0x23a3ac,null))[_0x7d82('0x25')](function(_0x528e5d){if(_0x528e5d){_0x1c50ec=_0x528e5d;_0x19ce6b[_0x7d82('0x30')]=_['keys'](db[_0x7d82('0x4d')][_0x7d82('0x2d')]);_0x19ce6b[_0x7d82('0x31')]=_['keys'](_0x3afb60[_0x7d82('0x31')]);_0x19ce6b[_0x7d82('0x32')]=_[_0x7d82('0x33')](_0x19ce6b[_0x7d82('0x30')],_0x19ce6b[_0x7d82('0x31')]);_0x243255[_0x7d82('0x34')]=_[_0x7d82('0x33')](_0x19ce6b[_0x7d82('0x30')],qs[_0x7d82('0x35')](_0x3afb60[_0x7d82('0x31')]['fields']));_0x243255['attributes']=_0x243255[_0x7d82('0x34')][_0x7d82('0x46')]?_0x243255[_0x7d82('0x34')]:_0x19ce6b[_0x7d82('0x30')];_0x243255[_0x7d82('0x4e')]=qs[_0x7d82('0x4b')](_0x3afb60[_0x7d82('0x31')]['sort']);_0x243255[_0x7d82('0x38')]=qs['filters'](_[_0x7d82('0x39')](_0x3afb60[_0x7d82('0x31')],_0x19ce6b['filters']));if(_0x3afb60[_0x7d82('0x31')][_0x7d82('0x3a')]){_0x243255['where']=_[_0x7d82('0x3b')](_0x243255['where'],{'$or':_[_0x7d82('0x2c')](_0x243255[_0x7d82('0x34')],function(_0x5bddc5){var _0x55d82b={};_0x55d82b[_0x5bddc5]={'$like':'%'+_0x3afb60['query']['filter']+'%'};return _0x55d82b;})});}_0x243255=_[_0x7d82('0x3b')]({},_0x243255,_0x3afb60[_0x7d82('0x3e')]);return _0x1c50ec[_0x7d82('0x4f')](_0x243255);}})[_0x7d82('0x25')](function(_0x512359){if(_0x512359){_0x59f021=_0x512359['length'];if(!_0x3afb60[_0x7d82('0x31')][_0x7d82('0x36')](_0x7d82('0x37'))){_0x243255[_0x7d82('0x20')]=qs[_0x7d82('0x20')](_0x3afb60[_0x7d82('0x31')]['limit']);_0x243255[_0x7d82('0x1d')]=qs[_0x7d82('0x1d')](_0x3afb60[_0x7d82('0x31')][_0x7d82('0x1d')]);}return _0x1c50ec['getSubjects'](_0x243255);}})[_0x7d82('0x25')](function(_0x378cda){if(_0x378cda){return _0x378cda?{'count':_0x59f021,'rows':_0x378cda}:null;}})[_0x7d82('0x25')](respondWithResult(_0x23a3ac,null))[_0x7d82('0x42')](handleError(_0x23a3ac,null));};exports['getDescriptions']=function(_0x20a7be,_0x34fd77,_0x112a26){var _0x19548c={};var _0x4a570f={};var _0x1ef8e1;var _0x21b13c;return db[_0x7d82('0x3f')][_0x7d82('0x4a')]({'where':{'id':_0x20a7be[_0x7d82('0x44')]['id']}})[_0x7d82('0x25')](handleEntityNotFound(_0x34fd77,null))[_0x7d82('0x25')](function(_0x1277f6){if(_0x1277f6){_0x1ef8e1=_0x1277f6;_0x4a570f[_0x7d82('0x30')]=_[_0x7d82('0x45')](db[_0x7d82('0x4d')][_0x7d82('0x2d')]);_0x4a570f[_0x7d82('0x31')]=_[_0x7d82('0x45')](_0x20a7be[_0x7d82('0x31')]);_0x4a570f['filters']=_[_0x7d82('0x33')](_0x4a570f['model'],_0x4a570f[_0x7d82('0x31')]);_0x19548c['attributes']=_[_0x7d82('0x33')](_0x4a570f['model'],qs[_0x7d82('0x35')](_0x20a7be[_0x7d82('0x31')][_0x7d82('0x35')]));_0x19548c['attributes']=_0x19548c[_0x7d82('0x34')]['length']?_0x19548c['attributes']:_0x4a570f[_0x7d82('0x30')];_0x19548c['order']=qs[_0x7d82('0x4b')](_0x20a7be[_0x7d82('0x31')][_0x7d82('0x4b')]);_0x19548c[_0x7d82('0x38')]=qs[_0x7d82('0x32')](_['pick'](_0x20a7be[_0x7d82('0x31')],_0x4a570f[_0x7d82('0x32')]));if(_0x20a7be[_0x7d82('0x31')]['filter']){_0x19548c[_0x7d82('0x38')]=_[_0x7d82('0x3b')](_0x19548c[_0x7d82('0x38')],{'$or':_['map'](_0x19548c[_0x7d82('0x34')],function(_0x582fe5){var _0x540837={};_0x540837[_0x582fe5]={'$like':'%'+_0x20a7be[_0x7d82('0x31')][_0x7d82('0x3a')]+'%'};return _0x540837;})});}_0x19548c=_['merge']({},_0x19548c,_0x20a7be['options']);return _0x1ef8e1[_0x7d82('0x50')](_0x19548c);}})[_0x7d82('0x25')](function(_0x526387){if(_0x526387){_0x21b13c=_0x526387['length'];if(!_0x20a7be[_0x7d82('0x31')][_0x7d82('0x36')](_0x7d82('0x37'))){_0x19548c[_0x7d82('0x20')]=qs[_0x7d82('0x20')](_0x20a7be[_0x7d82('0x31')][_0x7d82('0x20')]);_0x19548c[_0x7d82('0x1d')]=qs[_0x7d82('0x1d')](_0x20a7be[_0x7d82('0x31')][_0x7d82('0x1d')]);}return _0x1ef8e1[_0x7d82('0x50')](_0x19548c);}})['then'](function(_0x3d6492){if(_0x3d6492){return _0x3d6492?{'count':_0x21b13c,'rows':_0x3d6492}:null;}})[_0x7d82('0x25')](respondWithResult(_0x34fd77,null))[_0x7d82('0x42')](handleError(_0x34fd77,null));}; \ No newline at end of file diff --git a/server/api/intZohoConfiguration/intZohoConfiguration.model.js b/server/api/intZohoConfiguration/intZohoConfiguration.model.js index fdba632..3c42040 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 _0xdccc=['ZohoConfiguration','int_zoho_configurations','lodash','util','../../config/logger','moment','bluebird','request-promise','rimraf','exports'];(function(_0x510b98,_0x4c4cbb){var _0x45e775=function(_0x29ec11){while(--_0x29ec11){_0x510b98['push'](_0x510b98['shift']());}};_0x45e775(++_0x4c4cbb);}(_0xdccc,0xb6));var _0xcdcc=function(_0x2d66bc,_0x20492b){_0x2d66bc=_0x2d66bc-0x0;var _0x44a28a=_0xdccc[_0x2d66bc];return _0x44a28a;};'use strict';var _=require(_0xcdcc('0x0'));var util=require(_0xcdcc('0x1'));var logger=require(_0xcdcc('0x2'))('api');var moment=require(_0xcdcc('0x3'));var BPromise=require(_0xcdcc('0x4'));var rp=require(_0xcdcc('0x5'));var fs=require('fs');var path=require('path');var rimraf=require(_0xcdcc('0x6'));var config=require('../../config/environment');var attributes=require('./intZohoConfiguration.attributes');module[_0xcdcc('0x7')]=function(_0x3ade5c,_0xb80265){return _0x3ade5c['define'](_0xcdcc('0x8'),attributes,{'tableName':_0xcdcc('0x9'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x0478=['moment','bluebird','request-promise','path','rimraf','../../config/environment','./intZohoConfiguration.attributes','exports','define','ZohoConfiguration','int_zoho_configurations','util','../../config/logger','api'];(function(_0x48bc3a,_0x2507f7){var _0x2e3beb=function(_0x3b763f){while(--_0x3b763f){_0x48bc3a['push'](_0x48bc3a['shift']());}};_0x2e3beb(++_0x2507f7);}(_0x0478,0x14d));var _0x8047=function(_0x240f11,_0x1e5f12){_0x240f11=_0x240f11-0x0;var _0x1495e1=_0x0478[_0x240f11];return _0x1495e1;};'use strict';var _=require('lodash');var util=require(_0x8047('0x0'));var logger=require(_0x8047('0x1'))(_0x8047('0x2'));var moment=require(_0x8047('0x3'));var BPromise=require(_0x8047('0x4'));var rp=require(_0x8047('0x5'));var fs=require('fs');var path=require(_0x8047('0x6'));var rimraf=require(_0x8047('0x7'));var config=require(_0x8047('0x8'));var attributes=require(_0x8047('0x9'));module[_0x8047('0xa')]=function(_0x2dc889,_0x12c35d){return _0x2dc889[_0x8047('0xb')](_0x8047('0xc'),attributes,{'tableName':_0x8047('0xd'),'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 e782a7a..0e373db 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 _0xfac1=['error','message','result','catch','util','moment','bluebird','randomstring','../../mysqldb','../../config/logger','rpc','../../config/environment','client','http','request','info','ZohoConfiguration,\x20%s,\x20%s','request\x20sent','debug','stringify'];(function(_0x2f965f,_0x100aca){var _0x73f2b9=function(_0x25705d){while(--_0x25705d){_0x2f965f['push'](_0x2f965f['shift']());}};_0x73f2b9(++_0x100aca);}(_0xfac1,0x11c));var _0x1fac=function(_0x11238d,_0x499ac8){_0x11238d=_0x11238d-0x0;var _0x3686b0=_0xfac1[_0x11238d];return _0x3686b0;};'use strict';var _=require('lodash');var util=require(_0x1fac('0x0'));var moment=require(_0x1fac('0x1'));var BPromise=require(_0x1fac('0x2'));var rs=require(_0x1fac('0x3'));var fs=require('fs');var Redis=require('ioredis');var db=require(_0x1fac('0x4'))['db'];var utils=require('../../config/utils');var logger=require(_0x1fac('0x5'))(_0x1fac('0x6'));var config=require(_0x1fac('0x7'));var jayson=require('jayson/promise');var client=jayson[_0x1fac('0x8')][_0x1fac('0x9')]({'port':0x232a});function respondWithRpcPromise(_0x221676,_0x5939b5,_0x3f096d){return new BPromise(function(_0x416dae,_0x29ff1a){return client[_0x1fac('0xa')](_0x221676,_0x3f096d)['then'](function(_0x19be90){logger[_0x1fac('0xb')](_0x1fac('0xc'),_0x5939b5,_0x1fac('0xd'));logger[_0x1fac('0xe')]('ZohoConfiguration,\x20%s,\x20%s,\x20%s',_0x5939b5,_0x1fac('0xd'),JSON[_0x1fac('0xf')](_0x19be90));if(_0x19be90[_0x1fac('0x10')]){if(_0x19be90[_0x1fac('0x10')]['code']===0x1f4){logger[_0x1fac('0x10')](_0x1fac('0xc'),_0x5939b5,_0x19be90[_0x1fac('0x10')][_0x1fac('0x11')]);return _0x29ff1a(_0x19be90[_0x1fac('0x10')][_0x1fac('0x11')]);}logger[_0x1fac('0x10')](_0x1fac('0xc'),_0x5939b5,_0x19be90[_0x1fac('0x10')][_0x1fac('0x11')]);return _0x416dae(_0x19be90['error'][_0x1fac('0x11')]);}else{logger[_0x1fac('0xb')](_0x1fac('0xc'),_0x5939b5,_0x1fac('0xd'));_0x416dae(_0x19be90[_0x1fac('0x12')]['message']);}})[_0x1fac('0x13')](function(_0x30baeb){logger[_0x1fac('0x10')](_0x1fac('0xc'),_0x5939b5,_0x30baeb);_0x29ff1a(_0x30baeb);});});} \ No newline at end of file +var _0x58d8=['debug','ZohoConfiguration,\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','then','info','ZohoConfiguration,\x20%s,\x20%s','request\x20sent'];(function(_0x1b13b4,_0x7d9f97){var _0x9c6e3c=function(_0xf6dd0b){while(--_0xf6dd0b){_0x1b13b4['push'](_0x1b13b4['shift']());}};_0x9c6e3c(++_0x7d9f97);}(_0x58d8,0x103));var _0x858d=function(_0x14add3,_0x13ce8d){_0x14add3=_0x14add3-0x0;var _0x4a174f=_0x58d8[_0x14add3];return _0x4a174f;};'use strict';var _=require('lodash');var util=require('util');var moment=require(_0x858d('0x0'));var BPromise=require('bluebird');var rs=require(_0x858d('0x1'));var fs=require('fs');var Redis=require(_0x858d('0x2'));var db=require(_0x858d('0x3'))['db'];var utils=require(_0x858d('0x4'));var logger=require(_0x858d('0x5'))('rpc');var config=require(_0x858d('0x6'));var jayson=require(_0x858d('0x7'));var client=jayson[_0x858d('0x8')][_0x858d('0x9')]({'port':0x232a});function respondWithRpcPromise(_0x4e7399,_0x2dacb8,_0x2d1b53){return new BPromise(function(_0x544a0c,_0x18315a){return client['request'](_0x4e7399,_0x2d1b53)[_0x858d('0xa')](function(_0x27b16b){logger[_0x858d('0xb')](_0x858d('0xc'),_0x2dacb8,_0x858d('0xd'));logger[_0x858d('0xe')](_0x858d('0xf'),_0x2dacb8,_0x858d('0xd'),JSON[_0x858d('0x10')](_0x27b16b));if(_0x27b16b[_0x858d('0x11')]){if(_0x27b16b[_0x858d('0x11')]['code']===0x1f4){logger[_0x858d('0x11')](_0x858d('0xc'),_0x2dacb8,_0x27b16b['error'][_0x858d('0x12')]);return _0x18315a(_0x27b16b['error']['message']);}logger[_0x858d('0x11')](_0x858d('0xc'),_0x2dacb8,_0x27b16b['error'][_0x858d('0x12')]);return _0x544a0c(_0x27b16b[_0x858d('0x11')][_0x858d('0x12')]);}else{logger[_0x858d('0xb')]('ZohoConfiguration,\x20%s,\x20%s',_0x2dacb8,'request\x20sent');_0x544a0c(_0x27b16b[_0x858d('0x13')][_0x858d('0x12')]);}})[_0x858d('0x14')](function(_0x541cd4){logger[_0x858d('0x11')]('ZohoConfiguration,\x20%s,\x20%s',_0x2dacb8,_0x541cd4);_0x18315a(_0x541cd4);});});} \ No newline at end of file diff --git a/server/api/intZohoField/index.js b/server/api/intZohoField/index.js index 22a228c..8b8f6fc 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 _0x1eae=['show','post','create','delete','destroy','exports','util','connect-timeout','Router','fs-extra','../../components/auth/service','../../components/interaction/service','./intZohoField.controller','get','isAuthenticated','index','/:id'];(function(_0x5a03c3,_0x4f939e){var _0x317f49=function(_0x121b7d){while(--_0x121b7d){_0x5a03c3['push'](_0x5a03c3['shift']());}};_0x317f49(++_0x4f939e);}(_0x1eae,0x105));var _0xe1ea=function(_0x17eee5,_0x1ee781){_0x17eee5=_0x17eee5-0x0;var _0x1e3324=_0x1eae[_0x17eee5];return _0x1e3324;};'use strict';var multer=require('multer');var util=require(_0xe1ea('0x0'));var path=require('path');var timeout=require(_0xe1ea('0x1'));var express=require('express');var router=express[_0xe1ea('0x2')]();var fs_extra=require(_0xe1ea('0x3'));var auth=require(_0xe1ea('0x4'));var interaction=require(_0xe1ea('0x5'));var config=require('../../config/environment');var controller=require(_0xe1ea('0x6'));router[_0xe1ea('0x7')]('/',auth[_0xe1ea('0x8')](),controller[_0xe1ea('0x9')]);router[_0xe1ea('0x7')](_0xe1ea('0xa'),auth[_0xe1ea('0x8')](),controller[_0xe1ea('0xb')]);router[_0xe1ea('0xc')]('/',auth[_0xe1ea('0x8')](),controller[_0xe1ea('0xd')]);router['put'](_0xe1ea('0xa'),auth[_0xe1ea('0x8')](),controller['update']);router[_0xe1ea('0xe')](_0xe1ea('0xa'),auth[_0xe1ea('0x8')](),controller[_0xe1ea('0xf')]);module[_0xe1ea('0x10')]=router; \ No newline at end of file +var _0x507d=['exports','multer','util','path','connect-timeout','express','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','isAuthenticated','index','/:id','show','post','create','put','delete','destroy'];(function(_0x4a2689,_0x314a16){var _0x463450=function(_0x5388b8){while(--_0x5388b8){_0x4a2689['push'](_0x4a2689['shift']());}};_0x463450(++_0x314a16);}(_0x507d,0x1b6));var _0xd507=function(_0x39004a,_0x36ea3d){_0x39004a=_0x39004a-0x0;var _0x57e49f=_0x507d[_0x39004a];return _0x57e49f;};'use strict';var multer=require(_0xd507('0x0'));var util=require(_0xd507('0x1'));var path=require(_0xd507('0x2'));var timeout=require(_0xd507('0x3'));var express=require(_0xd507('0x4'));var router=express['Router']();var fs_extra=require(_0xd507('0x5'));var auth=require(_0xd507('0x6'));var interaction=require(_0xd507('0x7'));var config=require(_0xd507('0x8'));var controller=require('./intZohoField.controller');router['get']('/',auth[_0xd507('0x9')](),controller[_0xd507('0xa')]);router['get'](_0xd507('0xb'),auth['isAuthenticated'](),controller[_0xd507('0xc')]);router[_0xd507('0xd')]('/',auth[_0xd507('0x9')](),controller[_0xd507('0xe')]);router[_0xd507('0xf')](_0xd507('0xb'),auth[_0xd507('0x9')](),controller['update']);router[_0xd507('0x10')](_0xd507('0xb'),auth[_0xd507('0x9')](),controller[_0xd507('0x11')]);module[_0xd507('0x12')]=router; \ No newline at end of file diff --git a/server/api/intZohoField/intZohoField.attributes.js b/server/api/intZohoField/intZohoField.attributes.js index bd954e3..fa7f87e 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 _0xbbab=['BOOLEAN','sequelize','exports','ENUM','string','variable','customVariable','STRING'];(function(_0x4acfd2,_0x5b9374){var _0x12afbe=function(_0x5bc178){while(--_0x5bc178){_0x4acfd2['push'](_0x4acfd2['shift']());}};_0x12afbe(++_0x5b9374);}(_0xbbab,0x81));var _0xbbba=function(_0x40afad,_0x572c11){_0x40afad=_0x40afad-0x0;var _0x3587d2=_0xbbab[_0x40afad];return _0x3587d2;};'use strict';var Sequelize=require(_0xbbba('0x0'));module[_0xbbba('0x1')]={'type':{'type':Sequelize[_0xbbba('0x2')](_0xbbba('0x3'),_0xbbba('0x4'),_0xbbba('0x5'),'keyValue','picklist'),'defaultValue':_0xbbba('0x3')},'content':{'type':Sequelize[_0xbbba('0x6')]},'key':{'type':Sequelize['STRING']},'keyType':{'type':Sequelize[_0xbbba('0x2')](_0xbbba('0x3'),_0xbbba('0x4'),_0xbbba('0x5'))},'keyContent':{'type':Sequelize[_0xbbba('0x6')]},'idField':{'type':Sequelize['STRING']},'nameField':{'type':Sequelize[_0xbbba('0x6')]},'customField':{'type':Sequelize[_0xbbba('0x7')],'defaultValue':!![]},'variableName':{'type':Sequelize[_0xbbba('0x6')]}}; \ No newline at end of file +var _0x58f9=['STRING','BOOLEAN','sequelize','exports','ENUM','string','variable','customVariable','picklist'];(function(_0xea46d,_0x254082){var _0x1fa4c5=function(_0x4d7817){while(--_0x4d7817){_0xea46d['push'](_0xea46d['shift']());}};_0x1fa4c5(++_0x254082);}(_0x58f9,0x18e));var _0x958f=function(_0x12310f,_0x1b2d55){_0x12310f=_0x12310f-0x0;var _0x5abecf=_0x58f9[_0x12310f];return _0x5abecf;};'use strict';var Sequelize=require(_0x958f('0x0'));module[_0x958f('0x1')]={'type':{'type':Sequelize[_0x958f('0x2')](_0x958f('0x3'),_0x958f('0x4'),_0x958f('0x5'),'keyValue',_0x958f('0x6')),'defaultValue':_0x958f('0x3')},'content':{'type':Sequelize[_0x958f('0x7')]},'key':{'type':Sequelize[_0x958f('0x7')]},'keyType':{'type':Sequelize['ENUM'](_0x958f('0x3'),_0x958f('0x4'),_0x958f('0x5'))},'keyContent':{'type':Sequelize[_0x958f('0x7')]},'idField':{'type':Sequelize[_0x958f('0x7')]},'nameField':{'type':Sequelize['STRING']},'customField':{'type':Sequelize[_0x958f('0x8')],'defaultValue':!![]},'variableName':{'type':Sequelize[_0x958f('0x7')]}}; \ No newline at end of file diff --git a/server/api/intZohoField/intZohoField.controller.js b/server/api/intZohoField/intZohoField.controller.js index 2276d88..ef77512 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 _0x1c6c=['nolimit','order','sort','where','pick','VIRTUAL','filter','merge','options','include','rows','catch','show','params','keys','intersection','create','body','find','eml-format','zip-dir','request-promise','moment','bluebird','mustache','sox','to-csv','ejs','fs-extra','lodash','squel','crypto','jsforce','desk.js','querystring','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/license/util','../../mysqldb','sendStatus','status','end','json','offset','undefined','limit','count','set','Content-Range','apply','reject','save','update','then','destroy','error','stack','name','map','ZohoField','rawAttributes','fieldName','type','model','query','filters','fields','attributes','length','hasOwnProperty'];(function(_0x456a58,_0x3d2e6d){var _0x57c3e7=function(_0x246149){while(--_0x246149){_0x456a58['push'](_0x456a58['shift']());}};_0x57c3e7(++_0x3d2e6d);}(_0x1c6c,0x13f));var _0xc1c6=function(_0x3935a0,_0x28861b){_0x3935a0=_0x3935a0-0x0;var _0x1fe3d5=_0x1c6c[_0x3935a0];return _0x1fe3d5;};'use strict';var emlformat=require(_0xc1c6('0x0'));var rimraf=require('rimraf');var zipdir=require(_0xc1c6('0x1'));var jsonpatch=require('fast-json-patch');var rp=require(_0xc1c6('0x2'));var moment=require(_0xc1c6('0x3'));var BPromise=require(_0xc1c6('0x4'));var Mustache=require(_0xc1c6('0x5'));var util=require('util');var path=require('path');var sox=require(_0xc1c6('0x6'));var csv=require(_0xc1c6('0x7'));var ejs=require(_0xc1c6('0x8'));var fs=require('fs');var fs_extra=require(_0xc1c6('0x9'));var _=require(_0xc1c6('0xa'));var squel=require(_0xc1c6('0xb'));var crypto=require(_0xc1c6('0xc'));var jsforce=require(_0xc1c6('0xd'));var deskjs=require(_0xc1c6('0xe'));var toCsv=require('to-csv');var querystring=require(_0xc1c6('0xf'));var Papa=require('papaparse');var Redis=require('ioredis');var authService=require(_0xc1c6('0x10'));var qs=require(_0xc1c6('0x11'));var as=require(_0xc1c6('0x12'));var hardwareService=require(_0xc1c6('0x13'));var logger=require(_0xc1c6('0x14'))(_0xc1c6('0x15'));var utils=require(_0xc1c6('0x16'));var config=require('../../config/environment');var licenseUtil=require(_0xc1c6('0x17'));var db=require(_0xc1c6('0x18'))['db'];function respondWithStatusCode(_0x4e4d7b,_0x570117){_0x570117=_0x570117||0xcc;return function(_0x262d50){if(_0x262d50){return _0x4e4d7b[_0xc1c6('0x19')](_0x570117);}return _0x4e4d7b[_0xc1c6('0x1a')](_0x570117)[_0xc1c6('0x1b')]();};}function respondWithResult(_0x4fc498,_0x535a63){_0x535a63=_0x535a63||0xc8;return function(_0x5430df){if(_0x5430df){return _0x4fc498[_0xc1c6('0x1a')](_0x535a63)[_0xc1c6('0x1c')](_0x5430df);}};}function respondWithFilteredResult(_0x59fa95,_0x38021e){return function(_0x24b00d){if(_0x24b00d){var _0x139c57=typeof _0x38021e[_0xc1c6('0x1d')]===_0xc1c6('0x1e')&&typeof _0x38021e[_0xc1c6('0x1f')]===_0xc1c6('0x1e');var _0x33bd13=_0x24b00d[_0xc1c6('0x20')];var _0x135891=_0x139c57?0x0:_0x38021e[_0xc1c6('0x1d')];var _0x293a3d=_0x139c57?_0x24b00d['count']:_0x38021e[_0xc1c6('0x1d')]+_0x38021e[_0xc1c6('0x1f')];var _0x2124a4;if(_0x293a3d>=_0x33bd13){_0x293a3d=_0x33bd13;_0x2124a4=0xc8;}else{_0x2124a4=0xce;}_0x59fa95['status'](_0x2124a4);return _0x59fa95[_0xc1c6('0x21')](_0xc1c6('0x22'),_0x135891+'-'+_0x293a3d+'/'+_0x33bd13)[_0xc1c6('0x1c')](_0x24b00d);}return null;};}function patchUpdates(_0x151ec0){return function(_0x5e633c){try{jsonpatch[_0xc1c6('0x23')](_0x5e633c,_0x151ec0,!![]);}catch(_0x3efac8){return BPromise[_0xc1c6('0x24')](_0x3efac8);}return _0x5e633c[_0xc1c6('0x25')]();};}function saveUpdates(_0x2a9054,_0x401e45){return function(_0x2c3497){if(_0x2c3497){return _0x2c3497[_0xc1c6('0x26')](_0x2a9054)[_0xc1c6('0x27')](function(_0x3d723f){return _0x3d723f;});}return null;};}function removeEntity(_0x3098e5,_0x539727){return function(_0x1a3d2b){if(_0x1a3d2b){return _0x1a3d2b[_0xc1c6('0x28')]()[_0xc1c6('0x27')](function(){_0x3098e5[_0xc1c6('0x1a')](0xcc)['end']();});}};}function handleEntityNotFound(_0x287a1a,_0xc4dd8d){return function(_0x368078){if(!_0x368078){_0x287a1a[_0xc1c6('0x19')](0x194);}return _0x368078;};}function handleError(_0x39f2d4,_0x1ad34b){_0x1ad34b=_0x1ad34b||0x1f4;return function(_0x54ccc4){logger[_0xc1c6('0x29')](_0x54ccc4[_0xc1c6('0x2a')]);if(_0x54ccc4[_0xc1c6('0x2b')]){delete _0x54ccc4[_0xc1c6('0x2b')];}_0x39f2d4[_0xc1c6('0x1a')](_0x1ad34b)['send'](_0x54ccc4);};}exports['index']=function(_0x3c5c30,_0x3fd1c3){var _0x4166ff={},_0x273e97={},_0x38890f={'count':0x0,'rows':[]};var _0xe6c5f0=_[_0xc1c6('0x2c')](db[_0xc1c6('0x2d')][_0xc1c6('0x2e')],function(_0x242cb7){return{'name':_0x242cb7[_0xc1c6('0x2f')],'type':_0x242cb7[_0xc1c6('0x30')]['key']};});_0x273e97[_0xc1c6('0x31')]=_[_0xc1c6('0x2c')](_0xe6c5f0,_0xc1c6('0x2b'));_0x273e97[_0xc1c6('0x32')]=_['keys'](_0x3c5c30[_0xc1c6('0x32')]);_0x273e97[_0xc1c6('0x33')]=_['intersection'](_0x273e97['model'],_0x273e97[_0xc1c6('0x32')]);_0x4166ff['attributes']=_['intersection'](_0x273e97[_0xc1c6('0x31')],qs[_0xc1c6('0x34')](_0x3c5c30[_0xc1c6('0x32')][_0xc1c6('0x34')]));_0x4166ff[_0xc1c6('0x35')]=_0x4166ff[_0xc1c6('0x35')][_0xc1c6('0x36')]?_0x4166ff['attributes']:_0x273e97['model'];if(!_0x3c5c30[_0xc1c6('0x32')][_0xc1c6('0x37')](_0xc1c6('0x38'))){_0x4166ff[_0xc1c6('0x1f')]=qs['limit'](_0x3c5c30['query']['limit']);_0x4166ff[_0xc1c6('0x1d')]=qs[_0xc1c6('0x1d')](_0x3c5c30[_0xc1c6('0x32')][_0xc1c6('0x1d')]);}_0x4166ff[_0xc1c6('0x39')]=qs['sort'](_0x3c5c30[_0xc1c6('0x32')][_0xc1c6('0x3a')]);_0x4166ff[_0xc1c6('0x3b')]=qs['filters'](_[_0xc1c6('0x3c')](_0x3c5c30[_0xc1c6('0x32')],_0x273e97[_0xc1c6('0x33')]),_0xe6c5f0);if(_0x3c5c30[_0xc1c6('0x32')]['filter']){_0x4166ff[_0xc1c6('0x3b')]=_['merge'](_0x4166ff['where'],{'$or':_['map'](_0xe6c5f0,function(_0xb9d2aa){if(_0xb9d2aa[_0xc1c6('0x30')]!==_0xc1c6('0x3d')){var _0x1c0479={};_0x1c0479[_0xb9d2aa[_0xc1c6('0x2b')]]={'$like':'%'+_0x3c5c30[_0xc1c6('0x32')][_0xc1c6('0x3e')]+'%'};return _0x1c0479;}})});}_0x4166ff=_[_0xc1c6('0x3f')]({},_0x4166ff,_0x3c5c30[_0xc1c6('0x40')]);var _0x2ca9fb={'where':_0x4166ff[_0xc1c6('0x3b')]};return db['ZohoField'][_0xc1c6('0x20')](_0x2ca9fb)[_0xc1c6('0x27')](function(_0x21989c){_0x38890f[_0xc1c6('0x20')]=_0x21989c;if(_0x3c5c30[_0xc1c6('0x32')]['includeAll']){_0x4166ff[_0xc1c6('0x41')]=[{'all':!![]}];}return db[_0xc1c6('0x2d')]['findAll'](_0x4166ff);})[_0xc1c6('0x27')](function(_0x1ca98b){_0x38890f[_0xc1c6('0x42')]=_0x1ca98b;return _0x38890f;})['then'](respondWithFilteredResult(_0x3fd1c3,_0x4166ff))[_0xc1c6('0x43')](handleError(_0x3fd1c3,null));};exports[_0xc1c6('0x44')]=function(_0x5b90b0,_0x579a73){var _0x5b90a8={'raw':!![],'where':{'id':_0x5b90b0[_0xc1c6('0x45')]['id']}},_0x5c152e={};_0x5c152e[_0xc1c6('0x31')]=_['keys'](db[_0xc1c6('0x2d')]['rawAttributes']);_0x5c152e[_0xc1c6('0x32')]=_[_0xc1c6('0x46')](_0x5b90b0['query']);_0x5c152e[_0xc1c6('0x33')]=_['intersection'](_0x5c152e['model'],_0x5c152e[_0xc1c6('0x32')]);_0x5b90a8[_0xc1c6('0x35')]=_[_0xc1c6('0x47')](_0x5c152e[_0xc1c6('0x31')],qs[_0xc1c6('0x34')](_0x5b90b0[_0xc1c6('0x32')]['fields']));_0x5b90a8[_0xc1c6('0x35')]=_0x5b90a8[_0xc1c6('0x35')][_0xc1c6('0x36')]?_0x5b90a8['attributes']:_0x5c152e[_0xc1c6('0x31')];if(_0x5b90b0[_0xc1c6('0x32')]['includeAll']){_0x5b90a8['include']=[{'all':!![]}];}_0x5b90a8=_[_0xc1c6('0x3f')]({},_0x5b90a8,_0x5b90b0[_0xc1c6('0x40')]);return db[_0xc1c6('0x2d')]['find'](_0x5b90a8)[_0xc1c6('0x27')](handleEntityNotFound(_0x579a73,null))[_0xc1c6('0x27')](respondWithResult(_0x579a73,null))[_0xc1c6('0x43')](handleError(_0x579a73,null));};exports[_0xc1c6('0x48')]=function(_0x5552d1,_0x2fc131){return db[_0xc1c6('0x2d')][_0xc1c6('0x48')](_0x5552d1[_0xc1c6('0x49')],{})[_0xc1c6('0x27')](respondWithResult(_0x2fc131,0xc9))[_0xc1c6('0x43')](handleError(_0x2fc131,null));};exports[_0xc1c6('0x26')]=function(_0x3364b9,_0x31e737){if(_0x3364b9[_0xc1c6('0x49')]['id']){delete _0x3364b9[_0xc1c6('0x49')]['id'];}return db[_0xc1c6('0x2d')][_0xc1c6('0x4a')]({'where':{'id':_0x3364b9[_0xc1c6('0x45')]['id']}})[_0xc1c6('0x27')](handleEntityNotFound(_0x31e737,null))[_0xc1c6('0x27')](saveUpdates(_0x3364b9[_0xc1c6('0x49')],null))[_0xc1c6('0x27')](respondWithResult(_0x31e737,null))[_0xc1c6('0x43')](handleError(_0x31e737,null));};exports[_0xc1c6('0x28')]=function(_0x1892f2,_0x57fa2b){return db[_0xc1c6('0x2d')][_0xc1c6('0x4a')]({'where':{'id':_0x1892f2[_0xc1c6('0x45')]['id']}})[_0xc1c6('0x27')](handleEntityNotFound(_0x57fa2b,null))['then'](removeEntity(_0x57fa2b,null))['catch'](handleError(_0x57fa2b,null));}; \ No newline at end of file +var _0x1fb2=['rows','show','params','find','catch','create','body','eml-format','fast-json-patch','request-promise','bluebird','mustache','util','path','sox','to-csv','ejs','fs-extra','lodash','squel','jsforce','desk.js','querystring','papaparse','../../components/auth/service','../../components/parsers/qs','../../config/license/hardware','../../config/logger','api','../../config/license/util','../../mysqldb','sendStatus','status','end','json','offset','undefined','count','set','Content-Range','apply','reject','update','then','destroy','error','stack','name','send','map','ZohoField','type','key','query','keys','filters','intersection','model','fields','attributes','hasOwnProperty','limit','sort','where','pick','merge','options','includeAll','include'];(function(_0xc6be3a,_0x540e05){var _0x56a310=function(_0x50a144){while(--_0x50a144){_0xc6be3a['push'](_0xc6be3a['shift']());}};_0x56a310(++_0x540e05);}(_0x1fb2,0x1ea));var _0x21fb=function(_0x16bac5,_0x36015a){_0x16bac5=_0x16bac5-0x0;var _0x439144=_0x1fb2[_0x16bac5];return _0x439144;};'use strict';var emlformat=require(_0x21fb('0x0'));var rimraf=require('rimraf');var zipdir=require('zip-dir');var jsonpatch=require(_0x21fb('0x1'));var rp=require(_0x21fb('0x2'));var moment=require('moment');var BPromise=require(_0x21fb('0x3'));var Mustache=require(_0x21fb('0x4'));var util=require(_0x21fb('0x5'));var path=require(_0x21fb('0x6'));var sox=require(_0x21fb('0x7'));var csv=require(_0x21fb('0x8'));var ejs=require(_0x21fb('0x9'));var fs=require('fs');var fs_extra=require(_0x21fb('0xa'));var _=require(_0x21fb('0xb'));var squel=require(_0x21fb('0xc'));var crypto=require('crypto');var jsforce=require(_0x21fb('0xd'));var deskjs=require(_0x21fb('0xe'));var toCsv=require(_0x21fb('0x8'));var querystring=require(_0x21fb('0xf'));var Papa=require(_0x21fb('0x10'));var Redis=require('ioredis');var authService=require(_0x21fb('0x11'));var qs=require(_0x21fb('0x12'));var as=require('../../components/parsers/advancedSearch');var hardwareService=require(_0x21fb('0x13'));var logger=require(_0x21fb('0x14'))(_0x21fb('0x15'));var utils=require('../../config/utils');var config=require('../../config/environment');var licenseUtil=require(_0x21fb('0x16'));var db=require(_0x21fb('0x17'))['db'];function respondWithStatusCode(_0x3e9884,_0x43259f){_0x43259f=_0x43259f||0xcc;return function(_0x105e6f){if(_0x105e6f){return _0x3e9884[_0x21fb('0x18')](_0x43259f);}return _0x3e9884[_0x21fb('0x19')](_0x43259f)[_0x21fb('0x1a')]();};}function respondWithResult(_0x47202b,_0x4dd298){_0x4dd298=_0x4dd298||0xc8;return function(_0x1fed37){if(_0x1fed37){return _0x47202b['status'](_0x4dd298)[_0x21fb('0x1b')](_0x1fed37);}};}function respondWithFilteredResult(_0x255eab,_0x4a1b27){return function(_0x497347){if(_0x497347){var _0x1841bd=typeof _0x4a1b27[_0x21fb('0x1c')]===_0x21fb('0x1d')&&typeof _0x4a1b27['limit']==='undefined';var _0x3f1fc8=_0x497347[_0x21fb('0x1e')];var _0x4cb647=_0x1841bd?0x0:_0x4a1b27['offset'];var _0x268325=_0x1841bd?_0x497347[_0x21fb('0x1e')]:_0x4a1b27[_0x21fb('0x1c')]+_0x4a1b27['limit'];var _0x187239;if(_0x268325>=_0x3f1fc8){_0x268325=_0x3f1fc8;_0x187239=0xc8;}else{_0x187239=0xce;}_0x255eab['status'](_0x187239);return _0x255eab[_0x21fb('0x1f')](_0x21fb('0x20'),_0x4cb647+'-'+_0x268325+'/'+_0x3f1fc8)[_0x21fb('0x1b')](_0x497347);}return null;};}function patchUpdates(_0x19b6ab){return function(_0x229a5e){try{jsonpatch[_0x21fb('0x21')](_0x229a5e,_0x19b6ab,!![]);}catch(_0x4e9d9c){return BPromise[_0x21fb('0x22')](_0x4e9d9c);}return _0x229a5e['save']();};}function saveUpdates(_0x4a1d1c,_0x24749f){return function(_0xa91893){if(_0xa91893){return _0xa91893[_0x21fb('0x23')](_0x4a1d1c)[_0x21fb('0x24')](function(_0x46b218){return _0x46b218;});}return null;};}function removeEntity(_0x5d55ba,_0x5e7723){return function(_0x30eb3e){if(_0x30eb3e){return _0x30eb3e[_0x21fb('0x25')]()[_0x21fb('0x24')](function(){_0x5d55ba[_0x21fb('0x19')](0xcc)[_0x21fb('0x1a')]();});}};}function handleEntityNotFound(_0x5c2348,_0x110f5e){return function(_0x160f04){if(!_0x160f04){_0x5c2348[_0x21fb('0x18')](0x194);}return _0x160f04;};}function handleError(_0x378ca4,_0xa95439){_0xa95439=_0xa95439||0x1f4;return function(_0x4f1dae){logger[_0x21fb('0x26')](_0x4f1dae[_0x21fb('0x27')]);if(_0x4f1dae[_0x21fb('0x28')]){delete _0x4f1dae['name'];}_0x378ca4[_0x21fb('0x19')](_0xa95439)[_0x21fb('0x29')](_0x4f1dae);};}exports['index']=function(_0x1f5ca0,_0xcae182){var _0x37762a={},_0x5a4368={},_0x504b67={'count':0x0,'rows':[]};var _0xc60606=_[_0x21fb('0x2a')](db[_0x21fb('0x2b')]['rawAttributes'],function(_0x3f17c5){return{'name':_0x3f17c5['fieldName'],'type':_0x3f17c5[_0x21fb('0x2c')][_0x21fb('0x2d')]};});_0x5a4368['model']=_[_0x21fb('0x2a')](_0xc60606,_0x21fb('0x28'));_0x5a4368[_0x21fb('0x2e')]=_[_0x21fb('0x2f')](_0x1f5ca0[_0x21fb('0x2e')]);_0x5a4368[_0x21fb('0x30')]=_[_0x21fb('0x31')](_0x5a4368[_0x21fb('0x32')],_0x5a4368['query']);_0x37762a['attributes']=_[_0x21fb('0x31')](_0x5a4368[_0x21fb('0x32')],qs[_0x21fb('0x33')](_0x1f5ca0['query'][_0x21fb('0x33')]));_0x37762a[_0x21fb('0x34')]=_0x37762a[_0x21fb('0x34')]['length']?_0x37762a[_0x21fb('0x34')]:_0x5a4368[_0x21fb('0x32')];if(!_0x1f5ca0[_0x21fb('0x2e')][_0x21fb('0x35')]('nolimit')){_0x37762a[_0x21fb('0x36')]=qs[_0x21fb('0x36')](_0x1f5ca0[_0x21fb('0x2e')][_0x21fb('0x36')]);_0x37762a[_0x21fb('0x1c')]=qs[_0x21fb('0x1c')](_0x1f5ca0[_0x21fb('0x2e')][_0x21fb('0x1c')]);}_0x37762a['order']=qs[_0x21fb('0x37')](_0x1f5ca0['query']['sort']);_0x37762a[_0x21fb('0x38')]=qs[_0x21fb('0x30')](_[_0x21fb('0x39')](_0x1f5ca0[_0x21fb('0x2e')],_0x5a4368[_0x21fb('0x30')]),_0xc60606);if(_0x1f5ca0[_0x21fb('0x2e')]['filter']){_0x37762a[_0x21fb('0x38')]=_[_0x21fb('0x3a')](_0x37762a[_0x21fb('0x38')],{'$or':_[_0x21fb('0x2a')](_0xc60606,function(_0x11f0fc){if(_0x11f0fc[_0x21fb('0x2c')]!=='VIRTUAL'){var _0x266a7c={};_0x266a7c[_0x11f0fc[_0x21fb('0x28')]]={'$like':'%'+_0x1f5ca0[_0x21fb('0x2e')]['filter']+'%'};return _0x266a7c;}})});}_0x37762a=_['merge']({},_0x37762a,_0x1f5ca0[_0x21fb('0x3b')]);var _0x24473b={'where':_0x37762a[_0x21fb('0x38')]};return db['ZohoField'][_0x21fb('0x1e')](_0x24473b)[_0x21fb('0x24')](function(_0x12b52d){_0x504b67[_0x21fb('0x1e')]=_0x12b52d;if(_0x1f5ca0[_0x21fb('0x2e')][_0x21fb('0x3c')]){_0x37762a[_0x21fb('0x3d')]=[{'all':!![]}];}return db[_0x21fb('0x2b')]['findAll'](_0x37762a);})[_0x21fb('0x24')](function(_0x2a0110){_0x504b67[_0x21fb('0x3e')]=_0x2a0110;return _0x504b67;})['then'](respondWithFilteredResult(_0xcae182,_0x37762a))['catch'](handleError(_0xcae182,null));};exports[_0x21fb('0x3f')]=function(_0x26b6e4,_0x5caa80){var _0x1c3eb0={'raw':!![],'where':{'id':_0x26b6e4[_0x21fb('0x40')]['id']}},_0x399c01={};_0x399c01['model']=_[_0x21fb('0x2f')](db[_0x21fb('0x2b')]['rawAttributes']);_0x399c01['query']=_['keys'](_0x26b6e4[_0x21fb('0x2e')]);_0x399c01[_0x21fb('0x30')]=_[_0x21fb('0x31')](_0x399c01[_0x21fb('0x32')],_0x399c01[_0x21fb('0x2e')]);_0x1c3eb0[_0x21fb('0x34')]=_[_0x21fb('0x31')](_0x399c01[_0x21fb('0x32')],qs['fields'](_0x26b6e4[_0x21fb('0x2e')][_0x21fb('0x33')]));_0x1c3eb0[_0x21fb('0x34')]=_0x1c3eb0[_0x21fb('0x34')]['length']?_0x1c3eb0[_0x21fb('0x34')]:_0x399c01[_0x21fb('0x32')];if(_0x26b6e4['query'][_0x21fb('0x3c')]){_0x1c3eb0[_0x21fb('0x3d')]=[{'all':!![]}];}_0x1c3eb0=_[_0x21fb('0x3a')]({},_0x1c3eb0,_0x26b6e4[_0x21fb('0x3b')]);return db[_0x21fb('0x2b')][_0x21fb('0x41')](_0x1c3eb0)['then'](handleEntityNotFound(_0x5caa80,null))[_0x21fb('0x24')](respondWithResult(_0x5caa80,null))[_0x21fb('0x42')](handleError(_0x5caa80,null));};exports['create']=function(_0x54146c,_0xcd66f5){return db[_0x21fb('0x2b')][_0x21fb('0x43')](_0x54146c[_0x21fb('0x44')],{})[_0x21fb('0x24')](respondWithResult(_0xcd66f5,0xc9))[_0x21fb('0x42')](handleError(_0xcd66f5,null));};exports[_0x21fb('0x23')]=function(_0x1fbbab,_0x166ba8){if(_0x1fbbab[_0x21fb('0x44')]['id']){delete _0x1fbbab[_0x21fb('0x44')]['id'];}return db['ZohoField'][_0x21fb('0x41')]({'where':{'id':_0x1fbbab[_0x21fb('0x40')]['id']}})['then'](handleEntityNotFound(_0x166ba8,null))[_0x21fb('0x24')](saveUpdates(_0x1fbbab['body'],null))[_0x21fb('0x24')](respondWithResult(_0x166ba8,null))[_0x21fb('0x42')](handleError(_0x166ba8,null));};exports['destroy']=function(_0x2cf01f,_0x432dda){return db[_0x21fb('0x2b')]['find']({'where':{'id':_0x2cf01f[_0x21fb('0x40')]['id']}})[_0x21fb('0x24')](handleEntityNotFound(_0x432dda,null))[_0x21fb('0x24')](removeEntity(_0x432dda,null))[_0x21fb('0x42')](handleError(_0x432dda,null));}; \ No newline at end of file diff --git a/server/api/intZohoField/intZohoField.model.js b/server/api/intZohoField/intZohoField.model.js index 752f61a..694431c 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 _0xa456=['./intZohoField.attributes','exports','define','ZohoField','int_zoho_fields','zoho_unique_index','idField','lodash','util','../../config/logger','api','bluebird','request-promise','path','../../config/environment'];(function(_0xa464c9,_0x7c86d8){var _0x3d73c4=function(_0x5c2056){while(--_0x5c2056){_0xa464c9['push'](_0xa464c9['shift']());}};_0x3d73c4(++_0x7c86d8);}(_0xa456,0x142));var _0x6a45=function(_0x4c12ec,_0x2e9103){_0x4c12ec=_0x4c12ec-0x0;var _0x3ae42c=_0xa456[_0x4c12ec];return _0x3ae42c;};'use strict';var _=require(_0x6a45('0x0'));var util=require(_0x6a45('0x1'));var logger=require(_0x6a45('0x2'))(_0x6a45('0x3'));var moment=require('moment');var BPromise=require(_0x6a45('0x4'));var rp=require(_0x6a45('0x5'));var fs=require('fs');var path=require(_0x6a45('0x6'));var rimraf=require('rimraf');var config=require(_0x6a45('0x7'));var attributes=require(_0x6a45('0x8'));module[_0x6a45('0x9')]=function(_0x14da6b,_0x4dfbfa){return _0x14da6b[_0x6a45('0xa')](_0x6a45('0xb'),attributes,{'tableName':_0x6a45('0xc'),'paranoid':![],'indexes':[{'name':_0x6a45('0xd'),'fields':[_0x6a45('0xe'),'FieldId'],'unique':!![]}],'timestamps':!![]});}; \ No newline at end of file +var _0x01d9=['define','ZohoField','int_zoho_fields','zoho_unique_index','idField','FieldId','lodash','util','../../config/logger','api','bluebird','request-promise','path','rimraf','../../config/environment','./intZohoField.attributes','exports'];(function(_0x5037ab,_0x43209e){var _0x512adb=function(_0x261783){while(--_0x261783){_0x5037ab['push'](_0x5037ab['shift']());}};_0x512adb(++_0x43209e);}(_0x01d9,0x6c));var _0x901d=function(_0x321bb2,_0x202794){_0x321bb2=_0x321bb2-0x0;var _0x9c12ed=_0x01d9[_0x321bb2];return _0x9c12ed;};'use strict';var _=require(_0x901d('0x0'));var util=require(_0x901d('0x1'));var logger=require(_0x901d('0x2'))(_0x901d('0x3'));var moment=require('moment');var BPromise=require(_0x901d('0x4'));var rp=require(_0x901d('0x5'));var fs=require('fs');var path=require(_0x901d('0x6'));var rimraf=require(_0x901d('0x7'));var config=require(_0x901d('0x8'));var attributes=require(_0x901d('0x9'));module[_0x901d('0xa')]=function(_0x4e7842,_0x1e5d7d){return _0x4e7842[_0x901d('0xb')](_0x901d('0xc'),attributes,{'tableName':_0x901d('0xd'),'paranoid':![],'indexes':[{'name':_0x901d('0xe'),'fields':[_0x901d('0xf'),_0x901d('0x10')],'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 5b8a1e3..598decc 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 _0xd4bf=['request\x20sent','stringify','error','message','result','catch','lodash','bluebird','randomstring','ioredis','../../config/logger','rpc','../../config/environment','jayson/promise','client','request','then','info','ZohoField,\x20%s,\x20%s','debug','ZohoField,\x20%s,\x20%s,\x20%s'];(function(_0x1629c9,_0x484a8c){var _0x350a80=function(_0x2ddcb7){while(--_0x2ddcb7){_0x1629c9['push'](_0x1629c9['shift']());}};_0x350a80(++_0x484a8c);}(_0xd4bf,0x1d4));var _0xfd4b=function(_0x35df43,_0x33cadd){_0x35df43=_0x35df43-0x0;var _0x5966a9=_0xd4bf[_0x35df43];return _0x5966a9;};'use strict';var _=require(_0xfd4b('0x0'));var util=require('util');var moment=require('moment');var BPromise=require(_0xfd4b('0x1'));var rs=require(_0xfd4b('0x2'));var fs=require('fs');var Redis=require(_0xfd4b('0x3'));var db=require('../../mysqldb')['db'];var utils=require('../../config/utils');var logger=require(_0xfd4b('0x4'))(_0xfd4b('0x5'));var config=require(_0xfd4b('0x6'));var jayson=require(_0xfd4b('0x7'));var client=jayson[_0xfd4b('0x8')]['http']({'port':0x232a});function respondWithRpcPromise(_0x1a5b7c,_0x25e5cc,_0x37a7f6){return new BPromise(function(_0x414586,_0x124123){return client[_0xfd4b('0x9')](_0x1a5b7c,_0x37a7f6)[_0xfd4b('0xa')](function(_0x1f03ea){logger[_0xfd4b('0xb')](_0xfd4b('0xc'),_0x25e5cc,'request\x20sent');logger[_0xfd4b('0xd')](_0xfd4b('0xe'),_0x25e5cc,_0xfd4b('0xf'),JSON[_0xfd4b('0x10')](_0x1f03ea));if(_0x1f03ea[_0xfd4b('0x11')]){if(_0x1f03ea['error']['code']===0x1f4){logger[_0xfd4b('0x11')]('ZohoField,\x20%s,\x20%s',_0x25e5cc,_0x1f03ea['error'][_0xfd4b('0x12')]);return _0x124123(_0x1f03ea[_0xfd4b('0x11')][_0xfd4b('0x12')]);}logger['error'](_0xfd4b('0xc'),_0x25e5cc,_0x1f03ea['error']['message']);return _0x414586(_0x1f03ea[_0xfd4b('0x11')][_0xfd4b('0x12')]);}else{logger['info'](_0xfd4b('0xc'),_0x25e5cc,_0xfd4b('0xf'));_0x414586(_0x1f03ea[_0xfd4b('0x13')][_0xfd4b('0x12')]);}})[_0xfd4b('0x14')](function(_0x56b493){logger[_0xfd4b('0x11')](_0xfd4b('0xc'),_0x25e5cc,_0x56b493);_0x124123(_0x56b493);});});} \ No newline at end of file +var _0x0a91=['../../config/environment','jayson/promise','client','request','then','info','request\x20sent','ZohoField,\x20%s,\x20%s,\x20%s','stringify','error','code','message','ZohoField,\x20%s,\x20%s','result','catch','lodash','moment','bluebird','randomstring','../../mysqldb','../../config/utils','../../config/logger','rpc'];(function(_0x5a0bad,_0x566692){var _0x1239c5=function(_0x2ab0bf){while(--_0x2ab0bf){_0x5a0bad['push'](_0x5a0bad['shift']());}};_0x1239c5(++_0x566692);}(_0x0a91,0x123));var _0x10a9=function(_0x3a8cab,_0x375ef7){_0x3a8cab=_0x3a8cab-0x0;var _0x2be7ad=_0x0a91[_0x3a8cab];return _0x2be7ad;};'use strict';var _=require(_0x10a9('0x0'));var util=require('util');var moment=require(_0x10a9('0x1'));var BPromise=require(_0x10a9('0x2'));var rs=require(_0x10a9('0x3'));var fs=require('fs');var Redis=require('ioredis');var db=require(_0x10a9('0x4'))['db'];var utils=require(_0x10a9('0x5'));var logger=require(_0x10a9('0x6'))(_0x10a9('0x7'));var config=require(_0x10a9('0x8'));var jayson=require(_0x10a9('0x9'));var client=jayson[_0x10a9('0xa')]['http']({'port':0x232a});function respondWithRpcPromise(_0x9775fb,_0x268c8d,_0x149548){return new BPromise(function(_0x1d5dae,_0x193195){return client[_0x10a9('0xb')](_0x9775fb,_0x149548)[_0x10a9('0xc')](function(_0x2b8081){logger[_0x10a9('0xd')]('ZohoField,\x20%s,\x20%s',_0x268c8d,_0x10a9('0xe'));logger['debug'](_0x10a9('0xf'),_0x268c8d,_0x10a9('0xe'),JSON[_0x10a9('0x10')](_0x2b8081));if(_0x2b8081[_0x10a9('0x11')]){if(_0x2b8081[_0x10a9('0x11')][_0x10a9('0x12')]===0x1f4){logger[_0x10a9('0x11')]('ZohoField,\x20%s,\x20%s',_0x268c8d,_0x2b8081[_0x10a9('0x11')]['message']);return _0x193195(_0x2b8081[_0x10a9('0x11')][_0x10a9('0x13')]);}logger['error'](_0x10a9('0x14'),_0x268c8d,_0x2b8081[_0x10a9('0x11')]['message']);return _0x1d5dae(_0x2b8081['error'][_0x10a9('0x13')]);}else{logger[_0x10a9('0xd')](_0x10a9('0x14'),_0x268c8d,_0x10a9('0xe'));_0x1d5dae(_0x2b8081[_0x10a9('0x15')][_0x10a9('0x13')]);}})[_0x10a9('0x16')](function(_0x147250){logger[_0x10a9('0x11')](_0x10a9('0x14'),_0x268c8d,_0x147250);_0x193195(_0x147250);});});} \ No newline at end of file diff --git a/server/api/integration/index.js b/server/api/integration/index.js index 658bcbe..89c1bef 100644 --- a/server/api/integration/index.js +++ b/server/api/integration/index.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x0713=['../../config/environment','exports','path','connect-timeout','express','Router','fs-extra','../../components/interaction/service'];(function(_0x395be7,_0x3dab8b){var _0x4966d0=function(_0x592f8b){while(--_0x592f8b){_0x395be7['push'](_0x395be7['shift']());}};_0x4966d0(++_0x3dab8b);}(_0x0713,0x1ba));var _0x3071=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0x0713[_0x3dd15e];return _0x231fd0;};'use strict';var multer=require('multer');var util=require('util');var path=require(_0x3071('0x0'));var timeout=require(_0x3071('0x1'));var express=require(_0x3071('0x2'));var router=express[_0x3071('0x3')]();var fs_extra=require(_0x3071('0x4'));var auth=require('../../components/auth/service');var interaction=require(_0x3071('0x5'));var config=require(_0x3071('0x6'));module[_0x3071('0x7')]=router; \ No newline at end of file +var _0x9c44=['express','Router','fs-extra','../../components/auth/service','exports','path','connect-timeout'];(function(_0x5b4303,_0x225e71){var _0x1aacba=function(_0x1ac0d0){while(--_0x1ac0d0){_0x5b4303['push'](_0x5b4303['shift']());}};_0x1aacba(++_0x225e71);}(_0x9c44,0x178));var _0x49c4=function(_0x1969a7,_0x5a133a){_0x1969a7=_0x1969a7-0x0;var _0x3d665f=_0x9c44[_0x1969a7];return _0x3d665f;};'use strict';var multer=require('multer');var util=require('util');var path=require(_0x49c4('0x0'));var timeout=require(_0x49c4('0x1'));var express=require(_0x49c4('0x2'));var router=express[_0x49c4('0x3')]();var fs_extra=require(_0x49c4('0x4'));var auth=require(_0x49c4('0x5'));var interaction=require('../../components/interaction/service');var config=require('../../config/environment');module[_0x49c4('0x6')]=router; \ No newline at end of file diff --git a/server/api/integration/integration.attributes.js b/server/api/integration/integration.attributes.js index 71c6b0f..6d9b51d 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 _0x2f0c=['sequelize','exports','unique_name_and_version','STRING','app.js','INTEGER','BOOLEAN','state'];(function(_0x4cf78f,_0x457d20){var _0x358151=function(_0xda5153){while(--_0xda5153){_0x4cf78f['push'](_0x4cf78f['shift']());}};_0x358151(++_0x457d20);}(_0x2f0c,0xe8));var _0xc2f0=function(_0x315b61,_0x4bb11e){_0x315b61=_0x315b61-0x0;var _0x3521e8=_0x2f0c[_0x315b61];return _0x3521e8;};'use strict';var Sequelize=require(_0xc2f0('0x0'));module[_0xc2f0('0x1')]={'name':{'type':Sequelize['STRING'],'allowNull':![],'unique':_0xc2f0('0x2')},'version':{'type':Sequelize[_0xc2f0('0x3')],'allowNull':![],'unique':_0xc2f0('0x2')},'main':{'type':Sequelize[_0xc2f0('0x3')],'defaultValue':_0xc2f0('0x4')},'filename':{'type':Sequelize[_0xc2f0('0x3')]},'path':{'type':Sequelize[_0xc2f0('0x3')]},'type':{'type':Sequelize[_0xc2f0('0x3')]},'size':{'type':Sequelize[_0xc2f0('0x5')]},'active':{'type':Sequelize[_0xc2f0('0x6')],'defaultValue':![]},'author':{'type':Sequelize[_0xc2f0('0x3')]},'logo':{'type':Sequelize[_0xc2f0('0x3')]},'state':{'type':Sequelize['STRING'],'unique':_0xc2f0('0x7')},'description':{'type':Sequelize['STRING']},'title':{'type':Sequelize[_0xc2f0('0x3')]},'remoteUri':{'type':Sequelize[_0xc2f0('0x3')]},'link':{'type':Sequelize[_0xc2f0('0x3')],'defaultValue':'#'}}; \ No newline at end of file +var _0xe152=['state','sequelize','STRING','unique_name_and_version','app.js','INTEGER','BOOLEAN'];(function(_0x5a9c0c,_0x4ec485){var _0x53c77d=function(_0x1cf384){while(--_0x1cf384){_0x5a9c0c['push'](_0x5a9c0c['shift']());}};_0x53c77d(++_0x4ec485);}(_0xe152,0x158));var _0x2e15=function(_0x36f024,_0x3f4a9d){_0x36f024=_0x36f024-0x0;var _0x50ee9d=_0xe152[_0x36f024];return _0x50ee9d;};'use strict';var Sequelize=require(_0x2e15('0x0'));module['exports']={'name':{'type':Sequelize[_0x2e15('0x1')],'allowNull':![],'unique':_0x2e15('0x2')},'version':{'type':Sequelize[_0x2e15('0x1')],'allowNull':![],'unique':_0x2e15('0x2')},'main':{'type':Sequelize[_0x2e15('0x1')],'defaultValue':_0x2e15('0x3')},'filename':{'type':Sequelize[_0x2e15('0x1')]},'path':{'type':Sequelize[_0x2e15('0x1')]},'type':{'type':Sequelize[_0x2e15('0x1')]},'size':{'type':Sequelize[_0x2e15('0x4')]},'active':{'type':Sequelize[_0x2e15('0x5')],'defaultValue':![]},'author':{'type':Sequelize[_0x2e15('0x1')]},'logo':{'type':Sequelize[_0x2e15('0x1')]},'state':{'type':Sequelize[_0x2e15('0x1')],'unique':_0x2e15('0x6')},'description':{'type':Sequelize['STRING']},'title':{'type':Sequelize[_0x2e15('0x1')]},'remoteUri':{'type':Sequelize[_0x2e15('0x1')]},'link':{'type':Sequelize[_0x2e15('0x1')],'defaultValue':'#'}}; \ No newline at end of file diff --git a/server/api/integration/integration.controller.js b/server/api/integration/integration.controller.js index 430f9c6..7c1fadf 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 _0x1a85=['includeAll','find','create','body','params','destroy','zip-dir','fast-json-patch','request-promise','mustache','util','path','to-csv','fs-extra','squel','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','../../mysqldb','sendStatus','status','json','offset','undefined','limit','count','set','Content-Range','apply','reject','update','then','end','error','stack','name','send','index','Integration','rawAttributes','fieldName','type','model','query','keys','filters','attributes','intersection','length','hasOwnProperty','nolimit','sort','where','pick','map','VIRTUAL','merge','options','include','findAll','rows','catch','show','fields'];(function(_0x1a2129,_0x13be7e){var _0xd30b98=function(_0x796c1c){while(--_0x796c1c){_0x1a2129['push'](_0x1a2129['shift']());}};_0xd30b98(++_0x13be7e);}(_0x1a85,0x178));var _0x51a8=function(_0x353598,_0x33e234){_0x353598=_0x353598-0x0;var _0x4cf82e=_0x1a85[_0x353598];return _0x4cf82e;};'use strict';var emlformat=require('eml-format');var rimraf=require('rimraf');var zipdir=require(_0x51a8('0x0'));var jsonpatch=require(_0x51a8('0x1'));var rp=require(_0x51a8('0x2'));var moment=require('moment');var BPromise=require('bluebird');var Mustache=require(_0x51a8('0x3'));var util=require(_0x51a8('0x4'));var path=require(_0x51a8('0x5'));var sox=require('sox');var csv=require(_0x51a8('0x6'));var ejs=require('ejs');var fs=require('fs');var fs_extra=require(_0x51a8('0x7'));var _=require('lodash');var squel=require(_0x51a8('0x8'));var crypto=require(_0x51a8('0x9'));var jsforce=require('jsforce');var deskjs=require(_0x51a8('0xa'));var toCsv=require('to-csv');var querystring=require('querystring');var Papa=require(_0x51a8('0xb'));var Redis=require(_0x51a8('0xc'));var authService=require(_0x51a8('0xd'));var qs=require(_0x51a8('0xe'));var as=require(_0x51a8('0xf'));var hardwareService=require(_0x51a8('0x10'));var logger=require(_0x51a8('0x11'))(_0x51a8('0x12'));var utils=require(_0x51a8('0x13'));var config=require(_0x51a8('0x14'));var licenseUtil=require(_0x51a8('0x15'));var db=require(_0x51a8('0x16'))['db'];function respondWithStatusCode(_0x38a1d2,_0x1827e6){_0x1827e6=_0x1827e6||0xcc;return function(_0x43c042){if(_0x43c042){return _0x38a1d2[_0x51a8('0x17')](_0x1827e6);}return _0x38a1d2[_0x51a8('0x18')](_0x1827e6)['end']();};}function respondWithResult(_0x461f5c,_0x7a4c36){_0x7a4c36=_0x7a4c36||0xc8;return function(_0xaec066){if(_0xaec066){return _0x461f5c['status'](_0x7a4c36)[_0x51a8('0x19')](_0xaec066);}};}function respondWithFilteredResult(_0x547d40,_0x10584b){return function(_0x2b8d37){if(_0x2b8d37){var _0x39cd45=typeof _0x10584b[_0x51a8('0x1a')]===_0x51a8('0x1b')&&typeof _0x10584b[_0x51a8('0x1c')]===_0x51a8('0x1b');var _0x516abc=_0x2b8d37[_0x51a8('0x1d')];var _0x45a433=_0x39cd45?0x0:_0x10584b[_0x51a8('0x1a')];var _0x23539e=_0x39cd45?_0x2b8d37[_0x51a8('0x1d')]:_0x10584b[_0x51a8('0x1a')]+_0x10584b['limit'];var _0x1df8c2;if(_0x23539e>=_0x516abc){_0x23539e=_0x516abc;_0x1df8c2=0xc8;}else{_0x1df8c2=0xce;}_0x547d40[_0x51a8('0x18')](_0x1df8c2);return _0x547d40[_0x51a8('0x1e')](_0x51a8('0x1f'),_0x45a433+'-'+_0x23539e+'/'+_0x516abc)[_0x51a8('0x19')](_0x2b8d37);}return null;};}function patchUpdates(_0x3bc044){return function(_0x28aea0){try{jsonpatch[_0x51a8('0x20')](_0x28aea0,_0x3bc044,!![]);}catch(_0x5ac1c0){return BPromise[_0x51a8('0x21')](_0x5ac1c0);}return _0x28aea0['save']();};}function saveUpdates(_0xfe0ddb,_0x12c029){return function(_0x8bda40){if(_0x8bda40){return _0x8bda40[_0x51a8('0x22')](_0xfe0ddb)['then'](function(_0xae3588){return _0xae3588;});}return null;};}function removeEntity(_0x4b9cdd,_0x47f063){return function(_0x23d26a){if(_0x23d26a){return _0x23d26a['destroy']()[_0x51a8('0x23')](function(){_0x4b9cdd[_0x51a8('0x18')](0xcc)[_0x51a8('0x24')]();});}};}function handleEntityNotFound(_0x18e2f3,_0x157554){return function(_0x2f2f05){if(!_0x2f2f05){_0x18e2f3[_0x51a8('0x17')](0x194);}return _0x2f2f05;};}function handleError(_0x1326a2,_0x5b3f49){_0x5b3f49=_0x5b3f49||0x1f4;return function(_0x273ce2){logger[_0x51a8('0x25')](_0x273ce2[_0x51a8('0x26')]);if(_0x273ce2[_0x51a8('0x27')]){delete _0x273ce2[_0x51a8('0x27')];}_0x1326a2[_0x51a8('0x18')](_0x5b3f49)[_0x51a8('0x28')](_0x273ce2);};}exports[_0x51a8('0x29')]=function(_0xec08ae,_0x4b5cda){var _0x20c6b5={},_0x347a02={},_0x4a1548={'count':0x0,'rows':[]};var _0x2f9d53=_['map'](db[_0x51a8('0x2a')][_0x51a8('0x2b')],function(_0x143f46){return{'name':_0x143f46[_0x51a8('0x2c')],'type':_0x143f46[_0x51a8('0x2d')]['key']};});_0x347a02[_0x51a8('0x2e')]=_['map'](_0x2f9d53,_0x51a8('0x27'));_0x347a02[_0x51a8('0x2f')]=_[_0x51a8('0x30')](_0xec08ae['query']);_0x347a02[_0x51a8('0x31')]=_['intersection'](_0x347a02[_0x51a8('0x2e')],_0x347a02[_0x51a8('0x2f')]);_0x20c6b5[_0x51a8('0x32')]=_[_0x51a8('0x33')](_0x347a02[_0x51a8('0x2e')],qs['fields'](_0xec08ae[_0x51a8('0x2f')]['fields']));_0x20c6b5[_0x51a8('0x32')]=_0x20c6b5[_0x51a8('0x32')][_0x51a8('0x34')]?_0x20c6b5['attributes']:_0x347a02[_0x51a8('0x2e')];if(!_0xec08ae[_0x51a8('0x2f')][_0x51a8('0x35')](_0x51a8('0x36'))){_0x20c6b5[_0x51a8('0x1c')]=qs['limit'](_0xec08ae['query']['limit']);_0x20c6b5[_0x51a8('0x1a')]=qs[_0x51a8('0x1a')](_0xec08ae['query'][_0x51a8('0x1a')]);}_0x20c6b5['order']=qs[_0x51a8('0x37')](_0xec08ae[_0x51a8('0x2f')][_0x51a8('0x37')]);_0x20c6b5[_0x51a8('0x38')]=qs[_0x51a8('0x31')](_[_0x51a8('0x39')](_0xec08ae['query'],_0x347a02['filters']),_0x2f9d53);if(_0xec08ae[_0x51a8('0x2f')]['filter']){_0x20c6b5['where']=_['merge'](_0x20c6b5[_0x51a8('0x38')],{'$or':_[_0x51a8('0x3a')](_0x2f9d53,function(_0x3cbf97){if(_0x3cbf97['type']!==_0x51a8('0x3b')){var _0x25d772={};_0x25d772[_0x3cbf97[_0x51a8('0x27')]]={'$like':'%'+_0xec08ae[_0x51a8('0x2f')]['filter']+'%'};return _0x25d772;}})});}_0x20c6b5=_[_0x51a8('0x3c')]({},_0x20c6b5,_0xec08ae[_0x51a8('0x3d')]);var _0x1b0333={'where':_0x20c6b5['where']};return db[_0x51a8('0x2a')]['count'](_0x1b0333)[_0x51a8('0x23')](function(_0x1e637a){_0x4a1548[_0x51a8('0x1d')]=_0x1e637a;if(_0xec08ae[_0x51a8('0x2f')]['includeAll']){_0x20c6b5[_0x51a8('0x3e')]=[{'all':!![]}];}return db[_0x51a8('0x2a')][_0x51a8('0x3f')](_0x20c6b5);})[_0x51a8('0x23')](function(_0xa33fc){_0x4a1548[_0x51a8('0x40')]=_0xa33fc;return _0x4a1548;})[_0x51a8('0x23')](respondWithFilteredResult(_0x4b5cda,_0x20c6b5))[_0x51a8('0x41')](handleError(_0x4b5cda,null));};exports[_0x51a8('0x42')]=function(_0x4b8467,_0x22e6e6){var _0x2afb74={'raw':![],'where':{'id':_0x4b8467['params']['id']}},_0x4c7c67={};_0x4c7c67[_0x51a8('0x2e')]=_[_0x51a8('0x30')](db[_0x51a8('0x2a')][_0x51a8('0x2b')]);_0x4c7c67[_0x51a8('0x2f')]=_[_0x51a8('0x30')](_0x4b8467[_0x51a8('0x2f')]);_0x4c7c67[_0x51a8('0x31')]=_[_0x51a8('0x33')](_0x4c7c67[_0x51a8('0x2e')],_0x4c7c67['query']);_0x2afb74[_0x51a8('0x32')]=_[_0x51a8('0x33')](_0x4c7c67[_0x51a8('0x2e')],qs[_0x51a8('0x43')](_0x4b8467[_0x51a8('0x2f')][_0x51a8('0x43')]));_0x2afb74['attributes']=_0x2afb74[_0x51a8('0x32')]['length']?_0x2afb74[_0x51a8('0x32')]:_0x4c7c67[_0x51a8('0x2e')];if(_0x4b8467[_0x51a8('0x2f')][_0x51a8('0x44')]){_0x2afb74[_0x51a8('0x3e')]=[{'all':!![]}];}_0x2afb74=_['merge']({},_0x2afb74,_0x4b8467['options']);return db[_0x51a8('0x2a')][_0x51a8('0x45')](_0x2afb74)[_0x51a8('0x23')](handleEntityNotFound(_0x22e6e6,null))[_0x51a8('0x23')](respondWithResult(_0x22e6e6,null))[_0x51a8('0x41')](handleError(_0x22e6e6,null));};exports['create']=function(_0x504a43,_0xcbd998){return db[_0x51a8('0x2a')][_0x51a8('0x46')](_0x504a43[_0x51a8('0x47')],{})[_0x51a8('0x23')](respondWithResult(_0xcbd998,0xc9))[_0x51a8('0x41')](handleError(_0xcbd998,null));};exports[_0x51a8('0x22')]=function(_0x1103a3,_0x301578){if(_0x1103a3['body']['id']){delete _0x1103a3['body']['id'];}return db['Integration'][_0x51a8('0x45')]({'where':{'id':_0x1103a3[_0x51a8('0x48')]['id']}})[_0x51a8('0x23')](handleEntityNotFound(_0x301578,null))['then'](saveUpdates(_0x1103a3[_0x51a8('0x47')],null))[_0x51a8('0x23')](respondWithResult(_0x301578,null))['catch'](handleError(_0x301578,null));};exports[_0x51a8('0x49')]=function(_0x4fb93c,_0x50a2f8){return db[_0x51a8('0x2a')][_0x51a8('0x45')]({'where':{'id':_0x4fb93c[_0x51a8('0x48')]['id']}})['then'](handleEntityNotFound(_0x50a2f8,null))['then'](removeEntity(_0x50a2f8,null))[_0x51a8('0x41')](handleError(_0x50a2f8,null));}; \ No newline at end of file +var _0x781d=['../../config/license/hardware','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','sendStatus','status','end','offset','undefined','limit','count','Content-Range','json','apply','reject','update','destroy','then','error','name','send','index','map','Integration','fieldName','type','key','query','keys','intersection','model','attributes','fields','length','nolimit','order','where','filters','filter','merge','VIRTUAL','includeAll','catch','show','params','rawAttributes','options','body','find','eml-format','rimraf','request-promise','moment','bluebird','mustache','util','path','sox','to-csv','ejs','fs-extra','squel','crypto','jsforce','desk.js','querystring','ioredis','../../components/auth/service','../../components/parsers/advancedSearch'];(function(_0x37c043,_0x265504){var _0xf2cfec=function(_0x1cfb41){while(--_0x1cfb41){_0x37c043['push'](_0x37c043['shift']());}};_0xf2cfec(++_0x265504);}(_0x781d,0x14a));var _0xd781=function(_0x397e5f,_0x454c8f){_0x397e5f=_0x397e5f-0x0;var _0x5302b8=_0x781d[_0x397e5f];return _0x5302b8;};'use strict';var emlformat=require(_0xd781('0x0'));var rimraf=require(_0xd781('0x1'));var zipdir=require('zip-dir');var jsonpatch=require('fast-json-patch');var rp=require(_0xd781('0x2'));var moment=require(_0xd781('0x3'));var BPromise=require(_0xd781('0x4'));var Mustache=require(_0xd781('0x5'));var util=require(_0xd781('0x6'));var path=require(_0xd781('0x7'));var sox=require(_0xd781('0x8'));var csv=require(_0xd781('0x9'));var ejs=require(_0xd781('0xa'));var fs=require('fs');var fs_extra=require(_0xd781('0xb'));var _=require('lodash');var squel=require(_0xd781('0xc'));var crypto=require(_0xd781('0xd'));var jsforce=require(_0xd781('0xe'));var deskjs=require(_0xd781('0xf'));var toCsv=require('to-csv');var querystring=require(_0xd781('0x10'));var Papa=require('papaparse');var Redis=require(_0xd781('0x11'));var authService=require(_0xd781('0x12'));var qs=require('../../components/parsers/qs');var as=require(_0xd781('0x13'));var hardwareService=require(_0xd781('0x14'));var logger=require('../../config/logger')('api');var utils=require(_0xd781('0x15'));var config=require(_0xd781('0x16'));var licenseUtil=require(_0xd781('0x17'));var db=require(_0xd781('0x18'))['db'];function respondWithStatusCode(_0xbea78b,_0x1f2f1e){_0x1f2f1e=_0x1f2f1e||0xcc;return function(_0xc7758f){if(_0xc7758f){return _0xbea78b[_0xd781('0x19')](_0x1f2f1e);}return _0xbea78b[_0xd781('0x1a')](_0x1f2f1e)[_0xd781('0x1b')]();};}function respondWithResult(_0xd454e7,_0x587953){_0x587953=_0x587953||0xc8;return function(_0x477bdc){if(_0x477bdc){return _0xd454e7[_0xd781('0x1a')](_0x587953)['json'](_0x477bdc);}};}function respondWithFilteredResult(_0x3a1f48,_0x48bffc){return function(_0x294e5a){if(_0x294e5a){var _0x22d787=typeof _0x48bffc[_0xd781('0x1c')]===_0xd781('0x1d')&&typeof _0x48bffc[_0xd781('0x1e')]===_0xd781('0x1d');var _0x501b0d=_0x294e5a['count'];var _0x1407fc=_0x22d787?0x0:_0x48bffc[_0xd781('0x1c')];var _0x395d9c=_0x22d787?_0x294e5a[_0xd781('0x1f')]:_0x48bffc[_0xd781('0x1c')]+_0x48bffc[_0xd781('0x1e')];var _0x260aa8;if(_0x395d9c>=_0x501b0d){_0x395d9c=_0x501b0d;_0x260aa8=0xc8;}else{_0x260aa8=0xce;}_0x3a1f48[_0xd781('0x1a')](_0x260aa8);return _0x3a1f48['set'](_0xd781('0x20'),_0x1407fc+'-'+_0x395d9c+'/'+_0x501b0d)[_0xd781('0x21')](_0x294e5a);}return null;};}function patchUpdates(_0x1036d3){return function(_0x103758){try{jsonpatch[_0xd781('0x22')](_0x103758,_0x1036d3,!![]);}catch(_0x274665){return BPromise[_0xd781('0x23')](_0x274665);}return _0x103758['save']();};}function saveUpdates(_0xe0c65f,_0x4e2c56){return function(_0x567fdf){if(_0x567fdf){return _0x567fdf[_0xd781('0x24')](_0xe0c65f)['then'](function(_0x175ba6){return _0x175ba6;});}return null;};}function removeEntity(_0x101480,_0x395087){return function(_0x31bf57){if(_0x31bf57){return _0x31bf57[_0xd781('0x25')]()[_0xd781('0x26')](function(){_0x101480[_0xd781('0x1a')](0xcc)[_0xd781('0x1b')]();});}};}function handleEntityNotFound(_0x10940b,_0x5662db){return function(_0x529ca1){if(!_0x529ca1){_0x10940b[_0xd781('0x19')](0x194);}return _0x529ca1;};}function handleError(_0x849587,_0xdad0b1){_0xdad0b1=_0xdad0b1||0x1f4;return function(_0x57b41e){logger[_0xd781('0x27')](_0x57b41e['stack']);if(_0x57b41e['name']){delete _0x57b41e[_0xd781('0x28')];}_0x849587['status'](_0xdad0b1)[_0xd781('0x29')](_0x57b41e);};}exports[_0xd781('0x2a')]=function(_0x5c3848,_0x5b6b9d){var _0x43cc74={},_0x5b0464={},_0x296a0b={'count':0x0,'rows':[]};var _0x4a3bd3=_[_0xd781('0x2b')](db[_0xd781('0x2c')]['rawAttributes'],function(_0x54521e){return{'name':_0x54521e[_0xd781('0x2d')],'type':_0x54521e[_0xd781('0x2e')][_0xd781('0x2f')]};});_0x5b0464['model']=_['map'](_0x4a3bd3,_0xd781('0x28'));_0x5b0464[_0xd781('0x30')]=_[_0xd781('0x31')](_0x5c3848['query']);_0x5b0464['filters']=_[_0xd781('0x32')](_0x5b0464[_0xd781('0x33')],_0x5b0464['query']);_0x43cc74[_0xd781('0x34')]=_[_0xd781('0x32')](_0x5b0464['model'],qs[_0xd781('0x35')](_0x5c3848[_0xd781('0x30')][_0xd781('0x35')]));_0x43cc74[_0xd781('0x34')]=_0x43cc74['attributes'][_0xd781('0x36')]?_0x43cc74[_0xd781('0x34')]:_0x5b0464[_0xd781('0x33')];if(!_0x5c3848[_0xd781('0x30')]['hasOwnProperty'](_0xd781('0x37'))){_0x43cc74[_0xd781('0x1e')]=qs['limit'](_0x5c3848[_0xd781('0x30')]['limit']);_0x43cc74[_0xd781('0x1c')]=qs[_0xd781('0x1c')](_0x5c3848['query'][_0xd781('0x1c')]);}_0x43cc74[_0xd781('0x38')]=qs['sort'](_0x5c3848[_0xd781('0x30')]['sort']);_0x43cc74[_0xd781('0x39')]=qs[_0xd781('0x3a')](_['pick'](_0x5c3848[_0xd781('0x30')],_0x5b0464[_0xd781('0x3a')]),_0x4a3bd3);if(_0x5c3848['query'][_0xd781('0x3b')]){_0x43cc74[_0xd781('0x39')]=_[_0xd781('0x3c')](_0x43cc74['where'],{'$or':_[_0xd781('0x2b')](_0x4a3bd3,function(_0x22b94e){if(_0x22b94e[_0xd781('0x2e')]!==_0xd781('0x3d')){var _0x2e8218={};_0x2e8218[_0x22b94e[_0xd781('0x28')]]={'$like':'%'+_0x5c3848[_0xd781('0x30')][_0xd781('0x3b')]+'%'};return _0x2e8218;}})});}_0x43cc74=_[_0xd781('0x3c')]({},_0x43cc74,_0x5c3848['options']);var _0x2a60d6={'where':_0x43cc74['where']};return db[_0xd781('0x2c')][_0xd781('0x1f')](_0x2a60d6)['then'](function(_0x1a5833){_0x296a0b[_0xd781('0x1f')]=_0x1a5833;if(_0x5c3848[_0xd781('0x30')][_0xd781('0x3e')]){_0x43cc74['include']=[{'all':!![]}];}return db[_0xd781('0x2c')]['findAll'](_0x43cc74);})[_0xd781('0x26')](function(_0xcdaacf){_0x296a0b['rows']=_0xcdaacf;return _0x296a0b;})['then'](respondWithFilteredResult(_0x5b6b9d,_0x43cc74))[_0xd781('0x3f')](handleError(_0x5b6b9d,null));};exports[_0xd781('0x40')]=function(_0x15b49d,_0x23bbab){var _0x53aba6={'raw':![],'where':{'id':_0x15b49d[_0xd781('0x41')]['id']}},_0x46e7f6={};_0x46e7f6['model']=_['keys'](db[_0xd781('0x2c')][_0xd781('0x42')]);_0x46e7f6[_0xd781('0x30')]=_['keys'](_0x15b49d['query']);_0x46e7f6[_0xd781('0x3a')]=_[_0xd781('0x32')](_0x46e7f6[_0xd781('0x33')],_0x46e7f6[_0xd781('0x30')]);_0x53aba6[_0xd781('0x34')]=_[_0xd781('0x32')](_0x46e7f6['model'],qs['fields'](_0x15b49d[_0xd781('0x30')][_0xd781('0x35')]));_0x53aba6[_0xd781('0x34')]=_0x53aba6[_0xd781('0x34')][_0xd781('0x36')]?_0x53aba6['attributes']:_0x46e7f6[_0xd781('0x33')];if(_0x15b49d[_0xd781('0x30')][_0xd781('0x3e')]){_0x53aba6['include']=[{'all':!![]}];}_0x53aba6=_[_0xd781('0x3c')]({},_0x53aba6,_0x15b49d[_0xd781('0x43')]);return db[_0xd781('0x2c')]['find'](_0x53aba6)[_0xd781('0x26')](handleEntityNotFound(_0x23bbab,null))[_0xd781('0x26')](respondWithResult(_0x23bbab,null))['catch'](handleError(_0x23bbab,null));};exports['create']=function(_0x13a907,_0x16d16e){return db[_0xd781('0x2c')]['create'](_0x13a907[_0xd781('0x44')],{})[_0xd781('0x26')](respondWithResult(_0x16d16e,0xc9))[_0xd781('0x3f')](handleError(_0x16d16e,null));};exports[_0xd781('0x24')]=function(_0x336d30,_0x3828ad){if(_0x336d30[_0xd781('0x44')]['id']){delete _0x336d30['body']['id'];}return db[_0xd781('0x2c')][_0xd781('0x45')]({'where':{'id':_0x336d30[_0xd781('0x41')]['id']}})['then'](handleEntityNotFound(_0x3828ad,null))[_0xd781('0x26')](saveUpdates(_0x336d30[_0xd781('0x44')],null))['then'](respondWithResult(_0x3828ad,null))[_0xd781('0x3f')](handleError(_0x3828ad,null));};exports[_0xd781('0x25')]=function(_0x41caac,_0x207546){return db[_0xd781('0x2c')]['find']({'where':{'id':_0x41caac[_0xd781('0x41')]['id']}})['then'](handleEntityNotFound(_0x207546,null))[_0xd781('0x26')](removeEntity(_0x207546,null))['catch'](handleError(_0x207546,null));}; \ No newline at end of file diff --git a/server/api/integration/integration.model.js b/server/api/integration/integration.model.js index aee5063..ccf9059 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 _0x8ca0=['api','moment','bluebird','request-promise','path','rimraf','../../config/environment','./integration.attributes','Integration','integrations','lodash','../../config/logger'];(function(_0x5c1c86,_0x2fc9b3){var _0x439edf=function(_0xc702f4){while(--_0xc702f4){_0x5c1c86['push'](_0x5c1c86['shift']());}};_0x439edf(++_0x2fc9b3);}(_0x8ca0,0x1c6));var _0x08ca=function(_0x59aeeb,_0x400591){_0x59aeeb=_0x59aeeb-0x0;var _0x11999f=_0x8ca0[_0x59aeeb];return _0x11999f;};'use strict';var _=require(_0x08ca('0x0'));var util=require('util');var logger=require(_0x08ca('0x1'))(_0x08ca('0x2'));var moment=require(_0x08ca('0x3'));var BPromise=require(_0x08ca('0x4'));var rp=require(_0x08ca('0x5'));var fs=require('fs');var path=require(_0x08ca('0x6'));var rimraf=require(_0x08ca('0x7'));var config=require(_0x08ca('0x8'));var attributes=require(_0x08ca('0x9'));module['exports']=function(_0x207540,_0x1d4e2e){return _0x207540['define'](_0x08ca('0xa'),attributes,{'tableName':_0x08ca('0xb'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x0818=['exports','define','Integration','lodash','util','../../config/logger','api','moment','bluebird','request-promise','path','../../config/environment','./integration.attributes'];(function(_0x401fc9,_0x2366a4){var _0x5ae086=function(_0x36a58d){while(--_0x36a58d){_0x401fc9['push'](_0x401fc9['shift']());}};_0x5ae086(++_0x2366a4);}(_0x0818,0x196));var _0x8081=function(_0x5f5b7a,_0x563e61){_0x5f5b7a=_0x5f5b7a-0x0;var _0x7d276d=_0x0818[_0x5f5b7a];return _0x7d276d;};'use strict';var _=require(_0x8081('0x0'));var util=require(_0x8081('0x1'));var logger=require(_0x8081('0x2'))(_0x8081('0x3'));var moment=require(_0x8081('0x4'));var BPromise=require(_0x8081('0x5'));var rp=require(_0x8081('0x6'));var fs=require('fs');var path=require(_0x8081('0x7'));var rimraf=require('rimraf');var config=require(_0x8081('0x8'));var attributes=require(_0x8081('0x9'));module[_0x8081('0xa')]=function(_0x2cd1da,_0x2455a3){return _0x2cd1da[_0x8081('0xb')](_0x8081('0xc'),attributes,{'tableName':'integrations','paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/integration/integration.rpc.js b/server/api/integration/integration.rpc.js index bdeded9..c9eb62e 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 _0xc6ac=['http','request','then','info','Integration,\x20%s,\x20%s','debug','Integration,\x20%s,\x20%s,\x20%s','request\x20sent','error','code','message','lodash','util','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','client'];(function(_0x778945,_0x4a9ec3){var _0x19cee3=function(_0x389c33){while(--_0x389c33){_0x778945['push'](_0x778945['shift']());}};_0x19cee3(++_0x4a9ec3);}(_0xc6ac,0x15b));var _0xcc6a=function(_0x2796ef,_0x39b8c8){_0x2796ef=_0x2796ef-0x0;var _0x12b5bb=_0xc6ac[_0x2796ef];return _0x12b5bb;};'use strict';var _=require(_0xcc6a('0x0'));var util=require(_0xcc6a('0x1'));var moment=require(_0xcc6a('0x2'));var BPromise=require(_0xcc6a('0x3'));var rs=require(_0xcc6a('0x4'));var fs=require('fs');var Redis=require(_0xcc6a('0x5'));var db=require(_0xcc6a('0x6'))['db'];var utils=require(_0xcc6a('0x7'));var logger=require(_0xcc6a('0x8'))(_0xcc6a('0x9'));var config=require(_0xcc6a('0xa'));var jayson=require(_0xcc6a('0xb'));var client=jayson[_0xcc6a('0xc')][_0xcc6a('0xd')]({'port':0x232a});function respondWithRpcPromise(_0x5f3887,_0x3dd497,_0x11b919){return new BPromise(function(_0xf02261,_0x560cc4){return client[_0xcc6a('0xe')](_0x5f3887,_0x11b919)[_0xcc6a('0xf')](function(_0x7806a0){logger[_0xcc6a('0x10')](_0xcc6a('0x11'),_0x3dd497,'request\x20sent');logger[_0xcc6a('0x12')](_0xcc6a('0x13'),_0x3dd497,_0xcc6a('0x14'),JSON['stringify'](_0x7806a0));if(_0x7806a0[_0xcc6a('0x15')]){if(_0x7806a0[_0xcc6a('0x15')][_0xcc6a('0x16')]===0x1f4){logger['error']('Integration,\x20%s,\x20%s',_0x3dd497,_0x7806a0[_0xcc6a('0x15')][_0xcc6a('0x17')]);return _0x560cc4(_0x7806a0[_0xcc6a('0x15')]['message']);}logger['error'](_0xcc6a('0x11'),_0x3dd497,_0x7806a0[_0xcc6a('0x15')][_0xcc6a('0x17')]);return _0xf02261(_0x7806a0[_0xcc6a('0x15')][_0xcc6a('0x17')]);}else{logger[_0xcc6a('0x10')](_0xcc6a('0x11'),_0x3dd497,_0xcc6a('0x14'));_0xf02261(_0x7806a0['result']['message']);}})['catch'](function(_0x395a55){logger[_0xcc6a('0x15')](_0xcc6a('0x11'),_0x3dd497,_0x395a55);_0x560cc4(_0x395a55);});});} \ No newline at end of file +var _0xc6ac=['http','request','then','info','Integration,\x20%s,\x20%s','debug','Integration,\x20%s,\x20%s,\x20%s','request\x20sent','error','code','message','lodash','util','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','client'];(function(_0x5804cf,_0x5df6a3){var _0x572379=function(_0x27953d){while(--_0x27953d){_0x5804cf['push'](_0x5804cf['shift']());}};_0x572379(++_0x5df6a3);}(_0xc6ac,0x15b));var _0xcc6a=function(_0x192e2d,_0x40607c){_0x192e2d=_0x192e2d-0x0;var _0x1ce536=_0xc6ac[_0x192e2d];return _0x1ce536;};'use strict';var _=require(_0xcc6a('0x0'));var util=require(_0xcc6a('0x1'));var moment=require(_0xcc6a('0x2'));var BPromise=require(_0xcc6a('0x3'));var rs=require(_0xcc6a('0x4'));var fs=require('fs');var Redis=require(_0xcc6a('0x5'));var db=require(_0xcc6a('0x6'))['db'];var utils=require(_0xcc6a('0x7'));var logger=require(_0xcc6a('0x8'))(_0xcc6a('0x9'));var config=require(_0xcc6a('0xa'));var jayson=require(_0xcc6a('0xb'));var client=jayson[_0xcc6a('0xc')][_0xcc6a('0xd')]({'port':0x232a});function respondWithRpcPromise(_0x5f3887,_0x3dd497,_0x11b919){return new BPromise(function(_0xf02261,_0x560cc4){return client[_0xcc6a('0xe')](_0x5f3887,_0x11b919)[_0xcc6a('0xf')](function(_0x7806a0){logger[_0xcc6a('0x10')](_0xcc6a('0x11'),_0x3dd497,'request\x20sent');logger[_0xcc6a('0x12')](_0xcc6a('0x13'),_0x3dd497,_0xcc6a('0x14'),JSON['stringify'](_0x7806a0));if(_0x7806a0[_0xcc6a('0x15')]){if(_0x7806a0[_0xcc6a('0x15')][_0xcc6a('0x16')]===0x1f4){logger['error']('Integration,\x20%s,\x20%s',_0x3dd497,_0x7806a0[_0xcc6a('0x15')][_0xcc6a('0x17')]);return _0x560cc4(_0x7806a0[_0xcc6a('0x15')]['message']);}logger['error'](_0xcc6a('0x11'),_0x3dd497,_0x7806a0[_0xcc6a('0x15')][_0xcc6a('0x17')]);return _0xf02261(_0x7806a0[_0xcc6a('0x15')][_0xcc6a('0x17')]);}else{logger[_0xcc6a('0x10')](_0xcc6a('0x11'),_0x3dd497,_0xcc6a('0x14'));_0xf02261(_0x7806a0['result']['message']);}})['catch'](function(_0x395a55){logger[_0xcc6a('0x15')](_0xcc6a('0x11'),_0x3dd497,_0x395a55);_0x560cc4(_0x395a55);});});} \ No newline at end of file diff --git a/server/api/integrationReport/index.js b/server/api/integrationReport/index.js index f95765d..8b1d2c4 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 _0x2ef3=['express','Router','../../components/auth/service','../../components/interaction/service','./integrationReport.controller','get','/describe','isAuthenticated','describe','/:id','show','post','update','delete','exports','multer','util','path','connect-timeout'];(function(_0x27a0de,_0x34eee0){var _0x4b8ca8=function(_0x5be63b){while(--_0x5be63b){_0x27a0de['push'](_0x27a0de['shift']());}};_0x4b8ca8(++_0x34eee0);}(_0x2ef3,0xba));var _0x32ef=function(_0x23d196,_0x4803c4){_0x23d196=_0x23d196-0x0;var _0x4fbb6b=_0x2ef3[_0x23d196];return _0x4fbb6b;};'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('0xf')]('/',auth[_0x32ef('0xb')](),controller['create']);router['put'](_0x32ef('0xd'),auth[_0x32ef('0xb')](),controller[_0x32ef('0x10')]);router[_0x32ef('0x11')]('/:id',auth[_0x32ef('0xb')](),controller['destroy']);module[_0x32ef('0x12')]=router; \ No newline at end of file +var _0x4137=['show','post','create','put','update','exports','multer','util','path','connect-timeout','express','Router','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','./integrationReport.controller','get','index','/describe','isAuthenticated','/:id'];(function(_0x297fd3,_0x115406){var _0x2af381=function(_0x1dd31b){while(--_0x1dd31b){_0x297fd3['push'](_0x297fd3['shift']());}};_0x2af381(++_0x115406);}(_0x4137,0xf8));var _0x7413=function(_0x1cc8fe,_0x105328){_0x1cc8fe=_0x1cc8fe-0x0;var _0x230054=_0x4137[_0x1cc8fe];return _0x230054;};'use strict';var multer=require(_0x7413('0x0'));var util=require(_0x7413('0x1'));var path=require(_0x7413('0x2'));var timeout=require(_0x7413('0x3'));var express=require(_0x7413('0x4'));var router=express[_0x7413('0x5')]();var fs_extra=require(_0x7413('0x6'));var auth=require(_0x7413('0x7'));var interaction=require(_0x7413('0x8'));var config=require(_0x7413('0x9'));var controller=require(_0x7413('0xa'));router[_0x7413('0xb')]('/',auth['isAuthenticated'](),controller[_0x7413('0xc')]);router[_0x7413('0xb')](_0x7413('0xd'),auth[_0x7413('0xe')](),controller['describe']);router[_0x7413('0xb')](_0x7413('0xf'),auth['isAuthenticated'](),controller[_0x7413('0x10')]);router[_0x7413('0x11')]('/',auth['isAuthenticated'](),controller[_0x7413('0x12')]);router[_0x7413('0x13')](_0x7413('0xf'),auth[_0x7413('0xe')](),controller[_0x7413('0x14')]);router['delete'](_0x7413('0xf'),auth[_0x7413('0xe')](),controller['destroy']);module[_0x7413('0x15')]=router; \ No newline at end of file diff --git a/server/api/integrationReport/integrationReport.attributes.js b/server/api/integrationReport/integrationReport.attributes.js index b42902e..56bfa0d 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 _0xba8b=['sequelize','STRING','INTEGER','DATE','BOOLEAN','TEXT','ENUM','SENT','SENDING','FAILED'];(function(_0x1d9aa0,_0x272488){var _0x226868=function(_0x17127c){while(--_0x17127c){_0x1d9aa0['push'](_0x1d9aa0['shift']());}};_0x226868(++_0x272488);}(_0xba8b,0xaa));var _0xbba8=function(_0x565ed7,_0x398228){_0x565ed7=_0x565ed7-0x0;var _0x183ad7=_0xba8b[_0x565ed7];return _0x183ad7;};'use strict';var Sequelize=require(_0xbba8('0x0'));module['exports']={'integration':{'type':Sequelize[_0xbba8('0x1')]},'eventChannel':{'type':Sequelize[_0xbba8('0x1')]},'exitStatus':{'type':Sequelize[_0xbba8('0x1')]},'ticketId':{'type':Sequelize[_0xbba8('0x1')]},'integrationId':{'type':Sequelize[_0xbba8('0x2')]},'contacts':{'type':Sequelize[_0xbba8('0x1')]},'uniqueid':{'type':Sequelize[_0xbba8('0x1')]},'calleridnum':{'type':Sequelize[_0xbba8('0x1')]},'calleridname':{'type':Sequelize[_0xbba8('0x1')]},'queue':{'type':Sequelize[_0xbba8('0x1')]},'interface':{'type':Sequelize['STRING']},'membername':{'type':Sequelize[_0xbba8('0x1')]},'agentcalledAt':{'type':Sequelize['DATE']},'agentconnectAt':{'type':Sequelize[_0xbba8('0x3')]},'holdtime':{'type':Sequelize[_0xbba8('0x2')]},'agentcomplete':{'type':Sequelize[_0xbba8('0x4')],'defaultValue':![]},'agentcompleteAt':{'type':Sequelize[_0xbba8('0x3')]},'talktime':{'type':Sequelize[_0xbba8('0x2')]},'agentacw':{'type':Sequelize[_0xbba8('0x4')],'defaultValue':![]},'acwtime':{'type':Sequelize[_0xbba8('0x2')]},'reason':{'type':Sequelize[_0xbba8('0x1')]},'agentringnoanswer':{'type':Sequelize[_0xbba8('0x4')],'defaultValue':![]},'agentringnoanswerAt':{'type':Sequelize['DATE']},'agentdump':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'agentdumpAt':{'type':Sequelize['DATE']},'lastevent':{'type':Sequelize[_0xbba8('0x1')]},'channel':{'type':Sequelize[_0xbba8('0x1')]},'channelstate':{'type':Sequelize['INTEGER']},'channelstatedesc':{'type':Sequelize[_0xbba8('0x1')]},'connectedlinenum':{'type':Sequelize[_0xbba8('0x1')]},'connectedlinename':{'type':Sequelize['STRING']},'language':{'type':Sequelize[_0xbba8('0x1')]},'accountcode':{'type':Sequelize[_0xbba8('0x1')]},'context':{'type':Sequelize[_0xbba8('0x1')]},'exten':{'type':Sequelize['STRING']},'priority':{'type':Sequelize['STRING']},'destchannel':{'type':Sequelize[_0xbba8('0x1')]},'destchannelstate':{'type':Sequelize['INTEGER']},'destchannelstatedesc':{'type':Sequelize[_0xbba8('0x1')]},'destcalleridnum':{'type':Sequelize['STRING']},'destcalleridname':{'type':Sequelize[_0xbba8('0x1')]},'destconnectedlinenum':{'type':Sequelize[_0xbba8('0x1')]},'destconnectedlinename':{'type':Sequelize[_0xbba8('0x1')]},'destlanguage':{'type':Sequelize['STRING']},'destaccountcode':{'type':Sequelize['STRING']},'destcontext':{'type':Sequelize['STRING']},'destexten':{'type':Sequelize[_0xbba8('0x1')]},'destpriority':{'type':Sequelize[_0xbba8('0x1')]},'destuniqueid':{'type':Sequelize[_0xbba8('0x1')]},'messageId':{'type':Sequelize[_0xbba8('0x1')]},'inReplyTo':{'type':Sequelize[_0xbba8('0x1')]},'subject':{'type':Sequelize['STRING']},'from':{'type':Sequelize[_0xbba8('0x1')]},'to':{'type':Sequelize['STRING']},'cc':{'type':Sequelize['STRING']},'attachment':{'type':Sequelize['TEXT']},'html':{'type':Sequelize[_0xbba8('0x5')]},'text':{'type':Sequelize['TEXT']},'status':{'type':Sequelize[_0xbba8('0x6')](_0xbba8('0x7'),_0xbba8('0x8'),'RECEIVED',_0xbba8('0x9'))},'url':{'type':Sequelize[_0xbba8('0x1')]},'app':{'type':Sequelize[_0xbba8('0x1')]},'appdata':{'type':Sequelize[_0xbba8('0x1')]},'projectId':{'type':Sequelize[_0xbba8('0x2')]}}; \ No newline at end of file +var _0x8b95=['SENDING','RECEIVED','FAILED','STRING','DATE','INTEGER','BOOLEAN','TEXT','ENUM','SENT'];(function(_0x1405f8,_0x2d431e){var _0x270946=function(_0x439dc1){while(--_0x439dc1){_0x1405f8['push'](_0x1405f8['shift']());}};_0x270946(++_0x2d431e);}(_0x8b95,0x8f));var _0x58b9=function(_0x3c6512,_0x37ccc0){_0x3c6512=_0x3c6512-0x0;var _0x1c5954=_0x8b95[_0x3c6512];return _0x1c5954;};'use strict';var Sequelize=require('sequelize');module['exports']={'integration':{'type':Sequelize[_0x58b9('0x0')]},'eventChannel':{'type':Sequelize[_0x58b9('0x0')]},'exitStatus':{'type':Sequelize[_0x58b9('0x0')]},'ticketId':{'type':Sequelize['STRING']},'integrationId':{'type':Sequelize['INTEGER']},'contacts':{'type':Sequelize[_0x58b9('0x0')]},'uniqueid':{'type':Sequelize[_0x58b9('0x0')]},'calleridnum':{'type':Sequelize[_0x58b9('0x0')]},'calleridname':{'type':Sequelize['STRING']},'queue':{'type':Sequelize['STRING']},'interface':{'type':Sequelize[_0x58b9('0x0')]},'membername':{'type':Sequelize[_0x58b9('0x0')]},'agentcalledAt':{'type':Sequelize[_0x58b9('0x1')]},'agentconnectAt':{'type':Sequelize[_0x58b9('0x1')]},'holdtime':{'type':Sequelize[_0x58b9('0x2')]},'agentcomplete':{'type':Sequelize[_0x58b9('0x3')],'defaultValue':![]},'agentcompleteAt':{'type':Sequelize[_0x58b9('0x1')]},'talktime':{'type':Sequelize['INTEGER']},'agentacw':{'type':Sequelize[_0x58b9('0x3')],'defaultValue':![]},'acwtime':{'type':Sequelize['INTEGER']},'reason':{'type':Sequelize[_0x58b9('0x0')]},'agentringnoanswer':{'type':Sequelize[_0x58b9('0x3')],'defaultValue':![]},'agentringnoanswerAt':{'type':Sequelize[_0x58b9('0x1')]},'agentdump':{'type':Sequelize[_0x58b9('0x3')],'defaultValue':![]},'agentdumpAt':{'type':Sequelize[_0x58b9('0x1')]},'lastevent':{'type':Sequelize['STRING']},'channel':{'type':Sequelize[_0x58b9('0x0')]},'channelstate':{'type':Sequelize[_0x58b9('0x2')]},'channelstatedesc':{'type':Sequelize[_0x58b9('0x0')]},'connectedlinenum':{'type':Sequelize['STRING']},'connectedlinename':{'type':Sequelize['STRING']},'language':{'type':Sequelize[_0x58b9('0x0')]},'accountcode':{'type':Sequelize[_0x58b9('0x0')]},'context':{'type':Sequelize[_0x58b9('0x0')]},'exten':{'type':Sequelize[_0x58b9('0x0')]},'priority':{'type':Sequelize[_0x58b9('0x0')]},'destchannel':{'type':Sequelize[_0x58b9('0x0')]},'destchannelstate':{'type':Sequelize[_0x58b9('0x2')]},'destchannelstatedesc':{'type':Sequelize[_0x58b9('0x0')]},'destcalleridnum':{'type':Sequelize[_0x58b9('0x0')]},'destcalleridname':{'type':Sequelize['STRING']},'destconnectedlinenum':{'type':Sequelize['STRING']},'destconnectedlinename':{'type':Sequelize[_0x58b9('0x0')]},'destlanguage':{'type':Sequelize[_0x58b9('0x0')]},'destaccountcode':{'type':Sequelize['STRING']},'destcontext':{'type':Sequelize[_0x58b9('0x0')]},'destexten':{'type':Sequelize[_0x58b9('0x0')]},'destpriority':{'type':Sequelize[_0x58b9('0x0')]},'destuniqueid':{'type':Sequelize['STRING']},'messageId':{'type':Sequelize[_0x58b9('0x0')]},'inReplyTo':{'type':Sequelize[_0x58b9('0x0')]},'subject':{'type':Sequelize['STRING']},'from':{'type':Sequelize[_0x58b9('0x0')]},'to':{'type':Sequelize[_0x58b9('0x0')]},'cc':{'type':Sequelize[_0x58b9('0x0')]},'attachment':{'type':Sequelize['TEXT']},'html':{'type':Sequelize[_0x58b9('0x4')]},'text':{'type':Sequelize[_0x58b9('0x4')]},'status':{'type':Sequelize[_0x58b9('0x5')](_0x58b9('0x6'),_0x58b9('0x7'),_0x58b9('0x8'),_0x58b9('0x9'))},'url':{'type':Sequelize['STRING']},'app':{'type':Sequelize[_0x58b9('0x0')]},'appdata':{'type':Sequelize[_0x58b9('0x0')]},'projectId':{'type':Sequelize[_0x58b9('0x2')]}}; \ No newline at end of file diff --git a/server/api/integrationReport/integrationReport.controller.js b/server/api/integrationReport/integrationReport.controller.js index b75418d..a1d04be 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 _0xef4b=['error','stack','name','send','map','IntegrationReport','rawAttributes','fieldName','type','query','filters','intersection','model','fields','attributes','length','nolimit','order','sort','where','pick','filter','merge','options','includeAll','include','rows','catch','keys','find','create','body','params','destroy','describe','eml-format','rimraf','zip-dir','request-promise','bluebird','mustache','util','path','sox','to-csv','ejs','lodash','squel','crypto','desk.js','querystring','ioredis','../../components/auth/service','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/license/util','../../mysqldb','sendStatus','status','json','offset','undefined','count','limit','Content-Range','save','update','then','end'];(function(_0x26475e,_0xe34ebb){var _0x44d0dc=function(_0x170925){while(--_0x170925){_0x26475e['push'](_0x26475e['shift']());}};_0x44d0dc(++_0xe34ebb);}(_0xef4b,0x186));var _0xbef4=function(_0x448e8d,_0x43a056){_0x448e8d=_0x448e8d-0x0;var _0x46e774=_0xef4b[_0x448e8d];return _0x46e774;};'use strict';var emlformat=require(_0xbef4('0x0'));var rimraf=require(_0xbef4('0x1'));var zipdir=require(_0xbef4('0x2'));var jsonpatch=require('fast-json-patch');var rp=require(_0xbef4('0x3'));var moment=require('moment');var BPromise=require(_0xbef4('0x4'));var Mustache=require(_0xbef4('0x5'));var util=require(_0xbef4('0x6'));var path=require(_0xbef4('0x7'));var sox=require(_0xbef4('0x8'));var csv=require(_0xbef4('0x9'));var ejs=require(_0xbef4('0xa'));var fs=require('fs');var fs_extra=require('fs-extra');var _=require(_0xbef4('0xb'));var squel=require(_0xbef4('0xc'));var crypto=require(_0xbef4('0xd'));var jsforce=require('jsforce');var deskjs=require(_0xbef4('0xe'));var toCsv=require('to-csv');var querystring=require(_0xbef4('0xf'));var Papa=require('papaparse');var Redis=require(_0xbef4('0x10'));var authService=require(_0xbef4('0x11'));var qs=require('../../components/parsers/qs');var as=require('../../components/parsers/advancedSearch');var hardwareService=require(_0xbef4('0x12'));var logger=require(_0xbef4('0x13'))(_0xbef4('0x14'));var utils=require(_0xbef4('0x15'));var config=require('../../config/environment');var licenseUtil=require(_0xbef4('0x16'));var db=require(_0xbef4('0x17'))['db'];function respondWithStatusCode(_0x252faf,_0x2a2cbc){_0x2a2cbc=_0x2a2cbc||0xcc;return function(_0x53b5b4){if(_0x53b5b4){return _0x252faf[_0xbef4('0x18')](_0x2a2cbc);}return _0x252faf[_0xbef4('0x19')](_0x2a2cbc)['end']();};}function respondWithResult(_0x580002,_0xdd69ed){_0xdd69ed=_0xdd69ed||0xc8;return function(_0x567ea4){if(_0x567ea4){return _0x580002[_0xbef4('0x19')](_0xdd69ed)[_0xbef4('0x1a')](_0x567ea4);}};}function respondWithFilteredResult(_0x2d24b4,_0x4662d8){return function(_0x5c0fc7){if(_0x5c0fc7){var _0x3a6e4e=typeof _0x4662d8[_0xbef4('0x1b')]===_0xbef4('0x1c')&&typeof _0x4662d8['limit']===_0xbef4('0x1c');var _0x12624b=_0x5c0fc7[_0xbef4('0x1d')];var _0x38e314=_0x3a6e4e?0x0:_0x4662d8[_0xbef4('0x1b')];var _0x3bfb8d=_0x3a6e4e?_0x5c0fc7[_0xbef4('0x1d')]:_0x4662d8[_0xbef4('0x1b')]+_0x4662d8[_0xbef4('0x1e')];var _0xd5b8a8;if(_0x3bfb8d>=_0x12624b){_0x3bfb8d=_0x12624b;_0xd5b8a8=0xc8;}else{_0xd5b8a8=0xce;}_0x2d24b4['status'](_0xd5b8a8);return _0x2d24b4['set'](_0xbef4('0x1f'),_0x38e314+'-'+_0x3bfb8d+'/'+_0x12624b)[_0xbef4('0x1a')](_0x5c0fc7);}return null;};}function patchUpdates(_0x12ccfd){return function(_0x2c1101){try{jsonpatch['apply'](_0x2c1101,_0x12ccfd,!![]);}catch(_0x50599f){return BPromise['reject'](_0x50599f);}return _0x2c1101[_0xbef4('0x20')]();};}function saveUpdates(_0x51d9d4,_0x31fe3c){return function(_0x33169d){if(_0x33169d){return _0x33169d[_0xbef4('0x21')](_0x51d9d4)[_0xbef4('0x22')](function(_0x4d911d){return _0x4d911d;});}return null;};}function removeEntity(_0x1beb83,_0x32e7a9){return function(_0x3229d8){if(_0x3229d8){return _0x3229d8['destroy']()[_0xbef4('0x22')](function(){_0x1beb83[_0xbef4('0x19')](0xcc)[_0xbef4('0x23')]();});}};}function handleEntityNotFound(_0x42b90d,_0x44e7b1){return function(_0x3ad93a){if(!_0x3ad93a){_0x42b90d[_0xbef4('0x18')](0x194);}return _0x3ad93a;};}function handleError(_0x35cc2b,_0x959506){_0x959506=_0x959506||0x1f4;return function(_0x2463d0){logger[_0xbef4('0x24')](_0x2463d0[_0xbef4('0x25')]);if(_0x2463d0[_0xbef4('0x26')]){delete _0x2463d0[_0xbef4('0x26')];}_0x35cc2b[_0xbef4('0x19')](_0x959506)[_0xbef4('0x27')](_0x2463d0);};}exports['index']=function(_0x3bd9c6,_0xefb00a){var _0x75f8af={},_0x874094={},_0x581139={'count':0x0,'rows':[]};var _0x154934=_[_0xbef4('0x28')](db[_0xbef4('0x29')][_0xbef4('0x2a')],function(_0x58a929){return{'name':_0x58a929[_0xbef4('0x2b')],'type':_0x58a929[_0xbef4('0x2c')]['key']};});_0x874094['model']=_[_0xbef4('0x28')](_0x154934,_0xbef4('0x26'));_0x874094[_0xbef4('0x2d')]=_['keys'](_0x3bd9c6[_0xbef4('0x2d')]);_0x874094[_0xbef4('0x2e')]=_[_0xbef4('0x2f')](_0x874094['model'],_0x874094[_0xbef4('0x2d')]);_0x75f8af['attributes']=_[_0xbef4('0x2f')](_0x874094[_0xbef4('0x30')],qs[_0xbef4('0x31')](_0x3bd9c6[_0xbef4('0x2d')][_0xbef4('0x31')]));_0x75f8af[_0xbef4('0x32')]=_0x75f8af['attributes'][_0xbef4('0x33')]?_0x75f8af['attributes']:_0x874094[_0xbef4('0x30')];if(!_0x3bd9c6[_0xbef4('0x2d')]['hasOwnProperty'](_0xbef4('0x34'))){_0x75f8af['limit']=qs[_0xbef4('0x1e')](_0x3bd9c6[_0xbef4('0x2d')][_0xbef4('0x1e')]);_0x75f8af[_0xbef4('0x1b')]=qs['offset'](_0x3bd9c6['query'][_0xbef4('0x1b')]);}_0x75f8af[_0xbef4('0x35')]=qs[_0xbef4('0x36')](_0x3bd9c6[_0xbef4('0x2d')]['sort']);_0x75f8af[_0xbef4('0x37')]=qs[_0xbef4('0x2e')](_[_0xbef4('0x38')](_0x3bd9c6[_0xbef4('0x2d')],_0x874094[_0xbef4('0x2e')]),_0x154934);if(_0x3bd9c6['query'][_0xbef4('0x39')]){_0x75f8af[_0xbef4('0x37')]=_[_0xbef4('0x3a')](_0x75f8af[_0xbef4('0x37')],{'$or':_[_0xbef4('0x28')](_0x154934,function(_0x50c39c){if(_0x50c39c[_0xbef4('0x2c')]!=='VIRTUAL'){var _0x5be222={};_0x5be222[_0x50c39c[_0xbef4('0x26')]]={'$like':'%'+_0x3bd9c6['query'][_0xbef4('0x39')]+'%'};return _0x5be222;}})});}_0x75f8af=_['merge']({},_0x75f8af,_0x3bd9c6[_0xbef4('0x3b')]);var _0x354294={'where':_0x75f8af[_0xbef4('0x37')]};return db[_0xbef4('0x29')][_0xbef4('0x1d')](_0x354294)['then'](function(_0x1ad76a){_0x581139[_0xbef4('0x1d')]=_0x1ad76a;if(_0x3bd9c6[_0xbef4('0x2d')][_0xbef4('0x3c')]){_0x75f8af[_0xbef4('0x3d')]=[{'all':!![]}];}return db[_0xbef4('0x29')]['findAll'](_0x75f8af);})[_0xbef4('0x22')](function(_0x1ba0ba){_0x581139[_0xbef4('0x3e')]=_0x1ba0ba;return _0x581139;})[_0xbef4('0x22')](respondWithFilteredResult(_0xefb00a,_0x75f8af))[_0xbef4('0x3f')](handleError(_0xefb00a,null));};exports['show']=function(_0x1266f8,_0x58e41d){var _0xc62685={'raw':![],'where':{'id':_0x1266f8['params']['id']}},_0xd9a0d6={};_0xd9a0d6[_0xbef4('0x30')]=_[_0xbef4('0x40')](db[_0xbef4('0x29')][_0xbef4('0x2a')]);_0xd9a0d6[_0xbef4('0x2d')]=_['keys'](_0x1266f8['query']);_0xd9a0d6[_0xbef4('0x2e')]=_[_0xbef4('0x2f')](_0xd9a0d6[_0xbef4('0x30')],_0xd9a0d6[_0xbef4('0x2d')]);_0xc62685[_0xbef4('0x32')]=_['intersection'](_0xd9a0d6[_0xbef4('0x30')],qs['fields'](_0x1266f8[_0xbef4('0x2d')]['fields']));_0xc62685[_0xbef4('0x32')]=_0xc62685['attributes'][_0xbef4('0x33')]?_0xc62685[_0xbef4('0x32')]:_0xd9a0d6[_0xbef4('0x30')];if(_0x1266f8['query'][_0xbef4('0x3c')]){_0xc62685['include']=[{'all':!![]}];}_0xc62685=_[_0xbef4('0x3a')]({},_0xc62685,_0x1266f8[_0xbef4('0x3b')]);return db[_0xbef4('0x29')][_0xbef4('0x41')](_0xc62685)['then'](handleEntityNotFound(_0x58e41d,null))[_0xbef4('0x22')](respondWithResult(_0x58e41d,null))[_0xbef4('0x3f')](handleError(_0x58e41d,null));};exports[_0xbef4('0x42')]=function(_0x1df51e,_0x4cb32d){return db[_0xbef4('0x29')]['create'](_0x1df51e['body'],{})[_0xbef4('0x22')](respondWithResult(_0x4cb32d,0xc9))[_0xbef4('0x3f')](handleError(_0x4cb32d,null));};exports[_0xbef4('0x21')]=function(_0x5b8ba3,_0x3f941f){if(_0x5b8ba3[_0xbef4('0x43')]['id']){delete _0x5b8ba3[_0xbef4('0x43')]['id'];}return db[_0xbef4('0x29')][_0xbef4('0x41')]({'where':{'id':_0x5b8ba3[_0xbef4('0x44')]['id']}})[_0xbef4('0x22')](handleEntityNotFound(_0x3f941f,null))['then'](saveUpdates(_0x5b8ba3[_0xbef4('0x43')],null))[_0xbef4('0x22')](respondWithResult(_0x3f941f,null))[_0xbef4('0x3f')](handleError(_0x3f941f,null));};exports[_0xbef4('0x45')]=function(_0x52fb7c,_0x20e22d){return db[_0xbef4('0x29')][_0xbef4('0x41')]({'where':{'id':_0x52fb7c[_0xbef4('0x44')]['id']}})['then'](handleEntityNotFound(_0x20e22d,null))[_0xbef4('0x22')](removeEntity(_0x20e22d,null))['catch'](handleError(_0x20e22d,null));};exports[_0xbef4('0x46')]=function(_0xcbfe3f,_0x30dce7){return db[_0xbef4('0x29')][_0xbef4('0x46')]()[_0xbef4('0x22')](respondWithResult(_0x30dce7,null))[_0xbef4('0x3f')](handleError(_0x30dce7,null));}; \ No newline at end of file +var _0xb42f=['length','hasOwnProperty','nolimit','limit','sort','pick','filter','where','merge','VIRTUAL','options','include','rows','catch','show','find','body','params','describe','eml-format','rimraf','zip-dir','fast-json-patch','moment','sox','to-csv','ejs','fs-extra','lodash','squel','crypto','querystring','ioredis','../../components/auth/service','../../components/parsers/advancedSearch','../../config/logger','api','../../config/utils','../../config/environment','../../config/license/util','sendStatus','status','end','offset','count','set','json','reject','save','update','then','destroy','error','stack','name','map','IntegrationReport','rawAttributes','fieldName','type','key','model','query','keys','filters','intersection','attributes','fields'];(function(_0x1b9629,_0x5554b4){var _0x4ade3a=function(_0x4e5114){while(--_0x4e5114){_0x1b9629['push'](_0x1b9629['shift']());}};_0x4ade3a(++_0x5554b4);}(_0xb42f,0x167));var _0xfb42=function(_0x142738,_0x2976dc){_0x142738=_0x142738-0x0;var _0x14d3d8=_0xb42f[_0x142738];return _0x14d3d8;};'use strict';var emlformat=require(_0xfb42('0x0'));var rimraf=require(_0xfb42('0x1'));var zipdir=require(_0xfb42('0x2'));var jsonpatch=require(_0xfb42('0x3'));var rp=require('request-promise');var moment=require(_0xfb42('0x4'));var BPromise=require('bluebird');var Mustache=require('mustache');var util=require('util');var path=require('path');var sox=require(_0xfb42('0x5'));var csv=require(_0xfb42('0x6'));var ejs=require(_0xfb42('0x7'));var fs=require('fs');var fs_extra=require(_0xfb42('0x8'));var _=require(_0xfb42('0x9'));var squel=require(_0xfb42('0xa'));var crypto=require(_0xfb42('0xb'));var jsforce=require('jsforce');var deskjs=require('desk.js');var toCsv=require(_0xfb42('0x6'));var querystring=require(_0xfb42('0xc'));var Papa=require('papaparse');var Redis=require(_0xfb42('0xd'));var authService=require(_0xfb42('0xe'));var qs=require('../../components/parsers/qs');var as=require(_0xfb42('0xf'));var hardwareService=require('../../config/license/hardware');var logger=require(_0xfb42('0x10'))(_0xfb42('0x11'));var utils=require(_0xfb42('0x12'));var config=require(_0xfb42('0x13'));var licenseUtil=require(_0xfb42('0x14'));var db=require('../../mysqldb')['db'];function respondWithStatusCode(_0x5805ba,_0x39710e){_0x39710e=_0x39710e||0xcc;return function(_0x43e6f2){if(_0x43e6f2){return _0x5805ba[_0xfb42('0x15')](_0x39710e);}return _0x5805ba[_0xfb42('0x16')](_0x39710e)[_0xfb42('0x17')]();};}function respondWithResult(_0x31d8f7,_0x36d63d){_0x36d63d=_0x36d63d||0xc8;return function(_0x40f215){if(_0x40f215){return _0x31d8f7['status'](_0x36d63d)['json'](_0x40f215);}};}function respondWithFilteredResult(_0x2b460a,_0x4e2fc2){return function(_0x4dd33a){if(_0x4dd33a){var _0x4d8cdb=typeof _0x4e2fc2[_0xfb42('0x18')]==='undefined'&&typeof _0x4e2fc2['limit']==='undefined';var _0xf0ae2c=_0x4dd33a[_0xfb42('0x19')];var _0x2ae902=_0x4d8cdb?0x0:_0x4e2fc2[_0xfb42('0x18')];var _0x582d35=_0x4d8cdb?_0x4dd33a[_0xfb42('0x19')]:_0x4e2fc2['offset']+_0x4e2fc2['limit'];var _0x421ecf;if(_0x582d35>=_0xf0ae2c){_0x582d35=_0xf0ae2c;_0x421ecf=0xc8;}else{_0x421ecf=0xce;}_0x2b460a['status'](_0x421ecf);return _0x2b460a[_0xfb42('0x1a')]('Content-Range',_0x2ae902+'-'+_0x582d35+'/'+_0xf0ae2c)[_0xfb42('0x1b')](_0x4dd33a);}return null;};}function patchUpdates(_0x479c73){return function(_0x1f1b21){try{jsonpatch['apply'](_0x1f1b21,_0x479c73,!![]);}catch(_0xaee45a){return BPromise[_0xfb42('0x1c')](_0xaee45a);}return _0x1f1b21[_0xfb42('0x1d')]();};}function saveUpdates(_0xb8428c,_0x5f3c00){return function(_0x1ee665){if(_0x1ee665){return _0x1ee665[_0xfb42('0x1e')](_0xb8428c)[_0xfb42('0x1f')](function(_0x2aa1c0){return _0x2aa1c0;});}return null;};}function removeEntity(_0x3fd70e,_0x2be482){return function(_0x4681ac){if(_0x4681ac){return _0x4681ac[_0xfb42('0x20')]()['then'](function(){_0x3fd70e['status'](0xcc)['end']();});}};}function handleEntityNotFound(_0x54b5fe,_0x1180a4){return function(_0x3d4fa5){if(!_0x3d4fa5){_0x54b5fe[_0xfb42('0x15')](0x194);}return _0x3d4fa5;};}function handleError(_0x2b72db,_0x230bb8){_0x230bb8=_0x230bb8||0x1f4;return function(_0xd00426){logger[_0xfb42('0x21')](_0xd00426[_0xfb42('0x22')]);if(_0xd00426[_0xfb42('0x23')]){delete _0xd00426[_0xfb42('0x23')];}_0x2b72db[_0xfb42('0x16')](_0x230bb8)['send'](_0xd00426);};}exports['index']=function(_0x4395ca,_0x2c0b89){var _0x325ac6={},_0x233c29={},_0x3e028b={'count':0x0,'rows':[]};var _0x1c041d=_[_0xfb42('0x24')](db[_0xfb42('0x25')][_0xfb42('0x26')],function(_0x30735b){return{'name':_0x30735b[_0xfb42('0x27')],'type':_0x30735b[_0xfb42('0x28')][_0xfb42('0x29')]};});_0x233c29[_0xfb42('0x2a')]=_[_0xfb42('0x24')](_0x1c041d,_0xfb42('0x23'));_0x233c29[_0xfb42('0x2b')]=_[_0xfb42('0x2c')](_0x4395ca['query']);_0x233c29[_0xfb42('0x2d')]=_[_0xfb42('0x2e')](_0x233c29['model'],_0x233c29[_0xfb42('0x2b')]);_0x325ac6[_0xfb42('0x2f')]=_[_0xfb42('0x2e')](_0x233c29[_0xfb42('0x2a')],qs[_0xfb42('0x30')](_0x4395ca[_0xfb42('0x2b')][_0xfb42('0x30')]));_0x325ac6[_0xfb42('0x2f')]=_0x325ac6[_0xfb42('0x2f')][_0xfb42('0x31')]?_0x325ac6['attributes']:_0x233c29[_0xfb42('0x2a')];if(!_0x4395ca[_0xfb42('0x2b')][_0xfb42('0x32')](_0xfb42('0x33'))){_0x325ac6[_0xfb42('0x34')]=qs[_0xfb42('0x34')](_0x4395ca[_0xfb42('0x2b')]['limit']);_0x325ac6[_0xfb42('0x18')]=qs[_0xfb42('0x18')](_0x4395ca['query'][_0xfb42('0x18')]);}_0x325ac6['order']=qs[_0xfb42('0x35')](_0x4395ca[_0xfb42('0x2b')][_0xfb42('0x35')]);_0x325ac6['where']=qs[_0xfb42('0x2d')](_[_0xfb42('0x36')](_0x4395ca[_0xfb42('0x2b')],_0x233c29[_0xfb42('0x2d')]),_0x1c041d);if(_0x4395ca[_0xfb42('0x2b')][_0xfb42('0x37')]){_0x325ac6[_0xfb42('0x38')]=_[_0xfb42('0x39')](_0x325ac6[_0xfb42('0x38')],{'$or':_['map'](_0x1c041d,function(_0x1dd508){if(_0x1dd508[_0xfb42('0x28')]!==_0xfb42('0x3a')){var _0x56dac5={};_0x56dac5[_0x1dd508['name']]={'$like':'%'+_0x4395ca['query'][_0xfb42('0x37')]+'%'};return _0x56dac5;}})});}_0x325ac6=_[_0xfb42('0x39')]({},_0x325ac6,_0x4395ca[_0xfb42('0x3b')]);var _0x2fb1cc={'where':_0x325ac6[_0xfb42('0x38')]};return db[_0xfb42('0x25')]['count'](_0x2fb1cc)[_0xfb42('0x1f')](function(_0x1e883c){_0x3e028b['count']=_0x1e883c;if(_0x4395ca[_0xfb42('0x2b')]['includeAll']){_0x325ac6[_0xfb42('0x3c')]=[{'all':!![]}];}return db[_0xfb42('0x25')]['findAll'](_0x325ac6);})[_0xfb42('0x1f')](function(_0x395160){_0x3e028b[_0xfb42('0x3d')]=_0x395160;return _0x3e028b;})['then'](respondWithFilteredResult(_0x2c0b89,_0x325ac6))[_0xfb42('0x3e')](handleError(_0x2c0b89,null));};exports[_0xfb42('0x3f')]=function(_0x57387f,_0xb37ef0){var _0x3be126={'raw':![],'where':{'id':_0x57387f['params']['id']}},_0x529ec2={};_0x529ec2[_0xfb42('0x2a')]=_[_0xfb42('0x2c')](db['IntegrationReport'][_0xfb42('0x26')]);_0x529ec2['query']=_[_0xfb42('0x2c')](_0x57387f[_0xfb42('0x2b')]);_0x529ec2[_0xfb42('0x2d')]=_[_0xfb42('0x2e')](_0x529ec2[_0xfb42('0x2a')],_0x529ec2[_0xfb42('0x2b')]);_0x3be126[_0xfb42('0x2f')]=_[_0xfb42('0x2e')](_0x529ec2[_0xfb42('0x2a')],qs['fields'](_0x57387f[_0xfb42('0x2b')][_0xfb42('0x30')]));_0x3be126['attributes']=_0x3be126[_0xfb42('0x2f')][_0xfb42('0x31')]?_0x3be126['attributes']:_0x529ec2[_0xfb42('0x2a')];if(_0x57387f[_0xfb42('0x2b')]['includeAll']){_0x3be126[_0xfb42('0x3c')]=[{'all':!![]}];}_0x3be126=_[_0xfb42('0x39')]({},_0x3be126,_0x57387f[_0xfb42('0x3b')]);return db[_0xfb42('0x25')][_0xfb42('0x40')](_0x3be126)['then'](handleEntityNotFound(_0xb37ef0,null))[_0xfb42('0x1f')](respondWithResult(_0xb37ef0,null))['catch'](handleError(_0xb37ef0,null));};exports['create']=function(_0x56aaaa,_0x4a9e10){return db[_0xfb42('0x25')]['create'](_0x56aaaa[_0xfb42('0x41')],{})[_0xfb42('0x1f')](respondWithResult(_0x4a9e10,0xc9))[_0xfb42('0x3e')](handleError(_0x4a9e10,null));};exports['update']=function(_0x2bba22,_0x1c490a){if(_0x2bba22[_0xfb42('0x41')]['id']){delete _0x2bba22[_0xfb42('0x41')]['id'];}return db['IntegrationReport'][_0xfb42('0x40')]({'where':{'id':_0x2bba22[_0xfb42('0x42')]['id']}})[_0xfb42('0x1f')](handleEntityNotFound(_0x1c490a,null))[_0xfb42('0x1f')](saveUpdates(_0x2bba22[_0xfb42('0x41')],null))[_0xfb42('0x1f')](respondWithResult(_0x1c490a,null))[_0xfb42('0x3e')](handleError(_0x1c490a,null));};exports['destroy']=function(_0x5e27d1,_0x27279d){return db['IntegrationReport'][_0xfb42('0x40')]({'where':{'id':_0x5e27d1[_0xfb42('0x42')]['id']}})[_0xfb42('0x1f')](handleEntityNotFound(_0x27279d,null))[_0xfb42('0x1f')](removeEntity(_0x27279d,null))[_0xfb42('0x3e')](handleError(_0x27279d,null));};exports['describe']=function(_0x2c21cf,_0x3a024e){return db[_0xfb42('0x25')][_0xfb42('0x43')]()[_0xfb42('0x1f')](respondWithResult(_0x3a024e,null))['catch'](handleError(_0x3a024e,null));}; \ No newline at end of file diff --git a/server/api/integrationReport/integrationReport.model.js b/server/api/integrationReport/integrationReport.model.js index 6ec3f39..be9bc59 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 _0x3460=['../../config/logger','api','moment','bluebird','request-promise','path','rimraf','../../config/environment','exports','define','IntegrationReport','report_integration','lodash','util'];(function(_0x4a8684,_0x53dd2f){var _0xed0cc3=function(_0xd4bfc8){while(--_0xd4bfc8){_0x4a8684['push'](_0x4a8684['shift']());}};_0xed0cc3(++_0x53dd2f);}(_0x3460,0xde));var _0x0346=function(_0x328fc8,_0x414f5e){_0x328fc8=_0x328fc8-0x0;var _0x15159b=_0x3460[_0x328fc8];return _0x15159b;};'use strict';var _=require(_0x0346('0x0'));var util=require(_0x0346('0x1'));var logger=require(_0x0346('0x2'))(_0x0346('0x3'));var moment=require(_0x0346('0x4'));var BPromise=require(_0x0346('0x5'));var rp=require(_0x0346('0x6'));var fs=require('fs');var path=require(_0x0346('0x7'));var rimraf=require(_0x0346('0x8'));var config=require(_0x0346('0x9'));var attributes=require('./integrationReport.attributes');module[_0x0346('0xa')]=function(_0x1ded61,_0x2e620c){return _0x1ded61[_0x0346('0xb')](_0x0346('0xc'),attributes,{'tableName':_0x0346('0xd'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0xb56a=['../../config/environment','./integrationReport.attributes','exports','define','lodash','util','../../config/logger','api','moment','bluebird','request-promise','path'];(function(_0x51bdda,_0x5666ca){var _0x998aab=function(_0x3f4029){while(--_0x3f4029){_0x51bdda['push'](_0x51bdda['shift']());}};_0x998aab(++_0x5666ca);}(_0xb56a,0x1f0));var _0xab56=function(_0x46e363,_0x45d7e2){_0x46e363=_0x46e363-0x0;var _0x3fb059=_0xb56a[_0x46e363];return _0x3fb059;};'use strict';var _=require(_0xab56('0x0'));var util=require(_0xab56('0x1'));var logger=require(_0xab56('0x2'))(_0xab56('0x3'));var moment=require(_0xab56('0x4'));var BPromise=require(_0xab56('0x5'));var rp=require(_0xab56('0x6'));var fs=require('fs');var path=require(_0xab56('0x7'));var rimraf=require('rimraf');var config=require(_0xab56('0x8'));var attributes=require(_0xab56('0x9'));module[_0xab56('0xa')]=function(_0x49b010,_0x5495aa){return _0x49b010[_0xab56('0xb')]('IntegrationReport',attributes,{'tableName':'report_integration','paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/integrationReport/integrationReport.rpc.js b/server/api/integrationReport/integrationReport.rpc.js index e279bf4..221ff1e 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 _0x7a54=['info','IntegrationReport,\x20%s,\x20%s','debug','stringify','error','code','message','request\x20sent','result','catch','lodash','util','moment','randomstring','ioredis','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','http'];(function(_0x3bf83f,_0x181cac){var _0x22c4a9=function(_0xb3ff0d){while(--_0xb3ff0d){_0x3bf83f['push'](_0x3bf83f['shift']());}};_0x22c4a9(++_0x181cac);}(_0x7a54,0x106));var _0x47a5=function(_0x349562,_0x3f0916){_0x349562=_0x349562-0x0;var _0x4498e9=_0x7a54[_0x349562];return _0x4498e9;};'use strict';var _=require(_0x47a5('0x0'));var util=require(_0x47a5('0x1'));var moment=require(_0x47a5('0x2'));var BPromise=require('bluebird');var rs=require(_0x47a5('0x3'));var fs=require('fs');var Redis=require(_0x47a5('0x4'));var db=require('../../mysqldb')['db'];var utils=require(_0x47a5('0x5'));var logger=require(_0x47a5('0x6'))(_0x47a5('0x7'));var config=require(_0x47a5('0x8'));var jayson=require(_0x47a5('0x9'));var client=jayson['client'][_0x47a5('0xa')]({'port':0x232a});function respondWithRpcPromise(_0x59199c,_0x343372,_0x30e405){return new BPromise(function(_0x506eda,_0x194fb0){return client['request'](_0x59199c,_0x30e405)['then'](function(_0x582352){logger[_0x47a5('0xb')](_0x47a5('0xc'),_0x343372,'request\x20sent');logger[_0x47a5('0xd')]('IntegrationReport,\x20%s,\x20%s,\x20%s',_0x343372,'request\x20sent',JSON[_0x47a5('0xe')](_0x582352));if(_0x582352[_0x47a5('0xf')]){if(_0x582352[_0x47a5('0xf')][_0x47a5('0x10')]===0x1f4){logger[_0x47a5('0xf')](_0x47a5('0xc'),_0x343372,_0x582352[_0x47a5('0xf')]['message']);return _0x194fb0(_0x582352[_0x47a5('0xf')][_0x47a5('0x11')]);}logger[_0x47a5('0xf')](_0x47a5('0xc'),_0x343372,_0x582352[_0x47a5('0xf')][_0x47a5('0x11')]);return _0x506eda(_0x582352[_0x47a5('0xf')][_0x47a5('0x11')]);}else{logger['info'](_0x47a5('0xc'),_0x343372,_0x47a5('0x12'));_0x506eda(_0x582352[_0x47a5('0x13')][_0x47a5('0x11')]);}})[_0x47a5('0x14')](function(_0x574af6){logger['error'](_0x47a5('0xc'),_0x343372,_0x574af6);_0x194fb0(_0x574af6);});});} \ No newline at end of file +var _0xadb5=['error','code','message','result','catch','util','bluebird','randomstring','ioredis','../../config/utils','../../config/logger','rpc','jayson/promise','client','http','request','then','info','IntegrationReport,\x20%s,\x20%s','request\x20sent','stringify'];(function(_0x4468b2,_0x4f0703){var _0x4fb044=function(_0x135dd5){while(--_0x135dd5){_0x4468b2['push'](_0x4468b2['shift']());}};_0x4fb044(++_0x4f0703);}(_0xadb5,0xad));var _0x5adb=function(_0x1d8b4e,_0x36304c){_0x1d8b4e=_0x1d8b4e-0x0;var _0x190bbc=_0xadb5[_0x1d8b4e];return _0x190bbc;};'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']('IntegrationReport,\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 diff --git a/server/api/interval/index.js b/server/api/interval/index.js index 5a8f880..d928349 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 _0x8c8b=['post','create','addInterval','/:id/sub_intervals/create_many','addIntervals','update','delete','destroy','exports','multer','connect-timeout','express','Router','fs-extra','../../config/environment','./interval.controller','get','isAuthenticated','index','/:id','show','/:id/sub_intervals','getIntervals'];(function(_0x3aa078,_0x4fad16){var _0x30c3b1=function(_0x5b8011){while(--_0x5b8011){_0x3aa078['push'](_0x3aa078['shift']());}};_0x30c3b1(++_0x4fad16);}(_0x8c8b,0x106));var _0xb8c8=function(_0x321bb2,_0x202794){_0x321bb2=_0x321bb2-0x0;var _0x9c12ed=_0x8c8b[_0x321bb2];return _0x9c12ed;};'use strict';var multer=require(_0xb8c8('0x0'));var util=require('util');var path=require('path');var timeout=require(_0xb8c8('0x1'));var express=require(_0xb8c8('0x2'));var router=express[_0xb8c8('0x3')]();var fs_extra=require(_0xb8c8('0x4'));var auth=require('../../components/auth/service');var interaction=require('../../components/interaction/service');var config=require(_0xb8c8('0x5'));var controller=require(_0xb8c8('0x6'));router[_0xb8c8('0x7')]('/',auth[_0xb8c8('0x8')](),controller[_0xb8c8('0x9')]);router[_0xb8c8('0x7')](_0xb8c8('0xa'),auth[_0xb8c8('0x8')](),controller[_0xb8c8('0xb')]);router[_0xb8c8('0x7')](_0xb8c8('0xc'),auth['isAuthenticated'](),controller[_0xb8c8('0xd')]);router[_0xb8c8('0xe')]('/',auth[_0xb8c8('0x8')](),controller[_0xb8c8('0xf')]);router[_0xb8c8('0xe')](_0xb8c8('0xc'),auth[_0xb8c8('0x8')](),controller[_0xb8c8('0x10')]);router[_0xb8c8('0xe')](_0xb8c8('0x11'),auth[_0xb8c8('0x8')](),controller[_0xb8c8('0x12')]);router['put'](_0xb8c8('0xa'),auth['isAuthenticated'](),controller[_0xb8c8('0x13')]);router[_0xb8c8('0x14')]('/:id',auth[_0xb8c8('0x8')](),controller[_0xb8c8('0x15')]);module[_0xb8c8('0x16')]=router; \ No newline at end of file +var _0xe590=['destroy','exports','multer','util','path','connect-timeout','express','Router','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','get','isAuthenticated','index','/:id','show','/:id/sub_intervals','getIntervals','post','addInterval','/:id/sub_intervals/create_many','put','update','delete'];(function(_0x2bded4,_0x5aa045){var _0x302c84=function(_0xe33874){while(--_0xe33874){_0x2bded4['push'](_0x2bded4['shift']());}};_0x302c84(++_0x5aa045);}(_0xe590,0xca));var _0x0e59=function(_0x1cb503,_0x2118c4){_0x1cb503=_0x1cb503-0x0;var _0x3468e8=_0xe590[_0x1cb503];return _0x3468e8;};'use strict';var multer=require(_0x0e59('0x0'));var util=require(_0x0e59('0x1'));var path=require(_0x0e59('0x2'));var timeout=require(_0x0e59('0x3'));var express=require(_0x0e59('0x4'));var router=express[_0x0e59('0x5')]();var fs_extra=require(_0x0e59('0x6'));var auth=require(_0x0e59('0x7'));var interaction=require(_0x0e59('0x8'));var config=require(_0x0e59('0x9'));var controller=require('./interval.controller');router[_0x0e59('0xa')]('/',auth[_0x0e59('0xb')](),controller[_0x0e59('0xc')]);router['get'](_0x0e59('0xd'),auth['isAuthenticated'](),controller[_0x0e59('0xe')]);router[_0x0e59('0xa')](_0x0e59('0xf'),auth[_0x0e59('0xb')](),controller[_0x0e59('0x10')]);router[_0x0e59('0x11')]('/',auth['isAuthenticated'](),controller['create']);router[_0x0e59('0x11')](_0x0e59('0xf'),auth[_0x0e59('0xb')](),controller[_0x0e59('0x12')]);router[_0x0e59('0x11')](_0x0e59('0x13'),auth[_0x0e59('0xb')](),controller['addIntervals']);router[_0x0e59('0x14')]('/:id',auth[_0x0e59('0xb')](),controller[_0x0e59('0x15')]);router[_0x0e59('0x16')](_0x0e59('0xd'),auth[_0x0e59('0xb')](),controller[_0x0e59('0x17')]);module[_0x0e59('0x18')]=router; \ No newline at end of file diff --git a/server/api/interval/interval.attributes.js b/server/api/interval/interval.attributes.js index 4131509..d643992 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 _0x89ea=['sequelize','exports','STRING'];(function(_0xaf29da,_0x117f5a){var _0x295c51=function(_0x3feaf4){while(--_0x3feaf4){_0xaf29da['push'](_0xaf29da['shift']());}};_0x295c51(++_0x117f5a);}(_0x89ea,0x13e));var _0xa89e=function(_0x2fff28,_0x540e58){_0x2fff28=_0x2fff28-0x0;var _0x1f68b9=_0x89ea[_0x2fff28];return _0x1f68b9;};'use strict';var Sequelize=require(_0xa89e('0x0'));module[_0xa89e('0x1')]={'name':{'type':Sequelize[_0xa89e('0x2')]},'description':{'type':Sequelize[_0xa89e('0x2')]},'interval':{'type':Sequelize[_0xa89e('0x2')],'allowNull':!![]}}; \ No newline at end of file +var _0xdf17=['STRING'];(function(_0x3aee0,_0x5617d1){var _0x326205=function(_0x547fbb){while(--_0x547fbb){_0x3aee0['push'](_0x3aee0['shift']());}};_0x326205(++_0x5617d1);}(_0xdf17,0xf5));var _0x7df1=function(_0x311c35,_0x534915){_0x311c35=_0x311c35-0x0;var _0x5cc50c=_0xdf17[_0x311c35];return _0x5cc50c;};'use strict';var Sequelize=require('sequelize');module['exports']={'name':{'type':Sequelize[_0x7df1('0x0')]},'description':{'type':Sequelize[_0x7df1('0x0')]},'interval':{'type':Sequelize['STRING'],'allowNull':!![]}}; \ No newline at end of file diff --git a/server/api/interval/interval.controller.js b/server/api/interval/interval.controller.js index 0a603f4..55d869d 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 _0xa6da=['../../config/environment','../../components/extensions/rewrite','sendStatus','end','status','json','offset','undefined','count','limit','set','Content-Range','apply','reject','save','update','destroy','then','get','Intervals','stack','name','send','index','map','Interval','fieldName','type','key','model','query','keys','filters','intersection','attributes','length','hasOwnProperty','nolimit','sort','where','pick','filter','merge','VIRTUAL','includeAll','include','findAll','catch','params','fields','options','find','create','body','user','Unable\x20to\x20retrieve\x20the\x20current\x20user','role','UserProfileSection','userProfileId','UserProfileResource','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','addInterval','getIntervals','findOne','transaction','IntervalId','bulkCreate','eml-format','rimraf','fast-json-patch','request-promise','moment','mustache','util','path','to-csv','crypto','jsforce','desk.js','querystring','papaparse','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','api','../../config/utils'];(function(_0x493230,_0x48756c){var _0x533c85=function(_0x3dda95){while(--_0x3dda95){_0x493230['push'](_0x493230['shift']());}};_0x533c85(++_0x48756c);}(_0xa6da,0x19b));var _0xaa6d=function(_0x500027,_0x219b7a){_0x500027=_0x500027-0x0;var _0x12415d=_0xa6da[_0x500027];return _0x12415d;};'use strict';var emlformat=require(_0xaa6d('0x0'));var rimraf=require(_0xaa6d('0x1'));var zipdir=require('zip-dir');var jsonpatch=require(_0xaa6d('0x2'));var rp=require(_0xaa6d('0x3'));var moment=require(_0xaa6d('0x4'));var BPromise=require('bluebird');var Mustache=require(_0xaa6d('0x5'));var util=require(_0xaa6d('0x6'));var path=require(_0xaa6d('0x7'));var sox=require('sox');var csv=require(_0xaa6d('0x8'));var ejs=require('ejs');var fs=require('fs');var fs_extra=require('fs-extra');var _=require('lodash');var squel=require('squel');var crypto=require(_0xaa6d('0x9'));var jsforce=require(_0xaa6d('0xa'));var deskjs=require(_0xaa6d('0xb'));var toCsv=require('to-csv');var querystring=require(_0xaa6d('0xc'));var Papa=require(_0xaa6d('0xd'));var Redis=require('ioredis');var authService=require(_0xaa6d('0xe'));var qs=require(_0xaa6d('0xf'));var as=require(_0xaa6d('0x10'));var hardwareService=require('../../config/license/hardware');var logger=require('../../config/logger')(_0xaa6d('0x11'));var utils=require(_0xaa6d('0x12'));var config=require(_0xaa6d('0x13'));var licenseUtil=require('../../config/license/util');var db=require('../../mysqldb')['db'];var extensions=require(_0xaa6d('0x14'));function respondWithStatusCode(_0x32cd62,_0x9b0592){_0x9b0592=_0x9b0592||0xcc;return function(_0x21a4d6){if(_0x21a4d6){return _0x32cd62[_0xaa6d('0x15')](_0x9b0592);}return _0x32cd62['status'](_0x9b0592)[_0xaa6d('0x16')]();};}function respondWithResult(_0x34b5f0,_0x36fa26){_0x36fa26=_0x36fa26||0xc8;return function(_0x203d71){if(_0x203d71){return _0x34b5f0[_0xaa6d('0x17')](_0x36fa26)[_0xaa6d('0x18')](_0x203d71);}};}function respondWithFilteredResult(_0x586f49,_0x2698e1){return function(_0x37466e){if(_0x37466e){var _0x4c96e9=typeof _0x2698e1[_0xaa6d('0x19')]===_0xaa6d('0x1a')&&typeof _0x2698e1['limit']===_0xaa6d('0x1a');var _0x421539=_0x37466e[_0xaa6d('0x1b')];var _0x370017=_0x4c96e9?0x0:_0x2698e1[_0xaa6d('0x19')];var _0x2f59ff=_0x4c96e9?_0x37466e[_0xaa6d('0x1b')]:_0x2698e1[_0xaa6d('0x19')]+_0x2698e1[_0xaa6d('0x1c')];var _0x460b26;if(_0x2f59ff>=_0x421539){_0x2f59ff=_0x421539;_0x460b26=0xc8;}else{_0x460b26=0xce;}_0x586f49[_0xaa6d('0x17')](_0x460b26);return _0x586f49[_0xaa6d('0x1d')](_0xaa6d('0x1e'),_0x370017+'-'+_0x2f59ff+'/'+_0x421539)[_0xaa6d('0x18')](_0x37466e);}return null;};}function patchUpdates(_0x250cf0){return function(_0xa11a19){try{jsonpatch[_0xaa6d('0x1f')](_0xa11a19,_0x250cf0,!![]);}catch(_0x41d4bf){return BPromise[_0xaa6d('0x20')](_0x41d4bf);}return _0xa11a19[_0xaa6d('0x21')]();};}function saveUpdates(_0x1e51ca,_0x3971be){return function(_0x49a6bb){if(_0x49a6bb){return _0x49a6bb[_0xaa6d('0x22')](_0x1e51ca)['then'](function(_0x503eb9){return _0x503eb9;});}return null;};}function removeEntity(_0x4273a4,_0x59f380){return function(_0x8ed27b){if(_0x8ed27b){return _0x8ed27b[_0xaa6d('0x23')]()[_0xaa6d('0x24')](function(){var _0x4a168e=_0x8ed27b[_0xaa6d('0x25')]({'plain':!![]});var _0x31c57d=_0xaa6d('0x26');return db['UserProfileResource'][_0xaa6d('0x23')]({'where':{'type':_0x31c57d,'resourceId':_0x4a168e['id']}})[_0xaa6d('0x24')](function(){return _0x8ed27b;});})[_0xaa6d('0x24')](function(){_0x4273a4[_0xaa6d('0x17')](0xcc)[_0xaa6d('0x16')]();});}};}function handleEntityNotFound(_0x63d72,_0x2d4bf7){return function(_0x5e2597){if(!_0x5e2597){_0x63d72['sendStatus'](0x194);}return _0x5e2597;};}function handleError(_0x257c8f,_0x2b3cff){_0x2b3cff=_0x2b3cff||0x1f4;return function(_0x99cc62){logger['error'](_0x99cc62[_0xaa6d('0x27')]);if(_0x99cc62['name']){delete _0x99cc62[_0xaa6d('0x28')];}_0x257c8f[_0xaa6d('0x17')](_0x2b3cff)[_0xaa6d('0x29')](_0x99cc62);};}exports[_0xaa6d('0x2a')]=function(_0x5c03a9,_0x490075){var _0x26228e={},_0x2bf170={},_0x51811e={'count':0x0,'rows':[]};var _0x268f55=_[_0xaa6d('0x2b')](db[_0xaa6d('0x2c')]['rawAttributes'],function(_0x913f51){return{'name':_0x913f51[_0xaa6d('0x2d')],'type':_0x913f51[_0xaa6d('0x2e')][_0xaa6d('0x2f')]};});_0x2bf170[_0xaa6d('0x30')]=_['map'](_0x268f55,'name');_0x2bf170[_0xaa6d('0x31')]=_[_0xaa6d('0x32')](_0x5c03a9['query']);_0x2bf170[_0xaa6d('0x33')]=_[_0xaa6d('0x34')](_0x2bf170['model'],_0x2bf170[_0xaa6d('0x31')]);_0x26228e[_0xaa6d('0x35')]=_[_0xaa6d('0x34')](_0x2bf170[_0xaa6d('0x30')],qs['fields'](_0x5c03a9[_0xaa6d('0x31')]['fields']));_0x26228e[_0xaa6d('0x35')]=_0x26228e[_0xaa6d('0x35')][_0xaa6d('0x36')]?_0x26228e['attributes']:_0x2bf170[_0xaa6d('0x30')];if(!_0x5c03a9[_0xaa6d('0x31')][_0xaa6d('0x37')](_0xaa6d('0x38'))){_0x26228e[_0xaa6d('0x1c')]=qs['limit'](_0x5c03a9[_0xaa6d('0x31')]['limit']);_0x26228e[_0xaa6d('0x19')]=qs['offset'](_0x5c03a9[_0xaa6d('0x31')][_0xaa6d('0x19')]);}_0x26228e['order']=qs[_0xaa6d('0x39')](_0x5c03a9[_0xaa6d('0x31')]['sort']);_0x26228e[_0xaa6d('0x3a')]=qs[_0xaa6d('0x33')](_[_0xaa6d('0x3b')](_0x5c03a9[_0xaa6d('0x31')],_0x2bf170['filters']),_0x268f55);if(_0x5c03a9['query'][_0xaa6d('0x3c')]){_0x26228e[_0xaa6d('0x3a')]=_[_0xaa6d('0x3d')](_0x26228e[_0xaa6d('0x3a')],{'$or':_[_0xaa6d('0x2b')](_0x268f55,function(_0x37110b){if(_0x37110b['type']!==_0xaa6d('0x3e')){var _0x47b700={};_0x47b700[_0x37110b[_0xaa6d('0x28')]]={'$like':'%'+_0x5c03a9[_0xaa6d('0x31')][_0xaa6d('0x3c')]+'%'};return _0x47b700;}})});}_0x26228e=_[_0xaa6d('0x3d')]({},_0x26228e,_0x5c03a9['options']);var _0x36ef87={'where':_0x26228e[_0xaa6d('0x3a')]};return db[_0xaa6d('0x2c')][_0xaa6d('0x1b')](_0x36ef87)[_0xaa6d('0x24')](function(_0x220d87){_0x51811e[_0xaa6d('0x1b')]=_0x220d87;if(_0x5c03a9[_0xaa6d('0x31')][_0xaa6d('0x3f')]){_0x26228e[_0xaa6d('0x40')]=[{'all':!![]}];}return db[_0xaa6d('0x2c')][_0xaa6d('0x41')](_0x26228e);})[_0xaa6d('0x24')](function(_0x5e809d){_0x51811e['rows']=_0x5e809d;return _0x51811e;})[_0xaa6d('0x24')](respondWithFilteredResult(_0x490075,_0x26228e))[_0xaa6d('0x42')](handleError(_0x490075,null));};exports['show']=function(_0x2f4941,_0x4a9019){var _0x2cc444={'raw':!![],'where':{'id':_0x2f4941[_0xaa6d('0x43')]['id']}},_0x2f6c05={};_0x2f6c05[_0xaa6d('0x30')]=_[_0xaa6d('0x32')](db[_0xaa6d('0x2c')]['rawAttributes']);_0x2f6c05[_0xaa6d('0x31')]=_['keys'](_0x2f4941[_0xaa6d('0x31')]);_0x2f6c05[_0xaa6d('0x33')]=_[_0xaa6d('0x34')](_0x2f6c05[_0xaa6d('0x30')],_0x2f6c05[_0xaa6d('0x31')]);_0x2cc444[_0xaa6d('0x35')]=_['intersection'](_0x2f6c05[_0xaa6d('0x30')],qs[_0xaa6d('0x44')](_0x2f4941[_0xaa6d('0x31')][_0xaa6d('0x44')]));_0x2cc444[_0xaa6d('0x35')]=_0x2cc444[_0xaa6d('0x35')][_0xaa6d('0x36')]?_0x2cc444[_0xaa6d('0x35')]:_0x2f6c05[_0xaa6d('0x30')];if(_0x2f4941[_0xaa6d('0x31')][_0xaa6d('0x3f')]){_0x2cc444[_0xaa6d('0x40')]=[{'all':!![]}];}_0x2cc444=_[_0xaa6d('0x3d')]({},_0x2cc444,_0x2f4941[_0xaa6d('0x45')]);return db[_0xaa6d('0x2c')][_0xaa6d('0x46')](_0x2cc444)[_0xaa6d('0x24')](handleEntityNotFound(_0x4a9019,null))[_0xaa6d('0x24')](respondWithResult(_0x4a9019,null))[_0xaa6d('0x42')](handleError(_0x4a9019,null));};exports[_0xaa6d('0x47')]=function(_0x4aad9f,_0x16b6ac){return db['Interval'][_0xaa6d('0x47')](_0x4aad9f[_0xaa6d('0x48')],{})[_0xaa6d('0x24')](function(_0x419bf9){var _0x263a01=_0x4aad9f[_0xaa6d('0x49')][_0xaa6d('0x25')]({'plain':!![]});if(!_0x263a01)throw new Error(_0xaa6d('0x4a'));if(_0x263a01[_0xaa6d('0x4b')]===_0xaa6d('0x49')){var _0x4208bb=_0x419bf9[_0xaa6d('0x25')]({'plain':!![]});var _0x377c87=_0xaa6d('0x26');return db[_0xaa6d('0x4c')][_0xaa6d('0x46')]({'where':{'name':_0x377c87,'userProfileId':_0x263a01[_0xaa6d('0x4d')]},'raw':!![]})['then'](function(_0x5d8776){if(_0x5d8776&&_0x5d8776['autoAssociation']===0x0){return db[_0xaa6d('0x4e')][_0xaa6d('0x47')]({'name':_0x4208bb['name'],'resourceId':_0x4208bb['id'],'type':_0x5d8776[_0xaa6d('0x28')],'sectionId':_0x5d8776['id']},{})[_0xaa6d('0x24')](function(){return _0x419bf9;});}else{return _0x419bf9;}})[_0xaa6d('0x42')](function(_0x596b8a){logger['error'](_0xaa6d('0x4f'),_0x596b8a);throw _0x596b8a;});}return _0x419bf9;})[_0xaa6d('0x24')](respondWithResult(_0x16b6ac,0xc9))['catch'](handleError(_0x16b6ac,null));};exports[_0xaa6d('0x22')]=function(_0x276c5a,_0x2bd627){if(_0x276c5a[_0xaa6d('0x48')]['id']){delete _0x276c5a['body']['id'];}return db[_0xaa6d('0x2c')][_0xaa6d('0x46')]({'where':{'id':_0x276c5a[_0xaa6d('0x43')]['id']}})['then'](handleEntityNotFound(_0x2bd627,null))['then'](saveUpdates(_0x276c5a[_0xaa6d('0x48')],null))[_0xaa6d('0x24')](respondWithResult(_0x2bd627,null))[_0xaa6d('0x42')](handleError(_0x2bd627,null));};exports['destroy']=function(_0x1f378a,_0x51fbd7){return db[_0xaa6d('0x2c')][_0xaa6d('0x46')]({'where':{'id':_0x1f378a['params']['id']}})[_0xaa6d('0x24')](handleEntityNotFound(_0x51fbd7,null))[_0xaa6d('0x24')](removeEntity(_0x51fbd7,null))['catch'](handleError(_0x51fbd7,null));};exports[_0xaa6d('0x50')]=function(_0x2f5be8,_0x4180cc,_0x886b5f){if(_0x2f5be8[_0xaa6d('0x48')]['id']){delete _0x2f5be8[_0xaa6d('0x48')]['id'];}return db[_0xaa6d('0x2c')][_0xaa6d('0x46')]({'where':{'id':_0x2f5be8[_0xaa6d('0x43')]['id']}})[_0xaa6d('0x24')](handleEntityNotFound(_0x4180cc,null))[_0xaa6d('0x24')](function(_0x532e6e){if(_0x532e6e){_0x2f5be8[_0xaa6d('0x48')]['IntervalId']=_0x532e6e['id'];return db[_0xaa6d('0x2c')][_0xaa6d('0x47')](_0x2f5be8[_0xaa6d('0x48')]);}})['then'](respondWithResult(_0x4180cc,null))[_0xaa6d('0x42')](handleError(_0x4180cc,null));};exports[_0xaa6d('0x51')]=function(_0x4138e8,_0x283f16,_0xf9c2d8){var _0x361647={};var _0xf8a8f1={};var _0x37cd59;var _0x880d7f;return db['Interval'][_0xaa6d('0x52')]({'where':{'id':_0x4138e8['params']['id']}})[_0xaa6d('0x24')](handleEntityNotFound(_0x283f16,null))['then'](function(_0x3913c5){if(_0x3913c5){_0x37cd59=_0x3913c5;_0xf8a8f1[_0xaa6d('0x30')]=_[_0xaa6d('0x32')](db[_0xaa6d('0x2c')]['rawAttributes']);_0xf8a8f1[_0xaa6d('0x31')]=_[_0xaa6d('0x32')](_0x4138e8[_0xaa6d('0x31')]);_0xf8a8f1['filters']=_[_0xaa6d('0x34')](_0xf8a8f1[_0xaa6d('0x30')],_0xf8a8f1[_0xaa6d('0x31')]);_0x361647['attributes']=_[_0xaa6d('0x34')](_0xf8a8f1[_0xaa6d('0x30')],qs[_0xaa6d('0x44')](_0x4138e8['query']['fields']));_0x361647[_0xaa6d('0x35')]=_0x361647[_0xaa6d('0x35')]['length']?_0x361647[_0xaa6d('0x35')]:_0xf8a8f1[_0xaa6d('0x30')];_0x361647['order']=qs[_0xaa6d('0x39')](_0x4138e8[_0xaa6d('0x31')][_0xaa6d('0x39')]);_0x361647[_0xaa6d('0x3a')]=qs[_0xaa6d('0x33')](_['pick'](_0x4138e8[_0xaa6d('0x31')],_0xf8a8f1['filters']));if(_0x4138e8[_0xaa6d('0x31')][_0xaa6d('0x3c')]){_0x361647['where']=_[_0xaa6d('0x3d')](_0x361647[_0xaa6d('0x3a')],{'$or':_['map'](_0x361647[_0xaa6d('0x35')],function(_0x1e2d00){var _0x14b6b6={};_0x14b6b6[_0x1e2d00]={'$like':'%'+_0x4138e8[_0xaa6d('0x31')][_0xaa6d('0x3c')]+'%'};return _0x14b6b6;})});}_0x361647=_['merge']({},_0x361647,_0x4138e8[_0xaa6d('0x45')]);return _0x37cd59[_0xaa6d('0x51')](_0x361647);}})[_0xaa6d('0x24')](function(_0x392971){if(_0x392971){_0x880d7f=_0x392971[_0xaa6d('0x36')];if(!_0x4138e8[_0xaa6d('0x31')]['hasOwnProperty']('nolimit')){_0x361647['limit']=qs[_0xaa6d('0x1c')](_0x4138e8['query']['limit']);_0x361647[_0xaa6d('0x19')]=qs[_0xaa6d('0x19')](_0x4138e8[_0xaa6d('0x31')][_0xaa6d('0x19')]);}return _0x37cd59[_0xaa6d('0x51')](_0x361647);}})[_0xaa6d('0x24')](function(_0x5d3322){if(_0x5d3322){return _0x5d3322?{'count':_0x880d7f,'rows':_0x5d3322}:null;}})['then'](respondWithResult(_0x283f16,null))[_0xaa6d('0x42')](handleError(_0x283f16,null));};exports['addIntervals']=function(_0x30fdff,_0x47ed09,_0x4c9d2b){return db[_0xaa6d('0x2c')]['findOne']({'where':{'id':_0x30fdff[_0xaa6d('0x43')]['id']}})[_0xaa6d('0x24')](handleEntityNotFound(_0x47ed09,null))['then'](function(_0x20ad37){if(_0x20ad37){return db['sequelize'][_0xaa6d('0x53')](function(_0x1fd0cf){return db[_0xaa6d('0x2c')][_0xaa6d('0x23')]({'where':{'IntervalId':_0x30fdff[_0xaa6d('0x43')]['id']},'transaction':_0x1fd0cf})[_0xaa6d('0x24')](function(_0x1e33e5){var _0x367ebc=_['map'](_0x30fdff[_0xaa6d('0x48')],function(_0x1c7ca5){delete _0x1c7ca5['id'];_0x1c7ca5[_0xaa6d('0x54')]=_0x30fdff[_0xaa6d('0x43')]['id'];return _0x1c7ca5;});return db['Interval'][_0xaa6d('0x55')](_0x367ebc,{'transaction':_0x1fd0cf});});})[_0xaa6d('0x24')](function(){return db[_0xaa6d('0x2c')][_0xaa6d('0x41')]({'where':{'IntervalId':_0x30fdff[_0xaa6d('0x43')]['id']}});});}})[_0xaa6d('0x24')](respondWithResult(_0x47ed09,null))[_0xaa6d('0x42')](handleError(_0x47ed09,null));}; \ No newline at end of file +var _0xc6b2=['addInterval','IntervalId','getIntervals','findOne','addIntervals','sequelize','bulkCreate','eml-format','rimraf','fast-json-patch','request-promise','mustache','util','path','sox','fs-extra','squel','to-csv','papaparse','ioredis','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','api','../../config/utils','../../config/environment','../../config/license/util','../../components/extensions/rewrite','sendStatus','status','json','offset','undefined','limit','count','set','Content-Range','apply','reject','save','update','then','destroy','Intervals','UserProfileResource','end','error','stack','name','send','index','map','Interval','rawAttributes','fieldName','type','key','model','query','keys','filters','attributes','intersection','fields','length','hasOwnProperty','order','sort','where','pick','filter','merge','VIRTUAL','options','include','findAll','rows','show','params','includeAll','find','catch','create','body','get','role','UserProfileSection','autoAssociation','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s'];(function(_0x2de187,_0x2f0452){var _0x2c0159=function(_0x12dc33){while(--_0x12dc33){_0x2de187['push'](_0x2de187['shift']());}};_0x2c0159(++_0x2f0452);}(_0xc6b2,0x112));var _0x2c6b=function(_0x41b683,_0x10e5ab){_0x41b683=_0x41b683-0x0;var _0x3e8d91=_0xc6b2[_0x41b683];return _0x3e8d91;};'use strict';var emlformat=require(_0x2c6b('0x0'));var rimraf=require(_0x2c6b('0x1'));var zipdir=require('zip-dir');var jsonpatch=require(_0x2c6b('0x2'));var rp=require(_0x2c6b('0x3'));var moment=require('moment');var BPromise=require('bluebird');var Mustache=require(_0x2c6b('0x4'));var util=require(_0x2c6b('0x5'));var path=require(_0x2c6b('0x6'));var sox=require(_0x2c6b('0x7'));var csv=require('to-csv');var ejs=require('ejs');var fs=require('fs');var fs_extra=require(_0x2c6b('0x8'));var _=require('lodash');var squel=require(_0x2c6b('0x9'));var crypto=require('crypto');var jsforce=require('jsforce');var deskjs=require('desk.js');var toCsv=require(_0x2c6b('0xa'));var querystring=require('querystring');var Papa=require(_0x2c6b('0xb'));var Redis=require(_0x2c6b('0xc'));var authService=require('../../components/auth/service');var qs=require(_0x2c6b('0xd'));var as=require(_0x2c6b('0xe'));var hardwareService=require(_0x2c6b('0xf'));var logger=require('../../config/logger')(_0x2c6b('0x10'));var utils=require(_0x2c6b('0x11'));var config=require(_0x2c6b('0x12'));var licenseUtil=require(_0x2c6b('0x13'));var db=require('../../mysqldb')['db'];var extensions=require(_0x2c6b('0x14'));function respondWithStatusCode(_0x464376,_0x1bd320){_0x1bd320=_0x1bd320||0xcc;return function(_0x957ddc){if(_0x957ddc){return _0x464376[_0x2c6b('0x15')](_0x1bd320);}return _0x464376[_0x2c6b('0x16')](_0x1bd320)['end']();};}function respondWithResult(_0x271795,_0x2dfc60){_0x2dfc60=_0x2dfc60||0xc8;return function(_0x335b86){if(_0x335b86){return _0x271795[_0x2c6b('0x16')](_0x2dfc60)[_0x2c6b('0x17')](_0x335b86);}};}function respondWithFilteredResult(_0x24543b,_0x22ea3f){return function(_0x28918c){if(_0x28918c){var _0x2d9a99=typeof _0x22ea3f[_0x2c6b('0x18')]===_0x2c6b('0x19')&&typeof _0x22ea3f[_0x2c6b('0x1a')]===_0x2c6b('0x19');var _0xa8ba0a=_0x28918c[_0x2c6b('0x1b')];var _0x561d8f=_0x2d9a99?0x0:_0x22ea3f[_0x2c6b('0x18')];var _0x294c47=_0x2d9a99?_0x28918c[_0x2c6b('0x1b')]:_0x22ea3f[_0x2c6b('0x18')]+_0x22ea3f[_0x2c6b('0x1a')];var _0x1d0935;if(_0x294c47>=_0xa8ba0a){_0x294c47=_0xa8ba0a;_0x1d0935=0xc8;}else{_0x1d0935=0xce;}_0x24543b['status'](_0x1d0935);return _0x24543b[_0x2c6b('0x1c')](_0x2c6b('0x1d'),_0x561d8f+'-'+_0x294c47+'/'+_0xa8ba0a)[_0x2c6b('0x17')](_0x28918c);}return null;};}function patchUpdates(_0x4df9a3){return function(_0x5c6812){try{jsonpatch[_0x2c6b('0x1e')](_0x5c6812,_0x4df9a3,!![]);}catch(_0xec876d){return BPromise[_0x2c6b('0x1f')](_0xec876d);}return _0x5c6812[_0x2c6b('0x20')]();};}function saveUpdates(_0x1928f9,_0x39acc1){return function(_0x29d978){if(_0x29d978){return _0x29d978[_0x2c6b('0x21')](_0x1928f9)[_0x2c6b('0x22')](function(_0x3f58d6){return _0x3f58d6;});}return null;};}function removeEntity(_0x554cc8,_0xb1905a){return function(_0x379531){if(_0x379531){return _0x379531[_0x2c6b('0x23')]()['then'](function(){var _0x189c14=_0x379531['get']({'plain':!![]});var _0x36f2a0=_0x2c6b('0x24');return db[_0x2c6b('0x25')]['destroy']({'where':{'type':_0x36f2a0,'resourceId':_0x189c14['id']}})['then'](function(){return _0x379531;});})[_0x2c6b('0x22')](function(){_0x554cc8[_0x2c6b('0x16')](0xcc)[_0x2c6b('0x26')]();});}};}function handleEntityNotFound(_0x25f7d4,_0x795a4a){return function(_0x586d4a){if(!_0x586d4a){_0x25f7d4[_0x2c6b('0x15')](0x194);}return _0x586d4a;};}function handleError(_0x16f5f9,_0x1937cb){_0x1937cb=_0x1937cb||0x1f4;return function(_0x1efa03){logger[_0x2c6b('0x27')](_0x1efa03[_0x2c6b('0x28')]);if(_0x1efa03[_0x2c6b('0x29')]){delete _0x1efa03[_0x2c6b('0x29')];}_0x16f5f9['status'](_0x1937cb)[_0x2c6b('0x2a')](_0x1efa03);};}exports[_0x2c6b('0x2b')]=function(_0x563e71,_0x19f6c1){var _0x527358={},_0x1e3f74={},_0x349505={'count':0x0,'rows':[]};var _0x3261ba=_[_0x2c6b('0x2c')](db[_0x2c6b('0x2d')][_0x2c6b('0x2e')],function(_0x12af18){return{'name':_0x12af18[_0x2c6b('0x2f')],'type':_0x12af18[_0x2c6b('0x30')][_0x2c6b('0x31')]};});_0x1e3f74[_0x2c6b('0x32')]=_['map'](_0x3261ba,'name');_0x1e3f74[_0x2c6b('0x33')]=_[_0x2c6b('0x34')](_0x563e71[_0x2c6b('0x33')]);_0x1e3f74[_0x2c6b('0x35')]=_['intersection'](_0x1e3f74[_0x2c6b('0x32')],_0x1e3f74['query']);_0x527358[_0x2c6b('0x36')]=_[_0x2c6b('0x37')](_0x1e3f74[_0x2c6b('0x32')],qs[_0x2c6b('0x38')](_0x563e71[_0x2c6b('0x33')]['fields']));_0x527358['attributes']=_0x527358[_0x2c6b('0x36')][_0x2c6b('0x39')]?_0x527358[_0x2c6b('0x36')]:_0x1e3f74[_0x2c6b('0x32')];if(!_0x563e71[_0x2c6b('0x33')][_0x2c6b('0x3a')]('nolimit')){_0x527358[_0x2c6b('0x1a')]=qs[_0x2c6b('0x1a')](_0x563e71[_0x2c6b('0x33')]['limit']);_0x527358[_0x2c6b('0x18')]=qs[_0x2c6b('0x18')](_0x563e71['query']['offset']);}_0x527358[_0x2c6b('0x3b')]=qs[_0x2c6b('0x3c')](_0x563e71[_0x2c6b('0x33')]['sort']);_0x527358[_0x2c6b('0x3d')]=qs[_0x2c6b('0x35')](_[_0x2c6b('0x3e')](_0x563e71['query'],_0x1e3f74[_0x2c6b('0x35')]),_0x3261ba);if(_0x563e71[_0x2c6b('0x33')][_0x2c6b('0x3f')]){_0x527358[_0x2c6b('0x3d')]=_[_0x2c6b('0x40')](_0x527358[_0x2c6b('0x3d')],{'$or':_['map'](_0x3261ba,function(_0xabfa13){if(_0xabfa13[_0x2c6b('0x30')]!==_0x2c6b('0x41')){var _0x2af515={};_0x2af515[_0xabfa13[_0x2c6b('0x29')]]={'$like':'%'+_0x563e71[_0x2c6b('0x33')]['filter']+'%'};return _0x2af515;}})});}_0x527358=_[_0x2c6b('0x40')]({},_0x527358,_0x563e71[_0x2c6b('0x42')]);var _0x854906={'where':_0x527358[_0x2c6b('0x3d')]};return db[_0x2c6b('0x2d')][_0x2c6b('0x1b')](_0x854906)['then'](function(_0x1bd025){_0x349505[_0x2c6b('0x1b')]=_0x1bd025;if(_0x563e71[_0x2c6b('0x33')]['includeAll']){_0x527358[_0x2c6b('0x43')]=[{'all':!![]}];}return db[_0x2c6b('0x2d')][_0x2c6b('0x44')](_0x527358);})['then'](function(_0x114694){_0x349505[_0x2c6b('0x45')]=_0x114694;return _0x349505;})[_0x2c6b('0x22')](respondWithFilteredResult(_0x19f6c1,_0x527358))['catch'](handleError(_0x19f6c1,null));};exports[_0x2c6b('0x46')]=function(_0x17e37c,_0x237e07){var _0x30461c={'raw':!![],'where':{'id':_0x17e37c[_0x2c6b('0x47')]['id']}},_0x4b8e51={};_0x4b8e51[_0x2c6b('0x32')]=_[_0x2c6b('0x34')](db['Interval'][_0x2c6b('0x2e')]);_0x4b8e51[_0x2c6b('0x33')]=_['keys'](_0x17e37c[_0x2c6b('0x33')]);_0x4b8e51[_0x2c6b('0x35')]=_[_0x2c6b('0x37')](_0x4b8e51['model'],_0x4b8e51[_0x2c6b('0x33')]);_0x30461c[_0x2c6b('0x36')]=_[_0x2c6b('0x37')](_0x4b8e51[_0x2c6b('0x32')],qs[_0x2c6b('0x38')](_0x17e37c['query'][_0x2c6b('0x38')]));_0x30461c['attributes']=_0x30461c[_0x2c6b('0x36')][_0x2c6b('0x39')]?_0x30461c[_0x2c6b('0x36')]:_0x4b8e51[_0x2c6b('0x32')];if(_0x17e37c[_0x2c6b('0x33')][_0x2c6b('0x48')]){_0x30461c['include']=[{'all':!![]}];}_0x30461c=_[_0x2c6b('0x40')]({},_0x30461c,_0x17e37c[_0x2c6b('0x42')]);return db[_0x2c6b('0x2d')][_0x2c6b('0x49')](_0x30461c)['then'](handleEntityNotFound(_0x237e07,null))[_0x2c6b('0x22')](respondWithResult(_0x237e07,null))[_0x2c6b('0x4a')](handleError(_0x237e07,null));};exports['create']=function(_0x404589,_0x3e0072){return db[_0x2c6b('0x2d')][_0x2c6b('0x4b')](_0x404589[_0x2c6b('0x4c')],{})[_0x2c6b('0x22')](function(_0x59c1b2){var _0x849210=_0x404589['user'][_0x2c6b('0x4d')]({'plain':!![]});if(!_0x849210)throw new Error('Unable\x20to\x20retrieve\x20the\x20current\x20user');if(_0x849210[_0x2c6b('0x4e')]==='user'){var _0x23c239=_0x59c1b2[_0x2c6b('0x4d')]({'plain':!![]});var _0x298ee4='Intervals';return db[_0x2c6b('0x4f')][_0x2c6b('0x49')]({'where':{'name':_0x298ee4,'userProfileId':_0x849210['userProfileId']},'raw':!![]})['then'](function(_0x18610c){if(_0x18610c&&_0x18610c[_0x2c6b('0x50')]===0x0){return db[_0x2c6b('0x25')][_0x2c6b('0x4b')]({'name':_0x23c239[_0x2c6b('0x29')],'resourceId':_0x23c239['id'],'type':_0x18610c['name'],'sectionId':_0x18610c['id']},{})['then'](function(){return _0x59c1b2;});}else{return _0x59c1b2;}})[_0x2c6b('0x4a')](function(_0x3da5a7){logger[_0x2c6b('0x27')](_0x2c6b('0x51'),_0x3da5a7);throw _0x3da5a7;});}return _0x59c1b2;})[_0x2c6b('0x22')](respondWithResult(_0x3e0072,0xc9))[_0x2c6b('0x4a')](handleError(_0x3e0072,null));};exports[_0x2c6b('0x21')]=function(_0x28f64a,_0x16623f){if(_0x28f64a[_0x2c6b('0x4c')]['id']){delete _0x28f64a[_0x2c6b('0x4c')]['id'];}return db[_0x2c6b('0x2d')][_0x2c6b('0x49')]({'where':{'id':_0x28f64a['params']['id']}})[_0x2c6b('0x22')](handleEntityNotFound(_0x16623f,null))[_0x2c6b('0x22')](saveUpdates(_0x28f64a[_0x2c6b('0x4c')],null))[_0x2c6b('0x22')](respondWithResult(_0x16623f,null))[_0x2c6b('0x4a')](handleError(_0x16623f,null));};exports['destroy']=function(_0x56c124,_0x77776a){return db['Interval'][_0x2c6b('0x49')]({'where':{'id':_0x56c124[_0x2c6b('0x47')]['id']}})['then'](handleEntityNotFound(_0x77776a,null))[_0x2c6b('0x22')](removeEntity(_0x77776a,null))['catch'](handleError(_0x77776a,null));};exports[_0x2c6b('0x52')]=function(_0x484ee2,_0x533d40,_0xf12f8c){if(_0x484ee2[_0x2c6b('0x4c')]['id']){delete _0x484ee2[_0x2c6b('0x4c')]['id'];}return db[_0x2c6b('0x2d')][_0x2c6b('0x49')]({'where':{'id':_0x484ee2[_0x2c6b('0x47')]['id']}})[_0x2c6b('0x22')](handleEntityNotFound(_0x533d40,null))[_0x2c6b('0x22')](function(_0x42849a){if(_0x42849a){_0x484ee2['body'][_0x2c6b('0x53')]=_0x42849a['id'];return db[_0x2c6b('0x2d')][_0x2c6b('0x4b')](_0x484ee2[_0x2c6b('0x4c')]);}})['then'](respondWithResult(_0x533d40,null))['catch'](handleError(_0x533d40,null));};exports[_0x2c6b('0x54')]=function(_0x21667b,_0x59de59,_0x4c4bcb){var _0x2f9363={};var _0x3eb366={};var _0x3b881e;var _0x550699;return db[_0x2c6b('0x2d')][_0x2c6b('0x55')]({'where':{'id':_0x21667b[_0x2c6b('0x47')]['id']}})[_0x2c6b('0x22')](handleEntityNotFound(_0x59de59,null))['then'](function(_0x5d3573){if(_0x5d3573){_0x3b881e=_0x5d3573;_0x3eb366[_0x2c6b('0x32')]=_[_0x2c6b('0x34')](db[_0x2c6b('0x2d')][_0x2c6b('0x2e')]);_0x3eb366[_0x2c6b('0x33')]=_['keys'](_0x21667b['query']);_0x3eb366['filters']=_[_0x2c6b('0x37')](_0x3eb366[_0x2c6b('0x32')],_0x3eb366[_0x2c6b('0x33')]);_0x2f9363['attributes']=_['intersection'](_0x3eb366[_0x2c6b('0x32')],qs[_0x2c6b('0x38')](_0x21667b[_0x2c6b('0x33')][_0x2c6b('0x38')]));_0x2f9363[_0x2c6b('0x36')]=_0x2f9363[_0x2c6b('0x36')]['length']?_0x2f9363['attributes']:_0x3eb366['model'];_0x2f9363['order']=qs['sort'](_0x21667b['query']['sort']);_0x2f9363['where']=qs[_0x2c6b('0x35')](_[_0x2c6b('0x3e')](_0x21667b[_0x2c6b('0x33')],_0x3eb366['filters']));if(_0x21667b[_0x2c6b('0x33')][_0x2c6b('0x3f')]){_0x2f9363[_0x2c6b('0x3d')]=_[_0x2c6b('0x40')](_0x2f9363[_0x2c6b('0x3d')],{'$or':_[_0x2c6b('0x2c')](_0x2f9363[_0x2c6b('0x36')],function(_0x2ef2e2){var _0x5be8d8={};_0x5be8d8[_0x2ef2e2]={'$like':'%'+_0x21667b['query'][_0x2c6b('0x3f')]+'%'};return _0x5be8d8;})});}_0x2f9363=_[_0x2c6b('0x40')]({},_0x2f9363,_0x21667b[_0x2c6b('0x42')]);return _0x3b881e[_0x2c6b('0x54')](_0x2f9363);}})[_0x2c6b('0x22')](function(_0x504986){if(_0x504986){_0x550699=_0x504986[_0x2c6b('0x39')];if(!_0x21667b[_0x2c6b('0x33')][_0x2c6b('0x3a')]('nolimit')){_0x2f9363[_0x2c6b('0x1a')]=qs[_0x2c6b('0x1a')](_0x21667b['query'][_0x2c6b('0x1a')]);_0x2f9363[_0x2c6b('0x18')]=qs[_0x2c6b('0x18')](_0x21667b['query']['offset']);}return _0x3b881e[_0x2c6b('0x54')](_0x2f9363);}})[_0x2c6b('0x22')](function(_0x44223d){if(_0x44223d){return _0x44223d?{'count':_0x550699,'rows':_0x44223d}:null;}})['then'](respondWithResult(_0x59de59,null))[_0x2c6b('0x4a')](handleError(_0x59de59,null));};exports[_0x2c6b('0x56')]=function(_0x5b27d5,_0x370b80,_0x2334a8){return db[_0x2c6b('0x2d')][_0x2c6b('0x55')]({'where':{'id':_0x5b27d5[_0x2c6b('0x47')]['id']}})['then'](handleEntityNotFound(_0x370b80,null))['then'](function(_0x4f1a7e){if(_0x4f1a7e){return db[_0x2c6b('0x57')]['transaction'](function(_0x1e4de9){return db[_0x2c6b('0x2d')][_0x2c6b('0x23')]({'where':{'IntervalId':_0x5b27d5[_0x2c6b('0x47')]['id']},'transaction':_0x1e4de9})[_0x2c6b('0x22')](function(_0x2a332c){var _0x17c362=_[_0x2c6b('0x2c')](_0x5b27d5[_0x2c6b('0x4c')],function(_0x3ddca9){delete _0x3ddca9['id'];_0x3ddca9[_0x2c6b('0x53')]=_0x5b27d5[_0x2c6b('0x47')]['id'];return _0x3ddca9;});return db[_0x2c6b('0x2d')][_0x2c6b('0x58')](_0x17c362,{'transaction':_0x1e4de9});});})['then'](function(){return db['Interval'][_0x2c6b('0x44')]({'where':{'IntervalId':_0x5b27d5[_0x2c6b('0x47')]['id']}});});}})[_0x2c6b('0x22')](respondWithResult(_0x370b80,null))[_0x2c6b('0x4a')](handleError(_0x370b80,null));}; \ No newline at end of file diff --git a/server/api/interval/interval.model.js b/server/api/interval/interval.model.js index 8e13881..7a1777b 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 _0xf781=['exports','define','tools_intervals','rewrite','interval','getIntervals','all','map','then','reduce','../../components/extensions/rewrite','../../utils/iftime','iftime'];(function(_0xfdae14,_0x3f712a){var _0x36647d=function(_0x43a872){while(--_0x43a872){_0xfdae14['push'](_0xfdae14['shift']());}};_0x36647d(++_0x3f712a);}(_0xf781,0x99));var _0x1f78=function(_0x8a5e34,_0x5e62af){_0x8a5e34=_0x8a5e34-0x0;var _0xd74e18=_0xf781[_0x8a5e34];return _0xd74e18;};'use strict';var attributes=require('./interval.attributes');var extensions=require(_0x1f78('0x0'));var iftime=require(_0x1f78('0x1'))[_0x1f78('0x2')];module[_0x1f78('0x3')]=function(_0x386f98){return _0x386f98[_0x1f78('0x4')]('Interval',attributes,{'tableName':_0x1f78('0x5'),'paranoid':![],'indexes':[],'timestamps':!![],'hooks':{'afterCreate':function(_0x7f58b6){extensions[_0x1f78('0x6')](_0x386f98,_0x7f58b6);},'afterBulkCreate':function(_0x5d1564,_0x14babe,_0x57713f){_0x57713f();extensions[_0x1f78('0x6')](_0x386f98,_0x5d1564[0x0]);},'afterUpdate':function(_0x3596b2){extensions['rewrite'](_0x386f98,_0x3596b2);},'afterDestroy':function(_0x542629){extensions[_0x1f78('0x6')](_0x386f98,_0x542629);}},'instanceMethods':{'ifTime':function(_0x2e77f5=undefined,_0x211c51=new Date()){if(typeof this[_0x1f78('0x7')]==='string'){return iftime(this[_0x1f78('0x7')],_0x2e77f5,_0x211c51);}else{return this[_0x1f78('0x8')]()['then'](function(_0x102dec){return Promise[_0x1f78('0x9')](_0x102dec[_0x1f78('0xa')](function(_0x324b1d){return _0x324b1d['ifTime'](_0x2e77f5,_0x211c51);}));})[_0x1f78('0xb')](function(_0x4485fe){return _0x4485fe[_0x1f78('0xc')](function(_0x2ee471,_0x22d62f){return _0x2ee471||_0x22d62f;},![]);});}}}});}; \ No newline at end of file +var _0x24f5=['getIntervals','then','all','map','ifTime','./interval.attributes','../../components/extensions/rewrite','../../utils/iftime','iftime','exports','Interval','tools_intervals','rewrite','interval','string'];(function(_0xc6be3a,_0x540e05){var _0x56a310=function(_0x50a144){while(--_0x50a144){_0xc6be3a['push'](_0xc6be3a['shift']());}};_0x56a310(++_0x540e05);}(_0x24f5,0x17c));var _0x524f=function(_0x14add3,_0x13ce8d){_0x14add3=_0x14add3-0x0;var _0x4a174f=_0x24f5[_0x14add3];return _0x4a174f;};'use strict';var attributes=require(_0x524f('0x0'));var extensions=require(_0x524f('0x1'));var iftime=require(_0x524f('0x2'))[_0x524f('0x3')];module[_0x524f('0x4')]=function(_0x188d9e){return _0x188d9e['define'](_0x524f('0x5'),attributes,{'tableName':_0x524f('0x6'),'paranoid':![],'indexes':[],'timestamps':!![],'hooks':{'afterCreate':function(_0x281120){extensions[_0x524f('0x7')](_0x188d9e,_0x281120);},'afterBulkCreate':function(_0x4af91c,_0x23bda1,_0x2177bd){_0x2177bd();extensions[_0x524f('0x7')](_0x188d9e,_0x4af91c[0x0]);},'afterUpdate':function(_0x2c8600){extensions[_0x524f('0x7')](_0x188d9e,_0x2c8600);},'afterDestroy':function(_0x252c3b){extensions[_0x524f('0x7')](_0x188d9e,_0x252c3b);}},'instanceMethods':{'ifTime':function(_0x8a69d6=undefined,_0x49700c=new Date()){if(typeof this[_0x524f('0x8')]===_0x524f('0x9')){return iftime(this['interval'],_0x8a69d6,_0x49700c);}else{return this[_0x524f('0xa')]()[_0x524f('0xb')](function(_0x51d4af){return Promise[_0x524f('0xc')](_0x51d4af[_0x524f('0xd')](function(_0x4ae9e7){return _0x4ae9e7[_0x524f('0xe')](_0x8a69d6,_0x49700c);}));})[_0x524f('0xb')](function(_0x40c86c){return _0x40c86c['reduce'](function(_0x4edad6,_0x44b2cc){return _0x4edad6||_0x44b2cc;},![]);});}}}});}; \ No newline at end of file diff --git a/server/api/interval/interval.rpc.js b/server/api/interval/interval.rpc.js index fd9683a..4bde579 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 _0xfe5c=['limit','map','include','model','attributes','then','info','GetInterval','debug','catch','message','error','ShowInterval','find','where','stringify','all','reduce','format','IntervalIftime:\x20intervals\x20=\x20%s\x20(ids\x20=\x20%s)','join','findById','name','ifTime','IntervalIftime','intervalIds','intervals','string','timezone','length','IntervalIftime:\x20interval\x20strings\x20=\x20%s','IntervalIftime:\x20timezone\x20=\x20%s','Iftime','silly','resolve','isArray','../../mysqldb','iftime','../../config/logger','rpc','Interval','findAll','options','raw'];(function(_0x11f1fd,_0xce95a8){var _0x2d1215=function(_0x532087){while(--_0x532087){_0x11f1fd['push'](_0x11f1fd['shift']());}};_0x2d1215(++_0xce95a8);}(_0xfe5c,0x158));var _0xcfe5=function(_0x2d95ca,_0x59e3db){_0x2d95ca=_0x2d95ca-0x0;var _0xb2fdcd=_0xfe5c[_0x2d95ca];return _0xb2fdcd;};'use strict';var _=require('lodash');var util=require('util');var db=require(_0xcfe5('0x0'))['db'];var iftime=require('../../utils/iftime')[_0xcfe5('0x1')];var logger=require(_0xcfe5('0x2'))(_0xcfe5('0x3'));exports['GetInterval']=function(_0x5c0c63){var _0x6349fc=this;return new Promise(function(_0x40fe9d,_0x3d7509){return db[_0xcfe5('0x4')][_0xcfe5('0x5')]({'raw':_0x5c0c63[_0xcfe5('0x6')]?_0x5c0c63[_0xcfe5('0x6')][_0xcfe5('0x7')]===undefined?!![]:![]:!![],'where':_0x5c0c63[_0xcfe5('0x6')]?_0x5c0c63[_0xcfe5('0x6')]['where']||null:null,'attributes':_0x5c0c63[_0xcfe5('0x6')]?_0x5c0c63[_0xcfe5('0x6')]['attributes']||null:null,'limit':_0x5c0c63[_0xcfe5('0x6')]?_0x5c0c63['options'][_0xcfe5('0x8')]||null:null,'include':_0x5c0c63[_0xcfe5('0x6')]?_0x5c0c63['options']['include']?_[_0xcfe5('0x9')](_0x5c0c63['options'][_0xcfe5('0xa')],function(_0x4a1846){return{'model':db[_0x4a1846[_0xcfe5('0xb')]],'as':_0x4a1846['as'],'attributes':_0x4a1846[_0xcfe5('0xc')],'include':_0x4a1846[_0xcfe5('0xa')]?_[_0xcfe5('0x9')](_0x4a1846[_0xcfe5('0xa')],function(_0x4e3f31){return{'model':db[_0x4e3f31[_0xcfe5('0xb')]],'as':_0x4e3f31['as'],'attributes':_0x4e3f31[_0xcfe5('0xc')],'include':_0x4e3f31[_0xcfe5('0xa')]?_[_0xcfe5('0x9')](_0x4e3f31[_0xcfe5('0xa')],function(_0x4c1ebd){return{'model':db[_0x4c1ebd['model']],'as':_0x4c1ebd['as'],'attributes':_0x4c1ebd[_0xcfe5('0xc')]};}):[]};}):[]};}):[]:[]})[_0xcfe5('0xd')](function(_0x225ffe){logger[_0xcfe5('0xe')](_0xcfe5('0xf'),_0x5c0c63);logger[_0xcfe5('0x10')](_0xcfe5('0xf'),_0x5c0c63,JSON['stringify'](_0x225ffe));_0x40fe9d(_0x225ffe);})[_0xcfe5('0x11')](function(_0x571e76){logger['error'](_0xcfe5('0xf'),_0x571e76[_0xcfe5('0x12')],_0x5c0c63);_0x3d7509(_0x6349fc[_0xcfe5('0x13')](0x1f4,_0x571e76['message']));});});};exports[_0xcfe5('0x14')]=function(_0x4ed028){var _0x3390bd=this;return new Promise(function(_0x11dfac,_0x429aea){return db['Interval'][_0xcfe5('0x15')]({'raw':_0x4ed028[_0xcfe5('0x6')]?_0x4ed028['options'][_0xcfe5('0x7')]===undefined?!![]:![]:!![],'where':_0x4ed028['options']?_0x4ed028[_0xcfe5('0x6')][_0xcfe5('0x16')]||null:null,'attributes':_0x4ed028[_0xcfe5('0x6')]?_0x4ed028[_0xcfe5('0x6')]['attributes']||null:null,'include':_0x4ed028['options']?_0x4ed028[_0xcfe5('0x6')]['include']?_['map'](_0x4ed028['options']['include'],function(_0x545d13){return{'model':db[_0x545d13[_0xcfe5('0xb')]],'as':_0x545d13['as'],'attributes':_0x545d13[_0xcfe5('0xc')],'include':_0x545d13[_0xcfe5('0xa')]?_[_0xcfe5('0x9')](_0x545d13['include'],function(_0x2c4d38){return{'model':db[_0x2c4d38[_0xcfe5('0xb')]],'as':_0x2c4d38['as'],'attributes':_0x2c4d38[_0xcfe5('0xc')],'include':_0x2c4d38[_0xcfe5('0xa')]?_[_0xcfe5('0x9')](_0x2c4d38['include'],function(_0x41168e){return{'model':db[_0x41168e[_0xcfe5('0xb')]],'as':_0x41168e['as'],'attributes':_0x41168e[_0xcfe5('0xc')]};}):[]};}):[]};}):[]:[]})['then'](function(_0xc59fa0){logger[_0xcfe5('0xe')](_0xcfe5('0x14'),_0x4ed028);logger['debug'](_0xcfe5('0x14'),_0x4ed028,JSON[_0xcfe5('0x17')](_0xc59fa0));_0x11dfac(_0xc59fa0);})[_0xcfe5('0x11')](function(_0x2f7a97){logger[_0xcfe5('0x13')](_0xcfe5('0x14'),_0x2f7a97[_0xcfe5('0x12')],_0x4ed028);_0x429aea(_0x3390bd[_0xcfe5('0x13')](0x1f4,_0x2f7a97[_0xcfe5('0x12')]));});});};function checkArrayOfIntervals(_0x6b8a5b,_0x14ce77){var _0x83e407=[];return db[_0xcfe5('0x4')][_0xcfe5('0x5')]({'where':{'id':_0x6b8a5b}})[_0xcfe5('0xd')](function(_0xcdb57c){_0x83e407=_0xcdb57c;return Promise[_0xcfe5('0x18')](_0x83e407[_0xcfe5('0x9')](function(_0x3d83c6){return _0x3d83c6['ifTime'](_0x14ce77);}));})[_0xcfe5('0xd')](function(_0x2d62ca){var _0x2f6581=_0x2d62ca[_0xcfe5('0x19')](function(_0x41f824,_0x554ec2){return _0x41f824||_0x554ec2;},![]);logger[_0xcfe5('0xe')](util[_0xcfe5('0x1a')](_0xcfe5('0x1b'),_0x83e407['map'](function(_0x2434c6){return _0x2434c6['name'];})[_0xcfe5('0x1c')](',\x20'),_0x83e407[_0xcfe5('0x9')](function(_0x3dad8a){return _0x3dad8a['id'];})['join'](',\x20')));return _0x2f6581;});}function checkSingleInterval(_0x118382,_0x28816c){return db['Interval'][_0xcfe5('0x1d')](_0x118382)[_0xcfe5('0xd')](function(_0x451dc2){if(_0x451dc2){logger[_0xcfe5('0xe')](util[_0xcfe5('0x1a')]('IntervalIftime:\x20interval\x20=\x20%s\x20(id\x20=\x20%s)',_0x451dc2[_0xcfe5('0x1e')],_0x451dc2['id']));return _0x451dc2[_0xcfe5('0x1f')](_0x28816c);}});}exports[_0xcfe5('0x20')]=function(_0x18e0d0){var _0x5e96d9=_0x18e0d0[_0xcfe5('0x21')];var _0xf3d3c=Array['isArray'](_0x18e0d0[_0xcfe5('0x22')])?_0x18e0d0[_0xcfe5('0x22')]:typeof _0x18e0d0[_0xcfe5('0x22')]===_0xcfe5('0x23')?[_0x18e0d0[_0xcfe5('0x22')]]:[];var _0x58cee1=_0x18e0d0[_0xcfe5('0x24')]||undefined;var _0x516917=![];if(_0xf3d3c[_0xcfe5('0x25')]){logger[_0xcfe5('0xe')](util[_0xcfe5('0x1a')](_0xcfe5('0x26'),_0xf3d3c[_0xcfe5('0x1c')](';\x20')));}if(_0x58cee1){logger[_0xcfe5('0xe')](util[_0xcfe5('0x1a')](_0xcfe5('0x27'),_0x58cee1));}logger['debug'](_0xcfe5('0x28'),_0x516917);logger[_0xcfe5('0x29')]('IntervalIftime',_0x18e0d0);return Promise[_0xcfe5('0x2a')]()[_0xcfe5('0xd')](function(){if(Array[_0xcfe5('0x2b')](_0x5e96d9)){return checkArrayOfIntervals(_0x5e96d9,_0x58cee1);}else if(_0x5e96d9){return checkSingleInterval(_0x5e96d9,_0x58cee1);}})[_0xcfe5('0xd')](function(_0x3f55a5){var _0xc75789=_0xf3d3c[_0xcfe5('0x19')](function(_0x3cdd2c,_0x11ffb7){return _0x3cdd2c||iftime(_0x11ffb7,_0x58cee1);},![]);_0x516917=_0x3f55a5||_0xc75789;return _0x516917;})[_0xcfe5('0x11')](function(_0x329f0b){logger[_0xcfe5('0x13')](_0xcfe5('0x20'),_0x18e0d0,_0x329f0b);throw this['error'](0x1f4,_0x329f0b[_0xcfe5('0x12')]);});}; \ No newline at end of file +var _0xbbab=['format','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','../../utils/iftime','../../config/logger','GetInterval','options','attributes','limit','include','model','map','then','info','debug','stringify','catch','error','message','Interval','find','where','ShowInterval','findAll','all','ifTime','reduce'];(function(_0x5d6434,_0x5e6328){var _0xf2a276=function(_0x177602){while(--_0x177602){_0x5d6434['push'](_0x5d6434['shift']());}};_0xf2a276(++_0x5e6328);}(_0xbbab,0x178));var _0xbbba=function(_0x3cda17,_0x436107){_0x3cda17=_0x3cda17-0x0;var _0x1eee4b=_0xbbab[_0x3cda17];return _0x1eee4b;};'use strict';var _=require('lodash');var util=require('util');var db=require('../../mysqldb')['db'];var iftime=require(_0xbbba('0x0'))['iftime'];var logger=require(_0xbbba('0x1'))('rpc');exports[_0xbbba('0x2')]=function(_0x41f638){var _0x3d3cc4=this;return new Promise(function(_0x13c896,_0x5390d8){return db['Interval']['findAll']({'raw':_0x41f638['options']?_0x41f638[_0xbbba('0x3')]['raw']===undefined?!![]:![]:!![],'where':_0x41f638[_0xbbba('0x3')]?_0x41f638[_0xbbba('0x3')]['where']||null:null,'attributes':_0x41f638['options']?_0x41f638[_0xbbba('0x3')][_0xbbba('0x4')]||null:null,'limit':_0x41f638[_0xbbba('0x3')]?_0x41f638['options'][_0xbbba('0x5')]||null:null,'include':_0x41f638[_0xbbba('0x3')]?_0x41f638[_0xbbba('0x3')][_0xbbba('0x6')]?_['map'](_0x41f638[_0xbbba('0x3')][_0xbbba('0x6')],function(_0x5d8a4e){return{'model':db[_0x5d8a4e[_0xbbba('0x7')]],'as':_0x5d8a4e['as'],'attributes':_0x5d8a4e['attributes'],'include':_0x5d8a4e[_0xbbba('0x6')]?_['map'](_0x5d8a4e[_0xbbba('0x6')],function(_0x309e34){return{'model':db[_0x309e34['model']],'as':_0x309e34['as'],'attributes':_0x309e34[_0xbbba('0x4')],'include':_0x309e34[_0xbbba('0x6')]?_[_0xbbba('0x8')](_0x309e34[_0xbbba('0x6')],function(_0x3b9cf7){return{'model':db[_0x3b9cf7['model']],'as':_0x3b9cf7['as'],'attributes':_0x3b9cf7[_0xbbba('0x4')]};}):[]};}):[]};}):[]:[]})[_0xbbba('0x9')](function(_0x24c832){logger[_0xbbba('0xa')](_0xbbba('0x2'),_0x41f638);logger[_0xbbba('0xb')]('GetInterval',_0x41f638,JSON[_0xbbba('0xc')](_0x24c832));_0x13c896(_0x24c832);})[_0xbbba('0xd')](function(_0x2a6143){logger[_0xbbba('0xe')](_0xbbba('0x2'),_0x2a6143[_0xbbba('0xf')],_0x41f638);_0x5390d8(_0x3d3cc4[_0xbbba('0xe')](0x1f4,_0x2a6143[_0xbbba('0xf')]));});});};exports['ShowInterval']=function(_0x46f917){var _0x1c64b7=this;return new Promise(function(_0x4af5b1,_0x30a2ec){return db[_0xbbba('0x10')][_0xbbba('0x11')]({'raw':_0x46f917[_0xbbba('0x3')]?_0x46f917[_0xbbba('0x3')]['raw']===undefined?!![]:![]:!![],'where':_0x46f917[_0xbbba('0x3')]?_0x46f917['options'][_0xbbba('0x12')]||null:null,'attributes':_0x46f917[_0xbbba('0x3')]?_0x46f917[_0xbbba('0x3')][_0xbbba('0x4')]||null:null,'include':_0x46f917[_0xbbba('0x3')]?_0x46f917[_0xbbba('0x3')][_0xbbba('0x6')]?_[_0xbbba('0x8')](_0x46f917[_0xbbba('0x3')][_0xbbba('0x6')],function(_0x1a36d5){return{'model':db[_0x1a36d5[_0xbbba('0x7')]],'as':_0x1a36d5['as'],'attributes':_0x1a36d5['attributes'],'include':_0x1a36d5[_0xbbba('0x6')]?_[_0xbbba('0x8')](_0x1a36d5[_0xbbba('0x6')],function(_0x51a948){return{'model':db[_0x51a948[_0xbbba('0x7')]],'as':_0x51a948['as'],'attributes':_0x51a948['attributes'],'include':_0x51a948[_0xbbba('0x6')]?_[_0xbbba('0x8')](_0x51a948[_0xbbba('0x6')],function(_0x3b68ba){return{'model':db[_0x3b68ba[_0xbbba('0x7')]],'as':_0x3b68ba['as'],'attributes':_0x3b68ba['attributes']};}):[]};}):[]};}):[]:[]})[_0xbbba('0x9')](function(_0x4d8995){logger[_0xbbba('0xa')](_0xbbba('0x13'),_0x46f917);logger[_0xbbba('0xb')]('ShowInterval',_0x46f917,JSON[_0xbbba('0xc')](_0x4d8995));_0x4af5b1(_0x4d8995);})[_0xbbba('0xd')](function(_0x4c1b38){logger[_0xbbba('0xe')]('ShowInterval',_0x4c1b38[_0xbbba('0xf')],_0x46f917);_0x30a2ec(_0x1c64b7[_0xbbba('0xe')](0x1f4,_0x4c1b38[_0xbbba('0xf')]));});});};function checkArrayOfIntervals(_0x4e0d88,_0x34cec5){var _0x43723b=[];return db[_0xbbba('0x10')][_0xbbba('0x14')]({'where':{'id':_0x4e0d88}})[_0xbbba('0x9')](function(_0x2a4d67){_0x43723b=_0x2a4d67;return Promise[_0xbbba('0x15')](_0x43723b[_0xbbba('0x8')](function(_0x1434b0){return _0x1434b0[_0xbbba('0x16')](_0x34cec5);}));})['then'](function(_0x3297d4){var _0x2cc892=_0x3297d4[_0xbbba('0x17')](function(_0x50b2af,_0x3ed1ab){return _0x50b2af||_0x3ed1ab;},![]);logger['info'](util[_0xbbba('0x18')]('IntervalIftime:\x20intervals\x20=\x20%s\x20(ids\x20=\x20%s)',_0x43723b['map'](function(_0x3763f7){return _0x3763f7[_0xbbba('0x19')];})[_0xbbba('0x1a')](',\x20'),_0x43723b['map'](function(_0x27c2ea){return _0x27c2ea['id'];})[_0xbbba('0x1a')](',\x20')));return _0x2cc892;});}function checkSingleInterval(_0xd03390,_0x334bb2){return db[_0xbbba('0x10')][_0xbbba('0x1b')](_0xd03390)[_0xbbba('0x9')](function(_0x4859e1){if(_0x4859e1){logger['info'](util['format'](_0xbbba('0x1c'),_0x4859e1['name'],_0x4859e1['id']));return _0x4859e1[_0xbbba('0x16')](_0x334bb2);}});}exports[_0xbbba('0x1d')]=function(_0x23a04b){var _0x369e0d=_0x23a04b[_0xbbba('0x1e')];var _0x351d4f=Array[_0xbbba('0x1f')](_0x23a04b[_0xbbba('0x20')])?_0x23a04b['intervals']:typeof _0x23a04b[_0xbbba('0x20')]===_0xbbba('0x21')?[_0x23a04b['intervals']]:[];var _0x45ba23=_0x23a04b[_0xbbba('0x22')]||undefined;var _0x1e1c46=![];if(_0x351d4f[_0xbbba('0x23')]){logger[_0xbbba('0xa')](util[_0xbbba('0x18')](_0xbbba('0x24'),_0x351d4f[_0xbbba('0x1a')](';\x20')));}if(_0x45ba23){logger[_0xbbba('0xa')](util[_0xbbba('0x18')](_0xbbba('0x25'),_0x45ba23));}logger[_0xbbba('0xb')](_0xbbba('0x26'),_0x1e1c46);logger['silly'](_0xbbba('0x1d'),_0x23a04b);return Promise[_0xbbba('0x27')]()['then'](function(){if(Array['isArray'](_0x369e0d)){return checkArrayOfIntervals(_0x369e0d,_0x45ba23);}else if(_0x369e0d){return checkSingleInterval(_0x369e0d,_0x45ba23);}})['then'](function(_0x42cc1e){var _0xd56d3b=_0x351d4f[_0xbbba('0x17')](function(_0x5d7825,_0x327831){return _0x5d7825||iftime(_0x327831,_0x45ba23);},![]);_0x1e1c46=_0x42cc1e||_0xd56d3b;return _0x1e1c46;})[_0xbbba('0xd')](function(_0x564faf){logger['error'](_0xbbba('0x1d'),_0x23a04b,_0x564faf);throw this['error'](0x1f4,_0x564faf[_0xbbba('0xf')]);});}; \ No newline at end of file diff --git a/server/api/jira/index.js b/server/api/jira/index.js index eaf49c0..2345f94 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 _0xadb5=['post','isAuthenticated','exports','Router','./jira.controller'];(function(_0x5da932,_0xc609d8){var _0x25d4b2=function(_0x1c73c6){while(--_0x1c73c6){_0x5da932['push'](_0x5da932['shift']());}};_0x25d4b2(++_0xc609d8);}(_0xadb5,0xad));var _0x5adb=function(_0x211b08,_0x1beb92){_0x211b08=_0x211b08-0x0;var _0x3e1055=_0xadb5[_0x211b08];return _0x3e1055;};'use strict';var express=require('express');var router=express[_0x5adb('0x0')]();var auth=require('../../components/auth/service');var controller=require(_0x5adb('0x1'));router[_0x5adb('0x2')]('/',auth[_0x5adb('0x3')](),controller['send']);module[_0x5adb('0x4')]=router; \ No newline at end of file +var _0xadb5=['post','isAuthenticated','exports','Router','./jira.controller'];(function(_0x1c4b4f,_0x5b18eb){var _0x32fbf2=function(_0x312a1e){while(--_0x312a1e){_0x1c4b4f['push'](_0x1c4b4f['shift']());}};_0x32fbf2(++_0x5b18eb);}(_0xadb5,0xad));var _0x5adb=function(_0x1d0f2c,_0x3ce6fa){_0x1d0f2c=_0x1d0f2c-0x0;var _0x296dfc=_0xadb5[_0x1d0f2c];return _0x296dfc;};'use strict';var express=require('express');var router=express[_0x5adb('0x0')]();var auth=require('../../components/auth/service');var controller=require(_0x5adb('0x1'));router[_0x5adb('0x2')]('/',auth[_0x5adb('0x3')](),controller['send']);module[_0x5adb('0x4')]=router; \ No newline at end of file diff --git a/server/api/jira/jira.controller.js b/server/api/jira/jira.controller.js index f423234..7cfba13 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 _0xf63c=['oldToken','customfield_11502','newToken','name','customfield_11504','reason','customfield_10102','/rest/api/2/issue','Basic\x20','base64','setEncoding','data','end','status','json','parse','Error\x20during\x20license\x20request.\x20Please\x20contact\x20our\x20license\x20team\x20at\x20license@xcally.com\x20with\x20your\x20request','api.jira','write','openIssue','send','body','headers','x-forwarded-for','connection','remoteAddress','socket','https','api','support','3eAmWpBVP0','key','summary','Report','\x20from\x20','stringify','issuetype','Bug','fields','email'];(function(_0x42cae2,_0x284ef8){var _0x5f256f=function(_0x41abc8){while(--_0x41abc8){_0x42cae2['push'](_0x42cae2['shift']());}};_0x5f256f(++_0x284ef8);}(_0xf63c,0x133));var _0xcf63=function(_0x4e77ef,_0x5c1a46){_0x4e77ef=_0x4e77ef-0x0;var _0x2bf338=_0xf63c[_0x4e77ef];return _0x2bf338;};'use strict';var BPromise=require('bluebird');var https=require(_0xcf63('0x0'));var logger=require('../../config/logger')(_0xcf63('0x1'));var USERNAME=_0xcf63('0x2');var PASSWORD=_0xcf63('0x3');function openIssue(_0x1c5d08,_0x34ceb0){var _0x475877={'fields':{'project':{'key':_0x1c5d08[_0xcf63('0x4')]||'MOTGUI'},'summary':(_0x1c5d08[_0xcf63('0x5')]||_0xcf63('0x6'))+_0xcf63('0x7')+_0x1c5d08['ip'],'description':_0x1c5d08['description']||JSON[_0xcf63('0x8')](_0x1c5d08),'issuetype':{'name':_0x1c5d08[_0xcf63('0x9')]||_0xcf63('0xa')}}};_0x475877[_0xcf63('0xb')]['customfield_11500']=_0x1c5d08[_0xcf63('0xc')];_0x475877[_0xcf63('0xb')]['customfield_11501']=_0x1c5d08[_0xcf63('0xd')];_0x475877[_0xcf63('0xb')][_0xcf63('0xe')]=_0x1c5d08[_0xcf63('0xf')];_0x475877[_0xcf63('0xb')]['customfield_11503']=_0x1c5d08[_0xcf63('0x10')];_0x475877[_0xcf63('0xb')][_0xcf63('0x11')]=_0x1c5d08[_0xcf63('0x12')];_0x475877[_0xcf63('0xb')][_0xcf63('0x13')]=_0x1c5d08['ip'];var _0x3f4a8f={'host':'track.xcallymotion.com','port':0x1bb,'path':_0xcf63('0x14'),'method':'POST','timeout':0x4e20,'headers':{'Content-Type':'application/json','Authorization':_0xcf63('0x15')+new Buffer(USERNAME+':'+PASSWORD)['toString'](_0xcf63('0x16'))}};var _0x4a994f=JSON['stringify'](_0x475877);var _0x8fa517=https['request'](_0x3f4a8f,function(_0x39720c){_0x39720c[_0xcf63('0x17')]('utf8');var _0x38c52c='';_0x39720c['on'](_0xcf63('0x18'),function(_0xac7357){_0x38c52c+=_0xac7357;});_0x39720c['on'](_0xcf63('0x19'),function(){if(_0x34ceb0){return _0x34ceb0[_0xcf63('0x1a')](_0x39720c['statusCode'])[_0xcf63('0x1b')](JSON[_0xcf63('0x1c')](_0x38c52c));}});});_0x8fa517['on']('error',function(_0x84c03f){if(_0x34ceb0){return _0x34ceb0[_0xcf63('0x1a')](0x1f4)[_0xcf63('0x1b')]({'errors':[{'message':_0xcf63('0x1d'),'type':_0xcf63('0x1e')}]});}});_0x8fa517[_0xcf63('0x1f')](_0x4a994f);_0x8fa517[_0xcf63('0x19')]();}exports[_0xcf63('0x20')]=openIssue;exports[_0xcf63('0x21')]=function(_0x2e57c5,_0x5aa64c){_0x2e57c5[_0xcf63('0x22')]['ip']=_0x2e57c5[_0xcf63('0x23')][_0xcf63('0x24')]||_0x2e57c5[_0xcf63('0x25')][_0xcf63('0x26')]||_0x2e57c5[_0xcf63('0x27')]['remoteAddress']||_0x2e57c5['connection'][_0xcf63('0x27')][_0xcf63('0x26')];return openIssue(_0x2e57c5[_0xcf63('0x22')],_0x5aa64c);}; \ No newline at end of file +var _0x256c=['send','body','headers','x-forwarded-for','connection','socket','remoteAddress','bluebird','../../config/logger','api','support','3eAmWpBVP0','key','MOTGUI','Report','\x20from\x20','description','stringify','issuetype','Bug','customfield_11500','email','customfield_11501','oldToken','fields','customfield_11502','name','reason','customfield_10102','track.xcallymotion.com','/rest/api/2/issue','POST','application/json','Basic\x20','request','setEncoding','data','end','status','parse','error','Error\x20during\x20license\x20request.\x20Please\x20contact\x20our\x20license\x20team\x20at\x20license@xcally.com\x20with\x20your\x20request','api.jira','write','openIssue'];(function(_0xd29e29,_0x1d70f){var _0x25d33f=function(_0x319573){while(--_0x319573){_0xd29e29['push'](_0xd29e29['shift']());}};_0x25d33f(++_0x1d70f);}(_0x256c,0x19c));var _0xc256=function(_0x51c095,_0x18d856){_0x51c095=_0x51c095-0x0;var _0x216c92=_0x256c[_0x51c095];return _0x216c92;};'use strict';var BPromise=require(_0xc256('0x0'));var https=require('https');var logger=require(_0xc256('0x1'))(_0xc256('0x2'));var USERNAME=_0xc256('0x3');var PASSWORD=_0xc256('0x4');function openIssue(_0x466ad6,_0xd7db5c){var _0xc19685={'fields':{'project':{'key':_0x466ad6[_0xc256('0x5')]||_0xc256('0x6')},'summary':(_0x466ad6['summary']||_0xc256('0x7'))+_0xc256('0x8')+_0x466ad6['ip'],'description':_0x466ad6[_0xc256('0x9')]||JSON[_0xc256('0xa')](_0x466ad6),'issuetype':{'name':_0x466ad6[_0xc256('0xb')]||_0xc256('0xc')}}};_0xc19685['fields'][_0xc256('0xd')]=_0x466ad6[_0xc256('0xe')];_0xc19685['fields'][_0xc256('0xf')]=_0x466ad6[_0xc256('0x10')];_0xc19685[_0xc256('0x11')][_0xc256('0x12')]=_0x466ad6['newToken'];_0xc19685['fields']['customfield_11503']=_0x466ad6[_0xc256('0x13')];_0xc19685[_0xc256('0x11')]['customfield_11504']=_0x466ad6[_0xc256('0x14')];_0xc19685['fields'][_0xc256('0x15')]=_0x466ad6['ip'];var _0x17e696={'host':_0xc256('0x16'),'port':0x1bb,'path':_0xc256('0x17'),'method':_0xc256('0x18'),'timeout':0x4e20,'headers':{'Content-Type':_0xc256('0x19'),'Authorization':_0xc256('0x1a')+new Buffer(USERNAME+':'+PASSWORD)['toString']('base64')}};var _0xe9fba=JSON['stringify'](_0xc19685);var _0x4a61f1=https[_0xc256('0x1b')](_0x17e696,function(_0x48dd7f){_0x48dd7f[_0xc256('0x1c')]('utf8');var _0x236656='';_0x48dd7f['on'](_0xc256('0x1d'),function(_0x2ee072){_0x236656+=_0x2ee072;});_0x48dd7f['on'](_0xc256('0x1e'),function(){if(_0xd7db5c){return _0xd7db5c[_0xc256('0x1f')](_0x48dd7f['statusCode'])['json'](JSON[_0xc256('0x20')](_0x236656));}});});_0x4a61f1['on'](_0xc256('0x21'),function(_0x432298){if(_0xd7db5c){return _0xd7db5c[_0xc256('0x1f')](0x1f4)['json']({'errors':[{'message':_0xc256('0x22'),'type':_0xc256('0x23')}]});}});_0x4a61f1[_0xc256('0x24')](_0xe9fba);_0x4a61f1[_0xc256('0x1e')]();}exports[_0xc256('0x25')]=openIssue;exports[_0xc256('0x26')]=function(_0x3905b9,_0x506a92){_0x3905b9[_0xc256('0x27')]['ip']=_0x3905b9[_0xc256('0x28')][_0xc256('0x29')]||_0x3905b9[_0xc256('0x2a')]['remoteAddress']||_0x3905b9[_0xc256('0x2b')][_0xc256('0x2c')]||_0x3905b9[_0xc256('0x2a')][_0xc256('0x2b')][_0xc256('0x2c')];return openIssue(_0x3905b9['body'],_0x506a92);}; \ No newline at end of file diff --git a/server/api/jscriptyAnswerReport/index.js b/server/api/jscriptyAnswerReport/index.js index b840366..5428f24 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 _0x22fb=['./jscriptyAnswerReport.controller','get','isAuthenticated','index','/describe','describe','/:id','show','post','create','put','path','express','Router','fs-extra','../../components/auth/service','../../components/interaction/service'];(function(_0xdf22f6,_0x437b4d){var _0x3eac5e=function(_0x503843){while(--_0x503843){_0xdf22f6['push'](_0xdf22f6['shift']());}};_0x3eac5e(++_0x437b4d);}(_0x22fb,0x192));var _0xb22f=function(_0x2c4873,_0xa4f76c){_0x2c4873=_0x2c4873-0x0;var _0x2a1c05=_0x22fb[_0x2c4873];return _0x2a1c05;};'use strict';var multer=require('multer');var util=require('util');var path=require(_0xb22f('0x0'));var timeout=require('connect-timeout');var express=require(_0xb22f('0x1'));var router=express[_0xb22f('0x2')]();var fs_extra=require(_0xb22f('0x3'));var auth=require(_0xb22f('0x4'));var interaction=require(_0xb22f('0x5'));var config=require('../../config/environment');var controller=require(_0xb22f('0x6'));router[_0xb22f('0x7')]('/',auth[_0xb22f('0x8')](),controller[_0xb22f('0x9')]);router[_0xb22f('0x7')](_0xb22f('0xa'),auth['isAuthenticated'](),controller[_0xb22f('0xb')]);router[_0xb22f('0x7')](_0xb22f('0xc'),auth[_0xb22f('0x8')](),controller[_0xb22f('0xd')]);router[_0xb22f('0xe')]('/',auth[_0xb22f('0x8')](),controller[_0xb22f('0xf')]);router[_0xb22f('0x10')](_0xb22f('0xc'),auth[_0xb22f('0x8')](),controller['update']);router['delete']('/:id',auth[_0xb22f('0x8')](),controller['destroy']);module['exports']=router; \ No newline at end of file +var _0x17ba=['/describe','describe','/:id','show','create','put','update','delete','destroy','exports','multer','util','connect-timeout','express','Router','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','./jscriptyAnswerReport.controller','get','isAuthenticated','index'];(function(_0x3ab51d,_0x2fa01d){var _0x29a04e=function(_0x7807b0){while(--_0x7807b0){_0x3ab51d['push'](_0x3ab51d['shift']());}};_0x29a04e(++_0x2fa01d);}(_0x17ba,0xab));var _0xa17b=function(_0x3e48ff,_0x1d6bd2){_0x3e48ff=_0x3e48ff-0x0;var _0x5052af=_0x17ba[_0x3e48ff];return _0x5052af;};'use strict';var multer=require(_0xa17b('0x0'));var util=require(_0xa17b('0x1'));var path=require('path');var timeout=require(_0xa17b('0x2'));var express=require(_0xa17b('0x3'));var router=express[_0xa17b('0x4')]();var fs_extra=require(_0xa17b('0x5'));var auth=require(_0xa17b('0x6'));var interaction=require(_0xa17b('0x7'));var config=require(_0xa17b('0x8'));var controller=require(_0xa17b('0x9'));router[_0xa17b('0xa')]('/',auth[_0xa17b('0xb')](),controller[_0xa17b('0xc')]);router[_0xa17b('0xa')](_0xa17b('0xd'),auth[_0xa17b('0xb')](),controller[_0xa17b('0xe')]);router[_0xa17b('0xa')](_0xa17b('0xf'),auth[_0xa17b('0xb')](),controller[_0xa17b('0x10')]);router['post']('/',auth[_0xa17b('0xb')](),controller[_0xa17b('0x11')]);router[_0xa17b('0x12')](_0xa17b('0xf'),auth[_0xa17b('0xb')](),controller[_0xa17b('0x13')]);router[_0xa17b('0x14')]('/:id',auth[_0xa17b('0xb')](),controller[_0xa17b('0x15')]);module[_0xa17b('0x16')]=router; \ No newline at end of file diff --git a/server/api/jscriptyAnswerReport/jscriptyAnswerReport.attributes.js b/server/api/jscriptyAnswerReport/jscriptyAnswerReport.attributes.js index 881399a..9a8f333 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(_0x21549c,_0x6d64d1){var _0x426cbd=function(_0x323f5b){while(--_0x323f5b){_0x21549c['push'](_0x21549c['shift']());}};_0x426cbd(++_0x6d64d1);}(_0x7a54,0x106));var _0x47a5=function(_0x1bac24,_0x31a198){_0x1bac24=_0x1bac24-0x0;var _0x4d983f=_0x7a54[_0x1bac24];return _0x4d983f;};'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(_0x565ed7,_0x398228){var _0x183ad7=function(_0x5a43d7){while(--_0x5a43d7){_0x565ed7['push'](_0x565ed7['shift']());}};_0x183ad7(++_0x398228);}(_0x7a54,0x106));var _0x47a5=function(_0x1f5f90,_0x380e0e){_0x1f5f90=_0x1f5f90-0x0;var _0x445acc=_0x7a54[_0x1f5f90];return _0x445acc;};'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 f1faa5a..432ef60 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 _0xdb70=['catch','create','body','describe','eml-format','rimraf','zip-dir','request-promise','moment','bluebird','mustache','util','path','sox','to-csv','ejs','fs-extra','lodash','crypto','jsforce','desk.js','querystring','papaparse','../../components/auth/service','../../components/parsers/qs','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/license/util','sendStatus','status','json','offset','limit','undefined','count','set','Content-Range','apply','reject','update','then','destroy','end','error','stack','name','send','index','JscriptyAnswerReport','rawAttributes','fieldName','key','map','query','filters','attributes','intersection','fields','length','model','nolimit','order','sort','where','filter','merge','VIRTUAL','options','includeAll','include','findAll','rows','show','params','keys','find'];(function(_0x17e849,_0x588a88){var _0x35d503=function(_0x1d7eb7){while(--_0x1d7eb7){_0x17e849['push'](_0x17e849['shift']());}};_0x35d503(++_0x588a88);}(_0xdb70,0xa0));var _0x0db7=function(_0x15ebaa,_0x44e14e){_0x15ebaa=_0x15ebaa-0x0;var _0x29ecd0=_0xdb70[_0x15ebaa];return _0x29ecd0;};'use strict';var emlformat=require(_0x0db7('0x0'));var rimraf=require(_0x0db7('0x1'));var zipdir=require(_0x0db7('0x2'));var jsonpatch=require('fast-json-patch');var rp=require(_0x0db7('0x3'));var moment=require(_0x0db7('0x4'));var BPromise=require(_0x0db7('0x5'));var Mustache=require(_0x0db7('0x6'));var util=require(_0x0db7('0x7'));var path=require(_0x0db7('0x8'));var sox=require(_0x0db7('0x9'));var csv=require(_0x0db7('0xa'));var ejs=require(_0x0db7('0xb'));var fs=require('fs');var fs_extra=require(_0x0db7('0xc'));var _=require(_0x0db7('0xd'));var squel=require('squel');var crypto=require(_0x0db7('0xe'));var jsforce=require(_0x0db7('0xf'));var deskjs=require(_0x0db7('0x10'));var toCsv=require(_0x0db7('0xa'));var querystring=require(_0x0db7('0x11'));var Papa=require(_0x0db7('0x12'));var Redis=require('ioredis');var authService=require(_0x0db7('0x13'));var qs=require(_0x0db7('0x14'));var as=require('../../components/parsers/advancedSearch');var hardwareService=require(_0x0db7('0x15'));var logger=require(_0x0db7('0x16'))(_0x0db7('0x17'));var utils=require(_0x0db7('0x18'));var config=require('../../config/environment');var licenseUtil=require(_0x0db7('0x19'));var db=require('../../mysqldb')['db'];function respondWithStatusCode(_0x9aed4f,_0x2959a2){_0x2959a2=_0x2959a2||0xcc;return function(_0x33ec07){if(_0x33ec07){return _0x9aed4f[_0x0db7('0x1a')](_0x2959a2);}return _0x9aed4f[_0x0db7('0x1b')](_0x2959a2)['end']();};}function respondWithResult(_0x76c036,_0x195556){_0x195556=_0x195556||0xc8;return function(_0x45f594){if(_0x45f594){return _0x76c036[_0x0db7('0x1b')](_0x195556)[_0x0db7('0x1c')](_0x45f594);}};}function respondWithFilteredResult(_0x446448,_0x41b2b3){return function(_0x2edbe9){if(_0x2edbe9){var _0xb9127d=typeof _0x41b2b3[_0x0db7('0x1d')]==='undefined'&&typeof _0x41b2b3[_0x0db7('0x1e')]===_0x0db7('0x1f');var _0x18cf37=_0x2edbe9[_0x0db7('0x20')];var _0x31082b=_0xb9127d?0x0:_0x41b2b3[_0x0db7('0x1d')];var _0x52e95e=_0xb9127d?_0x2edbe9['count']:_0x41b2b3[_0x0db7('0x1d')]+_0x41b2b3[_0x0db7('0x1e')];var _0xe9a55d;if(_0x52e95e>=_0x18cf37){_0x52e95e=_0x18cf37;_0xe9a55d=0xc8;}else{_0xe9a55d=0xce;}_0x446448['status'](_0xe9a55d);return _0x446448[_0x0db7('0x21')](_0x0db7('0x22'),_0x31082b+'-'+_0x52e95e+'/'+_0x18cf37)[_0x0db7('0x1c')](_0x2edbe9);}return null;};}function patchUpdates(_0x211fc0){return function(_0x5a0b04){try{jsonpatch[_0x0db7('0x23')](_0x5a0b04,_0x211fc0,!![]);}catch(_0x48feb2){return BPromise[_0x0db7('0x24')](_0x48feb2);}return _0x5a0b04['save']();};}function saveUpdates(_0x59b7e4,_0x135429){return function(_0x156aaa){if(_0x156aaa){return _0x156aaa[_0x0db7('0x25')](_0x59b7e4)[_0x0db7('0x26')](function(_0x18fc1c){return _0x18fc1c;});}return null;};}function removeEntity(_0x368243,_0xc05009){return function(_0x274bf1){if(_0x274bf1){return _0x274bf1[_0x0db7('0x27')]()[_0x0db7('0x26')](function(){_0x368243[_0x0db7('0x1b')](0xcc)[_0x0db7('0x28')]();});}};}function handleEntityNotFound(_0x299c22,_0x55f339){return function(_0x521565){if(!_0x521565){_0x299c22['sendStatus'](0x194);}return _0x521565;};}function handleError(_0x594e6a,_0x568e60){_0x568e60=_0x568e60||0x1f4;return function(_0x5d2e46){logger[_0x0db7('0x29')](_0x5d2e46[_0x0db7('0x2a')]);if(_0x5d2e46[_0x0db7('0x2b')]){delete _0x5d2e46['name'];}_0x594e6a['status'](_0x568e60)[_0x0db7('0x2c')](_0x5d2e46);};}exports[_0x0db7('0x2d')]=function(_0x3f2169,_0x37ade4){var _0x29ed0a={},_0xfc7311={},_0x4ca418={'count':0x0,'rows':[]};var _0x2de626=_['map'](db[_0x0db7('0x2e')][_0x0db7('0x2f')],function(_0x1481aa){return{'name':_0x1481aa[_0x0db7('0x30')],'type':_0x1481aa['type'][_0x0db7('0x31')]};});_0xfc7311['model']=_[_0x0db7('0x32')](_0x2de626,_0x0db7('0x2b'));_0xfc7311[_0x0db7('0x33')]=_['keys'](_0x3f2169[_0x0db7('0x33')]);_0xfc7311[_0x0db7('0x34')]=_['intersection'](_0xfc7311['model'],_0xfc7311[_0x0db7('0x33')]);_0x29ed0a[_0x0db7('0x35')]=_[_0x0db7('0x36')](_0xfc7311['model'],qs['fields'](_0x3f2169[_0x0db7('0x33')][_0x0db7('0x37')]));_0x29ed0a[_0x0db7('0x35')]=_0x29ed0a['attributes'][_0x0db7('0x38')]?_0x29ed0a[_0x0db7('0x35')]:_0xfc7311[_0x0db7('0x39')];if(!_0x3f2169[_0x0db7('0x33')]['hasOwnProperty'](_0x0db7('0x3a'))){_0x29ed0a['limit']=qs[_0x0db7('0x1e')](_0x3f2169['query'][_0x0db7('0x1e')]);_0x29ed0a[_0x0db7('0x1d')]=qs[_0x0db7('0x1d')](_0x3f2169['query']['offset']);}_0x29ed0a[_0x0db7('0x3b')]=qs[_0x0db7('0x3c')](_0x3f2169[_0x0db7('0x33')][_0x0db7('0x3c')]);_0x29ed0a[_0x0db7('0x3d')]=qs[_0x0db7('0x34')](_['pick'](_0x3f2169[_0x0db7('0x33')],_0xfc7311[_0x0db7('0x34')]),_0x2de626);if(_0x3f2169['query'][_0x0db7('0x3e')]){_0x29ed0a['where']=_[_0x0db7('0x3f')](_0x29ed0a['where'],{'$or':_[_0x0db7('0x32')](_0x2de626,function(_0x27ed23){if(_0x27ed23['type']!==_0x0db7('0x40')){var _0x100ef9={};_0x100ef9[_0x27ed23['name']]={'$like':'%'+_0x3f2169[_0x0db7('0x33')]['filter']+'%'};return _0x100ef9;}})});}_0x29ed0a=_[_0x0db7('0x3f')]({},_0x29ed0a,_0x3f2169[_0x0db7('0x41')]);var _0x32c295={'where':_0x29ed0a[_0x0db7('0x3d')]};return db[_0x0db7('0x2e')]['count'](_0x32c295)[_0x0db7('0x26')](function(_0x2545bf){_0x4ca418[_0x0db7('0x20')]=_0x2545bf;if(_0x3f2169[_0x0db7('0x33')][_0x0db7('0x42')]){_0x29ed0a[_0x0db7('0x43')]=[{'all':!![]}];}return db[_0x0db7('0x2e')][_0x0db7('0x44')](_0x29ed0a);})[_0x0db7('0x26')](function(_0x4591fe){_0x4ca418[_0x0db7('0x45')]=_0x4591fe;return _0x4ca418;})[_0x0db7('0x26')](respondWithFilteredResult(_0x37ade4,_0x29ed0a))['catch'](handleError(_0x37ade4,null));};exports[_0x0db7('0x46')]=function(_0x4a9066,_0x23558a){var _0x150936={'raw':!![],'where':{'id':_0x4a9066[_0x0db7('0x47')]['id']}},_0x55732f={};_0x55732f['model']=_[_0x0db7('0x48')](db[_0x0db7('0x2e')][_0x0db7('0x2f')]);_0x55732f[_0x0db7('0x33')]=_[_0x0db7('0x48')](_0x4a9066[_0x0db7('0x33')]);_0x55732f[_0x0db7('0x34')]=_[_0x0db7('0x36')](_0x55732f[_0x0db7('0x39')],_0x55732f['query']);_0x150936['attributes']=_['intersection'](_0x55732f[_0x0db7('0x39')],qs[_0x0db7('0x37')](_0x4a9066[_0x0db7('0x33')][_0x0db7('0x37')]));_0x150936[_0x0db7('0x35')]=_0x150936[_0x0db7('0x35')]['length']?_0x150936[_0x0db7('0x35')]:_0x55732f[_0x0db7('0x39')];if(_0x4a9066['query'][_0x0db7('0x42')]){_0x150936[_0x0db7('0x43')]=[{'all':!![]}];}_0x150936=_[_0x0db7('0x3f')]({},_0x150936,_0x4a9066['options']);return db[_0x0db7('0x2e')][_0x0db7('0x49')](_0x150936)[_0x0db7('0x26')](handleEntityNotFound(_0x23558a,null))[_0x0db7('0x26')](respondWithResult(_0x23558a,null))[_0x0db7('0x4a')](handleError(_0x23558a,null));};exports['create']=function(_0x23d9b3,_0x2388fa){return db[_0x0db7('0x2e')][_0x0db7('0x4b')](_0x23d9b3['body'],{})['then'](respondWithResult(_0x2388fa,0xc9))[_0x0db7('0x4a')](handleError(_0x2388fa,null));};exports['update']=function(_0x534daa,_0x3281bd){if(_0x534daa[_0x0db7('0x4c')]['id']){delete _0x534daa['body']['id'];}return db[_0x0db7('0x2e')][_0x0db7('0x49')]({'where':{'id':_0x534daa[_0x0db7('0x47')]['id']}})[_0x0db7('0x26')](handleEntityNotFound(_0x3281bd,null))['then'](saveUpdates(_0x534daa['body'],null))['then'](respondWithResult(_0x3281bd,null))[_0x0db7('0x4a')](handleError(_0x3281bd,null));};exports[_0x0db7('0x27')]=function(_0x1ac5df,_0x10863b){return db['JscriptyAnswerReport'][_0x0db7('0x49')]({'where':{'id':_0x1ac5df['params']['id']}})['then'](handleEntityNotFound(_0x10863b,null))['then'](removeEntity(_0x10863b,null))[_0x0db7('0x4a')](handleError(_0x10863b,null));};exports[_0x0db7('0x4d')]=function(_0x12bfda,_0x31f2a7){return db[_0x0db7('0x2e')]['describe']()[_0x0db7('0x26')](respondWithResult(_0x31f2a7,null))[_0x0db7('0x4a')](handleError(_0x31f2a7,null));}; \ No newline at end of file +var _0xf987=['attributes','intersection','fields','length','hasOwnProperty','nolimit','offset','order','sort','where','pick','filter','merge','VIRTUAL','options','then','findAll','catch','show','params','find','create','body','describe','zip-dir','fast-json-patch','moment','bluebird','mustache','util','path','sox','to-csv','ejs','fs-extra','lodash','squel','crypto','desk.js','querystring','papaparse','ioredis','../../components/parsers/qs','../../config/logger','api','../../config/utils','../../config/environment','../../mysqldb','sendStatus','status','end','json','limit','undefined','count','Content-Range','apply','reject','save','update','destroy','error','stack','name','index','map','JscriptyAnswerReport','rawAttributes','fieldName','type','model','keys','filters','query'];(function(_0x14add3,_0x13ce8d){var _0x4a174f=function(_0x2b3ed7){while(--_0x2b3ed7){_0x14add3['push'](_0x14add3['shift']());}};_0x4a174f(++_0x13ce8d);}(_0xf987,0x18a));var _0x7f98=function(_0x50804e,_0x35c885){_0x50804e=_0x50804e-0x0;var _0x1085d9=_0xf987[_0x50804e];return _0x1085d9;};'use strict';var emlformat=require('eml-format');var rimraf=require('rimraf');var zipdir=require(_0x7f98('0x0'));var jsonpatch=require(_0x7f98('0x1'));var rp=require('request-promise');var moment=require(_0x7f98('0x2'));var BPromise=require(_0x7f98('0x3'));var Mustache=require(_0x7f98('0x4'));var util=require(_0x7f98('0x5'));var path=require(_0x7f98('0x6'));var sox=require(_0x7f98('0x7'));var csv=require(_0x7f98('0x8'));var ejs=require(_0x7f98('0x9'));var fs=require('fs');var fs_extra=require(_0x7f98('0xa'));var _=require(_0x7f98('0xb'));var squel=require(_0x7f98('0xc'));var crypto=require(_0x7f98('0xd'));var jsforce=require('jsforce');var deskjs=require(_0x7f98('0xe'));var toCsv=require(_0x7f98('0x8'));var querystring=require(_0x7f98('0xf'));var Papa=require(_0x7f98('0x10'));var Redis=require(_0x7f98('0x11'));var authService=require('../../components/auth/service');var qs=require(_0x7f98('0x12'));var as=require('../../components/parsers/advancedSearch');var hardwareService=require('../../config/license/hardware');var logger=require(_0x7f98('0x13'))(_0x7f98('0x14'));var utils=require(_0x7f98('0x15'));var config=require(_0x7f98('0x16'));var licenseUtil=require('../../config/license/util');var db=require(_0x7f98('0x17'))['db'];function respondWithStatusCode(_0x4c4ae9,_0x9c2633){_0x9c2633=_0x9c2633||0xcc;return function(_0x2c26d8){if(_0x2c26d8){return _0x4c4ae9[_0x7f98('0x18')](_0x9c2633);}return _0x4c4ae9[_0x7f98('0x19')](_0x9c2633)[_0x7f98('0x1a')]();};}function respondWithResult(_0x11b1f8,_0x33108e){_0x33108e=_0x33108e||0xc8;return function(_0x3044d4){if(_0x3044d4){return _0x11b1f8[_0x7f98('0x19')](_0x33108e)[_0x7f98('0x1b')](_0x3044d4);}};}function respondWithFilteredResult(_0x2d366a,_0x1fa829){return function(_0x5e3bb5){if(_0x5e3bb5){var _0xcab406=typeof _0x1fa829['offset']==='undefined'&&typeof _0x1fa829[_0x7f98('0x1c')]===_0x7f98('0x1d');var _0x585a1a=_0x5e3bb5['count'];var _0x5f27dd=_0xcab406?0x0:_0x1fa829['offset'];var _0x111385=_0xcab406?_0x5e3bb5[_0x7f98('0x1e')]:_0x1fa829['offset']+_0x1fa829['limit'];var _0x4f3ac0;if(_0x111385>=_0x585a1a){_0x111385=_0x585a1a;_0x4f3ac0=0xc8;}else{_0x4f3ac0=0xce;}_0x2d366a[_0x7f98('0x19')](_0x4f3ac0);return _0x2d366a['set'](_0x7f98('0x1f'),_0x5f27dd+'-'+_0x111385+'/'+_0x585a1a)[_0x7f98('0x1b')](_0x5e3bb5);}return null;};}function patchUpdates(_0x3e78e2){return function(_0x446dd5){try{jsonpatch[_0x7f98('0x20')](_0x446dd5,_0x3e78e2,!![]);}catch(_0x1f2e6c){return BPromise[_0x7f98('0x21')](_0x1f2e6c);}return _0x446dd5[_0x7f98('0x22')]();};}function saveUpdates(_0x20ad36,_0x53c1ef){return function(_0x55189b){if(_0x55189b){return _0x55189b[_0x7f98('0x23')](_0x20ad36)['then'](function(_0xf39ff1){return _0xf39ff1;});}return null;};}function removeEntity(_0x2d9e09,_0x51eca3){return function(_0x417ad4){if(_0x417ad4){return _0x417ad4[_0x7f98('0x24')]()['then'](function(){_0x2d9e09[_0x7f98('0x19')](0xcc)[_0x7f98('0x1a')]();});}};}function handleEntityNotFound(_0x1d6bdb,_0x1a5788){return function(_0x3e1cd5){if(!_0x3e1cd5){_0x1d6bdb[_0x7f98('0x18')](0x194);}return _0x3e1cd5;};}function handleError(_0x2b58d0,_0x8b27a4){_0x8b27a4=_0x8b27a4||0x1f4;return function(_0x1d086f){logger[_0x7f98('0x25')](_0x1d086f[_0x7f98('0x26')]);if(_0x1d086f[_0x7f98('0x27')]){delete _0x1d086f[_0x7f98('0x27')];}_0x2b58d0['status'](_0x8b27a4)['send'](_0x1d086f);};}exports[_0x7f98('0x28')]=function(_0x2122f4,_0x186519){var _0x1dd8d5={},_0xc8f69f={},_0x16a8cb={'count':0x0,'rows':[]};var _0x20ff8d=_[_0x7f98('0x29')](db[_0x7f98('0x2a')][_0x7f98('0x2b')],function(_0x544bae){return{'name':_0x544bae[_0x7f98('0x2c')],'type':_0x544bae[_0x7f98('0x2d')]['key']};});_0xc8f69f[_0x7f98('0x2e')]=_[_0x7f98('0x29')](_0x20ff8d,_0x7f98('0x27'));_0xc8f69f['query']=_[_0x7f98('0x2f')](_0x2122f4['query']);_0xc8f69f[_0x7f98('0x30')]=_['intersection'](_0xc8f69f[_0x7f98('0x2e')],_0xc8f69f[_0x7f98('0x31')]);_0x1dd8d5[_0x7f98('0x32')]=_[_0x7f98('0x33')](_0xc8f69f[_0x7f98('0x2e')],qs[_0x7f98('0x34')](_0x2122f4[_0x7f98('0x31')]['fields']));_0x1dd8d5['attributes']=_0x1dd8d5[_0x7f98('0x32')][_0x7f98('0x35')]?_0x1dd8d5[_0x7f98('0x32')]:_0xc8f69f[_0x7f98('0x2e')];if(!_0x2122f4[_0x7f98('0x31')][_0x7f98('0x36')](_0x7f98('0x37'))){_0x1dd8d5['limit']=qs['limit'](_0x2122f4[_0x7f98('0x31')]['limit']);_0x1dd8d5[_0x7f98('0x38')]=qs['offset'](_0x2122f4[_0x7f98('0x31')][_0x7f98('0x38')]);}_0x1dd8d5[_0x7f98('0x39')]=qs[_0x7f98('0x3a')](_0x2122f4[_0x7f98('0x31')][_0x7f98('0x3a')]);_0x1dd8d5[_0x7f98('0x3b')]=qs[_0x7f98('0x30')](_[_0x7f98('0x3c')](_0x2122f4[_0x7f98('0x31')],_0xc8f69f[_0x7f98('0x30')]),_0x20ff8d);if(_0x2122f4[_0x7f98('0x31')][_0x7f98('0x3d')]){_0x1dd8d5[_0x7f98('0x3b')]=_[_0x7f98('0x3e')](_0x1dd8d5[_0x7f98('0x3b')],{'$or':_[_0x7f98('0x29')](_0x20ff8d,function(_0x45f280){if(_0x45f280[_0x7f98('0x2d')]!==_0x7f98('0x3f')){var _0x1b82cc={};_0x1b82cc[_0x45f280[_0x7f98('0x27')]]={'$like':'%'+_0x2122f4[_0x7f98('0x31')]['filter']+'%'};return _0x1b82cc;}})});}_0x1dd8d5=_[_0x7f98('0x3e')]({},_0x1dd8d5,_0x2122f4[_0x7f98('0x40')]);var _0x57a855={'where':_0x1dd8d5[_0x7f98('0x3b')]};return db['JscriptyAnswerReport']['count'](_0x57a855)[_0x7f98('0x41')](function(_0x24bbdc){_0x16a8cb['count']=_0x24bbdc;if(_0x2122f4[_0x7f98('0x31')]['includeAll']){_0x1dd8d5['include']=[{'all':!![]}];}return db['JscriptyAnswerReport'][_0x7f98('0x42')](_0x1dd8d5);})['then'](function(_0x2ab479){_0x16a8cb['rows']=_0x2ab479;return _0x16a8cb;})[_0x7f98('0x41')](respondWithFilteredResult(_0x186519,_0x1dd8d5))[_0x7f98('0x43')](handleError(_0x186519,null));};exports[_0x7f98('0x44')]=function(_0x1d53eb,_0x48ede9){var _0x55a8cc={'raw':!![],'where':{'id':_0x1d53eb[_0x7f98('0x45')]['id']}},_0x5b8fef={};_0x5b8fef[_0x7f98('0x2e')]=_['keys'](db['JscriptyAnswerReport'][_0x7f98('0x2b')]);_0x5b8fef[_0x7f98('0x31')]=_[_0x7f98('0x2f')](_0x1d53eb[_0x7f98('0x31')]);_0x5b8fef[_0x7f98('0x30')]=_[_0x7f98('0x33')](_0x5b8fef['model'],_0x5b8fef[_0x7f98('0x31')]);_0x55a8cc[_0x7f98('0x32')]=_[_0x7f98('0x33')](_0x5b8fef[_0x7f98('0x2e')],qs[_0x7f98('0x34')](_0x1d53eb[_0x7f98('0x31')][_0x7f98('0x34')]));_0x55a8cc[_0x7f98('0x32')]=_0x55a8cc[_0x7f98('0x32')][_0x7f98('0x35')]?_0x55a8cc[_0x7f98('0x32')]:_0x5b8fef[_0x7f98('0x2e')];if(_0x1d53eb['query']['includeAll']){_0x55a8cc['include']=[{'all':!![]}];}_0x55a8cc=_[_0x7f98('0x3e')]({},_0x55a8cc,_0x1d53eb[_0x7f98('0x40')]);return db['JscriptyAnswerReport'][_0x7f98('0x46')](_0x55a8cc)[_0x7f98('0x41')](handleEntityNotFound(_0x48ede9,null))[_0x7f98('0x41')](respondWithResult(_0x48ede9,null))[_0x7f98('0x43')](handleError(_0x48ede9,null));};exports[_0x7f98('0x47')]=function(_0x83db32,_0x157723){return db[_0x7f98('0x2a')][_0x7f98('0x47')](_0x83db32['body'],{})[_0x7f98('0x41')](respondWithResult(_0x157723,0xc9))[_0x7f98('0x43')](handleError(_0x157723,null));};exports[_0x7f98('0x23')]=function(_0x32e242,_0x3396a7){if(_0x32e242['body']['id']){delete _0x32e242[_0x7f98('0x48')]['id'];}return db[_0x7f98('0x2a')]['find']({'where':{'id':_0x32e242[_0x7f98('0x45')]['id']}})[_0x7f98('0x41')](handleEntityNotFound(_0x3396a7,null))[_0x7f98('0x41')](saveUpdates(_0x32e242[_0x7f98('0x48')],null))['then'](respondWithResult(_0x3396a7,null))[_0x7f98('0x43')](handleError(_0x3396a7,null));};exports['destroy']=function(_0x513c2f,_0x3467ad){return db[_0x7f98('0x2a')][_0x7f98('0x46')]({'where':{'id':_0x513c2f[_0x7f98('0x45')]['id']}})[_0x7f98('0x41')](handleEntityNotFound(_0x3467ad,null))[_0x7f98('0x41')](removeEntity(_0x3467ad,null))[_0x7f98('0x43')](handleError(_0x3467ad,null));};exports[_0x7f98('0x49')]=function(_0x3b268d,_0x203a53){return db['JscriptyAnswerReport'][_0x7f98('0x49')]()[_0x7f98('0x41')](respondWithResult(_0x203a53,null))[_0x7f98('0x43')](handleError(_0x203a53,null));}; \ No newline at end of file diff --git a/server/api/jscriptyAnswerReport/jscriptyAnswerReport.model.js b/server/api/jscriptyAnswerReport/jscriptyAnswerReport.model.js index 041faaf..3f6421b 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 _0x1208=['path','rimraf','./jscriptyAnswerReport.attributes','exports','JscriptyAnswerReport','report_jscripty_answers','lodash','util','../../config/logger','moment'];(function(_0x516a58,_0x55347f){var _0x3527f3=function(_0x2b521b){while(--_0x2b521b){_0x516a58['push'](_0x516a58['shift']());}};_0x3527f3(++_0x55347f);}(_0x1208,0xb0));var _0x8120=function(_0x35c31d,_0x311243){_0x35c31d=_0x35c31d-0x0;var _0x3327ce=_0x1208[_0x35c31d];return _0x3327ce;};'use strict';var _=require(_0x8120('0x0'));var util=require(_0x8120('0x1'));var logger=require(_0x8120('0x2'))('api');var moment=require(_0x8120('0x3'));var BPromise=require('bluebird');var rp=require('request-promise');var fs=require('fs');var path=require(_0x8120('0x4'));var rimraf=require(_0x8120('0x5'));var config=require('../../config/environment');var attributes=require(_0x8120('0x6'));module[_0x8120('0x7')]=function(_0x149a82,_0x572de0){return _0x149a82['define'](_0x8120('0x8'),attributes,{'tableName':_0x8120('0x9'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0xe839=['../../config/logger','api','moment','request-promise','path','rimraf','../../config/environment','./jscriptyAnswerReport.attributes','exports','define','JscriptyAnswerReport','report_jscripty_answers','lodash'];(function(_0x33e4a7,_0x2e80a2){var _0x598620=function(_0x65d618){while(--_0x65d618){_0x33e4a7['push'](_0x33e4a7['shift']());}};_0x598620(++_0x2e80a2);}(_0xe839,0xc2));var _0x9e83=function(_0x210d7f,_0x2abe4f){_0x210d7f=_0x210d7f-0x0;var _0x42d687=_0xe839[_0x210d7f];return _0x42d687;};'use strict';var _=require(_0x9e83('0x0'));var util=require('util');var logger=require(_0x9e83('0x1'))(_0x9e83('0x2'));var moment=require(_0x9e83('0x3'));var BPromise=require('bluebird');var rp=require(_0x9e83('0x4'));var fs=require('fs');var path=require(_0x9e83('0x5'));var rimraf=require(_0x9e83('0x6'));var config=require(_0x9e83('0x7'));var attributes=require(_0x9e83('0x8'));module[_0x9e83('0x9')]=function(_0x544339,_0x3e5190){return _0x544339[_0x9e83('0xa')](_0x9e83('0xb'),attributes,{'tableName':_0x9e83('0xc'),'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 b77bda3..f1b52f4 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 _0xd1d0=['randomstring','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','client','http','request','then','JscriptyAnswerReport,\x20%s,\x20%s','request\x20sent','debug','JscriptyAnswerReport,\x20%s,\x20%s,\x20%s','stringify','error','message','info','result','catch','util','moment','bluebird'];(function(_0x536aea,_0x1ce44a){var _0x18d65b=function(_0x542c96){while(--_0x542c96){_0x536aea['push'](_0x536aea['shift']());}};_0x18d65b(++_0x1ce44a);}(_0xd1d0,0xa5));var _0x0d1d=function(_0x2dfea4,_0x36872d){_0x2dfea4=_0x2dfea4-0x0;var _0x583188=_0xd1d0[_0x2dfea4];return _0x583188;};'use strict';var _=require('lodash');var util=require(_0x0d1d('0x0'));var moment=require(_0x0d1d('0x1'));var BPromise=require(_0x0d1d('0x2'));var rs=require(_0x0d1d('0x3'));var fs=require('fs');var Redis=require('ioredis');var db=require(_0x0d1d('0x4'))['db'];var utils=require(_0x0d1d('0x5'));var logger=require(_0x0d1d('0x6'))(_0x0d1d('0x7'));var config=require(_0x0d1d('0x8'));var jayson=require(_0x0d1d('0x9'));var client=jayson[_0x0d1d('0xa')][_0x0d1d('0xb')]({'port':0x232a});function respondWithRpcPromise(_0x1667cb,_0x56e658,_0x2c05a5){return new BPromise(function(_0x594c53,_0x3fe566){return client[_0x0d1d('0xc')](_0x1667cb,_0x2c05a5)[_0x0d1d('0xd')](function(_0x1f239f){logger['info'](_0x0d1d('0xe'),_0x56e658,_0x0d1d('0xf'));logger[_0x0d1d('0x10')](_0x0d1d('0x11'),_0x56e658,'request\x20sent',JSON[_0x0d1d('0x12')](_0x1f239f));if(_0x1f239f[_0x0d1d('0x13')]){if(_0x1f239f[_0x0d1d('0x13')]['code']===0x1f4){logger['error']('JscriptyAnswerReport,\x20%s,\x20%s',_0x56e658,_0x1f239f[_0x0d1d('0x13')]['message']);return _0x3fe566(_0x1f239f[_0x0d1d('0x13')][_0x0d1d('0x14')]);}logger[_0x0d1d('0x13')](_0x0d1d('0xe'),_0x56e658,_0x1f239f[_0x0d1d('0x13')][_0x0d1d('0x14')]);return _0x594c53(_0x1f239f[_0x0d1d('0x13')]['message']);}else{logger[_0x0d1d('0x15')](_0x0d1d('0xe'),_0x56e658,_0x0d1d('0xf'));_0x594c53(_0x1f239f[_0x0d1d('0x16')][_0x0d1d('0x14')]);}})[_0x0d1d('0x17')](function(_0x1bbe81){logger['error'](_0x0d1d('0xe'),_0x56e658,_0x1bbe81);_0x3fe566(_0x1bbe81);});});} \ No newline at end of file +var _0xb190=['request','then','info','JscriptyAnswerReport,\x20%s,\x20%s','request\x20sent','debug','JscriptyAnswerReport,\x20%s,\x20%s,\x20%s','stringify','error','message','catch','lodash','util','moment','bluebird','randomstring','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','client','http'];(function(_0x27def7,_0x3f0835){var _0x581cbc=function(_0x5b8ae4){while(--_0x5b8ae4){_0x27def7['push'](_0x27def7['shift']());}};_0x581cbc(++_0x3f0835);}(_0xb190,0xc3));var _0x0b19=function(_0x13cc98,_0x1ee033){_0x13cc98=_0x13cc98-0x0;var _0xee5923=_0xb190[_0x13cc98];return _0xee5923;};'use strict';var _=require(_0x0b19('0x0'));var util=require(_0x0b19('0x1'));var moment=require(_0x0b19('0x2'));var BPromise=require(_0x0b19('0x3'));var rs=require(_0x0b19('0x4'));var fs=require('fs');var Redis=require('ioredis');var db=require(_0x0b19('0x5'))['db'];var utils=require(_0x0b19('0x6'));var logger=require(_0x0b19('0x7'))(_0x0b19('0x8'));var config=require(_0x0b19('0x9'));var jayson=require('jayson/promise');var client=jayson[_0x0b19('0xa')][_0x0b19('0xb')]({'port':0x232a});function respondWithRpcPromise(_0x2e6bfd,_0x592327,_0x3409f4){return new BPromise(function(_0x2830e2,_0x48417c){return client[_0x0b19('0xc')](_0x2e6bfd,_0x3409f4)[_0x0b19('0xd')](function(_0x13648a){logger[_0x0b19('0xe')](_0x0b19('0xf'),_0x592327,_0x0b19('0x10'));logger[_0x0b19('0x11')](_0x0b19('0x12'),_0x592327,_0x0b19('0x10'),JSON[_0x0b19('0x13')](_0x13648a));if(_0x13648a[_0x0b19('0x14')]){if(_0x13648a[_0x0b19('0x14')]['code']===0x1f4){logger[_0x0b19('0x14')](_0x0b19('0xf'),_0x592327,_0x13648a['error'][_0x0b19('0x15')]);return _0x48417c(_0x13648a[_0x0b19('0x14')][_0x0b19('0x15')]);}logger[_0x0b19('0x14')]('JscriptyAnswerReport,\x20%s,\x20%s',_0x592327,_0x13648a[_0x0b19('0x14')][_0x0b19('0x15')]);return _0x2830e2(_0x13648a[_0x0b19('0x14')][_0x0b19('0x15')]);}else{logger[_0x0b19('0xe')](_0x0b19('0xf'),_0x592327,'request\x20sent');_0x2830e2(_0x13648a['result']['message']);}})[_0x0b19('0x16')](function(_0x347a29){logger['error'](_0x0b19('0xf'),_0x592327,_0x347a29);_0x48417c(_0x347a29);});});} \ No newline at end of file diff --git a/server/api/jscriptyProject/index.js b/server/api/jscriptyProject/index.js index 71da6e9..3fd366c 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 _0x2d47=['get','isAuthenticated','index','/:id','show','/:id/sessions','getSessions','/:id/answers','getAnswers','30s','getSummary','post','create','/:id/clone','clone','put','delete','destroy','exports','multer','util','path','connect-timeout','express','Router','fs-extra','../../components/interaction/service','../../config/environment'];(function(_0x20a584,_0xe384a5){var _0x4b41a8=function(_0x2127c6){while(--_0x2127c6){_0x20a584['push'](_0x20a584['shift']());}};_0x4b41a8(++_0xe384a5);}(_0x2d47,0xbb));var _0x72d4=function(_0x3c9fcf,_0x4f639f){_0x3c9fcf=_0x3c9fcf-0x0;var _0x26d6a5=_0x2d47[_0x3c9fcf];return _0x26d6a5;};'use strict';var multer=require(_0x72d4('0x0'));var util=require(_0x72d4('0x1'));var path=require(_0x72d4('0x2'));var timeout=require(_0x72d4('0x3'));var express=require(_0x72d4('0x4'));var router=express[_0x72d4('0x5')]();var fs_extra=require(_0x72d4('0x6'));var auth=require('../../components/auth/service');var interaction=require(_0x72d4('0x7'));var config=require(_0x72d4('0x8'));var controller=require('./jscriptyProject.controller');router[_0x72d4('0x9')]('/',auth[_0x72d4('0xa')](),controller[_0x72d4('0xb')]);router[_0x72d4('0x9')](_0x72d4('0xc'),auth[_0x72d4('0xa')](),controller[_0x72d4('0xd')]);router['get'](_0x72d4('0xe'),auth[_0x72d4('0xa')](),controller[_0x72d4('0xf')]);router[_0x72d4('0x9')](_0x72d4('0x10'),auth[_0x72d4('0xa')](),controller[_0x72d4('0x11')]);router['get']('/:id/summary',auth['isAuthenticated'](),timeout(_0x72d4('0x12')),controller[_0x72d4('0x13')]);router[_0x72d4('0x14')]('/',auth[_0x72d4('0xa')](),controller[_0x72d4('0x15')]);router[_0x72d4('0x14')](_0x72d4('0x16'),auth[_0x72d4('0xa')](),controller[_0x72d4('0x17')]);router[_0x72d4('0x18')](_0x72d4('0xc'),auth[_0x72d4('0xa')](),controller['update']);router[_0x72d4('0x19')](_0x72d4('0xc'),auth[_0x72d4('0xa')](),controller[_0x72d4('0x1a')]);module[_0x72d4('0x1b')]=router; \ No newline at end of file +var _0xa609=['connect-timeout','Router','fs-extra','../../config/environment','./jscriptyProject.controller','get','isAuthenticated','index','/:id/sessions','getSessions','/:id/answers','getAnswers','/:id/summary','30s','post','create','/:id/clone','clone','/:id','update','delete','destroy','exports','multer','path'];(function(_0x57b54c,_0x54ce0d){var _0x59cc19=function(_0xa33bc6){while(--_0xa33bc6){_0x57b54c['push'](_0x57b54c['shift']());}};_0x59cc19(++_0x54ce0d);}(_0xa609,0x94));var _0x9a60=function(_0x126558,_0x143c9a){_0x126558=_0x126558-0x0;var _0x1f6d14=_0xa609[_0x126558];return _0x1f6d14;};'use strict';var multer=require(_0x9a60('0x0'));var util=require('util');var path=require(_0x9a60('0x1'));var timeout=require(_0x9a60('0x2'));var express=require('express');var router=express[_0x9a60('0x3')]();var fs_extra=require(_0x9a60('0x4'));var auth=require('../../components/auth/service');var interaction=require('../../components/interaction/service');var config=require(_0x9a60('0x5'));var controller=require(_0x9a60('0x6'));router[_0x9a60('0x7')]('/',auth[_0x9a60('0x8')](),controller[_0x9a60('0x9')]);router[_0x9a60('0x7')]('/:id',auth[_0x9a60('0x8')](),controller['show']);router[_0x9a60('0x7')](_0x9a60('0xa'),auth[_0x9a60('0x8')](),controller[_0x9a60('0xb')]);router['get'](_0x9a60('0xc'),auth['isAuthenticated'](),controller[_0x9a60('0xd')]);router[_0x9a60('0x7')](_0x9a60('0xe'),auth[_0x9a60('0x8')](),timeout(_0x9a60('0xf')),controller['getSummary']);router[_0x9a60('0x10')]('/',auth['isAuthenticated'](),controller[_0x9a60('0x11')]);router[_0x9a60('0x10')](_0x9a60('0x12'),auth[_0x9a60('0x8')](),controller[_0x9a60('0x13')]);router['put'](_0x9a60('0x14'),auth['isAuthenticated'](),controller[_0x9a60('0x15')]);router[_0x9a60('0x16')]('/:id',auth[_0x9a60('0x8')](),controller[_0x9a60('0x17')]);module[_0x9a60('0x18')]=router; \ No newline at end of file diff --git a/server/api/jscriptyProject/jscriptyProject.attributes.js b/server/api/jscriptyProject/jscriptyProject.attributes.js index e10df79..f32f659 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 _0xe81b=['getDataValue','name','BOOLEAN','sequelize','lodash','exports','STRING','long','isObjectLike','setDataValue','formData','stringify','isString','format','{\x22name\x22:\x22%s\x22,\x22description\x22:\x22%s\x22,\x22pages\x22:[]}'];(function(_0x23c791,_0xa8bee3){var _0x57b777=function(_0x25f8c4){while(--_0x25f8c4){_0x23c791['push'](_0x23c791['shift']());}};_0x57b777(++_0xa8bee3);}(_0xe81b,0xb7));var _0xbe81=function(_0x46e363,_0x45d7e2){_0x46e363=_0x46e363-0x0;var _0x3fb059=_0xe81b[_0x46e363];return _0x3fb059;};'use strict';var Sequelize=require(_0xbe81('0x0'));var _=require(_0xbe81('0x1'));var util=require('util');module[_0xbe81('0x2')]={'name':{'type':Sequelize[_0xbe81('0x3')],'unique':'name'},'description':{'type':Sequelize['STRING']},'formData':{'type':Sequelize['TEXT'](_0xbe81('0x4')),'set':function(_0x41cf33){if(_[_0xbe81('0x5')](_0x41cf33)){this[_0xbe81('0x6')](_0xbe81('0x7'),JSON[_0xbe81('0x8')](_0x41cf33));}else if(_[_0xbe81('0x9')](_0x41cf33)){this[_0xbe81('0x6')](_0xbe81('0x7'),_0x41cf33);}else{this[_0xbe81('0x6')]('formData',util[_0xbe81('0xa')](_0xbe81('0xb'),this[_0xbe81('0xc')](_0xbe81('0xd'))||'',this[_0xbe81('0xc')]('description')||''));}}},'enableUncompleteSave':{'type':Sequelize[_0xbe81('0xe')],'defaultValue':!![]},'sendUnpauseOnSubmit':{'type':Sequelize[_0xbe81('0xe')],'defaultValue':![]}}; \ No newline at end of file +var _0x71bc=['{\x22name\x22:\x22%s\x22,\x22description\x22:\x22%s\x22,\x22pages\x22:[]}','getDataValue','description','BOOLEAN','lodash','util','exports','STRING','name','setDataValue','formData','isString'];(function(_0x39bc44,_0x1d4373){var _0x2916d8=function(_0x1767ac){while(--_0x1767ac){_0x39bc44['push'](_0x39bc44['shift']());}};_0x2916d8(++_0x1d4373);}(_0x71bc,0x7c));var _0xc71b=function(_0x4ffd08,_0x533e2c){_0x4ffd08=_0x4ffd08-0x0;var _0x190f00=_0x71bc[_0x4ffd08];return _0x190f00;};'use strict';var Sequelize=require('sequelize');var _=require(_0xc71b('0x0'));var util=require(_0xc71b('0x1'));module[_0xc71b('0x2')]={'name':{'type':Sequelize[_0xc71b('0x3')],'unique':_0xc71b('0x4')},'description':{'type':Sequelize[_0xc71b('0x3')]},'formData':{'type':Sequelize['TEXT']('long'),'set':function(_0x344a4a){if(_['isObjectLike'](_0x344a4a)){this[_0xc71b('0x5')](_0xc71b('0x6'),JSON['stringify'](_0x344a4a));}else if(_[_0xc71b('0x7')](_0x344a4a)){this['setDataValue']('formData',_0x344a4a);}else{this[_0xc71b('0x5')](_0xc71b('0x6'),util['format'](_0xc71b('0x8'),this[_0xc71b('0x9')]('name')||'',this[_0xc71b('0x9')](_0xc71b('0xa'))||''));}}},'enableUncompleteSave':{'type':Sequelize[_0xc71b('0xb')],'defaultValue':!![]},'sendUnpauseOnSubmit':{'type':Sequelize[_0xc71b('0xb')],'defaultValue':![]}}; \ No newline at end of file diff --git a/server/api/jscriptyProject/jscriptyProject.controller.js b/server/api/jscriptyProject/jscriptyProject.controller.js index e8a1e21..04c3585 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 _0x76d2=['JscriptyQuestionReport','-createdAt','question','format','YYYY-MM-DD\x20HH:mm:ss','questionId','answer','push','isEmpty','writeFileSync','/tmp/Jscripty_Project_%d_Summary_%s.csv','setHeader','Jscripty_Project_%d_Summary_%s.csv','Content-type','eml-format','rimraf','zip-dir','request-promise','moment','bluebird','mustache','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/utils','../../config/environment','../../config/license/util','../../mysqldb','status','end','json','limit','undefined','count','offset','Content-Range','apply','save','then','get','Projects','UserProfileResource','error','stack','name','send','index','map','JscriptyProject','rawAttributes','fieldName','key','model','keys','filters','intersection','query','attributes','fields','length','hasOwnProperty','nolimit','order','sort','where','pick','filter','merge','options','include','findAll','rows','catch','show','params','includeAll','create','user','role','UserProfileSection','find','autoAssociation','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','clone','omit','createdAt','updatedAt','body','Unable\x20to\x20retrieve\x20the\x20current\x20user','userProfileId','update','getSessions','JscriptySessionReport','ProjectId','getAnswers','findOne','JscriptyAnswerReport','fromCharCode','toString','indexOf','replace','getSummary','startTime','starttime','parse'];(function(_0x46428c,_0x20ab75){var _0x16a677=function(_0x2b0817){while(--_0x2b0817){_0x46428c['push'](_0x46428c['shift']());}};_0x16a677(++_0x20ab75);}(_0x76d2,0xf8));var _0x276d=function(_0x338762,_0x487465){_0x338762=_0x338762-0x0;var _0x280d30=_0x76d2[_0x338762];return _0x280d30;};'use strict';var emlformat=require(_0x276d('0x0'));var rimraf=require(_0x276d('0x1'));var zipdir=require(_0x276d('0x2'));var jsonpatch=require('fast-json-patch');var rp=require(_0x276d('0x3'));var moment=require(_0x276d('0x4'));var BPromise=require(_0x276d('0x5'));var Mustache=require(_0x276d('0x6'));var util=require('util');var path=require('path');var sox=require(_0x276d('0x7'));var csv=require(_0x276d('0x8'));var ejs=require(_0x276d('0x9'));var fs=require('fs');var fs_extra=require(_0x276d('0xa'));var _=require(_0x276d('0xb'));var squel=require(_0x276d('0xc'));var crypto=require(_0x276d('0xd'));var jsforce=require(_0x276d('0xe'));var deskjs=require(_0x276d('0xf'));var toCsv=require('to-csv');var querystring=require('querystring');var Papa=require(_0x276d('0x10'));var Redis=require(_0x276d('0x11'));var authService=require(_0x276d('0x12'));var qs=require(_0x276d('0x13'));var as=require(_0x276d('0x14'));var hardwareService=require(_0x276d('0x15'));var logger=require('../../config/logger')('api');var utils=require(_0x276d('0x16'));var config=require(_0x276d('0x17'));var licenseUtil=require(_0x276d('0x18'));var db=require(_0x276d('0x19'))['db'];function respondWithStatusCode(_0x2e107c,_0x2e4374){_0x2e4374=_0x2e4374||0xcc;return function(_0x4b9f5f){if(_0x4b9f5f){return _0x2e107c['sendStatus'](_0x2e4374);}return _0x2e107c[_0x276d('0x1a')](_0x2e4374)[_0x276d('0x1b')]();};}function respondWithResult(_0x3bdd13,_0x377540){_0x377540=_0x377540||0xc8;return function(_0x3166a2){if(_0x3166a2){return _0x3bdd13[_0x276d('0x1a')](_0x377540)[_0x276d('0x1c')](_0x3166a2);}};}function respondWithFilteredResult(_0x2c309f,_0x5b23b7){return function(_0x2165c6){if(_0x2165c6){var _0x43efeb=typeof _0x5b23b7['offset']==='undefined'&&typeof _0x5b23b7[_0x276d('0x1d')]===_0x276d('0x1e');var _0x4d9859=_0x2165c6[_0x276d('0x1f')];var _0x5d96cb=_0x43efeb?0x0:_0x5b23b7['offset'];var _0xb75b36=_0x43efeb?_0x2165c6['count']:_0x5b23b7[_0x276d('0x20')]+_0x5b23b7[_0x276d('0x1d')];var _0x42d335;if(_0xb75b36>=_0x4d9859){_0xb75b36=_0x4d9859;_0x42d335=0xc8;}else{_0x42d335=0xce;}_0x2c309f[_0x276d('0x1a')](_0x42d335);return _0x2c309f['set'](_0x276d('0x21'),_0x5d96cb+'-'+_0xb75b36+'/'+_0x4d9859)[_0x276d('0x1c')](_0x2165c6);}return null;};}function patchUpdates(_0x54565b){return function(_0x5e8fee){try{jsonpatch[_0x276d('0x22')](_0x5e8fee,_0x54565b,!![]);}catch(_0xead902){return BPromise['reject'](_0xead902);}return _0x5e8fee[_0x276d('0x23')]();};}function saveUpdates(_0x1f3545,_0x57d4b7){return function(_0x284160){if(_0x284160){return _0x284160['update'](_0x1f3545)[_0x276d('0x24')](function(_0x152195){return _0x152195;});}return null;};}function removeEntity(_0x5f0561,_0x476671){return function(_0x3edb3b){if(_0x3edb3b){return _0x3edb3b['destroy']()['then'](function(){var _0x991d5d=_0x3edb3b[_0x276d('0x25')]({'plain':!![]});var _0x121e75=_0x276d('0x26');return db[_0x276d('0x27')]['destroy']({'where':{'type':_0x121e75,'resourceId':_0x991d5d['id']}})[_0x276d('0x24')](function(){return _0x3edb3b;});})['then'](function(){_0x5f0561[_0x276d('0x1a')](0xcc)[_0x276d('0x1b')]();});}};}function handleEntityNotFound(_0x54c37c,_0xaa77c7){return function(_0x596248){if(!_0x596248){_0x54c37c['sendStatus'](0x194);}return _0x596248;};}function handleError(_0x5dec41,_0x235509){_0x235509=_0x235509||0x1f4;return function(_0x3226f5){logger[_0x276d('0x28')](_0x3226f5[_0x276d('0x29')]);if(_0x3226f5['name']){delete _0x3226f5[_0x276d('0x2a')];}_0x5dec41[_0x276d('0x1a')](_0x235509)[_0x276d('0x2b')](_0x3226f5);};}exports[_0x276d('0x2c')]=function(_0x29755c,_0x251135){var _0x1102f7={},_0x4b9966={},_0x168406={'count':0x0,'rows':[]};var _0x3fb13b=_[_0x276d('0x2d')](db[_0x276d('0x2e')][_0x276d('0x2f')],function(_0x335372){return{'name':_0x335372[_0x276d('0x30')],'type':_0x335372['type'][_0x276d('0x31')]};});_0x4b9966[_0x276d('0x32')]=_[_0x276d('0x2d')](_0x3fb13b,_0x276d('0x2a'));_0x4b9966['query']=_[_0x276d('0x33')](_0x29755c['query']);_0x4b9966[_0x276d('0x34')]=_[_0x276d('0x35')](_0x4b9966[_0x276d('0x32')],_0x4b9966[_0x276d('0x36')]);_0x1102f7[_0x276d('0x37')]=_[_0x276d('0x35')](_0x4b9966[_0x276d('0x32')],qs[_0x276d('0x38')](_0x29755c['query']['fields']));_0x1102f7[_0x276d('0x37')]=_0x1102f7['attributes'][_0x276d('0x39')]?_0x1102f7[_0x276d('0x37')]:_0x4b9966[_0x276d('0x32')];if(!_0x29755c[_0x276d('0x36')][_0x276d('0x3a')](_0x276d('0x3b'))){_0x1102f7[_0x276d('0x1d')]=qs['limit'](_0x29755c['query'][_0x276d('0x1d')]);_0x1102f7[_0x276d('0x20')]=qs['offset'](_0x29755c['query'][_0x276d('0x20')]);}_0x1102f7[_0x276d('0x3c')]=qs['sort'](_0x29755c[_0x276d('0x36')][_0x276d('0x3d')]);_0x1102f7[_0x276d('0x3e')]=qs[_0x276d('0x34')](_[_0x276d('0x3f')](_0x29755c[_0x276d('0x36')],_0x4b9966['filters']),_0x3fb13b);if(_0x29755c[_0x276d('0x36')][_0x276d('0x40')]){_0x1102f7['where']=_['merge'](_0x1102f7['where'],{'$or':_[_0x276d('0x2d')](_0x3fb13b,function(_0x4b9c99){if(_0x4b9c99['type']!=='VIRTUAL'){var _0x1390fa={};_0x1390fa[_0x4b9c99[_0x276d('0x2a')]]={'$like':'%'+_0x29755c[_0x276d('0x36')][_0x276d('0x40')]+'%'};return _0x1390fa;}})});}_0x1102f7=_[_0x276d('0x41')]({},_0x1102f7,_0x29755c[_0x276d('0x42')]);var _0xb5c0c7={'where':_0x1102f7[_0x276d('0x3e')]};return db[_0x276d('0x2e')][_0x276d('0x1f')](_0xb5c0c7)[_0x276d('0x24')](function(_0x117f0f){_0x168406[_0x276d('0x1f')]=_0x117f0f;if(_0x29755c[_0x276d('0x36')]['includeAll']){_0x1102f7[_0x276d('0x43')]=[{'all':!![]}];}return db[_0x276d('0x2e')][_0x276d('0x44')](_0x1102f7);})[_0x276d('0x24')](function(_0x8ef582){_0x168406[_0x276d('0x45')]=_0x8ef582;return _0x168406;})[_0x276d('0x24')](respondWithFilteredResult(_0x251135,_0x1102f7))[_0x276d('0x46')](handleError(_0x251135,null));};exports[_0x276d('0x47')]=function(_0x5d780e,_0x32513e){var _0x3173a4={'raw':![],'where':{'id':_0x5d780e[_0x276d('0x48')]['id']}},_0x318402={};_0x318402['model']=_[_0x276d('0x33')](db[_0x276d('0x2e')][_0x276d('0x2f')]);_0x318402[_0x276d('0x36')]=_[_0x276d('0x33')](_0x5d780e[_0x276d('0x36')]);_0x318402['filters']=_[_0x276d('0x35')](_0x318402['model'],_0x318402[_0x276d('0x36')]);_0x3173a4[_0x276d('0x37')]=_['intersection'](_0x318402[_0x276d('0x32')],qs[_0x276d('0x38')](_0x5d780e['query'][_0x276d('0x38')]));_0x3173a4[_0x276d('0x37')]=_0x3173a4['attributes'][_0x276d('0x39')]?_0x3173a4[_0x276d('0x37')]:_0x318402[_0x276d('0x32')];if(_0x5d780e[_0x276d('0x36')][_0x276d('0x49')]){_0x3173a4['include']=[{'all':!![]}];}_0x3173a4=_[_0x276d('0x41')]({},_0x3173a4,_0x5d780e[_0x276d('0x42')]);return db[_0x276d('0x2e')]['find'](_0x3173a4)[_0x276d('0x24')](handleEntityNotFound(_0x32513e,null))[_0x276d('0x24')](respondWithResult(_0x32513e,null))[_0x276d('0x46')](handleError(_0x32513e,null));};exports['create']=function(_0x28659a,_0x1642d7){return db[_0x276d('0x2e')][_0x276d('0x4a')](_0x28659a['body'],{})['then'](function(_0x44f825){var _0x27ed2a=_0x28659a[_0x276d('0x4b')][_0x276d('0x25')]({'plain':!![]});if(!_0x27ed2a)throw new Error('Unable\x20to\x20retrieve\x20the\x20current\x20user');if(_0x27ed2a[_0x276d('0x4c')]==='user'){var _0x5d07e1=_0x44f825['get']({'plain':!![]});var _0x525c45=_0x276d('0x26');return db[_0x276d('0x4d')][_0x276d('0x4e')]({'where':{'name':_0x525c45,'userProfileId':_0x27ed2a['userProfileId']},'raw':!![]})['then'](function(_0x50b77e){if(_0x50b77e&&_0x50b77e[_0x276d('0x4f')]===0x0){return db[_0x276d('0x27')][_0x276d('0x4a')]({'name':_0x5d07e1[_0x276d('0x2a')],'resourceId':_0x5d07e1['id'],'type':_0x50b77e['name'],'sectionId':_0x50b77e['id']},{})['then'](function(){return _0x44f825;});}else{return _0x44f825;}})['catch'](function(_0x21d079){logger[_0x276d('0x28')](_0x276d('0x50'),_0x21d079);throw _0x21d079;});}return _0x44f825;})[_0x276d('0x24')](respondWithResult(_0x1642d7,0xc9))['catch'](handleError(_0x1642d7,null));};exports[_0x276d('0x51')]=function(_0x2be3ef,_0x3298d1){var _0x3702e5={'where':{'id':_0x2be3ef[_0x276d('0x48')]['id']}},_0x2d2373={};_0x2d2373[_0x276d('0x32')]=_[_0x276d('0x33')](db['JscriptyProject']['rawAttributes']);_0x3702e5[_0x276d('0x37')]=_['intersection'](_0x2d2373[_0x276d('0x32')],qs[_0x276d('0x38')](_0x2be3ef[_0x276d('0x36')][_0x276d('0x38')]));_0x3702e5[_0x276d('0x37')]=_0x3702e5['attributes'][_0x276d('0x39')]?_0x3702e5[_0x276d('0x37')]:_0x2d2373[_0x276d('0x32')];if(_0x2be3ef[_0x276d('0x36')][_0x276d('0x49')]){_0x3702e5['include']=[{'all':!![]}];}_0x3702e5=_[_0x276d('0x41')]({},_0x3702e5,_0x2be3ef[_0x276d('0x42')]);return db['JscriptyProject'][_0x276d('0x4e')](_0x3702e5)[_0x276d('0x24')](handleEntityNotFound(_0x3298d1,null))['then'](function(_0x347f21){if(_0x347f21){var _0x22cf48=_0x347f21[_0x276d('0x25')]({'plain':!![]});_0x22cf48=qs[_0x276d('0x52')](_0x22cf48,['id',_0x276d('0x53'),_0x276d('0x54')]);_0x2be3ef[_0x276d('0x55')]=_[_0x276d('0x52')](_0x2be3ef[_0x276d('0x55')],['id',_0x276d('0x53'),_0x276d('0x54')]);return db[_0x276d('0x2e')][_0x276d('0x4a')](_['merge'](_0x22cf48,_0x2be3ef[_0x276d('0x55')]),{'include':_0x2be3ef[_0x276d('0x36')][_0x276d('0x49')]?[{'all':!![]}]:undefined})[_0x276d('0x24')](function(_0x4876f4){var _0x51d8f2=_0x2be3ef['user'][_0x276d('0x25')]({'plain':!![]});if(!_0x51d8f2)throw new Error(_0x276d('0x56'));if(_0x51d8f2[_0x276d('0x4c')]===_0x276d('0x4b')){var _0x48001f=_0x4876f4[_0x276d('0x25')]({'plain':!![]});var _0x3fd2f5=_0x276d('0x26');return db[_0x276d('0x4d')][_0x276d('0x4e')]({'where':{'name':_0x3fd2f5,'userProfileId':_0x51d8f2[_0x276d('0x57')]},'raw':!![]})[_0x276d('0x24')](function(_0x357a8c){if(_0x357a8c&&_0x357a8c[_0x276d('0x4f')]===0x0){return db[_0x276d('0x27')][_0x276d('0x4a')]({'name':_0x48001f[_0x276d('0x2a')],'resourceId':_0x48001f['id'],'type':_0x357a8c[_0x276d('0x2a')],'sectionId':_0x357a8c['id']},{})[_0x276d('0x24')](function(){return _0x4876f4;});}else{return _0x4876f4;}})['catch'](function(_0x3653ab){logger[_0x276d('0x28')]('Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s',_0x3653ab);throw _0x3653ab;});}return _0x4876f4;});}})[_0x276d('0x24')](respondWithResult(_0x3298d1,0xc9))[_0x276d('0x46')](handleError(_0x3298d1,null));};exports[_0x276d('0x58')]=function(_0x5db132,_0xc5446b){if(_0x5db132[_0x276d('0x55')]['id']){delete _0x5db132[_0x276d('0x55')]['id'];}return db[_0x276d('0x2e')][_0x276d('0x4e')]({'where':{'id':_0x5db132[_0x276d('0x48')]['id']}})[_0x276d('0x24')](handleEntityNotFound(_0xc5446b,null))[_0x276d('0x24')](saveUpdates(_0x5db132['body'],null))[_0x276d('0x24')](respondWithResult(_0xc5446b,null))['catch'](handleError(_0xc5446b,null));};exports['destroy']=function(_0x1dcdce,_0x2dd008){return db[_0x276d('0x2e')][_0x276d('0x4e')]({'where':{'id':_0x1dcdce['params']['id']}})[_0x276d('0x24')](handleEntityNotFound(_0x2dd008,null))[_0x276d('0x24')](removeEntity(_0x2dd008,null))[_0x276d('0x46')](handleError(_0x2dd008,null));};exports[_0x276d('0x59')]=function(_0x3e314a,_0x62fa2a,_0x156fac){var _0x2763bc={'raw':!![],'where':{}};var _0x3d2220={};var _0x196257={'count':0x0,'rows':[]};return db[_0x276d('0x2e')]['findOne']({'where':{'id':_0x3e314a[_0x276d('0x48')]['id']}})[_0x276d('0x24')](handleEntityNotFound(_0x62fa2a,null))[_0x276d('0x24')](function(_0x34d77c){if(_0x34d77c){_0x3d2220[_0x276d('0x32')]=_[_0x276d('0x33')](db[_0x276d('0x5a')][_0x276d('0x2f')]);_0x3d2220[_0x276d('0x36')]=_['keys'](_0x3e314a[_0x276d('0x36')]);_0x3d2220[_0x276d('0x34')]=_[_0x276d('0x35')](_0x3d2220[_0x276d('0x32')],_0x3d2220[_0x276d('0x36')]);_0x2763bc[_0x276d('0x37')]=_['intersection'](_0x3d2220[_0x276d('0x32')],qs[_0x276d('0x38')](_0x3e314a[_0x276d('0x36')][_0x276d('0x38')]));_0x2763bc[_0x276d('0x37')]=_0x2763bc['attributes'][_0x276d('0x39')]?_0x2763bc['attributes']:_0x3d2220['model'];if(!_0x3e314a[_0x276d('0x36')][_0x276d('0x3a')](_0x276d('0x3b'))){_0x2763bc[_0x276d('0x1d')]=qs[_0x276d('0x1d')](_0x3e314a[_0x276d('0x36')][_0x276d('0x1d')]);_0x2763bc[_0x276d('0x20')]=qs[_0x276d('0x20')](_0x3e314a[_0x276d('0x36')][_0x276d('0x20')]);}_0x2763bc[_0x276d('0x3c')]=qs[_0x276d('0x3d')](_0x3e314a['query'][_0x276d('0x3d')]);_0x2763bc[_0x276d('0x3e')]=qs[_0x276d('0x34')](_[_0x276d('0x3f')](_0x3e314a[_0x276d('0x36')],_0x3d2220[_0x276d('0x34')]));_0x2763bc[_0x276d('0x3e')][_0x276d('0x5b')]=_0x34d77c['id'];if(_0x3e314a['query']['filter']){_0x2763bc[_0x276d('0x3e')]=_[_0x276d('0x41')](_0x2763bc[_0x276d('0x3e')],{'$or':_[_0x276d('0x2d')](_0x2763bc[_0x276d('0x37')],function(_0x49ca7a){var _0x5265e8={};_0x5265e8[_0x49ca7a]={'$like':'%'+_0x3e314a[_0x276d('0x36')]['filter']+'%'};return _0x5265e8;})});}_0x2763bc=_[_0x276d('0x41')]({},_0x2763bc,_0x3e314a[_0x276d('0x42')]);return db[_0x276d('0x5a')]['count']({'where':_0x2763bc[_0x276d('0x3e')]})['then'](function(_0x2bfb5d){_0x196257['count']=_0x2bfb5d;if(_0x3e314a['query']['includeAll']){_0x2763bc[_0x276d('0x43')]=[{'all':!![]}];}return db[_0x276d('0x5a')][_0x276d('0x44')](_0x2763bc);})[_0x276d('0x24')](function(_0x1a1957){_0x196257[_0x276d('0x45')]=_0x1a1957;return _0x196257;});}})[_0x276d('0x24')](respondWithFilteredResult(_0x62fa2a,_0x2763bc))[_0x276d('0x46')](handleError(_0x62fa2a,null));};exports[_0x276d('0x5c')]=function(_0x5a1524,_0x35252d,_0x5c839b){var _0x2ae16a={'raw':!![],'where':{}};var _0xc8ebb6={};var _0x326752={'count':0x0,'rows':[]};return db[_0x276d('0x2e')][_0x276d('0x5d')]({'where':{'id':_0x5a1524['params']['id']}})['then'](handleEntityNotFound(_0x35252d,null))[_0x276d('0x24')](function(_0x56e6d8){if(_0x56e6d8){_0xc8ebb6[_0x276d('0x32')]=_[_0x276d('0x33')](db[_0x276d('0x5e')][_0x276d('0x2f')]);_0xc8ebb6['query']=_['keys'](_0x5a1524[_0x276d('0x36')]);_0xc8ebb6['filters']=_[_0x276d('0x35')](_0xc8ebb6[_0x276d('0x32')],_0xc8ebb6['query']);_0x2ae16a[_0x276d('0x37')]=_['intersection'](_0xc8ebb6['model'],qs[_0x276d('0x38')](_0x5a1524['query'][_0x276d('0x38')]));_0x2ae16a[_0x276d('0x37')]=_0x2ae16a['attributes'][_0x276d('0x39')]?_0x2ae16a[_0x276d('0x37')]:_0xc8ebb6['model'];if(!_0x5a1524[_0x276d('0x36')]['hasOwnProperty'](_0x276d('0x3b'))){_0x2ae16a[_0x276d('0x1d')]=qs[_0x276d('0x1d')](_0x5a1524[_0x276d('0x36')][_0x276d('0x1d')]);_0x2ae16a['offset']=qs['offset'](_0x5a1524[_0x276d('0x36')][_0x276d('0x20')]);}_0x2ae16a[_0x276d('0x3c')]=qs[_0x276d('0x3d')](_0x5a1524[_0x276d('0x36')][_0x276d('0x3d')]);_0x2ae16a[_0x276d('0x3e')]=qs[_0x276d('0x34')](_[_0x276d('0x3f')](_0x5a1524[_0x276d('0x36')],_0xc8ebb6[_0x276d('0x34')]));_0x2ae16a[_0x276d('0x3e')]['ProjectId']=_0x56e6d8['id'];if(_0x5a1524['query'][_0x276d('0x40')]){_0x2ae16a[_0x276d('0x3e')]=_[_0x276d('0x41')](_0x2ae16a['where'],{'$or':_['map'](_0x2ae16a[_0x276d('0x37')],function(_0x3ae14d){var _0x577857={};_0x577857[_0x3ae14d]={'$like':'%'+_0x5a1524[_0x276d('0x36')]['filter']+'%'};return _0x577857;})});}_0x2ae16a=_[_0x276d('0x41')]({},_0x2ae16a,_0x5a1524[_0x276d('0x42')]);return db['JscriptyAnswerReport'][_0x276d('0x1f')]({'where':_0x2ae16a[_0x276d('0x3e')]})[_0x276d('0x24')](function(_0x2a4acf){_0x326752[_0x276d('0x1f')]=_0x2a4acf;if(_0x5a1524[_0x276d('0x36')][_0x276d('0x49')]){_0x2ae16a[_0x276d('0x43')]=[{'all':!![]}];}return db[_0x276d('0x5e')][_0x276d('0x44')](_0x2ae16a);})[_0x276d('0x24')](function(_0x43ec7f){_0x326752[_0x276d('0x45')]=_0x43ec7f;return _0x326752;});}})[_0x276d('0x24')](respondWithFilteredResult(_0x35252d,_0x2ae16a))[_0x276d('0x46')](handleError(_0x35252d,null));};function char(_0x366662){return'number'===typeof _0x366662?String[_0x276d('0x5f')]['apply'](null,arguments):_0x366662;}function needsEncapsulation(_0x337a31){return!!_0x337a31&&(_0x337a31[_0x276d('0x60')]()[_0x276d('0x61')](char(0xd))>=0x0||_0x337a31[_0x276d('0x60')]()[_0x276d('0x61')](char(0xa))>=0x0||_0x337a31['toString']()['indexOf'](char(0x2c))>=0x0||_0x337a31['toString']()[_0x276d('0x61')](char(0x22))>=0x0);}function encapsulate(_0x4e498d){var _0x481d52=char(0x22),_0x6b277a='\x5c'+char(0x22),_0x1657b1=_0x4e498d[_0x276d('0x60')]()[_0x276d('0x62')](new RegExp(_0x481d52,'g'),_0x6b277a);return _0x481d52+_0x1657b1+_0x481d52;}exports[_0x276d('0x63')]=function(_0x5bacf4,_0x30e727,_0x188077){var _0x3db450,_0x26ee4e;var _0x1fbbd1={'where':{'ProjectId':_0x5bacf4['params']['id']}};if(_0x5bacf4[_0x276d('0x36')][_0x276d('0x64')]){_0x1fbbd1['where'][_0x276d('0x65')]=JSON[_0x276d('0x66')](_0x5bacf4[_0x276d('0x36')][_0x276d('0x64')]);}return db[_0x276d('0x5a')][_0x276d('0x44')](_0x1fbbd1)[_0x276d('0x24')](handleEntityNotFound(_0x30e727,null))[_0x276d('0x24')](function(_0x8df312){if(_0x8df312){_0x3db450=_0x8df312;return db[_0x276d('0x67')]['findAll']({'where':{'SessionId':{'$in':_['map'](_0x3db450,'id')},'ProjectId':_0x5bacf4[_0x276d('0x48')]['id']},'order':_0x276d('0x68')});}})[_0x276d('0x24')](handleEntityNotFound(_0x30e727,null))['then'](function(_0x486562){if(_0x486562){_0x26ee4e=_0x486562;var _0x2c1418={};for(var _0x164627=0x0,_0x1e1926=_0x26ee4e[_0x276d('0x39')];_0x164627<_0x1e1926;_0x164627++){if(!_0x2c1418[_0x276d('0x3a')](_0x26ee4e[_0x164627]['questionId'])){_0x2c1418[_0x26ee4e[_0x164627]['questionId']]=needsEncapsulation(_0x26ee4e[_0x164627]['question'])?encapsulate(_0x26ee4e[_0x164627]['question']):_0x26ee4e[_0x164627][_0x276d('0x69')];}}var _0x254fc8=[],_0x5f5572={};for(var _0x45b0c7=0x0,_0x24bc1b=_0x3db450[_0x276d('0x39')];_0x45b0c7<_0x24bc1b;_0x45b0c7++){_0x5f5572={'ProjectId':_0x5bacf4[_0x276d('0x48')]['id'],'SessionId':_0x3db450[_0x45b0c7]['id'],'StartTime':moment(_0x3db450[_0x45b0c7][_0x276d('0x65')])[_0x276d('0x6a')](_0x276d('0x6b'))};for(var _0x4eb279=0x0,_0x12a831=_0x26ee4e[_0x276d('0x39')];_0x4eb279<_0x12a831;_0x4eb279++){if(_0x26ee4e[_0x4eb279]['SessionId']==_0x3db450[_0x45b0c7]['id']&&_0x2c1418[_0x276d('0x3a')](_0x26ee4e[_0x4eb279][_0x276d('0x6c')])){_0x5f5572[_0x2c1418[_0x26ee4e[_0x4eb279][_0x276d('0x6c')]]]=_0x26ee4e[_0x4eb279][_0x276d('0x6d')];}}for(var _0x2926de in _0x2c1418){if(!_0x5f5572['hasOwnProperty'](_0x2c1418[_0x2926de])){_0x5f5572[_0x2c1418[_0x2926de]]=null;}}_0x254fc8[_0x276d('0x6e')](_0x5f5572);}return _0x254fc8;}})['then'](function(_0x2a10a6){if(!_[_0x276d('0x6f')](_0x2a10a6)){var _0x2812df=toCsv(_0x2a10a6);var _0x5ce4d0=Date['now']();fs[_0x276d('0x70')](util[_0x276d('0x6a')](_0x276d('0x71'),_0x5bacf4[_0x276d('0x48')]['id'],_0x5ce4d0),_0x2812df);_0x30e727[_0x276d('0x72')]('Content-disposition','attachment;\x20filename='+util['format'](_0x276d('0x73'),_0x5bacf4['params']['id'],_0x5ce4d0));_0x30e727[_0x276d('0x72')](_0x276d('0x74'),'text/csv');return _0x30e727['download'](util['format'](_0x276d('0x71'),_0x5bacf4[_0x276d('0x48')]['id'],_0x5ce4d0));}else{return _0x30e727['sendStatus'](0xcc);}})[_0x276d('0x46')](handleError(_0x30e727,null));}; \ No newline at end of file +var _0xa0a3=['JscriptyQuestionReport','-createdAt','questionId','question','SessionId','answer','isEmpty','now','format','setHeader','Content-disposition','attachment;\x20filename=','Jscripty_Project_%d_Summary_%s.csv','Content-type','text/csv','/tmp/Jscripty_Project_%d_Summary_%s.csv','rimraf','zip-dir','request-promise','moment','bluebird','mustache','util','path','sox','to-csv','ejs','fs-extra','lodash','squel','crypto','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','api','../../config/utils','../../mysqldb','sendStatus','status','end','json','offset','limit','count','set','Content-Range','apply','update','then','destroy','get','UserProfileResource','name','send','map','JscriptyProject','rawAttributes','fieldName','type','key','model','query','keys','filters','attributes','intersection','fields','length','hasOwnProperty','sort','where','pick','filter','merge','options','includeAll','findAll','rows','catch','show','params','include','create','body','user','role','UserProfileSection','find','autoAssociation','error','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','clone','omit','createdAt','updatedAt','Unable\x20to\x20retrieve\x20the\x20current\x20user','userProfileId','getSessions','JscriptySessionReport','nolimit','order','ProjectId','findOne','JscriptyAnswerReport','number','fromCharCode','toString','indexOf','replace','getSummary','starttime','parse','startTime'];(function(_0x297b9c,_0x4ee418){var _0x291330=function(_0x383d23){while(--_0x383d23){_0x297b9c['push'](_0x297b9c['shift']());}};_0x291330(++_0x4ee418);}(_0xa0a3,0x1e0));var _0x3a0a=function(_0x27a50a,_0x2be133){_0x27a50a=_0x27a50a-0x0;var _0x24679d=_0xa0a3[_0x27a50a];return _0x24679d;};'use strict';var emlformat=require('eml-format');var rimraf=require(_0x3a0a('0x0'));var zipdir=require(_0x3a0a('0x1'));var jsonpatch=require('fast-json-patch');var rp=require(_0x3a0a('0x2'));var moment=require(_0x3a0a('0x3'));var BPromise=require(_0x3a0a('0x4'));var Mustache=require(_0x3a0a('0x5'));var util=require(_0x3a0a('0x6'));var path=require(_0x3a0a('0x7'));var sox=require(_0x3a0a('0x8'));var csv=require(_0x3a0a('0x9'));var ejs=require(_0x3a0a('0xa'));var fs=require('fs');var fs_extra=require(_0x3a0a('0xb'));var _=require(_0x3a0a('0xc'));var squel=require(_0x3a0a('0xd'));var crypto=require(_0x3a0a('0xe'));var jsforce=require('jsforce');var deskjs=require('desk.js');var toCsv=require(_0x3a0a('0x9'));var querystring=require(_0x3a0a('0xf'));var Papa=require(_0x3a0a('0x10'));var Redis=require(_0x3a0a('0x11'));var authService=require(_0x3a0a('0x12'));var qs=require(_0x3a0a('0x13'));var as=require(_0x3a0a('0x14'));var hardwareService=require('../../config/license/hardware');var logger=require('../../config/logger')(_0x3a0a('0x15'));var utils=require(_0x3a0a('0x16'));var config=require('../../config/environment');var licenseUtil=require('../../config/license/util');var db=require(_0x3a0a('0x17'))['db'];function respondWithStatusCode(_0x1db53c,_0x52cb58){_0x52cb58=_0x52cb58||0xcc;return function(_0x2243d2){if(_0x2243d2){return _0x1db53c[_0x3a0a('0x18')](_0x52cb58);}return _0x1db53c[_0x3a0a('0x19')](_0x52cb58)[_0x3a0a('0x1a')]();};}function respondWithResult(_0x977120,_0x303dc7){_0x303dc7=_0x303dc7||0xc8;return function(_0x350d58){if(_0x350d58){return _0x977120[_0x3a0a('0x19')](_0x303dc7)[_0x3a0a('0x1b')](_0x350d58);}};}function respondWithFilteredResult(_0x21e0f7,_0x11eeee){return function(_0x22a60e){if(_0x22a60e){var _0x52f629=typeof _0x11eeee[_0x3a0a('0x1c')]==='undefined'&&typeof _0x11eeee[_0x3a0a('0x1d')]==='undefined';var _0x2f5e77=_0x22a60e[_0x3a0a('0x1e')];var _0x36582f=_0x52f629?0x0:_0x11eeee['offset'];var _0x104679=_0x52f629?_0x22a60e[_0x3a0a('0x1e')]:_0x11eeee['offset']+_0x11eeee[_0x3a0a('0x1d')];var _0x26f7bb;if(_0x104679>=_0x2f5e77){_0x104679=_0x2f5e77;_0x26f7bb=0xc8;}else{_0x26f7bb=0xce;}_0x21e0f7[_0x3a0a('0x19')](_0x26f7bb);return _0x21e0f7[_0x3a0a('0x1f')](_0x3a0a('0x20'),_0x36582f+'-'+_0x104679+'/'+_0x2f5e77)[_0x3a0a('0x1b')](_0x22a60e);}return null;};}function patchUpdates(_0x3e99f9){return function(_0x231541){try{jsonpatch[_0x3a0a('0x21')](_0x231541,_0x3e99f9,!![]);}catch(_0x430509){return BPromise['reject'](_0x430509);}return _0x231541['save']();};}function saveUpdates(_0x483039,_0x33560b){return function(_0x6681b2){if(_0x6681b2){return _0x6681b2[_0x3a0a('0x22')](_0x483039)[_0x3a0a('0x23')](function(_0x1468a9){return _0x1468a9;});}return null;};}function removeEntity(_0x49d60d,_0x280022){return function(_0x1d2eac){if(_0x1d2eac){return _0x1d2eac[_0x3a0a('0x24')]()['then'](function(){var _0x3a5955=_0x1d2eac[_0x3a0a('0x25')]({'plain':!![]});var _0x496348='Projects';return db[_0x3a0a('0x26')][_0x3a0a('0x24')]({'where':{'type':_0x496348,'resourceId':_0x3a5955['id']}})[_0x3a0a('0x23')](function(){return _0x1d2eac;});})['then'](function(){_0x49d60d[_0x3a0a('0x19')](0xcc)[_0x3a0a('0x1a')]();});}};}function handleEntityNotFound(_0x130ca6,_0x188027){return function(_0x122e65){if(!_0x122e65){_0x130ca6['sendStatus'](0x194);}return _0x122e65;};}function handleError(_0x4a5481,_0x453040){_0x453040=_0x453040||0x1f4;return function(_0x3d01d8){logger['error'](_0x3d01d8['stack']);if(_0x3d01d8[_0x3a0a('0x27')]){delete _0x3d01d8[_0x3a0a('0x27')];}_0x4a5481[_0x3a0a('0x19')](_0x453040)[_0x3a0a('0x28')](_0x3d01d8);};}exports['index']=function(_0x5d7760,_0x38aaa0){var _0x23dd57={},_0x177181={},_0x4c99f9={'count':0x0,'rows':[]};var _0x1418b6=_[_0x3a0a('0x29')](db[_0x3a0a('0x2a')][_0x3a0a('0x2b')],function(_0x10b09f){return{'name':_0x10b09f[_0x3a0a('0x2c')],'type':_0x10b09f[_0x3a0a('0x2d')][_0x3a0a('0x2e')]};});_0x177181[_0x3a0a('0x2f')]=_['map'](_0x1418b6,_0x3a0a('0x27'));_0x177181[_0x3a0a('0x30')]=_[_0x3a0a('0x31')](_0x5d7760[_0x3a0a('0x30')]);_0x177181[_0x3a0a('0x32')]=_['intersection'](_0x177181[_0x3a0a('0x2f')],_0x177181[_0x3a0a('0x30')]);_0x23dd57[_0x3a0a('0x33')]=_[_0x3a0a('0x34')](_0x177181[_0x3a0a('0x2f')],qs[_0x3a0a('0x35')](_0x5d7760['query'][_0x3a0a('0x35')]));_0x23dd57[_0x3a0a('0x33')]=_0x23dd57[_0x3a0a('0x33')][_0x3a0a('0x36')]?_0x23dd57[_0x3a0a('0x33')]:_0x177181[_0x3a0a('0x2f')];if(!_0x5d7760[_0x3a0a('0x30')][_0x3a0a('0x37')]('nolimit')){_0x23dd57[_0x3a0a('0x1d')]=qs[_0x3a0a('0x1d')](_0x5d7760[_0x3a0a('0x30')][_0x3a0a('0x1d')]);_0x23dd57[_0x3a0a('0x1c')]=qs[_0x3a0a('0x1c')](_0x5d7760[_0x3a0a('0x30')][_0x3a0a('0x1c')]);}_0x23dd57['order']=qs[_0x3a0a('0x38')](_0x5d7760[_0x3a0a('0x30')][_0x3a0a('0x38')]);_0x23dd57[_0x3a0a('0x39')]=qs[_0x3a0a('0x32')](_[_0x3a0a('0x3a')](_0x5d7760[_0x3a0a('0x30')],_0x177181[_0x3a0a('0x32')]),_0x1418b6);if(_0x5d7760[_0x3a0a('0x30')]['filter']){_0x23dd57[_0x3a0a('0x39')]=_['merge'](_0x23dd57[_0x3a0a('0x39')],{'$or':_[_0x3a0a('0x29')](_0x1418b6,function(_0x17b5b3){if(_0x17b5b3[_0x3a0a('0x2d')]!=='VIRTUAL'){var _0x425c95={};_0x425c95[_0x17b5b3['name']]={'$like':'%'+_0x5d7760[_0x3a0a('0x30')][_0x3a0a('0x3b')]+'%'};return _0x425c95;}})});}_0x23dd57=_[_0x3a0a('0x3c')]({},_0x23dd57,_0x5d7760[_0x3a0a('0x3d')]);var _0x4d32f8={'where':_0x23dd57[_0x3a0a('0x39')]};return db['JscriptyProject']['count'](_0x4d32f8)[_0x3a0a('0x23')](function(_0x4f9b60){_0x4c99f9['count']=_0x4f9b60;if(_0x5d7760[_0x3a0a('0x30')][_0x3a0a('0x3e')]){_0x23dd57['include']=[{'all':!![]}];}return db[_0x3a0a('0x2a')][_0x3a0a('0x3f')](_0x23dd57);})[_0x3a0a('0x23')](function(_0xd16d0){_0x4c99f9[_0x3a0a('0x40')]=_0xd16d0;return _0x4c99f9;})['then'](respondWithFilteredResult(_0x38aaa0,_0x23dd57))[_0x3a0a('0x41')](handleError(_0x38aaa0,null));};exports[_0x3a0a('0x42')]=function(_0x2b4a6b,_0x34ea81){var _0x45e170={'raw':![],'where':{'id':_0x2b4a6b[_0x3a0a('0x43')]['id']}},_0x34e633={};_0x34e633[_0x3a0a('0x2f')]=_['keys'](db['JscriptyProject'][_0x3a0a('0x2b')]);_0x34e633[_0x3a0a('0x30')]=_[_0x3a0a('0x31')](_0x2b4a6b['query']);_0x34e633[_0x3a0a('0x32')]=_[_0x3a0a('0x34')](_0x34e633[_0x3a0a('0x2f')],_0x34e633[_0x3a0a('0x30')]);_0x45e170['attributes']=_[_0x3a0a('0x34')](_0x34e633['model'],qs[_0x3a0a('0x35')](_0x2b4a6b['query'][_0x3a0a('0x35')]));_0x45e170['attributes']=_0x45e170[_0x3a0a('0x33')][_0x3a0a('0x36')]?_0x45e170['attributes']:_0x34e633['model'];if(_0x2b4a6b[_0x3a0a('0x30')][_0x3a0a('0x3e')]){_0x45e170[_0x3a0a('0x44')]=[{'all':!![]}];}_0x45e170=_[_0x3a0a('0x3c')]({},_0x45e170,_0x2b4a6b[_0x3a0a('0x3d')]);return db[_0x3a0a('0x2a')]['find'](_0x45e170)['then'](handleEntityNotFound(_0x34ea81,null))[_0x3a0a('0x23')](respondWithResult(_0x34ea81,null))[_0x3a0a('0x41')](handleError(_0x34ea81,null));};exports['create']=function(_0x48aa92,_0x1ef695){return db['JscriptyProject'][_0x3a0a('0x45')](_0x48aa92[_0x3a0a('0x46')],{})[_0x3a0a('0x23')](function(_0x34677a){var _0x385f83=_0x48aa92[_0x3a0a('0x47')]['get']({'plain':!![]});if(!_0x385f83)throw new Error('Unable\x20to\x20retrieve\x20the\x20current\x20user');if(_0x385f83[_0x3a0a('0x48')]===_0x3a0a('0x47')){var _0x201dca=_0x34677a[_0x3a0a('0x25')]({'plain':!![]});var _0x26f46c='Projects';return db[_0x3a0a('0x49')][_0x3a0a('0x4a')]({'where':{'name':_0x26f46c,'userProfileId':_0x385f83['userProfileId']},'raw':!![]})['then'](function(_0x37d62d){if(_0x37d62d&&_0x37d62d[_0x3a0a('0x4b')]===0x0){return db[_0x3a0a('0x26')][_0x3a0a('0x45')]({'name':_0x201dca[_0x3a0a('0x27')],'resourceId':_0x201dca['id'],'type':_0x37d62d[_0x3a0a('0x27')],'sectionId':_0x37d62d['id']},{})[_0x3a0a('0x23')](function(){return _0x34677a;});}else{return _0x34677a;}})['catch'](function(_0x2905b7){logger[_0x3a0a('0x4c')](_0x3a0a('0x4d'),_0x2905b7);throw _0x2905b7;});}return _0x34677a;})[_0x3a0a('0x23')](respondWithResult(_0x1ef695,0xc9))[_0x3a0a('0x41')](handleError(_0x1ef695,null));};exports[_0x3a0a('0x4e')]=function(_0x93e846,_0x2ebdec){var _0x2cc478={'where':{'id':_0x93e846[_0x3a0a('0x43')]['id']}},_0x3fe96a={};_0x3fe96a[_0x3a0a('0x2f')]=_[_0x3a0a('0x31')](db['JscriptyProject'][_0x3a0a('0x2b')]);_0x2cc478[_0x3a0a('0x33')]=_[_0x3a0a('0x34')](_0x3fe96a['model'],qs['fields'](_0x93e846[_0x3a0a('0x30')][_0x3a0a('0x35')]));_0x2cc478[_0x3a0a('0x33')]=_0x2cc478['attributes']['length']?_0x2cc478[_0x3a0a('0x33')]:_0x3fe96a[_0x3a0a('0x2f')];if(_0x93e846[_0x3a0a('0x30')]['includeAll']){_0x2cc478[_0x3a0a('0x44')]=[{'all':!![]}];}_0x2cc478=_[_0x3a0a('0x3c')]({},_0x2cc478,_0x93e846[_0x3a0a('0x3d')]);return db[_0x3a0a('0x2a')][_0x3a0a('0x4a')](_0x2cc478)['then'](handleEntityNotFound(_0x2ebdec,null))[_0x3a0a('0x23')](function(_0x5d3081){if(_0x5d3081){var _0x40df97=_0x5d3081[_0x3a0a('0x25')]({'plain':!![]});_0x40df97=qs[_0x3a0a('0x4f')](_0x40df97,['id',_0x3a0a('0x50'),'updatedAt']);_0x93e846[_0x3a0a('0x46')]=_['omit'](_0x93e846[_0x3a0a('0x46')],['id',_0x3a0a('0x50'),_0x3a0a('0x51')]);return db[_0x3a0a('0x2a')][_0x3a0a('0x45')](_[_0x3a0a('0x3c')](_0x40df97,_0x93e846[_0x3a0a('0x46')]),{'include':_0x93e846[_0x3a0a('0x30')][_0x3a0a('0x3e')]?[{'all':!![]}]:undefined})[_0x3a0a('0x23')](function(_0x25a7c8){var _0x8e7485=_0x93e846[_0x3a0a('0x47')][_0x3a0a('0x25')]({'plain':!![]});if(!_0x8e7485)throw new Error(_0x3a0a('0x52'));if(_0x8e7485[_0x3a0a('0x48')]===_0x3a0a('0x47')){var _0x3c8166=_0x25a7c8[_0x3a0a('0x25')]({'plain':!![]});var _0x182ba6='Projects';return db[_0x3a0a('0x49')][_0x3a0a('0x4a')]({'where':{'name':_0x182ba6,'userProfileId':_0x8e7485[_0x3a0a('0x53')]},'raw':!![]})[_0x3a0a('0x23')](function(_0x2c807a){if(_0x2c807a&&_0x2c807a[_0x3a0a('0x4b')]===0x0){return db[_0x3a0a('0x26')][_0x3a0a('0x45')]({'name':_0x3c8166[_0x3a0a('0x27')],'resourceId':_0x3c8166['id'],'type':_0x2c807a[_0x3a0a('0x27')],'sectionId':_0x2c807a['id']},{})[_0x3a0a('0x23')](function(){return _0x25a7c8;});}else{return _0x25a7c8;}})[_0x3a0a('0x41')](function(_0x1a3227){logger[_0x3a0a('0x4c')](_0x3a0a('0x4d'),_0x1a3227);throw _0x1a3227;});}return _0x25a7c8;});}})['then'](respondWithResult(_0x2ebdec,0xc9))['catch'](handleError(_0x2ebdec,null));};exports['update']=function(_0x21b82c,_0x4ba52b){if(_0x21b82c[_0x3a0a('0x46')]['id']){delete _0x21b82c['body']['id'];}return db[_0x3a0a('0x2a')]['find']({'where':{'id':_0x21b82c[_0x3a0a('0x43')]['id']}})[_0x3a0a('0x23')](handleEntityNotFound(_0x4ba52b,null))['then'](saveUpdates(_0x21b82c[_0x3a0a('0x46')],null))['then'](respondWithResult(_0x4ba52b,null))[_0x3a0a('0x41')](handleError(_0x4ba52b,null));};exports[_0x3a0a('0x24')]=function(_0x2474ff,_0x2b0507){return db[_0x3a0a('0x2a')][_0x3a0a('0x4a')]({'where':{'id':_0x2474ff['params']['id']}})[_0x3a0a('0x23')](handleEntityNotFound(_0x2b0507,null))[_0x3a0a('0x23')](removeEntity(_0x2b0507,null))[_0x3a0a('0x41')](handleError(_0x2b0507,null));};exports[_0x3a0a('0x54')]=function(_0x476e45,_0x34f09a,_0x23836c){var _0x5404a9={'raw':!![],'where':{}};var _0x53f68e={};var _0x183e88={'count':0x0,'rows':[]};return db[_0x3a0a('0x2a')]['findOne']({'where':{'id':_0x476e45[_0x3a0a('0x43')]['id']}})[_0x3a0a('0x23')](handleEntityNotFound(_0x34f09a,null))['then'](function(_0x535379){if(_0x535379){_0x53f68e['model']=_[_0x3a0a('0x31')](db[_0x3a0a('0x55')]['rawAttributes']);_0x53f68e[_0x3a0a('0x30')]=_['keys'](_0x476e45[_0x3a0a('0x30')]);_0x53f68e[_0x3a0a('0x32')]=_[_0x3a0a('0x34')](_0x53f68e[_0x3a0a('0x2f')],_0x53f68e[_0x3a0a('0x30')]);_0x5404a9[_0x3a0a('0x33')]=_[_0x3a0a('0x34')](_0x53f68e[_0x3a0a('0x2f')],qs['fields'](_0x476e45['query']['fields']));_0x5404a9[_0x3a0a('0x33')]=_0x5404a9[_0x3a0a('0x33')]['length']?_0x5404a9[_0x3a0a('0x33')]:_0x53f68e[_0x3a0a('0x2f')];if(!_0x476e45[_0x3a0a('0x30')][_0x3a0a('0x37')](_0x3a0a('0x56'))){_0x5404a9['limit']=qs[_0x3a0a('0x1d')](_0x476e45[_0x3a0a('0x30')][_0x3a0a('0x1d')]);_0x5404a9[_0x3a0a('0x1c')]=qs['offset'](_0x476e45[_0x3a0a('0x30')][_0x3a0a('0x1c')]);}_0x5404a9[_0x3a0a('0x57')]=qs[_0x3a0a('0x38')](_0x476e45['query'][_0x3a0a('0x38')]);_0x5404a9[_0x3a0a('0x39')]=qs[_0x3a0a('0x32')](_[_0x3a0a('0x3a')](_0x476e45[_0x3a0a('0x30')],_0x53f68e['filters']));_0x5404a9[_0x3a0a('0x39')][_0x3a0a('0x58')]=_0x535379['id'];if(_0x476e45[_0x3a0a('0x30')][_0x3a0a('0x3b')]){_0x5404a9[_0x3a0a('0x39')]=_['merge'](_0x5404a9[_0x3a0a('0x39')],{'$or':_[_0x3a0a('0x29')](_0x5404a9['attributes'],function(_0x3872a3){var _0x27187b={};_0x27187b[_0x3872a3]={'$like':'%'+_0x476e45[_0x3a0a('0x30')]['filter']+'%'};return _0x27187b;})});}_0x5404a9=_[_0x3a0a('0x3c')]({},_0x5404a9,_0x476e45[_0x3a0a('0x3d')]);return db['JscriptySessionReport'][_0x3a0a('0x1e')]({'where':_0x5404a9[_0x3a0a('0x39')]})['then'](function(_0x226331){_0x183e88[_0x3a0a('0x1e')]=_0x226331;if(_0x476e45[_0x3a0a('0x30')]['includeAll']){_0x5404a9['include']=[{'all':!![]}];}return db[_0x3a0a('0x55')][_0x3a0a('0x3f')](_0x5404a9);})[_0x3a0a('0x23')](function(_0xfa7c6a){_0x183e88[_0x3a0a('0x40')]=_0xfa7c6a;return _0x183e88;});}})[_0x3a0a('0x23')](respondWithFilteredResult(_0x34f09a,_0x5404a9))[_0x3a0a('0x41')](handleError(_0x34f09a,null));};exports['getAnswers']=function(_0x37521a,_0x27315d,_0x426ae5){var _0x4a9744={'raw':!![],'where':{}};var _0x26b9a2={};var _0x489e7f={'count':0x0,'rows':[]};return db[_0x3a0a('0x2a')][_0x3a0a('0x59')]({'where':{'id':_0x37521a[_0x3a0a('0x43')]['id']}})[_0x3a0a('0x23')](handleEntityNotFound(_0x27315d,null))['then'](function(_0x479733){if(_0x479733){_0x26b9a2['model']=_['keys'](db['JscriptyAnswerReport'][_0x3a0a('0x2b')]);_0x26b9a2[_0x3a0a('0x30')]=_[_0x3a0a('0x31')](_0x37521a[_0x3a0a('0x30')]);_0x26b9a2[_0x3a0a('0x32')]=_['intersection'](_0x26b9a2[_0x3a0a('0x2f')],_0x26b9a2[_0x3a0a('0x30')]);_0x4a9744[_0x3a0a('0x33')]=_[_0x3a0a('0x34')](_0x26b9a2[_0x3a0a('0x2f')],qs[_0x3a0a('0x35')](_0x37521a[_0x3a0a('0x30')][_0x3a0a('0x35')]));_0x4a9744[_0x3a0a('0x33')]=_0x4a9744[_0x3a0a('0x33')][_0x3a0a('0x36')]?_0x4a9744[_0x3a0a('0x33')]:_0x26b9a2[_0x3a0a('0x2f')];if(!_0x37521a[_0x3a0a('0x30')][_0x3a0a('0x37')](_0x3a0a('0x56'))){_0x4a9744[_0x3a0a('0x1d')]=qs[_0x3a0a('0x1d')](_0x37521a['query'][_0x3a0a('0x1d')]);_0x4a9744['offset']=qs[_0x3a0a('0x1c')](_0x37521a[_0x3a0a('0x30')]['offset']);}_0x4a9744[_0x3a0a('0x57')]=qs[_0x3a0a('0x38')](_0x37521a[_0x3a0a('0x30')][_0x3a0a('0x38')]);_0x4a9744[_0x3a0a('0x39')]=qs['filters'](_[_0x3a0a('0x3a')](_0x37521a[_0x3a0a('0x30')],_0x26b9a2[_0x3a0a('0x32')]));_0x4a9744[_0x3a0a('0x39')][_0x3a0a('0x58')]=_0x479733['id'];if(_0x37521a['query'][_0x3a0a('0x3b')]){_0x4a9744['where']=_[_0x3a0a('0x3c')](_0x4a9744[_0x3a0a('0x39')],{'$or':_['map'](_0x4a9744[_0x3a0a('0x33')],function(_0x5beab5){var _0x46f2d0={};_0x46f2d0[_0x5beab5]={'$like':'%'+_0x37521a[_0x3a0a('0x30')][_0x3a0a('0x3b')]+'%'};return _0x46f2d0;})});}_0x4a9744=_[_0x3a0a('0x3c')]({},_0x4a9744,_0x37521a[_0x3a0a('0x3d')]);return db[_0x3a0a('0x5a')][_0x3a0a('0x1e')]({'where':_0x4a9744[_0x3a0a('0x39')]})[_0x3a0a('0x23')](function(_0x55f6af){_0x489e7f[_0x3a0a('0x1e')]=_0x55f6af;if(_0x37521a[_0x3a0a('0x30')]['includeAll']){_0x4a9744['include']=[{'all':!![]}];}return db['JscriptyAnswerReport'][_0x3a0a('0x3f')](_0x4a9744);})['then'](function(_0x2f1415){_0x489e7f['rows']=_0x2f1415;return _0x489e7f;});}})[_0x3a0a('0x23')](respondWithFilteredResult(_0x27315d,_0x4a9744))['catch'](handleError(_0x27315d,null));};function char(_0x3d6b41){return _0x3a0a('0x5b')===typeof _0x3d6b41?String[_0x3a0a('0x5c')][_0x3a0a('0x21')](null,arguments):_0x3d6b41;}function needsEncapsulation(_0x2f6c41){return!!_0x2f6c41&&(_0x2f6c41[_0x3a0a('0x5d')]()[_0x3a0a('0x5e')](char(0xd))>=0x0||_0x2f6c41[_0x3a0a('0x5d')]()[_0x3a0a('0x5e')](char(0xa))>=0x0||_0x2f6c41[_0x3a0a('0x5d')]()['indexOf'](char(0x2c))>=0x0||_0x2f6c41[_0x3a0a('0x5d')]()[_0x3a0a('0x5e')](char(0x22))>=0x0);}function encapsulate(_0x3e94ec){var _0xc9fecd=char(0x22),_0x5b0819='\x5c'+char(0x22),_0x4955a=_0x3e94ec['toString']()[_0x3a0a('0x5f')](new RegExp(_0xc9fecd,'g'),_0x5b0819);return _0xc9fecd+_0x4955a+_0xc9fecd;}exports[_0x3a0a('0x60')]=function(_0x53cf90,_0x213cd6,_0x31cf8e){var _0x52ad38,_0x4155d3;var _0x483930={'where':{'ProjectId':_0x53cf90[_0x3a0a('0x43')]['id']}};if(_0x53cf90[_0x3a0a('0x30')]['startTime']){_0x483930[_0x3a0a('0x39')][_0x3a0a('0x61')]=JSON[_0x3a0a('0x62')](_0x53cf90['query'][_0x3a0a('0x63')]);}return db[_0x3a0a('0x55')][_0x3a0a('0x3f')](_0x483930)['then'](handleEntityNotFound(_0x213cd6,null))[_0x3a0a('0x23')](function(_0x2309ba){if(_0x2309ba){_0x52ad38=_0x2309ba;return db[_0x3a0a('0x64')][_0x3a0a('0x3f')]({'where':{'SessionId':{'$in':_[_0x3a0a('0x29')](_0x52ad38,'id')},'ProjectId':_0x53cf90[_0x3a0a('0x43')]['id']},'order':_0x3a0a('0x65')});}})[_0x3a0a('0x23')](handleEntityNotFound(_0x213cd6,null))['then'](function(_0x579656){if(_0x579656){_0x4155d3=_0x579656;var _0x2deef6={};for(var _0x68d787=0x0,_0x932f9=_0x4155d3[_0x3a0a('0x36')];_0x68d787<_0x932f9;_0x68d787++){if(!_0x2deef6[_0x3a0a('0x37')](_0x4155d3[_0x68d787][_0x3a0a('0x66')])){_0x2deef6[_0x4155d3[_0x68d787][_0x3a0a('0x66')]]=needsEncapsulation(_0x4155d3[_0x68d787][_0x3a0a('0x67')])?encapsulate(_0x4155d3[_0x68d787][_0x3a0a('0x67')]):_0x4155d3[_0x68d787][_0x3a0a('0x67')];}}var _0x7da6a0=[],_0x2bc924={};for(var _0x31ae21=0x0,_0x2475d4=_0x52ad38[_0x3a0a('0x36')];_0x31ae21<_0x2475d4;_0x31ae21++){_0x2bc924={'ProjectId':_0x53cf90[_0x3a0a('0x43')]['id'],'SessionId':_0x52ad38[_0x31ae21]['id'],'StartTime':moment(_0x52ad38[_0x31ae21][_0x3a0a('0x61')])['format']('YYYY-MM-DD\x20HH:mm:ss')};for(var _0x2bdd7a=0x0,_0x440093=_0x4155d3['length'];_0x2bdd7a<_0x440093;_0x2bdd7a++){if(_0x4155d3[_0x2bdd7a][_0x3a0a('0x68')]==_0x52ad38[_0x31ae21]['id']&&_0x2deef6[_0x3a0a('0x37')](_0x4155d3[_0x2bdd7a][_0x3a0a('0x66')])){_0x2bc924[_0x2deef6[_0x4155d3[_0x2bdd7a]['questionId']]]=_0x4155d3[_0x2bdd7a][_0x3a0a('0x69')];}}for(var _0x1bd9c6 in _0x2deef6){if(!_0x2bc924[_0x3a0a('0x37')](_0x2deef6[_0x1bd9c6])){_0x2bc924[_0x2deef6[_0x1bd9c6]]=null;}}_0x7da6a0['push'](_0x2bc924);}return _0x7da6a0;}})[_0x3a0a('0x23')](function(_0x4a2b06){if(!_[_0x3a0a('0x6a')](_0x4a2b06)){var _0x48d7a5=toCsv(_0x4a2b06);var _0x349832=Date[_0x3a0a('0x6b')]();fs['writeFileSync'](util[_0x3a0a('0x6c')]('/tmp/Jscripty_Project_%d_Summary_%s.csv',_0x53cf90[_0x3a0a('0x43')]['id'],_0x349832),_0x48d7a5);_0x213cd6[_0x3a0a('0x6d')](_0x3a0a('0x6e'),_0x3a0a('0x6f')+util[_0x3a0a('0x6c')](_0x3a0a('0x70'),_0x53cf90[_0x3a0a('0x43')]['id'],_0x349832));_0x213cd6[_0x3a0a('0x6d')](_0x3a0a('0x71'),_0x3a0a('0x72'));return _0x213cd6['download'](util[_0x3a0a('0x6c')](_0x3a0a('0x73'),_0x53cf90[_0x3a0a('0x43')]['id'],_0x349832));}else{return _0x213cd6['sendStatus'](0xcc);}})[_0x3a0a('0x41')](handleError(_0x213cd6,null));}; \ No newline at end of file diff --git a/server/api/jscriptyProject/jscriptyProject.model.js b/server/api/jscriptyProject/jscriptyProject.model.js index 2e0ca92..d1a48af 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 _0x861a=['bluebird','request-promise','path','../../config/environment','./jscriptyProject.attributes','exports','JscriptyProject','jscripty_projects','lodash','../../config/logger','api','moment'];(function(_0x501510,_0x61caa9){var _0x1e6ee5=function(_0x32845b){while(--_0x32845b){_0x501510['push'](_0x501510['shift']());}};_0x1e6ee5(++_0x61caa9);}(_0x861a,0x194));var _0xa861=function(_0x32c3d0,_0x2ca631){_0x32c3d0=_0x32c3d0-0x0;var _0x5c9b86=_0x861a[_0x32c3d0];return _0x5c9b86;};'use strict';var _=require(_0xa861('0x0'));var util=require('util');var logger=require(_0xa861('0x1'))(_0xa861('0x2'));var moment=require(_0xa861('0x3'));var BPromise=require(_0xa861('0x4'));var rp=require(_0xa861('0x5'));var fs=require('fs');var path=require(_0xa861('0x6'));var rimraf=require('rimraf');var config=require(_0xa861('0x7'));var attributes=require(_0xa861('0x8'));module[_0xa861('0x9')]=function(_0x1a9322,_0x247b78){return _0x1a9322['define'](_0xa861('0xa'),attributes,{'tableName':_0xa861('0xb'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x4f5d=['define','JscriptyProject','jscripty_projects','lodash','util','../../config/logger','api','moment','bluebird','path','rimraf','../../config/environment','./jscriptyProject.attributes','exports'];(function(_0x51d7c7,_0x59348e){var _0x3fbc36=function(_0x5d3140){while(--_0x5d3140){_0x51d7c7['push'](_0x51d7c7['shift']());}};_0x3fbc36(++_0x59348e);}(_0x4f5d,0x1d1));var _0xd4f5=function(_0x209941,_0x5c9988){_0x209941=_0x209941-0x0;var _0x1e8729=_0x4f5d[_0x209941];return _0x1e8729;};'use strict';var _=require(_0xd4f5('0x0'));var util=require(_0xd4f5('0x1'));var logger=require(_0xd4f5('0x2'))(_0xd4f5('0x3'));var moment=require(_0xd4f5('0x4'));var BPromise=require(_0xd4f5('0x5'));var rp=require('request-promise');var fs=require('fs');var path=require(_0xd4f5('0x6'));var rimraf=require(_0xd4f5('0x7'));var config=require(_0xd4f5('0x8'));var attributes=require(_0xd4f5('0x9'));module[_0xd4f5('0xa')]=function(_0x2c44bb,_0x121bfd){return _0x2c44bb[_0xd4f5('0xb')](_0xd4f5('0xc'),attributes,{'tableName':_0xd4f5('0xd'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/jscriptyProject/jscriptyProject.rpc.js b/server/api/jscriptyProject/jscriptyProject.rpc.js index f93f299..29075bc 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 _0xcb91=['stringify','error','code','message','catch','moment','bluebird','randomstring','ioredis','../../config/utils','../../config/logger','../../config/environment','jayson/promise','http','request','info','JscriptyProject,\x20%s,\x20%s','request\x20sent','debug','JscriptyProject,\x20%s,\x20%s,\x20%s'];(function(_0xada51,_0x2aa52e){var _0x143bc6=function(_0x222046){while(--_0x222046){_0xada51['push'](_0xada51['shift']());}};_0x143bc6(++_0x2aa52e);}(_0xcb91,0x1a9));var _0x1cb9=function(_0x465a0c,_0x19d4d5){_0x465a0c=_0x465a0c-0x0;var _0x1e202e=_0xcb91[_0x465a0c];return _0x1e202e;};'use strict';var _=require('lodash');var util=require('util');var moment=require(_0x1cb9('0x0'));var BPromise=require(_0x1cb9('0x1'));var rs=require(_0x1cb9('0x2'));var fs=require('fs');var Redis=require(_0x1cb9('0x3'));var db=require('../../mysqldb')['db'];var utils=require(_0x1cb9('0x4'));var logger=require(_0x1cb9('0x5'))('rpc');var config=require(_0x1cb9('0x6'));var jayson=require(_0x1cb9('0x7'));var client=jayson['client'][_0x1cb9('0x8')]({'port':0x232a});function respondWithRpcPromise(_0x3f7deb,_0x4ffe20,_0x38737d){return new BPromise(function(_0x12567c,_0x59d1be){return client[_0x1cb9('0x9')](_0x3f7deb,_0x38737d)['then'](function(_0x567139){logger[_0x1cb9('0xa')](_0x1cb9('0xb'),_0x4ffe20,_0x1cb9('0xc'));logger[_0x1cb9('0xd')](_0x1cb9('0xe'),_0x4ffe20,'request\x20sent',JSON[_0x1cb9('0xf')](_0x567139));if(_0x567139[_0x1cb9('0x10')]){if(_0x567139[_0x1cb9('0x10')][_0x1cb9('0x11')]===0x1f4){logger[_0x1cb9('0x10')]('JscriptyProject,\x20%s,\x20%s',_0x4ffe20,_0x567139['error']['message']);return _0x59d1be(_0x567139[_0x1cb9('0x10')][_0x1cb9('0x12')]);}logger[_0x1cb9('0x10')](_0x1cb9('0xb'),_0x4ffe20,_0x567139['error'][_0x1cb9('0x12')]);return _0x12567c(_0x567139[_0x1cb9('0x10')][_0x1cb9('0x12')]);}else{logger[_0x1cb9('0xa')](_0x1cb9('0xb'),_0x4ffe20,'request\x20sent');_0x12567c(_0x567139['result'][_0x1cb9('0x12')]);}})[_0x1cb9('0x13')](function(_0x3904b7){logger[_0x1cb9('0x10')](_0x1cb9('0xb'),_0x4ffe20,_0x3904b7);_0x59d1be(_0x3904b7);});});} \ No newline at end of file +var _0xaa88=['ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','http','then','info','request\x20sent','debug','JscriptyProject,\x20%s,\x20%s,\x20%s','error','JscriptyProject,\x20%s,\x20%s','message','result','catch','lodash','util','moment','bluebird'];(function(_0x25df55,_0x57ea51){var _0x4863e7=function(_0x3f5780){while(--_0x3f5780){_0x25df55['push'](_0x25df55['shift']());}};_0x4863e7(++_0x57ea51);}(_0xaa88,0x137));var _0x8aa8=function(_0x37a79c,_0x2b19f0){_0x37a79c=_0x37a79c-0x0;var _0x561d89=_0xaa88[_0x37a79c];return _0x561d89;};'use strict';var _=require(_0x8aa8('0x0'));var util=require(_0x8aa8('0x1'));var moment=require(_0x8aa8('0x2'));var BPromise=require(_0x8aa8('0x3'));var rs=require('randomstring');var fs=require('fs');var Redis=require(_0x8aa8('0x4'));var db=require(_0x8aa8('0x5'))['db'];var utils=require(_0x8aa8('0x6'));var logger=require(_0x8aa8('0x7'))(_0x8aa8('0x8'));var config=require(_0x8aa8('0x9'));var jayson=require('jayson/promise');var client=jayson['client'][_0x8aa8('0xa')]({'port':0x232a});function respondWithRpcPromise(_0x5264ff,_0x449d2d,_0x1ed84d){return new BPromise(function(_0x27c08d,_0x40826f){return client['request'](_0x5264ff,_0x1ed84d)[_0x8aa8('0xb')](function(_0x2d974c){logger[_0x8aa8('0xc')]('JscriptyProject,\x20%s,\x20%s',_0x449d2d,_0x8aa8('0xd'));logger[_0x8aa8('0xe')](_0x8aa8('0xf'),_0x449d2d,_0x8aa8('0xd'),JSON['stringify'](_0x2d974c));if(_0x2d974c[_0x8aa8('0x10')]){if(_0x2d974c[_0x8aa8('0x10')]['code']===0x1f4){logger[_0x8aa8('0x10')](_0x8aa8('0x11'),_0x449d2d,_0x2d974c[_0x8aa8('0x10')]['message']);return _0x40826f(_0x2d974c[_0x8aa8('0x10')][_0x8aa8('0x12')]);}logger[_0x8aa8('0x10')]('JscriptyProject,\x20%s,\x20%s',_0x449d2d,_0x2d974c[_0x8aa8('0x10')]['message']);return _0x27c08d(_0x2d974c['error'][_0x8aa8('0x12')]);}else{logger[_0x8aa8('0xc')](_0x8aa8('0x11'),_0x449d2d,_0x8aa8('0xd'));_0x27c08d(_0x2d974c[_0x8aa8('0x13')][_0x8aa8('0x12')]);}})[_0x8aa8('0x14')](function(_0xd59fb8){logger[_0x8aa8('0x10')]('JscriptyProject,\x20%s,\x20%s',_0x449d2d,_0xd59fb8);_0x40826f(_0xd59fb8);});});} \ No newline at end of file diff --git a/server/api/jscriptyQuestionReport/index.js b/server/api/jscriptyQuestionReport/index.js index e21f628..2211f97 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 _0xcc53=['/:id','show','create','put','destroy','exports','multer','util','connect-timeout','fs-extra','../../components/auth/service','isAuthenticated','index','/describe','describe','get'];(function(_0x2486b8,_0x3b819c){var _0x44b2be=function(_0x482386){while(--_0x482386){_0x2486b8['push'](_0x2486b8['shift']());}};_0x44b2be(++_0x3b819c);}(_0xcc53,0x86));var _0x3cc5=function(_0x3d28b5,_0x4350e5){_0x3d28b5=_0x3d28b5-0x0;var _0x172582=_0xcc53[_0x3d28b5];return _0x172582;};'use strict';var multer=require(_0x3cc5('0x0'));var util=require(_0x3cc5('0x1'));var path=require('path');var timeout=require(_0x3cc5('0x2'));var express=require('express');var router=express['Router']();var fs_extra=require(_0x3cc5('0x3'));var auth=require(_0x3cc5('0x4'));var interaction=require('../../components/interaction/service');var config=require('../../config/environment');var controller=require('./jscriptyQuestionReport.controller');router['get']('/',auth[_0x3cc5('0x5')](),controller[_0x3cc5('0x6')]);router['get'](_0x3cc5('0x7'),auth[_0x3cc5('0x5')](),controller[_0x3cc5('0x8')]);router[_0x3cc5('0x9')](_0x3cc5('0xa'),auth[_0x3cc5('0x5')](),controller[_0x3cc5('0xb')]);router['post']('/',auth[_0x3cc5('0x5')](),controller[_0x3cc5('0xc')]);router[_0x3cc5('0xd')](_0x3cc5('0xa'),auth['isAuthenticated'](),controller['update']);router['delete'](_0x3cc5('0xa'),auth[_0x3cc5('0x5')](),controller[_0x3cc5('0xe')]);module[_0x3cc5('0xf')]=router; \ No newline at end of file +var _0xfb98=['/describe','describe','isAuthenticated','post','put','/:id','update','delete','destroy','exports','multer','path','express','Router','../../components/interaction/service','./jscriptyQuestionReport.controller','get','index'];(function(_0x1757f2,_0x1b09fa){var _0x5e7212=function(_0x4f1794){while(--_0x4f1794){_0x1757f2['push'](_0x1757f2['shift']());}};_0x5e7212(++_0x1b09fa);}(_0xfb98,0x160));var _0x8fb9=function(_0x5ba4cc,_0x38c848){_0x5ba4cc=_0x5ba4cc-0x0;var _0x33654e=_0xfb98[_0x5ba4cc];return _0x33654e;};'use strict';var multer=require(_0x8fb9('0x0'));var util=require('util');var path=require(_0x8fb9('0x1'));var timeout=require('connect-timeout');var express=require(_0x8fb9('0x2'));var router=express[_0x8fb9('0x3')]();var fs_extra=require('fs-extra');var auth=require('../../components/auth/service');var interaction=require(_0x8fb9('0x4'));var config=require('../../config/environment');var controller=require(_0x8fb9('0x5'));router[_0x8fb9('0x6')]('/',auth['isAuthenticated'](),controller[_0x8fb9('0x7')]);router[_0x8fb9('0x6')](_0x8fb9('0x8'),auth['isAuthenticated'](),controller[_0x8fb9('0x9')]);router[_0x8fb9('0x6')]('/:id',auth[_0x8fb9('0xa')](),controller['show']);router[_0x8fb9('0xb')]('/',auth['isAuthenticated'](),controller['create']);router[_0x8fb9('0xc')](_0x8fb9('0xd'),auth['isAuthenticated'](),controller[_0x8fb9('0xe')]);router[_0x8fb9('0xf')]('/:id',auth['isAuthenticated'](),controller[_0x8fb9('0x10')]);module[_0x8fb9('0x11')]=router; \ No newline at end of file diff --git a/server/api/jscriptyQuestionReport/jscriptyQuestionReport.attributes.js b/server/api/jscriptyQuestionReport/jscriptyQuestionReport.attributes.js index 388be5b..ae1d613 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(_0x209941,_0x5c9988){var _0x1e8729=function(_0x51a9b8){while(--_0x51a9b8){_0x209941['push'](_0x209941['shift']());}};_0x1e8729(++_0x5c9988);}(_0x7a54,0x106));var _0x47a5=function(_0x37891e,_0x1cf512){_0x37891e=_0x37891e-0x0;var _0x2c0171=_0x7a54[_0x37891e];return _0x2c0171;};'use strict';var Sequelize=require(_0x47a5('0x0'));module[_0x47a5('0x1')]={'question':{'type':Sequelize[_0x47a5('0x2')]},'answer':{'type':Sequelize['TEXT'](_0x47a5('0x3'))},'membername':{'type':Sequelize[_0x47a5('0x4')]},'projectname':{'type':Sequelize['STRING']},'queue':{'type':Sequelize[_0x47a5('0x4')]},'uniqueid':{'type':Sequelize[_0x47a5('0x4')]},'calleridname':{'type':Sequelize[_0x47a5('0x4')]},'calleridnum':{'type':Sequelize[_0x47a5('0x4')]},'questionId':{'type':Sequelize[_0x47a5('0x4')]}}; \ No newline at end of file +var _0x7a54=['long','STRING','sequelize','exports','TEXT'];(function(_0x53ccf2,_0x13cb67){var _0x5a2964=function(_0x3b0514){while(--_0x3b0514){_0x53ccf2['push'](_0x53ccf2['shift']());}};_0x5a2964(++_0x13cb67);}(_0x7a54,0x106));var _0x47a5=function(_0x24bb3d,_0x2eb6a9){_0x24bb3d=_0x24bb3d-0x0;var _0x5cdfba=_0x7a54[_0x24bb3d];return _0x5cdfba;};'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 67d9224..f585409 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 _0xa18e=['fieldName','key','model','map','query','filters','intersection','attributes','fields','length','hasOwnProperty','nolimit','order','sort','where','pick','filter','merge','type','VIRTUAL','options','includeAll','include','findAll','rows','params','keys','catch','create','body','find','describe','rimraf','zip-dir','fast-json-patch','request-promise','moment','bluebird','util','sox','to-csv','ejs','lodash','crypto','desk.js','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','../../config/utils','../../config/environment','status','end','json','offset','undefined','limit','count','set','Content-Range','reject','save','update','then','destroy','sendStatus','error','name','send','index','JscriptyQuestionReport','rawAttributes'];(function(_0x65ea17,_0x395437){var _0x3c96a4=function(_0xef6940){while(--_0xef6940){_0x65ea17['push'](_0x65ea17['shift']());}};_0x3c96a4(++_0x395437);}(_0xa18e,0xb6));var _0xea18=function(_0x35da42,_0x5c2610){_0x35da42=_0x35da42-0x0;var _0x370035=_0xa18e[_0x35da42];return _0x370035;};'use strict';var emlformat=require('eml-format');var rimraf=require(_0xea18('0x0'));var zipdir=require(_0xea18('0x1'));var jsonpatch=require(_0xea18('0x2'));var rp=require(_0xea18('0x3'));var moment=require(_0xea18('0x4'));var BPromise=require(_0xea18('0x5'));var Mustache=require('mustache');var util=require(_0xea18('0x6'));var path=require('path');var sox=require(_0xea18('0x7'));var csv=require(_0xea18('0x8'));var ejs=require(_0xea18('0x9'));var fs=require('fs');var fs_extra=require('fs-extra');var _=require(_0xea18('0xa'));var squel=require('squel');var crypto=require(_0xea18('0xb'));var jsforce=require('jsforce');var deskjs=require(_0xea18('0xc'));var toCsv=require(_0xea18('0x8'));var querystring=require('querystring');var Papa=require(_0xea18('0xd'));var Redis=require(_0xea18('0xe'));var authService=require(_0xea18('0xf'));var qs=require(_0xea18('0x10'));var as=require(_0xea18('0x11'));var hardwareService=require(_0xea18('0x12'));var logger=require(_0xea18('0x13'))('api');var utils=require(_0xea18('0x14'));var config=require(_0xea18('0x15'));var licenseUtil=require('../../config/license/util');var db=require('../../mysqldb')['db'];function respondWithStatusCode(_0x780647,_0x1c25f4){_0x1c25f4=_0x1c25f4||0xcc;return function(_0x57452b){if(_0x57452b){return _0x780647['sendStatus'](_0x1c25f4);}return _0x780647[_0xea18('0x16')](_0x1c25f4)[_0xea18('0x17')]();};}function respondWithResult(_0x32c140,_0x9662a9){_0x9662a9=_0x9662a9||0xc8;return function(_0x56f40b){if(_0x56f40b){return _0x32c140[_0xea18('0x16')](_0x9662a9)[_0xea18('0x18')](_0x56f40b);}};}function respondWithFilteredResult(_0x20f0cf,_0x52d10a){return function(_0x52af2d){if(_0x52af2d){var _0xd63e=typeof _0x52d10a[_0xea18('0x19')]===_0xea18('0x1a')&&typeof _0x52d10a[_0xea18('0x1b')]===_0xea18('0x1a');var _0x477728=_0x52af2d[_0xea18('0x1c')];var _0x4e703d=_0xd63e?0x0:_0x52d10a[_0xea18('0x19')];var _0x46bc61=_0xd63e?_0x52af2d[_0xea18('0x1c')]:_0x52d10a[_0xea18('0x19')]+_0x52d10a['limit'];var _0x3c166c;if(_0x46bc61>=_0x477728){_0x46bc61=_0x477728;_0x3c166c=0xc8;}else{_0x3c166c=0xce;}_0x20f0cf[_0xea18('0x16')](_0x3c166c);return _0x20f0cf[_0xea18('0x1d')](_0xea18('0x1e'),_0x4e703d+'-'+_0x46bc61+'/'+_0x477728)[_0xea18('0x18')](_0x52af2d);}return null;};}function patchUpdates(_0x582a95){return function(_0x347281){try{jsonpatch['apply'](_0x347281,_0x582a95,!![]);}catch(_0x140471){return BPromise[_0xea18('0x1f')](_0x140471);}return _0x347281[_0xea18('0x20')]();};}function saveUpdates(_0x5ca6e0,_0x5ca7ca){return function(_0x318b7c){if(_0x318b7c){return _0x318b7c[_0xea18('0x21')](_0x5ca6e0)[_0xea18('0x22')](function(_0x16f8c4){return _0x16f8c4;});}return null;};}function removeEntity(_0x1a3e53,_0x161b74){return function(_0xe9f9b){if(_0xe9f9b){return _0xe9f9b[_0xea18('0x23')]()[_0xea18('0x22')](function(){_0x1a3e53['status'](0xcc)[_0xea18('0x17')]();});}};}function handleEntityNotFound(_0x249673,_0x37de9a){return function(_0x4b00f8){if(!_0x4b00f8){_0x249673[_0xea18('0x24')](0x194);}return _0x4b00f8;};}function handleError(_0x487277,_0x5e5d7d){_0x5e5d7d=_0x5e5d7d||0x1f4;return function(_0xf24be0){logger[_0xea18('0x25')](_0xf24be0['stack']);if(_0xf24be0[_0xea18('0x26')]){delete _0xf24be0[_0xea18('0x26')];}_0x487277['status'](_0x5e5d7d)[_0xea18('0x27')](_0xf24be0);};}exports[_0xea18('0x28')]=function(_0x3e05e9,_0xb7df54){var _0x51e4a4={},_0x17b9b4={},_0x1f29ed={'count':0x0,'rows':[]};var _0xb2c5dc=_['map'](db[_0xea18('0x29')][_0xea18('0x2a')],function(_0x353aea){return{'name':_0x353aea[_0xea18('0x2b')],'type':_0x353aea['type'][_0xea18('0x2c')]};});_0x17b9b4[_0xea18('0x2d')]=_[_0xea18('0x2e')](_0xb2c5dc,'name');_0x17b9b4[_0xea18('0x2f')]=_['keys'](_0x3e05e9[_0xea18('0x2f')]);_0x17b9b4[_0xea18('0x30')]=_[_0xea18('0x31')](_0x17b9b4[_0xea18('0x2d')],_0x17b9b4[_0xea18('0x2f')]);_0x51e4a4[_0xea18('0x32')]=_[_0xea18('0x31')](_0x17b9b4['model'],qs[_0xea18('0x33')](_0x3e05e9[_0xea18('0x2f')][_0xea18('0x33')]));_0x51e4a4[_0xea18('0x32')]=_0x51e4a4['attributes'][_0xea18('0x34')]?_0x51e4a4[_0xea18('0x32')]:_0x17b9b4[_0xea18('0x2d')];if(!_0x3e05e9['query'][_0xea18('0x35')](_0xea18('0x36'))){_0x51e4a4[_0xea18('0x1b')]=qs[_0xea18('0x1b')](_0x3e05e9[_0xea18('0x2f')][_0xea18('0x1b')]);_0x51e4a4[_0xea18('0x19')]=qs[_0xea18('0x19')](_0x3e05e9[_0xea18('0x2f')][_0xea18('0x19')]);}_0x51e4a4[_0xea18('0x37')]=qs[_0xea18('0x38')](_0x3e05e9[_0xea18('0x2f')][_0xea18('0x38')]);_0x51e4a4[_0xea18('0x39')]=qs['filters'](_[_0xea18('0x3a')](_0x3e05e9[_0xea18('0x2f')],_0x17b9b4[_0xea18('0x30')]),_0xb2c5dc);if(_0x3e05e9[_0xea18('0x2f')][_0xea18('0x3b')]){_0x51e4a4['where']=_[_0xea18('0x3c')](_0x51e4a4[_0xea18('0x39')],{'$or':_['map'](_0xb2c5dc,function(_0x214ca4){if(_0x214ca4[_0xea18('0x3d')]!==_0xea18('0x3e')){var _0x3a9a07={};_0x3a9a07[_0x214ca4['name']]={'$like':'%'+_0x3e05e9[_0xea18('0x2f')][_0xea18('0x3b')]+'%'};return _0x3a9a07;}})});}_0x51e4a4=_[_0xea18('0x3c')]({},_0x51e4a4,_0x3e05e9[_0xea18('0x3f')]);var _0x5d281a={'where':_0x51e4a4[_0xea18('0x39')]};return db[_0xea18('0x29')]['count'](_0x5d281a)[_0xea18('0x22')](function(_0x5654cb){_0x1f29ed[_0xea18('0x1c')]=_0x5654cb;if(_0x3e05e9[_0xea18('0x2f')][_0xea18('0x40')]){_0x51e4a4[_0xea18('0x41')]=[{'all':!![]}];}return db[_0xea18('0x29')][_0xea18('0x42')](_0x51e4a4);})[_0xea18('0x22')](function(_0x46e3a0){_0x1f29ed[_0xea18('0x43')]=_0x46e3a0;return _0x1f29ed;})['then'](respondWithFilteredResult(_0xb7df54,_0x51e4a4))['catch'](handleError(_0xb7df54,null));};exports['show']=function(_0xb89ee8,_0x20c686){var _0xdf0125={'raw':!![],'where':{'id':_0xb89ee8[_0xea18('0x44')]['id']}},_0x34c2ba={};_0x34c2ba[_0xea18('0x2d')]=_[_0xea18('0x45')](db[_0xea18('0x29')]['rawAttributes']);_0x34c2ba[_0xea18('0x2f')]=_['keys'](_0xb89ee8[_0xea18('0x2f')]);_0x34c2ba['filters']=_[_0xea18('0x31')](_0x34c2ba[_0xea18('0x2d')],_0x34c2ba['query']);_0xdf0125[_0xea18('0x32')]=_[_0xea18('0x31')](_0x34c2ba[_0xea18('0x2d')],qs['fields'](_0xb89ee8[_0xea18('0x2f')]['fields']));_0xdf0125[_0xea18('0x32')]=_0xdf0125['attributes'][_0xea18('0x34')]?_0xdf0125['attributes']:_0x34c2ba[_0xea18('0x2d')];if(_0xb89ee8[_0xea18('0x2f')][_0xea18('0x40')]){_0xdf0125[_0xea18('0x41')]=[{'all':!![]}];}_0xdf0125=_[_0xea18('0x3c')]({},_0xdf0125,_0xb89ee8[_0xea18('0x3f')]);return db['JscriptyQuestionReport']['find'](_0xdf0125)[_0xea18('0x22')](handleEntityNotFound(_0x20c686,null))[_0xea18('0x22')](respondWithResult(_0x20c686,null))[_0xea18('0x46')](handleError(_0x20c686,null));};exports[_0xea18('0x47')]=function(_0x47a437,_0x132405){return db['JscriptyQuestionReport'][_0xea18('0x47')](_0x47a437[_0xea18('0x48')],{})['then'](respondWithResult(_0x132405,0xc9))[_0xea18('0x46')](handleError(_0x132405,null));};exports[_0xea18('0x21')]=function(_0x34ed90,_0x1102bb){if(_0x34ed90['body']['id']){delete _0x34ed90[_0xea18('0x48')]['id'];}return db['JscriptyQuestionReport'][_0xea18('0x49')]({'where':{'id':_0x34ed90[_0xea18('0x44')]['id']}})[_0xea18('0x22')](handleEntityNotFound(_0x1102bb,null))[_0xea18('0x22')](saveUpdates(_0x34ed90[_0xea18('0x48')],null))['then'](respondWithResult(_0x1102bb,null))[_0xea18('0x46')](handleError(_0x1102bb,null));};exports[_0xea18('0x23')]=function(_0x2e6cd1,_0x3c3527){return db['JscriptyQuestionReport']['find']({'where':{'id':_0x2e6cd1[_0xea18('0x44')]['id']}})[_0xea18('0x22')](handleEntityNotFound(_0x3c3527,null))['then'](removeEntity(_0x3c3527,null))[_0xea18('0x46')](handleError(_0x3c3527,null));};exports['describe']=function(_0x2b526a,_0x45d8f9){return db[_0xea18('0x29')][_0xea18('0x4a')]()[_0xea18('0x22')](respondWithResult(_0x45d8f9,null))[_0xea18('0x46')](handleError(_0x45d8f9,null));}; \ No newline at end of file +var _0xa3d2=['error','stack','name','send','index','JscriptyQuestionReport','rawAttributes','fieldName','type','key','map','query','filters','intersection','attributes','model','fields','length','hasOwnProperty','nolimit','order','sort','where','pick','filter','merge','options','includeAll','include','rows','catch','show','params','keys','find','create','body','describe','eml-format','rimraf','request-promise','moment','bluebird','mustache','util','sox','to-csv','ejs','fs-extra','lodash','crypto','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','end','json','offset','undefined','limit','count','set','Content-Range','apply','reject','update','then','destroy','status'];(function(_0x122ef9,_0x451d2a){var _0x42fba0=function(_0x17c9d3){while(--_0x17c9d3){_0x122ef9['push'](_0x122ef9['shift']());}};_0x42fba0(++_0x451d2a);}(_0xa3d2,0xc0));var _0x2a3d=function(_0x2962b4,_0x4b0786){_0x2962b4=_0x2962b4-0x0;var _0x411b7d=_0xa3d2[_0x2962b4];return _0x411b7d;};'use strict';var emlformat=require(_0x2a3d('0x0'));var rimraf=require(_0x2a3d('0x1'));var zipdir=require('zip-dir');var jsonpatch=require('fast-json-patch');var rp=require(_0x2a3d('0x2'));var moment=require(_0x2a3d('0x3'));var BPromise=require(_0x2a3d('0x4'));var Mustache=require(_0x2a3d('0x5'));var util=require(_0x2a3d('0x6'));var path=require('path');var sox=require(_0x2a3d('0x7'));var csv=require(_0x2a3d('0x8'));var ejs=require(_0x2a3d('0x9'));var fs=require('fs');var fs_extra=require(_0x2a3d('0xa'));var _=require(_0x2a3d('0xb'));var squel=require('squel');var crypto=require(_0x2a3d('0xc'));var jsforce=require(_0x2a3d('0xd'));var deskjs=require(_0x2a3d('0xe'));var toCsv=require(_0x2a3d('0x8'));var querystring=require('querystring');var Papa=require(_0x2a3d('0xf'));var Redis=require(_0x2a3d('0x10'));var authService=require(_0x2a3d('0x11'));var qs=require(_0x2a3d('0x12'));var as=require(_0x2a3d('0x13'));var hardwareService=require(_0x2a3d('0x14'));var logger=require('../../config/logger')(_0x2a3d('0x15'));var utils=require(_0x2a3d('0x16'));var config=require(_0x2a3d('0x17'));var licenseUtil=require(_0x2a3d('0x18'));var db=require('../../mysqldb')['db'];function respondWithStatusCode(_0x29c9de,_0x1ac1e7){_0x1ac1e7=_0x1ac1e7||0xcc;return function(_0x240e44){if(_0x240e44){return _0x29c9de['sendStatus'](_0x1ac1e7);}return _0x29c9de['status'](_0x1ac1e7)[_0x2a3d('0x19')]();};}function respondWithResult(_0xf0858e,_0x506160){_0x506160=_0x506160||0xc8;return function(_0xc65383){if(_0xc65383){return _0xf0858e['status'](_0x506160)[_0x2a3d('0x1a')](_0xc65383);}};}function respondWithFilteredResult(_0x1bcf11,_0xca81b6){return function(_0x129a2d){if(_0x129a2d){var _0x52d252=typeof _0xca81b6[_0x2a3d('0x1b')]===_0x2a3d('0x1c')&&typeof _0xca81b6[_0x2a3d('0x1d')]===_0x2a3d('0x1c');var _0x16f615=_0x129a2d[_0x2a3d('0x1e')];var _0x194be7=_0x52d252?0x0:_0xca81b6[_0x2a3d('0x1b')];var _0x57325d=_0x52d252?_0x129a2d[_0x2a3d('0x1e')]:_0xca81b6['offset']+_0xca81b6[_0x2a3d('0x1d')];var _0x1197df;if(_0x57325d>=_0x16f615){_0x57325d=_0x16f615;_0x1197df=0xc8;}else{_0x1197df=0xce;}_0x1bcf11['status'](_0x1197df);return _0x1bcf11[_0x2a3d('0x1f')](_0x2a3d('0x20'),_0x194be7+'-'+_0x57325d+'/'+_0x16f615)['json'](_0x129a2d);}return null;};}function patchUpdates(_0x44ecfb){return function(_0x15c229){try{jsonpatch[_0x2a3d('0x21')](_0x15c229,_0x44ecfb,!![]);}catch(_0x38cd57){return BPromise[_0x2a3d('0x22')](_0x38cd57);}return _0x15c229['save']();};}function saveUpdates(_0x5f12ba,_0x53140d){return function(_0x3a5911){if(_0x3a5911){return _0x3a5911[_0x2a3d('0x23')](_0x5f12ba)[_0x2a3d('0x24')](function(_0x12a114){return _0x12a114;});}return null;};}function removeEntity(_0x4e6dd5,_0x1ba721){return function(_0x1b7c59){if(_0x1b7c59){return _0x1b7c59[_0x2a3d('0x25')]()[_0x2a3d('0x24')](function(){_0x4e6dd5[_0x2a3d('0x26')](0xcc)[_0x2a3d('0x19')]();});}};}function handleEntityNotFound(_0x8954a3,_0x34cb28){return function(_0x270c9e){if(!_0x270c9e){_0x8954a3['sendStatus'](0x194);}return _0x270c9e;};}function handleError(_0x81d31f,_0x297c1e){_0x297c1e=_0x297c1e||0x1f4;return function(_0x4efdd5){logger[_0x2a3d('0x27')](_0x4efdd5[_0x2a3d('0x28')]);if(_0x4efdd5[_0x2a3d('0x29')]){delete _0x4efdd5[_0x2a3d('0x29')];}_0x81d31f[_0x2a3d('0x26')](_0x297c1e)[_0x2a3d('0x2a')](_0x4efdd5);};}exports[_0x2a3d('0x2b')]=function(_0x591f64,_0x422e6d){var _0xcd46ed={},_0x357b02={},_0x451616={'count':0x0,'rows':[]};var _0x1fd4a1=_['map'](db[_0x2a3d('0x2c')][_0x2a3d('0x2d')],function(_0x3a4c64){return{'name':_0x3a4c64[_0x2a3d('0x2e')],'type':_0x3a4c64[_0x2a3d('0x2f')][_0x2a3d('0x30')]};});_0x357b02['model']=_[_0x2a3d('0x31')](_0x1fd4a1,_0x2a3d('0x29'));_0x357b02[_0x2a3d('0x32')]=_['keys'](_0x591f64[_0x2a3d('0x32')]);_0x357b02[_0x2a3d('0x33')]=_[_0x2a3d('0x34')](_0x357b02['model'],_0x357b02[_0x2a3d('0x32')]);_0xcd46ed[_0x2a3d('0x35')]=_['intersection'](_0x357b02[_0x2a3d('0x36')],qs[_0x2a3d('0x37')](_0x591f64['query'][_0x2a3d('0x37')]));_0xcd46ed[_0x2a3d('0x35')]=_0xcd46ed['attributes'][_0x2a3d('0x38')]?_0xcd46ed[_0x2a3d('0x35')]:_0x357b02['model'];if(!_0x591f64['query'][_0x2a3d('0x39')](_0x2a3d('0x3a'))){_0xcd46ed[_0x2a3d('0x1d')]=qs[_0x2a3d('0x1d')](_0x591f64[_0x2a3d('0x32')][_0x2a3d('0x1d')]);_0xcd46ed[_0x2a3d('0x1b')]=qs[_0x2a3d('0x1b')](_0x591f64[_0x2a3d('0x32')][_0x2a3d('0x1b')]);}_0xcd46ed[_0x2a3d('0x3b')]=qs[_0x2a3d('0x3c')](_0x591f64[_0x2a3d('0x32')][_0x2a3d('0x3c')]);_0xcd46ed[_0x2a3d('0x3d')]=qs[_0x2a3d('0x33')](_[_0x2a3d('0x3e')](_0x591f64[_0x2a3d('0x32')],_0x357b02[_0x2a3d('0x33')]),_0x1fd4a1);if(_0x591f64[_0x2a3d('0x32')][_0x2a3d('0x3f')]){_0xcd46ed[_0x2a3d('0x3d')]=_[_0x2a3d('0x40')](_0xcd46ed[_0x2a3d('0x3d')],{'$or':_[_0x2a3d('0x31')](_0x1fd4a1,function(_0x34ec59){if(_0x34ec59[_0x2a3d('0x2f')]!=='VIRTUAL'){var _0x4ec542={};_0x4ec542[_0x34ec59[_0x2a3d('0x29')]]={'$like':'%'+_0x591f64[_0x2a3d('0x32')]['filter']+'%'};return _0x4ec542;}})});}_0xcd46ed=_[_0x2a3d('0x40')]({},_0xcd46ed,_0x591f64[_0x2a3d('0x41')]);var _0x13a4df={'where':_0xcd46ed[_0x2a3d('0x3d')]};return db[_0x2a3d('0x2c')][_0x2a3d('0x1e')](_0x13a4df)[_0x2a3d('0x24')](function(_0x84f856){_0x451616['count']=_0x84f856;if(_0x591f64[_0x2a3d('0x32')][_0x2a3d('0x42')]){_0xcd46ed[_0x2a3d('0x43')]=[{'all':!![]}];}return db[_0x2a3d('0x2c')]['findAll'](_0xcd46ed);})[_0x2a3d('0x24')](function(_0x57e3ae){_0x451616[_0x2a3d('0x44')]=_0x57e3ae;return _0x451616;})[_0x2a3d('0x24')](respondWithFilteredResult(_0x422e6d,_0xcd46ed))[_0x2a3d('0x45')](handleError(_0x422e6d,null));};exports[_0x2a3d('0x46')]=function(_0x538434,_0x314bca){var _0xd5b4d9={'raw':!![],'where':{'id':_0x538434[_0x2a3d('0x47')]['id']}},_0x3501b4={};_0x3501b4['model']=_[_0x2a3d('0x48')](db['JscriptyQuestionReport'][_0x2a3d('0x2d')]);_0x3501b4[_0x2a3d('0x32')]=_[_0x2a3d('0x48')](_0x538434[_0x2a3d('0x32')]);_0x3501b4[_0x2a3d('0x33')]=_[_0x2a3d('0x34')](_0x3501b4[_0x2a3d('0x36')],_0x3501b4[_0x2a3d('0x32')]);_0xd5b4d9[_0x2a3d('0x35')]=_['intersection'](_0x3501b4['model'],qs[_0x2a3d('0x37')](_0x538434[_0x2a3d('0x32')][_0x2a3d('0x37')]));_0xd5b4d9['attributes']=_0xd5b4d9[_0x2a3d('0x35')][_0x2a3d('0x38')]?_0xd5b4d9[_0x2a3d('0x35')]:_0x3501b4['model'];if(_0x538434[_0x2a3d('0x32')][_0x2a3d('0x42')]){_0xd5b4d9[_0x2a3d('0x43')]=[{'all':!![]}];}_0xd5b4d9=_[_0x2a3d('0x40')]({},_0xd5b4d9,_0x538434['options']);return db[_0x2a3d('0x2c')][_0x2a3d('0x49')](_0xd5b4d9)['then'](handleEntityNotFound(_0x314bca,null))[_0x2a3d('0x24')](respondWithResult(_0x314bca,null))[_0x2a3d('0x45')](handleError(_0x314bca,null));};exports[_0x2a3d('0x4a')]=function(_0x4eb93c,_0x11ebe5){return db[_0x2a3d('0x2c')]['create'](_0x4eb93c[_0x2a3d('0x4b')],{})[_0x2a3d('0x24')](respondWithResult(_0x11ebe5,0xc9))[_0x2a3d('0x45')](handleError(_0x11ebe5,null));};exports[_0x2a3d('0x23')]=function(_0x40538a,_0x2d35a3){if(_0x40538a[_0x2a3d('0x4b')]['id']){delete _0x40538a[_0x2a3d('0x4b')]['id'];}return db[_0x2a3d('0x2c')][_0x2a3d('0x49')]({'where':{'id':_0x40538a[_0x2a3d('0x47')]['id']}})['then'](handleEntityNotFound(_0x2d35a3,null))[_0x2a3d('0x24')](saveUpdates(_0x40538a[_0x2a3d('0x4b')],null))[_0x2a3d('0x24')](respondWithResult(_0x2d35a3,null))[_0x2a3d('0x45')](handleError(_0x2d35a3,null));};exports[_0x2a3d('0x25')]=function(_0x9ee9e7,_0x4002a0){return db[_0x2a3d('0x2c')]['find']({'where':{'id':_0x9ee9e7[_0x2a3d('0x47')]['id']}})[_0x2a3d('0x24')](handleEntityNotFound(_0x4002a0,null))[_0x2a3d('0x24')](removeEntity(_0x4002a0,null))[_0x2a3d('0x45')](handleError(_0x4002a0,null));};exports[_0x2a3d('0x4c')]=function(_0x43303a,_0x3c20a0){return db[_0x2a3d('0x2c')][_0x2a3d('0x4c')]()[_0x2a3d('0x24')](respondWithResult(_0x3c20a0,null))[_0x2a3d('0x45')](handleError(_0x3c20a0,null));}; \ No newline at end of file diff --git a/server/api/jscriptyQuestionReport/jscriptyQuestionReport.model.js b/server/api/jscriptyQuestionReport/jscriptyQuestionReport.model.js index 41d0e60..cf8d9b1 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 _0xfc06=['lodash','../../config/logger','api','moment','bluebird','request-promise','path','rimraf','../../config/environment','exports','define','JscriptyQuestionReport','report_jscripty_questions'];(function(_0x967959,_0x53c5c1){var _0x5c4489=function(_0x1ae5c6){while(--_0x1ae5c6){_0x967959['push'](_0x967959['shift']());}};_0x5c4489(++_0x53c5c1);}(_0xfc06,0x152));var _0x6fc0=function(_0x28d6c2,_0x301129){_0x28d6c2=_0x28d6c2-0x0;var _0x501f86=_0xfc06[_0x28d6c2];return _0x501f86;};'use strict';var _=require(_0x6fc0('0x0'));var util=require('util');var logger=require(_0x6fc0('0x1'))(_0x6fc0('0x2'));var moment=require(_0x6fc0('0x3'));var BPromise=require(_0x6fc0('0x4'));var rp=require(_0x6fc0('0x5'));var fs=require('fs');var path=require(_0x6fc0('0x6'));var rimraf=require(_0x6fc0('0x7'));var config=require(_0x6fc0('0x8'));var attributes=require('./jscriptyQuestionReport.attributes');module[_0x6fc0('0x9')]=function(_0x18352a,_0x4ebe35){return _0x18352a[_0x6fc0('0xa')](_0x6fc0('0xb'),attributes,{'tableName':_0x6fc0('0xc'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0xc2fc=['lodash','util','api','moment','bluebird','request-promise','path','rimraf','../../config/environment','./jscriptyQuestionReport.attributes','define','JscriptyQuestionReport','report_jscripty_questions'];(function(_0xe9c2a5,_0x4629d6){var _0x5119a5=function(_0x21f439){while(--_0x21f439){_0xe9c2a5['push'](_0xe9c2a5['shift']());}};_0x5119a5(++_0x4629d6);}(_0xc2fc,0x138));var _0xcc2f=function(_0x28cea8,_0x18ca20){_0x28cea8=_0x28cea8-0x0;var _0x849a1e=_0xc2fc[_0x28cea8];return _0x849a1e;};'use strict';var _=require(_0xcc2f('0x0'));var util=require(_0xcc2f('0x1'));var logger=require('../../config/logger')(_0xcc2f('0x2'));var moment=require(_0xcc2f('0x3'));var BPromise=require(_0xcc2f('0x4'));var rp=require(_0xcc2f('0x5'));var fs=require('fs');var path=require(_0xcc2f('0x6'));var rimraf=require(_0xcc2f('0x7'));var config=require(_0xcc2f('0x8'));var attributes=require(_0xcc2f('0x9'));module['exports']=function(_0x27eb30,_0x3a8f2a){return _0x27eb30[_0xcc2f('0xa')](_0xcc2f('0xb'),attributes,{'tableName':_0xcc2f('0xc'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/jscriptyQuestionReport/jscriptyQuestionReport.rpc.js b/server/api/jscriptyQuestionReport/jscriptyQuestionReport.rpc.js index ac64883..1858fac 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 _0x1595=['../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','client','request','then','info','JscriptyQuestionReport,\x20%s,\x20%s','debug','request\x20sent','error','code','message','result','moment','randomstring','ioredis'];(function(_0x2bdd4d,_0x2a4b42){var _0x2f723f=function(_0x142498){while(--_0x142498){_0x2bdd4d['push'](_0x2bdd4d['shift']());}};_0x2f723f(++_0x2a4b42);}(_0x1595,0x165));var _0x5159=function(_0x1c8113,_0x3c166f){_0x1c8113=_0x1c8113-0x0;var _0x5cfd4e=_0x1595[_0x1c8113];return _0x5cfd4e;};'use strict';var _=require('lodash');var util=require('util');var moment=require(_0x5159('0x0'));var BPromise=require('bluebird');var rs=require(_0x5159('0x1'));var fs=require('fs');var Redis=require(_0x5159('0x2'));var db=require(_0x5159('0x3'))['db'];var utils=require(_0x5159('0x4'));var logger=require(_0x5159('0x5'))(_0x5159('0x6'));var config=require(_0x5159('0x7'));var jayson=require(_0x5159('0x8'));var client=jayson[_0x5159('0x9')]['http']({'port':0x232a});function respondWithRpcPromise(_0x15450a,_0x43d60a,_0x50b70e){return new BPromise(function(_0x58603f,_0xc824af){return client[_0x5159('0xa')](_0x15450a,_0x50b70e)[_0x5159('0xb')](function(_0x25b0d4){logger[_0x5159('0xc')](_0x5159('0xd'),_0x43d60a,'request\x20sent');logger[_0x5159('0xe')]('JscriptyQuestionReport,\x20%s,\x20%s,\x20%s',_0x43d60a,_0x5159('0xf'),JSON['stringify'](_0x25b0d4));if(_0x25b0d4[_0x5159('0x10')]){if(_0x25b0d4[_0x5159('0x10')][_0x5159('0x11')]===0x1f4){logger[_0x5159('0x10')](_0x5159('0xd'),_0x43d60a,_0x25b0d4[_0x5159('0x10')][_0x5159('0x12')]);return _0xc824af(_0x25b0d4[_0x5159('0x10')][_0x5159('0x12')]);}logger['error'](_0x5159('0xd'),_0x43d60a,_0x25b0d4[_0x5159('0x10')][_0x5159('0x12')]);return _0x58603f(_0x25b0d4['error'][_0x5159('0x12')]);}else{logger[_0x5159('0xc')]('JscriptyQuestionReport,\x20%s,\x20%s',_0x43d60a,_0x5159('0xf'));_0x58603f(_0x25b0d4[_0x5159('0x13')]['message']);}})['catch'](function(_0x4bd706){logger[_0x5159('0x10')]('JscriptyQuestionReport,\x20%s,\x20%s',_0x43d60a,_0x4bd706);_0xc824af(_0x4bd706);});});} \ No newline at end of file +var _0xd8af=['code','message','info','result','util','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','jayson/promise','http','request','then','JscriptyQuestionReport,\x20%s,\x20%s','request\x20sent','debug','JscriptyQuestionReport,\x20%s,\x20%s,\x20%s','stringify','error'];(function(_0x311c74,_0x229368){var _0x1777d4=function(_0x4d38aa){while(--_0x4d38aa){_0x311c74['push'](_0x311c74['shift']());}};_0x1777d4(++_0x229368);}(_0xd8af,0x1a8));var _0xfd8a=function(_0xc62a90,_0x7ea2f1){_0xc62a90=_0xc62a90-0x0;var _0x53c01b=_0xd8af[_0xc62a90];return _0x53c01b;};'use strict';var _=require('lodash');var util=require(_0xfd8a('0x0'));var moment=require('moment');var BPromise=require(_0xfd8a('0x1'));var rs=require(_0xfd8a('0x2'));var fs=require('fs');var Redis=require(_0xfd8a('0x3'));var db=require(_0xfd8a('0x4'))['db'];var utils=require(_0xfd8a('0x5'));var logger=require(_0xfd8a('0x6'))('rpc');var config=require('../../config/environment');var jayson=require(_0xfd8a('0x7'));var client=jayson['client'][_0xfd8a('0x8')]({'port':0x232a});function respondWithRpcPromise(_0x32d137,_0x2d987a,_0x1984a0){return new BPromise(function(_0x1036ca,_0x4641b5){return client[_0xfd8a('0x9')](_0x32d137,_0x1984a0)[_0xfd8a('0xa')](function(_0x2f7204){logger['info'](_0xfd8a('0xb'),_0x2d987a,_0xfd8a('0xc'));logger[_0xfd8a('0xd')](_0xfd8a('0xe'),_0x2d987a,_0xfd8a('0xc'),JSON[_0xfd8a('0xf')](_0x2f7204));if(_0x2f7204[_0xfd8a('0x10')]){if(_0x2f7204[_0xfd8a('0x10')][_0xfd8a('0x11')]===0x1f4){logger['error']('JscriptyQuestionReport,\x20%s,\x20%s',_0x2d987a,_0x2f7204[_0xfd8a('0x10')]['message']);return _0x4641b5(_0x2f7204[_0xfd8a('0x10')][_0xfd8a('0x12')]);}logger[_0xfd8a('0x10')](_0xfd8a('0xb'),_0x2d987a,_0x2f7204['error'][_0xfd8a('0x12')]);return _0x1036ca(_0x2f7204['error'][_0xfd8a('0x12')]);}else{logger[_0xfd8a('0x13')](_0xfd8a('0xb'),_0x2d987a,_0xfd8a('0xc'));_0x1036ca(_0x2f7204[_0xfd8a('0x14')][_0xfd8a('0x12')]);}})['catch'](function(_0x5dbf5d){logger['error'](_0xfd8a('0xb'),_0x2d987a,_0x5dbf5d);_0x4641b5(_0x5dbf5d);});});} \ No newline at end of file diff --git a/server/api/jscriptySessionReport/index.js b/server/api/jscriptySessionReport/index.js index 567cebc..7b1fd6a 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 _0x6d7b=['post','update','delete','destroy','exports','multer','path','express','Router','../../components/interaction/service','../../config/environment','./jscriptySessionReport.controller','get','index','isAuthenticated','describe','/:id','show','/:id/questions','getQuestions'];(function(_0x322522,_0x4db288){var _0x293bcf=function(_0xf108b8){while(--_0xf108b8){_0x322522['push'](_0x322522['shift']());}};_0x293bcf(++_0x4db288);}(_0x6d7b,0xe1));var _0xb6d7=function(_0x2ed88f,_0x5bc5ae){_0x2ed88f=_0x2ed88f-0x0;var _0x17ca96=_0x6d7b[_0x2ed88f];return _0x17ca96;};'use strict';var multer=require(_0xb6d7('0x0'));var util=require('util');var path=require(_0xb6d7('0x1'));var timeout=require('connect-timeout');var express=require(_0xb6d7('0x2'));var router=express[_0xb6d7('0x3')]();var fs_extra=require('fs-extra');var auth=require('../../components/auth/service');var interaction=require(_0xb6d7('0x4'));var config=require(_0xb6d7('0x5'));var controller=require(_0xb6d7('0x6'));router[_0xb6d7('0x7')]('/',auth['isAuthenticated'](),controller[_0xb6d7('0x8')]);router[_0xb6d7('0x7')]('/describe',auth[_0xb6d7('0x9')](),controller[_0xb6d7('0xa')]);router[_0xb6d7('0x7')](_0xb6d7('0xb'),auth['isAuthenticated'](),controller[_0xb6d7('0xc')]);router[_0xb6d7('0x7')](_0xb6d7('0xd'),auth[_0xb6d7('0x9')](),controller[_0xb6d7('0xe')]);router[_0xb6d7('0xf')]('/',auth[_0xb6d7('0x9')](),controller['create']);router['put'](_0xb6d7('0xb'),auth[_0xb6d7('0x9')](),controller[_0xb6d7('0x10')]);router[_0xb6d7('0x11')](_0xb6d7('0xb'),auth['isAuthenticated'](),controller[_0xb6d7('0x12')]);module[_0xb6d7('0x13')]=router; \ No newline at end of file +var _0x0b3d=['connect-timeout','express','Router','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','./jscriptySessionReport.controller','get','index','isAuthenticated','describe','show','getQuestions','post','put','/:id','update','delete','exports','util'];(function(_0x2f9668,_0x5f5c0a){var _0x52d870=function(_0xe2e7ab){while(--_0xe2e7ab){_0x2f9668['push'](_0x2f9668['shift']());}};_0x52d870(++_0x5f5c0a);}(_0x0b3d,0x1b8));var _0xd0b3=function(_0x28caf4,_0x797e55){_0x28caf4=_0x28caf4-0x0;var _0x503f93=_0x0b3d[_0x28caf4];return _0x503f93;};'use strict';var multer=require('multer');var util=require(_0xd0b3('0x0'));var path=require('path');var timeout=require(_0xd0b3('0x1'));var express=require(_0xd0b3('0x2'));var router=express[_0xd0b3('0x3')]();var fs_extra=require(_0xd0b3('0x4'));var auth=require(_0xd0b3('0x5'));var interaction=require(_0xd0b3('0x6'));var config=require(_0xd0b3('0x7'));var controller=require(_0xd0b3('0x8'));router[_0xd0b3('0x9')]('/',auth['isAuthenticated'](),controller[_0xd0b3('0xa')]);router['get']('/describe',auth[_0xd0b3('0xb')](),controller[_0xd0b3('0xc')]);router['get']('/:id',auth['isAuthenticated'](),controller[_0xd0b3('0xd')]);router[_0xd0b3('0x9')]('/:id/questions',auth['isAuthenticated'](),controller[_0xd0b3('0xe')]);router[_0xd0b3('0xf')]('/',auth['isAuthenticated'](),controller['create']);router[_0xd0b3('0x10')](_0xd0b3('0x11'),auth[_0xd0b3('0xb')](),controller[_0xd0b3('0x12')]);router[_0xd0b3('0x13')](_0xd0b3('0x11'),auth['isAuthenticated'](),controller['destroy']);module[_0xd0b3('0x14')]=router; \ No newline at end of file diff --git a/server/api/jscriptySessionReport/jscriptySessionReport.attributes.js b/server/api/jscriptySessionReport/jscriptySessionReport.attributes.js index 2fe4cc4..b648376 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 _0xe033=['STRING','moment','sequelize','exports','DATE','setDataValue','endtime','YYYY-MM-DD\x20HH:mm:ss'];(function(_0x18120d,_0x47a355){var _0x5b3b8f=function(_0x12c822){while(--_0x12c822){_0x18120d['push'](_0x18120d['shift']());}};_0x5b3b8f(++_0x47a355);}(_0xe033,0x161));var _0x3e03=function(_0x59de10,_0xfedd02){_0x59de10=_0x59de10-0x0;var _0xbcf642=_0xe033[_0x59de10];return _0xbcf642;};'use strict';var moment=require(_0x3e03('0x0'));var Sequelize=require(_0x3e03('0x1'));module[_0x3e03('0x2')]={'starttime':{'type':Sequelize[_0x3e03('0x3')],'set':function(_0x48f925){this[_0x3e03('0x4')]('starttime',_0x48f925);this[_0x3e03('0x4')](_0x3e03('0x5'),moment()['format'](_0x3e03('0x6')));}},'endtime':{'type':Sequelize[_0x3e03('0x3')]},'membername':{'type':Sequelize[_0x3e03('0x7')]},'projectname':{'type':Sequelize[_0x3e03('0x7')]},'queue':{'type':Sequelize[_0x3e03('0x7')]},'uniqueid':{'type':Sequelize[_0x3e03('0x7')]},'calleridname':{'type':Sequelize[_0x3e03('0x7')]},'calleridnum':{'type':Sequelize['STRING']},'completed':{'type':Sequelize['BOOLEAN'],'defaultValue':![]}}; \ No newline at end of file +var _0xff2b=['STRING','BOOLEAN','moment','sequelize','exports','DATE','setDataValue','starttime','endtime','YYYY-MM-DD\x20HH:mm:ss'];(function(_0x46ee56,_0x5ee126){var _0x5cf569=function(_0x32cf25){while(--_0x32cf25){_0x46ee56['push'](_0x46ee56['shift']());}};_0x5cf569(++_0x5ee126);}(_0xff2b,0x66));var _0xbff2=function(_0x29b367,_0x64800b){_0x29b367=_0x29b367-0x0;var _0x574151=_0xff2b[_0x29b367];return _0x574151;};'use strict';var moment=require(_0xbff2('0x0'));var Sequelize=require(_0xbff2('0x1'));module[_0xbff2('0x2')]={'starttime':{'type':Sequelize[_0xbff2('0x3')],'set':function(_0x26f380){this[_0xbff2('0x4')](_0xbff2('0x5'),_0x26f380);this['setDataValue'](_0xbff2('0x6'),moment()['format'](_0xbff2('0x7')));}},'endtime':{'type':Sequelize[_0xbff2('0x3')]},'membername':{'type':Sequelize['STRING']},'projectname':{'type':Sequelize[_0xbff2('0x8')]},'queue':{'type':Sequelize[_0xbff2('0x8')]},'uniqueid':{'type':Sequelize['STRING']},'calleridname':{'type':Sequelize[_0xbff2('0x8')]},'calleridnum':{'type':Sequelize[_0xbff2('0x8')]},'completed':{'type':Sequelize[_0xbff2('0x9')],'defaultValue':![]}}; \ No newline at end of file diff --git a/server/api/jscriptySessionReport/jscriptySessionReport.controller.js b/server/api/jscriptySessionReport/jscriptySessionReport.controller.js index a3416b5..89b0faf 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 _0x7eee=['stack','name','send','index','map','JscriptySessionReport','rawAttributes','type','key','model','query','keys','filters','intersection','fields','attributes','length','hasOwnProperty','nolimit','order','sort','filter','where','merge','options','includeAll','include','findAll','rows','catch','show','params','find','create','body','destroy','describe','JscriptyQuestionReport','pick','SessionId','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','moment','bluebird','mustache','util','sox','ejs','fs-extra','lodash','crypto','jsforce','desk.js','to-csv','querystring','papaparse','../../components/auth/service','../../components/parsers/qs','api','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','sendStatus','status','json','offset','limit','undefined','count','set','Content-Range','apply','reject','save','update','then','end','error'];(function(_0x5126bb,_0x10c31b){var _0x1d04b3=function(_0x28bcae){while(--_0x28bcae){_0x5126bb['push'](_0x5126bb['shift']());}};_0x1d04b3(++_0x10c31b);}(_0x7eee,0x7a));var _0xe7ee=function(_0x216d36,_0x185c4c){_0x216d36=_0x216d36-0x0;var _0x3daee6=_0x7eee[_0x216d36];return _0x3daee6;};'use strict';var emlformat=require(_0xe7ee('0x0'));var rimraf=require(_0xe7ee('0x1'));var zipdir=require(_0xe7ee('0x2'));var jsonpatch=require(_0xe7ee('0x3'));var rp=require(_0xe7ee('0x4'));var moment=require(_0xe7ee('0x5'));var BPromise=require(_0xe7ee('0x6'));var Mustache=require(_0xe7ee('0x7'));var util=require(_0xe7ee('0x8'));var path=require('path');var sox=require(_0xe7ee('0x9'));var csv=require('to-csv');var ejs=require(_0xe7ee('0xa'));var fs=require('fs');var fs_extra=require(_0xe7ee('0xb'));var _=require(_0xe7ee('0xc'));var squel=require('squel');var crypto=require(_0xe7ee('0xd'));var jsforce=require(_0xe7ee('0xe'));var deskjs=require(_0xe7ee('0xf'));var toCsv=require(_0xe7ee('0x10'));var querystring=require(_0xe7ee('0x11'));var Papa=require(_0xe7ee('0x12'));var Redis=require('ioredis');var authService=require(_0xe7ee('0x13'));var qs=require(_0xe7ee('0x14'));var as=require('../../components/parsers/advancedSearch');var hardwareService=require('../../config/license/hardware');var logger=require('../../config/logger')(_0xe7ee('0x15'));var utils=require(_0xe7ee('0x16'));var config=require(_0xe7ee('0x17'));var licenseUtil=require(_0xe7ee('0x18'));var db=require(_0xe7ee('0x19'))['db'];function respondWithStatusCode(_0x39de99,_0x2c121e){_0x2c121e=_0x2c121e||0xcc;return function(_0x119811){if(_0x119811){return _0x39de99[_0xe7ee('0x1a')](_0x2c121e);}return _0x39de99['status'](_0x2c121e)['end']();};}function respondWithResult(_0x2a3ede,_0x4a1a60){_0x4a1a60=_0x4a1a60||0xc8;return function(_0xf7025b){if(_0xf7025b){return _0x2a3ede[_0xe7ee('0x1b')](_0x4a1a60)[_0xe7ee('0x1c')](_0xf7025b);}};}function respondWithFilteredResult(_0x30f078,_0x4a9c1d){return function(_0x1e0dc6){if(_0x1e0dc6){var _0x30e05d=typeof _0x4a9c1d[_0xe7ee('0x1d')]==='undefined'&&typeof _0x4a9c1d[_0xe7ee('0x1e')]===_0xe7ee('0x1f');var _0x560f6b=_0x1e0dc6[_0xe7ee('0x20')];var _0x37e8df=_0x30e05d?0x0:_0x4a9c1d[_0xe7ee('0x1d')];var _0x5f4de1=_0x30e05d?_0x1e0dc6[_0xe7ee('0x20')]:_0x4a9c1d['offset']+_0x4a9c1d[_0xe7ee('0x1e')];var _0x356828;if(_0x5f4de1>=_0x560f6b){_0x5f4de1=_0x560f6b;_0x356828=0xc8;}else{_0x356828=0xce;}_0x30f078[_0xe7ee('0x1b')](_0x356828);return _0x30f078[_0xe7ee('0x21')](_0xe7ee('0x22'),_0x37e8df+'-'+_0x5f4de1+'/'+_0x560f6b)['json'](_0x1e0dc6);}return null;};}function patchUpdates(_0x3a7ddc){return function(_0x169b9d){try{jsonpatch[_0xe7ee('0x23')](_0x169b9d,_0x3a7ddc,!![]);}catch(_0x4e3b74){return BPromise[_0xe7ee('0x24')](_0x4e3b74);}return _0x169b9d[_0xe7ee('0x25')]();};}function saveUpdates(_0x29f6d5,_0x2c4787){return function(_0x339625){if(_0x339625){return _0x339625[_0xe7ee('0x26')](_0x29f6d5)[_0xe7ee('0x27')](function(_0x6978af){return _0x6978af;});}return null;};}function removeEntity(_0x546f1d,_0x2b2d1a){return function(_0x53520a){if(_0x53520a){return _0x53520a['destroy']()[_0xe7ee('0x27')](function(){_0x546f1d['status'](0xcc)[_0xe7ee('0x28')]();});}};}function handleEntityNotFound(_0x42d560,_0x1a324b){return function(_0x135729){if(!_0x135729){_0x42d560[_0xe7ee('0x1a')](0x194);}return _0x135729;};}function handleError(_0x4bef46,_0x5849c4){_0x5849c4=_0x5849c4||0x1f4;return function(_0x4fb8c8){logger[_0xe7ee('0x29')](_0x4fb8c8[_0xe7ee('0x2a')]);if(_0x4fb8c8[_0xe7ee('0x2b')]){delete _0x4fb8c8[_0xe7ee('0x2b')];}_0x4bef46[_0xe7ee('0x1b')](_0x5849c4)[_0xe7ee('0x2c')](_0x4fb8c8);};}exports[_0xe7ee('0x2d')]=function(_0x4db98d,_0x9f5f27){var _0x258a84={},_0x975add={},_0x702f1c={'count':0x0,'rows':[]};var _0x564e5e=_[_0xe7ee('0x2e')](db[_0xe7ee('0x2f')][_0xe7ee('0x30')],function(_0x58bd6f){return{'name':_0x58bd6f['fieldName'],'type':_0x58bd6f[_0xe7ee('0x31')][_0xe7ee('0x32')]};});_0x975add[_0xe7ee('0x33')]=_[_0xe7ee('0x2e')](_0x564e5e,_0xe7ee('0x2b'));_0x975add[_0xe7ee('0x34')]=_[_0xe7ee('0x35')](_0x4db98d[_0xe7ee('0x34')]);_0x975add[_0xe7ee('0x36')]=_['intersection'](_0x975add[_0xe7ee('0x33')],_0x975add[_0xe7ee('0x34')]);_0x258a84['attributes']=_[_0xe7ee('0x37')](_0x975add['model'],qs[_0xe7ee('0x38')](_0x4db98d[_0xe7ee('0x34')]['fields']));_0x258a84[_0xe7ee('0x39')]=_0x258a84[_0xe7ee('0x39')][_0xe7ee('0x3a')]?_0x258a84[_0xe7ee('0x39')]:_0x975add[_0xe7ee('0x33')];if(!_0x4db98d[_0xe7ee('0x34')][_0xe7ee('0x3b')](_0xe7ee('0x3c'))){_0x258a84[_0xe7ee('0x1e')]=qs[_0xe7ee('0x1e')](_0x4db98d[_0xe7ee('0x34')][_0xe7ee('0x1e')]);_0x258a84[_0xe7ee('0x1d')]=qs[_0xe7ee('0x1d')](_0x4db98d[_0xe7ee('0x34')][_0xe7ee('0x1d')]);}_0x258a84[_0xe7ee('0x3d')]=qs[_0xe7ee('0x3e')](_0x4db98d['query'][_0xe7ee('0x3e')]);_0x258a84['where']=qs[_0xe7ee('0x36')](_['pick'](_0x4db98d[_0xe7ee('0x34')],_0x975add[_0xe7ee('0x36')]),_0x564e5e);if(_0x4db98d['query'][_0xe7ee('0x3f')]){_0x258a84[_0xe7ee('0x40')]=_[_0xe7ee('0x41')](_0x258a84[_0xe7ee('0x40')],{'$or':_['map'](_0x564e5e,function(_0x468205){if(_0x468205[_0xe7ee('0x31')]!=='VIRTUAL'){var _0x2d1bc7={};_0x2d1bc7[_0x468205[_0xe7ee('0x2b')]]={'$like':'%'+_0x4db98d[_0xe7ee('0x34')][_0xe7ee('0x3f')]+'%'};return _0x2d1bc7;}})});}_0x258a84=_[_0xe7ee('0x41')]({},_0x258a84,_0x4db98d[_0xe7ee('0x42')]);var _0x166c41={'where':_0x258a84[_0xe7ee('0x40')]};return db[_0xe7ee('0x2f')][_0xe7ee('0x20')](_0x166c41)[_0xe7ee('0x27')](function(_0x123070){_0x702f1c[_0xe7ee('0x20')]=_0x123070;if(_0x4db98d[_0xe7ee('0x34')][_0xe7ee('0x43')]){_0x258a84[_0xe7ee('0x44')]=[{'all':!![]}];}return db[_0xe7ee('0x2f')][_0xe7ee('0x45')](_0x258a84);})['then'](function(_0x2a918e){_0x702f1c[_0xe7ee('0x46')]=_0x2a918e;return _0x702f1c;})['then'](respondWithFilteredResult(_0x9f5f27,_0x258a84))[_0xe7ee('0x47')](handleError(_0x9f5f27,null));};exports[_0xe7ee('0x48')]=function(_0x152b42,_0x26b1c0){var _0x23b73f={'raw':!![],'where':{'id':_0x152b42[_0xe7ee('0x49')]['id']}},_0x200ac3={};_0x200ac3['model']=_['keys'](db[_0xe7ee('0x2f')][_0xe7ee('0x30')]);_0x200ac3[_0xe7ee('0x34')]=_[_0xe7ee('0x35')](_0x152b42[_0xe7ee('0x34')]);_0x200ac3['filters']=_[_0xe7ee('0x37')](_0x200ac3['model'],_0x200ac3['query']);_0x23b73f[_0xe7ee('0x39')]=_['intersection'](_0x200ac3[_0xe7ee('0x33')],qs[_0xe7ee('0x38')](_0x152b42[_0xe7ee('0x34')][_0xe7ee('0x38')]));_0x23b73f[_0xe7ee('0x39')]=_0x23b73f[_0xe7ee('0x39')][_0xe7ee('0x3a')]?_0x23b73f[_0xe7ee('0x39')]:_0x200ac3[_0xe7ee('0x33')];if(_0x152b42[_0xe7ee('0x34')][_0xe7ee('0x43')]){_0x23b73f['include']=[{'all':!![]}];}_0x23b73f=_[_0xe7ee('0x41')]({},_0x23b73f,_0x152b42[_0xe7ee('0x42')]);return db['JscriptySessionReport'][_0xe7ee('0x4a')](_0x23b73f)[_0xe7ee('0x27')](handleEntityNotFound(_0x26b1c0,null))['then'](respondWithResult(_0x26b1c0,null))[_0xe7ee('0x47')](handleError(_0x26b1c0,null));};exports[_0xe7ee('0x4b')]=function(_0x1f4535,_0x3d984a){return db['JscriptySessionReport']['create'](_0x1f4535['body'],{})[_0xe7ee('0x27')](respondWithResult(_0x3d984a,0xc9))[_0xe7ee('0x47')](handleError(_0x3d984a,null));};exports[_0xe7ee('0x26')]=function(_0x35dc48,_0x30d64a){if(_0x35dc48['body']['id']){delete _0x35dc48[_0xe7ee('0x4c')]['id'];}return db['JscriptySessionReport'][_0xe7ee('0x4a')]({'where':{'id':_0x35dc48[_0xe7ee('0x49')]['id']}})['then'](handleEntityNotFound(_0x30d64a,null))[_0xe7ee('0x27')](saveUpdates(_0x35dc48['body'],null))[_0xe7ee('0x27')](respondWithResult(_0x30d64a,null))[_0xe7ee('0x47')](handleError(_0x30d64a,null));};exports[_0xe7ee('0x4d')]=function(_0x1b37b3,_0x120170){return db[_0xe7ee('0x2f')][_0xe7ee('0x4a')]({'where':{'id':_0x1b37b3['params']['id']}})['then'](handleEntityNotFound(_0x120170,null))[_0xe7ee('0x27')](removeEntity(_0x120170,null))[_0xe7ee('0x47')](handleError(_0x120170,null));};exports[_0xe7ee('0x4e')]=function(_0x211989,_0x307b19){return db[_0xe7ee('0x2f')]['describe']()['then'](respondWithResult(_0x307b19,null))[_0xe7ee('0x47')](handleError(_0x307b19,null));};exports['getQuestions']=function(_0x5f1603,_0x4f0d99,_0x537c43){var _0x23acc5={'raw':!![],'where':{}};var _0x1f7f89={};var _0x4f58b1={'count':0x0,'rows':[]};return db[_0xe7ee('0x2f')]['findOne']({'where':{'id':_0x5f1603[_0xe7ee('0x49')]['id']}})[_0xe7ee('0x27')](handleEntityNotFound(_0x4f0d99,null))['then'](function(_0x520a1c){if(_0x520a1c){_0x1f7f89[_0xe7ee('0x33')]=_[_0xe7ee('0x35')](db[_0xe7ee('0x4f')][_0xe7ee('0x30')]);_0x1f7f89[_0xe7ee('0x34')]=_[_0xe7ee('0x35')](_0x5f1603['query']);_0x1f7f89[_0xe7ee('0x36')]=_[_0xe7ee('0x37')](_0x1f7f89[_0xe7ee('0x33')],_0x1f7f89[_0xe7ee('0x34')]);_0x23acc5[_0xe7ee('0x39')]=_[_0xe7ee('0x37')](_0x1f7f89['model'],qs[_0xe7ee('0x38')](_0x5f1603[_0xe7ee('0x34')][_0xe7ee('0x38')]));_0x23acc5[_0xe7ee('0x39')]=_0x23acc5[_0xe7ee('0x39')][_0xe7ee('0x3a')]?_0x23acc5[_0xe7ee('0x39')]:_0x1f7f89[_0xe7ee('0x33')];if(!_0x5f1603[_0xe7ee('0x34')][_0xe7ee('0x3b')](_0xe7ee('0x3c'))){_0x23acc5['limit']=qs[_0xe7ee('0x1e')](_0x5f1603['query'][_0xe7ee('0x1e')]);_0x23acc5[_0xe7ee('0x1d')]=qs[_0xe7ee('0x1d')](_0x5f1603[_0xe7ee('0x34')][_0xe7ee('0x1d')]);}_0x23acc5[_0xe7ee('0x3d')]=qs[_0xe7ee('0x3e')](_0x5f1603['query'][_0xe7ee('0x3e')]);_0x23acc5[_0xe7ee('0x40')]=qs['filters'](_[_0xe7ee('0x50')](_0x5f1603[_0xe7ee('0x34')],_0x1f7f89[_0xe7ee('0x36')]));_0x23acc5[_0xe7ee('0x40')][_0xe7ee('0x51')]=_0x520a1c['id'];if(_0x5f1603[_0xe7ee('0x34')]['filter']){_0x23acc5[_0xe7ee('0x40')]=_['merge'](_0x23acc5['where'],{'$or':_[_0xe7ee('0x2e')](_0x23acc5[_0xe7ee('0x39')],function(_0x12ebd6){var _0x563f4a={};_0x563f4a[_0x12ebd6]={'$like':'%'+_0x5f1603[_0xe7ee('0x34')][_0xe7ee('0x3f')]+'%'};return _0x563f4a;})});}_0x23acc5=_['merge']({},_0x23acc5,_0x5f1603[_0xe7ee('0x42')]);return db['JscriptyQuestionReport']['count']({'where':_0x23acc5[_0xe7ee('0x40')]})[_0xe7ee('0x27')](function(_0x766ccb){_0x4f58b1[_0xe7ee('0x20')]=_0x766ccb;if(_0x5f1603['query'][_0xe7ee('0x43')]){_0x23acc5[_0xe7ee('0x44')]=[{'all':!![]}];}return db[_0xe7ee('0x4f')]['findAll'](_0x23acc5);})[_0xe7ee('0x27')](function(_0x5c0473){_0x4f58b1[_0xe7ee('0x46')]=_0x5c0473;return _0x4f58b1;});}})[_0xe7ee('0x27')](respondWithFilteredResult(_0x4f0d99,_0x23acc5))['catch'](handleError(_0x4f0d99,null));}; \ No newline at end of file +var _0xea31=['merge','options','JscriptySessionReport','includeAll','include','rows','catch','show','params','rawAttributes','find','create','body','describe','findOne','hasOwnProperty','SessionId','JscriptyQuestionReport','findAll','eml-format','rimraf','zip-dir','request-promise','bluebird','mustache','util','path','to-csv','ejs','fs-extra','lodash','squel','jsforce','desk.js','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','end','status','json','limit','undefined','count','offset','apply','reject','save','update','then','destroy','sendStatus','error','name','send','map','key','query','keys','filters','intersection','model','fields','attributes','length','nolimit','order','sort','where','filter','type'];(function(_0xa464c9,_0x7c86d8){var _0x3d73c4=function(_0x5c2056){while(--_0x5c2056){_0xa464c9['push'](_0xa464c9['shift']());}};_0x3d73c4(++_0x7c86d8);}(_0xea31,0x14b));var _0x1ea3=function(_0x43502f,_0x5ec455){_0x43502f=_0x43502f-0x0;var _0x2506b2=_0xea31[_0x43502f];return _0x2506b2;};'use strict';var emlformat=require(_0x1ea3('0x0'));var rimraf=require(_0x1ea3('0x1'));var zipdir=require(_0x1ea3('0x2'));var jsonpatch=require('fast-json-patch');var rp=require(_0x1ea3('0x3'));var moment=require('moment');var BPromise=require(_0x1ea3('0x4'));var Mustache=require(_0x1ea3('0x5'));var util=require(_0x1ea3('0x6'));var path=require(_0x1ea3('0x7'));var sox=require('sox');var csv=require(_0x1ea3('0x8'));var ejs=require(_0x1ea3('0x9'));var fs=require('fs');var fs_extra=require(_0x1ea3('0xa'));var _=require(_0x1ea3('0xb'));var squel=require(_0x1ea3('0xc'));var crypto=require('crypto');var jsforce=require(_0x1ea3('0xd'));var deskjs=require(_0x1ea3('0xe'));var toCsv=require('to-csv');var querystring=require(_0x1ea3('0xf'));var Papa=require(_0x1ea3('0x10'));var Redis=require(_0x1ea3('0x11'));var authService=require(_0x1ea3('0x12'));var qs=require(_0x1ea3('0x13'));var as=require(_0x1ea3('0x14'));var hardwareService=require(_0x1ea3('0x15'));var logger=require('../../config/logger')('api');var utils=require(_0x1ea3('0x16'));var config=require(_0x1ea3('0x17'));var licenseUtil=require(_0x1ea3('0x18'));var db=require(_0x1ea3('0x19'))['db'];function respondWithStatusCode(_0x25df57,_0x38414c){_0x38414c=_0x38414c||0xcc;return function(_0x3fbaff){if(_0x3fbaff){return _0x25df57['sendStatus'](_0x38414c);}return _0x25df57['status'](_0x38414c)[_0x1ea3('0x1a')]();};}function respondWithResult(_0x3f3d7f,_0x4826a4){_0x4826a4=_0x4826a4||0xc8;return function(_0x4aed91){if(_0x4aed91){return _0x3f3d7f[_0x1ea3('0x1b')](_0x4826a4)[_0x1ea3('0x1c')](_0x4aed91);}};}function respondWithFilteredResult(_0x58939c,_0x46c997){return function(_0x1a742e){if(_0x1a742e){var _0x38fd7f=typeof _0x46c997['offset']==='undefined'&&typeof _0x46c997[_0x1ea3('0x1d')]===_0x1ea3('0x1e');var _0x1316de=_0x1a742e[_0x1ea3('0x1f')];var _0x14fb49=_0x38fd7f?0x0:_0x46c997[_0x1ea3('0x20')];var _0x1ad237=_0x38fd7f?_0x1a742e[_0x1ea3('0x1f')]:_0x46c997[_0x1ea3('0x20')]+_0x46c997['limit'];var _0x2f73c3;if(_0x1ad237>=_0x1316de){_0x1ad237=_0x1316de;_0x2f73c3=0xc8;}else{_0x2f73c3=0xce;}_0x58939c['status'](_0x2f73c3);return _0x58939c['set']('Content-Range',_0x14fb49+'-'+_0x1ad237+'/'+_0x1316de)[_0x1ea3('0x1c')](_0x1a742e);}return null;};}function patchUpdates(_0x2f0f88){return function(_0x2788e0){try{jsonpatch[_0x1ea3('0x21')](_0x2788e0,_0x2f0f88,!![]);}catch(_0x931cb1){return BPromise[_0x1ea3('0x22')](_0x931cb1);}return _0x2788e0[_0x1ea3('0x23')]();};}function saveUpdates(_0x2db315,_0x4d498d){return function(_0x200d8b){if(_0x200d8b){return _0x200d8b[_0x1ea3('0x24')](_0x2db315)[_0x1ea3('0x25')](function(_0x16f56a){return _0x16f56a;});}return null;};}function removeEntity(_0x5d279b,_0x1d2d8e){return function(_0x5d2272){if(_0x5d2272){return _0x5d2272[_0x1ea3('0x26')]()[_0x1ea3('0x25')](function(){_0x5d279b['status'](0xcc)[_0x1ea3('0x1a')]();});}};}function handleEntityNotFound(_0x5d9396,_0x52c326){return function(_0x5eb202){if(!_0x5eb202){_0x5d9396[_0x1ea3('0x27')](0x194);}return _0x5eb202;};}function handleError(_0x17641f,_0x2356b6){_0x2356b6=_0x2356b6||0x1f4;return function(_0x31c00a){logger[_0x1ea3('0x28')](_0x31c00a['stack']);if(_0x31c00a['name']){delete _0x31c00a[_0x1ea3('0x29')];}_0x17641f[_0x1ea3('0x1b')](_0x2356b6)[_0x1ea3('0x2a')](_0x31c00a);};}exports['index']=function(_0x5f572f,_0xf670f4){var _0x2901f4={},_0x3f514a={},_0x30180a={'count':0x0,'rows':[]};var _0x11c33f=_[_0x1ea3('0x2b')](db['JscriptySessionReport']['rawAttributes'],function(_0x315aa6){return{'name':_0x315aa6['fieldName'],'type':_0x315aa6['type'][_0x1ea3('0x2c')]};});_0x3f514a['model']=_['map'](_0x11c33f,'name');_0x3f514a[_0x1ea3('0x2d')]=_[_0x1ea3('0x2e')](_0x5f572f[_0x1ea3('0x2d')]);_0x3f514a[_0x1ea3('0x2f')]=_[_0x1ea3('0x30')](_0x3f514a[_0x1ea3('0x31')],_0x3f514a[_0x1ea3('0x2d')]);_0x2901f4['attributes']=_[_0x1ea3('0x30')](_0x3f514a[_0x1ea3('0x31')],qs['fields'](_0x5f572f[_0x1ea3('0x2d')][_0x1ea3('0x32')]));_0x2901f4[_0x1ea3('0x33')]=_0x2901f4[_0x1ea3('0x33')][_0x1ea3('0x34')]?_0x2901f4[_0x1ea3('0x33')]:_0x3f514a[_0x1ea3('0x31')];if(!_0x5f572f['query']['hasOwnProperty'](_0x1ea3('0x35'))){_0x2901f4[_0x1ea3('0x1d')]=qs[_0x1ea3('0x1d')](_0x5f572f[_0x1ea3('0x2d')][_0x1ea3('0x1d')]);_0x2901f4[_0x1ea3('0x20')]=qs[_0x1ea3('0x20')](_0x5f572f[_0x1ea3('0x2d')][_0x1ea3('0x20')]);}_0x2901f4[_0x1ea3('0x36')]=qs['sort'](_0x5f572f[_0x1ea3('0x2d')][_0x1ea3('0x37')]);_0x2901f4[_0x1ea3('0x38')]=qs[_0x1ea3('0x2f')](_['pick'](_0x5f572f[_0x1ea3('0x2d')],_0x3f514a[_0x1ea3('0x2f')]),_0x11c33f);if(_0x5f572f['query'][_0x1ea3('0x39')]){_0x2901f4[_0x1ea3('0x38')]=_['merge'](_0x2901f4['where'],{'$or':_[_0x1ea3('0x2b')](_0x11c33f,function(_0x367664){if(_0x367664[_0x1ea3('0x3a')]!=='VIRTUAL'){var _0x440b25={};_0x440b25[_0x367664[_0x1ea3('0x29')]]={'$like':'%'+_0x5f572f[_0x1ea3('0x2d')][_0x1ea3('0x39')]+'%'};return _0x440b25;}})});}_0x2901f4=_[_0x1ea3('0x3b')]({},_0x2901f4,_0x5f572f[_0x1ea3('0x3c')]);var _0x2adcd0={'where':_0x2901f4[_0x1ea3('0x38')]};return db[_0x1ea3('0x3d')][_0x1ea3('0x1f')](_0x2adcd0)[_0x1ea3('0x25')](function(_0x2304b2){_0x30180a[_0x1ea3('0x1f')]=_0x2304b2;if(_0x5f572f['query'][_0x1ea3('0x3e')]){_0x2901f4[_0x1ea3('0x3f')]=[{'all':!![]}];}return db[_0x1ea3('0x3d')]['findAll'](_0x2901f4);})[_0x1ea3('0x25')](function(_0x4a25be){_0x30180a[_0x1ea3('0x40')]=_0x4a25be;return _0x30180a;})['then'](respondWithFilteredResult(_0xf670f4,_0x2901f4))[_0x1ea3('0x41')](handleError(_0xf670f4,null));};exports[_0x1ea3('0x42')]=function(_0x3fc84b,_0x18446c){var _0x1ed4ad={'raw':!![],'where':{'id':_0x3fc84b[_0x1ea3('0x43')]['id']}},_0x4a6917={};_0x4a6917[_0x1ea3('0x31')]=_[_0x1ea3('0x2e')](db['JscriptySessionReport'][_0x1ea3('0x44')]);_0x4a6917['query']=_[_0x1ea3('0x2e')](_0x3fc84b['query']);_0x4a6917[_0x1ea3('0x2f')]=_[_0x1ea3('0x30')](_0x4a6917[_0x1ea3('0x31')],_0x4a6917[_0x1ea3('0x2d')]);_0x1ed4ad[_0x1ea3('0x33')]=_['intersection'](_0x4a6917[_0x1ea3('0x31')],qs['fields'](_0x3fc84b[_0x1ea3('0x2d')][_0x1ea3('0x32')]));_0x1ed4ad[_0x1ea3('0x33')]=_0x1ed4ad[_0x1ea3('0x33')][_0x1ea3('0x34')]?_0x1ed4ad['attributes']:_0x4a6917[_0x1ea3('0x31')];if(_0x3fc84b[_0x1ea3('0x2d')][_0x1ea3('0x3e')]){_0x1ed4ad[_0x1ea3('0x3f')]=[{'all':!![]}];}_0x1ed4ad=_[_0x1ea3('0x3b')]({},_0x1ed4ad,_0x3fc84b[_0x1ea3('0x3c')]);return db['JscriptySessionReport'][_0x1ea3('0x45')](_0x1ed4ad)[_0x1ea3('0x25')](handleEntityNotFound(_0x18446c,null))[_0x1ea3('0x25')](respondWithResult(_0x18446c,null))[_0x1ea3('0x41')](handleError(_0x18446c,null));};exports[_0x1ea3('0x46')]=function(_0x247f41,_0xbef80){return db['JscriptySessionReport']['create'](_0x247f41[_0x1ea3('0x47')],{})[_0x1ea3('0x25')](respondWithResult(_0xbef80,0xc9))[_0x1ea3('0x41')](handleError(_0xbef80,null));};exports[_0x1ea3('0x24')]=function(_0x5f1770,_0x20633b){if(_0x5f1770[_0x1ea3('0x47')]['id']){delete _0x5f1770[_0x1ea3('0x47')]['id'];}return db[_0x1ea3('0x3d')][_0x1ea3('0x45')]({'where':{'id':_0x5f1770[_0x1ea3('0x43')]['id']}})[_0x1ea3('0x25')](handleEntityNotFound(_0x20633b,null))[_0x1ea3('0x25')](saveUpdates(_0x5f1770[_0x1ea3('0x47')],null))[_0x1ea3('0x25')](respondWithResult(_0x20633b,null))[_0x1ea3('0x41')](handleError(_0x20633b,null));};exports[_0x1ea3('0x26')]=function(_0x4c149c,_0x222e75){return db[_0x1ea3('0x3d')][_0x1ea3('0x45')]({'where':{'id':_0x4c149c[_0x1ea3('0x43')]['id']}})[_0x1ea3('0x25')](handleEntityNotFound(_0x222e75,null))[_0x1ea3('0x25')](removeEntity(_0x222e75,null))[_0x1ea3('0x41')](handleError(_0x222e75,null));};exports[_0x1ea3('0x48')]=function(_0x11145d,_0x467ac3){return db['JscriptySessionReport'][_0x1ea3('0x48')]()['then'](respondWithResult(_0x467ac3,null))[_0x1ea3('0x41')](handleError(_0x467ac3,null));};exports['getQuestions']=function(_0x3c3abc,_0x3f7809,_0x3871fd){var _0x45d8af={'raw':!![],'where':{}};var _0x33193f={};var _0x220713={'count':0x0,'rows':[]};return db[_0x1ea3('0x3d')][_0x1ea3('0x49')]({'where':{'id':_0x3c3abc[_0x1ea3('0x43')]['id']}})[_0x1ea3('0x25')](handleEntityNotFound(_0x3f7809,null))[_0x1ea3('0x25')](function(_0x2314aa){if(_0x2314aa){_0x33193f['model']=_[_0x1ea3('0x2e')](db['JscriptyQuestionReport'][_0x1ea3('0x44')]);_0x33193f[_0x1ea3('0x2d')]=_['keys'](_0x3c3abc[_0x1ea3('0x2d')]);_0x33193f[_0x1ea3('0x2f')]=_[_0x1ea3('0x30')](_0x33193f[_0x1ea3('0x31')],_0x33193f[_0x1ea3('0x2d')]);_0x45d8af[_0x1ea3('0x33')]=_[_0x1ea3('0x30')](_0x33193f[_0x1ea3('0x31')],qs[_0x1ea3('0x32')](_0x3c3abc[_0x1ea3('0x2d')][_0x1ea3('0x32')]));_0x45d8af['attributes']=_0x45d8af[_0x1ea3('0x33')][_0x1ea3('0x34')]?_0x45d8af['attributes']:_0x33193f['model'];if(!_0x3c3abc[_0x1ea3('0x2d')][_0x1ea3('0x4a')](_0x1ea3('0x35'))){_0x45d8af[_0x1ea3('0x1d')]=qs[_0x1ea3('0x1d')](_0x3c3abc[_0x1ea3('0x2d')][_0x1ea3('0x1d')]);_0x45d8af[_0x1ea3('0x20')]=qs[_0x1ea3('0x20')](_0x3c3abc[_0x1ea3('0x2d')]['offset']);}_0x45d8af[_0x1ea3('0x36')]=qs['sort'](_0x3c3abc[_0x1ea3('0x2d')][_0x1ea3('0x37')]);_0x45d8af[_0x1ea3('0x38')]=qs[_0x1ea3('0x2f')](_['pick'](_0x3c3abc[_0x1ea3('0x2d')],_0x33193f[_0x1ea3('0x2f')]));_0x45d8af[_0x1ea3('0x38')][_0x1ea3('0x4b')]=_0x2314aa['id'];if(_0x3c3abc['query']['filter']){_0x45d8af[_0x1ea3('0x38')]=_[_0x1ea3('0x3b')](_0x45d8af[_0x1ea3('0x38')],{'$or':_['map'](_0x45d8af[_0x1ea3('0x33')],function(_0x584aa0){var _0x1a0ab4={};_0x1a0ab4[_0x584aa0]={'$like':'%'+_0x3c3abc[_0x1ea3('0x2d')][_0x1ea3('0x39')]+'%'};return _0x1a0ab4;})});}_0x45d8af=_[_0x1ea3('0x3b')]({},_0x45d8af,_0x3c3abc[_0x1ea3('0x3c')]);return db[_0x1ea3('0x4c')][_0x1ea3('0x1f')]({'where':_0x45d8af['where']})[_0x1ea3('0x25')](function(_0x4df88c){_0x220713[_0x1ea3('0x1f')]=_0x4df88c;if(_0x3c3abc[_0x1ea3('0x2d')][_0x1ea3('0x3e')]){_0x45d8af[_0x1ea3('0x3f')]=[{'all':!![]}];}return db[_0x1ea3('0x4c')][_0x1ea3('0x4d')](_0x45d8af);})['then'](function(_0xfde30c){_0x220713[_0x1ea3('0x40')]=_0xfde30c;return _0x220713;});}})[_0x1ea3('0x25')](respondWithFilteredResult(_0x3f7809,_0x45d8af))[_0x1ea3('0x41')](handleError(_0x3f7809,null));}; \ No newline at end of file diff --git a/server/api/jscriptySessionReport/jscriptySessionReport.model.js b/server/api/jscriptySessionReport/jscriptySessionReport.model.js index 1d56bdb..f782af5 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 _0x82c4=['JscriptySessionReport','report_jscripty_sessions','lodash','util','../../config/logger','api','moment','bluebird','request-promise','rimraf','./jscriptySessionReport.attributes','define'];(function(_0x25e7b9,_0x11c8c4){var _0x27fc5f=function(_0x49b65a){while(--_0x49b65a){_0x25e7b9['push'](_0x25e7b9['shift']());}};_0x27fc5f(++_0x11c8c4);}(_0x82c4,0x1ca));var _0x482c=function(_0x5d1d9f,_0x1ef696){_0x5d1d9f=_0x5d1d9f-0x0;var _0x2faa8e=_0x82c4[_0x5d1d9f];return _0x2faa8e;};'use strict';var _=require(_0x482c('0x0'));var util=require(_0x482c('0x1'));var logger=require(_0x482c('0x2'))(_0x482c('0x3'));var moment=require(_0x482c('0x4'));var BPromise=require(_0x482c('0x5'));var rp=require(_0x482c('0x6'));var fs=require('fs');var path=require('path');var rimraf=require(_0x482c('0x7'));var config=require('../../config/environment');var attributes=require(_0x482c('0x8'));module['exports']=function(_0x477cf4,_0x5d7c76){return _0x477cf4[_0x482c('0x9')](_0x482c('0xa'),attributes,{'tableName':_0x482c('0xb'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0xf072=['path','rimraf','./jscriptySessionReport.attributes','exports','define','JscriptySessionReport','report_jscripty_sessions','lodash','util','../../config/logger','moment','request-promise'];(function(_0x3e6421,_0x3fbd79){var _0x10f2b9=function(_0x115d8d){while(--_0x115d8d){_0x3e6421['push'](_0x3e6421['shift']());}};_0x10f2b9(++_0x3fbd79);}(_0xf072,0x1cf));var _0x2f07=function(_0x34ebe6,_0x20b871){_0x34ebe6=_0x34ebe6-0x0;var _0x3e9bd8=_0xf072[_0x34ebe6];return _0x3e9bd8;};'use strict';var _=require(_0x2f07('0x0'));var util=require(_0x2f07('0x1'));var logger=require(_0x2f07('0x2'))('api');var moment=require(_0x2f07('0x3'));var BPromise=require('bluebird');var rp=require(_0x2f07('0x4'));var fs=require('fs');var path=require(_0x2f07('0x5'));var rimraf=require(_0x2f07('0x6'));var config=require('../../config/environment');var attributes=require(_0x2f07('0x7'));module[_0x2f07('0x8')]=function(_0x3643bb,_0x2e6422){return _0x3643bb[_0x2f07('0x9')](_0x2f07('0xa'),attributes,{'tableName':_0x2f07('0xb'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/jscriptySessionReport/jscriptySessionReport.rpc.js b/server/api/jscriptySessionReport/jscriptySessionReport.rpc.js index 2043284..8b6a169 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 _0x2272=['lodash','util','moment','bluebird','randomstring','../../mysqldb','../../config/utils','../../config/logger','jayson/promise','client','http','request','then','info','request\x20sent','debug','JscriptySessionReport,\x20%s,\x20%s,\x20%s','stringify','error','code','JscriptySessionReport,\x20%s,\x20%s','message','result','catch'];(function(_0x5a49e3,_0x4a5545){var _0x2934b7=function(_0x2e558e){while(--_0x2e558e){_0x5a49e3['push'](_0x5a49e3['shift']());}};_0x2934b7(++_0x4a5545);}(_0x2272,0xd8));var _0x2227=function(_0x19e35c,_0x29cd1e){_0x19e35c=_0x19e35c-0x0;var _0x3e1fe8=_0x2272[_0x19e35c];return _0x3e1fe8;};'use strict';var _=require(_0x2227('0x0'));var util=require(_0x2227('0x1'));var moment=require(_0x2227('0x2'));var BPromise=require(_0x2227('0x3'));var rs=require(_0x2227('0x4'));var fs=require('fs');var Redis=require('ioredis');var db=require(_0x2227('0x5'))['db'];var utils=require(_0x2227('0x6'));var logger=require(_0x2227('0x7'))('rpc');var config=require('../../config/environment');var jayson=require(_0x2227('0x8'));var client=jayson[_0x2227('0x9')][_0x2227('0xa')]({'port':0x232a});function respondWithRpcPromise(_0x2591db,_0xaec623,_0x1413d2){return new BPromise(function(_0x41fc3f,_0x34bdd0){return client[_0x2227('0xb')](_0x2591db,_0x1413d2)[_0x2227('0xc')](function(_0x496bbd){logger[_0x2227('0xd')]('JscriptySessionReport,\x20%s,\x20%s',_0xaec623,_0x2227('0xe'));logger[_0x2227('0xf')](_0x2227('0x10'),_0xaec623,_0x2227('0xe'),JSON[_0x2227('0x11')](_0x496bbd));if(_0x496bbd['error']){if(_0x496bbd[_0x2227('0x12')][_0x2227('0x13')]===0x1f4){logger[_0x2227('0x12')](_0x2227('0x14'),_0xaec623,_0x496bbd[_0x2227('0x12')][_0x2227('0x15')]);return _0x34bdd0(_0x496bbd['error']['message']);}logger['error'](_0x2227('0x14'),_0xaec623,_0x496bbd['error'][_0x2227('0x15')]);return _0x41fc3f(_0x496bbd[_0x2227('0x12')]['message']);}else{logger[_0x2227('0xd')](_0x2227('0x14'),_0xaec623,_0x2227('0xe'));_0x41fc3f(_0x496bbd[_0x2227('0x16')][_0x2227('0x15')]);}})[_0x2227('0x17')](function(_0x508e92){logger[_0x2227('0x12')](_0x2227('0x14'),_0xaec623,_0x508e92);_0x34bdd0(_0x508e92);});});} \ No newline at end of file +var _0x1a37=['rpc','jayson/promise','http','info','JscriptySessionReport,\x20%s,\x20%s','request\x20sent','debug','JscriptySessionReport,\x20%s,\x20%s,\x20%s','stringify','error','message','catch','lodash','util','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger'];(function(_0x562f20,_0x11eece){var _0x56698d=function(_0x452f03){while(--_0x452f03){_0x562f20['push'](_0x562f20['shift']());}};_0x56698d(++_0x11eece);}(_0x1a37,0xb4));var _0x71a3=function(_0x2b7764,_0x2606f1){_0x2b7764=_0x2b7764-0x0;var _0x848dcb=_0x1a37[_0x2b7764];return _0x848dcb;};'use strict';var _=require(_0x71a3('0x0'));var util=require(_0x71a3('0x1'));var moment=require(_0x71a3('0x2'));var BPromise=require(_0x71a3('0x3'));var rs=require(_0x71a3('0x4'));var fs=require('fs');var Redis=require(_0x71a3('0x5'));var db=require(_0x71a3('0x6'))['db'];var utils=require(_0x71a3('0x7'));var logger=require(_0x71a3('0x8'))(_0x71a3('0x9'));var config=require('../../config/environment');var jayson=require(_0x71a3('0xa'));var client=jayson['client'][_0x71a3('0xb')]({'port':0x232a});function respondWithRpcPromise(_0x45050a,_0x231ea7,_0x2bb6a2){return new BPromise(function(_0x4a9ab2,_0x53b893){return client['request'](_0x45050a,_0x2bb6a2)['then'](function(_0x89da86){logger[_0x71a3('0xc')](_0x71a3('0xd'),_0x231ea7,_0x71a3('0xe'));logger[_0x71a3('0xf')](_0x71a3('0x10'),_0x231ea7,_0x71a3('0xe'),JSON[_0x71a3('0x11')](_0x89da86));if(_0x89da86['error']){if(_0x89da86['error']['code']===0x1f4){logger[_0x71a3('0x12')](_0x71a3('0xd'),_0x231ea7,_0x89da86[_0x71a3('0x12')][_0x71a3('0x13')]);return _0x53b893(_0x89da86[_0x71a3('0x12')][_0x71a3('0x13')]);}logger[_0x71a3('0x12')](_0x71a3('0xd'),_0x231ea7,_0x89da86[_0x71a3('0x12')][_0x71a3('0x13')]);return _0x4a9ab2(_0x89da86[_0x71a3('0x12')]['message']);}else{logger[_0x71a3('0xc')](_0x71a3('0xd'),_0x231ea7,'request\x20sent');_0x4a9ab2(_0x89da86['result'][_0x71a3('0x13')]);}})[_0x71a3('0x14')](function(_0xee797f){logger[_0x71a3('0x12')](_0x71a3('0xd'),_0x231ea7,_0xee797f);_0x53b893(_0xee797f);});});} \ No newline at end of file diff --git a/server/api/license/index.js b/server/api/license/index.js index d54f64d..723a35f 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 _0x992d=['path','connect-timeout','express','Router','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','./license.controller','get','index','put','isAuthenticated','update','/download_log_file','downloadLogFile','exports','multer','util'];(function(_0x55cc5d,_0x872047){var _0x16032f=function(_0x293968){while(--_0x293968){_0x55cc5d['push'](_0x55cc5d['shift']());}};_0x16032f(++_0x872047);}(_0x992d,0x11b));var _0xd992=function(_0x3e5086,_0x48f4a2){_0x3e5086=_0x3e5086-0x0;var _0xfeb102=_0x992d[_0x3e5086];return _0xfeb102;};'use strict';var multer=require(_0xd992('0x0'));var util=require(_0xd992('0x1'));var path=require(_0xd992('0x2'));var timeout=require(_0xd992('0x3'));var express=require(_0xd992('0x4'));var router=express[_0xd992('0x5')]();var fs_extra=require(_0xd992('0x6'));var auth=require(_0xd992('0x7'));var interaction=require(_0xd992('0x8'));var config=require(_0xd992('0x9'));var controller=require(_0xd992('0xa'));router[_0xd992('0xb')]('/',controller[_0xd992('0xc')]);router[_0xd992('0xd')]('/:id',auth[_0xd992('0xe')](),controller[_0xd992('0xf')]);router[_0xd992('0xb')](_0xd992('0x10'),auth[_0xd992('0xe')](),controller[_0xd992('0x11')]);module[_0xd992('0x12')]=router; \ No newline at end of file +var _0x2cbd=['fs-extra','../../components/interaction/service','../../config/environment','get','isAuthenticated','update','/download_log_file','downloadLogFile','exports','multer','util','path','connect-timeout'];(function(_0x599f41,_0x4db732){var _0x2e4d58=function(_0x14c882){while(--_0x14c882){_0x599f41['push'](_0x599f41['shift']());}};_0x2e4d58(++_0x4db732);}(_0x2cbd,0x1ea));var _0xd2cb=function(_0x2212d1,_0x483fc8){_0x2212d1=_0x2212d1-0x0;var _0x15eec5=_0x2cbd[_0x2212d1];return _0x15eec5;};'use strict';var multer=require(_0xd2cb('0x0'));var util=require(_0xd2cb('0x1'));var path=require(_0xd2cb('0x2'));var timeout=require(_0xd2cb('0x3'));var express=require('express');var router=express['Router']();var fs_extra=require(_0xd2cb('0x4'));var auth=require('../../components/auth/service');var interaction=require(_0xd2cb('0x5'));var config=require(_0xd2cb('0x6'));var controller=require('./license.controller');router[_0xd2cb('0x7')]('/',controller['index']);router['put']('/:id',auth[_0xd2cb('0x8')](),controller[_0xd2cb('0x9')]);router[_0xd2cb('0x7')](_0xd2cb('0xa'),auth[_0xd2cb('0x8')](),controller[_0xd2cb('0xb')]);module[_0xd2cb('0xc')]=router; \ No newline at end of file diff --git a/server/api/license/license.attributes.js b/server/api/license/license.attributes.js index d1996cf..40e9aec 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 _0xef33=['exports','TEXT','STRING','INTEGER','sequelize'];(function(_0x1cc07e,_0x527192){var _0xb762fc=function(_0x408f78){while(--_0x408f78){_0x1cc07e['push'](_0x1cc07e['shift']());}};_0xb762fc(++_0x527192);}(_0xef33,0x1a8));var _0x3ef3=function(_0x6fafb6,_0x345743){_0x6fafb6=_0x6fafb6-0x0;var _0x2fbdf3=_0xef33[_0x6fafb6];return _0x2fbdf3;};'use strict';var Sequelize=require(_0x3ef3('0x0'));module[_0x3ef3('0x1')]={'license':{'type':Sequelize[_0x3ef3('0x2')]},'data1':{'type':Sequelize[_0x3ef3('0x3')]},'data2':{'type':Sequelize['STRING']},'chatLicenseExceeded':{'type':Sequelize[_0x3ef3('0x4')],'defaultValue':0x0}}; \ No newline at end of file +var _0x37c0=['STRING','INTEGER','sequelize'];(function(_0x5d2803,_0xf375bd){var _0xdcad2c=function(_0x3c3a98){while(--_0x3c3a98){_0x5d2803['push'](_0x5d2803['shift']());}};_0xdcad2c(++_0xf375bd);}(_0x37c0,0xbf));var _0x037c=function(_0x497e7d,_0x51121c){_0x497e7d=_0x497e7d-0x0;var _0x4f86e4=_0x37c0[_0x497e7d];return _0x4f86e4;};'use strict';var Sequelize=require(_0x037c('0x0'));module['exports']={'license':{'type':Sequelize['TEXT']},'data1':{'type':Sequelize[_0x037c('0x1')]},'data2':{'type':Sequelize[_0x037c('0x1')]},'chatLicenseExceeded':{'type':Sequelize[_0x037c('0x2')],'defaultValue':0x0}}; \ No newline at end of file diff --git a/server/api/license/license.controller.js b/server/api/license/license.controller.js index 636e249..addbdd2 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 _0x9b07=['undefined','count','limit','Content-Range','apply','reject','save','then','destroy','error','stack','name','send','index','model','keys','License','query','filters','intersection','attributes','fields','options','catch','update','params','get','checkLicense','body','key','demo','downloadLogFile','license-info.log','/var','log','xcally','setHeader','Content-disposition','set','Content-Type','text/plain','download','zip-dir','fast-json-patch','request-promise','moment','util','path','to-csv','ejs','fs-extra','lodash','crypto','jsforce','desk.js','querystring','papaparse','ioredis','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','sendStatus','status','end','json','offset'];(function(_0x2b90ae,_0xe3aa78){var _0x2edb4a=function(_0x358bd9){while(--_0x358bd9){_0x2b90ae['push'](_0x2b90ae['shift']());}};_0x2edb4a(++_0xe3aa78);}(_0x9b07,0x14a));var _0x79b0=function(_0x550d12,_0x5384bd){_0x550d12=_0x550d12-0x0;var _0x12103d=_0x9b07[_0x550d12];return _0x12103d;};'use strict';var emlformat=require('eml-format');var rimraf=require('rimraf');var zipdir=require(_0x79b0('0x0'));var jsonpatch=require(_0x79b0('0x1'));var rp=require(_0x79b0('0x2'));var moment=require(_0x79b0('0x3'));var BPromise=require('bluebird');var Mustache=require('mustache');var util=require(_0x79b0('0x4'));var path=require(_0x79b0('0x5'));var sox=require('sox');var csv=require(_0x79b0('0x6'));var ejs=require(_0x79b0('0x7'));var fs=require('fs');var fs_extra=require(_0x79b0('0x8'));var _=require(_0x79b0('0x9'));var squel=require('squel');var crypto=require(_0x79b0('0xa'));var jsforce=require(_0x79b0('0xb'));var deskjs=require(_0x79b0('0xc'));var toCsv=require('to-csv');var querystring=require(_0x79b0('0xd'));var Papa=require(_0x79b0('0xe'));var Redis=require(_0x79b0('0xf'));var authService=require('../../components/auth/service');var qs=require(_0x79b0('0x10'));var as=require(_0x79b0('0x11'));var hardwareService=require(_0x79b0('0x12'));var logger=require(_0x79b0('0x13'))(_0x79b0('0x14'));var utils=require(_0x79b0('0x15'));var config=require(_0x79b0('0x16'));var licenseUtil=require(_0x79b0('0x17'));var db=require(_0x79b0('0x18'))['db'];function respondWithStatusCode(_0x2396b9,_0x1c3bba){_0x1c3bba=_0x1c3bba||0xcc;return function(_0x14dfe8){if(_0x14dfe8){return _0x2396b9[_0x79b0('0x19')](_0x1c3bba);}return _0x2396b9[_0x79b0('0x1a')](_0x1c3bba)[_0x79b0('0x1b')]();};}function respondWithResult(_0x4b4115,_0x1ce45b){_0x1ce45b=_0x1ce45b||0xc8;return function(_0x17dc4c){if(_0x17dc4c){return _0x4b4115['status'](_0x1ce45b)[_0x79b0('0x1c')](_0x17dc4c);}};}function respondWithFilteredResult(_0x27f02a,_0x2a6602){return function(_0x4883c4){if(_0x4883c4){var _0x3e0f94=typeof _0x2a6602[_0x79b0('0x1d')]===_0x79b0('0x1e')&&typeof _0x2a6602['limit']===_0x79b0('0x1e');var _0x1c85ed=_0x4883c4[_0x79b0('0x1f')];var _0x3870e5=_0x3e0f94?0x0:_0x2a6602['offset'];var _0x4f7aab=_0x3e0f94?_0x4883c4['count']:_0x2a6602[_0x79b0('0x1d')]+_0x2a6602[_0x79b0('0x20')];var _0x2c340c;if(_0x4f7aab>=_0x1c85ed){_0x4f7aab=_0x1c85ed;_0x2c340c=0xc8;}else{_0x2c340c=0xce;}_0x27f02a[_0x79b0('0x1a')](_0x2c340c);return _0x27f02a['set'](_0x79b0('0x21'),_0x3870e5+'-'+_0x4f7aab+'/'+_0x1c85ed)[_0x79b0('0x1c')](_0x4883c4);}return null;};}function patchUpdates(_0x122ec0){return function(_0x41b7a0){try{jsonpatch[_0x79b0('0x22')](_0x41b7a0,_0x122ec0,!![]);}catch(_0x41590f){return BPromise[_0x79b0('0x23')](_0x41590f);}return _0x41b7a0[_0x79b0('0x24')]();};}function saveUpdates(_0x26f8af,_0x273946){return function(_0x24040a){if(_0x24040a){return _0x24040a['update'](_0x26f8af)[_0x79b0('0x25')](function(_0x5f4db0){return _0x5f4db0;});}return null;};}function removeEntity(_0x4b8eab,_0x1ccce8){return function(_0x5de2af){if(_0x5de2af){return _0x5de2af[_0x79b0('0x26')]()['then'](function(){_0x4b8eab[_0x79b0('0x1a')](0xcc)[_0x79b0('0x1b')]();});}};}function handleEntityNotFound(_0x4f68a2,_0x5a98ee){return function(_0x24eb22){if(!_0x24eb22){_0x4f68a2[_0x79b0('0x19')](0x194);}return _0x24eb22;};}function handleError(_0xd1ec4,_0x5a0734){_0x5a0734=_0x5a0734||0x1f4;return function(_0x33e345){logger[_0x79b0('0x27')](_0x33e345[_0x79b0('0x28')]);if(_0x33e345[_0x79b0('0x29')]){delete _0x33e345[_0x79b0('0x29')];}_0xd1ec4['status'](_0x5a0734)[_0x79b0('0x2a')](_0x33e345);};}var utilLicense=require(_0x79b0('0x17'));exports[_0x79b0('0x2b')]=function(_0x485418,_0x31a6c8){var _0xbc725f={'raw':!![],'where':{'id':0x1}},_0x215668={};_0x215668[_0x79b0('0x2c')]=_[_0x79b0('0x2d')](db[_0x79b0('0x2e')]['rawAttributes']);_0x215668[_0x79b0('0x2f')]=_[_0x79b0('0x2d')](_0x485418[_0x79b0('0x2f')]);_0x215668[_0x79b0('0x30')]=_[_0x79b0('0x31')](_0x215668[_0x79b0('0x2c')],_0x215668['query']);_0xbc725f[_0x79b0('0x32')]=_[_0x79b0('0x31')](_0x215668[_0x79b0('0x2c')],qs[_0x79b0('0x33')](_0x485418[_0x79b0('0x2f')][_0x79b0('0x33')]));_0xbc725f['attributes']=_0xbc725f[_0x79b0('0x32')]['length']?_0xbc725f[_0x79b0('0x32')]:_0x215668[_0x79b0('0x2c')];_0xbc725f=_['merge']({},_0xbc725f,_0x485418[_0x79b0('0x34')]);return utilLicense['getLicense'](_0xbc725f)[_0x79b0('0x25')](respondWithResult(_0x31a6c8,null))[_0x79b0('0x35')](handleError(_0x31a6c8,null));};exports[_0x79b0('0x36')]=function(_0x5500e5,_0x44f9ce){if(_0x5500e5['body']['id']){delete _0x5500e5['body']['id'];}return db['License']['find']({'where':{'id':_0x5500e5[_0x79b0('0x37')]['id']}})[_0x79b0('0x25')](handleEntityNotFound(_0x44f9ce,null))[_0x79b0('0x25')](function(_0x3b776){var _0x4d2683=_0x3b776[_0x79b0('0x38')]({'plain':!![]});return utilLicense[_0x79b0('0x39')](_0x4d2683,_0x5500e5[_0x79b0('0x3a')][_0x79b0('0x3b')]);})[_0x79b0('0x25')](function(_0x5394f9){if(!_0x5394f9[_0x79b0('0x3c')]){return saveUpdates(_0x5500e5[_0x79b0('0x3a')],null);}return _0x5394f9;})[_0x79b0('0x25')](respondWithResult(_0x44f9ce,null))[_0x79b0('0x35')](handleError(_0x44f9ce,null));};exports[_0x79b0('0x3d')]=function(_0x52a97c,_0x3ab9cf){var _0x42a2bf=_0x79b0('0x3e');var _0x4d5473=path['join'](_0x79b0('0x3f'),_0x79b0('0x40'),_0x79b0('0x41'),_0x42a2bf);_0x3ab9cf[_0x79b0('0x42')](_0x79b0('0x43'),'attachment;\x20filename='+_0x42a2bf);_0x3ab9cf[_0x79b0('0x44')](_0x79b0('0x45'),_0x79b0('0x46'));_0x3ab9cf[_0x79b0('0x47')](_0x4d5473);}; \ No newline at end of file +var _0xc7e2=['rimraf','fast-json-patch','request-promise','moment','mustache','util','sox','to-csv','fs-extra','lodash','squel','crypto','desk.js','querystring','papaparse','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','../../mysqldb','sendStatus','status','end','json','offset','undefined','limit','count','set','Content-Range','update','then','destroy','error','stack','name','../../config/license/util','index','model','keys','query','filters','intersection','attributes','fields','length','merge','options','catch','body','License','find','get','checkLicense','key','demo','downloadLogFile','license-info.log','join','/var','log','xcally','setHeader','Content-disposition','attachment;\x20filename=','Content-Type','text/plain','download','eml-format'];(function(_0x1ba6ad,_0x13e6e9){var _0x3cf481=function(_0x12b0dd){while(--_0x12b0dd){_0x1ba6ad['push'](_0x1ba6ad['shift']());}};_0x3cf481(++_0x13e6e9);}(_0xc7e2,0x117));var _0x2c7e=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0xc7e2[_0x3dd15e];return _0x231fd0;};'use strict';var emlformat=require(_0x2c7e('0x0'));var rimraf=require(_0x2c7e('0x1'));var zipdir=require('zip-dir');var jsonpatch=require(_0x2c7e('0x2'));var rp=require(_0x2c7e('0x3'));var moment=require(_0x2c7e('0x4'));var BPromise=require('bluebird');var Mustache=require(_0x2c7e('0x5'));var util=require(_0x2c7e('0x6'));var path=require('path');var sox=require(_0x2c7e('0x7'));var csv=require(_0x2c7e('0x8'));var ejs=require('ejs');var fs=require('fs');var fs_extra=require(_0x2c7e('0x9'));var _=require(_0x2c7e('0xa'));var squel=require(_0x2c7e('0xb'));var crypto=require(_0x2c7e('0xc'));var jsforce=require('jsforce');var deskjs=require(_0x2c7e('0xd'));var toCsv=require(_0x2c7e('0x8'));var querystring=require(_0x2c7e('0xe'));var Papa=require(_0x2c7e('0xf'));var Redis=require('ioredis');var authService=require(_0x2c7e('0x10'));var qs=require(_0x2c7e('0x11'));var as=require(_0x2c7e('0x12'));var hardwareService=require(_0x2c7e('0x13'));var logger=require(_0x2c7e('0x14'))('api');var utils=require('../../config/utils');var config=require('../../config/environment');var licenseUtil=require('../../config/license/util');var db=require(_0x2c7e('0x15'))['db'];function respondWithStatusCode(_0x21eadd,_0x594fba){_0x594fba=_0x594fba||0xcc;return function(_0xcb5f0c){if(_0xcb5f0c){return _0x21eadd[_0x2c7e('0x16')](_0x594fba);}return _0x21eadd[_0x2c7e('0x17')](_0x594fba)[_0x2c7e('0x18')]();};}function respondWithResult(_0x1a4c2c,_0x448594){_0x448594=_0x448594||0xc8;return function(_0x4df8c6){if(_0x4df8c6){return _0x1a4c2c[_0x2c7e('0x17')](_0x448594)[_0x2c7e('0x19')](_0x4df8c6);}};}function respondWithFilteredResult(_0x292067,_0x4e0169){return function(_0x3fd14d){if(_0x3fd14d){var _0x3419f8=typeof _0x4e0169[_0x2c7e('0x1a')]===_0x2c7e('0x1b')&&typeof _0x4e0169[_0x2c7e('0x1c')]==='undefined';var _0x30e3c8=_0x3fd14d[_0x2c7e('0x1d')];var _0x4e8e60=_0x3419f8?0x0:_0x4e0169[_0x2c7e('0x1a')];var _0x3ca50c=_0x3419f8?_0x3fd14d['count']:_0x4e0169[_0x2c7e('0x1a')]+_0x4e0169[_0x2c7e('0x1c')];var _0x20ae54;if(_0x3ca50c>=_0x30e3c8){_0x3ca50c=_0x30e3c8;_0x20ae54=0xc8;}else{_0x20ae54=0xce;}_0x292067[_0x2c7e('0x17')](_0x20ae54);return _0x292067[_0x2c7e('0x1e')](_0x2c7e('0x1f'),_0x4e8e60+'-'+_0x3ca50c+'/'+_0x30e3c8)[_0x2c7e('0x19')](_0x3fd14d);}return null;};}function patchUpdates(_0x4262e3){return function(_0x457ef6){try{jsonpatch['apply'](_0x457ef6,_0x4262e3,!![]);}catch(_0x4f35b5){return BPromise['reject'](_0x4f35b5);}return _0x457ef6['save']();};}function saveUpdates(_0x44a7c8,_0x84ef5){return function(_0x293485){if(_0x293485){return _0x293485[_0x2c7e('0x20')](_0x44a7c8)[_0x2c7e('0x21')](function(_0x570487){return _0x570487;});}return null;};}function removeEntity(_0x93077b,_0x2a694a){return function(_0x3f1c1b){if(_0x3f1c1b){return _0x3f1c1b[_0x2c7e('0x22')]()['then'](function(){_0x93077b[_0x2c7e('0x17')](0xcc)['end']();});}};}function handleEntityNotFound(_0x15008c,_0x47a827){return function(_0x52917c){if(!_0x52917c){_0x15008c[_0x2c7e('0x16')](0x194);}return _0x52917c;};}function handleError(_0x8de480,_0x2782f1){_0x2782f1=_0x2782f1||0x1f4;return function(_0x3a8ffe){logger[_0x2c7e('0x23')](_0x3a8ffe[_0x2c7e('0x24')]);if(_0x3a8ffe[_0x2c7e('0x25')]){delete _0x3a8ffe['name'];}_0x8de480[_0x2c7e('0x17')](_0x2782f1)['send'](_0x3a8ffe);};}var utilLicense=require(_0x2c7e('0x26'));exports[_0x2c7e('0x27')]=function(_0x385c71,_0x3ce4d3){var _0x3bc714={'raw':!![],'where':{'id':0x1}},_0x8aa78c={};_0x8aa78c[_0x2c7e('0x28')]=_[_0x2c7e('0x29')](db['License']['rawAttributes']);_0x8aa78c[_0x2c7e('0x2a')]=_[_0x2c7e('0x29')](_0x385c71['query']);_0x8aa78c[_0x2c7e('0x2b')]=_[_0x2c7e('0x2c')](_0x8aa78c[_0x2c7e('0x28')],_0x8aa78c['query']);_0x3bc714[_0x2c7e('0x2d')]=_[_0x2c7e('0x2c')](_0x8aa78c[_0x2c7e('0x28')],qs[_0x2c7e('0x2e')](_0x385c71[_0x2c7e('0x2a')]['fields']));_0x3bc714[_0x2c7e('0x2d')]=_0x3bc714[_0x2c7e('0x2d')][_0x2c7e('0x2f')]?_0x3bc714['attributes']:_0x8aa78c[_0x2c7e('0x28')];_0x3bc714=_[_0x2c7e('0x30')]({},_0x3bc714,_0x385c71[_0x2c7e('0x31')]);return utilLicense['getLicense'](_0x3bc714)['then'](respondWithResult(_0x3ce4d3,null))[_0x2c7e('0x32')](handleError(_0x3ce4d3,null));};exports['update']=function(_0x1b74bc,_0xff6cea){if(_0x1b74bc['body']['id']){delete _0x1b74bc[_0x2c7e('0x33')]['id'];}return db[_0x2c7e('0x34')][_0x2c7e('0x35')]({'where':{'id':_0x1b74bc['params']['id']}})['then'](handleEntityNotFound(_0xff6cea,null))[_0x2c7e('0x21')](function(_0x96087c){var _0x565d45=_0x96087c[_0x2c7e('0x36')]({'plain':!![]});return utilLicense[_0x2c7e('0x37')](_0x565d45,_0x1b74bc[_0x2c7e('0x33')][_0x2c7e('0x38')]);})[_0x2c7e('0x21')](function(_0x97e06){if(!_0x97e06[_0x2c7e('0x39')]){return saveUpdates(_0x1b74bc[_0x2c7e('0x33')],null);}return _0x97e06;})[_0x2c7e('0x21')](respondWithResult(_0xff6cea,null))[_0x2c7e('0x32')](handleError(_0xff6cea,null));};exports[_0x2c7e('0x3a')]=function(_0x46f046,_0x5d380a){var _0x2e817d=_0x2c7e('0x3b');var _0x5182c9=path[_0x2c7e('0x3c')](_0x2c7e('0x3d'),_0x2c7e('0x3e'),_0x2c7e('0x3f'),_0x2e817d);_0x5d380a[_0x2c7e('0x40')](_0x2c7e('0x41'),_0x2c7e('0x42')+_0x2e817d);_0x5d380a['set'](_0x2c7e('0x43'),_0x2c7e('0x44'));_0x5d380a[_0x2c7e('0x45')](_0x5182c9);}; \ No newline at end of file diff --git a/server/api/license/license.model.js b/server/api/license/license.model.js index fc8554d..3f1939e 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 _0xbe84=['rimraf','../../config/environment','exports','define','License','license','lodash','../../config/logger','api','moment','bluebird','request-promise','path'];(function(_0x52a6a0,_0x38c78e){var _0x4ab22c=function(_0x1ea6a2){while(--_0x1ea6a2){_0x52a6a0['push'](_0x52a6a0['shift']());}};_0x4ab22c(++_0x38c78e);}(_0xbe84,0x1c0));var _0x4be8=function(_0x126558,_0x143c9a){_0x126558=_0x126558-0x0;var _0x1f6d14=_0xbe84[_0x126558];return _0x1f6d14;};'use strict';var _=require(_0x4be8('0x0'));var util=require('util');var logger=require(_0x4be8('0x1'))(_0x4be8('0x2'));var moment=require(_0x4be8('0x3'));var BPromise=require(_0x4be8('0x4'));var rp=require(_0x4be8('0x5'));var fs=require('fs');var path=require(_0x4be8('0x6'));var rimraf=require(_0x4be8('0x7'));var config=require(_0x4be8('0x8'));var attributes=require('./license.attributes');module[_0x4be8('0x9')]=function(_0x576f9d,_0xdec643){return _0x576f9d[_0x4be8('0xa')](_0x4be8('0xb'),attributes,{'tableName':_0x4be8('0xc'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x2e32=['lodash','../../config/logger','api','bluebird','request-promise','path','rimraf','../../config/environment','./license.attributes'];(function(_0x4daf26,_0x57fccc){var _0x59541b=function(_0x58e306){while(--_0x58e306){_0x4daf26['push'](_0x4daf26['shift']());}};_0x59541b(++_0x57fccc);}(_0x2e32,0xa2));var _0x22e3=function(_0xb24a3e,_0x4a3594){_0xb24a3e=_0xb24a3e-0x0;var _0x4038d7=_0x2e32[_0xb24a3e];return _0x4038d7;};'use strict';var _=require(_0x22e3('0x0'));var util=require('util');var logger=require(_0x22e3('0x1'))(_0x22e3('0x2'));var moment=require('moment');var BPromise=require(_0x22e3('0x3'));var rp=require(_0x22e3('0x4'));var fs=require('fs');var path=require(_0x22e3('0x5'));var rimraf=require(_0x22e3('0x6'));var config=require(_0x22e3('0x7'));var attributes=require(_0x22e3('0x8'));module['exports']=function(_0x22df8f,_0x52c1ce){return _0x22df8f['define']('License',attributes,{'tableName':'license','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 b888c95..f0dfa53 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 _0x5ca7=['License,\x20%s,\x20%s','request\x20sent','debug','License,\x20%s,\x20%s,\x20%s','error','code','message','result','lodash','moment','bluebird','randomstring','../../mysqldb','rpc','../../config/environment','jayson/promise','client','http','request','then','info'];(function(_0x1d2c74,_0x588523){var _0x13c38d=function(_0x262996){while(--_0x262996){_0x1d2c74['push'](_0x1d2c74['shift']());}};_0x13c38d(++_0x588523);}(_0x5ca7,0xda));var _0x75ca=function(_0x5f09c5,_0x2bfca0){_0x5f09c5=_0x5f09c5-0x0;var _0x426ad9=_0x5ca7[_0x5f09c5];return _0x426ad9;};'use strict';var _=require(_0x75ca('0x0'));var util=require('util');var moment=require(_0x75ca('0x1'));var BPromise=require(_0x75ca('0x2'));var rs=require(_0x75ca('0x3'));var fs=require('fs');var Redis=require('ioredis');var db=require(_0x75ca('0x4'))['db'];var utils=require('../../config/utils');var logger=require('../../config/logger')(_0x75ca('0x5'));var config=require(_0x75ca('0x6'));var jayson=require(_0x75ca('0x7'));var client=jayson[_0x75ca('0x8')][_0x75ca('0x9')]({'port':0x232a});function respondWithRpcPromise(_0x525085,_0x195b19,_0x22a6a2){return new BPromise(function(_0x5386cb,_0x4622c7){return client[_0x75ca('0xa')](_0x525085,_0x22a6a2)[_0x75ca('0xb')](function(_0x4ebfdd){logger[_0x75ca('0xc')](_0x75ca('0xd'),_0x195b19,_0x75ca('0xe'));logger[_0x75ca('0xf')](_0x75ca('0x10'),_0x195b19,_0x75ca('0xe'),JSON['stringify'](_0x4ebfdd));if(_0x4ebfdd[_0x75ca('0x11')]){if(_0x4ebfdd[_0x75ca('0x11')][_0x75ca('0x12')]===0x1f4){logger[_0x75ca('0x11')](_0x75ca('0xd'),_0x195b19,_0x4ebfdd[_0x75ca('0x11')]['message']);return _0x4622c7(_0x4ebfdd[_0x75ca('0x11')]['message']);}logger[_0x75ca('0x11')]('License,\x20%s,\x20%s',_0x195b19,_0x4ebfdd['error']['message']);return _0x5386cb(_0x4ebfdd[_0x75ca('0x11')][_0x75ca('0x13')]);}else{logger[_0x75ca('0xc')](_0x75ca('0xd'),_0x195b19,_0x75ca('0xe'));_0x5386cb(_0x4ebfdd[_0x75ca('0x14')][_0x75ca('0x13')]);}})['catch'](function(_0x188b8a){logger[_0x75ca('0x11')](_0x75ca('0xd'),_0x195b19,_0x188b8a);_0x4622c7(_0x188b8a);});});} \ No newline at end of file +var _0xd41f=['bluebird','ioredis','../../mysqldb','../../config/utils','../../config/logger','../../config/environment','jayson/promise','client','request','info','License,\x20%s,\x20%s','request\x20sent','debug','License,\x20%s,\x20%s,\x20%s','stringify','error','message','result','lodash','util','moment'];(function(_0x56daff,_0xadca9a){var _0x132c82=function(_0x19e0d7){while(--_0x19e0d7){_0x56daff['push'](_0x56daff['shift']());}};_0x132c82(++_0xadca9a);}(_0xd41f,0x177));var _0xfd41=function(_0x321bb2,_0x202794){_0x321bb2=_0x321bb2-0x0;var _0x9c12ed=_0xd41f[_0x321bb2];return _0x9c12ed;};'use strict';var _=require(_0xfd41('0x0'));var util=require(_0xfd41('0x1'));var moment=require(_0xfd41('0x2'));var BPromise=require(_0xfd41('0x3'));var rs=require('randomstring');var fs=require('fs');var Redis=require(_0xfd41('0x4'));var db=require(_0xfd41('0x5'))['db'];var utils=require(_0xfd41('0x6'));var logger=require(_0xfd41('0x7'))('rpc');var config=require(_0xfd41('0x8'));var jayson=require(_0xfd41('0x9'));var client=jayson[_0xfd41('0xa')]['http']({'port':0x232a});function respondWithRpcPromise(_0x57c7d3,_0x5d8641,_0x5b6317){return new BPromise(function(_0x56d299,_0x1e0ea3){return client[_0xfd41('0xb')](_0x57c7d3,_0x5b6317)['then'](function(_0x14e111){logger[_0xfd41('0xc')](_0xfd41('0xd'),_0x5d8641,_0xfd41('0xe'));logger[_0xfd41('0xf')](_0xfd41('0x10'),_0x5d8641,'request\x20sent',JSON[_0xfd41('0x11')](_0x14e111));if(_0x14e111['error']){if(_0x14e111['error']['code']===0x1f4){logger[_0xfd41('0x12')](_0xfd41('0xd'),_0x5d8641,_0x14e111[_0xfd41('0x12')][_0xfd41('0x13')]);return _0x1e0ea3(_0x14e111[_0xfd41('0x12')][_0xfd41('0x13')]);}logger[_0xfd41('0x12')](_0xfd41('0xd'),_0x5d8641,_0x14e111['error']['message']);return _0x56d299(_0x14e111[_0xfd41('0x12')]['message']);}else{logger[_0xfd41('0xc')](_0xfd41('0xd'),_0x5d8641,_0xfd41('0xe'));_0x56d299(_0x14e111[_0xfd41('0x14')][_0xfd41('0x13')]);}})['catch'](function(_0x5906cf){logger['error'](_0xfd41('0xd'),_0x5d8641,_0x5906cf);_0x1e0ea3(_0x5906cf);});});} \ No newline at end of file diff --git a/server/api/mailAccount/index.js b/server/api/mailAccount/index.js index 5dc76be..e95f0ce 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 _0xc48e=['../../components/auth/service','../../config/environment','./mailAccount.controller','get','isAuthenticated','describe','/:id','getDispositions','/:id/canned_answers','getAnswers','getImap','/:id/out_servers','getSmtp','/:id/interactions','/:id/applications','getApplications','getMessages','/:id/verify','verifySmtp','/:id/users','getAgents','/:id/dispositions','addDisposition','post','addAnswer','create','/:id/in_servers','addSmtp','addApplications','/:id/send','send','addAgents','put','update','delete','removeDispositions','removeSmtp','destroy','removeAgents','exports','multer','util','connect-timeout','express','Router','fs-extra'];(function(_0x321bb2,_0x202794){var _0x9c12ed=function(_0x263dd3){while(--_0x263dd3){_0x321bb2['push'](_0x321bb2['shift']());}};_0x9c12ed(++_0x202794);}(_0xc48e,0x84));var _0xec48=function(_0x1c5407,_0x250d9f){_0x1c5407=_0x1c5407-0x0;var _0x114b26=_0xc48e[_0x1c5407];return _0x114b26;};'use strict';var multer=require(_0xec48('0x0'));var util=require(_0xec48('0x1'));var path=require('path');var timeout=require(_0xec48('0x2'));var express=require(_0xec48('0x3'));var router=express[_0xec48('0x4')]();var fs_extra=require(_0xec48('0x5'));var auth=require(_0xec48('0x6'));var interaction=require('../../components/interaction/service');var config=require(_0xec48('0x7'));var controller=require(_0xec48('0x8'));router[_0xec48('0x9')]('/',auth[_0xec48('0xa')](),controller['index']);router[_0xec48('0x9')]('/describe',auth[_0xec48('0xa')](),controller[_0xec48('0xb')]);router[_0xec48('0x9')](_0xec48('0xc'),auth['isAuthenticated'](),controller['show']);router[_0xec48('0x9')]('/:id/dispositions',auth[_0xec48('0xa')](),controller[_0xec48('0xd')]);router[_0xec48('0x9')](_0xec48('0xe'),auth[_0xec48('0xa')](),controller[_0xec48('0xf')]);router[_0xec48('0x9')]('/:id/in_servers',auth[_0xec48('0xa')](),controller[_0xec48('0x10')]);router[_0xec48('0x9')](_0xec48('0x11'),auth[_0xec48('0xa')](),controller[_0xec48('0x12')]);router['get'](_0xec48('0x13'),auth[_0xec48('0xa')](),controller['getInteractions']);router[_0xec48('0x9')](_0xec48('0x14'),auth[_0xec48('0xa')](),controller[_0xec48('0x15')]);router[_0xec48('0x9')]('/:id/messages',auth[_0xec48('0xa')](),controller[_0xec48('0x16')]);router[_0xec48('0x9')](_0xec48('0x17'),auth[_0xec48('0xa')](),controller[_0xec48('0x18')]);router[_0xec48('0x9')](_0xec48('0x19'),auth[_0xec48('0xa')](),controller[_0xec48('0x1a')]);router['post'](_0xec48('0x1b'),auth['isAuthenticated'](),controller[_0xec48('0x1c')]);router[_0xec48('0x1d')](_0xec48('0xe'),auth[_0xec48('0xa')](),controller[_0xec48('0x1e')]);router['post']('/',auth[_0xec48('0xa')](),controller[_0xec48('0x1f')]);router['post'](_0xec48('0x20'),auth[_0xec48('0xa')](),controller['addImap']);router['post'](_0xec48('0x11'),auth['isAuthenticated'](),controller[_0xec48('0x21')]);router[_0xec48('0x1d')](_0xec48('0x13'),auth[_0xec48('0xa')](),controller['addInteraction']);router['post']('/:id/applications',auth[_0xec48('0xa')](),controller[_0xec48('0x22')]);router['post'](_0xec48('0x23'),auth[_0xec48('0xa')](),controller[_0xec48('0x24')]);router[_0xec48('0x1d')](_0xec48('0x19'),auth[_0xec48('0xa')](),controller[_0xec48('0x25')]);router[_0xec48('0x26')](_0xec48('0xc'),auth[_0xec48('0xa')](),controller[_0xec48('0x27')]);router[_0xec48('0x28')](_0xec48('0x1b'),auth[_0xec48('0xa')](),controller[_0xec48('0x29')]);router[_0xec48('0x28')](_0xec48('0xe'),auth[_0xec48('0xa')](),controller['removeAnswers']);router[_0xec48('0x28')](_0xec48('0x20'),auth[_0xec48('0xa')](),controller['removeImap']);router[_0xec48('0x28')]('/:id/out_servers',auth[_0xec48('0xa')](),controller[_0xec48('0x2a')]);router[_0xec48('0x28')](_0xec48('0xc'),auth[_0xec48('0xa')](),controller[_0xec48('0x2b')]);router[_0xec48('0x28')](_0xec48('0x19'),auth[_0xec48('0xa')](),controller[_0xec48('0x2c')]);module[_0xec48('0x2d')]=router; \ No newline at end of file +var _0x5a77=['./mailAccount.controller','get','index','/describe','isAuthenticated','/:id','show','getDispositions','/:id/canned_answers','getAnswers','getImap','/:id/out_servers','/:id/interactions','/:id/applications','getApplications','/:id/messages','/:id/verify','verifySmtp','getAgents','/:id/dispositions','addDisposition','post','addAnswer','addInteraction','/:id/send','send','put','update','removeDispositions','delete','/:id/in_servers','removeImap','removeSmtp','destroy','/:id/users','removeAgents','exports','multer','util','path','connect-timeout','express','Router','fs-extra','../../components/auth/service'];(function(_0x1541c6,_0x170408){var _0x41901b=function(_0x517db0){while(--_0x517db0){_0x1541c6['push'](_0x1541c6['shift']());}};_0x41901b(++_0x170408);}(_0x5a77,0x18d));var _0x75a7=function(_0x1e565a,_0x17dce7){_0x1e565a=_0x1e565a-0x0;var _0x356df5=_0x5a77[_0x1e565a];return _0x356df5;};'use strict';var multer=require(_0x75a7('0x0'));var util=require(_0x75a7('0x1'));var path=require(_0x75a7('0x2'));var timeout=require(_0x75a7('0x3'));var express=require(_0x75a7('0x4'));var router=express[_0x75a7('0x5')]();var fs_extra=require(_0x75a7('0x6'));var auth=require(_0x75a7('0x7'));var interaction=require('../../components/interaction/service');var config=require('../../config/environment');var controller=require(_0x75a7('0x8'));router[_0x75a7('0x9')]('/',auth['isAuthenticated'](),controller[_0x75a7('0xa')]);router['get'](_0x75a7('0xb'),auth[_0x75a7('0xc')](),controller['describe']);router[_0x75a7('0x9')](_0x75a7('0xd'),auth[_0x75a7('0xc')](),controller[_0x75a7('0xe')]);router[_0x75a7('0x9')]('/:id/dispositions',auth[_0x75a7('0xc')](),controller[_0x75a7('0xf')]);router[_0x75a7('0x9')](_0x75a7('0x10'),auth[_0x75a7('0xc')](),controller[_0x75a7('0x11')]);router[_0x75a7('0x9')]('/:id/in_servers',auth[_0x75a7('0xc')](),controller[_0x75a7('0x12')]);router['get'](_0x75a7('0x13'),auth[_0x75a7('0xc')](),controller['getSmtp']);router[_0x75a7('0x9')](_0x75a7('0x14'),auth['isAuthenticated'](),controller['getInteractions']);router[_0x75a7('0x9')](_0x75a7('0x15'),auth[_0x75a7('0xc')](),controller[_0x75a7('0x16')]);router['get'](_0x75a7('0x17'),auth[_0x75a7('0xc')](),controller['getMessages']);router[_0x75a7('0x9')](_0x75a7('0x18'),auth[_0x75a7('0xc')](),controller[_0x75a7('0x19')]);router[_0x75a7('0x9')]('/:id/users',auth[_0x75a7('0xc')](),controller[_0x75a7('0x1a')]);router['post'](_0x75a7('0x1b'),auth['isAuthenticated'](),controller[_0x75a7('0x1c')]);router[_0x75a7('0x1d')](_0x75a7('0x10'),auth[_0x75a7('0xc')](),controller[_0x75a7('0x1e')]);router['post']('/',auth['isAuthenticated'](),controller['create']);router['post']('/:id/in_servers',auth[_0x75a7('0xc')](),controller['addImap']);router[_0x75a7('0x1d')]('/:id/out_servers',auth[_0x75a7('0xc')](),controller['addSmtp']);router[_0x75a7('0x1d')](_0x75a7('0x14'),auth['isAuthenticated'](),controller[_0x75a7('0x1f')]);router['post'](_0x75a7('0x15'),auth['isAuthenticated'](),controller['addApplications']);router[_0x75a7('0x1d')](_0x75a7('0x20'),auth['isAuthenticated'](),controller[_0x75a7('0x21')]);router['post']('/:id/users',auth['isAuthenticated'](),controller['addAgents']);router[_0x75a7('0x22')]('/:id',auth[_0x75a7('0xc')](),controller[_0x75a7('0x23')]);router['delete'](_0x75a7('0x1b'),auth[_0x75a7('0xc')](),controller[_0x75a7('0x24')]);router[_0x75a7('0x25')]('/:id/canned_answers',auth[_0x75a7('0xc')](),controller['removeAnswers']);router['delete'](_0x75a7('0x26'),auth['isAuthenticated'](),controller[_0x75a7('0x27')]);router[_0x75a7('0x25')]('/:id/out_servers',auth[_0x75a7('0xc')](),controller[_0x75a7('0x28')]);router[_0x75a7('0x25')](_0x75a7('0xd'),auth[_0x75a7('0xc')](),controller[_0x75a7('0x29')]);router[_0x75a7('0x25')](_0x75a7('0x2a'),auth[_0x75a7('0xc')](),controller[_0x75a7('0x2b')]);module[_0x75a7('0x2c')]=router; \ No newline at end of file diff --git a/server/api/mailAccount/mailAccount.attributes.js b/server/api/mailAccount/mailAccount.attributes.js index 0da1c12..7c5c33a 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 _0xf225=['hotmail','yahoo','getDataValue','provider','custom','exports','STRING','BOOLEAN','Arial,Helvetica,sans-serif','INTEGER','UNSIGNED','TEXT','Account:\x20{{account.name}}
{{#queue}}Queue:\x20{{queue.name}}
{{/queue}}From\x20:\x20{{from}}
Subject\x20:\x20{{message.subject}}','Enabled/disables\x20mandatory\x20dispo\x20on\x20a\x20queue','mandatoryDispositionPauseId','setDataValue','ENUM'];(function(_0x3dd15e,_0x1f0015){var _0x231fd0=function(_0x4f680a){while(--_0x4f680a){_0x3dd15e['push'](_0x3dd15e['shift']());}};_0x231fd0(++_0x1f0015);}(_0xf225,0xd1));var _0x5f22=function(_0x54da44,_0x170596){_0x54da44=_0x54da44-0x0;var _0x55da37=_0xf225[_0x54da44];return _0x55da37;};'use strict';var Sequelize=require('sequelize');module[_0x5f22('0x0')]={'description':{'type':Sequelize['STRING']},'name':{'type':Sequelize[_0x5f22('0x1')],'allowNull':![]},'service':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'email':{'type':Sequelize[_0x5f22('0x1')],'validate':{'isEmail':!![]}},'active':{'type':Sequelize['BOOLEAN'],'defaultValue':!![]},'key':{'type':Sequelize[_0x5f22('0x1')],'allowNull':![]},'template':{'type':Sequelize['TEXT']},'markAsUnread':{'type':Sequelize[_0x5f22('0x2')],'defaultValue':![]},'fontFamily':{'type':Sequelize['STRING'],'allowNull':![],'defaultValue':_0x5f22('0x3')},'fontSize':{'type':Sequelize[_0x5f22('0x4')](0x2)[_0x5f22('0x5')],'defaultValue':0xd,'validate':{'min':0x8,'max':0x48}},'notificationTemplate':{'type':Sequelize[_0x5f22('0x6')],'defaultValue':function(){return _0x5f22('0x7');}},'notificationSound':{'type':Sequelize[_0x5f22('0x2')],'defaultValue':!![]},'notificationShake':{'type':Sequelize[_0x5f22('0x2')],'defaultValue':![]},'waitForTheAssignedAgent':{'type':Sequelize['INTEGER'],'validate':{'min':0x1,'max':0x20c49b},'defaultValue':0xa},'waitForTheAssignedQueue':{'type':Sequelize[_0x5f22('0x4')],'validate':{'min':0x1,'max':0x20c49b},'defaultValue':0xa},'queueTransfer':{'type':Sequelize[_0x5f22('0x2')],'defaultValue':![]},'queueTransferTimeout':{'type':Sequelize[_0x5f22('0x4')],'validate':{'min':0x1,'max':0x20c49b},'defaultValue':0x12c},'agentTransfer':{'type':Sequelize[_0x5f22('0x2')],'defaultValue':![]},'agentTransferTimeout':{'type':Sequelize[_0x5f22('0x4')],'validate':{'min':0x1,'max':0x20c49b},'defaultValue':0x12c},'mandatoryDispositionPauseId':{'type':Sequelize[_0x5f22('0x4')],'allowNull':!![],'defaultValue':null,'comment':'Status\x20to\x20put\x20when\x20mandatory\x20disposition\x20is\x20enabled'},'mandatoryDisposition':{'type':Sequelize['BOOLEAN'],'defaultValue':![],'comment':_0x5f22('0x8'),'set':function(_0x97ff53){if(!_0x97ff53)this['setDataValue'](_0x5f22('0x9'),null);this[_0x5f22('0xa')]('mandatoryDisposition',_0x97ff53);}},'provider':{'type':Sequelize[_0x5f22('0xb')]('gmail',_0x5f22('0xc'),_0x5f22('0xd'),'outlook365'),'defaultValue':null,'get':function(){var _0x272980=this[_0x5f22('0xe')](_0x5f22('0xf'));return _0x272980||_0x5f22('0x10');},'set':function(_0x14358f){if(_0x14358f===_0x5f22('0x10')){_0x14358f=null;}return this[_0x5f22('0xa')](_0x5f22('0xf'),_0x14358f);}}}; \ No newline at end of file +var _0xe855=['hotmail','getDataValue','provider','custom','sequelize','STRING','BOOLEAN','TEXT','Arial,Helvetica,sans-serif','INTEGER','UNSIGNED','Account:\x20{{account.name}}
{{#queue}}Queue:\x20{{queue.name}}
{{/queue}}From\x20:\x20{{from}}
Subject\x20:\x20{{message.subject}}','setDataValue','mandatoryDispositionPauseId','mandatoryDisposition','ENUM','gmail'];(function(_0x4fbb3e,_0x55785f){var _0x1eb197=function(_0xfda25){while(--_0xfda25){_0x4fbb3e['push'](_0x4fbb3e['shift']());}};_0x1eb197(++_0x55785f);}(_0xe855,0x1cf));var _0x5e85=function(_0x453327,_0x3ebe4a){_0x453327=_0x453327-0x0;var _0x1d5a70=_0xe855[_0x453327];return _0x1d5a70;};'use strict';var Sequelize=require(_0x5e85('0x0'));module['exports']={'description':{'type':Sequelize['STRING']},'name':{'type':Sequelize[_0x5e85('0x1')],'allowNull':![]},'service':{'type':Sequelize[_0x5e85('0x2')],'defaultValue':![]},'email':{'type':Sequelize[_0x5e85('0x1')],'validate':{'isEmail':!![]}},'active':{'type':Sequelize[_0x5e85('0x2')],'defaultValue':!![]},'key':{'type':Sequelize[_0x5e85('0x1')],'allowNull':![]},'template':{'type':Sequelize[_0x5e85('0x3')]},'markAsUnread':{'type':Sequelize[_0x5e85('0x2')],'defaultValue':![]},'fontFamily':{'type':Sequelize[_0x5e85('0x1')],'allowNull':![],'defaultValue':_0x5e85('0x4')},'fontSize':{'type':Sequelize[_0x5e85('0x5')](0x2)[_0x5e85('0x6')],'defaultValue':0xd,'validate':{'min':0x8,'max':0x48}},'notificationTemplate':{'type':Sequelize[_0x5e85('0x3')],'defaultValue':function(){return _0x5e85('0x7');}},'notificationSound':{'type':Sequelize[_0x5e85('0x2')],'defaultValue':!![]},'notificationShake':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'waitForTheAssignedAgent':{'type':Sequelize['INTEGER'],'validate':{'min':0x1,'max':0x20c49b},'defaultValue':0xa},'waitForTheAssignedQueue':{'type':Sequelize[_0x5e85('0x5')],'validate':{'min':0x1,'max':0x20c49b},'defaultValue':0xa},'queueTransfer':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'queueTransferTimeout':{'type':Sequelize[_0x5e85('0x5')],'validate':{'min':0x1,'max':0x20c49b},'defaultValue':0x12c},'agentTransfer':{'type':Sequelize[_0x5e85('0x2')],'defaultValue':![]},'agentTransferTimeout':{'type':Sequelize['INTEGER'],'validate':{'min':0x1,'max':0x20c49b},'defaultValue':0x12c},'mandatoryDispositionPauseId':{'type':Sequelize[_0x5e85('0x5')],'allowNull':!![],'defaultValue':null,'comment':'Status\x20to\x20put\x20when\x20mandatory\x20disposition\x20is\x20enabled'},'mandatoryDisposition':{'type':Sequelize[_0x5e85('0x2')],'defaultValue':![],'comment':'Enabled/disables\x20mandatory\x20dispo\x20on\x20a\x20queue','set':function(_0x4f2528){if(!_0x4f2528)this[_0x5e85('0x8')](_0x5e85('0x9'),null);this['setDataValue'](_0x5e85('0xa'),_0x4f2528);}},'provider':{'type':Sequelize[_0x5e85('0xb')](_0x5e85('0xc'),_0x5e85('0xd'),'yahoo','outlook365'),'defaultValue':null,'get':function(){var _0x3d7d55=this[_0x5e85('0xe')](_0x5e85('0xf'));return _0x3d7d55||'custom';},'set':function(_0x4c1a21){if(_0x4c1a21===_0x5e85('0x10')){_0x4c1a21=null;}return this[_0x5e85('0x8')]('provider',_0x4c1a21);}}}; \ No newline at end of file diff --git a/server/api/mailAccount/mailAccount.controller.js b/server/api/mailAccount/mailAccount.controller.js index 0d5c0c9..3ceea6d 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 _0x9b1b=['MailServerOut','find','update','body','provider','Mail\x20Account\x20not\x20found','describe','addDisposition','MailAccountId','Disposition','create','getDispositions','findOne','nolimit','pick','map','rows','removeDispositions','CannedAnswer','getAnswers','order','removeAnswers','ids','custom','email','ListId','isNil','active','description','Unable\x20to\x20retrieve\x20the\x20current\x20user','role','UserProfileSection','userProfileId','getImap','addImap','removeImap','setImap','getSmtp','addSmtp','removeSmtp','setSmtp','addInteraction','omit','MailInteraction','CmContact','Contact','User','Owner','fullname','Tags','color','tag','addApplications','sequelize','transaction','Transaction','READ_COMMITTED','MailApplication','findAndCountAll','priority','stack','getApplications','MailMessage','$gte','YYYY-MM-DD\x20HH:mm:ss','inlineCss','true','split','List','Contacts','updatedAt','DESC','CloudProvider','Smtp\x20configuration\x20not\x20found','from','format','%s\x20<%s>','user','attachments','join','root','basename','getSmtpOptions','SendMail','sendMail','List\x20not\x20found','messageId','subject','attach','out','verifySmtp','VerifySmtp','destroy','Sequelize','ValidationError','You\x20can\x27t\x20remove\x20the\x20mail\x20service\x20account','addAgents','spread','emit','userMailAccount:save','removeAgents','isArray','userMailAccount:remove','getAgents','moment','bluebird','util','path','lodash','juice','ioredis','../../components/parsers/qs','../../config/logger','api','../../config/environment','../../mysqldb','redis','defaults','localhost','socket.io-emitter','./mailAccount.socket','jayson/promise','http','MailAccount,\x20%s,\x20%s','request\x20sent','debug','MailAccount,\x20%s,\x20%s,\x20%s','stringify','error','code','message','result','catch','sendStatus','status','end','json','offset','undefined','limit','count','set','Content-Range','then','get','MailAccounts','UserProfileResource','name','send','gmail','imap.gmail.com','hotmail','imap-mail.outlook.com','outlook365','outlook.office365.com','Unknown\x20email\x20service\x20provider','smtp.gmail.com','yahoo','smtp.mail.yahoo.com','smtp-mail.outlook.com','smtp.office365.com','username','pass','password','modernAuthentication','CloudProviderId','host','port','secure','service','authentication','Imap','Smtp','index','MailServerIn','Pause','mandatoryDispositionPause','MailAccount','rawAttributes','fieldName','type','key','model','keys','query','filters','attributes','intersection','fields','length','hasOwnProperty','sort','where','filter','merge','VIRTUAL','options','includeAll','include','findAll','show','params'];(function(_0x5cc635,_0x3444a5){var _0x37e4ca=function(_0x59f131){while(--_0x59f131){_0x5cc635['push'](_0x5cc635['shift']());}};_0x37e4ca(++_0x3444a5);}(_0x9b1b,0x132));var _0xb9b1=function(_0x3d0af8,_0x3faeec){_0x3d0af8=_0x3d0af8-0x0;var _0x4ff111=_0x9b1b[_0x3d0af8];return _0x4ff111;};'use strict';var moment=require(_0xb9b1('0x0'));var BPromise=require(_0xb9b1('0x1'));var util=require(_0xb9b1('0x2'));var path=require(_0xb9b1('0x3'));var _=require(_0xb9b1('0x4'));var juice=require(_0xb9b1('0x5'));var Redis=require(_0xb9b1('0x6'));var qs=require(_0xb9b1('0x7'));var logger=require(_0xb9b1('0x8'))(_0xb9b1('0x9'));var config=require(_0xb9b1('0xa'));var db=require(_0xb9b1('0xb'))['db'];config[_0xb9b1('0xc')]=_[_0xb9b1('0xd')](config[_0xb9b1('0xc')],{'host':_0xb9b1('0xe'),'port':0x18eb});var socket=require(_0xb9b1('0xf'))(new Redis(config[_0xb9b1('0xc')]));require(_0xb9b1('0x10'))['register'](socket);var jayson=require(_0xb9b1('0x11'));var client=jayson['client'][_0xb9b1('0x12')]({'port':0x232b});function respondWithRpcPromise(_0x5e735c,_0x5c521e,_0x380ba7,_0x52010d){return new BPromise(function(_0xc46043,_0xe52411){var _0x54f7cf=_0x52010d||client;return _0x54f7cf['request'](_0x5e735c,_0x380ba7)['then'](function(_0x56f047){logger['info'](_0xb9b1('0x13'),_0x5c521e,_0xb9b1('0x14'));logger[_0xb9b1('0x15')](_0xb9b1('0x16'),_0x5c521e,_0xb9b1('0x14'),JSON[_0xb9b1('0x17')](_0x56f047));if(_0x56f047['error']){if(_0x56f047[_0xb9b1('0x18')][_0xb9b1('0x19')]===0x1f4){logger[_0xb9b1('0x18')](_0xb9b1('0x13'),_0x5c521e,_0x56f047[_0xb9b1('0x18')]['message']);return _0xe52411(_0x56f047[_0xb9b1('0x18')][_0xb9b1('0x1a')]);}logger[_0xb9b1('0x18')]('MailAccount,\x20%s,\x20%s',_0x5c521e,_0x56f047['error']['message']);return _0xc46043(_0x56f047[_0xb9b1('0x18')]['message']);}else{logger['info'](_0xb9b1('0x13'),_0x5c521e,_0xb9b1('0x14'));_0xc46043(_0x56f047[_0xb9b1('0x1b')]['message']);}})[_0xb9b1('0x1c')](function(_0x71f870){logger[_0xb9b1('0x18')](_0xb9b1('0x13'),_0x5c521e,_0x71f870);_0xe52411(_0x71f870);});});}function respondWithStatusCode(_0x3f2659,_0x3cd85c){_0x3cd85c=_0x3cd85c||0xcc;return function(_0x1be85b){if(_0x1be85b){return _0x3f2659[_0xb9b1('0x1d')](_0x3cd85c);}return _0x3f2659[_0xb9b1('0x1e')](_0x3cd85c)[_0xb9b1('0x1f')]();};}function respondWithResult(_0x21f40b,_0x57e734){_0x57e734=_0x57e734||0xc8;return function(_0x1502c8){if(_0x1502c8){return _0x21f40b['status'](_0x57e734)[_0xb9b1('0x20')](_0x1502c8);}};}function respondWithFilteredResult(_0x2ad5b1,_0x40bcfb){return function(_0x1891d3){if(_0x1891d3){var _0x42153a=typeof _0x40bcfb[_0xb9b1('0x21')]===_0xb9b1('0x22')&&typeof _0x40bcfb[_0xb9b1('0x23')]===_0xb9b1('0x22');var _0x147d94=_0x1891d3['count'];var _0x4e438f=_0x42153a?0x0:_0x40bcfb[_0xb9b1('0x21')];var _0x4c12d5=_0x42153a?_0x1891d3[_0xb9b1('0x24')]:_0x40bcfb['offset']+_0x40bcfb[_0xb9b1('0x23')];var _0x53cfc7;if(_0x4c12d5>=_0x147d94){_0x4c12d5=_0x147d94;_0x53cfc7=0xc8;}else{_0x53cfc7=0xce;}_0x2ad5b1['status'](_0x53cfc7);return _0x2ad5b1[_0xb9b1('0x25')](_0xb9b1('0x26'),_0x4e438f+'-'+_0x4c12d5+'/'+_0x147d94)[_0xb9b1('0x20')](_0x1891d3);}return null;};}function saveUpdates(_0x356afe){return function(_0x9328b3){if(_0x9328b3){return _0x9328b3['update'](_0x356afe)[_0xb9b1('0x27')](function(_0x3e1c47){return _0x3e1c47;});}return null;};}function removeEntity(_0x244025){return function(_0x4c9fc6){if(_0x4c9fc6){return _0x4c9fc6['destroy']()[_0xb9b1('0x27')](function(){var _0x2d88f4=_0x4c9fc6[_0xb9b1('0x28')]({'plain':!![]});var _0x1a7c6b=_0xb9b1('0x29');return db[_0xb9b1('0x2a')]['destroy']({'where':{'type':_0x1a7c6b,'resourceId':_0x2d88f4['id']}})[_0xb9b1('0x27')](function(){return _0x4c9fc6;});})[_0xb9b1('0x27')](function(){_0x244025[_0xb9b1('0x1e')](0xcc)[_0xb9b1('0x1f')]();});}};}function handleEntityNotFound(_0x230804){return function(_0x32ee59){if(!_0x32ee59){_0x230804['sendStatus'](0x194);}return _0x32ee59;};}function handleError(_0x35070e,_0x4663c){_0x4663c=_0x4663c||0x1f4;return function(_0x2af128){logger['error'](_0x2af128['stack']);if(_0x2af128[_0xb9b1('0x2b')]){delete _0x2af128[_0xb9b1('0x2b')];}_0x35070e[_0xb9b1('0x1e')](_0x4663c)[_0xb9b1('0x2c')](_0x2af128);};}function getImapHost(_0x42fe9e){switch(_0x42fe9e){case _0xb9b1('0x2d'):return _0xb9b1('0x2e');case'yahoo':return'imap.mail.yahoo.com';case _0xb9b1('0x2f'):return _0xb9b1('0x30');case _0xb9b1('0x31'):return _0xb9b1('0x32');}throw new Error(_0xb9b1('0x33'),_0x42fe9e);}function getSmtpHost(_0xdd29b3){switch(_0xdd29b3){case'gmail':return _0xb9b1('0x34');case _0xb9b1('0x35'):return _0xb9b1('0x36');case _0xb9b1('0x2f'):return _0xb9b1('0x37');case _0xb9b1('0x31'):return _0xb9b1('0x38');}throw new Error(_0xb9b1('0x33'),_0xdd29b3);}function getAuthenticationOptions(_0x539ac2,_0x31f31c){var _0x29767a={};var _0x5b42b1={};if(_0x539ac2){_0x29767a['user']=_0x5b42b1['user']=_0x31f31c[_0xb9b1('0x39')];_0x29767a['password']=_0x5b42b1[_0xb9b1('0x3a')]=_0x31f31c[_0xb9b1('0x3b')];if(_0x31f31c[_0xb9b1('0x3c')]){_0x29767a['modernAuthentication']=_0x5b42b1[_0xb9b1('0x3c')]=!![];_0x29767a[_0xb9b1('0x3d')]=_0x5b42b1[_0xb9b1('0x3d')]=_0x31f31c[_0xb9b1('0x3d')];_0x29767a[_0xb9b1('0x3b')]=_0x5b42b1['pass']=null;}else{_0x29767a[_0xb9b1('0x3d')]=_0x5b42b1[_0xb9b1('0x3d')]=null;}_0x29767a[_0xb9b1('0x3e')]=getImapHost(_0x539ac2);_0x29767a['port']=0x3e1;_0x5b42b1['host']=getSmtpHost(_0x539ac2);_0x5b42b1[_0xb9b1('0x3f')]=0x24b;_0x5b42b1[_0xb9b1('0x40')]=![];_0x29767a[_0xb9b1('0x41')]=_0x5b42b1[_0xb9b1('0x41')]=null;}else{if(_0x31f31c[_0xb9b1('0x42')]){_0x29767a['user']=_0x5b42b1['user']=_0x31f31c['username'];_0x29767a[_0xb9b1('0x3b')]=_0x5b42b1[_0xb9b1('0x3a')]=_0x31f31c[_0xb9b1('0x3b')];}else{_0x29767a['authentication']=_0x5b42b1[_0xb9b1('0x42')]=![];_0x29767a['user']=_0x5b42b1['user']=null;_0x29767a[_0xb9b1('0x3b')]=_0x5b42b1[_0xb9b1('0x3a')]=null;}_0x29767a['host']=_0x31f31c[_0xb9b1('0x43')][_0xb9b1('0x3e')];_0x29767a[_0xb9b1('0x3f')]=_0x31f31c[_0xb9b1('0x43')][_0xb9b1('0x3f')];_0x5b42b1['host']=_0x31f31c[_0xb9b1('0x44')][_0xb9b1('0x3e')];_0x5b42b1[_0xb9b1('0x3f')]=_0x31f31c[_0xb9b1('0x44')][_0xb9b1('0x3f')];}return{'Imap':_0x29767a,'Smtp':_0x5b42b1};}exports[_0xb9b1('0x45')]=function(_0x19c3d8,_0xa6a7c6){var _0x26057a={'include':[{'model':db[_0xb9b1('0x46')],'as':'Imap'},{'model':db['MailServerOut'],'as':_0xb9b1('0x44')},{'model':db[_0xb9b1('0x47')],'as':_0xb9b1('0x48')}]},_0x374e9d={},_0x17074b={'count':0x0,'rows':[]};var _0x3e281f=_['map'](db[_0xb9b1('0x49')][_0xb9b1('0x4a')],function(_0x1d5da9){return{'name':_0x1d5da9[_0xb9b1('0x4b')],'type':_0x1d5da9[_0xb9b1('0x4c')][_0xb9b1('0x4d')]};});_0x374e9d[_0xb9b1('0x4e')]=_['map'](_0x3e281f,_0xb9b1('0x2b'));_0x374e9d['query']=_[_0xb9b1('0x4f')](_0x19c3d8[_0xb9b1('0x50')]);_0x374e9d[_0xb9b1('0x51')]=_['intersection'](_0x374e9d['model'],_0x374e9d[_0xb9b1('0x50')]);_0x26057a[_0xb9b1('0x52')]=_[_0xb9b1('0x53')](_0x374e9d[_0xb9b1('0x4e')],qs[_0xb9b1('0x54')](_0x19c3d8[_0xb9b1('0x50')][_0xb9b1('0x54')]));_0x26057a['attributes']=_0x26057a[_0xb9b1('0x52')][_0xb9b1('0x55')]?_0x26057a['attributes']:_0x374e9d[_0xb9b1('0x4e')];if(!_0x19c3d8[_0xb9b1('0x50')][_0xb9b1('0x56')]('nolimit')){_0x26057a[_0xb9b1('0x23')]=qs[_0xb9b1('0x23')](_0x19c3d8['query'][_0xb9b1('0x23')]);_0x26057a[_0xb9b1('0x21')]=qs[_0xb9b1('0x21')](_0x19c3d8[_0xb9b1('0x50')]['offset']);}_0x26057a['order']=qs[_0xb9b1('0x57')](_0x19c3d8[_0xb9b1('0x50')]['sort']);_0x26057a[_0xb9b1('0x58')]=qs[_0xb9b1('0x51')](_['pick'](_0x19c3d8[_0xb9b1('0x50')],_0x374e9d[_0xb9b1('0x51')]),_0x3e281f);if(_0x19c3d8[_0xb9b1('0x50')][_0xb9b1('0x59')]){_0x26057a[_0xb9b1('0x58')]=_[_0xb9b1('0x5a')](_0x26057a[_0xb9b1('0x58')],{'$or':_['map'](_0x3e281f,function(_0x2a32fb){if(_0x2a32fb[_0xb9b1('0x4c')]!==_0xb9b1('0x5b')){var _0x486a0d={};_0x486a0d[_0x2a32fb[_0xb9b1('0x2b')]]={'$like':'%'+_0x19c3d8['query'][_0xb9b1('0x59')]+'%'};return _0x486a0d;}})});}_0x26057a=_[_0xb9b1('0x5a')]({},_0x26057a,_0x19c3d8[_0xb9b1('0x5c')]);var _0x4f180c={'where':_0x26057a[_0xb9b1('0x58')]};return db[_0xb9b1('0x49')]['count'](_0x4f180c)['then'](function(_0x1c98e6){_0x17074b[_0xb9b1('0x24')]=_0x1c98e6;if(_0x19c3d8[_0xb9b1('0x50')][_0xb9b1('0x5d')]){_0x26057a[_0xb9b1('0x5e')]=[{'all':!![]}];}return db[_0xb9b1('0x49')][_0xb9b1('0x5f')](_0x26057a);})[_0xb9b1('0x27')](function(_0x31e15f){_0x17074b['rows']=_0x31e15f;return _0x17074b;})['then'](respondWithFilteredResult(_0xa6a7c6,_0x26057a))[_0xb9b1('0x1c')](handleError(_0xa6a7c6,null));};exports[_0xb9b1('0x60')]=function(_0x58ce40,_0x184bbe){var _0x5be9be={'raw':![],'where':{'id':_0x58ce40[_0xb9b1('0x61')]['id']},'include':[{'model':db[_0xb9b1('0x46')],'as':_0xb9b1('0x43')},{'model':db[_0xb9b1('0x62')],'as':_0xb9b1('0x44')},{'model':db[_0xb9b1('0x47')],'as':_0xb9b1('0x48')}]},_0x3fc9ec={};_0x3fc9ec['model']=_[_0xb9b1('0x4f')](db[_0xb9b1('0x49')][_0xb9b1('0x4a')]);_0x3fc9ec[_0xb9b1('0x50')]=_[_0xb9b1('0x4f')](_0x58ce40['query']);_0x3fc9ec['filters']=_[_0xb9b1('0x53')](_0x3fc9ec[_0xb9b1('0x4e')],_0x3fc9ec[_0xb9b1('0x50')]);_0x5be9be[_0xb9b1('0x52')]=_['intersection'](_0x3fc9ec['model'],qs[_0xb9b1('0x54')](_0x58ce40[_0xb9b1('0x50')][_0xb9b1('0x54')]));_0x5be9be[_0xb9b1('0x52')]=_0x5be9be[_0xb9b1('0x52')][_0xb9b1('0x55')]?_0x5be9be[_0xb9b1('0x52')]:_0x3fc9ec['model'];if(_0x58ce40[_0xb9b1('0x50')][_0xb9b1('0x5d')]){_0x5be9be[_0xb9b1('0x5e')]=[{'all':!![]}];}_0x5be9be=_['merge']({},_0x5be9be,_0x58ce40[_0xb9b1('0x5c')]);return db[_0xb9b1('0x49')][_0xb9b1('0x63')](_0x5be9be)['then'](handleEntityNotFound(_0x184bbe,null))['then'](respondWithResult(_0x184bbe,null))['catch'](handleError(_0x184bbe,null));};exports[_0xb9b1('0x64')]=function(_0x378646,_0x20678c){if(_0x378646['body']['id']){delete _0x378646['body']['id'];}var _0x4128b1=_0x378646[_0xb9b1('0x65')][_0xb9b1('0x66')]==='custom'?null:_0x378646['body'][_0xb9b1('0x66')];var _0x57bc38=_0x378646[_0xb9b1('0x65')][_0xb9b1('0x43')]||{};var _0x30618c=_0x378646[_0xb9b1('0x65')][_0xb9b1('0x44')]||{};if(_0x4128b1){_0x57bc38[_0xb9b1('0x3e')]=getImapHost(_0x4128b1);_0x57bc38[_0xb9b1('0x3f')]=0x3e1;_0x30618c[_0xb9b1('0x3e')]=getSmtpHost(_0x4128b1);_0x30618c['port']=0x24b;_0x30618c['secure']=![];}if(_0x30618c[_0xb9b1('0x3c')]){_0x30618c[_0xb9b1('0x40')]=![];}else{_0x30618c[_0xb9b1('0x3d')]=null;}if(!_0x57bc38[_0xb9b1('0x3c')])_0x57bc38[_0xb9b1('0x3d')]=null;_0x378646[_0xb9b1('0x65')]['Imap']=_0x57bc38;_0x378646[_0xb9b1('0x65')][_0xb9b1('0x44')]=_0x30618c;return db[_0xb9b1('0x49')][_0xb9b1('0x63')]({'where':{'id':_0x378646[_0xb9b1('0x61')]['id']},'include':[{'model':db['MailServerIn'],'as':_0xb9b1('0x43')},{'model':db[_0xb9b1('0x62')],'as':_0xb9b1('0x44')},{'model':db[_0xb9b1('0x47')],'as':_0xb9b1('0x48')}]})[_0xb9b1('0x27')](handleEntityNotFound(_0x20678c,null))[_0xb9b1('0x27')](function(_0x2e3c85){if(!_0x2e3c85)throw new Error(_0xb9b1('0x67'));if(_0x2e3c85['service'])delete _0x378646[_0xb9b1('0x65')][_0xb9b1('0x43')];return _0x2e3c85;})[_0xb9b1('0x27')](saveUpdates(_0x378646['body'],null))['then'](function(_0x5fc044){if(!_0x378646[_0xb9b1('0x65')][_0xb9b1('0x43')])return _0x5fc044;return db[_0xb9b1('0x46')]['update'](_0x378646[_0xb9b1('0x65')][_0xb9b1('0x43')],{'where':{'MailAccountId':_0x5fc044['id']}})[_0xb9b1('0x27')](function(){return _0x5fc044;});})[_0xb9b1('0x27')](function(_0x3bc7b5){if(!_0x378646['body']['Smtp'])return _0x3bc7b5;return db[_0xb9b1('0x62')][_0xb9b1('0x64')](_0x378646['body'][_0xb9b1('0x44')],{'where':{'MailAccountId':_0x3bc7b5['id']}})[_0xb9b1('0x27')](function(){return _0x3bc7b5;});})[_0xb9b1('0x27')](respondWithResult(_0x20678c,null))[_0xb9b1('0x1c')](handleError(_0x20678c,null));};exports['describe']=function(_0x4934a1,_0xd7f235){return db[_0xb9b1('0x49')][_0xb9b1('0x68')]()['then'](respondWithResult(_0xd7f235,null))['catch'](handleError(_0xd7f235,null));};exports[_0xb9b1('0x69')]=function(_0x82420f,_0x2a867e){if(_0x82420f[_0xb9b1('0x65')]['id']){delete _0x82420f[_0xb9b1('0x65')]['id'];}return db[_0xb9b1('0x49')][_0xb9b1('0x63')]({'where':{'id':_0x82420f['params']['id']}})[_0xb9b1('0x27')](handleEntityNotFound(_0x2a867e,null))[_0xb9b1('0x27')](function(_0x376088){if(_0x376088){_0x82420f[_0xb9b1('0x65')][_0xb9b1('0x6a')]=_0x376088['id'];return db[_0xb9b1('0x6b')][_0xb9b1('0x6c')](_0x82420f[_0xb9b1('0x65')]);}})[_0xb9b1('0x27')](respondWithResult(_0x2a867e,null))[_0xb9b1('0x1c')](handleError(_0x2a867e,null));};exports[_0xb9b1('0x6d')]=function(_0x5b170f,_0x7be83b){var _0x55c553={'raw':![],'where':{}};var _0x5b2054={};var _0x5ca143={'count':0x0,'rows':[]};return db[_0xb9b1('0x49')][_0xb9b1('0x6e')]({'where':{'id':_0x5b170f[_0xb9b1('0x61')]['id']}})[_0xb9b1('0x27')](handleEntityNotFound(_0x7be83b,null))[_0xb9b1('0x27')](function(_0xe9ba05){if(_0xe9ba05){_0x5b2054['model']=_['keys'](db['Disposition']['rawAttributes']);_0x5b2054[_0xb9b1('0x50')]=_[_0xb9b1('0x4f')](_0x5b170f[_0xb9b1('0x50')]);_0x5b2054[_0xb9b1('0x51')]=_[_0xb9b1('0x53')](_0x5b2054[_0xb9b1('0x4e')],_0x5b2054[_0xb9b1('0x50')]);_0x55c553[_0xb9b1('0x52')]=_[_0xb9b1('0x53')](_0x5b2054[_0xb9b1('0x4e')],qs[_0xb9b1('0x54')](_0x5b170f[_0xb9b1('0x50')][_0xb9b1('0x54')]));_0x55c553[_0xb9b1('0x52')]=_0x55c553[_0xb9b1('0x52')][_0xb9b1('0x55')]?_0x55c553['attributes']:_0x5b2054['model'];if(!_0x5b170f[_0xb9b1('0x50')]['hasOwnProperty'](_0xb9b1('0x6f'))){_0x55c553[_0xb9b1('0x23')]=qs[_0xb9b1('0x23')](_0x5b170f[_0xb9b1('0x50')][_0xb9b1('0x23')]);_0x55c553[_0xb9b1('0x21')]=qs['offset'](_0x5b170f[_0xb9b1('0x50')][_0xb9b1('0x21')]);}_0x55c553['order']=qs['sort'](_0x5b170f[_0xb9b1('0x50')][_0xb9b1('0x57')]);_0x55c553['where']=qs[_0xb9b1('0x51')](_[_0xb9b1('0x70')](_0x5b170f['query'],_0x5b2054['filters']));_0x55c553[_0xb9b1('0x58')][_0xb9b1('0x6a')]=_0xe9ba05['id'];if(_0x5b170f[_0xb9b1('0x50')]['filter']){_0x55c553[_0xb9b1('0x58')]=_['merge'](_0x55c553[_0xb9b1('0x58')],{'$or':_[_0xb9b1('0x71')](_0x55c553[_0xb9b1('0x52')],function(_0x139c14){var _0x4f5c7d={};_0x4f5c7d[_0x139c14]={'$like':'%'+_0x5b170f['query'][_0xb9b1('0x59')]+'%'};return _0x4f5c7d;})});}_0x55c553=_['merge']({},_0x55c553,_0x5b170f[_0xb9b1('0x5c')]);return db[_0xb9b1('0x6b')][_0xb9b1('0x24')]({'where':_0x55c553['where']})[_0xb9b1('0x27')](function(_0x156a88){_0x5ca143[_0xb9b1('0x24')]=_0x156a88;if(_0x5b170f[_0xb9b1('0x50')][_0xb9b1('0x5d')]){_0x55c553[_0xb9b1('0x5e')]=[{'all':!![]}];}return db[_0xb9b1('0x6b')][_0xb9b1('0x5f')](_0x55c553);})[_0xb9b1('0x27')](function(_0x255769){_0x5ca143[_0xb9b1('0x72')]=_0x255769;return _0x5ca143;});}})['then'](respondWithFilteredResult(_0x7be83b,_0x55c553))['catch'](handleError(_0x7be83b,null));};exports[_0xb9b1('0x73')]=function(_0x2f650e,_0x35ba8b){return db['MailAccount'][_0xb9b1('0x63')]({'where':{'id':_0x2f650e[_0xb9b1('0x61')]['id']}})['then'](handleEntityNotFound(_0x35ba8b,null))[_0xb9b1('0x27')](function(_0x48b922){if(_0x48b922){return _0x48b922[_0xb9b1('0x73')](_0x2f650e['query']['ids']);}})[_0xb9b1('0x27')](respondWithStatusCode(_0x35ba8b,null))[_0xb9b1('0x1c')](handleError(_0x35ba8b,null));};exports['addAnswer']=function(_0x519a73,_0x405cb5){if(_0x519a73['body']['id']){delete _0x519a73[_0xb9b1('0x65')]['id'];}return db[_0xb9b1('0x49')]['find']({'where':{'id':_0x519a73[_0xb9b1('0x61')]['id']}})['then'](handleEntityNotFound(_0x405cb5,null))[_0xb9b1('0x27')](function(_0x50b6ee){if(_0x50b6ee){_0x519a73['body']['MailAccountId']=_0x50b6ee['id'];return db[_0xb9b1('0x74')][_0xb9b1('0x6c')](_0x519a73[_0xb9b1('0x65')]);}})[_0xb9b1('0x27')](respondWithResult(_0x405cb5,null))[_0xb9b1('0x1c')](handleError(_0x405cb5,null));};exports[_0xb9b1('0x75')]=function(_0x4a6773,_0x46f6a2){var _0x4deadc={'raw':![],'where':{}};var _0x2013c7={};var _0x391d76={'count':0x0,'rows':[]};return db[_0xb9b1('0x49')][_0xb9b1('0x6e')]({'where':{'id':_0x4a6773[_0xb9b1('0x61')]['id']}})[_0xb9b1('0x27')](handleEntityNotFound(_0x46f6a2,null))[_0xb9b1('0x27')](function(_0x2ce9f8){if(_0x2ce9f8){_0x2013c7['model']=_[_0xb9b1('0x4f')](db[_0xb9b1('0x74')][_0xb9b1('0x4a')]);_0x2013c7[_0xb9b1('0x50')]=_[_0xb9b1('0x4f')](_0x4a6773[_0xb9b1('0x50')]);_0x2013c7[_0xb9b1('0x51')]=_[_0xb9b1('0x53')](_0x2013c7[_0xb9b1('0x4e')],_0x2013c7['query']);_0x4deadc['attributes']=_[_0xb9b1('0x53')](_0x2013c7[_0xb9b1('0x4e')],qs['fields'](_0x4a6773[_0xb9b1('0x50')][_0xb9b1('0x54')]));_0x4deadc['attributes']=_0x4deadc[_0xb9b1('0x52')][_0xb9b1('0x55')]?_0x4deadc['attributes']:_0x2013c7['model'];if(!_0x4a6773[_0xb9b1('0x50')]['hasOwnProperty'](_0xb9b1('0x6f'))){_0x4deadc['limit']=qs['limit'](_0x4a6773[_0xb9b1('0x50')][_0xb9b1('0x23')]);_0x4deadc[_0xb9b1('0x21')]=qs[_0xb9b1('0x21')](_0x4a6773[_0xb9b1('0x50')]['offset']);}_0x4deadc[_0xb9b1('0x76')]=qs['sort'](_0x4a6773[_0xb9b1('0x50')]['sort']);_0x4deadc[_0xb9b1('0x58')]=qs[_0xb9b1('0x51')](_['pick'](_0x4a6773[_0xb9b1('0x50')],_0x2013c7['filters']));_0x4deadc[_0xb9b1('0x58')]['MailAccountId']=_0x2ce9f8['id'];if(_0x4a6773[_0xb9b1('0x50')]['filter']){_0x4deadc[_0xb9b1('0x58')]=_[_0xb9b1('0x5a')](_0x4deadc[_0xb9b1('0x58')],{'$or':_['map'](_0x4deadc[_0xb9b1('0x52')],function(_0x4f9a3f){var _0x4529b4={};_0x4529b4[_0x4f9a3f]={'$like':'%'+_0x4a6773[_0xb9b1('0x50')][_0xb9b1('0x59')]+'%'};return _0x4529b4;})});}_0x4deadc=_[_0xb9b1('0x5a')]({},_0x4deadc,_0x4a6773[_0xb9b1('0x5c')]);return db['CannedAnswer']['count']({'where':_0x4deadc[_0xb9b1('0x58')]})[_0xb9b1('0x27')](function(_0x10112d){_0x391d76[_0xb9b1('0x24')]=_0x10112d;if(_0x4a6773[_0xb9b1('0x50')][_0xb9b1('0x5d')]){_0x4deadc[_0xb9b1('0x5e')]=[{'all':!![]}];}return db[_0xb9b1('0x74')][_0xb9b1('0x5f')](_0x4deadc);})[_0xb9b1('0x27')](function(_0xa3190b){_0x391d76[_0xb9b1('0x72')]=_0xa3190b;return _0x391d76;});}})[_0xb9b1('0x27')](respondWithFilteredResult(_0x46f6a2,_0x4deadc))['catch'](handleError(_0x46f6a2,null));};exports['removeAnswers']=function(_0x35270d,_0x52aa76){return db[_0xb9b1('0x49')][_0xb9b1('0x63')]({'where':{'id':_0x35270d[_0xb9b1('0x61')]['id']}})['then'](handleEntityNotFound(_0x52aa76,null))[_0xb9b1('0x27')](function(_0x57a089){if(_0x57a089){return _0x57a089[_0xb9b1('0x77')](_0x35270d[_0xb9b1('0x50')][_0xb9b1('0x78')]);}})[_0xb9b1('0x27')](respondWithStatusCode(_0x52aa76,null))['catch'](handleError(_0x52aa76,null));};exports['create']=function(_0x18f3fc,_0x3f07da){var _0x3a20e1={'name':_0x18f3fc['body'][_0xb9b1('0x2b')],'key':_0x18f3fc[_0xb9b1('0x65')][_0xb9b1('0x4d')],'provider':_0x18f3fc[_0xb9b1('0x65')][_0xb9b1('0x66')]===_0xb9b1('0x79')?null:_0x18f3fc['body'][_0xb9b1('0x66')],'email':_0x18f3fc[_0xb9b1('0x65')][_0xb9b1('0x7a')],'ListId':_0x18f3fc[_0xb9b1('0x65')][_0xb9b1('0x7b')],'active':!_[_0xb9b1('0x7c')](_0x18f3fc[_0xb9b1('0x65')][_0xb9b1('0x7d')])?_0x18f3fc[_0xb9b1('0x65')][_0xb9b1('0x7d')]:!![],'description':_0x18f3fc[_0xb9b1('0x65')][_0xb9b1('0x7e')]||null};var _0x4f120a=getAuthenticationOptions(_0x3a20e1['provider'],_0x18f3fc[_0xb9b1('0x65')]);_0x3a20e1[_0xb9b1('0x43')]=_0x4f120a[_0xb9b1('0x43')];_0x3a20e1[_0xb9b1('0x44')]=_0x4f120a[_0xb9b1('0x44')];return db[_0xb9b1('0x49')][_0xb9b1('0x6c')](_0x3a20e1,{'include':[{'model':db['MailServerOut'],'as':'Smtp'},{'model':db['MailServerIn'],'as':'Imap'}]})[_0xb9b1('0x27')](function(_0x56236){var _0x1dc11e=_0x18f3fc['user'][_0xb9b1('0x28')]({'plain':!![]});if(!_0x1dc11e)throw new Error(_0xb9b1('0x7f'));if(_0x1dc11e[_0xb9b1('0x80')]==='user'){var _0x2cde66=_0x56236['get']({'plain':!![]});return db[_0xb9b1('0x81')][_0xb9b1('0x63')]({'where':{'name':_0xb9b1('0x29'),'userProfileId':_0x1dc11e[_0xb9b1('0x82')]},'raw':!![]})['then'](function(_0x3197c8){if(_0x3197c8&&_0x3197c8['autoAssociation']===0x0){return db[_0xb9b1('0x2a')][_0xb9b1('0x6c')]({'name':_0x2cde66[_0xb9b1('0x2b')],'resourceId':_0x2cde66['id'],'type':_0x3197c8['name'],'sectionId':_0x3197c8['id']},{})[_0xb9b1('0x27')](function(){return _0x56236;});}else{return _0x56236;}})[_0xb9b1('0x1c')](function(_0x15a554){logger[_0xb9b1('0x18')]('Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s',_0x15a554);throw _0x15a554;});}return _0x56236;})[_0xb9b1('0x27')](respondWithResult(_0x3f07da,0xc9))[_0xb9b1('0x1c')](handleError(_0x3f07da,null));};exports[_0xb9b1('0x83')]=function(_0x3a26c2,_0x3eda14){return db[_0xb9b1('0x49')][_0xb9b1('0x6e')]({'where':{'id':_0x3a26c2[_0xb9b1('0x61')]['id']}})['then'](handleEntityNotFound(_0x3eda14,null))[_0xb9b1('0x27')](function(_0x26da80){if(_0x26da80){return _0x26da80[_0xb9b1('0x83')]();}return null;})[_0xb9b1('0x27')](respondWithResult(_0x3eda14,null))['catch'](handleError(_0x3eda14,null));};exports[_0xb9b1('0x84')]=function(_0x4104c9,_0x4681e1){if(_0x4104c9[_0xb9b1('0x65')]['id']){delete _0x4104c9[_0xb9b1('0x65')]['id'];}return db['MailAccount'][_0xb9b1('0x63')]({'where':{'id':_0x4104c9[_0xb9b1('0x61')]['id']}})[_0xb9b1('0x27')](handleEntityNotFound(_0x4681e1,null))[_0xb9b1('0x27')](function(_0x2e8c1b){if(_0x2e8c1b){_0x4104c9['body']['MailAccountId']=_0x2e8c1b['id'];return db[_0xb9b1('0x46')][_0xb9b1('0x6c')](_0x4104c9['body']);}})['then'](respondWithResult(_0x4681e1,null))[_0xb9b1('0x1c')](handleError(_0x4681e1,null));};exports[_0xb9b1('0x85')]=function(_0x438a4f,_0x1233fa){return db['MailAccount'][_0xb9b1('0x6e')]({'where':{'id':_0x438a4f[_0xb9b1('0x61')]['id']}})[_0xb9b1('0x27')](handleEntityNotFound(_0x1233fa,null))[_0xb9b1('0x27')](function(_0x117f3e){if(_0x117f3e){return _0x117f3e[_0xb9b1('0x86')](null);}return null;})[_0xb9b1('0x27')](respondWithStatusCode(_0x1233fa,null))[_0xb9b1('0x1c')](handleError(_0x1233fa,null));};exports[_0xb9b1('0x87')]=function(_0x465fe8,_0x3fcc87){return db['MailAccount'][_0xb9b1('0x6e')]({'where':{'id':_0x465fe8[_0xb9b1('0x61')]['id']}})[_0xb9b1('0x27')](handleEntityNotFound(_0x3fcc87,null))[_0xb9b1('0x27')](function(_0x34c206){if(_0x34c206){return _0x34c206[_0xb9b1('0x87')]();}return null;})[_0xb9b1('0x27')](respondWithResult(_0x3fcc87,null))[_0xb9b1('0x1c')](handleError(_0x3fcc87,null));};exports[_0xb9b1('0x88')]=function(_0x2d2603,_0x2eeccd){if(_0x2d2603[_0xb9b1('0x65')]['id']){delete _0x2d2603['body']['id'];}return db['MailAccount'][_0xb9b1('0x63')]({'where':{'id':_0x2d2603[_0xb9b1('0x61')]['id']}})[_0xb9b1('0x27')](handleEntityNotFound(_0x2eeccd,null))[_0xb9b1('0x27')](function(_0x530076){if(_0x530076){_0x2d2603[_0xb9b1('0x65')]['MailAccountId']=_0x530076['id'];return db['MailServerOut'][_0xb9b1('0x6c')](_0x2d2603[_0xb9b1('0x65')]);}})['then'](respondWithResult(_0x2eeccd,null))['catch'](handleError(_0x2eeccd,null));};exports[_0xb9b1('0x89')]=function(_0x359041,_0x38eb0d){return db[_0xb9b1('0x49')][_0xb9b1('0x6e')]({'where':{'id':_0x359041[_0xb9b1('0x61')]['id']}})[_0xb9b1('0x27')](handleEntityNotFound(_0x38eb0d,null))['then'](function(_0x5c5ce2){if(_0x5c5ce2){return _0x5c5ce2[_0xb9b1('0x8a')](null);}return null;})[_0xb9b1('0x27')](respondWithStatusCode(_0x38eb0d,null))[_0xb9b1('0x1c')](handleError(_0x38eb0d,null));};exports[_0xb9b1('0x8b')]=function(_0x15e08c,_0x56ce2e){return db['MailInteraction'][_0xb9b1('0x63')]({'where':{'id':_0x15e08c[_0xb9b1('0x61')]['id']}})['then'](handleEntityNotFound(_0x56ce2e,null))['then'](function(_0xcd475d){if(_0xcd475d){return _0xcd475d[_0xb9b1('0x8b')](_0x15e08c[_0xb9b1('0x65')][_0xb9b1('0x78')],_[_0xb9b1('0x8c')](_0x15e08c[_0xb9b1('0x65')],[_0xb9b1('0x78'),'id'])||{});}})['then'](respondWithResult(_0x56ce2e,null))[_0xb9b1('0x1c')](handleError(_0x56ce2e,null));};exports['getInteractions']=function(_0x5582a9,_0x2e7b96){var _0x1abfe3={'raw':![],'where':{}};var _0x5a72fb={};var _0x2a6b99={'count':0x0,'rows':[]};return db[_0xb9b1('0x49')][_0xb9b1('0x6e')]({'where':{'id':_0x5582a9[_0xb9b1('0x61')]['id']}})[_0xb9b1('0x27')](handleEntityNotFound(_0x2e7b96,null))[_0xb9b1('0x27')](function(_0x326e11){if(_0x326e11){_0x5a72fb[_0xb9b1('0x4e')]=_[_0xb9b1('0x4f')](db[_0xb9b1('0x8d')]['rawAttributes']);_0x5a72fb[_0xb9b1('0x50')]=_[_0xb9b1('0x4f')](_0x5582a9[_0xb9b1('0x50')]);_0x5a72fb[_0xb9b1('0x51')]=_[_0xb9b1('0x53')](_0x5a72fb[_0xb9b1('0x4e')],_0x5a72fb[_0xb9b1('0x50')]);_0x1abfe3[_0xb9b1('0x52')]=_['intersection'](_0x5a72fb[_0xb9b1('0x4e')],qs[_0xb9b1('0x54')](_0x5582a9[_0xb9b1('0x50')]['fields']));_0x1abfe3[_0xb9b1('0x52')]=_0x1abfe3[_0xb9b1('0x52')]['length']?_0x1abfe3['attributes']:_0x5a72fb['model'];if(!_0x5582a9[_0xb9b1('0x50')][_0xb9b1('0x56')]('nolimit')){_0x1abfe3['limit']=qs[_0xb9b1('0x23')](_0x5582a9['query'][_0xb9b1('0x23')]);_0x1abfe3[_0xb9b1('0x21')]=qs[_0xb9b1('0x21')](_0x5582a9[_0xb9b1('0x50')][_0xb9b1('0x21')]);}_0x1abfe3['order']=qs[_0xb9b1('0x57')](_0x5582a9['query'][_0xb9b1('0x57')]);_0x1abfe3['where']=qs['filters'](_[_0xb9b1('0x70')](_0x5582a9[_0xb9b1('0x50')],_0x5a72fb['filters']));_0x1abfe3[_0xb9b1('0x58')][_0xb9b1('0x6a')]=_0x326e11['id'];if(_0x5582a9[_0xb9b1('0x50')][_0xb9b1('0x59')]){_0x1abfe3['where']=_[_0xb9b1('0x5a')](_0x1abfe3[_0xb9b1('0x58')],{'$or':_[_0xb9b1('0x71')](_0x1abfe3[_0xb9b1('0x52')],function(_0x21c3c9){var _0x545e85={};_0x545e85[_0x21c3c9]={'$like':'%'+_0x5582a9[_0xb9b1('0x50')][_0xb9b1('0x59')]+'%'};return _0x545e85;})});}_0x1abfe3=_['merge']({},_0x1abfe3,_0x5582a9[_0xb9b1('0x5c')]);return db[_0xb9b1('0x8d')][_0xb9b1('0x24')]({'where':_0x1abfe3['where']})[_0xb9b1('0x27')](function(_0x5ada4c){_0x2a6b99[_0xb9b1('0x24')]=_0x5ada4c;if(_0x5582a9[_0xb9b1('0x50')]['includeAll']){_0x1abfe3['include']=[{'model':db[_0xb9b1('0x8e')],'as':_0xb9b1('0x8f'),'required':![]},{'model':db[_0xb9b1('0x90')],'as':_0xb9b1('0x91'),'attributes':[_0xb9b1('0x2b'),_0xb9b1('0x92'),'internal'],'required':![]},{'model':db['Tag'],'as':_0xb9b1('0x93'),'attributes':['id',_0xb9b1('0x2b'),_0xb9b1('0x94')],'where':_0x5582a9[_0xb9b1('0x50')][_0xb9b1('0x95')]?{'id':_0x5582a9[_0xb9b1('0x50')][_0xb9b1('0x95')]}:undefined,'required':_0x5582a9[_0xb9b1('0x50')][_0xb9b1('0x95')]?!![]:![]}];}return db[_0xb9b1('0x8d')][_0xb9b1('0x5f')](_0x1abfe3);})[_0xb9b1('0x27')](function(_0x15ff22){_0x2a6b99[_0xb9b1('0x72')]=_0x15ff22;return _0x2a6b99;});}})[_0xb9b1('0x27')](respondWithFilteredResult(_0x2e7b96,_0x1abfe3))[_0xb9b1('0x1c')](handleError(_0x2e7b96,null));};exports[_0xb9b1('0x96')]=function addApplications(_0x5deafd,_0xeedfbf){var _0x181557=_0x5deafd[_0xb9b1('0x61')]['id'];var _0x3dd8fb=_0x5deafd['body'];var _0x385c0c=0xc8;var _0x3f19ff=null;return db[_0xb9b1('0x97')][_0xb9b1('0x98')]({'isolationLevel':db[_0xb9b1('0x97')][_0xb9b1('0x99')]['ISOLATION_LEVELS'][_0xb9b1('0x9a')]},function(_0x326063){return db[_0xb9b1('0x49')][_0xb9b1('0x6e')]({'where':{'id':_0x181557},'transaction':_0x326063})[_0xb9b1('0x27')](function(_0x508684){if(_0x508684){return db['MailApplication']['destroy']({'where':{'MailAccountId':_0x181557},'transaction':_0x326063})[_0xb9b1('0x27')](function(){var _0x3c1085=_[_0xb9b1('0x71')](_0x3dd8fb,function(_0x437520){_0x437520['MailAccountId']=_0x181557;return _0x437520;});return db['MailApplication']['bulkCreate'](_0x3c1085,{'transaction':_0x326063});});}else{_0x385c0c=0x194;_0x3f19ff=[];}});})['then'](function(){if(_0x385c0c!==0x194){return db[_0xb9b1('0x9b')][_0xb9b1('0x9c')]({'where':{'MailAccountId':_0x181557},'order':_0xb9b1('0x9d')})[_0xb9b1('0x27')](function(_0x4fbbf6){_0x3f19ff=_0x4fbbf6;});}})['catch'](function(_0xcc49){_0x385c0c=0x1f4;logger[_0xb9b1('0x18')](_0xcc49[_0xb9b1('0x9e')]);if(_0xcc49['name']){delete _0xcc49['name'];}_0x3f19ff=_0xcc49;})['finally'](function(){if(_0x3f19ff===null){_0xeedfbf[_0xb9b1('0x1d')](_0x385c0c);}else{if(_0x385c0c===0x1f4){_0xeedfbf['status'](_0x385c0c)['send'](_0x3f19ff);}else{_0xeedfbf[_0xb9b1('0x1e')](_0x385c0c)[_0xb9b1('0x20')](_0x3f19ff);}}});};exports[_0xb9b1('0x9f')]=function(_0x40671e,_0x1c89bf){var _0x19d3c2={};var _0x3c2f3e={};var _0x5bdd42;var _0x1a5b7;return db[_0xb9b1('0x49')]['findOne']({'where':{'id':_0x40671e[_0xb9b1('0x61')]['id']}})[_0xb9b1('0x27')](handleEntityNotFound(_0x1c89bf,null))[_0xb9b1('0x27')](function(_0x468581){if(_0x468581){_0x5bdd42=_0x468581;_0x3c2f3e[_0xb9b1('0x4e')]=_[_0xb9b1('0x4f')](db[_0xb9b1('0x9b')][_0xb9b1('0x4a')]);_0x3c2f3e['query']=_['keys'](_0x40671e['query']);_0x3c2f3e[_0xb9b1('0x51')]=_['intersection'](_0x3c2f3e[_0xb9b1('0x4e')],_0x3c2f3e['query']);_0x19d3c2[_0xb9b1('0x52')]=_[_0xb9b1('0x53')](_0x3c2f3e[_0xb9b1('0x4e')],qs[_0xb9b1('0x54')](_0x40671e['query'][_0xb9b1('0x54')]));_0x19d3c2[_0xb9b1('0x52')]=_0x19d3c2[_0xb9b1('0x52')]['length']?_0x19d3c2[_0xb9b1('0x52')]:_0x3c2f3e[_0xb9b1('0x4e')];_0x19d3c2[_0xb9b1('0x76')]=qs['sort'](_0x40671e[_0xb9b1('0x50')][_0xb9b1('0x57')]);_0x19d3c2['where']=qs[_0xb9b1('0x51')](_['pick'](_0x40671e[_0xb9b1('0x50')],_0x3c2f3e['filters']));if(_0x40671e['query'][_0xb9b1('0x59')]){_0x19d3c2[_0xb9b1('0x58')]=_[_0xb9b1('0x5a')](_0x19d3c2['where'],{'$or':_[_0xb9b1('0x71')](_0x19d3c2[_0xb9b1('0x52')],function(_0x4eb8b7){var _0xbe0597={};_0xbe0597[_0x4eb8b7]={'$like':'%'+_0x40671e[_0xb9b1('0x50')]['filter']+'%'};return _0xbe0597;})});}_0x19d3c2=_[_0xb9b1('0x5a')]({},_0x19d3c2,_0x40671e[_0xb9b1('0x5c')]);return _0x5bdd42[_0xb9b1('0x9f')](_0x19d3c2);}})[_0xb9b1('0x27')](function(_0x59eab0){if(_0x59eab0){_0x1a5b7=_0x59eab0[_0xb9b1('0x55')];if(!_0x40671e['query']['hasOwnProperty'](_0xb9b1('0x6f'))){_0x19d3c2['limit']=qs[_0xb9b1('0x23')](_0x40671e[_0xb9b1('0x50')][_0xb9b1('0x23')]);_0x19d3c2[_0xb9b1('0x21')]=qs[_0xb9b1('0x21')](_0x40671e['query'][_0xb9b1('0x21')]);}return _0x5bdd42[_0xb9b1('0x9f')](_0x19d3c2);}})[_0xb9b1('0x27')](function(_0x4dfbe8){if(_0x4dfbe8){return _0x4dfbe8?{'count':_0x1a5b7,'rows':_0x4dfbe8}:null;}})['then'](respondWithResult(_0x1c89bf,null))[_0xb9b1('0x1c')](handleError(_0x1c89bf,null));};exports['getMessages']=function(_0x1f539c,_0x49a9f8){var _0x118cdc={'raw':!![],'where':{}};var _0x2fcea3={};var _0x5a1df8={'count':0x0,'rows':[]};return db[_0xb9b1('0x49')][_0xb9b1('0x6e')]({'where':{'id':_0x1f539c[_0xb9b1('0x61')]['id']}})[_0xb9b1('0x27')](handleEntityNotFound(_0x49a9f8,null))[_0xb9b1('0x27')](function(_0x431789){if(_0x431789){_0x2fcea3['model']=_[_0xb9b1('0x4f')](db[_0xb9b1('0xa0')][_0xb9b1('0x4a')]);_0x2fcea3[_0xb9b1('0x50')]=_[_0xb9b1('0x4f')](_0x1f539c[_0xb9b1('0x50')]);_0x2fcea3[_0xb9b1('0x51')]=_[_0xb9b1('0x53')](_0x2fcea3[_0xb9b1('0x4e')],_0x2fcea3[_0xb9b1('0x50')]);_0x118cdc['attributes']=_[_0xb9b1('0x53')](_0x2fcea3[_0xb9b1('0x4e')],qs[_0xb9b1('0x54')](_0x1f539c[_0xb9b1('0x50')][_0xb9b1('0x54')]));_0x118cdc[_0xb9b1('0x52')]=_0x118cdc['attributes'][_0xb9b1('0x55')]?_0x118cdc[_0xb9b1('0x52')]:_0x2fcea3['model'];if(!_0x1f539c[_0xb9b1('0x50')][_0xb9b1('0x56')](_0xb9b1('0x6f'))){_0x118cdc['limit']=qs[_0xb9b1('0x23')](_0x1f539c[_0xb9b1('0x50')][_0xb9b1('0x23')]);_0x118cdc[_0xb9b1('0x21')]=qs[_0xb9b1('0x21')](_0x1f539c['query']['offset']);}_0x118cdc[_0xb9b1('0x76')]=qs[_0xb9b1('0x57')](_0x1f539c[_0xb9b1('0x50')]['sort']);_0x118cdc[_0xb9b1('0x58')]=qs['filters'](_[_0xb9b1('0x70')](_0x1f539c['query'],_0x2fcea3['filters']));_0x118cdc['where'][_0xb9b1('0x6a')]=_0x431789['id'];if(_0x1f539c[_0xb9b1('0x50')][_0xb9b1('0x59')]){_0x118cdc[_0xb9b1('0x58')]=_[_0xb9b1('0x5a')](_0x118cdc['where'],{'$or':_[_0xb9b1('0x71')](_0x118cdc[_0xb9b1('0x52')],function(_0x86a151){var _0x268b6a={};_0x268b6a[_0x86a151]={'$like':'%'+_0x1f539c['query'][_0xb9b1('0x59')]+'%'};return _0x268b6a;})});}if(_0x1f539c[_0xb9b1('0x50')][_0xb9b1('0xa1')]){var _0x1da00e=_0x1f539c[_0xb9b1('0x50')]['$gte']['split'](',');var _0x366636={};_0x366636[_0x1da00e[0x0]]={'$gte':moment(_0x1da00e[0x1])['format'](_0xb9b1('0xa2'))};_0x118cdc['where']=_[_0xb9b1('0x5a')](_0x118cdc[_0xb9b1('0x58')],_0x366636);}_0x118cdc=_[_0xb9b1('0x5a')]({},_0x118cdc,_0x1f539c[_0xb9b1('0x5c')]);return db[_0xb9b1('0xa0')][_0xb9b1('0x24')]({'where':_0x118cdc[_0xb9b1('0x58')]})[_0xb9b1('0x27')](function(_0x2f3d79){_0x5a1df8[_0xb9b1('0x24')]=_0x2f3d79;if(_0x1f539c[_0xb9b1('0x50')]['includeAll']){_0x118cdc[_0xb9b1('0x5e')]=[{'all':!![]}];}return db[_0xb9b1('0xa0')]['findAll'](_0x118cdc);})[_0xb9b1('0x27')](function(_0x557b3e){if(_0x1f539c[_0xb9b1('0x50')][_0xb9b1('0xa3')]===_0xb9b1('0xa4')){for(var _0x5d4208=0x0;_0x5d4208<_0x557b3e[_0xb9b1('0x55')];_0x5d4208++){_0x557b3e[_0x5d4208][_0xb9b1('0x65')]=juice(_0x557b3e[_0x5d4208][_0xb9b1('0x65')]);}}_0x5a1df8['rows']=_0x557b3e;return _0x5a1df8;});}})[_0xb9b1('0x27')](respondWithFilteredResult(_0x49a9f8,_0x118cdc))[_0xb9b1('0x1c')](handleError(_0x49a9f8,null));};exports[_0xb9b1('0x2c')]=function(_0x1e25a4,_0x38d2dd){var _0x5a4110,_0x22d074={},_0x16b925;if(_0x1e25a4[_0xb9b1('0x65')]['to']){_0x16b925=_0x1e25a4[_0xb9b1('0x65')]['to'][_0xb9b1('0xa5')](',')[0x0];}return db[_0xb9b1('0x49')][_0xb9b1('0x63')]({'where':{'id':_0x1e25a4['params']['id']},'include':[{'model':db['CmList'],'as':_0xb9b1('0xa6'),'include':[{'model':db[_0xb9b1('0x8e')],'as':_0xb9b1('0xa7'),'where':{'email':_0x16b925},'limit':0x1,'order':[[_0xb9b1('0xa8'),_0xb9b1('0xa9')]]}]},{'model':db[_0xb9b1('0x62')],'as':'Smtp','raw':!![],'include':[{'model':db[_0xb9b1('0xaa')],'as':_0xb9b1('0xaa'),'raw':!![]}]}]})[_0xb9b1('0x27')](handleEntityNotFound(_0x38d2dd,null))[_0xb9b1('0x27')](function(_0x19d5cf){if(!_0x19d5cf)return;_0x5a4110=_0x19d5cf;if(!_0x19d5cf[_0xb9b1('0x44')])throw new Error(_0xb9b1('0xab'));if(_[_0xb9b1('0x7c')](_0x1e25a4[_0xb9b1('0x65')][_0xb9b1('0xac')])){_0x1e25a4[_0xb9b1('0x65')][_0xb9b1('0xac')]=util[_0xb9b1('0xad')](_0xb9b1('0xae'),_0x19d5cf[_0xb9b1('0x2b')],_0x19d5cf['email']||_0x19d5cf[_0xb9b1('0x44')][_0xb9b1('0xaf')]);}if(_0x1e25a4[_0xb9b1('0x65')]['attachments']&&_0x1e25a4[_0xb9b1('0x65')][_0xb9b1('0xb0')][_0xb9b1('0x55')]){for(var _0x18d58b=0x0;_0x18d58b<_0x1e25a4['body']['attachments']['length'];_0x18d58b+=0x1){_0x1e25a4['body'][_0xb9b1('0xb0')][_0x18d58b]={'filename':_0x1e25a4[_0xb9b1('0x65')]['attachments'][_0x18d58b][_0xb9b1('0x2b')],'path':path[_0xb9b1('0xb1')](config[_0xb9b1('0xb2')],'server/files/attachments',_0x1e25a4[_0xb9b1('0x65')][_0xb9b1('0xb0')][_0x18d58b][_0xb9b1('0xb3')])};}}var _0x22db51=_0x19d5cf[_0xb9b1('0xb4')]();return respondWithRpcPromise(_0xb9b1('0xb5'),_0xb9b1('0xb6'),{'account':_0x22db51,'message':_0x1e25a4[_0xb9b1('0x65')]});})[_0xb9b1('0x27')](function(_0x190d73){if(!_0x190d73)return;_0x22d074=_0x190d73;if(!_0x5a4110[_0xb9b1('0xa6')])throw new Error(_0xb9b1('0xb7'));if(_0x5a4110[_0xb9b1('0xa6')]['Contacts'][_0xb9b1('0x55')])return _0x5a4110[_0xb9b1('0xa6')]['Contacts'][0x0];return db[_0xb9b1('0x8e')]['create'](_[_0xb9b1('0xd')](_0x1e25a4['body'],{'firstName':_0x1e25a4['body']['to'],'email':_0x1e25a4[_0xb9b1('0x65')]['to'],'phone':_0x1e25a4[_0xb9b1('0x65')]['to'],'ListId':_0x5a4110[_0xb9b1('0x7b')]}));})[_0xb9b1('0x27')](function(_0x419297){if(!_0x419297)return;var _0x5ca674={'UserId':_0x1e25a4[_0xb9b1('0xaf')]['id'],'ContactId':_0x419297['id'],'MailAccountId':_0x5a4110['id'],'inReplyTo':_0x22d074[_0xb9b1('0xb8')],'to':_0x1e25a4[_0xb9b1('0x65')][_0xb9b1('0xac')],'cc':_0x1e25a4['body']['cc'],'subject':_0x1e25a4[_0xb9b1('0x65')][_0xb9b1('0xb9')],'attach':_0x1e25a4[_0xb9b1('0x65')][_0xb9b1('0xba')],'firstMsgDirection':_0xb9b1('0xbb'),'lastMsgAt':moment()[_0xb9b1('0xad')](_0xb9b1('0xa2')),'lastMsgDirection':_0xb9b1('0xbb'),'Messages':[_[_0xb9b1('0x5a')](_0x1e25a4[_0xb9b1('0x65')],{'messageId':_0x22d074['messageId'],'sentAt':moment()[_0xb9b1('0xad')](_0xb9b1('0xa2')),'read':!![],'MailAccountId':_0x5a4110['id'],'UserId':_0x1e25a4[_0xb9b1('0xaf')]['id'],'ContactId':_0x419297['id']})]};if(_0x1e25a4[_0xb9b1('0x65')]['Interaction']){_0x5ca674=_[_0xb9b1('0x5a')](_0x5ca674,_0x1e25a4[_0xb9b1('0x65')]['Interaction']);}return db[_0xb9b1('0x8d')][_0xb9b1('0x6c')](_0x5ca674,{'include':[{'model':db[_0xb9b1('0xa0')],'as':'Messages'}]});})[_0xb9b1('0x27')](respondWithResult(_0x38d2dd,null))[_0xb9b1('0x1c')](handleError(_0x38d2dd,null));};exports[_0xb9b1('0xbc')]=function(_0x1d4471,_0x3fdfa7){return db[_0xb9b1('0x49')][_0xb9b1('0x63')]({'where':{'id':_0x1d4471[_0xb9b1('0x61')]['id']},'include':[{'model':db[_0xb9b1('0x62')],'as':'Smtp','raw':!![],'include':[{'model':db['CloudProvider'],'as':_0xb9b1('0xaa'),'raw':!![]}]}]})['then'](handleEntityNotFound(_0x3fdfa7,null))[_0xb9b1('0x27')](function(_0x384381){if(!_0x384381[_0xb9b1('0x44')])return;var _0x309a5a=_0x384381[_0xb9b1('0xb4')]();return respondWithRpcPromise(_0xb9b1('0xbd'),'verifySmtp',{'account':_0x309a5a});})[_0xb9b1('0x27')](respondWithResult(_0x3fdfa7,null))['catch'](handleError(_0x3fdfa7,null));};exports[_0xb9b1('0xbe')]=function(_0x3342c7,_0x2dd04e){return db[_0xb9b1('0x49')][_0xb9b1('0x63')]({'where':{'id':_0x3342c7[_0xb9b1('0x61')]['id']}})[_0xb9b1('0x27')](handleEntityNotFound(_0x2dd04e,null))[_0xb9b1('0x27')](function(_0x910b1e){if(_0x910b1e&&_0x910b1e[_0xb9b1('0x41')]){throw new db[(_0xb9b1('0xbf'))][(_0xb9b1('0xc0'))](_0xb9b1('0xc1'));}return _0x910b1e;})['then'](removeEntity(_0x2dd04e,null))['catch'](handleError(_0x2dd04e,null));};exports[_0xb9b1('0xc2')]=function(_0x1c294d,_0xc2da79){return db[_0xb9b1('0x49')]['find']({'where':{'id':_0x1c294d[_0xb9b1('0x61')]['id']}})[_0xb9b1('0x27')](handleEntityNotFound(_0xc2da79,null))['then'](function(_0x50d3b8){if(_0x50d3b8){return _0x50d3b8[_0xb9b1('0xc2')](_0x1c294d[_0xb9b1('0x65')]['ids'],_['omit'](_0x1c294d['body'],[_0xb9b1('0x78'),'id'])||{})[_0xb9b1('0xc3')](function(_0x55792b){for(var _0x3e13f6=0x0;_0x3e13f6<_0x1c294d['body'][_0xb9b1('0x78')][_0xb9b1('0x55')];_0x3e13f6+=0x1){socket[_0xb9b1('0xc4')](_0xb9b1('0xc5'),{'UserId':Number(_0x1c294d['body'][_0xb9b1('0x78')][_0x3e13f6]),'MailAccountId':Number(_0x1c294d[_0xb9b1('0x61')]['id'])});}return _0x55792b;});}})[_0xb9b1('0x27')](respondWithResult(_0xc2da79,null))[_0xb9b1('0x1c')](handleError(_0xc2da79,null));};exports[_0xb9b1('0xc6')]=function(_0x220caa,_0x15ac58){return db[_0xb9b1('0x49')][_0xb9b1('0x63')]({'where':{'id':_0x220caa[_0xb9b1('0x61')]['id']}})['then'](handleEntityNotFound(_0x15ac58,null))[_0xb9b1('0x27')](function(_0x4122b9){if(_0x4122b9){return _0x4122b9[_0xb9b1('0xc6')](_0x220caa[_0xb9b1('0x50')][_0xb9b1('0x78')])[_0xb9b1('0x27')](function(){if(_[_0xb9b1('0xc7')](_0x220caa[_0xb9b1('0x50')][_0xb9b1('0x78')])){for(var _0x265eac=0x0;_0x265eac<_0x220caa[_0xb9b1('0x50')][_0xb9b1('0x78')][_0xb9b1('0x55')];_0x265eac+=0x1){socket[_0xb9b1('0xc4')](_0xb9b1('0xc8'),{'UserId':Number(_0x220caa['query'][_0xb9b1('0x78')][_0x265eac]),'MailAccountId':Number(_0x220caa[_0xb9b1('0x61')]['id'])});}}else{socket[_0xb9b1('0xc4')](_0xb9b1('0xc8'),{'UserId':Number(_0x220caa[_0xb9b1('0x50')]['ids']),'MailAccountId':Number(_0x220caa[_0xb9b1('0x61')]['id'])});}});}})[_0xb9b1('0x27')](respondWithStatusCode(_0x15ac58,null))['catch'](handleError(_0x15ac58,null));};exports[_0xb9b1('0xc9')]=function(_0x50d9ec,_0xa7fe6a){var _0x561cc6={};var _0x5b161e={};var _0x166b64;var _0x93aeae;return db[_0xb9b1('0x49')][_0xb9b1('0x6e')]({'where':{'id':_0x50d9ec[_0xb9b1('0x61')]['id']}})['then'](handleEntityNotFound(_0xa7fe6a,null))[_0xb9b1('0x27')](function(_0x599f74){if(_0x599f74){_0x166b64=_0x599f74;_0x5b161e[_0xb9b1('0x4e')]=_[_0xb9b1('0x4f')](db['User'][_0xb9b1('0x4a')]);_0x5b161e[_0xb9b1('0x50')]=_['keys'](_0x50d9ec[_0xb9b1('0x50')]);_0x5b161e['filters']=_[_0xb9b1('0x53')](_0x5b161e[_0xb9b1('0x4e')],_0x5b161e[_0xb9b1('0x50')]);_0x561cc6[_0xb9b1('0x52')]=_[_0xb9b1('0x53')](_0x5b161e[_0xb9b1('0x4e')],qs[_0xb9b1('0x54')](_0x50d9ec[_0xb9b1('0x50')]['fields']));_0x561cc6[_0xb9b1('0x52')]=_0x561cc6[_0xb9b1('0x52')][_0xb9b1('0x55')]?_0x561cc6['attributes']:_0x5b161e['model'];_0x561cc6[_0xb9b1('0x76')]=qs[_0xb9b1('0x57')](_0x50d9ec[_0xb9b1('0x50')]['sort']);_0x561cc6['where']=qs[_0xb9b1('0x51')](_[_0xb9b1('0x70')](_0x50d9ec[_0xb9b1('0x50')],_0x5b161e[_0xb9b1('0x51')]));if(_0x50d9ec[_0xb9b1('0x50')][_0xb9b1('0x59')]){_0x561cc6['where']=_[_0xb9b1('0x5a')](_0x561cc6[_0xb9b1('0x58')],{'$or':_[_0xb9b1('0x71')](_0x561cc6[_0xb9b1('0x52')],function(_0x15936d){var _0x45de98={};_0x45de98[_0x15936d]={'$like':'%'+_0x50d9ec[_0xb9b1('0x50')]['filter']+'%'};return _0x45de98;})});}_0x561cc6=_[_0xb9b1('0x5a')]({},_0x561cc6,_0x50d9ec['options']);return _0x166b64[_0xb9b1('0xc9')](_0x561cc6);}})[_0xb9b1('0x27')](function(_0x569688){if(_0x569688){_0x93aeae=_0x569688[_0xb9b1('0x55')];if(!_0x50d9ec[_0xb9b1('0x50')][_0xb9b1('0x56')](_0xb9b1('0x6f'))){_0x561cc6[_0xb9b1('0x23')]=qs[_0xb9b1('0x23')](_0x50d9ec[_0xb9b1('0x50')][_0xb9b1('0x23')]);_0x561cc6['offset']=qs['offset'](_0x50d9ec['query'][_0xb9b1('0x21')]);}return _0x166b64[_0xb9b1('0xc9')](_0x561cc6);}})[_0xb9b1('0x27')](function(_0x50f845){if(_0x50f845){return _0x50f845?{'count':_0x93aeae,'rows':_0x50f845}:null;}})[_0xb9b1('0x27')](respondWithResult(_0xa7fe6a,null))[_0xb9b1('0x1c')](handleError(_0xa7fe6a,null));}; \ No newline at end of file +var _0x26f7=['filter','merge','where','type','VIRTUAL','includeAll','include','findAll','rows','MailServerOut','options','find','body','custom','provider','params','MailServerIn','Mail\x20Account\x20not\x20found','update','describe','addDisposition','MailAccountId','Disposition','create','findOne','hasOwnProperty','pick','removeDispositions','ids','addAnswer','CannedAnswer','getAnswers','removeAnswers','ListId','active','description','Unable\x20to\x20retrieve\x20the\x20current\x20user','userProfileId','autoAssociation','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','getImap','addImap','removeImap','setImap','getSmtp','setSmtp','addInteraction','MailInteraction','omit','getInteractions','CmContact','Contact','User','internal','Tags','tag','addApplications','transaction','sequelize','Transaction','ISOLATION_LEVELS','READ_COMMITTED','MailApplication','priority','finally','getApplications','MailMessage','$gte','split','format','inlineCss','true','CmList','List','updatedAt','DESC','CloudProvider','Smtp\x20configuration\x20not\x20found','from','%s\x20<%s>','attachments','join','root','basename','sendMail','Contacts','messageId','attach','out','YYYY-MM-DD\x20HH:mm:ss','Interaction','verifySmtp','getSmtpOptions','VerifySmtp','ValidationError','addAgents','spread','emit','userMailAccount:save','removeAgents','isArray','userMailAccount:remove','getAgents','moment','util','ioredis','../../config/logger','../../config/environment','../../mysqldb','redis','defaults','localhost','./mailAccount.socket','register','jayson/promise','client','http','then','info','MailAccount,\x20%s,\x20%s','request\x20sent','debug','MailAccount,\x20%s,\x20%s,\x20%s','stringify','error','code','message','result','catch','sendStatus','end','json','undefined','count','offset','limit','status','set','Content-Range','destroy','get','MailAccounts','UserProfileResource','stack','send','gmail','imap.gmail.com','imap.mail.yahoo.com','hotmail','imap-mail.outlook.com','outlook365','outlook.office365.com','Unknown\x20email\x20service\x20provider','smtp.gmail.com','yahoo','smtp.mail.yahoo.com','smtp-mail.outlook.com','username','password','modernAuthentication','CloudProviderId','pass','host','port','secure','service','user','authentication','Imap','Smtp','index','Pause','mandatoryDispositionPause','map','MailAccount','rawAttributes','fieldName','key','model','name','query','keys','filters','intersection','fields','attributes','length','nolimit','order','sort'];(function(_0x2b2c42,_0x1dd69f){var _0x4aabf2=function(_0x2c206a){while(--_0x2c206a){_0x2b2c42['push'](_0x2b2c42['shift']());}};_0x4aabf2(++_0x1dd69f);}(_0x26f7,0x67));var _0x726f=function(_0x3ef496,_0x48243a){_0x3ef496=_0x3ef496-0x0;var _0x2d99a9=_0x26f7[_0x3ef496];return _0x2d99a9;};'use strict';var moment=require(_0x726f('0x0'));var BPromise=require('bluebird');var util=require(_0x726f('0x1'));var path=require('path');var _=require('lodash');var juice=require('juice');var Redis=require(_0x726f('0x2'));var qs=require('../../components/parsers/qs');var logger=require(_0x726f('0x3'))('api');var config=require(_0x726f('0x4'));var db=require(_0x726f('0x5'))['db'];config[_0x726f('0x6')]=_[_0x726f('0x7')](config[_0x726f('0x6')],{'host':_0x726f('0x8'),'port':0x18eb});var socket=require('socket.io-emitter')(new Redis(config['redis']));require(_0x726f('0x9'))[_0x726f('0xa')](socket);var jayson=require(_0x726f('0xb'));var client=jayson[_0x726f('0xc')][_0x726f('0xd')]({'port':0x232b});function respondWithRpcPromise(_0x31fbbb,_0x33eba6,_0x43fceb,_0x1674cf){return new BPromise(function(_0x39f6d8,_0x2c1308){var _0x3f39e4=_0x1674cf||client;return _0x3f39e4['request'](_0x31fbbb,_0x43fceb)[_0x726f('0xe')](function(_0x3da936){logger[_0x726f('0xf')](_0x726f('0x10'),_0x33eba6,_0x726f('0x11'));logger[_0x726f('0x12')](_0x726f('0x13'),_0x33eba6,_0x726f('0x11'),JSON[_0x726f('0x14')](_0x3da936));if(_0x3da936[_0x726f('0x15')]){if(_0x3da936[_0x726f('0x15')][_0x726f('0x16')]===0x1f4){logger[_0x726f('0x15')](_0x726f('0x10'),_0x33eba6,_0x3da936[_0x726f('0x15')][_0x726f('0x17')]);return _0x2c1308(_0x3da936[_0x726f('0x15')][_0x726f('0x17')]);}logger[_0x726f('0x15')](_0x726f('0x10'),_0x33eba6,_0x3da936['error'][_0x726f('0x17')]);return _0x39f6d8(_0x3da936['error']['message']);}else{logger['info'](_0x726f('0x10'),_0x33eba6,_0x726f('0x11'));_0x39f6d8(_0x3da936[_0x726f('0x18')]['message']);}})[_0x726f('0x19')](function(_0x5b4e4b){logger[_0x726f('0x15')](_0x726f('0x10'),_0x33eba6,_0x5b4e4b);_0x2c1308(_0x5b4e4b);});});}function respondWithStatusCode(_0x30f082,_0x4afb31){_0x4afb31=_0x4afb31||0xcc;return function(_0xfef530){if(_0xfef530){return _0x30f082[_0x726f('0x1a')](_0x4afb31);}return _0x30f082['status'](_0x4afb31)[_0x726f('0x1b')]();};}function respondWithResult(_0x34c173,_0x4ed6b9){_0x4ed6b9=_0x4ed6b9||0xc8;return function(_0x5e8355){if(_0x5e8355){return _0x34c173['status'](_0x4ed6b9)[_0x726f('0x1c')](_0x5e8355);}};}function respondWithFilteredResult(_0x572292,_0x5f3953){return function(_0x40b2d2){if(_0x40b2d2){var _0x3c52ab=typeof _0x5f3953['offset']==='undefined'&&typeof _0x5f3953['limit']===_0x726f('0x1d');var _0x18c217=_0x40b2d2[_0x726f('0x1e')];var _0x2b559d=_0x3c52ab?0x0:_0x5f3953[_0x726f('0x1f')];var _0x40fc80=_0x3c52ab?_0x40b2d2['count']:_0x5f3953[_0x726f('0x1f')]+_0x5f3953[_0x726f('0x20')];var _0x5eae17;if(_0x40fc80>=_0x18c217){_0x40fc80=_0x18c217;_0x5eae17=0xc8;}else{_0x5eae17=0xce;}_0x572292[_0x726f('0x21')](_0x5eae17);return _0x572292[_0x726f('0x22')](_0x726f('0x23'),_0x2b559d+'-'+_0x40fc80+'/'+_0x18c217)[_0x726f('0x1c')](_0x40b2d2);}return null;};}function saveUpdates(_0x55ccba){return function(_0x38ad35){if(_0x38ad35){return _0x38ad35['update'](_0x55ccba)[_0x726f('0xe')](function(_0x1bc53a){return _0x1bc53a;});}return null;};}function removeEntity(_0x4bc7a6){return function(_0x1ed44a){if(_0x1ed44a){return _0x1ed44a[_0x726f('0x24')]()[_0x726f('0xe')](function(){var _0x2a15ce=_0x1ed44a[_0x726f('0x25')]({'plain':!![]});var _0x1195b3=_0x726f('0x26');return db[_0x726f('0x27')][_0x726f('0x24')]({'where':{'type':_0x1195b3,'resourceId':_0x2a15ce['id']}})[_0x726f('0xe')](function(){return _0x1ed44a;});})['then'](function(){_0x4bc7a6[_0x726f('0x21')](0xcc)['end']();});}};}function handleEntityNotFound(_0x3982ba){return function(_0x35f9b5){if(!_0x35f9b5){_0x3982ba[_0x726f('0x1a')](0x194);}return _0x35f9b5;};}function handleError(_0x22f844,_0x19c896){_0x19c896=_0x19c896||0x1f4;return function(_0x117ba1){logger[_0x726f('0x15')](_0x117ba1[_0x726f('0x28')]);if(_0x117ba1['name']){delete _0x117ba1['name'];}_0x22f844['status'](_0x19c896)[_0x726f('0x29')](_0x117ba1);};}function getImapHost(_0x2c5dfe){switch(_0x2c5dfe){case _0x726f('0x2a'):return _0x726f('0x2b');case'yahoo':return _0x726f('0x2c');case _0x726f('0x2d'):return _0x726f('0x2e');case _0x726f('0x2f'):return _0x726f('0x30');}throw new Error(_0x726f('0x31'),_0x2c5dfe);}function getSmtpHost(_0x554534){switch(_0x554534){case _0x726f('0x2a'):return _0x726f('0x32');case _0x726f('0x33'):return _0x726f('0x34');case'hotmail':return _0x726f('0x35');case _0x726f('0x2f'):return'smtp.office365.com';}throw new Error('Unknown\x20email\x20service\x20provider',_0x554534);}function getAuthenticationOptions(_0x41e3da,_0x4ce45f){var _0x413979={};var _0x36121e={};if(_0x41e3da){_0x413979['user']=_0x36121e['user']=_0x4ce45f[_0x726f('0x36')];_0x413979[_0x726f('0x37')]=_0x36121e['pass']=_0x4ce45f['password'];if(_0x4ce45f[_0x726f('0x38')]){_0x413979['modernAuthentication']=_0x36121e['modernAuthentication']=!![];_0x413979['CloudProviderId']=_0x36121e[_0x726f('0x39')]=_0x4ce45f[_0x726f('0x39')];_0x413979[_0x726f('0x37')]=_0x36121e[_0x726f('0x3a')]=null;}else{_0x413979['CloudProviderId']=_0x36121e[_0x726f('0x39')]=null;}_0x413979[_0x726f('0x3b')]=getImapHost(_0x41e3da);_0x413979['port']=0x3e1;_0x36121e[_0x726f('0x3b')]=getSmtpHost(_0x41e3da);_0x36121e[_0x726f('0x3c')]=0x24b;_0x36121e[_0x726f('0x3d')]=![];_0x413979[_0x726f('0x3e')]=_0x36121e['service']=null;}else{if(_0x4ce45f['authentication']){_0x413979[_0x726f('0x3f')]=_0x36121e[_0x726f('0x3f')]=_0x4ce45f[_0x726f('0x36')];_0x413979[_0x726f('0x37')]=_0x36121e[_0x726f('0x3a')]=_0x4ce45f[_0x726f('0x37')];}else{_0x413979[_0x726f('0x40')]=_0x36121e[_0x726f('0x40')]=![];_0x413979['user']=_0x36121e[_0x726f('0x3f')]=null;_0x413979['password']=_0x36121e['pass']=null;}_0x413979[_0x726f('0x3b')]=_0x4ce45f[_0x726f('0x41')][_0x726f('0x3b')];_0x413979[_0x726f('0x3c')]=_0x4ce45f[_0x726f('0x41')]['port'];_0x36121e[_0x726f('0x3b')]=_0x4ce45f[_0x726f('0x42')][_0x726f('0x3b')];_0x36121e[_0x726f('0x3c')]=_0x4ce45f[_0x726f('0x42')]['port'];}return{'Imap':_0x413979,'Smtp':_0x36121e};}exports[_0x726f('0x43')]=function(_0x1801a0,_0x5e4acc){var _0x516ccd={'include':[{'model':db['MailServerIn'],'as':_0x726f('0x41')},{'model':db['MailServerOut'],'as':_0x726f('0x42')},{'model':db[_0x726f('0x44')],'as':_0x726f('0x45')}]},_0x336fd0={},_0x452cd1={'count':0x0,'rows':[]};var _0x183120=_[_0x726f('0x46')](db[_0x726f('0x47')][_0x726f('0x48')],function(_0x11d06f){return{'name':_0x11d06f[_0x726f('0x49')],'type':_0x11d06f['type'][_0x726f('0x4a')]};});_0x336fd0[_0x726f('0x4b')]=_['map'](_0x183120,_0x726f('0x4c'));_0x336fd0[_0x726f('0x4d')]=_[_0x726f('0x4e')](_0x1801a0[_0x726f('0x4d')]);_0x336fd0[_0x726f('0x4f')]=_['intersection'](_0x336fd0['model'],_0x336fd0[_0x726f('0x4d')]);_0x516ccd['attributes']=_[_0x726f('0x50')](_0x336fd0[_0x726f('0x4b')],qs['fields'](_0x1801a0['query'][_0x726f('0x51')]));_0x516ccd['attributes']=_0x516ccd[_0x726f('0x52')][_0x726f('0x53')]?_0x516ccd[_0x726f('0x52')]:_0x336fd0[_0x726f('0x4b')];if(!_0x1801a0['query']['hasOwnProperty'](_0x726f('0x54'))){_0x516ccd[_0x726f('0x20')]=qs[_0x726f('0x20')](_0x1801a0[_0x726f('0x4d')]['limit']);_0x516ccd[_0x726f('0x1f')]=qs[_0x726f('0x1f')](_0x1801a0[_0x726f('0x4d')][_0x726f('0x1f')]);}_0x516ccd[_0x726f('0x55')]=qs[_0x726f('0x56')](_0x1801a0['query']['sort']);_0x516ccd['where']=qs[_0x726f('0x4f')](_['pick'](_0x1801a0['query'],_0x336fd0['filters']),_0x183120);if(_0x1801a0[_0x726f('0x4d')][_0x726f('0x57')]){_0x516ccd['where']=_[_0x726f('0x58')](_0x516ccd[_0x726f('0x59')],{'$or':_[_0x726f('0x46')](_0x183120,function(_0x5eeee2){if(_0x5eeee2[_0x726f('0x5a')]!==_0x726f('0x5b')){var _0x45f822={};_0x45f822[_0x5eeee2['name']]={'$like':'%'+_0x1801a0[_0x726f('0x4d')][_0x726f('0x57')]+'%'};return _0x45f822;}})});}_0x516ccd=_['merge']({},_0x516ccd,_0x1801a0['options']);var _0x1e900c={'where':_0x516ccd[_0x726f('0x59')]};return db['MailAccount'][_0x726f('0x1e')](_0x1e900c)['then'](function(_0x33d504){_0x452cd1['count']=_0x33d504;if(_0x1801a0['query'][_0x726f('0x5c')]){_0x516ccd[_0x726f('0x5d')]=[{'all':!![]}];}return db['MailAccount'][_0x726f('0x5e')](_0x516ccd);})['then'](function(_0x36e729){_0x452cd1[_0x726f('0x5f')]=_0x36e729;return _0x452cd1;})[_0x726f('0xe')](respondWithFilteredResult(_0x5e4acc,_0x516ccd))[_0x726f('0x19')](handleError(_0x5e4acc,null));};exports['show']=function(_0x1796af,_0xaee72c){var _0x538ab5={'raw':![],'where':{'id':_0x1796af['params']['id']},'include':[{'model':db['MailServerIn'],'as':_0x726f('0x41')},{'model':db[_0x726f('0x60')],'as':_0x726f('0x42')},{'model':db['Pause'],'as':_0x726f('0x45')}]},_0x101047={};_0x101047[_0x726f('0x4b')]=_[_0x726f('0x4e')](db[_0x726f('0x47')]['rawAttributes']);_0x101047[_0x726f('0x4d')]=_[_0x726f('0x4e')](_0x1796af[_0x726f('0x4d')]);_0x101047[_0x726f('0x4f')]=_[_0x726f('0x50')](_0x101047[_0x726f('0x4b')],_0x101047[_0x726f('0x4d')]);_0x538ab5[_0x726f('0x52')]=_['intersection'](_0x101047[_0x726f('0x4b')],qs[_0x726f('0x51')](_0x1796af['query']['fields']));_0x538ab5[_0x726f('0x52')]=_0x538ab5['attributes'][_0x726f('0x53')]?_0x538ab5[_0x726f('0x52')]:_0x101047[_0x726f('0x4b')];if(_0x1796af[_0x726f('0x4d')][_0x726f('0x5c')]){_0x538ab5[_0x726f('0x5d')]=[{'all':!![]}];}_0x538ab5=_[_0x726f('0x58')]({},_0x538ab5,_0x1796af[_0x726f('0x61')]);return db[_0x726f('0x47')][_0x726f('0x62')](_0x538ab5)[_0x726f('0xe')](handleEntityNotFound(_0xaee72c,null))[_0x726f('0xe')](respondWithResult(_0xaee72c,null))['catch'](handleError(_0xaee72c,null));};exports['update']=function(_0xc56c5f,_0x181ea1){if(_0xc56c5f[_0x726f('0x63')]['id']){delete _0xc56c5f[_0x726f('0x63')]['id'];}var _0x4b559b=_0xc56c5f[_0x726f('0x63')]['provider']===_0x726f('0x64')?null:_0xc56c5f[_0x726f('0x63')][_0x726f('0x65')];var _0xd29afd=_0xc56c5f[_0x726f('0x63')]['Imap']||{};var _0x335e9a=_0xc56c5f[_0x726f('0x63')][_0x726f('0x42')]||{};if(_0x4b559b){_0xd29afd[_0x726f('0x3b')]=getImapHost(_0x4b559b);_0xd29afd[_0x726f('0x3c')]=0x3e1;_0x335e9a['host']=getSmtpHost(_0x4b559b);_0x335e9a[_0x726f('0x3c')]=0x24b;_0x335e9a['secure']=![];}if(_0x335e9a[_0x726f('0x38')]){_0x335e9a[_0x726f('0x3d')]=![];}else{_0x335e9a[_0x726f('0x39')]=null;}if(!_0xd29afd['modernAuthentication'])_0xd29afd['CloudProviderId']=null;_0xc56c5f[_0x726f('0x63')][_0x726f('0x41')]=_0xd29afd;_0xc56c5f[_0x726f('0x63')]['Smtp']=_0x335e9a;return db[_0x726f('0x47')][_0x726f('0x62')]({'where':{'id':_0xc56c5f[_0x726f('0x66')]['id']},'include':[{'model':db[_0x726f('0x67')],'as':_0x726f('0x41')},{'model':db[_0x726f('0x60')],'as':_0x726f('0x42')},{'model':db['Pause'],'as':_0x726f('0x45')}]})['then'](handleEntityNotFound(_0x181ea1,null))['then'](function(_0xd83ffb){if(!_0xd83ffb)throw new Error(_0x726f('0x68'));if(_0xd83ffb[_0x726f('0x3e')])delete _0xc56c5f[_0x726f('0x63')][_0x726f('0x41')];return _0xd83ffb;})[_0x726f('0xe')](saveUpdates(_0xc56c5f['body'],null))['then'](function(_0x4f5f01){if(!_0xc56c5f[_0x726f('0x63')]['Imap'])return _0x4f5f01;return db[_0x726f('0x67')][_0x726f('0x69')](_0xc56c5f[_0x726f('0x63')][_0x726f('0x41')],{'where':{'MailAccountId':_0x4f5f01['id']}})['then'](function(){return _0x4f5f01;});})['then'](function(_0x63ef3f){if(!_0xc56c5f[_0x726f('0x63')][_0x726f('0x42')])return _0x63ef3f;return db[_0x726f('0x60')][_0x726f('0x69')](_0xc56c5f[_0x726f('0x63')][_0x726f('0x42')],{'where':{'MailAccountId':_0x63ef3f['id']}})[_0x726f('0xe')](function(){return _0x63ef3f;});})[_0x726f('0xe')](respondWithResult(_0x181ea1,null))['catch'](handleError(_0x181ea1,null));};exports[_0x726f('0x6a')]=function(_0x525ded,_0x7341bd){return db[_0x726f('0x47')]['describe']()[_0x726f('0xe')](respondWithResult(_0x7341bd,null))[_0x726f('0x19')](handleError(_0x7341bd,null));};exports[_0x726f('0x6b')]=function(_0x348804,_0x1a7027){if(_0x348804[_0x726f('0x63')]['id']){delete _0x348804[_0x726f('0x63')]['id'];}return db[_0x726f('0x47')][_0x726f('0x62')]({'where':{'id':_0x348804[_0x726f('0x66')]['id']}})[_0x726f('0xe')](handleEntityNotFound(_0x1a7027,null))[_0x726f('0xe')](function(_0x5e0c33){if(_0x5e0c33){_0x348804[_0x726f('0x63')][_0x726f('0x6c')]=_0x5e0c33['id'];return db[_0x726f('0x6d')][_0x726f('0x6e')](_0x348804[_0x726f('0x63')]);}})[_0x726f('0xe')](respondWithResult(_0x1a7027,null))[_0x726f('0x19')](handleError(_0x1a7027,null));};exports['getDispositions']=function(_0xbfce0d,_0x340183){var _0x3740a3={'raw':![],'where':{}};var _0x5405f6={};var _0x2461af={'count':0x0,'rows':[]};return db['MailAccount'][_0x726f('0x6f')]({'where':{'id':_0xbfce0d[_0x726f('0x66')]['id']}})[_0x726f('0xe')](handleEntityNotFound(_0x340183,null))[_0x726f('0xe')](function(_0x57d077){if(_0x57d077){_0x5405f6[_0x726f('0x4b')]=_[_0x726f('0x4e')](db[_0x726f('0x6d')][_0x726f('0x48')]);_0x5405f6[_0x726f('0x4d')]=_[_0x726f('0x4e')](_0xbfce0d[_0x726f('0x4d')]);_0x5405f6[_0x726f('0x4f')]=_[_0x726f('0x50')](_0x5405f6[_0x726f('0x4b')],_0x5405f6[_0x726f('0x4d')]);_0x3740a3[_0x726f('0x52')]=_['intersection'](_0x5405f6[_0x726f('0x4b')],qs[_0x726f('0x51')](_0xbfce0d[_0x726f('0x4d')]['fields']));_0x3740a3['attributes']=_0x3740a3[_0x726f('0x52')][_0x726f('0x53')]?_0x3740a3[_0x726f('0x52')]:_0x5405f6[_0x726f('0x4b')];if(!_0xbfce0d['query'][_0x726f('0x70')](_0x726f('0x54'))){_0x3740a3['limit']=qs[_0x726f('0x20')](_0xbfce0d[_0x726f('0x4d')]['limit']);_0x3740a3[_0x726f('0x1f')]=qs[_0x726f('0x1f')](_0xbfce0d[_0x726f('0x4d')]['offset']);}_0x3740a3['order']=qs[_0x726f('0x56')](_0xbfce0d[_0x726f('0x4d')][_0x726f('0x56')]);_0x3740a3[_0x726f('0x59')]=qs[_0x726f('0x4f')](_[_0x726f('0x71')](_0xbfce0d['query'],_0x5405f6[_0x726f('0x4f')]));_0x3740a3[_0x726f('0x59')][_0x726f('0x6c')]=_0x57d077['id'];if(_0xbfce0d[_0x726f('0x4d')][_0x726f('0x57')]){_0x3740a3[_0x726f('0x59')]=_[_0x726f('0x58')](_0x3740a3[_0x726f('0x59')],{'$or':_[_0x726f('0x46')](_0x3740a3[_0x726f('0x52')],function(_0x79547c){var _0x1b67fa={};_0x1b67fa[_0x79547c]={'$like':'%'+_0xbfce0d[_0x726f('0x4d')][_0x726f('0x57')]+'%'};return _0x1b67fa;})});}_0x3740a3=_['merge']({},_0x3740a3,_0xbfce0d['options']);return db[_0x726f('0x6d')]['count']({'where':_0x3740a3[_0x726f('0x59')]})[_0x726f('0xe')](function(_0x3a8c2b){_0x2461af[_0x726f('0x1e')]=_0x3a8c2b;if(_0xbfce0d[_0x726f('0x4d')][_0x726f('0x5c')]){_0x3740a3[_0x726f('0x5d')]=[{'all':!![]}];}return db['Disposition'][_0x726f('0x5e')](_0x3740a3);})[_0x726f('0xe')](function(_0xaae3c5){_0x2461af[_0x726f('0x5f')]=_0xaae3c5;return _0x2461af;});}})['then'](respondWithFilteredResult(_0x340183,_0x3740a3))[_0x726f('0x19')](handleError(_0x340183,null));};exports[_0x726f('0x72')]=function(_0xf15527,_0x50c4b9){return db[_0x726f('0x47')]['find']({'where':{'id':_0xf15527[_0x726f('0x66')]['id']}})[_0x726f('0xe')](handleEntityNotFound(_0x50c4b9,null))[_0x726f('0xe')](function(_0x33dc98){if(_0x33dc98){return _0x33dc98[_0x726f('0x72')](_0xf15527[_0x726f('0x4d')][_0x726f('0x73')]);}})['then'](respondWithStatusCode(_0x50c4b9,null))[_0x726f('0x19')](handleError(_0x50c4b9,null));};exports[_0x726f('0x74')]=function(_0x4e8a1a,_0x40c73f){if(_0x4e8a1a[_0x726f('0x63')]['id']){delete _0x4e8a1a['body']['id'];}return db[_0x726f('0x47')][_0x726f('0x62')]({'where':{'id':_0x4e8a1a['params']['id']}})[_0x726f('0xe')](handleEntityNotFound(_0x40c73f,null))[_0x726f('0xe')](function(_0x91f851){if(_0x91f851){_0x4e8a1a['body']['MailAccountId']=_0x91f851['id'];return db[_0x726f('0x75')][_0x726f('0x6e')](_0x4e8a1a['body']);}})[_0x726f('0xe')](respondWithResult(_0x40c73f,null))[_0x726f('0x19')](handleError(_0x40c73f,null));};exports[_0x726f('0x76')]=function(_0x1eb292,_0x3e506a){var _0x513c15={'raw':![],'where':{}};var _0x295bd8={};var _0xfca422={'count':0x0,'rows':[]};return db['MailAccount'][_0x726f('0x6f')]({'where':{'id':_0x1eb292[_0x726f('0x66')]['id']}})[_0x726f('0xe')](handleEntityNotFound(_0x3e506a,null))[_0x726f('0xe')](function(_0x3ca34d){if(_0x3ca34d){_0x295bd8[_0x726f('0x4b')]=_[_0x726f('0x4e')](db[_0x726f('0x75')][_0x726f('0x48')]);_0x295bd8[_0x726f('0x4d')]=_[_0x726f('0x4e')](_0x1eb292['query']);_0x295bd8[_0x726f('0x4f')]=_[_0x726f('0x50')](_0x295bd8[_0x726f('0x4b')],_0x295bd8[_0x726f('0x4d')]);_0x513c15[_0x726f('0x52')]=_['intersection'](_0x295bd8['model'],qs[_0x726f('0x51')](_0x1eb292[_0x726f('0x4d')]['fields']));_0x513c15[_0x726f('0x52')]=_0x513c15[_0x726f('0x52')][_0x726f('0x53')]?_0x513c15[_0x726f('0x52')]:_0x295bd8[_0x726f('0x4b')];if(!_0x1eb292[_0x726f('0x4d')][_0x726f('0x70')]('nolimit')){_0x513c15['limit']=qs[_0x726f('0x20')](_0x1eb292[_0x726f('0x4d')]['limit']);_0x513c15['offset']=qs[_0x726f('0x1f')](_0x1eb292['query'][_0x726f('0x1f')]);}_0x513c15[_0x726f('0x55')]=qs['sort'](_0x1eb292['query']['sort']);_0x513c15[_0x726f('0x59')]=qs[_0x726f('0x4f')](_[_0x726f('0x71')](_0x1eb292[_0x726f('0x4d')],_0x295bd8['filters']));_0x513c15[_0x726f('0x59')][_0x726f('0x6c')]=_0x3ca34d['id'];if(_0x1eb292['query'][_0x726f('0x57')]){_0x513c15[_0x726f('0x59')]=_['merge'](_0x513c15[_0x726f('0x59')],{'$or':_['map'](_0x513c15[_0x726f('0x52')],function(_0x5288a3){var _0x42ccb9={};_0x42ccb9[_0x5288a3]={'$like':'%'+_0x1eb292[_0x726f('0x4d')][_0x726f('0x57')]+'%'};return _0x42ccb9;})});}_0x513c15=_[_0x726f('0x58')]({},_0x513c15,_0x1eb292[_0x726f('0x61')]);return db['CannedAnswer'][_0x726f('0x1e')]({'where':_0x513c15[_0x726f('0x59')]})['then'](function(_0x31bca9){_0xfca422[_0x726f('0x1e')]=_0x31bca9;if(_0x1eb292[_0x726f('0x4d')][_0x726f('0x5c')]){_0x513c15['include']=[{'all':!![]}];}return db[_0x726f('0x75')][_0x726f('0x5e')](_0x513c15);})[_0x726f('0xe')](function(_0x104b88){_0xfca422[_0x726f('0x5f')]=_0x104b88;return _0xfca422;});}})[_0x726f('0xe')](respondWithFilteredResult(_0x3e506a,_0x513c15))[_0x726f('0x19')](handleError(_0x3e506a,null));};exports['removeAnswers']=function(_0x137090,_0xfe72eb){return db[_0x726f('0x47')][_0x726f('0x62')]({'where':{'id':_0x137090[_0x726f('0x66')]['id']}})[_0x726f('0xe')](handleEntityNotFound(_0xfe72eb,null))[_0x726f('0xe')](function(_0x40d3d1){if(_0x40d3d1){return _0x40d3d1[_0x726f('0x77')](_0x137090['query'][_0x726f('0x73')]);}})[_0x726f('0xe')](respondWithStatusCode(_0xfe72eb,null))[_0x726f('0x19')](handleError(_0xfe72eb,null));};exports[_0x726f('0x6e')]=function(_0x52247d,_0x457b7a){var _0x5d8ebc={'name':_0x52247d[_0x726f('0x63')][_0x726f('0x4c')],'key':_0x52247d[_0x726f('0x63')][_0x726f('0x4a')],'provider':_0x52247d[_0x726f('0x63')]['provider']===_0x726f('0x64')?null:_0x52247d['body'][_0x726f('0x65')],'email':_0x52247d[_0x726f('0x63')]['email'],'ListId':_0x52247d[_0x726f('0x63')][_0x726f('0x78')],'active':!_['isNil'](_0x52247d[_0x726f('0x63')][_0x726f('0x79')])?_0x52247d[_0x726f('0x63')][_0x726f('0x79')]:!![],'description':_0x52247d[_0x726f('0x63')][_0x726f('0x7a')]||null};var _0x40297f=getAuthenticationOptions(_0x5d8ebc[_0x726f('0x65')],_0x52247d[_0x726f('0x63')]);_0x5d8ebc[_0x726f('0x41')]=_0x40297f['Imap'];_0x5d8ebc[_0x726f('0x42')]=_0x40297f[_0x726f('0x42')];return db[_0x726f('0x47')][_0x726f('0x6e')](_0x5d8ebc,{'include':[{'model':db[_0x726f('0x60')],'as':'Smtp'},{'model':db[_0x726f('0x67')],'as':_0x726f('0x41')}]})[_0x726f('0xe')](function(_0x5752b9){var _0x2e8512=_0x52247d[_0x726f('0x3f')][_0x726f('0x25')]({'plain':!![]});if(!_0x2e8512)throw new Error(_0x726f('0x7b'));if(_0x2e8512['role']===_0x726f('0x3f')){var _0x3c0c90=_0x5752b9[_0x726f('0x25')]({'plain':!![]});return db['UserProfileSection'][_0x726f('0x62')]({'where':{'name':_0x726f('0x26'),'userProfileId':_0x2e8512[_0x726f('0x7c')]},'raw':!![]})[_0x726f('0xe')](function(_0x15a5fb){if(_0x15a5fb&&_0x15a5fb[_0x726f('0x7d')]===0x0){return db['UserProfileResource'][_0x726f('0x6e')]({'name':_0x3c0c90[_0x726f('0x4c')],'resourceId':_0x3c0c90['id'],'type':_0x15a5fb[_0x726f('0x4c')],'sectionId':_0x15a5fb['id']},{})['then'](function(){return _0x5752b9;});}else{return _0x5752b9;}})[_0x726f('0x19')](function(_0x22fc8a){logger[_0x726f('0x15')](_0x726f('0x7e'),_0x22fc8a);throw _0x22fc8a;});}return _0x5752b9;})[_0x726f('0xe')](respondWithResult(_0x457b7a,0xc9))['catch'](handleError(_0x457b7a,null));};exports[_0x726f('0x7f')]=function(_0x283cb1,_0xc7561e){return db[_0x726f('0x47')][_0x726f('0x6f')]({'where':{'id':_0x283cb1[_0x726f('0x66')]['id']}})[_0x726f('0xe')](handleEntityNotFound(_0xc7561e,null))[_0x726f('0xe')](function(_0x403dfc){if(_0x403dfc){return _0x403dfc['getImap']();}return null;})['then'](respondWithResult(_0xc7561e,null))[_0x726f('0x19')](handleError(_0xc7561e,null));};exports[_0x726f('0x80')]=function(_0x3888ef,_0x22abe2){if(_0x3888ef[_0x726f('0x63')]['id']){delete _0x3888ef[_0x726f('0x63')]['id'];}return db['MailAccount'][_0x726f('0x62')]({'where':{'id':_0x3888ef[_0x726f('0x66')]['id']}})[_0x726f('0xe')](handleEntityNotFound(_0x22abe2,null))[_0x726f('0xe')](function(_0x256c77){if(_0x256c77){_0x3888ef['body'][_0x726f('0x6c')]=_0x256c77['id'];return db['MailServerIn'][_0x726f('0x6e')](_0x3888ef['body']);}})['then'](respondWithResult(_0x22abe2,null))['catch'](handleError(_0x22abe2,null));};exports[_0x726f('0x81')]=function(_0x2305a8,_0x4ed5d5){return db[_0x726f('0x47')][_0x726f('0x6f')]({'where':{'id':_0x2305a8[_0x726f('0x66')]['id']}})['then'](handleEntityNotFound(_0x4ed5d5,null))[_0x726f('0xe')](function(_0x1b3c76){if(_0x1b3c76){return _0x1b3c76[_0x726f('0x82')](null);}return null;})[_0x726f('0xe')](respondWithStatusCode(_0x4ed5d5,null))[_0x726f('0x19')](handleError(_0x4ed5d5,null));};exports[_0x726f('0x83')]=function(_0x3360a4,_0x357c33){return db[_0x726f('0x47')]['findOne']({'where':{'id':_0x3360a4[_0x726f('0x66')]['id']}})[_0x726f('0xe')](handleEntityNotFound(_0x357c33,null))[_0x726f('0xe')](function(_0x23a578){if(_0x23a578){return _0x23a578[_0x726f('0x83')]();}return null;})['then'](respondWithResult(_0x357c33,null))[_0x726f('0x19')](handleError(_0x357c33,null));};exports['addSmtp']=function(_0x14b201,_0x46f93d){if(_0x14b201[_0x726f('0x63')]['id']){delete _0x14b201[_0x726f('0x63')]['id'];}return db[_0x726f('0x47')][_0x726f('0x62')]({'where':{'id':_0x14b201['params']['id']}})['then'](handleEntityNotFound(_0x46f93d,null))[_0x726f('0xe')](function(_0x423aca){if(_0x423aca){_0x14b201[_0x726f('0x63')][_0x726f('0x6c')]=_0x423aca['id'];return db['MailServerOut'][_0x726f('0x6e')](_0x14b201[_0x726f('0x63')]);}})[_0x726f('0xe')](respondWithResult(_0x46f93d,null))['catch'](handleError(_0x46f93d,null));};exports['removeSmtp']=function(_0x12d288,_0x3b59b8){return db[_0x726f('0x47')]['findOne']({'where':{'id':_0x12d288[_0x726f('0x66')]['id']}})['then'](handleEntityNotFound(_0x3b59b8,null))[_0x726f('0xe')](function(_0x531a0b){if(_0x531a0b){return _0x531a0b[_0x726f('0x84')](null);}return null;})[_0x726f('0xe')](respondWithStatusCode(_0x3b59b8,null))[_0x726f('0x19')](handleError(_0x3b59b8,null));};exports[_0x726f('0x85')]=function(_0x273dde,_0x4099a3){return db[_0x726f('0x86')][_0x726f('0x62')]({'where':{'id':_0x273dde[_0x726f('0x66')]['id']}})[_0x726f('0xe')](handleEntityNotFound(_0x4099a3,null))['then'](function(_0x2ae6b0){if(_0x2ae6b0){return _0x2ae6b0[_0x726f('0x85')](_0x273dde[_0x726f('0x63')][_0x726f('0x73')],_[_0x726f('0x87')](_0x273dde[_0x726f('0x63')],['ids','id'])||{});}})[_0x726f('0xe')](respondWithResult(_0x4099a3,null))[_0x726f('0x19')](handleError(_0x4099a3,null));};exports[_0x726f('0x88')]=function(_0x3d7c26,_0x2f31dd){var _0x55021d={'raw':![],'where':{}};var _0x42e818={};var _0x2b98b2={'count':0x0,'rows':[]};return db[_0x726f('0x47')][_0x726f('0x6f')]({'where':{'id':_0x3d7c26[_0x726f('0x66')]['id']}})[_0x726f('0xe')](handleEntityNotFound(_0x2f31dd,null))[_0x726f('0xe')](function(_0x292dda){if(_0x292dda){_0x42e818[_0x726f('0x4b')]=_[_0x726f('0x4e')](db[_0x726f('0x86')][_0x726f('0x48')]);_0x42e818[_0x726f('0x4d')]=_[_0x726f('0x4e')](_0x3d7c26[_0x726f('0x4d')]);_0x42e818['filters']=_[_0x726f('0x50')](_0x42e818[_0x726f('0x4b')],_0x42e818['query']);_0x55021d[_0x726f('0x52')]=_[_0x726f('0x50')](_0x42e818[_0x726f('0x4b')],qs[_0x726f('0x51')](_0x3d7c26['query'][_0x726f('0x51')]));_0x55021d['attributes']=_0x55021d['attributes'][_0x726f('0x53')]?_0x55021d['attributes']:_0x42e818[_0x726f('0x4b')];if(!_0x3d7c26[_0x726f('0x4d')]['hasOwnProperty']('nolimit')){_0x55021d[_0x726f('0x20')]=qs[_0x726f('0x20')](_0x3d7c26['query'][_0x726f('0x20')]);_0x55021d[_0x726f('0x1f')]=qs[_0x726f('0x1f')](_0x3d7c26[_0x726f('0x4d')][_0x726f('0x1f')]);}_0x55021d['order']=qs[_0x726f('0x56')](_0x3d7c26[_0x726f('0x4d')][_0x726f('0x56')]);_0x55021d[_0x726f('0x59')]=qs[_0x726f('0x4f')](_[_0x726f('0x71')](_0x3d7c26[_0x726f('0x4d')],_0x42e818['filters']));_0x55021d[_0x726f('0x59')]['MailAccountId']=_0x292dda['id'];if(_0x3d7c26[_0x726f('0x4d')][_0x726f('0x57')]){_0x55021d['where']=_[_0x726f('0x58')](_0x55021d[_0x726f('0x59')],{'$or':_[_0x726f('0x46')](_0x55021d[_0x726f('0x52')],function(_0x39c0ed){var _0x4db8ff={};_0x4db8ff[_0x39c0ed]={'$like':'%'+_0x3d7c26[_0x726f('0x4d')][_0x726f('0x57')]+'%'};return _0x4db8ff;})});}_0x55021d=_[_0x726f('0x58')]({},_0x55021d,_0x3d7c26[_0x726f('0x61')]);return db[_0x726f('0x86')][_0x726f('0x1e')]({'where':_0x55021d['where']})[_0x726f('0xe')](function(_0x499aa5){_0x2b98b2[_0x726f('0x1e')]=_0x499aa5;if(_0x3d7c26['query'][_0x726f('0x5c')]){_0x55021d[_0x726f('0x5d')]=[{'model':db[_0x726f('0x89')],'as':_0x726f('0x8a'),'required':![]},{'model':db[_0x726f('0x8b')],'as':'Owner','attributes':['name','fullname',_0x726f('0x8c')],'required':![]},{'model':db['Tag'],'as':_0x726f('0x8d'),'attributes':['id',_0x726f('0x4c'),'color'],'where':_0x3d7c26[_0x726f('0x4d')][_0x726f('0x8e')]?{'id':_0x3d7c26['query']['tag']}:undefined,'required':_0x3d7c26[_0x726f('0x4d')][_0x726f('0x8e')]?!![]:![]}];}return db[_0x726f('0x86')]['findAll'](_0x55021d);})['then'](function(_0x11e82a){_0x2b98b2['rows']=_0x11e82a;return _0x2b98b2;});}})[_0x726f('0xe')](respondWithFilteredResult(_0x2f31dd,_0x55021d))[_0x726f('0x19')](handleError(_0x2f31dd,null));};exports[_0x726f('0x8f')]=function addApplications(_0x5dafbe,_0x3cbfbe){var _0xdfc23=_0x5dafbe['params']['id'];var _0x41c23f=_0x5dafbe[_0x726f('0x63')];var _0x23b8c2=0xc8;var _0x13a244=null;return db['sequelize'][_0x726f('0x90')]({'isolationLevel':db[_0x726f('0x91')][_0x726f('0x92')][_0x726f('0x93')][_0x726f('0x94')]},function(_0x2501e8){return db[_0x726f('0x47')][_0x726f('0x6f')]({'where':{'id':_0xdfc23},'transaction':_0x2501e8})[_0x726f('0xe')](function(_0x33ed42){if(_0x33ed42){return db['MailApplication'][_0x726f('0x24')]({'where':{'MailAccountId':_0xdfc23},'transaction':_0x2501e8})['then'](function(){var _0x254540=_[_0x726f('0x46')](_0x41c23f,function(_0xc2d3ac){_0xc2d3ac['MailAccountId']=_0xdfc23;return _0xc2d3ac;});return db[_0x726f('0x95')]['bulkCreate'](_0x254540,{'transaction':_0x2501e8});});}else{_0x23b8c2=0x194;_0x13a244=[];}});})[_0x726f('0xe')](function(){if(_0x23b8c2!==0x194){return db[_0x726f('0x95')]['findAndCountAll']({'where':{'MailAccountId':_0xdfc23},'order':_0x726f('0x96')})['then'](function(_0x50450c){_0x13a244=_0x50450c;});}})[_0x726f('0x19')](function(_0x22c742){_0x23b8c2=0x1f4;logger['error'](_0x22c742['stack']);if(_0x22c742[_0x726f('0x4c')]){delete _0x22c742[_0x726f('0x4c')];}_0x13a244=_0x22c742;})[_0x726f('0x97')](function(){if(_0x13a244===null){_0x3cbfbe['sendStatus'](_0x23b8c2);}else{if(_0x23b8c2===0x1f4){_0x3cbfbe[_0x726f('0x21')](_0x23b8c2)[_0x726f('0x29')](_0x13a244);}else{_0x3cbfbe[_0x726f('0x21')](_0x23b8c2)[_0x726f('0x1c')](_0x13a244);}}});};exports['getApplications']=function(_0x406756,_0x3fb615){var _0x314cbf={};var _0x156441={};var _0x3de823;var _0x88e40d;return db[_0x726f('0x47')][_0x726f('0x6f')]({'where':{'id':_0x406756['params']['id']}})['then'](handleEntityNotFound(_0x3fb615,null))[_0x726f('0xe')](function(_0x1f1152){if(_0x1f1152){_0x3de823=_0x1f1152;_0x156441[_0x726f('0x4b')]=_['keys'](db[_0x726f('0x95')][_0x726f('0x48')]);_0x156441['query']=_['keys'](_0x406756[_0x726f('0x4d')]);_0x156441['filters']=_['intersection'](_0x156441[_0x726f('0x4b')],_0x156441['query']);_0x314cbf[_0x726f('0x52')]=_[_0x726f('0x50')](_0x156441['model'],qs['fields'](_0x406756[_0x726f('0x4d')][_0x726f('0x51')]));_0x314cbf[_0x726f('0x52')]=_0x314cbf['attributes'][_0x726f('0x53')]?_0x314cbf[_0x726f('0x52')]:_0x156441[_0x726f('0x4b')];_0x314cbf['order']=qs[_0x726f('0x56')](_0x406756[_0x726f('0x4d')][_0x726f('0x56')]);_0x314cbf[_0x726f('0x59')]=qs[_0x726f('0x4f')](_[_0x726f('0x71')](_0x406756[_0x726f('0x4d')],_0x156441[_0x726f('0x4f')]));if(_0x406756[_0x726f('0x4d')]['filter']){_0x314cbf[_0x726f('0x59')]=_['merge'](_0x314cbf[_0x726f('0x59')],{'$or':_[_0x726f('0x46')](_0x314cbf[_0x726f('0x52')],function(_0x4e79d2){var _0xbb0cc3={};_0xbb0cc3[_0x4e79d2]={'$like':'%'+_0x406756[_0x726f('0x4d')][_0x726f('0x57')]+'%'};return _0xbb0cc3;})});}_0x314cbf=_[_0x726f('0x58')]({},_0x314cbf,_0x406756[_0x726f('0x61')]);return _0x3de823['getApplications'](_0x314cbf);}})[_0x726f('0xe')](function(_0x29ba83){if(_0x29ba83){_0x88e40d=_0x29ba83['length'];if(!_0x406756[_0x726f('0x4d')][_0x726f('0x70')](_0x726f('0x54'))){_0x314cbf[_0x726f('0x20')]=qs['limit'](_0x406756[_0x726f('0x4d')][_0x726f('0x20')]);_0x314cbf[_0x726f('0x1f')]=qs[_0x726f('0x1f')](_0x406756[_0x726f('0x4d')][_0x726f('0x1f')]);}return _0x3de823[_0x726f('0x98')](_0x314cbf);}})['then'](function(_0x2e0f42){if(_0x2e0f42){return _0x2e0f42?{'count':_0x88e40d,'rows':_0x2e0f42}:null;}})[_0x726f('0xe')](respondWithResult(_0x3fb615,null))[_0x726f('0x19')](handleError(_0x3fb615,null));};exports['getMessages']=function(_0x2d3300,_0x4ce1ef){var _0x321b36={'raw':!![],'where':{}};var _0xdcbb52={};var _0x4b9c37={'count':0x0,'rows':[]};return db[_0x726f('0x47')][_0x726f('0x6f')]({'where':{'id':_0x2d3300[_0x726f('0x66')]['id']}})[_0x726f('0xe')](handleEntityNotFound(_0x4ce1ef,null))[_0x726f('0xe')](function(_0x44465c){if(_0x44465c){_0xdcbb52[_0x726f('0x4b')]=_['keys'](db[_0x726f('0x99')]['rawAttributes']);_0xdcbb52['query']=_[_0x726f('0x4e')](_0x2d3300[_0x726f('0x4d')]);_0xdcbb52[_0x726f('0x4f')]=_[_0x726f('0x50')](_0xdcbb52[_0x726f('0x4b')],_0xdcbb52[_0x726f('0x4d')]);_0x321b36[_0x726f('0x52')]=_[_0x726f('0x50')](_0xdcbb52[_0x726f('0x4b')],qs[_0x726f('0x51')](_0x2d3300['query'][_0x726f('0x51')]));_0x321b36[_0x726f('0x52')]=_0x321b36[_0x726f('0x52')][_0x726f('0x53')]?_0x321b36[_0x726f('0x52')]:_0xdcbb52[_0x726f('0x4b')];if(!_0x2d3300[_0x726f('0x4d')]['hasOwnProperty']('nolimit')){_0x321b36[_0x726f('0x20')]=qs[_0x726f('0x20')](_0x2d3300[_0x726f('0x4d')][_0x726f('0x20')]);_0x321b36[_0x726f('0x1f')]=qs[_0x726f('0x1f')](_0x2d3300[_0x726f('0x4d')][_0x726f('0x1f')]);}_0x321b36['order']=qs[_0x726f('0x56')](_0x2d3300['query'][_0x726f('0x56')]);_0x321b36[_0x726f('0x59')]=qs[_0x726f('0x4f')](_[_0x726f('0x71')](_0x2d3300[_0x726f('0x4d')],_0xdcbb52[_0x726f('0x4f')]));_0x321b36['where']['MailAccountId']=_0x44465c['id'];if(_0x2d3300[_0x726f('0x4d')][_0x726f('0x57')]){_0x321b36['where']=_[_0x726f('0x58')](_0x321b36[_0x726f('0x59')],{'$or':_[_0x726f('0x46')](_0x321b36[_0x726f('0x52')],function(_0x36d7aa){var _0x4ed050={};_0x4ed050[_0x36d7aa]={'$like':'%'+_0x2d3300[_0x726f('0x4d')]['filter']+'%'};return _0x4ed050;})});}if(_0x2d3300[_0x726f('0x4d')][_0x726f('0x9a')]){var _0x5a4c43=_0x2d3300[_0x726f('0x4d')]['$gte'][_0x726f('0x9b')](',');var _0x5a25ee={};_0x5a25ee[_0x5a4c43[0x0]]={'$gte':moment(_0x5a4c43[0x1])[_0x726f('0x9c')]('YYYY-MM-DD\x20HH:mm:ss')};_0x321b36['where']=_[_0x726f('0x58')](_0x321b36[_0x726f('0x59')],_0x5a25ee);}_0x321b36=_[_0x726f('0x58')]({},_0x321b36,_0x2d3300[_0x726f('0x61')]);return db[_0x726f('0x99')]['count']({'where':_0x321b36['where']})[_0x726f('0xe')](function(_0x33bf4f){_0x4b9c37[_0x726f('0x1e')]=_0x33bf4f;if(_0x2d3300[_0x726f('0x4d')]['includeAll']){_0x321b36[_0x726f('0x5d')]=[{'all':!![]}];}return db[_0x726f('0x99')][_0x726f('0x5e')](_0x321b36);})[_0x726f('0xe')](function(_0x4ca365){if(_0x2d3300[_0x726f('0x4d')][_0x726f('0x9d')]===_0x726f('0x9e')){for(var _0x20760e=0x0;_0x20760e<_0x4ca365[_0x726f('0x53')];_0x20760e++){_0x4ca365[_0x20760e]['body']=juice(_0x4ca365[_0x20760e][_0x726f('0x63')]);}}_0x4b9c37[_0x726f('0x5f')]=_0x4ca365;return _0x4b9c37;});}})[_0x726f('0xe')](respondWithFilteredResult(_0x4ce1ef,_0x321b36))['catch'](handleError(_0x4ce1ef,null));};exports[_0x726f('0x29')]=function(_0x56dce3,_0x5bab86){var _0x5d0568,_0xb94404={},_0x57f1df;if(_0x56dce3['body']['to']){_0x57f1df=_0x56dce3[_0x726f('0x63')]['to'][_0x726f('0x9b')](',')[0x0];}return db[_0x726f('0x47')][_0x726f('0x62')]({'where':{'id':_0x56dce3[_0x726f('0x66')]['id']},'include':[{'model':db[_0x726f('0x9f')],'as':_0x726f('0xa0'),'include':[{'model':db[_0x726f('0x89')],'as':'Contacts','where':{'email':_0x57f1df},'limit':0x1,'order':[[_0x726f('0xa1'),_0x726f('0xa2')]]}]},{'model':db[_0x726f('0x60')],'as':_0x726f('0x42'),'raw':!![],'include':[{'model':db[_0x726f('0xa3')],'as':_0x726f('0xa3'),'raw':!![]}]}]})[_0x726f('0xe')](handleEntityNotFound(_0x5bab86,null))[_0x726f('0xe')](function(_0x4efb27){if(!_0x4efb27)return;_0x5d0568=_0x4efb27;if(!_0x4efb27[_0x726f('0x42')])throw new Error(_0x726f('0xa4'));if(_['isNil'](_0x56dce3[_0x726f('0x63')][_0x726f('0xa5')])){_0x56dce3[_0x726f('0x63')][_0x726f('0xa5')]=util[_0x726f('0x9c')](_0x726f('0xa6'),_0x4efb27[_0x726f('0x4c')],_0x4efb27['email']||_0x4efb27[_0x726f('0x42')][_0x726f('0x3f')]);}if(_0x56dce3[_0x726f('0x63')][_0x726f('0xa7')]&&_0x56dce3['body'][_0x726f('0xa7')]['length']){for(var _0x3d6428=0x0;_0x3d6428<_0x56dce3[_0x726f('0x63')][_0x726f('0xa7')]['length'];_0x3d6428+=0x1){_0x56dce3[_0x726f('0x63')][_0x726f('0xa7')][_0x3d6428]={'filename':_0x56dce3[_0x726f('0x63')][_0x726f('0xa7')][_0x3d6428][_0x726f('0x4c')],'path':path[_0x726f('0xa8')](config[_0x726f('0xa9')],'server/files/attachments',_0x56dce3[_0x726f('0x63')]['attachments'][_0x3d6428][_0x726f('0xaa')])};}}var _0x371771=_0x4efb27['getSmtpOptions']();return respondWithRpcPromise('SendMail',_0x726f('0xab'),{'account':_0x371771,'message':_0x56dce3['body']});})[_0x726f('0xe')](function(_0x276f3d){if(!_0x276f3d)return;_0xb94404=_0x276f3d;if(!_0x5d0568[_0x726f('0xa0')])throw new Error('List\x20not\x20found');if(_0x5d0568[_0x726f('0xa0')]['Contacts']['length'])return _0x5d0568['List'][_0x726f('0xac')][0x0];return db[_0x726f('0x89')][_0x726f('0x6e')](_[_0x726f('0x7')](_0x56dce3['body'],{'firstName':_0x56dce3['body']['to'],'email':_0x56dce3[_0x726f('0x63')]['to'],'phone':_0x56dce3['body']['to'],'ListId':_0x5d0568[_0x726f('0x78')]}));})[_0x726f('0xe')](function(_0x488825){if(!_0x488825)return;var _0x5bc4de={'UserId':_0x56dce3[_0x726f('0x3f')]['id'],'ContactId':_0x488825['id'],'MailAccountId':_0x5d0568['id'],'inReplyTo':_0xb94404[_0x726f('0xad')],'to':_0x56dce3['body'][_0x726f('0xa5')],'cc':_0x56dce3['body']['cc'],'subject':_0x56dce3[_0x726f('0x63')]['subject'],'attach':_0x56dce3[_0x726f('0x63')][_0x726f('0xae')],'firstMsgDirection':_0x726f('0xaf'),'lastMsgAt':moment()[_0x726f('0x9c')]('YYYY-MM-DD\x20HH:mm:ss'),'lastMsgDirection':'out','Messages':[_[_0x726f('0x58')](_0x56dce3[_0x726f('0x63')],{'messageId':_0xb94404[_0x726f('0xad')],'sentAt':moment()[_0x726f('0x9c')](_0x726f('0xb0')),'read':!![],'MailAccountId':_0x5d0568['id'],'UserId':_0x56dce3['user']['id'],'ContactId':_0x488825['id']})]};if(_0x56dce3[_0x726f('0x63')][_0x726f('0xb1')]){_0x5bc4de=_[_0x726f('0x58')](_0x5bc4de,_0x56dce3[_0x726f('0x63')][_0x726f('0xb1')]);}return db[_0x726f('0x86')][_0x726f('0x6e')](_0x5bc4de,{'include':[{'model':db[_0x726f('0x99')],'as':'Messages'}]});})[_0x726f('0xe')](respondWithResult(_0x5bab86,null))['catch'](handleError(_0x5bab86,null));};exports[_0x726f('0xb2')]=function(_0x45089f,_0x470ec0){return db['MailAccount'][_0x726f('0x62')]({'where':{'id':_0x45089f[_0x726f('0x66')]['id']},'include':[{'model':db[_0x726f('0x60')],'as':_0x726f('0x42'),'raw':!![],'include':[{'model':db[_0x726f('0xa3')],'as':_0x726f('0xa3'),'raw':!![]}]}]})['then'](handleEntityNotFound(_0x470ec0,null))['then'](function(_0xc8d5d0){if(!_0xc8d5d0[_0x726f('0x42')])return;var _0x3d0047=_0xc8d5d0[_0x726f('0xb3')]();return respondWithRpcPromise(_0x726f('0xb4'),_0x726f('0xb2'),{'account':_0x3d0047});})['then'](respondWithResult(_0x470ec0,null))[_0x726f('0x19')](handleError(_0x470ec0,null));};exports[_0x726f('0x24')]=function(_0x233a41,_0x1c6579){return db[_0x726f('0x47')][_0x726f('0x62')]({'where':{'id':_0x233a41[_0x726f('0x66')]['id']}})[_0x726f('0xe')](handleEntityNotFound(_0x1c6579,null))[_0x726f('0xe')](function(_0x4e2e55){if(_0x4e2e55&&_0x4e2e55[_0x726f('0x3e')]){throw new db['Sequelize'][(_0x726f('0xb5'))]('You\x20can\x27t\x20remove\x20the\x20mail\x20service\x20account');}return _0x4e2e55;})['then'](removeEntity(_0x1c6579,null))['catch'](handleError(_0x1c6579,null));};exports[_0x726f('0xb6')]=function(_0x556a0f,_0x21fab2){return db[_0x726f('0x47')][_0x726f('0x62')]({'where':{'id':_0x556a0f['params']['id']}})[_0x726f('0xe')](handleEntityNotFound(_0x21fab2,null))[_0x726f('0xe')](function(_0x81af38){if(_0x81af38){return _0x81af38[_0x726f('0xb6')](_0x556a0f[_0x726f('0x63')][_0x726f('0x73')],_[_0x726f('0x87')](_0x556a0f[_0x726f('0x63')],[_0x726f('0x73'),'id'])||{})[_0x726f('0xb7')](function(_0x54753c){for(var _0x231845=0x0;_0x231845<_0x556a0f[_0x726f('0x63')][_0x726f('0x73')]['length'];_0x231845+=0x1){socket[_0x726f('0xb8')](_0x726f('0xb9'),{'UserId':Number(_0x556a0f[_0x726f('0x63')][_0x726f('0x73')][_0x231845]),'MailAccountId':Number(_0x556a0f['params']['id'])});}return _0x54753c;});}})['then'](respondWithResult(_0x21fab2,null))['catch'](handleError(_0x21fab2,null));};exports[_0x726f('0xba')]=function(_0x398fc4,_0x5974b8){return db[_0x726f('0x47')][_0x726f('0x62')]({'where':{'id':_0x398fc4[_0x726f('0x66')]['id']}})[_0x726f('0xe')](handleEntityNotFound(_0x5974b8,null))[_0x726f('0xe')](function(_0x178f3a){if(_0x178f3a){return _0x178f3a[_0x726f('0xba')](_0x398fc4['query']['ids'])[_0x726f('0xe')](function(){if(_[_0x726f('0xbb')](_0x398fc4[_0x726f('0x4d')]['ids'])){for(var _0x16c205=0x0;_0x16c205<_0x398fc4[_0x726f('0x4d')][_0x726f('0x73')][_0x726f('0x53')];_0x16c205+=0x1){socket[_0x726f('0xb8')](_0x726f('0xbc'),{'UserId':Number(_0x398fc4['query'][_0x726f('0x73')][_0x16c205]),'MailAccountId':Number(_0x398fc4[_0x726f('0x66')]['id'])});}}else{socket[_0x726f('0xb8')](_0x726f('0xbc'),{'UserId':Number(_0x398fc4['query'][_0x726f('0x73')]),'MailAccountId':Number(_0x398fc4['params']['id'])});}});}})[_0x726f('0xe')](respondWithStatusCode(_0x5974b8,null))[_0x726f('0x19')](handleError(_0x5974b8,null));};exports[_0x726f('0xbd')]=function(_0x28c4be,_0x53d9eb){var _0x4a7131={};var _0x2018a1={};var _0x1c315b;var _0x5ca895;return db[_0x726f('0x47')][_0x726f('0x6f')]({'where':{'id':_0x28c4be[_0x726f('0x66')]['id']}})[_0x726f('0xe')](handleEntityNotFound(_0x53d9eb,null))['then'](function(_0x5d14ff){if(_0x5d14ff){_0x1c315b=_0x5d14ff;_0x2018a1[_0x726f('0x4b')]=_[_0x726f('0x4e')](db['User']['rawAttributes']);_0x2018a1['query']=_[_0x726f('0x4e')](_0x28c4be[_0x726f('0x4d')]);_0x2018a1[_0x726f('0x4f')]=_['intersection'](_0x2018a1[_0x726f('0x4b')],_0x2018a1[_0x726f('0x4d')]);_0x4a7131[_0x726f('0x52')]=_[_0x726f('0x50')](_0x2018a1['model'],qs[_0x726f('0x51')](_0x28c4be[_0x726f('0x4d')][_0x726f('0x51')]));_0x4a7131[_0x726f('0x52')]=_0x4a7131[_0x726f('0x52')]['length']?_0x4a7131[_0x726f('0x52')]:_0x2018a1[_0x726f('0x4b')];_0x4a7131[_0x726f('0x55')]=qs[_0x726f('0x56')](_0x28c4be[_0x726f('0x4d')][_0x726f('0x56')]);_0x4a7131[_0x726f('0x59')]=qs[_0x726f('0x4f')](_['pick'](_0x28c4be[_0x726f('0x4d')],_0x2018a1[_0x726f('0x4f')]));if(_0x28c4be[_0x726f('0x4d')][_0x726f('0x57')]){_0x4a7131[_0x726f('0x59')]=_['merge'](_0x4a7131[_0x726f('0x59')],{'$or':_[_0x726f('0x46')](_0x4a7131[_0x726f('0x52')],function(_0x1c1cd2){var _0x568927={};_0x568927[_0x1c1cd2]={'$like':'%'+_0x28c4be['query'][_0x726f('0x57')]+'%'};return _0x568927;})});}_0x4a7131=_['merge']({},_0x4a7131,_0x28c4be[_0x726f('0x61')]);return _0x1c315b[_0x726f('0xbd')](_0x4a7131);}})['then'](function(_0x4d2171){if(_0x4d2171){_0x5ca895=_0x4d2171[_0x726f('0x53')];if(!_0x28c4be['query'][_0x726f('0x70')](_0x726f('0x54'))){_0x4a7131[_0x726f('0x20')]=qs[_0x726f('0x20')](_0x28c4be['query'][_0x726f('0x20')]);_0x4a7131[_0x726f('0x1f')]=qs['offset'](_0x28c4be[_0x726f('0x4d')]['offset']);}return _0x1c315b['getAgents'](_0x4a7131);}})['then'](function(_0x55f955){if(_0x55f955){return _0x55f955?{'count':_0x5ca895,'rows':_0x55f955}:null;}})[_0x726f('0xe')](respondWithResult(_0x53d9eb,null))[_0x726f('0x19')](handleError(_0x53d9eb,null));}; \ No newline at end of file diff --git a/server/api/mailAccount/mailAccount.events.js b/server/api/mailAccount/mailAccount.events.js index 87929a1..9ec368a 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 _0xe590=['hasOwnProperty','exports','events','../../mysqldb','MailAccount','setMaxListeners','save','update','remove','emit'];(function(_0x16d24f,_0x4686a5){var _0x3beec6=function(_0x552ae0){while(--_0x552ae0){_0x16d24f['push'](_0x16d24f['shift']());}};_0x3beec6(++_0x4686a5);}(_0xe590,0xca));var _0x0e59=function(_0x21eb98,_0x396529){_0x21eb98=_0x21eb98-0x0;var _0x2992e1=_0xe590[_0x21eb98];return _0x2992e1;};'use strict';var EventEmitter=require(_0x0e59('0x0'));var MailAccount=require(_0x0e59('0x1'))['db'][_0x0e59('0x2')];var MailAccountEvents=new EventEmitter();MailAccountEvents[_0x0e59('0x3')](0x0);var events={'afterCreate':_0x0e59('0x4'),'afterUpdate':_0x0e59('0x5'),'afterDestroy':_0x0e59('0x6')};function emitEvent(_0xbc3bc1){return function(_0x1980fe,_0xd9231c,_0x49c653){MailAccountEvents[_0x0e59('0x7')](_0xbc3bc1+':'+_0x1980fe['id'],_0x1980fe);MailAccountEvents[_0x0e59('0x7')](_0xbc3bc1,_0x1980fe);_0x49c653(null);};}for(var e in events){if(events[_0x0e59('0x8')](e)){var event=events[e];MailAccount['hook'](e,emitEvent(event));}}module[_0x0e59('0x9')]=MailAccountEvents; \ No newline at end of file +var _0x3dcc=['events','update','remove','emit','hasOwnProperty','hook','exports'];(function(_0x34450e,_0x350b08){var _0x348049=function(_0x43e6ef){while(--_0x43e6ef){_0x34450e['push'](_0x34450e['shift']());}};_0x348049(++_0x350b08);}(_0x3dcc,0xf5));var _0xc3dc=function(_0x3f7598,_0x212e37){_0x3f7598=_0x3f7598-0x0;var _0x51fb16=_0x3dcc[_0x3f7598];return _0x51fb16;};'use strict';var EventEmitter=require(_0xc3dc('0x0'));var MailAccount=require('../../mysqldb')['db']['MailAccount'];var MailAccountEvents=new EventEmitter();MailAccountEvents['setMaxListeners'](0x0);var events={'afterCreate':'save','afterUpdate':_0xc3dc('0x1'),'afterDestroy':_0xc3dc('0x2')};function emitEvent(_0x5ca0a4){return function(_0x1bfd18,_0x1fc578,_0x2df5c0){MailAccountEvents['emit'](_0x5ca0a4+':'+_0x1bfd18['id'],_0x1bfd18);MailAccountEvents[_0xc3dc('0x3')](_0x5ca0a4,_0x1bfd18);_0x2df5c0(null);};}for(var e in events){if(events[_0xc3dc('0x4')](e)){var event=events[e];MailAccount[_0xc3dc('0x5')](e,emitEvent(event));}}module[_0xc3dc('0x6')]=MailAccountEvents; \ No newline at end of file diff --git a/server/api/mailAccount/mailAccount.model.js b/server/api/mailAccount/mailAccount.model.js index 16c7f57..9b58560 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 _0xcac7=['exports','mail_accounts','provider','custom','service','Smtp','host','port','secure','authentication','modernAuthentication','CloudProvider','auth','OAuth2','user','data5'];(function(_0x1efa20,_0x198e49){var _0x46472e=function(_0x4a8b22){while(--_0x4a8b22){_0x1efa20['push'](_0x1efa20['shift']());}};_0x46472e(++_0x198e49);}(_0xcac7,0x1d0));var _0x7cac=function(_0x4e1813,_0x3de68d){_0x4e1813=_0x4e1813-0x0;var _0x5a255c=_0xcac7[_0x4e1813];return _0x5a255c;};'use strict';var attributes=require('./mailAccount.attributes');module[_0x7cac('0x0')]=function(_0x47cb6e){return _0x47cb6e['define']('MailAccount',attributes,{'tableName':_0x7cac('0x1'),'paranoid':![],'indexes':[],'timestamps':!![],'instanceMethods':{'getSmtpOptions':function(){var _0x3c72bf=this;var _0x4a242d={'id':_0x3c72bf['id'],'tls':{'rejectUnauthorized':![]}};if(_0x3c72bf[_0x7cac('0x2')]!==_0x7cac('0x3')){_0x4a242d[_0x7cac('0x4')]=_0x3c72bf[_0x7cac('0x2')];}else{_0x4a242d['host']=_0x3c72bf[_0x7cac('0x5')][_0x7cac('0x6')];_0x4a242d[_0x7cac('0x7')]=_0x3c72bf['Smtp'][_0x7cac('0x7')];_0x4a242d[_0x7cac('0x8')]=_0x3c72bf[_0x7cac('0x5')][_0x7cac('0x8')];}if(_0x3c72bf[_0x7cac('0x5')][_0x7cac('0x9')]){if(_0x3c72bf['Smtp'][_0x7cac('0xa')]){if(!_0x3c72bf[_0x7cac('0x5')][_0x7cac('0xb')])throw new Error('Cloud\x20Provider\x20configuration\x20not\x20found');_0x4a242d[_0x7cac('0xc')]={'type':_0x7cac('0xd'),'user':_0x3c72bf[_0x7cac('0x5')][_0x7cac('0xe')],'accessToken':_0x3c72bf['Smtp'][_0x7cac('0xb')][_0x7cac('0xf')]};}else{_0x4a242d[_0x7cac('0xc')]={'user':_0x3c72bf[_0x7cac('0x5')][_0x7cac('0xe')],'pass':_0x3c72bf[_0x7cac('0x5')]['pass']};}}return _0x4a242d;}}});}; \ No newline at end of file +var _0xec3f=['modernAuthentication','CloudProvider','Cloud\x20Provider\x20configuration\x20not\x20found','OAuth2','user','data5','auth','pass','./mailAccount.attributes','define','mail_accounts','provider','service','Smtp','host','port','secure','authentication'];(function(_0x1f5834,_0x421950){var _0x418e31=function(_0x5f5cc4){while(--_0x5f5cc4){_0x1f5834['push'](_0x1f5834['shift']());}};_0x418e31(++_0x421950);}(_0xec3f,0x1a6));var _0xfec3=function(_0x115e73,_0x4b1539){_0x115e73=_0x115e73-0x0;var _0x5c45bf=_0xec3f[_0x115e73];return _0x5c45bf;};'use strict';var attributes=require(_0xfec3('0x0'));module['exports']=function(_0x3ec4ea){return _0x3ec4ea[_0xfec3('0x1')]('MailAccount',attributes,{'tableName':_0xfec3('0x2'),'paranoid':![],'indexes':[],'timestamps':!![],'instanceMethods':{'getSmtpOptions':function(){var _0x2a0f60=this;var _0x58f7ee={'id':_0x2a0f60['id'],'tls':{'rejectUnauthorized':![]}};if(_0x2a0f60[_0xfec3('0x3')]!=='custom'){_0x58f7ee[_0xfec3('0x4')]=_0x2a0f60[_0xfec3('0x3')];}else{_0x58f7ee['host']=_0x2a0f60[_0xfec3('0x5')][_0xfec3('0x6')];_0x58f7ee['port']=_0x2a0f60[_0xfec3('0x5')][_0xfec3('0x7')];_0x58f7ee[_0xfec3('0x8')]=_0x2a0f60[_0xfec3('0x5')][_0xfec3('0x8')];}if(_0x2a0f60[_0xfec3('0x5')][_0xfec3('0x9')]){if(_0x2a0f60[_0xfec3('0x5')][_0xfec3('0xa')]){if(!_0x2a0f60[_0xfec3('0x5')][_0xfec3('0xb')])throw new Error(_0xfec3('0xc'));_0x58f7ee['auth']={'type':_0xfec3('0xd'),'user':_0x2a0f60['Smtp'][_0xfec3('0xe')],'accessToken':_0x2a0f60[_0xfec3('0x5')][_0xfec3('0xb')][_0xfec3('0xf')]};}else{_0x58f7ee[_0xfec3('0x10')]={'user':_0x2a0f60[_0xfec3('0x5')][_0xfec3('0xe')],'pass':_0x2a0f60['Smtp'][_0xfec3('0x11')]};}}return _0x58f7ee;}}});}; \ No newline at end of file diff --git a/server/api/mailAccount/mailAccount.rpc.js b/server/api/mailAccount/mailAccount.rpc.js index b4cb1dc..8245f43 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 _0x326f=['localhost','socket.io-emitter','request','MailAccount,\x20%s,\x20%s','debug','request\x20sent','stringify','error','code','message','info','result','catch','options','attributes','limit','include','map','model','then','GetMailAccount','ShowMailAccount','MailAccount','find','raw','setDataValue','smtpOptions','getSmtpOptions','NotifyMailAccount','body','mail','keys','CmContact','rawAttributes','createdAt','updatedAt','CompanyId','ListId','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','from','account','CmList','List','Contacts','DESC','MailApplication','Applications','MailServerOut','Smtp','CloudProvider','get','applications','list','priority','asc','autoclose','push','close','*,*,*,*','length','defaults','create','List\x20not\x20found','messageId','generate','attach','format','YYYY-MM-DD\x20HH:mm:ss','MailInteraction','MailMessage','Messages','inReplyTo','spread','update','interaction','created','subject','attachments','originTo','bcc','originChannel','ChatOfflineMessageId','Attachment','Attachments','User','name','UserId','unshift','waitForTheAssignedAgent','queueId','queue','waitForTheAssignedQueue','Start','lodash','randomstring','ioredis','../../mysqldb','../../config/logger','rpc','../../config/environment','jayson/promise','client','http','redis'];(function(_0x34021d,_0x753aa6){var _0x16597b=function(_0x2d040a){while(--_0x2d040a){_0x34021d['push'](_0x34021d['shift']());}};_0x16597b(++_0x753aa6);}(_0x326f,0xd1));var _0xf326=function(_0x4d4b0c,_0x177a2f){_0x4d4b0c=_0x4d4b0c-0x0;var _0x1b9336=_0x326f[_0x4d4b0c];return _0x1b9336;};'use strict';var _=require(_0xf326('0x0'));var moment=require('moment');var BPromise=require('bluebird');var rs=require(_0xf326('0x1'));var Redis=require(_0xf326('0x2'));var db=require(_0xf326('0x3'))['db'];var logger=require(_0xf326('0x4'))(_0xf326('0x5'));var config=require(_0xf326('0x6'));var jayson=require(_0xf326('0x7'));var client=jayson[_0xf326('0x8')][_0xf326('0x9')]({'port':0x232c});config[_0xf326('0xa')]=_['defaults'](config[_0xf326('0xa')],{'host':_0xf326('0xb'),'port':0x18eb});var socket=require(_0xf326('0xc'))(new Redis(config[_0xf326('0xa')]));require('./mailAccount.socket')['register'](socket);function respondWithRpcPromise(_0x592975,_0x3bacf2,_0x1fc80e){return new BPromise(function(_0x163416,_0x2686e1){return client[_0xf326('0xd')](_0x592975,_0x1fc80e)['then'](function(_0x136e2d){logger['info'](_0xf326('0xe'),_0x3bacf2,'request\x20sent');logger[_0xf326('0xf')]('MailAccount,\x20%s,\x20%s,\x20%s',_0x3bacf2,_0xf326('0x10'),JSON[_0xf326('0x11')](_0x136e2d));if(_0x136e2d['error']){if(_0x136e2d[_0xf326('0x12')][_0xf326('0x13')]===0x1f4){logger[_0xf326('0x12')](_0xf326('0xe'),_0x3bacf2,_0x136e2d['error'][_0xf326('0x14')]);return _0x2686e1(_0x136e2d['error']['message']);}logger[_0xf326('0x12')](_0xf326('0xe'),_0x3bacf2,_0x136e2d[_0xf326('0x12')][_0xf326('0x14')]);return _0x163416(_0x136e2d[_0xf326('0x12')][_0xf326('0x14')]);}else{logger[_0xf326('0x15')](_0xf326('0xe'),_0x3bacf2,'request\x20sent');_0x163416(_0x136e2d[_0xf326('0x16')][_0xf326('0x14')]);}})[_0xf326('0x17')](function(_0x31ffb9){logger[_0xf326('0x12')](_0xf326('0xe'),_0x3bacf2,_0x31ffb9);_0x2686e1(_0x31ffb9);});});}exports['GetMailAccount']=function(_0x4a5b6c){var _0x56ad41=this;return new Promise(function(_0x16e605,_0x289f4b){return db['MailAccount']['findAll']({'raw':_0x4a5b6c[_0xf326('0x18')]?_0x4a5b6c['options']['raw']===undefined?!![]:![]:!![],'where':_0x4a5b6c[_0xf326('0x18')]?_0x4a5b6c[_0xf326('0x18')]['where']||null:null,'attributes':_0x4a5b6c['options']?_0x4a5b6c[_0xf326('0x18')][_0xf326('0x19')]||null:null,'limit':_0x4a5b6c['options']?_0x4a5b6c[_0xf326('0x18')][_0xf326('0x1a')]||null:null,'include':_0x4a5b6c[_0xf326('0x18')]?_0x4a5b6c[_0xf326('0x18')][_0xf326('0x1b')]?_[_0xf326('0x1c')](_0x4a5b6c['options']['include'],function(_0x4f31f6){return{'model':db[_0x4f31f6[_0xf326('0x1d')]],'as':_0x4f31f6['as'],'attributes':_0x4f31f6[_0xf326('0x19')],'include':_0x4f31f6[_0xf326('0x1b')]?_[_0xf326('0x1c')](_0x4f31f6[_0xf326('0x1b')],function(_0x410237){return{'model':db[_0x410237['model']],'as':_0x410237['as'],'attributes':_0x410237[_0xf326('0x19')],'include':_0x410237[_0xf326('0x1b')]?_[_0xf326('0x1c')](_0x410237['include'],function(_0x1617d2){return{'model':db[_0x1617d2['model']],'as':_0x1617d2['as'],'attributes':_0x1617d2['attributes']};}):[]};}):[]};}):[]:[]})[_0xf326('0x1e')](function(_0x1ae23a){logger[_0xf326('0x15')]('GetMailAccount',_0x4a5b6c);logger[_0xf326('0xf')](_0xf326('0x1f'),_0x4a5b6c,JSON['stringify'](_0x1ae23a));_0x16e605(_0x1ae23a);})[_0xf326('0x17')](function(_0x119ab8){logger[_0xf326('0x12')](_0xf326('0x1f'),_0x119ab8[_0xf326('0x14')],_0x4a5b6c);_0x289f4b(_0x56ad41[_0xf326('0x12')](0x1f4,_0x119ab8[_0xf326('0x14')]));});});};exports[_0xf326('0x20')]=function(_0x43b951){var _0x349a03=this;return new Promise(function(_0x4b52f2,_0x1035ed){return db[_0xf326('0x21')][_0xf326('0x22')]({'raw':_0x43b951['options']?_0x43b951[_0xf326('0x18')][_0xf326('0x23')]===undefined?!![]:![]:!![],'where':_0x43b951[_0xf326('0x18')]?_0x43b951['options']['where']||null:null,'attributes':_0x43b951[_0xf326('0x18')]?_0x43b951[_0xf326('0x18')][_0xf326('0x19')]||null:null,'include':_0x43b951[_0xf326('0x18')]?_0x43b951[_0xf326('0x18')][_0xf326('0x1b')]?_[_0xf326('0x1c')](_0x43b951[_0xf326('0x18')]['include'],function(_0x461e93){return{'model':db[_0x461e93[_0xf326('0x1d')]],'as':_0x461e93['as'],'attributes':_0x461e93['attributes'],'include':_0x461e93[_0xf326('0x1b')]?_['map'](_0x461e93[_0xf326('0x1b')],function(_0x481b64){return{'model':db[_0x481b64['model']],'as':_0x481b64['as'],'attributes':_0x481b64[_0xf326('0x19')],'include':_0x481b64['include']?_[_0xf326('0x1c')](_0x481b64['include'],function(_0x310dbb){return{'model':db[_0x310dbb[_0xf326('0x1d')]],'as':_0x310dbb['as'],'attributes':_0x310dbb[_0xf326('0x19')]};}):[]};}):[]};}):[]:[]})['then'](function(_0x3dcc7e){if(_0x43b951[_0xf326('0x18')]['smtp']===!![])_0x3dcc7e[_0xf326('0x24')](_0xf326('0x25'),_0x3dcc7e[_0xf326('0x26')]());logger[_0xf326('0x15')]('ShowMailAccount',_0x43b951);logger[_0xf326('0xf')](_0xf326('0x20'),_0x43b951,JSON[_0xf326('0x11')](_0x3dcc7e));_0x4b52f2(_0x3dcc7e);})[_0xf326('0x17')](function(_0x1d88ed){logger['error'](_0xf326('0x20'),_0x1d88ed[_0xf326('0x14')],_0x43b951);_0x1035ed(_0x349a03['error'](0x1f4,_0x1d88ed['message']));});});};exports[_0xf326('0x27')]=function(_0x577634){var _0x55dfa8=this;return new Promise(function(_0x22d462,_0x5d6ae2){var _0x3e1e8c={'body':_0x577634[_0xf326('0x28')],'channel':_0xf326('0x29')};var _0x39611e=_['difference'](_[_0xf326('0x2a')](db[_0xf326('0x2b')][_0xf326('0x2c')]),[_0xf326('0x2d'),_0xf326('0x2e'),_0xf326('0x2f'),_0xf326('0x30')]);var _0x224a32=![];if(_0x577634[_0xf326('0x28')]['id']){delete _0x577634[_0xf326('0x28')]['id'];}if(_[_0xf326('0x31')](_0x577634[_0xf326('0x28')]['from'])){return _0x5d6ae2(_0x55dfa8[_0xf326('0x12')](0x1f4,_0xf326('0x32')));}if(_[_0xf326('0x31')](_0x577634[_0xf326('0x28')][_0xf326('0x28')])||_0x577634[_0xf326('0x28')]['body']===''){return _0x5d6ae2(_0x55dfa8[_0xf326('0x12')](0x1f4,_0xf326('0x33')));}if(_['isNil'](_0x577634[_0xf326('0x28')][_0xf326('0x34')])){return _0x5d6ae2(_0x55dfa8[_0xf326('0x12')](0x1f4,_0xf326('0x35')+_0x39611e));}if(!_[_0xf326('0x36')](_0x39611e,_0x577634['body']['mapKey'])){return _0x5d6ae2(_0x55dfa8[_0xf326('0x12')](0x1f4,_0xf326('0x37')+_0x39611e));}var _0x5ed62e={};_0x5ed62e[_0x577634['body'][_0xf326('0x34')]]=_0x577634[_0xf326('0x28')][_0xf326('0x38')];return db['MailAccount'][_0xf326('0x22')]({'where':{'id':_0x577634[_0xf326('0x39')]['id']},'include':[{'model':db[_0xf326('0x3a')],'as':_0xf326('0x3b'),'include':[{'model':db[_0xf326('0x2b')],'as':_0xf326('0x3c'),'where':_0x5ed62e,'limit':0x1,'order':[[_0xf326('0x2e'),_0xf326('0x3d')]]}]},{'model':db[_0xf326('0x3e')],'as':_0xf326('0x3f')},{'model':db[_0xf326('0x40')],'as':_0xf326('0x41'),'include':[{'model':db[_0xf326('0x42')],'as':_0xf326('0x42')}]}]})[_0xf326('0x1e')](function(_0x59f9a7){if(_0x59f9a7&&_0x59f9a7[_0xf326('0x3b')]){var _0x1b0e03=_0x59f9a7[_0xf326('0x43')]({'plain':!![]});_0x3e1e8c[_0xf326('0x39')]=_['omit'](_0x1b0e03,[_0xf326('0x3f'),_0xf326('0x3b')]);_0x3e1e8c[_0xf326('0x39')][_0xf326('0x25')]=_0x59f9a7['getSmtpOptions']();_0x3e1e8c[_0xf326('0x44')]=_0x1b0e03[_0xf326('0x3f')];_0x3e1e8c[_0xf326('0x45')]=_0x1b0e03[_0xf326('0x3b')];_0x3e1e8c[_0xf326('0x44')]=_['orderBy'](_0x3e1e8c['applications'],[_0xf326('0x46')],[_0xf326('0x47')]);if(_0x3e1e8c[_0xf326('0x39')]&&_0x3e1e8c['account'][_0xf326('0x48')]){_0x3e1e8c[_0xf326('0x44')][_0xf326('0x49')]({'id':0x0,'priority':_0x3e1e8c['applications']['length']+0x1,'app':_0xf326('0x4a'),'appdata':'autoclose','interval':_0xf326('0x4b')});}if(_0x3e1e8c['account'][_0xf326('0x3f')]){delete _0x3e1e8c[_0xf326('0x39')][_0xf326('0x3f')];}if(_0x3e1e8c[_0xf326('0x39')][_0xf326('0x3b')]){delete _0x3e1e8c[_0xf326('0x39')][_0xf326('0x3b')];}if(_0x1b0e03['List'][_0xf326('0x3c')][_0xf326('0x4c')]){return _0x1b0e03[_0xf326('0x3b')]['Contacts'][0x0];}var _0x208ba4=_[_0xf326('0x4d')](_0x577634[_0xf326('0x28')],{'firstName':_0x577634[_0xf326('0x28')][_0xf326('0x38')],'ListId':_0x1b0e03['ListId']});_0x208ba4[_0x577634[_0xf326('0x28')][_0xf326('0x34')]]=_0x577634[_0xf326('0x28')][_0xf326('0x38')];return db['CmContact'][_0xf326('0x4e')](_0x208ba4);}else{throw new Error(_0xf326('0x4f'));}})[_0xf326('0x1e')](function(_0x29e52e){_0x3e1e8c['contact']=_0x29e52e;if(_0x29e52e){if(!_0x577634['body'][_0xf326('0x14')][_0xf326('0x50')]){_0x577634['body'][_0xf326('0x14')][_0xf326('0x50')]=rs[_0xf326('0x51')]()+'\x20'+_0x577634[_0xf326('0x28')]['message'][_0xf326('0x38')];}var _0x5657b7={'ContactId':_0x29e52e['id'],'MailAccountId':_0x577634['account']['id'],'inReplyTo':_0x577634[_0xf326('0x28')]['message'][_0xf326('0x50')],'to':_0x577634[_0xf326('0x28')][_0xf326('0x14')]['from'],'cc':_0x577634['body'][_0xf326('0x14')]['cc'],'subject':_0x577634[_0xf326('0x28')][_0xf326('0x14')]['subject'],'attach':_0x577634[_0xf326('0x28')]['message'][_0xf326('0x52')],'lastMsgAt':moment()[_0xf326('0x53')](_0xf326('0x54')),'lastMsgDirection':'in'};return db[_0xf326('0x55')][_0xf326('0x22')]({'where':{'closed':![],'MailAccountId':_0x577634[_0xf326('0x39')]['id']},'include':[{'model':db[_0xf326('0x56')],'as':_0xf326('0x57'),'attributes':[_0xf326('0x50')],'where':{'messageId':_0x577634[_0xf326('0x28')][_0xf326('0x14')][_0xf326('0x58')]}}]})[_0xf326('0x1e')](function(_0x4ca1b8){if(_0x4ca1b8){return[_0x4ca1b8,![]];}return db[_0xf326('0x55')]['create'](_0x5657b7)[_0xf326('0x1e')](function(_0x32d173){return[_0x32d173,!![]];});});}else{throw new Error('Contact\x20not\x20found');}})[_0xf326('0x59')](function(_0x5283da,_0x3255b2){if(_0x5283da){_0x224a32=_0x3255b2;if(!_0x3255b2){return _0x5283da[_0xf326('0x5a')]({'inReplyTo':_0x577634[_0xf326('0x28')][_0xf326('0x14')][_0xf326('0x50')],'to':_0x577634['body']['message'][_0xf326('0x38')],'cc':_0x577634[_0xf326('0x28')][_0xf326('0x14')]['cc'],'subject':_0x577634[_0xf326('0x28')][_0xf326('0x14')]['subject'],'attach':_0x5283da[_0xf326('0x52')]?_0x5283da[_0xf326('0x52')]:_0x577634['body']['message']['attach'],'substatus':null,'substatusAt':moment()[_0xf326('0x53')](_0xf326('0x54')),'lastMsgAt':moment()[_0xf326('0x53')](_0xf326('0x54')),'lastMsgDirection':'in'});}else{return _0x5283da;}}})[_0xf326('0x1e')](function(_0x23a56e){_0x3e1e8c[_0xf326('0x5b')]=_0x23a56e['get']({'plain':!![]});_0x3e1e8c[_0xf326('0x5b')][_0xf326('0x5c')]=_0x224a32;return db[_0xf326('0x56')][_0xf326('0x4e')]({'body':_0x577634['body'][_0xf326('0x28')],'MailAccountId':_0x577634['account']['id'],'MailInteractionId':_0x23a56e['id'],'direction':'in','ContactId':_0x3e1e8c['contact']['id'],'messageId':_0x577634[_0xf326('0x28')]['message'][_0xf326('0x50')],'from':_0x577634[_0xf326('0x28')][_0xf326('0x14')][_0xf326('0x38')],'to':_0x577634[_0xf326('0x28')]['message']['to'],'cc':_0x577634['body']['message']['cc'],'subject':_0x577634[_0xf326('0x28')][_0xf326('0x14')][_0xf326('0x5d')],'attach':_0x577634[_0xf326('0x28')][_0xf326('0x14')]['attach'],'Attachments':_0x577634[_0xf326('0x28')][_0xf326('0x14')][_0xf326('0x5e')],'originTo':_0x577634['body']['message'][_0xf326('0x5f')],'originCc':_0x577634[_0xf326('0x28')]['message']['originCc'],'bcc':_0x577634[_0xf326('0x28')]['message'][_0xf326('0x60')],'ChatWebsiteId':_0x577634['body']['message']['ChatWebsiteId']||null,'originChannel':_0x577634[_0xf326('0x28')][_0xf326('0x14')][_0xf326('0x61')]||'Email','ChatOfflineMessageId':_0x577634[_0xf326('0x28')][_0xf326('0x14')][_0xf326('0x62')]||null},{'include':[{'model':db[_0xf326('0x63')],'as':_0xf326('0x64')}]});})[_0xf326('0x1e')](function(_0x7f6d0e){_0x3e1e8c[_0xf326('0x14')]=_0x7f6d0e;if(!_0x3e1e8c[_0xf326('0x5b')]['UserId']){return;}return db[_0xf326('0x65')]['find']({'attributes':['id',_0xf326('0x66')],'where':{'id':_0x3e1e8c[_0xf326('0x5b')][_0xf326('0x67')]}});})['then'](function(_0x2465f8){if(_0x2465f8){_0x3e1e8c[_0xf326('0x44')][_0xf326('0x68')]({'id':0x0,'priority':0x0,'app':'agent','appdata':_0x2465f8[_0xf326('0x66')]+','+(_0x3e1e8c[_0xf326('0x39')][_0xf326('0x69')]||0xa),'interval':_0xf326('0x4b')});}if(!_0x3e1e8c['interaction'][_0xf326('0x6a')]){return;}return db['MailQueue']['find']({'attributes':['id',_0xf326('0x66')],'where':{'id':_0x3e1e8c[_0xf326('0x5b')]['queueId']}});})['then'](function(_0x4b8f8d){if(_0x4b8f8d){_0x3e1e8c[_0xf326('0x44')]['unshift']({'id':0x0,'priority':0x1,'app':_0xf326('0x6b'),'appdata':_0x4b8f8d[_0xf326('0x66')]+','+(_0x3e1e8c[_0xf326('0x39')][_0xf326('0x6c')]||0x12c),'interval':_0xf326('0x4b')});}return respondWithRpcPromise(_0xf326('0x6d'),'startRouting',_0x3e1e8c);})[_0xf326('0x1e')](function(_0x323926){_0x22d462(_0x323926);})['catch'](function(_0x497ada){_0x5d6ae2(_0x55dfa8[_0xf326('0x12')](0x1f4,_0x497ada['message']));});});}; \ No newline at end of file +var _0xe0ae=['DESC','MailApplication','Applications','MailServerOut','Smtp','CloudProvider','get','account','omit','getSmtpOptions','applications','orderBy','priority','autoclose','push','length','close','*,*,*,*','messageId','generate','subject','attach','YYYY-MM-DD\x20HH:mm:ss','MailMessage','Messages','inReplyTo','create','Contact\x20not\x20found','spread','update','format','created','contact','attachments','originTo','originCc','bcc','ChatWebsiteId','originChannel','Email','ChatOfflineMessageId','Attachment','Attachments','UserId','User','interaction','unshift','agent','name','waitForTheAssignedAgent','queueId','MailQueue','Start','bluebird','randomstring','../../mysqldb','rpc','../../config/environment','client','defaults','redis','localhost','socket.io-emitter','./mailAccount.socket','request','then','info','request\x20sent','debug','error','MailAccount,\x20%s,\x20%s','message','result','catch','GetMailAccount','MailAccount','findAll','options','raw','where','limit','include','map','model','attributes','stringify','ShowMailAccount','find','setDataValue','smtpOptions','mail','difference','keys','CmContact','rawAttributes','createdAt','ListId','body','isNil','from','from\x20is\x20mandatory','body\x20is\x20mandatory\x20and\x20not\x20empty','mapKey\x20is\x20mandatory,\x20please\x20use\x20one\x20of\x20these:\x20','mapKey\x20invalid,\x20please\x20use\x20one\x20of\x20these:\x20','mapKey','CmList','List','Contacts'];(function(_0x4b7895,_0x3c4f5d){var _0x264180=function(_0xe0e861){while(--_0xe0e861){_0x4b7895['push'](_0x4b7895['shift']());}};_0x264180(++_0x3c4f5d);}(_0xe0ae,0xa1));var _0xee0a=function(_0x522ae8,_0x3b637e){_0x522ae8=_0x522ae8-0x0;var _0x3189b9=_0xe0ae[_0x522ae8];return _0x3189b9;};'use strict';var _=require('lodash');var moment=require('moment');var BPromise=require(_0xee0a('0x0'));var rs=require(_0xee0a('0x1'));var Redis=require('ioredis');var db=require(_0xee0a('0x2'))['db'];var logger=require('../../config/logger')(_0xee0a('0x3'));var config=require(_0xee0a('0x4'));var jayson=require('jayson/promise');var client=jayson[_0xee0a('0x5')]['http']({'port':0x232c});config['redis']=_[_0xee0a('0x6')](config[_0xee0a('0x7')],{'host':_0xee0a('0x8'),'port':0x18eb});var socket=require(_0xee0a('0x9'))(new Redis(config['redis']));require(_0xee0a('0xa'))['register'](socket);function respondWithRpcPromise(_0x4e2c89,_0x1f9d42,_0x3d0b3f){return new BPromise(function(_0xbd4483,_0x57d190){return client[_0xee0a('0xb')](_0x4e2c89,_0x3d0b3f)[_0xee0a('0xc')](function(_0x548eb7){logger[_0xee0a('0xd')]('MailAccount,\x20%s,\x20%s',_0x1f9d42,_0xee0a('0xe'));logger[_0xee0a('0xf')]('MailAccount,\x20%s,\x20%s,\x20%s',_0x1f9d42,_0xee0a('0xe'),JSON['stringify'](_0x548eb7));if(_0x548eb7[_0xee0a('0x10')]){if(_0x548eb7[_0xee0a('0x10')]['code']===0x1f4){logger['error'](_0xee0a('0x11'),_0x1f9d42,_0x548eb7[_0xee0a('0x10')][_0xee0a('0x12')]);return _0x57d190(_0x548eb7[_0xee0a('0x10')][_0xee0a('0x12')]);}logger['error'](_0xee0a('0x11'),_0x1f9d42,_0x548eb7[_0xee0a('0x10')]['message']);return _0xbd4483(_0x548eb7[_0xee0a('0x10')][_0xee0a('0x12')]);}else{logger[_0xee0a('0xd')](_0xee0a('0x11'),_0x1f9d42,'request\x20sent');_0xbd4483(_0x548eb7[_0xee0a('0x13')][_0xee0a('0x12')]);}})[_0xee0a('0x14')](function(_0x55c474){logger[_0xee0a('0x10')](_0xee0a('0x11'),_0x1f9d42,_0x55c474);_0x57d190(_0x55c474);});});}exports[_0xee0a('0x15')]=function(_0x24f8f1){var _0x5d29e0=this;return new Promise(function(_0xe9d5d4,_0x10c224){return db[_0xee0a('0x16')][_0xee0a('0x17')]({'raw':_0x24f8f1['options']?_0x24f8f1[_0xee0a('0x18')][_0xee0a('0x19')]===undefined?!![]:![]:!![],'where':_0x24f8f1[_0xee0a('0x18')]?_0x24f8f1[_0xee0a('0x18')][_0xee0a('0x1a')]||null:null,'attributes':_0x24f8f1[_0xee0a('0x18')]?_0x24f8f1[_0xee0a('0x18')]['attributes']||null:null,'limit':_0x24f8f1[_0xee0a('0x18')]?_0x24f8f1[_0xee0a('0x18')][_0xee0a('0x1b')]||null:null,'include':_0x24f8f1[_0xee0a('0x18')]?_0x24f8f1['options'][_0xee0a('0x1c')]?_[_0xee0a('0x1d')](_0x24f8f1[_0xee0a('0x18')][_0xee0a('0x1c')],function(_0x4c61e2){return{'model':db[_0x4c61e2['model']],'as':_0x4c61e2['as'],'attributes':_0x4c61e2['attributes'],'include':_0x4c61e2[_0xee0a('0x1c')]?_['map'](_0x4c61e2['include'],function(_0x1c9ad8){return{'model':db[_0x1c9ad8[_0xee0a('0x1e')]],'as':_0x1c9ad8['as'],'attributes':_0x1c9ad8[_0xee0a('0x1f')],'include':_0x1c9ad8['include']?_[_0xee0a('0x1d')](_0x1c9ad8[_0xee0a('0x1c')],function(_0x15b1c0){return{'model':db[_0x15b1c0[_0xee0a('0x1e')]],'as':_0x15b1c0['as'],'attributes':_0x15b1c0[_0xee0a('0x1f')]};}):[]};}):[]};}):[]:[]})[_0xee0a('0xc')](function(_0x145332){logger[_0xee0a('0xd')](_0xee0a('0x15'),_0x24f8f1);logger[_0xee0a('0xf')]('GetMailAccount',_0x24f8f1,JSON[_0xee0a('0x20')](_0x145332));_0xe9d5d4(_0x145332);})[_0xee0a('0x14')](function(_0x284be5){logger[_0xee0a('0x10')](_0xee0a('0x15'),_0x284be5[_0xee0a('0x12')],_0x24f8f1);_0x10c224(_0x5d29e0['error'](0x1f4,_0x284be5[_0xee0a('0x12')]));});});};exports[_0xee0a('0x21')]=function(_0x86cef4){var _0x114042=this;return new Promise(function(_0x4b9cd7,_0x354dff){return db['MailAccount'][_0xee0a('0x22')]({'raw':_0x86cef4[_0xee0a('0x18')]?_0x86cef4[_0xee0a('0x18')][_0xee0a('0x19')]===undefined?!![]:![]:!![],'where':_0x86cef4[_0xee0a('0x18')]?_0x86cef4[_0xee0a('0x18')][_0xee0a('0x1a')]||null:null,'attributes':_0x86cef4[_0xee0a('0x18')]?_0x86cef4['options'][_0xee0a('0x1f')]||null:null,'include':_0x86cef4[_0xee0a('0x18')]?_0x86cef4['options'][_0xee0a('0x1c')]?_[_0xee0a('0x1d')](_0x86cef4[_0xee0a('0x18')]['include'],function(_0x131b60){return{'model':db[_0x131b60[_0xee0a('0x1e')]],'as':_0x131b60['as'],'attributes':_0x131b60[_0xee0a('0x1f')],'include':_0x131b60['include']?_[_0xee0a('0x1d')](_0x131b60[_0xee0a('0x1c')],function(_0x340dc8){return{'model':db[_0x340dc8['model']],'as':_0x340dc8['as'],'attributes':_0x340dc8['attributes'],'include':_0x340dc8[_0xee0a('0x1c')]?_[_0xee0a('0x1d')](_0x340dc8[_0xee0a('0x1c')],function(_0x25041c){return{'model':db[_0x25041c[_0xee0a('0x1e')]],'as':_0x25041c['as'],'attributes':_0x25041c[_0xee0a('0x1f')]};}):[]};}):[]};}):[]:[]})[_0xee0a('0xc')](function(_0x616351){if(_0x86cef4[_0xee0a('0x18')]['smtp']===!![])_0x616351[_0xee0a('0x23')](_0xee0a('0x24'),_0x616351['getSmtpOptions']());logger[_0xee0a('0xd')](_0xee0a('0x21'),_0x86cef4);logger['debug'](_0xee0a('0x21'),_0x86cef4,JSON[_0xee0a('0x20')](_0x616351));_0x4b9cd7(_0x616351);})[_0xee0a('0x14')](function(_0x4393d9){logger[_0xee0a('0x10')](_0xee0a('0x21'),_0x4393d9[_0xee0a('0x12')],_0x86cef4);_0x354dff(_0x114042[_0xee0a('0x10')](0x1f4,_0x4393d9[_0xee0a('0x12')]));});});};exports['NotifyMailAccount']=function(_0x429eca){var _0x263878=this;return new Promise(function(_0x41eba8,_0xf3efee){var _0x4c87e8={'body':_0x429eca['body'],'channel':_0xee0a('0x25')};var _0x2715f7=_[_0xee0a('0x26')](_[_0xee0a('0x27')](db[_0xee0a('0x28')][_0xee0a('0x29')]),[_0xee0a('0x2a'),'updatedAt','CompanyId',_0xee0a('0x2b')]);var _0x283062=![];if(_0x429eca['body']['id']){delete _0x429eca[_0xee0a('0x2c')]['id'];}if(_[_0xee0a('0x2d')](_0x429eca['body'][_0xee0a('0x2e')])){return _0xf3efee(_0x263878[_0xee0a('0x10')](0x1f4,_0xee0a('0x2f')));}if(_[_0xee0a('0x2d')](_0x429eca[_0xee0a('0x2c')][_0xee0a('0x2c')])||_0x429eca[_0xee0a('0x2c')]['body']===''){return _0xf3efee(_0x263878['error'](0x1f4,_0xee0a('0x30')));}if(_['isNil'](_0x429eca['body']['mapKey'])){return _0xf3efee(_0x263878[_0xee0a('0x10')](0x1f4,_0xee0a('0x31')+_0x2715f7));}if(!_['includes'](_0x2715f7,_0x429eca['body']['mapKey'])){return _0xf3efee(_0x263878['error'](0x1f4,_0xee0a('0x32')+_0x2715f7));}var _0x2e687f={};_0x2e687f[_0x429eca[_0xee0a('0x2c')][_0xee0a('0x33')]]=_0x429eca[_0xee0a('0x2c')][_0xee0a('0x2e')];return db['MailAccount'][_0xee0a('0x22')]({'where':{'id':_0x429eca['account']['id']},'include':[{'model':db[_0xee0a('0x34')],'as':_0xee0a('0x35'),'include':[{'model':db[_0xee0a('0x28')],'as':_0xee0a('0x36'),'where':_0x2e687f,'limit':0x1,'order':[['updatedAt',_0xee0a('0x37')]]}]},{'model':db[_0xee0a('0x38')],'as':_0xee0a('0x39')},{'model':db[_0xee0a('0x3a')],'as':_0xee0a('0x3b'),'include':[{'model':db[_0xee0a('0x3c')],'as':_0xee0a('0x3c')}]}]})['then'](function(_0x51300e){if(_0x51300e&&_0x51300e[_0xee0a('0x35')]){var _0x2162b8=_0x51300e[_0xee0a('0x3d')]({'plain':!![]});_0x4c87e8[_0xee0a('0x3e')]=_[_0xee0a('0x3f')](_0x2162b8,[_0xee0a('0x39'),_0xee0a('0x35')]);_0x4c87e8[_0xee0a('0x3e')][_0xee0a('0x24')]=_0x51300e[_0xee0a('0x40')]();_0x4c87e8[_0xee0a('0x41')]=_0x2162b8[_0xee0a('0x39')];_0x4c87e8['list']=_0x2162b8[_0xee0a('0x35')];_0x4c87e8[_0xee0a('0x41')]=_[_0xee0a('0x42')](_0x4c87e8[_0xee0a('0x41')],[_0xee0a('0x43')],['asc']);if(_0x4c87e8[_0xee0a('0x3e')]&&_0x4c87e8[_0xee0a('0x3e')][_0xee0a('0x44')]){_0x4c87e8[_0xee0a('0x41')][_0xee0a('0x45')]({'id':0x0,'priority':_0x4c87e8['applications'][_0xee0a('0x46')]+0x1,'app':_0xee0a('0x47'),'appdata':_0xee0a('0x44'),'interval':_0xee0a('0x48')});}if(_0x4c87e8[_0xee0a('0x3e')]['Applications']){delete _0x4c87e8[_0xee0a('0x3e')][_0xee0a('0x39')];}if(_0x4c87e8[_0xee0a('0x3e')][_0xee0a('0x35')]){delete _0x4c87e8[_0xee0a('0x3e')][_0xee0a('0x35')];}if(_0x2162b8[_0xee0a('0x35')][_0xee0a('0x36')][_0xee0a('0x46')]){return _0x2162b8[_0xee0a('0x35')][_0xee0a('0x36')][0x0];}var _0x24b147=_[_0xee0a('0x6')](_0x429eca[_0xee0a('0x2c')],{'firstName':_0x429eca[_0xee0a('0x2c')][_0xee0a('0x2e')],'ListId':_0x2162b8[_0xee0a('0x2b')]});_0x24b147[_0x429eca[_0xee0a('0x2c')][_0xee0a('0x33')]]=_0x429eca[_0xee0a('0x2c')][_0xee0a('0x2e')];return db[_0xee0a('0x28')]['create'](_0x24b147);}else{throw new Error('List\x20not\x20found');}})['then'](function(_0x35eb93){_0x4c87e8['contact']=_0x35eb93;if(_0x35eb93){if(!_0x429eca[_0xee0a('0x2c')][_0xee0a('0x12')][_0xee0a('0x49')]){_0x429eca[_0xee0a('0x2c')]['message'][_0xee0a('0x49')]=rs[_0xee0a('0x4a')]()+'\x20'+_0x429eca[_0xee0a('0x2c')][_0xee0a('0x12')][_0xee0a('0x2e')];}var _0x99e2b0={'ContactId':_0x35eb93['id'],'MailAccountId':_0x429eca[_0xee0a('0x3e')]['id'],'inReplyTo':_0x429eca[_0xee0a('0x2c')][_0xee0a('0x12')][_0xee0a('0x49')],'to':_0x429eca[_0xee0a('0x2c')][_0xee0a('0x12')][_0xee0a('0x2e')],'cc':_0x429eca[_0xee0a('0x2c')]['message']['cc'],'subject':_0x429eca[_0xee0a('0x2c')]['message'][_0xee0a('0x4b')],'attach':_0x429eca[_0xee0a('0x2c')]['message'][_0xee0a('0x4c')],'lastMsgAt':moment()['format'](_0xee0a('0x4d')),'lastMsgDirection':'in'};return db['MailInteraction']['find']({'where':{'closed':![],'MailAccountId':_0x429eca['account']['id']},'include':[{'model':db[_0xee0a('0x4e')],'as':_0xee0a('0x4f'),'attributes':[_0xee0a('0x49')],'where':{'messageId':_0x429eca[_0xee0a('0x2c')][_0xee0a('0x12')][_0xee0a('0x50')]}}]})[_0xee0a('0xc')](function(_0xe583e5){if(_0xe583e5){return[_0xe583e5,![]];}return db['MailInteraction'][_0xee0a('0x51')](_0x99e2b0)['then'](function(_0x593c77){return[_0x593c77,!![]];});});}else{throw new Error(_0xee0a('0x52'));}})[_0xee0a('0x53')](function(_0x2aa5d3,_0x20f149){if(_0x2aa5d3){_0x283062=_0x20f149;if(!_0x20f149){return _0x2aa5d3[_0xee0a('0x54')]({'inReplyTo':_0x429eca[_0xee0a('0x2c')][_0xee0a('0x12')][_0xee0a('0x49')],'to':_0x429eca['body'][_0xee0a('0x12')]['from'],'cc':_0x429eca[_0xee0a('0x2c')][_0xee0a('0x12')]['cc'],'subject':_0x429eca[_0xee0a('0x2c')][_0xee0a('0x12')][_0xee0a('0x4b')],'attach':_0x2aa5d3[_0xee0a('0x4c')]?_0x2aa5d3['attach']:_0x429eca[_0xee0a('0x2c')][_0xee0a('0x12')][_0xee0a('0x4c')],'substatus':null,'substatusAt':moment()['format'](_0xee0a('0x4d')),'lastMsgAt':moment()[_0xee0a('0x55')]('YYYY-MM-DD\x20HH:mm:ss'),'lastMsgDirection':'in'});}else{return _0x2aa5d3;}}})[_0xee0a('0xc')](function(_0x4b76b9){_0x4c87e8['interaction']=_0x4b76b9['get']({'plain':!![]});_0x4c87e8['interaction'][_0xee0a('0x56')]=_0x283062;return db['MailMessage'][_0xee0a('0x51')]({'body':_0x429eca['body'][_0xee0a('0x2c')],'MailAccountId':_0x429eca[_0xee0a('0x3e')]['id'],'MailInteractionId':_0x4b76b9['id'],'direction':'in','ContactId':_0x4c87e8[_0xee0a('0x57')]['id'],'messageId':_0x429eca[_0xee0a('0x2c')]['message'][_0xee0a('0x49')],'from':_0x429eca[_0xee0a('0x2c')][_0xee0a('0x12')][_0xee0a('0x2e')],'to':_0x429eca[_0xee0a('0x2c')]['message']['to'],'cc':_0x429eca[_0xee0a('0x2c')][_0xee0a('0x12')]['cc'],'subject':_0x429eca[_0xee0a('0x2c')]['message'][_0xee0a('0x4b')],'attach':_0x429eca[_0xee0a('0x2c')]['message'][_0xee0a('0x4c')],'Attachments':_0x429eca[_0xee0a('0x2c')][_0xee0a('0x12')][_0xee0a('0x58')],'originTo':_0x429eca[_0xee0a('0x2c')][_0xee0a('0x12')][_0xee0a('0x59')],'originCc':_0x429eca[_0xee0a('0x2c')]['message'][_0xee0a('0x5a')],'bcc':_0x429eca[_0xee0a('0x2c')][_0xee0a('0x12')][_0xee0a('0x5b')],'ChatWebsiteId':_0x429eca[_0xee0a('0x2c')][_0xee0a('0x12')][_0xee0a('0x5c')]||null,'originChannel':_0x429eca['body'][_0xee0a('0x12')][_0xee0a('0x5d')]||_0xee0a('0x5e'),'ChatOfflineMessageId':_0x429eca[_0xee0a('0x2c')]['message'][_0xee0a('0x5f')]||null},{'include':[{'model':db[_0xee0a('0x60')],'as':_0xee0a('0x61')}]});})[_0xee0a('0xc')](function(_0x23373d){_0x4c87e8['message']=_0x23373d;if(!_0x4c87e8['interaction'][_0xee0a('0x62')]){return;}return db[_0xee0a('0x63')][_0xee0a('0x22')]({'attributes':['id','name'],'where':{'id':_0x4c87e8[_0xee0a('0x64')][_0xee0a('0x62')]}});})[_0xee0a('0xc')](function(_0x319487){if(_0x319487){_0x4c87e8[_0xee0a('0x41')][_0xee0a('0x65')]({'id':0x0,'priority':0x0,'app':_0xee0a('0x66'),'appdata':_0x319487[_0xee0a('0x67')]+','+(_0x4c87e8['account'][_0xee0a('0x68')]||0xa),'interval':_0xee0a('0x48')});}if(!_0x4c87e8[_0xee0a('0x64')][_0xee0a('0x69')]){return;}return db[_0xee0a('0x6a')]['find']({'attributes':['id',_0xee0a('0x67')],'where':{'id':_0x4c87e8[_0xee0a('0x64')][_0xee0a('0x69')]}});})[_0xee0a('0xc')](function(_0x12b9db){if(_0x12b9db){_0x4c87e8['applications']['unshift']({'id':0x0,'priority':0x1,'app':'queue','appdata':_0x12b9db['name']+','+(_0x4c87e8[_0xee0a('0x3e')]['waitForTheAssignedQueue']||0x12c),'interval':_0xee0a('0x48')});}return respondWithRpcPromise(_0xee0a('0x6b'),'startRouting',_0x4c87e8);})[_0xee0a('0xc')](function(_0x59dd8b){_0x41eba8(_0x59dd8b);})[_0xee0a('0x14')](function(_0x5750bb){_0xf3efee(_0x263878[_0xee0a('0x10')](0x1f4,_0x5750bb[_0xee0a('0x12')]));});});}; \ No newline at end of file diff --git a/server/api/mailAccount/mailAccount.socket.js b/server/api/mailAccount/mailAccount.socket.js index e291847..30034ac 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 _0x87ef=['remove','update','emit','removeListener','register','length','mailAccount:','./mailAccount.events'];(function(_0x7bef62,_0x3deaea){var _0x190e16=function(_0x1c5b9a){while(--_0x1c5b9a){_0x7bef62['push'](_0x7bef62['shift']());}};_0x190e16(++_0x3deaea);}(_0x87ef,0x13f));var _0xf87e=function(_0x403c20,_0x4a7b99){_0x403c20=_0x403c20-0x0;var _0x2b271a=_0x87ef[_0x403c20];return _0x2b271a;};'use strict';var MailAccountEvents=require(_0xf87e('0x0'));var events=['save',_0xf87e('0x1'),_0xf87e('0x2')];function createListener(_0x26ab17,_0x447549){return function(_0x59878a){_0x447549[_0xf87e('0x3')](_0x26ab17,_0x59878a);};}function removeListener(_0xef0a07,_0x3dd3b8){return function(){MailAccountEvents[_0xf87e('0x4')](_0xef0a07,_0x3dd3b8);};}exports[_0xf87e('0x5')]=function(_0x5883d2){for(var _0x36b9ca=0x0,_0x1f5c60=events[_0xf87e('0x6')];_0x36b9ca<_0x1f5c60;_0x36b9ca++){var _0x3187ba=events[_0x36b9ca];var _0x10f39b=createListener(_0xf87e('0x7')+_0x3187ba,_0x5883d2);MailAccountEvents['on'](_0x3187ba,_0x10f39b);}}; \ No newline at end of file +var _0xb1b4=['length','mailAccount:','./mailAccount.events','save','remove','emit','register'];(function(_0x3ef2d5,_0x423d46){var _0x2fefb2=function(_0x54f82f){while(--_0x54f82f){_0x3ef2d5['push'](_0x3ef2d5['shift']());}};_0x2fefb2(++_0x423d46);}(_0xb1b4,0x175));var _0x4b1b=function(_0x10a1ac,_0x25f5b0){_0x10a1ac=_0x10a1ac-0x0;var _0x45b99e=_0xb1b4[_0x10a1ac];return _0x45b99e;};'use strict';var MailAccountEvents=require(_0x4b1b('0x0'));var events=[_0x4b1b('0x1'),_0x4b1b('0x2'),'update'];function createListener(_0x474410,_0x460847){return function(_0x1053dc){_0x460847[_0x4b1b('0x3')](_0x474410,_0x1053dc);};}function removeListener(_0x31e2fc,_0x1ccca5){return function(){MailAccountEvents['removeListener'](_0x31e2fc,_0x1ccca5);};}exports[_0x4b1b('0x4')]=function(_0x1c61de){for(var _0x41fec8=0x0,_0x22018d=events[_0x4b1b('0x5')];_0x41fec8<_0x22018d;_0x41fec8++){var _0x562806=events[_0x41fec8];var _0x3d2e43=createListener(_0x4b1b('0x6')+_0x562806,_0x1c61de);MailAccountEvents['on'](_0x562806,_0x3d2e43);}}; \ No newline at end of file diff --git a/server/api/mailApplication/index.js b/server/api/mailApplication/index.js index 03605b8..d119b51 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 _0xdb2e=['connect-timeout','express','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','./mailApplication.controller','get','/:id','isAuthenticated','update','destroy','multer','util','path'];(function(_0x5e9850,_0x291edf){var _0x2d3d96=function(_0x28f972){while(--_0x28f972){_0x5e9850['push'](_0x5e9850['shift']());}};_0x2d3d96(++_0x291edf);}(_0xdb2e,0x1b0));var _0xedb2=function(_0x3361db,_0x4b4f9e){_0x3361db=_0x3361db-0x0;var _0x3f4a8b=_0xdb2e[_0x3361db];return _0x3f4a8b;};'use strict';var multer=require(_0xedb2('0x0'));var util=require(_0xedb2('0x1'));var path=require(_0xedb2('0x2'));var timeout=require(_0xedb2('0x3'));var express=require(_0xedb2('0x4'));var router=express['Router']();var fs_extra=require(_0xedb2('0x5'));var auth=require(_0xedb2('0x6'));var interaction=require(_0xedb2('0x7'));var config=require(_0xedb2('0x8'));var controller=require(_0xedb2('0x9'));router[_0xedb2('0xa')](_0xedb2('0xb'),auth['isAuthenticated'](),controller['show']);router['put'](_0xedb2('0xb'),auth[_0xedb2('0xc')](),controller[_0xedb2('0xd')]);router['delete']('/:id',auth[_0xedb2('0xc')](),controller[_0xedb2('0xe')]);module['exports']=router; \ No newline at end of file +var _0x1c55=['../../config/environment','./mailApplication.controller','/:id','isAuthenticated','show','put','update','delete','exports','util','path','connect-timeout','express','Router','fs-extra','../../components/interaction/service'];(function(_0x3f47c4,_0x5e9fc1){var _0x159d7e=function(_0x54cd81){while(--_0x54cd81){_0x3f47c4['push'](_0x3f47c4['shift']());}};_0x159d7e(++_0x5e9fc1);}(_0x1c55,0x1b9));var _0x51c5=function(_0x14add3,_0x13ce8d){_0x14add3=_0x14add3-0x0;var _0x4a174f=_0x1c55[_0x14add3];return _0x4a174f;};'use strict';var multer=require('multer');var util=require(_0x51c5('0x0'));var path=require(_0x51c5('0x1'));var timeout=require(_0x51c5('0x2'));var express=require(_0x51c5('0x3'));var router=express[_0x51c5('0x4')]();var fs_extra=require(_0x51c5('0x5'));var auth=require('../../components/auth/service');var interaction=require(_0x51c5('0x6'));var config=require(_0x51c5('0x7'));var controller=require(_0x51c5('0x8'));router['get'](_0x51c5('0x9'),auth[_0x51c5('0xa')](),controller[_0x51c5('0xb')]);router[_0x51c5('0xc')](_0x51c5('0x9'),auth['isAuthenticated'](),controller[_0x51c5('0xd')]);router[_0x51c5('0xe')](_0x51c5('0x9'),auth['isAuthenticated'](),controller['destroy']);module[_0x51c5('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 186b35d..6b16324 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 _0x1a93=['exports','INTEGER','STRING','noop','TEXT','*,*,*,*','sequelize'];(function(_0x895358,_0x32f914){var _0x26e26e=function(_0xf2da4a){while(--_0xf2da4a){_0x895358['push'](_0x895358['shift']());}};_0x26e26e(++_0x32f914);}(_0x1a93,0xdf));var _0x31a9=function(_0x52103c,_0x26c63c){_0x52103c=_0x52103c-0x0;var _0x873bde=_0x1a93[_0x52103c];return _0x873bde;};'use strict';var Sequelize=require(_0x31a9('0x0'));module[_0x31a9('0x1')]={'priority':{'type':Sequelize[_0x31a9('0x2')],'allowNull':![]},'app':{'type':Sequelize[_0x31a9('0x3')],'allowNull':![],'defaultValue':_0x31a9('0x4')},'appdata':{'type':Sequelize[_0x31a9('0x5')]()},'description':{'type':Sequelize[_0x31a9('0x3')]},'interval':{'type':Sequelize[_0x31a9('0x3')],'defaultValue':_0x31a9('0x6')}}; \ No newline at end of file +var _0x9402=['sequelize','exports','INTEGER','noop','STRING'];(function(_0x32fad3,_0x28411b){var _0x4448f3=function(_0xa74b87){while(--_0xa74b87){_0x32fad3['push'](_0x32fad3['shift']());}};_0x4448f3(++_0x28411b);}(_0x9402,0x14f));var _0x2940=function(_0x54d371,_0x4011b0){_0x54d371=_0x54d371-0x0;var _0xce969e=_0x9402[_0x54d371];return _0xce969e;};'use strict';var Sequelize=require(_0x2940('0x0'));module[_0x2940('0x1')]={'priority':{'type':Sequelize[_0x2940('0x2')],'allowNull':![]},'app':{'type':Sequelize['STRING'],'allowNull':![],'defaultValue':_0x2940('0x3')},'appdata':{'type':Sequelize['TEXT']()},'description':{'type':Sequelize[_0x2940('0x4')]},'interval':{'type':Sequelize[_0x2940('0x4')],'defaultValue':'*,*,*,*'}}; \ No newline at end of file diff --git a/server/api/mailApplication/mailApplication.controller.js b/server/api/mailApplication/mailApplication.controller.js index c7b0aab..6e12920 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 _0xbdb7=['update','error','stack','name','send','show','params','model','keys','MailApplication','query','filters','intersection','attributes','length','includeAll','merge','find','then','body','catch','destroy','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','moment','bluebird','mustache','util','sox','fs-extra','lodash','jsforce','desk.js','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../mysqldb','end','json','offset','undefined','limit','count','status','set','Content-Range','apply','save'];(function(_0x467488,_0x38c7ae){var _0x56107f=function(_0x4992b3){while(--_0x4992b3){_0x467488['push'](_0x467488['shift']());}};_0x56107f(++_0x38c7ae);}(_0xbdb7,0x12e));var _0x7bdb=function(_0x253c95,_0x39fd4a){_0x253c95=_0x253c95-0x0;var _0x5934d4=_0xbdb7[_0x253c95];return _0x5934d4;};'use strict';var emlformat=require(_0x7bdb('0x0'));var rimraf=require(_0x7bdb('0x1'));var zipdir=require(_0x7bdb('0x2'));var jsonpatch=require(_0x7bdb('0x3'));var rp=require(_0x7bdb('0x4'));var moment=require(_0x7bdb('0x5'));var BPromise=require(_0x7bdb('0x6'));var Mustache=require(_0x7bdb('0x7'));var util=require(_0x7bdb('0x8'));var path=require('path');var sox=require(_0x7bdb('0x9'));var csv=require('to-csv');var ejs=require('ejs');var fs=require('fs');var fs_extra=require(_0x7bdb('0xa'));var _=require(_0x7bdb('0xb'));var squel=require('squel');var crypto=require('crypto');var jsforce=require(_0x7bdb('0xc'));var deskjs=require(_0x7bdb('0xd'));var toCsv=require('to-csv');var querystring=require('querystring');var Papa=require(_0x7bdb('0xe'));var Redis=require(_0x7bdb('0xf'));var authService=require(_0x7bdb('0x10'));var qs=require(_0x7bdb('0x11'));var as=require(_0x7bdb('0x12'));var hardwareService=require(_0x7bdb('0x13'));var logger=require(_0x7bdb('0x14'))(_0x7bdb('0x15'));var utils=require('../../config/utils');var config=require('../../config/environment');var licenseUtil=require('../../config/license/util');var db=require(_0x7bdb('0x16'))['db'];function respondWithStatusCode(_0x25e3cb,_0x496613){_0x496613=_0x496613||0xcc;return function(_0x8d74ff){if(_0x8d74ff){return _0x25e3cb['sendStatus'](_0x496613);}return _0x25e3cb['status'](_0x496613)[_0x7bdb('0x17')]();};}function respondWithResult(_0x46dd4a,_0x4fd91a){_0x4fd91a=_0x4fd91a||0xc8;return function(_0x50eeca){if(_0x50eeca){return _0x46dd4a['status'](_0x4fd91a)[_0x7bdb('0x18')](_0x50eeca);}};}function respondWithFilteredResult(_0x195b2e,_0xe9919f){return function(_0x25d417){if(_0x25d417){var _0x31c909=typeof _0xe9919f[_0x7bdb('0x19')]===_0x7bdb('0x1a')&&typeof _0xe9919f[_0x7bdb('0x1b')]==='undefined';var _0x1c5750=_0x25d417[_0x7bdb('0x1c')];var _0x5723f4=_0x31c909?0x0:_0xe9919f[_0x7bdb('0x19')];var _0x4ffd4b=_0x31c909?_0x25d417[_0x7bdb('0x1c')]:_0xe9919f[_0x7bdb('0x19')]+_0xe9919f['limit'];var _0x3e5f8e;if(_0x4ffd4b>=_0x1c5750){_0x4ffd4b=_0x1c5750;_0x3e5f8e=0xc8;}else{_0x3e5f8e=0xce;}_0x195b2e[_0x7bdb('0x1d')](_0x3e5f8e);return _0x195b2e[_0x7bdb('0x1e')](_0x7bdb('0x1f'),_0x5723f4+'-'+_0x4ffd4b+'/'+_0x1c5750)[_0x7bdb('0x18')](_0x25d417);}return null;};}function patchUpdates(_0x5bfc35){return function(_0x49f353){try{jsonpatch[_0x7bdb('0x20')](_0x49f353,_0x5bfc35,!![]);}catch(_0xcb25f2){return BPromise['reject'](_0xcb25f2);}return _0x49f353[_0x7bdb('0x21')]();};}function saveUpdates(_0x118ea1,_0x346c72){return function(_0x3f53e7){if(_0x3f53e7){return _0x3f53e7[_0x7bdb('0x22')](_0x118ea1)['then'](function(_0x1d37ac){return _0x1d37ac;});}return null;};}function removeEntity(_0xdad53d,_0x40c447){return function(_0x3a456f){if(_0x3a456f){return _0x3a456f['destroy']()['then'](function(){_0xdad53d[_0x7bdb('0x1d')](0xcc)['end']();});}};}function handleEntityNotFound(_0x47abaf,_0x4a9e02){return function(_0x2abef6){if(!_0x2abef6){_0x47abaf['sendStatus'](0x194);}return _0x2abef6;};}function handleError(_0x2b14bc,_0x72ba69){_0x72ba69=_0x72ba69||0x1f4;return function(_0x3ec129){logger[_0x7bdb('0x23')](_0x3ec129[_0x7bdb('0x24')]);if(_0x3ec129['name']){delete _0x3ec129[_0x7bdb('0x25')];}_0x2b14bc[_0x7bdb('0x1d')](_0x72ba69)[_0x7bdb('0x26')](_0x3ec129);};}exports[_0x7bdb('0x27')]=function(_0x371e8a,_0x2e8e65){var _0x1e9996={'raw':!![],'where':{'id':_0x371e8a[_0x7bdb('0x28')]['id']}},_0xd2d7be={};_0xd2d7be[_0x7bdb('0x29')]=_[_0x7bdb('0x2a')](db[_0x7bdb('0x2b')]['rawAttributes']);_0xd2d7be[_0x7bdb('0x2c')]=_[_0x7bdb('0x2a')](_0x371e8a[_0x7bdb('0x2c')]);_0xd2d7be[_0x7bdb('0x2d')]=_[_0x7bdb('0x2e')](_0xd2d7be['model'],_0xd2d7be[_0x7bdb('0x2c')]);_0x1e9996[_0x7bdb('0x2f')]=_[_0x7bdb('0x2e')](_0xd2d7be[_0x7bdb('0x29')],qs['fields'](_0x371e8a['query']['fields']));_0x1e9996[_0x7bdb('0x2f')]=_0x1e9996['attributes'][_0x7bdb('0x30')]?_0x1e9996['attributes']:_0xd2d7be[_0x7bdb('0x29')];if(_0x371e8a[_0x7bdb('0x2c')][_0x7bdb('0x31')]){_0x1e9996['include']=[{'all':!![]}];}_0x1e9996=_[_0x7bdb('0x32')]({},_0x1e9996,_0x371e8a['options']);return db['MailApplication'][_0x7bdb('0x33')](_0x1e9996)['then'](handleEntityNotFound(_0x2e8e65,null))[_0x7bdb('0x34')](respondWithResult(_0x2e8e65,null))['catch'](handleError(_0x2e8e65,null));};exports['update']=function(_0x206c26,_0x353b26){if(_0x206c26[_0x7bdb('0x35')]['id']){delete _0x206c26[_0x7bdb('0x35')]['id'];}return db[_0x7bdb('0x2b')][_0x7bdb('0x33')]({'where':{'id':_0x206c26['params']['id']}})[_0x7bdb('0x34')](handleEntityNotFound(_0x353b26,null))[_0x7bdb('0x34')](saveUpdates(_0x206c26[_0x7bdb('0x35')],null))[_0x7bdb('0x34')](respondWithResult(_0x353b26,null))[_0x7bdb('0x36')](handleError(_0x353b26,null));};exports[_0x7bdb('0x37')]=function(_0x228340,_0x2587af){return db[_0x7bdb('0x2b')]['find']({'where':{'id':_0x228340['params']['id']}})[_0x7bdb('0x34')](handleEntityNotFound(_0x2587af,null))[_0x7bdb('0x34')](removeEntity(_0x2587af,null))[_0x7bdb('0x36')](handleError(_0x2587af,null));}; \ No newline at end of file +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(_0x88281e,_0x502f0b){var _0x4c8edf=function(_0x1d8afc){while(--_0x1d8afc){_0x88281e['push'](_0x88281e['shift']());}};_0x4c8edf(++_0x502f0b);}(_0x54ef,0x112));var _0xf54e=function(_0x1d1322,_0x1d8b75){_0x1d1322=_0x1d1322-0x0;var _0x53f5f9=_0x54ef[_0x1d1322];return _0x53f5f9;};'use strict';var emlformat=require(_0xf54e('0x0'));var rimraf=require(_0xf54e('0x1'));var zipdir=require(_0xf54e('0x2'));var jsonpatch=require('fast-json-patch');var rp=require(_0xf54e('0x3'));var moment=require(_0xf54e('0x4'));var BPromise=require(_0xf54e('0x5'));var Mustache=require(_0xf54e('0x6'));var util=require(_0xf54e('0x7'));var path=require(_0xf54e('0x8'));var sox=require(_0xf54e('0x9'));var csv=require('to-csv');var ejs=require('ejs');var fs=require('fs');var fs_extra=require(_0xf54e('0xa'));var _=require(_0xf54e('0xb'));var squel=require(_0xf54e('0xc'));var crypto=require('crypto');var jsforce=require(_0xf54e('0xd'));var deskjs=require('desk.js');var toCsv=require(_0xf54e('0xe'));var querystring=require(_0xf54e('0xf'));var Papa=require('papaparse');var Redis=require(_0xf54e('0x10'));var authService=require(_0xf54e('0x11'));var qs=require(_0xf54e('0x12'));var as=require(_0xf54e('0x13'));var hardwareService=require('../../config/license/hardware');var logger=require(_0xf54e('0x14'))(_0xf54e('0x15'));var utils=require(_0xf54e('0x16'));var config=require(_0xf54e('0x17'));var licenseUtil=require('../../config/license/util');var db=require(_0xf54e('0x18'))['db'];function respondWithStatusCode(_0x4b0ee1,_0x4bd828){_0x4bd828=_0x4bd828||0xcc;return function(_0x15a9d4){if(_0x15a9d4){return _0x4b0ee1[_0xf54e('0x19')](_0x4bd828);}return _0x4b0ee1[_0xf54e('0x1a')](_0x4bd828)[_0xf54e('0x1b')]();};}function respondWithResult(_0x5644aa,_0x331732){_0x331732=_0x331732||0xc8;return function(_0x1bbeaa){if(_0x1bbeaa){return _0x5644aa[_0xf54e('0x1a')](_0x331732)[_0xf54e('0x1c')](_0x1bbeaa);}};}function respondWithFilteredResult(_0x56828e,_0x2366ee){return function(_0x389abc){if(_0x389abc){var _0x3eb415=typeof _0x2366ee['offset']==='undefined'&&typeof _0x2366ee[_0xf54e('0x1d')]===_0xf54e('0x1e');var _0x1c02e7=_0x389abc[_0xf54e('0x1f')];var _0x15cc48=_0x3eb415?0x0:_0x2366ee[_0xf54e('0x20')];var _0x2e27b6=_0x3eb415?_0x389abc[_0xf54e('0x1f')]:_0x2366ee[_0xf54e('0x20')]+_0x2366ee[_0xf54e('0x1d')];var _0x226c96;if(_0x2e27b6>=_0x1c02e7){_0x2e27b6=_0x1c02e7;_0x226c96=0xc8;}else{_0x226c96=0xce;}_0x56828e['status'](_0x226c96);return _0x56828e['set'](_0xf54e('0x21'),_0x15cc48+'-'+_0x2e27b6+'/'+_0x1c02e7)['json'](_0x389abc);}return null;};}function patchUpdates(_0x3e1556){return function(_0x1bfe99){try{jsonpatch[_0xf54e('0x22')](_0x1bfe99,_0x3e1556,!![]);}catch(_0x9903fc){return BPromise[_0xf54e('0x23')](_0x9903fc);}return _0x1bfe99[_0xf54e('0x24')]();};}function saveUpdates(_0x388aa0,_0x11985e){return function(_0x3c0169){if(_0x3c0169){return _0x3c0169[_0xf54e('0x25')](_0x388aa0)[_0xf54e('0x26')](function(_0x5b83df){return _0x5b83df;});}return null;};}function removeEntity(_0x6f6d29,_0x54f914){return function(_0x264a8f){if(_0x264a8f){return _0x264a8f[_0xf54e('0x27')]()[_0xf54e('0x26')](function(){_0x6f6d29[_0xf54e('0x1a')](0xcc)[_0xf54e('0x1b')]();});}};}function handleEntityNotFound(_0x160160,_0x1e08d1){return function(_0x43488d){if(!_0x43488d){_0x160160[_0xf54e('0x19')](0x194);}return _0x43488d;};}function handleError(_0x33457f,_0xf6cdd7){_0xf6cdd7=_0xf6cdd7||0x1f4;return function(_0x39c0ae){logger[_0xf54e('0x28')](_0x39c0ae['stack']);if(_0x39c0ae[_0xf54e('0x29')]){delete _0x39c0ae['name'];}_0x33457f[_0xf54e('0x1a')](_0xf6cdd7)['send'](_0x39c0ae);};}exports[_0xf54e('0x2a')]=function(_0x269f47,_0x21ba00){var _0xa13cd0={'raw':!![],'where':{'id':_0x269f47[_0xf54e('0x2b')]['id']}},_0x25b643={};_0x25b643[_0xf54e('0x2c')]=_['keys'](db['MailApplication'][_0xf54e('0x2d')]);_0x25b643[_0xf54e('0x2e')]=_[_0xf54e('0x2f')](_0x269f47[_0xf54e('0x2e')]);_0x25b643[_0xf54e('0x30')]=_[_0xf54e('0x31')](_0x25b643[_0xf54e('0x2c')],_0x25b643[_0xf54e('0x2e')]);_0xa13cd0[_0xf54e('0x32')]=_[_0xf54e('0x31')](_0x25b643['model'],qs['fields'](_0x269f47[_0xf54e('0x2e')][_0xf54e('0x33')]));_0xa13cd0['attributes']=_0xa13cd0[_0xf54e('0x32')][_0xf54e('0x34')]?_0xa13cd0[_0xf54e('0x32')]:_0x25b643[_0xf54e('0x2c')];if(_0x269f47['query']['includeAll']){_0xa13cd0['include']=[{'all':!![]}];}_0xa13cd0=_[_0xf54e('0x35')]({},_0xa13cd0,_0x269f47[_0xf54e('0x36')]);return db[_0xf54e('0x37')][_0xf54e('0x38')](_0xa13cd0)[_0xf54e('0x26')](handleEntityNotFound(_0x21ba00,null))[_0xf54e('0x26')](respondWithResult(_0x21ba00,null))['catch'](handleError(_0x21ba00,null));};exports['update']=function(_0x530cee,_0xc04e04){if(_0x530cee[_0xf54e('0x39')]['id']){delete _0x530cee['body']['id'];}return db['MailApplication'][_0xf54e('0x38')]({'where':{'id':_0x530cee[_0xf54e('0x2b')]['id']}})[_0xf54e('0x26')](handleEntityNotFound(_0xc04e04,null))['then'](saveUpdates(_0x530cee[_0xf54e('0x39')],null))[_0xf54e('0x26')](respondWithResult(_0xc04e04,null))['catch'](handleError(_0xc04e04,null));};exports[_0xf54e('0x27')]=function(_0x6e5bdf,_0x5af03){return db[_0xf54e('0x37')][_0xf54e('0x38')]({'where':{'id':_0x6e5bdf[_0xf54e('0x2b')]['id']}})['then'](handleEntityNotFound(_0x5af03,null))['then'](removeEntity(_0x5af03,null))[_0xf54e('0x3a')](handleError(_0x5af03,null));}; \ No newline at end of file diff --git a/server/api/mailApplication/mailApplication.model.js b/server/api/mailApplication/mailApplication.model.js index ceaa1a6..9ecd61b 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 _0xa56b=['rimraf','../../config/environment','./mailApplication.attributes','exports','define','MailApplication','mail_applications','utf8mb4','utf8mb4_unicode_ci','lodash','../../config/logger','api','bluebird','request-promise','path'];(function(_0xb8329d,_0x51fedf){var _0x330773=function(_0x29314b){while(--_0x29314b){_0xb8329d['push'](_0xb8329d['shift']());}};_0x330773(++_0x51fedf);}(_0xa56b,0xbd));var _0xba56=function(_0xd09668,_0x1435b2){_0xd09668=_0xd09668-0x0;var _0x68726=_0xa56b[_0xd09668];return _0x68726;};'use strict';var _=require(_0xba56('0x0'));var util=require('util');var logger=require(_0xba56('0x1'))(_0xba56('0x2'));var moment=require('moment');var BPromise=require(_0xba56('0x3'));var rp=require(_0xba56('0x4'));var fs=require('fs');var path=require(_0xba56('0x5'));var rimraf=require(_0xba56('0x6'));var config=require(_0xba56('0x7'));var attributes=require(_0xba56('0x8'));module[_0xba56('0x9')]=function(_0x1531b7,_0x433e55){return _0x1531b7[_0xba56('0xa')](_0xba56('0xb'),attributes,{'tableName':_0xba56('0xc'),'paranoid':![],'indexes':[],'timestamps':!![],'charset':_0xba56('0xd'),'collate':_0xba56('0xe')});}; \ No newline at end of file +var _0x6690=['moment','bluebird','request-promise','path','rimraf','../../config/environment','./mailApplication.attributes','define','MailApplication','utf8mb4_unicode_ci'];(function(_0xa817ad,_0x4b28d5){var _0x9c7fe6=function(_0x5063dc){while(--_0x5063dc){_0xa817ad['push'](_0xa817ad['shift']());}};_0x9c7fe6(++_0x4b28d5);}(_0x6690,0xfa));var _0x0669=function(_0x3947c9,_0x4d6c97){_0x3947c9=_0x3947c9-0x0;var _0x2e7871=_0x6690[_0x3947c9];return _0x2e7871;};'use strict';var _=require('lodash');var util=require('util');var logger=require('../../config/logger')('api');var moment=require(_0x0669('0x0'));var BPromise=require(_0x0669('0x1'));var rp=require(_0x0669('0x2'));var fs=require('fs');var path=require(_0x0669('0x3'));var rimraf=require(_0x0669('0x4'));var config=require(_0x0669('0x5'));var attributes=require(_0x0669('0x6'));module['exports']=function(_0xfc3f6c,_0xf8248b){return _0xfc3f6c[_0x0669('0x7')](_0x0669('0x8'),attributes,{'tableName':'mail_applications','paranoid':![],'indexes':[],'timestamps':!![],'charset':'utf8mb4','collate':_0x0669('0x9')});}; \ No newline at end of file diff --git a/server/api/mailApplication/mailApplication.rpc.js b/server/api/mailApplication/mailApplication.rpc.js index de6df43..095bf52 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 _0x63b1=['info','MailApplication,\x20%s,\x20%s','request\x20sent','debug','error','code','message','result','catch','UpdateMailApplication','update','body','options','raw','where','attributes','limit','stringify','lodash','util','moment','bluebird','../../config/utils','rpc','../../config/environment','jayson/promise','client','http','request','then'];(function(_0x59d99d,_0x193e9e){var _0x14c53d=function(_0x1cc4a8){while(--_0x1cc4a8){_0x59d99d['push'](_0x59d99d['shift']());}};_0x14c53d(++_0x193e9e);}(_0x63b1,0x120));var _0x163b=function(_0x1be87b,_0x223e2c){_0x1be87b=_0x1be87b-0x0;var _0x397c8=_0x63b1[_0x1be87b];return _0x397c8;};'use strict';var _=require(_0x163b('0x0'));var util=require(_0x163b('0x1'));var moment=require(_0x163b('0x2'));var BPromise=require(_0x163b('0x3'));var rs=require('randomstring');var fs=require('fs');var Redis=require('ioredis');var db=require('../../mysqldb')['db'];var utils=require(_0x163b('0x4'));var logger=require('../../config/logger')(_0x163b('0x5'));var config=require(_0x163b('0x6'));var jayson=require(_0x163b('0x7'));var client=jayson[_0x163b('0x8')][_0x163b('0x9')]({'port':0x232a});function respondWithRpcPromise(_0xecdb58,_0x2e8059,_0x27d1d1){return new BPromise(function(_0x50c8b9,_0x15e5ac){return client[_0x163b('0xa')](_0xecdb58,_0x27d1d1)[_0x163b('0xb')](function(_0x5d0724){logger[_0x163b('0xc')](_0x163b('0xd'),_0x2e8059,_0x163b('0xe'));logger[_0x163b('0xf')]('MailApplication,\x20%s,\x20%s,\x20%s',_0x2e8059,_0x163b('0xe'),JSON['stringify'](_0x5d0724));if(_0x5d0724[_0x163b('0x10')]){if(_0x5d0724[_0x163b('0x10')][_0x163b('0x11')]===0x1f4){logger[_0x163b('0x10')](_0x163b('0xd'),_0x2e8059,_0x5d0724[_0x163b('0x10')][_0x163b('0x12')]);return _0x15e5ac(_0x5d0724[_0x163b('0x10')]['message']);}logger['error']('MailApplication,\x20%s,\x20%s',_0x2e8059,_0x5d0724[_0x163b('0x10')][_0x163b('0x12')]);return _0x50c8b9(_0x5d0724[_0x163b('0x10')][_0x163b('0x12')]);}else{logger[_0x163b('0xc')](_0x163b('0xd'),_0x2e8059,_0x163b('0xe'));_0x50c8b9(_0x5d0724[_0x163b('0x13')]['message']);}})[_0x163b('0x14')](function(_0x261129){logger[_0x163b('0x10')]('MailApplication,\x20%s,\x20%s',_0x2e8059,_0x261129);_0x15e5ac(_0x261129);});});}exports[_0x163b('0x15')]=function(_0x832818){var _0x19ac46=this;return new Promise(function(_0x5954e2,_0x483459){return db['MailApplication'][_0x163b('0x16')](_0x832818[_0x163b('0x17')],{'raw':_0x832818[_0x163b('0x18')]?_0x832818['options'][_0x163b('0x19')]===undefined?!![]:![]:!![],'individualHooks':!![],'where':_0x832818[_0x163b('0x18')]?_0x832818[_0x163b('0x18')][_0x163b('0x1a')]||null:null,'attributes':_0x832818[_0x163b('0x18')]?_0x832818[_0x163b('0x18')][_0x163b('0x1b')]||null:null,'limit':_0x832818[_0x163b('0x18')]?_0x832818['options'][_0x163b('0x1c')]||null:null})[_0x163b('0xb')](function(_0x7b617f){logger[_0x163b('0xc')](_0x163b('0x15'),_0x832818);logger[_0x163b('0xf')]('UpdateMailApplication',_0x832818,JSON[_0x163b('0x1d')](_0x7b617f));_0x5954e2(_0x7b617f);})['catch'](function(_0x83d39d){logger['error']('UpdateMailApplication',_0x83d39d['message'],_0x832818);_0x483459(_0x19ac46[_0x163b('0x10')](0x1f4,_0x83d39d['message']));});});}; \ No newline at end of file +var _0x1547=['rpc','../../config/environment','client','http','request','info','request\x20sent','MailApplication,\x20%s,\x20%s,\x20%s','stringify','error','code','MailApplication,\x20%s,\x20%s','message','result','catch','UpdateMailApplication','MailApplication','body','raw','options','where','attributes','limit','then','debug','lodash','util','moment','bluebird','../../mysqldb','../../config/logger'];(function(_0x140bbf,_0x98d5a7){var _0x4a296d=function(_0x2f9d7b){while(--_0x2f9d7b){_0x140bbf['push'](_0x140bbf['shift']());}};_0x4a296d(++_0x98d5a7);}(_0x1547,0x111));var _0x7154=function(_0xa59acd,_0x4f0d1e){_0xa59acd=_0xa59acd-0x0;var _0x28d677=_0x1547[_0xa59acd];return _0x28d677;};'use strict';var _=require(_0x7154('0x0'));var util=require(_0x7154('0x1'));var moment=require(_0x7154('0x2'));var BPromise=require(_0x7154('0x3'));var rs=require('randomstring');var fs=require('fs');var Redis=require('ioredis');var db=require(_0x7154('0x4'))['db'];var utils=require('../../config/utils');var logger=require(_0x7154('0x5'))(_0x7154('0x6'));var config=require(_0x7154('0x7'));var jayson=require('jayson/promise');var client=jayson[_0x7154('0x8')][_0x7154('0x9')]({'port':0x232a});function respondWithRpcPromise(_0x7d4f96,_0x1d4d29,_0x5e5c70){return new BPromise(function(_0x26b212,_0x82c70c){return client[_0x7154('0xa')](_0x7d4f96,_0x5e5c70)['then'](function(_0x431c12){logger[_0x7154('0xb')]('MailApplication,\x20%s,\x20%s',_0x1d4d29,_0x7154('0xc'));logger['debug'](_0x7154('0xd'),_0x1d4d29,'request\x20sent',JSON[_0x7154('0xe')](_0x431c12));if(_0x431c12[_0x7154('0xf')]){if(_0x431c12[_0x7154('0xf')][_0x7154('0x10')]===0x1f4){logger[_0x7154('0xf')](_0x7154('0x11'),_0x1d4d29,_0x431c12[_0x7154('0xf')][_0x7154('0x12')]);return _0x82c70c(_0x431c12[_0x7154('0xf')]['message']);}logger['error']('MailApplication,\x20%s,\x20%s',_0x1d4d29,_0x431c12[_0x7154('0xf')][_0x7154('0x12')]);return _0x26b212(_0x431c12[_0x7154('0xf')]['message']);}else{logger['info']('MailApplication,\x20%s,\x20%s',_0x1d4d29,_0x7154('0xc'));_0x26b212(_0x431c12[_0x7154('0x13')][_0x7154('0x12')]);}})[_0x7154('0x14')](function(_0x5b4f73){logger['error'](_0x7154('0x11'),_0x1d4d29,_0x5b4f73);_0x82c70c(_0x5b4f73);});});}exports[_0x7154('0x15')]=function(_0x4eaf48){var _0x44ef0a=this;return new Promise(function(_0x1b6883,_0xd9d5e2){return db[_0x7154('0x16')]['update'](_0x4eaf48[_0x7154('0x17')],{'raw':_0x4eaf48['options']?_0x4eaf48['options'][_0x7154('0x18')]===undefined?!![]:![]:!![],'individualHooks':!![],'where':_0x4eaf48[_0x7154('0x19')]?_0x4eaf48[_0x7154('0x19')][_0x7154('0x1a')]||null:null,'attributes':_0x4eaf48[_0x7154('0x19')]?_0x4eaf48[_0x7154('0x19')][_0x7154('0x1b')]||null:null,'limit':_0x4eaf48[_0x7154('0x19')]?_0x4eaf48[_0x7154('0x19')][_0x7154('0x1c')]||null:null})[_0x7154('0x1d')](function(_0x938e68){logger[_0x7154('0xb')](_0x7154('0x15'),_0x4eaf48);logger[_0x7154('0x1e')](_0x7154('0x15'),_0x4eaf48,JSON[_0x7154('0xe')](_0x938e68));_0x1b6883(_0x938e68);})['catch'](function(_0x27bf5e){logger['error'](_0x7154('0x15'),_0x27bf5e['message'],_0x4eaf48);_0xd9d5e2(_0x44ef0a[_0x7154('0xf')](0x1f4,_0x27bf5e['message']));});});}; \ No newline at end of file diff --git a/server/api/mailInteraction/index.js b/server/api/mailInteraction/index.js index 1314695..55e4e20 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 _0xf189=['/:id/messages','/:id/download','download','post','create','addMessage','/:id/tags','tracked','mail','mailinteraction:addtags','addTags','put','update','mailinteraction:destroy','destroy','delete','removeTags','exports','Router','../../components/auth/service','../../components/interaction/service','isAuthenticated','index','get','/:id','show'];(function(_0x3ab9ee,_0x4a74b8){var _0x82ee88=function(_0x6ccc7e){while(--_0x6ccc7e){_0x3ab9ee['push'](_0x3ab9ee['shift']());}};_0x82ee88(++_0x4a74b8);}(_0xf189,0x1e6));var _0x9f18=function(_0x17d9e3,_0x1f969c){_0x17d9e3=_0x17d9e3-0x0;var _0x14192d=_0xf189[_0x17d9e3];return _0x14192d;};'use strict';var express=require('express');var router=express[_0x9f18('0x0')]();var auth=require(_0x9f18('0x1'));var interaction=require(_0x9f18('0x2'));var controller=require('./mailInteraction.controller');router['get']('/',auth[_0x9f18('0x3')](),controller[_0x9f18('0x4')]);router[_0x9f18('0x5')]('/describe',auth[_0x9f18('0x3')](),controller['describe']);router[_0x9f18('0x5')](_0x9f18('0x6'),auth['isAuthenticated'](),controller[_0x9f18('0x7')]);router[_0x9f18('0x5')](_0x9f18('0x8'),auth[_0x9f18('0x3')](),controller['getMessages']);router[_0x9f18('0x5')](_0x9f18('0x9'),auth[_0x9f18('0x3')](),controller[_0x9f18('0xa')]);router[_0x9f18('0xb')]('/',auth[_0x9f18('0x3')](),controller[_0x9f18('0xc')]);router[_0x9f18('0xb')](_0x9f18('0x8'),auth['isAuthenticated'](),controller[_0x9f18('0xd')]);router[_0x9f18('0xb')](_0x9f18('0xe'),auth[_0x9f18('0x3')](),interaction[_0x9f18('0xf')](_0x9f18('0x10'),_0x9f18('0x11')),controller[_0x9f18('0x12')]);router[_0x9f18('0x13')](_0x9f18('0x6'),auth[_0x9f18('0x3')](),interaction['tracked']('mail','mailinteraction:update'),controller[_0x9f18('0x14')]);router['delete']('/:id',auth['isAuthenticated'](),interaction[_0x9f18('0xf')](_0x9f18('0x10'),_0x9f18('0x15')),controller[_0x9f18('0x16')]);router[_0x9f18('0x17')](_0x9f18('0xe'),auth['isAuthenticated'](),controller[_0x9f18('0x18')]);module[_0x9f18('0x19')]=router; \ No newline at end of file +var _0xba05=['getMessages','/:id/download','download','post','addMessage','/:id/tags','mail','mailinteraction:addtags','addTags','put','update','/:id','tracked','mailinteraction:destroy','destroy','delete','express','../../components/auth/service','../../components/interaction/service','./mailInteraction.controller','get','isAuthenticated','index','/describe','describe','show','/:id/messages'];(function(_0x48e491,_0x1a0149){var _0x2aa4f9=function(_0x4d97b6){while(--_0x4d97b6){_0x48e491['push'](_0x48e491['shift']());}};_0x2aa4f9(++_0x1a0149);}(_0xba05,0x1a5));var _0x5ba0=function(_0x4a53d,_0x58a95e){_0x4a53d=_0x4a53d-0x0;var _0x27410e=_0xba05[_0x4a53d];return _0x27410e;};'use strict';var express=require(_0x5ba0('0x0'));var router=express['Router']();var auth=require(_0x5ba0('0x1'));var interaction=require(_0x5ba0('0x2'));var controller=require(_0x5ba0('0x3'));router[_0x5ba0('0x4')]('/',auth[_0x5ba0('0x5')](),controller[_0x5ba0('0x6')]);router['get'](_0x5ba0('0x7'),auth[_0x5ba0('0x5')](),controller[_0x5ba0('0x8')]);router[_0x5ba0('0x4')]('/:id',auth[_0x5ba0('0x5')](),controller[_0x5ba0('0x9')]);router[_0x5ba0('0x4')](_0x5ba0('0xa'),auth['isAuthenticated'](),controller[_0x5ba0('0xb')]);router[_0x5ba0('0x4')](_0x5ba0('0xc'),auth[_0x5ba0('0x5')](),controller[_0x5ba0('0xd')]);router[_0x5ba0('0xe')]('/',auth['isAuthenticated'](),controller['create']);router[_0x5ba0('0xe')](_0x5ba0('0xa'),auth[_0x5ba0('0x5')](),controller[_0x5ba0('0xf')]);router[_0x5ba0('0xe')](_0x5ba0('0x10'),auth[_0x5ba0('0x5')](),interaction['tracked'](_0x5ba0('0x11'),_0x5ba0('0x12')),controller[_0x5ba0('0x13')]);router[_0x5ba0('0x14')]('/:id',auth['isAuthenticated'](),interaction['tracked'](_0x5ba0('0x11'),'mailinteraction:update'),controller[_0x5ba0('0x15')]);router['delete'](_0x5ba0('0x16'),auth['isAuthenticated'](),interaction[_0x5ba0('0x17')](_0x5ba0('0x11'),_0x5ba0('0x18')),controller[_0x5ba0('0x19')]);router[_0x5ba0('0x1a')](_0x5ba0('0x10'),auth[_0x5ba0('0x5')](),controller['removeTags']);module['exports']=router; \ No newline at end of file diff --git a/server/api/mailInteraction/mailInteraction.attributes.js b/server/api/mailInteraction/mailInteraction.attributes.js index 63c83ec..e55d90f 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 _0x5d2b=['long','ENUM','out','INTEGER','sequelize','iconv','BOOLEAN','DATE','STRING','TEXT'];(function(_0xbbcb36,_0x586383){var _0x4278ff=function(_0x35c9da){while(--_0x35c9da){_0xbbcb36['push'](_0xbbcb36['shift']());}};_0x4278ff(++_0x586383);}(_0x5d2b,0x90));var _0xb5d2=function(_0x1231df,_0x424cb3){_0x1231df=_0x1231df-0x0;var _0x1b2222=_0x5d2b[_0x1231df];return _0x1b2222;};'use strict';var Sequelize=require(_0xb5d2('0x0'));var iconv=require(_0xb5d2('0x1'));module['exports']={'closed':{'type':Sequelize[_0xb5d2('0x2')],'defaultValue':![]},'closedAt':{'type':Sequelize[_0xb5d2('0x3')]},'disposition':{'type':Sequelize[_0xb5d2('0x4')]},'secondDisposition':{'type':Sequelize['STRING']},'thirdDisposition':{'type':Sequelize[_0xb5d2('0x4')]},'note':{'type':Sequelize[_0xb5d2('0x4')]},'inReplyTo':{'type':Sequelize[_0xb5d2('0x4')](0x1fe)},'to':{'type':Sequelize['STRING']},'cc':{'type':Sequelize[_0xb5d2('0x5')](_0xb5d2('0x6'))},'subject':{'type':Sequelize['TEXT']()},'attach':{'type':Sequelize[_0xb5d2('0x2')],'defaultValue':![]},'read1stAt':{'type':Sequelize[_0xb5d2('0x3')]},'substatus':{'type':Sequelize[_0xb5d2('0x4')](0x3c)},'substatusAt':{'type':Sequelize[_0xb5d2('0x3')]},'firstMsgDirection':{'type':Sequelize[_0xb5d2('0x7')]('in',_0xb5d2('0x8')),'defaultValue':'in','allowNull':![]},'lastMsgAt':{'type':Sequelize['DATE']},'lastMsgDirection':{'type':Sequelize[_0xb5d2('0x7')]('in',_0xb5d2('0x8')),'defaultValue':'in','allowNull':![]},'autoreplyExecuted':{'type':Sequelize[_0xb5d2('0x2')],'defaultValue':![]},'queueId':{'type':Sequelize[_0xb5d2('0x9')]}}; \ No newline at end of file +var _0x9e99=['TEXT','long','ENUM','out','INTEGER','sequelize','BOOLEAN','DATE','STRING'];(function(_0x1bbc08,_0x444008){var _0x5d825b=function(_0x522920){while(--_0x522920){_0x1bbc08['push'](_0x1bbc08['shift']());}};_0x5d825b(++_0x444008);}(_0x9e99,0xd4));var _0x99e9=function(_0x2d99a3,_0x153baf){_0x2d99a3=_0x2d99a3-0x0;var _0x1a0fc0=_0x9e99[_0x2d99a3];return _0x1a0fc0;};'use strict';var Sequelize=require(_0x99e9('0x0'));var iconv=require('iconv');module['exports']={'closed':{'type':Sequelize[_0x99e9('0x1')],'defaultValue':![]},'closedAt':{'type':Sequelize[_0x99e9('0x2')]},'disposition':{'type':Sequelize[_0x99e9('0x3')]},'secondDisposition':{'type':Sequelize[_0x99e9('0x3')]},'thirdDisposition':{'type':Sequelize[_0x99e9('0x3')]},'note':{'type':Sequelize[_0x99e9('0x3')]},'inReplyTo':{'type':Sequelize['STRING'](0x1fe)},'to':{'type':Sequelize[_0x99e9('0x3')]},'cc':{'type':Sequelize[_0x99e9('0x4')](_0x99e9('0x5'))},'subject':{'type':Sequelize[_0x99e9('0x4')]()},'attach':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'read1stAt':{'type':Sequelize['DATE']},'substatus':{'type':Sequelize[_0x99e9('0x3')](0x3c)},'substatusAt':{'type':Sequelize[_0x99e9('0x2')]},'firstMsgDirection':{'type':Sequelize[_0x99e9('0x6')]('in',_0x99e9('0x7')),'defaultValue':'in','allowNull':![]},'lastMsgAt':{'type':Sequelize[_0x99e9('0x2')]},'lastMsgDirection':{'type':Sequelize[_0x99e9('0x6')]('in',_0x99e9('0x7')),'defaultValue':'in','allowNull':![]},'autoreplyExecuted':{'type':Sequelize[_0x99e9('0x1')],'defaultValue':![]},'queueId':{'type':Sequelize[_0x99e9('0x8')]}}; \ No newline at end of file diff --git a/server/api/mailInteraction/mailInteraction.controller.js b/server/api/mailInteraction/mailInteraction.controller.js index 774775b..65ed052 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 _0x193e=['zip-dir','moment','bluebird','path','lodash','juice','../../components/parsers/qs','../../config/logger','api','../../config/environment','../../mysqldb','html-entities','redis','localhost','socket.io-emitter','sendStatus','status','end','offset','undefined','limit','count','set','Content-Range','json','update','error','stack','name','send','index','map','MailInteraction','rawAttributes','fieldName','type','key','findAll','mail','user','then','catch','show','model','query','keys','filters','intersection','attributes','fields','length','includeAll','include','merge','create','body','params','destroy','find','describe','MailMessage','ids','omit','getMessages','findOne','order','sort','where','MailInteractionId','filter','$gte','split','YYYY-MM-DD\x20HH:mm:ss','options','inlineCss','true','addTags','setTags','spread','Tag','color','emit','mailInteractionTags:save','removeTags','download','unix','toString','root','files','tmp','join','server','attachments','transcript-%d-%s.zip','push','Attachment','Attachments','Messages','from','bcc','subject','get','mkdirSync','each','missing.recipient@your.company.com','decode','format','ddd,\x20DD\x20MMM\x20YYYY\x20HH:mm:ss\x20ZZ','headers','Bcc','basename','existsSync','build','writeFileSync','message%d.eml','eml-format','rimraf'];(function(_0x18d0d0,_0xb910b1){var _0xa7841=function(_0x403472){while(--_0x403472){_0x18d0d0['push'](_0x18d0d0['shift']());}};_0xa7841(++_0xb910b1);}(_0x193e,0xe8));var _0xe193=function(_0x1243e9,_0x43e932){_0x1243e9=_0x1243e9-0x0;var _0x2210ee=_0x193e[_0x1243e9];return _0x2210ee;};'use strict';var emlformat=require(_0xe193('0x0'));var rimraf=require(_0xe193('0x1'));var zipdir=require(_0xe193('0x2'));var moment=require(_0xe193('0x3'));var BPromise=require(_0xe193('0x4'));var util=require('util');var path=require(_0xe193('0x5'));var fs=require('fs');var _=require(_0xe193('0x6'));var juice=require(_0xe193('0x7'));var Redis=require('ioredis');var interaction=require('../../components/interaction/service');var qs=require(_0xe193('0x8'));var logger=require(_0xe193('0x9'))(_0xe193('0xa'));var config=require(_0xe193('0xb'));var db=require(_0xe193('0xc'))['db'];var htmlEntities=require(_0xe193('0xd'));config['redis']=_['defaults'](config[_0xe193('0xe')],{'host':_0xe193('0xf'),'port':0x18eb});var socket=require(_0xe193('0x10'))(new Redis(config[_0xe193('0xe')]));require('./mailInteraction.socket')['register'](socket);function respondWithStatusCode(_0x31fffa,_0x3caf14){_0x3caf14=_0x3caf14||0xcc;return function(_0x33bba4){if(_0x33bba4){return _0x31fffa[_0xe193('0x11')](_0x3caf14);}return _0x31fffa[_0xe193('0x12')](_0x3caf14)[_0xe193('0x13')]();};}function respondWithResult(_0x513b86,_0x307ba1){_0x307ba1=_0x307ba1||0xc8;return function(_0x5853d4){if(_0x5853d4){return _0x513b86[_0xe193('0x12')](_0x307ba1)['json'](_0x5853d4);}};}function respondWithFilteredResult(_0x388f5c,_0xf0fee3){return function(_0x5b5716){if(_0x5b5716){var _0x4cb304=typeof _0xf0fee3[_0xe193('0x14')]===_0xe193('0x15')&&typeof _0xf0fee3[_0xe193('0x16')]===_0xe193('0x15');var _0x3ebe1d=_0x5b5716[_0xe193('0x17')];var _0x3da848=_0x4cb304?0x0:_0xf0fee3[_0xe193('0x14')];var _0x19cd7f=_0x4cb304?_0x5b5716[_0xe193('0x17')]:_0xf0fee3[_0xe193('0x14')]+_0xf0fee3[_0xe193('0x16')];var _0x37145d;if(_0x19cd7f>=_0x3ebe1d){_0x19cd7f=_0x3ebe1d;_0x37145d=0xc8;}else{_0x37145d=0xce;}_0x388f5c[_0xe193('0x12')](_0x37145d);return _0x388f5c[_0xe193('0x18')](_0xe193('0x19'),_0x3da848+'-'+_0x19cd7f+'/'+_0x3ebe1d)[_0xe193('0x1a')](_0x5b5716);}return null;};}function saveUpdates(_0x441652){return function(_0x134f14){if(_0x134f14){return _0x134f14[_0xe193('0x1b')](_0x441652)['then'](function(_0x4f7e5e){return _0x4f7e5e;});}return null;};}function removeEntity(_0x2282fb){return function(_0x35d79d){if(_0x35d79d){return _0x35d79d['destroy']()['then'](function(){_0x2282fb[_0xe193('0x12')](0xcc)['end']();});}};}function handleEntityNotFound(_0x15efc6){return function(_0x4ae19f){if(!_0x4ae19f){_0x15efc6[_0xe193('0x11')](0x194);}return _0x4ae19f;};}function handleError(_0xcec9cf,_0x135aec){_0x135aec=_0x135aec||0x1f4;return function(_0x1f649d){logger[_0xe193('0x1c')](_0x1f649d[_0xe193('0x1d')]);if(_0x1f649d['name']){delete _0x1f649d[_0xe193('0x1e')];}_0xcec9cf[_0xe193('0x12')](_0x135aec)[_0xe193('0x1f')](_0x1f649d);};}exports[_0xe193('0x20')]=function(_0x1715d0,_0x12325f){var _0x5f0388={};var _0x499b6f=_[_0xe193('0x21')](db[_0xe193('0x22')][_0xe193('0x23')],function(_0x2a485c){return{'name':_0x2a485c[_0xe193('0x24')],'type':_0x2a485c[_0xe193('0x25')][_0xe193('0x26')]};});_0x5f0388=qs['getOptions'](_0x499b6f,_0x1715d0);return interaction[_0xe193('0x27')](_0xe193('0x28'),_0x1715d0['query'],_0x1715d0[_0xe193('0x29')],_0x5f0388,_0x499b6f)[_0xe193('0x2a')](respondWithFilteredResult(_0x12325f,_0x5f0388))[_0xe193('0x2b')](handleError(_0x12325f,null));};exports[_0xe193('0x2c')]=function(_0x376abc,_0x48fa27){var _0x410cf5={'raw':![],'where':{'id':_0x376abc['params']['id']}},_0x5d10a0={};_0x5d10a0[_0xe193('0x2d')]=_['keys'](db[_0xe193('0x22')][_0xe193('0x23')]);_0x5d10a0[_0xe193('0x2e')]=_[_0xe193('0x2f')](_0x376abc['query']);_0x5d10a0[_0xe193('0x30')]=_[_0xe193('0x31')](_0x5d10a0[_0xe193('0x2d')],_0x5d10a0[_0xe193('0x2e')]);_0x410cf5[_0xe193('0x32')]=_[_0xe193('0x31')](_0x5d10a0[_0xe193('0x2d')],qs['fields'](_0x376abc[_0xe193('0x2e')][_0xe193('0x33')]));_0x410cf5[_0xe193('0x32')]=_0x410cf5[_0xe193('0x32')][_0xe193('0x34')]?_0x410cf5[_0xe193('0x32')]:_0x5d10a0[_0xe193('0x2d')];if(_0x376abc[_0xe193('0x2e')][_0xe193('0x35')]){_0x410cf5[_0xe193('0x36')]=[{'all':!![]}];}_0x410cf5=_[_0xe193('0x37')]({},_0x410cf5,_0x376abc['options']);return db[_0xe193('0x22')]['find'](_0x410cf5)[_0xe193('0x2a')](handleEntityNotFound(_0x48fa27,null))[_0xe193('0x2a')](respondWithResult(_0x48fa27,null))[_0xe193('0x2b')](handleError(_0x48fa27,null));};exports['create']=function(_0x56e52b,_0x46ecf0){return db[_0xe193('0x22')][_0xe193('0x38')](_0x56e52b[_0xe193('0x39')],{})['then'](respondWithResult(_0x46ecf0,0xc9))[_0xe193('0x2b')](handleError(_0x46ecf0,null));};exports[_0xe193('0x1b')]=function(_0x6a9705,_0x4c4d08){if(_0x6a9705[_0xe193('0x39')]['id']){delete _0x6a9705[_0xe193('0x39')]['id'];}return db[_0xe193('0x22')]['find']({'where':{'id':_0x6a9705[_0xe193('0x3a')]['id']}})['then'](handleEntityNotFound(_0x4c4d08,null))['then'](saveUpdates(_0x6a9705['body'],null))[_0xe193('0x2a')](respondWithResult(_0x4c4d08,null))['catch'](handleError(_0x4c4d08,null));};exports[_0xe193('0x3b')]=function(_0x2e07ec,_0x2fcd38){return db['MailInteraction'][_0xe193('0x3c')]({'where':{'id':_0x2e07ec[_0xe193('0x3a')]['id']}})[_0xe193('0x2a')](handleEntityNotFound(_0x2fcd38,null))[_0xe193('0x2a')](removeEntity(_0x2fcd38,null))[_0xe193('0x2b')](handleError(_0x2fcd38,null));};exports[_0xe193('0x3d')]=function(_0x1adea3,_0x491de7){return db[_0xe193('0x22')][_0xe193('0x3d')]()[_0xe193('0x2a')](respondWithResult(_0x491de7,null))[_0xe193('0x2b')](handleError(_0x491de7,null));};exports['addMessage']=function(_0x5e968b,_0x5a9ca8){return db[_0xe193('0x3e')][_0xe193('0x3c')]({'where':{'id':_0x5e968b[_0xe193('0x3a')]['id']}})[_0xe193('0x2a')](handleEntityNotFound(_0x5a9ca8,null))[_0xe193('0x2a')](function(_0x4550fc){if(_0x4550fc){return _0x4550fc['addMessage'](_0x5e968b[_0xe193('0x39')][_0xe193('0x3f')],_[_0xe193('0x40')](_0x5e968b[_0xe193('0x39')],[_0xe193('0x3f'),'id'])||{});}})['then'](respondWithResult(_0x5a9ca8,null))[_0xe193('0x2b')](handleError(_0x5a9ca8,null));};exports[_0xe193('0x41')]=function(_0x541429,_0x55a5d0){var _0x30452c={'raw':![],'where':{}};var _0x26e2b7={};var _0x48c41a={'count':0x0,'rows':[]};return db[_0xe193('0x22')][_0xe193('0x42')]({'where':{'id':_0x541429[_0xe193('0x3a')]['id']}})[_0xe193('0x2a')](handleEntityNotFound(_0x55a5d0,null))[_0xe193('0x2a')](function(_0x28fa2b){if(_0x28fa2b){_0x26e2b7[_0xe193('0x2d')]=_[_0xe193('0x2f')](db[_0xe193('0x3e')]['rawAttributes']);_0x26e2b7['query']=_['keys'](_0x541429[_0xe193('0x2e')]);_0x26e2b7[_0xe193('0x30')]=_[_0xe193('0x31')](_0x26e2b7[_0xe193('0x2d')],_0x26e2b7['query']);_0x30452c[_0xe193('0x32')]=_[_0xe193('0x31')](_0x26e2b7[_0xe193('0x2d')],qs[_0xe193('0x33')](_0x541429[_0xe193('0x2e')][_0xe193('0x33')]));_0x30452c[_0xe193('0x32')]=_0x30452c['attributes'][_0xe193('0x34')]?_0x30452c[_0xe193('0x32')]:_0x26e2b7['model'];if(!_0x541429[_0xe193('0x2e')]['hasOwnProperty']('nolimit')){_0x30452c['limit']=qs[_0xe193('0x16')](_0x541429[_0xe193('0x2e')][_0xe193('0x16')]);_0x30452c['offset']=qs[_0xe193('0x14')](_0x541429[_0xe193('0x2e')][_0xe193('0x14')]);}_0x30452c[_0xe193('0x43')]=qs['sort'](_0x541429['query'][_0xe193('0x44')]);_0x30452c[_0xe193('0x45')]=qs['filters'](_['pick'](_0x541429[_0xe193('0x2e')],_0x26e2b7[_0xe193('0x30')]));_0x30452c['where'][_0xe193('0x46')]=_0x28fa2b['id'];if(_0x541429['query'][_0xe193('0x47')]){_0x30452c[_0xe193('0x45')]=_['merge'](_0x30452c[_0xe193('0x45')],{'$or':_[_0xe193('0x21')](_0x30452c[_0xe193('0x32')],function(_0x59f3a3){var _0x352577={};_0x352577[_0x59f3a3]={'$like':'%'+_0x541429[_0xe193('0x2e')][_0xe193('0x47')]+'%'};return _0x352577;})});}if(_0x541429[_0xe193('0x2e')]['$gte']){var _0x3efc6d=_0x541429[_0xe193('0x2e')][_0xe193('0x48')][_0xe193('0x49')](',');var _0x19e012={};_0x19e012[_0x3efc6d[0x0]]={'$gte':moment(_0x3efc6d[0x1])['format'](_0xe193('0x4a'))};_0x30452c[_0xe193('0x45')]=_[_0xe193('0x37')](_0x30452c[_0xe193('0x45')],_0x19e012);}_0x30452c=_[_0xe193('0x37')]({},_0x30452c,_0x541429[_0xe193('0x4b')]);return db[_0xe193('0x3e')]['count']({'where':_0x30452c[_0xe193('0x45')]})[_0xe193('0x2a')](function(_0x47db93){_0x48c41a['count']=_0x47db93;if(_0x541429[_0xe193('0x2e')][_0xe193('0x35')]){_0x30452c['include']=[{'all':!![]}];}return db[_0xe193('0x3e')]['findAll'](_0x30452c);})[_0xe193('0x2a')](function(_0x1ad1aa){if(_0x541429['query'][_0xe193('0x4c')]===_0xe193('0x4d')){for(var _0x3e1e70=0x0;_0x3e1e70<_0x1ad1aa[_0xe193('0x34')];_0x3e1e70++){_0x1ad1aa[_0x3e1e70][_0xe193('0x39')]=juice(_0x1ad1aa[_0x3e1e70][_0xe193('0x39')]);}}_0x48c41a['rows']=_0x1ad1aa;return _0x48c41a;});}})['then'](respondWithFilteredResult(_0x55a5d0,_0x30452c))[_0xe193('0x2b')](handleError(_0x55a5d0,null));};exports[_0xe193('0x4e')]=function(_0x4fa73c,_0x31b5c7){return db[_0xe193('0x22')]['find']({'where':{'id':_0x4fa73c[_0xe193('0x3a')]['id']}})[_0xe193('0x2a')](handleEntityNotFound(_0x31b5c7,null))[_0xe193('0x2a')](function(_0x5a434d){if(_0x5a434d){return _0x5a434d[_0xe193('0x4f')](_0x4fa73c[_0xe193('0x39')][_0xe193('0x3f')],_[_0xe193('0x40')](_0x4fa73c[_0xe193('0x39')],['ids','id'])||{})[_0xe193('0x50')](function(){return db[_0xe193('0x51')][_0xe193('0x27')]({'attributes':['id',_0xe193('0x1e'),_0xe193('0x52')],'where':{'id':_0x4fa73c[_0xe193('0x39')]['ids']}});})[_0xe193('0x2a')](function(_0x8701e1){socket[_0xe193('0x53')](_0xe193('0x54'),{'id':Number(_0x4fa73c[_0xe193('0x3a')]['id']),'tags':_0x8701e1||[]});return{'id':Number(_0x4fa73c[_0xe193('0x3a')]['id']),'tags':_0x8701e1||[]};});}})[_0xe193('0x2a')](respondWithResult(_0x31b5c7,null))['catch'](handleError(_0x31b5c7,null));};exports['removeTags']=function(_0x3fc641,_0x50fb8f){return db[_0xe193('0x22')]['find']({'where':{'id':_0x3fc641[_0xe193('0x3a')]['id']}})[_0xe193('0x2a')](handleEntityNotFound(_0x50fb8f,null))[_0xe193('0x2a')](function(_0x31cbd7){if(_0x31cbd7){return _0x31cbd7[_0xe193('0x55')](_0x3fc641['query']['ids']);}})[_0xe193('0x2a')](respondWithStatusCode(_0x50fb8f,null))[_0xe193('0x2b')](handleError(_0x50fb8f,null));};exports[_0xe193('0x56')]=function(_0x21e204,_0x16806f){var _0x27ff88=moment()[_0xe193('0x57')]()[_0xe193('0x58')]();var _0x4d433f=path['join'](config[_0xe193('0x59')],'server',_0xe193('0x5a'),_0xe193('0x5b'));var _0x2a07d8=path[_0xe193('0x5c')](config[_0xe193('0x59')],_0xe193('0x5d'),'files',_0xe193('0x5e'));var _0x41c245=path[_0xe193('0x5c')](_0x4d433f,_0x27ff88);var _0x420da6=util['format'](_0xe193('0x5f'),_0x21e204[_0xe193('0x3a')]['id'],_0x27ff88);var _0x28499c=path[_0xe193('0x5c')](_0x4d433f,_0x420da6);var _0x2e89b2=[];if(_0x21e204[_0xe193('0x2e')][_0xe193('0x5e')]){_0x2e89b2[_0xe193('0x60')]({'model':db[_0xe193('0x61')],'as':_0xe193('0x62'),'raw':!![]});}var _0x5dc9fa=[{'model':db[_0xe193('0x3e')],'as':_0xe193('0x63'),'attributes':['id','body',_0xe193('0x64'),'to','cc',_0xe193('0x65'),_0xe193('0x66'),'createdAt'],'where':{'secret':![]},'order':qs[_0xe193('0x44')]('id'),'include':_0x2e89b2}];return db[_0xe193('0x22')][_0xe193('0x3c')]({'where':{'id':_0x21e204['params']['id']},'include':_0x5dc9fa})[_0xe193('0x2a')](handleEntityNotFound(_0x16806f,null))[_0xe193('0x2a')](function(_0x53a28a){if(_0x53a28a&&_0x53a28a[_0xe193('0x63')]){var _0x42ff6d=_0x53a28a[_0xe193('0x67')]({'plain':!![]});fs[_0xe193('0x68')](_0x41c245);return BPromise[_0xe193('0x69')](_0x42ff6d[_0xe193('0x63')],function(_0x39fcf3,_0x13e60d){var _0x335df2={'from':_0x39fcf3[_0xe193('0x64')],'to':_0x39fcf3['to']||_0xe193('0x6a'),'subject':_0x39fcf3[_0xe193('0x66')],'html':htmlEntities[_0xe193('0x6b')](_0x39fcf3[_0xe193('0x39')]),'headers':{'Date':moment(_0x39fcf3['createdAt'])[_0xe193('0x6c')](_0xe193('0x6d'))},'attachments':[]};if(_0x39fcf3['cc']){_0x335df2[_0xe193('0x6e')]['Cc']=_0x39fcf3['cc'];}if(_0x39fcf3['bcc']){_0x335df2[_0xe193('0x6e')][_0xe193('0x6f')]=_0x39fcf3[_0xe193('0x65')];}return new BPromise(function(_0x3f4760,_0x2cecca){if(_0x39fcf3[_0xe193('0x62')]){for(var _0x251b86=0x0;_0x251b86<_0x39fcf3[_0xe193('0x62')][_0xe193('0x34')];_0x251b86++){var _0x2534fe=_0x39fcf3['Attachments'][_0x251b86];var _0x57da3f=path[_0xe193('0x5c')](_0x2a07d8,_0x2534fe[_0xe193('0x70')]);if(fs[_0xe193('0x71')](_0x57da3f)){_0x335df2[_0xe193('0x5e')][_0xe193('0x60')]({'name':_0x2534fe[_0xe193('0x1e')],'contentType':_0x2534fe[_0xe193('0x25')],'data':fs['readFileSync'](_0x57da3f)});}}}emlformat[_0xe193('0x72')](_0x335df2,function(_0x1fd085,_0x529a1a){if(_0x1fd085)return _0x2cecca(_0x1fd085);fs[_0xe193('0x73')](path[_0xe193('0x5c')](_0x41c245,util[_0xe193('0x6c')](_0xe193('0x74'),_0x13e60d)),_0x529a1a);return _0x3f4760(_0x529a1a);});});})[_0xe193('0x2a')](function(){return new BPromise(function(_0x5a9eb6,_0x34c8cd){zipdir(_0x41c245,{'saveTo':_0x28499c},function(_0x1c561a,_0x22950e){if(_0x1c561a)return _0x34c8cd(_0x1c561a);return _0x5a9eb6(_0x22950e);});})['then'](function(){return new BPromise(function(_0x3ba193,_0xb20721){rimraf(_0x41c245,function(_0x22d5df){if(_0x22d5df)_0xb20721(_0x22d5df);return _0x3ba193();});});})[_0xe193('0x2a')](function(){return _0x16806f['download'](_0x28499c,_0x420da6,function(_0x1b4b84){if(!_0x1b4b84)fs['unlinkSync'](_0x28499c);});});});}else{return _0x16806f['sendStatus'](0xc8);}})[_0xe193('0x2b')](handleError(_0x16806f,null));}; \ No newline at end of file +var _0x8b0e=['attributes','fields','length','includeAll','merge','options','create','body','find','describe','addMessage','MailMessage','ids','omit','findOne','hasOwnProperty','nolimit','sort','where','pick','MailInteractionId','filter','$gte','split','format','YYYY-MM-DD\x20HH:mm:ss','count','include','true','rows','addTags','setTags','Tag','color','emit','mailInteractionTags:save','removeTags','download','toString','join','root','server','files','attachments','transcript-%d-%s.zip','Attachment','Attachments','Messages','from','bcc','subject','createdAt','get','mkdirSync','each','missing.recipient@your.company.com','decode','ddd,\x20DD\x20MMM\x20YYYY\x20HH:mm:ss\x20ZZ','headers','basename','existsSync','push','build','writeFileSync','message%d.eml','eml-format','rimraf','zip-dir','util','path','lodash','juice','ioredis','../../components/parsers/qs','../../config/logger','api','../../config/environment','redis','socket.io-emitter','./mailInteraction.socket','register','sendStatus','status','end','json','offset','undefined','limit','set','Content-Range','update','then','destroy','error','stack','name','send','index','map','MailInteraction','rawAttributes','fieldName','type','key','getOptions','findAll','query','user','catch','params','model','keys','filters','intersection'];(function(_0x3a73c4,_0x5347f2){var _0x13864d=function(_0x2d219a){while(--_0x2d219a){_0x3a73c4['push'](_0x3a73c4['shift']());}};_0x13864d(++_0x5347f2);}(_0x8b0e,0xb3));var _0xe8b0=function(_0x40bdbc,_0x3fabcd){_0x40bdbc=_0x40bdbc-0x0;var _0xc603a8=_0x8b0e[_0x40bdbc];return _0xc603a8;};'use strict';var emlformat=require(_0xe8b0('0x0'));var rimraf=require(_0xe8b0('0x1'));var zipdir=require(_0xe8b0('0x2'));var moment=require('moment');var BPromise=require('bluebird');var util=require(_0xe8b0('0x3'));var path=require(_0xe8b0('0x4'));var fs=require('fs');var _=require(_0xe8b0('0x5'));var juice=require(_0xe8b0('0x6'));var Redis=require(_0xe8b0('0x7'));var interaction=require('../../components/interaction/service');var qs=require(_0xe8b0('0x8'));var logger=require(_0xe8b0('0x9'))(_0xe8b0('0xa'));var config=require(_0xe8b0('0xb'));var db=require('../../mysqldb')['db'];var htmlEntities=require('html-entities');config['redis']=_['defaults'](config[_0xe8b0('0xc')],{'host':'localhost','port':0x18eb});var socket=require(_0xe8b0('0xd'))(new Redis(config[_0xe8b0('0xc')]));require(_0xe8b0('0xe'))[_0xe8b0('0xf')](socket);function respondWithStatusCode(_0x3b2ff8,_0x31c406){_0x31c406=_0x31c406||0xcc;return function(_0x45fba0){if(_0x45fba0){return _0x3b2ff8[_0xe8b0('0x10')](_0x31c406);}return _0x3b2ff8[_0xe8b0('0x11')](_0x31c406)[_0xe8b0('0x12')]();};}function respondWithResult(_0x255588,_0x29be86){_0x29be86=_0x29be86||0xc8;return function(_0x32aeca){if(_0x32aeca){return _0x255588[_0xe8b0('0x11')](_0x29be86)[_0xe8b0('0x13')](_0x32aeca);}};}function respondWithFilteredResult(_0x316ecf,_0x5ad129){return function(_0x5bb220){if(_0x5bb220){var _0x517e25=typeof _0x5ad129[_0xe8b0('0x14')]===_0xe8b0('0x15')&&typeof _0x5ad129[_0xe8b0('0x16')]===_0xe8b0('0x15');var _0x3c2ed2=_0x5bb220['count'];var _0x5c0589=_0x517e25?0x0:_0x5ad129[_0xe8b0('0x14')];var _0x406c8f=_0x517e25?_0x5bb220['count']:_0x5ad129['offset']+_0x5ad129[_0xe8b0('0x16')];var _0x55dd06;if(_0x406c8f>=_0x3c2ed2){_0x406c8f=_0x3c2ed2;_0x55dd06=0xc8;}else{_0x55dd06=0xce;}_0x316ecf[_0xe8b0('0x11')](_0x55dd06);return _0x316ecf[_0xe8b0('0x17')](_0xe8b0('0x18'),_0x5c0589+'-'+_0x406c8f+'/'+_0x3c2ed2)[_0xe8b0('0x13')](_0x5bb220);}return null;};}function saveUpdates(_0x3237fa){return function(_0x3ad959){if(_0x3ad959){return _0x3ad959[_0xe8b0('0x19')](_0x3237fa)[_0xe8b0('0x1a')](function(_0x2805cd){return _0x2805cd;});}return null;};}function removeEntity(_0x70e104){return function(_0x6f1228){if(_0x6f1228){return _0x6f1228[_0xe8b0('0x1b')]()['then'](function(){_0x70e104[_0xe8b0('0x11')](0xcc)[_0xe8b0('0x12')]();});}};}function handleEntityNotFound(_0x441ae2){return function(_0x473c8a){if(!_0x473c8a){_0x441ae2[_0xe8b0('0x10')](0x194);}return _0x473c8a;};}function handleError(_0x3f612,_0x498c03){_0x498c03=_0x498c03||0x1f4;return function(_0x59b0ab){logger[_0xe8b0('0x1c')](_0x59b0ab[_0xe8b0('0x1d')]);if(_0x59b0ab[_0xe8b0('0x1e')]){delete _0x59b0ab['name'];}_0x3f612[_0xe8b0('0x11')](_0x498c03)[_0xe8b0('0x1f')](_0x59b0ab);};}exports[_0xe8b0('0x20')]=function(_0x10acb1,_0xe7dde2){var _0x5a99ef={};var _0x3a8f3a=_[_0xe8b0('0x21')](db[_0xe8b0('0x22')][_0xe8b0('0x23')],function(_0x40c522){return{'name':_0x40c522[_0xe8b0('0x24')],'type':_0x40c522[_0xe8b0('0x25')][_0xe8b0('0x26')]};});_0x5a99ef=qs[_0xe8b0('0x27')](_0x3a8f3a,_0x10acb1);return interaction[_0xe8b0('0x28')]('mail',_0x10acb1[_0xe8b0('0x29')],_0x10acb1[_0xe8b0('0x2a')],_0x5a99ef,_0x3a8f3a)[_0xe8b0('0x1a')](respondWithFilteredResult(_0xe7dde2,_0x5a99ef))[_0xe8b0('0x2b')](handleError(_0xe7dde2,null));};exports['show']=function(_0x29a96d,_0x1c2f5e){var _0x5567bb={'raw':![],'where':{'id':_0x29a96d[_0xe8b0('0x2c')]['id']}},_0x16babf={};_0x16babf[_0xe8b0('0x2d')]=_[_0xe8b0('0x2e')](db['MailInteraction'][_0xe8b0('0x23')]);_0x16babf[_0xe8b0('0x29')]=_['keys'](_0x29a96d[_0xe8b0('0x29')]);_0x16babf[_0xe8b0('0x2f')]=_[_0xe8b0('0x30')](_0x16babf[_0xe8b0('0x2d')],_0x16babf[_0xe8b0('0x29')]);_0x5567bb[_0xe8b0('0x31')]=_[_0xe8b0('0x30')](_0x16babf[_0xe8b0('0x2d')],qs[_0xe8b0('0x32')](_0x29a96d[_0xe8b0('0x29')][_0xe8b0('0x32')]));_0x5567bb[_0xe8b0('0x31')]=_0x5567bb['attributes'][_0xe8b0('0x33')]?_0x5567bb[_0xe8b0('0x31')]:_0x16babf[_0xe8b0('0x2d')];if(_0x29a96d['query'][_0xe8b0('0x34')]){_0x5567bb['include']=[{'all':!![]}];}_0x5567bb=_[_0xe8b0('0x35')]({},_0x5567bb,_0x29a96d[_0xe8b0('0x36')]);return db['MailInteraction']['find'](_0x5567bb)[_0xe8b0('0x1a')](handleEntityNotFound(_0x1c2f5e,null))[_0xe8b0('0x1a')](respondWithResult(_0x1c2f5e,null))['catch'](handleError(_0x1c2f5e,null));};exports['create']=function(_0x1cad64,_0x436031){return db[_0xe8b0('0x22')][_0xe8b0('0x37')](_0x1cad64[_0xe8b0('0x38')],{})[_0xe8b0('0x1a')](respondWithResult(_0x436031,0xc9))[_0xe8b0('0x2b')](handleError(_0x436031,null));};exports[_0xe8b0('0x19')]=function(_0x3f24c2,_0x18b451){if(_0x3f24c2[_0xe8b0('0x38')]['id']){delete _0x3f24c2[_0xe8b0('0x38')]['id'];}return db[_0xe8b0('0x22')][_0xe8b0('0x39')]({'where':{'id':_0x3f24c2[_0xe8b0('0x2c')]['id']}})['then'](handleEntityNotFound(_0x18b451,null))[_0xe8b0('0x1a')](saveUpdates(_0x3f24c2[_0xe8b0('0x38')],null))[_0xe8b0('0x1a')](respondWithResult(_0x18b451,null))[_0xe8b0('0x2b')](handleError(_0x18b451,null));};exports[_0xe8b0('0x1b')]=function(_0x3ae907,_0x2d607c){return db['MailInteraction'][_0xe8b0('0x39')]({'where':{'id':_0x3ae907[_0xe8b0('0x2c')]['id']}})[_0xe8b0('0x1a')](handleEntityNotFound(_0x2d607c,null))['then'](removeEntity(_0x2d607c,null))[_0xe8b0('0x2b')](handleError(_0x2d607c,null));};exports[_0xe8b0('0x3a')]=function(_0x400d50,_0x58a965){return db[_0xe8b0('0x22')][_0xe8b0('0x3a')]()[_0xe8b0('0x1a')](respondWithResult(_0x58a965,null))[_0xe8b0('0x2b')](handleError(_0x58a965,null));};exports[_0xe8b0('0x3b')]=function(_0x1baa3f,_0x320216){return db[_0xe8b0('0x3c')][_0xe8b0('0x39')]({'where':{'id':_0x1baa3f[_0xe8b0('0x2c')]['id']}})[_0xe8b0('0x1a')](handleEntityNotFound(_0x320216,null))[_0xe8b0('0x1a')](function(_0x4d8b97){if(_0x4d8b97){return _0x4d8b97[_0xe8b0('0x3b')](_0x1baa3f[_0xe8b0('0x38')][_0xe8b0('0x3d')],_[_0xe8b0('0x3e')](_0x1baa3f['body'],[_0xe8b0('0x3d'),'id'])||{});}})['then'](respondWithResult(_0x320216,null))[_0xe8b0('0x2b')](handleError(_0x320216,null));};exports['getMessages']=function(_0x37b579,_0x339a90){var _0x1d00d6={'raw':![],'where':{}};var _0x44ead9={};var _0x73f805={'count':0x0,'rows':[]};return db[_0xe8b0('0x22')][_0xe8b0('0x3f')]({'where':{'id':_0x37b579[_0xe8b0('0x2c')]['id']}})['then'](handleEntityNotFound(_0x339a90,null))['then'](function(_0x3e6612){if(_0x3e6612){_0x44ead9[_0xe8b0('0x2d')]=_[_0xe8b0('0x2e')](db['MailMessage'][_0xe8b0('0x23')]);_0x44ead9['query']=_[_0xe8b0('0x2e')](_0x37b579[_0xe8b0('0x29')]);_0x44ead9[_0xe8b0('0x2f')]=_['intersection'](_0x44ead9[_0xe8b0('0x2d')],_0x44ead9[_0xe8b0('0x29')]);_0x1d00d6[_0xe8b0('0x31')]=_[_0xe8b0('0x30')](_0x44ead9[_0xe8b0('0x2d')],qs['fields'](_0x37b579[_0xe8b0('0x29')]['fields']));_0x1d00d6[_0xe8b0('0x31')]=_0x1d00d6[_0xe8b0('0x31')][_0xe8b0('0x33')]?_0x1d00d6[_0xe8b0('0x31')]:_0x44ead9['model'];if(!_0x37b579['query'][_0xe8b0('0x40')](_0xe8b0('0x41'))){_0x1d00d6[_0xe8b0('0x16')]=qs['limit'](_0x37b579['query'][_0xe8b0('0x16')]);_0x1d00d6[_0xe8b0('0x14')]=qs[_0xe8b0('0x14')](_0x37b579['query'][_0xe8b0('0x14')]);}_0x1d00d6['order']=qs['sort'](_0x37b579[_0xe8b0('0x29')][_0xe8b0('0x42')]);_0x1d00d6[_0xe8b0('0x43')]=qs[_0xe8b0('0x2f')](_[_0xe8b0('0x44')](_0x37b579['query'],_0x44ead9['filters']));_0x1d00d6[_0xe8b0('0x43')][_0xe8b0('0x45')]=_0x3e6612['id'];if(_0x37b579[_0xe8b0('0x29')][_0xe8b0('0x46')]){_0x1d00d6[_0xe8b0('0x43')]=_[_0xe8b0('0x35')](_0x1d00d6[_0xe8b0('0x43')],{'$or':_[_0xe8b0('0x21')](_0x1d00d6[_0xe8b0('0x31')],function(_0x2db2c4){var _0x2df806={};_0x2df806[_0x2db2c4]={'$like':'%'+_0x37b579[_0xe8b0('0x29')][_0xe8b0('0x46')]+'%'};return _0x2df806;})});}if(_0x37b579['query'][_0xe8b0('0x47')]){var _0x103d09=_0x37b579[_0xe8b0('0x29')][_0xe8b0('0x47')][_0xe8b0('0x48')](',');var _0x4006ca={};_0x4006ca[_0x103d09[0x0]]={'$gte':moment(_0x103d09[0x1])[_0xe8b0('0x49')](_0xe8b0('0x4a'))};_0x1d00d6['where']=_['merge'](_0x1d00d6[_0xe8b0('0x43')],_0x4006ca);}_0x1d00d6=_[_0xe8b0('0x35')]({},_0x1d00d6,_0x37b579[_0xe8b0('0x36')]);return db[_0xe8b0('0x3c')][_0xe8b0('0x4b')]({'where':_0x1d00d6['where']})[_0xe8b0('0x1a')](function(_0x33451e){_0x73f805[_0xe8b0('0x4b')]=_0x33451e;if(_0x37b579[_0xe8b0('0x29')]['includeAll']){_0x1d00d6[_0xe8b0('0x4c')]=[{'all':!![]}];}return db[_0xe8b0('0x3c')][_0xe8b0('0x28')](_0x1d00d6);})[_0xe8b0('0x1a')](function(_0x1c833f){if(_0x37b579['query']['inlineCss']===_0xe8b0('0x4d')){for(var _0x24ffaf=0x0;_0x24ffaf<_0x1c833f[_0xe8b0('0x33')];_0x24ffaf++){_0x1c833f[_0x24ffaf][_0xe8b0('0x38')]=juice(_0x1c833f[_0x24ffaf]['body']);}}_0x73f805[_0xe8b0('0x4e')]=_0x1c833f;return _0x73f805;});}})[_0xe8b0('0x1a')](respondWithFilteredResult(_0x339a90,_0x1d00d6))[_0xe8b0('0x2b')](handleError(_0x339a90,null));};exports[_0xe8b0('0x4f')]=function(_0x4f58e1,_0x33df73){return db[_0xe8b0('0x22')][_0xe8b0('0x39')]({'where':{'id':_0x4f58e1[_0xe8b0('0x2c')]['id']}})[_0xe8b0('0x1a')](handleEntityNotFound(_0x33df73,null))['then'](function(_0x1a2fd3){if(_0x1a2fd3){return _0x1a2fd3[_0xe8b0('0x50')](_0x4f58e1[_0xe8b0('0x38')][_0xe8b0('0x3d')],_[_0xe8b0('0x3e')](_0x4f58e1['body'],[_0xe8b0('0x3d'),'id'])||{})['spread'](function(){return db[_0xe8b0('0x51')][_0xe8b0('0x28')]({'attributes':['id',_0xe8b0('0x1e'),_0xe8b0('0x52')],'where':{'id':_0x4f58e1[_0xe8b0('0x38')][_0xe8b0('0x3d')]}});})[_0xe8b0('0x1a')](function(_0x24f04b){socket[_0xe8b0('0x53')](_0xe8b0('0x54'),{'id':Number(_0x4f58e1['params']['id']),'tags':_0x24f04b||[]});return{'id':Number(_0x4f58e1[_0xe8b0('0x2c')]['id']),'tags':_0x24f04b||[]};});}})[_0xe8b0('0x1a')](respondWithResult(_0x33df73,null))[_0xe8b0('0x2b')](handleError(_0x33df73,null));};exports[_0xe8b0('0x55')]=function(_0x3f8e58,_0x4e8c07){return db[_0xe8b0('0x22')][_0xe8b0('0x39')]({'where':{'id':_0x3f8e58[_0xe8b0('0x2c')]['id']}})[_0xe8b0('0x1a')](handleEntityNotFound(_0x4e8c07,null))[_0xe8b0('0x1a')](function(_0xc7e4cb){if(_0xc7e4cb){return _0xc7e4cb[_0xe8b0('0x55')](_0x3f8e58[_0xe8b0('0x29')][_0xe8b0('0x3d')]);}})[_0xe8b0('0x1a')](respondWithStatusCode(_0x4e8c07,null))['catch'](handleError(_0x4e8c07,null));};exports[_0xe8b0('0x56')]=function(_0x233587,_0x4e1fa6){var _0x436f49=moment()['unix']()[_0xe8b0('0x57')]();var _0xfbe90=path[_0xe8b0('0x58')](config[_0xe8b0('0x59')],_0xe8b0('0x5a'),_0xe8b0('0x5b'),'tmp');var _0x3dae55=path[_0xe8b0('0x58')](config[_0xe8b0('0x59')],'server',_0xe8b0('0x5b'),_0xe8b0('0x5c'));var _0x2fcc4d=path[_0xe8b0('0x58')](_0xfbe90,_0x436f49);var _0x276558=util[_0xe8b0('0x49')](_0xe8b0('0x5d'),_0x233587[_0xe8b0('0x2c')]['id'],_0x436f49);var _0x164b5d=path[_0xe8b0('0x58')](_0xfbe90,_0x276558);var _0x3f1865=[];if(_0x233587[_0xe8b0('0x29')][_0xe8b0('0x5c')]){_0x3f1865['push']({'model':db[_0xe8b0('0x5e')],'as':_0xe8b0('0x5f'),'raw':!![]});}var _0x40833c=[{'model':db[_0xe8b0('0x3c')],'as':_0xe8b0('0x60'),'attributes':['id',_0xe8b0('0x38'),_0xe8b0('0x61'),'to','cc',_0xe8b0('0x62'),_0xe8b0('0x63'),_0xe8b0('0x64')],'where':{'secret':![]},'order':qs[_0xe8b0('0x42')]('id'),'include':_0x3f1865}];return db[_0xe8b0('0x22')][_0xe8b0('0x39')]({'where':{'id':_0x233587[_0xe8b0('0x2c')]['id']},'include':_0x40833c})['then'](handleEntityNotFound(_0x4e1fa6,null))[_0xe8b0('0x1a')](function(_0x1e9703){if(_0x1e9703&&_0x1e9703[_0xe8b0('0x60')]){var _0x229eb0=_0x1e9703[_0xe8b0('0x65')]({'plain':!![]});fs[_0xe8b0('0x66')](_0x2fcc4d);return BPromise[_0xe8b0('0x67')](_0x229eb0[_0xe8b0('0x60')],function(_0x18508f,_0x41ac84){var _0x7c879d={'from':_0x18508f[_0xe8b0('0x61')],'to':_0x18508f['to']||_0xe8b0('0x68'),'subject':_0x18508f[_0xe8b0('0x63')],'html':htmlEntities[_0xe8b0('0x69')](_0x18508f[_0xe8b0('0x38')]),'headers':{'Date':moment(_0x18508f[_0xe8b0('0x64')])[_0xe8b0('0x49')](_0xe8b0('0x6a'))},'attachments':[]};if(_0x18508f['cc']){_0x7c879d[_0xe8b0('0x6b')]['Cc']=_0x18508f['cc'];}if(_0x18508f[_0xe8b0('0x62')]){_0x7c879d[_0xe8b0('0x6b')]['Bcc']=_0x18508f[_0xe8b0('0x62')];}return new BPromise(function(_0x13b513,_0x4c0bb8){if(_0x18508f[_0xe8b0('0x5f')]){for(var _0x666da5=0x0;_0x666da5<_0x18508f['Attachments'][_0xe8b0('0x33')];_0x666da5++){var _0x914fa0=_0x18508f['Attachments'][_0x666da5];var _0x30cfe6=path[_0xe8b0('0x58')](_0x3dae55,_0x914fa0[_0xe8b0('0x6c')]);if(fs[_0xe8b0('0x6d')](_0x30cfe6)){_0x7c879d[_0xe8b0('0x5c')][_0xe8b0('0x6e')]({'name':_0x914fa0['name'],'contentType':_0x914fa0[_0xe8b0('0x25')],'data':fs['readFileSync'](_0x30cfe6)});}}}emlformat[_0xe8b0('0x6f')](_0x7c879d,function(_0xf0feec,_0x4a4bf8){if(_0xf0feec)return _0x4c0bb8(_0xf0feec);fs[_0xe8b0('0x70')](path[_0xe8b0('0x58')](_0x2fcc4d,util['format'](_0xe8b0('0x71'),_0x41ac84)),_0x4a4bf8);return _0x13b513(_0x4a4bf8);});});})[_0xe8b0('0x1a')](function(){return new BPromise(function(_0x13c74c,_0x3720dc){zipdir(_0x2fcc4d,{'saveTo':_0x164b5d},function(_0x543c92,_0xf91696){if(_0x543c92)return _0x3720dc(_0x543c92);return _0x13c74c(_0xf91696);});})[_0xe8b0('0x1a')](function(){return new BPromise(function(_0x521da9,_0x490a8c){rimraf(_0x2fcc4d,function(_0x2af0d8){if(_0x2af0d8)_0x490a8c(_0x2af0d8);return _0x521da9();});});})[_0xe8b0('0x1a')](function(){return _0x4e1fa6[_0xe8b0('0x56')](_0x164b5d,_0x276558,function(_0x5bca9e){if(!_0x5bca9e)fs['unlinkSync'](_0x164b5d);});});});}else{return _0x4e1fa6[_0xe8b0('0x10')](0xc8);}})['catch'](handleError(_0x4e1fa6,null));}; \ No newline at end of file diff --git a/server/api/mailInteraction/mailInteraction.events.js b/server/api/mailInteraction/mailInteraction.events.js index 28e2771..137d0e7 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 _0xdbbe=['MailMessage','setMaxListeners','save','remove','getUsers','then','setDataValue','Users','length','emit','catch','hasOwnProperty','hook','../../mysqldb','MailInteraction'];(function(_0x3f1929,_0x957487){var _0x1ebaa9=function(_0x46f186){while(--_0x46f186){_0x3f1929['push'](_0x3f1929['shift']());}};_0x1ebaa9(++_0x957487);}(_0xdbbe,0x148));var _0xedbb=function(_0x261b8a,_0x553ec4){_0x261b8a=_0x261b8a-0x0;var _0x3455e8=_0xdbbe[_0x261b8a];return _0x3455e8;};'use strict';var EventEmitter=require('events');var MailInteraction=require(_0xedbb('0x0'))['db'][_0xedbb('0x1')];var MailMessage=require(_0xedbb('0x0'))['db'][_0xedbb('0x2')];var MailInteractionEvents=new EventEmitter();MailInteractionEvents[_0xedbb('0x3')](0x0);var events={'afterCreate':_0xedbb('0x4'),'afterUpdate':'update','afterDestroy':_0xedbb('0x5')};function emitEvent(_0x9c1af2){return function(_0x20c290,_0x32da9,_0x8022ef){_0x20c290[_0xedbb('0x6')]({'attributes':['id'],'raw':!![]})[_0xedbb('0x7')](function(_0x51f66c){_0x20c290[_0xedbb('0x8')](_0xedbb('0x9'),_0x51f66c['map'](function(_0x37e358){return{'id':_0x37e358['id']};}));return MailMessage['findAll']({'where':{'MailInteractionId':_0x20c290['id'],'direction':'in','read':![]},'raw':!![]});})[_0xedbb('0x7')](function(_0xcf5769){_0x20c290[_0xedbb('0x8')]('unreadMessages',_0xcf5769[_0xedbb('0xa')]);MailInteractionEvents['emit'](_0x9c1af2+':'+_0x20c290['id'],_0x20c290);MailInteractionEvents[_0xedbb('0xb')](_0x9c1af2,_0x20c290);_0x8022ef(null);})[_0xedbb('0xc')](_0x8022ef(null));};}for(var e in events){if(events[_0xedbb('0xd')](e)){var event=events[e];MailInteraction[_0xedbb('0xe')](e,emitEvent(event));}}module['exports']=MailInteractionEvents; \ No newline at end of file +var _0x2f0e=['save','remove','getUsers','then','setDataValue','Users','map','findAll','unreadMessages','length','emit','catch','hasOwnProperty','hook','exports','../../mysqldb','MailInteraction','setMaxListeners'];(function(_0x183fbc,_0x22707d){var _0x43f528=function(_0x21870c){while(--_0x21870c){_0x183fbc['push'](_0x183fbc['shift']());}};_0x43f528(++_0x22707d);}(_0x2f0e,0x165));var _0xe2f0=function(_0x1fdb0e,_0x3bc470){_0x1fdb0e=_0x1fdb0e-0x0;var _0x3404b7=_0x2f0e[_0x1fdb0e];return _0x3404b7;};'use strict';var EventEmitter=require('events');var MailInteraction=require(_0xe2f0('0x0'))['db'][_0xe2f0('0x1')];var MailMessage=require('../../mysqldb')['db']['MailMessage'];var MailInteractionEvents=new EventEmitter();MailInteractionEvents[_0xe2f0('0x2')](0x0);var events={'afterCreate':_0xe2f0('0x3'),'afterUpdate':'update','afterDestroy':_0xe2f0('0x4')};function emitEvent(_0x4176cb){return function(_0x10b32e,_0x305bf6,_0x14ad33){_0x10b32e[_0xe2f0('0x5')]({'attributes':['id'],'raw':!![]})[_0xe2f0('0x6')](function(_0x143030){_0x10b32e[_0xe2f0('0x7')](_0xe2f0('0x8'),_0x143030[_0xe2f0('0x9')](function(_0x584faa){return{'id':_0x584faa['id']};}));return MailMessage[_0xe2f0('0xa')]({'where':{'MailInteractionId':_0x10b32e['id'],'direction':'in','read':![]},'raw':!![]});})[_0xe2f0('0x6')](function(_0x68172a){_0x10b32e[_0xe2f0('0x7')](_0xe2f0('0xb'),_0x68172a[_0xe2f0('0xc')]);MailInteractionEvents[_0xe2f0('0xd')](_0x4176cb+':'+_0x10b32e['id'],_0x10b32e);MailInteractionEvents[_0xe2f0('0xd')](_0x4176cb,_0x10b32e);_0x14ad33(null);})[_0xe2f0('0xe')](_0x14ad33(null));};}for(var e in events){if(events[_0xe2f0('0xf')](e)){var event=events[e];MailInteraction[_0xe2f0('0x10')](e,emitEvent(event));}}module[_0xe2f0('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 17d05a3..c272374 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 _0x4f6e=['subject','FULLTEXT','substatus','substatusAt','format','YYYY-MM-DD\x20HH:mm:ss','closed','closedAt','changed','get','MailMessage','update','then','catch','utf8mb4_unicode_ci','lodash','../../config/logger','moment','request-promise','./mailInteraction.attributes','exports','MailInteraction','mail_interactions'];(function(_0x196f22,_0x25c5e0){var _0xf55530=function(_0x54fae4){while(--_0x54fae4){_0x196f22['push'](_0x196f22['shift']());}};_0xf55530(++_0x25c5e0);}(_0x4f6e,0x1c4));var _0xe4f6=function(_0x16631a,_0x2cfd7c){_0x16631a=_0x16631a-0x0;var _0xb7d915=_0x4f6e[_0x16631a];return _0xb7d915;};'use strict';var _=require(_0xe4f6('0x0'));var util=require('util');var logger=require(_0xe4f6('0x1'))('api');var moment=require(_0xe4f6('0x2'));var BPromise=require('bluebird');var rp=require(_0xe4f6('0x3'));var fs=require('fs');var path=require('path');var rimraf=require('rimraf');var config=require('../../config/environment');var attributes=require(_0xe4f6('0x4'));module[_0xe4f6('0x5')]=function(_0x4fe515,_0xe5bc28){return _0x4fe515['define'](_0xe4f6('0x6'),attributes,{'tableName':_0xe4f6('0x7'),'paranoid':![],'indexes':[{'name':'fti_mail_interactions','fields':[_0xe4f6('0x8'),'to'],'type':_0xe4f6('0x9')}],'timestamps':!![],'hooks':{'beforeCreate':function(_0x3bef5e,_0x19abea,_0x445df7){if(_0x3bef5e[_0xe4f6('0xa')]){_0x3bef5e[_0xe4f6('0xb')]=moment()[_0xe4f6('0xc')](_0xe4f6('0xd'));}if(_0x3bef5e[_0xe4f6('0xe')]){_0x3bef5e[_0xe4f6('0xf')]=moment()['format'](_0xe4f6('0xd'));}_0x445df7(null,_0x19abea);},'beforeUpdate':function(_0x17c77e,_0xc1a27e,_0x275cf2){if(_0x17c77e[_0xe4f6('0x10')]('substatus')){_0x17c77e[_0xe4f6('0xb')]=_0x17c77e['substatus']?moment()[_0xe4f6('0xc')]('YYYY-MM-DD\x20HH:mm:ss'):null;}if(_0x17c77e['changed'](_0xe4f6('0xe'))){_0x17c77e[_0xe4f6('0xf')]=moment()[_0xe4f6('0xc')](_0xe4f6('0xd'));_0x17c77e[_0xe4f6('0xa')]=null;_0x17c77e[_0xe4f6('0xb')]=null;}_0x275cf2(null,_0x17c77e);},'afterUpdate':function(_0x1db71c,_0x3e69b3,_0x2d07a4){var _0x519507=_0x4fe515['models'];var _0x13494b=_0x1db71c[_0xe4f6('0x11')]({'plain':!![]});if(_0x13494b['closed']){return _0x519507[_0xe4f6('0x12')][_0xe4f6('0x13')]({'read':!![]},{'where':{'MailInteractionId':_0x13494b['id']}})[_0xe4f6('0x14')](function(){_0x2d07a4();})[_0xe4f6('0x15')](function(_0x5dcc5e){_0x2d07a4(_0x5dcc5e);});}else{_0x2d07a4();}}},'charset':'utf8mb4','collate':_0xe4f6('0x16')});}; \ No newline at end of file +var _0x98db=['closed','closedAt','changed','substatus','get','MailMessage','update','then','catch','utf8mb4','utf8mb4_unicode_ci','lodash','util','../../config/logger','api','moment','bluebird','path','rimraf','../../config/environment','./mailInteraction.attributes','define','MailInteraction','mail_interactions','fti_mail_interactions','subject','FULLTEXT','substatusAt','format','YYYY-MM-DD\x20HH:mm:ss'];(function(_0x50e47e,_0x1bf3cc){var _0x38f9de=function(_0x2855e9){while(--_0x2855e9){_0x50e47e['push'](_0x50e47e['shift']());}};_0x38f9de(++_0x1bf3cc);}(_0x98db,0x1eb));var _0xb98d=function(_0x132558,_0x521d93){_0x132558=_0x132558-0x0;var _0x34f138=_0x98db[_0x132558];return _0x34f138;};'use strict';var _=require(_0xb98d('0x0'));var util=require(_0xb98d('0x1'));var logger=require(_0xb98d('0x2'))(_0xb98d('0x3'));var moment=require(_0xb98d('0x4'));var BPromise=require(_0xb98d('0x5'));var rp=require('request-promise');var fs=require('fs');var path=require(_0xb98d('0x6'));var rimraf=require(_0xb98d('0x7'));var config=require(_0xb98d('0x8'));var attributes=require(_0xb98d('0x9'));module['exports']=function(_0x48b307,_0x35d6da){return _0x48b307[_0xb98d('0xa')](_0xb98d('0xb'),attributes,{'tableName':_0xb98d('0xc'),'paranoid':![],'indexes':[{'name':_0xb98d('0xd'),'fields':[_0xb98d('0xe'),'to'],'type':_0xb98d('0xf')}],'timestamps':!![],'hooks':{'beforeCreate':function(_0x35bc31,_0x1ce593,_0x7b0409){if(_0x35bc31['substatus']){_0x35bc31[_0xb98d('0x10')]=moment()[_0xb98d('0x11')](_0xb98d('0x12'));}if(_0x35bc31[_0xb98d('0x13')]){_0x35bc31[_0xb98d('0x14')]=moment()['format'](_0xb98d('0x12'));}_0x7b0409(null,_0x1ce593);},'beforeUpdate':function(_0x4de020,_0x586063,_0x177b79){if(_0x4de020[_0xb98d('0x15')](_0xb98d('0x16'))){_0x4de020[_0xb98d('0x10')]=_0x4de020[_0xb98d('0x16')]?moment()[_0xb98d('0x11')](_0xb98d('0x12')):null;}if(_0x4de020['changed'](_0xb98d('0x13'))){_0x4de020['closedAt']=moment()[_0xb98d('0x11')]('YYYY-MM-DD\x20HH:mm:ss');_0x4de020[_0xb98d('0x16')]=null;_0x4de020[_0xb98d('0x10')]=null;}_0x177b79(null,_0x4de020);},'afterUpdate':function(_0x25c337,_0x5ed84b,_0x343562){var _0xeaff25=_0x48b307['models'];var _0xa9faed=_0x25c337[_0xb98d('0x17')]({'plain':!![]});if(_0xa9faed['closed']){return _0xeaff25[_0xb98d('0x18')][_0xb98d('0x19')]({'read':!![]},{'where':{'MailInteractionId':_0xa9faed['id']}})[_0xb98d('0x1a')](function(){_0x343562();})[_0xb98d('0x1b')](function(_0x3a7a39){_0x343562(_0x3a7a39);});}else{_0x343562();}}},'charset':_0xb98d('0x1c'),'collate':_0xb98d('0x1d')});}; \ No newline at end of file diff --git a/server/api/mailInteraction/mailInteraction.rpc.js b/server/api/mailInteraction/mailInteraction.rpc.js index 1b9d461..20f02e7 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 _0x077b=['MailInteraction,\x20%s,\x20%s,\x20%s','request\x20sent','error','MailInteraction,\x20%s,\x20%s','message','result','catch','MailInteraction','update','body','options','raw','where','attributes','limit','then','UpdateMailInteraction','stringify','AddTagsToMailInteraction','addTags','ids','omit','spread','AddTags','lodash','moment','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','client','http','redis','defaults','./mailInteraction.socket','register','request','info','debug'];(function(_0x41df5c,_0x4e16d7){var _0x63eff4=function(_0x50455c){while(--_0x50455c){_0x41df5c['push'](_0x41df5c['shift']());}};_0x63eff4(++_0x4e16d7);}(_0x077b,0xc0));var _0xb077=function(_0xa825d2,_0x2732c9){_0xa825d2=_0xa825d2-0x0;var _0x3cff5a=_0x077b[_0xa825d2];return _0x3cff5a;};'use strict';var _=require(_0xb077('0x0'));var util=require('util');var moment=require(_0xb077('0x1'));var BPromise=require('bluebird');var rs=require(_0xb077('0x2'));var fs=require('fs');var Redis=require(_0xb077('0x3'));var db=require(_0xb077('0x4'))['db'];var utils=require(_0xb077('0x5'));var logger=require(_0xb077('0x6'))(_0xb077('0x7'));var config=require(_0xb077('0x8'));var jayson=require('jayson/promise');var client=jayson[_0xb077('0x9')][_0xb077('0xa')]({'port':0x232a});config[_0xb077('0xb')]=_[_0xb077('0xc')](config[_0xb077('0xb')],{'host':'localhost','port':0x18eb});var socket=require('socket.io-emitter')(new Redis(config[_0xb077('0xb')]));require(_0xb077('0xd'))[_0xb077('0xe')](socket);function respondWithRpcPromise(_0x217238,_0x51d39d,_0x479906){return new BPromise(function(_0x1f9370,_0x4184f5){return client[_0xb077('0xf')](_0x217238,_0x479906)['then'](function(_0x38a351){logger[_0xb077('0x10')]('MailInteraction,\x20%s,\x20%s',_0x51d39d,'request\x20sent');logger[_0xb077('0x11')](_0xb077('0x12'),_0x51d39d,_0xb077('0x13'),JSON['stringify'](_0x38a351));if(_0x38a351['error']){if(_0x38a351[_0xb077('0x14')]['code']===0x1f4){logger[_0xb077('0x14')](_0xb077('0x15'),_0x51d39d,_0x38a351[_0xb077('0x14')][_0xb077('0x16')]);return _0x4184f5(_0x38a351[_0xb077('0x14')][_0xb077('0x16')]);}logger[_0xb077('0x14')](_0xb077('0x15'),_0x51d39d,_0x38a351[_0xb077('0x14')][_0xb077('0x16')]);return _0x1f9370(_0x38a351[_0xb077('0x14')][_0xb077('0x16')]);}else{logger[_0xb077('0x10')](_0xb077('0x15'),_0x51d39d,_0xb077('0x13'));_0x1f9370(_0x38a351[_0xb077('0x17')][_0xb077('0x16')]);}})[_0xb077('0x18')](function(_0x55b760){logger[_0xb077('0x14')]('MailInteraction,\x20%s,\x20%s',_0x51d39d,_0x55b760);_0x4184f5(_0x55b760);});});}exports['UpdateMailInteraction']=function(_0x51bc0a){var _0x4e750e=this;return new Promise(function(_0xa644e8,_0x540364){return db[_0xb077('0x19')][_0xb077('0x1a')](_0x51bc0a[_0xb077('0x1b')],{'raw':_0x51bc0a[_0xb077('0x1c')]?_0x51bc0a['options'][_0xb077('0x1d')]===undefined?!![]:![]:!![],'individualHooks':!![],'where':_0x51bc0a[_0xb077('0x1c')]?_0x51bc0a[_0xb077('0x1c')][_0xb077('0x1e')]||null:null,'attributes':_0x51bc0a[_0xb077('0x1c')]?_0x51bc0a['options'][_0xb077('0x1f')]||null:null,'limit':_0x51bc0a[_0xb077('0x1c')]?_0x51bc0a[_0xb077('0x1c')][_0xb077('0x20')]||null:null})[_0xb077('0x21')](function(_0x3e64d6){logger[_0xb077('0x10')]('UpdateMailInteraction',_0x51bc0a);logger[_0xb077('0x11')](_0xb077('0x22'),_0x51bc0a,JSON[_0xb077('0x23')](_0x3e64d6));_0xa644e8(_0x3e64d6);})[_0xb077('0x18')](function(_0x5dd929){logger['error']('UpdateMailInteraction',_0x5dd929[_0xb077('0x16')],_0x51bc0a);_0x540364(_0x4e750e['error'](0x1f4,_0x5dd929['message']));});});};exports[_0xb077('0x24')]=function(_0x519437){return new Promise(function(_0xa7e60c,_0x5b4e30){return db[_0xb077('0x19')]['find']({'where':_0x519437[_0xb077('0x1c')]?_0x519437[_0xb077('0x1c')]['where']||null:null})[_0xb077('0x21')](function(_0xc842ec){if(_0xc842ec){return _0xc842ec[_0xb077('0x25')](_0x519437['body'][_0xb077('0x26')],_[_0xb077('0x27')](_0x519437[_0xb077('0x1b')],[_0xb077('0x26'),'id'])||{});}})[_0xb077('0x28')](function(_0x57d3f7){logger[_0xb077('0x10')](_0xb077('0x29'),_0x519437);logger['debug'](_0xb077('0x29'),_0x519437,JSON[_0xb077('0x23')](_0x57d3f7));_0xa7e60c(_0x57d3f7);})['catch'](function(_0x7676ae){logger[_0xb077('0x14')](_0xb077('0x29'),_0x7676ae[_0xb077('0x16')],_0x519437);_0x5b4e30(_this[_0xb077('0x14')](0x1f4,_0x7676ae['message']));});});}; \ No newline at end of file +var _0x8015=['../../mysqldb','../../config/logger','../../config/environment','jayson/promise','http','redis','defaults','socket.io-emitter','register','request','then','info','MailInteraction,\x20%s,\x20%s','request\x20sent','debug','MailInteraction,\x20%s,\x20%s,\x20%s','stringify','error','code','message','result','catch','MailInteraction','update','body','options','raw','where','limit','UpdateMailInteraction','AddTagsToMailInteraction','find','addTags','ids','omit','spread','AddTags','lodash','moment','bluebird','randomstring','ioredis'];(function(_0x4f6e38,_0x177760){var _0x3d1319=function(_0x821e8d){while(--_0x821e8d){_0x4f6e38['push'](_0x4f6e38['shift']());}};_0x3d1319(++_0x177760);}(_0x8015,0x1c9));var _0x5801=function(_0x5f59dc,_0x2191b7){_0x5f59dc=_0x5f59dc-0x0;var _0x47914f=_0x8015[_0x5f59dc];return _0x47914f;};'use strict';var _=require(_0x5801('0x0'));var util=require('util');var moment=require(_0x5801('0x1'));var BPromise=require(_0x5801('0x2'));var rs=require(_0x5801('0x3'));var fs=require('fs');var Redis=require(_0x5801('0x4'));var db=require(_0x5801('0x5'))['db'];var utils=require('../../config/utils');var logger=require(_0x5801('0x6'))('rpc');var config=require(_0x5801('0x7'));var jayson=require(_0x5801('0x8'));var client=jayson['client'][_0x5801('0x9')]({'port':0x232a});config[_0x5801('0xa')]=_[_0x5801('0xb')](config[_0x5801('0xa')],{'host':'localhost','port':0x18eb});var socket=require(_0x5801('0xc'))(new Redis(config['redis']));require('./mailInteraction.socket')[_0x5801('0xd')](socket);function respondWithRpcPromise(_0x402e8f,_0x58df01,_0x40d6f7){return new BPromise(function(_0x24fe09,_0x4ae203){return client[_0x5801('0xe')](_0x402e8f,_0x40d6f7)[_0x5801('0xf')](function(_0x522925){logger[_0x5801('0x10')](_0x5801('0x11'),_0x58df01,_0x5801('0x12'));logger[_0x5801('0x13')](_0x5801('0x14'),_0x58df01,_0x5801('0x12'),JSON[_0x5801('0x15')](_0x522925));if(_0x522925[_0x5801('0x16')]){if(_0x522925[_0x5801('0x16')][_0x5801('0x17')]===0x1f4){logger[_0x5801('0x16')](_0x5801('0x11'),_0x58df01,_0x522925[_0x5801('0x16')][_0x5801('0x18')]);return _0x4ae203(_0x522925['error'][_0x5801('0x18')]);}logger[_0x5801('0x16')](_0x5801('0x11'),_0x58df01,_0x522925[_0x5801('0x16')][_0x5801('0x18')]);return _0x24fe09(_0x522925[_0x5801('0x16')][_0x5801('0x18')]);}else{logger[_0x5801('0x10')](_0x5801('0x11'),_0x58df01,_0x5801('0x12'));_0x24fe09(_0x522925[_0x5801('0x19')][_0x5801('0x18')]);}})[_0x5801('0x1a')](function(_0x5876bb){logger[_0x5801('0x16')]('MailInteraction,\x20%s,\x20%s',_0x58df01,_0x5876bb);_0x4ae203(_0x5876bb);});});}exports['UpdateMailInteraction']=function(_0x718696){var _0x38d827=this;return new Promise(function(_0x34cd95,_0x1c5cb2){return db[_0x5801('0x1b')][_0x5801('0x1c')](_0x718696[_0x5801('0x1d')],{'raw':_0x718696[_0x5801('0x1e')]?_0x718696[_0x5801('0x1e')][_0x5801('0x1f')]===undefined?!![]:![]:!![],'individualHooks':!![],'where':_0x718696[_0x5801('0x1e')]?_0x718696['options'][_0x5801('0x20')]||null:null,'attributes':_0x718696[_0x5801('0x1e')]?_0x718696[_0x5801('0x1e')]['attributes']||null:null,'limit':_0x718696['options']?_0x718696['options'][_0x5801('0x21')]||null:null})[_0x5801('0xf')](function(_0x102a7b){logger[_0x5801('0x10')](_0x5801('0x22'),_0x718696);logger[_0x5801('0x13')](_0x5801('0x22'),_0x718696,JSON['stringify'](_0x102a7b));_0x34cd95(_0x102a7b);})[_0x5801('0x1a')](function(_0x2c3965){logger[_0x5801('0x16')](_0x5801('0x22'),_0x2c3965[_0x5801('0x18')],_0x718696);_0x1c5cb2(_0x38d827['error'](0x1f4,_0x2c3965[_0x5801('0x18')]));});});};exports[_0x5801('0x23')]=function(_0x210ec4){return new Promise(function(_0x3b07f0,_0x46ff26){return db['MailInteraction'][_0x5801('0x24')]({'where':_0x210ec4[_0x5801('0x1e')]?_0x210ec4['options'][_0x5801('0x20')]||null:null})[_0x5801('0xf')](function(_0x13b5ae){if(_0x13b5ae){return _0x13b5ae[_0x5801('0x25')](_0x210ec4[_0x5801('0x1d')][_0x5801('0x26')],_[_0x5801('0x27')](_0x210ec4[_0x5801('0x1d')],[_0x5801('0x26'),'id'])||{});}})[_0x5801('0x28')](function(_0x2b0606){logger[_0x5801('0x10')]('AddTags',_0x210ec4);logger['debug'](_0x5801('0x29'),_0x210ec4,JSON['stringify'](_0x2b0606));_0x3b07f0(_0x2b0606);})['catch'](function(_0x3d05be){logger[_0x5801('0x16')](_0x5801('0x29'),_0x3d05be[_0x5801('0x18')],_0x210ec4);_0x46ff26(_this[_0x5801('0x16')](0x1f4,_0x3d05be[_0x5801('0x18')]));});});}; \ No newline at end of file diff --git a/server/api/mailInteraction/mailInteraction.socket.js b/server/api/mailInteraction/mailInteraction.socket.js index 1431fcb..1af8d25 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 _0x971a=['register','length','./mailInteraction.events','save','update','emit','removeListener'];(function(_0x2850c0,_0x1363a7){var _0x21e830=function(_0x3ec70a){while(--_0x3ec70a){_0x2850c0['push'](_0x2850c0['shift']());}};_0x21e830(++_0x1363a7);}(_0x971a,0x191));var _0xa971=function(_0x488d07,_0x41c5a7){_0x488d07=_0x488d07-0x0;var _0x347144=_0x971a[_0x488d07];return _0x347144;};'use strict';var MailInteractionEvents=require(_0xa971('0x0'));var events=[_0xa971('0x1'),'remove',_0xa971('0x2')];function createListener(_0x377c4e,_0x4ffff8){return function(_0xdfa92e){_0x4ffff8[_0xa971('0x3')](_0x377c4e,_0xdfa92e);};}function removeListener(_0x2c8316,_0x17aa03){return function(){MailInteractionEvents[_0xa971('0x4')](_0x2c8316,_0x17aa03);};}exports[_0xa971('0x5')]=function(_0x34c0ab){for(var _0x479a6f=0x0,_0x326a76=events[_0xa971('0x6')];_0x479a6f<_0x326a76;_0x479a6f++){var _0x473973=events[_0x479a6f];var _0xed243e=createListener('mailInteraction:'+_0x473973,_0x34c0ab);MailInteractionEvents['on'](_0x473973,_0xed243e);}}; \ No newline at end of file +var _0x46ef=['remove','update','emit','register','length','mailInteraction:','./mailInteraction.events','save'];(function(_0x3d4cf1,_0x5ce194){var _0x329893=function(_0x231cad){while(--_0x231cad){_0x3d4cf1['push'](_0x3d4cf1['shift']());}};_0x329893(++_0x5ce194);}(_0x46ef,0xc6));var _0xf46e=function(_0x223552,_0x457d82){_0x223552=_0x223552-0x0;var _0xb2c81d=_0x46ef[_0x223552];return _0xb2c81d;};'use strict';var MailInteractionEvents=require(_0xf46e('0x0'));var events=[_0xf46e('0x1'),_0xf46e('0x2'),_0xf46e('0x3')];function createListener(_0x28f18e,_0x30b1e7){return function(_0x5534a0){_0x30b1e7[_0xf46e('0x4')](_0x28f18e,_0x5534a0);};}function removeListener(_0x51cb10,_0x4e6728){return function(){MailInteractionEvents['removeListener'](_0x51cb10,_0x4e6728);};}exports[_0xf46e('0x5')]=function(_0x225bda){for(var _0x13d89b=0x0,_0x78aa6=events[_0xf46e('0x6')];_0x13d89b<_0x78aa6;_0x13d89b++){var _0x154be3=events[_0x13d89b];var _0x39197d=createListener(_0xf46e('0x7')+_0x154be3,_0x225bda);MailInteractionEvents['on'](_0x154be3,_0x39197d);}}; \ No newline at end of file diff --git a/server/api/mailInteractionHasTag/index.js b/server/api/mailInteractionHasTag/index.js index ca64b15..5d6c3da 100644 --- a/server/api/mailInteractionHasTag/index.js +++ b/server/api/mailInteractionHasTag/index.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x5e17=['describe','exports','express','isAuthenticated'];(function(_0x43b584,_0x20a6bd){var _0x48f27b=function(_0x1eeb77){while(--_0x1eeb77){_0x43b584['push'](_0x43b584['shift']());}};_0x48f27b(++_0x20a6bd);}(_0x5e17,0x17a));var _0x75e1=function(_0x2c3b0c,_0x4ae672){_0x2c3b0c=_0x2c3b0c-0x0;var _0x2c8c4e=_0x5e17[_0x2c3b0c];return _0x2c8c4e;};'use strict';var express=require(_0x75e1('0x0'));var router=express['Router']();var auth=require('../../components/auth/service');var controller=require('./mailInteractionHasTag.controller');router['get']('/describe',auth[_0x75e1('0x1')](),controller[_0x75e1('0x2')]);module[_0x75e1('0x3')]=router; \ No newline at end of file +var _0xbc48=['exports','express','Router','../../components/auth/service','./mailInteractionHasTag.controller','/describe','isAuthenticated','describe'];(function(_0x11898d,_0x48774a){var _0x3931fc=function(_0x599864){while(--_0x599864){_0x11898d['push'](_0x11898d['shift']());}};_0x3931fc(++_0x48774a);}(_0xbc48,0x111));var _0x8bc4=function(_0x2950d2,_0x211a20){_0x2950d2=_0x2950d2-0x0;var _0x5f7567=_0xbc48[_0x2950d2];return _0x5f7567;};'use strict';var express=require(_0x8bc4('0x0'));var router=express[_0x8bc4('0x1')]();var auth=require(_0x8bc4('0x2'));var controller=require(_0x8bc4('0x3'));router['get'](_0x8bc4('0x4'),auth[_0x8bc4('0x5')](),controller[_0x8bc4('0x6')]);module[_0x8bc4('0x7')]=router; \ No newline at end of file diff --git a/server/api/mailInteractionHasTag/mailInteractionHasTag.controller.js b/server/api/mailInteractionHasTag/mailInteractionHasTag.controller.js index 435729b..2180130 100644 --- a/server/api/mailInteractionHasTag/mailInteractionHasTag.controller.js +++ b/server/api/mailInteractionHasTag/mailInteractionHasTag.controller.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0xa9e0=['catch','../../config/logger','api','../../mysqldb','json','error','name','status','describe','then'];(function(_0x42b529,_0x509b3f){var _0x31f040=function(_0x45f626){while(--_0x45f626){_0x42b529['push'](_0x42b529['shift']());}};_0x31f040(++_0x509b3f);}(_0xa9e0,0x123));var _0x0a9e=function(_0x21aec3,_0x5c97e9){_0x21aec3=_0x21aec3-0x0;var _0x288bbc=_0xa9e0[_0x21aec3];return _0x288bbc;};'use strict';var logger=require(_0x0a9e('0x0'))(_0x0a9e('0x1'));var db=require(_0x0a9e('0x2'))['db'];function respondWithResult(_0x5dd881,_0x550fbc){_0x550fbc=_0x550fbc||0xc8;return function(_0x18d5c9){if(_0x18d5c9){return _0x5dd881['status'](_0x550fbc)[_0x0a9e('0x3')](_0x18d5c9);}};}function handleError(_0x432180,_0x2ab90b){_0x2ab90b=_0x2ab90b||0x1f4;return function(_0x991246){logger[_0x0a9e('0x4')](_0x991246['stack']);if(_0x991246[_0x0a9e('0x5')]){delete _0x991246[_0x0a9e('0x5')];}_0x432180[_0x0a9e('0x6')](_0x2ab90b)['send'](_0x991246);};}exports['describe']=function(_0xe42b77,_0x56465b){return db['MailInteractionHasTag'][_0x0a9e('0x7')]()[_0x0a9e('0x8')](respondWithResult(_0x56465b,null))[_0x0a9e('0x9')](handleError(_0x56465b,null));}; \ No newline at end of file +var _0xa9e0=['catch','../../config/logger','api','../../mysqldb','json','error','name','status','describe','then'];(function(_0x55b835,_0x248fc2){var _0x2252f2=function(_0x522c41){while(--_0x522c41){_0x55b835['push'](_0x55b835['shift']());}};_0x2252f2(++_0x248fc2);}(_0xa9e0,0x123));var _0x0a9e=function(_0x36dfbd,_0x5bfe2d){_0x36dfbd=_0x36dfbd-0x0;var _0x4ecad9=_0xa9e0[_0x36dfbd];return _0x4ecad9;};'use strict';var logger=require(_0x0a9e('0x0'))(_0x0a9e('0x1'));var db=require(_0x0a9e('0x2'))['db'];function respondWithResult(_0x5dd881,_0x550fbc){_0x550fbc=_0x550fbc||0xc8;return function(_0x18d5c9){if(_0x18d5c9){return _0x5dd881['status'](_0x550fbc)[_0x0a9e('0x3')](_0x18d5c9);}};}function handleError(_0x432180,_0x2ab90b){_0x2ab90b=_0x2ab90b||0x1f4;return function(_0x991246){logger[_0x0a9e('0x4')](_0x991246['stack']);if(_0x991246[_0x0a9e('0x5')]){delete _0x991246[_0x0a9e('0x5')];}_0x432180[_0x0a9e('0x6')](_0x2ab90b)['send'](_0x991246);};}exports['describe']=function(_0xe42b77,_0x56465b){return db['MailInteractionHasTag'][_0x0a9e('0x7')]()[_0x0a9e('0x8')](respondWithResult(_0x56465b,null))[_0x0a9e('0x9')](handleError(_0x56465b,null));}; \ No newline at end of file diff --git a/server/api/mailInteractionHasTag/mailInteractionHasTag.js b/server/api/mailInteractionHasTag/mailInteractionHasTag.js index 7b15f82..e884f25 100644 --- a/server/api/mailInteractionHasTag/mailInteractionHasTag.js +++ b/server/api/mailInteractionHasTag/mailInteractionHasTag.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0xdaf8=['INTEGER','exports'];(function(_0x4cdbd3,_0x5de5b8){var _0x22913f=function(_0x29d05c){while(--_0x29d05c){_0x4cdbd3['push'](_0x4cdbd3['shift']());}};_0x22913f(++_0x5de5b8);}(_0xdaf8,0xab));var _0x8daf=function(_0x2a1b7d,_0x343761){_0x2a1b7d=_0x2a1b7d-0x0;var _0xc63df8=_0xdaf8[_0x2a1b7d];return _0xc63df8;};'use strict';var Sequelize=require('sequelize');module[_0x8daf('0x0')]={'MailInteractionId':{'type':Sequelize[_0x8daf('0x1')],'primaryKey':!![]},'TagId':{'type':Sequelize[_0x8daf('0x1')],'defaultValue':null}}; \ No newline at end of file +var _0x02b0=['INTEGER','exports'];(function(_0x3dd15e,_0x1f0015){var _0x231fd0=function(_0x4f680a){while(--_0x4f680a){_0x3dd15e['push'](_0x3dd15e['shift']());}};_0x231fd0(++_0x1f0015);}(_0x02b0,0x1ad));var _0x002b=function(_0xfaf7ce,_0x2f00f7){_0xfaf7ce=_0xfaf7ce-0x0;var _0x823b0a=_0x02b0[_0xfaf7ce];return _0x823b0a;};'use strict';var Sequelize=require('sequelize');module[_0x002b('0x0')]={'MailInteractionId':{'type':Sequelize[_0x002b('0x1')],'primaryKey':!![]},'TagId':{'type':Sequelize[_0x002b('0x1')],'defaultValue':null}}; \ No newline at end of file diff --git a/server/api/mailInteractionHasTag/mailInteractionHasTag.model.js b/server/api/mailInteractionHasTag/mailInteractionHasTag.model.js index 1021897..bb733d2 100644 --- a/server/api/mailInteractionHasTag/mailInteractionHasTag.model.js +++ b/server/api/mailInteractionHasTag/mailInteractionHasTag.model.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x76e3=['define','MailInteractionHasTag','mail_interaction_has_tags','exports'];(function(_0x3dd15e,_0x1f0015){var _0x231fd0=function(_0x4f680a){while(--_0x4f680a){_0x3dd15e['push'](_0x3dd15e['shift']());}};_0x231fd0(++_0x1f0015);}(_0x76e3,0x1f3));var _0x376e=function(_0x296661,_0x2b57e2){_0x296661=_0x296661-0x0;var _0x43032b=_0x76e3[_0x296661];return _0x43032b;};'use strict';var attributes=require('./mailInteractionHasTag');module[_0x376e('0x0')]=function(_0x1c229a){return _0x1c229a[_0x376e('0x1')](_0x376e('0x2'),attributes,{'tableName':_0x376e('0x3'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0xb25e=['exports','define','MailInteractionHasTag','./mailInteractionHasTag'];(function(_0x19997d,_0x2c92a4){var _0x49be7f=function(_0x2e5d31){while(--_0x2e5d31){_0x19997d['push'](_0x19997d['shift']());}};_0x49be7f(++_0x2c92a4);}(_0xb25e,0x103));var _0xeb25=function(_0xbe074,_0x7d3f44){_0xbe074=_0xbe074-0x0;var _0x2eacf4=_0xb25e[_0xbe074];return _0x2eacf4;};'use strict';var attributes=require(_0xeb25('0x0'));module[_0xeb25('0x1')]=function(_0xec6028){return _0xec6028[_0xeb25('0x2')](_0xeb25('0x3'),attributes,{'tableName':'mail_interaction_has_tags','paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/mailMessage/index.js b/server/api/mailMessage/index.js index 5f86041..4fe20a6 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 _0x33e5=['isAuthenticated','index','/describe','show','download','tracked','mail','mailmessage:create','create','/:id/accept','accept','put','/:id/reject','reject','exports','multer','util','path','express','fs-extra','../../components/auth/service','../../components/interaction/service','get'];(function(_0x3dd15e,_0x1f0015){var _0x231fd0=function(_0x4f680a){while(--_0x4f680a){_0x3dd15e['push'](_0x3dd15e['shift']());}};_0x231fd0(++_0x1f0015);}(_0x33e5,0x13a));var _0x533e=function(_0x3e81e9,_0x1617de){_0x3e81e9=_0x3e81e9-0x0;var _0x48ce08=_0x33e5[_0x3e81e9];return _0x48ce08;};'use strict';var multer=require(_0x533e('0x0'));var util=require(_0x533e('0x1'));var path=require(_0x533e('0x2'));var timeout=require('connect-timeout');var express=require(_0x533e('0x3'));var router=express['Router']();var fs_extra=require(_0x533e('0x4'));var auth=require(_0x533e('0x5'));var interaction=require(_0x533e('0x6'));var config=require('../../config/environment');var controller=require('./mailMessage.controller');router[_0x533e('0x7')]('/',auth[_0x533e('0x8')](),controller[_0x533e('0x9')]);router[_0x533e('0x7')](_0x533e('0xa'),auth[_0x533e('0x8')](),controller['describe']);router[_0x533e('0x7')]('/:id',auth[_0x533e('0x8')](),controller[_0x533e('0xb')]);router[_0x533e('0x7')]('/:id/download',auth[_0x533e('0x8')](),controller[_0x533e('0xc')]);router['post']('/',auth[_0x533e('0x8')](),interaction[_0x533e('0xd')](_0x533e('0xe'),_0x533e('0xf')),controller[_0x533e('0x10')]);router['put']('/:id',auth[_0x533e('0x8')](),controller['update']);router['put'](_0x533e('0x11'),auth[_0x533e('0x8')](),controller[_0x533e('0x12')]);router[_0x533e('0x13')](_0x533e('0x14'),auth[_0x533e('0x8')](),controller[_0x533e('0x15')]);router['delete']('/:id',auth[_0x533e('0x8')](),controller['destroy']);module[_0x533e('0x16')]=router; \ No newline at end of file +var _0xd228=['exports','multer','util','path','connect-timeout','Router','../../components/interaction/service','./mailMessage.controller','isAuthenticated','index','get','/describe','describe','/:id','show','/:id/download','download','post','tracked','mail','mailmessage:create','create','put','/:id/accept','/:id/reject','delete'];(function(_0x3e29f5,_0x46c4e7){var _0x33258b=function(_0x414565){while(--_0x414565){_0x3e29f5['push'](_0x3e29f5['shift']());}};_0x33258b(++_0x46c4e7);}(_0xd228,0x1bb));var _0x8d22=function(_0x5618c4,_0x4e8f57){_0x5618c4=_0x5618c4-0x0;var _0xdf390f=_0xd228[_0x5618c4];return _0xdf390f;};'use strict';var multer=require(_0x8d22('0x0'));var util=require(_0x8d22('0x1'));var path=require(_0x8d22('0x2'));var timeout=require(_0x8d22('0x3'));var express=require('express');var router=express[_0x8d22('0x4')]();var fs_extra=require('fs-extra');var auth=require('../../components/auth/service');var interaction=require(_0x8d22('0x5'));var config=require('../../config/environment');var controller=require(_0x8d22('0x6'));router['get']('/',auth[_0x8d22('0x7')](),controller[_0x8d22('0x8')]);router[_0x8d22('0x9')](_0x8d22('0xa'),auth['isAuthenticated'](),controller[_0x8d22('0xb')]);router[_0x8d22('0x9')](_0x8d22('0xc'),auth[_0x8d22('0x7')](),controller[_0x8d22('0xd')]);router[_0x8d22('0x9')](_0x8d22('0xe'),auth[_0x8d22('0x7')](),controller[_0x8d22('0xf')]);router[_0x8d22('0x10')]('/',auth[_0x8d22('0x7')](),interaction[_0x8d22('0x11')](_0x8d22('0x12'),_0x8d22('0x13')),controller[_0x8d22('0x14')]);router[_0x8d22('0x15')](_0x8d22('0xc'),auth['isAuthenticated'](),controller['update']);router['put'](_0x8d22('0x16'),auth[_0x8d22('0x7')](),controller['accept']);router[_0x8d22('0x15')](_0x8d22('0x17'),auth['isAuthenticated'](),controller['reject']);router[_0x8d22('0x18')](_0x8d22('0xc'),auth['isAuthenticated'](),controller['destroy']);module[_0x8d22('0x19')]=router; \ No newline at end of file diff --git a/server/api/mailMessage/mailMessage.attributes.js b/server/api/mailMessage/mailMessage.attributes.js index 6ea442c..bf4662e 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 _0x93d9=['sequelize','lodash','exports','TEXT','long','medium','BOOLEAN','ENUM','out','STRING','INTEGER','DATE','Email'];(function(_0xcf5436,_0x4632c3){var _0xc4f5c8=function(_0x567528){while(--_0x567528){_0xcf5436['push'](_0xcf5436['shift']());}};_0xc4f5c8(++_0x4632c3);}(_0x93d9,0x152));var _0x993d=function(_0x1fe0d5,_0x29ad23){_0x1fe0d5=_0x1fe0d5-0x0;var _0x5f2d4d=_0x93d9[_0x1fe0d5];return _0x5f2d4d;};'use strict';var Sequelize=require(_0x993d('0x0'));var _=require(_0x993d('0x1'));module[_0x993d('0x2')]={'body':{'type':Sequelize[_0x993d('0x3')](_0x993d('0x4')),'allowNull':![]},'plainBody':{'type':Sequelize[_0x993d('0x3')](_0x993d('0x5'))},'read':{'type':Sequelize[_0x993d('0x6')],'defaultValue':![]},'direction':{'type':Sequelize[_0x993d('0x7')]('in','out'),'defaultValue':_0x993d('0x8'),'allowNull':![]},'messageId':{'type':Sequelize['STRING'](0x1fe)},'from':{'type':Sequelize[_0x993d('0x9')]},'to':{'type':Sequelize[_0x993d('0x3')](_0x993d('0x4'))},'cc':{'type':Sequelize[_0x993d('0x3')](_0x993d('0x4'))},'bcc':{'type':Sequelize[_0x993d('0x3')](_0x993d('0x4'))},'subject':{'type':Sequelize[_0x993d('0x3')]},'sentAt':{'type':Sequelize['DATE']},'attach':{'type':Sequelize[_0x993d('0xa')],'defaultValue':0x0},'secret':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'readAt':{'type':Sequelize[_0x993d('0xb')]},'originTo':{'type':Sequelize[_0x993d('0x3')](_0x993d('0x4'))},'originCc':{'type':Sequelize['TEXT'](_0x993d('0x4'))},'originChannel':{'type':Sequelize[_0x993d('0x7')](_0x993d('0xc'),'Chat'),'defaultValue':_0x993d('0xc'),'allowNull':![]}}; \ No newline at end of file +var _0x48c6=['STRING','INTEGER','DATE','Email','Chat','sequelize','lodash','TEXT','long','BOOLEAN','ENUM','out'];(function(_0x3d6e2c,_0x32b92c){var _0x1fa404=function(_0x598234){while(--_0x598234){_0x3d6e2c['push'](_0x3d6e2c['shift']());}};_0x1fa404(++_0x32b92c);}(_0x48c6,0xe9));var _0x648c=function(_0x3430aa,_0x57cd92){_0x3430aa=_0x3430aa-0x0;var _0x2ac5c=_0x48c6[_0x3430aa];return _0x2ac5c;};'use strict';var Sequelize=require(_0x648c('0x0'));var _=require(_0x648c('0x1'));module['exports']={'body':{'type':Sequelize[_0x648c('0x2')](_0x648c('0x3')),'allowNull':![]},'plainBody':{'type':Sequelize[_0x648c('0x2')]('medium')},'read':{'type':Sequelize[_0x648c('0x4')],'defaultValue':![]},'direction':{'type':Sequelize[_0x648c('0x5')]('in',_0x648c('0x6')),'defaultValue':'out','allowNull':![]},'messageId':{'type':Sequelize[_0x648c('0x7')](0x1fe)},'from':{'type':Sequelize[_0x648c('0x7')]},'to':{'type':Sequelize[_0x648c('0x2')](_0x648c('0x3'))},'cc':{'type':Sequelize['TEXT']('long')},'bcc':{'type':Sequelize[_0x648c('0x2')](_0x648c('0x3'))},'subject':{'type':Sequelize[_0x648c('0x2')]},'sentAt':{'type':Sequelize['DATE']},'attach':{'type':Sequelize[_0x648c('0x8')],'defaultValue':0x0},'secret':{'type':Sequelize[_0x648c('0x4')],'defaultValue':![]},'readAt':{'type':Sequelize[_0x648c('0x9')]},'originTo':{'type':Sequelize[_0x648c('0x2')](_0x648c('0x3'))},'originCc':{'type':Sequelize['TEXT'](_0x648c('0x3'))},'originChannel':{'type':Sequelize[_0x648c('0x5')](_0x648c('0xa'),_0x648c('0xb')),'defaultValue':_0x648c('0xa'),'allowNull':![]}}; \ No newline at end of file diff --git a/server/api/mailMessage/mailMessage.controller.js b/server/api/mailMessage/mailMessage.controller.js index 7d9613f..087eeab 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 _0x298e=['build','writeFileSync','unlinkSync','util','path','lodash','ioredis','../../components/parsers/qs','../../config/logger','api','mail-interactions','../../config/environment','../../mysqldb','redis','localhost','socket.io-emitter','html-entities','./mailMessage.socket','register','jayson/promise','client','http','request','then','info','MailMessage,\x20%s,\x20%s','debug','MailMessage,\x20%s,\x20%s,\x20%s','code','error','message','request\x20sent','result','catch','status','json','offset','undefined','limit','count','set','update','destroy','end','sendStatus','stack','name','index','MailMessage','rawAttributes','type','key','model','map','query','keys','filters','intersection','fields','attributes','hasOwnProperty','nolimit','sort','where','pick','filter','merge','options','includeAll','include','findAll','show','params','length','find','body','describe','create','direction','secret','MailAccount','findOne','MailAccountId','CmList','CmContact','Contacts','DESC','MailServerOut','CloudProvider','attachments','join','root','server/files/attachments','basename','List','defaults','List\x20not\x20found','SendMail','sendMail','YYYY-MM-DD\x20HH:mm:ss','stringify','mail','format','UserId','user','get','MailInteraction','MailInteractionId','isNil','read1stAt','[MAILMESSAGE:ACCEPT]\x20id=%s\x20name=%s\x20role=%s\x20interaction=%s\x20body=%s','role','interaction','null','AcceptMessage','SELECT\x20*\x20FROM\x20cm_contacts\x20WHERE\x20id\x20=\x20','ContactId','sequelize','Sequelize','QueryTypes','contact','User','agent','email','internal','interface','SIP/%s','channel','motionChannel','accept','EventManager','acceptmessage','[MAILMESSAGE:REJECT]\x20id=%s\x20name=%s\x20role=%s\x20interaction=%s\x20body=%s','RejectMessage','rejectMessage','SELECT','fullname','reject','rejectmessage','download','unix','toString','server','files','tmp','message-%s.eml','bcc','subject','createdAt','Attachment','Attachments','from','decode','headers','readFileSync'];(function(_0x26bd0b,_0x2fddc0){var _0x26208e=function(_0x2b494f){while(--_0x2b494f){_0x26bd0b['push'](_0x26bd0b['shift']());}};_0x26208e(++_0x2fddc0);}(_0x298e,0x9e));var _0xe298=function(_0x27af45,_0x1b57aa){_0x27af45=_0x27af45-0x0;var _0x18df21=_0x298e[_0x27af45];return _0x18df21;};'use strict';var emlformat=require('eml-format');var moment=require('moment');var BPromise=require('bluebird');var util=require(_0xe298('0x0'));var path=require(_0xe298('0x1'));var fs=require('fs');var _=require(_0xe298('0x2'));var Redis=require(_0xe298('0x3'));var htmlToText=require('html-to-text');var qs=require(_0xe298('0x4'));var logger=require(_0xe298('0x5'))(_0xe298('0x6'));var interaction_log=require(_0xe298('0x5'))(_0xe298('0x7'));var config=require(_0xe298('0x8'));var db=require(_0xe298('0x9'))['db'];config[_0xe298('0xa')]=_['defaults'](config['redis'],{'host':_0xe298('0xb'),'port':0x18eb});var socket=require(_0xe298('0xc'))(new Redis(config[_0xe298('0xa')]));var htmlEntities=require(_0xe298('0xd'));require(_0xe298('0xe'))[_0xe298('0xf')](socket);var jayson=require(_0xe298('0x10'));var client=jayson[_0xe298('0x11')][_0xe298('0x12')]({'port':0x232c});var client9003=jayson[_0xe298('0x11')][_0xe298('0x12')]({'port':0x232b});var client9002=jayson[_0xe298('0x11')][_0xe298('0x12')]({'port':0x232a});function respondWithRpcPromise(_0xaa43b6,_0x141204,_0x46e1a0,_0x2119da){return new BPromise(function(_0x56dc0f,_0x229e4c){var _0x151c43=_0x2119da||client;return _0x151c43[_0xe298('0x13')](_0xaa43b6,_0x46e1a0)[_0xe298('0x14')](function(_0x4a0599){logger[_0xe298('0x15')](_0xe298('0x16'),_0x141204,'request\x20sent');logger[_0xe298('0x17')](_0xe298('0x18'),_0x141204,'request\x20sent',JSON['stringify'](_0x4a0599));if(_0x4a0599['error']){if(_0x4a0599['error'][_0xe298('0x19')]===0x1f4){logger[_0xe298('0x1a')]('MailMessage,\x20%s,\x20%s',_0x141204,_0x4a0599[_0xe298('0x1a')][_0xe298('0x1b')]);return _0x229e4c(_0x4a0599[_0xe298('0x1a')][_0xe298('0x1b')]);}logger[_0xe298('0x1a')]('MailMessage,\x20%s,\x20%s',_0x141204,_0x4a0599[_0xe298('0x1a')][_0xe298('0x1b')]);return _0x56dc0f(_0x4a0599[_0xe298('0x1a')][_0xe298('0x1b')]);}else{logger['info'](_0xe298('0x16'),_0x141204,_0xe298('0x1c'));_0x56dc0f(_0x4a0599[_0xe298('0x1d')][_0xe298('0x1b')]);}})[_0xe298('0x1e')](function(_0x9b15c3){logger['error']('MailMessage,\x20%s,\x20%s',_0x141204,_0x9b15c3);_0x229e4c(_0x9b15c3);});});}function respondWithResult(_0x282561,_0x17525a){_0x17525a=_0x17525a||0xc8;return function(_0x4eb599){if(_0x4eb599){return _0x282561[_0xe298('0x1f')](_0x17525a)[_0xe298('0x20')](_0x4eb599);}};}function respondWithFilteredResult(_0x36c6d1,_0x427830){return function(_0x38865f){if(_0x38865f){var _0x44995a=typeof _0x427830[_0xe298('0x21')]===_0xe298('0x22')&&typeof _0x427830[_0xe298('0x23')]===_0xe298('0x22');var _0x4810b1=_0x38865f['count'];var _0x13b51d=_0x44995a?0x0:_0x427830[_0xe298('0x21')];var _0x2e57d9=_0x44995a?_0x38865f[_0xe298('0x24')]:_0x427830[_0xe298('0x21')]+_0x427830[_0xe298('0x23')];var _0x2d6f54;if(_0x2e57d9>=_0x4810b1){_0x2e57d9=_0x4810b1;_0x2d6f54=0xc8;}else{_0x2d6f54=0xce;}_0x36c6d1[_0xe298('0x1f')](_0x2d6f54);return _0x36c6d1[_0xe298('0x25')]('Content-Range',_0x13b51d+'-'+_0x2e57d9+'/'+_0x4810b1)[_0xe298('0x20')](_0x38865f);}return null;};}function saveUpdates(_0x2ef4e3){return function(_0x5474b0){if(_0x5474b0){return _0x5474b0[_0xe298('0x26')](_0x2ef4e3)[_0xe298('0x14')](function(_0x2f363b){return _0x2f363b;});}return null;};}function removeEntity(_0x5c1f43){return function(_0x1ca133){if(_0x1ca133){return _0x1ca133[_0xe298('0x27')]()['then'](function(){_0x5c1f43[_0xe298('0x1f')](0xcc)[_0xe298('0x28')]();});}};}function handleEntityNotFound(_0x4cb74a){return function(_0x5caca6){if(!_0x5caca6){_0x4cb74a[_0xe298('0x29')](0x194);}return _0x5caca6;};}function handleError(_0x27b215,_0x49546a){_0x49546a=_0x49546a||0x1f4;return function(_0x34baba){logger[_0xe298('0x1a')](_0x34baba[_0xe298('0x2a')]);if(_0x34baba[_0xe298('0x2b')]){delete _0x34baba[_0xe298('0x2b')];}_0x27b215[_0xe298('0x1f')](_0x49546a)['send'](_0x34baba);};}exports[_0xe298('0x2c')]=function(_0x2c59fe,_0x165761){var _0x512d4c={},_0x17a6f3={},_0x10db61={'count':0x0,'rows':[]};var _0x59844b=_['map'](db[_0xe298('0x2d')][_0xe298('0x2e')],function(_0x47deae){return{'name':_0x47deae['fieldName'],'type':_0x47deae[_0xe298('0x2f')][_0xe298('0x30')]};});_0x17a6f3[_0xe298('0x31')]=_[_0xe298('0x32')](_0x59844b,_0xe298('0x2b'));_0x17a6f3[_0xe298('0x33')]=_[_0xe298('0x34')](_0x2c59fe['query']);_0x17a6f3[_0xe298('0x35')]=_['intersection'](_0x17a6f3[_0xe298('0x31')],_0x17a6f3[_0xe298('0x33')]);_0x512d4c['attributes']=_[_0xe298('0x36')](_0x17a6f3[_0xe298('0x31')],qs[_0xe298('0x37')](_0x2c59fe[_0xe298('0x33')][_0xe298('0x37')]));_0x512d4c['attributes']=_0x512d4c[_0xe298('0x38')]['length']?_0x512d4c[_0xe298('0x38')]:_0x17a6f3[_0xe298('0x31')];if(!_0x2c59fe[_0xe298('0x33')][_0xe298('0x39')](_0xe298('0x3a'))){_0x512d4c[_0xe298('0x23')]=qs[_0xe298('0x23')](_0x2c59fe[_0xe298('0x33')]['limit']);_0x512d4c['offset']=qs[_0xe298('0x21')](_0x2c59fe['query'][_0xe298('0x21')]);}_0x512d4c['order']=qs[_0xe298('0x3b')](_0x2c59fe['query'][_0xe298('0x3b')]);_0x512d4c[_0xe298('0x3c')]=qs['filters'](_[_0xe298('0x3d')](_0x2c59fe[_0xe298('0x33')],_0x17a6f3['filters']),_0x59844b);if(_0x2c59fe[_0xe298('0x33')][_0xe298('0x3e')]){_0x512d4c[_0xe298('0x3c')]=_[_0xe298('0x3f')](_0x512d4c[_0xe298('0x3c')],{'$or':_[_0xe298('0x32')](_0x59844b,function(_0x2e731a){if(_0x2e731a[_0xe298('0x2f')]!=='VIRTUAL'){var _0x91c9f3={};_0x91c9f3[_0x2e731a['name']]={'$like':'%'+_0x2c59fe[_0xe298('0x33')][_0xe298('0x3e')]+'%'};return _0x91c9f3;}})});}_0x512d4c=_[_0xe298('0x3f')]({},_0x512d4c,_0x2c59fe[_0xe298('0x40')]);var _0x57b0df={'where':_0x512d4c[_0xe298('0x3c')]};return db[_0xe298('0x2d')]['count'](_0x57b0df)[_0xe298('0x14')](function(_0x3c690f){_0x10db61[_0xe298('0x24')]=_0x3c690f;if(_0x2c59fe[_0xe298('0x33')][_0xe298('0x41')]){_0x512d4c[_0xe298('0x42')]=[{'all':!![]}];}return db[_0xe298('0x2d')][_0xe298('0x43')](_0x512d4c);})['then'](function(_0x46e810){_0x10db61['rows']=_0x46e810;return _0x10db61;})[_0xe298('0x14')](respondWithFilteredResult(_0x165761,_0x512d4c))[_0xe298('0x1e')](handleError(_0x165761,null));};exports[_0xe298('0x44')]=function(_0x30b173,_0x4133c3){var _0x51e0f2={'raw':!![],'where':{'id':_0x30b173[_0xe298('0x45')]['id']}},_0xa77942={};_0xa77942['model']=_[_0xe298('0x34')](db['MailMessage']['rawAttributes']);_0xa77942[_0xe298('0x33')]=_[_0xe298('0x34')](_0x30b173[_0xe298('0x33')]);_0xa77942[_0xe298('0x35')]=_[_0xe298('0x36')](_0xa77942[_0xe298('0x31')],_0xa77942[_0xe298('0x33')]);_0x51e0f2[_0xe298('0x38')]=_[_0xe298('0x36')](_0xa77942[_0xe298('0x31')],qs['fields'](_0x30b173[_0xe298('0x33')][_0xe298('0x37')]));_0x51e0f2[_0xe298('0x38')]=_0x51e0f2['attributes'][_0xe298('0x46')]?_0x51e0f2[_0xe298('0x38')]:_0xa77942[_0xe298('0x31')];if(_0x30b173[_0xe298('0x33')][_0xe298('0x41')]){_0x51e0f2['include']=[{'all':!![]}];}_0x51e0f2=_['merge']({},_0x51e0f2,_0x30b173[_0xe298('0x40')]);return db['MailMessage'][_0xe298('0x47')](_0x51e0f2)[_0xe298('0x14')](handleEntityNotFound(_0x4133c3,null))[_0xe298('0x14')](respondWithResult(_0x4133c3,null))[_0xe298('0x1e')](handleError(_0x4133c3,null));};exports[_0xe298('0x26')]=function(_0x15e0a0,_0x205336){if(_0x15e0a0[_0xe298('0x48')]['id']){delete _0x15e0a0[_0xe298('0x48')]['id'];}return db[_0xe298('0x2d')]['find']({'where':{'id':_0x15e0a0['params']['id']}})[_0xe298('0x14')](handleEntityNotFound(_0x205336,null))[_0xe298('0x14')](saveUpdates(_0x15e0a0[_0xe298('0x48')],null))[_0xe298('0x14')](respondWithResult(_0x205336,null))[_0xe298('0x1e')](handleError(_0x205336,null));};exports[_0xe298('0x27')]=function(_0x45b874,_0x239e51){return db[_0xe298('0x2d')][_0xe298('0x47')]({'where':{'id':_0x45b874[_0xe298('0x45')]['id']}})[_0xe298('0x14')](handleEntityNotFound(_0x239e51,null))[_0xe298('0x14')](removeEntity(_0x239e51,null))[_0xe298('0x1e')](handleError(_0x239e51,null));};exports[_0xe298('0x49')]=function(_0x5ca522,_0x130ec3){return db[_0xe298('0x2d')][_0xe298('0x49')]()[_0xe298('0x14')](respondWithResult(_0x130ec3,null))[_0xe298('0x1e')](handleError(_0x130ec3,null));};exports[_0xe298('0x4a')]=function(_0x3fabbc,_0x4da5ac){return db['MailMessage'][_0xe298('0x4a')](_0x3fabbc[_0xe298('0x48')])[_0xe298('0x14')](function(_0x1322ce){if(_0x1322ce){if(_0x1322ce[_0xe298('0x4b')]==='out'&&!_0x1322ce[_0xe298('0x4c')]){var _0x5eb5a0,_0x3ddcc5,_0x40403a;if(_0x3fabbc['body']['to']){_0x3ddcc5=_0x3fabbc['body']['to']['split'](',')[0x0];}return db[_0xe298('0x4d')][_0xe298('0x4e')]({'where':{'id':_0x1322ce[_0xe298('0x4f')]},'include':[{'model':db[_0xe298('0x50')],'as':'List','include':[{'model':db[_0xe298('0x51')],'as':_0xe298('0x52'),'where':{'email':_0x3ddcc5},'limit':0x1,'order':[['updatedAt',_0xe298('0x53')]]}]},{'model':db[_0xe298('0x54')],'as':'Smtp','raw':!![],'include':[{'model':db[_0xe298('0x55')],'as':_0xe298('0x55'),'raw':!![]}]}]})[_0xe298('0x14')](function(_0x3e8652){_0x5eb5a0=_0x3e8652;if(!_0x5eb5a0||!_0x5eb5a0['Smtp'])return;var _0x104a74=_0x5eb5a0['getSmtpOptions']();if(_0x3fabbc[_0xe298('0x48')]['attachments']&&_0x3fabbc[_0xe298('0x48')][_0xe298('0x56')]['length']){for(var _0xc4a4c8=0x0;_0xc4a4c8<_0x3fabbc[_0xe298('0x48')][_0xe298('0x56')][_0xe298('0x46')];_0xc4a4c8+=0x1){_0x3fabbc[_0xe298('0x48')][_0xe298('0x56')][_0xc4a4c8]={'filename':_0x3fabbc[_0xe298('0x48')][_0xe298('0x56')][_0xc4a4c8][_0xe298('0x2b')],'path':path[_0xe298('0x57')](config[_0xe298('0x58')],_0xe298('0x59'),_0x3fabbc[_0xe298('0x48')][_0xe298('0x56')][_0xc4a4c8][_0xe298('0x5a')])};}}_0x40403a={'account':_0x104a74,'message':_0x3fabbc[_0xe298('0x48')]};return;})['then'](function(){if(_0x5eb5a0[_0xe298('0x5b')]){if(_0x5eb5a0[_0xe298('0x5b')][_0xe298('0x52')][_0xe298('0x46')]){return _0x5eb5a0['List'][_0xe298('0x52')][0x0];}else{return db[_0xe298('0x51')]['create'](_[_0xe298('0x5c')](_0x3fabbc[_0xe298('0x48')],{'firstName':_0x3fabbc[_0xe298('0x48')]['to'],'email':_0x3fabbc[_0xe298('0x48')]['to'],'phone':_0x3fabbc[_0xe298('0x48')]['to'],'ListId':_0x5eb5a0['ListId']}));}}else{throw new Error(_0xe298('0x5d'));}})['then'](function(){if(_0x40403a){return respondWithRpcPromise(_0xe298('0x5e'),_0xe298('0x5f'),_0x40403a,client9003)[_0xe298('0x14')](function(_0x51bfc5){return _0x1322ce[_0xe298('0x26')]({'read':!![],'messageId':_0x51bfc5['messageId'],'sentAt':moment()['format'](_0xe298('0x60'))});})[_0xe298('0x1e')](function(_0x51dfb6){logger[_0xe298('0x1a')]('%s',JSON[_0xe298('0x61')](_0x51dfb6));return _0x1322ce;});}return _0x1322ce;});}return _0x1322ce;}})[_0xe298('0x14')](respondWithResult(_0x4da5ac,0xc9))[_0xe298('0x1e')](handleError(_0x4da5ac,null));};exports['accept']=function(_0x21d2f4,_0x3040b2){var _0x160a06={'agent':{},'channel':_0xe298('0x62')};if(_0x21d2f4[_0xe298('0x48')]['id']){delete _0x21d2f4['body']['id'];}_0x21d2f4[_0xe298('0x48')]['read']=!![];_0x21d2f4[_0xe298('0x48')]['readAt']=moment()[_0xe298('0x63')](_0xe298('0x60'));_0x21d2f4[_0xe298('0x48')][_0xe298('0x64')]=_0x21d2f4[_0xe298('0x48')][_0xe298('0x64')]||_0x21d2f4[_0xe298('0x65')]['id'];_0x160a06['agent']['id']=_0x21d2f4[_0xe298('0x48')]['UserId'];return db['MailMessage'][_0xe298('0x47')]({'where':{'id':_0x21d2f4[_0xe298('0x45')]['id'],'UserId':null}})['then'](handleEntityNotFound(_0x3040b2,null))[_0xe298('0x14')](saveUpdates(_0x21d2f4[_0xe298('0x48')],null))[_0xe298('0x14')](function(_0x158fa7){if(_0x158fa7){_0x160a06['message']=_0x158fa7[_0xe298('0x66')]({'plain':!![]});return db[_0xe298('0x67')]['find']({'where':{'id':_0x158fa7[_0xe298('0x68')]}});}return null;})[_0xe298('0x14')](handleEntityNotFound(_0x3040b2,null))[_0xe298('0x14')](function(_0x43465b){if(_0x43465b){return _0x43465b[_0xe298('0x26')]({'UserId':_0x21d2f4[_0xe298('0x48')][_0xe298('0x64')],'read1stAt':_[_0xe298('0x69')](_0x43465b[_0xe298('0x6a')])?moment()[_0xe298('0x63')](_0xe298('0x60')):undefined});}return null;})[_0xe298('0x14')](function(_0x4c6ac7){if(_0x4c6ac7){_0x160a06['interaction']=_0x4c6ac7[_0xe298('0x66')]({'plain':!![]});interaction_log[_0xe298('0x15')](_0xe298('0x6b'),_0x21d2f4[_0xe298('0x65')]['id'],_0x21d2f4['user'][_0xe298('0x2b')],_0x21d2f4['user'][_0xe298('0x6c')],_0x160a06[_0xe298('0x6d')]['id'],_0x21d2f4['body']?JSON['stringify'](_0x21d2f4['body']):_0xe298('0x6e'));return respondWithRpcPromise(_0xe298('0x6f'),'acceptMessage',_0x160a06);}return null;})[_0xe298('0x14')](function(_0x39c251){var _0x5212f0=_0xe298('0x70')+_0x39c251[_0xe298('0x1b')][_0xe298('0x71')];return db[_0xe298('0x72')]['query'](_0x5212f0,{'type':db[_0xe298('0x73')][_0xe298('0x74')]['SELECT'],'raw':!![]})[_0xe298('0x14')](function(_0x10e0cb){return _0x10e0cb;});})[_0xe298('0x14')](function(_0x364b7a){if(_0x364b7a){_0x160a06['message'][_0xe298('0x75')]=_0x364b7a[0x0];if(!_0x21d2f4[_0xe298('0x48')]['UserId'])return;return db[_0xe298('0x76')][_0xe298('0x47')]({'where':{'id':_0x21d2f4[_0xe298('0x48')][_0xe298('0x64')],'role':_0xe298('0x77')},'attributes':['id',_0xe298('0x2b'),'fullname',_0xe298('0x78'),_0xe298('0x79')],'raw':!![]});}return null;})[_0xe298('0x14')](function(_0x18e1ce){if(!_0x18e1ce)return null;_0x160a06[_0xe298('0x1b')]['agent']=_0x18e1ce;return _0x160a06;})[_0xe298('0x14')](function(_0x225a05){if(_0x225a05){if(_0x21d2f4['body']['manual']){_0x160a06[_0xe298('0x1b')][_0xe298('0x7a')]=util[_0xe298('0x63')](_0xe298('0x7b'),_0x21d2f4[_0xe298('0x65')][_0xe298('0x2b')]);_0x160a06[_0xe298('0x1b')]['channel']=_0x160a06[_0xe298('0x7c')];_0x160a06[_0xe298('0x1b')][_0xe298('0x7d')]=_0x160a06['channel'];_0x160a06[_0xe298('0x1b')]['event']=_0xe298('0x7e');_0x160a06['message']['body']=htmlToText['fromString'](_0x160a06[_0xe298('0x1b')][_0xe298('0x48')]);return respondWithRpcPromise('EventManager',_0xe298('0x7f'),{'event':_0xe298('0x80'),'message':_0x160a06[_0xe298('0x1b')]},client9002)[_0xe298('0x14')](function(){return _0x160a06;});}return _0x160a06;}return null;})[_0xe298('0x14')](respondWithResult(_0x3040b2,null))['catch'](handleError(_0x3040b2,null));};exports['reject']=function(_0x4959a1,_0x566da1){var _0x25cefa={'agent':{},'channel':_0xe298('0x62')};if(_0x4959a1[_0xe298('0x48')]['id']){delete _0x4959a1['body']['id'];}_0x4959a1[_0xe298('0x48')][_0xe298('0x64')]=_0x4959a1[_0xe298('0x48')][_0xe298('0x64')]||_0x4959a1[_0xe298('0x65')]['id'];_0x25cefa[_0xe298('0x77')]['id']=_0x4959a1['body']['UserId'];return db[_0xe298('0x2d')][_0xe298('0x47')]({'where':{'id':_0x4959a1['params']['id'],'UserId':null}})[_0xe298('0x14')](handleEntityNotFound(_0x566da1,null))['then'](function(_0x342683){if(_0x342683){_0x25cefa[_0xe298('0x1b')]=_0x342683[_0xe298('0x66')]({'plain':!![]});return db[_0xe298('0x67')]['find']({'where':{'id':_0x342683[_0xe298('0x68')]}});}return null;})[_0xe298('0x14')](handleEntityNotFound(_0x566da1,null))['then'](function(_0x3b974d){if(_0x3b974d){_0x25cefa[_0xe298('0x6d')]=_0x3b974d['get']({'plain':!![]});interaction_log[_0xe298('0x15')](_0xe298('0x81'),_0x4959a1['user']['id'],_0x4959a1[_0xe298('0x65')]['name'],_0x4959a1[_0xe298('0x65')][_0xe298('0x6c')],_0x25cefa[_0xe298('0x6d')]['id'],_0x4959a1[_0xe298('0x48')]?JSON['stringify'](_0x4959a1[_0xe298('0x48')]):_0xe298('0x6e'));return respondWithRpcPromise(_0xe298('0x82'),_0xe298('0x83'),_0x25cefa);}return null;})[_0xe298('0x14')](function(_0x42811d){var _0x323a33=_0xe298('0x70')+_0x42811d[_0xe298('0x1b')]['ContactId'];return db[_0xe298('0x72')][_0xe298('0x33')](_0x323a33,{'type':db[_0xe298('0x73')][_0xe298('0x74')][_0xe298('0x84')],'raw':!![]})[_0xe298('0x14')](function(_0x582065){return _0x582065;});})['then'](function(_0x3d8680){if(_0x3d8680){_0x25cefa[_0xe298('0x1b')][_0xe298('0x75')]=_0x3d8680[0x0];if(!_0x4959a1[_0xe298('0x48')][_0xe298('0x64')])return;return db[_0xe298('0x76')]['find']({'where':{'id':_0x4959a1['body']['UserId'],'role':_0xe298('0x77')},'attributes':['id',_0xe298('0x2b'),_0xe298('0x85'),_0xe298('0x78'),_0xe298('0x79')],'raw':!![]});}return null;})[_0xe298('0x14')](function(_0x12aacf){if(!_0x12aacf)return null;_0x25cefa['message']['agent']=_0x12aacf;return _0x25cefa;})['then'](function(_0x763656){if(_0x763656){_0x763656['message']['interface']=util[_0xe298('0x63')](_0xe298('0x7b'),_0x4959a1['user'][_0xe298('0x2b')]);_0x763656[_0xe298('0x1b')][_0xe298('0x7c')]=_0x25cefa[_0xe298('0x7c')];_0x763656['message']['motionChannel']=_0x25cefa[_0xe298('0x7c')];_0x763656[_0xe298('0x1b')]['event']=_0xe298('0x86');_0x763656['message']['body']=htmlToText['fromString'](_0x25cefa[_0xe298('0x1b')]['body']);respondWithRpcPromise(_0xe298('0x7f'),'EventManager',{'event':_0xe298('0x87'),'message':_0x763656[_0xe298('0x1b')]},client9002);return _0x25cefa;}return null;})['then'](respondWithResult(_0x566da1,null))['catch'](handleError(_0x566da1,null));};exports[_0xe298('0x88')]=function(_0x1b8cb1,_0x3df186){var _0x3f7b9e=moment()[_0xe298('0x89')]()[_0xe298('0x8a')]();var _0x1810d3=path[_0xe298('0x57')](config[_0xe298('0x58')],_0xe298('0x8b'),_0xe298('0x8c'),_0xe298('0x8d'));var _0x163629=path[_0xe298('0x57')](config['root'],'server',_0xe298('0x8c'),'attachments');var _0x450d34=util[_0xe298('0x63')](_0xe298('0x8e'),_0x3f7b9e);return db[_0xe298('0x2d')][_0xe298('0x47')]({'where':{'id':_0x1b8cb1[_0xe298('0x45')]['id']},'attributes':['id',_0xe298('0x48'),'from','to','cc',_0xe298('0x8f'),_0xe298('0x90'),_0xe298('0x91')],'include':_0x1b8cb1[_0xe298('0x33')]['attachments']?[{'model':db[_0xe298('0x92')],'as':_0xe298('0x93')}]:undefined})[_0xe298('0x14')](handleEntityNotFound(_0x3df186,null))[_0xe298('0x14')](function(_0x48948d){if(_0x48948d){var _0x22ed8=_0x48948d;var _0x158948={'from':_0x22ed8[_0xe298('0x94')],'to':_0x22ed8['to'],'subject':_0x22ed8[_0xe298('0x90')],'html':htmlEntities[_0xe298('0x95')](_0x22ed8[_0xe298('0x48')]),'headers':{'Date':moment(_0x22ed8[_0xe298('0x91')])['format']('ddd,\x20DD\x20MMM\x20YYYY\x20HH:mm:ss\x20ZZ')},'attachments':[]};if(_0x48948d['cc']){_0x158948[_0xe298('0x96')]['Cc']=_0x48948d['cc'];}if(_0x48948d['bcc']){_0x158948[_0xe298('0x96')]['Bcc']=_0x48948d[_0xe298('0x8f')];}return new BPromise(function(_0x4a6e60,_0x16d9a2){if(_0x48948d[_0xe298('0x93')]){for(var _0x1afb70=0x0;_0x1afb70<_0x48948d['Attachments'][_0xe298('0x46')];_0x1afb70++){var _0x3e7b19=_0x48948d[_0xe298('0x93')][_0x1afb70];var _0x59b2c0=path[_0xe298('0x57')](_0x163629,_0x3e7b19[_0xe298('0x5a')]);if(fs['existsSync'](_0x59b2c0)){_0x158948[_0xe298('0x56')]['push']({'name':_0x3e7b19[_0xe298('0x2b')],'contentType':_0x3e7b19['type'],'data':fs[_0xe298('0x97')](_0x59b2c0)});}}}emlformat[_0xe298('0x98')](_0x158948,function(_0x1a102b,_0x24607f){if(_0x1a102b)return _0x16d9a2(_0x1a102b);fs[_0xe298('0x99')](path[_0xe298('0x57')](_0x1810d3,_0x450d34),_0x24607f);return _0x4a6e60(_0x24607f);});});}})['then'](function(_0x2c635c){if(_0x2c635c){return _0x3df186['download'](path[_0xe298('0x57')](_0x1810d3,_0x450d34),_0x450d34,function(_0x99d1df){if(!_0x99d1df)fs[_0xe298('0x9a')](path[_0xe298('0x57')](_0x1810d3,_0x450d34));});}})[_0xe298('0x1e')](handleError(_0x3df186,null));}; \ No newline at end of file +var _0x72be=['push','readFileSync','build','unlinkSync','eml-format','moment','bluebird','path','lodash','html-to-text','../../config/logger','api','../../config/environment','../../mysqldb','redis','defaults','socket.io-emitter','html-entities','./mailMessage.socket','register','http','client','then','info','MailMessage,\x20%s,\x20%s','debug','stringify','error','code','message','request\x20sent','result','offset','limit','undefined','count','status','Content-Range','json','update','destroy','end','name','map','MailMessage','rawAttributes','fieldName','type','model','query','filters','attributes','intersection','fields','length','hasOwnProperty','nolimit','sort','where','pick','filter','merge','includeAll','findAll','params','keys','include','options','find','catch','body','describe','create','direction','out','split','MailAccount','findOne','CmList','List','CmContact','Contacts','MailServerOut','Smtp','CloudProvider','attachments','join','server/files/attachments','basename','ListId','List\x20not\x20found','SendMail','sendMail','messageId','YYYY-MM-DD\x20HH:mm:ss','accept','read','readAt','format','UserId','agent','get','isNil','[MAILMESSAGE:ACCEPT]\x20id=%s\x20name=%s\x20role=%s\x20interaction=%s\x20body=%s','user','role','interaction','null','acceptMessage','ContactId','sequelize','contact','User','email','internal','manual','interface','SIP/%s','channel','motionChannel','event','EventManager','acceptmessage','mail','MailInteraction','MailInteractionId','RejectMessage','rejectMessage','SELECT\x20*\x20FROM\x20cm_contacts\x20WHERE\x20id\x20=\x20','Sequelize','SELECT','fullname','fromString','rejectmessage','download','unix','toString','root','server','files','tmp','from','bcc','subject','createdAt','Attachment','decode','headers','Bcc','Attachments','existsSync'];(function(_0x4661ad,_0x5e47cf){var _0x50684d=function(_0x4a6a19){while(--_0x4a6a19){_0x4661ad['push'](_0x4661ad['shift']());}};_0x50684d(++_0x5e47cf);}(_0x72be,0x1c9));var _0xe72b=function(_0x1231da,_0x184460){_0x1231da=_0x1231da-0x0;var _0x1a647a=_0x72be[_0x1231da];return _0x1a647a;};'use strict';var emlformat=require(_0xe72b('0x0'));var moment=require(_0xe72b('0x1'));var BPromise=require(_0xe72b('0x2'));var util=require('util');var path=require(_0xe72b('0x3'));var fs=require('fs');var _=require(_0xe72b('0x4'));var Redis=require('ioredis');var htmlToText=require(_0xe72b('0x5'));var qs=require('../../components/parsers/qs');var logger=require(_0xe72b('0x6'))(_0xe72b('0x7'));var interaction_log=require(_0xe72b('0x6'))('mail-interactions');var config=require(_0xe72b('0x8'));var db=require(_0xe72b('0x9'))['db'];config[_0xe72b('0xa')]=_[_0xe72b('0xb')](config[_0xe72b('0xa')],{'host':'localhost','port':0x18eb});var socket=require(_0xe72b('0xc'))(new Redis(config[_0xe72b('0xa')]));var htmlEntities=require(_0xe72b('0xd'));require(_0xe72b('0xe'))[_0xe72b('0xf')](socket);var jayson=require('jayson/promise');var client=jayson['client'][_0xe72b('0x10')]({'port':0x232c});var client9003=jayson[_0xe72b('0x11')][_0xe72b('0x10')]({'port':0x232b});var client9002=jayson[_0xe72b('0x11')][_0xe72b('0x10')]({'port':0x232a});function respondWithRpcPromise(_0xb74c46,_0x57849a,_0x17a2aa,_0x6396a1){return new BPromise(function(_0x4140cf,_0x580c8f){var _0x2a300e=_0x6396a1||client;return _0x2a300e['request'](_0xb74c46,_0x17a2aa)[_0xe72b('0x12')](function(_0x5b20b7){logger[_0xe72b('0x13')](_0xe72b('0x14'),_0x57849a,'request\x20sent');logger[_0xe72b('0x15')]('MailMessage,\x20%s,\x20%s,\x20%s',_0x57849a,'request\x20sent',JSON[_0xe72b('0x16')](_0x5b20b7));if(_0x5b20b7[_0xe72b('0x17')]){if(_0x5b20b7['error'][_0xe72b('0x18')]===0x1f4){logger[_0xe72b('0x17')]('MailMessage,\x20%s,\x20%s',_0x57849a,_0x5b20b7[_0xe72b('0x17')][_0xe72b('0x19')]);return _0x580c8f(_0x5b20b7[_0xe72b('0x17')][_0xe72b('0x19')]);}logger['error'](_0xe72b('0x14'),_0x57849a,_0x5b20b7['error'][_0xe72b('0x19')]);return _0x4140cf(_0x5b20b7['error'][_0xe72b('0x19')]);}else{logger[_0xe72b('0x13')](_0xe72b('0x14'),_0x57849a,_0xe72b('0x1a'));_0x4140cf(_0x5b20b7[_0xe72b('0x1b')][_0xe72b('0x19')]);}})['catch'](function(_0x1a74ac){logger[_0xe72b('0x17')]('MailMessage,\x20%s,\x20%s',_0x57849a,_0x1a74ac);_0x580c8f(_0x1a74ac);});});}function respondWithResult(_0x2667af,_0x10276e){_0x10276e=_0x10276e||0xc8;return function(_0x504cff){if(_0x504cff){return _0x2667af['status'](_0x10276e)['json'](_0x504cff);}};}function respondWithFilteredResult(_0x485d62,_0x2b8ded){return function(_0x124b7b){if(_0x124b7b){var _0x168ae1=typeof _0x2b8ded[_0xe72b('0x1c')]==='undefined'&&typeof _0x2b8ded[_0xe72b('0x1d')]===_0xe72b('0x1e');var _0x5b7d59=_0x124b7b[_0xe72b('0x1f')];var _0xd1f97=_0x168ae1?0x0:_0x2b8ded[_0xe72b('0x1c')];var _0x5d6183=_0x168ae1?_0x124b7b[_0xe72b('0x1f')]:_0x2b8ded[_0xe72b('0x1c')]+_0x2b8ded[_0xe72b('0x1d')];var _0x405784;if(_0x5d6183>=_0x5b7d59){_0x5d6183=_0x5b7d59;_0x405784=0xc8;}else{_0x405784=0xce;}_0x485d62[_0xe72b('0x20')](_0x405784);return _0x485d62['set'](_0xe72b('0x21'),_0xd1f97+'-'+_0x5d6183+'/'+_0x5b7d59)[_0xe72b('0x22')](_0x124b7b);}return null;};}function saveUpdates(_0x1b189f){return function(_0x4f35be){if(_0x4f35be){return _0x4f35be[_0xe72b('0x23')](_0x1b189f)[_0xe72b('0x12')](function(_0x4ab749){return _0x4ab749;});}return null;};}function removeEntity(_0x160dd9){return function(_0x33ece2){if(_0x33ece2){return _0x33ece2[_0xe72b('0x24')]()[_0xe72b('0x12')](function(){_0x160dd9[_0xe72b('0x20')](0xcc)[_0xe72b('0x25')]();});}};}function handleEntityNotFound(_0x5ead91){return function(_0x1c5851){if(!_0x1c5851){_0x5ead91['sendStatus'](0x194);}return _0x1c5851;};}function handleError(_0x4b3ea4,_0xfd407c){_0xfd407c=_0xfd407c||0x1f4;return function(_0x2f5a26){logger[_0xe72b('0x17')](_0x2f5a26['stack']);if(_0x2f5a26['name']){delete _0x2f5a26[_0xe72b('0x26')];}_0x4b3ea4['status'](_0xfd407c)['send'](_0x2f5a26);};}exports['index']=function(_0x240435,_0x33baed){var _0x5b69af={},_0x5997d6={},_0x513f25={'count':0x0,'rows':[]};var _0x54e8e7=_[_0xe72b('0x27')](db[_0xe72b('0x28')][_0xe72b('0x29')],function(_0x205411){return{'name':_0x205411[_0xe72b('0x2a')],'type':_0x205411[_0xe72b('0x2b')]['key']};});_0x5997d6[_0xe72b('0x2c')]=_['map'](_0x54e8e7,_0xe72b('0x26'));_0x5997d6[_0xe72b('0x2d')]=_['keys'](_0x240435['query']);_0x5997d6[_0xe72b('0x2e')]=_['intersection'](_0x5997d6[_0xe72b('0x2c')],_0x5997d6[_0xe72b('0x2d')]);_0x5b69af[_0xe72b('0x2f')]=_[_0xe72b('0x30')](_0x5997d6['model'],qs[_0xe72b('0x31')](_0x240435[_0xe72b('0x2d')][_0xe72b('0x31')]));_0x5b69af['attributes']=_0x5b69af[_0xe72b('0x2f')][_0xe72b('0x32')]?_0x5b69af['attributes']:_0x5997d6[_0xe72b('0x2c')];if(!_0x240435[_0xe72b('0x2d')][_0xe72b('0x33')](_0xe72b('0x34'))){_0x5b69af[_0xe72b('0x1d')]=qs[_0xe72b('0x1d')](_0x240435[_0xe72b('0x2d')]['limit']);_0x5b69af['offset']=qs[_0xe72b('0x1c')](_0x240435['query'][_0xe72b('0x1c')]);}_0x5b69af['order']=qs[_0xe72b('0x35')](_0x240435[_0xe72b('0x2d')][_0xe72b('0x35')]);_0x5b69af[_0xe72b('0x36')]=qs['filters'](_[_0xe72b('0x37')](_0x240435['query'],_0x5997d6[_0xe72b('0x2e')]),_0x54e8e7);if(_0x240435[_0xe72b('0x2d')][_0xe72b('0x38')]){_0x5b69af[_0xe72b('0x36')]=_[_0xe72b('0x39')](_0x5b69af['where'],{'$or':_['map'](_0x54e8e7,function(_0x107ea0){if(_0x107ea0['type']!=='VIRTUAL'){var _0x1f881a={};_0x1f881a[_0x107ea0['name']]={'$like':'%'+_0x240435[_0xe72b('0x2d')][_0xe72b('0x38')]+'%'};return _0x1f881a;}})});}_0x5b69af=_['merge']({},_0x5b69af,_0x240435['options']);var _0x44b87c={'where':_0x5b69af[_0xe72b('0x36')]};return db[_0xe72b('0x28')][_0xe72b('0x1f')](_0x44b87c)[_0xe72b('0x12')](function(_0x132f59){_0x513f25[_0xe72b('0x1f')]=_0x132f59;if(_0x240435[_0xe72b('0x2d')][_0xe72b('0x3a')]){_0x5b69af['include']=[{'all':!![]}];}return db[_0xe72b('0x28')][_0xe72b('0x3b')](_0x5b69af);})['then'](function(_0x2a6dc4){_0x513f25['rows']=_0x2a6dc4;return _0x513f25;})['then'](respondWithFilteredResult(_0x33baed,_0x5b69af))['catch'](handleError(_0x33baed,null));};exports['show']=function(_0x15f248,_0x303835){var _0x36b66f={'raw':!![],'where':{'id':_0x15f248[_0xe72b('0x3c')]['id']}},_0x24747a={};_0x24747a[_0xe72b('0x2c')]=_[_0xe72b('0x3d')](db['MailMessage'][_0xe72b('0x29')]);_0x24747a[_0xe72b('0x2d')]=_[_0xe72b('0x3d')](_0x15f248['query']);_0x24747a[_0xe72b('0x2e')]=_[_0xe72b('0x30')](_0x24747a['model'],_0x24747a[_0xe72b('0x2d')]);_0x36b66f[_0xe72b('0x2f')]=_[_0xe72b('0x30')](_0x24747a[_0xe72b('0x2c')],qs['fields'](_0x15f248['query'][_0xe72b('0x31')]));_0x36b66f['attributes']=_0x36b66f[_0xe72b('0x2f')][_0xe72b('0x32')]?_0x36b66f[_0xe72b('0x2f')]:_0x24747a[_0xe72b('0x2c')];if(_0x15f248['query'][_0xe72b('0x3a')]){_0x36b66f[_0xe72b('0x3e')]=[{'all':!![]}];}_0x36b66f=_[_0xe72b('0x39')]({},_0x36b66f,_0x15f248[_0xe72b('0x3f')]);return db['MailMessage'][_0xe72b('0x40')](_0x36b66f)[_0xe72b('0x12')](handleEntityNotFound(_0x303835,null))['then'](respondWithResult(_0x303835,null))[_0xe72b('0x41')](handleError(_0x303835,null));};exports[_0xe72b('0x23')]=function(_0x491b36,_0x53cf07){if(_0x491b36[_0xe72b('0x42')]['id']){delete _0x491b36[_0xe72b('0x42')]['id'];}return db[_0xe72b('0x28')][_0xe72b('0x40')]({'where':{'id':_0x491b36[_0xe72b('0x3c')]['id']}})[_0xe72b('0x12')](handleEntityNotFound(_0x53cf07,null))[_0xe72b('0x12')](saveUpdates(_0x491b36[_0xe72b('0x42')],null))[_0xe72b('0x12')](respondWithResult(_0x53cf07,null))[_0xe72b('0x41')](handleError(_0x53cf07,null));};exports[_0xe72b('0x24')]=function(_0x399aac,_0x48ed43){return db['MailMessage'][_0xe72b('0x40')]({'where':{'id':_0x399aac[_0xe72b('0x3c')]['id']}})['then'](handleEntityNotFound(_0x48ed43,null))[_0xe72b('0x12')](removeEntity(_0x48ed43,null))[_0xe72b('0x41')](handleError(_0x48ed43,null));};exports[_0xe72b('0x43')]=function(_0x2606e9,_0x3a9439){return db['MailMessage'][_0xe72b('0x43')]()[_0xe72b('0x12')](respondWithResult(_0x3a9439,null))['catch'](handleError(_0x3a9439,null));};exports[_0xe72b('0x44')]=function(_0x62b3ec,_0x6272a2){return db[_0xe72b('0x28')][_0xe72b('0x44')](_0x62b3ec['body'])[_0xe72b('0x12')](function(_0x54cbc0){if(_0x54cbc0){if(_0x54cbc0[_0xe72b('0x45')]===_0xe72b('0x46')&&!_0x54cbc0['secret']){var _0xc97cec,_0x2ea731,_0x4cf2c5;if(_0x62b3ec['body']['to']){_0x2ea731=_0x62b3ec['body']['to'][_0xe72b('0x47')](',')[0x0];}return db[_0xe72b('0x48')][_0xe72b('0x49')]({'where':{'id':_0x54cbc0['MailAccountId']},'include':[{'model':db[_0xe72b('0x4a')],'as':_0xe72b('0x4b'),'include':[{'model':db[_0xe72b('0x4c')],'as':_0xe72b('0x4d'),'where':{'email':_0x2ea731},'limit':0x1,'order':[['updatedAt','DESC']]}]},{'model':db[_0xe72b('0x4e')],'as':_0xe72b('0x4f'),'raw':!![],'include':[{'model':db[_0xe72b('0x50')],'as':'CloudProvider','raw':!![]}]}]})[_0xe72b('0x12')](function(_0x4f03cb){_0xc97cec=_0x4f03cb;if(!_0xc97cec||!_0xc97cec[_0xe72b('0x4f')])return;var _0x4f1538=_0xc97cec['getSmtpOptions']();if(_0x62b3ec[_0xe72b('0x42')]['attachments']&&_0x62b3ec[_0xe72b('0x42')]['attachments']['length']){for(var _0x2e8304=0x0;_0x2e8304<_0x62b3ec[_0xe72b('0x42')][_0xe72b('0x51')][_0xe72b('0x32')];_0x2e8304+=0x1){_0x62b3ec['body'][_0xe72b('0x51')][_0x2e8304]={'filename':_0x62b3ec['body']['attachments'][_0x2e8304][_0xe72b('0x26')],'path':path[_0xe72b('0x52')](config['root'],_0xe72b('0x53'),_0x62b3ec[_0xe72b('0x42')][_0xe72b('0x51')][_0x2e8304][_0xe72b('0x54')])};}}_0x4cf2c5={'account':_0x4f1538,'message':_0x62b3ec[_0xe72b('0x42')]};return;})['then'](function(){if(_0xc97cec[_0xe72b('0x4b')]){if(_0xc97cec[_0xe72b('0x4b')][_0xe72b('0x4d')][_0xe72b('0x32')]){return _0xc97cec[_0xe72b('0x4b')][_0xe72b('0x4d')][0x0];}else{return db[_0xe72b('0x4c')]['create'](_[_0xe72b('0xb')](_0x62b3ec['body'],{'firstName':_0x62b3ec[_0xe72b('0x42')]['to'],'email':_0x62b3ec['body']['to'],'phone':_0x62b3ec[_0xe72b('0x42')]['to'],'ListId':_0xc97cec[_0xe72b('0x55')]}));}}else{throw new Error(_0xe72b('0x56'));}})[_0xe72b('0x12')](function(){if(_0x4cf2c5){return respondWithRpcPromise(_0xe72b('0x57'),_0xe72b('0x58'),_0x4cf2c5,client9003)['then'](function(_0x53f7c7){return _0x54cbc0['update']({'read':!![],'messageId':_0x53f7c7[_0xe72b('0x59')],'sentAt':moment()['format'](_0xe72b('0x5a'))});})[_0xe72b('0x41')](function(_0x5d840b){logger[_0xe72b('0x17')]('%s',JSON['stringify'](_0x5d840b));return _0x54cbc0;});}return _0x54cbc0;});}return _0x54cbc0;}})[_0xe72b('0x12')](respondWithResult(_0x6272a2,0xc9))[_0xe72b('0x41')](handleError(_0x6272a2,null));};exports[_0xe72b('0x5b')]=function(_0x530b03,_0x52d22c){var _0x3d2b83={'agent':{},'channel':'mail'};if(_0x530b03[_0xe72b('0x42')]['id']){delete _0x530b03['body']['id'];}_0x530b03['body'][_0xe72b('0x5c')]=!![];_0x530b03[_0xe72b('0x42')][_0xe72b('0x5d')]=moment()[_0xe72b('0x5e')](_0xe72b('0x5a'));_0x530b03[_0xe72b('0x42')][_0xe72b('0x5f')]=_0x530b03[_0xe72b('0x42')][_0xe72b('0x5f')]||_0x530b03['user']['id'];_0x3d2b83[_0xe72b('0x60')]['id']=_0x530b03[_0xe72b('0x42')][_0xe72b('0x5f')];return db[_0xe72b('0x28')][_0xe72b('0x40')]({'where':{'id':_0x530b03[_0xe72b('0x3c')]['id'],'UserId':null}})[_0xe72b('0x12')](handleEntityNotFound(_0x52d22c,null))[_0xe72b('0x12')](saveUpdates(_0x530b03[_0xe72b('0x42')],null))[_0xe72b('0x12')](function(_0x435e5c){if(_0x435e5c){_0x3d2b83[_0xe72b('0x19')]=_0x435e5c[_0xe72b('0x61')]({'plain':!![]});return db['MailInteraction']['find']({'where':{'id':_0x435e5c['MailInteractionId']}});}return null;})[_0xe72b('0x12')](handleEntityNotFound(_0x52d22c,null))[_0xe72b('0x12')](function(_0x373a05){if(_0x373a05){return _0x373a05[_0xe72b('0x23')]({'UserId':_0x530b03[_0xe72b('0x42')][_0xe72b('0x5f')],'read1stAt':_[_0xe72b('0x62')](_0x373a05['read1stAt'])?moment()[_0xe72b('0x5e')](_0xe72b('0x5a')):undefined});}return null;})[_0xe72b('0x12')](function(_0x1324c7){if(_0x1324c7){_0x3d2b83['interaction']=_0x1324c7[_0xe72b('0x61')]({'plain':!![]});interaction_log[_0xe72b('0x13')](_0xe72b('0x63'),_0x530b03['user']['id'],_0x530b03[_0xe72b('0x64')]['name'],_0x530b03[_0xe72b('0x64')][_0xe72b('0x65')],_0x3d2b83[_0xe72b('0x66')]['id'],_0x530b03[_0xe72b('0x42')]?JSON['stringify'](_0x530b03['body']):_0xe72b('0x67'));return respondWithRpcPromise('AcceptMessage',_0xe72b('0x68'),_0x3d2b83);}return null;})[_0xe72b('0x12')](function(_0x3c4942){var _0x1bc6dd='SELECT\x20*\x20FROM\x20cm_contacts\x20WHERE\x20id\x20=\x20'+_0x3c4942[_0xe72b('0x19')][_0xe72b('0x69')];return db[_0xe72b('0x6a')][_0xe72b('0x2d')](_0x1bc6dd,{'type':db['Sequelize']['QueryTypes']['SELECT'],'raw':!![]})[_0xe72b('0x12')](function(_0x1b3448){return _0x1b3448;});})[_0xe72b('0x12')](function(_0x2e7cab){if(_0x2e7cab){_0x3d2b83['message'][_0xe72b('0x6b')]=_0x2e7cab[0x0];if(!_0x530b03[_0xe72b('0x42')][_0xe72b('0x5f')])return;return db[_0xe72b('0x6c')][_0xe72b('0x40')]({'where':{'id':_0x530b03[_0xe72b('0x42')][_0xe72b('0x5f')],'role':_0xe72b('0x60')},'attributes':['id',_0xe72b('0x26'),'fullname',_0xe72b('0x6d'),_0xe72b('0x6e')],'raw':!![]});}return null;})[_0xe72b('0x12')](function(_0x54c407){if(!_0x54c407)return null;_0x3d2b83[_0xe72b('0x19')]['agent']=_0x54c407;return _0x3d2b83;})[_0xe72b('0x12')](function(_0x2ba3df){if(_0x2ba3df){if(_0x530b03[_0xe72b('0x42')][_0xe72b('0x6f')]){_0x3d2b83[_0xe72b('0x19')][_0xe72b('0x70')]=util[_0xe72b('0x5e')](_0xe72b('0x71'),_0x530b03['user'][_0xe72b('0x26')]);_0x3d2b83[_0xe72b('0x19')][_0xe72b('0x72')]=_0x3d2b83[_0xe72b('0x72')];_0x3d2b83[_0xe72b('0x19')][_0xe72b('0x73')]=_0x3d2b83[_0xe72b('0x72')];_0x3d2b83[_0xe72b('0x19')][_0xe72b('0x74')]=_0xe72b('0x5b');_0x3d2b83['message'][_0xe72b('0x42')]=htmlToText['fromString'](_0x3d2b83[_0xe72b('0x19')][_0xe72b('0x42')]);return respondWithRpcPromise(_0xe72b('0x75'),_0xe72b('0x75'),{'event':_0xe72b('0x76'),'message':_0x3d2b83[_0xe72b('0x19')]},client9002)[_0xe72b('0x12')](function(){return _0x3d2b83;});}return _0x3d2b83;}return null;})[_0xe72b('0x12')](respondWithResult(_0x52d22c,null))[_0xe72b('0x41')](handleError(_0x52d22c,null));};exports['reject']=function(_0x1fcbea,_0x59d061){var _0x4234ff={'agent':{},'channel':_0xe72b('0x77')};if(_0x1fcbea[_0xe72b('0x42')]['id']){delete _0x1fcbea[_0xe72b('0x42')]['id'];}_0x1fcbea[_0xe72b('0x42')][_0xe72b('0x5f')]=_0x1fcbea['body']['UserId']||_0x1fcbea[_0xe72b('0x64')]['id'];_0x4234ff[_0xe72b('0x60')]['id']=_0x1fcbea[_0xe72b('0x42')]['UserId'];return db[_0xe72b('0x28')]['find']({'where':{'id':_0x1fcbea[_0xe72b('0x3c')]['id'],'UserId':null}})[_0xe72b('0x12')](handleEntityNotFound(_0x59d061,null))[_0xe72b('0x12')](function(_0x552a25){if(_0x552a25){_0x4234ff['message']=_0x552a25[_0xe72b('0x61')]({'plain':!![]});return db[_0xe72b('0x78')][_0xe72b('0x40')]({'where':{'id':_0x552a25[_0xe72b('0x79')]}});}return null;})['then'](handleEntityNotFound(_0x59d061,null))['then'](function(_0x6b12e7){if(_0x6b12e7){_0x4234ff[_0xe72b('0x66')]=_0x6b12e7[_0xe72b('0x61')]({'plain':!![]});interaction_log[_0xe72b('0x13')]('[MAILMESSAGE:REJECT]\x20id=%s\x20name=%s\x20role=%s\x20interaction=%s\x20body=%s',_0x1fcbea['user']['id'],_0x1fcbea['user'][_0xe72b('0x26')],_0x1fcbea[_0xe72b('0x64')][_0xe72b('0x65')],_0x4234ff['interaction']['id'],_0x1fcbea['body']?JSON[_0xe72b('0x16')](_0x1fcbea[_0xe72b('0x42')]):_0xe72b('0x67'));return respondWithRpcPromise(_0xe72b('0x7a'),_0xe72b('0x7b'),_0x4234ff);}return null;})[_0xe72b('0x12')](function(_0x823549){var _0x123f9a=_0xe72b('0x7c')+_0x823549[_0xe72b('0x19')]['ContactId'];return db[_0xe72b('0x6a')][_0xe72b('0x2d')](_0x123f9a,{'type':db[_0xe72b('0x7d')]['QueryTypes'][_0xe72b('0x7e')],'raw':!![]})['then'](function(_0x17a899){return _0x17a899;});})[_0xe72b('0x12')](function(_0x243202){if(_0x243202){_0x4234ff[_0xe72b('0x19')]['contact']=_0x243202[0x0];if(!_0x1fcbea[_0xe72b('0x42')][_0xe72b('0x5f')])return;return db[_0xe72b('0x6c')][_0xe72b('0x40')]({'where':{'id':_0x1fcbea[_0xe72b('0x42')][_0xe72b('0x5f')],'role':'agent'},'attributes':['id',_0xe72b('0x26'),_0xe72b('0x7f'),_0xe72b('0x6d'),'internal'],'raw':!![]});}return null;})[_0xe72b('0x12')](function(_0x21cabe){if(!_0x21cabe)return null;_0x4234ff[_0xe72b('0x19')]['agent']=_0x21cabe;return _0x4234ff;})[_0xe72b('0x12')](function(_0x2c008d){if(_0x2c008d){_0x2c008d[_0xe72b('0x19')][_0xe72b('0x70')]=util[_0xe72b('0x5e')]('SIP/%s',_0x1fcbea[_0xe72b('0x64')][_0xe72b('0x26')]);_0x2c008d[_0xe72b('0x19')]['channel']=_0x4234ff['channel'];_0x2c008d[_0xe72b('0x19')][_0xe72b('0x73')]=_0x4234ff[_0xe72b('0x72')];_0x2c008d[_0xe72b('0x19')][_0xe72b('0x74')]='reject';_0x2c008d['message'][_0xe72b('0x42')]=htmlToText[_0xe72b('0x80')](_0x4234ff[_0xe72b('0x19')]['body']);respondWithRpcPromise('EventManager',_0xe72b('0x75'),{'event':_0xe72b('0x81'),'message':_0x2c008d[_0xe72b('0x19')]},client9002);return _0x4234ff;}return null;})[_0xe72b('0x12')](respondWithResult(_0x59d061,null))['catch'](handleError(_0x59d061,null));};exports[_0xe72b('0x82')]=function(_0x683de6,_0x590a80){var _0x43b691=moment()[_0xe72b('0x83')]()[_0xe72b('0x84')]();var _0xb3ceb0=path[_0xe72b('0x52')](config[_0xe72b('0x85')],_0xe72b('0x86'),_0xe72b('0x87'),_0xe72b('0x88'));var _0x5ae83c=path['join'](config['root'],_0xe72b('0x86'),_0xe72b('0x87'),_0xe72b('0x51'));var _0x2c1a51=util[_0xe72b('0x5e')]('message-%s.eml',_0x43b691);return db[_0xe72b('0x28')][_0xe72b('0x40')]({'where':{'id':_0x683de6['params']['id']},'attributes':['id',_0xe72b('0x42'),_0xe72b('0x89'),'to','cc',_0xe72b('0x8a'),_0xe72b('0x8b'),_0xe72b('0x8c')],'include':_0x683de6[_0xe72b('0x2d')][_0xe72b('0x51')]?[{'model':db[_0xe72b('0x8d')],'as':'Attachments'}]:undefined})[_0xe72b('0x12')](handleEntityNotFound(_0x590a80,null))[_0xe72b('0x12')](function(_0x587ecf){if(_0x587ecf){var _0x51061c=_0x587ecf;var _0x54ea8e={'from':_0x51061c[_0xe72b('0x89')],'to':_0x51061c['to'],'subject':_0x51061c[_0xe72b('0x8b')],'html':htmlEntities[_0xe72b('0x8e')](_0x51061c['body']),'headers':{'Date':moment(_0x51061c[_0xe72b('0x8c')])[_0xe72b('0x5e')]('ddd,\x20DD\x20MMM\x20YYYY\x20HH:mm:ss\x20ZZ')},'attachments':[]};if(_0x587ecf['cc']){_0x54ea8e['headers']['Cc']=_0x587ecf['cc'];}if(_0x587ecf[_0xe72b('0x8a')]){_0x54ea8e[_0xe72b('0x8f')][_0xe72b('0x90')]=_0x587ecf[_0xe72b('0x8a')];}return new BPromise(function(_0x30a203,_0x4c3ff5){if(_0x587ecf[_0xe72b('0x91')]){for(var _0x5725ac=0x0;_0x5725ac<_0x587ecf['Attachments'][_0xe72b('0x32')];_0x5725ac++){var _0x5762fc=_0x587ecf[_0xe72b('0x91')][_0x5725ac];var _0x321e15=path[_0xe72b('0x52')](_0x5ae83c,_0x5762fc['basename']);if(fs[_0xe72b('0x92')](_0x321e15)){_0x54ea8e[_0xe72b('0x51')][_0xe72b('0x93')]({'name':_0x5762fc['name'],'contentType':_0x5762fc[_0xe72b('0x2b')],'data':fs[_0xe72b('0x94')](_0x321e15)});}}}emlformat[_0xe72b('0x95')](_0x54ea8e,function(_0x3add72,_0x48b16a){if(_0x3add72)return _0x4c3ff5(_0x3add72);fs['writeFileSync'](path[_0xe72b('0x52')](_0xb3ceb0,_0x2c1a51),_0x48b16a);return _0x30a203(_0x48b16a);});});}})[_0xe72b('0x12')](function(_0x36f53e){if(_0x36f53e){return _0x590a80[_0xe72b('0x82')](path[_0xe72b('0x52')](_0xb3ceb0,_0x2c1a51),_0x2c1a51,function(_0x12a02e){if(!_0x12a02e)fs[_0xe72b('0x96')](path[_0xe72b('0x52')](_0xb3ceb0,_0x2c1a51));});}})[_0xe72b('0x41')](handleError(_0x590a80,null));}; \ No newline at end of file diff --git a/server/api/mailMessage/mailMessage.events.js b/server/api/mailMessage/mailMessage.events.js index 3d0b198..7ef693b 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 _0x7a3d=['emit','hasOwnProperty','hook','exports','events','../../mysqldb','MailMessage','setMaxListeners','save','update','remove'];(function(_0x2c077b,_0x171aff){var _0x23105e=function(_0x5bc326){while(--_0x5bc326){_0x2c077b['push'](_0x2c077b['shift']());}};_0x23105e(++_0x171aff);}(_0x7a3d,0x10c));var _0xd7a3=function(_0x1fc14e,_0x2ddf06){_0x1fc14e=_0x1fc14e-0x0;var _0x2afe2f=_0x7a3d[_0x1fc14e];return _0x2afe2f;};'use strict';var EventEmitter=require(_0xd7a3('0x0'));var MailMessage=require(_0xd7a3('0x1'))['db'][_0xd7a3('0x2')];var MailMessageEvents=new EventEmitter();MailMessageEvents[_0xd7a3('0x3')](0x0);var events={'afterCreate':_0xd7a3('0x4'),'afterUpdate':_0xd7a3('0x5'),'afterDestroy':_0xd7a3('0x6')};function emitEvent(_0x50fb34){return function(_0x38e378,_0x513469,_0x19162f){MailMessageEvents[_0xd7a3('0x7')](_0x50fb34+':'+_0x38e378['id'],_0x38e378);MailMessageEvents[_0xd7a3('0x7')](_0x50fb34,_0x38e378);_0x19162f(null);};}for(var e in events){if(events[_0xd7a3('0x8')](e)){var event=events[e];MailMessage[_0xd7a3('0x9')](e,emitEvent(event));}}module[_0xd7a3('0xa')]=MailMessageEvents; \ No newline at end of file +var _0x27a7=['hook','exports','events','../../mysqldb','setMaxListeners','remove','emit'];(function(_0x55cc58,_0x5ce0af){var _0x26062e=function(_0x59e29d){while(--_0x59e29d){_0x55cc58['push'](_0x55cc58['shift']());}};_0x26062e(++_0x5ce0af);}(_0x27a7,0xe9));var _0x727a=function(_0x5235a6,_0x680b76){_0x5235a6=_0x5235a6-0x0;var _0x1cf37e=_0x27a7[_0x5235a6];return _0x1cf37e;};'use strict';var EventEmitter=require(_0x727a('0x0'));var MailMessage=require(_0x727a('0x1'))['db']['MailMessage'];var MailMessageEvents=new EventEmitter();MailMessageEvents[_0x727a('0x2')](0x0);var events={'afterCreate':'save','afterUpdate':'update','afterDestroy':_0x727a('0x3')};function emitEvent(_0x5e8ba4){return function(_0x1575ad,_0x380ce1,_0x5ad7bc){MailMessageEvents[_0x727a('0x4')](_0x5e8ba4+':'+_0x1575ad['id'],_0x1575ad);MailMessageEvents['emit'](_0x5e8ba4,_0x1575ad);_0x5ad7bc(null);};}for(var e in events){if(events['hasOwnProperty'](e)){var event=events[e];MailMessage[_0x727a('0x5')](e,emitEvent(event));}}module[_0x727a('0x6')]=MailMessageEvents; \ No newline at end of file diff --git a/server/api/mailMessage/mailMessage.model.js b/server/api/mailMessage/mailMessage.model.js index 9eedc76..c234a81 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 _0xd167=['messageId','fti_mail_messages','plainBody','subject','FULLTEXT','body','fromString','models','get','direction','toLowerCase','out','UserId','MailInteraction','findOne','createdAt','catch','error','utf8mb4','utf8mb4_unicode_ci','lodash','util','../../config/logger','api','moment','bluebird','request-promise','path','rimraf','../../config/environment','./mailMessage.attributes','exports','define','mail_messages'];(function(_0x5d4607,_0x6b5e7b){var _0x5e4a86=function(_0x46891a){while(--_0x46891a){_0x5d4607['push'](_0x5d4607['shift']());}};_0x5e4a86(++_0x6b5e7b);}(_0xd167,0x124));var _0x7d16=function(_0x296ba8,_0x41d564){_0x296ba8=_0x296ba8-0x0;var _0x39c661=_0xd167[_0x296ba8];return _0x39c661;};'use strict';var _=require(_0x7d16('0x0'));var util=require(_0x7d16('0x1'));var logger=require(_0x7d16('0x2'))(_0x7d16('0x3'));var moment=require(_0x7d16('0x4'));var BPromise=require(_0x7d16('0x5'));var rp=require(_0x7d16('0x6'));var htmlToText=require('html-to-text');var fs=require('fs');var path=require(_0x7d16('0x7'));var rimraf=require(_0x7d16('0x8'));var config=require(_0x7d16('0x9'));var attributes=require(_0x7d16('0xa'));module[_0x7d16('0xb')]=function(_0x4f8e67,_0x10f09b){return _0x4f8e67[_0x7d16('0xc')]('MailMessage',attributes,{'tableName':_0x7d16('0xd'),'paranoid':![],'indexes':[{'name':_0x7d16('0xe'),'fields':[_0x7d16('0xe')]},{'name':_0x7d16('0xf'),'fields':[_0x7d16('0x10'),_0x7d16('0x11')],'type':_0x7d16('0x12')}],'timestamps':!![],'hooks':{'beforeCreate':function(_0x4430a3,_0x18ad3e,_0x5c1ceb){if(_0x4430a3[_0x7d16('0x13')]){_0x4430a3[_0x7d16('0x10')]=htmlToText[_0x7d16('0x14')](_0x4430a3[_0x7d16('0x13')],{'preserveNewlines':!![],'singleNewLineParagraphs':!![],'uppercaseHeadings':![],'noLinkBrackets':!![],'ignoreImage':!![]});}_0x5c1ceb(null,_0x18ad3e);},'afterCreate':function(_0xee7384,_0x249797,_0x410574){var _0x341023=_0x4f8e67[_0x7d16('0x15')];var _0x18c673=_0xee7384[_0x7d16('0x16')]({'plain':!![]});if(_0x18c673[_0x7d16('0x17')][_0x7d16('0x18')]()==='in'||_0x18c673['direction'][_0x7d16('0x18')]()===_0x7d16('0x19')&&!_0x18c673['secret']&&!_['isNil'](_0x18c673[_0x7d16('0x1a')])){_0x341023[_0x7d16('0x1b')][_0x7d16('0x1c')]({'where':{'id':_0x18c673['MailInteractionId']}})['then'](function(_0x4c9cfa){if(_0x4c9cfa){_0x4c9cfa['update']({'lastMsgAt':_0x18c673[_0x7d16('0x1d')],'lastMsgDirection':_0x18c673[_0x7d16('0x17')][_0x7d16('0x18')]()});}})[_0x7d16('0x1e')](function(_0x55d2ea){console[_0x7d16('0x1f')](_0x55d2ea);});}_0x410574();}},'charset':_0x7d16('0x20'),'collate':_0x7d16('0x21')});}; \ No newline at end of file +var _0x5c4b=['messageId','fti_mail_messages','body','plainBody','fromString','models','toLowerCase','direction','out','isNil','UserId','MailInteractionId','then','update','createdAt','catch','utf8mb4','utf8mb4_unicode_ci','util','api','moment','bluebird','request-promise','html-to-text','rimraf','../../config/environment','./mailMessage.attributes','exports','define','mail_messages'];(function(_0x3bdcb8,_0x30daef){var _0x2fe9ad=function(_0x2715ae){while(--_0x2715ae){_0x3bdcb8['push'](_0x3bdcb8['shift']());}};_0x2fe9ad(++_0x30daef);}(_0x5c4b,0x15c));var _0xb5c4=function(_0x21ea35,_0x2882ca){_0x21ea35=_0x21ea35-0x0;var _0x370cb0=_0x5c4b[_0x21ea35];return _0x370cb0;};'use strict';var _=require('lodash');var util=require(_0xb5c4('0x0'));var logger=require('../../config/logger')(_0xb5c4('0x1'));var moment=require(_0xb5c4('0x2'));var BPromise=require(_0xb5c4('0x3'));var rp=require(_0xb5c4('0x4'));var htmlToText=require(_0xb5c4('0x5'));var fs=require('fs');var path=require('path');var rimraf=require(_0xb5c4('0x6'));var config=require(_0xb5c4('0x7'));var attributes=require(_0xb5c4('0x8'));module[_0xb5c4('0x9')]=function(_0x56b1a8,_0x228539){return _0x56b1a8[_0xb5c4('0xa')]('MailMessage',attributes,{'tableName':_0xb5c4('0xb'),'paranoid':![],'indexes':[{'name':_0xb5c4('0xc'),'fields':[_0xb5c4('0xc')]},{'name':_0xb5c4('0xd'),'fields':['plainBody','subject'],'type':'FULLTEXT'}],'timestamps':!![],'hooks':{'beforeCreate':function(_0x49a8a0,_0x217626,_0x851188){if(_0x49a8a0[_0xb5c4('0xe')]){_0x49a8a0[_0xb5c4('0xf')]=htmlToText[_0xb5c4('0x10')](_0x49a8a0[_0xb5c4('0xe')],{'preserveNewlines':!![],'singleNewLineParagraphs':!![],'uppercaseHeadings':![],'noLinkBrackets':!![],'ignoreImage':!![]});}_0x851188(null,_0x217626);},'afterCreate':function(_0x20f10e,_0x48d77e,_0xf08863){var _0x42e022=_0x56b1a8[_0xb5c4('0x11')];var _0x5f44fd=_0x20f10e['get']({'plain':!![]});if(_0x5f44fd['direction'][_0xb5c4('0x12')]()==='in'||_0x5f44fd[_0xb5c4('0x13')][_0xb5c4('0x12')]()===_0xb5c4('0x14')&&!_0x5f44fd['secret']&&!_[_0xb5c4('0x15')](_0x5f44fd[_0xb5c4('0x16')])){_0x42e022['MailInteraction']['findOne']({'where':{'id':_0x5f44fd[_0xb5c4('0x17')]}})[_0xb5c4('0x18')](function(_0x54b972){if(_0x54b972){_0x54b972[_0xb5c4('0x19')]({'lastMsgAt':_0x5f44fd[_0xb5c4('0x1a')],'lastMsgDirection':_0x5f44fd[_0xb5c4('0x13')][_0xb5c4('0x12')]()});}})[_0xb5c4('0x1b')](function(_0x30b592){console['error'](_0x30b592);});}_0xf08863();}},'charset':_0xb5c4('0x1c'),'collate':_0xb5c4('0x1d')});}; \ No newline at end of file diff --git a/server/api/mailMessage/mailMessage.rpc.js b/server/api/mailMessage/mailMessage.rpc.js index 422bd17..898cb2f 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 _0x3de3=['ioredis','../../mysqldb','../../config/utils','../../config/logger','../../config/environment','jayson/promise','http','defaults','redis','localhost','./mailMessage.socket','register','request','then','info','MailMessage,\x20%s,\x20%s','request\x20sent','debug','stringify','code','error','message','result','CreateMailMessage','MailMessage','create','options','catch','lodash','moment','bluebird'];(function(_0x190e7e,_0x53cea1){var _0x1c21ce=function(_0x315818){while(--_0x315818){_0x190e7e['push'](_0x190e7e['shift']());}};_0x1c21ce(++_0x53cea1);}(_0x3de3,0x1ce));var _0x33de=function(_0x558411,_0x1a4430){_0x558411=_0x558411-0x0;var _0x10f9db=_0x3de3[_0x558411];return _0x10f9db;};'use strict';var _=require(_0x33de('0x0'));var util=require('util');var moment=require(_0x33de('0x1'));var BPromise=require(_0x33de('0x2'));var rs=require('randomstring');var fs=require('fs');var Redis=require(_0x33de('0x3'));var db=require(_0x33de('0x4'))['db'];var utils=require(_0x33de('0x5'));var logger=require(_0x33de('0x6'))('rpc');var config=require(_0x33de('0x7'));var jayson=require(_0x33de('0x8'));var client=jayson['client'][_0x33de('0x9')]({'port':0x232a});config['redis']=_[_0x33de('0xa')](config[_0x33de('0xb')],{'host':_0x33de('0xc'),'port':0x18eb});var socket=require('socket.io-emitter')(new Redis(config[_0x33de('0xb')]));require(_0x33de('0xd'))[_0x33de('0xe')](socket);function respondWithRpcPromise(_0x5e1be7,_0x2cbf35,_0x348720){return new BPromise(function(_0x8b655d,_0x241211){return client[_0x33de('0xf')](_0x5e1be7,_0x348720)[_0x33de('0x10')](function(_0x8dfa3b){logger[_0x33de('0x11')](_0x33de('0x12'),_0x2cbf35,_0x33de('0x13'));logger[_0x33de('0x14')]('MailMessage,\x20%s,\x20%s,\x20%s',_0x2cbf35,_0x33de('0x13'),JSON[_0x33de('0x15')](_0x8dfa3b));if(_0x8dfa3b['error']){if(_0x8dfa3b['error'][_0x33de('0x16')]===0x1f4){logger[_0x33de('0x17')](_0x33de('0x12'),_0x2cbf35,_0x8dfa3b[_0x33de('0x17')]['message']);return _0x241211(_0x8dfa3b[_0x33de('0x17')][_0x33de('0x18')]);}logger['error']('MailMessage,\x20%s,\x20%s',_0x2cbf35,_0x8dfa3b[_0x33de('0x17')][_0x33de('0x18')]);return _0x8b655d(_0x8dfa3b[_0x33de('0x17')]['message']);}else{logger[_0x33de('0x11')](_0x33de('0x12'),_0x2cbf35,'request\x20sent');_0x8b655d(_0x8dfa3b[_0x33de('0x19')][_0x33de('0x18')]);}})['catch'](function(_0x5bb74e){logger[_0x33de('0x17')]('MailMessage,\x20%s,\x20%s',_0x2cbf35,_0x5bb74e);_0x241211(_0x5bb74e);});});}exports[_0x33de('0x1a')]=function(_0x2f0529){var _0x3810b5=this;return new Promise(function(_0x315c9b,_0xc4f1a4){return db[_0x33de('0x1b')][_0x33de('0x1c')](_0x2f0529['body'],{'raw':_0x2f0529['options']?_0x2f0529[_0x33de('0x1d')]['raw']===undefined?!![]:![]:!![]})[_0x33de('0x10')](function(_0x4cd8db){logger[_0x33de('0x11')](_0x33de('0x1a'),_0x2f0529);logger['debug'](_0x33de('0x1a'),_0x2f0529,JSON['stringify'](_0x4cd8db));_0x315c9b(_0x4cd8db);})[_0x33de('0x1e')](function(_0x5c602d){logger[_0x33de('0x17')](_0x33de('0x1a'),_0x5c602d[_0x33de('0x18')],_0x2f0529);_0xc4f1a4(_0x3810b5['error'](0x1f4,_0x5c602d[_0x33de('0x18')]));});});}; \ No newline at end of file +var _0x14a0=['code','message','result','catch','CreateMailMessage','MailMessage','create','body','options','raw','util','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/environment','jayson/promise','client','defaults','redis','localhost','./mailMessage.socket','request','then','info','MailMessage,\x20%s,\x20%s','request\x20sent','debug','MailMessage,\x20%s,\x20%s,\x20%s','stringify','error'];(function(_0x3dc62f,_0x3c8719){var _0x1faf41=function(_0x2cb8b0){while(--_0x2cb8b0){_0x3dc62f['push'](_0x3dc62f['shift']());}};_0x1faf41(++_0x3c8719);}(_0x14a0,0x8e));var _0x014a=function(_0x360739,_0x2ec1b2){_0x360739=_0x360739-0x0;var _0x3e23a1=_0x14a0[_0x360739];return _0x3e23a1;};'use strict';var _=require('lodash');var util=require(_0x014a('0x0'));var moment=require(_0x014a('0x1'));var BPromise=require(_0x014a('0x2'));var rs=require(_0x014a('0x3'));var fs=require('fs');var Redis=require(_0x014a('0x4'));var db=require(_0x014a('0x5'))['db'];var utils=require(_0x014a('0x6'));var logger=require('../../config/logger')('rpc');var config=require(_0x014a('0x7'));var jayson=require(_0x014a('0x8'));var client=jayson[_0x014a('0x9')]['http']({'port':0x232a});config['redis']=_[_0x014a('0xa')](config[_0x014a('0xb')],{'host':_0x014a('0xc'),'port':0x18eb});var socket=require('socket.io-emitter')(new Redis(config['redis']));require(_0x014a('0xd'))['register'](socket);function respondWithRpcPromise(_0x490ea2,_0x5aa52f,_0x4f3539){return new BPromise(function(_0x330469,_0x4c7418){return client[_0x014a('0xe')](_0x490ea2,_0x4f3539)[_0x014a('0xf')](function(_0x543bbf){logger[_0x014a('0x10')](_0x014a('0x11'),_0x5aa52f,_0x014a('0x12'));logger[_0x014a('0x13')](_0x014a('0x14'),_0x5aa52f,_0x014a('0x12'),JSON[_0x014a('0x15')](_0x543bbf));if(_0x543bbf[_0x014a('0x16')]){if(_0x543bbf[_0x014a('0x16')][_0x014a('0x17')]===0x1f4){logger[_0x014a('0x16')](_0x014a('0x11'),_0x5aa52f,_0x543bbf['error'][_0x014a('0x18')]);return _0x4c7418(_0x543bbf[_0x014a('0x16')]['message']);}logger[_0x014a('0x16')](_0x014a('0x11'),_0x5aa52f,_0x543bbf['error'][_0x014a('0x18')]);return _0x330469(_0x543bbf[_0x014a('0x16')][_0x014a('0x18')]);}else{logger[_0x014a('0x10')](_0x014a('0x11'),_0x5aa52f,_0x014a('0x12'));_0x330469(_0x543bbf[_0x014a('0x19')][_0x014a('0x18')]);}})[_0x014a('0x1a')](function(_0x3b9341){logger[_0x014a('0x16')](_0x014a('0x11'),_0x5aa52f,_0x3b9341);_0x4c7418(_0x3b9341);});});}exports[_0x014a('0x1b')]=function(_0x34e5c3){var _0x5c69c5=this;return new Promise(function(_0x359903,_0x109a9c){return db[_0x014a('0x1c')][_0x014a('0x1d')](_0x34e5c3[_0x014a('0x1e')],{'raw':_0x34e5c3[_0x014a('0x1f')]?_0x34e5c3[_0x014a('0x1f')][_0x014a('0x20')]===undefined?!![]:![]:!![]})[_0x014a('0xf')](function(_0x486e66){logger[_0x014a('0x10')]('CreateMailMessage',_0x34e5c3);logger[_0x014a('0x13')](_0x014a('0x1b'),_0x34e5c3,JSON[_0x014a('0x15')](_0x486e66));_0x359903(_0x486e66);})[_0x014a('0x1a')](function(_0x2b3c10){logger[_0x014a('0x16')](_0x014a('0x1b'),_0x2b3c10[_0x014a('0x18')],_0x34e5c3);_0x109a9c(_0x5c69c5[_0x014a('0x16')](0x1f4,_0x2b3c10['message']));});});}; \ No newline at end of file diff --git a/server/api/mailMessage/mailMessage.socket.js b/server/api/mailMessage/mailMessage.socket.js index 272dda4..84f3161 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 _0x36f4=['remove','update','removeListener','register','mailMessage:','save'];(function(_0x3c0735,_0x4752eb){var _0x3ad1c4=function(_0x1a7c15){while(--_0x1a7c15){_0x3c0735['push'](_0x3c0735['shift']());}};_0x3ad1c4(++_0x4752eb);}(_0x36f4,0xb3));var _0x436f=function(_0x99743b,_0x4cab8f){_0x99743b=_0x99743b-0x0;var _0x3008df=_0x36f4[_0x99743b];return _0x3008df;};'use strict';var MailMessageEvents=require('./mailMessage.events');var events=[_0x436f('0x0'),_0x436f('0x1'),_0x436f('0x2')];function createListener(_0x162fc6,_0x1e7ce7){return function(_0x4ed0be){_0x1e7ce7['emit'](_0x162fc6,_0x4ed0be);};}function removeListener(_0x3fdc73,_0x42f8e4){return function(){MailMessageEvents[_0x436f('0x3')](_0x3fdc73,_0x42f8e4);};}exports[_0x436f('0x4')]=function(_0x59cfcf){for(var _0x5f31ff=0x0,_0x1d27a2=events['length'];_0x5f31ff<_0x1d27a2;_0x5f31ff++){var _0x374425=events[_0x5f31ff];var _0x5cd749=createListener(_0x436f('0x5')+_0x374425,_0x59cfcf);MailMessageEvents['on'](_0x374425,_0x5cd749);}}; \ No newline at end of file +var _0x1575=['./mailMessage.events','save','remove','update','removeListener','register','length','mailMessage:'];(function(_0x327f41,_0x5c3672){var _0x3ffdae=function(_0x128465){while(--_0x128465){_0x327f41['push'](_0x327f41['shift']());}};_0x3ffdae(++_0x5c3672);}(_0x1575,0x190));var _0x5157=function(_0x96baa6,_0x113c83){_0x96baa6=_0x96baa6-0x0;var _0x14c52b=_0x1575[_0x96baa6];return _0x14c52b;};'use strict';var MailMessageEvents=require(_0x5157('0x0'));var events=[_0x5157('0x1'),_0x5157('0x2'),_0x5157('0x3')];function createListener(_0x1f43bc,_0x411e71){return function(_0x3cbbd6){_0x411e71['emit'](_0x1f43bc,_0x3cbbd6);};}function removeListener(_0x6961cb,_0x5c2424){return function(){MailMessageEvents[_0x5157('0x4')](_0x6961cb,_0x5c2424);};}exports[_0x5157('0x5')]=function(_0x5d2312){for(var _0xdd370b=0x0,_0x321a4b=events[_0x5157('0x6')];_0xdd370b<_0x321a4b;_0xdd370b++){var _0x10d01f=events[_0xdd370b];var _0x1aa7f4=createListener(_0x5157('0x7')+_0x10d01f,_0x5d2312);MailMessageEvents['on'](_0x10d01f,_0x1aa7f4);}}; \ No newline at end of file diff --git a/server/api/mailQueue/index.js b/server/api/mailQueue/index.js index 614fa33..6594e6f 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 _0x3e2b=['addAgents','put','delete','destroy','removeTeams','multer','util','path','connect-timeout','express','../../config/environment','./mailQueue.controller','isAuthenticated','get','describe','/:id','show','/:id/members','getMembers','getTeams','getAgents','post','create','/:id/teams','addTeams','/:id/users'];(function(_0x465028,_0x4570ac){var _0xb783d4=function(_0x5458c5){while(--_0x5458c5){_0x465028['push'](_0x465028['shift']());}};_0xb783d4(++_0x4570ac);}(_0x3e2b,0x171));var _0xb3e2=function(_0x48cad4,_0x1fb515){_0x48cad4=_0x48cad4-0x0;var _0x1a619b=_0x3e2b[_0x48cad4];return _0x1a619b;};'use strict';var multer=require(_0xb3e2('0x0'));var util=require(_0xb3e2('0x1'));var path=require(_0xb3e2('0x2'));var timeout=require(_0xb3e2('0x3'));var express=require(_0xb3e2('0x4'));var router=express['Router']();var fs_extra=require('fs-extra');var auth=require('../../components/auth/service');var interaction=require('../../components/interaction/service');var config=require(_0xb3e2('0x5'));var controller=require(_0xb3e2('0x6'));router['get']('/',auth[_0xb3e2('0x7')](),controller['index']);router[_0xb3e2('0x8')]('/describe',auth[_0xb3e2('0x7')](),controller[_0xb3e2('0x9')]);router[_0xb3e2('0x8')](_0xb3e2('0xa'),auth[_0xb3e2('0x7')](),controller[_0xb3e2('0xb')]);router[_0xb3e2('0x8')](_0xb3e2('0xc'),auth[_0xb3e2('0x7')](),controller[_0xb3e2('0xd')]);router[_0xb3e2('0x8')]('/:id/teams',auth[_0xb3e2('0x7')](),controller[_0xb3e2('0xe')]);router[_0xb3e2('0x8')]('/:id/users',auth['isAuthenticated'](),controller[_0xb3e2('0xf')]);router[_0xb3e2('0x10')]('/',auth[_0xb3e2('0x7')](),controller[_0xb3e2('0x11')]);router[_0xb3e2('0x10')](_0xb3e2('0x12'),auth[_0xb3e2('0x7')](),controller[_0xb3e2('0x13')]);router[_0xb3e2('0x10')](_0xb3e2('0x14'),auth[_0xb3e2('0x7')](),controller[_0xb3e2('0x15')]);router[_0xb3e2('0x16')](_0xb3e2('0xa'),auth['isAuthenticated'](),controller['update']);router[_0xb3e2('0x17')](_0xb3e2('0xa'),auth[_0xb3e2('0x7')](),controller[_0xb3e2('0x18')]);router[_0xb3e2('0x17')](_0xb3e2('0x12'),auth[_0xb3e2('0x7')](),controller[_0xb3e2('0x19')]);router[_0xb3e2('0x17')](_0xb3e2('0x14'),auth['isAuthenticated'](),controller['removeAgents']);module['exports']=router; \ No newline at end of file +var _0x1270=['describe','/:id/teams','getTeams','/:id/users','getAgents','post','create','addAgents','put','/:id','update','delete','removeAgents','multer','util','fs-extra','../../components/interaction/service','../../config/environment','./mailQueue.controller','get','isAuthenticated','index'];(function(_0x37a887,_0x5abb88){var _0x52ff95=function(_0x4065ee){while(--_0x4065ee){_0x37a887['push'](_0x37a887['shift']());}};_0x52ff95(++_0x5abb88);}(_0x1270,0x16d));var _0x0127=function(_0x32f647,_0x37a466){_0x32f647=_0x32f647-0x0;var _0x199ad2=_0x1270[_0x32f647];return _0x199ad2;};'use strict';var multer=require(_0x0127('0x0'));var util=require(_0x0127('0x1'));var path=require('path');var timeout=require('connect-timeout');var express=require('express');var router=express['Router']();var fs_extra=require(_0x0127('0x2'));var auth=require('../../components/auth/service');var interaction=require(_0x0127('0x3'));var config=require(_0x0127('0x4'));var controller=require(_0x0127('0x5'));router[_0x0127('0x6')]('/',auth[_0x0127('0x7')](),controller[_0x0127('0x8')]);router['get']('/describe',auth[_0x0127('0x7')](),controller[_0x0127('0x9')]);router[_0x0127('0x6')]('/:id',auth[_0x0127('0x7')](),controller['show']);router[_0x0127('0x6')]('/:id/members',auth[_0x0127('0x7')](),controller['getMembers']);router['get'](_0x0127('0xa'),auth['isAuthenticated'](),controller[_0x0127('0xb')]);router[_0x0127('0x6')](_0x0127('0xc'),auth[_0x0127('0x7')](),controller[_0x0127('0xd')]);router[_0x0127('0xe')]('/',auth['isAuthenticated'](),controller[_0x0127('0xf')]);router[_0x0127('0xe')](_0x0127('0xa'),auth[_0x0127('0x7')](),controller['addTeams']);router['post'](_0x0127('0xc'),auth[_0x0127('0x7')](),controller[_0x0127('0x10')]);router[_0x0127('0x11')](_0x0127('0x12'),auth[_0x0127('0x7')](),controller[_0x0127('0x13')]);router[_0x0127('0x14')](_0x0127('0x12'),auth[_0x0127('0x7')](),controller['destroy']);router[_0x0127('0x14')]('/:id/teams',auth[_0x0127('0x7')](),controller['removeTeams']);router['delete'](_0x0127('0xc'),auth[_0x0127('0x7')](),controller[_0x0127('0x15')]);module['exports']=router; \ No newline at end of file diff --git a/server/api/mailQueue/mailQueue.attributes.js b/server/api/mailQueue/mailQueue.attributes.js index da4e82f..94d2636 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 _0x245f=['ENUM','beepall','roundrobin','sequelize','name','STRING'];(function(_0x2cdd7f,_0xe47114){var _0x2c01d8=function(_0x33a95b){while(--_0x33a95b){_0x2cdd7f['push'](_0x2cdd7f['shift']());}};_0x2c01d8(++_0xe47114);}(_0x245f,0x1dd));var _0xf245=function(_0x39e698,_0x53b7e7){_0x39e698=_0x39e698-0x0;var _0x3e6a69=_0x245f[_0x39e698];return _0x3e6a69;};'use strict';var Sequelize=require(_0xf245('0x0'));module['exports']={'name':{'type':Sequelize['STRING'],'unique':_0xf245('0x1'),'validate':{'notEmpty':!![],'is':/^[A-Za-z0-9\.\_]+$/i}},'description':{'type':Sequelize[_0xf245('0x2')]},'timeout':{'type':Sequelize['INTEGER'],'validate':{'min':0x1,'max':0x20c49b}},'strategy':{'type':Sequelize[_0xf245('0x3')]('rrmemory',_0xf245('0x4'),_0xf245('0x5'))}}; \ No newline at end of file +var _0x9e4f=['exports','name','STRING','INTEGER','ENUM','rrmemory','sequelize'];(function(_0x3922ca,_0x1fa70e){var _0x41ff55=function(_0x5a500b){while(--_0x5a500b){_0x3922ca['push'](_0x3922ca['shift']());}};_0x41ff55(++_0x1fa70e);}(_0x9e4f,0x76));var _0xf9e4=function(_0x563f44,_0x5295ba){_0x563f44=_0x563f44-0x0;var _0x1f8f27=_0x9e4f[_0x563f44];return _0x1f8f27;};'use strict';var Sequelize=require(_0xf9e4('0x0'));module[_0xf9e4('0x1')]={'name':{'type':Sequelize['STRING'],'unique':_0xf9e4('0x2'),'validate':{'notEmpty':!![],'is':/^[A-Za-z0-9\.\_]+$/i}},'description':{'type':Sequelize[_0xf9e4('0x3')]},'timeout':{'type':Sequelize[_0xf9e4('0x4')],'validate':{'min':0x1,'max':0x20c49b}},'strategy':{'type':Sequelize[_0xf9e4('0x5')](_0xf9e4('0x6'),'beepall','roundrobin')}}; \ No newline at end of file diff --git a/server/api/mailQueue/mailQueue.controller.js b/server/api/mailQueue/mailQueue.controller.js index 5cf38fe..74a43f7 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 _0x753b=['body','describe','getMembers','findOne','keys','UserMailQueue','length','hasOwnProperty','nolimit','order','sort','MailQueueId','merge','findAll','User','findAndCountAll','UserId','mailPause','updatedAt','createdAt','rows','format','%s/%s','SIP','Team','pick','getTeams','ids','Agents','online','interface','flatMap','sequelize','transaction','addTeams','each','findOrCreate','forEach','emit','userMailQueue:save','removeTeams','select','field','tq.TeamId','from','join','ut.TeamId\x20=\x20tq.TeamId','MailQueueId\x20=\x20?','clone','push','toString','every','TeamId','all','isEmpty','addAgents','omit','removeAgents','isArray','userMailQueue:remove','getAgents','filter','bluebird','util','ioredis','../../components/parsers/qs','api','../../config/environment','../../mysqldb','defaults','redis','localhost','socket.io-emitter','./mailQueue.socket','register','sendStatus','status','end','json','offset','undefined','limit','count','set','Content-Range','destroy','MailQueues','UserProfileResource','then','error','send','map','rawAttributes','fieldName','type','getOptions','where','include','catch','show','params','MailQueue','query','filters','model','attributes','intersection','fields','includeAll','options','find','create','user','Unable\x20to\x20retrieve\x20the\x20current\x20user','role','get','UserProfileSection','userProfileId','name','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','update'];(function(_0x3f113f,_0x2c3b0e){var _0xdc2c91=function(_0x4e6c37){while(--_0x4e6c37){_0x3f113f['push'](_0x3f113f['shift']());}};_0xdc2c91(++_0x2c3b0e);}(_0x753b,0xb7));var _0xb753=function(_0x58c053,_0x51c43f){_0x58c053=_0x58c053-0x0;var _0xe1079=_0x753b[_0x58c053];return _0xe1079;};'use strict';var BPromise=require(_0xb753('0x0'));var util=require(_0xb753('0x1'));var _=require('lodash');var squel=require('squel');var Redis=require(_0xb753('0x2'));var qs=require(_0xb753('0x3'));var logger=require('../../config/logger')(_0xb753('0x4'));var config=require(_0xb753('0x5'));var db=require(_0xb753('0x6'))['db'];config['redis']=_[_0xb753('0x7')](config[_0xb753('0x8')],{'host':_0xb753('0x9'),'port':0x18eb});var socket=require(_0xb753('0xa'))(new Redis(config[_0xb753('0x8')]));require(_0xb753('0xb'))[_0xb753('0xc')](socket);function respondWithStatusCode(_0x545923,_0x40e0f8){_0x40e0f8=_0x40e0f8||0xcc;return function(_0x1d8db7){if(_0x1d8db7){return _0x545923[_0xb753('0xd')](_0x40e0f8);}return _0x545923[_0xb753('0xe')](_0x40e0f8)[_0xb753('0xf')]();};}function respondWithResult(_0x57c9f5,_0x36de5b){_0x36de5b=_0x36de5b||0xc8;return function(_0x484e72){if(_0x484e72){return _0x57c9f5[_0xb753('0xe')](_0x36de5b)[_0xb753('0x10')](_0x484e72);}};}function respondWithFilteredResult(_0x3adf5e,_0x390499){return function(_0x162967){if(_0x162967){var _0x3ed49d=typeof _0x390499[_0xb753('0x11')]===_0xb753('0x12')&&typeof _0x390499[_0xb753('0x13')]===_0xb753('0x12');var _0x56a891=_0x162967[_0xb753('0x14')];var _0x36cf38=_0x3ed49d?0x0:_0x390499[_0xb753('0x11')];var _0x18e730=_0x3ed49d?_0x162967[_0xb753('0x14')]:_0x390499['offset']+_0x390499[_0xb753('0x13')];var _0x2e92ca;if(_0x18e730>=_0x56a891){_0x18e730=_0x56a891;_0x2e92ca=0xc8;}else{_0x2e92ca=0xce;}_0x3adf5e['status'](_0x2e92ca);return _0x3adf5e[_0xb753('0x15')](_0xb753('0x16'),_0x36cf38+'-'+_0x18e730+'/'+_0x56a891)[_0xb753('0x10')](_0x162967);}return null;};}function saveUpdates(_0x5e9088){return function(_0xfab903){if(_0xfab903){return _0xfab903['update'](_0x5e9088)['then'](function(_0x4d10f6){return _0x4d10f6;});}return null;};}function removeEntity(_0x4815cf){return function(_0x241d77){if(_0x241d77){return _0x241d77[_0xb753('0x17')]()['then'](function(){var _0x4be3a5=_0x241d77['get']({'plain':!![]});var _0xb7c2a0=_0xb753('0x18');return db[_0xb753('0x19')][_0xb753('0x17')]({'where':{'type':_0xb7c2a0,'resourceId':_0x4be3a5['id']}})[_0xb753('0x1a')](function(){return _0x241d77;});})['then'](function(){_0x4815cf[_0xb753('0xe')](0xcc)[_0xb753('0xf')]();});}};}function handleEntityNotFound(_0x44f8ee){return function(_0x31fab2){if(!_0x31fab2){_0x44f8ee[_0xb753('0xd')](0x194);}return _0x31fab2;};}function handleError(_0x20259b,_0x1b75a4){_0x1b75a4=_0x1b75a4||0x1f4;return function(_0x808853){logger[_0xb753('0x1b')](_0x808853['stack']);if(_0x808853['name']){delete _0x808853['name'];}_0x20259b[_0xb753('0xe')](_0x1b75a4)[_0xb753('0x1c')](_0x808853);};}exports['index']=function(_0x41fe0a,_0x227a06){var _0x540521={};var _0x3a7feb={'count':0x0,'rows':[]};var _0x5f3134=_[_0xb753('0x1d')](db['MailQueue'][_0xb753('0x1e')],function(_0x1ed627){return{'name':_0x1ed627[_0xb753('0x1f')],'type':_0x1ed627[_0xb753('0x20')]['key']};});_0x540521=qs[_0xb753('0x21')](_0x5f3134,_0x41fe0a);var _0x39d8d1={'where':_0x540521[_0xb753('0x22')]};return db['MailQueue'][_0xb753('0x14')](_0x39d8d1)[_0xb753('0x1a')](function(_0x43567f){_0x3a7feb[_0xb753('0x14')]=_0x43567f;_0x540521[_0xb753('0x23')]=qs[_0xb753('0x23')](_0x41fe0a['query']);return db['MailQueue']['findAll'](_0x540521);})[_0xb753('0x1a')](function(_0x3d31f1){_0x3a7feb['rows']=_0x3d31f1;return _0x3a7feb;})[_0xb753('0x1a')](respondWithFilteredResult(_0x227a06,_0x540521))[_0xb753('0x24')](handleError(_0x227a06,null));};exports[_0xb753('0x25')]=function(_0x1b3741,_0x1852d8){var _0x525c96={'raw':!![],'where':{'id':_0x1b3741[_0xb753('0x26')]['id']}},_0x4f5907={};_0x4f5907['model']=_['keys'](db[_0xb753('0x27')][_0xb753('0x1e')]);_0x4f5907['query']=_['keys'](_0x1b3741[_0xb753('0x28')]);_0x4f5907[_0xb753('0x29')]=_['intersection'](_0x4f5907[_0xb753('0x2a')],_0x4f5907[_0xb753('0x28')]);_0x525c96[_0xb753('0x2b')]=_[_0xb753('0x2c')](_0x4f5907[_0xb753('0x2a')],qs[_0xb753('0x2d')](_0x1b3741[_0xb753('0x28')][_0xb753('0x2d')]));_0x525c96['attributes']=_0x525c96[_0xb753('0x2b')]['length']?_0x525c96['attributes']:_0x4f5907['model'];if(_0x1b3741[_0xb753('0x28')][_0xb753('0x2e')]){_0x525c96['include']=[{'all':!![]}];}_0x525c96=_['merge']({},_0x525c96,_0x1b3741[_0xb753('0x2f')]);return db[_0xb753('0x27')][_0xb753('0x30')](_0x525c96)[_0xb753('0x1a')](handleEntityNotFound(_0x1852d8,null))[_0xb753('0x1a')](respondWithResult(_0x1852d8,null))[_0xb753('0x24')](handleError(_0x1852d8,null));};exports[_0xb753('0x31')]=function(_0x1ee1ed,_0x597e70){return db[_0xb753('0x27')][_0xb753('0x31')](_0x1ee1ed['body'],{})[_0xb753('0x1a')](function(_0x3e13c9){var _0xacb236=_0x1ee1ed[_0xb753('0x32')]['get']({'plain':!![]});if(!_0xacb236)throw new Error(_0xb753('0x33'));if(_0xacb236[_0xb753('0x34')]===_0xb753('0x32')){var _0x55b818=_0x3e13c9[_0xb753('0x35')]({'plain':!![]});var _0x2813e=_0xb753('0x18');return db[_0xb753('0x36')][_0xb753('0x30')]({'where':{'name':_0x2813e,'userProfileId':_0xacb236[_0xb753('0x37')]},'raw':!![]})['then'](function(_0x1567af){if(_0x1567af&&_0x1567af['autoAssociation']===0x0){return db['UserProfileResource'][_0xb753('0x31')]({'name':_0x55b818[_0xb753('0x38')],'resourceId':_0x55b818['id'],'type':_0x1567af[_0xb753('0x38')],'sectionId':_0x1567af['id']},{})['then'](function(){return _0x3e13c9;});}else{return _0x3e13c9;}})[_0xb753('0x24')](function(_0x5157d5){logger['error'](_0xb753('0x39'),_0x5157d5);throw _0x5157d5;});}return _0x3e13c9;})['then'](respondWithResult(_0x597e70,0xc9))[_0xb753('0x24')](handleError(_0x597e70,null));};exports[_0xb753('0x3a')]=function(_0x14f77e,_0x1dbea8){if(_0x14f77e[_0xb753('0x3b')]['id']){delete _0x14f77e[_0xb753('0x3b')]['id'];}return db[_0xb753('0x27')][_0xb753('0x30')]({'where':{'id':_0x14f77e['params']['id']}})['then'](handleEntityNotFound(_0x1dbea8,null))[_0xb753('0x1a')](saveUpdates(_0x14f77e['body'],null))[_0xb753('0x1a')](respondWithResult(_0x1dbea8,null))[_0xb753('0x24')](handleError(_0x1dbea8,null));};exports[_0xb753('0x17')]=function(_0x51c22f,_0x51c4e6){return db[_0xb753('0x27')][_0xb753('0x30')]({'where':{'id':_0x51c22f[_0xb753('0x26')]['id']}})[_0xb753('0x1a')](handleEntityNotFound(_0x51c4e6,null))['then'](removeEntity(_0x51c4e6,null))[_0xb753('0x24')](handleError(_0x51c4e6,null));};exports['describe']=function(_0x552b54,_0x2db56f){return db[_0xb753('0x27')][_0xb753('0x3c')]()[_0xb753('0x1a')](respondWithResult(_0x2db56f,null))[_0xb753('0x24')](handleError(_0x2db56f,null));};exports[_0xb753('0x3d')]=function(_0x7ffd85,_0x32523a){var _0x3289fb={'raw':!![],'where':{}},_0x559f0a={},_0x3f4929;return db['MailQueue'][_0xb753('0x3e')]({'where':{'id':_0x7ffd85[_0xb753('0x26')]['id']}})[_0xb753('0x1a')](handleEntityNotFound(_0x32523a,null))[_0xb753('0x1a')](function(_0x26a646){if(_0x26a646){_0x3f4929=_0x26a646['get']({'plain':!![]});_0x559f0a[_0xb753('0x2a')]=_[_0xb753('0x3f')](db[_0xb753('0x40')][_0xb753('0x1e')]);_0x559f0a[_0xb753('0x28')]=_[_0xb753('0x3f')](_0x7ffd85[_0xb753('0x28')]);_0x559f0a['filters']=_[_0xb753('0x2c')](_0x559f0a['model'],_0x559f0a[_0xb753('0x28')]);_0x3289fb['attributes']=_[_0xb753('0x2c')](_0x559f0a[_0xb753('0x2a')],qs[_0xb753('0x2d')](_0x7ffd85[_0xb753('0x28')][_0xb753('0x2d')]));_0x3289fb['attributes']=_0x3289fb[_0xb753('0x2b')][_0xb753('0x41')]?_0x3289fb[_0xb753('0x2b')]:_0x559f0a[_0xb753('0x2a')];if(!_0x7ffd85[_0xb753('0x28')][_0xb753('0x42')](_0xb753('0x43'))){_0x3289fb['limit']=qs[_0xb753('0x13')](_0x7ffd85[_0xb753('0x28')]['limit']);_0x3289fb['offset']=qs[_0xb753('0x11')](_0x7ffd85[_0xb753('0x28')][_0xb753('0x11')]);}_0x3289fb[_0xb753('0x44')]=qs[_0xb753('0x45')](_0x7ffd85['query'][_0xb753('0x45')]);_0x3289fb[_0xb753('0x22')]=qs[_0xb753('0x29')](_['pick'](_0x7ffd85['query'],_0x559f0a[_0xb753('0x29')]));_0x3289fb[_0xb753('0x22')][_0xb753('0x46')]=_0x26a646['id'];if(_0x7ffd85['query']['filter']){_0x3289fb[_0xb753('0x22')]=_[_0xb753('0x47')](_0x3289fb[_0xb753('0x22')],{'$or':_[_0xb753('0x1d')](_0x3289fb[_0xb753('0x2b')],function(_0x38126d){var _0x197a13={};_0x197a13[_0x38126d]={'$like':'%'+_0x7ffd85[_0xb753('0x28')]['filter']+'%'};return _0x197a13;})});}_0x3289fb=_['merge']({},_0x3289fb,_0x7ffd85['options']);return db[_0xb753('0x40')][_0xb753('0x48')](_0x3289fb);}})[_0xb753('0x1a')](function(_0x883ef9){if(_0x883ef9){return db[_0xb753('0x49')][_0xb753('0x4a')]({'where':{'id':_[_0xb753('0x1d')](_0x883ef9,_0xb753('0x4b')),'role':'agent'},'attributes':['id',_0xb753('0x38'),_0xb753('0x4c'),_0xb753('0x4d'),_0xb753('0x4e')]});}})['then'](function(_0x5e34e5){if(_0x5e34e5){return{'count':_0x5e34e5['count'],'rows':_[_0xb753('0x1d')](_0x5e34e5[_0xb753('0x4f')],function(_0x44cf4b){return{'membername':_0x44cf4b[_0xb753('0x38')],'UserId':_0x44cf4b['id'],'queue_name':_0x3f4929[_0xb753('0x38')],'MailQueueId':_0x3f4929['id'],'interface':util[_0xb753('0x50')](_0xb753('0x51'),_0xb753('0x52'),_0x44cf4b[_0xb753('0x38')]),'penalty':0x0,'paused':_0x44cf4b[_0xb753('0x4c')],'createdAt':_0x44cf4b[_0xb753('0x4e')],'updatedAt':_0x44cf4b['updatedAt']};})};}else{return{'count':0x0,'rows':[]};}})[_0xb753('0x1a')](respondWithFilteredResult(_0x32523a,_0x3289fb))[_0xb753('0x24')](handleError(_0x32523a,null));};exports['getTeams']=function(_0x49df24,_0x49ab9b){var _0x25ca87={};var _0x3dd939={};var _0x5eb301;var _0xb8c0ec;return db['MailQueue'][_0xb753('0x3e')]({'where':{'id':_0x49df24['params']['id']}})[_0xb753('0x1a')](handleEntityNotFound(_0x49ab9b,null))[_0xb753('0x1a')](function(_0x3cb9b5){if(_0x3cb9b5){_0x5eb301=_0x3cb9b5;_0x3dd939['model']=_[_0xb753('0x3f')](db[_0xb753('0x53')][_0xb753('0x1e')]);_0x3dd939['query']=_['keys'](_0x49df24[_0xb753('0x28')]);_0x3dd939[_0xb753('0x29')]=_['intersection'](_0x3dd939['model'],_0x3dd939[_0xb753('0x28')]);_0x25ca87[_0xb753('0x2b')]=_['intersection'](_0x3dd939[_0xb753('0x2a')],qs['fields'](_0x49df24['query'][_0xb753('0x2d')]));_0x25ca87[_0xb753('0x2b')]=_0x25ca87[_0xb753('0x2b')]['length']?_0x25ca87[_0xb753('0x2b')]:_0x3dd939[_0xb753('0x2a')];_0x25ca87['order']=qs['sort'](_0x49df24['query'][_0xb753('0x45')]);_0x25ca87[_0xb753('0x22')]=qs['filters'](_[_0xb753('0x54')](_0x49df24[_0xb753('0x28')],_0x3dd939[_0xb753('0x29')]));if(_0x49df24[_0xb753('0x28')]['filter']){_0x25ca87[_0xb753('0x22')]=_[_0xb753('0x47')](_0x25ca87['where'],{'$or':_[_0xb753('0x1d')](_0x25ca87[_0xb753('0x2b')],function(_0x315e40){var _0x32bc6c={};_0x32bc6c[_0x315e40]={'$like':'%'+_0x49df24[_0xb753('0x28')]['filter']+'%'};return _0x32bc6c;})});}_0x25ca87=_[_0xb753('0x47')]({},_0x25ca87,_0x49df24[_0xb753('0x2f')]);return _0x5eb301[_0xb753('0x55')](_0x25ca87);}})[_0xb753('0x1a')](function(_0x314267){if(_0x314267){_0xb8c0ec=_0x314267[_0xb753('0x41')];if(!_0x49df24['query'][_0xb753('0x42')](_0xb753('0x43'))){_0x25ca87[_0xb753('0x13')]=qs['limit'](_0x49df24['query'][_0xb753('0x13')]);_0x25ca87[_0xb753('0x11')]=qs[_0xb753('0x11')](_0x49df24[_0xb753('0x28')]['offset']);}return _0x5eb301[_0xb753('0x55')](_0x25ca87);}})[_0xb753('0x1a')](function(_0x4389f6){if(_0x4389f6){return _0x4389f6?{'count':_0xb8c0ec,'rows':_0x4389f6}:null;}})['then'](respondWithResult(_0x49ab9b,null))['catch'](handleError(_0x49ab9b,null));};exports['addTeams']=function(_0x2917be,_0x304f02){var _0x252be2=_0x2917be['body'][_0xb753('0x56')];return db[_0xb753('0x53')][_0xb753('0x48')]({'where':{'id':_0x252be2},'attributes':['id'],'include':[{'model':db[_0xb753('0x49')],'as':_0xb753('0x57'),'attributes':['id',_0xb753('0x38'),_0xb753('0x58'),'voicePause',_0xb753('0x59')],'raw':!![]}]})[_0xb753('0x1a')](function(_0x5808f7){if(_0x5808f7){var _0x427df9=_[_0xb753('0x5a')](_0x5808f7,function(_0x347cc5){var _0x5c2ede=_0x347cc5[_0xb753('0x35')]({'plain':!![]});return _0x5c2ede[_0xb753('0x57')];});return db[_0xb753('0x27')][_0xb753('0x30')]({'where':{'id':_0x2917be[_0xb753('0x26')]['id']}})[_0xb753('0x1a')](function(_0x14fd82){return db[_0xb753('0x5b')][_0xb753('0x5c')](function(_0xb9c98f){return _0x14fd82[_0xb753('0x5d')](_0x252be2,{'transaction':_0xb9c98f})[_0xb753('0x1a')](function(){return BPromise[_0xb753('0x5e')](_0x427df9,function(_0x1d7980){return db['UserMailQueue'][_0xb753('0x5f')]({'where':{'UserId':_0x1d7980['id'],'MailQueueId':_0x2917be[_0xb753('0x26')]['id']},'transaction':_0xb9c98f});});})[_0xb753('0x1a')](function(){_0x427df9[_0xb753('0x60')](function(_0x49e701){socket[_0xb753('0x61')](_0xb753('0x62'),{'UserId':_0x49e701['id'],'MailQueueId':_0x14fd82['id']});});});});});}})[_0xb753('0x1a')](respondWithStatusCode(_0x304f02,null))[_0xb753('0x24')](handleError(_0x304f02,null));};exports[_0xb753('0x63')]=function(_0x50c221,_0x49a5c3){return db[_0xb753('0x53')][_0xb753('0x48')]({'where':{'id':_0x50c221[_0xb753('0x28')][_0xb753('0x56')]},'attributes':['id'],'include':[{'model':db[_0xb753('0x49')],'as':'Agents','attributes':['id'],'raw':!![]}]})['then'](handleEntityNotFound(_0x49a5c3,null))[_0xb753('0x1a')](function(_0x4061d1){var _0xf6a4d7=_['map'](_0x4061d1,'id');var _0x30dc9a=[];var _0x40e047=[];var _0x2093ab=squel[_0xb753('0x64')]();_0x2093ab[_0xb753('0x65')](_0xb753('0x66'))[_0xb753('0x67')]('team_has_mail_queues','tq')[_0xb753('0x68')]('user_has_teams','ut',_0xb753('0x69'))[_0xb753('0x22')](_0xb753('0x6a'),_0x50c221['params']['id']);for(var _0x216a11=0x0;_0x216a11<_0x4061d1[_0xb753('0x41')];_0x216a11+=0x1){let _0x43b002=_0x4061d1[_0x216a11];for(var _0x13107e=0x0;_0x13107e<_0x43b002[_0xb753('0x57')][_0xb753('0x41')];_0x13107e+=0x1){let _0x53a10e=_0x43b002['Agents'][_0x13107e];var _0x35b179=_0x2093ab[_0xb753('0x6b')]();_0x35b179['where']('ut.UserId\x20=\x20?',_0x53a10e['id']);_0x40e047[_0xb753('0x6c')](db[_0xb753('0x5b')]['query'](_0x35b179[_0xb753('0x6d')](),{'type':db['sequelize']['QueryTypes']['SELECT']})[_0xb753('0x1a')](function(_0x549df4){if(_0x549df4[_0xb753('0x41')]===0x1){return _0x53a10e['id'];}else{var _0x58ed41=_[_0xb753('0x6e')](_['map'](_0x549df4,_0xb753('0x6f')),function(_0x241d6e){return _['includes'](_0xf6a4d7,_0x241d6e);});if(_0x58ed41){return _0x53a10e['id'];}}}));}}return BPromise[_0xb753('0x70')](_0x40e047)['then'](function(_0x540141){_0x30dc9a=_(_0x30dc9a)['union'](_0x540141)['compact']()['value']();return db[_0xb753('0x27')]['find']({'where':{'id':_0x50c221['params']['id']}})[_0xb753('0x1a')](function(_0x1ee34d){return db[_0xb753('0x5b')][_0xb753('0x5c')](function(_0x57d078){return _0x1ee34d['removeTeams'](_0x50c221[_0xb753('0x28')]['ids'],{'transaction':_0x57d078})[_0xb753('0x1a')](function(){if(!_[_0xb753('0x71')](_0x30dc9a)){return _0x1ee34d['removeAgents'](_0x30dc9a,{'transaction':_0x57d078});}})[_0xb753('0x1a')](function(){_0x30dc9a['forEach'](function(_0x547c87){socket['emit']('userMailQueue:remove',{'UserId':_0x547c87,'MailQueueId':_0x1ee34d['id']});});});});});});})['then'](respondWithStatusCode(_0x49a5c3,null))[_0xb753('0x24')](handleError(_0x49a5c3,null));};exports[_0xb753('0x72')]=function(_0x2e06e0,_0x38f42f){return db['MailQueue']['find']({'where':{'id':_0x2e06e0[_0xb753('0x26')]['id']}})[_0xb753('0x1a')](handleEntityNotFound(_0x38f42f,null))['then'](function(_0x3d1a67){if(_0x3d1a67){return _0x3d1a67['addAgents'](_0x2e06e0[_0xb753('0x3b')][_0xb753('0x56')],_[_0xb753('0x73')](_0x2e06e0[_0xb753('0x3b')],[_0xb753('0x56'),'id'])||{})['spread'](function(_0x4a8ff9){for(var _0x47510c=0x0;_0x47510c<_0x2e06e0[_0xb753('0x3b')][_0xb753('0x56')][_0xb753('0x41')];_0x47510c+=0x1){socket[_0xb753('0x61')](_0xb753('0x62'),{'UserId':Number(_0x2e06e0[_0xb753('0x3b')][_0xb753('0x56')][_0x47510c]),'MailQueueId':Number(_0x2e06e0[_0xb753('0x26')]['id'])});}return _0x4a8ff9;});}})[_0xb753('0x1a')](respondWithResult(_0x38f42f,null))[_0xb753('0x24')](handleError(_0x38f42f,null));};exports[_0xb753('0x74')]=function(_0x1b6812,_0x34aec4){return db[_0xb753('0x27')][_0xb753('0x30')]({'where':{'id':_0x1b6812[_0xb753('0x26')]['id']}})[_0xb753('0x1a')](handleEntityNotFound(_0x34aec4,null))[_0xb753('0x1a')](function(_0x19dfdb){if(_0x19dfdb){return _0x19dfdb[_0xb753('0x74')](_0x1b6812[_0xb753('0x28')][_0xb753('0x56')])['then'](function(){if(_[_0xb753('0x75')](_0x1b6812['query'][_0xb753('0x56')])){for(var _0x442f1b=0x0;_0x442f1b<_0x1b6812['query'][_0xb753('0x56')][_0xb753('0x41')];_0x442f1b+=0x1){socket[_0xb753('0x61')]('userMailQueue:remove',{'UserId':Number(_0x1b6812['query'][_0xb753('0x56')][_0x442f1b]),'MailQueueId':Number(_0x1b6812[_0xb753('0x26')]['id'])});}}else{socket[_0xb753('0x61')](_0xb753('0x76'),{'UserId':Number(_0x1b6812[_0xb753('0x28')][_0xb753('0x56')]),'MailQueueId':Number(_0x1b6812[_0xb753('0x26')]['id'])});}});}})[_0xb753('0x1a')](respondWithStatusCode(_0x34aec4,null))['catch'](handleError(_0x34aec4,null));};exports[_0xb753('0x77')]=function(_0x426fa9,_0x4a7261){var _0x3c1303={};var _0x1220c0={};var _0x3b68c3;var _0x3ce3e1;return db[_0xb753('0x27')][_0xb753('0x3e')]({'where':{'id':_0x426fa9[_0xb753('0x26')]['id']}})[_0xb753('0x1a')](handleEntityNotFound(_0x4a7261,null))[_0xb753('0x1a')](function(_0x326ca9){if(_0x326ca9){_0x3b68c3=_0x326ca9;_0x1220c0[_0xb753('0x2a')]=_['keys'](db['User'][_0xb753('0x1e')]);_0x1220c0[_0xb753('0x28')]=_['keys'](_0x426fa9[_0xb753('0x28')]);_0x1220c0[_0xb753('0x29')]=_['intersection'](_0x1220c0[_0xb753('0x2a')],_0x1220c0['query']);_0x3c1303['attributes']=_['intersection'](_0x1220c0[_0xb753('0x2a')],qs['fields'](_0x426fa9['query'][_0xb753('0x2d')]));_0x3c1303[_0xb753('0x2b')]=_0x3c1303[_0xb753('0x2b')][_0xb753('0x41')]?_0x3c1303[_0xb753('0x2b')]:_0x1220c0[_0xb753('0x2a')];_0x3c1303[_0xb753('0x44')]=qs['sort'](_0x426fa9[_0xb753('0x28')][_0xb753('0x45')]);_0x3c1303[_0xb753('0x22')]=qs[_0xb753('0x29')](_[_0xb753('0x54')](_0x426fa9[_0xb753('0x28')],_0x1220c0[_0xb753('0x29')]));if(_0x426fa9['query'][_0xb753('0x78')]){_0x3c1303[_0xb753('0x22')]=_['merge'](_0x3c1303[_0xb753('0x22')],{'$or':_[_0xb753('0x1d')](_0x3c1303['attributes'],function(_0x24b262){var _0xee896f={};_0xee896f[_0x24b262]={'$like':'%'+_0x426fa9[_0xb753('0x28')][_0xb753('0x78')]+'%'};return _0xee896f;})});}_0x3c1303=_['merge']({},_0x3c1303,_0x426fa9[_0xb753('0x2f')]);return _0x3b68c3[_0xb753('0x77')](_0x3c1303);}})[_0xb753('0x1a')](function(_0x2c8de7){if(_0x2c8de7){_0x3ce3e1=_0x2c8de7[_0xb753('0x41')];if(!_0x426fa9['query'][_0xb753('0x42')](_0xb753('0x43'))){_0x3c1303[_0xb753('0x13')]=qs[_0xb753('0x13')](_0x426fa9['query'][_0xb753('0x13')]);_0x3c1303[_0xb753('0x11')]=qs[_0xb753('0x11')](_0x426fa9['query']['offset']);}return _0x3b68c3[_0xb753('0x77')](_0x3c1303);}})[_0xb753('0x1a')](function(_0x1c33b7){if(_0x1c33b7){return _0x1c33b7?{'count':_0x3ce3e1,'rows':_0x1c33b7}:null;}})[_0xb753('0x1a')](respondWithResult(_0x4a7261,null))['catch'](handleError(_0x4a7261,null));}; \ No newline at end of file +var _0xcdb0=['MailQueues','UserProfileResource','end','error','stack','name','send','index','map','MailQueue','rawAttributes','key','where','query','findAll','catch','params','model','keys','filters','intersection','attributes','fields','length','includeAll','include','merge','options','find','create','body','user','Unable\x20to\x20retrieve\x20the\x20current\x20user','UserProfileSection','userProfileId','autoAssociation','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','getMembers','findOne','UserMailQueue','hasOwnProperty','nolimit','order','sort','pick','MailQueueId','filter','findAndCountAll','UserId','agent','mailPause','updatedAt','createdAt','rows','%s/%s','SIP','getTeams','Team','addTeams','ids','Agents','online','voicePause','flatMap','transaction','each','findOrCreate','emit','userMailQueue:save','removeTeams','User','from','team_has_mail_queues','join','user_has_teams','ut.TeamId\x20=\x20tq.TeamId','MailQueueId\x20=\x20?','ut.UserId\x20=\x20?','push','toString','sequelize','QueryTypes','SELECT','includes','all','union','compact','value','userMailQueue:remove','addAgents','omit','spread','removeAgents','isArray','getAgents','util','../../components/parsers/qs','../../config/logger','api','../../mysqldb','redis','defaults','localhost','socket.io-emitter','./mailQueue.socket','register','sendStatus','status','json','offset','undefined','limit','count','set','Content-Range','update','then','destroy','get'];(function(_0x47364e,_0x4ab744){var _0x7f564b=function(_0x552bd7){while(--_0x552bd7){_0x47364e['push'](_0x47364e['shift']());}};_0x7f564b(++_0x4ab744);}(_0xcdb0,0x14d));var _0x0cdb=function(_0x391264,_0x22e0d7){_0x391264=_0x391264-0x0;var _0x46f7d3=_0xcdb0[_0x391264];return _0x46f7d3;};'use strict';var BPromise=require('bluebird');var util=require(_0x0cdb('0x0'));var _=require('lodash');var squel=require('squel');var Redis=require('ioredis');var qs=require(_0x0cdb('0x1'));var logger=require(_0x0cdb('0x2'))(_0x0cdb('0x3'));var config=require('../../config/environment');var db=require(_0x0cdb('0x4'))['db'];config[_0x0cdb('0x5')]=_[_0x0cdb('0x6')](config[_0x0cdb('0x5')],{'host':_0x0cdb('0x7'),'port':0x18eb});var socket=require(_0x0cdb('0x8'))(new Redis(config[_0x0cdb('0x5')]));require(_0x0cdb('0x9'))[_0x0cdb('0xa')](socket);function respondWithStatusCode(_0x30cb66,_0x1baf34){_0x1baf34=_0x1baf34||0xcc;return function(_0x1f785a){if(_0x1f785a){return _0x30cb66[_0x0cdb('0xb')](_0x1baf34);}return _0x30cb66[_0x0cdb('0xc')](_0x1baf34)['end']();};}function respondWithResult(_0x50fed7,_0x1c6024){_0x1c6024=_0x1c6024||0xc8;return function(_0x43bde9){if(_0x43bde9){return _0x50fed7['status'](_0x1c6024)[_0x0cdb('0xd')](_0x43bde9);}};}function respondWithFilteredResult(_0x1ac53e,_0x5b6945){return function(_0x1f0b25){if(_0x1f0b25){var _0x3eed75=typeof _0x5b6945[_0x0cdb('0xe')]===_0x0cdb('0xf')&&typeof _0x5b6945[_0x0cdb('0x10')]==='undefined';var _0x121e51=_0x1f0b25[_0x0cdb('0x11')];var _0x17f6ad=_0x3eed75?0x0:_0x5b6945[_0x0cdb('0xe')];var _0xb617a=_0x3eed75?_0x1f0b25['count']:_0x5b6945[_0x0cdb('0xe')]+_0x5b6945['limit'];var _0x3042a0;if(_0xb617a>=_0x121e51){_0xb617a=_0x121e51;_0x3042a0=0xc8;}else{_0x3042a0=0xce;}_0x1ac53e[_0x0cdb('0xc')](_0x3042a0);return _0x1ac53e[_0x0cdb('0x12')](_0x0cdb('0x13'),_0x17f6ad+'-'+_0xb617a+'/'+_0x121e51)[_0x0cdb('0xd')](_0x1f0b25);}return null;};}function saveUpdates(_0x11bd2f){return function(_0x58132d){if(_0x58132d){return _0x58132d[_0x0cdb('0x14')](_0x11bd2f)[_0x0cdb('0x15')](function(_0x1a6f74){return _0x1a6f74;});}return null;};}function removeEntity(_0x266e74){return function(_0x51b718){if(_0x51b718){return _0x51b718[_0x0cdb('0x16')]()[_0x0cdb('0x15')](function(){var _0x2572f9=_0x51b718[_0x0cdb('0x17')]({'plain':!![]});var _0x15aaff=_0x0cdb('0x18');return db[_0x0cdb('0x19')]['destroy']({'where':{'type':_0x15aaff,'resourceId':_0x2572f9['id']}})[_0x0cdb('0x15')](function(){return _0x51b718;});})[_0x0cdb('0x15')](function(){_0x266e74['status'](0xcc)[_0x0cdb('0x1a')]();});}};}function handleEntityNotFound(_0x424705){return function(_0x3232a6){if(!_0x3232a6){_0x424705[_0x0cdb('0xb')](0x194);}return _0x3232a6;};}function handleError(_0xa886e5,_0x5923a6){_0x5923a6=_0x5923a6||0x1f4;return function(_0x4d5ab9){logger[_0x0cdb('0x1b')](_0x4d5ab9[_0x0cdb('0x1c')]);if(_0x4d5ab9['name']){delete _0x4d5ab9[_0x0cdb('0x1d')];}_0xa886e5['status'](_0x5923a6)[_0x0cdb('0x1e')](_0x4d5ab9);};}exports[_0x0cdb('0x1f')]=function(_0x3e5f29,_0x24f1c5){var _0x4267d3={};var _0x122298={'count':0x0,'rows':[]};var _0x2e860a=_[_0x0cdb('0x20')](db[_0x0cdb('0x21')][_0x0cdb('0x22')],function(_0x37ef8b){return{'name':_0x37ef8b['fieldName'],'type':_0x37ef8b['type'][_0x0cdb('0x23')]};});_0x4267d3=qs['getOptions'](_0x2e860a,_0x3e5f29);var _0x23f7fd={'where':_0x4267d3[_0x0cdb('0x24')]};return db[_0x0cdb('0x21')]['count'](_0x23f7fd)[_0x0cdb('0x15')](function(_0x3c451a){_0x122298['count']=_0x3c451a;_0x4267d3['include']=qs['include'](_0x3e5f29[_0x0cdb('0x25')]);return db[_0x0cdb('0x21')][_0x0cdb('0x26')](_0x4267d3);})['then'](function(_0xac885e){_0x122298['rows']=_0xac885e;return _0x122298;})[_0x0cdb('0x15')](respondWithFilteredResult(_0x24f1c5,_0x4267d3))[_0x0cdb('0x27')](handleError(_0x24f1c5,null));};exports['show']=function(_0xe01b6c,_0x1a8871){var _0x11e66a={'raw':!![],'where':{'id':_0xe01b6c[_0x0cdb('0x28')]['id']}},_0x187d35={};_0x187d35[_0x0cdb('0x29')]=_[_0x0cdb('0x2a')](db[_0x0cdb('0x21')]['rawAttributes']);_0x187d35[_0x0cdb('0x25')]=_[_0x0cdb('0x2a')](_0xe01b6c['query']);_0x187d35[_0x0cdb('0x2b')]=_[_0x0cdb('0x2c')](_0x187d35[_0x0cdb('0x29')],_0x187d35[_0x0cdb('0x25')]);_0x11e66a[_0x0cdb('0x2d')]=_[_0x0cdb('0x2c')](_0x187d35['model'],qs[_0x0cdb('0x2e')](_0xe01b6c[_0x0cdb('0x25')][_0x0cdb('0x2e')]));_0x11e66a['attributes']=_0x11e66a['attributes'][_0x0cdb('0x2f')]?_0x11e66a['attributes']:_0x187d35['model'];if(_0xe01b6c[_0x0cdb('0x25')][_0x0cdb('0x30')]){_0x11e66a[_0x0cdb('0x31')]=[{'all':!![]}];}_0x11e66a=_[_0x0cdb('0x32')]({},_0x11e66a,_0xe01b6c[_0x0cdb('0x33')]);return db[_0x0cdb('0x21')][_0x0cdb('0x34')](_0x11e66a)[_0x0cdb('0x15')](handleEntityNotFound(_0x1a8871,null))[_0x0cdb('0x15')](respondWithResult(_0x1a8871,null))[_0x0cdb('0x27')](handleError(_0x1a8871,null));};exports[_0x0cdb('0x35')]=function(_0x32531a,_0x4f248f){return db[_0x0cdb('0x21')][_0x0cdb('0x35')](_0x32531a[_0x0cdb('0x36')],{})[_0x0cdb('0x15')](function(_0x3f0a8f){var _0x2be1d0=_0x32531a[_0x0cdb('0x37')][_0x0cdb('0x17')]({'plain':!![]});if(!_0x2be1d0)throw new Error(_0x0cdb('0x38'));if(_0x2be1d0['role']===_0x0cdb('0x37')){var _0x409509=_0x3f0a8f[_0x0cdb('0x17')]({'plain':!![]});var _0x2cef47=_0x0cdb('0x18');return db[_0x0cdb('0x39')][_0x0cdb('0x34')]({'where':{'name':_0x2cef47,'userProfileId':_0x2be1d0[_0x0cdb('0x3a')]},'raw':!![]})[_0x0cdb('0x15')](function(_0x52b9d8){if(_0x52b9d8&&_0x52b9d8[_0x0cdb('0x3b')]===0x0){return db[_0x0cdb('0x19')][_0x0cdb('0x35')]({'name':_0x409509[_0x0cdb('0x1d')],'resourceId':_0x409509['id'],'type':_0x52b9d8['name'],'sectionId':_0x52b9d8['id']},{})[_0x0cdb('0x15')](function(){return _0x3f0a8f;});}else{return _0x3f0a8f;}})[_0x0cdb('0x27')](function(_0x17e37d){logger[_0x0cdb('0x1b')](_0x0cdb('0x3c'),_0x17e37d);throw _0x17e37d;});}return _0x3f0a8f;})[_0x0cdb('0x15')](respondWithResult(_0x4f248f,0xc9))[_0x0cdb('0x27')](handleError(_0x4f248f,null));};exports['update']=function(_0x8cce3b,_0x8ab555){if(_0x8cce3b[_0x0cdb('0x36')]['id']){delete _0x8cce3b[_0x0cdb('0x36')]['id'];}return db['MailQueue']['find']({'where':{'id':_0x8cce3b[_0x0cdb('0x28')]['id']}})[_0x0cdb('0x15')](handleEntityNotFound(_0x8ab555,null))[_0x0cdb('0x15')](saveUpdates(_0x8cce3b['body'],null))[_0x0cdb('0x15')](respondWithResult(_0x8ab555,null))[_0x0cdb('0x27')](handleError(_0x8ab555,null));};exports['destroy']=function(_0x1a4f00,_0x2a71cc){return db[_0x0cdb('0x21')]['find']({'where':{'id':_0x1a4f00[_0x0cdb('0x28')]['id']}})[_0x0cdb('0x15')](handleEntityNotFound(_0x2a71cc,null))[_0x0cdb('0x15')](removeEntity(_0x2a71cc,null))[_0x0cdb('0x27')](handleError(_0x2a71cc,null));};exports['describe']=function(_0xdcf465,_0x498070){return db[_0x0cdb('0x21')]['describe']()[_0x0cdb('0x15')](respondWithResult(_0x498070,null))[_0x0cdb('0x27')](handleError(_0x498070,null));};exports[_0x0cdb('0x3d')]=function(_0x19dc5c,_0x3a4ef4){var _0x507dbe={'raw':!![],'where':{}},_0x426e25={},_0x3f2c8a;return db[_0x0cdb('0x21')][_0x0cdb('0x3e')]({'where':{'id':_0x19dc5c[_0x0cdb('0x28')]['id']}})[_0x0cdb('0x15')](handleEntityNotFound(_0x3a4ef4,null))[_0x0cdb('0x15')](function(_0x3749c4){if(_0x3749c4){_0x3f2c8a=_0x3749c4[_0x0cdb('0x17')]({'plain':!![]});_0x426e25[_0x0cdb('0x29')]=_['keys'](db[_0x0cdb('0x3f')][_0x0cdb('0x22')]);_0x426e25[_0x0cdb('0x25')]=_[_0x0cdb('0x2a')](_0x19dc5c[_0x0cdb('0x25')]);_0x426e25[_0x0cdb('0x2b')]=_[_0x0cdb('0x2c')](_0x426e25[_0x0cdb('0x29')],_0x426e25['query']);_0x507dbe['attributes']=_[_0x0cdb('0x2c')](_0x426e25[_0x0cdb('0x29')],qs[_0x0cdb('0x2e')](_0x19dc5c[_0x0cdb('0x25')][_0x0cdb('0x2e')]));_0x507dbe['attributes']=_0x507dbe['attributes'][_0x0cdb('0x2f')]?_0x507dbe[_0x0cdb('0x2d')]:_0x426e25[_0x0cdb('0x29')];if(!_0x19dc5c[_0x0cdb('0x25')][_0x0cdb('0x40')](_0x0cdb('0x41'))){_0x507dbe['limit']=qs['limit'](_0x19dc5c[_0x0cdb('0x25')][_0x0cdb('0x10')]);_0x507dbe['offset']=qs[_0x0cdb('0xe')](_0x19dc5c[_0x0cdb('0x25')]['offset']);}_0x507dbe[_0x0cdb('0x42')]=qs['sort'](_0x19dc5c[_0x0cdb('0x25')][_0x0cdb('0x43')]);_0x507dbe[_0x0cdb('0x24')]=qs[_0x0cdb('0x2b')](_[_0x0cdb('0x44')](_0x19dc5c['query'],_0x426e25[_0x0cdb('0x2b')]));_0x507dbe[_0x0cdb('0x24')][_0x0cdb('0x45')]=_0x3749c4['id'];if(_0x19dc5c[_0x0cdb('0x25')][_0x0cdb('0x46')]){_0x507dbe[_0x0cdb('0x24')]=_['merge'](_0x507dbe['where'],{'$or':_[_0x0cdb('0x20')](_0x507dbe[_0x0cdb('0x2d')],function(_0x28cf58){var _0x4bc7cd={};_0x4bc7cd[_0x28cf58]={'$like':'%'+_0x19dc5c[_0x0cdb('0x25')]['filter']+'%'};return _0x4bc7cd;})});}_0x507dbe=_[_0x0cdb('0x32')]({},_0x507dbe,_0x19dc5c[_0x0cdb('0x33')]);return db[_0x0cdb('0x3f')][_0x0cdb('0x26')](_0x507dbe);}})[_0x0cdb('0x15')](function(_0x4fb667){if(_0x4fb667){return db['User'][_0x0cdb('0x47')]({'where':{'id':_[_0x0cdb('0x20')](_0x4fb667,_0x0cdb('0x48')),'role':_0x0cdb('0x49')},'attributes':['id',_0x0cdb('0x1d'),_0x0cdb('0x4a'),_0x0cdb('0x4b'),_0x0cdb('0x4c')]});}})['then'](function(_0x86c39c){if(_0x86c39c){return{'count':_0x86c39c[_0x0cdb('0x11')],'rows':_[_0x0cdb('0x20')](_0x86c39c[_0x0cdb('0x4d')],function(_0x4d2dcf){return{'membername':_0x4d2dcf[_0x0cdb('0x1d')],'UserId':_0x4d2dcf['id'],'queue_name':_0x3f2c8a[_0x0cdb('0x1d')],'MailQueueId':_0x3f2c8a['id'],'interface':util['format'](_0x0cdb('0x4e'),_0x0cdb('0x4f'),_0x4d2dcf['name']),'penalty':0x0,'paused':_0x4d2dcf[_0x0cdb('0x4a')],'createdAt':_0x4d2dcf[_0x0cdb('0x4c')],'updatedAt':_0x4d2dcf[_0x0cdb('0x4b')]};})};}else{return{'count':0x0,'rows':[]};}})[_0x0cdb('0x15')](respondWithFilteredResult(_0x3a4ef4,_0x507dbe))[_0x0cdb('0x27')](handleError(_0x3a4ef4,null));};exports[_0x0cdb('0x50')]=function(_0x10e28a,_0x40498f){var _0x9ac1f6={};var _0x4c75eb={};var _0x5c53b8;var _0x8bab01;return db[_0x0cdb('0x21')][_0x0cdb('0x3e')]({'where':{'id':_0x10e28a['params']['id']}})[_0x0cdb('0x15')](handleEntityNotFound(_0x40498f,null))[_0x0cdb('0x15')](function(_0x4599e5){if(_0x4599e5){_0x5c53b8=_0x4599e5;_0x4c75eb[_0x0cdb('0x29')]=_[_0x0cdb('0x2a')](db[_0x0cdb('0x51')][_0x0cdb('0x22')]);_0x4c75eb[_0x0cdb('0x25')]=_['keys'](_0x10e28a[_0x0cdb('0x25')]);_0x4c75eb['filters']=_['intersection'](_0x4c75eb[_0x0cdb('0x29')],_0x4c75eb[_0x0cdb('0x25')]);_0x9ac1f6[_0x0cdb('0x2d')]=_[_0x0cdb('0x2c')](_0x4c75eb['model'],qs[_0x0cdb('0x2e')](_0x10e28a[_0x0cdb('0x25')][_0x0cdb('0x2e')]));_0x9ac1f6[_0x0cdb('0x2d')]=_0x9ac1f6[_0x0cdb('0x2d')][_0x0cdb('0x2f')]?_0x9ac1f6[_0x0cdb('0x2d')]:_0x4c75eb['model'];_0x9ac1f6[_0x0cdb('0x42')]=qs[_0x0cdb('0x43')](_0x10e28a[_0x0cdb('0x25')][_0x0cdb('0x43')]);_0x9ac1f6['where']=qs['filters'](_[_0x0cdb('0x44')](_0x10e28a[_0x0cdb('0x25')],_0x4c75eb[_0x0cdb('0x2b')]));if(_0x10e28a['query'][_0x0cdb('0x46')]){_0x9ac1f6[_0x0cdb('0x24')]=_['merge'](_0x9ac1f6[_0x0cdb('0x24')],{'$or':_[_0x0cdb('0x20')](_0x9ac1f6['attributes'],function(_0x758549){var _0x56cce9={};_0x56cce9[_0x758549]={'$like':'%'+_0x10e28a[_0x0cdb('0x25')]['filter']+'%'};return _0x56cce9;})});}_0x9ac1f6=_[_0x0cdb('0x32')]({},_0x9ac1f6,_0x10e28a[_0x0cdb('0x33')]);return _0x5c53b8[_0x0cdb('0x50')](_0x9ac1f6);}})[_0x0cdb('0x15')](function(_0xe09f30){if(_0xe09f30){_0x8bab01=_0xe09f30[_0x0cdb('0x2f')];if(!_0x10e28a[_0x0cdb('0x25')]['hasOwnProperty']('nolimit')){_0x9ac1f6[_0x0cdb('0x10')]=qs[_0x0cdb('0x10')](_0x10e28a[_0x0cdb('0x25')][_0x0cdb('0x10')]);_0x9ac1f6[_0x0cdb('0xe')]=qs['offset'](_0x10e28a[_0x0cdb('0x25')]['offset']);}return _0x5c53b8[_0x0cdb('0x50')](_0x9ac1f6);}})['then'](function(_0x20cd15){if(_0x20cd15){return _0x20cd15?{'count':_0x8bab01,'rows':_0x20cd15}:null;}})[_0x0cdb('0x15')](respondWithResult(_0x40498f,null))[_0x0cdb('0x27')](handleError(_0x40498f,null));};exports[_0x0cdb('0x52')]=function(_0x52ed7d,_0x579851){var _0x3fcfa3=_0x52ed7d[_0x0cdb('0x36')][_0x0cdb('0x53')];return db[_0x0cdb('0x51')]['findAll']({'where':{'id':_0x3fcfa3},'attributes':['id'],'include':[{'model':db['User'],'as':_0x0cdb('0x54'),'attributes':['id',_0x0cdb('0x1d'),_0x0cdb('0x55'),_0x0cdb('0x56'),'interface'],'raw':!![]}]})['then'](function(_0x3a2fc6){if(_0x3a2fc6){var _0x33d750=_[_0x0cdb('0x57')](_0x3a2fc6,function(_0xe989e6){var _0x426736=_0xe989e6[_0x0cdb('0x17')]({'plain':!![]});return _0x426736[_0x0cdb('0x54')];});return db[_0x0cdb('0x21')][_0x0cdb('0x34')]({'where':{'id':_0x52ed7d[_0x0cdb('0x28')]['id']}})[_0x0cdb('0x15')](function(_0x311bd3){return db['sequelize'][_0x0cdb('0x58')](function(_0x89c2db){return _0x311bd3[_0x0cdb('0x52')](_0x3fcfa3,{'transaction':_0x89c2db})[_0x0cdb('0x15')](function(){return BPromise[_0x0cdb('0x59')](_0x33d750,function(_0x38ce3b){return db['UserMailQueue'][_0x0cdb('0x5a')]({'where':{'UserId':_0x38ce3b['id'],'MailQueueId':_0x52ed7d[_0x0cdb('0x28')]['id']},'transaction':_0x89c2db});});})[_0x0cdb('0x15')](function(){_0x33d750['forEach'](function(_0x4682c2){socket[_0x0cdb('0x5b')](_0x0cdb('0x5c'),{'UserId':_0x4682c2['id'],'MailQueueId':_0x311bd3['id']});});});});});}})[_0x0cdb('0x15')](respondWithStatusCode(_0x579851,null))['catch'](handleError(_0x579851,null));};exports[_0x0cdb('0x5d')]=function(_0x1ede40,_0x7b2e8){return db[_0x0cdb('0x51')][_0x0cdb('0x26')]({'where':{'id':_0x1ede40[_0x0cdb('0x25')]['ids']},'attributes':['id'],'include':[{'model':db[_0x0cdb('0x5e')],'as':_0x0cdb('0x54'),'attributes':['id'],'raw':!![]}]})['then'](handleEntityNotFound(_0x7b2e8,null))['then'](function(_0x844f10){var _0x18ae0b=_[_0x0cdb('0x20')](_0x844f10,'id');var _0x4a2aed=[];var _0x20f1d5=[];var _0x3e96d1=squel['select']();_0x3e96d1['field']('tq.TeamId')[_0x0cdb('0x5f')](_0x0cdb('0x60'),'tq')[_0x0cdb('0x61')](_0x0cdb('0x62'),'ut',_0x0cdb('0x63'))[_0x0cdb('0x24')](_0x0cdb('0x64'),_0x1ede40['params']['id']);for(var _0x19b936=0x0;_0x19b936<_0x844f10[_0x0cdb('0x2f')];_0x19b936+=0x1){let _0x35efb7=_0x844f10[_0x19b936];for(var _0x7ab041=0x0;_0x7ab041<_0x35efb7[_0x0cdb('0x54')][_0x0cdb('0x2f')];_0x7ab041+=0x1){let _0x190aec=_0x35efb7[_0x0cdb('0x54')][_0x7ab041];var _0x45430b=_0x3e96d1['clone']();_0x45430b['where'](_0x0cdb('0x65'),_0x190aec['id']);_0x20f1d5[_0x0cdb('0x66')](db['sequelize'][_0x0cdb('0x25')](_0x45430b[_0x0cdb('0x67')](),{'type':db[_0x0cdb('0x68')][_0x0cdb('0x69')][_0x0cdb('0x6a')]})[_0x0cdb('0x15')](function(_0x2cdb58){if(_0x2cdb58['length']===0x1){return _0x190aec['id'];}else{var _0x10a348=_['every'](_[_0x0cdb('0x20')](_0x2cdb58,'TeamId'),function(_0x51fff0){return _[_0x0cdb('0x6b')](_0x18ae0b,_0x51fff0);});if(_0x10a348){return _0x190aec['id'];}}}));}}return BPromise[_0x0cdb('0x6c')](_0x20f1d5)[_0x0cdb('0x15')](function(_0x4f885c){_0x4a2aed=_(_0x4a2aed)[_0x0cdb('0x6d')](_0x4f885c)[_0x0cdb('0x6e')]()[_0x0cdb('0x6f')]();return db['MailQueue']['find']({'where':{'id':_0x1ede40['params']['id']}})[_0x0cdb('0x15')](function(_0x2e061b){return db[_0x0cdb('0x68')][_0x0cdb('0x58')](function(_0x1ac3d6){return _0x2e061b[_0x0cdb('0x5d')](_0x1ede40[_0x0cdb('0x25')]['ids'],{'transaction':_0x1ac3d6})['then'](function(){if(!_['isEmpty'](_0x4a2aed)){return _0x2e061b['removeAgents'](_0x4a2aed,{'transaction':_0x1ac3d6});}})['then'](function(){_0x4a2aed['forEach'](function(_0x35e493){socket[_0x0cdb('0x5b')](_0x0cdb('0x70'),{'UserId':_0x35e493,'MailQueueId':_0x2e061b['id']});});});});});});})[_0x0cdb('0x15')](respondWithStatusCode(_0x7b2e8,null))[_0x0cdb('0x27')](handleError(_0x7b2e8,null));};exports[_0x0cdb('0x71')]=function(_0x16bb09,_0x59d836){return db['MailQueue'][_0x0cdb('0x34')]({'where':{'id':_0x16bb09[_0x0cdb('0x28')]['id']}})['then'](handleEntityNotFound(_0x59d836,null))[_0x0cdb('0x15')](function(_0x2970b3){if(_0x2970b3){return _0x2970b3['addAgents'](_0x16bb09[_0x0cdb('0x36')]['ids'],_[_0x0cdb('0x72')](_0x16bb09[_0x0cdb('0x36')],['ids','id'])||{})[_0x0cdb('0x73')](function(_0x45f434){for(var _0xadc1ea=0x0;_0xadc1ea<_0x16bb09['body'][_0x0cdb('0x53')]['length'];_0xadc1ea+=0x1){socket[_0x0cdb('0x5b')](_0x0cdb('0x5c'),{'UserId':Number(_0x16bb09[_0x0cdb('0x36')][_0x0cdb('0x53')][_0xadc1ea]),'MailQueueId':Number(_0x16bb09[_0x0cdb('0x28')]['id'])});}return _0x45f434;});}})[_0x0cdb('0x15')](respondWithResult(_0x59d836,null))[_0x0cdb('0x27')](handleError(_0x59d836,null));};exports[_0x0cdb('0x74')]=function(_0x231490,_0x214a72){return db['MailQueue'][_0x0cdb('0x34')]({'where':{'id':_0x231490[_0x0cdb('0x28')]['id']}})[_0x0cdb('0x15')](handleEntityNotFound(_0x214a72,null))['then'](function(_0x2187e2){if(_0x2187e2){return _0x2187e2[_0x0cdb('0x74')](_0x231490[_0x0cdb('0x25')][_0x0cdb('0x53')])[_0x0cdb('0x15')](function(){if(_[_0x0cdb('0x75')](_0x231490[_0x0cdb('0x25')]['ids'])){for(var _0xbf0636=0x0;_0xbf0636<_0x231490[_0x0cdb('0x25')][_0x0cdb('0x53')][_0x0cdb('0x2f')];_0xbf0636+=0x1){socket['emit'](_0x0cdb('0x70'),{'UserId':Number(_0x231490[_0x0cdb('0x25')]['ids'][_0xbf0636]),'MailQueueId':Number(_0x231490['params']['id'])});}}else{socket[_0x0cdb('0x5b')](_0x0cdb('0x70'),{'UserId':Number(_0x231490[_0x0cdb('0x25')][_0x0cdb('0x53')]),'MailQueueId':Number(_0x231490['params']['id'])});}});}})[_0x0cdb('0x15')](respondWithStatusCode(_0x214a72,null))['catch'](handleError(_0x214a72,null));};exports[_0x0cdb('0x76')]=function(_0x1c2230,_0x55b0e9){var _0x183518={};var _0x4180c6={};var _0x4dca18;var _0x53b612;return db[_0x0cdb('0x21')][_0x0cdb('0x3e')]({'where':{'id':_0x1c2230['params']['id']}})[_0x0cdb('0x15')](handleEntityNotFound(_0x55b0e9,null))[_0x0cdb('0x15')](function(_0x4ec955){if(_0x4ec955){_0x4dca18=_0x4ec955;_0x4180c6[_0x0cdb('0x29')]=_[_0x0cdb('0x2a')](db[_0x0cdb('0x5e')][_0x0cdb('0x22')]);_0x4180c6[_0x0cdb('0x25')]=_[_0x0cdb('0x2a')](_0x1c2230[_0x0cdb('0x25')]);_0x4180c6['filters']=_[_0x0cdb('0x2c')](_0x4180c6[_0x0cdb('0x29')],_0x4180c6[_0x0cdb('0x25')]);_0x183518['attributes']=_[_0x0cdb('0x2c')](_0x4180c6[_0x0cdb('0x29')],qs[_0x0cdb('0x2e')](_0x1c2230[_0x0cdb('0x25')]['fields']));_0x183518['attributes']=_0x183518['attributes'][_0x0cdb('0x2f')]?_0x183518['attributes']:_0x4180c6[_0x0cdb('0x29')];_0x183518[_0x0cdb('0x42')]=qs[_0x0cdb('0x43')](_0x1c2230[_0x0cdb('0x25')][_0x0cdb('0x43')]);_0x183518[_0x0cdb('0x24')]=qs[_0x0cdb('0x2b')](_[_0x0cdb('0x44')](_0x1c2230[_0x0cdb('0x25')],_0x4180c6[_0x0cdb('0x2b')]));if(_0x1c2230['query'][_0x0cdb('0x46')]){_0x183518[_0x0cdb('0x24')]=_[_0x0cdb('0x32')](_0x183518[_0x0cdb('0x24')],{'$or':_[_0x0cdb('0x20')](_0x183518['attributes'],function(_0x23d6ed){var _0x20466f={};_0x20466f[_0x23d6ed]={'$like':'%'+_0x1c2230[_0x0cdb('0x25')]['filter']+'%'};return _0x20466f;})});}_0x183518=_[_0x0cdb('0x32')]({},_0x183518,_0x1c2230[_0x0cdb('0x33')]);return _0x4dca18[_0x0cdb('0x76')](_0x183518);}})['then'](function(_0x1755e9){if(_0x1755e9){_0x53b612=_0x1755e9[_0x0cdb('0x2f')];if(!_0x1c2230[_0x0cdb('0x25')]['hasOwnProperty'](_0x0cdb('0x41'))){_0x183518['limit']=qs[_0x0cdb('0x10')](_0x1c2230[_0x0cdb('0x25')][_0x0cdb('0x10')]);_0x183518[_0x0cdb('0xe')]=qs[_0x0cdb('0xe')](_0x1c2230[_0x0cdb('0x25')]['offset']);}return _0x4dca18['getAgents'](_0x183518);}})[_0x0cdb('0x15')](function(_0x479304){if(_0x479304){return _0x479304?{'count':_0x53b612,'rows':_0x479304}:null;}})[_0x0cdb('0x15')](respondWithResult(_0x55b0e9,null))[_0x0cdb('0x27')](handleError(_0x55b0e9,null));}; \ No newline at end of file diff --git a/server/api/mailQueue/mailQueue.events.js b/server/api/mailQueue/mailQueue.events.js index bd8d697..e0a6502 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 _0x1361=['MailQueue','setMaxListeners','save','update','emit','hasOwnProperty','hook','exports','events'];(function(_0xcf5855,_0x44948f){var _0x3d6a61=function(_0x3db33c){while(--_0x3db33c){_0xcf5855['push'](_0xcf5855['shift']());}};_0x3d6a61(++_0x44948f);}(_0x1361,0xf2));var _0x1136=function(_0x130c3f,_0x38ac63){_0x130c3f=_0x130c3f-0x0;var _0x1f0f72=_0x1361[_0x130c3f];return _0x1f0f72;};'use strict';var EventEmitter=require(_0x1136('0x0'));var MailQueue=require('../../mysqldb')['db'][_0x1136('0x1')];var MailQueueEvents=new EventEmitter();MailQueueEvents[_0x1136('0x2')](0x0);var events={'afterCreate':_0x1136('0x3'),'afterUpdate':_0x1136('0x4'),'afterDestroy':'remove'};function emitEvent(_0xbb837d){return function(_0x17893f,_0x39a6e8,_0x1ef15c){MailQueueEvents[_0x1136('0x5')](_0xbb837d+':'+_0x17893f['id'],_0x17893f);MailQueueEvents['emit'](_0xbb837d,_0x17893f);_0x1ef15c(null);};}for(var e in events){if(events[_0x1136('0x6')](e)){var event=events[e];MailQueue[_0x1136('0x7')](e,emitEvent(event));}}module[_0x1136('0x8')]=MailQueueEvents; \ No newline at end of file +var _0x6b7f=['emit','hasOwnProperty','hook','exports','events','../../mysqldb','setMaxListeners','update','remove'];(function(_0x487f81,_0x352037){var _0xfdf234=function(_0x4dab59){while(--_0x4dab59){_0x487f81['push'](_0x487f81['shift']());}};_0xfdf234(++_0x352037);}(_0x6b7f,0x151));var _0xf6b7=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0x6b7f[_0x3dd15e];return _0x231fd0;};'use strict';var EventEmitter=require(_0xf6b7('0x0'));var MailQueue=require(_0xf6b7('0x1'))['db']['MailQueue'];var MailQueueEvents=new EventEmitter();MailQueueEvents[_0xf6b7('0x2')](0x0);var events={'afterCreate':'save','afterUpdate':_0xf6b7('0x3'),'afterDestroy':_0xf6b7('0x4')};function emitEvent(_0xc4a04){return function(_0x5f3bc2,_0x22de58,_0x5bd332){MailQueueEvents[_0xf6b7('0x5')](_0xc4a04+':'+_0x5f3bc2['id'],_0x5f3bc2);MailQueueEvents[_0xf6b7('0x5')](_0xc4a04,_0x5f3bc2);_0x5bd332(null);};}for(var e in events){if(events[_0xf6b7('0x6')](e)){var event=events[e];MailQueue[_0xf6b7('0x7')](e,emitEvent(event));}}module[_0xf6b7('0x8')]=MailQueueEvents; \ No newline at end of file diff --git a/server/api/mailQueue/mailQueue.model.js b/server/api/mailQueue/mailQueue.model.js index 6b998e2..c543886 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 _0x5d00=['define','mail_queues','lodash','util','api','moment','bluebird','request-promise','path','../../config/environment','./mailQueue.attributes','exports'];(function(_0x5f2559,_0x422084){var _0x295739=function(_0x33fbee){while(--_0x33fbee){_0x5f2559['push'](_0x5f2559['shift']());}};_0x295739(++_0x422084);}(_0x5d00,0x6e));var _0x05d0=function(_0x1daaa9,_0x220393){_0x1daaa9=_0x1daaa9-0x0;var _0x1dd221=_0x5d00[_0x1daaa9];return _0x1dd221;};'use strict';var _=require(_0x05d0('0x0'));var util=require(_0x05d0('0x1'));var logger=require('../../config/logger')(_0x05d0('0x2'));var moment=require(_0x05d0('0x3'));var BPromise=require(_0x05d0('0x4'));var rp=require(_0x05d0('0x5'));var fs=require('fs');var path=require(_0x05d0('0x6'));var rimraf=require('rimraf');var config=require(_0x05d0('0x7'));var attributes=require(_0x05d0('0x8'));module[_0x05d0('0x9')]=function(_0x2c60fb,_0x355e30){return _0x2c60fb[_0x05d0('0xa')]('MailQueue',attributes,{'tableName':_0x05d0('0xb'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0xa6fc=['mail_queues','lodash','util','../../config/logger','api','bluebird','request-promise','path','../../config/environment','./mailQueue.attributes','exports','define'];(function(_0x2399ea,_0x1c9455){var _0x3b525d=function(_0x5ee8c1){while(--_0x5ee8c1){_0x2399ea['push'](_0x2399ea['shift']());}};_0x3b525d(++_0x1c9455);}(_0xa6fc,0x145));var _0xca6f=function(_0x5a897a,_0x55511c){_0x5a897a=_0x5a897a-0x0;var _0x4a5fba=_0xa6fc[_0x5a897a];return _0x4a5fba;};'use strict';var _=require(_0xca6f('0x0'));var util=require(_0xca6f('0x1'));var logger=require(_0xca6f('0x2'))(_0xca6f('0x3'));var moment=require('moment');var BPromise=require(_0xca6f('0x4'));var rp=require(_0xca6f('0x5'));var fs=require('fs');var path=require(_0xca6f('0x6'));var rimraf=require('rimraf');var config=require(_0xca6f('0x7'));var attributes=require(_0xca6f('0x8'));module[_0xca6f('0x9')]=function(_0x4c351d,_0x52fd45){return _0x4c351d[_0xca6f('0xa')]('MailQueue',attributes,{'tableName':_0xca6f('0xb'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/mailQueue/mailQueue.rpc.js b/server/api/mailQueue/mailQueue.rpc.js index 82455e8..151ed77 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 _0x52ae=['stringify','error','code','MailQueue,\x20%s,\x20%s','message','catch','GetMailQueue','MailQueue','findAll','options','raw','where','attributes','limit','include','map','model','debug','ShowMailQueue','lodash','util','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','client','http','redis','localhost','socket.io-emitter','./mailQueue.socket','register','then','info','request\x20sent'];(function(_0x4228a2,_0x527255){var _0x288374=function(_0x42a07d){while(--_0x42a07d){_0x4228a2['push'](_0x4228a2['shift']());}};_0x288374(++_0x527255);}(_0x52ae,0x18f));var _0xe52a=function(_0x285824,_0x3da647){_0x285824=_0x285824-0x0;var _0x311d7e=_0x52ae[_0x285824];return _0x311d7e;};'use strict';var _=require(_0xe52a('0x0'));var util=require(_0xe52a('0x1'));var moment=require('moment');var BPromise=require('bluebird');var rs=require('randomstring');var fs=require('fs');var Redis=require(_0xe52a('0x2'));var db=require(_0xe52a('0x3'))['db'];var utils=require(_0xe52a('0x4'));var logger=require(_0xe52a('0x5'))(_0xe52a('0x6'));var config=require(_0xe52a('0x7'));var jayson=require(_0xe52a('0x8'));var client=jayson[_0xe52a('0x9')][_0xe52a('0xa')]({'port':0x232a});config['redis']=_['defaults'](config[_0xe52a('0xb')],{'host':_0xe52a('0xc'),'port':0x18eb});var socket=require(_0xe52a('0xd'))(new Redis(config['redis']));require(_0xe52a('0xe'))[_0xe52a('0xf')](socket);function respondWithRpcPromise(_0x273612,_0x38a413,_0x54fa31){return new BPromise(function(_0xb0494f,_0x46dba8){return client['request'](_0x273612,_0x54fa31)[_0xe52a('0x10')](function(_0xb5dc8c){logger[_0xe52a('0x11')]('MailQueue,\x20%s,\x20%s',_0x38a413,_0xe52a('0x12'));logger['debug']('MailQueue,\x20%s,\x20%s,\x20%s',_0x38a413,_0xe52a('0x12'),JSON[_0xe52a('0x13')](_0xb5dc8c));if(_0xb5dc8c[_0xe52a('0x14')]){if(_0xb5dc8c[_0xe52a('0x14')][_0xe52a('0x15')]===0x1f4){logger['error'](_0xe52a('0x16'),_0x38a413,_0xb5dc8c[_0xe52a('0x14')][_0xe52a('0x17')]);return _0x46dba8(_0xb5dc8c[_0xe52a('0x14')][_0xe52a('0x17')]);}logger[_0xe52a('0x14')]('MailQueue,\x20%s,\x20%s',_0x38a413,_0xb5dc8c[_0xe52a('0x14')][_0xe52a('0x17')]);return _0xb0494f(_0xb5dc8c[_0xe52a('0x14')]['message']);}else{logger[_0xe52a('0x11')]('MailQueue,\x20%s,\x20%s',_0x38a413,_0xe52a('0x12'));_0xb0494f(_0xb5dc8c['result']['message']);}})[_0xe52a('0x18')](function(_0x8a5f44){logger[_0xe52a('0x14')](_0xe52a('0x16'),_0x38a413,_0x8a5f44);_0x46dba8(_0x8a5f44);});});}exports[_0xe52a('0x19')]=function(_0x318f6b){var _0x348b8b=this;return new Promise(function(_0x472aca,_0x26d07e){return db[_0xe52a('0x1a')][_0xe52a('0x1b')]({'raw':_0x318f6b[_0xe52a('0x1c')]?_0x318f6b[_0xe52a('0x1c')][_0xe52a('0x1d')]===undefined?!![]:![]:!![],'where':_0x318f6b['options']?_0x318f6b['options'][_0xe52a('0x1e')]||null:null,'attributes':_0x318f6b[_0xe52a('0x1c')]?_0x318f6b[_0xe52a('0x1c')][_0xe52a('0x1f')]||null:null,'limit':_0x318f6b[_0xe52a('0x1c')]?_0x318f6b[_0xe52a('0x1c')][_0xe52a('0x20')]||null:null,'include':_0x318f6b[_0xe52a('0x1c')]?_0x318f6b[_0xe52a('0x1c')][_0xe52a('0x21')]?_['map'](_0x318f6b[_0xe52a('0x1c')][_0xe52a('0x21')],function(_0x4a7ec3){return{'model':db[_0x4a7ec3['model']],'as':_0x4a7ec3['as'],'attributes':_0x4a7ec3[_0xe52a('0x1f')],'include':_0x4a7ec3[_0xe52a('0x21')]?_[_0xe52a('0x22')](_0x4a7ec3['include'],function(_0x4f42c8){return{'model':db[_0x4f42c8[_0xe52a('0x23')]],'as':_0x4f42c8['as'],'attributes':_0x4f42c8[_0xe52a('0x1f')],'include':_0x4f42c8[_0xe52a('0x21')]?_['map'](_0x4f42c8[_0xe52a('0x21')],function(_0x42bffc){return{'model':db[_0x42bffc['model']],'as':_0x42bffc['as'],'attributes':_0x42bffc['attributes']};}):[]};}):[]};}):[]:[]})[_0xe52a('0x10')](function(_0x3935dc){logger['info'](_0xe52a('0x19'),_0x318f6b);logger[_0xe52a('0x24')]('GetMailQueue',_0x318f6b,JSON[_0xe52a('0x13')](_0x3935dc));_0x472aca(_0x3935dc);})[_0xe52a('0x18')](function(_0x4a9bf7){logger[_0xe52a('0x14')](_0xe52a('0x19'),_0x4a9bf7[_0xe52a('0x17')],_0x318f6b);_0x26d07e(_0x348b8b[_0xe52a('0x14')](0x1f4,_0x4a9bf7[_0xe52a('0x17')]));});});};exports['ShowMailQueue']=function(_0x42d8eb){var _0x4093ef=this;return new Promise(function(_0x26f9da,_0x447462){return db[_0xe52a('0x1a')]['find']({'raw':_0x42d8eb[_0xe52a('0x1c')]?_0x42d8eb[_0xe52a('0x1c')][_0xe52a('0x1d')]===undefined?!![]:![]:!![],'where':_0x42d8eb[_0xe52a('0x1c')]?_0x42d8eb[_0xe52a('0x1c')][_0xe52a('0x1e')]||null:null,'attributes':_0x42d8eb['options']?_0x42d8eb[_0xe52a('0x1c')][_0xe52a('0x1f')]||null:null,'include':_0x42d8eb['options']?_0x42d8eb['options'][_0xe52a('0x21')]?_['map'](_0x42d8eb[_0xe52a('0x1c')]['include'],function(_0x12afb9){return{'model':db[_0x12afb9[_0xe52a('0x23')]],'as':_0x12afb9['as'],'attributes':_0x12afb9['attributes'],'include':_0x12afb9['include']?_['map'](_0x12afb9['include'],function(_0x2fa38e){return{'model':db[_0x2fa38e[_0xe52a('0x23')]],'as':_0x2fa38e['as'],'attributes':_0x2fa38e['attributes'],'include':_0x2fa38e[_0xe52a('0x21')]?_[_0xe52a('0x22')](_0x2fa38e['include'],function(_0x2fc35a){return{'model':db[_0x2fc35a[_0xe52a('0x23')]],'as':_0x2fc35a['as'],'attributes':_0x2fc35a['attributes']};}):[]};}):[]};}):[]:[]})[_0xe52a('0x10')](function(_0x30c0e6){logger[_0xe52a('0x11')](_0xe52a('0x25'),_0x42d8eb);logger[_0xe52a('0x24')]('ShowMailQueue',_0x42d8eb,JSON[_0xe52a('0x13')](_0x30c0e6));_0x26f9da(_0x30c0e6);})['catch'](function(_0x5c964c){logger[_0xe52a('0x14')](_0xe52a('0x25'),_0x5c964c[_0xe52a('0x17')],_0x42d8eb);_0x447462(_0x4093ef['error'](0x1f4,_0x5c964c['message']));});});}; \ No newline at end of file +var _0xf3f6=['info','request\x20sent','debug','MailQueue,\x20%s,\x20%s,\x20%s','stringify','error','MailQueue,\x20%s,\x20%s','message','result','catch','findAll','options','raw','where','attributes','limit','include','map','model','GetMailQueue','ShowMailQueue','MailQueue','find','lodash','util','moment','bluebird','randomstring','ioredis','../../config/utils','../../config/environment','jayson/promise','client','http','defaults','localhost','redis','./mailQueue.socket','register','request','then'];(function(_0x188b0b,_0x15ec7b){var _0x33b734=function(_0x5b70b7){while(--_0x5b70b7){_0x188b0b['push'](_0x188b0b['shift']());}};_0x33b734(++_0x15ec7b);}(_0xf3f6,0x136));var _0x6f3f=function(_0x2861ac,_0x3c41bd){_0x2861ac=_0x2861ac-0x0;var _0xd0479c=_0xf3f6[_0x2861ac];return _0xd0479c;};'use strict';var _=require(_0x6f3f('0x0'));var util=require(_0x6f3f('0x1'));var moment=require(_0x6f3f('0x2'));var BPromise=require(_0x6f3f('0x3'));var rs=require(_0x6f3f('0x4'));var fs=require('fs');var Redis=require(_0x6f3f('0x5'));var db=require('../../mysqldb')['db'];var utils=require(_0x6f3f('0x6'));var logger=require('../../config/logger')('rpc');var config=require(_0x6f3f('0x7'));var jayson=require(_0x6f3f('0x8'));var client=jayson[_0x6f3f('0x9')][_0x6f3f('0xa')]({'port':0x232a});config['redis']=_[_0x6f3f('0xb')](config['redis'],{'host':_0x6f3f('0xc'),'port':0x18eb});var socket=require('socket.io-emitter')(new Redis(config[_0x6f3f('0xd')]));require(_0x6f3f('0xe'))[_0x6f3f('0xf')](socket);function respondWithRpcPromise(_0x50c169,_0xcb9c4c,_0x3a793e){return new BPromise(function(_0x389a33,_0xd3af83){return client[_0x6f3f('0x10')](_0x50c169,_0x3a793e)[_0x6f3f('0x11')](function(_0x5abb56){logger[_0x6f3f('0x12')]('MailQueue,\x20%s,\x20%s',_0xcb9c4c,_0x6f3f('0x13'));logger[_0x6f3f('0x14')](_0x6f3f('0x15'),_0xcb9c4c,_0x6f3f('0x13'),JSON[_0x6f3f('0x16')](_0x5abb56));if(_0x5abb56[_0x6f3f('0x17')]){if(_0x5abb56[_0x6f3f('0x17')]['code']===0x1f4){logger[_0x6f3f('0x17')](_0x6f3f('0x18'),_0xcb9c4c,_0x5abb56[_0x6f3f('0x17')][_0x6f3f('0x19')]);return _0xd3af83(_0x5abb56[_0x6f3f('0x17')][_0x6f3f('0x19')]);}logger['error'](_0x6f3f('0x18'),_0xcb9c4c,_0x5abb56['error'][_0x6f3f('0x19')]);return _0x389a33(_0x5abb56['error']['message']);}else{logger['info'](_0x6f3f('0x18'),_0xcb9c4c,_0x6f3f('0x13'));_0x389a33(_0x5abb56[_0x6f3f('0x1a')][_0x6f3f('0x19')]);}})[_0x6f3f('0x1b')](function(_0x4039bd){logger[_0x6f3f('0x17')](_0x6f3f('0x18'),_0xcb9c4c,_0x4039bd);_0xd3af83(_0x4039bd);});});}exports['GetMailQueue']=function(_0x2d4fca){var _0x13162a=this;return new Promise(function(_0xf4528e,_0x3cb972){return db['MailQueue'][_0x6f3f('0x1c')]({'raw':_0x2d4fca[_0x6f3f('0x1d')]?_0x2d4fca[_0x6f3f('0x1d')][_0x6f3f('0x1e')]===undefined?!![]:![]:!![],'where':_0x2d4fca[_0x6f3f('0x1d')]?_0x2d4fca[_0x6f3f('0x1d')][_0x6f3f('0x1f')]||null:null,'attributes':_0x2d4fca[_0x6f3f('0x1d')]?_0x2d4fca[_0x6f3f('0x1d')][_0x6f3f('0x20')]||null:null,'limit':_0x2d4fca['options']?_0x2d4fca['options'][_0x6f3f('0x21')]||null:null,'include':_0x2d4fca[_0x6f3f('0x1d')]?_0x2d4fca[_0x6f3f('0x1d')][_0x6f3f('0x22')]?_[_0x6f3f('0x23')](_0x2d4fca[_0x6f3f('0x1d')][_0x6f3f('0x22')],function(_0x24bffe){return{'model':db[_0x24bffe[_0x6f3f('0x24')]],'as':_0x24bffe['as'],'attributes':_0x24bffe['attributes'],'include':_0x24bffe[_0x6f3f('0x22')]?_['map'](_0x24bffe['include'],function(_0x28a1e5){return{'model':db[_0x28a1e5[_0x6f3f('0x24')]],'as':_0x28a1e5['as'],'attributes':_0x28a1e5[_0x6f3f('0x20')],'include':_0x28a1e5['include']?_['map'](_0x28a1e5['include'],function(_0x34c6cc){return{'model':db[_0x34c6cc[_0x6f3f('0x24')]],'as':_0x34c6cc['as'],'attributes':_0x34c6cc[_0x6f3f('0x20')]};}):[]};}):[]};}):[]:[]})[_0x6f3f('0x11')](function(_0x16094b){logger[_0x6f3f('0x12')]('GetMailQueue',_0x2d4fca);logger[_0x6f3f('0x14')](_0x6f3f('0x25'),_0x2d4fca,JSON[_0x6f3f('0x16')](_0x16094b));_0xf4528e(_0x16094b);})['catch'](function(_0x48e6d0){logger[_0x6f3f('0x17')](_0x6f3f('0x25'),_0x48e6d0[_0x6f3f('0x19')],_0x2d4fca);_0x3cb972(_0x13162a[_0x6f3f('0x17')](0x1f4,_0x48e6d0['message']));});});};exports[_0x6f3f('0x26')]=function(_0x1313bd){var _0x72a64e=this;return new Promise(function(_0x2ce9af,_0x1aa7df){return db[_0x6f3f('0x27')][_0x6f3f('0x28')]({'raw':_0x1313bd[_0x6f3f('0x1d')]?_0x1313bd[_0x6f3f('0x1d')][_0x6f3f('0x1e')]===undefined?!![]:![]:!![],'where':_0x1313bd[_0x6f3f('0x1d')]?_0x1313bd[_0x6f3f('0x1d')][_0x6f3f('0x1f')]||null:null,'attributes':_0x1313bd[_0x6f3f('0x1d')]?_0x1313bd['options']['attributes']||null:null,'include':_0x1313bd[_0x6f3f('0x1d')]?_0x1313bd[_0x6f3f('0x1d')][_0x6f3f('0x22')]?_[_0x6f3f('0x23')](_0x1313bd[_0x6f3f('0x1d')][_0x6f3f('0x22')],function(_0x5c6d31){return{'model':db[_0x5c6d31[_0x6f3f('0x24')]],'as':_0x5c6d31['as'],'attributes':_0x5c6d31[_0x6f3f('0x20')],'include':_0x5c6d31['include']?_[_0x6f3f('0x23')](_0x5c6d31['include'],function(_0x5be122){return{'model':db[_0x5be122[_0x6f3f('0x24')]],'as':_0x5be122['as'],'attributes':_0x5be122[_0x6f3f('0x20')],'include':_0x5be122[_0x6f3f('0x22')]?_[_0x6f3f('0x23')](_0x5be122[_0x6f3f('0x22')],function(_0x90dc68){return{'model':db[_0x90dc68['model']],'as':_0x90dc68['as'],'attributes':_0x90dc68[_0x6f3f('0x20')]};}):[]};}):[]};}):[]:[]})[_0x6f3f('0x11')](function(_0x3dc2ed){logger[_0x6f3f('0x12')]('ShowMailQueue',_0x1313bd);logger['debug'](_0x6f3f('0x26'),_0x1313bd,JSON[_0x6f3f('0x16')](_0x3dc2ed));_0x2ce9af(_0x3dc2ed);})['catch'](function(_0x1f41ee){logger['error'](_0x6f3f('0x26'),_0x1f41ee[_0x6f3f('0x19')],_0x1313bd);_0x1aa7df(_0x72a64e['error'](0x1f4,_0x1f41ee[_0x6f3f('0x19')]));});});}; \ No newline at end of file diff --git a/server/api/mailQueue/mailQueue.socket.js b/server/api/mailQueue/mailQueue.socket.js index f596938..c0f7c3e 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 _0x2fe5=['length','./mailQueue.events','save','emit','removeListener','register'];(function(_0x422be2,_0x1c439e){var _0x1b820e=function(_0x513cc8){while(--_0x513cc8){_0x422be2['push'](_0x422be2['shift']());}};_0x1b820e(++_0x1c439e);}(_0x2fe5,0x14b));var _0x52fe=function(_0x40a045,_0x516f0e){_0x40a045=_0x40a045-0x0;var _0x1a687c=_0x2fe5[_0x40a045];return _0x1a687c;};'use strict';var MailQueueEvents=require(_0x52fe('0x0'));var events=[_0x52fe('0x1'),'remove','update'];function createListener(_0x3c2763,_0x1d8bec){return function(_0x243be8){_0x1d8bec[_0x52fe('0x2')](_0x3c2763,_0x243be8);};}function removeListener(_0xd0dfd1,_0x48ef08){return function(){MailQueueEvents[_0x52fe('0x3')](_0xd0dfd1,_0x48ef08);};}exports[_0x52fe('0x4')]=function(_0x584af7){for(var _0x2efcaa=0x0,_0x157c5a=events[_0x52fe('0x5')];_0x2efcaa<_0x157c5a;_0x2efcaa++){var _0x31b5dd=events[_0x2efcaa];var _0x408cef=createListener('mailQueue:'+_0x31b5dd,_0x584af7);MailQueueEvents['on'](_0x31b5dd,_0x408cef);}}; \ No newline at end of file +var _0xab61=['remove','update','emit','removeListener','length','mailQueue:','./mailQueue.events','save'];(function(_0x5ed2b0,_0x3efa62){var _0x1aec7a=function(_0x550280){while(--_0x550280){_0x5ed2b0['push'](_0x5ed2b0['shift']());}};_0x1aec7a(++_0x3efa62);}(_0xab61,0x196));var _0x1ab6=function(_0x8b3b02,_0x5e3db){_0x8b3b02=_0x8b3b02-0x0;var _0x4a5104=_0xab61[_0x8b3b02];return _0x4a5104;};'use strict';var MailQueueEvents=require(_0x1ab6('0x0'));var events=[_0x1ab6('0x1'),_0x1ab6('0x2'),_0x1ab6('0x3')];function createListener(_0x55083a,_0x28fd5c){return function(_0x3c8b32){_0x28fd5c[_0x1ab6('0x4')](_0x55083a,_0x3c8b32);};}function removeListener(_0x347521,_0x17b521){return function(){MailQueueEvents[_0x1ab6('0x5')](_0x347521,_0x17b521);};}exports['register']=function(_0x45ee75){for(var _0x16e4be=0x0,_0x1284ef=events[_0x1ab6('0x6')];_0x16e4be<_0x1284ef;_0x16e4be++){var _0x3b9791=events[_0x16e4be];var _0x589228=createListener(_0x1ab6('0x7')+_0x3b9791,_0x45ee75);MailQueueEvents['on'](_0x3b9791,_0x589228);}}; \ No newline at end of file diff --git a/server/api/mailQueueReport/index.js b/server/api/mailQueueReport/index.js index 1b2de00..2ab3a0c 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 _0xc02b=['connect-timeout','Router','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','get','isAuthenticated','describe','show','post','create','/:id','update','delete','destroy','exports','path'];(function(_0x598b78,_0x4ef4eb){var _0x3c96a1=function(_0x2b7c0d){while(--_0x2b7c0d){_0x598b78['push'](_0x598b78['shift']());}};_0x3c96a1(++_0x4ef4eb);}(_0xc02b,0x179));var _0xbc02=function(_0x98db33,_0x397f20){_0x98db33=_0x98db33-0x0;var _0x5ae63a=_0xc02b[_0x98db33];return _0x5ae63a;};'use strict';var multer=require('multer');var util=require('util');var path=require(_0xbc02('0x0'));var timeout=require(_0xbc02('0x1'));var express=require('express');var router=express[_0xbc02('0x2')]();var fs_extra=require(_0xbc02('0x3'));var auth=require(_0xbc02('0x4'));var interaction=require(_0xbc02('0x5'));var config=require(_0xbc02('0x6'));var controller=require('./mailQueueReport.controller');router[_0xbc02('0x7')]('/',auth[_0xbc02('0x8')](),controller['index']);router['get']('/describe',auth['isAuthenticated'](),controller[_0xbc02('0x9')]);router[_0xbc02('0x7')]('/:id',auth[_0xbc02('0x8')](),controller[_0xbc02('0xa')]);router[_0xbc02('0xb')]('/',auth[_0xbc02('0x8')](),controller[_0xbc02('0xc')]);router['put'](_0xbc02('0xd'),auth[_0xbc02('0x8')](),controller[_0xbc02('0xe')]);router[_0xbc02('0xf')]('/:id',auth['isAuthenticated'](),controller[_0xbc02('0x10')]);module[_0xbc02('0x11')]=router; \ No newline at end of file +var _0x7155=['update','delete','multer','util','path','connect-timeout','Router','fs-extra','../../components/interaction/service','get','isAuthenticated','index','/describe','/:id','show','create','put'];(function(_0x4243a3,_0x447337){var _0x1b2a33=function(_0x6a8200){while(--_0x6a8200){_0x4243a3['push'](_0x4243a3['shift']());}};_0x1b2a33(++_0x447337);}(_0x7155,0x134));var _0x5715=function(_0x14add3,_0x13ce8d){_0x14add3=_0x14add3-0x0;var _0x4a174f=_0x7155[_0x14add3];return _0x4a174f;};'use strict';var multer=require(_0x5715('0x0'));var util=require(_0x5715('0x1'));var path=require(_0x5715('0x2'));var timeout=require(_0x5715('0x3'));var express=require('express');var router=express[_0x5715('0x4')]();var fs_extra=require(_0x5715('0x5'));var auth=require('../../components/auth/service');var interaction=require(_0x5715('0x6'));var config=require('../../config/environment');var controller=require('./mailQueueReport.controller');router[_0x5715('0x7')]('/',auth[_0x5715('0x8')](),controller[_0x5715('0x9')]);router[_0x5715('0x7')](_0x5715('0xa'),auth['isAuthenticated'](),controller['describe']);router[_0x5715('0x7')](_0x5715('0xb'),auth[_0x5715('0x8')](),controller[_0x5715('0xc')]);router['post']('/',auth['isAuthenticated'](),controller[_0x5715('0xd')]);router[_0x5715('0xe')](_0x5715('0xb'),auth[_0x5715('0x8')](),controller[_0x5715('0xf')]);router[_0x5715('0x10')](_0x5715('0xb'),auth[_0x5715('0x8')](),controller['destroy']);module['exports']=router; \ No newline at end of file diff --git a/server/api/mailQueueReport/mailQueueReport.attributes.js b/server/api/mailQueueReport/mailQueueReport.attributes.js index 3aa449b..668b251 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 _0xd178=['DATE','moment','exports','STRING'];(function(_0x460e20,_0x3ff2d0){var _0x4088a4=function(_0x460092){while(--_0x460092){_0x460e20['push'](_0x460e20['shift']());}};_0x4088a4(++_0x3ff2d0);}(_0xd178,0x1c9));var _0x8d17=function(_0x42f009,_0x5e27b1){_0x42f009=_0x42f009-0x0;var _0x22a1e0=_0xd178[_0x42f009];return _0x22a1e0;};'use strict';var moment=require(_0x8d17('0x0'));var Sequelize=require('sequelize');module[_0x8d17('0x1')]={'uniqueid':{'type':Sequelize[_0x8d17('0x2')],'allowNull':![]},'from':{'type':Sequelize[_0x8d17('0x2')]},'joinAt':{'type':Sequelize[_0x8d17('0x3')]},'leaveAt':{'type':Sequelize['DATE']},'acceptAt':{'type':Sequelize[_0x8d17('0x3')]},'exitAt':{'type':Sequelize['DATE']},'reason':{'type':Sequelize[_0x8d17('0x2')]}}; \ No newline at end of file +var _0x6bb7=['DATE','STRING'];(function(_0x2c7e4c,_0x199ec7){var _0x5e2f51=function(_0x5d431c){while(--_0x5d431c){_0x2c7e4c['push'](_0x2c7e4c['shift']());}};_0x5e2f51(++_0x199ec7);}(_0x6bb7,0x18d));var _0x76bb=function(_0x2d9ee4,_0x3d9c9c){_0x2d9ee4=_0x2d9ee4-0x0;var _0x530580=_0x6bb7[_0x2d9ee4];return _0x530580;};'use strict';var moment=require('moment');var Sequelize=require('sequelize');module['exports']={'uniqueid':{'type':Sequelize['STRING'],'allowNull':![]},'from':{'type':Sequelize[_0x76bb('0x0')]},'joinAt':{'type':Sequelize[_0x76bb('0x1')]},'leaveAt':{'type':Sequelize['DATE']},'acceptAt':{'type':Sequelize[_0x76bb('0x1')]},'exitAt':{'type':Sequelize['DATE']},'reason':{'type':Sequelize[_0x76bb('0x0')]}}; \ No newline at end of file diff --git a/server/api/mailQueueReport/mailQueueReport.controller.js b/server/api/mailQueueReport/mailQueueReport.controller.js index 57c21b7..9a7e883 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 _0xda2d=['send','index','map','MailQueueReport','rawAttributes','fieldName','type','model','filters','fields','query','attributes','length','nolimit','order','sort','pick','where','merge','VIRTUAL','filter','options','include','findAll','rows','catch','params','keys','intersection','find','create','body','describe','rimraf','zip-dir','fast-json-patch','request-promise','moment','path','sox','to-csv','ejs','fs-extra','lodash','squel','crypto','jsforce','desk.js','querystring','papaparse','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/environment','sendStatus','status','end','offset','undefined','count','limit','set','Content-Range','json','reject','save','update','then','destroy','error','name'];(function(_0x49fb23,_0x5340d4){var _0x4ef27b=function(_0xe79ef4){while(--_0xe79ef4){_0x49fb23['push'](_0x49fb23['shift']());}};_0x4ef27b(++_0x5340d4);}(_0xda2d,0x102));var _0xdda2=function(_0x18d656,_0x507b8c){_0x18d656=_0x18d656-0x0;var _0x2cc36a=_0xda2d[_0x18d656];return _0x2cc36a;};'use strict';var emlformat=require('eml-format');var rimraf=require(_0xdda2('0x0'));var zipdir=require(_0xdda2('0x1'));var jsonpatch=require(_0xdda2('0x2'));var rp=require(_0xdda2('0x3'));var moment=require(_0xdda2('0x4'));var BPromise=require('bluebird');var Mustache=require('mustache');var util=require('util');var path=require(_0xdda2('0x5'));var sox=require(_0xdda2('0x6'));var csv=require(_0xdda2('0x7'));var ejs=require(_0xdda2('0x8'));var fs=require('fs');var fs_extra=require(_0xdda2('0x9'));var _=require(_0xdda2('0xa'));var squel=require(_0xdda2('0xb'));var crypto=require(_0xdda2('0xc'));var jsforce=require(_0xdda2('0xd'));var deskjs=require(_0xdda2('0xe'));var toCsv=require('to-csv');var querystring=require(_0xdda2('0xf'));var Papa=require(_0xdda2('0x10'));var Redis=require('ioredis');var authService=require(_0xdda2('0x11'));var qs=require(_0xdda2('0x12'));var as=require(_0xdda2('0x13'));var hardwareService=require(_0xdda2('0x14'));var logger=require(_0xdda2('0x15'))(_0xdda2('0x16'));var utils=require(_0xdda2('0x17'));var config=require(_0xdda2('0x18'));var licenseUtil=require('../../config/license/util');var db=require('../../mysqldb')['db'];function respondWithStatusCode(_0x56d25d,_0xa6446b){_0xa6446b=_0xa6446b||0xcc;return function(_0x320f73){if(_0x320f73){return _0x56d25d[_0xdda2('0x19')](_0xa6446b);}return _0x56d25d[_0xdda2('0x1a')](_0xa6446b)[_0xdda2('0x1b')]();};}function respondWithResult(_0x475222,_0x3490f1){_0x3490f1=_0x3490f1||0xc8;return function(_0x4df902){if(_0x4df902){return _0x475222[_0xdda2('0x1a')](_0x3490f1)['json'](_0x4df902);}};}function respondWithFilteredResult(_0xbef148,_0xb6b01e){return function(_0x3553d5){if(_0x3553d5){var _0x457764=typeof _0xb6b01e[_0xdda2('0x1c')]==='undefined'&&typeof _0xb6b01e['limit']===_0xdda2('0x1d');var _0x518c6d=_0x3553d5[_0xdda2('0x1e')];var _0x1a3b35=_0x457764?0x0:_0xb6b01e[_0xdda2('0x1c')];var _0x2b6ee8=_0x457764?_0x3553d5[_0xdda2('0x1e')]:_0xb6b01e[_0xdda2('0x1c')]+_0xb6b01e[_0xdda2('0x1f')];var _0x351151;if(_0x2b6ee8>=_0x518c6d){_0x2b6ee8=_0x518c6d;_0x351151=0xc8;}else{_0x351151=0xce;}_0xbef148[_0xdda2('0x1a')](_0x351151);return _0xbef148[_0xdda2('0x20')](_0xdda2('0x21'),_0x1a3b35+'-'+_0x2b6ee8+'/'+_0x518c6d)[_0xdda2('0x22')](_0x3553d5);}return null;};}function patchUpdates(_0x4eed30){return function(_0x41fe7d){try{jsonpatch['apply'](_0x41fe7d,_0x4eed30,!![]);}catch(_0xc4567c){return BPromise[_0xdda2('0x23')](_0xc4567c);}return _0x41fe7d[_0xdda2('0x24')]();};}function saveUpdates(_0x4c5226,_0x347ee6){return function(_0x5a9bb8){if(_0x5a9bb8){return _0x5a9bb8[_0xdda2('0x25')](_0x4c5226)[_0xdda2('0x26')](function(_0x4ac3eb){return _0x4ac3eb;});}return null;};}function removeEntity(_0x144f1e,_0xfda248){return function(_0x2528d7){if(_0x2528d7){return _0x2528d7[_0xdda2('0x27')]()[_0xdda2('0x26')](function(){_0x144f1e['status'](0xcc)[_0xdda2('0x1b')]();});}};}function handleEntityNotFound(_0x4be5ea,_0x2391a5){return function(_0x31d48b){if(!_0x31d48b){_0x4be5ea['sendStatus'](0x194);}return _0x31d48b;};}function handleError(_0x4e97dc,_0x28da54){_0x28da54=_0x28da54||0x1f4;return function(_0x4567e7){logger[_0xdda2('0x28')](_0x4567e7['stack']);if(_0x4567e7[_0xdda2('0x29')]){delete _0x4567e7[_0xdda2('0x29')];}_0x4e97dc[_0xdda2('0x1a')](_0x28da54)[_0xdda2('0x2a')](_0x4567e7);};}exports[_0xdda2('0x2b')]=function(_0x91b41a,_0x4bb8a4){var _0x24c37d={},_0x255bbc={},_0x53acb5={'count':0x0,'rows':[]};var _0x45e800=_[_0xdda2('0x2c')](db[_0xdda2('0x2d')][_0xdda2('0x2e')],function(_0x5540e5){return{'name':_0x5540e5[_0xdda2('0x2f')],'type':_0x5540e5[_0xdda2('0x30')]['key']};});_0x255bbc[_0xdda2('0x31')]=_['map'](_0x45e800,_0xdda2('0x29'));_0x255bbc['query']=_['keys'](_0x91b41a['query']);_0x255bbc[_0xdda2('0x32')]=_['intersection'](_0x255bbc[_0xdda2('0x31')],_0x255bbc['query']);_0x24c37d['attributes']=_['intersection'](_0x255bbc[_0xdda2('0x31')],qs[_0xdda2('0x33')](_0x91b41a[_0xdda2('0x34')][_0xdda2('0x33')]));_0x24c37d[_0xdda2('0x35')]=_0x24c37d[_0xdda2('0x35')][_0xdda2('0x36')]?_0x24c37d[_0xdda2('0x35')]:_0x255bbc[_0xdda2('0x31')];if(!_0x91b41a[_0xdda2('0x34')]['hasOwnProperty'](_0xdda2('0x37'))){_0x24c37d[_0xdda2('0x1f')]=qs[_0xdda2('0x1f')](_0x91b41a[_0xdda2('0x34')][_0xdda2('0x1f')]);_0x24c37d[_0xdda2('0x1c')]=qs[_0xdda2('0x1c')](_0x91b41a['query']['offset']);}_0x24c37d[_0xdda2('0x38')]=qs[_0xdda2('0x39')](_0x91b41a[_0xdda2('0x34')]['sort']);_0x24c37d['where']=qs[_0xdda2('0x32')](_[_0xdda2('0x3a')](_0x91b41a[_0xdda2('0x34')],_0x255bbc[_0xdda2('0x32')]),_0x45e800);if(_0x91b41a[_0xdda2('0x34')]['filter']){_0x24c37d[_0xdda2('0x3b')]=_[_0xdda2('0x3c')](_0x24c37d['where'],{'$or':_['map'](_0x45e800,function(_0x98bf47){if(_0x98bf47[_0xdda2('0x30')]!==_0xdda2('0x3d')){var _0x2708f4={};_0x2708f4[_0x98bf47[_0xdda2('0x29')]]={'$like':'%'+_0x91b41a['query'][_0xdda2('0x3e')]+'%'};return _0x2708f4;}})});}_0x24c37d=_[_0xdda2('0x3c')]({},_0x24c37d,_0x91b41a[_0xdda2('0x3f')]);var _0x1a7262={'where':_0x24c37d['where']};return db['MailQueueReport'][_0xdda2('0x1e')](_0x1a7262)[_0xdda2('0x26')](function(_0x7a25fe){_0x53acb5['count']=_0x7a25fe;if(_0x91b41a[_0xdda2('0x34')]['includeAll']){_0x24c37d[_0xdda2('0x40')]=[{'all':!![]}];}return db['MailQueueReport'][_0xdda2('0x41')](_0x24c37d);})[_0xdda2('0x26')](function(_0x1db762){_0x53acb5[_0xdda2('0x42')]=_0x1db762;return _0x53acb5;})['then'](respondWithFilteredResult(_0x4bb8a4,_0x24c37d))[_0xdda2('0x43')](handleError(_0x4bb8a4,null));};exports['show']=function(_0x392f70,_0x4d3b78){var _0x1d1678={'raw':!![],'where':{'id':_0x392f70[_0xdda2('0x44')]['id']}},_0x12589b={};_0x12589b[_0xdda2('0x31')]=_[_0xdda2('0x45')](db['MailQueueReport'][_0xdda2('0x2e')]);_0x12589b[_0xdda2('0x34')]=_['keys'](_0x392f70[_0xdda2('0x34')]);_0x12589b['filters']=_[_0xdda2('0x46')](_0x12589b[_0xdda2('0x31')],_0x12589b[_0xdda2('0x34')]);_0x1d1678[_0xdda2('0x35')]=_[_0xdda2('0x46')](_0x12589b[_0xdda2('0x31')],qs[_0xdda2('0x33')](_0x392f70[_0xdda2('0x34')][_0xdda2('0x33')]));_0x1d1678[_0xdda2('0x35')]=_0x1d1678[_0xdda2('0x35')][_0xdda2('0x36')]?_0x1d1678[_0xdda2('0x35')]:_0x12589b['model'];if(_0x392f70['query']['includeAll']){_0x1d1678[_0xdda2('0x40')]=[{'all':!![]}];}_0x1d1678=_[_0xdda2('0x3c')]({},_0x1d1678,_0x392f70['options']);return db[_0xdda2('0x2d')][_0xdda2('0x47')](_0x1d1678)[_0xdda2('0x26')](handleEntityNotFound(_0x4d3b78,null))['then'](respondWithResult(_0x4d3b78,null))[_0xdda2('0x43')](handleError(_0x4d3b78,null));};exports[_0xdda2('0x48')]=function(_0x4eada0,_0x5f0aa8){return db[_0xdda2('0x2d')]['create'](_0x4eada0[_0xdda2('0x49')],{})['then'](respondWithResult(_0x5f0aa8,0xc9))[_0xdda2('0x43')](handleError(_0x5f0aa8,null));};exports[_0xdda2('0x25')]=function(_0x50bd88,_0x585665){if(_0x50bd88[_0xdda2('0x49')]['id']){delete _0x50bd88[_0xdda2('0x49')]['id'];}return db[_0xdda2('0x2d')][_0xdda2('0x47')]({'where':{'id':_0x50bd88['params']['id']}})[_0xdda2('0x26')](handleEntityNotFound(_0x585665,null))[_0xdda2('0x26')](saveUpdates(_0x50bd88[_0xdda2('0x49')],null))[_0xdda2('0x26')](respondWithResult(_0x585665,null))[_0xdda2('0x43')](handleError(_0x585665,null));};exports['destroy']=function(_0x1a56cc,_0x40b610){return db['MailQueueReport'][_0xdda2('0x47')]({'where':{'id':_0x1a56cc[_0xdda2('0x44')]['id']}})[_0xdda2('0x26')](handleEntityNotFound(_0x40b610,null))[_0xdda2('0x26')](removeEntity(_0x40b610,null))[_0xdda2('0x43')](handleError(_0x40b610,null));};exports[_0xdda2('0x4a')]=function(_0x4b6519,_0x2c58c7){return db['MailQueueReport'][_0xdda2('0x4a')]()['then'](respondWithResult(_0x2c58c7,null))[_0xdda2('0x43')](handleError(_0x2c58c7,null));}; \ No newline at end of file +var _0x8aad=['sort','pick','filter','where','merge','VIRTUAL','options','include','findAll','rows','catch','show','params','includeAll','find','create','body','describe','eml-format','rimraf','fast-json-patch','moment','bluebird','path','ejs','fs-extra','lodash','crypto','jsforce','desk.js','to-csv','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','api','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','sendStatus','status','undefined','limit','count','offset','Content-Range','json','apply','reject','save','update','then','destroy','end','error','stack','name','send','map','MailQueueReport','rawAttributes','fieldName','type','key','model','query','keys','filters','intersection','fields','attributes','length','hasOwnProperty','nolimit','order'];(function(_0x478c81,_0x1fd0ae){var _0x153acd=function(_0x2ce970){while(--_0x2ce970){_0x478c81['push'](_0x478c81['shift']());}};_0x153acd(++_0x1fd0ae);}(_0x8aad,0x146));var _0xd8aa=function(_0x20103e,_0x69bc4){_0x20103e=_0x20103e-0x0;var _0x256b38=_0x8aad[_0x20103e];return _0x256b38;};'use strict';var emlformat=require(_0xd8aa('0x0'));var rimraf=require(_0xd8aa('0x1'));var zipdir=require('zip-dir');var jsonpatch=require(_0xd8aa('0x2'));var rp=require('request-promise');var moment=require(_0xd8aa('0x3'));var BPromise=require(_0xd8aa('0x4'));var Mustache=require('mustache');var util=require('util');var path=require(_0xd8aa('0x5'));var sox=require('sox');var csv=require('to-csv');var ejs=require(_0xd8aa('0x6'));var fs=require('fs');var fs_extra=require(_0xd8aa('0x7'));var _=require(_0xd8aa('0x8'));var squel=require('squel');var crypto=require(_0xd8aa('0x9'));var jsforce=require(_0xd8aa('0xa'));var deskjs=require(_0xd8aa('0xb'));var toCsv=require(_0xd8aa('0xc'));var querystring=require('querystring');var Papa=require('papaparse');var Redis=require(_0xd8aa('0xd'));var authService=require(_0xd8aa('0xe'));var qs=require(_0xd8aa('0xf'));var as=require(_0xd8aa('0x10'));var hardwareService=require(_0xd8aa('0x11'));var logger=require('../../config/logger')(_0xd8aa('0x12'));var utils=require(_0xd8aa('0x13'));var config=require(_0xd8aa('0x14'));var licenseUtil=require(_0xd8aa('0x15'));var db=require(_0xd8aa('0x16'))['db'];function respondWithStatusCode(_0x6ec0eb,_0x549fad){_0x549fad=_0x549fad||0xcc;return function(_0x1e7db8){if(_0x1e7db8){return _0x6ec0eb[_0xd8aa('0x17')](_0x549fad);}return _0x6ec0eb[_0xd8aa('0x18')](_0x549fad)['end']();};}function respondWithResult(_0x5a8c79,_0x275eff){_0x275eff=_0x275eff||0xc8;return function(_0x319ffe){if(_0x319ffe){return _0x5a8c79[_0xd8aa('0x18')](_0x275eff)['json'](_0x319ffe);}};}function respondWithFilteredResult(_0x2678ed,_0x180c56){return function(_0x39b5bc){if(_0x39b5bc){var _0x404ed6=typeof _0x180c56['offset']===_0xd8aa('0x19')&&typeof _0x180c56[_0xd8aa('0x1a')]==='undefined';var _0x16d5c6=_0x39b5bc[_0xd8aa('0x1b')];var _0x32e2cd=_0x404ed6?0x0:_0x180c56[_0xd8aa('0x1c')];var _0x2d34ac=_0x404ed6?_0x39b5bc['count']:_0x180c56[_0xd8aa('0x1c')]+_0x180c56[_0xd8aa('0x1a')];var _0xb156e6;if(_0x2d34ac>=_0x16d5c6){_0x2d34ac=_0x16d5c6;_0xb156e6=0xc8;}else{_0xb156e6=0xce;}_0x2678ed[_0xd8aa('0x18')](_0xb156e6);return _0x2678ed['set'](_0xd8aa('0x1d'),_0x32e2cd+'-'+_0x2d34ac+'/'+_0x16d5c6)[_0xd8aa('0x1e')](_0x39b5bc);}return null;};}function patchUpdates(_0x46d69b){return function(_0x3588ee){try{jsonpatch[_0xd8aa('0x1f')](_0x3588ee,_0x46d69b,!![]);}catch(_0x4fe5d8){return BPromise[_0xd8aa('0x20')](_0x4fe5d8);}return _0x3588ee[_0xd8aa('0x21')]();};}function saveUpdates(_0xc4f55c,_0x5910b3){return function(_0xa7cf85){if(_0xa7cf85){return _0xa7cf85[_0xd8aa('0x22')](_0xc4f55c)[_0xd8aa('0x23')](function(_0x290849){return _0x290849;});}return null;};}function removeEntity(_0x3ef3a9,_0x16758a){return function(_0x1f64f8){if(_0x1f64f8){return _0x1f64f8[_0xd8aa('0x24')]()[_0xd8aa('0x23')](function(){_0x3ef3a9[_0xd8aa('0x18')](0xcc)[_0xd8aa('0x25')]();});}};}function handleEntityNotFound(_0x370d6f,_0x26cc66){return function(_0x5f1027){if(!_0x5f1027){_0x370d6f[_0xd8aa('0x17')](0x194);}return _0x5f1027;};}function handleError(_0x59eb3f,_0xd4d204){_0xd4d204=_0xd4d204||0x1f4;return function(_0x1f6ab2){logger[_0xd8aa('0x26')](_0x1f6ab2[_0xd8aa('0x27')]);if(_0x1f6ab2[_0xd8aa('0x28')]){delete _0x1f6ab2[_0xd8aa('0x28')];}_0x59eb3f[_0xd8aa('0x18')](_0xd4d204)[_0xd8aa('0x29')](_0x1f6ab2);};}exports['index']=function(_0x1f2a28,_0x34b792){var _0x214393={},_0x49a7c8={},_0x19a59d={'count':0x0,'rows':[]};var _0x51c6f4=_[_0xd8aa('0x2a')](db[_0xd8aa('0x2b')][_0xd8aa('0x2c')],function(_0x168a2e){return{'name':_0x168a2e[_0xd8aa('0x2d')],'type':_0x168a2e[_0xd8aa('0x2e')][_0xd8aa('0x2f')]};});_0x49a7c8[_0xd8aa('0x30')]=_['map'](_0x51c6f4,_0xd8aa('0x28'));_0x49a7c8[_0xd8aa('0x31')]=_[_0xd8aa('0x32')](_0x1f2a28[_0xd8aa('0x31')]);_0x49a7c8[_0xd8aa('0x33')]=_[_0xd8aa('0x34')](_0x49a7c8[_0xd8aa('0x30')],_0x49a7c8[_0xd8aa('0x31')]);_0x214393['attributes']=_[_0xd8aa('0x34')](_0x49a7c8[_0xd8aa('0x30')],qs[_0xd8aa('0x35')](_0x1f2a28['query'][_0xd8aa('0x35')]));_0x214393[_0xd8aa('0x36')]=_0x214393[_0xd8aa('0x36')][_0xd8aa('0x37')]?_0x214393[_0xd8aa('0x36')]:_0x49a7c8[_0xd8aa('0x30')];if(!_0x1f2a28[_0xd8aa('0x31')][_0xd8aa('0x38')](_0xd8aa('0x39'))){_0x214393['limit']=qs[_0xd8aa('0x1a')](_0x1f2a28[_0xd8aa('0x31')][_0xd8aa('0x1a')]);_0x214393[_0xd8aa('0x1c')]=qs[_0xd8aa('0x1c')](_0x1f2a28[_0xd8aa('0x31')][_0xd8aa('0x1c')]);}_0x214393[_0xd8aa('0x3a')]=qs[_0xd8aa('0x3b')](_0x1f2a28['query'][_0xd8aa('0x3b')]);_0x214393['where']=qs[_0xd8aa('0x33')](_[_0xd8aa('0x3c')](_0x1f2a28['query'],_0x49a7c8[_0xd8aa('0x33')]),_0x51c6f4);if(_0x1f2a28[_0xd8aa('0x31')][_0xd8aa('0x3d')]){_0x214393[_0xd8aa('0x3e')]=_[_0xd8aa('0x3f')](_0x214393['where'],{'$or':_['map'](_0x51c6f4,function(_0x25145c){if(_0x25145c['type']!==_0xd8aa('0x40')){var _0x7a6df2={};_0x7a6df2[_0x25145c[_0xd8aa('0x28')]]={'$like':'%'+_0x1f2a28[_0xd8aa('0x31')][_0xd8aa('0x3d')]+'%'};return _0x7a6df2;}})});}_0x214393=_[_0xd8aa('0x3f')]({},_0x214393,_0x1f2a28[_0xd8aa('0x41')]);var _0x3b0220={'where':_0x214393[_0xd8aa('0x3e')]};return db[_0xd8aa('0x2b')][_0xd8aa('0x1b')](_0x3b0220)['then'](function(_0x17ebb4){_0x19a59d[_0xd8aa('0x1b')]=_0x17ebb4;if(_0x1f2a28[_0xd8aa('0x31')]['includeAll']){_0x214393[_0xd8aa('0x42')]=[{'all':!![]}];}return db[_0xd8aa('0x2b')][_0xd8aa('0x43')](_0x214393);})[_0xd8aa('0x23')](function(_0x3a0284){_0x19a59d[_0xd8aa('0x44')]=_0x3a0284;return _0x19a59d;})[_0xd8aa('0x23')](respondWithFilteredResult(_0x34b792,_0x214393))[_0xd8aa('0x45')](handleError(_0x34b792,null));};exports[_0xd8aa('0x46')]=function(_0x3f5857,_0x20c7a0){var _0x3ec42f={'raw':!![],'where':{'id':_0x3f5857[_0xd8aa('0x47')]['id']}},_0x3b26c9={};_0x3b26c9[_0xd8aa('0x30')]=_[_0xd8aa('0x32')](db[_0xd8aa('0x2b')][_0xd8aa('0x2c')]);_0x3b26c9['query']=_[_0xd8aa('0x32')](_0x3f5857[_0xd8aa('0x31')]);_0x3b26c9[_0xd8aa('0x33')]=_[_0xd8aa('0x34')](_0x3b26c9[_0xd8aa('0x30')],_0x3b26c9[_0xd8aa('0x31')]);_0x3ec42f['attributes']=_[_0xd8aa('0x34')](_0x3b26c9['model'],qs[_0xd8aa('0x35')](_0x3f5857['query'][_0xd8aa('0x35')]));_0x3ec42f['attributes']=_0x3ec42f['attributes'][_0xd8aa('0x37')]?_0x3ec42f[_0xd8aa('0x36')]:_0x3b26c9[_0xd8aa('0x30')];if(_0x3f5857[_0xd8aa('0x31')][_0xd8aa('0x48')]){_0x3ec42f[_0xd8aa('0x42')]=[{'all':!![]}];}_0x3ec42f=_['merge']({},_0x3ec42f,_0x3f5857[_0xd8aa('0x41')]);return db[_0xd8aa('0x2b')][_0xd8aa('0x49')](_0x3ec42f)[_0xd8aa('0x23')](handleEntityNotFound(_0x20c7a0,null))[_0xd8aa('0x23')](respondWithResult(_0x20c7a0,null))['catch'](handleError(_0x20c7a0,null));};exports['create']=function(_0x58cf42,_0x1fd1dc){return db[_0xd8aa('0x2b')][_0xd8aa('0x4a')](_0x58cf42[_0xd8aa('0x4b')],{})[_0xd8aa('0x23')](respondWithResult(_0x1fd1dc,0xc9))[_0xd8aa('0x45')](handleError(_0x1fd1dc,null));};exports['update']=function(_0x221e2b,_0x241e23){if(_0x221e2b['body']['id']){delete _0x221e2b[_0xd8aa('0x4b')]['id'];}return db[_0xd8aa('0x2b')][_0xd8aa('0x49')]({'where':{'id':_0x221e2b['params']['id']}})[_0xd8aa('0x23')](handleEntityNotFound(_0x241e23,null))[_0xd8aa('0x23')](saveUpdates(_0x221e2b[_0xd8aa('0x4b')],null))[_0xd8aa('0x23')](respondWithResult(_0x241e23,null))[_0xd8aa('0x45')](handleError(_0x241e23,null));};exports[_0xd8aa('0x24')]=function(_0x4f494d,_0x566d52){return db[_0xd8aa('0x2b')][_0xd8aa('0x49')]({'where':{'id':_0x4f494d[_0xd8aa('0x47')]['id']}})[_0xd8aa('0x23')](handleEntityNotFound(_0x566d52,null))[_0xd8aa('0x23')](removeEntity(_0x566d52,null))[_0xd8aa('0x45')](handleError(_0x566d52,null));};exports[_0xd8aa('0x4c')]=function(_0x4f9d21,_0x9db7e3){return db[_0xd8aa('0x2b')]['describe']()[_0xd8aa('0x23')](respondWithResult(_0x9db7e3,null))['catch'](handleError(_0x9db7e3,null));}; \ No newline at end of file diff --git a/server/api/mailQueueReport/mailQueueReport.model.js b/server/api/mailQueueReport/mailQueueReport.model.js index 3f645ee..e27aeb6 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 _0x24cd=['lodash','util','api','moment','request-promise','rimraf','../../config/environment','./mailQueueReport.attributes','exports','define','MailQueueReport','report_mail_queue','uniqueid'];(function(_0x17a754,_0x5f1052){var _0x545d3e=function(_0x24ec39){while(--_0x24ec39){_0x17a754['push'](_0x17a754['shift']());}};_0x545d3e(++_0x5f1052);}(_0x24cd,0x8f));var _0xd24c=function(_0x4c0208,_0x58bffa){_0x4c0208=_0x4c0208-0x0;var _0x4fe97d=_0x24cd[_0x4c0208];return _0x4fe97d;};'use strict';var _=require(_0xd24c('0x0'));var util=require(_0xd24c('0x1'));var logger=require('../../config/logger')(_0xd24c('0x2'));var moment=require(_0xd24c('0x3'));var BPromise=require('bluebird');var rp=require(_0xd24c('0x4'));var fs=require('fs');var path=require('path');var rimraf=require(_0xd24c('0x5'));var config=require(_0xd24c('0x6'));var attributes=require(_0xd24c('0x7'));module[_0xd24c('0x8')]=function(_0x49146b,_0xa83efc){return _0x49146b[_0xd24c('0x9')](_0xd24c('0xa'),attributes,{'tableName':_0xd24c('0xb'),'paranoid':![],'indexes':[{'name':_0xd24c('0xc'),'fields':['uniqueid']}],'timestamps':!![]});}; \ No newline at end of file +var _0x9618=['rimraf','../../config/environment','./mailQueueReport.attributes','exports','define','report_mail_queue','uniqueid','lodash','util','../../config/logger','api','moment','request-promise','path'];(function(_0x4bb27a,_0x373798){var _0x1ef716=function(_0x5c0403){while(--_0x5c0403){_0x4bb27a['push'](_0x4bb27a['shift']());}};_0x1ef716(++_0x373798);}(_0x9618,0x1b9));var _0x8961=function(_0x5c3fe5,_0x37d4f8){_0x5c3fe5=_0x5c3fe5-0x0;var _0x32ad29=_0x9618[_0x5c3fe5];return _0x32ad29;};'use strict';var _=require(_0x8961('0x0'));var util=require(_0x8961('0x1'));var logger=require(_0x8961('0x2'))(_0x8961('0x3'));var moment=require(_0x8961('0x4'));var BPromise=require('bluebird');var rp=require(_0x8961('0x5'));var fs=require('fs');var path=require(_0x8961('0x6'));var rimraf=require(_0x8961('0x7'));var config=require(_0x8961('0x8'));var attributes=require(_0x8961('0x9'));module[_0x8961('0xa')]=function(_0x5bd3f4,_0x4391e3){return _0x5bd3f4[_0x8961('0xb')]('MailQueueReport',attributes,{'tableName':_0x8961('0xc'),'paranoid':![],'indexes':[{'name':_0x8961('0xd'),'fields':[_0x8961('0xd')]}],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/mailQueueReport/mailQueueReport.rpc.js b/server/api/mailQueueReport/mailQueueReport.rpc.js index 0a9530c..396037f 100644 --- a/server/api/mailQueueReport/mailQueueReport.rpc.js +++ b/server/api/mailQueueReport/mailQueueReport.rpc.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x7a54=['moment','randomstring','ioredis','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','http','info','MailQueueReport,\x20%s,\x20%s','debug','stringify','error','code','message','request\x20sent','result','catch','MailQueueReport','create','body','options','raw','CreateMailQueueReport','UpdateMailQueueReport','update','where','attributes','limit','then','lodash','util'];(function(_0x9db457,_0xcfd958){var _0xc8a791=function(_0x5e4ab2){while(--_0x5e4ab2){_0x9db457['push'](_0x9db457['shift']());}};_0xc8a791(++_0xcfd958);}(_0x7a54,0x106));var _0x47a5=function(_0x46b350,_0x5dde4f){_0x46b350=_0x46b350-0x0;var _0x26a9b3=_0x7a54[_0x46b350];return _0x26a9b3;};'use strict';var _=require(_0x47a5('0x0'));var util=require(_0x47a5('0x1'));var moment=require(_0x47a5('0x2'));var BPromise=require('bluebird');var rs=require(_0x47a5('0x3'));var fs=require('fs');var Redis=require(_0x47a5('0x4'));var db=require('../../mysqldb')['db'];var utils=require(_0x47a5('0x5'));var logger=require(_0x47a5('0x6'))(_0x47a5('0x7'));var config=require(_0x47a5('0x8'));var jayson=require(_0x47a5('0x9'));var client=jayson['client'][_0x47a5('0xa')]({'port':0x232a});function respondWithRpcPromise(_0x59199c,_0x343372,_0x30e405){return new BPromise(function(_0x506eda,_0x194fb0){return client['request'](_0x59199c,_0x30e405)['then'](function(_0x582352){logger[_0x47a5('0xb')](_0x47a5('0xc'),_0x343372,'request\x20sent');logger[_0x47a5('0xd')]('MailQueueReport,\x20%s,\x20%s,\x20%s',_0x343372,'request\x20sent',JSON[_0x47a5('0xe')](_0x582352));if(_0x582352[_0x47a5('0xf')]){if(_0x582352[_0x47a5('0xf')][_0x47a5('0x10')]===0x1f4){logger[_0x47a5('0xf')](_0x47a5('0xc'),_0x343372,_0x582352[_0x47a5('0xf')]['message']);return _0x194fb0(_0x582352[_0x47a5('0xf')][_0x47a5('0x11')]);}logger[_0x47a5('0xf')](_0x47a5('0xc'),_0x343372,_0x582352[_0x47a5('0xf')][_0x47a5('0x11')]);return _0x506eda(_0x582352[_0x47a5('0xf')][_0x47a5('0x11')]);}else{logger['info'](_0x47a5('0xc'),_0x343372,_0x47a5('0x12'));_0x506eda(_0x582352[_0x47a5('0x13')][_0x47a5('0x11')]);}})[_0x47a5('0x14')](function(_0x574af6){logger['error'](_0x47a5('0xc'),_0x343372,_0x574af6);_0x194fb0(_0x574af6);});});}exports['CreateMailQueueReport']=function(_0x5247fd){var _0x423a81=this;return new Promise(function(_0xaf70a6,_0x2ce454){return db[_0x47a5('0x15')][_0x47a5('0x16')](_0x5247fd[_0x47a5('0x17')],{'raw':_0x5247fd[_0x47a5('0x18')]?_0x5247fd[_0x47a5('0x18')][_0x47a5('0x19')]===undefined?!![]:![]:!![]})['then'](function(_0x1570bc){logger[_0x47a5('0xb')]('CreateMailQueueReport',_0x5247fd);logger[_0x47a5('0xd')](_0x47a5('0x1a'),_0x5247fd,JSON[_0x47a5('0xe')](_0x1570bc));_0xaf70a6(_0x1570bc);})['catch'](function(_0xb8ae6c){logger[_0x47a5('0xf')](_0x47a5('0x1a'),_0xb8ae6c[_0x47a5('0x11')],_0x5247fd);_0x2ce454(_0x423a81['error'](0x1f4,_0xb8ae6c[_0x47a5('0x11')]));});});};exports[_0x47a5('0x1b')]=function(_0x513981){var _0x28747d=this;return new Promise(function(_0xc4cd63,_0x4437f1){return db[_0x47a5('0x15')][_0x47a5('0x1c')](_0x513981['body'],{'raw':_0x513981['options']?_0x513981[_0x47a5('0x18')]['raw']===undefined?!![]:![]:!![],'individualHooks':!![],'where':_0x513981[_0x47a5('0x18')]?_0x513981['options'][_0x47a5('0x1d')]||null:null,'attributes':_0x513981[_0x47a5('0x18')]?_0x513981[_0x47a5('0x18')][_0x47a5('0x1e')]||null:null,'limit':_0x513981[_0x47a5('0x18')]?_0x513981[_0x47a5('0x18')][_0x47a5('0x1f')]||null:null})[_0x47a5('0x20')](function(_0x16631f){logger[_0x47a5('0xb')](_0x47a5('0x1b'),_0x513981);logger[_0x47a5('0xd')](_0x47a5('0x1b'),_0x513981,JSON['stringify'](_0x16631f));_0xc4cd63(_0x16631f);})[_0x47a5('0x14')](function(_0x51833b){logger[_0x47a5('0xf')](_0x47a5('0x1b'),_0x51833b[_0x47a5('0x11')],_0x513981);_0x4437f1(_0x28747d['error'](0x1f4,_0x51833b[_0x47a5('0x11')]));});});}; \ No newline at end of file +var _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(_0x15a909,_0x5e00c9){var _0xb5d8f4=function(_0x4a0640){while(--_0x4a0640){_0x15a909['push'](_0x15a909['shift']());}};_0xb5d8f4(++_0x5e00c9);}(_0xc4aa,0x1b7));var _0xac4a=function(_0x255d5b,_0x4f6f35){_0x255d5b=_0x255d5b-0x0;var _0x3e141a=_0xc4aa[_0x255d5b];return _0x3e141a;};'use strict';var _=require(_0xac4a('0x0'));var util=require(_0xac4a('0x1'));var moment=require(_0xac4a('0x2'));var BPromise=require(_0xac4a('0x3'));var rs=require(_0xac4a('0x4'));var fs=require('fs');var Redis=require(_0xac4a('0x5'));var db=require('../../mysqldb')['db'];var utils=require('../../config/utils');var logger=require('../../config/logger')(_0xac4a('0x6'));var config=require(_0xac4a('0x7'));var jayson=require(_0xac4a('0x8'));var client=jayson[_0xac4a('0x9')][_0xac4a('0xa')]({'port':0x232a});function respondWithRpcPromise(_0x15cd34,_0x3ef77c,_0x10525b){return new BPromise(function(_0x5c6179,_0x5b8339){return client[_0xac4a('0xb')](_0x15cd34,_0x10525b)[_0xac4a('0xc')](function(_0x26ec84){logger['info'](_0xac4a('0xd'),_0x3ef77c,_0xac4a('0xe'));logger[_0xac4a('0xf')]('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 f44b7e3..c23d363 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(_0x2d398b,_0x5e98f8){var _0x5d8b9d=function(_0x121a78){while(--_0x121a78){_0x2d398b['push'](_0x2d398b['shift']());}};_0x5d8b9d(++_0x5e98f8);}(_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(_0x4adfe8,_0x5bfb9a){var _0x22a1fc=function(_0x4b0f8b){while(--_0x4b0f8b){_0x4adfe8['push'](_0x4adfe8['shift']());}};_0x22a1fc(++_0x5bfb9a);}(_0x70e0,0x17b));var _0x070e=function(_0x56e2e7,_0x315529){_0x56e2e7=_0x56e2e7-0x0;var _0x371dad=_0x70e0[_0x56e2e7];return _0x371dad;};'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/mailServerIn/mailServerIn.attributes.js b/server/api/mailServerIn/mailServerIn.attributes.js index 7b2c2dd..f65b3a0 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 _0x4981=['exports','STRING','BOOLEAN','INBOX','INTEGER','sequelize'];(function(_0x5c3c0b,_0x4ee35e){var _0x52ecd2=function(_0x3cf575){while(--_0x3cf575){_0x5c3c0b['push'](_0x5c3c0b['shift']());}};_0x52ecd2(++_0x4ee35e);}(_0x4981,0x19d));var _0x1498=function(_0x42cfea,_0x40173c){_0x42cfea=_0x42cfea-0x0;var _0x319dc7=_0x4981[_0x42cfea];return _0x319dc7;};'use strict';var Sequelize=require(_0x1498('0x0'));module[_0x1498('0x1')]={'description':{'type':Sequelize[_0x1498('0x2')]},'host':{'type':Sequelize[_0x1498('0x2')]},'authentication':{'type':Sequelize[_0x1498('0x3')],'defaultValue':!![]},'user':{'type':Sequelize[_0x1498('0x2')]},'password':{'type':Sequelize[_0x1498('0x2')]},'port':{'type':Sequelize['INTEGER']},'tls':{'type':Sequelize[_0x1498('0x3')],'defaultValue':!![]},'mailbox':{'type':Sequelize[_0x1498('0x2')],'defaultValue':_0x1498('0x4')},'connTimeout':{'type':Sequelize[_0x1498('0x5')],'defaultValue':0xa},'authTimeout':{'type':Sequelize[_0x1498('0x5')],'defaultValue':0x5},'service':{'type':Sequelize['STRING']},'modernAuthentication':{'type':Sequelize[_0x1498('0x3')],'defaultValue':![]}}; \ No newline at end of file +var _0xe0b9=['sequelize','exports','STRING','BOOLEAN','INTEGER'];(function(_0x45d55e,_0x2fede3){var _0x29812a=function(_0x3c6830){while(--_0x3c6830){_0x45d55e['push'](_0x45d55e['shift']());}};_0x29812a(++_0x2fede3);}(_0xe0b9,0x109));var _0x9e0b=function(_0x34b1b8,_0x54c9bf){_0x34b1b8=_0x34b1b8-0x0;var _0x542dd8=_0xe0b9[_0x34b1b8];return _0x542dd8;};'use strict';var Sequelize=require(_0x9e0b('0x0'));module[_0x9e0b('0x1')]={'description':{'type':Sequelize[_0x9e0b('0x2')]},'host':{'type':Sequelize[_0x9e0b('0x2')]},'authentication':{'type':Sequelize[_0x9e0b('0x3')],'defaultValue':!![]},'user':{'type':Sequelize[_0x9e0b('0x2')]},'password':{'type':Sequelize[_0x9e0b('0x2')]},'port':{'type':Sequelize[_0x9e0b('0x4')]},'tls':{'type':Sequelize[_0x9e0b('0x3')],'defaultValue':!![]},'mailbox':{'type':Sequelize[_0x9e0b('0x2')],'defaultValue':'INBOX'},'connTimeout':{'type':Sequelize[_0x9e0b('0x4')],'defaultValue':0xa},'authTimeout':{'type':Sequelize[_0x9e0b('0x4')],'defaultValue':0x5},'service':{'type':Sequelize[_0x9e0b('0x2')]},'modernAuthentication':{'type':Sequelize['BOOLEAN'],'defaultValue':![]}}; \ No newline at end of file diff --git a/server/api/mailServerIn/mailServerIn.model.js b/server/api/mailServerIn/mailServerIn.model.js index 1d28ae6..4139b27 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 _0x0ebd=['../../config/environment','./mailServerIn.attributes','exports','define','MailServerIn','mail_servers_in','lodash','util','api','moment','bluebird','request-promise','rimraf'];(function(_0x3b8251,_0x2e024c){var _0x23033a=function(_0x4f8e80){while(--_0x4f8e80){_0x3b8251['push'](_0x3b8251['shift']());}};_0x23033a(++_0x2e024c);}(_0x0ebd,0xe3));var _0xd0eb=function(_0x10da54,_0x179fcb){_0x10da54=_0x10da54-0x0;var _0x17028a=_0x0ebd[_0x10da54];return _0x17028a;};'use strict';var _=require(_0xd0eb('0x0'));var util=require(_0xd0eb('0x1'));var logger=require('../../config/logger')(_0xd0eb('0x2'));var moment=require(_0xd0eb('0x3'));var BPromise=require(_0xd0eb('0x4'));var rp=require(_0xd0eb('0x5'));var fs=require('fs');var path=require('path');var rimraf=require(_0xd0eb('0x6'));var config=require(_0xd0eb('0x7'));var attributes=require(_0xd0eb('0x8'));module[_0xd0eb('0x9')]=function(_0x291933,_0x43cd92){return _0x291933[_0xd0eb('0xa')](_0xd0eb('0xb'),attributes,{'tableName':_0xd0eb('0xc'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x9a04=['MailServerIn','mail_servers_in','lodash','util','../../config/logger','bluebird','request-promise','rimraf','./mailServerIn.attributes'];(function(_0x12b2bc,_0x480fd4){var _0xd99024=function(_0x4588fb){while(--_0x4588fb){_0x12b2bc['push'](_0x12b2bc['shift']());}};_0xd99024(++_0x480fd4);}(_0x9a04,0x1e8));var _0x49a0=function(_0x27fa45,_0x39acb4){_0x27fa45=_0x27fa45-0x0;var _0x45ccee=_0x9a04[_0x27fa45];return _0x45ccee;};'use strict';var _=require(_0x49a0('0x0'));var util=require(_0x49a0('0x1'));var logger=require(_0x49a0('0x2'))('api');var moment=require('moment');var BPromise=require(_0x49a0('0x3'));var rp=require(_0x49a0('0x4'));var fs=require('fs');var path=require('path');var rimraf=require(_0x49a0('0x5'));var config=require('../../config/environment');var attributes=require(_0x49a0('0x6'));module['exports']=function(_0x188e4f,_0x43e85a){return _0x188e4f['define'](_0x49a0('0x7'),attributes,{'tableName':_0x49a0('0x8'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/mailServerIn/mailServerIn.rpc.js b/server/api/mailServerIn/mailServerIn.rpc.js index 0fbf9b3..6c7b89a 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 _0xef38=['include','info','util','moment','bluebird','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','client','http','request','then','MailServerIn,\x20%s,\x20%s','request\x20sent','debug','MailServerIn,\x20%s,\x20%s,\x20%s','stringify','error','code','message','result','GetMailServerIn','MailServerIn','findAll','options','raw','attributes','limit','map','model'];(function(_0x18b6ed,_0x472642){var _0x430e50=function(_0x53dfc1){while(--_0x53dfc1){_0x18b6ed['push'](_0x18b6ed['shift']());}};_0x430e50(++_0x472642);}(_0xef38,0x122));var _0x8ef3=function(_0x40814e,_0x246052){_0x40814e=_0x40814e-0x0;var _0x2e8e09=_0xef38[_0x40814e];return _0x2e8e09;};'use strict';var _=require('lodash');var util=require(_0x8ef3('0x0'));var moment=require(_0x8ef3('0x1'));var BPromise=require(_0x8ef3('0x2'));var rs=require('randomstring');var fs=require('fs');var Redis=require('ioredis');var db=require(_0x8ef3('0x3'))['db'];var utils=require(_0x8ef3('0x4'));var logger=require(_0x8ef3('0x5'))(_0x8ef3('0x6'));var config=require(_0x8ef3('0x7'));var jayson=require('jayson/promise');var client=jayson[_0x8ef3('0x8')][_0x8ef3('0x9')]({'port':0x232a});function respondWithRpcPromise(_0x50ee13,_0x2c9ccd,_0x26107d){return new BPromise(function(_0x217874,_0x12b6c0){return client[_0x8ef3('0xa')](_0x50ee13,_0x26107d)[_0x8ef3('0xb')](function(_0xc4b3b3){logger['info'](_0x8ef3('0xc'),_0x2c9ccd,_0x8ef3('0xd'));logger[_0x8ef3('0xe')](_0x8ef3('0xf'),_0x2c9ccd,_0x8ef3('0xd'),JSON[_0x8ef3('0x10')](_0xc4b3b3));if(_0xc4b3b3[_0x8ef3('0x11')]){if(_0xc4b3b3[_0x8ef3('0x11')][_0x8ef3('0x12')]===0x1f4){logger[_0x8ef3('0x11')](_0x8ef3('0xc'),_0x2c9ccd,_0xc4b3b3[_0x8ef3('0x11')][_0x8ef3('0x13')]);return _0x12b6c0(_0xc4b3b3[_0x8ef3('0x11')][_0x8ef3('0x13')]);}logger[_0x8ef3('0x11')](_0x8ef3('0xc'),_0x2c9ccd,_0xc4b3b3[_0x8ef3('0x11')][_0x8ef3('0x13')]);return _0x217874(_0xc4b3b3['error'][_0x8ef3('0x13')]);}else{logger['info'](_0x8ef3('0xc'),_0x2c9ccd,'request\x20sent');_0x217874(_0xc4b3b3[_0x8ef3('0x14')][_0x8ef3('0x13')]);}})['catch'](function(_0x56884c){logger[_0x8ef3('0x11')](_0x8ef3('0xc'),_0x2c9ccd,_0x56884c);_0x12b6c0(_0x56884c);});});}exports[_0x8ef3('0x15')]=function(_0x434aa9){var _0x5296f2=this;return new Promise(function(_0x5cbed2,_0x29025b){return db[_0x8ef3('0x16')][_0x8ef3('0x17')]({'raw':_0x434aa9[_0x8ef3('0x18')]?_0x434aa9['options'][_0x8ef3('0x19')]===undefined?!![]:![]:!![],'where':_0x434aa9[_0x8ef3('0x18')]?_0x434aa9[_0x8ef3('0x18')]['where']||null:null,'attributes':_0x434aa9['options']?_0x434aa9[_0x8ef3('0x18')][_0x8ef3('0x1a')]||null:null,'limit':_0x434aa9[_0x8ef3('0x18')]?_0x434aa9[_0x8ef3('0x18')][_0x8ef3('0x1b')]||null:null,'include':_0x434aa9[_0x8ef3('0x18')]?_0x434aa9[_0x8ef3('0x18')]['include']?_[_0x8ef3('0x1c')](_0x434aa9[_0x8ef3('0x18')]['include'],function(_0xa9829e){return{'model':db[_0xa9829e[_0x8ef3('0x1d')]],'as':_0xa9829e['as'],'attributes':_0xa9829e[_0x8ef3('0x1a')],'include':_0xa9829e[_0x8ef3('0x1e')]?_[_0x8ef3('0x1c')](_0xa9829e['include'],function(_0x18ef45){return{'model':db[_0x18ef45[_0x8ef3('0x1d')]],'as':_0x18ef45['as'],'attributes':_0x18ef45[_0x8ef3('0x1a')],'include':_0x18ef45[_0x8ef3('0x1e')]?_['map'](_0x18ef45[_0x8ef3('0x1e')],function(_0x28637a){return{'model':db[_0x28637a[_0x8ef3('0x1d')]],'as':_0x28637a['as'],'attributes':_0x28637a[_0x8ef3('0x1a')]};}):[]};}):[]};}):[]:[]})[_0x8ef3('0xb')](function(_0x28748f){logger[_0x8ef3('0x1f')](_0x8ef3('0x15'),_0x434aa9);logger[_0x8ef3('0xe')](_0x8ef3('0x15'),_0x434aa9,JSON[_0x8ef3('0x10')](_0x28748f));_0x5cbed2(_0x28748f);})['catch'](function(_0x4408f9){logger[_0x8ef3('0x11')](_0x8ef3('0x15'),_0x4408f9[_0x8ef3('0x13')],_0x434aa9);_0x29025b(_0x5296f2[_0x8ef3('0x11')](0x1f4,_0x4408f9[_0x8ef3('0x13')]));});});}; \ No newline at end of file +var _0x0c24=['rpc','../../config/environment','client','http','request','then','info','MailServerIn,\x20%s,\x20%s','request\x20sent','debug','MailServerIn,\x20%s,\x20%s,\x20%s','stringify','error','code','message','result','GetMailServerIn','options','where','limit','include','map','model','attributes','catch','moment','bluebird','ioredis','../../config/logger'];(function(_0xdb73ea,_0x14aa33){var _0x5f7490=function(_0x48c59f){while(--_0x48c59f){_0xdb73ea['push'](_0xdb73ea['shift']());}};_0x5f7490(++_0x14aa33);}(_0x0c24,0x13b));var _0x40c2=function(_0x474376,_0x385824){_0x474376=_0x474376-0x0;var _0x9141b=_0x0c24[_0x474376];return _0x9141b;};'use strict';var _=require('lodash');var util=require('util');var moment=require(_0x40c2('0x0'));var BPromise=require(_0x40c2('0x1'));var rs=require('randomstring');var fs=require('fs');var Redis=require(_0x40c2('0x2'));var db=require('../../mysqldb')['db'];var utils=require('../../config/utils');var logger=require(_0x40c2('0x3'))(_0x40c2('0x4'));var config=require(_0x40c2('0x5'));var jayson=require('jayson/promise');var client=jayson[_0x40c2('0x6')][_0x40c2('0x7')]({'port':0x232a});function respondWithRpcPromise(_0x413670,_0x19abb1,_0x2c1b0c){return new BPromise(function(_0x38cc37,_0x5dfb8c){return client[_0x40c2('0x8')](_0x413670,_0x2c1b0c)[_0x40c2('0x9')](function(_0x34bc74){logger[_0x40c2('0xa')](_0x40c2('0xb'),_0x19abb1,_0x40c2('0xc'));logger[_0x40c2('0xd')](_0x40c2('0xe'),_0x19abb1,_0x40c2('0xc'),JSON[_0x40c2('0xf')](_0x34bc74));if(_0x34bc74['error']){if(_0x34bc74[_0x40c2('0x10')][_0x40c2('0x11')]===0x1f4){logger[_0x40c2('0x10')](_0x40c2('0xb'),_0x19abb1,_0x34bc74[_0x40c2('0x10')]['message']);return _0x5dfb8c(_0x34bc74['error']['message']);}logger[_0x40c2('0x10')](_0x40c2('0xb'),_0x19abb1,_0x34bc74['error']['message']);return _0x38cc37(_0x34bc74['error'][_0x40c2('0x12')]);}else{logger['info'](_0x40c2('0xb'),_0x19abb1,_0x40c2('0xc'));_0x38cc37(_0x34bc74[_0x40c2('0x13')][_0x40c2('0x12')]);}})['catch'](function(_0x551007){logger[_0x40c2('0x10')]('MailServerIn,\x20%s,\x20%s',_0x19abb1,_0x551007);_0x5dfb8c(_0x551007);});});}exports[_0x40c2('0x14')]=function(_0x5cda21){var _0x210e8b=this;return new Promise(function(_0x513329,_0x447a7f){return db['MailServerIn']['findAll']({'raw':_0x5cda21[_0x40c2('0x15')]?_0x5cda21[_0x40c2('0x15')]['raw']===undefined?!![]:![]:!![],'where':_0x5cda21[_0x40c2('0x15')]?_0x5cda21[_0x40c2('0x15')][_0x40c2('0x16')]||null:null,'attributes':_0x5cda21[_0x40c2('0x15')]?_0x5cda21[_0x40c2('0x15')]['attributes']||null:null,'limit':_0x5cda21['options']?_0x5cda21[_0x40c2('0x15')][_0x40c2('0x17')]||null:null,'include':_0x5cda21[_0x40c2('0x15')]?_0x5cda21[_0x40c2('0x15')][_0x40c2('0x18')]?_[_0x40c2('0x19')](_0x5cda21['options'][_0x40c2('0x18')],function(_0x4b5234){return{'model':db[_0x4b5234[_0x40c2('0x1a')]],'as':_0x4b5234['as'],'attributes':_0x4b5234['attributes'],'include':_0x4b5234['include']?_[_0x40c2('0x19')](_0x4b5234[_0x40c2('0x18')],function(_0x2bd8df){return{'model':db[_0x2bd8df['model']],'as':_0x2bd8df['as'],'attributes':_0x2bd8df[_0x40c2('0x1b')],'include':_0x2bd8df[_0x40c2('0x18')]?_[_0x40c2('0x19')](_0x2bd8df[_0x40c2('0x18')],function(_0x2e4e66){return{'model':db[_0x2e4e66['model']],'as':_0x2e4e66['as'],'attributes':_0x2e4e66[_0x40c2('0x1b')]};}):[]};}):[]};}):[]:[]})['then'](function(_0x3c43ba){logger[_0x40c2('0xa')](_0x40c2('0x14'),_0x5cda21);logger[_0x40c2('0xd')](_0x40c2('0x14'),_0x5cda21,JSON[_0x40c2('0xf')](_0x3c43ba));_0x513329(_0x3c43ba);})[_0x40c2('0x1c')](function(_0x371b62){logger[_0x40c2('0x10')](_0x40c2('0x14'),_0x371b62[_0x40c2('0x12')],_0x5cda21);_0x447a7f(_0x210e8b[_0x40c2('0x10')](0x1f4,_0x371b62[_0x40c2('0x12')]));});});}; \ No newline at end of file diff --git a/server/api/mailServerOut/index.js b/server/api/mailServerOut/index.js index 8940681..f8b8e6c 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(_0x494d1f,_0x3f72ff){var _0x457b6e=function(_0x38cb16){while(--_0x38cb16){_0x494d1f['push'](_0x494d1f['shift']());}};_0x457b6e(++_0x3f72ff);}(_0x9957,0x93));var _0x7995=function(_0x5ddb1c,_0x5ea4df){_0x5ddb1c=_0x5ddb1c-0x0;var _0x354adc=_0x9957[_0x5ddb1c];return _0x354adc;};'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(_0x40ac5e,_0x2de228){var _0x2839d6=function(_0x123d47){while(--_0x123d47){_0x40ac5e['push'](_0x40ac5e['shift']());}};_0x2839d6(++_0x2de228);}(_0x7a54,0x106));var _0x47a5=function(_0x7b2d90,_0x57f021){_0x7b2d90=_0x7b2d90-0x0;var _0x122eb6=_0x7a54[_0x7b2d90];return _0x122eb6;};'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 b3596db..a761601 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 _0x1c7c=['sequelize','exports','STRING','BOOLEAN'];(function(_0x48e98b,_0x14b40d){var _0x50224f=function(_0x5b4e07){while(--_0x5b4e07){_0x48e98b['push'](_0x48e98b['shift']());}};_0x50224f(++_0x14b40d);}(_0x1c7c,0x164));var _0xc1c7=function(_0x2c74b1,_0x3784a5){_0x2c74b1=_0x2c74b1-0x0;var _0x5d4554=_0x1c7c[_0x2c74b1];return _0x5d4554;};'use strict';var Sequelize=require(_0xc1c7('0x0'));module[_0xc1c7('0x1')]={'description':{'type':Sequelize[_0xc1c7('0x2')]},'host':{'type':Sequelize[_0xc1c7('0x2')]},'user':{'type':Sequelize['STRING']},'pass':{'type':Sequelize[_0xc1c7('0x2')]},'port':{'type':Sequelize['INTEGER']},'secure':{'type':Sequelize[_0xc1c7('0x3')],'defaultValue':![]},'service':{'type':Sequelize[_0xc1c7('0x2')]},'authentication':{'type':Sequelize[_0xc1c7('0x3')],'defaultValue':!![]},'modernAuthentication':{'type':Sequelize[_0xc1c7('0x3')],'defaultValue':![]}}; \ No newline at end of file +var _0xb62e=['STRING','INTEGER','BOOLEAN','sequelize','exports'];(function(_0x2dacca,_0x3b55a5){var _0x4e8745=function(_0x4c4515){while(--_0x4c4515){_0x2dacca['push'](_0x2dacca['shift']());}};_0x4e8745(++_0x3b55a5);}(_0xb62e,0x1de));var _0xeb62=function(_0x167cc1,_0x56ef5a){_0x167cc1=_0x167cc1-0x0;var _0x10bc4b=_0xb62e[_0x167cc1];return _0x10bc4b;};'use strict';var Sequelize=require(_0xeb62('0x0'));module[_0xeb62('0x1')]={'description':{'type':Sequelize[_0xeb62('0x2')]},'host':{'type':Sequelize[_0xeb62('0x2')]},'user':{'type':Sequelize['STRING']},'pass':{'type':Sequelize[_0xeb62('0x2')]},'port':{'type':Sequelize[_0xeb62('0x3')]},'secure':{'type':Sequelize[_0xeb62('0x4')],'defaultValue':![]},'service':{'type':Sequelize[_0xeb62('0x2')]},'authentication':{'type':Sequelize[_0xeb62('0x4')],'defaultValue':!![]},'modernAuthentication':{'type':Sequelize[_0xeb62('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 6b7e9e9..a635b0f 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 _0x54fa=['sort','where','pick','filter','VIRTUAL','merge','options','includeAll','include','findAll','rows','catch','show','keys','find','create','body','params','eml-format','rimraf','zip-dir','fast-json-patch','moment','mustache','path','sox','to-csv','ejs','fs-extra','lodash','squel','crypto','jsforce','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','api','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','sendStatus','status','end','json','offset','undefined','count','limit','set','Content-Range','apply','save','then','destroy','error','name','send','index','map','MailServerOut','rawAttributes','fieldName','type','key','model','query','filters','intersection','attributes','fields','length','hasOwnProperty','nolimit','order'];(function(_0x19950b,_0x53d0d7){var _0x3c6b41=function(_0x3924ad){while(--_0x3924ad){_0x19950b['push'](_0x19950b['shift']());}};_0x3c6b41(++_0x53d0d7);}(_0x54fa,0x14e));var _0xa54f=function(_0x3e1829,_0xc8ccda){_0x3e1829=_0x3e1829-0x0;var _0x129345=_0x54fa[_0x3e1829];return _0x129345;};'use strict';var emlformat=require(_0xa54f('0x0'));var rimraf=require(_0xa54f('0x1'));var zipdir=require(_0xa54f('0x2'));var jsonpatch=require(_0xa54f('0x3'));var rp=require('request-promise');var moment=require(_0xa54f('0x4'));var BPromise=require('bluebird');var Mustache=require(_0xa54f('0x5'));var util=require('util');var path=require(_0xa54f('0x6'));var sox=require(_0xa54f('0x7'));var csv=require(_0xa54f('0x8'));var ejs=require(_0xa54f('0x9'));var fs=require('fs');var fs_extra=require(_0xa54f('0xa'));var _=require(_0xa54f('0xb'));var squel=require(_0xa54f('0xc'));var crypto=require(_0xa54f('0xd'));var jsforce=require(_0xa54f('0xe'));var deskjs=require('desk.js');var toCsv=require(_0xa54f('0x8'));var querystring=require(_0xa54f('0xf'));var Papa=require(_0xa54f('0x10'));var Redis=require(_0xa54f('0x11'));var authService=require(_0xa54f('0x12'));var qs=require(_0xa54f('0x13'));var as=require(_0xa54f('0x14'));var hardwareService=require(_0xa54f('0x15'));var logger=require('../../config/logger')(_0xa54f('0x16'));var utils=require(_0xa54f('0x17'));var config=require(_0xa54f('0x18'));var licenseUtil=require(_0xa54f('0x19'));var db=require(_0xa54f('0x1a'))['db'];function respondWithStatusCode(_0x2f16d5,_0x44ddf1){_0x44ddf1=_0x44ddf1||0xcc;return function(_0x585169){if(_0x585169){return _0x2f16d5[_0xa54f('0x1b')](_0x44ddf1);}return _0x2f16d5[_0xa54f('0x1c')](_0x44ddf1)[_0xa54f('0x1d')]();};}function respondWithResult(_0x3aa58a,_0x1ab892){_0x1ab892=_0x1ab892||0xc8;return function(_0xa22edf){if(_0xa22edf){return _0x3aa58a[_0xa54f('0x1c')](_0x1ab892)[_0xa54f('0x1e')](_0xa22edf);}};}function respondWithFilteredResult(_0x3f1879,_0x46231b){return function(_0x268890){if(_0x268890){var _0xb7f186=typeof _0x46231b[_0xa54f('0x1f')]===_0xa54f('0x20')&&typeof _0x46231b['limit']===_0xa54f('0x20');var _0x4fc557=_0x268890[_0xa54f('0x21')];var _0x3214f3=_0xb7f186?0x0:_0x46231b[_0xa54f('0x1f')];var _0x2c61ea=_0xb7f186?_0x268890[_0xa54f('0x21')]:_0x46231b[_0xa54f('0x1f')]+_0x46231b[_0xa54f('0x22')];var _0x2b88e1;if(_0x2c61ea>=_0x4fc557){_0x2c61ea=_0x4fc557;_0x2b88e1=0xc8;}else{_0x2b88e1=0xce;}_0x3f1879['status'](_0x2b88e1);return _0x3f1879[_0xa54f('0x23')](_0xa54f('0x24'),_0x3214f3+'-'+_0x2c61ea+'/'+_0x4fc557)[_0xa54f('0x1e')](_0x268890);}return null;};}function patchUpdates(_0x39654c){return function(_0x16a771){try{jsonpatch[_0xa54f('0x25')](_0x16a771,_0x39654c,!![]);}catch(_0x4daca7){return BPromise['reject'](_0x4daca7);}return _0x16a771[_0xa54f('0x26')]();};}function saveUpdates(_0x33e7d1,_0x19e748){return function(_0x4550a6){if(_0x4550a6){return _0x4550a6['update'](_0x33e7d1)[_0xa54f('0x27')](function(_0x397f18){return _0x397f18;});}return null;};}function removeEntity(_0x3aa002,_0x44d4b8){return function(_0x124a12){if(_0x124a12){return _0x124a12[_0xa54f('0x28')]()[_0xa54f('0x27')](function(){_0x3aa002[_0xa54f('0x1c')](0xcc)['end']();});}};}function handleEntityNotFound(_0xe69b79,_0x8fa63){return function(_0x220fbf){if(!_0x220fbf){_0xe69b79['sendStatus'](0x194);}return _0x220fbf;};}function handleError(_0x58f4cc,_0x194f51){_0x194f51=_0x194f51||0x1f4;return function(_0x47acb2){logger[_0xa54f('0x29')](_0x47acb2['stack']);if(_0x47acb2[_0xa54f('0x2a')]){delete _0x47acb2[_0xa54f('0x2a')];}_0x58f4cc['status'](_0x194f51)[_0xa54f('0x2b')](_0x47acb2);};}exports[_0xa54f('0x2c')]=function(_0x33c033,_0x4960a8){var _0x4eed92={},_0xfddf85={},_0x130209={'count':0x0,'rows':[]};var _0x400dd2=_[_0xa54f('0x2d')](db[_0xa54f('0x2e')][_0xa54f('0x2f')],function(_0x1a3a99){return{'name':_0x1a3a99[_0xa54f('0x30')],'type':_0x1a3a99[_0xa54f('0x31')][_0xa54f('0x32')]};});_0xfddf85[_0xa54f('0x33')]=_[_0xa54f('0x2d')](_0x400dd2,_0xa54f('0x2a'));_0xfddf85[_0xa54f('0x34')]=_['keys'](_0x33c033[_0xa54f('0x34')]);_0xfddf85[_0xa54f('0x35')]=_[_0xa54f('0x36')](_0xfddf85['model'],_0xfddf85[_0xa54f('0x34')]);_0x4eed92[_0xa54f('0x37')]=_[_0xa54f('0x36')](_0xfddf85[_0xa54f('0x33')],qs[_0xa54f('0x38')](_0x33c033[_0xa54f('0x34')][_0xa54f('0x38')]));_0x4eed92['attributes']=_0x4eed92['attributes'][_0xa54f('0x39')]?_0x4eed92[_0xa54f('0x37')]:_0xfddf85[_0xa54f('0x33')];if(!_0x33c033[_0xa54f('0x34')][_0xa54f('0x3a')](_0xa54f('0x3b'))){_0x4eed92[_0xa54f('0x22')]=qs[_0xa54f('0x22')](_0x33c033[_0xa54f('0x34')][_0xa54f('0x22')]);_0x4eed92[_0xa54f('0x1f')]=qs[_0xa54f('0x1f')](_0x33c033[_0xa54f('0x34')][_0xa54f('0x1f')]);}_0x4eed92[_0xa54f('0x3c')]=qs[_0xa54f('0x3d')](_0x33c033[_0xa54f('0x34')]['sort']);_0x4eed92[_0xa54f('0x3e')]=qs[_0xa54f('0x35')](_[_0xa54f('0x3f')](_0x33c033[_0xa54f('0x34')],_0xfddf85['filters']),_0x400dd2);if(_0x33c033['query'][_0xa54f('0x40')]){_0x4eed92[_0xa54f('0x3e')]=_['merge'](_0x4eed92[_0xa54f('0x3e')],{'$or':_[_0xa54f('0x2d')](_0x400dd2,function(_0xeba340){if(_0xeba340['type']!==_0xa54f('0x41')){var _0x182239={};_0x182239[_0xeba340['name']]={'$like':'%'+_0x33c033['query']['filter']+'%'};return _0x182239;}})});}_0x4eed92=_[_0xa54f('0x42')]({},_0x4eed92,_0x33c033[_0xa54f('0x43')]);var _0x2342cc={'where':_0x4eed92[_0xa54f('0x3e')]};return db[_0xa54f('0x2e')]['count'](_0x2342cc)[_0xa54f('0x27')](function(_0x513f7a){_0x130209['count']=_0x513f7a;if(_0x33c033[_0xa54f('0x34')][_0xa54f('0x44')]){_0x4eed92[_0xa54f('0x45')]=[{'all':!![]}];}return db['MailServerOut'][_0xa54f('0x46')](_0x4eed92);})[_0xa54f('0x27')](function(_0x25bd32){_0x130209[_0xa54f('0x47')]=_0x25bd32;return _0x130209;})[_0xa54f('0x27')](respondWithFilteredResult(_0x4960a8,_0x4eed92))[_0xa54f('0x48')](handleError(_0x4960a8,null));};exports[_0xa54f('0x49')]=function(_0x13737b,_0x4fe99f){var _0x5d0cca={'raw':!![],'where':{'id':_0x13737b['params']['id']}},_0x4cba37={};_0x4cba37[_0xa54f('0x33')]=_[_0xa54f('0x4a')](db[_0xa54f('0x2e')]['rawAttributes']);_0x4cba37['query']=_[_0xa54f('0x4a')](_0x13737b['query']);_0x4cba37[_0xa54f('0x35')]=_[_0xa54f('0x36')](_0x4cba37[_0xa54f('0x33')],_0x4cba37[_0xa54f('0x34')]);_0x5d0cca[_0xa54f('0x37')]=_[_0xa54f('0x36')](_0x4cba37['model'],qs[_0xa54f('0x38')](_0x13737b[_0xa54f('0x34')]['fields']));_0x5d0cca['attributes']=_0x5d0cca[_0xa54f('0x37')]['length']?_0x5d0cca['attributes']:_0x4cba37['model'];if(_0x13737b[_0xa54f('0x34')][_0xa54f('0x44')]){_0x5d0cca['include']=[{'all':!![]}];}_0x5d0cca=_[_0xa54f('0x42')]({},_0x5d0cca,_0x13737b[_0xa54f('0x43')]);return db[_0xa54f('0x2e')][_0xa54f('0x4b')](_0x5d0cca)['then'](handleEntityNotFound(_0x4fe99f,null))[_0xa54f('0x27')](respondWithResult(_0x4fe99f,null))[_0xa54f('0x48')](handleError(_0x4fe99f,null));};exports[_0xa54f('0x4c')]=function(_0xdef6be,_0x3086af){return db[_0xa54f('0x2e')][_0xa54f('0x4c')](_0xdef6be[_0xa54f('0x4d')],{})[_0xa54f('0x27')](respondWithResult(_0x3086af,0xc9))['catch'](handleError(_0x3086af,null));};exports['update']=function(_0x48b51a,_0x407bf3){if(_0x48b51a[_0xa54f('0x4d')]['id']){delete _0x48b51a[_0xa54f('0x4d')]['id'];}return db['MailServerOut'][_0xa54f('0x4b')]({'where':{'id':_0x48b51a['params']['id']}})[_0xa54f('0x27')](handleEntityNotFound(_0x407bf3,null))[_0xa54f('0x27')](saveUpdates(_0x48b51a['body'],null))[_0xa54f('0x27')](respondWithResult(_0x407bf3,null))[_0xa54f('0x48')](handleError(_0x407bf3,null));};exports[_0xa54f('0x28')]=function(_0x362a7d,_0x55fcc2){return db[_0xa54f('0x2e')][_0xa54f('0x4b')]({'where':{'id':_0x362a7d[_0xa54f('0x4e')]['id']}})[_0xa54f('0x27')](handleEntityNotFound(_0x55fcc2,null))[_0xa54f('0x27')](removeEntity(_0x55fcc2,null))[_0xa54f('0x48')](handleError(_0x55fcc2,null));}; \ No newline at end of file +var _0x4ef7=['mustache','util','to-csv','fs-extra','squel','crypto','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','sendStatus','status','undefined','offset','json','reject','save','update','destroy','then','end','stack','name','send','map','MailServerOut','fieldName','type','key','model','query','keys','intersection','attributes','fields','hasOwnProperty','nolimit','limit','order','where','filters','pick','filter','merge','VIRTUAL','options','count','includeAll','include','findAll','rows','catch','show','params','rawAttributes','length','find','create','body','eml-format','rimraf','zip-dir','fast-json-patch','moment','bluebird'];(function(_0x38efbb,_0x42176f){var _0x137548=function(_0x492eb7){while(--_0x492eb7){_0x38efbb['push'](_0x38efbb['shift']());}};_0x137548(++_0x42176f);}(_0x4ef7,0x167));var _0x74ef=function(_0x2a1ab5,_0x4275ae){_0x2a1ab5=_0x2a1ab5-0x0;var _0x4f16dc=_0x4ef7[_0x2a1ab5];return _0x4f16dc;};'use strict';var emlformat=require(_0x74ef('0x0'));var rimraf=require(_0x74ef('0x1'));var zipdir=require(_0x74ef('0x2'));var jsonpatch=require(_0x74ef('0x3'));var rp=require('request-promise');var moment=require(_0x74ef('0x4'));var BPromise=require(_0x74ef('0x5'));var Mustache=require(_0x74ef('0x6'));var util=require(_0x74ef('0x7'));var path=require('path');var sox=require('sox');var csv=require(_0x74ef('0x8'));var ejs=require('ejs');var fs=require('fs');var fs_extra=require(_0x74ef('0x9'));var _=require('lodash');var squel=require(_0x74ef('0xa'));var crypto=require(_0x74ef('0xb'));var jsforce=require('jsforce');var deskjs=require('desk.js');var toCsv=require(_0x74ef('0x8'));var querystring=require(_0x74ef('0xc'));var Papa=require(_0x74ef('0xd'));var Redis=require(_0x74ef('0xe'));var authService=require(_0x74ef('0xf'));var qs=require(_0x74ef('0x10'));var as=require('../../components/parsers/advancedSearch');var hardwareService=require(_0x74ef('0x11'));var logger=require(_0x74ef('0x12'))(_0x74ef('0x13'));var utils=require(_0x74ef('0x14'));var config=require(_0x74ef('0x15'));var licenseUtil=require(_0x74ef('0x16'));var db=require(_0x74ef('0x17'))['db'];function respondWithStatusCode(_0x144709,_0x187578){_0x187578=_0x187578||0xcc;return function(_0x5e63a0){if(_0x5e63a0){return _0x144709[_0x74ef('0x18')](_0x187578);}return _0x144709[_0x74ef('0x19')](_0x187578)['end']();};}function respondWithResult(_0x272ffd,_0x4dbf39){_0x4dbf39=_0x4dbf39||0xc8;return function(_0x8c9435){if(_0x8c9435){return _0x272ffd[_0x74ef('0x19')](_0x4dbf39)['json'](_0x8c9435);}};}function respondWithFilteredResult(_0x56304c,_0xd749b1){return function(_0x52aa4d){if(_0x52aa4d){var _0x2d7dad=typeof _0xd749b1['offset']===_0x74ef('0x1a')&&typeof _0xd749b1['limit']===_0x74ef('0x1a');var _0x28ee60=_0x52aa4d['count'];var _0x427fff=_0x2d7dad?0x0:_0xd749b1[_0x74ef('0x1b')];var _0x4f3248=_0x2d7dad?_0x52aa4d['count']:_0xd749b1[_0x74ef('0x1b')]+_0xd749b1['limit'];var _0x345bc5;if(_0x4f3248>=_0x28ee60){_0x4f3248=_0x28ee60;_0x345bc5=0xc8;}else{_0x345bc5=0xce;}_0x56304c['status'](_0x345bc5);return _0x56304c['set']('Content-Range',_0x427fff+'-'+_0x4f3248+'/'+_0x28ee60)[_0x74ef('0x1c')](_0x52aa4d);}return null;};}function patchUpdates(_0x1d03c1){return function(_0x5a5011){try{jsonpatch['apply'](_0x5a5011,_0x1d03c1,!![]);}catch(_0x5566d6){return BPromise[_0x74ef('0x1d')](_0x5566d6);}return _0x5a5011[_0x74ef('0x1e')]();};}function saveUpdates(_0x11b304,_0x2de050){return function(_0x116275){if(_0x116275){return _0x116275[_0x74ef('0x1f')](_0x11b304)['then'](function(_0x5cc241){return _0x5cc241;});}return null;};}function removeEntity(_0x664931,_0x1ece36){return function(_0x4451c3){if(_0x4451c3){return _0x4451c3[_0x74ef('0x20')]()[_0x74ef('0x21')](function(){_0x664931[_0x74ef('0x19')](0xcc)[_0x74ef('0x22')]();});}};}function handleEntityNotFound(_0x3e84c6,_0x361159){return function(_0xfbfcb4){if(!_0xfbfcb4){_0x3e84c6['sendStatus'](0x194);}return _0xfbfcb4;};}function handleError(_0x2fbdec,_0x466335){_0x466335=_0x466335||0x1f4;return function(_0xe5389c){logger['error'](_0xe5389c[_0x74ef('0x23')]);if(_0xe5389c[_0x74ef('0x24')]){delete _0xe5389c[_0x74ef('0x24')];}_0x2fbdec[_0x74ef('0x19')](_0x466335)[_0x74ef('0x25')](_0xe5389c);};}exports['index']=function(_0x42bfea,_0x33e1ad){var _0x1ecd63={},_0x902b63={},_0x4049fb={'count':0x0,'rows':[]};var _0x4ccfe7=_[_0x74ef('0x26')](db[_0x74ef('0x27')]['rawAttributes'],function(_0xdf6f4c){return{'name':_0xdf6f4c[_0x74ef('0x28')],'type':_0xdf6f4c[_0x74ef('0x29')][_0x74ef('0x2a')]};});_0x902b63[_0x74ef('0x2b')]=_[_0x74ef('0x26')](_0x4ccfe7,_0x74ef('0x24'));_0x902b63[_0x74ef('0x2c')]=_[_0x74ef('0x2d')](_0x42bfea['query']);_0x902b63['filters']=_[_0x74ef('0x2e')](_0x902b63[_0x74ef('0x2b')],_0x902b63[_0x74ef('0x2c')]);_0x1ecd63[_0x74ef('0x2f')]=_[_0x74ef('0x2e')](_0x902b63[_0x74ef('0x2b')],qs[_0x74ef('0x30')](_0x42bfea['query'][_0x74ef('0x30')]));_0x1ecd63[_0x74ef('0x2f')]=_0x1ecd63['attributes']['length']?_0x1ecd63['attributes']:_0x902b63[_0x74ef('0x2b')];if(!_0x42bfea['query'][_0x74ef('0x31')](_0x74ef('0x32'))){_0x1ecd63[_0x74ef('0x33')]=qs[_0x74ef('0x33')](_0x42bfea[_0x74ef('0x2c')]['limit']);_0x1ecd63[_0x74ef('0x1b')]=qs[_0x74ef('0x1b')](_0x42bfea['query'][_0x74ef('0x1b')]);}_0x1ecd63[_0x74ef('0x34')]=qs['sort'](_0x42bfea['query']['sort']);_0x1ecd63[_0x74ef('0x35')]=qs[_0x74ef('0x36')](_[_0x74ef('0x37')](_0x42bfea[_0x74ef('0x2c')],_0x902b63[_0x74ef('0x36')]),_0x4ccfe7);if(_0x42bfea[_0x74ef('0x2c')][_0x74ef('0x38')]){_0x1ecd63[_0x74ef('0x35')]=_[_0x74ef('0x39')](_0x1ecd63[_0x74ef('0x35')],{'$or':_[_0x74ef('0x26')](_0x4ccfe7,function(_0x996edb){if(_0x996edb[_0x74ef('0x29')]!==_0x74ef('0x3a')){var _0x19a468={};_0x19a468[_0x996edb[_0x74ef('0x24')]]={'$like':'%'+_0x42bfea['query'][_0x74ef('0x38')]+'%'};return _0x19a468;}})});}_0x1ecd63=_[_0x74ef('0x39')]({},_0x1ecd63,_0x42bfea[_0x74ef('0x3b')]);var _0x518c7c={'where':_0x1ecd63[_0x74ef('0x35')]};return db[_0x74ef('0x27')][_0x74ef('0x3c')](_0x518c7c)['then'](function(_0x16ec95){_0x4049fb[_0x74ef('0x3c')]=_0x16ec95;if(_0x42bfea[_0x74ef('0x2c')][_0x74ef('0x3d')]){_0x1ecd63[_0x74ef('0x3e')]=[{'all':!![]}];}return db[_0x74ef('0x27')][_0x74ef('0x3f')](_0x1ecd63);})[_0x74ef('0x21')](function(_0x1ec729){_0x4049fb[_0x74ef('0x40')]=_0x1ec729;return _0x4049fb;})[_0x74ef('0x21')](respondWithFilteredResult(_0x33e1ad,_0x1ecd63))[_0x74ef('0x41')](handleError(_0x33e1ad,null));};exports[_0x74ef('0x42')]=function(_0x2b4642,_0x35b3a8){var _0x1b9cc8={'raw':!![],'where':{'id':_0x2b4642[_0x74ef('0x43')]['id']}},_0x4bf858={};_0x4bf858[_0x74ef('0x2b')]=_[_0x74ef('0x2d')](db[_0x74ef('0x27')][_0x74ef('0x44')]);_0x4bf858['query']=_[_0x74ef('0x2d')](_0x2b4642['query']);_0x4bf858[_0x74ef('0x36')]=_[_0x74ef('0x2e')](_0x4bf858[_0x74ef('0x2b')],_0x4bf858[_0x74ef('0x2c')]);_0x1b9cc8['attributes']=_[_0x74ef('0x2e')](_0x4bf858[_0x74ef('0x2b')],qs[_0x74ef('0x30')](_0x2b4642['query']['fields']));_0x1b9cc8[_0x74ef('0x2f')]=_0x1b9cc8[_0x74ef('0x2f')][_0x74ef('0x45')]?_0x1b9cc8[_0x74ef('0x2f')]:_0x4bf858['model'];if(_0x2b4642[_0x74ef('0x2c')][_0x74ef('0x3d')]){_0x1b9cc8[_0x74ef('0x3e')]=[{'all':!![]}];}_0x1b9cc8=_[_0x74ef('0x39')]({},_0x1b9cc8,_0x2b4642[_0x74ef('0x3b')]);return db[_0x74ef('0x27')][_0x74ef('0x46')](_0x1b9cc8)['then'](handleEntityNotFound(_0x35b3a8,null))[_0x74ef('0x21')](respondWithResult(_0x35b3a8,null))[_0x74ef('0x41')](handleError(_0x35b3a8,null));};exports[_0x74ef('0x47')]=function(_0x2d12ea,_0x231b99){return db[_0x74ef('0x27')][_0x74ef('0x47')](_0x2d12ea[_0x74ef('0x48')],{})['then'](respondWithResult(_0x231b99,0xc9))[_0x74ef('0x41')](handleError(_0x231b99,null));};exports[_0x74ef('0x1f')]=function(_0x5dec62,_0x5ab91b){if(_0x5dec62['body']['id']){delete _0x5dec62[_0x74ef('0x48')]['id'];}return db[_0x74ef('0x27')]['find']({'where':{'id':_0x5dec62[_0x74ef('0x43')]['id']}})[_0x74ef('0x21')](handleEntityNotFound(_0x5ab91b,null))[_0x74ef('0x21')](saveUpdates(_0x5dec62[_0x74ef('0x48')],null))['then'](respondWithResult(_0x5ab91b,null))[_0x74ef('0x41')](handleError(_0x5ab91b,null));};exports[_0x74ef('0x20')]=function(_0x163ee3,_0x2385e8){return db[_0x74ef('0x27')][_0x74ef('0x46')]({'where':{'id':_0x163ee3[_0x74ef('0x43')]['id']}})[_0x74ef('0x21')](handleEntityNotFound(_0x2385e8,null))['then'](removeEntity(_0x2385e8,null))[_0x74ef('0x41')](handleError(_0x2385e8,null));}; \ No newline at end of file diff --git a/server/api/mailServerOut/mailServerOut.model.js b/server/api/mailServerOut/mailServerOut.model.js index b2a60c2..bcbd4b3 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 _0x9690=['mail_servers_out','util','../../config/logger','path','../../config/environment','exports','MailServerOut'];(function(_0x59e8a8,_0x2ca0ad){var _0x4d1b9e=function(_0x213b7d){while(--_0x213b7d){_0x59e8a8['push'](_0x59e8a8['shift']());}};_0x4d1b9e(++_0x2ca0ad);}(_0x9690,0x71));var _0x0969=function(_0x3e7c6a,_0x25004e){_0x3e7c6a=_0x3e7c6a-0x0;var _0x3cc7df=_0x9690[_0x3e7c6a];return _0x3cc7df;};'use strict';var _=require('lodash');var util=require(_0x0969('0x0'));var logger=require(_0x0969('0x1'))('api');var moment=require('moment');var BPromise=require('bluebird');var rp=require('request-promise');var fs=require('fs');var path=require(_0x0969('0x2'));var rimraf=require('rimraf');var config=require(_0x0969('0x3'));var attributes=require('./mailServerOut.attributes');module[_0x0969('0x4')]=function(_0x20de3a,_0x13e9f8){return _0x20de3a['define'](_0x0969('0x5'),attributes,{'tableName':_0x0969('0x6'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x0976=['moment','bluebird','request-promise','path','rimraf','../../config/environment','./mailServerOut.attributes','mail_servers_out','util'];(function(_0x4c49cd,_0x1b630d){var _0x29ba71=function(_0x3df9cf){while(--_0x3df9cf){_0x4c49cd['push'](_0x4c49cd['shift']());}};_0x29ba71(++_0x1b630d);}(_0x0976,0x1b8));var _0x6097=function(_0x248a5e,_0x32304a){_0x248a5e=_0x248a5e-0x0;var _0x31ddf7=_0x0976[_0x248a5e];return _0x31ddf7;};'use strict';var _=require('lodash');var util=require(_0x6097('0x0'));var logger=require('../../config/logger')('api');var moment=require(_0x6097('0x1'));var BPromise=require(_0x6097('0x2'));var rp=require(_0x6097('0x3'));var fs=require('fs');var path=require(_0x6097('0x4'));var rimraf=require(_0x6097('0x5'));var config=require(_0x6097('0x6'));var attributes=require(_0x6097('0x7'));module['exports']=function(_0x42a592,_0x5110e0){return _0x42a592['define']('MailServerOut',attributes,{'tableName':_0x6097('0x8'),'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 339decb..b0f517d 100644 --- a/server/api/mailServerOut/mailServerOut.rpc.js +++ b/server/api/mailServerOut/mailServerOut.rpc.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x5f66=['../../mysqldb','../../config/utils','rpc','jayson/promise','client','request','then','MailServerOut,\x20%s,\x20%s','request\x20sent','debug','MailServerOut,\x20%s,\x20%s,\x20%s','stringify','code','message','error','info','catch','util','bluebird','randomstring','ioredis'];(function(_0x44dd16,_0xb6b917){var _0x508053=function(_0xa1f871){while(--_0xa1f871){_0x44dd16['push'](_0x44dd16['shift']());}};_0x508053(++_0xb6b917);}(_0x5f66,0x1a0));var _0x65f6=function(_0x465028,_0x4570ac){_0x465028=_0x465028-0x0;var _0xb783d4=_0x5f66[_0x465028];return _0xb783d4;};'use strict';var _=require('lodash');var util=require(_0x65f6('0x0'));var moment=require('moment');var BPromise=require(_0x65f6('0x1'));var rs=require(_0x65f6('0x2'));var fs=require('fs');var Redis=require(_0x65f6('0x3'));var db=require(_0x65f6('0x4'))['db'];var utils=require(_0x65f6('0x5'));var logger=require('../../config/logger')(_0x65f6('0x6'));var config=require('../../config/environment');var jayson=require(_0x65f6('0x7'));var client=jayson[_0x65f6('0x8')]['http']({'port':0x232a});function respondWithRpcPromise(_0x4ed98f,_0x1c0e12,_0x2c6571){return new BPromise(function(_0x112079,_0x8f6451){return client[_0x65f6('0x9')](_0x4ed98f,_0x2c6571)[_0x65f6('0xa')](function(_0x48d85c){logger['info'](_0x65f6('0xb'),_0x1c0e12,_0x65f6('0xc'));logger[_0x65f6('0xd')](_0x65f6('0xe'),_0x1c0e12,'request\x20sent',JSON[_0x65f6('0xf')](_0x48d85c));if(_0x48d85c['error']){if(_0x48d85c['error'][_0x65f6('0x10')]===0x1f4){logger['error'](_0x65f6('0xb'),_0x1c0e12,_0x48d85c['error'][_0x65f6('0x11')]);return _0x8f6451(_0x48d85c[_0x65f6('0x12')][_0x65f6('0x11')]);}logger[_0x65f6('0x12')](_0x65f6('0xb'),_0x1c0e12,_0x48d85c[_0x65f6('0x12')][_0x65f6('0x11')]);return _0x112079(_0x48d85c[_0x65f6('0x12')][_0x65f6('0x11')]);}else{logger[_0x65f6('0x13')]('MailServerOut,\x20%s,\x20%s',_0x1c0e12,_0x65f6('0xc'));_0x112079(_0x48d85c['result']['message']);}})[_0x65f6('0x14')](function(_0x5c69f8){logger[_0x65f6('0x12')](_0x65f6('0xb'),_0x1c0e12,_0x5c69f8);_0x8f6451(_0x5c69f8);});});} \ No newline at end of file +var _0x5f66=['../../mysqldb','../../config/utils','rpc','jayson/promise','client','request','then','MailServerOut,\x20%s,\x20%s','request\x20sent','debug','MailServerOut,\x20%s,\x20%s,\x20%s','stringify','code','message','error','info','catch','util','bluebird','randomstring','ioredis'];(function(_0x1d89d9,_0x282b85){var _0x2b2610=function(_0xdacee5){while(--_0xdacee5){_0x1d89d9['push'](_0x1d89d9['shift']());}};_0x2b2610(++_0x282b85);}(_0x5f66,0x1a0));var _0x65f6=function(_0x173441,_0x26b0d9){_0x173441=_0x173441-0x0;var _0x2423a8=_0x5f66[_0x173441];return _0x2423a8;};'use strict';var _=require('lodash');var util=require(_0x65f6('0x0'));var moment=require('moment');var BPromise=require(_0x65f6('0x1'));var rs=require(_0x65f6('0x2'));var fs=require('fs');var Redis=require(_0x65f6('0x3'));var db=require(_0x65f6('0x4'))['db'];var utils=require(_0x65f6('0x5'));var logger=require('../../config/logger')(_0x65f6('0x6'));var config=require('../../config/environment');var jayson=require(_0x65f6('0x7'));var client=jayson[_0x65f6('0x8')]['http']({'port':0x232a});function respondWithRpcPromise(_0x4ed98f,_0x1c0e12,_0x2c6571){return new BPromise(function(_0x112079,_0x8f6451){return client[_0x65f6('0x9')](_0x4ed98f,_0x2c6571)[_0x65f6('0xa')](function(_0x48d85c){logger['info'](_0x65f6('0xb'),_0x1c0e12,_0x65f6('0xc'));logger[_0x65f6('0xd')](_0x65f6('0xe'),_0x1c0e12,'request\x20sent',JSON[_0x65f6('0xf')](_0x48d85c));if(_0x48d85c['error']){if(_0x48d85c['error'][_0x65f6('0x10')]===0x1f4){logger['error'](_0x65f6('0xb'),_0x1c0e12,_0x48d85c['error'][_0x65f6('0x11')]);return _0x8f6451(_0x48d85c[_0x65f6('0x12')][_0x65f6('0x11')]);}logger[_0x65f6('0x12')](_0x65f6('0xb'),_0x1c0e12,_0x48d85c[_0x65f6('0x12')][_0x65f6('0x11')]);return _0x112079(_0x48d85c[_0x65f6('0x12')][_0x65f6('0x11')]);}else{logger[_0x65f6('0x13')]('MailServerOut,\x20%s,\x20%s',_0x1c0e12,_0x65f6('0xc'));_0x112079(_0x48d85c['result']['message']);}})[_0x65f6('0x14')](function(_0x5c69f8){logger[_0x65f6('0x12')](_0x65f6('0xb'),_0x1c0e12,_0x5c69f8);_0x8f6451(_0x5c69f8);});});} \ No newline at end of file diff --git a/server/api/mailSubstatus/index.js b/server/api/mailSubstatus/index.js index d6136bd..4c5cc80 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 _0x7d4e=['/describe','get','/:id','show','create','update','delete','destroy','exports','util','path','connect-timeout','express','Router','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','./mailSubstatus.controller','isAuthenticated','index'];(function(_0x28458f,_0x398ed9){var _0x31114f=function(_0x4d2f52){while(--_0x4d2f52){_0x28458f['push'](_0x28458f['shift']());}};_0x31114f(++_0x398ed9);}(_0x7d4e,0x72));var _0xe7d4=function(_0x4d3afc,_0x1661e6){_0x4d3afc=_0x4d3afc-0x0;var _0x1fa6db=_0x7d4e[_0x4d3afc];return _0x1fa6db;};'use strict';var multer=require('multer');var util=require(_0xe7d4('0x0'));var path=require(_0xe7d4('0x1'));var timeout=require(_0xe7d4('0x2'));var express=require(_0xe7d4('0x3'));var router=express[_0xe7d4('0x4')]();var fs_extra=require(_0xe7d4('0x5'));var auth=require(_0xe7d4('0x6'));var interaction=require(_0xe7d4('0x7'));var config=require(_0xe7d4('0x8'));var controller=require(_0xe7d4('0x9'));router['get']('/',auth[_0xe7d4('0xa')](),controller[_0xe7d4('0xb')]);router['get'](_0xe7d4('0xc'),auth[_0xe7d4('0xa')](),controller['describe']);router[_0xe7d4('0xd')](_0xe7d4('0xe'),auth['isAuthenticated'](),controller[_0xe7d4('0xf')]);router['post']('/',auth[_0xe7d4('0xa')](),controller[_0xe7d4('0x10')]);router['put'](_0xe7d4('0xe'),auth[_0xe7d4('0xa')](),controller[_0xe7d4('0x11')]);router[_0xe7d4('0x12')](_0xe7d4('0xe'),auth['isAuthenticated'](),controller[_0xe7d4('0x13')]);module[_0xe7d4('0x14')]=router; \ No newline at end of file +var _0x791a=['fs-extra','../../components/auth/service','../../config/environment','get','isAuthenticated','index','/describe','show','post','create','/:id','update','delete','exports','util','path','express'];(function(_0x11201e,_0x388bc6){var _0xbb7c7f=function(_0x1ad40b){while(--_0x1ad40b){_0x11201e['push'](_0x11201e['shift']());}};_0xbb7c7f(++_0x388bc6);}(_0x791a,0x151));var _0xa791=function(_0x5b95da,_0x1ff804){_0x5b95da=_0x5b95da-0x0;var _0x1f01c5=_0x791a[_0x5b95da];return _0x1f01c5;};'use strict';var multer=require('multer');var util=require(_0xa791('0x0'));var path=require(_0xa791('0x1'));var timeout=require('connect-timeout');var express=require(_0xa791('0x2'));var router=express['Router']();var fs_extra=require(_0xa791('0x3'));var auth=require(_0xa791('0x4'));var interaction=require('../../components/interaction/service');var config=require(_0xa791('0x5'));var controller=require('./mailSubstatus.controller');router[_0xa791('0x6')]('/',auth[_0xa791('0x7')](),controller[_0xa791('0x8')]);router[_0xa791('0x6')](_0xa791('0x9'),auth[_0xa791('0x7')](),controller['describe']);router[_0xa791('0x6')]('/:id',auth[_0xa791('0x7')](),controller[_0xa791('0xa')]);router[_0xa791('0xb')]('/',auth[_0xa791('0x7')](),controller[_0xa791('0xc')]);router['put'](_0xa791('0xd'),auth['isAuthenticated'](),controller[_0xa791('0xe')]);router[_0xa791('0xf')](_0xa791('0xd'),auth[_0xa791('0x7')](),controller['destroy']);module[_0xa791('0x10')]=router; \ No newline at end of file diff --git a/server/api/mailSubstatus/mailSubstatus.attributes.js b/server/api/mailSubstatus/mailSubstatus.attributes.js index c1b4ac6..a712c92 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 _0xe3da=['name','sequelize','exports','STRING'];(function(_0x4f8118,_0xaf5acf){var _0x1d5964=function(_0x34352a){while(--_0x34352a){_0x4f8118['push'](_0x4f8118['shift']());}};_0x1d5964(++_0xaf5acf);}(_0xe3da,0x1cd));var _0xae3d=function(_0x57b54c,_0x54ce0d){_0x57b54c=_0x57b54c-0x0;var _0x59cc19=_0xe3da[_0x57b54c];return _0x59cc19;};'use strict';var Sequelize=require(_0xae3d('0x0'));module[_0xae3d('0x1')]={'name':{'type':Sequelize[_0xae3d('0x2')],'unique':_0xae3d('0x3'),'allowNull':![],'validate':{'notEmpty':!![]}},'description':{'type':Sequelize[_0xae3d('0x2')]}}; \ No newline at end of file +var _0xfb65=['exports','STRING'];(function(_0x5bd426,_0x4878e5){var _0x23a7eb=function(_0x594b42){while(--_0x594b42){_0x5bd426['push'](_0x5bd426['shift']());}};_0x23a7eb(++_0x4878e5);}(_0xfb65,0x82));var _0x5fb6=function(_0x130ef8,_0x4c2eb1){_0x130ef8=_0x130ef8-0x0;var _0x223a38=_0xfb65[_0x130ef8];return _0x223a38;};'use strict';var Sequelize=require('sequelize');module[_0x5fb6('0x0')]={'name':{'type':Sequelize[_0x5fb6('0x1')],'unique':'name','allowNull':![],'validate':{'notEmpty':!![]}},'description':{'type':Sequelize[_0x5fb6('0x1')]}}; \ No newline at end of file diff --git a/server/api/mailSubstatus/mailSubstatus.controller.js b/server/api/mailSubstatus/mailSubstatus.controller.js index 2a8728e..2d4df6f 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 _0xaaf9=['undefined','limit','count','Content-Range','reject','save','update','then','destroy','sendStatus','stack','name','send','map','MailSubstatus','rawAttributes','fieldName','type','key','query','intersection','model','attributes','fields','length','order','sort','where','filters','pick','merge','VIRTUAL','options','includeAll','include','rows','keys','find','catch','create','body','params','describe','eml-format','rimraf','zip-dir','fast-json-patch','sox','ejs','fs-extra','lodash','squel','desk.js','to-csv','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','../../config/environment','../../mysqldb','end','status','json','offset'];(function(_0xe0c5f4,_0x178377){var _0x33d591=function(_0x59b005){while(--_0x59b005){_0xe0c5f4['push'](_0xe0c5f4['shift']());}};_0x33d591(++_0x178377);}(_0xaaf9,0x17f));var _0x9aaf=function(_0x5e06a4,_0x537b8a){_0x5e06a4=_0x5e06a4-0x0;var _0x415c77=_0xaaf9[_0x5e06a4];return _0x415c77;};'use strict';var emlformat=require(_0x9aaf('0x0'));var rimraf=require(_0x9aaf('0x1'));var zipdir=require(_0x9aaf('0x2'));var jsonpatch=require(_0x9aaf('0x3'));var rp=require('request-promise');var moment=require('moment');var BPromise=require('bluebird');var Mustache=require('mustache');var util=require('util');var path=require('path');var sox=require(_0x9aaf('0x4'));var csv=require('to-csv');var ejs=require(_0x9aaf('0x5'));var fs=require('fs');var fs_extra=require(_0x9aaf('0x6'));var _=require(_0x9aaf('0x7'));var squel=require(_0x9aaf('0x8'));var crypto=require('crypto');var jsforce=require('jsforce');var deskjs=require(_0x9aaf('0x9'));var toCsv=require(_0x9aaf('0xa'));var querystring=require(_0x9aaf('0xb'));var Papa=require(_0x9aaf('0xc'));var Redis=require(_0x9aaf('0xd'));var authService=require(_0x9aaf('0xe'));var qs=require(_0x9aaf('0xf'));var as=require(_0x9aaf('0x10'));var hardwareService=require(_0x9aaf('0x11'));var logger=require(_0x9aaf('0x12'))('api');var utils=require('../../config/utils');var config=require(_0x9aaf('0x13'));var licenseUtil=require('../../config/license/util');var db=require(_0x9aaf('0x14'))['db'];function respondWithStatusCode(_0x54d615,_0x315ee5){_0x315ee5=_0x315ee5||0xcc;return function(_0x5dc355){if(_0x5dc355){return _0x54d615['sendStatus'](_0x315ee5);}return _0x54d615['status'](_0x315ee5)[_0x9aaf('0x15')]();};}function respondWithResult(_0x37679e,_0x30527a){_0x30527a=_0x30527a||0xc8;return function(_0x2fc184){if(_0x2fc184){return _0x37679e[_0x9aaf('0x16')](_0x30527a)[_0x9aaf('0x17')](_0x2fc184);}};}function respondWithFilteredResult(_0x52b831,_0x27d7c3){return function(_0x1f97cd){if(_0x1f97cd){var _0x4b2ebd=typeof _0x27d7c3[_0x9aaf('0x18')]===_0x9aaf('0x19')&&typeof _0x27d7c3[_0x9aaf('0x1a')]===_0x9aaf('0x19');var _0x54a3fd=_0x1f97cd['count'];var _0x57fd4f=_0x4b2ebd?0x0:_0x27d7c3[_0x9aaf('0x18')];var _0x47d1dc=_0x4b2ebd?_0x1f97cd[_0x9aaf('0x1b')]:_0x27d7c3[_0x9aaf('0x18')]+_0x27d7c3['limit'];var _0x2c8620;if(_0x47d1dc>=_0x54a3fd){_0x47d1dc=_0x54a3fd;_0x2c8620=0xc8;}else{_0x2c8620=0xce;}_0x52b831[_0x9aaf('0x16')](_0x2c8620);return _0x52b831['set'](_0x9aaf('0x1c'),_0x57fd4f+'-'+_0x47d1dc+'/'+_0x54a3fd)[_0x9aaf('0x17')](_0x1f97cd);}return null;};}function patchUpdates(_0x3591f8){return function(_0x43169a){try{jsonpatch['apply'](_0x43169a,_0x3591f8,!![]);}catch(_0x2fc5bc){return BPromise[_0x9aaf('0x1d')](_0x2fc5bc);}return _0x43169a[_0x9aaf('0x1e')]();};}function saveUpdates(_0xb19433,_0x37f247){return function(_0x6236c3){if(_0x6236c3){return _0x6236c3[_0x9aaf('0x1f')](_0xb19433)[_0x9aaf('0x20')](function(_0x55b28f){return _0x55b28f;});}return null;};}function removeEntity(_0x3e577f,_0xe80be3){return function(_0x4b5ba0){if(_0x4b5ba0){return _0x4b5ba0[_0x9aaf('0x21')]()[_0x9aaf('0x20')](function(){_0x3e577f[_0x9aaf('0x16')](0xcc)[_0x9aaf('0x15')]();});}};}function handleEntityNotFound(_0x44fbf9,_0x12a477){return function(_0x54b694){if(!_0x54b694){_0x44fbf9[_0x9aaf('0x22')](0x194);}return _0x54b694;};}function handleError(_0xd93633,_0x68a045){_0x68a045=_0x68a045||0x1f4;return function(_0x291c48){logger['error'](_0x291c48[_0x9aaf('0x23')]);if(_0x291c48['name']){delete _0x291c48[_0x9aaf('0x24')];}_0xd93633['status'](_0x68a045)[_0x9aaf('0x25')](_0x291c48);};}exports['index']=function(_0x171a54,_0x19f6cb){var _0x21ec3f={},_0x5c08b0={},_0x4a3d2b={'count':0x0,'rows':[]};var _0x4d9517=_[_0x9aaf('0x26')](db[_0x9aaf('0x27')][_0x9aaf('0x28')],function(_0x2d5f3e){return{'name':_0x2d5f3e[_0x9aaf('0x29')],'type':_0x2d5f3e[_0x9aaf('0x2a')][_0x9aaf('0x2b')]};});_0x5c08b0['model']=_[_0x9aaf('0x26')](_0x4d9517,_0x9aaf('0x24'));_0x5c08b0[_0x9aaf('0x2c')]=_['keys'](_0x171a54[_0x9aaf('0x2c')]);_0x5c08b0['filters']=_[_0x9aaf('0x2d')](_0x5c08b0[_0x9aaf('0x2e')],_0x5c08b0[_0x9aaf('0x2c')]);_0x21ec3f[_0x9aaf('0x2f')]=_[_0x9aaf('0x2d')](_0x5c08b0[_0x9aaf('0x2e')],qs['fields'](_0x171a54[_0x9aaf('0x2c')][_0x9aaf('0x30')]));_0x21ec3f[_0x9aaf('0x2f')]=_0x21ec3f[_0x9aaf('0x2f')][_0x9aaf('0x31')]?_0x21ec3f[_0x9aaf('0x2f')]:_0x5c08b0[_0x9aaf('0x2e')];if(!_0x171a54[_0x9aaf('0x2c')]['hasOwnProperty']('nolimit')){_0x21ec3f['limit']=qs[_0x9aaf('0x1a')](_0x171a54[_0x9aaf('0x2c')]['limit']);_0x21ec3f[_0x9aaf('0x18')]=qs['offset'](_0x171a54[_0x9aaf('0x2c')][_0x9aaf('0x18')]);}_0x21ec3f[_0x9aaf('0x32')]=qs[_0x9aaf('0x33')](_0x171a54[_0x9aaf('0x2c')]['sort']);_0x21ec3f[_0x9aaf('0x34')]=qs[_0x9aaf('0x35')](_[_0x9aaf('0x36')](_0x171a54[_0x9aaf('0x2c')],_0x5c08b0[_0x9aaf('0x35')]),_0x4d9517);if(_0x171a54[_0x9aaf('0x2c')]['filter']){_0x21ec3f[_0x9aaf('0x34')]=_[_0x9aaf('0x37')](_0x21ec3f[_0x9aaf('0x34')],{'$or':_[_0x9aaf('0x26')](_0x4d9517,function(_0x16bc7c){if(_0x16bc7c['type']!==_0x9aaf('0x38')){var _0x35eb1a={};_0x35eb1a[_0x16bc7c['name']]={'$like':'%'+_0x171a54[_0x9aaf('0x2c')]['filter']+'%'};return _0x35eb1a;}})});}_0x21ec3f=_[_0x9aaf('0x37')]({},_0x21ec3f,_0x171a54[_0x9aaf('0x39')]);var _0xd2628={'where':_0x21ec3f[_0x9aaf('0x34')]};return db[_0x9aaf('0x27')][_0x9aaf('0x1b')](_0xd2628)[_0x9aaf('0x20')](function(_0x961b46){_0x4a3d2b['count']=_0x961b46;if(_0x171a54['query'][_0x9aaf('0x3a')]){_0x21ec3f[_0x9aaf('0x3b')]=[{'all':!![]}];}return db['MailSubstatus']['findAll'](_0x21ec3f);})[_0x9aaf('0x20')](function(_0x28c234){_0x4a3d2b[_0x9aaf('0x3c')]=_0x28c234;return _0x4a3d2b;})['then'](respondWithFilteredResult(_0x19f6cb,_0x21ec3f))['catch'](handleError(_0x19f6cb,null));};exports['show']=function(_0x2b21c7,_0x4db7b4){var _0x968c44={'raw':!![],'where':{'id':_0x2b21c7['params']['id']}},_0x110dd7={};_0x110dd7['model']=_[_0x9aaf('0x3d')](db[_0x9aaf('0x27')]['rawAttributes']);_0x110dd7[_0x9aaf('0x2c')]=_[_0x9aaf('0x3d')](_0x2b21c7['query']);_0x110dd7[_0x9aaf('0x35')]=_[_0x9aaf('0x2d')](_0x110dd7[_0x9aaf('0x2e')],_0x110dd7[_0x9aaf('0x2c')]);_0x968c44['attributes']=_[_0x9aaf('0x2d')](_0x110dd7[_0x9aaf('0x2e')],qs[_0x9aaf('0x30')](_0x2b21c7[_0x9aaf('0x2c')][_0x9aaf('0x30')]));_0x968c44['attributes']=_0x968c44[_0x9aaf('0x2f')][_0x9aaf('0x31')]?_0x968c44[_0x9aaf('0x2f')]:_0x110dd7[_0x9aaf('0x2e')];if(_0x2b21c7[_0x9aaf('0x2c')]['includeAll']){_0x968c44[_0x9aaf('0x3b')]=[{'all':!![]}];}_0x968c44=_['merge']({},_0x968c44,_0x2b21c7[_0x9aaf('0x39')]);return db[_0x9aaf('0x27')][_0x9aaf('0x3e')](_0x968c44)[_0x9aaf('0x20')](handleEntityNotFound(_0x4db7b4,null))[_0x9aaf('0x20')](respondWithResult(_0x4db7b4,null))[_0x9aaf('0x3f')](handleError(_0x4db7b4,null));};exports[_0x9aaf('0x40')]=function(_0xf2d1c,_0x466567){return db[_0x9aaf('0x27')]['create'](_0xf2d1c[_0x9aaf('0x41')],{})[_0x9aaf('0x20')](respondWithResult(_0x466567,0xc9))['catch'](handleError(_0x466567,null));};exports['update']=function(_0x3a29b0,_0x2e3bba){if(_0x3a29b0['body']['id']){delete _0x3a29b0[_0x9aaf('0x41')]['id'];}return db['MailSubstatus']['find']({'where':{'id':_0x3a29b0['params']['id']}})[_0x9aaf('0x20')](handleEntityNotFound(_0x2e3bba,null))[_0x9aaf('0x20')](saveUpdates(_0x3a29b0[_0x9aaf('0x41')],null))['then'](respondWithResult(_0x2e3bba,null))['catch'](handleError(_0x2e3bba,null));};exports[_0x9aaf('0x21')]=function(_0x466216,_0x1b6c7b){return db['MailSubstatus'][_0x9aaf('0x3e')]({'where':{'id':_0x466216[_0x9aaf('0x42')]['id']}})[_0x9aaf('0x20')](handleEntityNotFound(_0x1b6c7b,null))[_0x9aaf('0x20')](removeEntity(_0x1b6c7b,null))[_0x9aaf('0x3f')](handleError(_0x1b6c7b,null));};exports[_0x9aaf('0x43')]=function(_0x94b427,_0x1218bb){return db[_0x9aaf('0x27')][_0x9aaf('0x43')]()[_0x9aaf('0x20')](respondWithResult(_0x1218bb,null))[_0x9aaf('0x3f')](handleError(_0x1218bb,null));}; \ No newline at end of file +var _0x8610=['MailSubstatus','includeAll','include','findAll','rows','show','params','find','catch','create','body','describe','eml-format','zip-dir','request-promise','moment','bluebird','util','sox','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','status','offset','count','limit','set','Content-Range','json','apply','reject','save','update','then','destroy','error','stack','name','send','index','map','rawAttributes','fieldName','type','key','model','query','keys','filters','intersection','fields','attributes','length','order','sort','pick','filter','where','merge','options'];(function(_0x14add3,_0x13ce8d){var _0x4a174f=function(_0x2b3ed7){while(--_0x2b3ed7){_0x14add3['push'](_0x14add3['shift']());}};_0x4a174f(++_0x13ce8d);}(_0x8610,0x1ce));var _0x0861=function(_0x3efddb,_0x306de9){_0x3efddb=_0x3efddb-0x0;var _0x26fcac=_0x8610[_0x3efddb];return _0x26fcac;};'use strict';var emlformat=require(_0x0861('0x0'));var rimraf=require('rimraf');var zipdir=require(_0x0861('0x1'));var jsonpatch=require('fast-json-patch');var rp=require(_0x0861('0x2'));var moment=require(_0x0861('0x3'));var BPromise=require(_0x0861('0x4'));var Mustache=require('mustache');var util=require(_0x0861('0x5'));var path=require('path');var sox=require(_0x0861('0x6'));var csv=require(_0x0861('0x7'));var ejs=require(_0x0861('0x8'));var fs=require('fs');var fs_extra=require(_0x0861('0x9'));var _=require(_0x0861('0xa'));var squel=require(_0x0861('0xb'));var crypto=require(_0x0861('0xc'));var jsforce=require(_0x0861('0xd'));var deskjs=require(_0x0861('0xe'));var toCsv=require('to-csv');var querystring=require(_0x0861('0xf'));var Papa=require(_0x0861('0x10'));var Redis=require(_0x0861('0x11'));var authService=require(_0x0861('0x12'));var qs=require(_0x0861('0x13'));var as=require('../../components/parsers/advancedSearch');var hardwareService=require('../../config/license/hardware');var logger=require(_0x0861('0x14'))('api');var utils=require(_0x0861('0x15'));var config=require('../../config/environment');var licenseUtil=require(_0x0861('0x16'));var db=require(_0x0861('0x17'))['db'];function respondWithStatusCode(_0x37c39d,_0x3a5ac9){_0x3a5ac9=_0x3a5ac9||0xcc;return function(_0xffb453){if(_0xffb453){return _0x37c39d[_0x0861('0x18')](_0x3a5ac9);}return _0x37c39d[_0x0861('0x19')](_0x3a5ac9)['end']();};}function respondWithResult(_0x3ee403,_0x17fba5){_0x17fba5=_0x17fba5||0xc8;return function(_0x158ce6){if(_0x158ce6){return _0x3ee403[_0x0861('0x19')](_0x17fba5)['json'](_0x158ce6);}};}function respondWithFilteredResult(_0xc07841,_0x3c45d6){return function(_0x152f02){if(_0x152f02){var _0x4f3601=typeof _0x3c45d6[_0x0861('0x1a')]==='undefined'&&typeof _0x3c45d6['limit']==='undefined';var _0x425060=_0x152f02[_0x0861('0x1b')];var _0x612192=_0x4f3601?0x0:_0x3c45d6[_0x0861('0x1a')];var _0x269cf8=_0x4f3601?_0x152f02['count']:_0x3c45d6['offset']+_0x3c45d6[_0x0861('0x1c')];var _0x486801;if(_0x269cf8>=_0x425060){_0x269cf8=_0x425060;_0x486801=0xc8;}else{_0x486801=0xce;}_0xc07841['status'](_0x486801);return _0xc07841[_0x0861('0x1d')](_0x0861('0x1e'),_0x612192+'-'+_0x269cf8+'/'+_0x425060)[_0x0861('0x1f')](_0x152f02);}return null;};}function patchUpdates(_0x3a6599){return function(_0x13d871){try{jsonpatch[_0x0861('0x20')](_0x13d871,_0x3a6599,!![]);}catch(_0xd7b74b){return BPromise[_0x0861('0x21')](_0xd7b74b);}return _0x13d871[_0x0861('0x22')]();};}function saveUpdates(_0x5df35b,_0x1bcad2){return function(_0x3f0e06){if(_0x3f0e06){return _0x3f0e06[_0x0861('0x23')](_0x5df35b)[_0x0861('0x24')](function(_0x2169c8){return _0x2169c8;});}return null;};}function removeEntity(_0x2cf7b0,_0xb10f72){return function(_0x15b2ba){if(_0x15b2ba){return _0x15b2ba[_0x0861('0x25')]()[_0x0861('0x24')](function(){_0x2cf7b0[_0x0861('0x19')](0xcc)['end']();});}};}function handleEntityNotFound(_0x8ad41b,_0x37b784){return function(_0x560e31){if(!_0x560e31){_0x8ad41b[_0x0861('0x18')](0x194);}return _0x560e31;};}function handleError(_0x21f8e0,_0x790d90){_0x790d90=_0x790d90||0x1f4;return function(_0x341726){logger[_0x0861('0x26')](_0x341726[_0x0861('0x27')]);if(_0x341726['name']){delete _0x341726[_0x0861('0x28')];}_0x21f8e0[_0x0861('0x19')](_0x790d90)[_0x0861('0x29')](_0x341726);};}exports[_0x0861('0x2a')]=function(_0x15f239,_0x4255b5){var _0x117c28={},_0x5ba6eb={},_0x4a9781={'count':0x0,'rows':[]};var _0x3199af=_[_0x0861('0x2b')](db['MailSubstatus'][_0x0861('0x2c')],function(_0xcd807){return{'name':_0xcd807[_0x0861('0x2d')],'type':_0xcd807[_0x0861('0x2e')][_0x0861('0x2f')]};});_0x5ba6eb[_0x0861('0x30')]=_[_0x0861('0x2b')](_0x3199af,_0x0861('0x28'));_0x5ba6eb[_0x0861('0x31')]=_[_0x0861('0x32')](_0x15f239[_0x0861('0x31')]);_0x5ba6eb[_0x0861('0x33')]=_[_0x0861('0x34')](_0x5ba6eb[_0x0861('0x30')],_0x5ba6eb['query']);_0x117c28['attributes']=_[_0x0861('0x34')](_0x5ba6eb['model'],qs[_0x0861('0x35')](_0x15f239[_0x0861('0x31')]['fields']));_0x117c28[_0x0861('0x36')]=_0x117c28[_0x0861('0x36')][_0x0861('0x37')]?_0x117c28[_0x0861('0x36')]:_0x5ba6eb[_0x0861('0x30')];if(!_0x15f239[_0x0861('0x31')]['hasOwnProperty']('nolimit')){_0x117c28['limit']=qs[_0x0861('0x1c')](_0x15f239[_0x0861('0x31')][_0x0861('0x1c')]);_0x117c28[_0x0861('0x1a')]=qs[_0x0861('0x1a')](_0x15f239[_0x0861('0x31')][_0x0861('0x1a')]);}_0x117c28[_0x0861('0x38')]=qs[_0x0861('0x39')](_0x15f239[_0x0861('0x31')][_0x0861('0x39')]);_0x117c28['where']=qs[_0x0861('0x33')](_[_0x0861('0x3a')](_0x15f239[_0x0861('0x31')],_0x5ba6eb[_0x0861('0x33')]),_0x3199af);if(_0x15f239[_0x0861('0x31')][_0x0861('0x3b')]){_0x117c28[_0x0861('0x3c')]=_[_0x0861('0x3d')](_0x117c28['where'],{'$or':_[_0x0861('0x2b')](_0x3199af,function(_0x438621){if(_0x438621[_0x0861('0x2e')]!=='VIRTUAL'){var _0x4d87b0={};_0x4d87b0[_0x438621[_0x0861('0x28')]]={'$like':'%'+_0x15f239[_0x0861('0x31')]['filter']+'%'};return _0x4d87b0;}})});}_0x117c28=_['merge']({},_0x117c28,_0x15f239[_0x0861('0x3e')]);var _0x14621f={'where':_0x117c28[_0x0861('0x3c')]};return db[_0x0861('0x3f')][_0x0861('0x1b')](_0x14621f)[_0x0861('0x24')](function(_0x25eff6){_0x4a9781['count']=_0x25eff6;if(_0x15f239[_0x0861('0x31')][_0x0861('0x40')]){_0x117c28[_0x0861('0x41')]=[{'all':!![]}];}return db[_0x0861('0x3f')][_0x0861('0x42')](_0x117c28);})['then'](function(_0x8b1f59){_0x4a9781[_0x0861('0x43')]=_0x8b1f59;return _0x4a9781;})[_0x0861('0x24')](respondWithFilteredResult(_0x4255b5,_0x117c28))['catch'](handleError(_0x4255b5,null));};exports[_0x0861('0x44')]=function(_0xb58db9,_0x1de698){var _0xdf61d6={'raw':!![],'where':{'id':_0xb58db9[_0x0861('0x45')]['id']}},_0x40fc9c={};_0x40fc9c['model']=_[_0x0861('0x32')](db[_0x0861('0x3f')][_0x0861('0x2c')]);_0x40fc9c[_0x0861('0x31')]=_[_0x0861('0x32')](_0xb58db9[_0x0861('0x31')]);_0x40fc9c[_0x0861('0x33')]=_[_0x0861('0x34')](_0x40fc9c[_0x0861('0x30')],_0x40fc9c[_0x0861('0x31')]);_0xdf61d6[_0x0861('0x36')]=_[_0x0861('0x34')](_0x40fc9c[_0x0861('0x30')],qs[_0x0861('0x35')](_0xb58db9[_0x0861('0x31')][_0x0861('0x35')]));_0xdf61d6['attributes']=_0xdf61d6['attributes']['length']?_0xdf61d6[_0x0861('0x36')]:_0x40fc9c[_0x0861('0x30')];if(_0xb58db9['query'][_0x0861('0x40')]){_0xdf61d6[_0x0861('0x41')]=[{'all':!![]}];}_0xdf61d6=_[_0x0861('0x3d')]({},_0xdf61d6,_0xb58db9['options']);return db['MailSubstatus'][_0x0861('0x46')](_0xdf61d6)[_0x0861('0x24')](handleEntityNotFound(_0x1de698,null))['then'](respondWithResult(_0x1de698,null))[_0x0861('0x47')](handleError(_0x1de698,null));};exports[_0x0861('0x48')]=function(_0x13ce4f,_0x27aed6){return db[_0x0861('0x3f')]['create'](_0x13ce4f['body'],{})[_0x0861('0x24')](respondWithResult(_0x27aed6,0xc9))[_0x0861('0x47')](handleError(_0x27aed6,null));};exports[_0x0861('0x23')]=function(_0x6108b8,_0x3c9cd4){if(_0x6108b8[_0x0861('0x49')]['id']){delete _0x6108b8['body']['id'];}return db[_0x0861('0x3f')]['find']({'where':{'id':_0x6108b8[_0x0861('0x45')]['id']}})[_0x0861('0x24')](handleEntityNotFound(_0x3c9cd4,null))[_0x0861('0x24')](saveUpdates(_0x6108b8[_0x0861('0x49')],null))[_0x0861('0x24')](respondWithResult(_0x3c9cd4,null))[_0x0861('0x47')](handleError(_0x3c9cd4,null));};exports['destroy']=function(_0x2f8dc1,_0x345eaa){return db[_0x0861('0x3f')][_0x0861('0x46')]({'where':{'id':_0x2f8dc1[_0x0861('0x45')]['id']}})['then'](handleEntityNotFound(_0x345eaa,null))['then'](removeEntity(_0x345eaa,null))[_0x0861('0x47')](handleError(_0x345eaa,null));};exports[_0x0861('0x4a')]=function(_0x556e7d,_0x4cc7df){return db[_0x0861('0x3f')][_0x0861('0x4a')]()[_0x0861('0x24')](respondWithResult(_0x4cc7df,null))[_0x0861('0x47')](handleError(_0x4cc7df,null));}; \ No newline at end of file diff --git a/server/api/mailSubstatus/mailSubstatus.events.js b/server/api/mailSubstatus/mailSubstatus.events.js index 9b8a8f9..893517c 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 _0xa9b7=['setMaxListeners','update','emit','hasOwnProperty','hook','exports','events','../../mysqldb','MailSubstatus'];(function(_0x5c9168,_0x5c3d09){var _0x41fb14=function(_0x5bbdda){while(--_0x5bbdda){_0x5c9168['push'](_0x5c9168['shift']());}};_0x41fb14(++_0x5c3d09);}(_0xa9b7,0x10b));var _0x7a9b=function(_0x254680,_0x4ba3e6){_0x254680=_0x254680-0x0;var _0x1921c0=_0xa9b7[_0x254680];return _0x1921c0;};'use strict';var EventEmitter=require(_0x7a9b('0x0'));var MailSubstatus=require(_0x7a9b('0x1'))['db'][_0x7a9b('0x2')];var MailSubstatusEvents=new EventEmitter();MailSubstatusEvents[_0x7a9b('0x3')](0x0);var events={'afterUpdate':_0x7a9b('0x4')};function emitEvent(_0xb4a1ae){return function(_0x3ff65c,_0x2247a2,_0x4753e0){MailSubstatusEvents[_0x7a9b('0x5')](_0xb4a1ae+':'+_0x3ff65c['id'],_0x3ff65c);MailSubstatusEvents['emit'](_0xb4a1ae,_0x3ff65c);_0x4753e0(null);};}for(var e in events){if(events[_0x7a9b('0x6')](e)){var event=events[e];MailSubstatus[_0x7a9b('0x7')](e,emitEvent(event));}}module[_0x7a9b('0x8')]=MailSubstatusEvents; \ No newline at end of file +var _0x4405=['update','emit','hasOwnProperty','hook','exports','events','../../mysqldb','setMaxListeners'];(function(_0x209ee0,_0x583a18){var _0x5273a0=function(_0x4b184b){while(--_0x4b184b){_0x209ee0['push'](_0x209ee0['shift']());}};_0x5273a0(++_0x583a18);}(_0x4405,0x125));var _0x5440=function(_0x507cba,_0x316150){_0x507cba=_0x507cba-0x0;var _0x45bf84=_0x4405[_0x507cba];return _0x45bf84;};'use strict';var EventEmitter=require(_0x5440('0x0'));var MailSubstatus=require(_0x5440('0x1'))['db']['MailSubstatus'];var MailSubstatusEvents=new EventEmitter();MailSubstatusEvents[_0x5440('0x2')](0x0);var events={'afterUpdate':_0x5440('0x3')};function emitEvent(_0x389fd6){return function(_0x516d08,_0x588e5c,_0x2982b1){MailSubstatusEvents['emit'](_0x389fd6+':'+_0x516d08['id'],_0x516d08);MailSubstatusEvents[_0x5440('0x4')](_0x389fd6,_0x516d08);_0x2982b1(null);};}for(var e in events){if(events[_0x5440('0x5')](e)){var event=events[e];MailSubstatus[_0x5440('0x6')](e,emitEvent(event));}}module[_0x5440('0x7')]=MailSubstatusEvents; \ No newline at end of file diff --git a/server/api/mailSubstatus/mailSubstatus.model.js b/server/api/mailSubstatus/mailSubstatus.model.js index 9d4157d..2ef4628 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 _0x7df7=['then','./mailSubstatus.attributes','exports','models','mail_substatuses','Condition','update','name','mailSubstatus','_previousDataValues'];(function(_0x539964,_0x54d1f8){var _0x559b1a=function(_0x46fec9){while(--_0x46fec9){_0x539964['push'](_0x539964['shift']());}};_0x559b1a(++_0x54d1f8);}(_0x7df7,0x1b9));var _0x77df=function(_0x3d58ae,_0x297c75){_0x3d58ae=_0x3d58ae-0x0;var _0x55c5b0=_0x7df7[_0x3d58ae];return _0x55c5b0;};'use strict';var attributes=require(_0x77df('0x0'));module[_0x77df('0x1')]=function(_0x5b255a){var _0x4a36f7=_0x5b255a[_0x77df('0x2')];return _0x5b255a['define']('MailSubstatus',attributes,{'tableName':_0x77df('0x3'),'paranoid':![],'indexes':[],'timestamps':!![],'hooks':{'afterUpdate':function(_0x5b091b,_0x1c65b7,_0x4719d9){return _0x4a36f7[_0x77df('0x4')][_0x77df('0x5')]({'value':_0x5b091b[_0x77df('0x6')]},{'where':{'field':_0x77df('0x7'),'value':_0x5b091b[_0x77df('0x8')][_0x77df('0x6')]}})[_0x77df('0x9')](function(){_0x4719d9();})['catch'](function(_0x546470){_0x4719d9(_0x546470);});}}});}; \ No newline at end of file +var _0xe806=['mailSubstatus','name','./mailSubstatus.attributes','models','define','mail_substatuses','update'];(function(_0x26c4d0,_0x461b33){var _0x471dc5=function(_0x48bd15){while(--_0x48bd15){_0x26c4d0['push'](_0x26c4d0['shift']());}};_0x471dc5(++_0x461b33);}(_0xe806,0x113));var _0x6e80=function(_0xb9e732,_0x529789){_0xb9e732=_0xb9e732-0x0;var _0x56ec61=_0xe806[_0xb9e732];return _0x56ec61;};'use strict';var attributes=require(_0x6e80('0x0'));module['exports']=function(_0x170709){var _0x65f4a=_0x170709[_0x6e80('0x1')];return _0x170709[_0x6e80('0x2')]('MailSubstatus',attributes,{'tableName':_0x6e80('0x3'),'paranoid':![],'indexes':[],'timestamps':!![],'hooks':{'afterUpdate':function(_0x4961dd,_0x1f971f,_0x427bcf){return _0x65f4a['Condition'][_0x6e80('0x4')]({'value':_0x4961dd['name']},{'where':{'field':_0x6e80('0x5'),'value':_0x4961dd['_previousDataValues'][_0x6e80('0x6')]}})['then'](function(){_0x427bcf();})['catch'](function(_0x240b2d){_0x427bcf(_0x240b2d);});}}});}; \ No newline at end of file diff --git a/server/api/mailSubstatus/mailSubstatus.rpc.js b/server/api/mailSubstatus/mailSubstatus.rpc.js index 4ab6cf6..0b61c37 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 _0x291c=['info','MailSubstatus,\x20%s,\x20%s','debug','MailSubstatus,\x20%s,\x20%s,\x20%s','request\x20sent','stringify','error','code','message','result','catch','lodash','util','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/logger','rpc','../../config/environment','jayson/promise','client','http','request','then'];(function(_0x3dd15e,_0x1f0015){var _0x231fd0=function(_0x4f680a){while(--_0x4f680a){_0x3dd15e['push'](_0x3dd15e['shift']());}};_0x231fd0(++_0x1f0015);}(_0x291c,0x191));var _0xc291=function(_0x413feb,_0x10477f){_0x413feb=_0x413feb-0x0;var _0x40ee88=_0x291c[_0x413feb];return _0x40ee88;};'use strict';var _=require(_0xc291('0x0'));var util=require(_0xc291('0x1'));var moment=require(_0xc291('0x2'));var BPromise=require(_0xc291('0x3'));var rs=require(_0xc291('0x4'));var fs=require('fs');var Redis=require(_0xc291('0x5'));var db=require(_0xc291('0x6'))['db'];var utils=require('../../config/utils');var logger=require(_0xc291('0x7'))(_0xc291('0x8'));var config=require(_0xc291('0x9'));var jayson=require(_0xc291('0xa'));var client=jayson[_0xc291('0xb')][_0xc291('0xc')]({'port':0x232a});function respondWithRpcPromise(_0x554acd,_0x4ce754,_0x50ce28){return new BPromise(function(_0x432338,_0x180bef){return client[_0xc291('0xd')](_0x554acd,_0x50ce28)[_0xc291('0xe')](function(_0x47c969){logger[_0xc291('0xf')](_0xc291('0x10'),_0x4ce754,'request\x20sent');logger[_0xc291('0x11')](_0xc291('0x12'),_0x4ce754,_0xc291('0x13'),JSON[_0xc291('0x14')](_0x47c969));if(_0x47c969[_0xc291('0x15')]){if(_0x47c969[_0xc291('0x15')][_0xc291('0x16')]===0x1f4){logger[_0xc291('0x15')](_0xc291('0x10'),_0x4ce754,_0x47c969['error'][_0xc291('0x17')]);return _0x180bef(_0x47c969[_0xc291('0x15')][_0xc291('0x17')]);}logger[_0xc291('0x15')]('MailSubstatus,\x20%s,\x20%s',_0x4ce754,_0x47c969[_0xc291('0x15')][_0xc291('0x17')]);return _0x432338(_0x47c969['error'][_0xc291('0x17')]);}else{logger[_0xc291('0xf')](_0xc291('0x10'),_0x4ce754,_0xc291('0x13'));_0x432338(_0x47c969[_0xc291('0x18')][_0xc291('0x17')]);}})[_0xc291('0x19')](function(_0x53a8c1){logger[_0xc291('0x15')](_0xc291('0x10'),_0x4ce754,_0x53a8c1);_0x180bef(_0x53a8c1);});});} \ No newline at end of file +var _0x0186=['util','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/logger','jayson/promise','http','request','then','MailSubstatus,\x20%s,\x20%s','debug','MailSubstatus,\x20%s,\x20%s,\x20%s','request\x20sent','stringify','error','code','message','info','result','catch','lodash'];(function(_0x244ccd,_0x42e035){var _0x3fda12=function(_0xd5bcab){while(--_0xd5bcab){_0x244ccd['push'](_0x244ccd['shift']());}};_0x3fda12(++_0x42e035);}(_0x0186,0xe5));var _0x6018=function(_0x44d636,_0x1b5b34){_0x44d636=_0x44d636-0x0;var _0xe19f67=_0x0186[_0x44d636];return _0xe19f67;};'use strict';var _=require(_0x6018('0x0'));var util=require(_0x6018('0x1'));var moment=require(_0x6018('0x2'));var BPromise=require(_0x6018('0x3'));var rs=require(_0x6018('0x4'));var fs=require('fs');var Redis=require(_0x6018('0x5'));var db=require(_0x6018('0x6'))['db'];var utils=require('../../config/utils');var logger=require(_0x6018('0x7'))('rpc');var config=require('../../config/environment');var jayson=require(_0x6018('0x8'));var client=jayson['client'][_0x6018('0x9')]({'port':0x232a});function respondWithRpcPromise(_0x2431a0,_0x3dbc30,_0x428ca6){return new BPromise(function(_0x57ac5e,_0xd5f6dd){return client[_0x6018('0xa')](_0x2431a0,_0x428ca6)[_0x6018('0xb')](function(_0x408004){logger['info'](_0x6018('0xc'),_0x3dbc30,'request\x20sent');logger[_0x6018('0xd')](_0x6018('0xe'),_0x3dbc30,_0x6018('0xf'),JSON[_0x6018('0x10')](_0x408004));if(_0x408004[_0x6018('0x11')]){if(_0x408004['error'][_0x6018('0x12')]===0x1f4){logger[_0x6018('0x11')](_0x6018('0xc'),_0x3dbc30,_0x408004['error']['message']);return _0xd5f6dd(_0x408004[_0x6018('0x11')][_0x6018('0x13')]);}logger[_0x6018('0x11')]('MailSubstatus,\x20%s,\x20%s',_0x3dbc30,_0x408004[_0x6018('0x11')][_0x6018('0x13')]);return _0x57ac5e(_0x408004['error']['message']);}else{logger[_0x6018('0x14')](_0x6018('0xc'),_0x3dbc30,_0x6018('0xf'));_0x57ac5e(_0x408004[_0x6018('0x15')][_0x6018('0x13')]);}})[_0x6018('0x16')](function(_0x1c6dbd){logger['error'](_0x6018('0xc'),_0x3dbc30,_0x1c6dbd);_0xd5f6dd(_0x1c6dbd);});});} \ No newline at end of file diff --git a/server/api/mailTransferReport/index.js b/server/api/mailTransferReport/index.js index 16c5c22..5a67d02 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 _0xdb61=['post','create','update','destroy','exports','multer','util','path','connect-timeout','express','../../components/interaction/service','./mailTransferReport.controller','get','isAuthenticated','index','/describe','describe','/:id','show'];(function(_0x331952,_0x163a69){var _0x3e931c=function(_0x550c7b){while(--_0x550c7b){_0x331952['push'](_0x331952['shift']());}};_0x3e931c(++_0x163a69);}(_0xdb61,0x77));var _0x1db6=function(_0x2eaa8d,_0x12f7d1){_0x2eaa8d=_0x2eaa8d-0x0;var _0x16b6b0=_0xdb61[_0x2eaa8d];return _0x16b6b0;};'use strict';var multer=require(_0x1db6('0x0'));var util=require(_0x1db6('0x1'));var path=require(_0x1db6('0x2'));var timeout=require(_0x1db6('0x3'));var express=require(_0x1db6('0x4'));var router=express['Router']();var fs_extra=require('fs-extra');var auth=require('../../components/auth/service');var interaction=require(_0x1db6('0x5'));var config=require('../../config/environment');var controller=require(_0x1db6('0x6'));router[_0x1db6('0x7')]('/',auth[_0x1db6('0x8')](),controller[_0x1db6('0x9')]);router[_0x1db6('0x7')](_0x1db6('0xa'),auth[_0x1db6('0x8')](),controller[_0x1db6('0xb')]);router[_0x1db6('0x7')](_0x1db6('0xc'),auth[_0x1db6('0x8')](),controller[_0x1db6('0xd')]);router[_0x1db6('0xe')]('/',auth[_0x1db6('0x8')](),controller[_0x1db6('0xf')]);router['put']('/:id',auth[_0x1db6('0x8')](),controller[_0x1db6('0x10')]);router['delete'](_0x1db6('0xc'),auth[_0x1db6('0x8')](),controller[_0x1db6('0x11')]);module[_0x1db6('0x12')]=router; \ No newline at end of file +var _0xf79d=['put','update','delete','destroy','exports','multer','path','connect-timeout','Router','fs-extra','../../components/interaction/service','../../config/environment','./mailTransferReport.controller','get','isAuthenticated','index','/describe','describe','/:id','post','create'];(function(_0x30faec,_0x18940b){var _0x29484f=function(_0x169ae8){while(--_0x169ae8){_0x30faec['push'](_0x30faec['shift']());}};_0x29484f(++_0x18940b);}(_0xf79d,0x12b));var _0xdf79=function(_0x2a05f8,_0x42fbbe){_0x2a05f8=_0x2a05f8-0x0;var _0x429b9c=_0xf79d[_0x2a05f8];return _0x429b9c;};'use strict';var multer=require(_0xdf79('0x0'));var util=require('util');var path=require(_0xdf79('0x1'));var timeout=require(_0xdf79('0x2'));var express=require('express');var router=express[_0xdf79('0x3')]();var fs_extra=require(_0xdf79('0x4'));var auth=require('../../components/auth/service');var interaction=require(_0xdf79('0x5'));var config=require(_0xdf79('0x6'));var controller=require(_0xdf79('0x7'));router[_0xdf79('0x8')]('/',auth[_0xdf79('0x9')](),controller[_0xdf79('0xa')]);router[_0xdf79('0x8')](_0xdf79('0xb'),auth[_0xdf79('0x9')](),controller[_0xdf79('0xc')]);router[_0xdf79('0x8')](_0xdf79('0xd'),auth['isAuthenticated'](),controller['show']);router[_0xdf79('0xe')]('/',auth[_0xdf79('0x9')](),controller[_0xdf79('0xf')]);router[_0xdf79('0x10')](_0xdf79('0xd'),auth[_0xdf79('0x9')](),controller[_0xdf79('0x11')]);router[_0xdf79('0x12')](_0xdf79('0xd'),auth[_0xdf79('0x9')](),controller[_0xdf79('0x13')]);module[_0xdf79('0x14')]=router; \ No newline at end of file diff --git a/server/api/mailTransferReport/mailTransferReport.attributes.js b/server/api/mailTransferReport/mailTransferReport.attributes.js index e559846..d049567 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 _0xe706=['NOW','moment','sequelize','exports','ENUM','account','agent','queue','DATE'];(function(_0x282790,_0x112b5f){var _0x4c5de5=function(_0x1357da){while(--_0x1357da){_0x282790['push'](_0x282790['shift']());}};_0x4c5de5(++_0x112b5f);}(_0xe706,0xa3));var _0x6e70=function(_0x310d56,_0x581328){_0x310d56=_0x310d56-0x0;var _0x8759c7=_0xe706[_0x310d56];return _0x8759c7;};'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 _0xa9e0=['account','queue','DATE','NOW','moment','sequelize','exports'];(function(_0xb85fd5,_0x3362ae){var _0x34228e=function(_0x1e62fa){while(--_0x1e62fa){_0xb85fd5['push'](_0xb85fd5['shift']());}};_0x34228e(++_0x3362ae);}(_0xa9e0,0x123));var _0x0a9e=function(_0x37bd26,_0x5ad346){_0x37bd26=_0x37bd26-0x0;var _0xe83dc4=_0xa9e0[_0x37bd26];return _0xe83dc4;};'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/mailTransferReport/mailTransferReport.controller.js b/server/api/mailTransferReport/mailTransferReport.controller.js index 36c1d8d..f0d54f4 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 _0xbe28=['../../config/logger','../../config/utils','../../config/environment','../../config/license/util','sendStatus','status','end','json','undefined','count','offset','limit','set','reject','destroy','stack','name','send','map','MailTransferReport','rawAttributes','fieldName','type','key','query','filters','intersection','model','attributes','fields','length','nolimit','sort','where','pick','filter','merge','VIRTUAL','options','then','includeAll','include','findAll','rows','catch','show','params','find','body','update','describe','eml-format','zip-dir','request-promise','moment','bluebird','mustache','util','path','to-csv','ejs','fs-extra','lodash','squel','desk.js','querystring','../../components/auth/service','../../components/parsers/advancedSearch','../../config/license/hardware'];(function(_0xc0a3d3,_0x2c8d00){var _0x3386e8=function(_0x3f9df4){while(--_0x3f9df4){_0xc0a3d3['push'](_0xc0a3d3['shift']());}};_0x3386e8(++_0x2c8d00);}(_0xbe28,0x1d1));var _0x8be2=function(_0x1d4055,_0x3d4d4e){_0x1d4055=_0x1d4055-0x0;var _0x13b28c=_0xbe28[_0x1d4055];return _0x13b28c;};'use strict';var emlformat=require(_0x8be2('0x0'));var rimraf=require('rimraf');var zipdir=require(_0x8be2('0x1'));var jsonpatch=require('fast-json-patch');var rp=require(_0x8be2('0x2'));var moment=require(_0x8be2('0x3'));var BPromise=require(_0x8be2('0x4'));var Mustache=require(_0x8be2('0x5'));var util=require(_0x8be2('0x6'));var path=require(_0x8be2('0x7'));var sox=require('sox');var csv=require(_0x8be2('0x8'));var ejs=require(_0x8be2('0x9'));var fs=require('fs');var fs_extra=require(_0x8be2('0xa'));var _=require(_0x8be2('0xb'));var squel=require(_0x8be2('0xc'));var crypto=require('crypto');var jsforce=require('jsforce');var deskjs=require(_0x8be2('0xd'));var toCsv=require('to-csv');var querystring=require(_0x8be2('0xe'));var Papa=require('papaparse');var Redis=require('ioredis');var authService=require(_0x8be2('0xf'));var qs=require('../../components/parsers/qs');var as=require(_0x8be2('0x10'));var hardwareService=require(_0x8be2('0x11'));var logger=require(_0x8be2('0x12'))('api');var utils=require(_0x8be2('0x13'));var config=require(_0x8be2('0x14'));var licenseUtil=require(_0x8be2('0x15'));var db=require('../../mysqldb')['db'];function respondWithStatusCode(_0x358cf8,_0x4e6258){_0x4e6258=_0x4e6258||0xcc;return function(_0x34cecc){if(_0x34cecc){return _0x358cf8[_0x8be2('0x16')](_0x4e6258);}return _0x358cf8[_0x8be2('0x17')](_0x4e6258)[_0x8be2('0x18')]();};}function respondWithResult(_0x26eb47,_0x14c212){_0x14c212=_0x14c212||0xc8;return function(_0x581530){if(_0x581530){return _0x26eb47[_0x8be2('0x17')](_0x14c212)[_0x8be2('0x19')](_0x581530);}};}function respondWithFilteredResult(_0xe1756,_0x1b45d3){return function(_0xbd392a){if(_0xbd392a){var _0x4a7fb8=typeof _0x1b45d3['offset']===_0x8be2('0x1a')&&typeof _0x1b45d3['limit']==='undefined';var _0x1bcd3f=_0xbd392a[_0x8be2('0x1b')];var _0xb48833=_0x4a7fb8?0x0:_0x1b45d3[_0x8be2('0x1c')];var _0x26f943=_0x4a7fb8?_0xbd392a['count']:_0x1b45d3[_0x8be2('0x1c')]+_0x1b45d3[_0x8be2('0x1d')];var _0x49de8f;if(_0x26f943>=_0x1bcd3f){_0x26f943=_0x1bcd3f;_0x49de8f=0xc8;}else{_0x49de8f=0xce;}_0xe1756['status'](_0x49de8f);return _0xe1756[_0x8be2('0x1e')]('Content-Range',_0xb48833+'-'+_0x26f943+'/'+_0x1bcd3f)[_0x8be2('0x19')](_0xbd392a);}return null;};}function patchUpdates(_0x25c083){return function(_0x48c751){try{jsonpatch['apply'](_0x48c751,_0x25c083,!![]);}catch(_0x184ed6){return BPromise[_0x8be2('0x1f')](_0x184ed6);}return _0x48c751['save']();};}function saveUpdates(_0x395af8,_0xfc664c){return function(_0x499d15){if(_0x499d15){return _0x499d15['update'](_0x395af8)['then'](function(_0x5c8e7a){return _0x5c8e7a;});}return null;};}function removeEntity(_0xaad6a1,_0x3ab545){return function(_0x4239ea){if(_0x4239ea){return _0x4239ea[_0x8be2('0x20')]()['then'](function(){_0xaad6a1['status'](0xcc)[_0x8be2('0x18')]();});}};}function handleEntityNotFound(_0x385c03,_0x4ef87e){return function(_0x22c4bc){if(!_0x22c4bc){_0x385c03[_0x8be2('0x16')](0x194);}return _0x22c4bc;};}function handleError(_0x2283ed,_0x49bcaa){_0x49bcaa=_0x49bcaa||0x1f4;return function(_0x25eaa8){logger['error'](_0x25eaa8[_0x8be2('0x21')]);if(_0x25eaa8[_0x8be2('0x22')]){delete _0x25eaa8[_0x8be2('0x22')];}_0x2283ed[_0x8be2('0x17')](_0x49bcaa)[_0x8be2('0x23')](_0x25eaa8);};}exports['index']=function(_0x58b1e3,_0x4d6928){var _0x13f2c1={},_0x294415={},_0x24a22b={'count':0x0,'rows':[]};var _0x2161af=_[_0x8be2('0x24')](db[_0x8be2('0x25')][_0x8be2('0x26')],function(_0x35f52f){return{'name':_0x35f52f[_0x8be2('0x27')],'type':_0x35f52f[_0x8be2('0x28')][_0x8be2('0x29')]};});_0x294415['model']=_[_0x8be2('0x24')](_0x2161af,_0x8be2('0x22'));_0x294415['query']=_['keys'](_0x58b1e3[_0x8be2('0x2a')]);_0x294415[_0x8be2('0x2b')]=_[_0x8be2('0x2c')](_0x294415[_0x8be2('0x2d')],_0x294415['query']);_0x13f2c1[_0x8be2('0x2e')]=_[_0x8be2('0x2c')](_0x294415[_0x8be2('0x2d')],qs[_0x8be2('0x2f')](_0x58b1e3[_0x8be2('0x2a')][_0x8be2('0x2f')]));_0x13f2c1[_0x8be2('0x2e')]=_0x13f2c1[_0x8be2('0x2e')][_0x8be2('0x30')]?_0x13f2c1['attributes']:_0x294415[_0x8be2('0x2d')];if(!_0x58b1e3['query']['hasOwnProperty'](_0x8be2('0x31'))){_0x13f2c1[_0x8be2('0x1d')]=qs['limit'](_0x58b1e3['query']['limit']);_0x13f2c1[_0x8be2('0x1c')]=qs['offset'](_0x58b1e3['query']['offset']);}_0x13f2c1['order']=qs[_0x8be2('0x32')](_0x58b1e3[_0x8be2('0x2a')][_0x8be2('0x32')]);_0x13f2c1[_0x8be2('0x33')]=qs[_0x8be2('0x2b')](_[_0x8be2('0x34')](_0x58b1e3[_0x8be2('0x2a')],_0x294415[_0x8be2('0x2b')]),_0x2161af);if(_0x58b1e3[_0x8be2('0x2a')][_0x8be2('0x35')]){_0x13f2c1[_0x8be2('0x33')]=_[_0x8be2('0x36')](_0x13f2c1[_0x8be2('0x33')],{'$or':_[_0x8be2('0x24')](_0x2161af,function(_0x3b680f){if(_0x3b680f[_0x8be2('0x28')]!==_0x8be2('0x37')){var _0x17aedc={};_0x17aedc[_0x3b680f[_0x8be2('0x22')]]={'$like':'%'+_0x58b1e3[_0x8be2('0x2a')][_0x8be2('0x35')]+'%'};return _0x17aedc;}})});}_0x13f2c1=_[_0x8be2('0x36')]({},_0x13f2c1,_0x58b1e3[_0x8be2('0x38')]);var _0xd946a2={'where':_0x13f2c1['where']};return db[_0x8be2('0x25')][_0x8be2('0x1b')](_0xd946a2)[_0x8be2('0x39')](function(_0x5bdb00){_0x24a22b[_0x8be2('0x1b')]=_0x5bdb00;if(_0x58b1e3[_0x8be2('0x2a')][_0x8be2('0x3a')]){_0x13f2c1[_0x8be2('0x3b')]=[{'all':!![]}];}return db['MailTransferReport'][_0x8be2('0x3c')](_0x13f2c1);})['then'](function(_0x1e9a5f){_0x24a22b[_0x8be2('0x3d')]=_0x1e9a5f;return _0x24a22b;})[_0x8be2('0x39')](respondWithFilteredResult(_0x4d6928,_0x13f2c1))[_0x8be2('0x3e')](handleError(_0x4d6928,null));};exports[_0x8be2('0x3f')]=function(_0x58110d,_0xf6b3e){var _0x2f915c={'raw':!![],'where':{'id':_0x58110d[_0x8be2('0x40')]['id']}},_0x4200d1={};_0x4200d1['model']=_['keys'](db[_0x8be2('0x25')][_0x8be2('0x26')]);_0x4200d1['query']=_['keys'](_0x58110d[_0x8be2('0x2a')]);_0x4200d1[_0x8be2('0x2b')]=_['intersection'](_0x4200d1[_0x8be2('0x2d')],_0x4200d1[_0x8be2('0x2a')]);_0x2f915c[_0x8be2('0x2e')]=_[_0x8be2('0x2c')](_0x4200d1['model'],qs[_0x8be2('0x2f')](_0x58110d[_0x8be2('0x2a')][_0x8be2('0x2f')]));_0x2f915c[_0x8be2('0x2e')]=_0x2f915c[_0x8be2('0x2e')][_0x8be2('0x30')]?_0x2f915c[_0x8be2('0x2e')]:_0x4200d1['model'];if(_0x58110d[_0x8be2('0x2a')][_0x8be2('0x3a')]){_0x2f915c[_0x8be2('0x3b')]=[{'all':!![]}];}_0x2f915c=_[_0x8be2('0x36')]({},_0x2f915c,_0x58110d[_0x8be2('0x38')]);return db['MailTransferReport'][_0x8be2('0x41')](_0x2f915c)[_0x8be2('0x39')](handleEntityNotFound(_0xf6b3e,null))[_0x8be2('0x39')](respondWithResult(_0xf6b3e,null))['catch'](handleError(_0xf6b3e,null));};exports['create']=function(_0x220eb9,_0x23e905){return db[_0x8be2('0x25')]['create'](_0x220eb9[_0x8be2('0x42')],{})[_0x8be2('0x39')](respondWithResult(_0x23e905,0xc9))[_0x8be2('0x3e')](handleError(_0x23e905,null));};exports[_0x8be2('0x43')]=function(_0x563141,_0x57e715){if(_0x563141['body']['id']){delete _0x563141[_0x8be2('0x42')]['id'];}return db['MailTransferReport'][_0x8be2('0x41')]({'where':{'id':_0x563141[_0x8be2('0x40')]['id']}})[_0x8be2('0x39')](handleEntityNotFound(_0x57e715,null))[_0x8be2('0x39')](saveUpdates(_0x563141[_0x8be2('0x42')],null))[_0x8be2('0x39')](respondWithResult(_0x57e715,null))[_0x8be2('0x3e')](handleError(_0x57e715,null));};exports['destroy']=function(_0x141416,_0x27fffe){return db['MailTransferReport'][_0x8be2('0x41')]({'where':{'id':_0x141416['params']['id']}})[_0x8be2('0x39')](handleEntityNotFound(_0x27fffe,null))[_0x8be2('0x39')](removeEntity(_0x27fffe,null))[_0x8be2('0x3e')](handleError(_0x27fffe,null));};exports[_0x8be2('0x44')]=function(_0x4780b9,_0x5ef253){return db[_0x8be2('0x25')][_0x8be2('0x44')]()[_0x8be2('0x39')](respondWithResult(_0x5ef253,null))[_0x8be2('0x3e')](handleError(_0x5ef253,null));}; \ No newline at end of file +var _0x8122=['mustache','util','path','sox','ejs','fs-extra','lodash','squel','crypto','jsforce','desk.js','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/logger','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','sendStatus','status','end','json','offset','undefined','limit','count','Content-Range','apply','reject','save','update','then','destroy','name','send','map','MailTransferReport','rawAttributes','fieldName','type','key','model','keys','query','filters','intersection','attributes','fields','hasOwnProperty','nolimit','order','sort','where','pick','filter','merge','VIRTUAL','options','include','findAll','rows','catch','show','params','length','includeAll','create','body','find','describe','eml-format','rimraf','fast-json-patch','moment','bluebird'];(function(_0x4470f3,_0x318801){var _0xa2413a=function(_0x4300b9){while(--_0x4300b9){_0x4470f3['push'](_0x4470f3['shift']());}};_0xa2413a(++_0x318801);}(_0x8122,0x99));var _0x2812=function(_0x55b594,_0xc538d6){_0x55b594=_0x55b594-0x0;var _0x1270cd=_0x8122[_0x55b594];return _0x1270cd;};'use strict';var emlformat=require(_0x2812('0x0'));var rimraf=require(_0x2812('0x1'));var zipdir=require('zip-dir');var jsonpatch=require(_0x2812('0x2'));var rp=require('request-promise');var moment=require(_0x2812('0x3'));var BPromise=require(_0x2812('0x4'));var Mustache=require(_0x2812('0x5'));var util=require(_0x2812('0x6'));var path=require(_0x2812('0x7'));var sox=require(_0x2812('0x8'));var csv=require('to-csv');var ejs=require(_0x2812('0x9'));var fs=require('fs');var fs_extra=require(_0x2812('0xa'));var _=require(_0x2812('0xb'));var squel=require(_0x2812('0xc'));var crypto=require(_0x2812('0xd'));var jsforce=require(_0x2812('0xe'));var deskjs=require(_0x2812('0xf'));var toCsv=require('to-csv');var querystring=require(_0x2812('0x10'));var Papa=require(_0x2812('0x11'));var Redis=require(_0x2812('0x12'));var authService=require(_0x2812('0x13'));var qs=require(_0x2812('0x14'));var as=require(_0x2812('0x15'));var hardwareService=require('../../config/license/hardware');var logger=require(_0x2812('0x16'))('api');var utils=require(_0x2812('0x17'));var config=require(_0x2812('0x18'));var licenseUtil=require(_0x2812('0x19'));var db=require(_0x2812('0x1a'))['db'];function respondWithStatusCode(_0x486075,_0x52b0db){_0x52b0db=_0x52b0db||0xcc;return function(_0x41d59a){if(_0x41d59a){return _0x486075[_0x2812('0x1b')](_0x52b0db);}return _0x486075[_0x2812('0x1c')](_0x52b0db)[_0x2812('0x1d')]();};}function respondWithResult(_0x20d3ce,_0x3ce89a){_0x3ce89a=_0x3ce89a||0xc8;return function(_0x3ed2f2){if(_0x3ed2f2){return _0x20d3ce['status'](_0x3ce89a)[_0x2812('0x1e')](_0x3ed2f2);}};}function respondWithFilteredResult(_0x3a604f,_0x343ac5){return function(_0x4f0b97){if(_0x4f0b97){var _0xe779c=typeof _0x343ac5[_0x2812('0x1f')]===_0x2812('0x20')&&typeof _0x343ac5[_0x2812('0x21')]==='undefined';var _0x3d3564=_0x4f0b97['count'];var _0x3970a5=_0xe779c?0x0:_0x343ac5[_0x2812('0x1f')];var _0x475c50=_0xe779c?_0x4f0b97[_0x2812('0x22')]:_0x343ac5[_0x2812('0x1f')]+_0x343ac5[_0x2812('0x21')];var _0x3630ed;if(_0x475c50>=_0x3d3564){_0x475c50=_0x3d3564;_0x3630ed=0xc8;}else{_0x3630ed=0xce;}_0x3a604f[_0x2812('0x1c')](_0x3630ed);return _0x3a604f['set'](_0x2812('0x23'),_0x3970a5+'-'+_0x475c50+'/'+_0x3d3564)[_0x2812('0x1e')](_0x4f0b97);}return null;};}function patchUpdates(_0x1e89d0){return function(_0x625218){try{jsonpatch[_0x2812('0x24')](_0x625218,_0x1e89d0,!![]);}catch(_0x1fbf75){return BPromise[_0x2812('0x25')](_0x1fbf75);}return _0x625218[_0x2812('0x26')]();};}function saveUpdates(_0x2e5f6,_0x11975f){return function(_0x4cd8a5){if(_0x4cd8a5){return _0x4cd8a5[_0x2812('0x27')](_0x2e5f6)[_0x2812('0x28')](function(_0x2e3d0d){return _0x2e3d0d;});}return null;};}function removeEntity(_0x4c3b60,_0xc65142){return function(_0x355c97){if(_0x355c97){return _0x355c97[_0x2812('0x29')]()['then'](function(){_0x4c3b60[_0x2812('0x1c')](0xcc)[_0x2812('0x1d')]();});}};}function handleEntityNotFound(_0x4c21c0,_0x4ae1ba){return function(_0x6aefe8){if(!_0x6aefe8){_0x4c21c0[_0x2812('0x1b')](0x194);}return _0x6aefe8;};}function handleError(_0x5acfdd,_0x26af26){_0x26af26=_0x26af26||0x1f4;return function(_0x556cf4){logger['error'](_0x556cf4['stack']);if(_0x556cf4[_0x2812('0x2a')]){delete _0x556cf4[_0x2812('0x2a')];}_0x5acfdd[_0x2812('0x1c')](_0x26af26)[_0x2812('0x2b')](_0x556cf4);};}exports['index']=function(_0x1fbc1a,_0x9ca0f9){var _0x112cd6={},_0x1aab3d={},_0x2071fd={'count':0x0,'rows':[]};var _0x1a1eb0=_[_0x2812('0x2c')](db[_0x2812('0x2d')][_0x2812('0x2e')],function(_0x1292c2){return{'name':_0x1292c2[_0x2812('0x2f')],'type':_0x1292c2[_0x2812('0x30')][_0x2812('0x31')]};});_0x1aab3d[_0x2812('0x32')]=_[_0x2812('0x2c')](_0x1a1eb0,_0x2812('0x2a'));_0x1aab3d['query']=_[_0x2812('0x33')](_0x1fbc1a[_0x2812('0x34')]);_0x1aab3d[_0x2812('0x35')]=_[_0x2812('0x36')](_0x1aab3d[_0x2812('0x32')],_0x1aab3d[_0x2812('0x34')]);_0x112cd6[_0x2812('0x37')]=_[_0x2812('0x36')](_0x1aab3d[_0x2812('0x32')],qs[_0x2812('0x38')](_0x1fbc1a['query'][_0x2812('0x38')]));_0x112cd6['attributes']=_0x112cd6[_0x2812('0x37')]['length']?_0x112cd6['attributes']:_0x1aab3d[_0x2812('0x32')];if(!_0x1fbc1a[_0x2812('0x34')][_0x2812('0x39')](_0x2812('0x3a'))){_0x112cd6[_0x2812('0x21')]=qs['limit'](_0x1fbc1a[_0x2812('0x34')][_0x2812('0x21')]);_0x112cd6[_0x2812('0x1f')]=qs['offset'](_0x1fbc1a['query']['offset']);}_0x112cd6[_0x2812('0x3b')]=qs[_0x2812('0x3c')](_0x1fbc1a[_0x2812('0x34')][_0x2812('0x3c')]);_0x112cd6[_0x2812('0x3d')]=qs['filters'](_[_0x2812('0x3e')](_0x1fbc1a[_0x2812('0x34')],_0x1aab3d[_0x2812('0x35')]),_0x1a1eb0);if(_0x1fbc1a[_0x2812('0x34')][_0x2812('0x3f')]){_0x112cd6[_0x2812('0x3d')]=_[_0x2812('0x40')](_0x112cd6['where'],{'$or':_['map'](_0x1a1eb0,function(_0x511914){if(_0x511914[_0x2812('0x30')]!==_0x2812('0x41')){var _0x2e3a2b={};_0x2e3a2b[_0x511914[_0x2812('0x2a')]]={'$like':'%'+_0x1fbc1a[_0x2812('0x34')]['filter']+'%'};return _0x2e3a2b;}})});}_0x112cd6=_[_0x2812('0x40')]({},_0x112cd6,_0x1fbc1a[_0x2812('0x42')]);var _0x2712c8={'where':_0x112cd6[_0x2812('0x3d')]};return db[_0x2812('0x2d')][_0x2812('0x22')](_0x2712c8)[_0x2812('0x28')](function(_0x28752c){_0x2071fd['count']=_0x28752c;if(_0x1fbc1a[_0x2812('0x34')]['includeAll']){_0x112cd6[_0x2812('0x43')]=[{'all':!![]}];}return db[_0x2812('0x2d')][_0x2812('0x44')](_0x112cd6);})[_0x2812('0x28')](function(_0x2c6f29){_0x2071fd[_0x2812('0x45')]=_0x2c6f29;return _0x2071fd;})[_0x2812('0x28')](respondWithFilteredResult(_0x9ca0f9,_0x112cd6))[_0x2812('0x46')](handleError(_0x9ca0f9,null));};exports[_0x2812('0x47')]=function(_0x54f61f,_0x354b9d){var _0x489c73={'raw':!![],'where':{'id':_0x54f61f[_0x2812('0x48')]['id']}},_0x41dd61={};_0x41dd61[_0x2812('0x32')]=_[_0x2812('0x33')](db[_0x2812('0x2d')][_0x2812('0x2e')]);_0x41dd61[_0x2812('0x34')]=_[_0x2812('0x33')](_0x54f61f[_0x2812('0x34')]);_0x41dd61['filters']=_[_0x2812('0x36')](_0x41dd61['model'],_0x41dd61[_0x2812('0x34')]);_0x489c73[_0x2812('0x37')]=_['intersection'](_0x41dd61[_0x2812('0x32')],qs[_0x2812('0x38')](_0x54f61f[_0x2812('0x34')][_0x2812('0x38')]));_0x489c73[_0x2812('0x37')]=_0x489c73[_0x2812('0x37')][_0x2812('0x49')]?_0x489c73[_0x2812('0x37')]:_0x41dd61[_0x2812('0x32')];if(_0x54f61f[_0x2812('0x34')][_0x2812('0x4a')]){_0x489c73[_0x2812('0x43')]=[{'all':!![]}];}_0x489c73=_['merge']({},_0x489c73,_0x54f61f[_0x2812('0x42')]);return db[_0x2812('0x2d')]['find'](_0x489c73)[_0x2812('0x28')](handleEntityNotFound(_0x354b9d,null))[_0x2812('0x28')](respondWithResult(_0x354b9d,null))[_0x2812('0x46')](handleError(_0x354b9d,null));};exports[_0x2812('0x4b')]=function(_0x1d655c,_0x1b940b){return db['MailTransferReport'][_0x2812('0x4b')](_0x1d655c['body'],{})[_0x2812('0x28')](respondWithResult(_0x1b940b,0xc9))[_0x2812('0x46')](handleError(_0x1b940b,null));};exports[_0x2812('0x27')]=function(_0x5a5b0d,_0x34aff2){if(_0x5a5b0d[_0x2812('0x4c')]['id']){delete _0x5a5b0d['body']['id'];}return db[_0x2812('0x2d')]['find']({'where':{'id':_0x5a5b0d[_0x2812('0x48')]['id']}})[_0x2812('0x28')](handleEntityNotFound(_0x34aff2,null))['then'](saveUpdates(_0x5a5b0d['body'],null))[_0x2812('0x28')](respondWithResult(_0x34aff2,null))[_0x2812('0x46')](handleError(_0x34aff2,null));};exports[_0x2812('0x29')]=function(_0x41b707,_0x2c51e0){return db['MailTransferReport'][_0x2812('0x4d')]({'where':{'id':_0x41b707[_0x2812('0x48')]['id']}})[_0x2812('0x28')](handleEntityNotFound(_0x2c51e0,null))[_0x2812('0x28')](removeEntity(_0x2c51e0,null))[_0x2812('0x46')](handleError(_0x2c51e0,null));};exports[_0x2812('0x4e')]=function(_0x311cce,_0x5a85f9){return db['MailTransferReport'][_0x2812('0x4e')]()[_0x2812('0x28')](respondWithResult(_0x5a85f9,null))[_0x2812('0x46')](handleError(_0x5a85f9,null));}; \ No newline at end of file diff --git a/server/api/mailTransferReport/mailTransferReport.model.js b/server/api/mailTransferReport/mailTransferReport.model.js index 2f3ff96..9a6377e 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 _0x84cb=['path','rimraf','../../config/environment','./mailTransferReport.attributes','exports','MailTransferReport','report_mail_transfer','uniqueid','lodash','../../config/logger','moment','request-promise'];(function(_0x285cd3,_0xb5dc59){var _0x21cc67=function(_0x51c5a7){while(--_0x51c5a7){_0x285cd3['push'](_0x285cd3['shift']());}};_0x21cc67(++_0xb5dc59);}(_0x84cb,0xf8));var _0xb84c=function(_0x3c7199,_0x269c46){_0x3c7199=_0x3c7199-0x0;var _0x5a55b6=_0x84cb[_0x3c7199];return _0x5a55b6;};'use strict';var _=require(_0xb84c('0x0'));var util=require('util');var logger=require(_0xb84c('0x1'))('api');var moment=require(_0xb84c('0x2'));var BPromise=require('bluebird');var rp=require(_0xb84c('0x3'));var fs=require('fs');var path=require(_0xb84c('0x4'));var rimraf=require(_0xb84c('0x5'));var config=require(_0xb84c('0x6'));var attributes=require(_0xb84c('0x7'));module[_0xb84c('0x8')]=function(_0x1afb9f,_0x20fa18){return _0x1afb9f['define'](_0xb84c('0x9'),attributes,{'tableName':_0xb84c('0xa'),'paranoid':![],'indexes':[{'name':_0xb84c('0xb'),'fields':[_0xb84c('0xb')]}],'timestamps':!![]});}; \ No newline at end of file +var _0xcd3a=['api','moment','bluebird','request-promise','path','../../config/environment','./mailTransferReport.attributes','exports','MailTransferReport','report_mail_transfer','uniqueid','lodash','util','../../config/logger'];(function(_0x130c64,_0x24ce68){var _0x59d57e=function(_0x2af67f){while(--_0x2af67f){_0x130c64['push'](_0x130c64['shift']());}};_0x59d57e(++_0x24ce68);}(_0xcd3a,0xcf));var _0xacd3=function(_0x140e9d,_0x58d034){_0x140e9d=_0x140e9d-0x0;var _0x3f454d=_0xcd3a[_0x140e9d];return _0x3f454d;};'use strict';var _=require(_0xacd3('0x0'));var util=require(_0xacd3('0x1'));var logger=require(_0xacd3('0x2'))(_0xacd3('0x3'));var moment=require(_0xacd3('0x4'));var BPromise=require(_0xacd3('0x5'));var rp=require(_0xacd3('0x6'));var fs=require('fs');var path=require(_0xacd3('0x7'));var rimraf=require('rimraf');var config=require(_0xacd3('0x8'));var attributes=require(_0xacd3('0x9'));module[_0xacd3('0xa')]=function(_0x1d702c,_0x546b62){return _0x1d702c['define'](_0xacd3('0xb'),attributes,{'tableName':_0xacd3('0xc'),'paranoid':![],'indexes':[{'name':_0xacd3('0xd'),'fields':['uniqueid']}],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/mailTransferReport/mailTransferReport.rpc.js b/server/api/mailTransferReport/mailTransferReport.rpc.js index 13a9127..7dddd7f 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 _0x7991=['MailTransferReport,\x20%s,\x20%s,\x20%s','stringify','error','code','MailTransferReport,\x20%s,\x20%s','message','result','util','moment','bluebird','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','client','http','request','info','request\x20sent','debug'];(function(_0x4997be,_0x2e102d){var _0x23e833=function(_0x15859e){while(--_0x15859e){_0x4997be['push'](_0x4997be['shift']());}};_0x23e833(++_0x2e102d);}(_0x7991,0x1d5));var _0x1799=function(_0x297597,_0x2b6df8){_0x297597=_0x297597-0x0;var _0x4c6424=_0x7991[_0x297597];return _0x4c6424;};'use strict';var _=require('lodash');var util=require(_0x1799('0x0'));var moment=require(_0x1799('0x1'));var BPromise=require(_0x1799('0x2'));var rs=require('randomstring');var fs=require('fs');var Redis=require(_0x1799('0x3'));var db=require(_0x1799('0x4'))['db'];var utils=require(_0x1799('0x5'));var logger=require(_0x1799('0x6'))(_0x1799('0x7'));var config=require(_0x1799('0x8'));var jayson=require('jayson/promise');var client=jayson[_0x1799('0x9')][_0x1799('0xa')]({'port':0x232a});function respondWithRpcPromise(_0x5a77cc,_0x5e0248,_0x33ae26){return new BPromise(function(_0x5e56c8,_0x21e973){return client[_0x1799('0xb')](_0x5a77cc,_0x33ae26)['then'](function(_0x48a0da){logger[_0x1799('0xc')]('MailTransferReport,\x20%s,\x20%s',_0x5e0248,_0x1799('0xd'));logger[_0x1799('0xe')](_0x1799('0xf'),_0x5e0248,_0x1799('0xd'),JSON[_0x1799('0x10')](_0x48a0da));if(_0x48a0da[_0x1799('0x11')]){if(_0x48a0da[_0x1799('0x11')][_0x1799('0x12')]===0x1f4){logger[_0x1799('0x11')](_0x1799('0x13'),_0x5e0248,_0x48a0da[_0x1799('0x11')][_0x1799('0x14')]);return _0x21e973(_0x48a0da[_0x1799('0x11')][_0x1799('0x14')]);}logger[_0x1799('0x11')](_0x1799('0x13'),_0x5e0248,_0x48a0da['error'][_0x1799('0x14')]);return _0x5e56c8(_0x48a0da[_0x1799('0x11')][_0x1799('0x14')]);}else{logger[_0x1799('0xc')](_0x1799('0x13'),_0x5e0248,'request\x20sent');_0x5e56c8(_0x48a0da[_0x1799('0x15')][_0x1799('0x14')]);}})['catch'](function(_0x7803b5){logger[_0x1799('0x11')](_0x1799('0x13'),_0x5e0248,_0x7803b5);_0x21e973(_0x7803b5);});});} \ No newline at end of file +var _0xde05=['info','MailTransferReport,\x20%s,\x20%s','request\x20sent','debug','MailTransferReport,\x20%s,\x20%s,\x20%s','stringify','error','code','message','util','moment','bluebird','randomstring','ioredis','../../config/logger','rpc','../../config/environment','jayson/promise','client','http','request'];(function(_0x47d1f5,_0x42c1a1){var _0x1b19a1=function(_0x5a9a4e){while(--_0x5a9a4e){_0x47d1f5['push'](_0x47d1f5['shift']());}};_0x1b19a1(++_0x42c1a1);}(_0xde05,0x87));var _0x5de0=function(_0x2291f4,_0x2a4330){_0x2291f4=_0x2291f4-0x0;var _0x2e4e8a=_0xde05[_0x2291f4];return _0x2e4e8a;};'use strict';var _=require('lodash');var util=require(_0x5de0('0x0'));var moment=require(_0x5de0('0x1'));var BPromise=require(_0x5de0('0x2'));var rs=require(_0x5de0('0x3'));var fs=require('fs');var Redis=require(_0x5de0('0x4'));var db=require('../../mysqldb')['db'];var utils=require('../../config/utils');var logger=require(_0x5de0('0x5'))(_0x5de0('0x6'));var config=require(_0x5de0('0x7'));var jayson=require(_0x5de0('0x8'));var client=jayson[_0x5de0('0x9')][_0x5de0('0xa')]({'port':0x232a});function respondWithRpcPromise(_0x361463,_0x338b84,_0x5b162f){return new BPromise(function(_0x24c56a,_0x3275d6){return client[_0x5de0('0xb')](_0x361463,_0x5b162f)['then'](function(_0x5821cb){logger[_0x5de0('0xc')](_0x5de0('0xd'),_0x338b84,_0x5de0('0xe'));logger[_0x5de0('0xf')](_0x5de0('0x10'),_0x338b84,'request\x20sent',JSON[_0x5de0('0x11')](_0x5821cb));if(_0x5821cb[_0x5de0('0x12')]){if(_0x5821cb[_0x5de0('0x12')][_0x5de0('0x13')]===0x1f4){logger[_0x5de0('0x12')](_0x5de0('0xd'),_0x338b84,_0x5821cb['error'][_0x5de0('0x14')]);return _0x3275d6(_0x5821cb[_0x5de0('0x12')]['message']);}logger[_0x5de0('0x12')]('MailTransferReport,\x20%s,\x20%s',_0x338b84,_0x5821cb[_0x5de0('0x12')]['message']);return _0x24c56a(_0x5821cb[_0x5de0('0x12')][_0x5de0('0x14')]);}else{logger['info']('MailTransferReport,\x20%s,\x20%s',_0x338b84,'request\x20sent');_0x24c56a(_0x5821cb['result']['message']);}})['catch'](function(_0x2acc99){logger[_0x5de0('0x12')](_0x5de0('0xd'),_0x338b84,_0x2acc99);_0x3275d6(_0x2acc99);});});} \ No newline at end of file diff --git a/server/api/memberReport/index.js b/server/api/memberReport/index.js index c9a2577..af4edff 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 _0x6847=['../../components/auth/service','../../components/interaction/service','../../config/environment','./memberReport.controller','get','isAuthenticated','index','/describe','show','create','/:id','delete','destroy','multer','path','connect-timeout','express','Router','fs-extra'];(function(_0x3166a4,_0x3e20b9){var _0x12f09f=function(_0x11387f){while(--_0x11387f){_0x3166a4['push'](_0x3166a4['shift']());}};_0x12f09f(++_0x3e20b9);}(_0x6847,0xde));var _0x7684=function(_0x21d0c3,_0x16c71c){_0x21d0c3=_0x21d0c3-0x0;var _0x4df18e=_0x6847[_0x21d0c3];return _0x4df18e;};'use strict';var multer=require(_0x7684('0x0'));var util=require('util');var path=require(_0x7684('0x1'));var timeout=require(_0x7684('0x2'));var express=require(_0x7684('0x3'));var router=express[_0x7684('0x4')]();var fs_extra=require(_0x7684('0x5'));var auth=require(_0x7684('0x6'));var interaction=require(_0x7684('0x7'));var config=require(_0x7684('0x8'));var controller=require(_0x7684('0x9'));router[_0x7684('0xa')]('/',auth[_0x7684('0xb')](),controller[_0x7684('0xc')]);router[_0x7684('0xa')](_0x7684('0xd'),auth['isAuthenticated'](),controller['describe']);router[_0x7684('0xa')]('/:id',auth[_0x7684('0xb')](),controller[_0x7684('0xe')]);router['post']('/',auth[_0x7684('0xb')](),controller[_0x7684('0xf')]);router['put'](_0x7684('0x10'),auth[_0x7684('0xb')](),controller['update']);router[_0x7684('0x11')](_0x7684('0x10'),auth[_0x7684('0xb')](),controller[_0x7684('0x12')]);module['exports']=router; \ No newline at end of file +var _0x8fc2=['destroy','exports','path','express','Router','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','./memberReport.controller','get','isAuthenticated','index','/describe','/:id','post','create','put','update'];(function(_0x349b5c,_0x55e5fa){var _0x3efcac=function(_0x27832d){while(--_0x27832d){_0x349b5c['push'](_0x349b5c['shift']());}};_0x3efcac(++_0x55e5fa);}(_0x8fc2,0x9a));var _0x28fc=function(_0x4d43fd,_0x224e59){_0x4d43fd=_0x4d43fd-0x0;var _0x11f50e=_0x8fc2[_0x4d43fd];return _0x11f50e;};'use strict';var multer=require('multer');var util=require('util');var path=require(_0x28fc('0x0'));var timeout=require('connect-timeout');var express=require(_0x28fc('0x1'));var router=express[_0x28fc('0x2')]();var fs_extra=require(_0x28fc('0x3'));var auth=require(_0x28fc('0x4'));var interaction=require(_0x28fc('0x5'));var config=require(_0x28fc('0x6'));var controller=require(_0x28fc('0x7'));router[_0x28fc('0x8')]('/',auth[_0x28fc('0x9')](),controller[_0x28fc('0xa')]);router['get'](_0x28fc('0xb'),auth[_0x28fc('0x9')](),controller['describe']);router[_0x28fc('0x8')](_0x28fc('0xc'),auth[_0x28fc('0x9')](),controller['show']);router[_0x28fc('0xd')]('/',auth[_0x28fc('0x9')](),controller[_0x28fc('0xe')]);router[_0x28fc('0xf')](_0x28fc('0xc'),auth[_0x28fc('0x9')](),controller[_0x28fc('0x10')]);router['delete'](_0x28fc('0xc'),auth[_0x28fc('0x9')](),controller[_0x28fc('0x11')]);module[_0x28fc('0x12')]=router; \ No newline at end of file diff --git a/server/api/memberReport/memberReport.attributes.js b/server/api/memberReport/memberReport.attributes.js index 3e692ae..5bcfd4d 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 _0x9b2a=['DATE','getDataValue','enterAt','seconds','setDataValue','exitAt','duration','talk:[dial\x20string]','INTEGER','sequelize','exports','STRING','DEFAULT\x20PAUSE'];(function(_0x56bc37,_0x5df7af){var _0x5f03fb=function(_0x582b5b){while(--_0x582b5b){_0x56bc37['push'](_0x56bc37['shift']());}};_0x5f03fb(++_0x5df7af);}(_0x9b2a,0x127));var _0xa9b2=function(_0x2eb685,_0x4b8046){_0x2eb685=_0x2eb685-0x0;var _0x3bcb80=_0x9b2a[_0x2eb685];return _0x3bcb80;};'use strict';var Sequelize=require(_0xa9b2('0x0'));var moment=require('moment');module[_0xa9b2('0x1')]={'channel':{'type':Sequelize[_0xa9b2('0x2')]},'membername':{'type':Sequelize[_0xa9b2('0x2')]},'interface':{'type':Sequelize['STRING']},'type':{'type':Sequelize[_0xa9b2('0x2')],'defaultValue':_0xa9b2('0x3'),'comment':'LOGIN,\x20PAUSE,\x20TALKING'},'duration':{'type':Sequelize['INTEGER']},'enterAt':{'type':Sequelize[_0xa9b2('0x4')]},'exitAt':{'type':Sequelize[_0xa9b2('0x4')],'set':function(_0x181a8f){var _0xd7801e=moment(_0x181a8f);var _0x558267=moment(this[_0xa9b2('0x5')](_0xa9b2('0x6')));var _0x2d2560=_0xd7801e['diff'](_0x558267,_0xa9b2('0x7'));this[_0xa9b2('0x8')](_0xa9b2('0x9'),_0x181a8f);this[_0xa9b2('0x8')](_0xa9b2('0xa'),_0x2d2560>=0x0?_0x2d2560:null);}},'data1':{'type':Sequelize[_0xa9b2('0x2')],'comment':'talk:[inbound,\x20outbound],\x20pause:[reason]'},'data2':{'type':Sequelize[_0xa9b2('0x2')],'comment':'talk:[start]'},'data3':{'type':Sequelize['STRING'],'comment':'talk:[destination]'},'data4':{'type':Sequelize[_0xa9b2('0x2')],'comment':_0xa9b2('0xb')},'data5':{'type':Sequelize[_0xa9b2('0x2')],'comment':'talk:[queue]'},'role':{'type':Sequelize['STRING']},'internal':{'type':Sequelize[_0xa9b2('0xc')]},'uniqueid':{'type':Sequelize['STRING']}}; \ No newline at end of file +var _0x032a=['moment','STRING','DEFAULT\x20PAUSE','LOGIN,\x20PAUSE,\x20TALKING','INTEGER','DATE','enterAt','seconds','exitAt','setDataValue','duration','talk:[inbound,\x20outbound],\x20pause:[reason]','talk:[start]','talk:[dial\x20string]','talk:[queue]'];(function(_0x122817,_0x36c505){var _0x3822b3=function(_0x17def6){while(--_0x17def6){_0x122817['push'](_0x122817['shift']());}};_0x3822b3(++_0x36c505);}(_0x032a,0xf0));var _0xa032=function(_0x2ecdbe,_0x114206){_0x2ecdbe=_0x2ecdbe-0x0;var _0x44d6d4=_0x032a[_0x2ecdbe];return _0x44d6d4;};'use strict';var Sequelize=require('sequelize');var moment=require(_0xa032('0x0'));module['exports']={'channel':{'type':Sequelize[_0xa032('0x1')]},'membername':{'type':Sequelize[_0xa032('0x1')]},'interface':{'type':Sequelize[_0xa032('0x1')]},'type':{'type':Sequelize[_0xa032('0x1')],'defaultValue':_0xa032('0x2'),'comment':_0xa032('0x3')},'duration':{'type':Sequelize[_0xa032('0x4')]},'enterAt':{'type':Sequelize[_0xa032('0x5')]},'exitAt':{'type':Sequelize[_0xa032('0x5')],'set':function(_0x2b1445){var _0x43d0f5=moment(_0x2b1445);var _0x40128a=moment(this['getDataValue'](_0xa032('0x6')));var _0x4a5d8e=_0x43d0f5['diff'](_0x40128a,_0xa032('0x7'));this['setDataValue'](_0xa032('0x8'),_0x2b1445);this[_0xa032('0x9')](_0xa032('0xa'),_0x4a5d8e>=0x0?_0x4a5d8e:null);}},'data1':{'type':Sequelize[_0xa032('0x1')],'comment':_0xa032('0xb')},'data2':{'type':Sequelize['STRING'],'comment':_0xa032('0xc')},'data3':{'type':Sequelize[_0xa032('0x1')],'comment':'talk:[destination]'},'data4':{'type':Sequelize[_0xa032('0x1')],'comment':_0xa032('0xd')},'data5':{'type':Sequelize[_0xa032('0x1')],'comment':_0xa032('0xe')},'role':{'type':Sequelize[_0xa032('0x1')]},'internal':{'type':Sequelize['INTEGER']},'uniqueid':{'type':Sequelize[_0xa032('0x1')]}}; \ No newline at end of file diff --git a/server/api/memberReport/memberReport.controller.js b/server/api/memberReport/memberReport.controller.js index 82a8a4e..39a50d8 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 _0x7217=['query','filters','intersection','attributes','fields','hasOwnProperty','nolimit','sort','where','pick','merge','filter','includeAll','include','rows','catch','show','params','rawAttributes','length','find','create','body','describe','eml-format','zip-dir','fast-json-patch','request-promise','moment','bluebird','path','sox','to-csv','ejs','fs-extra','lodash','squel','crypto','jsforce','desk.js','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','status','end','json','offset','undefined','limit','count','set','Content-Range','apply','reject','save','update','then','destroy','sendStatus','stack','send','index','map','MemberReport','fieldName','type','model','name','keys'];(function(_0x5ef0da,_0x2b96e6){var _0xf6d3aa=function(_0x46b1ca){while(--_0x46b1ca){_0x5ef0da['push'](_0x5ef0da['shift']());}};_0xf6d3aa(++_0x2b96e6);}(_0x7217,0x19e));var _0x7721=function(_0x4b7b62,_0x4920a9){_0x4b7b62=_0x4b7b62-0x0;var _0x2280df=_0x7217[_0x4b7b62];return _0x2280df;};'use strict';var emlformat=require(_0x7721('0x0'));var rimraf=require('rimraf');var zipdir=require(_0x7721('0x1'));var jsonpatch=require(_0x7721('0x2'));var rp=require(_0x7721('0x3'));var moment=require(_0x7721('0x4'));var BPromise=require(_0x7721('0x5'));var Mustache=require('mustache');var util=require('util');var path=require(_0x7721('0x6'));var sox=require(_0x7721('0x7'));var csv=require(_0x7721('0x8'));var ejs=require(_0x7721('0x9'));var fs=require('fs');var fs_extra=require(_0x7721('0xa'));var _=require(_0x7721('0xb'));var squel=require(_0x7721('0xc'));var crypto=require(_0x7721('0xd'));var jsforce=require(_0x7721('0xe'));var deskjs=require(_0x7721('0xf'));var toCsv=require(_0x7721('0x8'));var querystring=require(_0x7721('0x10'));var Papa=require(_0x7721('0x11'));var Redis=require(_0x7721('0x12'));var authService=require(_0x7721('0x13'));var qs=require('../../components/parsers/qs');var as=require(_0x7721('0x14'));var hardwareService=require(_0x7721('0x15'));var logger=require(_0x7721('0x16'))(_0x7721('0x17'));var utils=require(_0x7721('0x18'));var config=require(_0x7721('0x19'));var licenseUtil=require(_0x7721('0x1a'));var db=require(_0x7721('0x1b'))['db'];function respondWithStatusCode(_0x55b4ca,_0x2911ec){_0x2911ec=_0x2911ec||0xcc;return function(_0x199930){if(_0x199930){return _0x55b4ca['sendStatus'](_0x2911ec);}return _0x55b4ca[_0x7721('0x1c')](_0x2911ec)[_0x7721('0x1d')]();};}function respondWithResult(_0x3f01c5,_0x2e9752){_0x2e9752=_0x2e9752||0xc8;return function(_0x5069da){if(_0x5069da){return _0x3f01c5[_0x7721('0x1c')](_0x2e9752)[_0x7721('0x1e')](_0x5069da);}};}function respondWithFilteredResult(_0x534f1b,_0x4e199a){return function(_0x4b183e){if(_0x4b183e){var _0x5ed54=typeof _0x4e199a[_0x7721('0x1f')]===_0x7721('0x20')&&typeof _0x4e199a[_0x7721('0x21')]==='undefined';var _0x20f669=_0x4b183e['count'];var _0x3fc09e=_0x5ed54?0x0:_0x4e199a['offset'];var _0xfec626=_0x5ed54?_0x4b183e[_0x7721('0x22')]:_0x4e199a[_0x7721('0x1f')]+_0x4e199a[_0x7721('0x21')];var _0x2286e5;if(_0xfec626>=_0x20f669){_0xfec626=_0x20f669;_0x2286e5=0xc8;}else{_0x2286e5=0xce;}_0x534f1b[_0x7721('0x1c')](_0x2286e5);return _0x534f1b[_0x7721('0x23')](_0x7721('0x24'),_0x3fc09e+'-'+_0xfec626+'/'+_0x20f669)[_0x7721('0x1e')](_0x4b183e);}return null;};}function patchUpdates(_0xaeccc4){return function(_0x4ce1db){try{jsonpatch[_0x7721('0x25')](_0x4ce1db,_0xaeccc4,!![]);}catch(_0x2c1583){return BPromise[_0x7721('0x26')](_0x2c1583);}return _0x4ce1db[_0x7721('0x27')]();};}function saveUpdates(_0x57140c,_0x28f5a6){return function(_0x512f31){if(_0x512f31){return _0x512f31[_0x7721('0x28')](_0x57140c)[_0x7721('0x29')](function(_0x3e8a4e){return _0x3e8a4e;});}return null;};}function removeEntity(_0x1caad8,_0x121cc4){return function(_0x395b15){if(_0x395b15){return _0x395b15[_0x7721('0x2a')]()['then'](function(){_0x1caad8[_0x7721('0x1c')](0xcc)[_0x7721('0x1d')]();});}};}function handleEntityNotFound(_0x125564,_0x1f67c7){return function(_0x40d550){if(!_0x40d550){_0x125564[_0x7721('0x2b')](0x194);}return _0x40d550;};}function handleError(_0x424e05,_0xf753f1){_0xf753f1=_0xf753f1||0x1f4;return function(_0x40f367){logger['error'](_0x40f367[_0x7721('0x2c')]);if(_0x40f367['name']){delete _0x40f367['name'];}_0x424e05[_0x7721('0x1c')](_0xf753f1)[_0x7721('0x2d')](_0x40f367);};}exports[_0x7721('0x2e')]=function(_0x158d98,_0x1ea4d){var _0x37b9f0={},_0xd7d703={},_0x1da2d8={'count':0x0,'rows':[]};var _0x5c54f0=_[_0x7721('0x2f')](db[_0x7721('0x30')]['rawAttributes'],function(_0x4a25c9){return{'name':_0x4a25c9[_0x7721('0x31')],'type':_0x4a25c9[_0x7721('0x32')]['key']};});_0xd7d703[_0x7721('0x33')]=_[_0x7721('0x2f')](_0x5c54f0,_0x7721('0x34'));_0xd7d703['query']=_[_0x7721('0x35')](_0x158d98[_0x7721('0x36')]);_0xd7d703[_0x7721('0x37')]=_[_0x7721('0x38')](_0xd7d703[_0x7721('0x33')],_0xd7d703['query']);_0x37b9f0[_0x7721('0x39')]=_[_0x7721('0x38')](_0xd7d703[_0x7721('0x33')],qs['fields'](_0x158d98[_0x7721('0x36')][_0x7721('0x3a')]));_0x37b9f0['attributes']=_0x37b9f0[_0x7721('0x39')]['length']?_0x37b9f0[_0x7721('0x39')]:_0xd7d703[_0x7721('0x33')];if(!_0x158d98[_0x7721('0x36')][_0x7721('0x3b')](_0x7721('0x3c'))){_0x37b9f0[_0x7721('0x21')]=qs[_0x7721('0x21')](_0x158d98[_0x7721('0x36')][_0x7721('0x21')]);_0x37b9f0[_0x7721('0x1f')]=qs[_0x7721('0x1f')](_0x158d98['query'][_0x7721('0x1f')]);}_0x37b9f0['order']=qs[_0x7721('0x3d')](_0x158d98[_0x7721('0x36')][_0x7721('0x3d')]);_0x37b9f0[_0x7721('0x3e')]=qs[_0x7721('0x37')](_[_0x7721('0x3f')](_0x158d98['query'],_0xd7d703['filters']),_0x5c54f0);if(_0x158d98['query']['filter']){_0x37b9f0[_0x7721('0x3e')]=_[_0x7721('0x40')](_0x37b9f0[_0x7721('0x3e')],{'$or':_[_0x7721('0x2f')](_0x5c54f0,function(_0x4a90ce){if(_0x4a90ce[_0x7721('0x32')]!=='VIRTUAL'){var _0xfab37b={};_0xfab37b[_0x4a90ce[_0x7721('0x34')]]={'$like':'%'+_0x158d98['query'][_0x7721('0x41')]+'%'};return _0xfab37b;}})});}_0x37b9f0=_[_0x7721('0x40')]({},_0x37b9f0,_0x158d98['options']);var _0x4d0111={'where':_0x37b9f0[_0x7721('0x3e')]};return db[_0x7721('0x30')][_0x7721('0x22')](_0x4d0111)[_0x7721('0x29')](function(_0x577af9){_0x1da2d8[_0x7721('0x22')]=_0x577af9;if(_0x158d98[_0x7721('0x36')][_0x7721('0x42')]){_0x37b9f0[_0x7721('0x43')]=[{'all':!![]}];}return db[_0x7721('0x30')]['findAll'](_0x37b9f0);})[_0x7721('0x29')](function(_0x4a2c28){_0x1da2d8[_0x7721('0x44')]=_0x4a2c28;return _0x1da2d8;})['then'](respondWithFilteredResult(_0x1ea4d,_0x37b9f0))[_0x7721('0x45')](handleError(_0x1ea4d,null));};exports[_0x7721('0x46')]=function(_0x231dad,_0x49e0c5){var _0x1453d4={'raw':!![],'where':{'id':_0x231dad[_0x7721('0x47')]['id']}},_0x11d853={};_0x11d853['model']=_[_0x7721('0x35')](db[_0x7721('0x30')][_0x7721('0x48')]);_0x11d853[_0x7721('0x36')]=_[_0x7721('0x35')](_0x231dad[_0x7721('0x36')]);_0x11d853[_0x7721('0x37')]=_['intersection'](_0x11d853['model'],_0x11d853[_0x7721('0x36')]);_0x1453d4[_0x7721('0x39')]=_[_0x7721('0x38')](_0x11d853[_0x7721('0x33')],qs[_0x7721('0x3a')](_0x231dad[_0x7721('0x36')][_0x7721('0x3a')]));_0x1453d4[_0x7721('0x39')]=_0x1453d4[_0x7721('0x39')][_0x7721('0x49')]?_0x1453d4['attributes']:_0x11d853['model'];if(_0x231dad[_0x7721('0x36')][_0x7721('0x42')]){_0x1453d4[_0x7721('0x43')]=[{'all':!![]}];}_0x1453d4=_[_0x7721('0x40')]({},_0x1453d4,_0x231dad['options']);return db[_0x7721('0x30')][_0x7721('0x4a')](_0x1453d4)['then'](handleEntityNotFound(_0x49e0c5,null))[_0x7721('0x29')](respondWithResult(_0x49e0c5,null))['catch'](handleError(_0x49e0c5,null));};exports[_0x7721('0x4b')]=function(_0x5c6922,_0x334f23){return db[_0x7721('0x30')][_0x7721('0x4b')](_0x5c6922['body'],{})[_0x7721('0x29')](respondWithResult(_0x334f23,0xc9))[_0x7721('0x45')](handleError(_0x334f23,null));};exports['update']=function(_0x223d93,_0x1196c2){if(_0x223d93[_0x7721('0x4c')]['id']){delete _0x223d93['body']['id'];}return db[_0x7721('0x30')]['find']({'where':{'id':_0x223d93[_0x7721('0x47')]['id']}})[_0x7721('0x29')](handleEntityNotFound(_0x1196c2,null))[_0x7721('0x29')](saveUpdates(_0x223d93[_0x7721('0x4c')],null))[_0x7721('0x29')](respondWithResult(_0x1196c2,null))[_0x7721('0x45')](handleError(_0x1196c2,null));};exports[_0x7721('0x2a')]=function(_0x7fbb73,_0x694d2f){return db[_0x7721('0x30')][_0x7721('0x4a')]({'where':{'id':_0x7fbb73[_0x7721('0x47')]['id']}})[_0x7721('0x29')](handleEntityNotFound(_0x694d2f,null))[_0x7721('0x29')](removeEntity(_0x694d2f,null))[_0x7721('0x45')](handleError(_0x694d2f,null));};exports['describe']=function(_0x474f32,_0x2f6f30){return db[_0x7721('0x30')][_0x7721('0x4d')]()[_0x7721('0x29')](respondWithResult(_0x2f6f30,null))[_0x7721('0x45')](handleError(_0x2f6f30,null));}; \ No newline at end of file +var _0xedd9=['keys','filters','intersection','attributes','fields','length','hasOwnProperty','nolimit','order','sort','where','pick','filter','merge','VIRTUAL','options','includeAll','include','findAll','catch','params','find','create','body','update','destroy','describe','rimraf','zip-dir','fast-json-patch','request-promise','moment','bluebird','mustache','util','sox','to-csv','ejs','fs-extra','squel','jsforce','desk.js','querystring','ioredis','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/logger','api','../../config/environment','../../config/license/util','../../mysqldb','sendStatus','status','json','offset','undefined','limit','count','set','apply','then','end','error','stack','send','index','map','MemberReport','rawAttributes','fieldName','type','key','model','name','query'];(function(_0xa1e3e3,_0x29fe0e){var _0xc980e9=function(_0x1f5adc){while(--_0x1f5adc){_0xa1e3e3['push'](_0xa1e3e3['shift']());}};_0xc980e9(++_0x29fe0e);}(_0xedd9,0xfc));var _0x9edd=function(_0x53f587,_0x104532){_0x53f587=_0x53f587-0x0;var _0x16f2de=_0xedd9[_0x53f587];return _0x16f2de;};'use strict';var emlformat=require('eml-format');var rimraf=require(_0x9edd('0x0'));var zipdir=require(_0x9edd('0x1'));var jsonpatch=require(_0x9edd('0x2'));var rp=require(_0x9edd('0x3'));var moment=require(_0x9edd('0x4'));var BPromise=require(_0x9edd('0x5'));var Mustache=require(_0x9edd('0x6'));var util=require(_0x9edd('0x7'));var path=require('path');var sox=require(_0x9edd('0x8'));var csv=require(_0x9edd('0x9'));var ejs=require(_0x9edd('0xa'));var fs=require('fs');var fs_extra=require(_0x9edd('0xb'));var _=require('lodash');var squel=require(_0x9edd('0xc'));var crypto=require('crypto');var jsforce=require(_0x9edd('0xd'));var deskjs=require(_0x9edd('0xe'));var toCsv=require(_0x9edd('0x9'));var querystring=require(_0x9edd('0xf'));var Papa=require('papaparse');var Redis=require(_0x9edd('0x10'));var authService=require('../../components/auth/service');var qs=require(_0x9edd('0x11'));var as=require(_0x9edd('0x12'));var hardwareService=require('../../config/license/hardware');var logger=require(_0x9edd('0x13'))(_0x9edd('0x14'));var utils=require('../../config/utils');var config=require(_0x9edd('0x15'));var licenseUtil=require(_0x9edd('0x16'));var db=require(_0x9edd('0x17'))['db'];function respondWithStatusCode(_0xfd544a,_0x287ddd){_0x287ddd=_0x287ddd||0xcc;return function(_0x3a7b84){if(_0x3a7b84){return _0xfd544a[_0x9edd('0x18')](_0x287ddd);}return _0xfd544a[_0x9edd('0x19')](_0x287ddd)['end']();};}function respondWithResult(_0x176bfa,_0x44fc7c){_0x44fc7c=_0x44fc7c||0xc8;return function(_0x891832){if(_0x891832){return _0x176bfa[_0x9edd('0x19')](_0x44fc7c)[_0x9edd('0x1a')](_0x891832);}};}function respondWithFilteredResult(_0x338f3c,_0x1042aa){return function(_0x75a4ab){if(_0x75a4ab){var _0x4ea60f=typeof _0x1042aa[_0x9edd('0x1b')]===_0x9edd('0x1c')&&typeof _0x1042aa[_0x9edd('0x1d')]==='undefined';var _0x1b54c0=_0x75a4ab[_0x9edd('0x1e')];var _0x40ba32=_0x4ea60f?0x0:_0x1042aa['offset'];var _0x43dc70=_0x4ea60f?_0x75a4ab['count']:_0x1042aa[_0x9edd('0x1b')]+_0x1042aa[_0x9edd('0x1d')];var _0x4bdb88;if(_0x43dc70>=_0x1b54c0){_0x43dc70=_0x1b54c0;_0x4bdb88=0xc8;}else{_0x4bdb88=0xce;}_0x338f3c['status'](_0x4bdb88);return _0x338f3c[_0x9edd('0x1f')]('Content-Range',_0x40ba32+'-'+_0x43dc70+'/'+_0x1b54c0)[_0x9edd('0x1a')](_0x75a4ab);}return null;};}function patchUpdates(_0x54a03f){return function(_0x535f37){try{jsonpatch[_0x9edd('0x20')](_0x535f37,_0x54a03f,!![]);}catch(_0x1c46a8){return BPromise['reject'](_0x1c46a8);}return _0x535f37['save']();};}function saveUpdates(_0x341d67,_0x186186){return function(_0x477878){if(_0x477878){return _0x477878['update'](_0x341d67)[_0x9edd('0x21')](function(_0x1dca43){return _0x1dca43;});}return null;};}function removeEntity(_0x44a6c1,_0x2ca65f){return function(_0x339a0d){if(_0x339a0d){return _0x339a0d['destroy']()[_0x9edd('0x21')](function(){_0x44a6c1[_0x9edd('0x19')](0xcc)[_0x9edd('0x22')]();});}};}function handleEntityNotFound(_0x2f9f86,_0x310a4d){return function(_0x4d507f){if(!_0x4d507f){_0x2f9f86['sendStatus'](0x194);}return _0x4d507f;};}function handleError(_0x3276ee,_0xfeca7b){_0xfeca7b=_0xfeca7b||0x1f4;return function(_0x8d67aa){logger[_0x9edd('0x23')](_0x8d67aa[_0x9edd('0x24')]);if(_0x8d67aa['name']){delete _0x8d67aa['name'];}_0x3276ee[_0x9edd('0x19')](_0xfeca7b)[_0x9edd('0x25')](_0x8d67aa);};}exports[_0x9edd('0x26')]=function(_0x52746a,_0x238b22){var _0x28cfae={},_0x2ae8dd={},_0x41af53={'count':0x0,'rows':[]};var _0x5eccfb=_[_0x9edd('0x27')](db[_0x9edd('0x28')][_0x9edd('0x29')],function(_0x12c1bc){return{'name':_0x12c1bc[_0x9edd('0x2a')],'type':_0x12c1bc[_0x9edd('0x2b')][_0x9edd('0x2c')]};});_0x2ae8dd[_0x9edd('0x2d')]=_[_0x9edd('0x27')](_0x5eccfb,_0x9edd('0x2e'));_0x2ae8dd[_0x9edd('0x2f')]=_[_0x9edd('0x30')](_0x52746a[_0x9edd('0x2f')]);_0x2ae8dd[_0x9edd('0x31')]=_[_0x9edd('0x32')](_0x2ae8dd['model'],_0x2ae8dd[_0x9edd('0x2f')]);_0x28cfae[_0x9edd('0x33')]=_[_0x9edd('0x32')](_0x2ae8dd['model'],qs[_0x9edd('0x34')](_0x52746a[_0x9edd('0x2f')][_0x9edd('0x34')]));_0x28cfae[_0x9edd('0x33')]=_0x28cfae[_0x9edd('0x33')][_0x9edd('0x35')]?_0x28cfae[_0x9edd('0x33')]:_0x2ae8dd[_0x9edd('0x2d')];if(!_0x52746a[_0x9edd('0x2f')][_0x9edd('0x36')](_0x9edd('0x37'))){_0x28cfae[_0x9edd('0x1d')]=qs[_0x9edd('0x1d')](_0x52746a[_0x9edd('0x2f')]['limit']);_0x28cfae[_0x9edd('0x1b')]=qs['offset'](_0x52746a[_0x9edd('0x2f')][_0x9edd('0x1b')]);}_0x28cfae[_0x9edd('0x38')]=qs[_0x9edd('0x39')](_0x52746a[_0x9edd('0x2f')]['sort']);_0x28cfae[_0x9edd('0x3a')]=qs[_0x9edd('0x31')](_[_0x9edd('0x3b')](_0x52746a[_0x9edd('0x2f')],_0x2ae8dd[_0x9edd('0x31')]),_0x5eccfb);if(_0x52746a[_0x9edd('0x2f')][_0x9edd('0x3c')]){_0x28cfae[_0x9edd('0x3a')]=_[_0x9edd('0x3d')](_0x28cfae[_0x9edd('0x3a')],{'$or':_['map'](_0x5eccfb,function(_0x231604){if(_0x231604['type']!==_0x9edd('0x3e')){var _0x5658d6={};_0x5658d6[_0x231604[_0x9edd('0x2e')]]={'$like':'%'+_0x52746a[_0x9edd('0x2f')][_0x9edd('0x3c')]+'%'};return _0x5658d6;}})});}_0x28cfae=_['merge']({},_0x28cfae,_0x52746a[_0x9edd('0x3f')]);var _0xcbd0ef={'where':_0x28cfae[_0x9edd('0x3a')]};return db['MemberReport'][_0x9edd('0x1e')](_0xcbd0ef)['then'](function(_0x1fc4fb){_0x41af53[_0x9edd('0x1e')]=_0x1fc4fb;if(_0x52746a['query'][_0x9edd('0x40')]){_0x28cfae[_0x9edd('0x41')]=[{'all':!![]}];}return db[_0x9edd('0x28')][_0x9edd('0x42')](_0x28cfae);})['then'](function(_0x449f01){_0x41af53['rows']=_0x449f01;return _0x41af53;})[_0x9edd('0x21')](respondWithFilteredResult(_0x238b22,_0x28cfae))[_0x9edd('0x43')](handleError(_0x238b22,null));};exports['show']=function(_0x318757,_0x49a128){var _0x548299={'raw':!![],'where':{'id':_0x318757[_0x9edd('0x44')]['id']}},_0x369b69={};_0x369b69[_0x9edd('0x2d')]=_[_0x9edd('0x30')](db[_0x9edd('0x28')][_0x9edd('0x29')]);_0x369b69[_0x9edd('0x2f')]=_[_0x9edd('0x30')](_0x318757[_0x9edd('0x2f')]);_0x369b69[_0x9edd('0x31')]=_[_0x9edd('0x32')](_0x369b69[_0x9edd('0x2d')],_0x369b69[_0x9edd('0x2f')]);_0x548299[_0x9edd('0x33')]=_[_0x9edd('0x32')](_0x369b69['model'],qs[_0x9edd('0x34')](_0x318757[_0x9edd('0x2f')][_0x9edd('0x34')]));_0x548299[_0x9edd('0x33')]=_0x548299[_0x9edd('0x33')][_0x9edd('0x35')]?_0x548299[_0x9edd('0x33')]:_0x369b69['model'];if(_0x318757['query']['includeAll']){_0x548299[_0x9edd('0x41')]=[{'all':!![]}];}_0x548299=_['merge']({},_0x548299,_0x318757[_0x9edd('0x3f')]);return db[_0x9edd('0x28')][_0x9edd('0x45')](_0x548299)[_0x9edd('0x21')](handleEntityNotFound(_0x49a128,null))[_0x9edd('0x21')](respondWithResult(_0x49a128,null))['catch'](handleError(_0x49a128,null));};exports[_0x9edd('0x46')]=function(_0x35e63c,_0x40e33d){return db['MemberReport'][_0x9edd('0x46')](_0x35e63c[_0x9edd('0x47')],{})[_0x9edd('0x21')](respondWithResult(_0x40e33d,0xc9))[_0x9edd('0x43')](handleError(_0x40e33d,null));};exports[_0x9edd('0x48')]=function(_0x35bdec,_0x4d4f33){if(_0x35bdec[_0x9edd('0x47')]['id']){delete _0x35bdec[_0x9edd('0x47')]['id'];}return db['MemberReport'][_0x9edd('0x45')]({'where':{'id':_0x35bdec[_0x9edd('0x44')]['id']}})['then'](handleEntityNotFound(_0x4d4f33,null))[_0x9edd('0x21')](saveUpdates(_0x35bdec[_0x9edd('0x47')],null))[_0x9edd('0x21')](respondWithResult(_0x4d4f33,null))['catch'](handleError(_0x4d4f33,null));};exports[_0x9edd('0x49')]=function(_0x151157,_0x317a60){return db[_0x9edd('0x28')]['find']({'where':{'id':_0x151157[_0x9edd('0x44')]['id']}})[_0x9edd('0x21')](handleEntityNotFound(_0x317a60,null))[_0x9edd('0x21')](removeEntity(_0x317a60,null))['catch'](handleError(_0x317a60,null));};exports[_0x9edd('0x4a')]=function(_0x21f6ce,_0x57db43){return db[_0x9edd('0x28')]['describe']()[_0x9edd('0x21')](respondWithResult(_0x57db43,null))[_0x9edd('0x43')](handleError(_0x57db43,null));}; \ No newline at end of file diff --git a/server/api/memberReport/memberReport.model.js b/server/api/memberReport/memberReport.model.js index 95f833b..1a85ca0 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 _0x0218=['moment','bluebird','request-promise','path','rimraf','exports','define','report_member','membername_interface','interface','lodash','util','../../config/logger'];(function(_0x2b7d39,_0x54fa9f){var _0x4950f3=function(_0x4573e4){while(--_0x4573e4){_0x2b7d39['push'](_0x2b7d39['shift']());}};_0x4950f3(++_0x54fa9f);}(_0x0218,0x1aa));var _0x8021=function(_0x300e14,_0x11fbce){_0x300e14=_0x300e14-0x0;var _0x25cbe0=_0x0218[_0x300e14];return _0x25cbe0;};'use strict';var _=require(_0x8021('0x0'));var util=require(_0x8021('0x1'));var logger=require(_0x8021('0x2'))('api');var moment=require(_0x8021('0x3'));var BPromise=require(_0x8021('0x4'));var rp=require(_0x8021('0x5'));var fs=require('fs');var path=require(_0x8021('0x6'));var rimraf=require(_0x8021('0x7'));var config=require('../../config/environment');var attributes=require('./memberReport.attributes');module[_0x8021('0x8')]=function(_0x3d39e1,_0x37b100){return _0x3d39e1[_0x8021('0x9')]('MemberReport',attributes,{'tableName':_0x8021('0xa'),'paranoid':![],'indexes':[{'name':_0x8021('0xb'),'fields':['membername',_0x8021('0xc')]}],'timestamps':!![]});}; \ No newline at end of file +var _0x038f=['rimraf','../../config/environment','./memberReport.attributes','exports','define','MemberReport','report_member','membername_interface','interface','util','../../config/logger','bluebird'];(function(_0x20da10,_0x5d3c32){var _0x5a2145=function(_0x2c4ffa){while(--_0x2c4ffa){_0x20da10['push'](_0x20da10['shift']());}};_0x5a2145(++_0x5d3c32);}(_0x038f,0xe1));var _0xf038=function(_0x4f0c2b,_0x2c9d14){_0x4f0c2b=_0x4f0c2b-0x0;var _0x526436=_0x038f[_0x4f0c2b];return _0x526436;};'use strict';var _=require('lodash');var util=require(_0xf038('0x0'));var logger=require(_0xf038('0x1'))('api');var moment=require('moment');var BPromise=require(_0xf038('0x2'));var rp=require('request-promise');var fs=require('fs');var path=require('path');var rimraf=require(_0xf038('0x3'));var config=require(_0xf038('0x4'));var attributes=require(_0xf038('0x5'));module[_0xf038('0x6')]=function(_0x385807,_0x318408){return _0x385807[_0xf038('0x7')](_0xf038('0x8'),attributes,{'tableName':_0xf038('0x9'),'paranoid':![],'indexes':[{'name':_0xf038('0xa'),'fields':['membername',_0xf038('0xb')]}],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/memberReport/memberReport.rpc.js b/server/api/memberReport/memberReport.rpc.js index 6b83544..edbb301 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 _0x3e24=['GetMemberReport','MemberReport','options','where','attributes','limit','map','include','model','debug','stringify','CreateMemberReport','create','body','raw','update','UpdateMemberReport','lodash','util','moment','bluebird','randomstring','../../mysqldb','../../config/utils','rpc','../../config/environment','jayson/promise','client','http','then','MemberReport,\x20%s,\x20%s','request\x20sent','MemberReport,\x20%s,\x20%s,\x20%s','error','code','message','info','catch'];(function(_0x1378bc,_0xf96dd6){var _0x28680b=function(_0xddf189){while(--_0xddf189){_0x1378bc['push'](_0x1378bc['shift']());}};_0x28680b(++_0xf96dd6);}(_0x3e24,0x167));var _0x43e2=function(_0x2feb53,_0x264ef7){_0x2feb53=_0x2feb53-0x0;var _0x5700ee=_0x3e24[_0x2feb53];return _0x5700ee;};'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});function respondWithRpcPromise(_0x121e2e,_0x23b2d8,_0x59956d){return new BPromise(function(_0xb75b,_0x2357bc){return client['request'](_0x121e2e,_0x59956d)[_0x43e2('0xc')](function(_0x2fdf85){logger['info'](_0x43e2('0xd'),_0x23b2d8,_0x43e2('0xe'));logger['debug'](_0x43e2('0xf'),_0x23b2d8,'request\x20sent',JSON['stringify'](_0x2fdf85));if(_0x2fdf85['error']){if(_0x2fdf85[_0x43e2('0x10')][_0x43e2('0x11')]===0x1f4){logger[_0x43e2('0x10')](_0x43e2('0xd'),_0x23b2d8,_0x2fdf85[_0x43e2('0x10')][_0x43e2('0x12')]);return _0x2357bc(_0x2fdf85[_0x43e2('0x10')][_0x43e2('0x12')]);}logger[_0x43e2('0x10')](_0x43e2('0xd'),_0x23b2d8,_0x2fdf85[_0x43e2('0x10')][_0x43e2('0x12')]);return _0xb75b(_0x2fdf85['error'][_0x43e2('0x12')]);}else{logger[_0x43e2('0x13')](_0x43e2('0xd'),_0x23b2d8,_0x43e2('0xe'));_0xb75b(_0x2fdf85['result']['message']);}})[_0x43e2('0x14')](function(_0x417ce5){logger[_0x43e2('0x10')](_0x43e2('0xd'),_0x23b2d8,_0x417ce5);_0x2357bc(_0x417ce5);});});}exports[_0x43e2('0x15')]=function(_0x1b7cde){var _0x3ea010=this;return new Promise(function(_0x15ecb5,_0x3236b9){return db[_0x43e2('0x16')]['findAll']({'raw':_0x1b7cde[_0x43e2('0x17')]?_0x1b7cde[_0x43e2('0x17')]['raw']===undefined?!![]:![]:!![],'where':_0x1b7cde[_0x43e2('0x17')]?_0x1b7cde['options'][_0x43e2('0x18')]||null:null,'attributes':_0x1b7cde[_0x43e2('0x17')]?_0x1b7cde[_0x43e2('0x17')][_0x43e2('0x19')]||null:null,'limit':_0x1b7cde[_0x43e2('0x17')]?_0x1b7cde['options'][_0x43e2('0x1a')]||null:null,'include':_0x1b7cde[_0x43e2('0x17')]?_0x1b7cde[_0x43e2('0x17')]['include']?_[_0x43e2('0x1b')](_0x1b7cde[_0x43e2('0x17')][_0x43e2('0x1c')],function(_0x11b285){return{'model':db[_0x11b285['model']],'as':_0x11b285['as'],'attributes':_0x11b285[_0x43e2('0x19')],'include':_0x11b285[_0x43e2('0x1c')]?_[_0x43e2('0x1b')](_0x11b285[_0x43e2('0x1c')],function(_0x178223){return{'model':db[_0x178223[_0x43e2('0x1d')]],'as':_0x178223['as'],'attributes':_0x178223[_0x43e2('0x19')],'include':_0x178223[_0x43e2('0x1c')]?_[_0x43e2('0x1b')](_0x178223[_0x43e2('0x1c')],function(_0x1ea844){return{'model':db[_0x1ea844[_0x43e2('0x1d')]],'as':_0x1ea844['as'],'attributes':_0x1ea844['attributes']};}):[]};}):[]};}):[]:[]})[_0x43e2('0xc')](function(_0x2f2bd8){logger['info'](_0x43e2('0x15'),_0x1b7cde);logger[_0x43e2('0x1e')](_0x43e2('0x15'),_0x1b7cde,JSON[_0x43e2('0x1f')](_0x2f2bd8));_0x15ecb5(_0x2f2bd8);})[_0x43e2('0x14')](function(_0x5a896b){logger[_0x43e2('0x10')](_0x43e2('0x15'),_0x5a896b[_0x43e2('0x12')],_0x1b7cde);_0x3236b9(_0x3ea010[_0x43e2('0x10')](0x1f4,_0x5a896b[_0x43e2('0x12')]));});});};exports[_0x43e2('0x20')]=function(_0x53f797){var _0x51226b=this;return new Promise(function(_0xe09322,_0x1dcbc8){return db[_0x43e2('0x16')][_0x43e2('0x21')](_0x53f797[_0x43e2('0x22')],{'raw':_0x53f797['options']?_0x53f797[_0x43e2('0x17')][_0x43e2('0x23')]===undefined?!![]:![]:!![]})[_0x43e2('0xc')](function(_0x31beeb){logger[_0x43e2('0x13')](_0x43e2('0x20'),_0x53f797);logger[_0x43e2('0x1e')]('CreateMemberReport',_0x53f797,JSON['stringify'](_0x31beeb));_0xe09322(_0x31beeb);})[_0x43e2('0x14')](function(_0xdbc014){logger['error'](_0x43e2('0x20'),_0xdbc014[_0x43e2('0x12')],_0x53f797);_0x1dcbc8(_0x51226b['error'](0x1f4,_0xdbc014[_0x43e2('0x12')]));});});};exports['UpdateMemberReport']=function(_0x4ad658){var _0x4cba6b=this;return new Promise(function(_0x2bb489,_0x5cd807){return db[_0x43e2('0x16')][_0x43e2('0x24')](_0x4ad658[_0x43e2('0x22')],{'raw':_0x4ad658[_0x43e2('0x17')]?_0x4ad658[_0x43e2('0x17')][_0x43e2('0x23')]===undefined?!![]:![]:!![],'individualHooks':!![],'where':_0x4ad658[_0x43e2('0x17')]?_0x4ad658[_0x43e2('0x17')][_0x43e2('0x18')]||null:null,'attributes':_0x4ad658[_0x43e2('0x17')]?_0x4ad658[_0x43e2('0x17')][_0x43e2('0x19')]||null:null,'limit':_0x4ad658[_0x43e2('0x17')]?_0x4ad658[_0x43e2('0x17')][_0x43e2('0x1a')]||null:null})[_0x43e2('0xc')](function(_0x16fac0){logger['info']('UpdateMemberReport',_0x4ad658);logger['debug'](_0x43e2('0x25'),_0x4ad658,JSON[_0x43e2('0x1f')](_0x16fac0));_0x2bb489(_0x16fac0);})['catch'](function(_0x5cfde9){logger[_0x43e2('0x10')](_0x43e2('0x25'),_0x5cfde9[_0x43e2('0x12')],_0x4ad658);_0x5cd807(_0x4cba6b[_0x43e2('0x10')](0x1f4,_0x5cfde9[_0x43e2('0x12')]));});});}; \ No newline at end of file +var _0x885a=['body','stringify','UpdateMemberReport','limit','util','moment','bluebird','randomstring','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','http','request','info','MemberReport,\x20%s,\x20%s','request\x20sent','debug','MemberReport,\x20%s,\x20%s,\x20%s','error','code','message','result','catch','MemberReport','options','raw','where','attributes','include','map','model','then','GetMemberReport','CreateMemberReport','create'];(function(_0x1c7673,_0x4b27c2){var _0x298620=function(_0xb505b4){while(--_0xb505b4){_0x1c7673['push'](_0x1c7673['shift']());}};_0x298620(++_0x4b27c2);}(_0x885a,0x180));var _0xa885=function(_0x20a584,_0xe384a5){_0x20a584=_0x20a584-0x0;var _0x4b41a8=_0x885a[_0x20a584];return _0x4b41a8;};'use strict';var _=require('lodash');var util=require(_0xa885('0x0'));var moment=require(_0xa885('0x1'));var BPromise=require(_0xa885('0x2'));var rs=require(_0xa885('0x3'));var fs=require('fs');var Redis=require('ioredis');var db=require(_0xa885('0x4'))['db'];var utils=require(_0xa885('0x5'));var logger=require(_0xa885('0x6'))(_0xa885('0x7'));var config=require(_0xa885('0x8'));var jayson=require(_0xa885('0x9'));var client=jayson['client'][_0xa885('0xa')]({'port':0x232a});function respondWithRpcPromise(_0x1200c7,_0x31fd77,_0x546175){return new BPromise(function(_0x6b26e2,_0x2b7916){return client[_0xa885('0xb')](_0x1200c7,_0x546175)['then'](function(_0x2305b1){logger[_0xa885('0xc')](_0xa885('0xd'),_0x31fd77,_0xa885('0xe'));logger[_0xa885('0xf')](_0xa885('0x10'),_0x31fd77,_0xa885('0xe'),JSON['stringify'](_0x2305b1));if(_0x2305b1[_0xa885('0x11')]){if(_0x2305b1[_0xa885('0x11')][_0xa885('0x12')]===0x1f4){logger[_0xa885('0x11')](_0xa885('0xd'),_0x31fd77,_0x2305b1[_0xa885('0x11')][_0xa885('0x13')]);return _0x2b7916(_0x2305b1['error'][_0xa885('0x13')]);}logger[_0xa885('0x11')](_0xa885('0xd'),_0x31fd77,_0x2305b1[_0xa885('0x11')][_0xa885('0x13')]);return _0x6b26e2(_0x2305b1['error'][_0xa885('0x13')]);}else{logger[_0xa885('0xc')]('MemberReport,\x20%s,\x20%s',_0x31fd77,_0xa885('0xe'));_0x6b26e2(_0x2305b1[_0xa885('0x14')]['message']);}})[_0xa885('0x15')](function(_0x41b3de){logger['error'](_0xa885('0xd'),_0x31fd77,_0x41b3de);_0x2b7916(_0x41b3de);});});}exports['GetMemberReport']=function(_0x2e9290){var _0x3960ea=this;return new Promise(function(_0x8c26c,_0x4e4d51){return db[_0xa885('0x16')]['findAll']({'raw':_0x2e9290[_0xa885('0x17')]?_0x2e9290[_0xa885('0x17')][_0xa885('0x18')]===undefined?!![]:![]:!![],'where':_0x2e9290['options']?_0x2e9290[_0xa885('0x17')][_0xa885('0x19')]||null:null,'attributes':_0x2e9290[_0xa885('0x17')]?_0x2e9290['options'][_0xa885('0x1a')]||null:null,'limit':_0x2e9290[_0xa885('0x17')]?_0x2e9290[_0xa885('0x17')]['limit']||null:null,'include':_0x2e9290[_0xa885('0x17')]?_0x2e9290['options'][_0xa885('0x1b')]?_[_0xa885('0x1c')](_0x2e9290['options'][_0xa885('0x1b')],function(_0x190a57){return{'model':db[_0x190a57[_0xa885('0x1d')]],'as':_0x190a57['as'],'attributes':_0x190a57['attributes'],'include':_0x190a57[_0xa885('0x1b')]?_[_0xa885('0x1c')](_0x190a57['include'],function(_0x39ae58){return{'model':db[_0x39ae58['model']],'as':_0x39ae58['as'],'attributes':_0x39ae58[_0xa885('0x1a')],'include':_0x39ae58['include']?_[_0xa885('0x1c')](_0x39ae58[_0xa885('0x1b')],function(_0x3e347e){return{'model':db[_0x3e347e[_0xa885('0x1d')]],'as':_0x3e347e['as'],'attributes':_0x3e347e[_0xa885('0x1a')]};}):[]};}):[]};}):[]:[]})[_0xa885('0x1e')](function(_0x1e13d5){logger[_0xa885('0xc')]('GetMemberReport',_0x2e9290);logger['debug']('GetMemberReport',_0x2e9290,JSON['stringify'](_0x1e13d5));_0x8c26c(_0x1e13d5);})[_0xa885('0x15')](function(_0x3e9e22){logger[_0xa885('0x11')](_0xa885('0x1f'),_0x3e9e22[_0xa885('0x13')],_0x2e9290);_0x4e4d51(_0x3960ea[_0xa885('0x11')](0x1f4,_0x3e9e22['message']));});});};exports[_0xa885('0x20')]=function(_0x47d01c){var _0x1318ef=this;return new Promise(function(_0x4a1e54,_0x39990f){return db['MemberReport'][_0xa885('0x21')](_0x47d01c[_0xa885('0x22')],{'raw':_0x47d01c[_0xa885('0x17')]?_0x47d01c['options'][_0xa885('0x18')]===undefined?!![]:![]:!![]})[_0xa885('0x1e')](function(_0x5ed672){logger[_0xa885('0xc')]('CreateMemberReport',_0x47d01c);logger[_0xa885('0xf')](_0xa885('0x20'),_0x47d01c,JSON[_0xa885('0x23')](_0x5ed672));_0x4a1e54(_0x5ed672);})['catch'](function(_0xf34189){logger[_0xa885('0x11')](_0xa885('0x20'),_0xf34189['message'],_0x47d01c);_0x39990f(_0x1318ef[_0xa885('0x11')](0x1f4,_0xf34189[_0xa885('0x13')]));});});};exports[_0xa885('0x24')]=function(_0xd7c964){var _0x3995f0=this;return new Promise(function(_0x209758,_0x2a00d4){return db[_0xa885('0x16')]['update'](_0xd7c964['body'],{'raw':_0xd7c964[_0xa885('0x17')]?_0xd7c964[_0xa885('0x17')][_0xa885('0x18')]===undefined?!![]:![]:!![],'individualHooks':!![],'where':_0xd7c964[_0xa885('0x17')]?_0xd7c964[_0xa885('0x17')][_0xa885('0x19')]||null:null,'attributes':_0xd7c964[_0xa885('0x17')]?_0xd7c964[_0xa885('0x17')][_0xa885('0x1a')]||null:null,'limit':_0xd7c964['options']?_0xd7c964['options'][_0xa885('0x25')]||null:null})['then'](function(_0x502a96){logger[_0xa885('0xc')]('UpdateMemberReport',_0xd7c964);logger[_0xa885('0xf')](_0xa885('0x24'),_0xd7c964,JSON[_0xa885('0x23')](_0x502a96));_0x209758(_0x502a96);})[_0xa885('0x15')](function(_0x2d433e){logger[_0xa885('0x11')](_0xa885('0x24'),_0x2d433e[_0xa885('0x13')],_0xd7c964);_0x2a00d4(_0x3995f0[_0xa885('0x11')](0x1f4,_0x2d433e[_0xa885('0x13')]));});});}; \ No newline at end of file diff --git a/server/api/migration/index.js b/server/api/migration/index.js index 057387c..97af34a 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 _0x444e=['index','exports','multer','path','express','fs-extra','../../components/interaction/service','../../config/environment','./migration.controller','get'];(function(_0x34a2a8,_0x1999e3){var _0x1cb2d1=function(_0x17272f){while(--_0x17272f){_0x34a2a8['push'](_0x34a2a8['shift']());}};_0x1cb2d1(++_0x1999e3);}(_0x444e,0xe8));var _0xe444=function(_0x555230,_0x3e16af){_0x555230=_0x555230-0x0;var _0x2feabe=_0x444e[_0x555230];return _0x2feabe;};'use strict';var multer=require(_0xe444('0x0'));var util=require('util');var path=require(_0xe444('0x1'));var timeout=require('connect-timeout');var express=require(_0xe444('0x2'));var router=express['Router']();var fs_extra=require(_0xe444('0x3'));var auth=require('../../components/auth/service');var interaction=require(_0xe444('0x4'));var config=require(_0xe444('0x5'));var controller=require(_0xe444('0x6'));router[_0xe444('0x7')]('/',controller[_0xe444('0x8')]);module[_0xe444('0x9')]=router; \ No newline at end of file +var _0x2a8e=['../../components/interaction/service','../../config/environment','./migration.controller','get','index','exports','multer','util','path','connect-timeout','Router','fs-extra'];(function(_0x284b79,_0x39bf66){var _0x75ce94=function(_0xbebd54){while(--_0xbebd54){_0x284b79['push'](_0x284b79['shift']());}};_0x75ce94(++_0x39bf66);}(_0x2a8e,0x156));var _0xe2a8=function(_0x52d931,_0x364734){_0x52d931=_0x52d931-0x0;var _0x2ba19f=_0x2a8e[_0x52d931];return _0x2ba19f;};'use strict';var multer=require(_0xe2a8('0x0'));var util=require(_0xe2a8('0x1'));var path=require(_0xe2a8('0x2'));var timeout=require(_0xe2a8('0x3'));var express=require('express');var router=express[_0xe2a8('0x4')]();var fs_extra=require(_0xe2a8('0x5'));var auth=require('../../components/auth/service');var interaction=require(_0xe2a8('0x6'));var config=require(_0xe2a8('0x7'));var controller=require(_0xe2a8('0x8'));router[_0xe2a8('0x9')]('/',controller[_0xe2a8('0xa')]);module[_0xe2a8('0xb')]=router; \ No newline at end of file diff --git a/server/api/migration/migration.attributes.js b/server/api/migration/migration.attributes.js index 03d92d8..0f0b115 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. * // * * // ************************************************************************* -'use strict';var Sequelize=require('sequelize');module['exports']={'version':{'type':Sequelize['STRING'],'unique':'version'}}; \ No newline at end of file +var _0x075f=['sequelize','exports','STRING','version'];(function(_0x56f053,_0x49926f){var _0x58fa63=function(_0x31c3bd){while(--_0x31c3bd){_0x56f053['push'](_0x56f053['shift']());}};_0x58fa63(++_0x49926f);}(_0x075f,0x18c));var _0xf075=function(_0x5865f7,_0x1bcfba){_0x5865f7=_0x5865f7-0x0;var _0x36fc98=_0x075f[_0x5865f7];return _0x36fc98;};'use strict';var Sequelize=require(_0xf075('0x0'));module[_0xf075('0x1')]={'version':{'type':Sequelize[_0xf075('0x2')],'unique':_0xf075('0x3')}}; \ No newline at end of file diff --git a/server/api/migration/migration.controller.js b/server/api/migration/migration.controller.js index 3cfe68e..080e4a4 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 _0x440d=['then','error','stack','name','send','map','Migration','fieldName','type','key','model','query','keys','filters','intersection','fields','attributes','length','hasOwnProperty','order','sort','where','pick','filter','merge','options','includeAll','include','rows','catch','eml-format','zip-dir','request-promise','bluebird','util','path','sox','to-csv','ejs','fs-extra','squel','crypto','jsforce','desk.js','querystring','ioredis','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','sendStatus','status','end','json','offset','undefined','count','limit','set','apply','reject','save','destroy'];(function(_0x6579e6,_0x745d22){var _0x4f796f=function(_0x576fba){while(--_0x576fba){_0x6579e6['push'](_0x6579e6['shift']());}};_0x4f796f(++_0x745d22);}(_0x440d,0x1f3));var _0xd440=function(_0x2b281b,_0x360f48){_0x2b281b=_0x2b281b-0x0;var _0x514213=_0x440d[_0x2b281b];return _0x514213;};'use strict';var emlformat=require(_0xd440('0x0'));var rimraf=require('rimraf');var zipdir=require(_0xd440('0x1'));var jsonpatch=require('fast-json-patch');var rp=require(_0xd440('0x2'));var moment=require('moment');var BPromise=require(_0xd440('0x3'));var Mustache=require('mustache');var util=require(_0xd440('0x4'));var path=require(_0xd440('0x5'));var sox=require(_0xd440('0x6'));var csv=require(_0xd440('0x7'));var ejs=require(_0xd440('0x8'));var fs=require('fs');var fs_extra=require(_0xd440('0x9'));var _=require('lodash');var squel=require(_0xd440('0xa'));var crypto=require(_0xd440('0xb'));var jsforce=require(_0xd440('0xc'));var deskjs=require(_0xd440('0xd'));var toCsv=require(_0xd440('0x7'));var querystring=require(_0xd440('0xe'));var Papa=require('papaparse');var Redis=require(_0xd440('0xf'));var authService=require('../../components/auth/service');var qs=require(_0xd440('0x10'));var as=require(_0xd440('0x11'));var hardwareService=require(_0xd440('0x12'));var logger=require(_0xd440('0x13'))('api');var utils=require(_0xd440('0x14'));var config=require(_0xd440('0x15'));var licenseUtil=require(_0xd440('0x16'));var db=require(_0xd440('0x17'))['db'];function respondWithStatusCode(_0x2876e2,_0x1f73d0){_0x1f73d0=_0x1f73d0||0xcc;return function(_0x2b6353){if(_0x2b6353){return _0x2876e2[_0xd440('0x18')](_0x1f73d0);}return _0x2876e2[_0xd440('0x19')](_0x1f73d0)[_0xd440('0x1a')]();};}function respondWithResult(_0x42ae03,_0x34ee1d){_0x34ee1d=_0x34ee1d||0xc8;return function(_0x40fab0){if(_0x40fab0){return _0x42ae03[_0xd440('0x19')](_0x34ee1d)[_0xd440('0x1b')](_0x40fab0);}};}function respondWithFilteredResult(_0x32dc94,_0x2c4f03){return function(_0x42a91e){if(_0x42a91e){var _0x49bce5=typeof _0x2c4f03[_0xd440('0x1c')]===_0xd440('0x1d')&&typeof _0x2c4f03['limit']===_0xd440('0x1d');var _0x504e1a=_0x42a91e[_0xd440('0x1e')];var _0x117ea8=_0x49bce5?0x0:_0x2c4f03['offset'];var _0x49a275=_0x49bce5?_0x42a91e[_0xd440('0x1e')]:_0x2c4f03[_0xd440('0x1c')]+_0x2c4f03[_0xd440('0x1f')];var _0x40333a;if(_0x49a275>=_0x504e1a){_0x49a275=_0x504e1a;_0x40333a=0xc8;}else{_0x40333a=0xce;}_0x32dc94[_0xd440('0x19')](_0x40333a);return _0x32dc94[_0xd440('0x20')]('Content-Range',_0x117ea8+'-'+_0x49a275+'/'+_0x504e1a)[_0xd440('0x1b')](_0x42a91e);}return null;};}function patchUpdates(_0x45f742){return function(_0x4b4f07){try{jsonpatch[_0xd440('0x21')](_0x4b4f07,_0x45f742,!![]);}catch(_0xcabf1f){return BPromise[_0xd440('0x22')](_0xcabf1f);}return _0x4b4f07[_0xd440('0x23')]();};}function saveUpdates(_0x80f08e,_0x23071e){return function(_0x5c28f1){if(_0x5c28f1){return _0x5c28f1['update'](_0x80f08e)['then'](function(_0xde4cab){return _0xde4cab;});}return null;};}function removeEntity(_0x5976d2,_0x236b62){return function(_0x39ef24){if(_0x39ef24){return _0x39ef24[_0xd440('0x24')]()[_0xd440('0x25')](function(){_0x5976d2[_0xd440('0x19')](0xcc)[_0xd440('0x1a')]();});}};}function handleEntityNotFound(_0x287618,_0x1c0d75){return function(_0x5827d5){if(!_0x5827d5){_0x287618[_0xd440('0x18')](0x194);}return _0x5827d5;};}function handleError(_0xb22cf8,_0x5043af){_0x5043af=_0x5043af||0x1f4;return function(_0x3fbe90){logger[_0xd440('0x26')](_0x3fbe90[_0xd440('0x27')]);if(_0x3fbe90[_0xd440('0x28')]){delete _0x3fbe90[_0xd440('0x28')];}_0xb22cf8[_0xd440('0x19')](_0x5043af)[_0xd440('0x29')](_0x3fbe90);};}exports['index']=function(_0x21b887,_0x15c40b){var _0x42b723={},_0x120a6d={},_0x32fc83={'count':0x0,'rows':[]};var _0x1fd89e=_[_0xd440('0x2a')](db[_0xd440('0x2b')]['rawAttributes'],function(_0x2396eb){return{'name':_0x2396eb[_0xd440('0x2c')],'type':_0x2396eb[_0xd440('0x2d')][_0xd440('0x2e')]};});_0x120a6d[_0xd440('0x2f')]=_[_0xd440('0x2a')](_0x1fd89e,'name');_0x120a6d[_0xd440('0x30')]=_[_0xd440('0x31')](_0x21b887[_0xd440('0x30')]);_0x120a6d[_0xd440('0x32')]=_[_0xd440('0x33')](_0x120a6d[_0xd440('0x2f')],_0x120a6d[_0xd440('0x30')]);_0x42b723['attributes']=_[_0xd440('0x33')](_0x120a6d[_0xd440('0x2f')],qs['fields'](_0x21b887[_0xd440('0x30')][_0xd440('0x34')]));_0x42b723[_0xd440('0x35')]=_0x42b723[_0xd440('0x35')][_0xd440('0x36')]?_0x42b723[_0xd440('0x35')]:_0x120a6d['model'];if(!_0x21b887[_0xd440('0x30')][_0xd440('0x37')]('nolimit')){_0x42b723[_0xd440('0x1f')]=qs[_0xd440('0x1f')](_0x21b887[_0xd440('0x30')][_0xd440('0x1f')]);_0x42b723[_0xd440('0x1c')]=qs[_0xd440('0x1c')](_0x21b887[_0xd440('0x30')][_0xd440('0x1c')]);}_0x42b723[_0xd440('0x38')]=qs[_0xd440('0x39')](_0x21b887[_0xd440('0x30')][_0xd440('0x39')]);_0x42b723[_0xd440('0x3a')]=qs[_0xd440('0x32')](_[_0xd440('0x3b')](_0x21b887[_0xd440('0x30')],_0x120a6d[_0xd440('0x32')]),_0x1fd89e);if(_0x21b887['query'][_0xd440('0x3c')]){_0x42b723['where']=_[_0xd440('0x3d')](_0x42b723[_0xd440('0x3a')],{'$or':_[_0xd440('0x2a')](_0x1fd89e,function(_0x1181cf){if(_0x1181cf[_0xd440('0x2d')]!=='VIRTUAL'){var _0x2d72c4={};_0x2d72c4[_0x1181cf[_0xd440('0x28')]]={'$like':'%'+_0x21b887['query'][_0xd440('0x3c')]+'%'};return _0x2d72c4;}})});}_0x42b723=_[_0xd440('0x3d')]({},_0x42b723,_0x21b887[_0xd440('0x3e')]);var _0x227ac0={'where':_0x42b723[_0xd440('0x3a')]};return db['Migration'][_0xd440('0x1e')](_0x227ac0)[_0xd440('0x25')](function(_0x551619){_0x32fc83[_0xd440('0x1e')]=_0x551619;if(_0x21b887[_0xd440('0x30')][_0xd440('0x3f')]){_0x42b723[_0xd440('0x40')]=[{'all':!![]}];}return db[_0xd440('0x2b')]['findAll'](_0x42b723);})['then'](function(_0x4a9ea3){_0x32fc83[_0xd440('0x41')]=_0x4a9ea3;return _0x32fc83;})[_0xd440('0x25')](respondWithFilteredResult(_0x15c40b,_0x42b723))[_0xd440('0x42')](handleError(_0x15c40b,null));}; \ No newline at end of file +var _0x8adf=['Migration','rawAttributes','fieldName','type','key','map','query','filters','model','attributes','fields','length','hasOwnProperty','sort','where','pick','filter','merge','VIRTUAL','include','rows','catch','eml-format','rimraf','zip-dir','fast-json-patch','moment','bluebird','mustache','util','path','ejs','fs-extra','lodash','crypto','desk.js','to-csv','querystring','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','status','end','json','offset','undefined','count','limit','set','Content-Range','apply','reject','save','update','then','sendStatus','error','stack','name','index'];(function(_0x11e030,_0x4c6bce){var _0x3c7aa4=function(_0xc60409){while(--_0xc60409){_0x11e030['push'](_0x11e030['shift']());}};_0x3c7aa4(++_0x4c6bce);}(_0x8adf,0x1f2));var _0xf8ad=function(_0x3f0a7f,_0x318a81){_0x3f0a7f=_0x3f0a7f-0x0;var _0x101af4=_0x8adf[_0x3f0a7f];return _0x101af4;};'use strict';var emlformat=require(_0xf8ad('0x0'));var rimraf=require(_0xf8ad('0x1'));var zipdir=require(_0xf8ad('0x2'));var jsonpatch=require(_0xf8ad('0x3'));var rp=require('request-promise');var moment=require(_0xf8ad('0x4'));var BPromise=require(_0xf8ad('0x5'));var Mustache=require(_0xf8ad('0x6'));var util=require(_0xf8ad('0x7'));var path=require(_0xf8ad('0x8'));var sox=require('sox');var csv=require('to-csv');var ejs=require(_0xf8ad('0x9'));var fs=require('fs');var fs_extra=require(_0xf8ad('0xa'));var _=require(_0xf8ad('0xb'));var squel=require('squel');var crypto=require(_0xf8ad('0xc'));var jsforce=require('jsforce');var deskjs=require(_0xf8ad('0xd'));var toCsv=require(_0xf8ad('0xe'));var querystring=require(_0xf8ad('0xf'));var Papa=require('papaparse');var Redis=require(_0xf8ad('0x10'));var authService=require(_0xf8ad('0x11'));var qs=require(_0xf8ad('0x12'));var as=require(_0xf8ad('0x13'));var hardwareService=require(_0xf8ad('0x14'));var logger=require(_0xf8ad('0x15'))(_0xf8ad('0x16'));var utils=require(_0xf8ad('0x17'));var config=require(_0xf8ad('0x18'));var licenseUtil=require(_0xf8ad('0x19'));var db=require(_0xf8ad('0x1a'))['db'];function respondWithStatusCode(_0x5db057,_0x15c4a1){_0x15c4a1=_0x15c4a1||0xcc;return function(_0x2c563a){if(_0x2c563a){return _0x5db057['sendStatus'](_0x15c4a1);}return _0x5db057[_0xf8ad('0x1b')](_0x15c4a1)[_0xf8ad('0x1c')]();};}function respondWithResult(_0x3716b4,_0x21cab3){_0x21cab3=_0x21cab3||0xc8;return function(_0x26d443){if(_0x26d443){return _0x3716b4[_0xf8ad('0x1b')](_0x21cab3)[_0xf8ad('0x1d')](_0x26d443);}};}function respondWithFilteredResult(_0x335e81,_0x430723){return function(_0x1c0d20){if(_0x1c0d20){var _0x7b61a6=typeof _0x430723[_0xf8ad('0x1e')]===_0xf8ad('0x1f')&&typeof _0x430723['limit']==='undefined';var _0x35881f=_0x1c0d20[_0xf8ad('0x20')];var _0x42d8a9=_0x7b61a6?0x0:_0x430723[_0xf8ad('0x1e')];var _0x146611=_0x7b61a6?_0x1c0d20[_0xf8ad('0x20')]:_0x430723[_0xf8ad('0x1e')]+_0x430723[_0xf8ad('0x21')];var _0x2da637;if(_0x146611>=_0x35881f){_0x146611=_0x35881f;_0x2da637=0xc8;}else{_0x2da637=0xce;}_0x335e81[_0xf8ad('0x1b')](_0x2da637);return _0x335e81[_0xf8ad('0x22')](_0xf8ad('0x23'),_0x42d8a9+'-'+_0x146611+'/'+_0x35881f)['json'](_0x1c0d20);}return null;};}function patchUpdates(_0x1d4295){return function(_0x17a5db){try{jsonpatch[_0xf8ad('0x24')](_0x17a5db,_0x1d4295,!![]);}catch(_0x24ce93){return BPromise[_0xf8ad('0x25')](_0x24ce93);}return _0x17a5db[_0xf8ad('0x26')]();};}function saveUpdates(_0x142354,_0x2fe297){return function(_0xb4de47){if(_0xb4de47){return _0xb4de47[_0xf8ad('0x27')](_0x142354)[_0xf8ad('0x28')](function(_0x283b25){return _0x283b25;});}return null;};}function removeEntity(_0x3c3b61,_0x4b5193){return function(_0x30059f){if(_0x30059f){return _0x30059f['destroy']()[_0xf8ad('0x28')](function(){_0x3c3b61[_0xf8ad('0x1b')](0xcc)['end']();});}};}function handleEntityNotFound(_0xfa8d43,_0x5832c3){return function(_0x6f20be){if(!_0x6f20be){_0xfa8d43[_0xf8ad('0x29')](0x194);}return _0x6f20be;};}function handleError(_0x1bf931,_0x585cf2){_0x585cf2=_0x585cf2||0x1f4;return function(_0x2608b5){logger[_0xf8ad('0x2a')](_0x2608b5[_0xf8ad('0x2b')]);if(_0x2608b5[_0xf8ad('0x2c')]){delete _0x2608b5[_0xf8ad('0x2c')];}_0x1bf931['status'](_0x585cf2)['send'](_0x2608b5);};}exports[_0xf8ad('0x2d')]=function(_0x187665,_0x56da94){var _0x2b850c={},_0x54a0b6={},_0x5b5aa1={'count':0x0,'rows':[]};var _0x5475cd=_['map'](db[_0xf8ad('0x2e')][_0xf8ad('0x2f')],function(_0x465de7){return{'name':_0x465de7[_0xf8ad('0x30')],'type':_0x465de7[_0xf8ad('0x31')][_0xf8ad('0x32')]};});_0x54a0b6['model']=_[_0xf8ad('0x33')](_0x5475cd,_0xf8ad('0x2c'));_0x54a0b6[_0xf8ad('0x34')]=_['keys'](_0x187665[_0xf8ad('0x34')]);_0x54a0b6[_0xf8ad('0x35')]=_['intersection'](_0x54a0b6[_0xf8ad('0x36')],_0x54a0b6['query']);_0x2b850c[_0xf8ad('0x37')]=_['intersection'](_0x54a0b6[_0xf8ad('0x36')],qs[_0xf8ad('0x38')](_0x187665[_0xf8ad('0x34')][_0xf8ad('0x38')]));_0x2b850c[_0xf8ad('0x37')]=_0x2b850c[_0xf8ad('0x37')][_0xf8ad('0x39')]?_0x2b850c[_0xf8ad('0x37')]:_0x54a0b6[_0xf8ad('0x36')];if(!_0x187665[_0xf8ad('0x34')][_0xf8ad('0x3a')]('nolimit')){_0x2b850c['limit']=qs['limit'](_0x187665['query']['limit']);_0x2b850c['offset']=qs[_0xf8ad('0x1e')](_0x187665['query']['offset']);}_0x2b850c['order']=qs[_0xf8ad('0x3b')](_0x187665['query'][_0xf8ad('0x3b')]);_0x2b850c[_0xf8ad('0x3c')]=qs[_0xf8ad('0x35')](_[_0xf8ad('0x3d')](_0x187665[_0xf8ad('0x34')],_0x54a0b6[_0xf8ad('0x35')]),_0x5475cd);if(_0x187665[_0xf8ad('0x34')][_0xf8ad('0x3e')]){_0x2b850c['where']=_[_0xf8ad('0x3f')](_0x2b850c[_0xf8ad('0x3c')],{'$or':_[_0xf8ad('0x33')](_0x5475cd,function(_0x24c545){if(_0x24c545[_0xf8ad('0x31')]!==_0xf8ad('0x40')){var _0x2c7294={};_0x2c7294[_0x24c545['name']]={'$like':'%'+_0x187665[_0xf8ad('0x34')][_0xf8ad('0x3e')]+'%'};return _0x2c7294;}})});}_0x2b850c=_[_0xf8ad('0x3f')]({},_0x2b850c,_0x187665['options']);var _0x4ab1b0={'where':_0x2b850c[_0xf8ad('0x3c')]};return db['Migration'][_0xf8ad('0x20')](_0x4ab1b0)[_0xf8ad('0x28')](function(_0x1ce9c0){_0x5b5aa1[_0xf8ad('0x20')]=_0x1ce9c0;if(_0x187665['query']['includeAll']){_0x2b850c[_0xf8ad('0x41')]=[{'all':!![]}];}return db[_0xf8ad('0x2e')]['findAll'](_0x2b850c);})[_0xf8ad('0x28')](function(_0x412ddb){_0x5b5aa1[_0xf8ad('0x42')]=_0x412ddb;return _0x5b5aa1;})['then'](respondWithFilteredResult(_0x56da94,_0x2b850c))[_0xf8ad('0x43')](handleError(_0x56da94,null));}; \ No newline at end of file diff --git a/server/api/migration/migration.model.js b/server/api/migration/migration.model.js index 9b4ecc2..75cb8ae 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 _0x6415=['../../config/environment','./migration.attributes','Migration','migrations','lodash','util','../../config/logger','api','moment','bluebird','path'];(function(_0xb7b5b2,_0x424b9f){var _0x2d9877=function(_0x1e3a86){while(--_0x1e3a86){_0xb7b5b2['push'](_0xb7b5b2['shift']());}};_0x2d9877(++_0x424b9f);}(_0x6415,0x9e));var _0x5641=function(_0x39a027,_0x58fcbd){_0x39a027=_0x39a027-0x0;var _0x3c1f42=_0x6415[_0x39a027];return _0x3c1f42;};'use strict';var _=require(_0x5641('0x0'));var util=require(_0x5641('0x1'));var logger=require(_0x5641('0x2'))(_0x5641('0x3'));var moment=require(_0x5641('0x4'));var BPromise=require(_0x5641('0x5'));var rp=require('request-promise');var fs=require('fs');var path=require(_0x5641('0x6'));var rimraf=require('rimraf');var config=require(_0x5641('0x7'));var attributes=require(_0x5641('0x8'));module['exports']=function(_0xa02468,_0x8de1af){return _0xa02468['define'](_0x5641('0x9'),attributes,{'tableName':_0x5641('0xa'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x2724=['moment','bluebird','request-promise','rimraf','../../config/environment','exports','define','util'];(function(_0x5c0c04,_0x20213a){var _0x7729f=function(_0x33c636){while(--_0x33c636){_0x5c0c04['push'](_0x5c0c04['shift']());}};_0x7729f(++_0x20213a);}(_0x2724,0x1b7));var _0x4272=function(_0x2e84e1,_0x832016){_0x2e84e1=_0x2e84e1-0x0;var _0x4edb71=_0x2724[_0x2e84e1];return _0x4edb71;};'use strict';var _=require('lodash');var util=require(_0x4272('0x0'));var logger=require('../../config/logger')('api');var moment=require(_0x4272('0x1'));var BPromise=require(_0x4272('0x2'));var rp=require(_0x4272('0x3'));var fs=require('fs');var path=require('path');var rimraf=require(_0x4272('0x4'));var config=require(_0x4272('0x5'));var attributes=require('./migration.attributes');module[_0x4272('0x6')]=function(_0x2f03db,_0x13c26d){return _0x2f03db[_0x4272('0x7')]('Migration',attributes,{'tableName':'migrations','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 8f4815a..5f532bb 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 _0x6e77=['then','Migration,\x20%s,\x20%s','request\x20sent','debug','Migration,\x20%s,\x20%s,\x20%s','stringify','error','code','message','result','catch','util','randomstring','ioredis','../../config/utils','../../config/logger','rpc','client','http'];(function(_0xaa6a4,_0x64b067){var _0xdc31a4=function(_0x4269d8){while(--_0x4269d8){_0xaa6a4['push'](_0xaa6a4['shift']());}};_0xdc31a4(++_0x64b067);}(_0x6e77,0xef));var _0x76e7=function(_0x548eae,_0xad69de){_0x548eae=_0x548eae-0x0;var _0x5b1a01=_0x6e77[_0x548eae];return _0x5b1a01;};'use strict';var _=require('lodash');var util=require(_0x76e7('0x0'));var moment=require('moment');var BPromise=require('bluebird');var rs=require(_0x76e7('0x1'));var fs=require('fs');var Redis=require(_0x76e7('0x2'));var db=require('../../mysqldb')['db'];var utils=require(_0x76e7('0x3'));var logger=require(_0x76e7('0x4'))(_0x76e7('0x5'));var config=require('../../config/environment');var jayson=require('jayson/promise');var client=jayson[_0x76e7('0x6')][_0x76e7('0x7')]({'port':0x232a});function respondWithRpcPromise(_0xac49d0,_0x5a5e94,_0x433ae3){return new BPromise(function(_0x464a99,_0x4ab2ff){return client['request'](_0xac49d0,_0x433ae3)[_0x76e7('0x8')](function(_0x2b2f4f){logger['info'](_0x76e7('0x9'),_0x5a5e94,_0x76e7('0xa'));logger[_0x76e7('0xb')](_0x76e7('0xc'),_0x5a5e94,'request\x20sent',JSON[_0x76e7('0xd')](_0x2b2f4f));if(_0x2b2f4f[_0x76e7('0xe')]){if(_0x2b2f4f[_0x76e7('0xe')][_0x76e7('0xf')]===0x1f4){logger[_0x76e7('0xe')](_0x76e7('0x9'),_0x5a5e94,_0x2b2f4f[_0x76e7('0xe')][_0x76e7('0x10')]);return _0x4ab2ff(_0x2b2f4f[_0x76e7('0xe')][_0x76e7('0x10')]);}logger[_0x76e7('0xe')]('Migration,\x20%s,\x20%s',_0x5a5e94,_0x2b2f4f[_0x76e7('0xe')]['message']);return _0x464a99(_0x2b2f4f[_0x76e7('0xe')][_0x76e7('0x10')]);}else{logger['info'](_0x76e7('0x9'),_0x5a5e94,_0x76e7('0xa'));_0x464a99(_0x2b2f4f[_0x76e7('0x11')][_0x76e7('0x10')]);}})[_0x76e7('0x12')](function(_0x333466){logger[_0x76e7('0xe')]('Migration,\x20%s,\x20%s',_0x5a5e94,_0x333466);_0x4ab2ff(_0x333466);});});} \ No newline at end of file +var _0xb67f=['info','Migration,\x20%s,\x20%s','request\x20sent','Migration,\x20%s,\x20%s,\x20%s','stringify','error','message','util','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','../../config/environment','jayson/promise','client','http','request','then'];(function(_0x48fe82,_0x361c8c){var _0x3d2e30=function(_0x5da1f7){while(--_0x5da1f7){_0x48fe82['push'](_0x48fe82['shift']());}};_0x3d2e30(++_0x361c8c);}(_0xb67f,0x12d));var _0xfb67=function(_0x4dc1db,_0xc2cc0d){_0x4dc1db=_0x4dc1db-0x0;var _0xb5fc32=_0xb67f[_0x4dc1db];return _0xb5fc32;};'use strict';var _=require('lodash');var util=require(_0xfb67('0x0'));var moment=require(_0xfb67('0x1'));var BPromise=require(_0xfb67('0x2'));var rs=require(_0xfb67('0x3'));var fs=require('fs');var Redis=require(_0xfb67('0x4'));var db=require(_0xfb67('0x5'))['db'];var utils=require(_0xfb67('0x6'));var logger=require(_0xfb67('0x7'))('rpc');var config=require(_0xfb67('0x8'));var jayson=require(_0xfb67('0x9'));var client=jayson[_0xfb67('0xa')][_0xfb67('0xb')]({'port':0x232a});function respondWithRpcPromise(_0x1e07cf,_0x4feb36,_0x4cda73){return new BPromise(function(_0x4c5b07,_0x2d59a1){return client[_0xfb67('0xc')](_0x1e07cf,_0x4cda73)[_0xfb67('0xd')](function(_0x489c4e){logger[_0xfb67('0xe')](_0xfb67('0xf'),_0x4feb36,_0xfb67('0x10'));logger['debug'](_0xfb67('0x11'),_0x4feb36,'request\x20sent',JSON[_0xfb67('0x12')](_0x489c4e));if(_0x489c4e[_0xfb67('0x13')]){if(_0x489c4e['error']['code']===0x1f4){logger[_0xfb67('0x13')]('Migration,\x20%s,\x20%s',_0x4feb36,_0x489c4e[_0xfb67('0x13')][_0xfb67('0x14')]);return _0x2d59a1(_0x489c4e[_0xfb67('0x13')][_0xfb67('0x14')]);}logger[_0xfb67('0x13')](_0xfb67('0xf'),_0x4feb36,_0x489c4e[_0xfb67('0x13')][_0xfb67('0x14')]);return _0x4c5b07(_0x489c4e[_0xfb67('0x13')][_0xfb67('0x14')]);}else{logger[_0xfb67('0xe')]('Migration,\x20%s,\x20%s',_0x4feb36,_0xfb67('0x10'));_0x4c5b07(_0x489c4e['result'][_0xfb67('0x14')]);}})['catch'](function(_0x3c8d43){logger[_0xfb67('0x13')]('Migration,\x20%s,\x20%s',_0x4feb36,_0x3c8d43);_0x2d59a1(_0x3c8d43);});});} \ No newline at end of file diff --git a/server/api/network/index.js b/server/api/network/index.js index 14c783c..3838237 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 _0x96d8=['path','connect-timeout','express','Router','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','./network.controller','get','isAuthenticated','index','/:id','show','post','create','put','update','delete','destroy','multer','util'];(function(_0x64e0dc,_0xc6da53){var _0x538f0f=function(_0x5d9f8e){while(--_0x5d9f8e){_0x64e0dc['push'](_0x64e0dc['shift']());}};_0x538f0f(++_0xc6da53);}(_0x96d8,0x1e2));var _0x896d=function(_0x1fb5d1,_0x95dbe6){_0x1fb5d1=_0x1fb5d1-0x0;var _0x38611d=_0x96d8[_0x1fb5d1];return _0x38611d;};'use strict';var multer=require(_0x896d('0x0'));var util=require(_0x896d('0x1'));var path=require(_0x896d('0x2'));var timeout=require(_0x896d('0x3'));var express=require(_0x896d('0x4'));var router=express[_0x896d('0x5')]();var fs_extra=require(_0x896d('0x6'));var auth=require(_0x896d('0x7'));var interaction=require(_0x896d('0x8'));var config=require(_0x896d('0x9'));var controller=require(_0x896d('0xa'));router[_0x896d('0xb')]('/',auth[_0x896d('0xc')](),controller[_0x896d('0xd')]);router['get'](_0x896d('0xe'),auth[_0x896d('0xc')](),controller[_0x896d('0xf')]);router[_0x896d('0x10')]('/',auth[_0x896d('0xc')](),controller[_0x896d('0x11')]);router[_0x896d('0x12')](_0x896d('0xe'),auth['isAuthenticated'](),controller[_0x896d('0x13')]);router[_0x896d('0x14')](_0x896d('0xe'),auth[_0x896d('0xc')](),controller[_0x896d('0x15')]);module['exports']=router; \ No newline at end of file +var _0x35a6=['show','post','create','put','destroy','path','connect-timeout','express','Router','fs-extra','../../components/auth/service','isAuthenticated','index','get','/:id'];(function(_0x345e4c,_0x3e73ba){var _0x40c41c=function(_0x23dfe0){while(--_0x23dfe0){_0x345e4c['push'](_0x345e4c['shift']());}};_0x40c41c(++_0x3e73ba);}(_0x35a6,0x122));var _0x635a=function(_0xa31086,_0xdc718a){_0xa31086=_0xa31086-0x0;var _0x732df0=_0x35a6[_0xa31086];return _0x732df0;};'use strict';var multer=require('multer');var util=require('util');var path=require(_0x635a('0x0'));var timeout=require(_0x635a('0x1'));var express=require(_0x635a('0x2'));var router=express[_0x635a('0x3')]();var fs_extra=require(_0x635a('0x4'));var auth=require(_0x635a('0x5'));var interaction=require('../../components/interaction/service');var config=require('../../config/environment');var controller=require('./network.controller');router['get']('/',auth[_0x635a('0x6')](),controller[_0x635a('0x7')]);router[_0x635a('0x8')](_0x635a('0x9'),auth[_0x635a('0x6')](),controller[_0x635a('0xa')]);router[_0x635a('0xb')]('/',auth[_0x635a('0x6')](),controller[_0x635a('0xc')]);router[_0x635a('0xd')](_0x635a('0x9'),auth[_0x635a('0x6')](),controller['update']);router['delete'](_0x635a('0x9'),auth[_0x635a('0x6')](),controller[_0x635a('0xe')]);module['exports']=router; \ No newline at end of file diff --git a/server/api/network/network.attributes.js b/server/api/network/network.attributes.js index 5996cb1..414f8ea 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 _0x539c=['STRING','exports','ENUM','localnet','externip'];(function(_0x4c4129,_0x4ba6cf){var _0x4a0f06=function(_0x3152d6){while(--_0x3152d6){_0x4c4129['push'](_0x4c4129['shift']());}};_0x4a0f06(++_0x4ba6cf);}(_0x539c,0x1c8));var _0xc539=function(_0x20a584,_0xe384a5){_0x20a584=_0x20a584-0x0;var _0x4b41a8=_0x539c[_0x20a584];return _0x4b41a8;};'use strict';var Sequelize=require('sequelize');module[_0xc539('0x0')]={'type':{'type':Sequelize[_0xc539('0x1')](_0xc539('0x2'),_0xc539('0x3'),'stun','turn')},'value':{'type':Sequelize[_0xc539('0x4')]},'username':{'type':Sequelize[_0xc539('0x4')]},'password':{'type':Sequelize[_0xc539('0x4')]}}; \ No newline at end of file +var _0xe27c=['externip','stun','turn','STRING','sequelize','exports','ENUM'];(function(_0x520d1,_0x2d85bf){var _0x221840=function(_0xea9979){while(--_0xea9979){_0x520d1['push'](_0x520d1['shift']());}};_0x221840(++_0x2d85bf);}(_0xe27c,0xc8));var _0xce27=function(_0x57adae,_0x3a254){_0x57adae=_0x57adae-0x0;var _0x7e8bac=_0xe27c[_0x57adae];return _0x7e8bac;};'use strict';var Sequelize=require(_0xce27('0x0'));module[_0xce27('0x1')]={'type':{'type':Sequelize[_0xce27('0x2')]('localnet',_0xce27('0x3'),_0xce27('0x4'),_0xce27('0x5'))},'value':{'type':Sequelize[_0xce27('0x6')]},'username':{'type':Sequelize[_0xce27('0x6')]},'password':{'type':Sequelize[_0xce27('0x6')]}}; \ No newline at end of file diff --git a/server/api/network/network.controller.js b/server/api/network/network.controller.js index 3b3ae10..12ae7f3 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 _0x2a3c=['model','map','query','keys','filters','intersection','attributes','fields','hasOwnProperty','nolimit','order','sort','where','pick','filter','merge','options','includeAll','include','findAll','rows','params','create','body','toUpperCase','STUN','readFileSync','join','root','utf8','render','/etc/asterisk/stun_xcally.conf','Reload','res_stun_monitor.so','TURN','server/files/templates/turn_multiple.ejs','writeFileSync','/etc/asterisk/turn_xcally.conf','server/files/templates/network.ejs','format','/etc/asterisk/sip_xcally_%s.conf','chan_sip.so','find','server/files/templates/stun_multiple.ejs','toLowerCase','util','path','ejs','lodash','../../config/logger','api','../../config/environment','jayson/promise','http','request','info','request\x20sent','Network,\x20%s,\x20%s,\x20%s','stringify','error','Network,\x20%s,\x20%s','message','result','catch','status','json','offset','limit','undefined','count','set','update','then','destroy','end','sendStatus','name','send','index','Network','rawAttributes','fieldName','type'];(function(_0x2c944e,_0x26f659){var _0x2cc529=function(_0x3fbc4b){while(--_0x3fbc4b){_0x2c944e['push'](_0x2c944e['shift']());}};_0x2cc529(++_0x26f659);}(_0x2a3c,0x179));var _0xc2a3=function(_0x5c3c0b,_0x4ee35e){_0x5c3c0b=_0x5c3c0b-0x0;var _0x52ecd2=_0x2a3c[_0x5c3c0b];return _0x52ecd2;};'use strict';var util=require(_0xc2a3('0x0'));var path=require(_0xc2a3('0x1'));var ejs=require(_0xc2a3('0x2'));var fs=require('fs');var _=require(_0xc2a3('0x3'));var qs=require('../../components/parsers/qs');var logger=require(_0xc2a3('0x4'))(_0xc2a3('0x5'));var config=require(_0xc2a3('0x6'));var db=require('../../mysqldb')['db'];var jayson=require(_0xc2a3('0x7'));var client=jayson['client'][_0xc2a3('0x8')]({'port':0x232a});function respondWithRpcPromise(_0x44944f,_0x56c152,_0x48d8de,_0xab652){return new Promise(function(_0x3cd6cf,_0x2a8026){var _0x108af5=_0xab652||client;return _0x108af5[_0xc2a3('0x9')](_0x44944f,_0x48d8de)['then'](function(_0x18816b){logger[_0xc2a3('0xa')]('Network,\x20%s,\x20%s',_0x56c152,_0xc2a3('0xb'));logger['debug'](_0xc2a3('0xc'),_0x56c152,_0xc2a3('0xb'),JSON[_0xc2a3('0xd')](_0x18816b));if(_0x18816b['error']){if(_0x18816b[_0xc2a3('0xe')]['code']===0x1f4){logger['error'](_0xc2a3('0xf'),_0x56c152,_0x18816b[_0xc2a3('0xe')][_0xc2a3('0x10')]);return _0x2a8026(_0x18816b[_0xc2a3('0xe')][_0xc2a3('0x10')]);}logger['error'](_0xc2a3('0xf'),_0x56c152,_0x18816b['error'][_0xc2a3('0x10')]);return _0x3cd6cf(_0x18816b[_0xc2a3('0xe')]['message']);}else{logger[_0xc2a3('0xa')](_0xc2a3('0xf'),_0x56c152,_0xc2a3('0xb'));_0x3cd6cf(_0x18816b[_0xc2a3('0x11')][_0xc2a3('0x10')]);}})[_0xc2a3('0x12')](function(_0x5f5133){logger['error'](_0xc2a3('0xf'),_0x56c152,_0x5f5133);_0x2a8026(_0x5f5133);});});}function respondWithResult(_0x481ef1,_0x1d75ea){_0x1d75ea=_0x1d75ea||0xc8;return function(_0x5f5701){if(_0x5f5701){return _0x481ef1[_0xc2a3('0x13')](_0x1d75ea)[_0xc2a3('0x14')](_0x5f5701);}};}function respondWithFilteredResult(_0x58def8,_0x54dfb1){return function(_0x2024b5){if(_0x2024b5){var _0xd8f491=typeof _0x54dfb1[_0xc2a3('0x15')]==='undefined'&&typeof _0x54dfb1[_0xc2a3('0x16')]===_0xc2a3('0x17');var _0xea6eb3=_0x2024b5['count'];var _0x83021b=_0xd8f491?0x0:_0x54dfb1[_0xc2a3('0x15')];var _0x162997=_0xd8f491?_0x2024b5[_0xc2a3('0x18')]:_0x54dfb1[_0xc2a3('0x15')]+_0x54dfb1[_0xc2a3('0x16')];var _0x56115d;if(_0x162997>=_0xea6eb3){_0x162997=_0xea6eb3;_0x56115d=0xc8;}else{_0x56115d=0xce;}_0x58def8['status'](_0x56115d);return _0x58def8[_0xc2a3('0x19')]('Content-Range',_0x83021b+'-'+_0x162997+'/'+_0xea6eb3)[_0xc2a3('0x14')](_0x2024b5);}return null;};}function saveUpdates(_0x256386){return function(_0x420d1f){if(_0x420d1f){return _0x420d1f[_0xc2a3('0x1a')](_0x256386)[_0xc2a3('0x1b')](function(_0x1a8569){return _0x1a8569;});}return null;};}function removeEntity(_0x349413){return function(_0x7d2615){if(_0x7d2615){return _0x7d2615[_0xc2a3('0x1c')]()[_0xc2a3('0x1b')](function(){_0x349413[_0xc2a3('0x13')](0xcc)[_0xc2a3('0x1d')]();});}};}function handleEntityNotFound(_0x4eed31){return function(_0x34ed60){if(!_0x34ed60){_0x4eed31[_0xc2a3('0x1e')](0x194);}return _0x34ed60;};}function handleError(_0x40a557,_0x1a2b5c){_0x1a2b5c=_0x1a2b5c||0x1f4;return function(_0x2f95ce){logger['error'](_0x2f95ce['stack']);if(_0x2f95ce[_0xc2a3('0x1f')]){delete _0x2f95ce[_0xc2a3('0x1f')];}_0x40a557[_0xc2a3('0x13')](_0x1a2b5c)[_0xc2a3('0x20')](_0x2f95ce);};}exports[_0xc2a3('0x21')]=function(_0x2e693a,_0x26051e){var _0x3c32b3={},_0xd0b2b0={},_0x2ce28b={'count':0x0,'rows':[]};var _0x57937e=_['map'](db[_0xc2a3('0x22')][_0xc2a3('0x23')],function(_0x28ee09){return{'name':_0x28ee09[_0xc2a3('0x24')],'type':_0x28ee09[_0xc2a3('0x25')]['key']};});_0xd0b2b0[_0xc2a3('0x26')]=_[_0xc2a3('0x27')](_0x57937e,_0xc2a3('0x1f'));_0xd0b2b0[_0xc2a3('0x28')]=_[_0xc2a3('0x29')](_0x2e693a[_0xc2a3('0x28')]);_0xd0b2b0[_0xc2a3('0x2a')]=_[_0xc2a3('0x2b')](_0xd0b2b0[_0xc2a3('0x26')],_0xd0b2b0[_0xc2a3('0x28')]);_0x3c32b3[_0xc2a3('0x2c')]=_['intersection'](_0xd0b2b0['model'],qs[_0xc2a3('0x2d')](_0x2e693a[_0xc2a3('0x28')][_0xc2a3('0x2d')]));_0x3c32b3[_0xc2a3('0x2c')]=_0x3c32b3[_0xc2a3('0x2c')]['length']?_0x3c32b3[_0xc2a3('0x2c')]:_0xd0b2b0['model'];if(!_0x2e693a['query'][_0xc2a3('0x2e')](_0xc2a3('0x2f'))){_0x3c32b3['limit']=qs[_0xc2a3('0x16')](_0x2e693a[_0xc2a3('0x28')][_0xc2a3('0x16')]);_0x3c32b3[_0xc2a3('0x15')]=qs['offset'](_0x2e693a[_0xc2a3('0x28')][_0xc2a3('0x15')]);}_0x3c32b3[_0xc2a3('0x30')]=qs[_0xc2a3('0x31')](_0x2e693a[_0xc2a3('0x28')][_0xc2a3('0x31')]);_0x3c32b3[_0xc2a3('0x32')]=qs[_0xc2a3('0x2a')](_[_0xc2a3('0x33')](_0x2e693a[_0xc2a3('0x28')],_0xd0b2b0[_0xc2a3('0x2a')]),_0x57937e);if(_0x2e693a[_0xc2a3('0x28')][_0xc2a3('0x34')]){_0x3c32b3[_0xc2a3('0x32')]=_[_0xc2a3('0x35')](_0x3c32b3[_0xc2a3('0x32')],{'$or':_[_0xc2a3('0x27')](_0x57937e,function(_0x19ff46){if(_0x19ff46[_0xc2a3('0x25')]!=='VIRTUAL'){var _0x259570={};_0x259570[_0x19ff46[_0xc2a3('0x1f')]]={'$like':'%'+_0x2e693a[_0xc2a3('0x28')][_0xc2a3('0x34')]+'%'};return _0x259570;}})});}_0x3c32b3=_[_0xc2a3('0x35')]({},_0x3c32b3,_0x2e693a[_0xc2a3('0x36')]);var _0x1b1442={'where':_0x3c32b3[_0xc2a3('0x32')]};return db[_0xc2a3('0x22')][_0xc2a3('0x18')](_0x1b1442)['then'](function(_0x87cc91){_0x2ce28b['count']=_0x87cc91;if(_0x2e693a[_0xc2a3('0x28')][_0xc2a3('0x37')]){_0x3c32b3[_0xc2a3('0x38')]=[{'all':!![]}];}return db[_0xc2a3('0x22')][_0xc2a3('0x39')](_0x3c32b3);})[_0xc2a3('0x1b')](function(_0x27d88c){_0x2ce28b[_0xc2a3('0x3a')]=_0x27d88c;return _0x2ce28b;})['then'](respondWithFilteredResult(_0x26051e,_0x3c32b3))[_0xc2a3('0x12')](handleError(_0x26051e,null));};exports['show']=function(_0x2fe347,_0x30270d){var _0x3e9a4d={'raw':!![],'where':{'id':_0x2fe347[_0xc2a3('0x3b')]['id']}},_0x413075={};_0x413075['model']=_[_0xc2a3('0x29')](db[_0xc2a3('0x22')][_0xc2a3('0x23')]);_0x413075['query']=_[_0xc2a3('0x29')](_0x2fe347[_0xc2a3('0x28')]);_0x413075['filters']=_[_0xc2a3('0x2b')](_0x413075[_0xc2a3('0x26')],_0x413075['query']);_0x3e9a4d[_0xc2a3('0x2c')]=_[_0xc2a3('0x2b')](_0x413075[_0xc2a3('0x26')],qs[_0xc2a3('0x2d')](_0x2fe347['query'][_0xc2a3('0x2d')]));_0x3e9a4d['attributes']=_0x3e9a4d[_0xc2a3('0x2c')]['length']?_0x3e9a4d[_0xc2a3('0x2c')]:_0x413075[_0xc2a3('0x26')];if(_0x2fe347[_0xc2a3('0x28')][_0xc2a3('0x37')]){_0x3e9a4d[_0xc2a3('0x38')]=[{'all':!![]}];}_0x3e9a4d=_['merge']({},_0x3e9a4d,_0x2fe347[_0xc2a3('0x36')]);return db[_0xc2a3('0x22')]['find'](_0x3e9a4d)[_0xc2a3('0x1b')](handleEntityNotFound(_0x30270d,null))['then'](respondWithResult(_0x30270d,null))[_0xc2a3('0x12')](handleError(_0x30270d,null));};exports[_0xc2a3('0x3c')]=function(_0x22cc5c,_0x5b6d3b){var _0x4deeed;return db[_0xc2a3('0x22')][_0xc2a3('0x3c')](_0x22cc5c[_0xc2a3('0x3d')],{'raw':!![]})[_0xc2a3('0x1b')](function(_0xf7bb92){_0x4deeed=_0xf7bb92;return db[_0xc2a3('0x22')][_0xc2a3('0x39')]({'where':{'type':_0x22cc5c[_0xc2a3('0x3d')]['type']},'raw':!![]});})[_0xc2a3('0x1b')](function(_0x450eac){if(_0x4deeed[_0xc2a3('0x25')][_0xc2a3('0x3e')]()==_0xc2a3('0x3f')){var _0x5734d8=fs[_0xc2a3('0x40')](path[_0xc2a3('0x41')](config[_0xc2a3('0x42')],'server/files/templates/stun_multiple.ejs'),_0xc2a3('0x43'));var _0x213b62=ejs[_0xc2a3('0x44')](_0x5734d8,{'networks':_0x450eac||[]});fs['writeFileSync'](_0xc2a3('0x45'),_0x213b62);return respondWithRpcPromise(_0xc2a3('0x46'),_0xc2a3('0x3c'),{'module':_0xc2a3('0x47')});}else if(_0x4deeed[_0xc2a3('0x25')][_0xc2a3('0x3e')]()==_0xc2a3('0x48')){var _0x45a48e=fs[_0xc2a3('0x40')](path[_0xc2a3('0x41')](config[_0xc2a3('0x42')],_0xc2a3('0x49')),'utf8');var _0x35e6a8=ejs[_0xc2a3('0x44')](_0x45a48e,{'networks':_0x450eac||[]});fs[_0xc2a3('0x4a')](_0xc2a3('0x4b'),_0x35e6a8);return respondWithRpcPromise(_0xc2a3('0x46'),_0xc2a3('0x3c'),{'module':_0xc2a3('0x47')});}else{var _0x3350dd=fs[_0xc2a3('0x40')](path['join'](config[_0xc2a3('0x42')],_0xc2a3('0x4c')),_0xc2a3('0x43'));var _0x4345c6=ejs[_0xc2a3('0x44')](_0x3350dd,{'networks':_0x450eac||[]});fs['writeFileSync'](util[_0xc2a3('0x4d')](_0xc2a3('0x4e'),_0x22cc5c[_0xc2a3('0x3d')][_0xc2a3('0x25')]['toLowerCase']()),_0x4345c6);return respondWithRpcPromise(_0xc2a3('0x46'),_0xc2a3('0x3c'),{'module':_0xc2a3('0x4f')});}})[_0xc2a3('0x1b')](function(){return _0x4deeed;})[_0xc2a3('0x1b')](respondWithResult(_0x5b6d3b,0xc9))[_0xc2a3('0x12')](handleError(_0x5b6d3b,null));};exports[_0xc2a3('0x1a')]=function(_0x3d624f,_0x3fbdde){var _0x53c042;return db['Network'][_0xc2a3('0x50')]({'where':{'id':_0x3d624f[_0xc2a3('0x3b')]['id']}})[_0xc2a3('0x1b')](handleEntityNotFound(_0x3fbdde,null))[_0xc2a3('0x1b')](saveUpdates(_0x3d624f[_0xc2a3('0x3d')],null))[_0xc2a3('0x1b')](function(_0x514f41){if(_0x514f41){_0x53c042=_0x514f41;return db[_0xc2a3('0x22')][_0xc2a3('0x39')]({'where':{'type':_0x53c042['type']},'raw':!![]});}return null;})['then'](function(_0x1fabdc){if(_0x53c042['type'][_0xc2a3('0x3e')]()==_0xc2a3('0x3f')){var _0x5ae38d=fs[_0xc2a3('0x40')](path[_0xc2a3('0x41')](config[_0xc2a3('0x42')],_0xc2a3('0x51')),'utf8');var _0x1336d2=ejs[_0xc2a3('0x44')](_0x5ae38d,{'networks':_0x1fabdc||[]});fs[_0xc2a3('0x4a')]('/etc/asterisk/stun_xcally.conf',_0x1336d2);return respondWithRpcPromise(_0xc2a3('0x46'),_0xc2a3('0x1a'),{'module':_0xc2a3('0x47')});}else if(_0x53c042[_0xc2a3('0x25')]['toUpperCase']()==_0xc2a3('0x48')){var _0xf7bc8e=fs['readFileSync'](path[_0xc2a3('0x41')](config[_0xc2a3('0x42')],_0xc2a3('0x49')),_0xc2a3('0x43'));var _0x10af1b=ejs['render'](_0xf7bc8e,{'networks':_0x1fabdc||[]});fs[_0xc2a3('0x4a')]('/etc/asterisk/turn_xcally.conf',_0x10af1b);return respondWithRpcPromise(_0xc2a3('0x46'),'update',{'module':_0xc2a3('0x47')});}else{var _0x4e2302=fs[_0xc2a3('0x40')](path[_0xc2a3('0x41')](config[_0xc2a3('0x42')],_0xc2a3('0x4c')),_0xc2a3('0x43'));var _0x4cccbd=ejs[_0xc2a3('0x44')](_0x4e2302,{'networks':_0x1fabdc||[]});fs[_0xc2a3('0x4a')](util[_0xc2a3('0x4d')](_0xc2a3('0x4e'),_0x3d624f[_0xc2a3('0x3d')][_0xc2a3('0x25')]['toLowerCase']()),_0x4cccbd);return respondWithRpcPromise('Reload',_0xc2a3('0x1a'),{'module':_0xc2a3('0x4f')});}})[_0xc2a3('0x1b')](function(_0x2e3315){if(_0x2e3315){return _0x53c042;}return null;})[_0xc2a3('0x1b')](respondWithResult(_0x3fbdde,null))[_0xc2a3('0x12')](handleError(_0x3fbdde,null));};exports[_0xc2a3('0x1c')]=function(_0x25e428,_0x5d96fd){var _0x2929c2;return db[_0xc2a3('0x22')][_0xc2a3('0x50')]({'where':{'id':_0x25e428['params']['id']}})[_0xc2a3('0x1b')](function(_0x37b387){_0x2929c2=_0x37b387;return _0x37b387;})['then'](handleEntityNotFound(_0x5d96fd,null))['then'](removeEntity(_0x5d96fd,null))[_0xc2a3('0x1b')](function(){if(_0x2929c2){return db[_0xc2a3('0x22')]['findAll']({'where':{'type':_0x2929c2[_0xc2a3('0x25')]},'raw':!![]});}})['then'](function(_0x3a2087){if(_0x2929c2[_0xc2a3('0x25')][_0xc2a3('0x3e')]()==_0xc2a3('0x3f')){var _0x429275=fs[_0xc2a3('0x40')](path[_0xc2a3('0x41')](config[_0xc2a3('0x42')],'server/files/templates/stun_multiple.ejs'),_0xc2a3('0x43'));var _0xb31e00=ejs[_0xc2a3('0x44')](_0x429275,{'networks':_0x3a2087||[]});fs[_0xc2a3('0x4a')](_0xc2a3('0x45'),_0xb31e00);return respondWithRpcPromise(_0xc2a3('0x46'),_0xc2a3('0x1c'),{'module':_0xc2a3('0x47')});}else if(_0x2929c2[_0xc2a3('0x25')]['toUpperCase']()==_0xc2a3('0x48')){var _0x5662fc=fs[_0xc2a3('0x40')](path['join'](config[_0xc2a3('0x42')],_0xc2a3('0x49')),_0xc2a3('0x43'));var _0x5722d6=ejs[_0xc2a3('0x44')](_0x5662fc,{'networks':_0x3a2087||[]});fs[_0xc2a3('0x4a')]('/etc/asterisk/turn_xcally.conf',_0x5722d6);return respondWithRpcPromise(_0xc2a3('0x46'),_0xc2a3('0x1c'),{'module':_0xc2a3('0x47')});}else{var _0x2cfb8a=fs[_0xc2a3('0x40')](path['join'](config['root'],'server/files/templates/network.ejs'),_0xc2a3('0x43'));var _0xa32990=ejs['render'](_0x2cfb8a,{'networks':_0x3a2087||[]});fs[_0xc2a3('0x4a')](util['format'](_0xc2a3('0x4e'),_0x2929c2[_0xc2a3('0x25')][_0xc2a3('0x52')]()),_0xa32990);return respondWithRpcPromise('Reload',_0xc2a3('0x1c'),{'module':_0xc2a3('0x4f')});}})['catch'](handleError(_0x5d96fd,null));}; \ No newline at end of file +var _0xb420=['map','fieldName','key','model','query','keys','filters','attributes','intersection','fields','length','hasOwnProperty','nolimit','order','sort','where','pick','filter','merge','VIRTUAL','options','Network','includeAll','include','findAll','rawAttributes','create','body','type','toUpperCase','STUN','readFileSync','join','server/files/templates/stun_multiple.ejs','utf8','render','writeFileSync','/etc/asterisk/stun_xcally.conf','res_stun_monitor.so','TURN','root','server/files/templates/turn_multiple.ejs','/etc/asterisk/turn_xcally.conf','Reload','server/files/templates/network.ejs','format','/etc/asterisk/sip_xcally_%s.conf','toLowerCase','chan_sip.so','find','params','util','path','ejs','api','../../config/environment','../../mysqldb','jayson/promise','http','request','then','info','request\x20sent','debug','stringify','error','code','Network,\x20%s,\x20%s','message','result','catch','status','json','offset','undefined','limit','count','set','update','destroy','end','sendStatus','stack','name'];(function(_0x3dd15e,_0x1f0015){var _0x231fd0=function(_0x4f680a){while(--_0x4f680a){_0x3dd15e['push'](_0x3dd15e['shift']());}};_0x231fd0(++_0x1f0015);}(_0xb420,0xdb));var _0x0b42=function(_0x501510,_0x61caa9){_0x501510=_0x501510-0x0;var _0x1e6ee5=_0xb420[_0x501510];return _0x1e6ee5;};'use strict';var util=require(_0x0b42('0x0'));var path=require(_0x0b42('0x1'));var ejs=require(_0x0b42('0x2'));var fs=require('fs');var _=require('lodash');var qs=require('../../components/parsers/qs');var logger=require('../../config/logger')(_0x0b42('0x3'));var config=require(_0x0b42('0x4'));var db=require(_0x0b42('0x5'))['db'];var jayson=require(_0x0b42('0x6'));var client=jayson['client'][_0x0b42('0x7')]({'port':0x232a});function respondWithRpcPromise(_0x4447d2,_0x5c6bbe,_0x14c85e,_0x1bb333){return new Promise(function(_0x1048c0,_0x53fb22){var _0x4646d4=_0x1bb333||client;return _0x4646d4[_0x0b42('0x8')](_0x4447d2,_0x14c85e)[_0x0b42('0x9')](function(_0x33ce36){logger[_0x0b42('0xa')]('Network,\x20%s,\x20%s',_0x5c6bbe,_0x0b42('0xb'));logger[_0x0b42('0xc')]('Network,\x20%s,\x20%s,\x20%s',_0x5c6bbe,_0x0b42('0xb'),JSON[_0x0b42('0xd')](_0x33ce36));if(_0x33ce36[_0x0b42('0xe')]){if(_0x33ce36['error'][_0x0b42('0xf')]===0x1f4){logger[_0x0b42('0xe')](_0x0b42('0x10'),_0x5c6bbe,_0x33ce36[_0x0b42('0xe')][_0x0b42('0x11')]);return _0x53fb22(_0x33ce36[_0x0b42('0xe')][_0x0b42('0x11')]);}logger[_0x0b42('0xe')](_0x0b42('0x10'),_0x5c6bbe,_0x33ce36[_0x0b42('0xe')][_0x0b42('0x11')]);return _0x1048c0(_0x33ce36[_0x0b42('0xe')][_0x0b42('0x11')]);}else{logger['info'](_0x0b42('0x10'),_0x5c6bbe,_0x0b42('0xb'));_0x1048c0(_0x33ce36[_0x0b42('0x12')]['message']);}})[_0x0b42('0x13')](function(_0xa0bcb6){logger[_0x0b42('0xe')]('Network,\x20%s,\x20%s',_0x5c6bbe,_0xa0bcb6);_0x53fb22(_0xa0bcb6);});});}function respondWithResult(_0x30914d,_0x4e291d){_0x4e291d=_0x4e291d||0xc8;return function(_0x4a3425){if(_0x4a3425){return _0x30914d[_0x0b42('0x14')](_0x4e291d)[_0x0b42('0x15')](_0x4a3425);}};}function respondWithFilteredResult(_0x28ebc2,_0x2de446){return function(_0x1e6a40){if(_0x1e6a40){var _0x5b2d0f=typeof _0x2de446[_0x0b42('0x16')]===_0x0b42('0x17')&&typeof _0x2de446[_0x0b42('0x18')]===_0x0b42('0x17');var _0x440616=_0x1e6a40[_0x0b42('0x19')];var _0x27ec5f=_0x5b2d0f?0x0:_0x2de446[_0x0b42('0x16')];var _0x225b1c=_0x5b2d0f?_0x1e6a40[_0x0b42('0x19')]:_0x2de446[_0x0b42('0x16')]+_0x2de446['limit'];var _0x3ef379;if(_0x225b1c>=_0x440616){_0x225b1c=_0x440616;_0x3ef379=0xc8;}else{_0x3ef379=0xce;}_0x28ebc2[_0x0b42('0x14')](_0x3ef379);return _0x28ebc2[_0x0b42('0x1a')]('Content-Range',_0x27ec5f+'-'+_0x225b1c+'/'+_0x440616)[_0x0b42('0x15')](_0x1e6a40);}return null;};}function saveUpdates(_0x5acfc9){return function(_0x39e5c4){if(_0x39e5c4){return _0x39e5c4[_0x0b42('0x1b')](_0x5acfc9)[_0x0b42('0x9')](function(_0x5bca29){return _0x5bca29;});}return null;};}function removeEntity(_0x1d05d9){return function(_0xe9f281){if(_0xe9f281){return _0xe9f281[_0x0b42('0x1c')]()[_0x0b42('0x9')](function(){_0x1d05d9['status'](0xcc)[_0x0b42('0x1d')]();});}};}function handleEntityNotFound(_0x584227){return function(_0x33c68a){if(!_0x33c68a){_0x584227[_0x0b42('0x1e')](0x194);}return _0x33c68a;};}function handleError(_0x2c798f,_0x410249){_0x410249=_0x410249||0x1f4;return function(_0x5cfca9){logger[_0x0b42('0xe')](_0x5cfca9[_0x0b42('0x1f')]);if(_0x5cfca9['name']){delete _0x5cfca9[_0x0b42('0x20')];}_0x2c798f[_0x0b42('0x14')](_0x410249)['send'](_0x5cfca9);};}exports['index']=function(_0x206dde,_0x594eeb){var _0x31f94b={},_0x4b9795={},_0x122bdf={'count':0x0,'rows':[]};var _0x3bd159=_[_0x0b42('0x21')](db['Network']['rawAttributes'],function(_0x47cef1){return{'name':_0x47cef1[_0x0b42('0x22')],'type':_0x47cef1['type'][_0x0b42('0x23')]};});_0x4b9795[_0x0b42('0x24')]=_[_0x0b42('0x21')](_0x3bd159,_0x0b42('0x20'));_0x4b9795[_0x0b42('0x25')]=_[_0x0b42('0x26')](_0x206dde[_0x0b42('0x25')]);_0x4b9795[_0x0b42('0x27')]=_['intersection'](_0x4b9795['model'],_0x4b9795['query']);_0x31f94b[_0x0b42('0x28')]=_[_0x0b42('0x29')](_0x4b9795[_0x0b42('0x24')],qs[_0x0b42('0x2a')](_0x206dde['query'][_0x0b42('0x2a')]));_0x31f94b[_0x0b42('0x28')]=_0x31f94b['attributes'][_0x0b42('0x2b')]?_0x31f94b[_0x0b42('0x28')]:_0x4b9795[_0x0b42('0x24')];if(!_0x206dde[_0x0b42('0x25')][_0x0b42('0x2c')](_0x0b42('0x2d'))){_0x31f94b[_0x0b42('0x18')]=qs[_0x0b42('0x18')](_0x206dde[_0x0b42('0x25')][_0x0b42('0x18')]);_0x31f94b[_0x0b42('0x16')]=qs[_0x0b42('0x16')](_0x206dde[_0x0b42('0x25')][_0x0b42('0x16')]);}_0x31f94b[_0x0b42('0x2e')]=qs[_0x0b42('0x2f')](_0x206dde['query'][_0x0b42('0x2f')]);_0x31f94b[_0x0b42('0x30')]=qs[_0x0b42('0x27')](_[_0x0b42('0x31')](_0x206dde[_0x0b42('0x25')],_0x4b9795[_0x0b42('0x27')]),_0x3bd159);if(_0x206dde[_0x0b42('0x25')][_0x0b42('0x32')]){_0x31f94b[_0x0b42('0x30')]=_[_0x0b42('0x33')](_0x31f94b[_0x0b42('0x30')],{'$or':_[_0x0b42('0x21')](_0x3bd159,function(_0x373b4f){if(_0x373b4f['type']!==_0x0b42('0x34')){var _0x3a53da={};_0x3a53da[_0x373b4f['name']]={'$like':'%'+_0x206dde[_0x0b42('0x25')][_0x0b42('0x32')]+'%'};return _0x3a53da;}})});}_0x31f94b=_[_0x0b42('0x33')]({},_0x31f94b,_0x206dde[_0x0b42('0x35')]);var _0x5547ad={'where':_0x31f94b[_0x0b42('0x30')]};return db[_0x0b42('0x36')][_0x0b42('0x19')](_0x5547ad)['then'](function(_0x46c1b4){_0x122bdf[_0x0b42('0x19')]=_0x46c1b4;if(_0x206dde['query'][_0x0b42('0x37')]){_0x31f94b[_0x0b42('0x38')]=[{'all':!![]}];}return db[_0x0b42('0x36')][_0x0b42('0x39')](_0x31f94b);})[_0x0b42('0x9')](function(_0x5c1cdb){_0x122bdf['rows']=_0x5c1cdb;return _0x122bdf;})[_0x0b42('0x9')](respondWithFilteredResult(_0x594eeb,_0x31f94b))['catch'](handleError(_0x594eeb,null));};exports['show']=function(_0x2a566f,_0x549659){var _0x1e8ae3={'raw':!![],'where':{'id':_0x2a566f['params']['id']}},_0x16e9a9={};_0x16e9a9['model']=_['keys'](db['Network'][_0x0b42('0x3a')]);_0x16e9a9[_0x0b42('0x25')]=_[_0x0b42('0x26')](_0x2a566f[_0x0b42('0x25')]);_0x16e9a9[_0x0b42('0x27')]=_['intersection'](_0x16e9a9[_0x0b42('0x24')],_0x16e9a9[_0x0b42('0x25')]);_0x1e8ae3[_0x0b42('0x28')]=_[_0x0b42('0x29')](_0x16e9a9[_0x0b42('0x24')],qs[_0x0b42('0x2a')](_0x2a566f['query'][_0x0b42('0x2a')]));_0x1e8ae3[_0x0b42('0x28')]=_0x1e8ae3[_0x0b42('0x28')]['length']?_0x1e8ae3[_0x0b42('0x28')]:_0x16e9a9['model'];if(_0x2a566f[_0x0b42('0x25')][_0x0b42('0x37')]){_0x1e8ae3[_0x0b42('0x38')]=[{'all':!![]}];}_0x1e8ae3=_[_0x0b42('0x33')]({},_0x1e8ae3,_0x2a566f['options']);return db[_0x0b42('0x36')]['find'](_0x1e8ae3)[_0x0b42('0x9')](handleEntityNotFound(_0x549659,null))[_0x0b42('0x9')](respondWithResult(_0x549659,null))[_0x0b42('0x13')](handleError(_0x549659,null));};exports[_0x0b42('0x3b')]=function(_0x5c2e4a,_0x2667fc){var _0x4344f3;return db[_0x0b42('0x36')]['create'](_0x5c2e4a[_0x0b42('0x3c')],{'raw':!![]})['then'](function(_0x467be8){_0x4344f3=_0x467be8;return db[_0x0b42('0x36')][_0x0b42('0x39')]({'where':{'type':_0x5c2e4a[_0x0b42('0x3c')][_0x0b42('0x3d')]},'raw':!![]});})['then'](function(_0x116e8c){if(_0x4344f3[_0x0b42('0x3d')][_0x0b42('0x3e')]()==_0x0b42('0x3f')){var _0x51cf0e=fs[_0x0b42('0x40')](path[_0x0b42('0x41')](config['root'],_0x0b42('0x42')),_0x0b42('0x43'));var _0x28d600=ejs[_0x0b42('0x44')](_0x51cf0e,{'networks':_0x116e8c||[]});fs[_0x0b42('0x45')](_0x0b42('0x46'),_0x28d600);return respondWithRpcPromise('Reload',_0x0b42('0x3b'),{'module':_0x0b42('0x47')});}else if(_0x4344f3[_0x0b42('0x3d')][_0x0b42('0x3e')]()==_0x0b42('0x48')){var _0x254a39=fs['readFileSync'](path[_0x0b42('0x41')](config[_0x0b42('0x49')],_0x0b42('0x4a')),'utf8');var _0x292a5d=ejs[_0x0b42('0x44')](_0x254a39,{'networks':_0x116e8c||[]});fs[_0x0b42('0x45')](_0x0b42('0x4b'),_0x292a5d);return respondWithRpcPromise(_0x0b42('0x4c'),_0x0b42('0x3b'),{'module':_0x0b42('0x47')});}else{var _0x2a0248=fs['readFileSync'](path[_0x0b42('0x41')](config[_0x0b42('0x49')],_0x0b42('0x4d')),'utf8');var _0x3c05ca=ejs[_0x0b42('0x44')](_0x2a0248,{'networks':_0x116e8c||[]});fs[_0x0b42('0x45')](util[_0x0b42('0x4e')](_0x0b42('0x4f'),_0x5c2e4a[_0x0b42('0x3c')][_0x0b42('0x3d')][_0x0b42('0x50')]()),_0x3c05ca);return respondWithRpcPromise('Reload','create',{'module':_0x0b42('0x51')});}})[_0x0b42('0x9')](function(){return _0x4344f3;})[_0x0b42('0x9')](respondWithResult(_0x2667fc,0xc9))['catch'](handleError(_0x2667fc,null));};exports[_0x0b42('0x1b')]=function(_0x47fc34,_0x5d2711){var _0xba050d;return db[_0x0b42('0x36')][_0x0b42('0x52')]({'where':{'id':_0x47fc34[_0x0b42('0x53')]['id']}})[_0x0b42('0x9')](handleEntityNotFound(_0x5d2711,null))[_0x0b42('0x9')](saveUpdates(_0x47fc34[_0x0b42('0x3c')],null))[_0x0b42('0x9')](function(_0x268c5d){if(_0x268c5d){_0xba050d=_0x268c5d;return db[_0x0b42('0x36')][_0x0b42('0x39')]({'where':{'type':_0xba050d['type']},'raw':!![]});}return null;})['then'](function(_0xff817a){if(_0xba050d[_0x0b42('0x3d')][_0x0b42('0x3e')]()==_0x0b42('0x3f')){var _0x59474d=fs[_0x0b42('0x40')](path['join'](config['root'],_0x0b42('0x42')),_0x0b42('0x43'));var _0x5bbf79=ejs[_0x0b42('0x44')](_0x59474d,{'networks':_0xff817a||[]});fs[_0x0b42('0x45')](_0x0b42('0x46'),_0x5bbf79);return respondWithRpcPromise(_0x0b42('0x4c'),_0x0b42('0x1b'),{'module':'res_stun_monitor.so'});}else if(_0xba050d[_0x0b42('0x3d')][_0x0b42('0x3e')]()==_0x0b42('0x48')){var _0x41ae23=fs[_0x0b42('0x40')](path[_0x0b42('0x41')](config[_0x0b42('0x49')],_0x0b42('0x4a')),_0x0b42('0x43'));var _0x1a52a0=ejs['render'](_0x41ae23,{'networks':_0xff817a||[]});fs[_0x0b42('0x45')](_0x0b42('0x4b'),_0x1a52a0);return respondWithRpcPromise(_0x0b42('0x4c'),_0x0b42('0x1b'),{'module':_0x0b42('0x47')});}else{var _0x260e3a=fs[_0x0b42('0x40')](path[_0x0b42('0x41')](config[_0x0b42('0x49')],'server/files/templates/network.ejs'),'utf8');var _0xf193bc=ejs['render'](_0x260e3a,{'networks':_0xff817a||[]});fs[_0x0b42('0x45')](util[_0x0b42('0x4e')](_0x0b42('0x4f'),_0x47fc34[_0x0b42('0x3c')][_0x0b42('0x3d')]['toLowerCase']()),_0xf193bc);return respondWithRpcPromise(_0x0b42('0x4c'),_0x0b42('0x1b'),{'module':_0x0b42('0x51')});}})[_0x0b42('0x9')](function(_0x4678fb){if(_0x4678fb){return _0xba050d;}return null;})[_0x0b42('0x9')](respondWithResult(_0x5d2711,null))[_0x0b42('0x13')](handleError(_0x5d2711,null));};exports['destroy']=function(_0x12a058,_0xd10145){var _0x238219;return db['Network'][_0x0b42('0x52')]({'where':{'id':_0x12a058[_0x0b42('0x53')]['id']}})[_0x0b42('0x9')](function(_0x207145){_0x238219=_0x207145;return _0x207145;})[_0x0b42('0x9')](handleEntityNotFound(_0xd10145,null))[_0x0b42('0x9')](removeEntity(_0xd10145,null))[_0x0b42('0x9')](function(){if(_0x238219){return db[_0x0b42('0x36')][_0x0b42('0x39')]({'where':{'type':_0x238219['type']},'raw':!![]});}})[_0x0b42('0x9')](function(_0x20ee3e){if(_0x238219[_0x0b42('0x3d')][_0x0b42('0x3e')]()==_0x0b42('0x3f')){var _0x417c15=fs[_0x0b42('0x40')](path[_0x0b42('0x41')](config[_0x0b42('0x49')],_0x0b42('0x42')),'utf8');var _0x3d17f3=ejs[_0x0b42('0x44')](_0x417c15,{'networks':_0x20ee3e||[]});fs[_0x0b42('0x45')]('/etc/asterisk/stun_xcally.conf',_0x3d17f3);return respondWithRpcPromise(_0x0b42('0x4c'),'destroy',{'module':_0x0b42('0x47')});}else if(_0x238219[_0x0b42('0x3d')][_0x0b42('0x3e')]()==_0x0b42('0x48')){var _0x453bb4=fs[_0x0b42('0x40')](path[_0x0b42('0x41')](config[_0x0b42('0x49')],_0x0b42('0x4a')),_0x0b42('0x43'));var _0x563fc1=ejs[_0x0b42('0x44')](_0x453bb4,{'networks':_0x20ee3e||[]});fs['writeFileSync'](_0x0b42('0x4b'),_0x563fc1);return respondWithRpcPromise(_0x0b42('0x4c'),_0x0b42('0x1c'),{'module':_0x0b42('0x47')});}else{var _0x1b93a0=fs[_0x0b42('0x40')](path[_0x0b42('0x41')](config['root'],'server/files/templates/network.ejs'),_0x0b42('0x43'));var _0x188d41=ejs[_0x0b42('0x44')](_0x1b93a0,{'networks':_0x20ee3e||[]});fs[_0x0b42('0x45')](util[_0x0b42('0x4e')](_0x0b42('0x4f'),_0x238219['type'][_0x0b42('0x50')]()),_0x188d41);return respondWithRpcPromise(_0x0b42('0x4c'),_0x0b42('0x1c'),{'module':_0x0b42('0x51')});}})[_0x0b42('0x13')](handleError(_0xd10145,null));}; \ No newline at end of file diff --git a/server/api/network/network.model.js b/server/api/network/network.model.js index 276aca3..2ec0aea 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 _0xf4eb=['./network.attributes','exports','define','network','lodash','bluebird','rimraf','../../config/environment'];(function(_0x29c2bb,_0x1bde54){var _0x5446f1=function(_0x106117){while(--_0x106117){_0x29c2bb['push'](_0x29c2bb['shift']());}};_0x5446f1(++_0x1bde54);}(_0xf4eb,0xec));var _0xbf4e=function(_0x296524,_0x27a6ac){_0x296524=_0x296524-0x0;var _0x3281ff=_0xf4eb[_0x296524];return _0x3281ff;};'use strict';var _=require(_0xbf4e('0x0'));var util=require('util');var logger=require('../../config/logger')('api');var moment=require('moment');var BPromise=require(_0xbf4e('0x1'));var rp=require('request-promise');var fs=require('fs');var path=require('path');var rimraf=require(_0xbf4e('0x2'));var config=require(_0xbf4e('0x3'));var attributes=require(_0xbf4e('0x4'));module[_0xbf4e('0x5')]=function(_0xa4dcf5,_0x2fcfed){return _0xa4dcf5[_0xbf4e('0x6')]('Network',attributes,{'tableName':_0xbf4e('0x7'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0xe3d4=['api','bluebird','request-promise','rimraf','./network.attributes','exports','define','network','util','../../config/logger'];(function(_0x13ed55,_0x387602){var _0x4f793e=function(_0x29c65a){while(--_0x29c65a){_0x13ed55['push'](_0x13ed55['shift']());}};_0x4f793e(++_0x387602);}(_0xe3d4,0xc6));var _0x4e3d=function(_0x567ad7,_0x4f55e0){_0x567ad7=_0x567ad7-0x0;var _0x338c0e=_0xe3d4[_0x567ad7];return _0x338c0e;};'use strict';var _=require('lodash');var util=require(_0x4e3d('0x0'));var logger=require(_0x4e3d('0x1'))(_0x4e3d('0x2'));var moment=require('moment');var BPromise=require(_0x4e3d('0x3'));var rp=require(_0x4e3d('0x4'));var fs=require('fs');var path=require('path');var rimraf=require(_0x4e3d('0x5'));var config=require('../../config/environment');var attributes=require(_0x4e3d('0x6'));module[_0x4e3d('0x7')]=function(_0x4fd5ff,_0x3eaf60){return _0x4fd5ff[_0x4e3d('0x8')]('Network',attributes,{'tableName':_0x4e3d('0x9'),'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 f5a8d45..b66f77d 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(_0x441df7,_0x961c3c){_0x441df7=_0x441df7-0x0;var _0x52ccfb=_0x7a54[_0x441df7];return _0x52ccfb;};'use strict';var _=require(_0x47a5('0x0'));var util=require(_0x47a5('0x1'));var moment=require(_0x47a5('0x2'));var BPromise=require('bluebird');var rs=require(_0x47a5('0x3'));var fs=require('fs');var Redis=require(_0x47a5('0x4'));var db=require('../../mysqldb')['db'];var utils=require(_0x47a5('0x5'));var logger=require(_0x47a5('0x6'))(_0x47a5('0x7'));var config=require(_0x47a5('0x8'));var jayson=require(_0x47a5('0x9'));var client=jayson['client'][_0x47a5('0xa')]({'port':0x232a});function respondWithRpcPromise(_0x59199c,_0x343372,_0x30e405){return new BPromise(function(_0x506eda,_0x194fb0){return client['request'](_0x59199c,_0x30e405)['then'](function(_0x582352){logger[_0x47a5('0xb')](_0x47a5('0xc'),_0x343372,'request\x20sent');logger[_0x47a5('0xd')]('Network,\x20%s,\x20%s,\x20%s',_0x343372,'request\x20sent',JSON[_0x47a5('0xe')](_0x582352));if(_0x582352[_0x47a5('0xf')]){if(_0x582352[_0x47a5('0xf')][_0x47a5('0x10')]===0x1f4){logger[_0x47a5('0xf')](_0x47a5('0xc'),_0x343372,_0x582352[_0x47a5('0xf')]['message']);return _0x194fb0(_0x582352[_0x47a5('0xf')][_0x47a5('0x11')]);}logger[_0x47a5('0xf')](_0x47a5('0xc'),_0x343372,_0x582352[_0x47a5('0xf')][_0x47a5('0x11')]);return _0x506eda(_0x582352[_0x47a5('0xf')][_0x47a5('0x11')]);}else{logger['info'](_0x47a5('0xc'),_0x343372,_0x47a5('0x12'));_0x506eda(_0x582352[_0x47a5('0x13')][_0x47a5('0x11')]);}})[_0x47a5('0x14')](function(_0x574af6){logger['error'](_0x47a5('0xc'),_0x343372,_0x574af6);_0x194fb0(_0x574af6);});});} \ No newline at end of file +var _0x7a54=['info','Network,\x20%s,\x20%s','debug','stringify','error','code','message','request\x20sent','result','catch','lodash','util','moment','randomstring','ioredis','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','http'];(function(_0x3ab51d,_0x2fa01d){var _0x29a04e=function(_0x7807b0){while(--_0x7807b0){_0x3ab51d['push'](_0x3ab51d['shift']());}};_0x29a04e(++_0x2fa01d);}(_0x7a54,0x106));var _0x47a5=function(_0x36b741,_0x2e2d30){_0x36b741=_0x36b741-0x0;var _0x3cd9ee=_0x7a54[_0x36b741];return _0x3cd9ee;};'use strict';var _=require(_0x47a5('0x0'));var util=require(_0x47a5('0x1'));var moment=require(_0x47a5('0x2'));var BPromise=require('bluebird');var rs=require(_0x47a5('0x3'));var fs=require('fs');var Redis=require(_0x47a5('0x4'));var db=require('../../mysqldb')['db'];var utils=require(_0x47a5('0x5'));var logger=require(_0x47a5('0x6'))(_0x47a5('0x7'));var config=require(_0x47a5('0x8'));var jayson=require(_0x47a5('0x9'));var client=jayson['client'][_0x47a5('0xa')]({'port':0x232a});function respondWithRpcPromise(_0x59199c,_0x343372,_0x30e405){return new BPromise(function(_0x506eda,_0x194fb0){return client['request'](_0x59199c,_0x30e405)['then'](function(_0x582352){logger[_0x47a5('0xb')](_0x47a5('0xc'),_0x343372,'request\x20sent');logger[_0x47a5('0xd')]('Network,\x20%s,\x20%s,\x20%s',_0x343372,'request\x20sent',JSON[_0x47a5('0xe')](_0x582352));if(_0x582352[_0x47a5('0xf')]){if(_0x582352[_0x47a5('0xf')][_0x47a5('0x10')]===0x1f4){logger[_0x47a5('0xf')](_0x47a5('0xc'),_0x343372,_0x582352[_0x47a5('0xf')]['message']);return _0x194fb0(_0x582352[_0x47a5('0xf')][_0x47a5('0x11')]);}logger[_0x47a5('0xf')](_0x47a5('0xc'),_0x343372,_0x582352[_0x47a5('0xf')][_0x47a5('0x11')]);return _0x506eda(_0x582352[_0x47a5('0xf')][_0x47a5('0x11')]);}else{logger['info'](_0x47a5('0xc'),_0x343372,_0x47a5('0x12'));_0x506eda(_0x582352[_0x47a5('0x13')][_0x47a5('0x11')]);}})[_0x47a5('0x14')](function(_0x574af6){logger['error'](_0x47a5('0xc'),_0x343372,_0x574af6);_0x194fb0(_0x574af6);});});} \ No newline at end of file diff --git a/server/api/openchannelAccount/index.js b/server/api/openchannelAccount/index.js index 8f8c353..bda2a15 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 _0x3d04=['multer','util','path','connect-timeout','express','Router','fs-extra','../../components/auth/service','../../config/environment','./openchannelAccount.controller','get','isAuthenticated','describe','/:id','show','/:id/canned_answers','getAnswers','getApplications','/:id/interactions','getInteractions','/:id/users','getAgents','create','post','/:id/dispositions','addAnswer','/:id/notify','/:id/applications','addAgents','/:id/send','send','put','update','delete','destroy','removeDispositions','removeAgents','exports'];(function(_0x189f03,_0x225682){var _0x1bbfc7=function(_0xe2e19f){while(--_0xe2e19f){_0x189f03['push'](_0x189f03['shift']());}};_0x1bbfc7(++_0x225682);}(_0x3d04,0xbe));var _0x43d0=function(_0x3bf83f,_0x181cac){_0x3bf83f=_0x3bf83f-0x0;var _0x22c4a9=_0x3d04[_0x3bf83f];return _0x22c4a9;};'use strict';var multer=require(_0x43d0('0x0'));var util=require(_0x43d0('0x1'));var path=require(_0x43d0('0x2'));var timeout=require(_0x43d0('0x3'));var express=require(_0x43d0('0x4'));var router=express[_0x43d0('0x5')]();var fs_extra=require(_0x43d0('0x6'));var auth=require(_0x43d0('0x7'));var interaction=require('../../components/interaction/service');var config=require(_0x43d0('0x8'));var controller=require(_0x43d0('0x9'));router[_0x43d0('0xa')]('/',auth[_0x43d0('0xb')](),controller['index']);router['get']('/describe',auth['isAuthenticated'](),controller[_0x43d0('0xc')]);router[_0x43d0('0xa')](_0x43d0('0xd'),auth[_0x43d0('0xb')](),controller[_0x43d0('0xe')]);router['get']('/:id/dispositions',auth[_0x43d0('0xb')](),controller['getDispositions']);router['get'](_0x43d0('0xf'),auth[_0x43d0('0xb')](),controller[_0x43d0('0x10')]);router[_0x43d0('0xa')]('/:id/applications',auth[_0x43d0('0xb')](),controller[_0x43d0('0x11')]);router['get'](_0x43d0('0x12'),auth[_0x43d0('0xb')](),controller[_0x43d0('0x13')]);router['get'](_0x43d0('0x14'),auth[_0x43d0('0xb')](),controller[_0x43d0('0x15')]);router['post']('/',auth[_0x43d0('0xb')](),controller[_0x43d0('0x16')]);router[_0x43d0('0x17')](_0x43d0('0x18'),auth[_0x43d0('0xb')](),controller['addDisposition']);router['post'](_0x43d0('0xf'),auth[_0x43d0('0xb')](),controller[_0x43d0('0x19')]);router['post'](_0x43d0('0x1a'),controller['notify']);router[_0x43d0('0x17')](_0x43d0('0x1b'),auth[_0x43d0('0xb')](),controller['addApplications']);router[_0x43d0('0x17')](_0x43d0('0x14'),auth['isAuthenticated'](),controller[_0x43d0('0x1c')]);router[_0x43d0('0x17')](_0x43d0('0x1d'),auth[_0x43d0('0xb')](),controller[_0x43d0('0x1e')]);router[_0x43d0('0x1f')](_0x43d0('0xd'),auth[_0x43d0('0xb')](),controller[_0x43d0('0x20')]);router[_0x43d0('0x21')](_0x43d0('0xd'),auth[_0x43d0('0xb')](),controller[_0x43d0('0x22')]);router[_0x43d0('0x21')](_0x43d0('0x18'),auth['isAuthenticated'](),controller[_0x43d0('0x23')]);router[_0x43d0('0x21')]('/:id/canned_answers',auth[_0x43d0('0xb')](),controller['removeAnswers']);router[_0x43d0('0x21')](_0x43d0('0x14'),auth['isAuthenticated'](),controller[_0x43d0('0x24')]);module[_0x43d0('0x25')]=router; \ No newline at end of file +var _0x7096=['removeAgents','exports','util','connect-timeout','Router','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','./openchannelAccount.controller','get','isAuthenticated','index','/describe','describe','show','/:id/dispositions','getDispositions','getAnswers','/:id/applications','getApplications','/:id/interactions','getInteractions','/:id/users','post','create','addDisposition','/:id/notify','addAgents','/:id/send','send','put','/:id','update','delete','destroy','removeDispositions','removeAnswers'];(function(_0x5d30f9,_0x16447b){var _0x4c9f07=function(_0x300347){while(--_0x300347){_0x5d30f9['push'](_0x5d30f9['shift']());}};_0x4c9f07(++_0x16447b);}(_0x7096,0x10c));var _0x6709=function(_0x1e7b16,_0x4607a1){_0x1e7b16=_0x1e7b16-0x0;var _0x37fadc=_0x7096[_0x1e7b16];return _0x37fadc;};'use strict';var multer=require('multer');var util=require(_0x6709('0x0'));var path=require('path');var timeout=require(_0x6709('0x1'));var express=require('express');var router=express[_0x6709('0x2')]();var fs_extra=require(_0x6709('0x3'));var auth=require(_0x6709('0x4'));var interaction=require(_0x6709('0x5'));var config=require(_0x6709('0x6'));var controller=require(_0x6709('0x7'));router[_0x6709('0x8')]('/',auth[_0x6709('0x9')](),controller[_0x6709('0xa')]);router[_0x6709('0x8')](_0x6709('0xb'),auth[_0x6709('0x9')](),controller[_0x6709('0xc')]);router['get']('/:id',auth[_0x6709('0x9')](),controller[_0x6709('0xd')]);router[_0x6709('0x8')](_0x6709('0xe'),auth[_0x6709('0x9')](),controller[_0x6709('0xf')]);router['get']('/:id/canned_answers',auth[_0x6709('0x9')](),controller[_0x6709('0x10')]);router[_0x6709('0x8')](_0x6709('0x11'),auth[_0x6709('0x9')](),controller[_0x6709('0x12')]);router[_0x6709('0x8')](_0x6709('0x13'),auth['isAuthenticated'](),controller[_0x6709('0x14')]);router[_0x6709('0x8')](_0x6709('0x15'),auth[_0x6709('0x9')](),controller['getAgents']);router[_0x6709('0x16')]('/',auth['isAuthenticated'](),controller[_0x6709('0x17')]);router['post'](_0x6709('0xe'),auth[_0x6709('0x9')](),controller[_0x6709('0x18')]);router[_0x6709('0x16')]('/:id/canned_answers',auth['isAuthenticated'](),controller['addAnswer']);router[_0x6709('0x16')](_0x6709('0x19'),controller['notify']);router[_0x6709('0x16')](_0x6709('0x11'),auth[_0x6709('0x9')](),controller['addApplications']);router[_0x6709('0x16')](_0x6709('0x15'),auth[_0x6709('0x9')](),controller[_0x6709('0x1a')]);router['post'](_0x6709('0x1b'),auth[_0x6709('0x9')](),controller[_0x6709('0x1c')]);router[_0x6709('0x1d')](_0x6709('0x1e'),auth[_0x6709('0x9')](),controller[_0x6709('0x1f')]);router[_0x6709('0x20')](_0x6709('0x1e'),auth[_0x6709('0x9')](),controller[_0x6709('0x21')]);router[_0x6709('0x20')]('/:id/dispositions',auth[_0x6709('0x9')](),controller[_0x6709('0x22')]);router[_0x6709('0x20')]('/:id/canned_answers',auth[_0x6709('0x9')](),controller[_0x6709('0x23')]);router[_0x6709('0x20')](_0x6709('0x15'),auth['isAuthenticated'](),controller[_0x6709('0x24')]);module[_0x6709('0x25')]=router; \ No newline at end of file diff --git a/server/api/openchannelAccount/openchannelAccount.attributes.js b/server/api/openchannelAccount/openchannelAccount.attributes.js index 54b2f42..c054325 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 _0x23a1=['STRING','name','generate','TEXT','Account:\x20{{account.name}}
{{#queue}}Queue:\x20{{queue.name}}
{{/queue}}From\x20:\x20{{from}}','BOOLEAN','INTEGER','Status\x20to\x20put\x20when\x20mandatory\x20disposition\x20is\x20enabled','setDataValue','mandatoryDispositionPauseId','mandatoryDisposition','sequelize','randomstring','exports'];(function(_0x4b369d,_0x265eb8){var _0x571a98=function(_0x56341a){while(--_0x56341a){_0x4b369d['push'](_0x4b369d['shift']());}};_0x571a98(++_0x265eb8);}(_0x23a1,0x14d));var _0x123a=function(_0x122ef9,_0x451d2a){_0x122ef9=_0x122ef9-0x0;var _0x42fba0=_0x23a1[_0x122ef9];return _0x42fba0;};'use strict';var Sequelize=require(_0x123a('0x0'));var rs=require(_0x123a('0x1'));module[_0x123a('0x2')]={'name':{'type':Sequelize[_0x123a('0x3')],'unique':_0x123a('0x4'),'allowNull':![]},'description':{'type':Sequelize[_0x123a('0x3')]},'token':{'type':Sequelize[_0x123a('0x3')],'defaultValue':function(){return rs[_0x123a('0x5')]();}},'replyUri':{'type':Sequelize['STRING'],'validate':{'isUrl':!![]}},'key':{'type':Sequelize[_0x123a('0x3')],'allowNull':![]},'notificationTemplate':{'type':Sequelize[_0x123a('0x6')],'defaultValue':function(){return _0x123a('0x7');}},'notificationSound':{'type':Sequelize[_0x123a('0x8')],'defaultValue':!![]},'notificationShake':{'type':Sequelize[_0x123a('0x8')],'defaultValue':![]},'waitForTheAssignedAgent':{'type':Sequelize['INTEGER'],'validate':{'min':0x1,'max':0x20c49b},'defaultValue':0xa},'waitForTheAssignedQueue':{'type':Sequelize['INTEGER'],'validate':{'min':0x1,'max':0x20c49b},'defaultValue':0xa},'mapKey':{'type':Sequelize[_0x123a('0x3')]},'queueTransfer':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'queueTransferTimeout':{'type':Sequelize['INTEGER'],'validate':{'min':0x1,'max':0x20c49b},'defaultValue':0x12c},'agentTransfer':{'type':Sequelize[_0x123a('0x8')],'defaultValue':![]},'agentTransferTimeout':{'type':Sequelize[_0x123a('0x9')],'validate':{'min':0x1,'max':0x20c49b},'defaultValue':0x12c},'mandatoryDispositionPauseId':{'type':Sequelize['INTEGER'],'allowNull':!![],'defaultValue':null,'comment':_0x123a('0xa')},'mandatoryDisposition':{'type':Sequelize[_0x123a('0x8')],'defaultValue':![],'comment':'Enabled/disables\x20mandatory\x20dispo\x20on\x20a\x20queue','set':function(_0x2fbb4c){if(!_0x2fbb4c)this[_0x123a('0xb')](_0x123a('0xc'),null);this[_0x123a('0xb')](_0x123a('0xd'),_0x2fbb4c);}}}; \ No newline at end of file +var _0x7c1e=['Account:\x20{{account.name}}
{{#queue}}Queue:\x20{{queue.name}}
{{/queue}}From\x20:\x20{{from}}','BOOLEAN','INTEGER','setDataValue','mandatoryDisposition','randomstring','exports','STRING','name','TEXT'];(function(_0x2d6d88,_0x2ea070){var _0x1991b0=function(_0x13b3fe){while(--_0x13b3fe){_0x2d6d88['push'](_0x2d6d88['shift']());}};_0x1991b0(++_0x2ea070);}(_0x7c1e,0x1ef));var _0xe7c1=function(_0x6e8cd,_0x55db57){_0x6e8cd=_0x6e8cd-0x0;var _0x4b1033=_0x7c1e[_0x6e8cd];return _0x4b1033;};'use strict';var Sequelize=require('sequelize');var rs=require(_0xe7c1('0x0'));module[_0xe7c1('0x1')]={'name':{'type':Sequelize[_0xe7c1('0x2')],'unique':_0xe7c1('0x3'),'allowNull':![]},'description':{'type':Sequelize[_0xe7c1('0x2')]},'token':{'type':Sequelize[_0xe7c1('0x2')],'defaultValue':function(){return rs['generate']();}},'replyUri':{'type':Sequelize[_0xe7c1('0x2')],'validate':{'isUrl':!![]}},'key':{'type':Sequelize[_0xe7c1('0x2')],'allowNull':![]},'notificationTemplate':{'type':Sequelize[_0xe7c1('0x4')],'defaultValue':function(){return _0xe7c1('0x5');}},'notificationSound':{'type':Sequelize[_0xe7c1('0x6')],'defaultValue':!![]},'notificationShake':{'type':Sequelize[_0xe7c1('0x6')],'defaultValue':![]},'waitForTheAssignedAgent':{'type':Sequelize[_0xe7c1('0x7')],'validate':{'min':0x1,'max':0x20c49b},'defaultValue':0xa},'waitForTheAssignedQueue':{'type':Sequelize[_0xe7c1('0x7')],'validate':{'min':0x1,'max':0x20c49b},'defaultValue':0xa},'mapKey':{'type':Sequelize[_0xe7c1('0x2')]},'queueTransfer':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'queueTransferTimeout':{'type':Sequelize['INTEGER'],'validate':{'min':0x1,'max':0x20c49b},'defaultValue':0x12c},'agentTransfer':{'type':Sequelize[_0xe7c1('0x6')],'defaultValue':![]},'agentTransferTimeout':{'type':Sequelize[_0xe7c1('0x7')],'validate':{'min':0x1,'max':0x20c49b},'defaultValue':0x12c},'mandatoryDispositionPauseId':{'type':Sequelize[_0xe7c1('0x7')],'allowNull':!![],'defaultValue':null,'comment':'Status\x20to\x20put\x20when\x20mandatory\x20disposition\x20is\x20enabled'},'mandatoryDisposition':{'type':Sequelize[_0xe7c1('0x6')],'defaultValue':![],'comment':'Enabled/disables\x20mandatory\x20dispo\x20on\x20a\x20queue','set':function(_0x19d9dd){if(!_0x19d9dd)this[_0xe7c1('0x8')]('mandatoryDispositionPauseId',null);this[_0xe7c1('0x8')](_0xe7c1('0x9'),_0x19d9dd);}}}; \ No newline at end of file diff --git a/server/api/openchannelAccount/openchannelAccount.controller.js b/server/api/openchannelAccount/openchannelAccount.controller.js index de60993..99899d2 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 _0x12af=['stack','send','index','Pause','mandatoryDispositionPause','map','rawAttributes','fieldName','type','key','model','name','query','attributes','fields','length','hasOwnProperty','sort','where','filters','pick','merge','VIRTUAL','filter','OpenchannelAccount','includeAll','include','findAll','rows','show','params','keys','intersection','options','find','create','body','user','Unable\x20to\x20retrieve\x20the\x20current\x20user','OpenchannelAccounts','UserProfileSection','userProfileId','describe','addDisposition','OpenchannelAccountId','Disposition','getDispositions','findOne','nolimit','ids','CannedAnswer','order','removeAnswers','CmContact','ValidationError','no\x20available\x20attributes','difference','updatedAt','createdAt','CompanyId','ListId','isNil','body\x20is\x20mandatory\x20and\x20not\x20empty','mapKey','mapKey\x20is\x20mandatory,\x20please\x20use\x20one\x20of\x20these:\x20','includes','mapKey\x20invalid,\x20please\x20use\x20one\x20of\x20these:\x20','from','Contacts','DESC','OpenchannelApplication','Applications','account','list','applications','orderBy','priority','asc','List','contact','firstName','lastName','threadId','OpenchannelInteraction','externalUrl','ContactId','spread','messageId','update','interaction','created','close','unmanaged','*,*,*,*','OpenchannelMessage','AttachmentId','UserId','User','unshift','agent','OpenchannelQueue','queueId','waitForTheAssignedQueue','EventManager','notify','addApplications','sequelize','transaction','ISOLATION_LEVELS','findAndCountAll','getApplications','getInteractions','Contact','Owner','fullname','internal','Tag','Tags','color','tag','addAgents','omit','emit','userOpenchannelAccount:save','removeAgents','isArray','userOpenchannelAccount:remove','getAgents','CmList','out','Messages','dataValues','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','moment','bluebird','mustache','util','to-csv','fs-extra','lodash','squel','crypto','desk.js','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/license/util','../../mysqldb','redis','defaults','localhost','./openchannelAccount.socket','register','client','request','then','request\x20sent','debug','stringify','error','code','message','OpenchannelAccount,\x20%s,\x20%s','info','result','catch','sendStatus','status','end','json','offset','undefined','limit','count','set','Content-Range','save','destroy','get','UserProfileResource'];(function(_0x121689,_0xfc6372){var _0x4ad7a5=function(_0xfd576){while(--_0xfd576){_0x121689['push'](_0x121689['shift']());}};_0x4ad7a5(++_0xfc6372);}(_0x12af,0x84));var _0xf12a=function(_0x432d38,_0x201399){_0x432d38=_0x432d38-0x0;var _0x39c577=_0x12af[_0x432d38];return _0x39c577;};'use strict';var emlformat=require(_0xf12a('0x0'));var rimraf=require(_0xf12a('0x1'));var zipdir=require(_0xf12a('0x2'));var jsonpatch=require(_0xf12a('0x3'));var rp=require(_0xf12a('0x4'));var moment=require(_0xf12a('0x5'));var BPromise=require(_0xf12a('0x6'));var Mustache=require(_0xf12a('0x7'));var util=require(_0xf12a('0x8'));var path=require('path');var sox=require('sox');var csv=require(_0xf12a('0x9'));var ejs=require('ejs');var fs=require('fs');var fs_extra=require(_0xf12a('0xa'));var _=require(_0xf12a('0xb'));var squel=require(_0xf12a('0xc'));var crypto=require(_0xf12a('0xd'));var jsforce=require('jsforce');var deskjs=require(_0xf12a('0xe'));var toCsv=require(_0xf12a('0x9'));var querystring=require('querystring');var Papa=require(_0xf12a('0xf'));var Redis=require(_0xf12a('0x10'));var authService=require(_0xf12a('0x11'));var qs=require(_0xf12a('0x12'));var as=require(_0xf12a('0x13'));var hardwareService=require(_0xf12a('0x14'));var logger=require(_0xf12a('0x15'))(_0xf12a('0x16'));var utils=require('../../config/utils');var config=require('../../config/environment');var licenseUtil=require(_0xf12a('0x17'));var db=require(_0xf12a('0x18'))['db'];config[_0xf12a('0x19')]=_[_0xf12a('0x1a')](config[_0xf12a('0x19')],{'host':_0xf12a('0x1b'),'port':0x18eb});var socket=require('socket.io-emitter')(new Redis(config['redis']));require(_0xf12a('0x1c'))[_0xf12a('0x1d')](socket);var jayson=require('jayson/promise');var client=jayson['client']['http']({'port':0x232c});var client9002=jayson[_0xf12a('0x1e')]['http']({'port':0x232a});function respondWithRpcPromise(_0x166b5e,_0x3c4efc,_0x534f0d,_0xccf221){return new BPromise(function(_0x39f1a9,_0x2a329e){var _0x4520fd=_0xccf221||client;return _0x4520fd[_0xf12a('0x1f')](_0x166b5e,_0x534f0d)[_0xf12a('0x20')](function(_0x482272){logger['info']('OpenchannelAccount,\x20%s,\x20%s',_0x3c4efc,_0xf12a('0x21'));logger[_0xf12a('0x22')]('OpenchannelAccount,\x20%s,\x20%s,\x20%s',_0x3c4efc,_0xf12a('0x21'),JSON[_0xf12a('0x23')](_0x482272));if(_0x482272[_0xf12a('0x24')]){if(_0x482272[_0xf12a('0x24')][_0xf12a('0x25')]===0x1f4){logger[_0xf12a('0x24')]('OpenchannelAccount,\x20%s,\x20%s',_0x3c4efc,_0x482272[_0xf12a('0x24')][_0xf12a('0x26')]);return _0x2a329e(_0x482272[_0xf12a('0x24')][_0xf12a('0x26')]);}logger[_0xf12a('0x24')](_0xf12a('0x27'),_0x3c4efc,_0x482272['error']['message']);return _0x39f1a9(_0x482272[_0xf12a('0x24')]['message']);}else{logger[_0xf12a('0x28')](_0xf12a('0x27'),_0x3c4efc,_0xf12a('0x21'));_0x39f1a9(_0x482272[_0xf12a('0x29')][_0xf12a('0x26')]);}})[_0xf12a('0x2a')](function(_0x12f796){logger[_0xf12a('0x24')](_0xf12a('0x27'),_0x3c4efc,_0x12f796);_0x2a329e(_0x12f796);});});}function respondWithStatusCode(_0x7095bb,_0x3e055a){_0x3e055a=_0x3e055a||0xcc;return function(_0x2a8b7b){if(_0x2a8b7b){return _0x7095bb[_0xf12a('0x2b')](_0x3e055a);}return _0x7095bb[_0xf12a('0x2c')](_0x3e055a)[_0xf12a('0x2d')]();};}function respondWithResult(_0x8a9ed8,_0x36382d){_0x36382d=_0x36382d||0xc8;return function(_0x7d9c95){if(_0x7d9c95){return _0x8a9ed8[_0xf12a('0x2c')](_0x36382d)[_0xf12a('0x2e')](_0x7d9c95);}};}function respondWithFilteredResult(_0x5c78f9,_0x3c93d2){return function(_0x466055){if(_0x466055){var _0x4bdfd2=typeof _0x3c93d2[_0xf12a('0x2f')]===_0xf12a('0x30')&&typeof _0x3c93d2[_0xf12a('0x31')]===_0xf12a('0x30');var _0x5a6862=_0x466055[_0xf12a('0x32')];var _0x27746f=_0x4bdfd2?0x0:_0x3c93d2[_0xf12a('0x2f')];var _0x729ddc=_0x4bdfd2?_0x466055[_0xf12a('0x32')]:_0x3c93d2[_0xf12a('0x2f')]+_0x3c93d2[_0xf12a('0x31')];var _0x5132ec;if(_0x729ddc>=_0x5a6862){_0x729ddc=_0x5a6862;_0x5132ec=0xc8;}else{_0x5132ec=0xce;}_0x5c78f9[_0xf12a('0x2c')](_0x5132ec);return _0x5c78f9[_0xf12a('0x33')](_0xf12a('0x34'),_0x27746f+'-'+_0x729ddc+'/'+_0x5a6862)[_0xf12a('0x2e')](_0x466055);}return null;};}function patchUpdates(_0x182998){return function(_0x125562){try{jsonpatch['apply'](_0x125562,_0x182998,!![]);}catch(_0x397ac6){return BPromise['reject'](_0x397ac6);}return _0x125562[_0xf12a('0x35')]();};}function saveUpdates(_0x21f987,_0x52ccf9){return function(_0x324e2e){if(_0x324e2e){return _0x324e2e['update'](_0x21f987)['then'](function(_0x4decec){return _0x4decec;});}return null;};}function removeEntity(_0x520a35,_0x2623c4){return function(_0x33cb44){if(_0x33cb44){return _0x33cb44[_0xf12a('0x36')]()[_0xf12a('0x20')](function(){var _0x36f224=_0x33cb44[_0xf12a('0x37')]({'plain':!![]});var _0x359293='OpenchannelAccounts';return db[_0xf12a('0x38')][_0xf12a('0x36')]({'where':{'type':_0x359293,'resourceId':_0x36f224['id']}})['then'](function(){return _0x33cb44;});})[_0xf12a('0x20')](function(){_0x520a35[_0xf12a('0x2c')](0xcc)['end']();});}};}function handleEntityNotFound(_0x18443e,_0x4cf36a){return function(_0x18c54a){if(!_0x18c54a){_0x18443e['sendStatus'](0x194);}return _0x18c54a;};}function handleError(_0xbf9699,_0x14686d){_0x14686d=_0x14686d||0x1f4;return function(_0x180673){logger['error'](_0x180673[_0xf12a('0x39')]);if(_0x180673['name']){delete _0x180673['name'];}_0xbf9699[_0xf12a('0x2c')](_0x14686d)[_0xf12a('0x3a')](_0x180673);};}exports[_0xf12a('0x3b')]=function(_0x58fc8c,_0x3e1ce9){var _0x24b68d={'include':[{'model':db[_0xf12a('0x3c')],'as':_0xf12a('0x3d')}]},_0x4b7056={},_0x3910e9={'count':0x0,'rows':[]};var _0x2a9772=_[_0xf12a('0x3e')](db['OpenchannelAccount'][_0xf12a('0x3f')],function(_0x310b85){return{'name':_0x310b85[_0xf12a('0x40')],'type':_0x310b85[_0xf12a('0x41')][_0xf12a('0x42')]};});_0x4b7056[_0xf12a('0x43')]=_[_0xf12a('0x3e')](_0x2a9772,_0xf12a('0x44'));_0x4b7056[_0xf12a('0x45')]=_['keys'](_0x58fc8c[_0xf12a('0x45')]);_0x4b7056['filters']=_['intersection'](_0x4b7056[_0xf12a('0x43')],_0x4b7056[_0xf12a('0x45')]);_0x24b68d[_0xf12a('0x46')]=_['intersection'](_0x4b7056[_0xf12a('0x43')],qs[_0xf12a('0x47')](_0x58fc8c[_0xf12a('0x45')][_0xf12a('0x47')]));_0x24b68d[_0xf12a('0x46')]=_0x24b68d[_0xf12a('0x46')][_0xf12a('0x48')]?_0x24b68d[_0xf12a('0x46')]:_0x4b7056[_0xf12a('0x43')];if(!_0x58fc8c[_0xf12a('0x45')][_0xf12a('0x49')]('nolimit')){_0x24b68d[_0xf12a('0x31')]=qs[_0xf12a('0x31')](_0x58fc8c['query'][_0xf12a('0x31')]);_0x24b68d[_0xf12a('0x2f')]=qs[_0xf12a('0x2f')](_0x58fc8c[_0xf12a('0x45')]['offset']);}_0x24b68d['order']=qs[_0xf12a('0x4a')](_0x58fc8c[_0xf12a('0x45')][_0xf12a('0x4a')]);_0x24b68d[_0xf12a('0x4b')]=qs[_0xf12a('0x4c')](_[_0xf12a('0x4d')](_0x58fc8c['query'],_0x4b7056['filters']),_0x2a9772);if(_0x58fc8c[_0xf12a('0x45')]['filter']){_0x24b68d[_0xf12a('0x4b')]=_[_0xf12a('0x4e')](_0x24b68d[_0xf12a('0x4b')],{'$or':_[_0xf12a('0x3e')](_0x2a9772,function(_0x1b0be5){if(_0x1b0be5['type']!==_0xf12a('0x4f')){var _0x371e14={};_0x371e14[_0x1b0be5[_0xf12a('0x44')]]={'$like':'%'+_0x58fc8c[_0xf12a('0x45')][_0xf12a('0x50')]+'%'};return _0x371e14;}})});}_0x24b68d=_[_0xf12a('0x4e')]({},_0x24b68d,_0x58fc8c['options']);var _0x3d0302={'where':_0x24b68d[_0xf12a('0x4b')]};return db[_0xf12a('0x51')][_0xf12a('0x32')](_0x3d0302)[_0xf12a('0x20')](function(_0x33f8e1){_0x3910e9[_0xf12a('0x32')]=_0x33f8e1;if(_0x58fc8c[_0xf12a('0x45')][_0xf12a('0x52')]){_0x24b68d[_0xf12a('0x53')]=[{'all':!![]}];}return db[_0xf12a('0x51')][_0xf12a('0x54')](_0x24b68d);})[_0xf12a('0x20')](function(_0x2334b5){_0x3910e9[_0xf12a('0x55')]=_0x2334b5;return _0x3910e9;})[_0xf12a('0x20')](respondWithFilteredResult(_0x3e1ce9,_0x24b68d))[_0xf12a('0x2a')](handleError(_0x3e1ce9,null));};exports[_0xf12a('0x56')]=function(_0x18adbb,_0xd8a448){var _0x4bd19d={'raw':![],'where':{'id':_0x18adbb[_0xf12a('0x57')]['id']},'include':[{'model':db['Pause'],'as':_0xf12a('0x3d')}]},_0x348c87={};_0x348c87[_0xf12a('0x43')]=_[_0xf12a('0x58')](db['OpenchannelAccount'][_0xf12a('0x3f')]);_0x348c87[_0xf12a('0x45')]=_[_0xf12a('0x58')](_0x18adbb[_0xf12a('0x45')]);_0x348c87[_0xf12a('0x4c')]=_[_0xf12a('0x59')](_0x348c87[_0xf12a('0x43')],_0x348c87[_0xf12a('0x45')]);_0x4bd19d[_0xf12a('0x46')]=_['intersection'](_0x348c87['model'],qs['fields'](_0x18adbb['query']['fields']));_0x4bd19d[_0xf12a('0x46')]=_0x4bd19d['attributes'][_0xf12a('0x48')]?_0x4bd19d[_0xf12a('0x46')]:_0x348c87[_0xf12a('0x43')];if(_0x18adbb[_0xf12a('0x45')][_0xf12a('0x52')]){_0x4bd19d[_0xf12a('0x53')]=[{'all':!![]}];}_0x4bd19d=_['merge']({},_0x4bd19d,_0x18adbb[_0xf12a('0x5a')]);return db[_0xf12a('0x51')][_0xf12a('0x5b')](_0x4bd19d)['then'](handleEntityNotFound(_0xd8a448,null))[_0xf12a('0x20')](respondWithResult(_0xd8a448,null))['catch'](handleError(_0xd8a448,null));};exports[_0xf12a('0x5c')]=function(_0x5367b2,_0x3cc9fe){return db[_0xf12a('0x51')][_0xf12a('0x5c')](_0x5367b2[_0xf12a('0x5d')],{})[_0xf12a('0x20')](function(_0x5430f8){var _0x2e6173=_0x5367b2[_0xf12a('0x5e')][_0xf12a('0x37')]({'plain':!![]});if(!_0x2e6173)throw new Error(_0xf12a('0x5f'));if(_0x2e6173['role']==='user'){var _0x2e5481=_0x5430f8[_0xf12a('0x37')]({'plain':!![]});var _0x14171f=_0xf12a('0x60');return db[_0xf12a('0x61')][_0xf12a('0x5b')]({'where':{'name':_0x14171f,'userProfileId':_0x2e6173[_0xf12a('0x62')]},'raw':!![]})[_0xf12a('0x20')](function(_0x3da2fa){if(_0x3da2fa&&_0x3da2fa['autoAssociation']===0x0){return db['UserProfileResource'][_0xf12a('0x5c')]({'name':_0x2e5481[_0xf12a('0x44')],'resourceId':_0x2e5481['id'],'type':_0x3da2fa[_0xf12a('0x44')],'sectionId':_0x3da2fa['id']},{})[_0xf12a('0x20')](function(){return _0x5430f8;});}else{return _0x5430f8;}})[_0xf12a('0x2a')](function(_0x5eea08){logger[_0xf12a('0x24')]('Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s',_0x5eea08);throw _0x5eea08;});}return _0x5430f8;})[_0xf12a('0x20')](respondWithResult(_0x3cc9fe,0xc9))[_0xf12a('0x2a')](handleError(_0x3cc9fe,null));};exports['update']=function(_0x3f033d,_0x365644){if(_0x3f033d[_0xf12a('0x5d')]['id']){delete _0x3f033d['body']['id'];}return db[_0xf12a('0x51')]['find']({'where':{'id':_0x3f033d[_0xf12a('0x57')]['id']},'include':[{'model':db[_0xf12a('0x3c')],'as':'mandatoryDispositionPause'}]})[_0xf12a('0x20')](handleEntityNotFound(_0x365644,null))[_0xf12a('0x20')](saveUpdates(_0x3f033d[_0xf12a('0x5d')],null))[_0xf12a('0x20')](respondWithResult(_0x365644,null))['catch'](handleError(_0x365644,null));};exports['destroy']=function(_0x45314c,_0x3668a9){return db[_0xf12a('0x51')]['find']({'where':{'id':_0x45314c['params']['id']}})[_0xf12a('0x20')](handleEntityNotFound(_0x3668a9,null))[_0xf12a('0x20')](removeEntity(_0x3668a9,null))['catch'](handleError(_0x3668a9,null));};exports[_0xf12a('0x63')]=function(_0x550fbe,_0x176023){return db[_0xf12a('0x51')][_0xf12a('0x63')]()['then'](respondWithResult(_0x176023,null))[_0xf12a('0x2a')](handleError(_0x176023,null));};exports[_0xf12a('0x64')]=function(_0x46ee35,_0x90d1b5,_0x3ca472){if(_0x46ee35['body']['id']){delete _0x46ee35[_0xf12a('0x5d')]['id'];}return db['OpenchannelAccount'][_0xf12a('0x5b')]({'where':{'id':_0x46ee35[_0xf12a('0x57')]['id']}})[_0xf12a('0x20')](handleEntityNotFound(_0x90d1b5,null))[_0xf12a('0x20')](function(_0x330506){if(_0x330506){_0x46ee35[_0xf12a('0x5d')][_0xf12a('0x65')]=_0x330506['id'];return db[_0xf12a('0x66')][_0xf12a('0x5c')](_0x46ee35[_0xf12a('0x5d')]);}})[_0xf12a('0x20')](respondWithResult(_0x90d1b5,null))[_0xf12a('0x2a')](handleError(_0x90d1b5,null));};exports[_0xf12a('0x67')]=function(_0x53b270,_0x347bed,_0x2e16c9){var _0x2bb6cd={'raw':![],'where':{}};var _0x8f14da={};var _0x51dbce={'count':0x0,'rows':[]};return db[_0xf12a('0x51')][_0xf12a('0x68')]({'where':{'id':_0x53b270['params']['id']}})[_0xf12a('0x20')](handleEntityNotFound(_0x347bed,null))[_0xf12a('0x20')](function(_0x298452){if(_0x298452){_0x8f14da[_0xf12a('0x43')]=_[_0xf12a('0x58')](db['Disposition'][_0xf12a('0x3f')]);_0x8f14da[_0xf12a('0x45')]=_[_0xf12a('0x58')](_0x53b270[_0xf12a('0x45')]);_0x8f14da[_0xf12a('0x4c')]=_['intersection'](_0x8f14da[_0xf12a('0x43')],_0x8f14da[_0xf12a('0x45')]);_0x2bb6cd[_0xf12a('0x46')]=_[_0xf12a('0x59')](_0x8f14da[_0xf12a('0x43')],qs[_0xf12a('0x47')](_0x53b270['query'][_0xf12a('0x47')]));_0x2bb6cd[_0xf12a('0x46')]=_0x2bb6cd[_0xf12a('0x46')][_0xf12a('0x48')]?_0x2bb6cd[_0xf12a('0x46')]:_0x8f14da[_0xf12a('0x43')];if(!_0x53b270[_0xf12a('0x45')][_0xf12a('0x49')](_0xf12a('0x69'))){_0x2bb6cd[_0xf12a('0x31')]=qs['limit'](_0x53b270[_0xf12a('0x45')][_0xf12a('0x31')]);_0x2bb6cd['offset']=qs[_0xf12a('0x2f')](_0x53b270[_0xf12a('0x45')][_0xf12a('0x2f')]);}_0x2bb6cd['order']=qs[_0xf12a('0x4a')](_0x53b270[_0xf12a('0x45')][_0xf12a('0x4a')]);_0x2bb6cd['where']=qs[_0xf12a('0x4c')](_[_0xf12a('0x4d')](_0x53b270[_0xf12a('0x45')],_0x8f14da['filters']));_0x2bb6cd[_0xf12a('0x4b')][_0xf12a('0x65')]=_0x298452['id'];if(_0x53b270[_0xf12a('0x45')][_0xf12a('0x50')]){_0x2bb6cd[_0xf12a('0x4b')]=_[_0xf12a('0x4e')](_0x2bb6cd[_0xf12a('0x4b')],{'$or':_['map'](_0x2bb6cd[_0xf12a('0x46')],function(_0x793b9b){var _0x579306={};_0x579306[_0x793b9b]={'$like':'%'+_0x53b270[_0xf12a('0x45')][_0xf12a('0x50')]+'%'};return _0x579306;})});}_0x2bb6cd=_[_0xf12a('0x4e')]({},_0x2bb6cd,_0x53b270[_0xf12a('0x5a')]);return db['Disposition'][_0xf12a('0x32')]({'where':_0x2bb6cd[_0xf12a('0x4b')]})[_0xf12a('0x20')](function(_0x3e77c3){_0x51dbce[_0xf12a('0x32')]=_0x3e77c3;if(_0x53b270['query'][_0xf12a('0x52')]){_0x2bb6cd[_0xf12a('0x53')]=[{'all':!![]}];}return db[_0xf12a('0x66')][_0xf12a('0x54')](_0x2bb6cd);})[_0xf12a('0x20')](function(_0x3e83f3){_0x51dbce[_0xf12a('0x55')]=_0x3e83f3;return _0x51dbce;});}})[_0xf12a('0x20')](respondWithFilteredResult(_0x347bed,_0x2bb6cd))[_0xf12a('0x2a')](handleError(_0x347bed,null));};exports['removeDispositions']=function(_0x3ecbeb,_0x427c6e,_0xc58f17){return db[_0xf12a('0x51')][_0xf12a('0x5b')]({'where':{'id':_0x3ecbeb['params']['id']}})[_0xf12a('0x20')](handleEntityNotFound(_0x427c6e,null))[_0xf12a('0x20')](function(_0x371876){if(_0x371876){return _0x371876['removeDispositions'](_0x3ecbeb[_0xf12a('0x45')][_0xf12a('0x6a')]);}})[_0xf12a('0x20')](respondWithStatusCode(_0x427c6e,null))[_0xf12a('0x2a')](handleError(_0x427c6e,null));};exports['addAnswer']=function(_0x5a22ce,_0x3cc721,_0x33fa2c){if(_0x5a22ce[_0xf12a('0x5d')]['id']){delete _0x5a22ce[_0xf12a('0x5d')]['id'];}return db['OpenchannelAccount'][_0xf12a('0x5b')]({'where':{'id':_0x5a22ce[_0xf12a('0x57')]['id']}})[_0xf12a('0x20')](handleEntityNotFound(_0x3cc721,null))[_0xf12a('0x20')](function(_0x2d62d4){if(_0x2d62d4){_0x5a22ce[_0xf12a('0x5d')]['OpenchannelAccountId']=_0x2d62d4['id'];return db['CannedAnswer'][_0xf12a('0x5c')](_0x5a22ce[_0xf12a('0x5d')]);}})[_0xf12a('0x20')](respondWithResult(_0x3cc721,null))['catch'](handleError(_0x3cc721,null));};exports['getAnswers']=function(_0x2090ed,_0x16c63c,_0x35dc91){var _0x464189={'raw':![],'where':{}};var _0x29effa={};var _0x2aa245={'count':0x0,'rows':[]};return db[_0xf12a('0x51')][_0xf12a('0x68')]({'where':{'id':_0x2090ed['params']['id']}})[_0xf12a('0x20')](handleEntityNotFound(_0x16c63c,null))['then'](function(_0x4b2270){if(_0x4b2270){_0x29effa[_0xf12a('0x43')]=_[_0xf12a('0x58')](db[_0xf12a('0x6b')][_0xf12a('0x3f')]);_0x29effa[_0xf12a('0x45')]=_[_0xf12a('0x58')](_0x2090ed['query']);_0x29effa[_0xf12a('0x4c')]=_[_0xf12a('0x59')](_0x29effa[_0xf12a('0x43')],_0x29effa[_0xf12a('0x45')]);_0x464189[_0xf12a('0x46')]=_[_0xf12a('0x59')](_0x29effa[_0xf12a('0x43')],qs[_0xf12a('0x47')](_0x2090ed[_0xf12a('0x45')][_0xf12a('0x47')]));_0x464189[_0xf12a('0x46')]=_0x464189[_0xf12a('0x46')][_0xf12a('0x48')]?_0x464189[_0xf12a('0x46')]:_0x29effa[_0xf12a('0x43')];if(!_0x2090ed[_0xf12a('0x45')][_0xf12a('0x49')](_0xf12a('0x69'))){_0x464189[_0xf12a('0x31')]=qs[_0xf12a('0x31')](_0x2090ed['query'][_0xf12a('0x31')]);_0x464189[_0xf12a('0x2f')]=qs[_0xf12a('0x2f')](_0x2090ed[_0xf12a('0x45')][_0xf12a('0x2f')]);}_0x464189[_0xf12a('0x6c')]=qs[_0xf12a('0x4a')](_0x2090ed[_0xf12a('0x45')]['sort']);_0x464189[_0xf12a('0x4b')]=qs['filters'](_['pick'](_0x2090ed['query'],_0x29effa[_0xf12a('0x4c')]));_0x464189[_0xf12a('0x4b')][_0xf12a('0x65')]=_0x4b2270['id'];if(_0x2090ed[_0xf12a('0x45')][_0xf12a('0x50')]){_0x464189[_0xf12a('0x4b')]=_[_0xf12a('0x4e')](_0x464189[_0xf12a('0x4b')],{'$or':_[_0xf12a('0x3e')](_0x464189[_0xf12a('0x46')],function(_0x402a85){var _0xd76793={};_0xd76793[_0x402a85]={'$like':'%'+_0x2090ed[_0xf12a('0x45')]['filter']+'%'};return _0xd76793;})});}_0x464189=_[_0xf12a('0x4e')]({},_0x464189,_0x2090ed[_0xf12a('0x5a')]);return db[_0xf12a('0x6b')][_0xf12a('0x32')]({'where':_0x464189[_0xf12a('0x4b')]})['then'](function(_0x53f6fc){_0x2aa245['count']=_0x53f6fc;if(_0x2090ed[_0xf12a('0x45')]['includeAll']){_0x464189[_0xf12a('0x53')]=[{'all':!![]}];}return db[_0xf12a('0x6b')]['findAll'](_0x464189);})[_0xf12a('0x20')](function(_0x5a59a1){_0x2aa245[_0xf12a('0x55')]=_0x5a59a1;return _0x2aa245;});}})['then'](respondWithFilteredResult(_0x16c63c,_0x464189))[_0xf12a('0x2a')](handleError(_0x16c63c,null));};exports[_0xf12a('0x6d')]=function(_0xc88b66,_0x5753d1,_0x1d8edb){return db['OpenchannelAccount'][_0xf12a('0x5b')]({'where':{'id':_0xc88b66[_0xf12a('0x57')]['id']}})[_0xf12a('0x20')](handleEntityNotFound(_0x5753d1,null))['then'](function(_0x83caa3){if(_0x83caa3){return _0x83caa3[_0xf12a('0x6d')](_0xc88b66[_0xf12a('0x45')][_0xf12a('0x6a')]);}})[_0xf12a('0x20')](respondWithStatusCode(_0x5753d1,null))['catch'](handleError(_0x5753d1,null));};exports['notify']=function(_0x3847f2,_0xdb753c,_0x4fae3e){var _0x387ef9={'body':_0x3847f2[_0xf12a('0x5d')],'channel':'openchannel'};var _0xe92f9e=[];var _0x5495c8=[];var _0x398f47={};var _0x6aeca2=![];return db[_0xf12a('0x6e')]['describe']()[_0xf12a('0x20')](function(_0x246ef3){if(!_0x246ef3){throw new db['Sequelize'][(_0xf12a('0x6f'))](_0xf12a('0x70'));}_0xe92f9e=_[_0xf12a('0x71')](_[_0xf12a('0x58')](_0x246ef3),['createdAt',_0xf12a('0x72')]);_0x5495c8=_[_0xf12a('0x71')](_[_0xf12a('0x58')](_0x246ef3),[_0xf12a('0x73'),_0xf12a('0x72'),_0xf12a('0x74'),_0xf12a('0x75')]);if(_0x3847f2[_0xf12a('0x5d')]['id']){delete _0x3847f2['body']['id'];}if(_[_0xf12a('0x76')](_0x3847f2[_0xf12a('0x5d')]['from'])){throw new db['Sequelize'][(_0xf12a('0x6f'))]('from\x20is\x20mandatory');}if(_[_0xf12a('0x76')](_0x3847f2[_0xf12a('0x5d')][_0xf12a('0x5d')])||_0x3847f2[_0xf12a('0x5d')]['body']===''){throw new db['Sequelize'][(_0xf12a('0x6f'))](_0xf12a('0x77'));}if(_[_0xf12a('0x76')](_0x3847f2['body'][_0xf12a('0x78')])){throw new db['Sequelize'][(_0xf12a('0x6f'))](_0xf12a('0x79')+_0x5495c8);}if(!_[_0xf12a('0x7a')](_0x5495c8,_0x3847f2[_0xf12a('0x5d')][_0xf12a('0x78')])){throw new db['Sequelize'][(_0xf12a('0x6f'))](_0xf12a('0x7b')+_0x5495c8);}_0x398f47[_0x3847f2[_0xf12a('0x5d')]['mapKey']]=_0x3847f2[_0xf12a('0x5d')][_0xf12a('0x7c')];})[_0xf12a('0x20')](function(){return db[_0xf12a('0x51')][_0xf12a('0x5b')]({'where':{'id':_0x3847f2[_0xf12a('0x57')]['id']},'include':[{'model':db['CmList'],'as':'List','include':[{'model':db[_0xf12a('0x6e')],'as':_0xf12a('0x7d'),'where':_0x398f47,'limit':0x1,'order':[[_0xf12a('0x72'),_0xf12a('0x7e')]]}]},{'model':db[_0xf12a('0x7f')],'as':_0xf12a('0x80')}]});})[_0xf12a('0x20')](handleEntityNotFound(_0xdb753c,null))['then'](function(_0x16340b){if(_0x16340b&&_0x16340b['List']){_0x387ef9[_0xf12a('0x81')]=_0x16340b;_0x387ef9['applications']=_0x16340b[_0xf12a('0x80')];_0x387ef9[_0xf12a('0x82')]=_0x16340b['List'];_0x387ef9[_0xf12a('0x83')]=_[_0xf12a('0x84')](_0x387ef9['applications'],[_0xf12a('0x85')],[_0xf12a('0x86')]);if(_0x387ef9[_0xf12a('0x81')]['Applications']){delete _0x387ef9[_0xf12a('0x81')][_0xf12a('0x80')];}if(_0x387ef9['account'][_0xf12a('0x87')]&&_0x387ef9['account'][_0xf12a('0x87')][_0xf12a('0x7d')][_0xf12a('0x48')]){return _0x387ef9[_0xf12a('0x81')]['List'][_0xf12a('0x7d')][0x0];}var _0x40b8ad=_[_0xf12a('0x1a')](_0x3847f2[_0xf12a('0x5d')],{'firstName':_0x3847f2[_0xf12a('0x5d')][_0xf12a('0x7c')],'ListId':_0x16340b[_0xf12a('0x75')]});_0x40b8ad[_0x3847f2[_0xf12a('0x5d')]['mapKey']]=_0x3847f2['body'][_0xf12a('0x7c')];return db[_0xf12a('0x6e')][_0xf12a('0x5c')](_0x40b8ad,{'fields':_0xe92f9e,'raw':!![]});}})[_0xf12a('0x20')](handleEntityNotFound(_0xdb753c,null))['then'](function(_0x1443c9){_0x387ef9[_0xf12a('0x88')]=_0x1443c9;if(_0x1443c9){var _0x202965={'ContactId':_0x1443c9['id'],'OpenchannelAccountId':_0x3847f2[_0xf12a('0x57')]['id'],'from':(_0x1443c9[_0xf12a('0x89')]||'')+'\x20'+(_0x1443c9[_0xf12a('0x8a')]||'')};var _0x43c175={'OpenchannelAccountId':_0x3847f2[_0xf12a('0x57')]['id'],'closed':![]};if(_0x3847f2[_0xf12a('0x5d')][_0xf12a('0x8b')]){_0x43c175[_0xf12a('0x8b')]=_0x3847f2[_0xf12a('0x5d')][_0xf12a('0x8b')];return db[_0xf12a('0x8c')]['find']({'where':_0x43c175})[_0xf12a('0x20')](function(_0x4ba2e0){if(_0x4ba2e0){return[_0x4ba2e0,![]];}_0x202965[_0xf12a('0x8b')]=_0x3847f2['body']['threadId'];_0x202965[_0xf12a('0x8d')]=_0x3847f2['body']['externalUrl'];return db['OpenchannelInteraction'][_0xf12a('0x5c')](_0x202965)['then'](function(_0x365859){return[_0x365859,!![]];});});}else{_0x43c175[_0xf12a('0x8b')]=null;}_0x43c175[_0xf12a('0x8e')]=_0x1443c9['id'];return db['OpenchannelInteraction'][_0xf12a('0x5b')]({'where':_0x43c175})['then'](function(_0x3001b6){if(_0x3001b6){return[_0x3001b6,![]];}return db[_0xf12a('0x8c')][_0xf12a('0x5c')](_0x202965)[_0xf12a('0x20')](function(_0x248a90){return[_0x248a90,!![]];});});}})[_0xf12a('0x8f')](function(_0x3a7dd1,_0x4ee571){if(_0x3a7dd1){_0x6aeca2=_0x4ee571;if(!_0x4ee571){var _0x50b982={'from':(_0x387ef9[_0xf12a('0x88')][_0xf12a('0x89')]||'')+'\x20'+(_0x387ef9[_0xf12a('0x88')][_0xf12a('0x8a')]||'')};if(_0x3847f2[_0xf12a('0x5d')][_0xf12a('0x8b')]&&_0x3847f2[_0xf12a('0x5d')][_0xf12a('0x90')]&&_0x3847f2[_0xf12a('0x5d')][_0xf12a('0x8b')]!=_0x3847f2[_0xf12a('0x5d')]['messageId']){_0x50b982[_0xf12a('0x8b')]=_0x3847f2[_0xf12a('0x5d')][_0xf12a('0x90')];}return _0x3a7dd1[_0xf12a('0x91')](_0x50b982);}else{return _0x3a7dd1;}}})[_0xf12a('0x20')](function(_0x349562){_0x387ef9[_0xf12a('0x92')]=_0x349562[_0xf12a('0x37')]({'plain':!![]});_0x387ef9[_0xf12a('0x92')][_0xf12a('0x93')]=_0x6aeca2;if(_0x387ef9[_0xf12a('0x92')]['created']){if(_0x387ef9[_0xf12a('0x81')]['autoclose']){_0x387ef9['applications']['push']({'id':0x0,'priority':_0x387ef9[_0xf12a('0x83')][_0xf12a('0x48')]+0x1,'app':_0xf12a('0x94'),'appdata':_0xf12a('0x95'),'interval':_0xf12a('0x96')});}}return db[_0xf12a('0x97')][_0xf12a('0x5c')]({'body':_0x3847f2[_0xf12a('0x5d')][_0xf12a('0x5d')],'OpenchannelAccountId':_0x3847f2[_0xf12a('0x57')]['id'],'OpenchannelInteractionId':_0x349562['id'],'direction':'in','ContactId':_0x387ef9[_0xf12a('0x88')]['id'],'AttachmentId':_0x3847f2['body'][_0xf12a('0x98')]});})[_0xf12a('0x20')](function(_0x5c3051){_0x387ef9[_0xf12a('0x26')]=_0x5c3051;if(!_0x387ef9[_0xf12a('0x92')][_0xf12a('0x99')])return;return db[_0xf12a('0x9a')]['find']({'attributes':['id',_0xf12a('0x44')],'where':{'id':_0x387ef9[_0xf12a('0x92')][_0xf12a('0x99')]}});})['then'](function(_0x36423d){if(_0x36423d){_0x387ef9[_0xf12a('0x83')][_0xf12a('0x9b')]({'id':0x0,'priority':0x0,'app':_0xf12a('0x9c'),'appdata':_0x36423d[_0xf12a('0x44')]+','+(_0x387ef9[_0xf12a('0x81')]['waitForTheAssignedAgent']||0xa),'interval':_0xf12a('0x96')});}if(!_0x387ef9[_0xf12a('0x92')]['queueId'])return;return db[_0xf12a('0x9d')][_0xf12a('0x5b')]({'attributes':['id',_0xf12a('0x44')],'where':{'id':_0x387ef9[_0xf12a('0x92')][_0xf12a('0x9e')]}});})[_0xf12a('0x20')](function(_0x2f77ea){if(_0x2f77ea){_0x387ef9[_0xf12a('0x83')][_0xf12a('0x9b')]({'id':0x0,'priority':0x1,'app':'queue','appdata':_0x2f77ea[_0xf12a('0x44')]+','+(_0x387ef9[_0xf12a('0x81')][_0xf12a('0x9f')]||0x12c),'interval':_0xf12a('0x96')});}return respondWithRpcPromise('Start','startRouting',_0x387ef9);})['then'](function(_0x4e6e27){respondWithRpcPromise('EventManager',_0xf12a('0xa0'),{'event':_0xf12a('0xa1'),'message':_0x4e6e27},client9002);return _0x4e6e27;})[_0xf12a('0x20')](respondWithResult(_0xdb753c,null))[_0xf12a('0x2a')](handleError(_0xdb753c,null));};exports[_0xf12a('0xa2')]=function(_0x4f2078,_0x42d9ae){var _0x4937c6=_0x4f2078['params']['id'];var _0x1db0db=_0x4f2078['body'];var _0x2d862e=0xc8;var _0x6c2a2c=null;return db[_0xf12a('0xa3')][_0xf12a('0xa4')]({'isolationLevel':db[_0xf12a('0xa3')]['Transaction'][_0xf12a('0xa5')]['READ_COMMITTED']},function(_0x1c36cb){return db[_0xf12a('0x51')][_0xf12a('0x68')]({'where':{'id':_0x4937c6},'transaction':_0x1c36cb})[_0xf12a('0x20')](function(_0x2e87c2){if(_0x2e87c2){return db[_0xf12a('0x7f')][_0xf12a('0x36')]({'where':{'OpenchannelAccountId':_0x4937c6},'transaction':_0x1c36cb})[_0xf12a('0x20')](function(){var _0x20346a=_[_0xf12a('0x3e')](_0x1db0db,function(_0x11e96a){_0x11e96a[_0xf12a('0x65')]=_0x4937c6;return _0x11e96a;});return db[_0xf12a('0x7f')]['bulkCreate'](_0x20346a,{'transaction':_0x1c36cb});});}else{_0x2d862e=0x194;_0x6c2a2c=[];}});})[_0xf12a('0x20')](function(){if(_0x2d862e!==0x194){return db[_0xf12a('0x7f')][_0xf12a('0xa6')]({'where':{'OpenchannelAccountId':_0x4937c6},'order':_0xf12a('0x85')})[_0xf12a('0x20')](function(_0x539a5d){_0x6c2a2c=_0x539a5d;});}})[_0xf12a('0x2a')](function(_0x2c5363){_0x2d862e=0x1f4;logger[_0xf12a('0x24')](_0x2c5363[_0xf12a('0x39')]);if(_0x2c5363[_0xf12a('0x44')]){delete _0x2c5363[_0xf12a('0x44')];}_0x6c2a2c=_0x2c5363;})['finally'](function(){if(_0x6c2a2c===null){_0x42d9ae[_0xf12a('0x2b')](_0x2d862e);}else{if(_0x2d862e===0x1f4){_0x42d9ae[_0xf12a('0x2c')](_0x2d862e)['send'](_0x6c2a2c);}else{_0x42d9ae[_0xf12a('0x2c')](_0x2d862e)['json'](_0x6c2a2c);}}});};exports[_0xf12a('0xa7')]=function(_0x2cba5b,_0xb53dc4,_0x1ad679){var _0x595f20={};var _0x3107dd={};var _0x1c561d;var _0x3ad762;return db[_0xf12a('0x51')]['findOne']({'where':{'id':_0x2cba5b[_0xf12a('0x57')]['id']}})[_0xf12a('0x20')](handleEntityNotFound(_0xb53dc4,null))[_0xf12a('0x20')](function(_0x47eda2){if(_0x47eda2){_0x1c561d=_0x47eda2;_0x3107dd[_0xf12a('0x43')]=_[_0xf12a('0x58')](db['OpenchannelApplication'][_0xf12a('0x3f')]);_0x3107dd[_0xf12a('0x45')]=_['keys'](_0x2cba5b[_0xf12a('0x45')]);_0x3107dd[_0xf12a('0x4c')]=_['intersection'](_0x3107dd[_0xf12a('0x43')],_0x3107dd['query']);_0x595f20['attributes']=_[_0xf12a('0x59')](_0x3107dd[_0xf12a('0x43')],qs['fields'](_0x2cba5b[_0xf12a('0x45')][_0xf12a('0x47')]));_0x595f20[_0xf12a('0x46')]=_0x595f20['attributes'][_0xf12a('0x48')]?_0x595f20['attributes']:_0x3107dd[_0xf12a('0x43')];_0x595f20['order']=qs[_0xf12a('0x4a')](_0x2cba5b[_0xf12a('0x45')][_0xf12a('0x4a')]);_0x595f20[_0xf12a('0x4b')]=qs[_0xf12a('0x4c')](_[_0xf12a('0x4d')](_0x2cba5b[_0xf12a('0x45')],_0x3107dd[_0xf12a('0x4c')]));if(_0x2cba5b['query']['filter']){_0x595f20[_0xf12a('0x4b')]=_[_0xf12a('0x4e')](_0x595f20[_0xf12a('0x4b')],{'$or':_[_0xf12a('0x3e')](_0x595f20[_0xf12a('0x46')],function(_0x292f06){var _0x2d8283={};_0x2d8283[_0x292f06]={'$like':'%'+_0x2cba5b[_0xf12a('0x45')]['filter']+'%'};return _0x2d8283;})});}_0x595f20=_['merge']({},_0x595f20,_0x2cba5b[_0xf12a('0x5a')]);return _0x1c561d[_0xf12a('0xa7')](_0x595f20);}})[_0xf12a('0x20')](function(_0x46dc06){if(_0x46dc06){_0x3ad762=_0x46dc06[_0xf12a('0x48')];if(!_0x2cba5b[_0xf12a('0x45')][_0xf12a('0x49')](_0xf12a('0x69'))){_0x595f20[_0xf12a('0x31')]=qs['limit'](_0x2cba5b[_0xf12a('0x45')][_0xf12a('0x31')]);_0x595f20[_0xf12a('0x2f')]=qs[_0xf12a('0x2f')](_0x2cba5b[_0xf12a('0x45')][_0xf12a('0x2f')]);}return _0x1c561d[_0xf12a('0xa7')](_0x595f20);}})[_0xf12a('0x20')](function(_0x3347a2){if(_0x3347a2){return _0x3347a2?{'count':_0x3ad762,'rows':_0x3347a2}:null;}})[_0xf12a('0x20')](respondWithResult(_0xb53dc4,null))[_0xf12a('0x2a')](handleError(_0xb53dc4,null));};exports[_0xf12a('0xa8')]=function(_0x3dffa7,_0x20b230,_0x4cf585){var _0x2b3ed9={'raw':![],'where':{}};var _0x1adef9={};var _0x486fb2={'count':0x0,'rows':[]};return db[_0xf12a('0x51')][_0xf12a('0x68')]({'where':{'id':_0x3dffa7[_0xf12a('0x57')]['id']}})[_0xf12a('0x20')](handleEntityNotFound(_0x20b230,null))[_0xf12a('0x20')](function(_0x5f0a85){if(_0x5f0a85){_0x1adef9[_0xf12a('0x43')]=_[_0xf12a('0x58')](db['OpenchannelInteraction'][_0xf12a('0x3f')]);_0x1adef9['query']=_['keys'](_0x3dffa7['query']);_0x1adef9[_0xf12a('0x4c')]=_[_0xf12a('0x59')](_0x1adef9[_0xf12a('0x43')],_0x1adef9[_0xf12a('0x45')]);_0x2b3ed9[_0xf12a('0x46')]=_['intersection'](_0x1adef9[_0xf12a('0x43')],qs[_0xf12a('0x47')](_0x3dffa7[_0xf12a('0x45')]['fields']));_0x2b3ed9[_0xf12a('0x46')]=_0x2b3ed9[_0xf12a('0x46')][_0xf12a('0x48')]?_0x2b3ed9[_0xf12a('0x46')]:_0x1adef9[_0xf12a('0x43')];if(!_0x3dffa7[_0xf12a('0x45')][_0xf12a('0x49')](_0xf12a('0x69'))){_0x2b3ed9[_0xf12a('0x31')]=qs['limit'](_0x3dffa7[_0xf12a('0x45')]['limit']);_0x2b3ed9[_0xf12a('0x2f')]=qs[_0xf12a('0x2f')](_0x3dffa7[_0xf12a('0x45')]['offset']);}_0x2b3ed9[_0xf12a('0x6c')]=qs[_0xf12a('0x4a')](_0x3dffa7[_0xf12a('0x45')]['sort']);_0x2b3ed9[_0xf12a('0x4b')]=qs['filters'](_[_0xf12a('0x4d')](_0x3dffa7[_0xf12a('0x45')],_0x1adef9[_0xf12a('0x4c')]));_0x2b3ed9[_0xf12a('0x4b')][_0xf12a('0x65')]=_0x5f0a85['id'];if(_0x3dffa7[_0xf12a('0x45')][_0xf12a('0x50')]){_0x2b3ed9[_0xf12a('0x4b')]=_['merge'](_0x2b3ed9['where'],{'$or':_['map'](_0x2b3ed9[_0xf12a('0x46')],function(_0x4213c2){var _0x130f53={};_0x130f53[_0x4213c2]={'$like':'%'+_0x3dffa7[_0xf12a('0x45')][_0xf12a('0x50')]+'%'};return _0x130f53;})});}_0x2b3ed9=_[_0xf12a('0x4e')]({},_0x2b3ed9,_0x3dffa7[_0xf12a('0x5a')]);return db[_0xf12a('0x8c')]['count']({'where':_0x2b3ed9[_0xf12a('0x4b')]})[_0xf12a('0x20')](function(_0x5d56dd){_0x486fb2[_0xf12a('0x32')]=_0x5d56dd;if(_0x3dffa7[_0xf12a('0x45')]['includeAll']){_0x2b3ed9[_0xf12a('0x53')]=[{'model':db['CmContact'],'as':_0xf12a('0xa9'),'required':![]},{'model':db['User'],'as':_0xf12a('0xaa'),'attributes':['name',_0xf12a('0xab'),_0xf12a('0xac')],'required':![]},{'model':db[_0xf12a('0xad')],'as':_0xf12a('0xae'),'attributes':['id',_0xf12a('0x44'),_0xf12a('0xaf')],'where':_0x3dffa7[_0xf12a('0x45')][_0xf12a('0xb0')]?{'id':_0x3dffa7[_0xf12a('0x45')]['tag']}:undefined,'required':_0x3dffa7[_0xf12a('0x45')][_0xf12a('0xb0')]?!![]:![]}];}return db[_0xf12a('0x8c')][_0xf12a('0x54')](_0x2b3ed9);})[_0xf12a('0x20')](function(_0x233e11){_0x486fb2[_0xf12a('0x55')]=_0x233e11;return _0x486fb2;});}})[_0xf12a('0x20')](respondWithFilteredResult(_0x20b230,_0x2b3ed9))[_0xf12a('0x2a')](handleError(_0x20b230,null));};exports['addAgents']=function(_0x49dd5e,_0xd16af,_0x55824b){return db[_0xf12a('0x51')][_0xf12a('0x5b')]({'where':{'id':_0x49dd5e['params']['id']}})['then'](handleEntityNotFound(_0xd16af,null))['then'](function(_0x4846f1){if(_0x4846f1){return _0x4846f1[_0xf12a('0xb1')](_0x49dd5e[_0xf12a('0x5d')][_0xf12a('0x6a')],_[_0xf12a('0xb2')](_0x49dd5e[_0xf12a('0x5d')],[_0xf12a('0x6a'),'id'])||{})[_0xf12a('0x8f')](function(_0x2dc55c){for(var _0x8ac8da=0x0;_0x8ac8da<_0x49dd5e['body'][_0xf12a('0x6a')][_0xf12a('0x48')];_0x8ac8da+=0x1){socket[_0xf12a('0xb3')](_0xf12a('0xb4'),{'UserId':Number(_0x49dd5e[_0xf12a('0x5d')][_0xf12a('0x6a')][_0x8ac8da]),'OpenchannelAccountId':Number(_0x49dd5e[_0xf12a('0x57')]['id'])});}return _0x2dc55c;});}})[_0xf12a('0x20')](respondWithResult(_0xd16af,null))[_0xf12a('0x2a')](handleError(_0xd16af,null));};exports[_0xf12a('0xb5')]=function(_0x299df3,_0xf77934,_0xb36596){return db[_0xf12a('0x51')][_0xf12a('0x5b')]({'where':{'id':_0x299df3[_0xf12a('0x57')]['id']}})['then'](handleEntityNotFound(_0xf77934,null))[_0xf12a('0x20')](function(_0x39b43c){if(_0x39b43c){return _0x39b43c[_0xf12a('0xb5')](_0x299df3[_0xf12a('0x45')][_0xf12a('0x6a')])[_0xf12a('0x20')](function(){if(_[_0xf12a('0xb6')](_0x299df3[_0xf12a('0x45')][_0xf12a('0x6a')])){for(var _0x2b5ef2=0x0;_0x2b5ef2<_0x299df3[_0xf12a('0x45')][_0xf12a('0x6a')][_0xf12a('0x48')];_0x2b5ef2+=0x1){socket['emit'](_0xf12a('0xb7'),{'UserId':Number(_0x299df3['query']['ids'][_0x2b5ef2]),'OpenchannelAccountId':Number(_0x299df3['params']['id'])});}}else{socket['emit'](_0xf12a('0xb7'),{'UserId':Number(_0x299df3['query'][_0xf12a('0x6a')]),'OpenchannelAccountId':Number(_0x299df3[_0xf12a('0x57')]['id'])});}});}})[_0xf12a('0x20')](respondWithStatusCode(_0xf77934,null))[_0xf12a('0x2a')](handleError(_0xf77934,null));};exports[_0xf12a('0xb8')]=function(_0x5614a5,_0x47c15d,_0x47decb){var _0x82e115={};var _0x3f41b0={};var _0x5abd5c;var _0x48393d;return db[_0xf12a('0x51')]['findOne']({'where':{'id':_0x5614a5[_0xf12a('0x57')]['id']}})[_0xf12a('0x20')](handleEntityNotFound(_0x47c15d,null))[_0xf12a('0x20')](function(_0x4c423e){if(_0x4c423e){_0x5abd5c=_0x4c423e;_0x3f41b0['model']=_[_0xf12a('0x58')](db['User'][_0xf12a('0x3f')]);_0x3f41b0[_0xf12a('0x45')]=_['keys'](_0x5614a5[_0xf12a('0x45')]);_0x3f41b0[_0xf12a('0x4c')]=_[_0xf12a('0x59')](_0x3f41b0[_0xf12a('0x43')],_0x3f41b0[_0xf12a('0x45')]);_0x82e115['attributes']=_[_0xf12a('0x59')](_0x3f41b0['model'],qs[_0xf12a('0x47')](_0x5614a5[_0xf12a('0x45')][_0xf12a('0x47')]));_0x82e115[_0xf12a('0x46')]=_0x82e115['attributes'][_0xf12a('0x48')]?_0x82e115[_0xf12a('0x46')]:_0x3f41b0[_0xf12a('0x43')];_0x82e115[_0xf12a('0x6c')]=qs[_0xf12a('0x4a')](_0x5614a5[_0xf12a('0x45')][_0xf12a('0x4a')]);_0x82e115[_0xf12a('0x4b')]=qs[_0xf12a('0x4c')](_[_0xf12a('0x4d')](_0x5614a5['query'],_0x3f41b0[_0xf12a('0x4c')]));if(_0x5614a5['query']['filter']){_0x82e115[_0xf12a('0x4b')]=_[_0xf12a('0x4e')](_0x82e115[_0xf12a('0x4b')],{'$or':_['map'](_0x82e115[_0xf12a('0x46')],function(_0x573d8a){var _0x571162={};_0x571162[_0x573d8a]={'$like':'%'+_0x5614a5[_0xf12a('0x45')]['filter']+'%'};return _0x571162;})});}_0x82e115=_[_0xf12a('0x4e')]({},_0x82e115,_0x5614a5['options']);return _0x5abd5c['getAgents'](_0x82e115);}})[_0xf12a('0x20')](function(_0x4c9da6){if(_0x4c9da6){_0x48393d=_0x4c9da6[_0xf12a('0x48')];if(!_0x5614a5[_0xf12a('0x45')][_0xf12a('0x49')]('nolimit')){_0x82e115[_0xf12a('0x31')]=qs['limit'](_0x5614a5[_0xf12a('0x45')][_0xf12a('0x31')]);_0x82e115[_0xf12a('0x2f')]=qs['offset'](_0x5614a5['query']['offset']);}return _0x5abd5c['getAgents'](_0x82e115);}})[_0xf12a('0x20')](function(_0xd3fce1){if(_0xd3fce1){return _0xd3fce1?{'count':_0x48393d,'rows':_0xd3fce1}:null;}})[_0xf12a('0x20')](respondWithResult(_0x47c15d,null))[_0xf12a('0x2a')](handleError(_0x47c15d,null));};exports[_0xf12a('0x3a')]=function(_0xd1e24f,_0x2132f2,_0x542316){var _0x2ecae8,_0xfad0df,_0x5bb9ae;if(_['isNil'](_0xd1e24f[_0xf12a('0x5d')]['body'])||_0xd1e24f[_0xf12a('0x5d')][_0xf12a('0x5d')]===''){throw new db['Sequelize'][(_0xf12a('0x6f'))](_0xf12a('0x77'));}if(_['isNil'](_0xd1e24f[_0xf12a('0x5d')]['to'])){}_0x2ecae8=_0xd1e24f['body']['to'];return db[_0xf12a('0x51')][_0xf12a('0x68')]({'where':{'id':_0xd1e24f[_0xf12a('0x57')]['id']}})[_0xf12a('0x20')](handleEntityNotFound(_0x2132f2,null))[_0xf12a('0x20')](function(_0xa1740f){if(_0xa1740f){return db[_0xf12a('0x51')][_0xf12a('0x5b')]({'where':{'id':_0xa1740f['id']},'include':[{'model':db[_0xf12a('0xb9')],'as':_0xf12a('0x87'),'include':[{'model':db[_0xf12a('0x6e')],'as':'Contacts','where':{[_0xa1740f[_0xf12a('0x78')]]:_0x2ecae8},'limit':0x1,'order':[[_0xf12a('0x72'),'DESC']]}]}]})[_0xf12a('0x20')](handleEntityNotFound(_0x2132f2,null))[_0xf12a('0x20')](function(_0x48de82){if(_0x48de82&&_0x48de82[_0xf12a('0x87')]){_0xfad0df=_0x48de82[_0xf12a('0x37')]({'plain':!![]});if(_0xfad0df[_0xf12a('0x87')]&&_0xfad0df[_0xf12a('0x87')]['Contacts'][_0xf12a('0x48')]){return _0xfad0df[_0xf12a('0x87')]['Contacts'][0x0];}return db[_0xf12a('0x6e')][_0xf12a('0x5c')](_[_0xf12a('0x1a')](_0xd1e24f[_0xf12a('0x5d')],{'firstName':_0x2ecae8,[_0x48de82[_0xf12a('0x78')]]:_0x2ecae8,'phone':_0x2ecae8,'ListId':_0xfad0df[_0xf12a('0x75')]}));}})[_0xf12a('0x20')](handleEntityNotFound(_0x2132f2,null))[_0xf12a('0x20')](function(_0x419e9f){if(_0x419e9f){_0x5bb9ae=_0x419e9f;return db[_0xf12a('0x8c')][_0xf12a('0x5b')]({'where':{'ContactId':_0x5bb9ae['id'],'closed':![],'OpenchannelAccountId':_0xfad0df['id']}})['then'](function(_0x1881c9){if(_0x1881c9){return[_0x1881c9,![]];}return db['OpenchannelInteraction'][_0xf12a('0x5c')]({'UserId':_0xd1e24f['user']['id'],'ContactId':_0x5bb9ae['id'],'OpenchannelAccountId':_0xfad0df['id'],'lastMsgDirection':_0xf12a('0xba'),'firstMsgDirection':_0xf12a('0xba'),'Messages':[_['merge'](_0xd1e24f[_0xf12a('0x5d')],{'read':![],'body':_0xd1e24f[_0xf12a('0x5d')][_0xf12a('0x5d')],'OpenchannelAccountId':_0xfad0df['id'],'UserId':_0xd1e24f[_0xf12a('0x5e')]['id'],'ContactId':_0x5bb9ae['id']})]},{'include':[{'model':db[_0xf12a('0x97')],'as':_0xf12a('0xbb')}]})[_0xf12a('0x20')](function(_0x2c7b47){return[_0x2c7b47,!![]];});});}})['spread'](function(_0x61400c,_0x5d5a3a){if(_0x5d5a3a){return _0x61400c;}return db[_0xf12a('0x97')][_0xf12a('0x5c')](_[_0xf12a('0x4e')](_0xd1e24f[_0xf12a('0x5d')],{'read':![],'body':_0xd1e24f[_0xf12a('0x5d')][_0xf12a('0x5d')],'OpenchannelAccountId':_0xfad0df['id'],'OpenchannelInteractionId':_0x61400c['id'],'UserId':_0xd1e24f[_0xf12a('0x5e')]['id'],'ContactId':_0x5bb9ae['id']}))[_0xf12a('0x20')](function(_0x56220f){_0x61400c[_0xf12a('0xbc')]['Messages']=[];_0x61400c[_0xf12a('0xbc')][_0xf12a('0xbb')]['push'](_0x56220f[_0xf12a('0xbc')]);return _0x61400c;});});}})[_0xf12a('0x20')](respondWithResult(_0x2132f2,null))[_0xf12a('0x2a')](handleError(_0x2132f2,null));}; \ No newline at end of file +var _0x0736=['AttachmentId','UserId','User','unshift','agent','waitForTheAssignedAgent','queueId','OpenchannelQueue','queue','waitForTheAssignedQueue','Start','startRouting','EventManager','addApplications','sequelize','transaction','Transaction','READ_COMMITTED','bulkCreate','findAndCountAll','getApplications','getInteractions','Contact','Owner','fullname','internal','Tag','Tags','color','tag','addAgents','omit','emit','removeAgents','isArray','userOpenchannelAccount:remove','getAgents','out','Messages','dataValues','eml-format','rimraf','fast-json-patch','request-promise','moment','bluebird','mustache','util','path','sox','to-csv','ejs','fs-extra','lodash','squel','crypto','jsforce','desk.js','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','../../mysqldb','redis','localhost','socket.io-emitter','./openchannelAccount.socket','register','jayson/promise','client','http','request','then','info','debug','stringify','error','code','message','OpenchannelAccount,\x20%s,\x20%s','request\x20sent','sendStatus','status','end','json','offset','undefined','limit','count','set','Content-Range','apply','reject','save','destroy','get','OpenchannelAccounts','stack','send','index','Pause','mandatoryDispositionPause','map','rawAttributes','fieldName','type','key','model','name','query','keys','filters','intersection','attributes','fields','nolimit','order','sort','pick','filter','where','VIRTUAL','merge','options','OpenchannelAccount','includeAll','include','findAll','rows','show','params','find','catch','body','user','Unable\x20to\x20retrieve\x20the\x20current\x20user','role','UserProfileSection','userProfileId','autoAssociation','UserProfileResource','create','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','update','describe','addDisposition','OpenchannelAccountId','Disposition','length','hasOwnProperty','removeDispositions','ids','addAnswer','findOne','CannedAnswer','removeAnswers','notify','openchannel','Sequelize','no\x20available\x20attributes','difference','createdAt','updatedAt','CompanyId','ListId','from','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','List','CmContact','Contacts','DESC','OpenchannelApplication','Applications','applications','list','orderBy','priority','asc','account','defaults','firstName','lastName','threadId','externalUrl','OpenchannelInteraction','spread','contact','messageId','interaction','push','close','unmanaged','*,*,*,*','OpenchannelMessage'];(function(_0x4f9d8c,_0x178c6c){var _0x3715d7=function(_0x50b93f){while(--_0x50b93f){_0x4f9d8c['push'](_0x4f9d8c['shift']());}};_0x3715d7(++_0x178c6c);}(_0x0736,0x1c0));var _0x6073=function(_0x5e7d40,_0x424b99){_0x5e7d40=_0x5e7d40-0x0;var _0x3eaccb=_0x0736[_0x5e7d40];return _0x3eaccb;};'use strict';var emlformat=require(_0x6073('0x0'));var rimraf=require(_0x6073('0x1'));var zipdir=require('zip-dir');var jsonpatch=require(_0x6073('0x2'));var rp=require(_0x6073('0x3'));var moment=require(_0x6073('0x4'));var BPromise=require(_0x6073('0x5'));var Mustache=require(_0x6073('0x6'));var util=require(_0x6073('0x7'));var path=require(_0x6073('0x8'));var sox=require(_0x6073('0x9'));var csv=require(_0x6073('0xa'));var ejs=require(_0x6073('0xb'));var fs=require('fs');var fs_extra=require(_0x6073('0xc'));var _=require(_0x6073('0xd'));var squel=require(_0x6073('0xe'));var crypto=require(_0x6073('0xf'));var jsforce=require(_0x6073('0x10'));var deskjs=require(_0x6073('0x11'));var toCsv=require(_0x6073('0xa'));var querystring=require('querystring');var Papa=require(_0x6073('0x12'));var Redis=require(_0x6073('0x13'));var authService=require(_0x6073('0x14'));var qs=require(_0x6073('0x15'));var as=require(_0x6073('0x16'));var hardwareService=require(_0x6073('0x17'));var logger=require(_0x6073('0x18'))('api');var utils=require('../../config/utils');var config=require('../../config/environment');var licenseUtil=require('../../config/license/util');var db=require(_0x6073('0x19'))['db'];config[_0x6073('0x1a')]=_['defaults'](config[_0x6073('0x1a')],{'host':_0x6073('0x1b'),'port':0x18eb});var socket=require(_0x6073('0x1c'))(new Redis(config[_0x6073('0x1a')]));require(_0x6073('0x1d'))[_0x6073('0x1e')](socket);var jayson=require(_0x6073('0x1f'));var client=jayson[_0x6073('0x20')][_0x6073('0x21')]({'port':0x232c});var client9002=jayson[_0x6073('0x20')][_0x6073('0x21')]({'port':0x232a});function respondWithRpcPromise(_0x43a2fe,_0x45637e,_0x5afec5,_0x231a25){return new BPromise(function(_0x258bed,_0x3e77bb){var _0x50d889=_0x231a25||client;return _0x50d889[_0x6073('0x22')](_0x43a2fe,_0x5afec5)[_0x6073('0x23')](function(_0x16b04f){logger[_0x6073('0x24')]('OpenchannelAccount,\x20%s,\x20%s',_0x45637e,'request\x20sent');logger[_0x6073('0x25')]('OpenchannelAccount,\x20%s,\x20%s,\x20%s',_0x45637e,'request\x20sent',JSON[_0x6073('0x26')](_0x16b04f));if(_0x16b04f[_0x6073('0x27')]){if(_0x16b04f[_0x6073('0x27')][_0x6073('0x28')]===0x1f4){logger[_0x6073('0x27')]('OpenchannelAccount,\x20%s,\x20%s',_0x45637e,_0x16b04f[_0x6073('0x27')]['message']);return _0x3e77bb(_0x16b04f['error'][_0x6073('0x29')]);}logger[_0x6073('0x27')](_0x6073('0x2a'),_0x45637e,_0x16b04f['error'][_0x6073('0x29')]);return _0x258bed(_0x16b04f[_0x6073('0x27')][_0x6073('0x29')]);}else{logger[_0x6073('0x24')](_0x6073('0x2a'),_0x45637e,_0x6073('0x2b'));_0x258bed(_0x16b04f['result'][_0x6073('0x29')]);}})['catch'](function(_0xd58a15){logger[_0x6073('0x27')](_0x6073('0x2a'),_0x45637e,_0xd58a15);_0x3e77bb(_0xd58a15);});});}function respondWithStatusCode(_0x41fff2,_0x26cc30){_0x26cc30=_0x26cc30||0xcc;return function(_0x3802e8){if(_0x3802e8){return _0x41fff2[_0x6073('0x2c')](_0x26cc30);}return _0x41fff2[_0x6073('0x2d')](_0x26cc30)[_0x6073('0x2e')]();};}function respondWithResult(_0x4def74,_0x1d3d35){_0x1d3d35=_0x1d3d35||0xc8;return function(_0x4d5cbb){if(_0x4d5cbb){return _0x4def74['status'](_0x1d3d35)[_0x6073('0x2f')](_0x4d5cbb);}};}function respondWithFilteredResult(_0x3dd707,_0xdb627b){return function(_0x3bbfb8){if(_0x3bbfb8){var _0x179cc2=typeof _0xdb627b[_0x6073('0x30')]===_0x6073('0x31')&&typeof _0xdb627b[_0x6073('0x32')]===_0x6073('0x31');var _0x5ad864=_0x3bbfb8['count'];var _0x1fade1=_0x179cc2?0x0:_0xdb627b[_0x6073('0x30')];var _0x34fe56=_0x179cc2?_0x3bbfb8[_0x6073('0x33')]:_0xdb627b[_0x6073('0x30')]+_0xdb627b['limit'];var _0x24e59f;if(_0x34fe56>=_0x5ad864){_0x34fe56=_0x5ad864;_0x24e59f=0xc8;}else{_0x24e59f=0xce;}_0x3dd707[_0x6073('0x2d')](_0x24e59f);return _0x3dd707[_0x6073('0x34')](_0x6073('0x35'),_0x1fade1+'-'+_0x34fe56+'/'+_0x5ad864)[_0x6073('0x2f')](_0x3bbfb8);}return null;};}function patchUpdates(_0x5de5ae){return function(_0x3504cb){try{jsonpatch[_0x6073('0x36')](_0x3504cb,_0x5de5ae,!![]);}catch(_0x246799){return BPromise[_0x6073('0x37')](_0x246799);}return _0x3504cb[_0x6073('0x38')]();};}function saveUpdates(_0x362952,_0x586f10){return function(_0x4790ed){if(_0x4790ed){return _0x4790ed['update'](_0x362952)[_0x6073('0x23')](function(_0x1b2f42){return _0x1b2f42;});}return null;};}function removeEntity(_0x294e1e,_0x502a79){return function(_0x56e6e5){if(_0x56e6e5){return _0x56e6e5[_0x6073('0x39')]()['then'](function(){var _0x582359=_0x56e6e5[_0x6073('0x3a')]({'plain':!![]});var _0x443025=_0x6073('0x3b');return db['UserProfileResource'][_0x6073('0x39')]({'where':{'type':_0x443025,'resourceId':_0x582359['id']}})[_0x6073('0x23')](function(){return _0x56e6e5;});})[_0x6073('0x23')](function(){_0x294e1e[_0x6073('0x2d')](0xcc)[_0x6073('0x2e')]();});}};}function handleEntityNotFound(_0x5486fd,_0x352bcd){return function(_0x54d804){if(!_0x54d804){_0x5486fd['sendStatus'](0x194);}return _0x54d804;};}function handleError(_0x2df1e5,_0x462327){_0x462327=_0x462327||0x1f4;return function(_0x4305a6){logger[_0x6073('0x27')](_0x4305a6[_0x6073('0x3c')]);if(_0x4305a6['name']){delete _0x4305a6['name'];}_0x2df1e5[_0x6073('0x2d')](_0x462327)[_0x6073('0x3d')](_0x4305a6);};}exports[_0x6073('0x3e')]=function(_0x218703,_0x40f68a){var _0x546d09={'include':[{'model':db[_0x6073('0x3f')],'as':_0x6073('0x40')}]},_0x9ac862={},_0x36a56f={'count':0x0,'rows':[]};var _0x359f08=_[_0x6073('0x41')](db['OpenchannelAccount'][_0x6073('0x42')],function(_0x15dcc4){return{'name':_0x15dcc4[_0x6073('0x43')],'type':_0x15dcc4[_0x6073('0x44')][_0x6073('0x45')]};});_0x9ac862[_0x6073('0x46')]=_[_0x6073('0x41')](_0x359f08,_0x6073('0x47'));_0x9ac862[_0x6073('0x48')]=_[_0x6073('0x49')](_0x218703[_0x6073('0x48')]);_0x9ac862[_0x6073('0x4a')]=_[_0x6073('0x4b')](_0x9ac862[_0x6073('0x46')],_0x9ac862[_0x6073('0x48')]);_0x546d09[_0x6073('0x4c')]=_['intersection'](_0x9ac862['model'],qs[_0x6073('0x4d')](_0x218703[_0x6073('0x48')][_0x6073('0x4d')]));_0x546d09['attributes']=_0x546d09[_0x6073('0x4c')]['length']?_0x546d09[_0x6073('0x4c')]:_0x9ac862[_0x6073('0x46')];if(!_0x218703[_0x6073('0x48')]['hasOwnProperty'](_0x6073('0x4e'))){_0x546d09[_0x6073('0x32')]=qs[_0x6073('0x32')](_0x218703[_0x6073('0x48')][_0x6073('0x32')]);_0x546d09[_0x6073('0x30')]=qs['offset'](_0x218703[_0x6073('0x48')][_0x6073('0x30')]);}_0x546d09[_0x6073('0x4f')]=qs[_0x6073('0x50')](_0x218703[_0x6073('0x48')][_0x6073('0x50')]);_0x546d09['where']=qs[_0x6073('0x4a')](_[_0x6073('0x51')](_0x218703['query'],_0x9ac862[_0x6073('0x4a')]),_0x359f08);if(_0x218703[_0x6073('0x48')][_0x6073('0x52')]){_0x546d09[_0x6073('0x53')]=_['merge'](_0x546d09[_0x6073('0x53')],{'$or':_[_0x6073('0x41')](_0x359f08,function(_0x4e2662){if(_0x4e2662[_0x6073('0x44')]!==_0x6073('0x54')){var _0x1c3193={};_0x1c3193[_0x4e2662['name']]={'$like':'%'+_0x218703[_0x6073('0x48')]['filter']+'%'};return _0x1c3193;}})});}_0x546d09=_[_0x6073('0x55')]({},_0x546d09,_0x218703[_0x6073('0x56')]);var _0x3c5af9={'where':_0x546d09['where']};return db[_0x6073('0x57')][_0x6073('0x33')](_0x3c5af9)[_0x6073('0x23')](function(_0x780018){_0x36a56f[_0x6073('0x33')]=_0x780018;if(_0x218703[_0x6073('0x48')][_0x6073('0x58')]){_0x546d09[_0x6073('0x59')]=[{'all':!![]}];}return db['OpenchannelAccount'][_0x6073('0x5a')](_0x546d09);})[_0x6073('0x23')](function(_0x5c67a1){_0x36a56f[_0x6073('0x5b')]=_0x5c67a1;return _0x36a56f;})[_0x6073('0x23')](respondWithFilteredResult(_0x40f68a,_0x546d09))['catch'](handleError(_0x40f68a,null));};exports[_0x6073('0x5c')]=function(_0x5bf34e,_0x59a767){var _0x408746={'raw':![],'where':{'id':_0x5bf34e[_0x6073('0x5d')]['id']},'include':[{'model':db[_0x6073('0x3f')],'as':_0x6073('0x40')}]},_0x22a5a6={};_0x22a5a6[_0x6073('0x46')]=_[_0x6073('0x49')](db[_0x6073('0x57')][_0x6073('0x42')]);_0x22a5a6['query']=_[_0x6073('0x49')](_0x5bf34e[_0x6073('0x48')]);_0x22a5a6[_0x6073('0x4a')]=_['intersection'](_0x22a5a6[_0x6073('0x46')],_0x22a5a6['query']);_0x408746[_0x6073('0x4c')]=_[_0x6073('0x4b')](_0x22a5a6['model'],qs[_0x6073('0x4d')](_0x5bf34e[_0x6073('0x48')][_0x6073('0x4d')]));_0x408746['attributes']=_0x408746[_0x6073('0x4c')]['length']?_0x408746[_0x6073('0x4c')]:_0x22a5a6[_0x6073('0x46')];if(_0x5bf34e[_0x6073('0x48')][_0x6073('0x58')]){_0x408746[_0x6073('0x59')]=[{'all':!![]}];}_0x408746=_[_0x6073('0x55')]({},_0x408746,_0x5bf34e[_0x6073('0x56')]);return db['OpenchannelAccount'][_0x6073('0x5e')](_0x408746)[_0x6073('0x23')](handleEntityNotFound(_0x59a767,null))[_0x6073('0x23')](respondWithResult(_0x59a767,null))[_0x6073('0x5f')](handleError(_0x59a767,null));};exports['create']=function(_0x2242ed,_0x1be25f){return db[_0x6073('0x57')]['create'](_0x2242ed[_0x6073('0x60')],{})[_0x6073('0x23')](function(_0x5f0d14){var _0x904dd8=_0x2242ed[_0x6073('0x61')][_0x6073('0x3a')]({'plain':!![]});if(!_0x904dd8)throw new Error(_0x6073('0x62'));if(_0x904dd8[_0x6073('0x63')]===_0x6073('0x61')){var _0x47bb58=_0x5f0d14['get']({'plain':!![]});var _0x17f593=_0x6073('0x3b');return db[_0x6073('0x64')]['find']({'where':{'name':_0x17f593,'userProfileId':_0x904dd8[_0x6073('0x65')]},'raw':!![]})[_0x6073('0x23')](function(_0x14a087){if(_0x14a087&&_0x14a087[_0x6073('0x66')]===0x0){return db[_0x6073('0x67')][_0x6073('0x68')]({'name':_0x47bb58[_0x6073('0x47')],'resourceId':_0x47bb58['id'],'type':_0x14a087[_0x6073('0x47')],'sectionId':_0x14a087['id']},{})[_0x6073('0x23')](function(){return _0x5f0d14;});}else{return _0x5f0d14;}})['catch'](function(_0x21ec87){logger[_0x6073('0x27')](_0x6073('0x69'),_0x21ec87);throw _0x21ec87;});}return _0x5f0d14;})[_0x6073('0x23')](respondWithResult(_0x1be25f,0xc9))[_0x6073('0x5f')](handleError(_0x1be25f,null));};exports[_0x6073('0x6a')]=function(_0x227260,_0x2d42c3){if(_0x227260[_0x6073('0x60')]['id']){delete _0x227260[_0x6073('0x60')]['id'];}return db[_0x6073('0x57')][_0x6073('0x5e')]({'where':{'id':_0x227260[_0x6073('0x5d')]['id']},'include':[{'model':db[_0x6073('0x3f')],'as':_0x6073('0x40')}]})[_0x6073('0x23')](handleEntityNotFound(_0x2d42c3,null))[_0x6073('0x23')](saveUpdates(_0x227260[_0x6073('0x60')],null))[_0x6073('0x23')](respondWithResult(_0x2d42c3,null))[_0x6073('0x5f')](handleError(_0x2d42c3,null));};exports[_0x6073('0x39')]=function(_0x39056e,_0x52915e){return db[_0x6073('0x57')][_0x6073('0x5e')]({'where':{'id':_0x39056e['params']['id']}})['then'](handleEntityNotFound(_0x52915e,null))['then'](removeEntity(_0x52915e,null))[_0x6073('0x5f')](handleError(_0x52915e,null));};exports[_0x6073('0x6b')]=function(_0x58547f,_0x15a131){return db[_0x6073('0x57')][_0x6073('0x6b')]()[_0x6073('0x23')](respondWithResult(_0x15a131,null))[_0x6073('0x5f')](handleError(_0x15a131,null));};exports[_0x6073('0x6c')]=function(_0x365cec,_0x335653,_0x760724){if(_0x365cec['body']['id']){delete _0x365cec[_0x6073('0x60')]['id'];}return db[_0x6073('0x57')][_0x6073('0x5e')]({'where':{'id':_0x365cec['params']['id']}})[_0x6073('0x23')](handleEntityNotFound(_0x335653,null))[_0x6073('0x23')](function(_0x4d8d0e){if(_0x4d8d0e){_0x365cec[_0x6073('0x60')][_0x6073('0x6d')]=_0x4d8d0e['id'];return db[_0x6073('0x6e')]['create'](_0x365cec[_0x6073('0x60')]);}})[_0x6073('0x23')](respondWithResult(_0x335653,null))[_0x6073('0x5f')](handleError(_0x335653,null));};exports['getDispositions']=function(_0x5998ca,_0x293ba4,_0x4990ed){var _0x26eaa2={'raw':![],'where':{}};var _0x1a5593={};var _0x5fa25b={'count':0x0,'rows':[]};return db[_0x6073('0x57')]['findOne']({'where':{'id':_0x5998ca['params']['id']}})[_0x6073('0x23')](handleEntityNotFound(_0x293ba4,null))[_0x6073('0x23')](function(_0x684ad3){if(_0x684ad3){_0x1a5593[_0x6073('0x46')]=_[_0x6073('0x49')](db['Disposition'][_0x6073('0x42')]);_0x1a5593[_0x6073('0x48')]=_[_0x6073('0x49')](_0x5998ca['query']);_0x1a5593['filters']=_[_0x6073('0x4b')](_0x1a5593[_0x6073('0x46')],_0x1a5593[_0x6073('0x48')]);_0x26eaa2['attributes']=_[_0x6073('0x4b')](_0x1a5593['model'],qs[_0x6073('0x4d')](_0x5998ca['query'][_0x6073('0x4d')]));_0x26eaa2[_0x6073('0x4c')]=_0x26eaa2[_0x6073('0x4c')][_0x6073('0x6f')]?_0x26eaa2[_0x6073('0x4c')]:_0x1a5593[_0x6073('0x46')];if(!_0x5998ca[_0x6073('0x48')][_0x6073('0x70')](_0x6073('0x4e'))){_0x26eaa2[_0x6073('0x32')]=qs[_0x6073('0x32')](_0x5998ca[_0x6073('0x48')][_0x6073('0x32')]);_0x26eaa2[_0x6073('0x30')]=qs['offset'](_0x5998ca[_0x6073('0x48')]['offset']);}_0x26eaa2[_0x6073('0x4f')]=qs[_0x6073('0x50')](_0x5998ca[_0x6073('0x48')][_0x6073('0x50')]);_0x26eaa2['where']=qs[_0x6073('0x4a')](_[_0x6073('0x51')](_0x5998ca[_0x6073('0x48')],_0x1a5593[_0x6073('0x4a')]));_0x26eaa2[_0x6073('0x53')]['OpenchannelAccountId']=_0x684ad3['id'];if(_0x5998ca[_0x6073('0x48')]['filter']){_0x26eaa2[_0x6073('0x53')]=_[_0x6073('0x55')](_0x26eaa2[_0x6073('0x53')],{'$or':_[_0x6073('0x41')](_0x26eaa2['attributes'],function(_0x5c8d99){var _0x46439f={};_0x46439f[_0x5c8d99]={'$like':'%'+_0x5998ca[_0x6073('0x48')]['filter']+'%'};return _0x46439f;})});}_0x26eaa2=_[_0x6073('0x55')]({},_0x26eaa2,_0x5998ca[_0x6073('0x56')]);return db[_0x6073('0x6e')][_0x6073('0x33')]({'where':_0x26eaa2[_0x6073('0x53')]})[_0x6073('0x23')](function(_0x2287a3){_0x5fa25b[_0x6073('0x33')]=_0x2287a3;if(_0x5998ca[_0x6073('0x48')]['includeAll']){_0x26eaa2[_0x6073('0x59')]=[{'all':!![]}];}return db['Disposition'][_0x6073('0x5a')](_0x26eaa2);})[_0x6073('0x23')](function(_0x5d612a){_0x5fa25b[_0x6073('0x5b')]=_0x5d612a;return _0x5fa25b;});}})[_0x6073('0x23')](respondWithFilteredResult(_0x293ba4,_0x26eaa2))[_0x6073('0x5f')](handleError(_0x293ba4,null));};exports[_0x6073('0x71')]=function(_0x3e2253,_0x117074,_0x3cff54){return db[_0x6073('0x57')][_0x6073('0x5e')]({'where':{'id':_0x3e2253[_0x6073('0x5d')]['id']}})[_0x6073('0x23')](handleEntityNotFound(_0x117074,null))['then'](function(_0x517ba8){if(_0x517ba8){return _0x517ba8['removeDispositions'](_0x3e2253['query'][_0x6073('0x72')]);}})['then'](respondWithStatusCode(_0x117074,null))[_0x6073('0x5f')](handleError(_0x117074,null));};exports[_0x6073('0x73')]=function(_0x466edb,_0x19bcf5,_0xdc5d08){if(_0x466edb[_0x6073('0x60')]['id']){delete _0x466edb['body']['id'];}return db[_0x6073('0x57')][_0x6073('0x5e')]({'where':{'id':_0x466edb[_0x6073('0x5d')]['id']}})['then'](handleEntityNotFound(_0x19bcf5,null))[_0x6073('0x23')](function(_0x24dd2f){if(_0x24dd2f){_0x466edb[_0x6073('0x60')][_0x6073('0x6d')]=_0x24dd2f['id'];return db['CannedAnswer'][_0x6073('0x68')](_0x466edb[_0x6073('0x60')]);}})[_0x6073('0x23')](respondWithResult(_0x19bcf5,null))[_0x6073('0x5f')](handleError(_0x19bcf5,null));};exports['getAnswers']=function(_0x206c9b,_0x3a3683,_0x791e5f){var _0x521a8d={'raw':![],'where':{}};var _0x279dd6={};var _0x228044={'count':0x0,'rows':[]};return db['OpenchannelAccount'][_0x6073('0x74')]({'where':{'id':_0x206c9b['params']['id']}})[_0x6073('0x23')](handleEntityNotFound(_0x3a3683,null))[_0x6073('0x23')](function(_0x460c7a){if(_0x460c7a){_0x279dd6[_0x6073('0x46')]=_[_0x6073('0x49')](db['CannedAnswer'][_0x6073('0x42')]);_0x279dd6['query']=_[_0x6073('0x49')](_0x206c9b['query']);_0x279dd6[_0x6073('0x4a')]=_[_0x6073('0x4b')](_0x279dd6[_0x6073('0x46')],_0x279dd6[_0x6073('0x48')]);_0x521a8d[_0x6073('0x4c')]=_[_0x6073('0x4b')](_0x279dd6[_0x6073('0x46')],qs[_0x6073('0x4d')](_0x206c9b[_0x6073('0x48')][_0x6073('0x4d')]));_0x521a8d[_0x6073('0x4c')]=_0x521a8d[_0x6073('0x4c')][_0x6073('0x6f')]?_0x521a8d['attributes']:_0x279dd6['model'];if(!_0x206c9b[_0x6073('0x48')][_0x6073('0x70')](_0x6073('0x4e'))){_0x521a8d['limit']=qs[_0x6073('0x32')](_0x206c9b[_0x6073('0x48')][_0x6073('0x32')]);_0x521a8d['offset']=qs[_0x6073('0x30')](_0x206c9b[_0x6073('0x48')][_0x6073('0x30')]);}_0x521a8d[_0x6073('0x4f')]=qs['sort'](_0x206c9b[_0x6073('0x48')][_0x6073('0x50')]);_0x521a8d[_0x6073('0x53')]=qs[_0x6073('0x4a')](_[_0x6073('0x51')](_0x206c9b[_0x6073('0x48')],_0x279dd6[_0x6073('0x4a')]));_0x521a8d['where'][_0x6073('0x6d')]=_0x460c7a['id'];if(_0x206c9b[_0x6073('0x48')][_0x6073('0x52')]){_0x521a8d[_0x6073('0x53')]=_[_0x6073('0x55')](_0x521a8d['where'],{'$or':_[_0x6073('0x41')](_0x521a8d[_0x6073('0x4c')],function(_0x42ae9){var _0x57466e={};_0x57466e[_0x42ae9]={'$like':'%'+_0x206c9b[_0x6073('0x48')]['filter']+'%'};return _0x57466e;})});}_0x521a8d=_[_0x6073('0x55')]({},_0x521a8d,_0x206c9b[_0x6073('0x56')]);return db['CannedAnswer'][_0x6073('0x33')]({'where':_0x521a8d[_0x6073('0x53')]})[_0x6073('0x23')](function(_0x4d112f){_0x228044[_0x6073('0x33')]=_0x4d112f;if(_0x206c9b[_0x6073('0x48')][_0x6073('0x58')]){_0x521a8d[_0x6073('0x59')]=[{'all':!![]}];}return db[_0x6073('0x75')][_0x6073('0x5a')](_0x521a8d);})[_0x6073('0x23')](function(_0x12d3a3){_0x228044[_0x6073('0x5b')]=_0x12d3a3;return _0x228044;});}})[_0x6073('0x23')](respondWithFilteredResult(_0x3a3683,_0x521a8d))[_0x6073('0x5f')](handleError(_0x3a3683,null));};exports[_0x6073('0x76')]=function(_0x730d02,_0x575ab5,_0x5b680b){return db[_0x6073('0x57')][_0x6073('0x5e')]({'where':{'id':_0x730d02[_0x6073('0x5d')]['id']}})[_0x6073('0x23')](handleEntityNotFound(_0x575ab5,null))[_0x6073('0x23')](function(_0x330939){if(_0x330939){return _0x330939[_0x6073('0x76')](_0x730d02[_0x6073('0x48')][_0x6073('0x72')]);}})[_0x6073('0x23')](respondWithStatusCode(_0x575ab5,null))[_0x6073('0x5f')](handleError(_0x575ab5,null));};exports[_0x6073('0x77')]=function(_0x14a2ae,_0x43a18f,_0x287fe8){var _0x3a6b81={'body':_0x14a2ae[_0x6073('0x60')],'channel':_0x6073('0x78')};var _0xea842f=[];var _0x34ef93=[];var _0x1ce337={};var _0x284d3f=![];return db['CmContact']['describe']()['then'](function(_0x140b41){if(!_0x140b41){throw new db[(_0x6073('0x79'))]['ValidationError'](_0x6073('0x7a'));}_0xea842f=_[_0x6073('0x7b')](_[_0x6073('0x49')](_0x140b41),[_0x6073('0x7c'),_0x6073('0x7d')]);_0x34ef93=_[_0x6073('0x7b')](_[_0x6073('0x49')](_0x140b41),[_0x6073('0x7c'),_0x6073('0x7d'),_0x6073('0x7e'),_0x6073('0x7f')]);if(_0x14a2ae['body']['id']){delete _0x14a2ae[_0x6073('0x60')]['id'];}if(_['isNil'](_0x14a2ae[_0x6073('0x60')][_0x6073('0x80')])){throw new db[(_0x6073('0x79'))]['ValidationError'](_0x6073('0x81'));}if(_[_0x6073('0x82')](_0x14a2ae[_0x6073('0x60')]['body'])||_0x14a2ae['body']['body']===''){throw new db[(_0x6073('0x79'))][(_0x6073('0x83'))]('body\x20is\x20mandatory\x20and\x20not\x20empty');}if(_['isNil'](_0x14a2ae['body'][_0x6073('0x84')])){throw new db[(_0x6073('0x79'))]['ValidationError'](_0x6073('0x85')+_0x34ef93);}if(!_[_0x6073('0x86')](_0x34ef93,_0x14a2ae[_0x6073('0x60')][_0x6073('0x84')])){throw new db[(_0x6073('0x79'))][(_0x6073('0x83'))](_0x6073('0x87')+_0x34ef93);}_0x1ce337[_0x14a2ae[_0x6073('0x60')][_0x6073('0x84')]]=_0x14a2ae[_0x6073('0x60')][_0x6073('0x80')];})[_0x6073('0x23')](function(){return db[_0x6073('0x57')]['find']({'where':{'id':_0x14a2ae[_0x6073('0x5d')]['id']},'include':[{'model':db[_0x6073('0x88')],'as':_0x6073('0x89'),'include':[{'model':db[_0x6073('0x8a')],'as':_0x6073('0x8b'),'where':_0x1ce337,'limit':0x1,'order':[[_0x6073('0x7d'),_0x6073('0x8c')]]}]},{'model':db[_0x6073('0x8d')],'as':_0x6073('0x8e')}]});})[_0x6073('0x23')](handleEntityNotFound(_0x43a18f,null))[_0x6073('0x23')](function(_0x29ee7b){if(_0x29ee7b&&_0x29ee7b[_0x6073('0x89')]){_0x3a6b81['account']=_0x29ee7b;_0x3a6b81[_0x6073('0x8f')]=_0x29ee7b['Applications'];_0x3a6b81[_0x6073('0x90')]=_0x29ee7b['List'];_0x3a6b81['applications']=_[_0x6073('0x91')](_0x3a6b81[_0x6073('0x8f')],[_0x6073('0x92')],[_0x6073('0x93')]);if(_0x3a6b81[_0x6073('0x94')][_0x6073('0x8e')]){delete _0x3a6b81[_0x6073('0x94')][_0x6073('0x8e')];}if(_0x3a6b81[_0x6073('0x94')]['List']&&_0x3a6b81[_0x6073('0x94')][_0x6073('0x89')]['Contacts']['length']){return _0x3a6b81[_0x6073('0x94')][_0x6073('0x89')][_0x6073('0x8b')][0x0];}var _0x1a1106=_[_0x6073('0x95')](_0x14a2ae[_0x6073('0x60')],{'firstName':_0x14a2ae[_0x6073('0x60')][_0x6073('0x80')],'ListId':_0x29ee7b[_0x6073('0x7f')]});_0x1a1106[_0x14a2ae['body']['mapKey']]=_0x14a2ae['body'][_0x6073('0x80')];return db[_0x6073('0x8a')][_0x6073('0x68')](_0x1a1106,{'fields':_0xea842f,'raw':!![]});}})[_0x6073('0x23')](handleEntityNotFound(_0x43a18f,null))[_0x6073('0x23')](function(_0x2e1894){_0x3a6b81['contact']=_0x2e1894;if(_0x2e1894){var _0x206f88={'ContactId':_0x2e1894['id'],'OpenchannelAccountId':_0x14a2ae[_0x6073('0x5d')]['id'],'from':(_0x2e1894[_0x6073('0x96')]||'')+'\x20'+(_0x2e1894[_0x6073('0x97')]||'')};var _0x5a3afb={'OpenchannelAccountId':_0x14a2ae['params']['id'],'closed':![]};if(_0x14a2ae[_0x6073('0x60')]['threadId']){_0x5a3afb[_0x6073('0x98')]=_0x14a2ae[_0x6073('0x60')][_0x6073('0x98')];return db['OpenchannelInteraction']['find']({'where':_0x5a3afb})[_0x6073('0x23')](function(_0x364c2e){if(_0x364c2e){return[_0x364c2e,![]];}_0x206f88['threadId']=_0x14a2ae[_0x6073('0x60')][_0x6073('0x98')];_0x206f88[_0x6073('0x99')]=_0x14a2ae[_0x6073('0x60')][_0x6073('0x99')];return db[_0x6073('0x9a')][_0x6073('0x68')](_0x206f88)[_0x6073('0x23')](function(_0x10e65d){return[_0x10e65d,!![]];});});}else{_0x5a3afb[_0x6073('0x98')]=null;}_0x5a3afb['ContactId']=_0x2e1894['id'];return db[_0x6073('0x9a')][_0x6073('0x5e')]({'where':_0x5a3afb})[_0x6073('0x23')](function(_0x257b2f){if(_0x257b2f){return[_0x257b2f,![]];}return db[_0x6073('0x9a')][_0x6073('0x68')](_0x206f88)['then'](function(_0x39f69e){return[_0x39f69e,!![]];});});}})[_0x6073('0x9b')](function(_0x4fb895,_0xa2bdc7){if(_0x4fb895){_0x284d3f=_0xa2bdc7;if(!_0xa2bdc7){var _0x2454f6={'from':(_0x3a6b81[_0x6073('0x9c')][_0x6073('0x96')]||'')+'\x20'+(_0x3a6b81[_0x6073('0x9c')][_0x6073('0x97')]||'')};if(_0x14a2ae[_0x6073('0x60')][_0x6073('0x98')]&&_0x14a2ae['body'][_0x6073('0x9d')]&&_0x14a2ae[_0x6073('0x60')][_0x6073('0x98')]!=_0x14a2ae[_0x6073('0x60')][_0x6073('0x9d')]){_0x2454f6[_0x6073('0x98')]=_0x14a2ae['body'][_0x6073('0x9d')];}return _0x4fb895[_0x6073('0x6a')](_0x2454f6);}else{return _0x4fb895;}}})['then'](function(_0x534285){_0x3a6b81[_0x6073('0x9e')]=_0x534285[_0x6073('0x3a')]({'plain':!![]});_0x3a6b81[_0x6073('0x9e')]['created']=_0x284d3f;if(_0x3a6b81[_0x6073('0x9e')]['created']){if(_0x3a6b81[_0x6073('0x94')]['autoclose']){_0x3a6b81[_0x6073('0x8f')][_0x6073('0x9f')]({'id':0x0,'priority':_0x3a6b81[_0x6073('0x8f')][_0x6073('0x6f')]+0x1,'app':_0x6073('0xa0'),'appdata':_0x6073('0xa1'),'interval':_0x6073('0xa2')});}}return db[_0x6073('0xa3')]['create']({'body':_0x14a2ae['body'][_0x6073('0x60')],'OpenchannelAccountId':_0x14a2ae[_0x6073('0x5d')]['id'],'OpenchannelInteractionId':_0x534285['id'],'direction':'in','ContactId':_0x3a6b81['contact']['id'],'AttachmentId':_0x14a2ae[_0x6073('0x60')][_0x6073('0xa4')]});})[_0x6073('0x23')](function(_0x47236b){_0x3a6b81[_0x6073('0x29')]=_0x47236b;if(!_0x3a6b81[_0x6073('0x9e')][_0x6073('0xa5')])return;return db[_0x6073('0xa6')]['find']({'attributes':['id',_0x6073('0x47')],'where':{'id':_0x3a6b81[_0x6073('0x9e')][_0x6073('0xa5')]}});})[_0x6073('0x23')](function(_0x73cea5){if(_0x73cea5){_0x3a6b81[_0x6073('0x8f')][_0x6073('0xa7')]({'id':0x0,'priority':0x0,'app':_0x6073('0xa8'),'appdata':_0x73cea5['name']+','+(_0x3a6b81[_0x6073('0x94')][_0x6073('0xa9')]||0xa),'interval':_0x6073('0xa2')});}if(!_0x3a6b81[_0x6073('0x9e')][_0x6073('0xaa')])return;return db[_0x6073('0xab')][_0x6073('0x5e')]({'attributes':['id',_0x6073('0x47')],'where':{'id':_0x3a6b81[_0x6073('0x9e')][_0x6073('0xaa')]}});})[_0x6073('0x23')](function(_0x3db609){if(_0x3db609){_0x3a6b81[_0x6073('0x8f')]['unshift']({'id':0x0,'priority':0x1,'app':_0x6073('0xac'),'appdata':_0x3db609[_0x6073('0x47')]+','+(_0x3a6b81['account'][_0x6073('0xad')]||0x12c),'interval':_0x6073('0xa2')});}return respondWithRpcPromise(_0x6073('0xae'),_0x6073('0xaf'),_0x3a6b81);})['then'](function(_0x4cc35e){respondWithRpcPromise(_0x6073('0xb0'),_0x6073('0xb0'),{'event':_0x6073('0x77'),'message':_0x4cc35e},client9002);return _0x4cc35e;})['then'](respondWithResult(_0x43a18f,null))['catch'](handleError(_0x43a18f,null));};exports[_0x6073('0xb1')]=function(_0x4fed16,_0x13b535){var _0x57ee64=_0x4fed16[_0x6073('0x5d')]['id'];var _0x438455=_0x4fed16[_0x6073('0x60')];var _0x49f24a=0xc8;var _0xcd871c=null;return db[_0x6073('0xb2')][_0x6073('0xb3')]({'isolationLevel':db[_0x6073('0xb2')][_0x6073('0xb4')]['ISOLATION_LEVELS'][_0x6073('0xb5')]},function(_0x24c890){return db[_0x6073('0x57')][_0x6073('0x74')]({'where':{'id':_0x57ee64},'transaction':_0x24c890})[_0x6073('0x23')](function(_0x5e3eec){if(_0x5e3eec){return db[_0x6073('0x8d')][_0x6073('0x39')]({'where':{'OpenchannelAccountId':_0x57ee64},'transaction':_0x24c890})[_0x6073('0x23')](function(){var _0x587ce9=_[_0x6073('0x41')](_0x438455,function(_0x209c1a){_0x209c1a['OpenchannelAccountId']=_0x57ee64;return _0x209c1a;});return db['OpenchannelApplication'][_0x6073('0xb6')](_0x587ce9,{'transaction':_0x24c890});});}else{_0x49f24a=0x194;_0xcd871c=[];}});})['then'](function(){if(_0x49f24a!==0x194){return db[_0x6073('0x8d')][_0x6073('0xb7')]({'where':{'OpenchannelAccountId':_0x57ee64},'order':_0x6073('0x92')})[_0x6073('0x23')](function(_0x2d0501){_0xcd871c=_0x2d0501;});}})[_0x6073('0x5f')](function(_0x4959c5){_0x49f24a=0x1f4;logger[_0x6073('0x27')](_0x4959c5[_0x6073('0x3c')]);if(_0x4959c5[_0x6073('0x47')]){delete _0x4959c5['name'];}_0xcd871c=_0x4959c5;})['finally'](function(){if(_0xcd871c===null){_0x13b535['sendStatus'](_0x49f24a);}else{if(_0x49f24a===0x1f4){_0x13b535[_0x6073('0x2d')](_0x49f24a)[_0x6073('0x3d')](_0xcd871c);}else{_0x13b535[_0x6073('0x2d')](_0x49f24a)['json'](_0xcd871c);}}});};exports[_0x6073('0xb8')]=function(_0x1c49e5,_0x59e35d,_0x14bb82){var _0x4714fb={};var _0x576f86={};var _0x2ba2bd;var _0x590f7e;return db['OpenchannelAccount']['findOne']({'where':{'id':_0x1c49e5['params']['id']}})[_0x6073('0x23')](handleEntityNotFound(_0x59e35d,null))[_0x6073('0x23')](function(_0x343c60){if(_0x343c60){_0x2ba2bd=_0x343c60;_0x576f86[_0x6073('0x46')]=_[_0x6073('0x49')](db[_0x6073('0x8d')][_0x6073('0x42')]);_0x576f86['query']=_[_0x6073('0x49')](_0x1c49e5['query']);_0x576f86[_0x6073('0x4a')]=_[_0x6073('0x4b')](_0x576f86['model'],_0x576f86[_0x6073('0x48')]);_0x4714fb[_0x6073('0x4c')]=_['intersection'](_0x576f86[_0x6073('0x46')],qs[_0x6073('0x4d')](_0x1c49e5[_0x6073('0x48')][_0x6073('0x4d')]));_0x4714fb['attributes']=_0x4714fb['attributes'][_0x6073('0x6f')]?_0x4714fb[_0x6073('0x4c')]:_0x576f86['model'];_0x4714fb[_0x6073('0x4f')]=qs[_0x6073('0x50')](_0x1c49e5[_0x6073('0x48')][_0x6073('0x50')]);_0x4714fb['where']=qs[_0x6073('0x4a')](_[_0x6073('0x51')](_0x1c49e5[_0x6073('0x48')],_0x576f86[_0x6073('0x4a')]));if(_0x1c49e5[_0x6073('0x48')][_0x6073('0x52')]){_0x4714fb[_0x6073('0x53')]=_[_0x6073('0x55')](_0x4714fb['where'],{'$or':_[_0x6073('0x41')](_0x4714fb[_0x6073('0x4c')],function(_0x1cf60b){var _0x20d851={};_0x20d851[_0x1cf60b]={'$like':'%'+_0x1c49e5['query']['filter']+'%'};return _0x20d851;})});}_0x4714fb=_[_0x6073('0x55')]({},_0x4714fb,_0x1c49e5[_0x6073('0x56')]);return _0x2ba2bd['getApplications'](_0x4714fb);}})['then'](function(_0x44d0eb){if(_0x44d0eb){_0x590f7e=_0x44d0eb['length'];if(!_0x1c49e5['query'][_0x6073('0x70')]('nolimit')){_0x4714fb[_0x6073('0x32')]=qs[_0x6073('0x32')](_0x1c49e5[_0x6073('0x48')][_0x6073('0x32')]);_0x4714fb[_0x6073('0x30')]=qs[_0x6073('0x30')](_0x1c49e5[_0x6073('0x48')][_0x6073('0x30')]);}return _0x2ba2bd[_0x6073('0xb8')](_0x4714fb);}})[_0x6073('0x23')](function(_0x735ef){if(_0x735ef){return _0x735ef?{'count':_0x590f7e,'rows':_0x735ef}:null;}})[_0x6073('0x23')](respondWithResult(_0x59e35d,null))[_0x6073('0x5f')](handleError(_0x59e35d,null));};exports[_0x6073('0xb9')]=function(_0x3b381f,_0x2c7e0b,_0x1a6af9){var _0xb80a8a={'raw':![],'where':{}};var _0x2df45e={};var _0x151378={'count':0x0,'rows':[]};return db[_0x6073('0x57')][_0x6073('0x74')]({'where':{'id':_0x3b381f[_0x6073('0x5d')]['id']}})[_0x6073('0x23')](handleEntityNotFound(_0x2c7e0b,null))[_0x6073('0x23')](function(_0x15c16a){if(_0x15c16a){_0x2df45e[_0x6073('0x46')]=_[_0x6073('0x49')](db[_0x6073('0x9a')][_0x6073('0x42')]);_0x2df45e[_0x6073('0x48')]=_[_0x6073('0x49')](_0x3b381f[_0x6073('0x48')]);_0x2df45e[_0x6073('0x4a')]=_[_0x6073('0x4b')](_0x2df45e[_0x6073('0x46')],_0x2df45e[_0x6073('0x48')]);_0xb80a8a[_0x6073('0x4c')]=_[_0x6073('0x4b')](_0x2df45e[_0x6073('0x46')],qs[_0x6073('0x4d')](_0x3b381f[_0x6073('0x48')][_0x6073('0x4d')]));_0xb80a8a[_0x6073('0x4c')]=_0xb80a8a[_0x6073('0x4c')]['length']?_0xb80a8a[_0x6073('0x4c')]:_0x2df45e[_0x6073('0x46')];if(!_0x3b381f[_0x6073('0x48')][_0x6073('0x70')](_0x6073('0x4e'))){_0xb80a8a[_0x6073('0x32')]=qs['limit'](_0x3b381f['query'][_0x6073('0x32')]);_0xb80a8a[_0x6073('0x30')]=qs[_0x6073('0x30')](_0x3b381f[_0x6073('0x48')][_0x6073('0x30')]);}_0xb80a8a[_0x6073('0x4f')]=qs['sort'](_0x3b381f['query'][_0x6073('0x50')]);_0xb80a8a[_0x6073('0x53')]=qs[_0x6073('0x4a')](_[_0x6073('0x51')](_0x3b381f[_0x6073('0x48')],_0x2df45e[_0x6073('0x4a')]));_0xb80a8a['where'][_0x6073('0x6d')]=_0x15c16a['id'];if(_0x3b381f[_0x6073('0x48')]['filter']){_0xb80a8a['where']=_[_0x6073('0x55')](_0xb80a8a[_0x6073('0x53')],{'$or':_[_0x6073('0x41')](_0xb80a8a['attributes'],function(_0x1cdc66){var _0x5a9c5e={};_0x5a9c5e[_0x1cdc66]={'$like':'%'+_0x3b381f[_0x6073('0x48')][_0x6073('0x52')]+'%'};return _0x5a9c5e;})});}_0xb80a8a=_[_0x6073('0x55')]({},_0xb80a8a,_0x3b381f[_0x6073('0x56')]);return db[_0x6073('0x9a')][_0x6073('0x33')]({'where':_0xb80a8a[_0x6073('0x53')]})[_0x6073('0x23')](function(_0x5e1f2f){_0x151378[_0x6073('0x33')]=_0x5e1f2f;if(_0x3b381f['query'][_0x6073('0x58')]){_0xb80a8a[_0x6073('0x59')]=[{'model':db[_0x6073('0x8a')],'as':_0x6073('0xba'),'required':![]},{'model':db[_0x6073('0xa6')],'as':_0x6073('0xbb'),'attributes':[_0x6073('0x47'),_0x6073('0xbc'),_0x6073('0xbd')],'required':![]},{'model':db[_0x6073('0xbe')],'as':_0x6073('0xbf'),'attributes':['id','name',_0x6073('0xc0')],'where':_0x3b381f[_0x6073('0x48')][_0x6073('0xc1')]?{'id':_0x3b381f['query'][_0x6073('0xc1')]}:undefined,'required':_0x3b381f[_0x6073('0x48')][_0x6073('0xc1')]?!![]:![]}];}return db[_0x6073('0x9a')][_0x6073('0x5a')](_0xb80a8a);})[_0x6073('0x23')](function(_0x3fd0a8){_0x151378[_0x6073('0x5b')]=_0x3fd0a8;return _0x151378;});}})[_0x6073('0x23')](respondWithFilteredResult(_0x2c7e0b,_0xb80a8a))[_0x6073('0x5f')](handleError(_0x2c7e0b,null));};exports[_0x6073('0xc2')]=function(_0x1aa0c3,_0x492631,_0x1b7996){return db['OpenchannelAccount'][_0x6073('0x5e')]({'where':{'id':_0x1aa0c3[_0x6073('0x5d')]['id']}})[_0x6073('0x23')](handleEntityNotFound(_0x492631,null))[_0x6073('0x23')](function(_0x2a9634){if(_0x2a9634){return _0x2a9634[_0x6073('0xc2')](_0x1aa0c3['body'][_0x6073('0x72')],_[_0x6073('0xc3')](_0x1aa0c3[_0x6073('0x60')],[_0x6073('0x72'),'id'])||{})[_0x6073('0x9b')](function(_0x14961f){for(var _0x13f326=0x0;_0x13f326<_0x1aa0c3[_0x6073('0x60')][_0x6073('0x72')][_0x6073('0x6f')];_0x13f326+=0x1){socket[_0x6073('0xc4')]('userOpenchannelAccount:save',{'UserId':Number(_0x1aa0c3[_0x6073('0x60')]['ids'][_0x13f326]),'OpenchannelAccountId':Number(_0x1aa0c3[_0x6073('0x5d')]['id'])});}return _0x14961f;});}})[_0x6073('0x23')](respondWithResult(_0x492631,null))['catch'](handleError(_0x492631,null));};exports[_0x6073('0xc5')]=function(_0x3efafd,_0x43ce89,_0x2785de){return db[_0x6073('0x57')][_0x6073('0x5e')]({'where':{'id':_0x3efafd[_0x6073('0x5d')]['id']}})['then'](handleEntityNotFound(_0x43ce89,null))[_0x6073('0x23')](function(_0x48f63c){if(_0x48f63c){return _0x48f63c[_0x6073('0xc5')](_0x3efafd[_0x6073('0x48')][_0x6073('0x72')])['then'](function(){if(_[_0x6073('0xc6')](_0x3efafd[_0x6073('0x48')][_0x6073('0x72')])){for(var _0x7d4edd=0x0;_0x7d4edd<_0x3efafd[_0x6073('0x48')]['ids'][_0x6073('0x6f')];_0x7d4edd+=0x1){socket[_0x6073('0xc4')](_0x6073('0xc7'),{'UserId':Number(_0x3efafd[_0x6073('0x48')][_0x6073('0x72')][_0x7d4edd]),'OpenchannelAccountId':Number(_0x3efafd[_0x6073('0x5d')]['id'])});}}else{socket[_0x6073('0xc4')](_0x6073('0xc7'),{'UserId':Number(_0x3efafd['query'][_0x6073('0x72')]),'OpenchannelAccountId':Number(_0x3efafd[_0x6073('0x5d')]['id'])});}});}})[_0x6073('0x23')](respondWithStatusCode(_0x43ce89,null))[_0x6073('0x5f')](handleError(_0x43ce89,null));};exports['getAgents']=function(_0x3d8345,_0x10a0c6,_0xa53dee){var _0x5e2e84={};var _0x46e920={};var _0x5bb07d;var _0x4bd39;return db[_0x6073('0x57')][_0x6073('0x74')]({'where':{'id':_0x3d8345[_0x6073('0x5d')]['id']}})['then'](handleEntityNotFound(_0x10a0c6,null))[_0x6073('0x23')](function(_0x53184b){if(_0x53184b){_0x5bb07d=_0x53184b;_0x46e920[_0x6073('0x46')]=_['keys'](db[_0x6073('0xa6')][_0x6073('0x42')]);_0x46e920[_0x6073('0x48')]=_[_0x6073('0x49')](_0x3d8345[_0x6073('0x48')]);_0x46e920[_0x6073('0x4a')]=_[_0x6073('0x4b')](_0x46e920[_0x6073('0x46')],_0x46e920[_0x6073('0x48')]);_0x5e2e84[_0x6073('0x4c')]=_['intersection'](_0x46e920[_0x6073('0x46')],qs[_0x6073('0x4d')](_0x3d8345[_0x6073('0x48')][_0x6073('0x4d')]));_0x5e2e84[_0x6073('0x4c')]=_0x5e2e84['attributes']['length']?_0x5e2e84[_0x6073('0x4c')]:_0x46e920['model'];_0x5e2e84['order']=qs['sort'](_0x3d8345[_0x6073('0x48')][_0x6073('0x50')]);_0x5e2e84[_0x6073('0x53')]=qs['filters'](_[_0x6073('0x51')](_0x3d8345[_0x6073('0x48')],_0x46e920[_0x6073('0x4a')]));if(_0x3d8345[_0x6073('0x48')][_0x6073('0x52')]){_0x5e2e84['where']=_[_0x6073('0x55')](_0x5e2e84['where'],{'$or':_[_0x6073('0x41')](_0x5e2e84[_0x6073('0x4c')],function(_0x376f08){var _0x12eb20={};_0x12eb20[_0x376f08]={'$like':'%'+_0x3d8345[_0x6073('0x48')][_0x6073('0x52')]+'%'};return _0x12eb20;})});}_0x5e2e84=_[_0x6073('0x55')]({},_0x5e2e84,_0x3d8345['options']);return _0x5bb07d[_0x6073('0xc8')](_0x5e2e84);}})[_0x6073('0x23')](function(_0x212ae6){if(_0x212ae6){_0x4bd39=_0x212ae6[_0x6073('0x6f')];if(!_0x3d8345['query'][_0x6073('0x70')](_0x6073('0x4e'))){_0x5e2e84[_0x6073('0x32')]=qs[_0x6073('0x32')](_0x3d8345[_0x6073('0x48')][_0x6073('0x32')]);_0x5e2e84[_0x6073('0x30')]=qs[_0x6073('0x30')](_0x3d8345['query'][_0x6073('0x30')]);}return _0x5bb07d[_0x6073('0xc8')](_0x5e2e84);}})['then'](function(_0x1c7148){if(_0x1c7148){return _0x1c7148?{'count':_0x4bd39,'rows':_0x1c7148}:null;}})['then'](respondWithResult(_0x10a0c6,null))[_0x6073('0x5f')](handleError(_0x10a0c6,null));};exports[_0x6073('0x3d')]=function(_0x106f9b,_0x22a882,_0x4cb5ef){var _0x1658a3,_0x57e142,_0x1f80d8;if(_['isNil'](_0x106f9b[_0x6073('0x60')][_0x6073('0x60')])||_0x106f9b[_0x6073('0x60')][_0x6073('0x60')]===''){throw new db[(_0x6073('0x79'))][(_0x6073('0x83'))]('body\x20is\x20mandatory\x20and\x20not\x20empty');}if(_['isNil'](_0x106f9b[_0x6073('0x60')]['to'])){}_0x1658a3=_0x106f9b[_0x6073('0x60')]['to'];return db[_0x6073('0x57')][_0x6073('0x74')]({'where':{'id':_0x106f9b[_0x6073('0x5d')]['id']}})[_0x6073('0x23')](handleEntityNotFound(_0x22a882,null))[_0x6073('0x23')](function(_0x472e88){if(_0x472e88){return db[_0x6073('0x57')]['find']({'where':{'id':_0x472e88['id']},'include':[{'model':db[_0x6073('0x88')],'as':_0x6073('0x89'),'include':[{'model':db[_0x6073('0x8a')],'as':_0x6073('0x8b'),'where':{[_0x472e88[_0x6073('0x84')]]:_0x1658a3},'limit':0x1,'order':[[_0x6073('0x7d'),_0x6073('0x8c')]]}]}]})['then'](handleEntityNotFound(_0x22a882,null))[_0x6073('0x23')](function(_0x657c67){if(_0x657c67&&_0x657c67['List']){_0x57e142=_0x657c67[_0x6073('0x3a')]({'plain':!![]});if(_0x57e142['List']&&_0x57e142[_0x6073('0x89')]['Contacts'][_0x6073('0x6f')]){return _0x57e142[_0x6073('0x89')]['Contacts'][0x0];}return db[_0x6073('0x8a')][_0x6073('0x68')](_[_0x6073('0x95')](_0x106f9b[_0x6073('0x60')],{'firstName':_0x1658a3,[_0x657c67[_0x6073('0x84')]]:_0x1658a3,'phone':_0x1658a3,'ListId':_0x57e142['ListId']}));}})[_0x6073('0x23')](handleEntityNotFound(_0x22a882,null))[_0x6073('0x23')](function(_0x311649){if(_0x311649){_0x1f80d8=_0x311649;return db[_0x6073('0x9a')][_0x6073('0x5e')]({'where':{'ContactId':_0x1f80d8['id'],'closed':![],'OpenchannelAccountId':_0x57e142['id']}})[_0x6073('0x23')](function(_0x12095c){if(_0x12095c){return[_0x12095c,![]];}return db[_0x6073('0x9a')][_0x6073('0x68')]({'UserId':_0x106f9b['user']['id'],'ContactId':_0x1f80d8['id'],'OpenchannelAccountId':_0x57e142['id'],'lastMsgDirection':_0x6073('0xc9'),'firstMsgDirection':_0x6073('0xc9'),'Messages':[_[_0x6073('0x55')](_0x106f9b['body'],{'read':![],'body':_0x106f9b[_0x6073('0x60')]['body'],'OpenchannelAccountId':_0x57e142['id'],'UserId':_0x106f9b[_0x6073('0x61')]['id'],'ContactId':_0x1f80d8['id']})]},{'include':[{'model':db[_0x6073('0xa3')],'as':_0x6073('0xca')}]})[_0x6073('0x23')](function(_0x36ce78){return[_0x36ce78,!![]];});});}})[_0x6073('0x9b')](function(_0x50bf1a,_0x1e99b5){if(_0x1e99b5){return _0x50bf1a;}return db[_0x6073('0xa3')]['create'](_[_0x6073('0x55')](_0x106f9b[_0x6073('0x60')],{'read':![],'body':_0x106f9b[_0x6073('0x60')][_0x6073('0x60')],'OpenchannelAccountId':_0x57e142['id'],'OpenchannelInteractionId':_0x50bf1a['id'],'UserId':_0x106f9b[_0x6073('0x61')]['id'],'ContactId':_0x1f80d8['id']}))[_0x6073('0x23')](function(_0x28f452){_0x50bf1a[_0x6073('0xcb')][_0x6073('0xca')]=[];_0x50bf1a[_0x6073('0xcb')][_0x6073('0xca')][_0x6073('0x9f')](_0x28f452[_0x6073('0xcb')]);return _0x50bf1a;});});}})[_0x6073('0x23')](respondWithResult(_0x22a882,null))[_0x6073('0x5f')](handleError(_0x22a882,null));}; \ No newline at end of file diff --git a/server/api/openchannelAccount/openchannelAccount.events.js b/server/api/openchannelAccount/openchannelAccount.events.js index 6d5bed3..b74c21d 100644 --- a/server/api/openchannelAccount/openchannelAccount.events.js +++ b/server/api/openchannelAccount/openchannelAccount.events.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x153f=['setMaxListeners','save','update','remove','emit','hasOwnProperty','hook','events','../../mysqldb','OpenchannelAccount'];(function(_0x31cc0a,_0x368956){var _0x4ff26d=function(_0x3d44c9){while(--_0x3d44c9){_0x31cc0a['push'](_0x31cc0a['shift']());}};_0x4ff26d(++_0x368956);}(_0x153f,0x15b));var _0xf153=function(_0x286455,_0x377e65){_0x286455=_0x286455-0x0;var _0x318155=_0x153f[_0x286455];return _0x318155;};'use strict';var EventEmitter=require(_0xf153('0x0'));var OpenchannelAccount=require(_0xf153('0x1'))['db'][_0xf153('0x2')];var OpenchannelAccountEvents=new EventEmitter();OpenchannelAccountEvents[_0xf153('0x3')](0x0);var events={'afterCreate':_0xf153('0x4'),'afterUpdate':_0xf153('0x5'),'afterDestroy':_0xf153('0x6')};function emitEvent(_0x59757c){return function(_0x364e65,_0x5c49c7,_0x1f9ead){OpenchannelAccountEvents[_0xf153('0x7')](_0x59757c+':'+_0x364e65['id'],_0x364e65);OpenchannelAccountEvents[_0xf153('0x7')](_0x59757c,_0x364e65);_0x1f9ead(null);};}for(var e in events){if(events[_0xf153('0x8')](e)){var event=events[e];OpenchannelAccount[_0xf153('0x9')](e,emitEvent(event));}}module['exports']=OpenchannelAccountEvents; \ No newline at end of file +var _0x9348=['../../mysqldb','OpenchannelAccount','setMaxListeners','save','remove','emit','hasOwnProperty','hook','events'];(function(_0x52fe6d,_0x39b193){var _0x1e33f4=function(_0x2810a8){while(--_0x2810a8){_0x52fe6d['push'](_0x52fe6d['shift']());}};_0x1e33f4(++_0x39b193);}(_0x9348,0x10d));var _0x8934=function(_0x3530af,_0x1210ac){_0x3530af=_0x3530af-0x0;var _0x236595=_0x9348[_0x3530af];return _0x236595;};'use strict';var EventEmitter=require(_0x8934('0x0'));var OpenchannelAccount=require(_0x8934('0x1'))['db'][_0x8934('0x2')];var OpenchannelAccountEvents=new EventEmitter();OpenchannelAccountEvents[_0x8934('0x3')](0x0);var events={'afterCreate':_0x8934('0x4'),'afterUpdate':'update','afterDestroy':_0x8934('0x5')};function emitEvent(_0x35da0b){return function(_0x5f34d7,_0x34f94c,_0x923aa3){OpenchannelAccountEvents[_0x8934('0x6')](_0x35da0b+':'+_0x5f34d7['id'],_0x5f34d7);OpenchannelAccountEvents[_0x8934('0x6')](_0x35da0b,_0x5f34d7);_0x923aa3(null);};}for(var e in events){if(events[_0x8934('0x7')](e)){var event=events[e];OpenchannelAccount[_0x8934('0x8')](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 ef4db9e..bd21136 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(_0x3d7aa7,_0x1668df){var _0x596301=function(_0x3cc307){while(--_0x3cc307){_0x3d7aa7['push'](_0x3d7aa7['shift']());}};_0x596301(++_0x1668df);}(_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(_0x33dcc8,_0x44da98){var _0x1b6df1=function(_0x2cb38c){while(--_0x2cb38c){_0x33dcc8['push'](_0x33dcc8['shift']());}};_0x1b6df1(++_0x44da98);}(_0xa9e0,0x123));var _0x0a9e=function(_0x47b58b,_0x41a189){_0x47b58b=_0x47b58b-0x0;var _0x46bebe=_0xa9e0[_0x47b58b];return _0x46bebe;};'use strict';var _=require(_0x0a9e('0x0'));var util=require(_0x0a9e('0x1'));var 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 0419746..c825184 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 _0x00b3=['OpenchannelAccount,\x20%s,\x20%s','result','catch','util','moment','bluebird','randomstring','../../mysqldb','../../config/logger','../../config/environment','jayson/promise','client','http','redis','./openchannelAccount.socket','register','then','info','request\x20sent','debug','OpenchannelAccount,\x20%s,\x20%s,\x20%s','stringify','error','code','message'];(function(_0x30e004,_0x46f8c2){var _0x5ca247=function(_0x20d80f){while(--_0x20d80f){_0x30e004['push'](_0x30e004['shift']());}};_0x5ca247(++_0x46f8c2);}(_0x00b3,0x17a));var _0x300b=function(_0x1cabc6,_0xe0604a){_0x1cabc6=_0x1cabc6-0x0;var _0x1719f7=_0x00b3[_0x1cabc6];return _0x1719f7;};'use strict';var _=require('lodash');var util=require(_0x300b('0x0'));var moment=require(_0x300b('0x1'));var BPromise=require(_0x300b('0x2'));var rs=require(_0x300b('0x3'));var fs=require('fs');var Redis=require('ioredis');var db=require(_0x300b('0x4'))['db'];var utils=require('../../config/utils');var logger=require(_0x300b('0x5'))('rpc');var config=require(_0x300b('0x6'));var jayson=require(_0x300b('0x7'));var client=jayson[_0x300b('0x8')][_0x300b('0x9')]({'port':0x232a});config['redis']=_['defaults'](config[_0x300b('0xa')],{'host':'localhost','port':0x18eb});var socket=require('socket.io-emitter')(new Redis(config[_0x300b('0xa')]));require(_0x300b('0xb'))[_0x300b('0xc')](socket);function respondWithRpcPromise(_0x4d8d78,_0x42e5a5,_0x3d907e){return new BPromise(function(_0x243abf,_0x212b2b){return client['request'](_0x4d8d78,_0x3d907e)[_0x300b('0xd')](function(_0x2eeb2d){logger[_0x300b('0xe')]('OpenchannelAccount,\x20%s,\x20%s',_0x42e5a5,_0x300b('0xf'));logger[_0x300b('0x10')](_0x300b('0x11'),_0x42e5a5,_0x300b('0xf'),JSON[_0x300b('0x12')](_0x2eeb2d));if(_0x2eeb2d[_0x300b('0x13')]){if(_0x2eeb2d[_0x300b('0x13')][_0x300b('0x14')]===0x1f4){logger['error']('OpenchannelAccount,\x20%s,\x20%s',_0x42e5a5,_0x2eeb2d['error']['message']);return _0x212b2b(_0x2eeb2d[_0x300b('0x13')][_0x300b('0x15')]);}logger[_0x300b('0x13')](_0x300b('0x16'),_0x42e5a5,_0x2eeb2d['error']['message']);return _0x243abf(_0x2eeb2d[_0x300b('0x13')][_0x300b('0x15')]);}else{logger[_0x300b('0xe')](_0x300b('0x16'),_0x42e5a5,'request\x20sent');_0x243abf(_0x2eeb2d[_0x300b('0x17')][_0x300b('0x15')]);}})[_0x300b('0x18')](function(_0x5cba7c){logger[_0x300b('0x13')](_0x300b('0x16'),_0x42e5a5,_0x5cba7c);_0x212b2b(_0x5cba7c);});});} \ No newline at end of file +var _0xde2c=['bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','rpc','../../config/environment','jayson/promise','client','http','defaults','redis','localhost','./openchannelAccount.socket','register','info','OpenchannelAccount,\x20%s,\x20%s','request\x20sent','debug','OpenchannelAccount,\x20%s,\x20%s,\x20%s','stringify','error','message','lodash','util','moment'];(function(_0x19197c,_0x4545b3){var _0x584f80=function(_0x189d8c){while(--_0x189d8c){_0x19197c['push'](_0x19197c['shift']());}};_0x584f80(++_0x4545b3);}(_0xde2c,0x7f));var _0xcde2=function(_0x43d16c,_0x2b5447){_0x43d16c=_0x43d16c-0x0;var _0x208cce=_0xde2c[_0x43d16c];return _0x208cce;};'use strict';var _=require(_0xcde2('0x0'));var util=require(_0xcde2('0x1'));var moment=require(_0xcde2('0x2'));var BPromise=require(_0xcde2('0x3'));var rs=require(_0xcde2('0x4'));var fs=require('fs');var Redis=require(_0xcde2('0x5'));var db=require(_0xcde2('0x6'))['db'];var utils=require(_0xcde2('0x7'));var logger=require('../../config/logger')(_0xcde2('0x8'));var config=require(_0xcde2('0x9'));var jayson=require(_0xcde2('0xa'));var client=jayson[_0xcde2('0xb')][_0xcde2('0xc')]({'port':0x232a});config['redis']=_[_0xcde2('0xd')](config[_0xcde2('0xe')],{'host':_0xcde2('0xf'),'port':0x18eb});var socket=require('socket.io-emitter')(new Redis(config['redis']));require(_0xcde2('0x10'))[_0xcde2('0x11')](socket);function respondWithRpcPromise(_0x4e9749,_0x181a73,_0x29f7e0){return new BPromise(function(_0x12a287,_0x127358){return client['request'](_0x4e9749,_0x29f7e0)['then'](function(_0x25677f){logger[_0xcde2('0x12')](_0xcde2('0x13'),_0x181a73,_0xcde2('0x14'));logger[_0xcde2('0x15')](_0xcde2('0x16'),_0x181a73,'request\x20sent',JSON[_0xcde2('0x17')](_0x25677f));if(_0x25677f['error']){if(_0x25677f[_0xcde2('0x18')]['code']===0x1f4){logger['error'](_0xcde2('0x13'),_0x181a73,_0x25677f[_0xcde2('0x18')][_0xcde2('0x19')]);return _0x127358(_0x25677f[_0xcde2('0x18')][_0xcde2('0x19')]);}logger['error'](_0xcde2('0x13'),_0x181a73,_0x25677f['error'][_0xcde2('0x19')]);return _0x12a287(_0x25677f[_0xcde2('0x18')][_0xcde2('0x19')]);}else{logger[_0xcde2('0x12')]('OpenchannelAccount,\x20%s,\x20%s',_0x181a73,'request\x20sent');_0x12a287(_0x25677f['result'][_0xcde2('0x19')]);}})['catch'](function(_0x285ac7){logger[_0xcde2('0x18')](_0xcde2('0x13'),_0x181a73,_0x285ac7);_0x127358(_0x285ac7);});});} \ No newline at end of file diff --git a/server/api/openchannelAccount/openchannelAccount.socket.js b/server/api/openchannelAccount/openchannelAccount.socket.js index 02870f7..39c0e73 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 _0x668b=['./openchannelAccount.events','save','update','removeListener','length'];(function(_0x55833b,_0x3965da){var _0x55932e=function(_0x520bdd){while(--_0x520bdd){_0x55833b['push'](_0x55833b['shift']());}};_0x55932e(++_0x3965da);}(_0x668b,0x140));var _0xb668=function(_0x5037ab,_0x43209e){_0x5037ab=_0x5037ab-0x0;var _0x512adb=_0x668b[_0x5037ab];return _0x512adb;};'use strict';var OpenchannelAccountEvents=require(_0xb668('0x0'));var events=[_0xb668('0x1'),'remove',_0xb668('0x2')];function createListener(_0x2c30c1,_0x49a53b){return function(_0x336ba4){_0x49a53b['emit'](_0x2c30c1,_0x336ba4);};}function removeListener(_0x2fab11,_0x4092a6){return function(){OpenchannelAccountEvents[_0xb668('0x3')](_0x2fab11,_0x4092a6);};}exports['register']=function(_0x9b99a8){for(var _0x296fa9=0x0,_0x3be92e=events[_0xb668('0x4')];_0x296fa9<_0x3be92e;_0x296fa9++){var _0x20b749=events[_0x296fa9];var _0x3f01bc=createListener('openchannelAccount:'+_0x20b749,_0x9b99a8);OpenchannelAccountEvents['on'](_0x20b749,_0x3f01bc);}}; \ No newline at end of file +var _0x5106=['removeListener','register','./openchannelAccount.events','remove'];(function(_0x3947c9,_0x4d6c97){var _0x2e7871=function(_0x1236cc){while(--_0x1236cc){_0x3947c9['push'](_0x3947c9['shift']());}};_0x2e7871(++_0x4d6c97);}(_0x5106,0x116));var _0x6510=function(_0x4565bf,_0x5ad9d6){_0x4565bf=_0x4565bf-0x0;var _0x5610ba=_0x5106[_0x4565bf];return _0x5610ba;};'use strict';var OpenchannelAccountEvents=require(_0x6510('0x0'));var events=['save',_0x6510('0x1'),'update'];function createListener(_0x183717,_0x4b0419){return function(_0x579fe8){_0x4b0419['emit'](_0x183717,_0x579fe8);};}function removeListener(_0x25620c,_0x4465c2){return function(){OpenchannelAccountEvents[_0x6510('0x2')](_0x25620c,_0x4465c2);};}exports[_0x6510('0x3')]=function(_0x28cb6e){for(var _0x2f5cb3=0x0,_0x485cfa=events['length'];_0x2f5cb3<_0x485cfa;_0x2f5cb3++){var _0x57164e=events[_0x2f5cb3];var _0x226e1a=createListener('openchannelAccount:'+_0x57164e,_0x28cb6e);OpenchannelAccountEvents['on'](_0x57164e,_0x226e1a);}}; \ No newline at end of file diff --git a/server/api/openchannelApplication/index.js b/server/api/openchannelApplication/index.js index 4141c6b..eeb231b 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 _0x7533=['express','Router','fs-extra','../../components/auth/service','../../components/interaction/service','get','isAuthenticated','show','post','create','put','update','delete','/:id','destroy','multer','path','connect-timeout'];(function(_0x367fb6,_0x26880d){var _0x3034be=function(_0xe971d8){while(--_0xe971d8){_0x367fb6['push'](_0x367fb6['shift']());}};_0x3034be(++_0x26880d);}(_0x7533,0x7b));var _0x3753=function(_0x3b37ff,_0x22af5a){_0x3b37ff=_0x3b37ff-0x0;var _0x47210b=_0x7533[_0x3b37ff];return _0x47210b;};'use strict';var multer=require(_0x3753('0x0'));var util=require('util');var path=require(_0x3753('0x1'));var timeout=require(_0x3753('0x2'));var express=require(_0x3753('0x3'));var router=express[_0x3753('0x4')]();var fs_extra=require(_0x3753('0x5'));var auth=require(_0x3753('0x6'));var interaction=require(_0x3753('0x7'));var config=require('../../config/environment');var controller=require('./openchannelApplication.controller');router[_0x3753('0x8')]('/',auth[_0x3753('0x9')](),controller['index']);router[_0x3753('0x8')]('/:id',auth['isAuthenticated'](),controller[_0x3753('0xa')]);router[_0x3753('0xb')]('/',auth[_0x3753('0x9')](),controller[_0x3753('0xc')]);router[_0x3753('0xd')]('/:id',auth[_0x3753('0x9')](),controller[_0x3753('0xe')]);router[_0x3753('0xf')](_0x3753('0x10'),auth[_0x3753('0x9')](),controller[_0x3753('0x11')]);module['exports']=router; \ No newline at end of file +var _0x925f=['connect-timeout','express','Router','fs-extra','../../components/auth/service','../../components/interaction/service','./openchannelApplication.controller','get','isAuthenticated','post','create','/:id','update','delete','destroy','multer'];(function(_0x40a045,_0x516f0e){var _0x1a687c=function(_0x48c9fe){while(--_0x48c9fe){_0x40a045['push'](_0x40a045['shift']());}};_0x1a687c(++_0x516f0e);}(_0x925f,0xff));var _0xf925=function(_0xcf82b2,_0x49ab9a){_0xcf82b2=_0xcf82b2-0x0;var _0x4275e9=_0x925f[_0xcf82b2];return _0x4275e9;};'use strict';var multer=require(_0xf925('0x0'));var util=require('util');var path=require('path');var timeout=require(_0xf925('0x1'));var express=require(_0xf925('0x2'));var router=express[_0xf925('0x3')]();var fs_extra=require(_0xf925('0x4'));var auth=require(_0xf925('0x5'));var interaction=require(_0xf925('0x6'));var config=require('../../config/environment');var controller=require(_0xf925('0x7'));router[_0xf925('0x8')]('/',auth[_0xf925('0x9')](),controller['index']);router[_0xf925('0x8')]('/:id',auth[_0xf925('0x9')](),controller['show']);router[_0xf925('0xa')]('/',auth['isAuthenticated'](),controller[_0xf925('0xb')]);router['put'](_0xf925('0xc'),auth[_0xf925('0x9')](),controller[_0xf925('0xd')]);router[_0xf925('0xe')](_0xf925('0xc'),auth['isAuthenticated'](),controller[_0xf925('0xf')]);module['exports']=router; \ No newline at end of file diff --git a/server/api/openchannelApplication/openchannelApplication.attributes.js b/server/api/openchannelApplication/openchannelApplication.attributes.js index b92d637..f454be9 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 _0x11d4=['noop','STRING','*,*,*,*','sequelize'];(function(_0x12b2e5,_0x2318d0){var _0x2cc1f=function(_0x58eff8){while(--_0x58eff8){_0x12b2e5['push'](_0x12b2e5['shift']());}};_0x2cc1f(++_0x2318d0);}(_0x11d4,0x1eb));var _0x411d=function(_0x1f68be,_0x346c25){_0x1f68be=_0x1f68be-0x0;var _0x4e094b=_0x11d4[_0x1f68be];return _0x4e094b;};'use strict';var Sequelize=require(_0x411d('0x0'));module['exports']={'priority':{'type':Sequelize['INTEGER'],'allowNull':![]},'app':{'type':Sequelize['STRING'],'allowNull':![],'defaultValue':_0x411d('0x1')},'appdata':{'type':Sequelize['TEXT']()},'description':{'type':Sequelize[_0x411d('0x2')]},'interval':{'type':Sequelize['STRING'],'defaultValue':_0x411d('0x3')}}; \ No newline at end of file +var _0x1c0a=['noop','TEXT','*,*,*,*','sequelize','exports','INTEGER','STRING'];(function(_0x1ea170,_0x28d157){var _0x32487e=function(_0x5bebe9){while(--_0x5bebe9){_0x1ea170['push'](_0x1ea170['shift']());}};_0x32487e(++_0x28d157);}(_0x1c0a,0x6c));var _0xa1c0=function(_0x1e0363,_0x292ef2){_0x1e0363=_0x1e0363-0x0;var _0x10b297=_0x1c0a[_0x1e0363];return _0x10b297;};'use strict';var Sequelize=require(_0xa1c0('0x0'));module[_0xa1c0('0x1')]={'priority':{'type':Sequelize[_0xa1c0('0x2')],'allowNull':![]},'app':{'type':Sequelize[_0xa1c0('0x3')],'allowNull':![],'defaultValue':_0xa1c0('0x4')},'appdata':{'type':Sequelize[_0xa1c0('0x5')]()},'description':{'type':Sequelize[_0xa1c0('0x3')]},'interval':{'type':Sequelize['STRING'],'defaultValue':_0xa1c0('0x6')}}; \ No newline at end of file diff --git a/server/api/openchannelApplication/openchannelApplication.controller.js b/server/api/openchannelApplication/openchannelApplication.controller.js index 2a08268..8dcd444 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 _0x7d90=['count','set','apply','reject','save','update','then','destroy','sendStatus','index','OpenchannelApplication','rawAttributes','fieldName','key','model','map','name','query','attributes','intersection','fields','nolimit','sort','pick','filters','filter','where','type','VIRTUAL','options','includeAll','include','findAll','rows','catch','show','params','keys','length','merge','find','create','body','eml-format','zip-dir','fast-json-patch','moment','mustache','util','path','to-csv','ejs','fs-extra','lodash','crypto','jsforce','desk.js','querystring','papaparse','ioredis','../../config/logger','api','../../config/environment','../../config/license/util','../../mysqldb','status','end','json','offset','undefined','limit'];(function(_0x2d6d88,_0x2ea070){var _0x1991b0=function(_0x13b3fe){while(--_0x13b3fe){_0x2d6d88['push'](_0x2d6d88['shift']());}};_0x1991b0(++_0x2ea070);}(_0x7d90,0x1d5));var _0x07d9=function(_0x34132a,_0x12259d){_0x34132a=_0x34132a-0x0;var _0x2c99c2=_0x7d90[_0x34132a];return _0x2c99c2;};'use strict';var emlformat=require(_0x07d9('0x0'));var rimraf=require('rimraf');var zipdir=require(_0x07d9('0x1'));var jsonpatch=require(_0x07d9('0x2'));var rp=require('request-promise');var moment=require(_0x07d9('0x3'));var BPromise=require('bluebird');var Mustache=require(_0x07d9('0x4'));var util=require(_0x07d9('0x5'));var path=require(_0x07d9('0x6'));var sox=require('sox');var csv=require(_0x07d9('0x7'));var ejs=require(_0x07d9('0x8'));var fs=require('fs');var fs_extra=require(_0x07d9('0x9'));var _=require(_0x07d9('0xa'));var squel=require('squel');var crypto=require(_0x07d9('0xb'));var jsforce=require(_0x07d9('0xc'));var deskjs=require(_0x07d9('0xd'));var toCsv=require(_0x07d9('0x7'));var querystring=require(_0x07d9('0xe'));var Papa=require(_0x07d9('0xf'));var Redis=require(_0x07d9('0x10'));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(_0x07d9('0x11'))(_0x07d9('0x12'));var utils=require('../../config/utils');var config=require(_0x07d9('0x13'));var licenseUtil=require(_0x07d9('0x14'));var db=require(_0x07d9('0x15'))['db'];function respondWithStatusCode(_0xab83e9,_0x59d89b){_0x59d89b=_0x59d89b||0xcc;return function(_0x414aa8){if(_0x414aa8){return _0xab83e9['sendStatus'](_0x59d89b);}return _0xab83e9[_0x07d9('0x16')](_0x59d89b)[_0x07d9('0x17')]();};}function respondWithResult(_0x2cbdae,_0x1ef114){_0x1ef114=_0x1ef114||0xc8;return function(_0x3168d1){if(_0x3168d1){return _0x2cbdae[_0x07d9('0x16')](_0x1ef114)[_0x07d9('0x18')](_0x3168d1);}};}function respondWithFilteredResult(_0x19208e,_0x187762){return function(_0x335a21){if(_0x335a21){var _0x430736=typeof _0x187762[_0x07d9('0x19')]===_0x07d9('0x1a')&&typeof _0x187762[_0x07d9('0x1b')]===_0x07d9('0x1a');var _0x12f775=_0x335a21[_0x07d9('0x1c')];var _0x36a2af=_0x430736?0x0:_0x187762['offset'];var _0x3648d4=_0x430736?_0x335a21['count']:_0x187762[_0x07d9('0x19')]+_0x187762[_0x07d9('0x1b')];var _0x5bffcb;if(_0x3648d4>=_0x12f775){_0x3648d4=_0x12f775;_0x5bffcb=0xc8;}else{_0x5bffcb=0xce;}_0x19208e['status'](_0x5bffcb);return _0x19208e[_0x07d9('0x1d')]('Content-Range',_0x36a2af+'-'+_0x3648d4+'/'+_0x12f775)[_0x07d9('0x18')](_0x335a21);}return null;};}function patchUpdates(_0x52e089){return function(_0x22bc68){try{jsonpatch[_0x07d9('0x1e')](_0x22bc68,_0x52e089,!![]);}catch(_0x37dc7c){return BPromise[_0x07d9('0x1f')](_0x37dc7c);}return _0x22bc68[_0x07d9('0x20')]();};}function saveUpdates(_0x13a594,_0x530139){return function(_0x219838){if(_0x219838){return _0x219838[_0x07d9('0x21')](_0x13a594)[_0x07d9('0x22')](function(_0x4eaee7){return _0x4eaee7;});}return null;};}function removeEntity(_0x1dc962,_0x56634c){return function(_0x161066){if(_0x161066){return _0x161066[_0x07d9('0x23')]()['then'](function(){_0x1dc962['status'](0xcc)['end']();});}};}function handleEntityNotFound(_0xc9812e,_0x768796){return function(_0x198f79){if(!_0x198f79){_0xc9812e[_0x07d9('0x24')](0x194);}return _0x198f79;};}function handleError(_0x197081,_0x4f5144){_0x4f5144=_0x4f5144||0x1f4;return function(_0x153af8){logger['error'](_0x153af8['stack']);if(_0x153af8['name']){delete _0x153af8['name'];}_0x197081[_0x07d9('0x16')](_0x4f5144)['send'](_0x153af8);};}exports[_0x07d9('0x25')]=function(_0x376c93,_0x340e2c){var _0x2f0fd2={},_0x4c430c={},_0x35a8c8={'count':0x0,'rows':[]};var _0x5dc706=_['map'](db[_0x07d9('0x26')][_0x07d9('0x27')],function(_0x27f883){return{'name':_0x27f883[_0x07d9('0x28')],'type':_0x27f883['type'][_0x07d9('0x29')]};});_0x4c430c[_0x07d9('0x2a')]=_[_0x07d9('0x2b')](_0x5dc706,_0x07d9('0x2c'));_0x4c430c[_0x07d9('0x2d')]=_['keys'](_0x376c93[_0x07d9('0x2d')]);_0x4c430c['filters']=_['intersection'](_0x4c430c[_0x07d9('0x2a')],_0x4c430c[_0x07d9('0x2d')]);_0x2f0fd2[_0x07d9('0x2e')]=_[_0x07d9('0x2f')](_0x4c430c[_0x07d9('0x2a')],qs[_0x07d9('0x30')](_0x376c93[_0x07d9('0x2d')][_0x07d9('0x30')]));_0x2f0fd2['attributes']=_0x2f0fd2[_0x07d9('0x2e')]['length']?_0x2f0fd2[_0x07d9('0x2e')]:_0x4c430c['model'];if(!_0x376c93[_0x07d9('0x2d')]['hasOwnProperty'](_0x07d9('0x31'))){_0x2f0fd2[_0x07d9('0x1b')]=qs[_0x07d9('0x1b')](_0x376c93['query'][_0x07d9('0x1b')]);_0x2f0fd2[_0x07d9('0x19')]=qs[_0x07d9('0x19')](_0x376c93['query']['offset']);}_0x2f0fd2['order']=qs['sort'](_0x376c93[_0x07d9('0x2d')][_0x07d9('0x32')]);_0x2f0fd2['where']=qs['filters'](_[_0x07d9('0x33')](_0x376c93['query'],_0x4c430c[_0x07d9('0x34')]),_0x5dc706);if(_0x376c93[_0x07d9('0x2d')][_0x07d9('0x35')]){_0x2f0fd2['where']=_['merge'](_0x2f0fd2[_0x07d9('0x36')],{'$or':_[_0x07d9('0x2b')](_0x5dc706,function(_0x229f33){if(_0x229f33[_0x07d9('0x37')]!==_0x07d9('0x38')){var _0x3537cb={};_0x3537cb[_0x229f33['name']]={'$like':'%'+_0x376c93[_0x07d9('0x2d')]['filter']+'%'};return _0x3537cb;}})});}_0x2f0fd2=_['merge']({},_0x2f0fd2,_0x376c93[_0x07d9('0x39')]);var _0x2aeb7d={'where':_0x2f0fd2[_0x07d9('0x36')]};return db['OpenchannelApplication'][_0x07d9('0x1c')](_0x2aeb7d)[_0x07d9('0x22')](function(_0x43a272){_0x35a8c8['count']=_0x43a272;if(_0x376c93[_0x07d9('0x2d')][_0x07d9('0x3a')]){_0x2f0fd2[_0x07d9('0x3b')]=[{'all':!![]}];}return db[_0x07d9('0x26')][_0x07d9('0x3c')](_0x2f0fd2);})[_0x07d9('0x22')](function(_0xb09d13){_0x35a8c8[_0x07d9('0x3d')]=_0xb09d13;return _0x35a8c8;})[_0x07d9('0x22')](respondWithFilteredResult(_0x340e2c,_0x2f0fd2))[_0x07d9('0x3e')](handleError(_0x340e2c,null));};exports[_0x07d9('0x3f')]=function(_0x181e2c,_0x3aacd9){var _0x1054b7={'raw':!![],'where':{'id':_0x181e2c[_0x07d9('0x40')]['id']}},_0x388892={};_0x388892[_0x07d9('0x2a')]=_[_0x07d9('0x41')](db['OpenchannelApplication'][_0x07d9('0x27')]);_0x388892['query']=_[_0x07d9('0x41')](_0x181e2c[_0x07d9('0x2d')]);_0x388892[_0x07d9('0x34')]=_['intersection'](_0x388892[_0x07d9('0x2a')],_0x388892[_0x07d9('0x2d')]);_0x1054b7[_0x07d9('0x2e')]=_['intersection'](_0x388892[_0x07d9('0x2a')],qs[_0x07d9('0x30')](_0x181e2c[_0x07d9('0x2d')][_0x07d9('0x30')]));_0x1054b7[_0x07d9('0x2e')]=_0x1054b7[_0x07d9('0x2e')][_0x07d9('0x42')]?_0x1054b7[_0x07d9('0x2e')]:_0x388892[_0x07d9('0x2a')];if(_0x181e2c[_0x07d9('0x2d')][_0x07d9('0x3a')]){_0x1054b7['include']=[{'all':!![]}];}_0x1054b7=_[_0x07d9('0x43')]({},_0x1054b7,_0x181e2c[_0x07d9('0x39')]);return db[_0x07d9('0x26')][_0x07d9('0x44')](_0x1054b7)['then'](handleEntityNotFound(_0x3aacd9,null))[_0x07d9('0x22')](respondWithResult(_0x3aacd9,null))[_0x07d9('0x3e')](handleError(_0x3aacd9,null));};exports[_0x07d9('0x45')]=function(_0x14b751,_0x3346e9){return db[_0x07d9('0x26')][_0x07d9('0x45')](_0x14b751[_0x07d9('0x46')],{})[_0x07d9('0x22')](respondWithResult(_0x3346e9,0xc9))[_0x07d9('0x3e')](handleError(_0x3346e9,null));};exports['update']=function(_0x2a74ef,_0x526b05){if(_0x2a74ef[_0x07d9('0x46')]['id']){delete _0x2a74ef[_0x07d9('0x46')]['id'];}return db[_0x07d9('0x26')][_0x07d9('0x44')]({'where':{'id':_0x2a74ef['params']['id']}})['then'](handleEntityNotFound(_0x526b05,null))[_0x07d9('0x22')](saveUpdates(_0x2a74ef['body'],null))[_0x07d9('0x22')](respondWithResult(_0x526b05,null))[_0x07d9('0x3e')](handleError(_0x526b05,null));};exports[_0x07d9('0x23')]=function(_0x5bdaa7,_0x5f0137){return db[_0x07d9('0x26')][_0x07d9('0x44')]({'where':{'id':_0x5bdaa7[_0x07d9('0x40')]['id']}})[_0x07d9('0x22')](handleEntityNotFound(_0x5f0137,null))[_0x07d9('0x22')](removeEntity(_0x5f0137,null))[_0x07d9('0x3e')](handleError(_0x5f0137,null));}; \ No newline at end of file +var _0x3e6c=['show','params','fields','find','catch','create','body','update','destroy','eml-format','rimraf','zip-dir','fast-json-patch','moment','mustache','util','path','sox','ejs','fs-extra','lodash','squel','jsforce','desk.js','to-csv','ioredis','../../components/auth/service','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','sendStatus','status','end','offset','undefined','limit','count','set','Content-Range','json','apply','reject','then','stack','name','send','index','map','fieldName','type','key','model','keys','query','filters','intersection','attributes','length','hasOwnProperty','nolimit','sort','where','pick','merge','VIRTUAL','filter','options','OpenchannelApplication','includeAll','include','findAll'];(function(_0x51cbd1,_0x183e5f){var _0x591c08=function(_0x320349){while(--_0x320349){_0x51cbd1['push'](_0x51cbd1['shift']());}};_0x591c08(++_0x183e5f);}(_0x3e6c,0xea));var _0xc3e6=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0x3e6c[_0x3dd15e];return _0x231fd0;};'use strict';var emlformat=require(_0xc3e6('0x0'));var rimraf=require(_0xc3e6('0x1'));var zipdir=require(_0xc3e6('0x2'));var jsonpatch=require(_0xc3e6('0x3'));var rp=require('request-promise');var moment=require(_0xc3e6('0x4'));var BPromise=require('bluebird');var Mustache=require(_0xc3e6('0x5'));var util=require(_0xc3e6('0x6'));var path=require(_0xc3e6('0x7'));var sox=require(_0xc3e6('0x8'));var csv=require('to-csv');var ejs=require(_0xc3e6('0x9'));var fs=require('fs');var fs_extra=require(_0xc3e6('0xa'));var _=require(_0xc3e6('0xb'));var squel=require(_0xc3e6('0xc'));var crypto=require('crypto');var jsforce=require(_0xc3e6('0xd'));var deskjs=require(_0xc3e6('0xe'));var toCsv=require(_0xc3e6('0xf'));var querystring=require('querystring');var Papa=require('papaparse');var Redis=require(_0xc3e6('0x10'));var authService=require(_0xc3e6('0x11'));var qs=require('../../components/parsers/qs');var as=require(_0xc3e6('0x12'));var hardwareService=require(_0xc3e6('0x13'));var logger=require(_0xc3e6('0x14'))('api');var utils=require(_0xc3e6('0x15'));var config=require(_0xc3e6('0x16'));var licenseUtil=require(_0xc3e6('0x17'));var db=require(_0xc3e6('0x18'))['db'];function respondWithStatusCode(_0xd091aa,_0x4d906f){_0x4d906f=_0x4d906f||0xcc;return function(_0x23f2af){if(_0x23f2af){return _0xd091aa[_0xc3e6('0x19')](_0x4d906f);}return _0xd091aa[_0xc3e6('0x1a')](_0x4d906f)[_0xc3e6('0x1b')]();};}function respondWithResult(_0x53dd10,_0x8b9bfb){_0x8b9bfb=_0x8b9bfb||0xc8;return function(_0x3a05ea){if(_0x3a05ea){return _0x53dd10[_0xc3e6('0x1a')](_0x8b9bfb)['json'](_0x3a05ea);}};}function respondWithFilteredResult(_0x46cc0b,_0x500eb4){return function(_0x287ea4){if(_0x287ea4){var _0x455c24=typeof _0x500eb4[_0xc3e6('0x1c')]===_0xc3e6('0x1d')&&typeof _0x500eb4[_0xc3e6('0x1e')]===_0xc3e6('0x1d');var _0x1025fc=_0x287ea4[_0xc3e6('0x1f')];var _0x5b3f18=_0x455c24?0x0:_0x500eb4['offset'];var _0x3cc11b=_0x455c24?_0x287ea4['count']:_0x500eb4[_0xc3e6('0x1c')]+_0x500eb4[_0xc3e6('0x1e')];var _0x32ef31;if(_0x3cc11b>=_0x1025fc){_0x3cc11b=_0x1025fc;_0x32ef31=0xc8;}else{_0x32ef31=0xce;}_0x46cc0b[_0xc3e6('0x1a')](_0x32ef31);return _0x46cc0b[_0xc3e6('0x20')](_0xc3e6('0x21'),_0x5b3f18+'-'+_0x3cc11b+'/'+_0x1025fc)[_0xc3e6('0x22')](_0x287ea4);}return null;};}function patchUpdates(_0x4b4e2b){return function(_0x499dfb){try{jsonpatch[_0xc3e6('0x23')](_0x499dfb,_0x4b4e2b,!![]);}catch(_0x3e93c2){return BPromise[_0xc3e6('0x24')](_0x3e93c2);}return _0x499dfb['save']();};}function saveUpdates(_0x8ae250,_0x5e4db1){return function(_0x54c757){if(_0x54c757){return _0x54c757['update'](_0x8ae250)[_0xc3e6('0x25')](function(_0x4bec91){return _0x4bec91;});}return null;};}function removeEntity(_0x329c0b,_0x4ad2f0){return function(_0x145bca){if(_0x145bca){return _0x145bca['destroy']()[_0xc3e6('0x25')](function(){_0x329c0b[_0xc3e6('0x1a')](0xcc)[_0xc3e6('0x1b')]();});}};}function handleEntityNotFound(_0x4cab18,_0x5abb3c){return function(_0x53d3db){if(!_0x53d3db){_0x4cab18[_0xc3e6('0x19')](0x194);}return _0x53d3db;};}function handleError(_0x70074b,_0x5afdc6){_0x5afdc6=_0x5afdc6||0x1f4;return function(_0xbf6ba){logger['error'](_0xbf6ba[_0xc3e6('0x26')]);if(_0xbf6ba[_0xc3e6('0x27')]){delete _0xbf6ba[_0xc3e6('0x27')];}_0x70074b['status'](_0x5afdc6)[_0xc3e6('0x28')](_0xbf6ba);};}exports[_0xc3e6('0x29')]=function(_0x23a7f5,_0x390312){var _0x1286a7={},_0x4598a9={},_0xcccc9c={'count':0x0,'rows':[]};var _0x302abb=_[_0xc3e6('0x2a')](db['OpenchannelApplication']['rawAttributes'],function(_0x1c1596){return{'name':_0x1c1596[_0xc3e6('0x2b')],'type':_0x1c1596[_0xc3e6('0x2c')][_0xc3e6('0x2d')]};});_0x4598a9[_0xc3e6('0x2e')]=_[_0xc3e6('0x2a')](_0x302abb,_0xc3e6('0x27'));_0x4598a9['query']=_[_0xc3e6('0x2f')](_0x23a7f5[_0xc3e6('0x30')]);_0x4598a9[_0xc3e6('0x31')]=_[_0xc3e6('0x32')](_0x4598a9['model'],_0x4598a9[_0xc3e6('0x30')]);_0x1286a7[_0xc3e6('0x33')]=_[_0xc3e6('0x32')](_0x4598a9[_0xc3e6('0x2e')],qs['fields'](_0x23a7f5['query']['fields']));_0x1286a7['attributes']=_0x1286a7[_0xc3e6('0x33')][_0xc3e6('0x34')]?_0x1286a7[_0xc3e6('0x33')]:_0x4598a9['model'];if(!_0x23a7f5['query'][_0xc3e6('0x35')](_0xc3e6('0x36'))){_0x1286a7['limit']=qs[_0xc3e6('0x1e')](_0x23a7f5['query'][_0xc3e6('0x1e')]);_0x1286a7[_0xc3e6('0x1c')]=qs['offset'](_0x23a7f5[_0xc3e6('0x30')]['offset']);}_0x1286a7['order']=qs[_0xc3e6('0x37')](_0x23a7f5['query'][_0xc3e6('0x37')]);_0x1286a7[_0xc3e6('0x38')]=qs[_0xc3e6('0x31')](_[_0xc3e6('0x39')](_0x23a7f5['query'],_0x4598a9[_0xc3e6('0x31')]),_0x302abb);if(_0x23a7f5['query']['filter']){_0x1286a7['where']=_[_0xc3e6('0x3a')](_0x1286a7[_0xc3e6('0x38')],{'$or':_[_0xc3e6('0x2a')](_0x302abb,function(_0x1f9324){if(_0x1f9324[_0xc3e6('0x2c')]!==_0xc3e6('0x3b')){var _0x2790e2={};_0x2790e2[_0x1f9324['name']]={'$like':'%'+_0x23a7f5[_0xc3e6('0x30')][_0xc3e6('0x3c')]+'%'};return _0x2790e2;}})});}_0x1286a7=_[_0xc3e6('0x3a')]({},_0x1286a7,_0x23a7f5[_0xc3e6('0x3d')]);var _0x1a4398={'where':_0x1286a7[_0xc3e6('0x38')]};return db[_0xc3e6('0x3e')][_0xc3e6('0x1f')](_0x1a4398)[_0xc3e6('0x25')](function(_0x4c8491){_0xcccc9c['count']=_0x4c8491;if(_0x23a7f5[_0xc3e6('0x30')][_0xc3e6('0x3f')]){_0x1286a7[_0xc3e6('0x40')]=[{'all':!![]}];}return db['OpenchannelApplication'][_0xc3e6('0x41')](_0x1286a7);})[_0xc3e6('0x25')](function(_0x2900f3){_0xcccc9c['rows']=_0x2900f3;return _0xcccc9c;})[_0xc3e6('0x25')](respondWithFilteredResult(_0x390312,_0x1286a7))['catch'](handleError(_0x390312,null));};exports[_0xc3e6('0x42')]=function(_0x53326c,_0x337862){var _0x18174f={'raw':!![],'where':{'id':_0x53326c[_0xc3e6('0x43')]['id']}},_0x1e85a0={};_0x1e85a0[_0xc3e6('0x2e')]=_['keys'](db[_0xc3e6('0x3e')]['rawAttributes']);_0x1e85a0[_0xc3e6('0x30')]=_[_0xc3e6('0x2f')](_0x53326c[_0xc3e6('0x30')]);_0x1e85a0[_0xc3e6('0x31')]=_[_0xc3e6('0x32')](_0x1e85a0['model'],_0x1e85a0[_0xc3e6('0x30')]);_0x18174f[_0xc3e6('0x33')]=_[_0xc3e6('0x32')](_0x1e85a0[_0xc3e6('0x2e')],qs['fields'](_0x53326c[_0xc3e6('0x30')][_0xc3e6('0x44')]));_0x18174f['attributes']=_0x18174f[_0xc3e6('0x33')][_0xc3e6('0x34')]?_0x18174f[_0xc3e6('0x33')]:_0x1e85a0[_0xc3e6('0x2e')];if(_0x53326c[_0xc3e6('0x30')][_0xc3e6('0x3f')]){_0x18174f[_0xc3e6('0x40')]=[{'all':!![]}];}_0x18174f=_[_0xc3e6('0x3a')]({},_0x18174f,_0x53326c[_0xc3e6('0x3d')]);return db[_0xc3e6('0x3e')][_0xc3e6('0x45')](_0x18174f)[_0xc3e6('0x25')](handleEntityNotFound(_0x337862,null))[_0xc3e6('0x25')](respondWithResult(_0x337862,null))[_0xc3e6('0x46')](handleError(_0x337862,null));};exports[_0xc3e6('0x47')]=function(_0x4329f6,_0xdb4463){return db[_0xc3e6('0x3e')][_0xc3e6('0x47')](_0x4329f6[_0xc3e6('0x48')],{})['then'](respondWithResult(_0xdb4463,0xc9))[_0xc3e6('0x46')](handleError(_0xdb4463,null));};exports[_0xc3e6('0x49')]=function(_0x6d1318,_0x563009){if(_0x6d1318['body']['id']){delete _0x6d1318['body']['id'];}return db[_0xc3e6('0x3e')][_0xc3e6('0x45')]({'where':{'id':_0x6d1318[_0xc3e6('0x43')]['id']}})[_0xc3e6('0x25')](handleEntityNotFound(_0x563009,null))[_0xc3e6('0x25')](saveUpdates(_0x6d1318[_0xc3e6('0x48')],null))[_0xc3e6('0x25')](respondWithResult(_0x563009,null))[_0xc3e6('0x46')](handleError(_0x563009,null));};exports[_0xc3e6('0x4a')]=function(_0x22883f,_0x377f2c){return db[_0xc3e6('0x3e')][_0xc3e6('0x45')]({'where':{'id':_0x22883f['params']['id']}})[_0xc3e6('0x25')](handleEntityNotFound(_0x377f2c,null))['then'](removeEntity(_0x377f2c,null))[_0xc3e6('0x46')](handleError(_0x377f2c,null));}; \ No newline at end of file diff --git a/server/api/openchannelApplication/openchannelApplication.model.js b/server/api/openchannelApplication/openchannelApplication.model.js index 778e8c2..f72fd36 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 _0x7b3e=['request-promise','path','rimraf','../../config/environment','./openchannelApplication.attributes','exports','define','OpenchannelApplication','utf8mb4','utf8mb4_unicode_ci','lodash','../../config/logger','api','moment','bluebird'];(function(_0x24a88e,_0x22a0b8){var _0x232cbb=function(_0x50b7a4){while(--_0x50b7a4){_0x24a88e['push'](_0x24a88e['shift']());}};_0x232cbb(++_0x22a0b8);}(_0x7b3e,0x1cc));var _0xe7b3=function(_0x55e2ab,_0x2b0d23){_0x55e2ab=_0x55e2ab-0x0;var _0x76a2b4=_0x7b3e[_0x55e2ab];return _0x76a2b4;};'use strict';var _=require(_0xe7b3('0x0'));var util=require('util');var logger=require(_0xe7b3('0x1'))(_0xe7b3('0x2'));var moment=require(_0xe7b3('0x3'));var BPromise=require(_0xe7b3('0x4'));var rp=require(_0xe7b3('0x5'));var fs=require('fs');var path=require(_0xe7b3('0x6'));var rimraf=require(_0xe7b3('0x7'));var config=require(_0xe7b3('0x8'));var attributes=require(_0xe7b3('0x9'));module[_0xe7b3('0xa')]=function(_0x24a55e,_0x4a2b9a){return _0x24a55e[_0xe7b3('0xb')](_0xe7b3('0xc'),attributes,{'tableName':'openchannel_applications','paranoid':![],'indexes':[],'timestamps':!![],'charset':_0xe7b3('0xd'),'collate':_0xe7b3('0xe')});}; \ No newline at end of file +var _0xa5a7=['../../config/logger','bluebird','request-promise','rimraf','./openchannelApplication.attributes','define','OpenchannelApplication','openchannel_applications','utf8mb4','utf8mb4_unicode_ci','lodash','util'];(function(_0x119d13,_0x263cd2){var _0x333c35=function(_0x422c6e){while(--_0x422c6e){_0x119d13['push'](_0x119d13['shift']());}};_0x333c35(++_0x263cd2);}(_0xa5a7,0x1d2));var _0x7a5a=function(_0x419ba8,_0x671bd3){_0x419ba8=_0x419ba8-0x0;var _0xf71a31=_0xa5a7[_0x419ba8];return _0xf71a31;};'use strict';var _=require(_0x7a5a('0x0'));var util=require(_0x7a5a('0x1'));var logger=require(_0x7a5a('0x2'))('api');var moment=require('moment');var BPromise=require(_0x7a5a('0x3'));var rp=require(_0x7a5a('0x4'));var fs=require('fs');var path=require('path');var rimraf=require(_0x7a5a('0x5'));var config=require('../../config/environment');var attributes=require(_0x7a5a('0x6'));module['exports']=function(_0x2a9278,_0x3abc1a){return _0x2a9278[_0x7a5a('0x7')](_0x7a5a('0x8'),attributes,{'tableName':_0x7a5a('0x9'),'paranoid':![],'indexes':[],'timestamps':!![],'charset':_0x7a5a('0xa'),'collate':_0x7a5a('0xb')});}; \ No newline at end of file diff --git a/server/api/openchannelApplication/openchannelApplication.rpc.js b/server/api/openchannelApplication/openchannelApplication.rpc.js index b8efe62..3bca0d9 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 _0xbe13=['message','OpenchannelApplication,\x20%s,\x20%s','result','catch','UpdateOpenchannelApplication','OpenchannelApplication','update','body','raw','options','where','attributes','limit','lodash','util','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/logger','../../config/environment','jayson/promise','client','http','request','then','info','request\x20sent','debug','OpenchannelApplication,\x20%s,\x20%s,\x20%s','stringify','error','code'];(function(_0x2d4661,_0x2da65c){var _0x42ed1e=function(_0x263c50){while(--_0x263c50){_0x2d4661['push'](_0x2d4661['shift']());}};_0x42ed1e(++_0x2da65c);}(_0xbe13,0x13f));var _0x3be1=function(_0x50a957,_0x445378){_0x50a957=_0x50a957-0x0;var _0x5262c4=_0xbe13[_0x50a957];return _0x5262c4;};'use strict';var _=require(_0x3be1('0x0'));var util=require(_0x3be1('0x1'));var moment=require(_0x3be1('0x2'));var BPromise=require(_0x3be1('0x3'));var rs=require(_0x3be1('0x4'));var fs=require('fs');var Redis=require(_0x3be1('0x5'));var db=require(_0x3be1('0x6'))['db'];var utils=require('../../config/utils');var logger=require(_0x3be1('0x7'))('rpc');var config=require(_0x3be1('0x8'));var jayson=require(_0x3be1('0x9'));var client=jayson[_0x3be1('0xa')][_0x3be1('0xb')]({'port':0x232a});function respondWithRpcPromise(_0x5b7071,_0x41c1c6,_0x46330a){return new BPromise(function(_0x448fe4,_0x17ac16){return client[_0x3be1('0xc')](_0x5b7071,_0x46330a)[_0x3be1('0xd')](function(_0x282715){logger[_0x3be1('0xe')]('OpenchannelApplication,\x20%s,\x20%s',_0x41c1c6,_0x3be1('0xf'));logger[_0x3be1('0x10')](_0x3be1('0x11'),_0x41c1c6,'request\x20sent',JSON[_0x3be1('0x12')](_0x282715));if(_0x282715[_0x3be1('0x13')]){if(_0x282715[_0x3be1('0x13')][_0x3be1('0x14')]===0x1f4){logger[_0x3be1('0x13')]('OpenchannelApplication,\x20%s,\x20%s',_0x41c1c6,_0x282715[_0x3be1('0x13')][_0x3be1('0x15')]);return _0x17ac16(_0x282715[_0x3be1('0x13')][_0x3be1('0x15')]);}logger['error'](_0x3be1('0x16'),_0x41c1c6,_0x282715['error'][_0x3be1('0x15')]);return _0x448fe4(_0x282715['error'][_0x3be1('0x15')]);}else{logger[_0x3be1('0xe')](_0x3be1('0x16'),_0x41c1c6,_0x3be1('0xf'));_0x448fe4(_0x282715[_0x3be1('0x17')][_0x3be1('0x15')]);}})[_0x3be1('0x18')](function(_0x4a5bbe){logger[_0x3be1('0x13')](_0x3be1('0x16'),_0x41c1c6,_0x4a5bbe);_0x17ac16(_0x4a5bbe);});});}exports[_0x3be1('0x19')]=function(_0x2c6765){var _0x38ea8e=this;return new Promise(function(_0x5b8d23,_0x46fc45){return db[_0x3be1('0x1a')][_0x3be1('0x1b')](_0x2c6765[_0x3be1('0x1c')],{'raw':_0x2c6765['options']?_0x2c6765['options'][_0x3be1('0x1d')]===undefined?!![]:![]:!![],'individualHooks':!![],'where':_0x2c6765[_0x3be1('0x1e')]?_0x2c6765[_0x3be1('0x1e')][_0x3be1('0x1f')]||null:null,'attributes':_0x2c6765[_0x3be1('0x1e')]?_0x2c6765['options'][_0x3be1('0x20')]||null:null,'limit':_0x2c6765['options']?_0x2c6765['options'][_0x3be1('0x21')]||null:null})['then'](function(_0x3679ef){logger[_0x3be1('0xe')]('UpdateOpenchannelApplication',_0x2c6765);logger[_0x3be1('0x10')](_0x3be1('0x19'),_0x2c6765,JSON[_0x3be1('0x12')](_0x3679ef));_0x5b8d23(_0x3679ef);})['catch'](function(_0x32a413){logger[_0x3be1('0x13')](_0x3be1('0x19'),_0x32a413[_0x3be1('0x15')],_0x2c6765);_0x46fc45(_0x38ea8e['error'](0x1f4,_0x32a413['message']));});});}; \ No newline at end of file +var _0x5c9f=['UpdateOpenchannelApplication','OpenchannelApplication','update','body','options','raw','attributes','limit','debug','stringify','catch','lodash','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','client','http','request','then','OpenchannelApplication,\x20%s,\x20%s','request\x20sent','OpenchannelApplication,\x20%s,\x20%s,\x20%s','error','code','message','info','result'];(function(_0x9bb2c3,_0x3edacf){var _0x3f77c7=function(_0xb9c8){while(--_0xb9c8){_0x9bb2c3['push'](_0x9bb2c3['shift']());}};_0x3f77c7(++_0x3edacf);}(_0x5c9f,0x1c5));var _0xf5c9=function(_0x508c10,_0x5a15f0){_0x508c10=_0x508c10-0x0;var _0x3108b5=_0x5c9f[_0x508c10];return _0x3108b5;};'use strict';var _=require(_0xf5c9('0x0'));var util=require('util');var moment=require(_0xf5c9('0x1'));var BPromise=require(_0xf5c9('0x2'));var rs=require(_0xf5c9('0x3'));var fs=require('fs');var Redis=require(_0xf5c9('0x4'));var db=require(_0xf5c9('0x5'))['db'];var utils=require(_0xf5c9('0x6'));var logger=require(_0xf5c9('0x7'))(_0xf5c9('0x8'));var config=require(_0xf5c9('0x9'));var jayson=require(_0xf5c9('0xa'));var client=jayson[_0xf5c9('0xb')][_0xf5c9('0xc')]({'port':0x232a});function respondWithRpcPromise(_0x31436c,_0x4a03e5,_0x108f90){return new BPromise(function(_0x2ce6b2,_0x1bbfd8){return client[_0xf5c9('0xd')](_0x31436c,_0x108f90)[_0xf5c9('0xe')](function(_0x5b1647){logger['info'](_0xf5c9('0xf'),_0x4a03e5,_0xf5c9('0x10'));logger['debug'](_0xf5c9('0x11'),_0x4a03e5,_0xf5c9('0x10'),JSON['stringify'](_0x5b1647));if(_0x5b1647[_0xf5c9('0x12')]){if(_0x5b1647[_0xf5c9('0x12')][_0xf5c9('0x13')]===0x1f4){logger[_0xf5c9('0x12')](_0xf5c9('0xf'),_0x4a03e5,_0x5b1647[_0xf5c9('0x12')]['message']);return _0x1bbfd8(_0x5b1647['error'][_0xf5c9('0x14')]);}logger[_0xf5c9('0x12')](_0xf5c9('0xf'),_0x4a03e5,_0x5b1647['error'][_0xf5c9('0x14')]);return _0x2ce6b2(_0x5b1647[_0xf5c9('0x12')][_0xf5c9('0x14')]);}else{logger[_0xf5c9('0x15')](_0xf5c9('0xf'),_0x4a03e5,'request\x20sent');_0x2ce6b2(_0x5b1647[_0xf5c9('0x16')][_0xf5c9('0x14')]);}})['catch'](function(_0x4578e0){logger['error'](_0xf5c9('0xf'),_0x4a03e5,_0x4578e0);_0x1bbfd8(_0x4578e0);});});}exports[_0xf5c9('0x17')]=function(_0x356d91){var _0x32f27a=this;return new Promise(function(_0x739ae2,_0x3b4ddd){return db[_0xf5c9('0x18')][_0xf5c9('0x19')](_0x356d91[_0xf5c9('0x1a')],{'raw':_0x356d91[_0xf5c9('0x1b')]?_0x356d91[_0xf5c9('0x1b')][_0xf5c9('0x1c')]===undefined?!![]:![]:!![],'individualHooks':!![],'where':_0x356d91[_0xf5c9('0x1b')]?_0x356d91[_0xf5c9('0x1b')]['where']||null:null,'attributes':_0x356d91[_0xf5c9('0x1b')]?_0x356d91[_0xf5c9('0x1b')][_0xf5c9('0x1d')]||null:null,'limit':_0x356d91[_0xf5c9('0x1b')]?_0x356d91[_0xf5c9('0x1b')][_0xf5c9('0x1e')]||null:null})[_0xf5c9('0xe')](function(_0xce821f){logger[_0xf5c9('0x15')](_0xf5c9('0x17'),_0x356d91);logger[_0xf5c9('0x1f')](_0xf5c9('0x17'),_0x356d91,JSON[_0xf5c9('0x20')](_0xce821f));_0x739ae2(_0xce821f);})[_0xf5c9('0x21')](function(_0x10845e){logger['error'](_0xf5c9('0x17'),_0x10845e[_0xf5c9('0x14')],_0x356d91);_0x3b4ddd(_0x32f27a['error'](0x1f4,_0x10845e['message']));});});}; \ No newline at end of file diff --git a/server/api/openchannelInteraction/index.js b/server/api/openchannelInteraction/index.js index babd4b0..b41e189 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 _0x597e=['/:id/messages','getMessages','create','addMessage','openchannel','openchannelinteraction:addtags','addTags','put','tracked','openchannelinteraction:update','delete','destroy','removeTags','exports','util','connect-timeout','express','Router','../../components/auth/service','../../components/interaction/service','../../config/environment','./openchannelInteraction.controller','get','isAuthenticated','index','/describe','describe','/:id'];(function(_0xcb5862,_0x4d09be){var _0x5cf2b4=function(_0x1d7a1d){while(--_0x1d7a1d){_0xcb5862['push'](_0xcb5862['shift']());}};_0x5cf2b4(++_0x4d09be);}(_0x597e,0xee));var _0xe597=function(_0x5cfb23,_0x7dd43e){_0x5cfb23=_0x5cfb23-0x0;var _0x4086c8=_0x597e[_0x5cfb23];return _0x4086c8;};'use strict';var multer=require('multer');var util=require(_0xe597('0x0'));var path=require('path');var timeout=require(_0xe597('0x1'));var express=require(_0xe597('0x2'));var router=express[_0xe597('0x3')]();var fs_extra=require('fs-extra');var auth=require(_0xe597('0x4'));var interaction=require(_0xe597('0x5'));var config=require(_0xe597('0x6'));var controller=require(_0xe597('0x7'));router[_0xe597('0x8')]('/',auth[_0xe597('0x9')](),controller[_0xe597('0xa')]);router[_0xe597('0x8')](_0xe597('0xb'),auth[_0xe597('0x9')](),controller[_0xe597('0xc')]);router[_0xe597('0x8')](_0xe597('0xd'),auth[_0xe597('0x9')](),controller['show']);router['get'](_0xe597('0xe'),auth['isAuthenticated'](),controller[_0xe597('0xf')]);router[_0xe597('0x8')]('/:id/download',auth[_0xe597('0x9')](),controller['download']);router['post']('/',auth[_0xe597('0x9')](),controller[_0xe597('0x10')]);router['post'](_0xe597('0xe'),auth[_0xe597('0x9')](),controller[_0xe597('0x11')]);router['post']('/:id/tags',auth[_0xe597('0x9')](),interaction['tracked'](_0xe597('0x12'),_0xe597('0x13')),controller[_0xe597('0x14')]);router[_0xe597('0x15')](_0xe597('0xd'),auth[_0xe597('0x9')](),interaction[_0xe597('0x16')](_0xe597('0x12'),_0xe597('0x17')),controller['update']);router[_0xe597('0x18')]('/:id',auth[_0xe597('0x9')](),interaction[_0xe597('0x16')](_0xe597('0x12'),'openchannelinteraction:destroy'),controller[_0xe597('0x19')]);router[_0xe597('0x18')]('/:id/tags',auth[_0xe597('0x9')](),controller[_0xe597('0x1a')]);module[_0xe597('0x1b')]=router; \ No newline at end of file +var _0xbbb6=['../../config/environment','isAuthenticated','index','get','/:id','/:id/messages','/:id/download','download','post','create','addMessage','/:id/tags','openchannelinteraction:addtags','addTags','put','tracked','openchannel','update','delete','openchannelinteraction:destroy','destroy','removeTags','multer','util','path','connect-timeout','express','Router','../../components/auth/service'];(function(_0x5db2e5,_0x5ade38){var _0x40953f=function(_0x9b8c5a){while(--_0x9b8c5a){_0x5db2e5['push'](_0x5db2e5['shift']());}};_0x40953f(++_0x5ade38);}(_0xbbb6,0xe1));var _0x6bbb=function(_0x3e705e,_0x34a449){_0x3e705e=_0x3e705e-0x0;var _0x506d74=_0xbbb6[_0x3e705e];return _0x506d74;};'use strict';var multer=require(_0x6bbb('0x0'));var util=require(_0x6bbb('0x1'));var path=require(_0x6bbb('0x2'));var timeout=require(_0x6bbb('0x3'));var express=require(_0x6bbb('0x4'));var router=express[_0x6bbb('0x5')]();var fs_extra=require('fs-extra');var auth=require(_0x6bbb('0x6'));var interaction=require('../../components/interaction/service');var config=require(_0x6bbb('0x7'));var controller=require('./openchannelInteraction.controller');router['get']('/',auth[_0x6bbb('0x8')](),controller[_0x6bbb('0x9')]);router[_0x6bbb('0xa')]('/describe',auth[_0x6bbb('0x8')](),controller['describe']);router[_0x6bbb('0xa')](_0x6bbb('0xb'),auth[_0x6bbb('0x8')](),controller['show']);router[_0x6bbb('0xa')](_0x6bbb('0xc'),auth[_0x6bbb('0x8')](),controller['getMessages']);router['get'](_0x6bbb('0xd'),auth[_0x6bbb('0x8')](),controller[_0x6bbb('0xe')]);router[_0x6bbb('0xf')]('/',auth['isAuthenticated'](),controller[_0x6bbb('0x10')]);router[_0x6bbb('0xf')](_0x6bbb('0xc'),auth[_0x6bbb('0x8')](),controller[_0x6bbb('0x11')]);router[_0x6bbb('0xf')](_0x6bbb('0x12'),auth[_0x6bbb('0x8')](),interaction['tracked']('openchannel',_0x6bbb('0x13')),controller[_0x6bbb('0x14')]);router[_0x6bbb('0x15')](_0x6bbb('0xb'),auth[_0x6bbb('0x8')](),interaction[_0x6bbb('0x16')](_0x6bbb('0x17'),'openchannelinteraction:update'),controller[_0x6bbb('0x18')]);router[_0x6bbb('0x19')](_0x6bbb('0xb'),auth[_0x6bbb('0x8')](),interaction[_0x6bbb('0x16')]('openchannel',_0x6bbb('0x1a')),controller[_0x6bbb('0x1b')]);router[_0x6bbb('0x19')](_0x6bbb('0x12'),auth[_0x6bbb('0x8')](),controller[_0x6bbb('0x1c')]);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 da91bbc..55f9581 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 _0xe87e=['DATE','STRING','ENUM','out','INTEGER','sequelize','exports','BOOLEAN'];(function(_0x149a9b,_0x5bb275){var _0x2c2bf6=function(_0xfe0c14){while(--_0xfe0c14){_0x149a9b['push'](_0x149a9b['shift']());}};_0x2c2bf6(++_0x5bb275);}(_0xe87e,0x17d));var _0xee87=function(_0x5b8b97,_0x6b4dfa){_0x5b8b97=_0x5b8b97-0x0;var _0x1fdf84=_0xe87e[_0x5b8b97];return _0x1fdf84;};'use strict';var Sequelize=require(_0xee87('0x0'));module[_0xee87('0x1')]={'closed':{'type':Sequelize[_0xee87('0x2')],'defaultValue':![]},'closedAt':{'type':Sequelize[_0xee87('0x3')]},'disposition':{'type':Sequelize[_0xee87('0x4')]},'secondDisposition':{'type':Sequelize['STRING']},'thirdDisposition':{'type':Sequelize[_0xee87('0x4')]},'note':{'type':Sequelize[_0xee87('0x4')]},'read1stAt':{'type':Sequelize[_0xee87('0x3')]},'threadId':{'type':Sequelize[_0xee87('0x4')]},'externalUrl':{'type':Sequelize[_0xee87('0x4')]},'lastMsgAt':{'type':Sequelize[_0xee87('0x3')]},'firstMsgDirection':{'type':Sequelize[_0xee87('0x5')]('in','out'),'defaultValue':'in','allowNull':![]},'lastMsgDirection':{'type':Sequelize['ENUM']('in',_0xee87('0x6')),'defaultValue':'in','allowNull':![]},'from':{'type':Sequelize[_0xee87('0x4')]},'autoreplyExecuted':{'type':Sequelize[_0xee87('0x2')],'defaultValue':![]},'queueId':{'type':Sequelize[_0xee87('0x7')]}}; \ No newline at end of file +var _0xb077=['out','BOOLEAN','sequelize','DATE','STRING','ENUM'];(function(_0x4fe19c,_0x45d0fe){var _0x952ac7=function(_0x274a16){while(--_0x274a16){_0x4fe19c['push'](_0x4fe19c['shift']());}};_0x952ac7(++_0x45d0fe);}(_0xb077,0x7a));var _0x7b07=function(_0x2be8e1,_0x1e5a85){_0x2be8e1=_0x2be8e1-0x0;var _0x26f890=_0xb077[_0x2be8e1];return _0x26f890;};'use strict';var Sequelize=require(_0x7b07('0x0'));module['exports']={'closed':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'closedAt':{'type':Sequelize[_0x7b07('0x1')]},'disposition':{'type':Sequelize['STRING']},'secondDisposition':{'type':Sequelize[_0x7b07('0x2')]},'thirdDisposition':{'type':Sequelize[_0x7b07('0x2')]},'note':{'type':Sequelize[_0x7b07('0x2')]},'read1stAt':{'type':Sequelize[_0x7b07('0x1')]},'threadId':{'type':Sequelize[_0x7b07('0x2')]},'externalUrl':{'type':Sequelize['STRING']},'lastMsgAt':{'type':Sequelize['DATE']},'firstMsgDirection':{'type':Sequelize[_0x7b07('0x3')]('in',_0x7b07('0x4')),'defaultValue':'in','allowNull':![]},'lastMsgDirection':{'type':Sequelize[_0x7b07('0x3')]('in','out'),'defaultValue':'in','allowNull':![]},'from':{'type':Sequelize['STRING']},'autoreplyExecuted':{'type':Sequelize[_0x7b07('0x5')],'defaultValue':![]},'queueId':{'type':Sequelize['INTEGER']}}; \ No newline at end of file diff --git a/server/api/openchannelInteraction/openchannelInteraction.controller.js b/server/api/openchannelInteraction/openchannelInteraction.controller.js index 869817f..1b42642 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 _0xc90f=['count','offset','limit','set','Content-Range','json','then','error','stack','name','send','index','type','getOptions','findAll','query','user','show','from','model','keys','OpenchannelInteraction','rawAttributes','filters','intersection','attributes','fields','length','include','merge','find','catch','create','body','update','params','destroy','describe','addMessage','ids','omit','getMessages','findOne','OpenchannelMessage','hasOwnProperty','nolimit','where','pick','map','filter','$gte','format','YYYY-MM-DD\x20HH:mm:ss','options','includeAll','rows','addTags','Tag','color','emit','openchannelInteractionTags:save','removeTags','download','unix','toString','join','server','files','tmp','root','attachments','push','User','fullname','Contact','lastName','Messages','direction','read','OpenchannelAccount','Account','mkdirSync','Openchannel','Owner','N.A.','createdAt','closed','closedAt','disposition','threadId','Public','Private','Attachment','existsSync','createReadStream','pipe','createWriteStream','System','firstName','basename','out','secret','value','renderFile','views','downloadInteraction.ejs','.pdf','createPdfFromHTML','Unable\x20to\x20delete\x20zip\x20file','unlinkSync','moment','util','path','ejs','lodash','ioredis','../../config/logger','api','../../config/environment','../../mysqldb','redis','defaults','socket.io-emitter','./openchannelInteraction.socket','register','sendStatus','status','end','undefined'];(function(_0x321bb2,_0x202794){var _0x9c12ed=function(_0x263dd3){while(--_0x263dd3){_0x321bb2['push'](_0x321bb2['shift']());}};_0x9c12ed(++_0x202794);}(_0xc90f,0x6e));var _0xfc90=function(_0x38ced4,_0x24263f){_0x38ced4=_0x38ced4-0x0;var _0x547c07=_0xc90f[_0x38ced4];return _0x547c07;};'use strict';var rimraf=require('rimraf');var zipdir=require('zip-dir');var moment=require(_0xfc90('0x0'));var util=require(_0xfc90('0x1'));var path=require(_0xfc90('0x2'));var ejs=require(_0xfc90('0x3'));var fs=require('fs');var _=require(_0xfc90('0x4'));var Redis=require(_0xfc90('0x5'));var interaction=require('../../components/interaction/service');var qs=require('../../components/parsers/qs');var pdf=require('../../components/export/pdf');var logger=require(_0xfc90('0x6'))(_0xfc90('0x7'));var config=require(_0xfc90('0x8'));var db=require(_0xfc90('0x9'))['db'];config[_0xfc90('0xa')]=_[_0xfc90('0xb')](config[_0xfc90('0xa')],{'host':'localhost','port':0x18eb});var socket=require(_0xfc90('0xc'))(new Redis(config[_0xfc90('0xa')]));require(_0xfc90('0xd'))[_0xfc90('0xe')](socket);function respondWithStatusCode(_0x95a4bb,_0xacba72){_0xacba72=_0xacba72||0xcc;return function(_0x2f06ad){if(_0x2f06ad){return _0x95a4bb[_0xfc90('0xf')](_0xacba72);}return _0x95a4bb[_0xfc90('0x10')](_0xacba72)[_0xfc90('0x11')]();};}function respondWithResult(_0x1cb1dc,_0x5cb8e3){_0x5cb8e3=_0x5cb8e3||0xc8;return function(_0x23e63a){if(_0x23e63a){return _0x1cb1dc['status'](_0x5cb8e3)['json'](_0x23e63a);}};}function respondWithFilteredResult(_0x952ab5,_0x5aff60){return function(_0x462462){if(_0x462462){var _0x32f8a6=typeof _0x5aff60['offset']===_0xfc90('0x12')&&typeof _0x5aff60['limit']===_0xfc90('0x12');var _0x291e2a=_0x462462[_0xfc90('0x13')];var _0x431131=_0x32f8a6?0x0:_0x5aff60[_0xfc90('0x14')];var _0x44f538=_0x32f8a6?_0x462462[_0xfc90('0x13')]:_0x5aff60[_0xfc90('0x14')]+_0x5aff60[_0xfc90('0x15')];var _0x23f676;if(_0x44f538>=_0x291e2a){_0x44f538=_0x291e2a;_0x23f676=0xc8;}else{_0x23f676=0xce;}_0x952ab5[_0xfc90('0x10')](_0x23f676);return _0x952ab5[_0xfc90('0x16')](_0xfc90('0x17'),_0x431131+'-'+_0x44f538+'/'+_0x291e2a)[_0xfc90('0x18')](_0x462462);}return null;};}function saveUpdates(_0x7212c8){return function(_0x2f2ff7){if(_0x2f2ff7){return _0x2f2ff7['update'](_0x7212c8)[_0xfc90('0x19')](function(_0x93f023){return _0x93f023;});}return null;};}function removeEntity(_0x5b7841){return function(_0x214741){if(_0x214741){return _0x214741['destroy']()[_0xfc90('0x19')](function(){_0x5b7841[_0xfc90('0x10')](0xcc)['end']();});}};}function handleEntityNotFound(_0x1d340b){return function(_0x31c9f2){if(!_0x31c9f2){_0x1d340b[_0xfc90('0xf')](0x194);}return _0x31c9f2;};}function handleError(_0x4a760b,_0x51b678){_0x51b678=_0x51b678||0x1f4;return function(_0x5e35bc){logger[_0xfc90('0x1a')](_0x5e35bc[_0xfc90('0x1b')]);if(_0x5e35bc[_0xfc90('0x1c')]){delete _0x5e35bc[_0xfc90('0x1c')];}_0x4a760b['status'](_0x51b678)[_0xfc90('0x1d')](_0x5e35bc);};}exports[_0xfc90('0x1e')]=function(_0x22d822,_0x2a16e7){var _0x2864f5={};var _0x4fffb6=_['map'](db['OpenchannelInteraction']['rawAttributes'],function(_0x5621e8){return{'name':_0x5621e8['fieldName'],'type':_0x5621e8[_0xfc90('0x1f')]['key']};});_0x2864f5=qs[_0xfc90('0x20')](_0x4fffb6,_0x22d822);return interaction[_0xfc90('0x21')]('openchannel',_0x22d822[_0xfc90('0x22')],_0x22d822[_0xfc90('0x23')],_0x2864f5,_0x4fffb6)[_0xfc90('0x19')](respondWithFilteredResult(_0x2a16e7,_0x2864f5))['catch'](handleError(_0x2a16e7,null));};exports[_0xfc90('0x24')]=function(_0x1fe31d,_0xeaa7af){var _0x3fccf6={};if(_0x1fe31d[_0xfc90('0x22')][_0xfc90('0x1f')]&&_0x1fe31d[_0xfc90('0x22')][_0xfc90('0x1f')]===_0xfc90('0x25')){_0x3fccf6[_0xfc90('0x25')]=_0x1fe31d['params']['id'];}else{_0x3fccf6['id']=_0x1fe31d['params']['id'];}var _0x1dc34e={'raw':![],'where':_0x3fccf6},_0x232031={};_0x232031[_0xfc90('0x26')]=_[_0xfc90('0x27')](db[_0xfc90('0x28')][_0xfc90('0x29')]);_0x232031[_0xfc90('0x22')]=_[_0xfc90('0x27')](_0x1fe31d[_0xfc90('0x22')]);_0x232031[_0xfc90('0x2a')]=_[_0xfc90('0x2b')](_0x232031[_0xfc90('0x26')],_0x232031[_0xfc90('0x22')]);_0x1dc34e[_0xfc90('0x2c')]=_['intersection'](_0x232031['model'],qs['fields'](_0x1fe31d[_0xfc90('0x22')][_0xfc90('0x2d')]));_0x1dc34e[_0xfc90('0x2c')]=_0x1dc34e[_0xfc90('0x2c')][_0xfc90('0x2e')]?_0x1dc34e[_0xfc90('0x2c')]:_0x232031[_0xfc90('0x26')];if(_0x1fe31d['query']['includeAll']){_0x1dc34e[_0xfc90('0x2f')]=[{'all':!![]}];}_0x1dc34e=_[_0xfc90('0x30')]({},_0x1dc34e,_0x1fe31d['options']);return db[_0xfc90('0x28')][_0xfc90('0x31')](_0x1dc34e)[_0xfc90('0x19')](handleEntityNotFound(_0xeaa7af,null))[_0xfc90('0x19')](respondWithResult(_0xeaa7af,null))[_0xfc90('0x32')](handleError(_0xeaa7af,null));};exports[_0xfc90('0x33')]=function(_0x5694c0,_0x3b837f){return db['OpenchannelInteraction'][_0xfc90('0x33')](_0x5694c0[_0xfc90('0x34')],{})[_0xfc90('0x19')](respondWithResult(_0x3b837f,0xc9))[_0xfc90('0x32')](handleError(_0x3b837f,null));};exports[_0xfc90('0x35')]=function(_0x270df5,_0x139352){if(_0x270df5[_0xfc90('0x34')]['id']){delete _0x270df5[_0xfc90('0x34')]['id'];}return db[_0xfc90('0x28')][_0xfc90('0x31')]({'where':{'id':_0x270df5[_0xfc90('0x36')]['id']}})['then'](handleEntityNotFound(_0x139352,null))['then'](saveUpdates(_0x270df5[_0xfc90('0x34')],null))[_0xfc90('0x19')](respondWithResult(_0x139352,null))[_0xfc90('0x32')](handleError(_0x139352,null));};exports[_0xfc90('0x37')]=function(_0x1a3bc9,_0xf37d1){return db[_0xfc90('0x28')]['find']({'where':{'id':_0x1a3bc9[_0xfc90('0x36')]['id']}})['then'](handleEntityNotFound(_0xf37d1,null))[_0xfc90('0x19')](removeEntity(_0xf37d1,null))[_0xfc90('0x32')](handleError(_0xf37d1,null));};exports[_0xfc90('0x38')]=function(_0x128075,_0x118d02){return db[_0xfc90('0x28')][_0xfc90('0x38')]()[_0xfc90('0x19')](respondWithResult(_0x118d02,null))['catch'](handleError(_0x118d02,null));};exports[_0xfc90('0x39')]=function(_0x5aa369,_0x613e75){return db['OpenchannelMessage'][_0xfc90('0x31')]({'where':{'id':_0x5aa369[_0xfc90('0x36')]['id']}})['then'](handleEntityNotFound(_0x613e75,null))[_0xfc90('0x19')](function(_0x5510c6){if(_0x5510c6){return _0x5510c6[_0xfc90('0x39')](_0x5aa369[_0xfc90('0x34')][_0xfc90('0x3a')],_[_0xfc90('0x3b')](_0x5aa369[_0xfc90('0x34')],[_0xfc90('0x3a'),'id'])||{});}})[_0xfc90('0x19')](respondWithResult(_0x613e75,null))[_0xfc90('0x32')](handleError(_0x613e75,null));};exports[_0xfc90('0x3c')]=function(_0x57119f,_0x2af510){var _0x138e3f={'raw':![],'where':{}};var _0x5be510={};var _0x5ae5f0={'count':0x0,'rows':[]};return db['OpenchannelInteraction'][_0xfc90('0x3d')]({'where':{'id':_0x57119f['params']['id']}})[_0xfc90('0x19')](handleEntityNotFound(_0x2af510,null))[_0xfc90('0x19')](function(_0x53d679){if(_0x53d679){_0x5be510[_0xfc90('0x26')]=_[_0xfc90('0x27')](db[_0xfc90('0x3e')]['rawAttributes']);_0x5be510[_0xfc90('0x22')]=_[_0xfc90('0x27')](_0x57119f[_0xfc90('0x22')]);_0x5be510[_0xfc90('0x2a')]=_[_0xfc90('0x2b')](_0x5be510[_0xfc90('0x26')],_0x5be510[_0xfc90('0x22')]);_0x138e3f['attributes']=_['intersection'](_0x5be510['model'],qs[_0xfc90('0x2d')](_0x57119f[_0xfc90('0x22')][_0xfc90('0x2d')]));_0x138e3f[_0xfc90('0x2c')]=_0x138e3f[_0xfc90('0x2c')]['length']?_0x138e3f[_0xfc90('0x2c')]:_0x5be510[_0xfc90('0x26')];if(!_0x57119f[_0xfc90('0x22')][_0xfc90('0x3f')](_0xfc90('0x40'))){_0x138e3f[_0xfc90('0x15')]=qs[_0xfc90('0x15')](_0x57119f[_0xfc90('0x22')]['limit']);_0x138e3f['offset']=qs[_0xfc90('0x14')](_0x57119f['query'][_0xfc90('0x14')]);}_0x138e3f['order']=qs['sort'](_0x57119f[_0xfc90('0x22')]['sort']);_0x138e3f[_0xfc90('0x41')]=qs[_0xfc90('0x2a')](_[_0xfc90('0x42')](_0x57119f[_0xfc90('0x22')],_0x5be510[_0xfc90('0x2a')]));_0x138e3f[_0xfc90('0x41')]['OpenchannelInteractionId']=_0x53d679['id'];if(_0x57119f[_0xfc90('0x22')]['filter']){_0x138e3f['where']=_[_0xfc90('0x30')](_0x138e3f['where'],{'$or':_[_0xfc90('0x43')](_0x138e3f[_0xfc90('0x2c')],function(_0x377b71){var _0x450071={};_0x450071[_0x377b71]={'$like':'%'+_0x57119f[_0xfc90('0x22')][_0xfc90('0x44')]+'%'};return _0x450071;})});}if(_0x57119f[_0xfc90('0x22')][_0xfc90('0x45')]){var _0x40cd18=_0x57119f[_0xfc90('0x22')][_0xfc90('0x45')]['split'](',');var _0x527cd0={};_0x527cd0[_0x40cd18[0x0]]={'$gte':moment(_0x40cd18[0x1])[_0xfc90('0x46')](_0xfc90('0x47'))};_0x138e3f[_0xfc90('0x41')]=_['merge'](_0x138e3f[_0xfc90('0x41')],_0x527cd0);}_0x138e3f=_[_0xfc90('0x30')]({},_0x138e3f,_0x57119f[_0xfc90('0x48')]);return db[_0xfc90('0x3e')][_0xfc90('0x13')]({'where':_0x138e3f[_0xfc90('0x41')]})[_0xfc90('0x19')](function(_0x559ec5){_0x5ae5f0['count']=_0x559ec5;if(_0x57119f[_0xfc90('0x22')][_0xfc90('0x49')]){_0x138e3f['include']=[{'all':!![]}];}return db[_0xfc90('0x3e')][_0xfc90('0x21')](_0x138e3f);})[_0xfc90('0x19')](function(_0x5abbe9){_0x5ae5f0[_0xfc90('0x4a')]=_0x5abbe9;return _0x5ae5f0;});}})[_0xfc90('0x19')](respondWithFilteredResult(_0x2af510,_0x138e3f))[_0xfc90('0x32')](handleError(_0x2af510,null));};exports[_0xfc90('0x4b')]=function(_0x12215b,_0x10636b){return db[_0xfc90('0x28')][_0xfc90('0x31')]({'where':{'id':_0x12215b[_0xfc90('0x36')]['id']}})['then'](handleEntityNotFound(_0x10636b,null))[_0xfc90('0x19')](function(_0x521172){if(_0x521172){return _0x521172['setTags'](_0x12215b[_0xfc90('0x34')][_0xfc90('0x3a')],_[_0xfc90('0x3b')](_0x12215b[_0xfc90('0x34')],[_0xfc90('0x3a'),'id'])||{})['spread'](function(){return db[_0xfc90('0x4c')][_0xfc90('0x21')]({'attributes':['id',_0xfc90('0x1c'),_0xfc90('0x4d')],'where':{'id':_0x12215b[_0xfc90('0x34')]['ids']}});})[_0xfc90('0x19')](function(_0x5ec85b){socket[_0xfc90('0x4e')](_0xfc90('0x4f'),{'id':Number(_0x12215b[_0xfc90('0x36')]['id']),'tags':_0x5ec85b||[]});return{'id':Number(_0x12215b[_0xfc90('0x36')]['id']),'tags':_0x5ec85b||[]};});}})['then'](respondWithResult(_0x10636b,null))['catch'](handleError(_0x10636b,null));};exports['removeTags']=function(_0x544988,_0x2c1518){return db['OpenchannelInteraction'][_0xfc90('0x31')]({'where':{'id':_0x544988['params']['id']}})[_0xfc90('0x19')](handleEntityNotFound(_0x2c1518,null))[_0xfc90('0x19')](function(_0x5dad52){if(_0x5dad52){return _0x5dad52[_0xfc90('0x50')](_0x544988[_0xfc90('0x22')][_0xfc90('0x3a')]);}})[_0xfc90('0x19')](respondWithStatusCode(_0x2c1518,null))[_0xfc90('0x32')](handleError(_0x2c1518,null));};exports[_0xfc90('0x51')]=function(_0x33ce4a,_0x5d5061){var _0x4bcb3c=moment()[_0xfc90('0x52')]()[_0xfc90('0x53')]();var _0x45d38b=path[_0xfc90('0x54')](config['root'],_0xfc90('0x55'),_0xfc90('0x56'),_0xfc90('0x57'));var _0x16b078=path[_0xfc90('0x54')](config[_0xfc90('0x58')],_0xfc90('0x55'),_0xfc90('0x56'),_0xfc90('0x59'));var _0xbd9595=path[_0xfc90('0x54')](_0x45d38b,_0x4bcb3c);var _0x333753=util[_0xfc90('0x46')]('transcript-%d-%s.zip',_0x33ce4a[_0xfc90('0x36')]['id'],_0x4bcb3c);var _0xb6202=path['join'](_0x45d38b,_0x333753);var _0x2d0e2b=[];_0x2d0e2b[_0xfc90('0x5a')]({'model':db[_0xfc90('0x5b')],'as':_0xfc90('0x5b'),'attributes':['id',_0xfc90('0x5c')],'raw':!![]});_0x2d0e2b['push']({'model':db['CmContact'],'as':_0xfc90('0x5d'),'attributes':['id','firstName',_0xfc90('0x5e')],'raw':!![]});if(_0x33ce4a['query']['attachments']){_0x2d0e2b[_0xfc90('0x5a')]({'model':db['Attachment'],'as':'Attachment','raw':!![]});}var _0x2c6a8b=[{'model':db['OpenchannelMessage'],'as':_0xfc90('0x5f'),'attributes':['id',_0xfc90('0x34'),'createdAt',_0xfc90('0x60'),'secret',_0xfc90('0x61')],'include':_0x2d0e2b}];_0x2c6a8b[_0xfc90('0x5a')]({'model':db[_0xfc90('0x62')],'as':_0xfc90('0x63'),'attributes':['id',_0xfc90('0x1c')]});_0x2c6a8b[_0xfc90('0x5a')]({'model':db[_0xfc90('0x5b')],'as':'Owner','attributes':['id',_0xfc90('0x5c')]});return db[_0xfc90('0x28')]['find']({'where':{'id':_0x33ce4a['params']['id']},'include':_0x2c6a8b})['then'](handleEntityNotFound(_0x5d5061,null))[_0xfc90('0x19')](function(_0x5eb014){if(_0x5eb014){var _0x45a610=_0x5eb014['get']({'plain':!![]});fs[_0xfc90('0x64')](_0xbd9595);var _0x57bb82={'channel':_0xfc90('0x65'),'account':_0x45a610[_0xfc90('0x63')]['name'],'agent':_0x45a610[_0xfc90('0x66')]?_0x45a610[_0xfc90('0x66')][_0xfc90('0x5c')]:_0xfc90('0x67'),'createdAt':moment(_0x45a610[_0xfc90('0x68')])['format'](_0xfc90('0x47'))[_0xfc90('0x53')](),'closedAt':_0x45a610[_0xfc90('0x69')]?moment(_0x45a610[_0xfc90('0x6a')])[_0xfc90('0x46')]('YYYY-MM-DD\x20HH:mm:ss')[_0xfc90('0x53')]():'','disposition':_0x45a610[_0xfc90('0x6b')],'visibility':_0x45a610[_0xfc90('0x6c')]?_0xfc90('0x6d'):_0xfc90('0x6e'),'messages':_(_0x45a610['Messages'])[_0xfc90('0x44')]({'secret':![]})[_0xfc90('0x43')](function(_0x3044e8){if(_0x3044e8['Attachment']){var _0x9197bc=path['join'](_0x16b078,_0x3044e8[_0xfc90('0x6f')]['basename']);if(fs[_0xfc90('0x70')](_0x9197bc)){fs[_0xfc90('0x71')](_0x9197bc)[_0xfc90('0x72')](fs[_0xfc90('0x73')](path[_0xfc90('0x54')](_0xbd9595,_0x3044e8[_0xfc90('0x6f')]['basename'])));}}return{'date':moment(_0x3044e8[_0xfc90('0x68')])[_0xfc90('0x46')](_0xfc90('0x47'))[_0xfc90('0x53')](),'sender':_0x3044e8[_0xfc90('0x60')]==='out'?_0x3044e8[_0xfc90('0x5b')]?_0x3044e8['User']['fullname']:_0xfc90('0x74'):_0x3044e8['Contact'][_0xfc90('0x75')]+(_0x3044e8['Contact']['lastName']?'\x20'+_0x3044e8[_0xfc90('0x5d')]['lastName']:''),'body':_0x3044e8[_0xfc90('0x6f')]?_0x3044e8['Attachment'][_0xfc90('0x76')]:_0x3044e8['body'],'direction':_0x3044e8['direction']===_0xfc90('0x77')?'A':'C','secret':_0x3044e8[_0xfc90('0x78')],'read':_0x3044e8[_0xfc90('0x61')],'attachment':_0x3044e8[_0xfc90('0x6f')]};})[_0xfc90('0x79')]()};return ejs[_0xfc90('0x7a')](path[_0xfc90('0x54')](config['root'],_0xfc90('0x55'),_0xfc90('0x7b'),_0xfc90('0x7c')),{'interaction':_0x57bb82})[_0xfc90('0x19')](function(_0x438286){var _0x1c1c00=path[_0xfc90('0x54')](_0xbd9595,'transcript-'+_0x45a610['id']+'-'+_0x4bcb3c+_0xfc90('0x7d'));var _0x396b0c={'path':_0x1c1c00,'channel':_0xfc90('0x65'),'interactionId':_0x45a610['id']};return pdf[_0xfc90('0x7e')](_0x438286,_0x396b0c);})[_0xfc90('0x19')](function(){return new Promise(function(_0x110efa,_0x5f3432){zipdir(_0xbd9595,{'saveTo':_0xb6202},function(_0x307ede,_0x5ca994){if(_0x307ede)return _0x5f3432(_0x307ede);return _0x110efa(_0x5ca994);});})[_0xfc90('0x19')](function(){return new Promise(function(_0xbb8a33,_0x55eecc){rimraf(_0xbd9595,function(_0x37f81c){if(_0x37f81c)_0x55eecc(_0x37f81c);return _0xbb8a33();});});})[_0xfc90('0x19')](function(){return _0x5d5061['download'](_0xb6202,_0x333753,function(_0x1c4bf1){if(_0x1c4bf1){logger[_0xfc90('0x1a')](_0xfc90('0x7f'),_0x1c4bf1);}else{fs[_0xfc90('0x80')](_0xb6202);}});});});}else{return _0x5d5061['sendStatus'](0xc8);}})[_0xfc90('0x32')](handleError(_0x5d5061,null));}; \ No newline at end of file +var _0x0527=['out','System','value','renderFile','root','transcript-','rimraf','zip-dir','util','path','ejs','lodash','ioredis','../../components/interaction/service','../../components/parsers/qs','../../components/export/pdf','api','../../config/environment','../../mysqldb','redis','localhost','socket.io-emitter','./openchannelInteraction.socket','register','sendStatus','status','end','json','offset','undefined','limit','count','set','Content-Range','destroy','then','error','stack','name','send','index','map','rawAttributes','fieldName','type','key','getOptions','openchannel','query','user','show','from','params','model','keys','OpenchannelInteraction','filters','attributes','intersection','fields','length','includeAll','include','options','find','catch','create','body','describe','addMessage','OpenchannelMessage','ids','omit','findOne','hasOwnProperty','nolimit','order','sort','where','pick','OpenchannelInteractionId','filter','$gte','split','format','merge','findAll','addTags','setTags','spread','Tag','color','emit','openchannelInteractionTags:save','removeTags','download','toString','server','files','join','attachments','transcript-%d-%s.zip','User','fullname','CmContact','Contact','lastName','push','Attachment','Messages','createdAt','secret','read','Account','Owner','get','mkdirSync','Openchannel','N.A.','YYYY-MM-DD\x20HH:mm:ss','closed','closedAt','threadId','Public','Private','existsSync','pipe','createWriteStream','basename','direction'];(function(_0x22a89c,_0x17b60e){var _0x4f88e8=function(_0x15e85b){while(--_0x15e85b){_0x22a89c['push'](_0x22a89c['shift']());}};_0x4f88e8(++_0x17b60e);}(_0x0527,0x10a));var _0x7052=function(_0x7384a2,_0x598b90){_0x7384a2=_0x7384a2-0x0;var _0x3f7416=_0x0527[_0x7384a2];return _0x3f7416;};'use strict';var rimraf=require(_0x7052('0x0'));var zipdir=require(_0x7052('0x1'));var moment=require('moment');var util=require(_0x7052('0x2'));var path=require(_0x7052('0x3'));var ejs=require(_0x7052('0x4'));var fs=require('fs');var _=require(_0x7052('0x5'));var Redis=require(_0x7052('0x6'));var interaction=require(_0x7052('0x7'));var qs=require(_0x7052('0x8'));var pdf=require(_0x7052('0x9'));var logger=require('../../config/logger')(_0x7052('0xa'));var config=require(_0x7052('0xb'));var db=require(_0x7052('0xc'))['db'];config[_0x7052('0xd')]=_['defaults'](config[_0x7052('0xd')],{'host':_0x7052('0xe'),'port':0x18eb});var socket=require(_0x7052('0xf'))(new Redis(config[_0x7052('0xd')]));require(_0x7052('0x10'))[_0x7052('0x11')](socket);function respondWithStatusCode(_0x518766,_0x21ad75){_0x21ad75=_0x21ad75||0xcc;return function(_0x461e5c){if(_0x461e5c){return _0x518766[_0x7052('0x12')](_0x21ad75);}return _0x518766[_0x7052('0x13')](_0x21ad75)[_0x7052('0x14')]();};}function respondWithResult(_0x10383,_0x59b072){_0x59b072=_0x59b072||0xc8;return function(_0x6aaaa4){if(_0x6aaaa4){return _0x10383[_0x7052('0x13')](_0x59b072)[_0x7052('0x15')](_0x6aaaa4);}};}function respondWithFilteredResult(_0x552aa8,_0x259e1b){return function(_0x4caad0){if(_0x4caad0){var _0x4a4c3c=typeof _0x259e1b[_0x7052('0x16')]===_0x7052('0x17')&&typeof _0x259e1b[_0x7052('0x18')]===_0x7052('0x17');var _0x407b6c=_0x4caad0[_0x7052('0x19')];var _0x54fbc1=_0x4a4c3c?0x0:_0x259e1b[_0x7052('0x16')];var _0xfc4cbf=_0x4a4c3c?_0x4caad0['count']:_0x259e1b[_0x7052('0x16')]+_0x259e1b[_0x7052('0x18')];var _0x7a69c4;if(_0xfc4cbf>=_0x407b6c){_0xfc4cbf=_0x407b6c;_0x7a69c4=0xc8;}else{_0x7a69c4=0xce;}_0x552aa8[_0x7052('0x13')](_0x7a69c4);return _0x552aa8[_0x7052('0x1a')](_0x7052('0x1b'),_0x54fbc1+'-'+_0xfc4cbf+'/'+_0x407b6c)['json'](_0x4caad0);}return null;};}function saveUpdates(_0x4711f2){return function(_0x5a2269){if(_0x5a2269){return _0x5a2269['update'](_0x4711f2)['then'](function(_0xa9d2ff){return _0xa9d2ff;});}return null;};}function removeEntity(_0xaa168e){return function(_0x27e495){if(_0x27e495){return _0x27e495[_0x7052('0x1c')]()[_0x7052('0x1d')](function(){_0xaa168e[_0x7052('0x13')](0xcc)[_0x7052('0x14')]();});}};}function handleEntityNotFound(_0x210716){return function(_0x2bc16a){if(!_0x2bc16a){_0x210716['sendStatus'](0x194);}return _0x2bc16a;};}function handleError(_0x438044,_0x56ba50){_0x56ba50=_0x56ba50||0x1f4;return function(_0x4d1c1a){logger[_0x7052('0x1e')](_0x4d1c1a[_0x7052('0x1f')]);if(_0x4d1c1a[_0x7052('0x20')]){delete _0x4d1c1a[_0x7052('0x20')];}_0x438044[_0x7052('0x13')](_0x56ba50)[_0x7052('0x21')](_0x4d1c1a);};}exports[_0x7052('0x22')]=function(_0x44bb68,_0x3b8f44){var _0xff8d15={};var _0x550878=_[_0x7052('0x23')](db['OpenchannelInteraction'][_0x7052('0x24')],function(_0x28fd54){return{'name':_0x28fd54[_0x7052('0x25')],'type':_0x28fd54[_0x7052('0x26')][_0x7052('0x27')]};});_0xff8d15=qs[_0x7052('0x28')](_0x550878,_0x44bb68);return interaction['findAll'](_0x7052('0x29'),_0x44bb68[_0x7052('0x2a')],_0x44bb68[_0x7052('0x2b')],_0xff8d15,_0x550878)[_0x7052('0x1d')](respondWithFilteredResult(_0x3b8f44,_0xff8d15))['catch'](handleError(_0x3b8f44,null));};exports[_0x7052('0x2c')]=function(_0x4805cd,_0x5ba70a){var _0xcce882={};if(_0x4805cd[_0x7052('0x2a')]['type']&&_0x4805cd[_0x7052('0x2a')]['type']==='from'){_0xcce882[_0x7052('0x2d')]=_0x4805cd[_0x7052('0x2e')]['id'];}else{_0xcce882['id']=_0x4805cd[_0x7052('0x2e')]['id'];}var _0x35c2d1={'raw':![],'where':_0xcce882},_0x39ecf6={};_0x39ecf6[_0x7052('0x2f')]=_[_0x7052('0x30')](db[_0x7052('0x31')][_0x7052('0x24')]);_0x39ecf6[_0x7052('0x2a')]=_[_0x7052('0x30')](_0x4805cd['query']);_0x39ecf6[_0x7052('0x32')]=_['intersection'](_0x39ecf6[_0x7052('0x2f')],_0x39ecf6[_0x7052('0x2a')]);_0x35c2d1[_0x7052('0x33')]=_[_0x7052('0x34')](_0x39ecf6['model'],qs['fields'](_0x4805cd[_0x7052('0x2a')][_0x7052('0x35')]));_0x35c2d1[_0x7052('0x33')]=_0x35c2d1[_0x7052('0x33')][_0x7052('0x36')]?_0x35c2d1[_0x7052('0x33')]:_0x39ecf6[_0x7052('0x2f')];if(_0x4805cd['query'][_0x7052('0x37')]){_0x35c2d1[_0x7052('0x38')]=[{'all':!![]}];}_0x35c2d1=_['merge']({},_0x35c2d1,_0x4805cd[_0x7052('0x39')]);return db[_0x7052('0x31')][_0x7052('0x3a')](_0x35c2d1)[_0x7052('0x1d')](handleEntityNotFound(_0x5ba70a,null))[_0x7052('0x1d')](respondWithResult(_0x5ba70a,null))[_0x7052('0x3b')](handleError(_0x5ba70a,null));};exports['create']=function(_0xa94685,_0x1004b0){return db[_0x7052('0x31')][_0x7052('0x3c')](_0xa94685[_0x7052('0x3d')],{})[_0x7052('0x1d')](respondWithResult(_0x1004b0,0xc9))[_0x7052('0x3b')](handleError(_0x1004b0,null));};exports['update']=function(_0x4aa2d7,_0x2ffc57){if(_0x4aa2d7[_0x7052('0x3d')]['id']){delete _0x4aa2d7[_0x7052('0x3d')]['id'];}return db[_0x7052('0x31')][_0x7052('0x3a')]({'where':{'id':_0x4aa2d7[_0x7052('0x2e')]['id']}})[_0x7052('0x1d')](handleEntityNotFound(_0x2ffc57,null))[_0x7052('0x1d')](saveUpdates(_0x4aa2d7[_0x7052('0x3d')],null))[_0x7052('0x1d')](respondWithResult(_0x2ffc57,null))['catch'](handleError(_0x2ffc57,null));};exports['destroy']=function(_0x2ebaef,_0x182587){return db[_0x7052('0x31')][_0x7052('0x3a')]({'where':{'id':_0x2ebaef[_0x7052('0x2e')]['id']}})[_0x7052('0x1d')](handleEntityNotFound(_0x182587,null))[_0x7052('0x1d')](removeEntity(_0x182587,null))[_0x7052('0x3b')](handleError(_0x182587,null));};exports[_0x7052('0x3e')]=function(_0x4aa819,_0x277d4d){return db['OpenchannelInteraction'][_0x7052('0x3e')]()[_0x7052('0x1d')](respondWithResult(_0x277d4d,null))[_0x7052('0x3b')](handleError(_0x277d4d,null));};exports[_0x7052('0x3f')]=function(_0x2cea5f,_0x2c17ab){return db[_0x7052('0x40')][_0x7052('0x3a')]({'where':{'id':_0x2cea5f['params']['id']}})[_0x7052('0x1d')](handleEntityNotFound(_0x2c17ab,null))[_0x7052('0x1d')](function(_0x7587e3){if(_0x7587e3){return _0x7587e3[_0x7052('0x3f')](_0x2cea5f[_0x7052('0x3d')][_0x7052('0x41')],_[_0x7052('0x42')](_0x2cea5f[_0x7052('0x3d')],[_0x7052('0x41'),'id'])||{});}})[_0x7052('0x1d')](respondWithResult(_0x2c17ab,null))[_0x7052('0x3b')](handleError(_0x2c17ab,null));};exports['getMessages']=function(_0x1d8880,_0x3788ac){var _0x541c3d={'raw':![],'where':{}};var _0x493f81={};var _0x17e237={'count':0x0,'rows':[]};return db[_0x7052('0x31')][_0x7052('0x43')]({'where':{'id':_0x1d8880[_0x7052('0x2e')]['id']}})['then'](handleEntityNotFound(_0x3788ac,null))[_0x7052('0x1d')](function(_0x5c60b4){if(_0x5c60b4){_0x493f81[_0x7052('0x2f')]=_[_0x7052('0x30')](db[_0x7052('0x40')][_0x7052('0x24')]);_0x493f81['query']=_[_0x7052('0x30')](_0x1d8880[_0x7052('0x2a')]);_0x493f81['filters']=_[_0x7052('0x34')](_0x493f81[_0x7052('0x2f')],_0x493f81['query']);_0x541c3d[_0x7052('0x33')]=_[_0x7052('0x34')](_0x493f81[_0x7052('0x2f')],qs[_0x7052('0x35')](_0x1d8880[_0x7052('0x2a')][_0x7052('0x35')]));_0x541c3d[_0x7052('0x33')]=_0x541c3d[_0x7052('0x33')][_0x7052('0x36')]?_0x541c3d[_0x7052('0x33')]:_0x493f81[_0x7052('0x2f')];if(!_0x1d8880[_0x7052('0x2a')][_0x7052('0x44')](_0x7052('0x45'))){_0x541c3d[_0x7052('0x18')]=qs['limit'](_0x1d8880[_0x7052('0x2a')][_0x7052('0x18')]);_0x541c3d[_0x7052('0x16')]=qs['offset'](_0x1d8880[_0x7052('0x2a')][_0x7052('0x16')]);}_0x541c3d[_0x7052('0x46')]=qs['sort'](_0x1d8880[_0x7052('0x2a')][_0x7052('0x47')]);_0x541c3d[_0x7052('0x48')]=qs[_0x7052('0x32')](_[_0x7052('0x49')](_0x1d8880[_0x7052('0x2a')],_0x493f81[_0x7052('0x32')]));_0x541c3d[_0x7052('0x48')][_0x7052('0x4a')]=_0x5c60b4['id'];if(_0x1d8880[_0x7052('0x2a')][_0x7052('0x4b')]){_0x541c3d[_0x7052('0x48')]=_['merge'](_0x541c3d[_0x7052('0x48')],{'$or':_[_0x7052('0x23')](_0x541c3d['attributes'],function(_0x45351d){var _0x510e3a={};_0x510e3a[_0x45351d]={'$like':'%'+_0x1d8880[_0x7052('0x2a')][_0x7052('0x4b')]+'%'};return _0x510e3a;})});}if(_0x1d8880[_0x7052('0x2a')]['$gte']){var _0x67b9b4=_0x1d8880[_0x7052('0x2a')][_0x7052('0x4c')][_0x7052('0x4d')](',');var _0x183bc6={};_0x183bc6[_0x67b9b4[0x0]]={'$gte':moment(_0x67b9b4[0x1])[_0x7052('0x4e')]('YYYY-MM-DD\x20HH:mm:ss')};_0x541c3d[_0x7052('0x48')]=_['merge'](_0x541c3d['where'],_0x183bc6);}_0x541c3d=_[_0x7052('0x4f')]({},_0x541c3d,_0x1d8880[_0x7052('0x39')]);return db['OpenchannelMessage'][_0x7052('0x19')]({'where':_0x541c3d[_0x7052('0x48')]})[_0x7052('0x1d')](function(_0x4083e8){_0x17e237['count']=_0x4083e8;if(_0x1d8880[_0x7052('0x2a')]['includeAll']){_0x541c3d[_0x7052('0x38')]=[{'all':!![]}];}return db[_0x7052('0x40')][_0x7052('0x50')](_0x541c3d);})[_0x7052('0x1d')](function(_0x4c980e){_0x17e237['rows']=_0x4c980e;return _0x17e237;});}})['then'](respondWithFilteredResult(_0x3788ac,_0x541c3d))[_0x7052('0x3b')](handleError(_0x3788ac,null));};exports[_0x7052('0x51')]=function(_0x4ced7d,_0x4f4076){return db[_0x7052('0x31')]['find']({'where':{'id':_0x4ced7d[_0x7052('0x2e')]['id']}})['then'](handleEntityNotFound(_0x4f4076,null))['then'](function(_0x2cf846){if(_0x2cf846){return _0x2cf846[_0x7052('0x52')](_0x4ced7d['body']['ids'],_[_0x7052('0x42')](_0x4ced7d[_0x7052('0x3d')],[_0x7052('0x41'),'id'])||{})[_0x7052('0x53')](function(){return db[_0x7052('0x54')][_0x7052('0x50')]({'attributes':['id',_0x7052('0x20'),_0x7052('0x55')],'where':{'id':_0x4ced7d['body']['ids']}});})[_0x7052('0x1d')](function(_0x4d04ae){socket[_0x7052('0x56')](_0x7052('0x57'),{'id':Number(_0x4ced7d[_0x7052('0x2e')]['id']),'tags':_0x4d04ae||[]});return{'id':Number(_0x4ced7d[_0x7052('0x2e')]['id']),'tags':_0x4d04ae||[]};});}})[_0x7052('0x1d')](respondWithResult(_0x4f4076,null))[_0x7052('0x3b')](handleError(_0x4f4076,null));};exports[_0x7052('0x58')]=function(_0x20b080,_0x27b221){return db[_0x7052('0x31')]['find']({'where':{'id':_0x20b080[_0x7052('0x2e')]['id']}})['then'](handleEntityNotFound(_0x27b221,null))[_0x7052('0x1d')](function(_0x592af6){if(_0x592af6){return _0x592af6[_0x7052('0x58')](_0x20b080[_0x7052('0x2a')]['ids']);}})[_0x7052('0x1d')](respondWithStatusCode(_0x27b221,null))[_0x7052('0x3b')](handleError(_0x27b221,null));};exports[_0x7052('0x59')]=function(_0x2b4de2,_0x503e48){var _0x45e889=moment()['unix']()[_0x7052('0x5a')]();var _0xa8c0c9=path['join'](config['root'],_0x7052('0x5b'),_0x7052('0x5c'),'tmp');var _0x273d61=path[_0x7052('0x5d')](config['root'],_0x7052('0x5b'),_0x7052('0x5c'),_0x7052('0x5e'));var _0x59a218=path[_0x7052('0x5d')](_0xa8c0c9,_0x45e889);var _0x456773=util[_0x7052('0x4e')](_0x7052('0x5f'),_0x2b4de2[_0x7052('0x2e')]['id'],_0x45e889);var _0xd16f5d=path[_0x7052('0x5d')](_0xa8c0c9,_0x456773);var _0x29977c=[];_0x29977c['push']({'model':db['User'],'as':_0x7052('0x60'),'attributes':['id',_0x7052('0x61')],'raw':!![]});_0x29977c['push']({'model':db[_0x7052('0x62')],'as':_0x7052('0x63'),'attributes':['id','firstName',_0x7052('0x64')],'raw':!![]});if(_0x2b4de2[_0x7052('0x2a')][_0x7052('0x5e')]){_0x29977c[_0x7052('0x65')]({'model':db[_0x7052('0x66')],'as':_0x7052('0x66'),'raw':!![]});}var _0x483e39=[{'model':db[_0x7052('0x40')],'as':_0x7052('0x67'),'attributes':['id',_0x7052('0x3d'),_0x7052('0x68'),'direction',_0x7052('0x69'),_0x7052('0x6a')],'include':_0x29977c}];_0x483e39[_0x7052('0x65')]({'model':db['OpenchannelAccount'],'as':_0x7052('0x6b'),'attributes':['id','name']});_0x483e39[_0x7052('0x65')]({'model':db[_0x7052('0x60')],'as':_0x7052('0x6c'),'attributes':['id',_0x7052('0x61')]});return db[_0x7052('0x31')][_0x7052('0x3a')]({'where':{'id':_0x2b4de2[_0x7052('0x2e')]['id']},'include':_0x483e39})[_0x7052('0x1d')](handleEntityNotFound(_0x503e48,null))[_0x7052('0x1d')](function(_0x5e4f1c){if(_0x5e4f1c){var _0x30e152=_0x5e4f1c[_0x7052('0x6d')]({'plain':!![]});fs[_0x7052('0x6e')](_0x59a218);var _0x2d9b79={'channel':_0x7052('0x6f'),'account':_0x30e152[_0x7052('0x6b')][_0x7052('0x20')],'agent':_0x30e152[_0x7052('0x6c')]?_0x30e152[_0x7052('0x6c')]['fullname']:_0x7052('0x70'),'createdAt':moment(_0x30e152['createdAt'])[_0x7052('0x4e')](_0x7052('0x71'))[_0x7052('0x5a')](),'closedAt':_0x30e152[_0x7052('0x72')]?moment(_0x30e152[_0x7052('0x73')])[_0x7052('0x4e')]('YYYY-MM-DD\x20HH:mm:ss')[_0x7052('0x5a')]():'','disposition':_0x30e152['disposition'],'visibility':_0x30e152[_0x7052('0x74')]?_0x7052('0x75'):_0x7052('0x76'),'messages':_(_0x30e152[_0x7052('0x67')])['filter']({'secret':![]})[_0x7052('0x23')](function(_0x59e408){if(_0x59e408[_0x7052('0x66')]){var _0x3f25a9=path[_0x7052('0x5d')](_0x273d61,_0x59e408[_0x7052('0x66')]['basename']);if(fs[_0x7052('0x77')](_0x3f25a9)){fs['createReadStream'](_0x3f25a9)[_0x7052('0x78')](fs[_0x7052('0x79')](path[_0x7052('0x5d')](_0x59a218,_0x59e408[_0x7052('0x66')][_0x7052('0x7a')])));}}return{'date':moment(_0x59e408[_0x7052('0x68')])[_0x7052('0x4e')](_0x7052('0x71'))[_0x7052('0x5a')](),'sender':_0x59e408[_0x7052('0x7b')]===_0x7052('0x7c')?_0x59e408[_0x7052('0x60')]?_0x59e408[_0x7052('0x60')]['fullname']:_0x7052('0x7d'):_0x59e408[_0x7052('0x63')]['firstName']+(_0x59e408['Contact'][_0x7052('0x64')]?'\x20'+_0x59e408[_0x7052('0x63')]['lastName']:''),'body':_0x59e408[_0x7052('0x66')]?_0x59e408[_0x7052('0x66')][_0x7052('0x7a')]:_0x59e408['body'],'direction':_0x59e408[_0x7052('0x7b')]===_0x7052('0x7c')?'A':'C','secret':_0x59e408[_0x7052('0x69')],'read':_0x59e408[_0x7052('0x6a')],'attachment':_0x59e408[_0x7052('0x66')]};})[_0x7052('0x7e')]()};return ejs[_0x7052('0x7f')](path['join'](config[_0x7052('0x80')],'server','views','downloadInteraction.ejs'),{'interaction':_0x2d9b79})['then'](function(_0x2c3f10){var _0xad9303=path['join'](_0x59a218,_0x7052('0x81')+_0x30e152['id']+'-'+_0x45e889+'.pdf');var _0x58ad57={'path':_0xad9303,'channel':_0x7052('0x6f'),'interactionId':_0x30e152['id']};return pdf['createPdfFromHTML'](_0x2c3f10,_0x58ad57);})['then'](function(){return new Promise(function(_0x5e0200,_0x39989e){zipdir(_0x59a218,{'saveTo':_0xd16f5d},function(_0x3eb2fb,_0x8530a0){if(_0x3eb2fb)return _0x39989e(_0x3eb2fb);return _0x5e0200(_0x8530a0);});})[_0x7052('0x1d')](function(){return new Promise(function(_0x472271,_0x1d4d98){rimraf(_0x59a218,function(_0x15ec7c){if(_0x15ec7c)_0x1d4d98(_0x15ec7c);return _0x472271();});});})[_0x7052('0x1d')](function(){return _0x503e48['download'](_0xd16f5d,_0x456773,function(_0x14502e){if(_0x14502e){logger[_0x7052('0x1e')]('Unable\x20to\x20delete\x20zip\x20file',_0x14502e);}else{fs['unlinkSync'](_0xd16f5d);}});});});}else{return _0x503e48[_0x7052('0x12')](0xc8);}})[_0x7052('0x3b')](handleError(_0x503e48,null));}; \ No newline at end of file diff --git a/server/api/openchannelInteraction/openchannelInteraction.events.js b/server/api/openchannelInteraction/openchannelInteraction.events.js index 2554f66..1c33624 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 _0x9711=['hasOwnProperty','hook','exports','events','../../mysqldb','OpenchannelInteraction','save','remove','getUsers','then','setDataValue','map','findAll','unreadMessages','emit','catch'];(function(_0x5d8657,_0x2c118f){var _0x1ba44e=function(_0x2db953){while(--_0x2db953){_0x5d8657['push'](_0x5d8657['shift']());}};_0x1ba44e(++_0x2c118f);}(_0x9711,0xa3));var _0x1971=function(_0x3434c8,_0x38ee08){_0x3434c8=_0x3434c8-0x0;var _0x2f421e=_0x9711[_0x3434c8];return _0x2f421e;};'use strict';var EventEmitter=require(_0x1971('0x0'));var OpenchannelInteraction=require(_0x1971('0x1'))['db'][_0x1971('0x2')];var OpenchannelMessage=require('../../mysqldb')['db']['OpenchannelMessage'];var OpenchannelInteractionEvents=new EventEmitter();OpenchannelInteractionEvents['setMaxListeners'](0x0);var events={'afterCreate':_0x1971('0x3'),'afterUpdate':'update','afterDestroy':_0x1971('0x4')};function emitEvent(_0x4c1b7e){return function(_0x3f0203,_0x24b2a2,_0x133cba){_0x3f0203[_0x1971('0x5')]({'attributes':['id'],'raw':!![]})[_0x1971('0x6')](function(_0x2ac67e){_0x3f0203[_0x1971('0x7')]('Users',_0x2ac67e[_0x1971('0x8')](function(_0x5977b4){return{'id':_0x5977b4['id']};}));return OpenchannelMessage[_0x1971('0x9')]({'where':{'OpenchannelInteractionId':_0x3f0203['id'],'direction':'in','read':![]},'raw':!![]});})['then'](function(_0x31a82b){_0x3f0203[_0x1971('0x7')](_0x1971('0xa'),_0x31a82b['length']);OpenchannelInteractionEvents[_0x1971('0xb')](_0x4c1b7e+':'+_0x3f0203['id'],_0x3f0203);OpenchannelInteractionEvents[_0x1971('0xb')](_0x4c1b7e,_0x3f0203);_0x133cba(null);})[_0x1971('0xc')](_0x133cba(null));};}for(var e in events){if(events[_0x1971('0xd')](e)){var event=events[e];OpenchannelInteraction[_0x1971('0xe')](e,emitEvent(event));}}module[_0x1971('0xf')]=OpenchannelInteractionEvents; \ No newline at end of file +var _0x6589=['map','findAll','emit','catch','exports','../../mysqldb','then'];(function(_0x26ed0c,_0x1d8bec){var _0x3daa2a=function(_0x5d73f0){while(--_0x5d73f0){_0x26ed0c['push'](_0x26ed0c['shift']());}};_0x3daa2a(++_0x1d8bec);}(_0x6589,0x116));var _0x9658=function(_0x3de4f8,_0x336c7d){_0x3de4f8=_0x3de4f8-0x0;var _0x3d81fc=_0x6589[_0x3de4f8];return _0x3d81fc;};'use strict';var EventEmitter=require('events');var OpenchannelInteraction=require('../../mysqldb')['db']['OpenchannelInteraction'];var OpenchannelMessage=require(_0x9658('0x0'))['db']['OpenchannelMessage'];var OpenchannelInteractionEvents=new EventEmitter();OpenchannelInteractionEvents['setMaxListeners'](0x0);var events={'afterCreate':'save','afterUpdate':'update','afterDestroy':'remove'};function emitEvent(_0x38e725){return function(_0x4b2add,_0x3c2155,_0x33c965){_0x4b2add['getUsers']({'attributes':['id'],'raw':!![]})[_0x9658('0x1')](function(_0x184d4a){_0x4b2add['setDataValue']('Users',_0x184d4a[_0x9658('0x2')](function(_0x264b27){return{'id':_0x264b27['id']};}));return OpenchannelMessage[_0x9658('0x3')]({'where':{'OpenchannelInteractionId':_0x4b2add['id'],'direction':'in','read':![]},'raw':!![]});})[_0x9658('0x1')](function(_0x7bc0a){_0x4b2add['setDataValue']('unreadMessages',_0x7bc0a['length']);OpenchannelInteractionEvents['emit'](_0x38e725+':'+_0x4b2add['id'],_0x4b2add);OpenchannelInteractionEvents[_0x9658('0x4')](_0x38e725,_0x4b2add);_0x33c965(null);})[_0x9658('0x5')](_0x33c965(null));};}for(var e in events){if(events['hasOwnProperty'](e)){var event=events[e];OpenchannelInteraction['hook'](e,emitEvent(event));}}module[_0x9658('0x6')]=OpenchannelInteractionEvents; \ No newline at end of file diff --git a/server/api/openchannelInteraction/openchannelInteraction.model.js b/server/api/openchannelInteraction/openchannelInteraction.model.js index dff34c3..ebf176f 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 _0xc824=['lodash','util','../../config/logger','api','moment','bluebird','request-promise','path','../../config/environment','./openchannelInteraction.attributes','OpenchannelInteraction','openchannel_interactions','utf8mb4','closed','format','YYYY-MM-DD\x20HH:mm:ss'];(function(_0x3f26df,_0x1d7b13){var _0xb0ad67=function(_0x3ac70f){while(--_0x3ac70f){_0x3f26df['push'](_0x3f26df['shift']());}};_0xb0ad67(++_0x1d7b13);}(_0xc824,0x1b0));var _0x4c82=function(_0x24a302,_0x16be7c){_0x24a302=_0x24a302-0x0;var _0x27116d=_0xc824[_0x24a302];return _0x27116d;};'use strict';var _=require(_0x4c82('0x0'));var util=require(_0x4c82('0x1'));var logger=require(_0x4c82('0x2'))(_0x4c82('0x3'));var moment=require(_0x4c82('0x4'));var BPromise=require(_0x4c82('0x5'));var rp=require(_0x4c82('0x6'));var fs=require('fs');var path=require(_0x4c82('0x7'));var rimraf=require('rimraf');var config=require(_0x4c82('0x8'));var attributes=require(_0x4c82('0x9'));module['exports']=function(_0x21675d,_0x1e7617){return _0x21675d['define'](_0x4c82('0xa'),attributes,{'tableName':_0x4c82('0xb'),'paranoid':![],'indexes':[],'timestamps':!![],'charset':_0x4c82('0xc'),'collate':'utf8mb4_unicode_ci','hooks':{'beforeUpdate':function(_0x41a2d9,_0x523e0d,_0x3a47ae){if(_0x41a2d9['changed'](_0x4c82('0xd'))){_0x41a2d9['closedAt']=moment()[_0x4c82('0xe')](_0x4c82('0xf'));}_0x3a47ae(null,_0x41a2d9);}}});}; \ No newline at end of file +var _0x8e9f=['../../config/logger','api','moment','bluebird','request-promise','path','rimraf','../../config/environment','./openchannelInteraction.attributes','define','openchannel_interactions','utf8mb4_unicode_ci','changed','closed','format','lodash'];(function(_0x33bc39,_0x252914){var _0x23ad29=function(_0x5c70ad){while(--_0x5c70ad){_0x33bc39['push'](_0x33bc39['shift']());}};_0x23ad29(++_0x252914);}(_0x8e9f,0x1ef));var _0xf8e9=function(_0x1ed116,_0x23bc80){_0x1ed116=_0x1ed116-0x0;var _0x574066=_0x8e9f[_0x1ed116];return _0x574066;};'use strict';var _=require(_0xf8e9('0x0'));var util=require('util');var logger=require(_0xf8e9('0x1'))(_0xf8e9('0x2'));var moment=require(_0xf8e9('0x3'));var BPromise=require(_0xf8e9('0x4'));var rp=require(_0xf8e9('0x5'));var fs=require('fs');var path=require(_0xf8e9('0x6'));var rimraf=require(_0xf8e9('0x7'));var config=require(_0xf8e9('0x8'));var attributes=require(_0xf8e9('0x9'));module['exports']=function(_0x2cb32a,_0x55d4c5){return _0x2cb32a[_0xf8e9('0xa')]('OpenchannelInteraction',attributes,{'tableName':_0xf8e9('0xb'),'paranoid':![],'indexes':[],'timestamps':!![],'charset':'utf8mb4','collate':_0xf8e9('0xc'),'hooks':{'beforeUpdate':function(_0x301615,_0x2d2cf8,_0x2c4db8){if(_0x301615[_0xf8e9('0xd')](_0xf8e9('0xe'))){_0x301615['closedAt']=moment()[_0xf8e9('0xf')]('YYYY-MM-DD\x20HH:mm:ss');}_0x2c4db8(null,_0x301615);}}});}; \ No newline at end of file diff --git a/server/api/openchannelInteraction/openchannelInteraction.rpc.js b/server/api/openchannelInteraction/openchannelInteraction.rpc.js index 9a78619..2851586 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 _0x77f2=['../../config/environment','jayson/promise','client','http','redis','defaults','localhost','socket.io-emitter','request','then','OpenchannelInteraction,\x20%s,\x20%s','request\x20sent','debug','OpenchannelInteraction,\x20%s,\x20%s,\x20%s','stringify','error','code','message','result','catch','UpdateOpenchannelInteraction','OpenchannelInteraction','options','raw','where','attributes','info','find','addTags','ids','body','spread','AddTags','lodash','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc'];(function(_0x6c993a,_0x5ea3ab){var _0x27f547=function(_0x22df20){while(--_0x22df20){_0x6c993a['push'](_0x6c993a['shift']());}};_0x27f547(++_0x5ea3ab);}(_0x77f2,0xc5));var _0x277f=function(_0x2112d4,_0x3c863c){_0x2112d4=_0x2112d4-0x0;var _0x434972=_0x77f2[_0x2112d4];return _0x434972;};'use strict';var _=require(_0x277f('0x0'));var util=require('util');var moment=require('moment');var BPromise=require(_0x277f('0x1'));var rs=require(_0x277f('0x2'));var fs=require('fs');var Redis=require(_0x277f('0x3'));var db=require(_0x277f('0x4'))['db'];var utils=require(_0x277f('0x5'));var logger=require(_0x277f('0x6'))(_0x277f('0x7'));var config=require(_0x277f('0x8'));var jayson=require(_0x277f('0x9'));var client=jayson[_0x277f('0xa')][_0x277f('0xb')]({'port':0x232a});config[_0x277f('0xc')]=_[_0x277f('0xd')](config[_0x277f('0xc')],{'host':_0x277f('0xe'),'port':0x18eb});var socket=require(_0x277f('0xf'))(new Redis(config[_0x277f('0xc')]));require('./openchannelInteraction.socket')['register'](socket);function respondWithRpcPromise(_0x5f59fa,_0x3ec849,_0x25c70c){return new BPromise(function(_0x50b46c,_0x430522){return client[_0x277f('0x10')](_0x5f59fa,_0x25c70c)[_0x277f('0x11')](function(_0x1c9235){logger['info'](_0x277f('0x12'),_0x3ec849,_0x277f('0x13'));logger[_0x277f('0x14')](_0x277f('0x15'),_0x3ec849,_0x277f('0x13'),JSON[_0x277f('0x16')](_0x1c9235));if(_0x1c9235['error']){if(_0x1c9235[_0x277f('0x17')][_0x277f('0x18')]===0x1f4){logger[_0x277f('0x17')](_0x277f('0x12'),_0x3ec849,_0x1c9235[_0x277f('0x17')][_0x277f('0x19')]);return _0x430522(_0x1c9235[_0x277f('0x17')][_0x277f('0x19')]);}logger['error']('OpenchannelInteraction,\x20%s,\x20%s',_0x3ec849,_0x1c9235[_0x277f('0x17')][_0x277f('0x19')]);return _0x50b46c(_0x1c9235[_0x277f('0x17')][_0x277f('0x19')]);}else{logger['info']('OpenchannelInteraction,\x20%s,\x20%s',_0x3ec849,_0x277f('0x13'));_0x50b46c(_0x1c9235[_0x277f('0x1a')][_0x277f('0x19')]);}})[_0x277f('0x1b')](function(_0xfb5a68){logger['error'](_0x277f('0x12'),_0x3ec849,_0xfb5a68);_0x430522(_0xfb5a68);});});}exports[_0x277f('0x1c')]=function(_0x595093){var _0x13957a=this;return new Promise(function(_0x4d5654,_0xaeb6e4){return db[_0x277f('0x1d')]['update'](_0x595093['body'],{'raw':_0x595093[_0x277f('0x1e')]?_0x595093[_0x277f('0x1e')][_0x277f('0x1f')]===undefined?!![]:![]:!![],'individualHooks':!![],'where':_0x595093['options']?_0x595093[_0x277f('0x1e')][_0x277f('0x20')]||null:null,'attributes':_0x595093['options']?_0x595093[_0x277f('0x1e')][_0x277f('0x21')]||null:null,'limit':_0x595093['options']?_0x595093[_0x277f('0x1e')]['limit']||null:null})[_0x277f('0x11')](function(_0x720dee){logger[_0x277f('0x22')](_0x277f('0x1c'),_0x595093);logger[_0x277f('0x14')](_0x277f('0x1c'),_0x595093,JSON[_0x277f('0x16')](_0x720dee));_0x4d5654(_0x720dee);})['catch'](function(_0x306f41){logger[_0x277f('0x17')](_0x277f('0x1c'),_0x306f41[_0x277f('0x19')],_0x595093);_0xaeb6e4(_0x13957a[_0x277f('0x17')](0x1f4,_0x306f41[_0x277f('0x19')]));});});};exports['AddTagsToOpenchannelInteraction']=function(_0x353dc8){return new Promise(function(_0x232cba,_0x234b8e){return db[_0x277f('0x1d')][_0x277f('0x23')]({'where':_0x353dc8['options']?_0x353dc8[_0x277f('0x1e')][_0x277f('0x20')]||null:null})['then'](function(_0x363964){if(_0x363964){return _0x363964[_0x277f('0x24')](_0x353dc8['body'][_0x277f('0x25')],_['omit'](_0x353dc8[_0x277f('0x26')],['ids','id'])||{});}})[_0x277f('0x27')](function(_0xbfe710){logger[_0x277f('0x22')](_0x277f('0x28'),_0x353dc8);logger[_0x277f('0x14')]('AddTags',_0x353dc8,JSON['stringify'](_0xbfe710));_0x232cba(_0xbfe710);})['catch'](function(_0x539c1a){logger[_0x277f('0x17')]('AddTags',_0x539c1a['message'],_0x353dc8);_0x234b8e(_this[_0x277f('0x17')](0x1f4,_0x539c1a[_0x277f('0x19')]));});});}; \ No newline at end of file +var _0xc593=['debug','OpenchannelInteraction,\x20%s,\x20%s,\x20%s','error','message','catch','UpdateOpenchannelInteraction','OpenchannelInteraction','options','raw','where','attributes','limit','stringify','AddTagsToOpenchannelInteraction','omit','body','ids','AddTags','lodash','util','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/environment','jayson/promise','redis','defaults','localhost','register','then','info','OpenchannelInteraction,\x20%s,\x20%s','request\x20sent'];(function(_0x3dd15e,_0x1f0015){var _0x231fd0=function(_0x4f680a){while(--_0x4f680a){_0x3dd15e['push'](_0x3dd15e['shift']());}};_0x231fd0(++_0x1f0015);}(_0xc593,0xe4));var _0x3c59=function(_0x167cc1,_0x56ef5a){_0x167cc1=_0x167cc1-0x0;var _0x10bc4b=_0xc593[_0x167cc1];return _0x10bc4b;};'use strict';var _=require(_0x3c59('0x0'));var util=require(_0x3c59('0x1'));var moment=require(_0x3c59('0x2'));var BPromise=require(_0x3c59('0x3'));var rs=require(_0x3c59('0x4'));var fs=require('fs');var Redis=require(_0x3c59('0x5'));var db=require(_0x3c59('0x6'))['db'];var utils=require('../../config/utils');var logger=require('../../config/logger')('rpc');var config=require(_0x3c59('0x7'));var jayson=require(_0x3c59('0x8'));var client=jayson['client']['http']({'port':0x232a});config[_0x3c59('0x9')]=_[_0x3c59('0xa')](config[_0x3c59('0x9')],{'host':_0x3c59('0xb'),'port':0x18eb});var socket=require('socket.io-emitter')(new Redis(config[_0x3c59('0x9')]));require('./openchannelInteraction.socket')[_0x3c59('0xc')](socket);function respondWithRpcPromise(_0x5a4556,_0xb683e8,_0x58c086){return new BPromise(function(_0x5611a7,_0xf798b4){return client['request'](_0x5a4556,_0x58c086)[_0x3c59('0xd')](function(_0xcc19af){logger[_0x3c59('0xe')](_0x3c59('0xf'),_0xb683e8,_0x3c59('0x10'));logger[_0x3c59('0x11')](_0x3c59('0x12'),_0xb683e8,'request\x20sent',JSON['stringify'](_0xcc19af));if(_0xcc19af[_0x3c59('0x13')]){if(_0xcc19af[_0x3c59('0x13')]['code']===0x1f4){logger['error']('OpenchannelInteraction,\x20%s,\x20%s',_0xb683e8,_0xcc19af[_0x3c59('0x13')][_0x3c59('0x14')]);return _0xf798b4(_0xcc19af[_0x3c59('0x13')][_0x3c59('0x14')]);}logger[_0x3c59('0x13')](_0x3c59('0xf'),_0xb683e8,_0xcc19af[_0x3c59('0x13')][_0x3c59('0x14')]);return _0x5611a7(_0xcc19af[_0x3c59('0x13')][_0x3c59('0x14')]);}else{logger[_0x3c59('0xe')]('OpenchannelInteraction,\x20%s,\x20%s',_0xb683e8,_0x3c59('0x10'));_0x5611a7(_0xcc19af['result'][_0x3c59('0x14')]);}})[_0x3c59('0x15')](function(_0x5d91f0){logger['error']('OpenchannelInteraction,\x20%s,\x20%s',_0xb683e8,_0x5d91f0);_0xf798b4(_0x5d91f0);});});}exports[_0x3c59('0x16')]=function(_0xa6e5a1){var _0x44da01=this;return new Promise(function(_0x5b8fb7,_0x397d56){return db[_0x3c59('0x17')]['update'](_0xa6e5a1['body'],{'raw':_0xa6e5a1[_0x3c59('0x18')]?_0xa6e5a1[_0x3c59('0x18')][_0x3c59('0x19')]===undefined?!![]:![]:!![],'individualHooks':!![],'where':_0xa6e5a1['options']?_0xa6e5a1['options'][_0x3c59('0x1a')]||null:null,'attributes':_0xa6e5a1['options']?_0xa6e5a1[_0x3c59('0x18')][_0x3c59('0x1b')]||null:null,'limit':_0xa6e5a1[_0x3c59('0x18')]?_0xa6e5a1[_0x3c59('0x18')][_0x3c59('0x1c')]||null:null})[_0x3c59('0xd')](function(_0x42067f){logger['info'](_0x3c59('0x16'),_0xa6e5a1);logger['debug'](_0x3c59('0x16'),_0xa6e5a1,JSON[_0x3c59('0x1d')](_0x42067f));_0x5b8fb7(_0x42067f);})[_0x3c59('0x15')](function(_0x586834){logger[_0x3c59('0x13')]('UpdateOpenchannelInteraction',_0x586834[_0x3c59('0x14')],_0xa6e5a1);_0x397d56(_0x44da01[_0x3c59('0x13')](0x1f4,_0x586834[_0x3c59('0x14')]));});});};exports[_0x3c59('0x1e')]=function(_0xd30b1c){return new Promise(function(_0x407df6,_0x27c4d9){return db['OpenchannelInteraction']['find']({'where':_0xd30b1c[_0x3c59('0x18')]?_0xd30b1c['options'][_0x3c59('0x1a')]||null:null})[_0x3c59('0xd')](function(_0x43f4e1){if(_0x43f4e1){return _0x43f4e1['addTags'](_0xd30b1c['body']['ids'],_[_0x3c59('0x1f')](_0xd30b1c[_0x3c59('0x20')],[_0x3c59('0x21'),'id'])||{});}})['spread'](function(_0x3f2456){logger[_0x3c59('0xe')](_0x3c59('0x22'),_0xd30b1c);logger[_0x3c59('0x11')](_0x3c59('0x22'),_0xd30b1c,JSON['stringify'](_0x3f2456));_0x407df6(_0x3f2456);})['catch'](function(_0x1f19ca){logger['error'](_0x3c59('0x22'),_0x1f19ca[_0x3c59('0x14')],_0xd30b1c);_0x27c4d9(_this[_0x3c59('0x13')](0x1f4,_0x1f19ca[_0x3c59('0x14')]));});});}; \ No newline at end of file diff --git a/server/api/openchannelInteraction/openchannelInteraction.socket.js b/server/api/openchannelInteraction/openchannelInteraction.socket.js index ed16f81..3cc4ffb 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 _0x2490=['./openchannelInteraction.events','remove','update','emit','removeListener','openchannelInteraction:'];(function(_0x43776a,_0x4eb74c){var _0x18eb8f=function(_0x319afb){while(--_0x319afb){_0x43776a['push'](_0x43776a['shift']());}};_0x18eb8f(++_0x4eb74c);}(_0x2490,0x132));var _0x0249=function(_0x37d33f,_0x4efb57){_0x37d33f=_0x37d33f-0x0;var _0x418b75=_0x2490[_0x37d33f];return _0x418b75;};'use strict';var OpenchannelInteractionEvents=require(_0x0249('0x0'));var events=['save',_0x0249('0x1'),_0x0249('0x2')];function createListener(_0x360404,_0x30186e){return function(_0x317e90){_0x30186e[_0x0249('0x3')](_0x360404,_0x317e90);};}function removeListener(_0x54e382,_0x3d4b17){return function(){OpenchannelInteractionEvents[_0x0249('0x4')](_0x54e382,_0x3d4b17);};}exports['register']=function(_0x3f5bfd){for(var _0x290e50=0x0,_0x473374=events['length'];_0x290e50<_0x473374;_0x290e50++){var _0x3bfb1b=events[_0x290e50];var _0xd29c34=createListener(_0x0249('0x5')+_0x3bfb1b,_0x3f5bfd);OpenchannelInteractionEvents['on'](_0x3bfb1b,_0xd29c34);}}; \ No newline at end of file +var _0x0b7e=['removeListener','register','length','openchannelInteraction:','./openchannelInteraction.events','save','remove','update','emit'];(function(_0x2f4be7,_0xef8ddd){var _0x3e0110=function(_0x51e338){while(--_0x51e338){_0x2f4be7['push'](_0x2f4be7['shift']());}};_0x3e0110(++_0xef8ddd);}(_0x0b7e,0x148));var _0xe0b7=function(_0xebf6d4,_0x30b627){_0xebf6d4=_0xebf6d4-0x0;var _0x3c889c=_0x0b7e[_0xebf6d4];return _0x3c889c;};'use strict';var OpenchannelInteractionEvents=require(_0xe0b7('0x0'));var events=[_0xe0b7('0x1'),_0xe0b7('0x2'),_0xe0b7('0x3')];function createListener(_0x562f96,_0x4897d1){return function(_0x36b1a4){_0x4897d1[_0xe0b7('0x4')](_0x562f96,_0x36b1a4);};}function removeListener(_0x10b99d,_0x3fbbae){return function(){OpenchannelInteractionEvents[_0xe0b7('0x5')](_0x10b99d,_0x3fbbae);};}exports[_0xe0b7('0x6')]=function(_0x3c4bd4){for(var _0x4ed6e9=0x0,_0x9dc7a7=events[_0xe0b7('0x7')];_0x4ed6e9<_0x9dc7a7;_0x4ed6e9++){var _0x23f3db=events[_0x4ed6e9];var _0x31a605=createListener(_0xe0b7('0x8')+_0x23f3db,_0x3c4bd4);OpenchannelInteractionEvents['on'](_0x23f3db,_0x31a605);}}; \ No newline at end of file diff --git a/server/api/openchannelMessage/index.js b/server/api/openchannelMessage/index.js index 9d52408..02884cf 100644 --- a/server/api/openchannelMessage/index.js +++ b/server/api/openchannelMessage/index.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0xa9e0=['index','/describe','show','post','isAuthenticated','tracked','openchannel','openchannelmessage:create','update','put','/:id/accept','accept','reject','delete','/:id','destroy','multer','util','path','Router','../../components/auth/service','../../components/interaction/service','../../config/environment','./openchannelMessage.controller','get'];(function(_0x36fe61,_0x85943b){var _0x39f40c=function(_0x3603f4){while(--_0x3603f4){_0x36fe61['push'](_0x36fe61['shift']());}};_0x39f40c(++_0x85943b);}(_0xa9e0,0x123));var _0x0a9e=function(_0x21aec3,_0x5c97e9){_0x21aec3=_0x21aec3-0x0;var _0x288bbc=_0xa9e0[_0x21aec3];return _0x288bbc;};'use strict';var multer=require(_0x0a9e('0x0'));var util=require(_0x0a9e('0x1'));var path=require(_0x0a9e('0x2'));var timeout=require('connect-timeout');var express=require('express');var router=express[_0x0a9e('0x3')]();var fs_extra=require('fs-extra');var auth=require(_0x0a9e('0x4'));var interaction=require(_0x0a9e('0x5'));var config=require(_0x0a9e('0x6'));var controller=require(_0x0a9e('0x7'));router[_0x0a9e('0x8')]('/',auth['isAuthenticated'](),controller[_0x0a9e('0x9')]);router[_0x0a9e('0x8')](_0x0a9e('0xa'),auth['isAuthenticated'](),controller['describe']);router[_0x0a9e('0x8')]('/:id',auth['isAuthenticated'](),controller[_0x0a9e('0xb')]);router[_0x0a9e('0xc')]('/',auth[_0x0a9e('0xd')](),interaction[_0x0a9e('0xe')](_0x0a9e('0xf'),_0x0a9e('0x10')),controller['create']);router['put']('/:id',auth['isAuthenticated'](),controller[_0x0a9e('0x11')]);router[_0x0a9e('0x12')](_0x0a9e('0x13'),auth[_0x0a9e('0xd')](),controller[_0x0a9e('0x14')]);router[_0x0a9e('0x12')]('/:id/reject',auth[_0x0a9e('0xd')](),controller[_0x0a9e('0x15')]);router[_0x0a9e('0x16')](_0x0a9e('0x17'),auth[_0x0a9e('0xd')](),controller[_0x0a9e('0x18')]);module['exports']=router; \ No newline at end of file +var _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(_0x68c979,_0x431cff){var _0x4f0001=function(_0xa7595d){while(--_0xa7595d){_0x68c979['push'](_0x68c979['shift']());}};_0x4f0001(++_0x431cff);}(_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 diff --git a/server/api/openchannelMessage/openchannelMessage.attributes.js b/server/api/openchannelMessage/openchannelMessage.attributes.js index 939ead8..61539dc 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 _0x9e6b=['ENUM','out','DATE','TEXT','sequelize','exports','medium'];(function(_0x582bc3,_0x3a4bda){var _0x3d0a91=function(_0x8bff6a){while(--_0x8bff6a){_0x582bc3['push'](_0x582bc3['shift']());}};_0x3d0a91(++_0x3a4bda);}(_0x9e6b,0x11c));var _0xb9e6=function(_0x53ccf2,_0x13cb67){_0x53ccf2=_0x53ccf2-0x0;var _0x5a2964=_0x9e6b[_0x53ccf2];return _0x5a2964;};'use strict';var Sequelize=require(_0xb9e6('0x0'));module[_0xb9e6('0x1')]={'body':{'type':Sequelize['TEXT'](_0xb9e6('0x2')),'allowNull':![]},'read':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'secret':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'direction':{'type':Sequelize[_0xb9e6('0x3')]('in',_0xb9e6('0x4')),'defaultValue':_0xb9e6('0x4'),'allowNull':![]},'readAt':{'type':Sequelize[_0xb9e6('0x5')]},'providerName':{'type':Sequelize['STRING']},'providerResponse':{'type':Sequelize[_0xb9e6('0x6')]}}; \ No newline at end of file +var _0xb6fa=['STRING','TEXT','sequelize','medium','ENUM','out','DATE'];(function(_0x3dd15e,_0x1f0015){var _0x231fd0=function(_0x4f680a){while(--_0x4f680a){_0x3dd15e['push'](_0x3dd15e['shift']());}};_0x231fd0(++_0x1f0015);}(_0xb6fa,0x1c2));var _0xab6f=function(_0xf79bae,_0x263b2a){_0xf79bae=_0xf79bae-0x0;var _0x5d2cb7=_0xb6fa[_0xf79bae];return _0x5d2cb7;};'use strict';var Sequelize=require(_0xab6f('0x0'));module['exports']={'body':{'type':Sequelize['TEXT'](_0xab6f('0x1')),'allowNull':![]},'read':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'secret':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'direction':{'type':Sequelize[_0xab6f('0x2')]('in',_0xab6f('0x3')),'defaultValue':'out','allowNull':![]},'readAt':{'type':Sequelize[_0xab6f('0x4')]},'providerName':{'type':Sequelize[_0xab6f('0x5')]},'providerResponse':{'type':Sequelize[_0xab6f('0x6')]}}; \ No newline at end of file diff --git a/server/api/openchannelMessage/openchannelMessage.controller.js b/server/api/openchannelMessage/openchannelMessage.controller.js index e76a200..16bedeb 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 _0x4b87=['../../mysqldb','redis','defaults','localhost','socket.io-emitter','jayson/promise','client','http','request','info','OpenchannelMessage,\x20%s,\x20%s','request\x20sent','debug','OpenchannelMessage,\x20%s,\x20%s,\x20%s','stringify','error','code','message','result','catch','sendStatus','status','end','offset','undefined','limit','count','apply','reject','update','then','destroy','stack','name','rawAttributes','fieldName','type','key','model','map','query','filters','intersection','fields','attributes','length','hasOwnProperty','sort','where','merge','VIRTUAL','filter','OpenchannelMessage','rows','show','keys','include','options','find','create','body','params','describe','openchannel-interactions','accept','openchannel','read','readAt','format','UserId','user','agent','get','OpenchannelInteraction','OpenchannelInteractionId','isNil','YYYY-MM-DD\x20HH:mm:ss','interaction','[OPENCHANNELMESSAGE:ACCEPT]\x20id=%s\x20name=%s\x20role=%s\x20interaction=%s\x20body=%s','role','null','AcceptMessage','acceptMessage','SELECT\x20*\x20FROM\x20cm_contacts\x20WHERE\x20id\x20=\x20','ContactId','sequelize','Sequelize','QueryTypes','SELECT','contact','User','fullname','email','internal','interface','SIP/%s','channel','motionChannel','event','EventManager','acceptmessage','RejectMessage','rejectMessage','rejectmessage','eml-format','rimraf','fast-json-patch','moment','bluebird','util','path','to-csv','ejs','fs-extra','lodash','desk.js','querystring','papaparse','ioredis','../../components/auth/service','../../config/logger','api','../../config/utils','../../config/environment'];(function(_0x5d4f12,_0x11e67c){var _0x4eb577=function(_0x4d7a2d){while(--_0x4d7a2d){_0x5d4f12['push'](_0x5d4f12['shift']());}};_0x4eb577(++_0x11e67c);}(_0x4b87,0x1dc));var _0x74b8=function(_0x241a0b,_0x5bd1c2){_0x241a0b=_0x241a0b-0x0;var _0x3bbdb8=_0x4b87[_0x241a0b];return _0x3bbdb8;};'use strict';var emlformat=require(_0x74b8('0x0'));var rimraf=require(_0x74b8('0x1'));var zipdir=require('zip-dir');var jsonpatch=require(_0x74b8('0x2'));var rp=require('request-promise');var moment=require(_0x74b8('0x3'));var BPromise=require(_0x74b8('0x4'));var Mustache=require('mustache');var util=require(_0x74b8('0x5'));var path=require(_0x74b8('0x6'));var sox=require('sox');var csv=require(_0x74b8('0x7'));var ejs=require(_0x74b8('0x8'));var fs=require('fs');var fs_extra=require(_0x74b8('0x9'));var _=require(_0x74b8('0xa'));var squel=require('squel');var crypto=require('crypto');var jsforce=require('jsforce');var deskjs=require(_0x74b8('0xb'));var toCsv=require('to-csv');var querystring=require(_0x74b8('0xc'));var Papa=require(_0x74b8('0xd'));var Redis=require(_0x74b8('0xe'));var authService=require(_0x74b8('0xf'));var qs=require('../../components/parsers/qs');var as=require('../../components/parsers/advancedSearch');var hardwareService=require('../../config/license/hardware');var logger=require(_0x74b8('0x10'))(_0x74b8('0x11'));var utils=require(_0x74b8('0x12'));var config=require(_0x74b8('0x13'));var licenseUtil=require('../../config/license/util');var db=require(_0x74b8('0x14'))['db'];config[_0x74b8('0x15')]=_[_0x74b8('0x16')](config[_0x74b8('0x15')],{'host':_0x74b8('0x17'),'port':0x18eb});var socket=require(_0x74b8('0x18'))(new Redis(config[_0x74b8('0x15')]));require('./openchannelMessage.socket')['register'](socket);var jayson=require(_0x74b8('0x19'));var client=jayson[_0x74b8('0x1a')][_0x74b8('0x1b')]({'port':0x232c});var client9002=jayson['client'][_0x74b8('0x1b')]({'port':0x232a});function respondWithRpcPromise(_0x3fd431,_0x136a0b,_0x1fca99,_0x1909d1){return new BPromise(function(_0x4aefca,_0x1e17f1){var _0x3d5b38=_0x1909d1||client;return _0x3d5b38[_0x74b8('0x1c')](_0x3fd431,_0x1fca99)['then'](function(_0x45ec2b){logger[_0x74b8('0x1d')](_0x74b8('0x1e'),_0x136a0b,_0x74b8('0x1f'));logger[_0x74b8('0x20')](_0x74b8('0x21'),_0x136a0b,_0x74b8('0x1f'),JSON[_0x74b8('0x22')](_0x45ec2b));if(_0x45ec2b[_0x74b8('0x23')]){if(_0x45ec2b['error'][_0x74b8('0x24')]===0x1f4){logger[_0x74b8('0x23')](_0x74b8('0x1e'),_0x136a0b,_0x45ec2b[_0x74b8('0x23')]['message']);return _0x1e17f1(_0x45ec2b[_0x74b8('0x23')][_0x74b8('0x25')]);}logger[_0x74b8('0x23')](_0x74b8('0x1e'),_0x136a0b,_0x45ec2b[_0x74b8('0x23')]['message']);return _0x4aefca(_0x45ec2b[_0x74b8('0x23')][_0x74b8('0x25')]);}else{logger[_0x74b8('0x1d')](_0x74b8('0x1e'),_0x136a0b,_0x74b8('0x1f'));_0x4aefca(_0x45ec2b[_0x74b8('0x26')][_0x74b8('0x25')]);}})[_0x74b8('0x27')](function(_0x38a9a4){logger['error']('OpenchannelMessage,\x20%s,\x20%s',_0x136a0b,_0x38a9a4);_0x1e17f1(_0x38a9a4);});});}function respondWithStatusCode(_0x2662a7,_0x1b2ecc){_0x1b2ecc=_0x1b2ecc||0xcc;return function(_0x44934f){if(_0x44934f){return _0x2662a7[_0x74b8('0x28')](_0x1b2ecc);}return _0x2662a7[_0x74b8('0x29')](_0x1b2ecc)[_0x74b8('0x2a')]();};}function respondWithResult(_0x34e583,_0x26a27a){_0x26a27a=_0x26a27a||0xc8;return function(_0x1ed415){if(_0x1ed415){return _0x34e583['status'](_0x26a27a)['json'](_0x1ed415);}};}function respondWithFilteredResult(_0x205607,_0x3db641){return function(_0x568cc1){if(_0x568cc1){var _0x4a18b6=typeof _0x3db641[_0x74b8('0x2b')]===_0x74b8('0x2c')&&typeof _0x3db641[_0x74b8('0x2d')]===_0x74b8('0x2c');var _0x1d09cf=_0x568cc1['count'];var _0x286e4e=_0x4a18b6?0x0:_0x3db641[_0x74b8('0x2b')];var _0x47eee6=_0x4a18b6?_0x568cc1[_0x74b8('0x2e')]:_0x3db641['offset']+_0x3db641[_0x74b8('0x2d')];var _0x413c55;if(_0x47eee6>=_0x1d09cf){_0x47eee6=_0x1d09cf;_0x413c55=0xc8;}else{_0x413c55=0xce;}_0x205607['status'](_0x413c55);return _0x205607['set']('Content-Range',_0x286e4e+'-'+_0x47eee6+'/'+_0x1d09cf)['json'](_0x568cc1);}return null;};}function patchUpdates(_0x47598d){return function(_0x5a997b){try{jsonpatch[_0x74b8('0x2f')](_0x5a997b,_0x47598d,!![]);}catch(_0x5ebd92){return BPromise[_0x74b8('0x30')](_0x5ebd92);}return _0x5a997b['save']();};}function saveUpdates(_0x686cb7,_0x45223d){return function(_0x4dcd00){if(_0x4dcd00){return _0x4dcd00[_0x74b8('0x31')](_0x686cb7)[_0x74b8('0x32')](function(_0x4a9143){return _0x4a9143;});}return null;};}function removeEntity(_0xf37f99,_0x41c0c9){return function(_0x47065a){if(_0x47065a){return _0x47065a[_0x74b8('0x33')]()[_0x74b8('0x32')](function(){_0xf37f99[_0x74b8('0x29')](0xcc)[_0x74b8('0x2a')]();});}};}function handleEntityNotFound(_0x27c7d3,_0x414e6b){return function(_0x57ddd1){if(!_0x57ddd1){_0x27c7d3[_0x74b8('0x28')](0x194);}return _0x57ddd1;};}function handleError(_0x2f008f,_0x556f6b){_0x556f6b=_0x556f6b||0x1f4;return function(_0xc74bbf){logger[_0x74b8('0x23')](_0xc74bbf[_0x74b8('0x34')]);if(_0xc74bbf[_0x74b8('0x35')]){delete _0xc74bbf[_0x74b8('0x35')];}_0x2f008f['status'](_0x556f6b)['send'](_0xc74bbf);};}exports['index']=function(_0x317d08,_0x260e86){var _0x4aa6ba={},_0x297d47={},_0xae645f={'count':0x0,'rows':[]};var _0x582e64=_['map'](db['OpenchannelMessage'][_0x74b8('0x36')],function(_0x1d86cc){return{'name':_0x1d86cc[_0x74b8('0x37')],'type':_0x1d86cc[_0x74b8('0x38')][_0x74b8('0x39')]};});_0x297d47[_0x74b8('0x3a')]=_[_0x74b8('0x3b')](_0x582e64,_0x74b8('0x35'));_0x297d47[_0x74b8('0x3c')]=_['keys'](_0x317d08[_0x74b8('0x3c')]);_0x297d47[_0x74b8('0x3d')]=_[_0x74b8('0x3e')](_0x297d47[_0x74b8('0x3a')],_0x297d47[_0x74b8('0x3c')]);_0x4aa6ba['attributes']=_[_0x74b8('0x3e')](_0x297d47[_0x74b8('0x3a')],qs[_0x74b8('0x3f')](_0x317d08['query'][_0x74b8('0x3f')]));_0x4aa6ba[_0x74b8('0x40')]=_0x4aa6ba['attributes'][_0x74b8('0x41')]?_0x4aa6ba[_0x74b8('0x40')]:_0x297d47[_0x74b8('0x3a')];if(!_0x317d08['query'][_0x74b8('0x42')]('nolimit')){_0x4aa6ba[_0x74b8('0x2d')]=qs[_0x74b8('0x2d')](_0x317d08[_0x74b8('0x3c')]['limit']);_0x4aa6ba[_0x74b8('0x2b')]=qs[_0x74b8('0x2b')](_0x317d08[_0x74b8('0x3c')][_0x74b8('0x2b')]);}_0x4aa6ba['order']=qs['sort'](_0x317d08[_0x74b8('0x3c')][_0x74b8('0x43')]);_0x4aa6ba[_0x74b8('0x44')]=qs['filters'](_['pick'](_0x317d08[_0x74b8('0x3c')],_0x297d47[_0x74b8('0x3d')]),_0x582e64);if(_0x317d08[_0x74b8('0x3c')]['filter']){_0x4aa6ba['where']=_[_0x74b8('0x45')](_0x4aa6ba['where'],{'$or':_[_0x74b8('0x3b')](_0x582e64,function(_0x509cb2){if(_0x509cb2[_0x74b8('0x38')]!==_0x74b8('0x46')){var _0x33aaf9={};_0x33aaf9[_0x509cb2['name']]={'$like':'%'+_0x317d08[_0x74b8('0x3c')][_0x74b8('0x47')]+'%'};return _0x33aaf9;}})});}_0x4aa6ba=_['merge']({},_0x4aa6ba,_0x317d08['options']);var _0x28ee6a={'where':_0x4aa6ba[_0x74b8('0x44')]};return db[_0x74b8('0x48')][_0x74b8('0x2e')](_0x28ee6a)[_0x74b8('0x32')](function(_0x395543){_0xae645f[_0x74b8('0x2e')]=_0x395543;if(_0x317d08[_0x74b8('0x3c')]['includeAll']){_0x4aa6ba['include']=[{'all':!![]}];}return db[_0x74b8('0x48')]['findAll'](_0x4aa6ba);})['then'](function(_0x2349db){_0xae645f[_0x74b8('0x49')]=_0x2349db;return _0xae645f;})[_0x74b8('0x32')](respondWithFilteredResult(_0x260e86,_0x4aa6ba))[_0x74b8('0x27')](handleError(_0x260e86,null));};exports[_0x74b8('0x4a')]=function(_0x26ebdf,_0x3edb89){var _0xaa155d={'raw':!![],'where':{'id':_0x26ebdf['params']['id']}},_0x341afd={};_0x341afd['model']=_[_0x74b8('0x4b')](db['OpenchannelMessage'][_0x74b8('0x36')]);_0x341afd[_0x74b8('0x3c')]=_[_0x74b8('0x4b')](_0x26ebdf[_0x74b8('0x3c')]);_0x341afd[_0x74b8('0x3d')]=_[_0x74b8('0x3e')](_0x341afd[_0x74b8('0x3a')],_0x341afd['query']);_0xaa155d['attributes']=_[_0x74b8('0x3e')](_0x341afd[_0x74b8('0x3a')],qs[_0x74b8('0x3f')](_0x26ebdf[_0x74b8('0x3c')][_0x74b8('0x3f')]));_0xaa155d[_0x74b8('0x40')]=_0xaa155d[_0x74b8('0x40')][_0x74b8('0x41')]?_0xaa155d[_0x74b8('0x40')]:_0x341afd[_0x74b8('0x3a')];if(_0x26ebdf[_0x74b8('0x3c')]['includeAll']){_0xaa155d[_0x74b8('0x4c')]=[{'all':!![]}];}_0xaa155d=_[_0x74b8('0x45')]({},_0xaa155d,_0x26ebdf[_0x74b8('0x4d')]);return db[_0x74b8('0x48')][_0x74b8('0x4e')](_0xaa155d)[_0x74b8('0x32')](handleEntityNotFound(_0x3edb89,null))[_0x74b8('0x32')](respondWithResult(_0x3edb89,null))['catch'](handleError(_0x3edb89,null));};exports[_0x74b8('0x4f')]=function(_0x4115e7,_0x36e490){return db['OpenchannelMessage'][_0x74b8('0x4f')](_0x4115e7['body'],{})['then'](respondWithResult(_0x36e490,0xc9))[_0x74b8('0x27')](handleError(_0x36e490,null));};exports[_0x74b8('0x31')]=function(_0x571aa3,_0x52d7d3){if(_0x571aa3[_0x74b8('0x50')]['id']){delete _0x571aa3[_0x74b8('0x50')]['id'];}return db['OpenchannelMessage'][_0x74b8('0x4e')]({'where':{'id':_0x571aa3[_0x74b8('0x51')]['id']}})[_0x74b8('0x32')](handleEntityNotFound(_0x52d7d3,null))[_0x74b8('0x32')](saveUpdates(_0x571aa3[_0x74b8('0x50')],null))['then'](respondWithResult(_0x52d7d3,null))[_0x74b8('0x27')](handleError(_0x52d7d3,null));};exports[_0x74b8('0x33')]=function(_0x37f94c,_0x40af95){return db[_0x74b8('0x48')][_0x74b8('0x4e')]({'where':{'id':_0x37f94c[_0x74b8('0x51')]['id']}})[_0x74b8('0x32')](handleEntityNotFound(_0x40af95,null))[_0x74b8('0x32')](removeEntity(_0x40af95,null))[_0x74b8('0x27')](handleError(_0x40af95,null));};exports[_0x74b8('0x52')]=function(_0x20bbf6,_0x2292e7){return db[_0x74b8('0x48')][_0x74b8('0x52')]()[_0x74b8('0x32')](respondWithResult(_0x2292e7,null))[_0x74b8('0x27')](handleError(_0x2292e7,null));};var interaction_log=require(_0x74b8('0x10'))(_0x74b8('0x53'));exports[_0x74b8('0x54')]=function(_0x13cba7,_0x2f8ccc,_0x2f2564){var _0x5603b={'agent':{},'channel':_0x74b8('0x55')};if(_0x13cba7[_0x74b8('0x50')]['id']){delete _0x13cba7[_0x74b8('0x50')]['id'];}_0x13cba7[_0x74b8('0x50')][_0x74b8('0x56')]=!![];_0x13cba7[_0x74b8('0x50')][_0x74b8('0x57')]=moment()[_0x74b8('0x58')]('YYYY-MM-DD\x20HH:mm:ss');_0x13cba7[_0x74b8('0x50')][_0x74b8('0x59')]=_0x13cba7[_0x74b8('0x50')][_0x74b8('0x59')]||_0x13cba7[_0x74b8('0x5a')]['id'];_0x5603b[_0x74b8('0x5b')]['id']=_0x13cba7[_0x74b8('0x50')][_0x74b8('0x59')];return db['OpenchannelMessage'][_0x74b8('0x4e')]({'where':{'id':_0x13cba7[_0x74b8('0x51')]['id'],'UserId':null}})[_0x74b8('0x32')](handleEntityNotFound(_0x2f8ccc,null))[_0x74b8('0x32')](saveUpdates(_0x13cba7['body'],null))['then'](function(_0x433475){if(_0x433475){_0x5603b[_0x74b8('0x25')]=_0x433475[_0x74b8('0x5c')]({'plain':!![]});return db[_0x74b8('0x5d')][_0x74b8('0x4e')]({'where':{'id':_0x433475[_0x74b8('0x5e')]}});}return null;})[_0x74b8('0x32')](handleEntityNotFound(_0x2f8ccc,null))['then'](function(_0x3c6581){if(_0x3c6581){return _0x3c6581[_0x74b8('0x31')]({'UserId':_0x13cba7[_0x74b8('0x50')]['UserId'],'read1stAt':_[_0x74b8('0x5f')](_0x3c6581['read1stAt'])?moment()[_0x74b8('0x58')](_0x74b8('0x60')):undefined});}return null;})[_0x74b8('0x32')](function(_0x8f9a91){if(_0x8f9a91){_0x5603b[_0x74b8('0x61')]=_0x8f9a91[_0x74b8('0x5c')]({'plain':!![]});interaction_log[_0x74b8('0x1d')](_0x74b8('0x62'),_0x13cba7['user']['id'],_0x13cba7[_0x74b8('0x5a')][_0x74b8('0x35')],_0x13cba7[_0x74b8('0x5a')][_0x74b8('0x63')],_0x5603b[_0x74b8('0x61')]['id'],_0x13cba7[_0x74b8('0x50')]?JSON[_0x74b8('0x22')](_0x13cba7['body']):_0x74b8('0x64'));return respondWithRpcPromise(_0x74b8('0x65'),_0x74b8('0x66'),_0x5603b);}return null;})[_0x74b8('0x32')](function(_0x516397){var _0x51f78b=_0x74b8('0x67')+_0x516397[_0x74b8('0x25')][_0x74b8('0x68')];return db[_0x74b8('0x69')][_0x74b8('0x3c')](_0x51f78b,{'type':db[_0x74b8('0x6a')][_0x74b8('0x6b')][_0x74b8('0x6c')],'raw':!![]})['then'](function(_0x168f7c){return _0x168f7c;});})[_0x74b8('0x32')](function(_0x14117f){if(_0x14117f){_0x5603b[_0x74b8('0x25')][_0x74b8('0x6d')]=_0x14117f[0x0];if(!_0x13cba7['body'][_0x74b8('0x59')])return;return db[_0x74b8('0x6e')][_0x74b8('0x4e')]({'where':{'id':_0x13cba7['body'][_0x74b8('0x59')],'role':_0x74b8('0x5b')},'attributes':['id',_0x74b8('0x35'),_0x74b8('0x6f'),_0x74b8('0x70'),_0x74b8('0x71')],'raw':!![]});}return null;})[_0x74b8('0x32')](function(_0x39048a){if(!_0x39048a)return null;_0x5603b[_0x74b8('0x25')][_0x74b8('0x5b')]=_0x39048a;return _0x5603b;})[_0x74b8('0x32')](function(_0x3d2d71){if(_0x3d2d71){if(_0x13cba7[_0x74b8('0x50')]['manual']){_0x5603b['message'][_0x74b8('0x72')]=util[_0x74b8('0x58')](_0x74b8('0x73'),_0x13cba7[_0x74b8('0x5a')][_0x74b8('0x35')]);_0x5603b[_0x74b8('0x25')][_0x74b8('0x74')]=_0x5603b[_0x74b8('0x74')];_0x5603b[_0x74b8('0x25')][_0x74b8('0x75')]=_0x5603b['channel'];_0x5603b['message'][_0x74b8('0x76')]=_0x74b8('0x54');return respondWithRpcPromise(_0x74b8('0x77'),_0x74b8('0x77'),{'event':_0x74b8('0x78'),'message':_0x5603b[_0x74b8('0x25')]},client9002)['then'](function(){return _0x5603b;});}return _0x5603b;}return null;})['then'](respondWithResult(_0x2f8ccc,null))['catch'](handleError(_0x2f8ccc,null));};var interaction_log=require(_0x74b8('0x10'))(_0x74b8('0x53'));exports[_0x74b8('0x30')]=function(_0x6f617c,_0x4cf1f5,_0x563396){var _0x130ffa={'agent':{},'channel':_0x74b8('0x55')};if(_0x6f617c['body']['id']){delete _0x6f617c[_0x74b8('0x50')]['id'];}_0x6f617c[_0x74b8('0x50')]['UserId']=_0x6f617c[_0x74b8('0x50')][_0x74b8('0x59')]||_0x6f617c[_0x74b8('0x5a')]['id'];_0x130ffa[_0x74b8('0x5b')]['id']=_0x6f617c[_0x74b8('0x50')][_0x74b8('0x59')];return db[_0x74b8('0x48')]['find']({'where':{'id':_0x6f617c[_0x74b8('0x51')]['id'],'UserId':null}})['then'](handleEntityNotFound(_0x4cf1f5,null))['then'](function(_0x36c745){if(_0x36c745){_0x130ffa[_0x74b8('0x25')]=_0x36c745[_0x74b8('0x5c')]({'plain':!![]});return db[_0x74b8('0x5d')]['find']({'where':{'id':_0x36c745[_0x74b8('0x5e')]}});}return null;})[_0x74b8('0x32')](handleEntityNotFound(_0x4cf1f5,null))[_0x74b8('0x32')](function(_0x58a493){if(_0x58a493){_0x130ffa[_0x74b8('0x61')]=_0x58a493[_0x74b8('0x5c')]({'plain':!![]});interaction_log[_0x74b8('0x1d')]('[OPENCHANNELMESSAGE:REJECT]\x20id=%s\x20name=%s\x20role=%s\x20interaction=%s\x20body=%s',_0x6f617c['user']['id'],_0x6f617c[_0x74b8('0x5a')][_0x74b8('0x35')],_0x6f617c[_0x74b8('0x5a')][_0x74b8('0x63')],_0x130ffa[_0x74b8('0x61')]['id'],_0x6f617c[_0x74b8('0x50')]?JSON['stringify'](_0x6f617c['body']):_0x74b8('0x64'));return respondWithRpcPromise(_0x74b8('0x79'),_0x74b8('0x7a'),_0x130ffa);}return null;})[_0x74b8('0x32')](function(_0x4a884e){var _0x58acac='SELECT\x20*\x20FROM\x20cm_contacts\x20WHERE\x20id\x20=\x20'+_0x4a884e[_0x74b8('0x25')][_0x74b8('0x68')];return db[_0x74b8('0x69')]['query'](_0x58acac,{'type':db[_0x74b8('0x6a')][_0x74b8('0x6b')][_0x74b8('0x6c')],'raw':!![]})['then'](function(_0x3aacd6){return _0x3aacd6;});})[_0x74b8('0x32')](function(_0x59c7e1){if(_0x59c7e1){_0x130ffa['message'][_0x74b8('0x6d')]=_0x59c7e1[0x0];if(!_0x6f617c[_0x74b8('0x50')][_0x74b8('0x59')])return;return db[_0x74b8('0x6e')][_0x74b8('0x4e')]({'where':{'id':_0x6f617c[_0x74b8('0x50')]['UserId'],'role':_0x74b8('0x5b')},'attributes':['id','name','fullname','email',_0x74b8('0x71')],'raw':!![]});}return null;})[_0x74b8('0x32')](function(_0x3ef4b7){if(!_0x3ef4b7)return null;_0x130ffa[_0x74b8('0x25')][_0x74b8('0x5b')]=_0x3ef4b7;return _0x130ffa;})[_0x74b8('0x32')](function(_0x2e9f32){if(_0x2e9f32){_0x2e9f32[_0x74b8('0x25')][_0x74b8('0x72')]=util[_0x74b8('0x58')](_0x74b8('0x73'),_0x6f617c[_0x74b8('0x5a')][_0x74b8('0x35')]);_0x2e9f32[_0x74b8('0x25')][_0x74b8('0x74')]=_0x130ffa[_0x74b8('0x74')];_0x2e9f32['message'][_0x74b8('0x75')]=_0x130ffa[_0x74b8('0x74')];_0x2e9f32[_0x74b8('0x25')][_0x74b8('0x76')]='reject';respondWithRpcPromise(_0x74b8('0x77'),_0x74b8('0x77'),{'event':_0x74b8('0x7b'),'message':_0x2e9f32[_0x74b8('0x25')]},client9002);return _0x130ffa;}return null;})[_0x74b8('0x32')](respondWithResult(_0x4cf1f5,null))['catch'](handleError(_0x4cf1f5,null));}; \ No newline at end of file +var _0x58d3=['message','sendStatus','end','offset','limit','undefined','count','status','set','Content-Range','json','reject','save','update','destroy','stack','name','send','index','map','OpenchannelMessage','rawAttributes','fieldName','key','model','query','keys','filters','intersection','attributes','fields','length','hasOwnProperty','nolimit','sort','where','pick','merge','type','VIRTUAL','include','catch','show','params','includeAll','options','find','create','body','describe','openchannel-interactions','accept','openchannel','read','YYYY-MM-DD\x20HH:mm:ss','UserId','agent','get','OpenchannelInteraction','OpenchannelInteractionId','format','[OPENCHANNELMESSAGE:ACCEPT]\x20id=%s\x20name=%s\x20role=%s\x20interaction=%s\x20body=%s','user','role','interaction','null','AcceptMessage','acceptMessage','SELECT\x20*\x20FROM\x20cm_contacts\x20WHERE\x20id\x20=\x20','sequelize','QueryTypes','SELECT','contact','User','email','internal','interface','channel','motionChannel','EventManager','[OPENCHANNELMESSAGE:REJECT]\x20id=%s\x20name=%s\x20role=%s\x20interaction=%s\x20body=%s','stringify','RejectMessage','rejectMessage','Sequelize','SIP/%s','event','rejectmessage','fast-json-patch','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/environment','redis','defaults','./openchannelMessage.socket','client','http','request','then','info','OpenchannelMessage,\x20%s,\x20%s','request\x20sent','OpenchannelMessage,\x20%s,\x20%s,\x20%s','error','code'];(function(_0x3674db,_0x2026e6){var _0x32a344=function(_0x460941){while(--_0x460941){_0x3674db['push'](_0x3674db['shift']());}};_0x32a344(++_0x2026e6);}(_0x58d3,0xd4));var _0x358d=function(_0x36eacf,_0x1669ee){_0x36eacf=_0x36eacf-0x0;var _0xad3a8a=_0x58d3[_0x36eacf];return _0xad3a8a;};'use strict';var emlformat=require('eml-format');var rimraf=require('rimraf');var zipdir=require('zip-dir');var jsonpatch=require(_0x358d('0x0'));var rp=require('request-promise');var moment=require('moment');var BPromise=require('bluebird');var Mustache=require(_0x358d('0x1'));var util=require(_0x358d('0x2'));var path=require(_0x358d('0x3'));var sox=require(_0x358d('0x4'));var csv=require(_0x358d('0x5'));var ejs=require(_0x358d('0x6'));var fs=require('fs');var fs_extra=require(_0x358d('0x7'));var _=require(_0x358d('0x8'));var squel=require(_0x358d('0x9'));var crypto=require(_0x358d('0xa'));var jsforce=require('jsforce');var deskjs=require(_0x358d('0xb'));var toCsv=require('to-csv');var querystring=require(_0x358d('0xc'));var Papa=require(_0x358d('0xd'));var Redis=require(_0x358d('0xe'));var authService=require(_0x358d('0xf'));var qs=require(_0x358d('0x10'));var as=require(_0x358d('0x11'));var hardwareService=require(_0x358d('0x12'));var logger=require(_0x358d('0x13'))(_0x358d('0x14'));var utils=require(_0x358d('0x15'));var config=require(_0x358d('0x16'));var licenseUtil=require('../../config/license/util');var db=require('../../mysqldb')['db'];config[_0x358d('0x17')]=_[_0x358d('0x18')](config[_0x358d('0x17')],{'host':'localhost','port':0x18eb});var socket=require('socket.io-emitter')(new Redis(config['redis']));require(_0x358d('0x19'))['register'](socket);var jayson=require('jayson/promise');var client=jayson[_0x358d('0x1a')][_0x358d('0x1b')]({'port':0x232c});var client9002=jayson[_0x358d('0x1a')][_0x358d('0x1b')]({'port':0x232a});function respondWithRpcPromise(_0x52f32b,_0x3f566e,_0x198481,_0x25a720){return new BPromise(function(_0x51103a,_0x19b014){var _0x123732=_0x25a720||client;return _0x123732[_0x358d('0x1c')](_0x52f32b,_0x198481)[_0x358d('0x1d')](function(_0x56f74b){logger[_0x358d('0x1e')](_0x358d('0x1f'),_0x3f566e,_0x358d('0x20'));logger['debug'](_0x358d('0x21'),_0x3f566e,'request\x20sent',JSON['stringify'](_0x56f74b));if(_0x56f74b[_0x358d('0x22')]){if(_0x56f74b[_0x358d('0x22')][_0x358d('0x23')]===0x1f4){logger[_0x358d('0x22')]('OpenchannelMessage,\x20%s,\x20%s',_0x3f566e,_0x56f74b[_0x358d('0x22')][_0x358d('0x24')]);return _0x19b014(_0x56f74b['error'][_0x358d('0x24')]);}logger[_0x358d('0x22')]('OpenchannelMessage,\x20%s,\x20%s',_0x3f566e,_0x56f74b['error'][_0x358d('0x24')]);return _0x51103a(_0x56f74b[_0x358d('0x22')][_0x358d('0x24')]);}else{logger[_0x358d('0x1e')]('OpenchannelMessage,\x20%s,\x20%s',_0x3f566e,_0x358d('0x20'));_0x51103a(_0x56f74b['result'][_0x358d('0x24')]);}})['catch'](function(_0xf1f7){logger[_0x358d('0x22')]('OpenchannelMessage,\x20%s,\x20%s',_0x3f566e,_0xf1f7);_0x19b014(_0xf1f7);});});}function respondWithStatusCode(_0xa92743,_0x1bc380){_0x1bc380=_0x1bc380||0xcc;return function(_0x385955){if(_0x385955){return _0xa92743[_0x358d('0x25')](_0x1bc380);}return _0xa92743['status'](_0x1bc380)[_0x358d('0x26')]();};}function respondWithResult(_0x30494a,_0x120aff){_0x120aff=_0x120aff||0xc8;return function(_0x337019){if(_0x337019){return _0x30494a['status'](_0x120aff)['json'](_0x337019);}};}function respondWithFilteredResult(_0x28606d,_0x9f9e9b){return function(_0x68e158){if(_0x68e158){var _0x146fbb=typeof _0x9f9e9b[_0x358d('0x27')]==='undefined'&&typeof _0x9f9e9b[_0x358d('0x28')]===_0x358d('0x29');var _0x12d76e=_0x68e158[_0x358d('0x2a')];var _0x678fdd=_0x146fbb?0x0:_0x9f9e9b[_0x358d('0x27')];var _0x448885=_0x146fbb?_0x68e158[_0x358d('0x2a')]:_0x9f9e9b[_0x358d('0x27')]+_0x9f9e9b[_0x358d('0x28')];var _0x35fc31;if(_0x448885>=_0x12d76e){_0x448885=_0x12d76e;_0x35fc31=0xc8;}else{_0x35fc31=0xce;}_0x28606d[_0x358d('0x2b')](_0x35fc31);return _0x28606d[_0x358d('0x2c')](_0x358d('0x2d'),_0x678fdd+'-'+_0x448885+'/'+_0x12d76e)[_0x358d('0x2e')](_0x68e158);}return null;};}function patchUpdates(_0x51e566){return function(_0x1a3648){try{jsonpatch['apply'](_0x1a3648,_0x51e566,!![]);}catch(_0x3c5d29){return BPromise[_0x358d('0x2f')](_0x3c5d29);}return _0x1a3648[_0x358d('0x30')]();};}function saveUpdates(_0x57b3fe,_0x2128d8){return function(_0x383645){if(_0x383645){return _0x383645[_0x358d('0x31')](_0x57b3fe)[_0x358d('0x1d')](function(_0xa50ed2){return _0xa50ed2;});}return null;};}function removeEntity(_0x8d98bb,_0x372106){return function(_0x349c54){if(_0x349c54){return _0x349c54[_0x358d('0x32')]()[_0x358d('0x1d')](function(){_0x8d98bb['status'](0xcc)['end']();});}};}function handleEntityNotFound(_0xece0b5,_0x31e739){return function(_0xd3b6e2){if(!_0xd3b6e2){_0xece0b5[_0x358d('0x25')](0x194);}return _0xd3b6e2;};}function handleError(_0x4c8e33,_0x401084){_0x401084=_0x401084||0x1f4;return function(_0x4d3ac6){logger['error'](_0x4d3ac6[_0x358d('0x33')]);if(_0x4d3ac6['name']){delete _0x4d3ac6[_0x358d('0x34')];}_0x4c8e33[_0x358d('0x2b')](_0x401084)[_0x358d('0x35')](_0x4d3ac6);};}exports[_0x358d('0x36')]=function(_0x40adb3,_0x5082e3){var _0x2d9c3b={},_0x4edf9e={},_0x2c9994={'count':0x0,'rows':[]};var _0xd8fdf4=_[_0x358d('0x37')](db[_0x358d('0x38')][_0x358d('0x39')],function(_0x505b41){return{'name':_0x505b41[_0x358d('0x3a')],'type':_0x505b41['type'][_0x358d('0x3b')]};});_0x4edf9e[_0x358d('0x3c')]=_[_0x358d('0x37')](_0xd8fdf4,_0x358d('0x34'));_0x4edf9e[_0x358d('0x3d')]=_[_0x358d('0x3e')](_0x40adb3['query']);_0x4edf9e[_0x358d('0x3f')]=_[_0x358d('0x40')](_0x4edf9e[_0x358d('0x3c')],_0x4edf9e[_0x358d('0x3d')]);_0x2d9c3b[_0x358d('0x41')]=_[_0x358d('0x40')](_0x4edf9e[_0x358d('0x3c')],qs[_0x358d('0x42')](_0x40adb3[_0x358d('0x3d')][_0x358d('0x42')]));_0x2d9c3b[_0x358d('0x41')]=_0x2d9c3b['attributes'][_0x358d('0x43')]?_0x2d9c3b[_0x358d('0x41')]:_0x4edf9e[_0x358d('0x3c')];if(!_0x40adb3[_0x358d('0x3d')][_0x358d('0x44')](_0x358d('0x45'))){_0x2d9c3b[_0x358d('0x28')]=qs[_0x358d('0x28')](_0x40adb3[_0x358d('0x3d')][_0x358d('0x28')]);_0x2d9c3b[_0x358d('0x27')]=qs['offset'](_0x40adb3[_0x358d('0x3d')][_0x358d('0x27')]);}_0x2d9c3b['order']=qs[_0x358d('0x46')](_0x40adb3[_0x358d('0x3d')]['sort']);_0x2d9c3b[_0x358d('0x47')]=qs[_0x358d('0x3f')](_[_0x358d('0x48')](_0x40adb3['query'],_0x4edf9e['filters']),_0xd8fdf4);if(_0x40adb3[_0x358d('0x3d')]['filter']){_0x2d9c3b['where']=_[_0x358d('0x49')](_0x2d9c3b[_0x358d('0x47')],{'$or':_[_0x358d('0x37')](_0xd8fdf4,function(_0x246107){if(_0x246107[_0x358d('0x4a')]!==_0x358d('0x4b')){var _0x1b5ae9={};_0x1b5ae9[_0x246107[_0x358d('0x34')]]={'$like':'%'+_0x40adb3[_0x358d('0x3d')]['filter']+'%'};return _0x1b5ae9;}})});}_0x2d9c3b=_[_0x358d('0x49')]({},_0x2d9c3b,_0x40adb3['options']);var _0x21f29a={'where':_0x2d9c3b[_0x358d('0x47')]};return db[_0x358d('0x38')][_0x358d('0x2a')](_0x21f29a)['then'](function(_0x50714c){_0x2c9994[_0x358d('0x2a')]=_0x50714c;if(_0x40adb3[_0x358d('0x3d')]['includeAll']){_0x2d9c3b[_0x358d('0x4c')]=[{'all':!![]}];}return db[_0x358d('0x38')]['findAll'](_0x2d9c3b);})[_0x358d('0x1d')](function(_0x3aee43){_0x2c9994['rows']=_0x3aee43;return _0x2c9994;})[_0x358d('0x1d')](respondWithFilteredResult(_0x5082e3,_0x2d9c3b))[_0x358d('0x4d')](handleError(_0x5082e3,null));};exports[_0x358d('0x4e')]=function(_0x286e12,_0x451a86){var _0xb61db1={'raw':!![],'where':{'id':_0x286e12[_0x358d('0x4f')]['id']}},_0x208773={};_0x208773[_0x358d('0x3c')]=_[_0x358d('0x3e')](db[_0x358d('0x38')]['rawAttributes']);_0x208773[_0x358d('0x3d')]=_[_0x358d('0x3e')](_0x286e12[_0x358d('0x3d')]);_0x208773[_0x358d('0x3f')]=_[_0x358d('0x40')](_0x208773[_0x358d('0x3c')],_0x208773[_0x358d('0x3d')]);_0xb61db1['attributes']=_[_0x358d('0x40')](_0x208773[_0x358d('0x3c')],qs[_0x358d('0x42')](_0x286e12[_0x358d('0x3d')][_0x358d('0x42')]));_0xb61db1[_0x358d('0x41')]=_0xb61db1['attributes'][_0x358d('0x43')]?_0xb61db1[_0x358d('0x41')]:_0x208773['model'];if(_0x286e12[_0x358d('0x3d')][_0x358d('0x50')]){_0xb61db1['include']=[{'all':!![]}];}_0xb61db1=_[_0x358d('0x49')]({},_0xb61db1,_0x286e12[_0x358d('0x51')]);return db[_0x358d('0x38')][_0x358d('0x52')](_0xb61db1)[_0x358d('0x1d')](handleEntityNotFound(_0x451a86,null))[_0x358d('0x1d')](respondWithResult(_0x451a86,null))[_0x358d('0x4d')](handleError(_0x451a86,null));};exports[_0x358d('0x53')]=function(_0x221ecd,_0x1bde15){return db[_0x358d('0x38')][_0x358d('0x53')](_0x221ecd[_0x358d('0x54')],{})[_0x358d('0x1d')](respondWithResult(_0x1bde15,0xc9))[_0x358d('0x4d')](handleError(_0x1bde15,null));};exports[_0x358d('0x31')]=function(_0x4fa341,_0xe710cf){if(_0x4fa341[_0x358d('0x54')]['id']){delete _0x4fa341[_0x358d('0x54')]['id'];}return db[_0x358d('0x38')][_0x358d('0x52')]({'where':{'id':_0x4fa341[_0x358d('0x4f')]['id']}})[_0x358d('0x1d')](handleEntityNotFound(_0xe710cf,null))['then'](saveUpdates(_0x4fa341['body'],null))[_0x358d('0x1d')](respondWithResult(_0xe710cf,null))[_0x358d('0x4d')](handleError(_0xe710cf,null));};exports[_0x358d('0x32')]=function(_0xa9586,_0x27b42c){return db[_0x358d('0x38')][_0x358d('0x52')]({'where':{'id':_0xa9586[_0x358d('0x4f')]['id']}})[_0x358d('0x1d')](handleEntityNotFound(_0x27b42c,null))['then'](removeEntity(_0x27b42c,null))[_0x358d('0x4d')](handleError(_0x27b42c,null));};exports['describe']=function(_0x311426,_0x5333af){return db[_0x358d('0x38')][_0x358d('0x55')]()[_0x358d('0x1d')](respondWithResult(_0x5333af,null))[_0x358d('0x4d')](handleError(_0x5333af,null));};var interaction_log=require(_0x358d('0x13'))(_0x358d('0x56'));exports[_0x358d('0x57')]=function(_0x639e61,_0x83b043,_0x12d18d){var _0x5cb233={'agent':{},'channel':_0x358d('0x58')};if(_0x639e61[_0x358d('0x54')]['id']){delete _0x639e61[_0x358d('0x54')]['id'];}_0x639e61[_0x358d('0x54')][_0x358d('0x59')]=!![];_0x639e61[_0x358d('0x54')]['readAt']=moment()['format'](_0x358d('0x5a'));_0x639e61['body'][_0x358d('0x5b')]=_0x639e61[_0x358d('0x54')][_0x358d('0x5b')]||_0x639e61['user']['id'];_0x5cb233[_0x358d('0x5c')]['id']=_0x639e61['body'][_0x358d('0x5b')];return db[_0x358d('0x38')][_0x358d('0x52')]({'where':{'id':_0x639e61[_0x358d('0x4f')]['id'],'UserId':null}})[_0x358d('0x1d')](handleEntityNotFound(_0x83b043,null))['then'](saveUpdates(_0x639e61[_0x358d('0x54')],null))[_0x358d('0x1d')](function(_0x553db4){if(_0x553db4){_0x5cb233['message']=_0x553db4[_0x358d('0x5d')]({'plain':!![]});return db[_0x358d('0x5e')][_0x358d('0x52')]({'where':{'id':_0x553db4[_0x358d('0x5f')]}});}return null;})[_0x358d('0x1d')](handleEntityNotFound(_0x83b043,null))['then'](function(_0x27ef15){if(_0x27ef15){return _0x27ef15[_0x358d('0x31')]({'UserId':_0x639e61[_0x358d('0x54')]['UserId'],'read1stAt':_['isNil'](_0x27ef15['read1stAt'])?moment()[_0x358d('0x60')]('YYYY-MM-DD\x20HH:mm:ss'):undefined});}return null;})[_0x358d('0x1d')](function(_0x472b93){if(_0x472b93){_0x5cb233['interaction']=_0x472b93[_0x358d('0x5d')]({'plain':!![]});interaction_log[_0x358d('0x1e')](_0x358d('0x61'),_0x639e61[_0x358d('0x62')]['id'],_0x639e61[_0x358d('0x62')][_0x358d('0x34')],_0x639e61['user'][_0x358d('0x63')],_0x5cb233[_0x358d('0x64')]['id'],_0x639e61[_0x358d('0x54')]?JSON['stringify'](_0x639e61[_0x358d('0x54')]):_0x358d('0x65'));return respondWithRpcPromise(_0x358d('0x66'),_0x358d('0x67'),_0x5cb233);}return null;})[_0x358d('0x1d')](function(_0x469a98){var _0x160ee5=_0x358d('0x68')+_0x469a98[_0x358d('0x24')]['ContactId'];return db[_0x358d('0x69')][_0x358d('0x3d')](_0x160ee5,{'type':db['Sequelize'][_0x358d('0x6a')][_0x358d('0x6b')],'raw':!![]})[_0x358d('0x1d')](function(_0xe592b9){return _0xe592b9;});})[_0x358d('0x1d')](function(_0x4ac274){if(_0x4ac274){_0x5cb233[_0x358d('0x24')][_0x358d('0x6c')]=_0x4ac274[0x0];if(!_0x639e61[_0x358d('0x54')]['UserId'])return;return db[_0x358d('0x6d')][_0x358d('0x52')]({'where':{'id':_0x639e61['body'][_0x358d('0x5b')],'role':'agent'},'attributes':['id','name','fullname',_0x358d('0x6e'),_0x358d('0x6f')],'raw':!![]});}return null;})['then'](function(_0x415503){if(!_0x415503)return null;_0x5cb233[_0x358d('0x24')][_0x358d('0x5c')]=_0x415503;return _0x5cb233;})['then'](function(_0x5c1d82){if(_0x5c1d82){if(_0x639e61[_0x358d('0x54')]['manual']){_0x5cb233[_0x358d('0x24')][_0x358d('0x70')]=util[_0x358d('0x60')]('SIP/%s',_0x639e61[_0x358d('0x62')]['name']);_0x5cb233[_0x358d('0x24')][_0x358d('0x71')]=_0x5cb233['channel'];_0x5cb233[_0x358d('0x24')][_0x358d('0x72')]=_0x5cb233[_0x358d('0x71')];_0x5cb233[_0x358d('0x24')]['event']=_0x358d('0x57');return respondWithRpcPromise('EventManager',_0x358d('0x73'),{'event':'acceptmessage','message':_0x5cb233[_0x358d('0x24')]},client9002)[_0x358d('0x1d')](function(){return _0x5cb233;});}return _0x5cb233;}return null;})['then'](respondWithResult(_0x83b043,null))[_0x358d('0x4d')](handleError(_0x83b043,null));};var interaction_log=require(_0x358d('0x13'))(_0x358d('0x56'));exports[_0x358d('0x2f')]=function(_0x17249b,_0x3ec452,_0x2c1f7b){var _0x3d3c06={'agent':{},'channel':_0x358d('0x58')};if(_0x17249b[_0x358d('0x54')]['id']){delete _0x17249b[_0x358d('0x54')]['id'];}_0x17249b[_0x358d('0x54')][_0x358d('0x5b')]=_0x17249b['body'][_0x358d('0x5b')]||_0x17249b['user']['id'];_0x3d3c06['agent']['id']=_0x17249b[_0x358d('0x54')][_0x358d('0x5b')];return db['OpenchannelMessage']['find']({'where':{'id':_0x17249b[_0x358d('0x4f')]['id'],'UserId':null}})[_0x358d('0x1d')](handleEntityNotFound(_0x3ec452,null))[_0x358d('0x1d')](function(_0x4dbfce){if(_0x4dbfce){_0x3d3c06[_0x358d('0x24')]=_0x4dbfce[_0x358d('0x5d')]({'plain':!![]});return db[_0x358d('0x5e')]['find']({'where':{'id':_0x4dbfce['OpenchannelInteractionId']}});}return null;})['then'](handleEntityNotFound(_0x3ec452,null))[_0x358d('0x1d')](function(_0x25233e){if(_0x25233e){_0x3d3c06['interaction']=_0x25233e['get']({'plain':!![]});interaction_log[_0x358d('0x1e')](_0x358d('0x74'),_0x17249b[_0x358d('0x62')]['id'],_0x17249b[_0x358d('0x62')][_0x358d('0x34')],_0x17249b['user'][_0x358d('0x63')],_0x3d3c06[_0x358d('0x64')]['id'],_0x17249b[_0x358d('0x54')]?JSON[_0x358d('0x75')](_0x17249b[_0x358d('0x54')]):_0x358d('0x65'));return respondWithRpcPromise(_0x358d('0x76'),_0x358d('0x77'),_0x3d3c06);}return null;})[_0x358d('0x1d')](function(_0x49cb0e){var _0xc7a9ca=_0x358d('0x68')+_0x49cb0e[_0x358d('0x24')]['ContactId'];return db['sequelize'][_0x358d('0x3d')](_0xc7a9ca,{'type':db[_0x358d('0x78')][_0x358d('0x6a')]['SELECT'],'raw':!![]})[_0x358d('0x1d')](function(_0x4d17f9){return _0x4d17f9;});})[_0x358d('0x1d')](function(_0x5825db){if(_0x5825db){_0x3d3c06[_0x358d('0x24')]['contact']=_0x5825db[0x0];if(!_0x17249b['body']['UserId'])return;return db[_0x358d('0x6d')][_0x358d('0x52')]({'where':{'id':_0x17249b[_0x358d('0x54')][_0x358d('0x5b')],'role':_0x358d('0x5c')},'attributes':['id','name','fullname','email',_0x358d('0x6f')],'raw':!![]});}return null;})[_0x358d('0x1d')](function(_0x265c15){if(!_0x265c15)return null;_0x3d3c06[_0x358d('0x24')][_0x358d('0x5c')]=_0x265c15;return _0x3d3c06;})['then'](function(_0x311611){if(_0x311611){_0x311611[_0x358d('0x24')]['interface']=util[_0x358d('0x60')](_0x358d('0x79'),_0x17249b[_0x358d('0x62')][_0x358d('0x34')]);_0x311611[_0x358d('0x24')][_0x358d('0x71')]=_0x3d3c06[_0x358d('0x71')];_0x311611[_0x358d('0x24')][_0x358d('0x72')]=_0x3d3c06[_0x358d('0x71')];_0x311611[_0x358d('0x24')][_0x358d('0x7a')]=_0x358d('0x2f');respondWithRpcPromise(_0x358d('0x73'),_0x358d('0x73'),{'event':_0x358d('0x7b'),'message':_0x311611[_0x358d('0x24')]},client9002);return _0x3d3c06;}return null;})[_0x358d('0x1d')](respondWithResult(_0x3ec452,null))[_0x358d('0x4d')](handleError(_0x3ec452,null));}; \ No newline at end of file diff --git a/server/api/openchannelMessage/openchannelMessage.events.js b/server/api/openchannelMessage/openchannelMessage.events.js index bec90e1..184cb0b 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 _0xb0ba=['remove','emit','hasOwnProperty','hook','exports','events','../../mysqldb','OpenchannelMessage','setMaxListeners','save','update'];(function(_0x6c993a,_0x5ea3ab){var _0x27f547=function(_0x22df20){while(--_0x22df20){_0x6c993a['push'](_0x6c993a['shift']());}};_0x27f547(++_0x5ea3ab);}(_0xb0ba,0x73));var _0xab0b=function(_0x60815f,_0x43bcb1){_0x60815f=_0x60815f-0x0;var _0x509f7e=_0xb0ba[_0x60815f];return _0x509f7e;};'use strict';var EventEmitter=require(_0xab0b('0x0'));var OpenchannelMessage=require(_0xab0b('0x1'))['db'][_0xab0b('0x2')];var OpenchannelMessageEvents=new EventEmitter();OpenchannelMessageEvents[_0xab0b('0x3')](0x0);var events={'afterCreate':_0xab0b('0x4'),'afterUpdate':_0xab0b('0x5'),'afterDestroy':_0xab0b('0x6')};function emitEvent(_0x12ae49){return function(_0x20e170,_0xda3859,_0x5d5925){OpenchannelMessageEvents['emit'](_0x12ae49+':'+_0x20e170['id'],_0x20e170);OpenchannelMessageEvents[_0xab0b('0x7')](_0x12ae49,_0x20e170);_0x5d5925(null);};}for(var e in events){if(events[_0xab0b('0x8')](e)){var event=events[e];OpenchannelMessage[_0xab0b('0x9')](e,emitEvent(event));}}module[_0xab0b('0xa')]=OpenchannelMessageEvents; \ No newline at end of file +var _0xb1fd=['setMaxListeners','save','update','remove','emit','OpenchannelMessage'];(function(_0x44f738,_0x31cd2b){var _0x5f1271=function(_0x55c48f){while(--_0x55c48f){_0x44f738['push'](_0x44f738['shift']());}};_0x5f1271(++_0x31cd2b);}(_0xb1fd,0x18b));var _0xdb1f=function(_0x2a80bd,_0x1511e0){_0x2a80bd=_0x2a80bd-0x0;var _0x1a1592=_0xb1fd[_0x2a80bd];return _0x1a1592;};'use strict';var EventEmitter=require('events');var OpenchannelMessage=require('../../mysqldb')['db'][_0xdb1f('0x0')];var OpenchannelMessageEvents=new EventEmitter();OpenchannelMessageEvents[_0xdb1f('0x1')](0x0);var events={'afterCreate':_0xdb1f('0x2'),'afterUpdate':_0xdb1f('0x3'),'afterDestroy':_0xdb1f('0x4')};function emitEvent(_0x13505e){return function(_0x3e523,_0x574289,_0x18ecca){OpenchannelMessageEvents['emit'](_0x13505e+':'+_0x3e523['id'],_0x3e523);OpenchannelMessageEvents[_0xdb1f('0x5')](_0x13505e,_0x3e523);_0x18ecca(null);};}for(var e in events){if(events['hasOwnProperty'](e)){var event=events[e];OpenchannelMessage['hook'](e,emitEvent(event));}}module['exports']=OpenchannelMessageEvents; \ No newline at end of file diff --git a/server/api/openchannelMessage/openchannelMessage.model.js b/server/api/openchannelMessage/openchannelMessage.model.js index bdfb910..1848ea2 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 _0x3136=['finally','utf8mb4_unicode_ci','lodash','util','../../config/logger','moment','bluebird','request-promise','path','rimraf','../../config/environment','exports','openchannel_messages','fti_openchannel_messages','FULLTEXT','models','get','direction','toLowerCase','isNil','UserId','OpenchannelInteraction','findOne','then','update','catch','error','out','secret','CmContact','describe','OpenchannelAccount','find','OpenchannelAccountId','Interactions','OpenchannelInteractionId','Contact','keys','replyUri','info','OpenchannelMessage,\x20%s,\x20%s','format','Forwarding\x20message\x20%d\x20to\x20%s','length','Interaction','omit','Message\x20%d\x20forwarded\x20to\x20%s','body','threadId','afterCreate','inspect'];(function(_0x5d2ab6,_0x2a0b8c){var _0x3619ae=function(_0x351578){while(--_0x351578){_0x5d2ab6['push'](_0x5d2ab6['shift']());}};_0x3619ae(++_0x2a0b8c);}(_0x3136,0x134));var _0x6313=function(_0x139574,_0x369600){_0x139574=_0x139574-0x0;var _0xe20ac2=_0x3136[_0x139574];return _0xe20ac2;};'use strict';var _=require(_0x6313('0x0'));var util=require(_0x6313('0x1'));var logger=require(_0x6313('0x2'))('api');var moment=require(_0x6313('0x3'));var BPromise=require(_0x6313('0x4'));var rp=require(_0x6313('0x5'));var fs=require('fs');var path=require(_0x6313('0x6'));var rimraf=require(_0x6313('0x7'));var config=require(_0x6313('0x8'));var attributes=require('./openchannelMessage.attributes');module[_0x6313('0x9')]=function(_0x212d1a,_0x25d225){return _0x212d1a['define']('OpenchannelMessage',attributes,{'tableName':_0x6313('0xa'),'paranoid':![],'indexes':[{'name':_0x6313('0xb'),'fields':['body'],'type':_0x6313('0xc')}],'timestamps':!![],'hooks':{'afterCreate':function(_0x449650,_0x209567,_0x485fc3){var _0x3a1697=_0x212d1a[_0x6313('0xd')];var _0x27e69b=_0x449650[_0x6313('0xe')]({'plain':!![]});if(_0x27e69b[_0x6313('0xf')][_0x6313('0x10')]()==='in'||_0x27e69b[_0x6313('0xf')][_0x6313('0x10')]()==='out'&&!_0x27e69b['secret']&&!_[_0x6313('0x11')](_0x27e69b[_0x6313('0x12')])){_0x3a1697[_0x6313('0x13')][_0x6313('0x14')]({'where':{'id':_0x27e69b['OpenchannelInteractionId']}})[_0x6313('0x15')](function(_0x3a1592){if(_0x3a1592){_0x3a1592[_0x6313('0x16')]({'lastMsgAt':_0x27e69b['createdAt'],'lastMsgDirection':_0x27e69b[_0x6313('0xf')]['toLowerCase']()});}})[_0x6313('0x17')](function(_0x254031){console[_0x6313('0x18')](_0x254031);});}if(_0x27e69b[_0x6313('0xf')]===_0x6313('0x19')&&!_0x27e69b[_0x6313('0x1a')]){var _0x523908;_0x3a1697[_0x6313('0x1b')][_0x6313('0x1c')]()['then'](function(_0x5e7ec5){return _0x3a1697[_0x6313('0x1d')][_0x6313('0x1e')]({'where':{'id':_0x27e69b[_0x6313('0x1f')]},'include':[{'model':_0x3a1697[_0x6313('0x13')],'as':_0x6313('0x20'),'where':{'id':_0x27e69b[_0x6313('0x21')]},'limit':0x1,'include':[{'model':_0x3a1697[_0x6313('0x1b')],'as':_0x6313('0x22'),'attributes':_[_0x6313('0x23')](_0x5e7ec5)}]}]});})[_0x6313('0x15')](function(_0x425cfe){_0x523908=_0x425cfe[_0x6313('0xe')]({'plain':!![]});if(_0x523908&&_0x523908[_0x6313('0x24')]){logger[_0x6313('0x25')](_0x6313('0x26'),'afterCreate',util[_0x6313('0x27')](_0x6313('0x28'),_0x27e69b['id'],_0x523908['replyUri']));if(_0x523908['Interactions']&&_0x523908[_0x6313('0x20')][_0x6313('0x29')]){_0x27e69b[_0x6313('0x2a')]=_[_0x6313('0x2b')](_0x523908[_0x6313('0x20')][0x0],_0x6313('0x22'));_0x27e69b[_0x6313('0x22')]=_0x523908['Interactions'][0x0][_0x6313('0x22')];}var _0x209567={'method':'POST','uri':encodeURI(_0x523908[_0x6313('0x24')]),'json':!![],'resolveWithFullResponse':!![]};switch(_0x209567['method']){case'GET':_0x209567['qs']=_0x27e69b;break;case'POST':_0x209567['body']=_0x27e69b;break;}return rp(_0x209567)[_0x6313('0x15')](function(_0x323cd2){logger[_0x6313('0x25')](_0x6313('0x26'),'afterCreate',util[_0x6313('0x27')](_0x6313('0x2c'),_0x27e69b['id'],_0x523908['replyUri']));if(_0x323cd2[_0x6313('0x2d')][_0x6313('0x2e')]&&_0x323cd2[_0x6313('0x2d')][_0x6313('0x2e')]!=_0x27e69b['Interaction']['threadId']){return _0x3a1697[_0x6313('0x13')]['update']({'threadId':_0x323cd2[_0x6313('0x2d')][_0x6313('0x2e')]},{'where':{'id':_0x27e69b[_0x6313('0x2a')]['id']}});}else{return;}})['then'](function(){return _0x449650[_0x6313('0x16')]({'read':!![]});})[_0x6313('0x17')](function(_0x11800a){logger[_0x6313('0x18')](_0x6313('0x26'),_0x6313('0x2f'),util[_0x6313('0x30')](_0x11800a,{'showHidden':![],'depth':null}));_0x485fc3();});}else{_0x485fc3();}})[_0x6313('0x31')](function(){_0x485fc3();});}else{_0x485fc3();}}},'charset':'utf8mb4','collate':_0x6313('0x32')});}; \ No newline at end of file +var _0x07a1=['omit','method','GET','POST','info','format','Message\x20%d\x20forwarded\x20to\x20%s','threadId','Interaction','catch','inspect','utf8mb4','utf8mb4_unicode_ci','util','../../config/logger','api','moment','bluebird','request-promise','path','rimraf','../../config/environment','./openchannelMessage.attributes','exports','define','OpenchannelMessage','openchannel_messages','body','FULLTEXT','get','direction','toLowerCase','out','UserId','OpenchannelInteraction','then','update','createdAt','error','secret','CmContact','Contact','OpenchannelMessage,\x20%s,\x20%s','afterCreate','replyUri','Interactions'];(function(_0x25b9a1,_0x3e141b){var _0x2dff67=function(_0x1d5279){while(--_0x1d5279){_0x25b9a1['push'](_0x25b9a1['shift']());}};_0x2dff67(++_0x3e141b);}(_0x07a1,0x17d));var _0x107a=function(_0x588b85,_0x21d8a9){_0x588b85=_0x588b85-0x0;var _0x36c533=_0x07a1[_0x588b85];return _0x36c533;};'use strict';var _=require('lodash');var util=require(_0x107a('0x0'));var logger=require(_0x107a('0x1'))(_0x107a('0x2'));var moment=require(_0x107a('0x3'));var BPromise=require(_0x107a('0x4'));var rp=require(_0x107a('0x5'));var fs=require('fs');var path=require(_0x107a('0x6'));var rimraf=require(_0x107a('0x7'));var config=require(_0x107a('0x8'));var attributes=require(_0x107a('0x9'));module[_0x107a('0xa')]=function(_0xb68544,_0x392bbf){return _0xb68544[_0x107a('0xb')](_0x107a('0xc'),attributes,{'tableName':_0x107a('0xd'),'paranoid':![],'indexes':[{'name':'fti_openchannel_messages','fields':[_0x107a('0xe')],'type':_0x107a('0xf')}],'timestamps':!![],'hooks':{'afterCreate':function(_0xbd8a17,_0x23934f,_0x55387f){var _0x3c4788=_0xb68544['models'];var _0xad3fce=_0xbd8a17[_0x107a('0x10')]({'plain':!![]});if(_0xad3fce['direction']['toLowerCase']()==='in'||_0xad3fce[_0x107a('0x11')][_0x107a('0x12')]()===_0x107a('0x13')&&!_0xad3fce['secret']&&!_['isNil'](_0xad3fce[_0x107a('0x14')])){_0x3c4788[_0x107a('0x15')]['findOne']({'where':{'id':_0xad3fce['OpenchannelInteractionId']}})[_0x107a('0x16')](function(_0x580a7a){if(_0x580a7a){_0x580a7a[_0x107a('0x17')]({'lastMsgAt':_0xad3fce[_0x107a('0x18')],'lastMsgDirection':_0xad3fce[_0x107a('0x11')][_0x107a('0x12')]()});}})['catch'](function(_0x56dc2d){console[_0x107a('0x19')](_0x56dc2d);});}if(_0xad3fce[_0x107a('0x11')]===_0x107a('0x13')&&!_0xad3fce[_0x107a('0x1a')]){var _0x21e3cc;_0x3c4788[_0x107a('0x1b')]['describe']()['then'](function(_0x35766a){return _0x3c4788['OpenchannelAccount']['find']({'where':{'id':_0xad3fce['OpenchannelAccountId']},'include':[{'model':_0x3c4788['OpenchannelInteraction'],'as':'Interactions','where':{'id':_0xad3fce['OpenchannelInteractionId']},'limit':0x1,'include':[{'model':_0x3c4788[_0x107a('0x1b')],'as':_0x107a('0x1c'),'attributes':_['keys'](_0x35766a)}]}]});})[_0x107a('0x16')](function(_0xe6ac63){_0x21e3cc=_0xe6ac63[_0x107a('0x10')]({'plain':!![]});if(_0x21e3cc&&_0x21e3cc['replyUri']){logger['info'](_0x107a('0x1d'),_0x107a('0x1e'),util['format']('Forwarding\x20message\x20%d\x20to\x20%s',_0xad3fce['id'],_0x21e3cc[_0x107a('0x1f')]));if(_0x21e3cc[_0x107a('0x20')]&&_0x21e3cc[_0x107a('0x20')]['length']){_0xad3fce['Interaction']=_[_0x107a('0x21')](_0x21e3cc[_0x107a('0x20')][0x0],'Contact');_0xad3fce[_0x107a('0x1c')]=_0x21e3cc[_0x107a('0x20')][0x0][_0x107a('0x1c')];}var _0x23934f={'method':'POST','uri':encodeURI(_0x21e3cc['replyUri']),'json':!![],'resolveWithFullResponse':!![]};switch(_0x23934f[_0x107a('0x22')]){case _0x107a('0x23'):_0x23934f['qs']=_0xad3fce;break;case _0x107a('0x24'):_0x23934f[_0x107a('0xe')]=_0xad3fce;break;}return rp(_0x23934f)['then'](function(_0x2185d7){logger[_0x107a('0x25')](_0x107a('0x1d'),_0x107a('0x1e'),util[_0x107a('0x26')](_0x107a('0x27'),_0xad3fce['id'],_0x21e3cc['replyUri']));if(_0x2185d7['body'][_0x107a('0x28')]&&_0x2185d7[_0x107a('0xe')][_0x107a('0x28')]!=_0xad3fce[_0x107a('0x29')][_0x107a('0x28')]){return _0x3c4788[_0x107a('0x15')][_0x107a('0x17')]({'threadId':_0x2185d7[_0x107a('0xe')][_0x107a('0x28')]},{'where':{'id':_0xad3fce['Interaction']['id']}});}else{return;}})[_0x107a('0x16')](function(){return _0xbd8a17[_0x107a('0x17')]({'read':!![]});})[_0x107a('0x2a')](function(_0x130345){logger[_0x107a('0x19')](_0x107a('0x1d'),_0x107a('0x1e'),util[_0x107a('0x2b')](_0x130345,{'showHidden':![],'depth':null}));_0x55387f();});}else{_0x55387f();}})['finally'](function(){_0x55387f();});}else{_0x55387f();}}},'charset':_0x107a('0x2c'),'collate':_0x107a('0x2d')});}; \ No newline at end of file diff --git a/server/api/openchannelMessage/openchannelMessage.rpc.js b/server/api/openchannelMessage/openchannelMessage.rpc.js index 68f4a2e..c584f02 100644 --- a/server/api/openchannelMessage/openchannelMessage.rpc.js +++ b/server/api/openchannelMessage/openchannelMessage.rpc.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x7a54=['../../config/environment','jayson/promise','http','defaults','redis','socket.io-emitter','then','info','OpenchannelMessage,\x20%s,\x20%s','request\x20sent','debug','OpenchannelMessage,\x20%s,\x20%s,\x20%s','stringify','error','code','message','result','catch','CreateOpenchannelMessage','OpenchannelMessage','body','options','lodash','util','moment','randomstring','ioredis','../../config/utils','../../config/logger','rpc'];(function(_0x6c9ae8,_0x1af22c){var _0x3f8a09=function(_0x25f8fa){while(--_0x25f8fa){_0x6c9ae8['push'](_0x6c9ae8['shift']());}};_0x3f8a09(++_0x1af22c);}(_0x7a54,0x106));var _0x47a5=function(_0x239d39,_0xf60b31){_0x239d39=_0x239d39-0x0;var _0x23ad52=_0x7a54[_0x239d39];return _0x23ad52;};'use strict';var _=require(_0x47a5('0x0'));var util=require(_0x47a5('0x1'));var moment=require(_0x47a5('0x2'));var BPromise=require('bluebird');var rs=require(_0x47a5('0x3'));var fs=require('fs');var Redis=require(_0x47a5('0x4'));var db=require('../../mysqldb')['db'];var utils=require(_0x47a5('0x5'));var logger=require(_0x47a5('0x6'))(_0x47a5('0x7'));var config=require(_0x47a5('0x8'));var jayson=require(_0x47a5('0x9'));var client=jayson['client'][_0x47a5('0xa')]({'port':0x232a});config['redis']=_[_0x47a5('0xb')](config[_0x47a5('0xc')],{'host':'localhost','port':0x18eb});var socket=require(_0x47a5('0xd'))(new Redis(config['redis']));require('./openchannelMessage.socket')['register'](socket);function respondWithRpcPromise(_0x2a0e98,_0x2baee7,_0x5e31dd){return new BPromise(function(_0x2eb0dd,_0x49e844){return client['request'](_0x2a0e98,_0x5e31dd)[_0x47a5('0xe')](function(_0x69e4d4){logger[_0x47a5('0xf')](_0x47a5('0x10'),_0x2baee7,_0x47a5('0x11'));logger[_0x47a5('0x12')](_0x47a5('0x13'),_0x2baee7,'request\x20sent',JSON[_0x47a5('0x14')](_0x69e4d4));if(_0x69e4d4[_0x47a5('0x15')]){if(_0x69e4d4[_0x47a5('0x15')][_0x47a5('0x16')]===0x1f4){logger[_0x47a5('0x15')](_0x47a5('0x10'),_0x2baee7,_0x69e4d4[_0x47a5('0x15')][_0x47a5('0x17')]);return _0x49e844(_0x69e4d4['error'][_0x47a5('0x17')]);}logger[_0x47a5('0x15')](_0x47a5('0x10'),_0x2baee7,_0x69e4d4[_0x47a5('0x15')][_0x47a5('0x17')]);return _0x2eb0dd(_0x69e4d4['error']['message']);}else{logger[_0x47a5('0xf')]('OpenchannelMessage,\x20%s,\x20%s',_0x2baee7,'request\x20sent');_0x2eb0dd(_0x69e4d4[_0x47a5('0x18')][_0x47a5('0x17')]);}})[_0x47a5('0x19')](function(_0x1ef371){logger[_0x47a5('0x15')](_0x47a5('0x10'),_0x2baee7,_0x1ef371);_0x49e844(_0x1ef371);});});}exports[_0x47a5('0x1a')]=function(_0xe3c618){var _0x3aed38=this;return new Promise(function(_0x4a9fcb,_0x1570bc){return db[_0x47a5('0x1b')]['create'](_0xe3c618[_0x47a5('0x1c')],{'raw':_0xe3c618[_0x47a5('0x1d')]?_0xe3c618[_0x47a5('0x1d')]['raw']===undefined?!![]:![]:!![]})[_0x47a5('0xe')](function(_0x2f142b){logger[_0x47a5('0xf')](_0x47a5('0x1a'),_0xe3c618);logger['debug'](_0x47a5('0x1a'),_0xe3c618,JSON[_0x47a5('0x14')](_0x2f142b));_0x4a9fcb(_0x2f142b);})['catch'](function(_0x28747d){logger[_0x47a5('0x15')](_0x47a5('0x1a'),_0x28747d[_0x47a5('0x17')],_0xe3c618);_0x1570bc(_0x3aed38[_0x47a5('0x15')](0x1f4,_0x28747d['message']));});});}; \ No newline at end of file +var _0x5f2f=['OpenchannelMessage,\x20%s,\x20%s,\x20%s','stringify','error','code','message','info','result','catch','OpenchannelMessage','create','options','raw','CreateOpenchannelMessage','lodash','util','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/environment','jayson/promise','client','http','redis','defaults','localhost','socket.io-emitter','register','then','OpenchannelMessage,\x20%s,\x20%s','request\x20sent','debug'];(function(_0x210157,_0x277ed6){var _0x26ceb7=function(_0x346782){while(--_0x346782){_0x210157['push'](_0x210157['shift']());}};_0x26ceb7(++_0x277ed6);}(_0x5f2f,0x73));var _0xf5f2=function(_0x501381,_0x4a77e9){_0x501381=_0x501381-0x0;var _0x27e6d4=_0x5f2f[_0x501381];return _0x27e6d4;};'use strict';var _=require(_0xf5f2('0x0'));var util=require(_0xf5f2('0x1'));var moment=require(_0xf5f2('0x2'));var BPromise=require(_0xf5f2('0x3'));var rs=require(_0xf5f2('0x4'));var fs=require('fs');var Redis=require(_0xf5f2('0x5'));var db=require(_0xf5f2('0x6'))['db'];var utils=require(_0xf5f2('0x7'));var logger=require('../../config/logger')('rpc');var config=require(_0xf5f2('0x8'));var jayson=require(_0xf5f2('0x9'));var client=jayson[_0xf5f2('0xa')][_0xf5f2('0xb')]({'port':0x232a});config[_0xf5f2('0xc')]=_[_0xf5f2('0xd')](config['redis'],{'host':_0xf5f2('0xe'),'port':0x18eb});var socket=require(_0xf5f2('0xf'))(new Redis(config[_0xf5f2('0xc')]));require('./openchannelMessage.socket')[_0xf5f2('0x10')](socket);function respondWithRpcPromise(_0x15dd7c,_0x218ae3,_0x4e0e6b){return new BPromise(function(_0x977a59,_0x4ebbbe){return client['request'](_0x15dd7c,_0x4e0e6b)[_0xf5f2('0x11')](function(_0x151aba){logger['info'](_0xf5f2('0x12'),_0x218ae3,_0xf5f2('0x13'));logger[_0xf5f2('0x14')](_0xf5f2('0x15'),_0x218ae3,_0xf5f2('0x13'),JSON[_0xf5f2('0x16')](_0x151aba));if(_0x151aba['error']){if(_0x151aba[_0xf5f2('0x17')][_0xf5f2('0x18')]===0x1f4){logger[_0xf5f2('0x17')](_0xf5f2('0x12'),_0x218ae3,_0x151aba[_0xf5f2('0x17')]['message']);return _0x4ebbbe(_0x151aba[_0xf5f2('0x17')][_0xf5f2('0x19')]);}logger[_0xf5f2('0x17')](_0xf5f2('0x12'),_0x218ae3,_0x151aba[_0xf5f2('0x17')][_0xf5f2('0x19')]);return _0x977a59(_0x151aba[_0xf5f2('0x17')][_0xf5f2('0x19')]);}else{logger[_0xf5f2('0x1a')](_0xf5f2('0x12'),_0x218ae3,_0xf5f2('0x13'));_0x977a59(_0x151aba[_0xf5f2('0x1b')][_0xf5f2('0x19')]);}})[_0xf5f2('0x1c')](function(_0x3cf5ea){logger[_0xf5f2('0x17')](_0xf5f2('0x12'),_0x218ae3,_0x3cf5ea);_0x4ebbbe(_0x3cf5ea);});});}exports['CreateOpenchannelMessage']=function(_0x34706d){var _0x47101e=this;return new Promise(function(_0x49dac2,_0x47acfc){return db[_0xf5f2('0x1d')][_0xf5f2('0x1e')](_0x34706d['body'],{'raw':_0x34706d[_0xf5f2('0x1f')]?_0x34706d[_0xf5f2('0x1f')][_0xf5f2('0x20')]===undefined?!![]:![]:!![]})[_0xf5f2('0x11')](function(_0x36f1cb){logger['info'](_0xf5f2('0x21'),_0x34706d);logger[_0xf5f2('0x14')](_0xf5f2('0x21'),_0x34706d,JSON[_0xf5f2('0x16')](_0x36f1cb));_0x49dac2(_0x36f1cb);})[_0xf5f2('0x1c')](function(_0x5bdf4a){logger['error'](_0xf5f2('0x21'),_0x5bdf4a[_0xf5f2('0x19')],_0x34706d);_0x47acfc(_0x47101e[_0xf5f2('0x17')](0x1f4,_0x5bdf4a[_0xf5f2('0x19')]));});});}; \ No newline at end of file diff --git a/server/api/openchannelMessage/openchannelMessage.socket.js b/server/api/openchannelMessage/openchannelMessage.socket.js index 94c01dd..581067d 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 _0x30cb=['save','remove','emit','register','./openchannelMessage.events'];(function(_0x26d46b,_0x1c113e){var _0xe37ef1=function(_0x18b155){while(--_0x18b155){_0x26d46b['push'](_0x26d46b['shift']());}};_0xe37ef1(++_0x1c113e);}(_0x30cb,0xb8));var _0xb30c=function(_0x13282b,_0x327836){_0x13282b=_0x13282b-0x0;var _0x1d7c1d=_0x30cb[_0x13282b];return _0x1d7c1d;};'use strict';var OpenchannelMessageEvents=require(_0xb30c('0x0'));var events=[_0xb30c('0x1'),_0xb30c('0x2'),'update'];function createListener(_0x1d5d82,_0x422f28){return function(_0x2e4089){_0x422f28[_0xb30c('0x3')](_0x1d5d82,_0x2e4089);};}function removeListener(_0x59ea6f,_0x3b0a0b){return function(){OpenchannelMessageEvents['removeListener'](_0x59ea6f,_0x3b0a0b);};}exports[_0xb30c('0x4')]=function(_0x12f3f5){for(var _0x5e3bc7=0x0,_0x1f0614=events['length'];_0x5e3bc7<_0x1f0614;_0x5e3bc7++){var _0x27c524=events[_0x5e3bc7];var _0x141279=createListener('openchannelMessage:'+_0x27c524,_0x12f3f5);OpenchannelMessageEvents['on'](_0x27c524,_0x141279);}}; \ No newline at end of file +var _0x4a9c=['register','length','openchannelMessage:','./openchannelMessage.events','save','remove','update','emit'];(function(_0x39728a,_0x1eb7f9){var _0x15f525=function(_0x3e0676){while(--_0x3e0676){_0x39728a['push'](_0x39728a['shift']());}};_0x15f525(++_0x1eb7f9);}(_0x4a9c,0x1d3));var _0xc4a9=function(_0x535fa2,_0x59346a){_0x535fa2=_0x535fa2-0x0;var _0x4b2d2f=_0x4a9c[_0x535fa2];return _0x4b2d2f;};'use strict';var OpenchannelMessageEvents=require(_0xc4a9('0x0'));var events=[_0xc4a9('0x1'),_0xc4a9('0x2'),_0xc4a9('0x3')];function createListener(_0x355736,_0x5d824d){return function(_0x30649e){_0x5d824d[_0xc4a9('0x4')](_0x355736,_0x30649e);};}function removeListener(_0x20db97,_0x6952ec){return function(){OpenchannelMessageEvents['removeListener'](_0x20db97,_0x6952ec);};}exports[_0xc4a9('0x5')]=function(_0x566b43){for(var _0x49fb79=0x0,_0x217d74=events[_0xc4a9('0x6')];_0x49fb79<_0x217d74;_0x49fb79++){var _0x173b4b=events[_0x49fb79];var _0x49dbab=createListener(_0xc4a9('0x7')+_0x173b4b,_0x566b43);OpenchannelMessageEvents['on'](_0x173b4b,_0x49dbab);}}; \ No newline at end of file diff --git a/server/api/openchannelQueue/index.js b/server/api/openchannelQueue/index.js index 9c41966..56c772b 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 _0x0633=['express','Router','fs-extra','../../components/auth/service','../../config/environment','./openchannelQueue.controller','get','isAuthenticated','index','/:id','show','/:id/members','getMembers','/:id/teams','getTeams','/:id/users','getAgents','post','create','addTeams','addAgents','update','delete','destroy','removeTeams','exports','multer','path','connect-timeout'];(function(_0x316931,_0x540814){var _0x1910da=function(_0x49e551){while(--_0x49e551){_0x316931['push'](_0x316931['shift']());}};_0x1910da(++_0x540814);}(_0x0633,0x159));var _0x3063=function(_0x2e6d2d,_0x4519f1){_0x2e6d2d=_0x2e6d2d-0x0;var _0x5adbe5=_0x0633[_0x2e6d2d];return _0x5adbe5;};'use strict';var multer=require(_0x3063('0x0'));var util=require('util');var path=require(_0x3063('0x1'));var timeout=require(_0x3063('0x2'));var express=require(_0x3063('0x3'));var router=express[_0x3063('0x4')]();var fs_extra=require(_0x3063('0x5'));var auth=require(_0x3063('0x6'));var interaction=require('../../components/interaction/service');var config=require(_0x3063('0x7'));var controller=require(_0x3063('0x8'));router[_0x3063('0x9')]('/',auth[_0x3063('0xa')](),controller[_0x3063('0xb')]);router[_0x3063('0x9')]('/describe',auth[_0x3063('0xa')](),controller['describe']);router[_0x3063('0x9')](_0x3063('0xc'),auth[_0x3063('0xa')](),controller[_0x3063('0xd')]);router[_0x3063('0x9')](_0x3063('0xe'),auth['isAuthenticated'](),controller[_0x3063('0xf')]);router[_0x3063('0x9')](_0x3063('0x10'),auth[_0x3063('0xa')](),controller[_0x3063('0x11')]);router['get'](_0x3063('0x12'),auth[_0x3063('0xa')](),controller[_0x3063('0x13')]);router[_0x3063('0x14')]('/',auth[_0x3063('0xa')](),controller[_0x3063('0x15')]);router[_0x3063('0x14')](_0x3063('0x10'),auth[_0x3063('0xa')](),controller[_0x3063('0x16')]);router['post'](_0x3063('0x12'),auth[_0x3063('0xa')](),controller[_0x3063('0x17')]);router['put'](_0x3063('0xc'),auth['isAuthenticated'](),controller[_0x3063('0x18')]);router[_0x3063('0x19')](_0x3063('0xc'),auth[_0x3063('0xa')](),controller[_0x3063('0x1a')]);router['delete'](_0x3063('0x10'),auth[_0x3063('0xa')](),controller[_0x3063('0x1b')]);router[_0x3063('0x19')]('/:id/users',auth[_0x3063('0xa')](),controller['removeAgents']);module[_0x3063('0x1c')]=router; \ No newline at end of file +var _0xfb86=['/:id/teams','getTeams','getAgents','create','post','addTeams','/:id/users','put','/:id','update','destroy','delete','removeAgents','exports','multer','util','path','connect-timeout','express','Router','fs-extra','../../components/interaction/service','../../config/environment','get','isAuthenticated','show','/:id/members','getMembers'];(function(_0x49b4ed,_0x2c3a76){var _0x3b8650=function(_0x53b151){while(--_0x53b151){_0x49b4ed['push'](_0x49b4ed['shift']());}};_0x3b8650(++_0x2c3a76);}(_0xfb86,0xb6));var _0x6fb8=function(_0x348184,_0x1526ba){_0x348184=_0x348184-0x0;var _0x2dfd4f=_0xfb86[_0x348184];return _0x2dfd4f;};'use strict';var multer=require(_0x6fb8('0x0'));var util=require(_0x6fb8('0x1'));var path=require(_0x6fb8('0x2'));var timeout=require(_0x6fb8('0x3'));var express=require(_0x6fb8('0x4'));var router=express[_0x6fb8('0x5')]();var fs_extra=require(_0x6fb8('0x6'));var auth=require('../../components/auth/service');var interaction=require(_0x6fb8('0x7'));var config=require(_0x6fb8('0x8'));var controller=require('./openchannelQueue.controller');router[_0x6fb8('0x9')]('/',auth[_0x6fb8('0xa')](),controller['index']);router[_0x6fb8('0x9')]('/describe',auth[_0x6fb8('0xa')](),controller['describe']);router['get']('/:id',auth[_0x6fb8('0xa')](),controller[_0x6fb8('0xb')]);router[_0x6fb8('0x9')](_0x6fb8('0xc'),auth['isAuthenticated'](),controller[_0x6fb8('0xd')]);router[_0x6fb8('0x9')](_0x6fb8('0xe'),auth[_0x6fb8('0xa')](),controller[_0x6fb8('0xf')]);router[_0x6fb8('0x9')]('/:id/users',auth['isAuthenticated'](),controller[_0x6fb8('0x10')]);router['post']('/',auth['isAuthenticated'](),controller[_0x6fb8('0x11')]);router[_0x6fb8('0x12')]('/:id/teams',auth[_0x6fb8('0xa')](),controller[_0x6fb8('0x13')]);router[_0x6fb8('0x12')](_0x6fb8('0x14'),auth['isAuthenticated'](),controller['addAgents']);router[_0x6fb8('0x15')](_0x6fb8('0x16'),auth['isAuthenticated'](),controller[_0x6fb8('0x17')]);router['delete']('/:id',auth[_0x6fb8('0xa')](),controller[_0x6fb8('0x18')]);router[_0x6fb8('0x19')](_0x6fb8('0xe'),auth['isAuthenticated'](),controller['removeTeams']);router[_0x6fb8('0x19')]('/:id/users',auth[_0x6fb8('0xa')](),controller[_0x6fb8('0x1a')]);module[_0x6fb8('0x1b')]=router; \ No newline at end of file diff --git a/server/api/openchannelQueue/openchannelQueue.attributes.js b/server/api/openchannelQueue/openchannelQueue.attributes.js index 8765091..43e6ff7 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 _0x916e=['roundrobin','STRING','name','INTEGER','ENUM','rrmemory','beepall'];(function(_0x1caf6a,_0x26a5bf){var _0x1bf493=function(_0x3982f5){while(--_0x3982f5){_0x1caf6a['push'](_0x1caf6a['shift']());}};_0x1bf493(++_0x26a5bf);}(_0x916e,0x166));var _0xe916=function(_0x282fe1,_0x537ac6){_0x282fe1=_0x282fe1-0x0;var _0x1ec74e=_0x916e[_0x282fe1];return _0x1ec74e;};'use strict';var Sequelize=require('sequelize');module['exports']={'name':{'type':Sequelize[_0xe916('0x0')],'unique':_0xe916('0x1'),'validate':{'notEmpty':!![],'is':/^[A-Za-z0-9\.\_]+$/i}},'description':{'type':Sequelize[_0xe916('0x0')]},'timeout':{'type':Sequelize[_0xe916('0x2')],'validate':{'min':0x1,'max':0x20c49b}},'strategy':{'type':Sequelize[_0xe916('0x3')](_0xe916('0x4'),_0xe916('0x5'),_0xe916('0x6'))}}; \ No newline at end of file +var _0x251f=['beepall','roundrobin','sequelize','STRING','name','INTEGER','ENUM'];(function(_0x4e4088,_0x14df21){var _0x573fd9=function(_0x55663c){while(--_0x55663c){_0x4e4088['push'](_0x4e4088['shift']());}};_0x573fd9(++_0x14df21);}(_0x251f,0x1d0));var _0xf251=function(_0x7a6aed,_0x335e68){_0x7a6aed=_0x7a6aed-0x0;var _0x9dbabf=_0x251f[_0x7a6aed];return _0x9dbabf;};'use strict';var Sequelize=require(_0xf251('0x0'));module['exports']={'name':{'type':Sequelize[_0xf251('0x1')],'unique':_0xf251('0x2'),'validate':{'notEmpty':!![],'is':/^[A-Za-z0-9\.\_]+$/i}},'description':{'type':Sequelize[_0xf251('0x1')]},'timeout':{'type':Sequelize[_0xf251('0x3')],'validate':{'min':0x1,'max':0x20c49b}},'strategy':{'type':Sequelize[_0xf251('0x4')]('rrmemory',_0xf251('0x5'),_0xf251('0x6'))}}; \ No newline at end of file diff --git a/server/api/openchannelQueue/openchannelQueue.controller.js b/server/api/openchannelQueue/openchannelQueue.controller.js index efecb25..cf269c2 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 _0x23cd=['value','isEmpty','removeAgents','forEach','userOpenchannelQueue:remove','addAgents','omit','spread','getAgents','bluebird','util','lodash','squel','ioredis','api','../../config/environment','../../mysqldb','redis','defaults','localhost','./openchannelQueue.socket','register','sendStatus','status','end','json','offset','undefined','limit','count','set','Content-Range','update','then','destroy','OpenchannelQueues','UserProfileResource','error','send','map','OpenchannelQueue','rawAttributes','fieldName','type','key','getOptions','where','include','findAll','rows','catch','show','params','model','keys','query','filters','intersection','fields','attributes','includeAll','options','find','user','get','Unable\x20to\x20retrieve\x20the\x20current\x20user','role','UserProfileSection','userProfileId','autoAssociation','create','name','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','body','describe','getMembers','findOne','UserOpenchannelQueue','length','hasOwnProperty','nolimit','order','sort','OpenchannelQueueId','filter','merge','User','findAndCountAll','UserId','agent','openchannelPause','updatedAt','createdAt','%s/%s','SIP','getTeams','Team','pick','ids','Agents','interface','flatMap','sequelize','transaction','addTeams','each','findOrCreate','emit','removeTeams','select','field','team_has_openchannel_queues','ut.TeamId\x20=\x20tq.TeamId','OpenchannelQueueId\x20=\x20?','clone','push','toString','QueryTypes','SELECT','every','TeamId','includes','all','union','compact'];(function(_0x1bcbf7,_0x31bf2a){var _0x4aeb5b=function(_0x113ee2){while(--_0x113ee2){_0x1bcbf7['push'](_0x1bcbf7['shift']());}};_0x4aeb5b(++_0x31bf2a);}(_0x23cd,0x86));var _0xd23c=function(_0x3b1fcb,_0x46e9e2){_0x3b1fcb=_0x3b1fcb-0x0;var _0x2afb81=_0x23cd[_0x3b1fcb];return _0x2afb81;};'use strict';var BPromise=require(_0xd23c('0x0'));var util=require(_0xd23c('0x1'));var _=require(_0xd23c('0x2'));var squel=require(_0xd23c('0x3'));var Redis=require(_0xd23c('0x4'));var qs=require('../../components/parsers/qs');var logger=require('../../config/logger')(_0xd23c('0x5'));var config=require(_0xd23c('0x6'));var db=require(_0xd23c('0x7'))['db'];config[_0xd23c('0x8')]=_[_0xd23c('0x9')](config['redis'],{'host':_0xd23c('0xa'),'port':0x18eb});var socket=require('socket.io-emitter')(new Redis(config['redis']));require(_0xd23c('0xb'))[_0xd23c('0xc')](socket);function respondWithStatusCode(_0x4d17cf,_0x565f3a){_0x565f3a=_0x565f3a||0xcc;return function(_0x1efd4d){if(_0x1efd4d){return _0x4d17cf[_0xd23c('0xd')](_0x565f3a);}return _0x4d17cf[_0xd23c('0xe')](_0x565f3a)[_0xd23c('0xf')]();};}function respondWithResult(_0x2ea3b6,_0x202834){_0x202834=_0x202834||0xc8;return function(_0x1d860c){if(_0x1d860c){return _0x2ea3b6[_0xd23c('0xe')](_0x202834)[_0xd23c('0x10')](_0x1d860c);}};}function respondWithFilteredResult(_0xa21f30,_0x57b292){return function(_0xcfa27f){if(_0xcfa27f){var _0x27f9e5=typeof _0x57b292[_0xd23c('0x11')]===_0xd23c('0x12')&&typeof _0x57b292[_0xd23c('0x13')]===_0xd23c('0x12');var _0x10c7b8=_0xcfa27f[_0xd23c('0x14')];var _0x2b932d=_0x27f9e5?0x0:_0x57b292['offset'];var _0x26cd68=_0x27f9e5?_0xcfa27f[_0xd23c('0x14')]:_0x57b292[_0xd23c('0x11')]+_0x57b292[_0xd23c('0x13')];var _0x381d6e;if(_0x26cd68>=_0x10c7b8){_0x26cd68=_0x10c7b8;_0x381d6e=0xc8;}else{_0x381d6e=0xce;}_0xa21f30[_0xd23c('0xe')](_0x381d6e);return _0xa21f30[_0xd23c('0x15')](_0xd23c('0x16'),_0x2b932d+'-'+_0x26cd68+'/'+_0x10c7b8)[_0xd23c('0x10')](_0xcfa27f);}return null;};}function saveUpdates(_0x5a14c2){return function(_0x48ad02){if(_0x48ad02){return _0x48ad02[_0xd23c('0x17')](_0x5a14c2)[_0xd23c('0x18')](function(_0x5f210f){return _0x5f210f;});}return null;};}function removeEntity(_0x4cc4e2){return function(_0x1ef9b5){if(_0x1ef9b5){return _0x1ef9b5[_0xd23c('0x19')]()['then'](function(){var _0x267843=_0x1ef9b5['get']({'plain':!![]});var _0x3d71c6=_0xd23c('0x1a');return db[_0xd23c('0x1b')][_0xd23c('0x19')]({'where':{'type':_0x3d71c6,'resourceId':_0x267843['id']}})[_0xd23c('0x18')](function(){return _0x1ef9b5;});})['then'](function(){_0x4cc4e2[_0xd23c('0xe')](0xcc)[_0xd23c('0xf')]();});}};}function handleEntityNotFound(_0x6c1d61){return function(_0x2d9e69){if(!_0x2d9e69){_0x6c1d61[_0xd23c('0xd')](0x194);}return _0x2d9e69;};}function handleError(_0x208c25,_0x4840d2){_0x4840d2=_0x4840d2||0x1f4;return function(_0x428aa1){logger[_0xd23c('0x1c')](_0x428aa1['stack']);if(_0x428aa1['name']){delete _0x428aa1['name'];}_0x208c25[_0xd23c('0xe')](_0x4840d2)[_0xd23c('0x1d')](_0x428aa1);};}exports['index']=function(_0x17e683,_0xcc84b0){var _0x385f8a={};var _0x4d0066={'count':0x0,'rows':[]};var _0x4229ec=_[_0xd23c('0x1e')](db[_0xd23c('0x1f')][_0xd23c('0x20')],function(_0x5b73a0){return{'name':_0x5b73a0[_0xd23c('0x21')],'type':_0x5b73a0[_0xd23c('0x22')][_0xd23c('0x23')]};});_0x385f8a=qs[_0xd23c('0x24')](_0x4229ec,_0x17e683);var _0x534def={'where':_0x385f8a[_0xd23c('0x25')]};return db['OpenchannelQueue'][_0xd23c('0x14')](_0x534def)[_0xd23c('0x18')](function(_0x40c575){_0x4d0066[_0xd23c('0x14')]=_0x40c575;_0x385f8a['include']=qs[_0xd23c('0x26')](_0x17e683['query']);return db[_0xd23c('0x1f')][_0xd23c('0x27')](_0x385f8a);})[_0xd23c('0x18')](function(_0x94220c){_0x4d0066[_0xd23c('0x28')]=_0x94220c;return _0x4d0066;})[_0xd23c('0x18')](respondWithFilteredResult(_0xcc84b0,_0x385f8a))[_0xd23c('0x29')](handleError(_0xcc84b0,null));};exports[_0xd23c('0x2a')]=function(_0x59336a,_0x5d9c1d){var _0x2fe29e={'raw':!![],'where':{'id':_0x59336a[_0xd23c('0x2b')]['id']}},_0x549cb2={};_0x549cb2[_0xd23c('0x2c')]=_[_0xd23c('0x2d')](db[_0xd23c('0x1f')][_0xd23c('0x20')]);_0x549cb2[_0xd23c('0x2e')]=_[_0xd23c('0x2d')](_0x59336a[_0xd23c('0x2e')]);_0x549cb2[_0xd23c('0x2f')]=_[_0xd23c('0x30')](_0x549cb2[_0xd23c('0x2c')],_0x549cb2[_0xd23c('0x2e')]);_0x2fe29e['attributes']=_[_0xd23c('0x30')](_0x549cb2['model'],qs['fields'](_0x59336a[_0xd23c('0x2e')][_0xd23c('0x31')]));_0x2fe29e[_0xd23c('0x32')]=_0x2fe29e['attributes']['length']?_0x2fe29e['attributes']:_0x549cb2[_0xd23c('0x2c')];if(_0x59336a[_0xd23c('0x2e')][_0xd23c('0x33')]){_0x2fe29e[_0xd23c('0x26')]=[{'all':!![]}];}_0x2fe29e=_['merge']({},_0x2fe29e,_0x59336a[_0xd23c('0x34')]);return db['OpenchannelQueue'][_0xd23c('0x35')](_0x2fe29e)[_0xd23c('0x18')](handleEntityNotFound(_0x5d9c1d,null))[_0xd23c('0x18')](respondWithResult(_0x5d9c1d,null))[_0xd23c('0x29')](handleError(_0x5d9c1d,null));};exports['create']=function(_0x25f780,_0x41ffb9){return db[_0xd23c('0x1f')]['create'](_0x25f780['body'],{})['then'](function(_0x14eb11){var _0xd1a61d=_0x25f780[_0xd23c('0x36')][_0xd23c('0x37')]({'plain':!![]});if(!_0xd1a61d)throw new Error(_0xd23c('0x38'));if(_0xd1a61d[_0xd23c('0x39')]===_0xd23c('0x36')){var _0x49d616=_0x14eb11[_0xd23c('0x37')]({'plain':!![]});var _0x24776d='OpenchannelQueues';return db[_0xd23c('0x3a')]['find']({'where':{'name':_0x24776d,'userProfileId':_0xd1a61d[_0xd23c('0x3b')]},'raw':!![]})[_0xd23c('0x18')](function(_0x38757a){if(_0x38757a&&_0x38757a[_0xd23c('0x3c')]===0x0){return db['UserProfileResource'][_0xd23c('0x3d')]({'name':_0x49d616[_0xd23c('0x3e')],'resourceId':_0x49d616['id'],'type':_0x38757a[_0xd23c('0x3e')],'sectionId':_0x38757a['id']},{})[_0xd23c('0x18')](function(){return _0x14eb11;});}else{return _0x14eb11;}})[_0xd23c('0x29')](function(_0x1defd8){logger['error'](_0xd23c('0x3f'),_0x1defd8);throw _0x1defd8;});}return _0x14eb11;})[_0xd23c('0x18')](respondWithResult(_0x41ffb9,0xc9))[_0xd23c('0x29')](handleError(_0x41ffb9,null));};exports[_0xd23c('0x17')]=function(_0x3b91d0,_0x66c01){if(_0x3b91d0[_0xd23c('0x40')]['id']){delete _0x3b91d0[_0xd23c('0x40')]['id'];}return db[_0xd23c('0x1f')][_0xd23c('0x35')]({'where':{'id':_0x3b91d0['params']['id']}})['then'](handleEntityNotFound(_0x66c01,null))[_0xd23c('0x18')](saveUpdates(_0x3b91d0[_0xd23c('0x40')],null))['then'](respondWithResult(_0x66c01,null))[_0xd23c('0x29')](handleError(_0x66c01,null));};exports[_0xd23c('0x19')]=function(_0x490c26,_0x337747){return db['OpenchannelQueue']['find']({'where':{'id':_0x490c26[_0xd23c('0x2b')]['id']}})[_0xd23c('0x18')](handleEntityNotFound(_0x337747,null))[_0xd23c('0x18')](removeEntity(_0x337747,null))[_0xd23c('0x29')](handleError(_0x337747,null));};exports['describe']=function(_0x57d6b2,_0x30923d){return db['OpenchannelQueue'][_0xd23c('0x41')]()['then'](respondWithResult(_0x30923d,null))[_0xd23c('0x29')](handleError(_0x30923d,null));};exports[_0xd23c('0x42')]=function(_0x2bd24a,_0x4f5c0b){var _0x1feffd={'raw':!![],'where':{}},_0x3a2029={},_0x3de175;return db[_0xd23c('0x1f')][_0xd23c('0x43')]({'where':{'id':_0x2bd24a['params']['id']}})[_0xd23c('0x18')](handleEntityNotFound(_0x4f5c0b,null))[_0xd23c('0x18')](function(_0x451930){if(_0x451930){_0x3de175=_0x451930[_0xd23c('0x37')]({'plain':!![]});_0x3a2029[_0xd23c('0x2c')]=_['keys'](db[_0xd23c('0x44')][_0xd23c('0x20')]);_0x3a2029[_0xd23c('0x2e')]=_['keys'](_0x2bd24a[_0xd23c('0x2e')]);_0x3a2029[_0xd23c('0x2f')]=_[_0xd23c('0x30')](_0x3a2029['model'],_0x3a2029['query']);_0x1feffd[_0xd23c('0x32')]=_['intersection'](_0x3a2029[_0xd23c('0x2c')],qs[_0xd23c('0x31')](_0x2bd24a[_0xd23c('0x2e')][_0xd23c('0x31')]));_0x1feffd[_0xd23c('0x32')]=_0x1feffd['attributes'][_0xd23c('0x45')]?_0x1feffd['attributes']:_0x3a2029[_0xd23c('0x2c')];if(!_0x2bd24a[_0xd23c('0x2e')][_0xd23c('0x46')](_0xd23c('0x47'))){_0x1feffd[_0xd23c('0x13')]=qs[_0xd23c('0x13')](_0x2bd24a['query'][_0xd23c('0x13')]);_0x1feffd[_0xd23c('0x11')]=qs['offset'](_0x2bd24a['query']['offset']);}_0x1feffd[_0xd23c('0x48')]=qs[_0xd23c('0x49')](_0x2bd24a[_0xd23c('0x2e')][_0xd23c('0x49')]);_0x1feffd[_0xd23c('0x25')]=qs[_0xd23c('0x2f')](_['pick'](_0x2bd24a[_0xd23c('0x2e')],_0x3a2029[_0xd23c('0x2f')]));_0x1feffd[_0xd23c('0x25')][_0xd23c('0x4a')]=_0x451930['id'];if(_0x2bd24a['query'][_0xd23c('0x4b')]){_0x1feffd[_0xd23c('0x25')]=_[_0xd23c('0x4c')](_0x1feffd['where'],{'$or':_[_0xd23c('0x1e')](_0x1feffd[_0xd23c('0x32')],function(_0x350159){var _0x1ec235={};_0x1ec235[_0x350159]={'$like':'%'+_0x2bd24a[_0xd23c('0x2e')][_0xd23c('0x4b')]+'%'};return _0x1ec235;})});}_0x1feffd=_[_0xd23c('0x4c')]({},_0x1feffd,_0x2bd24a[_0xd23c('0x34')]);return db[_0xd23c('0x44')][_0xd23c('0x27')](_0x1feffd);}})['then'](function(_0x398765){if(_0x398765){return db[_0xd23c('0x4d')][_0xd23c('0x4e')]({'where':{'id':_[_0xd23c('0x1e')](_0x398765,_0xd23c('0x4f')),'role':_0xd23c('0x50')},'attributes':['id',_0xd23c('0x3e'),_0xd23c('0x51'),_0xd23c('0x52'),_0xd23c('0x53')]});}})[_0xd23c('0x18')](function(_0x22e9c3){if(_0x22e9c3){return{'count':_0x22e9c3[_0xd23c('0x14')],'rows':_[_0xd23c('0x1e')](_0x22e9c3[_0xd23c('0x28')],function(_0xfbf572){return{'membername':_0xfbf572['name'],'UserId':_0xfbf572['id'],'queue_name':_0x3de175['name'],'OpenchannelQueueId':_0x3de175['id'],'interface':util['format'](_0xd23c('0x54'),_0xd23c('0x55'),_0xfbf572[_0xd23c('0x3e')]),'penalty':0x0,'paused':_0xfbf572['openchannelPause'],'createdAt':_0xfbf572[_0xd23c('0x53')],'updatedAt':_0xfbf572[_0xd23c('0x52')]};})};}else{return{'count':0x0,'rows':[]};}})[_0xd23c('0x18')](respondWithFilteredResult(_0x4f5c0b,_0x1feffd))['catch'](handleError(_0x4f5c0b,null));};exports[_0xd23c('0x56')]=function(_0x515f64,_0x40ec63){var _0x2d34cc={};var _0x32e01f={};var _0x4ad399;var _0x1421c1;return db[_0xd23c('0x1f')][_0xd23c('0x43')]({'where':{'id':_0x515f64[_0xd23c('0x2b')]['id']}})['then'](handleEntityNotFound(_0x40ec63,null))[_0xd23c('0x18')](function(_0x221cf0){if(_0x221cf0){_0x4ad399=_0x221cf0;_0x32e01f['model']=_[_0xd23c('0x2d')](db[_0xd23c('0x57')][_0xd23c('0x20')]);_0x32e01f[_0xd23c('0x2e')]=_[_0xd23c('0x2d')](_0x515f64['query']);_0x32e01f[_0xd23c('0x2f')]=_[_0xd23c('0x30')](_0x32e01f[_0xd23c('0x2c')],_0x32e01f['query']);_0x2d34cc[_0xd23c('0x32')]=_[_0xd23c('0x30')](_0x32e01f[_0xd23c('0x2c')],qs[_0xd23c('0x31')](_0x515f64[_0xd23c('0x2e')][_0xd23c('0x31')]));_0x2d34cc[_0xd23c('0x32')]=_0x2d34cc[_0xd23c('0x32')][_0xd23c('0x45')]?_0x2d34cc[_0xd23c('0x32')]:_0x32e01f[_0xd23c('0x2c')];_0x2d34cc['order']=qs[_0xd23c('0x49')](_0x515f64[_0xd23c('0x2e')][_0xd23c('0x49')]);_0x2d34cc[_0xd23c('0x25')]=qs[_0xd23c('0x2f')](_[_0xd23c('0x58')](_0x515f64[_0xd23c('0x2e')],_0x32e01f[_0xd23c('0x2f')]));if(_0x515f64['query'][_0xd23c('0x4b')]){_0x2d34cc[_0xd23c('0x25')]=_[_0xd23c('0x4c')](_0x2d34cc[_0xd23c('0x25')],{'$or':_[_0xd23c('0x1e')](_0x2d34cc[_0xd23c('0x32')],function(_0xbb7bd6){var _0x297b4c={};_0x297b4c[_0xbb7bd6]={'$like':'%'+_0x515f64[_0xd23c('0x2e')][_0xd23c('0x4b')]+'%'};return _0x297b4c;})});}_0x2d34cc=_[_0xd23c('0x4c')]({},_0x2d34cc,_0x515f64['options']);return _0x4ad399[_0xd23c('0x56')](_0x2d34cc);}})[_0xd23c('0x18')](function(_0xe2b74c){if(_0xe2b74c){_0x1421c1=_0xe2b74c[_0xd23c('0x45')];if(!_0x515f64['query'][_0xd23c('0x46')](_0xd23c('0x47'))){_0x2d34cc[_0xd23c('0x13')]=qs[_0xd23c('0x13')](_0x515f64[_0xd23c('0x2e')][_0xd23c('0x13')]);_0x2d34cc[_0xd23c('0x11')]=qs[_0xd23c('0x11')](_0x515f64[_0xd23c('0x2e')][_0xd23c('0x11')]);}return _0x4ad399[_0xd23c('0x56')](_0x2d34cc);}})[_0xd23c('0x18')](function(_0x1f54bc){if(_0x1f54bc){return _0x1f54bc?{'count':_0x1421c1,'rows':_0x1f54bc}:null;}})[_0xd23c('0x18')](respondWithResult(_0x40ec63,null))[_0xd23c('0x29')](handleError(_0x40ec63,null));};exports['addTeams']=function(_0x22caaf,_0xec49ef){var _0x48217c=_0x22caaf[_0xd23c('0x40')][_0xd23c('0x59')];return db[_0xd23c('0x57')][_0xd23c('0x27')]({'where':{'id':_0x48217c},'attributes':['id'],'include':[{'model':db[_0xd23c('0x4d')],'as':_0xd23c('0x5a'),'attributes':['id','name','online','voicePause',_0xd23c('0x5b')],'raw':!![]}]})[_0xd23c('0x18')](function(_0xa90e8f){if(_0xa90e8f){var _0x347dcc=_[_0xd23c('0x5c')](_0xa90e8f,function(_0x42b69c){var _0x30a702=_0x42b69c[_0xd23c('0x37')]({'plain':!![]});return _0x30a702['Agents'];});return db[_0xd23c('0x1f')][_0xd23c('0x35')]({'where':{'id':_0x22caaf[_0xd23c('0x2b')]['id']}})[_0xd23c('0x18')](function(_0x5b45ab){return db[_0xd23c('0x5d')][_0xd23c('0x5e')](function(_0x1f12be){return _0x5b45ab[_0xd23c('0x5f')](_0x48217c,{'transaction':_0x1f12be})[_0xd23c('0x18')](function(){return BPromise[_0xd23c('0x60')](_0x347dcc,function(_0x10fa6a){return db['UserOpenchannelQueue'][_0xd23c('0x61')]({'where':{'UserId':_0x10fa6a['id'],'OpenchannelQueueId':_0x22caaf['params']['id']},'transaction':_0x1f12be});});})[_0xd23c('0x18')](function(){_0x347dcc['forEach'](function(_0x10b117){socket[_0xd23c('0x62')]('userOpenchannelQueue:save',{'UserId':_0x10b117['id'],'OpenchannelQueueId':_0x5b45ab['id']});});});});});}})[_0xd23c('0x18')](respondWithStatusCode(_0xec49ef,null))[_0xd23c('0x29')](handleError(_0xec49ef,null));};exports[_0xd23c('0x63')]=function(_0x34996c,_0x257eed){return db[_0xd23c('0x57')][_0xd23c('0x27')]({'where':{'id':_0x34996c['query'][_0xd23c('0x59')]},'attributes':['id'],'include':[{'model':db[_0xd23c('0x4d')],'as':_0xd23c('0x5a'),'attributes':['id'],'raw':!![]}]})['then'](handleEntityNotFound(_0x257eed,null))[_0xd23c('0x18')](function(_0x765f88){var _0xac30c6=_[_0xd23c('0x1e')](_0x765f88,'id');var _0x22ea42=[];var _0x36f4cd=[];var _0x44aa44=squel[_0xd23c('0x64')]();_0x44aa44[_0xd23c('0x65')]('tq.TeamId')['from'](_0xd23c('0x66'),'tq')['join']('user_has_teams','ut',_0xd23c('0x67'))[_0xd23c('0x25')](_0xd23c('0x68'),_0x34996c[_0xd23c('0x2b')]['id']);for(var _0x4f8186=0x0;_0x4f8186<_0x765f88[_0xd23c('0x45')];_0x4f8186+=0x1){let _0x5a9d38=_0x765f88[_0x4f8186];for(var _0x39a275=0x0;_0x39a275<_0x5a9d38[_0xd23c('0x5a')]['length'];_0x39a275+=0x1){let _0x21ee89=_0x5a9d38['Agents'][_0x39a275];var _0x29817b=_0x44aa44[_0xd23c('0x69')]();_0x29817b[_0xd23c('0x25')]('ut.UserId\x20=\x20?',_0x21ee89['id']);_0x36f4cd[_0xd23c('0x6a')](db[_0xd23c('0x5d')]['query'](_0x29817b[_0xd23c('0x6b')](),{'type':db[_0xd23c('0x5d')][_0xd23c('0x6c')][_0xd23c('0x6d')]})[_0xd23c('0x18')](function(_0x4798b3){if(_0x4798b3['length']===0x1){return _0x21ee89['id'];}else{var _0x3858ef=_[_0xd23c('0x6e')](_[_0xd23c('0x1e')](_0x4798b3,_0xd23c('0x6f')),function(_0xb018b4){return _[_0xd23c('0x70')](_0xac30c6,_0xb018b4);});if(_0x3858ef){return _0x21ee89['id'];}}}));}}return BPromise[_0xd23c('0x71')](_0x36f4cd)[_0xd23c('0x18')](function(_0x1a7d8a){_0x22ea42=_(_0x22ea42)[_0xd23c('0x72')](_0x1a7d8a)[_0xd23c('0x73')]()[_0xd23c('0x74')]();return db[_0xd23c('0x1f')][_0xd23c('0x35')]({'where':{'id':_0x34996c[_0xd23c('0x2b')]['id']}})[_0xd23c('0x18')](function(_0x2c43db){return db['sequelize']['transaction'](function(_0x1ff01e){return _0x2c43db['removeTeams'](_0x34996c[_0xd23c('0x2e')]['ids'],{'transaction':_0x1ff01e})['then'](function(){if(!_[_0xd23c('0x75')](_0x22ea42)){return _0x2c43db[_0xd23c('0x76')](_0x22ea42,{'transaction':_0x1ff01e});}})[_0xd23c('0x18')](function(){_0x22ea42[_0xd23c('0x77')](function(_0x190c86){socket['emit'](_0xd23c('0x78'),{'UserId':_0x190c86,'OpenchannelQueueId':_0x2c43db['id']});});});});});});})['then'](respondWithStatusCode(_0x257eed,null))['catch'](handleError(_0x257eed,null));};exports[_0xd23c('0x79')]=function(_0x437a65,_0x15cd0b){return db['OpenchannelQueue']['find']({'where':{'id':_0x437a65[_0xd23c('0x2b')]['id']}})[_0xd23c('0x18')](handleEntityNotFound(_0x15cd0b,null))[_0xd23c('0x18')](function(_0x2e11d9){if(_0x2e11d9){return _0x2e11d9['addAgents'](_0x437a65[_0xd23c('0x40')][_0xd23c('0x59')],_[_0xd23c('0x7a')](_0x437a65[_0xd23c('0x40')],[_0xd23c('0x59'),'id'])||{})[_0xd23c('0x7b')](function(_0x244812){for(var _0x416b3e=0x0;_0x416b3e<_0x437a65['body']['ids'][_0xd23c('0x45')];_0x416b3e+=0x1){socket[_0xd23c('0x62')]('userOpenchannelQueue:save',{'UserId':Number(_0x437a65['body']['ids'][_0x416b3e]),'OpenchannelQueueId':Number(_0x437a65['params']['id'])});}return _0x244812;});}})[_0xd23c('0x18')](respondWithResult(_0x15cd0b,null))['catch'](handleError(_0x15cd0b,null));};exports[_0xd23c('0x76')]=function(_0x5c641d,_0x36238f){return db['OpenchannelQueue'][_0xd23c('0x35')]({'where':{'id':_0x5c641d['params']['id']}})[_0xd23c('0x18')](handleEntityNotFound(_0x36238f,null))[_0xd23c('0x18')](function(_0x514c1b){if(_0x514c1b){return _0x514c1b[_0xd23c('0x76')](_0x5c641d[_0xd23c('0x2e')][_0xd23c('0x59')])[_0xd23c('0x18')](function(){if(_['isArray'](_0x5c641d['query'][_0xd23c('0x59')])){for(var _0x202cac=0x0;_0x202cac<_0x5c641d[_0xd23c('0x2e')][_0xd23c('0x59')][_0xd23c('0x45')];_0x202cac+=0x1){socket[_0xd23c('0x62')](_0xd23c('0x78'),{'UserId':Number(_0x5c641d[_0xd23c('0x2e')][_0xd23c('0x59')][_0x202cac]),'OpenchannelQueueId':Number(_0x5c641d[_0xd23c('0x2b')]['id'])});}}else{socket[_0xd23c('0x62')]('userOpenchannelQueue:remove',{'UserId':Number(_0x5c641d[_0xd23c('0x2e')][_0xd23c('0x59')]),'OpenchannelQueueId':Number(_0x5c641d[_0xd23c('0x2b')]['id'])});}});}})[_0xd23c('0x18')](respondWithStatusCode(_0x36238f,null))[_0xd23c('0x29')](handleError(_0x36238f,null));};exports[_0xd23c('0x7c')]=function(_0x17cab5,_0x211d41){var _0x5f10ca={};var _0x1d8f40={};var _0x1ffac4;var _0x132b08;return db[_0xd23c('0x1f')]['findOne']({'where':{'id':_0x17cab5['params']['id']}})['then'](handleEntityNotFound(_0x211d41,null))[_0xd23c('0x18')](function(_0x30a8d0){if(_0x30a8d0){_0x1ffac4=_0x30a8d0;_0x1d8f40[_0xd23c('0x2c')]=_['keys'](db[_0xd23c('0x4d')]['rawAttributes']);_0x1d8f40[_0xd23c('0x2e')]=_[_0xd23c('0x2d')](_0x17cab5[_0xd23c('0x2e')]);_0x1d8f40[_0xd23c('0x2f')]=_['intersection'](_0x1d8f40[_0xd23c('0x2c')],_0x1d8f40['query']);_0x5f10ca[_0xd23c('0x32')]=_['intersection'](_0x1d8f40['model'],qs[_0xd23c('0x31')](_0x17cab5[_0xd23c('0x2e')][_0xd23c('0x31')]));_0x5f10ca[_0xd23c('0x32')]=_0x5f10ca[_0xd23c('0x32')]['length']?_0x5f10ca[_0xd23c('0x32')]:_0x1d8f40[_0xd23c('0x2c')];_0x5f10ca[_0xd23c('0x48')]=qs[_0xd23c('0x49')](_0x17cab5[_0xd23c('0x2e')][_0xd23c('0x49')]);_0x5f10ca[_0xd23c('0x25')]=qs['filters'](_['pick'](_0x17cab5[_0xd23c('0x2e')],_0x1d8f40[_0xd23c('0x2f')]));if(_0x17cab5['query'][_0xd23c('0x4b')]){_0x5f10ca[_0xd23c('0x25')]=_[_0xd23c('0x4c')](_0x5f10ca[_0xd23c('0x25')],{'$or':_[_0xd23c('0x1e')](_0x5f10ca[_0xd23c('0x32')],function(_0x2005eb){var _0x15536f={};_0x15536f[_0x2005eb]={'$like':'%'+_0x17cab5[_0xd23c('0x2e')][_0xd23c('0x4b')]+'%'};return _0x15536f;})});}_0x5f10ca=_[_0xd23c('0x4c')]({},_0x5f10ca,_0x17cab5['options']);return _0x1ffac4[_0xd23c('0x7c')](_0x5f10ca);}})[_0xd23c('0x18')](function(_0x30a051){if(_0x30a051){_0x132b08=_0x30a051[_0xd23c('0x45')];if(!_0x17cab5['query'][_0xd23c('0x46')](_0xd23c('0x47'))){_0x5f10ca[_0xd23c('0x13')]=qs[_0xd23c('0x13')](_0x17cab5[_0xd23c('0x2e')][_0xd23c('0x13')]);_0x5f10ca[_0xd23c('0x11')]=qs[_0xd23c('0x11')](_0x17cab5[_0xd23c('0x2e')]['offset']);}return _0x1ffac4[_0xd23c('0x7c')](_0x5f10ca);}})[_0xd23c('0x18')](function(_0x4c5967){if(_0x4c5967){return _0x4c5967?{'count':_0x132b08,'rows':_0x4c5967}:null;}})[_0xd23c('0x18')](respondWithResult(_0x211d41,null))[_0xd23c('0x29')](handleError(_0x211d41,null));}; \ No newline at end of file +var _0x85d6=['clone','ut.UserId\x20=\x20?','push','toString','QueryTypes','SELECT','every','TeamId','all','union','compact','value','removeAgents','addAgents','spread','isArray','userOpenchannelQueue:remove','getAgents','pick','nolimit','bluebird','util','lodash','../../components/parsers/qs','../../config/logger','api','../../config/environment','redis','defaults','localhost','socket.io-emitter','./openchannelQueue.socket','register','sendStatus','end','offset','undefined','limit','count','status','set','Content-Range','json','then','destroy','get','OpenchannelQueues','UserProfileResource','error','stack','name','send','index','map','rawAttributes','fieldName','key','OpenchannelQueue','include','findAll','rows','catch','model','keys','filters','intersection','query','attributes','length','includeAll','merge','options','find','create','body','user','Unable\x20to\x20retrieve\x20the\x20current\x20user','role','autoAssociation','update','params','describe','getMembers','findOne','UserOpenchannelQueue','fields','hasOwnProperty','where','OpenchannelQueueId','filter','User','findAndCountAll','agent','openchannelPause','createdAt','%s/%s','SIP','getTeams','order','sort','addTeams','ids','Team','Agents','voicePause','flatMap','sequelize','transaction','each','findOrCreate','forEach','emit','userOpenchannelQueue:save','removeTeams','select','field','tq.TeamId','from','team_has_openchannel_queues','user_has_teams','ut.TeamId\x20=\x20tq.TeamId','OpenchannelQueueId\x20=\x20?'];(function(_0x5f3f88,_0x562baf){var _0xd08119=function(_0x42dbf7){while(--_0x42dbf7){_0x5f3f88['push'](_0x5f3f88['shift']());}};_0xd08119(++_0x562baf);}(_0x85d6,0x182));var _0x685d=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0x85d6[_0x3dd15e];return _0x231fd0;};'use strict';var BPromise=require(_0x685d('0x0'));var util=require(_0x685d('0x1'));var _=require(_0x685d('0x2'));var squel=require('squel');var Redis=require('ioredis');var qs=require(_0x685d('0x3'));var logger=require(_0x685d('0x4'))(_0x685d('0x5'));var config=require(_0x685d('0x6'));var db=require('../../mysqldb')['db'];config[_0x685d('0x7')]=_[_0x685d('0x8')](config[_0x685d('0x7')],{'host':_0x685d('0x9'),'port':0x18eb});var socket=require(_0x685d('0xa'))(new Redis(config['redis']));require(_0x685d('0xb'))[_0x685d('0xc')](socket);function respondWithStatusCode(_0x4c70e4,_0x1a57b0){_0x1a57b0=_0x1a57b0||0xcc;return function(_0x1fd81b){if(_0x1fd81b){return _0x4c70e4[_0x685d('0xd')](_0x1a57b0);}return _0x4c70e4['status'](_0x1a57b0)[_0x685d('0xe')]();};}function respondWithResult(_0x162424,_0x46c1d6){_0x46c1d6=_0x46c1d6||0xc8;return function(_0xb96b08){if(_0xb96b08){return _0x162424['status'](_0x46c1d6)['json'](_0xb96b08);}};}function respondWithFilteredResult(_0x7086a,_0x303ea7){return function(_0x202e71){if(_0x202e71){var _0x1a24e9=typeof _0x303ea7[_0x685d('0xf')]===_0x685d('0x10')&&typeof _0x303ea7[_0x685d('0x11')]===_0x685d('0x10');var _0x3966e6=_0x202e71['count'];var _0xd6e7a6=_0x1a24e9?0x0:_0x303ea7['offset'];var _0x3cd9bf=_0x1a24e9?_0x202e71[_0x685d('0x12')]:_0x303ea7[_0x685d('0xf')]+_0x303ea7[_0x685d('0x11')];var _0x779153;if(_0x3cd9bf>=_0x3966e6){_0x3cd9bf=_0x3966e6;_0x779153=0xc8;}else{_0x779153=0xce;}_0x7086a[_0x685d('0x13')](_0x779153);return _0x7086a[_0x685d('0x14')](_0x685d('0x15'),_0xd6e7a6+'-'+_0x3cd9bf+'/'+_0x3966e6)[_0x685d('0x16')](_0x202e71);}return null;};}function saveUpdates(_0x25a4e0){return function(_0x3c05e6){if(_0x3c05e6){return _0x3c05e6['update'](_0x25a4e0)[_0x685d('0x17')](function(_0x58fddf){return _0x58fddf;});}return null;};}function removeEntity(_0x1c3514){return function(_0x41ccc7){if(_0x41ccc7){return _0x41ccc7[_0x685d('0x18')]()[_0x685d('0x17')](function(){var _0x2d5b0f=_0x41ccc7[_0x685d('0x19')]({'plain':!![]});var _0x1463e9=_0x685d('0x1a');return db[_0x685d('0x1b')][_0x685d('0x18')]({'where':{'type':_0x1463e9,'resourceId':_0x2d5b0f['id']}})[_0x685d('0x17')](function(){return _0x41ccc7;});})['then'](function(){_0x1c3514['status'](0xcc)['end']();});}};}function handleEntityNotFound(_0x491084){return function(_0x203072){if(!_0x203072){_0x491084[_0x685d('0xd')](0x194);}return _0x203072;};}function handleError(_0x52b884,_0xe9184d){_0xe9184d=_0xe9184d||0x1f4;return function(_0x493007){logger[_0x685d('0x1c')](_0x493007[_0x685d('0x1d')]);if(_0x493007[_0x685d('0x1e')]){delete _0x493007[_0x685d('0x1e')];}_0x52b884[_0x685d('0x13')](_0xe9184d)[_0x685d('0x1f')](_0x493007);};}exports[_0x685d('0x20')]=function(_0x2f8e12,_0x7733b0){var _0x4948c4={};var _0x4bac82={'count':0x0,'rows':[]};var _0x3551fe=_[_0x685d('0x21')](db['OpenchannelQueue'][_0x685d('0x22')],function(_0x50bc31){return{'name':_0x50bc31[_0x685d('0x23')],'type':_0x50bc31['type'][_0x685d('0x24')]};});_0x4948c4=qs['getOptions'](_0x3551fe,_0x2f8e12);var _0x58e0f0={'where':_0x4948c4['where']};return db[_0x685d('0x25')][_0x685d('0x12')](_0x58e0f0)[_0x685d('0x17')](function(_0x1f2647){_0x4bac82['count']=_0x1f2647;_0x4948c4[_0x685d('0x26')]=qs[_0x685d('0x26')](_0x2f8e12['query']);return db['OpenchannelQueue'][_0x685d('0x27')](_0x4948c4);})[_0x685d('0x17')](function(_0x24cc17){_0x4bac82[_0x685d('0x28')]=_0x24cc17;return _0x4bac82;})['then'](respondWithFilteredResult(_0x7733b0,_0x4948c4))[_0x685d('0x29')](handleError(_0x7733b0,null));};exports['show']=function(_0x4f83c3,_0x5e257d){var _0x25430c={'raw':!![],'where':{'id':_0x4f83c3['params']['id']}},_0x5531ed={};_0x5531ed[_0x685d('0x2a')]=_[_0x685d('0x2b')](db['OpenchannelQueue'][_0x685d('0x22')]);_0x5531ed['query']=_[_0x685d('0x2b')](_0x4f83c3['query']);_0x5531ed[_0x685d('0x2c')]=_[_0x685d('0x2d')](_0x5531ed[_0x685d('0x2a')],_0x5531ed[_0x685d('0x2e')]);_0x25430c[_0x685d('0x2f')]=_[_0x685d('0x2d')](_0x5531ed['model'],qs['fields'](_0x4f83c3['query']['fields']));_0x25430c['attributes']=_0x25430c[_0x685d('0x2f')][_0x685d('0x30')]?_0x25430c[_0x685d('0x2f')]:_0x5531ed[_0x685d('0x2a')];if(_0x4f83c3['query'][_0x685d('0x31')]){_0x25430c[_0x685d('0x26')]=[{'all':!![]}];}_0x25430c=_[_0x685d('0x32')]({},_0x25430c,_0x4f83c3[_0x685d('0x33')]);return db[_0x685d('0x25')][_0x685d('0x34')](_0x25430c)[_0x685d('0x17')](handleEntityNotFound(_0x5e257d,null))[_0x685d('0x17')](respondWithResult(_0x5e257d,null))[_0x685d('0x29')](handleError(_0x5e257d,null));};exports[_0x685d('0x35')]=function(_0x11a230,_0x4b0401){return db['OpenchannelQueue']['create'](_0x11a230[_0x685d('0x36')],{})[_0x685d('0x17')](function(_0x16dfdb){var _0x39b89a=_0x11a230[_0x685d('0x37')][_0x685d('0x19')]({'plain':!![]});if(!_0x39b89a)throw new Error(_0x685d('0x38'));if(_0x39b89a[_0x685d('0x39')]===_0x685d('0x37')){var _0x2e31a7=_0x16dfdb[_0x685d('0x19')]({'plain':!![]});var _0x5e8186=_0x685d('0x1a');return db['UserProfileSection'][_0x685d('0x34')]({'where':{'name':_0x5e8186,'userProfileId':_0x39b89a['userProfileId']},'raw':!![]})[_0x685d('0x17')](function(_0xaa880c){if(_0xaa880c&&_0xaa880c[_0x685d('0x3a')]===0x0){return db[_0x685d('0x1b')][_0x685d('0x35')]({'name':_0x2e31a7[_0x685d('0x1e')],'resourceId':_0x2e31a7['id'],'type':_0xaa880c[_0x685d('0x1e')],'sectionId':_0xaa880c['id']},{})[_0x685d('0x17')](function(){return _0x16dfdb;});}else{return _0x16dfdb;}})[_0x685d('0x29')](function(_0x417ade){logger[_0x685d('0x1c')]('Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s',_0x417ade);throw _0x417ade;});}return _0x16dfdb;})[_0x685d('0x17')](respondWithResult(_0x4b0401,0xc9))[_0x685d('0x29')](handleError(_0x4b0401,null));};exports[_0x685d('0x3b')]=function(_0x190a74,_0x5b892c){if(_0x190a74[_0x685d('0x36')]['id']){delete _0x190a74[_0x685d('0x36')]['id'];}return db[_0x685d('0x25')][_0x685d('0x34')]({'where':{'id':_0x190a74[_0x685d('0x3c')]['id']}})[_0x685d('0x17')](handleEntityNotFound(_0x5b892c,null))['then'](saveUpdates(_0x190a74[_0x685d('0x36')],null))[_0x685d('0x17')](respondWithResult(_0x5b892c,null))[_0x685d('0x29')](handleError(_0x5b892c,null));};exports[_0x685d('0x18')]=function(_0x464ed7,_0x3ab5c9){return db[_0x685d('0x25')][_0x685d('0x34')]({'where':{'id':_0x464ed7[_0x685d('0x3c')]['id']}})[_0x685d('0x17')](handleEntityNotFound(_0x3ab5c9,null))[_0x685d('0x17')](removeEntity(_0x3ab5c9,null))[_0x685d('0x29')](handleError(_0x3ab5c9,null));};exports['describe']=function(_0x18eb34,_0x3616a0){return db['OpenchannelQueue'][_0x685d('0x3d')]()[_0x685d('0x17')](respondWithResult(_0x3616a0,null))['catch'](handleError(_0x3616a0,null));};exports[_0x685d('0x3e')]=function(_0x17b7d2,_0x5a07aa){var _0x54e279={'raw':!![],'where':{}},_0x2cb1dc={},_0x4518fa;return db[_0x685d('0x25')][_0x685d('0x3f')]({'where':{'id':_0x17b7d2[_0x685d('0x3c')]['id']}})[_0x685d('0x17')](handleEntityNotFound(_0x5a07aa,null))[_0x685d('0x17')](function(_0x3098e2){if(_0x3098e2){_0x4518fa=_0x3098e2['get']({'plain':!![]});_0x2cb1dc[_0x685d('0x2a')]=_[_0x685d('0x2b')](db[_0x685d('0x40')]['rawAttributes']);_0x2cb1dc[_0x685d('0x2e')]=_[_0x685d('0x2b')](_0x17b7d2[_0x685d('0x2e')]);_0x2cb1dc['filters']=_[_0x685d('0x2d')](_0x2cb1dc[_0x685d('0x2a')],_0x2cb1dc['query']);_0x54e279[_0x685d('0x2f')]=_[_0x685d('0x2d')](_0x2cb1dc[_0x685d('0x2a')],qs[_0x685d('0x41')](_0x17b7d2[_0x685d('0x2e')]['fields']));_0x54e279[_0x685d('0x2f')]=_0x54e279[_0x685d('0x2f')][_0x685d('0x30')]?_0x54e279[_0x685d('0x2f')]:_0x2cb1dc[_0x685d('0x2a')];if(!_0x17b7d2['query'][_0x685d('0x42')]('nolimit')){_0x54e279[_0x685d('0x11')]=qs[_0x685d('0x11')](_0x17b7d2[_0x685d('0x2e')][_0x685d('0x11')]);_0x54e279[_0x685d('0xf')]=qs[_0x685d('0xf')](_0x17b7d2[_0x685d('0x2e')][_0x685d('0xf')]);}_0x54e279['order']=qs['sort'](_0x17b7d2[_0x685d('0x2e')]['sort']);_0x54e279['where']=qs[_0x685d('0x2c')](_['pick'](_0x17b7d2[_0x685d('0x2e')],_0x2cb1dc[_0x685d('0x2c')]));_0x54e279[_0x685d('0x43')][_0x685d('0x44')]=_0x3098e2['id'];if(_0x17b7d2['query'][_0x685d('0x45')]){_0x54e279[_0x685d('0x43')]=_[_0x685d('0x32')](_0x54e279[_0x685d('0x43')],{'$or':_[_0x685d('0x21')](_0x54e279[_0x685d('0x2f')],function(_0x2804c9){var _0x116e96={};_0x116e96[_0x2804c9]={'$like':'%'+_0x17b7d2[_0x685d('0x2e')]['filter']+'%'};return _0x116e96;})});}_0x54e279=_[_0x685d('0x32')]({},_0x54e279,_0x17b7d2['options']);return db[_0x685d('0x40')][_0x685d('0x27')](_0x54e279);}})[_0x685d('0x17')](function(_0x442311){if(_0x442311){return db[_0x685d('0x46')][_0x685d('0x47')]({'where':{'id':_[_0x685d('0x21')](_0x442311,'UserId'),'role':_0x685d('0x48')},'attributes':['id',_0x685d('0x1e'),_0x685d('0x49'),'updatedAt',_0x685d('0x4a')]});}})['then'](function(_0x472038){if(_0x472038){return{'count':_0x472038[_0x685d('0x12')],'rows':_[_0x685d('0x21')](_0x472038['rows'],function(_0x4462a1){return{'membername':_0x4462a1[_0x685d('0x1e')],'UserId':_0x4462a1['id'],'queue_name':_0x4518fa[_0x685d('0x1e')],'OpenchannelQueueId':_0x4518fa['id'],'interface':util['format'](_0x685d('0x4b'),_0x685d('0x4c'),_0x4462a1[_0x685d('0x1e')]),'penalty':0x0,'paused':_0x4462a1[_0x685d('0x49')],'createdAt':_0x4462a1[_0x685d('0x4a')],'updatedAt':_0x4462a1['updatedAt']};})};}else{return{'count':0x0,'rows':[]};}})['then'](respondWithFilteredResult(_0x5a07aa,_0x54e279))[_0x685d('0x29')](handleError(_0x5a07aa,null));};exports[_0x685d('0x4d')]=function(_0x2b9953,_0x17f2df){var _0x46e4ce={};var _0x33d543={};var _0x162b1a;var _0x498678;return db[_0x685d('0x25')]['findOne']({'where':{'id':_0x2b9953[_0x685d('0x3c')]['id']}})[_0x685d('0x17')](handleEntityNotFound(_0x17f2df,null))[_0x685d('0x17')](function(_0xa3fdf7){if(_0xa3fdf7){_0x162b1a=_0xa3fdf7;_0x33d543[_0x685d('0x2a')]=_[_0x685d('0x2b')](db['Team'][_0x685d('0x22')]);_0x33d543[_0x685d('0x2e')]=_['keys'](_0x2b9953[_0x685d('0x2e')]);_0x33d543['filters']=_[_0x685d('0x2d')](_0x33d543[_0x685d('0x2a')],_0x33d543[_0x685d('0x2e')]);_0x46e4ce[_0x685d('0x2f')]=_[_0x685d('0x2d')](_0x33d543[_0x685d('0x2a')],qs[_0x685d('0x41')](_0x2b9953[_0x685d('0x2e')]['fields']));_0x46e4ce[_0x685d('0x2f')]=_0x46e4ce[_0x685d('0x2f')][_0x685d('0x30')]?_0x46e4ce[_0x685d('0x2f')]:_0x33d543[_0x685d('0x2a')];_0x46e4ce[_0x685d('0x4e')]=qs[_0x685d('0x4f')](_0x2b9953[_0x685d('0x2e')][_0x685d('0x4f')]);_0x46e4ce[_0x685d('0x43')]=qs[_0x685d('0x2c')](_['pick'](_0x2b9953[_0x685d('0x2e')],_0x33d543[_0x685d('0x2c')]));if(_0x2b9953['query'][_0x685d('0x45')]){_0x46e4ce[_0x685d('0x43')]=_[_0x685d('0x32')](_0x46e4ce[_0x685d('0x43')],{'$or':_[_0x685d('0x21')](_0x46e4ce['attributes'],function(_0x786298){var _0x59e780={};_0x59e780[_0x786298]={'$like':'%'+_0x2b9953['query'][_0x685d('0x45')]+'%'};return _0x59e780;})});}_0x46e4ce=_[_0x685d('0x32')]({},_0x46e4ce,_0x2b9953[_0x685d('0x33')]);return _0x162b1a[_0x685d('0x4d')](_0x46e4ce);}})[_0x685d('0x17')](function(_0x2b8e0a){if(_0x2b8e0a){_0x498678=_0x2b8e0a[_0x685d('0x30')];if(!_0x2b9953[_0x685d('0x2e')]['hasOwnProperty']('nolimit')){_0x46e4ce['limit']=qs[_0x685d('0x11')](_0x2b9953[_0x685d('0x2e')][_0x685d('0x11')]);_0x46e4ce[_0x685d('0xf')]=qs[_0x685d('0xf')](_0x2b9953[_0x685d('0x2e')]['offset']);}return _0x162b1a[_0x685d('0x4d')](_0x46e4ce);}})['then'](function(_0x678279){if(_0x678279){return _0x678279?{'count':_0x498678,'rows':_0x678279}:null;}})['then'](respondWithResult(_0x17f2df,null))[_0x685d('0x29')](handleError(_0x17f2df,null));};exports[_0x685d('0x50')]=function(_0x4a9ff9,_0x5240e3){var _0x5682e5=_0x4a9ff9[_0x685d('0x36')][_0x685d('0x51')];return db[_0x685d('0x52')]['findAll']({'where':{'id':_0x5682e5},'attributes':['id'],'include':[{'model':db[_0x685d('0x46')],'as':_0x685d('0x53'),'attributes':['id',_0x685d('0x1e'),'online',_0x685d('0x54'),'interface'],'raw':!![]}]})['then'](function(_0xb20cf1){if(_0xb20cf1){var _0x276907=_[_0x685d('0x55')](_0xb20cf1,function(_0x588518){var _0x195655=_0x588518[_0x685d('0x19')]({'plain':!![]});return _0x195655[_0x685d('0x53')];});return db['OpenchannelQueue'][_0x685d('0x34')]({'where':{'id':_0x4a9ff9[_0x685d('0x3c')]['id']}})[_0x685d('0x17')](function(_0x5a4f90){return db[_0x685d('0x56')][_0x685d('0x57')](function(_0x786254){return _0x5a4f90[_0x685d('0x50')](_0x5682e5,{'transaction':_0x786254})[_0x685d('0x17')](function(){return BPromise[_0x685d('0x58')](_0x276907,function(_0x4f6f0e){return db['UserOpenchannelQueue'][_0x685d('0x59')]({'where':{'UserId':_0x4f6f0e['id'],'OpenchannelQueueId':_0x4a9ff9['params']['id']},'transaction':_0x786254});});})[_0x685d('0x17')](function(){_0x276907[_0x685d('0x5a')](function(_0x1c62ed){socket[_0x685d('0x5b')](_0x685d('0x5c'),{'UserId':_0x1c62ed['id'],'OpenchannelQueueId':_0x5a4f90['id']});});});});});}})[_0x685d('0x17')](respondWithStatusCode(_0x5240e3,null))[_0x685d('0x29')](handleError(_0x5240e3,null));};exports[_0x685d('0x5d')]=function(_0x8d0177,_0x5922f6){return db[_0x685d('0x52')][_0x685d('0x27')]({'where':{'id':_0x8d0177['query'][_0x685d('0x51')]},'attributes':['id'],'include':[{'model':db['User'],'as':_0x685d('0x53'),'attributes':['id'],'raw':!![]}]})['then'](handleEntityNotFound(_0x5922f6,null))['then'](function(_0x1cd18c){var _0x1dd9b5=_['map'](_0x1cd18c,'id');var _0x5a05ab=[];var _0x25d4e6=[];var _0x3ec0b6=squel[_0x685d('0x5e')]();_0x3ec0b6[_0x685d('0x5f')](_0x685d('0x60'))[_0x685d('0x61')](_0x685d('0x62'),'tq')['join'](_0x685d('0x63'),'ut',_0x685d('0x64'))['where'](_0x685d('0x65'),_0x8d0177[_0x685d('0x3c')]['id']);for(var _0x3f67bd=0x0;_0x3f67bd<_0x1cd18c[_0x685d('0x30')];_0x3f67bd+=0x1){let _0x3eec0f=_0x1cd18c[_0x3f67bd];for(var _0x442c2e=0x0;_0x442c2e<_0x3eec0f[_0x685d('0x53')][_0x685d('0x30')];_0x442c2e+=0x1){let _0x51f4dc=_0x3eec0f[_0x685d('0x53')][_0x442c2e];var _0xb091ec=_0x3ec0b6[_0x685d('0x66')]();_0xb091ec[_0x685d('0x43')](_0x685d('0x67'),_0x51f4dc['id']);_0x25d4e6[_0x685d('0x68')](db[_0x685d('0x56')][_0x685d('0x2e')](_0xb091ec[_0x685d('0x69')](),{'type':db[_0x685d('0x56')][_0x685d('0x6a')][_0x685d('0x6b')]})['then'](function(_0x480e46){if(_0x480e46[_0x685d('0x30')]===0x1){return _0x51f4dc['id'];}else{var _0xdc0aef=_[_0x685d('0x6c')](_[_0x685d('0x21')](_0x480e46,_0x685d('0x6d')),function(_0x4c6c05){return _['includes'](_0x1dd9b5,_0x4c6c05);});if(_0xdc0aef){return _0x51f4dc['id'];}}}));}}return BPromise[_0x685d('0x6e')](_0x25d4e6)['then'](function(_0x4fe25d){_0x5a05ab=_(_0x5a05ab)[_0x685d('0x6f')](_0x4fe25d)[_0x685d('0x70')]()[_0x685d('0x71')]();return db['OpenchannelQueue']['find']({'where':{'id':_0x8d0177['params']['id']}})[_0x685d('0x17')](function(_0x4f2e1c){return db[_0x685d('0x56')][_0x685d('0x57')](function(_0x1348ac){return _0x4f2e1c[_0x685d('0x5d')](_0x8d0177[_0x685d('0x2e')][_0x685d('0x51')],{'transaction':_0x1348ac})[_0x685d('0x17')](function(){if(!_['isEmpty'](_0x5a05ab)){return _0x4f2e1c[_0x685d('0x72')](_0x5a05ab,{'transaction':_0x1348ac});}})[_0x685d('0x17')](function(){_0x5a05ab[_0x685d('0x5a')](function(_0x2bd27b){socket['emit']('userOpenchannelQueue:remove',{'UserId':_0x2bd27b,'OpenchannelQueueId':_0x4f2e1c['id']});});});});});});})[_0x685d('0x17')](respondWithStatusCode(_0x5922f6,null))[_0x685d('0x29')](handleError(_0x5922f6,null));};exports[_0x685d('0x73')]=function(_0x10fc1c,_0x4cd726){return db[_0x685d('0x25')][_0x685d('0x34')]({'where':{'id':_0x10fc1c['params']['id']}})['then'](handleEntityNotFound(_0x4cd726,null))['then'](function(_0x18e341){if(_0x18e341){return _0x18e341[_0x685d('0x73')](_0x10fc1c[_0x685d('0x36')][_0x685d('0x51')],_['omit'](_0x10fc1c[_0x685d('0x36')],[_0x685d('0x51'),'id'])||{})[_0x685d('0x74')](function(_0x50fa13){for(var _0x163395=0x0;_0x163395<_0x10fc1c[_0x685d('0x36')][_0x685d('0x51')][_0x685d('0x30')];_0x163395+=0x1){socket[_0x685d('0x5b')](_0x685d('0x5c'),{'UserId':Number(_0x10fc1c[_0x685d('0x36')][_0x685d('0x51')][_0x163395]),'OpenchannelQueueId':Number(_0x10fc1c[_0x685d('0x3c')]['id'])});}return _0x50fa13;});}})[_0x685d('0x17')](respondWithResult(_0x4cd726,null))[_0x685d('0x29')](handleError(_0x4cd726,null));};exports[_0x685d('0x72')]=function(_0x27f0a8,_0x445087){return db[_0x685d('0x25')][_0x685d('0x34')]({'where':{'id':_0x27f0a8['params']['id']}})[_0x685d('0x17')](handleEntityNotFound(_0x445087,null))[_0x685d('0x17')](function(_0x248fc3){if(_0x248fc3){return _0x248fc3[_0x685d('0x72')](_0x27f0a8['query'][_0x685d('0x51')])[_0x685d('0x17')](function(){if(_[_0x685d('0x75')](_0x27f0a8[_0x685d('0x2e')][_0x685d('0x51')])){for(var _0x25736b=0x0;_0x25736b<_0x27f0a8[_0x685d('0x2e')][_0x685d('0x51')][_0x685d('0x30')];_0x25736b+=0x1){socket['emit']('userOpenchannelQueue:remove',{'UserId':Number(_0x27f0a8[_0x685d('0x2e')][_0x685d('0x51')][_0x25736b]),'OpenchannelQueueId':Number(_0x27f0a8['params']['id'])});}}else{socket['emit'](_0x685d('0x76'),{'UserId':Number(_0x27f0a8[_0x685d('0x2e')][_0x685d('0x51')]),'OpenchannelQueueId':Number(_0x27f0a8['params']['id'])});}});}})['then'](respondWithStatusCode(_0x445087,null))[_0x685d('0x29')](handleError(_0x445087,null));};exports[_0x685d('0x77')]=function(_0x5bfb4f,_0x3353df){var _0x12368c={};var _0x4d4ae3={};var _0x1d1780;var _0x1f0ad6;return db[_0x685d('0x25')]['findOne']({'where':{'id':_0x5bfb4f[_0x685d('0x3c')]['id']}})[_0x685d('0x17')](handleEntityNotFound(_0x3353df,null))['then'](function(_0x24d932){if(_0x24d932){_0x1d1780=_0x24d932;_0x4d4ae3[_0x685d('0x2a')]=_[_0x685d('0x2b')](db['User']['rawAttributes']);_0x4d4ae3[_0x685d('0x2e')]=_[_0x685d('0x2b')](_0x5bfb4f[_0x685d('0x2e')]);_0x4d4ae3['filters']=_[_0x685d('0x2d')](_0x4d4ae3[_0x685d('0x2a')],_0x4d4ae3[_0x685d('0x2e')]);_0x12368c[_0x685d('0x2f')]=_[_0x685d('0x2d')](_0x4d4ae3['model'],qs[_0x685d('0x41')](_0x5bfb4f[_0x685d('0x2e')]['fields']));_0x12368c[_0x685d('0x2f')]=_0x12368c[_0x685d('0x2f')][_0x685d('0x30')]?_0x12368c[_0x685d('0x2f')]:_0x4d4ae3['model'];_0x12368c[_0x685d('0x4e')]=qs[_0x685d('0x4f')](_0x5bfb4f[_0x685d('0x2e')]['sort']);_0x12368c[_0x685d('0x43')]=qs['filters'](_[_0x685d('0x78')](_0x5bfb4f[_0x685d('0x2e')],_0x4d4ae3[_0x685d('0x2c')]));if(_0x5bfb4f[_0x685d('0x2e')][_0x685d('0x45')]){_0x12368c[_0x685d('0x43')]=_[_0x685d('0x32')](_0x12368c[_0x685d('0x43')],{'$or':_[_0x685d('0x21')](_0x12368c[_0x685d('0x2f')],function(_0x55370d){var _0x1713f1={};_0x1713f1[_0x55370d]={'$like':'%'+_0x5bfb4f[_0x685d('0x2e')][_0x685d('0x45')]+'%'};return _0x1713f1;})});}_0x12368c=_[_0x685d('0x32')]({},_0x12368c,_0x5bfb4f[_0x685d('0x33')]);return _0x1d1780[_0x685d('0x77')](_0x12368c);}})['then'](function(_0x256821){if(_0x256821){_0x1f0ad6=_0x256821[_0x685d('0x30')];if(!_0x5bfb4f[_0x685d('0x2e')][_0x685d('0x42')](_0x685d('0x79'))){_0x12368c[_0x685d('0x11')]=qs['limit'](_0x5bfb4f['query'][_0x685d('0x11')]);_0x12368c[_0x685d('0xf')]=qs[_0x685d('0xf')](_0x5bfb4f[_0x685d('0x2e')]['offset']);}return _0x1d1780[_0x685d('0x77')](_0x12368c);}})[_0x685d('0x17')](function(_0x3d4f8f){if(_0x3d4f8f){return _0x3d4f8f?{'count':_0x1f0ad6,'rows':_0x3d4f8f}:null;}})[_0x685d('0x17')](respondWithResult(_0x3353df,null))['catch'](handleError(_0x3353df,null));}; \ No newline at end of file diff --git a/server/api/openchannelQueue/openchannelQueue.events.js b/server/api/openchannelQueue/openchannelQueue.events.js index a3e909a..72ca6db 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 _0x9911=['save','update','remove','emit','hasOwnProperty','hook','events','../../mysqldb','OpenchannelQueue','setMaxListeners'];(function(_0x4d463a,_0x8bb55a){var _0x36ecb2=function(_0x144958){while(--_0x144958){_0x4d463a['push'](_0x4d463a['shift']());}};_0x36ecb2(++_0x8bb55a);}(_0x9911,0x7e));var _0x1991=function(_0x5d415c,_0x3a9b8a){_0x5d415c=_0x5d415c-0x0;var _0x4bf785=_0x9911[_0x5d415c];return _0x4bf785;};'use strict';var EventEmitter=require(_0x1991('0x0'));var OpenchannelQueue=require(_0x1991('0x1'))['db'][_0x1991('0x2')];var OpenchannelQueueEvents=new EventEmitter();OpenchannelQueueEvents[_0x1991('0x3')](0x0);var events={'afterCreate':_0x1991('0x4'),'afterUpdate':_0x1991('0x5'),'afterDestroy':_0x1991('0x6')};function emitEvent(_0x11f8e3){return function(_0x2cd206,_0x2912cf,_0x203596){OpenchannelQueueEvents['emit'](_0x11f8e3+':'+_0x2cd206['id'],_0x2cd206);OpenchannelQueueEvents[_0x1991('0x7')](_0x11f8e3,_0x2cd206);_0x203596(null);};}for(var e in events){if(events[_0x1991('0x8')](e)){var event=events[e];OpenchannelQueue[_0x1991('0x9')](e,emitEvent(event));}}module['exports']=OpenchannelQueueEvents; \ No newline at end of file +var _0x6110=['hook','events','../../mysqldb','OpenchannelQueue','setMaxListeners','save','update','emit','hasOwnProperty'];(function(_0x3dd15e,_0x1f0015){var _0x231fd0=function(_0x4f680a){while(--_0x4f680a){_0x3dd15e['push'](_0x3dd15e['shift']());}};_0x231fd0(++_0x1f0015);}(_0x6110,0x64));var _0x0611=function(_0x49b085,_0x2b458a){_0x49b085=_0x49b085-0x0;var _0x16118b=_0x6110[_0x49b085];return _0x16118b;};'use strict';var EventEmitter=require(_0x0611('0x0'));var OpenchannelQueue=require(_0x0611('0x1'))['db'][_0x0611('0x2')];var OpenchannelQueueEvents=new EventEmitter();OpenchannelQueueEvents[_0x0611('0x3')](0x0);var events={'afterCreate':_0x0611('0x4'),'afterUpdate':_0x0611('0x5'),'afterDestroy':'remove'};function emitEvent(_0x1e09fa){return function(_0x52b7fb,_0x43df2c,_0x36087d){OpenchannelQueueEvents['emit'](_0x1e09fa+':'+_0x52b7fb['id'],_0x52b7fb);OpenchannelQueueEvents[_0x0611('0x6')](_0x1e09fa,_0x52b7fb);_0x36087d(null);};}for(var e in events){if(events[_0x0611('0x7')](e)){var event=events[e];OpenchannelQueue[_0x0611('0x8')](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 3364900..4a2a3f5 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 _0x8453=['moment','bluebird','request-promise','path','../../config/environment','./openchannelQueue.attributes','exports','define','OpenchannelQueue','openchannel_queues','lodash','util'];(function(_0x575722,_0x205da7){var _0x587a1b=function(_0x1e5b9f){while(--_0x1e5b9f){_0x575722['push'](_0x575722['shift']());}};_0x587a1b(++_0x205da7);}(_0x8453,0x15a));var _0x3845=function(_0x471a9c,_0x3086b3){_0x471a9c=_0x471a9c-0x0;var _0xf5ce0b=_0x8453[_0x471a9c];return _0xf5ce0b;};'use strict';var _=require(_0x3845('0x0'));var util=require(_0x3845('0x1'));var logger=require('../../config/logger')('api');var moment=require(_0x3845('0x2'));var BPromise=require(_0x3845('0x3'));var rp=require(_0x3845('0x4'));var fs=require('fs');var path=require(_0x3845('0x5'));var rimraf=require('rimraf');var config=require(_0x3845('0x6'));var attributes=require(_0x3845('0x7'));module[_0x3845('0x8')]=function(_0x8a20d9,_0x2d6646){return _0x8a20d9[_0x3845('0x9')](_0x3845('0xa'),attributes,{'tableName':_0x3845('0xb'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0xaefd=['OpenchannelQueue','openchannel_queues','../../config/logger','api','moment','bluebird','request-promise','rimraf','../../config/environment','./openchannelQueue.attributes','exports'];(function(_0x2c91e9,_0x2fb965){var _0x13f0ff=function(_0xb39edf){while(--_0xb39edf){_0x2c91e9['push'](_0x2c91e9['shift']());}};_0x13f0ff(++_0x2fb965);}(_0xaefd,0x12b));var _0xdaef=function(_0x33561f,_0x28a605){_0x33561f=_0x33561f-0x0;var _0x33a4aa=_0xaefd[_0x33561f];return _0x33a4aa;};'use strict';var _=require('lodash');var util=require('util');var logger=require(_0xdaef('0x0'))(_0xdaef('0x1'));var moment=require(_0xdaef('0x2'));var BPromise=require(_0xdaef('0x3'));var rp=require(_0xdaef('0x4'));var fs=require('fs');var path=require('path');var rimraf=require(_0xdaef('0x5'));var config=require(_0xdaef('0x6'));var attributes=require(_0xdaef('0x7'));module[_0xdaef('0x8')]=function(_0x1f8a58,_0xd8f10c){return _0x1f8a58['define'](_0xdaef('0x9'),attributes,{'tableName':_0xdaef('0xa'),'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 36f4b9d..efd399f 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 _0xf1e5=['request','then','info','OpenchannelQueue,\x20%s,\x20%s','request\x20sent','debug','OpenchannelQueue,\x20%s,\x20%s,\x20%s','stringify','error','message','result','catch','GetOpenchannelQueue','findAll','options','raw','where','attributes','limit','map','include','model','ShowOpenchannelQueue','find','lodash','util','moment','randomstring','ioredis','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','client','http','redis','defaults','localhost','socket.io-emitter','./openchannelQueue.socket','register'];(function(_0x3dd15e,_0x1f0015){var _0x231fd0=function(_0x4f680a){while(--_0x4f680a){_0x3dd15e['push'](_0x3dd15e['shift']());}};_0x231fd0(++_0x1f0015);}(_0xf1e5,0xea));var _0x5f1e=function(_0xa33428,_0x43582e){_0xa33428=_0xa33428-0x0;var _0x4cd46b=_0xf1e5[_0xa33428];return _0x4cd46b;};'use strict';var _=require(_0x5f1e('0x0'));var util=require(_0x5f1e('0x1'));var moment=require(_0x5f1e('0x2'));var BPromise=require('bluebird');var rs=require(_0x5f1e('0x3'));var fs=require('fs');var Redis=require(_0x5f1e('0x4'));var db=require('../../mysqldb')['db'];var utils=require(_0x5f1e('0x5'));var logger=require(_0x5f1e('0x6'))(_0x5f1e('0x7'));var config=require(_0x5f1e('0x8'));var jayson=require(_0x5f1e('0x9'));var client=jayson[_0x5f1e('0xa')][_0x5f1e('0xb')]({'port':0x232a});config[_0x5f1e('0xc')]=_[_0x5f1e('0xd')](config['redis'],{'host':_0x5f1e('0xe'),'port':0x18eb});var socket=require(_0x5f1e('0xf'))(new Redis(config[_0x5f1e('0xc')]));require(_0x5f1e('0x10'))[_0x5f1e('0x11')](socket);function respondWithRpcPromise(_0x59c3f3,_0x44a1fd,_0x40191f){return new BPromise(function(_0x259eb6,_0x5c4d76){return client[_0x5f1e('0x12')](_0x59c3f3,_0x40191f)[_0x5f1e('0x13')](function(_0x40cd6f){logger[_0x5f1e('0x14')](_0x5f1e('0x15'),_0x44a1fd,_0x5f1e('0x16'));logger[_0x5f1e('0x17')](_0x5f1e('0x18'),_0x44a1fd,'request\x20sent',JSON[_0x5f1e('0x19')](_0x40cd6f));if(_0x40cd6f[_0x5f1e('0x1a')]){if(_0x40cd6f[_0x5f1e('0x1a')]['code']===0x1f4){logger['error'](_0x5f1e('0x15'),_0x44a1fd,_0x40cd6f[_0x5f1e('0x1a')][_0x5f1e('0x1b')]);return _0x5c4d76(_0x40cd6f[_0x5f1e('0x1a')][_0x5f1e('0x1b')]);}logger[_0x5f1e('0x1a')](_0x5f1e('0x15'),_0x44a1fd,_0x40cd6f[_0x5f1e('0x1a')][_0x5f1e('0x1b')]);return _0x259eb6(_0x40cd6f[_0x5f1e('0x1a')][_0x5f1e('0x1b')]);}else{logger['info']('OpenchannelQueue,\x20%s,\x20%s',_0x44a1fd,_0x5f1e('0x16'));_0x259eb6(_0x40cd6f[_0x5f1e('0x1c')][_0x5f1e('0x1b')]);}})[_0x5f1e('0x1d')](function(_0x2bb18b){logger[_0x5f1e('0x1a')](_0x5f1e('0x15'),_0x44a1fd,_0x2bb18b);_0x5c4d76(_0x2bb18b);});});}exports[_0x5f1e('0x1e')]=function(_0x3ce92a){var _0x48e805=this;return new Promise(function(_0x317fd8,_0xfeaf73){return db['OpenchannelQueue'][_0x5f1e('0x1f')]({'raw':_0x3ce92a['options']?_0x3ce92a[_0x5f1e('0x20')][_0x5f1e('0x21')]===undefined?!![]:![]:!![],'where':_0x3ce92a[_0x5f1e('0x20')]?_0x3ce92a[_0x5f1e('0x20')][_0x5f1e('0x22')]||null:null,'attributes':_0x3ce92a[_0x5f1e('0x20')]?_0x3ce92a[_0x5f1e('0x20')][_0x5f1e('0x23')]||null:null,'limit':_0x3ce92a[_0x5f1e('0x20')]?_0x3ce92a[_0x5f1e('0x20')][_0x5f1e('0x24')]||null:null,'include':_0x3ce92a[_0x5f1e('0x20')]?_0x3ce92a['options']['include']?_[_0x5f1e('0x25')](_0x3ce92a[_0x5f1e('0x20')][_0x5f1e('0x26')],function(_0x2323b8){return{'model':db[_0x2323b8[_0x5f1e('0x27')]],'as':_0x2323b8['as'],'attributes':_0x2323b8[_0x5f1e('0x23')],'include':_0x2323b8['include']?_['map'](_0x2323b8[_0x5f1e('0x26')],function(_0x2b7f1b){return{'model':db[_0x2b7f1b[_0x5f1e('0x27')]],'as':_0x2b7f1b['as'],'attributes':_0x2b7f1b['attributes'],'include':_0x2b7f1b['include']?_[_0x5f1e('0x25')](_0x2b7f1b[_0x5f1e('0x26')],function(_0x52c8b4){return{'model':db[_0x52c8b4[_0x5f1e('0x27')]],'as':_0x52c8b4['as'],'attributes':_0x52c8b4[_0x5f1e('0x23')]};}):[]};}):[]};}):[]:[]})['then'](function(_0x797be8){logger[_0x5f1e('0x14')](_0x5f1e('0x1e'),_0x3ce92a);logger['debug'](_0x5f1e('0x1e'),_0x3ce92a,JSON[_0x5f1e('0x19')](_0x797be8));_0x317fd8(_0x797be8);})[_0x5f1e('0x1d')](function(_0x2f54b4){logger[_0x5f1e('0x1a')](_0x5f1e('0x1e'),_0x2f54b4[_0x5f1e('0x1b')],_0x3ce92a);_0xfeaf73(_0x48e805[_0x5f1e('0x1a')](0x1f4,_0x2f54b4[_0x5f1e('0x1b')]));});});};exports[_0x5f1e('0x28')]=function(_0x4319c){var _0x1ec048=this;return new Promise(function(_0x217f64,_0x9f0001){return db['OpenchannelQueue'][_0x5f1e('0x29')]({'raw':_0x4319c[_0x5f1e('0x20')]?_0x4319c[_0x5f1e('0x20')][_0x5f1e('0x21')]===undefined?!![]:![]:!![],'where':_0x4319c[_0x5f1e('0x20')]?_0x4319c[_0x5f1e('0x20')][_0x5f1e('0x22')]||null:null,'attributes':_0x4319c[_0x5f1e('0x20')]?_0x4319c[_0x5f1e('0x20')][_0x5f1e('0x23')]||null:null,'include':_0x4319c['options']?_0x4319c[_0x5f1e('0x20')][_0x5f1e('0x26')]?_[_0x5f1e('0x25')](_0x4319c[_0x5f1e('0x20')][_0x5f1e('0x26')],function(_0x51cb24){return{'model':db[_0x51cb24[_0x5f1e('0x27')]],'as':_0x51cb24['as'],'attributes':_0x51cb24['attributes'],'include':_0x51cb24[_0x5f1e('0x26')]?_[_0x5f1e('0x25')](_0x51cb24['include'],function(_0x5d7028){return{'model':db[_0x5d7028['model']],'as':_0x5d7028['as'],'attributes':_0x5d7028[_0x5f1e('0x23')],'include':_0x5d7028[_0x5f1e('0x26')]?_[_0x5f1e('0x25')](_0x5d7028[_0x5f1e('0x26')],function(_0x3ea0bd){return{'model':db[_0x3ea0bd['model']],'as':_0x3ea0bd['as'],'attributes':_0x3ea0bd['attributes']};}):[]};}):[]};}):[]:[]})[_0x5f1e('0x13')](function(_0x51ffb8){logger[_0x5f1e('0x14')](_0x5f1e('0x28'),_0x4319c);logger[_0x5f1e('0x17')](_0x5f1e('0x28'),_0x4319c,JSON['stringify'](_0x51ffb8));_0x217f64(_0x51ffb8);})[_0x5f1e('0x1d')](function(_0x333845){logger[_0x5f1e('0x1a')](_0x5f1e('0x28'),_0x333845[_0x5f1e('0x1b')],_0x4319c);_0x9f0001(_0x1ec048[_0x5f1e('0x1a')](0x1f4,_0x333845[_0x5f1e('0x1b')]));});});}; \ No newline at end of file +var _0xfba7=['raw','options','attributes','include','map','model','ShowOpenchannelQueue','where','lodash','moment','bluebird','randomstring','ioredis','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','client','http','redis','defaults','localhost','./openchannelQueue.socket','register','then','request\x20sent','stringify','error','code','OpenchannelQueue,\x20%s,\x20%s','message','info','result','catch','GetOpenchannelQueue','OpenchannelQueue'];(function(_0x18474f,_0x51e0f9){var _0xab5297=function(_0x4b2327){while(--_0x4b2327){_0x18474f['push'](_0x18474f['shift']());}};_0xab5297(++_0x51e0f9);}(_0xfba7,0x10b));var _0x7fba=function(_0x1faebd,_0x1a000c){_0x1faebd=_0x1faebd-0x0;var _0x898c7d=_0xfba7[_0x1faebd];return _0x898c7d;};'use strict';var _=require(_0x7fba('0x0'));var util=require('util');var moment=require(_0x7fba('0x1'));var BPromise=require(_0x7fba('0x2'));var rs=require(_0x7fba('0x3'));var fs=require('fs');var Redis=require(_0x7fba('0x4'));var db=require('../../mysqldb')['db'];var utils=require(_0x7fba('0x5'));var logger=require(_0x7fba('0x6'))(_0x7fba('0x7'));var config=require(_0x7fba('0x8'));var jayson=require(_0x7fba('0x9'));var client=jayson[_0x7fba('0xa')][_0x7fba('0xb')]({'port':0x232a});config[_0x7fba('0xc')]=_[_0x7fba('0xd')](config[_0x7fba('0xc')],{'host':_0x7fba('0xe'),'port':0x18eb});var socket=require('socket.io-emitter')(new Redis(config[_0x7fba('0xc')]));require(_0x7fba('0xf'))[_0x7fba('0x10')](socket);function respondWithRpcPromise(_0x29142f,_0x435249,_0x20cc06){return new BPromise(function(_0x40caf5,_0x1edf78){return client['request'](_0x29142f,_0x20cc06)[_0x7fba('0x11')](function(_0x34d63f){logger['info']('OpenchannelQueue,\x20%s,\x20%s',_0x435249,_0x7fba('0x12'));logger['debug']('OpenchannelQueue,\x20%s,\x20%s,\x20%s',_0x435249,_0x7fba('0x12'),JSON[_0x7fba('0x13')](_0x34d63f));if(_0x34d63f['error']){if(_0x34d63f[_0x7fba('0x14')][_0x7fba('0x15')]===0x1f4){logger[_0x7fba('0x14')](_0x7fba('0x16'),_0x435249,_0x34d63f[_0x7fba('0x14')][_0x7fba('0x17')]);return _0x1edf78(_0x34d63f[_0x7fba('0x14')][_0x7fba('0x17')]);}logger[_0x7fba('0x14')]('OpenchannelQueue,\x20%s,\x20%s',_0x435249,_0x34d63f[_0x7fba('0x14')][_0x7fba('0x17')]);return _0x40caf5(_0x34d63f[_0x7fba('0x14')][_0x7fba('0x17')]);}else{logger[_0x7fba('0x18')]('OpenchannelQueue,\x20%s,\x20%s',_0x435249,_0x7fba('0x12'));_0x40caf5(_0x34d63f[_0x7fba('0x19')][_0x7fba('0x17')]);}})[_0x7fba('0x1a')](function(_0x2635f6){logger['error']('OpenchannelQueue,\x20%s,\x20%s',_0x435249,_0x2635f6);_0x1edf78(_0x2635f6);});});}exports[_0x7fba('0x1b')]=function(_0x4c8ef9){var _0x23ee88=this;return new Promise(function(_0x5f40db,_0x4a90b){return db[_0x7fba('0x1c')]['findAll']({'raw':_0x4c8ef9['options']?_0x4c8ef9['options'][_0x7fba('0x1d')]===undefined?!![]:![]:!![],'where':_0x4c8ef9[_0x7fba('0x1e')]?_0x4c8ef9[_0x7fba('0x1e')]['where']||null:null,'attributes':_0x4c8ef9[_0x7fba('0x1e')]?_0x4c8ef9[_0x7fba('0x1e')][_0x7fba('0x1f')]||null:null,'limit':_0x4c8ef9[_0x7fba('0x1e')]?_0x4c8ef9[_0x7fba('0x1e')]['limit']||null:null,'include':_0x4c8ef9[_0x7fba('0x1e')]?_0x4c8ef9['options'][_0x7fba('0x20')]?_[_0x7fba('0x21')](_0x4c8ef9[_0x7fba('0x1e')][_0x7fba('0x20')],function(_0x5d9fe6){return{'model':db[_0x5d9fe6[_0x7fba('0x22')]],'as':_0x5d9fe6['as'],'attributes':_0x5d9fe6[_0x7fba('0x1f')],'include':_0x5d9fe6[_0x7fba('0x20')]?_[_0x7fba('0x21')](_0x5d9fe6[_0x7fba('0x20')],function(_0x25d455){return{'model':db[_0x25d455[_0x7fba('0x22')]],'as':_0x25d455['as'],'attributes':_0x25d455['attributes'],'include':_0x25d455[_0x7fba('0x20')]?_[_0x7fba('0x21')](_0x25d455['include'],function(_0x5a0d65){return{'model':db[_0x5a0d65[_0x7fba('0x22')]],'as':_0x5a0d65['as'],'attributes':_0x5a0d65[_0x7fba('0x1f')]};}):[]};}):[]};}):[]:[]})[_0x7fba('0x11')](function(_0x2e4ce1){logger[_0x7fba('0x18')](_0x7fba('0x1b'),_0x4c8ef9);logger['debug'](_0x7fba('0x1b'),_0x4c8ef9,JSON[_0x7fba('0x13')](_0x2e4ce1));_0x5f40db(_0x2e4ce1);})[_0x7fba('0x1a')](function(_0x51d801){logger[_0x7fba('0x14')](_0x7fba('0x1b'),_0x51d801[_0x7fba('0x17')],_0x4c8ef9);_0x4a90b(_0x23ee88[_0x7fba('0x14')](0x1f4,_0x51d801[_0x7fba('0x17')]));});});};exports[_0x7fba('0x23')]=function(_0x17265d){var _0x3d7031=this;return new Promise(function(_0x5deae7,_0x11e42b){return db[_0x7fba('0x1c')]['find']({'raw':_0x17265d[_0x7fba('0x1e')]?_0x17265d[_0x7fba('0x1e')]['raw']===undefined?!![]:![]:!![],'where':_0x17265d[_0x7fba('0x1e')]?_0x17265d[_0x7fba('0x1e')][_0x7fba('0x24')]||null:null,'attributes':_0x17265d[_0x7fba('0x1e')]?_0x17265d['options'][_0x7fba('0x1f')]||null:null,'include':_0x17265d['options']?_0x17265d[_0x7fba('0x1e')]['include']?_[_0x7fba('0x21')](_0x17265d[_0x7fba('0x1e')][_0x7fba('0x20')],function(_0x122dc7){return{'model':db[_0x122dc7['model']],'as':_0x122dc7['as'],'attributes':_0x122dc7['attributes'],'include':_0x122dc7[_0x7fba('0x20')]?_[_0x7fba('0x21')](_0x122dc7[_0x7fba('0x20')],function(_0x2f3aaa){return{'model':db[_0x2f3aaa[_0x7fba('0x22')]],'as':_0x2f3aaa['as'],'attributes':_0x2f3aaa[_0x7fba('0x1f')],'include':_0x2f3aaa['include']?_[_0x7fba('0x21')](_0x2f3aaa['include'],function(_0x382647){return{'model':db[_0x382647['model']],'as':_0x382647['as'],'attributes':_0x382647[_0x7fba('0x1f')]};}):[]};}):[]};}):[]:[]})[_0x7fba('0x11')](function(_0x495047){logger[_0x7fba('0x18')](_0x7fba('0x23'),_0x17265d);logger['debug'](_0x7fba('0x23'),_0x17265d,JSON[_0x7fba('0x13')](_0x495047));_0x5deae7(_0x495047);})[_0x7fba('0x1a')](function(_0x3a74cc){logger[_0x7fba('0x14')](_0x7fba('0x23'),_0x3a74cc[_0x7fba('0x17')],_0x17265d);_0x11e42b(_0x3d7031[_0x7fba('0x14')](0x1f4,_0x3a74cc['message']));});});}; \ No newline at end of file diff --git a/server/api/openchannelQueue/openchannelQueue.socket.js b/server/api/openchannelQueue/openchannelQueue.socket.js index 930719b..9961ae8 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 _0x0df5=['remove','update','length'];(function(_0xba37ef,_0x555be8){var _0x4440c2=function(_0x5916a7){while(--_0x5916a7){_0xba37ef['push'](_0xba37ef['shift']());}};_0x4440c2(++_0x555be8);}(_0x0df5,0x18f));var _0x50df=function(_0xc8258c,_0x48f129){_0xc8258c=_0xc8258c-0x0;var _0x427736=_0x0df5[_0xc8258c];return _0x427736;};'use strict';var OpenchannelQueueEvents=require('./openchannelQueue.events');var events=['save',_0x50df('0x0'),_0x50df('0x1')];function createListener(_0x1949a1,_0x5b14b1){return function(_0x405378){_0x5b14b1['emit'](_0x1949a1,_0x405378);};}function removeListener(_0x5ffd1a,_0x693790){return function(){OpenchannelQueueEvents['removeListener'](_0x5ffd1a,_0x693790);};}exports['register']=function(_0x145b24){for(var _0x4b6582=0x0,_0x139e23=events[_0x50df('0x2')];_0x4b6582<_0x139e23;_0x4b6582++){var _0x51a779=events[_0x4b6582];var _0x5b24bc=createListener('openchannelQueue:'+_0x51a779,_0x145b24);OpenchannelQueueEvents['on'](_0x51a779,_0x5b24bc);}}; \ No newline at end of file +var _0xf7c7=['remove','update','removeListener','length','openchannelQueue:','./openchannelQueue.events'];(function(_0x151381,_0x97b314){var _0x2afab6=function(_0x4b3941){while(--_0x4b3941){_0x151381['push'](_0x151381['shift']());}};_0x2afab6(++_0x97b314);}(_0xf7c7,0x7d));var _0x7f7c=function(_0x2d6771,_0x1d2ffe){_0x2d6771=_0x2d6771-0x0;var _0x3972d3=_0xf7c7[_0x2d6771];return _0x3972d3;};'use strict';var OpenchannelQueueEvents=require(_0x7f7c('0x0'));var events=['save',_0x7f7c('0x1'),_0x7f7c('0x2')];function createListener(_0x1cd888,_0x4d6998){return function(_0x3a15f0){_0x4d6998['emit'](_0x1cd888,_0x3a15f0);};}function removeListener(_0xe90304,_0x3b0769){return function(){OpenchannelQueueEvents[_0x7f7c('0x3')](_0xe90304,_0x3b0769);};}exports['register']=function(_0x5e5598){for(var _0x552160=0x0,_0x4d2643=events[_0x7f7c('0x4')];_0x552160<_0x4d2643;_0x552160++){var _0x1c9fc0=events[_0x552160];var _0x1de432=createListener(_0x7f7c('0x5')+_0x1c9fc0,_0x5e5598);OpenchannelQueueEvents['on'](_0x1c9fc0,_0x1de432);}}; \ No newline at end of file diff --git a/server/api/openchannelQueueReport/index.js b/server/api/openchannelQueueReport/index.js index 345a01e..8dd6f91 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 _0x76b4=['put','update','delete','exports','multer','connect-timeout','express','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','./openchannelQueueReport.controller','isAuthenticated','index','get','/describe','describe','/:id','show'];(function(_0x24fa1a,_0x16d9c2){var _0xc5621f=function(_0x5616ac){while(--_0x5616ac){_0x24fa1a['push'](_0x24fa1a['shift']());}};_0xc5621f(++_0x16d9c2);}(_0x76b4,0xaf));var _0x476b=function(_0x4c83a1,_0x123f8e){_0x4c83a1=_0x4c83a1-0x0;var _0xf26040=_0x76b4[_0x4c83a1];return _0xf26040;};'use strict';var multer=require(_0x476b('0x0'));var util=require('util');var path=require('path');var timeout=require(_0x476b('0x1'));var express=require(_0x476b('0x2'));var router=express['Router']();var fs_extra=require(_0x476b('0x3'));var auth=require(_0x476b('0x4'));var interaction=require(_0x476b('0x5'));var config=require(_0x476b('0x6'));var controller=require(_0x476b('0x7'));router['get']('/',auth[_0x476b('0x8')](),controller[_0x476b('0x9')]);router[_0x476b('0xa')](_0x476b('0xb'),auth[_0x476b('0x8')](),controller[_0x476b('0xc')]);router[_0x476b('0xa')](_0x476b('0xd'),auth[_0x476b('0x8')](),controller[_0x476b('0xe')]);router['post']('/',auth[_0x476b('0x8')](),controller['create']);router[_0x476b('0xf')]('/:id',auth['isAuthenticated'](),controller[_0x476b('0x10')]);router[_0x476b('0x11')](_0x476b('0xd'),auth[_0x476b('0x8')](),controller['destroy']);module[_0x476b('0x12')]=router; \ No newline at end of file +var _0x0bb1=['update','delete','destroy','exports','multer','util','path','connect-timeout','express','Router','fs-extra','../../components/auth/service','../../config/environment','./openchannelQueueReport.controller','isAuthenticated','index','/describe','describe','get','/:id','show','post','create','put'];(function(_0x2fd96d,_0x371b9d){var _0x451e85=function(_0x3596c3){while(--_0x3596c3){_0x2fd96d['push'](_0x2fd96d['shift']());}};_0x451e85(++_0x371b9d);}(_0x0bb1,0x1cc));var _0x10bb=function(_0x4f217f,_0x313163){_0x4f217f=_0x4f217f-0x0;var _0x3b583a=_0x0bb1[_0x4f217f];return _0x3b583a;};'use strict';var multer=require(_0x10bb('0x0'));var util=require(_0x10bb('0x1'));var path=require(_0x10bb('0x2'));var timeout=require(_0x10bb('0x3'));var express=require(_0x10bb('0x4'));var router=express[_0x10bb('0x5')]();var fs_extra=require(_0x10bb('0x6'));var auth=require(_0x10bb('0x7'));var interaction=require('../../components/interaction/service');var config=require(_0x10bb('0x8'));var controller=require(_0x10bb('0x9'));router['get']('/',auth[_0x10bb('0xa')](),controller[_0x10bb('0xb')]);router['get'](_0x10bb('0xc'),auth['isAuthenticated'](),controller[_0x10bb('0xd')]);router[_0x10bb('0xe')](_0x10bb('0xf'),auth[_0x10bb('0xa')](),controller[_0x10bb('0x10')]);router[_0x10bb('0x11')]('/',auth[_0x10bb('0xa')](),controller[_0x10bb('0x12')]);router[_0x10bb('0x13')](_0x10bb('0xf'),auth['isAuthenticated'](),controller[_0x10bb('0x14')]);router[_0x10bb('0x15')](_0x10bb('0xf'),auth[_0x10bb('0xa')](),controller[_0x10bb('0x16')]);module[_0x10bb('0x17')]=router; \ No newline at end of file diff --git a/server/api/openchannelQueueReport/openchannelQueueReport.attributes.js b/server/api/openchannelQueueReport/openchannelQueueReport.attributes.js index 709b1e8..495ea6f 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 _0x77c6=['DATE','moment','STRING'];(function(_0xc0abd6,_0x577fcb){var _0x27161a=function(_0x574735){while(--_0x574735){_0xc0abd6['push'](_0xc0abd6['shift']());}};_0x27161a(++_0x577fcb);}(_0x77c6,0x1b7));var _0x677c=function(_0x5ee384,_0x48c600){_0x5ee384=_0x5ee384-0x0;var _0x316ca4=_0x77c6[_0x5ee384];return _0x316ca4;};'use strict';var moment=require(_0x677c('0x0'));var Sequelize=require('sequelize');module['exports']={'uniqueid':{'type':Sequelize[_0x677c('0x1')],'allowNull':![]},'from':{'type':Sequelize['STRING']},'joinAt':{'type':Sequelize[_0x677c('0x2')]},'leaveAt':{'type':Sequelize[_0x677c('0x2')]},'acceptAt':{'type':Sequelize[_0x677c('0x2')]},'exitAt':{'type':Sequelize[_0x677c('0x2')]},'reason':{'type':Sequelize[_0x677c('0x1')]}}; \ No newline at end of file +var _0x22f1=['moment','STRING','DATE'];(function(_0x41b654,_0x39239c){var _0x55c219=function(_0x1f55c0){while(--_0x1f55c0){_0x41b654['push'](_0x41b654['shift']());}};_0x55c219(++_0x39239c);}(_0x22f1,0xbd));var _0x122f=function(_0x3fd932,_0x4346e3){_0x3fd932=_0x3fd932-0x0;var _0x7771de=_0x22f1[_0x3fd932];return _0x7771de;};'use strict';var moment=require(_0x122f('0x0'));var Sequelize=require('sequelize');module['exports']={'uniqueid':{'type':Sequelize[_0x122f('0x1')],'allowNull':![]},'from':{'type':Sequelize['STRING']},'joinAt':{'type':Sequelize[_0x122f('0x2')]},'leaveAt':{'type':Sequelize[_0x122f('0x2')]},'acceptAt':{'type':Sequelize[_0x122f('0x2')]},'exitAt':{'type':Sequelize[_0x122f('0x2')]},'reason':{'type':Sequelize[_0x122f('0x1')]}}; \ No newline at end of file diff --git a/server/api/openchannelQueueReport/openchannelQueueReport.controller.js b/server/api/openchannelQueueReport/openchannelQueueReport.controller.js index 2f77d51..5644132 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 _0xedd3=['eml-format','rimraf','fast-json-patch','request-promise','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/utils','../../config/environment','../../mysqldb','status','json','offset','undefined','limit','count','set','Content-Range','apply','reject','save','update','then','end','error','stack','name','send','index','map','OpenchannelQueueReport','rawAttributes','fieldName','key','model','query','keys','intersection','attributes','length','nolimit','order','sort','where','filters','pick','filter','type','merge','options','includeAll','include','findAll','rows','catch','params','fields','find','create','body','describe'];(function(_0x1b6b79,_0xb1986e){var _0x2b2b46=function(_0xbacbd2){while(--_0xbacbd2){_0x1b6b79['push'](_0x1b6b79['shift']());}};_0x2b2b46(++_0xb1986e);}(_0xedd3,0xed));var _0x3edd=function(_0x199572,_0x33e667){_0x199572=_0x199572-0x0;var _0x13cfa3=_0xedd3[_0x199572];return _0x13cfa3;};'use strict';var emlformat=require(_0x3edd('0x0'));var rimraf=require(_0x3edd('0x1'));var zipdir=require('zip-dir');var jsonpatch=require(_0x3edd('0x2'));var rp=require(_0x3edd('0x3'));var moment=require('moment');var BPromise=require(_0x3edd('0x4'));var Mustache=require(_0x3edd('0x5'));var util=require(_0x3edd('0x6'));var path=require(_0x3edd('0x7'));var sox=require(_0x3edd('0x8'));var csv=require(_0x3edd('0x9'));var ejs=require(_0x3edd('0xa'));var fs=require('fs');var fs_extra=require(_0x3edd('0xb'));var _=require(_0x3edd('0xc'));var squel=require(_0x3edd('0xd'));var crypto=require('crypto');var jsforce=require(_0x3edd('0xe'));var deskjs=require(_0x3edd('0xf'));var toCsv=require('to-csv');var querystring=require(_0x3edd('0x10'));var Papa=require(_0x3edd('0x11'));var Redis=require(_0x3edd('0x12'));var authService=require(_0x3edd('0x13'));var qs=require(_0x3edd('0x14'));var as=require(_0x3edd('0x15'));var hardwareService=require(_0x3edd('0x16'));var logger=require(_0x3edd('0x17'))(_0x3edd('0x18'));var utils=require(_0x3edd('0x19'));var config=require(_0x3edd('0x1a'));var licenseUtil=require('../../config/license/util');var db=require(_0x3edd('0x1b'))['db'];function respondWithStatusCode(_0x2956df,_0x5074b8){_0x5074b8=_0x5074b8||0xcc;return function(_0x49311b){if(_0x49311b){return _0x2956df['sendStatus'](_0x5074b8);}return _0x2956df['status'](_0x5074b8)['end']();};}function respondWithResult(_0x52cfa5,_0x1f3173){_0x1f3173=_0x1f3173||0xc8;return function(_0x5ad0fe){if(_0x5ad0fe){return _0x52cfa5[_0x3edd('0x1c')](_0x1f3173)[_0x3edd('0x1d')](_0x5ad0fe);}};}function respondWithFilteredResult(_0x29f0cb,_0x47274f){return function(_0x1daf91){if(_0x1daf91){var _0x10cc5e=typeof _0x47274f[_0x3edd('0x1e')]===_0x3edd('0x1f')&&typeof _0x47274f[_0x3edd('0x20')]===_0x3edd('0x1f');var _0x1c624b=_0x1daf91['count'];var _0x468fc2=_0x10cc5e?0x0:_0x47274f[_0x3edd('0x1e')];var _0x26d2b9=_0x10cc5e?_0x1daf91[_0x3edd('0x21')]:_0x47274f[_0x3edd('0x1e')]+_0x47274f['limit'];var _0x33afed;if(_0x26d2b9>=_0x1c624b){_0x26d2b9=_0x1c624b;_0x33afed=0xc8;}else{_0x33afed=0xce;}_0x29f0cb[_0x3edd('0x1c')](_0x33afed);return _0x29f0cb[_0x3edd('0x22')](_0x3edd('0x23'),_0x468fc2+'-'+_0x26d2b9+'/'+_0x1c624b)[_0x3edd('0x1d')](_0x1daf91);}return null;};}function patchUpdates(_0x15fa18){return function(_0x325f24){try{jsonpatch[_0x3edd('0x24')](_0x325f24,_0x15fa18,!![]);}catch(_0x552346){return BPromise[_0x3edd('0x25')](_0x552346);}return _0x325f24[_0x3edd('0x26')]();};}function saveUpdates(_0x45f67b,_0xa7bfa2){return function(_0x3f321f){if(_0x3f321f){return _0x3f321f[_0x3edd('0x27')](_0x45f67b)[_0x3edd('0x28')](function(_0x197ad1){return _0x197ad1;});}return null;};}function removeEntity(_0x46b50c,_0x2113ec){return function(_0x16225c){if(_0x16225c){return _0x16225c['destroy']()['then'](function(){_0x46b50c['status'](0xcc)[_0x3edd('0x29')]();});}};}function handleEntityNotFound(_0x46987d,_0x16b31f){return function(_0x345b0a){if(!_0x345b0a){_0x46987d['sendStatus'](0x194);}return _0x345b0a;};}function handleError(_0x395eb7,_0xa39fd2){_0xa39fd2=_0xa39fd2||0x1f4;return function(_0x191258){logger[_0x3edd('0x2a')](_0x191258[_0x3edd('0x2b')]);if(_0x191258[_0x3edd('0x2c')]){delete _0x191258[_0x3edd('0x2c')];}_0x395eb7[_0x3edd('0x1c')](_0xa39fd2)[_0x3edd('0x2d')](_0x191258);};}exports[_0x3edd('0x2e')]=function(_0x4b042d,_0x5b58d3){var _0x15befd={},_0x1633b1={},_0x1968f2={'count':0x0,'rows':[]};var _0x446ad6=_[_0x3edd('0x2f')](db[_0x3edd('0x30')][_0x3edd('0x31')],function(_0x8eae42){return{'name':_0x8eae42[_0x3edd('0x32')],'type':_0x8eae42['type'][_0x3edd('0x33')]};});_0x1633b1[_0x3edd('0x34')]=_['map'](_0x446ad6,_0x3edd('0x2c'));_0x1633b1[_0x3edd('0x35')]=_[_0x3edd('0x36')](_0x4b042d[_0x3edd('0x35')]);_0x1633b1['filters']=_[_0x3edd('0x37')](_0x1633b1[_0x3edd('0x34')],_0x1633b1[_0x3edd('0x35')]);_0x15befd[_0x3edd('0x38')]=_[_0x3edd('0x37')](_0x1633b1[_0x3edd('0x34')],qs['fields'](_0x4b042d[_0x3edd('0x35')]['fields']));_0x15befd[_0x3edd('0x38')]=_0x15befd[_0x3edd('0x38')][_0x3edd('0x39')]?_0x15befd[_0x3edd('0x38')]:_0x1633b1['model'];if(!_0x4b042d['query']['hasOwnProperty'](_0x3edd('0x3a'))){_0x15befd[_0x3edd('0x20')]=qs[_0x3edd('0x20')](_0x4b042d[_0x3edd('0x35')][_0x3edd('0x20')]);_0x15befd[_0x3edd('0x1e')]=qs[_0x3edd('0x1e')](_0x4b042d[_0x3edd('0x35')]['offset']);}_0x15befd[_0x3edd('0x3b')]=qs[_0x3edd('0x3c')](_0x4b042d['query'][_0x3edd('0x3c')]);_0x15befd[_0x3edd('0x3d')]=qs[_0x3edd('0x3e')](_[_0x3edd('0x3f')](_0x4b042d[_0x3edd('0x35')],_0x1633b1['filters']),_0x446ad6);if(_0x4b042d['query'][_0x3edd('0x40')]){_0x15befd[_0x3edd('0x3d')]=_['merge'](_0x15befd[_0x3edd('0x3d')],{'$or':_['map'](_0x446ad6,function(_0x3b0aba){if(_0x3b0aba[_0x3edd('0x41')]!=='VIRTUAL'){var _0xecbacd={};_0xecbacd[_0x3b0aba[_0x3edd('0x2c')]]={'$like':'%'+_0x4b042d[_0x3edd('0x35')][_0x3edd('0x40')]+'%'};return _0xecbacd;}})});}_0x15befd=_[_0x3edd('0x42')]({},_0x15befd,_0x4b042d[_0x3edd('0x43')]);var _0x285446={'where':_0x15befd[_0x3edd('0x3d')]};return db[_0x3edd('0x30')][_0x3edd('0x21')](_0x285446)[_0x3edd('0x28')](function(_0x26bc0d){_0x1968f2[_0x3edd('0x21')]=_0x26bc0d;if(_0x4b042d['query'][_0x3edd('0x44')]){_0x15befd[_0x3edd('0x45')]=[{'all':!![]}];}return db[_0x3edd('0x30')][_0x3edd('0x46')](_0x15befd);})[_0x3edd('0x28')](function(_0x410964){_0x1968f2[_0x3edd('0x47')]=_0x410964;return _0x1968f2;})[_0x3edd('0x28')](respondWithFilteredResult(_0x5b58d3,_0x15befd))[_0x3edd('0x48')](handleError(_0x5b58d3,null));};exports['show']=function(_0x26487f,_0x41aaf5){var _0x2de747={'raw':!![],'where':{'id':_0x26487f[_0x3edd('0x49')]['id']}},_0xf561d0={};_0xf561d0[_0x3edd('0x34')]=_[_0x3edd('0x36')](db['OpenchannelQueueReport'][_0x3edd('0x31')]);_0xf561d0[_0x3edd('0x35')]=_[_0x3edd('0x36')](_0x26487f[_0x3edd('0x35')]);_0xf561d0['filters']=_[_0x3edd('0x37')](_0xf561d0[_0x3edd('0x34')],_0xf561d0[_0x3edd('0x35')]);_0x2de747['attributes']=_[_0x3edd('0x37')](_0xf561d0[_0x3edd('0x34')],qs[_0x3edd('0x4a')](_0x26487f[_0x3edd('0x35')]['fields']));_0x2de747[_0x3edd('0x38')]=_0x2de747[_0x3edd('0x38')][_0x3edd('0x39')]?_0x2de747[_0x3edd('0x38')]:_0xf561d0[_0x3edd('0x34')];if(_0x26487f[_0x3edd('0x35')][_0x3edd('0x44')]){_0x2de747[_0x3edd('0x45')]=[{'all':!![]}];}_0x2de747=_[_0x3edd('0x42')]({},_0x2de747,_0x26487f[_0x3edd('0x43')]);return db[_0x3edd('0x30')][_0x3edd('0x4b')](_0x2de747)['then'](handleEntityNotFound(_0x41aaf5,null))[_0x3edd('0x28')](respondWithResult(_0x41aaf5,null))[_0x3edd('0x48')](handleError(_0x41aaf5,null));};exports['create']=function(_0x521260,_0x399a63){return db['OpenchannelQueueReport'][_0x3edd('0x4c')](_0x521260[_0x3edd('0x4d')],{})[_0x3edd('0x28')](respondWithResult(_0x399a63,0xc9))[_0x3edd('0x48')](handleError(_0x399a63,null));};exports[_0x3edd('0x27')]=function(_0x42e8a2,_0x42fac5){if(_0x42e8a2[_0x3edd('0x4d')]['id']){delete _0x42e8a2[_0x3edd('0x4d')]['id'];}return db[_0x3edd('0x30')][_0x3edd('0x4b')]({'where':{'id':_0x42e8a2['params']['id']}})[_0x3edd('0x28')](handleEntityNotFound(_0x42fac5,null))[_0x3edd('0x28')](saveUpdates(_0x42e8a2[_0x3edd('0x4d')],null))[_0x3edd('0x28')](respondWithResult(_0x42fac5,null))[_0x3edd('0x48')](handleError(_0x42fac5,null));};exports['destroy']=function(_0x1277bd,_0x5d25a7){return db[_0x3edd('0x30')][_0x3edd('0x4b')]({'where':{'id':_0x1277bd[_0x3edd('0x49')]['id']}})[_0x3edd('0x28')](handleEntityNotFound(_0x5d25a7,null))[_0x3edd('0x28')](removeEntity(_0x5d25a7,null))[_0x3edd('0x48')](handleError(_0x5d25a7,null));};exports['describe']=function(_0x539b76,_0x22a67b){return db[_0x3edd('0x30')][_0x3edd('0x4e')]()['then'](respondWithResult(_0x22a67b,null))[_0x3edd('0x48')](handleError(_0x22a67b,null));}; \ No newline at end of file +var _0x8a76=['params','keys','includeAll','create','body','find','describe','eml-format','rimraf','zip-dir','moment','bluebird','mustache','util','sox','ejs','fs-extra','lodash','crypto','desk.js','querystring','papaparse','../../components/auth/service','../../components/parsers/advancedSearch','api','../../config/utils','../../config/license/util','../../mysqldb','end','status','json','offset','undefined','limit','count','Content-Range','apply','reject','save','update','then','destroy','sendStatus','error','stack','name','send','map','OpenchannelQueueReport','rawAttributes','fieldName','type','model','query','filters','intersection','attributes','fields','length','order','sort','where','merge','filter','options','include','rows','catch','show'];(function(_0x3dd15e,_0x1f0015){var _0x231fd0=function(_0x4f680a){while(--_0x4f680a){_0x3dd15e['push'](_0x3dd15e['shift']());}};_0x231fd0(++_0x1f0015);}(_0x8a76,0x91));var _0x68a7=function(_0x5dc64c,_0x119d0f){_0x5dc64c=_0x5dc64c-0x0;var _0x27f870=_0x8a76[_0x5dc64c];return _0x27f870;};'use strict';var emlformat=require(_0x68a7('0x0'));var rimraf=require(_0x68a7('0x1'));var zipdir=require(_0x68a7('0x2'));var jsonpatch=require('fast-json-patch');var rp=require('request-promise');var moment=require(_0x68a7('0x3'));var BPromise=require(_0x68a7('0x4'));var Mustache=require(_0x68a7('0x5'));var util=require(_0x68a7('0x6'));var path=require('path');var sox=require(_0x68a7('0x7'));var csv=require('to-csv');var ejs=require(_0x68a7('0x8'));var fs=require('fs');var fs_extra=require(_0x68a7('0x9'));var _=require(_0x68a7('0xa'));var squel=require('squel');var crypto=require(_0x68a7('0xb'));var jsforce=require('jsforce');var deskjs=require(_0x68a7('0xc'));var toCsv=require('to-csv');var querystring=require(_0x68a7('0xd'));var Papa=require(_0x68a7('0xe'));var Redis=require('ioredis');var authService=require(_0x68a7('0xf'));var qs=require('../../components/parsers/qs');var as=require(_0x68a7('0x10'));var hardwareService=require('../../config/license/hardware');var logger=require('../../config/logger')(_0x68a7('0x11'));var utils=require(_0x68a7('0x12'));var config=require('../../config/environment');var licenseUtil=require(_0x68a7('0x13'));var db=require(_0x68a7('0x14'))['db'];function respondWithStatusCode(_0x1ac040,_0x386073){_0x386073=_0x386073||0xcc;return function(_0x39e6a2){if(_0x39e6a2){return _0x1ac040['sendStatus'](_0x386073);}return _0x1ac040['status'](_0x386073)[_0x68a7('0x15')]();};}function respondWithResult(_0x23ee53,_0x2986ae){_0x2986ae=_0x2986ae||0xc8;return function(_0x39f477){if(_0x39f477){return _0x23ee53[_0x68a7('0x16')](_0x2986ae)[_0x68a7('0x17')](_0x39f477);}};}function respondWithFilteredResult(_0x304232,_0x4f56b5){return function(_0x1bdc77){if(_0x1bdc77){var _0x39dbd7=typeof _0x4f56b5[_0x68a7('0x18')]===_0x68a7('0x19')&&typeof _0x4f56b5[_0x68a7('0x1a')]===_0x68a7('0x19');var _0x3453c0=_0x1bdc77[_0x68a7('0x1b')];var _0x2cc253=_0x39dbd7?0x0:_0x4f56b5['offset'];var _0x3a1d06=_0x39dbd7?_0x1bdc77[_0x68a7('0x1b')]:_0x4f56b5[_0x68a7('0x18')]+_0x4f56b5['limit'];var _0x2e9797;if(_0x3a1d06>=_0x3453c0){_0x3a1d06=_0x3453c0;_0x2e9797=0xc8;}else{_0x2e9797=0xce;}_0x304232[_0x68a7('0x16')](_0x2e9797);return _0x304232['set'](_0x68a7('0x1c'),_0x2cc253+'-'+_0x3a1d06+'/'+_0x3453c0)[_0x68a7('0x17')](_0x1bdc77);}return null;};}function patchUpdates(_0x181dbc){return function(_0x46057b){try{jsonpatch[_0x68a7('0x1d')](_0x46057b,_0x181dbc,!![]);}catch(_0x4b0723){return BPromise[_0x68a7('0x1e')](_0x4b0723);}return _0x46057b[_0x68a7('0x1f')]();};}function saveUpdates(_0x13116c,_0x48a794){return function(_0x49606e){if(_0x49606e){return _0x49606e[_0x68a7('0x20')](_0x13116c)[_0x68a7('0x21')](function(_0x375632){return _0x375632;});}return null;};}function removeEntity(_0x561060,_0x5bedfa){return function(_0x3d05ea){if(_0x3d05ea){return _0x3d05ea[_0x68a7('0x22')]()[_0x68a7('0x21')](function(){_0x561060[_0x68a7('0x16')](0xcc)[_0x68a7('0x15')]();});}};}function handleEntityNotFound(_0x508d14,_0x395bf3){return function(_0x5e4c38){if(!_0x5e4c38){_0x508d14[_0x68a7('0x23')](0x194);}return _0x5e4c38;};}function handleError(_0x36e008,_0x37b036){_0x37b036=_0x37b036||0x1f4;return function(_0x47da34){logger[_0x68a7('0x24')](_0x47da34[_0x68a7('0x25')]);if(_0x47da34['name']){delete _0x47da34[_0x68a7('0x26')];}_0x36e008['status'](_0x37b036)[_0x68a7('0x27')](_0x47da34);};}exports['index']=function(_0x2f67c0,_0x3e781f){var _0x99e613={},_0x4eddec={},_0xa0105b={'count':0x0,'rows':[]};var _0x5e236b=_[_0x68a7('0x28')](db[_0x68a7('0x29')][_0x68a7('0x2a')],function(_0x308c25){return{'name':_0x308c25[_0x68a7('0x2b')],'type':_0x308c25[_0x68a7('0x2c')]['key']};});_0x4eddec[_0x68a7('0x2d')]=_[_0x68a7('0x28')](_0x5e236b,'name');_0x4eddec[_0x68a7('0x2e')]=_['keys'](_0x2f67c0[_0x68a7('0x2e')]);_0x4eddec[_0x68a7('0x2f')]=_[_0x68a7('0x30')](_0x4eddec[_0x68a7('0x2d')],_0x4eddec[_0x68a7('0x2e')]);_0x99e613[_0x68a7('0x31')]=_[_0x68a7('0x30')](_0x4eddec[_0x68a7('0x2d')],qs[_0x68a7('0x32')](_0x2f67c0['query'][_0x68a7('0x32')]));_0x99e613['attributes']=_0x99e613['attributes'][_0x68a7('0x33')]?_0x99e613[_0x68a7('0x31')]:_0x4eddec['model'];if(!_0x2f67c0[_0x68a7('0x2e')]['hasOwnProperty']('nolimit')){_0x99e613[_0x68a7('0x1a')]=qs[_0x68a7('0x1a')](_0x2f67c0[_0x68a7('0x2e')][_0x68a7('0x1a')]);_0x99e613[_0x68a7('0x18')]=qs[_0x68a7('0x18')](_0x2f67c0[_0x68a7('0x2e')][_0x68a7('0x18')]);}_0x99e613[_0x68a7('0x34')]=qs['sort'](_0x2f67c0['query'][_0x68a7('0x35')]);_0x99e613[_0x68a7('0x36')]=qs[_0x68a7('0x2f')](_['pick'](_0x2f67c0['query'],_0x4eddec[_0x68a7('0x2f')]),_0x5e236b);if(_0x2f67c0[_0x68a7('0x2e')]['filter']){_0x99e613[_0x68a7('0x36')]=_[_0x68a7('0x37')](_0x99e613[_0x68a7('0x36')],{'$or':_[_0x68a7('0x28')](_0x5e236b,function(_0x3eded1){if(_0x3eded1[_0x68a7('0x2c')]!=='VIRTUAL'){var _0x52f9d1={};_0x52f9d1[_0x3eded1['name']]={'$like':'%'+_0x2f67c0[_0x68a7('0x2e')][_0x68a7('0x38')]+'%'};return _0x52f9d1;}})});}_0x99e613=_[_0x68a7('0x37')]({},_0x99e613,_0x2f67c0[_0x68a7('0x39')]);var _0x3c9fc7={'where':_0x99e613['where']};return db['OpenchannelQueueReport'][_0x68a7('0x1b')](_0x3c9fc7)[_0x68a7('0x21')](function(_0x40fc61){_0xa0105b[_0x68a7('0x1b')]=_0x40fc61;if(_0x2f67c0[_0x68a7('0x2e')]['includeAll']){_0x99e613[_0x68a7('0x3a')]=[{'all':!![]}];}return db[_0x68a7('0x29')]['findAll'](_0x99e613);})[_0x68a7('0x21')](function(_0x59632b){_0xa0105b[_0x68a7('0x3b')]=_0x59632b;return _0xa0105b;})[_0x68a7('0x21')](respondWithFilteredResult(_0x3e781f,_0x99e613))[_0x68a7('0x3c')](handleError(_0x3e781f,null));};exports[_0x68a7('0x3d')]=function(_0x4797ec,_0x470a64){var _0x3738ee={'raw':!![],'where':{'id':_0x4797ec[_0x68a7('0x3e')]['id']}},_0x274e22={};_0x274e22[_0x68a7('0x2d')]=_[_0x68a7('0x3f')](db[_0x68a7('0x29')][_0x68a7('0x2a')]);_0x274e22[_0x68a7('0x2e')]=_[_0x68a7('0x3f')](_0x4797ec['query']);_0x274e22[_0x68a7('0x2f')]=_[_0x68a7('0x30')](_0x274e22['model'],_0x274e22[_0x68a7('0x2e')]);_0x3738ee[_0x68a7('0x31')]=_[_0x68a7('0x30')](_0x274e22[_0x68a7('0x2d')],qs['fields'](_0x4797ec[_0x68a7('0x2e')][_0x68a7('0x32')]));_0x3738ee[_0x68a7('0x31')]=_0x3738ee[_0x68a7('0x31')]['length']?_0x3738ee[_0x68a7('0x31')]:_0x274e22['model'];if(_0x4797ec[_0x68a7('0x2e')][_0x68a7('0x40')]){_0x3738ee[_0x68a7('0x3a')]=[{'all':!![]}];}_0x3738ee=_['merge']({},_0x3738ee,_0x4797ec[_0x68a7('0x39')]);return db[_0x68a7('0x29')]['find'](_0x3738ee)['then'](handleEntityNotFound(_0x470a64,null))['then'](respondWithResult(_0x470a64,null))[_0x68a7('0x3c')](handleError(_0x470a64,null));};exports['create']=function(_0x59f4af,_0x4d2b48){return db['OpenchannelQueueReport'][_0x68a7('0x41')](_0x59f4af[_0x68a7('0x42')],{})[_0x68a7('0x21')](respondWithResult(_0x4d2b48,0xc9))[_0x68a7('0x3c')](handleError(_0x4d2b48,null));};exports[_0x68a7('0x20')]=function(_0x1ce26d,_0x5325aa){if(_0x1ce26d[_0x68a7('0x42')]['id']){delete _0x1ce26d[_0x68a7('0x42')]['id'];}return db['OpenchannelQueueReport']['find']({'where':{'id':_0x1ce26d['params']['id']}})[_0x68a7('0x21')](handleEntityNotFound(_0x5325aa,null))[_0x68a7('0x21')](saveUpdates(_0x1ce26d[_0x68a7('0x42')],null))[_0x68a7('0x21')](respondWithResult(_0x5325aa,null))[_0x68a7('0x3c')](handleError(_0x5325aa,null));};exports['destroy']=function(_0x37a3e9,_0xfd8a09){return db[_0x68a7('0x29')][_0x68a7('0x43')]({'where':{'id':_0x37a3e9[_0x68a7('0x3e')]['id']}})[_0x68a7('0x21')](handleEntityNotFound(_0xfd8a09,null))[_0x68a7('0x21')](removeEntity(_0xfd8a09,null))[_0x68a7('0x3c')](handleError(_0xfd8a09,null));};exports[_0x68a7('0x44')]=function(_0x1e8647,_0x160b89){return db[_0x68a7('0x29')][_0x68a7('0x44')]()[_0x68a7('0x21')](respondWithResult(_0x160b89,null))['catch'](handleError(_0x160b89,null));}; \ No newline at end of file diff --git a/server/api/openchannelQueueReport/openchannelQueueReport.model.js b/server/api/openchannelQueueReport/openchannelQueueReport.model.js index 7eff6b1..a3ba831 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 _0xc4aa=['bluebird','../../config/environment','./openchannelQueueReport.attributes','exports','define','OpenchannelQueueReport','report_openchannel_queue','lodash','util','../../config/logger','api','moment'];(function(_0x37a6b5,_0x530367){var _0x481ab4=function(_0x2221ab){while(--_0x2221ab){_0x37a6b5['push'](_0x37a6b5['shift']());}};_0x481ab4(++_0x530367);}(_0xc4aa,0x1b7));var _0xac4a=function(_0x45d55e,_0x2fede3){_0x45d55e=_0x45d55e-0x0;var _0x29812a=_0xc4aa[_0x45d55e];return _0x29812a;};'use strict';var _=require(_0xac4a('0x0'));var util=require(_0xac4a('0x1'));var logger=require(_0xac4a('0x2'))(_0xac4a('0x3'));var moment=require(_0xac4a('0x4'));var BPromise=require(_0xac4a('0x5'));var rp=require('request-promise');var fs=require('fs');var path=require('path');var rimraf=require('rimraf');var config=require(_0xac4a('0x6'));var attributes=require(_0xac4a('0x7'));module[_0xac4a('0x8')]=function(_0x215f39,_0x96be2b){return _0x215f39[_0xac4a('0x9')](_0xac4a('0xa'),attributes,{'tableName':_0xac4a('0xb'),'paranoid':![],'indexes':[{'name':'uniqueid','fields':['uniqueid']}],'timestamps':!![]});}; \ No newline at end of file +var _0x814b=['../../config/logger','api','moment','bluebird','path','rimraf','../../config/environment','./openchannelQueueReport.attributes','exports','define','OpenchannelQueueReport','uniqueid','lodash','util'];(function(_0xfb0cfd,_0x500179){var _0x2fd8aa=function(_0xccb501){while(--_0xccb501){_0xfb0cfd['push'](_0xfb0cfd['shift']());}};_0x2fd8aa(++_0x500179);}(_0x814b,0x1a2));var _0xb814=function(_0x4b7d87,_0x238711){_0x4b7d87=_0x4b7d87-0x0;var _0x3b9f82=_0x814b[_0x4b7d87];return _0x3b9f82;};'use strict';var _=require(_0xb814('0x0'));var util=require(_0xb814('0x1'));var logger=require(_0xb814('0x2'))(_0xb814('0x3'));var moment=require(_0xb814('0x4'));var BPromise=require(_0xb814('0x5'));var rp=require('request-promise');var fs=require('fs');var path=require(_0xb814('0x6'));var rimraf=require(_0xb814('0x7'));var config=require(_0xb814('0x8'));var attributes=require(_0xb814('0x9'));module[_0xb814('0xa')]=function(_0x322a70,_0x53e507){return _0x322a70[_0xb814('0xb')](_0xb814('0xc'),attributes,{'tableName':'report_openchannel_queue','paranoid':![],'indexes':[{'name':_0xb814('0xd'),'fields':[_0xb814('0xd')]}],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/openchannelQueueReport/openchannelQueueReport.rpc.js b/server/api/openchannelQueueReport/openchannelQueueReport.rpc.js index 33f88f1..673ffb5 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 _0xaebd=['rpc','../../config/environment','jayson/promise','client','request','then','info','request\x20sent','OpenchannelQueueReport,\x20%s,\x20%s,\x20%s','stringify','error','message','OpenchannelQueueReport,\x20%s,\x20%s','catch','CreateOpenchannelQueueReport','create','options','raw','debug','OpenchannelQueueReport','update','body','limit','UpdateOpenchannelQueueReport','lodash','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/logger'];(function(_0x51d179,_0x5657d5){var _0x2ee3ae=function(_0x56d6a2){while(--_0x56d6a2){_0x51d179['push'](_0x51d179['shift']());}};_0x2ee3ae(++_0x5657d5);}(_0xaebd,0x1e9));var _0xdaeb=function(_0x583513,_0x34e323){_0x583513=_0x583513-0x0;var _0x15e3ec=_0xaebd[_0x583513];return _0x15e3ec;};'use strict';var _=require(_0xdaeb('0x0'));var util=require('util');var moment=require(_0xdaeb('0x1'));var BPromise=require(_0xdaeb('0x2'));var rs=require(_0xdaeb('0x3'));var fs=require('fs');var Redis=require(_0xdaeb('0x4'));var db=require(_0xdaeb('0x5'))['db'];var utils=require('../../config/utils');var logger=require(_0xdaeb('0x6'))(_0xdaeb('0x7'));var config=require(_0xdaeb('0x8'));var jayson=require(_0xdaeb('0x9'));var client=jayson[_0xdaeb('0xa')]['http']({'port':0x232a});function respondWithRpcPromise(_0x3ea090,_0x3f7ba1,_0x52c717){return new BPromise(function(_0x550bd9,_0x1b9d37){return client[_0xdaeb('0xb')](_0x3ea090,_0x52c717)[_0xdaeb('0xc')](function(_0x5e0ae9){logger[_0xdaeb('0xd')]('OpenchannelQueueReport,\x20%s,\x20%s',_0x3f7ba1,_0xdaeb('0xe'));logger['debug'](_0xdaeb('0xf'),_0x3f7ba1,'request\x20sent',JSON[_0xdaeb('0x10')](_0x5e0ae9));if(_0x5e0ae9[_0xdaeb('0x11')]){if(_0x5e0ae9['error']['code']===0x1f4){logger[_0xdaeb('0x11')]('OpenchannelQueueReport,\x20%s,\x20%s',_0x3f7ba1,_0x5e0ae9[_0xdaeb('0x11')][_0xdaeb('0x12')]);return _0x1b9d37(_0x5e0ae9[_0xdaeb('0x11')][_0xdaeb('0x12')]);}logger[_0xdaeb('0x11')](_0xdaeb('0x13'),_0x3f7ba1,_0x5e0ae9[_0xdaeb('0x11')]['message']);return _0x550bd9(_0x5e0ae9['error'][_0xdaeb('0x12')]);}else{logger[_0xdaeb('0xd')](_0xdaeb('0x13'),_0x3f7ba1,_0xdaeb('0xe'));_0x550bd9(_0x5e0ae9['result']['message']);}})[_0xdaeb('0x14')](function(_0x4dd803){logger['error'](_0xdaeb('0x13'),_0x3f7ba1,_0x4dd803);_0x1b9d37(_0x4dd803);});});}exports[_0xdaeb('0x15')]=function(_0x1b5243){var _0x1fe84e=this;return new Promise(function(_0x2d8f11,_0x36f9ac){return db['OpenchannelQueueReport'][_0xdaeb('0x16')](_0x1b5243['body'],{'raw':_0x1b5243[_0xdaeb('0x17')]?_0x1b5243[_0xdaeb('0x17')][_0xdaeb('0x18')]===undefined?!![]:![]:!![]})['then'](function(_0x4e97e0){logger[_0xdaeb('0xd')](_0xdaeb('0x15'),_0x1b5243);logger[_0xdaeb('0x19')](_0xdaeb('0x15'),_0x1b5243,JSON[_0xdaeb('0x10')](_0x4e97e0));_0x2d8f11(_0x4e97e0);})['catch'](function(_0x597bb7){logger[_0xdaeb('0x11')](_0xdaeb('0x15'),_0x597bb7[_0xdaeb('0x12')],_0x1b5243);_0x36f9ac(_0x1fe84e[_0xdaeb('0x11')](0x1f4,_0x597bb7[_0xdaeb('0x12')]));});});};exports['UpdateOpenchannelQueueReport']=function(_0x254c3b){var _0x4dc25f=this;return new Promise(function(_0x130c35,_0x398616){return db[_0xdaeb('0x1a')][_0xdaeb('0x1b')](_0x254c3b[_0xdaeb('0x1c')],{'raw':_0x254c3b['options']?_0x254c3b[_0xdaeb('0x17')][_0xdaeb('0x18')]===undefined?!![]:![]:!![],'individualHooks':!![],'where':_0x254c3b[_0xdaeb('0x17')]?_0x254c3b['options']['where']||null:null,'attributes':_0x254c3b[_0xdaeb('0x17')]?_0x254c3b['options']['attributes']||null:null,'limit':_0x254c3b[_0xdaeb('0x17')]?_0x254c3b[_0xdaeb('0x17')][_0xdaeb('0x1d')]||null:null})['then'](function(_0x5e6f97){logger[_0xdaeb('0xd')](_0xdaeb('0x1e'),_0x254c3b);logger[_0xdaeb('0x19')]('UpdateOpenchannelQueueReport',_0x254c3b,JSON[_0xdaeb('0x10')](_0x5e6f97));_0x130c35(_0x5e6f97);})['catch'](function(_0x4da82d){logger[_0xdaeb('0x11')](_0xdaeb('0x1e'),_0x4da82d[_0xdaeb('0x12')],_0x254c3b);_0x398616(_0x4dc25f[_0xdaeb('0x11')](0x1f4,_0x4da82d[_0xdaeb('0x12')]));});});}; \ No newline at end of file +var _0xefda=['lodash','bluebird','randomstring','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','http','request','then','request\x20sent','debug','OpenchannelQueueReport,\x20%s,\x20%s,\x20%s','stringify','error','code','OpenchannelQueueReport,\x20%s,\x20%s','message','info','result','catch','CreateOpenchannelQueueReport','create','body','options','raw','UpdateOpenchannelQueueReport','update'];(function(_0x3dd15e,_0x1f0015){var _0x231fd0=function(_0x4f680a){while(--_0x4f680a){_0x3dd15e['push'](_0x3dd15e['shift']());}};_0x231fd0(++_0x1f0015);}(_0xefda,0x96));var _0xaefd=function(_0x19264b,_0x3351a3){_0x19264b=_0x19264b-0x0;var _0x38f854=_0xefda[_0x19264b];return _0x38f854;};'use strict';var _=require(_0xaefd('0x0'));var util=require('util');var moment=require('moment');var BPromise=require(_0xaefd('0x1'));var rs=require(_0xaefd('0x2'));var fs=require('fs');var Redis=require('ioredis');var db=require(_0xaefd('0x3'))['db'];var utils=require(_0xaefd('0x4'));var logger=require(_0xaefd('0x5'))(_0xaefd('0x6'));var config=require(_0xaefd('0x7'));var jayson=require(_0xaefd('0x8'));var client=jayson['client'][_0xaefd('0x9')]({'port':0x232a});function respondWithRpcPromise(_0x3b9736,_0x24d10c,_0x1d76f3){return new BPromise(function(_0x4ce248,_0x15193c){return client[_0xaefd('0xa')](_0x3b9736,_0x1d76f3)[_0xaefd('0xb')](function(_0x4d44ed){logger['info']('OpenchannelQueueReport,\x20%s,\x20%s',_0x24d10c,_0xaefd('0xc'));logger[_0xaefd('0xd')](_0xaefd('0xe'),_0x24d10c,_0xaefd('0xc'),JSON[_0xaefd('0xf')](_0x4d44ed));if(_0x4d44ed[_0xaefd('0x10')]){if(_0x4d44ed[_0xaefd('0x10')][_0xaefd('0x11')]===0x1f4){logger[_0xaefd('0x10')](_0xaefd('0x12'),_0x24d10c,_0x4d44ed[_0xaefd('0x10')]['message']);return _0x15193c(_0x4d44ed[_0xaefd('0x10')]['message']);}logger[_0xaefd('0x10')](_0xaefd('0x12'),_0x24d10c,_0x4d44ed[_0xaefd('0x10')][_0xaefd('0x13')]);return _0x4ce248(_0x4d44ed['error'][_0xaefd('0x13')]);}else{logger[_0xaefd('0x14')](_0xaefd('0x12'),_0x24d10c,_0xaefd('0xc'));_0x4ce248(_0x4d44ed[_0xaefd('0x15')][_0xaefd('0x13')]);}})[_0xaefd('0x16')](function(_0x23d736){logger['error'](_0xaefd('0x12'),_0x24d10c,_0x23d736);_0x15193c(_0x23d736);});});}exports[_0xaefd('0x17')]=function(_0x9748f4){var _0x1737a1=this;return new Promise(function(_0x2db61b,_0x244956){return db['OpenchannelQueueReport'][_0xaefd('0x18')](_0x9748f4[_0xaefd('0x19')],{'raw':_0x9748f4[_0xaefd('0x1a')]?_0x9748f4[_0xaefd('0x1a')][_0xaefd('0x1b')]===undefined?!![]:![]:!![]})[_0xaefd('0xb')](function(_0x5282ed){logger[_0xaefd('0x14')](_0xaefd('0x17'),_0x9748f4);logger[_0xaefd('0xd')](_0xaefd('0x17'),_0x9748f4,JSON[_0xaefd('0xf')](_0x5282ed));_0x2db61b(_0x5282ed);})['catch'](function(_0x479486){logger['error'](_0xaefd('0x17'),_0x479486[_0xaefd('0x13')],_0x9748f4);_0x244956(_0x1737a1[_0xaefd('0x10')](0x1f4,_0x479486['message']));});});};exports[_0xaefd('0x1c')]=function(_0x4cd9b2){var _0x3deec8=this;return new Promise(function(_0x3caa99,_0x1a05eb){return db['OpenchannelQueueReport'][_0xaefd('0x1d')](_0x4cd9b2[_0xaefd('0x19')],{'raw':_0x4cd9b2[_0xaefd('0x1a')]?_0x4cd9b2[_0xaefd('0x1a')][_0xaefd('0x1b')]===undefined?!![]:![]:!![],'individualHooks':!![],'where':_0x4cd9b2['options']?_0x4cd9b2[_0xaefd('0x1a')]['where']||null:null,'attributes':_0x4cd9b2[_0xaefd('0x1a')]?_0x4cd9b2[_0xaefd('0x1a')]['attributes']||null:null,'limit':_0x4cd9b2[_0xaefd('0x1a')]?_0x4cd9b2[_0xaefd('0x1a')]['limit']||null:null})[_0xaefd('0xb')](function(_0x114ec0){logger[_0xaefd('0x14')]('UpdateOpenchannelQueueReport',_0x4cd9b2);logger[_0xaefd('0xd')]('UpdateOpenchannelQueueReport',_0x4cd9b2,JSON[_0xaefd('0xf')](_0x114ec0));_0x3caa99(_0x114ec0);})['catch'](function(_0x4a1acb){logger[_0xaefd('0x10')](_0xaefd('0x1c'),_0x4a1acb['message'],_0x4cd9b2);_0x1a05eb(_0x3deec8['error'](0x1f4,_0x4a1acb['message']));});});}; \ No newline at end of file diff --git a/server/api/openchannelTransferReport/index.js b/server/api/openchannelTransferReport/index.js index 05f81bd..234d790 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 _0x6b90=['express','Router','fs-extra','../../components/interaction/service','../../config/environment','get','/describe','isAuthenticated','describe','show','post','create','update','delete','/:id','destroy','exports','util','path','connect-timeout'];(function(_0x318527,_0xa20ec7){var _0x1fe7a5=function(_0x350548){while(--_0x350548){_0x318527['push'](_0x318527['shift']());}};_0x1fe7a5(++_0xa20ec7);}(_0x6b90,0x9d));var _0x06b9=function(_0x34d823,_0x2d20b0){_0x34d823=_0x34d823-0x0;var _0x1eb90c=_0x6b90[_0x34d823];return _0x1eb90c;};'use strict';var multer=require('multer');var util=require(_0x06b9('0x0'));var path=require(_0x06b9('0x1'));var timeout=require(_0x06b9('0x2'));var express=require(_0x06b9('0x3'));var router=express[_0x06b9('0x4')]();var fs_extra=require(_0x06b9('0x5'));var auth=require('../../components/auth/service');var interaction=require(_0x06b9('0x6'));var config=require(_0x06b9('0x7'));var controller=require('./openchannelTransferReport.controller');router['get']('/',auth['isAuthenticated'](),controller['index']);router[_0x06b9('0x8')](_0x06b9('0x9'),auth[_0x06b9('0xa')](),controller[_0x06b9('0xb')]);router[_0x06b9('0x8')]('/:id',auth[_0x06b9('0xa')](),controller[_0x06b9('0xc')]);router[_0x06b9('0xd')]('/',auth['isAuthenticated'](),controller[_0x06b9('0xe')]);router['put']('/:id',auth[_0x06b9('0xa')](),controller[_0x06b9('0xf')]);router[_0x06b9('0x10')](_0x06b9('0x11'),auth[_0x06b9('0xa')](),controller[_0x06b9('0x12')]);module[_0x06b9('0x13')]=router; \ No newline at end of file +var _0x20f2=['fs-extra','../../components/auth/service','../../components/interaction/service','./openchannelTransferReport.controller','get','/describe','describe','/:id','isAuthenticated','show','post','update','destroy','exports','multer','util','connect-timeout','express','Router'];(function(_0x460fd7,_0x2012db){var _0x44d1c2=function(_0x545e11){while(--_0x545e11){_0x460fd7['push'](_0x460fd7['shift']());}};_0x44d1c2(++_0x2012db);}(_0x20f2,0xf2));var _0x220f=function(_0x97a753,_0xede0cb){_0x97a753=_0x97a753-0x0;var _0x80b7ce=_0x20f2[_0x97a753];return _0x80b7ce;};'use strict';var multer=require(_0x220f('0x0'));var util=require(_0x220f('0x1'));var path=require('path');var timeout=require(_0x220f('0x2'));var express=require(_0x220f('0x3'));var router=express[_0x220f('0x4')]();var fs_extra=require(_0x220f('0x5'));var auth=require(_0x220f('0x6'));var interaction=require(_0x220f('0x7'));var config=require('../../config/environment');var controller=require(_0x220f('0x8'));router[_0x220f('0x9')]('/',auth['isAuthenticated'](),controller['index']);router['get'](_0x220f('0xa'),auth['isAuthenticated'](),controller[_0x220f('0xb')]);router[_0x220f('0x9')](_0x220f('0xc'),auth[_0x220f('0xd')](),controller[_0x220f('0xe')]);router[_0x220f('0xf')]('/',auth[_0x220f('0xd')](),controller['create']);router['put'](_0x220f('0xc'),auth['isAuthenticated'](),controller[_0x220f('0x10')]);router['delete'](_0x220f('0xc'),auth[_0x220f('0xd')](),controller[_0x220f('0x11')]);module[_0x220f('0x12')]=router; \ No newline at end of file diff --git a/server/api/openchannelTransferReport/openchannelTransferReport.attributes.js b/server/api/openchannelTransferReport/openchannelTransferReport.attributes.js index e5fa334..654a19a 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 _0x008c=['ENUM','agent','queue','DATE','NOW','moment','sequelize','exports','STRING'];(function(_0x5b15a6,_0x1ad76b){var _0x287d3f=function(_0x284836){while(--_0x284836){_0x5b15a6['push'](_0x5b15a6['shift']());}};_0x287d3f(++_0x1ad76b);}(_0x008c,0x188));var _0xc008=function(_0x500a1f,_0x14745f){_0x500a1f=_0x500a1f-0x0;var _0x2f5bd7=_0x008c[_0x500a1f];return _0x2f5bd7;};'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 +var _0xa9e0=['account','queue','DATE','NOW','moment','sequelize','exports'];(function(_0x4bd9de,_0x4c79ec){var _0x4855c0=function(_0x37552d){while(--_0x37552d){_0x4bd9de['push'](_0x4bd9de['shift']());}};_0x4855c0(++_0x4c79ec);}(_0xa9e0,0x123));var _0x0a9e=function(_0x43d11d,_0xccff91){_0x43d11d=_0x43d11d-0x0;var _0x38cd08=_0xa9e0[_0x43d11d];return _0x38cd08;};'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 d8f4738..90349dc 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 _0xfe40=['save','update','destroy','then','sendStatus','error','stack','name','send','index','OpenchannelTransferReport','rawAttributes','type','key','model','map','query','keys','filters','intersection','attributes','fields','length','hasOwnProperty','nolimit','order','sort','where','filter','merge','VIRTUAL','options','include','rows','catch','show','params','find','create','body','describe','eml-format','fast-json-patch','moment','bluebird','util','path','sox','ejs','fs-extra','lodash','squel','crypto','desk.js','to-csv','papaparse','ioredis','../../components/auth/service','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','status','end','offset','undefined','count','limit','Content-Range','apply'];(function(_0x4269ae,_0xbee855){var _0x43cbe8=function(_0xbeb349){while(--_0xbeb349){_0x4269ae['push'](_0x4269ae['shift']());}};_0x43cbe8(++_0xbee855);}(_0xfe40,0x151));var _0x0fe4=function(_0x3cb6f6,_0x1018be){_0x3cb6f6=_0x3cb6f6-0x0;var _0x524a98=_0xfe40[_0x3cb6f6];return _0x524a98;};'use strict';var emlformat=require(_0x0fe4('0x0'));var rimraf=require('rimraf');var zipdir=require('zip-dir');var jsonpatch=require(_0x0fe4('0x1'));var rp=require('request-promise');var moment=require(_0x0fe4('0x2'));var BPromise=require(_0x0fe4('0x3'));var Mustache=require('mustache');var util=require(_0x0fe4('0x4'));var path=require(_0x0fe4('0x5'));var sox=require(_0x0fe4('0x6'));var csv=require('to-csv');var ejs=require(_0x0fe4('0x7'));var fs=require('fs');var fs_extra=require(_0x0fe4('0x8'));var _=require(_0x0fe4('0x9'));var squel=require(_0x0fe4('0xa'));var crypto=require(_0x0fe4('0xb'));var jsforce=require('jsforce');var deskjs=require(_0x0fe4('0xc'));var toCsv=require(_0x0fe4('0xd'));var querystring=require('querystring');var Papa=require(_0x0fe4('0xe'));var Redis=require(_0x0fe4('0xf'));var authService=require(_0x0fe4('0x10'));var qs=require('../../components/parsers/qs');var as=require(_0x0fe4('0x11'));var hardwareService=require(_0x0fe4('0x12'));var logger=require(_0x0fe4('0x13'))(_0x0fe4('0x14'));var utils=require(_0x0fe4('0x15'));var config=require(_0x0fe4('0x16'));var licenseUtil=require(_0x0fe4('0x17'));var db=require(_0x0fe4('0x18'))['db'];function respondWithStatusCode(_0x28e01c,_0x3fbc3b){_0x3fbc3b=_0x3fbc3b||0xcc;return function(_0x568431){if(_0x568431){return _0x28e01c['sendStatus'](_0x3fbc3b);}return _0x28e01c[_0x0fe4('0x19')](_0x3fbc3b)[_0x0fe4('0x1a')]();};}function respondWithResult(_0x284e06,_0x16157f){_0x16157f=_0x16157f||0xc8;return function(_0x363df1){if(_0x363df1){return _0x284e06[_0x0fe4('0x19')](_0x16157f)['json'](_0x363df1);}};}function respondWithFilteredResult(_0x41d281,_0x2a0a08){return function(_0x1f40c2){if(_0x1f40c2){var _0x19c40b=typeof _0x2a0a08[_0x0fe4('0x1b')]===_0x0fe4('0x1c')&&typeof _0x2a0a08['limit']==='undefined';var _0x3f0e35=_0x1f40c2[_0x0fe4('0x1d')];var _0x52114f=_0x19c40b?0x0:_0x2a0a08[_0x0fe4('0x1b')];var _0x51cfed=_0x19c40b?_0x1f40c2[_0x0fe4('0x1d')]:_0x2a0a08['offset']+_0x2a0a08[_0x0fe4('0x1e')];var _0x2299e3;if(_0x51cfed>=_0x3f0e35){_0x51cfed=_0x3f0e35;_0x2299e3=0xc8;}else{_0x2299e3=0xce;}_0x41d281[_0x0fe4('0x19')](_0x2299e3);return _0x41d281['set'](_0x0fe4('0x1f'),_0x52114f+'-'+_0x51cfed+'/'+_0x3f0e35)['json'](_0x1f40c2);}return null;};}function patchUpdates(_0x38500e){return function(_0xf50047){try{jsonpatch[_0x0fe4('0x20')](_0xf50047,_0x38500e,!![]);}catch(_0x10c7aa){return BPromise['reject'](_0x10c7aa);}return _0xf50047[_0x0fe4('0x21')]();};}function saveUpdates(_0x4844d6,_0x13d9b9){return function(_0x5d2985){if(_0x5d2985){return _0x5d2985[_0x0fe4('0x22')](_0x4844d6)['then'](function(_0x2a5da0){return _0x2a5da0;});}return null;};}function removeEntity(_0x332b38,_0x10c700){return function(_0x481cac){if(_0x481cac){return _0x481cac[_0x0fe4('0x23')]()[_0x0fe4('0x24')](function(){_0x332b38[_0x0fe4('0x19')](0xcc)['end']();});}};}function handleEntityNotFound(_0x56a4e6,_0x2457b3){return function(_0x297906){if(!_0x297906){_0x56a4e6[_0x0fe4('0x25')](0x194);}return _0x297906;};}function handleError(_0x214448,_0x155c19){_0x155c19=_0x155c19||0x1f4;return function(_0x5dabd6){logger[_0x0fe4('0x26')](_0x5dabd6[_0x0fe4('0x27')]);if(_0x5dabd6['name']){delete _0x5dabd6[_0x0fe4('0x28')];}_0x214448[_0x0fe4('0x19')](_0x155c19)[_0x0fe4('0x29')](_0x5dabd6);};}exports[_0x0fe4('0x2a')]=function(_0x32840d,_0x22563b){var _0x54a956={},_0x36189b={},_0x4edbf3={'count':0x0,'rows':[]};var _0x2630d5=_['map'](db[_0x0fe4('0x2b')][_0x0fe4('0x2c')],function(_0x2156ef){return{'name':_0x2156ef['fieldName'],'type':_0x2156ef[_0x0fe4('0x2d')][_0x0fe4('0x2e')]};});_0x36189b[_0x0fe4('0x2f')]=_[_0x0fe4('0x30')](_0x2630d5,_0x0fe4('0x28'));_0x36189b[_0x0fe4('0x31')]=_[_0x0fe4('0x32')](_0x32840d[_0x0fe4('0x31')]);_0x36189b[_0x0fe4('0x33')]=_[_0x0fe4('0x34')](_0x36189b['model'],_0x36189b[_0x0fe4('0x31')]);_0x54a956[_0x0fe4('0x35')]=_[_0x0fe4('0x34')](_0x36189b[_0x0fe4('0x2f')],qs[_0x0fe4('0x36')](_0x32840d[_0x0fe4('0x31')][_0x0fe4('0x36')]));_0x54a956[_0x0fe4('0x35')]=_0x54a956[_0x0fe4('0x35')][_0x0fe4('0x37')]?_0x54a956[_0x0fe4('0x35')]:_0x36189b[_0x0fe4('0x2f')];if(!_0x32840d['query'][_0x0fe4('0x38')](_0x0fe4('0x39'))){_0x54a956[_0x0fe4('0x1e')]=qs[_0x0fe4('0x1e')](_0x32840d[_0x0fe4('0x31')]['limit']);_0x54a956[_0x0fe4('0x1b')]=qs[_0x0fe4('0x1b')](_0x32840d['query'][_0x0fe4('0x1b')]);}_0x54a956[_0x0fe4('0x3a')]=qs[_0x0fe4('0x3b')](_0x32840d[_0x0fe4('0x31')][_0x0fe4('0x3b')]);_0x54a956[_0x0fe4('0x3c')]=qs[_0x0fe4('0x33')](_['pick'](_0x32840d[_0x0fe4('0x31')],_0x36189b[_0x0fe4('0x33')]),_0x2630d5);if(_0x32840d['query'][_0x0fe4('0x3d')]){_0x54a956[_0x0fe4('0x3c')]=_[_0x0fe4('0x3e')](_0x54a956[_0x0fe4('0x3c')],{'$or':_[_0x0fe4('0x30')](_0x2630d5,function(_0x160def){if(_0x160def[_0x0fe4('0x2d')]!==_0x0fe4('0x3f')){var _0x413025={};_0x413025[_0x160def[_0x0fe4('0x28')]]={'$like':'%'+_0x32840d['query'][_0x0fe4('0x3d')]+'%'};return _0x413025;}})});}_0x54a956=_[_0x0fe4('0x3e')]({},_0x54a956,_0x32840d[_0x0fe4('0x40')]);var _0xc55981={'where':_0x54a956[_0x0fe4('0x3c')]};return db['OpenchannelTransferReport'][_0x0fe4('0x1d')](_0xc55981)['then'](function(_0x348a2d){_0x4edbf3['count']=_0x348a2d;if(_0x32840d[_0x0fe4('0x31')]['includeAll']){_0x54a956[_0x0fe4('0x41')]=[{'all':!![]}];}return db[_0x0fe4('0x2b')]['findAll'](_0x54a956);})['then'](function(_0x44cf19){_0x4edbf3[_0x0fe4('0x42')]=_0x44cf19;return _0x4edbf3;})[_0x0fe4('0x24')](respondWithFilteredResult(_0x22563b,_0x54a956))[_0x0fe4('0x43')](handleError(_0x22563b,null));};exports[_0x0fe4('0x44')]=function(_0x4e8a6d,_0x1eb769){var _0x2d2034={'raw':!![],'where':{'id':_0x4e8a6d[_0x0fe4('0x45')]['id']}},_0x50ae1f={};_0x50ae1f['model']=_['keys'](db[_0x0fe4('0x2b')][_0x0fe4('0x2c')]);_0x50ae1f[_0x0fe4('0x31')]=_[_0x0fe4('0x32')](_0x4e8a6d[_0x0fe4('0x31')]);_0x50ae1f[_0x0fe4('0x33')]=_[_0x0fe4('0x34')](_0x50ae1f[_0x0fe4('0x2f')],_0x50ae1f[_0x0fe4('0x31')]);_0x2d2034[_0x0fe4('0x35')]=_[_0x0fe4('0x34')](_0x50ae1f[_0x0fe4('0x2f')],qs[_0x0fe4('0x36')](_0x4e8a6d[_0x0fe4('0x31')][_0x0fe4('0x36')]));_0x2d2034[_0x0fe4('0x35')]=_0x2d2034[_0x0fe4('0x35')][_0x0fe4('0x37')]?_0x2d2034['attributes']:_0x50ae1f[_0x0fe4('0x2f')];if(_0x4e8a6d[_0x0fe4('0x31')]['includeAll']){_0x2d2034['include']=[{'all':!![]}];}_0x2d2034=_[_0x0fe4('0x3e')]({},_0x2d2034,_0x4e8a6d['options']);return db[_0x0fe4('0x2b')][_0x0fe4('0x46')](_0x2d2034)[_0x0fe4('0x24')](handleEntityNotFound(_0x1eb769,null))['then'](respondWithResult(_0x1eb769,null))[_0x0fe4('0x43')](handleError(_0x1eb769,null));};exports[_0x0fe4('0x47')]=function(_0x265991,_0x58a00a){return db[_0x0fe4('0x2b')][_0x0fe4('0x47')](_0x265991[_0x0fe4('0x48')],{})[_0x0fe4('0x24')](respondWithResult(_0x58a00a,0xc9))[_0x0fe4('0x43')](handleError(_0x58a00a,null));};exports[_0x0fe4('0x22')]=function(_0x108d16,_0x22cc15){if(_0x108d16[_0x0fe4('0x48')]['id']){delete _0x108d16['body']['id'];}return db[_0x0fe4('0x2b')][_0x0fe4('0x46')]({'where':{'id':_0x108d16[_0x0fe4('0x45')]['id']}})['then'](handleEntityNotFound(_0x22cc15,null))[_0x0fe4('0x24')](saveUpdates(_0x108d16['body'],null))[_0x0fe4('0x24')](respondWithResult(_0x22cc15,null))['catch'](handleError(_0x22cc15,null));};exports[_0x0fe4('0x23')]=function(_0x6f871b,_0x203d18){return db['OpenchannelTransferReport']['find']({'where':{'id':_0x6f871b[_0x0fe4('0x45')]['id']}})[_0x0fe4('0x24')](handleEntityNotFound(_0x203d18,null))['then'](removeEntity(_0x203d18,null))[_0x0fe4('0x43')](handleError(_0x203d18,null));};exports['describe']=function(_0x1e4222,_0x576bb9){return db[_0x0fe4('0x2b')][_0x0fe4('0x49')]()['then'](respondWithResult(_0x576bb9,null))[_0x0fe4('0x43')](handleError(_0x576bb9,null));}; \ No newline at end of file +var _0x40ba=['querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/advancedSearch','../../config/logger','api','../../config/environment','../../config/license/util','../../mysqldb','sendStatus','status','offset','undefined','limit','count','set','Content-Range','json','apply','reject','update','then','destroy','error','stack','name','send','index','map','fieldName','type','key','model','query','keys','filters','intersection','fields','attributes','length','hasOwnProperty','nolimit','order','sort','where','pick','filter','merge','VIRTUAL','OpenchannelTransferReport','includeAll','findAll','rows','catch','include','options','find','create','body','params','describe','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','moment','bluebird','mustache','path','sox','to-csv','ejs','lodash','squel','crypto','desk.js'];(function(_0x21a9d9,_0x4d5ac8){var _0x46adce=function(_0xfdd336){while(--_0xfdd336){_0x21a9d9['push'](_0x21a9d9['shift']());}};_0x46adce(++_0x4d5ac8);}(_0x40ba,0x128));var _0xa40b=function(_0x181dfe,_0xf84557){_0x181dfe=_0x181dfe-0x0;var _0x40c38f=_0x40ba[_0x181dfe];return _0x40c38f;};'use strict';var emlformat=require(_0xa40b('0x0'));var rimraf=require(_0xa40b('0x1'));var zipdir=require(_0xa40b('0x2'));var jsonpatch=require(_0xa40b('0x3'));var rp=require(_0xa40b('0x4'));var moment=require(_0xa40b('0x5'));var BPromise=require(_0xa40b('0x6'));var Mustache=require(_0xa40b('0x7'));var util=require('util');var path=require(_0xa40b('0x8'));var sox=require(_0xa40b('0x9'));var csv=require(_0xa40b('0xa'));var ejs=require(_0xa40b('0xb'));var fs=require('fs');var fs_extra=require('fs-extra');var _=require(_0xa40b('0xc'));var squel=require(_0xa40b('0xd'));var crypto=require(_0xa40b('0xe'));var jsforce=require('jsforce');var deskjs=require(_0xa40b('0xf'));var toCsv=require(_0xa40b('0xa'));var querystring=require(_0xa40b('0x10'));var Papa=require(_0xa40b('0x11'));var Redis=require(_0xa40b('0x12'));var authService=require(_0xa40b('0x13'));var qs=require('../../components/parsers/qs');var as=require(_0xa40b('0x14'));var hardwareService=require('../../config/license/hardware');var logger=require(_0xa40b('0x15'))(_0xa40b('0x16'));var utils=require('../../config/utils');var config=require(_0xa40b('0x17'));var licenseUtil=require(_0xa40b('0x18'));var db=require(_0xa40b('0x19'))['db'];function respondWithStatusCode(_0x46701c,_0xbeb47){_0xbeb47=_0xbeb47||0xcc;return function(_0x1efc7b){if(_0x1efc7b){return _0x46701c[_0xa40b('0x1a')](_0xbeb47);}return _0x46701c[_0xa40b('0x1b')](_0xbeb47)['end']();};}function respondWithResult(_0xb132d0,_0x58e5f3){_0x58e5f3=_0x58e5f3||0xc8;return function(_0x36d183){if(_0x36d183){return _0xb132d0[_0xa40b('0x1b')](_0x58e5f3)['json'](_0x36d183);}};}function respondWithFilteredResult(_0x1a03e8,_0x2c7423){return function(_0x481460){if(_0x481460){var _0x33af2f=typeof _0x2c7423[_0xa40b('0x1c')]===_0xa40b('0x1d')&&typeof _0x2c7423[_0xa40b('0x1e')]===_0xa40b('0x1d');var _0x27de6d=_0x481460[_0xa40b('0x1f')];var _0x216797=_0x33af2f?0x0:_0x2c7423[_0xa40b('0x1c')];var _0x2622b3=_0x33af2f?_0x481460[_0xa40b('0x1f')]:_0x2c7423[_0xa40b('0x1c')]+_0x2c7423[_0xa40b('0x1e')];var _0x2c4e54;if(_0x2622b3>=_0x27de6d){_0x2622b3=_0x27de6d;_0x2c4e54=0xc8;}else{_0x2c4e54=0xce;}_0x1a03e8[_0xa40b('0x1b')](_0x2c4e54);return _0x1a03e8[_0xa40b('0x20')](_0xa40b('0x21'),_0x216797+'-'+_0x2622b3+'/'+_0x27de6d)[_0xa40b('0x22')](_0x481460);}return null;};}function patchUpdates(_0x3ae50f){return function(_0x2dae41){try{jsonpatch[_0xa40b('0x23')](_0x2dae41,_0x3ae50f,!![]);}catch(_0x4a7d01){return BPromise[_0xa40b('0x24')](_0x4a7d01);}return _0x2dae41['save']();};}function saveUpdates(_0xac4e03,_0x2f54ba){return function(_0x7719d9){if(_0x7719d9){return _0x7719d9[_0xa40b('0x25')](_0xac4e03)[_0xa40b('0x26')](function(_0x59c534){return _0x59c534;});}return null;};}function removeEntity(_0x465bd1,_0x4d1b4c){return function(_0x542b50){if(_0x542b50){return _0x542b50[_0xa40b('0x27')]()['then'](function(){_0x465bd1['status'](0xcc)['end']();});}};}function handleEntityNotFound(_0x4290d3,_0x1c60b1){return function(_0x1dbe68){if(!_0x1dbe68){_0x4290d3[_0xa40b('0x1a')](0x194);}return _0x1dbe68;};}function handleError(_0x398422,_0x9039a2){_0x9039a2=_0x9039a2||0x1f4;return function(_0x4603bb){logger[_0xa40b('0x28')](_0x4603bb[_0xa40b('0x29')]);if(_0x4603bb[_0xa40b('0x2a')]){delete _0x4603bb['name'];}_0x398422['status'](_0x9039a2)[_0xa40b('0x2b')](_0x4603bb);};}exports[_0xa40b('0x2c')]=function(_0x353d6c,_0x22dff6){var _0x4de13a={},_0x4cb0da={},_0x1d8adf={'count':0x0,'rows':[]};var _0x576db1=_[_0xa40b('0x2d')](db['OpenchannelTransferReport']['rawAttributes'],function(_0x4ed7f3){return{'name':_0x4ed7f3[_0xa40b('0x2e')],'type':_0x4ed7f3[_0xa40b('0x2f')][_0xa40b('0x30')]};});_0x4cb0da[_0xa40b('0x31')]=_[_0xa40b('0x2d')](_0x576db1,_0xa40b('0x2a'));_0x4cb0da[_0xa40b('0x32')]=_[_0xa40b('0x33')](_0x353d6c[_0xa40b('0x32')]);_0x4cb0da[_0xa40b('0x34')]=_[_0xa40b('0x35')](_0x4cb0da['model'],_0x4cb0da[_0xa40b('0x32')]);_0x4de13a['attributes']=_[_0xa40b('0x35')](_0x4cb0da[_0xa40b('0x31')],qs[_0xa40b('0x36')](_0x353d6c['query'][_0xa40b('0x36')]));_0x4de13a[_0xa40b('0x37')]=_0x4de13a['attributes'][_0xa40b('0x38')]?_0x4de13a[_0xa40b('0x37')]:_0x4cb0da[_0xa40b('0x31')];if(!_0x353d6c[_0xa40b('0x32')][_0xa40b('0x39')](_0xa40b('0x3a'))){_0x4de13a[_0xa40b('0x1e')]=qs[_0xa40b('0x1e')](_0x353d6c['query'][_0xa40b('0x1e')]);_0x4de13a[_0xa40b('0x1c')]=qs[_0xa40b('0x1c')](_0x353d6c['query']['offset']);}_0x4de13a[_0xa40b('0x3b')]=qs['sort'](_0x353d6c['query'][_0xa40b('0x3c')]);_0x4de13a[_0xa40b('0x3d')]=qs[_0xa40b('0x34')](_[_0xa40b('0x3e')](_0x353d6c['query'],_0x4cb0da[_0xa40b('0x34')]),_0x576db1);if(_0x353d6c[_0xa40b('0x32')][_0xa40b('0x3f')]){_0x4de13a[_0xa40b('0x3d')]=_[_0xa40b('0x40')](_0x4de13a[_0xa40b('0x3d')],{'$or':_['map'](_0x576db1,function(_0x2b1f1e){if(_0x2b1f1e['type']!==_0xa40b('0x41')){var _0x5bdf32={};_0x5bdf32[_0x2b1f1e[_0xa40b('0x2a')]]={'$like':'%'+_0x353d6c[_0xa40b('0x32')][_0xa40b('0x3f')]+'%'};return _0x5bdf32;}})});}_0x4de13a=_['merge']({},_0x4de13a,_0x353d6c['options']);var _0x30cf8c={'where':_0x4de13a[_0xa40b('0x3d')]};return db[_0xa40b('0x42')][_0xa40b('0x1f')](_0x30cf8c)[_0xa40b('0x26')](function(_0x2b58cd){_0x1d8adf[_0xa40b('0x1f')]=_0x2b58cd;if(_0x353d6c[_0xa40b('0x32')][_0xa40b('0x43')]){_0x4de13a['include']=[{'all':!![]}];}return db[_0xa40b('0x42')][_0xa40b('0x44')](_0x4de13a);})[_0xa40b('0x26')](function(_0x5e1003){_0x1d8adf[_0xa40b('0x45')]=_0x5e1003;return _0x1d8adf;})[_0xa40b('0x26')](respondWithFilteredResult(_0x22dff6,_0x4de13a))[_0xa40b('0x46')](handleError(_0x22dff6,null));};exports['show']=function(_0x1c9bc5,_0x4b66e7){var _0x24493f={'raw':!![],'where':{'id':_0x1c9bc5['params']['id']}},_0x10a410={};_0x10a410[_0xa40b('0x31')]=_[_0xa40b('0x33')](db[_0xa40b('0x42')]['rawAttributes']);_0x10a410['query']=_['keys'](_0x1c9bc5[_0xa40b('0x32')]);_0x10a410[_0xa40b('0x34')]=_[_0xa40b('0x35')](_0x10a410[_0xa40b('0x31')],_0x10a410[_0xa40b('0x32')]);_0x24493f[_0xa40b('0x37')]=_[_0xa40b('0x35')](_0x10a410[_0xa40b('0x31')],qs[_0xa40b('0x36')](_0x1c9bc5[_0xa40b('0x32')]['fields']));_0x24493f[_0xa40b('0x37')]=_0x24493f[_0xa40b('0x37')][_0xa40b('0x38')]?_0x24493f[_0xa40b('0x37')]:_0x10a410[_0xa40b('0x31')];if(_0x1c9bc5[_0xa40b('0x32')][_0xa40b('0x43')]){_0x24493f[_0xa40b('0x47')]=[{'all':!![]}];}_0x24493f=_[_0xa40b('0x40')]({},_0x24493f,_0x1c9bc5[_0xa40b('0x48')]);return db['OpenchannelTransferReport'][_0xa40b('0x49')](_0x24493f)[_0xa40b('0x26')](handleEntityNotFound(_0x4b66e7,null))[_0xa40b('0x26')](respondWithResult(_0x4b66e7,null))[_0xa40b('0x46')](handleError(_0x4b66e7,null));};exports[_0xa40b('0x4a')]=function(_0x327df5,_0x1110d0){return db[_0xa40b('0x42')][_0xa40b('0x4a')](_0x327df5['body'],{})[_0xa40b('0x26')](respondWithResult(_0x1110d0,0xc9))[_0xa40b('0x46')](handleError(_0x1110d0,null));};exports['update']=function(_0x1fd2f0,_0x42d73c){if(_0x1fd2f0['body']['id']){delete _0x1fd2f0[_0xa40b('0x4b')]['id'];}return db['OpenchannelTransferReport'][_0xa40b('0x49')]({'where':{'id':_0x1fd2f0[_0xa40b('0x4c')]['id']}})[_0xa40b('0x26')](handleEntityNotFound(_0x42d73c,null))[_0xa40b('0x26')](saveUpdates(_0x1fd2f0['body'],null))[_0xa40b('0x26')](respondWithResult(_0x42d73c,null))[_0xa40b('0x46')](handleError(_0x42d73c,null));};exports['destroy']=function(_0x138eba,_0x49bac2){return db[_0xa40b('0x42')]['find']({'where':{'id':_0x138eba[_0xa40b('0x4c')]['id']}})[_0xa40b('0x26')](handleEntityNotFound(_0x49bac2,null))['then'](removeEntity(_0x49bac2,null))[_0xa40b('0x46')](handleError(_0x49bac2,null));};exports[_0xa40b('0x4d')]=function(_0x5cf5c2,_0x303f8b){return db['OpenchannelTransferReport'][_0xa40b('0x4d')]()['then'](respondWithResult(_0x303f8b,null))[_0xa40b('0x46')](handleError(_0x303f8b,null));}; \ No newline at end of file diff --git a/server/api/openchannelTransferReport/openchannelTransferReport.model.js b/server/api/openchannelTransferReport/openchannelTransferReport.model.js index 72d2bb5..9c98c20 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 _0x4e5a=['api','bluebird','path','rimraf','define','OpenchannelTransferReport','uniqueid','util','../../config/logger'];(function(_0x29d933,_0x193821){var _0x3e3156=function(_0x543943){while(--_0x543943){_0x29d933['push'](_0x29d933['shift']());}};_0x3e3156(++_0x193821);}(_0x4e5a,0xf1));var _0xa4e5=function(_0x4b6cc8,_0x355e5b){_0x4b6cc8=_0x4b6cc8-0x0;var _0x5c4743=_0x4e5a[_0x4b6cc8];return _0x5c4743;};'use strict';var _=require('lodash');var util=require(_0xa4e5('0x0'));var logger=require(_0xa4e5('0x1'))(_0xa4e5('0x2'));var moment=require('moment');var BPromise=require(_0xa4e5('0x3'));var rp=require('request-promise');var fs=require('fs');var path=require(_0xa4e5('0x4'));var rimraf=require(_0xa4e5('0x5'));var config=require('../../config/environment');var attributes=require('./openchannelTransferReport.attributes');module['exports']=function(_0x456fda,_0x26c4a3){return _0x456fda[_0xa4e5('0x6')](_0xa4e5('0x7'),attributes,{'tableName':'report_openchannel_transfer','paranoid':![],'indexes':[{'name':_0xa4e5('0x8'),'fields':[_0xa4e5('0x8')]}],'timestamps':!![]});}; \ No newline at end of file +var _0xf55c=['../../config/logger','moment','bluebird','request-promise','path','rimraf','../../config/environment','./openchannelTransferReport.attributes','exports','define','OpenchannelTransferReport','report_openchannel_transfer','uniqueid','lodash','util'];(function(_0x40684b,_0x1a3ca8){var _0x2a1569=function(_0x2246e8){while(--_0x2246e8){_0x40684b['push'](_0x40684b['shift']());}};_0x2a1569(++_0x1a3ca8);}(_0xf55c,0xb2));var _0xcf55=function(_0x173d7e,_0x3242fd){_0x173d7e=_0x173d7e-0x0;var _0x2220d6=_0xf55c[_0x173d7e];return _0x2220d6;};'use strict';var _=require(_0xcf55('0x0'));var util=require(_0xcf55('0x1'));var logger=require(_0xcf55('0x2'))('api');var moment=require(_0xcf55('0x3'));var BPromise=require(_0xcf55('0x4'));var rp=require(_0xcf55('0x5'));var fs=require('fs');var path=require(_0xcf55('0x6'));var rimraf=require(_0xcf55('0x7'));var config=require(_0xcf55('0x8'));var attributes=require(_0xcf55('0x9'));module[_0xcf55('0xa')]=function(_0x284ca7,_0x52d402){return _0x284ca7[_0xcf55('0xb')](_0xcf55('0xc'),attributes,{'tableName':_0xcf55('0xd'),'paranoid':![],'indexes':[{'name':_0xcf55('0xe'),'fields':[_0xcf55('0xe')]}],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/openchannelTransferReport/openchannelTransferReport.rpc.js b/server/api/openchannelTransferReport/openchannelTransferReport.rpc.js index 99ea52b..cf2ac07 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 _0x7d55=['request\x20sent','OpenchannelTransferReport,\x20%s,\x20%s,\x20%s','stringify','code','OpenchannelTransferReport,\x20%s,\x20%s','error','message','lodash','util','moment','bluebird','../../mysqldb','../../config/utils','../../config/logger','../../config/environment','jayson/promise','client','http','then'];(function(_0x3dd15e,_0x1f0015){var _0x231fd0=function(_0x4f680a){while(--_0x4f680a){_0x3dd15e['push'](_0x3dd15e['shift']());}};_0x231fd0(++_0x1f0015);}(_0x7d55,0x1bc));var _0x57d5=function(_0x3ba997,_0x1b8649){_0x3ba997=_0x3ba997-0x0;var _0x50a52d=_0x7d55[_0x3ba997];return _0x50a52d;};'use strict';var _=require(_0x57d5('0x0'));var util=require(_0x57d5('0x1'));var moment=require(_0x57d5('0x2'));var BPromise=require(_0x57d5('0x3'));var rs=require('randomstring');var fs=require('fs');var Redis=require('ioredis');var db=require(_0x57d5('0x4'))['db'];var utils=require(_0x57d5('0x5'));var logger=require(_0x57d5('0x6'))('rpc');var config=require(_0x57d5('0x7'));var jayson=require(_0x57d5('0x8'));var client=jayson[_0x57d5('0x9')][_0x57d5('0xa')]({'port':0x232a});function respondWithRpcPromise(_0x4393ed,_0x47282c,_0x599ec5){return new BPromise(function(_0x50bc50,_0x59e164){return client['request'](_0x4393ed,_0x599ec5)[_0x57d5('0xb')](function(_0x1e8e1c){logger['info']('OpenchannelTransferReport,\x20%s,\x20%s',_0x47282c,_0x57d5('0xc'));logger['debug'](_0x57d5('0xd'),_0x47282c,_0x57d5('0xc'),JSON[_0x57d5('0xe')](_0x1e8e1c));if(_0x1e8e1c['error']){if(_0x1e8e1c['error'][_0x57d5('0xf')]===0x1f4){logger['error'](_0x57d5('0x10'),_0x47282c,_0x1e8e1c[_0x57d5('0x11')][_0x57d5('0x12')]);return _0x59e164(_0x1e8e1c[_0x57d5('0x11')][_0x57d5('0x12')]);}logger[_0x57d5('0x11')](_0x57d5('0x10'),_0x47282c,_0x1e8e1c[_0x57d5('0x11')]['message']);return _0x50bc50(_0x1e8e1c['error'][_0x57d5('0x12')]);}else{logger['info'](_0x57d5('0x10'),_0x47282c,_0x57d5('0xc'));_0x50bc50(_0x1e8e1c['result'][_0x57d5('0x12')]);}})['catch'](function(_0x5e99df){logger[_0x57d5('0x11')](_0x57d5('0x10'),_0x47282c,_0x5e99df);_0x59e164(_0x5e99df);});});} \ No newline at end of file +var _0xc978=['bluebird','randomstring','ioredis','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','client','http','request','then','OpenchannelTransferReport,\x20%s,\x20%s','request\x20sent','debug','OpenchannelTransferReport,\x20%s,\x20%s,\x20%s','stringify','error','code','message','info','result','catch','lodash','util','moment'];(function(_0x3bf83f,_0x181cac){var _0x22c4a9=function(_0xb3ff0d){while(--_0xb3ff0d){_0x3bf83f['push'](_0x3bf83f['shift']());}};_0x22c4a9(++_0x181cac);}(_0xc978,0xcd));var _0x8c97=function(_0x20a584,_0xe384a5){_0x20a584=_0x20a584-0x0;var _0x4b41a8=_0xc978[_0x20a584];return _0x4b41a8;};'use strict';var _=require(_0x8c97('0x0'));var util=require(_0x8c97('0x1'));var moment=require(_0x8c97('0x2'));var BPromise=require(_0x8c97('0x3'));var rs=require(_0x8c97('0x4'));var fs=require('fs');var Redis=require(_0x8c97('0x5'));var db=require('../../mysqldb')['db'];var utils=require(_0x8c97('0x6'));var logger=require(_0x8c97('0x7'))(_0x8c97('0x8'));var config=require(_0x8c97('0x9'));var jayson=require(_0x8c97('0xa'));var client=jayson[_0x8c97('0xb')][_0x8c97('0xc')]({'port':0x232a});function respondWithRpcPromise(_0x524196,_0x41a511,_0x1b5864){return new BPromise(function(_0x332cd1,_0x26ff40){return client[_0x8c97('0xd')](_0x524196,_0x1b5864)[_0x8c97('0xe')](function(_0x17aef0){logger['info'](_0x8c97('0xf'),_0x41a511,_0x8c97('0x10'));logger[_0x8c97('0x11')](_0x8c97('0x12'),_0x41a511,_0x8c97('0x10'),JSON[_0x8c97('0x13')](_0x17aef0));if(_0x17aef0[_0x8c97('0x14')]){if(_0x17aef0[_0x8c97('0x14')][_0x8c97('0x15')]===0x1f4){logger['error'](_0x8c97('0xf'),_0x41a511,_0x17aef0[_0x8c97('0x14')]['message']);return _0x26ff40(_0x17aef0[_0x8c97('0x14')][_0x8c97('0x16')]);}logger['error'](_0x8c97('0xf'),_0x41a511,_0x17aef0['error']['message']);return _0x332cd1(_0x17aef0['error'][_0x8c97('0x16')]);}else{logger[_0x8c97('0x17')](_0x8c97('0xf'),_0x41a511,_0x8c97('0x10'));_0x332cd1(_0x17aef0[_0x8c97('0x18')][_0x8c97('0x16')]);}})[_0x8c97('0x19')](function(_0xe3be1){logger[_0x8c97('0x14')]('OpenchannelTransferReport,\x20%s,\x20%s',_0x41a511,_0xe3be1);_0x26ff40(_0xe3be1);});});} \ No newline at end of file diff --git a/server/api/pause/index.js b/server/api/pause/index.js index 97bbd7a..034b96b 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 _0x8ed8=['path','connect-timeout','express','Router','../../components/auth/service','../../components/interaction/service','../../config/environment','./pause.controller','get','isAuthenticated','index','/:id','show','post','create','update'];(function(_0x571549,_0x4a011a){var _0x164ea4=function(_0x4505e8){while(--_0x4505e8){_0x571549['push'](_0x571549['shift']());}};_0x164ea4(++_0x4a011a);}(_0x8ed8,0xe0));var _0x88ed=function(_0x564d83,_0x559ff4){_0x564d83=_0x564d83-0x0;var _0x320600=_0x8ed8[_0x564d83];return _0x320600;};'use strict';var multer=require('multer');var util=require('util');var path=require(_0x88ed('0x0'));var timeout=require(_0x88ed('0x1'));var express=require(_0x88ed('0x2'));var router=express[_0x88ed('0x3')]();var fs_extra=require('fs-extra');var auth=require(_0x88ed('0x4'));var interaction=require(_0x88ed('0x5'));var config=require(_0x88ed('0x6'));var controller=require(_0x88ed('0x7'));router[_0x88ed('0x8')]('/',auth[_0x88ed('0x9')](),controller[_0x88ed('0xa')]);router[_0x88ed('0x8')](_0x88ed('0xb'),auth['isAuthenticated'](),controller[_0x88ed('0xc')]);router[_0x88ed('0xd')]('/',auth[_0x88ed('0x9')](),controller[_0x88ed('0xe')]);router['put'](_0x88ed('0xb'),auth[_0x88ed('0x9')](),controller[_0x88ed('0xf')]);router['delete'](_0x88ed('0xb'),auth[_0x88ed('0x9')](),controller['destroy']);module['exports']=router; \ No newline at end of file +var _0xbd3a=['../../components/auth/service','../../config/environment','./pause.controller','get','index','/:id','show','post','isAuthenticated','create','put','delete','destroy','exports','multer','util','path','connect-timeout','express','fs-extra'];(function(_0x3372f1,_0x2914a7){var _0x5bdf0c=function(_0x2d5b9b){while(--_0x2d5b9b){_0x3372f1['push'](_0x3372f1['shift']());}};_0x5bdf0c(++_0x2914a7);}(_0xbd3a,0x112));var _0xabd3=function(_0x3a6a5c,_0x491815){_0x3a6a5c=_0x3a6a5c-0x0;var _0x43fb3b=_0xbd3a[_0x3a6a5c];return _0x43fb3b;};'use strict';var multer=require(_0xabd3('0x0'));var util=require(_0xabd3('0x1'));var path=require(_0xabd3('0x2'));var timeout=require(_0xabd3('0x3'));var express=require(_0xabd3('0x4'));var router=express['Router']();var fs_extra=require(_0xabd3('0x5'));var auth=require(_0xabd3('0x6'));var interaction=require('../../components/interaction/service');var config=require(_0xabd3('0x7'));var controller=require(_0xabd3('0x8'));router[_0xabd3('0x9')]('/',auth['isAuthenticated'](),controller[_0xabd3('0xa')]);router[_0xabd3('0x9')](_0xabd3('0xb'),auth['isAuthenticated'](),controller[_0xabd3('0xc')]);router[_0xabd3('0xd')]('/',auth[_0xabd3('0xe')](),controller[_0xabd3('0xf')]);router[_0xabd3('0x10')](_0xabd3('0xb'),auth[_0xabd3('0xe')](),controller['update']);router[_0xabd3('0x11')](_0xabd3('0xb'),auth['isAuthenticated'](),controller[_0xabd3('0x12')]);module[_0xabd3('0x13')]=router; \ No newline at end of file diff --git a/server/api/pause/pause.attributes.js b/server/api/pause/pause.attributes.js index 3499fdd..39d6a47 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 _0xd246=['name','STRING','sequelize','exports'];(function(_0x2f75fb,_0x591260){var _0x1911d4=function(_0x27e34a){while(--_0x27e34a){_0x2f75fb['push'](_0x2f75fb['shift']());}};_0x1911d4(++_0x591260);}(_0xd246,0x146));var _0x6d24=function(_0x463a6e,_0x1b47b5){_0x463a6e=_0x463a6e-0x0;var _0x51d8c6=_0xd246[_0x463a6e];return _0x51d8c6;};'use strict';var Sequelize=require(_0x6d24('0x0'));module[_0x6d24('0x1')]={'name':{'type':Sequelize['STRING'],'unique':_0x6d24('0x2'),'allowNull':![]},'description':{'type':Sequelize[_0x6d24('0x3')]}}; \ No newline at end of file +var _0x2f85=['sequelize','exports','STRING','name'];(function(_0x4bee59,_0x48f132){var _0x3ed6bb=function(_0x2b6c48){while(--_0x2b6c48){_0x4bee59['push'](_0x4bee59['shift']());}};_0x3ed6bb(++_0x48f132);}(_0x2f85,0xa0));var _0x52f8=function(_0x5d4596,_0x213e61){_0x5d4596=_0x5d4596-0x0;var _0x59e328=_0x2f85[_0x5d4596];return _0x59e328;};'use strict';var Sequelize=require(_0x52f8('0x0'));module[_0x52f8('0x1')]={'name':{'type':Sequelize[_0x52f8('0x2')],'unique':_0x52f8('0x3'),'allowNull':![]},'description':{'type':Sequelize[_0x52f8('0x2')]}}; \ No newline at end of file diff --git a/server/api/pause/pause.controller.js b/server/api/pause/pause.controller.js index f669b1b..ac0600b 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 _0xd3b5=['type','VIRTUAL','options','includeAll','include','findAll','rows','show','find','catch','create','body','user','role','UserProfileSection','userProfileId','params','eml-format','zip-dir','fast-json-patch','request-promise','util','path','to-csv','ejs','fs-extra','squel','crypto','jsforce','desk.js','querystring','papaparse','ioredis','../../components/parsers/advancedSearch','../../config/logger','api','../../config/utils','../../config/environment','../../config/license/util','sendStatus','status','end','json','offset','undefined','count','limit','set','apply','reject','save','update','then','destroy','get','Pauses','UserProfileResource','error','stack','name','send','map','Pause','fieldName','key','query','keys','filters','intersection','attributes','fields','length','model','hasOwnProperty','nolimit','order','pick','filter','merge','where'];(function(_0x7e4d6a,_0x10e6b3){var _0x524077=function(_0x5f3837){while(--_0x5f3837){_0x7e4d6a['push'](_0x7e4d6a['shift']());}};_0x524077(++_0x10e6b3);}(_0xd3b5,0x101));var _0x5d3b=function(_0x202d24,_0x5e8641){_0x202d24=_0x202d24-0x0;var _0x2b3a8e=_0xd3b5[_0x202d24];return _0x2b3a8e;};'use strict';var emlformat=require(_0x5d3b('0x0'));var rimraf=require('rimraf');var zipdir=require(_0x5d3b('0x1'));var jsonpatch=require(_0x5d3b('0x2'));var rp=require(_0x5d3b('0x3'));var moment=require('moment');var BPromise=require('bluebird');var Mustache=require('mustache');var util=require(_0x5d3b('0x4'));var path=require(_0x5d3b('0x5'));var sox=require('sox');var csv=require(_0x5d3b('0x6'));var ejs=require(_0x5d3b('0x7'));var fs=require('fs');var fs_extra=require(_0x5d3b('0x8'));var _=require('lodash');var squel=require(_0x5d3b('0x9'));var crypto=require(_0x5d3b('0xa'));var jsforce=require(_0x5d3b('0xb'));var deskjs=require(_0x5d3b('0xc'));var toCsv=require(_0x5d3b('0x6'));var querystring=require(_0x5d3b('0xd'));var Papa=require(_0x5d3b('0xe'));var Redis=require(_0x5d3b('0xf'));var authService=require('../../components/auth/service');var qs=require('../../components/parsers/qs');var as=require(_0x5d3b('0x10'));var hardwareService=require('../../config/license/hardware');var logger=require(_0x5d3b('0x11'))(_0x5d3b('0x12'));var utils=require(_0x5d3b('0x13'));var config=require(_0x5d3b('0x14'));var licenseUtil=require(_0x5d3b('0x15'));var db=require('../../mysqldb')['db'];function respondWithStatusCode(_0x38960e,_0x502045){_0x502045=_0x502045||0xcc;return function(_0xa2c71f){if(_0xa2c71f){return _0x38960e[_0x5d3b('0x16')](_0x502045);}return _0x38960e[_0x5d3b('0x17')](_0x502045)[_0x5d3b('0x18')]();};}function respondWithResult(_0x52ea3a,_0x455657){_0x455657=_0x455657||0xc8;return function(_0xe8b659){if(_0xe8b659){return _0x52ea3a[_0x5d3b('0x17')](_0x455657)[_0x5d3b('0x19')](_0xe8b659);}};}function respondWithFilteredResult(_0x227f8a,_0xb6818f){return function(_0x30e90a){if(_0x30e90a){var _0x42554c=typeof _0xb6818f[_0x5d3b('0x1a')]===_0x5d3b('0x1b')&&typeof _0xb6818f['limit']===_0x5d3b('0x1b');var _0x25f801=_0x30e90a[_0x5d3b('0x1c')];var _0x3ffa8d=_0x42554c?0x0:_0xb6818f['offset'];var _0x19b056=_0x42554c?_0x30e90a[_0x5d3b('0x1c')]:_0xb6818f['offset']+_0xb6818f[_0x5d3b('0x1d')];var _0x52d4be;if(_0x19b056>=_0x25f801){_0x19b056=_0x25f801;_0x52d4be=0xc8;}else{_0x52d4be=0xce;}_0x227f8a[_0x5d3b('0x17')](_0x52d4be);return _0x227f8a[_0x5d3b('0x1e')]('Content-Range',_0x3ffa8d+'-'+_0x19b056+'/'+_0x25f801)['json'](_0x30e90a);}return null;};}function patchUpdates(_0x2485fe){return function(_0x56620e){try{jsonpatch[_0x5d3b('0x1f')](_0x56620e,_0x2485fe,!![]);}catch(_0x5e2b67){return BPromise[_0x5d3b('0x20')](_0x5e2b67);}return _0x56620e[_0x5d3b('0x21')]();};}function saveUpdates(_0x27e987,_0x4fd0f6){return function(_0x1f5148){if(_0x1f5148){return _0x1f5148[_0x5d3b('0x22')](_0x27e987)[_0x5d3b('0x23')](function(_0x2ae093){return _0x2ae093;});}return null;};}function removeEntity(_0xfa974c,_0x5ebca1){return function(_0x13dd51){if(_0x13dd51){return _0x13dd51[_0x5d3b('0x24')]()['then'](function(){var _0x486d4d=_0x13dd51[_0x5d3b('0x25')]({'plain':!![]});var _0x3a668d=_0x5d3b('0x26');return db[_0x5d3b('0x27')]['destroy']({'where':{'type':_0x3a668d,'resourceId':_0x486d4d['id']}})[_0x5d3b('0x23')](function(){return _0x13dd51;});})[_0x5d3b('0x23')](function(){_0xfa974c[_0x5d3b('0x17')](0xcc)[_0x5d3b('0x18')]();});}};}function handleEntityNotFound(_0x4be129,_0x325e1f){return function(_0x19387){if(!_0x19387){_0x4be129[_0x5d3b('0x16')](0x194);}return _0x19387;};}function handleError(_0x1251f6,_0x2ea116){_0x2ea116=_0x2ea116||0x1f4;return function(_0x58fcef){logger[_0x5d3b('0x28')](_0x58fcef[_0x5d3b('0x29')]);if(_0x58fcef['name']){delete _0x58fcef[_0x5d3b('0x2a')];}_0x1251f6['status'](_0x2ea116)[_0x5d3b('0x2b')](_0x58fcef);};}exports['index']=function(_0x564d92,_0x226815){var _0x455c5d={},_0x362262={},_0x568791={'count':0x0,'rows':[]};var _0x488b2b=_[_0x5d3b('0x2c')](db[_0x5d3b('0x2d')]['rawAttributes'],function(_0x4d3677){return{'name':_0x4d3677[_0x5d3b('0x2e')],'type':_0x4d3677['type'][_0x5d3b('0x2f')]};});_0x362262['model']=_[_0x5d3b('0x2c')](_0x488b2b,'name');_0x362262[_0x5d3b('0x30')]=_[_0x5d3b('0x31')](_0x564d92['query']);_0x362262[_0x5d3b('0x32')]=_[_0x5d3b('0x33')](_0x362262['model'],_0x362262[_0x5d3b('0x30')]);_0x455c5d[_0x5d3b('0x34')]=_[_0x5d3b('0x33')](_0x362262['model'],qs[_0x5d3b('0x35')](_0x564d92[_0x5d3b('0x30')][_0x5d3b('0x35')]));_0x455c5d[_0x5d3b('0x34')]=_0x455c5d[_0x5d3b('0x34')][_0x5d3b('0x36')]?_0x455c5d['attributes']:_0x362262[_0x5d3b('0x37')];if(!_0x564d92['query'][_0x5d3b('0x38')](_0x5d3b('0x39'))){_0x455c5d[_0x5d3b('0x1d')]=qs['limit'](_0x564d92['query'][_0x5d3b('0x1d')]);_0x455c5d['offset']=qs[_0x5d3b('0x1a')](_0x564d92[_0x5d3b('0x30')][_0x5d3b('0x1a')]);}_0x455c5d[_0x5d3b('0x3a')]=qs['sort'](_0x564d92[_0x5d3b('0x30')]['sort']);_0x455c5d['where']=qs[_0x5d3b('0x32')](_[_0x5d3b('0x3b')](_0x564d92[_0x5d3b('0x30')],_0x362262[_0x5d3b('0x32')]),_0x488b2b);if(_0x564d92['query'][_0x5d3b('0x3c')]){_0x455c5d['where']=_[_0x5d3b('0x3d')](_0x455c5d[_0x5d3b('0x3e')],{'$or':_[_0x5d3b('0x2c')](_0x488b2b,function(_0x45cb41){if(_0x45cb41[_0x5d3b('0x3f')]!==_0x5d3b('0x40')){var _0xce58fd={};_0xce58fd[_0x45cb41[_0x5d3b('0x2a')]]={'$like':'%'+_0x564d92['query'][_0x5d3b('0x3c')]+'%'};return _0xce58fd;}})});}_0x455c5d=_[_0x5d3b('0x3d')]({},_0x455c5d,_0x564d92[_0x5d3b('0x41')]);var _0x35d365={'where':_0x455c5d[_0x5d3b('0x3e')]};return db[_0x5d3b('0x2d')]['count'](_0x35d365)[_0x5d3b('0x23')](function(_0x341c53){_0x568791['count']=_0x341c53;if(_0x564d92[_0x5d3b('0x30')][_0x5d3b('0x42')]){_0x455c5d[_0x5d3b('0x43')]=[{'all':!![]}];}return db['Pause'][_0x5d3b('0x44')](_0x455c5d);})[_0x5d3b('0x23')](function(_0x4ea034){_0x568791[_0x5d3b('0x45')]=_0x4ea034;return _0x568791;})[_0x5d3b('0x23')](respondWithFilteredResult(_0x226815,_0x455c5d))['catch'](handleError(_0x226815,null));};exports[_0x5d3b('0x46')]=function(_0x2a233e,_0x16c4fd){var _0xcd8b0f={'raw':!![],'where':{'id':_0x2a233e['params']['id']}},_0x328cef={};_0x328cef['model']=_['keys'](db[_0x5d3b('0x2d')]['rawAttributes']);_0x328cef['query']=_[_0x5d3b('0x31')](_0x2a233e[_0x5d3b('0x30')]);_0x328cef['filters']=_[_0x5d3b('0x33')](_0x328cef['model'],_0x328cef['query']);_0xcd8b0f[_0x5d3b('0x34')]=_[_0x5d3b('0x33')](_0x328cef[_0x5d3b('0x37')],qs[_0x5d3b('0x35')](_0x2a233e[_0x5d3b('0x30')]['fields']));_0xcd8b0f[_0x5d3b('0x34')]=_0xcd8b0f[_0x5d3b('0x34')][_0x5d3b('0x36')]?_0xcd8b0f[_0x5d3b('0x34')]:_0x328cef[_0x5d3b('0x37')];if(_0x2a233e[_0x5d3b('0x30')][_0x5d3b('0x42')]){_0xcd8b0f[_0x5d3b('0x43')]=[{'all':!![]}];}_0xcd8b0f=_['merge']({},_0xcd8b0f,_0x2a233e['options']);return db[_0x5d3b('0x2d')][_0x5d3b('0x47')](_0xcd8b0f)[_0x5d3b('0x23')](handleEntityNotFound(_0x16c4fd,null))[_0x5d3b('0x23')](respondWithResult(_0x16c4fd,null))[_0x5d3b('0x48')](handleError(_0x16c4fd,null));};exports['create']=function(_0x16818e,_0x9fd7e2){return db['Pause'][_0x5d3b('0x49')](_0x16818e[_0x5d3b('0x4a')],{})[_0x5d3b('0x23')](function(_0x529a7b){var _0x4c5b6d=_0x16818e[_0x5d3b('0x4b')]['get']({'plain':!![]});if(!_0x4c5b6d)throw new Error('Unable\x20to\x20retrieve\x20the\x20current\x20user');if(_0x4c5b6d[_0x5d3b('0x4c')]===_0x5d3b('0x4b')){var _0x33f01c=_0x529a7b[_0x5d3b('0x25')]({'plain':!![]});var _0x139179=_0x5d3b('0x26');return db[_0x5d3b('0x4d')][_0x5d3b('0x47')]({'where':{'name':_0x139179,'userProfileId':_0x4c5b6d[_0x5d3b('0x4e')]},'raw':!![]})[_0x5d3b('0x23')](function(_0xe725f2){if(_0xe725f2&&_0xe725f2['autoAssociation']===0x0){return db[_0x5d3b('0x27')][_0x5d3b('0x49')]({'name':_0x33f01c[_0x5d3b('0x2a')],'resourceId':_0x33f01c['id'],'type':_0xe725f2[_0x5d3b('0x2a')],'sectionId':_0xe725f2['id']},{})['then'](function(){return _0x529a7b;});}else{return _0x529a7b;}})[_0x5d3b('0x48')](function(_0x2188d9){logger[_0x5d3b('0x28')]('Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s',_0x2188d9);throw _0x2188d9;});}return _0x529a7b;})['then'](respondWithResult(_0x9fd7e2,0xc9))[_0x5d3b('0x48')](handleError(_0x9fd7e2,null));};exports['update']=function(_0x35d61a,_0x3cd43a){if(_0x35d61a[_0x5d3b('0x4a')]['id']){delete _0x35d61a[_0x5d3b('0x4a')]['id'];}return db[_0x5d3b('0x2d')][_0x5d3b('0x47')]({'where':{'id':_0x35d61a['params']['id']}})[_0x5d3b('0x23')](handleEntityNotFound(_0x3cd43a,null))[_0x5d3b('0x23')](saveUpdates(_0x35d61a['body'],null))[_0x5d3b('0x23')](respondWithResult(_0x3cd43a,null))[_0x5d3b('0x48')](handleError(_0x3cd43a,null));};exports[_0x5d3b('0x24')]=function(_0xd37c54,_0x16c794){return db[_0x5d3b('0x2d')][_0x5d3b('0x47')]({'where':{'id':_0xd37c54[_0x5d3b('0x4f')]['id']}})[_0x5d3b('0x23')](handleEntityNotFound(_0x16c794,null))['then'](removeEntity(_0x16c794,null))['catch'](handleError(_0x16c794,null));}; \ No newline at end of file +var _0x56e0=['filter','map','VIRTUAL','options','includeAll','include','findAll','rows','catch','params','Pause','length','merge','find','create','body','user','get','Unable\x20to\x20retrieve\x20the\x20current\x20user','role','UserProfileSection','userProfileId','autoAssociation','UserProfileResource','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','rimraf','zip-dir','fast-json-patch','request-promise','moment','bluebird','mustache','util','path','to-csv','ejs','fs-extra','lodash','squel','jsforce','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/license/util','../../mysqldb','sendStatus','status','offset','undefined','limit','count','Content-Range','json','apply','reject','update','destroy','then','Pauses','end','error','stack','rawAttributes','fieldName','type','key','model','name','query','keys','filters','intersection','attributes','fields','hasOwnProperty','order','sort','where','pick'];(function(_0x22f459,_0x5d1f3c){var _0x2f0b78=function(_0xc136e4){while(--_0xc136e4){_0x22f459['push'](_0x22f459['shift']());}};_0x2f0b78(++_0x5d1f3c);}(_0x56e0,0x118));var _0x056e=function(_0x420c05,_0x107ec7){_0x420c05=_0x420c05-0x0;var _0x3ae141=_0x56e0[_0x420c05];return _0x3ae141;};'use strict';var emlformat=require('eml-format');var rimraf=require(_0x056e('0x0'));var zipdir=require(_0x056e('0x1'));var jsonpatch=require(_0x056e('0x2'));var rp=require(_0x056e('0x3'));var moment=require(_0x056e('0x4'));var BPromise=require(_0x056e('0x5'));var Mustache=require(_0x056e('0x6'));var util=require(_0x056e('0x7'));var path=require(_0x056e('0x8'));var sox=require('sox');var csv=require(_0x056e('0x9'));var ejs=require(_0x056e('0xa'));var fs=require('fs');var fs_extra=require(_0x056e('0xb'));var _=require(_0x056e('0xc'));var squel=require(_0x056e('0xd'));var crypto=require('crypto');var jsforce=require(_0x056e('0xe'));var deskjs=require('desk.js');var toCsv=require(_0x056e('0x9'));var querystring=require(_0x056e('0xf'));var Papa=require(_0x056e('0x10'));var Redis=require(_0x056e('0x11'));var authService=require(_0x056e('0x12'));var qs=require(_0x056e('0x13'));var as=require('../../components/parsers/advancedSearch');var hardwareService=require(_0x056e('0x14'));var logger=require(_0x056e('0x15'))(_0x056e('0x16'));var utils=require(_0x056e('0x17'));var config=require('../../config/environment');var licenseUtil=require(_0x056e('0x18'));var db=require(_0x056e('0x19'))['db'];function respondWithStatusCode(_0x4ab1f6,_0x51a9ad){_0x51a9ad=_0x51a9ad||0xcc;return function(_0x24bd7c){if(_0x24bd7c){return _0x4ab1f6[_0x056e('0x1a')](_0x51a9ad);}return _0x4ab1f6[_0x056e('0x1b')](_0x51a9ad)['end']();};}function respondWithResult(_0x5b4bce,_0x15f69){_0x15f69=_0x15f69||0xc8;return function(_0x250d01){if(_0x250d01){return _0x5b4bce[_0x056e('0x1b')](_0x15f69)['json'](_0x250d01);}};}function respondWithFilteredResult(_0x422a64,_0x9cd3d7){return function(_0x51d8c9){if(_0x51d8c9){var _0xc31035=typeof _0x9cd3d7[_0x056e('0x1c')]===_0x056e('0x1d')&&typeof _0x9cd3d7[_0x056e('0x1e')]==='undefined';var _0x511dad=_0x51d8c9[_0x056e('0x1f')];var _0x219456=_0xc31035?0x0:_0x9cd3d7[_0x056e('0x1c')];var _0x4b5b5f=_0xc31035?_0x51d8c9['count']:_0x9cd3d7['offset']+_0x9cd3d7[_0x056e('0x1e')];var _0x393458;if(_0x4b5b5f>=_0x511dad){_0x4b5b5f=_0x511dad;_0x393458=0xc8;}else{_0x393458=0xce;}_0x422a64[_0x056e('0x1b')](_0x393458);return _0x422a64['set'](_0x056e('0x20'),_0x219456+'-'+_0x4b5b5f+'/'+_0x511dad)[_0x056e('0x21')](_0x51d8c9);}return null;};}function patchUpdates(_0x5acd77){return function(_0x390693){try{jsonpatch[_0x056e('0x22')](_0x390693,_0x5acd77,!![]);}catch(_0x140358){return BPromise[_0x056e('0x23')](_0x140358);}return _0x390693['save']();};}function saveUpdates(_0x4a596b,_0x35fc29){return function(_0x3b0a4e){if(_0x3b0a4e){return _0x3b0a4e[_0x056e('0x24')](_0x4a596b)['then'](function(_0x48edf9){return _0x48edf9;});}return null;};}function removeEntity(_0x322cbd,_0x36d6dc){return function(_0x8b65b6){if(_0x8b65b6){return _0x8b65b6[_0x056e('0x25')]()[_0x056e('0x26')](function(){var _0x49a7bf=_0x8b65b6['get']({'plain':!![]});var _0x42292b=_0x056e('0x27');return db['UserProfileResource'][_0x056e('0x25')]({'where':{'type':_0x42292b,'resourceId':_0x49a7bf['id']}})[_0x056e('0x26')](function(){return _0x8b65b6;});})['then'](function(){_0x322cbd[_0x056e('0x1b')](0xcc)[_0x056e('0x28')]();});}};}function handleEntityNotFound(_0x3084c7,_0x3fdbb5){return function(_0x54ab4f){if(!_0x54ab4f){_0x3084c7['sendStatus'](0x194);}return _0x54ab4f;};}function handleError(_0x50f04f,_0x2b81a3){_0x2b81a3=_0x2b81a3||0x1f4;return function(_0x1648d2){logger[_0x056e('0x29')](_0x1648d2[_0x056e('0x2a')]);if(_0x1648d2['name']){delete _0x1648d2['name'];}_0x50f04f[_0x056e('0x1b')](_0x2b81a3)['send'](_0x1648d2);};}exports['index']=function(_0x27b259,_0x178b92){var _0x513fd6={},_0xbc34bb={},_0x4211d0={'count':0x0,'rows':[]};var _0x453e2e=_['map'](db['Pause'][_0x056e('0x2b')],function(_0x7cc65a){return{'name':_0x7cc65a[_0x056e('0x2c')],'type':_0x7cc65a[_0x056e('0x2d')][_0x056e('0x2e')]};});_0xbc34bb[_0x056e('0x2f')]=_['map'](_0x453e2e,_0x056e('0x30'));_0xbc34bb[_0x056e('0x31')]=_[_0x056e('0x32')](_0x27b259['query']);_0xbc34bb[_0x056e('0x33')]=_[_0x056e('0x34')](_0xbc34bb[_0x056e('0x2f')],_0xbc34bb['query']);_0x513fd6[_0x056e('0x35')]=_[_0x056e('0x34')](_0xbc34bb['model'],qs[_0x056e('0x36')](_0x27b259[_0x056e('0x31')][_0x056e('0x36')]));_0x513fd6[_0x056e('0x35')]=_0x513fd6[_0x056e('0x35')]['length']?_0x513fd6['attributes']:_0xbc34bb['model'];if(!_0x27b259[_0x056e('0x31')][_0x056e('0x37')]('nolimit')){_0x513fd6[_0x056e('0x1e')]=qs[_0x056e('0x1e')](_0x27b259['query'][_0x056e('0x1e')]);_0x513fd6['offset']=qs[_0x056e('0x1c')](_0x27b259['query'][_0x056e('0x1c')]);}_0x513fd6[_0x056e('0x38')]=qs[_0x056e('0x39')](_0x27b259[_0x056e('0x31')][_0x056e('0x39')]);_0x513fd6[_0x056e('0x3a')]=qs[_0x056e('0x33')](_[_0x056e('0x3b')](_0x27b259['query'],_0xbc34bb[_0x056e('0x33')]),_0x453e2e);if(_0x27b259[_0x056e('0x31')][_0x056e('0x3c')]){_0x513fd6[_0x056e('0x3a')]=_['merge'](_0x513fd6[_0x056e('0x3a')],{'$or':_[_0x056e('0x3d')](_0x453e2e,function(_0x2cfb3a){if(_0x2cfb3a[_0x056e('0x2d')]!==_0x056e('0x3e')){var _0x40d11f={};_0x40d11f[_0x2cfb3a[_0x056e('0x30')]]={'$like':'%'+_0x27b259[_0x056e('0x31')][_0x056e('0x3c')]+'%'};return _0x40d11f;}})});}_0x513fd6=_['merge']({},_0x513fd6,_0x27b259[_0x056e('0x3f')]);var _0x1ac300={'where':_0x513fd6[_0x056e('0x3a')]};return db['Pause'][_0x056e('0x1f')](_0x1ac300)[_0x056e('0x26')](function(_0x2f0de0){_0x4211d0[_0x056e('0x1f')]=_0x2f0de0;if(_0x27b259[_0x056e('0x31')][_0x056e('0x40')]){_0x513fd6[_0x056e('0x41')]=[{'all':!![]}];}return db['Pause'][_0x056e('0x42')](_0x513fd6);})['then'](function(_0x51407a){_0x4211d0[_0x056e('0x43')]=_0x51407a;return _0x4211d0;})[_0x056e('0x26')](respondWithFilteredResult(_0x178b92,_0x513fd6))[_0x056e('0x44')](handleError(_0x178b92,null));};exports['show']=function(_0x3551bb,_0xe3fc5b){var _0xba7179={'raw':!![],'where':{'id':_0x3551bb[_0x056e('0x45')]['id']}},_0x199825={};_0x199825[_0x056e('0x2f')]=_[_0x056e('0x32')](db[_0x056e('0x46')]['rawAttributes']);_0x199825[_0x056e('0x31')]=_['keys'](_0x3551bb['query']);_0x199825[_0x056e('0x33')]=_[_0x056e('0x34')](_0x199825['model'],_0x199825[_0x056e('0x31')]);_0xba7179[_0x056e('0x35')]=_[_0x056e('0x34')](_0x199825[_0x056e('0x2f')],qs[_0x056e('0x36')](_0x3551bb[_0x056e('0x31')]['fields']));_0xba7179[_0x056e('0x35')]=_0xba7179[_0x056e('0x35')][_0x056e('0x47')]?_0xba7179[_0x056e('0x35')]:_0x199825['model'];if(_0x3551bb[_0x056e('0x31')][_0x056e('0x40')]){_0xba7179[_0x056e('0x41')]=[{'all':!![]}];}_0xba7179=_[_0x056e('0x48')]({},_0xba7179,_0x3551bb[_0x056e('0x3f')]);return db['Pause'][_0x056e('0x49')](_0xba7179)[_0x056e('0x26')](handleEntityNotFound(_0xe3fc5b,null))['then'](respondWithResult(_0xe3fc5b,null))[_0x056e('0x44')](handleError(_0xe3fc5b,null));};exports[_0x056e('0x4a')]=function(_0x99b138,_0x5b592c){return db[_0x056e('0x46')][_0x056e('0x4a')](_0x99b138[_0x056e('0x4b')],{})['then'](function(_0x3c9106){var _0x2fc404=_0x99b138[_0x056e('0x4c')][_0x056e('0x4d')]({'plain':!![]});if(!_0x2fc404)throw new Error(_0x056e('0x4e'));if(_0x2fc404[_0x056e('0x4f')]===_0x056e('0x4c')){var _0x5a7cdb=_0x3c9106[_0x056e('0x4d')]({'plain':!![]});var _0x554851=_0x056e('0x27');return db[_0x056e('0x50')][_0x056e('0x49')]({'where':{'name':_0x554851,'userProfileId':_0x2fc404[_0x056e('0x51')]},'raw':!![]})[_0x056e('0x26')](function(_0x5ef003){if(_0x5ef003&&_0x5ef003[_0x056e('0x52')]===0x0){return db[_0x056e('0x53')][_0x056e('0x4a')]({'name':_0x5a7cdb[_0x056e('0x30')],'resourceId':_0x5a7cdb['id'],'type':_0x5ef003['name'],'sectionId':_0x5ef003['id']},{})[_0x056e('0x26')](function(){return _0x3c9106;});}else{return _0x3c9106;}})[_0x056e('0x44')](function(_0x4b836f){logger[_0x056e('0x29')](_0x056e('0x54'),_0x4b836f);throw _0x4b836f;});}return _0x3c9106;})['then'](respondWithResult(_0x5b592c,0xc9))[_0x056e('0x44')](handleError(_0x5b592c,null));};exports[_0x056e('0x24')]=function(_0x1c8648,_0x517edc){if(_0x1c8648[_0x056e('0x4b')]['id']){delete _0x1c8648[_0x056e('0x4b')]['id'];}return db[_0x056e('0x46')][_0x056e('0x49')]({'where':{'id':_0x1c8648[_0x056e('0x45')]['id']}})[_0x056e('0x26')](handleEntityNotFound(_0x517edc,null))['then'](saveUpdates(_0x1c8648[_0x056e('0x4b')],null))[_0x056e('0x26')](respondWithResult(_0x517edc,null))['catch'](handleError(_0x517edc,null));};exports[_0x056e('0x25')]=function(_0x1b8fba,_0x1372d1){return db[_0x056e('0x46')][_0x056e('0x49')]({'where':{'id':_0x1b8fba[_0x056e('0x45')]['id']}})[_0x056e('0x26')](handleEntityNotFound(_0x1372d1,null))[_0x056e('0x26')](removeEntity(_0x1372d1,null))['catch'](handleError(_0x1372d1,null));}; \ No newline at end of file diff --git a/server/api/pause/pause.model.js b/server/api/pause/pause.model.js index 2db7e7c..bf253bb 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 _0x53ec=['bluebird','path','../../config/environment','./pause.attributes','define','Pause','lodash','util','../../config/logger','api','moment'];(function(_0xc2c1cf,_0x281cc2){var _0x32957b=function(_0x178538){while(--_0x178538){_0xc2c1cf['push'](_0xc2c1cf['shift']());}};_0x32957b(++_0x281cc2);}(_0x53ec,0x192));var _0xc53e=function(_0xe4e303,_0x8f9657){_0xe4e303=_0xe4e303-0x0;var _0x39021e=_0x53ec[_0xe4e303];return _0x39021e;};'use strict';var _=require(_0xc53e('0x0'));var util=require(_0xc53e('0x1'));var logger=require(_0xc53e('0x2'))(_0xc53e('0x3'));var moment=require(_0xc53e('0x4'));var BPromise=require(_0xc53e('0x5'));var rp=require('request-promise');var fs=require('fs');var path=require(_0xc53e('0x6'));var rimraf=require('rimraf');var config=require(_0xc53e('0x7'));var attributes=require(_0xc53e('0x8'));module['exports']=function(_0x2f1414,_0x4f989b){return _0x2f1414[_0xc53e('0x9')](_0xc53e('0xa'),attributes,{'tableName':'tools_pauses','paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x53ec=['bluebird','path','../../config/environment','./pause.attributes','define','Pause','lodash','util','../../config/logger','api','moment'];(function(_0x187978,_0x2a374b){var _0xad2dfa=function(_0x25b7f2){while(--_0x25b7f2){_0x187978['push'](_0x187978['shift']());}};_0xad2dfa(++_0x2a374b);}(_0x53ec,0x192));var _0xc53e=function(_0x141486,_0x58ed56){_0x141486=_0x141486-0x0;var _0x1b5fb9=_0x53ec[_0x141486];return _0x1b5fb9;};'use strict';var _=require(_0xc53e('0x0'));var util=require(_0xc53e('0x1'));var logger=require(_0xc53e('0x2'))(_0xc53e('0x3'));var moment=require(_0xc53e('0x4'));var BPromise=require(_0xc53e('0x5'));var rp=require('request-promise');var fs=require('fs');var path=require(_0xc53e('0x6'));var rimraf=require('rimraf');var config=require(_0xc53e('0x7'));var attributes=require(_0xc53e('0x8'));module['exports']=function(_0x2f1414,_0x4f989b){return _0x2f1414[_0xc53e('0x9')](_0xc53e('0xa'),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 1135ef5..63eca6e 100644 --- a/server/api/pause/pause.rpc.js +++ b/server/api/pause/pause.rpc.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x7a54=['message','request\x20sent','result','catch','Pause','find','options','raw','where','attributes','map','include','model','ShowPause','lodash','util','moment','randomstring','ioredis','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','http','info','Pause,\x20%s,\x20%s','debug','stringify','error','code'];(function(_0x1b48d2,_0x30b277){var _0xb4c314=function(_0x4df129){while(--_0x4df129){_0x1b48d2['push'](_0x1b48d2['shift']());}};_0xb4c314(++_0x30b277);}(_0x7a54,0x106));var _0x47a5=function(_0x3334e4,_0x42b0a0){_0x3334e4=_0x3334e4-0x0;var _0x3616be=_0x7a54[_0x3334e4];return _0x3616be;};'use strict';var _=require(_0x47a5('0x0'));var util=require(_0x47a5('0x1'));var moment=require(_0x47a5('0x2'));var BPromise=require('bluebird');var rs=require(_0x47a5('0x3'));var fs=require('fs');var Redis=require(_0x47a5('0x4'));var db=require('../../mysqldb')['db'];var utils=require(_0x47a5('0x5'));var logger=require(_0x47a5('0x6'))(_0x47a5('0x7'));var config=require(_0x47a5('0x8'));var jayson=require(_0x47a5('0x9'));var client=jayson['client'][_0x47a5('0xa')]({'port':0x232a});function respondWithRpcPromise(_0x59199c,_0x343372,_0x30e405){return new BPromise(function(_0x506eda,_0x194fb0){return client['request'](_0x59199c,_0x30e405)['then'](function(_0x582352){logger[_0x47a5('0xb')](_0x47a5('0xc'),_0x343372,'request\x20sent');logger[_0x47a5('0xd')]('Pause,\x20%s,\x20%s,\x20%s',_0x343372,'request\x20sent',JSON[_0x47a5('0xe')](_0x582352));if(_0x582352[_0x47a5('0xf')]){if(_0x582352[_0x47a5('0xf')][_0x47a5('0x10')]===0x1f4){logger[_0x47a5('0xf')](_0x47a5('0xc'),_0x343372,_0x582352[_0x47a5('0xf')]['message']);return _0x194fb0(_0x582352[_0x47a5('0xf')][_0x47a5('0x11')]);}logger[_0x47a5('0xf')](_0x47a5('0xc'),_0x343372,_0x582352[_0x47a5('0xf')][_0x47a5('0x11')]);return _0x506eda(_0x582352[_0x47a5('0xf')][_0x47a5('0x11')]);}else{logger['info'](_0x47a5('0xc'),_0x343372,_0x47a5('0x12'));_0x506eda(_0x582352[_0x47a5('0x13')][_0x47a5('0x11')]);}})[_0x47a5('0x14')](function(_0x574af6){logger['error'](_0x47a5('0xc'),_0x343372,_0x574af6);_0x194fb0(_0x574af6);});});}exports['ShowPause']=function(_0x5247fd){var _0x423a81=this;return new Promise(function(_0xaf70a6,_0x2ce454){return db[_0x47a5('0x15')][_0x47a5('0x16')]({'raw':_0x5247fd[_0x47a5('0x17')]?_0x5247fd[_0x47a5('0x17')][_0x47a5('0x18')]===undefined?!![]:![]:!![],'where':_0x5247fd[_0x47a5('0x17')]?_0x5247fd['options'][_0x47a5('0x19')]||null:null,'attributes':_0x5247fd[_0x47a5('0x17')]?_0x5247fd['options'][_0x47a5('0x1a')]||null:null,'include':_0x5247fd[_0x47a5('0x17')]?_0x5247fd[_0x47a5('0x17')]['include']?_[_0x47a5('0x1b')](_0x5247fd[_0x47a5('0x17')][_0x47a5('0x1c')],function(_0x7a9f9e){return{'model':db[_0x7a9f9e['model']],'as':_0x7a9f9e['as'],'attributes':_0x7a9f9e[_0x47a5('0x1a')],'include':_0x7a9f9e[_0x47a5('0x1c')]?_['map'](_0x7a9f9e[_0x47a5('0x1c')],function(_0xc4cd63){return{'model':db[_0xc4cd63[_0x47a5('0x1d')]],'as':_0xc4cd63['as'],'attributes':_0xc4cd63[_0x47a5('0x1a')],'include':_0xc4cd63[_0x47a5('0x1c')]?_['map'](_0xc4cd63['include'],function(_0x136745){return{'model':db[_0x136745['model']],'as':_0x136745['as'],'attributes':_0x136745[_0x47a5('0x1a')]};}):[]};}):[]};}):[]:[]})['then'](function(_0x23cb77){logger[_0x47a5('0xb')](_0x47a5('0x1e'),_0x5247fd);logger[_0x47a5('0xd')](_0x47a5('0x1e'),_0x5247fd,JSON[_0x47a5('0xe')](_0x23cb77));_0xaf70a6(_0x23cb77);})[_0x47a5('0x14')](function(_0x136b14){logger[_0x47a5('0xf')](_0x47a5('0x1e'),_0x136b14[_0x47a5('0x11')],_0x5247fd);_0x2ce454(_0x423a81[_0x47a5('0xf')](0x1f4,_0x136b14[_0x47a5('0x11')]));});});}; \ No newline at end of file +var _0x7a54=['message','request\x20sent','result','catch','Pause','find','options','raw','where','attributes','map','include','model','ShowPause','lodash','util','moment','randomstring','ioredis','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','http','info','Pause,\x20%s,\x20%s','debug','stringify','error','code'];(function(_0x1af6d8,_0xc0d47b){var _0x1cc691=function(_0x50491d){while(--_0x50491d){_0x1af6d8['push'](_0x1af6d8['shift']());}};_0x1cc691(++_0xc0d47b);}(_0x7a54,0x106));var _0x47a5=function(_0xd7dcf,_0x5dd06d){_0xd7dcf=_0xd7dcf-0x0;var _0x489968=_0x7a54[_0xd7dcf];return _0x489968;};'use strict';var _=require(_0x47a5('0x0'));var util=require(_0x47a5('0x1'));var moment=require(_0x47a5('0x2'));var BPromise=require('bluebird');var rs=require(_0x47a5('0x3'));var fs=require('fs');var Redis=require(_0x47a5('0x4'));var db=require('../../mysqldb')['db'];var utils=require(_0x47a5('0x5'));var logger=require(_0x47a5('0x6'))(_0x47a5('0x7'));var config=require(_0x47a5('0x8'));var jayson=require(_0x47a5('0x9'));var client=jayson['client'][_0x47a5('0xa')]({'port':0x232a});function respondWithRpcPromise(_0x59199c,_0x343372,_0x30e405){return new BPromise(function(_0x506eda,_0x194fb0){return client['request'](_0x59199c,_0x30e405)['then'](function(_0x582352){logger[_0x47a5('0xb')](_0x47a5('0xc'),_0x343372,'request\x20sent');logger[_0x47a5('0xd')]('Pause,\x20%s,\x20%s,\x20%s',_0x343372,'request\x20sent',JSON[_0x47a5('0xe')](_0x582352));if(_0x582352[_0x47a5('0xf')]){if(_0x582352[_0x47a5('0xf')][_0x47a5('0x10')]===0x1f4){logger[_0x47a5('0xf')](_0x47a5('0xc'),_0x343372,_0x582352[_0x47a5('0xf')]['message']);return _0x194fb0(_0x582352[_0x47a5('0xf')][_0x47a5('0x11')]);}logger[_0x47a5('0xf')](_0x47a5('0xc'),_0x343372,_0x582352[_0x47a5('0xf')][_0x47a5('0x11')]);return _0x506eda(_0x582352[_0x47a5('0xf')][_0x47a5('0x11')]);}else{logger['info'](_0x47a5('0xc'),_0x343372,_0x47a5('0x12'));_0x506eda(_0x582352[_0x47a5('0x13')][_0x47a5('0x11')]);}})[_0x47a5('0x14')](function(_0x574af6){logger['error'](_0x47a5('0xc'),_0x343372,_0x574af6);_0x194fb0(_0x574af6);});});}exports['ShowPause']=function(_0x5247fd){var _0x423a81=this;return new Promise(function(_0xaf70a6,_0x2ce454){return db[_0x47a5('0x15')][_0x47a5('0x16')]({'raw':_0x5247fd[_0x47a5('0x17')]?_0x5247fd[_0x47a5('0x17')][_0x47a5('0x18')]===undefined?!![]:![]:!![],'where':_0x5247fd[_0x47a5('0x17')]?_0x5247fd['options'][_0x47a5('0x19')]||null:null,'attributes':_0x5247fd[_0x47a5('0x17')]?_0x5247fd['options'][_0x47a5('0x1a')]||null:null,'include':_0x5247fd[_0x47a5('0x17')]?_0x5247fd[_0x47a5('0x17')]['include']?_[_0x47a5('0x1b')](_0x5247fd[_0x47a5('0x17')][_0x47a5('0x1c')],function(_0x7a9f9e){return{'model':db[_0x7a9f9e['model']],'as':_0x7a9f9e['as'],'attributes':_0x7a9f9e[_0x47a5('0x1a')],'include':_0x7a9f9e[_0x47a5('0x1c')]?_['map'](_0x7a9f9e[_0x47a5('0x1c')],function(_0xc4cd63){return{'model':db[_0xc4cd63[_0x47a5('0x1d')]],'as':_0xc4cd63['as'],'attributes':_0xc4cd63[_0x47a5('0x1a')],'include':_0xc4cd63[_0x47a5('0x1c')]?_['map'](_0xc4cd63['include'],function(_0x136745){return{'model':db[_0x136745['model']],'as':_0x136745['as'],'attributes':_0x136745[_0x47a5('0x1a')]};}):[]};}):[]};}):[]:[]})['then'](function(_0x23cb77){logger[_0x47a5('0xb')](_0x47a5('0x1e'),_0x5247fd);logger[_0x47a5('0xd')](_0x47a5('0x1e'),_0x5247fd,JSON[_0x47a5('0xe')](_0x23cb77));_0xaf70a6(_0x23cb77);})[_0x47a5('0x14')](function(_0x136b14){logger[_0x47a5('0xf')](_0x47a5('0x1e'),_0x136b14[_0x47a5('0x11')],_0x5247fd);_0x2ce454(_0x423a81[_0x47a5('0xf')](0x1f4,_0x136b14[_0x47a5('0x11')]));});});}; \ No newline at end of file diff --git a/server/api/plugin/index.js b/server/api/plugin/index.js index a47cc2d..d9dcbf2 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 _0x702d=['/:id/download','download','diskStorage','server/files/plugins','originalname','replace','format','%s-%s%s','basename','extname','post','single','upload','/:id','update','delete','exports','multer','util','path','connect-timeout','express','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','get','index','/webhook','isAuthenticated','show'];(function(_0x390316,_0x22c246){var _0x52cf92=function(_0x14db06){while(--_0x14db06){_0x390316['push'](_0x390316['shift']());}};_0x52cf92(++_0x22c246);}(_0x702d,0x147));var _0xd702=function(_0x364f68,_0x5bdde5){_0x364f68=_0x364f68-0x0;var _0x1d4de7=_0x702d[_0x364f68];return _0x1d4de7;};'use strict';var multer=require(_0xd702('0x0'));var util=require(_0xd702('0x1'));var path=require(_0xd702('0x2'));var timeout=require(_0xd702('0x3'));var express=require(_0xd702('0x4'));var router=express['Router']();var fs_extra=require(_0xd702('0x5'));var auth=require(_0xd702('0x6'));var interaction=require(_0xd702('0x7'));var config=require(_0xd702('0x8'));var controller=require('./plugin.controller');router[_0xd702('0x9')]('/',auth['isAuthenticated'](),controller[_0xd702('0xa')]);router[_0xd702('0x9')](_0xd702('0xb'),controller['webhookGet']);router[_0xd702('0x9')]('/:id',auth[_0xd702('0xc')](),controller[_0xd702('0xd')]);router[_0xd702('0x9')](_0xd702('0xe'),auth[_0xd702('0xc')](),controller[_0xd702('0xf')]);var upload=multer({'storage':multer[_0xd702('0x10')]({'destination':function(_0x1988eb,_0x5907cf,_0x15a632){_0x15a632(null,path['join'](config['root'],_0xd702('0x11')));},'filename':function(_0x42e1ad,_0x273577,_0x5c0dad){_0x273577[_0xd702('0x12')]=_0x273577[_0xd702('0x12')][_0xd702('0x13')](/[+@&\/\\#,+()$~%'":*?<>{}\s\\|]/g,'-');_0x5c0dad(null,util[_0xd702('0x14')](_0xd702('0x15'),path[_0xd702('0x16')](_0x273577['originalname'],path[_0xd702('0x17')](_0x273577[_0xd702('0x12')])),Date['now'](),path[_0xd702('0x17')](_0x273577['originalname'])));}})});router[_0xd702('0x18')]('/',upload[_0xd702('0x19')]('file'),controller[_0xd702('0x1a')]);router[_0xd702('0x18')](_0xd702('0xb'),controller['webhookPost']);router['put'](_0xd702('0x1b'),auth['isAuthenticated'](),controller[_0xd702('0x1c')]);router[_0xd702('0x1d')](_0xd702('0x1b'),auth[_0xd702('0xc')](),controller[_0xd702('0x1d')]);module[_0xd702('0x1e')]=router; \ No newline at end of file +var _0x6f0d=['delete','util','path','connect-timeout','express','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','./plugin.controller','isAuthenticated','get','/webhook','webhookGet','show','/:id/download','download','join','server/files/plugins','originalname','replace','format','%s-%s%s','extname','now','post','single','file','upload','webhookPost','put','/:id','update'];(function(_0x145b3c,_0x31ea4a){var _0x1b6e36=function(_0xfccee6){while(--_0xfccee6){_0x145b3c['push'](_0x145b3c['shift']());}};_0x1b6e36(++_0x31ea4a);}(_0x6f0d,0x16c));var _0xd6f0=function(_0x52a999,_0x2b10fc){_0x52a999=_0x52a999-0x0;var _0xac4e82=_0x6f0d[_0x52a999];return _0xac4e82;};'use strict';var multer=require('multer');var util=require(_0xd6f0('0x0'));var path=require(_0xd6f0('0x1'));var timeout=require(_0xd6f0('0x2'));var express=require(_0xd6f0('0x3'));var router=express['Router']();var fs_extra=require(_0xd6f0('0x4'));var auth=require(_0xd6f0('0x5'));var interaction=require(_0xd6f0('0x6'));var config=require(_0xd6f0('0x7'));var controller=require(_0xd6f0('0x8'));router['get']('/',auth[_0xd6f0('0x9')](),controller['index']);router[_0xd6f0('0xa')](_0xd6f0('0xb'),controller[_0xd6f0('0xc')]);router[_0xd6f0('0xa')]('/:id',auth['isAuthenticated'](),controller[_0xd6f0('0xd')]);router[_0xd6f0('0xa')](_0xd6f0('0xe'),auth[_0xd6f0('0x9')](),controller[_0xd6f0('0xf')]);var upload=multer({'storage':multer['diskStorage']({'destination':function(_0x136eee,_0xee144c,_0x329f69){_0x329f69(null,path[_0xd6f0('0x10')](config['root'],_0xd6f0('0x11')));},'filename':function(_0x2f0459,_0x306aad,_0x45973d){_0x306aad[_0xd6f0('0x12')]=_0x306aad[_0xd6f0('0x12')][_0xd6f0('0x13')](/[+@&\/\\#,+()$~%'":*?<>{}\s\\|]/g,'-');_0x45973d(null,util[_0xd6f0('0x14')](_0xd6f0('0x15'),path['basename'](_0x306aad[_0xd6f0('0x12')],path[_0xd6f0('0x16')](_0x306aad['originalname'])),Date[_0xd6f0('0x17')](),path['extname'](_0x306aad[_0xd6f0('0x12')])));}})});router[_0xd6f0('0x18')]('/',upload[_0xd6f0('0x19')](_0xd6f0('0x1a')),controller[_0xd6f0('0x1b')]);router[_0xd6f0('0x18')](_0xd6f0('0xb'),controller[_0xd6f0('0x1c')]);router[_0xd6f0('0x1d')](_0xd6f0('0x1e'),auth[_0xd6f0('0x9')](),controller[_0xd6f0('0x1f')]);router[_0xd6f0('0x20')](_0xd6f0('0x1e'),auth[_0xd6f0('0x9')](),controller[_0xd6f0('0x20')]);module['exports']=router; \ No newline at end of file diff --git a/server/api/plugin/plugin.attributes.js b/server/api/plugin/plugin.attributes.js index 01303dc..a34812f 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 _0xf466=['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.','sequelize','ENUM','html','script','TEXT','STRING'];(function(_0x492f45,_0x4bbf55){var _0x297b67=function(_0x9de251){while(--_0x9de251){_0x492f45['push'](_0x492f45['shift']());}};_0x297b67(++_0x4bbf55);}(_0xf466,0x1d6));var _0x6f46=function(_0xa883e3,_0x599111){_0xa883e3=_0xa883e3-0x0;var _0x23300a=_0xf466[_0xa883e3];return _0x23300a;};'use strict';var Sequelize=require(_0x6f46('0x0'));module['exports']={'name':{'type':Sequelize['STRING']},'type':{'type':Sequelize[_0x6f46('0x1')](_0x6f46('0x2'),_0x6f46('0x3'))},'description':{'type':Sequelize[_0x6f46('0x4')]},'version':{'type':Sequelize[_0x6f46('0x4')]},'path':{'type':Sequelize[_0x6f46('0x5')],'comment':_0x6f46('0x6')},'active':{'type':Sequelize[_0x6f46('0x7')],'defaultValue':0x0,'comment':_0x6f46('0x8')},'sidebar':{'type':Sequelize['ENUM'](_0x6f46('0x9'),_0x6f46('0xa'),_0x6f46('0xb'),_0x6f46('0xc')),'defaultValue':_0x6f46('0xb'),'comment':_0x6f46('0xd')},'icon':{'type':Sequelize[_0x6f46('0x5')]},'adminUrl':{'type':Sequelize[_0x6f46('0x5')]},'agentUrl':{'type':Sequelize[_0x6f46('0x5')]},'scriptName':{'type':Sequelize[_0x6f46('0x5')]},'scriptPath':{'type':Sequelize[_0x6f46('0x5')]}}; \ No newline at end of file +var _0xd0fb=['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(_0x5e8979,_0xdb0cbf){var _0x5ecdc2=function(_0x387178){while(--_0x387178){_0x5e8979['push'](_0x5e8979['shift']());}};_0x5ecdc2(++_0xdb0cbf);}(_0xd0fb,0x195));var _0xbd0f=function(_0x5bcdad,_0x5f3806){_0x5bcdad=_0x5bcdad-0x0;var _0x180ddf=_0xd0fb[_0x5bcdad];return _0x180ddf;};'use strict';var Sequelize=require(_0xbd0f('0x0'));module[_0xbd0f('0x1')]={'name':{'type':Sequelize[_0xbd0f('0x2')]},'type':{'type':Sequelize[_0xbd0f('0x3')](_0xbd0f('0x4'),_0xbd0f('0x5'))},'description':{'type':Sequelize[_0xbd0f('0x6')]},'version':{'type':Sequelize[_0xbd0f('0x6')]},'path':{'type':Sequelize[_0xbd0f('0x2')],'comment':_0xbd0f('0x7')},'active':{'type':Sequelize[_0xbd0f('0x8')],'defaultValue':0x0,'comment':_0xbd0f('0x9')},'sidebar':{'type':Sequelize[_0xbd0f('0x3')](_0xbd0f('0xa'),_0xbd0f('0xb'),_0xbd0f('0xc'),_0xbd0f('0xd')),'defaultValue':_0xbd0f('0xc'),'comment':_0xbd0f('0xe')},'icon':{'type':Sequelize[_0xbd0f('0x2')]},'adminUrl':{'type':Sequelize[_0xbd0f('0x2')]},'agentUrl':{'type':Sequelize[_0xbd0f('0x2')]},'scriptName':{'type':Sequelize[_0xbd0f('0x2')]},'scriptPath':{'type':Sequelize[_0xbd0f('0x2')]}}; \ No newline at end of file diff --git a/server/api/plugin/plugin.controller.js b/server/api/plugin/plugin.controller.js index 3d47666..8985db8 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 _0xcc1e=['squel','crypto','desk.js','querystring','extract-zip','rimraf','ioredis','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','api','../../config/utils','../../config/license/util','../../mysqldb','redis','localhost','socket.io-emitter','./plugin.socket','sendStatus','status','end','offset','undefined','limit','count','Content-Range','apply','save','get','UserProfileResource','destroy','then','error','name','send','index','map','rawAttributes','model','query','keys','intersection','attributes','fields','length','sort','where','filters','pick','filter','merge','type','options','Plugin','include','findAll','rows','catch','show','params','includeAll','find','path','server/files/plugins','%s.zip','basename','createWriteStream','zip','warning','code','ENOENT','Sequelize','Error','Error\x20while\x20generating\x20the\x20zip\x20archive','pipe','**/*','root','node_modules/**/*','join','attachments/**/*','close','existsSync','Error\x20while\x20downloading\x20the\x20plugin','unlinkSync','info','Download\x20completed','Temporary\x20file\x20removed','upload','file','filename','extname','Plugin\x20upload\x20filepath:\x20%s','Plugin\x20upload\x20destination:\x20%s','chmodSync','0777','readdirSync','Invalid\x20plugin\x20structure','lstatSync','isDirectory','some','manifest.json','Plugin\x20manifest\x20missing','parse','Invalid\x20manifest:\x20type\x20missing','version','parameters','Invalid\x20manifest:\x20parameters\x20missing','html','views','admin','agent','Invalid\x20manifest:\x20no\x20view\x20specified','scriptName','Invalid\x20manifest:\x20script\x20name\x20missing','scriptPath','Invalid\x20manifest:\x20script\x20path\x20missing','description','always','icon','Warning:\x20admin\x20view\x20not\x20specified','plugins','Warning:\x20agent\x20view\x20not\x20specified','script','test','create','body','role','userProfileId','Unable\x20to\x20retrieve\x20the\x20current\x20user','user','UserProfileSection','Plugins','autoAssociation','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','Zip\x20archive\x20removed','Extracted\x20folder\x20removed','update','delete','webhookGet','resolve','\x27PATH\x27\x20parameter\x20not\x20specified','port','hostname','json','encoding','headers','content-type','set','endsWith','download','statusCode','webhookPost','\x27PORT\x27\x20parameter\x20not\x20specified','http://localhost:','method','format','%s%s','content-length','eml-format','zip-dir','fast-json-patch','request-promise','moment','bluebird','mustache','util','sox','to-csv','ejs','fs-extra','lodash'];(function(_0xfa634c,_0x414e0e){var _0x73e478=function(_0xac2a51){while(--_0xac2a51){_0xfa634c['push'](_0xfa634c['shift']());}};_0x73e478(++_0x414e0e);}(_0xcc1e,0x1f4));var _0xecc1=function(_0x4b2d91,_0x482937){_0x4b2d91=_0x4b2d91-0x0;var _0x4b7d17=_0xcc1e[_0x4b2d91];return _0x4b7d17;};'use strict';var emlformat=require(_0xecc1('0x0'));var rimraf=require('rimraf');var zipdir=require(_0xecc1('0x1'));var jsonpatch=require(_0xecc1('0x2'));var rp=require(_0xecc1('0x3'));var moment=require(_0xecc1('0x4'));var BPromise=require(_0xecc1('0x5'));var Mustache=require(_0xecc1('0x6'));var util=require(_0xecc1('0x7'));var path=require('path');var sox=require(_0xecc1('0x8'));var csv=require(_0xecc1('0x9'));var ejs=require(_0xecc1('0xa'));var fs=require('fs');var fs_extra=require(_0xecc1('0xb'));var _=require(_0xecc1('0xc'));var squel=require(_0xecc1('0xd'));var crypto=require(_0xecc1('0xe'));var jsforce=require('jsforce');var deskjs=require(_0xecc1('0xf'));var toCsv=require(_0xecc1('0x9'));var querystring=require(_0xecc1('0x10'));var Papa=require('papaparse');var extract=require(_0xecc1('0x11'));var rimraf=require(_0xecc1('0x12'));var archiver=require('archiver');var Redis=require(_0xecc1('0x13'));var authService=require('../../components/auth/service');var qs=require(_0xecc1('0x14'));var as=require(_0xecc1('0x15'));var hardwareService=require(_0xecc1('0x16'));var logger=require('../../config/logger')(_0xecc1('0x17'));var utils=require(_0xecc1('0x18'));var config=require('../../config/environment');var licenseUtil=require(_0xecc1('0x19'));var db=require(_0xecc1('0x1a'))['db'];config[_0xecc1('0x1b')]=_['defaults'](config['redis'],{'host':_0xecc1('0x1c'),'port':0x18eb});var socket=require(_0xecc1('0x1d'))(new Redis(config[_0xecc1('0x1b')]));require(_0xecc1('0x1e'))['register'](socket);function respondWithStatusCode(_0x484f61,_0x4395a4){_0x4395a4=_0x4395a4||0xcc;return function(_0xf588c1){if(_0xf588c1){return _0x484f61[_0xecc1('0x1f')](_0x4395a4);}return _0x484f61[_0xecc1('0x20')](_0x4395a4)[_0xecc1('0x21')]();};}function respondWithResult(_0x29ce3a,_0xf5ba14){_0xf5ba14=_0xf5ba14||0xc8;return function(_0xfcdbc0){if(_0xfcdbc0){return _0x29ce3a[_0xecc1('0x20')](_0xf5ba14)['json'](_0xfcdbc0);}};}function respondWithFilteredResult(_0x338fdc,_0x365bc4){return function(_0x26ea0a){if(_0x26ea0a){var _0x1c7c12=typeof _0x365bc4[_0xecc1('0x22')]===_0xecc1('0x23')&&typeof _0x365bc4[_0xecc1('0x24')]==='undefined';var _0x40b2f5=_0x26ea0a['count'];var _0x26fef0=_0x1c7c12?0x0:_0x365bc4[_0xecc1('0x22')];var _0x2b23a0=_0x1c7c12?_0x26ea0a[_0xecc1('0x25')]:_0x365bc4[_0xecc1('0x22')]+_0x365bc4[_0xecc1('0x24')];var _0x2cad1f;if(_0x2b23a0>=_0x40b2f5){_0x2b23a0=_0x40b2f5;_0x2cad1f=0xc8;}else{_0x2cad1f=0xce;}_0x338fdc['status'](_0x2cad1f);return _0x338fdc['set'](_0xecc1('0x26'),_0x26fef0+'-'+_0x2b23a0+'/'+_0x40b2f5)['json'](_0x26ea0a);}return null;};}function patchUpdates(_0x1bf8a0){return function(_0x242858){try{jsonpatch[_0xecc1('0x27')](_0x242858,_0x1bf8a0,!![]);}catch(_0x336d64){return BPromise['reject'](_0x336d64);}return _0x242858[_0xecc1('0x28')]();};}function saveUpdates(_0x3b34cb,_0x2240e5){return function(_0xff64c8){if(_0xff64c8){return _0xff64c8['update'](_0x3b34cb)['then'](function(_0x1675be){return _0x1675be;});}return null;};}function removeEntity(_0x5de3fe,_0x4ee178){return function(_0x5a2bf9){if(_0x5a2bf9){return _0x5a2bf9['destroy']()['then'](function(){var _0x4328d4=_0x5a2bf9[_0xecc1('0x29')]({'plain':!![]});var _0x138edd='Plugins';return db[_0xecc1('0x2a')][_0xecc1('0x2b')]({'where':{'type':_0x138edd,'resourceId':_0x4328d4['id']}})[_0xecc1('0x2c')](function(){return _0x5a2bf9;});})[_0xecc1('0x2c')](function(){_0x5de3fe[_0xecc1('0x20')](0xcc)['end']();});}};}function handleEntityNotFound(_0x3a41ba,_0x45ffd3){return function(_0x3df67d){if(!_0x3df67d){_0x3a41ba[_0xecc1('0x1f')](0x194);}return _0x3df67d;};}function handleError(_0x2e1e54,_0x2d8676){_0x2d8676=_0x2d8676||0x1f4;return function(_0x2f83cc){logger[_0xecc1('0x2d')](_0x2f83cc['stack']);if(_0x2f83cc[_0xecc1('0x2e')]){delete _0x2f83cc[_0xecc1('0x2e')];}_0x2e1e54[_0xecc1('0x20')](_0x2d8676)[_0xecc1('0x2f')](_0x2f83cc);};}exports[_0xecc1('0x30')]=function(_0x3c3c35,_0x278c8c){var _0x1b31a9={},_0x5cfe98={},_0x5e3995={'count':0x0,'rows':[]};var _0x9992bf=_[_0xecc1('0x31')](db['Plugin'][_0xecc1('0x32')],function(_0x3c6082){return{'name':_0x3c6082['fieldName'],'type':_0x3c6082['type']['key']};});_0x5cfe98[_0xecc1('0x33')]=_[_0xecc1('0x31')](_0x9992bf,_0xecc1('0x2e'));_0x5cfe98[_0xecc1('0x34')]=_[_0xecc1('0x35')](_0x3c3c35[_0xecc1('0x34')]);_0x5cfe98['filters']=_[_0xecc1('0x36')](_0x5cfe98[_0xecc1('0x33')],_0x5cfe98[_0xecc1('0x34')]);_0x1b31a9[_0xecc1('0x37')]=_[_0xecc1('0x36')](_0x5cfe98[_0xecc1('0x33')],qs['fields'](_0x3c3c35[_0xecc1('0x34')][_0xecc1('0x38')]));_0x1b31a9['attributes']=_0x1b31a9[_0xecc1('0x37')][_0xecc1('0x39')]?_0x1b31a9['attributes']:_0x5cfe98[_0xecc1('0x33')];if(!_0x3c3c35[_0xecc1('0x34')]['hasOwnProperty']('nolimit')){_0x1b31a9[_0xecc1('0x24')]=qs[_0xecc1('0x24')](_0x3c3c35[_0xecc1('0x34')][_0xecc1('0x24')]);_0x1b31a9[_0xecc1('0x22')]=qs[_0xecc1('0x22')](_0x3c3c35[_0xecc1('0x34')][_0xecc1('0x22')]);}_0x1b31a9['order']=qs['sort'](_0x3c3c35[_0xecc1('0x34')][_0xecc1('0x3a')]);_0x1b31a9[_0xecc1('0x3b')]=qs[_0xecc1('0x3c')](_[_0xecc1('0x3d')](_0x3c3c35[_0xecc1('0x34')],_0x5cfe98['filters']),_0x9992bf);if(_0x3c3c35[_0xecc1('0x34')][_0xecc1('0x3e')]){_0x1b31a9[_0xecc1('0x3b')]=_[_0xecc1('0x3f')](_0x1b31a9[_0xecc1('0x3b')],{'$or':_[_0xecc1('0x31')](_0x9992bf,function(_0x200340){if(_0x200340[_0xecc1('0x40')]!=='VIRTUAL'){var _0x416cb0={};_0x416cb0[_0x200340['name']]={'$like':'%'+_0x3c3c35[_0xecc1('0x34')][_0xecc1('0x3e')]+'%'};return _0x416cb0;}})});}_0x1b31a9=_[_0xecc1('0x3f')]({},_0x1b31a9,_0x3c3c35[_0xecc1('0x41')]);var _0x10aab8={'where':_0x1b31a9[_0xecc1('0x3b')]};return db[_0xecc1('0x42')][_0xecc1('0x25')](_0x10aab8)[_0xecc1('0x2c')](function(_0x4714a5){_0x5e3995[_0xecc1('0x25')]=_0x4714a5;if(_0x3c3c35[_0xecc1('0x34')]['includeAll']){_0x1b31a9[_0xecc1('0x43')]=[{'all':!![]}];}return db['Plugin'][_0xecc1('0x44')](_0x1b31a9);})['then'](function(_0x125171){_0x5e3995[_0xecc1('0x45')]=_0x125171;return _0x5e3995;})[_0xecc1('0x2c')](respondWithFilteredResult(_0x278c8c,_0x1b31a9))[_0xecc1('0x46')](handleError(_0x278c8c,null));};exports[_0xecc1('0x47')]=function(_0x13627a,_0x3049b2){var _0x4c8771={'raw':!![],'where':{'id':_0x13627a[_0xecc1('0x48')]['id']}},_0x1cb625={};_0x1cb625[_0xecc1('0x33')]=_[_0xecc1('0x35')](db['Plugin'][_0xecc1('0x32')]);_0x1cb625[_0xecc1('0x34')]=_[_0xecc1('0x35')](_0x13627a[_0xecc1('0x34')]);_0x1cb625[_0xecc1('0x3c')]=_[_0xecc1('0x36')](_0x1cb625[_0xecc1('0x33')],_0x1cb625['query']);_0x4c8771['attributes']=_[_0xecc1('0x36')](_0x1cb625[_0xecc1('0x33')],qs[_0xecc1('0x38')](_0x13627a[_0xecc1('0x34')][_0xecc1('0x38')]));_0x4c8771[_0xecc1('0x37')]=_0x4c8771['attributes']['length']?_0x4c8771['attributes']:_0x1cb625[_0xecc1('0x33')];if(_0x13627a[_0xecc1('0x34')][_0xecc1('0x49')]){_0x4c8771[_0xecc1('0x43')]=[{'all':!![]}];}_0x4c8771=_[_0xecc1('0x3f')]({},_0x4c8771,_0x13627a['options']);return db[_0xecc1('0x42')][_0xecc1('0x4a')](_0x4c8771)[_0xecc1('0x2c')](handleEntityNotFound(_0x3049b2,null))[_0xecc1('0x2c')](respondWithResult(_0x3049b2,null))['catch'](handleError(_0x3049b2,null));};exports['download']=function(_0x1798ce,_0x34eeae,_0x17e936){return db[_0xecc1('0x42')][_0xecc1('0x4a')]({'where':{'id':_0x1798ce[_0xecc1('0x48')]['id']},'attributes':['name',_0xecc1('0x4b')],'raw':!![]})[_0xecc1('0x2c')](handleEntityNotFound(_0x34eeae,null))['then'](function(_0x126253){if(_0x126253){var _0x240f2e=path['join'](config['root'],_0xecc1('0x4c'),util['format'](_0xecc1('0x4d'),path[_0xecc1('0x4e')](_0x126253[_0xecc1('0x4b')])));var _0x568ec7=fs[_0xecc1('0x4f')](_0x240f2e);var _0x4fa123=archiver(_0xecc1('0x50'),{'zlib':{'level':0x9}});_0x4fa123['on'](_0xecc1('0x51'),function(_0x31bdfe){if(_0x31bdfe[_0xecc1('0x52')]===_0xecc1('0x53')){logger['error'](_0x31bdfe);}else{throw new db[(_0xecc1('0x54'))][(_0xecc1('0x55'))](_0xecc1('0x56'));}});_0x4fa123['on'](_0xecc1('0x2d'),function(_0x4ae8eb){throw new db[(_0xecc1('0x54'))]['Error']('Error\x20while\x20generating\x20the\x20zip\x20archive');});_0x4fa123[_0xecc1('0x57')](_0x568ec7);_0x4fa123['glob'](_0xecc1('0x58'),{'cwd':path['join'](config[_0xecc1('0x59')],_0xecc1('0x4c'),path['dirname'](_0x126253[_0xecc1('0x4b')])),'ignore':[path['join'](path['basename'](_0x126253['path']),_0xecc1('0x5a')),path[_0xecc1('0x5b')](path[_0xecc1('0x4e')](_0x126253[_0xecc1('0x4b')]),_0xecc1('0x5c'))],'nodir':!![]})['finalize']();_0x568ec7['on'](_0xecc1('0x5d'),function(){if(!fs[_0xecc1('0x5e')](_0x240f2e)){throw new db[(_0xecc1('0x54'))][(_0xecc1('0x55'))]('Plugin\x20not\x20found');}return _0x34eeae['download'](_0x240f2e,util['format'](_0xecc1('0x4d'),path[_0xecc1('0x4e')](_0x126253[_0xecc1('0x4b')])),function(_0x5c26ca){if(_0x5c26ca){throw new db['Sequelize'][(_0xecc1('0x55'))](_0xecc1('0x5f'));}fs[_0xecc1('0x60')](_0x240f2e);logger[_0xecc1('0x61')](_0xecc1('0x62'));logger['info'](_0xecc1('0x63'));});});}return null;})['catch'](handleError(_0x34eeae,null));};exports[_0xecc1('0x64')]=function(_0x3ab3b6,_0x49cd4f,_0x2a45f2){var _0x24742d=path['basename'](_0x3ab3b6[_0xecc1('0x65')][_0xecc1('0x66')],path[_0xecc1('0x67')](_0x3ab3b6[_0xecc1('0x65')][_0xecc1('0x66')]));var _0x420a5b=path[_0xecc1('0x5b')](config[_0xecc1('0x59')],_0xecc1('0x4c'),_0x3ab3b6['file'][_0xecc1('0x66')]);var _0x170617=path['join'](config['root'],_0xecc1('0x4c'),_0x24742d);logger['info'](_0xecc1('0x68'),_0x420a5b);logger[_0xecc1('0x61')](_0xecc1('0x69'),_0x170617);try{fs[_0xecc1('0x6a')](_0x420a5b,parseInt(_0xecc1('0x6b'),0x8));extract(_0x420a5b,{'dir':_0x170617},function(_0x1346b6){if(_0x1346b6){logger['error'](_0x1346b6);handleError(_0x1346b6,!![]);};var _0x30288e=fs[_0xecc1('0x6c')](_0x170617);if(_0x30288e[_0xecc1('0x39')]>0x1){removeReferences(_0x420a5b,_0x170617);logger['error']('Invalid\x20plugin\x20structure');return _0x2a45f2(new Error(_0xecc1('0x6d')));}var _0x57199e=fs[_0xecc1('0x6e')](path[_0xecc1('0x5b')](_0x170617,_0x30288e[0x0]));if(_0x57199e['isFile']()){removeReferences(_0x420a5b,_0x170617);logger[_0xecc1('0x2d')](_0xecc1('0x6d'));return _0x2a45f2(new Error(_0xecc1('0x6d')));}if(_0x57199e[_0xecc1('0x6f')]()){var _0x5c94fc=fs[_0xecc1('0x6c')](path['join'](_0x170617,_0x30288e[0x0]));if(_0x5c94fc['length']===0x0){removeReferences(_0x420a5b,_0x170617);logger[_0xecc1('0x2d')](_0xecc1('0x6d'));return _0x2a45f2(new Error('Invalid\x20plugin\x20structure'));}var _0x3678f0=_0x5c94fc[_0xecc1('0x70')](function(_0x3fb224){return _0x3fb224===_0xecc1('0x71');});if(!_0x3678f0){return _0x2a45f2(new Error(_0xecc1('0x72')));}var _0x761e4d=fs['readFileSync'](path[_0xecc1('0x5b')](_0x170617,_0x30288e[0x0],'manifest.json'));var _0x90e287=JSON[_0xecc1('0x73')](_0x761e4d);if('undefined'==typeof _0x90e287[_0xecc1('0x2e')]){return _0x2a45f2(new Error('Invalid\x20manifest:\x20name\x20missing'));}if(_0xecc1('0x23')==typeof _0x90e287[_0xecc1('0x40')]){return _0x2a45f2(new Error(_0xecc1('0x74')));}if(_0xecc1('0x23')==typeof _0x90e287[_0xecc1('0x75')]){return _0x2a45f2(new Error('Invalid\x20manifest:\x20version\x20not\x20specified'));}if(_0xecc1('0x23')==typeof _0x90e287[_0xecc1('0x76')]){return _0x2a45f2(new Error(_0xecc1('0x77')));}if(_0x90e287['type']===_0xecc1('0x78')){if(_0xecc1('0x23')==typeof _0x90e287[_0xecc1('0x76')][_0xecc1('0x79')]){return _0x2a45f2(new Error('Invalid\x20manifest:\x20views\x20missing'));}if('undefined'==typeof _0x90e287['parameters'][_0xecc1('0x79')][_0xecc1('0x7a')]&&_0xecc1('0x23')==typeof _0x90e287[_0xecc1('0x76')][_0xecc1('0x79')][_0xecc1('0x7b')]){return _0x2a45f2(new Error(_0xecc1('0x7c')));}}else if(_0x90e287[_0xecc1('0x40')]==='script'){if('undefined'==typeof _0x90e287[_0xecc1('0x76')][_0xecc1('0x7d')]){return _0x2a45f2(new Error(_0xecc1('0x7e')));}if('undefined'==typeof _0x90e287['parameters'][_0xecc1('0x7f')]){return _0x2a45f2(new Error(_0xecc1('0x80')));}}else{return _0x2a45f2(new Error('Invalid\x20manifest:\x20invalid\x20type'));}var _0x31c4c2=_0x90e287[_0xecc1('0x2e')];var _0x36e37e=_0x90e287[_0xecc1('0x81')];var _0x342659=_0x90e287['type'];var _0x4a2363=_0x90e287['sidebar']?_0x90e287['sidebar']:_0xecc1('0x82');var _0x39d047=_0x90e287['icon']?_0x90e287[_0xecc1('0x83')]:'icon-apps';var _0x2c8234='';var _0x19bbd5='';var _0x38aea9='';var _0x611655='';var _0x2abc60=_0x90e287['version'];if(_0x342659===_0xecc1('0x78')){if(_0xecc1('0x23')!=typeof _0x90e287[_0xecc1('0x76')][_0xecc1('0x79')][_0xecc1('0x7a')]){var _0x487203=_0x90e287[_0xecc1('0x76')][_0xecc1('0x79')][_0xecc1('0x7a')];if(!/^(f|ht)tps?:\/\//i['test'](_0x487203)){_0x2c8234=path[_0xecc1('0x5b')]('plugins',_0x24742d,_0x30288e[0x0],_0x487203);}else{_0x2c8234=_0x487203;}}else{logger[_0xecc1('0x61')](_0xecc1('0x84'));}if(_0xecc1('0x23')!=typeof _0x90e287[_0xecc1('0x76')][_0xecc1('0x79')]['agent']){var _0xd52ae5=_0x90e287[_0xecc1('0x76')][_0xecc1('0x79')][_0xecc1('0x7b')];if(!/^(f|ht)tps?:\/\//i['test'](_0xd52ae5)){_0x19bbd5=path[_0xecc1('0x5b')](_0xecc1('0x85'),_0x24742d,_0x30288e[0x0],_0xd52ae5);}else{_0x19bbd5=_0xd52ae5;}}else{logger[_0xecc1('0x61')](_0xecc1('0x86'));}}else if(_0x342659===_0xecc1('0x87')){_0x38aea9=_0x90e287[_0xecc1('0x76')][_0xecc1('0x7d')];_0x611655=_0x90e287[_0xecc1('0x76')][_0xecc1('0x7f')];if('undefined'!=typeof _0x90e287['parameters'][_0xecc1('0x79')]){if('undefined'!=typeof _0x90e287[_0xecc1('0x76')]['views'][_0xecc1('0x7a')]){var _0x487203=_0x90e287[_0xecc1('0x76')][_0xecc1('0x79')][_0xecc1('0x7a')];if(!/^(f|ht)tps?:\/\//i[_0xecc1('0x88')](_0x487203)){_0x2c8234=path[_0xecc1('0x5b')](_0xecc1('0x85'),_0x24742d,_0x30288e[0x0],_0x487203);}else{_0x2c8234=_0x487203;}}if(_0xecc1('0x23')!=typeof _0x90e287[_0xecc1('0x76')][_0xecc1('0x79')][_0xecc1('0x7b')]){var _0xd52ae5=_0x90e287[_0xecc1('0x76')][_0xecc1('0x79')]['agent'];if(!/^(f|ht)tps?:\/\//i[_0xecc1('0x88')](_0xd52ae5)){_0x19bbd5=path[_0xecc1('0x5b')](_0xecc1('0x85'),_0x24742d,_0x30288e[0x0],_0xd52ae5);}else{_0x19bbd5=_0xd52ae5;}}}}var _0x25cfb1={'name':_0x31c4c2,'description':_0x36e37e,'path':path[_0xecc1('0x5b')](_0x24742d,_0x30288e[0x0]),'type':_0x342659,'sidebar':_0x4a2363,'icon':_0x39d047,'adminUrl':_0x2c8234,'agentUrl':_0x19bbd5,'scriptName':_0x38aea9,'scriptPath':_0x611655,'version':_0x2abc60};removeReferences(_0x420a5b,null);return db['Plugin'][_0xecc1('0x89')](_0x25cfb1)['then'](function(_0x25b201){var _0x5120d3={'role':_0x3ab3b6[_0xecc1('0x8a')][_0xecc1('0x8b')],'userProfileId':_0x3ab3b6[_0xecc1('0x8a')][_0xecc1('0x8c')]};if(!_0x5120d3)throw new Error(_0xecc1('0x8d'));if(_0x5120d3[_0xecc1('0x8b')]===_0xecc1('0x8e')){var _0x4ff944=_0x25b201['get']({'plain':!![]});return db[_0xecc1('0x8f')][_0xecc1('0x4a')]({'where':{'name':_0xecc1('0x90'),'userProfileId':_0x5120d3[_0xecc1('0x8c')]},'raw':!![]})[_0xecc1('0x2c')](function(_0x3ae6f6){if(_0x3ae6f6&&_0x3ae6f6[_0xecc1('0x91')]===0x0){return db[_0xecc1('0x2a')][_0xecc1('0x89')]({'name':_0x4ff944['name'],'resourceId':_0x4ff944['id'],'type':_0x3ae6f6[_0xecc1('0x2e')],'sectionId':_0x3ae6f6['id']},{})[_0xecc1('0x2c')](function(){return _0x25b201;});}else{return _0x25b201;}})[_0xecc1('0x46')](function(_0x27e4bf){logger['error'](_0xecc1('0x92'),_0x27e4bf);throw _0x27e4bf;});}return _0x25b201;})['then'](respondWithResult(_0x49cd4f,null))['catch'](handleError(_0x49cd4f,null));}});}catch(_0x222845){_0x49cd4f[_0xecc1('0x20')](0x1f4)[_0xecc1('0x2f')](_0x222845);}};function removeReferences(_0x29c525,_0x3e9168){try{if(_0x29c525){fs[_0xecc1('0x60')](_0x29c525);logger[_0xecc1('0x61')](_0xecc1('0x93'));}if(_0x3e9168){rimraf(_0x3e9168,function(){});logger[_0xecc1('0x61')](_0xecc1('0x94'));}}catch(_0x5dded1){logger['error'](_0x5dded1);}}exports[_0xecc1('0x95')]=function(_0x4d1561,_0x21fa7a,_0x3ec004){return db[_0xecc1('0x42')][_0xecc1('0x4a')]({'where':{'id':_0x4d1561[_0xecc1('0x48')]['id']}})[_0xecc1('0x2c')](handleEntityNotFound(_0x21fa7a,null))[_0xecc1('0x2c')](saveUpdates(_0x4d1561[_0xecc1('0x8a')],null))[_0xecc1('0x2c')](respondWithResult(_0x21fa7a,null))[_0xecc1('0x46')](handleError(_0x21fa7a,null));};exports[_0xecc1('0x96')]=function(_0x150ab0,_0x44be77,_0x49329b){return db[_0xecc1('0x42')][_0xecc1('0x4a')]({'where':{'id':_0x150ab0[_0xecc1('0x48')]['id']}})[_0xecc1('0x2c')](function(_0x32bc57){if(_0x32bc57){return _0x32bc57[_0xecc1('0x2b')]();}})[_0xecc1('0x2c')](function(_0x25eb4f){rimraf(path[_0xecc1('0x5b')](config[_0xecc1('0x59')],_0xecc1('0x4c'),path['dirname'](_0x25eb4f[_0xecc1('0x4b')])),function(){});return _0x25eb4f;})[_0xecc1('0x2c')](handleEntityNotFound(_0x44be77,null))[_0xecc1('0x2c')](respondWithStatusCode(_0x44be77,null))['catch'](handleError(_0x44be77,null));};exports[_0xecc1('0x97')]=function(_0x4c39f9,_0x4a2b76,_0x2635a2){return BPromise[_0xecc1('0x98')]()[_0xecc1('0x2c')](function(){if(!_0x4c39f9[_0xecc1('0x34')][_0xecc1('0x4b')]){throw new Error(_0xecc1('0x99'));}if(!_0x4c39f9[_0xecc1('0x34')][_0xecc1('0x9a')]){throw new Error('\x27PORT\x27\x20parameter\x20not\x20specified');}var _0x381973=_0x4c39f9[_0xecc1('0x34')][_0xecc1('0x9b')]?_0x4c39f9[_0xecc1('0x34')][_0xecc1('0x9b')]+':'+_0x4c39f9[_0xecc1('0x34')]['port']:'http://localhost:'+_0x4c39f9[_0xecc1('0x34')][_0xecc1('0x9a')];var _0x2e9f54=_0x4c39f9[_0xecc1('0x34')]['json']?_0x4c39f9['query'][_0xecc1('0x9c')]:!![];var _0x5c1061=_0x4c39f9['query'][_0xecc1('0x9d')]?_0x4c39f9[_0xecc1('0x34')][_0xecc1('0x9d')]:null;var _0x2b2d9d={'method':_0x4c39f9['method'],'uri':util['format']('%s%s',_0x381973,_0x4c39f9[_0xecc1('0x34')][_0xecc1('0x4b')]),'json':_0x2e9f54,'resolveWithFullResponse':!![],'encoding':_0x5c1061,'qs':_0x4c39f9[_0xecc1('0x34')]};if(_0x4c39f9['headers']){_0x2b2d9d['headers']=_0x4c39f9[_0xecc1('0x9e')];if(_0x2b2d9d[_0xecc1('0x9e')]['content-length']){delete _0x2b2d9d['headers']['content-length'];}}if(_0x2b2d9d[_0xecc1('0x9e')][_0xecc1('0x9f')]){delete _0x2b2d9d[_0xecc1('0x9e')][_0xecc1('0x9f')];}return rp(_0x2b2d9d);})[_0xecc1('0x2c')](function(_0x52d0e8){if(_0x52d0e8){_0x4a2b76[_0xecc1('0xa0')](_0x52d0e8[_0xecc1('0x9e')]);logger['info'](_0x52d0e8[_0xecc1('0x8a')]);if(_[_0xecc1('0xa1')](_0x4c39f9[_0xecc1('0x34')]['path'],_0xecc1('0xa2'))&&_0x52d0e8[_0xecc1('0xa3')]==0x1f4){return _0x4a2b76[_0xecc1('0x1f')](_0x52d0e8[_0xecc1('0xa3')]);}else{return _0x4a2b76[_0xecc1('0x20')](_0x52d0e8[_0xecc1('0xa3')])[_0xecc1('0x2f')](_0x52d0e8['body']);}}else{return _0x4a2b76['sendStatus'](0xc8);}})[_0xecc1('0x46')](handleError(_0x4a2b76,null));};exports[_0xecc1('0xa4')]=function(_0x46fcc5,_0x1b1903,_0x3b3983){return BPromise[_0xecc1('0x98')]()[_0xecc1('0x2c')](function(){if(!_0x46fcc5['query'][_0xecc1('0x4b')]){throw new Error(_0xecc1('0x99'));}if(!_0x46fcc5[_0xecc1('0x34')]['port']){throw new Error(_0xecc1('0xa5'));}var _0x5464d8=_0x46fcc5[_0xecc1('0x34')][_0xecc1('0x9b')]?_0x46fcc5['query'][_0xecc1('0x9b')]+':'+_0x46fcc5[_0xecc1('0x34')][_0xecc1('0x9a')]:_0xecc1('0xa6')+_0x46fcc5[_0xecc1('0x34')][_0xecc1('0x9a')];var _0x5ef2dc=_0x46fcc5[_0xecc1('0x34')][_0xecc1('0x9c')]?_0x46fcc5['query']['json']:!![];var _0x2d2f90=_0x46fcc5[_0xecc1('0x34')][_0xecc1('0x9d')]?_0x46fcc5[_0xecc1('0x34')][_0xecc1('0x9d')]:null;var _0x2ba7c9={'method':_0x46fcc5[_0xecc1('0xa7')],'uri':util[_0xecc1('0xa8')](_0xecc1('0xa9'),_0x5464d8,_0x46fcc5[_0xecc1('0x34')][_0xecc1('0x4b')]),'json':_0x5ef2dc,'resolveWithFullResponse':!![],'encoding':_0x2d2f90,'body':_0x46fcc5[_0xecc1('0x8a')]};if(_0x46fcc5['headers']){_0x2ba7c9['headers']=_0x46fcc5[_0xecc1('0x9e')];if(_0x2ba7c9[_0xecc1('0x9e')][_0xecc1('0xaa')]){delete _0x2ba7c9[_0xecc1('0x9e')][_0xecc1('0xaa')];}}if(_0x2ba7c9[_0xecc1('0x9e')][_0xecc1('0x9f')]){delete _0x2ba7c9[_0xecc1('0x9e')]['content-type'];}return rp(_0x2ba7c9);})[_0xecc1('0x2c')](function(_0x461776){if(_0x461776){_0x1b1903[_0xecc1('0xa0')](_0x461776[_0xecc1('0x9e')]);logger[_0xecc1('0x61')](_0x461776[_0xecc1('0x8a')]);return _0x1b1903[_0xecc1('0x20')](_0x461776['statusCode'])[_0xecc1('0x2f')](_0x461776[_0xecc1('0x8a')]);}else{return _0x1b1903[_0xecc1('0x1f')](0xc8);}})[_0xecc1('0x46')](handleError(_0x1b1903,null));}; \ No newline at end of file +var _0x006f=['where','pick','filters','filter','merge','VIRTUAL','options','count','includeAll','include','findAll','show','params','fields','find','catch','join','root','%s.zip','basename','createWriteStream','warning','code','ENOENT','Sequelize','Error','Error\x20while\x20generating\x20the\x20zip\x20archive','pipe','glob','**/*','server/files/plugins','dirname','node_modules/**/*','attachments/**/*','finalize','close','Plugin\x20not\x20found','download','format','Error\x20while\x20downloading\x20the\x20plugin','unlinkSync','info','Temporary\x20file\x20removed','upload','filename','Plugin\x20upload\x20destination:\x20%s','chmodSync','0777','readdirSync','Invalid\x20plugin\x20structure','isDirectory','some','manifest.json','Plugin\x20manifest\x20missing','readFileSync','parse','Invalid\x20manifest:\x20name\x20missing','version','Invalid\x20manifest:\x20version\x20not\x20specified','parameters','Invalid\x20manifest:\x20parameters\x20missing','html','views','Invalid\x20manifest:\x20views\x20missing','admin','agent','Invalid\x20manifest:\x20no\x20view\x20specified','script','scriptName','Invalid\x20manifest:\x20script\x20name\x20missing','scriptPath','Invalid\x20manifest:\x20invalid\x20type','description','sidebar','always','icon','icon-apps','test','plugins','Warning:\x20admin\x20view\x20not\x20specified','Warning:\x20agent\x20view\x20not\x20specified','create','body','role','userProfileId','Unable\x20to\x20retrieve\x20the\x20current\x20user','UserProfileSection','autoAssociation','UserProfileResource','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','Zip\x20archive\x20removed','Extracted\x20folder\x20removed','webhookGet','\x27PATH\x27\x20parameter\x20not\x20specified','port','\x27PORT\x27\x20parameter\x20not\x20specified','hostname','http://localhost:','method','headers','content-length','content-type','endsWith','statusCode','resolve','encoding','%s%s','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','moment','util','path','sox','to-csv','fs-extra','lodash','squel','desk.js','querystring','papaparse','extract-zip','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/logger','api','../../config/license/util','../../mysqldb','redis','localhost','socket.io-emitter','sendStatus','status','end','json','offset','undefined','set','Content-Range','reject','update','then','Plugins','destroy','error','stack','name','index','map','Plugin','rawAttributes','fieldName','type','key','model','query','keys','attributes','length','hasOwnProperty','nolimit','limit','sort'];(function(_0x321ceb,_0x5eeb01){var _0x2ef97c=function(_0x408de8){while(--_0x408de8){_0x321ceb['push'](_0x321ceb['shift']());}};_0x2ef97c(++_0x5eeb01);}(_0x006f,0x6b));var _0xf006=function(_0x1f6f32,_0x3c3e00){_0x1f6f32=_0x1f6f32-0x0;var _0x4141f=_0x006f[_0x1f6f32];return _0x4141f;};'use strict';var emlformat=require(_0xf006('0x0'));var rimraf=require(_0xf006('0x1'));var zipdir=require(_0xf006('0x2'));var jsonpatch=require(_0xf006('0x3'));var rp=require(_0xf006('0x4'));var moment=require(_0xf006('0x5'));var BPromise=require('bluebird');var Mustache=require('mustache');var util=require(_0xf006('0x6'));var path=require(_0xf006('0x7'));var sox=require(_0xf006('0x8'));var csv=require(_0xf006('0x9'));var ejs=require('ejs');var fs=require('fs');var fs_extra=require(_0xf006('0xa'));var _=require(_0xf006('0xb'));var squel=require(_0xf006('0xc'));var crypto=require('crypto');var jsforce=require('jsforce');var deskjs=require(_0xf006('0xd'));var toCsv=require(_0xf006('0x9'));var querystring=require(_0xf006('0xe'));var Papa=require(_0xf006('0xf'));var extract=require(_0xf006('0x10'));var rimraf=require(_0xf006('0x1'));var archiver=require('archiver');var Redis=require('ioredis');var authService=require(_0xf006('0x11'));var qs=require(_0xf006('0x12'));var as=require(_0xf006('0x13'));var hardwareService=require('../../config/license/hardware');var logger=require(_0xf006('0x14'))(_0xf006('0x15'));var utils=require('../../config/utils');var config=require('../../config/environment');var licenseUtil=require(_0xf006('0x16'));var db=require(_0xf006('0x17'))['db'];config['redis']=_['defaults'](config[_0xf006('0x18')],{'host':_0xf006('0x19'),'port':0x18eb});var socket=require(_0xf006('0x1a'))(new Redis(config[_0xf006('0x18')]));require('./plugin.socket')['register'](socket);function respondWithStatusCode(_0x46afb7,_0x15d595){_0x15d595=_0x15d595||0xcc;return function(_0x4464ae){if(_0x4464ae){return _0x46afb7[_0xf006('0x1b')](_0x15d595);}return _0x46afb7[_0xf006('0x1c')](_0x15d595)[_0xf006('0x1d')]();};}function respondWithResult(_0x1fb9e3,_0x5f5069){_0x5f5069=_0x5f5069||0xc8;return function(_0x2827b3){if(_0x2827b3){return _0x1fb9e3['status'](_0x5f5069)[_0xf006('0x1e')](_0x2827b3);}};}function respondWithFilteredResult(_0x387c1c,_0x48af64){return function(_0x3d7866){if(_0x3d7866){var _0x5cabd3=typeof _0x48af64[_0xf006('0x1f')]===_0xf006('0x20')&&typeof _0x48af64['limit']===_0xf006('0x20');var _0x30ff5a=_0x3d7866['count'];var _0x206c2c=_0x5cabd3?0x0:_0x48af64['offset'];var _0x7a8291=_0x5cabd3?_0x3d7866['count']:_0x48af64['offset']+_0x48af64['limit'];var _0x41e490;if(_0x7a8291>=_0x30ff5a){_0x7a8291=_0x30ff5a;_0x41e490=0xc8;}else{_0x41e490=0xce;}_0x387c1c[_0xf006('0x1c')](_0x41e490);return _0x387c1c[_0xf006('0x21')](_0xf006('0x22'),_0x206c2c+'-'+_0x7a8291+'/'+_0x30ff5a)[_0xf006('0x1e')](_0x3d7866);}return null;};}function patchUpdates(_0x3e263c){return function(_0x47d5c6){try{jsonpatch['apply'](_0x47d5c6,_0x3e263c,!![]);}catch(_0x458b83){return BPromise[_0xf006('0x23')](_0x458b83);}return _0x47d5c6['save']();};}function saveUpdates(_0xe0ff7,_0x19903b){return function(_0x24e5a4){if(_0x24e5a4){return _0x24e5a4[_0xf006('0x24')](_0xe0ff7)[_0xf006('0x25')](function(_0x44de41){return _0x44de41;});}return null;};}function removeEntity(_0x5abfee,_0x1fa0c0){return function(_0x3e9c9f){if(_0x3e9c9f){return _0x3e9c9f['destroy']()[_0xf006('0x25')](function(){var _0x245f69=_0x3e9c9f['get']({'plain':!![]});var _0x57c82a=_0xf006('0x26');return db['UserProfileResource'][_0xf006('0x27')]({'where':{'type':_0x57c82a,'resourceId':_0x245f69['id']}})[_0xf006('0x25')](function(){return _0x3e9c9f;});})['then'](function(){_0x5abfee[_0xf006('0x1c')](0xcc)['end']();});}};}function handleEntityNotFound(_0x2efc95,_0x120e8f){return function(_0x2f4d3e){if(!_0x2f4d3e){_0x2efc95[_0xf006('0x1b')](0x194);}return _0x2f4d3e;};}function handleError(_0xeb9dfd,_0x316d7c){_0x316d7c=_0x316d7c||0x1f4;return function(_0x3267ff){logger[_0xf006('0x28')](_0x3267ff[_0xf006('0x29')]);if(_0x3267ff[_0xf006('0x2a')]){delete _0x3267ff['name'];}_0xeb9dfd[_0xf006('0x1c')](_0x316d7c)['send'](_0x3267ff);};}exports[_0xf006('0x2b')]=function(_0x589747,_0x297a82){var _0x3d6ab2={},_0x587286={},_0x143ddf={'count':0x0,'rows':[]};var _0x4f2bd1=_[_0xf006('0x2c')](db[_0xf006('0x2d')][_0xf006('0x2e')],function(_0xb14b4a){return{'name':_0xb14b4a[_0xf006('0x2f')],'type':_0xb14b4a[_0xf006('0x30')][_0xf006('0x31')]};});_0x587286[_0xf006('0x32')]=_[_0xf006('0x2c')](_0x4f2bd1,_0xf006('0x2a'));_0x587286[_0xf006('0x33')]=_[_0xf006('0x34')](_0x589747[_0xf006('0x33')]);_0x587286['filters']=_['intersection'](_0x587286[_0xf006('0x32')],_0x587286[_0xf006('0x33')]);_0x3d6ab2['attributes']=_['intersection'](_0x587286[_0xf006('0x32')],qs['fields'](_0x589747[_0xf006('0x33')]['fields']));_0x3d6ab2[_0xf006('0x35')]=_0x3d6ab2[_0xf006('0x35')][_0xf006('0x36')]?_0x3d6ab2[_0xf006('0x35')]:_0x587286['model'];if(!_0x589747['query'][_0xf006('0x37')](_0xf006('0x38'))){_0x3d6ab2[_0xf006('0x39')]=qs['limit'](_0x589747['query'][_0xf006('0x39')]);_0x3d6ab2[_0xf006('0x1f')]=qs[_0xf006('0x1f')](_0x589747['query']['offset']);}_0x3d6ab2['order']=qs[_0xf006('0x3a')](_0x589747[_0xf006('0x33')][_0xf006('0x3a')]);_0x3d6ab2[_0xf006('0x3b')]=qs['filters'](_[_0xf006('0x3c')](_0x589747[_0xf006('0x33')],_0x587286[_0xf006('0x3d')]),_0x4f2bd1);if(_0x589747[_0xf006('0x33')][_0xf006('0x3e')]){_0x3d6ab2['where']=_[_0xf006('0x3f')](_0x3d6ab2[_0xf006('0x3b')],{'$or':_['map'](_0x4f2bd1,function(_0x162e0f){if(_0x162e0f[_0xf006('0x30')]!==_0xf006('0x40')){var _0x56cb34={};_0x56cb34[_0x162e0f['name']]={'$like':'%'+_0x589747[_0xf006('0x33')][_0xf006('0x3e')]+'%'};return _0x56cb34;}})});}_0x3d6ab2=_['merge']({},_0x3d6ab2,_0x589747[_0xf006('0x41')]);var _0x44679a={'where':_0x3d6ab2[_0xf006('0x3b')]};return db[_0xf006('0x2d')][_0xf006('0x42')](_0x44679a)[_0xf006('0x25')](function(_0x444b77){_0x143ddf[_0xf006('0x42')]=_0x444b77;if(_0x589747[_0xf006('0x33')][_0xf006('0x43')]){_0x3d6ab2[_0xf006('0x44')]=[{'all':!![]}];}return db[_0xf006('0x2d')][_0xf006('0x45')](_0x3d6ab2);})[_0xf006('0x25')](function(_0x36e9a8){_0x143ddf['rows']=_0x36e9a8;return _0x143ddf;})[_0xf006('0x25')](respondWithFilteredResult(_0x297a82,_0x3d6ab2))['catch'](handleError(_0x297a82,null));};exports[_0xf006('0x46')]=function(_0x36235,_0x43d90a){var _0x9f6d81={'raw':!![],'where':{'id':_0x36235[_0xf006('0x47')]['id']}},_0x421a85={};_0x421a85[_0xf006('0x32')]=_[_0xf006('0x34')](db[_0xf006('0x2d')][_0xf006('0x2e')]);_0x421a85['query']=_[_0xf006('0x34')](_0x36235[_0xf006('0x33')]);_0x421a85[_0xf006('0x3d')]=_['intersection'](_0x421a85['model'],_0x421a85[_0xf006('0x33')]);_0x9f6d81[_0xf006('0x35')]=_['intersection'](_0x421a85[_0xf006('0x32')],qs[_0xf006('0x48')](_0x36235['query'][_0xf006('0x48')]));_0x9f6d81[_0xf006('0x35')]=_0x9f6d81['attributes'][_0xf006('0x36')]?_0x9f6d81[_0xf006('0x35')]:_0x421a85['model'];if(_0x36235['query']['includeAll']){_0x9f6d81[_0xf006('0x44')]=[{'all':!![]}];}_0x9f6d81=_[_0xf006('0x3f')]({},_0x9f6d81,_0x36235['options']);return db[_0xf006('0x2d')][_0xf006('0x49')](_0x9f6d81)[_0xf006('0x25')](handleEntityNotFound(_0x43d90a,null))[_0xf006('0x25')](respondWithResult(_0x43d90a,null))[_0xf006('0x4a')](handleError(_0x43d90a,null));};exports['download']=function(_0x1f768d,_0x184569,_0x13a512){return db[_0xf006('0x2d')][_0xf006('0x49')]({'where':{'id':_0x1f768d[_0xf006('0x47')]['id']},'attributes':[_0xf006('0x2a'),'path'],'raw':!![]})[_0xf006('0x25')](handleEntityNotFound(_0x184569,null))[_0xf006('0x25')](function(_0x417e19){if(_0x417e19){var _0x4eb596=path[_0xf006('0x4b')](config[_0xf006('0x4c')],'server/files/plugins',util['format'](_0xf006('0x4d'),path[_0xf006('0x4e')](_0x417e19[_0xf006('0x7')])));var _0x173aa3=fs[_0xf006('0x4f')](_0x4eb596);var _0x50442f=archiver('zip',{'zlib':{'level':0x9}});_0x50442f['on'](_0xf006('0x50'),function(_0x46e9fe){if(_0x46e9fe[_0xf006('0x51')]===_0xf006('0x52')){logger[_0xf006('0x28')](_0x46e9fe);}else{throw new db[(_0xf006('0x53'))][(_0xf006('0x54'))](_0xf006('0x55'));}});_0x50442f['on'](_0xf006('0x28'),function(_0x43290e){throw new db[(_0xf006('0x53'))][(_0xf006('0x54'))](_0xf006('0x55'));});_0x50442f[_0xf006('0x56')](_0x173aa3);_0x50442f[_0xf006('0x57')](_0xf006('0x58'),{'cwd':path[_0xf006('0x4b')](config[_0xf006('0x4c')],_0xf006('0x59'),path[_0xf006('0x5a')](_0x417e19[_0xf006('0x7')])),'ignore':[path[_0xf006('0x4b')](path[_0xf006('0x4e')](_0x417e19[_0xf006('0x7')]),_0xf006('0x5b')),path[_0xf006('0x4b')](path[_0xf006('0x4e')](_0x417e19[_0xf006('0x7')]),_0xf006('0x5c'))],'nodir':!![]})[_0xf006('0x5d')]();_0x173aa3['on'](_0xf006('0x5e'),function(){if(!fs['existsSync'](_0x4eb596)){throw new db[(_0xf006('0x53'))][(_0xf006('0x54'))](_0xf006('0x5f'));}return _0x184569[_0xf006('0x60')](_0x4eb596,util[_0xf006('0x61')](_0xf006('0x4d'),path[_0xf006('0x4e')](_0x417e19[_0xf006('0x7')])),function(_0x730621){if(_0x730621){throw new db['Sequelize'][(_0xf006('0x54'))](_0xf006('0x62'));}fs[_0xf006('0x63')](_0x4eb596);logger[_0xf006('0x64')]('Download\x20completed');logger[_0xf006('0x64')](_0xf006('0x65'));});});}return null;})[_0xf006('0x4a')](handleError(_0x184569,null));};exports[_0xf006('0x66')]=function(_0x28e07d,_0x4f2a1d,_0x20e65c){var _0x292a04=path['basename'](_0x28e07d['file'][_0xf006('0x67')],path['extname'](_0x28e07d['file']['filename']));var _0x1aab38=path['join'](config[_0xf006('0x4c')],_0xf006('0x59'),_0x28e07d['file'][_0xf006('0x67')]);var _0xe9fbf=path[_0xf006('0x4b')](config[_0xf006('0x4c')],_0xf006('0x59'),_0x292a04);logger[_0xf006('0x64')]('Plugin\x20upload\x20filepath:\x20%s',_0x1aab38);logger[_0xf006('0x64')](_0xf006('0x68'),_0xe9fbf);try{fs[_0xf006('0x69')](_0x1aab38,parseInt(_0xf006('0x6a'),0x8));extract(_0x1aab38,{'dir':_0xe9fbf},function(_0x587db3){if(_0x587db3){logger[_0xf006('0x28')](_0x587db3);handleError(_0x587db3,!![]);};var _0x466124=fs[_0xf006('0x6b')](_0xe9fbf);if(_0x466124[_0xf006('0x36')]>0x1){removeReferences(_0x1aab38,_0xe9fbf);logger[_0xf006('0x28')]('Invalid\x20plugin\x20structure');return _0x20e65c(new Error('Invalid\x20plugin\x20structure'));}var _0x876c91=fs['lstatSync'](path[_0xf006('0x4b')](_0xe9fbf,_0x466124[0x0]));if(_0x876c91['isFile']()){removeReferences(_0x1aab38,_0xe9fbf);logger['error'](_0xf006('0x6c'));return _0x20e65c(new Error(_0xf006('0x6c')));}if(_0x876c91[_0xf006('0x6d')]()){var _0x45cbb1=fs[_0xf006('0x6b')](path[_0xf006('0x4b')](_0xe9fbf,_0x466124[0x0]));if(_0x45cbb1[_0xf006('0x36')]===0x0){removeReferences(_0x1aab38,_0xe9fbf);logger[_0xf006('0x28')](_0xf006('0x6c'));return _0x20e65c(new Error(_0xf006('0x6c')));}var _0xcfae60=_0x45cbb1[_0xf006('0x6e')](function(_0x1fddbb){return _0x1fddbb===_0xf006('0x6f');});if(!_0xcfae60){return _0x20e65c(new Error(_0xf006('0x70')));}var _0x1cabea=fs[_0xf006('0x71')](path['join'](_0xe9fbf,_0x466124[0x0],_0xf006('0x6f')));var _0xd2ab76=JSON[_0xf006('0x72')](_0x1cabea);if(_0xf006('0x20')==typeof _0xd2ab76[_0xf006('0x2a')]){return _0x20e65c(new Error(_0xf006('0x73')));}if(_0xf006('0x20')==typeof _0xd2ab76['type']){return _0x20e65c(new Error('Invalid\x20manifest:\x20type\x20missing'));}if('undefined'==typeof _0xd2ab76[_0xf006('0x74')]){return _0x20e65c(new Error(_0xf006('0x75')));}if(_0xf006('0x20')==typeof _0xd2ab76[_0xf006('0x76')]){return _0x20e65c(new Error(_0xf006('0x77')));}if(_0xd2ab76[_0xf006('0x30')]===_0xf006('0x78')){if('undefined'==typeof _0xd2ab76[_0xf006('0x76')][_0xf006('0x79')]){return _0x20e65c(new Error(_0xf006('0x7a')));}if(_0xf006('0x20')==typeof _0xd2ab76[_0xf006('0x76')]['views'][_0xf006('0x7b')]&&_0xf006('0x20')==typeof _0xd2ab76[_0xf006('0x76')][_0xf006('0x79')][_0xf006('0x7c')]){return _0x20e65c(new Error(_0xf006('0x7d')));}}else if(_0xd2ab76[_0xf006('0x30')]===_0xf006('0x7e')){if(_0xf006('0x20')==typeof _0xd2ab76[_0xf006('0x76')][_0xf006('0x7f')]){return _0x20e65c(new Error(_0xf006('0x80')));}if(_0xf006('0x20')==typeof _0xd2ab76[_0xf006('0x76')][_0xf006('0x81')]){return _0x20e65c(new Error('Invalid\x20manifest:\x20script\x20path\x20missing'));}}else{return _0x20e65c(new Error(_0xf006('0x82')));}var _0x35826c=_0xd2ab76[_0xf006('0x2a')];var _0x3c6ff5=_0xd2ab76[_0xf006('0x83')];var _0x20b821=_0xd2ab76[_0xf006('0x30')];var _0x5aeb14=_0xd2ab76['sidebar']?_0xd2ab76[_0xf006('0x84')]:_0xf006('0x85');var _0x4b927c=_0xd2ab76[_0xf006('0x86')]?_0xd2ab76[_0xf006('0x86')]:_0xf006('0x87');var _0x2a722a='';var _0x236033='';var _0x889e17='';var _0x4cd5ab='';var _0x314adb=_0xd2ab76['version'];if(_0x20b821===_0xf006('0x78')){if('undefined'!=typeof _0xd2ab76['parameters']['views'][_0xf006('0x7b')]){var _0x592b4f=_0xd2ab76[_0xf006('0x76')]['views'][_0xf006('0x7b')];if(!/^(f|ht)tps?:\/\//i[_0xf006('0x88')](_0x592b4f)){_0x2a722a=path[_0xf006('0x4b')](_0xf006('0x89'),_0x292a04,_0x466124[0x0],_0x592b4f);}else{_0x2a722a=_0x592b4f;}}else{logger[_0xf006('0x64')](_0xf006('0x8a'));}if(_0xf006('0x20')!=typeof _0xd2ab76[_0xf006('0x76')][_0xf006('0x79')][_0xf006('0x7c')]){var _0x4e5efb=_0xd2ab76[_0xf006('0x76')][_0xf006('0x79')][_0xf006('0x7c')];if(!/^(f|ht)tps?:\/\//i[_0xf006('0x88')](_0x4e5efb)){_0x236033=path['join']('plugins',_0x292a04,_0x466124[0x0],_0x4e5efb);}else{_0x236033=_0x4e5efb;}}else{logger['info'](_0xf006('0x8b'));}}else if(_0x20b821===_0xf006('0x7e')){_0x889e17=_0xd2ab76[_0xf006('0x76')][_0xf006('0x7f')];_0x4cd5ab=_0xd2ab76[_0xf006('0x76')][_0xf006('0x81')];if('undefined'!=typeof _0xd2ab76[_0xf006('0x76')][_0xf006('0x79')]){if('undefined'!=typeof _0xd2ab76[_0xf006('0x76')]['views'][_0xf006('0x7b')]){var _0x592b4f=_0xd2ab76['parameters'][_0xf006('0x79')]['admin'];if(!/^(f|ht)tps?:\/\//i[_0xf006('0x88')](_0x592b4f)){_0x2a722a=path[_0xf006('0x4b')](_0xf006('0x89'),_0x292a04,_0x466124[0x0],_0x592b4f);}else{_0x2a722a=_0x592b4f;}}if('undefined'!=typeof _0xd2ab76[_0xf006('0x76')][_0xf006('0x79')][_0xf006('0x7c')]){var _0x4e5efb=_0xd2ab76[_0xf006('0x76')]['views'][_0xf006('0x7c')];if(!/^(f|ht)tps?:\/\//i[_0xf006('0x88')](_0x4e5efb)){_0x236033=path[_0xf006('0x4b')](_0xf006('0x89'),_0x292a04,_0x466124[0x0],_0x4e5efb);}else{_0x236033=_0x4e5efb;}}}}var _0x2b8994={'name':_0x35826c,'description':_0x3c6ff5,'path':path['join'](_0x292a04,_0x466124[0x0]),'type':_0x20b821,'sidebar':_0x5aeb14,'icon':_0x4b927c,'adminUrl':_0x2a722a,'agentUrl':_0x236033,'scriptName':_0x889e17,'scriptPath':_0x4cd5ab,'version':_0x314adb};removeReferences(_0x1aab38,null);return db['Plugin'][_0xf006('0x8c')](_0x2b8994)[_0xf006('0x25')](function(_0x3e9079){var _0x5f0410={'role':_0x28e07d[_0xf006('0x8d')][_0xf006('0x8e')],'userProfileId':_0x28e07d[_0xf006('0x8d')][_0xf006('0x8f')]};if(!_0x5f0410)throw new Error(_0xf006('0x90'));if(_0x5f0410[_0xf006('0x8e')]==='user'){var _0xb508a3=_0x3e9079['get']({'plain':!![]});return db[_0xf006('0x91')][_0xf006('0x49')]({'where':{'name':_0xf006('0x26'),'userProfileId':_0x5f0410['userProfileId']},'raw':!![]})[_0xf006('0x25')](function(_0x45ba3f){if(_0x45ba3f&&_0x45ba3f[_0xf006('0x92')]===0x0){return db[_0xf006('0x93')][_0xf006('0x8c')]({'name':_0xb508a3[_0xf006('0x2a')],'resourceId':_0xb508a3['id'],'type':_0x45ba3f[_0xf006('0x2a')],'sectionId':_0x45ba3f['id']},{})[_0xf006('0x25')](function(){return _0x3e9079;});}else{return _0x3e9079;}})['catch'](function(_0x1bdb3b){logger[_0xf006('0x28')](_0xf006('0x94'),_0x1bdb3b);throw _0x1bdb3b;});}return _0x3e9079;})[_0xf006('0x25')](respondWithResult(_0x4f2a1d,null))[_0xf006('0x4a')](handleError(_0x4f2a1d,null));}});}catch(_0x36ef1a){_0x4f2a1d[_0xf006('0x1c')](0x1f4)['send'](_0x36ef1a);}};function removeReferences(_0x2eeb8a,_0x544451){try{if(_0x2eeb8a){fs[_0xf006('0x63')](_0x2eeb8a);logger['info'](_0xf006('0x95'));}if(_0x544451){rimraf(_0x544451,function(){});logger[_0xf006('0x64')](_0xf006('0x96'));}}catch(_0x3bd57d){logger['error'](_0x3bd57d);}}exports['update']=function(_0x1ced0a,_0x4c2f25,_0x26376b){return db[_0xf006('0x2d')][_0xf006('0x49')]({'where':{'id':_0x1ced0a['params']['id']}})[_0xf006('0x25')](handleEntityNotFound(_0x4c2f25,null))[_0xf006('0x25')](saveUpdates(_0x1ced0a[_0xf006('0x8d')],null))[_0xf006('0x25')](respondWithResult(_0x4c2f25,null))[_0xf006('0x4a')](handleError(_0x4c2f25,null));};exports['delete']=function(_0xc03f10,_0x1da8f9,_0x1280c6){return db['Plugin'][_0xf006('0x49')]({'where':{'id':_0xc03f10[_0xf006('0x47')]['id']}})[_0xf006('0x25')](function(_0x2584f8){if(_0x2584f8){return _0x2584f8[_0xf006('0x27')]();}})[_0xf006('0x25')](function(_0x159818){rimraf(path['join'](config[_0xf006('0x4c')],_0xf006('0x59'),path[_0xf006('0x5a')](_0x159818['path'])),function(){});return _0x159818;})[_0xf006('0x25')](handleEntityNotFound(_0x1da8f9,null))[_0xf006('0x25')](respondWithStatusCode(_0x1da8f9,null))[_0xf006('0x4a')](handleError(_0x1da8f9,null));};exports[_0xf006('0x97')]=function(_0x362762,_0x306014,_0x132bc3){return BPromise['resolve']()[_0xf006('0x25')](function(){if(!_0x362762[_0xf006('0x33')]['path']){throw new Error(_0xf006('0x98'));}if(!_0x362762[_0xf006('0x33')][_0xf006('0x99')]){throw new Error(_0xf006('0x9a'));}var _0x144898=_0x362762[_0xf006('0x33')][_0xf006('0x9b')]?_0x362762[_0xf006('0x33')][_0xf006('0x9b')]+':'+_0x362762[_0xf006('0x33')][_0xf006('0x99')]:_0xf006('0x9c')+_0x362762['query']['port'];var _0x1e9969=_0x362762[_0xf006('0x33')][_0xf006('0x1e')]?_0x362762[_0xf006('0x33')][_0xf006('0x1e')]:!![];var _0x3fca3e=_0x362762[_0xf006('0x33')]['encoding']?_0x362762[_0xf006('0x33')]['encoding']:null;var _0x42806e={'method':_0x362762[_0xf006('0x9d')],'uri':util[_0xf006('0x61')]('%s%s',_0x144898,_0x362762[_0xf006('0x33')][_0xf006('0x7')]),'json':_0x1e9969,'resolveWithFullResponse':!![],'encoding':_0x3fca3e,'qs':_0x362762[_0xf006('0x33')]};if(_0x362762[_0xf006('0x9e')]){_0x42806e[_0xf006('0x9e')]=_0x362762['headers'];if(_0x42806e[_0xf006('0x9e')]['content-length']){delete _0x42806e[_0xf006('0x9e')][_0xf006('0x9f')];}}if(_0x42806e[_0xf006('0x9e')][_0xf006('0xa0')]){delete _0x42806e['headers'][_0xf006('0xa0')];}return rp(_0x42806e);})['then'](function(_0x5c405c){if(_0x5c405c){_0x306014[_0xf006('0x21')](_0x5c405c[_0xf006('0x9e')]);logger['info'](_0x5c405c['body']);if(_[_0xf006('0xa1')](_0x362762[_0xf006('0x33')]['path'],_0xf006('0x60'))&&_0x5c405c[_0xf006('0xa2')]==0x1f4){return _0x306014[_0xf006('0x1b')](_0x5c405c['statusCode']);}else{return _0x306014['status'](_0x5c405c[_0xf006('0xa2')])['send'](_0x5c405c[_0xf006('0x8d')]);}}else{return _0x306014[_0xf006('0x1b')](0xc8);}})[_0xf006('0x4a')](handleError(_0x306014,null));};exports['webhookPost']=function(_0x5649ec,_0x545f35,_0x2c37ff){return BPromise[_0xf006('0xa3')]()[_0xf006('0x25')](function(){if(!_0x5649ec[_0xf006('0x33')][_0xf006('0x7')]){throw new Error(_0xf006('0x98'));}if(!_0x5649ec[_0xf006('0x33')][_0xf006('0x99')]){throw new Error(_0xf006('0x9a'));}var _0x84ef7b=_0x5649ec[_0xf006('0x33')][_0xf006('0x9b')]?_0x5649ec[_0xf006('0x33')][_0xf006('0x9b')]+':'+_0x5649ec[_0xf006('0x33')][_0xf006('0x99')]:_0xf006('0x9c')+_0x5649ec['query'][_0xf006('0x99')];var _0x28b6fc=_0x5649ec[_0xf006('0x33')][_0xf006('0x1e')]?_0x5649ec['query'][_0xf006('0x1e')]:!![];var _0x2318df=_0x5649ec[_0xf006('0x33')]['encoding']?_0x5649ec[_0xf006('0x33')][_0xf006('0xa4')]:null;var _0x16c244={'method':_0x5649ec[_0xf006('0x9d')],'uri':util['format'](_0xf006('0xa5'),_0x84ef7b,_0x5649ec[_0xf006('0x33')]['path']),'json':_0x28b6fc,'resolveWithFullResponse':!![],'encoding':_0x2318df,'body':_0x5649ec[_0xf006('0x8d')]};if(_0x5649ec['headers']){_0x16c244['headers']=_0x5649ec[_0xf006('0x9e')];if(_0x16c244[_0xf006('0x9e')][_0xf006('0x9f')]){delete _0x16c244[_0xf006('0x9e')][_0xf006('0x9f')];}}if(_0x16c244['headers']['content-type']){delete _0x16c244[_0xf006('0x9e')]['content-type'];}return rp(_0x16c244);})[_0xf006('0x25')](function(_0x9f433b){if(_0x9f433b){_0x545f35[_0xf006('0x21')](_0x9f433b['headers']);logger[_0xf006('0x64')](_0x9f433b[_0xf006('0x8d')]);return _0x545f35[_0xf006('0x1c')](_0x9f433b['statusCode'])['send'](_0x9f433b[_0xf006('0x8d')]);}else{return _0x545f35[_0xf006('0x1b')](0xc8);}})[_0xf006('0x4a')](handleError(_0x545f35,null));}; \ No newline at end of file diff --git a/server/api/plugin/plugin.events.js b/server/api/plugin/plugin.events.js index 6b017a2..f11eac3 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 _0xc21c=['setMaxListeners','save','update','remove','emit','hasOwnProperty','hook','events','../../mysqldb'];(function(_0x3fed18,_0x1a87ef){var _0x2d71cc=function(_0x557560){while(--_0x557560){_0x3fed18['push'](_0x3fed18['shift']());}};_0x2d71cc(++_0x1a87ef);}(_0xc21c,0x166));var _0xcc21=function(_0x3778f0,_0x4c6ba8){_0x3778f0=_0x3778f0-0x0;var _0x2a43ff=_0xc21c[_0x3778f0];return _0x2a43ff;};'use strict';var EventEmitter=require(_0xcc21('0x0'));var Plugin=require(_0xcc21('0x1'))['db']['Plugin'];var PluginEvents=new EventEmitter();PluginEvents[_0xcc21('0x2')](0x0);var events={'afterCreate':_0xcc21('0x3'),'afterUpdate':_0xcc21('0x4'),'afterDestroy':_0xcc21('0x5')};function emitEvent(_0x4e17e8){return function(_0x3e29df,_0x31bf8b,_0x18866a){PluginEvents[_0xcc21('0x6')](_0x4e17e8+':'+_0x3e29df['id'],_0x3e29df);PluginEvents[_0xcc21('0x6')](_0x4e17e8,_0x3e29df);_0x18866a(null);};}for(var e in events){if(events[_0xcc21('0x7')](e)){var event=events[e];Plugin[_0xcc21('0x8')](e,emitEvent(event));}}module['exports']=PluginEvents; \ No newline at end of file +var _0x5a99=['emit','hook','exports','events','../../mysqldb','Plugin','save','update','remove'];(function(_0x3c7343,_0x57471f){var _0x531d25=function(_0x12f9b3){while(--_0x12f9b3){_0x3c7343['push'](_0x3c7343['shift']());}};_0x531d25(++_0x57471f);}(_0x5a99,0xc9));var _0x95a9=function(_0x5a39a8,_0x499ce0){_0x5a39a8=_0x5a39a8-0x0;var _0x1cae1e=_0x5a99[_0x5a39a8];return _0x1cae1e;};'use strict';var EventEmitter=require(_0x95a9('0x0'));var Plugin=require(_0x95a9('0x1'))['db'][_0x95a9('0x2')];var PluginEvents=new EventEmitter();PluginEvents['setMaxListeners'](0x0);var events={'afterCreate':_0x95a9('0x3'),'afterUpdate':_0x95a9('0x4'),'afterDestroy':_0x95a9('0x5')};function emitEvent(_0x475a71){return function(_0x4b30e2,_0x2c8e52,_0x3ff50a){PluginEvents[_0x95a9('0x6')](_0x475a71+':'+_0x4b30e2['id'],_0x4b30e2);PluginEvents[_0x95a9('0x6')](_0x475a71,_0x4b30e2);_0x3ff50a(null);};}for(var e in events){if(events['hasOwnProperty'](e)){var event=events[e];Plugin[_0x95a9('0x7')](e,emitEvent(event));}}module[_0x95a9('0x8')]=PluginEvents; \ No newline at end of file diff --git a/server/api/plugin/plugin.model.js b/server/api/plugin/plugin.model.js index 20267cd..8c57fdf 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 _0x472c=['Plugin','plugins','util','api','bluebird','request-promise','path','../../config/environment','exports'];(function(_0x3ab51d,_0x2fa01d){var _0x29a04e=function(_0x7807b0){while(--_0x7807b0){_0x3ab51d['push'](_0x3ab51d['shift']());}};_0x29a04e(++_0x2fa01d);}(_0x472c,0x1a9));var _0xc472=function(_0x36d249,_0xdedd53){_0x36d249=_0x36d249-0x0;var _0x44598c=_0x472c[_0x36d249];return _0x44598c;};'use strict';var _=require('lodash');var util=require(_0xc472('0x0'));var logger=require('../../config/logger')(_0xc472('0x1'));var moment=require('moment');var BPromise=require(_0xc472('0x2'));var rp=require(_0xc472('0x3'));var fs=require('fs');var path=require(_0xc472('0x4'));var rimraf=require('rimraf');var config=require(_0xc472('0x5'));var attributes=require('./plugin.attributes');module[_0xc472('0x6')]=function(_0x27d797,_0x24b09b){return _0x27d797['define'](_0xc472('0x7'),attributes,{'tableName':_0xc472('0x8'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0xecd9=['request-promise','path','../../config/environment','./plugin.attributes','exports','Plugin','plugins','lodash','util','../../config/logger','api','moment','bluebird'];(function(_0x311df2,_0x5b6291){var _0x2d70d7=function(_0x11d81b){while(--_0x11d81b){_0x311df2['push'](_0x311df2['shift']());}};_0x2d70d7(++_0x5b6291);}(_0xecd9,0x13f));var _0x9ecd=function(_0x1d653a,_0x1ee5cc){_0x1d653a=_0x1d653a-0x0;var _0x5e93f7=_0xecd9[_0x1d653a];return _0x5e93f7;};'use strict';var _=require(_0x9ecd('0x0'));var util=require(_0x9ecd('0x1'));var logger=require(_0x9ecd('0x2'))(_0x9ecd('0x3'));var moment=require(_0x9ecd('0x4'));var BPromise=require(_0x9ecd('0x5'));var rp=require(_0x9ecd('0x6'));var fs=require('fs');var path=require(_0x9ecd('0x7'));var rimraf=require('rimraf');var config=require(_0x9ecd('0x8'));var attributes=require(_0x9ecd('0x9'));module[_0x9ecd('0xa')]=function(_0x3106a4,_0x18346c){return _0x3106a4['define'](_0x9ecd('0xb'),attributes,{'tableName':_0x9ecd('0xc'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/plugin/plugin.rpc.js b/server/api/plugin/plugin.rpc.js index 56979c6..c35cf3c 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 _0xa16d=['register','then','info','Plugin,\x20%s,\x20%s','request\x20sent','Plugin,\x20%s,\x20%s,\x20%s','stringify','error','message','result','catch','Plugin','create','options','CreatePlugin','lodash','util','bluebird','randomstring','ioredis','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','client','http','redis','defaults','localhost','socket.io-emitter'];(function(_0xce9195,_0x1963e1){var _0x530fe6=function(_0x1b8055){while(--_0x1b8055){_0xce9195['push'](_0xce9195['shift']());}};_0x530fe6(++_0x1963e1);}(_0xa16d,0xaa));var _0xda16=function(_0x45dafa,_0x171e29){_0x45dafa=_0x45dafa-0x0;var _0xeb385a=_0xa16d[_0x45dafa];return _0xeb385a;};'use strict';var _=require(_0xda16('0x0'));var util=require(_0xda16('0x1'));var moment=require('moment');var BPromise=require(_0xda16('0x2'));var rs=require(_0xda16('0x3'));var fs=require('fs');var Redis=require(_0xda16('0x4'));var db=require('../../mysqldb')['db'];var utils=require(_0xda16('0x5'));var logger=require(_0xda16('0x6'))(_0xda16('0x7'));var config=require(_0xda16('0x8'));var jayson=require(_0xda16('0x9'));var client=jayson[_0xda16('0xa')][_0xda16('0xb')]({'port':0x232a});config[_0xda16('0xc')]=_[_0xda16('0xd')](config[_0xda16('0xc')],{'host':_0xda16('0xe'),'port':0x18eb});var socket=require(_0xda16('0xf'))(new Redis(config[_0xda16('0xc')]));require('./plugin.socket')[_0xda16('0x10')](socket);function respondWithRpcPromise(_0x4fc612,_0x49f6c3,_0x29abd6){return new BPromise(function(_0x54cad1,_0x51608c){return client['request'](_0x4fc612,_0x29abd6)[_0xda16('0x11')](function(_0x34524a){logger[_0xda16('0x12')](_0xda16('0x13'),_0x49f6c3,_0xda16('0x14'));logger['debug'](_0xda16('0x15'),_0x49f6c3,'request\x20sent',JSON[_0xda16('0x16')](_0x34524a));if(_0x34524a[_0xda16('0x17')]){if(_0x34524a['error']['code']===0x1f4){logger[_0xda16('0x17')]('Plugin,\x20%s,\x20%s',_0x49f6c3,_0x34524a['error'][_0xda16('0x18')]);return _0x51608c(_0x34524a[_0xda16('0x17')][_0xda16('0x18')]);}logger['error'](_0xda16('0x13'),_0x49f6c3,_0x34524a[_0xda16('0x17')][_0xda16('0x18')]);return _0x54cad1(_0x34524a['error'][_0xda16('0x18')]);}else{logger[_0xda16('0x12')](_0xda16('0x13'),_0x49f6c3,_0xda16('0x14'));_0x54cad1(_0x34524a[_0xda16('0x19')][_0xda16('0x18')]);}})[_0xda16('0x1a')](function(_0xe7bb06){logger[_0xda16('0x17')]('Plugin,\x20%s,\x20%s',_0x49f6c3,_0xe7bb06);_0x51608c(_0xe7bb06);});});}exports['CreatePlugin']=function(_0x5e0563){var _0x55a14e=this;return new Promise(function(_0x56028b,_0x2721c1){return db[_0xda16('0x1b')][_0xda16('0x1c')](_0x5e0563['body'],{'raw':_0x5e0563[_0xda16('0x1d')]?_0x5e0563[_0xda16('0x1d')]['raw']===undefined?!![]:![]:!![]})[_0xda16('0x11')](function(_0x28b5fe){logger[_0xda16('0x12')](_0xda16('0x1e'),_0x5e0563);logger['debug'](_0xda16('0x1e'),_0x5e0563,JSON[_0xda16('0x16')](_0x28b5fe));_0x56028b(_0x28b5fe);})[_0xda16('0x1a')](function(_0x57035a){logger[_0xda16('0x17')](_0xda16('0x1e'),_0x57035a[_0xda16('0x18')],_0x5e0563);_0x2721c1(_0x55a14e[_0xda16('0x17')](0x1f4,_0x57035a[_0xda16('0x18')]));});});}; \ No newline at end of file +var _0xbda9=['code','message','request\x20sent','result','catch','CreatePlugin','create','body','options','raw','moment','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','client','http','redis','defaults','localhost','./plugin.socket','register','then','info','Plugin,\x20%s,\x20%s','debug','stringify','error'];(function(_0x425dd4,_0x779c00){var _0x2ad350=function(_0x21f6e9){while(--_0x21f6e9){_0x425dd4['push'](_0x425dd4['shift']());}};_0x2ad350(++_0x779c00);}(_0xbda9,0x19d));var _0x9bda=function(_0x205959,_0x14c8f6){_0x205959=_0x205959-0x0;var _0x4cf94a=_0xbda9[_0x205959];return _0x4cf94a;};'use strict';var _=require('lodash');var util=require('util');var moment=require(_0x9bda('0x0'));var BPromise=require('bluebird');var rs=require(_0x9bda('0x1'));var fs=require('fs');var Redis=require(_0x9bda('0x2'));var db=require(_0x9bda('0x3'))['db'];var utils=require(_0x9bda('0x4'));var logger=require(_0x9bda('0x5'))(_0x9bda('0x6'));var config=require(_0x9bda('0x7'));var jayson=require('jayson/promise');var client=jayson[_0x9bda('0x8')][_0x9bda('0x9')]({'port':0x232a});config[_0x9bda('0xa')]=_[_0x9bda('0xb')](config[_0x9bda('0xa')],{'host':_0x9bda('0xc'),'port':0x18eb});var socket=require('socket.io-emitter')(new Redis(config['redis']));require(_0x9bda('0xd'))[_0x9bda('0xe')](socket);function respondWithRpcPromise(_0x3a0455,_0x2cabc1,_0x330688){return new BPromise(function(_0x50114a,_0x2f6cc3){return client['request'](_0x3a0455,_0x330688)[_0x9bda('0xf')](function(_0x35a08d){logger[_0x9bda('0x10')](_0x9bda('0x11'),_0x2cabc1,'request\x20sent');logger[_0x9bda('0x12')]('Plugin,\x20%s,\x20%s,\x20%s',_0x2cabc1,'request\x20sent',JSON[_0x9bda('0x13')](_0x35a08d));if(_0x35a08d['error']){if(_0x35a08d[_0x9bda('0x14')][_0x9bda('0x15')]===0x1f4){logger[_0x9bda('0x14')](_0x9bda('0x11'),_0x2cabc1,_0x35a08d[_0x9bda('0x14')][_0x9bda('0x16')]);return _0x2f6cc3(_0x35a08d[_0x9bda('0x14')][_0x9bda('0x16')]);}logger[_0x9bda('0x14')](_0x9bda('0x11'),_0x2cabc1,_0x35a08d['error'][_0x9bda('0x16')]);return _0x50114a(_0x35a08d[_0x9bda('0x14')]['message']);}else{logger[_0x9bda('0x10')](_0x9bda('0x11'),_0x2cabc1,_0x9bda('0x17'));_0x50114a(_0x35a08d[_0x9bda('0x18')]['message']);}})[_0x9bda('0x19')](function(_0x4ea189){logger[_0x9bda('0x14')](_0x9bda('0x11'),_0x2cabc1,_0x4ea189);_0x2f6cc3(_0x4ea189);});});}exports[_0x9bda('0x1a')]=function(_0x2e95ab){var _0x10ceab=this;return new Promise(function(_0x2ebb38,_0x37f899){return db['Plugin'][_0x9bda('0x1b')](_0x2e95ab[_0x9bda('0x1c')],{'raw':_0x2e95ab[_0x9bda('0x1d')]?_0x2e95ab[_0x9bda('0x1d')][_0x9bda('0x1e')]===undefined?!![]:![]:!![]})[_0x9bda('0xf')](function(_0x3dd50c){logger[_0x9bda('0x10')]('CreatePlugin',_0x2e95ab);logger[_0x9bda('0x12')](_0x9bda('0x1a'),_0x2e95ab,JSON[_0x9bda('0x13')](_0x3dd50c));_0x2ebb38(_0x3dd50c);})[_0x9bda('0x19')](function(_0x54dc19){logger['error'](_0x9bda('0x1a'),_0x54dc19['message'],_0x2e95ab);_0x37f899(_0x10ceab[_0x9bda('0x14')](0x1f4,_0x54dc19[_0x9bda('0x16')]));});});}; \ No newline at end of file diff --git a/server/api/plugin/plugin.socket.js b/server/api/plugin/plugin.socket.js index df90f38..d1b2e06 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 _0xde7d=['removeListener','length','./plugin.events','save','remove','emit'];(function(_0x3bf83f,_0x181cac){var _0x22c4a9=function(_0xb3ff0d){while(--_0xb3ff0d){_0x3bf83f['push'](_0x3bf83f['shift']());}};_0x22c4a9(++_0x181cac);}(_0xde7d,0x140));var _0xdde7=function(_0xa206cf,_0x518f31){_0xa206cf=_0xa206cf-0x0;var _0x17d1b3=_0xde7d[_0xa206cf];return _0x17d1b3;};'use strict';var PluginEvents=require(_0xdde7('0x0'));var events=[_0xdde7('0x1'),_0xdde7('0x2'),'update'];function createListener(_0x14bc0c,_0x1c2e40){return function(_0x5cf200){_0x1c2e40[_0xdde7('0x3')](_0x14bc0c,_0x5cf200);};}function removeListener(_0x4863ff,_0xc419ca){return function(){PluginEvents[_0xdde7('0x4')](_0x4863ff,_0xc419ca);};}exports['register']=function(_0x239d01){for(var _0x5e9a7f=0x0,_0x3dd917=events[_0xdde7('0x5')];_0x5e9a7f<_0x3dd917;_0x5e9a7f++){var _0x17d51a=events[_0x5e9a7f];var _0x28745d=createListener('plugin:'+_0x17d51a,_0x239d01);PluginEvents['on'](_0x17d51a,_0x28745d);}}; \ No newline at end of file +var _0x967d=['register','length','plugin:','./plugin.events','remove','update','emit','removeListener'];(function(_0x1cc8fe,_0x105328){var _0x230054=function(_0x1a1b56){while(--_0x1a1b56){_0x1cc8fe['push'](_0x1cc8fe['shift']());}};_0x230054(++_0x105328);}(_0x967d,0x183));var _0xd967=function(_0x2d4d0c,_0x79451f){_0x2d4d0c=_0x2d4d0c-0x0;var _0x4a89a7=_0x967d[_0x2d4d0c];return _0x4a89a7;};'use strict';var PluginEvents=require(_0xd967('0x0'));var events=['save',_0xd967('0x1'),_0xd967('0x2')];function createListener(_0x39b94c,_0x16c580){return function(_0x475bb6){_0x16c580[_0xd967('0x3')](_0x39b94c,_0x475bb6);};}function removeListener(_0x36f2df,_0x3fe4d9){return function(){PluginEvents[_0xd967('0x4')](_0x36f2df,_0x3fe4d9);};}exports[_0xd967('0x5')]=function(_0x2cdd4c){for(var _0x2f0006=0x0,_0x4359c2=events[_0xd967('0x6')];_0x2f0006<_0x4359c2;_0x2f0006++){var _0x5dbfa8=events[_0x2f0006];var _0x59d7f5=createListener(_0xd967('0x7')+_0x5dbfa8,_0x2cdd4c);PluginEvents['on'](_0x5dbfa8,_0x59d7f5);}}; \ No newline at end of file diff --git a/server/api/pm2/index.js b/server/api/pm2/index.js index ed122d7..9ec24cc 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(_0x1ee472,_0x23da0d){var _0x14c371=function(_0x442c8f){while(--_0x442c8f){_0x1ee472['push'](_0x1ee472['shift']());}};_0x14c371(++_0x23da0d);}(_0xa9e0,0x123));var _0x0a9e=function(_0x5c351c,_0x2046d8){_0x5c351c=_0x5c351c-0x0;var _0x26f3b3=_0xa9e0[_0x5c351c];return _0x26f3b3;};'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(_0x2969f0,_0x328710){var _0x217e68=function(_0x49fd20){while(--_0x49fd20){_0x2969f0['push'](_0x2969f0['shift']());}};_0x217e68(++_0x328710);}(_0xa9e0,0x123));var _0x0a9e=function(_0x4709c0,_0x3396c7){_0x4709c0=_0x4709c0-0x0;var _0x13348b=_0xa9e0[_0x4709c0];return _0x13348b;};'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 6656680..58fa2f8 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 _0x6e6c=['script','join','cwd','dirname','chdir','start','dump','update','restart','hasOwnProperty','params','Unknown\x20status','destroy','delete','Unknown\x20id','lodash','../../config/pm2','api','path','bluebird','sendStatus','status','error','name','send','npm\x20install','info','index','then','reject','express','length','catch','describe','create','body'];(function(_0x58dc25,_0x49b9d5){var _0x21b0a7=function(_0x38a186){while(--_0x38a186){_0x58dc25['push'](_0x58dc25['shift']());}};_0x21b0a7(++_0x49b9d5);}(_0x6e6c,0xc3));var _0xc6e6=function(_0x19e35c,_0x29cd1e){_0x19e35c=_0x19e35c-0x0;var _0x3e1fe8=_0x6e6c[_0x19e35c];return _0x3e1fe8;};'use strict';var _=require(_0xc6e6('0x0'));var pm2=require(_0xc6e6('0x1'));var logger=require('../../config/logger')(_0xc6e6('0x2'));var path=require(_0xc6e6('0x3'));var exec=require('child_process')['exec'];var BPromise=require(_0xc6e6('0x4'));function handleEntityNotFound(_0x5a9e2b,_0x40b7e1){return function(_0x4b13f0){if(!_0x4b13f0){_0x5a9e2b[_0xc6e6('0x5')](0x194);;}return _0x4b13f0;};}function respondWithResult(_0x1182c7,_0x4bf906){_0x4bf906=_0x4bf906||0xc8;return function(_0x301f55){if(_0x301f55){return _0x1182c7[_0xc6e6('0x6')](_0x4bf906)['json'](_0x301f55);}return null;};}function handleError(_0x324706,_0x15d268){_0x15d268=_0x15d268||0x1f4;return function(_0x5a7ef3){logger[_0xc6e6('0x7')](_0x5a7ef3['stack']);if(_0x5a7ef3[_0xc6e6('0x8')]){delete _0x5a7ef3[_0xc6e6('0x8')];}_0x324706[_0xc6e6('0x6')](_0x15d268)[_0xc6e6('0x9')](_0x5a7ef3);};}function execChildProcess(){return new BPromise(function(_0x12596b,_0xbf9ffc){exec(_0xc6e6('0xa'),function(_0x10aae5,_0x2c205d,_0x58540d){logger[_0xc6e6('0xb')](_0x2c205d);logger['info'](_0x58540d);if(_0x10aae5){logger[_0xc6e6('0x7')](_0x10aae5);return _0xbf9ffc(_0x10aae5);}return _0x12596b(_0x2c205d);});});}exports[_0xc6e6('0xc')]=function(_0x33aea0,_0x13c8d5){return pm2['list']()[_0xc6e6('0xd')](function(_0x2bfe7d){if(_0x2bfe7d){var _0x13be73=_[_0xc6e6('0xe')](_0x2bfe7d,function(_0x102673){return _0x102673['name']===_0xc6e6('0xf')||_0x102673[_0xc6e6('0x8')]==='motion2';});return{'rows':_0x13be73,'count':_0x13be73[_0xc6e6('0x10')]};}return null;})[_0xc6e6('0xd')](respondWithResult(_0x13c8d5,null))[_0xc6e6('0x11')](handleError(_0x13c8d5,null));};exports['show']=function(_0x51fd7c,_0x5867bf){return pm2[_0xc6e6('0x12')](_0x51fd7c['params']['id'])[_0xc6e6('0xd')](respondWithResult(_0x5867bf,null))[_0xc6e6('0xd')](handleEntityNotFound(_0x5867bf,null))[_0xc6e6('0x11')](handleError(_0x5867bf,null));};exports[_0xc6e6('0x13')]=function(_0x19e1e4,_0x3a0d83){if(_0x19e1e4[_0xc6e6('0x14')][_0xc6e6('0x8')]&&_0x19e1e4[_0xc6e6('0x14')][_0xc6e6('0x15')]){var _0x4a36b6=path[_0xc6e6('0x16')](__dirname,'../../files/plugins',_0x19e1e4[_0xc6e6('0x14')][_0xc6e6('0x15')]);var _0x2be6fc=process[_0xc6e6('0x17')]();process['chdir'](path[_0xc6e6('0x18')](_0x4a36b6));return execChildProcess()[_0xc6e6('0xd')](function(_0x3a96df){process[_0xc6e6('0x19')](_0x2be6fc);return pm2[_0xc6e6('0x1a')]({'name':_0x19e1e4['body'][_0xc6e6('0x8')],'script':_0x4a36b6});})['then'](function(_0x266786){pm2[_0xc6e6('0x1b')]();return _0x266786[0x0];})[_0xc6e6('0xd')](respondWithResult(_0x3a0d83,0xc9))[_0xc6e6('0x11')](handleError(_0x3a0d83,null));}else{return _0x3a0d83['status'](0x1f4)[_0xc6e6('0x9')]({'message':'Missing\x20name\x20and/or\x20path'});}};exports[_0xc6e6('0x1c')]=function(_0x534745,_0x267c6a){if(_0x534745[_0xc6e6('0x14')]['id']){delete _0x534745[_0xc6e6('0x14')]['id'];}var _0x41e7c2={'online':_0xc6e6('0x1d'),'stopped':'stop'};if(_0x41e7c2[_0xc6e6('0x1e')](_0x534745[_0xc6e6('0x14')][_0xc6e6('0x6')])){return pm2[_0x41e7c2[_0x534745[_0xc6e6('0x14')]['status']]](_0x534745[_0xc6e6('0x1f')]['id'])['then'](respondWithResult(_0x267c6a,0xc8))[_0xc6e6('0x11')](handleError(_0x267c6a,null));}else{return _0x267c6a[_0xc6e6('0x6')](0x1f4)[_0xc6e6('0x9')]({'message':_0xc6e6('0x20')});}};exports[_0xc6e6('0x21')]=function(_0x402598,_0x43ff9c){if(_0x402598[_0xc6e6('0x14')]['id']){delete _0x402598[_0xc6e6('0x14')]['id'];}if(_0x402598[_0xc6e6('0x1f')]['id']){return pm2[_0xc6e6('0x22')](_0x402598[_0xc6e6('0x1f')]['id'])[_0xc6e6('0xd')](function(_0x410ba5){pm2[_0xc6e6('0x1b')]();return _0x410ba5[0x0];})[_0xc6e6('0xd')](respondWithResult(_0x43ff9c,null))[_0xc6e6('0x11')](handleError(_0x43ff9c,null));}else{return _0x43ff9c['status'](0x1f4)[_0xc6e6('0x9')]({'message':_0xc6e6('0x23')});}}; \ No newline at end of file +var _0x8ce3=['length','catch','show','describe','params','then','create','body','script','join','../../files/plugins','cwd','dirname','chdir','dump','Missing\x20name\x20and/or\x20path','update','restart','stop','hasOwnProperty','Unknown\x20status','delete','Unknown\x20id','lodash','../../config/pm2','api','path','child_process','exec','bluebird','status','json','stack','name','send','npm\x20install','info','error','index','list','reject','express','motion2'];(function(_0x2e2eab,_0x2e609a){var _0x2357bc=function(_0x2235ad){while(--_0x2235ad){_0x2e2eab['push'](_0x2e2eab['shift']());}};_0x2357bc(++_0x2e609a);}(_0x8ce3,0xc3));var _0x38ce=function(_0x279522,_0x497270){_0x279522=_0x279522-0x0;var _0xc6071d=_0x8ce3[_0x279522];return _0xc6071d;};'use strict';var _=require(_0x38ce('0x0'));var pm2=require(_0x38ce('0x1'));var logger=require('../../config/logger')(_0x38ce('0x2'));var path=require(_0x38ce('0x3'));var exec=require(_0x38ce('0x4'))[_0x38ce('0x5')];var BPromise=require(_0x38ce('0x6'));function handleEntityNotFound(_0x17b96d,_0x1efae3){return function(_0x381fa0){if(!_0x381fa0){_0x17b96d['sendStatus'](0x194);;}return _0x381fa0;};}function respondWithResult(_0x372f86,_0xb24f4c){_0xb24f4c=_0xb24f4c||0xc8;return function(_0x58074c){if(_0x58074c){return _0x372f86[_0x38ce('0x7')](_0xb24f4c)[_0x38ce('0x8')](_0x58074c);}return null;};}function handleError(_0x3f8011,_0x482955){_0x482955=_0x482955||0x1f4;return function(_0x3c66e5){logger['error'](_0x3c66e5[_0x38ce('0x9')]);if(_0x3c66e5['name']){delete _0x3c66e5[_0x38ce('0xa')];}_0x3f8011[_0x38ce('0x7')](_0x482955)[_0x38ce('0xb')](_0x3c66e5);};}function execChildProcess(){return new BPromise(function(_0x2c0cab,_0x564332){exec(_0x38ce('0xc'),function(_0x2a9045,_0x171a02,_0x29bd3a){logger[_0x38ce('0xd')](_0x171a02);logger[_0x38ce('0xd')](_0x29bd3a);if(_0x2a9045){logger[_0x38ce('0xe')](_0x2a9045);return _0x564332(_0x2a9045);}return _0x2c0cab(_0x171a02);});});}exports[_0x38ce('0xf')]=function(_0x263d6f,_0x2e661b){return pm2[_0x38ce('0x10')]()['then'](function(_0x48ba7c){if(_0x48ba7c){var _0x3c4d7f=_[_0x38ce('0x11')](_0x48ba7c,function(_0x2369f3){return _0x2369f3['name']===_0x38ce('0x12')||_0x2369f3['name']===_0x38ce('0x13');});return{'rows':_0x3c4d7f,'count':_0x3c4d7f[_0x38ce('0x14')]};}return null;})['then'](respondWithResult(_0x2e661b,null))[_0x38ce('0x15')](handleError(_0x2e661b,null));};exports[_0x38ce('0x16')]=function(_0x1dfaba,_0x51f670){return pm2[_0x38ce('0x17')](_0x1dfaba[_0x38ce('0x18')]['id'])[_0x38ce('0x19')](respondWithResult(_0x51f670,null))[_0x38ce('0x19')](handleEntityNotFound(_0x51f670,null))[_0x38ce('0x15')](handleError(_0x51f670,null));};exports[_0x38ce('0x1a')]=function(_0x2d4218,_0x518b04){if(_0x2d4218[_0x38ce('0x1b')][_0x38ce('0xa')]&&_0x2d4218[_0x38ce('0x1b')][_0x38ce('0x1c')]){var _0x30b060=path[_0x38ce('0x1d')](__dirname,_0x38ce('0x1e'),_0x2d4218[_0x38ce('0x1b')][_0x38ce('0x1c')]);var _0x3cf50b=process[_0x38ce('0x1f')]();process['chdir'](path[_0x38ce('0x20')](_0x30b060));return execChildProcess()[_0x38ce('0x19')](function(_0xe40e9c){process[_0x38ce('0x21')](_0x3cf50b);return pm2['start']({'name':_0x2d4218[_0x38ce('0x1b')][_0x38ce('0xa')],'script':_0x30b060});})['then'](function(_0xe0af00){pm2[_0x38ce('0x22')]();return _0xe0af00[0x0];})[_0x38ce('0x19')](respondWithResult(_0x518b04,0xc9))['catch'](handleError(_0x518b04,null));}else{return _0x518b04['status'](0x1f4)[_0x38ce('0xb')]({'message':_0x38ce('0x23')});}};exports[_0x38ce('0x24')]=function(_0x21d4e7,_0x264cf0){if(_0x21d4e7[_0x38ce('0x1b')]['id']){delete _0x21d4e7[_0x38ce('0x1b')]['id'];}var _0xce1f64={'online':_0x38ce('0x25'),'stopped':_0x38ce('0x26')};if(_0xce1f64[_0x38ce('0x27')](_0x21d4e7[_0x38ce('0x1b')]['status'])){return pm2[_0xce1f64[_0x21d4e7[_0x38ce('0x1b')][_0x38ce('0x7')]]](_0x21d4e7['params']['id'])[_0x38ce('0x19')](respondWithResult(_0x264cf0,0xc8))[_0x38ce('0x15')](handleError(_0x264cf0,null));}else{return _0x264cf0['status'](0x1f4)[_0x38ce('0xb')]({'message':_0x38ce('0x28')});}};exports['destroy']=function(_0x28d775,_0x53f2c9){if(_0x28d775[_0x38ce('0x1b')]['id']){delete _0x28d775[_0x38ce('0x1b')]['id'];}if(_0x28d775[_0x38ce('0x18')]['id']){return pm2[_0x38ce('0x29')](_0x28d775[_0x38ce('0x18')]['id'])[_0x38ce('0x19')](function(_0x34262a){pm2[_0x38ce('0x22')]();return _0x34262a[0x0];})['then'](respondWithResult(_0x53f2c9,null))['catch'](handleError(_0x53f2c9,null));}else{return _0x53f2c9[_0x38ce('0x7')](0x1f4)[_0x38ce('0xb')]({'message':_0x38ce('0x2a')});}}; \ No newline at end of file diff --git a/server/api/realtime/index.js b/server/api/realtime/index.js index b881c7d..07e19b2 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 _0x878f=['isAuthenticated','getAgents','/queues','getQueues','exports','express','Router','../../components/auth/service','get','/agents'];(function(_0x53ccf2,_0x13cb67){var _0x5a2964=function(_0x3b0514){while(--_0x3b0514){_0x53ccf2['push'](_0x53ccf2['shift']());}};_0x5a2964(++_0x13cb67);}(_0x878f,0x1bd));var _0xf878=function(_0x2b7330,_0x4ef8d5){_0x2b7330=_0x2b7330-0x0;var _0x136923=_0x878f[_0x2b7330];return _0x136923;};'use strict';var express=require(_0xf878('0x0'));var router=express[_0xf878('0x1')]();var auth=require(_0xf878('0x2'));var controller=require('./realtime.controller');router[_0xf878('0x3')](_0xf878('0x4'),auth[_0xf878('0x5')](),controller[_0xf878('0x6')]);router[_0xf878('0x3')](_0xf878('0x7'),auth[_0xf878('0x5')](),controller[_0xf878('0x8')]);module[_0xf878('0x9')]=router; \ No newline at end of file +var _0xec9a=['./realtime.controller','get','/agents','isAuthenticated','getAgents','getQueues','exports','express','Router','../../components/auth/service'];(function(_0x3dd15e,_0x1f0015){var _0x231fd0=function(_0x4f680a){while(--_0x4f680a){_0x3dd15e['push'](_0x3dd15e['shift']());}};_0x231fd0(++_0x1f0015);}(_0xec9a,0x101));var _0xaec9=function(_0x55d630,_0x33b09a){_0x55d630=_0x55d630-0x0;var _0x3b66b4=_0xec9a[_0x55d630];return _0x3b66b4;};'use strict';var express=require(_0xaec9('0x0'));var router=express[_0xaec9('0x1')]();var auth=require(_0xaec9('0x2'));var controller=require(_0xaec9('0x3'));router[_0xaec9('0x4')](_0xaec9('0x5'),auth[_0xaec9('0x6')](),controller[_0xaec9('0x7')]);router['get']('/queues',auth[_0xaec9('0x6')](),controller[_0xaec9('0x8')]);module[_0xaec9('0x9')]=router; \ No newline at end of file diff --git a/server/api/realtime/realtime.controller.js b/server/api/realtime/realtime.controller.js index fde26a4..13fb332 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 _0x38c4=['fieldName','type','key','agent','getOptions','raw','push','sequelize','forEach','Pause','where','user','role','userProfileId','online','extraQueryConditions','assign','UserProfile','getResources','findAndCountAll','filterAgentAttributes','merge','voiceStatus','talking','Status','sortAgentsByStatus','getRealtimeAgentsQueryFields','catch','Channel\x20parameter\x20%s\x20is\x20invalid','startCase','voice','outbound','Queues','name','filter','getRealtimeQueues','util','../../components/realtime/queues','../../config/utils','../../mysqldb','../../errors/api','APIBadRequestError','handleError','undefined','limit','count','set','Content-Range','json','getAgents','getChannels','query','globalQueueFilter','globalStatusFilter','pauseTypeFilter','pause','*pause','resolve','then','channel','isValidChannel','format','toLowerCase','sort','includes','globalStatus','getUpdatedSortOptions','fields','order','getAgentIdsByQueues','getRealtimeAgents','rows','getSortedAgentsIdsByStatus','length','map','rawAttributes'];(function(_0x58c20f,_0x4cdb1b){var _0x3b0318=function(_0x36fa84){while(--_0x36fa84){_0x58c20f['push'](_0x58c20f['shift']());}};_0x3b0318(++_0x4cdb1b);}(_0x38c4,0xbc));var _0x438c=function(_0x4f462a,_0x24d244){_0x4f462a=_0x4f462a-0x0;var _0x5ad97b=_0x38c4[_0x4f462a];return _0x5ad97b;};'use strict';var _=require('lodash');var util=require(_0x438c('0x0'));var rta=require('../../components/realtime/agents');var rtq=require(_0x438c('0x1'));var qs=require('../../components/parsers/qs');var utils=require(_0x438c('0x2'));var db=require(_0x438c('0x3'))['db'];var APIBadRequestError=require(_0x438c('0x4'))[_0x438c('0x5')];var APIHandleError=require('../../errors/api')[_0x438c('0x6')];function respondWithFilteredResult(_0x1b9dd8,_0x3b26b4){return function(_0x204590){if(_0x204590){var _0x3e8e44=typeof _0x3b26b4['offset']===_0x438c('0x7')&&typeof _0x3b26b4[_0x438c('0x8')]===_0x438c('0x7');var _0x51dfa1=_0x204590['count'];var _0x284078=_0x3e8e44?0x0:_0x3b26b4['offset'];var _0x2cd140=_0x3e8e44?_0x204590[_0x438c('0x9')]:_0x3b26b4['offset']+_0x3b26b4[_0x438c('0x8')];var _0x4b1ae3;if(_0x2cd140>=_0x51dfa1){_0x2cd140=_0x51dfa1;_0x4b1ae3=0xc8;}else{_0x4b1ae3=0xce;}_0x1b9dd8['status'](_0x4b1ae3);return _0x1b9dd8[_0x438c('0xa')](_0x438c('0xb'),_0x284078+'-'+_0x2cd140+'/'+_0x51dfa1)[_0x438c('0xc')](_0x204590);}return null;};}exports[_0x438c('0xd')]=function(_0x544651,_0x4db862){var _0x5ae945={'count':0x0,'rows':[]};var _0xcebb66={};var _0x242a87;var _0x126461=utils[_0x438c('0xe')]();var _0x5f25d2;var _0x432b01;var _0xa477e9=_0x544651[_0x438c('0xf')][_0x438c('0x10')];var _0x510092=_0x544651[_0x438c('0xf')][_0x438c('0x11')];var _0x4fc361=_0x544651[_0x438c('0xf')][_0x438c('0x12')];var _0x104458=_0x510092===_0x438c('0x13')||_0x510092===_0x438c('0x14')?!![]:![];var _0x3fad5a=[];var _0x5112d3;var _0x1b7f3b;Promise[_0x438c('0x15')]()[_0x438c('0x16')](function(){if(_0x544651[_0x438c('0xf')][_0x438c('0x17')]){if(!utils[_0x438c('0x18')](_0x544651[_0x438c('0xf')][_0x438c('0x17')])){throw new APIBadRequestError(util[_0x438c('0x19')]('Channel\x20parameter\x20%s\x20is\x20invalid',_0x544651[_0x438c('0xf')][_0x438c('0x17')]));}_0x242a87=_0x544651[_0x438c('0xf')][_0x438c('0x17')][_0x438c('0x1a')]();}if(!_0x544651['query'][_0x438c('0x1b')]||!_0x544651[_0x438c('0xf')]['sort'][_0x438c('0x1c')](_0x438c('0x1d'))){_0x544651['query'][_0x438c('0x1b')]=rta['validateSortParameter'](_0x544651['query']['sort']);return;}var _0x4feecb=rta[_0x438c('0x1e')](_0x544651[_0x438c('0xf')][_0x438c('0x1b')]);_0x544651[_0x438c('0xf')][_0x438c('0x1b')]=_0x4feecb[_0x438c('0x1f')]['join'](',');_0x5112d3=_0x4feecb[_0x438c('0x20')];})['then'](function(){if(!_0xa477e9){return[];}return rta[_0x438c('0x21')](_0xa477e9,_0x242a87);})[_0x438c('0x16')](function(_0x17c48b){_0x3fad5a=_0x17c48b;return rta[_0x438c('0x22')]();})[_0x438c('0x16')](function(_0x1a32c8){_0x432b01=_0x1a32c8[_0x438c('0x23')];if((!_0x510092||_0x104458)&&!_0x5112d3){return _0x3fad5a;}if(_0x5112d3&&!_0x510092){return rta[_0x438c('0x24')](_0x432b01,_0x3fad5a,_0x5112d3);}else{return rta['getAgentIdsByStatus'](_0x432b01,_0x3fad5a,_0x510092);}})[_0x438c('0x16')](function(_0x399c69){_0x3fad5a=_0x399c69;var _0x52e39f=![];if(_0x3fad5a[_0x438c('0x25')]===0x0){if(_0xa477e9||_0x510092){_0x52e39f=!![];}if(_0x104458){_0x52e39f=![];}}if(_0x52e39f){return _0x5ae945;}var _0x3a9c7b=_[_0x438c('0x26')](db['User'][_0x438c('0x27')],function(_0x41bec9){return{'name':_0x41bec9[_0x438c('0x28')],'type':_0x41bec9[_0x438c('0x29')][_0x438c('0x2a')]};});_0x544651['query']['role']=_0x438c('0x2b');_0xcebb66=qs[_0x438c('0x2c')](_0x3a9c7b,_0x544651);_0xcebb66[_0x438c('0x2d')]=!![];var _0x4d7707=[];if(_0x3fad5a['length']>0x0){_0x4d7707[_0x438c('0x2e')]({'id':{'$in':_0x3fad5a}});if(_0x5112d3&&!_0x510092){_0x1b7f3b=[db[_0x438c('0x2f')]['literal']('FIELD(id,'+_0x3fad5a+')')];_0xcebb66[_0x438c('0x20')]=_0x1b7f3b;}}if(_0x104458){_0x126461[_0x438c('0x30')](function(_0x54cefd){var _0x2a56cf=!![];if(_0x510092===_0x438c('0x14')&&_0x242a87!==_0x54cefd){_0x2a56cf=![];}_0x4d7707[_0x438c('0x2e')]({[_0x54cefd+_0x438c('0x31')]:_0x2a56cf});});if(_0x4fc361){_0x4d7707['push']({'pauseType':_0x4fc361});}}else if(_0x510092){_0x126461[_0x438c('0x30')](function(_0x24c863){_0x4d7707[_0x438c('0x2e')]({[_0x24c863+_0x438c('0x31')]:![]});});}_0xcebb66['where']=_['merge'](_0xcebb66[_0x438c('0x32')],{'$and':_0x4d7707});if(_0x544651[_0x438c('0x33')][_0x438c('0x34')]===_0x438c('0x33')){var _0x58d4c4={'params':{'id':_0x544651[_0x438c('0x33')][_0x438c('0x35')]},'query':{'section':'Agents','role':'agent','raw':!![],'ids':_0x3fad5a,'customSorting':_0x1b7f3b}};if(_0x544651['query'][_0x438c('0x36')]){_0x58d4c4['query'][_0x438c('0x36')]=!![];}if(_0x104458){_0x58d4c4[_0x438c('0xf')][_0x438c('0x37')]=_0x4d7707;}_0x58d4c4['query']=Object[_0x438c('0x38')](_0x58d4c4[_0x438c('0xf')],_['omit'](_0x544651[_0x438c('0xf')],'id'));return db[_0x438c('0x39')][_0x438c('0x3a')](_0x58d4c4);}return db['User'][_0x438c('0x3b')](_0xcebb66);})['then'](function(_0x2e7bfb){_0x5ae945[_0x438c('0x9')]=_0x2e7bfb['count'];_0x5f25d2=_0x2e7bfb[_0x438c('0x23')];return _0x5f25d2[_0x438c('0x26')](function(_0x16107d){var _0x2bc7d9=_['find'](_0x432b01,['id',_0x16107d['id']]);if(_0x2bc7d9){var _0x1bad00=rta[_0x438c('0x3c')](_0x2bc7d9);_[_0x438c('0x3d')](_0x16107d,_0x1bad00);}_0x16107d['globalStatus']=rta['getAgentStatus'](_0x16107d);if(_0x16107d[_0x438c('0x1d')]['includes'](_0x438c('0x13'))){_0x126461[_0x438c('0x30')](function(_0x2df348){if(_0x16107d[_0x2df348+_0x438c('0x31')]){if(_0x2df348==='voice'){if(_0x16107d[_0x438c('0x3e')]!==_0x438c('0x3f')){_0x16107d['voiceStatus']=_0x438c('0x13');}}else{_0x16107d[_0x2df348+_0x438c('0x40')]='pause';}}});}return _0x16107d;});})[_0x438c('0x16')](function(_0x31b67c){if(!_0x5112d3||_0x1b7f3b){return _0x31b67c;}return rta[_0x438c('0x41')](_0x31b67c,_0x5112d3);})[_0x438c('0x16')](function(_0x6e2d79){var _0x141526=rta[_0x438c('0x42')]();_0x5ae945['rows']=_0x6e2d79[_0x438c('0x26')](function(_0x5985e5){return _['pick'](_0x5985e5,_0x141526);});return _0x5ae945;})[_0x438c('0x16')](respondWithFilteredResult(_0x4db862,_0xcebb66))[_0x438c('0x43')](APIHandleError(_0x4db862));};exports['getQueues']=function(_0x3de0bc,_0x2609d9){var _0xaeb319={'count':0x0,'rows':[]};var _0x194e2f={};var _0x169623;var _0x3566c8;var _0x14bc39;Promise[_0x438c('0x15')]()[_0x438c('0x16')](function(){if(_0x3de0bc[_0x438c('0xf')]['channel']){if(!utils[_0x438c('0x18')](_0x3de0bc['query'][_0x438c('0x17')])){throw new APIBadRequestError(util['format'](_0x438c('0x44'),_0x3de0bc[_0x438c('0xf')][_0x438c('0x17')]));}_0x169623=_0x3de0bc['query']['channel'][_0x438c('0x1a')]();}var _0x52df43=_[_0x438c('0x45')](_0x169623)+'Queue';var _0x389c4a=_['map'](db[_0x52df43][_0x438c('0x27')],function(_0x21f836){return{'name':_0x21f836[_0x438c('0x28')],'type':_0x21f836['type']['key']};});if(!_0x3de0bc['query']['fields']){var _0x59ba9b=['id','name'];if(_0x169623===_0x438c('0x46')){_0x59ba9b['push'](_0x438c('0x29'));if(_0x3de0bc[_0x438c('0xf')][_0x438c('0x29')]==='outbound'){_0x59ba9b[_0x438c('0x2e')](['dialActive','dialMethod']);}}_0x3de0bc[_0x438c('0xf')][_0x438c('0x1f')]=_0x59ba9b['join'](',');}_0x194e2f=qs[_0x438c('0x2c')](_0x389c4a,_0x3de0bc);if(_0x3de0bc[_0x438c('0x33')]['role']==='user'){var _0xbb0402={'params':{'id':_0x3de0bc[_0x438c('0x33')][_0x438c('0x35')]},'query':{'section':_0x169623===_0x438c('0x46')&&_0x3de0bc[_0x438c('0xf')][_0x438c('0x29')]===_0x438c('0x47')?'QueueCampaigns':_[_0x438c('0x45')](_0x169623)+_0x438c('0x48'),'type':_0x3de0bc[_0x438c('0xf')][_0x438c('0x29')],'nolimit':!![],'sort':_0x438c('0x49'),'filter':_0x3de0bc[_0x438c('0xf')][_0x438c('0x4a')]}};_0xbb0402[_0x438c('0xf')]=Object[_0x438c('0x38')](_0xbb0402[_0x438c('0xf')],_0x3de0bc['query']);delete _0xbb0402['query']['id'];return db[_0x438c('0x39')][_0x438c('0x3a')](_0xbb0402);}return db[_0x52df43][_0x438c('0x3b')](_0x194e2f);})[_0x438c('0x16')](function(_0x1d0a19){_0xaeb319[_0x438c('0x9')]=_0x1d0a19['count'];_0x3566c8=_0x1d0a19[_0x438c('0x23')];return rtq[_0x438c('0x4b')](_0x3de0bc,_0x169623);})[_0x438c('0x16')](function(_0xe9c555){_0x14bc39=_0xe9c555[_0x438c('0x23')];return rtq['initializeQueues'](_0x3566c8,_0x14bc39,_0x169623,_0x3de0bc[_0x438c('0xf')][_0x438c('0x29')]);})[_0x438c('0x16')](function(_0x431a48){_0xaeb319[_0x438c('0x23')]=_0x431a48;return _0xaeb319;})[_0x438c('0x16')](respondWithFilteredResult(_0x2609d9,_0x194e2f))['catch'](APIHandleError(_0x2609d9));}; \ No newline at end of file +var _0x6d46=['rows','map','User','rawAttributes','fieldName','type','agent','raw','length','sequelize','literal','FIELD(id,','forEach','push','where','merge','user','role','userProfileId','Agents','online','extraQueryConditions','assign','omit','UserProfile','findAndCountAll','filterAgentAttributes','globalStatus','getAgentStatus','Pause','voice','voiceStatus','Status','sortAgentsByStatus','getRealtimeAgentsQueryFields','pick','catch','resolve','isValidChannel','toLowerCase','startCase','key','name','outbound','join','getOptions','QueueCampaigns','Queues','filter','getRealtimeQueues','initializeQueues','util','../../components/realtime/agents','../../components/realtime/queues','../../config/utils','../../errors/api','APIBadRequestError','handleError','limit','undefined','count','offset','status','set','json','getAgents','getChannels','query','globalStatusFilter','pauseTypeFilter','pause','*pause','then','channel','format','Channel\x20parameter\x20%s\x20is\x20invalid','sort','includes','validateSortParameter','getUpdatedSortOptions','fields','order','getAgentIdsByQueues','getRealtimeAgents'];(function(_0x54bf67,_0x5381e5){var _0x5f18a9=function(_0x5fea82){while(--_0x5fea82){_0x54bf67['push'](_0x54bf67['shift']());}};_0x5f18a9(++_0x5381e5);}(_0x6d46,0x87));var _0x66d4=function(_0x46d0c9,_0x526bfa){_0x46d0c9=_0x46d0c9-0x0;var _0x174506=_0x6d46[_0x46d0c9];return _0x174506;};'use strict';var _=require('lodash');var util=require(_0x66d4('0x0'));var rta=require(_0x66d4('0x1'));var rtq=require(_0x66d4('0x2'));var qs=require('../../components/parsers/qs');var utils=require(_0x66d4('0x3'));var db=require('../../mysqldb')['db'];var APIBadRequestError=require(_0x66d4('0x4'))[_0x66d4('0x5')];var APIHandleError=require(_0x66d4('0x4'))[_0x66d4('0x6')];function respondWithFilteredResult(_0x280cbf,_0x8d8822){return function(_0x127ab1){if(_0x127ab1){var _0x2b73df=typeof _0x8d8822['offset']==='undefined'&&typeof _0x8d8822[_0x66d4('0x7')]===_0x66d4('0x8');var _0x15949b=_0x127ab1[_0x66d4('0x9')];var _0x36c9a8=_0x2b73df?0x0:_0x8d8822[_0x66d4('0xa')];var _0x5cfbf2=_0x2b73df?_0x127ab1[_0x66d4('0x9')]:_0x8d8822[_0x66d4('0xa')]+_0x8d8822['limit'];var _0x20ca13;if(_0x5cfbf2>=_0x15949b){_0x5cfbf2=_0x15949b;_0x20ca13=0xc8;}else{_0x20ca13=0xce;}_0x280cbf[_0x66d4('0xb')](_0x20ca13);return _0x280cbf[_0x66d4('0xc')]('Content-Range',_0x36c9a8+'-'+_0x5cfbf2+'/'+_0x15949b)[_0x66d4('0xd')](_0x127ab1);}return null;};}exports[_0x66d4('0xe')]=function(_0x335c62,_0x2fa18f){var _0x2a8bed={'count':0x0,'rows':[]};var _0x56f57c={};var _0xd91684;var _0x422e3e=utils[_0x66d4('0xf')]();var _0x256920;var _0x5940b;var _0x3c3c70=_0x335c62['query']['globalQueueFilter'];var _0x5288f7=_0x335c62[_0x66d4('0x10')][_0x66d4('0x11')];var _0x4b992e=_0x335c62[_0x66d4('0x10')][_0x66d4('0x12')];var _0x5ae89b=_0x5288f7===_0x66d4('0x13')||_0x5288f7===_0x66d4('0x14')?!![]:![];var _0x59dab7=[];var _0x377c1b;var _0x565112;Promise['resolve']()[_0x66d4('0x15')](function(){if(_0x335c62['query']['channel']){if(!utils['isValidChannel'](_0x335c62[_0x66d4('0x10')][_0x66d4('0x16')])){throw new APIBadRequestError(util[_0x66d4('0x17')](_0x66d4('0x18'),_0x335c62[_0x66d4('0x10')]['channel']));}_0xd91684=_0x335c62[_0x66d4('0x10')][_0x66d4('0x16')]['toLowerCase']();}if(!_0x335c62[_0x66d4('0x10')]['sort']||!_0x335c62['query'][_0x66d4('0x19')][_0x66d4('0x1a')]('globalStatus')){_0x335c62[_0x66d4('0x10')][_0x66d4('0x19')]=rta[_0x66d4('0x1b')](_0x335c62['query']['sort']);return;}var _0x40c934=rta[_0x66d4('0x1c')](_0x335c62[_0x66d4('0x10')][_0x66d4('0x19')]);_0x335c62[_0x66d4('0x10')]['sort']=_0x40c934[_0x66d4('0x1d')]['join'](',');_0x377c1b=_0x40c934[_0x66d4('0x1e')];})[_0x66d4('0x15')](function(){if(!_0x3c3c70){return[];}return rta[_0x66d4('0x1f')](_0x3c3c70,_0xd91684);})[_0x66d4('0x15')](function(_0xb02841){_0x59dab7=_0xb02841;return rta[_0x66d4('0x20')]();})['then'](function(_0x54558c){_0x5940b=_0x54558c[_0x66d4('0x21')];if((!_0x5288f7||_0x5ae89b)&&!_0x377c1b){return _0x59dab7;}if(_0x377c1b&&!_0x5288f7){return rta['getSortedAgentsIdsByStatus'](_0x5940b,_0x59dab7,_0x377c1b);}else{return rta['getAgentIdsByStatus'](_0x5940b,_0x59dab7,_0x5288f7);}})[_0x66d4('0x15')](function(_0x5e8300){_0x59dab7=_0x5e8300;var _0x441657=![];if(_0x59dab7['length']===0x0){if(_0x3c3c70||_0x5288f7){_0x441657=!![];}if(_0x5ae89b){_0x441657=![];}}if(_0x441657){return _0x2a8bed;}var _0x2b5cf0=_[_0x66d4('0x22')](db[_0x66d4('0x23')][_0x66d4('0x24')],function(_0x59cefa){return{'name':_0x59cefa[_0x66d4('0x25')],'type':_0x59cefa[_0x66d4('0x26')]['key']};});_0x335c62[_0x66d4('0x10')]['role']=_0x66d4('0x27');_0x56f57c=qs['getOptions'](_0x2b5cf0,_0x335c62);_0x56f57c[_0x66d4('0x28')]=!![];var _0x42de38=[];if(_0x59dab7[_0x66d4('0x29')]>0x0){_0x42de38['push']({'id':{'$in':_0x59dab7}});if(_0x377c1b&&!_0x5288f7){_0x565112=[db[_0x66d4('0x2a')][_0x66d4('0x2b')](_0x66d4('0x2c')+_0x59dab7+')')];_0x56f57c[_0x66d4('0x1e')]=_0x565112;}}if(_0x5ae89b){_0x422e3e[_0x66d4('0x2d')](function(_0x3bdb4c){var _0x2f588c=!![];if(_0x5288f7===_0x66d4('0x14')&&_0xd91684!==_0x3bdb4c){_0x2f588c=![];}_0x42de38[_0x66d4('0x2e')]({[_0x3bdb4c+'Pause']:_0x2f588c});});if(_0x4b992e){_0x42de38[_0x66d4('0x2e')]({'pauseType':_0x4b992e});}}else if(_0x5288f7){_0x422e3e[_0x66d4('0x2d')](function(_0x4258d){_0x42de38[_0x66d4('0x2e')]({[_0x4258d+'Pause']:![]});});}_0x56f57c[_0x66d4('0x2f')]=_[_0x66d4('0x30')](_0x56f57c[_0x66d4('0x2f')],{'$and':_0x42de38});if(_0x335c62[_0x66d4('0x31')][_0x66d4('0x32')]==='user'){var _0x5f55af={'params':{'id':_0x335c62[_0x66d4('0x31')][_0x66d4('0x33')]},'query':{'section':_0x66d4('0x34'),'role':_0x66d4('0x27'),'raw':!![],'ids':_0x59dab7,'customSorting':_0x565112}};if(_0x335c62[_0x66d4('0x10')][_0x66d4('0x35')]){_0x5f55af['query'][_0x66d4('0x35')]=!![];}if(_0x5ae89b){_0x5f55af[_0x66d4('0x10')][_0x66d4('0x36')]=_0x42de38;}_0x5f55af[_0x66d4('0x10')]=Object[_0x66d4('0x37')](_0x5f55af['query'],_[_0x66d4('0x38')](_0x335c62[_0x66d4('0x10')],'id'));return db[_0x66d4('0x39')]['getResources'](_0x5f55af);}return db[_0x66d4('0x23')][_0x66d4('0x3a')](_0x56f57c);})['then'](function(_0x43dfe6){_0x2a8bed['count']=_0x43dfe6['count'];_0x256920=_0x43dfe6[_0x66d4('0x21')];return _0x256920['map'](function(_0x151b86){var _0x481aa8=_['find'](_0x5940b,['id',_0x151b86['id']]);if(_0x481aa8){var _0x45ba35=rta[_0x66d4('0x3b')](_0x481aa8);_[_0x66d4('0x30')](_0x151b86,_0x45ba35);}_0x151b86[_0x66d4('0x3c')]=rta[_0x66d4('0x3d')](_0x151b86);if(_0x151b86['globalStatus']['includes'](_0x66d4('0x13'))){_0x422e3e[_0x66d4('0x2d')](function(_0x26dfa6){if(_0x151b86[_0x26dfa6+_0x66d4('0x3e')]){if(_0x26dfa6===_0x66d4('0x3f')){if(_0x151b86['voiceStatus']!=='talking'){_0x151b86[_0x66d4('0x40')]=_0x66d4('0x13');}}else{_0x151b86[_0x26dfa6+_0x66d4('0x41')]='pause';}}});}return _0x151b86;});})[_0x66d4('0x15')](function(_0x1b09fe){if(!_0x377c1b||_0x565112){return _0x1b09fe;}return rta[_0x66d4('0x42')](_0x1b09fe,_0x377c1b);})[_0x66d4('0x15')](function(_0xe10537){var _0x4fdd30=rta[_0x66d4('0x43')]();_0x2a8bed[_0x66d4('0x21')]=_0xe10537[_0x66d4('0x22')](function(_0x3424c3){return _[_0x66d4('0x44')](_0x3424c3,_0x4fdd30);});return _0x2a8bed;})['then'](respondWithFilteredResult(_0x2fa18f,_0x56f57c))[_0x66d4('0x45')](APIHandleError(_0x2fa18f));};exports['getQueues']=function(_0x3935b1,_0x29b048){var _0x33def8={'count':0x0,'rows':[]};var _0x15e026={};var _0x1380aa;var _0x9f8bdf;var _0x4a84e6;Promise[_0x66d4('0x46')]()[_0x66d4('0x15')](function(){if(_0x3935b1[_0x66d4('0x10')][_0x66d4('0x16')]){if(!utils[_0x66d4('0x47')](_0x3935b1[_0x66d4('0x10')][_0x66d4('0x16')])){throw new APIBadRequestError(util['format'](_0x66d4('0x18'),_0x3935b1['query'][_0x66d4('0x16')]));}_0x1380aa=_0x3935b1[_0x66d4('0x10')][_0x66d4('0x16')][_0x66d4('0x48')]();}var _0x26605c=_[_0x66d4('0x49')](_0x1380aa)+'Queue';var _0x30a6ff=_[_0x66d4('0x22')](db[_0x26605c][_0x66d4('0x24')],function(_0x574e7d){return{'name':_0x574e7d[_0x66d4('0x25')],'type':_0x574e7d['type'][_0x66d4('0x4a')]};});if(!_0x3935b1['query'][_0x66d4('0x1d')]){var _0x28ddaa=['id',_0x66d4('0x4b')];if(_0x1380aa===_0x66d4('0x3f')){_0x28ddaa[_0x66d4('0x2e')]('type');if(_0x3935b1['query'][_0x66d4('0x26')]===_0x66d4('0x4c')){_0x28ddaa['push'](['dialActive','dialMethod']);}}_0x3935b1[_0x66d4('0x10')][_0x66d4('0x1d')]=_0x28ddaa[_0x66d4('0x4d')](',');}_0x15e026=qs[_0x66d4('0x4e')](_0x30a6ff,_0x3935b1);if(_0x3935b1['user'][_0x66d4('0x32')]===_0x66d4('0x31')){var _0x989e62={'params':{'id':_0x3935b1[_0x66d4('0x31')][_0x66d4('0x33')]},'query':{'section':_0x1380aa==='voice'&&_0x3935b1['query'][_0x66d4('0x26')]===_0x66d4('0x4c')?_0x66d4('0x4f'):_[_0x66d4('0x49')](_0x1380aa)+_0x66d4('0x50'),'type':_0x3935b1[_0x66d4('0x10')][_0x66d4('0x26')],'nolimit':!![],'sort':_0x66d4('0x4b'),'filter':_0x3935b1['query'][_0x66d4('0x51')]}};_0x989e62[_0x66d4('0x10')]=Object['assign'](_0x989e62[_0x66d4('0x10')],_0x3935b1[_0x66d4('0x10')]);delete _0x989e62['query']['id'];return db[_0x66d4('0x39')]['getResources'](_0x989e62);}return db[_0x26605c]['findAndCountAll'](_0x15e026);})[_0x66d4('0x15')](function(_0x3192ed){_0x33def8[_0x66d4('0x9')]=_0x3192ed['count'];_0x9f8bdf=_0x3192ed[_0x66d4('0x21')];return rtq[_0x66d4('0x52')](_0x3935b1,_0x1380aa);})['then'](function(_0x50b2eb){_0x4a84e6=_0x50b2eb[_0x66d4('0x21')];return rtq[_0x66d4('0x53')](_0x9f8bdf,_0x4a84e6,_0x1380aa,_0x3935b1[_0x66d4('0x10')]['type']);})[_0x66d4('0x15')](function(_0x4f3359){_0x33def8['rows']=_0x4f3359;return _0x33def8;})['then'](respondWithFilteredResult(_0x29b048,_0x15e026))[_0x66d4('0x45')](APIHandleError(_0x29b048));}; \ No newline at end of file diff --git a/server/api/reportAgentPreview/index.js b/server/api/reportAgentPreview/index.js index f8bd1e4..aa20ca1 100644 --- a/server/api/reportAgentPreview/index.js +++ b/server/api/reportAgentPreview/index.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x0713=['../../config/environment','exports','path','connect-timeout','express','Router','fs-extra','../../components/interaction/service'];(function(_0x124f5b,_0x5c5b50){var _0x4ebac8=function(_0x45a0d9){while(--_0x45a0d9){_0x124f5b['push'](_0x124f5b['shift']());}};_0x4ebac8(++_0x5c5b50);}(_0x0713,0x1ba));var _0x3071=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0x0713[_0x3dd15e];return _0x231fd0;};'use strict';var multer=require('multer');var util=require('util');var path=require(_0x3071('0x0'));var timeout=require(_0x3071('0x1'));var express=require(_0x3071('0x2'));var router=express[_0x3071('0x3')]();var fs_extra=require(_0x3071('0x4'));var auth=require('../../components/auth/service');var interaction=require(_0x3071('0x5'));var config=require(_0x3071('0x6'));module[_0x3071('0x7')]=router; \ No newline at end of file +var _0xe706=['../../components/interaction/service','../../config/environment','exports','multer','util','path','express','Router','fs-extra','../../components/auth/service'];(function(_0x42aea3,_0x317e06){var _0x19c5e2=function(_0x2f0aa9){while(--_0x2f0aa9){_0x42aea3['push'](_0x42aea3['shift']());}};_0x19c5e2(++_0x317e06);}(_0xe706,0xa3));var _0x6e70=function(_0x2dd970,_0x316ea1){_0x2dd970=_0x2dd970-0x0;var _0x109177=_0xe706[_0x2dd970];return _0x109177;};'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/reportAgentPreview/reportAgentPreview.attributes.js b/server/api/reportAgentPreview/reportAgentPreview.attributes.js index 6b901f7..aedf32d 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 _0xaa37=['STRING','DATE','sequelize','exports','INTEGER'];(function(_0x16b9ed,_0x56517a){var _0x66b1f8=function(_0x1c883){while(--_0x1c883){_0x16b9ed['push'](_0x16b9ed['shift']());}};_0x66b1f8(++_0x56517a);}(_0xaa37,0x1d3));var _0x7aa3=function(_0x42245d,_0x51758f){_0x42245d=_0x42245d-0x0;var _0x4b211a=_0xaa37[_0x42245d];return _0x4b211a;};'use strict';var Sequelize=require(_0x7aa3('0x0'));module[_0x7aa3('0x1')]={'state':{'type':Sequelize[_0x7aa3('0x2')](0x2)},'statedesc':{'type':Sequelize[_0x7aa3('0x3')]},'scheduledat':{'type':Sequelize['DATE']},'uniqueid':{'type':Sequelize[_0x7aa3('0x3')]},'starttime':{'type':Sequelize[_0x7aa3('0x4')]},'responsetime':{'type':Sequelize[_0x7aa3('0x4')]},'ringtime':{'type':Sequelize[_0x7aa3('0x2')],'defaultValue':0x0},'campaign':{'type':Sequelize[_0x7aa3('0x3')]},'campaigntype':{'type':Sequelize[_0x7aa3('0x3')]},'membername':{'type':Sequelize[_0x7aa3('0x3')]}}; \ No newline at end of file +var _0x36f3=['STRING','DATE','exports','INTEGER'];(function(_0x3bd608,_0x4983d3){var _0x538339=function(_0x3f23fd){while(--_0x3f23fd){_0x3bd608['push'](_0x3bd608['shift']());}};_0x538339(++_0x4983d3);}(_0x36f3,0xe6));var _0x336f=function(_0x380b52,_0x5b1752){_0x380b52=_0x380b52-0x0;var _0x2e098c=_0x36f3[_0x380b52];return _0x2e098c;};'use strict';var Sequelize=require('sequelize');module[_0x336f('0x0')]={'state':{'type':Sequelize[_0x336f('0x1')](0x2)},'statedesc':{'type':Sequelize[_0x336f('0x2')]},'scheduledat':{'type':Sequelize[_0x336f('0x3')]},'uniqueid':{'type':Sequelize[_0x336f('0x2')]},'starttime':{'type':Sequelize[_0x336f('0x3')]},'responsetime':{'type':Sequelize[_0x336f('0x3')]},'ringtime':{'type':Sequelize[_0x336f('0x1')],'defaultValue':0x0},'campaign':{'type':Sequelize[_0x336f('0x2')]},'campaigntype':{'type':Sequelize['STRING']},'membername':{'type':Sequelize[_0x336f('0x2')]}}; \ No newline at end of file diff --git a/server/api/reportAgentPreview/reportAgentPreview.model.js b/server/api/reportAgentPreview/reportAgentPreview.model.js index 42995e9..fc0f6b2 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 _0x9366=['define','ReportAgentPreview','report_agent_preview','lodash','util','../../config/logger','bluebird','request-promise','../../config/environment','./reportAgentPreview.attributes','exports'];(function(_0x131205,_0x57575c){var _0x305300=function(_0x179eea){while(--_0x179eea){_0x131205['push'](_0x131205['shift']());}};_0x305300(++_0x57575c);}(_0x9366,0xea));var _0x6936=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0x9366[_0x3dd15e];return _0x231fd0;};'use strict';var _=require(_0x6936('0x0'));var util=require(_0x6936('0x1'));var logger=require(_0x6936('0x2'))('api');var moment=require('moment');var BPromise=require(_0x6936('0x3'));var rp=require(_0x6936('0x4'));var fs=require('fs');var path=require('path');var rimraf=require('rimraf');var config=require(_0x6936('0x5'));var attributes=require(_0x6936('0x6'));module[_0x6936('0x7')]=function(_0x451882,_0x5091e8){return _0x451882[_0x6936('0x8')](_0x6936('0x9'),attributes,{'tableName':_0x6936('0xa'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x52a4=['rimraf','../../config/environment','ReportAgentPreview','lodash','../../config/logger','api','bluebird','path'];(function(_0x17d9e3,_0x1f969c){var _0x14192d=function(_0x159745){while(--_0x159745){_0x17d9e3['push'](_0x17d9e3['shift']());}};_0x14192d(++_0x1f969c);}(_0x52a4,0x1cb));var _0x452a=function(_0x266629,_0x236d12){_0x266629=_0x266629-0x0;var _0x5d4c1e=_0x52a4[_0x266629];return _0x5d4c1e;};'use strict';var _=require(_0x452a('0x0'));var util=require('util');var logger=require(_0x452a('0x1'))(_0x452a('0x2'));var moment=require('moment');var BPromise=require(_0x452a('0x3'));var rp=require('request-promise');var fs=require('fs');var path=require(_0x452a('0x4'));var rimraf=require(_0x452a('0x5'));var config=require(_0x452a('0x6'));var attributes=require('./reportAgentPreview.attributes');module['exports']=function(_0xa885d2,_0xdd2a6a){return _0xa885d2['define'](_0x452a('0x7'),attributes,{'tableName':'report_agent_preview','paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/reportAgentPreview/reportAgentPreview.rpc.js b/server/api/reportAgentPreview/reportAgentPreview.rpc.js index 30f9fb3..bd7dc3d 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 _0x35ed=['randomstring','ioredis','../../mysqldb','../../config/logger','rpc','jayson/promise','client','http','then','debug','ReportAgentPreview,\x20%s,\x20%s,\x20%s','error','code','ReportAgentPreview,\x20%s,\x20%s','message','info','catch','ReportAgentPreview','create','options','CreateReportAgentPreview','util','bluebird'];(function(_0x282bdc,_0x58a652){var _0x2bba07=function(_0x1c0a42){while(--_0x1c0a42){_0x282bdc['push'](_0x282bdc['shift']());}};_0x2bba07(++_0x58a652);}(_0x35ed,0x1ca));var _0xd35e=function(_0x4f0626,_0x35beaf){_0x4f0626=_0x4f0626-0x0;var _0x578349=_0x35ed[_0x4f0626];return _0x578349;};'use strict';var _=require('lodash');var util=require(_0xd35e('0x0'));var moment=require('moment');var BPromise=require(_0xd35e('0x1'));var rs=require(_0xd35e('0x2'));var fs=require('fs');var Redis=require(_0xd35e('0x3'));var db=require(_0xd35e('0x4'))['db'];var utils=require('../../config/utils');var logger=require(_0xd35e('0x5'))(_0xd35e('0x6'));var config=require('../../config/environment');var jayson=require(_0xd35e('0x7'));var client=jayson[_0xd35e('0x8')][_0xd35e('0x9')]({'port':0x232a});function respondWithRpcPromise(_0xce56a5,_0xb13e6a,_0x373f0d){return new BPromise(function(_0x4ec3d5,_0x48f86a){return client['request'](_0xce56a5,_0x373f0d)[_0xd35e('0xa')](function(_0xfb3bab){logger['info']('ReportAgentPreview,\x20%s,\x20%s',_0xb13e6a,'request\x20sent');logger[_0xd35e('0xb')](_0xd35e('0xc'),_0xb13e6a,'request\x20sent',JSON['stringify'](_0xfb3bab));if(_0xfb3bab[_0xd35e('0xd')]){if(_0xfb3bab[_0xd35e('0xd')][_0xd35e('0xe')]===0x1f4){logger[_0xd35e('0xd')](_0xd35e('0xf'),_0xb13e6a,_0xfb3bab[_0xd35e('0xd')][_0xd35e('0x10')]);return _0x48f86a(_0xfb3bab['error'][_0xd35e('0x10')]);}logger[_0xd35e('0xd')](_0xd35e('0xf'),_0xb13e6a,_0xfb3bab[_0xd35e('0xd')][_0xd35e('0x10')]);return _0x4ec3d5(_0xfb3bab['error'][_0xd35e('0x10')]);}else{logger[_0xd35e('0x11')](_0xd35e('0xf'),_0xb13e6a,'request\x20sent');_0x4ec3d5(_0xfb3bab['result'][_0xd35e('0x10')]);}})[_0xd35e('0x12')](function(_0x1bb57f){logger[_0xd35e('0xd')](_0xd35e('0xf'),_0xb13e6a,_0x1bb57f);_0x48f86a(_0x1bb57f);});});}exports['CreateReportAgentPreview']=function(_0x2bc313){var _0x26f379=this;return new Promise(function(_0x1ccc25,_0x24b590){return db[_0xd35e('0x13')][_0xd35e('0x14')](_0x2bc313['body'],{'raw':_0x2bc313[_0xd35e('0x15')]?_0x2bc313['options']['raw']===undefined?!![]:![]:!![]})[_0xd35e('0xa')](function(_0x819cc8){logger[_0xd35e('0x11')](_0xd35e('0x16'),_0x2bc313);logger[_0xd35e('0xb')](_0xd35e('0x16'),_0x2bc313,JSON['stringify'](_0x819cc8));_0x1ccc25(_0x819cc8);})[_0xd35e('0x12')](function(_0x815408){logger[_0xd35e('0xd')]('CreateReportAgentPreview',_0x815408[_0xd35e('0x10')],_0x2bc313);_0x24b590(_0x26f379[_0xd35e('0xd')](0x1f4,_0x815408[_0xd35e('0x10')]));});});}; \ No newline at end of file +var _0x29f7=['util','moment','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','client','http','request','info','ReportAgentPreview,\x20%s,\x20%s,\x20%s','request\x20sent','stringify','code','error','ReportAgentPreview,\x20%s,\x20%s','message','result','catch','CreateReportAgentPreview','ReportAgentPreview','body','options','raw','then','debug','lodash'];(function(_0xd53062,_0x49b13f){var _0x155464=function(_0x36801b){while(--_0x36801b){_0xd53062['push'](_0xd53062['shift']());}};_0x155464(++_0x49b13f);}(_0x29f7,0xca));var _0x729f=function(_0x2ffdb1,_0x9a7e1d){_0x2ffdb1=_0x2ffdb1-0x0;var _0x3d38ad=_0x29f7[_0x2ffdb1];return _0x3d38ad;};'use strict';var _=require(_0x729f('0x0'));var util=require(_0x729f('0x1'));var moment=require(_0x729f('0x2'));var BPromise=require('bluebird');var rs=require('randomstring');var fs=require('fs');var Redis=require('ioredis');var db=require(_0x729f('0x3'))['db'];var utils=require(_0x729f('0x4'));var logger=require(_0x729f('0x5'))(_0x729f('0x6'));var config=require(_0x729f('0x7'));var jayson=require(_0x729f('0x8'));var client=jayson[_0x729f('0x9')][_0x729f('0xa')]({'port':0x232a});function respondWithRpcPromise(_0x1dfaa1,_0x43d212,_0x1563bc){return new BPromise(function(_0x431197,_0x21aee5){return client[_0x729f('0xb')](_0x1dfaa1,_0x1563bc)['then'](function(_0x592ed9){logger[_0x729f('0xc')]('ReportAgentPreview,\x20%s,\x20%s',_0x43d212,'request\x20sent');logger['debug'](_0x729f('0xd'),_0x43d212,_0x729f('0xe'),JSON[_0x729f('0xf')](_0x592ed9));if(_0x592ed9['error']){if(_0x592ed9['error'][_0x729f('0x10')]===0x1f4){logger[_0x729f('0x11')](_0x729f('0x12'),_0x43d212,_0x592ed9[_0x729f('0x11')][_0x729f('0x13')]);return _0x21aee5(_0x592ed9['error'][_0x729f('0x13')]);}logger[_0x729f('0x11')](_0x729f('0x12'),_0x43d212,_0x592ed9[_0x729f('0x11')][_0x729f('0x13')]);return _0x431197(_0x592ed9[_0x729f('0x11')][_0x729f('0x13')]);}else{logger[_0x729f('0xc')](_0x729f('0x12'),_0x43d212,_0x729f('0xe'));_0x431197(_0x592ed9[_0x729f('0x14')][_0x729f('0x13')]);}})[_0x729f('0x15')](function(_0x63d841){logger[_0x729f('0x11')]('ReportAgentPreview,\x20%s,\x20%s',_0x43d212,_0x63d841);_0x21aee5(_0x63d841);});});}exports[_0x729f('0x16')]=function(_0x417e68){var _0x4f8d35=this;return new Promise(function(_0x22c214,_0x39ee12){return db[_0x729f('0x17')]['create'](_0x417e68[_0x729f('0x18')],{'raw':_0x417e68['options']?_0x417e68[_0x729f('0x19')][_0x729f('0x1a')]===undefined?!![]:![]:!![]})[_0x729f('0x1b')](function(_0x4510d6){logger['info'](_0x729f('0x16'),_0x417e68);logger[_0x729f('0x1c')]('CreateReportAgentPreview',_0x417e68,JSON['stringify'](_0x4510d6));_0x22c214(_0x4510d6);})[_0x729f('0x15')](function(_0x13c33e){logger[_0x729f('0x11')](_0x729f('0x16'),_0x13c33e[_0x729f('0x13')],_0x417e68);_0x39ee12(_0x4f8d35['error'](0x1f4,_0x13c33e['message']));});});}; \ No newline at end of file diff --git a/server/api/rpc/index.js b/server/api/rpc/index.js index 45a47d3..6c44476 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 _0x1aff=['showMailQueues','/chat/queues/:id/notify','chat','/chat/queues/:id','showChatQueues','/fax/queues/:id/notify','fax','showFaxQueues','openchannel','/openchannel/queues/:id','showOpenchannelQueues','/sms/queues/:id/notify','sms','whatsapp','showSmsQueues','/whatsapp/queues/:id','showWhatsappQueues','/agents/:id/notify','agentNotify','exports','multer','util','path','Router','../../components/auth/service','./rpc.controller','isAuthenticated','voiceChannels','get','/voice/channels/:uniqueid/mixmonitor','voiceChannelMixMonitor','/voice/channels/:uniqueid/stopmixmonitor','voiceChannelStopMixMonitor','/voice/queues','/chat/queues','/mail/queues','mailAccounts','/openchannel/queues','openchannelQueues','whatsappQueues','/fax/queues','faxQueues','/voice/queues/preview/:id','voiceQueuesPreview','/voice/queues/channels','/voice/queues/channels/:uniqueid','voiceQueuesChannel','/voice/queues/channels/:uniqueid/hangup','voiceQueuesChannelHangup','/voice/queues/channels/:uniqueid/redirect/:exten','voiceQueuesChannelRedirect','showVoiceQueues','put','/voice/queues/:id','/outbound','outboundChannels','/agents','agents','/agents/:id/capacity','agentCapacity','/telephones','telephones','/campaigns','campaigns','chatQueuesWaitingInteractions','/mail/queues/waitinginteractions','mailQueuesWaitingInteractions','/openchannel/queues/waitinginteractions','openchannelQueuesWaitingInteractions','/openchannel/queues/:id/waitinginteractions','/sms/queues/waitinginteractions','smsQueuesWaitingInteractions','/whatsapp/queues/waitinginteractions','whatsappQueuesWaitingInteractions','/fax/queues/waitinginteractions','faxQueuesWaitingInteractions','post','/mail/queues/:id/notify','queueNotify','mail'];(function(_0x5c37a4,_0xe2093){var _0x21697e=function(_0xc242b6){while(--_0xc242b6){_0x5c37a4['push'](_0x5c37a4['shift']());}};_0x21697e(++_0xe2093);}(_0x1aff,0x64));var _0xf1af=function(_0x235fab,_0x2f4a5f){_0x235fab=_0x235fab-0x0;var _0x2384d3=_0x1aff[_0x235fab];return _0x2384d3;};'use strict';var multer=require(_0xf1af('0x0'));var util=require(_0xf1af('0x1'));var path=require(_0xf1af('0x2'));var express=require('express');var router=express[_0xf1af('0x3')]();var auth=require(_0xf1af('0x4'));var controller=require(_0xf1af('0x5'));router['get']('/voice/channels',auth[_0xf1af('0x6')](),controller[_0xf1af('0x7')]);router[_0xf1af('0x8')](_0xf1af('0x9'),auth[_0xf1af('0x6')](),controller[_0xf1af('0xa')]);router[_0xf1af('0x8')](_0xf1af('0xb'),auth[_0xf1af('0x6')](),controller[_0xf1af('0xc')]);router[_0xf1af('0x8')](_0xf1af('0xd'),auth[_0xf1af('0x6')](),controller['voiceQueues']);router[_0xf1af('0x8')](_0xf1af('0xe'),auth['isAuthenticated'](),controller['chatQueues']);router[_0xf1af('0x8')](_0xf1af('0xf'),auth[_0xf1af('0x6')](),controller['mailQueues']);router['get']('/mail/accounts',auth[_0xf1af('0x6')](),controller[_0xf1af('0x10')]);router['get'](_0xf1af('0x11'),auth[_0xf1af('0x6')](),controller[_0xf1af('0x12')]);router[_0xf1af('0x8')]('/sms/queues',auth[_0xf1af('0x6')](),controller['smsQueues']);router[_0xf1af('0x8')]('/whatsapp/queues',auth[_0xf1af('0x6')](),controller[_0xf1af('0x13')]);router[_0xf1af('0x8')](_0xf1af('0x14'),auth['isAuthenticated'](),controller[_0xf1af('0x15')]);router['get'](_0xf1af('0x16'),auth[_0xf1af('0x6')](),controller[_0xf1af('0x17')]);router[_0xf1af('0x8')](_0xf1af('0x18'),auth[_0xf1af('0x6')](),controller['voiceQueuesChannels']);router[_0xf1af('0x8')](_0xf1af('0x19'),auth[_0xf1af('0x6')](),controller[_0xf1af('0x1a')]);router[_0xf1af('0x8')](_0xf1af('0x1b'),auth[_0xf1af('0x6')](),controller[_0xf1af('0x1c')]);router[_0xf1af('0x8')](_0xf1af('0x1d'),auth['isAuthenticated'](),controller[_0xf1af('0x1e')]);router[_0xf1af('0x8')]('/voice/queues/:id',auth[_0xf1af('0x6')](),controller[_0xf1af('0x1f')]);router[_0xf1af('0x20')](_0xf1af('0x21'),auth['isAuthenticated'](),controller['updateVoiceQueue']);router['get'](_0xf1af('0x22'),auth['isAuthenticated'](),controller['outbound']);router[_0xf1af('0x8')]('/outbound/channels',auth[_0xf1af('0x6')](),controller[_0xf1af('0x23')]);router[_0xf1af('0x8')](_0xf1af('0x24'),auth['isAuthenticated'](),controller[_0xf1af('0x25')]);router[_0xf1af('0x20')](_0xf1af('0x26'),auth[_0xf1af('0x6')](),controller[_0xf1af('0x27')]);router[_0xf1af('0x8')](_0xf1af('0x28'),auth['isAuthenticated'](),controller[_0xf1af('0x29')]);router['get']('/trunks',auth[_0xf1af('0x6')](),controller['trunks']);router[_0xf1af('0x8')](_0xf1af('0x2a'),auth[_0xf1af('0x6')](),controller[_0xf1af('0x2b')]);router[_0xf1af('0x8')]('/fax/accounts',auth[_0xf1af('0x6')](),controller['faxAccounts']);router['get']('/chat/queues/waitinginteractions',auth['isAuthenticated'](),controller[_0xf1af('0x2c')]);router['get'](_0xf1af('0x2d'),auth['isAuthenticated'](),controller[_0xf1af('0x2e')]);router[_0xf1af('0x8')](_0xf1af('0x2f'),auth[_0xf1af('0x6')](),controller[_0xf1af('0x30')]);router[_0xf1af('0x8')](_0xf1af('0x31'),auth['isAuthenticated'](),controller['openchannelQueuesIdWaitingInteractions']);router['get'](_0xf1af('0x32'),auth['isAuthenticated'](),controller[_0xf1af('0x33')]);router[_0xf1af('0x8')](_0xf1af('0x34'),auth['isAuthenticated'](),controller[_0xf1af('0x35')]);router[_0xf1af('0x8')](_0xf1af('0x36'),auth[_0xf1af('0x6')](),controller[_0xf1af('0x37')]);router[_0xf1af('0x38')](_0xf1af('0x39'),auth[_0xf1af('0x6')](),controller[_0xf1af('0x3a')](_0xf1af('0x3b')));router[_0xf1af('0x8')]('/mail/queues/:id',auth[_0xf1af('0x6')](),controller[_0xf1af('0x3c')]);router['post'](_0xf1af('0x3d'),auth[_0xf1af('0x6')](),controller[_0xf1af('0x3a')](_0xf1af('0x3e')));router[_0xf1af('0x8')](_0xf1af('0x3f'),auth[_0xf1af('0x6')](),controller[_0xf1af('0x40')]);router['post'](_0xf1af('0x41'),auth[_0xf1af('0x6')](),controller['queueNotify'](_0xf1af('0x42')));router[_0xf1af('0x8')]('/fax/queues/:id',auth[_0xf1af('0x6')](),controller[_0xf1af('0x43')]);router[_0xf1af('0x38')]('/openchannel/queues/:id/notify',auth[_0xf1af('0x6')](),controller[_0xf1af('0x3a')](_0xf1af('0x44')));router['get'](_0xf1af('0x45'),auth[_0xf1af('0x6')](),controller[_0xf1af('0x46')]);router[_0xf1af('0x38')](_0xf1af('0x47'),auth[_0xf1af('0x6')](),controller[_0xf1af('0x3a')](_0xf1af('0x48')));router[_0xf1af('0x38')]('/whatsapp/queues/:id/notify',auth[_0xf1af('0x6')](),controller['queueNotify'](_0xf1af('0x49')));router['get']('/sms/queues/:id',auth[_0xf1af('0x6')](),controller[_0xf1af('0x4a')]);router[_0xf1af('0x8')](_0xf1af('0x4b'),auth[_0xf1af('0x6')](),controller[_0xf1af('0x4c')]);router[_0xf1af('0x38')](_0xf1af('0x4d'),auth[_0xf1af('0x6')](),controller[_0xf1af('0x4e')]);module[_0xf1af('0x4f')]=router; \ No newline at end of file +var _0xd978=['put','updateVoiceQueue','/outbound','outbound','outboundChannels','agents','agentCapacity','/telephones','telephones','/trunks','trunks','campaigns','/fax/accounts','faxAccounts','/chat/queues/waitinginteractions','chatQueuesWaitingInteractions','/mail/queues/waitinginteractions','mailQueuesWaitingInteractions','openchannelQueuesWaitingInteractions','/openchannel/queues/:id/waitinginteractions','openchannelQueuesIdWaitingInteractions','/sms/queues/waitinginteractions','/whatsapp/queues/waitinginteractions','whatsappQueuesWaitingInteractions','/fax/queues/waitinginteractions','faxQueuesWaitingInteractions','post','/mail/queues/:id/notify','queueNotify','mail','/mail/queues/:id','chat','/chat/queues/:id','showChatQueues','/fax/queues/:id','showFaxQueues','/openchannel/queues/:id/notify','openchannel','/openchannel/queues/:id','showOpenchannelQueues','/sms/queues/:id/notify','sms','whatsapp','/sms/queues/:id','showSmsQueues','/whatsapp/queues/:id','showWhatsappQueues','/agents/:id/notify','agentNotify','exports','multer','util','path','express','Router','../../components/auth/service','get','/voice/channels','voiceChannels','/voice/channels/:uniqueid/mixmonitor','isAuthenticated','voiceChannelMixMonitor','/voice/channels/:uniqueid/stopmixmonitor','voiceChannelStopMixMonitor','/voice/queues','chatQueues','/mail/queues','mailQueues','mailAccounts','/openchannel/queues','/sms/queues','/whatsapp/queues','whatsappQueues','/fax/queues','faxQueues','/voice/queues/preview/:id','voiceQueuesPreview','/voice/queues/channels','voiceQueuesChannels','/voice/queues/channels/:uniqueid','voiceQueuesChannel','voiceQueuesChannelHangup','/voice/queues/channels/:uniqueid/redirect/:exten','/voice/queues/:id','showVoiceQueues'];(function(_0x5a0d58,_0x33126c){var _0x4f1a32=function(_0x5eb5a4){while(--_0x5eb5a4){_0x5a0d58['push'](_0x5a0d58['shift']());}};_0x4f1a32(++_0x33126c);}(_0xd978,0x186));var _0x8d97=function(_0x500211,_0x1a0367){_0x500211=_0x500211-0x0;var _0x48f4e0=_0xd978[_0x500211];return _0x48f4e0;};'use strict';var multer=require(_0x8d97('0x0'));var util=require(_0x8d97('0x1'));var path=require(_0x8d97('0x2'));var express=require(_0x8d97('0x3'));var router=express[_0x8d97('0x4')]();var auth=require(_0x8d97('0x5'));var controller=require('./rpc.controller');router[_0x8d97('0x6')](_0x8d97('0x7'),auth['isAuthenticated'](),controller[_0x8d97('0x8')]);router[_0x8d97('0x6')](_0x8d97('0x9'),auth[_0x8d97('0xa')](),controller[_0x8d97('0xb')]);router['get'](_0x8d97('0xc'),auth['isAuthenticated'](),controller[_0x8d97('0xd')]);router[_0x8d97('0x6')](_0x8d97('0xe'),auth[_0x8d97('0xa')](),controller['voiceQueues']);router[_0x8d97('0x6')]('/chat/queues',auth[_0x8d97('0xa')](),controller[_0x8d97('0xf')]);router[_0x8d97('0x6')](_0x8d97('0x10'),auth[_0x8d97('0xa')](),controller[_0x8d97('0x11')]);router['get']('/mail/accounts',auth[_0x8d97('0xa')](),controller[_0x8d97('0x12')]);router[_0x8d97('0x6')](_0x8d97('0x13'),auth['isAuthenticated'](),controller['openchannelQueues']);router[_0x8d97('0x6')](_0x8d97('0x14'),auth['isAuthenticated'](),controller['smsQueues']);router[_0x8d97('0x6')](_0x8d97('0x15'),auth['isAuthenticated'](),controller[_0x8d97('0x16')]);router[_0x8d97('0x6')](_0x8d97('0x17'),auth[_0x8d97('0xa')](),controller[_0x8d97('0x18')]);router['get'](_0x8d97('0x19'),auth['isAuthenticated'](),controller[_0x8d97('0x1a')]);router[_0x8d97('0x6')](_0x8d97('0x1b'),auth['isAuthenticated'](),controller[_0x8d97('0x1c')]);router[_0x8d97('0x6')](_0x8d97('0x1d'),auth[_0x8d97('0xa')](),controller[_0x8d97('0x1e')]);router[_0x8d97('0x6')]('/voice/queues/channels/:uniqueid/hangup',auth[_0x8d97('0xa')](),controller[_0x8d97('0x1f')]);router[_0x8d97('0x6')](_0x8d97('0x20'),auth[_0x8d97('0xa')](),controller['voiceQueuesChannelRedirect']);router[_0x8d97('0x6')](_0x8d97('0x21'),auth[_0x8d97('0xa')](),controller[_0x8d97('0x22')]);router[_0x8d97('0x23')](_0x8d97('0x21'),auth['isAuthenticated'](),controller[_0x8d97('0x24')]);router[_0x8d97('0x6')](_0x8d97('0x25'),auth[_0x8d97('0xa')](),controller[_0x8d97('0x26')]);router[_0x8d97('0x6')]('/outbound/channels',auth[_0x8d97('0xa')](),controller[_0x8d97('0x27')]);router[_0x8d97('0x6')]('/agents',auth['isAuthenticated'](),controller[_0x8d97('0x28')]);router[_0x8d97('0x23')]('/agents/:id/capacity',auth[_0x8d97('0xa')](),controller[_0x8d97('0x29')]);router[_0x8d97('0x6')](_0x8d97('0x2a'),auth[_0x8d97('0xa')](),controller[_0x8d97('0x2b')]);router[_0x8d97('0x6')](_0x8d97('0x2c'),auth[_0x8d97('0xa')](),controller[_0x8d97('0x2d')]);router['get']('/campaigns',auth[_0x8d97('0xa')](),controller[_0x8d97('0x2e')]);router[_0x8d97('0x6')](_0x8d97('0x2f'),auth[_0x8d97('0xa')](),controller[_0x8d97('0x30')]);router[_0x8d97('0x6')](_0x8d97('0x31'),auth[_0x8d97('0xa')](),controller[_0x8d97('0x32')]);router[_0x8d97('0x6')](_0x8d97('0x33'),auth['isAuthenticated'](),controller[_0x8d97('0x34')]);router[_0x8d97('0x6')]('/openchannel/queues/waitinginteractions',auth[_0x8d97('0xa')](),controller[_0x8d97('0x35')]);router[_0x8d97('0x6')](_0x8d97('0x36'),auth[_0x8d97('0xa')](),controller[_0x8d97('0x37')]);router[_0x8d97('0x6')](_0x8d97('0x38'),auth['isAuthenticated'](),controller['smsQueuesWaitingInteractions']);router['get'](_0x8d97('0x39'),auth[_0x8d97('0xa')](),controller[_0x8d97('0x3a')]);router[_0x8d97('0x6')](_0x8d97('0x3b'),auth['isAuthenticated'](),controller[_0x8d97('0x3c')]);router[_0x8d97('0x3d')](_0x8d97('0x3e'),auth[_0x8d97('0xa')](),controller[_0x8d97('0x3f')](_0x8d97('0x40')));router[_0x8d97('0x6')](_0x8d97('0x41'),auth[_0x8d97('0xa')](),controller['showMailQueues']);router[_0x8d97('0x3d')]('/chat/queues/:id/notify',auth[_0x8d97('0xa')](),controller[_0x8d97('0x3f')](_0x8d97('0x42')));router[_0x8d97('0x6')](_0x8d97('0x43'),auth[_0x8d97('0xa')](),controller[_0x8d97('0x44')]);router[_0x8d97('0x3d')]('/fax/queues/:id/notify',auth[_0x8d97('0xa')](),controller[_0x8d97('0x3f')]('fax'));router['get'](_0x8d97('0x45'),auth[_0x8d97('0xa')](),controller[_0x8d97('0x46')]);router[_0x8d97('0x3d')](_0x8d97('0x47'),auth[_0x8d97('0xa')](),controller[_0x8d97('0x3f')](_0x8d97('0x48')));router[_0x8d97('0x6')](_0x8d97('0x49'),auth['isAuthenticated'](),controller[_0x8d97('0x4a')]);router[_0x8d97('0x3d')](_0x8d97('0x4b'),auth[_0x8d97('0xa')](),controller[_0x8d97('0x3f')](_0x8d97('0x4c')));router['post']('/whatsapp/queues/:id/notify',auth[_0x8d97('0xa')](),controller[_0x8d97('0x3f')](_0x8d97('0x4d')));router[_0x8d97('0x6')](_0x8d97('0x4e'),auth[_0x8d97('0xa')](),controller[_0x8d97('0x4f')]);router['get'](_0x8d97('0x50'),auth['isAuthenticated'](),controller[_0x8d97('0x51')]);router[_0x8d97('0x3d')](_0x8d97('0x52'),auth[_0x8d97('0xa')](),controller[_0x8d97('0x53')]);module[_0x8d97('0x54')]=router; \ No newline at end of file diff --git a/server/api/rpc/rpc.controller.js b/server/api/rpc/rpc.controller.js index 3a29788..fd7f5e6 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 _0xd8b0=['showSmsQueues','whatsappQueues','WhatsappQueues','showWhatsappQueues','faxQueues','FaxQueues','FaxAccounts','ChatQueuesWaitingInteractions','mailQueuesWaitingInteractions','MailQueuesWaitingInteractions','openchannelQueuesWaitingInteractions','OpenchannelQueuesWaitingInteractions','openchannelQueuesIdWaitingInteractions','type','map','queue_id','uniq','value','filter','indexOf','smsQueuesWaitingInteractions','whatsappQueuesWaitingInteractions','WhatsappQueuesWaitingInteractions','faxQueuesWaitingInteractions','Website','Account','Queue','findOne','\x20Queue\x20not\x20found','messageId','Interaction','\x20Message\x20not\x20found','update','MessageId','InteractionId','From','QueueId','TransferReport','queueTransferTimeout','*,*,*,*','agentNotify','channel','Channel\x20field\x20is\x20mandatory','capitalize','chat','agent','Message','create','Start','agentTransferTimeout','bluebird','moment','../../config/logger','api','jayson/promise','client','http','request','then','error','code','result','catch','status','json','sendStatus','stack','name','send','isNil','rows','find','voiceChannels','VoiceChannels','query','voiceChannelMixMonitor','VoiceChannelMixMonitor','params','VoiceChannelStopMixMonitor','merge','voiceQueues','VoiceQueues','showVoiceQueues','UpdateVoiceQueue','body','voiceQueuesPreview','VoiceQueuesChannels','voiceQueuesChannel','voiceQueuesChannelHangup','VoiceQueuesChannelHangup','voiceQueuesChannelRedirect','VoiceQueuesChannelRedirect','outbound','Outbound','outboundChannels','OutboundChannels','agents','Agents','agentCapacity','interaction','findAll','user','length','format','updateAttributes','MemberReport','findOrCreate','INTERACTION','interface','SIP/%s','internal','capacity','campaigns','showChatQueues','ChatQueues','MailQueues','showMailQueues','mailAccounts','openchannelQueues','OpenchannelQueues','showOpenchannelQueues','smsQueues','SmsQueues'];(function(_0x48f497,_0x21f019){var _0x57e739=function(_0x80023e){while(--_0x80023e){_0x48f497['push'](_0x48f497['shift']());}};_0x57e739(++_0x21f019);}(_0xd8b0,0xad));var _0x0d8b=function(_0x122ef9,_0x451d2a){_0x122ef9=_0x122ef9-0x0;var _0x42fba0=_0xd8b0[_0x122ef9];return _0x42fba0;};'use strict';var BPromise=require(_0x0d8b('0x0'));var moment=require(_0x0d8b('0x1'));var _=require('lodash');var util=require('util');var db=require('../../mysqldb')['db'];var logger=require(_0x0d8b('0x2'))(_0x0d8b('0x3'));var jayson=require(_0x0d8b('0x4'));var amiClient=jayson[_0x0d8b('0x5')][_0x0d8b('0x6')]({'port':0x232a});var mailClient=jayson['client']['http']({'port':0x232b});var routingClient=jayson[_0x0d8b('0x5')][_0x0d8b('0x6')]({'port':0x232c});function respondWithRpcPromise(_0x39f43a,_0x4a4470,_0x413284){return new BPromise(function(_0x284169,_0x58e4e2){var _0x129310=_0x413284?_0x413284:amiClient;return _0x129310[_0x0d8b('0x7')](_0x39f43a,_0x4a4470)[_0x0d8b('0x8')](function(_0x1f4800){if(_0x1f4800[_0x0d8b('0x9')]){if(_0x1f4800[_0x0d8b('0x9')][_0x0d8b('0xa')]===0x1f4){return _0x58e4e2(_0x1f4800[_0x0d8b('0x9')]['message']);}return _0x284169(_0x1f4800[_0x0d8b('0x9')]['message']);}else{_0x284169(_0x1f4800[_0x0d8b('0xb')]);}})[_0x0d8b('0xc')](function(_0x340cc4){_0x58e4e2(_0x340cc4);});});}function respondWithResult(_0x92cdd8,_0x35a07b){_0x35a07b=_0x35a07b||0xc8;return function(_0x32bb1a){if(_0x32bb1a){return _0x92cdd8[_0x0d8b('0xd')](_0x35a07b)[_0x0d8b('0xe')](_0x32bb1a);}return _0x92cdd8[_0x0d8b('0xf')](0x194);};}function handleError(_0x2ce75e,_0x5ad086){_0x5ad086=_0x5ad086||0x1f4;return function(_0xe65334){logger[_0x0d8b('0x9')](_0xe65334[_0x0d8b('0x10')]);if(_0xe65334['name']){delete _0xe65334[_0x0d8b('0x11')];}_0x2ce75e[_0x0d8b('0xd')](_0x5ad086)[_0x0d8b('0x12')](_0xe65334);};}function findById(_0xe2e167){return function(_0x2cb03c){if(!_['isNil'](_0xe2e167)&&!_[_0x0d8b('0x13')](_0x2cb03c)&&!_[_0x0d8b('0x13')](_0x2cb03c[_0x0d8b('0x14')])){return _[_0x0d8b('0x15')](_0x2cb03c[_0x0d8b('0x14')],function(_0x18dd2d){return _0x18dd2d['id']==_0xe2e167;});}return null;};}exports[_0x0d8b('0x16')]=function(_0xa3612a,_0x4a15bf){return respondWithRpcPromise(_0x0d8b('0x17'),_0xa3612a[_0x0d8b('0x18')])[_0x0d8b('0x8')](respondWithResult(_0x4a15bf,null))[_0x0d8b('0xc')](handleError(_0x4a15bf,null));};exports[_0x0d8b('0x19')]=function(_0x5b709c,_0x393beb){return respondWithRpcPromise(_0x0d8b('0x1a'),_['merge'](_0x5b709c['query'],_0x5b709c[_0x0d8b('0x1b')]))['then'](respondWithResult(_0x393beb,null))['catch'](handleError(_0x393beb,null));};exports['voiceChannelStopMixMonitor']=function(_0x238728,_0x2b924f){return respondWithRpcPromise(_0x0d8b('0x1c'),_[_0x0d8b('0x1d')](_0x238728[_0x0d8b('0x18')],_0x238728[_0x0d8b('0x1b')]))[_0x0d8b('0x8')](respondWithResult(_0x2b924f,null))[_0x0d8b('0xc')](handleError(_0x2b924f,null));};exports[_0x0d8b('0x1e')]=function(_0x5e5bc3,_0xe8bbee){return respondWithRpcPromise(_0x0d8b('0x1f'),_0x5e5bc3['query'])[_0x0d8b('0x8')](respondWithResult(_0xe8bbee,null))['catch'](handleError(_0xe8bbee,null));};exports[_0x0d8b('0x20')]=function(_0x234bdd,_0xa2af02){return respondWithRpcPromise('VoiceQueues',_0x234bdd['query'])[_0x0d8b('0x8')](findById(_0x234bdd[_0x0d8b('0x1b')]['id']))['then'](respondWithResult(_0xa2af02,null))[_0x0d8b('0xc')](handleError(_0xa2af02,null));};exports['updateVoiceQueue']=function(_0x1b2b59,_0x4b59e5){return respondWithRpcPromise(_0x0d8b('0x21'),_['merge'](_0x1b2b59[_0x0d8b('0x22')],_0x1b2b59['params']))[_0x0d8b('0x8')](respondWithResult(_0x4b59e5,null))['catch'](handleError(_0x4b59e5,null));};exports[_0x0d8b('0x23')]=function(_0x106e4c,_0x2c058d){return respondWithRpcPromise('VoiceQueuesPreview',_['merge'](_0x106e4c['query'],_0x106e4c[_0x0d8b('0x1b')]))['then'](respondWithResult(_0x2c058d,null))[_0x0d8b('0xc')](handleError(_0x2c058d,null));};exports['voiceQueuesChannels']=function(_0x5d05fc,_0x36017a){return respondWithRpcPromise(_0x0d8b('0x24'),_0x5d05fc[_0x0d8b('0x18')])[_0x0d8b('0x8')](respondWithResult(_0x36017a,null))[_0x0d8b('0xc')](handleError(_0x36017a,null));};exports[_0x0d8b('0x25')]=function(_0x4a99d3,_0x6f93c7){return respondWithRpcPromise('VoiceQueuesChannel',_[_0x0d8b('0x1d')](_0x4a99d3[_0x0d8b('0x18')],_0x4a99d3['params']))[_0x0d8b('0x8')](respondWithResult(_0x6f93c7,null))[_0x0d8b('0xc')](handleError(_0x6f93c7,null));};exports[_0x0d8b('0x26')]=function(_0x4f2ed2,_0x113318){return respondWithRpcPromise(_0x0d8b('0x27'),_[_0x0d8b('0x1d')](_0x4f2ed2[_0x0d8b('0x18')],_0x4f2ed2[_0x0d8b('0x1b')]))['then'](respondWithResult(_0x113318,null))[_0x0d8b('0xc')](handleError(_0x113318,null));};exports[_0x0d8b('0x28')]=function(_0x5ad0fe,_0x1180ac){return respondWithRpcPromise(_0x0d8b('0x29'),_[_0x0d8b('0x1d')](_0x5ad0fe[_0x0d8b('0x18')],_0x5ad0fe[_0x0d8b('0x1b')]))['then'](respondWithResult(_0x1180ac,null))['catch'](handleError(_0x1180ac,null));};exports[_0x0d8b('0x2a')]=function(_0x5c2c04,_0x531c55){return respondWithRpcPromise(_0x0d8b('0x2b'),_0x5c2c04[_0x0d8b('0x18')])[_0x0d8b('0x8')](respondWithResult(_0x531c55,null))[_0x0d8b('0xc')](handleError(_0x531c55,null));};exports[_0x0d8b('0x2c')]=function(_0x24c789,_0x579324){return respondWithRpcPromise(_0x0d8b('0x2d'),_0x24c789[_0x0d8b('0x18')])[_0x0d8b('0x8')](respondWithResult(_0x579324,null))[_0x0d8b('0xc')](handleError(_0x579324,null));};exports[_0x0d8b('0x2e')]=function(_0x1a39ad,_0xf1680e){var _0x5c980b;return respondWithRpcPromise(_0x0d8b('0x2f'),_0x1a39ad[_0x0d8b('0x18')])[_0x0d8b('0x8')](function(_0x1f196d){_0x5c980b=_0x1f196d;return respondWithRpcPromise('Agents',_0x1a39ad[_0x0d8b('0x18')],routingClient);})['then'](function(_0x37b26c){return _[_0x0d8b('0x1d')]({},_0x37b26c,_0x5c980b);})[_0x0d8b('0x8')](respondWithResult(_0xf1680e,null))[_0x0d8b('0xc')](handleError(_0xf1680e,null));};exports[_0x0d8b('0x30')]=function(_0x3e632e,_0x1ff17d){if(_0x3e632e[_0x0d8b('0x22')]&&_0x3e632e[_0x0d8b('0x22')][_0x0d8b('0x31')]&&_0x3e632e['user']&&_0x3e632e['user']['name']){for(var _0x4d0811 in _0x3e632e['body'][_0x0d8b('0x31')]){if(_0x3e632e[_0x0d8b('0x22')][_0x0d8b('0x31')]['hasOwnProperty'](_0x4d0811)){db['MemberReport'][_0x0d8b('0x32')]({'where':{'channel':_0x4d0811,'membername':_0x3e632e[_0x0d8b('0x33')][_0x0d8b('0x11')],'type':'INTERACTION','exitAt':null,'uniqueid':_0x3e632e[_0x0d8b('0x22')][_0x0d8b('0x31')][_0x4d0811]&&_0x3e632e['body']['interaction'][_0x4d0811][_0x0d8b('0x34')]?{'$notIn':_0x3e632e['body'][_0x0d8b('0x31')][_0x4d0811]}:{'$ne':null}}})['then'](function(_0x53f643){var _0x30ccee=moment()[_0x0d8b('0x35')]('YYYY-MM-DD\x20HH:mm:ss');for(var _0x5ebe8a=0x0,_0x59b8e9=_0x53f643['length'];_0x5ebe8a<_0x59b8e9;_0x5ebe8a+=0x1){_0x53f643[_0x5ebe8a][_0x0d8b('0x36')]({'exitAt':_0x30ccee});}});for(var _0x1e0498=0x0;_0x1e0498<_0x3e632e[_0x0d8b('0x22')]['interaction'][_0x4d0811][_0x0d8b('0x34')];_0x1e0498+=0x1){db[_0x0d8b('0x37')][_0x0d8b('0x38')]({'where':{'channel':_0x4d0811,'membername':_0x3e632e[_0x0d8b('0x33')][_0x0d8b('0x11')],'type':_0x0d8b('0x39'),'uniqueid':_0x3e632e[_0x0d8b('0x22')][_0x0d8b('0x31')][_0x4d0811][_0x1e0498],'exitAt':null},'defaults':{'channel':_0x4d0811,'membername':_0x3e632e[_0x0d8b('0x33')][_0x0d8b('0x11')],'interface':_[_0x0d8b('0x13')](_0x3e632e[_0x0d8b('0x33')][_0x0d8b('0x3a')])?util[_0x0d8b('0x35')](_0x0d8b('0x3b'),_0x3e632e[_0x0d8b('0x33')][_0x0d8b('0x11')]):_0x3e632e[_0x0d8b('0x33')][_0x0d8b('0x3a')],'type':'INTERACTION','enterAt':moment()[_0x0d8b('0x35')]('YYYY-MM-DD\x20HH:mm:ss'),'role':'agent','internal':_0x3e632e[_0x0d8b('0x33')][_0x0d8b('0x3c')],'uniqueid':_0x3e632e[_0x0d8b('0x22')][_0x0d8b('0x31')][_0x4d0811][_0x1e0498]}});}}}}return respondWithRpcPromise('AgentCapacity',{'id':_0x3e632e[_0x0d8b('0x1b')]['id'],'capacity':_0x3e632e[_0x0d8b('0x22')][_0x0d8b('0x3d')]},routingClient)[_0x0d8b('0x8')](respondWithResult(_0x1ff17d,null))[_0x0d8b('0xc')](handleError(_0x1ff17d,null));};exports['telephones']=function(_0x5c0824,_0x4e4d5f){return respondWithRpcPromise('Telephones',_0x5c0824[_0x0d8b('0x18')])[_0x0d8b('0x8')](respondWithResult(_0x4e4d5f,null))['catch'](handleError(_0x4e4d5f,null));};exports['trunks']=function(_0x44c5c1,_0x3d3cb6){return respondWithRpcPromise('Trunks',_0x44c5c1['query'])[_0x0d8b('0x8')](respondWithResult(_0x3d3cb6,null))[_0x0d8b('0xc')](handleError(_0x3d3cb6,null));};exports[_0x0d8b('0x3e')]=function(_0x346c0d,_0x2d5519){return respondWithRpcPromise('Campaigns',_0x346c0d[_0x0d8b('0x18')])[_0x0d8b('0x8')](respondWithResult(_0x2d5519,null))['catch'](handleError(_0x2d5519,null));};exports['chatQueues']=function(_0xf6a773,_0x3f2d95){return respondWithRpcPromise('ChatQueues',_0xf6a773['query'],routingClient)[_0x0d8b('0x8')](respondWithResult(_0x3f2d95,null))[_0x0d8b('0xc')](handleError(_0x3f2d95,null));};exports[_0x0d8b('0x3f')]=function(_0xb58818,_0x4a2989){return respondWithRpcPromise(_0x0d8b('0x40'),_0xb58818['query'],routingClient)['then'](findById(_0xb58818[_0x0d8b('0x1b')]['id']))[_0x0d8b('0x8')](respondWithResult(_0x4a2989,null))['catch'](handleError(_0x4a2989,null));};exports['mailQueues']=function(_0x44ed23,_0x3d7161){return respondWithRpcPromise(_0x0d8b('0x41'),_0x44ed23[_0x0d8b('0x18')],routingClient)[_0x0d8b('0x8')](respondWithResult(_0x3d7161,null))[_0x0d8b('0xc')](handleError(_0x3d7161,null));};exports[_0x0d8b('0x42')]=function(_0x3bead7,_0x5418d8){return respondWithRpcPromise(_0x0d8b('0x41'),_0x3bead7[_0x0d8b('0x18')],routingClient)[_0x0d8b('0x8')](findById(_0x3bead7[_0x0d8b('0x1b')]['id']))[_0x0d8b('0x8')](respondWithResult(_0x5418d8,null))[_0x0d8b('0xc')](handleError(_0x5418d8,null));};exports[_0x0d8b('0x43')]=function(_0x1c78b6,_0x375684){return respondWithRpcPromise('MailAccounts',_0x1c78b6[_0x0d8b('0x18')],mailClient)[_0x0d8b('0x8')](respondWithResult(_0x375684,null))[_0x0d8b('0xc')](handleError(_0x375684,null));};exports[_0x0d8b('0x44')]=function(_0x43ad22,_0x577951){return respondWithRpcPromise(_0x0d8b('0x45'),_0x43ad22[_0x0d8b('0x18')],routingClient)[_0x0d8b('0x8')](respondWithResult(_0x577951,null))[_0x0d8b('0xc')](handleError(_0x577951,null));};exports[_0x0d8b('0x46')]=function(_0x59ada2,_0x4d0e7c){return respondWithRpcPromise(_0x0d8b('0x45'),_0x59ada2[_0x0d8b('0x18')],routingClient)[_0x0d8b('0x8')](findById(_0x59ada2[_0x0d8b('0x1b')]['id']))['then'](respondWithResult(_0x4d0e7c,null))[_0x0d8b('0xc')](handleError(_0x4d0e7c,null));};exports[_0x0d8b('0x47')]=function(_0x8c0bbe,_0x5952dd){return respondWithRpcPromise(_0x0d8b('0x48'),_0x8c0bbe['query'],routingClient)[_0x0d8b('0x8')](respondWithResult(_0x5952dd,null))[_0x0d8b('0xc')](handleError(_0x5952dd,null));};exports[_0x0d8b('0x49')]=function(_0x26ccf0,_0x2b6eb6){return respondWithRpcPromise(_0x0d8b('0x48'),_0x26ccf0['query'],routingClient)[_0x0d8b('0x8')](findById(_0x26ccf0['params']['id']))[_0x0d8b('0x8')](respondWithResult(_0x2b6eb6,null))[_0x0d8b('0xc')](handleError(_0x2b6eb6,null));};exports[_0x0d8b('0x4a')]=function(_0x33a614,_0x48025e){return respondWithRpcPromise(_0x0d8b('0x4b'),_0x33a614[_0x0d8b('0x18')],routingClient)[_0x0d8b('0x8')](respondWithResult(_0x48025e,null))[_0x0d8b('0xc')](handleError(_0x48025e,null));};exports[_0x0d8b('0x4c')]=function(_0x273aef,_0x223fd8){return respondWithRpcPromise(_0x0d8b('0x4b'),_0x273aef[_0x0d8b('0x18')],routingClient)[_0x0d8b('0x8')](findById(_0x273aef['params']['id']))['then'](respondWithResult(_0x223fd8,null))[_0x0d8b('0xc')](handleError(_0x223fd8,null));};exports[_0x0d8b('0x4d')]=function(_0x53e399,_0xb1aa96){return respondWithRpcPromise('FaxQueues',_0x53e399['query'],routingClient)[_0x0d8b('0x8')](respondWithResult(_0xb1aa96,null))[_0x0d8b('0xc')](handleError(_0xb1aa96,null));};exports['showFaxQueues']=function(_0x587128,_0x1900e3){return respondWithRpcPromise(_0x0d8b('0x4e'),_0x587128[_0x0d8b('0x18')],routingClient)[_0x0d8b('0x8')](findById(_0x587128[_0x0d8b('0x1b')]['id']))[_0x0d8b('0x8')](respondWithResult(_0x1900e3,null))[_0x0d8b('0xc')](handleError(_0x1900e3,null));};exports['faxAccounts']=function(_0x1ca60c,_0x5878c2){return respondWithRpcPromise(_0x0d8b('0x4f'),_0x1ca60c[_0x0d8b('0x18')])[_0x0d8b('0x8')](respondWithResult(_0x5878c2,null))[_0x0d8b('0xc')](handleError(_0x5878c2,null));};exports['chatQueuesWaitingInteractions']=function(_0x3fe47d,_0x4a1c4a){return respondWithRpcPromise(_0x0d8b('0x50'),_0x3fe47d[_0x0d8b('0x18')],routingClient)[_0x0d8b('0x8')](respondWithResult(_0x4a1c4a,null))[_0x0d8b('0xc')](handleError(_0x4a1c4a,null));};exports[_0x0d8b('0x51')]=function(_0x2b44e5,_0x3e927c){return respondWithRpcPromise(_0x0d8b('0x52'),_0x2b44e5[_0x0d8b('0x18')],routingClient)[_0x0d8b('0x8')](respondWithResult(_0x3e927c,null))['catch'](handleError(_0x3e927c,null));};exports[_0x0d8b('0x53')]=function(_0x54c28b,_0x3e4121){return respondWithRpcPromise(_0x0d8b('0x54'),_0x54c28b['query'],routingClient)[_0x0d8b('0x8')](respondWithResult(_0x3e4121,null))['catch'](handleError(_0x3e4121,null));};exports[_0x0d8b('0x55')]=function(_0x445a00,_0x24f75){return respondWithRpcPromise(_0x0d8b('0x54'),_0x445a00[_0x0d8b('0x18')],routingClient)[_0x0d8b('0x8')](function(_0x3a073b){if(_0x445a00[_0x0d8b('0x18')]['type']!==undefined){var _0x10eca6=_(_0x3a073b[_0x0d8b('0x14')])['filter']([_0x445a00[_0x0d8b('0x18')][_0x0d8b('0x56')],_0x445a00[_0x0d8b('0x1b')]['id']])[_0x0d8b('0x57')](_0x0d8b('0x58'))[_0x0d8b('0x59')]()[_0x0d8b('0x5a')]();return _0x3a073b[_0x0d8b('0x14')][_0x0d8b('0x5b')](function(_0x5007c0){return _0x10eca6[_0x0d8b('0x5c')](_0x5007c0[_0x0d8b('0x58')])>-0x1;});}else{return _0x3a073b['rows'][_0x0d8b('0x5b')](function(_0x93fc55){return _0x93fc55[_0x0d8b('0x58')]===parseInt(_0x445a00['params']['id']);});}})['then'](respondWithResult(_0x24f75,null))[_0x0d8b('0xc')](handleError(_0x24f75,null));};exports[_0x0d8b('0x5d')]=function(_0x2c55bc,_0x5b76af){return respondWithRpcPromise('SmsQueuesWaitingInteractions',_0x2c55bc[_0x0d8b('0x18')],routingClient)[_0x0d8b('0x8')](respondWithResult(_0x5b76af,null))[_0x0d8b('0xc')](handleError(_0x5b76af,null));};exports[_0x0d8b('0x5e')]=function(_0x2a2b58,_0x3f7895){return respondWithRpcPromise(_0x0d8b('0x5f'),_0x2a2b58[_0x0d8b('0x18')],routingClient)[_0x0d8b('0x8')](respondWithResult(_0x3f7895,null))[_0x0d8b('0xc')](handleError(_0x3f7895,null));};exports[_0x0d8b('0x60')]=function(_0x291336,_0x3b060e){return respondWithRpcPromise('FaxQueuesWaitingInteractions',_0x291336[_0x0d8b('0x18')],routingClient)[_0x0d8b('0x8')](respondWithResult(_0x3b060e,null))['catch'](handleError(_0x3b060e,null));};exports['queueNotify']=function(_0x1a1029){return function(_0x1dad9f,_0x3573b4){var _0x14b1b8,_0x23e2e0;var _0x354208=_['capitalize'](_0x1a1029);var _0x502715=_0x1a1029==='chat'?_0x0d8b('0x61'):_0x0d8b('0x62');return db[_0x354208+_0x0d8b('0x63')][_0x0d8b('0x64')]({'raw':!![],'where':{'id':_0x1dad9f[_0x0d8b('0x1b')]['id']}})[_0x0d8b('0x8')](function(_0x5ef461){if(_[_0x0d8b('0x13')](_0x5ef461)){throw new Error(_0x354208+_0x0d8b('0x65'));}_0x14b1b8=_0x5ef461;return db[_0x354208+'Message'][_0x0d8b('0x64')]({'where':{'id':_0x1dad9f['body'][_0x0d8b('0x66')]},'include':[{'model':db[_0x354208+_0x0d8b('0x67')],'as':_0x0d8b('0x67')},{'model':db[_0x354208+_0x502715],'as':_0x0d8b('0x62')}]});})[_0x0d8b('0x8')](function(_0x8fae7f){if(_[_0x0d8b('0x13')](_0x8fae7f)){throw new Error(_0x354208+_0x0d8b('0x68'));}_0x23e2e0=_0x8fae7f;return _0x8fae7f[_0x0d8b('0x69')]({'read':0x0,'readAt':null,'UserId':null});})[_0x0d8b('0x8')](function(){var _0x276558={'uniqueid':_0x1a1029+'.'+_0x23e2e0['id']+'.'+_0x23e2e0[_0x0d8b('0x67')]['id'],'FromUserId':_0x1dad9f['user']['id'],'type':'queue'};_0x276558[_0x354208+_0x0d8b('0x6a')]=_0x23e2e0['id'];_0x276558[_0x354208+_0x0d8b('0x6b')]=_0x23e2e0[_0x0d8b('0x67')]['id'];_0x276558[_0x0d8b('0x6c')+_0x354208+_0x502715+'Id']=_0x23e2e0[_0x0d8b('0x62')]['id'];_0x276558['To'+_0x354208+_0x0d8b('0x6d')]=_0x14b1b8['id'];return db[_0x354208+_0x0d8b('0x6e')]['create'](_0x276558);})[_0x0d8b('0x8')](function(){return respondWithRpcPromise('Start',{'channel':_0x1a1029,'interaction':_0x23e2e0[_0x0d8b('0x67')],'message':_0x23e2e0,'account':_0x23e2e0['Account'],'applications':[{'id':0x0,'priority':0x1,'app':'queue','appdata':_0x14b1b8[_0x0d8b('0x11')]+','+(_0x23e2e0[_0x0d8b('0x62')][_0x0d8b('0x6f')]||0x12c),'interval':_0x0d8b('0x70')}],'transfer':!![]},routingClient);})[_0x0d8b('0x8')](respondWithResult(_0x3573b4,null))[_0x0d8b('0xc')](handleError(_0x3573b4,null));};};exports[_0x0d8b('0x71')]=function(_0x180eda,_0x35267a){var _0x20a8b6,_0x3a6014;if(_[_0x0d8b('0x13')](_0x180eda['body'][_0x0d8b('0x72')])){throw new Error(_0x0d8b('0x73'));}var _0x8be77c=_0x180eda['body']['channel'];var _0x2db144=_[_0x0d8b('0x74')](_0x8be77c);var _0x36d6ca=_0x8be77c===_0x0d8b('0x75')?_0x0d8b('0x61'):_0x0d8b('0x62');return db['User'][_0x0d8b('0x64')]({'raw':!![],'where':{'id':_0x180eda[_0x0d8b('0x1b')]['id'],'role':_0x0d8b('0x76')}})[_0x0d8b('0x8')](function(_0x4350ee){if(_['isNil'](_0x4350ee)){throw new Error('Agent\x20not\x20found');}_0x20a8b6=_0x4350ee;return db[_0x2db144+_0x0d8b('0x77')][_0x0d8b('0x64')]({'where':{'id':_0x180eda[_0x0d8b('0x22')]['messageId']},'include':[{'model':db[_0x2db144+_0x0d8b('0x67')],'as':_0x0d8b('0x67')},{'model':db[_0x2db144+_0x36d6ca],'as':_0x0d8b('0x62')}]});})['then'](function(_0xb61d4b){if(_[_0x0d8b('0x13')](_0xb61d4b)){throw new Error(_0x2db144+_0x0d8b('0x68'));}_0x3a6014=_0xb61d4b;return _0xb61d4b[_0x0d8b('0x69')]({'read':0x0,'readAt':null,'UserId':null});})[_0x0d8b('0x8')](function(){var _0x150e9f={'uniqueid':_0x8be77c+'.'+_0x3a6014['id']+'.'+_0x3a6014[_0x0d8b('0x67')]['id'],'FromUserId':_0x180eda[_0x0d8b('0x33')]['id'],'type':_0x0d8b('0x76'),'ToUserId':_0x20a8b6['id']};_0x150e9f[_0x2db144+'MessageId']=_0x3a6014['id'];_0x150e9f[_0x2db144+_0x0d8b('0x6b')]=_0x3a6014[_0x0d8b('0x67')]['id'];_0x150e9f[_0x0d8b('0x6c')+_0x2db144+_0x36d6ca+'Id']=_0x3a6014[_0x0d8b('0x62')]['id'];return db[_0x2db144+_0x0d8b('0x6e')][_0x0d8b('0x78')](_0x150e9f);})[_0x0d8b('0x8')](function(){return respondWithRpcPromise(_0x0d8b('0x79'),{'channel':_0x8be77c,'interaction':_0x3a6014[_0x0d8b('0x67')],'message':_0x3a6014,'account':_0x3a6014['Account'],'applications':[{'id':0x0,'priority':0x1,'app':'agent','appdata':_0x20a8b6[_0x0d8b('0x11')]+','+(_0x3a6014[_0x0d8b('0x62')][_0x0d8b('0x7a')]||0x12c),'interval':_0x0d8b('0x70')}],'transfer':!![]},routingClient);})['then'](respondWithResult(_0x35267a,null))[_0x0d8b('0xc')](handleError(_0x35267a,null));}; \ No newline at end of file +var _0xe706=['indexOf','queue_id','smsQueuesWaitingInteractions','SmsQueuesWaitingInteractions','whatsappQueuesWaitingInteractions','WhatsappQueuesWaitingInteractions','faxQueuesWaitingInteractions','FaxQueuesWaitingInteractions','queueNotify','capitalize','Website','Queue','\x20Queue\x20not\x20found','Message','findOne','Interaction','Account','update','queue','MessageId','InteractionId','TransferReport','*,*,*,*','agentNotify','channel','Channel\x20field\x20is\x20mandatory','chat','User','Agent\x20not\x20found','messageId','\x20Message\x20not\x20found','From','create','Start','agentTransferTimeout','bluebird','moment','lodash','../../mysqldb','../../config/logger','api','jayson/promise','client','http','request','then','error','code','message','result','catch','status','json','name','send','isNil','rows','VoiceChannels','query','voiceChannelMixMonitor','VoiceChannelMixMonitor','merge','params','VoiceChannelStopMixMonitor','voiceQueues','VoiceQueues','showVoiceQueues','UpdateVoiceQueue','body','voiceQueuesPreview','VoiceQueuesPreview','voiceQueuesChannels','VoiceQueuesChannels','VoiceQueuesChannel','voiceQueuesChannelHangup','VoiceQueuesChannelHangup','voiceQueuesChannelRedirect','VoiceQueuesChannelRedirect','Outbound','outboundChannels','OutboundChannels','agents','Agents','agentCapacity','user','hasOwnProperty','MemberReport','findAll','INTERACTION','interaction','length','format','YYYY-MM-DD\x20HH:mm:ss','updateAttributes','SIP/%s','interface','agent','internal','capacity','Telephones','trunks','Trunks','campaigns','Campaigns','chatQueues','ChatQueues','showChatQueues','mailQueues','MailQueues','showMailQueues','OpenchannelQueues','showOpenchannelQueues','showSmsQueues','SmsQueues','whatsappQueues','WhatsappQueues','faxQueues','showFaxQueues','faxAccounts','FaxAccounts','chatQueuesWaitingInteractions','ChatQueuesWaitingInteractions','mailQueuesWaitingInteractions','openchannelQueuesWaitingInteractions','OpenchannelQueuesWaitingInteractions','type','filter','uniq'];(function(_0x4ad3dc,_0x1413a6){var _0x318b01=function(_0x49ff2f){while(--_0x49ff2f){_0x4ad3dc['push'](_0x4ad3dc['shift']());}};_0x318b01(++_0x1413a6);}(_0xe706,0xa3));var _0x6e70=function(_0x1d3577,_0x17a32e){_0x1d3577=_0x1d3577-0x0;var _0x277d9a=_0xe706[_0x1d3577];return _0x277d9a;};'use strict';var BPromise=require(_0x6e70('0x0'));var moment=require(_0x6e70('0x1'));var _=require(_0x6e70('0x2'));var util=require('util');var db=require(_0x6e70('0x3'))['db'];var logger=require(_0x6e70('0x4'))(_0x6e70('0x5'));var jayson=require(_0x6e70('0x6'));var amiClient=jayson[_0x6e70('0x7')][_0x6e70('0x8')]({'port':0x232a});var mailClient=jayson[_0x6e70('0x7')][_0x6e70('0x8')]({'port':0x232b});var routingClient=jayson[_0x6e70('0x7')][_0x6e70('0x8')]({'port':0x232c});function respondWithRpcPromise(_0x36357b,_0x293ce7,_0x45a2d4){return new BPromise(function(_0x188ed3,_0x3c4843){var _0x449b48=_0x45a2d4?_0x45a2d4:amiClient;return _0x449b48[_0x6e70('0x9')](_0x36357b,_0x293ce7)[_0x6e70('0xa')](function(_0x100eb7){if(_0x100eb7[_0x6e70('0xb')]){if(_0x100eb7[_0x6e70('0xb')][_0x6e70('0xc')]===0x1f4){return _0x3c4843(_0x100eb7[_0x6e70('0xb')][_0x6e70('0xd')]);}return _0x188ed3(_0x100eb7['error']['message']);}else{_0x188ed3(_0x100eb7[_0x6e70('0xe')]);}})[_0x6e70('0xf')](function(_0x18cf27){_0x3c4843(_0x18cf27);});});}function respondWithResult(_0x27dd9b,_0x3b38f3){_0x3b38f3=_0x3b38f3||0xc8;return function(_0x310eb7){if(_0x310eb7){return _0x27dd9b[_0x6e70('0x10')](_0x3b38f3)[_0x6e70('0x11')](_0x310eb7);}return _0x27dd9b['sendStatus'](0x194);};}function handleError(_0x52737e,_0x48bc72){_0x48bc72=_0x48bc72||0x1f4;return function(_0x257e81){logger['error'](_0x257e81['stack']);if(_0x257e81[_0x6e70('0x12')]){delete _0x257e81[_0x6e70('0x12')];}_0x52737e['status'](_0x48bc72)[_0x6e70('0x13')](_0x257e81);};}function findById(_0x5c3fe7){return function(_0x2efc0f){if(!_[_0x6e70('0x14')](_0x5c3fe7)&&!_['isNil'](_0x2efc0f)&&!_['isNil'](_0x2efc0f[_0x6e70('0x15')])){return _['find'](_0x2efc0f[_0x6e70('0x15')],function(_0x173afe){return _0x173afe['id']==_0x5c3fe7;});}return null;};}exports['voiceChannels']=function(_0x497d61,_0xc238ba){return respondWithRpcPromise(_0x6e70('0x16'),_0x497d61[_0x6e70('0x17')])[_0x6e70('0xa')](respondWithResult(_0xc238ba,null))[_0x6e70('0xf')](handleError(_0xc238ba,null));};exports[_0x6e70('0x18')]=function(_0x1b2453,_0x44a49f){return respondWithRpcPromise(_0x6e70('0x19'),_[_0x6e70('0x1a')](_0x1b2453['query'],_0x1b2453[_0x6e70('0x1b')]))[_0x6e70('0xa')](respondWithResult(_0x44a49f,null))[_0x6e70('0xf')](handleError(_0x44a49f,null));};exports['voiceChannelStopMixMonitor']=function(_0x3ccd87,_0xa5d49){return respondWithRpcPromise(_0x6e70('0x1c'),_['merge'](_0x3ccd87[_0x6e70('0x17')],_0x3ccd87['params']))['then'](respondWithResult(_0xa5d49,null))['catch'](handleError(_0xa5d49,null));};exports[_0x6e70('0x1d')]=function(_0x19c5ae,_0x51d292){return respondWithRpcPromise(_0x6e70('0x1e'),_0x19c5ae[_0x6e70('0x17')])['then'](respondWithResult(_0x51d292,null))[_0x6e70('0xf')](handleError(_0x51d292,null));};exports[_0x6e70('0x1f')]=function(_0x2bb231,_0x4a67ac){return respondWithRpcPromise('VoiceQueues',_0x2bb231[_0x6e70('0x17')])[_0x6e70('0xa')](findById(_0x2bb231[_0x6e70('0x1b')]['id']))[_0x6e70('0xa')](respondWithResult(_0x4a67ac,null))[_0x6e70('0xf')](handleError(_0x4a67ac,null));};exports['updateVoiceQueue']=function(_0x1952ea,_0x406f29){return respondWithRpcPromise(_0x6e70('0x20'),_[_0x6e70('0x1a')](_0x1952ea[_0x6e70('0x21')],_0x1952ea[_0x6e70('0x1b')]))[_0x6e70('0xa')](respondWithResult(_0x406f29,null))[_0x6e70('0xf')](handleError(_0x406f29,null));};exports[_0x6e70('0x22')]=function(_0x3a5d30,_0x4b1229){return respondWithRpcPromise(_0x6e70('0x23'),_['merge'](_0x3a5d30[_0x6e70('0x17')],_0x3a5d30['params']))[_0x6e70('0xa')](respondWithResult(_0x4b1229,null))[_0x6e70('0xf')](handleError(_0x4b1229,null));};exports[_0x6e70('0x24')]=function(_0x56f6f7,_0x38c40d){return respondWithRpcPromise(_0x6e70('0x25'),_0x56f6f7['query'])[_0x6e70('0xa')](respondWithResult(_0x38c40d,null))[_0x6e70('0xf')](handleError(_0x38c40d,null));};exports['voiceQueuesChannel']=function(_0x10d8f6,_0x3665a1){return respondWithRpcPromise(_0x6e70('0x26'),_[_0x6e70('0x1a')](_0x10d8f6[_0x6e70('0x17')],_0x10d8f6[_0x6e70('0x1b')]))[_0x6e70('0xa')](respondWithResult(_0x3665a1,null))[_0x6e70('0xf')](handleError(_0x3665a1,null));};exports[_0x6e70('0x27')]=function(_0x419a41,_0x4d32d8){return respondWithRpcPromise(_0x6e70('0x28'),_['merge'](_0x419a41[_0x6e70('0x17')],_0x419a41[_0x6e70('0x1b')]))[_0x6e70('0xa')](respondWithResult(_0x4d32d8,null))[_0x6e70('0xf')](handleError(_0x4d32d8,null));};exports[_0x6e70('0x29')]=function(_0x989b80,_0x2440be){return respondWithRpcPromise(_0x6e70('0x2a'),_[_0x6e70('0x1a')](_0x989b80[_0x6e70('0x17')],_0x989b80[_0x6e70('0x1b')]))[_0x6e70('0xa')](respondWithResult(_0x2440be,null))[_0x6e70('0xf')](handleError(_0x2440be,null));};exports['outbound']=function(_0x5446a2,_0x5424eb){return respondWithRpcPromise(_0x6e70('0x2b'),_0x5446a2[_0x6e70('0x17')])[_0x6e70('0xa')](respondWithResult(_0x5424eb,null))[_0x6e70('0xf')](handleError(_0x5424eb,null));};exports[_0x6e70('0x2c')]=function(_0x3bdd87,_0x572a71){return respondWithRpcPromise(_0x6e70('0x2d'),_0x3bdd87[_0x6e70('0x17')])[_0x6e70('0xa')](respondWithResult(_0x572a71,null))[_0x6e70('0xf')](handleError(_0x572a71,null));};exports[_0x6e70('0x2e')]=function(_0x37bf46,_0x246e61){var _0x16fc7d;return respondWithRpcPromise('Agents',_0x37bf46[_0x6e70('0x17')])[_0x6e70('0xa')](function(_0x22fce9){_0x16fc7d=_0x22fce9;return respondWithRpcPromise(_0x6e70('0x2f'),_0x37bf46[_0x6e70('0x17')],routingClient);})[_0x6e70('0xa')](function(_0x21b0e7){return _['merge']({},_0x21b0e7,_0x16fc7d);})['then'](respondWithResult(_0x246e61,null))['catch'](handleError(_0x246e61,null));};exports[_0x6e70('0x30')]=function(_0x2b63cc,_0x83847b){if(_0x2b63cc[_0x6e70('0x21')]&&_0x2b63cc[_0x6e70('0x21')]['interaction']&&_0x2b63cc[_0x6e70('0x31')]&&_0x2b63cc[_0x6e70('0x31')][_0x6e70('0x12')]){for(var _0x52b197 in _0x2b63cc['body']['interaction']){if(_0x2b63cc[_0x6e70('0x21')]['interaction'][_0x6e70('0x32')](_0x52b197)){db[_0x6e70('0x33')][_0x6e70('0x34')]({'where':{'channel':_0x52b197,'membername':_0x2b63cc[_0x6e70('0x31')]['name'],'type':_0x6e70('0x35'),'exitAt':null,'uniqueid':_0x2b63cc['body'][_0x6e70('0x36')][_0x52b197]&&_0x2b63cc[_0x6e70('0x21')][_0x6e70('0x36')][_0x52b197][_0x6e70('0x37')]?{'$notIn':_0x2b63cc['body'][_0x6e70('0x36')][_0x52b197]}:{'$ne':null}}})[_0x6e70('0xa')](function(_0x3d39c3){var _0xac87d6=moment()[_0x6e70('0x38')](_0x6e70('0x39'));for(var _0x3d9c5=0x0,_0x552e7e=_0x3d39c3[_0x6e70('0x37')];_0x3d9c5<_0x552e7e;_0x3d9c5+=0x1){_0x3d39c3[_0x3d9c5][_0x6e70('0x3a')]({'exitAt':_0xac87d6});}});for(var _0x10de2a=0x0;_0x10de2a<_0x2b63cc[_0x6e70('0x21')][_0x6e70('0x36')][_0x52b197][_0x6e70('0x37')];_0x10de2a+=0x1){db[_0x6e70('0x33')]['findOrCreate']({'where':{'channel':_0x52b197,'membername':_0x2b63cc[_0x6e70('0x31')]['name'],'type':_0x6e70('0x35'),'uniqueid':_0x2b63cc[_0x6e70('0x21')]['interaction'][_0x52b197][_0x10de2a],'exitAt':null},'defaults':{'channel':_0x52b197,'membername':_0x2b63cc['user'][_0x6e70('0x12')],'interface':_[_0x6e70('0x14')](_0x2b63cc[_0x6e70('0x31')]['interface'])?util['format'](_0x6e70('0x3b'),_0x2b63cc[_0x6e70('0x31')][_0x6e70('0x12')]):_0x2b63cc[_0x6e70('0x31')][_0x6e70('0x3c')],'type':_0x6e70('0x35'),'enterAt':moment()['format'](_0x6e70('0x39')),'role':_0x6e70('0x3d'),'internal':_0x2b63cc[_0x6e70('0x31')][_0x6e70('0x3e')],'uniqueid':_0x2b63cc[_0x6e70('0x21')]['interaction'][_0x52b197][_0x10de2a]}});}}}}return respondWithRpcPromise('AgentCapacity',{'id':_0x2b63cc[_0x6e70('0x1b')]['id'],'capacity':_0x2b63cc[_0x6e70('0x21')][_0x6e70('0x3f')]},routingClient)[_0x6e70('0xa')](respondWithResult(_0x83847b,null))[_0x6e70('0xf')](handleError(_0x83847b,null));};exports['telephones']=function(_0x41bd0b,_0x232366){return respondWithRpcPromise(_0x6e70('0x40'),_0x41bd0b[_0x6e70('0x17')])[_0x6e70('0xa')](respondWithResult(_0x232366,null))['catch'](handleError(_0x232366,null));};exports[_0x6e70('0x41')]=function(_0x1dd242,_0x2c20d3){return respondWithRpcPromise(_0x6e70('0x42'),_0x1dd242[_0x6e70('0x17')])[_0x6e70('0xa')](respondWithResult(_0x2c20d3,null))['catch'](handleError(_0x2c20d3,null));};exports[_0x6e70('0x43')]=function(_0x8d425d,_0x5c2396){return respondWithRpcPromise(_0x6e70('0x44'),_0x8d425d[_0x6e70('0x17')])['then'](respondWithResult(_0x5c2396,null))[_0x6e70('0xf')](handleError(_0x5c2396,null));};exports[_0x6e70('0x45')]=function(_0x2134c4,_0x46d536){return respondWithRpcPromise(_0x6e70('0x46'),_0x2134c4['query'],routingClient)[_0x6e70('0xa')](respondWithResult(_0x46d536,null))[_0x6e70('0xf')](handleError(_0x46d536,null));};exports[_0x6e70('0x47')]=function(_0x13be81,_0x1c02d7){return respondWithRpcPromise(_0x6e70('0x46'),_0x13be81[_0x6e70('0x17')],routingClient)[_0x6e70('0xa')](findById(_0x13be81[_0x6e70('0x1b')]['id']))[_0x6e70('0xa')](respondWithResult(_0x1c02d7,null))[_0x6e70('0xf')](handleError(_0x1c02d7,null));};exports[_0x6e70('0x48')]=function(_0xb8f78,_0x1fd9a6){return respondWithRpcPromise(_0x6e70('0x49'),_0xb8f78[_0x6e70('0x17')],routingClient)[_0x6e70('0xa')](respondWithResult(_0x1fd9a6,null))[_0x6e70('0xf')](handleError(_0x1fd9a6,null));};exports[_0x6e70('0x4a')]=function(_0x1c7dca,_0x4c6aab){return respondWithRpcPromise(_0x6e70('0x49'),_0x1c7dca[_0x6e70('0x17')],routingClient)[_0x6e70('0xa')](findById(_0x1c7dca[_0x6e70('0x1b')]['id']))[_0x6e70('0xa')](respondWithResult(_0x4c6aab,null))[_0x6e70('0xf')](handleError(_0x4c6aab,null));};exports['mailAccounts']=function(_0x42bd85,_0x6cabf0){return respondWithRpcPromise('MailAccounts',_0x42bd85[_0x6e70('0x17')],mailClient)[_0x6e70('0xa')](respondWithResult(_0x6cabf0,null))[_0x6e70('0xf')](handleError(_0x6cabf0,null));};exports['openchannelQueues']=function(_0x51f268,_0x2f9be4){return respondWithRpcPromise(_0x6e70('0x4b'),_0x51f268[_0x6e70('0x17')],routingClient)[_0x6e70('0xa')](respondWithResult(_0x2f9be4,null))[_0x6e70('0xf')](handleError(_0x2f9be4,null));};exports[_0x6e70('0x4c')]=function(_0x30cd88,_0x57bfe5){return respondWithRpcPromise('OpenchannelQueues',_0x30cd88[_0x6e70('0x17')],routingClient)[_0x6e70('0xa')](findById(_0x30cd88[_0x6e70('0x1b')]['id']))[_0x6e70('0xa')](respondWithResult(_0x57bfe5,null))['catch'](handleError(_0x57bfe5,null));};exports['smsQueues']=function(_0x2e972b,_0x4e5545){return respondWithRpcPromise('SmsQueues',_0x2e972b['query'],routingClient)[_0x6e70('0xa')](respondWithResult(_0x4e5545,null))['catch'](handleError(_0x4e5545,null));};exports[_0x6e70('0x4d')]=function(_0x23900b,_0x3b4da0){return respondWithRpcPromise(_0x6e70('0x4e'),_0x23900b[_0x6e70('0x17')],routingClient)[_0x6e70('0xa')](findById(_0x23900b[_0x6e70('0x1b')]['id']))[_0x6e70('0xa')](respondWithResult(_0x3b4da0,null))['catch'](handleError(_0x3b4da0,null));};exports[_0x6e70('0x4f')]=function(_0x6a560f,_0x22c836){return respondWithRpcPromise(_0x6e70('0x50'),_0x6a560f[_0x6e70('0x17')],routingClient)['then'](respondWithResult(_0x22c836,null))['catch'](handleError(_0x22c836,null));};exports['showWhatsappQueues']=function(_0x1bb338,_0xd91b9){return respondWithRpcPromise(_0x6e70('0x50'),_0x1bb338['query'],routingClient)['then'](findById(_0x1bb338[_0x6e70('0x1b')]['id']))[_0x6e70('0xa')](respondWithResult(_0xd91b9,null))[_0x6e70('0xf')](handleError(_0xd91b9,null));};exports[_0x6e70('0x51')]=function(_0x2285f1,_0x32b884){return respondWithRpcPromise('FaxQueues',_0x2285f1[_0x6e70('0x17')],routingClient)[_0x6e70('0xa')](respondWithResult(_0x32b884,null))[_0x6e70('0xf')](handleError(_0x32b884,null));};exports[_0x6e70('0x52')]=function(_0x515c0c,_0xce964b){return respondWithRpcPromise('FaxQueues',_0x515c0c['query'],routingClient)[_0x6e70('0xa')](findById(_0x515c0c[_0x6e70('0x1b')]['id']))[_0x6e70('0xa')](respondWithResult(_0xce964b,null))[_0x6e70('0xf')](handleError(_0xce964b,null));};exports[_0x6e70('0x53')]=function(_0x2be0fc,_0x4b5b19){return respondWithRpcPromise(_0x6e70('0x54'),_0x2be0fc[_0x6e70('0x17')])[_0x6e70('0xa')](respondWithResult(_0x4b5b19,null))[_0x6e70('0xf')](handleError(_0x4b5b19,null));};exports[_0x6e70('0x55')]=function(_0x13c092,_0x363722){return respondWithRpcPromise(_0x6e70('0x56'),_0x13c092[_0x6e70('0x17')],routingClient)[_0x6e70('0xa')](respondWithResult(_0x363722,null))['catch'](handleError(_0x363722,null));};exports[_0x6e70('0x57')]=function(_0x303c5a,_0x577c3b){return respondWithRpcPromise('MailQueuesWaitingInteractions',_0x303c5a['query'],routingClient)[_0x6e70('0xa')](respondWithResult(_0x577c3b,null))[_0x6e70('0xf')](handleError(_0x577c3b,null));};exports[_0x6e70('0x58')]=function(_0x14bb74,_0x5a3dcb){return respondWithRpcPromise('OpenchannelQueuesWaitingInteractions',_0x14bb74['query'],routingClient)[_0x6e70('0xa')](respondWithResult(_0x5a3dcb,null))[_0x6e70('0xf')](handleError(_0x5a3dcb,null));};exports['openchannelQueuesIdWaitingInteractions']=function(_0x58666a,_0x1c7c5f){return respondWithRpcPromise(_0x6e70('0x59'),_0x58666a[_0x6e70('0x17')],routingClient)[_0x6e70('0xa')](function(_0x44bf96){if(_0x58666a[_0x6e70('0x17')][_0x6e70('0x5a')]!==undefined){var _0x3650e9=_(_0x44bf96[_0x6e70('0x15')])[_0x6e70('0x5b')]([_0x58666a[_0x6e70('0x17')][_0x6e70('0x5a')],_0x58666a[_0x6e70('0x1b')]['id']])['map']('queue_id')[_0x6e70('0x5c')]()['value']();return _0x44bf96[_0x6e70('0x15')]['filter'](function(_0x5b5471){return _0x3650e9[_0x6e70('0x5d')](_0x5b5471['queue_id'])>-0x1;});}else{return _0x44bf96['rows'][_0x6e70('0x5b')](function(_0x21e4c2){return _0x21e4c2[_0x6e70('0x5e')]===parseInt(_0x58666a['params']['id']);});}})['then'](respondWithResult(_0x1c7c5f,null))['catch'](handleError(_0x1c7c5f,null));};exports[_0x6e70('0x5f')]=function(_0x512b0a,_0x2e8ed3){return respondWithRpcPromise(_0x6e70('0x60'),_0x512b0a[_0x6e70('0x17')],routingClient)[_0x6e70('0xa')](respondWithResult(_0x2e8ed3,null))[_0x6e70('0xf')](handleError(_0x2e8ed3,null));};exports[_0x6e70('0x61')]=function(_0x214a8f,_0x50046a){return respondWithRpcPromise(_0x6e70('0x62'),_0x214a8f[_0x6e70('0x17')],routingClient)[_0x6e70('0xa')](respondWithResult(_0x50046a,null))['catch'](handleError(_0x50046a,null));};exports[_0x6e70('0x63')]=function(_0x227d94,_0x11a615){return respondWithRpcPromise(_0x6e70('0x64'),_0x227d94[_0x6e70('0x17')],routingClient)[_0x6e70('0xa')](respondWithResult(_0x11a615,null))[_0x6e70('0xf')](handleError(_0x11a615,null));};exports[_0x6e70('0x65')]=function(_0x461ec0){return function(_0x48f6fd,_0x463eed){var _0x39e6db,_0x53acc8;var _0x252f07=_[_0x6e70('0x66')](_0x461ec0);var _0x51be27=_0x461ec0==='chat'?_0x6e70('0x67'):'Account';return db[_0x252f07+_0x6e70('0x68')]['findOne']({'raw':!![],'where':{'id':_0x48f6fd[_0x6e70('0x1b')]['id']}})[_0x6e70('0xa')](function(_0x106f32){if(_[_0x6e70('0x14')](_0x106f32)){throw new Error(_0x252f07+_0x6e70('0x69'));}_0x39e6db=_0x106f32;return db[_0x252f07+_0x6e70('0x6a')][_0x6e70('0x6b')]({'where':{'id':_0x48f6fd['body']['messageId']},'include':[{'model':db[_0x252f07+_0x6e70('0x6c')],'as':'Interaction'},{'model':db[_0x252f07+_0x51be27],'as':_0x6e70('0x6d')}]});})[_0x6e70('0xa')](function(_0x28e5b1){if(_[_0x6e70('0x14')](_0x28e5b1)){throw new Error(_0x252f07+'\x20Message\x20not\x20found');}_0x53acc8=_0x28e5b1;return _0x28e5b1[_0x6e70('0x6e')]({'read':0x0,'readAt':null,'UserId':null});})['then'](function(){var _0x260dfa={'uniqueid':_0x461ec0+'.'+_0x53acc8['id']+'.'+_0x53acc8[_0x6e70('0x6c')]['id'],'FromUserId':_0x48f6fd[_0x6e70('0x31')]['id'],'type':_0x6e70('0x6f')};_0x260dfa[_0x252f07+_0x6e70('0x70')]=_0x53acc8['id'];_0x260dfa[_0x252f07+_0x6e70('0x71')]=_0x53acc8[_0x6e70('0x6c')]['id'];_0x260dfa['From'+_0x252f07+_0x51be27+'Id']=_0x53acc8[_0x6e70('0x6d')]['id'];_0x260dfa['To'+_0x252f07+'QueueId']=_0x39e6db['id'];return db[_0x252f07+_0x6e70('0x72')]['create'](_0x260dfa);})['then'](function(){return respondWithRpcPromise('Start',{'channel':_0x461ec0,'interaction':_0x53acc8[_0x6e70('0x6c')],'message':_0x53acc8,'account':_0x53acc8[_0x6e70('0x6d')],'applications':[{'id':0x0,'priority':0x1,'app':_0x6e70('0x6f'),'appdata':_0x39e6db[_0x6e70('0x12')]+','+(_0x53acc8[_0x6e70('0x6d')]['queueTransferTimeout']||0x12c),'interval':_0x6e70('0x73')}],'transfer':!![]},routingClient);})[_0x6e70('0xa')](respondWithResult(_0x463eed,null))['catch'](handleError(_0x463eed,null));};};exports[_0x6e70('0x74')]=function(_0x50e494,_0x17d3a4){var _0x5d0585,_0x4a87e2;if(_[_0x6e70('0x14')](_0x50e494[_0x6e70('0x21')][_0x6e70('0x75')])){throw new Error(_0x6e70('0x76'));}var _0x3e6661=_0x50e494[_0x6e70('0x21')][_0x6e70('0x75')];var _0x5c0276=_[_0x6e70('0x66')](_0x3e6661);var _0x4f4a16=_0x3e6661===_0x6e70('0x77')?_0x6e70('0x67'):_0x6e70('0x6d');return db[_0x6e70('0x78')][_0x6e70('0x6b')]({'raw':!![],'where':{'id':_0x50e494[_0x6e70('0x1b')]['id'],'role':_0x6e70('0x3d')}})['then'](function(_0x4466f0){if(_['isNil'](_0x4466f0)){throw new Error(_0x6e70('0x79'));}_0x5d0585=_0x4466f0;return db[_0x5c0276+_0x6e70('0x6a')][_0x6e70('0x6b')]({'where':{'id':_0x50e494[_0x6e70('0x21')][_0x6e70('0x7a')]},'include':[{'model':db[_0x5c0276+_0x6e70('0x6c')],'as':_0x6e70('0x6c')},{'model':db[_0x5c0276+_0x4f4a16],'as':_0x6e70('0x6d')}]});})[_0x6e70('0xa')](function(_0x162bc3){if(_['isNil'](_0x162bc3)){throw new Error(_0x5c0276+_0x6e70('0x7b'));}_0x4a87e2=_0x162bc3;return _0x162bc3[_0x6e70('0x6e')]({'read':0x0,'readAt':null,'UserId':null});})[_0x6e70('0xa')](function(){var _0x181802={'uniqueid':_0x3e6661+'.'+_0x4a87e2['id']+'.'+_0x4a87e2[_0x6e70('0x6c')]['id'],'FromUserId':_0x50e494['user']['id'],'type':'agent','ToUserId':_0x5d0585['id']};_0x181802[_0x5c0276+'MessageId']=_0x4a87e2['id'];_0x181802[_0x5c0276+_0x6e70('0x71')]=_0x4a87e2[_0x6e70('0x6c')]['id'];_0x181802[_0x6e70('0x7c')+_0x5c0276+_0x4f4a16+'Id']=_0x4a87e2[_0x6e70('0x6d')]['id'];return db[_0x5c0276+_0x6e70('0x72')][_0x6e70('0x7d')](_0x181802);})[_0x6e70('0xa')](function(){return respondWithRpcPromise(_0x6e70('0x7e'),{'channel':_0x3e6661,'interaction':_0x4a87e2[_0x6e70('0x6c')],'message':_0x4a87e2,'account':_0x4a87e2[_0x6e70('0x6d')],'applications':[{'id':0x0,'priority':0x1,'app':_0x6e70('0x3d'),'appdata':_0x5d0585[_0x6e70('0x12')]+','+(_0x4a87e2[_0x6e70('0x6d')][_0x6e70('0x7f')]||0x12c),'interval':_0x6e70('0x73')}],'transfer':!![]},routingClient);})['then'](respondWithResult(_0x17d3a4,null))[_0x6e70('0xf')](handleError(_0x17d3a4,null));}; \ No newline at end of file diff --git a/server/api/schedule/index.js b/server/api/schedule/index.js index 595d61b..1bd98c2 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 _0x4959=['show','/:id/run','run','post','put','/:id','update','delete','destroy','exports','util','express','Router','fs-extra','../../components/auth/service','../../components/interaction/service','./schedule.controller','get','isAuthenticated','index'];(function(_0x173102,_0x2fa134){var _0x876ed4=function(_0x527248){while(--_0x527248){_0x173102['push'](_0x173102['shift']());}};_0x876ed4(++_0x2fa134);}(_0x4959,0x10e));var _0x9495=function(_0x4c7bd4,_0x486076){_0x4c7bd4=_0x4c7bd4-0x0;var _0x3c0e2c=_0x4959[_0x4c7bd4];return _0x3c0e2c;};'use strict';var multer=require('multer');var util=require(_0x9495('0x0'));var path=require('path');var timeout=require('connect-timeout');var express=require(_0x9495('0x1'));var router=express[_0x9495('0x2')]();var fs_extra=require(_0x9495('0x3'));var auth=require(_0x9495('0x4'));var interaction=require(_0x9495('0x5'));var config=require('../../config/environment');var controller=require(_0x9495('0x6'));router[_0x9495('0x7')]('/',auth[_0x9495('0x8')](),controller[_0x9495('0x9')]);router[_0x9495('0x7')]('/:id',auth[_0x9495('0x8')](),controller[_0x9495('0xa')]);router[_0x9495('0x7')](_0x9495('0xb'),auth[_0x9495('0x8')](),controller[_0x9495('0xc')]);router[_0x9495('0xd')]('/',auth[_0x9495('0x8')](),controller['create']);router[_0x9495('0xe')](_0x9495('0xf'),auth['isAuthenticated'](),controller[_0x9495('0x10')]);router[_0x9495('0x11')]('/:id',auth[_0x9495('0x8')](),controller[_0x9495('0x12')]);module[_0x9495('0x13')]=router; \ No newline at end of file +var _0x3bc1=['multer','util','connect-timeout','express','Router','fs-extra','../../components/auth/service','../../components/interaction/service','./schedule.controller','get','isAuthenticated','index','show','/:id/run','post','put','/:id','exports'];(function(_0x445297,_0x5c4e3e){var _0x4535c2=function(_0x4245f9){while(--_0x4245f9){_0x445297['push'](_0x445297['shift']());}};_0x4535c2(++_0x5c4e3e);}(_0x3bc1,0xb4));var _0x13bc=function(_0x29fac6,_0x3da0c5){_0x29fac6=_0x29fac6-0x0;var _0x170757=_0x3bc1[_0x29fac6];return _0x170757;};'use strict';var multer=require(_0x13bc('0x0'));var util=require(_0x13bc('0x1'));var path=require('path');var timeout=require(_0x13bc('0x2'));var express=require(_0x13bc('0x3'));var router=express[_0x13bc('0x4')]();var fs_extra=require(_0x13bc('0x5'));var auth=require(_0x13bc('0x6'));var interaction=require(_0x13bc('0x7'));var config=require('../../config/environment');var controller=require(_0x13bc('0x8'));router[_0x13bc('0x9')]('/',auth[_0x13bc('0xa')](),controller[_0x13bc('0xb')]);router['get']('/:id',auth[_0x13bc('0xa')](),controller[_0x13bc('0xc')]);router[_0x13bc('0x9')](_0x13bc('0xd'),auth[_0x13bc('0xa')](),controller['run']);router[_0x13bc('0xe')]('/',auth[_0x13bc('0xa')](),controller['create']);router[_0x13bc('0xf')](_0x13bc('0x10'),auth[_0x13bc('0xa')](),controller['update']);router['delete']('/:id',auth['isAuthenticated'](),controller['destroy']);module[_0x13bc('0x11')]=router; \ No newline at end of file diff --git a/server/api/schedule/schedule.attributes.js b/server/api/schedule/schedule.attributes.js index e6ae05c..9f9d8f0 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 _0x9346=['STRING','BOOLEAN','0\x200\x20*\x20*\x20*','DATE','INTEGER','ENUM','years','quarters','months','days','minutes','csv','pdf','custom','default','TEXT','sequelize','exports'];(function(_0x2fc0ee,_0x41100a){var _0x25de3d=function(_0x46b925){while(--_0x46b925){_0x2fc0ee['push'](_0x2fc0ee['shift']());}};_0x25de3d(++_0x41100a);}(_0x9346,0x19c));var _0x6934=function(_0x44c185,_0x4fb115){_0x44c185=_0x44c185-0x0;var _0x33c2bc=_0x9346[_0x44c185];return _0x33c2bc;};'use strict';var Sequelize=require(_0x6934('0x0'));module[_0x6934('0x1')]={'name':{'type':Sequelize['STRING'],'allowNull':![]},'description':{'type':Sequelize[_0x6934('0x2')]},'active':{'type':Sequelize[_0x6934('0x3')],'allowNull':![],'defaultValue':![]},'cron':{'type':Sequelize[_0x6934('0x2')],'allowNull':![],'defaultValue':_0x6934('0x4')},'startAt':{'type':Sequelize['DATE'],'allowNull':![]},'endAt':{'type':Sequelize[_0x6934('0x5')],'allowNull':![]},'subtractNumber':{'type':Sequelize[_0x6934('0x6')],'allowNull':![],'defaultValue':0x1,'validate':{'min':0x1}},'subtractUnit':{'type':Sequelize[_0x6934('0x7')](_0x6934('0x8'),_0x6934('0x9'),_0x6934('0xa'),'weeks',_0x6934('0xb'),'hours',_0x6934('0xc')),'allowNull':![],'defaultValue':_0x6934('0xb')},'output':{'type':Sequelize[_0x6934('0x7')](_0x6934('0xd'),_0x6934('0xe'),'xlsx'),'allowNull':![],'defaultValue':'csv'},'type':{'type':Sequelize[_0x6934('0x7')](_0x6934('0xf'),_0x6934('0x10')),'allowNull':![],'defaultValue':_0x6934('0xf')},'sendMail':{'type':Sequelize[_0x6934('0x3')],'defaultValue':![]},'email':{'type':Sequelize[_0x6934('0x2')]},'cc':{'type':Sequelize['TEXT']},'bcc':{'type':Sequelize[_0x6934('0x11')]},'sendIfEmpty':{'type':Sequelize[_0x6934('0x3')],'defaultValue':!![]}}; \ No newline at end of file +var _0x345e=['years','quarters','hours','minutes','days','ENUM','xlsx','custom','default','TEXT','sequelize','exports','STRING','BOOLEAN','0\x200\x20*\x20*\x20*','DATE','INTEGER'];(function(_0x521929,_0x479be5){var _0x632436=function(_0x288290){while(--_0x288290){_0x521929['push'](_0x521929['shift']());}};_0x632436(++_0x479be5);}(_0x345e,0xf8));var _0xe345=function(_0x3650ad,_0x3386bf){_0x3650ad=_0x3650ad-0x0;var _0x3e4d7b=_0x345e[_0x3650ad];return _0x3e4d7b;};'use strict';var Sequelize=require(_0xe345('0x0'));module[_0xe345('0x1')]={'name':{'type':Sequelize[_0xe345('0x2')],'allowNull':![]},'description':{'type':Sequelize[_0xe345('0x2')]},'active':{'type':Sequelize[_0xe345('0x3')],'allowNull':![],'defaultValue':![]},'cron':{'type':Sequelize[_0xe345('0x2')],'allowNull':![],'defaultValue':_0xe345('0x4')},'startAt':{'type':Sequelize[_0xe345('0x5')],'allowNull':![]},'endAt':{'type':Sequelize[_0xe345('0x5')],'allowNull':![]},'subtractNumber':{'type':Sequelize[_0xe345('0x6')],'allowNull':![],'defaultValue':0x1,'validate':{'min':0x1}},'subtractUnit':{'type':Sequelize['ENUM'](_0xe345('0x7'),_0xe345('0x8'),'months','weeks','days',_0xe345('0x9'),_0xe345('0xa')),'allowNull':![],'defaultValue':_0xe345('0xb')},'output':{'type':Sequelize[_0xe345('0xc')]('csv','pdf',_0xe345('0xd')),'allowNull':![],'defaultValue':'csv'},'type':{'type':Sequelize[_0xe345('0xc')](_0xe345('0xe'),_0xe345('0xf')),'allowNull':![],'defaultValue':_0xe345('0xe')},'sendMail':{'type':Sequelize[_0xe345('0x3')],'defaultValue':![]},'email':{'type':Sequelize['STRING']},'cc':{'type':Sequelize['TEXT']},'bcc':{'type':Sequelize[_0xe345('0x10')]},'sendIfEmpty':{'type':Sequelize[_0xe345('0x3')],'defaultValue':!![]}}; \ No newline at end of file diff --git a/server/api/schedule/schedule.controller.js b/server/api/schedule/schedule.controller.js index ec18406..24602ab 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 _0x95b9=['UserProfileResource','error','name','send','index','map','Schedule','rawAttributes','key','model','keys','query','intersection','attributes','fields','hasOwnProperty','order','sort','where','filters','pick','filter','merge','type','VIRTUAL','options','includeAll','include','findAll','rows','catch','params','length','create','body','role','user','UserProfileSection','find','userProfileId','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','run','../../config/schedule','eml-format','rimraf','request-promise','moment','bluebird','mustache','util','path','sox','to-csv','ejs','fs-extra','lodash','squel','crypto','desk.js','papaparse','ioredis','../../components/auth/service','../../components/parsers/advancedSearch','../../config/license/hardware','api','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','sendStatus','status','end','json','offset','limit','undefined','count','Content-Range','apply','reject','save','update','destroy','then','get'];(function(_0x4c2071,_0x10e540){var _0x32485d=function(_0xe26b30){while(--_0xe26b30){_0x4c2071['push'](_0x4c2071['shift']());}};_0x32485d(++_0x10e540);}(_0x95b9,0x80));var _0x995b=function(_0x20729f,_0x52f750){_0x20729f=_0x20729f-0x0;var _0x1e7836=_0x95b9[_0x20729f];return _0x1e7836;};'use strict';var emlformat=require(_0x995b('0x0'));var rimraf=require(_0x995b('0x1'));var zipdir=require('zip-dir');var jsonpatch=require('fast-json-patch');var rp=require(_0x995b('0x2'));var moment=require(_0x995b('0x3'));var BPromise=require(_0x995b('0x4'));var Mustache=require(_0x995b('0x5'));var util=require(_0x995b('0x6'));var path=require(_0x995b('0x7'));var sox=require(_0x995b('0x8'));var csv=require(_0x995b('0x9'));var ejs=require(_0x995b('0xa'));var fs=require('fs');var fs_extra=require(_0x995b('0xb'));var _=require(_0x995b('0xc'));var squel=require(_0x995b('0xd'));var crypto=require(_0x995b('0xe'));var jsforce=require('jsforce');var deskjs=require(_0x995b('0xf'));var toCsv=require('to-csv');var querystring=require('querystring');var Papa=require(_0x995b('0x10'));var Redis=require(_0x995b('0x11'));var authService=require(_0x995b('0x12'));var qs=require('../../components/parsers/qs');var as=require(_0x995b('0x13'));var hardwareService=require(_0x995b('0x14'));var logger=require('../../config/logger')(_0x995b('0x15'));var utils=require(_0x995b('0x16'));var config=require(_0x995b('0x17'));var licenseUtil=require(_0x995b('0x18'));var db=require(_0x995b('0x19'))['db'];function respondWithStatusCode(_0x3be4f8,_0x52276e){_0x52276e=_0x52276e||0xcc;return function(_0x30f0a6){if(_0x30f0a6){return _0x3be4f8[_0x995b('0x1a')](_0x52276e);}return _0x3be4f8[_0x995b('0x1b')](_0x52276e)[_0x995b('0x1c')]();};}function respondWithResult(_0x115a53,_0x7d6a1a){_0x7d6a1a=_0x7d6a1a||0xc8;return function(_0x5b2152){if(_0x5b2152){return _0x115a53['status'](_0x7d6a1a)[_0x995b('0x1d')](_0x5b2152);}};}function respondWithFilteredResult(_0x19d754,_0x2f90b2){return function(_0x534032){if(_0x534032){var _0x473431=typeof _0x2f90b2[_0x995b('0x1e')]==='undefined'&&typeof _0x2f90b2[_0x995b('0x1f')]===_0x995b('0x20');var _0xeffe08=_0x534032['count'];var _0x5c4ff2=_0x473431?0x0:_0x2f90b2['offset'];var _0x2a68cc=_0x473431?_0x534032[_0x995b('0x21')]:_0x2f90b2[_0x995b('0x1e')]+_0x2f90b2['limit'];var _0x2dee31;if(_0x2a68cc>=_0xeffe08){_0x2a68cc=_0xeffe08;_0x2dee31=0xc8;}else{_0x2dee31=0xce;}_0x19d754[_0x995b('0x1b')](_0x2dee31);return _0x19d754['set'](_0x995b('0x22'),_0x5c4ff2+'-'+_0x2a68cc+'/'+_0xeffe08)[_0x995b('0x1d')](_0x534032);}return null;};}function patchUpdates(_0x5da28a){return function(_0x476e61){try{jsonpatch[_0x995b('0x23')](_0x476e61,_0x5da28a,!![]);}catch(_0x4d7e42){return BPromise[_0x995b('0x24')](_0x4d7e42);}return _0x476e61[_0x995b('0x25')]();};}function saveUpdates(_0x132179,_0x3c7f62){return function(_0x40938b){if(_0x40938b){return _0x40938b[_0x995b('0x26')](_0x132179)['then'](function(_0x41ed67){return _0x41ed67;});}return null;};}function removeEntity(_0x36ab67,_0x3670e5){return function(_0x40409d){if(_0x40409d){return _0x40409d[_0x995b('0x27')]()[_0x995b('0x28')](function(){var _0x11e9f3=_0x40409d[_0x995b('0x29')]({'plain':!![]});var _0x27be92='Scheduler';return db[_0x995b('0x2a')][_0x995b('0x27')]({'where':{'type':_0x27be92,'resourceId':_0x11e9f3['id']}})[_0x995b('0x28')](function(){return _0x40409d;});})[_0x995b('0x28')](function(){_0x36ab67[_0x995b('0x1b')](0xcc)[_0x995b('0x1c')]();});}};}function handleEntityNotFound(_0x11cee3,_0x589ae2){return function(_0x11fd35){if(!_0x11fd35){_0x11cee3[_0x995b('0x1a')](0x194);}return _0x11fd35;};}function handleError(_0x5c9252,_0x410b62){_0x410b62=_0x410b62||0x1f4;return function(_0x1af285){logger[_0x995b('0x2b')](_0x1af285['stack']);if(_0x1af285[_0x995b('0x2c')]){delete _0x1af285[_0x995b('0x2c')];}_0x5c9252[_0x995b('0x1b')](_0x410b62)[_0x995b('0x2d')](_0x1af285);};}exports[_0x995b('0x2e')]=function(_0x3f8546,_0x5a113c){var _0x560a1b={},_0x439119={},_0x1c4ecb={'count':0x0,'rows':[]};var _0x4ee782=_[_0x995b('0x2f')](db[_0x995b('0x30')][_0x995b('0x31')],function(_0x40c816){return{'name':_0x40c816['fieldName'],'type':_0x40c816['type'][_0x995b('0x32')]};});_0x439119[_0x995b('0x33')]=_[_0x995b('0x2f')](_0x4ee782,'name');_0x439119['query']=_[_0x995b('0x34')](_0x3f8546[_0x995b('0x35')]);_0x439119['filters']=_[_0x995b('0x36')](_0x439119[_0x995b('0x33')],_0x439119[_0x995b('0x35')]);_0x560a1b[_0x995b('0x37')]=_[_0x995b('0x36')](_0x439119[_0x995b('0x33')],qs[_0x995b('0x38')](_0x3f8546[_0x995b('0x35')][_0x995b('0x38')]));_0x560a1b[_0x995b('0x37')]=_0x560a1b[_0x995b('0x37')]['length']?_0x560a1b[_0x995b('0x37')]:_0x439119['model'];if(!_0x3f8546[_0x995b('0x35')][_0x995b('0x39')]('nolimit')){_0x560a1b[_0x995b('0x1f')]=qs[_0x995b('0x1f')](_0x3f8546['query'][_0x995b('0x1f')]);_0x560a1b['offset']=qs['offset'](_0x3f8546[_0x995b('0x35')][_0x995b('0x1e')]);}_0x560a1b[_0x995b('0x3a')]=qs[_0x995b('0x3b')](_0x3f8546[_0x995b('0x35')]['sort']);_0x560a1b[_0x995b('0x3c')]=qs[_0x995b('0x3d')](_[_0x995b('0x3e')](_0x3f8546[_0x995b('0x35')],_0x439119[_0x995b('0x3d')]),_0x4ee782);if(_0x3f8546['query'][_0x995b('0x3f')]){_0x560a1b[_0x995b('0x3c')]=_[_0x995b('0x40')](_0x560a1b[_0x995b('0x3c')],{'$or':_[_0x995b('0x2f')](_0x4ee782,function(_0x548ca3){if(_0x548ca3[_0x995b('0x41')]!==_0x995b('0x42')){var _0x2ff1eb={};_0x2ff1eb[_0x548ca3[_0x995b('0x2c')]]={'$like':'%'+_0x3f8546[_0x995b('0x35')]['filter']+'%'};return _0x2ff1eb;}})});}_0x560a1b=_[_0x995b('0x40')]({},_0x560a1b,_0x3f8546[_0x995b('0x43')]);var _0x1f41f4={'where':_0x560a1b[_0x995b('0x3c')]};return db[_0x995b('0x30')]['count'](_0x1f41f4)[_0x995b('0x28')](function(_0x11884c){_0x1c4ecb[_0x995b('0x21')]=_0x11884c;if(_0x3f8546[_0x995b('0x35')][_0x995b('0x44')]){_0x560a1b[_0x995b('0x45')]=[{'all':!![]}];}return db[_0x995b('0x30')][_0x995b('0x46')](_0x560a1b);})[_0x995b('0x28')](function(_0x3d7b53){_0x1c4ecb[_0x995b('0x47')]=_0x3d7b53;return _0x1c4ecb;})[_0x995b('0x28')](respondWithFilteredResult(_0x5a113c,_0x560a1b))[_0x995b('0x48')](handleError(_0x5a113c,null));};exports['show']=function(_0xa73496,_0x4ad31f){var _0x237fe8={'raw':![],'where':{'id':_0xa73496[_0x995b('0x49')]['id']}},_0x2e38b1={};_0x2e38b1[_0x995b('0x33')]=_[_0x995b('0x34')](db[_0x995b('0x30')][_0x995b('0x31')]);_0x2e38b1['query']=_[_0x995b('0x34')](_0xa73496[_0x995b('0x35')]);_0x2e38b1[_0x995b('0x3d')]=_['intersection'](_0x2e38b1['model'],_0x2e38b1['query']);_0x237fe8[_0x995b('0x37')]=_[_0x995b('0x36')](_0x2e38b1['model'],qs[_0x995b('0x38')](_0xa73496[_0x995b('0x35')][_0x995b('0x38')]));_0x237fe8['attributes']=_0x237fe8[_0x995b('0x37')][_0x995b('0x4a')]?_0x237fe8[_0x995b('0x37')]:_0x2e38b1['model'];if(_0xa73496[_0x995b('0x35')][_0x995b('0x44')]){_0x237fe8['include']=[{'all':!![]}];}_0x237fe8=_[_0x995b('0x40')]({},_0x237fe8,_0xa73496[_0x995b('0x43')]);return db[_0x995b('0x30')]['find'](_0x237fe8)['then'](handleEntityNotFound(_0x4ad31f,null))[_0x995b('0x28')](respondWithResult(_0x4ad31f,null))[_0x995b('0x48')](handleError(_0x4ad31f,null));};exports[_0x995b('0x4b')]=function(_0x27ace3,_0x6d61e2){return db[_0x995b('0x30')][_0x995b('0x4b')](_0x27ace3[_0x995b('0x4c')],{})['then'](function(_0x1ced81){var _0x222fe1=_0x27ace3['user'][_0x995b('0x29')]({'plain':!![]});if(!_0x222fe1)throw new Error('Unable\x20to\x20retrieve\x20the\x20current\x20user');if(_0x222fe1[_0x995b('0x4d')]===_0x995b('0x4e')){var _0x26e1d4=_0x1ced81[_0x995b('0x29')]({'plain':!![]});var _0x3c74f0='Scheduler';return db[_0x995b('0x4f')][_0x995b('0x50')]({'where':{'name':_0x3c74f0,'userProfileId':_0x222fe1[_0x995b('0x51')]},'raw':!![]})[_0x995b('0x28')](function(_0x52e53a){if(_0x52e53a&&_0x52e53a['autoAssociation']===0x0){return db[_0x995b('0x2a')][_0x995b('0x4b')]({'name':_0x26e1d4[_0x995b('0x2c')],'resourceId':_0x26e1d4['id'],'type':_0x52e53a[_0x995b('0x2c')],'sectionId':_0x52e53a['id']},{})['then'](function(){return _0x1ced81;});}else{return _0x1ced81;}})[_0x995b('0x48')](function(_0x1926ff){logger['error'](_0x995b('0x52'),_0x1926ff);throw _0x1926ff;});}return _0x1ced81;})[_0x995b('0x28')](respondWithResult(_0x6d61e2,0xc9))['catch'](handleError(_0x6d61e2,null));};exports['update']=function(_0xe76e3,_0x49a059){if(_0xe76e3[_0x995b('0x4c')]['id']){delete _0xe76e3[_0x995b('0x4c')]['id'];}return db[_0x995b('0x30')]['find']({'where':{'id':_0xe76e3['params']['id']}})[_0x995b('0x28')](handleEntityNotFound(_0x49a059,null))[_0x995b('0x28')](saveUpdates(_0xe76e3[_0x995b('0x4c')],null))[_0x995b('0x28')](respondWithResult(_0x49a059,null))[_0x995b('0x48')](handleError(_0x49a059,null));};exports[_0x995b('0x27')]=function(_0x5eecf0,_0x1e32c5){return db['Schedule'][_0x995b('0x50')]({'where':{'id':_0x5eecf0[_0x995b('0x49')]['id']}})['then'](handleEntityNotFound(_0x1e32c5,null))[_0x995b('0x28')](removeEntity(_0x1e32c5,null))[_0x995b('0x48')](handleError(_0x1e32c5,null));};exports[_0x995b('0x53')]=function(_0x4241b4,_0xbbd5c2,_0x491d14){var _0x11d853=require(_0x995b('0x54'));return db['Schedule'][_0x995b('0x50')]({'where':{'id':_0x4241b4[_0x995b('0x49')]['id']},'raw':!![]})[_0x995b('0x28')](handleEntityNotFound(_0xbbd5c2,null))[_0x995b('0x28')](function(){_0x11d853[_0x995b('0x53')](_0x4241b4[_0x995b('0x49')]['id']);})[_0x995b('0x28')](respondWithStatusCode(_0xbbd5c2,null))['catch'](handleError(_0xbbd5c2,null));}; \ No newline at end of file +var _0x098f=['count','offset','set','Content-Range','apply','reject','save','update','destroy','Scheduler','UserProfileResource','then','error','stack','name','send','map','Schedule','rawAttributes','fieldName','type','key','query','keys','filters','intersection','model','attributes','hasOwnProperty','nolimit','sort','where','pick','VIRTUAL','filter','options','includeAll','include','rows','show','params','fields','length','merge','catch','create','user','Unable\x20to\x20retrieve\x20the\x20current\x20user','role','get','UserProfileSection','find','userProfileId','autoAssociation','body','run','../../config/schedule','rimraf','zip-dir','request-promise','moment','bluebird','path','sox','to-csv','ejs','crypto','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','undefined','limit'];(function(_0x47157c,_0xbdfe95){var _0x5d9dae=function(_0x2e446d){while(--_0x2e446d){_0x47157c['push'](_0x47157c['shift']());}};_0x5d9dae(++_0xbdfe95);}(_0x098f,0x1e2));var _0xf098=function(_0x4ba0fa,_0x2b0794){_0x4ba0fa=_0x4ba0fa-0x0;var _0x43f815=_0x098f[_0x4ba0fa];return _0x43f815;};'use strict';var emlformat=require('eml-format');var rimraf=require(_0xf098('0x0'));var zipdir=require(_0xf098('0x1'));var jsonpatch=require('fast-json-patch');var rp=require(_0xf098('0x2'));var moment=require(_0xf098('0x3'));var BPromise=require(_0xf098('0x4'));var Mustache=require('mustache');var util=require('util');var path=require(_0xf098('0x5'));var sox=require(_0xf098('0x6'));var csv=require(_0xf098('0x7'));var ejs=require(_0xf098('0x8'));var fs=require('fs');var fs_extra=require('fs-extra');var _=require('lodash');var squel=require('squel');var crypto=require(_0xf098('0x9'));var jsforce=require(_0xf098('0xa'));var deskjs=require(_0xf098('0xb'));var toCsv=require(_0xf098('0x7'));var querystring=require('querystring');var Papa=require(_0xf098('0xc'));var Redis=require('ioredis');var authService=require(_0xf098('0xd'));var qs=require(_0xf098('0xe'));var as=require(_0xf098('0xf'));var hardwareService=require(_0xf098('0x10'));var logger=require(_0xf098('0x11'))('api');var utils=require(_0xf098('0x12'));var config=require(_0xf098('0x13'));var licenseUtil=require(_0xf098('0x14'));var db=require(_0xf098('0x15'))['db'];function respondWithStatusCode(_0x5befd1,_0xbf34c9){_0xbf34c9=_0xbf34c9||0xcc;return function(_0x453f4e){if(_0x453f4e){return _0x5befd1[_0xf098('0x16')](_0xbf34c9);}return _0x5befd1['status'](_0xbf34c9)[_0xf098('0x17')]();};}function respondWithResult(_0x20a58b,_0x3c184e){_0x3c184e=_0x3c184e||0xc8;return function(_0x47f4a8){if(_0x47f4a8){return _0x20a58b[_0xf098('0x18')](_0x3c184e)[_0xf098('0x19')](_0x47f4a8);}};}function respondWithFilteredResult(_0x5c1dce,_0x44e9a7){return function(_0x39606d){if(_0x39606d){var _0x5e27a3=typeof _0x44e9a7['offset']===_0xf098('0x1a')&&typeof _0x44e9a7[_0xf098('0x1b')]==='undefined';var _0x549415=_0x39606d[_0xf098('0x1c')];var _0x594402=_0x5e27a3?0x0:_0x44e9a7[_0xf098('0x1d')];var _0x2715c1=_0x5e27a3?_0x39606d[_0xf098('0x1c')]:_0x44e9a7[_0xf098('0x1d')]+_0x44e9a7['limit'];var _0x5d9f8a;if(_0x2715c1>=_0x549415){_0x2715c1=_0x549415;_0x5d9f8a=0xc8;}else{_0x5d9f8a=0xce;}_0x5c1dce[_0xf098('0x18')](_0x5d9f8a);return _0x5c1dce[_0xf098('0x1e')](_0xf098('0x1f'),_0x594402+'-'+_0x2715c1+'/'+_0x549415)[_0xf098('0x19')](_0x39606d);}return null;};}function patchUpdates(_0x1d53db){return function(_0x40e0e6){try{jsonpatch[_0xf098('0x20')](_0x40e0e6,_0x1d53db,!![]);}catch(_0x34c16d){return BPromise[_0xf098('0x21')](_0x34c16d);}return _0x40e0e6[_0xf098('0x22')]();};}function saveUpdates(_0x51e744,_0x1c67e7){return function(_0x2a3a6e){if(_0x2a3a6e){return _0x2a3a6e[_0xf098('0x23')](_0x51e744)['then'](function(_0x446503){return _0x446503;});}return null;};}function removeEntity(_0x53453f,_0x42ae4c){return function(_0x1d60f5){if(_0x1d60f5){return _0x1d60f5[_0xf098('0x24')]()['then'](function(){var _0x54f777=_0x1d60f5['get']({'plain':!![]});var _0x377248=_0xf098('0x25');return db[_0xf098('0x26')]['destroy']({'where':{'type':_0x377248,'resourceId':_0x54f777['id']}})[_0xf098('0x27')](function(){return _0x1d60f5;});})[_0xf098('0x27')](function(){_0x53453f[_0xf098('0x18')](0xcc)[_0xf098('0x17')]();});}};}function handleEntityNotFound(_0x5d02d3,_0x456641){return function(_0x5ad22a){if(!_0x5ad22a){_0x5d02d3[_0xf098('0x16')](0x194);}return _0x5ad22a;};}function handleError(_0x29d837,_0x5d827b){_0x5d827b=_0x5d827b||0x1f4;return function(_0x55ce47){logger[_0xf098('0x28')](_0x55ce47[_0xf098('0x29')]);if(_0x55ce47['name']){delete _0x55ce47[_0xf098('0x2a')];}_0x29d837['status'](_0x5d827b)[_0xf098('0x2b')](_0x55ce47);};}exports['index']=function(_0x4480e4,_0x18e70a){var _0x43e305={},_0x221978={},_0x434763={'count':0x0,'rows':[]};var _0x4a0f9c=_[_0xf098('0x2c')](db[_0xf098('0x2d')][_0xf098('0x2e')],function(_0x2a0b02){return{'name':_0x2a0b02[_0xf098('0x2f')],'type':_0x2a0b02[_0xf098('0x30')][_0xf098('0x31')]};});_0x221978['model']=_[_0xf098('0x2c')](_0x4a0f9c,'name');_0x221978[_0xf098('0x32')]=_[_0xf098('0x33')](_0x4480e4[_0xf098('0x32')]);_0x221978[_0xf098('0x34')]=_['intersection'](_0x221978['model'],_0x221978[_0xf098('0x32')]);_0x43e305['attributes']=_[_0xf098('0x35')](_0x221978[_0xf098('0x36')],qs['fields'](_0x4480e4[_0xf098('0x32')]['fields']));_0x43e305[_0xf098('0x37')]=_0x43e305['attributes']['length']?_0x43e305[_0xf098('0x37')]:_0x221978[_0xf098('0x36')];if(!_0x4480e4[_0xf098('0x32')][_0xf098('0x38')](_0xf098('0x39'))){_0x43e305[_0xf098('0x1b')]=qs[_0xf098('0x1b')](_0x4480e4[_0xf098('0x32')][_0xf098('0x1b')]);_0x43e305[_0xf098('0x1d')]=qs[_0xf098('0x1d')](_0x4480e4[_0xf098('0x32')][_0xf098('0x1d')]);}_0x43e305['order']=qs[_0xf098('0x3a')](_0x4480e4[_0xf098('0x32')][_0xf098('0x3a')]);_0x43e305[_0xf098('0x3b')]=qs[_0xf098('0x34')](_[_0xf098('0x3c')](_0x4480e4['query'],_0x221978['filters']),_0x4a0f9c);if(_0x4480e4['query']['filter']){_0x43e305['where']=_['merge'](_0x43e305[_0xf098('0x3b')],{'$or':_['map'](_0x4a0f9c,function(_0xbff3b4){if(_0xbff3b4['type']!==_0xf098('0x3d')){var _0x2cc70b={};_0x2cc70b[_0xbff3b4[_0xf098('0x2a')]]={'$like':'%'+_0x4480e4[_0xf098('0x32')][_0xf098('0x3e')]+'%'};return _0x2cc70b;}})});}_0x43e305=_['merge']({},_0x43e305,_0x4480e4[_0xf098('0x3f')]);var _0x182306={'where':_0x43e305[_0xf098('0x3b')]};return db[_0xf098('0x2d')][_0xf098('0x1c')](_0x182306)['then'](function(_0x1c29b7){_0x434763[_0xf098('0x1c')]=_0x1c29b7;if(_0x4480e4[_0xf098('0x32')][_0xf098('0x40')]){_0x43e305[_0xf098('0x41')]=[{'all':!![]}];}return db['Schedule']['findAll'](_0x43e305);})[_0xf098('0x27')](function(_0x58decc){_0x434763[_0xf098('0x42')]=_0x58decc;return _0x434763;})['then'](respondWithFilteredResult(_0x18e70a,_0x43e305))['catch'](handleError(_0x18e70a,null));};exports[_0xf098('0x43')]=function(_0x5659cc,_0x4d9d2f){var _0x5a3ec9={'raw':![],'where':{'id':_0x5659cc[_0xf098('0x44')]['id']}},_0x32b430={};_0x32b430[_0xf098('0x36')]=_[_0xf098('0x33')](db[_0xf098('0x2d')][_0xf098('0x2e')]);_0x32b430['query']=_[_0xf098('0x33')](_0x5659cc[_0xf098('0x32')]);_0x32b430[_0xf098('0x34')]=_[_0xf098('0x35')](_0x32b430[_0xf098('0x36')],_0x32b430['query']);_0x5a3ec9[_0xf098('0x37')]=_[_0xf098('0x35')](_0x32b430[_0xf098('0x36')],qs[_0xf098('0x45')](_0x5659cc[_0xf098('0x32')]['fields']));_0x5a3ec9['attributes']=_0x5a3ec9['attributes'][_0xf098('0x46')]?_0x5a3ec9[_0xf098('0x37')]:_0x32b430[_0xf098('0x36')];if(_0x5659cc[_0xf098('0x32')][_0xf098('0x40')]){_0x5a3ec9[_0xf098('0x41')]=[{'all':!![]}];}_0x5a3ec9=_[_0xf098('0x47')]({},_0x5a3ec9,_0x5659cc[_0xf098('0x3f')]);return db[_0xf098('0x2d')]['find'](_0x5a3ec9)[_0xf098('0x27')](handleEntityNotFound(_0x4d9d2f,null))[_0xf098('0x27')](respondWithResult(_0x4d9d2f,null))[_0xf098('0x48')](handleError(_0x4d9d2f,null));};exports[_0xf098('0x49')]=function(_0x2faf66,_0x978d4a){return db['Schedule']['create'](_0x2faf66['body'],{})[_0xf098('0x27')](function(_0x48f417){var _0x1fb103=_0x2faf66[_0xf098('0x4a')]['get']({'plain':!![]});if(!_0x1fb103)throw new Error(_0xf098('0x4b'));if(_0x1fb103[_0xf098('0x4c')]==='user'){var _0x522bde=_0x48f417[_0xf098('0x4d')]({'plain':!![]});var _0x1c1f6a=_0xf098('0x25');return db[_0xf098('0x4e')][_0xf098('0x4f')]({'where':{'name':_0x1c1f6a,'userProfileId':_0x1fb103[_0xf098('0x50')]},'raw':!![]})[_0xf098('0x27')](function(_0x4e8bf9){if(_0x4e8bf9&&_0x4e8bf9[_0xf098('0x51')]===0x0){return db[_0xf098('0x26')][_0xf098('0x49')]({'name':_0x522bde['name'],'resourceId':_0x522bde['id'],'type':_0x4e8bf9['name'],'sectionId':_0x4e8bf9['id']},{})[_0xf098('0x27')](function(){return _0x48f417;});}else{return _0x48f417;}})['catch'](function(_0xe2ee4c){logger[_0xf098('0x28')]('Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s',_0xe2ee4c);throw _0xe2ee4c;});}return _0x48f417;})['then'](respondWithResult(_0x978d4a,0xc9))[_0xf098('0x48')](handleError(_0x978d4a,null));};exports[_0xf098('0x23')]=function(_0x3e0fa6,_0x3b2d5a){if(_0x3e0fa6[_0xf098('0x52')]['id']){delete _0x3e0fa6['body']['id'];}return db[_0xf098('0x2d')][_0xf098('0x4f')]({'where':{'id':_0x3e0fa6[_0xf098('0x44')]['id']}})[_0xf098('0x27')](handleEntityNotFound(_0x3b2d5a,null))[_0xf098('0x27')](saveUpdates(_0x3e0fa6[_0xf098('0x52')],null))[_0xf098('0x27')](respondWithResult(_0x3b2d5a,null))[_0xf098('0x48')](handleError(_0x3b2d5a,null));};exports[_0xf098('0x24')]=function(_0x137b7e,_0x273630){return db[_0xf098('0x2d')]['find']({'where':{'id':_0x137b7e[_0xf098('0x44')]['id']}})[_0xf098('0x27')](handleEntityNotFound(_0x273630,null))[_0xf098('0x27')](removeEntity(_0x273630,null))[_0xf098('0x48')](handleError(_0x273630,null));};exports[_0xf098('0x53')]=function(_0x51f29b,_0x4c5d8f,_0x459cf2){var _0x2901fe=require(_0xf098('0x54'));return db[_0xf098('0x2d')][_0xf098('0x4f')]({'where':{'id':_0x51f29b[_0xf098('0x44')]['id']},'raw':!![]})['then'](handleEntityNotFound(_0x4c5d8f,null))[_0xf098('0x27')](function(){_0x2901fe[_0xf098('0x53')](_0x51f29b['params']['id']);})[_0xf098('0x27')](respondWithStatusCode(_0x4c5d8f,null))[_0xf098('0x48')](handleError(_0x4c5d8f,null));}; \ No newline at end of file diff --git a/server/api/schedule/schedule.model.js b/server/api/schedule/schedule.model.js index 07355e2..452d2fe 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 _0xcdb1=['util','api','moment','request-promise','path','rimraf','./schedule.attributes','exports','define','Schedule','lodash'];(function(_0x42b89a,_0x5842f4){var _0x33e70d=function(_0x5b6048){while(--_0x5b6048){_0x42b89a['push'](_0x42b89a['shift']());}};_0x33e70d(++_0x5842f4);}(_0xcdb1,0x1a1));var _0x1cdb=function(_0x3ab51d,_0x2fa01d){_0x3ab51d=_0x3ab51d-0x0;var _0x29a04e=_0xcdb1[_0x3ab51d];return _0x29a04e;};'use strict';var _=require(_0x1cdb('0x0'));var util=require(_0x1cdb('0x1'));var logger=require('../../config/logger')(_0x1cdb('0x2'));var moment=require(_0x1cdb('0x3'));var BPromise=require('bluebird');var rp=require(_0x1cdb('0x4'));var fs=require('fs');var path=require(_0x1cdb('0x5'));var rimraf=require(_0x1cdb('0x6'));var config=require('../../config/environment');var attributes=require(_0x1cdb('0x7'));module[_0x1cdb('0x8')]=function(_0x57aa5a,_0x5aa911){return _0x57aa5a[_0x1cdb('0x9')](_0x1cdb('0xa'),attributes,{'tableName':'tools_schedules','paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x04d1=['bluebird','request-promise','path','rimraf','../../config/environment','./schedule.attributes','exports','Schedule','moment'];(function(_0x122ef9,_0x451d2a){var _0x42fba0=function(_0x17c9d3){while(--_0x17c9d3){_0x122ef9['push'](_0x122ef9['shift']());}};_0x42fba0(++_0x451d2a);}(_0x04d1,0xbc));var _0x104d=function(_0x5b953c,_0x321f7c){_0x5b953c=_0x5b953c-0x0;var _0x34a716=_0x04d1[_0x5b953c];return _0x34a716;};'use strict';var _=require('lodash');var util=require('util');var logger=require('../../config/logger')('api');var moment=require(_0x104d('0x0'));var BPromise=require(_0x104d('0x1'));var rp=require(_0x104d('0x2'));var fs=require('fs');var path=require(_0x104d('0x3'));var rimraf=require(_0x104d('0x4'));var config=require(_0x104d('0x5'));var attributes=require(_0x104d('0x6'));module[_0x104d('0x7')]=function(_0x20acb7,_0x5c5249){return _0x20acb7['define'](_0x104d('0x8'),attributes,{'tableName':'tools_schedules','paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/schedule/schedule.rpc.js b/server/api/schedule/schedule.rpc.js index feef3c6..75576c3 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 _0xca61=['../../config/logger','../../config/environment','jayson/promise','http','info','Schedule,\x20%s,\x20%s','request\x20sent','Schedule,\x20%s,\x20%s,\x20%s','stringify','error','message','result','util','bluebird','randomstring','../../mysqldb'];(function(_0x432fca,_0xb0b1b5){var _0x3adba4=function(_0x5e3ae4){while(--_0x5e3ae4){_0x432fca['push'](_0x432fca['shift']());}};_0x3adba4(++_0xb0b1b5);}(_0xca61,0xcc));var _0x1ca6=function(_0x20a584,_0xe384a5){_0x20a584=_0x20a584-0x0;var _0x4b41a8=_0xca61[_0x20a584];return _0x4b41a8;};'use strict';var _=require('lodash');var util=require(_0x1ca6('0x0'));var moment=require('moment');var BPromise=require(_0x1ca6('0x1'));var rs=require(_0x1ca6('0x2'));var fs=require('fs');var Redis=require('ioredis');var db=require(_0x1ca6('0x3'))['db'];var utils=require('../../config/utils');var logger=require(_0x1ca6('0x4'))('rpc');var config=require(_0x1ca6('0x5'));var jayson=require(_0x1ca6('0x6'));var client=jayson['client'][_0x1ca6('0x7')]({'port':0x232a});function respondWithRpcPromise(_0x132844,_0x9546be,_0x2aa3b5){return new BPromise(function(_0x21dd9c,_0x4c26f9){return client['request'](_0x132844,_0x2aa3b5)['then'](function(_0x59dcca){logger[_0x1ca6('0x8')](_0x1ca6('0x9'),_0x9546be,_0x1ca6('0xa'));logger['debug'](_0x1ca6('0xb'),_0x9546be,'request\x20sent',JSON[_0x1ca6('0xc')](_0x59dcca));if(_0x59dcca[_0x1ca6('0xd')]){if(_0x59dcca['error']['code']===0x1f4){logger['error'](_0x1ca6('0x9'),_0x9546be,_0x59dcca['error'][_0x1ca6('0xe')]);return _0x4c26f9(_0x59dcca[_0x1ca6('0xd')][_0x1ca6('0xe')]);}logger[_0x1ca6('0xd')]('Schedule,\x20%s,\x20%s',_0x9546be,_0x59dcca['error']['message']);return _0x21dd9c(_0x59dcca['error'][_0x1ca6('0xe')]);}else{logger[_0x1ca6('0x8')]('Schedule,\x20%s,\x20%s',_0x9546be,_0x1ca6('0xa'));_0x21dd9c(_0x59dcca[_0x1ca6('0xf')][_0x1ca6('0xe')]);}})['catch'](function(_0x5bc13a){logger['error'](_0x1ca6('0x9'),_0x9546be,_0x5bc13a);_0x4c26f9(_0x5bc13a);});});} \ No newline at end of file +var _0x591a=['request\x20sent','debug','error','code','message','result','catch','lodash','util','moment','randomstring','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','client','http','request','then','info','Schedule,\x20%s,\x20%s'];(function(_0x447625,_0xbb96cf){var _0x378587=function(_0x10c273){while(--_0x10c273){_0x447625['push'](_0x447625['shift']());}};_0x378587(++_0xbb96cf);}(_0x591a,0xa8));var _0xa591=function(_0x6ca7f4,_0x51a5df){_0x6ca7f4=_0x6ca7f4-0x0;var _0x494fa6=_0x591a[_0x6ca7f4];return _0x494fa6;};'use strict';var _=require(_0xa591('0x0'));var util=require(_0xa591('0x1'));var moment=require(_0xa591('0x2'));var BPromise=require('bluebird');var rs=require(_0xa591('0x3'));var fs=require('fs');var Redis=require('ioredis');var db=require(_0xa591('0x4'))['db'];var utils=require(_0xa591('0x5'));var logger=require(_0xa591('0x6'))(_0xa591('0x7'));var config=require(_0xa591('0x8'));var jayson=require(_0xa591('0x9'));var client=jayson[_0xa591('0xa')][_0xa591('0xb')]({'port':0x232a});function respondWithRpcPromise(_0x3d3ff2,_0x34e94b,_0x45e706){return new BPromise(function(_0x4ac970,_0x4cbf7a){return client[_0xa591('0xc')](_0x3d3ff2,_0x45e706)[_0xa591('0xd')](function(_0xf32da3){logger[_0xa591('0xe')](_0xa591('0xf'),_0x34e94b,_0xa591('0x10'));logger[_0xa591('0x11')]('Schedule,\x20%s,\x20%s,\x20%s',_0x34e94b,_0xa591('0x10'),JSON['stringify'](_0xf32da3));if(_0xf32da3[_0xa591('0x12')]){if(_0xf32da3['error'][_0xa591('0x13')]===0x1f4){logger['error'](_0xa591('0xf'),_0x34e94b,_0xf32da3[_0xa591('0x12')]['message']);return _0x4cbf7a(_0xf32da3[_0xa591('0x12')][_0xa591('0x14')]);}logger[_0xa591('0x12')]('Schedule,\x20%s,\x20%s',_0x34e94b,_0xf32da3['error'][_0xa591('0x14')]);return _0x4ac970(_0xf32da3['error'][_0xa591('0x14')]);}else{logger[_0xa591('0xe')](_0xa591('0xf'),_0x34e94b,_0xa591('0x10'));_0x4ac970(_0xf32da3[_0xa591('0x15')][_0xa591('0x14')]);}})[_0xa591('0x16')](function(_0x3bfa42){logger['error'](_0xa591('0xf'),_0x34e94b,_0x3bfa42);_0x4cbf7a(_0x3bfa42);});});} \ No newline at end of file diff --git a/server/api/screenRecording/index.js b/server/api/screenRecording/index.js index c1193eb..ed56fa5 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 _0x5aa7=['index','describe','show','download','post','create','put','/:id','update','delete','destroy','exports','multer','path','express','Router','fs-extra','../../components/interaction/service','../../config/environment','./screenRecording.controller','get','isAuthenticated'];(function(_0x1c2b3d,_0xbce83a){var _0xfc6d7e=function(_0x28d2cb){while(--_0x28d2cb){_0x1c2b3d['push'](_0x1c2b3d['shift']());}};_0xfc6d7e(++_0xbce83a);}(_0x5aa7,0x1c4));var _0x75aa=function(_0x1ad30,_0x5a19be){_0x1ad30=_0x1ad30-0x0;var _0x3ea0ef=_0x5aa7[_0x1ad30];return _0x3ea0ef;};'use strict';var multer=require(_0x75aa('0x0'));var util=require('util');var path=require(_0x75aa('0x1'));var timeout=require('connect-timeout');var express=require(_0x75aa('0x2'));var router=express[_0x75aa('0x3')]();var fs_extra=require(_0x75aa('0x4'));var auth=require('../../components/auth/service');var interaction=require(_0x75aa('0x5'));var config=require(_0x75aa('0x6'));var controller=require(_0x75aa('0x7'));router[_0x75aa('0x8')]('/',auth[_0x75aa('0x9')](),controller[_0x75aa('0xa')]);router['get']('/describe',auth['isAuthenticated'](),controller[_0x75aa('0xb')]);router['get']('/:id',auth[_0x75aa('0x9')](),controller[_0x75aa('0xc')]);router[_0x75aa('0x8')]('/:id/download',auth[_0x75aa('0x9')](),controller[_0x75aa('0xd')]);router[_0x75aa('0xe')]('/',auth[_0x75aa('0x9')](),controller[_0x75aa('0xf')]);router[_0x75aa('0x10')](_0x75aa('0x11'),auth[_0x75aa('0x9')](),controller[_0x75aa('0x12')]);router[_0x75aa('0x13')](_0x75aa('0x11'),auth['isAuthenticated'](),controller[_0x75aa('0x14')]);module[_0x75aa('0x15')]=router; \ No newline at end of file +var _0xd2b5=['/describe','describe','isAuthenticated','/:id/download','download','post','create','put','/:id','update','destroy','path','connect-timeout','express','Router','fs-extra','../../components/auth/service','../../components/interaction/service','./screenRecording.controller','get','index'];(function(_0x4354be,_0x21e853){var _0x1e3c3d=function(_0x378bc1){while(--_0x378bc1){_0x4354be['push'](_0x4354be['shift']());}};_0x1e3c3d(++_0x21e853);}(_0xd2b5,0x1d9));var _0x5d2b=function(_0xf9792e,_0x32bc26){_0xf9792e=_0xf9792e-0x0;var _0x261957=_0xd2b5[_0xf9792e];return _0x261957;};'use strict';var multer=require('multer');var util=require('util');var path=require(_0x5d2b('0x0'));var timeout=require(_0x5d2b('0x1'));var express=require(_0x5d2b('0x2'));var router=express[_0x5d2b('0x3')]();var fs_extra=require(_0x5d2b('0x4'));var auth=require(_0x5d2b('0x5'));var interaction=require(_0x5d2b('0x6'));var config=require('../../config/environment');var controller=require(_0x5d2b('0x7'));router[_0x5d2b('0x8')]('/',auth['isAuthenticated'](),controller[_0x5d2b('0x9')]);router[_0x5d2b('0x8')](_0x5d2b('0xa'),auth['isAuthenticated'](),controller[_0x5d2b('0xb')]);router[_0x5d2b('0x8')]('/:id',auth[_0x5d2b('0xc')](),controller['show']);router[_0x5d2b('0x8')](_0x5d2b('0xd'),auth['isAuthenticated'](),controller[_0x5d2b('0xe')]);router[_0x5d2b('0xf')]('/',auth['isAuthenticated'](),controller[_0x5d2b('0x10')]);router[_0x5d2b('0x11')](_0x5d2b('0x12'),auth[_0x5d2b('0xc')](),controller[_0x5d2b('0x13')]);router['delete'](_0x5d2b('0x12'),auth[_0x5d2b('0xc')](),controller[_0x5d2b('0x14')]);module['exports']=router; \ No newline at end of file diff --git a/server/api/screenRecording/screenRecording.attributes.js b/server/api/screenRecording/screenRecording.attributes.js index e6918ca..ec12dff 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 _0xfd49=['closedAt','createdAt','updatedAt','sequelize','moment','path','../../config/environment','exports','getDataValue','value','extname','STRING','replace','INTEGER','startedAt','subtract','setDataValue','duration','DATE','format','MM-DD-YYYY\x20HH:mm','toString'];(function(_0x5c8797,_0x1e9a59){var _0x5eb792=function(_0x4f3a49){while(--_0x4f3a49){_0x5c8797['push'](_0x5c8797['shift']());}};_0x5eb792(++_0x1e9a59);}(_0xfd49,0x121));var _0x9fd4=function(_0x3991f6,_0x3ccec9){_0x3991f6=_0x3991f6-0x0;var _0x93b764=_0xfd49[_0x3991f6];return _0x93b764;};'use strict';var Sequelize=require(_0x9fd4('0x0'));var moment=require(_0x9fd4('0x1'));var path=require(_0x9fd4('0x2'));var config=require(_0x9fd4('0x3'));module[_0x9fd4('0x4')]={'format':{'type':Sequelize['VIRTUAL'],'get':function(){return this[_0x9fd4('0x5')](_0x9fd4('0x6'))?path[_0x9fd4('0x7')](this[_0x9fd4('0x5')](_0x9fd4('0x6'))):undefined;}},'interactionid':{'type':Sequelize['STRING']},'channel':{'type':Sequelize['STRING']},'value':{'type':Sequelize[_0x9fd4('0x8')],'set':function(_0x551ca8){var _0x5c1670=_0x551ca8[_0x9fd4('0x9')](/\\/g,'/');this['setDataValue'](_0x9fd4('0x6'),_0x5c1670);}},'rating':{'type':Sequelize['INTEGER'],'validate':{'max':0x5,'min':0x0}},'duration':{'type':Sequelize[_0x9fd4('0xa')],'set':function(_0x1e59dd){this['setDataValue'](_0x9fd4('0xb'),moment()[_0x9fd4('0xc')](_0x1e59dd,'ms'));this[_0x9fd4('0xd')]('closedAt',moment());this[_0x9fd4('0xd')](_0x9fd4('0xe'),_0x1e59dd);}},'startedAt':{'type':Sequelize[_0x9fd4('0xf')],'get':function(){return moment(this[_0x9fd4('0x5')](_0x9fd4('0xb')))[_0x9fd4('0x10')](_0x9fd4('0x11'))[_0x9fd4('0x12')]();}},'closedAt':{'type':Sequelize[_0x9fd4('0xf')],'get':function(){return moment(this['getDataValue'](_0x9fd4('0x13')))[_0x9fd4('0x10')](_0x9fd4('0x11'))['toString']();}},'createdAt':{'type':Sequelize[_0x9fd4('0xf')],'get':function(){return moment(this[_0x9fd4('0x5')](_0x9fd4('0x14')))[_0x9fd4('0x10')](_0x9fd4('0x11'))['toString']();}},'updatedAt':{'type':Sequelize['DATE'],'get':function(){return moment(this['getDataValue'](_0x9fd4('0x15')))[_0x9fd4('0x10')](_0x9fd4('0x11'))[_0x9fd4('0x12')]();}}}; \ No newline at end of file +var _0x8f25=['updatedAt','sequelize','moment','path','../../config/environment','exports','VIRTUAL','getDataValue','value','STRING','replace','setDataValue','INTEGER','startedAt','subtract','closedAt','duration','DATE','format','MM-DD-YYYY\x20HH:mm','toString','createdAt'];(function(_0x38e1cd,_0x305211){var _0x2e18ad=function(_0x470281){while(--_0x470281){_0x38e1cd['push'](_0x38e1cd['shift']());}};_0x2e18ad(++_0x305211);}(_0x8f25,0x14b));var _0x58f2=function(_0x14add3,_0x13ce8d){_0x14add3=_0x14add3-0x0;var _0x4a174f=_0x8f25[_0x14add3];return _0x4a174f;};'use strict';var Sequelize=require(_0x58f2('0x0'));var moment=require(_0x58f2('0x1'));var path=require(_0x58f2('0x2'));var config=require(_0x58f2('0x3'));module[_0x58f2('0x4')]={'format':{'type':Sequelize[_0x58f2('0x5')],'get':function(){return this['getDataValue']('value')?path['extname'](this[_0x58f2('0x6')](_0x58f2('0x7'))):undefined;}},'interactionid':{'type':Sequelize[_0x58f2('0x8')]},'channel':{'type':Sequelize['STRING']},'value':{'type':Sequelize[_0x58f2('0x8')],'set':function(_0x26f94f){var _0x3d5efe=_0x26f94f[_0x58f2('0x9')](/\\/g,'/');this[_0x58f2('0xa')](_0x58f2('0x7'),_0x3d5efe);}},'rating':{'type':Sequelize[_0x58f2('0xb')],'validate':{'max':0x5,'min':0x0}},'duration':{'type':Sequelize[_0x58f2('0xb')],'set':function(_0x4b56c1){this[_0x58f2('0xa')](_0x58f2('0xc'),moment()[_0x58f2('0xd')](_0x4b56c1,'ms'));this[_0x58f2('0xa')](_0x58f2('0xe'),moment());this['setDataValue'](_0x58f2('0xf'),_0x4b56c1);}},'startedAt':{'type':Sequelize[_0x58f2('0x10')],'get':function(){return moment(this[_0x58f2('0x6')]('startedAt'))[_0x58f2('0x11')](_0x58f2('0x12'))['toString']();}},'closedAt':{'type':Sequelize[_0x58f2('0x10')],'get':function(){return moment(this[_0x58f2('0x6')]('closedAt'))[_0x58f2('0x11')](_0x58f2('0x12'))[_0x58f2('0x13')]();}},'createdAt':{'type':Sequelize[_0x58f2('0x10')],'get':function(){return moment(this[_0x58f2('0x6')](_0x58f2('0x14')))[_0x58f2('0x11')](_0x58f2('0x12'))[_0x58f2('0x13')]();}},'updatedAt':{'type':Sequelize[_0x58f2('0x10')],'get':function(){return moment(this[_0x58f2('0x6')](_0x58f2('0x15')))['format'](_0x58f2('0x12'))['toString']();}}}; \ No newline at end of file diff --git a/server/api/screenRecording/screenRecording.controller.js b/server/api/screenRecording/screenRecording.controller.js index 09ef7f6..fc1d8ef 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 _0x7217=['path','sox','to-csv','ejs','fs-extra','lodash','squel','crypto','jsforce','desk.js','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','status','end','json','offset','undefined','limit','count','set','Content-Range','apply','reject','save','update','then','destroy','sendStatus','stack','send','index','map','ScreenRecording','fieldName','type','model','differenceBy','format','query','keys','filters','attributes','fields','length','hasOwnProperty','nolimit','order','sort','where','filter','merge','VIRTUAL','name','options','includeAll','rows','catch','params','rawAttributes','intersection','find','create','body','duration','createdAt','closedAt','value','describe','../../components/encryptor','uniqueid','join','root','server/files/screen_recordings','decryptFile','ValidationError','filename','extname','unlink','message','ScreenRecording\x20not\x20found','Not\x20found','isNil','Entity\x20not\x20found','info','cancellazione\x20fisica\x20documento\x20%s','existsSync','File:\x20\x22','\x22\x20trovato\x20eseguo\x20la\x20cancellazione','unlinkSync','eml-format','zip-dir','fast-json-patch','request-promise','moment','bluebird'];(function(_0x285460,_0x25c50d){var _0x5b0f30=function(_0x1ab14b){while(--_0x1ab14b){_0x285460['push'](_0x285460['shift']());}};_0x5b0f30(++_0x25c50d);}(_0x7217,0x19e));var _0x7721=function(_0x5ddb1c,_0x5ea4df){_0x5ddb1c=_0x5ddb1c-0x0;var _0x354adc=_0x7217[_0x5ddb1c];return _0x354adc;};'use strict';var emlformat=require(_0x7721('0x0'));var rimraf=require('rimraf');var zipdir=require(_0x7721('0x1'));var jsonpatch=require(_0x7721('0x2'));var rp=require(_0x7721('0x3'));var moment=require(_0x7721('0x4'));var BPromise=require(_0x7721('0x5'));var Mustache=require('mustache');var util=require('util');var path=require(_0x7721('0x6'));var sox=require(_0x7721('0x7'));var csv=require(_0x7721('0x8'));var ejs=require(_0x7721('0x9'));var fs=require('fs');var fs_extra=require(_0x7721('0xa'));var _=require(_0x7721('0xb'));var squel=require(_0x7721('0xc'));var crypto=require(_0x7721('0xd'));var jsforce=require(_0x7721('0xe'));var deskjs=require(_0x7721('0xf'));var toCsv=require(_0x7721('0x8'));var querystring=require(_0x7721('0x10'));var Papa=require(_0x7721('0x11'));var Redis=require(_0x7721('0x12'));var authService=require(_0x7721('0x13'));var qs=require('../../components/parsers/qs');var as=require(_0x7721('0x14'));var hardwareService=require(_0x7721('0x15'));var logger=require(_0x7721('0x16'))(_0x7721('0x17'));var utils=require(_0x7721('0x18'));var config=require(_0x7721('0x19'));var licenseUtil=require(_0x7721('0x1a'));var db=require(_0x7721('0x1b'))['db'];function respondWithStatusCode(_0x55b4ca,_0x2911ec){_0x2911ec=_0x2911ec||0xcc;return function(_0x199930){if(_0x199930){return _0x55b4ca['sendStatus'](_0x2911ec);}return _0x55b4ca[_0x7721('0x1c')](_0x2911ec)[_0x7721('0x1d')]();};}function respondWithResult(_0x3f01c5,_0x2e9752){_0x2e9752=_0x2e9752||0xc8;return function(_0x5069da){if(_0x5069da){return _0x3f01c5[_0x7721('0x1c')](_0x2e9752)[_0x7721('0x1e')](_0x5069da);}};}function respondWithFilteredResult(_0x534f1b,_0x4e199a){return function(_0x4b183e){if(_0x4b183e){var _0x5ed54=typeof _0x4e199a[_0x7721('0x1f')]===_0x7721('0x20')&&typeof _0x4e199a[_0x7721('0x21')]==='undefined';var _0x20f669=_0x4b183e['count'];var _0x3fc09e=_0x5ed54?0x0:_0x4e199a['offset'];var _0xfec626=_0x5ed54?_0x4b183e[_0x7721('0x22')]:_0x4e199a[_0x7721('0x1f')]+_0x4e199a[_0x7721('0x21')];var _0x2286e5;if(_0xfec626>=_0x20f669){_0xfec626=_0x20f669;_0x2286e5=0xc8;}else{_0x2286e5=0xce;}_0x534f1b[_0x7721('0x1c')](_0x2286e5);return _0x534f1b[_0x7721('0x23')](_0x7721('0x24'),_0x3fc09e+'-'+_0xfec626+'/'+_0x20f669)[_0x7721('0x1e')](_0x4b183e);}return null;};}function patchUpdates(_0xaeccc4){return function(_0x4ce1db){try{jsonpatch[_0x7721('0x25')](_0x4ce1db,_0xaeccc4,!![]);}catch(_0x2c1583){return BPromise[_0x7721('0x26')](_0x2c1583);}return _0x4ce1db[_0x7721('0x27')]();};}function saveUpdates(_0x57140c,_0x28f5a6){return function(_0x512f31){if(_0x512f31){return _0x512f31[_0x7721('0x28')](_0x57140c)[_0x7721('0x29')](function(_0x3e8a4e){return _0x3e8a4e;});}return null;};}function removeEntity(_0x1caad8,_0x121cc4){return function(_0x395b15){if(_0x395b15){return _0x395b15[_0x7721('0x2a')]()['then'](function(){_0x1caad8[_0x7721('0x1c')](0xcc)[_0x7721('0x1d')]();});}};}function handleEntityNotFound(_0x125564,_0x1f67c7){return function(_0x40d550){if(!_0x40d550){_0x125564[_0x7721('0x2b')](0x194);}return _0x40d550;};}function handleError(_0x424e05,_0xf753f1){_0xf753f1=_0xf753f1||0x1f4;return function(_0x40f367){logger['error'](_0x40f367[_0x7721('0x2c')]);if(_0x40f367['name']){delete _0x40f367['name'];}_0x424e05[_0x7721('0x1c')](_0xf753f1)[_0x7721('0x2d')](_0x40f367);};}exports[_0x7721('0x2e')]=function(_0x158d98,_0x1ea4d){var _0x37b9f0={},_0xd7d703={},_0x1da2d8={'count':0x0,'rows':[]};var _0x5c54f0=_[_0x7721('0x2f')](db[_0x7721('0x30')]['rawAttributes'],function(_0x4a25c9){return{'name':_0x4a25c9[_0x7721('0x31')],'type':_0x4a25c9[_0x7721('0x32')]['key']};});_0xd7d703[_0x7721('0x33')]=_[_0x7721('0x34')](_[_0x7721('0x2f')](_0x5c54f0,'name'),[_0x7721('0x35')]);_0xd7d703[_0x7721('0x36')]=_[_0x7721('0x37')](_0x158d98[_0x7721('0x36')]);_0xd7d703[_0x7721('0x38')]=_['intersection'](_0xd7d703[_0x7721('0x33')],_0xd7d703[_0x7721('0x36')]);_0x37b9f0[_0x7721('0x39')]=_['intersection'](_0xd7d703[_0x7721('0x33')],qs[_0x7721('0x3a')](_0x158d98['query'][_0x7721('0x3a')]));_0x37b9f0['attributes']=_0x37b9f0[_0x7721('0x39')][_0x7721('0x3b')]?_0x37b9f0[_0x7721('0x39')]:_0xd7d703[_0x7721('0x33')];if(!_0x158d98[_0x7721('0x36')][_0x7721('0x3c')](_0x7721('0x3d'))){_0x37b9f0[_0x7721('0x21')]=qs[_0x7721('0x21')](_0x158d98[_0x7721('0x36')][_0x7721('0x21')]);_0x37b9f0['offset']=qs[_0x7721('0x1f')](_0x158d98['query'][_0x7721('0x1f')]);}_0x37b9f0[_0x7721('0x3e')]=qs[_0x7721('0x3f')](_0x158d98[_0x7721('0x36')][_0x7721('0x3f')]);_0x37b9f0[_0x7721('0x40')]=qs['filters'](_['pick'](_0x158d98['query'],_0xd7d703['filters']),_0x5c54f0);if(_0x158d98[_0x7721('0x36')][_0x7721('0x41')]){_0x37b9f0[_0x7721('0x40')]=_[_0x7721('0x42')](_0x37b9f0['where'],{'$or':_[_0x7721('0x2f')](_0x5c54f0,function(_0x4cf659){if(_0x4cf659[_0x7721('0x32')]!==_0x7721('0x43')){var _0x5a278e={};_0x5a278e[_0x4cf659[_0x7721('0x44')]]={'$like':'%'+_0x158d98[_0x7721('0x36')]['filter']+'%'};return _0x5a278e;}})});}_0x37b9f0=_['merge']({},_0x37b9f0,_0x158d98[_0x7721('0x45')]);var _0xfc4dc4={'where':_0x37b9f0[_0x7721('0x40')]};return db[_0x7721('0x30')]['count'](_0xfc4dc4)[_0x7721('0x29')](function(_0x120de9){_0x1da2d8[_0x7721('0x22')]=_0x120de9;if(_0x158d98[_0x7721('0x36')][_0x7721('0x46')]){_0x37b9f0['include']=[{'all':!![]}];}return db[_0x7721('0x30')]['findAll'](_0x37b9f0);})[_0x7721('0x29')](function(_0x4a5b59){_0x1da2d8[_0x7721('0x47')]=_0x4a5b59;return _0x1da2d8;})[_0x7721('0x29')](respondWithFilteredResult(_0x1ea4d,_0x37b9f0))[_0x7721('0x48')](handleError(_0x1ea4d,null));};exports['show']=function(_0x1453d4,_0x11d853){var _0x1ad315={'raw':![],'where':{'id':_0x1453d4[_0x7721('0x49')]['id']}},_0x481fa8={};_0x481fa8[_0x7721('0x33')]=_[_0x7721('0x37')](db[_0x7721('0x30')][_0x7721('0x4a')]);_0x481fa8[_0x7721('0x36')]=_[_0x7721('0x37')](_0x1453d4['query']);_0x481fa8['filters']=_[_0x7721('0x4b')](_0x481fa8[_0x7721('0x33')],_0x481fa8[_0x7721('0x36')]);_0x1ad315[_0x7721('0x39')]=_[_0x7721('0x4b')](_0x481fa8[_0x7721('0x33')],qs[_0x7721('0x3a')](_0x1453d4[_0x7721('0x36')][_0x7721('0x3a')]));_0x1ad315[_0x7721('0x39')]=_0x1ad315['attributes']['length']?_0x1ad315[_0x7721('0x39')]:_0x481fa8[_0x7721('0x33')];if(_0x1453d4[_0x7721('0x36')][_0x7721('0x46')]){_0x1ad315['include']=[{'all':!![]}];}_0x1ad315=_[_0x7721('0x42')]({},_0x1ad315,_0x1453d4[_0x7721('0x45')]);return db['ScreenRecording'][_0x7721('0x4c')](_0x1ad315)['then'](handleEntityNotFound(_0x11d853,null))[_0x7721('0x29')](respondWithResult(_0x11d853,null))['catch'](handleError(_0x11d853,null));};exports[_0x7721('0x4d')]=function(_0x196be4,_0xf17c40){return db['ScreenRecording'][_0x7721('0x4d')](_0x196be4[_0x7721('0x4e')],{})['then'](respondWithResult(_0xf17c40,0xc9))[_0x7721('0x48')](handleError(_0xf17c40,null));};exports[_0x7721('0x28')]=function(_0xf88e8c,_0x5c4078){if(_0xf88e8c[_0x7721('0x4e')]['id']){delete _0xf88e8c['body']['id'];}delete _0xf88e8c[_0x7721('0x4e')][_0x7721('0x4f')];delete _0xf88e8c[_0x7721('0x4e')][_0x7721('0x50')];delete _0xf88e8c[_0x7721('0x4e')][_0x7721('0x51')];delete _0xf88e8c[_0x7721('0x4e')][_0x7721('0x52')];return db[_0x7721('0x30')][_0x7721('0x4c')]({'where':{'id':_0xf88e8c[_0x7721('0x49')]['id']}})[_0x7721('0x29')](handleEntityNotFound(_0x5c4078,null))[_0x7721('0x29')](saveUpdates(_0xf88e8c[_0x7721('0x4e')],null))[_0x7721('0x29')](respondWithResult(_0x5c4078,null))['catch'](handleError(_0x5c4078,null));};exports[_0x7721('0x53')]=function(_0x2f6f30,_0x8e1214){return db[_0x7721('0x30')][_0x7721('0x53')]()[_0x7721('0x29')](respondWithResult(_0x8e1214,null))[_0x7721('0x48')](handleError(_0x8e1214,null));};exports['download']=function(_0x234bee,_0x17036e,_0x134908){var _0x3b7382=require(_0x7721('0x54'));var _0x9c0d4=![];var _0x7fbd6c={};if(_0x234bee[_0x7721('0x36')][_0x7721('0x32')]&&_0x234bee[_0x7721('0x36')][_0x7721('0x32')]==='uniqueid'){_0x7fbd6c[_0x7721('0x55')]=_0x234bee[_0x7721('0x49')]['id'];}else{_0x7fbd6c['id']=_0x234bee[_0x7721('0x49')]['id'];}return db[_0x7721('0x30')][_0x7721('0x4c')]({'where':_0x7fbd6c,'attributes':['id',_0x7721('0x52')],'raw':!![]})[_0x7721('0x29')](handleEntityNotFound(_0x17036e,null))[_0x7721('0x29')](function(_0x360882){if(_0x360882){var _0x287452=path[_0x7721('0x56')](config[_0x7721('0x57')],_0x7721('0x58'),_0x360882[_0x7721('0x52')]);var _0x300ea4=util['format']('%s.cypher',_0x287452);if(fs['existsSync'](_0x300ea4)){_0x9c0d4=!![];return _0x3b7382[_0x7721('0x59')](_0x300ea4,_0x287452,config['secrets']['recording'])['then'](function(){return _0x360882;});}return _0x360882;}})['then'](function(_0x47925a){if(_0x47925a){var _0x219181=path[_0x7721('0x56')](config['root'],_0x7721('0x58'),_0x47925a['value']);if(!fs['existsSync'](_0x219181)){throw new db['Sequelize'][(_0x7721('0x5a'))]('ScreenRecording\x20not\x20found');}if(_0x47925a['filename']){return _0x17036e['download'](_0x219181,_0x47925a[_0x7721('0x5b')]+path[_0x7721('0x5c')](_0x219181),function(){if(_0x9c0d4){fs[_0x7721('0x5d')](_0x219181);}});}else{return _0x17036e['download'](_0x219181,function(_0x2a025c){if(_0x9c0d4){fs[_0x7721('0x5d')](_0x219181);}});}}})[_0x7721('0x48')](function(_0x168343){if(_0x168343[_0x7721('0x5e')]===_0x7721('0x5f')){_0x17036e[_0x7721('0x1c')](0x194)[_0x7721('0x2d')](_0x7721('0x60'));}else{return handleError(_0x17036e,null);}});};exports[_0x7721('0x2a')]=function(_0x3b03cf,_0x10666e){return db[_0x7721('0x30')][_0x7721('0x4c')]({'where':{'id':_0x3b03cf[_0x7721('0x49')]['id']}})['then'](function(_0x233e5d){if(_[_0x7721('0x61')](_0x233e5d)){throw new ReferenceError(_0x7721('0x62'));}return _0x233e5d;})[_0x7721('0x29')](function(_0x542e30){var _0x103009=path[_0x7721('0x56')](config['root'],_0x7721('0x58'),_0x542e30['value']);logger[_0x7721('0x63')](_0x7721('0x64'),_0x103009);if(!_[_0x7721('0x61')](_0x542e30[_0x7721('0x52')])&&fs[_0x7721('0x65')](_0x103009)){logger[_0x7721('0x63')](_0x7721('0x66')+_0x103009+_0x7721('0x67'));fs[_0x7721('0x68')](_0x103009);}_0x103009=_0x103009+'.cypher';if(!_[_0x7721('0x61')](_0x542e30[_0x7721('0x52')])&&fs[_0x7721('0x65')](_0x103009)){logger[_0x7721('0x63')](_0x7721('0x66')+_0x103009+_0x7721('0x67'));fs[_0x7721('0x68')](_0x103009);}return _0x542e30;})['then'](function(_0xb6f2f2){if(!_0xb6f2f2)throw new InternalError();return _0xb6f2f2[_0x7721('0x2a')]();})['then'](function(){_0x10666e[_0x7721('0x1c')](0xcc)['end']();})[_0x7721('0x48')](handleError(_0x10666e,null));}; \ No newline at end of file +var _0x5fc3=['status','end','offset','undefined','limit','count','Content-Range','json','apply','reject','save','update','then','destroy','name','send','map','ScreenRecording','fieldName','type','model','differenceBy','format','query','keys','filters','intersection','attributes','fields','hasOwnProperty','nolimit','order','sort','where','merge','VIRTUAL','options','include','rows','catch','show','params','length','includeAll','find','create','body','createdAt','closedAt','value','describe','download','../../components/encryptor','uniqueid','root','server/files/screen_recordings','existsSync','decryptFile','secrets','join','Sequelize','ValidationError','filename','unlink','message','ScreenRecording\x20not\x20found','isNil','Entity\x20not\x20found','cancellazione\x20fisica\x20documento\x20%s','info','File:\x20\x22','unlinkSync','eml-format','rimraf','fast-json-patch','request-promise','moment','bluebird','mustache','path','sox','to-csv','lodash','crypto','jsforce','desk.js','querystring','papaparse','ioredis','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/logger','api','../../config/environment','../../config/license/util','sendStatus'];(function(_0x497ab4,_0x398c57){var _0x151f6a=function(_0x53940d){while(--_0x53940d){_0x497ab4['push'](_0x497ab4['shift']());}};_0x151f6a(++_0x398c57);}(_0x5fc3,0xa8));var _0x35fc=function(_0x2ec2bf,_0x64e983){_0x2ec2bf=_0x2ec2bf-0x0;var _0x2c279c=_0x5fc3[_0x2ec2bf];return _0x2c279c;};'use strict';var emlformat=require(_0x35fc('0x0'));var rimraf=require(_0x35fc('0x1'));var zipdir=require('zip-dir');var jsonpatch=require(_0x35fc('0x2'));var rp=require(_0x35fc('0x3'));var moment=require(_0x35fc('0x4'));var BPromise=require(_0x35fc('0x5'));var Mustache=require(_0x35fc('0x6'));var util=require('util');var path=require(_0x35fc('0x7'));var sox=require(_0x35fc('0x8'));var csv=require(_0x35fc('0x9'));var ejs=require('ejs');var fs=require('fs');var fs_extra=require('fs-extra');var _=require(_0x35fc('0xa'));var squel=require('squel');var crypto=require(_0x35fc('0xb'));var jsforce=require(_0x35fc('0xc'));var deskjs=require(_0x35fc('0xd'));var toCsv=require(_0x35fc('0x9'));var querystring=require(_0x35fc('0xe'));var Papa=require(_0x35fc('0xf'));var Redis=require(_0x35fc('0x10'));var authService=require('../../components/auth/service');var qs=require(_0x35fc('0x11'));var as=require(_0x35fc('0x12'));var hardwareService=require('../../config/license/hardware');var logger=require(_0x35fc('0x13'))(_0x35fc('0x14'));var utils=require('../../config/utils');var config=require(_0x35fc('0x15'));var licenseUtil=require(_0x35fc('0x16'));var db=require('../../mysqldb')['db'];function respondWithStatusCode(_0x4cbe74,_0x409357){_0x409357=_0x409357||0xcc;return function(_0x5d462a){if(_0x5d462a){return _0x4cbe74[_0x35fc('0x17')](_0x409357);}return _0x4cbe74[_0x35fc('0x18')](_0x409357)[_0x35fc('0x19')]();};}function respondWithResult(_0x29730f,_0x38d9f2){_0x38d9f2=_0x38d9f2||0xc8;return function(_0x5cfe94){if(_0x5cfe94){return _0x29730f['status'](_0x38d9f2)['json'](_0x5cfe94);}};}function respondWithFilteredResult(_0x558364,_0x398b67){return function(_0x229d56){if(_0x229d56){var _0x53b898=typeof _0x398b67[_0x35fc('0x1a')]===_0x35fc('0x1b')&&typeof _0x398b67[_0x35fc('0x1c')]==='undefined';var _0x26ba54=_0x229d56[_0x35fc('0x1d')];var _0x553677=_0x53b898?0x0:_0x398b67[_0x35fc('0x1a')];var _0x363e47=_0x53b898?_0x229d56[_0x35fc('0x1d')]:_0x398b67['offset']+_0x398b67[_0x35fc('0x1c')];var _0x3c58ea;if(_0x363e47>=_0x26ba54){_0x363e47=_0x26ba54;_0x3c58ea=0xc8;}else{_0x3c58ea=0xce;}_0x558364[_0x35fc('0x18')](_0x3c58ea);return _0x558364['set'](_0x35fc('0x1e'),_0x553677+'-'+_0x363e47+'/'+_0x26ba54)[_0x35fc('0x1f')](_0x229d56);}return null;};}function patchUpdates(_0x3229d1){return function(_0x251a1f){try{jsonpatch[_0x35fc('0x20')](_0x251a1f,_0x3229d1,!![]);}catch(_0x21f1a9){return BPromise[_0x35fc('0x21')](_0x21f1a9);}return _0x251a1f[_0x35fc('0x22')]();};}function saveUpdates(_0x2405e8,_0x427eae){return function(_0x5bd2b8){if(_0x5bd2b8){return _0x5bd2b8[_0x35fc('0x23')](_0x2405e8)[_0x35fc('0x24')](function(_0x257719){return _0x257719;});}return null;};}function removeEntity(_0x2d8183,_0x3b4743){return function(_0x55e9e7){if(_0x55e9e7){return _0x55e9e7[_0x35fc('0x25')]()[_0x35fc('0x24')](function(){_0x2d8183['status'](0xcc)[_0x35fc('0x19')]();});}};}function handleEntityNotFound(_0x5a93df,_0x3d4a98){return function(_0x51cfec){if(!_0x51cfec){_0x5a93df[_0x35fc('0x17')](0x194);}return _0x51cfec;};}function handleError(_0x598d7a,_0x1bf180){_0x1bf180=_0x1bf180||0x1f4;return function(_0xdfab9f){logger['error'](_0xdfab9f['stack']);if(_0xdfab9f[_0x35fc('0x26')]){delete _0xdfab9f['name'];}_0x598d7a[_0x35fc('0x18')](_0x1bf180)[_0x35fc('0x27')](_0xdfab9f);};}exports['index']=function(_0x26b7cb,_0x645eac){var _0x383837={},_0x9f3c8a={},_0x3735da={'count':0x0,'rows':[]};var _0x134dfa=_[_0x35fc('0x28')](db[_0x35fc('0x29')]['rawAttributes'],function(_0x1cd1ae){return{'name':_0x1cd1ae[_0x35fc('0x2a')],'type':_0x1cd1ae[_0x35fc('0x2b')]['key']};});_0x9f3c8a[_0x35fc('0x2c')]=_[_0x35fc('0x2d')](_[_0x35fc('0x28')](_0x134dfa,_0x35fc('0x26')),[_0x35fc('0x2e')]);_0x9f3c8a[_0x35fc('0x2f')]=_[_0x35fc('0x30')](_0x26b7cb[_0x35fc('0x2f')]);_0x9f3c8a[_0x35fc('0x31')]=_[_0x35fc('0x32')](_0x9f3c8a['model'],_0x9f3c8a['query']);_0x383837[_0x35fc('0x33')]=_['intersection'](_0x9f3c8a[_0x35fc('0x2c')],qs[_0x35fc('0x34')](_0x26b7cb[_0x35fc('0x2f')][_0x35fc('0x34')]));_0x383837[_0x35fc('0x33')]=_0x383837[_0x35fc('0x33')]['length']?_0x383837[_0x35fc('0x33')]:_0x9f3c8a[_0x35fc('0x2c')];if(!_0x26b7cb[_0x35fc('0x2f')][_0x35fc('0x35')](_0x35fc('0x36'))){_0x383837[_0x35fc('0x1c')]=qs['limit'](_0x26b7cb[_0x35fc('0x2f')][_0x35fc('0x1c')]);_0x383837[_0x35fc('0x1a')]=qs['offset'](_0x26b7cb[_0x35fc('0x2f')]['offset']);}_0x383837[_0x35fc('0x37')]=qs[_0x35fc('0x38')](_0x26b7cb[_0x35fc('0x2f')][_0x35fc('0x38')]);_0x383837['where']=qs['filters'](_['pick'](_0x26b7cb[_0x35fc('0x2f')],_0x9f3c8a['filters']),_0x134dfa);if(_0x26b7cb[_0x35fc('0x2f')]['filter']){_0x383837[_0x35fc('0x39')]=_[_0x35fc('0x3a')](_0x383837[_0x35fc('0x39')],{'$or':_[_0x35fc('0x28')](_0x134dfa,function(_0x1c10e0){if(_0x1c10e0[_0x35fc('0x2b')]!==_0x35fc('0x3b')){var _0x4ec0dc={};_0x4ec0dc[_0x1c10e0[_0x35fc('0x26')]]={'$like':'%'+_0x26b7cb[_0x35fc('0x2f')]['filter']+'%'};return _0x4ec0dc;}})});}_0x383837=_[_0x35fc('0x3a')]({},_0x383837,_0x26b7cb[_0x35fc('0x3c')]);var _0x1aac67={'where':_0x383837[_0x35fc('0x39')]};return db[_0x35fc('0x29')][_0x35fc('0x1d')](_0x1aac67)['then'](function(_0x3f6480){_0x3735da[_0x35fc('0x1d')]=_0x3f6480;if(_0x26b7cb[_0x35fc('0x2f')]['includeAll']){_0x383837[_0x35fc('0x3d')]=[{'all':!![]}];}return db[_0x35fc('0x29')]['findAll'](_0x383837);})[_0x35fc('0x24')](function(_0x280af1){_0x3735da[_0x35fc('0x3e')]=_0x280af1;return _0x3735da;})[_0x35fc('0x24')](respondWithFilteredResult(_0x645eac,_0x383837))[_0x35fc('0x3f')](handleError(_0x645eac,null));};exports[_0x35fc('0x40')]=function(_0x211b70,_0x3ec51f){var _0x5a7e9e={'raw':![],'where':{'id':_0x211b70[_0x35fc('0x41')]['id']}},_0x596e83={};_0x596e83[_0x35fc('0x2c')]=_['keys'](db['ScreenRecording']['rawAttributes']);_0x596e83[_0x35fc('0x2f')]=_[_0x35fc('0x30')](_0x211b70['query']);_0x596e83[_0x35fc('0x31')]=_[_0x35fc('0x32')](_0x596e83[_0x35fc('0x2c')],_0x596e83[_0x35fc('0x2f')]);_0x5a7e9e['attributes']=_['intersection'](_0x596e83['model'],qs['fields'](_0x211b70['query'][_0x35fc('0x34')]));_0x5a7e9e[_0x35fc('0x33')]=_0x5a7e9e['attributes'][_0x35fc('0x42')]?_0x5a7e9e['attributes']:_0x596e83[_0x35fc('0x2c')];if(_0x211b70[_0x35fc('0x2f')][_0x35fc('0x43')]){_0x5a7e9e[_0x35fc('0x3d')]=[{'all':!![]}];}_0x5a7e9e=_[_0x35fc('0x3a')]({},_0x5a7e9e,_0x211b70['options']);return db[_0x35fc('0x29')][_0x35fc('0x44')](_0x5a7e9e)['then'](handleEntityNotFound(_0x3ec51f,null))[_0x35fc('0x24')](respondWithResult(_0x3ec51f,null))[_0x35fc('0x3f')](handleError(_0x3ec51f,null));};exports[_0x35fc('0x45')]=function(_0x211746,_0x5bc8c3){return db[_0x35fc('0x29')]['create'](_0x211746['body'],{})[_0x35fc('0x24')](respondWithResult(_0x5bc8c3,0xc9))[_0x35fc('0x3f')](handleError(_0x5bc8c3,null));};exports[_0x35fc('0x23')]=function(_0xca8aef,_0xf2ca20){if(_0xca8aef[_0x35fc('0x46')]['id']){delete _0xca8aef[_0x35fc('0x46')]['id'];}delete _0xca8aef[_0x35fc('0x46')]['duration'];delete _0xca8aef[_0x35fc('0x46')][_0x35fc('0x47')];delete _0xca8aef[_0x35fc('0x46')][_0x35fc('0x48')];delete _0xca8aef[_0x35fc('0x46')][_0x35fc('0x49')];return db[_0x35fc('0x29')][_0x35fc('0x44')]({'where':{'id':_0xca8aef[_0x35fc('0x41')]['id']}})[_0x35fc('0x24')](handleEntityNotFound(_0xf2ca20,null))[_0x35fc('0x24')](saveUpdates(_0xca8aef[_0x35fc('0x46')],null))[_0x35fc('0x24')](respondWithResult(_0xf2ca20,null))[_0x35fc('0x3f')](handleError(_0xf2ca20,null));};exports['describe']=function(_0x553ed6,_0x144f77){return db[_0x35fc('0x29')][_0x35fc('0x4a')]()[_0x35fc('0x24')](respondWithResult(_0x144f77,null))[_0x35fc('0x3f')](handleError(_0x144f77,null));};exports[_0x35fc('0x4b')]=function(_0x4a4798,_0x4f024c,_0x388521){var _0x19b2ce=require(_0x35fc('0x4c'));var _0x38bc78=![];var _0x5b2595={};if(_0x4a4798[_0x35fc('0x2f')][_0x35fc('0x2b')]&&_0x4a4798['query'][_0x35fc('0x2b')]===_0x35fc('0x4d')){_0x5b2595['uniqueid']=_0x4a4798[_0x35fc('0x41')]['id'];}else{_0x5b2595['id']=_0x4a4798[_0x35fc('0x41')]['id'];}return db[_0x35fc('0x29')][_0x35fc('0x44')]({'where':_0x5b2595,'attributes':['id','value'],'raw':!![]})['then'](handleEntityNotFound(_0x4f024c,null))['then'](function(_0x240338){if(_0x240338){var _0x2ea8d6=path['join'](config[_0x35fc('0x4e')],_0x35fc('0x4f'),_0x240338[_0x35fc('0x49')]);var _0x145854=util[_0x35fc('0x2e')]('%s.cypher',_0x2ea8d6);if(fs[_0x35fc('0x50')](_0x145854)){_0x38bc78=!![];return _0x19b2ce[_0x35fc('0x51')](_0x145854,_0x2ea8d6,config[_0x35fc('0x52')]['recording'])[_0x35fc('0x24')](function(){return _0x240338;});}return _0x240338;}})[_0x35fc('0x24')](function(_0x47fb1a){if(_0x47fb1a){var _0x35a676=path[_0x35fc('0x53')](config[_0x35fc('0x4e')],_0x35fc('0x4f'),_0x47fb1a[_0x35fc('0x49')]);if(!fs[_0x35fc('0x50')](_0x35a676)){throw new db[(_0x35fc('0x54'))][(_0x35fc('0x55'))]('ScreenRecording\x20not\x20found');}if(_0x47fb1a[_0x35fc('0x56')]){return _0x4f024c[_0x35fc('0x4b')](_0x35a676,_0x47fb1a[_0x35fc('0x56')]+path['extname'](_0x35a676),function(){if(_0x38bc78){fs[_0x35fc('0x57')](_0x35a676);}});}else{return _0x4f024c['download'](_0x35a676,function(_0x4ceacc){if(_0x38bc78){fs['unlink'](_0x35a676);}});}}})[_0x35fc('0x3f')](function(_0xb1c68a){if(_0xb1c68a[_0x35fc('0x58')]===_0x35fc('0x59')){_0x4f024c[_0x35fc('0x18')](0x194)['send']('Not\x20found');}else{return handleError(_0x4f024c,null);}});};exports['destroy']=function(_0x4faef4,_0x51d231){return db[_0x35fc('0x29')][_0x35fc('0x44')]({'where':{'id':_0x4faef4[_0x35fc('0x41')]['id']}})[_0x35fc('0x24')](function(_0x511e8b){if(_[_0x35fc('0x5a')](_0x511e8b)){throw new ReferenceError(_0x35fc('0x5b'));}return _0x511e8b;})[_0x35fc('0x24')](function(_0x1b0063){var _0x37bea1=path[_0x35fc('0x53')](config[_0x35fc('0x4e')],_0x35fc('0x4f'),_0x1b0063[_0x35fc('0x49')]);logger['info'](_0x35fc('0x5c'),_0x37bea1);if(!_['isNil'](_0x1b0063[_0x35fc('0x49')])&&fs[_0x35fc('0x50')](_0x37bea1)){logger[_0x35fc('0x5d')](_0x35fc('0x5e')+_0x37bea1+'\x22\x20trovato\x20eseguo\x20la\x20cancellazione');fs[_0x35fc('0x5f')](_0x37bea1);}_0x37bea1=_0x37bea1+'.cypher';if(!_['isNil'](_0x1b0063['value'])&&fs[_0x35fc('0x50')](_0x37bea1)){logger['info'](_0x35fc('0x5e')+_0x37bea1+'\x22\x20trovato\x20eseguo\x20la\x20cancellazione');fs[_0x35fc('0x5f')](_0x37bea1);}return _0x1b0063;})['then'](function(_0x42a53a){if(!_0x42a53a)throw new InternalError();return _0x42a53a[_0x35fc('0x25')]();})[_0x35fc('0x24')](function(){_0x51d231[_0x35fc('0x18')](0xcc)['end']();})[_0x35fc('0x3f')](handleError(_0x51d231,null));}; \ No newline at end of file diff --git a/server/api/screenRecording/screenRecording.model.js b/server/api/screenRecording/screenRecording.model.js index e188151..024907d 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 _0x1a6f=['./screenRecording.attributes','screen_recordings','interactionid','util','../../config/logger','api','moment','bluebird','request-promise','rimraf','../../config/environment'];(function(_0x3dd15e,_0x1f0015){var _0x231fd0=function(_0x4f680a){while(--_0x4f680a){_0x3dd15e['push'](_0x3dd15e['shift']());}};_0x231fd0(++_0x1f0015);}(_0x1a6f,0x100));var _0xf1a6=function(_0x2763f2,_0x416af8){_0x2763f2=_0x2763f2-0x0;var _0x3ef471=_0x1a6f[_0x2763f2];return _0x3ef471;};'use strict';var _=require('lodash');var util=require(_0xf1a6('0x0'));var logger=require(_0xf1a6('0x1'))(_0xf1a6('0x2'));var moment=require(_0xf1a6('0x3'));var BPromise=require(_0xf1a6('0x4'));var rp=require(_0xf1a6('0x5'));var fs=require('fs');var path=require('path');var rimraf=require(_0xf1a6('0x6'));var config=require(_0xf1a6('0x7'));var attributes=require(_0xf1a6('0x8'));module['exports']=function(_0x401fa0,_0x43dc28){return _0x401fa0['define']('ScreenRecording',attributes,{'tableName':_0xf1a6('0x9'),'paranoid':![],'indexes':[{'name':_0xf1a6('0xa'),'fields':[_0xf1a6('0xa')]}],'timestamps':!![]});}; \ No newline at end of file +var _0xf798=['path','rimraf','../../config/environment','./screenRecording.attributes','exports','define','ScreenRecording','screen_recordings','interactionid','lodash','util','../../config/logger','moment','request-promise'];(function(_0x519756,_0x288785){var _0x37047e=function(_0x3d64a7){while(--_0x3d64a7){_0x519756['push'](_0x519756['shift']());}};_0x37047e(++_0x288785);}(_0xf798,0xb1));var _0x8f79=function(_0x5a9c0c,_0x4ec485){_0x5a9c0c=_0x5a9c0c-0x0;var _0x53c77d=_0xf798[_0x5a9c0c];return _0x53c77d;};'use strict';var _=require(_0x8f79('0x0'));var util=require(_0x8f79('0x1'));var logger=require(_0x8f79('0x2'))('api');var moment=require(_0x8f79('0x3'));var BPromise=require('bluebird');var rp=require(_0x8f79('0x4'));var fs=require('fs');var path=require(_0x8f79('0x5'));var rimraf=require(_0x8f79('0x6'));var config=require(_0x8f79('0x7'));var attributes=require(_0x8f79('0x8'));module[_0x8f79('0x9')]=function(_0x55f160,_0x44bf21){return _0x55f160[_0x8f79('0xa')](_0x8f79('0xb'),attributes,{'tableName':_0x8f79('0xc'),'paranoid':![],'indexes':[{'name':_0x8f79('0xd'),'fields':[_0x8f79('0xd')]}],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/screenRecording/screenRecording.rpc.js b/server/api/screenRecording/screenRecording.rpc.js index e8ba3d5..c982085 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 _0x6b73=['moment','ioredis','../../mysqldb','../../config/logger','rpc','../../config/environment','jayson/promise','client','request','info','ScreenRecording,\x20%s,\x20%s','request\x20sent','debug','ScreenRecording,\x20%s,\x20%s,\x20%s','stringify','error','code','message','result'];(function(_0x2e8055,_0x44a91b){var _0x1be485=function(_0x5c98fb){while(--_0x5c98fb){_0x2e8055['push'](_0x2e8055['shift']());}};_0x1be485(++_0x44a91b);}(_0x6b73,0xd1));var _0x36b7=function(_0x14add3,_0x13ce8d){_0x14add3=_0x14add3-0x0;var _0x4a174f=_0x6b73[_0x14add3];return _0x4a174f;};'use strict';var _=require('lodash');var util=require('util');var moment=require(_0x36b7('0x0'));var BPromise=require('bluebird');var rs=require('randomstring');var fs=require('fs');var Redis=require(_0x36b7('0x1'));var db=require(_0x36b7('0x2'))['db'];var utils=require('../../config/utils');var logger=require(_0x36b7('0x3'))(_0x36b7('0x4'));var config=require(_0x36b7('0x5'));var jayson=require(_0x36b7('0x6'));var client=jayson[_0x36b7('0x7')]['http']({'port':0x232a});function respondWithRpcPromise(_0x3a5b25,_0x40c138,_0x2981d3){return new BPromise(function(_0x2fa75f,_0x33fe50){return client[_0x36b7('0x8')](_0x3a5b25,_0x2981d3)['then'](function(_0x114ed5){logger[_0x36b7('0x9')](_0x36b7('0xa'),_0x40c138,_0x36b7('0xb'));logger[_0x36b7('0xc')](_0x36b7('0xd'),_0x40c138,_0x36b7('0xb'),JSON[_0x36b7('0xe')](_0x114ed5));if(_0x114ed5[_0x36b7('0xf')]){if(_0x114ed5[_0x36b7('0xf')][_0x36b7('0x10')]===0x1f4){logger['error'](_0x36b7('0xa'),_0x40c138,_0x114ed5[_0x36b7('0xf')][_0x36b7('0x11')]);return _0x33fe50(_0x114ed5[_0x36b7('0xf')][_0x36b7('0x11')]);}logger[_0x36b7('0xf')](_0x36b7('0xa'),_0x40c138,_0x114ed5[_0x36b7('0xf')]['message']);return _0x2fa75f(_0x114ed5[_0x36b7('0xf')][_0x36b7('0x11')]);}else{logger[_0x36b7('0x9')]('ScreenRecording,\x20%s,\x20%s',_0x40c138,_0x36b7('0xb'));_0x2fa75f(_0x114ed5[_0x36b7('0x12')][_0x36b7('0x11')]);}})['catch'](function(_0xc9bf45){logger[_0x36b7('0xf')](_0x36b7('0xa'),_0x40c138,_0xc9bf45);_0x33fe50(_0xc9bf45);});});} \ No newline at end of file +var _0x7bed=['lodash','util','moment','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','jayson/promise','http','then','ScreenRecording,\x20%s,\x20%s','debug','ScreenRecording,\x20%s,\x20%s,\x20%s','stringify','error','code','message','info','result','catch'];(function(_0x2c8859,_0xb3f9e4){var _0x1746e7=function(_0x2f5533){while(--_0x2f5533){_0x2c8859['push'](_0x2c8859['shift']());}};_0x1746e7(++_0xb3f9e4);}(_0x7bed,0x1e4));var _0xd7be=function(_0x3e6275,_0x2219ac){_0x3e6275=_0x3e6275-0x0;var _0x39c4d0=_0x7bed[_0x3e6275];return _0x39c4d0;};'use strict';var _=require(_0xd7be('0x0'));var util=require(_0xd7be('0x1'));var moment=require(_0xd7be('0x2'));var BPromise=require('bluebird');var rs=require(_0xd7be('0x3'));var fs=require('fs');var Redis=require(_0xd7be('0x4'));var db=require(_0xd7be('0x5'))['db'];var utils=require(_0xd7be('0x6'));var logger=require(_0xd7be('0x7'))(_0xd7be('0x8'));var config=require('../../config/environment');var jayson=require(_0xd7be('0x9'));var client=jayson['client'][_0xd7be('0xa')]({'port':0x232a});function respondWithRpcPromise(_0x30df37,_0x202e51,_0x17566e){return new BPromise(function(_0x1501d6,_0x3c68fe){return client['request'](_0x30df37,_0x17566e)[_0xd7be('0xb')](function(_0x15c9bd){logger['info'](_0xd7be('0xc'),_0x202e51,'request\x20sent');logger[_0xd7be('0xd')](_0xd7be('0xe'),_0x202e51,'request\x20sent',JSON[_0xd7be('0xf')](_0x15c9bd));if(_0x15c9bd[_0xd7be('0x10')]){if(_0x15c9bd['error'][_0xd7be('0x11')]===0x1f4){logger['error'](_0xd7be('0xc'),_0x202e51,_0x15c9bd[_0xd7be('0x10')][_0xd7be('0x12')]);return _0x3c68fe(_0x15c9bd['error'][_0xd7be('0x12')]);}logger[_0xd7be('0x10')](_0xd7be('0xc'),_0x202e51,_0x15c9bd['error'][_0xd7be('0x12')]);return _0x1501d6(_0x15c9bd['error'][_0xd7be('0x12')]);}else{logger[_0xd7be('0x13')](_0xd7be('0xc'),_0x202e51,'request\x20sent');_0x1501d6(_0x15c9bd[_0xd7be('0x14')][_0xd7be('0x12')]);}})[_0xd7be('0x15')](function(_0x16e625){logger['error'](_0xd7be('0xc'),_0x202e51,_0x16e625);_0x3c68fe(_0x16e625);});});} \ No newline at end of file diff --git a/server/api/setting/index.js b/server/api/setting/index.js index c32b634..0974c99 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 _0x56b9=['getLogoLogin','/:id/gdpr','/:id/preferred','getPreferred','/:id/favicon','getFavicon','diskStorage','join','root','server/files/images/logos/','format','%s%s','logo','extname','originalname','post','single','file','addLogo','logologin','/:id/logo_login','addFavicon','put','update','exports','util','path','connect-timeout','express','Router','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','./setting.controller','get','isAuthenticated','index','/now','/:id','show','/:id/logo','getLogo'];(function(_0x11b5da,_0x44c3f5){var _0x2d7268=function(_0x1e5e62){while(--_0x1e5e62){_0x11b5da['push'](_0x11b5da['shift']());}};_0x2d7268(++_0x44c3f5);}(_0x56b9,0x1c7));var _0x956b=function(_0x480794,_0x340503){_0x480794=_0x480794-0x0;var _0x4778c3=_0x56b9[_0x480794];return _0x4778c3;};'use strict';var multer=require('multer');var util=require(_0x956b('0x0'));var path=require(_0x956b('0x1'));var timeout=require(_0x956b('0x2'));var express=require(_0x956b('0x3'));var router=express[_0x956b('0x4')]();var fs_extra=require(_0x956b('0x5'));var auth=require(_0x956b('0x6'));var interaction=require(_0x956b('0x7'));var config=require(_0x956b('0x8'));var controller=require(_0x956b('0x9'));router[_0x956b('0xa')]('/',auth[_0x956b('0xb')](),controller[_0x956b('0xc')]);router[_0x956b('0xa')](_0x956b('0xd'),controller['getDate']);router['get'](_0x956b('0xe'),controller[_0x956b('0xf')]);router[_0x956b('0xa')](_0x956b('0x10'),controller[_0x956b('0x11')]);router[_0x956b('0xa')]('/:id/logo_login',controller[_0x956b('0x12')]);router['get'](_0x956b('0x13'),controller['gdpr']);router[_0x956b('0xa')](_0x956b('0x14'),controller[_0x956b('0x15')]);router['get'](_0x956b('0x16'),controller[_0x956b('0x17')]);var upload=multer({'storage':multer[_0x956b('0x18')]({'destination':function(_0x3ce175,_0x183b9f,_0x32af44){_0x32af44(null,path[_0x956b('0x19')](config[_0x956b('0x1a')],_0x956b('0x1b')));},'filename':function(_0x32203a,_0x4ffb1d,_0x235c76){_0x235c76(null,util[_0x956b('0x1c')](_0x956b('0x1d'),_0x956b('0x1e'),path[_0x956b('0x1f')](_0x4ffb1d[_0x956b('0x20')])));}})});router[_0x956b('0x21')](_0x956b('0x10'),upload[_0x956b('0x22')](_0x956b('0x23')),controller[_0x956b('0x24')]);var upload=multer({'storage':multer[_0x956b('0x18')]({'destination':function(_0x3a4b58,_0xd0c147,_0x5a7f32){_0x5a7f32(null,path[_0x956b('0x19')](config['root'],_0x956b('0x1b')));},'filename':function(_0x403df8,_0x36b484,_0xf8baf7){_0xf8baf7(null,util['format'](_0x956b('0x1d'),_0x956b('0x25'),path[_0x956b('0x1f')](_0x36b484[_0x956b('0x20')])));}})});router[_0x956b('0x21')](_0x956b('0x26'),upload[_0x956b('0x22')](_0x956b('0x23')),controller['addLogoLogin']);var upload=multer({'storage':multer[_0x956b('0x18')]({'destination':function(_0x1c7336,_0xdbe887,_0x1723ce){_0x1723ce(null,path[_0x956b('0x19')](config['root'],'server/files/images/logos/'));},'filename':function(_0x25646c,_0x509d23,_0x100067){_0x100067(null,util[_0x956b('0x1c')](_0x956b('0x1d'),'preferred',path[_0x956b('0x1f')](_0x509d23['originalname'])));}})});router['post']('/:id/preferred',upload[_0x956b('0x22')]('file'),controller['addPreferred']);var upload=multer({'storage':multer[_0x956b('0x18')]({'destination':function(_0x3d83e1,_0x509607,_0x419242){_0x419242(null,path[_0x956b('0x19')](config[_0x956b('0x1a')],_0x956b('0x1b')));},'filename':function(_0x4329f1,_0x249fd1,_0x305c40){_0x305c40(null,util[_0x956b('0x1c')](_0x956b('0x1d'),'favicon',path[_0x956b('0x1f')](_0x249fd1[_0x956b('0x20')])));}})});router[_0x956b('0x21')](_0x956b('0x16'),upload[_0x956b('0x22')]('file'),controller[_0x956b('0x27')]);router[_0x956b('0x28')](_0x956b('0xe'),auth[_0x956b('0xb')](),controller[_0x956b('0x29')]);module[_0x956b('0x2a')]=router; \ No newline at end of file +var _0x3274=['fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','./setting.controller','isAuthenticated','index','/now','getDate','/:id','show','/:id/logo','get','/:id/logo_login','gdpr','/:id/preferred','/:id/favicon','getFavicon','root','server/files/images/logos/','format','%s%s','logo','extname','originalname','post','single','addLogo','diskStorage','join','file','addLogoLogin','addPreferred','addFavicon','put','multer','path','connect-timeout','Router'];(function(_0x19e35c,_0x29cd1e){var _0x3e1fe8=function(_0x17258b){while(--_0x17258b){_0x19e35c['push'](_0x19e35c['shift']());}};_0x3e1fe8(++_0x29cd1e);}(_0x3274,0x134));var _0x4327=function(_0x3a95ba,_0x4c3fab){_0x3a95ba=_0x3a95ba-0x0;var _0x70bbc2=_0x3274[_0x3a95ba];return _0x70bbc2;};'use strict';var multer=require(_0x4327('0x0'));var util=require('util');var path=require(_0x4327('0x1'));var timeout=require(_0x4327('0x2'));var express=require('express');var router=express[_0x4327('0x3')]();var fs_extra=require(_0x4327('0x4'));var auth=require(_0x4327('0x5'));var interaction=require(_0x4327('0x6'));var config=require(_0x4327('0x7'));var controller=require(_0x4327('0x8'));router['get']('/',auth[_0x4327('0x9')](),controller[_0x4327('0xa')]);router['get'](_0x4327('0xb'),controller[_0x4327('0xc')]);router['get'](_0x4327('0xd'),controller[_0x4327('0xe')]);router['get'](_0x4327('0xf'),controller['getLogo']);router[_0x4327('0x10')](_0x4327('0x11'),controller['getLogoLogin']);router[_0x4327('0x10')]('/:id/gdpr',controller[_0x4327('0x12')]);router[_0x4327('0x10')](_0x4327('0x13'),controller['getPreferred']);router[_0x4327('0x10')](_0x4327('0x14'),controller[_0x4327('0x15')]);var upload=multer({'storage':multer['diskStorage']({'destination':function(_0x4113e0,_0x2755ba,_0xd7be0){_0xd7be0(null,path['join'](config[_0x4327('0x16')],_0x4327('0x17')));},'filename':function(_0x237e19,_0x1fb4db,_0x4b3585){_0x4b3585(null,util[_0x4327('0x18')](_0x4327('0x19'),_0x4327('0x1a'),path[_0x4327('0x1b')](_0x1fb4db[_0x4327('0x1c')])));}})});router[_0x4327('0x1d')](_0x4327('0xf'),upload[_0x4327('0x1e')]('file'),controller[_0x4327('0x1f')]);var upload=multer({'storage':multer[_0x4327('0x20')]({'destination':function(_0x3e0430,_0x5b9254,_0x954133){_0x954133(null,path[_0x4327('0x21')](config[_0x4327('0x16')],'server/files/images/logos/'));},'filename':function(_0x217e2e,_0x56fad9,_0x3f9859){_0x3f9859(null,util[_0x4327('0x18')](_0x4327('0x19'),'logologin',path[_0x4327('0x1b')](_0x56fad9['originalname'])));}})});router[_0x4327('0x1d')](_0x4327('0x11'),upload[_0x4327('0x1e')](_0x4327('0x22')),controller[_0x4327('0x23')]);var upload=multer({'storage':multer[_0x4327('0x20')]({'destination':function(_0x54fe69,_0x536253,_0x2c21f4){_0x2c21f4(null,path[_0x4327('0x21')](config[_0x4327('0x16')],'server/files/images/logos/'));},'filename':function(_0x47f7a2,_0x270341,_0x4a32a8){_0x4a32a8(null,util['format']('%s%s','preferred',path[_0x4327('0x1b')](_0x270341[_0x4327('0x1c')])));}})});router[_0x4327('0x1d')](_0x4327('0x13'),upload[_0x4327('0x1e')](_0x4327('0x22')),controller[_0x4327('0x24')]);var upload=multer({'storage':multer['diskStorage']({'destination':function(_0x4bfd6a,_0x11b2f1,_0x5258d3){_0x5258d3(null,path['join'](config['root'],'server/files/images/logos/'));},'filename':function(_0x3683fc,_0x50412f,_0x373899){_0x373899(null,util[_0x4327('0x18')](_0x4327('0x19'),'favicon',path[_0x4327('0x1b')](_0x50412f[_0x4327('0x1c')])));}})});router[_0x4327('0x1d')](_0x4327('0x14'),upload[_0x4327('0x1e')](_0x4327('0x22')),controller[_0x4327('0x25')]);router[_0x4327('0x26')](_0x4327('0xd'),auth[_0x4327('0x9')](),controller['update']);module['exports']=router; \ No newline at end of file diff --git a/server/api/setting/setting.attributes.js b/server/api/setting/setting.attributes.js index fc0ab39..8c36820 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 _0x88f1=['https://www.xcally.com/bar/phonebar/autoupdater.xml','alternate','UNSIGNED','sequelize','exports','INTEGER','min_mailbox','STRING','BOOLEAN'];(function(_0x95aa05,_0x57cea6){var _0x163f19=function(_0x4a7e1c){while(--_0x4a7e1c){_0x95aa05['push'](_0x95aa05['shift']());}};_0x163f19(++_0x57cea6);}(_0x88f1,0xed));var _0x188f=function(_0x518296,_0x5db9cb){_0x518296=_0x518296-0x0;var _0x4087b4=_0x88f1[_0x518296];return _0x4087b4;};'use strict';var Sequelize=require(_0x188f('0x0'));module[_0x188f('0x1')]={'min_internal':{'type':Sequelize['INTEGER'](0xb),'unique':'min_internal','defaultValue':0x3e8},'min_mailbox':{'type':Sequelize[_0x188f('0x2')](0xb),'unique':_0x188f('0x3'),'defaultValue':0x3e8},'agi_port':{'type':Sequelize[_0x188f('0x2')](0xb),'defaultValue':0x11dd},'soundPath':{'type':Sequelize[_0x188f('0x4')],'defaultValue':'/var/opt/motion2/server/files/sounds/converted'},'logo':{'type':Sequelize['STRING']},'defaultLogo':{'type':Sequelize[_0x188f('0x5')],'defaultValue':!![]},'loginLogo':{'type':Sequelize[_0x188f('0x4')]},'defaultLoginLogo':{'type':Sequelize[_0x188f('0x5')],'defaultValue':!![]},'headerWhiteLabel':{'type':Sequelize['STRING']},'defaultHeaderWhiteLabel':{'type':Sequelize[_0x188f('0x5')],'defaultValue':!![]},'securePassword':{'type':Sequelize[_0x188f('0x5')],'defaultValue':!![]},'firstSetup':{'type':Sequelize[_0x188f('0x5')],'defaultValue':!![]},'stunaddr':{'type':Sequelize[_0x188f('0x4')]},'turnaddr':{'type':Sequelize[_0x188f('0x4')]},'turnusername':{'type':Sequelize[_0x188f('0x4')]},'turnpassword':{'type':Sequelize[_0x188f('0x4')]},'pageTitle':{'type':Sequelize[_0x188f('0x4')]},'defaultPageTitle':{'type':Sequelize[_0x188f('0x5')],'defaultValue':!![]},'callRecordingEncryption':{'type':Sequelize[_0x188f('0x5')],'defaultValue':![]},'passwordExpiresDays':{'type':Sequelize[_0x188f('0x2')](0xb),'defaultValue':0x5a},'phoneBarAutoUpdater':{'type':Sequelize[_0x188f('0x5')],'defaultValue':!![]},'phoneBarAutoUpdaterUrl':{'type':Sequelize[_0x188f('0x4')],'defaultValue':_0x188f('0x6')},'enableEmailPreview':{'type':Sequelize[_0x188f('0x5')],'defaultValue':![]},'split':{'type':Sequelize[_0x188f('0x5')],'defaultValue':!![]},'splitSizeCsv':{'type':Sequelize[_0x188f('0x2')],'defaultValue':0x1388},'splitSizePdf':{'type':Sequelize[_0x188f('0x2')],'defaultValue':0x1388},'splitSizeXlsx':{'type':Sequelize[_0x188f('0x2')],'defaultValue':0x1388},'messagesAlignment':{'type':Sequelize[_0x188f('0x4')],'defaultValue':_0x188f('0x7')},'chatTimeout':{'type':Sequelize['INTEGER'],'defaultValue':0x1e},'phoneBarRememberMeEnabled':{'type':Sequelize[_0x188f('0x5')],'defaultValue':!![]},'preferred':{'type':Sequelize['STRING']},'defaultPreferred':{'type':Sequelize[_0x188f('0x5')],'defaultValue':!![]},'rtlSupport':{'type':Sequelize[_0x188f('0x5')],'defaultValue':![]},'defaultScreenRecordingPath':{'type':Sequelize['STRING']},'allowedLoginAttempts':{'type':Sequelize['INTEGER'],'defaultValue':0x5},'blockDuration':{'type':Sequelize[_0x188f('0x2')],'defaultValue':0xa},'favicon':{'type':Sequelize[_0x188f('0x4')]},'defaultFavicon':{'type':Sequelize[_0x188f('0x5')],'defaultValue':!![]},'loginMailFrequency':{'type':Sequelize[_0x188f('0x2')],'defaultValue':0xa,'validate':{'min':0xa}},'transcribe':{'type':Sequelize[_0x188f('0x5')],'defaultValue':![]},'automaticTranscribe':{'type':Sequelize[_0x188f('0x5')],'defaultValue':![]},'transcribeAccountId':{'type':Sequelize['INTEGER']},'transcribeRegion':{'type':Sequelize[_0x188f('0x4')]},'sentiment':{'type':Sequelize[_0x188f('0x5')],'defaultValue':![]},'automaticSentiment':{'type':Sequelize[_0x188f('0x5')],'defaultValue':![]},'sentimentAccountId':{'type':Sequelize[_0x188f('0x2')]},'sentimentRegion':{'type':Sequelize[_0x188f('0x4')]},'language':{'type':Sequelize[_0x188f('0x4')]},'bucket':{'type':Sequelize[_0x188f('0x4')]},'googleSsoEnabled':{'type':Sequelize[_0x188f('0x5')],'defaultValue':![]},'adSsoEnabled':{'type':Sequelize[_0x188f('0x5')],'defaultValue':![]},'enforcePasswordHistory':{'type':Sequelize['BOOLEAN'],'defaultValue':!![]},'passwordHistoryLimit':{'type':Sequelize[_0x188f('0x2')](0x2)[_0x188f('0x8')],'defaultValue':0x3,'validate':{'min':0x1,'max':0x5}},'privacyPolicyEmail':{'type':Sequelize['INTEGER'](0x2)[_0x188f('0x8')],'defaultValue':0x0},'privacyPolicyName':{'type':Sequelize['INTEGER'](0x2)[_0x188f('0x8')],'defaultValue':0x0},'privacyPolicyNumber':{'type':Sequelize[_0x188f('0x2')](0x2)[_0x188f('0x8')],'defaultValue':0x0},'searchOnEnterKey':{'type':Sequelize[_0x188f('0x5')],'defaultValue':!![]},'chatInteractionsReloadTimeout':{'type':Sequelize[_0x188f('0x2')],'defaultValue':0x0},'mailInteractionsReloadTimeout':{'type':Sequelize[_0x188f('0x2')],'defaultValue':0x0},'openchannelInteractionsReloadTimeout':{'type':Sequelize[_0x188f('0x2')],'defaultValue':0x0},'smsInteractionsReloadTimeout':{'type':Sequelize[_0x188f('0x2')],'defaultValue':0x0},'whatsappInteractionsReloadTimeout':{'type':Sequelize[_0x188f('0x2')],'defaultValue':0x0},'stopRecordingOnTransfer':{'type':Sequelize[_0x188f('0x5')],'defaultValue':![]},'secureCookieEnabled':{'type':Sequelize['BOOLEAN'],'defaultValue':!![]},'viewHelpSection':{'type':Sequelize[_0x188f('0x5')],'defaultValue':!![]},'previewRecallmeReminderInterval':{'type':Sequelize['INTEGER'],'defaultValue':0x5,'validate':{'min':0x1}},'disabledCookie':{'type':Sequelize[_0x188f('0x5')],'defaultValue':![]},'limitTabs':{'type':Sequelize[_0x188f('0x2')],'defaultValue':0x14},'filterFullName':{'type':Sequelize[_0x188f('0x5')],'defaultValue':![]}}; \ No newline at end of file +var _0xfb0c=['min_internal','min_mailbox','STRING','BOOLEAN','https://www.xcally.com/bar/phonebar/autoupdater.xml','alternate','UNSIGNED','sequelize','INTEGER'];(function(_0x1f821a,_0x22ab44){var _0x1f7408=function(_0x128ad2){while(--_0x128ad2){_0x1f821a['push'](_0x1f821a['shift']());}};_0x1f7408(++_0x22ab44);}(_0xfb0c,0x115));var _0xcfb0=function(_0x2e51a9,_0x1e1a5a){_0x2e51a9=_0x2e51a9-0x0;var _0x5b04ef=_0xfb0c[_0x2e51a9];return _0x5b04ef;};'use strict';var Sequelize=require(_0xcfb0('0x0'));module['exports']={'min_internal':{'type':Sequelize[_0xcfb0('0x1')](0xb),'unique':_0xcfb0('0x2'),'defaultValue':0x3e8},'min_mailbox':{'type':Sequelize[_0xcfb0('0x1')](0xb),'unique':_0xcfb0('0x3'),'defaultValue':0x3e8},'agi_port':{'type':Sequelize[_0xcfb0('0x1')](0xb),'defaultValue':0x11dd},'soundPath':{'type':Sequelize[_0xcfb0('0x4')],'defaultValue':'/var/opt/motion2/server/files/sounds/converted'},'logo':{'type':Sequelize[_0xcfb0('0x4')]},'defaultLogo':{'type':Sequelize[_0xcfb0('0x5')],'defaultValue':!![]},'loginLogo':{'type':Sequelize[_0xcfb0('0x4')]},'defaultLoginLogo':{'type':Sequelize[_0xcfb0('0x5')],'defaultValue':!![]},'headerWhiteLabel':{'type':Sequelize[_0xcfb0('0x4')]},'defaultHeaderWhiteLabel':{'type':Sequelize[_0xcfb0('0x5')],'defaultValue':!![]},'securePassword':{'type':Sequelize[_0xcfb0('0x5')],'defaultValue':!![]},'firstSetup':{'type':Sequelize[_0xcfb0('0x5')],'defaultValue':!![]},'stunaddr':{'type':Sequelize[_0xcfb0('0x4')]},'turnaddr':{'type':Sequelize[_0xcfb0('0x4')]},'turnusername':{'type':Sequelize['STRING']},'turnpassword':{'type':Sequelize[_0xcfb0('0x4')]},'pageTitle':{'type':Sequelize['STRING']},'defaultPageTitle':{'type':Sequelize['BOOLEAN'],'defaultValue':!![]},'callRecordingEncryption':{'type':Sequelize[_0xcfb0('0x5')],'defaultValue':![]},'passwordExpiresDays':{'type':Sequelize[_0xcfb0('0x1')](0xb),'defaultValue':0x5a},'phoneBarAutoUpdater':{'type':Sequelize[_0xcfb0('0x5')],'defaultValue':!![]},'phoneBarAutoUpdaterUrl':{'type':Sequelize[_0xcfb0('0x4')],'defaultValue':_0xcfb0('0x6')},'enableEmailPreview':{'type':Sequelize[_0xcfb0('0x5')],'defaultValue':![]},'split':{'type':Sequelize[_0xcfb0('0x5')],'defaultValue':!![]},'splitSizeCsv':{'type':Sequelize[_0xcfb0('0x1')],'defaultValue':0x1388},'splitSizePdf':{'type':Sequelize[_0xcfb0('0x1')],'defaultValue':0x1388},'splitSizeXlsx':{'type':Sequelize[_0xcfb0('0x1')],'defaultValue':0x1388},'messagesAlignment':{'type':Sequelize[_0xcfb0('0x4')],'defaultValue':_0xcfb0('0x7')},'chatTimeout':{'type':Sequelize[_0xcfb0('0x1')],'defaultValue':0x1e},'phoneBarRememberMeEnabled':{'type':Sequelize['BOOLEAN'],'defaultValue':!![]},'preferred':{'type':Sequelize[_0xcfb0('0x4')]},'defaultPreferred':{'type':Sequelize[_0xcfb0('0x5')],'defaultValue':!![]},'rtlSupport':{'type':Sequelize[_0xcfb0('0x5')],'defaultValue':![]},'defaultScreenRecordingPath':{'type':Sequelize['STRING']},'allowedLoginAttempts':{'type':Sequelize['INTEGER'],'defaultValue':0x5},'blockDuration':{'type':Sequelize['INTEGER'],'defaultValue':0xa},'favicon':{'type':Sequelize['STRING']},'defaultFavicon':{'type':Sequelize[_0xcfb0('0x5')],'defaultValue':!![]},'loginMailFrequency':{'type':Sequelize[_0xcfb0('0x1')],'defaultValue':0xa,'validate':{'min':0xa}},'transcribe':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'automaticTranscribe':{'type':Sequelize[_0xcfb0('0x5')],'defaultValue':![]},'transcribeAccountId':{'type':Sequelize['INTEGER']},'transcribeRegion':{'type':Sequelize[_0xcfb0('0x4')]},'sentiment':{'type':Sequelize[_0xcfb0('0x5')],'defaultValue':![]},'automaticSentiment':{'type':Sequelize[_0xcfb0('0x5')],'defaultValue':![]},'sentimentAccountId':{'type':Sequelize[_0xcfb0('0x1')]},'sentimentRegion':{'type':Sequelize[_0xcfb0('0x4')]},'language':{'type':Sequelize[_0xcfb0('0x4')]},'bucket':{'type':Sequelize[_0xcfb0('0x4')]},'googleSsoEnabled':{'type':Sequelize[_0xcfb0('0x5')],'defaultValue':![]},'adSsoEnabled':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'enforcePasswordHistory':{'type':Sequelize[_0xcfb0('0x5')],'defaultValue':!![]},'passwordHistoryLimit':{'type':Sequelize[_0xcfb0('0x1')](0x2)['UNSIGNED'],'defaultValue':0x3,'validate':{'min':0x1,'max':0x5}},'privacyPolicyEmail':{'type':Sequelize[_0xcfb0('0x1')](0x2)[_0xcfb0('0x8')],'defaultValue':0x0},'privacyPolicyName':{'type':Sequelize[_0xcfb0('0x1')](0x2)[_0xcfb0('0x8')],'defaultValue':0x0},'privacyPolicyNumber':{'type':Sequelize[_0xcfb0('0x1')](0x2)[_0xcfb0('0x8')],'defaultValue':0x0},'searchOnEnterKey':{'type':Sequelize[_0xcfb0('0x5')],'defaultValue':!![]},'chatInteractionsReloadTimeout':{'type':Sequelize[_0xcfb0('0x1')],'defaultValue':0x0},'mailInteractionsReloadTimeout':{'type':Sequelize['INTEGER'],'defaultValue':0x0},'openchannelInteractionsReloadTimeout':{'type':Sequelize['INTEGER'],'defaultValue':0x0},'smsInteractionsReloadTimeout':{'type':Sequelize[_0xcfb0('0x1')],'defaultValue':0x0},'whatsappInteractionsReloadTimeout':{'type':Sequelize['INTEGER'],'defaultValue':0x0},'stopRecordingOnTransfer':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'secureCookieEnabled':{'type':Sequelize[_0xcfb0('0x5')],'defaultValue':!![]},'viewHelpSection':{'type':Sequelize[_0xcfb0('0x5')],'defaultValue':!![]},'previewRecallmeReminderInterval':{'type':Sequelize['INTEGER'],'defaultValue':0x5,'validate':{'min':0x1}},'disabledCookie':{'type':Sequelize[_0xcfb0('0x5')],'defaultValue':![]},'limitTabs':{'type':Sequelize[_0xcfb0('0x1')],'defaultValue':0x14},'filterFullName':{'type':Sequelize['BOOLEAN'],'defaultValue':![]}}; \ No newline at end of file diff --git a/server/api/setting/setting.controller.js b/server/api/setting/setting.controller.js index 7b202c2..319352e 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 _0x684d=['end','json','offset','undefined','limit','count','set','Content-Range','apply','save','update','then','destroy','stack','name','map','Setting','rawAttributes','type','key','model','query','keys','filters','intersection','attributes','fields','hasOwnProperty','nolimit','sort','where','pick','filter','merge','VIRTUAL','options','include','findAll','rows','params','length','includeAll','body','find','addLogo','file','filename','logo','addLogoLogin','loginLogo','getLogo','server/files/images/logos','getLicense','preferred','favicon','defaultLogo','defaultPreferred','defaultFavicon','existsSync','join','root','toLower','default_logo.svg','default','custom','Sequelize','ValidationError','upperFirst','\x20not\x20found','download','getLogoLogin','defaultLoginLogo','default_loginLogo.svg','gdpr','getPreferred','default_preferred.png','addFavicon','getFavicon','default_favicon.ico','getDate','utcOffset','format','YYYY-MM-DD\x20HH:mm:ss:SSS','send','eml-format','rimraf','fast-json-patch','request-promise','bluebird','mustache','util','path','sox','to-csv','ejs','fs-extra','lodash','squel','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','jayson/promise','client','http','info','Setting,\x20%s,\x20%s','debug','error','code','message','request\x20sent','catch','sendStatus','status'];(function(_0x424a9a,_0x2dd9af){var _0xa7831c=function(_0x512534){while(--_0x512534){_0x424a9a['push'](_0x424a9a['shift']());}};_0xa7831c(++_0x2dd9af);}(_0x684d,0xcf));var _0xd684=function(_0x376e57,_0x57d537){_0x376e57=_0x376e57-0x0;var _0x5317a5=_0x684d[_0x376e57];return _0x5317a5;};'use strict';var emlformat=require(_0xd684('0x0'));var rimraf=require(_0xd684('0x1'));var zipdir=require('zip-dir');var jsonpatch=require(_0xd684('0x2'));var rp=require(_0xd684('0x3'));var moment=require('moment');var BPromise=require(_0xd684('0x4'));var Mustache=require(_0xd684('0x5'));var util=require(_0xd684('0x6'));var path=require(_0xd684('0x7'));var sox=require(_0xd684('0x8'));var csv=require(_0xd684('0x9'));var ejs=require(_0xd684('0xa'));var fs=require('fs');var fs_extra=require(_0xd684('0xb'));var _=require(_0xd684('0xc'));var squel=require(_0xd684('0xd'));var crypto=require('crypto');var jsforce=require('jsforce');var deskjs=require('desk.js');var toCsv=require(_0xd684('0x9'));var querystring=require(_0xd684('0xe'));var Papa=require(_0xd684('0xf'));var Redis=require(_0xd684('0x10'));var authService=require(_0xd684('0x11'));var qs=require(_0xd684('0x12'));var as=require(_0xd684('0x13'));var hardwareService=require(_0xd684('0x14'));var logger=require(_0xd684('0x15'))('api');var utils=require(_0xd684('0x16'));var config=require(_0xd684('0x17'));var licenseUtil=require(_0xd684('0x18'));var db=require(_0xd684('0x19'))['db'];var jayson=require(_0xd684('0x1a'));var client=jayson[_0xd684('0x1b')][_0xd684('0x1c')]({'port':0x232a});function respondWithRpcPromise(_0x11be58,_0x46f962,_0x1c31c3,_0x1b5ea8){return new BPromise(function(_0x3424e6,_0x25aebc){var _0x1becd3=_0x1b5ea8||client;return _0x1becd3['request'](_0x11be58,_0x1c31c3)['then'](function(_0x60712){logger[_0xd684('0x1d')](_0xd684('0x1e'),_0x46f962,'request\x20sent');logger[_0xd684('0x1f')]('Setting,\x20%s,\x20%s,\x20%s',_0x46f962,'request\x20sent',JSON['stringify'](_0x60712));if(_0x60712[_0xd684('0x20')]){if(_0x60712[_0xd684('0x20')][_0xd684('0x21')]===0x1f4){logger[_0xd684('0x20')](_0xd684('0x1e'),_0x46f962,_0x60712[_0xd684('0x20')]['message']);return _0x25aebc(_0x60712['error'][_0xd684('0x22')]);}logger['error']('Setting,\x20%s,\x20%s',_0x46f962,_0x60712['error'][_0xd684('0x22')]);return _0x3424e6(_0x60712['error'][_0xd684('0x22')]);}else{logger[_0xd684('0x1d')]('Setting,\x20%s,\x20%s',_0x46f962,_0xd684('0x23'));_0x3424e6(_0x60712['result'][_0xd684('0x22')]);}})[_0xd684('0x24')](function(_0x186d56){logger[_0xd684('0x20')]('Setting,\x20%s,\x20%s',_0x46f962,_0x186d56);_0x25aebc(_0x186d56);});});}function respondWithStatusCode(_0x3a5deb,_0x1288c1){_0x1288c1=_0x1288c1||0xcc;return function(_0x3780d7){if(_0x3780d7){return _0x3a5deb[_0xd684('0x25')](_0x1288c1);}return _0x3a5deb[_0xd684('0x26')](_0x1288c1)[_0xd684('0x27')]();};}function respondWithResult(_0x4150f3,_0x40578c){_0x40578c=_0x40578c||0xc8;return function(_0x304eb4){if(_0x304eb4){return _0x4150f3[_0xd684('0x26')](_0x40578c)[_0xd684('0x28')](_0x304eb4);}};}function respondWithFilteredResult(_0x53ede2,_0x169195){return function(_0x2a0840){if(_0x2a0840){var _0x52c15c=typeof _0x169195[_0xd684('0x29')]===_0xd684('0x2a')&&typeof _0x169195[_0xd684('0x2b')]===_0xd684('0x2a');var _0x9798fa=_0x2a0840[_0xd684('0x2c')];var _0x1907c0=_0x52c15c?0x0:_0x169195['offset'];var _0xbcaee3=_0x52c15c?_0x2a0840[_0xd684('0x2c')]:_0x169195['offset']+_0x169195['limit'];var _0x5ba470;if(_0xbcaee3>=_0x9798fa){_0xbcaee3=_0x9798fa;_0x5ba470=0xc8;}else{_0x5ba470=0xce;}_0x53ede2[_0xd684('0x26')](_0x5ba470);return _0x53ede2[_0xd684('0x2d')](_0xd684('0x2e'),_0x1907c0+'-'+_0xbcaee3+'/'+_0x9798fa)['json'](_0x2a0840);}return null;};}function patchUpdates(_0x1f264e){return function(_0x132ca5){try{jsonpatch[_0xd684('0x2f')](_0x132ca5,_0x1f264e,!![]);}catch(_0x144662){return BPromise['reject'](_0x144662);}return _0x132ca5[_0xd684('0x30')]();};}function saveUpdates(_0x1e0436,_0x351fcb){return function(_0x436370){if(_0x436370){return _0x436370[_0xd684('0x31')](_0x1e0436)[_0xd684('0x32')](function(_0x1d7b8b){return _0x1d7b8b;});}return null;};}function removeEntity(_0x5cf821,_0x4d6467){return function(_0x1a1fce){if(_0x1a1fce){return _0x1a1fce[_0xd684('0x33')]()['then'](function(){_0x5cf821[_0xd684('0x26')](0xcc)['end']();});}};}function handleEntityNotFound(_0x48a04f,_0x50cfc7){return function(_0x29662e){if(!_0x29662e){_0x48a04f['sendStatus'](0x194);}return _0x29662e;};}function handleError(_0x5896f0,_0x3139ec){_0x3139ec=_0x3139ec||0x1f4;return function(_0xd797bd){logger[_0xd684('0x20')](_0xd797bd[_0xd684('0x34')]);if(_0xd797bd['name']){delete _0xd797bd[_0xd684('0x35')];}_0x5896f0[_0xd684('0x26')](_0x3139ec)['send'](_0xd797bd);};}exports['index']=function(_0x2a14b4,_0x5dcdd7){var _0x3a5c5b={},_0x172eff={},_0x2c8a63={'count':0x0,'rows':[]};var _0x3090f4=_[_0xd684('0x36')](db[_0xd684('0x37')][_0xd684('0x38')],function(_0x139f66){return{'name':_0x139f66['fieldName'],'type':_0x139f66[_0xd684('0x39')][_0xd684('0x3a')]};});_0x172eff[_0xd684('0x3b')]=_[_0xd684('0x36')](_0x3090f4,'name');_0x172eff[_0xd684('0x3c')]=_[_0xd684('0x3d')](_0x2a14b4['query']);_0x172eff[_0xd684('0x3e')]=_[_0xd684('0x3f')](_0x172eff[_0xd684('0x3b')],_0x172eff['query']);_0x3a5c5b[_0xd684('0x40')]=_[_0xd684('0x3f')](_0x172eff[_0xd684('0x3b')],qs[_0xd684('0x41')](_0x2a14b4[_0xd684('0x3c')][_0xd684('0x41')]));_0x3a5c5b['attributes']=_0x3a5c5b[_0xd684('0x40')]['length']?_0x3a5c5b[_0xd684('0x40')]:_0x172eff[_0xd684('0x3b')];if(!_0x2a14b4[_0xd684('0x3c')][_0xd684('0x42')](_0xd684('0x43'))){_0x3a5c5b[_0xd684('0x2b')]=qs[_0xd684('0x2b')](_0x2a14b4[_0xd684('0x3c')][_0xd684('0x2b')]);_0x3a5c5b[_0xd684('0x29')]=qs[_0xd684('0x29')](_0x2a14b4[_0xd684('0x3c')][_0xd684('0x29')]);}_0x3a5c5b['order']=qs[_0xd684('0x44')](_0x2a14b4[_0xd684('0x3c')][_0xd684('0x44')]);_0x3a5c5b[_0xd684('0x45')]=qs[_0xd684('0x3e')](_[_0xd684('0x46')](_0x2a14b4[_0xd684('0x3c')],_0x172eff[_0xd684('0x3e')]),_0x3090f4);if(_0x2a14b4['query'][_0xd684('0x47')]){_0x3a5c5b[_0xd684('0x45')]=_[_0xd684('0x48')](_0x3a5c5b[_0xd684('0x45')],{'$or':_[_0xd684('0x36')](_0x3090f4,function(_0x2afa65){if(_0x2afa65[_0xd684('0x39')]!==_0xd684('0x49')){var _0x41de5e={};_0x41de5e[_0x2afa65[_0xd684('0x35')]]={'$like':'%'+_0x2a14b4[_0xd684('0x3c')][_0xd684('0x47')]+'%'};return _0x41de5e;}})});}_0x3a5c5b=_['merge']({},_0x3a5c5b,_0x2a14b4[_0xd684('0x4a')]);var _0x142bdb={'where':_0x3a5c5b[_0xd684('0x45')]};return db[_0xd684('0x37')][_0xd684('0x2c')](_0x142bdb)[_0xd684('0x32')](function(_0xb06d22){_0x2c8a63['count']=_0xb06d22;if(_0x2a14b4[_0xd684('0x3c')]['includeAll']){_0x3a5c5b[_0xd684('0x4b')]=[{'all':!![]}];}return db[_0xd684('0x37')][_0xd684('0x4c')](_0x3a5c5b);})[_0xd684('0x32')](function(_0x2abc4c){_0x2c8a63[_0xd684('0x4d')]=_0x2abc4c;return _0x2c8a63;})[_0xd684('0x32')](respondWithFilteredResult(_0x5dcdd7,_0x3a5c5b))[_0xd684('0x24')](handleError(_0x5dcdd7,null));};exports['show']=function(_0x543da3,_0x462929){var _0x4dbb7e={'raw':![],'where':{'id':_0x543da3[_0xd684('0x4e')]['id']}},_0x52e09b={};_0x52e09b[_0xd684('0x3b')]=_['keys'](db[_0xd684('0x37')]['rawAttributes']);_0x52e09b[_0xd684('0x3c')]=_[_0xd684('0x3d')](_0x543da3[_0xd684('0x3c')]);_0x52e09b[_0xd684('0x3e')]=_[_0xd684('0x3f')](_0x52e09b[_0xd684('0x3b')],_0x52e09b[_0xd684('0x3c')]);_0x4dbb7e[_0xd684('0x40')]=_[_0xd684('0x3f')](_0x52e09b[_0xd684('0x3b')],qs['fields'](_0x543da3[_0xd684('0x3c')]['fields']));_0x4dbb7e['attributes']=_0x4dbb7e[_0xd684('0x40')][_0xd684('0x4f')]?_0x4dbb7e[_0xd684('0x40')]:_0x52e09b['model'];if(_0x543da3['query'][_0xd684('0x50')]){_0x4dbb7e[_0xd684('0x4b')]=[{'all':!![]}];}_0x4dbb7e=_[_0xd684('0x48')]({},_0x4dbb7e,_0x543da3[_0xd684('0x4a')]);return db['Setting']['find'](_0x4dbb7e)['then'](handleEntityNotFound(_0x462929,null))[_0xd684('0x32')](respondWithResult(_0x462929,null))['catch'](handleError(_0x462929,null));};exports[_0xd684('0x31')]=function(_0x3234a8,_0x2e36dc){if(_0x3234a8['body']['id']){delete _0x3234a8[_0xd684('0x51')]['id'];}return db[_0xd684('0x37')][_0xd684('0x52')]({'where':{'id':_0x3234a8['params']['id']}})[_0xd684('0x32')](handleEntityNotFound(_0x2e36dc,null))['then'](saveUpdates(_0x3234a8[_0xd684('0x51')],null))['then'](respondWithResult(_0x2e36dc,null))[_0xd684('0x24')](handleError(_0x2e36dc,null));};exports[_0xd684('0x53')]=function(_0x2e4b60,_0x3abc2e,_0x3531ee){if(_0x2e4b60['file']&&_0x2e4b60[_0xd684('0x54')][_0xd684('0x55')]){_0x2e4b60[_0xd684('0x51')][_0xd684('0x56')]=_0x2e4b60[_0xd684('0x54')][_0xd684('0x55')];}return db[_0xd684('0x37')]['find']({'where':{'id':_0x2e4b60[_0xd684('0x4e')]['id']}})[_0xd684('0x32')](handleEntityNotFound(_0x3abc2e,null))[_0xd684('0x32')](saveUpdates(_0x2e4b60[_0xd684('0x51')],null))[_0xd684('0x32')](respondWithResult(_0x3abc2e,null))[_0xd684('0x24')](handleError(_0x3abc2e,null));};exports[_0xd684('0x57')]=function(_0x56e20a,_0x2d1afb,_0x4971b6){if(_0x56e20a[_0xd684('0x54')]&&_0x56e20a[_0xd684('0x54')][_0xd684('0x55')]){_0x56e20a[_0xd684('0x51')][_0xd684('0x58')]=_0x56e20a[_0xd684('0x54')][_0xd684('0x55')];}return db[_0xd684('0x37')][_0xd684('0x52')]({'where':{'id':_0x56e20a[_0xd684('0x4e')]['id']}})[_0xd684('0x32')](handleEntityNotFound(_0x2d1afb,null))[_0xd684('0x32')](saveUpdates(_0x56e20a[_0xd684('0x51')],null))[_0xd684('0x32')](respondWithResult(_0x2d1afb,null))['catch'](handleError(_0x2d1afb,null));};var utilLicense=require(_0xd684('0x18'));exports[_0xd684('0x59')]=function(_0x290b69,_0x268690,_0x299ad9){var _0x4dac25=_0xd684('0x5a');var _0x14ea9f={'custom':![]};return utilLicense[_0xd684('0x5b')]()[_0xd684('0x32')](function(_0x21eaf4){if(_0x21eaf4){_0x14ea9f=_0x21eaf4;}return db['Setting'][_0xd684('0x52')]({'where':{'id':_0x290b69['params']['id']},'attributes':[_0xd684('0x56'),'loginLogo',_0xd684('0x5c'),_0xd684('0x5d'),_0xd684('0x5e'),'defaultLoginLogo',_0xd684('0x5f'),_0xd684('0x60')],'raw':!![]});})['then'](handleEntityNotFound(_0x268690,null))[_0xd684('0x32')](function(_0x1a0380){if(_0x1a0380){var _0x45e63b=_0x1a0380[_0xd684('0x56')]&&fs[_0xd684('0x61')](path[_0xd684('0x62')](config[_0xd684('0x63')],_0x4dac25,_[_0xd684('0x64')](_0x1a0380[_0xd684('0x56')])))?path[_0xd684('0x62')](config['root'],_0x4dac25,_[_0xd684('0x64')](_0x1a0380[_0xd684('0x56')])):path[_0xd684('0x62')](config[_0xd684('0x63')],_0x4dac25,_[_0xd684('0x64')](_0xd684('0x65')));var _0x59effc=_0xd684('0x66')+_['upperFirst'](_0xd684('0x56'));if(_0x1a0380[_0x59effc]||!_0x14ea9f[_0xd684('0x67')]){_0x45e63b=path['join'](config[_0xd684('0x63')],_0x4dac25,_[_0xd684('0x64')](_0xd684('0x65')));}if(!fs[_0xd684('0x61')](_0x45e63b)){throw new db[(_0xd684('0x68'))][(_0xd684('0x69'))](_[_0xd684('0x6a')](_0xd684('0x56'))+_0xd684('0x6b'));}return _0x268690[_0xd684('0x6c')](_0x45e63b);}})[_0xd684('0x24')](handleError(_0x268690,null));};var utilLicense=require(_0xd684('0x18'));exports[_0xd684('0x6d')]=function(_0x3ec013,_0x3113d9,_0x339dd9){var _0x3bf84f=_0xd684('0x5a');var _0x4a9298={'custom':![]};return utilLicense['getLicense']()['then'](function(_0x516bac){if(_0x516bac){_0x4a9298=_0x516bac;}return db['Setting'][_0xd684('0x52')]({'where':{'id':_0x3ec013[_0xd684('0x4e')]['id']},'attributes':['logo',_0xd684('0x58'),_0xd684('0x5c'),_0xd684('0x5d'),_0xd684('0x5e'),_0xd684('0x6e'),_0xd684('0x5f'),_0xd684('0x60')],'raw':!![]});})[_0xd684('0x32')](handleEntityNotFound(_0x3113d9,null))[_0xd684('0x32')](function(_0x49c4f0){if(_0x49c4f0){var _0x44752c=_0x49c4f0[_0xd684('0x58')]&&fs[_0xd684('0x61')](path[_0xd684('0x62')](config['root'],_0x3bf84f,_[_0xd684('0x64')](_0x49c4f0['loginLogo'])))?path['join'](config[_0xd684('0x63')],_0x3bf84f,_['toLower'](_0x49c4f0[_0xd684('0x58')])):path[_0xd684('0x62')](config[_0xd684('0x63')],_0x3bf84f,_[_0xd684('0x64')](_0xd684('0x6f')));var _0xf93d45=_0xd684('0x66')+_[_0xd684('0x6a')](_0xd684('0x58'));if(_0x49c4f0[_0xf93d45]||!_0x4a9298[_0xd684('0x67')]){_0x44752c=path['join'](config[_0xd684('0x63')],_0x3bf84f,_[_0xd684('0x64')]('default_loginLogo.svg'));}if(!fs[_0xd684('0x61')](_0x44752c)){throw new db[(_0xd684('0x68'))][(_0xd684('0x69'))](_[_0xd684('0x6a')](_0xd684('0x58'))+_0xd684('0x6b'));}return _0x3113d9[_0xd684('0x6c')](_0x44752c);}})[_0xd684('0x24')](handleError(_0x3113d9,null));};exports[_0xd684('0x70')]=function(_0x2fbdd9,_0x50dd91){return db[_0xd684('0x37')][_0xd684('0x52')]({'where':{'id':_0x2fbdd9[_0xd684('0x4e')]['id']},'attributes':['securePassword']})[_0xd684('0x32')](respondWithResult(_0x50dd91,null))['catch'](handleError(_0x50dd91,null));};exports['addPreferred']=function(_0x1bbbec,_0x5ba449,_0xcf7452){if(_0x1bbbec[_0xd684('0x54')]&&_0x1bbbec[_0xd684('0x54')][_0xd684('0x55')]){_0x1bbbec['body'][_0xd684('0x5c')]=_0x1bbbec[_0xd684('0x54')]['filename'];}return db['Setting'][_0xd684('0x52')]({'where':{'id':_0x1bbbec[_0xd684('0x4e')]['id']}})['then'](handleEntityNotFound(_0x5ba449,null))[_0xd684('0x32')](saveUpdates(_0x1bbbec[_0xd684('0x51')],null))[_0xd684('0x32')](respondWithResult(_0x5ba449,null))[_0xd684('0x24')](handleError(_0x5ba449,null));};var utilLicense=require(_0xd684('0x18'));exports[_0xd684('0x71')]=function(_0x39fea3,_0x124acd,_0x59ee86){var _0x1850bc='server/files/images/logos';var _0x2bed0f={'custom':![]};return utilLicense[_0xd684('0x5b')]()[_0xd684('0x32')](function(_0x3a3a1f){if(_0x3a3a1f){_0x2bed0f=_0x3a3a1f;}return db[_0xd684('0x37')][_0xd684('0x52')]({'where':{'id':_0x39fea3[_0xd684('0x4e')]['id']},'attributes':[_0xd684('0x56'),_0xd684('0x58'),_0xd684('0x5c'),_0xd684('0x5d'),_0xd684('0x5e'),_0xd684('0x6e'),_0xd684('0x5f'),_0xd684('0x60')],'raw':!![]});})[_0xd684('0x32')](handleEntityNotFound(_0x124acd,null))[_0xd684('0x32')](function(_0xcb9d11){if(_0xcb9d11){var _0x1a819b=_0xcb9d11[_0xd684('0x5c')]&&fs[_0xd684('0x61')](path[_0xd684('0x62')](config['root'],_0x1850bc,_[_0xd684('0x64')](_0xcb9d11['preferred'])))?path[_0xd684('0x62')](config[_0xd684('0x63')],_0x1850bc,_['toLower'](_0xcb9d11[_0xd684('0x5c')])):path[_0xd684('0x62')](config[_0xd684('0x63')],_0x1850bc,_[_0xd684('0x64')](_0xd684('0x72')));var _0x3dd5e9=_0xd684('0x66')+_['upperFirst'](_0xd684('0x5c'));if(_0xcb9d11[_0x3dd5e9]||!_0x2bed0f[_0xd684('0x67')]||!_0x2bed0f[_0xd684('0x5c')]){_0x1a819b=path[_0xd684('0x62')](config['root'],_0x1850bc,_[_0xd684('0x64')](_0xd684('0x72')));}if(!fs[_0xd684('0x61')](_0x1a819b)){throw new db[(_0xd684('0x68'))][(_0xd684('0x69'))](_['upperFirst']('preferred')+_0xd684('0x6b'));}return _0x124acd['download'](_0x1a819b);}})[_0xd684('0x24')](handleError(_0x124acd,null));};exports[_0xd684('0x73')]=function(_0x38d585,_0x539e74,_0x2d2da1){if(_0x38d585['file']&&_0x38d585[_0xd684('0x54')][_0xd684('0x55')]){_0x38d585[_0xd684('0x51')][_0xd684('0x5d')]=_0x38d585[_0xd684('0x54')][_0xd684('0x55')];}return db['Setting'][_0xd684('0x52')]({'where':{'id':_0x38d585['params']['id']}})[_0xd684('0x32')](handleEntityNotFound(_0x539e74,null))['then'](saveUpdates(_0x38d585[_0xd684('0x51')],null))[_0xd684('0x32')](respondWithResult(_0x539e74,null))[_0xd684('0x24')](handleError(_0x539e74,null));};var utilLicense=require('../../config/license/util');exports[_0xd684('0x74')]=function(_0x4521a5,_0x486c44,_0x58402b){var _0x7da683='server/files/images/logos';var _0x34102d={'custom':![]};return utilLicense[_0xd684('0x5b')]()[_0xd684('0x32')](function(_0x3661fd){if(_0x3661fd){_0x34102d=_0x3661fd;}return db[_0xd684('0x37')]['find']({'where':{'id':_0x4521a5[_0xd684('0x4e')]['id']},'attributes':[_0xd684('0x56'),'loginLogo','preferred',_0xd684('0x5d'),_0xd684('0x5e'),'defaultLoginLogo',_0xd684('0x5f'),_0xd684('0x60')],'raw':!![]});})[_0xd684('0x32')](handleEntityNotFound(_0x486c44,null))['then'](function(_0x27497a){if(_0x27497a){var _0x46be3f=_0x27497a[_0xd684('0x5d')]&&fs[_0xd684('0x61')](path[_0xd684('0x62')](config[_0xd684('0x63')],_0x7da683,_[_0xd684('0x64')](_0x27497a[_0xd684('0x5d')])))?path[_0xd684('0x62')](config[_0xd684('0x63')],_0x7da683,_[_0xd684('0x64')](_0x27497a[_0xd684('0x5d')])):path['join'](config[_0xd684('0x63')],_0x7da683,_[_0xd684('0x64')](_0xd684('0x75')));var _0x40682e=_0xd684('0x66')+_['upperFirst'](_0xd684('0x5d'));if(_0x27497a[_0x40682e]||!_0x34102d['custom']){_0x46be3f=path[_0xd684('0x62')](config['root'],_0x7da683,_[_0xd684('0x64')](_0xd684('0x75')));}if(!fs[_0xd684('0x61')](_0x46be3f)){throw new db[(_0xd684('0x68'))][(_0xd684('0x69'))](_[_0xd684('0x6a')](_0xd684('0x5d'))+_0xd684('0x6b'));}return _0x486c44['download'](_0x46be3f);}})[_0xd684('0x24')](handleError(_0x486c44,null));};exports[_0xd684('0x76')]=function(_0x2768de,_0x5b2e5c){var _0x530220={'offset':moment()[_0xd684('0x77')]()};_0x530220['now']=moment()[_0xd684('0x77')](_0x530220[_0xd684('0x29')])[_0xd684('0x78')](_0xd684('0x79'));return _0x5b2e5c[_0xd684('0x26')](0xc8)[_0xd684('0x7a')](_0x530220);}; \ No newline at end of file +var _0x1ef3=['ioredis','../../components/parsers/qs','api','../../config/utils','../../config/environment','../../config/license/util','request','then','info','Setting,\x20%s,\x20%s','Setting,\x20%s,\x20%s,\x20%s','stringify','error','code','message','request\x20sent','catch','sendStatus','status','json','offset','undefined','limit','set','Content-Range','apply','reject','destroy','end','stack','name','send','index','map','Setting','rawAttributes','key','model','query','filters','intersection','fields','attributes','length','hasOwnProperty','nolimit','order','sort','where','pick','filter','merge','type','VIRTUAL','options','count','findAll','rows','show','params','keys','includeAll','include','find','update','body','addLogo','file','filename','loginLogo','getLogo','server/files/images/logos','getLicense','logo','favicon','defaultFavicon','join','root','toLower','default','upperFirst','custom','default_logo.svg','existsSync','preferred','defaultLogo','defaultLoginLogo','defaultPreferred','default_loginLogo.svg','Sequelize','ValidationError','download','gdpr','securePassword','addPreferred','getPreferred','default_preferred.png','\x20not\x20found','addFavicon','getFavicon','getDate','utcOffset','now','format','YYYY-MM-DD\x20HH:mm:ss:SSS','eml-format','rimraf','fast-json-patch','request-promise','moment','mustache','util','sox','to-csv','ejs','fs-extra','lodash','squel','jsforce','desk.js','querystring'];(function(_0x4d8666,_0x2ff19d){var _0x37175b=function(_0x1b8de6){while(--_0x1b8de6){_0x4d8666['push'](_0x4d8666['shift']());}};_0x37175b(++_0x2ff19d);}(_0x1ef3,0x69));var _0x31ef=function(_0x97def9,_0x320c56){_0x97def9=_0x97def9-0x0;var _0x53c5ad=_0x1ef3[_0x97def9];return _0x53c5ad;};'use strict';var emlformat=require(_0x31ef('0x0'));var rimraf=require(_0x31ef('0x1'));var zipdir=require('zip-dir');var jsonpatch=require(_0x31ef('0x2'));var rp=require(_0x31ef('0x3'));var moment=require(_0x31ef('0x4'));var BPromise=require('bluebird');var Mustache=require(_0x31ef('0x5'));var util=require(_0x31ef('0x6'));var path=require('path');var sox=require(_0x31ef('0x7'));var csv=require(_0x31ef('0x8'));var ejs=require(_0x31ef('0x9'));var fs=require('fs');var fs_extra=require(_0x31ef('0xa'));var _=require(_0x31ef('0xb'));var squel=require(_0x31ef('0xc'));var crypto=require('crypto');var jsforce=require(_0x31ef('0xd'));var deskjs=require(_0x31ef('0xe'));var toCsv=require(_0x31ef('0x8'));var querystring=require(_0x31ef('0xf'));var Papa=require('papaparse');var Redis=require(_0x31ef('0x10'));var authService=require('../../components/auth/service');var qs=require(_0x31ef('0x11'));var as=require('../../components/parsers/advancedSearch');var hardwareService=require('../../config/license/hardware');var logger=require('../../config/logger')(_0x31ef('0x12'));var utils=require(_0x31ef('0x13'));var config=require(_0x31ef('0x14'));var licenseUtil=require(_0x31ef('0x15'));var db=require('../../mysqldb')['db'];var jayson=require('jayson/promise');var client=jayson['client']['http']({'port':0x232a});function respondWithRpcPromise(_0x597be6,_0xd90ceb,_0x5e124c,_0x241e96){return new BPromise(function(_0x22f9e2,_0x4889a7){var _0x39178b=_0x241e96||client;return _0x39178b[_0x31ef('0x16')](_0x597be6,_0x5e124c)[_0x31ef('0x17')](function(_0x1b95ab){logger[_0x31ef('0x18')](_0x31ef('0x19'),_0xd90ceb,'request\x20sent');logger['debug'](_0x31ef('0x1a'),_0xd90ceb,'request\x20sent',JSON[_0x31ef('0x1b')](_0x1b95ab));if(_0x1b95ab[_0x31ef('0x1c')]){if(_0x1b95ab[_0x31ef('0x1c')][_0x31ef('0x1d')]===0x1f4){logger[_0x31ef('0x1c')]('Setting,\x20%s,\x20%s',_0xd90ceb,_0x1b95ab[_0x31ef('0x1c')][_0x31ef('0x1e')]);return _0x4889a7(_0x1b95ab[_0x31ef('0x1c')][_0x31ef('0x1e')]);}logger['error']('Setting,\x20%s,\x20%s',_0xd90ceb,_0x1b95ab[_0x31ef('0x1c')][_0x31ef('0x1e')]);return _0x22f9e2(_0x1b95ab[_0x31ef('0x1c')][_0x31ef('0x1e')]);}else{logger['info'](_0x31ef('0x19'),_0xd90ceb,_0x31ef('0x1f'));_0x22f9e2(_0x1b95ab['result'][_0x31ef('0x1e')]);}})[_0x31ef('0x20')](function(_0x492d2c){logger[_0x31ef('0x1c')](_0x31ef('0x19'),_0xd90ceb,_0x492d2c);_0x4889a7(_0x492d2c);});});}function respondWithStatusCode(_0x747daf,_0x283583){_0x283583=_0x283583||0xcc;return function(_0x3fbc50){if(_0x3fbc50){return _0x747daf[_0x31ef('0x21')](_0x283583);}return _0x747daf[_0x31ef('0x22')](_0x283583)['end']();};}function respondWithResult(_0x4d2b58,_0x1622f6){_0x1622f6=_0x1622f6||0xc8;return function(_0x5c686e){if(_0x5c686e){return _0x4d2b58[_0x31ef('0x22')](_0x1622f6)[_0x31ef('0x23')](_0x5c686e);}};}function respondWithFilteredResult(_0x55f6bd,_0x34af31){return function(_0x5b63f0){if(_0x5b63f0){var _0x218a4a=typeof _0x34af31[_0x31ef('0x24')]===_0x31ef('0x25')&&typeof _0x34af31[_0x31ef('0x26')]===_0x31ef('0x25');var _0x25e55e=_0x5b63f0['count'];var _0x13704a=_0x218a4a?0x0:_0x34af31[_0x31ef('0x24')];var _0x489ff6=_0x218a4a?_0x5b63f0['count']:_0x34af31[_0x31ef('0x24')]+_0x34af31[_0x31ef('0x26')];var _0x4399dc;if(_0x489ff6>=_0x25e55e){_0x489ff6=_0x25e55e;_0x4399dc=0xc8;}else{_0x4399dc=0xce;}_0x55f6bd[_0x31ef('0x22')](_0x4399dc);return _0x55f6bd[_0x31ef('0x27')](_0x31ef('0x28'),_0x13704a+'-'+_0x489ff6+'/'+_0x25e55e)[_0x31ef('0x23')](_0x5b63f0);}return null;};}function patchUpdates(_0x423e19){return function(_0xce815b){try{jsonpatch[_0x31ef('0x29')](_0xce815b,_0x423e19,!![]);}catch(_0x4dbb4c){return BPromise[_0x31ef('0x2a')](_0x4dbb4c);}return _0xce815b['save']();};}function saveUpdates(_0xb82460,_0x4188e0){return function(_0x163986){if(_0x163986){return _0x163986['update'](_0xb82460)[_0x31ef('0x17')](function(_0x5604dd){return _0x5604dd;});}return null;};}function removeEntity(_0x50ac3f,_0x257275){return function(_0x80a560){if(_0x80a560){return _0x80a560[_0x31ef('0x2b')]()[_0x31ef('0x17')](function(){_0x50ac3f[_0x31ef('0x22')](0xcc)[_0x31ef('0x2c')]();});}};}function handleEntityNotFound(_0x521708,_0x4a4d8c){return function(_0x3ac151){if(!_0x3ac151){_0x521708[_0x31ef('0x21')](0x194);}return _0x3ac151;};}function handleError(_0x316b20,_0x4f4604){_0x4f4604=_0x4f4604||0x1f4;return function(_0x4ea4cb){logger['error'](_0x4ea4cb[_0x31ef('0x2d')]);if(_0x4ea4cb[_0x31ef('0x2e')]){delete _0x4ea4cb[_0x31ef('0x2e')];}_0x316b20[_0x31ef('0x22')](_0x4f4604)[_0x31ef('0x2f')](_0x4ea4cb);};}exports[_0x31ef('0x30')]=function(_0x2753cd,_0x1316f4){var _0x5a8a4e={},_0x179bc9={},_0x44f474={'count':0x0,'rows':[]};var _0x18a5bf=_[_0x31ef('0x31')](db[_0x31ef('0x32')][_0x31ef('0x33')],function(_0x169f56){return{'name':_0x169f56['fieldName'],'type':_0x169f56['type'][_0x31ef('0x34')]};});_0x179bc9[_0x31ef('0x35')]=_['map'](_0x18a5bf,_0x31ef('0x2e'));_0x179bc9[_0x31ef('0x36')]=_['keys'](_0x2753cd[_0x31ef('0x36')]);_0x179bc9[_0x31ef('0x37')]=_[_0x31ef('0x38')](_0x179bc9[_0x31ef('0x35')],_0x179bc9[_0x31ef('0x36')]);_0x5a8a4e['attributes']=_[_0x31ef('0x38')](_0x179bc9[_0x31ef('0x35')],qs[_0x31ef('0x39')](_0x2753cd[_0x31ef('0x36')][_0x31ef('0x39')]));_0x5a8a4e[_0x31ef('0x3a')]=_0x5a8a4e[_0x31ef('0x3a')][_0x31ef('0x3b')]?_0x5a8a4e['attributes']:_0x179bc9[_0x31ef('0x35')];if(!_0x2753cd[_0x31ef('0x36')][_0x31ef('0x3c')](_0x31ef('0x3d'))){_0x5a8a4e['limit']=qs['limit'](_0x2753cd[_0x31ef('0x36')][_0x31ef('0x26')]);_0x5a8a4e[_0x31ef('0x24')]=qs[_0x31ef('0x24')](_0x2753cd[_0x31ef('0x36')]['offset']);}_0x5a8a4e[_0x31ef('0x3e')]=qs[_0x31ef('0x3f')](_0x2753cd[_0x31ef('0x36')]['sort']);_0x5a8a4e[_0x31ef('0x40')]=qs['filters'](_[_0x31ef('0x41')](_0x2753cd[_0x31ef('0x36')],_0x179bc9[_0x31ef('0x37')]),_0x18a5bf);if(_0x2753cd['query'][_0x31ef('0x42')]){_0x5a8a4e[_0x31ef('0x40')]=_[_0x31ef('0x43')](_0x5a8a4e[_0x31ef('0x40')],{'$or':_['map'](_0x18a5bf,function(_0x241543){if(_0x241543[_0x31ef('0x44')]!==_0x31ef('0x45')){var _0x23b2cf={};_0x23b2cf[_0x241543['name']]={'$like':'%'+_0x2753cd['query'][_0x31ef('0x42')]+'%'};return _0x23b2cf;}})});}_0x5a8a4e=_[_0x31ef('0x43')]({},_0x5a8a4e,_0x2753cd[_0x31ef('0x46')]);var _0x2cc42e={'where':_0x5a8a4e['where']};return db[_0x31ef('0x32')][_0x31ef('0x47')](_0x2cc42e)[_0x31ef('0x17')](function(_0xb7272c){_0x44f474[_0x31ef('0x47')]=_0xb7272c;if(_0x2753cd[_0x31ef('0x36')]['includeAll']){_0x5a8a4e['include']=[{'all':!![]}];}return db[_0x31ef('0x32')][_0x31ef('0x48')](_0x5a8a4e);})['then'](function(_0x2f7c74){_0x44f474[_0x31ef('0x49')]=_0x2f7c74;return _0x44f474;})[_0x31ef('0x17')](respondWithFilteredResult(_0x1316f4,_0x5a8a4e))['catch'](handleError(_0x1316f4,null));};exports[_0x31ef('0x4a')]=function(_0x1ac151,_0x4ac292){var _0x220d89={'raw':![],'where':{'id':_0x1ac151[_0x31ef('0x4b')]['id']}},_0x21ceee={};_0x21ceee['model']=_[_0x31ef('0x4c')](db[_0x31ef('0x32')]['rawAttributes']);_0x21ceee['query']=_[_0x31ef('0x4c')](_0x1ac151[_0x31ef('0x36')]);_0x21ceee[_0x31ef('0x37')]=_[_0x31ef('0x38')](_0x21ceee['model'],_0x21ceee[_0x31ef('0x36')]);_0x220d89[_0x31ef('0x3a')]=_[_0x31ef('0x38')](_0x21ceee[_0x31ef('0x35')],qs[_0x31ef('0x39')](_0x1ac151[_0x31ef('0x36')][_0x31ef('0x39')]));_0x220d89[_0x31ef('0x3a')]=_0x220d89['attributes'][_0x31ef('0x3b')]?_0x220d89[_0x31ef('0x3a')]:_0x21ceee[_0x31ef('0x35')];if(_0x1ac151['query'][_0x31ef('0x4d')]){_0x220d89[_0x31ef('0x4e')]=[{'all':!![]}];}_0x220d89=_[_0x31ef('0x43')]({},_0x220d89,_0x1ac151['options']);return db[_0x31ef('0x32')][_0x31ef('0x4f')](_0x220d89)[_0x31ef('0x17')](handleEntityNotFound(_0x4ac292,null))[_0x31ef('0x17')](respondWithResult(_0x4ac292,null))['catch'](handleError(_0x4ac292,null));};exports[_0x31ef('0x50')]=function(_0x56db1d,_0x24fbfc){if(_0x56db1d[_0x31ef('0x51')]['id']){delete _0x56db1d[_0x31ef('0x51')]['id'];}return db[_0x31ef('0x32')][_0x31ef('0x4f')]({'where':{'id':_0x56db1d[_0x31ef('0x4b')]['id']}})[_0x31ef('0x17')](handleEntityNotFound(_0x24fbfc,null))['then'](saveUpdates(_0x56db1d[_0x31ef('0x51')],null))[_0x31ef('0x17')](respondWithResult(_0x24fbfc,null))[_0x31ef('0x20')](handleError(_0x24fbfc,null));};exports[_0x31ef('0x52')]=function(_0x2766ca,_0x434717,_0x505aba){if(_0x2766ca[_0x31ef('0x53')]&&_0x2766ca[_0x31ef('0x53')][_0x31ef('0x54')]){_0x2766ca['body']['logo']=_0x2766ca[_0x31ef('0x53')]['filename'];}return db[_0x31ef('0x32')]['find']({'where':{'id':_0x2766ca['params']['id']}})[_0x31ef('0x17')](handleEntityNotFound(_0x434717,null))['then'](saveUpdates(_0x2766ca[_0x31ef('0x51')],null))[_0x31ef('0x17')](respondWithResult(_0x434717,null))['catch'](handleError(_0x434717,null));};exports['addLogoLogin']=function(_0x49c358,_0x139709,_0x41c831){if(_0x49c358[_0x31ef('0x53')]&&_0x49c358[_0x31ef('0x53')][_0x31ef('0x54')]){_0x49c358['body'][_0x31ef('0x55')]=_0x49c358[_0x31ef('0x53')][_0x31ef('0x54')];}return db[_0x31ef('0x32')][_0x31ef('0x4f')]({'where':{'id':_0x49c358['params']['id']}})['then'](handleEntityNotFound(_0x139709,null))[_0x31ef('0x17')](saveUpdates(_0x49c358[_0x31ef('0x51')],null))[_0x31ef('0x17')](respondWithResult(_0x139709,null))[_0x31ef('0x20')](handleError(_0x139709,null));};var utilLicense=require('../../config/license/util');exports[_0x31ef('0x56')]=function(_0x1de064,_0x21accd,_0x42bda9){var _0x4a0791=_0x31ef('0x57');var _0x19ba3d={'custom':![]};return utilLicense[_0x31ef('0x58')]()['then'](function(_0x4a61bf){if(_0x4a61bf){_0x19ba3d=_0x4a61bf;}return db[_0x31ef('0x32')][_0x31ef('0x4f')]({'where':{'id':_0x1de064[_0x31ef('0x4b')]['id']},'attributes':[_0x31ef('0x59'),_0x31ef('0x55'),'preferred',_0x31ef('0x5a'),'defaultLogo','defaultLoginLogo','defaultPreferred',_0x31ef('0x5b')],'raw':!![]});})[_0x31ef('0x17')](handleEntityNotFound(_0x21accd,null))['then'](function(_0x584f25){if(_0x584f25){var _0x5eff1a=_0x584f25[_0x31ef('0x59')]&&fs['existsSync'](path[_0x31ef('0x5c')](config[_0x31ef('0x5d')],_0x4a0791,_[_0x31ef('0x5e')](_0x584f25['logo'])))?path[_0x31ef('0x5c')](config[_0x31ef('0x5d')],_0x4a0791,_[_0x31ef('0x5e')](_0x584f25[_0x31ef('0x59')])):path[_0x31ef('0x5c')](config[_0x31ef('0x5d')],_0x4a0791,_[_0x31ef('0x5e')]('default_logo.svg'));var _0x49a766=_0x31ef('0x5f')+_[_0x31ef('0x60')](_0x31ef('0x59'));if(_0x584f25[_0x49a766]||!_0x19ba3d[_0x31ef('0x61')]){_0x5eff1a=path[_0x31ef('0x5c')](config[_0x31ef('0x5d')],_0x4a0791,_[_0x31ef('0x5e')](_0x31ef('0x62')));}if(!fs[_0x31ef('0x63')](_0x5eff1a)){throw new db['Sequelize']['ValidationError'](_['upperFirst'](_0x31ef('0x59'))+'\x20not\x20found');}return _0x21accd['download'](_0x5eff1a);}})[_0x31ef('0x20')](handleError(_0x21accd,null));};var utilLicense=require('../../config/license/util');exports['getLogoLogin']=function(_0x1a4a2a,_0x49821f,_0xc4001a){var _0x29cb4c=_0x31ef('0x57');var _0x383ba0={'custom':![]};return utilLicense['getLicense']()['then'](function(_0x296eed){if(_0x296eed){_0x383ba0=_0x296eed;}return db[_0x31ef('0x32')][_0x31ef('0x4f')]({'where':{'id':_0x1a4a2a[_0x31ef('0x4b')]['id']},'attributes':[_0x31ef('0x59'),'loginLogo',_0x31ef('0x64'),_0x31ef('0x5a'),_0x31ef('0x65'),_0x31ef('0x66'),_0x31ef('0x67'),_0x31ef('0x5b')],'raw':!![]});})['then'](handleEntityNotFound(_0x49821f,null))[_0x31ef('0x17')](function(_0x58cad4){if(_0x58cad4){var _0x38065c=_0x58cad4[_0x31ef('0x55')]&&fs['existsSync'](path[_0x31ef('0x5c')](config[_0x31ef('0x5d')],_0x29cb4c,_[_0x31ef('0x5e')](_0x58cad4[_0x31ef('0x55')])))?path[_0x31ef('0x5c')](config[_0x31ef('0x5d')],_0x29cb4c,_[_0x31ef('0x5e')](_0x58cad4[_0x31ef('0x55')])):path['join'](config['root'],_0x29cb4c,_[_0x31ef('0x5e')](_0x31ef('0x68')));var _0x2e2bc4='default'+_['upperFirst']('loginLogo');if(_0x58cad4[_0x2e2bc4]||!_0x383ba0[_0x31ef('0x61')]){_0x38065c=path[_0x31ef('0x5c')](config[_0x31ef('0x5d')],_0x29cb4c,_[_0x31ef('0x5e')](_0x31ef('0x68')));}if(!fs['existsSync'](_0x38065c)){throw new db[(_0x31ef('0x69'))][(_0x31ef('0x6a'))](_['upperFirst'](_0x31ef('0x55'))+'\x20not\x20found');}return _0x49821f[_0x31ef('0x6b')](_0x38065c);}})[_0x31ef('0x20')](handleError(_0x49821f,null));};exports[_0x31ef('0x6c')]=function(_0x580bb8,_0x138dda){return db[_0x31ef('0x32')][_0x31ef('0x4f')]({'where':{'id':_0x580bb8['params']['id']},'attributes':[_0x31ef('0x6d')]})[_0x31ef('0x17')](respondWithResult(_0x138dda,null))[_0x31ef('0x20')](handleError(_0x138dda,null));};exports[_0x31ef('0x6e')]=function(_0x2d44ff,_0x13cba9,_0x157f54){if(_0x2d44ff[_0x31ef('0x53')]&&_0x2d44ff['file'][_0x31ef('0x54')]){_0x2d44ff[_0x31ef('0x51')][_0x31ef('0x64')]=_0x2d44ff['file'][_0x31ef('0x54')];}return db[_0x31ef('0x32')][_0x31ef('0x4f')]({'where':{'id':_0x2d44ff['params']['id']}})['then'](handleEntityNotFound(_0x13cba9,null))['then'](saveUpdates(_0x2d44ff[_0x31ef('0x51')],null))[_0x31ef('0x17')](respondWithResult(_0x13cba9,null))[_0x31ef('0x20')](handleError(_0x13cba9,null));};var utilLicense=require(_0x31ef('0x15'));exports[_0x31ef('0x6f')]=function(_0x216214,_0x4508b3,_0x2b18be){var _0x48c47c=_0x31ef('0x57');var _0x5d46b7={'custom':![]};return utilLicense['getLicense']()[_0x31ef('0x17')](function(_0x319baa){if(_0x319baa){_0x5d46b7=_0x319baa;}return db['Setting'][_0x31ef('0x4f')]({'where':{'id':_0x216214[_0x31ef('0x4b')]['id']},'attributes':['logo',_0x31ef('0x55'),_0x31ef('0x64'),_0x31ef('0x5a'),_0x31ef('0x65'),_0x31ef('0x66'),_0x31ef('0x67'),'defaultFavicon'],'raw':!![]});})[_0x31ef('0x17')](handleEntityNotFound(_0x4508b3,null))[_0x31ef('0x17')](function(_0x11c155){if(_0x11c155){var _0x3a75d7=_0x11c155[_0x31ef('0x64')]&&fs[_0x31ef('0x63')](path[_0x31ef('0x5c')](config[_0x31ef('0x5d')],_0x48c47c,_[_0x31ef('0x5e')](_0x11c155[_0x31ef('0x64')])))?path[_0x31ef('0x5c')](config['root'],_0x48c47c,_[_0x31ef('0x5e')](_0x11c155['preferred'])):path[_0x31ef('0x5c')](config[_0x31ef('0x5d')],_0x48c47c,_[_0x31ef('0x5e')](_0x31ef('0x70')));var _0x299693=_0x31ef('0x5f')+_['upperFirst']('preferred');if(_0x11c155[_0x299693]||!_0x5d46b7['custom']||!_0x5d46b7[_0x31ef('0x64')]){_0x3a75d7=path[_0x31ef('0x5c')](config['root'],_0x48c47c,_[_0x31ef('0x5e')](_0x31ef('0x70')));}if(!fs[_0x31ef('0x63')](_0x3a75d7)){throw new db[(_0x31ef('0x69'))][(_0x31ef('0x6a'))](_['upperFirst'](_0x31ef('0x64'))+_0x31ef('0x71'));}return _0x4508b3[_0x31ef('0x6b')](_0x3a75d7);}})[_0x31ef('0x20')](handleError(_0x4508b3,null));};exports[_0x31ef('0x72')]=function(_0x43deeb,_0x4026f7,_0x33cdf){if(_0x43deeb[_0x31ef('0x53')]&&_0x43deeb[_0x31ef('0x53')]['filename']){_0x43deeb[_0x31ef('0x51')]['favicon']=_0x43deeb[_0x31ef('0x53')][_0x31ef('0x54')];}return db[_0x31ef('0x32')]['find']({'where':{'id':_0x43deeb[_0x31ef('0x4b')]['id']}})[_0x31ef('0x17')](handleEntityNotFound(_0x4026f7,null))[_0x31ef('0x17')](saveUpdates(_0x43deeb['body'],null))[_0x31ef('0x17')](respondWithResult(_0x4026f7,null))[_0x31ef('0x20')](handleError(_0x4026f7,null));};var utilLicense=require(_0x31ef('0x15'));exports[_0x31ef('0x73')]=function(_0xb5913f,_0x29fb5a,_0x9c512d){var _0x210ec3=_0x31ef('0x57');var _0x46c2ac={'custom':![]};return utilLicense[_0x31ef('0x58')]()['then'](function(_0x2c5d06){if(_0x2c5d06){_0x46c2ac=_0x2c5d06;}return db[_0x31ef('0x32')]['find']({'where':{'id':_0xb5913f[_0x31ef('0x4b')]['id']},'attributes':[_0x31ef('0x59'),'loginLogo',_0x31ef('0x64'),_0x31ef('0x5a'),_0x31ef('0x65'),_0x31ef('0x66'),_0x31ef('0x67'),_0x31ef('0x5b')],'raw':!![]});})[_0x31ef('0x17')](handleEntityNotFound(_0x29fb5a,null))[_0x31ef('0x17')](function(_0x3b9ead){if(_0x3b9ead){var _0x32865f=_0x3b9ead[_0x31ef('0x5a')]&&fs[_0x31ef('0x63')](path['join'](config['root'],_0x210ec3,_[_0x31ef('0x5e')](_0x3b9ead[_0x31ef('0x5a')])))?path[_0x31ef('0x5c')](config[_0x31ef('0x5d')],_0x210ec3,_['toLower'](_0x3b9ead[_0x31ef('0x5a')])):path['join'](config[_0x31ef('0x5d')],_0x210ec3,_[_0x31ef('0x5e')]('default_favicon.ico'));var _0x817519=_0x31ef('0x5f')+_['upperFirst'](_0x31ef('0x5a'));if(_0x3b9ead[_0x817519]||!_0x46c2ac['custom']){_0x32865f=path['join'](config[_0x31ef('0x5d')],_0x210ec3,_['toLower']('default_favicon.ico'));}if(!fs[_0x31ef('0x63')](_0x32865f)){throw new db[(_0x31ef('0x69'))][(_0x31ef('0x6a'))](_[_0x31ef('0x60')](_0x31ef('0x5a'))+'\x20not\x20found');}return _0x29fb5a[_0x31ef('0x6b')](_0x32865f);}})[_0x31ef('0x20')](handleError(_0x29fb5a,null));};exports[_0x31ef('0x74')]=function(_0x1b600b,_0x2ea6a1){var _0x4f5574={'offset':moment()[_0x31ef('0x75')]()};_0x4f5574[_0x31ef('0x76')]=moment()[_0x31ef('0x75')](_0x4f5574[_0x31ef('0x24')])[_0x31ef('0x77')](_0x31ef('0x78'));return _0x2ea6a1[_0x31ef('0x22')](0xc8)['send'](_0x4f5574);}; \ No newline at end of file diff --git a/server/api/setting/setting.model.js b/server/api/setting/setting.model.js index d1c724b..a650ed3 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 _0xedd9=['../../config/logger','api','moment','bluebird','request-promise','path','rimraf','./setting.attributes','exports','Setting','util'];(function(_0x1c4512,_0x1ce551){var _0x285175=function(_0x2feef7){while(--_0x2feef7){_0x1c4512['push'](_0x1c4512['shift']());}};_0x285175(++_0x1ce551);}(_0xedd9,0xfc));var _0x9edd=function(_0x51df5c,_0x154c31){_0x51df5c=_0x51df5c-0x0;var _0x5608f6=_0xedd9[_0x51df5c];return _0x5608f6;};'use strict';var _=require('lodash');var util=require(_0x9edd('0x0'));var logger=require(_0x9edd('0x1'))(_0x9edd('0x2'));var moment=require(_0x9edd('0x3'));var BPromise=require(_0x9edd('0x4'));var rp=require(_0x9edd('0x5'));var fs=require('fs');var path=require(_0x9edd('0x6'));var rimraf=require(_0x9edd('0x7'));var config=require('../../config/environment');var attributes=require(_0x9edd('0x8'));module[_0x9edd('0x9')]=function(_0x268f9e,_0x34c1a7){return _0x268f9e['define'](_0x9edd('0xa'),attributes,{'tableName':'settings','paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x008c=['define','settings','lodash','util','../../config/logger','api','moment','request-promise','path','rimraf','../../config/environment','./setting.attributes','exports'];(function(_0x3b6cc7,_0x5df0c1){var _0x37f564=function(_0x160517){while(--_0x160517){_0x3b6cc7['push'](_0x3b6cc7['shift']());}};_0x37f564(++_0x5df0c1);}(_0x008c,0x188));var _0xc008=function(_0x53c4f8,_0x44ccaf){_0x53c4f8=_0x53c4f8-0x0;var _0x416458=_0x008c[_0x53c4f8];return _0x416458;};'use strict';var _=require(_0xc008('0x0'));var util=require(_0xc008('0x1'));var logger=require(_0xc008('0x2'))(_0xc008('0x3'));var moment=require(_0xc008('0x4'));var BPromise=require('bluebird');var rp=require(_0xc008('0x5'));var fs=require('fs');var path=require(_0xc008('0x6'));var rimraf=require(_0xc008('0x7'));var config=require(_0xc008('0x8'));var attributes=require(_0xc008('0x9'));module[_0xc008('0xa')]=function(_0x13aa7,_0x39bb5e){return _0x13aa7[_0xc008('0xb')]('Setting',attributes,{'tableName':_0xc008('0xc'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/setting/setting.rpc.js b/server/api/setting/setting.rpc.js index 32702ac..977e70d 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 _0x17ab=['../../config/environment','client','http','then','Setting,\x20%s,\x20%s','debug','request\x20sent','stringify','error','code','message','result','catch','ShowSetting','Setting','find','options','where','attributes','include','map','model','lodash','util','moment','bluebird','randomstring','ioredis','../../config/utils','../../config/logger','rpc'];(function(_0x25e9a4,_0x2cec74){var _0x5d4cbc=function(_0x10716b){while(--_0x10716b){_0x25e9a4['push'](_0x25e9a4['shift']());}};_0x5d4cbc(++_0x2cec74);}(_0x17ab,0x1c8));var _0xb17a=function(_0x4db3ab,_0x21b706){_0x4db3ab=_0x4db3ab-0x0;var _0x473e79=_0x17ab[_0x4db3ab];return _0x473e79;};'use strict';var _=require(_0xb17a('0x0'));var util=require(_0xb17a('0x1'));var moment=require(_0xb17a('0x2'));var BPromise=require(_0xb17a('0x3'));var rs=require(_0xb17a('0x4'));var fs=require('fs');var Redis=require(_0xb17a('0x5'));var db=require('../../mysqldb')['db'];var utils=require(_0xb17a('0x6'));var logger=require(_0xb17a('0x7'))(_0xb17a('0x8'));var config=require(_0xb17a('0x9'));var jayson=require('jayson/promise');var client=jayson[_0xb17a('0xa')][_0xb17a('0xb')]({'port':0x232a});function respondWithRpcPromise(_0xc596e5,_0x3366f7,_0x47782e){return new BPromise(function(_0x4e25ef,_0x1c6ca7){return client['request'](_0xc596e5,_0x47782e)[_0xb17a('0xc')](function(_0x4defde){logger['info'](_0xb17a('0xd'),_0x3366f7,'request\x20sent');logger[_0xb17a('0xe')]('Setting,\x20%s,\x20%s,\x20%s',_0x3366f7,_0xb17a('0xf'),JSON[_0xb17a('0x10')](_0x4defde));if(_0x4defde[_0xb17a('0x11')]){if(_0x4defde[_0xb17a('0x11')][_0xb17a('0x12')]===0x1f4){logger[_0xb17a('0x11')](_0xb17a('0xd'),_0x3366f7,_0x4defde[_0xb17a('0x11')][_0xb17a('0x13')]);return _0x1c6ca7(_0x4defde[_0xb17a('0x11')][_0xb17a('0x13')]);}logger['error'](_0xb17a('0xd'),_0x3366f7,_0x4defde['error']['message']);return _0x4e25ef(_0x4defde[_0xb17a('0x11')][_0xb17a('0x13')]);}else{logger['info'](_0xb17a('0xd'),_0x3366f7,_0xb17a('0xf'));_0x4e25ef(_0x4defde[_0xb17a('0x14')][_0xb17a('0x13')]);}})[_0xb17a('0x15')](function(_0x1bdafd){logger[_0xb17a('0x11')](_0xb17a('0xd'),_0x3366f7,_0x1bdafd);_0x1c6ca7(_0x1bdafd);});});}exports[_0xb17a('0x16')]=function(_0x3450cc){var _0x37bc49=this;return new Promise(function(_0x47fb1a,_0x57d11f){return db[_0xb17a('0x17')][_0xb17a('0x18')]({'raw':_0x3450cc[_0xb17a('0x19')]?_0x3450cc[_0xb17a('0x19')]['raw']===undefined?!![]:![]:!![],'where':_0x3450cc[_0xb17a('0x19')]?_0x3450cc['options'][_0xb17a('0x1a')]||null:null,'attributes':_0x3450cc[_0xb17a('0x19')]?_0x3450cc['options'][_0xb17a('0x1b')]||null:null,'include':_0x3450cc['options']?_0x3450cc[_0xb17a('0x19')][_0xb17a('0x1c')]?_[_0xb17a('0x1d')](_0x3450cc['options'][_0xb17a('0x1c')],function(_0x2ac7f8){return{'model':db[_0x2ac7f8[_0xb17a('0x1e')]],'as':_0x2ac7f8['as'],'attributes':_0x2ac7f8[_0xb17a('0x1b')],'include':_0x2ac7f8[_0xb17a('0x1c')]?_['map'](_0x2ac7f8[_0xb17a('0x1c')],function(_0x3df3aa){return{'model':db[_0x3df3aa['model']],'as':_0x3df3aa['as'],'attributes':_0x3df3aa[_0xb17a('0x1b')],'include':_0x3df3aa['include']?_[_0xb17a('0x1d')](_0x3df3aa[_0xb17a('0x1c')],function(_0x2fda55){return{'model':db[_0x2fda55[_0xb17a('0x1e')]],'as':_0x2fda55['as'],'attributes':_0x2fda55[_0xb17a('0x1b')]};}):[]};}):[]};}):[]:[]})[_0xb17a('0xc')](function(_0x3f4a14){logger['info']('ShowSetting',_0x3450cc);logger[_0xb17a('0xe')](_0xb17a('0x16'),_0x3450cc,JSON['stringify'](_0x3f4a14));_0x47fb1a(_0x3f4a14);})[_0xb17a('0x15')](function(_0x17e080){logger['error'](_0xb17a('0x16'),_0x17e080[_0xb17a('0x13')],_0x3450cc);_0x57d11f(_0x37bc49[_0xb17a('0x11')](0x1f4,_0x17e080['message']));});});}; \ No newline at end of file +var _0xe75c=['info','Setting,\x20%s,\x20%s','request\x20sent','debug','Setting,\x20%s,\x20%s,\x20%s','stringify','error','message','result','catch','ShowSetting','Setting','find','options','raw','where','attributes','include','model','map','then','lodash','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','jayson/promise','client','http'];(function(_0x3dd15e,_0x1f0015){var _0x231fd0=function(_0x4f680a){while(--_0x4f680a){_0x3dd15e['push'](_0x3dd15e['shift']());}};_0x231fd0(++_0x1f0015);}(_0xe75c,0x175));var _0xce75=function(_0x20a584,_0xe384a5){_0x20a584=_0x20a584-0x0;var _0x4b41a8=_0xe75c[_0x20a584];return _0x4b41a8;};'use strict';var _=require(_0xce75('0x0'));var util=require('util');var moment=require(_0xce75('0x1'));var BPromise=require(_0xce75('0x2'));var rs=require(_0xce75('0x3'));var fs=require('fs');var Redis=require(_0xce75('0x4'));var db=require(_0xce75('0x5'))['db'];var utils=require(_0xce75('0x6'));var logger=require(_0xce75('0x7'))('rpc');var config=require('../../config/environment');var jayson=require(_0xce75('0x8'));var client=jayson[_0xce75('0x9')][_0xce75('0xa')]({'port':0x232a});function respondWithRpcPromise(_0x1d4fdd,_0x19d30e,_0x432564){return new BPromise(function(_0x2084be,_0x38f0ba){return client['request'](_0x1d4fdd,_0x432564)['then'](function(_0x29dc70){logger[_0xce75('0xb')](_0xce75('0xc'),_0x19d30e,_0xce75('0xd'));logger[_0xce75('0xe')](_0xce75('0xf'),_0x19d30e,_0xce75('0xd'),JSON[_0xce75('0x10')](_0x29dc70));if(_0x29dc70[_0xce75('0x11')]){if(_0x29dc70[_0xce75('0x11')]['code']===0x1f4){logger[_0xce75('0x11')](_0xce75('0xc'),_0x19d30e,_0x29dc70['error'][_0xce75('0x12')]);return _0x38f0ba(_0x29dc70[_0xce75('0x11')]['message']);}logger['error'](_0xce75('0xc'),_0x19d30e,_0x29dc70[_0xce75('0x11')][_0xce75('0x12')]);return _0x2084be(_0x29dc70[_0xce75('0x11')][_0xce75('0x12')]);}else{logger['info'](_0xce75('0xc'),_0x19d30e,_0xce75('0xd'));_0x2084be(_0x29dc70[_0xce75('0x13')][_0xce75('0x12')]);}})[_0xce75('0x14')](function(_0x2f2340){logger['error'](_0xce75('0xc'),_0x19d30e,_0x2f2340);_0x38f0ba(_0x2f2340);});});}exports[_0xce75('0x15')]=function(_0x5b9c9f){var _0x2bfcec=this;return new Promise(function(_0x5d8568,_0x3c6f3b){return db[_0xce75('0x16')][_0xce75('0x17')]({'raw':_0x5b9c9f['options']?_0x5b9c9f[_0xce75('0x18')][_0xce75('0x19')]===undefined?!![]:![]:!![],'where':_0x5b9c9f['options']?_0x5b9c9f['options'][_0xce75('0x1a')]||null:null,'attributes':_0x5b9c9f[_0xce75('0x18')]?_0x5b9c9f['options'][_0xce75('0x1b')]||null:null,'include':_0x5b9c9f[_0xce75('0x18')]?_0x5b9c9f[_0xce75('0x18')][_0xce75('0x1c')]?_['map'](_0x5b9c9f[_0xce75('0x18')][_0xce75('0x1c')],function(_0x48e617){return{'model':db[_0x48e617[_0xce75('0x1d')]],'as':_0x48e617['as'],'attributes':_0x48e617[_0xce75('0x1b')],'include':_0x48e617[_0xce75('0x1c')]?_['map'](_0x48e617[_0xce75('0x1c')],function(_0x4d1c09){return{'model':db[_0x4d1c09[_0xce75('0x1d')]],'as':_0x4d1c09['as'],'attributes':_0x4d1c09[_0xce75('0x1b')],'include':_0x4d1c09[_0xce75('0x1c')]?_[_0xce75('0x1e')](_0x4d1c09[_0xce75('0x1c')],function(_0x9c8b2a){return{'model':db[_0x9c8b2a[_0xce75('0x1d')]],'as':_0x9c8b2a['as'],'attributes':_0x9c8b2a[_0xce75('0x1b')]};}):[]};}):[]};}):[]:[]})[_0xce75('0x1f')](function(_0xbcedfb){logger[_0xce75('0xb')](_0xce75('0x15'),_0x5b9c9f);logger[_0xce75('0xe')](_0xce75('0x15'),_0x5b9c9f,JSON[_0xce75('0x10')](_0xbcedfb));_0x5d8568(_0xbcedfb);})[_0xce75('0x14')](function(_0x19d0b3){logger['error'](_0xce75('0x15'),_0x19d0b3[_0xce75('0x12')],_0x5b9c9f);_0x3c6f3b(_0x2bfcec[_0xce75('0x11')](0x1f4,_0x19d0b3[_0xce75('0x12')]));});});}; \ No newline at end of file diff --git a/server/api/smsAccount/index.js b/server/api/smsAccount/index.js index 6586aa2..10c9f7f 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 _0x7a54=['getInteractions','/:id/status','statusGet','/:id/users','post','create','addAnswer','/:id/notify','notify','addApplications','send','status','addAgents','put','/:id','update','delete','destroy','/:id/canned_answers','removeAnswers','removeAgents','exports','multer','util','path','express','Router','../../components/auth/service','../../components/interaction/service','../../config/environment','./smsAccount.controller','get','index','/describe','isAuthenticated','/:id/dispositions','getDispositions','getAnswers','/:id/applications','getApplications'];(function(_0x16b212,_0x3c3472){var _0x349fa1=function(_0x2d95e4){while(--_0x2d95e4){_0x16b212['push'](_0x16b212['shift']());}};_0x349fa1(++_0x3c3472);}(_0x7a54,0x106));var _0x47a5=function(_0x449146,_0xe4e647){_0x449146=_0x449146-0x0;var _0x56941f=_0x7a54[_0x449146];return _0x56941f;};'use strict';var multer=require(_0x47a5('0x0'));var util=require(_0x47a5('0x1'));var path=require(_0x47a5('0x2'));var timeout=require('connect-timeout');var express=require(_0x47a5('0x3'));var router=express[_0x47a5('0x4')]();var fs_extra=require('fs-extra');var auth=require(_0x47a5('0x5'));var interaction=require(_0x47a5('0x6'));var config=require(_0x47a5('0x7'));var controller=require(_0x47a5('0x8'));router[_0x47a5('0x9')]('/',auth['isAuthenticated'](),controller[_0x47a5('0xa')]);router['get'](_0x47a5('0xb'),auth[_0x47a5('0xc')](),controller['describe']);router[_0x47a5('0x9')]('/:id',auth['isAuthenticated'](),controller['show']);router[_0x47a5('0x9')](_0x47a5('0xd'),auth['isAuthenticated'](),controller[_0x47a5('0xe')]);router['get']('/:id/canned_answers',auth[_0x47a5('0xc')](),controller[_0x47a5('0xf')]);router[_0x47a5('0x9')](_0x47a5('0x10'),auth[_0x47a5('0xc')](),controller[_0x47a5('0x11')]);router[_0x47a5('0x9')]('/:id/interactions',auth[_0x47a5('0xc')](),controller[_0x47a5('0x12')]);router[_0x47a5('0x9')](_0x47a5('0x13'),controller[_0x47a5('0x14')]);router[_0x47a5('0x9')](_0x47a5('0x15'),auth[_0x47a5('0xc')](),controller['getAgents']);router[_0x47a5('0x16')]('/',auth[_0x47a5('0xc')](),controller[_0x47a5('0x17')]);router[_0x47a5('0x16')](_0x47a5('0xd'),auth['isAuthenticated'](),controller['addDisposition']);router[_0x47a5('0x16')]('/:id/canned_answers',auth['isAuthenticated'](),controller[_0x47a5('0x18')]);router[_0x47a5('0x16')](_0x47a5('0x19'),controller[_0x47a5('0x1a')]);router[_0x47a5('0x16')](_0x47a5('0x10'),auth[_0x47a5('0xc')](),controller[_0x47a5('0x1b')]);router[_0x47a5('0x16')]('/:id/send',auth[_0x47a5('0xc')](),controller[_0x47a5('0x1c')]);router['post'](_0x47a5('0x13'),controller[_0x47a5('0x1d')]);router[_0x47a5('0x16')]('/:id/users',auth[_0x47a5('0xc')](),controller[_0x47a5('0x1e')]);router[_0x47a5('0x1f')](_0x47a5('0x20'),auth['isAuthenticated'](),controller[_0x47a5('0x21')]);router[_0x47a5('0x22')]('/:id',auth[_0x47a5('0xc')](),controller[_0x47a5('0x23')]);router[_0x47a5('0x22')](_0x47a5('0xd'),auth[_0x47a5('0xc')](),controller['removeDispositions']);router['delete'](_0x47a5('0x24'),auth['isAuthenticated'](),controller[_0x47a5('0x25')]);router['delete'](_0x47a5('0x15'),auth[_0x47a5('0xc')](),controller[_0x47a5('0x26')]);module[_0x47a5('0x27')]=router; \ No newline at end of file +var _0x7a54=['getInteractions','/:id/status','statusGet','/:id/users','post','create','addAnswer','/:id/notify','notify','addApplications','send','status','addAgents','put','/:id','update','delete','destroy','/:id/canned_answers','removeAnswers','removeAgents','exports','multer','util','path','express','Router','../../components/auth/service','../../components/interaction/service','../../config/environment','./smsAccount.controller','get','index','/describe','isAuthenticated','/:id/dispositions','getDispositions','getAnswers','/:id/applications','getApplications'];(function(_0x439b3e,_0x1cd59a){var _0x10324a=function(_0x4b732e){while(--_0x4b732e){_0x439b3e['push'](_0x439b3e['shift']());}};_0x10324a(++_0x1cd59a);}(_0x7a54,0x106));var _0x47a5=function(_0x3e5ec4,_0x4f7dd3){_0x3e5ec4=_0x3e5ec4-0x0;var _0x4e0297=_0x7a54[_0x3e5ec4];return _0x4e0297;};'use strict';var multer=require(_0x47a5('0x0'));var util=require(_0x47a5('0x1'));var path=require(_0x47a5('0x2'));var timeout=require('connect-timeout');var express=require(_0x47a5('0x3'));var router=express[_0x47a5('0x4')]();var fs_extra=require('fs-extra');var auth=require(_0x47a5('0x5'));var interaction=require(_0x47a5('0x6'));var config=require(_0x47a5('0x7'));var controller=require(_0x47a5('0x8'));router[_0x47a5('0x9')]('/',auth['isAuthenticated'](),controller[_0x47a5('0xa')]);router['get'](_0x47a5('0xb'),auth[_0x47a5('0xc')](),controller['describe']);router[_0x47a5('0x9')]('/:id',auth['isAuthenticated'](),controller['show']);router[_0x47a5('0x9')](_0x47a5('0xd'),auth['isAuthenticated'](),controller[_0x47a5('0xe')]);router['get']('/:id/canned_answers',auth[_0x47a5('0xc')](),controller[_0x47a5('0xf')]);router[_0x47a5('0x9')](_0x47a5('0x10'),auth[_0x47a5('0xc')](),controller[_0x47a5('0x11')]);router[_0x47a5('0x9')]('/:id/interactions',auth[_0x47a5('0xc')](),controller[_0x47a5('0x12')]);router[_0x47a5('0x9')](_0x47a5('0x13'),controller[_0x47a5('0x14')]);router[_0x47a5('0x9')](_0x47a5('0x15'),auth[_0x47a5('0xc')](),controller['getAgents']);router[_0x47a5('0x16')]('/',auth[_0x47a5('0xc')](),controller[_0x47a5('0x17')]);router[_0x47a5('0x16')](_0x47a5('0xd'),auth['isAuthenticated'](),controller['addDisposition']);router[_0x47a5('0x16')]('/:id/canned_answers',auth['isAuthenticated'](),controller[_0x47a5('0x18')]);router[_0x47a5('0x16')](_0x47a5('0x19'),controller[_0x47a5('0x1a')]);router[_0x47a5('0x16')](_0x47a5('0x10'),auth[_0x47a5('0xc')](),controller[_0x47a5('0x1b')]);router[_0x47a5('0x16')]('/:id/send',auth[_0x47a5('0xc')](),controller[_0x47a5('0x1c')]);router['post'](_0x47a5('0x13'),controller[_0x47a5('0x1d')]);router[_0x47a5('0x16')]('/:id/users',auth[_0x47a5('0xc')](),controller[_0x47a5('0x1e')]);router[_0x47a5('0x1f')](_0x47a5('0x20'),auth['isAuthenticated'](),controller[_0x47a5('0x21')]);router[_0x47a5('0x22')]('/:id',auth[_0x47a5('0xc')](),controller[_0x47a5('0x23')]);router[_0x47a5('0x22')](_0x47a5('0xd'),auth[_0x47a5('0xc')](),controller['removeDispositions']);router['delete'](_0x47a5('0x24'),auth['isAuthenticated'](),controller[_0x47a5('0x25')]);router['delete'](_0x47a5('0x15'),auth[_0x47a5('0xc')](),controller[_0x47a5('0x26')]);module[_0x47a5('0x27')]=router; \ No newline at end of file diff --git a/server/api/smsAccount/smsAccount.attributes.js b/server/api/smsAccount/smsAccount.attributes.js index 3393c9e..a54f62f 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 _0x7938=['TEXT','Account:\x20{{account.name}}
{{#queue}}Queue:\x20{{queue.name}}
{{/queue}}From\x20:\x20{{from}}','INTEGER','Status\x20to\x20put\x20when\x20mandatory\x20disposition\x20is\x20enabled','Enabled/disables\x20mandatory\x20dispo\x20on\x20a\x20queue','setDataValue','mandatoryDisposition','sequelize','randomstring','exports','STRING','name','generate','ENUM','twilio','skebby','connectel','plivo','clickatell','bandwidth','csc','infobip','intelepeer','BOOLEAN'];(function(_0x5a1ffc,_0x4eb25a){var _0x49c462=function(_0x246990){while(--_0x246990){_0x5a1ffc['push'](_0x5a1ffc['shift']());}};_0x49c462(++_0x4eb25a);}(_0x7938,0x7f));var _0x8793=function(_0xa691ee,_0x48c364){_0xa691ee=_0xa691ee-0x0;var _0x2cb66d=_0x7938[_0xa691ee];return _0x2cb66d;};'use strict';var Sequelize=require(_0x8793('0x0'));var rs=require(_0x8793('0x1'));module[_0x8793('0x2')]={'name':{'type':Sequelize[_0x8793('0x3')],'unique':_0x8793('0x4'),'allowNull':![]},'key':{'type':Sequelize['STRING'],'allowNull':![]},'remote':{'type':Sequelize['STRING'],'allowNull':![]},'token':{'type':Sequelize['STRING'],'defaultValue':function(){return rs[_0x8793('0x5')]();}},'phone':{'type':Sequelize[_0x8793('0x3')]},'type':{'type':Sequelize[_0x8793('0x6')](_0x8793('0x7'),_0x8793('0x8'),_0x8793('0x9'),'clicksend',_0x8793('0xa'),_0x8793('0xb'),_0x8793('0xc'),_0x8793('0xd'),_0x8793('0xe'),_0x8793('0xf'))},'accountSid':{'type':Sequelize[_0x8793('0x3')]},'authId':{'type':Sequelize['STRING']},'authToken':{'type':Sequelize[_0x8793('0x3')]},'smsMethod':{'type':Sequelize[_0x8793('0x6')]('SI','TI','GP')},'username':{'type':Sequelize[_0x8793('0x3')]},'password':{'type':Sequelize[_0x8793('0x3')]},'apiKey':{'type':Sequelize[_0x8793('0x3')]},'applicationId':{'type':Sequelize['STRING']},'accountId':{'type':Sequelize[_0x8793('0x3')]},'senderString':{'type':Sequelize[_0x8793('0x3')]},'deliveryReport':{'type':Sequelize[_0x8793('0x10')],'defaultValue':![]},'description':{'type':Sequelize['STRING']},'notificationTemplate':{'type':Sequelize[_0x8793('0x11')],'defaultValue':function(){return _0x8793('0x12');}},'notificationSound':{'type':Sequelize['BOOLEAN'],'defaultValue':!![]},'notificationShake':{'type':Sequelize[_0x8793('0x10')],'defaultValue':![]},'waitForTheAssignedAgent':{'type':Sequelize[_0x8793('0x13')],'validate':{'min':0x1,'max':0x20c49b},'defaultValue':0xa},'waitForTheAssignedQueue':{'type':Sequelize[_0x8793('0x13')],'validate':{'min':0x1,'max':0x20c49b},'defaultValue':0xa},'queueTransfer':{'type':Sequelize[_0x8793('0x10')],'defaultValue':![]},'queueTransferTimeout':{'type':Sequelize['INTEGER'],'validate':{'min':0x1,'max':0x20c49b},'defaultValue':0x12c},'agentTransfer':{'type':Sequelize[_0x8793('0x10')],'defaultValue':![]},'agentTransferTimeout':{'type':Sequelize['INTEGER'],'validate':{'min':0x1,'max':0x20c49b},'defaultValue':0x12c},'baseUrl':{'type':Sequelize[_0x8793('0x3')]},'mandatoryDispositionPauseId':{'type':Sequelize[_0x8793('0x13')],'comment':_0x8793('0x14')},'mandatoryDisposition':{'type':Sequelize[_0x8793('0x10')],'defaultValue':![],'comment':_0x8793('0x15'),'set':function(_0x5918ab){if(!_0x5918ab)this[_0x8793('0x16')]('mandatoryDispositionPauseId',null);this[_0x8793('0x16')](_0x8793('0x17'),_0x5918ab);}}}; \ No newline at end of file +var _0xdde1=['clicksend','clickatell','bandwidth','csc','infobip','BOOLEAN','INTEGER','Status\x20to\x20put\x20when\x20mandatory\x20disposition\x20is\x20enabled','setDataValue','mandatoryDispositionPauseId','mandatoryDisposition','sequelize','randomstring','exports','name','STRING','generate','ENUM','twilio','skebby','connectel'];(function(_0x4f7b43,_0x119c22){var _0x2fcdf3=function(_0xaeee0c){while(--_0xaeee0c){_0x4f7b43['push'](_0x4f7b43['shift']());}};_0x2fcdf3(++_0x119c22);}(_0xdde1,0x19a));var _0x1dde=function(_0x5f0089,_0x227e2c){_0x5f0089=_0x5f0089-0x0;var _0x193892=_0xdde1[_0x5f0089];return _0x193892;};'use strict';var Sequelize=require(_0x1dde('0x0'));var rs=require(_0x1dde('0x1'));module[_0x1dde('0x2')]={'name':{'type':Sequelize['STRING'],'unique':_0x1dde('0x3'),'allowNull':![]},'key':{'type':Sequelize[_0x1dde('0x4')],'allowNull':![]},'remote':{'type':Sequelize['STRING'],'allowNull':![]},'token':{'type':Sequelize[_0x1dde('0x4')],'defaultValue':function(){return rs[_0x1dde('0x5')]();}},'phone':{'type':Sequelize[_0x1dde('0x4')]},'type':{'type':Sequelize[_0x1dde('0x6')](_0x1dde('0x7'),_0x1dde('0x8'),_0x1dde('0x9'),_0x1dde('0xa'),'plivo',_0x1dde('0xb'),_0x1dde('0xc'),_0x1dde('0xd'),_0x1dde('0xe'),'intelepeer')},'accountSid':{'type':Sequelize[_0x1dde('0x4')]},'authId':{'type':Sequelize[_0x1dde('0x4')]},'authToken':{'type':Sequelize['STRING']},'smsMethod':{'type':Sequelize['ENUM']('SI','TI','GP')},'username':{'type':Sequelize['STRING']},'password':{'type':Sequelize[_0x1dde('0x4')]},'apiKey':{'type':Sequelize[_0x1dde('0x4')]},'applicationId':{'type':Sequelize['STRING']},'accountId':{'type':Sequelize['STRING']},'senderString':{'type':Sequelize['STRING']},'deliveryReport':{'type':Sequelize[_0x1dde('0xf')],'defaultValue':![]},'description':{'type':Sequelize[_0x1dde('0x4')]},'notificationTemplate':{'type':Sequelize['TEXT'],'defaultValue':function(){return'Account:\x20{{account.name}}
{{#queue}}Queue:\x20{{queue.name}}
{{/queue}}From\x20:\x20{{from}}';}},'notificationSound':{'type':Sequelize[_0x1dde('0xf')],'defaultValue':!![]},'notificationShake':{'type':Sequelize[_0x1dde('0xf')],'defaultValue':![]},'waitForTheAssignedAgent':{'type':Sequelize[_0x1dde('0x10')],'validate':{'min':0x1,'max':0x20c49b},'defaultValue':0xa},'waitForTheAssignedQueue':{'type':Sequelize[_0x1dde('0x10')],'validate':{'min':0x1,'max':0x20c49b},'defaultValue':0xa},'queueTransfer':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'queueTransferTimeout':{'type':Sequelize['INTEGER'],'validate':{'min':0x1,'max':0x20c49b},'defaultValue':0x12c},'agentTransfer':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'agentTransferTimeout':{'type':Sequelize['INTEGER'],'validate':{'min':0x1,'max':0x20c49b},'defaultValue':0x12c},'baseUrl':{'type':Sequelize[_0x1dde('0x4')]},'mandatoryDispositionPauseId':{'type':Sequelize[_0x1dde('0x10')],'comment':_0x1dde('0x11')},'mandatoryDisposition':{'type':Sequelize[_0x1dde('0xf')],'defaultValue':![],'comment':'Enabled/disables\x20mandatory\x20dispo\x20on\x20a\x20queue','set':function(_0x5c3a82){if(!_0x5c3a82)this[_0x1dde('0x12')](_0x1dde('0x13'),null);this['setDataValue'](_0x1dde('0x14'),_0x5c3a82);}}}; \ No newline at end of file diff --git a/server/api/smsAccount/smsAccount.controller.js b/server/api/smsAccount/smsAccount.controller.js index 7f352cb..a898517 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 _0xd712=['Tags','tag','to\x20is\x20mandatory','DESC','List','out','SmsMessage','Messages','dataValues','received\x20delivery\x20report\x20from','skebby_dispatch_id','connectel','requestid','status_code','infobip','groupName','redif','inspect','error_code','DELIVERED','clickatell','DELIVERED_TO_GATEWAY','DELIVRD','statusGet','state','message-id','addAgents','emit','userSmsAccount:save','removeAgents','isArray','userSmsAccount:remove','getAgents','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','bluebird','path','sox','ejs','fs-extra','lodash','squel','crypto','jsforce','desk.js','to-csv','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/license/util','../../mysqldb','redis','defaults','localhost','./smsAccount.socket','register','jayson/promise','client','http','request','SmsAccount,\x20%s,\x20%s','request\x20sent','debug','SmsAccount,\x20%s,\x20%s,\x20%s','error','code','message','info','result','catch','sendStatus','end','status','json','undefined','count','offset','limit','set','Content-Range','save','then','UserProfileResource','stack','Pause','mandatoryDispositionPause','SmsAccount','rawAttributes','fieldName','type','key','map','query','keys','filters','intersection','model','fields','attributes','length','hasOwnProperty','nolimit','order','sort','where','filter','merge','VIRTUAL','name','options','includeAll','include','findAll','rows','show','params','find','create','body','user','get','Unable\x20to\x20retrieve\x20the\x20current\x20user','SmsAccounts','userProfileId','autoAssociation','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','update','describe','findOne','Disposition','pick','removeDispositions','addAnswer','SmsAccountId','CannedAnswer','getAnswers','removeAnswers','ids','notify','sms','SmsApplication','Applications','account','orderBy','CmContact','no\x20available\x20attributes','createdAt','updatedAt','ListId','mobile','twilio','from','Body','messageId','MessageSid','skebby','sender','text','clicksend','message_id','MessageUUID','results','csc','originatingAddress','segmentedMessage','bandwidth','intelepeer','Sequelize','from\x20is\x20mandatory','isNil','ValidationError','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','list','omit','contact','SmsInteraction','spread','interaction','created','applications','close','*,*,*,*','ContactId','AttachmentId','UserId','User','unshift','agent','queueId','SmsQueue','queue','entity\x20found','SmsAccount,\x20%s,\x20%s,\x20%s,\x20%s','stringify','Content-Type','text/xml','send','\x0a','addApplications','sequelize','Transaction','ISOLATION_LEVELS','READ_COMMITTED','destroy','bulkCreate','findAndCountAll','finally','getApplications','Owner','fullname','internal'];(function(_0x5056fe,_0x26d8be){var _0x3778f7=function(_0x3e4bc8){while(--_0x3e4bc8){_0x5056fe['push'](_0x5056fe['shift']());}};_0x3778f7(++_0x26d8be);}(_0xd712,0x1e3));var _0x2d71=function(_0x1e7345,_0x18bcce){_0x1e7345=_0x1e7345-0x0;var _0x33017c=_0xd712[_0x1e7345];return _0x33017c;};'use strict';var emlformat=require(_0x2d71('0x0'));var rimraf=require(_0x2d71('0x1'));var zipdir=require(_0x2d71('0x2'));var jsonpatch=require(_0x2d71('0x3'));var rp=require(_0x2d71('0x4'));var moment=require('moment');var BPromise=require(_0x2d71('0x5'));var Mustache=require('mustache');var util=require('util');var path=require(_0x2d71('0x6'));var sox=require(_0x2d71('0x7'));var csv=require('to-csv');var ejs=require(_0x2d71('0x8'));var fs=require('fs');var fs_extra=require(_0x2d71('0x9'));var _=require(_0x2d71('0xa'));var squel=require(_0x2d71('0xb'));var crypto=require(_0x2d71('0xc'));var jsforce=require(_0x2d71('0xd'));var deskjs=require(_0x2d71('0xe'));var toCsv=require(_0x2d71('0xf'));var querystring=require(_0x2d71('0x10'));var Papa=require(_0x2d71('0x11'));var Redis=require(_0x2d71('0x12'));var authService=require(_0x2d71('0x13'));var qs=require('../../components/parsers/qs');var as=require(_0x2d71('0x14'));var hardwareService=require(_0x2d71('0x15'));var logger=require(_0x2d71('0x16'))(_0x2d71('0x17'));var utils=require('../../config/utils');var config=require('../../config/environment');var licenseUtil=require(_0x2d71('0x18'));var db=require(_0x2d71('0x19'))['db'];config[_0x2d71('0x1a')]=_[_0x2d71('0x1b')](config[_0x2d71('0x1a')],{'host':_0x2d71('0x1c'),'port':0x18eb});var socket=require('socket.io-emitter')(new Redis(config[_0x2d71('0x1a')]));require(_0x2d71('0x1d'))[_0x2d71('0x1e')](socket);var jayson=require(_0x2d71('0x1f'));var client=jayson[_0x2d71('0x20')][_0x2d71('0x21')]({'port':0x232c});function respondWithRpcPromise(_0x24e02a,_0x23b71d,_0x464d14,_0x3be929){return new BPromise(function(_0x5f4e78,_0x290151){var _0xa381e=_0x3be929||client;return _0xa381e[_0x2d71('0x22')](_0x24e02a,_0x464d14)['then'](function(_0xee3dfd){logger['info'](_0x2d71('0x23'),_0x23b71d,_0x2d71('0x24'));logger[_0x2d71('0x25')](_0x2d71('0x26'),_0x23b71d,_0x2d71('0x24'),JSON['stringify'](_0xee3dfd));if(_0xee3dfd['error']){if(_0xee3dfd[_0x2d71('0x27')][_0x2d71('0x28')]===0x1f4){logger[_0x2d71('0x27')]('SmsAccount,\x20%s,\x20%s',_0x23b71d,_0xee3dfd[_0x2d71('0x27')][_0x2d71('0x29')]);return _0x290151(_0xee3dfd[_0x2d71('0x27')][_0x2d71('0x29')]);}logger[_0x2d71('0x27')](_0x2d71('0x23'),_0x23b71d,_0xee3dfd[_0x2d71('0x27')][_0x2d71('0x29')]);return _0x5f4e78(_0xee3dfd['error'][_0x2d71('0x29')]);}else{logger[_0x2d71('0x2a')](_0x2d71('0x23'),_0x23b71d,_0x2d71('0x24'));_0x5f4e78(_0xee3dfd[_0x2d71('0x2b')]['message']);}})[_0x2d71('0x2c')](function(_0x2fb253){logger[_0x2d71('0x27')](_0x2d71('0x23'),_0x23b71d,_0x2fb253);_0x290151(_0x2fb253);});});}function respondWithStatusCode(_0x431988,_0x2c9ced){_0x2c9ced=_0x2c9ced||0xcc;return function(_0x4eda37){if(_0x4eda37){return _0x431988[_0x2d71('0x2d')](_0x2c9ced);}return _0x431988['status'](_0x2c9ced)[_0x2d71('0x2e')]();};}function respondWithResult(_0xbd2763,_0x14c0dc){_0x14c0dc=_0x14c0dc||0xc8;return function(_0x320e85){if(_0x320e85){return _0xbd2763[_0x2d71('0x2f')](_0x14c0dc)[_0x2d71('0x30')](_0x320e85);}};}function respondWithFilteredResult(_0x54ec13,_0x14f1ef){return function(_0x135d83){if(_0x135d83){var _0x513214=typeof _0x14f1ef['offset']==='undefined'&&typeof _0x14f1ef['limit']===_0x2d71('0x31');var _0x198ced=_0x135d83[_0x2d71('0x32')];var _0x284251=_0x513214?0x0:_0x14f1ef['offset'];var _0x3f1c3f=_0x513214?_0x135d83[_0x2d71('0x32')]:_0x14f1ef[_0x2d71('0x33')]+_0x14f1ef[_0x2d71('0x34')];var _0x523138;if(_0x3f1c3f>=_0x198ced){_0x3f1c3f=_0x198ced;_0x523138=0xc8;}else{_0x523138=0xce;}_0x54ec13[_0x2d71('0x2f')](_0x523138);return _0x54ec13[_0x2d71('0x35')](_0x2d71('0x36'),_0x284251+'-'+_0x3f1c3f+'/'+_0x198ced)[_0x2d71('0x30')](_0x135d83);}return null;};}function patchUpdates(_0x134091){return function(_0xd3a663){try{jsonpatch['apply'](_0xd3a663,_0x134091,!![]);}catch(_0x28d41c){return BPromise['reject'](_0x28d41c);}return _0xd3a663[_0x2d71('0x37')]();};}function saveUpdates(_0x3cedcd,_0x2b8fa6){return function(_0x474966){if(_0x474966){return _0x474966['update'](_0x3cedcd)['then'](function(_0x1f4df7){return _0x1f4df7;});}return null;};}function removeEntity(_0x57758a,_0x4da741){return function(_0x31c98e){if(_0x31c98e){return _0x31c98e['destroy']()[_0x2d71('0x38')](function(){var _0x14a2b9=_0x31c98e['get']({'plain':!![]});var _0x116744='SmsAccounts';return db[_0x2d71('0x39')]['destroy']({'where':{'type':_0x116744,'resourceId':_0x14a2b9['id']}})['then'](function(){return _0x31c98e;});})[_0x2d71('0x38')](function(){_0x57758a['status'](0xcc)[_0x2d71('0x2e')]();});}};}function handleEntityNotFound(_0x28a50a,_0x18be24){return function(_0xca9ba5){if(!_0xca9ba5){_0x28a50a[_0x2d71('0x2d')](0x194);}return _0xca9ba5;};}function handleError(_0x1b8533,_0x48b202){_0x48b202=_0x48b202||0x1f4;return function(_0x568283){logger['error'](_0x568283[_0x2d71('0x3a')]);if(_0x568283['name']){delete _0x568283['name'];}_0x1b8533[_0x2d71('0x2f')](_0x48b202)['send'](_0x568283);};}exports['index']=function(_0x3580b4,_0x1fa152){var _0xddbb76={'include':[{'model':db[_0x2d71('0x3b')],'as':_0x2d71('0x3c')}]},_0x206686={},_0x581e25={'count':0x0,'rows':[]};var _0x5dea7a=_['map'](db[_0x2d71('0x3d')][_0x2d71('0x3e')],function(_0x10b8d6){return{'name':_0x10b8d6[_0x2d71('0x3f')],'type':_0x10b8d6[_0x2d71('0x40')][_0x2d71('0x41')]};});_0x206686['model']=_[_0x2d71('0x42')](_0x5dea7a,'name');_0x206686[_0x2d71('0x43')]=_[_0x2d71('0x44')](_0x3580b4[_0x2d71('0x43')]);_0x206686[_0x2d71('0x45')]=_[_0x2d71('0x46')](_0x206686[_0x2d71('0x47')],_0x206686[_0x2d71('0x43')]);_0xddbb76['attributes']=_[_0x2d71('0x46')](_0x206686[_0x2d71('0x47')],qs[_0x2d71('0x48')](_0x3580b4['query'][_0x2d71('0x48')]));_0xddbb76[_0x2d71('0x49')]=_0xddbb76[_0x2d71('0x49')][_0x2d71('0x4a')]?_0xddbb76['attributes']:_0x206686['model'];if(!_0x3580b4[_0x2d71('0x43')][_0x2d71('0x4b')](_0x2d71('0x4c'))){_0xddbb76['limit']=qs['limit'](_0x3580b4['query'][_0x2d71('0x34')]);_0xddbb76[_0x2d71('0x33')]=qs[_0x2d71('0x33')](_0x3580b4['query']['offset']);}_0xddbb76[_0x2d71('0x4d')]=qs[_0x2d71('0x4e')](_0x3580b4['query'][_0x2d71('0x4e')]);_0xddbb76[_0x2d71('0x4f')]=qs['filters'](_['pick'](_0x3580b4[_0x2d71('0x43')],_0x206686[_0x2d71('0x45')]),_0x5dea7a);if(_0x3580b4['query'][_0x2d71('0x50')]){_0xddbb76[_0x2d71('0x4f')]=_[_0x2d71('0x51')](_0xddbb76['where'],{'$or':_[_0x2d71('0x42')](_0x5dea7a,function(_0xc3502c){if(_0xc3502c[_0x2d71('0x40')]!==_0x2d71('0x52')){var _0x3cd265={};_0x3cd265[_0xc3502c[_0x2d71('0x53')]]={'$like':'%'+_0x3580b4[_0x2d71('0x43')][_0x2d71('0x50')]+'%'};return _0x3cd265;}})});}_0xddbb76=_[_0x2d71('0x51')]({},_0xddbb76,_0x3580b4[_0x2d71('0x54')]);var _0x3bd6f2={'where':_0xddbb76[_0x2d71('0x4f')]};return db[_0x2d71('0x3d')][_0x2d71('0x32')](_0x3bd6f2)[_0x2d71('0x38')](function(_0x2d8093){_0x581e25[_0x2d71('0x32')]=_0x2d8093;if(_0x3580b4[_0x2d71('0x43')][_0x2d71('0x55')]){_0xddbb76[_0x2d71('0x56')]=[{'all':!![]}];}return db[_0x2d71('0x3d')][_0x2d71('0x57')](_0xddbb76);})[_0x2d71('0x38')](function(_0x9cc8d8){_0x581e25[_0x2d71('0x58')]=_0x9cc8d8;return _0x581e25;})['then'](respondWithFilteredResult(_0x1fa152,_0xddbb76))[_0x2d71('0x2c')](handleError(_0x1fa152,null));};exports[_0x2d71('0x59')]=function(_0x4a84f9,_0x90dabf){var _0x11cd21={'raw':![],'where':{'id':_0x4a84f9[_0x2d71('0x5a')]['id']},'include':[{'model':db['Pause'],'as':'mandatoryDispositionPause'}]},_0x2b193a={};_0x2b193a[_0x2d71('0x47')]=_[_0x2d71('0x44')](db[_0x2d71('0x3d')][_0x2d71('0x3e')]);_0x2b193a[_0x2d71('0x43')]=_[_0x2d71('0x44')](_0x4a84f9['query']);_0x2b193a[_0x2d71('0x45')]=_['intersection'](_0x2b193a[_0x2d71('0x47')],_0x2b193a[_0x2d71('0x43')]);_0x11cd21[_0x2d71('0x49')]=_[_0x2d71('0x46')](_0x2b193a[_0x2d71('0x47')],qs[_0x2d71('0x48')](_0x4a84f9['query']['fields']));_0x11cd21[_0x2d71('0x49')]=_0x11cd21[_0x2d71('0x49')][_0x2d71('0x4a')]?_0x11cd21[_0x2d71('0x49')]:_0x2b193a[_0x2d71('0x47')];if(_0x4a84f9['query'][_0x2d71('0x55')]){_0x11cd21[_0x2d71('0x56')]=[{'all':!![]}];}_0x11cd21=_['merge']({},_0x11cd21,_0x4a84f9[_0x2d71('0x54')]);return db[_0x2d71('0x3d')][_0x2d71('0x5b')](_0x11cd21)['then'](handleEntityNotFound(_0x90dabf,null))[_0x2d71('0x38')](respondWithResult(_0x90dabf,null))[_0x2d71('0x2c')](handleError(_0x90dabf,null));};exports['create']=function(_0x122257,_0x5744d1){return db[_0x2d71('0x3d')][_0x2d71('0x5c')](_0x122257[_0x2d71('0x5d')],{})[_0x2d71('0x38')](function(_0x1a41ed){var _0x23ace2=_0x122257[_0x2d71('0x5e')][_0x2d71('0x5f')]({'plain':!![]});if(!_0x23ace2)throw new Error(_0x2d71('0x60'));if(_0x23ace2['role']===_0x2d71('0x5e')){var _0xe587f4=_0x1a41ed[_0x2d71('0x5f')]({'plain':!![]});var _0x283dd3=_0x2d71('0x61');return db['UserProfileSection'][_0x2d71('0x5b')]({'where':{'name':_0x283dd3,'userProfileId':_0x23ace2[_0x2d71('0x62')]},'raw':!![]})[_0x2d71('0x38')](function(_0x3b6db9){if(_0x3b6db9&&_0x3b6db9[_0x2d71('0x63')]===0x0){return db[_0x2d71('0x39')][_0x2d71('0x5c')]({'name':_0xe587f4[_0x2d71('0x53')],'resourceId':_0xe587f4['id'],'type':_0x3b6db9['name'],'sectionId':_0x3b6db9['id']},{})[_0x2d71('0x38')](function(){return _0x1a41ed;});}else{return _0x1a41ed;}})['catch'](function(_0x2cc64f){logger[_0x2d71('0x27')](_0x2d71('0x64'),_0x2cc64f);throw _0x2cc64f;});}return _0x1a41ed;})[_0x2d71('0x38')](respondWithResult(_0x5744d1,0xc9))[_0x2d71('0x2c')](handleError(_0x5744d1,null));};exports[_0x2d71('0x65')]=function(_0x346ed6,_0x4fd39e){if(_0x346ed6[_0x2d71('0x5d')]['id']){delete _0x346ed6[_0x2d71('0x5d')]['id'];}return db['SmsAccount'][_0x2d71('0x5b')]({'where':{'id':_0x346ed6[_0x2d71('0x5a')]['id']},'include':[{'model':db['Pause'],'as':'mandatoryDispositionPause'}]})[_0x2d71('0x38')](handleEntityNotFound(_0x4fd39e,null))[_0x2d71('0x38')](saveUpdates(_0x346ed6['body'],null))[_0x2d71('0x38')](respondWithResult(_0x4fd39e,null))['catch'](handleError(_0x4fd39e,null));};exports['destroy']=function(_0x2f5101,_0x40bcc8){return db[_0x2d71('0x3d')]['find']({'where':{'id':_0x2f5101[_0x2d71('0x5a')]['id']}})[_0x2d71('0x38')](handleEntityNotFound(_0x40bcc8,null))[_0x2d71('0x38')](removeEntity(_0x40bcc8,null))[_0x2d71('0x2c')](handleError(_0x40bcc8,null));};exports[_0x2d71('0x66')]=function(_0x11d361,_0x4baf80){return db[_0x2d71('0x3d')][_0x2d71('0x66')]()['then'](respondWithResult(_0x4baf80,null))[_0x2d71('0x2c')](handleError(_0x4baf80,null));};exports['addDisposition']=function(_0x379da1,_0x3ef18d,_0xabaf3c){if(_0x379da1[_0x2d71('0x5d')]['id']){delete _0x379da1['body']['id'];}return db[_0x2d71('0x3d')][_0x2d71('0x5b')]({'where':{'id':_0x379da1['params']['id']}})['then'](handleEntityNotFound(_0x3ef18d,null))[_0x2d71('0x38')](function(_0x4f2d1c){if(_0x4f2d1c){_0x379da1[_0x2d71('0x5d')]['SmsAccountId']=_0x4f2d1c['id'];return db['Disposition'][_0x2d71('0x5c')](_0x379da1['body']);}})[_0x2d71('0x38')](respondWithResult(_0x3ef18d,null))[_0x2d71('0x2c')](handleError(_0x3ef18d,null));};exports['getDispositions']=function(_0x34d7db,_0x15cd6c,_0x299f8c){var _0x4da974={'raw':![],'where':{}};var _0x4fc1eb={};var _0x1282e5={'count':0x0,'rows':[]};return db[_0x2d71('0x3d')][_0x2d71('0x67')]({'where':{'id':_0x34d7db[_0x2d71('0x5a')]['id']}})['then'](handleEntityNotFound(_0x15cd6c,null))[_0x2d71('0x38')](function(_0x4c6d79){if(_0x4c6d79){_0x4fc1eb['model']=_[_0x2d71('0x44')](db[_0x2d71('0x68')][_0x2d71('0x3e')]);_0x4fc1eb[_0x2d71('0x43')]=_['keys'](_0x34d7db[_0x2d71('0x43')]);_0x4fc1eb[_0x2d71('0x45')]=_[_0x2d71('0x46')](_0x4fc1eb[_0x2d71('0x47')],_0x4fc1eb[_0x2d71('0x43')]);_0x4da974[_0x2d71('0x49')]=_[_0x2d71('0x46')](_0x4fc1eb['model'],qs[_0x2d71('0x48')](_0x34d7db[_0x2d71('0x43')][_0x2d71('0x48')]));_0x4da974['attributes']=_0x4da974['attributes'][_0x2d71('0x4a')]?_0x4da974['attributes']:_0x4fc1eb[_0x2d71('0x47')];if(!_0x34d7db['query'][_0x2d71('0x4b')](_0x2d71('0x4c'))){_0x4da974[_0x2d71('0x34')]=qs[_0x2d71('0x34')](_0x34d7db['query'][_0x2d71('0x34')]);_0x4da974['offset']=qs['offset'](_0x34d7db[_0x2d71('0x43')][_0x2d71('0x33')]);}_0x4da974[_0x2d71('0x4d')]=qs[_0x2d71('0x4e')](_0x34d7db['query'][_0x2d71('0x4e')]);_0x4da974['where']=qs[_0x2d71('0x45')](_[_0x2d71('0x69')](_0x34d7db['query'],_0x4fc1eb[_0x2d71('0x45')]));_0x4da974['where']['SmsAccountId']=_0x4c6d79['id'];if(_0x34d7db[_0x2d71('0x43')][_0x2d71('0x50')]){_0x4da974[_0x2d71('0x4f')]=_[_0x2d71('0x51')](_0x4da974[_0x2d71('0x4f')],{'$or':_[_0x2d71('0x42')](_0x4da974[_0x2d71('0x49')],function(_0x54c17b){var _0x7ab374={};_0x7ab374[_0x54c17b]={'$like':'%'+_0x34d7db[_0x2d71('0x43')][_0x2d71('0x50')]+'%'};return _0x7ab374;})});}_0x4da974=_[_0x2d71('0x51')]({},_0x4da974,_0x34d7db['options']);return db['Disposition'][_0x2d71('0x32')]({'where':_0x4da974[_0x2d71('0x4f')]})[_0x2d71('0x38')](function(_0x458d69){_0x1282e5[_0x2d71('0x32')]=_0x458d69;if(_0x34d7db[_0x2d71('0x43')][_0x2d71('0x55')]){_0x4da974[_0x2d71('0x56')]=[{'all':!![]}];}return db[_0x2d71('0x68')][_0x2d71('0x57')](_0x4da974);})[_0x2d71('0x38')](function(_0x56a355){_0x1282e5[_0x2d71('0x58')]=_0x56a355;return _0x1282e5;});}})[_0x2d71('0x38')](respondWithFilteredResult(_0x15cd6c,_0x4da974))[_0x2d71('0x2c')](handleError(_0x15cd6c,null));};exports[_0x2d71('0x6a')]=function(_0x12b718,_0x5d657c,_0x1b6dd7){return db[_0x2d71('0x3d')][_0x2d71('0x5b')]({'where':{'id':_0x12b718['params']['id']}})['then'](handleEntityNotFound(_0x5d657c,null))[_0x2d71('0x38')](function(_0x49ed31){if(_0x49ed31){return _0x49ed31['removeDispositions'](_0x12b718[_0x2d71('0x43')]['ids']);}})['then'](respondWithStatusCode(_0x5d657c,null))['catch'](handleError(_0x5d657c,null));};exports[_0x2d71('0x6b')]=function(_0x304819,_0x2bc0bf,_0x1d979a){if(_0x304819[_0x2d71('0x5d')]['id']){delete _0x304819[_0x2d71('0x5d')]['id'];}return db[_0x2d71('0x3d')][_0x2d71('0x5b')]({'where':{'id':_0x304819[_0x2d71('0x5a')]['id']}})['then'](handleEntityNotFound(_0x2bc0bf,null))[_0x2d71('0x38')](function(_0x3bea26){if(_0x3bea26){_0x304819['body'][_0x2d71('0x6c')]=_0x3bea26['id'];return db[_0x2d71('0x6d')][_0x2d71('0x5c')](_0x304819[_0x2d71('0x5d')]);}})[_0x2d71('0x38')](respondWithResult(_0x2bc0bf,null))['catch'](handleError(_0x2bc0bf,null));};exports[_0x2d71('0x6e')]=function(_0x902fef,_0x10f433,_0x398af1){var _0x131019={'raw':![],'where':{}};var _0x40a5c3={};var _0x5d9009={'count':0x0,'rows':[]};return db[_0x2d71('0x3d')][_0x2d71('0x67')]({'where':{'id':_0x902fef[_0x2d71('0x5a')]['id']}})[_0x2d71('0x38')](handleEntityNotFound(_0x10f433,null))[_0x2d71('0x38')](function(_0x53bb52){if(_0x53bb52){_0x40a5c3['model']=_[_0x2d71('0x44')](db[_0x2d71('0x6d')][_0x2d71('0x3e')]);_0x40a5c3[_0x2d71('0x43')]=_[_0x2d71('0x44')](_0x902fef[_0x2d71('0x43')]);_0x40a5c3[_0x2d71('0x45')]=_[_0x2d71('0x46')](_0x40a5c3['model'],_0x40a5c3[_0x2d71('0x43')]);_0x131019[_0x2d71('0x49')]=_[_0x2d71('0x46')](_0x40a5c3[_0x2d71('0x47')],qs[_0x2d71('0x48')](_0x902fef[_0x2d71('0x43')][_0x2d71('0x48')]));_0x131019[_0x2d71('0x49')]=_0x131019[_0x2d71('0x49')][_0x2d71('0x4a')]?_0x131019[_0x2d71('0x49')]:_0x40a5c3[_0x2d71('0x47')];if(!_0x902fef['query']['hasOwnProperty']('nolimit')){_0x131019['limit']=qs[_0x2d71('0x34')](_0x902fef[_0x2d71('0x43')][_0x2d71('0x34')]);_0x131019[_0x2d71('0x33')]=qs[_0x2d71('0x33')](_0x902fef[_0x2d71('0x43')]['offset']);}_0x131019[_0x2d71('0x4d')]=qs['sort'](_0x902fef[_0x2d71('0x43')][_0x2d71('0x4e')]);_0x131019[_0x2d71('0x4f')]=qs['filters'](_['pick'](_0x902fef[_0x2d71('0x43')],_0x40a5c3[_0x2d71('0x45')]));_0x131019[_0x2d71('0x4f')][_0x2d71('0x6c')]=_0x53bb52['id'];if(_0x902fef['query'][_0x2d71('0x50')]){_0x131019[_0x2d71('0x4f')]=_['merge'](_0x131019[_0x2d71('0x4f')],{'$or':_[_0x2d71('0x42')](_0x131019['attributes'],function(_0x58906e){var _0x4fde0d={};_0x4fde0d[_0x58906e]={'$like':'%'+_0x902fef[_0x2d71('0x43')][_0x2d71('0x50')]+'%'};return _0x4fde0d;})});}_0x131019=_[_0x2d71('0x51')]({},_0x131019,_0x902fef[_0x2d71('0x54')]);return db[_0x2d71('0x6d')][_0x2d71('0x32')]({'where':_0x131019[_0x2d71('0x4f')]})['then'](function(_0x3da4f1){_0x5d9009[_0x2d71('0x32')]=_0x3da4f1;if(_0x902fef['query'][_0x2d71('0x55')]){_0x131019['include']=[{'all':!![]}];}return db['CannedAnswer']['findAll'](_0x131019);})[_0x2d71('0x38')](function(_0x3afa33){_0x5d9009[_0x2d71('0x58')]=_0x3afa33;return _0x5d9009;});}})[_0x2d71('0x38')](respondWithFilteredResult(_0x10f433,_0x131019))[_0x2d71('0x2c')](handleError(_0x10f433,null));};exports[_0x2d71('0x6f')]=function(_0x2ef626,_0x3d94ce,_0x3bac29){return db[_0x2d71('0x3d')]['find']({'where':{'id':_0x2ef626[_0x2d71('0x5a')]['id']}})[_0x2d71('0x38')](handleEntityNotFound(_0x3d94ce,null))['then'](function(_0x5193e0){if(_0x5193e0){return _0x5193e0['removeAnswers'](_0x2ef626[_0x2d71('0x43')][_0x2d71('0x70')]);}})[_0x2d71('0x38')](respondWithStatusCode(_0x3d94ce,null))[_0x2d71('0x2c')](handleError(_0x3d94ce,null));};exports[_0x2d71('0x71')]=function(_0x306cfc,_0x18d606,_0x38d53b){var _0xbdb022={'channel':_0x2d71('0x72')};var _0x52a718=[];var _0x413454=[];var _0x460a25={};return db[_0x2d71('0x3d')][_0x2d71('0x5b')]({'where':{'id':_0x306cfc[_0x2d71('0x5a')]['id']},'include':[{'model':db[_0x2d71('0x73')],'as':_0x2d71('0x74')}]})[_0x2d71('0x38')](handleEntityNotFound(_0x18d606,null))[_0x2d71('0x38')](function(_0xd78245){_0xbdb022[_0x2d71('0x75')]=_0xd78245;_0xbdb022['applications']=_[_0x2d71('0x76')](_0xd78245['Applications'],['priority'],['asc']);if(_0xbdb022[_0x2d71('0x75')]['Applications']){delete _0xbdb022[_0x2d71('0x75')]['Applications'];}return db[_0x2d71('0x77')][_0x2d71('0x66')]();})[_0x2d71('0x38')](function(_0x5a7f10){if(!_0x5a7f10){throw new db['Sequelize']['ValidationError'](_0x2d71('0x78'));}_0x52a718=_['difference'](_[_0x2d71('0x44')](_0x5a7f10),[_0x2d71('0x79'),_0x2d71('0x7a')]);_0x413454=_['difference'](_['keys'](_0x5a7f10),['createdAt','updatedAt','CompanyId',_0x2d71('0x7b')]);_0xbdb022[_0x2d71('0x5d')]={'mapKey':_0x2d71('0x7c')};if(_0xbdb022[_0x2d71('0x75')][_0x2d71('0x40')]){switch(_0xbdb022[_0x2d71('0x75')][_0x2d71('0x40')]){case _0x2d71('0x7d'):_0xbdb022['body'][_0x2d71('0x7e')]=_0x306cfc['body']['From'];_0xbdb022[_0x2d71('0x5d')]['body']=_0x306cfc['body'][_0x2d71('0x7f')];_0xbdb022['body'][_0x2d71('0x80')]=_0x306cfc[_0x2d71('0x5d')][_0x2d71('0x81')];break;case _0x2d71('0x82'):_0xbdb022[_0x2d71('0x5d')]['from']='+'+_0x306cfc['body'][_0x2d71('0x83')];_0xbdb022[_0x2d71('0x5d')][_0x2d71('0x5d')]=_0x306cfc[_0x2d71('0x5d')][_0x2d71('0x84')];break;case'connectel':_0xbdb022['body'][_0x2d71('0x7e')]=_0x306cfc['body'][_0x2d71('0x7e')];_0xbdb022[_0x2d71('0x5d')][_0x2d71('0x5d')]=_0x306cfc[_0x2d71('0x5d')][_0x2d71('0x29')];break;case _0x2d71('0x85'):_0xbdb022[_0x2d71('0x5d')][_0x2d71('0x7e')]=_0x306cfc[_0x2d71('0x5d')][_0x2d71('0x7e')];_0xbdb022[_0x2d71('0x5d')]['body']=_0x306cfc[_0x2d71('0x5d')][_0x2d71('0x5d')];_0xbdb022[_0x2d71('0x5d')][_0x2d71('0x80')]=_0x306cfc[_0x2d71('0x5d')][_0x2d71('0x86')];break;case'plivo':_0xbdb022[_0x2d71('0x5d')][_0x2d71('0x7e')]=_0x306cfc[_0x2d71('0x5d')]['From'];_0xbdb022['body']['body']=_0x306cfc[_0x2d71('0x5d')]['Text'];_0xbdb022[_0x2d71('0x5d')]['messageId']=_0x306cfc['body'][_0x2d71('0x87')];break;case'infobip':_0xbdb022[_0x2d71('0x5d')][_0x2d71('0x7e')]='+'+_0x306cfc[_0x2d71('0x5d')]['results'][0x0][_0x2d71('0x7e')];_0xbdb022[_0x2d71('0x5d')][_0x2d71('0x5d')]=_0x306cfc[_0x2d71('0x5d')][_0x2d71('0x88')][0x0][_0x2d71('0x84')];_0xbdb022[_0x2d71('0x5d')][_0x2d71('0x80')]=_0x306cfc[_0x2d71('0x5d')][_0x2d71('0x88')][0x0][_0x2d71('0x80')];break;case _0x2d71('0x89'):_0xbdb022[_0x2d71('0x5d')]['from']=_0x306cfc[_0x2d71('0x5d')][_0x2d71('0x8a')];_0xbdb022['body'][_0x2d71('0x5d')]=_0x306cfc[_0x2d71('0x5d')][_0x2d71('0x8b')]['message'];break;case'clickatell':_0xbdb022[_0x2d71('0x5d')]['from']=_0x306cfc['body']['fromNumber'];_0xbdb022[_0x2d71('0x5d')][_0x2d71('0x5d')]=_0x306cfc[_0x2d71('0x5d')][_0x2d71('0x84')];_0xbdb022[_0x2d71('0x5d')][_0x2d71('0x80')]=_0x306cfc[_0x2d71('0x5d')]['replyMessageId'];break;case _0x2d71('0x8c'):_0xbdb022[_0x2d71('0x5d')][_0x2d71('0x80')]=_0x306cfc[_0x2d71('0x5d')][0x0][_0x2d71('0x29')]['id'];_0xbdb022[_0x2d71('0x5d')][_0x2d71('0x7e')]=_0x306cfc[_0x2d71('0x5d')][0x0]['message'][_0x2d71('0x7e')];_0xbdb022[_0x2d71('0x5d')]['body']=_0x306cfc[_0x2d71('0x5d')][0x0][_0x2d71('0x29')][_0x2d71('0x84')];break;case _0x2d71('0x8d'):_0xbdb022[_0x2d71('0x5d')][_0x2d71('0x7e')]=_0x306cfc[_0x2d71('0x5d')][_0x2d71('0x7e')];_0xbdb022[_0x2d71('0x5d')][_0x2d71('0x5d')]=_0x306cfc[_0x2d71('0x5d')][_0x2d71('0x29')];_0xbdb022[_0x2d71('0x5d')][_0x2d71('0x80')]=_0x306cfc['body']['refid'];break;}}if(_0xbdb022['body']['id']){delete _0xbdb022[_0x2d71('0x5d')]['id'];}if(_['isNil'](_0xbdb022[_0x2d71('0x5d')][_0x2d71('0x7e')])){throw new db[(_0x2d71('0x8e'))]['ValidationError'](_0x2d71('0x8f'));}if(_[_0x2d71('0x90')](_0xbdb022['body'][_0x2d71('0x5d')])||_0xbdb022[_0x2d71('0x5d')]['body']===''){throw new db['Sequelize'][(_0x2d71('0x91'))](_0x2d71('0x92'));}if(_[_0x2d71('0x90')](_0xbdb022[_0x2d71('0x5d')][_0x2d71('0x93')])){throw new db['Sequelize'][(_0x2d71('0x91'))](_0x2d71('0x94')+_0x413454);}if(!_[_0x2d71('0x95')](_0x413454,_0xbdb022[_0x2d71('0x5d')][_0x2d71('0x93')])){throw new db[(_0x2d71('0x8e'))][(_0x2d71('0x91'))](_0x2d71('0x96')+_0x413454);}_0x460a25[_0xbdb022[_0x2d71('0x5d')][_0x2d71('0x93')]]=_0xbdb022[_0x2d71('0x5d')][_0x2d71('0x7e')];return db[_0x2d71('0x97')][_0x2d71('0x5b')]({'where':{'id':_0xbdb022[_0x2d71('0x75')][_0x2d71('0x7b')]},'include':[{'model':db[_0x2d71('0x77')],'as':_0x2d71('0x98'),'where':_0x460a25,'limit':0x1,'order':[[_0x2d71('0x7a'),'DESC']]}]});})['then'](handleEntityNotFound(_0x18d606,null))[_0x2d71('0x38')](function(_0x125109){if(_0x125109){_0xbdb022[_0x2d71('0x99')]=_[_0x2d71('0x9a')](_0x125109,[_0x2d71('0x98')]);if(_0x125109[_0x2d71('0x98')][_0x2d71('0x4a')]){return _0x125109[_0x2d71('0x98')][0x0];}var _0x22bcf6=_[_0x2d71('0x1b')](_0xbdb022['body'],{'firstName':_0xbdb022[_0x2d71('0x5d')]['from'],'ListId':_0x125109['id']});_0x22bcf6[_0xbdb022['body'][_0x2d71('0x93')]]=_0xbdb022['body'][_0x2d71('0x7e')];return db[_0x2d71('0x77')][_0x2d71('0x5c')](_0x22bcf6,{'fields':_0x52a718,'raw':!![]});}})[_0x2d71('0x38')](handleEntityNotFound(_0x18d606,null))['then'](function(_0x52db14){if(_0x52db14){_0xbdb022[_0x2d71('0x9b')]=_0x52db14;var _0x3782e4={'ContactId':_0x52db14['id'],'phone':_0xbdb022[_0x2d71('0x5d')][_0x2d71('0x7e')],'SmsAccountId':_0x306cfc[_0x2d71('0x5a')]['id']};var _0x2f1e8a={'ContactId':_0x52db14['id'],'SmsAccountId':_0x306cfc[_0x2d71('0x5a')]['id'],'closed':![]};return db[_0x2d71('0x9c')][_0x2d71('0x5b')]({'where':_0x2f1e8a})[_0x2d71('0x38')](function(_0x3a017c){if(_0x3a017c){return[_0x3a017c,![]];}return db[_0x2d71('0x9c')][_0x2d71('0x5c')](_0x3782e4)[_0x2d71('0x38')](function(_0x13df08){return[_0x13df08,!![]];});});}})[_0x2d71('0x9d')](function(_0x47210a,_0x67d406){_0xbdb022[_0x2d71('0x9e')]=_0x47210a[_0x2d71('0x5f')]({'plain':!![]});_0xbdb022['interaction'][_0x2d71('0x9f')]=![];if(_0x67d406){if(_0xbdb022[_0x2d71('0x75')]['autoclose']){_0xbdb022[_0x2d71('0xa0')]['push']({'id':0x0,'priority':_0xbdb022[_0x2d71('0xa0')]['length']+0x1,'app':_0x2d71('0xa1'),'appdata':'unmanaged','interval':_0x2d71('0xa2')});}_0xbdb022[_0x2d71('0x9e')][_0x2d71('0x9f')]=!![];}return db['SmsMessage'][_0x2d71('0x5c')]({'phone':_0xbdb022[_0x2d71('0x5d')][_0x2d71('0x7e')],'messageId':_0xbdb022[_0x2d71('0x5d')][_0x2d71('0x80')],'body':_0xbdb022['body']['body'],'SmsAccountId':_0x306cfc[_0x2d71('0x5a')]['id'],'SmsInteractionId':_0x47210a['id'],'direction':'in','ContactId':_0x47210a[_0x2d71('0xa3')],'AttachmentId':_0xbdb022[_0x2d71('0x5d')][_0x2d71('0xa4')]});})['then'](function(_0x5c81ed){_0xbdb022[_0x2d71('0x29')]=_0x5c81ed;if(!_0xbdb022['interaction'][_0x2d71('0xa5')])return;return db[_0x2d71('0xa6')][_0x2d71('0x5b')]({'attributes':['id',_0x2d71('0x53')],'where':{'id':_0xbdb022[_0x2d71('0x9e')][_0x2d71('0xa5')]}});})['then'](function(_0x55adb3){if(_0x55adb3){_0xbdb022['applications'][_0x2d71('0xa7')]({'id':0x0,'priority':0x0,'app':_0x2d71('0xa8'),'appdata':_0x55adb3[_0x2d71('0x53')]+','+(_0xbdb022[_0x2d71('0x75')]['waitForTheAssignedAgent']||0xa),'interval':'*,*,*,*'});}if(!_0xbdb022['interaction'][_0x2d71('0xa9')])return;return db[_0x2d71('0xaa')][_0x2d71('0x5b')]({'attributes':['id',_0x2d71('0x53')],'where':{'id':_0xbdb022['interaction']['queueId']}});})[_0x2d71('0x38')](function(_0x46f641){if(_0x46f641){_0xbdb022[_0x2d71('0xa0')][_0x2d71('0xa7')]({'id':0x0,'priority':0x1,'app':_0x2d71('0xab'),'appdata':_0x46f641['name']+','+(_0xbdb022[_0x2d71('0x75')]['waitForTheAssignedQueue']||0x12c),'interval':_0x2d71('0xa2')});}return respondWithRpcPromise('Start','startRouting',_0xbdb022);})[_0x2d71('0x38')](function(_0x4fc7ba){if(_0x4fc7ba){var _0x12fd4d=0xc8;var _0x191432='receiveMessage';logger[_0x2d71('0x2a')](_0x2d71('0x26'),_0x191432,_0x12fd4d,_0x2d71('0xac'));logger[_0x2d71('0x25')](_0x2d71('0xad'),_0x191432,_0x12fd4d,'entity\x20found',JSON[_0x2d71('0xae')](_0x4fc7ba));if(_0xbdb022[_0x2d71('0x75')][_0x2d71('0x40')]==='twilio'){return _0x18d606[_0x2d71('0x2f')](_0x12fd4d)[_0x2d71('0x35')](_0x2d71('0xaf'),_0x2d71('0xb0'))[_0x2d71('0xb1')](_0x2d71('0xb2'));}else{return _0x18d606['status'](_0x12fd4d)['json'](_0x4fc7ba);}}})['catch'](handleError(_0x18d606,null));};exports[_0x2d71('0xb3')]=function(_0x521523,_0x2d2dee){var _0x54b831=_0x521523[_0x2d71('0x5a')]['id'];var _0x40dbd2=_0x521523[_0x2d71('0x5d')];var _0x18622f=0xc8;var _0x4ada70=null;return db[_0x2d71('0xb4')]['transaction']({'isolationLevel':db[_0x2d71('0xb4')][_0x2d71('0xb5')][_0x2d71('0xb6')][_0x2d71('0xb7')]},function(_0x53dfcd){return db['SmsAccount'][_0x2d71('0x67')]({'where':{'id':_0x54b831},'transaction':_0x53dfcd})[_0x2d71('0x38')](function(_0x305b1c){if(_0x305b1c){return db[_0x2d71('0x73')][_0x2d71('0xb8')]({'where':{'SmsAccountId':_0x54b831},'transaction':_0x53dfcd})[_0x2d71('0x38')](function(){var _0x64c62d=_[_0x2d71('0x42')](_0x40dbd2,function(_0x3c8be5){_0x3c8be5['SmsAccountId']=_0x54b831;return _0x3c8be5;});return db[_0x2d71('0x73')][_0x2d71('0xb9')](_0x64c62d,{'transaction':_0x53dfcd});});}else{_0x18622f=0x194;_0x4ada70=[];}});})['then'](function(){if(_0x18622f!==0x194){return db[_0x2d71('0x73')][_0x2d71('0xba')]({'where':{'SmsAccountId':_0x54b831},'order':'priority'})['then'](function(_0x1a0abf){_0x4ada70=_0x1a0abf;});}})[_0x2d71('0x2c')](function(_0x441873){_0x18622f=0x1f4;logger['error'](_0x441873[_0x2d71('0x3a')]);if(_0x441873['name']){delete _0x441873[_0x2d71('0x53')];}_0x4ada70=_0x441873;})[_0x2d71('0xbb')](function(){if(_0x4ada70===null){_0x2d2dee[_0x2d71('0x2d')](_0x18622f);}else{if(_0x18622f===0x1f4){_0x2d2dee[_0x2d71('0x2f')](_0x18622f)[_0x2d71('0xb1')](_0x4ada70);}else{_0x2d2dee[_0x2d71('0x2f')](_0x18622f)[_0x2d71('0x30')](_0x4ada70);}}});};exports[_0x2d71('0xbc')]=function(_0x2ed7eb,_0xf302cd,_0x1f370c){var _0x3f2642={};var _0x15658a={};var _0x4b9cf3;var _0x1f8a23;return db[_0x2d71('0x3d')][_0x2d71('0x67')]({'where':{'id':_0x2ed7eb['params']['id']}})[_0x2d71('0x38')](handleEntityNotFound(_0xf302cd,null))[_0x2d71('0x38')](function(_0x1a64d4){if(_0x1a64d4){_0x4b9cf3=_0x1a64d4;_0x15658a[_0x2d71('0x47')]=_['keys'](db[_0x2d71('0x73')][_0x2d71('0x3e')]);_0x15658a[_0x2d71('0x43')]=_[_0x2d71('0x44')](_0x2ed7eb[_0x2d71('0x43')]);_0x15658a[_0x2d71('0x45')]=_[_0x2d71('0x46')](_0x15658a['model'],_0x15658a[_0x2d71('0x43')]);_0x3f2642[_0x2d71('0x49')]=_[_0x2d71('0x46')](_0x15658a[_0x2d71('0x47')],qs[_0x2d71('0x48')](_0x2ed7eb['query']['fields']));_0x3f2642[_0x2d71('0x49')]=_0x3f2642['attributes'][_0x2d71('0x4a')]?_0x3f2642['attributes']:_0x15658a[_0x2d71('0x47')];_0x3f2642[_0x2d71('0x4d')]=qs[_0x2d71('0x4e')](_0x2ed7eb[_0x2d71('0x43')][_0x2d71('0x4e')]);_0x3f2642[_0x2d71('0x4f')]=qs['filters'](_[_0x2d71('0x69')](_0x2ed7eb[_0x2d71('0x43')],_0x15658a[_0x2d71('0x45')]));if(_0x2ed7eb[_0x2d71('0x43')][_0x2d71('0x50')]){_0x3f2642[_0x2d71('0x4f')]=_[_0x2d71('0x51')](_0x3f2642[_0x2d71('0x4f')],{'$or':_[_0x2d71('0x42')](_0x3f2642[_0x2d71('0x49')],function(_0x223294){var _0x53ab89={};_0x53ab89[_0x223294]={'$like':'%'+_0x2ed7eb[_0x2d71('0x43')][_0x2d71('0x50')]+'%'};return _0x53ab89;})});}_0x3f2642=_[_0x2d71('0x51')]({},_0x3f2642,_0x2ed7eb[_0x2d71('0x54')]);return _0x4b9cf3[_0x2d71('0xbc')](_0x3f2642);}})[_0x2d71('0x38')](function(_0xa526ff){if(_0xa526ff){_0x1f8a23=_0xa526ff['length'];if(!_0x2ed7eb[_0x2d71('0x43')][_0x2d71('0x4b')](_0x2d71('0x4c'))){_0x3f2642[_0x2d71('0x34')]=qs[_0x2d71('0x34')](_0x2ed7eb[_0x2d71('0x43')][_0x2d71('0x34')]);_0x3f2642[_0x2d71('0x33')]=qs[_0x2d71('0x33')](_0x2ed7eb[_0x2d71('0x43')][_0x2d71('0x33')]);}return _0x4b9cf3[_0x2d71('0xbc')](_0x3f2642);}})[_0x2d71('0x38')](function(_0x9584dc){if(_0x9584dc){return _0x9584dc?{'count':_0x1f8a23,'rows':_0x9584dc}:null;}})[_0x2d71('0x38')](respondWithResult(_0xf302cd,null))[_0x2d71('0x2c')](handleError(_0xf302cd,null));};exports['getInteractions']=function(_0x4d93a8,_0x228027,_0x26f5ca){var _0x243e0f={'raw':![],'where':{}};var _0xfc7dc5={};var _0x22f666={'count':0x0,'rows':[]};return db[_0x2d71('0x3d')][_0x2d71('0x67')]({'where':{'id':_0x4d93a8[_0x2d71('0x5a')]['id']}})[_0x2d71('0x38')](handleEntityNotFound(_0x228027,null))[_0x2d71('0x38')](function(_0x4ff83b){if(_0x4ff83b){_0xfc7dc5[_0x2d71('0x47')]=_[_0x2d71('0x44')](db[_0x2d71('0x9c')]['rawAttributes']);_0xfc7dc5[_0x2d71('0x43')]=_[_0x2d71('0x44')](_0x4d93a8[_0x2d71('0x43')]);_0xfc7dc5[_0x2d71('0x45')]=_[_0x2d71('0x46')](_0xfc7dc5[_0x2d71('0x47')],_0xfc7dc5['query']);_0x243e0f[_0x2d71('0x49')]=_['intersection'](_0xfc7dc5[_0x2d71('0x47')],qs[_0x2d71('0x48')](_0x4d93a8[_0x2d71('0x43')]['fields']));_0x243e0f['attributes']=_0x243e0f['attributes'][_0x2d71('0x4a')]?_0x243e0f['attributes']:_0xfc7dc5[_0x2d71('0x47')];if(!_0x4d93a8['query'][_0x2d71('0x4b')](_0x2d71('0x4c'))){_0x243e0f['limit']=qs[_0x2d71('0x34')](_0x4d93a8[_0x2d71('0x43')][_0x2d71('0x34')]);_0x243e0f['offset']=qs[_0x2d71('0x33')](_0x4d93a8[_0x2d71('0x43')][_0x2d71('0x33')]);}_0x243e0f[_0x2d71('0x4d')]=qs[_0x2d71('0x4e')](_0x4d93a8[_0x2d71('0x43')][_0x2d71('0x4e')]);_0x243e0f[_0x2d71('0x4f')]=qs[_0x2d71('0x45')](_['pick'](_0x4d93a8[_0x2d71('0x43')],_0xfc7dc5[_0x2d71('0x45')]));_0x243e0f['where'][_0x2d71('0x6c')]=_0x4ff83b['id'];if(_0x4d93a8[_0x2d71('0x43')][_0x2d71('0x50')]){_0x243e0f[_0x2d71('0x4f')]=_[_0x2d71('0x51')](_0x243e0f[_0x2d71('0x4f')],{'$or':_[_0x2d71('0x42')](_0x243e0f[_0x2d71('0x49')],function(_0x50337a){var _0x45478f={};_0x45478f[_0x50337a]={'$like':'%'+_0x4d93a8[_0x2d71('0x43')]['filter']+'%'};return _0x45478f;})});}_0x243e0f=_[_0x2d71('0x51')]({},_0x243e0f,_0x4d93a8['options']);return db[_0x2d71('0x9c')][_0x2d71('0x32')]({'where':_0x243e0f[_0x2d71('0x4f')]})[_0x2d71('0x38')](function(_0x568f6b){_0x22f666[_0x2d71('0x32')]=_0x568f6b;if(_0x4d93a8['query'][_0x2d71('0x55')]){_0x243e0f[_0x2d71('0x56')]=[{'model':db[_0x2d71('0x77')],'as':'Contact','required':![]},{'model':db['User'],'as':_0x2d71('0xbd'),'attributes':['name',_0x2d71('0xbe'),_0x2d71('0xbf')],'required':![]},{'model':db['Tag'],'as':_0x2d71('0xc0'),'attributes':['id',_0x2d71('0x53'),'color'],'where':_0x4d93a8[_0x2d71('0x43')]['tag']?{'id':_0x4d93a8[_0x2d71('0x43')]['tag']}:undefined,'required':_0x4d93a8[_0x2d71('0x43')][_0x2d71('0xc1')]?!![]:![]}];}return db['SmsInteraction'][_0x2d71('0x57')](_0x243e0f);})[_0x2d71('0x38')](function(_0x585e9f){_0x22f666['rows']=_0x585e9f;return _0x22f666;});}})[_0x2d71('0x38')](respondWithFilteredResult(_0x228027,_0x243e0f))['catch'](handleError(_0x228027,null));};exports[_0x2d71('0xb1')]=function(_0x3a705b,_0x18fa0d,_0x4f9e4d){var _0x6de3e2,_0x470e59,_0x34432d;if(_[_0x2d71('0x90')](_0x3a705b['body']['body'])||_0x3a705b['body'][_0x2d71('0x5d')]===''){throw new db[(_0x2d71('0x8e'))]['ValidationError'](_0x2d71('0x92'));}if(_['isNil'](_0x3a705b['body']['to'])){throw new db[(_0x2d71('0x8e'))]['ValidationError'](_0x2d71('0xc2'));}_0x6de3e2=_0x3a705b['body']['to'];return db[_0x2d71('0x3d')]['find']({'where':{'id':_0x3a705b[_0x2d71('0x5a')]['id']},'include':[{'model':db[_0x2d71('0x97')],'as':'List','include':[{'model':db[_0x2d71('0x77')],'as':_0x2d71('0x98'),'where':{'mobile':_0x6de3e2},'limit':0x1,'order':[[_0x2d71('0x7a'),_0x2d71('0xc3')]]}]}]})['then'](handleEntityNotFound(_0x18fa0d,null))['then'](function(_0x5356e9){if(_0x5356e9&&_0x5356e9[_0x2d71('0xc4')]){_0x470e59=_0x5356e9[_0x2d71('0x5f')]({'plain':!![]});if(_0x470e59[_0x2d71('0xc4')]&&_0x470e59[_0x2d71('0xc4')][_0x2d71('0x98')]['length']){return _0x470e59[_0x2d71('0xc4')][_0x2d71('0x98')][0x0];}return db['CmContact']['create'](_[_0x2d71('0x1b')](_0x3a705b[_0x2d71('0x5d')],{'firstName':_0x6de3e2,'mobile':_0x6de3e2,'phone':_0x6de3e2,'ListId':_0x470e59[_0x2d71('0x7b')]}));}})[_0x2d71('0x38')](handleEntityNotFound(_0x18fa0d,null))[_0x2d71('0x38')](function(_0x22c96c){if(_0x22c96c){_0x34432d=_0x22c96c;return db['SmsInteraction']['find']({'where':{'ContactId':_0x34432d['id'],'closed':![],'SmsAccountId':_0x470e59['id']}})[_0x2d71('0x38')](function(_0x67f5d7){if(_0x67f5d7){return[_0x67f5d7,![]];}return db[_0x2d71('0x9c')]['create']({'UserId':_0x3a705b['user']['id'],'ContactId':_0x34432d['id'],'SmsAccountId':_0x470e59['id'],'phone':_0x6de3e2,'firstMsgDirection':_0x2d71('0xc5'),'Messages':[_[_0x2d71('0x51')](_0x3a705b['body'],{'read':![],'body':_0x3a705b[_0x2d71('0x5d')][_0x2d71('0x5d')],'phone':_0x6de3e2,'SmsAccountId':_0x470e59['id'],'UserId':_0x3a705b[_0x2d71('0x5e')]['id'],'ContactId':_0x34432d['id']})]},{'include':[{'model':db[_0x2d71('0xc6')],'as':_0x2d71('0xc7')}]})[_0x2d71('0x38')](function(_0x155eb3){return[_0x155eb3,!![]];});});}})['spread'](function(_0x10386e,_0x15bf76){if(_0x15bf76){return _0x10386e;}return db[_0x2d71('0xc6')][_0x2d71('0x5c')](_[_0x2d71('0x51')](_0x3a705b[_0x2d71('0x5d')],{'read':![],'body':_0x3a705b[_0x2d71('0x5d')][_0x2d71('0x5d')],'phone':_0x6de3e2,'SmsAccountId':_0x470e59['id'],'SmsInteractionId':_0x10386e['id'],'UserId':_0x3a705b[_0x2d71('0x5e')]['id'],'ContactId':_0x34432d['id']}))['then'](function(_0x1cef57){_0x10386e[_0x2d71('0xc8')]['Messages']=[];_0x10386e[_0x2d71('0xc8')][_0x2d71('0xc7')]['push'](_0x1cef57[_0x2d71('0xc8')]);return _0x10386e;});})[_0x2d71('0x38')](respondWithResult(_0x18fa0d,null))[_0x2d71('0x2c')](handleError(_0x18fa0d,null));};exports[_0x2d71('0x2f')]=function(_0x22d459,_0x2f6a51,_0x292e4c){if(_0x22d459[_0x2d71('0x5d')]['id']){delete _0x22d459['body']['id'];}var _0x41c2e2,_0x4aa1ec,_0x156a6f;return db['SmsAccount'][_0x2d71('0x5b')]({'where':{'id':_0x22d459[_0x2d71('0x5a')]['id']}})[_0x2d71('0x38')](handleEntityNotFound(_0x2f6a51,null))[_0x2d71('0x38')](function(_0x4c7f7c){if(_0x4c7f7c){_0x156a6f=_0x4c7f7c;logger[_0x2d71('0x25')](_0x2d71('0x26'),_0x2d71('0x2f'),_0x2d71('0xc9'),_0x4c7f7c[_0x2d71('0x40')],util['inspect'](_0x22d459[_0x2d71('0x5d')],{'showHidden':![],'depth':null}));switch(_0x4c7f7c[_0x2d71('0x40')]){case'skebby':if(_0x22d459[_0x2d71('0x5d')]['skebby_dispatch_id']&&_0x22d459[_0x2d71('0x5d')][_0x2d71('0x2f')]){_0x4aa1ec=_0x22d459['body'][_0x2d71('0x2f')];return db[_0x2d71('0xc6')]['find']({'where':{'messageId':_0x22d459['body'][_0x2d71('0xca')]}});}break;case _0x2d71('0xcb'):if(_0x22d459[_0x2d71('0x5d')][_0x2d71('0xcc')]&&_0x22d459[_0x2d71('0x5d')]['statusInt']){_0x4aa1ec=_0x22d459[_0x2d71('0x5d')]['statusInt'];return db[_0x2d71('0xc6')][_0x2d71('0x5b')]({'where':{'messageId':_0x22d459['body'][_0x2d71('0xcc')]}});}break;case _0x2d71('0x85'):if(_0x22d459['body']['message_id']&&_0x22d459['body'][_0x2d71('0xcd')]){_0x4aa1ec=_0x22d459[_0x2d71('0x5d')][_0x2d71('0xcd')];return db[_0x2d71('0xc6')][_0x2d71('0x5b')]({'where':{'messageId':_0x22d459[_0x2d71('0x5d')][_0x2d71('0x86')]}});}break;case _0x2d71('0xce'):var _0x289fb7=_0x22d459['body'][_0x2d71('0x88')][0x0];if(_0x289fb7[_0x2d71('0x80')]&&_0x289fb7['status'][_0x2d71('0xcf')]==='DELIVERED'){_0x4aa1ec=_0x289fb7[_0x2d71('0x2f')]['groupName'];return db[_0x2d71('0xc6')][_0x2d71('0x5b')]({'where':{'messageId':_0x289fb7[_0x2d71('0x80')]}});}break;case'clickatell':if(_0x22d459['body'][_0x2d71('0x80')]&&_0x22d459['body'][_0x2d71('0x2f')]){_0x4aa1ec=_0x22d459[_0x2d71('0x5d')][_0x2d71('0x2f')];return db[_0x2d71('0xc6')][_0x2d71('0x5b')]({'where':{'messageId':_0x22d459[_0x2d71('0x5d')][_0x2d71('0x80')]}});}break;case _0x2d71('0x8c'):if(_0x22d459['body'][0x0][_0x2d71('0x29')]['id']){_0x4aa1ec=_0x22d459[_0x2d71('0x5d')][0x0]['type'];return db[_0x2d71('0xc6')]['find']({'where':{'messageId':_0x22d459['body'][0x0][_0x2d71('0x29')]['id']}});}break;case'intelepeer':if(_0x22d459[_0x2d71('0x5d')][_0x2d71('0xd0')]&&_0x22d459[_0x2d71('0x5d')][_0x2d71('0x2f')]){_0x4aa1ec=_0x22d459['body'][_0x2d71('0x2f')];return db['SmsMessage'][_0x2d71('0x5b')]({'where':{'messageId':_0x22d459[_0x2d71('0x5d')]['redif']}});}break;}}})[_0x2d71('0x38')](handleEntityNotFound(_0x2f6a51,null))['then'](function(_0x31faf9){if(_0x31faf9){_0x41c2e2=_0x31faf9;switch(_0x156a6f[_0x2d71('0x40')]){case _0x2d71('0x82'):if(_0x4aa1ec==='DELIVERED'){return _0x41c2e2[_0x2d71('0x65')]({'read':!![]});}else{logger[_0x2d71('0x27')](_0x2d71('0x26'),_0x2d71('0x2f'),_0x2d71('0x82'),util[_0x2d71('0xd1')](_0x22d459[_0x2d71('0x5d')],{'showHidden':![],'depth':null}));}break;case _0x2d71('0xcb'):if(_0x4aa1ec==='1'){return _0x41c2e2['update']({'read':!![]});}else{logger[_0x2d71('0x27')](_0x2d71('0x26'),_0x2d71('0x2f'),_0x2d71('0x82'),util['inspect'](_0x22d459[_0x2d71('0x5d')],{'showHidden':![],'depth':null}));}break;case _0x2d71('0x85'):if(!_0x22d459[_0x2d71('0x5d')][_0x2d71('0xd2')]&&_0x4aa1ec>=0xc8&&_0x4aa1ec<=0xce){return _0x41c2e2[_0x2d71('0x65')]({'read':!![]});}else{logger[_0x2d71('0x27')]('SmsAccount,\x20%s,\x20%s,\x20%s',_0x2d71('0x2f'),_0x2d71('0x85'),util[_0x2d71('0xd1')](_0x22d459[_0x2d71('0x5d')],{'showHidden':![],'depth':null}));}break;case _0x2d71('0xce'):var _0x263851=_0x22d459['body'][_0x2d71('0x88')][0x0];if(_0x263851['status'][_0x2d71('0xcf')]===_0x2d71('0xd3')){return _0x41c2e2[_0x2d71('0x65')]({'read':!![]});}else{logger['error'](_0x2d71('0x26'),_0x2d71('0x2f'),'infobip',util['inspect'](_0x22d459[_0x2d71('0x5d')],{'showHidden':![],'depth':null}));}break;case _0x2d71('0xd4'):if(_0x4aa1ec==_0x2d71('0xd5')||_0x4aa1ec=='RECEIVED_BY_RECIPIENT'){return _0x41c2e2[_0x2d71('0x65')]({'read':!![]});}else{logger['error'](_0x2d71('0x26'),'status',_0x2d71('0xd4'),util[_0x2d71('0xd1')](_0x22d459[_0x2d71('0x5d')],{'showHidden':![],'depth':null}));}break;case _0x2d71('0x8c'):if(_0x4aa1ec=='message-delivered'){return _0x41c2e2['update']({'read':!![]});}else{logger[_0x2d71('0x27')](_0x2d71('0x26'),'status','bandwidth',util['inspect'](_0x22d459[_0x2d71('0x5d')],{'showHidden':![],'depth':null}));}break;case _0x2d71('0x8d'):if(_0x4aa1ec===_0x2d71('0xd6')||_0x4aa1ec==='ACCEPTD'){return _0x41c2e2['update']({'read':!![]});}else{logger[_0x2d71('0x27')](_0x2d71('0x26'),_0x2d71('0x2f'),_0x2d71('0x8d'),util['inspect'](_0x22d459['body'],{'showHidden':![],'depth':null}));}break;}return _0x41c2e2;}})[_0x2d71('0x38')](respondWithResult(_0x2f6a51,null))[_0x2d71('0x2c')](handleError(_0x2f6a51,null));};exports[_0x2d71('0xd7')]=function(_0x56d067,_0x35edcc,_0x554a4a){var _0x23b6ff,_0x31193a,_0x394b5c;return db[_0x2d71('0x3d')][_0x2d71('0x5b')]({'where':{'id':_0x56d067[_0x2d71('0x5a')]['id']}})[_0x2d71('0x38')](handleEntityNotFound(_0x35edcc,null))['then'](function(_0xd5101){if(_0xd5101){_0x394b5c=_0xd5101;logger[_0x2d71('0x25')](_0x2d71('0x26'),'status','received\x20delivery\x20report\x20from',_0xd5101[_0x2d71('0x40')],util[_0x2d71('0xd1')](_0x56d067[_0x2d71('0x43')],{'showHidden':![],'depth':null}));switch(_0xd5101[_0x2d71('0x40')]){case'csc':if(_0x56d067[_0x2d71('0x43')]['message-id']&&_0x56d067[_0x2d71('0x43')][_0x2d71('0xd8')]){_0x31193a=_0x56d067[_0x2d71('0x43')][_0x2d71('0xd8')];return db[_0x2d71('0xc6')][_0x2d71('0x5b')]({'where':{'messageId':_0x56d067[_0x2d71('0x43')][_0x2d71('0xd9')]}});}break;}}})['then'](handleEntityNotFound(_0x35edcc,null))[_0x2d71('0x38')](function(_0x3694dd){if(_0x3694dd){_0x23b6ff=_0x3694dd;switch(_0x394b5c[_0x2d71('0x40')]){case'csc':if(_0x31193a==='2'||_0x31193a==='6'){return _0x23b6ff[_0x2d71('0x65')]({'read':!![]});}else{logger[_0x2d71('0x27')](_0x2d71('0x26'),_0x2d71('0x2f'),_0x2d71('0x89'),util[_0x2d71('0xd1')](_0x56d067[_0x2d71('0x43')],{'showHidden':![],'depth':null}));};break;}return _0x23b6ff;}})[_0x2d71('0x38')](respondWithResult(_0x35edcc,null))[_0x2d71('0x2c')](handleError(_0x35edcc,null));};exports[_0x2d71('0xda')]=function(_0x45b46b,_0x1ac917,_0x55714f){return db[_0x2d71('0x3d')][_0x2d71('0x5b')]({'where':{'id':_0x45b46b[_0x2d71('0x5a')]['id']}})['then'](handleEntityNotFound(_0x1ac917,null))[_0x2d71('0x38')](function(_0x11f56b){if(_0x11f56b){return _0x11f56b[_0x2d71('0xda')](_0x45b46b['body'][_0x2d71('0x70')],_['omit'](_0x45b46b['body'],[_0x2d71('0x70'),'id'])||{})[_0x2d71('0x9d')](function(_0x159ff0){for(var _0x3646c2=0x0;_0x3646c2<_0x45b46b[_0x2d71('0x5d')]['ids'][_0x2d71('0x4a')];_0x3646c2+=0x1){socket[_0x2d71('0xdb')](_0x2d71('0xdc'),{'UserId':Number(_0x45b46b[_0x2d71('0x5d')][_0x2d71('0x70')][_0x3646c2]),'SmsAccountId':Number(_0x45b46b[_0x2d71('0x5a')]['id'])});}return _0x159ff0;});}})[_0x2d71('0x38')](respondWithResult(_0x1ac917,null))['catch'](handleError(_0x1ac917,null));};exports[_0x2d71('0xdd')]=function(_0x93a5ae,_0xb30c5d,_0x432bcc){return db[_0x2d71('0x3d')]['find']({'where':{'id':_0x93a5ae[_0x2d71('0x5a')]['id']}})[_0x2d71('0x38')](handleEntityNotFound(_0xb30c5d,null))[_0x2d71('0x38')](function(_0x319559){if(_0x319559){return _0x319559[_0x2d71('0xdd')](_0x93a5ae[_0x2d71('0x43')]['ids'])[_0x2d71('0x38')](function(){if(_[_0x2d71('0xde')](_0x93a5ae[_0x2d71('0x43')][_0x2d71('0x70')])){for(var _0x146415=0x0;_0x146415<_0x93a5ae[_0x2d71('0x43')][_0x2d71('0x70')][_0x2d71('0x4a')];_0x146415+=0x1){socket['emit'](_0x2d71('0xdf'),{'UserId':Number(_0x93a5ae[_0x2d71('0x43')]['ids'][_0x146415]),'SmsAccountId':Number(_0x93a5ae['params']['id'])});}}else{socket['emit'](_0x2d71('0xdf'),{'UserId':Number(_0x93a5ae['query'][_0x2d71('0x70')]),'SmsAccountId':Number(_0x93a5ae['params']['id'])});}});}})[_0x2d71('0x38')](respondWithStatusCode(_0xb30c5d,null))['catch'](handleError(_0xb30c5d,null));};exports[_0x2d71('0xe0')]=function(_0x38fb84,_0x4e7b2c,_0x299261){var _0x1c776f={};var _0x246258={};var _0x3b8866;var _0x2a3542;return db['SmsAccount'][_0x2d71('0x67')]({'where':{'id':_0x38fb84[_0x2d71('0x5a')]['id']}})[_0x2d71('0x38')](handleEntityNotFound(_0x4e7b2c,null))[_0x2d71('0x38')](function(_0x4c31b3){if(_0x4c31b3){_0x3b8866=_0x4c31b3;_0x246258[_0x2d71('0x47')]=_[_0x2d71('0x44')](db[_0x2d71('0xa6')][_0x2d71('0x3e')]);_0x246258[_0x2d71('0x43')]=_['keys'](_0x38fb84[_0x2d71('0x43')]);_0x246258[_0x2d71('0x45')]=_[_0x2d71('0x46')](_0x246258['model'],_0x246258[_0x2d71('0x43')]);_0x1c776f['attributes']=_[_0x2d71('0x46')](_0x246258[_0x2d71('0x47')],qs['fields'](_0x38fb84[_0x2d71('0x43')][_0x2d71('0x48')]));_0x1c776f[_0x2d71('0x49')]=_0x1c776f[_0x2d71('0x49')][_0x2d71('0x4a')]?_0x1c776f[_0x2d71('0x49')]:_0x246258[_0x2d71('0x47')];_0x1c776f[_0x2d71('0x4d')]=qs[_0x2d71('0x4e')](_0x38fb84[_0x2d71('0x43')]['sort']);_0x1c776f[_0x2d71('0x4f')]=qs[_0x2d71('0x45')](_[_0x2d71('0x69')](_0x38fb84[_0x2d71('0x43')],_0x246258[_0x2d71('0x45')]));if(_0x38fb84[_0x2d71('0x43')][_0x2d71('0x50')]){_0x1c776f[_0x2d71('0x4f')]=_[_0x2d71('0x51')](_0x1c776f[_0x2d71('0x4f')],{'$or':_[_0x2d71('0x42')](_0x1c776f['attributes'],function(_0x3aeb88){var _0x1ff0c5={};_0x1ff0c5[_0x3aeb88]={'$like':'%'+_0x38fb84[_0x2d71('0x43')][_0x2d71('0x50')]+'%'};return _0x1ff0c5;})});}_0x1c776f=_[_0x2d71('0x51')]({},_0x1c776f,_0x38fb84[_0x2d71('0x54')]);return _0x3b8866[_0x2d71('0xe0')](_0x1c776f);}})['then'](function(_0x5c050d){if(_0x5c050d){_0x2a3542=_0x5c050d[_0x2d71('0x4a')];if(!_0x38fb84['query'][_0x2d71('0x4b')]('nolimit')){_0x1c776f[_0x2d71('0x34')]=qs[_0x2d71('0x34')](_0x38fb84[_0x2d71('0x43')]['limit']);_0x1c776f[_0x2d71('0x33')]=qs[_0x2d71('0x33')](_0x38fb84['query'][_0x2d71('0x33')]);}return _0x3b8866['getAgents'](_0x1c776f);}})['then'](function(_0x2e69eb){if(_0x2e69eb){return _0x2e69eb?{'count':_0x2a3542,'rows':_0x2e69eb}:null;}})[_0x2d71('0x38')](respondWithResult(_0x4e7b2c,null))[_0x2d71('0x2c')](handleError(_0x4e7b2c,null));}; \ No newline at end of file +var _0x770a=['get','SmsAccounts','UserProfileResource','stack','name','index','mandatoryDispositionPause','map','fieldName','key','model','query','keys','filters','intersection','attributes','fields','length','hasOwnProperty','nolimit','sort','where','filter','VIRTUAL','merge','SmsAccount','includeAll','include','findAll','rows','show','params','options','find','create','body','user','Unable\x20to\x20retrieve\x20the\x20current\x20user','role','UserProfileSection','userProfileId','autoAssociation','describe','addDisposition','getDispositions','findOne','Disposition','rawAttributes','order','pick','SmsAccountId','removeDispositions','ids','addAnswer','getAnswers','CannedAnswer','removeAnswers','notify','sms','SmsApplication','Applications','applications','orderBy','priority','account','CmContact','Sequelize','ValidationError','no\x20available\x20attributes','difference','createdAt','updatedAt','CompanyId','mobile','type','twilio','From','Body','messageId','MessageSid','skebby','from','sender','text','connectel','clicksend','MessageUUID','infobip','results','originatingAddress','segmentedMessage','fromNumber','replyMessageId','intelepeer','refid','isNil','from\x20is\x20mandatory','body\x20is\x20mandatory\x20and\x20not\x20empty','mapKey','includes','mapKey\x20invalid,\x20please\x20use\x20one\x20of\x20these:\x20','ListId','Contacts','list','omit','defaults','contact','SmsInteraction','created','autoclose','push','unmanaged','*,*,*,*','interaction','SmsMessage','ContactId','AttachmentId','UserId','User','agent','waitForTheAssignedAgent','SmsQueue','unshift','queue','waitForTheAssignedQueue','receiveMessage','entity\x20found','debug','SmsAccount,\x20%s,\x20%s,\x20%s,\x20%s','Content-Type','text/xml','addApplications','sequelize','transaction','Transaction','ISOLATION_LEVELS','READ_COMMITTED','findAndCountAll','send','getApplications','getInteractions','Contact','Tag','Tags','color','tag','to\x20is\x20mandatory','CmList','List','spread','dataValues','Messages','received\x20delivery\x20report\x20from','skebby_dispatch_id','requestid','statusInt','status_code','message_id','groupName','clickatell','bandwidth','redif','DELIVERED','update','inspect','error_code','DELIVERED_TO_GATEWAY','RECEIVED_BY_RECIPIENT','message-delivered','DELIVRD','ACCEPTD','statusGet','csc','message-id','addAgents','emit','userSmsAccount:save','removeAgents','isArray','userSmsAccount:remove','getAgents','rimraf','fast-json-patch','request-promise','moment','bluebird','mustache','path','to-csv','fs-extra','squel','crypto','jsforce','desk.js','querystring','ioredis','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','localhost','./smsAccount.socket','register','jayson/promise','http','request','then','SmsAccount,\x20%s,\x20%s','request\x20sent','SmsAccount,\x20%s,\x20%s,\x20%s','stringify','error','message','info','result','catch','sendStatus','end','status','json','undefined','limit','count','offset','set','apply','save','destroy'];(function(_0xcc8e20,_0x41ff66){var _0x523cfd=function(_0x381ef9){while(--_0x381ef9){_0xcc8e20['push'](_0xcc8e20['shift']());}};_0x523cfd(++_0x41ff66);}(_0x770a,0x19b));var _0xa770=function(_0x216b4f,_0x3eabd8){_0x216b4f=_0x216b4f-0x0;var _0xddcc7e=_0x770a[_0x216b4f];return _0xddcc7e;};'use strict';var emlformat=require('eml-format');var rimraf=require(_0xa770('0x0'));var zipdir=require('zip-dir');var jsonpatch=require(_0xa770('0x1'));var rp=require(_0xa770('0x2'));var moment=require(_0xa770('0x3'));var BPromise=require(_0xa770('0x4'));var Mustache=require(_0xa770('0x5'));var util=require('util');var path=require(_0xa770('0x6'));var sox=require('sox');var csv=require(_0xa770('0x7'));var ejs=require('ejs');var fs=require('fs');var fs_extra=require(_0xa770('0x8'));var _=require('lodash');var squel=require(_0xa770('0x9'));var crypto=require(_0xa770('0xa'));var jsforce=require(_0xa770('0xb'));var deskjs=require(_0xa770('0xc'));var toCsv=require('to-csv');var querystring=require(_0xa770('0xd'));var Papa=require('papaparse');var Redis=require(_0xa770('0xe'));var authService=require('../../components/auth/service');var qs=require('../../components/parsers/qs');var as=require(_0xa770('0xf'));var hardwareService=require(_0xa770('0x10'));var logger=require('../../config/logger')('api');var utils=require(_0xa770('0x11'));var config=require(_0xa770('0x12'));var licenseUtil=require(_0xa770('0x13'));var db=require(_0xa770('0x14'))['db'];config['redis']=_['defaults'](config['redis'],{'host':_0xa770('0x15'),'port':0x18eb});var socket=require('socket.io-emitter')(new Redis(config['redis']));require(_0xa770('0x16'))[_0xa770('0x17')](socket);var jayson=require(_0xa770('0x18'));var client=jayson['client'][_0xa770('0x19')]({'port':0x232c});function respondWithRpcPromise(_0x258833,_0x2939e4,_0x2335af,_0x20469d){return new BPromise(function(_0x5b9ea3,_0x314854){var _0x5b1da4=_0x20469d||client;return _0x5b1da4[_0xa770('0x1a')](_0x258833,_0x2335af)[_0xa770('0x1b')](function(_0x24251a){logger['info'](_0xa770('0x1c'),_0x2939e4,_0xa770('0x1d'));logger['debug'](_0xa770('0x1e'),_0x2939e4,_0xa770('0x1d'),JSON[_0xa770('0x1f')](_0x24251a));if(_0x24251a['error']){if(_0x24251a[_0xa770('0x20')]['code']===0x1f4){logger[_0xa770('0x20')]('SmsAccount,\x20%s,\x20%s',_0x2939e4,_0x24251a[_0xa770('0x20')][_0xa770('0x21')]);return _0x314854(_0x24251a[_0xa770('0x20')][_0xa770('0x21')]);}logger[_0xa770('0x20')](_0xa770('0x1c'),_0x2939e4,_0x24251a['error'][_0xa770('0x21')]);return _0x5b9ea3(_0x24251a[_0xa770('0x20')][_0xa770('0x21')]);}else{logger[_0xa770('0x22')](_0xa770('0x1c'),_0x2939e4,'request\x20sent');_0x5b9ea3(_0x24251a[_0xa770('0x23')][_0xa770('0x21')]);}})[_0xa770('0x24')](function(_0x48bf04){logger[_0xa770('0x20')](_0xa770('0x1c'),_0x2939e4,_0x48bf04);_0x314854(_0x48bf04);});});}function respondWithStatusCode(_0x33f160,_0x11b059){_0x11b059=_0x11b059||0xcc;return function(_0x2e36c8){if(_0x2e36c8){return _0x33f160[_0xa770('0x25')](_0x11b059);}return _0x33f160['status'](_0x11b059)[_0xa770('0x26')]();};}function respondWithResult(_0x28e2d3,_0x193d53){_0x193d53=_0x193d53||0xc8;return function(_0xb0199e){if(_0xb0199e){return _0x28e2d3[_0xa770('0x27')](_0x193d53)[_0xa770('0x28')](_0xb0199e);}};}function respondWithFilteredResult(_0x49c5ce,_0x110fb2){return function(_0xb0f771){if(_0xb0f771){var _0x5cc807=typeof _0x110fb2['offset']===_0xa770('0x29')&&typeof _0x110fb2[_0xa770('0x2a')]===_0xa770('0x29');var _0x49c03d=_0xb0f771[_0xa770('0x2b')];var _0x48fee2=_0x5cc807?0x0:_0x110fb2[_0xa770('0x2c')];var _0x2b81b6=_0x5cc807?_0xb0f771[_0xa770('0x2b')]:_0x110fb2['offset']+_0x110fb2['limit'];var _0x1427fe;if(_0x2b81b6>=_0x49c03d){_0x2b81b6=_0x49c03d;_0x1427fe=0xc8;}else{_0x1427fe=0xce;}_0x49c5ce[_0xa770('0x27')](_0x1427fe);return _0x49c5ce[_0xa770('0x2d')]('Content-Range',_0x48fee2+'-'+_0x2b81b6+'/'+_0x49c03d)['json'](_0xb0f771);}return null;};}function patchUpdates(_0x196ba8){return function(_0x2808a0){try{jsonpatch[_0xa770('0x2e')](_0x2808a0,_0x196ba8,!![]);}catch(_0x67a240){return BPromise['reject'](_0x67a240);}return _0x2808a0[_0xa770('0x2f')]();};}function saveUpdates(_0x22e3d7,_0x2d1a65){return function(_0x1e3c2d){if(_0x1e3c2d){return _0x1e3c2d['update'](_0x22e3d7)[_0xa770('0x1b')](function(_0x5e8bb2){return _0x5e8bb2;});}return null;};}function removeEntity(_0x39d4ee,_0x540569){return function(_0x3db2fa){if(_0x3db2fa){return _0x3db2fa[_0xa770('0x30')]()[_0xa770('0x1b')](function(){var _0x5ec876=_0x3db2fa[_0xa770('0x31')]({'plain':!![]});var _0x2fd2c2=_0xa770('0x32');return db[_0xa770('0x33')]['destroy']({'where':{'type':_0x2fd2c2,'resourceId':_0x5ec876['id']}})['then'](function(){return _0x3db2fa;});})[_0xa770('0x1b')](function(){_0x39d4ee[_0xa770('0x27')](0xcc)[_0xa770('0x26')]();});}};}function handleEntityNotFound(_0x2a41fa,_0x32ddfe){return function(_0x4d05f1){if(!_0x4d05f1){_0x2a41fa['sendStatus'](0x194);}return _0x4d05f1;};}function handleError(_0x526349,_0x2043e6){_0x2043e6=_0x2043e6||0x1f4;return function(_0x1ce88d){logger['error'](_0x1ce88d[_0xa770('0x34')]);if(_0x1ce88d[_0xa770('0x35')]){delete _0x1ce88d[_0xa770('0x35')];}_0x526349[_0xa770('0x27')](_0x2043e6)['send'](_0x1ce88d);};}exports[_0xa770('0x36')]=function(_0x4dff6c,_0x3af9eb){var _0x1a53d1={'include':[{'model':db['Pause'],'as':_0xa770('0x37')}]},_0x5385cd={},_0x1fbca7={'count':0x0,'rows':[]};var _0x3e754d=_[_0xa770('0x38')](db['SmsAccount']['rawAttributes'],function(_0x60a42){return{'name':_0x60a42[_0xa770('0x39')],'type':_0x60a42['type'][_0xa770('0x3a')]};});_0x5385cd[_0xa770('0x3b')]=_[_0xa770('0x38')](_0x3e754d,_0xa770('0x35'));_0x5385cd[_0xa770('0x3c')]=_[_0xa770('0x3d')](_0x4dff6c[_0xa770('0x3c')]);_0x5385cd[_0xa770('0x3e')]=_[_0xa770('0x3f')](_0x5385cd['model'],_0x5385cd[_0xa770('0x3c')]);_0x1a53d1[_0xa770('0x40')]=_['intersection'](_0x5385cd[_0xa770('0x3b')],qs[_0xa770('0x41')](_0x4dff6c[_0xa770('0x3c')][_0xa770('0x41')]));_0x1a53d1[_0xa770('0x40')]=_0x1a53d1['attributes'][_0xa770('0x42')]?_0x1a53d1[_0xa770('0x40')]:_0x5385cd[_0xa770('0x3b')];if(!_0x4dff6c[_0xa770('0x3c')][_0xa770('0x43')](_0xa770('0x44'))){_0x1a53d1['limit']=qs[_0xa770('0x2a')](_0x4dff6c['query'][_0xa770('0x2a')]);_0x1a53d1[_0xa770('0x2c')]=qs[_0xa770('0x2c')](_0x4dff6c[_0xa770('0x3c')]['offset']);}_0x1a53d1['order']=qs[_0xa770('0x45')](_0x4dff6c['query']['sort']);_0x1a53d1[_0xa770('0x46')]=qs[_0xa770('0x3e')](_['pick'](_0x4dff6c[_0xa770('0x3c')],_0x5385cd[_0xa770('0x3e')]),_0x3e754d);if(_0x4dff6c['query'][_0xa770('0x47')]){_0x1a53d1[_0xa770('0x46')]=_['merge'](_0x1a53d1['where'],{'$or':_['map'](_0x3e754d,function(_0x521fb0){if(_0x521fb0['type']!==_0xa770('0x48')){var _0x256cf3={};_0x256cf3[_0x521fb0['name']]={'$like':'%'+_0x4dff6c['query'][_0xa770('0x47')]+'%'};return _0x256cf3;}})});}_0x1a53d1=_[_0xa770('0x49')]({},_0x1a53d1,_0x4dff6c['options']);var _0x574427={'where':_0x1a53d1[_0xa770('0x46')]};return db[_0xa770('0x4a')][_0xa770('0x2b')](_0x574427)[_0xa770('0x1b')](function(_0x13f59c){_0x1fbca7[_0xa770('0x2b')]=_0x13f59c;if(_0x4dff6c['query'][_0xa770('0x4b')]){_0x1a53d1[_0xa770('0x4c')]=[{'all':!![]}];}return db[_0xa770('0x4a')][_0xa770('0x4d')](_0x1a53d1);})[_0xa770('0x1b')](function(_0x5c45be){_0x1fbca7[_0xa770('0x4e')]=_0x5c45be;return _0x1fbca7;})['then'](respondWithFilteredResult(_0x3af9eb,_0x1a53d1))[_0xa770('0x24')](handleError(_0x3af9eb,null));};exports[_0xa770('0x4f')]=function(_0x2dc521,_0x3d9bb3){var _0x4702c2={'raw':![],'where':{'id':_0x2dc521[_0xa770('0x50')]['id']},'include':[{'model':db['Pause'],'as':'mandatoryDispositionPause'}]},_0x3cc236={};_0x3cc236[_0xa770('0x3b')]=_[_0xa770('0x3d')](db[_0xa770('0x4a')]['rawAttributes']);_0x3cc236['query']=_[_0xa770('0x3d')](_0x2dc521['query']);_0x3cc236[_0xa770('0x3e')]=_[_0xa770('0x3f')](_0x3cc236[_0xa770('0x3b')],_0x3cc236[_0xa770('0x3c')]);_0x4702c2[_0xa770('0x40')]=_[_0xa770('0x3f')](_0x3cc236[_0xa770('0x3b')],qs['fields'](_0x2dc521[_0xa770('0x3c')][_0xa770('0x41')]));_0x4702c2[_0xa770('0x40')]=_0x4702c2[_0xa770('0x40')][_0xa770('0x42')]?_0x4702c2[_0xa770('0x40')]:_0x3cc236[_0xa770('0x3b')];if(_0x2dc521['query'][_0xa770('0x4b')]){_0x4702c2['include']=[{'all':!![]}];}_0x4702c2=_['merge']({},_0x4702c2,_0x2dc521[_0xa770('0x51')]);return db[_0xa770('0x4a')][_0xa770('0x52')](_0x4702c2)[_0xa770('0x1b')](handleEntityNotFound(_0x3d9bb3,null))[_0xa770('0x1b')](respondWithResult(_0x3d9bb3,null))[_0xa770('0x24')](handleError(_0x3d9bb3,null));};exports[_0xa770('0x53')]=function(_0x5e168,_0x4d73c0){return db[_0xa770('0x4a')]['create'](_0x5e168[_0xa770('0x54')],{})[_0xa770('0x1b')](function(_0x543351){var _0x5f1a8a=_0x5e168[_0xa770('0x55')][_0xa770('0x31')]({'plain':!![]});if(!_0x5f1a8a)throw new Error(_0xa770('0x56'));if(_0x5f1a8a[_0xa770('0x57')]===_0xa770('0x55')){var _0x4c5a2d=_0x543351[_0xa770('0x31')]({'plain':!![]});var _0xa4b67c='SmsAccounts';return db[_0xa770('0x58')]['find']({'where':{'name':_0xa4b67c,'userProfileId':_0x5f1a8a[_0xa770('0x59')]},'raw':!![]})[_0xa770('0x1b')](function(_0x12b173){if(_0x12b173&&_0x12b173[_0xa770('0x5a')]===0x0){return db['UserProfileResource'][_0xa770('0x53')]({'name':_0x4c5a2d[_0xa770('0x35')],'resourceId':_0x4c5a2d['id'],'type':_0x12b173[_0xa770('0x35')],'sectionId':_0x12b173['id']},{})['then'](function(){return _0x543351;});}else{return _0x543351;}})[_0xa770('0x24')](function(_0x46b74c){logger[_0xa770('0x20')]('Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s',_0x46b74c);throw _0x46b74c;});}return _0x543351;})[_0xa770('0x1b')](respondWithResult(_0x4d73c0,0xc9))['catch'](handleError(_0x4d73c0,null));};exports['update']=function(_0x29bfa8,_0xfc62e4){if(_0x29bfa8['body']['id']){delete _0x29bfa8[_0xa770('0x54')]['id'];}return db[_0xa770('0x4a')][_0xa770('0x52')]({'where':{'id':_0x29bfa8[_0xa770('0x50')]['id']},'include':[{'model':db['Pause'],'as':_0xa770('0x37')}]})[_0xa770('0x1b')](handleEntityNotFound(_0xfc62e4,null))[_0xa770('0x1b')](saveUpdates(_0x29bfa8[_0xa770('0x54')],null))[_0xa770('0x1b')](respondWithResult(_0xfc62e4,null))['catch'](handleError(_0xfc62e4,null));};exports[_0xa770('0x30')]=function(_0x152a37,_0x554bdc){return db[_0xa770('0x4a')][_0xa770('0x52')]({'where':{'id':_0x152a37[_0xa770('0x50')]['id']}})[_0xa770('0x1b')](handleEntityNotFound(_0x554bdc,null))[_0xa770('0x1b')](removeEntity(_0x554bdc,null))[_0xa770('0x24')](handleError(_0x554bdc,null));};exports[_0xa770('0x5b')]=function(_0x5c615e,_0x20ba62){return db['SmsAccount'][_0xa770('0x5b')]()['then'](respondWithResult(_0x20ba62,null))['catch'](handleError(_0x20ba62,null));};exports[_0xa770('0x5c')]=function(_0x138c5e,_0x34fbe7,_0x5d9fa3){if(_0x138c5e[_0xa770('0x54')]['id']){delete _0x138c5e[_0xa770('0x54')]['id'];}return db[_0xa770('0x4a')][_0xa770('0x52')]({'where':{'id':_0x138c5e['params']['id']}})[_0xa770('0x1b')](handleEntityNotFound(_0x34fbe7,null))[_0xa770('0x1b')](function(_0x4f23dd){if(_0x4f23dd){_0x138c5e[_0xa770('0x54')]['SmsAccountId']=_0x4f23dd['id'];return db['Disposition'][_0xa770('0x53')](_0x138c5e[_0xa770('0x54')]);}})[_0xa770('0x1b')](respondWithResult(_0x34fbe7,null))['catch'](handleError(_0x34fbe7,null));};exports[_0xa770('0x5d')]=function(_0x32efb2,_0x7a64e6,_0x2fa2dd){var _0xe3e6c2={'raw':![],'where':{}};var _0x3ab668={};var _0x4af540={'count':0x0,'rows':[]};return db[_0xa770('0x4a')][_0xa770('0x5e')]({'where':{'id':_0x32efb2[_0xa770('0x50')]['id']}})[_0xa770('0x1b')](handleEntityNotFound(_0x7a64e6,null))[_0xa770('0x1b')](function(_0x2a4dfb){if(_0x2a4dfb){_0x3ab668['model']=_[_0xa770('0x3d')](db[_0xa770('0x5f')][_0xa770('0x60')]);_0x3ab668['query']=_['keys'](_0x32efb2[_0xa770('0x3c')]);_0x3ab668[_0xa770('0x3e')]=_[_0xa770('0x3f')](_0x3ab668['model'],_0x3ab668[_0xa770('0x3c')]);_0xe3e6c2['attributes']=_[_0xa770('0x3f')](_0x3ab668[_0xa770('0x3b')],qs['fields'](_0x32efb2['query']['fields']));_0xe3e6c2[_0xa770('0x40')]=_0xe3e6c2['attributes'][_0xa770('0x42')]?_0xe3e6c2['attributes']:_0x3ab668[_0xa770('0x3b')];if(!_0x32efb2[_0xa770('0x3c')][_0xa770('0x43')](_0xa770('0x44'))){_0xe3e6c2['limit']=qs[_0xa770('0x2a')](_0x32efb2[_0xa770('0x3c')]['limit']);_0xe3e6c2[_0xa770('0x2c')]=qs[_0xa770('0x2c')](_0x32efb2[_0xa770('0x3c')]['offset']);}_0xe3e6c2[_0xa770('0x61')]=qs[_0xa770('0x45')](_0x32efb2[_0xa770('0x3c')][_0xa770('0x45')]);_0xe3e6c2['where']=qs[_0xa770('0x3e')](_[_0xa770('0x62')](_0x32efb2[_0xa770('0x3c')],_0x3ab668[_0xa770('0x3e')]));_0xe3e6c2[_0xa770('0x46')][_0xa770('0x63')]=_0x2a4dfb['id'];if(_0x32efb2['query'][_0xa770('0x47')]){_0xe3e6c2['where']=_['merge'](_0xe3e6c2['where'],{'$or':_[_0xa770('0x38')](_0xe3e6c2[_0xa770('0x40')],function(_0x25a4ac){var _0x293542={};_0x293542[_0x25a4ac]={'$like':'%'+_0x32efb2[_0xa770('0x3c')][_0xa770('0x47')]+'%'};return _0x293542;})});}_0xe3e6c2=_[_0xa770('0x49')]({},_0xe3e6c2,_0x32efb2[_0xa770('0x51')]);return db[_0xa770('0x5f')][_0xa770('0x2b')]({'where':_0xe3e6c2[_0xa770('0x46')]})[_0xa770('0x1b')](function(_0x2b9134){_0x4af540['count']=_0x2b9134;if(_0x32efb2[_0xa770('0x3c')][_0xa770('0x4b')]){_0xe3e6c2[_0xa770('0x4c')]=[{'all':!![]}];}return db['Disposition'][_0xa770('0x4d')](_0xe3e6c2);})[_0xa770('0x1b')](function(_0x4a0547){_0x4af540['rows']=_0x4a0547;return _0x4af540;});}})[_0xa770('0x1b')](respondWithFilteredResult(_0x7a64e6,_0xe3e6c2))[_0xa770('0x24')](handleError(_0x7a64e6,null));};exports['removeDispositions']=function(_0x341fed,_0x595173,_0xc2456f){return db[_0xa770('0x4a')]['find']({'where':{'id':_0x341fed[_0xa770('0x50')]['id']}})[_0xa770('0x1b')](handleEntityNotFound(_0x595173,null))[_0xa770('0x1b')](function(_0x238f81){if(_0x238f81){return _0x238f81[_0xa770('0x64')](_0x341fed[_0xa770('0x3c')][_0xa770('0x65')]);}})[_0xa770('0x1b')](respondWithStatusCode(_0x595173,null))[_0xa770('0x24')](handleError(_0x595173,null));};exports[_0xa770('0x66')]=function(_0xff842,_0x2b6cf6,_0x3c1452){if(_0xff842['body']['id']){delete _0xff842[_0xa770('0x54')]['id'];}return db[_0xa770('0x4a')][_0xa770('0x52')]({'where':{'id':_0xff842[_0xa770('0x50')]['id']}})[_0xa770('0x1b')](handleEntityNotFound(_0x2b6cf6,null))[_0xa770('0x1b')](function(_0x172fbb){if(_0x172fbb){_0xff842[_0xa770('0x54')]['SmsAccountId']=_0x172fbb['id'];return db['CannedAnswer'][_0xa770('0x53')](_0xff842['body']);}})[_0xa770('0x1b')](respondWithResult(_0x2b6cf6,null))[_0xa770('0x24')](handleError(_0x2b6cf6,null));};exports[_0xa770('0x67')]=function(_0x5d57df,_0x3e953c,_0x253c0b){var _0x5568cc={'raw':![],'where':{}};var _0x4b30f9={};var _0x5228f2={'count':0x0,'rows':[]};return db[_0xa770('0x4a')][_0xa770('0x5e')]({'where':{'id':_0x5d57df[_0xa770('0x50')]['id']}})['then'](handleEntityNotFound(_0x3e953c,null))['then'](function(_0x22776f){if(_0x22776f){_0x4b30f9['model']=_[_0xa770('0x3d')](db[_0xa770('0x68')]['rawAttributes']);_0x4b30f9[_0xa770('0x3c')]=_[_0xa770('0x3d')](_0x5d57df[_0xa770('0x3c')]);_0x4b30f9[_0xa770('0x3e')]=_[_0xa770('0x3f')](_0x4b30f9[_0xa770('0x3b')],_0x4b30f9['query']);_0x5568cc['attributes']=_[_0xa770('0x3f')](_0x4b30f9[_0xa770('0x3b')],qs[_0xa770('0x41')](_0x5d57df[_0xa770('0x3c')][_0xa770('0x41')]));_0x5568cc[_0xa770('0x40')]=_0x5568cc[_0xa770('0x40')]['length']?_0x5568cc[_0xa770('0x40')]:_0x4b30f9[_0xa770('0x3b')];if(!_0x5d57df['query'][_0xa770('0x43')](_0xa770('0x44'))){_0x5568cc[_0xa770('0x2a')]=qs[_0xa770('0x2a')](_0x5d57df[_0xa770('0x3c')][_0xa770('0x2a')]);_0x5568cc['offset']=qs[_0xa770('0x2c')](_0x5d57df[_0xa770('0x3c')][_0xa770('0x2c')]);}_0x5568cc[_0xa770('0x61')]=qs[_0xa770('0x45')](_0x5d57df[_0xa770('0x3c')]['sort']);_0x5568cc[_0xa770('0x46')]=qs[_0xa770('0x3e')](_['pick'](_0x5d57df[_0xa770('0x3c')],_0x4b30f9['filters']));_0x5568cc[_0xa770('0x46')][_0xa770('0x63')]=_0x22776f['id'];if(_0x5d57df[_0xa770('0x3c')][_0xa770('0x47')]){_0x5568cc[_0xa770('0x46')]=_[_0xa770('0x49')](_0x5568cc[_0xa770('0x46')],{'$or':_[_0xa770('0x38')](_0x5568cc[_0xa770('0x40')],function(_0x1ea03f){var _0x4c7a30={};_0x4c7a30[_0x1ea03f]={'$like':'%'+_0x5d57df['query']['filter']+'%'};return _0x4c7a30;})});}_0x5568cc=_['merge']({},_0x5568cc,_0x5d57df[_0xa770('0x51')]);return db[_0xa770('0x68')]['count']({'where':_0x5568cc[_0xa770('0x46')]})[_0xa770('0x1b')](function(_0x9a6c7c){_0x5228f2[_0xa770('0x2b')]=_0x9a6c7c;if(_0x5d57df[_0xa770('0x3c')][_0xa770('0x4b')]){_0x5568cc[_0xa770('0x4c')]=[{'all':!![]}];}return db[_0xa770('0x68')]['findAll'](_0x5568cc);})['then'](function(_0x14f835){_0x5228f2['rows']=_0x14f835;return _0x5228f2;});}})[_0xa770('0x1b')](respondWithFilteredResult(_0x3e953c,_0x5568cc))[_0xa770('0x24')](handleError(_0x3e953c,null));};exports[_0xa770('0x69')]=function(_0x5b509d,_0x101817,_0x247e8e){return db[_0xa770('0x4a')][_0xa770('0x52')]({'where':{'id':_0x5b509d[_0xa770('0x50')]['id']}})[_0xa770('0x1b')](handleEntityNotFound(_0x101817,null))[_0xa770('0x1b')](function(_0xa972ec){if(_0xa972ec){return _0xa972ec[_0xa770('0x69')](_0x5b509d[_0xa770('0x3c')][_0xa770('0x65')]);}})['then'](respondWithStatusCode(_0x101817,null))[_0xa770('0x24')](handleError(_0x101817,null));};exports[_0xa770('0x6a')]=function(_0x217761,_0x4f4db4,_0x394514){var _0x5df3d4={'channel':_0xa770('0x6b')};var _0x16bf50=[];var _0xe0ce92=[];var _0x4cd64c={};return db[_0xa770('0x4a')]['find']({'where':{'id':_0x217761[_0xa770('0x50')]['id']},'include':[{'model':db[_0xa770('0x6c')],'as':_0xa770('0x6d')}]})[_0xa770('0x1b')](handleEntityNotFound(_0x4f4db4,null))['then'](function(_0xc5d86a){_0x5df3d4['account']=_0xc5d86a;_0x5df3d4[_0xa770('0x6e')]=_[_0xa770('0x6f')](_0xc5d86a[_0xa770('0x6d')],[_0xa770('0x70')],['asc']);if(_0x5df3d4[_0xa770('0x71')][_0xa770('0x6d')]){delete _0x5df3d4[_0xa770('0x71')][_0xa770('0x6d')];}return db[_0xa770('0x72')][_0xa770('0x5b')]();})[_0xa770('0x1b')](function(_0x39659b){if(!_0x39659b){throw new db[(_0xa770('0x73'))][(_0xa770('0x74'))](_0xa770('0x75'));}_0x16bf50=_[_0xa770('0x76')](_['keys'](_0x39659b),[_0xa770('0x77'),_0xa770('0x78')]);_0xe0ce92=_['difference'](_[_0xa770('0x3d')](_0x39659b),['createdAt','updatedAt',_0xa770('0x79'),'ListId']);_0x5df3d4[_0xa770('0x54')]={'mapKey':_0xa770('0x7a')};if(_0x5df3d4['account'][_0xa770('0x7b')]){switch(_0x5df3d4[_0xa770('0x71')][_0xa770('0x7b')]){case _0xa770('0x7c'):_0x5df3d4[_0xa770('0x54')]['from']=_0x217761[_0xa770('0x54')][_0xa770('0x7d')];_0x5df3d4[_0xa770('0x54')][_0xa770('0x54')]=_0x217761[_0xa770('0x54')][_0xa770('0x7e')];_0x5df3d4[_0xa770('0x54')][_0xa770('0x7f')]=_0x217761[_0xa770('0x54')][_0xa770('0x80')];break;case _0xa770('0x81'):_0x5df3d4['body'][_0xa770('0x82')]='+'+_0x217761[_0xa770('0x54')][_0xa770('0x83')];_0x5df3d4[_0xa770('0x54')]['body']=_0x217761[_0xa770('0x54')][_0xa770('0x84')];break;case _0xa770('0x85'):_0x5df3d4[_0xa770('0x54')]['from']=_0x217761[_0xa770('0x54')]['from'];_0x5df3d4[_0xa770('0x54')][_0xa770('0x54')]=_0x217761[_0xa770('0x54')][_0xa770('0x21')];break;case _0xa770('0x86'):_0x5df3d4[_0xa770('0x54')][_0xa770('0x82')]=_0x217761[_0xa770('0x54')]['from'];_0x5df3d4[_0xa770('0x54')]['body']=_0x217761[_0xa770('0x54')][_0xa770('0x54')];_0x5df3d4[_0xa770('0x54')][_0xa770('0x7f')]=_0x217761[_0xa770('0x54')]['message_id'];break;case'plivo':_0x5df3d4['body'][_0xa770('0x82')]=_0x217761[_0xa770('0x54')]['From'];_0x5df3d4[_0xa770('0x54')][_0xa770('0x54')]=_0x217761['body']['Text'];_0x5df3d4[_0xa770('0x54')]['messageId']=_0x217761[_0xa770('0x54')][_0xa770('0x87')];break;case _0xa770('0x88'):_0x5df3d4[_0xa770('0x54')]['from']='+'+_0x217761[_0xa770('0x54')][_0xa770('0x89')][0x0][_0xa770('0x82')];_0x5df3d4[_0xa770('0x54')][_0xa770('0x54')]=_0x217761[_0xa770('0x54')][_0xa770('0x89')][0x0]['text'];_0x5df3d4[_0xa770('0x54')][_0xa770('0x7f')]=_0x217761[_0xa770('0x54')][_0xa770('0x89')][0x0][_0xa770('0x7f')];break;case'csc':_0x5df3d4[_0xa770('0x54')][_0xa770('0x82')]=_0x217761['body'][_0xa770('0x8a')];_0x5df3d4['body'][_0xa770('0x54')]=_0x217761[_0xa770('0x54')][_0xa770('0x8b')]['message'];break;case'clickatell':_0x5df3d4[_0xa770('0x54')]['from']=_0x217761[_0xa770('0x54')][_0xa770('0x8c')];_0x5df3d4['body'][_0xa770('0x54')]=_0x217761[_0xa770('0x54')][_0xa770('0x84')];_0x5df3d4[_0xa770('0x54')][_0xa770('0x7f')]=_0x217761[_0xa770('0x54')][_0xa770('0x8d')];break;case'bandwidth':_0x5df3d4['body'][_0xa770('0x7f')]=_0x217761[_0xa770('0x54')][0x0]['message']['id'];_0x5df3d4['body'][_0xa770('0x82')]=_0x217761[_0xa770('0x54')][0x0][_0xa770('0x21')][_0xa770('0x82')];_0x5df3d4[_0xa770('0x54')][_0xa770('0x54')]=_0x217761['body'][0x0]['message'][_0xa770('0x84')];break;case _0xa770('0x8e'):_0x5df3d4['body'][_0xa770('0x82')]=_0x217761[_0xa770('0x54')][_0xa770('0x82')];_0x5df3d4[_0xa770('0x54')][_0xa770('0x54')]=_0x217761['body']['message'];_0x5df3d4[_0xa770('0x54')]['messageId']=_0x217761['body'][_0xa770('0x8f')];break;}}if(_0x5df3d4['body']['id']){delete _0x5df3d4[_0xa770('0x54')]['id'];}if(_[_0xa770('0x90')](_0x5df3d4[_0xa770('0x54')][_0xa770('0x82')])){throw new db[(_0xa770('0x73'))][(_0xa770('0x74'))](_0xa770('0x91'));}if(_[_0xa770('0x90')](_0x5df3d4[_0xa770('0x54')][_0xa770('0x54')])||_0x5df3d4['body'][_0xa770('0x54')]===''){throw new db[(_0xa770('0x73'))][(_0xa770('0x74'))](_0xa770('0x92'));}if(_[_0xa770('0x90')](_0x5df3d4[_0xa770('0x54')][_0xa770('0x93')])){throw new db['Sequelize'][(_0xa770('0x74'))]('mapKey\x20is\x20mandatory,\x20please\x20use\x20one\x20of\x20these:\x20'+_0xe0ce92);}if(!_[_0xa770('0x94')](_0xe0ce92,_0x5df3d4[_0xa770('0x54')]['mapKey'])){throw new db['Sequelize'][(_0xa770('0x74'))](_0xa770('0x95')+_0xe0ce92);}_0x4cd64c[_0x5df3d4['body'][_0xa770('0x93')]]=_0x5df3d4[_0xa770('0x54')][_0xa770('0x82')];return db['CmList'][_0xa770('0x52')]({'where':{'id':_0x5df3d4[_0xa770('0x71')][_0xa770('0x96')]},'include':[{'model':db[_0xa770('0x72')],'as':_0xa770('0x97'),'where':_0x4cd64c,'limit':0x1,'order':[[_0xa770('0x78'),'DESC']]}]});})['then'](handleEntityNotFound(_0x4f4db4,null))[_0xa770('0x1b')](function(_0x3561c3){if(_0x3561c3){_0x5df3d4[_0xa770('0x98')]=_[_0xa770('0x99')](_0x3561c3,[_0xa770('0x97')]);if(_0x3561c3[_0xa770('0x97')]['length']){return _0x3561c3[_0xa770('0x97')][0x0];}var _0x1dc20a=_[_0xa770('0x9a')](_0x5df3d4[_0xa770('0x54')],{'firstName':_0x5df3d4[_0xa770('0x54')]['from'],'ListId':_0x3561c3['id']});_0x1dc20a[_0x5df3d4['body'][_0xa770('0x93')]]=_0x5df3d4['body'][_0xa770('0x82')];return db[_0xa770('0x72')][_0xa770('0x53')](_0x1dc20a,{'fields':_0x16bf50,'raw':!![]});}})[_0xa770('0x1b')](handleEntityNotFound(_0x4f4db4,null))[_0xa770('0x1b')](function(_0xc63563){if(_0xc63563){_0x5df3d4[_0xa770('0x9b')]=_0xc63563;var _0x308278={'ContactId':_0xc63563['id'],'phone':_0x5df3d4[_0xa770('0x54')][_0xa770('0x82')],'SmsAccountId':_0x217761[_0xa770('0x50')]['id']};var _0x3701f6={'ContactId':_0xc63563['id'],'SmsAccountId':_0x217761[_0xa770('0x50')]['id'],'closed':![]};return db[_0xa770('0x9c')][_0xa770('0x52')]({'where':_0x3701f6})['then'](function(_0x54ca1a){if(_0x54ca1a){return[_0x54ca1a,![]];}return db[_0xa770('0x9c')][_0xa770('0x53')](_0x308278)[_0xa770('0x1b')](function(_0x495566){return[_0x495566,!![]];});});}})['spread'](function(_0x21e60a,_0x334c71){_0x5df3d4['interaction']=_0x21e60a[_0xa770('0x31')]({'plain':!![]});_0x5df3d4['interaction'][_0xa770('0x9d')]=![];if(_0x334c71){if(_0x5df3d4[_0xa770('0x71')][_0xa770('0x9e')]){_0x5df3d4[_0xa770('0x6e')][_0xa770('0x9f')]({'id':0x0,'priority':_0x5df3d4['applications'][_0xa770('0x42')]+0x1,'app':'close','appdata':_0xa770('0xa0'),'interval':_0xa770('0xa1')});}_0x5df3d4[_0xa770('0xa2')][_0xa770('0x9d')]=!![];}return db[_0xa770('0xa3')][_0xa770('0x53')]({'phone':_0x5df3d4[_0xa770('0x54')]['from'],'messageId':_0x5df3d4[_0xa770('0x54')][_0xa770('0x7f')],'body':_0x5df3d4[_0xa770('0x54')][_0xa770('0x54')],'SmsAccountId':_0x217761[_0xa770('0x50')]['id'],'SmsInteractionId':_0x21e60a['id'],'direction':'in','ContactId':_0x21e60a[_0xa770('0xa4')],'AttachmentId':_0x5df3d4[_0xa770('0x54')][_0xa770('0xa5')]});})[_0xa770('0x1b')](function(_0x31c61f){_0x5df3d4[_0xa770('0x21')]=_0x31c61f;if(!_0x5df3d4[_0xa770('0xa2')][_0xa770('0xa6')])return;return db[_0xa770('0xa7')][_0xa770('0x52')]({'attributes':['id',_0xa770('0x35')],'where':{'id':_0x5df3d4['interaction'][_0xa770('0xa6')]}});})[_0xa770('0x1b')](function(_0x4d8b4a){if(_0x4d8b4a){_0x5df3d4[_0xa770('0x6e')]['unshift']({'id':0x0,'priority':0x0,'app':_0xa770('0xa8'),'appdata':_0x4d8b4a[_0xa770('0x35')]+','+(_0x5df3d4[_0xa770('0x71')][_0xa770('0xa9')]||0xa),'interval':_0xa770('0xa1')});}if(!_0x5df3d4['interaction']['queueId'])return;return db[_0xa770('0xaa')][_0xa770('0x52')]({'attributes':['id','name'],'where':{'id':_0x5df3d4['interaction']['queueId']}});})[_0xa770('0x1b')](function(_0x477796){if(_0x477796){_0x5df3d4[_0xa770('0x6e')][_0xa770('0xab')]({'id':0x0,'priority':0x1,'app':_0xa770('0xac'),'appdata':_0x477796['name']+','+(_0x5df3d4[_0xa770('0x71')][_0xa770('0xad')]||0x12c),'interval':'*,*,*,*'});}return respondWithRpcPromise('Start','startRouting',_0x5df3d4);})['then'](function(_0x2b27d1){if(_0x2b27d1){var _0x4095d2=0xc8;var _0x4092e5=_0xa770('0xae');logger[_0xa770('0x22')](_0xa770('0x1e'),_0x4092e5,_0x4095d2,_0xa770('0xaf'));logger[_0xa770('0xb0')](_0xa770('0xb1'),_0x4092e5,_0x4095d2,_0xa770('0xaf'),JSON[_0xa770('0x1f')](_0x2b27d1));if(_0x5df3d4['account'][_0xa770('0x7b')]===_0xa770('0x7c')){return _0x4f4db4['status'](_0x4095d2)[_0xa770('0x2d')](_0xa770('0xb2'),_0xa770('0xb3'))['send']('\x0a');}else{return _0x4f4db4['status'](_0x4095d2)[_0xa770('0x28')](_0x2b27d1);}}})[_0xa770('0x24')](handleError(_0x4f4db4,null));};exports[_0xa770('0xb4')]=function(_0x35fe47,_0x4f4807){var _0x36a683=_0x35fe47[_0xa770('0x50')]['id'];var _0xa000d4=_0x35fe47[_0xa770('0x54')];var _0x337d36=0xc8;var _0x3d1e90=null;return db[_0xa770('0xb5')][_0xa770('0xb6')]({'isolationLevel':db[_0xa770('0xb5')][_0xa770('0xb7')][_0xa770('0xb8')][_0xa770('0xb9')]},function(_0x14e834){return db[_0xa770('0x4a')][_0xa770('0x5e')]({'where':{'id':_0x36a683},'transaction':_0x14e834})[_0xa770('0x1b')](function(_0x4e39b2){if(_0x4e39b2){return db[_0xa770('0x6c')][_0xa770('0x30')]({'where':{'SmsAccountId':_0x36a683},'transaction':_0x14e834})['then'](function(){var _0x55d7ae=_['map'](_0xa000d4,function(_0x109ffc){_0x109ffc['SmsAccountId']=_0x36a683;return _0x109ffc;});return db['SmsApplication']['bulkCreate'](_0x55d7ae,{'transaction':_0x14e834});});}else{_0x337d36=0x194;_0x3d1e90=[];}});})['then'](function(){if(_0x337d36!==0x194){return db[_0xa770('0x6c')][_0xa770('0xba')]({'where':{'SmsAccountId':_0x36a683},'order':_0xa770('0x70')})[_0xa770('0x1b')](function(_0x3f29d1){_0x3d1e90=_0x3f29d1;});}})['catch'](function(_0xe6fe94){_0x337d36=0x1f4;logger[_0xa770('0x20')](_0xe6fe94[_0xa770('0x34')]);if(_0xe6fe94['name']){delete _0xe6fe94[_0xa770('0x35')];}_0x3d1e90=_0xe6fe94;})['finally'](function(){if(_0x3d1e90===null){_0x4f4807[_0xa770('0x25')](_0x337d36);}else{if(_0x337d36===0x1f4){_0x4f4807[_0xa770('0x27')](_0x337d36)[_0xa770('0xbb')](_0x3d1e90);}else{_0x4f4807[_0xa770('0x27')](_0x337d36)[_0xa770('0x28')](_0x3d1e90);}}});};exports[_0xa770('0xbc')]=function(_0x1ac7e2,_0x5688ec,_0x2295e3){var _0x4cc103={};var _0x4dc485={};var _0x2b0196;var _0x337658;return db[_0xa770('0x4a')][_0xa770('0x5e')]({'where':{'id':_0x1ac7e2['params']['id']}})[_0xa770('0x1b')](handleEntityNotFound(_0x5688ec,null))[_0xa770('0x1b')](function(_0x157811){if(_0x157811){_0x2b0196=_0x157811;_0x4dc485[_0xa770('0x3b')]=_[_0xa770('0x3d')](db[_0xa770('0x6c')][_0xa770('0x60')]);_0x4dc485[_0xa770('0x3c')]=_['keys'](_0x1ac7e2['query']);_0x4dc485[_0xa770('0x3e')]=_['intersection'](_0x4dc485['model'],_0x4dc485['query']);_0x4cc103[_0xa770('0x40')]=_[_0xa770('0x3f')](_0x4dc485[_0xa770('0x3b')],qs['fields'](_0x1ac7e2[_0xa770('0x3c')][_0xa770('0x41')]));_0x4cc103[_0xa770('0x40')]=_0x4cc103[_0xa770('0x40')][_0xa770('0x42')]?_0x4cc103[_0xa770('0x40')]:_0x4dc485[_0xa770('0x3b')];_0x4cc103[_0xa770('0x61')]=qs[_0xa770('0x45')](_0x1ac7e2[_0xa770('0x3c')][_0xa770('0x45')]);_0x4cc103[_0xa770('0x46')]=qs[_0xa770('0x3e')](_[_0xa770('0x62')](_0x1ac7e2['query'],_0x4dc485[_0xa770('0x3e')]));if(_0x1ac7e2[_0xa770('0x3c')]['filter']){_0x4cc103[_0xa770('0x46')]=_[_0xa770('0x49')](_0x4cc103['where'],{'$or':_[_0xa770('0x38')](_0x4cc103[_0xa770('0x40')],function(_0x39ccdc){var _0x3ef58d={};_0x3ef58d[_0x39ccdc]={'$like':'%'+_0x1ac7e2[_0xa770('0x3c')][_0xa770('0x47')]+'%'};return _0x3ef58d;})});}_0x4cc103=_[_0xa770('0x49')]({},_0x4cc103,_0x1ac7e2['options']);return _0x2b0196[_0xa770('0xbc')](_0x4cc103);}})['then'](function(_0x1b2d5e){if(_0x1b2d5e){_0x337658=_0x1b2d5e[_0xa770('0x42')];if(!_0x1ac7e2['query'][_0xa770('0x43')](_0xa770('0x44'))){_0x4cc103['limit']=qs[_0xa770('0x2a')](_0x1ac7e2[_0xa770('0x3c')]['limit']);_0x4cc103[_0xa770('0x2c')]=qs[_0xa770('0x2c')](_0x1ac7e2[_0xa770('0x3c')][_0xa770('0x2c')]);}return _0x2b0196[_0xa770('0xbc')](_0x4cc103);}})['then'](function(_0x4aa2f4){if(_0x4aa2f4){return _0x4aa2f4?{'count':_0x337658,'rows':_0x4aa2f4}:null;}})[_0xa770('0x1b')](respondWithResult(_0x5688ec,null))[_0xa770('0x24')](handleError(_0x5688ec,null));};exports[_0xa770('0xbd')]=function(_0x2b9e69,_0x3d4a21,_0x45f373){var _0x44aa30={'raw':![],'where':{}};var _0x40095b={};var _0x2979f5={'count':0x0,'rows':[]};return db[_0xa770('0x4a')]['findOne']({'where':{'id':_0x2b9e69[_0xa770('0x50')]['id']}})[_0xa770('0x1b')](handleEntityNotFound(_0x3d4a21,null))[_0xa770('0x1b')](function(_0x11afb6){if(_0x11afb6){_0x40095b[_0xa770('0x3b')]=_[_0xa770('0x3d')](db[_0xa770('0x9c')][_0xa770('0x60')]);_0x40095b[_0xa770('0x3c')]=_['keys'](_0x2b9e69[_0xa770('0x3c')]);_0x40095b[_0xa770('0x3e')]=_[_0xa770('0x3f')](_0x40095b[_0xa770('0x3b')],_0x40095b[_0xa770('0x3c')]);_0x44aa30['attributes']=_[_0xa770('0x3f')](_0x40095b[_0xa770('0x3b')],qs[_0xa770('0x41')](_0x2b9e69['query'][_0xa770('0x41')]));_0x44aa30[_0xa770('0x40')]=_0x44aa30[_0xa770('0x40')][_0xa770('0x42')]?_0x44aa30[_0xa770('0x40')]:_0x40095b[_0xa770('0x3b')];if(!_0x2b9e69['query'][_0xa770('0x43')](_0xa770('0x44'))){_0x44aa30['limit']=qs[_0xa770('0x2a')](_0x2b9e69[_0xa770('0x3c')]['limit']);_0x44aa30['offset']=qs[_0xa770('0x2c')](_0x2b9e69['query']['offset']);}_0x44aa30[_0xa770('0x61')]=qs[_0xa770('0x45')](_0x2b9e69[_0xa770('0x3c')][_0xa770('0x45')]);_0x44aa30['where']=qs['filters'](_[_0xa770('0x62')](_0x2b9e69[_0xa770('0x3c')],_0x40095b[_0xa770('0x3e')]));_0x44aa30[_0xa770('0x46')]['SmsAccountId']=_0x11afb6['id'];if(_0x2b9e69['query']['filter']){_0x44aa30[_0xa770('0x46')]=_[_0xa770('0x49')](_0x44aa30['where'],{'$or':_[_0xa770('0x38')](_0x44aa30[_0xa770('0x40')],function(_0x9d9a9b){var _0x4dfe08={};_0x4dfe08[_0x9d9a9b]={'$like':'%'+_0x2b9e69[_0xa770('0x3c')][_0xa770('0x47')]+'%'};return _0x4dfe08;})});}_0x44aa30=_['merge']({},_0x44aa30,_0x2b9e69[_0xa770('0x51')]);return db[_0xa770('0x9c')][_0xa770('0x2b')]({'where':_0x44aa30['where']})[_0xa770('0x1b')](function(_0x167fe9){_0x2979f5[_0xa770('0x2b')]=_0x167fe9;if(_0x2b9e69[_0xa770('0x3c')]['includeAll']){_0x44aa30[_0xa770('0x4c')]=[{'model':db['CmContact'],'as':_0xa770('0xbe'),'required':![]},{'model':db[_0xa770('0xa7')],'as':'Owner','attributes':['name','fullname','internal'],'required':![]},{'model':db[_0xa770('0xbf')],'as':_0xa770('0xc0'),'attributes':['id',_0xa770('0x35'),_0xa770('0xc1')],'where':_0x2b9e69[_0xa770('0x3c')][_0xa770('0xc2')]?{'id':_0x2b9e69[_0xa770('0x3c')][_0xa770('0xc2')]}:undefined,'required':_0x2b9e69[_0xa770('0x3c')][_0xa770('0xc2')]?!![]:![]}];}return db[_0xa770('0x9c')][_0xa770('0x4d')](_0x44aa30);})[_0xa770('0x1b')](function(_0x3c2947){_0x2979f5['rows']=_0x3c2947;return _0x2979f5;});}})[_0xa770('0x1b')](respondWithFilteredResult(_0x3d4a21,_0x44aa30))[_0xa770('0x24')](handleError(_0x3d4a21,null));};exports['send']=function(_0x43303c,_0x1e40f6,_0x3c70ce){var _0x3f814e,_0x5d9458,_0x1b53a3;if(_[_0xa770('0x90')](_0x43303c[_0xa770('0x54')][_0xa770('0x54')])||_0x43303c[_0xa770('0x54')][_0xa770('0x54')]===''){throw new db['Sequelize'][(_0xa770('0x74'))]('body\x20is\x20mandatory\x20and\x20not\x20empty');}if(_[_0xa770('0x90')](_0x43303c[_0xa770('0x54')]['to'])){throw new db[(_0xa770('0x73'))][(_0xa770('0x74'))](_0xa770('0xc3'));}_0x3f814e=_0x43303c[_0xa770('0x54')]['to'];return db['SmsAccount'][_0xa770('0x52')]({'where':{'id':_0x43303c[_0xa770('0x50')]['id']},'include':[{'model':db[_0xa770('0xc4')],'as':_0xa770('0xc5'),'include':[{'model':db[_0xa770('0x72')],'as':_0xa770('0x97'),'where':{'mobile':_0x3f814e},'limit':0x1,'order':[['updatedAt','DESC']]}]}]})[_0xa770('0x1b')](handleEntityNotFound(_0x1e40f6,null))[_0xa770('0x1b')](function(_0x4aa09c){if(_0x4aa09c&&_0x4aa09c['List']){_0x5d9458=_0x4aa09c['get']({'plain':!![]});if(_0x5d9458['List']&&_0x5d9458[_0xa770('0xc5')][_0xa770('0x97')]['length']){return _0x5d9458[_0xa770('0xc5')][_0xa770('0x97')][0x0];}return db[_0xa770('0x72')][_0xa770('0x53')](_['defaults'](_0x43303c[_0xa770('0x54')],{'firstName':_0x3f814e,'mobile':_0x3f814e,'phone':_0x3f814e,'ListId':_0x5d9458[_0xa770('0x96')]}));}})[_0xa770('0x1b')](handleEntityNotFound(_0x1e40f6,null))[_0xa770('0x1b')](function(_0x3152b4){if(_0x3152b4){_0x1b53a3=_0x3152b4;return db[_0xa770('0x9c')][_0xa770('0x52')]({'where':{'ContactId':_0x1b53a3['id'],'closed':![],'SmsAccountId':_0x5d9458['id']}})[_0xa770('0x1b')](function(_0x18557a){if(_0x18557a){return[_0x18557a,![]];}return db[_0xa770('0x9c')][_0xa770('0x53')]({'UserId':_0x43303c[_0xa770('0x55')]['id'],'ContactId':_0x1b53a3['id'],'SmsAccountId':_0x5d9458['id'],'phone':_0x3f814e,'firstMsgDirection':'out','Messages':[_['merge'](_0x43303c['body'],{'read':![],'body':_0x43303c[_0xa770('0x54')][_0xa770('0x54')],'phone':_0x3f814e,'SmsAccountId':_0x5d9458['id'],'UserId':_0x43303c[_0xa770('0x55')]['id'],'ContactId':_0x1b53a3['id']})]},{'include':[{'model':db['SmsMessage'],'as':'Messages'}]})['then'](function(_0x2c3b61){return[_0x2c3b61,!![]];});});}})[_0xa770('0xc6')](function(_0x1993cc,_0x5f47fc){if(_0x5f47fc){return _0x1993cc;}return db[_0xa770('0xa3')][_0xa770('0x53')](_[_0xa770('0x49')](_0x43303c[_0xa770('0x54')],{'read':![],'body':_0x43303c[_0xa770('0x54')][_0xa770('0x54')],'phone':_0x3f814e,'SmsAccountId':_0x5d9458['id'],'SmsInteractionId':_0x1993cc['id'],'UserId':_0x43303c[_0xa770('0x55')]['id'],'ContactId':_0x1b53a3['id']}))[_0xa770('0x1b')](function(_0x2f5887){_0x1993cc[_0xa770('0xc7')]['Messages']=[];_0x1993cc['dataValues'][_0xa770('0xc8')]['push'](_0x2f5887[_0xa770('0xc7')]);return _0x1993cc;});})['then'](respondWithResult(_0x1e40f6,null))[_0xa770('0x24')](handleError(_0x1e40f6,null));};exports[_0xa770('0x27')]=function(_0x466004,_0x2bd734,_0x56922f){if(_0x466004['body']['id']){delete _0x466004[_0xa770('0x54')]['id'];}var _0x3ddfbb,_0x231acb,_0x3f7562;return db['SmsAccount']['find']({'where':{'id':_0x466004[_0xa770('0x50')]['id']}})[_0xa770('0x1b')](handleEntityNotFound(_0x2bd734,null))[_0xa770('0x1b')](function(_0x216e2c){if(_0x216e2c){_0x3f7562=_0x216e2c;logger[_0xa770('0xb0')](_0xa770('0x1e'),_0xa770('0x27'),_0xa770('0xc9'),_0x216e2c[_0xa770('0x7b')],util['inspect'](_0x466004['body'],{'showHidden':![],'depth':null}));switch(_0x216e2c[_0xa770('0x7b')]){case _0xa770('0x81'):if(_0x466004[_0xa770('0x54')][_0xa770('0xca')]&&_0x466004[_0xa770('0x54')][_0xa770('0x27')]){_0x231acb=_0x466004['body'][_0xa770('0x27')];return db['SmsMessage'][_0xa770('0x52')]({'where':{'messageId':_0x466004['body']['skebby_dispatch_id']}});}break;case'connectel':if(_0x466004['body'][_0xa770('0xcb')]&&_0x466004['body'][_0xa770('0xcc')]){_0x231acb=_0x466004['body'][_0xa770('0xcc')];return db['SmsMessage'][_0xa770('0x52')]({'where':{'messageId':_0x466004[_0xa770('0x54')][_0xa770('0xcb')]}});}break;case _0xa770('0x86'):if(_0x466004[_0xa770('0x54')]['message_id']&&_0x466004[_0xa770('0x54')][_0xa770('0xcd')]){_0x231acb=_0x466004[_0xa770('0x54')][_0xa770('0xcd')];return db[_0xa770('0xa3')][_0xa770('0x52')]({'where':{'messageId':_0x466004['body'][_0xa770('0xce')]}});}break;case _0xa770('0x88'):var _0x82f656=_0x466004[_0xa770('0x54')][_0xa770('0x89')][0x0];if(_0x82f656[_0xa770('0x7f')]&&_0x82f656[_0xa770('0x27')][_0xa770('0xcf')]==='DELIVERED'){_0x231acb=_0x82f656[_0xa770('0x27')][_0xa770('0xcf')];return db[_0xa770('0xa3')][_0xa770('0x52')]({'where':{'messageId':_0x82f656[_0xa770('0x7f')]}});}break;case _0xa770('0xd0'):if(_0x466004[_0xa770('0x54')][_0xa770('0x7f')]&&_0x466004[_0xa770('0x54')][_0xa770('0x27')]){_0x231acb=_0x466004[_0xa770('0x54')][_0xa770('0x27')];return db['SmsMessage']['find']({'where':{'messageId':_0x466004[_0xa770('0x54')][_0xa770('0x7f')]}});}break;case _0xa770('0xd1'):if(_0x466004['body'][0x0][_0xa770('0x21')]['id']){_0x231acb=_0x466004[_0xa770('0x54')][0x0][_0xa770('0x7b')];return db[_0xa770('0xa3')][_0xa770('0x52')]({'where':{'messageId':_0x466004['body'][0x0]['message']['id']}});}break;case _0xa770('0x8e'):if(_0x466004[_0xa770('0x54')]['redif']&&_0x466004[_0xa770('0x54')][_0xa770('0x27')]){_0x231acb=_0x466004[_0xa770('0x54')]['status'];return db['SmsMessage'][_0xa770('0x52')]({'where':{'messageId':_0x466004[_0xa770('0x54')][_0xa770('0xd2')]}});}break;}}})[_0xa770('0x1b')](handleEntityNotFound(_0x2bd734,null))[_0xa770('0x1b')](function(_0x52f639){if(_0x52f639){_0x3ddfbb=_0x52f639;switch(_0x3f7562['type']){case _0xa770('0x81'):if(_0x231acb===_0xa770('0xd3')){return _0x3ddfbb[_0xa770('0xd4')]({'read':!![]});}else{logger[_0xa770('0x20')](_0xa770('0x1e'),_0xa770('0x27'),_0xa770('0x81'),util[_0xa770('0xd5')](_0x466004[_0xa770('0x54')],{'showHidden':![],'depth':null}));}break;case _0xa770('0x85'):if(_0x231acb==='1'){return _0x3ddfbb['update']({'read':!![]});}else{logger[_0xa770('0x20')](_0xa770('0x1e'),_0xa770('0x27'),'skebby',util['inspect'](_0x466004[_0xa770('0x54')],{'showHidden':![],'depth':null}));}break;case _0xa770('0x86'):if(!_0x466004['body'][_0xa770('0xd6')]&&_0x231acb>=0xc8&&_0x231acb<=0xce){return _0x3ddfbb['update']({'read':!![]});}else{logger['error'](_0xa770('0x1e'),_0xa770('0x27'),_0xa770('0x86'),util[_0xa770('0xd5')](_0x466004[_0xa770('0x54')],{'showHidden':![],'depth':null}));}break;case _0xa770('0x88'):var _0x4c873e=_0x466004[_0xa770('0x54')]['results'][0x0];if(_0x4c873e['status']['groupName']===_0xa770('0xd3')){return _0x3ddfbb['update']({'read':!![]});}else{logger[_0xa770('0x20')](_0xa770('0x1e'),_0xa770('0x27'),'infobip',util[_0xa770('0xd5')](_0x466004[_0xa770('0x54')],{'showHidden':![],'depth':null}));}break;case _0xa770('0xd0'):if(_0x231acb==_0xa770('0xd7')||_0x231acb==_0xa770('0xd8')){return _0x3ddfbb[_0xa770('0xd4')]({'read':!![]});}else{logger[_0xa770('0x20')](_0xa770('0x1e'),_0xa770('0x27'),_0xa770('0xd0'),util[_0xa770('0xd5')](_0x466004[_0xa770('0x54')],{'showHidden':![],'depth':null}));}break;case _0xa770('0xd1'):if(_0x231acb==_0xa770('0xd9')){return _0x3ddfbb[_0xa770('0xd4')]({'read':!![]});}else{logger[_0xa770('0x20')](_0xa770('0x1e'),'status',_0xa770('0xd1'),util[_0xa770('0xd5')](_0x466004[_0xa770('0x54')],{'showHidden':![],'depth':null}));}break;case _0xa770('0x8e'):if(_0x231acb===_0xa770('0xda')||_0x231acb===_0xa770('0xdb')){return _0x3ddfbb[_0xa770('0xd4')]({'read':!![]});}else{logger[_0xa770('0x20')](_0xa770('0x1e'),'status','intelepeer',util[_0xa770('0xd5')](_0x466004[_0xa770('0x54')],{'showHidden':![],'depth':null}));}break;}return _0x3ddfbb;}})[_0xa770('0x1b')](respondWithResult(_0x2bd734,null))[_0xa770('0x24')](handleError(_0x2bd734,null));};exports[_0xa770('0xdc')]=function(_0x8a42d4,_0x2151c6,_0x339f7b){var _0x564512,_0x2bfac9,_0x559bd2;return db['SmsAccount']['find']({'where':{'id':_0x8a42d4[_0xa770('0x50')]['id']}})['then'](handleEntityNotFound(_0x2151c6,null))[_0xa770('0x1b')](function(_0x566018){if(_0x566018){_0x559bd2=_0x566018;logger['debug'](_0xa770('0x1e'),_0xa770('0x27'),_0xa770('0xc9'),_0x566018['type'],util[_0xa770('0xd5')](_0x8a42d4[_0xa770('0x3c')],{'showHidden':![],'depth':null}));switch(_0x566018[_0xa770('0x7b')]){case _0xa770('0xdd'):if(_0x8a42d4['query'][_0xa770('0xde')]&&_0x8a42d4[_0xa770('0x3c')]['state']){_0x2bfac9=_0x8a42d4[_0xa770('0x3c')]['state'];return db['SmsMessage']['find']({'where':{'messageId':_0x8a42d4[_0xa770('0x3c')]['message-id']}});}break;}}})[_0xa770('0x1b')](handleEntityNotFound(_0x2151c6,null))[_0xa770('0x1b')](function(_0x49c735){if(_0x49c735){_0x564512=_0x49c735;switch(_0x559bd2[_0xa770('0x7b')]){case _0xa770('0xdd'):if(_0x2bfac9==='2'||_0x2bfac9==='6'){return _0x564512[_0xa770('0xd4')]({'read':!![]});}else{logger[_0xa770('0x20')](_0xa770('0x1e'),'status',_0xa770('0xdd'),util['inspect'](_0x8a42d4[_0xa770('0x3c')],{'showHidden':![],'depth':null}));};break;}return _0x564512;}})['then'](respondWithResult(_0x2151c6,null))[_0xa770('0x24')](handleError(_0x2151c6,null));};exports[_0xa770('0xdf')]=function(_0x57a35e,_0x5ae0ea,_0x53539a){return db['SmsAccount']['find']({'where':{'id':_0x57a35e['params']['id']}})['then'](handleEntityNotFound(_0x5ae0ea,null))['then'](function(_0x39388f){if(_0x39388f){return _0x39388f[_0xa770('0xdf')](_0x57a35e[_0xa770('0x54')][_0xa770('0x65')],_[_0xa770('0x99')](_0x57a35e['body'],[_0xa770('0x65'),'id'])||{})['spread'](function(_0x223aa8){for(var _0x5b719f=0x0;_0x5b719f<_0x57a35e['body'][_0xa770('0x65')]['length'];_0x5b719f+=0x1){socket[_0xa770('0xe0')](_0xa770('0xe1'),{'UserId':Number(_0x57a35e['body']['ids'][_0x5b719f]),'SmsAccountId':Number(_0x57a35e[_0xa770('0x50')]['id'])});}return _0x223aa8;});}})['then'](respondWithResult(_0x5ae0ea,null))['catch'](handleError(_0x5ae0ea,null));};exports[_0xa770('0xe2')]=function(_0x1008ae,_0x1f216f,_0x5cfb20){return db[_0xa770('0x4a')][_0xa770('0x52')]({'where':{'id':_0x1008ae['params']['id']}})[_0xa770('0x1b')](handleEntityNotFound(_0x1f216f,null))[_0xa770('0x1b')](function(_0x46b6c7){if(_0x46b6c7){return _0x46b6c7[_0xa770('0xe2')](_0x1008ae['query'][_0xa770('0x65')])[_0xa770('0x1b')](function(){if(_[_0xa770('0xe3')](_0x1008ae[_0xa770('0x3c')][_0xa770('0x65')])){for(var _0x696944=0x0;_0x696944<_0x1008ae[_0xa770('0x3c')][_0xa770('0x65')]['length'];_0x696944+=0x1){socket['emit'](_0xa770('0xe4'),{'UserId':Number(_0x1008ae['query'][_0xa770('0x65')][_0x696944]),'SmsAccountId':Number(_0x1008ae['params']['id'])});}}else{socket[_0xa770('0xe0')](_0xa770('0xe4'),{'UserId':Number(_0x1008ae[_0xa770('0x3c')][_0xa770('0x65')]),'SmsAccountId':Number(_0x1008ae[_0xa770('0x50')]['id'])});}});}})[_0xa770('0x1b')](respondWithStatusCode(_0x1f216f,null))[_0xa770('0x24')](handleError(_0x1f216f,null));};exports[_0xa770('0xe5')]=function(_0x5c7a19,_0x581681,_0x4f0fcf){var _0x55e298={};var _0x4d1b5c={};var _0x360718;var _0x111697;return db[_0xa770('0x4a')][_0xa770('0x5e')]({'where':{'id':_0x5c7a19[_0xa770('0x50')]['id']}})['then'](handleEntityNotFound(_0x581681,null))[_0xa770('0x1b')](function(_0x34ea28){if(_0x34ea28){_0x360718=_0x34ea28;_0x4d1b5c[_0xa770('0x3b')]=_[_0xa770('0x3d')](db[_0xa770('0xa7')][_0xa770('0x60')]);_0x4d1b5c[_0xa770('0x3c')]=_[_0xa770('0x3d')](_0x5c7a19[_0xa770('0x3c')]);_0x4d1b5c[_0xa770('0x3e')]=_[_0xa770('0x3f')](_0x4d1b5c[_0xa770('0x3b')],_0x4d1b5c[_0xa770('0x3c')]);_0x55e298[_0xa770('0x40')]=_[_0xa770('0x3f')](_0x4d1b5c[_0xa770('0x3b')],qs[_0xa770('0x41')](_0x5c7a19[_0xa770('0x3c')][_0xa770('0x41')]));_0x55e298[_0xa770('0x40')]=_0x55e298[_0xa770('0x40')][_0xa770('0x42')]?_0x55e298[_0xa770('0x40')]:_0x4d1b5c[_0xa770('0x3b')];_0x55e298[_0xa770('0x61')]=qs[_0xa770('0x45')](_0x5c7a19[_0xa770('0x3c')]['sort']);_0x55e298[_0xa770('0x46')]=qs[_0xa770('0x3e')](_[_0xa770('0x62')](_0x5c7a19[_0xa770('0x3c')],_0x4d1b5c[_0xa770('0x3e')]));if(_0x5c7a19[_0xa770('0x3c')][_0xa770('0x47')]){_0x55e298['where']=_[_0xa770('0x49')](_0x55e298[_0xa770('0x46')],{'$or':_['map'](_0x55e298['attributes'],function(_0x11522f){var _0x3c3fba={};_0x3c3fba[_0x11522f]={'$like':'%'+_0x5c7a19['query'][_0xa770('0x47')]+'%'};return _0x3c3fba;})});}_0x55e298=_[_0xa770('0x49')]({},_0x55e298,_0x5c7a19['options']);return _0x360718[_0xa770('0xe5')](_0x55e298);}})[_0xa770('0x1b')](function(_0x4a6cb3){if(_0x4a6cb3){_0x111697=_0x4a6cb3[_0xa770('0x42')];if(!_0x5c7a19[_0xa770('0x3c')][_0xa770('0x43')](_0xa770('0x44'))){_0x55e298['limit']=qs[_0xa770('0x2a')](_0x5c7a19[_0xa770('0x3c')][_0xa770('0x2a')]);_0x55e298[_0xa770('0x2c')]=qs[_0xa770('0x2c')](_0x5c7a19[_0xa770('0x3c')][_0xa770('0x2c')]);}return _0x360718[_0xa770('0xe5')](_0x55e298);}})[_0xa770('0x1b')](function(_0x242119){if(_0x242119){return _0x242119?{'count':_0x111697,'rows':_0x242119}:null;}})['then'](respondWithResult(_0x581681,null))['catch'](handleError(_0x581681,null));}; \ No newline at end of file diff --git a/server/api/smsAccount/smsAccount.events.js b/server/api/smsAccount/smsAccount.events.js index 0da4914..3044145 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 _0xeb64=['setMaxListeners','save','update','remove','emit','hasOwnProperty','hook','events','../../mysqldb','SmsAccount'];(function(_0x4b1032,_0x36952e){var _0x5a1d55=function(_0x282e9b){while(--_0x282e9b){_0x4b1032['push'](_0x4b1032['shift']());}};_0x5a1d55(++_0x36952e);}(_0xeb64,0x133));var _0x4eb6=function(_0x14f674,_0x24b58d){_0x14f674=_0x14f674-0x0;var _0x60cb5d=_0xeb64[_0x14f674];return _0x60cb5d;};'use strict';var EventEmitter=require(_0x4eb6('0x0'));var SmsAccount=require(_0x4eb6('0x1'))['db'][_0x4eb6('0x2')];var SmsAccountEvents=new EventEmitter();SmsAccountEvents[_0x4eb6('0x3')](0x0);var events={'afterCreate':_0x4eb6('0x4'),'afterUpdate':_0x4eb6('0x5'),'afterDestroy':_0x4eb6('0x6')};function emitEvent(_0x523b39){return function(_0x459283,_0x4a11d1,_0x19158a){SmsAccountEvents[_0x4eb6('0x7')](_0x523b39+':'+_0x459283['id'],_0x459283);SmsAccountEvents[_0x4eb6('0x7')](_0x523b39,_0x459283);_0x19158a(null);};}for(var e in events){if(events[_0x4eb6('0x8')](e)){var event=events[e];SmsAccount[_0x4eb6('0x9')](e,emitEvent(event));}}module['exports']=SmsAccountEvents; \ No newline at end of file +var _0xe6e9=['remove','emit','hasOwnProperty','exports','../../mysqldb','SmsAccount','save','update'];(function(_0x13c3c1,_0x1b9b57){var _0x5822f1=function(_0x49255d){while(--_0x49255d){_0x13c3c1['push'](_0x13c3c1['shift']());}};_0x5822f1(++_0x1b9b57);}(_0xe6e9,0x134));var _0x9e6e=function(_0x35b532,_0x318fb6){_0x35b532=_0x35b532-0x0;var _0x2c822b=_0xe6e9[_0x35b532];return _0x2c822b;};'use strict';var EventEmitter=require('events');var SmsAccount=require(_0x9e6e('0x0'))['db'][_0x9e6e('0x1')];var SmsAccountEvents=new EventEmitter();SmsAccountEvents['setMaxListeners'](0x0);var events={'afterCreate':_0x9e6e('0x2'),'afterUpdate':_0x9e6e('0x3'),'afterDestroy':_0x9e6e('0x4')};function emitEvent(_0x469f77){return function(_0x27cfc1,_0x4dc62b,_0x4c041d){SmsAccountEvents[_0x9e6e('0x5')](_0x469f77+':'+_0x27cfc1['id'],_0x27cfc1);SmsAccountEvents[_0x9e6e('0x5')](_0x469f77,_0x27cfc1);_0x4c041d(null);};}for(var e in events){if(events[_0x9e6e('0x6')](e)){var event=events[e];SmsAccount['hook'](e,emitEvent(event));}}module[_0x9e6e('0x7')]=SmsAccountEvents; \ No newline at end of file diff --git a/server/api/smsAccount/smsAccount.model.js b/server/api/smsAccount/smsAccount.model.js index f9fc885..14cc546 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 _0xd9a5=['path','rimraf','../../config/environment','./smsAccount.attributes','exports','define','SmsAccount','sms_accounts','lodash','../../config/logger','moment','bluebird'];(function(_0x3dd15e,_0x1f0015){var _0x231fd0=function(_0x4f680a){while(--_0x4f680a){_0x3dd15e['push'](_0x3dd15e['shift']());}};_0x231fd0(++_0x1f0015);}(_0xd9a5,0x140));var _0x5d9a=function(_0x38d6f8,_0x36557c){_0x38d6f8=_0x38d6f8-0x0;var _0x3d54fd=_0xd9a5[_0x38d6f8];return _0x3d54fd;};'use strict';var _=require(_0x5d9a('0x0'));var util=require('util');var logger=require(_0x5d9a('0x1'))('api');var moment=require(_0x5d9a('0x2'));var BPromise=require(_0x5d9a('0x3'));var rp=require('request-promise');var fs=require('fs');var path=require(_0x5d9a('0x4'));var rimraf=require(_0x5d9a('0x5'));var config=require(_0x5d9a('0x6'));var attributes=require(_0x5d9a('0x7'));module[_0x5d9a('0x8')]=function(_0x130c9a,_0x504d17){return _0x130c9a[_0x5d9a('0x9')](_0x5d9a('0xa'),attributes,{'tableName':_0x5d9a('0xb'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x910e=['api','moment','bluebird','path','rimraf','./smsAccount.attributes','exports','define','SmsAccount','sms_accounts','lodash','util','../../config/logger'];(function(_0x583bf0,_0x4b59aa){var _0x210ec6=function(_0x3a7abb){while(--_0x3a7abb){_0x583bf0['push'](_0x583bf0['shift']());}};_0x210ec6(++_0x4b59aa);}(_0x910e,0x128));var _0xe910=function(_0x36e4d2,_0x4f839b){_0x36e4d2=_0x36e4d2-0x0;var _0x52e92d=_0x910e[_0x36e4d2];return _0x52e92d;};'use strict';var _=require(_0xe910('0x0'));var util=require(_0xe910('0x1'));var logger=require(_0xe910('0x2'))(_0xe910('0x3'));var moment=require(_0xe910('0x4'));var BPromise=require(_0xe910('0x5'));var rp=require('request-promise');var fs=require('fs');var path=require(_0xe910('0x6'));var rimraf=require(_0xe910('0x7'));var config=require('../../config/environment');var attributes=require(_0xe910('0x8'));module[_0xe910('0x9')]=function(_0xdddbf,_0x587f5d){return _0xdddbf[_0xe910('0xa')](_0xe910('0xb'),attributes,{'tableName':_0xe910('0xc'),'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 2253685..1ce42fa 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 _0xa758=['error','code','message','result','catch','find','options','where','attributes','include','model','map','ShowSmsAccount','lodash','util','moment','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','client','http','redis','defaults','localhost','socket.io-emitter','./smsAccount.socket','register','then','info','SmsAccount,\x20%s,\x20%s','request\x20sent','debug','SmsAccount,\x20%s,\x20%s,\x20%s','stringify'];(function(_0x139a3c,_0x4fc883){var _0x2b375b=function(_0x525dbf){while(--_0x525dbf){_0x139a3c['push'](_0x139a3c['shift']());}};_0x2b375b(++_0x4fc883);}(_0xa758,0xcb));var _0x8a75=function(_0x260b34,_0x225d94){_0x260b34=_0x260b34-0x0;var _0x1ceaca=_0xa758[_0x260b34];return _0x1ceaca;};'use strict';var _=require(_0x8a75('0x0'));var util=require(_0x8a75('0x1'));var moment=require(_0x8a75('0x2'));var BPromise=require('bluebird');var rs=require('randomstring');var fs=require('fs');var Redis=require(_0x8a75('0x3'));var db=require(_0x8a75('0x4'))['db'];var utils=require(_0x8a75('0x5'));var logger=require(_0x8a75('0x6'))(_0x8a75('0x7'));var config=require(_0x8a75('0x8'));var jayson=require(_0x8a75('0x9'));var client=jayson[_0x8a75('0xa')][_0x8a75('0xb')]({'port':0x232a});config[_0x8a75('0xc')]=_[_0x8a75('0xd')](config[_0x8a75('0xc')],{'host':_0x8a75('0xe'),'port':0x18eb});var socket=require(_0x8a75('0xf'))(new Redis(config['redis']));require(_0x8a75('0x10'))[_0x8a75('0x11')](socket);function respondWithRpcPromise(_0x4dbdf8,_0x773c73,_0x3ed1ae){return new BPromise(function(_0xa351f6,_0x4ec5cc){return client['request'](_0x4dbdf8,_0x3ed1ae)[_0x8a75('0x12')](function(_0x48a6a2){logger[_0x8a75('0x13')](_0x8a75('0x14'),_0x773c73,_0x8a75('0x15'));logger[_0x8a75('0x16')](_0x8a75('0x17'),_0x773c73,_0x8a75('0x15'),JSON[_0x8a75('0x18')](_0x48a6a2));if(_0x48a6a2[_0x8a75('0x19')]){if(_0x48a6a2[_0x8a75('0x19')][_0x8a75('0x1a')]===0x1f4){logger[_0x8a75('0x19')](_0x8a75('0x14'),_0x773c73,_0x48a6a2['error'][_0x8a75('0x1b')]);return _0x4ec5cc(_0x48a6a2['error']['message']);}logger[_0x8a75('0x19')](_0x8a75('0x14'),_0x773c73,_0x48a6a2[_0x8a75('0x19')][_0x8a75('0x1b')]);return _0xa351f6(_0x48a6a2[_0x8a75('0x19')]['message']);}else{logger[_0x8a75('0x13')](_0x8a75('0x14'),_0x773c73,_0x8a75('0x15'));_0xa351f6(_0x48a6a2[_0x8a75('0x1c')]['message']);}})[_0x8a75('0x1d')](function(_0xd7c9aa){logger[_0x8a75('0x19')](_0x8a75('0x14'),_0x773c73,_0xd7c9aa);_0x4ec5cc(_0xd7c9aa);});});}exports['ShowSmsAccount']=function(_0x201fec){var _0x2b21b6=this;return new Promise(function(_0x3e3d12,_0x331267){return db['SmsAccount'][_0x8a75('0x1e')]({'raw':_0x201fec['options']?_0x201fec['options']['raw']===undefined?!![]:![]:!![],'where':_0x201fec[_0x8a75('0x1f')]?_0x201fec[_0x8a75('0x1f')][_0x8a75('0x20')]||null:null,'attributes':_0x201fec[_0x8a75('0x1f')]?_0x201fec[_0x8a75('0x1f')][_0x8a75('0x21')]||null:null,'include':_0x201fec[_0x8a75('0x1f')]?_0x201fec[_0x8a75('0x1f')][_0x8a75('0x22')]?_['map'](_0x201fec[_0x8a75('0x1f')][_0x8a75('0x22')],function(_0x5c4da1){return{'model':db[_0x5c4da1[_0x8a75('0x23')]],'as':_0x5c4da1['as'],'attributes':_0x5c4da1['attributes'],'include':_0x5c4da1['include']?_['map'](_0x5c4da1[_0x8a75('0x22')],function(_0xfd8c25){return{'model':db[_0xfd8c25[_0x8a75('0x23')]],'as':_0xfd8c25['as'],'attributes':_0xfd8c25[_0x8a75('0x21')],'include':_0xfd8c25[_0x8a75('0x22')]?_[_0x8a75('0x24')](_0xfd8c25[_0x8a75('0x22')],function(_0x4a99fd){return{'model':db[_0x4a99fd[_0x8a75('0x23')]],'as':_0x4a99fd['as'],'attributes':_0x4a99fd[_0x8a75('0x21')]};}):[]};}):[]};}):[]:[]})['then'](function(_0xbc954b){logger['info'](_0x8a75('0x25'),_0x201fec);logger['debug'](_0x8a75('0x25'),_0x201fec,JSON['stringify'](_0xbc954b));_0x3e3d12(_0xbc954b);})[_0x8a75('0x1d')](function(_0x2d08c8){logger['error']('ShowSmsAccount',_0x2d08c8[_0x8a75('0x1b')],_0x201fec);_0x331267(_0x2b21b6[_0x8a75('0x19')](0x1f4,_0x2d08c8['message']));});});}; \ No newline at end of file +var _0x2f35=['catch','SmsAccount','find','options','raw','attributes','include','map','model','ShowSmsAccount','util','moment','bluebird','randomstring','../../mysqldb','../../config/logger','rpc','../../config/environment','jayson/promise','client','http','redis','defaults','localhost','socket.io-emitter','./smsAccount.socket','register','request','then','info','request\x20sent','debug','stringify','error','SmsAccount,\x20%s,\x20%s','message'];(function(_0x10acb4,_0x2d4e4a){var _0x3b5665=function(_0xb788a3){while(--_0xb788a3){_0x10acb4['push'](_0x10acb4['shift']());}};_0x3b5665(++_0x2d4e4a);}(_0x2f35,0x1de));var _0x52f3=function(_0x58f65e,_0x467d61){_0x58f65e=_0x58f65e-0x0;var _0x35684b=_0x2f35[_0x58f65e];return _0x35684b;};'use strict';var _=require('lodash');var util=require(_0x52f3('0x0'));var moment=require(_0x52f3('0x1'));var BPromise=require(_0x52f3('0x2'));var rs=require(_0x52f3('0x3'));var fs=require('fs');var Redis=require('ioredis');var db=require(_0x52f3('0x4'))['db'];var utils=require('../../config/utils');var logger=require(_0x52f3('0x5'))(_0x52f3('0x6'));var config=require(_0x52f3('0x7'));var jayson=require(_0x52f3('0x8'));var client=jayson[_0x52f3('0x9')][_0x52f3('0xa')]({'port':0x232a});config[_0x52f3('0xb')]=_[_0x52f3('0xc')](config[_0x52f3('0xb')],{'host':_0x52f3('0xd'),'port':0x18eb});var socket=require(_0x52f3('0xe'))(new Redis(config[_0x52f3('0xb')]));require(_0x52f3('0xf'))[_0x52f3('0x10')](socket);function respondWithRpcPromise(_0x29c877,_0x59007c,_0x50a052){return new BPromise(function(_0x407dd5,_0x472c11){return client[_0x52f3('0x11')](_0x29c877,_0x50a052)[_0x52f3('0x12')](function(_0x34e023){logger[_0x52f3('0x13')]('SmsAccount,\x20%s,\x20%s',_0x59007c,_0x52f3('0x14'));logger[_0x52f3('0x15')]('SmsAccount,\x20%s,\x20%s,\x20%s',_0x59007c,'request\x20sent',JSON[_0x52f3('0x16')](_0x34e023));if(_0x34e023[_0x52f3('0x17')]){if(_0x34e023[_0x52f3('0x17')]['code']===0x1f4){logger[_0x52f3('0x17')](_0x52f3('0x18'),_0x59007c,_0x34e023[_0x52f3('0x17')]['message']);return _0x472c11(_0x34e023['error'][_0x52f3('0x19')]);}logger[_0x52f3('0x17')](_0x52f3('0x18'),_0x59007c,_0x34e023[_0x52f3('0x17')][_0x52f3('0x19')]);return _0x407dd5(_0x34e023['error'][_0x52f3('0x19')]);}else{logger['info']('SmsAccount,\x20%s,\x20%s',_0x59007c,_0x52f3('0x14'));_0x407dd5(_0x34e023['result'][_0x52f3('0x19')]);}})[_0x52f3('0x1a')](function(_0x9c9c26){logger[_0x52f3('0x17')](_0x52f3('0x18'),_0x59007c,_0x9c9c26);_0x472c11(_0x9c9c26);});});}exports['ShowSmsAccount']=function(_0xd9cc91){var _0x36d210=this;return new Promise(function(_0x110998,_0x1d26d6){return db[_0x52f3('0x1b')][_0x52f3('0x1c')]({'raw':_0xd9cc91[_0x52f3('0x1d')]?_0xd9cc91['options'][_0x52f3('0x1e')]===undefined?!![]:![]:!![],'where':_0xd9cc91[_0x52f3('0x1d')]?_0xd9cc91[_0x52f3('0x1d')]['where']||null:null,'attributes':_0xd9cc91[_0x52f3('0x1d')]?_0xd9cc91[_0x52f3('0x1d')][_0x52f3('0x1f')]||null:null,'include':_0xd9cc91[_0x52f3('0x1d')]?_0xd9cc91['options'][_0x52f3('0x20')]?_[_0x52f3('0x21')](_0xd9cc91[_0x52f3('0x1d')][_0x52f3('0x20')],function(_0x3c5e92){return{'model':db[_0x3c5e92[_0x52f3('0x22')]],'as':_0x3c5e92['as'],'attributes':_0x3c5e92['attributes'],'include':_0x3c5e92[_0x52f3('0x20')]?_[_0x52f3('0x21')](_0x3c5e92[_0x52f3('0x20')],function(_0x1bf1b7){return{'model':db[_0x1bf1b7[_0x52f3('0x22')]],'as':_0x1bf1b7['as'],'attributes':_0x1bf1b7[_0x52f3('0x1f')],'include':_0x1bf1b7[_0x52f3('0x20')]?_[_0x52f3('0x21')](_0x1bf1b7[_0x52f3('0x20')],function(_0x6baca0){return{'model':db[_0x6baca0['model']],'as':_0x6baca0['as'],'attributes':_0x6baca0[_0x52f3('0x1f')]};}):[]};}):[]};}):[]:[]})['then'](function(_0x115331){logger[_0x52f3('0x13')](_0x52f3('0x23'),_0xd9cc91);logger['debug'](_0x52f3('0x23'),_0xd9cc91,JSON['stringify'](_0x115331));_0x110998(_0x115331);})[_0x52f3('0x1a')](function(_0x7fe758){logger[_0x52f3('0x17')]('ShowSmsAccount',_0x7fe758[_0x52f3('0x19')],_0xd9cc91);_0x1d26d6(_0x36d210[_0x52f3('0x17')](0x1f4,_0x7fe758[_0x52f3('0x19')]));});});}; \ No newline at end of file diff --git a/server/api/smsAccount/smsAccount.socket.js b/server/api/smsAccount/smsAccount.socket.js index 435eac1..57677d8 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(_0x57b54c,_0x54ce0d){var _0x59cc19=function(_0xa33bc6){while(--_0xa33bc6){_0x57b54c['push'](_0x57b54c['shift']());}};_0x59cc19(++_0x54ce0d);}(_0xa9e0,0x123));var _0x0a9e=function(_0x5c3c0b,_0x4ee35e){_0x5c3c0b=_0x5c3c0b-0x0;var _0x52ecd2=_0xa9e0[_0x5c3c0b];return _0x52ecd2;};'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(_0x4a9fb1,_0x273043){var _0x348672=function(_0x142b69){while(--_0x142b69){_0x4a9fb1['push'](_0x4a9fb1['shift']());}};_0x348672(++_0x273043);}(_0xa9e0,0x123));var _0x0a9e=function(_0xbe200f,_0x4b50eb){_0xbe200f=_0xbe200f-0x0;var _0x192597=_0xa9e0[_0xbe200f];return _0x192597;};'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 26f40ed..63c3aec 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(_0x4afb4e,_0x1eba32){var _0x2e0475=function(_0x25c361){while(--_0x25c361){_0x4afb4e['push'](_0x4afb4e['shift']());}};_0x2e0475(++_0x1eba32);}(_0x008c,0x188));var _0xc008=function(_0x1155e6,_0x233e73){_0x1155e6=_0x1155e6-0x0;var _0x35dd79=_0x008c[_0x1155e6];return _0x35dd79;};'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 _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(_0x3acce6,_0x5b6da7){var _0x3c7ae1=function(_0x323c3b){while(--_0x323c3b){_0x3acce6['push'](_0x3acce6['shift']());}};_0x3c7ae1(++_0x5b6da7);}(_0x008c,0x188));var _0xc008=function(_0x5f49a2,_0x54b7ed){_0x5f49a2=_0x5f49a2-0x0;var _0x2e49ac=_0x008c[_0x5f49a2];return _0x2e49ac;};'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 diff --git a/server/api/smsApplication/smsApplication.attributes.js b/server/api/smsApplication/smsApplication.attributes.js index a03b686..eb5efa8 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 _0x5be3=['STRING','noop','*,*,*,*','sequelize','exports'];(function(_0xc9cbaa,_0x7431fc){var _0x42efa0=function(_0x8751bb){while(--_0x8751bb){_0xc9cbaa['push'](_0xc9cbaa['shift']());}};_0x42efa0(++_0x7431fc);}(_0x5be3,0x175));var _0x35be=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0x5be3[_0x3dd15e];return _0x231fd0;};'use strict';var Sequelize=require(_0x35be('0x0'));module[_0x35be('0x1')]={'priority':{'type':Sequelize['INTEGER'],'allowNull':![]},'app':{'type':Sequelize[_0x35be('0x2')],'allowNull':![],'defaultValue':_0x35be('0x3')},'appdata':{'type':Sequelize['TEXT']()},'description':{'type':Sequelize[_0x35be('0x2')]},'interval':{'type':Sequelize[_0x35be('0x2')],'defaultValue':_0x35be('0x4')}}; \ No newline at end of file +var _0x5d77=['noop','TEXT','sequelize','STRING'];(function(_0x45b47b,_0x3be73d){var _0x52c63d=function(_0x2007f6){while(--_0x2007f6){_0x45b47b['push'](_0x45b47b['shift']());}};_0x52c63d(++_0x3be73d);}(_0x5d77,0x19e));var _0x75d7=function(_0x217c86,_0x97c004){_0x217c86=_0x217c86-0x0;var _0x32284d=_0x5d77[_0x217c86];return _0x32284d;};'use strict';var Sequelize=require(_0x75d7('0x0'));module['exports']={'priority':{'type':Sequelize['INTEGER'],'allowNull':![]},'app':{'type':Sequelize[_0x75d7('0x1')],'allowNull':![],'defaultValue':_0x75d7('0x2')},'appdata':{'type':Sequelize[_0x75d7('0x3')]()},'description':{'type':Sequelize['STRING']},'interval':{'type':Sequelize[_0x75d7('0x1')],'defaultValue':'*,*,*,*'}}; \ No newline at end of file diff --git a/server/api/smsApplication/smsApplication.controller.js b/server/api/smsApplication/smsApplication.controller.js index 20dc352..0180d5a 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 _0xee71=['index','SmsApplication','fieldName','type','key','model','map','query','keys','filters','attributes','fields','length','hasOwnProperty','nolimit','order','sort','where','filter','merge','VIRTUAL','options','includeAll','include','rows','catch','show','params','rawAttributes','intersection','find','create','body','eml-format','rimraf','zip-dir','request-promise','path','sox','to-csv','ejs','fs-extra','lodash','squel','jsforce','desk.js','querystring','papaparse','../../components/auth/service','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/environment','../../config/license/util','../../mysqldb','sendStatus','status','end','json','offset','undefined','limit','count','set','apply','reject','save','update','then','destroy','error','stack','name','send'];(function(_0xc912d,_0x38c2be){var _0x12f9e3=function(_0x3573ce){while(--_0x3573ce){_0xc912d['push'](_0xc912d['shift']());}};_0x12f9e3(++_0x38c2be);}(_0xee71,0x6a));var _0x1ee7=function(_0x42b66c,_0x3697fc){_0x42b66c=_0x42b66c-0x0;var _0x6d210e=_0xee71[_0x42b66c];return _0x6d210e;};'use strict';var emlformat=require(_0x1ee7('0x0'));var rimraf=require(_0x1ee7('0x1'));var zipdir=require(_0x1ee7('0x2'));var jsonpatch=require('fast-json-patch');var rp=require(_0x1ee7('0x3'));var moment=require('moment');var BPromise=require('bluebird');var Mustache=require('mustache');var util=require('util');var path=require(_0x1ee7('0x4'));var sox=require(_0x1ee7('0x5'));var csv=require(_0x1ee7('0x6'));var ejs=require(_0x1ee7('0x7'));var fs=require('fs');var fs_extra=require(_0x1ee7('0x8'));var _=require(_0x1ee7('0x9'));var squel=require(_0x1ee7('0xa'));var crypto=require('crypto');var jsforce=require(_0x1ee7('0xb'));var deskjs=require(_0x1ee7('0xc'));var toCsv=require(_0x1ee7('0x6'));var querystring=require(_0x1ee7('0xd'));var Papa=require(_0x1ee7('0xe'));var Redis=require('ioredis');var authService=require(_0x1ee7('0xf'));var qs=require('../../components/parsers/qs');var as=require(_0x1ee7('0x10'));var hardwareService=require(_0x1ee7('0x11'));var logger=require('../../config/logger')('api');var utils=require('../../config/utils');var config=require(_0x1ee7('0x12'));var licenseUtil=require(_0x1ee7('0x13'));var db=require(_0x1ee7('0x14'))['db'];function respondWithStatusCode(_0x35ae4b,_0x575dbb){_0x575dbb=_0x575dbb||0xcc;return function(_0x500603){if(_0x500603){return _0x35ae4b[_0x1ee7('0x15')](_0x575dbb);}return _0x35ae4b[_0x1ee7('0x16')](_0x575dbb)[_0x1ee7('0x17')]();};}function respondWithResult(_0x2a9481,_0x292718){_0x292718=_0x292718||0xc8;return function(_0x1ebb52){if(_0x1ebb52){return _0x2a9481['status'](_0x292718)[_0x1ee7('0x18')](_0x1ebb52);}};}function respondWithFilteredResult(_0x1e3fbb,_0x4ed0be){return function(_0x5a0423){if(_0x5a0423){var _0x262809=typeof _0x4ed0be[_0x1ee7('0x19')]===_0x1ee7('0x1a')&&typeof _0x4ed0be[_0x1ee7('0x1b')]===_0x1ee7('0x1a');var _0x119ef8=_0x5a0423['count'];var _0x4c712b=_0x262809?0x0:_0x4ed0be[_0x1ee7('0x19')];var _0x29e920=_0x262809?_0x5a0423[_0x1ee7('0x1c')]:_0x4ed0be[_0x1ee7('0x19')]+_0x4ed0be[_0x1ee7('0x1b')];var _0x2bf4c4;if(_0x29e920>=_0x119ef8){_0x29e920=_0x119ef8;_0x2bf4c4=0xc8;}else{_0x2bf4c4=0xce;}_0x1e3fbb['status'](_0x2bf4c4);return _0x1e3fbb[_0x1ee7('0x1d')]('Content-Range',_0x4c712b+'-'+_0x29e920+'/'+_0x119ef8)[_0x1ee7('0x18')](_0x5a0423);}return null;};}function patchUpdates(_0xe739ca){return function(_0x8e860f){try{jsonpatch[_0x1ee7('0x1e')](_0x8e860f,_0xe739ca,!![]);}catch(_0x358130){return BPromise[_0x1ee7('0x1f')](_0x358130);}return _0x8e860f[_0x1ee7('0x20')]();};}function saveUpdates(_0x4ce15e,_0x28fae0){return function(_0x5899fa){if(_0x5899fa){return _0x5899fa[_0x1ee7('0x21')](_0x4ce15e)[_0x1ee7('0x22')](function(_0x4dc225){return _0x4dc225;});}return null;};}function removeEntity(_0xb5e5c9,_0xaeaa20){return function(_0x313407){if(_0x313407){return _0x313407[_0x1ee7('0x23')]()[_0x1ee7('0x22')](function(){_0xb5e5c9[_0x1ee7('0x16')](0xcc)[_0x1ee7('0x17')]();});}};}function handleEntityNotFound(_0x3e6fbb,_0x5db183){return function(_0x561412){if(!_0x561412){_0x3e6fbb[_0x1ee7('0x15')](0x194);}return _0x561412;};}function handleError(_0x51b790,_0x1e3608){_0x1e3608=_0x1e3608||0x1f4;return function(_0x1e9c03){logger[_0x1ee7('0x24')](_0x1e9c03[_0x1ee7('0x25')]);if(_0x1e9c03[_0x1ee7('0x26')]){delete _0x1e9c03['name'];}_0x51b790['status'](_0x1e3608)[_0x1ee7('0x27')](_0x1e9c03);};}exports[_0x1ee7('0x28')]=function(_0x3b053a,_0x302a90){var _0x59b65f={},_0x76e734={},_0x355339={'count':0x0,'rows':[]};var _0x2e1729=_['map'](db[_0x1ee7('0x29')]['rawAttributes'],function(_0x2ec4c1){return{'name':_0x2ec4c1[_0x1ee7('0x2a')],'type':_0x2ec4c1[_0x1ee7('0x2b')][_0x1ee7('0x2c')]};});_0x76e734[_0x1ee7('0x2d')]=_[_0x1ee7('0x2e')](_0x2e1729,_0x1ee7('0x26'));_0x76e734[_0x1ee7('0x2f')]=_[_0x1ee7('0x30')](_0x3b053a['query']);_0x76e734[_0x1ee7('0x31')]=_['intersection'](_0x76e734[_0x1ee7('0x2d')],_0x76e734['query']);_0x59b65f[_0x1ee7('0x32')]=_['intersection'](_0x76e734[_0x1ee7('0x2d')],qs[_0x1ee7('0x33')](_0x3b053a[_0x1ee7('0x2f')][_0x1ee7('0x33')]));_0x59b65f['attributes']=_0x59b65f[_0x1ee7('0x32')][_0x1ee7('0x34')]?_0x59b65f[_0x1ee7('0x32')]:_0x76e734[_0x1ee7('0x2d')];if(!_0x3b053a['query'][_0x1ee7('0x35')](_0x1ee7('0x36'))){_0x59b65f['limit']=qs['limit'](_0x3b053a[_0x1ee7('0x2f')]['limit']);_0x59b65f['offset']=qs[_0x1ee7('0x19')](_0x3b053a[_0x1ee7('0x2f')][_0x1ee7('0x19')]);}_0x59b65f[_0x1ee7('0x37')]=qs['sort'](_0x3b053a[_0x1ee7('0x2f')][_0x1ee7('0x38')]);_0x59b65f[_0x1ee7('0x39')]=qs[_0x1ee7('0x31')](_['pick'](_0x3b053a[_0x1ee7('0x2f')],_0x76e734[_0x1ee7('0x31')]),_0x2e1729);if(_0x3b053a['query'][_0x1ee7('0x3a')]){_0x59b65f['where']=_[_0x1ee7('0x3b')](_0x59b65f[_0x1ee7('0x39')],{'$or':_[_0x1ee7('0x2e')](_0x2e1729,function(_0x1f1d1f){if(_0x1f1d1f[_0x1ee7('0x2b')]!==_0x1ee7('0x3c')){var _0xe83c68={};_0xe83c68[_0x1f1d1f[_0x1ee7('0x26')]]={'$like':'%'+_0x3b053a['query'][_0x1ee7('0x3a')]+'%'};return _0xe83c68;}})});}_0x59b65f=_[_0x1ee7('0x3b')]({},_0x59b65f,_0x3b053a[_0x1ee7('0x3d')]);var _0x34960c={'where':_0x59b65f[_0x1ee7('0x39')]};return db[_0x1ee7('0x29')][_0x1ee7('0x1c')](_0x34960c)[_0x1ee7('0x22')](function(_0x47c2fb){_0x355339[_0x1ee7('0x1c')]=_0x47c2fb;if(_0x3b053a[_0x1ee7('0x2f')][_0x1ee7('0x3e')]){_0x59b65f[_0x1ee7('0x3f')]=[{'all':!![]}];}return db[_0x1ee7('0x29')]['findAll'](_0x59b65f);})['then'](function(_0x40a041){_0x355339[_0x1ee7('0x40')]=_0x40a041;return _0x355339;})[_0x1ee7('0x22')](respondWithFilteredResult(_0x302a90,_0x59b65f))[_0x1ee7('0x41')](handleError(_0x302a90,null));};exports[_0x1ee7('0x42')]=function(_0x4b1b15,_0x269fb3){var _0x1ec30f={'raw':!![],'where':{'id':_0x4b1b15[_0x1ee7('0x43')]['id']}},_0x54823f={};_0x54823f[_0x1ee7('0x2d')]=_['keys'](db[_0x1ee7('0x29')][_0x1ee7('0x44')]);_0x54823f[_0x1ee7('0x2f')]=_[_0x1ee7('0x30')](_0x4b1b15[_0x1ee7('0x2f')]);_0x54823f['filters']=_['intersection'](_0x54823f[_0x1ee7('0x2d')],_0x54823f[_0x1ee7('0x2f')]);_0x1ec30f[_0x1ee7('0x32')]=_[_0x1ee7('0x45')](_0x54823f['model'],qs[_0x1ee7('0x33')](_0x4b1b15['query'][_0x1ee7('0x33')]));_0x1ec30f[_0x1ee7('0x32')]=_0x1ec30f[_0x1ee7('0x32')]['length']?_0x1ec30f[_0x1ee7('0x32')]:_0x54823f[_0x1ee7('0x2d')];if(_0x4b1b15[_0x1ee7('0x2f')][_0x1ee7('0x3e')]){_0x1ec30f[_0x1ee7('0x3f')]=[{'all':!![]}];}_0x1ec30f=_[_0x1ee7('0x3b')]({},_0x1ec30f,_0x4b1b15[_0x1ee7('0x3d')]);return db['SmsApplication'][_0x1ee7('0x46')](_0x1ec30f)[_0x1ee7('0x22')](handleEntityNotFound(_0x269fb3,null))[_0x1ee7('0x22')](respondWithResult(_0x269fb3,null))[_0x1ee7('0x41')](handleError(_0x269fb3,null));};exports[_0x1ee7('0x47')]=function(_0x4c0e68,_0x336606){return db[_0x1ee7('0x29')][_0x1ee7('0x47')](_0x4c0e68[_0x1ee7('0x48')],{})[_0x1ee7('0x22')](respondWithResult(_0x336606,0xc9))[_0x1ee7('0x41')](handleError(_0x336606,null));};exports[_0x1ee7('0x21')]=function(_0x2acad4,_0x20303a){if(_0x2acad4['body']['id']){delete _0x2acad4['body']['id'];}return db[_0x1ee7('0x29')][_0x1ee7('0x46')]({'where':{'id':_0x2acad4[_0x1ee7('0x43')]['id']}})[_0x1ee7('0x22')](handleEntityNotFound(_0x20303a,null))['then'](saveUpdates(_0x2acad4['body'],null))[_0x1ee7('0x22')](respondWithResult(_0x20303a,null))['catch'](handleError(_0x20303a,null));};exports[_0x1ee7('0x23')]=function(_0x224982,_0x259cb5){return db[_0x1ee7('0x29')][_0x1ee7('0x46')]({'where':{'id':_0x224982[_0x1ee7('0x43')]['id']}})['then'](handleEntityNotFound(_0x259cb5,null))[_0x1ee7('0x22')](removeEntity(_0x259cb5,null))[_0x1ee7('0x41')](handleError(_0x259cb5,null));}; \ No newline at end of file +var _0x49c4=['show','params','find','create','body','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','bluebird','mustache','path','sox','to-csv','ejs','fs-extra','lodash','squel','crypto','jsforce','desk.js','papaparse','ioredis','../../components/auth/service','../../config/license/hardware','api','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','sendStatus','status','end','undefined','count','offset','limit','set','Content-Range','apply','reject','save','update','then','destroy','error','stack','name','send','index','map','SmsApplication','rawAttributes','fieldName','type','model','keys','query','filters','intersection','attributes','fields','length','hasOwnProperty','nolimit','order','sort','where','pick','merge','VIRTUAL','filter','options','includeAll','include','findAll','catch'];(function(_0x170994,_0x5adc66){var _0x3c89a3=function(_0x53e7e1){while(--_0x53e7e1){_0x170994['push'](_0x170994['shift']());}};_0x3c89a3(++_0x5adc66);}(_0x49c4,0x18b));var _0x449c=function(_0x279d37,_0x14de3f){_0x279d37=_0x279d37-0x0;var _0x530173=_0x49c4[_0x279d37];return _0x530173;};'use strict';var emlformat=require(_0x449c('0x0'));var rimraf=require(_0x449c('0x1'));var zipdir=require(_0x449c('0x2'));var jsonpatch=require(_0x449c('0x3'));var rp=require(_0x449c('0x4'));var moment=require('moment');var BPromise=require(_0x449c('0x5'));var Mustache=require(_0x449c('0x6'));var util=require('util');var path=require(_0x449c('0x7'));var sox=require(_0x449c('0x8'));var csv=require(_0x449c('0x9'));var ejs=require(_0x449c('0xa'));var fs=require('fs');var fs_extra=require(_0x449c('0xb'));var _=require(_0x449c('0xc'));var squel=require(_0x449c('0xd'));var crypto=require(_0x449c('0xe'));var jsforce=require(_0x449c('0xf'));var deskjs=require(_0x449c('0x10'));var toCsv=require(_0x449c('0x9'));var querystring=require('querystring');var Papa=require(_0x449c('0x11'));var Redis=require(_0x449c('0x12'));var authService=require(_0x449c('0x13'));var qs=require('../../components/parsers/qs');var as=require('../../components/parsers/advancedSearch');var hardwareService=require(_0x449c('0x14'));var logger=require('../../config/logger')(_0x449c('0x15'));var utils=require(_0x449c('0x16'));var config=require(_0x449c('0x17'));var licenseUtil=require(_0x449c('0x18'));var db=require(_0x449c('0x19'))['db'];function respondWithStatusCode(_0x44ce14,_0x56023a){_0x56023a=_0x56023a||0xcc;return function(_0x4a47cf){if(_0x4a47cf){return _0x44ce14[_0x449c('0x1a')](_0x56023a);}return _0x44ce14[_0x449c('0x1b')](_0x56023a)[_0x449c('0x1c')]();};}function respondWithResult(_0x5ee55a,_0x34cf7b){_0x34cf7b=_0x34cf7b||0xc8;return function(_0x3592f9){if(_0x3592f9){return _0x5ee55a[_0x449c('0x1b')](_0x34cf7b)['json'](_0x3592f9);}};}function respondWithFilteredResult(_0x399438,_0x3e47b5){return function(_0x2c29e0){if(_0x2c29e0){var _0x2d6c62=typeof _0x3e47b5['offset']===_0x449c('0x1d')&&typeof _0x3e47b5['limit']===_0x449c('0x1d');var _0x445402=_0x2c29e0[_0x449c('0x1e')];var _0x417801=_0x2d6c62?0x0:_0x3e47b5[_0x449c('0x1f')];var _0x232bcd=_0x2d6c62?_0x2c29e0[_0x449c('0x1e')]:_0x3e47b5[_0x449c('0x1f')]+_0x3e47b5[_0x449c('0x20')];var _0x5e9190;if(_0x232bcd>=_0x445402){_0x232bcd=_0x445402;_0x5e9190=0xc8;}else{_0x5e9190=0xce;}_0x399438[_0x449c('0x1b')](_0x5e9190);return _0x399438[_0x449c('0x21')](_0x449c('0x22'),_0x417801+'-'+_0x232bcd+'/'+_0x445402)['json'](_0x2c29e0);}return null;};}function patchUpdates(_0x45b05c){return function(_0x2e1291){try{jsonpatch[_0x449c('0x23')](_0x2e1291,_0x45b05c,!![]);}catch(_0x2acc53){return BPromise[_0x449c('0x24')](_0x2acc53);}return _0x2e1291[_0x449c('0x25')]();};}function saveUpdates(_0x998901,_0x3dec58){return function(_0x2775c1){if(_0x2775c1){return _0x2775c1[_0x449c('0x26')](_0x998901)[_0x449c('0x27')](function(_0xb8700a){return _0xb8700a;});}return null;};}function removeEntity(_0x2a5416,_0x4bd697){return function(_0x30ed32){if(_0x30ed32){return _0x30ed32[_0x449c('0x28')]()[_0x449c('0x27')](function(){_0x2a5416[_0x449c('0x1b')](0xcc)[_0x449c('0x1c')]();});}};}function handleEntityNotFound(_0x2df076,_0x5c201a){return function(_0x570122){if(!_0x570122){_0x2df076[_0x449c('0x1a')](0x194);}return _0x570122;};}function handleError(_0xea2938,_0x42866b){_0x42866b=_0x42866b||0x1f4;return function(_0x2d42b4){logger[_0x449c('0x29')](_0x2d42b4[_0x449c('0x2a')]);if(_0x2d42b4[_0x449c('0x2b')]){delete _0x2d42b4[_0x449c('0x2b')];}_0xea2938['status'](_0x42866b)[_0x449c('0x2c')](_0x2d42b4);};}exports[_0x449c('0x2d')]=function(_0x2429d5,_0x2731ca){var _0x275b7c={},_0x514652={},_0x41545d={'count':0x0,'rows':[]};var _0x557ec9=_[_0x449c('0x2e')](db[_0x449c('0x2f')][_0x449c('0x30')],function(_0x29a00f){return{'name':_0x29a00f[_0x449c('0x31')],'type':_0x29a00f[_0x449c('0x32')]['key']};});_0x514652[_0x449c('0x33')]=_[_0x449c('0x2e')](_0x557ec9,_0x449c('0x2b'));_0x514652['query']=_[_0x449c('0x34')](_0x2429d5[_0x449c('0x35')]);_0x514652[_0x449c('0x36')]=_[_0x449c('0x37')](_0x514652[_0x449c('0x33')],_0x514652['query']);_0x275b7c[_0x449c('0x38')]=_['intersection'](_0x514652[_0x449c('0x33')],qs[_0x449c('0x39')](_0x2429d5[_0x449c('0x35')]['fields']));_0x275b7c[_0x449c('0x38')]=_0x275b7c[_0x449c('0x38')][_0x449c('0x3a')]?_0x275b7c[_0x449c('0x38')]:_0x514652[_0x449c('0x33')];if(!_0x2429d5[_0x449c('0x35')][_0x449c('0x3b')](_0x449c('0x3c'))){_0x275b7c['limit']=qs[_0x449c('0x20')](_0x2429d5[_0x449c('0x35')][_0x449c('0x20')]);_0x275b7c[_0x449c('0x1f')]=qs[_0x449c('0x1f')](_0x2429d5[_0x449c('0x35')][_0x449c('0x1f')]);}_0x275b7c[_0x449c('0x3d')]=qs[_0x449c('0x3e')](_0x2429d5['query'][_0x449c('0x3e')]);_0x275b7c[_0x449c('0x3f')]=qs[_0x449c('0x36')](_[_0x449c('0x40')](_0x2429d5[_0x449c('0x35')],_0x514652[_0x449c('0x36')]),_0x557ec9);if(_0x2429d5[_0x449c('0x35')]['filter']){_0x275b7c[_0x449c('0x3f')]=_[_0x449c('0x41')](_0x275b7c[_0x449c('0x3f')],{'$or':_[_0x449c('0x2e')](_0x557ec9,function(_0x2ab4d4){if(_0x2ab4d4[_0x449c('0x32')]!==_0x449c('0x42')){var _0x570f83={};_0x570f83[_0x2ab4d4[_0x449c('0x2b')]]={'$like':'%'+_0x2429d5[_0x449c('0x35')][_0x449c('0x43')]+'%'};return _0x570f83;}})});}_0x275b7c=_[_0x449c('0x41')]({},_0x275b7c,_0x2429d5[_0x449c('0x44')]);var _0x2f973d={'where':_0x275b7c['where']};return db[_0x449c('0x2f')][_0x449c('0x1e')](_0x2f973d)[_0x449c('0x27')](function(_0x59589a){_0x41545d[_0x449c('0x1e')]=_0x59589a;if(_0x2429d5[_0x449c('0x35')][_0x449c('0x45')]){_0x275b7c[_0x449c('0x46')]=[{'all':!![]}];}return db[_0x449c('0x2f')][_0x449c('0x47')](_0x275b7c);})[_0x449c('0x27')](function(_0x2de0c1){_0x41545d['rows']=_0x2de0c1;return _0x41545d;})[_0x449c('0x27')](respondWithFilteredResult(_0x2731ca,_0x275b7c))[_0x449c('0x48')](handleError(_0x2731ca,null));};exports[_0x449c('0x49')]=function(_0x20e82d,_0x12da71){var _0x24eb15={'raw':!![],'where':{'id':_0x20e82d[_0x449c('0x4a')]['id']}},_0x26bd45={};_0x26bd45[_0x449c('0x33')]=_[_0x449c('0x34')](db[_0x449c('0x2f')][_0x449c('0x30')]);_0x26bd45[_0x449c('0x35')]=_[_0x449c('0x34')](_0x20e82d[_0x449c('0x35')]);_0x26bd45[_0x449c('0x36')]=_[_0x449c('0x37')](_0x26bd45['model'],_0x26bd45['query']);_0x24eb15['attributes']=_[_0x449c('0x37')](_0x26bd45[_0x449c('0x33')],qs['fields'](_0x20e82d['query'][_0x449c('0x39')]));_0x24eb15[_0x449c('0x38')]=_0x24eb15[_0x449c('0x38')]['length']?_0x24eb15[_0x449c('0x38')]:_0x26bd45[_0x449c('0x33')];if(_0x20e82d['query'][_0x449c('0x45')]){_0x24eb15[_0x449c('0x46')]=[{'all':!![]}];}_0x24eb15=_['merge']({},_0x24eb15,_0x20e82d[_0x449c('0x44')]);return db[_0x449c('0x2f')][_0x449c('0x4b')](_0x24eb15)[_0x449c('0x27')](handleEntityNotFound(_0x12da71,null))[_0x449c('0x27')](respondWithResult(_0x12da71,null))[_0x449c('0x48')](handleError(_0x12da71,null));};exports['create']=function(_0x193fd7,_0x4cb23d){return db[_0x449c('0x2f')][_0x449c('0x4c')](_0x193fd7[_0x449c('0x4d')],{})[_0x449c('0x27')](respondWithResult(_0x4cb23d,0xc9))['catch'](handleError(_0x4cb23d,null));};exports[_0x449c('0x26')]=function(_0x4aa0d3,_0x230ad0){if(_0x4aa0d3[_0x449c('0x4d')]['id']){delete _0x4aa0d3[_0x449c('0x4d')]['id'];}return db['SmsApplication'][_0x449c('0x4b')]({'where':{'id':_0x4aa0d3[_0x449c('0x4a')]['id']}})[_0x449c('0x27')](handleEntityNotFound(_0x230ad0,null))[_0x449c('0x27')](saveUpdates(_0x4aa0d3[_0x449c('0x4d')],null))[_0x449c('0x27')](respondWithResult(_0x230ad0,null))['catch'](handleError(_0x230ad0,null));};exports['destroy']=function(_0x5b0908,_0x11ea28){return db[_0x449c('0x2f')]['find']({'where':{'id':_0x5b0908[_0x449c('0x4a')]['id']}})[_0x449c('0x27')](handleEntityNotFound(_0x11ea28,null))[_0x449c('0x27')](removeEntity(_0x11ea28,null))[_0x449c('0x48')](handleError(_0x11ea28,null));}; \ No newline at end of file diff --git a/server/api/smsApplication/smsApplication.model.js b/server/api/smsApplication/smsApplication.model.js index a211d12..e7fb8db 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 _0x4259=['lodash','util','../../config/logger','api','moment','bluebird','request-promise','path','../../config/environment','exports','define','sms_applications','utf8mb4','utf8mb4_unicode_ci'];(function(_0x2440fe,_0x281a11){var _0x5cf734=function(_0x38e12b){while(--_0x38e12b){_0x2440fe['push'](_0x2440fe['shift']());}};_0x5cf734(++_0x281a11);}(_0x4259,0x188));var _0x9425=function(_0x4be04a,_0x3bf896){_0x4be04a=_0x4be04a-0x0;var _0xd03915=_0x4259[_0x4be04a];return _0xd03915;};'use strict';var _=require(_0x9425('0x0'));var util=require(_0x9425('0x1'));var logger=require(_0x9425('0x2'))(_0x9425('0x3'));var moment=require(_0x9425('0x4'));var BPromise=require(_0x9425('0x5'));var rp=require(_0x9425('0x6'));var fs=require('fs');var path=require(_0x9425('0x7'));var rimraf=require('rimraf');var config=require(_0x9425('0x8'));var attributes=require('./smsApplication.attributes');module[_0x9425('0x9')]=function(_0x51f597,_0x32887c){return _0x51f597[_0x9425('0xa')]('SmsApplication',attributes,{'tableName':_0x9425('0xb'),'paranoid':![],'indexes':[],'timestamps':!![],'charset':_0x9425('0xc'),'collate':_0x9425('0xd')});}; \ No newline at end of file +var _0x9e8e=['define','sms_applications','utf8mb4','utf8mb4_unicode_ci','lodash','util','../../config/logger','api','request-promise','rimraf','../../config/environment','./smsApplication.attributes','exports'];(function(_0x352246,_0x2ad7db){var _0x527e29=function(_0x214c95){while(--_0x214c95){_0x352246['push'](_0x352246['shift']());}};_0x527e29(++_0x2ad7db);}(_0x9e8e,0x1cb));var _0xe9e8=function(_0x5b0edd,_0x7efa00){_0x5b0edd=_0x5b0edd-0x0;var _0x4ae996=_0x9e8e[_0x5b0edd];return _0x4ae996;};'use strict';var _=require(_0xe9e8('0x0'));var util=require(_0xe9e8('0x1'));var logger=require(_0xe9e8('0x2'))(_0xe9e8('0x3'));var moment=require('moment');var BPromise=require('bluebird');var rp=require(_0xe9e8('0x4'));var fs=require('fs');var path=require('path');var rimraf=require(_0xe9e8('0x5'));var config=require(_0xe9e8('0x6'));var attributes=require(_0xe9e8('0x7'));module[_0xe9e8('0x8')]=function(_0x390331,_0x7b5734){return _0x390331[_0xe9e8('0x9')]('SmsApplication',attributes,{'tableName':_0xe9e8('0xa'),'paranoid':![],'indexes':[],'timestamps':!![],'charset':_0xe9e8('0xb'),'collate':_0xe9e8('0xc')});}; \ No newline at end of file diff --git a/server/api/smsApplication/smsApplication.rpc.js b/server/api/smsApplication/smsApplication.rpc.js index 01b2fb5..95a21dc 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 _0xd232=['then','info','SmsApplication,\x20%s,\x20%s','request\x20sent','SmsApplication,\x20%s,\x20%s,\x20%s','stringify','error','code','message','result','catch','lodash','moment','bluebird','randomstring','ioredis','../../mysqldb','rpc','client','http','request'];(function(_0x470d05,_0x1ccea9){var _0x355c9f=function(_0x5aff67){while(--_0x5aff67){_0x470d05['push'](_0x470d05['shift']());}};_0x355c9f(++_0x1ccea9);}(_0xd232,0x74));var _0x2d23=function(_0x321bb2,_0x202794){_0x321bb2=_0x321bb2-0x0;var _0x9c12ed=_0xd232[_0x321bb2];return _0x9c12ed;};'use strict';var _=require(_0x2d23('0x0'));var util=require('util');var moment=require(_0x2d23('0x1'));var BPromise=require(_0x2d23('0x2'));var rs=require(_0x2d23('0x3'));var fs=require('fs');var Redis=require(_0x2d23('0x4'));var db=require(_0x2d23('0x5'))['db'];var utils=require('../../config/utils');var logger=require('../../config/logger')(_0x2d23('0x6'));var config=require('../../config/environment');var jayson=require('jayson/promise');var client=jayson[_0x2d23('0x7')][_0x2d23('0x8')]({'port':0x232a});function respondWithRpcPromise(_0x15c735,_0x53ac18,_0x18cac8){return new BPromise(function(_0x4cf7f4,_0x2c4667){return client[_0x2d23('0x9')](_0x15c735,_0x18cac8)[_0x2d23('0xa')](function(_0x7847cb){logger[_0x2d23('0xb')](_0x2d23('0xc'),_0x53ac18,_0x2d23('0xd'));logger['debug'](_0x2d23('0xe'),_0x53ac18,_0x2d23('0xd'),JSON[_0x2d23('0xf')](_0x7847cb));if(_0x7847cb[_0x2d23('0x10')]){if(_0x7847cb[_0x2d23('0x10')][_0x2d23('0x11')]===0x1f4){logger[_0x2d23('0x10')](_0x2d23('0xc'),_0x53ac18,_0x7847cb[_0x2d23('0x10')][_0x2d23('0x12')]);return _0x2c4667(_0x7847cb[_0x2d23('0x10')][_0x2d23('0x12')]);}logger['error'](_0x2d23('0xc'),_0x53ac18,_0x7847cb[_0x2d23('0x10')][_0x2d23('0x12')]);return _0x4cf7f4(_0x7847cb[_0x2d23('0x10')][_0x2d23('0x12')]);}else{logger['info'](_0x2d23('0xc'),_0x53ac18,'request\x20sent');_0x4cf7f4(_0x7847cb[_0x2d23('0x13')]['message']);}})[_0x2d23('0x14')](function(_0x30b578){logger['error']('SmsApplication,\x20%s,\x20%s',_0x53ac18,_0x30b578);_0x2c4667(_0x30b578);});});} \ No newline at end of file +var _0xe2ab=['SmsApplication,\x20%s,\x20%s,\x20%s','stringify','error','SmsApplication,\x20%s,\x20%s','message','result','catch','lodash','util','moment','bluebird','randomstring','ioredis','../../config/utils','../../config/logger','rpc','../../config/environment','client','info','request\x20sent','debug'];(function(_0x4eaa9c,_0x3a879a){var _0x46b796=function(_0x41f4bc){while(--_0x41f4bc){_0x4eaa9c['push'](_0x4eaa9c['shift']());}};_0x46b796(++_0x3a879a);}(_0xe2ab,0xc4));var _0xbe2a=function(_0xc3f0cd,_0x3886a2){_0xc3f0cd=_0xc3f0cd-0x0;var _0x14a8c4=_0xe2ab[_0xc3f0cd];return _0x14a8c4;};'use strict';var _=require(_0xbe2a('0x0'));var util=require(_0xbe2a('0x1'));var moment=require(_0xbe2a('0x2'));var BPromise=require(_0xbe2a('0x3'));var rs=require(_0xbe2a('0x4'));var fs=require('fs');var Redis=require(_0xbe2a('0x5'));var db=require('../../mysqldb')['db'];var utils=require(_0xbe2a('0x6'));var logger=require(_0xbe2a('0x7'))(_0xbe2a('0x8'));var config=require(_0xbe2a('0x9'));var jayson=require('jayson/promise');var client=jayson[_0xbe2a('0xa')]['http']({'port':0x232a});function respondWithRpcPromise(_0x2f504b,_0x58b8f1,_0x5a8a5d){return new BPromise(function(_0xfccbff,_0x232194){return client['request'](_0x2f504b,_0x5a8a5d)['then'](function(_0x83d775){logger[_0xbe2a('0xb')]('SmsApplication,\x20%s,\x20%s',_0x58b8f1,_0xbe2a('0xc'));logger[_0xbe2a('0xd')](_0xbe2a('0xe'),_0x58b8f1,_0xbe2a('0xc'),JSON[_0xbe2a('0xf')](_0x83d775));if(_0x83d775['error']){if(_0x83d775['error']['code']===0x1f4){logger[_0xbe2a('0x10')](_0xbe2a('0x11'),_0x58b8f1,_0x83d775[_0xbe2a('0x10')][_0xbe2a('0x12')]);return _0x232194(_0x83d775[_0xbe2a('0x10')]['message']);}logger[_0xbe2a('0x10')](_0xbe2a('0x11'),_0x58b8f1,_0x83d775[_0xbe2a('0x10')]['message']);return _0xfccbff(_0x83d775[_0xbe2a('0x10')][_0xbe2a('0x12')]);}else{logger[_0xbe2a('0xb')](_0xbe2a('0x11'),_0x58b8f1,_0xbe2a('0xc'));_0xfccbff(_0x83d775[_0xbe2a('0x13')][_0xbe2a('0x12')]);}})[_0xbe2a('0x14')](function(_0x4395fe){logger['error'](_0xbe2a('0x11'),_0x58b8f1,_0x4395fe);_0x232194(_0x4395fe);});});} \ No newline at end of file diff --git a/server/api/smsInteraction/index.js b/server/api/smsInteraction/index.js index 2df53ba..7b35a60 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 _0x14a0=['/:id/download','post','create','/:id/messages','addMessage','/:id/tags','tracked','sms','addTags','put','smsinteraction:update','update','delete','/:id','smsinteraction:destroy','destroy','removeTags','exports','util','path','connect-timeout','express','Router','fs-extra','../../components/auth/service','./smsInteraction.controller','get','isAuthenticated','/describe','describe','getMessages'];(function(_0x53d7e7,_0x4d3b3d){var _0x33b186=function(_0x18bf94){while(--_0x18bf94){_0x53d7e7['push'](_0x53d7e7['shift']());}};_0x33b186(++_0x4d3b3d);}(_0x14a0,0x8e));var _0x014a=function(_0x90eab0,_0x343ea2){_0x90eab0=_0x90eab0-0x0;var _0x21e6c2=_0x14a0[_0x90eab0];return _0x21e6c2;};'use strict';var multer=require('multer');var util=require(_0x014a('0x0'));var path=require(_0x014a('0x1'));var timeout=require(_0x014a('0x2'));var express=require(_0x014a('0x3'));var router=express[_0x014a('0x4')]();var fs_extra=require(_0x014a('0x5'));var auth=require(_0x014a('0x6'));var interaction=require('../../components/interaction/service');var config=require('../../config/environment');var controller=require(_0x014a('0x7'));router[_0x014a('0x8')]('/',auth[_0x014a('0x9')](),controller['index']);router['get'](_0x014a('0xa'),auth[_0x014a('0x9')](),controller[_0x014a('0xb')]);router['get']('/:id',auth[_0x014a('0x9')](),controller['show']);router['get']('/:id/messages',auth['isAuthenticated'](),controller[_0x014a('0xc')]);router['get'](_0x014a('0xd'),auth[_0x014a('0x9')](),controller['download']);router[_0x014a('0xe')]('/',auth[_0x014a('0x9')](),controller[_0x014a('0xf')]);router[_0x014a('0xe')](_0x014a('0x10'),auth[_0x014a('0x9')](),controller[_0x014a('0x11')]);router[_0x014a('0xe')](_0x014a('0x12'),auth[_0x014a('0x9')](),interaction[_0x014a('0x13')](_0x014a('0x14'),'smsinteraction:addtags'),controller[_0x014a('0x15')]);router[_0x014a('0x16')]('/:id',auth[_0x014a('0x9')](),interaction[_0x014a('0x13')]('sms',_0x014a('0x17')),controller[_0x014a('0x18')]);router[_0x014a('0x19')](_0x014a('0x1a'),auth[_0x014a('0x9')](),interaction[_0x014a('0x13')](_0x014a('0x14'),_0x014a('0x1b')),controller[_0x014a('0x1c')]);router[_0x014a('0x19')](_0x014a('0x12'),auth[_0x014a('0x9')](),controller[_0x014a('0x1d')]);module[_0x014a('0x1e')]=router; \ No newline at end of file +var _0xd4a2=['isAuthenticated','index','/describe','describe','/:id','show','/:id/messages','getMessages','download','create','post','addMessage','/:id/tags','sms','addTags','put','update','tracked','removeTags','exports','multer','connect-timeout','Router','../../components/auth/service','../../config/environment','./smsInteraction.controller','get'];(function(_0x36fc1f,_0x27c1c8){var _0x371281=function(_0x2764fc){while(--_0x2764fc){_0x36fc1f['push'](_0x36fc1f['shift']());}};_0x371281(++_0x27c1c8);}(_0xd4a2,0x173));var _0x2d4a=function(_0x4284ba,_0x3c3bbd){_0x4284ba=_0x4284ba-0x0;var _0x411e60=_0xd4a2[_0x4284ba];return _0x411e60;};'use strict';var multer=require(_0x2d4a('0x0'));var util=require('util');var path=require('path');var timeout=require(_0x2d4a('0x1'));var express=require('express');var router=express[_0x2d4a('0x2')]();var fs_extra=require('fs-extra');var auth=require(_0x2d4a('0x3'));var interaction=require('../../components/interaction/service');var config=require(_0x2d4a('0x4'));var controller=require(_0x2d4a('0x5'));router[_0x2d4a('0x6')]('/',auth[_0x2d4a('0x7')](),controller[_0x2d4a('0x8')]);router['get'](_0x2d4a('0x9'),auth[_0x2d4a('0x7')](),controller[_0x2d4a('0xa')]);router[_0x2d4a('0x6')](_0x2d4a('0xb'),auth[_0x2d4a('0x7')](),controller[_0x2d4a('0xc')]);router[_0x2d4a('0x6')](_0x2d4a('0xd'),auth[_0x2d4a('0x7')](),controller[_0x2d4a('0xe')]);router[_0x2d4a('0x6')]('/:id/download',auth['isAuthenticated'](),controller[_0x2d4a('0xf')]);router['post']('/',auth[_0x2d4a('0x7')](),controller[_0x2d4a('0x10')]);router[_0x2d4a('0x11')](_0x2d4a('0xd'),auth[_0x2d4a('0x7')](),controller[_0x2d4a('0x12')]);router[_0x2d4a('0x11')](_0x2d4a('0x13'),auth['isAuthenticated'](),interaction['tracked'](_0x2d4a('0x14'),'smsinteraction:addtags'),controller[_0x2d4a('0x15')]);router[_0x2d4a('0x16')](_0x2d4a('0xb'),auth[_0x2d4a('0x7')](),interaction['tracked'](_0x2d4a('0x14'),'smsinteraction:update'),controller[_0x2d4a('0x17')]);router['delete'](_0x2d4a('0xb'),auth[_0x2d4a('0x7')](),interaction[_0x2d4a('0x18')](_0x2d4a('0x14'),'smsinteraction:destroy'),controller['destroy']);router['delete'](_0x2d4a('0x13'),auth[_0x2d4a('0x7')](),controller[_0x2d4a('0x19')]);module[_0x2d4a('0x1a')]=router; \ No newline at end of file diff --git a/server/api/smsInteraction/smsInteraction.attributes.js b/server/api/smsInteraction/smsInteraction.attributes.js index f7faa57..7e45949 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 _0xedf1=['BOOLEAN','INTEGER','sequelize','moment','DATE','STRING','ENUM','out'];(function(_0x211817,_0x2a8f71){var _0x4a55f3=function(_0x69c327){while(--_0x69c327){_0x211817['push'](_0x211817['shift']());}};_0x4a55f3(++_0x2a8f71);}(_0xedf1,0xb2));var _0x1edf=function(_0x4a1147,_0x21d09e){_0x4a1147=_0x4a1147-0x0;var _0x3be03c=_0xedf1[_0x4a1147];return _0x3be03c;};'use strict';var Sequelize=require(_0x1edf('0x0'));var moment=require(_0x1edf('0x1'));module['exports']={'closed':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'closedAt':{'type':Sequelize[_0x1edf('0x2')]},'disposition':{'type':Sequelize[_0x1edf('0x3')]},'secondDisposition':{'type':Sequelize[_0x1edf('0x3')]},'thirdDisposition':{'type':Sequelize['STRING']},'note':{'type':Sequelize[_0x1edf('0x3')]},'phone':{'type':Sequelize[_0x1edf('0x3')]},'read1stAt':{'type':Sequelize[_0x1edf('0x2')]},'firstMsgDirection':{'type':Sequelize['ENUM']('in','out'),'defaultValue':'in','allowNull':![]},'lastMsgAt':{'type':Sequelize[_0x1edf('0x2')]},'lastMsgDirection':{'type':Sequelize[_0x1edf('0x4')]('in',_0x1edf('0x5')),'defaultValue':'in','allowNull':![]},'autoreplyExecuted':{'type':Sequelize[_0x1edf('0x6')],'defaultValue':![]},'queueId':{'type':Sequelize[_0x1edf('0x7')]}}; \ No newline at end of file +var _0x253d=['out','DATE','INTEGER','sequelize','STRING','ENUM'];(function(_0x21a9d9,_0x4d5ac8){var _0x46adce=function(_0xfdd336){while(--_0xfdd336){_0x21a9d9['push'](_0x21a9d9['shift']());}};_0x46adce(++_0x4d5ac8);}(_0x253d,0x1b3));var _0xd253=function(_0x105bb8,_0x5a9f29){_0x105bb8=_0x105bb8-0x0;var _0x16e7bb=_0x253d[_0x105bb8];return _0x16e7bb;};'use strict';var Sequelize=require(_0xd253('0x0'));var moment=require('moment');module['exports']={'closed':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'closedAt':{'type':Sequelize['DATE']},'disposition':{'type':Sequelize[_0xd253('0x1')]},'secondDisposition':{'type':Sequelize[_0xd253('0x1')]},'thirdDisposition':{'type':Sequelize[_0xd253('0x1')]},'note':{'type':Sequelize[_0xd253('0x1')]},'phone':{'type':Sequelize[_0xd253('0x1')]},'read1stAt':{'type':Sequelize['DATE']},'firstMsgDirection':{'type':Sequelize[_0xd253('0x2')]('in',_0xd253('0x3')),'defaultValue':'in','allowNull':![]},'lastMsgAt':{'type':Sequelize[_0xd253('0x4')]},'lastMsgDirection':{'type':Sequelize[_0xd253('0x2')]('in',_0xd253('0x3')),'defaultValue':'in','allowNull':![]},'autoreplyExecuted':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'queueId':{'type':Sequelize[_0xd253('0x5')]}}; \ No newline at end of file diff --git a/server/api/smsInteraction/smsInteraction.controller.js b/server/api/smsInteraction/smsInteraction.controller.js index 97622ad..c52ec75 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 _0xdb50=['register','sendStatus','status','end','json','offset','undefined','count','limit','then','destroy','error','stack','name','send','index','map','rawAttributes','fieldName','type','key','getOptions','sms','query','user','catch','show','model','SmsInteraction','keys','filters','intersection','fields','attributes','length','include','merge','find','create','body','update','describe','addMessage','SmsMessage','omit','ids','getMessages','findOne','params','nolimit','order','sort','pick','where','SmsInteractionId','filter','$gte','split','format','YYYY-MM-DD\x20HH:mm:ss','options','includeAll','findAll','rows','addTags','setTags','spread','Tag','color','emit','removeTags','download','unix','toString','join','root','server','files','tmp','User','CmContact','Contact','firstName','lastName','createdAt','secret','read','push','Account','Owner','fullname','get','closed','closedAt','disposition','direction','out','value','views','downloadInteraction.ejs','.pdf','Sms','createPdfFromHTML','log','unlinkSync','rimraf','util','path','ejs','lodash','ioredis','../../components/interaction/service','../../components/export/pdf','../../config/logger','api','../../config/environment','../../mysqldb','defaults','redis','localhost','./smsInteraction.socket'];(function(_0x30597e,_0x3d3e66){var _0x17b1cf=function(_0xa3d995){while(--_0xa3d995){_0x30597e['push'](_0x30597e['shift']());}};_0x17b1cf(++_0x3d3e66);}(_0xdb50,0xe2));var _0x0db5=function(_0x22afa4,_0x4fceaa){_0x22afa4=_0x22afa4-0x0;var _0x3ec1ab=_0xdb50[_0x22afa4];return _0x3ec1ab;};'use strict';var rimraf=require(_0x0db5('0x0'));var zipdir=require('zip-dir');var moment=require('moment');var BPromise=require('bluebird');var util=require(_0x0db5('0x1'));var path=require(_0x0db5('0x2'));var ejs=require(_0x0db5('0x3'));var fs=require('fs');var _=require(_0x0db5('0x4'));var Redis=require(_0x0db5('0x5'));var interaction=require(_0x0db5('0x6'));var qs=require('../../components/parsers/qs');var pdf=require(_0x0db5('0x7'));var logger=require(_0x0db5('0x8'))(_0x0db5('0x9'));var config=require(_0x0db5('0xa'));var db=require(_0x0db5('0xb'))['db'];config['redis']=_[_0x0db5('0xc')](config[_0x0db5('0xd')],{'host':_0x0db5('0xe'),'port':0x18eb});var socket=require('socket.io-emitter')(new Redis(config[_0x0db5('0xd')]));require(_0x0db5('0xf'))[_0x0db5('0x10')](socket);function respondWithStatusCode(_0x1c4544,_0x53bb2c){_0x53bb2c=_0x53bb2c||0xcc;return function(_0x2100ab){if(_0x2100ab){return _0x1c4544[_0x0db5('0x11')](_0x53bb2c);}return _0x1c4544[_0x0db5('0x12')](_0x53bb2c)[_0x0db5('0x13')]();};}function respondWithResult(_0x35fe2c,_0x513c0b){_0x513c0b=_0x513c0b||0xc8;return function(_0xe47085){if(_0xe47085){return _0x35fe2c[_0x0db5('0x12')](_0x513c0b)[_0x0db5('0x14')](_0xe47085);}};}function respondWithFilteredResult(_0x3b2233,_0x1c4f43){return function(_0x409f32){if(_0x409f32){var _0x284d32=typeof _0x1c4f43[_0x0db5('0x15')]===_0x0db5('0x16')&&typeof _0x1c4f43['limit']===_0x0db5('0x16');var _0x3d37ec=_0x409f32[_0x0db5('0x17')];var _0x545141=_0x284d32?0x0:_0x1c4f43[_0x0db5('0x15')];var _0x499719=_0x284d32?_0x409f32['count']:_0x1c4f43[_0x0db5('0x15')]+_0x1c4f43[_0x0db5('0x18')];var _0x12de77;if(_0x499719>=_0x3d37ec){_0x499719=_0x3d37ec;_0x12de77=0xc8;}else{_0x12de77=0xce;}_0x3b2233['status'](_0x12de77);return _0x3b2233['set']('Content-Range',_0x545141+'-'+_0x499719+'/'+_0x3d37ec)[_0x0db5('0x14')](_0x409f32);}return null;};}function saveUpdates(_0x76254d){return function(_0x435d3c){if(_0x435d3c){return _0x435d3c['update'](_0x76254d)[_0x0db5('0x19')](function(_0x4cfb4c){return _0x4cfb4c;});}return null;};}function removeEntity(_0x45752c){return function(_0x4384d9){if(_0x4384d9){return _0x4384d9[_0x0db5('0x1a')]()[_0x0db5('0x19')](function(){_0x45752c['status'](0xcc)['end']();});}};}function handleEntityNotFound(_0x56327f){return function(_0x365661){if(!_0x365661){_0x56327f[_0x0db5('0x11')](0x194);}return _0x365661;};}function handleError(_0x4925a2,_0x2ebaca){_0x2ebaca=_0x2ebaca||0x1f4;return function(_0x5859b6){logger[_0x0db5('0x1b')](_0x5859b6[_0x0db5('0x1c')]);if(_0x5859b6[_0x0db5('0x1d')]){delete _0x5859b6[_0x0db5('0x1d')];}_0x4925a2[_0x0db5('0x12')](_0x2ebaca)[_0x0db5('0x1e')](_0x5859b6);};}exports[_0x0db5('0x1f')]=function(_0x50fbd2,_0x22cc52){var _0x158fa6={};var _0x3c55ab=_[_0x0db5('0x20')](db['SmsInteraction'][_0x0db5('0x21')],function(_0x1b2b59){return{'name':_0x1b2b59[_0x0db5('0x22')],'type':_0x1b2b59[_0x0db5('0x23')][_0x0db5('0x24')]};});_0x158fa6=qs[_0x0db5('0x25')](_0x3c55ab,_0x50fbd2);return interaction['findAll'](_0x0db5('0x26'),_0x50fbd2[_0x0db5('0x27')],_0x50fbd2[_0x0db5('0x28')],_0x158fa6,_0x3c55ab)[_0x0db5('0x19')](respondWithFilteredResult(_0x22cc52,_0x158fa6))[_0x0db5('0x29')](handleError(_0x22cc52,null));};exports[_0x0db5('0x2a')]=function(_0x3fcd64,_0x1346bb){var _0x420d15={'raw':![],'where':{'id':_0x3fcd64['params']['id']}},_0x51d384={};_0x51d384[_0x0db5('0x2b')]=_['keys'](db[_0x0db5('0x2c')][_0x0db5('0x21')]);_0x51d384['query']=_[_0x0db5('0x2d')](_0x3fcd64['query']);_0x51d384[_0x0db5('0x2e')]=_[_0x0db5('0x2f')](_0x51d384[_0x0db5('0x2b')],_0x51d384[_0x0db5('0x27')]);_0x420d15['attributes']=_[_0x0db5('0x2f')](_0x51d384[_0x0db5('0x2b')],qs[_0x0db5('0x30')](_0x3fcd64[_0x0db5('0x27')][_0x0db5('0x30')]));_0x420d15[_0x0db5('0x31')]=_0x420d15['attributes'][_0x0db5('0x32')]?_0x420d15[_0x0db5('0x31')]:_0x51d384[_0x0db5('0x2b')];if(_0x3fcd64[_0x0db5('0x27')]['includeAll']){_0x420d15[_0x0db5('0x33')]=[{'all':!![]}];}_0x420d15=_[_0x0db5('0x34')]({},_0x420d15,_0x3fcd64['options']);return db[_0x0db5('0x2c')][_0x0db5('0x35')](_0x420d15)[_0x0db5('0x19')](handleEntityNotFound(_0x1346bb,null))['then'](respondWithResult(_0x1346bb,null))[_0x0db5('0x29')](handleError(_0x1346bb,null));};exports[_0x0db5('0x36')]=function(_0x4dba8f,_0x1f8dbe){return db['SmsInteraction'][_0x0db5('0x36')](_0x4dba8f[_0x0db5('0x37')],{})[_0x0db5('0x19')](respondWithResult(_0x1f8dbe,0xc9))[_0x0db5('0x29')](handleError(_0x1f8dbe,null));};exports[_0x0db5('0x38')]=function(_0x54cbfc,_0x5535e4){if(_0x54cbfc[_0x0db5('0x37')]['id']){delete _0x54cbfc[_0x0db5('0x37')]['id'];}return db['SmsInteraction']['find']({'where':{'id':_0x54cbfc['params']['id']}})[_0x0db5('0x19')](handleEntityNotFound(_0x5535e4,null))[_0x0db5('0x19')](saveUpdates(_0x54cbfc[_0x0db5('0x37')],null))['then'](respondWithResult(_0x5535e4,null))[_0x0db5('0x29')](handleError(_0x5535e4,null));};exports['destroy']=function(_0x469759,_0x23ff02){return db[_0x0db5('0x2c')]['find']({'where':{'id':_0x469759['params']['id']}})[_0x0db5('0x19')](handleEntityNotFound(_0x23ff02,null))[_0x0db5('0x19')](removeEntity(_0x23ff02,null))['catch'](handleError(_0x23ff02,null));};exports[_0x0db5('0x39')]=function(_0x25b9e6,_0xd67cd4){return db['SmsInteraction'][_0x0db5('0x39')]()[_0x0db5('0x19')](respondWithResult(_0xd67cd4,null))[_0x0db5('0x29')](handleError(_0xd67cd4,null));};exports[_0x0db5('0x3a')]=function(_0x3a332e,_0xcc57ea){return db[_0x0db5('0x3b')][_0x0db5('0x35')]({'where':{'id':_0x3a332e['params']['id']}})[_0x0db5('0x19')](handleEntityNotFound(_0xcc57ea,null))[_0x0db5('0x19')](function(_0x29a4b3){if(_0x29a4b3){return _0x29a4b3[_0x0db5('0x3a')](_0x3a332e[_0x0db5('0x37')]['ids'],_[_0x0db5('0x3c')](_0x3a332e[_0x0db5('0x37')],[_0x0db5('0x3d'),'id'])||{});}})['then'](respondWithResult(_0xcc57ea,null))[_0x0db5('0x29')](handleError(_0xcc57ea,null));};exports[_0x0db5('0x3e')]=function(_0x1ceae5,_0x2060c2){var _0x3eb157={'raw':![],'where':{}};var _0x2b549d={};var _0x2709b6={'count':0x0,'rows':[]};return db[_0x0db5('0x2c')][_0x0db5('0x3f')]({'where':{'id':_0x1ceae5[_0x0db5('0x40')]['id']}})[_0x0db5('0x19')](handleEntityNotFound(_0x2060c2,null))[_0x0db5('0x19')](function(_0x3f6b4e){if(_0x3f6b4e){_0x2b549d[_0x0db5('0x2b')]=_[_0x0db5('0x2d')](db['SmsMessage'][_0x0db5('0x21')]);_0x2b549d['query']=_[_0x0db5('0x2d')](_0x1ceae5['query']);_0x2b549d[_0x0db5('0x2e')]=_[_0x0db5('0x2f')](_0x2b549d['model'],_0x2b549d[_0x0db5('0x27')]);_0x3eb157[_0x0db5('0x31')]=_[_0x0db5('0x2f')](_0x2b549d[_0x0db5('0x2b')],qs[_0x0db5('0x30')](_0x1ceae5[_0x0db5('0x27')][_0x0db5('0x30')]));_0x3eb157[_0x0db5('0x31')]=_0x3eb157[_0x0db5('0x31')][_0x0db5('0x32')]?_0x3eb157[_0x0db5('0x31')]:_0x2b549d[_0x0db5('0x2b')];if(!_0x1ceae5[_0x0db5('0x27')]['hasOwnProperty'](_0x0db5('0x41'))){_0x3eb157['limit']=qs[_0x0db5('0x18')](_0x1ceae5['query']['limit']);_0x3eb157['offset']=qs[_0x0db5('0x15')](_0x1ceae5['query']['offset']);}_0x3eb157[_0x0db5('0x42')]=qs[_0x0db5('0x43')](_0x1ceae5[_0x0db5('0x27')][_0x0db5('0x43')]);_0x3eb157['where']=qs[_0x0db5('0x2e')](_[_0x0db5('0x44')](_0x1ceae5[_0x0db5('0x27')],_0x2b549d['filters']));_0x3eb157[_0x0db5('0x45')][_0x0db5('0x46')]=_0x3f6b4e['id'];if(_0x1ceae5[_0x0db5('0x27')][_0x0db5('0x47')]){_0x3eb157[_0x0db5('0x45')]=_[_0x0db5('0x34')](_0x3eb157[_0x0db5('0x45')],{'$or':_['map'](_0x3eb157[_0x0db5('0x31')],function(_0x547fb8){var _0x286232={};_0x286232[_0x547fb8]={'$like':'%'+_0x1ceae5[_0x0db5('0x27')]['filter']+'%'};return _0x286232;})});}if(_0x1ceae5[_0x0db5('0x27')][_0x0db5('0x48')]){var _0x2b9410=_0x1ceae5[_0x0db5('0x27')][_0x0db5('0x48')][_0x0db5('0x49')](',');var _0x255afd={};_0x255afd[_0x2b9410[0x0]]={'$gte':moment(_0x2b9410[0x1])[_0x0db5('0x4a')](_0x0db5('0x4b'))};_0x3eb157['where']=_[_0x0db5('0x34')](_0x3eb157['where'],_0x255afd);}_0x3eb157=_[_0x0db5('0x34')]({},_0x3eb157,_0x1ceae5[_0x0db5('0x4c')]);return db[_0x0db5('0x3b')][_0x0db5('0x17')]({'where':_0x3eb157[_0x0db5('0x45')]})[_0x0db5('0x19')](function(_0x5c168c){_0x2709b6[_0x0db5('0x17')]=_0x5c168c;if(_0x1ceae5[_0x0db5('0x27')][_0x0db5('0x4d')]){_0x3eb157[_0x0db5('0x33')]=[{'all':!![]}];}return db[_0x0db5('0x3b')][_0x0db5('0x4e')](_0x3eb157);})[_0x0db5('0x19')](function(_0x48bcd5){_0x2709b6[_0x0db5('0x4f')]=_0x48bcd5;return _0x2709b6;});}})[_0x0db5('0x19')](respondWithFilteredResult(_0x2060c2,_0x3eb157))['catch'](handleError(_0x2060c2,null));};exports[_0x0db5('0x50')]=function(_0x2b3c40,_0x46fda5){return db[_0x0db5('0x2c')]['find']({'where':{'id':_0x2b3c40['params']['id']}})[_0x0db5('0x19')](handleEntityNotFound(_0x46fda5,null))[_0x0db5('0x19')](function(_0x234aeb){if(_0x234aeb){return _0x234aeb[_0x0db5('0x51')](_0x2b3c40[_0x0db5('0x37')][_0x0db5('0x3d')],_[_0x0db5('0x3c')](_0x2b3c40[_0x0db5('0x37')],[_0x0db5('0x3d'),'id'])||{})[_0x0db5('0x52')](function(){return db[_0x0db5('0x53')][_0x0db5('0x4e')]({'attributes':['id',_0x0db5('0x1d'),_0x0db5('0x54')],'where':{'id':_0x2b3c40['body'][_0x0db5('0x3d')]}});})[_0x0db5('0x19')](function(_0x55ea2a){socket[_0x0db5('0x55')]('smsInteractionTags:save',{'id':Number(_0x2b3c40[_0x0db5('0x40')]['id']),'tags':_0x55ea2a||[]});return{'id':Number(_0x2b3c40[_0x0db5('0x40')]['id']),'tags':_0x55ea2a||[]};});}})[_0x0db5('0x19')](respondWithResult(_0x46fda5,null))[_0x0db5('0x29')](handleError(_0x46fda5,null));};exports['removeTags']=function(_0xb60411,_0xf5bf59){return db[_0x0db5('0x2c')][_0x0db5('0x35')]({'where':{'id':_0xb60411['params']['id']}})[_0x0db5('0x19')](handleEntityNotFound(_0xf5bf59,null))[_0x0db5('0x19')](function(_0x203ea5){if(_0x203ea5){return _0x203ea5[_0x0db5('0x56')](_0xb60411[_0x0db5('0x27')]['ids']);}})['then'](respondWithStatusCode(_0xf5bf59,null))['catch'](handleError(_0xf5bf59,null));};exports[_0x0db5('0x57')]=function(_0x31d493,_0x4671bc){var _0x412d06=moment()[_0x0db5('0x58')]()[_0x0db5('0x59')]();var _0x5c6f93=path[_0x0db5('0x5a')](config[_0x0db5('0x5b')],_0x0db5('0x5c'),_0x0db5('0x5d'),_0x0db5('0x5e'));var _0x257bf3=path[_0x0db5('0x5a')](_0x5c6f93,_0x412d06);var _0x274c52=util[_0x0db5('0x4a')]('transcript-%d-%s.zip',_0x31d493[_0x0db5('0x40')]['id'],_0x412d06);var _0x4efc1f=path[_0x0db5('0x5a')](_0x5c6f93,_0x274c52);var _0x406436=[];_0x406436['push']({'model':db[_0x0db5('0x5f')],'as':_0x0db5('0x5f'),'attributes':['id','fullname'],'raw':!![]});_0x406436['push']({'model':db[_0x0db5('0x60')],'as':_0x0db5('0x61'),'attributes':['id',_0x0db5('0x62'),_0x0db5('0x63')],'raw':!![]});var _0x333450=[{'model':db[_0x0db5('0x3b')],'as':'Messages','attributes':['id',_0x0db5('0x37'),_0x0db5('0x64'),'direction',_0x0db5('0x65'),_0x0db5('0x66')],'include':_0x406436}];_0x333450[_0x0db5('0x67')]({'model':db['SmsAccount'],'as':_0x0db5('0x68'),'attributes':['id','name']});_0x333450[_0x0db5('0x67')]({'model':db[_0x0db5('0x5f')],'as':_0x0db5('0x69'),'attributes':['id',_0x0db5('0x6a')]});return db[_0x0db5('0x2c')][_0x0db5('0x35')]({'where':{'id':_0x31d493['params']['id']},'include':_0x333450})['then'](handleEntityNotFound(_0x4671bc,null))[_0x0db5('0x19')](function(_0x577f96){if(_0x577f96){var _0x5eccfb=_0x577f96[_0x0db5('0x6b')]({'plain':!![]});fs['mkdirSync'](_0x257bf3);var _0x3662f9={'channel':'Sms','account':_0x5eccfb[_0x0db5('0x68')][_0x0db5('0x1d')],'agent':_0x5eccfb[_0x0db5('0x69')]?_0x5eccfb['Owner'][_0x0db5('0x6a')]:'N.A.','createdAt':moment(_0x5eccfb[_0x0db5('0x64')])[_0x0db5('0x4a')](_0x0db5('0x4b'))['toString'](),'closedAt':_0x5eccfb[_0x0db5('0x6c')]?moment(_0x5eccfb[_0x0db5('0x6d')])[_0x0db5('0x4a')](_0x0db5('0x4b'))[_0x0db5('0x59')]():'','disposition':_0x5eccfb[_0x0db5('0x6e')],'messages':_(_0x5eccfb['Messages'])[_0x0db5('0x47')]({'secret':![]})[_0x0db5('0x20')](function(_0x577d74){return{'date':moment(_0x577d74[_0x0db5('0x64')])['format'](_0x0db5('0x4b'))[_0x0db5('0x59')](),'sender':_0x577d74[_0x0db5('0x6f')]===_0x0db5('0x70')?_0x577d74['User']?_0x577d74[_0x0db5('0x5f')]['fullname']:'System':_0x577d74[_0x0db5('0x61')][_0x0db5('0x62')]+(_0x577d74['Contact'][_0x0db5('0x63')]?'\x20'+_0x577d74['Contact'][_0x0db5('0x63')]:''),'body':_0x577d74['body'],'direction':_0x577d74[_0x0db5('0x6f')]===_0x0db5('0x70')?'A':'C','secret':_0x577d74[_0x0db5('0x65')],'read':_0x577d74[_0x0db5('0x66')]};})[_0x0db5('0x71')]()};return ejs['renderFile'](path[_0x0db5('0x5a')](config['root'],'server',_0x0db5('0x72'),_0x0db5('0x73')),{'interaction':_0x3662f9})[_0x0db5('0x19')](function(_0x3eadb5){var _0x3fe851=path['join'](_0x257bf3,'transcript-'+_0x5eccfb['id']+'-'+_0x412d06+_0x0db5('0x74'));var _0x4fdd43={'path':_0x3fe851,'channel':_0x0db5('0x75'),'interactionId':_0x5eccfb['id']};return pdf[_0x0db5('0x76')](_0x3eadb5,_0x4fdd43);})[_0x0db5('0x19')](function(){return new BPromise(function(_0x2ca4ae,_0x1491fc){zipdir(_0x257bf3,{'saveTo':_0x4efc1f},function(_0x19d042,_0x21769a){if(_0x19d042)return _0x1491fc(_0x19d042);return _0x2ca4ae(_0x21769a);});})[_0x0db5('0x19')](function(){return new BPromise(function(_0x2f4644,_0xb41759){rimraf(_0x257bf3,function(_0x1d25c7){if(_0x1d25c7)_0xb41759(_0x1d25c7);return _0x2f4644();});});})[_0x0db5('0x19')](function(){return _0x4671bc[_0x0db5('0x57')](_0x4efc1f,_0x274c52,function(_0x1041a7){if(_0x1041a7){console[_0x0db5('0x77')]('err',_0x1041a7);}else{fs[_0x0db5('0x78')](_0x4efc1f);}});});});}else{return _0x4671bc[_0x0db5('0x11')](0xc8);}})[_0x0db5('0x29')](handleError(_0x4671bc,null));}; \ No newline at end of file +var _0x11e5=['include','merge','options','find','create','body','destroy','describe','addMessage','SmsMessage','omit','ids','getMessages','findOne','filters','hasOwnProperty','nolimit','order','sort','where','pick','SmsInteractionId','filter','$gte','split','format','YYYY-MM-DD\x20HH:mm:ss','includeAll','findAll','addTags','setTags','spread','Tag','color','emit','removeTags','download','unix','toString','join','files','transcript-%d-%s.zip','User','fullname','CmContact','Contact','firstName','lastName','createdAt','direction','Account','push','Owner','get','mkdirSync','closedAt','disposition','Messages','out','System','read','value','renderFile','root','server','views','downloadInteraction.ejs','transcript-','Sms','createPdfFromHTML','err','unlinkSync','zip-dir','moment','util','ejs','lodash','../../components/interaction/service','../../components/parsers/qs','../../components/export/pdf','../../config/logger','api','../../config/environment','../../mysqldb','redis','socket.io-emitter','./smsInteraction.socket','register','sendStatus','status','json','offset','undefined','limit','count','set','Content-Range','update','then','end','error','name','send','index','map','fieldName','type','key','getOptions','sms','query','user','catch','show','params','model','SmsInteraction','keys','intersection','attributes','fields','length'];(function(_0x4978f8,_0x2c429d){var _0x432e99=function(_0x4133cc){while(--_0x4133cc){_0x4978f8['push'](_0x4978f8['shift']());}};_0x432e99(++_0x2c429d);}(_0x11e5,0x1b6));var _0x511e=function(_0x303064,_0x12f0c2){_0x303064=_0x303064-0x0;var _0x5a1d3d=_0x11e5[_0x303064];return _0x5a1d3d;};'use strict';var rimraf=require('rimraf');var zipdir=require(_0x511e('0x0'));var moment=require(_0x511e('0x1'));var BPromise=require('bluebird');var util=require(_0x511e('0x2'));var path=require('path');var ejs=require(_0x511e('0x3'));var fs=require('fs');var _=require(_0x511e('0x4'));var Redis=require('ioredis');var interaction=require(_0x511e('0x5'));var qs=require(_0x511e('0x6'));var pdf=require(_0x511e('0x7'));var logger=require(_0x511e('0x8'))(_0x511e('0x9'));var config=require(_0x511e('0xa'));var db=require(_0x511e('0xb'))['db'];config[_0x511e('0xc')]=_['defaults'](config[_0x511e('0xc')],{'host':'localhost','port':0x18eb});var socket=require(_0x511e('0xd'))(new Redis(config['redis']));require(_0x511e('0xe'))[_0x511e('0xf')](socket);function respondWithStatusCode(_0x48dce8,_0x389e85){_0x389e85=_0x389e85||0xcc;return function(_0x5e933f){if(_0x5e933f){return _0x48dce8[_0x511e('0x10')](_0x389e85);}return _0x48dce8[_0x511e('0x11')](_0x389e85)['end']();};}function respondWithResult(_0x449582,_0x492e50){_0x492e50=_0x492e50||0xc8;return function(_0x2be2e3){if(_0x2be2e3){return _0x449582[_0x511e('0x11')](_0x492e50)[_0x511e('0x12')](_0x2be2e3);}};}function respondWithFilteredResult(_0x54ef63,_0x230f02){return function(_0x212715){if(_0x212715){var _0xc7444f=typeof _0x230f02[_0x511e('0x13')]===_0x511e('0x14')&&typeof _0x230f02[_0x511e('0x15')]===_0x511e('0x14');var _0x54f912=_0x212715[_0x511e('0x16')];var _0x200f10=_0xc7444f?0x0:_0x230f02['offset'];var _0x4429e5=_0xc7444f?_0x212715[_0x511e('0x16')]:_0x230f02[_0x511e('0x13')]+_0x230f02[_0x511e('0x15')];var _0x46e50f;if(_0x4429e5>=_0x54f912){_0x4429e5=_0x54f912;_0x46e50f=0xc8;}else{_0x46e50f=0xce;}_0x54ef63[_0x511e('0x11')](_0x46e50f);return _0x54ef63[_0x511e('0x17')](_0x511e('0x18'),_0x200f10+'-'+_0x4429e5+'/'+_0x54f912)[_0x511e('0x12')](_0x212715);}return null;};}function saveUpdates(_0x2fe8f2){return function(_0x385cfc){if(_0x385cfc){return _0x385cfc[_0x511e('0x19')](_0x2fe8f2)[_0x511e('0x1a')](function(_0x4784c2){return _0x4784c2;});}return null;};}function removeEntity(_0x3b68e8){return function(_0x1d8bc5){if(_0x1d8bc5){return _0x1d8bc5['destroy']()[_0x511e('0x1a')](function(){_0x3b68e8['status'](0xcc)[_0x511e('0x1b')]();});}};}function handleEntityNotFound(_0x28d9da){return function(_0x38c8d3){if(!_0x38c8d3){_0x28d9da['sendStatus'](0x194);}return _0x38c8d3;};}function handleError(_0x98b7e6,_0x4410e4){_0x4410e4=_0x4410e4||0x1f4;return function(_0x4a18ce){logger[_0x511e('0x1c')](_0x4a18ce['stack']);if(_0x4a18ce[_0x511e('0x1d')]){delete _0x4a18ce[_0x511e('0x1d')];}_0x98b7e6['status'](_0x4410e4)[_0x511e('0x1e')](_0x4a18ce);};}exports[_0x511e('0x1f')]=function(_0x56d758,_0x46b7aa){var _0x44b1f2={};var _0x311f3b=_[_0x511e('0x20')](db['SmsInteraction']['rawAttributes'],function(_0x5bfe21){return{'name':_0x5bfe21[_0x511e('0x21')],'type':_0x5bfe21[_0x511e('0x22')][_0x511e('0x23')]};});_0x44b1f2=qs[_0x511e('0x24')](_0x311f3b,_0x56d758);return interaction['findAll'](_0x511e('0x25'),_0x56d758[_0x511e('0x26')],_0x56d758[_0x511e('0x27')],_0x44b1f2,_0x311f3b)[_0x511e('0x1a')](respondWithFilteredResult(_0x46b7aa,_0x44b1f2))[_0x511e('0x28')](handleError(_0x46b7aa,null));};exports[_0x511e('0x29')]=function(_0x5823db,_0x541d24){var _0x28dfba={'raw':![],'where':{'id':_0x5823db[_0x511e('0x2a')]['id']}},_0x36c287={};_0x36c287[_0x511e('0x2b')]=_['keys'](db[_0x511e('0x2c')]['rawAttributes']);_0x36c287[_0x511e('0x26')]=_[_0x511e('0x2d')](_0x5823db[_0x511e('0x26')]);_0x36c287['filters']=_[_0x511e('0x2e')](_0x36c287[_0x511e('0x2b')],_0x36c287[_0x511e('0x26')]);_0x28dfba[_0x511e('0x2f')]=_['intersection'](_0x36c287[_0x511e('0x2b')],qs['fields'](_0x5823db[_0x511e('0x26')][_0x511e('0x30')]));_0x28dfba[_0x511e('0x2f')]=_0x28dfba['attributes'][_0x511e('0x31')]?_0x28dfba[_0x511e('0x2f')]:_0x36c287[_0x511e('0x2b')];if(_0x5823db[_0x511e('0x26')]['includeAll']){_0x28dfba[_0x511e('0x32')]=[{'all':!![]}];}_0x28dfba=_[_0x511e('0x33')]({},_0x28dfba,_0x5823db[_0x511e('0x34')]);return db[_0x511e('0x2c')][_0x511e('0x35')](_0x28dfba)['then'](handleEntityNotFound(_0x541d24,null))[_0x511e('0x1a')](respondWithResult(_0x541d24,null))[_0x511e('0x28')](handleError(_0x541d24,null));};exports[_0x511e('0x36')]=function(_0x4502f6,_0x4fabc1){return db[_0x511e('0x2c')][_0x511e('0x36')](_0x4502f6[_0x511e('0x37')],{})[_0x511e('0x1a')](respondWithResult(_0x4fabc1,0xc9))[_0x511e('0x28')](handleError(_0x4fabc1,null));};exports[_0x511e('0x19')]=function(_0x2b9582,_0x163573){if(_0x2b9582['body']['id']){delete _0x2b9582['body']['id'];}return db[_0x511e('0x2c')][_0x511e('0x35')]({'where':{'id':_0x2b9582['params']['id']}})['then'](handleEntityNotFound(_0x163573,null))[_0x511e('0x1a')](saveUpdates(_0x2b9582[_0x511e('0x37')],null))[_0x511e('0x1a')](respondWithResult(_0x163573,null))[_0x511e('0x28')](handleError(_0x163573,null));};exports[_0x511e('0x38')]=function(_0x277536,_0xe382ed){return db[_0x511e('0x2c')][_0x511e('0x35')]({'where':{'id':_0x277536['params']['id']}})[_0x511e('0x1a')](handleEntityNotFound(_0xe382ed,null))[_0x511e('0x1a')](removeEntity(_0xe382ed,null))[_0x511e('0x28')](handleError(_0xe382ed,null));};exports[_0x511e('0x39')]=function(_0x230231,_0x366bdd){return db[_0x511e('0x2c')][_0x511e('0x39')]()['then'](respondWithResult(_0x366bdd,null))[_0x511e('0x28')](handleError(_0x366bdd,null));};exports[_0x511e('0x3a')]=function(_0xe42253,_0x1c8703){return db[_0x511e('0x3b')][_0x511e('0x35')]({'where':{'id':_0xe42253[_0x511e('0x2a')]['id']}})[_0x511e('0x1a')](handleEntityNotFound(_0x1c8703,null))[_0x511e('0x1a')](function(_0x1891b4){if(_0x1891b4){return _0x1891b4['addMessage'](_0xe42253['body']['ids'],_[_0x511e('0x3c')](_0xe42253[_0x511e('0x37')],[_0x511e('0x3d'),'id'])||{});}})[_0x511e('0x1a')](respondWithResult(_0x1c8703,null))[_0x511e('0x28')](handleError(_0x1c8703,null));};exports[_0x511e('0x3e')]=function(_0x3b915f,_0x3c3e97){var _0xaf151f={'raw':![],'where':{}};var _0x533048={};var _0x4fe6ec={'count':0x0,'rows':[]};return db['SmsInteraction'][_0x511e('0x3f')]({'where':{'id':_0x3b915f['params']['id']}})[_0x511e('0x1a')](handleEntityNotFound(_0x3c3e97,null))[_0x511e('0x1a')](function(_0x1cc704){if(_0x1cc704){_0x533048[_0x511e('0x2b')]=_[_0x511e('0x2d')](db['SmsMessage']['rawAttributes']);_0x533048[_0x511e('0x26')]=_['keys'](_0x3b915f['query']);_0x533048[_0x511e('0x40')]=_[_0x511e('0x2e')](_0x533048['model'],_0x533048[_0x511e('0x26')]);_0xaf151f[_0x511e('0x2f')]=_[_0x511e('0x2e')](_0x533048[_0x511e('0x2b')],qs[_0x511e('0x30')](_0x3b915f[_0x511e('0x26')][_0x511e('0x30')]));_0xaf151f[_0x511e('0x2f')]=_0xaf151f['attributes'][_0x511e('0x31')]?_0xaf151f[_0x511e('0x2f')]:_0x533048['model'];if(!_0x3b915f['query'][_0x511e('0x41')](_0x511e('0x42'))){_0xaf151f[_0x511e('0x15')]=qs[_0x511e('0x15')](_0x3b915f[_0x511e('0x26')]['limit']);_0xaf151f[_0x511e('0x13')]=qs[_0x511e('0x13')](_0x3b915f['query'][_0x511e('0x13')]);}_0xaf151f[_0x511e('0x43')]=qs[_0x511e('0x44')](_0x3b915f[_0x511e('0x26')][_0x511e('0x44')]);_0xaf151f[_0x511e('0x45')]=qs[_0x511e('0x40')](_[_0x511e('0x46')](_0x3b915f[_0x511e('0x26')],_0x533048['filters']));_0xaf151f[_0x511e('0x45')][_0x511e('0x47')]=_0x1cc704['id'];if(_0x3b915f['query'][_0x511e('0x48')]){_0xaf151f[_0x511e('0x45')]=_['merge'](_0xaf151f[_0x511e('0x45')],{'$or':_['map'](_0xaf151f[_0x511e('0x2f')],function(_0x15969e){var _0x590208={};_0x590208[_0x15969e]={'$like':'%'+_0x3b915f['query'][_0x511e('0x48')]+'%'};return _0x590208;})});}if(_0x3b915f[_0x511e('0x26')]['$gte']){var _0x3ac33e=_0x3b915f[_0x511e('0x26')][_0x511e('0x49')][_0x511e('0x4a')](',');var _0xd99344={};_0xd99344[_0x3ac33e[0x0]]={'$gte':moment(_0x3ac33e[0x1])[_0x511e('0x4b')](_0x511e('0x4c'))};_0xaf151f['where']=_[_0x511e('0x33')](_0xaf151f['where'],_0xd99344);}_0xaf151f=_[_0x511e('0x33')]({},_0xaf151f,_0x3b915f[_0x511e('0x34')]);return db['SmsMessage'][_0x511e('0x16')]({'where':_0xaf151f[_0x511e('0x45')]})[_0x511e('0x1a')](function(_0x403daf){_0x4fe6ec['count']=_0x403daf;if(_0x3b915f[_0x511e('0x26')][_0x511e('0x4d')]){_0xaf151f[_0x511e('0x32')]=[{'all':!![]}];}return db[_0x511e('0x3b')][_0x511e('0x4e')](_0xaf151f);})['then'](function(_0x31b007){_0x4fe6ec['rows']=_0x31b007;return _0x4fe6ec;});}})['then'](respondWithFilteredResult(_0x3c3e97,_0xaf151f))[_0x511e('0x28')](handleError(_0x3c3e97,null));};exports[_0x511e('0x4f')]=function(_0x2f9119,_0x5ce0ce){return db[_0x511e('0x2c')][_0x511e('0x35')]({'where':{'id':_0x2f9119['params']['id']}})['then'](handleEntityNotFound(_0x5ce0ce,null))[_0x511e('0x1a')](function(_0x2c9f49){if(_0x2c9f49){return _0x2c9f49[_0x511e('0x50')](_0x2f9119[_0x511e('0x37')][_0x511e('0x3d')],_[_0x511e('0x3c')](_0x2f9119[_0x511e('0x37')],[_0x511e('0x3d'),'id'])||{})[_0x511e('0x51')](function(){return db[_0x511e('0x52')]['findAll']({'attributes':['id',_0x511e('0x1d'),_0x511e('0x53')],'where':{'id':_0x2f9119['body']['ids']}});})['then'](function(_0x90b129){socket[_0x511e('0x54')]('smsInteractionTags:save',{'id':Number(_0x2f9119[_0x511e('0x2a')]['id']),'tags':_0x90b129||[]});return{'id':Number(_0x2f9119[_0x511e('0x2a')]['id']),'tags':_0x90b129||[]};});}})[_0x511e('0x1a')](respondWithResult(_0x5ce0ce,null))[_0x511e('0x28')](handleError(_0x5ce0ce,null));};exports[_0x511e('0x55')]=function(_0x5ba5ad,_0xb71ddc){return db[_0x511e('0x2c')][_0x511e('0x35')]({'where':{'id':_0x5ba5ad[_0x511e('0x2a')]['id']}})['then'](handleEntityNotFound(_0xb71ddc,null))['then'](function(_0x8e9789){if(_0x8e9789){return _0x8e9789[_0x511e('0x55')](_0x5ba5ad['query'][_0x511e('0x3d')]);}})['then'](respondWithStatusCode(_0xb71ddc,null))[_0x511e('0x28')](handleError(_0xb71ddc,null));};exports[_0x511e('0x56')]=function(_0x5da206,_0x41179f){var _0x442927=moment()[_0x511e('0x57')]()[_0x511e('0x58')]();var _0x337ab4=path[_0x511e('0x59')](config['root'],'server',_0x511e('0x5a'),'tmp');var _0x3799c2=path[_0x511e('0x59')](_0x337ab4,_0x442927);var _0x5dd657=util[_0x511e('0x4b')](_0x511e('0x5b'),_0x5da206['params']['id'],_0x442927);var _0x321d4a=path[_0x511e('0x59')](_0x337ab4,_0x5dd657);var _0x5d1579=[];_0x5d1579['push']({'model':db[_0x511e('0x5c')],'as':_0x511e('0x5c'),'attributes':['id',_0x511e('0x5d')],'raw':!![]});_0x5d1579['push']({'model':db[_0x511e('0x5e')],'as':_0x511e('0x5f'),'attributes':['id',_0x511e('0x60'),_0x511e('0x61')],'raw':!![]});var _0x2037aa=[{'model':db[_0x511e('0x3b')],'as':'Messages','attributes':['id',_0x511e('0x37'),_0x511e('0x62'),_0x511e('0x63'),'secret','read'],'include':_0x5d1579}];_0x2037aa['push']({'model':db['SmsAccount'],'as':_0x511e('0x64'),'attributes':['id',_0x511e('0x1d')]});_0x2037aa[_0x511e('0x65')]({'model':db['User'],'as':_0x511e('0x66'),'attributes':['id',_0x511e('0x5d')]});return db[_0x511e('0x2c')][_0x511e('0x35')]({'where':{'id':_0x5da206[_0x511e('0x2a')]['id']},'include':_0x2037aa})[_0x511e('0x1a')](handleEntityNotFound(_0x41179f,null))[_0x511e('0x1a')](function(_0x5cb1be){if(_0x5cb1be){var _0xe0df3f=_0x5cb1be[_0x511e('0x67')]({'plain':!![]});fs[_0x511e('0x68')](_0x3799c2);var _0x4e9c28={'channel':'Sms','account':_0xe0df3f['Account']['name'],'agent':_0xe0df3f[_0x511e('0x66')]?_0xe0df3f[_0x511e('0x66')][_0x511e('0x5d')]:'N.A.','createdAt':moment(_0xe0df3f[_0x511e('0x62')])[_0x511e('0x4b')]('YYYY-MM-DD\x20HH:mm:ss')[_0x511e('0x58')](),'closedAt':_0xe0df3f['closed']?moment(_0xe0df3f[_0x511e('0x69')])[_0x511e('0x4b')](_0x511e('0x4c'))[_0x511e('0x58')]():'','disposition':_0xe0df3f[_0x511e('0x6a')],'messages':_(_0xe0df3f[_0x511e('0x6b')])[_0x511e('0x48')]({'secret':![]})['map'](function(_0x4d554d){return{'date':moment(_0x4d554d[_0x511e('0x62')])[_0x511e('0x4b')](_0x511e('0x4c'))[_0x511e('0x58')](),'sender':_0x4d554d[_0x511e('0x63')]===_0x511e('0x6c')?_0x4d554d['User']?_0x4d554d['User']['fullname']:_0x511e('0x6d'):_0x4d554d['Contact'][_0x511e('0x60')]+(_0x4d554d[_0x511e('0x5f')][_0x511e('0x61')]?'\x20'+_0x4d554d[_0x511e('0x5f')][_0x511e('0x61')]:''),'body':_0x4d554d['body'],'direction':_0x4d554d[_0x511e('0x63')]==='out'?'A':'C','secret':_0x4d554d['secret'],'read':_0x4d554d[_0x511e('0x6e')]};})[_0x511e('0x6f')]()};return ejs[_0x511e('0x70')](path[_0x511e('0x59')](config[_0x511e('0x71')],_0x511e('0x72'),_0x511e('0x73'),_0x511e('0x74')),{'interaction':_0x4e9c28})[_0x511e('0x1a')](function(_0x1833eb){var _0x639180=path['join'](_0x3799c2,_0x511e('0x75')+_0xe0df3f['id']+'-'+_0x442927+'.pdf');var _0x98a82a={'path':_0x639180,'channel':_0x511e('0x76'),'interactionId':_0xe0df3f['id']};return pdf[_0x511e('0x77')](_0x1833eb,_0x98a82a);})[_0x511e('0x1a')](function(){return new BPromise(function(_0x4db619,_0xf5430d){zipdir(_0x3799c2,{'saveTo':_0x321d4a},function(_0x5b0006,_0x214a45){if(_0x5b0006)return _0xf5430d(_0x5b0006);return _0x4db619(_0x214a45);});})['then'](function(){return new BPromise(function(_0x1aeac6,_0x12b7dd){rimraf(_0x3799c2,function(_0x56b0dc){if(_0x56b0dc)_0x12b7dd(_0x56b0dc);return _0x1aeac6();});});})[_0x511e('0x1a')](function(){return _0x41179f[_0x511e('0x56')](_0x321d4a,_0x5dd657,function(_0x1b64e6){if(_0x1b64e6){console['log'](_0x511e('0x78'),_0x1b64e6);}else{fs[_0x511e('0x79')](_0x321d4a);}});});});}else{return _0x41179f[_0x511e('0x10')](0xc8);}})[_0x511e('0x28')](handleError(_0x41179f,null));}; \ No newline at end of file diff --git a/server/api/smsInteraction/smsInteraction.events.js b/server/api/smsInteraction/smsInteraction.events.js index 615f244..0918a17 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 _0x6a55=['setDataValue','Users','map','findAll','unreadMessages','length','emit','catch','exports','events','SmsMessage','update','getUsers','then'];(function(_0x21d17e,_0x1b0698){var _0x181433=function(_0x161661){while(--_0x161661){_0x21d17e['push'](_0x21d17e['shift']());}};_0x181433(++_0x1b0698);}(_0x6a55,0xdb));var _0x56a5=function(_0x4c12ec,_0x2e9103){_0x4c12ec=_0x4c12ec-0x0;var _0x3ae42c=_0x6a55[_0x4c12ec];return _0x3ae42c;};'use strict';var EventEmitter=require(_0x56a5('0x0'));var SmsInteraction=require('../../mysqldb')['db']['SmsInteraction'];var SmsMessage=require('../../mysqldb')['db'][_0x56a5('0x1')];var SmsInteractionEvents=new EventEmitter();SmsInteractionEvents['setMaxListeners'](0x0);var events={'afterCreate':'save','afterUpdate':_0x56a5('0x2'),'afterDestroy':'remove'};function emitEvent(_0x3ff76a){return function(_0x5171fa,_0x28bb2b,_0x380b1b){_0x5171fa[_0x56a5('0x3')]({'attributes':['id'],'raw':!![]})[_0x56a5('0x4')](function(_0x444c65){_0x5171fa[_0x56a5('0x5')](_0x56a5('0x6'),_0x444c65[_0x56a5('0x7')](function(_0x586f7a){return{'id':_0x586f7a['id']};}));return SmsMessage[_0x56a5('0x8')]({'where':{'SmsInteractionId':_0x5171fa['id'],'direction':'in','read':![]},'raw':!![]});})[_0x56a5('0x4')](function(_0x3c8283){_0x5171fa[_0x56a5('0x5')](_0x56a5('0x9'),_0x3c8283[_0x56a5('0xa')]);SmsInteractionEvents[_0x56a5('0xb')](_0x3ff76a+':'+_0x5171fa['id'],_0x5171fa);SmsInteractionEvents[_0x56a5('0xb')](_0x3ff76a,_0x5171fa);_0x380b1b(null);})[_0x56a5('0xc')](_0x380b1b(null));};}for(var e in events){if(events['hasOwnProperty'](e)){var event=events[e];SmsInteraction['hook'](e,emitEvent(event));}}module[_0x56a5('0xd')]=SmsInteractionEvents; \ No newline at end of file +var _0x4cf8=['unreadMessages','length','emit','catch','exports','events','../../mysqldb','SmsInteraction','SmsMessage','setMaxListeners','save','update','remove','then','setDataValue','Users','findAll'];(function(_0x137ac2,_0x3a3615){var _0x2df1d1=function(_0x3406ff){while(--_0x3406ff){_0x137ac2['push'](_0x137ac2['shift']());}};_0x2df1d1(++_0x3a3615);}(_0x4cf8,0x1e1));var _0x84cf=function(_0x1f71d8,_0x278518){_0x1f71d8=_0x1f71d8-0x0;var _0x10b045=_0x4cf8[_0x1f71d8];return _0x10b045;};'use strict';var EventEmitter=require(_0x84cf('0x0'));var SmsInteraction=require(_0x84cf('0x1'))['db'][_0x84cf('0x2')];var SmsMessage=require(_0x84cf('0x1'))['db'][_0x84cf('0x3')];var SmsInteractionEvents=new EventEmitter();SmsInteractionEvents[_0x84cf('0x4')](0x0);var events={'afterCreate':_0x84cf('0x5'),'afterUpdate':_0x84cf('0x6'),'afterDestroy':_0x84cf('0x7')};function emitEvent(_0x2d38c0){return function(_0x5844d7,_0x2c613d,_0x50ade2){_0x5844d7['getUsers']({'attributes':['id'],'raw':!![]})[_0x84cf('0x8')](function(_0x56c5cc){_0x5844d7[_0x84cf('0x9')](_0x84cf('0xa'),_0x56c5cc['map'](function(_0x2e0b79){return{'id':_0x2e0b79['id']};}));return SmsMessage[_0x84cf('0xb')]({'where':{'SmsInteractionId':_0x5844d7['id'],'direction':'in','read':![]},'raw':!![]});})['then'](function(_0xfb5398){_0x5844d7[_0x84cf('0x9')](_0x84cf('0xc'),_0xfb5398[_0x84cf('0xd')]);SmsInteractionEvents['emit'](_0x2d38c0+':'+_0x5844d7['id'],_0x5844d7);SmsInteractionEvents[_0x84cf('0xe')](_0x2d38c0,_0x5844d7);_0x50ade2(null);})[_0x84cf('0xf')](_0x50ade2(null));};}for(var e in events){if(events['hasOwnProperty'](e)){var event=events[e];SmsInteraction['hook'](e,emitEvent(event));}}module[_0x84cf('0x10')]=SmsInteractionEvents; \ No newline at end of file diff --git a/server/api/smsInteraction/smsInteraction.model.js b/server/api/smsInteraction/smsInteraction.model.js index eb2fc5a..691b7f7 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 _0xf484=['rimraf','../../config/environment','exports','SmsInteraction','closedAt','YYYY-MM-DD\x20HH:mm:ss','lodash','util','api','moment','bluebird','request-promise'];(function(_0x5160da,_0x3aa93d){var _0x4647ec=function(_0x3354c3){while(--_0x3354c3){_0x5160da['push'](_0x5160da['shift']());}};_0x4647ec(++_0x3aa93d);}(_0xf484,0x162));var _0x4f48=function(_0x59ee6f,_0x450239){_0x59ee6f=_0x59ee6f-0x0;var _0x4c0979=_0xf484[_0x59ee6f];return _0x4c0979;};'use strict';var _=require(_0x4f48('0x0'));var util=require(_0x4f48('0x1'));var logger=require('../../config/logger')(_0x4f48('0x2'));var moment=require(_0x4f48('0x3'));var BPromise=require(_0x4f48('0x4'));var rp=require(_0x4f48('0x5'));var fs=require('fs');var path=require('path');var rimraf=require(_0x4f48('0x6'));var config=require(_0x4f48('0x7'));var attributes=require('./smsInteraction.attributes');module[_0x4f48('0x8')]=function(_0x8233e9,_0x485a2){return _0x8233e9['define'](_0x4f48('0x9'),attributes,{'tableName':'sms_interactions','paranoid':![],'indexes':[],'timestamps':!![],'hooks':{'beforeUpdate':function(_0x16d28b,_0x200974,_0xc32890){if(_0x16d28b['changed']('closed')){_0x16d28b[_0x4f48('0xa')]=moment()['format'](_0x4f48('0xb'));}_0xc32890(null,_0x16d28b);}}});}; \ No newline at end of file +var _0x2598=['lodash','util','../../config/logger','api','moment','request-promise','path','rimraf','../../config/environment','./smsInteraction.attributes','exports','define','SmsInteraction','sms_interactions','changed','closed'];(function(_0x49e0ae,_0xa50de){var _0x282206=function(_0x461b41){while(--_0x461b41){_0x49e0ae['push'](_0x49e0ae['shift']());}};_0x282206(++_0xa50de);}(_0x2598,0x90));var _0x8259=function(_0xd894fa,_0x3cb54c){_0xd894fa=_0xd894fa-0x0;var _0x5a397b=_0x2598[_0xd894fa];return _0x5a397b;};'use strict';var _=require(_0x8259('0x0'));var util=require(_0x8259('0x1'));var logger=require(_0x8259('0x2'))(_0x8259('0x3'));var moment=require(_0x8259('0x4'));var BPromise=require('bluebird');var rp=require(_0x8259('0x5'));var fs=require('fs');var path=require(_0x8259('0x6'));var rimraf=require(_0x8259('0x7'));var config=require(_0x8259('0x8'));var attributes=require(_0x8259('0x9'));module[_0x8259('0xa')]=function(_0x525331,_0x139bea){return _0x525331[_0x8259('0xb')](_0x8259('0xc'),attributes,{'tableName':_0x8259('0xd'),'paranoid':![],'indexes':[],'timestamps':!![],'hooks':{'beforeUpdate':function(_0x16249f,_0x317bc8,_0x1af2c2){if(_0x16249f[_0x8259('0xe')](_0x8259('0xf'))){_0x16249f['closedAt']=moment()['format']('YYYY-MM-DD\x20HH:mm:ss');}_0x1af2c2(null,_0x16249f);}}});}; \ No newline at end of file diff --git a/server/api/smsInteraction/smsInteraction.rpc.js b/server/api/smsInteraction/smsInteraction.rpc.js index 770ae83..5dd6353 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 _0x3c1a=['debug','SmsInteraction,\x20%s,\x20%s,\x20%s','stringify','error','code','message','result','catch','SmsInteraction','body','options','raw','attributes','limit','UpdateSmsInteraction','AddTagsToSmsInteraction','find','where','addTags','omit','ids','spread','AddTags','lodash','util','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','http','defaults','redis','localhost','socket.io-emitter','./smsInteraction.socket','register','request','then','info','SmsInteraction,\x20%s,\x20%s','request\x20sent'];(function(_0x31bb8b,_0x27c1f2){var _0x500214=function(_0x5bf151){while(--_0x5bf151){_0x31bb8b['push'](_0x31bb8b['shift']());}};_0x500214(++_0x27c1f2);}(_0x3c1a,0x73));var _0xa3c1=function(_0x86c6cb,_0x30bb53){_0x86c6cb=_0x86c6cb-0x0;var _0x1b1592=_0x3c1a[_0x86c6cb];return _0x1b1592;};'use strict';var _=require(_0xa3c1('0x0'));var util=require(_0xa3c1('0x1'));var moment=require(_0xa3c1('0x2'));var BPromise=require(_0xa3c1('0x3'));var rs=require(_0xa3c1('0x4'));var fs=require('fs');var Redis=require(_0xa3c1('0x5'));var db=require(_0xa3c1('0x6'))['db'];var utils=require(_0xa3c1('0x7'));var logger=require(_0xa3c1('0x8'))(_0xa3c1('0x9'));var config=require(_0xa3c1('0xa'));var jayson=require('jayson/promise');var client=jayson['client'][_0xa3c1('0xb')]({'port':0x232a});config['redis']=_[_0xa3c1('0xc')](config[_0xa3c1('0xd')],{'host':_0xa3c1('0xe'),'port':0x18eb});var socket=require(_0xa3c1('0xf'))(new Redis(config[_0xa3c1('0xd')]));require(_0xa3c1('0x10'))[_0xa3c1('0x11')](socket);function respondWithRpcPromise(_0xabeb92,_0x247ff6,_0x2d1cd7){return new BPromise(function(_0x47a216,_0x171b72){return client[_0xa3c1('0x12')](_0xabeb92,_0x2d1cd7)[_0xa3c1('0x13')](function(_0xcd1410){logger[_0xa3c1('0x14')](_0xa3c1('0x15'),_0x247ff6,_0xa3c1('0x16'));logger[_0xa3c1('0x17')](_0xa3c1('0x18'),_0x247ff6,'request\x20sent',JSON[_0xa3c1('0x19')](_0xcd1410));if(_0xcd1410[_0xa3c1('0x1a')]){if(_0xcd1410['error'][_0xa3c1('0x1b')]===0x1f4){logger[_0xa3c1('0x1a')]('SmsInteraction,\x20%s,\x20%s',_0x247ff6,_0xcd1410[_0xa3c1('0x1a')][_0xa3c1('0x1c')]);return _0x171b72(_0xcd1410[_0xa3c1('0x1a')][_0xa3c1('0x1c')]);}logger['error'](_0xa3c1('0x15'),_0x247ff6,_0xcd1410[_0xa3c1('0x1a')]['message']);return _0x47a216(_0xcd1410[_0xa3c1('0x1a')]['message']);}else{logger['info'](_0xa3c1('0x15'),_0x247ff6,_0xa3c1('0x16'));_0x47a216(_0xcd1410[_0xa3c1('0x1d')][_0xa3c1('0x1c')]);}})[_0xa3c1('0x1e')](function(_0x400b81){logger['error'](_0xa3c1('0x15'),_0x247ff6,_0x400b81);_0x171b72(_0x400b81);});});}exports['UpdateSmsInteraction']=function(_0x5786a7){var _0x215caf=this;return new Promise(function(_0x28c969,_0x4a6c2e){return db[_0xa3c1('0x1f')]['update'](_0x5786a7[_0xa3c1('0x20')],{'raw':_0x5786a7[_0xa3c1('0x21')]?_0x5786a7['options'][_0xa3c1('0x22')]===undefined?!![]:![]:!![],'individualHooks':!![],'where':_0x5786a7[_0xa3c1('0x21')]?_0x5786a7[_0xa3c1('0x21')]['where']||null:null,'attributes':_0x5786a7[_0xa3c1('0x21')]?_0x5786a7[_0xa3c1('0x21')][_0xa3c1('0x23')]||null:null,'limit':_0x5786a7[_0xa3c1('0x21')]?_0x5786a7[_0xa3c1('0x21')][_0xa3c1('0x24')]||null:null})[_0xa3c1('0x13')](function(_0x48303a){logger[_0xa3c1('0x14')]('UpdateSmsInteraction',_0x5786a7);logger[_0xa3c1('0x17')](_0xa3c1('0x25'),_0x5786a7,JSON[_0xa3c1('0x19')](_0x48303a));_0x28c969(_0x48303a);})[_0xa3c1('0x1e')](function(_0xdf994e){logger['error'](_0xa3c1('0x25'),_0xdf994e[_0xa3c1('0x1c')],_0x5786a7);_0x4a6c2e(_0x215caf[_0xa3c1('0x1a')](0x1f4,_0xdf994e[_0xa3c1('0x1c')]));});});};exports[_0xa3c1('0x26')]=function(_0x76b67d){return new Promise(function(_0x3eb5ee,_0x1dcf08){return db[_0xa3c1('0x1f')][_0xa3c1('0x27')]({'where':_0x76b67d[_0xa3c1('0x21')]?_0x76b67d['options'][_0xa3c1('0x28')]||null:null})['then'](function(_0x8333db){if(_0x8333db){return _0x8333db[_0xa3c1('0x29')](_0x76b67d[_0xa3c1('0x20')]['ids'],_[_0xa3c1('0x2a')](_0x76b67d['body'],[_0xa3c1('0x2b'),'id'])||{});}})[_0xa3c1('0x2c')](function(_0x108fe3){logger[_0xa3c1('0x14')](_0xa3c1('0x2d'),_0x76b67d);logger[_0xa3c1('0x17')](_0xa3c1('0x2d'),_0x76b67d,JSON['stringify'](_0x108fe3));_0x3eb5ee(_0x108fe3);})[_0xa3c1('0x1e')](function(_0x6ed620){logger[_0xa3c1('0x1a')]('AddTags',_0x6ed620[_0xa3c1('0x1c')],_0x76b67d);_0x1dcf08(_this[_0xa3c1('0x1a')](0x1f4,_0x6ed620[_0xa3c1('0x1c')]));});});}; \ No newline at end of file +var _0x680e=['randomstring','ioredis','../../mysqldb','../../config/utils','jayson/promise','client','redis','defaults','localhost','socket.io-emitter','./smsInteraction.socket','register','request','info','request\x20sent','SmsInteraction,\x20%s,\x20%s,\x20%s','stringify','error','code','SmsInteraction,\x20%s,\x20%s','message','result','catch','UpdateSmsInteraction','body','options','where','attributes','then','debug','AddTagsToSmsInteraction','SmsInteraction','find','addTags','ids','omit','spread','util','moment','bluebird'];(function(_0x22b990,_0xd6b6fe){var _0x18e7e5=function(_0x361c25){while(--_0x361c25){_0x22b990['push'](_0x22b990['shift']());}};_0x18e7e5(++_0xd6b6fe);}(_0x680e,0x18d));var _0xe680=function(_0x529c4a,_0x576b39){_0x529c4a=_0x529c4a-0x0;var _0x2af6cc=_0x680e[_0x529c4a];return _0x2af6cc;};'use strict';var _=require('lodash');var util=require(_0xe680('0x0'));var moment=require(_0xe680('0x1'));var BPromise=require(_0xe680('0x2'));var rs=require(_0xe680('0x3'));var fs=require('fs');var Redis=require(_0xe680('0x4'));var db=require(_0xe680('0x5'))['db'];var utils=require(_0xe680('0x6'));var logger=require('../../config/logger')('rpc');var config=require('../../config/environment');var jayson=require(_0xe680('0x7'));var client=jayson[_0xe680('0x8')]['http']({'port':0x232a});config[_0xe680('0x9')]=_[_0xe680('0xa')](config[_0xe680('0x9')],{'host':_0xe680('0xb'),'port':0x18eb});var socket=require(_0xe680('0xc'))(new Redis(config['redis']));require(_0xe680('0xd'))[_0xe680('0xe')](socket);function respondWithRpcPromise(_0x489500,_0xee02b1,_0x32fd39){return new BPromise(function(_0x443ca9,_0xb71dbc){return client[_0xe680('0xf')](_0x489500,_0x32fd39)['then'](function(_0x5d3cc1){logger[_0xe680('0x10')]('SmsInteraction,\x20%s,\x20%s',_0xee02b1,_0xe680('0x11'));logger['debug'](_0xe680('0x12'),_0xee02b1,_0xe680('0x11'),JSON[_0xe680('0x13')](_0x5d3cc1));if(_0x5d3cc1[_0xe680('0x14')]){if(_0x5d3cc1[_0xe680('0x14')][_0xe680('0x15')]===0x1f4){logger[_0xe680('0x14')](_0xe680('0x16'),_0xee02b1,_0x5d3cc1[_0xe680('0x14')]['message']);return _0xb71dbc(_0x5d3cc1[_0xe680('0x14')]['message']);}logger[_0xe680('0x14')]('SmsInteraction,\x20%s,\x20%s',_0xee02b1,_0x5d3cc1[_0xe680('0x14')]['message']);return _0x443ca9(_0x5d3cc1[_0xe680('0x14')][_0xe680('0x17')]);}else{logger[_0xe680('0x10')](_0xe680('0x16'),_0xee02b1,_0xe680('0x11'));_0x443ca9(_0x5d3cc1[_0xe680('0x18')][_0xe680('0x17')]);}})[_0xe680('0x19')](function(_0x29e9a0){logger[_0xe680('0x14')](_0xe680('0x16'),_0xee02b1,_0x29e9a0);_0xb71dbc(_0x29e9a0);});});}exports[_0xe680('0x1a')]=function(_0x44ec6c){var _0x420843=this;return new Promise(function(_0x54c29a,_0x4008a9){return db['SmsInteraction']['update'](_0x44ec6c[_0xe680('0x1b')],{'raw':_0x44ec6c[_0xe680('0x1c')]?_0x44ec6c['options']['raw']===undefined?!![]:![]:!![],'individualHooks':!![],'where':_0x44ec6c[_0xe680('0x1c')]?_0x44ec6c[_0xe680('0x1c')][_0xe680('0x1d')]||null:null,'attributes':_0x44ec6c[_0xe680('0x1c')]?_0x44ec6c[_0xe680('0x1c')][_0xe680('0x1e')]||null:null,'limit':_0x44ec6c[_0xe680('0x1c')]?_0x44ec6c['options']['limit']||null:null})[_0xe680('0x1f')](function(_0x33c7b8){logger[_0xe680('0x10')](_0xe680('0x1a'),_0x44ec6c);logger[_0xe680('0x20')](_0xe680('0x1a'),_0x44ec6c,JSON[_0xe680('0x13')](_0x33c7b8));_0x54c29a(_0x33c7b8);})['catch'](function(_0x1efe5d){logger[_0xe680('0x14')](_0xe680('0x1a'),_0x1efe5d['message'],_0x44ec6c);_0x4008a9(_0x420843[_0xe680('0x14')](0x1f4,_0x1efe5d[_0xe680('0x17')]));});});};exports[_0xe680('0x21')]=function(_0x394cc4){return new Promise(function(_0x5a8a69,_0x1f1f03){return db[_0xe680('0x22')][_0xe680('0x23')]({'where':_0x394cc4[_0xe680('0x1c')]?_0x394cc4[_0xe680('0x1c')][_0xe680('0x1d')]||null:null})['then'](function(_0x2ea58c){if(_0x2ea58c){return _0x2ea58c[_0xe680('0x24')](_0x394cc4[_0xe680('0x1b')][_0xe680('0x25')],_[_0xe680('0x26')](_0x394cc4['body'],[_0xe680('0x25'),'id'])||{});}})[_0xe680('0x27')](function(_0x33b65a){logger['info']('AddTags',_0x394cc4);logger[_0xe680('0x20')]('AddTags',_0x394cc4,JSON[_0xe680('0x13')](_0x33b65a));_0x5a8a69(_0x33b65a);})[_0xe680('0x19')](function(_0x34e98b){logger['error']('AddTags',_0x34e98b[_0xe680('0x17')],_0x394cc4);_0x1f1f03(_this[_0xe680('0x14')](0x1f4,_0x34e98b[_0xe680('0x17')]));});});}; \ No newline at end of file diff --git a/server/api/smsInteraction/smsInteraction.socket.js b/server/api/smsInteraction/smsInteraction.socket.js index 1a3b985..1dc6619 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 _0x883d=['emit','removeListener','register','length','smsInteraction:','update'];(function(_0x39e9b9,_0x1490f9){var _0x23dd9a=function(_0x138d07){while(--_0x138d07){_0x39e9b9['push'](_0x39e9b9['shift']());}};_0x23dd9a(++_0x1490f9);}(_0x883d,0xb9));var _0xd883=function(_0xaf6a43,_0x4720ae){_0xaf6a43=_0xaf6a43-0x0;var _0x4392dc=_0x883d[_0xaf6a43];return _0x4392dc;};'use strict';var SmsInteractionEvents=require('./smsInteraction.events');var events=['save','remove',_0xd883('0x0')];function createListener(_0x3c1c88,_0x2ed685){return function(_0x3ca9c2){_0x2ed685[_0xd883('0x1')](_0x3c1c88,_0x3ca9c2);};}function removeListener(_0x9eb4a1,_0x51bd9b){return function(){SmsInteractionEvents[_0xd883('0x2')](_0x9eb4a1,_0x51bd9b);};}exports[_0xd883('0x3')]=function(_0x4d12b5){for(var _0x4db1cb=0x0,_0x2c6f4f=events[_0xd883('0x4')];_0x4db1cb<_0x2c6f4f;_0x4db1cb++){var _0x108af7=events[_0x4db1cb];var _0x13d40f=createListener(_0xd883('0x5')+_0x108af7,_0x4d12b5);SmsInteractionEvents['on'](_0x108af7,_0x13d40f);}}; \ No newline at end of file +var _0x4806=['removeListener','register','length','smsInteraction:','./smsInteraction.events','save','update','emit'];(function(_0x3aa567,_0x308325){var _0x3b436b=function(_0x20d71f){while(--_0x20d71f){_0x3aa567['push'](_0x3aa567['shift']());}};_0x3b436b(++_0x308325);}(_0x4806,0x114));var _0x6480=function(_0x409b52,_0x51134a){_0x409b52=_0x409b52-0x0;var _0x528340=_0x4806[_0x409b52];return _0x528340;};'use strict';var SmsInteractionEvents=require(_0x6480('0x0'));var events=[_0x6480('0x1'),'remove',_0x6480('0x2')];function createListener(_0x2172a2,_0x3e18d0){return function(_0x58497e){_0x3e18d0[_0x6480('0x3')](_0x2172a2,_0x58497e);};}function removeListener(_0x504155,_0x4918ab){return function(){SmsInteractionEvents[_0x6480('0x4')](_0x504155,_0x4918ab);};}exports[_0x6480('0x5')]=function(_0x68b27a){for(var _0x2b6733=0x0,_0x160772=events[_0x6480('0x6')];_0x2b6733<_0x160772;_0x2b6733++){var _0x44be27=events[_0x2b6733];var _0x3f0eda=createListener(_0x6480('0x7')+_0x44be27,_0x68b27a);SmsInteractionEvents['on'](_0x44be27,_0x3f0eda);}}; \ No newline at end of file diff --git a/server/api/smsMessage/index.js b/server/api/smsMessage/index.js index 24b6dcf..46b6492 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 _0xfe56=['./smsMessage.controller','get','isAuthenticated','index','/:id','show','sms','smsmessage:create','create','post','status','update','put','accept','/:id/reject','reject','delete','destroy','exports','multer','util','path','connect-timeout','express','Router','../../components/auth/service','../../components/interaction/service'];(function(_0x3ea5b0,_0x3916b7){var _0x4be3d7=function(_0x43a3c5){while(--_0x43a3c5){_0x3ea5b0['push'](_0x3ea5b0['shift']());}};_0x4be3d7(++_0x3916b7);}(_0xfe56,0x9a));var _0x6fe5=function(_0x20a584,_0xe384a5){_0x20a584=_0x20a584-0x0;var _0x4b41a8=_0xfe56[_0x20a584];return _0x4b41a8;};'use strict';var multer=require(_0x6fe5('0x0'));var util=require(_0x6fe5('0x1'));var path=require(_0x6fe5('0x2'));var timeout=require(_0x6fe5('0x3'));var express=require(_0x6fe5('0x4'));var router=express[_0x6fe5('0x5')]();var fs_extra=require('fs-extra');var auth=require(_0x6fe5('0x6'));var interaction=require(_0x6fe5('0x7'));var config=require('../../config/environment');var controller=require(_0x6fe5('0x8'));router[_0x6fe5('0x9')]('/',auth[_0x6fe5('0xa')](),controller[_0x6fe5('0xb')]);router[_0x6fe5('0x9')]('/describe',auth[_0x6fe5('0xa')](),controller['describe']);router[_0x6fe5('0x9')](_0x6fe5('0xc'),auth[_0x6fe5('0xa')](),controller[_0x6fe5('0xd')]);router['post']('/',auth['isAuthenticated'](),interaction['tracked'](_0x6fe5('0xe'),_0x6fe5('0xf')),controller[_0x6fe5('0x10')]);router[_0x6fe5('0x11')]('/:id/status',controller[_0x6fe5('0x12')]);router['put'](_0x6fe5('0xc'),auth[_0x6fe5('0xa')](),controller[_0x6fe5('0x13')]);router[_0x6fe5('0x14')]('/:id/accept',auth[_0x6fe5('0xa')](),controller[_0x6fe5('0x15')]);router['put'](_0x6fe5('0x16'),auth[_0x6fe5('0xa')](),controller[_0x6fe5('0x17')]);router[_0x6fe5('0x18')]('/:id',auth['isAuthenticated'](),controller[_0x6fe5('0x19')]);module[_0x6fe5('0x1a')]=router; \ No newline at end of file +var _0x5943=['accept','/:id/reject','reject','delete','destroy','multer','util','path','connect-timeout','express','Router','fs-extra','../../components/auth/service','./smsMessage.controller','isAuthenticated','index','get','/describe','describe','post','sms','smsmessage:create','create','/:id/status','status','/:id','update','put','/:id/accept'];(function(_0x261823,_0x101f53){var _0x2e41d8=function(_0x290760){while(--_0x290760){_0x261823['push'](_0x261823['shift']());}};_0x2e41d8(++_0x101f53);}(_0x5943,0x1f2));var _0x3594=function(_0x4f4b76,_0x316555){_0x4f4b76=_0x4f4b76-0x0;var _0x2b1cae=_0x5943[_0x4f4b76];return _0x2b1cae;};'use strict';var multer=require(_0x3594('0x0'));var util=require(_0x3594('0x1'));var path=require(_0x3594('0x2'));var timeout=require(_0x3594('0x3'));var express=require(_0x3594('0x4'));var router=express[_0x3594('0x5')]();var fs_extra=require(_0x3594('0x6'));var auth=require(_0x3594('0x7'));var interaction=require('../../components/interaction/service');var config=require('../../config/environment');var controller=require(_0x3594('0x8'));router['get']('/',auth[_0x3594('0x9')](),controller[_0x3594('0xa')]);router[_0x3594('0xb')](_0x3594('0xc'),auth[_0x3594('0x9')](),controller[_0x3594('0xd')]);router[_0x3594('0xb')]('/:id',auth['isAuthenticated'](),controller['show']);router[_0x3594('0xe')]('/',auth[_0x3594('0x9')](),interaction['tracked'](_0x3594('0xf'),_0x3594('0x10')),controller[_0x3594('0x11')]);router[_0x3594('0xe')](_0x3594('0x12'),controller[_0x3594('0x13')]);router['put'](_0x3594('0x14'),auth[_0x3594('0x9')](),controller[_0x3594('0x15')]);router[_0x3594('0x16')](_0x3594('0x17'),auth[_0x3594('0x9')](),controller[_0x3594('0x18')]);router['put'](_0x3594('0x19'),auth[_0x3594('0x9')](),controller[_0x3594('0x1a')]);router[_0x3594('0x1b')](_0x3594('0x14'),auth[_0x3594('0x9')](),controller[_0x3594('0x1c')]);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 090ff19..87c3cb5 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 _0x674a=['out','STRING','sequelize','TEXT','medium','BOOLEAN'];(function(_0x595670,_0x3573cb){var _0x1bb65e=function(_0x12dd81){while(--_0x12dd81){_0x595670['push'](_0x595670['shift']());}};_0x1bb65e(++_0x3573cb);}(_0x674a,0x1a0));var _0xa674=function(_0x2c2cfe,_0x2ef2b1){_0x2c2cfe=_0x2c2cfe-0x0;var _0xbbd474=_0x674a[_0x2c2cfe];return _0xbbd474;};'use strict';var Sequelize=require(_0xa674('0x0'));module['exports']={'body':{'type':Sequelize[_0xa674('0x1')](_0xa674('0x2')),'allowNull':![]},'read':{'type':Sequelize[_0xa674('0x3')],'defaultValue':![]},'direction':{'type':Sequelize['ENUM']('in',_0xa674('0x4')),'defaultValue':'out','allowNull':![]},'messageId':{'type':Sequelize[_0xa674('0x5')](0xbe)},'phone':{'type':Sequelize[_0xa674('0x5')]},'readAt':{'type':Sequelize['DATE']},'secret':{'type':Sequelize[_0xa674('0x3')],'defaultValue':![]},'providerName':{'type':Sequelize[_0xa674('0x5')]},'providerResponse':{'type':Sequelize[_0xa674('0x1')]}}; \ No newline at end of file +var _0xf3ff=['medium','BOOLEAN','ENUM','out','STRING','DATE','sequelize','TEXT'];(function(_0x3eada2,_0x347959){var _0x47e14b=function(_0x5de915){while(--_0x5de915){_0x3eada2['push'](_0x3eada2['shift']());}};_0x47e14b(++_0x347959);}(_0xf3ff,0xae));var _0xff3f=function(_0x4bb8e8,_0x4dd992){_0x4bb8e8=_0x4bb8e8-0x0;var _0x40db0b=_0xf3ff[_0x4bb8e8];return _0x40db0b;};'use strict';var Sequelize=require(_0xff3f('0x0'));module['exports']={'body':{'type':Sequelize[_0xff3f('0x1')](_0xff3f('0x2')),'allowNull':![]},'read':{'type':Sequelize[_0xff3f('0x3')],'defaultValue':![]},'direction':{'type':Sequelize[_0xff3f('0x4')]('in',_0xff3f('0x5')),'defaultValue':_0xff3f('0x5'),'allowNull':![]},'messageId':{'type':Sequelize['STRING'](0xbe)},'phone':{'type':Sequelize[_0xff3f('0x6')]},'readAt':{'type':Sequelize[_0xff3f('0x7')]},'secret':{'type':Sequelize[_0xff3f('0x3')],'defaultValue':![]},'providerName':{'type':Sequelize['STRING']},'providerResponse':{'type':Sequelize[_0xff3f('0x1')]}}; \ No newline at end of file diff --git a/server/api/smsMessage/smsMessage.controller.js b/server/api/smsMessage/smsMessage.controller.js index 219dddb..2034f47 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 _0x3588=['../../components/auth/service','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','redis','defaults','localhost','socket.io-emitter','./smsMessage.socket','register','http','request','then','SmsMessage,\x20%s,\x20%s','request\x20sent','SmsMessage,\x20%s,\x20%s,\x20%s','stringify','error','message','info','result','catch','sendStatus','status','end','json','offset','undefined','limit','count','set','Content-Range','apply','reject','save','update','destroy','stack','name','send','index','SmsMessage','rawAttributes','fieldName','key','model','map','query','keys','filters','intersection','attributes','fields','length','hasOwnProperty','order','where','pick','filter','merge','options','includeAll','findAll','rows','show','params','include','find','create','body','accept','read','YYYY-MM-DD\x20HH:mm:ss','UserId','user','agent','get','SmsInteraction','SmsInteractionId','isNil','format','interaction','[SMSMESSAGE:ACCEPT]\x20id=%s\x20name=%s\x20role=%s\x20interaction=%s\x20body=%s','role','AcceptMessage','acceptMessage','SELECT\x20*\x20FROM\x20cm_contacts\x20WHERE\x20id\x20=\x20','ContactId','sequelize','Sequelize','QueryTypes','SELECT','contact','User','fullname','email','manual','interface','SIP/%s','channel','event','EventManager','acceptmessage','RejectMessage','rejectMessage','internal','motionChannel','SmsAccount','debug','received\x20delivery\x20report\x20from','type','MessageSid','messageId','SmsAccount,\x20%s,\x20%s,\x20%s','inspect','plivo','MessageUUID','indexOf','sent','delivered','Status','infobip','results','groupName','DELIVERED','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','moment','bluebird','util','path','sox','to-csv','fs-extra','lodash','crypto','desk.js','querystring','papaparse'];(function(_0x2142c8,_0x3001eb){var _0x4286e9=function(_0x43d768){while(--_0x43d768){_0x2142c8['push'](_0x2142c8['shift']());}};_0x4286e9(++_0x3001eb);}(_0x3588,0x82));var _0x8358=function(_0x838813,_0x448f0f){_0x838813=_0x838813-0x0;var _0x2bd32d=_0x3588[_0x838813];return _0x2bd32d;};'use strict';var emlformat=require(_0x8358('0x0'));var rimraf=require(_0x8358('0x1'));var zipdir=require(_0x8358('0x2'));var jsonpatch=require(_0x8358('0x3'));var rp=require(_0x8358('0x4'));var moment=require(_0x8358('0x5'));var BPromise=require(_0x8358('0x6'));var Mustache=require('mustache');var util=require(_0x8358('0x7'));var path=require(_0x8358('0x8'));var sox=require(_0x8358('0x9'));var csv=require(_0x8358('0xa'));var ejs=require('ejs');var fs=require('fs');var fs_extra=require(_0x8358('0xb'));var _=require(_0x8358('0xc'));var squel=require('squel');var crypto=require(_0x8358('0xd'));var jsforce=require('jsforce');var deskjs=require(_0x8358('0xe'));var toCsv=require(_0x8358('0xa'));var querystring=require(_0x8358('0xf'));var Papa=require(_0x8358('0x10'));var Redis=require('ioredis');var authService=require(_0x8358('0x11'));var qs=require('../../components/parsers/qs');var as=require(_0x8358('0x12'));var hardwareService=require(_0x8358('0x13'));var logger=require(_0x8358('0x14'))(_0x8358('0x15'));var utils=require(_0x8358('0x16'));var config=require(_0x8358('0x17'));var licenseUtil=require(_0x8358('0x18'));var db=require(_0x8358('0x19'))['db'];config[_0x8358('0x1a')]=_[_0x8358('0x1b')](config[_0x8358('0x1a')],{'host':_0x8358('0x1c'),'port':0x18eb});var socket=require(_0x8358('0x1d'))(new Redis(config[_0x8358('0x1a')]));require(_0x8358('0x1e'))[_0x8358('0x1f')](socket);var jayson=require('jayson/promise');var client=jayson['client'][_0x8358('0x20')]({'port':0x232c});var client9002=jayson['client'][_0x8358('0x20')]({'port':0x232a});function respondWithRpcPromise(_0x4f412a,_0x585969,_0x484237,_0xc2ff8d){return new BPromise(function(_0x31d71f,_0x25b340){var _0x366a2b=_0xc2ff8d||client;return _0x366a2b[_0x8358('0x21')](_0x4f412a,_0x484237)[_0x8358('0x22')](function(_0x37f6fe){logger['info'](_0x8358('0x23'),_0x585969,_0x8358('0x24'));logger['debug'](_0x8358('0x25'),_0x585969,_0x8358('0x24'),JSON[_0x8358('0x26')](_0x37f6fe));if(_0x37f6fe[_0x8358('0x27')]){if(_0x37f6fe['error']['code']===0x1f4){logger[_0x8358('0x27')](_0x8358('0x23'),_0x585969,_0x37f6fe[_0x8358('0x27')]['message']);return _0x25b340(_0x37f6fe['error'][_0x8358('0x28')]);}logger['error'](_0x8358('0x23'),_0x585969,_0x37f6fe[_0x8358('0x27')][_0x8358('0x28')]);return _0x31d71f(_0x37f6fe[_0x8358('0x27')][_0x8358('0x28')]);}else{logger[_0x8358('0x29')](_0x8358('0x23'),_0x585969,'request\x20sent');_0x31d71f(_0x37f6fe[_0x8358('0x2a')]['message']);}})[_0x8358('0x2b')](function(_0x5d8317){logger[_0x8358('0x27')](_0x8358('0x23'),_0x585969,_0x5d8317);_0x25b340(_0x5d8317);});});}function respondWithStatusCode(_0x3a707c,_0x542499){_0x542499=_0x542499||0xcc;return function(_0x153e02){if(_0x153e02){return _0x3a707c[_0x8358('0x2c')](_0x542499);}return _0x3a707c[_0x8358('0x2d')](_0x542499)[_0x8358('0x2e')]();};}function respondWithResult(_0x2644a3,_0xc8b177){_0xc8b177=_0xc8b177||0xc8;return function(_0xb2d8c8){if(_0xb2d8c8){return _0x2644a3['status'](_0xc8b177)[_0x8358('0x2f')](_0xb2d8c8);}};}function respondWithFilteredResult(_0x3921bc,_0x334443){return function(_0x458eb9){if(_0x458eb9){var _0x460d5c=typeof _0x334443[_0x8358('0x30')]===_0x8358('0x31')&&typeof _0x334443[_0x8358('0x32')]===_0x8358('0x31');var _0x112d89=_0x458eb9[_0x8358('0x33')];var _0x2b3718=_0x460d5c?0x0:_0x334443[_0x8358('0x30')];var _0x50b14f=_0x460d5c?_0x458eb9[_0x8358('0x33')]:_0x334443['offset']+_0x334443['limit'];var _0x10da1b;if(_0x50b14f>=_0x112d89){_0x50b14f=_0x112d89;_0x10da1b=0xc8;}else{_0x10da1b=0xce;}_0x3921bc[_0x8358('0x2d')](_0x10da1b);return _0x3921bc[_0x8358('0x34')](_0x8358('0x35'),_0x2b3718+'-'+_0x50b14f+'/'+_0x112d89)['json'](_0x458eb9);}return null;};}function patchUpdates(_0x10e7f6){return function(_0x26dbaf){try{jsonpatch[_0x8358('0x36')](_0x26dbaf,_0x10e7f6,!![]);}catch(_0x505c71){return BPromise[_0x8358('0x37')](_0x505c71);}return _0x26dbaf[_0x8358('0x38')]();};}function saveUpdates(_0x207c5a,_0x22d08e){return function(_0x5d7abc){if(_0x5d7abc){return _0x5d7abc[_0x8358('0x39')](_0x207c5a)['then'](function(_0x3a394e){return _0x3a394e;});}return null;};}function removeEntity(_0x29d578,_0x2987de){return function(_0x1af9d6){if(_0x1af9d6){return _0x1af9d6[_0x8358('0x3a')]()[_0x8358('0x22')](function(){_0x29d578[_0x8358('0x2d')](0xcc)[_0x8358('0x2e')]();});}};}function handleEntityNotFound(_0x21aeae,_0x25a433){return function(_0x1fe861){if(!_0x1fe861){_0x21aeae['sendStatus'](0x194);}return _0x1fe861;};}function handleError(_0x4c020a,_0x3b4eeb){_0x3b4eeb=_0x3b4eeb||0x1f4;return function(_0x2c13f9){logger[_0x8358('0x27')](_0x2c13f9[_0x8358('0x3b')]);if(_0x2c13f9['name']){delete _0x2c13f9[_0x8358('0x3c')];}_0x4c020a[_0x8358('0x2d')](_0x3b4eeb)[_0x8358('0x3d')](_0x2c13f9);};}exports[_0x8358('0x3e')]=function(_0x45aacd,_0x3680a7){var _0x203291={},_0x4b7186={},_0x43c1b7={'count':0x0,'rows':[]};var _0x607d7b=_['map'](db[_0x8358('0x3f')][_0x8358('0x40')],function(_0x26ef7c){return{'name':_0x26ef7c[_0x8358('0x41')],'type':_0x26ef7c['type'][_0x8358('0x42')]};});_0x4b7186[_0x8358('0x43')]=_[_0x8358('0x44')](_0x607d7b,'name');_0x4b7186[_0x8358('0x45')]=_[_0x8358('0x46')](_0x45aacd[_0x8358('0x45')]);_0x4b7186[_0x8358('0x47')]=_[_0x8358('0x48')](_0x4b7186['model'],_0x4b7186['query']);_0x203291[_0x8358('0x49')]=_['intersection'](_0x4b7186[_0x8358('0x43')],qs['fields'](_0x45aacd['query'][_0x8358('0x4a')]));_0x203291[_0x8358('0x49')]=_0x203291[_0x8358('0x49')][_0x8358('0x4b')]?_0x203291[_0x8358('0x49')]:_0x4b7186[_0x8358('0x43')];if(!_0x45aacd[_0x8358('0x45')][_0x8358('0x4c')]('nolimit')){_0x203291['limit']=qs['limit'](_0x45aacd[_0x8358('0x45')][_0x8358('0x32')]);_0x203291['offset']=qs[_0x8358('0x30')](_0x45aacd[_0x8358('0x45')][_0x8358('0x30')]);}_0x203291[_0x8358('0x4d')]=qs['sort'](_0x45aacd[_0x8358('0x45')]['sort']);_0x203291[_0x8358('0x4e')]=qs['filters'](_[_0x8358('0x4f')](_0x45aacd[_0x8358('0x45')],_0x4b7186[_0x8358('0x47')]),_0x607d7b);if(_0x45aacd['query'][_0x8358('0x50')]){_0x203291[_0x8358('0x4e')]=_[_0x8358('0x51')](_0x203291[_0x8358('0x4e')],{'$or':_['map'](_0x607d7b,function(_0x5baf14){if(_0x5baf14['type']!=='VIRTUAL'){var _0x1e5356={};_0x1e5356[_0x5baf14[_0x8358('0x3c')]]={'$like':'%'+_0x45aacd[_0x8358('0x45')][_0x8358('0x50')]+'%'};return _0x1e5356;}})});}_0x203291=_[_0x8358('0x51')]({},_0x203291,_0x45aacd[_0x8358('0x52')]);var _0x5d7c41={'where':_0x203291[_0x8358('0x4e')]};return db[_0x8358('0x3f')][_0x8358('0x33')](_0x5d7c41)[_0x8358('0x22')](function(_0xf5474){_0x43c1b7[_0x8358('0x33')]=_0xf5474;if(_0x45aacd[_0x8358('0x45')][_0x8358('0x53')]){_0x203291['include']=[{'all':!![]}];}return db[_0x8358('0x3f')][_0x8358('0x54')](_0x203291);})['then'](function(_0x5709e3){_0x43c1b7[_0x8358('0x55')]=_0x5709e3;return _0x43c1b7;})['then'](respondWithFilteredResult(_0x3680a7,_0x203291))[_0x8358('0x2b')](handleError(_0x3680a7,null));};exports[_0x8358('0x56')]=function(_0x1bae18,_0x182dcc){var _0x21bbe8={'raw':!![],'where':{'id':_0x1bae18[_0x8358('0x57')]['id']}},_0x2b8f56={};_0x2b8f56[_0x8358('0x43')]=_['keys'](db[_0x8358('0x3f')][_0x8358('0x40')]);_0x2b8f56[_0x8358('0x45')]=_['keys'](_0x1bae18[_0x8358('0x45')]);_0x2b8f56[_0x8358('0x47')]=_[_0x8358('0x48')](_0x2b8f56[_0x8358('0x43')],_0x2b8f56[_0x8358('0x45')]);_0x21bbe8['attributes']=_[_0x8358('0x48')](_0x2b8f56['model'],qs[_0x8358('0x4a')](_0x1bae18['query'][_0x8358('0x4a')]));_0x21bbe8['attributes']=_0x21bbe8[_0x8358('0x49')]['length']?_0x21bbe8[_0x8358('0x49')]:_0x2b8f56[_0x8358('0x43')];if(_0x1bae18['query']['includeAll']){_0x21bbe8[_0x8358('0x58')]=[{'all':!![]}];}_0x21bbe8=_[_0x8358('0x51')]({},_0x21bbe8,_0x1bae18[_0x8358('0x52')]);return db[_0x8358('0x3f')][_0x8358('0x59')](_0x21bbe8)[_0x8358('0x22')](handleEntityNotFound(_0x182dcc,null))[_0x8358('0x22')](respondWithResult(_0x182dcc,null))[_0x8358('0x2b')](handleError(_0x182dcc,null));};exports[_0x8358('0x5a')]=function(_0x41e2ed,_0x4bc249){return db[_0x8358('0x3f')][_0x8358('0x5a')](_0x41e2ed[_0x8358('0x5b')],{})[_0x8358('0x22')](respondWithResult(_0x4bc249,0xc9))['catch'](handleError(_0x4bc249,null));};exports[_0x8358('0x39')]=function(_0x5ee2da,_0x5c449a){if(_0x5ee2da[_0x8358('0x5b')]['id']){delete _0x5ee2da['body']['id'];}return db[_0x8358('0x3f')]['find']({'where':{'id':_0x5ee2da[_0x8358('0x57')]['id']}})['then'](handleEntityNotFound(_0x5c449a,null))[_0x8358('0x22')](saveUpdates(_0x5ee2da['body'],null))[_0x8358('0x22')](respondWithResult(_0x5c449a,null))['catch'](handleError(_0x5c449a,null));};exports[_0x8358('0x3a')]=function(_0x5d1e12,_0x32b500){return db[_0x8358('0x3f')][_0x8358('0x59')]({'where':{'id':_0x5d1e12[_0x8358('0x57')]['id']}})[_0x8358('0x22')](handleEntityNotFound(_0x32b500,null))['then'](removeEntity(_0x32b500,null))[_0x8358('0x2b')](handleError(_0x32b500,null));};exports['describe']=function(_0x3009b0,_0x5bc672){return db[_0x8358('0x3f')]['describe']()[_0x8358('0x22')](respondWithResult(_0x5bc672,null))[_0x8358('0x2b')](handleError(_0x5bc672,null));};var interaction_log=require(_0x8358('0x14'))('sms-interactions');exports[_0x8358('0x5c')]=function(_0x3fa09d,_0x4c804c,_0x5b56ef){var _0x42422b={'agent':{},'channel':'sms'};if(_0x3fa09d[_0x8358('0x5b')]['id']){delete _0x3fa09d[_0x8358('0x5b')]['id'];}_0x3fa09d[_0x8358('0x5b')][_0x8358('0x5d')]=!![];_0x3fa09d['body']['readAt']=moment()['format'](_0x8358('0x5e'));_0x3fa09d[_0x8358('0x5b')][_0x8358('0x5f')]=_0x3fa09d[_0x8358('0x5b')]['UserId']||_0x3fa09d[_0x8358('0x60')]['id'];_0x42422b[_0x8358('0x61')]['id']=_0x3fa09d['body'][_0x8358('0x5f')];return db['SmsMessage'][_0x8358('0x59')]({'where':{'id':_0x3fa09d[_0x8358('0x57')]['id'],'UserId':null}})['then'](handleEntityNotFound(_0x4c804c,null))[_0x8358('0x22')](saveUpdates(_0x3fa09d['body'],null))[_0x8358('0x22')](function(_0x5d71c5){if(_0x5d71c5){_0x42422b['message']=_0x5d71c5[_0x8358('0x62')]({'plain':!![]});return db[_0x8358('0x63')][_0x8358('0x59')]({'where':{'id':_0x5d71c5[_0x8358('0x64')]}});}return null;})[_0x8358('0x22')](handleEntityNotFound(_0x4c804c,null))['then'](function(_0x15eacd){if(_0x15eacd){return _0x15eacd[_0x8358('0x39')]({'UserId':_0x3fa09d[_0x8358('0x5b')]['UserId'],'read1stAt':_[_0x8358('0x65')](_0x15eacd['read1stAt'])?moment()[_0x8358('0x66')](_0x8358('0x5e')):undefined});}return null;})[_0x8358('0x22')](function(_0x284625){if(_0x284625){_0x42422b[_0x8358('0x67')]=_0x284625[_0x8358('0x62')]({'plain':!![]});interaction_log[_0x8358('0x29')](_0x8358('0x68'),_0x3fa09d[_0x8358('0x60')]['id'],_0x3fa09d[_0x8358('0x60')]['name'],_0x3fa09d[_0x8358('0x60')][_0x8358('0x69')],_0x42422b[_0x8358('0x67')]['id'],_0x3fa09d[_0x8358('0x5b')]?JSON[_0x8358('0x26')](_0x3fa09d[_0x8358('0x5b')]):'null');return respondWithRpcPromise(_0x8358('0x6a'),_0x8358('0x6b'),_0x42422b);}return null;})[_0x8358('0x22')](function(_0x5375a5){var _0x5a6d8a=_0x8358('0x6c')+_0x5375a5[_0x8358('0x28')][_0x8358('0x6d')];return db[_0x8358('0x6e')]['query'](_0x5a6d8a,{'type':db[_0x8358('0x6f')][_0x8358('0x70')][_0x8358('0x71')],'raw':!![]})[_0x8358('0x22')](function(_0x28f8de){return _0x28f8de;});})[_0x8358('0x22')](function(_0x43cb9a){if(_0x43cb9a){_0x42422b[_0x8358('0x28')][_0x8358('0x72')]=_0x43cb9a[0x0];if(!_0x3fa09d['body'][_0x8358('0x5f')])return;return db[_0x8358('0x73')][_0x8358('0x59')]({'where':{'id':_0x3fa09d[_0x8358('0x5b')][_0x8358('0x5f')],'role':_0x8358('0x61')},'attributes':['id',_0x8358('0x3c'),_0x8358('0x74'),_0x8358('0x75'),'internal'],'raw':!![]});}return null;})['then'](function(_0x4f856d){if(!_0x4f856d)return null;_0x42422b['message'][_0x8358('0x61')]=_0x4f856d;return _0x42422b;})[_0x8358('0x22')](function(_0x27f100){if(_0x27f100){if(_0x3fa09d[_0x8358('0x5b')][_0x8358('0x76')]){_0x42422b[_0x8358('0x28')][_0x8358('0x77')]=util[_0x8358('0x66')](_0x8358('0x78'),_0x3fa09d[_0x8358('0x60')]['name']);_0x42422b['message'][_0x8358('0x79')]=_0x42422b[_0x8358('0x79')];_0x42422b[_0x8358('0x28')]['motionChannel']=_0x42422b[_0x8358('0x79')];_0x42422b[_0x8358('0x28')][_0x8358('0x7a')]=_0x8358('0x5c');return respondWithRpcPromise(_0x8358('0x7b'),'EventManager',{'event':_0x8358('0x7c'),'message':_0x42422b[_0x8358('0x28')]},client9002)[_0x8358('0x22')](function(){return _0x42422b;});}return _0x42422b;}return null;})['then'](respondWithResult(_0x4c804c,null))['catch'](handleError(_0x4c804c,null));};var interaction_log=require('../../config/logger')('sms-interactions');exports['reject']=function(_0x2bd0c0,_0x3a3361,_0x548ca9){var _0x3974ff={'agent':{},'channel':'sms'};if(_0x2bd0c0[_0x8358('0x5b')]['id']){delete _0x2bd0c0[_0x8358('0x5b')]['id'];}_0x2bd0c0[_0x8358('0x5b')]['UserId']=_0x2bd0c0[_0x8358('0x5b')]['UserId']||_0x2bd0c0[_0x8358('0x60')]['id'];_0x3974ff[_0x8358('0x61')]['id']=_0x2bd0c0[_0x8358('0x5b')][_0x8358('0x5f')];return db[_0x8358('0x3f')][_0x8358('0x59')]({'where':{'id':_0x2bd0c0[_0x8358('0x57')]['id'],'UserId':null}})[_0x8358('0x22')](handleEntityNotFound(_0x3a3361,null))[_0x8358('0x22')](function(_0x11e7e6){if(_0x11e7e6){_0x3974ff['message']=_0x11e7e6[_0x8358('0x62')]({'plain':!![]});return db[_0x8358('0x63')][_0x8358('0x59')]({'where':{'id':_0x11e7e6[_0x8358('0x64')]}});}return null;})['then'](handleEntityNotFound(_0x3a3361,null))[_0x8358('0x22')](function(_0x18cfc0){if(_0x18cfc0){_0x3974ff[_0x8358('0x67')]=_0x18cfc0[_0x8358('0x62')]({'plain':!![]});interaction_log[_0x8358('0x29')]('[SMSMESSAGE:REJECT]\x20id=%s\x20name=%s\x20role=%s\x20interaction=%s\x20body=%s',_0x2bd0c0[_0x8358('0x60')]['id'],_0x2bd0c0[_0x8358('0x60')]['name'],_0x2bd0c0['user']['role'],_0x3974ff['interaction']['id'],_0x2bd0c0[_0x8358('0x5b')]?JSON[_0x8358('0x26')](_0x2bd0c0[_0x8358('0x5b')]):'null');return respondWithRpcPromise(_0x8358('0x7d'),_0x8358('0x7e'),_0x3974ff);}return null;})[_0x8358('0x22')](function(_0x4d5a77){var _0x22a377=_0x8358('0x6c')+_0x4d5a77[_0x8358('0x28')][_0x8358('0x6d')];return db[_0x8358('0x6e')][_0x8358('0x45')](_0x22a377,{'type':db[_0x8358('0x6f')][_0x8358('0x70')][_0x8358('0x71')],'raw':!![]})[_0x8358('0x22')](function(_0x52f500){return _0x52f500;});})['then'](function(_0x5dd5a5){if(_0x5dd5a5){_0x3974ff['message'][_0x8358('0x72')]=_0x5dd5a5[0x0];if(!_0x2bd0c0[_0x8358('0x5b')]['UserId'])return;return db[_0x8358('0x73')]['find']({'where':{'id':_0x2bd0c0[_0x8358('0x5b')][_0x8358('0x5f')],'role':_0x8358('0x61')},'attributes':['id',_0x8358('0x3c'),_0x8358('0x74'),_0x8358('0x75'),_0x8358('0x7f')],'raw':!![]});}return null;})[_0x8358('0x22')](function(_0x5d9613){if(!_0x5d9613)return null;_0x3974ff[_0x8358('0x28')][_0x8358('0x61')]=_0x5d9613;return _0x3974ff;})[_0x8358('0x22')](function(_0x55b935){if(_0x55b935){_0x55b935[_0x8358('0x28')]['interface']=util[_0x8358('0x66')]('SIP/%s',_0x2bd0c0['user']['name']);_0x55b935[_0x8358('0x28')][_0x8358('0x79')]=_0x3974ff[_0x8358('0x79')];_0x55b935[_0x8358('0x28')][_0x8358('0x80')]=_0x3974ff['channel'];_0x55b935[_0x8358('0x28')][_0x8358('0x7a')]=_0x8358('0x37');respondWithRpcPromise('EventManager','EventManager',{'event':'rejectmessage','message':_0x55b935[_0x8358('0x28')]},client9002);return _0x3974ff;}return null;})[_0x8358('0x22')](respondWithResult(_0x3a3361,null))['catch'](handleError(_0x3a3361,null));};exports[_0x8358('0x2d')]=function(_0x4f1744,_0x2e80b8,_0x1cee22){if(_0x4f1744[_0x8358('0x5b')]['id']){delete _0x4f1744[_0x8358('0x5b')]['id'];}var _0x212a98;return db['SmsMessage'][_0x8358('0x59')]({'where':{'id':_0x4f1744['params']['id']}})['then'](handleEntityNotFound(_0x2e80b8,null))[_0x8358('0x22')](function(_0x671599){if(_0x671599){_0x212a98=_0x671599;return db[_0x8358('0x81')][_0x8358('0x59')]({'where':{'id':_0x671599['SmsAccountId']}});}})['then'](handleEntityNotFound(_0x2e80b8,null))[_0x8358('0x22')](function(_0x43864e){if(_0x43864e){logger[_0x8358('0x82')](_0x8358('0x25'),_0x8358('0x2d'),_0x8358('0x83'),_0x43864e[_0x8358('0x84')],util['inspect'](_0x4f1744['body'],{'showHidden':![],'depth':null}));switch(_0x43864e[_0x8358('0x84')]){case'twilio':if(_0x4f1744['body'][_0x8358('0x85')]&&_0x4f1744[_0x8358('0x5b')][_0x8358('0x85')]===_0x212a98[_0x8358('0x86')]){return _0x212a98[_0x8358('0x39')]({'read':!![]});}else{logger[_0x8358('0x27')](_0x8358('0x87'),'status','twilio',util[_0x8358('0x88')](_0x4f1744[_0x8358('0x5b')],{'showHidden':![],'depth':null}));}break;case _0x8358('0x89'):if(_0x4f1744[_0x8358('0x5b')][_0x8358('0x8a')]&&_0x4f1744[_0x8358('0x5b')][_0x8358('0x8a')]===_0x212a98[_0x8358('0x86')]&&_[_0x8358('0x8b')]([_0x8358('0x8c'),_0x8358('0x8d')],_0x4f1744['body'][_0x8358('0x8e')])>=0x0){return _0x212a98[_0x8358('0x39')]({'read':!![]});}else{logger[_0x8358('0x27')](_0x8358('0x87'),_0x8358('0x2d'),'plivio',util[_0x8358('0x88')](_0x4f1744[_0x8358('0x5b')],{'showHidden':![],'depth':null}));}break;case _0x8358('0x8f'):var _0x2dbaa1=_0x4f1744[_0x8358('0x5b')][_0x8358('0x90')][0x0];if(_0x2dbaa1[_0x8358('0x2d')][_0x8358('0x91')]===_0x8358('0x92')){return _0x212a98[_0x8358('0x39')]({'read':!![]});}else{logger[_0x8358('0x27')](_0x8358('0x87'),'status',_0x8358('0x8f'),util['inspect'](_0x4f1744[_0x8358('0x5b')],{'showHidden':![],'depth':null}));}break;}return _0x212a98;}})[_0x8358('0x22')](respondWithResult(_0x2e80b8,null))[_0x8358('0x2b')](handleError(_0x2e80b8,null));}; \ No newline at end of file +var _0x9e38=['contact','User','agent','fullname','email','manual','interface','SIP/%s','channel','motionChannel','EventManager','acceptmessage','SmsInteractionId','[SMSMESSAGE:REJECT]\x20id=%s\x20name=%s\x20role=%s\x20interaction=%s\x20body=%s','rejectMessage','internal','event','SmsAccount','SmsAccountId','received\x20delivery\x20report\x20from','twilio','MessageSid','messageId','plivo','MessageUUID','indexOf','sent','Status','SmsAccount,\x20%s,\x20%s,\x20%s','plivio','inspect','infobip','results','groupName','DELIVERED','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/environment','../../config/license/util','../../mysqldb','defaults','localhost','socket.io-emitter','redis','./smsMessage.socket','register','jayson/promise','client','http','SmsMessage,\x20%s,\x20%s','request\x20sent','debug','SmsMessage,\x20%s,\x20%s,\x20%s','error','message','info','result','catch','sendStatus','end','status','json','offset','undefined','limit','count','Content-Range','apply','reject','destroy','name','send','index','map','SmsMessage','rawAttributes','type','key','query','keys','filters','model','attributes','intersection','fields','length','hasOwnProperty','nolimit','sort','where','merge','filter','then','include','findAll','show','params','includeAll','options','create','body','update','find','describe','sms-interactions','accept','sms','read','readAt','format','YYYY-MM-DD\x20HH:mm:ss','UserId','SmsInteraction','isNil','read1stAt','interaction','get','user','role','stringify','null','AcceptMessage','acceptMessage','SELECT\x20*\x20FROM\x20cm_contacts\x20WHERE\x20id\x20=\x20','ContactId','sequelize','Sequelize','QueryTypes','SELECT'];(function(_0x3dd15e,_0x1f0015){var _0x231fd0=function(_0x4f680a){while(--_0x4f680a){_0x3dd15e['push'](_0x3dd15e['shift']());}};_0x231fd0(++_0x1f0015);}(_0x9e38,0x155));var _0x89e3=function(_0x101094,_0x5d3900){_0x101094=_0x101094-0x0;var _0x3d6d75=_0x9e38[_0x101094];return _0x3d6d75;};'use strict';var emlformat=require(_0x89e3('0x0'));var rimraf=require(_0x89e3('0x1'));var zipdir=require(_0x89e3('0x2'));var jsonpatch=require(_0x89e3('0x3'));var rp=require(_0x89e3('0x4'));var moment=require(_0x89e3('0x5'));var BPromise=require(_0x89e3('0x6'));var Mustache=require(_0x89e3('0x7'));var util=require(_0x89e3('0x8'));var path=require(_0x89e3('0x9'));var sox=require(_0x89e3('0xa'));var csv=require(_0x89e3('0xb'));var ejs=require(_0x89e3('0xc'));var fs=require('fs');var fs_extra=require('fs-extra');var _=require(_0x89e3('0xd'));var squel=require(_0x89e3('0xe'));var crypto=require(_0x89e3('0xf'));var jsforce=require(_0x89e3('0x10'));var deskjs=require(_0x89e3('0x11'));var toCsv=require(_0x89e3('0xb'));var querystring=require(_0x89e3('0x12'));var Papa=require(_0x89e3('0x13'));var Redis=require(_0x89e3('0x14'));var authService=require(_0x89e3('0x15'));var qs=require('../../components/parsers/qs');var as=require(_0x89e3('0x16'));var hardwareService=require(_0x89e3('0x17'));var logger=require(_0x89e3('0x18'))(_0x89e3('0x19'));var utils=require('../../config/utils');var config=require(_0x89e3('0x1a'));var licenseUtil=require(_0x89e3('0x1b'));var db=require(_0x89e3('0x1c'))['db'];config['redis']=_[_0x89e3('0x1d')](config['redis'],{'host':_0x89e3('0x1e'),'port':0x18eb});var socket=require(_0x89e3('0x1f'))(new Redis(config[_0x89e3('0x20')]));require(_0x89e3('0x21'))[_0x89e3('0x22')](socket);var jayson=require(_0x89e3('0x23'));var client=jayson[_0x89e3('0x24')][_0x89e3('0x25')]({'port':0x232c});var client9002=jayson[_0x89e3('0x24')][_0x89e3('0x25')]({'port':0x232a});function respondWithRpcPromise(_0x3439bc,_0x16742e,_0x462ec6,_0x1bce47){return new BPromise(function(_0x3d8792,_0x48a479){var _0x38688a=_0x1bce47||client;return _0x38688a['request'](_0x3439bc,_0x462ec6)['then'](function(_0x1a4555){logger['info'](_0x89e3('0x26'),_0x16742e,_0x89e3('0x27'));logger[_0x89e3('0x28')](_0x89e3('0x29'),_0x16742e,_0x89e3('0x27'),JSON['stringify'](_0x1a4555));if(_0x1a4555[_0x89e3('0x2a')]){if(_0x1a4555[_0x89e3('0x2a')]['code']===0x1f4){logger[_0x89e3('0x2a')](_0x89e3('0x26'),_0x16742e,_0x1a4555['error'][_0x89e3('0x2b')]);return _0x48a479(_0x1a4555[_0x89e3('0x2a')]['message']);}logger[_0x89e3('0x2a')](_0x89e3('0x26'),_0x16742e,_0x1a4555[_0x89e3('0x2a')][_0x89e3('0x2b')]);return _0x3d8792(_0x1a4555[_0x89e3('0x2a')]['message']);}else{logger[_0x89e3('0x2c')](_0x89e3('0x26'),_0x16742e,_0x89e3('0x27'));_0x3d8792(_0x1a4555[_0x89e3('0x2d')][_0x89e3('0x2b')]);}})[_0x89e3('0x2e')](function(_0x39e6d6){logger[_0x89e3('0x2a')](_0x89e3('0x26'),_0x16742e,_0x39e6d6);_0x48a479(_0x39e6d6);});});}function respondWithStatusCode(_0x3f8eef,_0x502b57){_0x502b57=_0x502b57||0xcc;return function(_0x2cccbc){if(_0x2cccbc){return _0x3f8eef[_0x89e3('0x2f')](_0x502b57);}return _0x3f8eef['status'](_0x502b57)[_0x89e3('0x30')]();};}function respondWithResult(_0x229fcb,_0x33789c){_0x33789c=_0x33789c||0xc8;return function(_0x1bc573){if(_0x1bc573){return _0x229fcb[_0x89e3('0x31')](_0x33789c)[_0x89e3('0x32')](_0x1bc573);}};}function respondWithFilteredResult(_0x1583c2,_0x11b276){return function(_0x349cb6){if(_0x349cb6){var _0x590904=typeof _0x11b276[_0x89e3('0x33')]===_0x89e3('0x34')&&typeof _0x11b276[_0x89e3('0x35')]===_0x89e3('0x34');var _0x27212=_0x349cb6[_0x89e3('0x36')];var _0xd341e1=_0x590904?0x0:_0x11b276['offset'];var _0x2cb5b9=_0x590904?_0x349cb6[_0x89e3('0x36')]:_0x11b276[_0x89e3('0x33')]+_0x11b276[_0x89e3('0x35')];var _0x29605f;if(_0x2cb5b9>=_0x27212){_0x2cb5b9=_0x27212;_0x29605f=0xc8;}else{_0x29605f=0xce;}_0x1583c2[_0x89e3('0x31')](_0x29605f);return _0x1583c2['set'](_0x89e3('0x37'),_0xd341e1+'-'+_0x2cb5b9+'/'+_0x27212)[_0x89e3('0x32')](_0x349cb6);}return null;};}function patchUpdates(_0x59f13d){return function(_0x3c02ce){try{jsonpatch[_0x89e3('0x38')](_0x3c02ce,_0x59f13d,!![]);}catch(_0x438275){return BPromise[_0x89e3('0x39')](_0x438275);}return _0x3c02ce['save']();};}function saveUpdates(_0x1355bb,_0x2d4210){return function(_0x4ce94a){if(_0x4ce94a){return _0x4ce94a['update'](_0x1355bb)['then'](function(_0x5a0d03){return _0x5a0d03;});}return null;};}function removeEntity(_0x4deaa0,_0x11b574){return function(_0x537b19){if(_0x537b19){return _0x537b19[_0x89e3('0x3a')]()['then'](function(){_0x4deaa0['status'](0xcc)[_0x89e3('0x30')]();});}};}function handleEntityNotFound(_0x4b6de6,_0x4393d5){return function(_0x1b3492){if(!_0x1b3492){_0x4b6de6[_0x89e3('0x2f')](0x194);}return _0x1b3492;};}function handleError(_0x177f29,_0x18ca74){_0x18ca74=_0x18ca74||0x1f4;return function(_0xfc6828){logger['error'](_0xfc6828['stack']);if(_0xfc6828[_0x89e3('0x3b')]){delete _0xfc6828[_0x89e3('0x3b')];}_0x177f29['status'](_0x18ca74)[_0x89e3('0x3c')](_0xfc6828);};}exports[_0x89e3('0x3d')]=function(_0x43f61e,_0x238abc){var _0x1ffd68={},_0x45455={},_0x1eb5c2={'count':0x0,'rows':[]};var _0x291c7b=_[_0x89e3('0x3e')](db[_0x89e3('0x3f')][_0x89e3('0x40')],function(_0x2609bb){return{'name':_0x2609bb['fieldName'],'type':_0x2609bb[_0x89e3('0x41')][_0x89e3('0x42')]};});_0x45455['model']=_[_0x89e3('0x3e')](_0x291c7b,_0x89e3('0x3b'));_0x45455[_0x89e3('0x43')]=_[_0x89e3('0x44')](_0x43f61e[_0x89e3('0x43')]);_0x45455[_0x89e3('0x45')]=_['intersection'](_0x45455[_0x89e3('0x46')],_0x45455[_0x89e3('0x43')]);_0x1ffd68[_0x89e3('0x47')]=_[_0x89e3('0x48')](_0x45455[_0x89e3('0x46')],qs[_0x89e3('0x49')](_0x43f61e[_0x89e3('0x43')][_0x89e3('0x49')]));_0x1ffd68[_0x89e3('0x47')]=_0x1ffd68['attributes'][_0x89e3('0x4a')]?_0x1ffd68[_0x89e3('0x47')]:_0x45455[_0x89e3('0x46')];if(!_0x43f61e[_0x89e3('0x43')][_0x89e3('0x4b')](_0x89e3('0x4c'))){_0x1ffd68[_0x89e3('0x35')]=qs['limit'](_0x43f61e[_0x89e3('0x43')][_0x89e3('0x35')]);_0x1ffd68[_0x89e3('0x33')]=qs[_0x89e3('0x33')](_0x43f61e['query'][_0x89e3('0x33')]);}_0x1ffd68['order']=qs[_0x89e3('0x4d')](_0x43f61e['query'][_0x89e3('0x4d')]);_0x1ffd68[_0x89e3('0x4e')]=qs[_0x89e3('0x45')](_['pick'](_0x43f61e['query'],_0x45455[_0x89e3('0x45')]),_0x291c7b);if(_0x43f61e[_0x89e3('0x43')]['filter']){_0x1ffd68[_0x89e3('0x4e')]=_[_0x89e3('0x4f')](_0x1ffd68[_0x89e3('0x4e')],{'$or':_['map'](_0x291c7b,function(_0xfe6b3a){if(_0xfe6b3a[_0x89e3('0x41')]!=='VIRTUAL'){var _0x15c105={};_0x15c105[_0xfe6b3a[_0x89e3('0x3b')]]={'$like':'%'+_0x43f61e['query'][_0x89e3('0x50')]+'%'};return _0x15c105;}})});}_0x1ffd68=_['merge']({},_0x1ffd68,_0x43f61e['options']);var _0x50a208={'where':_0x1ffd68['where']};return db[_0x89e3('0x3f')][_0x89e3('0x36')](_0x50a208)[_0x89e3('0x51')](function(_0x199819){_0x1eb5c2[_0x89e3('0x36')]=_0x199819;if(_0x43f61e[_0x89e3('0x43')]['includeAll']){_0x1ffd68[_0x89e3('0x52')]=[{'all':!![]}];}return db['SmsMessage'][_0x89e3('0x53')](_0x1ffd68);})[_0x89e3('0x51')](function(_0x36d2de){_0x1eb5c2['rows']=_0x36d2de;return _0x1eb5c2;})[_0x89e3('0x51')](respondWithFilteredResult(_0x238abc,_0x1ffd68))[_0x89e3('0x2e')](handleError(_0x238abc,null));};exports[_0x89e3('0x54')]=function(_0x8ed152,_0x14bc57){var _0x566c02={'raw':!![],'where':{'id':_0x8ed152[_0x89e3('0x55')]['id']}},_0x5c96bd={};_0x5c96bd[_0x89e3('0x46')]=_[_0x89e3('0x44')](db['SmsMessage'][_0x89e3('0x40')]);_0x5c96bd[_0x89e3('0x43')]=_[_0x89e3('0x44')](_0x8ed152[_0x89e3('0x43')]);_0x5c96bd[_0x89e3('0x45')]=_['intersection'](_0x5c96bd[_0x89e3('0x46')],_0x5c96bd[_0x89e3('0x43')]);_0x566c02[_0x89e3('0x47')]=_[_0x89e3('0x48')](_0x5c96bd['model'],qs['fields'](_0x8ed152[_0x89e3('0x43')]['fields']));_0x566c02['attributes']=_0x566c02['attributes'][_0x89e3('0x4a')]?_0x566c02[_0x89e3('0x47')]:_0x5c96bd['model'];if(_0x8ed152[_0x89e3('0x43')][_0x89e3('0x56')]){_0x566c02[_0x89e3('0x52')]=[{'all':!![]}];}_0x566c02=_['merge']({},_0x566c02,_0x8ed152[_0x89e3('0x57')]);return db['SmsMessage']['find'](_0x566c02)['then'](handleEntityNotFound(_0x14bc57,null))[_0x89e3('0x51')](respondWithResult(_0x14bc57,null))['catch'](handleError(_0x14bc57,null));};exports['create']=function(_0x385115,_0x43cec2){return db[_0x89e3('0x3f')][_0x89e3('0x58')](_0x385115[_0x89e3('0x59')],{})[_0x89e3('0x51')](respondWithResult(_0x43cec2,0xc9))[_0x89e3('0x2e')](handleError(_0x43cec2,null));};exports[_0x89e3('0x5a')]=function(_0x5df6fe,_0x3679da){if(_0x5df6fe[_0x89e3('0x59')]['id']){delete _0x5df6fe[_0x89e3('0x59')]['id'];}return db[_0x89e3('0x3f')]['find']({'where':{'id':_0x5df6fe[_0x89e3('0x55')]['id']}})[_0x89e3('0x51')](handleEntityNotFound(_0x3679da,null))[_0x89e3('0x51')](saveUpdates(_0x5df6fe['body'],null))[_0x89e3('0x51')](respondWithResult(_0x3679da,null))[_0x89e3('0x2e')](handleError(_0x3679da,null));};exports[_0x89e3('0x3a')]=function(_0x480750,_0x43cb7b){return db[_0x89e3('0x3f')][_0x89e3('0x5b')]({'where':{'id':_0x480750[_0x89e3('0x55')]['id']}})[_0x89e3('0x51')](handleEntityNotFound(_0x43cb7b,null))[_0x89e3('0x51')](removeEntity(_0x43cb7b,null))[_0x89e3('0x2e')](handleError(_0x43cb7b,null));};exports[_0x89e3('0x5c')]=function(_0x4fc367,_0x53be89){return db[_0x89e3('0x3f')][_0x89e3('0x5c')]()[_0x89e3('0x51')](respondWithResult(_0x53be89,null))['catch'](handleError(_0x53be89,null));};var interaction_log=require(_0x89e3('0x18'))(_0x89e3('0x5d'));exports[_0x89e3('0x5e')]=function(_0x5a2a4f,_0x473fe0,_0x428244){var _0x416420={'agent':{},'channel':_0x89e3('0x5f')};if(_0x5a2a4f['body']['id']){delete _0x5a2a4f['body']['id'];}_0x5a2a4f[_0x89e3('0x59')][_0x89e3('0x60')]=!![];_0x5a2a4f['body'][_0x89e3('0x61')]=moment()[_0x89e3('0x62')](_0x89e3('0x63'));_0x5a2a4f[_0x89e3('0x59')]['UserId']=_0x5a2a4f[_0x89e3('0x59')][_0x89e3('0x64')]||_0x5a2a4f['user']['id'];_0x416420['agent']['id']=_0x5a2a4f['body']['UserId'];return db[_0x89e3('0x3f')][_0x89e3('0x5b')]({'where':{'id':_0x5a2a4f[_0x89e3('0x55')]['id'],'UserId':null}})[_0x89e3('0x51')](handleEntityNotFound(_0x473fe0,null))['then'](saveUpdates(_0x5a2a4f[_0x89e3('0x59')],null))[_0x89e3('0x51')](function(_0x3588f0){if(_0x3588f0){_0x416420[_0x89e3('0x2b')]=_0x3588f0['get']({'plain':!![]});return db[_0x89e3('0x65')][_0x89e3('0x5b')]({'where':{'id':_0x3588f0['SmsInteractionId']}});}return null;})[_0x89e3('0x51')](handleEntityNotFound(_0x473fe0,null))['then'](function(_0xdc5131){if(_0xdc5131){return _0xdc5131[_0x89e3('0x5a')]({'UserId':_0x5a2a4f['body'][_0x89e3('0x64')],'read1stAt':_[_0x89e3('0x66')](_0xdc5131[_0x89e3('0x67')])?moment()[_0x89e3('0x62')](_0x89e3('0x63')):undefined});}return null;})['then'](function(_0x491b42){if(_0x491b42){_0x416420[_0x89e3('0x68')]=_0x491b42[_0x89e3('0x69')]({'plain':!![]});interaction_log[_0x89e3('0x2c')]('[SMSMESSAGE:ACCEPT]\x20id=%s\x20name=%s\x20role=%s\x20interaction=%s\x20body=%s',_0x5a2a4f['user']['id'],_0x5a2a4f[_0x89e3('0x6a')][_0x89e3('0x3b')],_0x5a2a4f[_0x89e3('0x6a')][_0x89e3('0x6b')],_0x416420[_0x89e3('0x68')]['id'],_0x5a2a4f[_0x89e3('0x59')]?JSON[_0x89e3('0x6c')](_0x5a2a4f[_0x89e3('0x59')]):_0x89e3('0x6d'));return respondWithRpcPromise(_0x89e3('0x6e'),_0x89e3('0x6f'),_0x416420);}return null;})[_0x89e3('0x51')](function(_0x610dd9){var _0x5e9825=_0x89e3('0x70')+_0x610dd9[_0x89e3('0x2b')][_0x89e3('0x71')];return db[_0x89e3('0x72')]['query'](_0x5e9825,{'type':db[_0x89e3('0x73')][_0x89e3('0x74')][_0x89e3('0x75')],'raw':!![]})[_0x89e3('0x51')](function(_0x262275){return _0x262275;});})['then'](function(_0x299e44){if(_0x299e44){_0x416420['message'][_0x89e3('0x76')]=_0x299e44[0x0];if(!_0x5a2a4f[_0x89e3('0x59')]['UserId'])return;return db[_0x89e3('0x77')][_0x89e3('0x5b')]({'where':{'id':_0x5a2a4f[_0x89e3('0x59')][_0x89e3('0x64')],'role':_0x89e3('0x78')},'attributes':['id',_0x89e3('0x3b'),_0x89e3('0x79'),_0x89e3('0x7a'),'internal'],'raw':!![]});}return null;})[_0x89e3('0x51')](function(_0x56a1e3){if(!_0x56a1e3)return null;_0x416420[_0x89e3('0x2b')][_0x89e3('0x78')]=_0x56a1e3;return _0x416420;})[_0x89e3('0x51')](function(_0x2e8ce0){if(_0x2e8ce0){if(_0x5a2a4f['body'][_0x89e3('0x7b')]){_0x416420[_0x89e3('0x2b')][_0x89e3('0x7c')]=util[_0x89e3('0x62')](_0x89e3('0x7d'),_0x5a2a4f[_0x89e3('0x6a')]['name']);_0x416420['message'][_0x89e3('0x7e')]=_0x416420['channel'];_0x416420['message'][_0x89e3('0x7f')]=_0x416420[_0x89e3('0x7e')];_0x416420['message']['event']='accept';return respondWithRpcPromise(_0x89e3('0x80'),'EventManager',{'event':_0x89e3('0x81'),'message':_0x416420[_0x89e3('0x2b')]},client9002)[_0x89e3('0x51')](function(){return _0x416420;});}return _0x416420;}return null;})['then'](respondWithResult(_0x473fe0,null))[_0x89e3('0x2e')](handleError(_0x473fe0,null));};var interaction_log=require(_0x89e3('0x18'))(_0x89e3('0x5d'));exports[_0x89e3('0x39')]=function(_0xc45e02,_0x5e0415,_0xb81df4){var _0x3f4948={'agent':{},'channel':_0x89e3('0x5f')};if(_0xc45e02['body']['id']){delete _0xc45e02[_0x89e3('0x59')]['id'];}_0xc45e02[_0x89e3('0x59')][_0x89e3('0x64')]=_0xc45e02[_0x89e3('0x59')]['UserId']||_0xc45e02[_0x89e3('0x6a')]['id'];_0x3f4948[_0x89e3('0x78')]['id']=_0xc45e02[_0x89e3('0x59')][_0x89e3('0x64')];return db['SmsMessage']['find']({'where':{'id':_0xc45e02['params']['id'],'UserId':null}})[_0x89e3('0x51')](handleEntityNotFound(_0x5e0415,null))[_0x89e3('0x51')](function(_0x345366){if(_0x345366){_0x3f4948[_0x89e3('0x2b')]=_0x345366[_0x89e3('0x69')]({'plain':!![]});return db[_0x89e3('0x65')][_0x89e3('0x5b')]({'where':{'id':_0x345366[_0x89e3('0x82')]}});}return null;})['then'](handleEntityNotFound(_0x5e0415,null))['then'](function(_0x79b7e4){if(_0x79b7e4){_0x3f4948[_0x89e3('0x68')]=_0x79b7e4[_0x89e3('0x69')]({'plain':!![]});interaction_log['info'](_0x89e3('0x83'),_0xc45e02[_0x89e3('0x6a')]['id'],_0xc45e02[_0x89e3('0x6a')]['name'],_0xc45e02[_0x89e3('0x6a')]['role'],_0x3f4948['interaction']['id'],_0xc45e02[_0x89e3('0x59')]?JSON[_0x89e3('0x6c')](_0xc45e02[_0x89e3('0x59')]):_0x89e3('0x6d'));return respondWithRpcPromise('RejectMessage',_0x89e3('0x84'),_0x3f4948);}return null;})[_0x89e3('0x51')](function(_0x36b191){var _0x53159a=_0x89e3('0x70')+_0x36b191[_0x89e3('0x2b')]['ContactId'];return db['sequelize']['query'](_0x53159a,{'type':db[_0x89e3('0x73')][_0x89e3('0x74')]['SELECT'],'raw':!![]})[_0x89e3('0x51')](function(_0xc73c23){return _0xc73c23;});})[_0x89e3('0x51')](function(_0x1512bc){if(_0x1512bc){_0x3f4948[_0x89e3('0x2b')][_0x89e3('0x76')]=_0x1512bc[0x0];if(!_0xc45e02[_0x89e3('0x59')]['UserId'])return;return db[_0x89e3('0x77')]['find']({'where':{'id':_0xc45e02['body'][_0x89e3('0x64')],'role':_0x89e3('0x78')},'attributes':['id',_0x89e3('0x3b'),_0x89e3('0x79'),_0x89e3('0x7a'),_0x89e3('0x85')],'raw':!![]});}return null;})[_0x89e3('0x51')](function(_0x418cb1){if(!_0x418cb1)return null;_0x3f4948[_0x89e3('0x2b')]['agent']=_0x418cb1;return _0x3f4948;})[_0x89e3('0x51')](function(_0x8f7e96){if(_0x8f7e96){_0x8f7e96[_0x89e3('0x2b')]['interface']=util['format'](_0x89e3('0x7d'),_0xc45e02[_0x89e3('0x6a')][_0x89e3('0x3b')]);_0x8f7e96[_0x89e3('0x2b')][_0x89e3('0x7e')]=_0x3f4948[_0x89e3('0x7e')];_0x8f7e96[_0x89e3('0x2b')][_0x89e3('0x7f')]=_0x3f4948[_0x89e3('0x7e')];_0x8f7e96[_0x89e3('0x2b')][_0x89e3('0x86')]=_0x89e3('0x39');respondWithRpcPromise('EventManager','EventManager',{'event':'rejectmessage','message':_0x8f7e96[_0x89e3('0x2b')]},client9002);return _0x3f4948;}return null;})[_0x89e3('0x51')](respondWithResult(_0x5e0415,null))['catch'](handleError(_0x5e0415,null));};exports[_0x89e3('0x31')]=function(_0x4851e5,_0x2c9d86,_0x44a9bb){if(_0x4851e5[_0x89e3('0x59')]['id']){delete _0x4851e5[_0x89e3('0x59')]['id'];}var _0x2892dd;return db[_0x89e3('0x3f')][_0x89e3('0x5b')]({'where':{'id':_0x4851e5[_0x89e3('0x55')]['id']}})[_0x89e3('0x51')](handleEntityNotFound(_0x2c9d86,null))[_0x89e3('0x51')](function(_0xa4b4f6){if(_0xa4b4f6){_0x2892dd=_0xa4b4f6;return db[_0x89e3('0x87')][_0x89e3('0x5b')]({'where':{'id':_0xa4b4f6[_0x89e3('0x88')]}});}})[_0x89e3('0x51')](handleEntityNotFound(_0x2c9d86,null))[_0x89e3('0x51')](function(_0x2d09e0){if(_0x2d09e0){logger[_0x89e3('0x28')](_0x89e3('0x29'),_0x89e3('0x31'),_0x89e3('0x89'),_0x2d09e0[_0x89e3('0x41')],util['inspect'](_0x4851e5[_0x89e3('0x59')],{'showHidden':![],'depth':null}));switch(_0x2d09e0[_0x89e3('0x41')]){case _0x89e3('0x8a'):if(_0x4851e5[_0x89e3('0x59')][_0x89e3('0x8b')]&&_0x4851e5[_0x89e3('0x59')][_0x89e3('0x8b')]===_0x2892dd[_0x89e3('0x8c')]){return _0x2892dd['update']({'read':!![]});}else{logger[_0x89e3('0x2a')]('SmsAccount,\x20%s,\x20%s,\x20%s',_0x89e3('0x31'),_0x89e3('0x8a'),util['inspect'](_0x4851e5[_0x89e3('0x59')],{'showHidden':![],'depth':null}));}break;case _0x89e3('0x8d'):if(_0x4851e5['body']['MessageUUID']&&_0x4851e5[_0x89e3('0x59')][_0x89e3('0x8e')]===_0x2892dd[_0x89e3('0x8c')]&&_[_0x89e3('0x8f')]([_0x89e3('0x90'),'delivered'],_0x4851e5['body'][_0x89e3('0x91')])>=0x0){return _0x2892dd[_0x89e3('0x5a')]({'read':!![]});}else{logger[_0x89e3('0x2a')](_0x89e3('0x92'),_0x89e3('0x31'),_0x89e3('0x93'),util[_0x89e3('0x94')](_0x4851e5[_0x89e3('0x59')],{'showHidden':![],'depth':null}));}break;case _0x89e3('0x95'):var _0x835e23=_0x4851e5['body'][_0x89e3('0x96')][0x0];if(_0x835e23[_0x89e3('0x31')][_0x89e3('0x97')]===_0x89e3('0x98')){return _0x2892dd[_0x89e3('0x5a')]({'read':!![]});}else{logger[_0x89e3('0x2a')](_0x89e3('0x92'),_0x89e3('0x31'),_0x89e3('0x95'),util[_0x89e3('0x94')](_0x4851e5[_0x89e3('0x59')],{'showHidden':![],'depth':null}));}break;}return _0x2892dd;}})[_0x89e3('0x51')](respondWithResult(_0x2c9d86,null))[_0x89e3('0x2e')](handleError(_0x2c9d86,null));}; \ No newline at end of file diff --git a/server/api/smsMessage/smsMessage.events.js b/server/api/smsMessage/smsMessage.events.js index cdc0600..af76fb2 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 _0x1d33=['remove','emit','hasOwnProperty','hook','exports','../../mysqldb','SmsMessage','setMaxListeners','update'];(function(_0x3dd15e,_0x1f0015){var _0x231fd0=function(_0x4f680a){while(--_0x4f680a){_0x3dd15e['push'](_0x3dd15e['shift']());}};_0x231fd0(++_0x1f0015);}(_0x1d33,0x11c));var _0x31d3=function(_0x29f8bb,_0x1f52b1){_0x29f8bb=_0x29f8bb-0x0;var _0x412f7d=_0x1d33[_0x29f8bb];return _0x412f7d;};'use strict';var EventEmitter=require('events');var SmsMessage=require(_0x31d3('0x0'))['db'][_0x31d3('0x1')];var SmsMessageEvents=new EventEmitter();SmsMessageEvents[_0x31d3('0x2')](0x0);var events={'afterCreate':'save','afterUpdate':_0x31d3('0x3'),'afterDestroy':_0x31d3('0x4')};function emitEvent(_0x3de9bf){return function(_0x16501f,_0x34dba3,_0x11a5c9){SmsMessageEvents['emit'](_0x3de9bf+':'+_0x16501f['id'],_0x16501f);SmsMessageEvents[_0x31d3('0x5')](_0x3de9bf,_0x16501f);_0x11a5c9(null);};}for(var e in events){if(events[_0x31d3('0x6')](e)){var event=events[e];SmsMessage[_0x31d3('0x7')](e,emitEvent(event));}}module[_0x31d3('0x8')]=SmsMessageEvents; \ No newline at end of file +var _0x2ccf=['../../mysqldb','SmsMessage','setMaxListeners','save','update','remove','emit','hook','events'];(function(_0x4b369d,_0x265eb8){var _0x571a98=function(_0x56341a){while(--_0x56341a){_0x4b369d['push'](_0x4b369d['shift']());}};_0x571a98(++_0x265eb8);}(_0x2ccf,0x143));var _0xf2cc=function(_0x1d27f9,_0x4f7c83){_0x1d27f9=_0x1d27f9-0x0;var _0x2d8e09=_0x2ccf[_0x1d27f9];return _0x2d8e09;};'use strict';var EventEmitter=require(_0xf2cc('0x0'));var SmsMessage=require(_0xf2cc('0x1'))['db'][_0xf2cc('0x2')];var SmsMessageEvents=new EventEmitter();SmsMessageEvents[_0xf2cc('0x3')](0x0);var events={'afterCreate':_0xf2cc('0x4'),'afterUpdate':_0xf2cc('0x5'),'afterDestroy':_0xf2cc('0x6')};function emitEvent(_0x4dfd31){return function(_0x44c03e,_0x354008,_0x3e3991){SmsMessageEvents[_0xf2cc('0x7')](_0x4dfd31+':'+_0x44c03e['id'],_0x44c03e);SmsMessageEvents['emit'](_0x4dfd31,_0x44c03e);_0x3e3991(null);};}for(var e in events){if(events['hasOwnProperty'](e)){var event=events[e];SmsMessage[_0xf2cc('0x8')](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 88a0d48..d3a15e4 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 _0x47f3=['api','moment','path','rimraf','./smsMessage.attributes','define','SmsMessage','messageId','FULLTEXT','models','get','direction','toLowerCase','out','secret','isNil','SmsInteractionId','SmsInteraction','then','update','createdAt','catch','error','SmsAccountId','type','twilio','authToken','phone','accountSid','messages','create','body','/status?token=','token','sid','SmsMessage,\x20%s,\x20%s,\x20%s','afterCreate','inspect','Missing\x20parameters:\x20phone,\x20accountSid\x20or\x20authToken','skebby','https://api.skebby.it/API/v1.0/REST/','smsMethod','sender','&password=','password','split','session_key','total_sent','internal_order_id','deliveryReport','read','Missing\x20parameters:\x20username,\x20password','connectel','senderString','POST','https://smsapi.connectel.se/api/v2/send/','Missing\x20parameters:\x20authToken','clicksend','xCALLY\x20Motion','format','username','https://rest.clicksend.com/v3/sms/send','Basic\x20%s','toString','base64','http_code','data','queued_count','message_id','clickSend','plivo','remote','/api/sms/messages/','%s:%s','authId','Missing\x20parameters:\x20authId,\x20authToken','infobip','baseUrl','/auth/1/session','/sms/2/text/advanced','application/json','IBSSO\x20','csc','crypto','apiKey','text','timestamp','keys','sort','length','createHash','md5','digest','hex','signature=','GET','/external/get/send.php?','id_sms','Missing\x20parameters:\x20apiKey','clickatell','https://platform.clickatell.com/messages','uuid','UTF-8','apiMessageId','bandwidth','https://messaging.bandwidth.com/api/v2/users/','/messages','applicationId','https://api.intelepeer.com/_rest/v4/app/sms/send','Bearer\x20','code','message','https://api.intelepeer.com/_rest/v4/app/sms/mdr','status','refid','intelepeer','finally','utf8mb4','utf8mb4_unicode_ci','lodash','util','../../config/logger'];(function(_0x441563,_0x1d4a28){var _0x2369ec=function(_0x1f97ba){while(--_0x1f97ba){_0x441563['push'](_0x441563['shift']());}};_0x2369ec(++_0x1d4a28);}(_0x47f3,0xf1));var _0x347f=function(_0x5cbf8a,_0x2fcfdb){_0x5cbf8a=_0x5cbf8a-0x0;var _0x4eae83=_0x47f3[_0x5cbf8a];return _0x4eae83;};'use strict';var _=require(_0x347f('0x0'));var util=require(_0x347f('0x1'));var logger=require(_0x347f('0x2'))(_0x347f('0x3'));var moment=require(_0x347f('0x4'));var BPromise=require('bluebird');var rp=require('request-promise');var fs=require('fs');var path=require(_0x347f('0x5'));var rimraf=require(_0x347f('0x6'));var config=require('../../config/environment');var attributes=require(_0x347f('0x7'));module['exports']=function(_0x2710c8,_0x455860){return _0x2710c8[_0x347f('0x8')](_0x347f('0x9'),attributes,{'tableName':'sms_messages','paranoid':![],'indexes':[{'name':_0x347f('0xa'),'fields':[_0x347f('0xa')]},{'name':'fti_sms_messages','fields':['body'],'type':_0x347f('0xb')}],'timestamps':!![],'hooks':{'afterCreate':function(_0x2fd500,_0x4f9f42,_0xcb18b0){var _0x503cd5=_0x2710c8[_0x347f('0xc')];var _0x2bdab1=_0x2fd500[_0x347f('0xd')]({'plain':!![]});if(_0x2bdab1[_0x347f('0xe')][_0x347f('0xf')]()==='in'||_0x2bdab1[_0x347f('0xe')]['toLowerCase']()===_0x347f('0x10')&&!_0x2bdab1[_0x347f('0x11')]&&!_[_0x347f('0x12')](_0x2bdab1['UserId'])&&!_[_0x347f('0x12')](_0x2bdab1[_0x347f('0x13')])){_0x503cd5[_0x347f('0x14')]['findOne']({'where':{'id':_0x2bdab1['SmsInteractionId']}})[_0x347f('0x15')](function(_0x179e1d){if(_0x179e1d){_0x179e1d[_0x347f('0x16')]({'lastMsgAt':_0x2bdab1[_0x347f('0x17')],'lastMsgDirection':_0x2bdab1[_0x347f('0xe')]['toLowerCase']()});}})[_0x347f('0x18')](function(_0x1671b3){console[_0x347f('0x19')](_0x1671b3);});}if(_0x2bdab1[_0x347f('0xe')]===_0x347f('0x10')&&!_0x2bdab1[_0x347f('0x11')]){var _0x12eb05;_0x503cd5['SmsAccount']['find']({'where':{'id':_0x2bdab1[_0x347f('0x1a')]},'raw':!![]})['then'](function(_0x45d7ca){_0x12eb05=_0x45d7ca;if(_0x12eb05&&_0x12eb05[_0x347f('0x1b')]){switch(_0x12eb05[_0x347f('0x1b')]){case'twilio':var _0x2f117c=require(_0x347f('0x1c'));if(_0x12eb05['accountSid']&&_0x12eb05[_0x347f('0x1d')]&&_0x12eb05[_0x347f('0x1e')]){var _0x346679=new _0x2f117c(_0x12eb05[_0x347f('0x1f')],_0x12eb05[_0x347f('0x1d')]);_0x346679[_0x347f('0x20')][_0x347f('0x21')]({'body':_0x2bdab1[_0x347f('0x22')],'to':_0x2bdab1[_0x347f('0x1e')],'from':_0x12eb05['phone'],'statusCallback':_0x12eb05['remote']+'/api/sms/messages/'+_0x2bdab1['id']+_0x347f('0x23')+_0x12eb05[_0x347f('0x24')]})[_0x347f('0x15')](function(_0x3ea040){if(_0x3ea040[_0x347f('0x25')]){return _0x2fd500[_0x347f('0x16')]({'messageId':_0x3ea040[_0x347f('0x25')]});}})[_0x347f('0x18')](function(_0xc8b215){logger[_0x347f('0x19')](_0x347f('0x26'),_0x347f('0x27'),_0x347f('0x1c'),util[_0x347f('0x28')](_0xc8b215,{'showHidden':![],'depth':null}));});}else{logger[_0x347f('0x19')]('SmsMessage,\x20%s,\x20%s,\x20%s','afterCreate',_0x347f('0x1c'),_0x347f('0x29'));}break;case _0x347f('0x2a'):var _0xea6545=_0x347f('0x2b');if(_0x12eb05['username']&&_0x12eb05['password']){var _0x13949c={'recipient':[_0x2bdab1[_0x347f('0x1e')]],'message':_0x2bdab1[_0x347f('0x22')],'message_type':_0x12eb05[_0x347f('0x2c')]};if(_0x12eb05[_0x347f('0x2c')]&&_0x12eb05[_0x347f('0x2c')]!=='SI'){_0x13949c[_0x347f('0x2d')]=_0x12eb05['phone'];}var _0x283115={'url':_0xea6545+'login?username='+_0x12eb05['username']+_0x347f('0x2e')+_0x12eb05[_0x347f('0x2f')],'method':'GET'};rp(_0x283115)['then'](function(_0x381a53){var _0x4a2242=_0x381a53[_0x347f('0x30')](';');var _0x6a5112={'user_key':_0x4a2242[0x0],'session_key':_0x4a2242[0x1]};_0x283115={'url':_0xea6545+'sms','method':'POST','headers':{'user_key':_0x6a5112['user_key'],'Session_key':_0x6a5112[_0x347f('0x31')]},'json':!![],'body':_0x13949c};return rp(_0x283115);})[_0x347f('0x15')](function(_0x3ffda9){if(_0x3ffda9[_0x347f('0x32')]>=0x1){var _0x14a57c={'messageId':_0x3ffda9[_0x347f('0x33')]};if(_0x12eb05[_0x347f('0x2c')]!=='GP'||!_0x12eb05[_0x347f('0x34')]){_0x14a57c[_0x347f('0x35')]=!![];}return _0x2fd500[_0x347f('0x16')](_0x14a57c);}else{return logger[_0x347f('0x19')](_0x347f('0x26'),_0x347f('0x27'),_0x347f('0x2a'),util['inspect'](_0x3ffda9,{'showHidden':![],'depth':null}));}})[_0x347f('0x18')](function(_0x2ce0eb){return logger['error'](_0x347f('0x26'),'afterCreate',_0x347f('0x2a'),util[_0x347f('0x28')](_0x2ce0eb,{'showHidden':![],'depth':null}));});}else{logger['error'](_0x347f('0x26'),_0x347f('0x27'),_0x347f('0x2a'),_0x347f('0x36'));}break;case _0x347f('0x37'):if(_0x12eb05['authToken']){var _0x4b504c={'recipient':_0x2bdab1['phone'],'message':_0x2bdab1['body'],'sender':_0x12eb05[_0x347f('0x38')]||_0x12eb05[_0x347f('0x1e')],'authorization':_0x12eb05[_0x347f('0x1d')]};var _0x4f9f42={'method':_0x347f('0x39'),'uri':_0x347f('0x3a'),'body':_0x4b504c,'json':!![]};rp(_0x4f9f42)[_0x347f('0x15')](function(_0x432f77){var _0x1b8cea={'messageId':_0x432f77['requestid']};if(!_0x12eb05['deliveryReport']){_0x1b8cea[_0x347f('0x35')]=!![];}return _0x2fd500[_0x347f('0x16')](_0x1b8cea);})[_0x347f('0x18')](function(_0xd0f45f){logger[_0x347f('0x19')](_0x347f('0x26'),'afterCreate',_0x347f('0x37'),util[_0x347f('0x28')](_0xd0f45f,{'showHidden':![],'depth':null}));});}else{logger[_0x347f('0x19')](_0x347f('0x26'),_0x347f('0x27'),_0x347f('0x37'),_0x347f('0x3b'));}break;case _0x347f('0x3c'):if(_0x12eb05['username']&&_0x12eb05[_0x347f('0x2f')]){var _0x4b504c={'messages':[{'source':_0x347f('0x3d'),'to':_0x2bdab1[_0x347f('0x1e')],'body':_0x2bdab1['body'],'from':_0x12eb05['senderString']||_0x12eb05[_0x347f('0x1e')]}]};var _0xf759ae=util[_0x347f('0x3e')]('%s:%s',_0x12eb05[_0x347f('0x3f')],_0x12eb05[_0x347f('0x2f')]);var _0x4f9f42={'method':'POST','uri':_0x347f('0x40'),'body':_0x4b504c,'headers':{'Authorization':util[_0x347f('0x3e')](_0x347f('0x41'),new Buffer(_0xf759ae)[_0x347f('0x42')](_0x347f('0x43')))},'json':!![]};rp(_0x4f9f42)[_0x347f('0x15')](function(_0x2c53fe){if(_0x2c53fe[_0x347f('0x44')]>=0xc8&&_0x2c53fe[_0x347f('0x44')]<=0xce){if(_0x2c53fe[_0x347f('0x45')]&&_0x2c53fe[_0x347f('0x45')][_0x347f('0x46')]>0x0){var _0xb5f2fa=_['head'](_0x2c53fe['data'][_0x347f('0x20')]);var _0x5528f7={'messageId':_0xb5f2fa[_0x347f('0x47')]};if(!_0x12eb05[_0x347f('0x34')]){_0x5528f7[_0x347f('0x35')]=!![];}return _0x2fd500['update'](_0x5528f7);}else{logger[_0x347f('0x19')](_0x347f('0x26'),_0x347f('0x27'),_0x347f('0x48'),util['inspect'](_0x2c53fe,{'showHidden':![],'depth':null}));}}else{logger[_0x347f('0x19')]('SmsMessage,\x20%s,\x20%s,\x20%s',_0x347f('0x27'),'clickSend',util[_0x347f('0x28')](_0x2c53fe,{'showHidden':![],'depth':null}));}})[_0x347f('0x18')](function(_0x24ab7a){logger['error'](_0x347f('0x26'),_0x347f('0x27'),_0x347f('0x48'),util[_0x347f('0x28')](_0x24ab7a,{'showHidden':![],'depth':null}));});}else{logger['error'](_0x347f('0x26'),_0x347f('0x27'),_0x347f('0x48'),'Missing\x20parameters:\x20username,\x20password');}break;case _0x347f('0x49'):if(_0x12eb05['authId']&&_0x12eb05[_0x347f('0x1d')]){var _0x4b504c={'dst':_0x2bdab1[_0x347f('0x1e')],'text':_0x2bdab1['body'],'src':_0x12eb05[_0x347f('0x38')]||_0x12eb05[_0x347f('0x1e')],'url':_0x12eb05[_0x347f('0x4a')]+_0x347f('0x4b')+_0x2bdab1['id']+_0x347f('0x23')+_0x12eb05['token']};var _0xf759ae=util[_0x347f('0x3e')](_0x347f('0x4c'),_0x12eb05[_0x347f('0x4d')],_0x12eb05[_0x347f('0x1d')]);var _0x4f9f42={'method':_0x347f('0x39'),'uri':util['format']('https://api.plivo.com/v1/Account/%s/Message/',_0x12eb05[_0x347f('0x4d')]),'body':_0x4b504c,'headers':{'Authorization':util[_0x347f('0x3e')](_0x347f('0x41'),new Buffer(_0xf759ae)[_0x347f('0x42')]('base64'))},'json':!![]};rp(_0x4f9f42)['then'](function(_0x18413c){var _0x3a793a={'messageId':_0x18413c['message_uuid'][0x0]};return _0x2fd500[_0x347f('0x16')](_0x3a793a);})['catch'](function(_0x4d1bc0){logger[_0x347f('0x19')](_0x347f('0x26'),'afterCreate',_0x347f('0x49'),util[_0x347f('0x28')](_0x4d1bc0,{'showHidden':![],'depth':null}));});}else{logger['error'](_0x347f('0x26'),_0x347f('0x27'),_0x347f('0x49'),_0x347f('0x4e'));}break;case _0x347f('0x4f'):if(_0x12eb05['username']&&_0x12eb05[_0x347f('0x2f')]){if(_0x12eb05[_0x347f('0x50')]){var _0x2c950d={'method':_0x347f('0x39'),'uri':_0x12eb05[_0x347f('0x50')]+_0x347f('0x51'),'body':{'username':_0x12eb05[_0x347f('0x3f')],'password':_0x12eb05[_0x347f('0x2f')]},'json':!![]};return rp(_0x2c950d)[_0x347f('0x15')](function(_0x4160a7){var _0x28d0d4={'method':_0x347f('0x39'),'uri':_0x12eb05[_0x347f('0x50')]+_0x347f('0x52'),'body':{'messages':[{'from':_0x12eb05[_0x347f('0x1e')],'destinations':[{'to':_0x2bdab1[_0x347f('0x1e')]}],'text':_0x2bdab1[_0x347f('0x22')],'notifyUrl':_0x12eb05[_0x347f('0x4a')]+_0x347f('0x4b')+_0x2bdab1['id']+_0x347f('0x23')+_0x12eb05[_0x347f('0x24')],'notifyContentType':_0x347f('0x53'),'callbackData':_0x12eb05['phone']+';'+_0x2bdab1[_0x347f('0x22')]}]},'headers':{'Authorization':_0x347f('0x54')+_0x4160a7[_0x347f('0x24')]},'json':!![]};return rp(_0x28d0d4)[_0x347f('0x15')](function(_0x13ddec){if(_0x13ddec['messages']){var _0x50d0ce={'messageId':_0x13ddec[_0x347f('0x20')][0x0][_0x347f('0xa')]};if(!_0x12eb05[_0x347f('0x34')]){_0x50d0ce[_0x347f('0x35')]=!![];}return _0x2fd500['update'](_0x50d0ce);}else{return logger[_0x347f('0x19')](_0x347f('0x26'),'afterCreate',_0x347f('0x4f'),util[_0x347f('0x28')](_0x13ddec,{'showHidden':![],'depth':null}));}});})[_0x347f('0x18')](function(_0x79fbce){return logger['error'](_0x347f('0x26'),'afterCreate',_0x347f('0x4f'),util[_0x347f('0x28')](_0x79fbce,{'showHidden':![],'depth':null}));});}else{logger['error'](_0x347f('0x26'),_0x347f('0x27'),'infobip','Missing\x20parameters:\x20base_url');}}else{logger['error'](_0x347f('0x26'),_0x347f('0x27'),'infobip',_0x347f('0x36'));}break;case _0x347f('0x55'):var _0x23e215=require(_0x347f('0x56'));if(_0x12eb05[_0x347f('0x57')]){var _0x3888b4={};_0x3888b4['login']=_0x12eb05[_0x347f('0x3f')];_0x3888b4[_0x347f('0x1e')]=_0x2bdab1[_0x347f('0x1e')];_0x3888b4[_0x347f('0x2d')]=_0x12eb05['phone'];_0x3888b4[_0x347f('0x58')]=_0x2bdab1[_0x347f('0x22')];_0x3888b4[_0x347f('0x59')]=+new Date();var _0x4f1844='';var _0x1b5671='';var _0x29d8b2=Object[_0x347f('0x5a')](_0x3888b4);_0x29d8b2[_0x347f('0x5b')]();for(var _0x59728a=0x0;_0x59728a<_0x29d8b2[_0x347f('0x5c')];_0x59728a++){if(_0x4f1844!=''){_0x4f1844+='&';}_0x4f1844+=_0x29d8b2[_0x59728a]+'='+encodeURIComponent(_0x3888b4[_0x29d8b2[_0x59728a]]);_0x1b5671+=_0x3888b4[_0x29d8b2[_0x59728a]];}_0x1b5671+=_0x12eb05['apiKey'];_0x1b5671=_0x23e215[_0x347f('0x5d')](_0x347f('0x5e'))[_0x347f('0x16')](_0x1b5671)[_0x347f('0x5f')](_0x347f('0x60'));if(_0x4f1844!==''){_0x4f1844+='&';}_0x4f1844+=_0x347f('0x61')+_0x1b5671;var _0x283115={'method':_0x347f('0x62'),'uri':_0x12eb05[_0x347f('0x50')]+_0x347f('0x63')+_0x4f1844,'json':!![]};return rp(_0x283115)['then'](function(_0x3d0630){var _0x811852=Object[_0x347f('0x5a')](_0x3d0630);if(_0x3d0630[_0x811852[0x0]][_0x347f('0x19')]&&parseInt(_0x3d0630[_0x811852[0x0]][_0x347f('0x19')])===0x0){var _0x21b0eb={'messageId':_0x3d0630[_0x811852[0x0]][_0x347f('0x64')]};if(!_0x12eb05['deliveryReport']){_0x21b0eb[_0x347f('0x35')]=!![];}return _0x2fd500['update'](_0x21b0eb);}else{return logger[_0x347f('0x19')](_0x347f('0x26'),_0x347f('0x27'),_0x347f('0x55'),util[_0x347f('0x28')](_0x3d0630[_0x347f('0x19')],{'showHidden':![],'depth':null}));}})[_0x347f('0x18')](function(_0x5149e6){return logger['error'](_0x347f('0x26'),'afterCreate',_0x347f('0x55'),util[_0x347f('0x28')](_0x5149e6,{'showHidden':![],'depth':null}));});}else{logger[_0x347f('0x19')]('SmsMessage,\x20%s,\x20%s,\x20%s',_0x347f('0x27'),'csc',_0x347f('0x65'));}break;case _0x347f('0x66'):if(_0x12eb05['apiKey']){var _0x59925c={'method':_0x347f('0x39'),'uri':_0x347f('0x67'),'headers':{'Authorization':_0x12eb05[_0x347f('0x57')]},'body':{'content':_0x2bdab1[_0x347f('0x22')],'to':[_0x2bdab1[_0x347f('0x1e')]],'from':_0x12eb05[_0x347f('0x1e')],'binary':![],'clientMessageId':_0x347f('0x68'),'charset':_0x347f('0x69')},'json':!![]};rp(_0x59925c)[_0x347f('0x15')](function(_0x34ca1e){if(!_0x34ca1e[_0x347f('0x19')]){var _0x227378={'messageId':_0x34ca1e[_0x347f('0x20')][0x0][_0x347f('0x6a')]};if(!_0x12eb05[_0x347f('0x34')]){_0x227378[_0x347f('0x35')]=!![];}return _0x2fd500['update'](_0x227378);}else{return logger[_0x347f('0x19')](_0x347f('0x26'),_0x347f('0x27'),'clickatell',util[_0x347f('0x28')](_0x34ca1e['error'],{'showHidden':![],'depth':null}));}})[_0x347f('0x18')](function(_0x5436fb){return logger[_0x347f('0x19')](_0x347f('0x26'),_0x347f('0x27'),_0x347f('0x66'),util[_0x347f('0x28')](_0x5436fb,{'showHidden':![],'depth':null}));});}else{logger['error'](_0x347f('0x26'),_0x347f('0x27'),_0x347f('0x66'),_0x347f('0x65'));}break;case _0x347f('0x6b'):if(_0x12eb05[_0x347f('0x3f')]&&_0x12eb05[_0x347f('0x2f')]){var _0xf759ae=util[_0x347f('0x3e')]('%s:%s',_0x12eb05[_0x347f('0x3f')],_0x12eb05[_0x347f('0x2f')]);var _0x4f9f42={'method':_0x347f('0x39'),'uri':_0x347f('0x6c')+_0x12eb05['accountId']+_0x347f('0x6d'),'body':{'to':[_0x2bdab1[_0x347f('0x1e')]],'text':_0x2bdab1[_0x347f('0x22')],'from':_0x12eb05[_0x347f('0x1e')],'applicationId':_0x12eb05[_0x347f('0x6e')]},'headers':{'Authorization':util[_0x347f('0x3e')](_0x347f('0x41'),new Buffer(_0xf759ae)[_0x347f('0x42')](_0x347f('0x43')))},'json':!![]};rp(_0x4f9f42)['then'](function(_0x1edf8e){if(_0x1edf8e['id']){var _0x3df04a={'messageId':_0x1edf8e['id']};return _0x2fd500[_0x347f('0x16')](_0x3df04a);}else{logger[_0x347f('0x19')](_0x347f('0x26'),'afterCreate',_0x347f('0x6b'),util['inspect'](_0x1edf8e,{'showHidden':![],'depth':null}));}})[_0x347f('0x18')](function(_0x577291){logger[_0x347f('0x19')](_0x347f('0x26'),_0x347f('0x27'),_0x347f('0x6b'),util[_0x347f('0x28')](_0x577291,{'showHidden':![],'depth':null}));});}else{logger[_0x347f('0x19')]('SmsMessage,\x20%s,\x20%s,\x20%s','afterCreate',_0x347f('0x6b'),_0x347f('0x36'));}break;case'intelepeer':if(_0x12eb05['apiKey']){var _0x853fe3={};var _0x283115={'method':_0x347f('0x39'),'uri':_0x347f('0x6f'),'headers':{'Authorization':_0x347f('0x70')+_0x12eb05[_0x347f('0x57')],'Content-Type':_0x347f('0x53')},'body':{'from':_0x12eb05[_0x347f('0x1e')],'to':_0x2bdab1[_0x347f('0x1e')],'text':_0x2bdab1['body']},'json':!![]};return rp(_0x283115)[_0x347f('0x15')](function(_0x18dfde){if(_0x18dfde[_0x347f('0x71')]==0xca){_0x853fe3[_0x347f('0x72')]=_0x18dfde;var _0x51101e={'method':_0x347f('0x39'),'uri':_0x347f('0x73'),'headers':{'Authorization':_0x347f('0x70')+_0x12eb05[_0x347f('0x57')],'Content-Type':'application/json'},'body':{'refid':_0x853fe3[_0x347f('0x72')]['refid']},'json':!![]};return rp(_0x51101e)[_0x347f('0x15')](function(_0x41428a){_0x853fe3[_0x347f('0x74')]=_0x41428a;var _0x5d220c={'messageId':_0x853fe3[_0x347f('0x72')][_0x347f('0x75')],'read':!![]};return _0x2fd500[_0x347f('0x16')](_0x5d220c);});}else{return logger[_0x347f('0x19')](_0x347f('0x26'),_0x347f('0x27'),_0x347f('0x76'),util[_0x347f('0x28')](_0x18dfde,{'showHidden':![],'depth':null}));}})['catch'](function(_0x3f924f){return logger['error'](_0x347f('0x26'),_0x347f('0x27'),_0x347f('0x76'),util['inspect'](_0x3f924f,{'showHidden':![],'depth':null}));});}else{return logger['error'](_0x347f('0x26'),'afterCreate',_0x347f('0x76'),'Token\x20not\x20received');}break;}}})[_0x347f('0x77')](function(){_0xcb18b0();});}else{_0xcb18b0();}}},'charset':_0x347f('0x78'),'collate':_0x347f('0x79')});}; \ No newline at end of file +var _0x6782=['phone','authToken','messages','create','remote','/api/sms/messages/','token','sid','update','error','SmsMessage,\x20%s,\x20%s,\x20%s','afterCreate','inspect','Missing\x20parameters:\x20phone,\x20accountSid\x20or\x20authToken','skebby','https://api.skebby.it/API/v1.0/REST/','username','password','smsMethod','sender','&password=','GET','split','sms','POST','session_key','total_sent','internal_order_id','read','Missing\x20parameters:\x20username,\x20password','connectel','https://smsapi.connectel.se/api/v2/send/','requestid','deliveryReport','Missing\x20parameters:\x20authToken','clicksend','xCALLY\x20Motion','senderString','%s:%s','https://rest.clicksend.com/v3/sms/send','http_code','data','queued_count','head','message_id','clickSend','plivo','/status?token=','format','authId','https://api.plivo.com/v1/Account/%s/Message/','Basic\x20%s','toString','message_uuid','Missing\x20parameters:\x20authId,\x20authToken','infobip','baseUrl','/sms/2/text/advanced','application/json','IBSSO\x20','Missing\x20parameters:\x20base_url','csc','apiKey','login','text','timestamp','keys','sort','length','createHash','digest','hex','signature=','clickatell','https://platform.clickatell.com/messages','UTF-8','apiMessageId','Missing\x20parameters:\x20apiKey','bandwidth','https://messaging.bandwidth.com/api/v2/users/','/messages','applicationId','base64','intelepeer','https://api.intelepeer.com/_rest/v4/app/sms/send','Bearer\x20','message','https://api.intelepeer.com/_rest/v4/app/sms/mdr','Token\x20not\x20received','finally','utf8mb4','lodash','util','../../config/logger','api','moment','bluebird','request-promise','path','../../config/environment','./smsMessage.attributes','exports','define','SmsMessage','sms_messages','messageId','fti_sms_messages','body','FULLTEXT','models','get','direction','toLowerCase','out','isNil','findOne','then','createdAt','catch','secret','SmsAccount','find','SmsAccountId','type','twilio','accountSid'];(function(_0x42ebba,_0x4cbf87){var _0x3fd2af=function(_0x26d999){while(--_0x26d999){_0x42ebba['push'](_0x42ebba['shift']());}};_0x3fd2af(++_0x4cbf87);}(_0x6782,0x1d5));var _0x2678=function(_0x27aef5,_0x4d4e8a){_0x27aef5=_0x27aef5-0x0;var _0x245f62=_0x6782[_0x27aef5];return _0x245f62;};'use strict';var _=require(_0x2678('0x0'));var util=require(_0x2678('0x1'));var logger=require(_0x2678('0x2'))(_0x2678('0x3'));var moment=require(_0x2678('0x4'));var BPromise=require(_0x2678('0x5'));var rp=require(_0x2678('0x6'));var fs=require('fs');var path=require(_0x2678('0x7'));var rimraf=require('rimraf');var config=require(_0x2678('0x8'));var attributes=require(_0x2678('0x9'));module[_0x2678('0xa')]=function(_0x9f03,_0x3b3335){return _0x9f03[_0x2678('0xb')](_0x2678('0xc'),attributes,{'tableName':_0x2678('0xd'),'paranoid':![],'indexes':[{'name':_0x2678('0xe'),'fields':[_0x2678('0xe')]},{'name':_0x2678('0xf'),'fields':[_0x2678('0x10')],'type':_0x2678('0x11')}],'timestamps':!![],'hooks':{'afterCreate':function(_0x537fd5,_0x3ee0af,_0x8eeae5){var _0x25b81e=_0x9f03[_0x2678('0x12')];var _0x3525e8=_0x537fd5[_0x2678('0x13')]({'plain':!![]});if(_0x3525e8[_0x2678('0x14')][_0x2678('0x15')]()==='in'||_0x3525e8[_0x2678('0x14')][_0x2678('0x15')]()===_0x2678('0x16')&&!_0x3525e8['secret']&&!_[_0x2678('0x17')](_0x3525e8['UserId'])&&!_[_0x2678('0x17')](_0x3525e8['SmsInteractionId'])){_0x25b81e['SmsInteraction'][_0x2678('0x18')]({'where':{'id':_0x3525e8['SmsInteractionId']}})[_0x2678('0x19')](function(_0x48929e){if(_0x48929e){_0x48929e['update']({'lastMsgAt':_0x3525e8[_0x2678('0x1a')],'lastMsgDirection':_0x3525e8[_0x2678('0x14')][_0x2678('0x15')]()});}})[_0x2678('0x1b')](function(_0x2375b3){console['error'](_0x2375b3);});}if(_0x3525e8['direction']===_0x2678('0x16')&&!_0x3525e8[_0x2678('0x1c')]){var _0x133de6;_0x25b81e[_0x2678('0x1d')][_0x2678('0x1e')]({'where':{'id':_0x3525e8[_0x2678('0x1f')]},'raw':!![]})[_0x2678('0x19')](function(_0x181c84){_0x133de6=_0x181c84;if(_0x133de6&&_0x133de6[_0x2678('0x20')]){switch(_0x133de6[_0x2678('0x20')]){case _0x2678('0x21'):var _0x4661c5=require(_0x2678('0x21'));if(_0x133de6[_0x2678('0x22')]&&_0x133de6['authToken']&&_0x133de6[_0x2678('0x23')]){var _0x3b3dbc=new _0x4661c5(_0x133de6[_0x2678('0x22')],_0x133de6[_0x2678('0x24')]);_0x3b3dbc[_0x2678('0x25')][_0x2678('0x26')]({'body':_0x3525e8['body'],'to':_0x3525e8[_0x2678('0x23')],'from':_0x133de6['phone'],'statusCallback':_0x133de6[_0x2678('0x27')]+_0x2678('0x28')+_0x3525e8['id']+'/status?token='+_0x133de6[_0x2678('0x29')]})[_0x2678('0x19')](function(_0x1382a9){if(_0x1382a9[_0x2678('0x2a')]){return _0x537fd5[_0x2678('0x2b')]({'messageId':_0x1382a9[_0x2678('0x2a')]});}})[_0x2678('0x1b')](function(_0x459b09){logger[_0x2678('0x2c')](_0x2678('0x2d'),_0x2678('0x2e'),_0x2678('0x21'),util[_0x2678('0x2f')](_0x459b09,{'showHidden':![],'depth':null}));});}else{logger[_0x2678('0x2c')]('SmsMessage,\x20%s,\x20%s,\x20%s',_0x2678('0x2e'),'twilio',_0x2678('0x30'));}break;case _0x2678('0x31'):var _0x4a0319=_0x2678('0x32');if(_0x133de6[_0x2678('0x33')]&&_0x133de6[_0x2678('0x34')]){var _0x43be0d={'recipient':[_0x3525e8[_0x2678('0x23')]],'message':_0x3525e8['body'],'message_type':_0x133de6[_0x2678('0x35')]};if(_0x133de6['smsMethod']&&_0x133de6[_0x2678('0x35')]!=='SI'){_0x43be0d[_0x2678('0x36')]=_0x133de6['phone'];}var _0x119a5c={'url':_0x4a0319+'login?username='+_0x133de6['username']+_0x2678('0x37')+_0x133de6[_0x2678('0x34')],'method':_0x2678('0x38')};rp(_0x119a5c)[_0x2678('0x19')](function(_0x4ceb7e){var _0x390d83=_0x4ceb7e[_0x2678('0x39')](';');var _0x335674={'user_key':_0x390d83[0x0],'session_key':_0x390d83[0x1]};_0x119a5c={'url':_0x4a0319+_0x2678('0x3a'),'method':_0x2678('0x3b'),'headers':{'user_key':_0x335674['user_key'],'Session_key':_0x335674[_0x2678('0x3c')]},'json':!![],'body':_0x43be0d};return rp(_0x119a5c);})['then'](function(_0x474c9a){if(_0x474c9a[_0x2678('0x3d')]>=0x1){var _0x2d26b0={'messageId':_0x474c9a[_0x2678('0x3e')]};if(_0x133de6['smsMethod']!=='GP'||!_0x133de6['deliveryReport']){_0x2d26b0[_0x2678('0x3f')]=!![];}return _0x537fd5['update'](_0x2d26b0);}else{return logger[_0x2678('0x2c')](_0x2678('0x2d'),'afterCreate',_0x2678('0x31'),util[_0x2678('0x2f')](_0x474c9a,{'showHidden':![],'depth':null}));}})[_0x2678('0x1b')](function(_0x22a44f){return logger[_0x2678('0x2c')](_0x2678('0x2d'),_0x2678('0x2e'),_0x2678('0x31'),util[_0x2678('0x2f')](_0x22a44f,{'showHidden':![],'depth':null}));});}else{logger['error'](_0x2678('0x2d'),_0x2678('0x2e'),_0x2678('0x31'),_0x2678('0x40'));}break;case _0x2678('0x41'):if(_0x133de6[_0x2678('0x24')]){var _0x20234d={'recipient':_0x3525e8[_0x2678('0x23')],'message':_0x3525e8[_0x2678('0x10')],'sender':_0x133de6['senderString']||_0x133de6[_0x2678('0x23')],'authorization':_0x133de6[_0x2678('0x24')]};var _0x3ee0af={'method':_0x2678('0x3b'),'uri':_0x2678('0x42'),'body':_0x20234d,'json':!![]};rp(_0x3ee0af)[_0x2678('0x19')](function(_0x43205b){var _0x2f60a3={'messageId':_0x43205b[_0x2678('0x43')]};if(!_0x133de6[_0x2678('0x44')]){_0x2f60a3['read']=!![];}return _0x537fd5[_0x2678('0x2b')](_0x2f60a3);})[_0x2678('0x1b')](function(_0x425b8e){logger[_0x2678('0x2c')](_0x2678('0x2d'),_0x2678('0x2e'),_0x2678('0x41'),util[_0x2678('0x2f')](_0x425b8e,{'showHidden':![],'depth':null}));});}else{logger[_0x2678('0x2c')]('SmsMessage,\x20%s,\x20%s,\x20%s',_0x2678('0x2e'),'connectel',_0x2678('0x45'));}break;case _0x2678('0x46'):if(_0x133de6['username']&&_0x133de6[_0x2678('0x34')]){var _0x20234d={'messages':[{'source':_0x2678('0x47'),'to':_0x3525e8['phone'],'body':_0x3525e8[_0x2678('0x10')],'from':_0x133de6[_0x2678('0x48')]||_0x133de6[_0x2678('0x23')]}]};var _0x2701b9=util['format'](_0x2678('0x49'),_0x133de6[_0x2678('0x33')],_0x133de6[_0x2678('0x34')]);var _0x3ee0af={'method':'POST','uri':_0x2678('0x4a'),'body':_0x20234d,'headers':{'Authorization':util['format']('Basic\x20%s',new Buffer(_0x2701b9)['toString']('base64'))},'json':!![]};rp(_0x3ee0af)[_0x2678('0x19')](function(_0x4b436f){if(_0x4b436f['http_code']>=0xc8&&_0x4b436f[_0x2678('0x4b')]<=0xce){if(_0x4b436f[_0x2678('0x4c')]&&_0x4b436f['data'][_0x2678('0x4d')]>0x0){var _0x4ac40e=_[_0x2678('0x4e')](_0x4b436f['data']['messages']);var _0x43165c={'messageId':_0x4ac40e[_0x2678('0x4f')]};if(!_0x133de6[_0x2678('0x44')]){_0x43165c[_0x2678('0x3f')]=!![];}return _0x537fd5['update'](_0x43165c);}else{logger[_0x2678('0x2c')](_0x2678('0x2d'),_0x2678('0x2e'),'clickSend',util[_0x2678('0x2f')](_0x4b436f,{'showHidden':![],'depth':null}));}}else{logger[_0x2678('0x2c')](_0x2678('0x2d'),_0x2678('0x2e'),_0x2678('0x50'),util['inspect'](_0x4b436f,{'showHidden':![],'depth':null}));}})[_0x2678('0x1b')](function(_0x9b74c4){logger['error'](_0x2678('0x2d'),_0x2678('0x2e'),_0x2678('0x50'),util[_0x2678('0x2f')](_0x9b74c4,{'showHidden':![],'depth':null}));});}else{logger[_0x2678('0x2c')](_0x2678('0x2d'),_0x2678('0x2e'),_0x2678('0x50'),_0x2678('0x40'));}break;case _0x2678('0x51'):if(_0x133de6['authId']&&_0x133de6[_0x2678('0x24')]){var _0x20234d={'dst':_0x3525e8['phone'],'text':_0x3525e8[_0x2678('0x10')],'src':_0x133de6[_0x2678('0x48')]||_0x133de6['phone'],'url':_0x133de6[_0x2678('0x27')]+_0x2678('0x28')+_0x3525e8['id']+_0x2678('0x52')+_0x133de6['token']};var _0x2701b9=util[_0x2678('0x53')]('%s:%s',_0x133de6[_0x2678('0x54')],_0x133de6['authToken']);var _0x3ee0af={'method':_0x2678('0x3b'),'uri':util[_0x2678('0x53')](_0x2678('0x55'),_0x133de6[_0x2678('0x54')]),'body':_0x20234d,'headers':{'Authorization':util[_0x2678('0x53')](_0x2678('0x56'),new Buffer(_0x2701b9)[_0x2678('0x57')]('base64'))},'json':!![]};rp(_0x3ee0af)[_0x2678('0x19')](function(_0x18329c){var _0x176949={'messageId':_0x18329c[_0x2678('0x58')][0x0]};return _0x537fd5['update'](_0x176949);})[_0x2678('0x1b')](function(_0x390563){logger[_0x2678('0x2c')](_0x2678('0x2d'),'afterCreate','plivo',util[_0x2678('0x2f')](_0x390563,{'showHidden':![],'depth':null}));});}else{logger[_0x2678('0x2c')](_0x2678('0x2d'),_0x2678('0x2e'),_0x2678('0x51'),_0x2678('0x59'));}break;case _0x2678('0x5a'):if(_0x133de6['username']&&_0x133de6[_0x2678('0x34')]){if(_0x133de6['baseUrl']){var _0x8f4767={'method':_0x2678('0x3b'),'uri':_0x133de6['baseUrl']+'/auth/1/session','body':{'username':_0x133de6[_0x2678('0x33')],'password':_0x133de6['password']},'json':!![]};return rp(_0x8f4767)[_0x2678('0x19')](function(_0x1ee718){var _0x590e3e={'method':_0x2678('0x3b'),'uri':_0x133de6[_0x2678('0x5b')]+_0x2678('0x5c'),'body':{'messages':[{'from':_0x133de6[_0x2678('0x23')],'destinations':[{'to':_0x3525e8[_0x2678('0x23')]}],'text':_0x3525e8[_0x2678('0x10')],'notifyUrl':_0x133de6[_0x2678('0x27')]+'/api/sms/messages/'+_0x3525e8['id']+_0x2678('0x52')+_0x133de6[_0x2678('0x29')],'notifyContentType':_0x2678('0x5d'),'callbackData':_0x133de6[_0x2678('0x23')]+';'+_0x3525e8[_0x2678('0x10')]}]},'headers':{'Authorization':_0x2678('0x5e')+_0x1ee718[_0x2678('0x29')]},'json':!![]};return rp(_0x590e3e)[_0x2678('0x19')](function(_0x568001){if(_0x568001[_0x2678('0x25')]){var _0x93f24c={'messageId':_0x568001[_0x2678('0x25')][0x0][_0x2678('0xe')]};if(!_0x133de6[_0x2678('0x44')]){_0x93f24c['read']=!![];}return _0x537fd5['update'](_0x93f24c);}else{return logger['error'](_0x2678('0x2d'),_0x2678('0x2e'),_0x2678('0x5a'),util[_0x2678('0x2f')](_0x568001,{'showHidden':![],'depth':null}));}});})['catch'](function(_0x2cb092){return logger[_0x2678('0x2c')](_0x2678('0x2d'),_0x2678('0x2e'),_0x2678('0x5a'),util[_0x2678('0x2f')](_0x2cb092,{'showHidden':![],'depth':null}));});}else{logger[_0x2678('0x2c')](_0x2678('0x2d'),_0x2678('0x2e'),_0x2678('0x5a'),_0x2678('0x5f'));}}else{logger['error']('SmsMessage,\x20%s,\x20%s,\x20%s','afterCreate',_0x2678('0x5a'),'Missing\x20parameters:\x20username,\x20password');}break;case _0x2678('0x60'):var _0x296e1e=require('crypto');if(_0x133de6[_0x2678('0x61')]){var _0x40fce9={};_0x40fce9[_0x2678('0x62')]=_0x133de6[_0x2678('0x33')];_0x40fce9['phone']=_0x3525e8['phone'];_0x40fce9[_0x2678('0x36')]=_0x133de6['phone'];_0x40fce9[_0x2678('0x63')]=_0x3525e8[_0x2678('0x10')];_0x40fce9[_0x2678('0x64')]=+new Date();var _0x4f05f3='';var _0x5e0f40='';var _0x2f5fcc=Object[_0x2678('0x65')](_0x40fce9);_0x2f5fcc[_0x2678('0x66')]();for(var _0x2e11e2=0x0;_0x2e11e2<_0x2f5fcc[_0x2678('0x67')];_0x2e11e2++){if(_0x4f05f3!=''){_0x4f05f3+='&';}_0x4f05f3+=_0x2f5fcc[_0x2e11e2]+'='+encodeURIComponent(_0x40fce9[_0x2f5fcc[_0x2e11e2]]);_0x5e0f40+=_0x40fce9[_0x2f5fcc[_0x2e11e2]];}_0x5e0f40+=_0x133de6[_0x2678('0x61')];_0x5e0f40=_0x296e1e[_0x2678('0x68')]('md5')[_0x2678('0x2b')](_0x5e0f40)[_0x2678('0x69')](_0x2678('0x6a'));if(_0x4f05f3!==''){_0x4f05f3+='&';}_0x4f05f3+=_0x2678('0x6b')+_0x5e0f40;var _0x119a5c={'method':'GET','uri':_0x133de6['baseUrl']+'/external/get/send.php?'+_0x4f05f3,'json':!![]};return rp(_0x119a5c)[_0x2678('0x19')](function(_0x5e399d){var _0x579a10=Object[_0x2678('0x65')](_0x5e399d);if(_0x5e399d[_0x579a10[0x0]]['error']&&parseInt(_0x5e399d[_0x579a10[0x0]][_0x2678('0x2c')])===0x0){var _0x23d204={'messageId':_0x5e399d[_0x579a10[0x0]]['id_sms']};if(!_0x133de6[_0x2678('0x44')]){_0x23d204['read']=!![];}return _0x537fd5[_0x2678('0x2b')](_0x23d204);}else{return logger[_0x2678('0x2c')]('SmsMessage,\x20%s,\x20%s,\x20%s','afterCreate',_0x2678('0x60'),util[_0x2678('0x2f')](_0x5e399d[_0x2678('0x2c')],{'showHidden':![],'depth':null}));}})[_0x2678('0x1b')](function(_0x4e8a1e){return logger[_0x2678('0x2c')](_0x2678('0x2d'),_0x2678('0x2e'),_0x2678('0x60'),util[_0x2678('0x2f')](_0x4e8a1e,{'showHidden':![],'depth':null}));});}else{logger[_0x2678('0x2c')](_0x2678('0x2d'),_0x2678('0x2e'),_0x2678('0x60'),'Missing\x20parameters:\x20apiKey');}break;case _0x2678('0x6c'):if(_0x133de6['apiKey']){var _0x32825f={'method':'POST','uri':_0x2678('0x6d'),'headers':{'Authorization':_0x133de6[_0x2678('0x61')]},'body':{'content':_0x3525e8[_0x2678('0x10')],'to':[_0x3525e8[_0x2678('0x23')]],'from':_0x133de6[_0x2678('0x23')],'binary':![],'clientMessageId':'uuid','charset':_0x2678('0x6e')},'json':!![]};rp(_0x32825f)[_0x2678('0x19')](function(_0x4ead6c){if(!_0x4ead6c[_0x2678('0x2c')]){var _0x3ec5c5={'messageId':_0x4ead6c[_0x2678('0x25')][0x0][_0x2678('0x6f')]};if(!_0x133de6[_0x2678('0x44')]){_0x3ec5c5[_0x2678('0x3f')]=!![];}return _0x537fd5[_0x2678('0x2b')](_0x3ec5c5);}else{return logger[_0x2678('0x2c')](_0x2678('0x2d'),_0x2678('0x2e'),_0x2678('0x6c'),util['inspect'](_0x4ead6c[_0x2678('0x2c')],{'showHidden':![],'depth':null}));}})[_0x2678('0x1b')](function(_0x85d250){return logger['error'](_0x2678('0x2d'),_0x2678('0x2e'),'clickatell',util[_0x2678('0x2f')](_0x85d250,{'showHidden':![],'depth':null}));});}else{logger[_0x2678('0x2c')](_0x2678('0x2d'),'afterCreate','clickatell',_0x2678('0x70'));}break;case _0x2678('0x71'):if(_0x133de6[_0x2678('0x33')]&&_0x133de6[_0x2678('0x34')]){var _0x2701b9=util[_0x2678('0x53')]('%s:%s',_0x133de6[_0x2678('0x33')],_0x133de6['password']);var _0x3ee0af={'method':'POST','uri':_0x2678('0x72')+_0x133de6['accountId']+_0x2678('0x73'),'body':{'to':[_0x3525e8[_0x2678('0x23')]],'text':_0x3525e8[_0x2678('0x10')],'from':_0x133de6[_0x2678('0x23')],'applicationId':_0x133de6[_0x2678('0x74')]},'headers':{'Authorization':util[_0x2678('0x53')](_0x2678('0x56'),new Buffer(_0x2701b9)[_0x2678('0x57')](_0x2678('0x75')))},'json':!![]};rp(_0x3ee0af)[_0x2678('0x19')](function(_0x32c493){if(_0x32c493['id']){var _0x101fcd={'messageId':_0x32c493['id']};return _0x537fd5[_0x2678('0x2b')](_0x101fcd);}else{logger[_0x2678('0x2c')]('SmsMessage,\x20%s,\x20%s,\x20%s','afterCreate',_0x2678('0x71'),util['inspect'](_0x32c493,{'showHidden':![],'depth':null}));}})['catch'](function(_0xb09fc4){logger['error'](_0x2678('0x2d'),_0x2678('0x2e'),_0x2678('0x71'),util['inspect'](_0xb09fc4,{'showHidden':![],'depth':null}));});}else{logger[_0x2678('0x2c')](_0x2678('0x2d'),'afterCreate',_0x2678('0x71'),_0x2678('0x40'));}break;case _0x2678('0x76'):if(_0x133de6[_0x2678('0x61')]){var _0x308407={};var _0x119a5c={'method':_0x2678('0x3b'),'uri':_0x2678('0x77'),'headers':{'Authorization':_0x2678('0x78')+_0x133de6[_0x2678('0x61')],'Content-Type':'application/json'},'body':{'from':_0x133de6[_0x2678('0x23')],'to':_0x3525e8[_0x2678('0x23')],'text':_0x3525e8[_0x2678('0x10')]},'json':!![]};return rp(_0x119a5c)[_0x2678('0x19')](function(_0x4a26a5){if(_0x4a26a5['code']==0xca){_0x308407[_0x2678('0x79')]=_0x4a26a5;var _0x3e52c1={'method':_0x2678('0x3b'),'uri':_0x2678('0x7a'),'headers':{'Authorization':'Bearer\x20'+_0x133de6[_0x2678('0x61')],'Content-Type':_0x2678('0x5d')},'body':{'refid':_0x308407[_0x2678('0x79')]['refid']},'json':!![]};return rp(_0x3e52c1)[_0x2678('0x19')](function(_0x11b945){_0x308407['status']=_0x11b945;var _0x29d955={'messageId':_0x308407[_0x2678('0x79')]['refid'],'read':!![]};return _0x537fd5[_0x2678('0x2b')](_0x29d955);});}else{return logger[_0x2678('0x2c')](_0x2678('0x2d'),_0x2678('0x2e'),_0x2678('0x76'),util['inspect'](_0x4a26a5,{'showHidden':![],'depth':null}));}})[_0x2678('0x1b')](function(_0x2786ff){return logger[_0x2678('0x2c')]('SmsMessage,\x20%s,\x20%s,\x20%s',_0x2678('0x2e'),_0x2678('0x76'),util['inspect'](_0x2786ff,{'showHidden':![],'depth':null}));});}else{return logger[_0x2678('0x2c')](_0x2678('0x2d'),'afterCreate','intelepeer',_0x2678('0x7b'));}break;}}})[_0x2678('0x7c')](function(){_0x8eeae5();});}else{_0x8eeae5();}}},'charset':_0x2678('0x7d'),'collate':'utf8mb4_unicode_ci'});}; \ No newline at end of file diff --git a/server/api/smsMessage/smsMessage.rpc.js b/server/api/smsMessage/smsMessage.rpc.js index a829a9b..0285eda 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 _0x54bd=['SmsMessage,\x20%s,\x20%s','debug','SmsMessage,\x20%s,\x20%s,\x20%s','request\x20sent','error','code','message','result','catch','CreateSmsMessage','SmsMessage','create','body','options','raw','info','stringify','lodash','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','rpc','../../config/environment','jayson/promise','client','http','redis','defaults','localhost','socket.io-emitter','register','request','then'];(function(_0x272509,_0x561669){var _0x141133=function(_0x30b928){while(--_0x30b928){_0x272509['push'](_0x272509['shift']());}};_0x141133(++_0x561669);}(_0x54bd,0xc5));var _0xd54b=function(_0x1c9176,_0x1b66eb){_0x1c9176=_0x1c9176-0x0;var _0x93deeb=_0x54bd[_0x1c9176];return _0x93deeb;};'use strict';var _=require(_0xd54b('0x0'));var util=require('util');var moment=require(_0xd54b('0x1'));var BPromise=require(_0xd54b('0x2'));var rs=require(_0xd54b('0x3'));var fs=require('fs');var Redis=require(_0xd54b('0x4'));var db=require(_0xd54b('0x5'))['db'];var utils=require(_0xd54b('0x6'));var logger=require('../../config/logger')(_0xd54b('0x7'));var config=require(_0xd54b('0x8'));var jayson=require(_0xd54b('0x9'));var client=jayson[_0xd54b('0xa')][_0xd54b('0xb')]({'port':0x232a});config[_0xd54b('0xc')]=_[_0xd54b('0xd')](config[_0xd54b('0xc')],{'host':_0xd54b('0xe'),'port':0x18eb});var socket=require(_0xd54b('0xf'))(new Redis(config['redis']));require('./smsMessage.socket')[_0xd54b('0x10')](socket);function respondWithRpcPromise(_0x171e47,_0x32fb9e,_0x42c936){return new BPromise(function(_0x1bd1f0,_0x3e4866){return client[_0xd54b('0x11')](_0x171e47,_0x42c936)[_0xd54b('0x12')](function(_0x3b2ff8){logger['info'](_0xd54b('0x13'),_0x32fb9e,'request\x20sent');logger[_0xd54b('0x14')](_0xd54b('0x15'),_0x32fb9e,_0xd54b('0x16'),JSON['stringify'](_0x3b2ff8));if(_0x3b2ff8[_0xd54b('0x17')]){if(_0x3b2ff8[_0xd54b('0x17')][_0xd54b('0x18')]===0x1f4){logger['error'](_0xd54b('0x13'),_0x32fb9e,_0x3b2ff8[_0xd54b('0x17')][_0xd54b('0x19')]);return _0x3e4866(_0x3b2ff8[_0xd54b('0x17')][_0xd54b('0x19')]);}logger[_0xd54b('0x17')]('SmsMessage,\x20%s,\x20%s',_0x32fb9e,_0x3b2ff8[_0xd54b('0x17')][_0xd54b('0x19')]);return _0x1bd1f0(_0x3b2ff8[_0xd54b('0x17')][_0xd54b('0x19')]);}else{logger['info']('SmsMessage,\x20%s,\x20%s',_0x32fb9e,_0xd54b('0x16'));_0x1bd1f0(_0x3b2ff8[_0xd54b('0x1a')][_0xd54b('0x19')]);}})[_0xd54b('0x1b')](function(_0x51b2b6){logger[_0xd54b('0x17')]('SmsMessage,\x20%s,\x20%s',_0x32fb9e,_0x51b2b6);_0x3e4866(_0x51b2b6);});});}exports[_0xd54b('0x1c')]=function(_0x35fa55){var _0x4afb20=this;return new Promise(function(_0x3203db,_0x36c022){return db[_0xd54b('0x1d')][_0xd54b('0x1e')](_0x35fa55[_0xd54b('0x1f')],{'raw':_0x35fa55['options']?_0x35fa55[_0xd54b('0x20')][_0xd54b('0x21')]===undefined?!![]:![]:!![]})[_0xd54b('0x12')](function(_0x48ce9f){logger[_0xd54b('0x22')](_0xd54b('0x1c'),_0x35fa55);logger[_0xd54b('0x14')](_0xd54b('0x1c'),_0x35fa55,JSON[_0xd54b('0x23')](_0x48ce9f));_0x3203db(_0x48ce9f);})['catch'](function(_0x260602){logger[_0xd54b('0x17')]('CreateSmsMessage',_0x260602[_0xd54b('0x19')],_0x35fa55);_0x36c022(_0x4afb20[_0xd54b('0x17')](0x1f4,_0x260602[_0xd54b('0x19')]));});});}; \ No newline at end of file +var _0x9a3c=['moment','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','client','http','redis','localhost','./smsMessage.socket','request','then','request\x20sent','debug','error','SmsMessage,\x20%s,\x20%s','message','info','result','catch','CreateSmsMessage','SmsMessage','create','options','raw','stringify','lodash','util'];(function(_0x3dd15e,_0x1f0015){var _0x231fd0=function(_0x4f680a){while(--_0x4f680a){_0x3dd15e['push'](_0x3dd15e['shift']());}};_0x231fd0(++_0x1f0015);}(_0x9a3c,0x191));var _0xc9a3=function(_0x387777,_0x356171){_0x387777=_0x387777-0x0;var _0x3f84c0=_0x9a3c[_0x387777];return _0x3f84c0;};'use strict';var _=require(_0xc9a3('0x0'));var util=require(_0xc9a3('0x1'));var moment=require(_0xc9a3('0x2'));var BPromise=require('bluebird');var rs=require('randomstring');var fs=require('fs');var Redis=require(_0xc9a3('0x3'));var db=require(_0xc9a3('0x4'))['db'];var utils=require(_0xc9a3('0x5'));var logger=require(_0xc9a3('0x6'))(_0xc9a3('0x7'));var config=require(_0xc9a3('0x8'));var jayson=require(_0xc9a3('0x9'));var client=jayson[_0xc9a3('0xa')][_0xc9a3('0xb')]({'port':0x232a});config[_0xc9a3('0xc')]=_['defaults'](config[_0xc9a3('0xc')],{'host':_0xc9a3('0xd'),'port':0x18eb});var socket=require('socket.io-emitter')(new Redis(config['redis']));require(_0xc9a3('0xe'))['register'](socket);function respondWithRpcPromise(_0xc6837d,_0x42787f,_0x521b6f){return new BPromise(function(_0x24fdd2,_0x1b1380){return client[_0xc9a3('0xf')](_0xc6837d,_0x521b6f)[_0xc9a3('0x10')](function(_0x236a9c){logger['info']('SmsMessage,\x20%s,\x20%s',_0x42787f,_0xc9a3('0x11'));logger[_0xc9a3('0x12')]('SmsMessage,\x20%s,\x20%s,\x20%s',_0x42787f,'request\x20sent',JSON['stringify'](_0x236a9c));if(_0x236a9c[_0xc9a3('0x13')]){if(_0x236a9c[_0xc9a3('0x13')]['code']===0x1f4){logger[_0xc9a3('0x13')](_0xc9a3('0x14'),_0x42787f,_0x236a9c['error'][_0xc9a3('0x15')]);return _0x1b1380(_0x236a9c[_0xc9a3('0x13')][_0xc9a3('0x15')]);}logger[_0xc9a3('0x13')](_0xc9a3('0x14'),_0x42787f,_0x236a9c[_0xc9a3('0x13')][_0xc9a3('0x15')]);return _0x24fdd2(_0x236a9c[_0xc9a3('0x13')]['message']);}else{logger[_0xc9a3('0x16')](_0xc9a3('0x14'),_0x42787f,_0xc9a3('0x11'));_0x24fdd2(_0x236a9c[_0xc9a3('0x17')][_0xc9a3('0x15')]);}})[_0xc9a3('0x18')](function(_0x347ad8){logger[_0xc9a3('0x13')](_0xc9a3('0x14'),_0x42787f,_0x347ad8);_0x1b1380(_0x347ad8);});});}exports[_0xc9a3('0x19')]=function(_0x560d8e){var _0x55e1a3=this;return new Promise(function(_0x23ceeb,_0xed2ae3){return db[_0xc9a3('0x1a')][_0xc9a3('0x1b')](_0x560d8e['body'],{'raw':_0x560d8e[_0xc9a3('0x1c')]?_0x560d8e[_0xc9a3('0x1c')][_0xc9a3('0x1d')]===undefined?!![]:![]:!![]})['then'](function(_0x559e85){logger[_0xc9a3('0x16')](_0xc9a3('0x19'),_0x560d8e);logger[_0xc9a3('0x12')]('CreateSmsMessage',_0x560d8e,JSON[_0xc9a3('0x1e')](_0x559e85));_0x23ceeb(_0x559e85);})['catch'](function(_0x48fd47){logger[_0xc9a3('0x13')](_0xc9a3('0x19'),_0x48fd47[_0xc9a3('0x15')],_0x560d8e);_0xed2ae3(_0x55e1a3[_0xc9a3('0x13')](0x1f4,_0x48fd47[_0xc9a3('0x15')]));});});}; \ No newline at end of file diff --git a/server/api/smsMessage/smsMessage.socket.js b/server/api/smsMessage/smsMessage.socket.js index 7198c0c..5f201ed 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 _0xfb92=['removeListener','register','length','./smsMessage.events','save','remove','update','emit'];(function(_0x481bf7,_0x437f69){var _0x461787=function(_0xb3bc9d){while(--_0xb3bc9d){_0x481bf7['push'](_0x481bf7['shift']());}};_0x461787(++_0x437f69);}(_0xfb92,0x1a3));var _0x2fb9=function(_0x5f4a77,_0x177a28){_0x5f4a77=_0x5f4a77-0x0;var _0x3f83e4=_0xfb92[_0x5f4a77];return _0x3f83e4;};'use strict';var SmsMessageEvents=require(_0x2fb9('0x0'));var events=[_0x2fb9('0x1'),_0x2fb9('0x2'),_0x2fb9('0x3')];function createListener(_0x5c1527,_0x33c47b){return function(_0x24e433){_0x33c47b[_0x2fb9('0x4')](_0x5c1527,_0x24e433);};}function removeListener(_0x10a915,_0x4f83c5){return function(){SmsMessageEvents[_0x2fb9('0x5')](_0x10a915,_0x4f83c5);};}exports[_0x2fb9('0x6')]=function(_0x5414c1){for(var _0x1a0589=0x0,_0x3c9922=events[_0x2fb9('0x7')];_0x1a0589<_0x3c9922;_0x1a0589++){var _0x59c2e3=events[_0x1a0589];var _0x15a74f=createListener('smsMessage:'+_0x59c2e3,_0x5414c1);SmsMessageEvents['on'](_0x59c2e3,_0x15a74f);}}; \ No newline at end of file +var _0x1dfc=['removeListener','register','length','smsMessage:','./smsMessage.events','remove','update'];(function(_0x321df4,_0x3efec5){var _0x50d06c=function(_0x3ac0f4){while(--_0x3ac0f4){_0x321df4['push'](_0x321df4['shift']());}};_0x50d06c(++_0x3efec5);}(_0x1dfc,0x1af));var _0xc1df=function(_0x416cff,_0xdc539c){_0x416cff=_0x416cff-0x0;var _0x34b44c=_0x1dfc[_0x416cff];return _0x34b44c;};'use strict';var SmsMessageEvents=require(_0xc1df('0x0'));var events=['save',_0xc1df('0x1'),_0xc1df('0x2')];function createListener(_0x1083c1,_0x221c12){return function(_0x5653a8){_0x221c12['emit'](_0x1083c1,_0x5653a8);};}function removeListener(_0x3ef511,_0x3419f7){return function(){SmsMessageEvents[_0xc1df('0x3')](_0x3ef511,_0x3419f7);};}exports[_0xc1df('0x4')]=function(_0xcd0ffb){for(var _0x57f09a=0x0,_0x402668=events[_0xc1df('0x5')];_0x57f09a<_0x402668;_0x57f09a++){var _0x478dd3=events[_0x57f09a];var _0x7b87fe=createListener(_0xc1df('0x6')+_0x478dd3,_0xcd0ffb);SmsMessageEvents['on'](_0x478dd3,_0x7b87fe);}}; \ No newline at end of file diff --git a/server/api/smsQueue/index.js b/server/api/smsQueue/index.js index 9a2a4eb..23b6d50 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 _0xc15d=['removeAgents','exports','multer','util','connect-timeout','Router','fs-extra','../../components/auth/service','../../components/interaction/service','get','index','/describe','isAuthenticated','show','/:id/members','getMembers','/:id/teams','getTeams','/:id/users','getAgents','create','post','addTeams','addAgents','/:id','update','delete','destroy','removeTeams'];(function(_0x3689aa,_0x2ff859){var _0x393312=function(_0x2907fd){while(--_0x2907fd){_0x3689aa['push'](_0x3689aa['shift']());}};_0x393312(++_0x2ff859);}(_0xc15d,0x76));var _0xdc15=function(_0x3a4a3d,_0x5775f6){_0x3a4a3d=_0x3a4a3d-0x0;var _0x377c46=_0xc15d[_0x3a4a3d];return _0x377c46;};'use strict';var multer=require(_0xdc15('0x0'));var util=require(_0xdc15('0x1'));var path=require('path');var timeout=require(_0xdc15('0x2'));var express=require('express');var router=express[_0xdc15('0x3')]();var fs_extra=require(_0xdc15('0x4'));var auth=require(_0xdc15('0x5'));var interaction=require(_0xdc15('0x6'));var config=require('../../config/environment');var controller=require('./smsQueue.controller');router[_0xdc15('0x7')]('/',auth['isAuthenticated'](),controller[_0xdc15('0x8')]);router['get'](_0xdc15('0x9'),auth[_0xdc15('0xa')](),controller['describe']);router[_0xdc15('0x7')]('/:id',auth[_0xdc15('0xa')](),controller[_0xdc15('0xb')]);router['get'](_0xdc15('0xc'),auth[_0xdc15('0xa')](),controller[_0xdc15('0xd')]);router[_0xdc15('0x7')](_0xdc15('0xe'),auth[_0xdc15('0xa')](),controller[_0xdc15('0xf')]);router[_0xdc15('0x7')](_0xdc15('0x10'),auth['isAuthenticated'](),controller[_0xdc15('0x11')]);router['post']('/',auth[_0xdc15('0xa')](),controller[_0xdc15('0x12')]);router[_0xdc15('0x13')](_0xdc15('0xe'),auth[_0xdc15('0xa')](),controller[_0xdc15('0x14')]);router[_0xdc15('0x13')]('/:id/users',auth[_0xdc15('0xa')](),controller[_0xdc15('0x15')]);router['put'](_0xdc15('0x16'),auth[_0xdc15('0xa')](),controller[_0xdc15('0x17')]);router[_0xdc15('0x18')](_0xdc15('0x16'),auth['isAuthenticated'](),controller[_0xdc15('0x19')]);router['delete'](_0xdc15('0xe'),auth[_0xdc15('0xa')](),controller[_0xdc15('0x1a')]);router['delete'](_0xdc15('0x10'),auth[_0xdc15('0xa')](),controller[_0xdc15('0x1b')]);module[_0xdc15('0x1c')]=router; \ No newline at end of file +var _0xb04c=['/:id/teams','getTeams','getAgents','post','addTeams','/:id/users','addAgents','put','update','delete','destroy','removeTeams','exports','multer','util','express','Router','../../components/auth/service','../../components/interaction/service','../../config/environment','./smsQueue.controller','get','isAuthenticated','/describe','describe','/:id','show','/:id/members'];(function(_0x36dfbd,_0x5bfe2d){var _0x4ecad9=function(_0x5230da){while(--_0x5230da){_0x36dfbd['push'](_0x36dfbd['shift']());}};_0x4ecad9(++_0x5bfe2d);}(_0xb04c,0x109));var _0xcb04=function(_0xa2bf31,_0x2a76a6){_0xa2bf31=_0xa2bf31-0x0;var _0x4f512f=_0xb04c[_0xa2bf31];return _0x4f512f;};'use strict';var multer=require(_0xcb04('0x0'));var util=require(_0xcb04('0x1'));var path=require('path');var timeout=require('connect-timeout');var express=require(_0xcb04('0x2'));var router=express[_0xcb04('0x3')]();var fs_extra=require('fs-extra');var auth=require(_0xcb04('0x4'));var interaction=require(_0xcb04('0x5'));var config=require(_0xcb04('0x6'));var controller=require(_0xcb04('0x7'));router[_0xcb04('0x8')]('/',auth[_0xcb04('0x9')](),controller['index']);router[_0xcb04('0x8')](_0xcb04('0xa'),auth['isAuthenticated'](),controller[_0xcb04('0xb')]);router[_0xcb04('0x8')](_0xcb04('0xc'),auth[_0xcb04('0x9')](),controller[_0xcb04('0xd')]);router[_0xcb04('0x8')](_0xcb04('0xe'),auth[_0xcb04('0x9')](),controller['getMembers']);router[_0xcb04('0x8')](_0xcb04('0xf'),auth[_0xcb04('0x9')](),controller[_0xcb04('0x10')]);router[_0xcb04('0x8')]('/:id/users',auth[_0xcb04('0x9')](),controller[_0xcb04('0x11')]);router[_0xcb04('0x12')]('/',auth[_0xcb04('0x9')](),controller['create']);router[_0xcb04('0x12')](_0xcb04('0xf'),auth['isAuthenticated'](),controller[_0xcb04('0x13')]);router['post'](_0xcb04('0x14'),auth['isAuthenticated'](),controller[_0xcb04('0x15')]);router[_0xcb04('0x16')]('/:id',auth[_0xcb04('0x9')](),controller[_0xcb04('0x17')]);router[_0xcb04('0x18')](_0xcb04('0xc'),auth[_0xcb04('0x9')](),controller[_0xcb04('0x19')]);router[_0xcb04('0x18')](_0xcb04('0xf'),auth[_0xcb04('0x9')](),controller[_0xcb04('0x1a')]);router[_0xcb04('0x18')](_0xcb04('0x14'),auth[_0xcb04('0x9')](),controller['removeAgents']);module[_0xcb04('0x1b')]=router; \ No newline at end of file diff --git a/server/api/smsQueue/smsQueue.attributes.js b/server/api/smsQueue/smsQueue.attributes.js index 83c42e1..d85dd29 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 _0x9640=['sequelize','exports','STRING','name','INTEGER','rrmemory','beepall','roundrobin'];(function(_0x3c9487,_0x1316d5){var _0x1149c0=function(_0xda3e3f){while(--_0xda3e3f){_0x3c9487['push'](_0x3c9487['shift']());}};_0x1149c0(++_0x1316d5);}(_0x9640,0x170));var _0x0964=function(_0x2eaa5b,_0x398439){_0x2eaa5b=_0x2eaa5b-0x0;var _0x19e78c=_0x9640[_0x2eaa5b];return _0x19e78c;};'use strict';var Sequelize=require(_0x0964('0x0'));module[_0x0964('0x1')]={'name':{'type':Sequelize[_0x0964('0x2')],'unique':_0x0964('0x3'),'validate':{'notEmpty':!![],'is':/^[A-Za-z0-9\.\_]+$/i}},'description':{'type':Sequelize[_0x0964('0x2')]},'timeout':{'type':Sequelize[_0x0964('0x4')],'validate':{'min':0x1,'max':0x20c49b}},'strategy':{'type':Sequelize['ENUM'](_0x0964('0x5'),_0x0964('0x6'),_0x0964('0x7'))}}; \ No newline at end of file +var _0xdbd2=['rrmemory','beepall','roundrobin','sequelize','exports','STRING','name','INTEGER','ENUM'];(function(_0x59ab10,_0x538141){var _0x383f73=function(_0x3eb88e){while(--_0x3eb88e){_0x59ab10['push'](_0x59ab10['shift']());}};_0x383f73(++_0x538141);}(_0xdbd2,0x1c5));var _0x2dbd=function(_0x1b9167,_0x4df5ce){_0x1b9167=_0x1b9167-0x0;var _0x38face=_0xdbd2[_0x1b9167];return _0x38face;};'use strict';var Sequelize=require(_0x2dbd('0x0'));module[_0x2dbd('0x1')]={'name':{'type':Sequelize[_0x2dbd('0x2')],'unique':_0x2dbd('0x3'),'validate':{'notEmpty':!![],'is':/^[A-Za-z0-9\.\_]+$/i}},'description':{'type':Sequelize[_0x2dbd('0x2')]},'timeout':{'type':Sequelize[_0x2dbd('0x4')],'validate':{'min':0x1,'max':0x20c49b}},'strategy':{'type':Sequelize[_0x2dbd('0x5')](_0x2dbd('0x6'),_0x2dbd('0x7'),_0x2dbd('0x8'))}}; \ No newline at end of file diff --git a/server/api/smsQueue/smsQueue.controller.js b/server/api/smsQueue/smsQueue.controller.js index d0b815d..b660c40 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 _0xadb5=['%s/%s','pick','filter','getTeams','addTeams','ids','findAll','online','voicePause','interface','flatMap','Agents','sequelize','transaction','each','forEach','userSmsQueue:save','removeTeams','Team','field','tq.TeamId','from','team_has_sms_queues','join','ut.TeamId\x20=\x20tq.TeamId','SmsQueueId\x20=\x20?','ut.UserId\x20=\x20?','push','toString','QueryTypes','SELECT','every','TeamId','all','union','compact','value','find','isEmpty','removeAgents','emit','userSmsQueue:remove','addAgents','omit','spread','isArray','getAgents','util','squel','ioredis','../../components/parsers/qs','api','../../config/environment','../../mysqldb','defaults','redis','localhost','socket.io-emitter','./smsQueue.socket','register','sendStatus','status','end','json','offset','limit','undefined','set','Content-Range','update','then','destroy','SmsQueues','UserProfileResource','error','stack','name','send','index','SmsQueue','rawAttributes','type','key','getOptions','where','count','include','query','rows','catch','show','model','keys','filters','fields','attributes','length','includeAll','options','create','user','get','role','autoAssociation','body','params','describe','getMembers','findOne','intersection','hasOwnProperty','nolimit','order','sort','SmsQueueId','merge','UserSmsQueue','User','findAndCountAll','map','UserId','agent','smsPause','updatedAt','createdAt','format'];(function(_0x588011,_0x5e9d11){var _0x3b3773=function(_0x4cca54){while(--_0x4cca54){_0x588011['push'](_0x588011['shift']());}};_0x3b3773(++_0x5e9d11);}(_0xadb5,0xad));var _0x5adb=function(_0x4c3a22,_0x2cdd50){_0x4c3a22=_0x4c3a22-0x0;var _0x145259=_0xadb5[_0x4c3a22];return _0x145259;};'use strict';var BPromise=require('bluebird');var util=require(_0x5adb('0x0'));var _=require('lodash');var squel=require(_0x5adb('0x1'));var Redis=require(_0x5adb('0x2'));var qs=require(_0x5adb('0x3'));var logger=require('../../config/logger')(_0x5adb('0x4'));var config=require(_0x5adb('0x5'));var db=require(_0x5adb('0x6'))['db'];config['redis']=_[_0x5adb('0x7')](config[_0x5adb('0x8')],{'host':_0x5adb('0x9'),'port':0x18eb});var socket=require(_0x5adb('0xa'))(new Redis(config[_0x5adb('0x8')]));require(_0x5adb('0xb'))[_0x5adb('0xc')](socket);function respondWithStatusCode(_0x6d1b45,_0x41261c){_0x41261c=_0x41261c||0xcc;return function(_0x7293ab){if(_0x7293ab){return _0x6d1b45[_0x5adb('0xd')](_0x41261c);}return _0x6d1b45[_0x5adb('0xe')](_0x41261c)[_0x5adb('0xf')]();};}function respondWithResult(_0x275428,_0x563d86){_0x563d86=_0x563d86||0xc8;return function(_0x4c268d){if(_0x4c268d){return _0x275428[_0x5adb('0xe')](_0x563d86)[_0x5adb('0x10')](_0x4c268d);}};}function respondWithFilteredResult(_0x82e67e,_0x53b772){return function(_0x29f0d5){if(_0x29f0d5){var _0x56012f=typeof _0x53b772[_0x5adb('0x11')]==='undefined'&&typeof _0x53b772[_0x5adb('0x12')]===_0x5adb('0x13');var _0x44abe3=_0x29f0d5['count'];var _0x2a545b=_0x56012f?0x0:_0x53b772[_0x5adb('0x11')];var _0xf82f72=_0x56012f?_0x29f0d5['count']:_0x53b772[_0x5adb('0x11')]+_0x53b772['limit'];var _0x367d82;if(_0xf82f72>=_0x44abe3){_0xf82f72=_0x44abe3;_0x367d82=0xc8;}else{_0x367d82=0xce;}_0x82e67e[_0x5adb('0xe')](_0x367d82);return _0x82e67e[_0x5adb('0x14')](_0x5adb('0x15'),_0x2a545b+'-'+_0xf82f72+'/'+_0x44abe3)[_0x5adb('0x10')](_0x29f0d5);}return null;};}function saveUpdates(_0x39d24d){return function(_0xa29dc){if(_0xa29dc){return _0xa29dc[_0x5adb('0x16')](_0x39d24d)[_0x5adb('0x17')](function(_0x529b65){return _0x529b65;});}return null;};}function removeEntity(_0x3fff62){return function(_0x5de028){if(_0x5de028){return _0x5de028[_0x5adb('0x18')]()['then'](function(){var _0x3ef465=_0x5de028['get']({'plain':!![]});var _0x5e218c=_0x5adb('0x19');return db[_0x5adb('0x1a')][_0x5adb('0x18')]({'where':{'type':_0x5e218c,'resourceId':_0x3ef465['id']}})[_0x5adb('0x17')](function(){return _0x5de028;});})[_0x5adb('0x17')](function(){_0x3fff62['status'](0xcc)[_0x5adb('0xf')]();});}};}function handleEntityNotFound(_0x5c296e){return function(_0x4e9f16){if(!_0x4e9f16){_0x5c296e[_0x5adb('0xd')](0x194);}return _0x4e9f16;};}function handleError(_0x379b33,_0x1a38d3){_0x1a38d3=_0x1a38d3||0x1f4;return function(_0x1a8014){logger[_0x5adb('0x1b')](_0x1a8014[_0x5adb('0x1c')]);if(_0x1a8014[_0x5adb('0x1d')]){delete _0x1a8014['name'];}_0x379b33[_0x5adb('0xe')](_0x1a38d3)[_0x5adb('0x1e')](_0x1a8014);};}exports[_0x5adb('0x1f')]=function(_0x3839fb,_0xeb556c){var _0x49f203={};var _0x2fee18={'count':0x0,'rows':[]};var _0x2e1e63=_['map'](db[_0x5adb('0x20')][_0x5adb('0x21')],function(_0x1a0acd){return{'name':_0x1a0acd['fieldName'],'type':_0x1a0acd[_0x5adb('0x22')][_0x5adb('0x23')]};});_0x49f203=qs[_0x5adb('0x24')](_0x2e1e63,_0x3839fb);var _0x2c64a3={'where':_0x49f203[_0x5adb('0x25')]};return db[_0x5adb('0x20')]['count'](_0x2c64a3)['then'](function(_0x5d457e){_0x2fee18[_0x5adb('0x26')]=_0x5d457e;_0x49f203[_0x5adb('0x27')]=qs[_0x5adb('0x27')](_0x3839fb[_0x5adb('0x28')]);return db[_0x5adb('0x20')]['findAll'](_0x49f203);})[_0x5adb('0x17')](function(_0x34b793){_0x2fee18[_0x5adb('0x29')]=_0x34b793;return _0x2fee18;})[_0x5adb('0x17')](respondWithFilteredResult(_0xeb556c,_0x49f203))[_0x5adb('0x2a')](handleError(_0xeb556c,null));};exports[_0x5adb('0x2b')]=function(_0x28190d,_0x28bf1f){var _0x138bf6={'raw':!![],'where':{'id':_0x28190d['params']['id']}},_0x260295={};_0x260295[_0x5adb('0x2c')]=_['keys'](db[_0x5adb('0x20')][_0x5adb('0x21')]);_0x260295['query']=_[_0x5adb('0x2d')](_0x28190d[_0x5adb('0x28')]);_0x260295[_0x5adb('0x2e')]=_['intersection'](_0x260295[_0x5adb('0x2c')],_0x260295[_0x5adb('0x28')]);_0x138bf6['attributes']=_['intersection'](_0x260295[_0x5adb('0x2c')],qs['fields'](_0x28190d[_0x5adb('0x28')][_0x5adb('0x2f')]));_0x138bf6[_0x5adb('0x30')]=_0x138bf6[_0x5adb('0x30')][_0x5adb('0x31')]?_0x138bf6['attributes']:_0x260295[_0x5adb('0x2c')];if(_0x28190d[_0x5adb('0x28')][_0x5adb('0x32')]){_0x138bf6['include']=[{'all':!![]}];}_0x138bf6=_['merge']({},_0x138bf6,_0x28190d[_0x5adb('0x33')]);return db[_0x5adb('0x20')]['find'](_0x138bf6)[_0x5adb('0x17')](handleEntityNotFound(_0x28bf1f,null))['then'](respondWithResult(_0x28bf1f,null))[_0x5adb('0x2a')](handleError(_0x28bf1f,null));};exports['create']=function(_0x11cb37,_0x4d052f){return db[_0x5adb('0x20')][_0x5adb('0x34')](_0x11cb37['body'],{})[_0x5adb('0x17')](function(_0x5a6a79){var _0xadbe37=_0x11cb37[_0x5adb('0x35')][_0x5adb('0x36')]({'plain':!![]});if(!_0xadbe37)throw new Error('Unable\x20to\x20retrieve\x20the\x20current\x20user');if(_0xadbe37[_0x5adb('0x37')]===_0x5adb('0x35')){var _0xcdaf8e=_0x5a6a79[_0x5adb('0x36')]({'plain':!![]});var _0x22aa95='SmsQueues';return db['UserProfileSection']['find']({'where':{'name':_0x22aa95,'userProfileId':_0xadbe37['userProfileId']},'raw':!![]})[_0x5adb('0x17')](function(_0x2fbe14){if(_0x2fbe14&&_0x2fbe14[_0x5adb('0x38')]===0x0){return db[_0x5adb('0x1a')][_0x5adb('0x34')]({'name':_0xcdaf8e[_0x5adb('0x1d')],'resourceId':_0xcdaf8e['id'],'type':_0x2fbe14[_0x5adb('0x1d')],'sectionId':_0x2fbe14['id']},{})[_0x5adb('0x17')](function(){return _0x5a6a79;});}else{return _0x5a6a79;}})['catch'](function(_0x53f2c6){logger[_0x5adb('0x1b')]('Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s',_0x53f2c6);throw _0x53f2c6;});}return _0x5a6a79;})[_0x5adb('0x17')](respondWithResult(_0x4d052f,0xc9))[_0x5adb('0x2a')](handleError(_0x4d052f,null));};exports[_0x5adb('0x16')]=function(_0x121714,_0xdfecfd){if(_0x121714['body']['id']){delete _0x121714[_0x5adb('0x39')]['id'];}return db[_0x5adb('0x20')]['find']({'where':{'id':_0x121714[_0x5adb('0x3a')]['id']}})[_0x5adb('0x17')](handleEntityNotFound(_0xdfecfd,null))['then'](saveUpdates(_0x121714[_0x5adb('0x39')],null))[_0x5adb('0x17')](respondWithResult(_0xdfecfd,null))[_0x5adb('0x2a')](handleError(_0xdfecfd,null));};exports[_0x5adb('0x18')]=function(_0xea3307,_0x4362ec){return db[_0x5adb('0x20')]['find']({'where':{'id':_0xea3307['params']['id']}})[_0x5adb('0x17')](handleEntityNotFound(_0x4362ec,null))[_0x5adb('0x17')](removeEntity(_0x4362ec,null))[_0x5adb('0x2a')](handleError(_0x4362ec,null));};exports[_0x5adb('0x3b')]=function(_0x57b8af,_0x507e48){return db[_0x5adb('0x20')][_0x5adb('0x3b')]()[_0x5adb('0x17')](respondWithResult(_0x507e48,null))[_0x5adb('0x2a')](handleError(_0x507e48,null));};exports[_0x5adb('0x3c')]=function(_0x5358c0,_0x182cbc){var _0x437f52={'raw':!![],'where':{}},_0x5b574c={},_0x7786c4;return db[_0x5adb('0x20')][_0x5adb('0x3d')]({'where':{'id':_0x5358c0[_0x5adb('0x3a')]['id']}})[_0x5adb('0x17')](handleEntityNotFound(_0x182cbc,null))[_0x5adb('0x17')](function(_0x39840e){if(_0x39840e){_0x7786c4=_0x39840e[_0x5adb('0x36')]({'plain':!![]});_0x5b574c['model']=_[_0x5adb('0x2d')](db['UserSmsQueue']['rawAttributes']);_0x5b574c['query']=_[_0x5adb('0x2d')](_0x5358c0[_0x5adb('0x28')]);_0x5b574c[_0x5adb('0x2e')]=_['intersection'](_0x5b574c[_0x5adb('0x2c')],_0x5b574c['query']);_0x437f52[_0x5adb('0x30')]=_[_0x5adb('0x3e')](_0x5b574c[_0x5adb('0x2c')],qs['fields'](_0x5358c0[_0x5adb('0x28')]['fields']));_0x437f52[_0x5adb('0x30')]=_0x437f52[_0x5adb('0x30')]['length']?_0x437f52[_0x5adb('0x30')]:_0x5b574c[_0x5adb('0x2c')];if(!_0x5358c0[_0x5adb('0x28')][_0x5adb('0x3f')](_0x5adb('0x40'))){_0x437f52['limit']=qs[_0x5adb('0x12')](_0x5358c0[_0x5adb('0x28')][_0x5adb('0x12')]);_0x437f52[_0x5adb('0x11')]=qs['offset'](_0x5358c0[_0x5adb('0x28')][_0x5adb('0x11')]);}_0x437f52[_0x5adb('0x41')]=qs['sort'](_0x5358c0[_0x5adb('0x28')][_0x5adb('0x42')]);_0x437f52[_0x5adb('0x25')]=qs[_0x5adb('0x2e')](_['pick'](_0x5358c0[_0x5adb('0x28')],_0x5b574c[_0x5adb('0x2e')]));_0x437f52[_0x5adb('0x25')][_0x5adb('0x43')]=_0x39840e['id'];if(_0x5358c0[_0x5adb('0x28')]['filter']){_0x437f52[_0x5adb('0x25')]=_['merge'](_0x437f52[_0x5adb('0x25')],{'$or':_['map'](_0x437f52[_0x5adb('0x30')],function(_0x35df22){var _0x1a9358={};_0x1a9358[_0x35df22]={'$like':'%'+_0x5358c0[_0x5adb('0x28')]['filter']+'%'};return _0x1a9358;})});}_0x437f52=_[_0x5adb('0x44')]({},_0x437f52,_0x5358c0[_0x5adb('0x33')]);return db[_0x5adb('0x45')]['findAll'](_0x437f52);}})['then'](function(_0x4ddfdf){if(_0x4ddfdf){return db[_0x5adb('0x46')][_0x5adb('0x47')]({'where':{'id':_[_0x5adb('0x48')](_0x4ddfdf,_0x5adb('0x49')),'role':_0x5adb('0x4a')},'attributes':['id',_0x5adb('0x1d'),_0x5adb('0x4b'),_0x5adb('0x4c'),_0x5adb('0x4d')]});}})[_0x5adb('0x17')](function(_0x452767){if(_0x452767){return{'count':_0x452767[_0x5adb('0x26')],'rows':_[_0x5adb('0x48')](_0x452767['rows'],function(_0x49f4c8){return{'membername':_0x49f4c8[_0x5adb('0x1d')],'UserId':_0x49f4c8['id'],'queue_name':_0x7786c4[_0x5adb('0x1d')],'SmsQueueId':_0x7786c4['id'],'interface':util[_0x5adb('0x4e')](_0x5adb('0x4f'),'SIP',_0x49f4c8[_0x5adb('0x1d')]),'penalty':0x0,'paused':_0x49f4c8[_0x5adb('0x4b')],'createdAt':_0x49f4c8['createdAt'],'updatedAt':_0x49f4c8[_0x5adb('0x4c')]};})};}else{return{'count':0x0,'rows':[]};}})[_0x5adb('0x17')](respondWithFilteredResult(_0x182cbc,_0x437f52))[_0x5adb('0x2a')](handleError(_0x182cbc,null));};exports['getTeams']=function(_0x30d185,_0x409357){var _0x19df2f={};var _0x30c92c={};var _0x330290;var _0x428019;return db['SmsQueue'][_0x5adb('0x3d')]({'where':{'id':_0x30d185[_0x5adb('0x3a')]['id']}})[_0x5adb('0x17')](handleEntityNotFound(_0x409357,null))['then'](function(_0xcd71d2){if(_0xcd71d2){_0x330290=_0xcd71d2;_0x30c92c[_0x5adb('0x2c')]=_[_0x5adb('0x2d')](db['Team'][_0x5adb('0x21')]);_0x30c92c['query']=_[_0x5adb('0x2d')](_0x30d185[_0x5adb('0x28')]);_0x30c92c[_0x5adb('0x2e')]=_['intersection'](_0x30c92c[_0x5adb('0x2c')],_0x30c92c[_0x5adb('0x28')]);_0x19df2f['attributes']=_[_0x5adb('0x3e')](_0x30c92c[_0x5adb('0x2c')],qs[_0x5adb('0x2f')](_0x30d185[_0x5adb('0x28')]['fields']));_0x19df2f[_0x5adb('0x30')]=_0x19df2f[_0x5adb('0x30')][_0x5adb('0x31')]?_0x19df2f[_0x5adb('0x30')]:_0x30c92c['model'];_0x19df2f['order']=qs[_0x5adb('0x42')](_0x30d185['query']['sort']);_0x19df2f['where']=qs[_0x5adb('0x2e')](_[_0x5adb('0x50')](_0x30d185['query'],_0x30c92c[_0x5adb('0x2e')]));if(_0x30d185[_0x5adb('0x28')][_0x5adb('0x51')]){_0x19df2f[_0x5adb('0x25')]=_[_0x5adb('0x44')](_0x19df2f[_0x5adb('0x25')],{'$or':_[_0x5adb('0x48')](_0x19df2f[_0x5adb('0x30')],function(_0x5240c1){var _0x4b9e80={};_0x4b9e80[_0x5240c1]={'$like':'%'+_0x30d185['query'][_0x5adb('0x51')]+'%'};return _0x4b9e80;})});}_0x19df2f=_[_0x5adb('0x44')]({},_0x19df2f,_0x30d185[_0x5adb('0x33')]);return _0x330290[_0x5adb('0x52')](_0x19df2f);}})[_0x5adb('0x17')](function(_0x2f6ef7){if(_0x2f6ef7){_0x428019=_0x2f6ef7[_0x5adb('0x31')];if(!_0x30d185[_0x5adb('0x28')]['hasOwnProperty']('nolimit')){_0x19df2f[_0x5adb('0x12')]=qs[_0x5adb('0x12')](_0x30d185[_0x5adb('0x28')][_0x5adb('0x12')]);_0x19df2f[_0x5adb('0x11')]=qs[_0x5adb('0x11')](_0x30d185[_0x5adb('0x28')][_0x5adb('0x11')]);}return _0x330290[_0x5adb('0x52')](_0x19df2f);}})[_0x5adb('0x17')](function(_0x484f3d){if(_0x484f3d){return _0x484f3d?{'count':_0x428019,'rows':_0x484f3d}:null;}})[_0x5adb('0x17')](respondWithResult(_0x409357,null))[_0x5adb('0x2a')](handleError(_0x409357,null));};exports[_0x5adb('0x53')]=function(_0x5d3aa4,_0x31f041){var _0xa1bd33=_0x5d3aa4['body'][_0x5adb('0x54')];return db['Team'][_0x5adb('0x55')]({'where':{'id':_0xa1bd33},'attributes':['id'],'include':[{'model':db[_0x5adb('0x46')],'as':'Agents','attributes':['id',_0x5adb('0x1d'),_0x5adb('0x56'),_0x5adb('0x57'),_0x5adb('0x58')],'raw':!![]}]})[_0x5adb('0x17')](function(_0x10f54a){if(_0x10f54a){var _0x3cee6c=_[_0x5adb('0x59')](_0x10f54a,function(_0x49a8a6){var _0x3786b4=_0x49a8a6[_0x5adb('0x36')]({'plain':!![]});return _0x3786b4[_0x5adb('0x5a')];});return db['SmsQueue']['find']({'where':{'id':_0x5d3aa4[_0x5adb('0x3a')]['id']}})['then'](function(_0x27d3d8){return db[_0x5adb('0x5b')][_0x5adb('0x5c')](function(_0x50600f){return _0x27d3d8[_0x5adb('0x53')](_0xa1bd33,{'transaction':_0x50600f})[_0x5adb('0x17')](function(){return BPromise[_0x5adb('0x5d')](_0x3cee6c,function(_0x3ecc56){return db[_0x5adb('0x45')]['findOrCreate']({'where':{'UserId':_0x3ecc56['id'],'SmsQueueId':_0x5d3aa4[_0x5adb('0x3a')]['id']},'transaction':_0x50600f});});})[_0x5adb('0x17')](function(){_0x3cee6c[_0x5adb('0x5e')](function(_0xe3d12d){socket['emit'](_0x5adb('0x5f'),{'UserId':_0xe3d12d['id'],'SmsQueueId':_0x27d3d8['id']});});});});});}})[_0x5adb('0x17')](respondWithStatusCode(_0x31f041,null))[_0x5adb('0x2a')](handleError(_0x31f041,null));};exports[_0x5adb('0x60')]=function(_0x15d4f1,_0x20faf6){return db[_0x5adb('0x61')]['findAll']({'where':{'id':_0x15d4f1[_0x5adb('0x28')][_0x5adb('0x54')]},'attributes':['id'],'include':[{'model':db['User'],'as':_0x5adb('0x5a'),'attributes':['id'],'raw':!![]}]})[_0x5adb('0x17')](handleEntityNotFound(_0x20faf6,null))['then'](function(_0x462fa0){var _0x50f8ed=_[_0x5adb('0x48')](_0x462fa0,'id');var _0x268df2=[];var _0x4a2ebc=[];var _0x167432=squel['select']();_0x167432[_0x5adb('0x62')](_0x5adb('0x63'))[_0x5adb('0x64')](_0x5adb('0x65'),'tq')[_0x5adb('0x66')]('user_has_teams','ut',_0x5adb('0x67'))[_0x5adb('0x25')](_0x5adb('0x68'),_0x15d4f1[_0x5adb('0x3a')]['id']);for(var _0x47c631=0x0;_0x47c631<_0x462fa0['length'];_0x47c631+=0x1){let _0x3f3db9=_0x462fa0[_0x47c631];for(var _0x461a07=0x0;_0x461a07<_0x3f3db9[_0x5adb('0x5a')][_0x5adb('0x31')];_0x461a07+=0x1){let _0x277668=_0x3f3db9[_0x5adb('0x5a')][_0x461a07];var _0x31f5b2=_0x167432['clone']();_0x31f5b2[_0x5adb('0x25')](_0x5adb('0x69'),_0x277668['id']);_0x4a2ebc[_0x5adb('0x6a')](db[_0x5adb('0x5b')]['query'](_0x31f5b2[_0x5adb('0x6b')](),{'type':db[_0x5adb('0x5b')][_0x5adb('0x6c')][_0x5adb('0x6d')]})[_0x5adb('0x17')](function(_0x188cbd){if(_0x188cbd[_0x5adb('0x31')]===0x1){return _0x277668['id'];}else{var _0x2d1b65=_[_0x5adb('0x6e')](_['map'](_0x188cbd,_0x5adb('0x6f')),function(_0x456799){return _['includes'](_0x50f8ed,_0x456799);});if(_0x2d1b65){return _0x277668['id'];}}}));}}return BPromise[_0x5adb('0x70')](_0x4a2ebc)[_0x5adb('0x17')](function(_0x2b8915){_0x268df2=_(_0x268df2)[_0x5adb('0x71')](_0x2b8915)[_0x5adb('0x72')]()[_0x5adb('0x73')]();return db[_0x5adb('0x20')][_0x5adb('0x74')]({'where':{'id':_0x15d4f1['params']['id']}})[_0x5adb('0x17')](function(_0x2386c0){return db['sequelize'][_0x5adb('0x5c')](function(_0x58a26f){return _0x2386c0[_0x5adb('0x60')](_0x15d4f1['query']['ids'],{'transaction':_0x58a26f})[_0x5adb('0x17')](function(){if(!_[_0x5adb('0x75')](_0x268df2)){return _0x2386c0[_0x5adb('0x76')](_0x268df2,{'transaction':_0x58a26f});}})['then'](function(){_0x268df2[_0x5adb('0x5e')](function(_0x321c3a){socket[_0x5adb('0x77')](_0x5adb('0x78'),{'UserId':_0x321c3a,'SmsQueueId':_0x2386c0['id']});});});});});});})[_0x5adb('0x17')](respondWithStatusCode(_0x20faf6,null))[_0x5adb('0x2a')](handleError(_0x20faf6,null));};exports[_0x5adb('0x79')]=function(_0x463e84,_0x28bd33){return db[_0x5adb('0x20')][_0x5adb('0x74')]({'where':{'id':_0x463e84[_0x5adb('0x3a')]['id']}})['then'](handleEntityNotFound(_0x28bd33,null))['then'](function(_0x312463){if(_0x312463){return _0x312463[_0x5adb('0x79')](_0x463e84['body'][_0x5adb('0x54')],_[_0x5adb('0x7a')](_0x463e84[_0x5adb('0x39')],[_0x5adb('0x54'),'id'])||{})[_0x5adb('0x7b')](function(_0x24cd3b){for(var _0x15626b=0x0;_0x15626b<_0x463e84[_0x5adb('0x39')][_0x5adb('0x54')]['length'];_0x15626b+=0x1){socket[_0x5adb('0x77')](_0x5adb('0x5f'),{'UserId':Number(_0x463e84[_0x5adb('0x39')]['ids'][_0x15626b]),'SmsQueueId':Number(_0x463e84[_0x5adb('0x3a')]['id'])});}return _0x24cd3b;});}})[_0x5adb('0x17')](respondWithResult(_0x28bd33,null))[_0x5adb('0x2a')](handleError(_0x28bd33,null));};exports[_0x5adb('0x76')]=function(_0x64475f,_0x2a78f9){return db['SmsQueue'][_0x5adb('0x74')]({'where':{'id':_0x64475f[_0x5adb('0x3a')]['id']}})[_0x5adb('0x17')](handleEntityNotFound(_0x2a78f9,null))[_0x5adb('0x17')](function(_0x2c3af8){if(_0x2c3af8){return _0x2c3af8[_0x5adb('0x76')](_0x64475f[_0x5adb('0x28')][_0x5adb('0x54')])[_0x5adb('0x17')](function(){if(_[_0x5adb('0x7c')](_0x64475f['query'][_0x5adb('0x54')])){for(var _0x5b9565=0x0;_0x5b9565<_0x64475f[_0x5adb('0x28')][_0x5adb('0x54')][_0x5adb('0x31')];_0x5b9565+=0x1){socket[_0x5adb('0x77')](_0x5adb('0x78'),{'UserId':Number(_0x64475f['query']['ids'][_0x5b9565]),'SmsQueueId':Number(_0x64475f[_0x5adb('0x3a')]['id'])});}}else{socket[_0x5adb('0x77')](_0x5adb('0x78'),{'UserId':Number(_0x64475f[_0x5adb('0x28')][_0x5adb('0x54')]),'SmsQueueId':Number(_0x64475f[_0x5adb('0x3a')]['id'])});}});}})['then'](respondWithStatusCode(_0x2a78f9,null))['catch'](handleError(_0x2a78f9,null));};exports[_0x5adb('0x7d')]=function(_0xd5b95d,_0x9d80fd){var _0x4f5721={};var _0x542626={};var _0x227c17;var _0x5982a5;return db[_0x5adb('0x20')][_0x5adb('0x3d')]({'where':{'id':_0xd5b95d['params']['id']}})['then'](handleEntityNotFound(_0x9d80fd,null))[_0x5adb('0x17')](function(_0x4bb198){if(_0x4bb198){_0x227c17=_0x4bb198;_0x542626['model']=_[_0x5adb('0x2d')](db[_0x5adb('0x46')][_0x5adb('0x21')]);_0x542626[_0x5adb('0x28')]=_[_0x5adb('0x2d')](_0xd5b95d[_0x5adb('0x28')]);_0x542626[_0x5adb('0x2e')]=_[_0x5adb('0x3e')](_0x542626[_0x5adb('0x2c')],_0x542626[_0x5adb('0x28')]);_0x4f5721[_0x5adb('0x30')]=_[_0x5adb('0x3e')](_0x542626[_0x5adb('0x2c')],qs['fields'](_0xd5b95d[_0x5adb('0x28')]['fields']));_0x4f5721[_0x5adb('0x30')]=_0x4f5721[_0x5adb('0x30')][_0x5adb('0x31')]?_0x4f5721[_0x5adb('0x30')]:_0x542626[_0x5adb('0x2c')];_0x4f5721[_0x5adb('0x41')]=qs[_0x5adb('0x42')](_0xd5b95d[_0x5adb('0x28')][_0x5adb('0x42')]);_0x4f5721[_0x5adb('0x25')]=qs[_0x5adb('0x2e')](_[_0x5adb('0x50')](_0xd5b95d['query'],_0x542626[_0x5adb('0x2e')]));if(_0xd5b95d[_0x5adb('0x28')][_0x5adb('0x51')]){_0x4f5721[_0x5adb('0x25')]=_[_0x5adb('0x44')](_0x4f5721[_0x5adb('0x25')],{'$or':_[_0x5adb('0x48')](_0x4f5721[_0x5adb('0x30')],function(_0x57c160){var _0xe7ddc4={};_0xe7ddc4[_0x57c160]={'$like':'%'+_0xd5b95d[_0x5adb('0x28')][_0x5adb('0x51')]+'%'};return _0xe7ddc4;})});}_0x4f5721=_['merge']({},_0x4f5721,_0xd5b95d[_0x5adb('0x33')]);return _0x227c17['getAgents'](_0x4f5721);}})[_0x5adb('0x17')](function(_0x50c3a3){if(_0x50c3a3){_0x5982a5=_0x50c3a3['length'];if(!_0xd5b95d[_0x5adb('0x28')][_0x5adb('0x3f')](_0x5adb('0x40'))){_0x4f5721[_0x5adb('0x12')]=qs[_0x5adb('0x12')](_0xd5b95d[_0x5adb('0x28')][_0x5adb('0x12')]);_0x4f5721[_0x5adb('0x11')]=qs[_0x5adb('0x11')](_0xd5b95d[_0x5adb('0x28')][_0x5adb('0x11')]);}return _0x227c17[_0x5adb('0x7d')](_0x4f5721);}})['then'](function(_0x364da7){if(_0x364da7){return _0x364da7?{'count':_0x5982a5,'rows':_0x364da7}:null;}})['then'](respondWithResult(_0x9d80fd,null))[_0x5adb('0x2a')](handleError(_0x9d80fd,null));}; \ No newline at end of file +var _0x2ef3=['intersection','attributes','model','fields','length','merge','options','create','body','user','Unable\x20to\x20retrieve\x20the\x20current\x20user','role','UserProfileSection','find','userProfileId','update','describe','getMembers','findOne','UserSmsQueue','filters','hasOwnProperty','order','sort','pick','SmsQueueId','filter','User','findAndCountAll','agent','updatedAt','createdAt','SIP','getTeams','Team','nolimit','addTeams','ids','online','voicePause','flatMap','each','findOrCreate','removeTeams','Agents','select','field','from','team_has_sms_queues','join','user_has_teams','ut.TeamId\x20=\x20tq.TeamId','clone','push','sequelize','toString','QueryTypes','TeamId','union','compact','value','transaction','isEmpty','emit','addAgents','spread','userSmsQueue:save','removeAgents','isArray','userSmsQueue:remove','getAgents','bluebird','util','lodash','squel','ioredis','../../components/parsers/qs','api','../../config/environment','redis','defaults','socket.io-emitter','./smsQueue.socket','register','sendStatus','status','end','json','offset','limit','undefined','count','Content-Range','then','destroy','get','SmsQueues','UserProfileResource','name','map','SmsQueue','rawAttributes','fieldName','type','key','getOptions','where','include','query','findAll','rows','catch','show','params','keys'];(function(_0x2fc59f,_0x2ca03a){var _0x1e8faa=function(_0x261f54){while(--_0x261f54){_0x2fc59f['push'](_0x2fc59f['shift']());}};_0x1e8faa(++_0x2ca03a);}(_0x2ef3,0xba));var _0x32ef=function(_0x57ffb0,_0x28464e){_0x57ffb0=_0x57ffb0-0x0;var _0x58595a=_0x2ef3[_0x57ffb0];return _0x58595a;};'use strict';var BPromise=require(_0x32ef('0x0'));var util=require(_0x32ef('0x1'));var _=require(_0x32ef('0x2'));var squel=require(_0x32ef('0x3'));var Redis=require(_0x32ef('0x4'));var qs=require(_0x32ef('0x5'));var logger=require('../../config/logger')(_0x32ef('0x6'));var config=require(_0x32ef('0x7'));var db=require('../../mysqldb')['db'];config[_0x32ef('0x8')]=_[_0x32ef('0x9')](config['redis'],{'host':'localhost','port':0x18eb});var socket=require(_0x32ef('0xa'))(new Redis(config[_0x32ef('0x8')]));require(_0x32ef('0xb'))[_0x32ef('0xc')](socket);function respondWithStatusCode(_0x234863,_0x298066){_0x298066=_0x298066||0xcc;return function(_0x2484a0){if(_0x2484a0){return _0x234863[_0x32ef('0xd')](_0x298066);}return _0x234863[_0x32ef('0xe')](_0x298066)[_0x32ef('0xf')]();};}function respondWithResult(_0x56eb42,_0x5780e9){_0x5780e9=_0x5780e9||0xc8;return function(_0x401d0b){if(_0x401d0b){return _0x56eb42[_0x32ef('0xe')](_0x5780e9)[_0x32ef('0x10')](_0x401d0b);}};}function respondWithFilteredResult(_0x1499c2,_0x5af651){return function(_0x193714){if(_0x193714){var _0x5afcc2=typeof _0x5af651[_0x32ef('0x11')]==='undefined'&&typeof _0x5af651[_0x32ef('0x12')]===_0x32ef('0x13');var _0x5c3eb9=_0x193714['count'];var _0x19ce1=_0x5afcc2?0x0:_0x5af651['offset'];var _0x326fce=_0x5afcc2?_0x193714[_0x32ef('0x14')]:_0x5af651[_0x32ef('0x11')]+_0x5af651[_0x32ef('0x12')];var _0x57aff1;if(_0x326fce>=_0x5c3eb9){_0x326fce=_0x5c3eb9;_0x57aff1=0xc8;}else{_0x57aff1=0xce;}_0x1499c2['status'](_0x57aff1);return _0x1499c2['set'](_0x32ef('0x15'),_0x19ce1+'-'+_0x326fce+'/'+_0x5c3eb9)[_0x32ef('0x10')](_0x193714);}return null;};}function saveUpdates(_0xb5aed2){return function(_0x53a5ca){if(_0x53a5ca){return _0x53a5ca['update'](_0xb5aed2)[_0x32ef('0x16')](function(_0x1a9476){return _0x1a9476;});}return null;};}function removeEntity(_0x286bfb){return function(_0x57863c){if(_0x57863c){return _0x57863c[_0x32ef('0x17')]()[_0x32ef('0x16')](function(){var _0x4f4c98=_0x57863c[_0x32ef('0x18')]({'plain':!![]});var _0x314ef1=_0x32ef('0x19');return db[_0x32ef('0x1a')][_0x32ef('0x17')]({'where':{'type':_0x314ef1,'resourceId':_0x4f4c98['id']}})[_0x32ef('0x16')](function(){return _0x57863c;});})['then'](function(){_0x286bfb[_0x32ef('0xe')](0xcc)['end']();});}};}function handleEntityNotFound(_0x309866){return function(_0x3a20ca){if(!_0x3a20ca){_0x309866['sendStatus'](0x194);}return _0x3a20ca;};}function handleError(_0x1af371,_0x97780){_0x97780=_0x97780||0x1f4;return function(_0x5e8898){logger['error'](_0x5e8898['stack']);if(_0x5e8898[_0x32ef('0x1b')]){delete _0x5e8898[_0x32ef('0x1b')];}_0x1af371[_0x32ef('0xe')](_0x97780)['send'](_0x5e8898);};}exports['index']=function(_0x19ea6,_0x4d584b){var _0x51a412={};var _0x278495={'count':0x0,'rows':[]};var _0x14d4b3=_[_0x32ef('0x1c')](db[_0x32ef('0x1d')][_0x32ef('0x1e')],function(_0x234175){return{'name':_0x234175[_0x32ef('0x1f')],'type':_0x234175[_0x32ef('0x20')][_0x32ef('0x21')]};});_0x51a412=qs[_0x32ef('0x22')](_0x14d4b3,_0x19ea6);var _0x1335e2={'where':_0x51a412[_0x32ef('0x23')]};return db['SmsQueue'][_0x32ef('0x14')](_0x1335e2)[_0x32ef('0x16')](function(_0x5a04cd){_0x278495[_0x32ef('0x14')]=_0x5a04cd;_0x51a412[_0x32ef('0x24')]=qs[_0x32ef('0x24')](_0x19ea6[_0x32ef('0x25')]);return db['SmsQueue'][_0x32ef('0x26')](_0x51a412);})[_0x32ef('0x16')](function(_0x31dbc3){_0x278495[_0x32ef('0x27')]=_0x31dbc3;return _0x278495;})[_0x32ef('0x16')](respondWithFilteredResult(_0x4d584b,_0x51a412))[_0x32ef('0x28')](handleError(_0x4d584b,null));};exports[_0x32ef('0x29')]=function(_0x575f3e,_0x36ac37){var _0x537214={'raw':!![],'where':{'id':_0x575f3e[_0x32ef('0x2a')]['id']}},_0x38bf73={};_0x38bf73['model']=_[_0x32ef('0x2b')](db[_0x32ef('0x1d')][_0x32ef('0x1e')]);_0x38bf73[_0x32ef('0x25')]=_[_0x32ef('0x2b')](_0x575f3e['query']);_0x38bf73['filters']=_[_0x32ef('0x2c')](_0x38bf73['model'],_0x38bf73[_0x32ef('0x25')]);_0x537214[_0x32ef('0x2d')]=_[_0x32ef('0x2c')](_0x38bf73[_0x32ef('0x2e')],qs[_0x32ef('0x2f')](_0x575f3e[_0x32ef('0x25')]['fields']));_0x537214['attributes']=_0x537214['attributes'][_0x32ef('0x30')]?_0x537214[_0x32ef('0x2d')]:_0x38bf73[_0x32ef('0x2e')];if(_0x575f3e['query']['includeAll']){_0x537214[_0x32ef('0x24')]=[{'all':!![]}];}_0x537214=_[_0x32ef('0x31')]({},_0x537214,_0x575f3e[_0x32ef('0x32')]);return db['SmsQueue']['find'](_0x537214)[_0x32ef('0x16')](handleEntityNotFound(_0x36ac37,null))[_0x32ef('0x16')](respondWithResult(_0x36ac37,null))[_0x32ef('0x28')](handleError(_0x36ac37,null));};exports[_0x32ef('0x33')]=function(_0x3a7c49,_0x211c79){return db[_0x32ef('0x1d')][_0x32ef('0x33')](_0x3a7c49[_0x32ef('0x34')],{})['then'](function(_0x3a4a99){var _0x36e374=_0x3a7c49[_0x32ef('0x35')]['get']({'plain':!![]});if(!_0x36e374)throw new Error(_0x32ef('0x36'));if(_0x36e374[_0x32ef('0x37')]===_0x32ef('0x35')){var _0x393a89=_0x3a4a99[_0x32ef('0x18')]({'plain':!![]});var _0x33a0fb=_0x32ef('0x19');return db[_0x32ef('0x38')][_0x32ef('0x39')]({'where':{'name':_0x33a0fb,'userProfileId':_0x36e374[_0x32ef('0x3a')]},'raw':!![]})[_0x32ef('0x16')](function(_0x4615b4){if(_0x4615b4&&_0x4615b4['autoAssociation']===0x0){return db[_0x32ef('0x1a')][_0x32ef('0x33')]({'name':_0x393a89[_0x32ef('0x1b')],'resourceId':_0x393a89['id'],'type':_0x4615b4[_0x32ef('0x1b')],'sectionId':_0x4615b4['id']},{})[_0x32ef('0x16')](function(){return _0x3a4a99;});}else{return _0x3a4a99;}})[_0x32ef('0x28')](function(_0x3c0e44){logger['error']('Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s',_0x3c0e44);throw _0x3c0e44;});}return _0x3a4a99;})[_0x32ef('0x16')](respondWithResult(_0x211c79,0xc9))[_0x32ef('0x28')](handleError(_0x211c79,null));};exports[_0x32ef('0x3b')]=function(_0x765c63,_0x5dca14){if(_0x765c63[_0x32ef('0x34')]['id']){delete _0x765c63[_0x32ef('0x34')]['id'];}return db['SmsQueue'][_0x32ef('0x39')]({'where':{'id':_0x765c63['params']['id']}})[_0x32ef('0x16')](handleEntityNotFound(_0x5dca14,null))[_0x32ef('0x16')](saveUpdates(_0x765c63[_0x32ef('0x34')],null))[_0x32ef('0x16')](respondWithResult(_0x5dca14,null))[_0x32ef('0x28')](handleError(_0x5dca14,null));};exports[_0x32ef('0x17')]=function(_0x321ef7,_0x3d35a1){return db[_0x32ef('0x1d')][_0x32ef('0x39')]({'where':{'id':_0x321ef7['params']['id']}})[_0x32ef('0x16')](handleEntityNotFound(_0x3d35a1,null))['then'](removeEntity(_0x3d35a1,null))[_0x32ef('0x28')](handleError(_0x3d35a1,null));};exports[_0x32ef('0x3c')]=function(_0x2dd94f,_0x4d8393){return db[_0x32ef('0x1d')][_0x32ef('0x3c')]()[_0x32ef('0x16')](respondWithResult(_0x4d8393,null))[_0x32ef('0x28')](handleError(_0x4d8393,null));};exports[_0x32ef('0x3d')]=function(_0x40bf12,_0x12c9e6){var _0x47dbe1={'raw':!![],'where':{}},_0x5cb6fc={},_0x36252c;return db[_0x32ef('0x1d')][_0x32ef('0x3e')]({'where':{'id':_0x40bf12[_0x32ef('0x2a')]['id']}})[_0x32ef('0x16')](handleEntityNotFound(_0x12c9e6,null))[_0x32ef('0x16')](function(_0x44ad11){if(_0x44ad11){_0x36252c=_0x44ad11[_0x32ef('0x18')]({'plain':!![]});_0x5cb6fc[_0x32ef('0x2e')]=_[_0x32ef('0x2b')](db[_0x32ef('0x3f')][_0x32ef('0x1e')]);_0x5cb6fc[_0x32ef('0x25')]=_['keys'](_0x40bf12[_0x32ef('0x25')]);_0x5cb6fc[_0x32ef('0x40')]=_[_0x32ef('0x2c')](_0x5cb6fc[_0x32ef('0x2e')],_0x5cb6fc[_0x32ef('0x25')]);_0x47dbe1[_0x32ef('0x2d')]=_[_0x32ef('0x2c')](_0x5cb6fc[_0x32ef('0x2e')],qs[_0x32ef('0x2f')](_0x40bf12[_0x32ef('0x25')][_0x32ef('0x2f')]));_0x47dbe1[_0x32ef('0x2d')]=_0x47dbe1[_0x32ef('0x2d')][_0x32ef('0x30')]?_0x47dbe1[_0x32ef('0x2d')]:_0x5cb6fc[_0x32ef('0x2e')];if(!_0x40bf12[_0x32ef('0x25')][_0x32ef('0x41')]('nolimit')){_0x47dbe1['limit']=qs[_0x32ef('0x12')](_0x40bf12[_0x32ef('0x25')][_0x32ef('0x12')]);_0x47dbe1[_0x32ef('0x11')]=qs[_0x32ef('0x11')](_0x40bf12[_0x32ef('0x25')][_0x32ef('0x11')]);}_0x47dbe1[_0x32ef('0x42')]=qs[_0x32ef('0x43')](_0x40bf12[_0x32ef('0x25')][_0x32ef('0x43')]);_0x47dbe1['where']=qs[_0x32ef('0x40')](_[_0x32ef('0x44')](_0x40bf12[_0x32ef('0x25')],_0x5cb6fc[_0x32ef('0x40')]));_0x47dbe1[_0x32ef('0x23')][_0x32ef('0x45')]=_0x44ad11['id'];if(_0x40bf12['query'][_0x32ef('0x46')]){_0x47dbe1[_0x32ef('0x23')]=_[_0x32ef('0x31')](_0x47dbe1['where'],{'$or':_[_0x32ef('0x1c')](_0x47dbe1['attributes'],function(_0x2ee3dd){var _0xbe35b={};_0xbe35b[_0x2ee3dd]={'$like':'%'+_0x40bf12['query'][_0x32ef('0x46')]+'%'};return _0xbe35b;})});}_0x47dbe1=_['merge']({},_0x47dbe1,_0x40bf12[_0x32ef('0x32')]);return db[_0x32ef('0x3f')][_0x32ef('0x26')](_0x47dbe1);}})[_0x32ef('0x16')](function(_0x2c7bee){if(_0x2c7bee){return db[_0x32ef('0x47')][_0x32ef('0x48')]({'where':{'id':_['map'](_0x2c7bee,'UserId'),'role':_0x32ef('0x49')},'attributes':['id','name','smsPause',_0x32ef('0x4a'),_0x32ef('0x4b')]});}})[_0x32ef('0x16')](function(_0x6aae59){if(_0x6aae59){return{'count':_0x6aae59[_0x32ef('0x14')],'rows':_[_0x32ef('0x1c')](_0x6aae59[_0x32ef('0x27')],function(_0x4249c3){return{'membername':_0x4249c3[_0x32ef('0x1b')],'UserId':_0x4249c3['id'],'queue_name':_0x36252c[_0x32ef('0x1b')],'SmsQueueId':_0x36252c['id'],'interface':util['format']('%s/%s',_0x32ef('0x4c'),_0x4249c3[_0x32ef('0x1b')]),'penalty':0x0,'paused':_0x4249c3['smsPause'],'createdAt':_0x4249c3[_0x32ef('0x4b')],'updatedAt':_0x4249c3[_0x32ef('0x4a')]};})};}else{return{'count':0x0,'rows':[]};}})[_0x32ef('0x16')](respondWithFilteredResult(_0x12c9e6,_0x47dbe1))['catch'](handleError(_0x12c9e6,null));};exports[_0x32ef('0x4d')]=function(_0x3c31d0,_0x20dcc5){var _0x52dfe0={};var _0x5e6030={};var _0x13ea1a;var _0x47d8bf;return db[_0x32ef('0x1d')]['findOne']({'where':{'id':_0x3c31d0['params']['id']}})[_0x32ef('0x16')](handleEntityNotFound(_0x20dcc5,null))[_0x32ef('0x16')](function(_0x10cb37){if(_0x10cb37){_0x13ea1a=_0x10cb37;_0x5e6030['model']=_[_0x32ef('0x2b')](db[_0x32ef('0x4e')][_0x32ef('0x1e')]);_0x5e6030['query']=_[_0x32ef('0x2b')](_0x3c31d0[_0x32ef('0x25')]);_0x5e6030['filters']=_['intersection'](_0x5e6030[_0x32ef('0x2e')],_0x5e6030[_0x32ef('0x25')]);_0x52dfe0[_0x32ef('0x2d')]=_[_0x32ef('0x2c')](_0x5e6030[_0x32ef('0x2e')],qs[_0x32ef('0x2f')](_0x3c31d0['query'][_0x32ef('0x2f')]));_0x52dfe0[_0x32ef('0x2d')]=_0x52dfe0[_0x32ef('0x2d')][_0x32ef('0x30')]?_0x52dfe0[_0x32ef('0x2d')]:_0x5e6030[_0x32ef('0x2e')];_0x52dfe0[_0x32ef('0x42')]=qs[_0x32ef('0x43')](_0x3c31d0[_0x32ef('0x25')]['sort']);_0x52dfe0[_0x32ef('0x23')]=qs[_0x32ef('0x40')](_[_0x32ef('0x44')](_0x3c31d0[_0x32ef('0x25')],_0x5e6030[_0x32ef('0x40')]));if(_0x3c31d0['query']['filter']){_0x52dfe0[_0x32ef('0x23')]=_[_0x32ef('0x31')](_0x52dfe0[_0x32ef('0x23')],{'$or':_[_0x32ef('0x1c')](_0x52dfe0[_0x32ef('0x2d')],function(_0x526fb1){var _0x3372d9={};_0x3372d9[_0x526fb1]={'$like':'%'+_0x3c31d0['query'][_0x32ef('0x46')]+'%'};return _0x3372d9;})});}_0x52dfe0=_[_0x32ef('0x31')]({},_0x52dfe0,_0x3c31d0['options']);return _0x13ea1a['getTeams'](_0x52dfe0);}})[_0x32ef('0x16')](function(_0x1538d0){if(_0x1538d0){_0x47d8bf=_0x1538d0[_0x32ef('0x30')];if(!_0x3c31d0['query']['hasOwnProperty'](_0x32ef('0x4f'))){_0x52dfe0[_0x32ef('0x12')]=qs[_0x32ef('0x12')](_0x3c31d0[_0x32ef('0x25')]['limit']);_0x52dfe0[_0x32ef('0x11')]=qs[_0x32ef('0x11')](_0x3c31d0[_0x32ef('0x25')][_0x32ef('0x11')]);}return _0x13ea1a[_0x32ef('0x4d')](_0x52dfe0);}})[_0x32ef('0x16')](function(_0x43b176){if(_0x43b176){return _0x43b176?{'count':_0x47d8bf,'rows':_0x43b176}:null;}})[_0x32ef('0x16')](respondWithResult(_0x20dcc5,null))[_0x32ef('0x28')](handleError(_0x20dcc5,null));};exports[_0x32ef('0x50')]=function(_0x132d9f,_0x3978cb){var _0x52b32f=_0x132d9f['body'][_0x32ef('0x51')];return db[_0x32ef('0x4e')]['findAll']({'where':{'id':_0x52b32f},'attributes':['id'],'include':[{'model':db[_0x32ef('0x47')],'as':'Agents','attributes':['id',_0x32ef('0x1b'),_0x32ef('0x52'),_0x32ef('0x53'),'interface'],'raw':!![]}]})[_0x32ef('0x16')](function(_0x4978a6){if(_0x4978a6){var _0x141fec=_[_0x32ef('0x54')](_0x4978a6,function(_0x47e3cc){var _0x4c70e0=_0x47e3cc[_0x32ef('0x18')]({'plain':!![]});return _0x4c70e0['Agents'];});return db[_0x32ef('0x1d')]['find']({'where':{'id':_0x132d9f[_0x32ef('0x2a')]['id']}})[_0x32ef('0x16')](function(_0x1adcb8){return db['sequelize']['transaction'](function(_0x4f1b94){return _0x1adcb8[_0x32ef('0x50')](_0x52b32f,{'transaction':_0x4f1b94})['then'](function(){return BPromise[_0x32ef('0x55')](_0x141fec,function(_0x13a374){return db[_0x32ef('0x3f')][_0x32ef('0x56')]({'where':{'UserId':_0x13a374['id'],'SmsQueueId':_0x132d9f[_0x32ef('0x2a')]['id']},'transaction':_0x4f1b94});});})[_0x32ef('0x16')](function(){_0x141fec['forEach'](function(_0x3d9245){socket['emit']('userSmsQueue:save',{'UserId':_0x3d9245['id'],'SmsQueueId':_0x1adcb8['id']});});});});});}})[_0x32ef('0x16')](respondWithStatusCode(_0x3978cb,null))['catch'](handleError(_0x3978cb,null));};exports[_0x32ef('0x57')]=function(_0x313798,_0x4d64ec){return db[_0x32ef('0x4e')][_0x32ef('0x26')]({'where':{'id':_0x313798[_0x32ef('0x25')][_0x32ef('0x51')]},'attributes':['id'],'include':[{'model':db[_0x32ef('0x47')],'as':_0x32ef('0x58'),'attributes':['id'],'raw':!![]}]})['then'](handleEntityNotFound(_0x4d64ec,null))['then'](function(_0x35b10d){var _0x5e0b55=_[_0x32ef('0x1c')](_0x35b10d,'id');var _0x266688=[];var _0x114d8e=[];var _0x1782a5=squel[_0x32ef('0x59')]();_0x1782a5[_0x32ef('0x5a')]('tq.TeamId')[_0x32ef('0x5b')](_0x32ef('0x5c'),'tq')[_0x32ef('0x5d')](_0x32ef('0x5e'),'ut',_0x32ef('0x5f'))['where']('SmsQueueId\x20=\x20?',_0x313798[_0x32ef('0x2a')]['id']);for(var _0x904a4f=0x0;_0x904a4f<_0x35b10d['length'];_0x904a4f+=0x1){let _0x211fb1=_0x35b10d[_0x904a4f];for(var _0x2e333d=0x0;_0x2e333d<_0x211fb1[_0x32ef('0x58')][_0x32ef('0x30')];_0x2e333d+=0x1){let _0xc3664d=_0x211fb1[_0x32ef('0x58')][_0x2e333d];var _0xfb4845=_0x1782a5[_0x32ef('0x60')]();_0xfb4845[_0x32ef('0x23')]('ut.UserId\x20=\x20?',_0xc3664d['id']);_0x114d8e[_0x32ef('0x61')](db[_0x32ef('0x62')]['query'](_0xfb4845[_0x32ef('0x63')](),{'type':db['sequelize'][_0x32ef('0x64')]['SELECT']})[_0x32ef('0x16')](function(_0x39300f){if(_0x39300f[_0x32ef('0x30')]===0x1){return _0xc3664d['id'];}else{var _0x3e000c=_['every'](_[_0x32ef('0x1c')](_0x39300f,_0x32ef('0x65')),function(_0x31f99f){return _['includes'](_0x5e0b55,_0x31f99f);});if(_0x3e000c){return _0xc3664d['id'];}}}));}}return BPromise['all'](_0x114d8e)['then'](function(_0x1aff33){_0x266688=_(_0x266688)[_0x32ef('0x66')](_0x1aff33)[_0x32ef('0x67')]()[_0x32ef('0x68')]();return db[_0x32ef('0x1d')]['find']({'where':{'id':_0x313798[_0x32ef('0x2a')]['id']}})['then'](function(_0x471de6){return db[_0x32ef('0x62')][_0x32ef('0x69')](function(_0x4baa7a){return _0x471de6[_0x32ef('0x57')](_0x313798[_0x32ef('0x25')][_0x32ef('0x51')],{'transaction':_0x4baa7a})[_0x32ef('0x16')](function(){if(!_[_0x32ef('0x6a')](_0x266688)){return _0x471de6['removeAgents'](_0x266688,{'transaction':_0x4baa7a});}})[_0x32ef('0x16')](function(){_0x266688['forEach'](function(_0x4f0433){socket[_0x32ef('0x6b')]('userSmsQueue:remove',{'UserId':_0x4f0433,'SmsQueueId':_0x471de6['id']});});});});});});})['then'](respondWithStatusCode(_0x4d64ec,null))[_0x32ef('0x28')](handleError(_0x4d64ec,null));};exports[_0x32ef('0x6c')]=function(_0xf6bc02,_0x3b9896){return db['SmsQueue'][_0x32ef('0x39')]({'where':{'id':_0xf6bc02['params']['id']}})['then'](handleEntityNotFound(_0x3b9896,null))[_0x32ef('0x16')](function(_0x56aede){if(_0x56aede){return _0x56aede[_0x32ef('0x6c')](_0xf6bc02[_0x32ef('0x34')][_0x32ef('0x51')],_['omit'](_0xf6bc02['body'],[_0x32ef('0x51'),'id'])||{})[_0x32ef('0x6d')](function(_0x2c4a3c){for(var _0x3741f8=0x0;_0x3741f8<_0xf6bc02[_0x32ef('0x34')][_0x32ef('0x51')][_0x32ef('0x30')];_0x3741f8+=0x1){socket['emit'](_0x32ef('0x6e'),{'UserId':Number(_0xf6bc02[_0x32ef('0x34')][_0x32ef('0x51')][_0x3741f8]),'SmsQueueId':Number(_0xf6bc02[_0x32ef('0x2a')]['id'])});}return _0x2c4a3c;});}})['then'](respondWithResult(_0x3b9896,null))['catch'](handleError(_0x3b9896,null));};exports[_0x32ef('0x6f')]=function(_0x5eb320,_0x116951){return db[_0x32ef('0x1d')]['find']({'where':{'id':_0x5eb320['params']['id']}})['then'](handleEntityNotFound(_0x116951,null))[_0x32ef('0x16')](function(_0x33f6c3){if(_0x33f6c3){return _0x33f6c3[_0x32ef('0x6f')](_0x5eb320[_0x32ef('0x25')]['ids'])[_0x32ef('0x16')](function(){if(_[_0x32ef('0x70')](_0x5eb320[_0x32ef('0x25')]['ids'])){for(var _0x2895ad=0x0;_0x2895ad<_0x5eb320['query'][_0x32ef('0x51')][_0x32ef('0x30')];_0x2895ad+=0x1){socket['emit']('userSmsQueue:remove',{'UserId':Number(_0x5eb320[_0x32ef('0x25')][_0x32ef('0x51')][_0x2895ad]),'SmsQueueId':Number(_0x5eb320[_0x32ef('0x2a')]['id'])});}}else{socket[_0x32ef('0x6b')](_0x32ef('0x71'),{'UserId':Number(_0x5eb320[_0x32ef('0x25')][_0x32ef('0x51')]),'SmsQueueId':Number(_0x5eb320[_0x32ef('0x2a')]['id'])});}});}})[_0x32ef('0x16')](respondWithStatusCode(_0x116951,null))['catch'](handleError(_0x116951,null));};exports[_0x32ef('0x72')]=function(_0x583290,_0x22d657){var _0x7e47b9={};var _0x1d9d57={};var _0x18cf5d;var _0x102f2f;return db['SmsQueue'][_0x32ef('0x3e')]({'where':{'id':_0x583290[_0x32ef('0x2a')]['id']}})[_0x32ef('0x16')](handleEntityNotFound(_0x22d657,null))[_0x32ef('0x16')](function(_0x1db74d){if(_0x1db74d){_0x18cf5d=_0x1db74d;_0x1d9d57[_0x32ef('0x2e')]=_[_0x32ef('0x2b')](db[_0x32ef('0x47')][_0x32ef('0x1e')]);_0x1d9d57['query']=_['keys'](_0x583290['query']);_0x1d9d57[_0x32ef('0x40')]=_[_0x32ef('0x2c')](_0x1d9d57['model'],_0x1d9d57[_0x32ef('0x25')]);_0x7e47b9['attributes']=_[_0x32ef('0x2c')](_0x1d9d57['model'],qs['fields'](_0x583290[_0x32ef('0x25')][_0x32ef('0x2f')]));_0x7e47b9[_0x32ef('0x2d')]=_0x7e47b9[_0x32ef('0x2d')][_0x32ef('0x30')]?_0x7e47b9['attributes']:_0x1d9d57[_0x32ef('0x2e')];_0x7e47b9['order']=qs[_0x32ef('0x43')](_0x583290['query']['sort']);_0x7e47b9['where']=qs['filters'](_['pick'](_0x583290[_0x32ef('0x25')],_0x1d9d57[_0x32ef('0x40')]));if(_0x583290['query'][_0x32ef('0x46')]){_0x7e47b9[_0x32ef('0x23')]=_[_0x32ef('0x31')](_0x7e47b9[_0x32ef('0x23')],{'$or':_[_0x32ef('0x1c')](_0x7e47b9[_0x32ef('0x2d')],function(_0x59f0aa){var _0x2ac861={};_0x2ac861[_0x59f0aa]={'$like':'%'+_0x583290['query'][_0x32ef('0x46')]+'%'};return _0x2ac861;})});}_0x7e47b9=_[_0x32ef('0x31')]({},_0x7e47b9,_0x583290['options']);return _0x18cf5d[_0x32ef('0x72')](_0x7e47b9);}})['then'](function(_0x4557b0){if(_0x4557b0){_0x102f2f=_0x4557b0[_0x32ef('0x30')];if(!_0x583290[_0x32ef('0x25')][_0x32ef('0x41')]('nolimit')){_0x7e47b9[_0x32ef('0x12')]=qs[_0x32ef('0x12')](_0x583290[_0x32ef('0x25')][_0x32ef('0x12')]);_0x7e47b9['offset']=qs[_0x32ef('0x11')](_0x583290['query'][_0x32ef('0x11')]);}return _0x18cf5d[_0x32ef('0x72')](_0x7e47b9);}})[_0x32ef('0x16')](function(_0x28ef17){if(_0x28ef17){return _0x28ef17?{'count':_0x102f2f,'rows':_0x28ef17}:null;}})[_0x32ef('0x16')](respondWithResult(_0x22d657,null))[_0x32ef('0x28')](handleError(_0x22d657,null));}; \ No newline at end of file diff --git a/server/api/smsQueue/smsQueue.events.js b/server/api/smsQueue/smsQueue.events.js index 4d4617c..e15c665 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 _0xcfd9=['save','update','emit','hasOwnProperty','hook','exports','SmsQueue','setMaxListeners'];(function(_0x14a944,_0x44e3d0){var _0x52323a=function(_0x5ca764){while(--_0x5ca764){_0x14a944['push'](_0x14a944['shift']());}};_0x52323a(++_0x44e3d0);}(_0xcfd9,0xf6));var _0x9cfd=function(_0xfc7019,_0x277c9e){_0xfc7019=_0xfc7019-0x0;var _0x2af8f4=_0xcfd9[_0xfc7019];return _0x2af8f4;};'use strict';var EventEmitter=require('events');var SmsQueue=require('../../mysqldb')['db'][_0x9cfd('0x0')];var SmsQueueEvents=new EventEmitter();SmsQueueEvents[_0x9cfd('0x1')](0x0);var events={'afterCreate':_0x9cfd('0x2'),'afterUpdate':_0x9cfd('0x3'),'afterDestroy':'remove'};function emitEvent(_0xfa1f5c){return function(_0x2de0ce,_0x1fd49f,_0x17cce2){SmsQueueEvents[_0x9cfd('0x4')](_0xfa1f5c+':'+_0x2de0ce['id'],_0x2de0ce);SmsQueueEvents[_0x9cfd('0x4')](_0xfa1f5c,_0x2de0ce);_0x17cce2(null);};}for(var e in events){if(events[_0x9cfd('0x5')](e)){var event=events[e];SmsQueue[_0x9cfd('0x6')](e,emitEvent(event));}}module[_0x9cfd('0x7')]=SmsQueueEvents; \ No newline at end of file +var _0x114d=['remove','emit','hasOwnProperty','hook','exports','events','../../mysqldb','SmsQueue','setMaxListeners','update'];(function(_0x13e88c,_0x3ab11b){var _0x150f6d=function(_0xa53c50){while(--_0xa53c50){_0x13e88c['push'](_0x13e88c['shift']());}};_0x150f6d(++_0x3ab11b);}(_0x114d,0x195));var _0xd114=function(_0x2432d6,_0x50b970){_0x2432d6=_0x2432d6-0x0;var _0x4d5c03=_0x114d[_0x2432d6];return _0x4d5c03;};'use strict';var EventEmitter=require(_0xd114('0x0'));var SmsQueue=require(_0xd114('0x1'))['db'][_0xd114('0x2')];var SmsQueueEvents=new EventEmitter();SmsQueueEvents[_0xd114('0x3')](0x0);var events={'afterCreate':'save','afterUpdate':_0xd114('0x4'),'afterDestroy':_0xd114('0x5')};function emitEvent(_0x309615){return function(_0xcc6ae2,_0x303b1e,_0x19274a){SmsQueueEvents[_0xd114('0x6')](_0x309615+':'+_0xcc6ae2['id'],_0xcc6ae2);SmsQueueEvents['emit'](_0x309615,_0xcc6ae2);_0x19274a(null);};}for(var e in events){if(events[_0xd114('0x7')](e)){var event=events[e];SmsQueue[_0xd114('0x8')](e,emitEvent(event));}}module[_0xd114('0x9')]=SmsQueueEvents; \ No newline at end of file diff --git a/server/api/smsQueue/smsQueue.model.js b/server/api/smsQueue/smsQueue.model.js index b96c5f7..1774383 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 _0x2b79=['./smsQueue.attributes','exports','SmsQueue','sms_queues','lodash','util','../../config/logger','moment','bluebird','request-promise','../../config/environment'];(function(_0x58f245,_0x3e4f31){var _0x1f0cfb=function(_0x515942){while(--_0x515942){_0x58f245['push'](_0x58f245['shift']());}};_0x1f0cfb(++_0x3e4f31);}(_0x2b79,0x12d));var _0x92b7=function(_0x5ab238,_0x4ddda9){_0x5ab238=_0x5ab238-0x0;var _0x236db6=_0x2b79[_0x5ab238];return _0x236db6;};'use strict';var _=require(_0x92b7('0x0'));var util=require(_0x92b7('0x1'));var logger=require(_0x92b7('0x2'))('api');var moment=require(_0x92b7('0x3'));var BPromise=require(_0x92b7('0x4'));var rp=require(_0x92b7('0x5'));var fs=require('fs');var path=require('path');var rimraf=require('rimraf');var config=require(_0x92b7('0x6'));var attributes=require(_0x92b7('0x7'));module[_0x92b7('0x8')]=function(_0xb24345,_0x413a82){return _0xb24345['define'](_0x92b7('0x9'),attributes,{'tableName':_0x92b7('0xa'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x3a9a=['lodash','util','../../config/logger','moment','request-promise','rimraf','define','SmsQueue'];(function(_0x2ff443,_0x1fd67c){var _0x28585c=function(_0x1ed8ed){while(--_0x1ed8ed){_0x2ff443['push'](_0x2ff443['shift']());}};_0x28585c(++_0x1fd67c);}(_0x3a9a,0xb0));var _0xa3a9=function(_0x2abc3d,_0x48edca){_0x2abc3d=_0x2abc3d-0x0;var _0x252745=_0x3a9a[_0x2abc3d];return _0x252745;};'use strict';var _=require(_0xa3a9('0x0'));var util=require(_0xa3a9('0x1'));var logger=require(_0xa3a9('0x2'))('api');var moment=require(_0xa3a9('0x3'));var BPromise=require('bluebird');var rp=require(_0xa3a9('0x4'));var fs=require('fs');var path=require('path');var rimraf=require(_0xa3a9('0x5'));var config=require('../../config/environment');var attributes=require('./smsQueue.attributes');module['exports']=function(_0x3086ec,_0x2fe3fe){return _0x3086ec[_0xa3a9('0x6')](_0xa3a9('0x7'),attributes,{'tableName':'sms_queues','paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/smsQueue/smsQueue.rpc.js b/server/api/smsQueue/smsQueue.rpc.js index 6ee34d8..e5f460e 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 _0x2ebe=['./smsQueue.socket','register','then','SmsQueue,\x20%s,\x20%s','debug','request\x20sent','stringify','error','code','message','info','result','catch','SmsQueue','findAll','options','raw','where','limit','include','model','attributes','map','GetSmsQueue','ShowSmsQueue','find','lodash','util','moment','bluebird','ioredis','../../mysqldb','rpc','../../config/environment','jayson/promise','client','http','redis','localhost','socket.io-emitter'];(function(_0x7a6aed,_0x335e68){var _0x9dbabf=function(_0x453c9c){while(--_0x453c9c){_0x7a6aed['push'](_0x7a6aed['shift']());}};_0x9dbabf(++_0x335e68);}(_0x2ebe,0x182));var _0xe2eb=function(_0x1f50a2,_0x12112f){_0x1f50a2=_0x1f50a2-0x0;var _0x2d2b18=_0x2ebe[_0x1f50a2];return _0x2d2b18;};'use strict';var _=require(_0xe2eb('0x0'));var util=require(_0xe2eb('0x1'));var moment=require(_0xe2eb('0x2'));var BPromise=require(_0xe2eb('0x3'));var rs=require('randomstring');var fs=require('fs');var Redis=require(_0xe2eb('0x4'));var db=require(_0xe2eb('0x5'))['db'];var utils=require('../../config/utils');var logger=require('../../config/logger')(_0xe2eb('0x6'));var config=require(_0xe2eb('0x7'));var jayson=require(_0xe2eb('0x8'));var client=jayson[_0xe2eb('0x9')][_0xe2eb('0xa')]({'port':0x232a});config[_0xe2eb('0xb')]=_['defaults'](config['redis'],{'host':_0xe2eb('0xc'),'port':0x18eb});var socket=require(_0xe2eb('0xd'))(new Redis(config[_0xe2eb('0xb')]));require(_0xe2eb('0xe'))[_0xe2eb('0xf')](socket);function respondWithRpcPromise(_0x1fe0a4,_0x51f792,_0x45780e){return new BPromise(function(_0x2d1723,_0xe20cbe){return client['request'](_0x1fe0a4,_0x45780e)[_0xe2eb('0x10')](function(_0x3ab36e){logger['info'](_0xe2eb('0x11'),_0x51f792,'request\x20sent');logger[_0xe2eb('0x12')]('SmsQueue,\x20%s,\x20%s,\x20%s',_0x51f792,_0xe2eb('0x13'),JSON[_0xe2eb('0x14')](_0x3ab36e));if(_0x3ab36e[_0xe2eb('0x15')]){if(_0x3ab36e[_0xe2eb('0x15')][_0xe2eb('0x16')]===0x1f4){logger['error'](_0xe2eb('0x11'),_0x51f792,_0x3ab36e[_0xe2eb('0x15')]['message']);return _0xe20cbe(_0x3ab36e[_0xe2eb('0x15')][_0xe2eb('0x17')]);}logger[_0xe2eb('0x15')]('SmsQueue,\x20%s,\x20%s',_0x51f792,_0x3ab36e[_0xe2eb('0x15')][_0xe2eb('0x17')]);return _0x2d1723(_0x3ab36e[_0xe2eb('0x15')][_0xe2eb('0x17')]);}else{logger[_0xe2eb('0x18')]('SmsQueue,\x20%s,\x20%s',_0x51f792,'request\x20sent');_0x2d1723(_0x3ab36e[_0xe2eb('0x19')][_0xe2eb('0x17')]);}})[_0xe2eb('0x1a')](function(_0xd8b201){logger[_0xe2eb('0x15')]('SmsQueue,\x20%s,\x20%s',_0x51f792,_0xd8b201);_0xe20cbe(_0xd8b201);});});}exports['GetSmsQueue']=function(_0x29b5e0){var _0x5d6eb5=this;return new Promise(function(_0x6acd2f,_0xf8b884){return db[_0xe2eb('0x1b')][_0xe2eb('0x1c')]({'raw':_0x29b5e0[_0xe2eb('0x1d')]?_0x29b5e0[_0xe2eb('0x1d')][_0xe2eb('0x1e')]===undefined?!![]:![]:!![],'where':_0x29b5e0['options']?_0x29b5e0['options'][_0xe2eb('0x1f')]||null:null,'attributes':_0x29b5e0[_0xe2eb('0x1d')]?_0x29b5e0[_0xe2eb('0x1d')]['attributes']||null:null,'limit':_0x29b5e0['options']?_0x29b5e0[_0xe2eb('0x1d')][_0xe2eb('0x20')]||null:null,'include':_0x29b5e0[_0xe2eb('0x1d')]?_0x29b5e0[_0xe2eb('0x1d')][_0xe2eb('0x21')]?_['map'](_0x29b5e0[_0xe2eb('0x1d')][_0xe2eb('0x21')],function(_0x18e76f){return{'model':db[_0x18e76f[_0xe2eb('0x22')]],'as':_0x18e76f['as'],'attributes':_0x18e76f['attributes'],'include':_0x18e76f[_0xe2eb('0x21')]?_['map'](_0x18e76f[_0xe2eb('0x21')],function(_0x91e9f3){return{'model':db[_0x91e9f3['model']],'as':_0x91e9f3['as'],'attributes':_0x91e9f3[_0xe2eb('0x23')],'include':_0x91e9f3[_0xe2eb('0x21')]?_[_0xe2eb('0x24')](_0x91e9f3[_0xe2eb('0x21')],function(_0xda913c){return{'model':db[_0xda913c[_0xe2eb('0x22')]],'as':_0xda913c['as'],'attributes':_0xda913c[_0xe2eb('0x23')]};}):[]};}):[]};}):[]:[]})[_0xe2eb('0x10')](function(_0x4e8c9a){logger['info'](_0xe2eb('0x25'),_0x29b5e0);logger['debug'](_0xe2eb('0x25'),_0x29b5e0,JSON[_0xe2eb('0x14')](_0x4e8c9a));_0x6acd2f(_0x4e8c9a);})[_0xe2eb('0x1a')](function(_0x15bf5a){logger[_0xe2eb('0x15')](_0xe2eb('0x25'),_0x15bf5a[_0xe2eb('0x17')],_0x29b5e0);_0xf8b884(_0x5d6eb5[_0xe2eb('0x15')](0x1f4,_0x15bf5a['message']));});});};exports[_0xe2eb('0x26')]=function(_0x351987){var _0x504ea3=this;return new Promise(function(_0x2a095f,_0xc5deba){return db['SmsQueue'][_0xe2eb('0x27')]({'raw':_0x351987[_0xe2eb('0x1d')]?_0x351987[_0xe2eb('0x1d')][_0xe2eb('0x1e')]===undefined?!![]:![]:!![],'where':_0x351987['options']?_0x351987[_0xe2eb('0x1d')][_0xe2eb('0x1f')]||null:null,'attributes':_0x351987['options']?_0x351987[_0xe2eb('0x1d')][_0xe2eb('0x23')]||null:null,'include':_0x351987[_0xe2eb('0x1d')]?_0x351987['options'][_0xe2eb('0x21')]?_['map'](_0x351987[_0xe2eb('0x1d')][_0xe2eb('0x21')],function(_0x3a1d48){return{'model':db[_0x3a1d48[_0xe2eb('0x22')]],'as':_0x3a1d48['as'],'attributes':_0x3a1d48[_0xe2eb('0x23')],'include':_0x3a1d48[_0xe2eb('0x21')]?_[_0xe2eb('0x24')](_0x3a1d48[_0xe2eb('0x21')],function(_0x1a42db){return{'model':db[_0x1a42db['model']],'as':_0x1a42db['as'],'attributes':_0x1a42db[_0xe2eb('0x23')],'include':_0x1a42db[_0xe2eb('0x21')]?_[_0xe2eb('0x24')](_0x1a42db[_0xe2eb('0x21')],function(_0x44ea05){return{'model':db[_0x44ea05[_0xe2eb('0x22')]],'as':_0x44ea05['as'],'attributes':_0x44ea05[_0xe2eb('0x23')]};}):[]};}):[]};}):[]:[]})[_0xe2eb('0x10')](function(_0x37e6f7){logger['info'](_0xe2eb('0x26'),_0x351987);logger['debug'](_0xe2eb('0x26'),_0x351987,JSON[_0xe2eb('0x14')](_0x37e6f7));_0x2a095f(_0x37e6f7);})[_0xe2eb('0x1a')](function(_0x3c2695){logger[_0xe2eb('0x15')](_0xe2eb('0x26'),_0x3c2695[_0xe2eb('0x17')],_0x351987);_0xc5deba(_0x504ea3[_0xe2eb('0x15')](0x1f4,_0x3c2695[_0xe2eb('0x17')]));});});}; \ No newline at end of file +var _0xff16=['result','catch','SmsQueue','options','where','limit','include','model','map','attributes','GetSmsQueue','find','raw','ShowSmsQueue','util','bluebird','randomstring','../../mysqldb','../../config/utils','../../config/environment','jayson/promise','client','http','redis','defaults','localhost','socket.io-emitter','register','request','then','info','SmsQueue,\x20%s,\x20%s','debug','SmsQueue,\x20%s,\x20%s,\x20%s','stringify','error','code','message'];(function(_0x2115a2,_0x546935){var _0x1de118=function(_0x59257c){while(--_0x59257c){_0x2115a2['push'](_0x2115a2['shift']());}};_0x1de118(++_0x546935);}(_0xff16,0xa6));var _0x6ff1=function(_0x3456a4,_0xacd066){_0x3456a4=_0x3456a4-0x0;var _0x5aa35e=_0xff16[_0x3456a4];return _0x5aa35e;};'use strict';var _=require('lodash');var util=require(_0x6ff1('0x0'));var moment=require('moment');var BPromise=require(_0x6ff1('0x1'));var rs=require(_0x6ff1('0x2'));var fs=require('fs');var Redis=require('ioredis');var db=require(_0x6ff1('0x3'))['db'];var utils=require(_0x6ff1('0x4'));var logger=require('../../config/logger')('rpc');var config=require(_0x6ff1('0x5'));var jayson=require(_0x6ff1('0x6'));var client=jayson[_0x6ff1('0x7')][_0x6ff1('0x8')]({'port':0x232a});config[_0x6ff1('0x9')]=_[_0x6ff1('0xa')](config[_0x6ff1('0x9')],{'host':_0x6ff1('0xb'),'port':0x18eb});var socket=require(_0x6ff1('0xc'))(new Redis(config[_0x6ff1('0x9')]));require('./smsQueue.socket')[_0x6ff1('0xd')](socket);function respondWithRpcPromise(_0x2edd69,_0x9016bb,_0x27c31e){return new BPromise(function(_0x2fc712,_0x2b4ba9){return client[_0x6ff1('0xe')](_0x2edd69,_0x27c31e)[_0x6ff1('0xf')](function(_0x48a4af){logger[_0x6ff1('0x10')](_0x6ff1('0x11'),_0x9016bb,'request\x20sent');logger[_0x6ff1('0x12')](_0x6ff1('0x13'),_0x9016bb,'request\x20sent',JSON[_0x6ff1('0x14')](_0x48a4af));if(_0x48a4af[_0x6ff1('0x15')]){if(_0x48a4af[_0x6ff1('0x15')][_0x6ff1('0x16')]===0x1f4){logger['error'](_0x6ff1('0x11'),_0x9016bb,_0x48a4af['error'][_0x6ff1('0x17')]);return _0x2b4ba9(_0x48a4af['error']['message']);}logger[_0x6ff1('0x15')]('SmsQueue,\x20%s,\x20%s',_0x9016bb,_0x48a4af[_0x6ff1('0x15')][_0x6ff1('0x17')]);return _0x2fc712(_0x48a4af[_0x6ff1('0x15')]['message']);}else{logger['info']('SmsQueue,\x20%s,\x20%s',_0x9016bb,'request\x20sent');_0x2fc712(_0x48a4af[_0x6ff1('0x18')][_0x6ff1('0x17')]);}})[_0x6ff1('0x19')](function(_0x23aff8){logger[_0x6ff1('0x15')](_0x6ff1('0x11'),_0x9016bb,_0x23aff8);_0x2b4ba9(_0x23aff8);});});}exports['GetSmsQueue']=function(_0x140fb6){var _0x2fba07=this;return new Promise(function(_0x344712,_0x323d4c){return db[_0x6ff1('0x1a')]['findAll']({'raw':_0x140fb6[_0x6ff1('0x1b')]?_0x140fb6[_0x6ff1('0x1b')]['raw']===undefined?!![]:![]:!![],'where':_0x140fb6[_0x6ff1('0x1b')]?_0x140fb6['options'][_0x6ff1('0x1c')]||null:null,'attributes':_0x140fb6['options']?_0x140fb6[_0x6ff1('0x1b')]['attributes']||null:null,'limit':_0x140fb6['options']?_0x140fb6['options'][_0x6ff1('0x1d')]||null:null,'include':_0x140fb6[_0x6ff1('0x1b')]?_0x140fb6[_0x6ff1('0x1b')]['include']?_['map'](_0x140fb6[_0x6ff1('0x1b')][_0x6ff1('0x1e')],function(_0x1664d8){return{'model':db[_0x1664d8[_0x6ff1('0x1f')]],'as':_0x1664d8['as'],'attributes':_0x1664d8['attributes'],'include':_0x1664d8[_0x6ff1('0x1e')]?_[_0x6ff1('0x20')](_0x1664d8['include'],function(_0x4f0045){return{'model':db[_0x4f0045[_0x6ff1('0x1f')]],'as':_0x4f0045['as'],'attributes':_0x4f0045[_0x6ff1('0x21')],'include':_0x4f0045[_0x6ff1('0x1e')]?_[_0x6ff1('0x20')](_0x4f0045['include'],function(_0x5420ee){return{'model':db[_0x5420ee['model']],'as':_0x5420ee['as'],'attributes':_0x5420ee[_0x6ff1('0x21')]};}):[]};}):[]};}):[]:[]})[_0x6ff1('0xf')](function(_0x39ecc9){logger[_0x6ff1('0x10')](_0x6ff1('0x22'),_0x140fb6);logger[_0x6ff1('0x12')](_0x6ff1('0x22'),_0x140fb6,JSON[_0x6ff1('0x14')](_0x39ecc9));_0x344712(_0x39ecc9);})[_0x6ff1('0x19')](function(_0x30994f){logger[_0x6ff1('0x15')](_0x6ff1('0x22'),_0x30994f[_0x6ff1('0x17')],_0x140fb6);_0x323d4c(_0x2fba07[_0x6ff1('0x15')](0x1f4,_0x30994f['message']));});});};exports['ShowSmsQueue']=function(_0x23cc36){var _0x5abc3b=this;return new Promise(function(_0xdcd513,_0x29c717){return db[_0x6ff1('0x1a')][_0x6ff1('0x23')]({'raw':_0x23cc36[_0x6ff1('0x1b')]?_0x23cc36[_0x6ff1('0x1b')][_0x6ff1('0x24')]===undefined?!![]:![]:!![],'where':_0x23cc36[_0x6ff1('0x1b')]?_0x23cc36[_0x6ff1('0x1b')][_0x6ff1('0x1c')]||null:null,'attributes':_0x23cc36[_0x6ff1('0x1b')]?_0x23cc36[_0x6ff1('0x1b')][_0x6ff1('0x21')]||null:null,'include':_0x23cc36[_0x6ff1('0x1b')]?_0x23cc36[_0x6ff1('0x1b')][_0x6ff1('0x1e')]?_['map'](_0x23cc36[_0x6ff1('0x1b')][_0x6ff1('0x1e')],function(_0x2ef385){return{'model':db[_0x2ef385[_0x6ff1('0x1f')]],'as':_0x2ef385['as'],'attributes':_0x2ef385[_0x6ff1('0x21')],'include':_0x2ef385['include']?_[_0x6ff1('0x20')](_0x2ef385[_0x6ff1('0x1e')],function(_0x2d51f6){return{'model':db[_0x2d51f6[_0x6ff1('0x1f')]],'as':_0x2d51f6['as'],'attributes':_0x2d51f6[_0x6ff1('0x21')],'include':_0x2d51f6['include']?_[_0x6ff1('0x20')](_0x2d51f6['include'],function(_0x315cc8){return{'model':db[_0x315cc8[_0x6ff1('0x1f')]],'as':_0x315cc8['as'],'attributes':_0x315cc8[_0x6ff1('0x21')]};}):[]};}):[]};}):[]:[]})[_0x6ff1('0xf')](function(_0x89bd1e){logger[_0x6ff1('0x10')](_0x6ff1('0x25'),_0x23cc36);logger['debug'](_0x6ff1('0x25'),_0x23cc36,JSON['stringify'](_0x89bd1e));_0xdcd513(_0x89bd1e);})['catch'](function(_0x1bf10b){logger[_0x6ff1('0x15')](_0x6ff1('0x25'),_0x1bf10b[_0x6ff1('0x17')],_0x23cc36);_0x29c717(_0x5abc3b[_0x6ff1('0x15')](0x1f4,_0x1bf10b[_0x6ff1('0x17')]));});});}; \ No newline at end of file diff --git a/server/api/smsQueue/smsQueue.socket.js b/server/api/smsQueue/smsQueue.socket.js index f7db405..452a1fa 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 _0xf90c=['smsQueue:','./smsQueue.events','remove','update','emit','removeListener','length'];(function(_0x2ad000,_0x193662){var _0x2faf7f=function(_0x49004f){while(--_0x49004f){_0x2ad000['push'](_0x2ad000['shift']());}};_0x2faf7f(++_0x193662);}(_0xf90c,0x8d));var _0xcf90=function(_0x2c249b,_0x52c230){_0x2c249b=_0x2c249b-0x0;var _0x3a7fce=_0xf90c[_0x2c249b];return _0x3a7fce;};'use strict';var SmsQueueEvents=require(_0xcf90('0x0'));var events=['save',_0xcf90('0x1'),_0xcf90('0x2')];function createListener(_0xd320a9,_0x49900a){return function(_0x179ac6){_0x49900a[_0xcf90('0x3')](_0xd320a9,_0x179ac6);};}function removeListener(_0x1d49b9,_0x3aad9f){return function(){SmsQueueEvents[_0xcf90('0x4')](_0x1d49b9,_0x3aad9f);};}exports['register']=function(_0x222047){for(var _0x3b9185=0x0,_0x12a9ce=events[_0xcf90('0x5')];_0x3b9185<_0x12a9ce;_0x3b9185++){var _0x1f74a1=events[_0x3b9185];var _0x21414f=createListener(_0xcf90('0x6')+_0x1f74a1,_0x222047);SmsQueueEvents['on'](_0x1f74a1,_0x21414f);}}; \ No newline at end of file +var _0x5b27=['length','smsQueue:','remove','emit'];(function(_0x38758e,_0x19a4e0){var _0x2d8516=function(_0x296844){while(--_0x296844){_0x38758e['push'](_0x38758e['shift']());}};_0x2d8516(++_0x19a4e0);}(_0x5b27,0x132));var _0x75b2=function(_0x28cc4e,_0x1fa204){_0x28cc4e=_0x28cc4e-0x0;var _0x439cbd=_0x5b27[_0x28cc4e];return _0x439cbd;};'use strict';var SmsQueueEvents=require('./smsQueue.events');var events=['save',_0x75b2('0x0'),'update'];function createListener(_0xeb9d71,_0x5efadb){return function(_0x4ef132){_0x5efadb[_0x75b2('0x1')](_0xeb9d71,_0x4ef132);};}function removeListener(_0x856389,_0x298c60){return function(){SmsQueueEvents['removeListener'](_0x856389,_0x298c60);};}exports['register']=function(_0x21b405){for(var _0x2b174b=0x0,_0x26c982=events[_0x75b2('0x2')];_0x2b174b<_0x26c982;_0x2b174b++){var _0x482eb2=events[_0x2b174b];var _0xf2435c=createListener(_0x75b2('0x3')+_0x482eb2,_0x21b405);SmsQueueEvents['on'](_0x482eb2,_0xf2435c);}}; \ No newline at end of file diff --git a/server/api/smsQueueReport/index.js b/server/api/smsQueueReport/index.js index 8b9794d..21021fb 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 _0xbd18=['/describe','describe','/:id','show','post','create','update','delete','exports','multer','util','path','express','../../components/interaction/service','../../config/environment','isAuthenticated','index','get'];(function(_0x17d9e3,_0x1f969c){var _0x14192d=function(_0x159745){while(--_0x159745){_0x17d9e3['push'](_0x17d9e3['shift']());}};_0x14192d(++_0x1f969c);}(_0xbd18,0x195));var _0x8bd1=function(_0x260381,_0x2790b2){_0x260381=_0x260381-0x0;var _0x262d08=_0xbd18[_0x260381];return _0x262d08;};'use strict';var multer=require(_0x8bd1('0x0'));var util=require(_0x8bd1('0x1'));var path=require(_0x8bd1('0x2'));var timeout=require('connect-timeout');var express=require(_0x8bd1('0x3'));var router=express['Router']();var fs_extra=require('fs-extra');var auth=require('../../components/auth/service');var interaction=require(_0x8bd1('0x4'));var config=require(_0x8bd1('0x5'));var controller=require('./smsQueueReport.controller');router['get']('/',auth[_0x8bd1('0x6')](),controller[_0x8bd1('0x7')]);router[_0x8bd1('0x8')](_0x8bd1('0x9'),auth['isAuthenticated'](),controller[_0x8bd1('0xa')]);router[_0x8bd1('0x8')](_0x8bd1('0xb'),auth['isAuthenticated'](),controller[_0x8bd1('0xc')]);router[_0x8bd1('0xd')]('/',auth[_0x8bd1('0x6')](),controller[_0x8bd1('0xe')]);router['put'](_0x8bd1('0xb'),auth['isAuthenticated'](),controller[_0x8bd1('0xf')]);router[_0x8bd1('0x10')]('/:id',auth[_0x8bd1('0x6')](),controller['destroy']);module[_0x8bd1('0x11')]=router; \ No newline at end of file +var _0x3483=['fs-extra','../../components/auth/service','../../config/environment','get','isAuthenticated','index','/:id','show','post','create','put','update','destroy','connect-timeout','express','Router'];(function(_0x101b93,_0x15242f){var _0x38d0b1=function(_0x5a14b8){while(--_0x5a14b8){_0x101b93['push'](_0x101b93['shift']());}};_0x38d0b1(++_0x15242f);}(_0x3483,0x7d));var _0x3348=function(_0x1ef386,_0x2b2b5d){_0x1ef386=_0x1ef386-0x0;var _0x272091=_0x3483[_0x1ef386];return _0x272091;};'use strict';var multer=require('multer');var util=require('util');var path=require('path');var timeout=require(_0x3348('0x0'));var express=require(_0x3348('0x1'));var router=express[_0x3348('0x2')]();var fs_extra=require(_0x3348('0x3'));var auth=require(_0x3348('0x4'));var interaction=require('../../components/interaction/service');var config=require(_0x3348('0x5'));var controller=require('./smsQueueReport.controller');router[_0x3348('0x6')]('/',auth[_0x3348('0x7')](),controller[_0x3348('0x8')]);router[_0x3348('0x6')]('/describe',auth[_0x3348('0x7')](),controller['describe']);router['get'](_0x3348('0x9'),auth[_0x3348('0x7')](),controller[_0x3348('0xa')]);router[_0x3348('0xb')]('/',auth[_0x3348('0x7')](),controller[_0x3348('0xc')]);router[_0x3348('0xd')](_0x3348('0x9'),auth[_0x3348('0x7')](),controller[_0x3348('0xe')]);router['delete']('/:id',auth[_0x3348('0x7')](),controller[_0x3348('0xf')]);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 58ba514..5f6542d 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 _0x88df=['exports','DATE','STRING','moment','sequelize'];(function(_0xe847a0,_0x140595){var _0xa8b82b=function(_0x1f4076){while(--_0x1f4076){_0xe847a0['push'](_0xe847a0['shift']());}};_0xa8b82b(++_0x140595);}(_0x88df,0x10c));var _0xf88d=function(_0x7a932b,_0x4b1bd9){_0x7a932b=_0x7a932b-0x0;var _0x30baff=_0x88df[_0x7a932b];return _0x30baff;};'use strict';var moment=require(_0xf88d('0x0'));var Sequelize=require(_0xf88d('0x1'));module[_0xf88d('0x2')]={'uniqueid':{'type':Sequelize['STRING'],'allowNull':![]},'from':{'type':Sequelize['STRING']},'joinAt':{'type':Sequelize['DATE']},'leaveAt':{'type':Sequelize[_0xf88d('0x3')]},'acceptAt':{'type':Sequelize[_0xf88d('0x3')]},'exitAt':{'type':Sequelize[_0xf88d('0x3')]},'reason':{'type':Sequelize[_0xf88d('0x4')]}}; \ No newline at end of file +var _0xe02c=['STRING','DATE','moment','exports'];(function(_0x25389b,_0x3197de){var _0x38b504=function(_0x6aba03){while(--_0x6aba03){_0x25389b['push'](_0x25389b['shift']());}};_0x38b504(++_0x3197de);}(_0xe02c,0xae));var _0xce02=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0xe02c[_0x3dd15e];return _0x231fd0;};'use strict';var moment=require(_0xce02('0x0'));var Sequelize=require('sequelize');module[_0xce02('0x1')]={'uniqueid':{'type':Sequelize[_0xce02('0x2')],'allowNull':![]},'from':{'type':Sequelize['STRING']},'joinAt':{'type':Sequelize[_0xce02('0x3')]},'leaveAt':{'type':Sequelize[_0xce02('0x3')]},'acceptAt':{'type':Sequelize[_0xce02('0x3')]},'exitAt':{'type':Sequelize['DATE']},'reason':{'type':Sequelize[_0xce02('0x2')]}}; \ No newline at end of file diff --git a/server/api/smsQueueReport/smsQueueReport.controller.js b/server/api/smsQueueReport/smsQueueReport.controller.js index 0f67437..f69334d 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 _0x84e4=['limit','count','set','Content-Range','apply','save','update','destroy','then','end','error','name','send','index','map','SmsQueueReport','rawAttributes','fieldName','type','model','query','filters','intersection','fields','attributes','length','hasOwnProperty','nolimit','order','sort','pick','where','VIRTUAL','filter','merge','options','includeAll','include','findAll','rows','show','params','keys','catch','create','body','find','describe','eml-format','rimraf','request-promise','moment','bluebird','mustache','util','path','sox','to-csv','ejs','squel','crypto','jsforce','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','sendStatus','status','json','offset','undefined'];(function(_0x4650ad,_0x2cae1a){var _0x17db36=function(_0x4749e5){while(--_0x4749e5){_0x4650ad['push'](_0x4650ad['shift']());}};_0x17db36(++_0x2cae1a);}(_0x84e4,0x11d));var _0x484e=function(_0x30cc1a,_0x162bbc){_0x30cc1a=_0x30cc1a-0x0;var _0xb3f18f=_0x84e4[_0x30cc1a];return _0xb3f18f;};'use strict';var emlformat=require(_0x484e('0x0'));var rimraf=require(_0x484e('0x1'));var zipdir=require('zip-dir');var jsonpatch=require('fast-json-patch');var rp=require(_0x484e('0x2'));var moment=require(_0x484e('0x3'));var BPromise=require(_0x484e('0x4'));var Mustache=require(_0x484e('0x5'));var util=require(_0x484e('0x6'));var path=require(_0x484e('0x7'));var sox=require(_0x484e('0x8'));var csv=require(_0x484e('0x9'));var ejs=require(_0x484e('0xa'));var fs=require('fs');var fs_extra=require('fs-extra');var _=require('lodash');var squel=require(_0x484e('0xb'));var crypto=require(_0x484e('0xc'));var jsforce=require(_0x484e('0xd'));var deskjs=require('desk.js');var toCsv=require(_0x484e('0x9'));var querystring=require(_0x484e('0xe'));var Papa=require(_0x484e('0xf'));var Redis=require(_0x484e('0x10'));var authService=require(_0x484e('0x11'));var qs=require(_0x484e('0x12'));var as=require(_0x484e('0x13'));var hardwareService=require(_0x484e('0x14'));var logger=require(_0x484e('0x15'))('api');var utils=require(_0x484e('0x16'));var config=require(_0x484e('0x17'));var licenseUtil=require(_0x484e('0x18'));var db=require(_0x484e('0x19'))['db'];function respondWithStatusCode(_0x517925,_0x11bd63){_0x11bd63=_0x11bd63||0xcc;return function(_0x59dc0a){if(_0x59dc0a){return _0x517925[_0x484e('0x1a')](_0x11bd63);}return _0x517925['status'](_0x11bd63)['end']();};}function respondWithResult(_0x48a678,_0x4930e0){_0x4930e0=_0x4930e0||0xc8;return function(_0x21a8be){if(_0x21a8be){return _0x48a678[_0x484e('0x1b')](_0x4930e0)[_0x484e('0x1c')](_0x21a8be);}};}function respondWithFilteredResult(_0x4f8598,_0x3e0819){return function(_0x5c5937){if(_0x5c5937){var _0x2c988f=typeof _0x3e0819[_0x484e('0x1d')]===_0x484e('0x1e')&&typeof _0x3e0819[_0x484e('0x1f')]==='undefined';var _0x1a0a59=_0x5c5937[_0x484e('0x20')];var _0x19ae56=_0x2c988f?0x0:_0x3e0819[_0x484e('0x1d')];var _0x151764=_0x2c988f?_0x5c5937[_0x484e('0x20')]:_0x3e0819[_0x484e('0x1d')]+_0x3e0819[_0x484e('0x1f')];var _0xaf7cab;if(_0x151764>=_0x1a0a59){_0x151764=_0x1a0a59;_0xaf7cab=0xc8;}else{_0xaf7cab=0xce;}_0x4f8598['status'](_0xaf7cab);return _0x4f8598[_0x484e('0x21')](_0x484e('0x22'),_0x19ae56+'-'+_0x151764+'/'+_0x1a0a59)[_0x484e('0x1c')](_0x5c5937);}return null;};}function patchUpdates(_0x7bbe2e){return function(_0x2aee73){try{jsonpatch[_0x484e('0x23')](_0x2aee73,_0x7bbe2e,!![]);}catch(_0x3836ca){return BPromise['reject'](_0x3836ca);}return _0x2aee73[_0x484e('0x24')]();};}function saveUpdates(_0x3a6e6e,_0x215560){return function(_0x32f0e2){if(_0x32f0e2){return _0x32f0e2[_0x484e('0x25')](_0x3a6e6e)['then'](function(_0x41826d){return _0x41826d;});}return null;};}function removeEntity(_0x1f45c2,_0x1ae528){return function(_0x6f0cda){if(_0x6f0cda){return _0x6f0cda[_0x484e('0x26')]()[_0x484e('0x27')](function(){_0x1f45c2['status'](0xcc)[_0x484e('0x28')]();});}};}function handleEntityNotFound(_0x3ded18,_0x2952d5){return function(_0x34119e){if(!_0x34119e){_0x3ded18[_0x484e('0x1a')](0x194);}return _0x34119e;};}function handleError(_0x555d94,_0x59fa2f){_0x59fa2f=_0x59fa2f||0x1f4;return function(_0x218bc1){logger[_0x484e('0x29')](_0x218bc1['stack']);if(_0x218bc1[_0x484e('0x2a')]){delete _0x218bc1['name'];}_0x555d94[_0x484e('0x1b')](_0x59fa2f)[_0x484e('0x2b')](_0x218bc1);};}exports[_0x484e('0x2c')]=function(_0x4f05cd,_0x322452){var _0x15513e={},_0x3e8bec={},_0x2f1547={'count':0x0,'rows':[]};var _0x55b27c=_[_0x484e('0x2d')](db[_0x484e('0x2e')][_0x484e('0x2f')],function(_0x1c6e5f){return{'name':_0x1c6e5f[_0x484e('0x30')],'type':_0x1c6e5f[_0x484e('0x31')]['key']};});_0x3e8bec[_0x484e('0x32')]=_[_0x484e('0x2d')](_0x55b27c,_0x484e('0x2a'));_0x3e8bec['query']=_['keys'](_0x4f05cd[_0x484e('0x33')]);_0x3e8bec[_0x484e('0x34')]=_[_0x484e('0x35')](_0x3e8bec[_0x484e('0x32')],_0x3e8bec[_0x484e('0x33')]);_0x15513e['attributes']=_[_0x484e('0x35')](_0x3e8bec[_0x484e('0x32')],qs[_0x484e('0x36')](_0x4f05cd[_0x484e('0x33')]['fields']));_0x15513e['attributes']=_0x15513e[_0x484e('0x37')][_0x484e('0x38')]?_0x15513e['attributes']:_0x3e8bec[_0x484e('0x32')];if(!_0x4f05cd[_0x484e('0x33')][_0x484e('0x39')](_0x484e('0x3a'))){_0x15513e['limit']=qs[_0x484e('0x1f')](_0x4f05cd[_0x484e('0x33')][_0x484e('0x1f')]);_0x15513e[_0x484e('0x1d')]=qs['offset'](_0x4f05cd['query'][_0x484e('0x1d')]);}_0x15513e[_0x484e('0x3b')]=qs['sort'](_0x4f05cd[_0x484e('0x33')][_0x484e('0x3c')]);_0x15513e['where']=qs[_0x484e('0x34')](_[_0x484e('0x3d')](_0x4f05cd[_0x484e('0x33')],_0x3e8bec[_0x484e('0x34')]),_0x55b27c);if(_0x4f05cd[_0x484e('0x33')]['filter']){_0x15513e[_0x484e('0x3e')]=_['merge'](_0x15513e[_0x484e('0x3e')],{'$or':_[_0x484e('0x2d')](_0x55b27c,function(_0x238a0d){if(_0x238a0d[_0x484e('0x31')]!==_0x484e('0x3f')){var _0xd4bc87={};_0xd4bc87[_0x238a0d[_0x484e('0x2a')]]={'$like':'%'+_0x4f05cd[_0x484e('0x33')][_0x484e('0x40')]+'%'};return _0xd4bc87;}})});}_0x15513e=_[_0x484e('0x41')]({},_0x15513e,_0x4f05cd[_0x484e('0x42')]);var _0x359b40={'where':_0x15513e[_0x484e('0x3e')]};return db['SmsQueueReport'][_0x484e('0x20')](_0x359b40)['then'](function(_0x18ebb2){_0x2f1547[_0x484e('0x20')]=_0x18ebb2;if(_0x4f05cd[_0x484e('0x33')][_0x484e('0x43')]){_0x15513e[_0x484e('0x44')]=[{'all':!![]}];}return db[_0x484e('0x2e')][_0x484e('0x45')](_0x15513e);})[_0x484e('0x27')](function(_0x2d7fbe){_0x2f1547[_0x484e('0x46')]=_0x2d7fbe;return _0x2f1547;})[_0x484e('0x27')](respondWithFilteredResult(_0x322452,_0x15513e))['catch'](handleError(_0x322452,null));};exports[_0x484e('0x47')]=function(_0x23181d,_0x854f64){var _0x5168fc={'raw':!![],'where':{'id':_0x23181d[_0x484e('0x48')]['id']}},_0x356057={};_0x356057[_0x484e('0x32')]=_[_0x484e('0x49')](db['SmsQueueReport'][_0x484e('0x2f')]);_0x356057['query']=_[_0x484e('0x49')](_0x23181d[_0x484e('0x33')]);_0x356057[_0x484e('0x34')]=_[_0x484e('0x35')](_0x356057[_0x484e('0x32')],_0x356057[_0x484e('0x33')]);_0x5168fc[_0x484e('0x37')]=_[_0x484e('0x35')](_0x356057[_0x484e('0x32')],qs[_0x484e('0x36')](_0x23181d[_0x484e('0x33')][_0x484e('0x36')]));_0x5168fc[_0x484e('0x37')]=_0x5168fc[_0x484e('0x37')]['length']?_0x5168fc['attributes']:_0x356057['model'];if(_0x23181d[_0x484e('0x33')][_0x484e('0x43')]){_0x5168fc[_0x484e('0x44')]=[{'all':!![]}];}_0x5168fc=_['merge']({},_0x5168fc,_0x23181d[_0x484e('0x42')]);return db[_0x484e('0x2e')]['find'](_0x5168fc)[_0x484e('0x27')](handleEntityNotFound(_0x854f64,null))[_0x484e('0x27')](respondWithResult(_0x854f64,null))[_0x484e('0x4a')](handleError(_0x854f64,null));};exports['create']=function(_0x45f2e2,_0x5b85a5){return db['SmsQueueReport'][_0x484e('0x4b')](_0x45f2e2[_0x484e('0x4c')],{})[_0x484e('0x27')](respondWithResult(_0x5b85a5,0xc9))['catch'](handleError(_0x5b85a5,null));};exports[_0x484e('0x25')]=function(_0x59ac5f,_0x1ca08d){if(_0x59ac5f['body']['id']){delete _0x59ac5f['body']['id'];}return db[_0x484e('0x2e')]['find']({'where':{'id':_0x59ac5f['params']['id']}})[_0x484e('0x27')](handleEntityNotFound(_0x1ca08d,null))[_0x484e('0x27')](saveUpdates(_0x59ac5f[_0x484e('0x4c')],null))[_0x484e('0x27')](respondWithResult(_0x1ca08d,null))[_0x484e('0x4a')](handleError(_0x1ca08d,null));};exports['destroy']=function(_0x5665cf,_0x4de39e){return db[_0x484e('0x2e')][_0x484e('0x4d')]({'where':{'id':_0x5665cf[_0x484e('0x48')]['id']}})[_0x484e('0x27')](handleEntityNotFound(_0x4de39e,null))['then'](removeEntity(_0x4de39e,null))[_0x484e('0x4a')](handleError(_0x4de39e,null));};exports[_0x484e('0x4e')]=function(_0x474d7d,_0x321926){return db['SmsQueueReport']['describe']()[_0x484e('0x27')](respondWithResult(_0x321926,null))['catch'](handleError(_0x321926,null));}; \ No newline at end of file +var _0xf1aa=['sox','to-csv','fs-extra','lodash','squel','crypto','jsforce','desk.js','querystring','ioredis','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/environment','../../config/license/util','../../mysqldb','sendStatus','status','end','offset','limit','undefined','count','set','json','apply','then','destroy','error','stack','name','send','index','map','rawAttributes','fieldName','type','key','model','query','keys','filters','intersection','attributes','fields','length','hasOwnProperty','order','sort','pick','filter','merge','where','VIRTUAL','options','includeAll','include','findAll','rows','catch','show','SmsQueueReport','find','create','body','params','describe','eml-format','rimraf','zip-dir','request-promise','bluebird','mustache','util','path'];(function(_0x2b3087,_0x5bad3a){var _0x39bb6a=function(_0x51f8d4){while(--_0x51f8d4){_0x2b3087['push'](_0x2b3087['shift']());}};_0x39bb6a(++_0x5bad3a);}(_0xf1aa,0xdc));var _0xaf1a=function(_0x42cae2,_0x284ef8){_0x42cae2=_0x42cae2-0x0;var _0x5f256f=_0xf1aa[_0x42cae2];return _0x5f256f;};'use strict';var emlformat=require(_0xaf1a('0x0'));var rimraf=require(_0xaf1a('0x1'));var zipdir=require(_0xaf1a('0x2'));var jsonpatch=require('fast-json-patch');var rp=require(_0xaf1a('0x3'));var moment=require('moment');var BPromise=require(_0xaf1a('0x4'));var Mustache=require(_0xaf1a('0x5'));var util=require(_0xaf1a('0x6'));var path=require(_0xaf1a('0x7'));var sox=require(_0xaf1a('0x8'));var csv=require(_0xaf1a('0x9'));var ejs=require('ejs');var fs=require('fs');var fs_extra=require(_0xaf1a('0xa'));var _=require(_0xaf1a('0xb'));var squel=require(_0xaf1a('0xc'));var crypto=require(_0xaf1a('0xd'));var jsforce=require(_0xaf1a('0xe'));var deskjs=require(_0xaf1a('0xf'));var toCsv=require(_0xaf1a('0x9'));var querystring=require(_0xaf1a('0x10'));var Papa=require('papaparse');var Redis=require(_0xaf1a('0x11'));var authService=require('../../components/auth/service');var qs=require('../../components/parsers/qs');var as=require(_0xaf1a('0x12'));var hardwareService=require(_0xaf1a('0x13'));var logger=require(_0xaf1a('0x14'))(_0xaf1a('0x15'));var utils=require('../../config/utils');var config=require(_0xaf1a('0x16'));var licenseUtil=require(_0xaf1a('0x17'));var db=require(_0xaf1a('0x18'))['db'];function respondWithStatusCode(_0x495c89,_0x3dd139){_0x3dd139=_0x3dd139||0xcc;return function(_0xb85a56){if(_0xb85a56){return _0x495c89[_0xaf1a('0x19')](_0x3dd139);}return _0x495c89[_0xaf1a('0x1a')](_0x3dd139)[_0xaf1a('0x1b')]();};}function respondWithResult(_0x18df0a,_0x432b96){_0x432b96=_0x432b96||0xc8;return function(_0x37500a){if(_0x37500a){return _0x18df0a[_0xaf1a('0x1a')](_0x432b96)['json'](_0x37500a);}};}function respondWithFilteredResult(_0x13fea8,_0x28475d){return function(_0x121fef){if(_0x121fef){var _0x347713=typeof _0x28475d[_0xaf1a('0x1c')]==='undefined'&&typeof _0x28475d[_0xaf1a('0x1d')]===_0xaf1a('0x1e');var _0x313ec6=_0x121fef[_0xaf1a('0x1f')];var _0x3cb751=_0x347713?0x0:_0x28475d[_0xaf1a('0x1c')];var _0x2a67d9=_0x347713?_0x121fef[_0xaf1a('0x1f')]:_0x28475d[_0xaf1a('0x1c')]+_0x28475d[_0xaf1a('0x1d')];var _0x177c50;if(_0x2a67d9>=_0x313ec6){_0x2a67d9=_0x313ec6;_0x177c50=0xc8;}else{_0x177c50=0xce;}_0x13fea8[_0xaf1a('0x1a')](_0x177c50);return _0x13fea8[_0xaf1a('0x20')]('Content-Range',_0x3cb751+'-'+_0x2a67d9+'/'+_0x313ec6)[_0xaf1a('0x21')](_0x121fef);}return null;};}function patchUpdates(_0x2dc5f7){return function(_0x3825e2){try{jsonpatch[_0xaf1a('0x22')](_0x3825e2,_0x2dc5f7,!![]);}catch(_0x3597c8){return BPromise['reject'](_0x3597c8);}return _0x3825e2['save']();};}function saveUpdates(_0x9237c3,_0x308375){return function(_0x301179){if(_0x301179){return _0x301179['update'](_0x9237c3)[_0xaf1a('0x23')](function(_0x346cbe){return _0x346cbe;});}return null;};}function removeEntity(_0x187488,_0x21fc2a){return function(_0x1608ae){if(_0x1608ae){return _0x1608ae[_0xaf1a('0x24')]()['then'](function(){_0x187488[_0xaf1a('0x1a')](0xcc)['end']();});}};}function handleEntityNotFound(_0x277e99,_0x587958){return function(_0x8a86c0){if(!_0x8a86c0){_0x277e99[_0xaf1a('0x19')](0x194);}return _0x8a86c0;};}function handleError(_0xaf73b,_0x5089b9){_0x5089b9=_0x5089b9||0x1f4;return function(_0x1a26d1){logger[_0xaf1a('0x25')](_0x1a26d1[_0xaf1a('0x26')]);if(_0x1a26d1[_0xaf1a('0x27')]){delete _0x1a26d1['name'];}_0xaf73b[_0xaf1a('0x1a')](_0x5089b9)[_0xaf1a('0x28')](_0x1a26d1);};}exports[_0xaf1a('0x29')]=function(_0x36c827,_0x22945f){var _0x15dd7f={},_0x304d97={},_0x544138={'count':0x0,'rows':[]};var _0x19784c=_[_0xaf1a('0x2a')](db['SmsQueueReport'][_0xaf1a('0x2b')],function(_0x597b6c){return{'name':_0x597b6c[_0xaf1a('0x2c')],'type':_0x597b6c[_0xaf1a('0x2d')][_0xaf1a('0x2e')]};});_0x304d97[_0xaf1a('0x2f')]=_['map'](_0x19784c,_0xaf1a('0x27'));_0x304d97[_0xaf1a('0x30')]=_[_0xaf1a('0x31')](_0x36c827['query']);_0x304d97[_0xaf1a('0x32')]=_[_0xaf1a('0x33')](_0x304d97[_0xaf1a('0x2f')],_0x304d97[_0xaf1a('0x30')]);_0x15dd7f[_0xaf1a('0x34')]=_[_0xaf1a('0x33')](_0x304d97[_0xaf1a('0x2f')],qs[_0xaf1a('0x35')](_0x36c827[_0xaf1a('0x30')][_0xaf1a('0x35')]));_0x15dd7f[_0xaf1a('0x34')]=_0x15dd7f[_0xaf1a('0x34')][_0xaf1a('0x36')]?_0x15dd7f['attributes']:_0x304d97[_0xaf1a('0x2f')];if(!_0x36c827[_0xaf1a('0x30')][_0xaf1a('0x37')]('nolimit')){_0x15dd7f[_0xaf1a('0x1d')]=qs[_0xaf1a('0x1d')](_0x36c827[_0xaf1a('0x30')][_0xaf1a('0x1d')]);_0x15dd7f['offset']=qs[_0xaf1a('0x1c')](_0x36c827['query'][_0xaf1a('0x1c')]);}_0x15dd7f[_0xaf1a('0x38')]=qs[_0xaf1a('0x39')](_0x36c827['query'][_0xaf1a('0x39')]);_0x15dd7f['where']=qs[_0xaf1a('0x32')](_[_0xaf1a('0x3a')](_0x36c827['query'],_0x304d97['filters']),_0x19784c);if(_0x36c827[_0xaf1a('0x30')][_0xaf1a('0x3b')]){_0x15dd7f['where']=_[_0xaf1a('0x3c')](_0x15dd7f[_0xaf1a('0x3d')],{'$or':_[_0xaf1a('0x2a')](_0x19784c,function(_0x443a1a){if(_0x443a1a[_0xaf1a('0x2d')]!==_0xaf1a('0x3e')){var _0x3e304a={};_0x3e304a[_0x443a1a[_0xaf1a('0x27')]]={'$like':'%'+_0x36c827[_0xaf1a('0x30')][_0xaf1a('0x3b')]+'%'};return _0x3e304a;}})});}_0x15dd7f=_[_0xaf1a('0x3c')]({},_0x15dd7f,_0x36c827[_0xaf1a('0x3f')]);var _0xa2bb95={'where':_0x15dd7f[_0xaf1a('0x3d')]};return db['SmsQueueReport']['count'](_0xa2bb95)[_0xaf1a('0x23')](function(_0x77585){_0x544138['count']=_0x77585;if(_0x36c827[_0xaf1a('0x30')][_0xaf1a('0x40')]){_0x15dd7f[_0xaf1a('0x41')]=[{'all':!![]}];}return db['SmsQueueReport'][_0xaf1a('0x42')](_0x15dd7f);})['then'](function(_0x432529){_0x544138[_0xaf1a('0x43')]=_0x432529;return _0x544138;})[_0xaf1a('0x23')](respondWithFilteredResult(_0x22945f,_0x15dd7f))[_0xaf1a('0x44')](handleError(_0x22945f,null));};exports[_0xaf1a('0x45')]=function(_0x5a4582,_0x2f7f40){var _0x5cc156={'raw':!![],'where':{'id':_0x5a4582['params']['id']}},_0x51ac7a={};_0x51ac7a[_0xaf1a('0x2f')]=_['keys'](db[_0xaf1a('0x46')][_0xaf1a('0x2b')]);_0x51ac7a[_0xaf1a('0x30')]=_[_0xaf1a('0x31')](_0x5a4582['query']);_0x51ac7a[_0xaf1a('0x32')]=_['intersection'](_0x51ac7a[_0xaf1a('0x2f')],_0x51ac7a[_0xaf1a('0x30')]);_0x5cc156[_0xaf1a('0x34')]=_[_0xaf1a('0x33')](_0x51ac7a[_0xaf1a('0x2f')],qs[_0xaf1a('0x35')](_0x5a4582[_0xaf1a('0x30')][_0xaf1a('0x35')]));_0x5cc156[_0xaf1a('0x34')]=_0x5cc156[_0xaf1a('0x34')][_0xaf1a('0x36')]?_0x5cc156[_0xaf1a('0x34')]:_0x51ac7a['model'];if(_0x5a4582[_0xaf1a('0x30')][_0xaf1a('0x40')]){_0x5cc156[_0xaf1a('0x41')]=[{'all':!![]}];}_0x5cc156=_[_0xaf1a('0x3c')]({},_0x5cc156,_0x5a4582['options']);return db[_0xaf1a('0x46')][_0xaf1a('0x47')](_0x5cc156)[_0xaf1a('0x23')](handleEntityNotFound(_0x2f7f40,null))[_0xaf1a('0x23')](respondWithResult(_0x2f7f40,null))[_0xaf1a('0x44')](handleError(_0x2f7f40,null));};exports[_0xaf1a('0x48')]=function(_0x4508ad,_0xd12548){return db[_0xaf1a('0x46')][_0xaf1a('0x48')](_0x4508ad[_0xaf1a('0x49')],{})['then'](respondWithResult(_0xd12548,0xc9))[_0xaf1a('0x44')](handleError(_0xd12548,null));};exports['update']=function(_0x5e0e79,_0x3c28c2){if(_0x5e0e79[_0xaf1a('0x49')]['id']){delete _0x5e0e79[_0xaf1a('0x49')]['id'];}return db[_0xaf1a('0x46')][_0xaf1a('0x47')]({'where':{'id':_0x5e0e79[_0xaf1a('0x4a')]['id']}})[_0xaf1a('0x23')](handleEntityNotFound(_0x3c28c2,null))[_0xaf1a('0x23')](saveUpdates(_0x5e0e79[_0xaf1a('0x49')],null))[_0xaf1a('0x23')](respondWithResult(_0x3c28c2,null))[_0xaf1a('0x44')](handleError(_0x3c28c2,null));};exports[_0xaf1a('0x24')]=function(_0x3e0fa0,_0x280afc){return db[_0xaf1a('0x46')][_0xaf1a('0x47')]({'where':{'id':_0x3e0fa0[_0xaf1a('0x4a')]['id']}})[_0xaf1a('0x23')](handleEntityNotFound(_0x280afc,null))[_0xaf1a('0x23')](removeEntity(_0x280afc,null))[_0xaf1a('0x44')](handleError(_0x280afc,null));};exports[_0xaf1a('0x4b')]=function(_0x335815,_0x20ba63){return db[_0xaf1a('0x46')]['describe']()['then'](respondWithResult(_0x20ba63,null))[_0xaf1a('0x44')](handleError(_0x20ba63,null));}; \ No newline at end of file diff --git a/server/api/smsQueueReport/smsQueueReport.model.js b/server/api/smsQueueReport/smsQueueReport.model.js index 05288b4..84f2e16 100644 --- a/server/api/smsQueueReport/smsQueueReport.model.js +++ b/server/api/smsQueueReport/smsQueueReport.model.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0xd8b0=['define','report_sms_queue','uniqueid','lodash','util','bluebird','request-promise','path','rimraf','../../config/environment'];(function(_0x8c2304,_0x47461a){var _0x3ed870=function(_0x1c9fad){while(--_0x1c9fad){_0x8c2304['push'](_0x8c2304['shift']());}};_0x3ed870(++_0x47461a);}(_0xd8b0,0xad));var _0x0d8b=function(_0x20a584,_0xe384a5){_0x20a584=_0x20a584-0x0;var _0x4b41a8=_0xd8b0[_0x20a584];return _0x4b41a8;};'use strict';var _=require(_0x0d8b('0x0'));var util=require(_0x0d8b('0x1'));var logger=require('../../config/logger')('api');var moment=require('moment');var BPromise=require(_0x0d8b('0x2'));var rp=require(_0x0d8b('0x3'));var fs=require('fs');var path=require(_0x0d8b('0x4'));var rimraf=require(_0x0d8b('0x5'));var config=require(_0x0d8b('0x6'));var attributes=require('./smsQueueReport.attributes');module['exports']=function(_0x3f8b6f,_0x227c63){return _0x3f8b6f[_0x0d8b('0x7')]('SmsQueueReport',attributes,{'tableName':_0x0d8b('0x8'),'paranoid':![],'indexes':[{'name':_0x0d8b('0x9'),'fields':['uniqueid']}],'timestamps':!![]});}; \ No newline at end of file +var _0xbaf0=['define','SmsQueueReport','report_sms_queue','uniqueid','util','../../config/logger','api','moment','bluebird','request-promise','rimraf','../../config/environment','./smsQueueReport.attributes','exports'];(function(_0x3d98db,_0x1eeab0){var _0x3bdbf5=function(_0x1bc819){while(--_0x1bc819){_0x3d98db['push'](_0x3d98db['shift']());}};_0x3bdbf5(++_0x1eeab0);}(_0xbaf0,0x12a));var _0x0baf=function(_0x465028,_0x4570ac){_0x465028=_0x465028-0x0;var _0xb783d4=_0xbaf0[_0x465028];return _0xb783d4;};'use strict';var _=require('lodash');var util=require(_0x0baf('0x0'));var logger=require(_0x0baf('0x1'))(_0x0baf('0x2'));var moment=require(_0x0baf('0x3'));var BPromise=require(_0x0baf('0x4'));var rp=require(_0x0baf('0x5'));var fs=require('fs');var path=require('path');var rimraf=require(_0x0baf('0x6'));var config=require(_0x0baf('0x7'));var attributes=require(_0x0baf('0x8'));module[_0x0baf('0x9')]=function(_0xe4c3c4,_0x335e24){return _0xe4c3c4[_0x0baf('0xa')](_0x0baf('0xb'),attributes,{'tableName':_0x0baf('0xc'),'paranoid':![],'indexes':[{'name':'uniqueid','fields':[_0x0baf('0xd')]}],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/smsQueueReport/smsQueueReport.rpc.js b/server/api/smsQueueReport/smsQueueReport.rpc.js index ecbfe81..91e002e 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 _0x3051=['body','where','attributes','limit','then','lodash','util','moment','bluebird','randomstring','ioredis','../../config/utils','../../config/logger','../../config/environment','jayson/promise','client','http','request','SmsQueueReport,\x20%s,\x20%s','request\x20sent','debug','SmsQueueReport,\x20%s,\x20%s,\x20%s','stringify','error','code','message','info','result','catch','CreateSmsQueueReport','SmsQueueReport','create','options','raw','UpdateSmsQueueReport'];(function(_0x45a5a3,_0x4bbd82){var _0x5ba07c=function(_0xaedf7f){while(--_0xaedf7f){_0x45a5a3['push'](_0x45a5a3['shift']());}};_0x5ba07c(++_0x4bbd82);}(_0x3051,0xfa));var _0x1305=function(_0x20a584,_0xe384a5){_0x20a584=_0x20a584-0x0;var _0x4b41a8=_0x3051[_0x20a584];return _0x4b41a8;};'use strict';var _=require(_0x1305('0x0'));var util=require(_0x1305('0x1'));var moment=require(_0x1305('0x2'));var BPromise=require(_0x1305('0x3'));var rs=require(_0x1305('0x4'));var fs=require('fs');var Redis=require(_0x1305('0x5'));var db=require('../../mysqldb')['db'];var utils=require(_0x1305('0x6'));var logger=require(_0x1305('0x7'))('rpc');var config=require(_0x1305('0x8'));var jayson=require(_0x1305('0x9'));var client=jayson[_0x1305('0xa')][_0x1305('0xb')]({'port':0x232a});function respondWithRpcPromise(_0x2a76f2,_0x33968e,_0x1d1d00){return new BPromise(function(_0x2546ff,_0x28a7f5){return client[_0x1305('0xc')](_0x2a76f2,_0x1d1d00)['then'](function(_0x1332fc){logger['info'](_0x1305('0xd'),_0x33968e,_0x1305('0xe'));logger[_0x1305('0xf')](_0x1305('0x10'),_0x33968e,_0x1305('0xe'),JSON[_0x1305('0x11')](_0x1332fc));if(_0x1332fc[_0x1305('0x12')]){if(_0x1332fc[_0x1305('0x12')][_0x1305('0x13')]===0x1f4){logger['error'](_0x1305('0xd'),_0x33968e,_0x1332fc[_0x1305('0x12')][_0x1305('0x14')]);return _0x28a7f5(_0x1332fc[_0x1305('0x12')]['message']);}logger['error'](_0x1305('0xd'),_0x33968e,_0x1332fc[_0x1305('0x12')][_0x1305('0x14')]);return _0x2546ff(_0x1332fc['error'][_0x1305('0x14')]);}else{logger[_0x1305('0x15')](_0x1305('0xd'),_0x33968e,_0x1305('0xe'));_0x2546ff(_0x1332fc[_0x1305('0x16')][_0x1305('0x14')]);}})[_0x1305('0x17')](function(_0x5d3c00){logger['error']('SmsQueueReport,\x20%s,\x20%s',_0x33968e,_0x5d3c00);_0x28a7f5(_0x5d3c00);});});}exports[_0x1305('0x18')]=function(_0x2211cc){var _0x585e81=this;return new Promise(function(_0x3d0c45,_0x3eef30){return db[_0x1305('0x19')][_0x1305('0x1a')](_0x2211cc['body'],{'raw':_0x2211cc['options']?_0x2211cc[_0x1305('0x1b')][_0x1305('0x1c')]===undefined?!![]:![]:!![]})['then'](function(_0x9f8e8){logger['info'](_0x1305('0x18'),_0x2211cc);logger[_0x1305('0xf')]('CreateSmsQueueReport',_0x2211cc,JSON[_0x1305('0x11')](_0x9f8e8));_0x3d0c45(_0x9f8e8);})[_0x1305('0x17')](function(_0x10175f){logger[_0x1305('0x12')](_0x1305('0x18'),_0x10175f[_0x1305('0x14')],_0x2211cc);_0x3eef30(_0x585e81[_0x1305('0x12')](0x1f4,_0x10175f[_0x1305('0x14')]));});});};exports[_0x1305('0x1d')]=function(_0x2cc801){var _0x4fc3c7=this;return new Promise(function(_0x3738c7,_0x45bfb2){return db[_0x1305('0x19')]['update'](_0x2cc801[_0x1305('0x1e')],{'raw':_0x2cc801['options']?_0x2cc801['options'][_0x1305('0x1c')]===undefined?!![]:![]:!![],'individualHooks':!![],'where':_0x2cc801[_0x1305('0x1b')]?_0x2cc801[_0x1305('0x1b')][_0x1305('0x1f')]||null:null,'attributes':_0x2cc801['options']?_0x2cc801[_0x1305('0x1b')][_0x1305('0x20')]||null:null,'limit':_0x2cc801[_0x1305('0x1b')]?_0x2cc801[_0x1305('0x1b')][_0x1305('0x21')]||null:null})[_0x1305('0x22')](function(_0x5ed998){logger[_0x1305('0x15')](_0x1305('0x1d'),_0x2cc801);logger[_0x1305('0xf')]('UpdateSmsQueueReport',_0x2cc801,JSON[_0x1305('0x11')](_0x5ed998));_0x3738c7(_0x5ed998);})[_0x1305('0x17')](function(_0x31f4b0){logger[_0x1305('0x12')](_0x1305('0x1d'),_0x31f4b0[_0x1305('0x14')],_0x2cc801);_0x45bfb2(_0x4fc3c7['error'](0x1f4,_0x31f4b0[_0x1305('0x14')]));});});}; \ No newline at end of file +var _0x3596=['bluebird','randomstring','ioredis','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','client','http','request','then','info','SmsQueueReport,\x20%s,\x20%s','request\x20sent','debug','SmsQueueReport,\x20%s,\x20%s,\x20%s','stringify','error','code','message','result','catch','CreateSmsQueueReport','create','body','options','raw','UpdateSmsQueueReport','SmsQueueReport','update','where','attributes','lodash','util','moment'];(function(_0x375a41,_0x317c9c){var _0x4b3702=function(_0x468c7c){while(--_0x468c7c){_0x375a41['push'](_0x375a41['shift']());}};_0x4b3702(++_0x317c9c);}(_0x3596,0xf9));var _0x6359=function(_0x2b4411,_0x2625ed){_0x2b4411=_0x2b4411-0x0;var _0x8e41ef=_0x3596[_0x2b4411];return _0x8e41ef;};'use strict';var _=require(_0x6359('0x0'));var util=require(_0x6359('0x1'));var moment=require(_0x6359('0x2'));var BPromise=require(_0x6359('0x3'));var rs=require(_0x6359('0x4'));var fs=require('fs');var Redis=require(_0x6359('0x5'));var db=require('../../mysqldb')['db'];var utils=require(_0x6359('0x6'));var logger=require(_0x6359('0x7'))(_0x6359('0x8'));var config=require(_0x6359('0x9'));var jayson=require(_0x6359('0xa'));var client=jayson[_0x6359('0xb')][_0x6359('0xc')]({'port':0x232a});function respondWithRpcPromise(_0x47e517,_0x88972c,_0x3d01b9){return new BPromise(function(_0x59eaca,_0x59d423){return client[_0x6359('0xd')](_0x47e517,_0x3d01b9)[_0x6359('0xe')](function(_0x1b9e1a){logger[_0x6359('0xf')](_0x6359('0x10'),_0x88972c,_0x6359('0x11'));logger[_0x6359('0x12')](_0x6359('0x13'),_0x88972c,_0x6359('0x11'),JSON[_0x6359('0x14')](_0x1b9e1a));if(_0x1b9e1a[_0x6359('0x15')]){if(_0x1b9e1a[_0x6359('0x15')][_0x6359('0x16')]===0x1f4){logger[_0x6359('0x15')]('SmsQueueReport,\x20%s,\x20%s',_0x88972c,_0x1b9e1a[_0x6359('0x15')][_0x6359('0x17')]);return _0x59d423(_0x1b9e1a[_0x6359('0x15')][_0x6359('0x17')]);}logger[_0x6359('0x15')](_0x6359('0x10'),_0x88972c,_0x1b9e1a[_0x6359('0x15')][_0x6359('0x17')]);return _0x59eaca(_0x1b9e1a['error'][_0x6359('0x17')]);}else{logger[_0x6359('0xf')](_0x6359('0x10'),_0x88972c,'request\x20sent');_0x59eaca(_0x1b9e1a[_0x6359('0x18')][_0x6359('0x17')]);}})[_0x6359('0x19')](function(_0x2a3dc4){logger[_0x6359('0x15')](_0x6359('0x10'),_0x88972c,_0x2a3dc4);_0x59d423(_0x2a3dc4);});});}exports[_0x6359('0x1a')]=function(_0x51c525){var _0x3826a2=this;return new Promise(function(_0x100a82,_0x37381e){return db['SmsQueueReport'][_0x6359('0x1b')](_0x51c525[_0x6359('0x1c')],{'raw':_0x51c525[_0x6359('0x1d')]?_0x51c525['options'][_0x6359('0x1e')]===undefined?!![]:![]:!![]})[_0x6359('0xe')](function(_0x845b8b){logger['info'](_0x6359('0x1a'),_0x51c525);logger['debug'](_0x6359('0x1a'),_0x51c525,JSON[_0x6359('0x14')](_0x845b8b));_0x100a82(_0x845b8b);})[_0x6359('0x19')](function(_0x4d1839){logger['error'](_0x6359('0x1a'),_0x4d1839[_0x6359('0x17')],_0x51c525);_0x37381e(_0x3826a2[_0x6359('0x15')](0x1f4,_0x4d1839[_0x6359('0x17')]));});});};exports[_0x6359('0x1f')]=function(_0x2d0f24){var _0x4f03ff=this;return new Promise(function(_0x4ec883,_0x683da5){return db[_0x6359('0x20')][_0x6359('0x21')](_0x2d0f24[_0x6359('0x1c')],{'raw':_0x2d0f24[_0x6359('0x1d')]?_0x2d0f24[_0x6359('0x1d')][_0x6359('0x1e')]===undefined?!![]:![]:!![],'individualHooks':!![],'where':_0x2d0f24[_0x6359('0x1d')]?_0x2d0f24[_0x6359('0x1d')][_0x6359('0x22')]||null:null,'attributes':_0x2d0f24[_0x6359('0x1d')]?_0x2d0f24[_0x6359('0x1d')][_0x6359('0x23')]||null:null,'limit':_0x2d0f24[_0x6359('0x1d')]?_0x2d0f24[_0x6359('0x1d')]['limit']||null:null})[_0x6359('0xe')](function(_0x280b33){logger['info'](_0x6359('0x1f'),_0x2d0f24);logger['debug'](_0x6359('0x1f'),_0x2d0f24,JSON[_0x6359('0x14')](_0x280b33));_0x4ec883(_0x280b33);})[_0x6359('0x19')](function(_0x3d37e8){logger[_0x6359('0x15')](_0x6359('0x1f'),_0x3d37e8[_0x6359('0x17')],_0x2d0f24);_0x683da5(_0x4f03ff['error'](0x1f4,_0x3d37e8['message']));});});}; \ No newline at end of file diff --git a/server/api/smsTransferReport/index.js b/server/api/smsTransferReport/index.js index ad142f8..7dd57f0 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 _0xf987=['../../components/interaction/service','../../config/environment','./smsTransferReport.controller','get','isAuthenticated','index','/describe','/:id','show','post','create','update','delete','destroy','path','connect-timeout','Router','fs-extra','../../components/auth/service'];(function(_0xc8f833,_0x361dae){var _0x9199eb=function(_0x2b1cc0){while(--_0x2b1cc0){_0xc8f833['push'](_0xc8f833['shift']());}};_0x9199eb(++_0x361dae);}(_0xf987,0x18a));var _0x7f98=function(_0x165b6b,_0x4a0dbb){_0x165b6b=_0x165b6b-0x0;var _0x1bc5e5=_0xf987[_0x165b6b];return _0x1bc5e5;};'use strict';var multer=require('multer');var util=require('util');var path=require(_0x7f98('0x0'));var timeout=require(_0x7f98('0x1'));var express=require('express');var router=express[_0x7f98('0x2')]();var fs_extra=require(_0x7f98('0x3'));var auth=require(_0x7f98('0x4'));var interaction=require(_0x7f98('0x5'));var config=require(_0x7f98('0x6'));var controller=require(_0x7f98('0x7'));router[_0x7f98('0x8')]('/',auth[_0x7f98('0x9')](),controller[_0x7f98('0xa')]);router[_0x7f98('0x8')](_0x7f98('0xb'),auth[_0x7f98('0x9')](),controller['describe']);router[_0x7f98('0x8')](_0x7f98('0xc'),auth[_0x7f98('0x9')](),controller[_0x7f98('0xd')]);router[_0x7f98('0xe')]('/',auth['isAuthenticated'](),controller[_0x7f98('0xf')]);router['put']('/:id',auth[_0x7f98('0x9')](),controller[_0x7f98('0x10')]);router[_0x7f98('0x11')](_0x7f98('0xc'),auth['isAuthenticated'](),controller[_0x7f98('0x12')]);module['exports']=router; \ No newline at end of file +var _0xa1f6=['util','path','connect-timeout','express','Router','get','isAuthenticated','index','/describe','describe','/:id','show','post','put','update','destroy','exports','multer'];(function(_0x449717,_0xa0ee6b){var _0x49234d=function(_0x2225b8){while(--_0x2225b8){_0x449717['push'](_0x449717['shift']());}};_0x49234d(++_0xa0ee6b);}(_0xa1f6,0x19d));var _0x6a1f=function(_0x599f41,_0x4db732){_0x599f41=_0x599f41-0x0;var _0x2e4d58=_0xa1f6[_0x599f41];return _0x2e4d58;};'use strict';var multer=require(_0x6a1f('0x0'));var util=require(_0x6a1f('0x1'));var path=require(_0x6a1f('0x2'));var timeout=require(_0x6a1f('0x3'));var express=require(_0x6a1f('0x4'));var router=express[_0x6a1f('0x5')]();var fs_extra=require('fs-extra');var auth=require('../../components/auth/service');var interaction=require('../../components/interaction/service');var config=require('../../config/environment');var controller=require('./smsTransferReport.controller');router[_0x6a1f('0x6')]('/',auth[_0x6a1f('0x7')](),controller[_0x6a1f('0x8')]);router[_0x6a1f('0x6')](_0x6a1f('0x9'),auth[_0x6a1f('0x7')](),controller[_0x6a1f('0xa')]);router['get'](_0x6a1f('0xb'),auth[_0x6a1f('0x7')](),controller[_0x6a1f('0xc')]);router[_0x6a1f('0xd')]('/',auth[_0x6a1f('0x7')](),controller['create']);router[_0x6a1f('0xe')](_0x6a1f('0xb'),auth[_0x6a1f('0x7')](),controller[_0x6a1f('0xf')]);router['delete'](_0x6a1f('0xb'),auth['isAuthenticated'](),controller[_0x6a1f('0x10')]);module[_0x6a1f('0x11')]=router; \ No newline at end of file diff --git a/server/api/smsTransferReport/smsTransferReport.attributes.js b/server/api/smsTransferReport/smsTransferReport.attributes.js index 3007e0b..7004d2c 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 _0x54ef=['agent','queue','DATE','NOW','moment','sequelize','exports','ENUM','account'];(function(_0x280bb5,_0x4a1aff){var _0x2b760c=function(_0x53b65a){while(--_0x53b65a){_0x280bb5['push'](_0x280bb5['shift']());}};_0x2b760c(++_0x4a1aff);}(_0x54ef,0x112));var _0xf54e=function(_0x141e52,_0x486dda){_0x141e52=_0x141e52-0x0;var _0x35a6cc=_0x54ef[_0x141e52];return _0x35a6cc;};'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 _0x34e8=['queue','DATE','NOW','moment','sequelize','exports','STRING','account','agent'];(function(_0x472378,_0x327f94){var _0x4c1e48=function(_0x300b1c){while(--_0x300b1c){_0x472378['push'](_0x472378['shift']());}};_0x4c1e48(++_0x327f94);}(_0x34e8,0x12c));var _0x834e=function(_0x2ee1d0,_0x1e1aec){_0x2ee1d0=_0x2ee1d0-0x0;var _0x2c665b=_0x34e8[_0x2ee1d0];return _0x2c665b;};'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/smsTransferReport/smsTransferReport.controller.js b/server/api/smsTransferReport/smsTransferReport.controller.js index 757d834..44c7936 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 _0x311f=['type','model','keys','filters','intersection','attributes','fields','length','query','order','sort','where','pick','filter','merge','VIRTUAL','options','includeAll','include','findAll','show','params','find','catch','create','body','describe','eml-format','zip-dir','fast-json-patch','request-promise','moment','bluebird','mustache','util','path','to-csv','fs-extra','lodash','squel','crypto','jsforce','desk.js','papaparse','ioredis','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/logger','api','../../config/utils','../../config/environment','../../mysqldb','sendStatus','status','end','limit','undefined','count','offset','set','Content-Range','apply','save','update','then','destroy','name','send','index','map','SmsTransferReport','rawAttributes','fieldName'];(function(_0x577bd7,_0x216ffa){var _0x5508b8=function(_0x2d1e34){while(--_0x2d1e34){_0x577bd7['push'](_0x577bd7['shift']());}};_0x5508b8(++_0x216ffa);}(_0x311f,0x188));var _0xf311=function(_0x4672d7,_0x378500){_0x4672d7=_0x4672d7-0x0;var _0x5cefb3=_0x311f[_0x4672d7];return _0x5cefb3;};'use strict';var emlformat=require(_0xf311('0x0'));var rimraf=require('rimraf');var zipdir=require(_0xf311('0x1'));var jsonpatch=require(_0xf311('0x2'));var rp=require(_0xf311('0x3'));var moment=require(_0xf311('0x4'));var BPromise=require(_0xf311('0x5'));var Mustache=require(_0xf311('0x6'));var util=require(_0xf311('0x7'));var path=require(_0xf311('0x8'));var sox=require('sox');var csv=require(_0xf311('0x9'));var ejs=require('ejs');var fs=require('fs');var fs_extra=require(_0xf311('0xa'));var _=require(_0xf311('0xb'));var squel=require(_0xf311('0xc'));var crypto=require(_0xf311('0xd'));var jsforce=require(_0xf311('0xe'));var deskjs=require(_0xf311('0xf'));var toCsv=require(_0xf311('0x9'));var querystring=require('querystring');var Papa=require(_0xf311('0x10'));var Redis=require(_0xf311('0x11'));var authService=require('../../components/auth/service');var qs=require(_0xf311('0x12'));var as=require(_0xf311('0x13'));var hardwareService=require('../../config/license/hardware');var logger=require(_0xf311('0x14'))(_0xf311('0x15'));var utils=require(_0xf311('0x16'));var config=require(_0xf311('0x17'));var licenseUtil=require('../../config/license/util');var db=require(_0xf311('0x18'))['db'];function respondWithStatusCode(_0x26dfca,_0x25249c){_0x25249c=_0x25249c||0xcc;return function(_0x434b36){if(_0x434b36){return _0x26dfca[_0xf311('0x19')](_0x25249c);}return _0x26dfca[_0xf311('0x1a')](_0x25249c)[_0xf311('0x1b')]();};}function respondWithResult(_0x28b75c,_0xa309d1){_0xa309d1=_0xa309d1||0xc8;return function(_0x4df120){if(_0x4df120){return _0x28b75c[_0xf311('0x1a')](_0xa309d1)['json'](_0x4df120);}};}function respondWithFilteredResult(_0x18955e,_0xc5caf5){return function(_0x1a4efb){if(_0x1a4efb){var _0x50ab4d=typeof _0xc5caf5['offset']==='undefined'&&typeof _0xc5caf5[_0xf311('0x1c')]===_0xf311('0x1d');var _0x41de5f=_0x1a4efb[_0xf311('0x1e')];var _0x3d10ff=_0x50ab4d?0x0:_0xc5caf5['offset'];var _0x438fb7=_0x50ab4d?_0x1a4efb[_0xf311('0x1e')]:_0xc5caf5[_0xf311('0x1f')]+_0xc5caf5['limit'];var _0xa00101;if(_0x438fb7>=_0x41de5f){_0x438fb7=_0x41de5f;_0xa00101=0xc8;}else{_0xa00101=0xce;}_0x18955e[_0xf311('0x1a')](_0xa00101);return _0x18955e[_0xf311('0x20')](_0xf311('0x21'),_0x3d10ff+'-'+_0x438fb7+'/'+_0x41de5f)['json'](_0x1a4efb);}return null;};}function patchUpdates(_0x4c0c64){return function(_0x493a60){try{jsonpatch[_0xf311('0x22')](_0x493a60,_0x4c0c64,!![]);}catch(_0x5e6472){return BPromise['reject'](_0x5e6472);}return _0x493a60[_0xf311('0x23')]();};}function saveUpdates(_0xe122f,_0x455738){return function(_0x11e105){if(_0x11e105){return _0x11e105[_0xf311('0x24')](_0xe122f)[_0xf311('0x25')](function(_0x2d6198){return _0x2d6198;});}return null;};}function removeEntity(_0x48f58a,_0x3f5bbe){return function(_0x336974){if(_0x336974){return _0x336974[_0xf311('0x26')]()[_0xf311('0x25')](function(){_0x48f58a['status'](0xcc)[_0xf311('0x1b')]();});}};}function handleEntityNotFound(_0x578b8c,_0x50d885){return function(_0x422780){if(!_0x422780){_0x578b8c[_0xf311('0x19')](0x194);}return _0x422780;};}function handleError(_0x366a99,_0x5f4807){_0x5f4807=_0x5f4807||0x1f4;return function(_0x59cfe4){logger['error'](_0x59cfe4['stack']);if(_0x59cfe4['name']){delete _0x59cfe4[_0xf311('0x27')];}_0x366a99[_0xf311('0x1a')](_0x5f4807)[_0xf311('0x28')](_0x59cfe4);};}exports[_0xf311('0x29')]=function(_0x55db90,_0x232346){var _0x116090={},_0x32c781={},_0x109df8={'count':0x0,'rows':[]};var _0x49a424=_[_0xf311('0x2a')](db[_0xf311('0x2b')][_0xf311('0x2c')],function(_0x428984){return{'name':_0x428984[_0xf311('0x2d')],'type':_0x428984[_0xf311('0x2e')]['key']};});_0x32c781[_0xf311('0x2f')]=_['map'](_0x49a424,'name');_0x32c781['query']=_[_0xf311('0x30')](_0x55db90['query']);_0x32c781[_0xf311('0x31')]=_[_0xf311('0x32')](_0x32c781['model'],_0x32c781['query']);_0x116090[_0xf311('0x33')]=_['intersection'](_0x32c781[_0xf311('0x2f')],qs[_0xf311('0x34')](_0x55db90['query'][_0xf311('0x34')]));_0x116090[_0xf311('0x33')]=_0x116090[_0xf311('0x33')][_0xf311('0x35')]?_0x116090[_0xf311('0x33')]:_0x32c781[_0xf311('0x2f')];if(!_0x55db90['query']['hasOwnProperty']('nolimit')){_0x116090['limit']=qs['limit'](_0x55db90[_0xf311('0x36')][_0xf311('0x1c')]);_0x116090[_0xf311('0x1f')]=qs[_0xf311('0x1f')](_0x55db90[_0xf311('0x36')][_0xf311('0x1f')]);}_0x116090[_0xf311('0x37')]=qs[_0xf311('0x38')](_0x55db90['query'][_0xf311('0x38')]);_0x116090[_0xf311('0x39')]=qs[_0xf311('0x31')](_[_0xf311('0x3a')](_0x55db90[_0xf311('0x36')],_0x32c781[_0xf311('0x31')]),_0x49a424);if(_0x55db90[_0xf311('0x36')][_0xf311('0x3b')]){_0x116090[_0xf311('0x39')]=_[_0xf311('0x3c')](_0x116090['where'],{'$or':_[_0xf311('0x2a')](_0x49a424,function(_0x588b98){if(_0x588b98[_0xf311('0x2e')]!==_0xf311('0x3d')){var _0xc8b775={};_0xc8b775[_0x588b98[_0xf311('0x27')]]={'$like':'%'+_0x55db90[_0xf311('0x36')][_0xf311('0x3b')]+'%'};return _0xc8b775;}})});}_0x116090=_['merge']({},_0x116090,_0x55db90[_0xf311('0x3e')]);var _0x3fd515={'where':_0x116090['where']};return db[_0xf311('0x2b')][_0xf311('0x1e')](_0x3fd515)[_0xf311('0x25')](function(_0x228182){_0x109df8[_0xf311('0x1e')]=_0x228182;if(_0x55db90[_0xf311('0x36')][_0xf311('0x3f')]){_0x116090[_0xf311('0x40')]=[{'all':!![]}];}return db['SmsTransferReport'][_0xf311('0x41')](_0x116090);})[_0xf311('0x25')](function(_0x5a8e03){_0x109df8['rows']=_0x5a8e03;return _0x109df8;})['then'](respondWithFilteredResult(_0x232346,_0x116090))['catch'](handleError(_0x232346,null));};exports[_0xf311('0x42')]=function(_0x13e9b9,_0xabbb8e){var _0x3eb7da={'raw':!![],'where':{'id':_0x13e9b9[_0xf311('0x43')]['id']}},_0x122d30={};_0x122d30['model']=_[_0xf311('0x30')](db[_0xf311('0x2b')][_0xf311('0x2c')]);_0x122d30[_0xf311('0x36')]=_[_0xf311('0x30')](_0x13e9b9['query']);_0x122d30[_0xf311('0x31')]=_['intersection'](_0x122d30[_0xf311('0x2f')],_0x122d30['query']);_0x3eb7da[_0xf311('0x33')]=_[_0xf311('0x32')](_0x122d30['model'],qs['fields'](_0x13e9b9[_0xf311('0x36')][_0xf311('0x34')]));_0x3eb7da['attributes']=_0x3eb7da[_0xf311('0x33')][_0xf311('0x35')]?_0x3eb7da['attributes']:_0x122d30[_0xf311('0x2f')];if(_0x13e9b9[_0xf311('0x36')][_0xf311('0x3f')]){_0x3eb7da[_0xf311('0x40')]=[{'all':!![]}];}_0x3eb7da=_['merge']({},_0x3eb7da,_0x13e9b9[_0xf311('0x3e')]);return db[_0xf311('0x2b')][_0xf311('0x44')](_0x3eb7da)[_0xf311('0x25')](handleEntityNotFound(_0xabbb8e,null))['then'](respondWithResult(_0xabbb8e,null))[_0xf311('0x45')](handleError(_0xabbb8e,null));};exports['create']=function(_0x5b017a,_0x259305){return db['SmsTransferReport'][_0xf311('0x46')](_0x5b017a['body'],{})[_0xf311('0x25')](respondWithResult(_0x259305,0xc9))['catch'](handleError(_0x259305,null));};exports[_0xf311('0x24')]=function(_0x28a909,_0x14b1bd){if(_0x28a909[_0xf311('0x47')]['id']){delete _0x28a909[_0xf311('0x47')]['id'];}return db['SmsTransferReport'][_0xf311('0x44')]({'where':{'id':_0x28a909[_0xf311('0x43')]['id']}})[_0xf311('0x25')](handleEntityNotFound(_0x14b1bd,null))[_0xf311('0x25')](saveUpdates(_0x28a909[_0xf311('0x47')],null))[_0xf311('0x25')](respondWithResult(_0x14b1bd,null))[_0xf311('0x45')](handleError(_0x14b1bd,null));};exports[_0xf311('0x26')]=function(_0x5b1892,_0x1ebe3f){return db[_0xf311('0x2b')]['find']({'where':{'id':_0x5b1892['params']['id']}})[_0xf311('0x25')](handleEntityNotFound(_0x1ebe3f,null))['then'](removeEntity(_0x1ebe3f,null))[_0xf311('0x45')](handleError(_0x1ebe3f,null));};exports[_0xf311('0x48')]=function(_0x1aead5,_0x41bdc4){return db[_0xf311('0x2b')][_0xf311('0x48')]()[_0xf311('0x25')](respondWithResult(_0x41bdc4,null))[_0xf311('0x45')](handleError(_0x41bdc4,null));}; \ No newline at end of file +var _0x8073=['../../mysqldb','sendStatus','end','status','json','offset','undefined','count','limit','set','Content-Range','apply','save','update','then','error','stack','name','send','map','rawAttributes','fieldName','key','query','keys','filters','intersection','model','attributes','fields','length','hasOwnProperty','nolimit','order','sort','where','filter','merge','type','VIRTUAL','options','SmsTransferReport','include','findAll','rows','catch','params','includeAll','create','body','find','destroy','describe','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','moment','bluebird','mustache','util','path','sox','to-csv','ejs','fs-extra','lodash','squel','crypto','jsforce','desk.js','querystring','papaparse','../../components/parsers/qs','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/environment','../../config/license/util'];(function(_0x4f642c,_0x260f66){var _0x581cf4=function(_0x36a5b0){while(--_0x36a5b0){_0x4f642c['push'](_0x4f642c['shift']());}};_0x581cf4(++_0x260f66);}(_0x8073,0x86));var _0x3807=function(_0x465a0c,_0x19d4d5){_0x465a0c=_0x465a0c-0x0;var _0x1e202e=_0x8073[_0x465a0c];return _0x1e202e;};'use strict';var emlformat=require(_0x3807('0x0'));var rimraf=require(_0x3807('0x1'));var zipdir=require(_0x3807('0x2'));var jsonpatch=require(_0x3807('0x3'));var rp=require(_0x3807('0x4'));var moment=require(_0x3807('0x5'));var BPromise=require(_0x3807('0x6'));var Mustache=require(_0x3807('0x7'));var util=require(_0x3807('0x8'));var path=require(_0x3807('0x9'));var sox=require(_0x3807('0xa'));var csv=require(_0x3807('0xb'));var ejs=require(_0x3807('0xc'));var fs=require('fs');var fs_extra=require(_0x3807('0xd'));var _=require(_0x3807('0xe'));var squel=require(_0x3807('0xf'));var crypto=require(_0x3807('0x10'));var jsforce=require(_0x3807('0x11'));var deskjs=require(_0x3807('0x12'));var toCsv=require(_0x3807('0xb'));var querystring=require(_0x3807('0x13'));var Papa=require(_0x3807('0x14'));var Redis=require('ioredis');var authService=require('../../components/auth/service');var qs=require(_0x3807('0x15'));var as=require('../../components/parsers/advancedSearch');var hardwareService=require(_0x3807('0x16'));var logger=require(_0x3807('0x17'))(_0x3807('0x18'));var utils=require(_0x3807('0x19'));var config=require(_0x3807('0x1a'));var licenseUtil=require(_0x3807('0x1b'));var db=require(_0x3807('0x1c'))['db'];function respondWithStatusCode(_0xd15793,_0x1d77ab){_0x1d77ab=_0x1d77ab||0xcc;return function(_0x621b95){if(_0x621b95){return _0xd15793[_0x3807('0x1d')](_0x1d77ab);}return _0xd15793['status'](_0x1d77ab)[_0x3807('0x1e')]();};}function respondWithResult(_0x353b58,_0x2c153b){_0x2c153b=_0x2c153b||0xc8;return function(_0x459293){if(_0x459293){return _0x353b58[_0x3807('0x1f')](_0x2c153b)[_0x3807('0x20')](_0x459293);}};}function respondWithFilteredResult(_0x399337,_0x301965){return function(_0x32b1fc){if(_0x32b1fc){var _0x525f32=typeof _0x301965[_0x3807('0x21')]===_0x3807('0x22')&&typeof _0x301965['limit']===_0x3807('0x22');var _0x69834d=_0x32b1fc[_0x3807('0x23')];var _0x3e90c4=_0x525f32?0x0:_0x301965['offset'];var _0x10e317=_0x525f32?_0x32b1fc[_0x3807('0x23')]:_0x301965[_0x3807('0x21')]+_0x301965[_0x3807('0x24')];var _0x4570af;if(_0x10e317>=_0x69834d){_0x10e317=_0x69834d;_0x4570af=0xc8;}else{_0x4570af=0xce;}_0x399337['status'](_0x4570af);return _0x399337[_0x3807('0x25')](_0x3807('0x26'),_0x3e90c4+'-'+_0x10e317+'/'+_0x69834d)['json'](_0x32b1fc);}return null;};}function patchUpdates(_0x594e01){return function(_0x496edb){try{jsonpatch[_0x3807('0x27')](_0x496edb,_0x594e01,!![]);}catch(_0x54c3d7){return BPromise['reject'](_0x54c3d7);}return _0x496edb[_0x3807('0x28')]();};}function saveUpdates(_0x111f3b,_0x2ca94b){return function(_0xa469b4){if(_0xa469b4){return _0xa469b4[_0x3807('0x29')](_0x111f3b)[_0x3807('0x2a')](function(_0x3d9d53){return _0x3d9d53;});}return null;};}function removeEntity(_0x5039f1,_0x359654){return function(_0x4986e6){if(_0x4986e6){return _0x4986e6['destroy']()[_0x3807('0x2a')](function(){_0x5039f1[_0x3807('0x1f')](0xcc)[_0x3807('0x1e')]();});}};}function handleEntityNotFound(_0x2fc120,_0x541cd6){return function(_0x508fb1){if(!_0x508fb1){_0x2fc120['sendStatus'](0x194);}return _0x508fb1;};}function handleError(_0xdb8b0f,_0x5f0c5a){_0x5f0c5a=_0x5f0c5a||0x1f4;return function(_0x233841){logger[_0x3807('0x2b')](_0x233841[_0x3807('0x2c')]);if(_0x233841['name']){delete _0x233841[_0x3807('0x2d')];}_0xdb8b0f[_0x3807('0x1f')](_0x5f0c5a)[_0x3807('0x2e')](_0x233841);};}exports['index']=function(_0x5c0477,_0x2a4d39){var _0xb25721={},_0x28073e={},_0x379261={'count':0x0,'rows':[]};var _0x1834c3=_[_0x3807('0x2f')](db['SmsTransferReport'][_0x3807('0x30')],function(_0x28f515){return{'name':_0x28f515[_0x3807('0x31')],'type':_0x28f515['type'][_0x3807('0x32')]};});_0x28073e['model']=_[_0x3807('0x2f')](_0x1834c3,_0x3807('0x2d'));_0x28073e[_0x3807('0x33')]=_[_0x3807('0x34')](_0x5c0477[_0x3807('0x33')]);_0x28073e[_0x3807('0x35')]=_[_0x3807('0x36')](_0x28073e[_0x3807('0x37')],_0x28073e[_0x3807('0x33')]);_0xb25721[_0x3807('0x38')]=_[_0x3807('0x36')](_0x28073e['model'],qs['fields'](_0x5c0477[_0x3807('0x33')][_0x3807('0x39')]));_0xb25721[_0x3807('0x38')]=_0xb25721[_0x3807('0x38')][_0x3807('0x3a')]?_0xb25721['attributes']:_0x28073e[_0x3807('0x37')];if(!_0x5c0477[_0x3807('0x33')][_0x3807('0x3b')](_0x3807('0x3c'))){_0xb25721['limit']=qs[_0x3807('0x24')](_0x5c0477[_0x3807('0x33')][_0x3807('0x24')]);_0xb25721[_0x3807('0x21')]=qs[_0x3807('0x21')](_0x5c0477[_0x3807('0x33')][_0x3807('0x21')]);}_0xb25721[_0x3807('0x3d')]=qs[_0x3807('0x3e')](_0x5c0477[_0x3807('0x33')][_0x3807('0x3e')]);_0xb25721[_0x3807('0x3f')]=qs['filters'](_['pick'](_0x5c0477[_0x3807('0x33')],_0x28073e['filters']),_0x1834c3);if(_0x5c0477[_0x3807('0x33')][_0x3807('0x40')]){_0xb25721[_0x3807('0x3f')]=_[_0x3807('0x41')](_0xb25721['where'],{'$or':_[_0x3807('0x2f')](_0x1834c3,function(_0x2183b9){if(_0x2183b9[_0x3807('0x42')]!==_0x3807('0x43')){var _0xd168ba={};_0xd168ba[_0x2183b9[_0x3807('0x2d')]]={'$like':'%'+_0x5c0477[_0x3807('0x33')][_0x3807('0x40')]+'%'};return _0xd168ba;}})});}_0xb25721=_['merge']({},_0xb25721,_0x5c0477[_0x3807('0x44')]);var _0x1ff7bf={'where':_0xb25721[_0x3807('0x3f')]};return db[_0x3807('0x45')][_0x3807('0x23')](_0x1ff7bf)[_0x3807('0x2a')](function(_0xc2517a){_0x379261['count']=_0xc2517a;if(_0x5c0477['query']['includeAll']){_0xb25721[_0x3807('0x46')]=[{'all':!![]}];}return db['SmsTransferReport'][_0x3807('0x47')](_0xb25721);})[_0x3807('0x2a')](function(_0x17b5a1){_0x379261[_0x3807('0x48')]=_0x17b5a1;return _0x379261;})[_0x3807('0x2a')](respondWithFilteredResult(_0x2a4d39,_0xb25721))[_0x3807('0x49')](handleError(_0x2a4d39,null));};exports['show']=function(_0x2abd84,_0x288bbb){var _0x4ba88d={'raw':!![],'where':{'id':_0x2abd84[_0x3807('0x4a')]['id']}},_0x485db3={};_0x485db3[_0x3807('0x37')]=_[_0x3807('0x34')](db[_0x3807('0x45')][_0x3807('0x30')]);_0x485db3[_0x3807('0x33')]=_[_0x3807('0x34')](_0x2abd84[_0x3807('0x33')]);_0x485db3['filters']=_[_0x3807('0x36')](_0x485db3['model'],_0x485db3['query']);_0x4ba88d[_0x3807('0x38')]=_['intersection'](_0x485db3[_0x3807('0x37')],qs['fields'](_0x2abd84[_0x3807('0x33')][_0x3807('0x39')]));_0x4ba88d['attributes']=_0x4ba88d[_0x3807('0x38')][_0x3807('0x3a')]?_0x4ba88d[_0x3807('0x38')]:_0x485db3['model'];if(_0x2abd84[_0x3807('0x33')][_0x3807('0x4b')]){_0x4ba88d['include']=[{'all':!![]}];}_0x4ba88d=_['merge']({},_0x4ba88d,_0x2abd84[_0x3807('0x44')]);return db['SmsTransferReport']['find'](_0x4ba88d)[_0x3807('0x2a')](handleEntityNotFound(_0x288bbb,null))['then'](respondWithResult(_0x288bbb,null))['catch'](handleError(_0x288bbb,null));};exports[_0x3807('0x4c')]=function(_0x13a3f6,_0x3246aa){return db[_0x3807('0x45')]['create'](_0x13a3f6[_0x3807('0x4d')],{})['then'](respondWithResult(_0x3246aa,0xc9))[_0x3807('0x49')](handleError(_0x3246aa,null));};exports[_0x3807('0x29')]=function(_0xf81212,_0x13c3fc){if(_0xf81212[_0x3807('0x4d')]['id']){delete _0xf81212[_0x3807('0x4d')]['id'];}return db[_0x3807('0x45')][_0x3807('0x4e')]({'where':{'id':_0xf81212['params']['id']}})[_0x3807('0x2a')](handleEntityNotFound(_0x13c3fc,null))[_0x3807('0x2a')](saveUpdates(_0xf81212['body'],null))[_0x3807('0x2a')](respondWithResult(_0x13c3fc,null))[_0x3807('0x49')](handleError(_0x13c3fc,null));};exports[_0x3807('0x4f')]=function(_0x588295,_0x5f59ff){return db[_0x3807('0x45')][_0x3807('0x4e')]({'where':{'id':_0x588295['params']['id']}})['then'](handleEntityNotFound(_0x5f59ff,null))[_0x3807('0x2a')](removeEntity(_0x5f59ff,null))[_0x3807('0x49')](handleError(_0x5f59ff,null));};exports[_0x3807('0x50')]=function(_0x22178d,_0x15069f){return db[_0x3807('0x45')][_0x3807('0x50')]()[_0x3807('0x2a')](respondWithResult(_0x15069f,null))[_0x3807('0x49')](handleError(_0x15069f,null));}; \ No newline at end of file diff --git a/server/api/smsTransferReport/smsTransferReport.model.js b/server/api/smsTransferReport/smsTransferReport.model.js index 3d4af64..aabfdcf 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 _0x2494=['api','moment','bluebird','request-promise','path','./smsTransferReport.attributes','define','report_sms_transfer','uniqueid','lodash','../../config/logger'];(function(_0x332a03,_0x501d78){var _0xc54831=function(_0x131b9f){while(--_0x131b9f){_0x332a03['push'](_0x332a03['shift']());}};_0xc54831(++_0x501d78);}(_0x2494,0x82));var _0x4249=function(_0x572fa9,_0x4108ad){_0x572fa9=_0x572fa9-0x0;var _0x5b5513=_0x2494[_0x572fa9];return _0x5b5513;};'use strict';var _=require(_0x4249('0x0'));var util=require('util');var logger=require(_0x4249('0x1'))(_0x4249('0x2'));var moment=require(_0x4249('0x3'));var BPromise=require(_0x4249('0x4'));var rp=require(_0x4249('0x5'));var fs=require('fs');var path=require(_0x4249('0x6'));var rimraf=require('rimraf');var config=require('../../config/environment');var attributes=require(_0x4249('0x7'));module['exports']=function(_0x3c2d8d,_0x1d4ca8){return _0x3c2d8d[_0x4249('0x8')]('SmsTransferReport',attributes,{'tableName':_0x4249('0x9'),'paranoid':![],'indexes':[{'name':_0x4249('0xa'),'fields':[_0x4249('0xa')]}],'timestamps':!![]});}; \ No newline at end of file +var _0x09d3=['moment','bluebird','request-promise','path','../../config/environment','exports','define','SmsTransferReport','uniqueid','lodash','util','../../config/logger','api'];(function(_0x59539e,_0x4c1afd){var _0x2a4c08=function(_0x2cf94b){while(--_0x2cf94b){_0x59539e['push'](_0x59539e['shift']());}};_0x2a4c08(++_0x4c1afd);}(_0x09d3,0xa5));var _0x309d=function(_0x4e1642,_0x1133dc){_0x4e1642=_0x4e1642-0x0;var _0x4c7998=_0x09d3[_0x4e1642];return _0x4c7998;};'use strict';var _=require(_0x309d('0x0'));var util=require(_0x309d('0x1'));var logger=require(_0x309d('0x2'))(_0x309d('0x3'));var moment=require(_0x309d('0x4'));var BPromise=require(_0x309d('0x5'));var rp=require(_0x309d('0x6'));var fs=require('fs');var path=require(_0x309d('0x7'));var rimraf=require('rimraf');var config=require(_0x309d('0x8'));var attributes=require('./smsTransferReport.attributes');module[_0x309d('0x9')]=function(_0x1332e8,_0x4b2653){return _0x1332e8[_0x309d('0xa')](_0x309d('0xb'),attributes,{'tableName':'report_sms_transfer','paranoid':![],'indexes':[{'name':_0x309d('0xc'),'fields':[_0x309d('0xc')]}],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/smsTransferReport/smsTransferReport.rpc.js b/server/api/smsTransferReport/smsTransferReport.rpc.js index b292b22..08c3b8c 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 _0x24ce=['../../config/environment','jayson/promise','client','http','request','then','info','SmsTransferReport,\x20%s,\x20%s','request\x20sent','debug','SmsTransferReport,\x20%s,\x20%s,\x20%s','stringify','error','message','result','catch','util','moment','bluebird','randomstring','../../config/utils'];(function(_0x179e41,_0x52013c){var _0x1dd334=function(_0x68ffb8){while(--_0x68ffb8){_0x179e41['push'](_0x179e41['shift']());}};_0x1dd334(++_0x52013c);}(_0x24ce,0x1de));var _0xe24c=function(_0x2b985a,_0x2283e2){_0x2b985a=_0x2b985a-0x0;var _0x1198f0=_0x24ce[_0x2b985a];return _0x1198f0;};'use strict';var _=require('lodash');var util=require(_0xe24c('0x0'));var moment=require(_0xe24c('0x1'));var BPromise=require(_0xe24c('0x2'));var rs=require(_0xe24c('0x3'));var fs=require('fs');var Redis=require('ioredis');var db=require('../../mysqldb')['db'];var utils=require(_0xe24c('0x4'));var logger=require('../../config/logger')('rpc');var config=require(_0xe24c('0x5'));var jayson=require(_0xe24c('0x6'));var client=jayson[_0xe24c('0x7')][_0xe24c('0x8')]({'port':0x232a});function respondWithRpcPromise(_0xe1d970,_0x496abb,_0x6d00e){return new BPromise(function(_0x2d8dde,_0x1e02af){return client[_0xe24c('0x9')](_0xe1d970,_0x6d00e)[_0xe24c('0xa')](function(_0x33e9d3){logger[_0xe24c('0xb')](_0xe24c('0xc'),_0x496abb,_0xe24c('0xd'));logger[_0xe24c('0xe')](_0xe24c('0xf'),_0x496abb,_0xe24c('0xd'),JSON[_0xe24c('0x10')](_0x33e9d3));if(_0x33e9d3['error']){if(_0x33e9d3[_0xe24c('0x11')]['code']===0x1f4){logger[_0xe24c('0x11')]('SmsTransferReport,\x20%s,\x20%s',_0x496abb,_0x33e9d3[_0xe24c('0x11')][_0xe24c('0x12')]);return _0x1e02af(_0x33e9d3['error']['message']);}logger['error'](_0xe24c('0xc'),_0x496abb,_0x33e9d3['error'][_0xe24c('0x12')]);return _0x2d8dde(_0x33e9d3[_0xe24c('0x11')][_0xe24c('0x12')]);}else{logger[_0xe24c('0xb')]('SmsTransferReport,\x20%s,\x20%s',_0x496abb,_0xe24c('0xd'));_0x2d8dde(_0x33e9d3[_0xe24c('0x13')][_0xe24c('0x12')]);}})[_0xe24c('0x14')](function(_0x261609){logger[_0xe24c('0x11')](_0xe24c('0xc'),_0x496abb,_0x261609);_0x1e02af(_0x261609);});});} \ No newline at end of file +var _0xb957=['info','SmsTransferReport,\x20%s,\x20%s,\x20%s','request\x20sent','error','code','message','SmsTransferReport,\x20%s,\x20%s','result','catch','moment','randomstring','ioredis','../../mysqldb','../../config/logger','rpc','../../config/environment','jayson/promise','client','request','then'];(function(_0x4b0986,_0x4b3462){var _0x1fed42=function(_0x2fa8b3){while(--_0x2fa8b3){_0x4b0986['push'](_0x4b0986['shift']());}};_0x1fed42(++_0x4b3462);}(_0xb957,0x6d));var _0x7b95=function(_0x5810e1,_0x1e71ab){_0x5810e1=_0x5810e1-0x0;var _0x4d3a87=_0xb957[_0x5810e1];return _0x4d3a87;};'use strict';var _=require('lodash');var util=require('util');var moment=require(_0x7b95('0x0'));var BPromise=require('bluebird');var rs=require(_0x7b95('0x1'));var fs=require('fs');var Redis=require(_0x7b95('0x2'));var db=require(_0x7b95('0x3'))['db'];var utils=require('../../config/utils');var logger=require(_0x7b95('0x4'))(_0x7b95('0x5'));var config=require(_0x7b95('0x6'));var jayson=require(_0x7b95('0x7'));var client=jayson[_0x7b95('0x8')]['http']({'port':0x232a});function respondWithRpcPromise(_0x2912d5,_0x16b05a,_0x161768){return new BPromise(function(_0x495bea,_0x5e1421){return client[_0x7b95('0x9')](_0x2912d5,_0x161768)[_0x7b95('0xa')](function(_0x2e82e6){logger[_0x7b95('0xb')]('SmsTransferReport,\x20%s,\x20%s',_0x16b05a,'request\x20sent');logger['debug'](_0x7b95('0xc'),_0x16b05a,_0x7b95('0xd'),JSON['stringify'](_0x2e82e6));if(_0x2e82e6['error']){if(_0x2e82e6[_0x7b95('0xe')][_0x7b95('0xf')]===0x1f4){logger[_0x7b95('0xe')]('SmsTransferReport,\x20%s,\x20%s',_0x16b05a,_0x2e82e6['error'][_0x7b95('0x10')]);return _0x5e1421(_0x2e82e6['error'][_0x7b95('0x10')]);}logger[_0x7b95('0xe')](_0x7b95('0x11'),_0x16b05a,_0x2e82e6[_0x7b95('0xe')]['message']);return _0x495bea(_0x2e82e6['error'][_0x7b95('0x10')]);}else{logger[_0x7b95('0xb')](_0x7b95('0x11'),_0x16b05a,_0x7b95('0xd'));_0x495bea(_0x2e82e6[_0x7b95('0x12')][_0x7b95('0x10')]);}})[_0x7b95('0x13')](function(_0x44e836){logger[_0x7b95('0xe')](_0x7b95('0x11'),_0x16b05a,_0x44e836);_0x5e1421(_0x44e836);});});} \ No newline at end of file diff --git a/server/api/sound/index.js b/server/api/sound/index.js index bdc80f2..aed6c68 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 _0x597b=['root','originalname','extname','now','post','single','file','create','put','exports','util','path','connect-timeout','express','fs-extra','../../components/interaction/service','../../config/environment','./sound.controller','get','isAuthenticated','index','/:id','show','/:id/download','download','diskStorage','join'];(function(_0x397e5f,_0x454c8f){var _0x5302b8=function(_0x1a29ef){while(--_0x1a29ef){_0x397e5f['push'](_0x397e5f['shift']());}};_0x5302b8(++_0x454c8f);}(_0x597b,0xc7));var _0xb597=function(_0x316ec8,_0x3e4209){_0x316ec8=_0x316ec8-0x0;var _0x2aee94=_0x597b[_0x316ec8];return _0x2aee94;};'use strict';var multer=require('multer');var util=require(_0xb597('0x0'));var path=require(_0xb597('0x1'));var timeout=require(_0xb597('0x2'));var express=require(_0xb597('0x3'));var router=express['Router']();var fs_extra=require(_0xb597('0x4'));var auth=require('../../components/auth/service');var interaction=require(_0xb597('0x5'));var config=require(_0xb597('0x6'));var controller=require(_0xb597('0x7'));router[_0xb597('0x8')]('/',auth[_0xb597('0x9')](),controller[_0xb597('0xa')]);router['get'](_0xb597('0xb'),auth[_0xb597('0x9')](),controller[_0xb597('0xc')]);router['get'](_0xb597('0xd'),auth[_0xb597('0x9')](),controller[_0xb597('0xe')]);var upload=multer({'storage':multer[_0xb597('0xf')]({'destination':function(_0x2c01f6,_0x4f43bd,_0x1cb053){_0x1cb053(null,path[_0xb597('0x10')](config[_0xb597('0x11')],'server/files/sounds/original/'));},'filename':function(_0x29918a,_0x16c023,_0x20d7c8){_0x16c023[_0xb597('0x12')]=_0x16c023[_0xb597('0x12')]['replace'](/[+@&\/\\#,+()$~%'":*?<>{}\s\\|]/g,'-');_0x20d7c8(null,util['format']('%s-%s%s',path['basename'](_0x16c023['originalname'],path[_0xb597('0x13')](_0x16c023[_0xb597('0x12')])),Date[_0xb597('0x14')](),path[_0xb597('0x13')](_0x16c023['originalname'])));}})});router[_0xb597('0x15')]('/',upload[_0xb597('0x16')](_0xb597('0x17')),controller[_0xb597('0x18')]);router[_0xb597('0x19')]('/:id',auth[_0xb597('0x9')](),controller['update']);router['delete'](_0xb597('0xb'),auth[_0xb597('0x9')](),controller['delete']);module[_0xb597('0x1a')]=router; \ No newline at end of file +var _0x685b=['create','put','update','delete','multer','util','path','express','../../components/auth/service','../../config/environment','get','isAuthenticated','index','/:id','show','/:id/download','download','join','root','originalname','replace','format','basename','extname','now','file'];(function(_0x239dba,_0x309e95){var _0x1ceb11=function(_0x14efe6){while(--_0x14efe6){_0x239dba['push'](_0x239dba['shift']());}};_0x1ceb11(++_0x309e95);}(_0x685b,0x1f2));var _0xb685=function(_0x7791d5,_0xdab65f){_0x7791d5=_0x7791d5-0x0;var _0x5ce288=_0x685b[_0x7791d5];return _0x5ce288;};'use strict';var multer=require(_0xb685('0x0'));var util=require(_0xb685('0x1'));var path=require(_0xb685('0x2'));var timeout=require('connect-timeout');var express=require(_0xb685('0x3'));var router=express['Router']();var fs_extra=require('fs-extra');var auth=require(_0xb685('0x4'));var interaction=require('../../components/interaction/service');var config=require(_0xb685('0x5'));var controller=require('./sound.controller');router[_0xb685('0x6')]('/',auth[_0xb685('0x7')](),controller[_0xb685('0x8')]);router[_0xb685('0x6')](_0xb685('0x9'),auth[_0xb685('0x7')](),controller[_0xb685('0xa')]);router['get'](_0xb685('0xb'),auth['isAuthenticated'](),controller[_0xb685('0xc')]);var upload=multer({'storage':multer['diskStorage']({'destination':function(_0x184737,_0x3bd54d,_0x15f950){_0x15f950(null,path[_0xb685('0xd')](config[_0xb685('0xe')],'server/files/sounds/original/'));},'filename':function(_0x43c8c7,_0x132d88,_0x13004c){_0x132d88[_0xb685('0xf')]=_0x132d88[_0xb685('0xf')][_0xb685('0x10')](/[+@&\/\\#,+()$~%'":*?<>{}\s\\|]/g,'-');_0x13004c(null,util[_0xb685('0x11')]('%s-%s%s',path[_0xb685('0x12')](_0x132d88[_0xb685('0xf')],path[_0xb685('0x13')](_0x132d88[_0xb685('0xf')])),Date[_0xb685('0x14')](),path[_0xb685('0x13')](_0x132d88[_0xb685('0xf')])));}})});router['post']('/',upload['single'](_0xb685('0x15')),controller[_0xb685('0x16')]);router[_0xb685('0x17')](_0xb685('0x9'),auth['isAuthenticated'](),controller[_0xb685('0x18')]);router[_0xb685('0x19')](_0xb685('0x9'),auth[_0xb685('0x7')](),controller[_0xb685('0x19')]);module['exports']=router; \ No newline at end of file diff --git a/server/api/sound/sound.attributes.js b/server/api/sound/sound.attributes.js index f11efb8..18e6a92 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 _0xc347=['BIGINT','INTEGER','sequelize','exports','STRING','name','FLOAT'];(function(_0x51021e,_0x5bde98){var _0x517038=function(_0x351a7b){while(--_0x351a7b){_0x51021e['push'](_0x51021e['shift']());}};_0x517038(++_0x5bde98);}(_0xc347,0x1f3));var _0x7c34=function(_0xefd519,_0xc62635){_0xefd519=_0xefd519-0x0;var _0x4bb882=_0xc347[_0xefd519];return _0x4bb882;};'use strict';var Sequelize=require(_0x7c34('0x0'));module[_0x7c34('0x1')]={'name':{'type':Sequelize[_0x7c34('0x2')],'unique':_0x7c34('0x3'),'allowNull':![]},'save_name':{'type':Sequelize['STRING']},'display_name':{'type':Sequelize[_0x7c34('0x2')],'defaultValue':''},'description':{'type':Sequelize[_0x7c34('0x2')]},'original_format':{'type':Sequelize['STRING']},'original_duration':{'type':Sequelize[_0x7c34('0x4')]},'original_sampleCount':{'type':Sequelize[_0x7c34('0x5')]},'original_channelCount':{'type':Sequelize[_0x7c34('0x6')]},'original_bitRate':{'type':Sequelize[_0x7c34('0x5')]},'original_sampleRate':{'type':Sequelize['INTEGER']},'converted_format':{'type':Sequelize[_0x7c34('0x2')]},'converted_duration':{'type':Sequelize['FLOAT']},'converted_sampleCount':{'type':Sequelize[_0x7c34('0x5')]},'converted_channelCount':{'type':Sequelize[_0x7c34('0x6')]},'converted_bitRate':{'type':Sequelize[_0x7c34('0x5')]},'converted_sampleRate':{'type':Sequelize[_0x7c34('0x6')]}}; \ No newline at end of file +var _0x91bd=['name','STRING','BIGINT','INTEGER','sequelize'];(function(_0x1b7cf9,_0x5c7cef){var _0x223436=function(_0x537ada){while(--_0x537ada){_0x1b7cf9['push'](_0x1b7cf9['shift']());}};_0x223436(++_0x5c7cef);}(_0x91bd,0xc7));var _0xd91b=function(_0x996bc8,_0x291e01){_0x996bc8=_0x996bc8-0x0;var _0x20b0ea=_0x91bd[_0x996bc8];return _0x20b0ea;};'use strict';var Sequelize=require(_0xd91b('0x0'));module['exports']={'name':{'type':Sequelize['STRING'],'unique':_0xd91b('0x1'),'allowNull':![]},'save_name':{'type':Sequelize[_0xd91b('0x2')]},'display_name':{'type':Sequelize['STRING'],'defaultValue':''},'description':{'type':Sequelize['STRING']},'original_format':{'type':Sequelize[_0xd91b('0x2')]},'original_duration':{'type':Sequelize['FLOAT']},'original_sampleCount':{'type':Sequelize['BIGINT']},'original_channelCount':{'type':Sequelize['INTEGER']},'original_bitRate':{'type':Sequelize[_0xd91b('0x3')]},'original_sampleRate':{'type':Sequelize['INTEGER']},'converted_format':{'type':Sequelize[_0xd91b('0x2')]},'converted_duration':{'type':Sequelize['FLOAT']},'converted_sampleCount':{'type':Sequelize[_0xd91b('0x3')]},'converted_channelCount':{'type':Sequelize[_0xd91b('0x4')]},'converted_bitRate':{'type':Sequelize[_0xd91b('0x3')]},'converted_sampleRate':{'type':Sequelize[_0xd91b('0x4')]}}; \ No newline at end of file diff --git a/server/api/sound/sound.controller.js b/server/api/sound/sound.controller.js index 208be40..b90a452 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 _0xd8df=['json','undefined','limit','count','offset','set','Content-Range','reject','then','destroy','get','Sounds','UserProfileResource','stack','name','send','index','map','Sound','rawAttributes','type','key','model','query','keys','filters','attributes','intersection','fields','length','nolimit','order','sort','where','pick','filter','merge','VIRTUAL','options','include','findAll','rows','catch','show','includeAll','find','download','params','save_name','converted_format','existsSync','join','root','server/files/sounds/converted','ValidationError','Sound\x20not\x20found','%s.%s','format','create','originalname','extname','file','filename','substring','wav','server/files/sounds/original','info','Sound\x20upload\x20destination:\x20%s','chmodSync','0777','transcode','error','unlinkSync','src','original_duration','duration','original_sampleCount','sampleCount','original_channelCount','channelCount','original_bitRate','bitRate','sampleRate','dest','converted_duration','converted_sampleCount','converted_channelCount','converted_bitRate','converted_sampleRate','body','role','UserProfileSection','userProfileId','autoAssociation','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','start','update','delete','original_format','eml-format','rimraf','fast-json-patch','request-promise','moment','bluebird','mustache','util','fs-extra','lodash','squel','crypto','jsforce','to-csv','querystring','papaparse','ioredis','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/logger','api','../../config/environment','../../config/license/util','../../mysqldb','sendStatus','status','end'];(function(_0x132479,_0x2fc76d){var _0xe6be48=function(_0x2352fe){while(--_0x2352fe){_0x132479['push'](_0x132479['shift']());}};_0xe6be48(++_0x2fc76d);}(_0xd8df,0x15f));var _0xfd8d=function(_0x364d1a,_0x5f0e14){_0x364d1a=_0x364d1a-0x0;var _0x54b914=_0xd8df[_0x364d1a];return _0x54b914;};'use strict';var emlformat=require(_0xfd8d('0x0'));var rimraf=require(_0xfd8d('0x1'));var zipdir=require('zip-dir');var jsonpatch=require(_0xfd8d('0x2'));var rp=require(_0xfd8d('0x3'));var moment=require(_0xfd8d('0x4'));var BPromise=require(_0xfd8d('0x5'));var Mustache=require(_0xfd8d('0x6'));var util=require(_0xfd8d('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(_0xfd8d('0x8'));var _=require(_0xfd8d('0x9'));var squel=require(_0xfd8d('0xa'));var crypto=require(_0xfd8d('0xb'));var jsforce=require(_0xfd8d('0xc'));var deskjs=require('desk.js');var toCsv=require(_0xfd8d('0xd'));var querystring=require(_0xfd8d('0xe'));var Papa=require(_0xfd8d('0xf'));var Redis=require(_0xfd8d('0x10'));var authService=require('../../components/auth/service');var qs=require(_0xfd8d('0x11'));var as=require(_0xfd8d('0x12'));var hardwareService=require('../../config/license/hardware');var logger=require(_0xfd8d('0x13'))(_0xfd8d('0x14'));var utils=require('../../config/utils');var config=require(_0xfd8d('0x15'));var licenseUtil=require(_0xfd8d('0x16'));var db=require(_0xfd8d('0x17'))['db'];function respondWithStatusCode(_0x53308b,_0x5a9932){_0x5a9932=_0x5a9932||0xcc;return function(_0x2b1951){if(_0x2b1951){return _0x53308b[_0xfd8d('0x18')](_0x5a9932);}return _0x53308b[_0xfd8d('0x19')](_0x5a9932)[_0xfd8d('0x1a')]();};}function respondWithResult(_0x253cf1,_0x3879ec){_0x3879ec=_0x3879ec||0xc8;return function(_0x383ec1){if(_0x383ec1){return _0x253cf1[_0xfd8d('0x19')](_0x3879ec)[_0xfd8d('0x1b')](_0x383ec1);}};}function respondWithFilteredResult(_0x16570e,_0x2a2af9){return function(_0x3c8b25){if(_0x3c8b25){var _0xe2e1eb=typeof _0x2a2af9['offset']===_0xfd8d('0x1c')&&typeof _0x2a2af9[_0xfd8d('0x1d')]===_0xfd8d('0x1c');var _0xe20e80=_0x3c8b25[_0xfd8d('0x1e')];var _0x4abeb9=_0xe2e1eb?0x0:_0x2a2af9[_0xfd8d('0x1f')];var _0x4d63d8=_0xe2e1eb?_0x3c8b25[_0xfd8d('0x1e')]:_0x2a2af9[_0xfd8d('0x1f')]+_0x2a2af9[_0xfd8d('0x1d')];var _0x847dc9;if(_0x4d63d8>=_0xe20e80){_0x4d63d8=_0xe20e80;_0x847dc9=0xc8;}else{_0x847dc9=0xce;}_0x16570e[_0xfd8d('0x19')](_0x847dc9);return _0x16570e[_0xfd8d('0x20')](_0xfd8d('0x21'),_0x4abeb9+'-'+_0x4d63d8+'/'+_0xe20e80)[_0xfd8d('0x1b')](_0x3c8b25);}return null;};}function patchUpdates(_0x143e56){return function(_0x38fdfe){try{jsonpatch['apply'](_0x38fdfe,_0x143e56,!![]);}catch(_0x222250){return BPromise[_0xfd8d('0x22')](_0x222250);}return _0x38fdfe['save']();};}function saveUpdates(_0x5896de,_0x956417){return function(_0x2aab7e){if(_0x2aab7e){return _0x2aab7e['update'](_0x5896de)[_0xfd8d('0x23')](function(_0x5338eb){return _0x5338eb;});}return null;};}function removeEntity(_0x3b9ff4,_0x5e90b7){return function(_0x319e2b){if(_0x319e2b){return _0x319e2b[_0xfd8d('0x24')]()[_0xfd8d('0x23')](function(){var _0x28a658=_0x319e2b[_0xfd8d('0x25')]({'plain':!![]});var _0x15506f=_0xfd8d('0x26');return db[_0xfd8d('0x27')][_0xfd8d('0x24')]({'where':{'type':_0x15506f,'resourceId':_0x28a658['id']}})['then'](function(){return _0x319e2b;});})[_0xfd8d('0x23')](function(){_0x3b9ff4[_0xfd8d('0x19')](0xcc)['end']();});}};}function handleEntityNotFound(_0x5214c4,_0x53c494){return function(_0x44e704){if(!_0x44e704){_0x5214c4[_0xfd8d('0x18')](0x194);}return _0x44e704;};}function handleError(_0x25d26a,_0x4fa944){_0x4fa944=_0x4fa944||0x1f4;return function(_0x5aa1fe){logger['error'](_0x5aa1fe[_0xfd8d('0x28')]);if(_0x5aa1fe[_0xfd8d('0x29')]){delete _0x5aa1fe[_0xfd8d('0x29')];}_0x25d26a[_0xfd8d('0x19')](_0x4fa944)[_0xfd8d('0x2a')](_0x5aa1fe);};}exports[_0xfd8d('0x2b')]=function(_0x1bd00b,_0x429a7e){var _0x2649e1={},_0x581bad={},_0x27e92f={'count':0x0,'rows':[]};var _0x125894=_[_0xfd8d('0x2c')](db[_0xfd8d('0x2d')][_0xfd8d('0x2e')],function(_0x248072){return{'name':_0x248072['fieldName'],'type':_0x248072[_0xfd8d('0x2f')][_0xfd8d('0x30')]};});_0x581bad[_0xfd8d('0x31')]=_[_0xfd8d('0x2c')](_0x125894,'name');_0x581bad[_0xfd8d('0x32')]=_[_0xfd8d('0x33')](_0x1bd00b[_0xfd8d('0x32')]);_0x581bad[_0xfd8d('0x34')]=_['intersection'](_0x581bad[_0xfd8d('0x31')],_0x581bad['query']);_0x2649e1[_0xfd8d('0x35')]=_[_0xfd8d('0x36')](_0x581bad['model'],qs[_0xfd8d('0x37')](_0x1bd00b[_0xfd8d('0x32')]['fields']));_0x2649e1[_0xfd8d('0x35')]=_0x2649e1['attributes'][_0xfd8d('0x38')]?_0x2649e1[_0xfd8d('0x35')]:_0x581bad[_0xfd8d('0x31')];if(!_0x1bd00b[_0xfd8d('0x32')]['hasOwnProperty'](_0xfd8d('0x39'))){_0x2649e1[_0xfd8d('0x1d')]=qs[_0xfd8d('0x1d')](_0x1bd00b[_0xfd8d('0x32')][_0xfd8d('0x1d')]);_0x2649e1[_0xfd8d('0x1f')]=qs[_0xfd8d('0x1f')](_0x1bd00b[_0xfd8d('0x32')][_0xfd8d('0x1f')]);}_0x2649e1[_0xfd8d('0x3a')]=qs['sort'](_0x1bd00b[_0xfd8d('0x32')][_0xfd8d('0x3b')]);_0x2649e1[_0xfd8d('0x3c')]=qs['filters'](_[_0xfd8d('0x3d')](_0x1bd00b[_0xfd8d('0x32')],_0x581bad[_0xfd8d('0x34')]),_0x125894);if(_0x1bd00b[_0xfd8d('0x32')][_0xfd8d('0x3e')]){_0x2649e1[_0xfd8d('0x3c')]=_[_0xfd8d('0x3f')](_0x2649e1['where'],{'$or':_[_0xfd8d('0x2c')](_0x125894,function(_0x4a55a8){if(_0x4a55a8[_0xfd8d('0x2f')]!==_0xfd8d('0x40')){var _0x5898fb={};_0x5898fb[_0x4a55a8[_0xfd8d('0x29')]]={'$like':'%'+_0x1bd00b['query'][_0xfd8d('0x3e')]+'%'};return _0x5898fb;}})});}_0x2649e1=_['merge']({},_0x2649e1,_0x1bd00b[_0xfd8d('0x41')]);var _0x2a9bdc={'where':_0x2649e1[_0xfd8d('0x3c')]};return db[_0xfd8d('0x2d')][_0xfd8d('0x1e')](_0x2a9bdc)[_0xfd8d('0x23')](function(_0x4ef15f){_0x27e92f[_0xfd8d('0x1e')]=_0x4ef15f;if(_0x1bd00b[_0xfd8d('0x32')]['includeAll']){_0x2649e1[_0xfd8d('0x42')]=[{'all':!![]}];}return db[_0xfd8d('0x2d')][_0xfd8d('0x43')](_0x2649e1);})[_0xfd8d('0x23')](function(_0x1f2704){_0x27e92f[_0xfd8d('0x44')]=_0x1f2704;return _0x27e92f;})[_0xfd8d('0x23')](respondWithFilteredResult(_0x429a7e,_0x2649e1))[_0xfd8d('0x45')](handleError(_0x429a7e,null));};exports[_0xfd8d('0x46')]=function(_0x58ba49,_0x277321){var _0x29945b={'raw':!![],'where':{'id':_0x58ba49['params']['id']}},_0xaafdb3={};_0xaafdb3[_0xfd8d('0x31')]=_['keys'](db[_0xfd8d('0x2d')][_0xfd8d('0x2e')]);_0xaafdb3[_0xfd8d('0x32')]=_[_0xfd8d('0x33')](_0x58ba49[_0xfd8d('0x32')]);_0xaafdb3[_0xfd8d('0x34')]=_['intersection'](_0xaafdb3[_0xfd8d('0x31')],_0xaafdb3[_0xfd8d('0x32')]);_0x29945b[_0xfd8d('0x35')]=_[_0xfd8d('0x36')](_0xaafdb3[_0xfd8d('0x31')],qs['fields'](_0x58ba49['query']['fields']));_0x29945b['attributes']=_0x29945b[_0xfd8d('0x35')][_0xfd8d('0x38')]?_0x29945b[_0xfd8d('0x35')]:_0xaafdb3[_0xfd8d('0x31')];if(_0x58ba49[_0xfd8d('0x32')][_0xfd8d('0x47')]){_0x29945b[_0xfd8d('0x42')]=[{'all':!![]}];}_0x29945b=_[_0xfd8d('0x3f')]({},_0x29945b,_0x58ba49['options']);return db[_0xfd8d('0x2d')][_0xfd8d('0x48')](_0x29945b)[_0xfd8d('0x23')](handleEntityNotFound(_0x277321,null))['then'](respondWithResult(_0x277321,null))['catch'](handleError(_0x277321,null));};exports[_0xfd8d('0x49')]=function(_0xdf425,_0x40419c,_0x15f48e){return db[_0xfd8d('0x2d')][_0xfd8d('0x48')]({'where':{'id':_0xdf425[_0xfd8d('0x4a')]['id']},'attributes':[_0xfd8d('0x29'),_0xfd8d('0x4b'),_0xfd8d('0x4c')],'raw':!![]})[_0xfd8d('0x23')](handleEntityNotFound(_0x40419c,null))['then'](function(_0x185569){if(_0x185569){if(!fs[_0xfd8d('0x4d')](path[_0xfd8d('0x4e')](config[_0xfd8d('0x4f')],_0xfd8d('0x50'),_0x185569[_0xfd8d('0x4b')]+'.'+_0x185569[_0xfd8d('0x4c')]))){throw new db['Sequelize'][(_0xfd8d('0x51'))](_0xfd8d('0x52'));}return _0x40419c['download'](path['join'](config['root'],_0xfd8d('0x50'),util['format'](_0xfd8d('0x53'),_0x185569[_0xfd8d('0x4b')],_0x185569[_0xfd8d('0x4c')])),util[_0xfd8d('0x54')](_0xfd8d('0x53'),_0x185569[_0xfd8d('0x29')],_0x185569['converted_format']));}return null;})[_0xfd8d('0x45')](handleError(_0x40419c,null));};exports[_0xfd8d('0x55')]=function(_0x290948,_0x2015f9,_0x198938){var _0x73a02f={'name':path['basename'](_0x290948['file'][_0xfd8d('0x56')],path[_0xfd8d('0x57')](_0x290948['file'][_0xfd8d('0x56')])),'save_name':path['basename'](_0x290948[_0xfd8d('0x58')]['filename'],path[_0xfd8d('0x57')](_0x290948[_0xfd8d('0x58')][_0xfd8d('0x59')])),'original_format':path['extname'](_0x290948[_0xfd8d('0x58')][_0xfd8d('0x56')])[_0xfd8d('0x5a')](0x1),'converted_format':_0xfd8d('0x5b')};var _0x31c7ab=path['join'](config[_0xfd8d('0x4f')],_0xfd8d('0x5c'),_0x290948[_0xfd8d('0x58')]['filename']);var _0x502d9c=path[_0xfd8d('0x4e')](config[_0xfd8d('0x4f')],_0xfd8d('0x50'),util[_0xfd8d('0x54')](_0xfd8d('0x53'),path['basename'](_0x290948['file']['filename'],path['extname'](_0x290948[_0xfd8d('0x58')][_0xfd8d('0x59')])),_0x73a02f[_0xfd8d('0x4c')]));logger['info']('Sound\x20upload\x20filepath:\x20%s',_0x31c7ab);logger[_0xfd8d('0x5d')](_0xfd8d('0x5e'),_0x502d9c);try{fs[_0xfd8d('0x5f')](_0x31c7ab,parseInt(_0xfd8d('0x60'),0x8));var _0x57418e=sox[_0xfd8d('0x61')](_0x31c7ab,_0x502d9c,{'sampleRate':0x1f40,'format':_0xfd8d('0x5b'),'channelCount':0x1,'bitRate':0xc0*0x400,'compressionQuality':0x5});_0x57418e['on'](_0xfd8d('0x62'),function(_0x4efeba){fs[_0xfd8d('0x63')](_0x31c7ab);_0x2015f9[_0xfd8d('0x19')](0x1f4)['send'](_0x4efeba);});_0x57418e['on'](_0xfd8d('0x64'),function(_0x105420){_0x73a02f[_0xfd8d('0x65')]=isNaN(_0x105420[_0xfd8d('0x66')])?null:_0x105420[_0xfd8d('0x66')]*0x3e8;_0x73a02f[_0xfd8d('0x67')]=isNaN(_0x105420[_0xfd8d('0x68')])?null:_0x105420[_0xfd8d('0x68')];_0x73a02f[_0xfd8d('0x69')]=isNaN(_0x105420[_0xfd8d('0x6a')])?null:_0x105420[_0xfd8d('0x6a')];_0x73a02f[_0xfd8d('0x6b')]=isNaN(_0x105420[_0xfd8d('0x6c')])?null:_0x105420[_0xfd8d('0x6c')];_0x73a02f['original_sampleRate']=isNaN(_0x105420[_0xfd8d('0x6d')])?null:_0x105420[_0xfd8d('0x6d')];});_0x57418e['on'](_0xfd8d('0x6e'),function(_0x474276){_0x73a02f[_0xfd8d('0x6f')]=isNaN(_0x474276[_0xfd8d('0x66')])?null:_0x474276[_0xfd8d('0x66')]*0x3e8;_0x73a02f[_0xfd8d('0x70')]=isNaN(_0x474276[_0xfd8d('0x68')])?null:_0x474276[_0xfd8d('0x68')];_0x73a02f[_0xfd8d('0x71')]=isNaN(_0x474276[_0xfd8d('0x6a')])?null:_0x474276[_0xfd8d('0x6a')];_0x73a02f[_0xfd8d('0x72')]=isNaN(_0x474276[_0xfd8d('0x6c')])?null:_0x474276[_0xfd8d('0x6c')];_0x73a02f[_0xfd8d('0x73')]=isNaN(_0x474276['sampleRate'])?null:_0x474276[_0xfd8d('0x6d')];});_0x57418e['on'](_0xfd8d('0x1a'),function(){fs[_0xfd8d('0x5f')](_0x502d9c,parseInt(_0xfd8d('0x60'),0x8));return db['Sound'][_0xfd8d('0x55')](_0x73a02f)[_0xfd8d('0x23')](function(_0x71c86c){var _0x198fca={'role':_0x290948[_0xfd8d('0x74')][_0xfd8d('0x75')],'userProfileId':_0x290948['body']['userProfileId']};if(!_0x198fca)throw new Error('Unable\x20to\x20retrieve\x20the\x20current\x20user');if(_0x198fca[_0xfd8d('0x75')]==='user'){var _0xc9f486=_0x71c86c[_0xfd8d('0x25')]({'plain':!![]});return db[_0xfd8d('0x76')][_0xfd8d('0x48')]({'where':{'name':_0xfd8d('0x26'),'userProfileId':_0x198fca[_0xfd8d('0x77')]},'raw':!![]})['then'](function(_0x38190f){if(_0x38190f&&_0x38190f[_0xfd8d('0x78')]===0x0){return db[_0xfd8d('0x27')]['create']({'name':_0xc9f486['name'],'resourceId':_0xc9f486['id'],'type':_0x38190f['name'],'sectionId':_0x38190f['id']},{})[_0xfd8d('0x23')](function(){return _0x71c86c;});}else{return _0x71c86c;}})['catch'](function(_0xf1cc5){logger[_0xfd8d('0x62')](_0xfd8d('0x79'),_0xf1cc5);throw _0xf1cc5;});}return _0x71c86c;})['then'](respondWithResult(_0x2015f9,null))['catch'](handleError(_0x2015f9,null));});_0x57418e[_0xfd8d('0x7a')]();}catch(_0x13f078){_0x2015f9[_0xfd8d('0x19')](0x1f4)[_0xfd8d('0x2a')](_0x13f078);}};exports[_0xfd8d('0x7b')]=function(_0x44b69d,_0x31542b,_0x3c7a80){return db[_0xfd8d('0x2d')][_0xfd8d('0x48')]({'where':{'id':_0x44b69d['params']['id']}})[_0xfd8d('0x23')](handleEntityNotFound(_0x31542b,null))[_0xfd8d('0x23')](saveUpdates(_['pick'](_0x44b69d['body'],[_0xfd8d('0x29'),'description']),null))[_0xfd8d('0x23')](respondWithResult(_0x31542b,null))[_0xfd8d('0x45')](handleError(_0x31542b,null));};exports[_0xfd8d('0x7c')]=function(_0x88ab5c,_0x5a83dc,_0x1f5fc1){return db[_0xfd8d('0x2d')][_0xfd8d('0x48')]({'where':{'id':_0x88ab5c[_0xfd8d('0x4a')]['id']}})[_0xfd8d('0x23')](function(_0x53fb9e){if(_0x53fb9e){return _0x53fb9e['destroy']();}})[_0xfd8d('0x23')](function(_0x25d8bd){var _0x56a05f=path[_0xfd8d('0x4e')](config[_0xfd8d('0x4f')],'server/files/sounds/original',util[_0xfd8d('0x54')]('%s.%s',_0x25d8bd['save_name'],_0x25d8bd[_0xfd8d('0x7d')]));var _0x3a3a26=path[_0xfd8d('0x4e')](config[_0xfd8d('0x4f')],'server/files/sounds/converted',util[_0xfd8d('0x54')](_0xfd8d('0x53'),_0x25d8bd['save_name'],_0x25d8bd[_0xfd8d('0x4c')]));fs[_0xfd8d('0x63')](_0x56a05f);fs['unlinkSync'](_0x3a3a26);return _0x25d8bd;})['then'](function(_0xa650c){if(_0xa650c){return _0x5a83dc[_0xfd8d('0x19')](0xcc)[_0xfd8d('0x1a')]();}})[_0xfd8d('0x23')](handleEntityNotFound(_0x5a83dc,null))[_0xfd8d('0x45')](handleError(_0x5a83dc,null));}; \ No newline at end of file +var _0x8e94=['body','userProfileId','Unable\x20to\x20retrieve\x20the\x20current\x20user','user','autoAssociation','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','start','description','delete','rimraf','fast-json-patch','request-promise','moment','bluebird','mustache','util','path','sox','ejs','fs-extra','crypto','jsforce','desk.js','to-csv','querystring','papaparse','../../components/auth/service','../../components/parsers/qs','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/environment','../../mysqldb','sendStatus','status','json','offset','undefined','limit','count','set','Content-Range','apply','reject','save','update','then','destroy','get','Sounds','UserProfileResource','end','error','stack','name','send','index','map','fieldName','model','query','keys','filters','fields','attributes','length','hasOwnProperty','nolimit','order','sort','where','pick','filter','merge','type','VIRTUAL','Sound','includeAll','findAll','show','params','rawAttributes','intersection','include','options','find','catch','save_name','join','server/files/sounds/converted','Sequelize','ValidationError','Sound\x20not\x20found','download','root','format','converted_format','%s.%s','create','basename','file','originalname','extname','filename','substring','wav','server/files/sounds/original','Sound\x20upload\x20filepath:\x20%s','info','Sound\x20upload\x20destination:\x20%s','chmodSync','0777','transcode','unlinkSync','src','duration','sampleCount','original_channelCount','channelCount','original_bitRate','bitRate','original_sampleRate','sampleRate','converted_duration','converted_sampleCount','converted_channelCount','converted_bitRate','converted_sampleRate','role'];(function(_0x3f22da,_0x1d4efd){var _0x1975bb=function(_0x586f31){while(--_0x586f31){_0x3f22da['push'](_0x3f22da['shift']());}};_0x1975bb(++_0x1d4efd);}(_0x8e94,0x18f));var _0x48e9=function(_0x8af54b,_0x280be5){_0x8af54b=_0x8af54b-0x0;var _0x27d8f0=_0x8e94[_0x8af54b];return _0x27d8f0;};'use strict';var emlformat=require('eml-format');var rimraf=require(_0x48e9('0x0'));var zipdir=require('zip-dir');var jsonpatch=require(_0x48e9('0x1'));var rp=require(_0x48e9('0x2'));var moment=require(_0x48e9('0x3'));var BPromise=require(_0x48e9('0x4'));var Mustache=require(_0x48e9('0x5'));var util=require(_0x48e9('0x6'));var path=require(_0x48e9('0x7'));var sox=require(_0x48e9('0x8'));var csv=require('to-csv');var ejs=require(_0x48e9('0x9'));var fs=require('fs');var fs_extra=require(_0x48e9('0xa'));var _=require('lodash');var squel=require('squel');var crypto=require(_0x48e9('0xb'));var jsforce=require(_0x48e9('0xc'));var deskjs=require(_0x48e9('0xd'));var toCsv=require(_0x48e9('0xe'));var querystring=require(_0x48e9('0xf'));var Papa=require(_0x48e9('0x10'));var Redis=require('ioredis');var authService=require(_0x48e9('0x11'));var qs=require(_0x48e9('0x12'));var as=require('../../components/parsers/advancedSearch');var hardwareService=require(_0x48e9('0x13'));var logger=require(_0x48e9('0x14'))(_0x48e9('0x15'));var utils=require(_0x48e9('0x16'));var config=require(_0x48e9('0x17'));var licenseUtil=require('../../config/license/util');var db=require(_0x48e9('0x18'))['db'];function respondWithStatusCode(_0x3b7d33,_0x16b5ed){_0x16b5ed=_0x16b5ed||0xcc;return function(_0x43c4bf){if(_0x43c4bf){return _0x3b7d33[_0x48e9('0x19')](_0x16b5ed);}return _0x3b7d33[_0x48e9('0x1a')](_0x16b5ed)['end']();};}function respondWithResult(_0x5877d3,_0x160d4d){_0x160d4d=_0x160d4d||0xc8;return function(_0x244391){if(_0x244391){return _0x5877d3['status'](_0x160d4d)[_0x48e9('0x1b')](_0x244391);}};}function respondWithFilteredResult(_0x16ee3c,_0x4d9419){return function(_0x36cd4d){if(_0x36cd4d){var _0x1f1131=typeof _0x4d9419[_0x48e9('0x1c')]===_0x48e9('0x1d')&&typeof _0x4d9419[_0x48e9('0x1e')]===_0x48e9('0x1d');var _0x22e804=_0x36cd4d[_0x48e9('0x1f')];var _0x3f6cd8=_0x1f1131?0x0:_0x4d9419[_0x48e9('0x1c')];var _0x3cbfd6=_0x1f1131?_0x36cd4d['count']:_0x4d9419['offset']+_0x4d9419['limit'];var _0x145dc0;if(_0x3cbfd6>=_0x22e804){_0x3cbfd6=_0x22e804;_0x145dc0=0xc8;}else{_0x145dc0=0xce;}_0x16ee3c[_0x48e9('0x1a')](_0x145dc0);return _0x16ee3c[_0x48e9('0x20')](_0x48e9('0x21'),_0x3f6cd8+'-'+_0x3cbfd6+'/'+_0x22e804)[_0x48e9('0x1b')](_0x36cd4d);}return null;};}function patchUpdates(_0x26b292){return function(_0x46dd1a){try{jsonpatch[_0x48e9('0x22')](_0x46dd1a,_0x26b292,!![]);}catch(_0x197522){return BPromise[_0x48e9('0x23')](_0x197522);}return _0x46dd1a[_0x48e9('0x24')]();};}function saveUpdates(_0x316c21,_0x34a790){return function(_0x6aba1f){if(_0x6aba1f){return _0x6aba1f[_0x48e9('0x25')](_0x316c21)[_0x48e9('0x26')](function(_0x3a6449){return _0x3a6449;});}return null;};}function removeEntity(_0x45053d,_0x8b843a){return function(_0x3d4acd){if(_0x3d4acd){return _0x3d4acd[_0x48e9('0x27')]()[_0x48e9('0x26')](function(){var _0x33bf36=_0x3d4acd[_0x48e9('0x28')]({'plain':!![]});var _0xa5e68=_0x48e9('0x29');return db[_0x48e9('0x2a')]['destroy']({'where':{'type':_0xa5e68,'resourceId':_0x33bf36['id']}})[_0x48e9('0x26')](function(){return _0x3d4acd;});})['then'](function(){_0x45053d[_0x48e9('0x1a')](0xcc)[_0x48e9('0x2b')]();});}};}function handleEntityNotFound(_0x3cce2e,_0x442227){return function(_0x2fc77f){if(!_0x2fc77f){_0x3cce2e[_0x48e9('0x19')](0x194);}return _0x2fc77f;};}function handleError(_0x1662ce,_0x11b73b){_0x11b73b=_0x11b73b||0x1f4;return function(_0xdf3a8e){logger[_0x48e9('0x2c')](_0xdf3a8e[_0x48e9('0x2d')]);if(_0xdf3a8e[_0x48e9('0x2e')]){delete _0xdf3a8e[_0x48e9('0x2e')];}_0x1662ce[_0x48e9('0x1a')](_0x11b73b)[_0x48e9('0x2f')](_0xdf3a8e);};}exports[_0x48e9('0x30')]=function(_0x2cad10,_0x46caa2){var _0x4360d4={},_0x2ce670={},_0x550bb2={'count':0x0,'rows':[]};var _0x36a1c6=_[_0x48e9('0x31')](db['Sound']['rawAttributes'],function(_0x534900){return{'name':_0x534900[_0x48e9('0x32')],'type':_0x534900['type']['key']};});_0x2ce670[_0x48e9('0x33')]=_[_0x48e9('0x31')](_0x36a1c6,_0x48e9('0x2e'));_0x2ce670[_0x48e9('0x34')]=_[_0x48e9('0x35')](_0x2cad10['query']);_0x2ce670[_0x48e9('0x36')]=_['intersection'](_0x2ce670[_0x48e9('0x33')],_0x2ce670[_0x48e9('0x34')]);_0x4360d4['attributes']=_['intersection'](_0x2ce670[_0x48e9('0x33')],qs[_0x48e9('0x37')](_0x2cad10[_0x48e9('0x34')]['fields']));_0x4360d4['attributes']=_0x4360d4[_0x48e9('0x38')][_0x48e9('0x39')]?_0x4360d4[_0x48e9('0x38')]:_0x2ce670[_0x48e9('0x33')];if(!_0x2cad10['query'][_0x48e9('0x3a')](_0x48e9('0x3b'))){_0x4360d4[_0x48e9('0x1e')]=qs[_0x48e9('0x1e')](_0x2cad10[_0x48e9('0x34')][_0x48e9('0x1e')]);_0x4360d4[_0x48e9('0x1c')]=qs[_0x48e9('0x1c')](_0x2cad10[_0x48e9('0x34')][_0x48e9('0x1c')]);}_0x4360d4[_0x48e9('0x3c')]=qs[_0x48e9('0x3d')](_0x2cad10[_0x48e9('0x34')][_0x48e9('0x3d')]);_0x4360d4[_0x48e9('0x3e')]=qs['filters'](_[_0x48e9('0x3f')](_0x2cad10[_0x48e9('0x34')],_0x2ce670[_0x48e9('0x36')]),_0x36a1c6);if(_0x2cad10[_0x48e9('0x34')][_0x48e9('0x40')]){_0x4360d4[_0x48e9('0x3e')]=_[_0x48e9('0x41')](_0x4360d4[_0x48e9('0x3e')],{'$or':_[_0x48e9('0x31')](_0x36a1c6,function(_0x2f5b92){if(_0x2f5b92[_0x48e9('0x42')]!==_0x48e9('0x43')){var _0x1d6208={};_0x1d6208[_0x2f5b92['name']]={'$like':'%'+_0x2cad10['query'][_0x48e9('0x40')]+'%'};return _0x1d6208;}})});}_0x4360d4=_[_0x48e9('0x41')]({},_0x4360d4,_0x2cad10['options']);var _0xfb1b8a={'where':_0x4360d4[_0x48e9('0x3e')]};return db[_0x48e9('0x44')][_0x48e9('0x1f')](_0xfb1b8a)[_0x48e9('0x26')](function(_0xe35e9d){_0x550bb2[_0x48e9('0x1f')]=_0xe35e9d;if(_0x2cad10[_0x48e9('0x34')][_0x48e9('0x45')]){_0x4360d4['include']=[{'all':!![]}];}return db[_0x48e9('0x44')][_0x48e9('0x46')](_0x4360d4);})[_0x48e9('0x26')](function(_0x1f2b02){_0x550bb2['rows']=_0x1f2b02;return _0x550bb2;})[_0x48e9('0x26')](respondWithFilteredResult(_0x46caa2,_0x4360d4))['catch'](handleError(_0x46caa2,null));};exports[_0x48e9('0x47')]=function(_0x22ec5f,_0x4f9a18){var _0x389ec3={'raw':!![],'where':{'id':_0x22ec5f[_0x48e9('0x48')]['id']}},_0x495512={};_0x495512[_0x48e9('0x33')]=_[_0x48e9('0x35')](db[_0x48e9('0x44')][_0x48e9('0x49')]);_0x495512['query']=_[_0x48e9('0x35')](_0x22ec5f[_0x48e9('0x34')]);_0x495512[_0x48e9('0x36')]=_['intersection'](_0x495512[_0x48e9('0x33')],_0x495512[_0x48e9('0x34')]);_0x389ec3[_0x48e9('0x38')]=_[_0x48e9('0x4a')](_0x495512[_0x48e9('0x33')],qs['fields'](_0x22ec5f[_0x48e9('0x34')][_0x48e9('0x37')]));_0x389ec3[_0x48e9('0x38')]=_0x389ec3[_0x48e9('0x38')]['length']?_0x389ec3['attributes']:_0x495512[_0x48e9('0x33')];if(_0x22ec5f[_0x48e9('0x34')][_0x48e9('0x45')]){_0x389ec3[_0x48e9('0x4b')]=[{'all':!![]}];}_0x389ec3=_['merge']({},_0x389ec3,_0x22ec5f[_0x48e9('0x4c')]);return db[_0x48e9('0x44')][_0x48e9('0x4d')](_0x389ec3)[_0x48e9('0x26')](handleEntityNotFound(_0x4f9a18,null))[_0x48e9('0x26')](respondWithResult(_0x4f9a18,null))[_0x48e9('0x4e')](handleError(_0x4f9a18,null));};exports['download']=function(_0x588d6a,_0x3b3072,_0x42666d){return db[_0x48e9('0x44')][_0x48e9('0x4d')]({'where':{'id':_0x588d6a[_0x48e9('0x48')]['id']},'attributes':[_0x48e9('0x2e'),_0x48e9('0x4f'),'converted_format'],'raw':!![]})[_0x48e9('0x26')](handleEntityNotFound(_0x3b3072,null))[_0x48e9('0x26')](function(_0x12eb33){if(_0x12eb33){if(!fs['existsSync'](path[_0x48e9('0x50')](config['root'],_0x48e9('0x51'),_0x12eb33[_0x48e9('0x4f')]+'.'+_0x12eb33['converted_format']))){throw new db[(_0x48e9('0x52'))][(_0x48e9('0x53'))](_0x48e9('0x54'));}return _0x3b3072[_0x48e9('0x55')](path['join'](config[_0x48e9('0x56')],'server/files/sounds/converted',util[_0x48e9('0x57')]('%s.%s',_0x12eb33['save_name'],_0x12eb33[_0x48e9('0x58')])),util[_0x48e9('0x57')](_0x48e9('0x59'),_0x12eb33[_0x48e9('0x2e')],_0x12eb33[_0x48e9('0x58')]));}return null;})[_0x48e9('0x4e')](handleError(_0x3b3072,null));};exports[_0x48e9('0x5a')]=function(_0x408a79,_0x52fedb,_0x48d9a1){var _0x57ab32={'name':path[_0x48e9('0x5b')](_0x408a79[_0x48e9('0x5c')][_0x48e9('0x5d')],path[_0x48e9('0x5e')](_0x408a79[_0x48e9('0x5c')][_0x48e9('0x5d')])),'save_name':path[_0x48e9('0x5b')](_0x408a79[_0x48e9('0x5c')][_0x48e9('0x5f')],path[_0x48e9('0x5e')](_0x408a79[_0x48e9('0x5c')][_0x48e9('0x5f')])),'original_format':path[_0x48e9('0x5e')](_0x408a79[_0x48e9('0x5c')]['originalname'])[_0x48e9('0x60')](0x1),'converted_format':_0x48e9('0x61')};var _0x10894e=path[_0x48e9('0x50')](config[_0x48e9('0x56')],_0x48e9('0x62'),_0x408a79[_0x48e9('0x5c')]['filename']);var _0x3fa41e=path['join'](config[_0x48e9('0x56')],_0x48e9('0x51'),util['format'](_0x48e9('0x59'),path[_0x48e9('0x5b')](_0x408a79['file'][_0x48e9('0x5f')],path[_0x48e9('0x5e')](_0x408a79[_0x48e9('0x5c')][_0x48e9('0x5f')])),_0x57ab32[_0x48e9('0x58')]));logger['info'](_0x48e9('0x63'),_0x10894e);logger[_0x48e9('0x64')](_0x48e9('0x65'),_0x3fa41e);try{fs[_0x48e9('0x66')](_0x10894e,parseInt(_0x48e9('0x67'),0x8));var _0x54bc7e=sox[_0x48e9('0x68')](_0x10894e,_0x3fa41e,{'sampleRate':0x1f40,'format':_0x48e9('0x61'),'channelCount':0x1,'bitRate':0xc0*0x400,'compressionQuality':0x5});_0x54bc7e['on'](_0x48e9('0x2c'),function(_0xe2de30){fs[_0x48e9('0x69')](_0x10894e);_0x52fedb['status'](0x1f4)[_0x48e9('0x2f')](_0xe2de30);});_0x54bc7e['on'](_0x48e9('0x6a'),function(_0x55ff4d){_0x57ab32['original_duration']=isNaN(_0x55ff4d[_0x48e9('0x6b')])?null:_0x55ff4d['duration']*0x3e8;_0x57ab32['original_sampleCount']=isNaN(_0x55ff4d[_0x48e9('0x6c')])?null:_0x55ff4d[_0x48e9('0x6c')];_0x57ab32[_0x48e9('0x6d')]=isNaN(_0x55ff4d[_0x48e9('0x6e')])?null:_0x55ff4d[_0x48e9('0x6e')];_0x57ab32[_0x48e9('0x6f')]=isNaN(_0x55ff4d['bitRate'])?null:_0x55ff4d[_0x48e9('0x70')];_0x57ab32[_0x48e9('0x71')]=isNaN(_0x55ff4d[_0x48e9('0x72')])?null:_0x55ff4d[_0x48e9('0x72')];});_0x54bc7e['on']('dest',function(_0x4cfec0){_0x57ab32[_0x48e9('0x73')]=isNaN(_0x4cfec0[_0x48e9('0x6b')])?null:_0x4cfec0[_0x48e9('0x6b')]*0x3e8;_0x57ab32[_0x48e9('0x74')]=isNaN(_0x4cfec0[_0x48e9('0x6c')])?null:_0x4cfec0[_0x48e9('0x6c')];_0x57ab32[_0x48e9('0x75')]=isNaN(_0x4cfec0['channelCount'])?null:_0x4cfec0[_0x48e9('0x6e')];_0x57ab32[_0x48e9('0x76')]=isNaN(_0x4cfec0[_0x48e9('0x70')])?null:_0x4cfec0[_0x48e9('0x70')];_0x57ab32[_0x48e9('0x77')]=isNaN(_0x4cfec0[_0x48e9('0x72')])?null:_0x4cfec0[_0x48e9('0x72')];});_0x54bc7e['on'](_0x48e9('0x2b'),function(){fs[_0x48e9('0x66')](_0x3fa41e,parseInt(_0x48e9('0x67'),0x8));return db[_0x48e9('0x44')][_0x48e9('0x5a')](_0x57ab32)[_0x48e9('0x26')](function(_0x475db8){var _0x4a4770={'role':_0x408a79['body'][_0x48e9('0x78')],'userProfileId':_0x408a79[_0x48e9('0x79')][_0x48e9('0x7a')]};if(!_0x4a4770)throw new Error(_0x48e9('0x7b'));if(_0x4a4770['role']===_0x48e9('0x7c')){var _0x36e908=_0x475db8['get']({'plain':!![]});return db['UserProfileSection'][_0x48e9('0x4d')]({'where':{'name':_0x48e9('0x29'),'userProfileId':_0x4a4770[_0x48e9('0x7a')]},'raw':!![]})[_0x48e9('0x26')](function(_0x7a551d){if(_0x7a551d&&_0x7a551d[_0x48e9('0x7d')]===0x0){return db['UserProfileResource'][_0x48e9('0x5a')]({'name':_0x36e908[_0x48e9('0x2e')],'resourceId':_0x36e908['id'],'type':_0x7a551d['name'],'sectionId':_0x7a551d['id']},{})[_0x48e9('0x26')](function(){return _0x475db8;});}else{return _0x475db8;}})[_0x48e9('0x4e')](function(_0xcd8d0d){logger[_0x48e9('0x2c')](_0x48e9('0x7e'),_0xcd8d0d);throw _0xcd8d0d;});}return _0x475db8;})['then'](respondWithResult(_0x52fedb,null))[_0x48e9('0x4e')](handleError(_0x52fedb,null));});_0x54bc7e[_0x48e9('0x7f')]();}catch(_0x5cb309){_0x52fedb[_0x48e9('0x1a')](0x1f4)[_0x48e9('0x2f')](_0x5cb309);}};exports[_0x48e9('0x25')]=function(_0x74826a,_0x272daa,_0x464f54){return db[_0x48e9('0x44')][_0x48e9('0x4d')]({'where':{'id':_0x74826a['params']['id']}})[_0x48e9('0x26')](handleEntityNotFound(_0x272daa,null))['then'](saveUpdates(_[_0x48e9('0x3f')](_0x74826a[_0x48e9('0x79')],[_0x48e9('0x2e'),_0x48e9('0x80')]),null))[_0x48e9('0x26')](respondWithResult(_0x272daa,null))[_0x48e9('0x4e')](handleError(_0x272daa,null));};exports[_0x48e9('0x81')]=function(_0x595ff4,_0x3b716f,_0x4926c0){return db[_0x48e9('0x44')][_0x48e9('0x4d')]({'where':{'id':_0x595ff4['params']['id']}})['then'](function(_0x4e3a4d){if(_0x4e3a4d){return _0x4e3a4d[_0x48e9('0x27')]();}})[_0x48e9('0x26')](function(_0x164dd0){var _0x46e11f=path[_0x48e9('0x50')](config['root'],_0x48e9('0x62'),util[_0x48e9('0x57')](_0x48e9('0x59'),_0x164dd0[_0x48e9('0x4f')],_0x164dd0['original_format']));var _0x8ba658=path[_0x48e9('0x50')](config[_0x48e9('0x56')],_0x48e9('0x51'),util[_0x48e9('0x57')](_0x48e9('0x59'),_0x164dd0[_0x48e9('0x4f')],_0x164dd0['converted_format']));fs[_0x48e9('0x69')](_0x46e11f);fs['unlinkSync'](_0x8ba658);return _0x164dd0;})[_0x48e9('0x26')](function(_0x4be2f4){if(_0x4be2f4){return _0x3b716f[_0x48e9('0x1a')](0xcc)[_0x48e9('0x2b')]();}})[_0x48e9('0x26')](handleEntityNotFound(_0x3b716f,null))[_0x48e9('0x4e')](handleError(_0x3b716f,null));}; \ No newline at end of file diff --git a/server/api/sound/sound.model.js b/server/api/sound/sound.model.js index 2def494..c719361 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 _0x3ea8=['path','../../config/environment','./sound.attributes','exports','define','tools_sounds','lodash','util','../../config/logger','moment','bluebird','request-promise'];(function(_0x486f4a,_0x478dc7){var _0x135d99=function(_0x434008){while(--_0x434008){_0x486f4a['push'](_0x486f4a['shift']());}};_0x135d99(++_0x478dc7);}(_0x3ea8,0x1e6));var _0x83ea=function(_0x5abaa5,_0x370ebe){_0x5abaa5=_0x5abaa5-0x0;var _0xb2e8c9=_0x3ea8[_0x5abaa5];return _0xb2e8c9;};'use strict';var _=require(_0x83ea('0x0'));var util=require(_0x83ea('0x1'));var logger=require(_0x83ea('0x2'))('api');var moment=require(_0x83ea('0x3'));var BPromise=require(_0x83ea('0x4'));var rp=require(_0x83ea('0x5'));var fs=require('fs');var path=require(_0x83ea('0x6'));var rimraf=require('rimraf');var config=require(_0x83ea('0x7'));var attributes=require(_0x83ea('0x8'));module[_0x83ea('0x9')]=function(_0x4bec6e,_0x5d076f){return _0x4bec6e[_0x83ea('0xa')]('Sound',attributes,{'tableName':_0x83ea('0xb'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x80a4=['lodash','api','moment','bluebird','path','rimraf','../../config/environment','./sound.attributes','define','Sound','tools_sounds'];(function(_0x167d4a,_0x256fad){var _0x48bd5a=function(_0x27cade){while(--_0x27cade){_0x167d4a['push'](_0x167d4a['shift']());}};_0x48bd5a(++_0x256fad);}(_0x80a4,0x9a));var _0x480a=function(_0x28019c,_0x67743){_0x28019c=_0x28019c-0x0;var _0x48ca39=_0x80a4[_0x28019c];return _0x48ca39;};'use strict';var _=require(_0x480a('0x0'));var util=require('util');var logger=require('../../config/logger')(_0x480a('0x1'));var moment=require(_0x480a('0x2'));var BPromise=require(_0x480a('0x3'));var rp=require('request-promise');var fs=require('fs');var path=require(_0x480a('0x4'));var rimraf=require(_0x480a('0x5'));var config=require(_0x480a('0x6'));var attributes=require(_0x480a('0x7'));module['exports']=function(_0x3d409c,_0x559d44){return _0x3d409c[_0x480a('0x8')](_0x480a('0x9'),attributes,{'tableName':_0x480a('0xa'),'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 cd99d2b..0610bb1 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 _0x9177=['message','result','catch','ShowSound','Sound','find','options','where','attributes','map','include','model','stringify','lodash','moment','randomstring','ioredis','../../mysqldb','../../config/logger','../../config/environment','jayson/promise','client','http','then','info','Sound,\x20%s,\x20%s','request\x20sent','Sound,\x20%s,\x20%s,\x20%s','error','code'];(function(_0x19b1e6,_0x139998){var _0x2f228d=function(_0x3fd7c4){while(--_0x3fd7c4){_0x19b1e6['push'](_0x19b1e6['shift']());}};_0x2f228d(++_0x139998);}(_0x9177,0xa3));var _0x7917=function(_0x307d86,_0x9264f2){_0x307d86=_0x307d86-0x0;var _0x361745=_0x9177[_0x307d86];return _0x361745;};'use strict';var _=require(_0x7917('0x0'));var util=require('util');var moment=require(_0x7917('0x1'));var BPromise=require('bluebird');var rs=require(_0x7917('0x2'));var fs=require('fs');var Redis=require(_0x7917('0x3'));var db=require(_0x7917('0x4'))['db'];var utils=require('../../config/utils');var logger=require(_0x7917('0x5'))('rpc');var config=require(_0x7917('0x6'));var jayson=require(_0x7917('0x7'));var client=jayson[_0x7917('0x8')][_0x7917('0x9')]({'port':0x232a});function respondWithRpcPromise(_0x38fea0,_0x49c3bf,_0x4c1532){return new BPromise(function(_0x238f0b,_0x37cfc8){return client['request'](_0x38fea0,_0x4c1532)[_0x7917('0xa')](function(_0x1f9dc3){logger[_0x7917('0xb')](_0x7917('0xc'),_0x49c3bf,_0x7917('0xd'));logger['debug'](_0x7917('0xe'),_0x49c3bf,_0x7917('0xd'),JSON['stringify'](_0x1f9dc3));if(_0x1f9dc3[_0x7917('0xf')]){if(_0x1f9dc3[_0x7917('0xf')][_0x7917('0x10')]===0x1f4){logger[_0x7917('0xf')](_0x7917('0xc'),_0x49c3bf,_0x1f9dc3['error']['message']);return _0x37cfc8(_0x1f9dc3[_0x7917('0xf')][_0x7917('0x11')]);}logger['error'](_0x7917('0xc'),_0x49c3bf,_0x1f9dc3[_0x7917('0xf')][_0x7917('0x11')]);return _0x238f0b(_0x1f9dc3[_0x7917('0xf')][_0x7917('0x11')]);}else{logger[_0x7917('0xb')](_0x7917('0xc'),_0x49c3bf,_0x7917('0xd'));_0x238f0b(_0x1f9dc3[_0x7917('0x12')][_0x7917('0x11')]);}})[_0x7917('0x13')](function(_0x896566){logger['error'](_0x7917('0xc'),_0x49c3bf,_0x896566);_0x37cfc8(_0x896566);});});}exports[_0x7917('0x14')]=function(_0x2c3247){var _0x132214=this;return new Promise(function(_0x5944b5,_0x31ad2f){return db[_0x7917('0x15')][_0x7917('0x16')]({'raw':_0x2c3247['options']?_0x2c3247[_0x7917('0x17')]['raw']===undefined?!![]:![]:!![],'where':_0x2c3247[_0x7917('0x17')]?_0x2c3247[_0x7917('0x17')][_0x7917('0x18')]||null:null,'attributes':_0x2c3247['options']?_0x2c3247[_0x7917('0x17')][_0x7917('0x19')]||null:null,'include':_0x2c3247[_0x7917('0x17')]?_0x2c3247['options']['include']?_[_0x7917('0x1a')](_0x2c3247[_0x7917('0x17')][_0x7917('0x1b')],function(_0x3a4dee){return{'model':db[_0x3a4dee[_0x7917('0x1c')]],'as':_0x3a4dee['as'],'attributes':_0x3a4dee[_0x7917('0x19')],'include':_0x3a4dee['include']?_[_0x7917('0x1a')](_0x3a4dee[_0x7917('0x1b')],function(_0x5cfe8e){return{'model':db[_0x5cfe8e[_0x7917('0x1c')]],'as':_0x5cfe8e['as'],'attributes':_0x5cfe8e['attributes'],'include':_0x5cfe8e[_0x7917('0x1b')]?_[_0x7917('0x1a')](_0x5cfe8e['include'],function(_0x1ec47b){return{'model':db[_0x1ec47b[_0x7917('0x1c')]],'as':_0x1ec47b['as'],'attributes':_0x1ec47b['attributes']};}):[]};}):[]};}):[]:[]})[_0x7917('0xa')](function(_0x3c1825){logger[_0x7917('0xb')](_0x7917('0x14'),_0x2c3247);logger['debug'](_0x7917('0x14'),_0x2c3247,JSON[_0x7917('0x1d')](_0x3c1825));_0x5944b5(_0x3c1825);})[_0x7917('0x13')](function(_0x3696de){logger['error'](_0x7917('0x14'),_0x3696de[_0x7917('0x11')],_0x2c3247);_0x31ad2f(_0x132214[_0x7917('0xf')](0x1f4,_0x3696de[_0x7917('0x11')]));});});}; \ No newline at end of file +var _0xd5bd=['where','attributes','include','map','model','lodash','util','bluebird','ioredis','../../config/logger','rpc','http','request','then','request\x20sent','debug','stringify','error','Sound,\x20%s,\x20%s','message','info','catch','ShowSound','Sound','options','raw'];(function(_0x130a83,_0x4aa187){var _0x262b3c=function(_0x385163){while(--_0x385163){_0x130a83['push'](_0x130a83['shift']());}};_0x262b3c(++_0x4aa187);}(_0xd5bd,0x123));var _0xdd5b=function(_0x4fab1e,_0x34b507){_0x4fab1e=_0x4fab1e-0x0;var _0x59bf51=_0xd5bd[_0x4fab1e];return _0x59bf51;};'use strict';var _=require(_0xdd5b('0x0'));var util=require(_0xdd5b('0x1'));var moment=require('moment');var BPromise=require(_0xdd5b('0x2'));var rs=require('randomstring');var fs=require('fs');var Redis=require(_0xdd5b('0x3'));var db=require('../../mysqldb')['db'];var utils=require('../../config/utils');var logger=require(_0xdd5b('0x4'))(_0xdd5b('0x5'));var config=require('../../config/environment');var jayson=require('jayson/promise');var client=jayson['client'][_0xdd5b('0x6')]({'port':0x232a});function respondWithRpcPromise(_0x39166d,_0x295d84,_0xfacad){return new BPromise(function(_0x457e7d,_0x13a06b){return client[_0xdd5b('0x7')](_0x39166d,_0xfacad)[_0xdd5b('0x8')](function(_0x46ae3a){logger['info']('Sound,\x20%s,\x20%s',_0x295d84,_0xdd5b('0x9'));logger[_0xdd5b('0xa')]('Sound,\x20%s,\x20%s,\x20%s',_0x295d84,_0xdd5b('0x9'),JSON[_0xdd5b('0xb')](_0x46ae3a));if(_0x46ae3a['error']){if(_0x46ae3a[_0xdd5b('0xc')]['code']===0x1f4){logger[_0xdd5b('0xc')](_0xdd5b('0xd'),_0x295d84,_0x46ae3a[_0xdd5b('0xc')][_0xdd5b('0xe')]);return _0x13a06b(_0x46ae3a['error']['message']);}logger[_0xdd5b('0xc')](_0xdd5b('0xd'),_0x295d84,_0x46ae3a[_0xdd5b('0xc')][_0xdd5b('0xe')]);return _0x457e7d(_0x46ae3a[_0xdd5b('0xc')]['message']);}else{logger[_0xdd5b('0xf')](_0xdd5b('0xd'),_0x295d84,_0xdd5b('0x9'));_0x457e7d(_0x46ae3a['result'][_0xdd5b('0xe')]);}})[_0xdd5b('0x10')](function(_0x54de0e){logger[_0xdd5b('0xc')]('Sound,\x20%s,\x20%s',_0x295d84,_0x54de0e);_0x13a06b(_0x54de0e);});});}exports[_0xdd5b('0x11')]=function(_0x1f9fd8){var _0x57eb56=this;return new Promise(function(_0x30ce27,_0x4ad707){return db[_0xdd5b('0x12')]['find']({'raw':_0x1f9fd8[_0xdd5b('0x13')]?_0x1f9fd8[_0xdd5b('0x13')][_0xdd5b('0x14')]===undefined?!![]:![]:!![],'where':_0x1f9fd8[_0xdd5b('0x13')]?_0x1f9fd8[_0xdd5b('0x13')][_0xdd5b('0x15')]||null:null,'attributes':_0x1f9fd8['options']?_0x1f9fd8['options'][_0xdd5b('0x16')]||null:null,'include':_0x1f9fd8[_0xdd5b('0x13')]?_0x1f9fd8[_0xdd5b('0x13')][_0xdd5b('0x17')]?_[_0xdd5b('0x18')](_0x1f9fd8['options'][_0xdd5b('0x17')],function(_0x22507a){return{'model':db[_0x22507a[_0xdd5b('0x19')]],'as':_0x22507a['as'],'attributes':_0x22507a[_0xdd5b('0x16')],'include':_0x22507a[_0xdd5b('0x17')]?_[_0xdd5b('0x18')](_0x22507a[_0xdd5b('0x17')],function(_0x36661e){return{'model':db[_0x36661e[_0xdd5b('0x19')]],'as':_0x36661e['as'],'attributes':_0x36661e[_0xdd5b('0x16')],'include':_0x36661e[_0xdd5b('0x17')]?_[_0xdd5b('0x18')](_0x36661e[_0xdd5b('0x17')],function(_0xc99ea){return{'model':db[_0xc99ea['model']],'as':_0xc99ea['as'],'attributes':_0xc99ea[_0xdd5b('0x16')]};}):[]};}):[]};}):[]:[]})[_0xdd5b('0x8')](function(_0x2e89ea){logger['info'](_0xdd5b('0x11'),_0x1f9fd8);logger[_0xdd5b('0xa')](_0xdd5b('0x11'),_0x1f9fd8,JSON[_0xdd5b('0xb')](_0x2e89ea));_0x30ce27(_0x2e89ea);})[_0xdd5b('0x10')](function(_0x1c8d0f){logger[_0xdd5b('0xc')](_0xdd5b('0x11'),_0x1c8d0f['message'],_0x1f9fd8);_0x4ad707(_0x57eb56[_0xdd5b('0xc')](0x1f4,_0x1c8d0f['message']));});});}; \ No newline at end of file diff --git a/server/api/squareMessage/index.js b/server/api/squareMessage/index.js index f684ba1..8e15d96 100644 --- a/server/api/squareMessage/index.js +++ b/server/api/squareMessage/index.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0xbaf0=['connect-timeout','express','Router','fs-extra','../../components/interaction/service','../../config/environment','./squareMessage.controller','get','isAuthenticated','index','/:id','post','create','put','update','delete','destroy','exports','util','path'];(function(_0x996ad3,_0x3bd7ab){var _0x33f4ed=function(_0x416a65){while(--_0x416a65){_0x996ad3['push'](_0x996ad3['shift']());}};_0x33f4ed(++_0x3bd7ab);}(_0xbaf0,0x12a));var _0x0baf=function(_0x14add3,_0x13ce8d){_0x14add3=_0x14add3-0x0;var _0x4a174f=_0xbaf0[_0x14add3];return _0x4a174f;};'use strict';var multer=require('multer');var util=require(_0x0baf('0x0'));var path=require(_0x0baf('0x1'));var timeout=require(_0x0baf('0x2'));var express=require(_0x0baf('0x3'));var router=express[_0x0baf('0x4')]();var fs_extra=require(_0x0baf('0x5'));var auth=require('../../components/auth/service');var interaction=require(_0x0baf('0x6'));var config=require(_0x0baf('0x7'));var controller=require(_0x0baf('0x8'));router[_0x0baf('0x9')]('/',auth[_0x0baf('0xa')](),controller[_0x0baf('0xb')]);router[_0x0baf('0x9')](_0x0baf('0xc'),auth[_0x0baf('0xa')](),controller['show']);router[_0x0baf('0xd')]('/',auth['isAuthenticated'](),controller[_0x0baf('0xe')]);router[_0x0baf('0xf')](_0x0baf('0xc'),auth[_0x0baf('0xa')](),controller[_0x0baf('0x10')]);router[_0x0baf('0x11')](_0x0baf('0xc'),auth[_0x0baf('0xa')](),controller[_0x0baf('0x12')]);module[_0x0baf('0x13')]=router; \ No newline at end of file +var _0x5eb8=['fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','./squareMessage.controller','get','isAuthenticated','index','/:id','show','put','update','delete','exports','path','connect-timeout','express','Router'];(function(_0x5b2a45,_0x495f65){var _0x22b7f3=function(_0x151721){while(--_0x151721){_0x5b2a45['push'](_0x5b2a45['shift']());}};_0x22b7f3(++_0x495f65);}(_0x5eb8,0xb0));var _0x85eb=function(_0x519756,_0x288785){_0x519756=_0x519756-0x0;var _0x37047e=_0x5eb8[_0x519756];return _0x37047e;};'use strict';var multer=require('multer');var util=require('util');var path=require(_0x85eb('0x0'));var timeout=require(_0x85eb('0x1'));var express=require(_0x85eb('0x2'));var router=express[_0x85eb('0x3')]();var fs_extra=require(_0x85eb('0x4'));var auth=require(_0x85eb('0x5'));var interaction=require(_0x85eb('0x6'));var config=require(_0x85eb('0x7'));var controller=require(_0x85eb('0x8'));router[_0x85eb('0x9')]('/',auth[_0x85eb('0xa')](),controller[_0x85eb('0xb')]);router['get'](_0x85eb('0xc'),auth[_0x85eb('0xa')](),controller[_0x85eb('0xd')]);router['post']('/',auth[_0x85eb('0xa')](),controller['create']);router[_0x85eb('0xe')](_0x85eb('0xc'),auth[_0x85eb('0xa')](),controller[_0x85eb('0xf')]);router[_0x85eb('0x10')](_0x85eb('0xc'),auth[_0x85eb('0xa')](),controller['destroy']);module[_0x85eb('0x11')]=router; \ No newline at end of file diff --git a/server/api/squareMessage/squareMessage.attributes.js b/server/api/squareMessage/squareMessage.attributes.js index 97d083e..acb8000 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 _0xb948=['STRING','medium','out','exports'];(function(_0xae2118,_0x1a8b83){var _0x368efe=function(_0x366801){while(--_0x366801){_0xae2118['push'](_0xae2118['shift']());}};_0x368efe(++_0x1a8b83);}(_0xb948,0x12b));var _0x8b94=function(_0x1f3c56,_0x598757){_0x1f3c56=_0x1f3c56-0x0;var _0x569524=_0xb948[_0x1f3c56];return _0x569524;};'use strict';var Sequelize=require('sequelize');module[_0x8b94('0x0')]={'uniqueid':{'type':Sequelize[_0x8b94('0x1')]},'body':{'type':Sequelize['TEXT'](_0x8b94('0x2')),'allowNull':![]},'direction':{'type':Sequelize['ENUM']('in',_0x8b94('0x3')),'defaultValue':'out','allowNull':![]},'providerName':{'type':Sequelize[_0x8b94('0x1')]},'providerResponse':{'type':Sequelize['TEXT']}}; \ No newline at end of file +var _0x1a56=['ENUM','out','STRING','exports','TEXT','medium'];(function(_0x240ec7,_0x599d9c){var _0xf1c51e=function(_0x45b1de){while(--_0x45b1de){_0x240ec7['push'](_0x240ec7['shift']());}};_0xf1c51e(++_0x599d9c);}(_0x1a56,0x1c5));var _0x61a5=function(_0x2fbcf6,_0x2e7155){_0x2fbcf6=_0x2fbcf6-0x0;var _0x3e7265=_0x1a56[_0x2fbcf6];return _0x3e7265;};'use strict';var Sequelize=require('sequelize');module[_0x61a5('0x0')]={'uniqueid':{'type':Sequelize['STRING']},'body':{'type':Sequelize[_0x61a5('0x1')](_0x61a5('0x2')),'allowNull':![]},'direction':{'type':Sequelize[_0x61a5('0x3')]('in',_0x61a5('0x4')),'defaultValue':_0x61a5('0x4'),'allowNull':![]},'providerName':{'type':Sequelize[_0x61a5('0x5')]},'providerResponse':{'type':Sequelize[_0x61a5('0x1')]}}; \ No newline at end of file diff --git a/server/api/squareMessage/squareMessage.controller.js b/server/api/squareMessage/squareMessage.controller.js index efe3b6c..53f680f 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 _0x9153=['fast-json-patch','request-promise','moment','mustache','util','path','sox','ejs','squel','crypto','jsforce','desk.js','querystring','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','status','json','offset','undefined','count','set','Content-Range','reject','update','then','end','error','stack','name','send','map','rawAttributes','fieldName','type','keys','intersection','query','attributes','model','fields','hasOwnProperty','nolimit','limit','sort','where','filters','pick','filter','merge','VIRTUAL','options','SquareMessage','include','findAll','catch','show','params','includeAll','find','create','body','destroy','eml-format','rimraf','zip-dir'];(function(_0x5741e,_0x2a903c){var _0x347149=function(_0x1b7209){while(--_0x1b7209){_0x5741e['push'](_0x5741e['shift']());}};_0x347149(++_0x2a903c);}(_0x9153,0xd8));var _0x3915=function(_0x2627c7,_0x26416d){_0x2627c7=_0x2627c7-0x0;var _0x3e9d45=_0x9153[_0x2627c7];return _0x3e9d45;};'use strict';var emlformat=require(_0x3915('0x0'));var rimraf=require(_0x3915('0x1'));var zipdir=require(_0x3915('0x2'));var jsonpatch=require(_0x3915('0x3'));var rp=require(_0x3915('0x4'));var moment=require(_0x3915('0x5'));var BPromise=require('bluebird');var Mustache=require(_0x3915('0x6'));var util=require(_0x3915('0x7'));var path=require(_0x3915('0x8'));var sox=require(_0x3915('0x9'));var csv=require('to-csv');var ejs=require(_0x3915('0xa'));var fs=require('fs');var fs_extra=require('fs-extra');var _=require('lodash');var squel=require(_0x3915('0xb'));var crypto=require(_0x3915('0xc'));var jsforce=require(_0x3915('0xd'));var deskjs=require(_0x3915('0xe'));var toCsv=require('to-csv');var querystring=require(_0x3915('0xf'));var Papa=require('papaparse');var Redis=require('ioredis');var authService=require(_0x3915('0x10'));var qs=require(_0x3915('0x11'));var as=require(_0x3915('0x12'));var hardwareService=require(_0x3915('0x13'));var logger=require(_0x3915('0x14'))(_0x3915('0x15'));var utils=require(_0x3915('0x16'));var config=require(_0x3915('0x17'));var licenseUtil=require(_0x3915('0x18'));var db=require(_0x3915('0x19'))['db'];function respondWithStatusCode(_0x4d3877,_0x3ad7ab){_0x3ad7ab=_0x3ad7ab||0xcc;return function(_0x22d231){if(_0x22d231){return _0x4d3877['sendStatus'](_0x3ad7ab);}return _0x4d3877[_0x3915('0x1a')](_0x3ad7ab)['end']();};}function respondWithResult(_0x5d8ab4,_0x24f5e9){_0x24f5e9=_0x24f5e9||0xc8;return function(_0x30d85a){if(_0x30d85a){return _0x5d8ab4[_0x3915('0x1a')](_0x24f5e9)[_0x3915('0x1b')](_0x30d85a);}};}function respondWithFilteredResult(_0x4af9a2,_0xca4a4a){return function(_0x3b6224){if(_0x3b6224){var _0x39981a=typeof _0xca4a4a[_0x3915('0x1c')]===_0x3915('0x1d')&&typeof _0xca4a4a['limit']===_0x3915('0x1d');var _0x44266c=_0x3b6224[_0x3915('0x1e')];var _0x1ac327=_0x39981a?0x0:_0xca4a4a[_0x3915('0x1c')];var _0x473eb4=_0x39981a?_0x3b6224['count']:_0xca4a4a[_0x3915('0x1c')]+_0xca4a4a['limit'];var _0x596773;if(_0x473eb4>=_0x44266c){_0x473eb4=_0x44266c;_0x596773=0xc8;}else{_0x596773=0xce;}_0x4af9a2['status'](_0x596773);return _0x4af9a2[_0x3915('0x1f')](_0x3915('0x20'),_0x1ac327+'-'+_0x473eb4+'/'+_0x44266c)[_0x3915('0x1b')](_0x3b6224);}return null;};}function patchUpdates(_0x55e896){return function(_0x2160d3){try{jsonpatch['apply'](_0x2160d3,_0x55e896,!![]);}catch(_0x38428b){return BPromise[_0x3915('0x21')](_0x38428b);}return _0x2160d3['save']();};}function saveUpdates(_0x42ae2d,_0x400601){return function(_0x3d2df2){if(_0x3d2df2){return _0x3d2df2[_0x3915('0x22')](_0x42ae2d)[_0x3915('0x23')](function(_0x54fe09){return _0x54fe09;});}return null;};}function removeEntity(_0x26b001,_0x4b2fe8){return function(_0x8a2184){if(_0x8a2184){return _0x8a2184['destroy']()[_0x3915('0x23')](function(){_0x26b001[_0x3915('0x1a')](0xcc)[_0x3915('0x24')]();});}};}function handleEntityNotFound(_0x404532,_0x28ec1d){return function(_0x54afa8){if(!_0x54afa8){_0x404532['sendStatus'](0x194);}return _0x54afa8;};}function handleError(_0x16d999,_0xa83d37){_0xa83d37=_0xa83d37||0x1f4;return function(_0x3e6102){logger[_0x3915('0x25')](_0x3e6102[_0x3915('0x26')]);if(_0x3e6102[_0x3915('0x27')]){delete _0x3e6102['name'];}_0x16d999['status'](_0xa83d37)[_0x3915('0x28')](_0x3e6102);};}exports['index']=function(_0x3652b2,_0x2d735d){var _0x323ced={},_0x4233c5={},_0x4c04a4={'count':0x0,'rows':[]};var _0x2a98be=_[_0x3915('0x29')](db['SquareMessage'][_0x3915('0x2a')],function(_0x30818b){return{'name':_0x30818b[_0x3915('0x2b')],'type':_0x30818b[_0x3915('0x2c')]['key']};});_0x4233c5['model']=_[_0x3915('0x29')](_0x2a98be,_0x3915('0x27'));_0x4233c5['query']=_[_0x3915('0x2d')](_0x3652b2['query']);_0x4233c5['filters']=_[_0x3915('0x2e')](_0x4233c5['model'],_0x4233c5[_0x3915('0x2f')]);_0x323ced[_0x3915('0x30')]=_[_0x3915('0x2e')](_0x4233c5[_0x3915('0x31')],qs[_0x3915('0x32')](_0x3652b2[_0x3915('0x2f')][_0x3915('0x32')]));_0x323ced['attributes']=_0x323ced[_0x3915('0x30')]['length']?_0x323ced[_0x3915('0x30')]:_0x4233c5[_0x3915('0x31')];if(!_0x3652b2[_0x3915('0x2f')][_0x3915('0x33')](_0x3915('0x34'))){_0x323ced['limit']=qs[_0x3915('0x35')](_0x3652b2['query'][_0x3915('0x35')]);_0x323ced[_0x3915('0x1c')]=qs[_0x3915('0x1c')](_0x3652b2[_0x3915('0x2f')][_0x3915('0x1c')]);}_0x323ced['order']=qs[_0x3915('0x36')](_0x3652b2['query'][_0x3915('0x36')]);_0x323ced[_0x3915('0x37')]=qs[_0x3915('0x38')](_[_0x3915('0x39')](_0x3652b2[_0x3915('0x2f')],_0x4233c5[_0x3915('0x38')]),_0x2a98be);if(_0x3652b2[_0x3915('0x2f')][_0x3915('0x3a')]){_0x323ced[_0x3915('0x37')]=_[_0x3915('0x3b')](_0x323ced[_0x3915('0x37')],{'$or':_[_0x3915('0x29')](_0x2a98be,function(_0xda86c4){if(_0xda86c4[_0x3915('0x2c')]!==_0x3915('0x3c')){var _0x43fd0b={};_0x43fd0b[_0xda86c4[_0x3915('0x27')]]={'$like':'%'+_0x3652b2[_0x3915('0x2f')]['filter']+'%'};return _0x43fd0b;}})});}_0x323ced=_[_0x3915('0x3b')]({},_0x323ced,_0x3652b2[_0x3915('0x3d')]);var _0x22c8bb={'where':_0x323ced[_0x3915('0x37')]};return db[_0x3915('0x3e')]['count'](_0x22c8bb)[_0x3915('0x23')](function(_0x469d97){_0x4c04a4[_0x3915('0x1e')]=_0x469d97;if(_0x3652b2[_0x3915('0x2f')]['includeAll']){_0x323ced[_0x3915('0x3f')]=[{'all':!![]}];}return db['SquareMessage'][_0x3915('0x40')](_0x323ced);})[_0x3915('0x23')](function(_0x5b885f){_0x4c04a4['rows']=_0x5b885f;return _0x4c04a4;})[_0x3915('0x23')](respondWithFilteredResult(_0x2d735d,_0x323ced))[_0x3915('0x41')](handleError(_0x2d735d,null));};exports[_0x3915('0x42')]=function(_0xca63f4,_0x1d689b){var _0x11746f={'raw':!![],'where':{'id':_0xca63f4[_0x3915('0x43')]['id']}},_0x5cc10c={};_0x5cc10c[_0x3915('0x31')]=_[_0x3915('0x2d')](db['SquareMessage'][_0x3915('0x2a')]);_0x5cc10c[_0x3915('0x2f')]=_[_0x3915('0x2d')](_0xca63f4[_0x3915('0x2f')]);_0x5cc10c[_0x3915('0x38')]=_[_0x3915('0x2e')](_0x5cc10c[_0x3915('0x31')],_0x5cc10c[_0x3915('0x2f')]);_0x11746f[_0x3915('0x30')]=_[_0x3915('0x2e')](_0x5cc10c[_0x3915('0x31')],qs[_0x3915('0x32')](_0xca63f4['query'][_0x3915('0x32')]));_0x11746f[_0x3915('0x30')]=_0x11746f[_0x3915('0x30')]['length']?_0x11746f[_0x3915('0x30')]:_0x5cc10c['model'];if(_0xca63f4[_0x3915('0x2f')][_0x3915('0x44')]){_0x11746f[_0x3915('0x3f')]=[{'all':!![]}];}_0x11746f=_[_0x3915('0x3b')]({},_0x11746f,_0xca63f4['options']);return db[_0x3915('0x3e')][_0x3915('0x45')](_0x11746f)[_0x3915('0x23')](handleEntityNotFound(_0x1d689b,null))['then'](respondWithResult(_0x1d689b,null))[_0x3915('0x41')](handleError(_0x1d689b,null));};exports[_0x3915('0x46')]=function(_0x5dd4d4,_0x4d340a){return db[_0x3915('0x3e')][_0x3915('0x46')](_0x5dd4d4[_0x3915('0x47')],{})[_0x3915('0x23')](respondWithResult(_0x4d340a,0xc9))[_0x3915('0x41')](handleError(_0x4d340a,null));};exports[_0x3915('0x22')]=function(_0x399ece,_0x342cec){if(_0x399ece[_0x3915('0x47')]['id']){delete _0x399ece[_0x3915('0x47')]['id'];}return db[_0x3915('0x3e')]['find']({'where':{'id':_0x399ece[_0x3915('0x43')]['id']}})[_0x3915('0x23')](handleEntityNotFound(_0x342cec,null))[_0x3915('0x23')](saveUpdates(_0x399ece[_0x3915('0x47')],null))[_0x3915('0x23')](respondWithResult(_0x342cec,null))[_0x3915('0x41')](handleError(_0x342cec,null));};exports[_0x3915('0x48')]=function(_0x1e3242,_0x1c5542){return db[_0x3915('0x3e')][_0x3915('0x45')]({'where':{'id':_0x1e3242[_0x3915('0x43')]['id']}})[_0x3915('0x23')](handleEntityNotFound(_0x1c5542,null))['then'](removeEntity(_0x1c5542,null))[_0x3915('0x41')](handleError(_0x1c5542,null));}; \ No newline at end of file +var _0x5987=['moment','bluebird','mustache','util','path','sox','to-csv','fs-extra','squel','crypto','jsforce','desk.js','querystring','papaparse','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','../../config/environment','../../config/license/util','../../mysqldb','sendStatus','status','undefined','limit','count','Content-Range','json','apply','reject','save','then','destroy','end','stack','name','send','index','SquareMessage','rawAttributes','fieldName','key','model','keys','query','filters','intersection','fields','attributes','length','hasOwnProperty','nolimit','offset','order','sort','pick','where','merge','type','VIRTUAL','filter','options','includeAll','include','findAll','catch','show','params','find','create','body','update','eml-format','rimraf','zip-dir','fast-json-patch'];(function(_0x3dd15e,_0x1f0015){var _0x231fd0=function(_0x4f680a){while(--_0x4f680a){_0x3dd15e['push'](_0x3dd15e['shift']());}};_0x231fd0(++_0x1f0015);}(_0x5987,0x128));var _0x7598=function(_0x5b644e,_0x2e5e07){_0x5b644e=_0x5b644e-0x0;var _0x49c6bf=_0x5987[_0x5b644e];return _0x49c6bf;};'use strict';var emlformat=require(_0x7598('0x0'));var rimraf=require(_0x7598('0x1'));var zipdir=require(_0x7598('0x2'));var jsonpatch=require(_0x7598('0x3'));var rp=require('request-promise');var moment=require(_0x7598('0x4'));var BPromise=require(_0x7598('0x5'));var Mustache=require(_0x7598('0x6'));var util=require(_0x7598('0x7'));var path=require(_0x7598('0x8'));var sox=require(_0x7598('0x9'));var csv=require(_0x7598('0xa'));var ejs=require('ejs');var fs=require('fs');var fs_extra=require(_0x7598('0xb'));var _=require('lodash');var squel=require(_0x7598('0xc'));var crypto=require(_0x7598('0xd'));var jsforce=require(_0x7598('0xe'));var deskjs=require(_0x7598('0xf'));var toCsv=require(_0x7598('0xa'));var querystring=require(_0x7598('0x10'));var Papa=require(_0x7598('0x11'));var Redis=require('ioredis');var authService=require('../../components/auth/service');var qs=require('../../components/parsers/qs');var as=require(_0x7598('0x12'));var hardwareService=require(_0x7598('0x13'));var logger=require(_0x7598('0x14'))('api');var utils=require('../../config/utils');var config=require(_0x7598('0x15'));var licenseUtil=require(_0x7598('0x16'));var db=require(_0x7598('0x17'))['db'];function respondWithStatusCode(_0x1a92e9,_0x22cc20){_0x22cc20=_0x22cc20||0xcc;return function(_0x52bc43){if(_0x52bc43){return _0x1a92e9[_0x7598('0x18')](_0x22cc20);}return _0x1a92e9['status'](_0x22cc20)['end']();};}function respondWithResult(_0x3773cd,_0x16527e){_0x16527e=_0x16527e||0xc8;return function(_0x1608b8){if(_0x1608b8){return _0x3773cd[_0x7598('0x19')](_0x16527e)['json'](_0x1608b8);}};}function respondWithFilteredResult(_0x388b3f,_0x3d80be){return function(_0x353d18){if(_0x353d18){var _0x3282de=typeof _0x3d80be['offset']===_0x7598('0x1a')&&typeof _0x3d80be[_0x7598('0x1b')]===_0x7598('0x1a');var _0x1360bb=_0x353d18[_0x7598('0x1c')];var _0x2a62ed=_0x3282de?0x0:_0x3d80be['offset'];var _0x817355=_0x3282de?_0x353d18[_0x7598('0x1c')]:_0x3d80be['offset']+_0x3d80be[_0x7598('0x1b')];var _0x2bc78d;if(_0x817355>=_0x1360bb){_0x817355=_0x1360bb;_0x2bc78d=0xc8;}else{_0x2bc78d=0xce;}_0x388b3f['status'](_0x2bc78d);return _0x388b3f['set'](_0x7598('0x1d'),_0x2a62ed+'-'+_0x817355+'/'+_0x1360bb)[_0x7598('0x1e')](_0x353d18);}return null;};}function patchUpdates(_0x1ae307){return function(_0x42286f){try{jsonpatch[_0x7598('0x1f')](_0x42286f,_0x1ae307,!![]);}catch(_0x5902a9){return BPromise[_0x7598('0x20')](_0x5902a9);}return _0x42286f[_0x7598('0x21')]();};}function saveUpdates(_0x1d6e1b,_0x87e713){return function(_0xb76cfc){if(_0xb76cfc){return _0xb76cfc['update'](_0x1d6e1b)[_0x7598('0x22')](function(_0x3d7ff0){return _0x3d7ff0;});}return null;};}function removeEntity(_0x3ec8b1,_0x453901){return function(_0x384d1d){if(_0x384d1d){return _0x384d1d[_0x7598('0x23')]()['then'](function(){_0x3ec8b1['status'](0xcc)[_0x7598('0x24')]();});}};}function handleEntityNotFound(_0x5b4d1c,_0x557abd){return function(_0x316972){if(!_0x316972){_0x5b4d1c[_0x7598('0x18')](0x194);}return _0x316972;};}function handleError(_0x36d167,_0x48a9aa){_0x48a9aa=_0x48a9aa||0x1f4;return function(_0x48d719){logger['error'](_0x48d719[_0x7598('0x25')]);if(_0x48d719[_0x7598('0x26')]){delete _0x48d719[_0x7598('0x26')];}_0x36d167[_0x7598('0x19')](_0x48a9aa)[_0x7598('0x27')](_0x48d719);};}exports[_0x7598('0x28')]=function(_0x2d36fc,_0x4139bc){var _0x1b4965={},_0x468ff3={},_0x4e88ad={'count':0x0,'rows':[]};var _0x5218a2=_['map'](db[_0x7598('0x29')][_0x7598('0x2a')],function(_0x386ae4){return{'name':_0x386ae4[_0x7598('0x2b')],'type':_0x386ae4['type'][_0x7598('0x2c')]};});_0x468ff3[_0x7598('0x2d')]=_['map'](_0x5218a2,_0x7598('0x26'));_0x468ff3['query']=_[_0x7598('0x2e')](_0x2d36fc[_0x7598('0x2f')]);_0x468ff3[_0x7598('0x30')]=_['intersection'](_0x468ff3['model'],_0x468ff3[_0x7598('0x2f')]);_0x1b4965['attributes']=_[_0x7598('0x31')](_0x468ff3[_0x7598('0x2d')],qs[_0x7598('0x32')](_0x2d36fc[_0x7598('0x2f')]['fields']));_0x1b4965[_0x7598('0x33')]=_0x1b4965[_0x7598('0x33')][_0x7598('0x34')]?_0x1b4965[_0x7598('0x33')]:_0x468ff3[_0x7598('0x2d')];if(!_0x2d36fc[_0x7598('0x2f')][_0x7598('0x35')](_0x7598('0x36'))){_0x1b4965[_0x7598('0x1b')]=qs['limit'](_0x2d36fc[_0x7598('0x2f')]['limit']);_0x1b4965[_0x7598('0x37')]=qs[_0x7598('0x37')](_0x2d36fc[_0x7598('0x2f')][_0x7598('0x37')]);}_0x1b4965[_0x7598('0x38')]=qs[_0x7598('0x39')](_0x2d36fc[_0x7598('0x2f')][_0x7598('0x39')]);_0x1b4965['where']=qs['filters'](_[_0x7598('0x3a')](_0x2d36fc[_0x7598('0x2f')],_0x468ff3['filters']),_0x5218a2);if(_0x2d36fc['query']['filter']){_0x1b4965[_0x7598('0x3b')]=_[_0x7598('0x3c')](_0x1b4965['where'],{'$or':_['map'](_0x5218a2,function(_0x45e80e){if(_0x45e80e[_0x7598('0x3d')]!==_0x7598('0x3e')){var _0xa9a5b1={};_0xa9a5b1[_0x45e80e[_0x7598('0x26')]]={'$like':'%'+_0x2d36fc[_0x7598('0x2f')][_0x7598('0x3f')]+'%'};return _0xa9a5b1;}})});}_0x1b4965=_['merge']({},_0x1b4965,_0x2d36fc[_0x7598('0x40')]);var _0x58af71={'where':_0x1b4965['where']};return db[_0x7598('0x29')][_0x7598('0x1c')](_0x58af71)[_0x7598('0x22')](function(_0x53cf55){_0x4e88ad[_0x7598('0x1c')]=_0x53cf55;if(_0x2d36fc['query'][_0x7598('0x41')]){_0x1b4965[_0x7598('0x42')]=[{'all':!![]}];}return db['SquareMessage'][_0x7598('0x43')](_0x1b4965);})[_0x7598('0x22')](function(_0x1ca78c){_0x4e88ad['rows']=_0x1ca78c;return _0x4e88ad;})[_0x7598('0x22')](respondWithFilteredResult(_0x4139bc,_0x1b4965))[_0x7598('0x44')](handleError(_0x4139bc,null));};exports[_0x7598('0x45')]=function(_0xf3bfce,_0x155410){var _0x2e068b={'raw':!![],'where':{'id':_0xf3bfce[_0x7598('0x46')]['id']}},_0x102b91={};_0x102b91[_0x7598('0x2d')]=_['keys'](db[_0x7598('0x29')]['rawAttributes']);_0x102b91[_0x7598('0x2f')]=_[_0x7598('0x2e')](_0xf3bfce[_0x7598('0x2f')]);_0x102b91['filters']=_[_0x7598('0x31')](_0x102b91['model'],_0x102b91[_0x7598('0x2f')]);_0x2e068b[_0x7598('0x33')]=_[_0x7598('0x31')](_0x102b91[_0x7598('0x2d')],qs[_0x7598('0x32')](_0xf3bfce['query']['fields']));_0x2e068b[_0x7598('0x33')]=_0x2e068b[_0x7598('0x33')][_0x7598('0x34')]?_0x2e068b[_0x7598('0x33')]:_0x102b91['model'];if(_0xf3bfce[_0x7598('0x2f')]['includeAll']){_0x2e068b['include']=[{'all':!![]}];}_0x2e068b=_[_0x7598('0x3c')]({},_0x2e068b,_0xf3bfce[_0x7598('0x40')]);return db[_0x7598('0x29')][_0x7598('0x47')](_0x2e068b)['then'](handleEntityNotFound(_0x155410,null))[_0x7598('0x22')](respondWithResult(_0x155410,null))[_0x7598('0x44')](handleError(_0x155410,null));};exports[_0x7598('0x48')]=function(_0x1ed6c6,_0x2e002d){return db[_0x7598('0x29')][_0x7598('0x48')](_0x1ed6c6[_0x7598('0x49')],{})[_0x7598('0x22')](respondWithResult(_0x2e002d,0xc9))[_0x7598('0x44')](handleError(_0x2e002d,null));};exports[_0x7598('0x4a')]=function(_0x2efa18,_0x12c6a6){if(_0x2efa18['body']['id']){delete _0x2efa18['body']['id'];}return db['SquareMessage'][_0x7598('0x47')]({'where':{'id':_0x2efa18[_0x7598('0x46')]['id']}})[_0x7598('0x22')](handleEntityNotFound(_0x12c6a6,null))[_0x7598('0x22')](saveUpdates(_0x2efa18[_0x7598('0x49')],null))['then'](respondWithResult(_0x12c6a6,null))['catch'](handleError(_0x12c6a6,null));};exports[_0x7598('0x23')]=function(_0x33a6a5,_0x4f5a62){return db['SquareMessage']['find']({'where':{'id':_0x33a6a5[_0x7598('0x46')]['id']}})['then'](handleEntityNotFound(_0x4f5a62,null))['then'](removeEntity(_0x4f5a62,null))[_0x7598('0x44')](handleError(_0x4f5a62,null));}; \ No newline at end of file diff --git a/server/api/squareMessage/squareMessage.model.js b/server/api/squareMessage/squareMessage.model.js index e98acd6..9ef66ac 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 _0x146d=['path','define','SquareMessage','lodash','util','../../config/logger','moment','request-promise'];(function(_0x36176e,_0x3719b7){var _0xbe79bc=function(_0x2eea8f){while(--_0x2eea8f){_0x36176e['push'](_0x36176e['shift']());}};_0xbe79bc(++_0x3719b7);}(_0x146d,0x14b));var _0xd146=function(_0x3540d3,_0x1230e9){_0x3540d3=_0x3540d3-0x0;var _0x4c2870=_0x146d[_0x3540d3];return _0x4c2870;};'use strict';var _=require(_0xd146('0x0'));var util=require(_0xd146('0x1'));var logger=require(_0xd146('0x2'))('api');var moment=require(_0xd146('0x3'));var BPromise=require('bluebird');var rp=require(_0xd146('0x4'));var fs=require('fs');var path=require(_0xd146('0x5'));var rimraf=require('rimraf');var config=require('../../config/environment');var attributes=require('./squareMessage.attributes');module['exports']=function(_0x1b1b3a,_0x414cbd){return _0x1b1b3a[_0xd146('0x6')](_0xd146('0x7'),attributes,{'tableName':'square_messages','paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x8739=['lodash','util','../../config/logger','api','moment','rimraf','exports','define','SquareMessage','square_messages'];(function(_0x5007cc,_0x3c66f1){var _0x11c89e=function(_0x37b804){while(--_0x37b804){_0x5007cc['push'](_0x5007cc['shift']());}};_0x11c89e(++_0x3c66f1);}(_0x8739,0xbe));var _0x9873=function(_0x4e6b6b,_0x3a65ca){_0x4e6b6b=_0x4e6b6b-0x0;var _0x1cfe66=_0x8739[_0x4e6b6b];return _0x1cfe66;};'use strict';var _=require(_0x9873('0x0'));var util=require(_0x9873('0x1'));var logger=require(_0x9873('0x2'))(_0x9873('0x3'));var moment=require(_0x9873('0x4'));var BPromise=require('bluebird');var rp=require('request-promise');var fs=require('fs');var path=require('path');var rimraf=require(_0x9873('0x5'));var config=require('../../config/environment');var attributes=require('./squareMessage.attributes');module[_0x9873('0x6')]=function(_0x40411e,_0x1b93e5){return _0x40411e[_0x9873('0x7')](_0x9873('0x8'),attributes,{'tableName':_0x9873('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 52e37ab..7b70201 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 _0x241e=['CreateSquareMessage','lodash','util','moment','randomstring','ioredis','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','client','http','SquareMessage,\x20%s,\x20%s','request\x20sent','debug','SquareMessage,\x20%s,\x20%s,\x20%s','stringify','error','code','message','info','catch','SquareMessage','create','options','raw','then'];(function(_0x570d3c,_0x375460){var _0x388b92=function(_0x3d91e8){while(--_0x3d91e8){_0x570d3c['push'](_0x570d3c['shift']());}};_0x388b92(++_0x375460);}(_0x241e,0xfd));var _0xe241=function(_0x350409,_0x32c536){_0x350409=_0x350409-0x0;var _0xdfd5ea=_0x241e[_0x350409];return _0xdfd5ea;};'use strict';var _=require(_0xe241('0x0'));var util=require(_0xe241('0x1'));var moment=require(_0xe241('0x2'));var BPromise=require('bluebird');var rs=require(_0xe241('0x3'));var fs=require('fs');var Redis=require(_0xe241('0x4'));var db=require('../../mysqldb')['db'];var utils=require(_0xe241('0x5'));var logger=require(_0xe241('0x6'))(_0xe241('0x7'));var config=require(_0xe241('0x8'));var jayson=require(_0xe241('0x9'));var client=jayson[_0xe241('0xa')][_0xe241('0xb')]({'port':0x232a});function respondWithRpcPromise(_0x17648d,_0xffa360,_0x3a8db2){return new BPromise(function(_0x1daeed,_0xba142e){return client['request'](_0x17648d,_0x3a8db2)['then'](function(_0x5ec5b5){logger['info'](_0xe241('0xc'),_0xffa360,_0xe241('0xd'));logger[_0xe241('0xe')](_0xe241('0xf'),_0xffa360,_0xe241('0xd'),JSON[_0xe241('0x10')](_0x5ec5b5));if(_0x5ec5b5[_0xe241('0x11')]){if(_0x5ec5b5[_0xe241('0x11')][_0xe241('0x12')]===0x1f4){logger[_0xe241('0x11')]('SquareMessage,\x20%s,\x20%s',_0xffa360,_0x5ec5b5[_0xe241('0x11')][_0xe241('0x13')]);return _0xba142e(_0x5ec5b5[_0xe241('0x11')]['message']);}logger['error'](_0xe241('0xc'),_0xffa360,_0x5ec5b5[_0xe241('0x11')]['message']);return _0x1daeed(_0x5ec5b5['error'][_0xe241('0x13')]);}else{logger[_0xe241('0x14')](_0xe241('0xc'),_0xffa360,_0xe241('0xd'));_0x1daeed(_0x5ec5b5['result'][_0xe241('0x13')]);}})[_0xe241('0x15')](function(_0x1dce7c){logger[_0xe241('0x11')](_0xe241('0xc'),_0xffa360,_0x1dce7c);_0xba142e(_0x1dce7c);});});}exports['CreateSquareMessage']=function(_0x202502){var _0x16aa4a=this;return new Promise(function(_0x8d24fc,_0x51ae1e){return db[_0xe241('0x16')][_0xe241('0x17')](_0x202502['body'],{'raw':_0x202502[_0xe241('0x18')]?_0x202502[_0xe241('0x18')][_0xe241('0x19')]===undefined?!![]:![]:!![]})[_0xe241('0x1a')](function(_0x31512a){logger[_0xe241('0x14')](_0xe241('0x1b'),_0x202502);logger[_0xe241('0xe')](_0xe241('0x1b'),_0x202502,JSON[_0xe241('0x10')](_0x31512a));_0x8d24fc(_0x31512a);})[_0xe241('0x15')](function(_0x3b46cb){logger['error'](_0xe241('0x1b'),_0x3b46cb['message'],_0x202502);_0x51ae1e(_0x16aa4a[_0xe241('0x11')](0x1f4,_0x3b46cb[_0xe241('0x13')]));});});}; \ No newline at end of file +var _0xfb92=['create','options','raw','lodash','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','client','http','request','then','info','SquareMessage,\x20%s,\x20%s','request\x20sent','debug','stringify','error','message','result','catch','CreateSquareMessage','SquareMessage'];(function(_0x1c152c,_0xee6157){var _0x272b4a=function(_0x3d2427){while(--_0x3d2427){_0x1c152c['push'](_0x1c152c['shift']());}};_0x272b4a(++_0xee6157);}(_0xfb92,0x199));var _0x2fb9=function(_0x4f5a40,_0x48d666){_0x4f5a40=_0x4f5a40-0x0;var _0x43f406=_0xfb92[_0x4f5a40];return _0x43f406;};'use strict';var _=require(_0x2fb9('0x0'));var util=require('util');var moment=require(_0x2fb9('0x1'));var BPromise=require(_0x2fb9('0x2'));var rs=require(_0x2fb9('0x3'));var fs=require('fs');var Redis=require(_0x2fb9('0x4'));var db=require(_0x2fb9('0x5'))['db'];var utils=require(_0x2fb9('0x6'));var logger=require(_0x2fb9('0x7'))(_0x2fb9('0x8'));var config=require(_0x2fb9('0x9'));var jayson=require(_0x2fb9('0xa'));var client=jayson[_0x2fb9('0xb')][_0x2fb9('0xc')]({'port':0x232a});function respondWithRpcPromise(_0x379691,_0x441bf9,_0x3ca2d5){return new BPromise(function(_0x4d62ca,_0x211d5a){return client[_0x2fb9('0xd')](_0x379691,_0x3ca2d5)[_0x2fb9('0xe')](function(_0x3bb213){logger[_0x2fb9('0xf')](_0x2fb9('0x10'),_0x441bf9,_0x2fb9('0x11'));logger[_0x2fb9('0x12')]('SquareMessage,\x20%s,\x20%s,\x20%s',_0x441bf9,_0x2fb9('0x11'),JSON[_0x2fb9('0x13')](_0x3bb213));if(_0x3bb213[_0x2fb9('0x14')]){if(_0x3bb213['error']['code']===0x1f4){logger[_0x2fb9('0x14')](_0x2fb9('0x10'),_0x441bf9,_0x3bb213[_0x2fb9('0x14')]['message']);return _0x211d5a(_0x3bb213['error'][_0x2fb9('0x15')]);}logger[_0x2fb9('0x14')](_0x2fb9('0x10'),_0x441bf9,_0x3bb213[_0x2fb9('0x14')]['message']);return _0x4d62ca(_0x3bb213[_0x2fb9('0x14')][_0x2fb9('0x15')]);}else{logger[_0x2fb9('0xf')](_0x2fb9('0x10'),_0x441bf9,'request\x20sent');_0x4d62ca(_0x3bb213[_0x2fb9('0x16')]['message']);}})[_0x2fb9('0x17')](function(_0x5465f7){logger[_0x2fb9('0x14')](_0x2fb9('0x10'),_0x441bf9,_0x5465f7);_0x211d5a(_0x5465f7);});});}exports[_0x2fb9('0x18')]=function(_0x3870a7){var _0x54f2a6=this;return new Promise(function(_0x31c2ee,_0x416ea3){return db[_0x2fb9('0x19')][_0x2fb9('0x1a')](_0x3870a7['body'],{'raw':_0x3870a7['options']?_0x3870a7[_0x2fb9('0x1b')][_0x2fb9('0x1c')]===undefined?!![]:![]:!![]})['then'](function(_0x583de3){logger['info'](_0x2fb9('0x18'),_0x3870a7);logger['debug'](_0x2fb9('0x18'),_0x3870a7,JSON['stringify'](_0x583de3));_0x31c2ee(_0x583de3);})[_0x2fb9('0x17')](function(_0x1a859e){logger[_0x2fb9('0x14')](_0x2fb9('0x18'),_0x1a859e['message'],_0x3870a7);_0x416ea3(_0x54f2a6[_0x2fb9('0x14')](0x1f4,_0x1a859e[_0x2fb9('0x15')]));});});}; \ No newline at end of file diff --git a/server/api/squareOdbc/index.js b/server/api/squareOdbc/index.js index fafc89b..c6c1cd7 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 _0xfe6e=['Router','fs-extra','../../components/auth/service','../../config/environment','get','/:id/test','isAuthenticated','15s','test','post','/:id','update','delete','destroy','multer','util','connect-timeout','express'];(function(_0x3dfd97,_0x2f97c4){var _0x2618e2=function(_0x51ad72){while(--_0x51ad72){_0x3dfd97['push'](_0x3dfd97['shift']());}};_0x2618e2(++_0x2f97c4);}(_0xfe6e,0x164));var _0xefe6=function(_0x5c4f5c,_0x598405){_0x5c4f5c=_0x5c4f5c-0x0;var _0x58a1fd=_0xfe6e[_0x5c4f5c];return _0x58a1fd;};'use strict';var multer=require(_0xefe6('0x0'));var util=require(_0xefe6('0x1'));var path=require('path');var timeout=require(_0xefe6('0x2'));var express=require(_0xefe6('0x3'));var router=express[_0xefe6('0x4')]();var fs_extra=require(_0xefe6('0x5'));var auth=require(_0xefe6('0x6'));var interaction=require('../../components/interaction/service');var config=require(_0xefe6('0x7'));var controller=require('./squareOdbc.controller');router['get']('/',auth['isAuthenticated'](),controller['index']);router[_0xefe6('0x8')]('/:id',auth['isAuthenticated'](),controller['show']);router[_0xefe6('0x8')](_0xefe6('0x9'),auth[_0xefe6('0xa')](),timeout(_0xefe6('0xb')),controller[_0xefe6('0xc')]);router[_0xefe6('0xd')]('/',auth[_0xefe6('0xa')](),controller['create']);router['put'](_0xefe6('0xe'),auth[_0xefe6('0xa')](),controller[_0xefe6('0xf')]);router[_0xefe6('0x10')](_0xefe6('0xe'),auth['isAuthenticated'](),controller[_0xefe6('0x11')]);module['exports']=router; \ No newline at end of file +var _0x998f=['../../components/interaction/service','../../config/environment','get','isAuthenticated','show','/:id/test','test','post','create','put','/:id','update','delete','destroy','multer','util','path','connect-timeout','express','fs-extra'];(function(_0x4cf881,_0xe61173){var _0x5e9f77=function(_0x443305){while(--_0x443305){_0x4cf881['push'](_0x4cf881['shift']());}};_0x5e9f77(++_0xe61173);}(_0x998f,0x72));var _0xf998=function(_0x4db33e,_0x22598d){_0x4db33e=_0x4db33e-0x0;var _0x5f052d=_0x998f[_0x4db33e];return _0x5f052d;};'use strict';var multer=require(_0xf998('0x0'));var util=require(_0xf998('0x1'));var path=require(_0xf998('0x2'));var timeout=require(_0xf998('0x3'));var express=require(_0xf998('0x4'));var router=express['Router']();var fs_extra=require(_0xf998('0x5'));var auth=require('../../components/auth/service');var interaction=require(_0xf998('0x6'));var config=require(_0xf998('0x7'));var controller=require('./squareOdbc.controller');router[_0xf998('0x8')]('/',auth['isAuthenticated'](),controller['index']);router[_0xf998('0x8')]('/:id',auth[_0xf998('0x9')](),controller[_0xf998('0xa')]);router[_0xf998('0x8')](_0xf998('0xb'),auth[_0xf998('0x9')](),timeout('15s'),controller[_0xf998('0xc')]);router[_0xf998('0xd')]('/',auth[_0xf998('0x9')](),controller[_0xf998('0xe')]);router[_0xf998('0xf')](_0xf998('0x10'),auth[_0xf998('0x9')](),controller[_0xf998('0x11')]);router[_0xf998('0x12')](_0xf998('0x10'),auth['isAuthenticated'](),controller[_0xf998('0x13')]);module['exports']=router; \ No newline at end of file diff --git a/server/api/squareOdbc/squareOdbc.attributes.js b/server/api/squareOdbc/squareOdbc.attributes.js index 530706f..241c393 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 _0x85af=['sequelize','exports','STRING','name'];(function(_0x1ae7b8,_0x4cf6b4){var _0x79ce41=function(_0x1d568c){while(--_0x1d568c){_0x1ae7b8['push'](_0x1ae7b8['shift']());}};_0x79ce41(++_0x4cf6b4);}(_0x85af,0xe4));var _0xf85a=function(_0x32df30,_0x54f107){_0x32df30=_0x32df30-0x0;var _0xffe81a=_0x85af[_0x32df30];return _0xffe81a;};'use strict';var Sequelize=require(_0xf85a('0x0'));module[_0xf85a('0x1')]={'name':{'type':Sequelize[_0xf85a('0x2')],'unique':_0xf85a('0x3'),'allowNull':![]},'dsn':{'type':Sequelize[_0xf85a('0x2')]},'description':{'type':Sequelize[_0xf85a('0x2')]}}; \ No newline at end of file +var _0xef8f=['name','STRING','sequelize'];(function(_0xa148b7,_0x2f3eb2){var _0x51efd3=function(_0x34bcec){while(--_0x34bcec){_0xa148b7['push'](_0xa148b7['shift']());}};_0x51efd3(++_0x2f3eb2);}(_0xef8f,0x173));var _0xfef8=function(_0xd728c6,_0x427107){_0xd728c6=_0xd728c6-0x0;var _0x455763=_0xef8f[_0xd728c6];return _0x455763;};'use strict';var Sequelize=require(_0xfef8('0x0'));module['exports']={'name':{'type':Sequelize['STRING'],'unique':_0xfef8('0x1'),'allowNull':![]},'dsn':{'type':Sequelize['STRING']},'description':{'type':Sequelize[_0xfef8('0x2')]}}; \ No newline at end of file diff --git a/server/api/squareOdbc/squareOdbc.controller.js b/server/api/squareOdbc/squareOdbc.controller.js index f002d78..5e99e56 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 _0x9d73=['limit','count','set','Content-Range','apply','reject','save','update','destroy','get','ODBC','UserProfileResource','then','error','stack','name','map','SquareOdbc','rawAttributes','type','key','keys','query','filters','intersection','model','attributes','fields','length','hasOwnProperty','nolimit','order','sort','where','pick','filter','VIRTUAL','merge','include','findAll','rows','catch','params','find','create','body','user','role','UserProfileSection','userProfileId','autoAssociation','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','test','dsn','openSync','eml-format','rimraf','zip-dir','moment','bluebird','mustache','path','sox','to-csv','ejs','fs-extra','lodash','crypto','jsforce','desk.js','querystring','ioredis','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/logger','api','../../config/utils','../../config/environment','../../config/license/util','sendStatus','status','end','json','offset','undefined'];(function(_0x40fe7c,_0x888df7){var _0x2a1a53=function(_0x3d5c40){while(--_0x3d5c40){_0x40fe7c['push'](_0x40fe7c['shift']());}};_0x2a1a53(++_0x888df7);}(_0x9d73,0x1e0));var _0x39d7=function(_0xfdb37f,_0x43f949){_0xfdb37f=_0xfdb37f-0x0;var _0x4e4e40=_0x9d73[_0xfdb37f];return _0x4e4e40;};'use strict';var emlformat=require(_0x39d7('0x0'));var rimraf=require(_0x39d7('0x1'));var zipdir=require(_0x39d7('0x2'));var jsonpatch=require('fast-json-patch');var rp=require('request-promise');var moment=require(_0x39d7('0x3'));var BPromise=require(_0x39d7('0x4'));var Mustache=require(_0x39d7('0x5'));var util=require('util');var path=require(_0x39d7('0x6'));var sox=require(_0x39d7('0x7'));var csv=require(_0x39d7('0x8'));var ejs=require(_0x39d7('0x9'));var fs=require('fs');var fs_extra=require(_0x39d7('0xa'));var _=require(_0x39d7('0xb'));var squel=require('squel');var crypto=require(_0x39d7('0xc'));var jsforce=require(_0x39d7('0xd'));var deskjs=require(_0x39d7('0xe'));var toCsv=require('to-csv');var querystring=require(_0x39d7('0xf'));var Papa=require('papaparse');var Redis=require(_0x39d7('0x10'));var authService=require('../../components/auth/service');var qs=require(_0x39d7('0x11'));var as=require(_0x39d7('0x12'));var hardwareService=require('../../config/license/hardware');var logger=require(_0x39d7('0x13'))(_0x39d7('0x14'));var utils=require(_0x39d7('0x15'));var config=require(_0x39d7('0x16'));var licenseUtil=require(_0x39d7('0x17'));var db=require('../../mysqldb')['db'];function respondWithStatusCode(_0x303022,_0x384f0d){_0x384f0d=_0x384f0d||0xcc;return function(_0x19cb9c){if(_0x19cb9c){return _0x303022[_0x39d7('0x18')](_0x384f0d);}return _0x303022[_0x39d7('0x19')](_0x384f0d)[_0x39d7('0x1a')]();};}function respondWithResult(_0x22256f,_0x53681c){_0x53681c=_0x53681c||0xc8;return function(_0x36f278){if(_0x36f278){return _0x22256f[_0x39d7('0x19')](_0x53681c)[_0x39d7('0x1b')](_0x36f278);}};}function respondWithFilteredResult(_0x44d024,_0x2cf3be){return function(_0x686a59){if(_0x686a59){var _0x2603c9=typeof _0x2cf3be[_0x39d7('0x1c')]===_0x39d7('0x1d')&&typeof _0x2cf3be[_0x39d7('0x1e')]===_0x39d7('0x1d');var _0x475834=_0x686a59[_0x39d7('0x1f')];var _0x5beba2=_0x2603c9?0x0:_0x2cf3be[_0x39d7('0x1c')];var _0x14cd82=_0x2603c9?_0x686a59[_0x39d7('0x1f')]:_0x2cf3be[_0x39d7('0x1c')]+_0x2cf3be['limit'];var _0x32140d;if(_0x14cd82>=_0x475834){_0x14cd82=_0x475834;_0x32140d=0xc8;}else{_0x32140d=0xce;}_0x44d024[_0x39d7('0x19')](_0x32140d);return _0x44d024[_0x39d7('0x20')](_0x39d7('0x21'),_0x5beba2+'-'+_0x14cd82+'/'+_0x475834)[_0x39d7('0x1b')](_0x686a59);}return null;};}function patchUpdates(_0x4d3cba){return function(_0x2630bf){try{jsonpatch[_0x39d7('0x22')](_0x2630bf,_0x4d3cba,!![]);}catch(_0x3f373c){return BPromise[_0x39d7('0x23')](_0x3f373c);}return _0x2630bf[_0x39d7('0x24')]();};}function saveUpdates(_0x43d542,_0x2fb014){return function(_0x3c36d1){if(_0x3c36d1){return _0x3c36d1[_0x39d7('0x25')](_0x43d542)['then'](function(_0x1153d3){return _0x1153d3;});}return null;};}function removeEntity(_0x30d038,_0x533cb1){return function(_0xb3bb78){if(_0xb3bb78){return _0xb3bb78[_0x39d7('0x26')]()['then'](function(){var _0x2d4208=_0xb3bb78[_0x39d7('0x27')]({'plain':!![]});var _0x337230=_0x39d7('0x28');return db[_0x39d7('0x29')][_0x39d7('0x26')]({'where':{'type':_0x337230,'resourceId':_0x2d4208['id']}})['then'](function(){return _0xb3bb78;});})[_0x39d7('0x2a')](function(){_0x30d038[_0x39d7('0x19')](0xcc)['end']();});}};}function handleEntityNotFound(_0x5f3b79,_0x444448){return function(_0x92e87a){if(!_0x92e87a){_0x5f3b79[_0x39d7('0x18')](0x194);}return _0x92e87a;};}function handleError(_0x4c7640,_0x1ee49e){_0x1ee49e=_0x1ee49e||0x1f4;return function(_0x5bb797){logger[_0x39d7('0x2b')](_0x5bb797[_0x39d7('0x2c')]);if(_0x5bb797[_0x39d7('0x2d')]){delete _0x5bb797[_0x39d7('0x2d')];}_0x4c7640[_0x39d7('0x19')](_0x1ee49e)['send'](_0x5bb797);};}exports['index']=function(_0x3d0529,_0x2d56e1){var _0x5a4eff={},_0xd90235={},_0x2590e6={'count':0x0,'rows':[]};var _0x23b464=_[_0x39d7('0x2e')](db[_0x39d7('0x2f')][_0x39d7('0x30')],function(_0x1d1fef){return{'name':_0x1d1fef['fieldName'],'type':_0x1d1fef[_0x39d7('0x31')][_0x39d7('0x32')]};});_0xd90235['model']=_['map'](_0x23b464,_0x39d7('0x2d'));_0xd90235['query']=_[_0x39d7('0x33')](_0x3d0529[_0x39d7('0x34')]);_0xd90235[_0x39d7('0x35')]=_[_0x39d7('0x36')](_0xd90235[_0x39d7('0x37')],_0xd90235['query']);_0x5a4eff[_0x39d7('0x38')]=_[_0x39d7('0x36')](_0xd90235['model'],qs['fields'](_0x3d0529['query'][_0x39d7('0x39')]));_0x5a4eff[_0x39d7('0x38')]=_0x5a4eff[_0x39d7('0x38')][_0x39d7('0x3a')]?_0x5a4eff['attributes']:_0xd90235[_0x39d7('0x37')];if(!_0x3d0529[_0x39d7('0x34')][_0x39d7('0x3b')](_0x39d7('0x3c'))){_0x5a4eff[_0x39d7('0x1e')]=qs[_0x39d7('0x1e')](_0x3d0529[_0x39d7('0x34')]['limit']);_0x5a4eff[_0x39d7('0x1c')]=qs[_0x39d7('0x1c')](_0x3d0529[_0x39d7('0x34')][_0x39d7('0x1c')]);}_0x5a4eff[_0x39d7('0x3d')]=qs[_0x39d7('0x3e')](_0x3d0529['query']['sort']);_0x5a4eff[_0x39d7('0x3f')]=qs['filters'](_[_0x39d7('0x40')](_0x3d0529[_0x39d7('0x34')],_0xd90235[_0x39d7('0x35')]),_0x23b464);if(_0x3d0529[_0x39d7('0x34')][_0x39d7('0x41')]){_0x5a4eff[_0x39d7('0x3f')]=_['merge'](_0x5a4eff[_0x39d7('0x3f')],{'$or':_[_0x39d7('0x2e')](_0x23b464,function(_0x1cc58e){if(_0x1cc58e[_0x39d7('0x31')]!==_0x39d7('0x42')){var _0x38bc22={};_0x38bc22[_0x1cc58e[_0x39d7('0x2d')]]={'$like':'%'+_0x3d0529[_0x39d7('0x34')][_0x39d7('0x41')]+'%'};return _0x38bc22;}})});}_0x5a4eff=_[_0x39d7('0x43')]({},_0x5a4eff,_0x3d0529['options']);var _0x71d218={'where':_0x5a4eff[_0x39d7('0x3f')]};return db['SquareOdbc']['count'](_0x71d218)[_0x39d7('0x2a')](function(_0x4e66a5){_0x2590e6['count']=_0x4e66a5;if(_0x3d0529[_0x39d7('0x34')]['includeAll']){_0x5a4eff[_0x39d7('0x44')]=[{'all':!![]}];}return db[_0x39d7('0x2f')][_0x39d7('0x45')](_0x5a4eff);})[_0x39d7('0x2a')](function(_0x1b8a8d){_0x2590e6[_0x39d7('0x46')]=_0x1b8a8d;return _0x2590e6;})[_0x39d7('0x2a')](respondWithFilteredResult(_0x2d56e1,_0x5a4eff))[_0x39d7('0x47')](handleError(_0x2d56e1,null));};exports['show']=function(_0x3f4f47,_0x1ce53c){var _0x2638f7={'raw':!![],'where':{'id':_0x3f4f47[_0x39d7('0x48')]['id']}},_0x445511={};_0x445511[_0x39d7('0x37')]=_[_0x39d7('0x33')](db[_0x39d7('0x2f')]['rawAttributes']);_0x445511['query']=_[_0x39d7('0x33')](_0x3f4f47['query']);_0x445511[_0x39d7('0x35')]=_[_0x39d7('0x36')](_0x445511[_0x39d7('0x37')],_0x445511['query']);_0x2638f7[_0x39d7('0x38')]=_[_0x39d7('0x36')](_0x445511[_0x39d7('0x37')],qs['fields'](_0x3f4f47['query']['fields']));_0x2638f7['attributes']=_0x2638f7[_0x39d7('0x38')][_0x39d7('0x3a')]?_0x2638f7[_0x39d7('0x38')]:_0x445511[_0x39d7('0x37')];if(_0x3f4f47[_0x39d7('0x34')]['includeAll']){_0x2638f7[_0x39d7('0x44')]=[{'all':!![]}];}_0x2638f7=_[_0x39d7('0x43')]({},_0x2638f7,_0x3f4f47['options']);return db[_0x39d7('0x2f')][_0x39d7('0x49')](_0x2638f7)['then'](handleEntityNotFound(_0x1ce53c,null))[_0x39d7('0x2a')](respondWithResult(_0x1ce53c,null))['catch'](handleError(_0x1ce53c,null));};exports[_0x39d7('0x4a')]=function(_0x1e9bba,_0x52df15){return db[_0x39d7('0x2f')]['create'](_0x1e9bba[_0x39d7('0x4b')],{})[_0x39d7('0x2a')](function(_0x26bcdb){var _0x1463e4=_0x1e9bba[_0x39d7('0x4c')]['get']({'plain':!![]});if(!_0x1463e4)throw new Error('Unable\x20to\x20retrieve\x20the\x20current\x20user');if(_0x1463e4[_0x39d7('0x4d')]==='user'){var _0x22869e=_0x26bcdb[_0x39d7('0x27')]({'plain':!![]});var _0x267fd9='ODBC';return db[_0x39d7('0x4e')][_0x39d7('0x49')]({'where':{'name':_0x267fd9,'userProfileId':_0x1463e4[_0x39d7('0x4f')]},'raw':!![]})['then'](function(_0x4d9f06){if(_0x4d9f06&&_0x4d9f06[_0x39d7('0x50')]===0x0){return db[_0x39d7('0x29')]['create']({'name':_0x22869e[_0x39d7('0x2d')],'resourceId':_0x22869e['id'],'type':_0x4d9f06['name'],'sectionId':_0x4d9f06['id']},{})['then'](function(){return _0x26bcdb;});}else{return _0x26bcdb;}})[_0x39d7('0x47')](function(_0x27a1ad){logger[_0x39d7('0x2b')](_0x39d7('0x51'),_0x27a1ad);throw _0x27a1ad;});}return _0x26bcdb;})[_0x39d7('0x2a')](respondWithResult(_0x52df15,0xc9))[_0x39d7('0x47')](handleError(_0x52df15,null));};exports[_0x39d7('0x25')]=function(_0x4a1b84,_0x488689){if(_0x4a1b84[_0x39d7('0x4b')]['id']){delete _0x4a1b84[_0x39d7('0x4b')]['id'];}return db['SquareOdbc'][_0x39d7('0x49')]({'where':{'id':_0x4a1b84[_0x39d7('0x48')]['id']}})[_0x39d7('0x2a')](handleEntityNotFound(_0x488689,null))[_0x39d7('0x2a')](saveUpdates(_0x4a1b84[_0x39d7('0x4b')],null))[_0x39d7('0x2a')](respondWithResult(_0x488689,null))[_0x39d7('0x47')](handleError(_0x488689,null));};exports['destroy']=function(_0xc6308f,_0x41caa2){return db[_0x39d7('0x2f')][_0x39d7('0x49')]({'where':{'id':_0xc6308f[_0x39d7('0x48')]['id']}})['then'](handleEntityNotFound(_0x41caa2,null))[_0x39d7('0x2a')](removeEntity(_0x41caa2,null))['catch'](handleError(_0x41caa2,null));};exports[_0x39d7('0x52')]=function(_0x35b445,_0x2a2d58,_0xe9d9c1){var _0x3a84a4;return db[_0x39d7('0x2f')]['find']({'where':{'id':_0x35b445[_0x39d7('0x48')]['id']},'attributes':['id',_0x39d7('0x53')]})[_0x39d7('0x2a')](handleEntityNotFound(_0x2a2d58,null))[_0x39d7('0x2a')](function(_0x7369b1){if(_0x7369b1){var _0x30f529=require('odbc')();_0x30f529[_0x39d7('0x54')](_0x7369b1[_0x39d7('0x53')]);_0x30f529['closeSync']();return _0x7369b1;}})[_0x39d7('0x2a')](respondWithResult(_0x2a2d58,null))[_0x39d7('0x47')](handleError(_0x2a2d58,null));}; \ No newline at end of file +var _0xbf33=['keys','options','find','create','body','user','Unable\x20to\x20retrieve\x20the\x20current\x20user','role','ODBC','UserProfileSection','autoAssociation','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','update','test','dsn','odbc','openSync','eml-format','rimraf','zip-dir','moment','bluebird','util','path','to-csv','fs-extra','lodash','squel','crypto','jsforce','desk.js','querystring','papaparse','ioredis','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','sendStatus','status','offset','limit','undefined','count','set','Content-Range','apply','reject','then','destroy','get','end','error','stack','name','map','SquareOdbc','rawAttributes','fieldName','type','key','model','query','filters','intersection','attributes','fields','hasOwnProperty','nolimit','sort','where','pick','merge','VIRTUAL','filter','includeAll','include','findAll','rows','catch','params'];(function(_0x323eec,_0x46c57d){var _0x19b7cc=function(_0x292de9){while(--_0x292de9){_0x323eec['push'](_0x323eec['shift']());}};_0x19b7cc(++_0x46c57d);}(_0xbf33,0x67));var _0x3bf3=function(_0x2bf141,_0x31eac7){_0x2bf141=_0x2bf141-0x0;var _0x48277b=_0xbf33[_0x2bf141];return _0x48277b;};'use strict';var emlformat=require(_0x3bf3('0x0'));var rimraf=require(_0x3bf3('0x1'));var zipdir=require(_0x3bf3('0x2'));var jsonpatch=require('fast-json-patch');var rp=require('request-promise');var moment=require(_0x3bf3('0x3'));var BPromise=require(_0x3bf3('0x4'));var Mustache=require('mustache');var util=require(_0x3bf3('0x5'));var path=require(_0x3bf3('0x6'));var sox=require('sox');var csv=require(_0x3bf3('0x7'));var ejs=require('ejs');var fs=require('fs');var fs_extra=require(_0x3bf3('0x8'));var _=require(_0x3bf3('0x9'));var squel=require(_0x3bf3('0xa'));var crypto=require(_0x3bf3('0xb'));var jsforce=require(_0x3bf3('0xc'));var deskjs=require(_0x3bf3('0xd'));var toCsv=require('to-csv');var querystring=require(_0x3bf3('0xe'));var Papa=require(_0x3bf3('0xf'));var Redis=require(_0x3bf3('0x10'));var authService=require('../../components/auth/service');var qs=require(_0x3bf3('0x11'));var as=require(_0x3bf3('0x12'));var hardwareService=require(_0x3bf3('0x13'));var logger=require(_0x3bf3('0x14'))(_0x3bf3('0x15'));var utils=require(_0x3bf3('0x16'));var config=require(_0x3bf3('0x17'));var licenseUtil=require(_0x3bf3('0x18'));var db=require(_0x3bf3('0x19'))['db'];function respondWithStatusCode(_0x4bd1fa,_0x169615){_0x169615=_0x169615||0xcc;return function(_0x53dec1){if(_0x53dec1){return _0x4bd1fa[_0x3bf3('0x1a')](_0x169615);}return _0x4bd1fa['status'](_0x169615)['end']();};}function respondWithResult(_0x447c34,_0x43f5cf){_0x43f5cf=_0x43f5cf||0xc8;return function(_0x153652){if(_0x153652){return _0x447c34[_0x3bf3('0x1b')](_0x43f5cf)['json'](_0x153652);}};}function respondWithFilteredResult(_0x39d255,_0x5bedf2){return function(_0x93bf5d){if(_0x93bf5d){var _0x2f3d43=typeof _0x5bedf2[_0x3bf3('0x1c')]==='undefined'&&typeof _0x5bedf2[_0x3bf3('0x1d')]===_0x3bf3('0x1e');var _0x47a1e0=_0x93bf5d[_0x3bf3('0x1f')];var _0x5a4224=_0x2f3d43?0x0:_0x5bedf2[_0x3bf3('0x1c')];var _0x47a9f5=_0x2f3d43?_0x93bf5d['count']:_0x5bedf2[_0x3bf3('0x1c')]+_0x5bedf2[_0x3bf3('0x1d')];var _0x2267db;if(_0x47a9f5>=_0x47a1e0){_0x47a9f5=_0x47a1e0;_0x2267db=0xc8;}else{_0x2267db=0xce;}_0x39d255[_0x3bf3('0x1b')](_0x2267db);return _0x39d255[_0x3bf3('0x20')](_0x3bf3('0x21'),_0x5a4224+'-'+_0x47a9f5+'/'+_0x47a1e0)['json'](_0x93bf5d);}return null;};}function patchUpdates(_0x1852d7){return function(_0x4ca29a){try{jsonpatch[_0x3bf3('0x22')](_0x4ca29a,_0x1852d7,!![]);}catch(_0x1da1cf){return BPromise[_0x3bf3('0x23')](_0x1da1cf);}return _0x4ca29a['save']();};}function saveUpdates(_0x370f93,_0x48fc78){return function(_0x58e46a){if(_0x58e46a){return _0x58e46a['update'](_0x370f93)[_0x3bf3('0x24')](function(_0x32865a){return _0x32865a;});}return null;};}function removeEntity(_0x2c507a,_0x528beb){return function(_0x2cab56){if(_0x2cab56){return _0x2cab56[_0x3bf3('0x25')]()['then'](function(){var _0x30f506=_0x2cab56[_0x3bf3('0x26')]({'plain':!![]});var _0x274a01='ODBC';return db['UserProfileResource']['destroy']({'where':{'type':_0x274a01,'resourceId':_0x30f506['id']}})['then'](function(){return _0x2cab56;});})[_0x3bf3('0x24')](function(){_0x2c507a[_0x3bf3('0x1b')](0xcc)[_0x3bf3('0x27')]();});}};}function handleEntityNotFound(_0x1abb19,_0x2410eb){return function(_0x5552bc){if(!_0x5552bc){_0x1abb19[_0x3bf3('0x1a')](0x194);}return _0x5552bc;};}function handleError(_0x4ed6c4,_0x226def){_0x226def=_0x226def||0x1f4;return function(_0x35ee4a){logger[_0x3bf3('0x28')](_0x35ee4a[_0x3bf3('0x29')]);if(_0x35ee4a[_0x3bf3('0x2a')]){delete _0x35ee4a[_0x3bf3('0x2a')];}_0x4ed6c4['status'](_0x226def)['send'](_0x35ee4a);};}exports['index']=function(_0x5ac916,_0xf79cf5){var _0xe6746b={},_0x39fdba={},_0x4755c9={'count':0x0,'rows':[]};var _0x50746d=_[_0x3bf3('0x2b')](db[_0x3bf3('0x2c')][_0x3bf3('0x2d')],function(_0x3277b4){return{'name':_0x3277b4[_0x3bf3('0x2e')],'type':_0x3277b4[_0x3bf3('0x2f')][_0x3bf3('0x30')]};});_0x39fdba[_0x3bf3('0x31')]=_['map'](_0x50746d,_0x3bf3('0x2a'));_0x39fdba[_0x3bf3('0x32')]=_['keys'](_0x5ac916['query']);_0x39fdba[_0x3bf3('0x33')]=_[_0x3bf3('0x34')](_0x39fdba[_0x3bf3('0x31')],_0x39fdba[_0x3bf3('0x32')]);_0xe6746b[_0x3bf3('0x35')]=_[_0x3bf3('0x34')](_0x39fdba[_0x3bf3('0x31')],qs[_0x3bf3('0x36')](_0x5ac916[_0x3bf3('0x32')][_0x3bf3('0x36')]));_0xe6746b[_0x3bf3('0x35')]=_0xe6746b['attributes']['length']?_0xe6746b[_0x3bf3('0x35')]:_0x39fdba[_0x3bf3('0x31')];if(!_0x5ac916['query'][_0x3bf3('0x37')](_0x3bf3('0x38'))){_0xe6746b[_0x3bf3('0x1d')]=qs['limit'](_0x5ac916['query']['limit']);_0xe6746b[_0x3bf3('0x1c')]=qs[_0x3bf3('0x1c')](_0x5ac916['query']['offset']);}_0xe6746b['order']=qs[_0x3bf3('0x39')](_0x5ac916[_0x3bf3('0x32')]['sort']);_0xe6746b[_0x3bf3('0x3a')]=qs['filters'](_[_0x3bf3('0x3b')](_0x5ac916[_0x3bf3('0x32')],_0x39fdba[_0x3bf3('0x33')]),_0x50746d);if(_0x5ac916[_0x3bf3('0x32')]['filter']){_0xe6746b['where']=_[_0x3bf3('0x3c')](_0xe6746b[_0x3bf3('0x3a')],{'$or':_[_0x3bf3('0x2b')](_0x50746d,function(_0x56d1e2){if(_0x56d1e2[_0x3bf3('0x2f')]!==_0x3bf3('0x3d')){var _0x33e2f1={};_0x33e2f1[_0x56d1e2[_0x3bf3('0x2a')]]={'$like':'%'+_0x5ac916[_0x3bf3('0x32')][_0x3bf3('0x3e')]+'%'};return _0x33e2f1;}})});}_0xe6746b=_[_0x3bf3('0x3c')]({},_0xe6746b,_0x5ac916['options']);var _0x57f799={'where':_0xe6746b[_0x3bf3('0x3a')]};return db[_0x3bf3('0x2c')]['count'](_0x57f799)[_0x3bf3('0x24')](function(_0x1ea22d){_0x4755c9['count']=_0x1ea22d;if(_0x5ac916[_0x3bf3('0x32')][_0x3bf3('0x3f')]){_0xe6746b[_0x3bf3('0x40')]=[{'all':!![]}];}return db['SquareOdbc'][_0x3bf3('0x41')](_0xe6746b);})[_0x3bf3('0x24')](function(_0x3d6eaf){_0x4755c9[_0x3bf3('0x42')]=_0x3d6eaf;return _0x4755c9;})[_0x3bf3('0x24')](respondWithFilteredResult(_0xf79cf5,_0xe6746b))[_0x3bf3('0x43')](handleError(_0xf79cf5,null));};exports['show']=function(_0xbdf726,_0x42293a){var _0x18b290={'raw':!![],'where':{'id':_0xbdf726[_0x3bf3('0x44')]['id']}},_0x5b7954={};_0x5b7954['model']=_[_0x3bf3('0x45')](db[_0x3bf3('0x2c')]['rawAttributes']);_0x5b7954['query']=_['keys'](_0xbdf726[_0x3bf3('0x32')]);_0x5b7954['filters']=_[_0x3bf3('0x34')](_0x5b7954[_0x3bf3('0x31')],_0x5b7954[_0x3bf3('0x32')]);_0x18b290['attributes']=_['intersection'](_0x5b7954[_0x3bf3('0x31')],qs['fields'](_0xbdf726[_0x3bf3('0x32')][_0x3bf3('0x36')]));_0x18b290['attributes']=_0x18b290['attributes']['length']?_0x18b290[_0x3bf3('0x35')]:_0x5b7954['model'];if(_0xbdf726[_0x3bf3('0x32')][_0x3bf3('0x3f')]){_0x18b290[_0x3bf3('0x40')]=[{'all':!![]}];}_0x18b290=_[_0x3bf3('0x3c')]({},_0x18b290,_0xbdf726[_0x3bf3('0x46')]);return db[_0x3bf3('0x2c')][_0x3bf3('0x47')](_0x18b290)[_0x3bf3('0x24')](handleEntityNotFound(_0x42293a,null))[_0x3bf3('0x24')](respondWithResult(_0x42293a,null))[_0x3bf3('0x43')](handleError(_0x42293a,null));};exports[_0x3bf3('0x48')]=function(_0x350a30,_0x236a6b){return db[_0x3bf3('0x2c')]['create'](_0x350a30[_0x3bf3('0x49')],{})[_0x3bf3('0x24')](function(_0x4f8442){var _0x891ace=_0x350a30[_0x3bf3('0x4a')][_0x3bf3('0x26')]({'plain':!![]});if(!_0x891ace)throw new Error(_0x3bf3('0x4b'));if(_0x891ace[_0x3bf3('0x4c')]===_0x3bf3('0x4a')){var _0x4664e8=_0x4f8442[_0x3bf3('0x26')]({'plain':!![]});var _0xaeefb=_0x3bf3('0x4d');return db[_0x3bf3('0x4e')]['find']({'where':{'name':_0xaeefb,'userProfileId':_0x891ace['userProfileId']},'raw':!![]})[_0x3bf3('0x24')](function(_0x117860){if(_0x117860&&_0x117860[_0x3bf3('0x4f')]===0x0){return db['UserProfileResource'][_0x3bf3('0x48')]({'name':_0x4664e8[_0x3bf3('0x2a')],'resourceId':_0x4664e8['id'],'type':_0x117860[_0x3bf3('0x2a')],'sectionId':_0x117860['id']},{})[_0x3bf3('0x24')](function(){return _0x4f8442;});}else{return _0x4f8442;}})[_0x3bf3('0x43')](function(_0x3c7351){logger[_0x3bf3('0x28')](_0x3bf3('0x50'),_0x3c7351);throw _0x3c7351;});}return _0x4f8442;})['then'](respondWithResult(_0x236a6b,0xc9))[_0x3bf3('0x43')](handleError(_0x236a6b,null));};exports[_0x3bf3('0x51')]=function(_0x26a06c,_0x1bc459){if(_0x26a06c[_0x3bf3('0x49')]['id']){delete _0x26a06c['body']['id'];}return db[_0x3bf3('0x2c')][_0x3bf3('0x47')]({'where':{'id':_0x26a06c['params']['id']}})[_0x3bf3('0x24')](handleEntityNotFound(_0x1bc459,null))[_0x3bf3('0x24')](saveUpdates(_0x26a06c[_0x3bf3('0x49')],null))[_0x3bf3('0x24')](respondWithResult(_0x1bc459,null))['catch'](handleError(_0x1bc459,null));};exports['destroy']=function(_0x16c4d1,_0x266a7d){return db[_0x3bf3('0x2c')]['find']({'where':{'id':_0x16c4d1[_0x3bf3('0x44')]['id']}})[_0x3bf3('0x24')](handleEntityNotFound(_0x266a7d,null))[_0x3bf3('0x24')](removeEntity(_0x266a7d,null))[_0x3bf3('0x43')](handleError(_0x266a7d,null));};exports[_0x3bf3('0x52')]=function(_0x445b49,_0x32755b,_0x290255){var _0x157a91;return db[_0x3bf3('0x2c')][_0x3bf3('0x47')]({'where':{'id':_0x445b49[_0x3bf3('0x44')]['id']},'attributes':['id',_0x3bf3('0x53')]})[_0x3bf3('0x24')](handleEntityNotFound(_0x32755b,null))[_0x3bf3('0x24')](function(_0x54428f){if(_0x54428f){var _0x5fa409=require(_0x3bf3('0x54'))();_0x5fa409[_0x3bf3('0x55')](_0x54428f[_0x3bf3('0x53')]);_0x5fa409['closeSync']();return _0x54428f;}})[_0x3bf3('0x24')](respondWithResult(_0x32755b,null))[_0x3bf3('0x43')](handleError(_0x32755b,null));}; \ No newline at end of file diff --git a/server/api/squareOdbc/squareOdbc.model.js b/server/api/squareOdbc/squareOdbc.model.js index a0698fa..4b7b31d 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 _0x0d93=['exports','define','SquareOdbc','square_odbc','util','../../config/logger','api','moment','bluebird','path','rimraf','./squareOdbc.attributes'];(function(_0x47c0cb,_0x5c08c8){var _0x59922a=function(_0x598a71){while(--_0x598a71){_0x47c0cb['push'](_0x47c0cb['shift']());}};_0x59922a(++_0x5c08c8);}(_0x0d93,0x64));var _0x30d9=function(_0x178856,_0x41f045){_0x178856=_0x178856-0x0;var _0x3c7fe7=_0x0d93[_0x178856];return _0x3c7fe7;};'use strict';var _=require('lodash');var util=require(_0x30d9('0x0'));var logger=require(_0x30d9('0x1'))(_0x30d9('0x2'));var moment=require(_0x30d9('0x3'));var BPromise=require(_0x30d9('0x4'));var rp=require('request-promise');var fs=require('fs');var path=require(_0x30d9('0x5'));var rimraf=require(_0x30d9('0x6'));var config=require('../../config/environment');var attributes=require(_0x30d9('0x7'));module[_0x30d9('0x8')]=function(_0x22933e,_0x4a3218){return _0x22933e[_0x30d9('0x9')](_0x30d9('0xa'),attributes,{'tableName':_0x30d9('0xb'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x5b94=['bluebird','request-promise','path','rimraf','../../config/environment','./squareOdbc.attributes','exports','SquareOdbc','util','../../config/logger'];(function(_0x20a584,_0xe384a5){var _0x4b41a8=function(_0x2127c6){while(--_0x2127c6){_0x20a584['push'](_0x20a584['shift']());}};_0x4b41a8(++_0xe384a5);}(_0x5b94,0x12a));var _0x45b9=function(_0x4565bf,_0x5ad9d6){_0x4565bf=_0x4565bf-0x0;var _0x5610ba=_0x5b94[_0x4565bf];return _0x5610ba;};'use strict';var _=require('lodash');var util=require(_0x45b9('0x0'));var logger=require(_0x45b9('0x1'))('api');var moment=require('moment');var BPromise=require(_0x45b9('0x2'));var rp=require(_0x45b9('0x3'));var fs=require('fs');var path=require(_0x45b9('0x4'));var rimraf=require(_0x45b9('0x5'));var config=require(_0x45b9('0x6'));var attributes=require(_0x45b9('0x7'));module[_0x45b9('0x8')]=function(_0x1798f8,_0x497625){return _0x1798f8['define'](_0x45b9('0x9'),attributes,{'tableName':'square_odbc','paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/squareOdbc/squareOdbc.rpc.js b/server/api/squareOdbc/squareOdbc.rpc.js index 4368792..6c21729 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 _0x255f=['moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','rpc','jayson/promise','client','http','request','then','info','SquareOdbc,\x20%s,\x20%s','debug','SquareOdbc,\x20%s,\x20%s,\x20%s','request\x20sent','stringify','code','error','message','result','catch','ShowSquareOdbc','find','options','where','attributes','include','map','model','lodash','util'];(function(_0xdd25cf,_0x14e8f2){var _0xa6dda7=function(_0x563844){while(--_0x563844){_0xdd25cf['push'](_0xdd25cf['shift']());}};_0xa6dda7(++_0x14e8f2);}(_0x255f,0x1ab));var _0xf255=function(_0x1177c7,_0x195cee){_0x1177c7=_0x1177c7-0x0;var _0x1506f1=_0x255f[_0x1177c7];return _0x1506f1;};'use strict';var _=require(_0xf255('0x0'));var util=require(_0xf255('0x1'));var moment=require(_0xf255('0x2'));var BPromise=require(_0xf255('0x3'));var rs=require(_0xf255('0x4'));var fs=require('fs');var Redis=require(_0xf255('0x5'));var db=require(_0xf255('0x6'))['db'];var utils=require(_0xf255('0x7'));var logger=require('../../config/logger')(_0xf255('0x8'));var config=require('../../config/environment');var jayson=require(_0xf255('0x9'));var client=jayson[_0xf255('0xa')][_0xf255('0xb')]({'port':0x232a});function respondWithRpcPromise(_0x48887b,_0x1a987b,_0x5e89f9){return new BPromise(function(_0x5c8789,_0x40138d){return client[_0xf255('0xc')](_0x48887b,_0x5e89f9)[_0xf255('0xd')](function(_0x57e490){logger[_0xf255('0xe')](_0xf255('0xf'),_0x1a987b,'request\x20sent');logger[_0xf255('0x10')](_0xf255('0x11'),_0x1a987b,_0xf255('0x12'),JSON[_0xf255('0x13')](_0x57e490));if(_0x57e490['error']){if(_0x57e490['error'][_0xf255('0x14')]===0x1f4){logger[_0xf255('0x15')]('SquareOdbc,\x20%s,\x20%s',_0x1a987b,_0x57e490[_0xf255('0x15')][_0xf255('0x16')]);return _0x40138d(_0x57e490['error'][_0xf255('0x16')]);}logger['error'](_0xf255('0xf'),_0x1a987b,_0x57e490[_0xf255('0x15')][_0xf255('0x16')]);return _0x5c8789(_0x57e490[_0xf255('0x15')][_0xf255('0x16')]);}else{logger['info'](_0xf255('0xf'),_0x1a987b,_0xf255('0x12'));_0x5c8789(_0x57e490[_0xf255('0x17')][_0xf255('0x16')]);}})[_0xf255('0x18')](function(_0x129ece){logger['error'](_0xf255('0xf'),_0x1a987b,_0x129ece);_0x40138d(_0x129ece);});});}exports[_0xf255('0x19')]=function(_0x3dc0fe){var _0x38d353=this;return new Promise(function(_0x48af62,_0x16bd7e){return db['SquareOdbc'][_0xf255('0x1a')]({'raw':_0x3dc0fe[_0xf255('0x1b')]?_0x3dc0fe[_0xf255('0x1b')]['raw']===undefined?!![]:![]:!![],'where':_0x3dc0fe[_0xf255('0x1b')]?_0x3dc0fe[_0xf255('0x1b')][_0xf255('0x1c')]||null:null,'attributes':_0x3dc0fe[_0xf255('0x1b')]?_0x3dc0fe['options'][_0xf255('0x1d')]||null:null,'include':_0x3dc0fe[_0xf255('0x1b')]?_0x3dc0fe[_0xf255('0x1b')][_0xf255('0x1e')]?_[_0xf255('0x1f')](_0x3dc0fe[_0xf255('0x1b')][_0xf255('0x1e')],function(_0x2d6e71){return{'model':db[_0x2d6e71['model']],'as':_0x2d6e71['as'],'attributes':_0x2d6e71[_0xf255('0x1d')],'include':_0x2d6e71[_0xf255('0x1e')]?_[_0xf255('0x1f')](_0x2d6e71['include'],function(_0x1a7480){return{'model':db[_0x1a7480[_0xf255('0x20')]],'as':_0x1a7480['as'],'attributes':_0x1a7480[_0xf255('0x1d')],'include':_0x1a7480[_0xf255('0x1e')]?_['map'](_0x1a7480['include'],function(_0x6d848e){return{'model':db[_0x6d848e[_0xf255('0x20')]],'as':_0x6d848e['as'],'attributes':_0x6d848e[_0xf255('0x1d')]};}):[]};}):[]};}):[]:[]})[_0xf255('0xd')](function(_0x5ed564){logger[_0xf255('0xe')](_0xf255('0x19'),_0x3dc0fe);logger[_0xf255('0x10')](_0xf255('0x19'),_0x3dc0fe,JSON[_0xf255('0x13')](_0x5ed564));_0x48af62(_0x5ed564);})['catch'](function(_0x3ef8b0){logger['error'](_0xf255('0x19'),_0x3ef8b0[_0xf255('0x16')],_0x3dc0fe);_0x16bd7e(_0x38d353[_0xf255('0x15')](0x1f4,_0x3ef8b0[_0xf255('0x16')]));});});}; \ No newline at end of file +var _0x2c7b=['error','message','result','SquareOdbc','find','options','raw','where','attributes','map','include','model','ShowSquareOdbc','catch','util','moment','bluebird','randomstring','../../mysqldb','../../config/utils','../../config/environment','jayson/promise','http','request','then','info','SquareOdbc,\x20%s,\x20%s','request\x20sent','SquareOdbc,\x20%s,\x20%s,\x20%s','stringify'];(function(_0x5c1ec8,_0x520373){var _0x36732e=function(_0x118819){while(--_0x118819){_0x5c1ec8['push'](_0x5c1ec8['shift']());}};_0x36732e(++_0x520373);}(_0x2c7b,0x158));var _0xb2c7=function(_0x5c351c,_0x2046d8){_0x5c351c=_0x5c351c-0x0;var _0x26f3b3=_0x2c7b[_0x5c351c];return _0x26f3b3;};'use strict';var _=require('lodash');var util=require(_0xb2c7('0x0'));var moment=require(_0xb2c7('0x1'));var BPromise=require(_0xb2c7('0x2'));var rs=require(_0xb2c7('0x3'));var fs=require('fs');var Redis=require('ioredis');var db=require(_0xb2c7('0x4'))['db'];var utils=require(_0xb2c7('0x5'));var logger=require('../../config/logger')('rpc');var config=require(_0xb2c7('0x6'));var jayson=require(_0xb2c7('0x7'));var client=jayson['client'][_0xb2c7('0x8')]({'port':0x232a});function respondWithRpcPromise(_0x5ed0e3,_0x3f95a4,_0x2bb17a){return new BPromise(function(_0x2659ba,_0x48fe3f){return client[_0xb2c7('0x9')](_0x5ed0e3,_0x2bb17a)[_0xb2c7('0xa')](function(_0x521f5f){logger[_0xb2c7('0xb')](_0xb2c7('0xc'),_0x3f95a4,_0xb2c7('0xd'));logger['debug'](_0xb2c7('0xe'),_0x3f95a4,_0xb2c7('0xd'),JSON[_0xb2c7('0xf')](_0x521f5f));if(_0x521f5f[_0xb2c7('0x10')]){if(_0x521f5f[_0xb2c7('0x10')]['code']===0x1f4){logger[_0xb2c7('0x10')](_0xb2c7('0xc'),_0x3f95a4,_0x521f5f[_0xb2c7('0x10')][_0xb2c7('0x11')]);return _0x48fe3f(_0x521f5f[_0xb2c7('0x10')][_0xb2c7('0x11')]);}logger[_0xb2c7('0x10')](_0xb2c7('0xc'),_0x3f95a4,_0x521f5f[_0xb2c7('0x10')][_0xb2c7('0x11')]);return _0x2659ba(_0x521f5f[_0xb2c7('0x10')]['message']);}else{logger[_0xb2c7('0xb')](_0xb2c7('0xc'),_0x3f95a4,_0xb2c7('0xd'));_0x2659ba(_0x521f5f[_0xb2c7('0x12')][_0xb2c7('0x11')]);}})['catch'](function(_0x4a6396){logger['error'](_0xb2c7('0xc'),_0x3f95a4,_0x4a6396);_0x48fe3f(_0x4a6396);});});}exports['ShowSquareOdbc']=function(_0x33c416){var _0x2b8037=this;return new Promise(function(_0x1e16e4,_0xc3a895){return db[_0xb2c7('0x13')][_0xb2c7('0x14')]({'raw':_0x33c416[_0xb2c7('0x15')]?_0x33c416[_0xb2c7('0x15')][_0xb2c7('0x16')]===undefined?!![]:![]:!![],'where':_0x33c416['options']?_0x33c416[_0xb2c7('0x15')][_0xb2c7('0x17')]||null:null,'attributes':_0x33c416[_0xb2c7('0x15')]?_0x33c416[_0xb2c7('0x15')][_0xb2c7('0x18')]||null:null,'include':_0x33c416[_0xb2c7('0x15')]?_0x33c416['options']['include']?_[_0xb2c7('0x19')](_0x33c416[_0xb2c7('0x15')][_0xb2c7('0x1a')],function(_0x5b61ce){return{'model':db[_0x5b61ce[_0xb2c7('0x1b')]],'as':_0x5b61ce['as'],'attributes':_0x5b61ce[_0xb2c7('0x18')],'include':_0x5b61ce[_0xb2c7('0x1a')]?_['map'](_0x5b61ce[_0xb2c7('0x1a')],function(_0x5dbed3){return{'model':db[_0x5dbed3[_0xb2c7('0x1b')]],'as':_0x5dbed3['as'],'attributes':_0x5dbed3[_0xb2c7('0x18')],'include':_0x5dbed3[_0xb2c7('0x1a')]?_[_0xb2c7('0x19')](_0x5dbed3[_0xb2c7('0x1a')],function(_0x3e126f){return{'model':db[_0x3e126f['model']],'as':_0x3e126f['as'],'attributes':_0x3e126f[_0xb2c7('0x18')]};}):[]};}):[]};}):[]:[]})[_0xb2c7('0xa')](function(_0x22c52f){logger[_0xb2c7('0xb')](_0xb2c7('0x1c'),_0x33c416);logger['debug'](_0xb2c7('0x1c'),_0x33c416,JSON[_0xb2c7('0xf')](_0x22c52f));_0x1e16e4(_0x22c52f);})[_0xb2c7('0x1d')](function(_0x3721b3){logger[_0xb2c7('0x10')](_0xb2c7('0x1c'),_0x3721b3[_0xb2c7('0x11')],_0x33c416);_0xc3a895(_0x2b8037[_0xb2c7('0x10')](0x1f4,_0x3721b3[_0xb2c7('0x11')]));});});}; \ No newline at end of file diff --git a/server/api/squareProject/index.js b/server/api/squareProject/index.js index b36b0ce..cbc09b6 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 _0xaf63=['get','isAuthenticated','/:id','show','post','create','put','destroy','multer','util','express','Router','fs-extra','../../components/interaction/service','../../config/environment','./squareProject.controller'];(function(_0x3af425,_0xcad1e3){var _0x22dc4c=function(_0x20ee27){while(--_0x20ee27){_0x3af425['push'](_0x3af425['shift']());}};_0x22dc4c(++_0xcad1e3);}(_0xaf63,0xc8));var _0x3af6=function(_0x3b3598,_0x761008){_0x3b3598=_0x3b3598-0x0;var _0x2ef5b0=_0xaf63[_0x3b3598];return _0x2ef5b0;};'use strict';var multer=require(_0x3af6('0x0'));var util=require(_0x3af6('0x1'));var path=require('path');var timeout=require('connect-timeout');var express=require(_0x3af6('0x2'));var router=express[_0x3af6('0x3')]();var fs_extra=require(_0x3af6('0x4'));var auth=require('../../components/auth/service');var interaction=require(_0x3af6('0x5'));var config=require(_0x3af6('0x6'));var controller=require(_0x3af6('0x7'));router[_0x3af6('0x8')]('/',auth[_0x3af6('0x9')](),controller['index']);router['get'](_0x3af6('0xa'),auth[_0x3af6('0x9')](),controller[_0x3af6('0xb')]);router[_0x3af6('0xc')]('/',auth[_0x3af6('0x9')](),controller[_0x3af6('0xd')]);router[_0x3af6('0xe')](_0x3af6('0xa'),auth['isAuthenticated'](),controller['update']);router['delete'](_0x3af6('0xa'),auth[_0x3af6('0x9')](),controller[_0x3af6('0xf')]);module['exports']=router; \ No newline at end of file +var _0x5586=['connect-timeout','express','Router','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','./squareProject.controller','get','index','/:id','isAuthenticated','post','create','put','update','destroy','multer','util','path'];(function(_0x3b0731,_0xcf9925){var _0x4204d7=function(_0x635ac5){while(--_0x635ac5){_0x3b0731['push'](_0x3b0731['shift']());}};_0x4204d7(++_0xcf9925);}(_0x5586,0x1a1));var _0x6558=function(_0x4a9fb1,_0x273043){_0x4a9fb1=_0x4a9fb1-0x0;var _0x348672=_0x5586[_0x4a9fb1];return _0x348672;};'use strict';var multer=require(_0x6558('0x0'));var util=require(_0x6558('0x1'));var path=require(_0x6558('0x2'));var timeout=require(_0x6558('0x3'));var express=require(_0x6558('0x4'));var router=express[_0x6558('0x5')]();var fs_extra=require(_0x6558('0x6'));var auth=require(_0x6558('0x7'));var interaction=require(_0x6558('0x8'));var config=require(_0x6558('0x9'));var controller=require(_0x6558('0xa'));router[_0x6558('0xb')]('/',auth['isAuthenticated'](),controller[_0x6558('0xc')]);router[_0x6558('0xb')](_0x6558('0xd'),auth[_0x6558('0xe')](),controller['show']);router[_0x6558('0xf')]('/',auth[_0x6558('0xe')](),controller[_0x6558('0x10')]);router[_0x6558('0x11')](_0x6558('0xd'),auth['isAuthenticated'](),controller[_0x6558('0x12')]);router['delete']('/:id',auth['isAuthenticated'](),controller[_0x6558('0x13')]);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 5649e15..a039b1f 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 _0xeefe=['sequelize','STRING','TEXT','long','preproduction','getDataValue','toString','BLOB','production','utf8','DATE'];(function(_0x3a46d0,_0x5a74b2){var _0x1a3016=function(_0x4d13ca){while(--_0x4d13ca){_0x3a46d0['push'](_0x3a46d0['shift']());}};_0x1a3016(++_0x5a74b2);}(_0xeefe,0xf2));var _0xeeef=function(_0x4987d9,_0x594e60){_0x4987d9=_0x4987d9-0x0;var _0x4d3d39=_0xeefe[_0x4987d9];return _0x4d3d39;};'use strict';var Sequelize=require(_0xeeef('0x0'));module['exports']={'name':{'type':Sequelize[_0xeeef('0x1')],'unique':'name','allowNull':![]},'description':{'type':Sequelize[_0xeeef('0x1')]},'notes':{'type':Sequelize[_0xeeef('0x2')]},'preproduction':{'type':Sequelize['BLOB'](_0xeeef('0x3')),'get':function(){if(this['getDataValue'](_0xeeef('0x4'))){return this[_0xeeef('0x5')](_0xeeef('0x4'))[_0xeeef('0x6')]('utf8');}}},'production':{'type':Sequelize[_0xeeef('0x7')](_0xeeef('0x3')),'get':function(){if(this[_0xeeef('0x5')](_0xeeef('0x8'))){return this[_0xeeef('0x5')](_0xeeef('0x8'))[_0xeeef('0x6')](_0xeeef('0x9'));}}},'savedAt':{'type':Sequelize[_0xeeef('0xa')]},'publishedAt':{'type':Sequelize[_0xeeef('0xa')]}}; \ No newline at end of file +var _0x7b81=['getDataValue','preproduction','toString','production','utf8','DATE','exports','STRING','name','TEXT','BLOB'];(function(_0x580a24,_0x18277f){var _0x4e24f8=function(_0x2c29ec){while(--_0x2c29ec){_0x580a24['push'](_0x580a24['shift']());}};_0x4e24f8(++_0x18277f);}(_0x7b81,0xab));var _0x17b8=function(_0x27019a,_0x9f3ac6){_0x27019a=_0x27019a-0x0;var _0x3f450d=_0x7b81[_0x27019a];return _0x3f450d;};'use strict';var Sequelize=require('sequelize');module[_0x17b8('0x0')]={'name':{'type':Sequelize[_0x17b8('0x1')],'unique':_0x17b8('0x2'),'allowNull':![]},'description':{'type':Sequelize[_0x17b8('0x1')]},'notes':{'type':Sequelize[_0x17b8('0x3')]},'preproduction':{'type':Sequelize[_0x17b8('0x4')]('long'),'get':function(){if(this[_0x17b8('0x5')](_0x17b8('0x6'))){return this[_0x17b8('0x5')](_0x17b8('0x6'))[_0x17b8('0x7')]('utf8');}}},'production':{'type':Sequelize[_0x17b8('0x4')]('long'),'get':function(){if(this[_0x17b8('0x5')](_0x17b8('0x8'))){return this[_0x17b8('0x5')](_0x17b8('0x8'))[_0x17b8('0x7')](_0x17b8('0x9'));}}},'savedAt':{'type':Sequelize[_0x17b8('0xa')]},'publishedAt':{'type':Sequelize[_0x17b8('0xa')]}}; \ No newline at end of file diff --git a/server/api/squareProject/squareProject.controller.js b/server/api/squareProject/squareProject.controller.js index ca5003a..a86ffeb 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 _0x6375=['autoAssociation','UserProfileResource','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','body','production','params','lodash','../../components/parsers/qs','../../config/logger','../../config/environment','redis','defaults','localhost','socket.io-emitter','./squareProject.socket','register','json','offset','limit','undefined','count','status','update','destroy','then','get','SquareProjects','publish','agi','stringify','sendStatus','error','name','send','index','SquareProject','fieldName','type','key','model','map','query','keys','filters','intersection','attributes','fields','length','nolimit','sort','where','pick','filter','VIRTUAL','merge','includeAll','include','findAll','show','rawAttributes','options','find','catch','create','user','Unable\x20to\x20retrieve\x20the\x20current\x20user','role','UserProfileSection','userProfileId'];(function(_0x2c912d,_0x5c8d3b){var _0x117645=function(_0x2526cc){while(--_0x2526cc){_0x2c912d['push'](_0x2c912d['shift']());}};_0x117645(++_0x5c8d3b);}(_0x6375,0xd5));var _0x5637=function(_0x4d613c,_0x55f220){_0x4d613c=_0x4d613c-0x0;var _0x301fe3=_0x6375[_0x4d613c];return _0x301fe3;};'use strict';var _=require(_0x5637('0x0'));var Redis=require('ioredis');var qs=require(_0x5637('0x1'));var logger=require(_0x5637('0x2'))('api');var config=require(_0x5637('0x3'));var db=require('../../mysqldb')['db'];config[_0x5637('0x4')]=_[_0x5637('0x5')](config[_0x5637('0x4')],{'host':_0x5637('0x6'),'port':0x18eb});var socket=require(_0x5637('0x7'))(new Redis(config['redis']));require(_0x5637('0x8'))[_0x5637('0x9')](socket);function respondWithResult(_0x180c9d,_0x5b3542){_0x5b3542=_0x5b3542||0xc8;return function(_0x3c377b){if(_0x3c377b){return _0x180c9d['status'](_0x5b3542)[_0x5637('0xa')](_0x3c377b);}};}function respondWithFilteredResult(_0x2fdbf9,_0x374d1b){return function(_0x2625a0){if(_0x2625a0){var _0xc47e2e=typeof _0x374d1b[_0x5637('0xb')]==='undefined'&&typeof _0x374d1b[_0x5637('0xc')]===_0x5637('0xd');var _0xb0280b=_0x2625a0[_0x5637('0xe')];var _0x59df13=_0xc47e2e?0x0:_0x374d1b[_0x5637('0xb')];var _0x450e19=_0xc47e2e?_0x2625a0[_0x5637('0xe')]:_0x374d1b[_0x5637('0xb')]+_0x374d1b['limit'];var _0x276612;if(_0x450e19>=_0xb0280b){_0x450e19=_0xb0280b;_0x276612=0xc8;}else{_0x276612=0xce;}_0x2fdbf9[_0x5637('0xf')](_0x276612);return _0x2fdbf9['set']('Content-Range',_0x59df13+'-'+_0x450e19+'/'+_0xb0280b)[_0x5637('0xa')](_0x2625a0);}return null;};}function saveUpdates(_0x15c618){return function(_0x124394){if(_0x124394){return _0x124394[_0x5637('0x10')](_0x15c618)['then'](function(_0x11391c){return _0x11391c;});}return null;};}function removeEntity(_0x57008c){return function(_0x5ba350){if(_0x5ba350){return _0x5ba350[_0x5637('0x11')]()[_0x5637('0x12')](function(){var _0x3f7148=_0x5ba350[_0x5637('0x13')]({'plain':!![]});var _0x20012e=_0x5637('0x14');return db['UserProfileResource']['destroy']({'where':{'type':_0x20012e,'resourceId':_0x3f7148['id']}})[_0x5637('0x12')](function(){return _0x5ba350;});})[_0x5637('0x12')](function(){var _0xd386a0=new Redis(config[_0x5637('0x4')]);_0xd386a0[_0x5637('0x15')](_0x5637('0x16'),JSON[_0x5637('0x17')]({'id':_0x5ba350['id'],'deleted':!![]}));})[_0x5637('0x12')](function(){_0x57008c['status'](0xcc)['end']();});}};}function handleEntityNotFound(_0x7d827d){return function(_0x183f6c){if(!_0x183f6c){_0x7d827d[_0x5637('0x18')](0x194);}return _0x183f6c;};}function handleError(_0x5b72d5,_0x35047d){_0x35047d=_0x35047d||0x1f4;return function(_0x334113){logger[_0x5637('0x19')](_0x334113['stack']);if(_0x334113[_0x5637('0x1a')]){delete _0x334113[_0x5637('0x1a')];}_0x5b72d5['status'](_0x35047d)[_0x5637('0x1b')](_0x334113);};}exports[_0x5637('0x1c')]=function(_0x8ce719,_0xa0c36e){var _0x2bac82={},_0x18cd60={},_0x17f9e0={'count':0x0,'rows':[]};var _0x1e7eb1=_['map'](db[_0x5637('0x1d')]['rawAttributes'],function(_0x2e7548){return{'name':_0x2e7548[_0x5637('0x1e')],'type':_0x2e7548[_0x5637('0x1f')][_0x5637('0x20')]};});_0x18cd60[_0x5637('0x21')]=_[_0x5637('0x22')](_0x1e7eb1,_0x5637('0x1a'));_0x18cd60[_0x5637('0x23')]=_[_0x5637('0x24')](_0x8ce719[_0x5637('0x23')]);_0x18cd60[_0x5637('0x25')]=_[_0x5637('0x26')](_0x18cd60[_0x5637('0x21')],_0x18cd60['query']);_0x2bac82[_0x5637('0x27')]=_['intersection'](_0x18cd60[_0x5637('0x21')],qs[_0x5637('0x28')](_0x8ce719['query'][_0x5637('0x28')]));_0x2bac82[_0x5637('0x27')]=_0x2bac82[_0x5637('0x27')][_0x5637('0x29')]?_0x2bac82[_0x5637('0x27')]:_0x18cd60[_0x5637('0x21')];if(!_0x8ce719[_0x5637('0x23')]['hasOwnProperty'](_0x5637('0x2a'))){_0x2bac82[_0x5637('0xc')]=qs['limit'](_0x8ce719['query'][_0x5637('0xc')]);_0x2bac82[_0x5637('0xb')]=qs['offset'](_0x8ce719['query'][_0x5637('0xb')]);}_0x2bac82['order']=qs[_0x5637('0x2b')](_0x8ce719[_0x5637('0x23')][_0x5637('0x2b')]);_0x2bac82[_0x5637('0x2c')]=qs[_0x5637('0x25')](_[_0x5637('0x2d')](_0x8ce719[_0x5637('0x23')],_0x18cd60[_0x5637('0x25')]),_0x1e7eb1);if(_0x8ce719[_0x5637('0x23')][_0x5637('0x2e')]){_0x2bac82[_0x5637('0x2c')]=_['merge'](_0x2bac82['where'],{'$or':_['map'](_0x1e7eb1,function(_0x4d8add){if(_0x4d8add[_0x5637('0x1f')]!==_0x5637('0x2f')){var _0x22287e={};_0x22287e[_0x4d8add[_0x5637('0x1a')]]={'$like':'%'+_0x8ce719[_0x5637('0x23')]['filter']+'%'};return _0x22287e;}})});}_0x2bac82=_[_0x5637('0x30')]({},_0x2bac82,_0x8ce719['options']);var _0x4da54f={'where':_0x2bac82['where']};return db['SquareProject'][_0x5637('0xe')](_0x4da54f)[_0x5637('0x12')](function(_0x5a6435){_0x17f9e0[_0x5637('0xe')]=_0x5a6435;if(_0x8ce719[_0x5637('0x23')][_0x5637('0x31')]){_0x2bac82[_0x5637('0x32')]=[{'all':!![]}];}return db[_0x5637('0x1d')][_0x5637('0x33')](_0x2bac82);})[_0x5637('0x12')](function(_0x8cce1d){_0x17f9e0['rows']=_0x8cce1d;return _0x17f9e0;})['then'](respondWithFilteredResult(_0xa0c36e,_0x2bac82))['catch'](handleError(_0xa0c36e,null));};exports[_0x5637('0x34')]=function(_0x4d8cff,_0x4d6f7a){var _0x10d675={'raw':![],'where':{'id':_0x4d8cff['params']['id']}},_0x275ead={};_0x275ead[_0x5637('0x21')]=_[_0x5637('0x24')](db['SquareProject'][_0x5637('0x35')]);_0x275ead[_0x5637('0x23')]=_['keys'](_0x4d8cff[_0x5637('0x23')]);_0x275ead[_0x5637('0x25')]=_[_0x5637('0x26')](_0x275ead['model'],_0x275ead[_0x5637('0x23')]);_0x10d675[_0x5637('0x27')]=_['intersection'](_0x275ead[_0x5637('0x21')],qs[_0x5637('0x28')](_0x4d8cff[_0x5637('0x23')]['fields']));_0x10d675[_0x5637('0x27')]=_0x10d675[_0x5637('0x27')][_0x5637('0x29')]?_0x10d675[_0x5637('0x27')]:_0x275ead[_0x5637('0x21')];if(_0x4d8cff[_0x5637('0x23')][_0x5637('0x31')]){_0x10d675[_0x5637('0x32')]=[{'all':!![]}];}_0x10d675=_['merge']({},_0x10d675,_0x4d8cff[_0x5637('0x36')]);return db['SquareProject'][_0x5637('0x37')](_0x10d675)[_0x5637('0x12')](handleEntityNotFound(_0x4d6f7a,null))[_0x5637('0x12')](respondWithResult(_0x4d6f7a,null))[_0x5637('0x38')](handleError(_0x4d6f7a,null));};exports['create']=function(_0x47f145,_0x3069be){return db[_0x5637('0x1d')][_0x5637('0x39')](_0x47f145['body'],{})[_0x5637('0x12')](function(_0x3537ea){var _0x19b05d=_0x47f145[_0x5637('0x3a')][_0x5637('0x13')]({'plain':!![]});if(!_0x19b05d)throw new Error(_0x5637('0x3b'));if(_0x19b05d[_0x5637('0x3c')]===_0x5637('0x3a')){var _0x46222f=_0x3537ea[_0x5637('0x13')]({'plain':!![]});var _0x59e63d=_0x5637('0x14');return db[_0x5637('0x3d')][_0x5637('0x37')]({'where':{'name':_0x59e63d,'userProfileId':_0x19b05d[_0x5637('0x3e')]},'raw':!![]})[_0x5637('0x12')](function(_0x495594){if(_0x495594&&_0x495594[_0x5637('0x3f')]===0x0){return db[_0x5637('0x40')][_0x5637('0x39')]({'name':_0x46222f['name'],'resourceId':_0x46222f['id'],'type':_0x495594[_0x5637('0x1a')],'sectionId':_0x495594['id']},{})[_0x5637('0x12')](function(){return _0x3537ea;});}else{return _0x3537ea;}})[_0x5637('0x38')](function(_0x2802a3){logger[_0x5637('0x19')](_0x5637('0x41'),_0x2802a3);throw _0x2802a3;});}return _0x3537ea;})[_0x5637('0x12')](respondWithResult(_0x3069be,0xc9))[_0x5637('0x38')](handleError(_0x3069be,null));};exports['update']=function(_0x2a265f,_0x33a686){if(_0x2a265f[_0x5637('0x42')]['id']){delete _0x2a265f[_0x5637('0x42')]['id'];}return db['SquareProject'][_0x5637('0x37')]({'where':{'id':_0x2a265f['params']['id']}})[_0x5637('0x12')](handleEntityNotFound(_0x33a686,null))[_0x5637('0x12')](saveUpdates(_0x2a265f[_0x5637('0x42')],null))[_0x5637('0x12')](function(_0x2187e0){if(!_0x2187e0)return;var _0x43767b=_0x2187e0[_0x5637('0x13')]({'plain':!![]});return _0x43767b;})[_0x5637('0x12')](function(_0x57a3c2){var _0x148c5d=new Redis(config[_0x5637('0x4')]);_0x148c5d[_0x5637('0x15')](_0x5637('0x16'),JSON[_0x5637('0x17')](_[_0x5637('0x2d')](_0x57a3c2,['id',_0x5637('0x1a'),_0x5637('0x43')])));return _0x57a3c2;})[_0x5637('0x12')](respondWithResult(_0x33a686,null))[_0x5637('0x38')](handleError(_0x33a686,null));};exports['destroy']=function(_0x317f6c,_0x4dc3e1){return db[_0x5637('0x1d')][_0x5637('0x37')]({'where':{'id':_0x317f6c[_0x5637('0x44')]['id']}})[_0x5637('0x12')](handleEntityNotFound(_0x4dc3e1,null))[_0x5637('0x12')](removeEntity(_0x4dc3e1,null))['catch'](handleError(_0x4dc3e1,null));}; \ No newline at end of file +var _0x3a53=['count','set','update','then','get','SquareProjects','publish','agi','status','sendStatus','stack','name','index','map','SquareProject','rawAttributes','fieldName','type','key','query','keys','filters','model','attributes','intersection','fields','hasOwnProperty','nolimit','order','sort','where','merge','VIRTUAL','filter','options','includeAll','include','findAll','rows','catch','show','find','create','user','Unable\x20to\x20retrieve\x20the\x20current\x20user','role','userProfileId','autoAssociation','UserProfileResource','error','body','params','stringify','pick','production','destroy','lodash','ioredis','../../components/parsers/qs','../../config/logger','api','../../config/environment','redis','defaults','localhost','socket.io-emitter','./squareProject.socket','register','json','offset','undefined','limit'];(function(_0x43ce45,_0x3c8f72){var _0xd50c7b=function(_0x314098){while(--_0x314098){_0x43ce45['push'](_0x43ce45['shift']());}};_0xd50c7b(++_0x3c8f72);}(_0x3a53,0x80));var _0x33a5=function(_0x2df864,_0x1e1504){_0x2df864=_0x2df864-0x0;var _0x17a34b=_0x3a53[_0x2df864];return _0x17a34b;};'use strict';var _=require(_0x33a5('0x0'));var Redis=require(_0x33a5('0x1'));var qs=require(_0x33a5('0x2'));var logger=require(_0x33a5('0x3'))(_0x33a5('0x4'));var config=require(_0x33a5('0x5'));var db=require('../../mysqldb')['db'];config[_0x33a5('0x6')]=_[_0x33a5('0x7')](config[_0x33a5('0x6')],{'host':_0x33a5('0x8'),'port':0x18eb});var socket=require(_0x33a5('0x9'))(new Redis(config[_0x33a5('0x6')]));require(_0x33a5('0xa'))[_0x33a5('0xb')](socket);function respondWithResult(_0x4bd92f,_0x2b3851){_0x2b3851=_0x2b3851||0xc8;return function(_0x4b5039){if(_0x4b5039){return _0x4bd92f['status'](_0x2b3851)[_0x33a5('0xc')](_0x4b5039);}};}function respondWithFilteredResult(_0x930af6,_0x40a87b){return function(_0x197f5a){if(_0x197f5a){var _0x4cd713=typeof _0x40a87b[_0x33a5('0xd')]===_0x33a5('0xe')&&typeof _0x40a87b[_0x33a5('0xf')]==='undefined';var _0x533d96=_0x197f5a[_0x33a5('0x10')];var _0x174c47=_0x4cd713?0x0:_0x40a87b[_0x33a5('0xd')];var _0x563d4c=_0x4cd713?_0x197f5a[_0x33a5('0x10')]:_0x40a87b[_0x33a5('0xd')]+_0x40a87b[_0x33a5('0xf')];var _0x1837fc;if(_0x563d4c>=_0x533d96){_0x563d4c=_0x533d96;_0x1837fc=0xc8;}else{_0x1837fc=0xce;}_0x930af6['status'](_0x1837fc);return _0x930af6[_0x33a5('0x11')]('Content-Range',_0x174c47+'-'+_0x563d4c+'/'+_0x533d96)[_0x33a5('0xc')](_0x197f5a);}return null;};}function saveUpdates(_0x14389c){return function(_0x3d7c90){if(_0x3d7c90){return _0x3d7c90[_0x33a5('0x12')](_0x14389c)['then'](function(_0x1e7e26){return _0x1e7e26;});}return null;};}function removeEntity(_0x4b39b0){return function(_0x34feb8){if(_0x34feb8){return _0x34feb8['destroy']()[_0x33a5('0x13')](function(){var _0x54bcff=_0x34feb8[_0x33a5('0x14')]({'plain':!![]});var _0x2a5779=_0x33a5('0x15');return db['UserProfileResource']['destroy']({'where':{'type':_0x2a5779,'resourceId':_0x54bcff['id']}})[_0x33a5('0x13')](function(){return _0x34feb8;});})[_0x33a5('0x13')](function(){var _0x470e5f=new Redis(config[_0x33a5('0x6')]);_0x470e5f[_0x33a5('0x16')](_0x33a5('0x17'),JSON['stringify']({'id':_0x34feb8['id'],'deleted':!![]}));})[_0x33a5('0x13')](function(){_0x4b39b0[_0x33a5('0x18')](0xcc)['end']();});}};}function handleEntityNotFound(_0x49f120){return function(_0x3e7119){if(!_0x3e7119){_0x49f120[_0x33a5('0x19')](0x194);}return _0x3e7119;};}function handleError(_0x3aa9de,_0x23bc5f){_0x23bc5f=_0x23bc5f||0x1f4;return function(_0x48c708){logger['error'](_0x48c708[_0x33a5('0x1a')]);if(_0x48c708[_0x33a5('0x1b')]){delete _0x48c708[_0x33a5('0x1b')];}_0x3aa9de['status'](_0x23bc5f)['send'](_0x48c708);};}exports[_0x33a5('0x1c')]=function(_0x1c2be5,_0x1d503f){var _0x4f398f={},_0x534a1a={},_0x5acd6a={'count':0x0,'rows':[]};var _0x53f009=_[_0x33a5('0x1d')](db[_0x33a5('0x1e')][_0x33a5('0x1f')],function(_0x154bf2){return{'name':_0x154bf2[_0x33a5('0x20')],'type':_0x154bf2[_0x33a5('0x21')][_0x33a5('0x22')]};});_0x534a1a['model']=_[_0x33a5('0x1d')](_0x53f009,'name');_0x534a1a[_0x33a5('0x23')]=_[_0x33a5('0x24')](_0x1c2be5[_0x33a5('0x23')]);_0x534a1a[_0x33a5('0x25')]=_['intersection'](_0x534a1a[_0x33a5('0x26')],_0x534a1a[_0x33a5('0x23')]);_0x4f398f[_0x33a5('0x27')]=_[_0x33a5('0x28')](_0x534a1a['model'],qs[_0x33a5('0x29')](_0x1c2be5[_0x33a5('0x23')]['fields']));_0x4f398f[_0x33a5('0x27')]=_0x4f398f[_0x33a5('0x27')]['length']?_0x4f398f[_0x33a5('0x27')]:_0x534a1a['model'];if(!_0x1c2be5[_0x33a5('0x23')][_0x33a5('0x2a')](_0x33a5('0x2b'))){_0x4f398f['limit']=qs[_0x33a5('0xf')](_0x1c2be5[_0x33a5('0x23')]['limit']);_0x4f398f[_0x33a5('0xd')]=qs['offset'](_0x1c2be5[_0x33a5('0x23')]['offset']);}_0x4f398f[_0x33a5('0x2c')]=qs[_0x33a5('0x2d')](_0x1c2be5[_0x33a5('0x23')]['sort']);_0x4f398f[_0x33a5('0x2e')]=qs[_0x33a5('0x25')](_['pick'](_0x1c2be5[_0x33a5('0x23')],_0x534a1a['filters']),_0x53f009);if(_0x1c2be5[_0x33a5('0x23')]['filter']){_0x4f398f[_0x33a5('0x2e')]=_[_0x33a5('0x2f')](_0x4f398f[_0x33a5('0x2e')],{'$or':_['map'](_0x53f009,function(_0x4d632e){if(_0x4d632e[_0x33a5('0x21')]!==_0x33a5('0x30')){var _0xaa2a25={};_0xaa2a25[_0x4d632e['name']]={'$like':'%'+_0x1c2be5[_0x33a5('0x23')][_0x33a5('0x31')]+'%'};return _0xaa2a25;}})});}_0x4f398f=_[_0x33a5('0x2f')]({},_0x4f398f,_0x1c2be5[_0x33a5('0x32')]);var _0x5bc612={'where':_0x4f398f[_0x33a5('0x2e')]};return db[_0x33a5('0x1e')]['count'](_0x5bc612)[_0x33a5('0x13')](function(_0x29844e){_0x5acd6a['count']=_0x29844e;if(_0x1c2be5['query'][_0x33a5('0x33')]){_0x4f398f[_0x33a5('0x34')]=[{'all':!![]}];}return db[_0x33a5('0x1e')][_0x33a5('0x35')](_0x4f398f);})['then'](function(_0x3294d0){_0x5acd6a[_0x33a5('0x36')]=_0x3294d0;return _0x5acd6a;})['then'](respondWithFilteredResult(_0x1d503f,_0x4f398f))[_0x33a5('0x37')](handleError(_0x1d503f,null));};exports[_0x33a5('0x38')]=function(_0x5d47ef,_0x23aa39){var _0x219c0e={'raw':![],'where':{'id':_0x5d47ef['params']['id']}},_0x1a9884={};_0x1a9884[_0x33a5('0x26')]=_[_0x33a5('0x24')](db[_0x33a5('0x1e')][_0x33a5('0x1f')]);_0x1a9884[_0x33a5('0x23')]=_['keys'](_0x5d47ef[_0x33a5('0x23')]);_0x1a9884[_0x33a5('0x25')]=_[_0x33a5('0x28')](_0x1a9884['model'],_0x1a9884['query']);_0x219c0e['attributes']=_[_0x33a5('0x28')](_0x1a9884[_0x33a5('0x26')],qs[_0x33a5('0x29')](_0x5d47ef[_0x33a5('0x23')]['fields']));_0x219c0e[_0x33a5('0x27')]=_0x219c0e[_0x33a5('0x27')]['length']?_0x219c0e[_0x33a5('0x27')]:_0x1a9884[_0x33a5('0x26')];if(_0x5d47ef[_0x33a5('0x23')]['includeAll']){_0x219c0e[_0x33a5('0x34')]=[{'all':!![]}];}_0x219c0e=_[_0x33a5('0x2f')]({},_0x219c0e,_0x5d47ef[_0x33a5('0x32')]);return db[_0x33a5('0x1e')][_0x33a5('0x39')](_0x219c0e)[_0x33a5('0x13')](handleEntityNotFound(_0x23aa39,null))['then'](respondWithResult(_0x23aa39,null))[_0x33a5('0x37')](handleError(_0x23aa39,null));};exports['create']=function(_0x31d27c,_0x3e5481){return db['SquareProject'][_0x33a5('0x3a')](_0x31d27c['body'],{})['then'](function(_0x2288ca){var _0x3050d2=_0x31d27c[_0x33a5('0x3b')]['get']({'plain':!![]});if(!_0x3050d2)throw new Error(_0x33a5('0x3c'));if(_0x3050d2[_0x33a5('0x3d')]==='user'){var _0x5d90bf=_0x2288ca[_0x33a5('0x14')]({'plain':!![]});var _0x178f55='SquareProjects';return db['UserProfileSection'][_0x33a5('0x39')]({'where':{'name':_0x178f55,'userProfileId':_0x3050d2[_0x33a5('0x3e')]},'raw':!![]})[_0x33a5('0x13')](function(_0x4cfc1c){if(_0x4cfc1c&&_0x4cfc1c[_0x33a5('0x3f')]===0x0){return db[_0x33a5('0x40')][_0x33a5('0x3a')]({'name':_0x5d90bf[_0x33a5('0x1b')],'resourceId':_0x5d90bf['id'],'type':_0x4cfc1c[_0x33a5('0x1b')],'sectionId':_0x4cfc1c['id']},{})[_0x33a5('0x13')](function(){return _0x2288ca;});}else{return _0x2288ca;}})[_0x33a5('0x37')](function(_0xd03856){logger[_0x33a5('0x41')]('Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s',_0xd03856);throw _0xd03856;});}return _0x2288ca;})[_0x33a5('0x13')](respondWithResult(_0x3e5481,0xc9))[_0x33a5('0x37')](handleError(_0x3e5481,null));};exports[_0x33a5('0x12')]=function(_0x4ec7ab,_0x65572){if(_0x4ec7ab[_0x33a5('0x42')]['id']){delete _0x4ec7ab[_0x33a5('0x42')]['id'];}return db[_0x33a5('0x1e')]['find']({'where':{'id':_0x4ec7ab[_0x33a5('0x43')]['id']}})['then'](handleEntityNotFound(_0x65572,null))[_0x33a5('0x13')](saveUpdates(_0x4ec7ab[_0x33a5('0x42')],null))[_0x33a5('0x13')](function(_0x5c7201){if(!_0x5c7201)return;var _0x16795f=_0x5c7201['get']({'plain':!![]});return _0x16795f;})[_0x33a5('0x13')](function(_0xa22f69){var _0x24bd51=new Redis(config[_0x33a5('0x6')]);_0x24bd51[_0x33a5('0x16')]('agi',JSON[_0x33a5('0x44')](_[_0x33a5('0x45')](_0xa22f69,['id',_0x33a5('0x1b'),_0x33a5('0x46')])));return _0xa22f69;})[_0x33a5('0x13')](respondWithResult(_0x65572,null))[_0x33a5('0x37')](handleError(_0x65572,null));};exports[_0x33a5('0x47')]=function(_0x19503e,_0x316411){return db[_0x33a5('0x1e')][_0x33a5('0x39')]({'where':{'id':_0x19503e[_0x33a5('0x43')]['id']}})['then'](handleEntityNotFound(_0x316411,null))['then'](removeEntity(_0x316411,null))['catch'](handleError(_0x316411,null));}; \ No newline at end of file diff --git a/server/api/squareProject/squareProject.events.js b/server/api/squareProject/squareProject.events.js index d6092bb..0da3b3b 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 _0x3f3a=['remove','emit','hasOwnProperty','events','../../mysqldb','SquareProject','save','update'];(function(_0x4683a3,_0x2cb153){var _0x4a17cf=function(_0x2bb399){while(--_0x2bb399){_0x4683a3['push'](_0x4683a3['shift']());}};_0x4a17cf(++_0x2cb153);}(_0x3f3a,0x6b));var _0xa3f3=function(_0x278e3c,_0x1c9cfd){_0x278e3c=_0x278e3c-0x0;var _0x3e2d9b=_0x3f3a[_0x278e3c];return _0x3e2d9b;};'use strict';var EventEmitter=require(_0xa3f3('0x0'));var SquareProject=require(_0xa3f3('0x1'))['db'][_0xa3f3('0x2')];var SquareProjectEvents=new EventEmitter();SquareProjectEvents['setMaxListeners'](0x0);var events={'afterCreate':_0xa3f3('0x3'),'afterUpdate':_0xa3f3('0x4'),'afterDestroy':_0xa3f3('0x5')};function emitEvent(_0x59f63f){return function(_0x279a28,_0x301d6c,_0x43c75e){SquareProjectEvents[_0xa3f3('0x6')](_0x59f63f+':'+_0x279a28['id'],_0x279a28);SquareProjectEvents[_0xa3f3('0x6')](_0x59f63f,_0x279a28);_0x43c75e(null);};}for(var e in events){if(events[_0xa3f3('0x7')](e)){var event=events[e];SquareProject['hook'](e,emitEvent(event));}}module['exports']=SquareProjectEvents; \ No newline at end of file +var _0x287d=['exports','events','update','remove','emit','hasOwnProperty'];(function(_0x8d5497,_0x31815c){var _0x45f13e=function(_0x28390e){while(--_0x28390e){_0x8d5497['push'](_0x8d5497['shift']());}};_0x45f13e(++_0x31815c);}(_0x287d,0x18d));var _0xd287=function(_0x5cabfd,_0x5dea47){_0x5cabfd=_0x5cabfd-0x0;var _0x4bc06c=_0x287d[_0x5cabfd];return _0x4bc06c;};'use strict';var EventEmitter=require(_0xd287('0x0'));var SquareProject=require('../../mysqldb')['db']['SquareProject'];var SquareProjectEvents=new EventEmitter();SquareProjectEvents['setMaxListeners'](0x0);var events={'afterCreate':'save','afterUpdate':_0xd287('0x1'),'afterDestroy':_0xd287('0x2')};function emitEvent(_0x39b582){return function(_0x2f077f,_0x53781d,_0x402826){SquareProjectEvents[_0xd287('0x3')](_0x39b582+':'+_0x2f077f['id'],_0x2f077f);SquareProjectEvents['emit'](_0x39b582,_0x2f077f);_0x402826(null);};}for(var e in events){if(events[_0xd287('0x4')](e)){var event=events[e];SquareProject['hook'](e,emitEvent(event));}}module[_0xd287('0x5')]=SquareProjectEvents; \ No newline at end of file diff --git a/server/api/squareProject/squareProject.model.js b/server/api/squareProject/squareProject.model.js index 094cb8b..d204377 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 _0xdbcb=['path','../../config/environment','exports','define','square_projects','changed','savedAt','format','YYYY-MM-DD\x20HH:mm:ss','production','publishedAt','lodash','util','../../config/logger','moment','bluebird','request-promise'];(function(_0x436ba3,_0x5e1123){var _0x42bc4d=function(_0x1d907e){while(--_0x1d907e){_0x436ba3['push'](_0x436ba3['shift']());}};_0x42bc4d(++_0x5e1123);}(_0xdbcb,0x13d));var _0xbdbc=function(_0x4c8812,_0xa9d102){_0x4c8812=_0x4c8812-0x0;var _0x42d129=_0xdbcb[_0x4c8812];return _0x42d129;};'use strict';var _=require(_0xbdbc('0x0'));var util=require(_0xbdbc('0x1'));var logger=require(_0xbdbc('0x2'))('api');var moment=require(_0xbdbc('0x3'));var BPromise=require(_0xbdbc('0x4'));var rp=require(_0xbdbc('0x5'));var fs=require('fs');var path=require(_0xbdbc('0x6'));var rimraf=require('rimraf');var config=require(_0xbdbc('0x7'));var attributes=require('./squareProject.attributes');module[_0xbdbc('0x8')]=function(_0x37402c,_0x13cb52){return _0x37402c[_0xbdbc('0x9')]('SquareProject',attributes,{'tableName':_0xbdbc('0xa'),'paranoid':![],'indexes':[],'timestamps':!![],'hooks':{'beforeUpdate':function(_0x41bf23,_0x3f5fa8,_0x630552){if(_0x41bf23[_0xbdbc('0xb')]('preproduction')){_0x41bf23[_0xbdbc('0xc')]=moment()[_0xbdbc('0xd')](_0xbdbc('0xe'));}if(_0x41bf23[_0xbdbc('0xb')](_0xbdbc('0xf'))){_0x41bf23[_0xbdbc('0x10')]=moment()[_0xbdbc('0xd')](_0xbdbc('0xe'));}_0x630552(null,_0x41bf23);}}});}; \ No newline at end of file +var _0x197f=['bluebird','request-promise','./squareProject.attributes','define','SquareProject','square_projects','changed','preproduction','savedAt','YYYY-MM-DD\x20HH:mm:ss','publishedAt','lodash','util','api','moment'];(function(_0x2c7dc6,_0x3c4ce0){var _0x10002b=function(_0x26f390){while(--_0x26f390){_0x2c7dc6['push'](_0x2c7dc6['shift']());}};_0x10002b(++_0x3c4ce0);}(_0x197f,0x1dc));var _0xf197=function(_0x283e93,_0x58101b){_0x283e93=_0x283e93-0x0;var _0x204bff=_0x197f[_0x283e93];return _0x204bff;};'use strict';var _=require(_0xf197('0x0'));var util=require(_0xf197('0x1'));var logger=require('../../config/logger')(_0xf197('0x2'));var moment=require(_0xf197('0x3'));var BPromise=require(_0xf197('0x4'));var rp=require(_0xf197('0x5'));var fs=require('fs');var path=require('path');var rimraf=require('rimraf');var config=require('../../config/environment');var attributes=require(_0xf197('0x6'));module['exports']=function(_0xcbfab9,_0x2ca9f2){return _0xcbfab9[_0xf197('0x7')](_0xf197('0x8'),attributes,{'tableName':_0xf197('0x9'),'paranoid':![],'indexes':[],'timestamps':!![],'hooks':{'beforeUpdate':function(_0x41adba,_0x32dda3,_0x4849e2){if(_0x41adba[_0xf197('0xa')](_0xf197('0xb'))){_0x41adba[_0xf197('0xc')]=moment()['format'](_0xf197('0xd'));}if(_0x41adba[_0xf197('0xa')]('production')){_0x41adba[_0xf197('0xe')]=moment()['format']('YYYY-MM-DD\x20HH:mm:ss');}_0x4849e2(null,_0x41adba);}}});}; \ No newline at end of file diff --git a/server/api/squareProject/squareProject.rpc.js b/server/api/squareProject/squareProject.rpc.js index 971eefe..568d210 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 _0x7bba=['../../config/environment','redis','localhost','socket.io-emitter','register','SquareProject','options','where','attributes','limit','include','map','model','then','info','debug','stringify','GetSquareProjects','message','error','ShowSquareProject','find','raw','catch','lodash','ioredis','../../config/logger','rpc'];(function(_0x4259a3,_0x2f9e82){var _0x5dfed4=function(_0x443519){while(--_0x443519){_0x4259a3['push'](_0x4259a3['shift']());}};_0x5dfed4(++_0x2f9e82);}(_0x7bba,0x1f4));var _0xa7bb=function(_0x4efdfd,_0x4a27df){_0x4efdfd=_0x4efdfd-0x0;var _0x2b413=_0x7bba[_0x4efdfd];return _0x2b413;};'use strict';var _=require(_0xa7bb('0x0'));var Redis=require(_0xa7bb('0x1'));var db=require('../../mysqldb')['db'];var logger=require(_0xa7bb('0x2'))(_0xa7bb('0x3'));var config=require(_0xa7bb('0x4'));config[_0xa7bb('0x5')]=_['defaults'](config[_0xa7bb('0x5')],{'host':_0xa7bb('0x6'),'port':0x18eb});var socket=require(_0xa7bb('0x7'))(new Redis(config['redis']));require('./squareProject.socket')[_0xa7bb('0x8')](socket);exports['GetSquareProjects']=function(_0xc8f042){var _0x48e811=this;return new Promise(function(_0x44e2c4,_0xff0bb0){return db[_0xa7bb('0x9')]['findAll']({'raw':_0xc8f042[_0xa7bb('0xa')]?_0xc8f042[_0xa7bb('0xa')]['raw']===undefined?!![]:![]:!![],'where':_0xc8f042[_0xa7bb('0xa')]?_0xc8f042[_0xa7bb('0xa')][_0xa7bb('0xb')]||null:null,'attributes':_0xc8f042['options']?_0xc8f042[_0xa7bb('0xa')][_0xa7bb('0xc')]||null:null,'limit':_0xc8f042[_0xa7bb('0xa')]?_0xc8f042['options'][_0xa7bb('0xd')]||null:null,'include':_0xc8f042[_0xa7bb('0xa')]?_0xc8f042['options'][_0xa7bb('0xe')]?_[_0xa7bb('0xf')](_0xc8f042[_0xa7bb('0xa')]['include'],function(_0x2a2925){return{'model':db[_0x2a2925[_0xa7bb('0x10')]],'as':_0x2a2925['as'],'attributes':_0x2a2925[_0xa7bb('0xc')],'include':_0x2a2925[_0xa7bb('0xe')]?_[_0xa7bb('0xf')](_0x2a2925['include'],function(_0x11398f){return{'model':db[_0x11398f['model']],'as':_0x11398f['as'],'attributes':_0x11398f[_0xa7bb('0xc')],'include':_0x11398f[_0xa7bb('0xe')]?_[_0xa7bb('0xf')](_0x11398f[_0xa7bb('0xe')],function(_0x288ff7){return{'model':db[_0x288ff7['model']],'as':_0x288ff7['as'],'attributes':_0x288ff7[_0xa7bb('0xc')]};}):[]};}):[]};}):[]:[]})[_0xa7bb('0x11')](function(_0x2aac0a){logger[_0xa7bb('0x12')]('GetSquareProjects',_0xc8f042);logger[_0xa7bb('0x13')]('GetSquareProjects',_0xc8f042,JSON[_0xa7bb('0x14')](_0x2aac0a));_0x44e2c4(_0x2aac0a);})['catch'](function(_0x45c30c){logger['error'](_0xa7bb('0x15'),_0x45c30c[_0xa7bb('0x16')],_0xc8f042);_0xff0bb0(_0x48e811[_0xa7bb('0x17')](0x1f4,_0x45c30c['message']));});});};exports[_0xa7bb('0x18')]=function(_0x3f9763){var _0x496f78=this;return new Promise(function(_0x145bd7,_0x25a87c){return db[_0xa7bb('0x9')][_0xa7bb('0x19')]({'raw':_0x3f9763['options']?_0x3f9763['options'][_0xa7bb('0x1a')]===undefined?!![]:![]:!![],'where':_0x3f9763[_0xa7bb('0xa')]?_0x3f9763['options'][_0xa7bb('0xb')]||null:null,'attributes':_0x3f9763[_0xa7bb('0xa')]?_0x3f9763[_0xa7bb('0xa')][_0xa7bb('0xc')]||null:null,'include':_0x3f9763[_0xa7bb('0xa')]?_0x3f9763[_0xa7bb('0xa')][_0xa7bb('0xe')]?_[_0xa7bb('0xf')](_0x3f9763['options'][_0xa7bb('0xe')],function(_0x1cc0c6){return{'model':db[_0x1cc0c6[_0xa7bb('0x10')]],'as':_0x1cc0c6['as'],'attributes':_0x1cc0c6[_0xa7bb('0xc')],'include':_0x1cc0c6[_0xa7bb('0xe')]?_[_0xa7bb('0xf')](_0x1cc0c6[_0xa7bb('0xe')],function(_0x4be649){return{'model':db[_0x4be649['model']],'as':_0x4be649['as'],'attributes':_0x4be649[_0xa7bb('0xc')],'include':_0x4be649[_0xa7bb('0xe')]?_[_0xa7bb('0xf')](_0x4be649['include'],function(_0x415c3e){return{'model':db[_0x415c3e['model']],'as':_0x415c3e['as'],'attributes':_0x415c3e['attributes']};}):[]};}):[]};}):[]:[]})[_0xa7bb('0x11')](function(_0x17bfc2){logger[_0xa7bb('0x12')](_0xa7bb('0x18'),_0x3f9763);logger[_0xa7bb('0x13')]('ShowSquareProject',_0x3f9763,JSON[_0xa7bb('0x14')](_0x17bfc2));_0x145bd7(_0x17bfc2);})[_0xa7bb('0x1b')](function(_0x10f486){logger[_0xa7bb('0x17')]('ShowSquareProject',_0x10f486['message'],_0x3f9763);_0x25a87c(_0x496f78[_0xa7bb('0x17')](0x1f4,_0x10f486[_0xa7bb('0x16')]));});});}; \ No newline at end of file +var _0x5dff=['catch','error','message','ShowSquareProject','lodash','ioredis','../../mysqldb','redis','defaults','localhost','socket.io-emitter','./squareProject.socket','SquareProject','findAll','options','raw','where','attributes','include','map','model','then','info','GetSquareProjects','debug','stringify'];(function(_0x5a2abe,_0x8638a3){var _0x4b4439=function(_0x57dfc8){while(--_0x57dfc8){_0x5a2abe['push'](_0x5a2abe['shift']());}};_0x4b4439(++_0x8638a3);}(_0x5dff,0x13c));var _0xf5df=function(_0x4addaa,_0x443146){_0x4addaa=_0x4addaa-0x0;var _0x3eb2eb=_0x5dff[_0x4addaa];return _0x3eb2eb;};'use strict';var _=require(_0xf5df('0x0'));var Redis=require(_0xf5df('0x1'));var db=require(_0xf5df('0x2'))['db'];var logger=require('../../config/logger')('rpc');var config=require('../../config/environment');config[_0xf5df('0x3')]=_[_0xf5df('0x4')](config['redis'],{'host':_0xf5df('0x5'),'port':0x18eb});var socket=require(_0xf5df('0x6'))(new Redis(config[_0xf5df('0x3')]));require(_0xf5df('0x7'))['register'](socket);exports['GetSquareProjects']=function(_0x4f2661){var _0x156a94=this;return new Promise(function(_0x2fd01e,_0x32a277){return db[_0xf5df('0x8')][_0xf5df('0x9')]({'raw':_0x4f2661[_0xf5df('0xa')]?_0x4f2661[_0xf5df('0xa')][_0xf5df('0xb')]===undefined?!![]:![]:!![],'where':_0x4f2661[_0xf5df('0xa')]?_0x4f2661[_0xf5df('0xa')][_0xf5df('0xc')]||null:null,'attributes':_0x4f2661['options']?_0x4f2661[_0xf5df('0xa')][_0xf5df('0xd')]||null:null,'limit':_0x4f2661[_0xf5df('0xa')]?_0x4f2661[_0xf5df('0xa')]['limit']||null:null,'include':_0x4f2661['options']?_0x4f2661[_0xf5df('0xa')][_0xf5df('0xe')]?_[_0xf5df('0xf')](_0x4f2661['options'][_0xf5df('0xe')],function(_0x2b038f){return{'model':db[_0x2b038f[_0xf5df('0x10')]],'as':_0x2b038f['as'],'attributes':_0x2b038f[_0xf5df('0xd')],'include':_0x2b038f[_0xf5df('0xe')]?_[_0xf5df('0xf')](_0x2b038f[_0xf5df('0xe')],function(_0x283654){return{'model':db[_0x283654[_0xf5df('0x10')]],'as':_0x283654['as'],'attributes':_0x283654[_0xf5df('0xd')],'include':_0x283654[_0xf5df('0xe')]?_[_0xf5df('0xf')](_0x283654['include'],function(_0x5eec22){return{'model':db[_0x5eec22[_0xf5df('0x10')]],'as':_0x5eec22['as'],'attributes':_0x5eec22[_0xf5df('0xd')]};}):[]};}):[]};}):[]:[]})[_0xf5df('0x11')](function(_0x3b4815){logger[_0xf5df('0x12')](_0xf5df('0x13'),_0x4f2661);logger[_0xf5df('0x14')](_0xf5df('0x13'),_0x4f2661,JSON[_0xf5df('0x15')](_0x3b4815));_0x2fd01e(_0x3b4815);})[_0xf5df('0x16')](function(_0x270e3b){logger[_0xf5df('0x17')]('GetSquareProjects',_0x270e3b[_0xf5df('0x18')],_0x4f2661);_0x32a277(_0x156a94[_0xf5df('0x17')](0x1f4,_0x270e3b['message']));});});};exports[_0xf5df('0x19')]=function(_0x51f240){var _0x4a72cc=this;return new Promise(function(_0x184e9a,_0x1daaf4){return db[_0xf5df('0x8')]['find']({'raw':_0x51f240[_0xf5df('0xa')]?_0x51f240['options'][_0xf5df('0xb')]===undefined?!![]:![]:!![],'where':_0x51f240['options']?_0x51f240[_0xf5df('0xa')][_0xf5df('0xc')]||null:null,'attributes':_0x51f240[_0xf5df('0xa')]?_0x51f240[_0xf5df('0xa')][_0xf5df('0xd')]||null:null,'include':_0x51f240['options']?_0x51f240[_0xf5df('0xa')][_0xf5df('0xe')]?_[_0xf5df('0xf')](_0x51f240[_0xf5df('0xa')][_0xf5df('0xe')],function(_0x693b4f){return{'model':db[_0x693b4f[_0xf5df('0x10')]],'as':_0x693b4f['as'],'attributes':_0x693b4f['attributes'],'include':_0x693b4f['include']?_[_0xf5df('0xf')](_0x693b4f[_0xf5df('0xe')],function(_0x7fcfd7){return{'model':db[_0x7fcfd7[_0xf5df('0x10')]],'as':_0x7fcfd7['as'],'attributes':_0x7fcfd7[_0xf5df('0xd')],'include':_0x7fcfd7[_0xf5df('0xe')]?_[_0xf5df('0xf')](_0x7fcfd7['include'],function(_0x1d099b){return{'model':db[_0x1d099b[_0xf5df('0x10')]],'as':_0x1d099b['as'],'attributes':_0x1d099b[_0xf5df('0xd')]};}):[]};}):[]};}):[]:[]})[_0xf5df('0x11')](function(_0xdd221c){logger[_0xf5df('0x12')](_0xf5df('0x19'),_0x51f240);logger[_0xf5df('0x14')](_0xf5df('0x19'),_0x51f240,JSON['stringify'](_0xdd221c));_0x184e9a(_0xdd221c);})[_0xf5df('0x16')](function(_0x172500){logger['error'](_0xf5df('0x19'),_0x172500[_0xf5df('0x18')],_0x51f240);_0x1daaf4(_0x4a72cc[_0xf5df('0x17')](0x1f4,_0x172500['message']));});});}; \ No newline at end of file diff --git a/server/api/squareProject/squareProject.socket.js b/server/api/squareProject/squareProject.socket.js index 2bbfdf4..5e8d7c2 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 _0xde90=['update','emit','removeListener','length','squareProject:','./squareProject.events','save','remove'];(function(_0x2a5778,_0x158ad9){var _0x5bb985=function(_0x4c928c){while(--_0x4c928c){_0x2a5778['push'](_0x2a5778['shift']());}};_0x5bb985(++_0x158ad9);}(_0xde90,0x1d5));var _0x0de9=function(_0x9664b9,_0x51d10e){_0x9664b9=_0x9664b9-0x0;var _0x420c36=_0xde90[_0x9664b9];return _0x420c36;};'use strict';var SquareProjectEvents=require(_0x0de9('0x0'));var events=[_0x0de9('0x1'),_0x0de9('0x2'),_0x0de9('0x3')];function createListener(_0x4764b4,_0x3661ca){return function(_0x527195){_0x3661ca[_0x0de9('0x4')](_0x4764b4,_0x527195);};}function removeListener(_0x4c82f0,_0x2587d0){return function(){SquareProjectEvents[_0x0de9('0x5')](_0x4c82f0,_0x2587d0);};}exports['register']=function(_0x17b2f3){for(var _0x1c86be=0x0,_0x5e6c7b=events[_0x0de9('0x6')];_0x1c86be<_0x5e6c7b;_0x1c86be++){var _0x31fc93=events[_0x1c86be];var _0x2ff235=createListener(_0x0de9('0x7')+_0x31fc93,_0x17b2f3);SquareProjectEvents['on'](_0x31fc93,_0x2ff235);}}; \ No newline at end of file +var _0x1870=['register','length','squareProject:','./squareProject.events','save','remove','update','emit','removeListener'];(function(_0x2dffae,_0xd1aa4a){var _0x5b01c4=function(_0x2dc567){while(--_0x2dc567){_0x2dffae['push'](_0x2dffae['shift']());}};_0x5b01c4(++_0xd1aa4a);}(_0x1870,0x123));var _0x0187=function(_0x246111,_0x472e65){_0x246111=_0x246111-0x0;var _0x1022c9=_0x1870[_0x246111];return _0x1022c9;};'use strict';var SquareProjectEvents=require(_0x0187('0x0'));var events=[_0x0187('0x1'),_0x0187('0x2'),_0x0187('0x3')];function createListener(_0x14b680,_0x583ee3){return function(_0x1c1914){_0x583ee3[_0x0187('0x4')](_0x14b680,_0x1c1914);};}function removeListener(_0x4dbd81,_0x31e303){return function(){SquareProjectEvents[_0x0187('0x5')](_0x4dbd81,_0x31e303);};}exports[_0x0187('0x6')]=function(_0x3a45e9){for(var _0x2eca60=0x0,_0x1f8405=events[_0x0187('0x7')];_0x2eca60<_0x1f8405;_0x2eca60++){var _0x4cd8a8=events[_0x2eca60];var _0x24f961=createListener(_0x0187('0x8')+_0x4cd8a8,_0x3a45e9);SquareProjectEvents['on'](_0x4cd8a8,_0x24f961);}}; \ No newline at end of file diff --git a/server/api/squareRecording/index.js b/server/api/squareRecording/index.js index 99da28b..fd0e242 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(_0x71f4dc,_0x4ace6c){var _0x266975=function(_0x219c17){while(--_0x219c17){_0x71f4dc['push'](_0x71f4dc['shift']());}};_0x266975(++_0x4ace6c);}(_0x5fc3,0xa8));var _0x35fc=function(_0x4191af,_0x5783da){_0x4191af=_0x4191af-0x0;var _0x27bebf=_0x5fc3[_0x4191af];return _0x27bebf;};'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 _0x814b=['multer','util','path','connect-timeout','express','Router','../../components/auth/service','../../components/interaction/service','../../config/environment','./squareRecording.controller','get','isAuthenticated','/:id','show','/:id/download','download','post','create','put','delete','destroy','exports'];(function(_0x3e4c58,_0x14f07a){var _0x2e7c65=function(_0xa41ad7){while(--_0xa41ad7){_0x3e4c58['push'](_0x3e4c58['shift']());}};_0x2e7c65(++_0x14f07a);}(_0x814b,0x1a2));var _0xb814=function(_0xe501ff,_0x955b7e){_0xe501ff=_0xe501ff-0x0;var _0x17135d=_0x814b[_0xe501ff];return _0x17135d;};'use strict';var multer=require(_0xb814('0x0'));var util=require(_0xb814('0x1'));var path=require(_0xb814('0x2'));var timeout=require(_0xb814('0x3'));var express=require(_0xb814('0x4'));var router=express[_0xb814('0x5')]();var fs_extra=require('fs-extra');var auth=require(_0xb814('0x6'));var interaction=require(_0xb814('0x7'));var config=require(_0xb814('0x8'));var controller=require(_0xb814('0x9'));router[_0xb814('0xa')]('/',auth[_0xb814('0xb')](),controller['index']);router[_0xb814('0xa')](_0xb814('0xc'),auth['isAuthenticated'](),controller[_0xb814('0xd')]);router[_0xb814('0xa')](_0xb814('0xe'),auth[_0xb814('0xb')](),controller[_0xb814('0xf')]);router[_0xb814('0x10')]('/',auth[_0xb814('0xb')](),controller[_0xb814('0x11')]);router[_0xb814('0x12')](_0xb814('0xc'),auth[_0xb814('0xb')](),controller['update']);router[_0xb814('0x13')]('/:id',auth[_0xb814('0xb')](),controller[_0xb814('0x14')]);module[_0xb814('0x15')]=router; \ No newline at end of file diff --git a/server/api/squareRecording/squareRecording.attributes.js b/server/api/squareRecording/squareRecording.attributes.js index e873ec3..f16dc41 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 _0x55ca=['sequelize','exports','STRING','VIRTUAL','getDataValue','substring','lastIndexOf'];(function(_0x470abd,_0x17ef85){var _0x4122c6=function(_0x670550){while(--_0x670550){_0x470abd['push'](_0x470abd['shift']());}};_0x4122c6(++_0x17ef85);}(_0x55ca,0x126));var _0xa55c=function(_0x49f19e,_0x1c3aa3){_0x49f19e=_0x49f19e-0x0;var _0x280b5a=_0x55ca[_0x49f19e];return _0x280b5a;};'use strict';var Sequelize=require(_0xa55c('0x0'));module[_0xa55c('0x1')]={'uniqueid':{'type':Sequelize['STRING']},'callerid':{'type':Sequelize['STRING']},'calleridname':{'type':Sequelize['STRING']},'context':{'type':Sequelize[_0xa55c('0x2')]},'extension':{'type':Sequelize[_0xa55c('0x2')]},'priority':{'type':Sequelize['STRING']},'accountcode':{'type':Sequelize[_0xa55c('0x2')]},'dnid':{'type':Sequelize[_0xa55c('0x2')]},'projectName':{'type':Sequelize[_0xa55c('0x2')]},'saveName':{'type':Sequelize[_0xa55c('0x2')]},'filename':{'type':Sequelize[_0xa55c('0x2')]},'savePath':{'type':Sequelize[_0xa55c('0x2')]},'format':{'type':Sequelize[_0xa55c('0x3')],'get':function(){var _0x4d0624='';var _0x2121fd=this[_0xa55c('0x4')]('savePath');if(_0x2121fd){_0x4d0624=_0x2121fd[_0xa55c('0x5')](_0x2121fd[_0xa55c('0x6')]('.'));}return _0x4d0624;}}}; \ No newline at end of file +var _0xb138=['getDataValue','substring','lastIndexOf','sequelize','exports','STRING'];(function(_0x58b6b8,_0x48b45f){var _0x388c0b=function(_0x4e0d8e){while(--_0x4e0d8e){_0x58b6b8['push'](_0x58b6b8['shift']());}};_0x388c0b(++_0x48b45f);}(_0xb138,0x1dd));var _0x8b13=function(_0x534fc7,_0x4974a5){_0x534fc7=_0x534fc7-0x0;var _0x520dcb=_0xb138[_0x534fc7];return _0x520dcb;};'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 e4de1b3..3391a2e 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 _0xdf18=['save','then','destroy','error','stack','send','fieldName','type','key','model','map','name','keys','query','filters','attributes','fields','hasOwnProperty','nolimit','order','sort','where','pick','filter','VIRTUAL','merge','SquareRecording','includeAll','findAll','rows','catch','show','params','rawAttributes','intersection','include','find','create','body','update','download','../../components/encryptor','uniqueid','filename','format','decryptFile','savePath','existsSync','Sequelize','ValidationError','SquareRecording\x20not\x20found','extname','unlink','Not\x20found','Entity\x20not\x20found','cancellazione\x20fisica\x20documento\x20%s','isNil','File:\x20\x22','.cypher','rimraf','fast-json-patch','moment','bluebird','mustache','path','sox','ejs','fs-extra','squel','crypto','desk.js','to-csv','querystring','ioredis','../../config/license/hardware','api','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','sendStatus','status','end','json','offset','undefined','count','limit','set','Content-Range','apply'];(function(_0x166f59,_0x4fccca){var _0x23db26=function(_0x6c53a1){while(--_0x6c53a1){_0x166f59['push'](_0x166f59['shift']());}};_0x23db26(++_0x4fccca);}(_0xdf18,0xf1));var _0x8df1=function(_0x192ed6,_0x22ef1e){_0x192ed6=_0x192ed6-0x0;var _0x55ce18=_0xdf18[_0x192ed6];return _0x55ce18;};'use strict';var emlformat=require('eml-format');var rimraf=require(_0x8df1('0x0'));var zipdir=require('zip-dir');var jsonpatch=require(_0x8df1('0x1'));var rp=require('request-promise');var moment=require(_0x8df1('0x2'));var BPromise=require(_0x8df1('0x3'));var Mustache=require(_0x8df1('0x4'));var util=require('util');var path=require(_0x8df1('0x5'));var sox=require(_0x8df1('0x6'));var csv=require('to-csv');var ejs=require(_0x8df1('0x7'));var fs=require('fs');var fs_extra=require(_0x8df1('0x8'));var _=require('lodash');var squel=require(_0x8df1('0x9'));var crypto=require(_0x8df1('0xa'));var jsforce=require('jsforce');var deskjs=require(_0x8df1('0xb'));var toCsv=require(_0x8df1('0xc'));var querystring=require(_0x8df1('0xd'));var Papa=require('papaparse');var Redis=require(_0x8df1('0xe'));var authService=require('../../components/auth/service');var qs=require('../../components/parsers/qs');var as=require('../../components/parsers/advancedSearch');var hardwareService=require(_0x8df1('0xf'));var logger=require('../../config/logger')(_0x8df1('0x10'));var utils=require(_0x8df1('0x11'));var config=require(_0x8df1('0x12'));var licenseUtil=require(_0x8df1('0x13'));var db=require(_0x8df1('0x14'))['db'];function respondWithStatusCode(_0x29dc74,_0x5eb34b){_0x5eb34b=_0x5eb34b||0xcc;return function(_0x3ad72c){if(_0x3ad72c){return _0x29dc74[_0x8df1('0x15')](_0x5eb34b);}return _0x29dc74[_0x8df1('0x16')](_0x5eb34b)[_0x8df1('0x17')]();};}function respondWithResult(_0x19f7a7,_0x3a1f31){_0x3a1f31=_0x3a1f31||0xc8;return function(_0x4eff51){if(_0x4eff51){return _0x19f7a7[_0x8df1('0x16')](_0x3a1f31)[_0x8df1('0x18')](_0x4eff51);}};}function respondWithFilteredResult(_0x3af918,_0x56c575){return function(_0xff09dd){if(_0xff09dd){var _0x3f524d=typeof _0x56c575[_0x8df1('0x19')]===_0x8df1('0x1a')&&typeof _0x56c575['limit']===_0x8df1('0x1a');var _0x55025f=_0xff09dd[_0x8df1('0x1b')];var _0x48e2a9=_0x3f524d?0x0:_0x56c575[_0x8df1('0x19')];var _0x3bad0=_0x3f524d?_0xff09dd[_0x8df1('0x1b')]:_0x56c575['offset']+_0x56c575[_0x8df1('0x1c')];var _0x54bbad;if(_0x3bad0>=_0x55025f){_0x3bad0=_0x55025f;_0x54bbad=0xc8;}else{_0x54bbad=0xce;}_0x3af918[_0x8df1('0x16')](_0x54bbad);return _0x3af918[_0x8df1('0x1d')](_0x8df1('0x1e'),_0x48e2a9+'-'+_0x3bad0+'/'+_0x55025f)['json'](_0xff09dd);}return null;};}function patchUpdates(_0x47afd5){return function(_0x55fc45){try{jsonpatch[_0x8df1('0x1f')](_0x55fc45,_0x47afd5,!![]);}catch(_0x503dac){return BPromise['reject'](_0x503dac);}return _0x55fc45[_0x8df1('0x20')]();};}function saveUpdates(_0x55cc8b,_0x458d6e){return function(_0x48739b){if(_0x48739b){return _0x48739b['update'](_0x55cc8b)[_0x8df1('0x21')](function(_0x1ee4ce){return _0x1ee4ce;});}return null;};}function removeEntity(_0x27e430,_0x36e088){return function(_0x5aadb0){if(_0x5aadb0){return _0x5aadb0[_0x8df1('0x22')]()[_0x8df1('0x21')](function(){_0x27e430[_0x8df1('0x16')](0xcc)['end']();});}};}function handleEntityNotFound(_0x2bd564,_0x22edfb){return function(_0x2589c3){if(!_0x2589c3){_0x2bd564[_0x8df1('0x15')](0x194);}return _0x2589c3;};}function handleError(_0x8974f2,_0x104d6a){_0x104d6a=_0x104d6a||0x1f4;return function(_0x5e35d9){logger[_0x8df1('0x23')](_0x5e35d9[_0x8df1('0x24')]);if(_0x5e35d9['name']){delete _0x5e35d9['name'];}_0x8974f2[_0x8df1('0x16')](_0x104d6a)[_0x8df1('0x25')](_0x5e35d9);};}exports['index']=function(_0x28860f,_0x1c9cfe){var _0x1d8417={},_0x2aaae3={},_0x5d80f2={'count':0x0,'rows':[]};var _0x2838c8=_['map'](db['SquareRecording']['rawAttributes'],function(_0x80ce83){return{'name':_0x80ce83[_0x8df1('0x26')],'type':_0x80ce83[_0x8df1('0x27')][_0x8df1('0x28')]};});_0x2aaae3[_0x8df1('0x29')]=_[_0x8df1('0x2a')](_0x2838c8,_0x8df1('0x2b'));_0x2aaae3['query']=_[_0x8df1('0x2c')](_0x28860f[_0x8df1('0x2d')]);_0x2aaae3[_0x8df1('0x2e')]=_['intersection'](_0x2aaae3[_0x8df1('0x29')],_0x2aaae3[_0x8df1('0x2d')]);_0x1d8417[_0x8df1('0x2f')]=_['intersection'](_0x2aaae3[_0x8df1('0x29')],qs[_0x8df1('0x30')](_0x28860f['query'][_0x8df1('0x30')]));_0x1d8417[_0x8df1('0x2f')]=_0x1d8417[_0x8df1('0x2f')]['length']?_0x1d8417[_0x8df1('0x2f')]:_0x2aaae3['model'];if(!_0x28860f[_0x8df1('0x2d')][_0x8df1('0x31')](_0x8df1('0x32'))){_0x1d8417['limit']=qs[_0x8df1('0x1c')](_0x28860f[_0x8df1('0x2d')]['limit']);_0x1d8417[_0x8df1('0x19')]=qs[_0x8df1('0x19')](_0x28860f[_0x8df1('0x2d')][_0x8df1('0x19')]);}_0x1d8417[_0x8df1('0x33')]=qs['sort'](_0x28860f[_0x8df1('0x2d')][_0x8df1('0x34')]);_0x1d8417[_0x8df1('0x35')]=qs[_0x8df1('0x2e')](_[_0x8df1('0x36')](_0x28860f[_0x8df1('0x2d')],_0x2aaae3['filters']),_0x2838c8);if(_0x28860f[_0x8df1('0x2d')][_0x8df1('0x37')]){_0x1d8417[_0x8df1('0x35')]=_['merge'](_0x1d8417[_0x8df1('0x35')],{'$or':_[_0x8df1('0x2a')](_0x2838c8,function(_0x23da8e){if(_0x23da8e[_0x8df1('0x27')]!==_0x8df1('0x38')){var _0x8462f3={};_0x8462f3[_0x23da8e[_0x8df1('0x2b')]]={'$like':'%'+_0x28860f['query']['filter']+'%'};return _0x8462f3;}})});}_0x1d8417=_[_0x8df1('0x39')]({},_0x1d8417,_0x28860f['options']);var _0x40d9c5={'where':_0x1d8417[_0x8df1('0x35')]};return db[_0x8df1('0x3a')]['count'](_0x40d9c5)[_0x8df1('0x21')](function(_0x187ee6){_0x5d80f2['count']=_0x187ee6;if(_0x28860f['query'][_0x8df1('0x3b')]){_0x1d8417['include']=[{'all':!![]}];}return db[_0x8df1('0x3a')][_0x8df1('0x3c')](_0x1d8417);})[_0x8df1('0x21')](function(_0x4400e2){_0x5d80f2[_0x8df1('0x3d')]=_0x4400e2;return _0x5d80f2;})['then'](respondWithFilteredResult(_0x1c9cfe,_0x1d8417))[_0x8df1('0x3e')](handleError(_0x1c9cfe,null));};exports[_0x8df1('0x3f')]=function(_0x25a6a0,_0x2e49b8){var _0x3024a8={'raw':!![],'where':{'id':_0x25a6a0[_0x8df1('0x40')]['id']}},_0x5b873b={};_0x5b873b[_0x8df1('0x29')]=_[_0x8df1('0x2c')](db[_0x8df1('0x3a')][_0x8df1('0x41')]);_0x5b873b[_0x8df1('0x2d')]=_['keys'](_0x25a6a0[_0x8df1('0x2d')]);_0x5b873b[_0x8df1('0x2e')]=_[_0x8df1('0x42')](_0x5b873b['model'],_0x5b873b['query']);_0x3024a8[_0x8df1('0x2f')]=_[_0x8df1('0x42')](_0x5b873b[_0x8df1('0x29')],qs[_0x8df1('0x30')](_0x25a6a0[_0x8df1('0x2d')]['fields']));_0x3024a8['attributes']=_0x3024a8['attributes']['length']?_0x3024a8[_0x8df1('0x2f')]:_0x5b873b[_0x8df1('0x29')];if(_0x25a6a0[_0x8df1('0x2d')][_0x8df1('0x3b')]){_0x3024a8[_0x8df1('0x43')]=[{'all':!![]}];}_0x3024a8=_[_0x8df1('0x39')]({},_0x3024a8,_0x25a6a0['options']);return db[_0x8df1('0x3a')][_0x8df1('0x44')](_0x3024a8)['then'](handleEntityNotFound(_0x2e49b8,null))[_0x8df1('0x21')](respondWithResult(_0x2e49b8,null))[_0x8df1('0x3e')](handleError(_0x2e49b8,null));};exports[_0x8df1('0x45')]=function(_0x2e522d,_0x35b345){return db[_0x8df1('0x3a')][_0x8df1('0x45')](_0x2e522d[_0x8df1('0x46')],{})['then'](respondWithResult(_0x35b345,0xc9))[_0x8df1('0x3e')](handleError(_0x35b345,null));};exports[_0x8df1('0x47')]=function(_0x172610,_0x39ec5d){if(_0x172610['body']['id']){delete _0x172610[_0x8df1('0x46')]['id'];}return db[_0x8df1('0x3a')]['find']({'where':{'id':_0x172610[_0x8df1('0x40')]['id']}})[_0x8df1('0x21')](handleEntityNotFound(_0x39ec5d,null))[_0x8df1('0x21')](saveUpdates(_0x172610['body'],null))[_0x8df1('0x21')](respondWithResult(_0x39ec5d,null))[_0x8df1('0x3e')](handleError(_0x39ec5d,null));};exports[_0x8df1('0x48')]=function(_0x4c23e1,_0x2613c4,_0x55640c){var _0x493abe=require(_0x8df1('0x49'));var _0x301829=![];var _0x191073={};if(_0x4c23e1[_0x8df1('0x2d')]['type']&&_0x4c23e1[_0x8df1('0x2d')][_0x8df1('0x27')]==='uniqueid'){_0x191073[_0x8df1('0x4a')]=_0x4c23e1[_0x8df1('0x40')]['id'];}else{_0x191073['id']=_0x4c23e1[_0x8df1('0x40')]['id'];}return db[_0x8df1('0x3a')][_0x8df1('0x44')]({'where':_0x191073,'attributes':['id','savePath',_0x8df1('0x4b')],'raw':!![]})[_0x8df1('0x21')](handleEntityNotFound(_0x2613c4,null))[_0x8df1('0x21')](function(_0x197ee6){if(_0x197ee6){var _0x3f9a19=_0x197ee6['savePath'];var _0x40ef20=util[_0x8df1('0x4c')]('%s.cypher',_0x3f9a19);if(fs['existsSync'](_0x40ef20)){_0x301829=!![];return _0x493abe[_0x8df1('0x4d')](_0x40ef20,_0x3f9a19,config['secrets']['recording'])['then'](function(){return _0x197ee6;});}return _0x197ee6;}})[_0x8df1('0x21')](function(_0x49fc04){if(_0x49fc04){var _0x316f24=_0x49fc04[_0x8df1('0x4e')];if(!fs[_0x8df1('0x4f')](_0x316f24)){throw new db[(_0x8df1('0x50'))][(_0x8df1('0x51'))](_0x8df1('0x52'));}if(_0x49fc04['filename']){return _0x2613c4['download'](_0x316f24,_0x49fc04['filename']+path[_0x8df1('0x53')](_0x316f24),function(){if(_0x301829){fs[_0x8df1('0x54')](_0x316f24);}});}else{return _0x2613c4['download'](_0x316f24,function(_0x190c94){if(_0x301829){fs[_0x8df1('0x54')](_0x316f24);}});}}})[_0x8df1('0x3e')](function(_0x280d66){if(_0x280d66['message']===_0x8df1('0x52')){_0x2613c4['status'](0x194)[_0x8df1('0x25')](_0x8df1('0x55'));}else{return handleError(_0x2613c4,null);}});};exports[_0x8df1('0x22')]=function(_0x39401b,_0x47e678){return db[_0x8df1('0x3a')][_0x8df1('0x44')]({'where':{'id':_0x39401b['params']['id']}})[_0x8df1('0x21')](function(_0x5003d6){if(_['isNil'](_0x5003d6)){throw new ReferenceError(_0x8df1('0x56'));}return _0x5003d6;})['then'](function(_0x327338){var _0x4072f0=_0x327338[_0x8df1('0x4e')];logger['info'](_0x8df1('0x57'),_0x4072f0);if(!_[_0x8df1('0x58')](_0x327338[_0x8df1('0x4e')])&&fs['existsSync'](_0x4072f0)){logger['info'](_0x8df1('0x59')+_0x4072f0+'\x22\x20trovato\x20eseguo\x20la\x20cancellazione');fs['unlinkSync'](_0x4072f0);}_0x4072f0=_0x4072f0+_0x8df1('0x5a');if(!_[_0x8df1('0x58')](_0x327338['savePath'])&&fs[_0x8df1('0x4f')](_0x4072f0)){logger['info']('File:\x20\x22'+_0x4072f0+'\x22\x20trovato\x20eseguo\x20la\x20cancellazione');fs['unlinkSync'](_0x4072f0);}return _0x327338;})['then'](function(_0x3021f7){if(!_0x3021f7)throw new InternalError();return _0x3021f7['destroy']();})['then'](function(){_0x47e678[_0x8df1('0x16')](0xcc)['end']();})['catch'](handleError(_0x47e678,null));}; \ No newline at end of file +var _0xb6b1=['catch','create','body','find','params','download','../../components/encryptor','uniqueid','savePath','filename','format','%s.cypher','secrets','recording','existsSync','ValidationError','unlink','SquareRecording\x20not\x20found','destroy','isNil','Entity\x20not\x20found','info','cancellazione\x20fisica\x20documento\x20%s','File:\x20\x22','\x22\x20trovato\x20eseguo\x20la\x20cancellazione','.cypher','eml-format','zip-dir','request-promise','moment','util','path','sox','to-csv','ejs','fs-extra','lodash','crypto','jsforce','desk.js','querystring','papaparse','../../components/auth/service','../../components/parsers/advancedSearch','../../config/license/hardware','api','../../mysqldb','sendStatus','status','end','offset','limit','set','json','reject','save','update','then','error','stack','name','send','index','map','rawAttributes','fieldName','type','key','model','query','keys','filters','intersection','fields','attributes','length','nolimit','order','sort','where','pick','filter','merge','VIRTUAL','options','count','includeAll','include','SquareRecording','findAll','rows'];(function(_0x16a637,_0x5eb627){var _0x25126d=function(_0x54e016){while(--_0x54e016){_0x16a637['push'](_0x16a637['shift']());}};_0x25126d(++_0x5eb627);}(_0xb6b1,0x75));var _0x1b6b=function(_0x31abee,_0x11ff0c){_0x31abee=_0x31abee-0x0;var _0x3c1761=_0xb6b1[_0x31abee];return _0x3c1761;};'use strict';var emlformat=require(_0x1b6b('0x0'));var rimraf=require('rimraf');var zipdir=require(_0x1b6b('0x1'));var jsonpatch=require('fast-json-patch');var rp=require(_0x1b6b('0x2'));var moment=require(_0x1b6b('0x3'));var BPromise=require('bluebird');var Mustache=require('mustache');var util=require(_0x1b6b('0x4'));var path=require(_0x1b6b('0x5'));var sox=require(_0x1b6b('0x6'));var csv=require(_0x1b6b('0x7'));var ejs=require(_0x1b6b('0x8'));var fs=require('fs');var fs_extra=require(_0x1b6b('0x9'));var _=require(_0x1b6b('0xa'));var squel=require('squel');var crypto=require(_0x1b6b('0xb'));var jsforce=require(_0x1b6b('0xc'));var deskjs=require(_0x1b6b('0xd'));var toCsv=require(_0x1b6b('0x7'));var querystring=require(_0x1b6b('0xe'));var Papa=require(_0x1b6b('0xf'));var Redis=require('ioredis');var authService=require(_0x1b6b('0x10'));var qs=require('../../components/parsers/qs');var as=require(_0x1b6b('0x11'));var hardwareService=require(_0x1b6b('0x12'));var logger=require('../../config/logger')(_0x1b6b('0x13'));var utils=require('../../config/utils');var config=require('../../config/environment');var licenseUtil=require('../../config/license/util');var db=require(_0x1b6b('0x14'))['db'];function respondWithStatusCode(_0x1fd183,_0x5ac20b){_0x5ac20b=_0x5ac20b||0xcc;return function(_0x18cf87){if(_0x18cf87){return _0x1fd183[_0x1b6b('0x15')](_0x5ac20b);}return _0x1fd183[_0x1b6b('0x16')](_0x5ac20b)[_0x1b6b('0x17')]();};}function respondWithResult(_0x38b478,_0x1c4f98){_0x1c4f98=_0x1c4f98||0xc8;return function(_0x5cdff7){if(_0x5cdff7){return _0x38b478[_0x1b6b('0x16')](_0x1c4f98)['json'](_0x5cdff7);}};}function respondWithFilteredResult(_0x5a38fd,_0x366757){return function(_0x4a153c){if(_0x4a153c){var _0x5a8210=typeof _0x366757[_0x1b6b('0x18')]==='undefined'&&typeof _0x366757[_0x1b6b('0x19')]==='undefined';var _0x5ed5fa=_0x4a153c['count'];var _0x4f2e04=_0x5a8210?0x0:_0x366757[_0x1b6b('0x18')];var _0x4ad553=_0x5a8210?_0x4a153c['count']:_0x366757[_0x1b6b('0x18')]+_0x366757['limit'];var _0x5895be;if(_0x4ad553>=_0x5ed5fa){_0x4ad553=_0x5ed5fa;_0x5895be=0xc8;}else{_0x5895be=0xce;}_0x5a38fd[_0x1b6b('0x16')](_0x5895be);return _0x5a38fd[_0x1b6b('0x1a')]('Content-Range',_0x4f2e04+'-'+_0x4ad553+'/'+_0x5ed5fa)[_0x1b6b('0x1b')](_0x4a153c);}return null;};}function patchUpdates(_0x254512){return function(_0x1294f9){try{jsonpatch['apply'](_0x1294f9,_0x254512,!![]);}catch(_0x3a29b8){return BPromise[_0x1b6b('0x1c')](_0x3a29b8);}return _0x1294f9[_0x1b6b('0x1d')]();};}function saveUpdates(_0x165d75,_0x453b30){return function(_0x3f0414){if(_0x3f0414){return _0x3f0414[_0x1b6b('0x1e')](_0x165d75)[_0x1b6b('0x1f')](function(_0x1947bf){return _0x1947bf;});}return null;};}function removeEntity(_0x2e09b8,_0x33cb32){return function(_0x5c424b){if(_0x5c424b){return _0x5c424b['destroy']()['then'](function(){_0x2e09b8['status'](0xcc)[_0x1b6b('0x17')]();});}};}function handleEntityNotFound(_0x5a89c2,_0x15a9ff){return function(_0x10123b){if(!_0x10123b){_0x5a89c2[_0x1b6b('0x15')](0x194);}return _0x10123b;};}function handleError(_0x4883ea,_0x1d5764){_0x1d5764=_0x1d5764||0x1f4;return function(_0x486918){logger[_0x1b6b('0x20')](_0x486918[_0x1b6b('0x21')]);if(_0x486918[_0x1b6b('0x22')]){delete _0x486918[_0x1b6b('0x22')];}_0x4883ea[_0x1b6b('0x16')](_0x1d5764)[_0x1b6b('0x23')](_0x486918);};}exports[_0x1b6b('0x24')]=function(_0x345b83,_0x22e940){var _0x3c86c4={},_0x128910={},_0x2d7554={'count':0x0,'rows':[]};var _0x321e0d=_[_0x1b6b('0x25')](db['SquareRecording'][_0x1b6b('0x26')],function(_0x7f4da2){return{'name':_0x7f4da2[_0x1b6b('0x27')],'type':_0x7f4da2[_0x1b6b('0x28')][_0x1b6b('0x29')]};});_0x128910[_0x1b6b('0x2a')]=_[_0x1b6b('0x25')](_0x321e0d,_0x1b6b('0x22'));_0x128910[_0x1b6b('0x2b')]=_[_0x1b6b('0x2c')](_0x345b83['query']);_0x128910[_0x1b6b('0x2d')]=_[_0x1b6b('0x2e')](_0x128910[_0x1b6b('0x2a')],_0x128910[_0x1b6b('0x2b')]);_0x3c86c4['attributes']=_[_0x1b6b('0x2e')](_0x128910[_0x1b6b('0x2a')],qs[_0x1b6b('0x2f')](_0x345b83[_0x1b6b('0x2b')][_0x1b6b('0x2f')]));_0x3c86c4[_0x1b6b('0x30')]=_0x3c86c4[_0x1b6b('0x30')][_0x1b6b('0x31')]?_0x3c86c4[_0x1b6b('0x30')]:_0x128910[_0x1b6b('0x2a')];if(!_0x345b83['query']['hasOwnProperty'](_0x1b6b('0x32'))){_0x3c86c4[_0x1b6b('0x19')]=qs[_0x1b6b('0x19')](_0x345b83['query'][_0x1b6b('0x19')]);_0x3c86c4[_0x1b6b('0x18')]=qs[_0x1b6b('0x18')](_0x345b83[_0x1b6b('0x2b')][_0x1b6b('0x18')]);}_0x3c86c4[_0x1b6b('0x33')]=qs[_0x1b6b('0x34')](_0x345b83[_0x1b6b('0x2b')][_0x1b6b('0x34')]);_0x3c86c4[_0x1b6b('0x35')]=qs[_0x1b6b('0x2d')](_[_0x1b6b('0x36')](_0x345b83[_0x1b6b('0x2b')],_0x128910[_0x1b6b('0x2d')]),_0x321e0d);if(_0x345b83[_0x1b6b('0x2b')][_0x1b6b('0x37')]){_0x3c86c4[_0x1b6b('0x35')]=_[_0x1b6b('0x38')](_0x3c86c4[_0x1b6b('0x35')],{'$or':_['map'](_0x321e0d,function(_0x5eae9b){if(_0x5eae9b[_0x1b6b('0x28')]!==_0x1b6b('0x39')){var _0x59b5a5={};_0x59b5a5[_0x5eae9b[_0x1b6b('0x22')]]={'$like':'%'+_0x345b83[_0x1b6b('0x2b')][_0x1b6b('0x37')]+'%'};return _0x59b5a5;}})});}_0x3c86c4=_[_0x1b6b('0x38')]({},_0x3c86c4,_0x345b83[_0x1b6b('0x3a')]);var _0x2be9aa={'where':_0x3c86c4['where']};return db['SquareRecording'][_0x1b6b('0x3b')](_0x2be9aa)[_0x1b6b('0x1f')](function(_0xd7f225){_0x2d7554[_0x1b6b('0x3b')]=_0xd7f225;if(_0x345b83[_0x1b6b('0x2b')][_0x1b6b('0x3c')]){_0x3c86c4[_0x1b6b('0x3d')]=[{'all':!![]}];}return db[_0x1b6b('0x3e')][_0x1b6b('0x3f')](_0x3c86c4);})[_0x1b6b('0x1f')](function(_0x30e6ba){_0x2d7554[_0x1b6b('0x40')]=_0x30e6ba;return _0x2d7554;})[_0x1b6b('0x1f')](respondWithFilteredResult(_0x22e940,_0x3c86c4))[_0x1b6b('0x41')](handleError(_0x22e940,null));};exports['show']=function(_0x36ce6e,_0x263e58){var _0x2aa06d={'raw':!![],'where':{'id':_0x36ce6e['params']['id']}},_0x1b3376={};_0x1b3376['model']=_[_0x1b6b('0x2c')](db['SquareRecording'][_0x1b6b('0x26')]);_0x1b3376[_0x1b6b('0x2b')]=_[_0x1b6b('0x2c')](_0x36ce6e[_0x1b6b('0x2b')]);_0x1b3376[_0x1b6b('0x2d')]=_[_0x1b6b('0x2e')](_0x1b3376[_0x1b6b('0x2a')],_0x1b3376[_0x1b6b('0x2b')]);_0x2aa06d['attributes']=_[_0x1b6b('0x2e')](_0x1b3376[_0x1b6b('0x2a')],qs[_0x1b6b('0x2f')](_0x36ce6e['query'][_0x1b6b('0x2f')]));_0x2aa06d[_0x1b6b('0x30')]=_0x2aa06d['attributes'][_0x1b6b('0x31')]?_0x2aa06d[_0x1b6b('0x30')]:_0x1b3376[_0x1b6b('0x2a')];if(_0x36ce6e['query'][_0x1b6b('0x3c')]){_0x2aa06d[_0x1b6b('0x3d')]=[{'all':!![]}];}_0x2aa06d=_[_0x1b6b('0x38')]({},_0x2aa06d,_0x36ce6e[_0x1b6b('0x3a')]);return db[_0x1b6b('0x3e')]['find'](_0x2aa06d)[_0x1b6b('0x1f')](handleEntityNotFound(_0x263e58,null))[_0x1b6b('0x1f')](respondWithResult(_0x263e58,null))[_0x1b6b('0x41')](handleError(_0x263e58,null));};exports[_0x1b6b('0x42')]=function(_0x31b972,_0x70102e){return db[_0x1b6b('0x3e')]['create'](_0x31b972[_0x1b6b('0x43')],{})[_0x1b6b('0x1f')](respondWithResult(_0x70102e,0xc9))[_0x1b6b('0x41')](handleError(_0x70102e,null));};exports[_0x1b6b('0x1e')]=function(_0x560291,_0x568c78){if(_0x560291[_0x1b6b('0x43')]['id']){delete _0x560291[_0x1b6b('0x43')]['id'];}return db[_0x1b6b('0x3e')][_0x1b6b('0x44')]({'where':{'id':_0x560291[_0x1b6b('0x45')]['id']}})[_0x1b6b('0x1f')](handleEntityNotFound(_0x568c78,null))[_0x1b6b('0x1f')](saveUpdates(_0x560291[_0x1b6b('0x43')],null))['then'](respondWithResult(_0x568c78,null))['catch'](handleError(_0x568c78,null));};exports[_0x1b6b('0x46')]=function(_0x91d536,_0x17f8b9,_0x39b770){var _0x270bd7=require(_0x1b6b('0x47'));var _0x3f3368=![];var _0x145e17={};if(_0x91d536['query']['type']&&_0x91d536[_0x1b6b('0x2b')][_0x1b6b('0x28')]===_0x1b6b('0x48')){_0x145e17[_0x1b6b('0x48')]=_0x91d536[_0x1b6b('0x45')]['id'];}else{_0x145e17['id']=_0x91d536[_0x1b6b('0x45')]['id'];}return db[_0x1b6b('0x3e')]['find']({'where':_0x145e17,'attributes':['id',_0x1b6b('0x49'),_0x1b6b('0x4a')],'raw':!![]})[_0x1b6b('0x1f')](handleEntityNotFound(_0x17f8b9,null))[_0x1b6b('0x1f')](function(_0x194f15){if(_0x194f15){var _0x5059c2=_0x194f15[_0x1b6b('0x49')];var _0xa341e=util[_0x1b6b('0x4b')](_0x1b6b('0x4c'),_0x5059c2);if(fs['existsSync'](_0xa341e)){_0x3f3368=!![];return _0x270bd7['decryptFile'](_0xa341e,_0x5059c2,config[_0x1b6b('0x4d')][_0x1b6b('0x4e')])['then'](function(){return _0x194f15;});}return _0x194f15;}})['then'](function(_0x47e5b2){if(_0x47e5b2){var _0x49864a=_0x47e5b2[_0x1b6b('0x49')];if(!fs[_0x1b6b('0x4f')](_0x49864a)){throw new db['Sequelize'][(_0x1b6b('0x50'))]('SquareRecording\x20not\x20found');}if(_0x47e5b2[_0x1b6b('0x4a')]){return _0x17f8b9[_0x1b6b('0x46')](_0x49864a,_0x47e5b2[_0x1b6b('0x4a')]+path['extname'](_0x49864a),function(){if(_0x3f3368){fs['unlink'](_0x49864a);}});}else{return _0x17f8b9[_0x1b6b('0x46')](_0x49864a,function(_0x55c11f){if(_0x3f3368){fs[_0x1b6b('0x51')](_0x49864a);}});}}})[_0x1b6b('0x41')](function(_0x591a6b){if(_0x591a6b['message']===_0x1b6b('0x52')){_0x17f8b9[_0x1b6b('0x16')](0x194)['send']('Not\x20found');}else{return handleError(_0x17f8b9,null);}});};exports[_0x1b6b('0x53')]=function(_0x1af996,_0x1c65eb){return db[_0x1b6b('0x3e')][_0x1b6b('0x44')]({'where':{'id':_0x1af996[_0x1b6b('0x45')]['id']}})[_0x1b6b('0x1f')](function(_0x475289){if(_[_0x1b6b('0x54')](_0x475289)){throw new ReferenceError(_0x1b6b('0x55'));}return _0x475289;})[_0x1b6b('0x1f')](function(_0xf6b7ce){var _0x2fc83a=_0xf6b7ce[_0x1b6b('0x49')];logger[_0x1b6b('0x56')](_0x1b6b('0x57'),_0x2fc83a);if(!_['isNil'](_0xf6b7ce['savePath'])&&fs['existsSync'](_0x2fc83a)){logger[_0x1b6b('0x56')](_0x1b6b('0x58')+_0x2fc83a+_0x1b6b('0x59'));fs['unlinkSync'](_0x2fc83a);}_0x2fc83a=_0x2fc83a+_0x1b6b('0x5a');if(!_[_0x1b6b('0x54')](_0xf6b7ce['savePath'])&&fs[_0x1b6b('0x4f')](_0x2fc83a)){logger[_0x1b6b('0x56')](_0x1b6b('0x58')+_0x2fc83a+_0x1b6b('0x59'));fs['unlinkSync'](_0x2fc83a);}return _0xf6b7ce;})[_0x1b6b('0x1f')](function(_0x4d1d25){if(!_0x4d1d25)throw new InternalError();return _0x4d1d25[_0x1b6b('0x53')]();})['then'](function(){_0x1c65eb[_0x1b6b('0x16')](0xcc)[_0x1b6b('0x17')]();})[_0x1b6b('0x41')](handleError(_0x1c65eb,null));}; \ No newline at end of file diff --git a/server/api/squareRecording/squareRecording.model.js b/server/api/squareRecording/squareRecording.model.js index 940c529..c589ac2 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 _0x225b=['square_recordings','lodash','util','api','moment','request-promise','rimraf','./squareRecording.attributes','exports','define','SquareRecording'];(function(_0xf35ac9,_0x51b46b){var _0x101387=function(_0x4fac01){while(--_0x4fac01){_0xf35ac9['push'](_0xf35ac9['shift']());}};_0x101387(++_0x51b46b);}(_0x225b,0xb1));var _0xb225=function(_0x415aaf,_0x3aca31){_0x415aaf=_0x415aaf-0x0;var _0x4aadd2=_0x225b[_0x415aaf];return _0x4aadd2;};'use strict';var _=require(_0xb225('0x0'));var util=require(_0xb225('0x1'));var logger=require('../../config/logger')(_0xb225('0x2'));var moment=require(_0xb225('0x3'));var BPromise=require('bluebird');var rp=require(_0xb225('0x4'));var fs=require('fs');var path=require('path');var rimraf=require(_0xb225('0x5'));var config=require('../../config/environment');var attributes=require(_0xb225('0x6'));module[_0xb225('0x7')]=function(_0x3f2419,_0x4751e2){return _0x3f2419[_0xb225('0x8')](_0xb225('0x9'),attributes,{'tableName':_0xb225('0xa'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x49fe=['request-promise','path','rimraf','../../config/environment','./squareRecording.attributes','exports','define','SquareRecording','square_recordings','lodash','moment','bluebird'];(function(_0xc2abc4,_0x6d6cf8){var _0x29d6a6=function(_0x58c9e2){while(--_0x58c9e2){_0xc2abc4['push'](_0xc2abc4['shift']());}};_0x29d6a6(++_0x6d6cf8);}(_0x49fe,0x75));var _0xe49f=function(_0x4f3bed,_0x23414b){_0x4f3bed=_0x4f3bed-0x0;var _0x371a2a=_0x49fe[_0x4f3bed];return _0x371a2a;};'use strict';var _=require(_0xe49f('0x0'));var util=require('util');var logger=require('../../config/logger')('api');var moment=require(_0xe49f('0x1'));var BPromise=require(_0xe49f('0x2'));var rp=require(_0xe49f('0x3'));var fs=require('fs');var path=require(_0xe49f('0x4'));var rimraf=require(_0xe49f('0x5'));var config=require(_0xe49f('0x6'));var attributes=require(_0xe49f('0x7'));module[_0xe49f('0x8')]=function(_0x3e984c,_0x2f3f9f){return _0x3e984c[_0xe49f('0x9')](_0xe49f('0xa'),attributes,{'tableName':_0xe49f('0xb'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/squareRecording/squareRecording.rpc.js b/server/api/squareRecording/squareRecording.rpc.js index 9dbdc07..5c4a8e2 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 _0xe139=['jayson/promise','http','request','info','request\x20sent','debug','SquareRecording,\x20%s,\x20%s,\x20%s','stringify','error','message','SquareRecording,\x20%s,\x20%s','result','catch','CreateSquareRecording','create','options','raw','then','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment'];(function(_0x170b0b,_0x4aa600){var _0x33cd22=function(_0x35263c){while(--_0x35263c){_0x170b0b['push'](_0x170b0b['shift']());}};_0x33cd22(++_0x4aa600);}(_0xe139,0x1dd));var _0x9e13=function(_0xf3255a,_0x1b5a46){_0xf3255a=_0xf3255a-0x0;var _0x336dff=_0xe139[_0xf3255a];return _0x336dff;};'use strict';var _=require('lodash');var util=require('util');var moment=require(_0x9e13('0x0'));var BPromise=require(_0x9e13('0x1'));var rs=require(_0x9e13('0x2'));var fs=require('fs');var Redis=require(_0x9e13('0x3'));var db=require(_0x9e13('0x4'))['db'];var utils=require(_0x9e13('0x5'));var logger=require(_0x9e13('0x6'))(_0x9e13('0x7'));var config=require(_0x9e13('0x8'));var jayson=require(_0x9e13('0x9'));var client=jayson['client'][_0x9e13('0xa')]({'port':0x232a});function respondWithRpcPromise(_0x38f4a6,_0x163c54,_0x3d5fff){return new BPromise(function(_0x5ddc38,_0x4dfa5b){return client[_0x9e13('0xb')](_0x38f4a6,_0x3d5fff)['then'](function(_0x54f1f5){logger[_0x9e13('0xc')]('SquareRecording,\x20%s,\x20%s',_0x163c54,_0x9e13('0xd'));logger[_0x9e13('0xe')](_0x9e13('0xf'),_0x163c54,_0x9e13('0xd'),JSON[_0x9e13('0x10')](_0x54f1f5));if(_0x54f1f5[_0x9e13('0x11')]){if(_0x54f1f5[_0x9e13('0x11')]['code']===0x1f4){logger[_0x9e13('0x11')]('SquareRecording,\x20%s,\x20%s',_0x163c54,_0x54f1f5['error'][_0x9e13('0x12')]);return _0x4dfa5b(_0x54f1f5[_0x9e13('0x11')]['message']);}logger[_0x9e13('0x11')](_0x9e13('0x13'),_0x163c54,_0x54f1f5[_0x9e13('0x11')][_0x9e13('0x12')]);return _0x5ddc38(_0x54f1f5[_0x9e13('0x11')][_0x9e13('0x12')]);}else{logger[_0x9e13('0xc')](_0x9e13('0x13'),_0x163c54,_0x9e13('0xd'));_0x5ddc38(_0x54f1f5[_0x9e13('0x14')][_0x9e13('0x12')]);}})[_0x9e13('0x15')](function(_0x52504e){logger['error'](_0x9e13('0x13'),_0x163c54,_0x52504e);_0x4dfa5b(_0x52504e);});});}exports[_0x9e13('0x16')]=function(_0x16d1cd){var _0x3f7e96=this;return new Promise(function(_0x120cc8,_0xdb3870){return db['SquareRecording'][_0x9e13('0x17')](_0x16d1cd['body'],{'raw':_0x16d1cd[_0x9e13('0x18')]?_0x16d1cd[_0x9e13('0x18')][_0x9e13('0x19')]===undefined?!![]:![]:!![]})[_0x9e13('0x1a')](function(_0x4d8a2a){logger[_0x9e13('0xc')](_0x9e13('0x16'),_0x16d1cd);logger[_0x9e13('0xe')](_0x9e13('0x16'),_0x16d1cd,JSON[_0x9e13('0x10')](_0x4d8a2a));_0x120cc8(_0x4d8a2a);})['catch'](function(_0x416ae5){logger[_0x9e13('0x11')](_0x9e13('0x16'),_0x416ae5[_0x9e13('0x12')],_0x16d1cd);_0xdb3870(_0x3f7e96[_0x9e13('0x11')](0x1f4,_0x416ae5[_0x9e13('0x12')]));});});}; \ No newline at end of file +var _0x5b47=['result','catch','SquareRecording','create','body','options','raw','info','CreateSquareRecording','util','moment','bluebird','randomstring','ioredis','../../config/utils','rpc','../../config/environment','jayson/promise','client','http','request','then','SquareRecording,\x20%s,\x20%s','debug','SquareRecording,\x20%s,\x20%s,\x20%s','request\x20sent','stringify','error','message'];(function(_0x4cdf1d,_0x5f3b3b){var _0x1f2c19=function(_0x3d6ff7){while(--_0x3d6ff7){_0x4cdf1d['push'](_0x4cdf1d['shift']());}};_0x1f2c19(++_0x5f3b3b);}(_0x5b47,0x148));var _0x75b4=function(_0x4ffbb5,_0x49054a){_0x4ffbb5=_0x4ffbb5-0x0;var _0x377d9d=_0x5b47[_0x4ffbb5];return _0x377d9d;};'use strict';var _=require('lodash');var util=require(_0x75b4('0x0'));var moment=require(_0x75b4('0x1'));var BPromise=require(_0x75b4('0x2'));var rs=require(_0x75b4('0x3'));var fs=require('fs');var Redis=require(_0x75b4('0x4'));var db=require('../../mysqldb')['db'];var utils=require(_0x75b4('0x5'));var logger=require('../../config/logger')(_0x75b4('0x6'));var config=require(_0x75b4('0x7'));var jayson=require(_0x75b4('0x8'));var client=jayson[_0x75b4('0x9')][_0x75b4('0xa')]({'port':0x232a});function respondWithRpcPromise(_0x33b5b8,_0x31a852,_0x355e1b){return new BPromise(function(_0x2e3afe,_0x1e91e5){return client[_0x75b4('0xb')](_0x33b5b8,_0x355e1b)[_0x75b4('0xc')](function(_0x5ef91b){logger['info'](_0x75b4('0xd'),_0x31a852,'request\x20sent');logger[_0x75b4('0xe')](_0x75b4('0xf'),_0x31a852,_0x75b4('0x10'),JSON[_0x75b4('0x11')](_0x5ef91b));if(_0x5ef91b[_0x75b4('0x12')]){if(_0x5ef91b[_0x75b4('0x12')]['code']===0x1f4){logger[_0x75b4('0x12')](_0x75b4('0xd'),_0x31a852,_0x5ef91b['error'][_0x75b4('0x13')]);return _0x1e91e5(_0x5ef91b[_0x75b4('0x12')][_0x75b4('0x13')]);}logger['error']('SquareRecording,\x20%s,\x20%s',_0x31a852,_0x5ef91b['error']['message']);return _0x2e3afe(_0x5ef91b['error'][_0x75b4('0x13')]);}else{logger['info'](_0x75b4('0xd'),_0x31a852,_0x75b4('0x10'));_0x2e3afe(_0x5ef91b[_0x75b4('0x14')][_0x75b4('0x13')]);}})[_0x75b4('0x15')](function(_0x1e8a39){logger[_0x75b4('0x12')](_0x75b4('0xd'),_0x31a852,_0x1e8a39);_0x1e91e5(_0x1e8a39);});});}exports['CreateSquareRecording']=function(_0x162f81){var _0x31eb6f=this;return new Promise(function(_0x13c036,_0xcdc72c){return db[_0x75b4('0x16')][_0x75b4('0x17')](_0x162f81[_0x75b4('0x18')],{'raw':_0x162f81['options']?_0x162f81[_0x75b4('0x19')][_0x75b4('0x1a')]===undefined?!![]:![]:!![]})[_0x75b4('0xc')](function(_0x379b42){logger[_0x75b4('0x1b')]('CreateSquareRecording',_0x162f81);logger[_0x75b4('0xe')](_0x75b4('0x1c'),_0x162f81,JSON['stringify'](_0x379b42));_0x13c036(_0x379b42);})[_0x75b4('0x15')](function(_0xc61a03){logger[_0x75b4('0x12')](_0x75b4('0x1c'),_0xc61a03['message'],_0x162f81);_0xcdc72c(_0x31eb6f[_0x75b4('0x12')](0x1f4,_0xc61a03[_0x75b4('0x13')]));});});}; \ No newline at end of file diff --git a/server/api/squareReport/index.js b/server/api/squareReport/index.js index f8b4636..95a5bb7 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(_0x4c05da,_0x414720){var _0x1614db=function(_0xa19cf6){while(--_0xa19cf6){_0x4c05da['push'](_0x4c05da['shift']());}};_0x1614db(++_0x414720);}(_0xa9e0,0x123));var _0x0a9e=function(_0xf0bcac,_0x531755){_0xf0bcac=_0xf0bcac-0x0;var _0x4e4c65=_0xa9e0[_0xf0bcac];return _0x4e4c65;};'use strict';var multer=require(_0x0a9e('0x0'));var util=require(_0x0a9e('0x1'));var path=require(_0x0a9e('0x2'));var timeout=require('connect-timeout');var express=require('express');var router=express[_0x0a9e('0x3')]();var fs_extra=require('fs-extra');var auth=require(_0x0a9e('0x4'));var interaction=require(_0x0a9e('0x5'));var config=require(_0x0a9e('0x6'));var controller=require(_0x0a9e('0x7'));router[_0x0a9e('0x8')]('/',auth['isAuthenticated'](),controller[_0x0a9e('0x9')]);router[_0x0a9e('0x8')](_0x0a9e('0xa'),auth['isAuthenticated'](),controller['describe']);router[_0x0a9e('0x8')]('/:id',auth['isAuthenticated'](),controller[_0x0a9e('0xb')]);router[_0x0a9e('0xc')]('/',auth[_0x0a9e('0xd')](),controller[_0x0a9e('0xe')]);router[_0x0a9e('0xf')](_0x0a9e('0x10'),auth['isAuthenticated'](),controller['update']);router['delete']('/:id',auth[_0x0a9e('0xd')](),controller[_0x0a9e('0x11')]);module[_0x0a9e('0x12')]=router; \ No newline at end of file +var _0xd8b0=['destroy','exports','multer','util','Router','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','isAuthenticated','index','get','describe','/:id','show','post','create','put','update'];(function(_0x2c0dc0,_0x19900d){var _0x4c0990=function(_0x530791){while(--_0x530791){_0x2c0dc0['push'](_0x2c0dc0['shift']());}};_0x4c0990(++_0x19900d);}(_0xd8b0,0xad));var _0x0d8b=function(_0xa464c9,_0x7c86d8){_0xa464c9=_0xa464c9-0x0;var _0x3d73c4=_0xd8b0[_0xa464c9];return _0x3d73c4;};'use strict';var multer=require(_0x0d8b('0x0'));var util=require(_0x0d8b('0x1'));var path=require('path');var timeout=require('connect-timeout');var express=require('express');var router=express[_0x0d8b('0x2')]();var fs_extra=require(_0x0d8b('0x3'));var auth=require(_0x0d8b('0x4'));var interaction=require(_0x0d8b('0x5'));var config=require(_0x0d8b('0x6'));var controller=require('./squareReport.controller');router['get']('/',auth[_0x0d8b('0x7')](),controller[_0x0d8b('0x8')]);router[_0x0d8b('0x9')]('/describe',auth[_0x0d8b('0x7')](),controller[_0x0d8b('0xa')]);router['get'](_0x0d8b('0xb'),auth[_0x0d8b('0x7')](),controller[_0x0d8b('0xc')]);router[_0x0d8b('0xd')]('/',auth[_0x0d8b('0x7')](),controller[_0x0d8b('0xe')]);router[_0x0d8b('0xf')](_0x0d8b('0xb'),auth['isAuthenticated'](),controller[_0x0d8b('0x10')]);router['delete'](_0x0d8b('0xb'),auth[_0x0d8b('0x7')](),controller[_0x0d8b('0x11')]);module[_0x0d8b('0x12')]=router; \ No newline at end of file diff --git a/server/api/squareReport/squareReport.attributes.js b/server/api/squareReport/squareReport.attributes.js index 7ab475a..ef2a1a3 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 _0x06ef=['DATE','BOOLEAN','STRING'];(function(_0x13b93d,_0x424dcf){var _0x3aef3c=function(_0x5b1cf9){while(--_0x5b1cf9){_0x13b93d['push'](_0x13b93d['shift']());}};_0x3aef3c(++_0x424dcf);}(_0x06ef,0x185));var _0xf06e=function(_0x48d0c9,_0x5b26ac){_0x48d0c9=_0x48d0c9-0x0;var _0xcfaa34=_0x06ef[_0x48d0c9];return _0xcfaa34;};'use strict';var Sequelize=require('sequelize');module['exports']={'network':{'type':Sequelize[_0xf06e('0x0')]},'network_script':{'type':Sequelize['STRING']},'request':{'type':Sequelize['STRING']},'channel':{'type':Sequelize['STRING']},'language':{'type':Sequelize['STRING']},'type':{'type':Sequelize[_0xf06e('0x0')]},'uniqueid':{'type':Sequelize[_0xf06e('0x0')]},'version':{'type':Sequelize[_0xf06e('0x0')]},'callerid':{'type':Sequelize['STRING']},'calleridname':{'type':Sequelize[_0xf06e('0x0')]},'callingpres':{'type':Sequelize[_0xf06e('0x0')]},'callingani2':{'type':Sequelize['STRING']},'callington':{'type':Sequelize['STRING']},'callingtns':{'type':Sequelize['STRING']},'dnid':{'type':Sequelize['STRING']},'rdnis':{'type':Sequelize['STRING']},'context':{'type':Sequelize[_0xf06e('0x0')]},'extension':{'type':Sequelize[_0xf06e('0x0')]},'priority':{'type':Sequelize[_0xf06e('0x0')]},'enhanced':{'type':Sequelize[_0xf06e('0x0')]},'accountcode':{'type':Sequelize[_0xf06e('0x0')]},'threadid':{'type':Sequelize['STRING']},'project_name':{'type':Sequelize[_0xf06e('0x0')]},'joinAt':{'type':Sequelize[_0xf06e('0x1')]},'leaveAt':{'type':Sequelize['DATE']},'bot':{'type':Sequelize[_0xf06e('0x2')],'defaultValue':![]}}; \ No newline at end of file +var _0xee24=['STRING','DATE','BOOLEAN','sequelize','exports'];(function(_0x27d395,_0x3b7806){var _0x2671d0=function(_0x409f99){while(--_0x409f99){_0x27d395['push'](_0x27d395['shift']());}};_0x2671d0(++_0x3b7806);}(_0xee24,0x80));var _0x4ee2=function(_0x4a359c,_0x2cd974){_0x4a359c=_0x4a359c-0x0;var _0x36b77f=_0xee24[_0x4a359c];return _0x36b77f;};'use strict';var Sequelize=require(_0x4ee2('0x0'));module[_0x4ee2('0x1')]={'network':{'type':Sequelize[_0x4ee2('0x2')]},'network_script':{'type':Sequelize[_0x4ee2('0x2')]},'request':{'type':Sequelize[_0x4ee2('0x2')]},'channel':{'type':Sequelize[_0x4ee2('0x2')]},'language':{'type':Sequelize[_0x4ee2('0x2')]},'type':{'type':Sequelize[_0x4ee2('0x2')]},'uniqueid':{'type':Sequelize[_0x4ee2('0x2')]},'version':{'type':Sequelize[_0x4ee2('0x2')]},'callerid':{'type':Sequelize[_0x4ee2('0x2')]},'calleridname':{'type':Sequelize['STRING']},'callingpres':{'type':Sequelize['STRING']},'callingani2':{'type':Sequelize[_0x4ee2('0x2')]},'callington':{'type':Sequelize[_0x4ee2('0x2')]},'callingtns':{'type':Sequelize[_0x4ee2('0x2')]},'dnid':{'type':Sequelize[_0x4ee2('0x2')]},'rdnis':{'type':Sequelize['STRING']},'context':{'type':Sequelize[_0x4ee2('0x2')]},'extension':{'type':Sequelize[_0x4ee2('0x2')]},'priority':{'type':Sequelize[_0x4ee2('0x2')]},'enhanced':{'type':Sequelize['STRING']},'accountcode':{'type':Sequelize[_0x4ee2('0x2')]},'threadid':{'type':Sequelize['STRING']},'project_name':{'type':Sequelize[_0x4ee2('0x2')]},'joinAt':{'type':Sequelize['DATE']},'leaveAt':{'type':Sequelize[_0x4ee2('0x3')]},'bot':{'type':Sequelize[_0x4ee2('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 c6fb733..46f2541 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 _0x07da=['reject','save','update','then','destroy','stack','name','send','index','map','SquareReport','rawAttributes','fieldName','type','model','query','keys','filters','intersection','attributes','fields','length','nolimit','sort','where','filter','merge','options','includeAll','findAll','rows','show','params','include','catch','create','body','find','describe','eml-format','rimraf','fast-json-patch','request-promise','moment','bluebird','util','path','to-csv','ejs','fs-extra','lodash','crypto','jsforce','desk.js','../../components/auth/service','../../components/parsers/qs','../../config/license/hardware','../../config/logger','../../config/environment','../../config/license/util','../../mysqldb','sendStatus','status','end','offset','undefined','limit','count','set','Content-Range','json','apply'];(function(_0x5b3e57,_0x56ceeb){var _0x8f1d7a=function(_0x439eb2){while(--_0x439eb2){_0x5b3e57['push'](_0x5b3e57['shift']());}};_0x8f1d7a(++_0x56ceeb);}(_0x07da,0xb7));var _0xa07d=function(_0x1773ad,_0x3d3996){_0x1773ad=_0x1773ad-0x0;var _0x2e4e06=_0x07da[_0x1773ad];return _0x2e4e06;};'use strict';var emlformat=require(_0xa07d('0x0'));var rimraf=require(_0xa07d('0x1'));var zipdir=require('zip-dir');var jsonpatch=require(_0xa07d('0x2'));var rp=require(_0xa07d('0x3'));var moment=require(_0xa07d('0x4'));var BPromise=require(_0xa07d('0x5'));var Mustache=require('mustache');var util=require(_0xa07d('0x6'));var path=require(_0xa07d('0x7'));var sox=require('sox');var csv=require(_0xa07d('0x8'));var ejs=require(_0xa07d('0x9'));var fs=require('fs');var fs_extra=require(_0xa07d('0xa'));var _=require(_0xa07d('0xb'));var squel=require('squel');var crypto=require(_0xa07d('0xc'));var jsforce=require(_0xa07d('0xd'));var deskjs=require(_0xa07d('0xe'));var toCsv=require(_0xa07d('0x8'));var querystring=require('querystring');var Papa=require('papaparse');var Redis=require('ioredis');var authService=require(_0xa07d('0xf'));var qs=require(_0xa07d('0x10'));var as=require('../../components/parsers/advancedSearch');var hardwareService=require(_0xa07d('0x11'));var logger=require(_0xa07d('0x12'))('api');var utils=require('../../config/utils');var config=require(_0xa07d('0x13'));var licenseUtil=require(_0xa07d('0x14'));var db=require(_0xa07d('0x15'))['db'];function respondWithStatusCode(_0x30bf45,_0x23e0f1){_0x23e0f1=_0x23e0f1||0xcc;return function(_0x1ec16c){if(_0x1ec16c){return _0x30bf45[_0xa07d('0x16')](_0x23e0f1);}return _0x30bf45[_0xa07d('0x17')](_0x23e0f1)[_0xa07d('0x18')]();};}function respondWithResult(_0x2b3cf1,_0x217427){_0x217427=_0x217427||0xc8;return function(_0x383907){if(_0x383907){return _0x2b3cf1['status'](_0x217427)['json'](_0x383907);}};}function respondWithFilteredResult(_0x241926,_0xa7028c){return function(_0x3e1951){if(_0x3e1951){var _0x3f9fe7=typeof _0xa7028c[_0xa07d('0x19')]===_0xa07d('0x1a')&&typeof _0xa7028c[_0xa07d('0x1b')]===_0xa07d('0x1a');var _0xbc1a0c=_0x3e1951[_0xa07d('0x1c')];var _0x586771=_0x3f9fe7?0x0:_0xa7028c[_0xa07d('0x19')];var _0x2ff9d2=_0x3f9fe7?_0x3e1951[_0xa07d('0x1c')]:_0xa7028c[_0xa07d('0x19')]+_0xa7028c[_0xa07d('0x1b')];var _0x5e7570;if(_0x2ff9d2>=_0xbc1a0c){_0x2ff9d2=_0xbc1a0c;_0x5e7570=0xc8;}else{_0x5e7570=0xce;}_0x241926[_0xa07d('0x17')](_0x5e7570);return _0x241926[_0xa07d('0x1d')](_0xa07d('0x1e'),_0x586771+'-'+_0x2ff9d2+'/'+_0xbc1a0c)[_0xa07d('0x1f')](_0x3e1951);}return null;};}function patchUpdates(_0x5fc50b){return function(_0x23a2ce){try{jsonpatch[_0xa07d('0x20')](_0x23a2ce,_0x5fc50b,!![]);}catch(_0x5a3f41){return BPromise[_0xa07d('0x21')](_0x5a3f41);}return _0x23a2ce[_0xa07d('0x22')]();};}function saveUpdates(_0x27f353,_0xd361d4){return function(_0x95b56f){if(_0x95b56f){return _0x95b56f[_0xa07d('0x23')](_0x27f353)[_0xa07d('0x24')](function(_0x40484c){return _0x40484c;});}return null;};}function removeEntity(_0x1d14fc,_0x4478e4){return function(_0x376b05){if(_0x376b05){return _0x376b05[_0xa07d('0x25')]()[_0xa07d('0x24')](function(){_0x1d14fc['status'](0xcc)[_0xa07d('0x18')]();});}};}function handleEntityNotFound(_0x5c4f80,_0x3f2c85){return function(_0x284b74){if(!_0x284b74){_0x5c4f80[_0xa07d('0x16')](0x194);}return _0x284b74;};}function handleError(_0x2df1d5,_0x35d143){_0x35d143=_0x35d143||0x1f4;return function(_0x4a134f){logger['error'](_0x4a134f[_0xa07d('0x26')]);if(_0x4a134f[_0xa07d('0x27')]){delete _0x4a134f['name'];}_0x2df1d5[_0xa07d('0x17')](_0x35d143)[_0xa07d('0x28')](_0x4a134f);};}exports[_0xa07d('0x29')]=function(_0x5f3e6f,_0x5848ef){var _0x4fc860={},_0x4e050c={},_0x3a2807={'count':0x0,'rows':[]};var _0x8cb8f9=_[_0xa07d('0x2a')](db[_0xa07d('0x2b')][_0xa07d('0x2c')],function(_0x4a9c2f){return{'name':_0x4a9c2f[_0xa07d('0x2d')],'type':_0x4a9c2f[_0xa07d('0x2e')]['key']};});_0x4e050c[_0xa07d('0x2f')]=_[_0xa07d('0x2a')](_0x8cb8f9,'name');_0x4e050c[_0xa07d('0x30')]=_[_0xa07d('0x31')](_0x5f3e6f['query']);_0x4e050c[_0xa07d('0x32')]=_[_0xa07d('0x33')](_0x4e050c['model'],_0x4e050c[_0xa07d('0x30')]);_0x4fc860[_0xa07d('0x34')]=_[_0xa07d('0x33')](_0x4e050c[_0xa07d('0x2f')],qs['fields'](_0x5f3e6f['query'][_0xa07d('0x35')]));_0x4fc860[_0xa07d('0x34')]=_0x4fc860[_0xa07d('0x34')][_0xa07d('0x36')]?_0x4fc860['attributes']:_0x4e050c['model'];if(!_0x5f3e6f['query']['hasOwnProperty'](_0xa07d('0x37'))){_0x4fc860[_0xa07d('0x1b')]=qs[_0xa07d('0x1b')](_0x5f3e6f[_0xa07d('0x30')][_0xa07d('0x1b')]);_0x4fc860[_0xa07d('0x19')]=qs[_0xa07d('0x19')](_0x5f3e6f[_0xa07d('0x30')]['offset']);}_0x4fc860['order']=qs['sort'](_0x5f3e6f['query'][_0xa07d('0x38')]);_0x4fc860[_0xa07d('0x39')]=qs[_0xa07d('0x32')](_['pick'](_0x5f3e6f['query'],_0x4e050c[_0xa07d('0x32')]),_0x8cb8f9);if(_0x5f3e6f[_0xa07d('0x30')][_0xa07d('0x3a')]){_0x4fc860['where']=_[_0xa07d('0x3b')](_0x4fc860[_0xa07d('0x39')],{'$or':_[_0xa07d('0x2a')](_0x8cb8f9,function(_0x51000b){if(_0x51000b[_0xa07d('0x2e')]!=='VIRTUAL'){var _0xa1c307={};_0xa1c307[_0x51000b[_0xa07d('0x27')]]={'$like':'%'+_0x5f3e6f[_0xa07d('0x30')]['filter']+'%'};return _0xa1c307;}})});}_0x4fc860=_[_0xa07d('0x3b')]({},_0x4fc860,_0x5f3e6f[_0xa07d('0x3c')]);var _0x4d0e4a={'where':_0x4fc860[_0xa07d('0x39')]};return db[_0xa07d('0x2b')][_0xa07d('0x1c')](_0x4d0e4a)['then'](function(_0x290546){_0x3a2807[_0xa07d('0x1c')]=_0x290546;if(_0x5f3e6f['query'][_0xa07d('0x3d')]){_0x4fc860['include']=[{'all':!![]}];}return db[_0xa07d('0x2b')][_0xa07d('0x3e')](_0x4fc860);})[_0xa07d('0x24')](function(_0xb8d127){_0x3a2807[_0xa07d('0x3f')]=_0xb8d127;return _0x3a2807;})['then'](respondWithFilteredResult(_0x5848ef,_0x4fc860))['catch'](handleError(_0x5848ef,null));};exports[_0xa07d('0x40')]=function(_0x20adf0,_0x2cee18){var _0x500d0b={'raw':!![],'where':{'id':_0x20adf0[_0xa07d('0x41')]['id']}},_0x2a7cf6={};_0x2a7cf6['model']=_[_0xa07d('0x31')](db[_0xa07d('0x2b')]['rawAttributes']);_0x2a7cf6[_0xa07d('0x30')]=_['keys'](_0x20adf0[_0xa07d('0x30')]);_0x2a7cf6[_0xa07d('0x32')]=_[_0xa07d('0x33')](_0x2a7cf6[_0xa07d('0x2f')],_0x2a7cf6[_0xa07d('0x30')]);_0x500d0b[_0xa07d('0x34')]=_['intersection'](_0x2a7cf6[_0xa07d('0x2f')],qs[_0xa07d('0x35')](_0x20adf0[_0xa07d('0x30')][_0xa07d('0x35')]));_0x500d0b['attributes']=_0x500d0b[_0xa07d('0x34')][_0xa07d('0x36')]?_0x500d0b[_0xa07d('0x34')]:_0x2a7cf6[_0xa07d('0x2f')];if(_0x20adf0[_0xa07d('0x30')][_0xa07d('0x3d')]){_0x500d0b[_0xa07d('0x42')]=[{'all':!![]}];}_0x500d0b=_['merge']({},_0x500d0b,_0x20adf0[_0xa07d('0x3c')]);return db[_0xa07d('0x2b')]['find'](_0x500d0b)['then'](handleEntityNotFound(_0x2cee18,null))['then'](respondWithResult(_0x2cee18,null))[_0xa07d('0x43')](handleError(_0x2cee18,null));};exports[_0xa07d('0x44')]=function(_0x2ddfad,_0x349f4b){return db['SquareReport'][_0xa07d('0x44')](_0x2ddfad['body'],{})[_0xa07d('0x24')](respondWithResult(_0x349f4b,0xc9))[_0xa07d('0x43')](handleError(_0x349f4b,null));};exports[_0xa07d('0x23')]=function(_0x3f6220,_0x4211d6){if(_0x3f6220[_0xa07d('0x45')]['id']){delete _0x3f6220[_0xa07d('0x45')]['id'];}return db[_0xa07d('0x2b')][_0xa07d('0x46')]({'where':{'id':_0x3f6220[_0xa07d('0x41')]['id']}})['then'](handleEntityNotFound(_0x4211d6,null))[_0xa07d('0x24')](saveUpdates(_0x3f6220[_0xa07d('0x45')],null))['then'](respondWithResult(_0x4211d6,null))['catch'](handleError(_0x4211d6,null));};exports[_0xa07d('0x25')]=function(_0x24e2f2,_0x42fe10){return db[_0xa07d('0x2b')][_0xa07d('0x46')]({'where':{'id':_0x24e2f2[_0xa07d('0x41')]['id']}})[_0xa07d('0x24')](handleEntityNotFound(_0x42fe10,null))[_0xa07d('0x24')](removeEntity(_0x42fe10,null))[_0xa07d('0x43')](handleError(_0x42fe10,null));};exports['describe']=function(_0x5e2d3e,_0x595c4c){return db[_0xa07d('0x2b')][_0xa07d('0x47')]()[_0xa07d('0x24')](respondWithResult(_0x595c4c,null))['catch'](handleError(_0x595c4c,null));}; \ No newline at end of file +var _0xac0a=['Content-Range','json','reject','save','update','then','destroy','error','stack','name','send','index','map','SquareReport','fieldName','type','key','query','keys','intersection','model','attributes','fields','length','nolimit','order','sort','where','filters','pick','filter','merge','options','includeAll','rows','show','rawAttributes','include','catch','create','body','find','params','describe','rimraf','zip-dir','request-promise','mustache','util','sox','to-csv','fs-extra','lodash','crypto','jsforce','desk.js','querystring','papaparse','ioredis','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/environment','../../mysqldb','sendStatus','status','undefined','count','offset','limit','set'];(function(_0x57c22b,_0x54a1fa){var _0x5c982e=function(_0x52dab3){while(--_0x52dab3){_0x57c22b['push'](_0x57c22b['shift']());}};_0x5c982e(++_0x54a1fa);}(_0xac0a,0x154));var _0xaac0=function(_0x1a5908,_0x25d97a){_0x1a5908=_0x1a5908-0x0;var _0x531690=_0xac0a[_0x1a5908];return _0x531690;};'use strict';var emlformat=require('eml-format');var rimraf=require(_0xaac0('0x0'));var zipdir=require(_0xaac0('0x1'));var jsonpatch=require('fast-json-patch');var rp=require(_0xaac0('0x2'));var moment=require('moment');var BPromise=require('bluebird');var Mustache=require(_0xaac0('0x3'));var util=require(_0xaac0('0x4'));var path=require('path');var sox=require(_0xaac0('0x5'));var csv=require(_0xaac0('0x6'));var ejs=require('ejs');var fs=require('fs');var fs_extra=require(_0xaac0('0x7'));var _=require(_0xaac0('0x8'));var squel=require('squel');var crypto=require(_0xaac0('0x9'));var jsforce=require(_0xaac0('0xa'));var deskjs=require(_0xaac0('0xb'));var toCsv=require('to-csv');var querystring=require(_0xaac0('0xc'));var Papa=require(_0xaac0('0xd'));var Redis=require(_0xaac0('0xe'));var authService=require('../../components/auth/service');var qs=require(_0xaac0('0xf'));var as=require(_0xaac0('0x10'));var hardwareService=require(_0xaac0('0x11'));var logger=require(_0xaac0('0x12'))(_0xaac0('0x13'));var utils=require(_0xaac0('0x14'));var config=require(_0xaac0('0x15'));var licenseUtil=require('../../config/license/util');var db=require(_0xaac0('0x16'))['db'];function respondWithStatusCode(_0x5d4eb1,_0x5e06bd){_0x5e06bd=_0x5e06bd||0xcc;return function(_0x5c4770){if(_0x5c4770){return _0x5d4eb1[_0xaac0('0x17')](_0x5e06bd);}return _0x5d4eb1[_0xaac0('0x18')](_0x5e06bd)['end']();};}function respondWithResult(_0x301f84,_0x3ffff0){_0x3ffff0=_0x3ffff0||0xc8;return function(_0x51aaab){if(_0x51aaab){return _0x301f84[_0xaac0('0x18')](_0x3ffff0)['json'](_0x51aaab);}};}function respondWithFilteredResult(_0x40cb1a,_0x1c59c7){return function(_0x4df65a){if(_0x4df65a){var _0x11939c=typeof _0x1c59c7['offset']===_0xaac0('0x19')&&typeof _0x1c59c7['limit']===_0xaac0('0x19');var _0x562a58=_0x4df65a[_0xaac0('0x1a')];var _0x446d92=_0x11939c?0x0:_0x1c59c7[_0xaac0('0x1b')];var _0x353d84=_0x11939c?_0x4df65a[_0xaac0('0x1a')]:_0x1c59c7[_0xaac0('0x1b')]+_0x1c59c7[_0xaac0('0x1c')];var _0x1977bf;if(_0x353d84>=_0x562a58){_0x353d84=_0x562a58;_0x1977bf=0xc8;}else{_0x1977bf=0xce;}_0x40cb1a['status'](_0x1977bf);return _0x40cb1a[_0xaac0('0x1d')](_0xaac0('0x1e'),_0x446d92+'-'+_0x353d84+'/'+_0x562a58)[_0xaac0('0x1f')](_0x4df65a);}return null;};}function patchUpdates(_0x113cc3){return function(_0x59ce90){try{jsonpatch['apply'](_0x59ce90,_0x113cc3,!![]);}catch(_0x3ef68c){return BPromise[_0xaac0('0x20')](_0x3ef68c);}return _0x59ce90[_0xaac0('0x21')]();};}function saveUpdates(_0x50dd5b,_0x2f5acb){return function(_0x2cdbdb){if(_0x2cdbdb){return _0x2cdbdb[_0xaac0('0x22')](_0x50dd5b)[_0xaac0('0x23')](function(_0x4f0136){return _0x4f0136;});}return null;};}function removeEntity(_0x5116a8,_0x137b00){return function(_0x42076c){if(_0x42076c){return _0x42076c[_0xaac0('0x24')]()['then'](function(){_0x5116a8[_0xaac0('0x18')](0xcc)['end']();});}};}function handleEntityNotFound(_0x4bfeda,_0x50abc0){return function(_0x31d8a5){if(!_0x31d8a5){_0x4bfeda[_0xaac0('0x17')](0x194);}return _0x31d8a5;};}function handleError(_0x4e42ab,_0x33d483){_0x33d483=_0x33d483||0x1f4;return function(_0x514000){logger[_0xaac0('0x25')](_0x514000[_0xaac0('0x26')]);if(_0x514000[_0xaac0('0x27')]){delete _0x514000[_0xaac0('0x27')];}_0x4e42ab['status'](_0x33d483)[_0xaac0('0x28')](_0x514000);};}exports[_0xaac0('0x29')]=function(_0x5ca1a5,_0x512d26){var _0x396063={},_0x3fb8a2={},_0x26796c={'count':0x0,'rows':[]};var _0x424e21=_[_0xaac0('0x2a')](db[_0xaac0('0x2b')]['rawAttributes'],function(_0x1e1109){return{'name':_0x1e1109[_0xaac0('0x2c')],'type':_0x1e1109[_0xaac0('0x2d')][_0xaac0('0x2e')]};});_0x3fb8a2['model']=_['map'](_0x424e21,'name');_0x3fb8a2[_0xaac0('0x2f')]=_[_0xaac0('0x30')](_0x5ca1a5[_0xaac0('0x2f')]);_0x3fb8a2['filters']=_[_0xaac0('0x31')](_0x3fb8a2[_0xaac0('0x32')],_0x3fb8a2[_0xaac0('0x2f')]);_0x396063[_0xaac0('0x33')]=_[_0xaac0('0x31')](_0x3fb8a2[_0xaac0('0x32')],qs[_0xaac0('0x34')](_0x5ca1a5[_0xaac0('0x2f')][_0xaac0('0x34')]));_0x396063['attributes']=_0x396063[_0xaac0('0x33')][_0xaac0('0x35')]?_0x396063['attributes']:_0x3fb8a2[_0xaac0('0x32')];if(!_0x5ca1a5[_0xaac0('0x2f')]['hasOwnProperty'](_0xaac0('0x36'))){_0x396063['limit']=qs[_0xaac0('0x1c')](_0x5ca1a5[_0xaac0('0x2f')][_0xaac0('0x1c')]);_0x396063[_0xaac0('0x1b')]=qs[_0xaac0('0x1b')](_0x5ca1a5[_0xaac0('0x2f')]['offset']);}_0x396063[_0xaac0('0x37')]=qs[_0xaac0('0x38')](_0x5ca1a5[_0xaac0('0x2f')][_0xaac0('0x38')]);_0x396063[_0xaac0('0x39')]=qs[_0xaac0('0x3a')](_[_0xaac0('0x3b')](_0x5ca1a5[_0xaac0('0x2f')],_0x3fb8a2['filters']),_0x424e21);if(_0x5ca1a5[_0xaac0('0x2f')][_0xaac0('0x3c')]){_0x396063[_0xaac0('0x39')]=_[_0xaac0('0x3d')](_0x396063[_0xaac0('0x39')],{'$or':_['map'](_0x424e21,function(_0x4d45ac){if(_0x4d45ac['type']!=='VIRTUAL'){var _0x5f5bf9={};_0x5f5bf9[_0x4d45ac[_0xaac0('0x27')]]={'$like':'%'+_0x5ca1a5[_0xaac0('0x2f')]['filter']+'%'};return _0x5f5bf9;}})});}_0x396063=_[_0xaac0('0x3d')]({},_0x396063,_0x5ca1a5[_0xaac0('0x3e')]);var _0x19d26a={'where':_0x396063[_0xaac0('0x39')]};return db[_0xaac0('0x2b')][_0xaac0('0x1a')](_0x19d26a)[_0xaac0('0x23')](function(_0x8d5d8){_0x26796c[_0xaac0('0x1a')]=_0x8d5d8;if(_0x5ca1a5[_0xaac0('0x2f')][_0xaac0('0x3f')]){_0x396063['include']=[{'all':!![]}];}return db[_0xaac0('0x2b')]['findAll'](_0x396063);})[_0xaac0('0x23')](function(_0x43c533){_0x26796c[_0xaac0('0x40')]=_0x43c533;return _0x26796c;})[_0xaac0('0x23')](respondWithFilteredResult(_0x512d26,_0x396063))['catch'](handleError(_0x512d26,null));};exports[_0xaac0('0x41')]=function(_0x209c44,_0x14eeff){var _0x13f26b={'raw':!![],'where':{'id':_0x209c44['params']['id']}},_0x53bdc9={};_0x53bdc9[_0xaac0('0x32')]=_[_0xaac0('0x30')](db[_0xaac0('0x2b')][_0xaac0('0x42')]);_0x53bdc9[_0xaac0('0x2f')]=_[_0xaac0('0x30')](_0x209c44[_0xaac0('0x2f')]);_0x53bdc9[_0xaac0('0x3a')]=_[_0xaac0('0x31')](_0x53bdc9[_0xaac0('0x32')],_0x53bdc9[_0xaac0('0x2f')]);_0x13f26b[_0xaac0('0x33')]=_[_0xaac0('0x31')](_0x53bdc9[_0xaac0('0x32')],qs['fields'](_0x209c44[_0xaac0('0x2f')][_0xaac0('0x34')]));_0x13f26b['attributes']=_0x13f26b[_0xaac0('0x33')]['length']?_0x13f26b['attributes']:_0x53bdc9[_0xaac0('0x32')];if(_0x209c44[_0xaac0('0x2f')][_0xaac0('0x3f')]){_0x13f26b[_0xaac0('0x43')]=[{'all':!![]}];}_0x13f26b=_[_0xaac0('0x3d')]({},_0x13f26b,_0x209c44[_0xaac0('0x3e')]);return db[_0xaac0('0x2b')]['find'](_0x13f26b)['then'](handleEntityNotFound(_0x14eeff,null))[_0xaac0('0x23')](respondWithResult(_0x14eeff,null))[_0xaac0('0x44')](handleError(_0x14eeff,null));};exports[_0xaac0('0x45')]=function(_0x17818f,_0x45844e){return db['SquareReport'][_0xaac0('0x45')](_0x17818f[_0xaac0('0x46')],{})[_0xaac0('0x23')](respondWithResult(_0x45844e,0xc9))[_0xaac0('0x44')](handleError(_0x45844e,null));};exports[_0xaac0('0x22')]=function(_0x1b83ea,_0x409224){if(_0x1b83ea['body']['id']){delete _0x1b83ea['body']['id'];}return db[_0xaac0('0x2b')][_0xaac0('0x47')]({'where':{'id':_0x1b83ea[_0xaac0('0x48')]['id']}})[_0xaac0('0x23')](handleEntityNotFound(_0x409224,null))[_0xaac0('0x23')](saveUpdates(_0x1b83ea[_0xaac0('0x46')],null))[_0xaac0('0x23')](respondWithResult(_0x409224,null))[_0xaac0('0x44')](handleError(_0x409224,null));};exports['destroy']=function(_0x5e1068,_0x53ffba){return db[_0xaac0('0x2b')]['find']({'where':{'id':_0x5e1068[_0xaac0('0x48')]['id']}})[_0xaac0('0x23')](handleEntityNotFound(_0x53ffba,null))[_0xaac0('0x23')](removeEntity(_0x53ffba,null))[_0xaac0('0x44')](handleError(_0x53ffba,null));};exports[_0xaac0('0x49')]=function(_0x5a6d09,_0x1e5a6e){return db['SquareReport'][_0xaac0('0x49')]()[_0xaac0('0x23')](respondWithResult(_0x1e5a6e,null))[_0xaac0('0x44')](handleError(_0x1e5a6e,null));}; \ No newline at end of file diff --git a/server/api/squareReport/squareReport.model.js b/server/api/squareReport/squareReport.model.js index e15134f..7db8997 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 _0xd901=['moment','path','rimraf','../../config/environment','./squareReport.attributes','exports','define','uniqueid','leaveAt','lodash','util','../../config/logger','api'];(function(_0x223049,_0x36d987){var _0x5e3729=function(_0x21cd70){while(--_0x21cd70){_0x223049['push'](_0x223049['shift']());}};_0x5e3729(++_0x36d987);}(_0xd901,0x18f));var _0x1d90=function(_0x1e7547,_0xec047a){_0x1e7547=_0x1e7547-0x0;var _0x4ea31c=_0xd901[_0x1e7547];return _0x4ea31c;};'use strict';var _=require(_0x1d90('0x0'));var util=require(_0x1d90('0x1'));var logger=require(_0x1d90('0x2'))(_0x1d90('0x3'));var moment=require(_0x1d90('0x4'));var BPromise=require('bluebird');var rp=require('request-promise');var fs=require('fs');var path=require(_0x1d90('0x5'));var rimraf=require(_0x1d90('0x6'));var config=require(_0x1d90('0x7'));var attributes=require(_0x1d90('0x8'));module[_0x1d90('0x9')]=function(_0x10bb83,_0x2a7ec9){return _0x10bb83[_0x1d90('0xa')]('SquareReport',attributes,{'tableName':'report_square','paranoid':![],'indexes':[{'name':'uid_pname','fields':[_0x1d90('0xb'),'project_name']},{'name':_0x1d90('0xc'),'fields':['leaveAt']}],'timestamps':!![]});}; \ No newline at end of file +var _0x435e=['../../config/environment','./squareReport.attributes','exports','SquareReport','report_square','uniqueid','project_name','leaveAt','util','../../config/logger','bluebird','request-promise','rimraf'];(function(_0x3dd15e,_0x1f0015){var _0x231fd0=function(_0x4f680a){while(--_0x4f680a){_0x3dd15e['push'](_0x3dd15e['shift']());}};_0x231fd0(++_0x1f0015);}(_0x435e,0x1b5));var _0xe435=function(_0x12f688,_0x585c25){_0x12f688=_0x12f688-0x0;var _0x59c3de=_0x435e[_0x12f688];return _0x59c3de;};'use strict';var _=require('lodash');var util=require(_0xe435('0x0'));var logger=require(_0xe435('0x1'))('api');var moment=require('moment');var BPromise=require(_0xe435('0x2'));var rp=require(_0xe435('0x3'));var fs=require('fs');var path=require('path');var rimraf=require(_0xe435('0x4'));var config=require(_0xe435('0x5'));var attributes=require(_0xe435('0x6'));module[_0xe435('0x7')]=function(_0x422eb5,_0x5bff25){return _0x422eb5['define'](_0xe435('0x8'),attributes,{'tableName':_0xe435('0x9'),'paranoid':![],'indexes':[{'name':'uid_pname','fields':[_0xe435('0xa'),_0xe435('0xb')]},{'name':_0xe435('0xc'),'fields':[_0xe435('0xc')]}],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/squareReport/squareReport.rpc.js b/server/api/squareReport/squareReport.rpc.js index 7a0e2b0..1f63d4c 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 _0xfbcd=['stringify','error','code','message','result','catch','CreateSquareReport','SquareReport','create','options','raw','UpdateSquareReport','body','where','attributes','limit','lodash','util','moment','bluebird','randomstring','ioredis','../../config/utils','rpc','../../config/environment','client','http','then','info','SquareReport,\x20%s,\x20%s','request\x20sent','debug'];(function(_0x4b7b69,_0x3ab075){var _0x173b4c=function(_0x234d5f){while(--_0x234d5f){_0x4b7b69['push'](_0x4b7b69['shift']());}};_0x173b4c(++_0x3ab075);}(_0xfbcd,0x170));var _0xdfbc=function(_0x573452,_0x2e531a){_0x573452=_0x573452-0x0;var _0x59777e=_0xfbcd[_0x573452];return _0x59777e;};'use strict';var _=require(_0xdfbc('0x0'));var util=require(_0xdfbc('0x1'));var moment=require(_0xdfbc('0x2'));var BPromise=require(_0xdfbc('0x3'));var rs=require(_0xdfbc('0x4'));var fs=require('fs');var Redis=require(_0xdfbc('0x5'));var db=require('../../mysqldb')['db'];var utils=require(_0xdfbc('0x6'));var logger=require('../../config/logger')(_0xdfbc('0x7'));var config=require(_0xdfbc('0x8'));var jayson=require('jayson/promise');var client=jayson[_0xdfbc('0x9')][_0xdfbc('0xa')]({'port':0x232a});function respondWithRpcPromise(_0x1cc9ec,_0x24fa4b,_0x5cca11){return new BPromise(function(_0x50015d,_0x128a24){return client['request'](_0x1cc9ec,_0x5cca11)[_0xdfbc('0xb')](function(_0x2a568c){logger[_0xdfbc('0xc')](_0xdfbc('0xd'),_0x24fa4b,_0xdfbc('0xe'));logger[_0xdfbc('0xf')]('SquareReport,\x20%s,\x20%s,\x20%s',_0x24fa4b,_0xdfbc('0xe'),JSON[_0xdfbc('0x10')](_0x2a568c));if(_0x2a568c[_0xdfbc('0x11')]){if(_0x2a568c[_0xdfbc('0x11')][_0xdfbc('0x12')]===0x1f4){logger[_0xdfbc('0x11')](_0xdfbc('0xd'),_0x24fa4b,_0x2a568c[_0xdfbc('0x11')][_0xdfbc('0x13')]);return _0x128a24(_0x2a568c['error'][_0xdfbc('0x13')]);}logger[_0xdfbc('0x11')](_0xdfbc('0xd'),_0x24fa4b,_0x2a568c[_0xdfbc('0x11')][_0xdfbc('0x13')]);return _0x50015d(_0x2a568c[_0xdfbc('0x11')][_0xdfbc('0x13')]);}else{logger[_0xdfbc('0xc')](_0xdfbc('0xd'),_0x24fa4b,'request\x20sent');_0x50015d(_0x2a568c[_0xdfbc('0x14')][_0xdfbc('0x13')]);}})[_0xdfbc('0x15')](function(_0x346fe8){logger[_0xdfbc('0x11')](_0xdfbc('0xd'),_0x24fa4b,_0x346fe8);_0x128a24(_0x346fe8);});});}exports[_0xdfbc('0x16')]=function(_0x219fba){var _0x3590ba=this;return new Promise(function(_0x5962ed,_0x263d8b){return db[_0xdfbc('0x17')][_0xdfbc('0x18')](_0x219fba['body'],{'raw':_0x219fba['options']?_0x219fba[_0xdfbc('0x19')][_0xdfbc('0x1a')]===undefined?!![]:![]:!![]})[_0xdfbc('0xb')](function(_0x1db546){logger['info']('CreateSquareReport',_0x219fba);logger[_0xdfbc('0xf')](_0xdfbc('0x16'),_0x219fba,JSON[_0xdfbc('0x10')](_0x1db546));_0x5962ed(_0x1db546);})[_0xdfbc('0x15')](function(_0xde1c4c){logger[_0xdfbc('0x11')](_0xdfbc('0x16'),_0xde1c4c[_0xdfbc('0x13')],_0x219fba);_0x263d8b(_0x3590ba['error'](0x1f4,_0xde1c4c['message']));});});};exports[_0xdfbc('0x1b')]=function(_0x576d84){var _0x234631=this;return new Promise(function(_0x2c2466,_0x5d9289){return db[_0xdfbc('0x17')]['update'](_0x576d84[_0xdfbc('0x1c')],{'raw':_0x576d84[_0xdfbc('0x19')]?_0x576d84['options']['raw']===undefined?!![]:![]:!![],'individualHooks':!![],'where':_0x576d84[_0xdfbc('0x19')]?_0x576d84[_0xdfbc('0x19')][_0xdfbc('0x1d')]||null:null,'attributes':_0x576d84[_0xdfbc('0x19')]?_0x576d84[_0xdfbc('0x19')][_0xdfbc('0x1e')]||null:null,'limit':_0x576d84[_0xdfbc('0x19')]?_0x576d84[_0xdfbc('0x19')][_0xdfbc('0x1f')]||null:null})[_0xdfbc('0xb')](function(_0x1d663d){logger[_0xdfbc('0xc')]('UpdateSquareReport',_0x576d84);logger[_0xdfbc('0xf')]('UpdateSquareReport',_0x576d84,JSON[_0xdfbc('0x10')](_0x1d663d));_0x2c2466(_0x1d663d);})[_0xdfbc('0x15')](function(_0xbaf0df){logger[_0xdfbc('0x11')](_0xdfbc('0x1b'),_0xbaf0df['message'],_0x576d84);_0x5d9289(_0x234631['error'](0x1f4,_0xbaf0df[_0xdfbc('0x13')]));});});}; \ No newline at end of file +var _0x0c17=['raw','UpdateSquareReport','lodash','util','bluebird','ioredis','rpc','../../config/environment','jayson/promise','request','then','info','SquareReport,\x20%s,\x20%s','request\x20sent','debug','SquareReport,\x20%s,\x20%s,\x20%s','stringify','error','message','result','catch','CreateSquareReport','SquareReport','create','body','options'];(function(_0x2b10c6,_0x185590){var _0x3789d2=function(_0x272987){while(--_0x272987){_0x2b10c6['push'](_0x2b10c6['shift']());}};_0x3789d2(++_0x185590);}(_0x0c17,0x9e));var _0x70c1=function(_0x2e48d8,_0x16167d){_0x2e48d8=_0x2e48d8-0x0;var _0x54de0d=_0x0c17[_0x2e48d8];return _0x54de0d;};'use strict';var _=require(_0x70c1('0x0'));var util=require(_0x70c1('0x1'));var moment=require('moment');var BPromise=require(_0x70c1('0x2'));var rs=require('randomstring');var fs=require('fs');var Redis=require(_0x70c1('0x3'));var db=require('../../mysqldb')['db'];var utils=require('../../config/utils');var logger=require('../../config/logger')(_0x70c1('0x4'));var config=require(_0x70c1('0x5'));var jayson=require(_0x70c1('0x6'));var client=jayson['client']['http']({'port':0x232a});function respondWithRpcPromise(_0x3f0ffa,_0x23484f,_0x499df3){return new BPromise(function(_0xf0fd76,_0x1acc0f){return client[_0x70c1('0x7')](_0x3f0ffa,_0x499df3)[_0x70c1('0x8')](function(_0x1ac0ca){logger[_0x70c1('0x9')](_0x70c1('0xa'),_0x23484f,_0x70c1('0xb'));logger[_0x70c1('0xc')](_0x70c1('0xd'),_0x23484f,'request\x20sent',JSON[_0x70c1('0xe')](_0x1ac0ca));if(_0x1ac0ca[_0x70c1('0xf')]){if(_0x1ac0ca[_0x70c1('0xf')]['code']===0x1f4){logger[_0x70c1('0xf')]('SquareReport,\x20%s,\x20%s',_0x23484f,_0x1ac0ca[_0x70c1('0xf')]['message']);return _0x1acc0f(_0x1ac0ca[_0x70c1('0xf')][_0x70c1('0x10')]);}logger['error'](_0x70c1('0xa'),_0x23484f,_0x1ac0ca[_0x70c1('0xf')][_0x70c1('0x10')]);return _0xf0fd76(_0x1ac0ca['error']['message']);}else{logger[_0x70c1('0x9')](_0x70c1('0xa'),_0x23484f,_0x70c1('0xb'));_0xf0fd76(_0x1ac0ca[_0x70c1('0x11')][_0x70c1('0x10')]);}})[_0x70c1('0x12')](function(_0x2a79a5){logger['error'](_0x70c1('0xa'),_0x23484f,_0x2a79a5);_0x1acc0f(_0x2a79a5);});});}exports[_0x70c1('0x13')]=function(_0x4d6fb6){var _0xcedecf=this;return new Promise(function(_0x57d4ba,_0xd19fa6){return db[_0x70c1('0x14')][_0x70c1('0x15')](_0x4d6fb6[_0x70c1('0x16')],{'raw':_0x4d6fb6[_0x70c1('0x17')]?_0x4d6fb6[_0x70c1('0x17')][_0x70c1('0x18')]===undefined?!![]:![]:!![]})['then'](function(_0x6bc10){logger['info'](_0x70c1('0x13'),_0x4d6fb6);logger['debug'](_0x70c1('0x13'),_0x4d6fb6,JSON[_0x70c1('0xe')](_0x6bc10));_0x57d4ba(_0x6bc10);})[_0x70c1('0x12')](function(_0x11ce8f){logger[_0x70c1('0xf')](_0x70c1('0x13'),_0x11ce8f[_0x70c1('0x10')],_0x4d6fb6);_0xd19fa6(_0xcedecf[_0x70c1('0xf')](0x1f4,_0x11ce8f[_0x70c1('0x10')]));});});};exports[_0x70c1('0x19')]=function(_0x49e32d){var _0x474e39=this;return new Promise(function(_0x42fc1e,_0x49bfa1){return db['SquareReport']['update'](_0x49e32d[_0x70c1('0x16')],{'raw':_0x49e32d[_0x70c1('0x17')]?_0x49e32d[_0x70c1('0x17')][_0x70c1('0x18')]===undefined?!![]:![]:!![],'individualHooks':!![],'where':_0x49e32d['options']?_0x49e32d['options']['where']||null:null,'attributes':_0x49e32d[_0x70c1('0x17')]?_0x49e32d[_0x70c1('0x17')]['attributes']||null:null,'limit':_0x49e32d['options']?_0x49e32d['options']['limit']||null:null})[_0x70c1('0x8')](function(_0x40902b){logger[_0x70c1('0x9')]('UpdateSquareReport',_0x49e32d);logger[_0x70c1('0xc')](_0x70c1('0x19'),_0x49e32d,JSON[_0x70c1('0xe')](_0x40902b));_0x42fc1e(_0x40902b);})['catch'](function(_0x1babea){logger[_0x70c1('0xf')](_0x70c1('0x19'),_0x1babea[_0x70c1('0x10')],_0x49e32d);_0x49bfa1(_0x474e39[_0x70c1('0xf')](0x1f4,_0x1babea[_0x70c1('0x10')]));});});}; \ No newline at end of file diff --git a/server/api/squareReportDetail/index.js b/server/api/squareReportDetail/index.js index fe60349..ba20f6e 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 _0x2c1e=['index','/describe','describe','/:id','post','create','put','update','delete','exports','util','path','express','fs-extra','../../components/auth/service','../../config/environment','./squareReportDetail.controller','get','isAuthenticated'];(function(_0x3b380d,_0x4bf247){var _0x54502b=function(_0x35d207){while(--_0x35d207){_0x3b380d['push'](_0x3b380d['shift']());}};_0x54502b(++_0x4bf247);}(_0x2c1e,0x160));var _0xe2c1=function(_0x426994,_0x3f09c6){_0x426994=_0x426994-0x0;var _0xbbfc6=_0x2c1e[_0x426994];return _0xbbfc6;};'use strict';var multer=require('multer');var util=require(_0xe2c1('0x0'));var path=require(_0xe2c1('0x1'));var timeout=require('connect-timeout');var express=require(_0xe2c1('0x2'));var router=express['Router']();var fs_extra=require(_0xe2c1('0x3'));var auth=require(_0xe2c1('0x4'));var interaction=require('../../components/interaction/service');var config=require(_0xe2c1('0x5'));var controller=require(_0xe2c1('0x6'));router[_0xe2c1('0x7')]('/',auth[_0xe2c1('0x8')](),controller[_0xe2c1('0x9')]);router[_0xe2c1('0x7')](_0xe2c1('0xa'),auth[_0xe2c1('0x8')](),controller[_0xe2c1('0xb')]);router[_0xe2c1('0x7')](_0xe2c1('0xc'),auth['isAuthenticated'](),controller['show']);router[_0xe2c1('0xd')]('/',auth[_0xe2c1('0x8')](),controller[_0xe2c1('0xe')]);router[_0xe2c1('0xf')](_0xe2c1('0xc'),auth[_0xe2c1('0x8')](),controller[_0xe2c1('0x10')]);router[_0xe2c1('0x11')]('/:id',auth[_0xe2c1('0x8')](),controller['destroy']);module[_0xe2c1('0x12')]=router; \ No newline at end of file +var _0x7d48=['fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','./squareReportDetail.controller','isAuthenticated','index','get','describe','/:id','show','create','put','update','destroy','exports','multer','util','path','connect-timeout','express','Router'];(function(_0x54fbed,_0x3c77a7){var _0x333bbc=function(_0x53c015){while(--_0x53c015){_0x54fbed['push'](_0x54fbed['shift']());}};_0x333bbc(++_0x3c77a7);}(_0x7d48,0x7e));var _0x87d4=function(_0x2f0f1f,_0x19153d){_0x2f0f1f=_0x2f0f1f-0x0;var _0x478cbd=_0x7d48[_0x2f0f1f];return _0x478cbd;};'use strict';var multer=require(_0x87d4('0x0'));var util=require(_0x87d4('0x1'));var path=require(_0x87d4('0x2'));var timeout=require(_0x87d4('0x3'));var express=require(_0x87d4('0x4'));var router=express[_0x87d4('0x5')]();var fs_extra=require(_0x87d4('0x6'));var auth=require(_0x87d4('0x7'));var interaction=require(_0x87d4('0x8'));var config=require(_0x87d4('0x9'));var controller=require(_0x87d4('0xa'));router['get']('/',auth[_0x87d4('0xb')](),controller[_0x87d4('0xc')]);router[_0x87d4('0xd')]('/describe',auth[_0x87d4('0xb')](),controller[_0x87d4('0xe')]);router['get'](_0x87d4('0xf'),auth['isAuthenticated'](),controller[_0x87d4('0x10')]);router['post']('/',auth[_0x87d4('0xb')](),controller[_0x87d4('0x11')]);router[_0x87d4('0x12')](_0x87d4('0xf'),auth['isAuthenticated'](),controller[_0x87d4('0x13')]);router['delete'](_0x87d4('0xf'),auth[_0x87d4('0xb')](),controller[_0x87d4('0x14')]);module[_0x87d4('0x15')]=router; \ No newline at end of file diff --git a/server/api/squareReportDetail/squareReportDetail.attributes.js b/server/api/squareReportDetail/squareReportDetail.attributes.js index 3953de3..a3c91bd 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 _0xf05a=['STRING','sequelize','exports'];(function(_0x37fd9c,_0x24b24a){var _0x2a515d=function(_0x4e7ce6){while(--_0x4e7ce6){_0x37fd9c['push'](_0x37fd9c['shift']());}};_0x2a515d(++_0x24b24a);}(_0xf05a,0x193));var _0xaf05=function(_0x57b54c,_0x54ce0d){_0x57b54c=_0x57b54c-0x0;var _0x59cc19=_0xf05a[_0x57b54c];return _0x59cc19;};'use strict';var Sequelize=require(_0xaf05('0x0'));module[_0xaf05('0x1')]={'uniqueid':{'type':Sequelize[_0xaf05('0x2')]},'node':{'type':Sequelize[_0xaf05('0x2')]},'application':{'type':Sequelize['STRING']},'data':{'type':Sequelize['TEXT']},'project_name':{'type':Sequelize[_0xaf05('0x2')]},'callerid':{'type':Sequelize[_0xaf05('0x2')]}}; \ No newline at end of file +var _0xea86=['TEXT','sequelize','exports','STRING'];(function(_0x49c327,_0x197706){var _0x3de249=function(_0x253815){while(--_0x253815){_0x49c327['push'](_0x49c327['shift']());}};_0x3de249(++_0x197706);}(_0xea86,0xc9));var _0x6ea8=function(_0xa464c9,_0x7c86d8){_0xa464c9=_0xa464c9-0x0;var _0x3d73c4=_0xea86[_0xa464c9];return _0x3d73c4;};'use strict';var Sequelize=require(_0x6ea8('0x0'));module[_0x6ea8('0x1')]={'uniqueid':{'type':Sequelize[_0x6ea8('0x2')]},'node':{'type':Sequelize['STRING']},'application':{'type':Sequelize[_0x6ea8('0x2')]},'data':{'type':Sequelize[_0x6ea8('0x3')]},'project_name':{'type':Sequelize[_0x6ea8('0x2')]},'callerid':{'type':Sequelize[_0x6ea8('0x2')]}}; \ No newline at end of file diff --git a/server/api/squareReportDetail/squareReportDetail.controller.js b/server/api/squareReportDetail/squareReportDetail.controller.js index e0f360b..6c2c23c 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 _0x74c1=['fieldName','type','key','query','intersection','model','attributes','fields','length','hasOwnProperty','order','sort','where','filters','pick','filter','merge','VIRTUAL','options','include','findAll','rows','catch','show','params','keys','includeAll','create','find','describe','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','moment','bluebird','mustache','path','ejs','fs-extra','lodash','squel','crypto','jsforce','to-csv','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','json','undefined','limit','count','offset','status','set','Content-Range','apply','reject','save','update','destroy','then','sendStatus','stack','name','send','index','map','SquareDetailsReport','rawAttributes'];(function(_0xf18dc7,_0x500931){var _0x5922ac=function(_0x230e11){while(--_0x230e11){_0xf18dc7['push'](_0xf18dc7['shift']());}};_0x5922ac(++_0x500931);}(_0x74c1,0xbc));var _0x174c=function(_0xc08f5b,_0x11ceab){_0xc08f5b=_0xc08f5b-0x0;var _0x2d67ee=_0x74c1[_0xc08f5b];return _0x2d67ee;};'use strict';var emlformat=require(_0x174c('0x0'));var rimraf=require(_0x174c('0x1'));var zipdir=require(_0x174c('0x2'));var jsonpatch=require(_0x174c('0x3'));var rp=require(_0x174c('0x4'));var moment=require(_0x174c('0x5'));var BPromise=require(_0x174c('0x6'));var Mustache=require(_0x174c('0x7'));var util=require('util');var path=require(_0x174c('0x8'));var sox=require('sox');var csv=require('to-csv');var ejs=require(_0x174c('0x9'));var fs=require('fs');var fs_extra=require(_0x174c('0xa'));var _=require(_0x174c('0xb'));var squel=require(_0x174c('0xc'));var crypto=require(_0x174c('0xd'));var jsforce=require(_0x174c('0xe'));var deskjs=require('desk.js');var toCsv=require(_0x174c('0xf'));var querystring=require('querystring');var Papa=require(_0x174c('0x10'));var Redis=require(_0x174c('0x11'));var authService=require(_0x174c('0x12'));var qs=require(_0x174c('0x13'));var as=require('../../components/parsers/advancedSearch');var hardwareService=require(_0x174c('0x14'));var logger=require(_0x174c('0x15'))(_0x174c('0x16'));var utils=require(_0x174c('0x17'));var config=require(_0x174c('0x18'));var licenseUtil=require(_0x174c('0x19'));var db=require(_0x174c('0x1a'))['db'];function respondWithStatusCode(_0x1551b3,_0x93e8a7){_0x93e8a7=_0x93e8a7||0xcc;return function(_0x21ff33){if(_0x21ff33){return _0x1551b3['sendStatus'](_0x93e8a7);}return _0x1551b3['status'](_0x93e8a7)['end']();};}function respondWithResult(_0x480b69,_0xc8623a){_0xc8623a=_0xc8623a||0xc8;return function(_0x376004){if(_0x376004){return _0x480b69['status'](_0xc8623a)[_0x174c('0x1b')](_0x376004);}};}function respondWithFilteredResult(_0x52433a,_0x9bc9cf){return function(_0x3897ff){if(_0x3897ff){var _0x877073=typeof _0x9bc9cf['offset']===_0x174c('0x1c')&&typeof _0x9bc9cf[_0x174c('0x1d')]===_0x174c('0x1c');var _0x45167a=_0x3897ff[_0x174c('0x1e')];var _0x58d3ce=_0x877073?0x0:_0x9bc9cf['offset'];var _0x39866f=_0x877073?_0x3897ff['count']:_0x9bc9cf[_0x174c('0x1f')]+_0x9bc9cf[_0x174c('0x1d')];var _0x221af0;if(_0x39866f>=_0x45167a){_0x39866f=_0x45167a;_0x221af0=0xc8;}else{_0x221af0=0xce;}_0x52433a[_0x174c('0x20')](_0x221af0);return _0x52433a[_0x174c('0x21')](_0x174c('0x22'),_0x58d3ce+'-'+_0x39866f+'/'+_0x45167a)[_0x174c('0x1b')](_0x3897ff);}return null;};}function patchUpdates(_0x210638){return function(_0x515782){try{jsonpatch[_0x174c('0x23')](_0x515782,_0x210638,!![]);}catch(_0x1da2f8){return BPromise[_0x174c('0x24')](_0x1da2f8);}return _0x515782[_0x174c('0x25')]();};}function saveUpdates(_0x129ddf,_0x222488){return function(_0x4dfe3b){if(_0x4dfe3b){return _0x4dfe3b[_0x174c('0x26')](_0x129ddf)['then'](function(_0xc4a8ec){return _0xc4a8ec;});}return null;};}function removeEntity(_0x2d3edd,_0x5dc872){return function(_0x36e499){if(_0x36e499){return _0x36e499[_0x174c('0x27')]()[_0x174c('0x28')](function(){_0x2d3edd[_0x174c('0x20')](0xcc)['end']();});}};}function handleEntityNotFound(_0x45c4f5,_0x1ccaa9){return function(_0x11b0dc){if(!_0x11b0dc){_0x45c4f5[_0x174c('0x29')](0x194);}return _0x11b0dc;};}function handleError(_0x59b978,_0x447121){_0x447121=_0x447121||0x1f4;return function(_0x26d1a5){logger['error'](_0x26d1a5[_0x174c('0x2a')]);if(_0x26d1a5['name']){delete _0x26d1a5[_0x174c('0x2b')];}_0x59b978[_0x174c('0x20')](_0x447121)[_0x174c('0x2c')](_0x26d1a5);};}exports[_0x174c('0x2d')]=function(_0x1485df,_0x3b85ac){var _0x61898b={},_0x1e64a3={},_0x1dce1a={'count':0x0,'rows':[]};var _0x2d4bba=_[_0x174c('0x2e')](db[_0x174c('0x2f')][_0x174c('0x30')],function(_0x247b04){return{'name':_0x247b04[_0x174c('0x31')],'type':_0x247b04[_0x174c('0x32')][_0x174c('0x33')]};});_0x1e64a3['model']=_[_0x174c('0x2e')](_0x2d4bba,_0x174c('0x2b'));_0x1e64a3[_0x174c('0x34')]=_['keys'](_0x1485df[_0x174c('0x34')]);_0x1e64a3['filters']=_[_0x174c('0x35')](_0x1e64a3[_0x174c('0x36')],_0x1e64a3[_0x174c('0x34')]);_0x61898b[_0x174c('0x37')]=_[_0x174c('0x35')](_0x1e64a3[_0x174c('0x36')],qs['fields'](_0x1485df['query'][_0x174c('0x38')]));_0x61898b[_0x174c('0x37')]=_0x61898b[_0x174c('0x37')][_0x174c('0x39')]?_0x61898b[_0x174c('0x37')]:_0x1e64a3[_0x174c('0x36')];if(!_0x1485df['query'][_0x174c('0x3a')]('nolimit')){_0x61898b['limit']=qs[_0x174c('0x1d')](_0x1485df[_0x174c('0x34')]['limit']);_0x61898b[_0x174c('0x1f')]=qs[_0x174c('0x1f')](_0x1485df[_0x174c('0x34')][_0x174c('0x1f')]);}_0x61898b[_0x174c('0x3b')]=qs[_0x174c('0x3c')](_0x1485df['query']['sort']);_0x61898b[_0x174c('0x3d')]=qs[_0x174c('0x3e')](_[_0x174c('0x3f')](_0x1485df['query'],_0x1e64a3[_0x174c('0x3e')]),_0x2d4bba);if(_0x1485df[_0x174c('0x34')][_0x174c('0x40')]){_0x61898b[_0x174c('0x3d')]=_[_0x174c('0x41')](_0x61898b['where'],{'$or':_[_0x174c('0x2e')](_0x2d4bba,function(_0x2db285){if(_0x2db285[_0x174c('0x32')]!==_0x174c('0x42')){var _0x3c309a={};_0x3c309a[_0x2db285['name']]={'$like':'%'+_0x1485df[_0x174c('0x34')][_0x174c('0x40')]+'%'};return _0x3c309a;}})});}_0x61898b=_[_0x174c('0x41')]({},_0x61898b,_0x1485df[_0x174c('0x43')]);var _0x46255f={'where':_0x61898b[_0x174c('0x3d')]};return db['SquareDetailsReport']['count'](_0x46255f)[_0x174c('0x28')](function(_0x1e38d0){_0x1dce1a[_0x174c('0x1e')]=_0x1e38d0;if(_0x1485df[_0x174c('0x34')]['includeAll']){_0x61898b[_0x174c('0x44')]=[{'all':!![]}];}return db[_0x174c('0x2f')][_0x174c('0x45')](_0x61898b);})[_0x174c('0x28')](function(_0xd41660){_0x1dce1a[_0x174c('0x46')]=_0xd41660;return _0x1dce1a;})[_0x174c('0x28')](respondWithFilteredResult(_0x3b85ac,_0x61898b))[_0x174c('0x47')](handleError(_0x3b85ac,null));};exports[_0x174c('0x48')]=function(_0xcce3b3,_0x48d389){var _0x3353bb={'raw':!![],'where':{'id':_0xcce3b3[_0x174c('0x49')]['id']}},_0x39bccb={};_0x39bccb['model']=_[_0x174c('0x4a')](db['SquareDetailsReport'][_0x174c('0x30')]);_0x39bccb[_0x174c('0x34')]=_[_0x174c('0x4a')](_0xcce3b3[_0x174c('0x34')]);_0x39bccb[_0x174c('0x3e')]=_['intersection'](_0x39bccb[_0x174c('0x36')],_0x39bccb[_0x174c('0x34')]);_0x3353bb[_0x174c('0x37')]=_[_0x174c('0x35')](_0x39bccb['model'],qs[_0x174c('0x38')](_0xcce3b3[_0x174c('0x34')]['fields']));_0x3353bb[_0x174c('0x37')]=_0x3353bb[_0x174c('0x37')][_0x174c('0x39')]?_0x3353bb[_0x174c('0x37')]:_0x39bccb[_0x174c('0x36')];if(_0xcce3b3[_0x174c('0x34')][_0x174c('0x4b')]){_0x3353bb[_0x174c('0x44')]=[{'all':!![]}];}_0x3353bb=_[_0x174c('0x41')]({},_0x3353bb,_0xcce3b3[_0x174c('0x43')]);return db[_0x174c('0x2f')]['find'](_0x3353bb)[_0x174c('0x28')](handleEntityNotFound(_0x48d389,null))[_0x174c('0x28')](respondWithResult(_0x48d389,null))['catch'](handleError(_0x48d389,null));};exports[_0x174c('0x4c')]=function(_0x17c78f,_0x25f01d){return db[_0x174c('0x2f')][_0x174c('0x4c')](_0x17c78f['body'],{})[_0x174c('0x28')](respondWithResult(_0x25f01d,0xc9))[_0x174c('0x47')](handleError(_0x25f01d,null));};exports[_0x174c('0x26')]=function(_0x168443,_0x295438){if(_0x168443['body']['id']){delete _0x168443['body']['id'];}return db['SquareDetailsReport']['find']({'where':{'id':_0x168443[_0x174c('0x49')]['id']}})['then'](handleEntityNotFound(_0x295438,null))[_0x174c('0x28')](saveUpdates(_0x168443['body'],null))[_0x174c('0x28')](respondWithResult(_0x295438,null))[_0x174c('0x47')](handleError(_0x295438,null));};exports[_0x174c('0x27')]=function(_0x7ebee8,_0x1cc31c){return db[_0x174c('0x2f')][_0x174c('0x4d')]({'where':{'id':_0x7ebee8[_0x174c('0x49')]['id']}})[_0x174c('0x28')](handleEntityNotFound(_0x1cc31c,null))['then'](removeEntity(_0x1cc31c,null))[_0x174c('0x47')](handleError(_0x1cc31c,null));};exports[_0x174c('0x4e')]=function(_0x1b66bf,_0x149507){return db[_0x174c('0x2f')][_0x174c('0x4e')]()[_0x174c('0x28')](respondWithResult(_0x149507,null))[_0x174c('0x47')](handleError(_0x149507,null));}; \ No newline at end of file +var _0xa8f6=['status','end','offset','undefined','limit','count','set','Content-Range','json','save','update','destroy','sendStatus','stack','name','index','map','SquareDetailsReport','rawAttributes','fieldName','type','key','model','keys','intersection','attributes','query','fields','length','nolimit','order','sort','where','filters','VIRTUAL','merge','options','then','includeAll','findAll','rows','params','find','catch','create','body','describe','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','moment','bluebird','util','path','sox','to-csv','fs-extra','lodash','squel','desk.js','papaparse','ioredis','../../components/parsers/qs','../../config/license/hardware','../../config/logger','../../config/utils','../../config/license/util','../../mysqldb'];(function(_0x13e79f,_0x16aea1){var _0x23b3d4=function(_0x2ff90f){while(--_0x2ff90f){_0x13e79f['push'](_0x13e79f['shift']());}};_0x23b3d4(++_0x16aea1);}(_0xa8f6,0x1d3));var _0x6a8f=function(_0x48b0b7,_0x2a0406){_0x48b0b7=_0x48b0b7-0x0;var _0x164584=_0xa8f6[_0x48b0b7];return _0x164584;};'use strict';var emlformat=require(_0x6a8f('0x0'));var rimraf=require(_0x6a8f('0x1'));var zipdir=require(_0x6a8f('0x2'));var jsonpatch=require(_0x6a8f('0x3'));var rp=require(_0x6a8f('0x4'));var moment=require(_0x6a8f('0x5'));var BPromise=require(_0x6a8f('0x6'));var Mustache=require('mustache');var util=require(_0x6a8f('0x7'));var path=require(_0x6a8f('0x8'));var sox=require(_0x6a8f('0x9'));var csv=require(_0x6a8f('0xa'));var ejs=require('ejs');var fs=require('fs');var fs_extra=require(_0x6a8f('0xb'));var _=require(_0x6a8f('0xc'));var squel=require(_0x6a8f('0xd'));var crypto=require('crypto');var jsforce=require('jsforce');var deskjs=require(_0x6a8f('0xe'));var toCsv=require(_0x6a8f('0xa'));var querystring=require('querystring');var Papa=require(_0x6a8f('0xf'));var Redis=require(_0x6a8f('0x10'));var authService=require('../../components/auth/service');var qs=require(_0x6a8f('0x11'));var as=require('../../components/parsers/advancedSearch');var hardwareService=require(_0x6a8f('0x12'));var logger=require(_0x6a8f('0x13'))('api');var utils=require(_0x6a8f('0x14'));var config=require('../../config/environment');var licenseUtil=require(_0x6a8f('0x15'));var db=require(_0x6a8f('0x16'))['db'];function respondWithStatusCode(_0x92218f,_0x241c67){_0x241c67=_0x241c67||0xcc;return function(_0x11dc24){if(_0x11dc24){return _0x92218f['sendStatus'](_0x241c67);}return _0x92218f[_0x6a8f('0x17')](_0x241c67)[_0x6a8f('0x18')]();};}function respondWithResult(_0x16cc95,_0x350f7e){_0x350f7e=_0x350f7e||0xc8;return function(_0x301e78){if(_0x301e78){return _0x16cc95[_0x6a8f('0x17')](_0x350f7e)['json'](_0x301e78);}};}function respondWithFilteredResult(_0x18bba0,_0x20bda3){return function(_0xc7772c){if(_0xc7772c){var _0xd23c86=typeof _0x20bda3[_0x6a8f('0x19')]===_0x6a8f('0x1a')&&typeof _0x20bda3[_0x6a8f('0x1b')]===_0x6a8f('0x1a');var _0x1b138f=_0xc7772c[_0x6a8f('0x1c')];var _0x47d6a7=_0xd23c86?0x0:_0x20bda3[_0x6a8f('0x19')];var _0x2b2361=_0xd23c86?_0xc7772c[_0x6a8f('0x1c')]:_0x20bda3[_0x6a8f('0x19')]+_0x20bda3[_0x6a8f('0x1b')];var _0x475bb2;if(_0x2b2361>=_0x1b138f){_0x2b2361=_0x1b138f;_0x475bb2=0xc8;}else{_0x475bb2=0xce;}_0x18bba0['status'](_0x475bb2);return _0x18bba0[_0x6a8f('0x1d')](_0x6a8f('0x1e'),_0x47d6a7+'-'+_0x2b2361+'/'+_0x1b138f)[_0x6a8f('0x1f')](_0xc7772c);}return null;};}function patchUpdates(_0x135e2b){return function(_0x347585){try{jsonpatch['apply'](_0x347585,_0x135e2b,!![]);}catch(_0x478bd3){return BPromise['reject'](_0x478bd3);}return _0x347585[_0x6a8f('0x20')]();};}function saveUpdates(_0x3117c1,_0x4cfa2b){return function(_0xb8b7e8){if(_0xb8b7e8){return _0xb8b7e8[_0x6a8f('0x21')](_0x3117c1)['then'](function(_0x51ee79){return _0x51ee79;});}return null;};}function removeEntity(_0x4dec39,_0x30ee48){return function(_0x9d0a10){if(_0x9d0a10){return _0x9d0a10[_0x6a8f('0x22')]()['then'](function(){_0x4dec39['status'](0xcc)[_0x6a8f('0x18')]();});}};}function handleEntityNotFound(_0x2e7e29,_0x50aeaf){return function(_0x4aa640){if(!_0x4aa640){_0x2e7e29[_0x6a8f('0x23')](0x194);}return _0x4aa640;};}function handleError(_0x1da2e2,_0x57750c){_0x57750c=_0x57750c||0x1f4;return function(_0x58f4c3){logger['error'](_0x58f4c3[_0x6a8f('0x24')]);if(_0x58f4c3[_0x6a8f('0x25')]){delete _0x58f4c3['name'];}_0x1da2e2[_0x6a8f('0x17')](_0x57750c)['send'](_0x58f4c3);};}exports[_0x6a8f('0x26')]=function(_0x3f9881,_0x126df1){var _0x569410={},_0x33be0e={},_0x103f0f={'count':0x0,'rows':[]};var _0x584033=_[_0x6a8f('0x27')](db[_0x6a8f('0x28')][_0x6a8f('0x29')],function(_0x54023e){return{'name':_0x54023e[_0x6a8f('0x2a')],'type':_0x54023e[_0x6a8f('0x2b')][_0x6a8f('0x2c')]};});_0x33be0e[_0x6a8f('0x2d')]=_[_0x6a8f('0x27')](_0x584033,_0x6a8f('0x25'));_0x33be0e['query']=_[_0x6a8f('0x2e')](_0x3f9881['query']);_0x33be0e['filters']=_[_0x6a8f('0x2f')](_0x33be0e[_0x6a8f('0x2d')],_0x33be0e['query']);_0x569410[_0x6a8f('0x30')]=_[_0x6a8f('0x2f')](_0x33be0e[_0x6a8f('0x2d')],qs['fields'](_0x3f9881[_0x6a8f('0x31')][_0x6a8f('0x32')]));_0x569410['attributes']=_0x569410[_0x6a8f('0x30')][_0x6a8f('0x33')]?_0x569410[_0x6a8f('0x30')]:_0x33be0e['model'];if(!_0x3f9881[_0x6a8f('0x31')]['hasOwnProperty'](_0x6a8f('0x34'))){_0x569410[_0x6a8f('0x1b')]=qs[_0x6a8f('0x1b')](_0x3f9881[_0x6a8f('0x31')]['limit']);_0x569410[_0x6a8f('0x19')]=qs[_0x6a8f('0x19')](_0x3f9881[_0x6a8f('0x31')][_0x6a8f('0x19')]);}_0x569410[_0x6a8f('0x35')]=qs[_0x6a8f('0x36')](_0x3f9881[_0x6a8f('0x31')][_0x6a8f('0x36')]);_0x569410[_0x6a8f('0x37')]=qs[_0x6a8f('0x38')](_['pick'](_0x3f9881[_0x6a8f('0x31')],_0x33be0e[_0x6a8f('0x38')]),_0x584033);if(_0x3f9881['query']['filter']){_0x569410[_0x6a8f('0x37')]=_['merge'](_0x569410[_0x6a8f('0x37')],{'$or':_[_0x6a8f('0x27')](_0x584033,function(_0x3f0d1d){if(_0x3f0d1d['type']!==_0x6a8f('0x39')){var _0x4e9f11={};_0x4e9f11[_0x3f0d1d['name']]={'$like':'%'+_0x3f9881[_0x6a8f('0x31')]['filter']+'%'};return _0x4e9f11;}})});}_0x569410=_[_0x6a8f('0x3a')]({},_0x569410,_0x3f9881[_0x6a8f('0x3b')]);var _0x14d422={'where':_0x569410[_0x6a8f('0x37')]};return db['SquareDetailsReport']['count'](_0x14d422)[_0x6a8f('0x3c')](function(_0x2934a9){_0x103f0f['count']=_0x2934a9;if(_0x3f9881['query'][_0x6a8f('0x3d')]){_0x569410['include']=[{'all':!![]}];}return db[_0x6a8f('0x28')][_0x6a8f('0x3e')](_0x569410);})['then'](function(_0xb56961){_0x103f0f[_0x6a8f('0x3f')]=_0xb56961;return _0x103f0f;})[_0x6a8f('0x3c')](respondWithFilteredResult(_0x126df1,_0x569410))['catch'](handleError(_0x126df1,null));};exports['show']=function(_0x13c3ab,_0x2cf02f){var _0x14418b={'raw':!![],'where':{'id':_0x13c3ab[_0x6a8f('0x40')]['id']}},_0x4c703b={};_0x4c703b['model']=_[_0x6a8f('0x2e')](db[_0x6a8f('0x28')][_0x6a8f('0x29')]);_0x4c703b[_0x6a8f('0x31')]=_[_0x6a8f('0x2e')](_0x13c3ab[_0x6a8f('0x31')]);_0x4c703b[_0x6a8f('0x38')]=_[_0x6a8f('0x2f')](_0x4c703b[_0x6a8f('0x2d')],_0x4c703b[_0x6a8f('0x31')]);_0x14418b[_0x6a8f('0x30')]=_[_0x6a8f('0x2f')](_0x4c703b[_0x6a8f('0x2d')],qs[_0x6a8f('0x32')](_0x13c3ab[_0x6a8f('0x31')][_0x6a8f('0x32')]));_0x14418b['attributes']=_0x14418b[_0x6a8f('0x30')]['length']?_0x14418b[_0x6a8f('0x30')]:_0x4c703b['model'];if(_0x13c3ab['query']['includeAll']){_0x14418b['include']=[{'all':!![]}];}_0x14418b=_['merge']({},_0x14418b,_0x13c3ab[_0x6a8f('0x3b')]);return db[_0x6a8f('0x28')][_0x6a8f('0x41')](_0x14418b)[_0x6a8f('0x3c')](handleEntityNotFound(_0x2cf02f,null))[_0x6a8f('0x3c')](respondWithResult(_0x2cf02f,null))[_0x6a8f('0x42')](handleError(_0x2cf02f,null));};exports[_0x6a8f('0x43')]=function(_0xa2d318,_0x3a57e9){return db['SquareDetailsReport'][_0x6a8f('0x43')](_0xa2d318[_0x6a8f('0x44')],{})['then'](respondWithResult(_0x3a57e9,0xc9))[_0x6a8f('0x42')](handleError(_0x3a57e9,null));};exports['update']=function(_0x5b944c,_0x125c35){if(_0x5b944c[_0x6a8f('0x44')]['id']){delete _0x5b944c[_0x6a8f('0x44')]['id'];}return db['SquareDetailsReport'][_0x6a8f('0x41')]({'where':{'id':_0x5b944c[_0x6a8f('0x40')]['id']}})['then'](handleEntityNotFound(_0x125c35,null))['then'](saveUpdates(_0x5b944c[_0x6a8f('0x44')],null))[_0x6a8f('0x3c')](respondWithResult(_0x125c35,null))[_0x6a8f('0x42')](handleError(_0x125c35,null));};exports[_0x6a8f('0x22')]=function(_0x14b7db,_0x2a8453){return db[_0x6a8f('0x28')][_0x6a8f('0x41')]({'where':{'id':_0x14b7db[_0x6a8f('0x40')]['id']}})[_0x6a8f('0x3c')](handleEntityNotFound(_0x2a8453,null))[_0x6a8f('0x3c')](removeEntity(_0x2a8453,null))['catch'](handleError(_0x2a8453,null));};exports[_0x6a8f('0x45')]=function(_0xa9ce44,_0x22d9e9){return db[_0x6a8f('0x28')][_0x6a8f('0x45')]()['then'](respondWithResult(_0x22d9e9,null))[_0x6a8f('0x42')](handleError(_0x22d9e9,null));}; \ No newline at end of file diff --git a/server/api/squareReportDetail/squareReportDetail.model.js b/server/api/squareReportDetail/squareReportDetail.model.js index 8a1d64d..a48d788 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 _0x00bd=['../../config/environment','./squareReportDetail.attributes','exports','report_square_details','util','../../config/logger','moment','bluebird','request-promise','path','rimraf'];(function(_0x8a70f1,_0x59e73f){var _0x2273a6=function(_0x4fca5c){while(--_0x4fca5c){_0x8a70f1['push'](_0x8a70f1['shift']());}};_0x2273a6(++_0x59e73f);}(_0x00bd,0x1c7));var _0xd00b=function(_0x4e331e,_0x3aa45d){_0x4e331e=_0x4e331e-0x0;var _0x5d144d=_0x00bd[_0x4e331e];return _0x5d144d;};'use strict';var _=require('lodash');var util=require(_0xd00b('0x0'));var logger=require(_0xd00b('0x1'))('api');var moment=require(_0xd00b('0x2'));var BPromise=require(_0xd00b('0x3'));var rp=require(_0xd00b('0x4'));var fs=require('fs');var path=require(_0xd00b('0x5'));var rimraf=require(_0xd00b('0x6'));var config=require(_0xd00b('0x7'));var attributes=require(_0xd00b('0x8'));module[_0xd00b('0x9')]=function(_0x28b416,_0x5d3db1){return _0x28b416['define']('SquareDetailsReport',attributes,{'tableName':_0xd00b('0xa'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0xaa09=['../../config/environment','./squareReportDetail.attributes','define','SquareDetailsReport','lodash','util','api','moment','request-promise','path','rimraf'];(function(_0x321bb2,_0x202794){var _0x9c12ed=function(_0x263dd3){while(--_0x263dd3){_0x321bb2['push'](_0x321bb2['shift']());}};_0x9c12ed(++_0x202794);}(_0xaa09,0x122));var _0x9aa0=function(_0x3034ea,_0x560604){_0x3034ea=_0x3034ea-0x0;var _0x5e062=_0xaa09[_0x3034ea];return _0x5e062;};'use strict';var _=require(_0x9aa0('0x0'));var util=require(_0x9aa0('0x1'));var logger=require('../../config/logger')(_0x9aa0('0x2'));var moment=require(_0x9aa0('0x3'));var BPromise=require('bluebird');var rp=require(_0x9aa0('0x4'));var fs=require('fs');var path=require(_0x9aa0('0x5'));var rimraf=require(_0x9aa0('0x6'));var config=require(_0x9aa0('0x7'));var attributes=require(_0x9aa0('0x8'));module['exports']=function(_0x2164cd,_0x5c7be1){return _0x2164cd[_0x9aa0('0x9')](_0x9aa0('0xa'),attributes,{'tableName':'report_square_details','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 7eb2377..c59394e 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 _0x263f=['randomstring','ioredis','../../config/utils','../../config/logger','rpc','jayson/promise','client','then','info','SquareDetailsReport,\x20%s,\x20%s','request\x20sent','debug','SquareDetailsReport,\x20%s,\x20%s,\x20%s','stringify','error','message','result','catch','CreateSquareDetailsReport','SquareDetailsReport','body','options','lodash','util','moment','bluebird'];(function(_0x498bb9,_0x420619){var _0xbc23f2=function(_0x5ce71b){while(--_0x5ce71b){_0x498bb9['push'](_0x498bb9['shift']());}};_0xbc23f2(++_0x420619);}(_0x263f,0x182));var _0xf263=function(_0x26fa14,_0x28eb85){_0x26fa14=_0x26fa14-0x0;var _0x2fa92b=_0x263f[_0x26fa14];return _0x2fa92b;};'use strict';var _=require(_0xf263('0x0'));var util=require(_0xf263('0x1'));var moment=require(_0xf263('0x2'));var BPromise=require(_0xf263('0x3'));var rs=require(_0xf263('0x4'));var fs=require('fs');var Redis=require(_0xf263('0x5'));var db=require('../../mysqldb')['db'];var utils=require(_0xf263('0x6'));var logger=require(_0xf263('0x7'))(_0xf263('0x8'));var config=require('../../config/environment');var jayson=require(_0xf263('0x9'));var client=jayson[_0xf263('0xa')]['http']({'port':0x232a});function respondWithRpcPromise(_0x4fded6,_0xa2b1b0,_0x9644ab){return new BPromise(function(_0xa2e77e,_0x16ff53){return client['request'](_0x4fded6,_0x9644ab)[_0xf263('0xb')](function(_0x26504c){logger[_0xf263('0xc')](_0xf263('0xd'),_0xa2b1b0,_0xf263('0xe'));logger[_0xf263('0xf')](_0xf263('0x10'),_0xa2b1b0,'request\x20sent',JSON[_0xf263('0x11')](_0x26504c));if(_0x26504c['error']){if(_0x26504c[_0xf263('0x12')]['code']===0x1f4){logger['error'](_0xf263('0xd'),_0xa2b1b0,_0x26504c[_0xf263('0x12')][_0xf263('0x13')]);return _0x16ff53(_0x26504c[_0xf263('0x12')][_0xf263('0x13')]);}logger[_0xf263('0x12')](_0xf263('0xd'),_0xa2b1b0,_0x26504c['error'][_0xf263('0x13')]);return _0xa2e77e(_0x26504c['error'][_0xf263('0x13')]);}else{logger[_0xf263('0xc')](_0xf263('0xd'),_0xa2b1b0,_0xf263('0xe'));_0xa2e77e(_0x26504c[_0xf263('0x14')][_0xf263('0x13')]);}})[_0xf263('0x15')](function(_0x57c655){logger['error'](_0xf263('0xd'),_0xa2b1b0,_0x57c655);_0x16ff53(_0x57c655);});});}exports[_0xf263('0x16')]=function(_0x325a84){var _0x2e660e=this;return new Promise(function(_0x1ea46b,_0x56bd2d){return db[_0xf263('0x17')]['create'](_0x325a84[_0xf263('0x18')],{'raw':_0x325a84[_0xf263('0x19')]?_0x325a84[_0xf263('0x19')]['raw']===undefined?!![]:![]:!![]})[_0xf263('0xb')](function(_0x169328){logger[_0xf263('0xc')]('CreateSquareDetailsReport',_0x325a84);logger[_0xf263('0xf')](_0xf263('0x16'),_0x325a84,JSON[_0xf263('0x11')](_0x169328));_0x1ea46b(_0x169328);})[_0xf263('0x15')](function(_0xa0695){logger[_0xf263('0x12')](_0xf263('0x16'),_0xa0695[_0xf263('0x13')],_0x325a84);_0x56bd2d(_0x2e660e[_0xf263('0x12')](0x1f4,_0xa0695[_0xf263('0x13')]));});});}; \ No newline at end of file +var _0xcf66=['body','options','raw','info','debug','lodash','util','moment','randomstring','ioredis','../../config/logger','rpc','jayson/promise','client','http','request','then','request\x20sent','SquareDetailsReport,\x20%s,\x20%s,\x20%s','stringify','error','SquareDetailsReport,\x20%s,\x20%s','message','result','catch','CreateSquareDetailsReport','SquareDetailsReport'];(function(_0x27c168,_0x448e81){var _0x13fa5d=function(_0x5d147e){while(--_0x5d147e){_0x27c168['push'](_0x27c168['shift']());}};_0x13fa5d(++_0x448e81);}(_0xcf66,0x71));var _0x6cf6=function(_0x52f0fa,_0x47f278){_0x52f0fa=_0x52f0fa-0x0;var _0x3ef1b3=_0xcf66[_0x52f0fa];return _0x3ef1b3;};'use strict';var _=require(_0x6cf6('0x0'));var util=require(_0x6cf6('0x1'));var moment=require(_0x6cf6('0x2'));var BPromise=require('bluebird');var rs=require(_0x6cf6('0x3'));var fs=require('fs');var Redis=require(_0x6cf6('0x4'));var db=require('../../mysqldb')['db'];var utils=require('../../config/utils');var logger=require(_0x6cf6('0x5'))(_0x6cf6('0x6'));var config=require('../../config/environment');var jayson=require(_0x6cf6('0x7'));var client=jayson[_0x6cf6('0x8')][_0x6cf6('0x9')]({'port':0x232a});function respondWithRpcPromise(_0x5eb082,_0x94c6a9,_0x308d0d){return new BPromise(function(_0x36b892,_0x748c93){return client[_0x6cf6('0xa')](_0x5eb082,_0x308d0d)[_0x6cf6('0xb')](function(_0x5b3827){logger['info']('SquareDetailsReport,\x20%s,\x20%s',_0x94c6a9,_0x6cf6('0xc'));logger['debug'](_0x6cf6('0xd'),_0x94c6a9,_0x6cf6('0xc'),JSON[_0x6cf6('0xe')](_0x5b3827));if(_0x5b3827[_0x6cf6('0xf')]){if(_0x5b3827['error']['code']===0x1f4){logger['error'](_0x6cf6('0x10'),_0x94c6a9,_0x5b3827[_0x6cf6('0xf')][_0x6cf6('0x11')]);return _0x748c93(_0x5b3827[_0x6cf6('0xf')][_0x6cf6('0x11')]);}logger[_0x6cf6('0xf')]('SquareDetailsReport,\x20%s,\x20%s',_0x94c6a9,_0x5b3827[_0x6cf6('0xf')]['message']);return _0x36b892(_0x5b3827[_0x6cf6('0xf')][_0x6cf6('0x11')]);}else{logger['info'](_0x6cf6('0x10'),_0x94c6a9,_0x6cf6('0xc'));_0x36b892(_0x5b3827[_0x6cf6('0x12')][_0x6cf6('0x11')]);}})[_0x6cf6('0x13')](function(_0x2bdb12){logger[_0x6cf6('0xf')](_0x6cf6('0x10'),_0x94c6a9,_0x2bdb12);_0x748c93(_0x2bdb12);});});}exports[_0x6cf6('0x14')]=function(_0x2ca2b1){var _0x5e8b11=this;return new Promise(function(_0x11d994,_0x22915c){return db[_0x6cf6('0x15')]['create'](_0x2ca2b1[_0x6cf6('0x16')],{'raw':_0x2ca2b1[_0x6cf6('0x17')]?_0x2ca2b1[_0x6cf6('0x17')][_0x6cf6('0x18')]===undefined?!![]:![]:!![]})[_0x6cf6('0xb')](function(_0x21e903){logger[_0x6cf6('0x19')]('CreateSquareDetailsReport',_0x2ca2b1);logger[_0x6cf6('0x1a')](_0x6cf6('0x14'),_0x2ca2b1,JSON[_0x6cf6('0xe')](_0x21e903));_0x11d994(_0x21e903);})[_0x6cf6('0x13')](function(_0x5cba3a){logger[_0x6cf6('0xf')](_0x6cf6('0x14'),_0x5cba3a[_0x6cf6('0x11')],_0x2ca2b1);_0x22915c(_0x5e8b11['error'](0x1f4,_0x5cba3a['message']));});});}; \ No newline at end of file diff --git a/server/api/system/index.js b/server/api/system/index.js index 1d30d21..4d4645b 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 _0x477f=['express','../../components/auth/service','get','index','killProcess','exports'];(function(_0x4966da,_0x30d5d4){var _0x19ebad=function(_0x1a5750){while(--_0x1a5750){_0x4966da['push'](_0x4966da['shift']());}};_0x19ebad(++_0x30d5d4);}(_0x477f,0x8a));var _0xf477=function(_0x323331,_0x31b0aa){_0x323331=_0x323331-0x0;var _0x1b6d86=_0x477f[_0x323331];return _0x1b6d86;};'use strict';var express=require(_0xf477('0x0'));var router=express['Router']();var auth=require(_0xf477('0x1'));var controller=require('./system.controller');router[_0xf477('0x2')]('/',auth['isAuthenticated'](),controller[_0xf477('0x3')]);router[_0xf477('0x2')]('/process/:pid/kill',auth['isAuthenticated'](),controller[_0xf477('0x4')]);module[_0xf477('0x5')]=router; \ No newline at end of file +var _0x50a8=['get','isAuthenticated','index','exports','../../components/auth/service','./system.controller'];(function(_0x3b81d7,_0x3f0025){var _0x5854e9=function(_0x406742){while(--_0x406742){_0x3b81d7['push'](_0x3b81d7['shift']());}};_0x5854e9(++_0x3f0025);}(_0x50a8,0x196));var _0x850a=function(_0x40e609,_0x4e4b74){_0x40e609=_0x40e609-0x0;var _0xf46928=_0x50a8[_0x40e609];return _0xf46928;};'use strict';var express=require('express');var router=express['Router']();var auth=require(_0x850a('0x0'));var controller=require(_0x850a('0x1'));router[_0x850a('0x2')]('/',auth[_0x850a('0x3')](),controller[_0x850a('0x4')]);router['get']('/process/:pid/kill',auth['isAuthenticated'](),controller['killProcess']);module[_0x850a('0x5')]=router; \ No newline at end of file diff --git a/server/api/system/system.controller.js b/server/api/system/system.controller.js index 69f8e49..85908a2 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 _0x5233=['indexOf','kill','SIGINT','child_process','exec','../../config/logger','util','bluebird','lodash','error','<%-\x20name\x20%>,\x20%s,\x20%s,\x20%s','name','send','index','getAllData','then','status','json','catch','killProcess','format','ps\x20-p\x20%s\x20-ww\x20-o\x20args','params','pid','split','length'];(function(_0x585ea3,_0x1cd2f6){var _0x29f9de=function(_0x5d30dc){while(--_0x5d30dc){_0x585ea3['push'](_0x585ea3['shift']());}};_0x29f9de(++_0x1cd2f6);}(_0x5233,0x1f1));var _0x3523=function(_0x4bb631,_0x385394){_0x4bb631=_0x4bb631-0x0;var _0x27a8f6=_0x5233[_0x4bb631];return _0x27a8f6;};'use strict';var info=require('systeminformation');var exec=require(_0x3523('0x0'))[_0x3523('0x1')];var logger=require(_0x3523('0x2'))('api');var util=require(_0x3523('0x3'));var BPromise=require(_0x3523('0x4'));var _=require(_0x3523('0x5'));function handleError(_0x274ae8,_0x3c64f3,_0x27b849){_0x3c64f3=_0x3c64f3||0x1f4;return function(_0x5d407d){logger[_0x3523('0x6')](_0x3523('0x7'),_0x27b849,_0x3c64f3,util['inspect'](_0x5d407d,{'showHidden':![],'depth':null}));delete _0x5d407d[_0x3523('0x8')];_0x274ae8['status'](_0x3c64f3)[_0x3523('0x9')](_0x5d407d);};}exports[_0x3523('0xa')]=function(_0x43ffd1,_0x20b4ca){return info[_0x3523('0xb')]()[_0x3523('0xc')](function(_0x467b94){return _0x20b4ca[_0x3523('0xd')](0xc8)[_0x3523('0xe')](_0x467b94);})[_0x3523('0xf')](function(_0x509609){return _0x20b4ca[_0x3523('0xd')](0x1f4)[_0x3523('0xe')](_0x509609);});};exports[_0x3523('0x10')]=function(_0x2f0baf,_0x4e5b11){var _0x4bdb77=['components/import/cm'];return new BPromise(function(_0x349a5d,_0x4facbf){return exec(util[_0x3523('0x11')](_0x3523('0x12'),_0x2f0baf[_0x3523('0x13')][_0x3523('0x14')]),function(_0x5061f8,_0x39fc2f,_0x14d3f4){if(_0x5061f8){return _0x4facbf(_0x5061f8);}return _0x349a5d(_0x39fc2f);});})[_0x3523('0xc')](function(_0x19afb7){var _0x4bc51e=![];var _0x334a10=_0x19afb7[_0x3523('0x15')](/\n/);for(var _0x39aa86=0x0,_0x543f21=_0x4bdb77[_0x3523('0x16')];_0x39aa86<_0x543f21,_0x4bc51e===![];_0x39aa86+=0x1){if(_0x19afb7[_0x3523('0x17')](_0x4bdb77[_0x39aa86])>=0x0){_0x4bc51e=!![];}}if(!_0x4bc51e){throw new Error(util[_0x3523('0x11')]('Process\x20with\x20pid\x20%s\x20not\x20found!',_0x2f0baf[_0x3523('0x13')]['pid']));}process[_0x3523('0x18')](_0x2f0baf[_0x3523('0x13')][_0x3523('0x14')],_0x3523('0x19'));return _0x4e5b11['status'](0xc8)[_0x3523('0xe')]({'message':util[_0x3523('0x11')]('Process\x20with\x20pid\x20%s\x20killed\x20correctly',_0x2f0baf[_0x3523('0x13')][_0x3523('0x14')])});})[_0x3523('0xf')](handleError(_0x4e5b11,null,_0x3523('0x10')));}; \ No newline at end of file +var _0x3525=['split','length','Process\x20with\x20pid\x20%s\x20not\x20found!','pid','kill','SIGINT','child_process','exec','../../config/logger','api','util','bluebird','lodash','error','<%-\x20name\x20%>,\x20%s,\x20%s,\x20%s','inspect','status','getAllData','json','components/import/cm','format','ps\x20-p\x20%s\x20-ww\x20-o\x20args','params','then'];(function(_0x33685b,_0x5029a9){var _0x3ff1c3=function(_0x163e9a){while(--_0x163e9a){_0x33685b['push'](_0x33685b['shift']());}};_0x3ff1c3(++_0x5029a9);}(_0x3525,0xde));var _0x5352=function(_0xfed62e,_0x5dd5d2){_0xfed62e=_0xfed62e-0x0;var _0x2f4d72=_0x3525[_0xfed62e];return _0x2f4d72;};'use strict';var info=require('systeminformation');var exec=require(_0x5352('0x0'))[_0x5352('0x1')];var logger=require(_0x5352('0x2'))(_0x5352('0x3'));var util=require(_0x5352('0x4'));var BPromise=require(_0x5352('0x5'));var _=require(_0x5352('0x6'));function handleError(_0x27ea39,_0x15b416,_0x3a43b2){_0x15b416=_0x15b416||0x1f4;return function(_0x35b2ff){logger[_0x5352('0x7')](_0x5352('0x8'),_0x3a43b2,_0x15b416,util[_0x5352('0x9')](_0x35b2ff,{'showHidden':![],'depth':null}));delete _0x35b2ff['name'];_0x27ea39[_0x5352('0xa')](_0x15b416)['send'](_0x35b2ff);};}exports['index']=function(_0xa0240f,_0x49d436){return info[_0x5352('0xb')]()['then'](function(_0x4eb15d){return _0x49d436['status'](0xc8)[_0x5352('0xc')](_0x4eb15d);})['catch'](function(_0x563a8d){return _0x49d436['status'](0x1f4)['json'](_0x563a8d);});};exports['killProcess']=function(_0x43ff90,_0x10f8a4){var _0x381a12=[_0x5352('0xd')];return new BPromise(function(_0x34914d,_0x2b7cf1){return exec(util[_0x5352('0xe')](_0x5352('0xf'),_0x43ff90[_0x5352('0x10')]['pid']),function(_0x1ed58c,_0x31edec,_0x1ad0cc){if(_0x1ed58c){return _0x2b7cf1(_0x1ed58c);}return _0x34914d(_0x31edec);});})[_0x5352('0x11')](function(_0x518097){var _0x2bb911=![];var _0x5b740c=_0x518097[_0x5352('0x12')](/\n/);for(var _0x14ebfd=0x0,_0x1d5fd2=_0x381a12[_0x5352('0x13')];_0x14ebfd<_0x1d5fd2,_0x2bb911===![];_0x14ebfd+=0x1){if(_0x518097['indexOf'](_0x381a12[_0x14ebfd])>=0x0){_0x2bb911=!![];}}if(!_0x2bb911){throw new Error(util[_0x5352('0xe')](_0x5352('0x14'),_0x43ff90['params'][_0x5352('0x15')]));}process[_0x5352('0x16')](_0x43ff90[_0x5352('0x10')]['pid'],_0x5352('0x17'));return _0x10f8a4[_0x5352('0xa')](0xc8)[_0x5352('0xc')]({'message':util['format']('Process\x20with\x20pid\x20%s\x20killed\x20correctly',_0x43ff90[_0x5352('0x10')][_0x5352('0x15')])});})['catch'](handleError(_0x10f8a4,null,'killProcess'));}; \ No newline at end of file diff --git a/server/api/tag/index.js b/server/api/tag/index.js index 7dbc920..84eb567 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 _0xedd9=['util','path','connect-timeout','express','Router','fs-extra','../../components/auth/service','../../components/interaction/service','./tag.controller','get','isAuthenticated','index','/describe','describe','/:id','post','create','put','update','destroy','exports'];(function(_0x259153,_0x4ff2aa){var _0x4dfa06=function(_0x2c9441){while(--_0x2c9441){_0x259153['push'](_0x259153['shift']());}};_0x4dfa06(++_0x4ff2aa);}(_0xedd9,0xfc));var _0x9edd=function(_0x73c56a,_0x13c60a){_0x73c56a=_0x73c56a-0x0;var _0x3ae916=_0xedd9[_0x73c56a];return _0x3ae916;};'use strict';var multer=require('multer');var util=require(_0x9edd('0x0'));var path=require(_0x9edd('0x1'));var timeout=require(_0x9edd('0x2'));var express=require(_0x9edd('0x3'));var router=express[_0x9edd('0x4')]();var fs_extra=require(_0x9edd('0x5'));var auth=require(_0x9edd('0x6'));var interaction=require(_0x9edd('0x7'));var config=require('../../config/environment');var controller=require(_0x9edd('0x8'));router[_0x9edd('0x9')]('/',auth[_0x9edd('0xa')](),controller[_0x9edd('0xb')]);router['get'](_0x9edd('0xc'),auth['isAuthenticated'](),controller[_0x9edd('0xd')]);router[_0x9edd('0x9')](_0x9edd('0xe'),auth[_0x9edd('0xa')](),controller['show']);router[_0x9edd('0xf')]('/',auth['isAuthenticated'](),controller[_0x9edd('0x10')]);router[_0x9edd('0x11')]('/:id',auth[_0x9edd('0xa')](),controller[_0x9edd('0x12')]);router['delete'](_0x9edd('0xe'),auth[_0x9edd('0xa')](),controller[_0x9edd('0x13')]);module[_0x9edd('0x14')]=router; \ No newline at end of file +var _0x55e0=['./tag.controller','get','isAuthenticated','describe','/:id','post','create','put','delete','destroy','exports','multer','util','path','connect-timeout','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment'];(function(_0x20f5b7,_0x179f65){var _0x281db2=function(_0x5007ec){while(--_0x5007ec){_0x20f5b7['push'](_0x20f5b7['shift']());}};_0x281db2(++_0x179f65);}(_0x55e0,0xdc));var _0x055e=function(_0x4f72ad,_0x4274d4){_0x4f72ad=_0x4f72ad-0x0;var _0x2347b3=_0x55e0[_0x4f72ad];return _0x2347b3;};'use strict';var multer=require(_0x055e('0x0'));var util=require(_0x055e('0x1'));var path=require(_0x055e('0x2'));var timeout=require(_0x055e('0x3'));var express=require('express');var router=express['Router']();var fs_extra=require(_0x055e('0x4'));var auth=require(_0x055e('0x5'));var interaction=require(_0x055e('0x6'));var config=require(_0x055e('0x7'));var controller=require(_0x055e('0x8'));router[_0x055e('0x9')]('/',auth['isAuthenticated'](),controller['index']);router[_0x055e('0x9')]('/describe',auth[_0x055e('0xa')](),controller[_0x055e('0xb')]);router[_0x055e('0x9')](_0x055e('0xc'),auth[_0x055e('0xa')](),controller['show']);router[_0x055e('0xd')]('/',auth[_0x055e('0xa')](),controller[_0x055e('0xe')]);router[_0x055e('0xf')](_0x055e('0xc'),auth['isAuthenticated'](),controller['update']);router[_0x055e('0x10')]('/:id',auth[_0x055e('0xa')](),controller[_0x055e('0x11')]);module[_0x055e('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 1476b0a..692e589 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 _0xa7b5=['STRING','name','sequelize','exports'];(function(_0x1b3a5c,_0x2f9d5f){var _0x2ae8cb=function(_0x549ab8){while(--_0x549ab8){_0x1b3a5c['push'](_0x1b3a5c['shift']());}};_0x2ae8cb(++_0x2f9d5f);}(_0xa7b5,0x162));var _0x5a7b=function(_0xbaa4bb,_0x43c244){_0xbaa4bb=_0xbaa4bb-0x0;var _0x3871b0=_0xa7b5[_0xbaa4bb];return _0x3871b0;};'use strict';var Sequelize=require(_0x5a7b('0x0'));module[_0x5a7b('0x1')]={'name':{'type':Sequelize[_0x5a7b('0x2')],'unique':_0x5a7b('0x3'),'allowNull':![],'validate':{'is':/[A-Za-z0-9._\\+*!-]+/,'notEmpty':!![]}},'color':{'type':Sequelize[_0x5a7b('0x2')],'defaultValue':'#0091EA'},'description':{'type':Sequelize[_0x5a7b('0x2')]}}; \ No newline at end of file +var _0x96f9=['sequelize','exports','STRING','name','#0091EA'];(function(_0x565fed,_0xb85768){var _0x3e018f=function(_0x104d8e){while(--_0x104d8e){_0x565fed['push'](_0x565fed['shift']());}};_0x3e018f(++_0xb85768);}(_0x96f9,0x64));var _0x996f=function(_0x17d9e3,_0x1f969c){_0x17d9e3=_0x17d9e3-0x0;var _0x14192d=_0x96f9[_0x17d9e3];return _0x14192d;};'use strict';var Sequelize=require(_0x996f('0x0'));module[_0x996f('0x1')]={'name':{'type':Sequelize[_0x996f('0x2')],'unique':_0x996f('0x3'),'allowNull':![],'validate':{'is':/[A-Za-z0-9._\\+*!-]+/,'notEmpty':!![]}},'color':{'type':Sequelize[_0x996f('0x2')],'defaultValue':_0x996f('0x4')},'description':{'type':Sequelize[_0x996f('0x2')]}}; \ No newline at end of file diff --git a/server/api/tag/tag.controller.js b/server/api/tag/tag.controller.js index 7a9cc59..9b173a5 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 _0x5a0f=['includeAll','findAll','rows','params','options','catch','create','body','get','Unable\x20to\x20retrieve\x20the\x20current\x20user','role','user','find','autoAssociation','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','describe','eml-format','zip-dir','fast-json-patch','mustache','util','sox','to-csv','ejs','fs-extra','lodash','squel','crypto','desk.js','papaparse','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/environment','../../config/license/util','sendStatus','end','json','offset','undefined','limit','count','status','set','reject','save','destroy','then','Tags','UserProfileResource','error','stack','name','send','index','Tag','rawAttributes','fieldName','type','model','query','keys','filters','intersection','fields','attributes','hasOwnProperty','nolimit','sort','where','filter','merge','map','VIRTUAL'];(function(_0x1da897,_0x17aedb){var _0x580d06=function(_0x12fcfb){while(--_0x12fcfb){_0x1da897['push'](_0x1da897['shift']());}};_0x580d06(++_0x17aedb);}(_0x5a0f,0x1e4));var _0xf5a0=function(_0xe84d19,_0x5eee93){_0xe84d19=_0xe84d19-0x0;var _0x5b3bf5=_0x5a0f[_0xe84d19];return _0x5b3bf5;};'use strict';var emlformat=require(_0xf5a0('0x0'));var rimraf=require('rimraf');var zipdir=require(_0xf5a0('0x1'));var jsonpatch=require(_0xf5a0('0x2'));var rp=require('request-promise');var moment=require('moment');var BPromise=require('bluebird');var Mustache=require(_0xf5a0('0x3'));var util=require(_0xf5a0('0x4'));var path=require('path');var sox=require(_0xf5a0('0x5'));var csv=require(_0xf5a0('0x6'));var ejs=require(_0xf5a0('0x7'));var fs=require('fs');var fs_extra=require(_0xf5a0('0x8'));var _=require(_0xf5a0('0x9'));var squel=require(_0xf5a0('0xa'));var crypto=require(_0xf5a0('0xb'));var jsforce=require('jsforce');var deskjs=require(_0xf5a0('0xc'));var toCsv=require('to-csv');var querystring=require('querystring');var Papa=require(_0xf5a0('0xd'));var Redis=require('ioredis');var authService=require(_0xf5a0('0xe'));var qs=require(_0xf5a0('0xf'));var as=require(_0xf5a0('0x10'));var hardwareService=require(_0xf5a0('0x11'));var logger=require(_0xf5a0('0x12'))(_0xf5a0('0x13'));var utils=require(_0xf5a0('0x14'));var config=require(_0xf5a0('0x15'));var licenseUtil=require(_0xf5a0('0x16'));var db=require('../../mysqldb')['db'];function respondWithStatusCode(_0x348839,_0x14c076){_0x14c076=_0x14c076||0xcc;return function(_0x37041b){if(_0x37041b){return _0x348839[_0xf5a0('0x17')](_0x14c076);}return _0x348839['status'](_0x14c076)[_0xf5a0('0x18')]();};}function respondWithResult(_0x47c8a1,_0x82ef8e){_0x82ef8e=_0x82ef8e||0xc8;return function(_0x19ed3f){if(_0x19ed3f){return _0x47c8a1['status'](_0x82ef8e)[_0xf5a0('0x19')](_0x19ed3f);}};}function respondWithFilteredResult(_0xbd6e0b,_0x18cd94){return function(_0x583c54){if(_0x583c54){var _0x14e2a4=typeof _0x18cd94[_0xf5a0('0x1a')]===_0xf5a0('0x1b')&&typeof _0x18cd94[_0xf5a0('0x1c')]===_0xf5a0('0x1b');var _0x4c0962=_0x583c54[_0xf5a0('0x1d')];var _0x13fd37=_0x14e2a4?0x0:_0x18cd94[_0xf5a0('0x1a')];var _0x3d74a7=_0x14e2a4?_0x583c54[_0xf5a0('0x1d')]:_0x18cd94[_0xf5a0('0x1a')]+_0x18cd94['limit'];var _0x46a781;if(_0x3d74a7>=_0x4c0962){_0x3d74a7=_0x4c0962;_0x46a781=0xc8;}else{_0x46a781=0xce;}_0xbd6e0b[_0xf5a0('0x1e')](_0x46a781);return _0xbd6e0b[_0xf5a0('0x1f')]('Content-Range',_0x13fd37+'-'+_0x3d74a7+'/'+_0x4c0962)[_0xf5a0('0x19')](_0x583c54);}return null;};}function patchUpdates(_0x33ebfa){return function(_0x33f51a){try{jsonpatch['apply'](_0x33f51a,_0x33ebfa,!![]);}catch(_0x12fe40){return BPromise[_0xf5a0('0x20')](_0x12fe40);}return _0x33f51a[_0xf5a0('0x21')]();};}function saveUpdates(_0x6f2e29,_0x304545){return function(_0x1f4d82){if(_0x1f4d82){return _0x1f4d82['update'](_0x6f2e29)['then'](function(_0x555943){return _0x555943;});}return null;};}function removeEntity(_0x1a3389,_0x4af9d1){return function(_0xf3a785){if(_0xf3a785){return _0xf3a785[_0xf5a0('0x22')]()[_0xf5a0('0x23')](function(){var _0x56a70b=_0xf3a785['get']({'plain':!![]});var _0x4ab974=_0xf5a0('0x24');return db[_0xf5a0('0x25')][_0xf5a0('0x22')]({'where':{'type':_0x4ab974,'resourceId':_0x56a70b['id']}})['then'](function(){return _0xf3a785;});})['then'](function(){_0x1a3389[_0xf5a0('0x1e')](0xcc)[_0xf5a0('0x18')]();});}};}function handleEntityNotFound(_0x967565,_0x234901){return function(_0x9dc7a8){if(!_0x9dc7a8){_0x967565[_0xf5a0('0x17')](0x194);}return _0x9dc7a8;};}function handleError(_0x589d65,_0x50b12e){_0x50b12e=_0x50b12e||0x1f4;return function(_0x47103d){logger[_0xf5a0('0x26')](_0x47103d[_0xf5a0('0x27')]);if(_0x47103d['name']){delete _0x47103d[_0xf5a0('0x28')];}_0x589d65[_0xf5a0('0x1e')](_0x50b12e)[_0xf5a0('0x29')](_0x47103d);};}exports[_0xf5a0('0x2a')]=function(_0x50ce08,_0x21c164){var _0x5427d0={},_0x1c799a={},_0x219177={'count':0x0,'rows':[]};var _0x43cdc6=_['map'](db[_0xf5a0('0x2b')][_0xf5a0('0x2c')],function(_0x2e1d50){return{'name':_0x2e1d50[_0xf5a0('0x2d')],'type':_0x2e1d50[_0xf5a0('0x2e')]['key']};});_0x1c799a[_0xf5a0('0x2f')]=_['map'](_0x43cdc6,_0xf5a0('0x28'));_0x1c799a[_0xf5a0('0x30')]=_[_0xf5a0('0x31')](_0x50ce08[_0xf5a0('0x30')]);_0x1c799a[_0xf5a0('0x32')]=_[_0xf5a0('0x33')](_0x1c799a['model'],_0x1c799a[_0xf5a0('0x30')]);_0x5427d0['attributes']=_['intersection'](_0x1c799a[_0xf5a0('0x2f')],qs[_0xf5a0('0x34')](_0x50ce08[_0xf5a0('0x30')][_0xf5a0('0x34')]));_0x5427d0[_0xf5a0('0x35')]=_0x5427d0[_0xf5a0('0x35')]['length']?_0x5427d0[_0xf5a0('0x35')]:_0x1c799a[_0xf5a0('0x2f')];if(!_0x50ce08[_0xf5a0('0x30')][_0xf5a0('0x36')](_0xf5a0('0x37'))){_0x5427d0[_0xf5a0('0x1c')]=qs['limit'](_0x50ce08[_0xf5a0('0x30')][_0xf5a0('0x1c')]);_0x5427d0[_0xf5a0('0x1a')]=qs[_0xf5a0('0x1a')](_0x50ce08[_0xf5a0('0x30')][_0xf5a0('0x1a')]);}_0x5427d0['order']=qs['sort'](_0x50ce08['query'][_0xf5a0('0x38')]);_0x5427d0[_0xf5a0('0x39')]=qs[_0xf5a0('0x32')](_['pick'](_0x50ce08['query'],_0x1c799a['filters']),_0x43cdc6);if(_0x50ce08[_0xf5a0('0x30')][_0xf5a0('0x3a')]){_0x5427d0[_0xf5a0('0x39')]=_[_0xf5a0('0x3b')](_0x5427d0[_0xf5a0('0x39')],{'$or':_[_0xf5a0('0x3c')](_0x43cdc6,function(_0x1c24c3){if(_0x1c24c3['type']!==_0xf5a0('0x3d')){var _0x4008eb={};_0x4008eb[_0x1c24c3[_0xf5a0('0x28')]]={'$like':'%'+_0x50ce08[_0xf5a0('0x30')][_0xf5a0('0x3a')]+'%'};return _0x4008eb;}})});}_0x5427d0=_[_0xf5a0('0x3b')]({},_0x5427d0,_0x50ce08['options']);var _0x2acaa2={'where':_0x5427d0[_0xf5a0('0x39')]};return db[_0xf5a0('0x2b')]['count'](_0x2acaa2)[_0xf5a0('0x23')](function(_0x139118){_0x219177[_0xf5a0('0x1d')]=_0x139118;if(_0x50ce08['query'][_0xf5a0('0x3e')]){_0x5427d0['include']=[{'all':!![]}];}return db[_0xf5a0('0x2b')][_0xf5a0('0x3f')](_0x5427d0);})[_0xf5a0('0x23')](function(_0x10b366){_0x219177[_0xf5a0('0x40')]=_0x10b366;return _0x219177;})[_0xf5a0('0x23')](respondWithFilteredResult(_0x21c164,_0x5427d0))['catch'](handleError(_0x21c164,null));};exports['show']=function(_0x22a861,_0x2050a3){var _0x43d345={'raw':!![],'where':{'id':_0x22a861[_0xf5a0('0x41')]['id']}},_0x478276={};_0x478276[_0xf5a0('0x2f')]=_[_0xf5a0('0x31')](db[_0xf5a0('0x2b')][_0xf5a0('0x2c')]);_0x478276[_0xf5a0('0x30')]=_[_0xf5a0('0x31')](_0x22a861[_0xf5a0('0x30')]);_0x478276[_0xf5a0('0x32')]=_[_0xf5a0('0x33')](_0x478276[_0xf5a0('0x2f')],_0x478276['query']);_0x43d345['attributes']=_[_0xf5a0('0x33')](_0x478276[_0xf5a0('0x2f')],qs[_0xf5a0('0x34')](_0x22a861[_0xf5a0('0x30')][_0xf5a0('0x34')]));_0x43d345[_0xf5a0('0x35')]=_0x43d345['attributes']['length']?_0x43d345[_0xf5a0('0x35')]:_0x478276[_0xf5a0('0x2f')];if(_0x22a861[_0xf5a0('0x30')][_0xf5a0('0x3e')]){_0x43d345['include']=[{'all':!![]}];}_0x43d345=_[_0xf5a0('0x3b')]({},_0x43d345,_0x22a861[_0xf5a0('0x42')]);return db[_0xf5a0('0x2b')]['find'](_0x43d345)[_0xf5a0('0x23')](handleEntityNotFound(_0x2050a3,null))[_0xf5a0('0x23')](respondWithResult(_0x2050a3,null))[_0xf5a0('0x43')](handleError(_0x2050a3,null));};exports[_0xf5a0('0x44')]=function(_0x1449b0,_0x3b8822){return db[_0xf5a0('0x2b')][_0xf5a0('0x44')](_0x1449b0[_0xf5a0('0x45')],{})['then'](function(_0x33b4da){var _0x4ac4f0=_0x1449b0['user'][_0xf5a0('0x46')]({'plain':!![]});if(!_0x4ac4f0)throw new Error(_0xf5a0('0x47'));if(_0x4ac4f0[_0xf5a0('0x48')]===_0xf5a0('0x49')){var _0x41a82b=_0x33b4da[_0xf5a0('0x46')]({'plain':!![]});var _0x1b8938=_0xf5a0('0x24');return db['UserProfileSection'][_0xf5a0('0x4a')]({'where':{'name':_0x1b8938,'userProfileId':_0x4ac4f0['userProfileId']},'raw':!![]})[_0xf5a0('0x23')](function(_0x4e3c58){if(_0x4e3c58&&_0x4e3c58[_0xf5a0('0x4b')]===0x0){return db[_0xf5a0('0x25')]['create']({'name':_0x41a82b[_0xf5a0('0x28')],'resourceId':_0x41a82b['id'],'type':_0x4e3c58[_0xf5a0('0x28')],'sectionId':_0x4e3c58['id']},{})[_0xf5a0('0x23')](function(){return _0x33b4da;});}else{return _0x33b4da;}})[_0xf5a0('0x43')](function(_0x2f21de){logger[_0xf5a0('0x26')](_0xf5a0('0x4c'),_0x2f21de);throw _0x2f21de;});}return _0x33b4da;})[_0xf5a0('0x23')](respondWithResult(_0x3b8822,0xc9))['catch'](handleError(_0x3b8822,null));};exports['update']=function(_0x49e7a8,_0x55bc9d){if(_0x49e7a8['body']['id']){delete _0x49e7a8['body']['id'];}return db['Tag'][_0xf5a0('0x4a')]({'where':{'id':_0x49e7a8['params']['id']}})[_0xf5a0('0x23')](handleEntityNotFound(_0x55bc9d,null))[_0xf5a0('0x23')](saveUpdates(_0x49e7a8[_0xf5a0('0x45')],null))[_0xf5a0('0x23')](respondWithResult(_0x55bc9d,null))[_0xf5a0('0x43')](handleError(_0x55bc9d,null));};exports[_0xf5a0('0x22')]=function(_0x56f83c,_0x6dfc6f){return db[_0xf5a0('0x2b')]['find']({'where':{'id':_0x56f83c[_0xf5a0('0x41')]['id']}})[_0xf5a0('0x23')](handleEntityNotFound(_0x6dfc6f,null))[_0xf5a0('0x23')](removeEntity(_0x6dfc6f,null))[_0xf5a0('0x43')](handleError(_0x6dfc6f,null));};exports[_0xf5a0('0x4d')]=function(_0x19e82d,_0x3bee6d){return db['Tag'][_0xf5a0('0x4d')]()[_0xf5a0('0x23')](respondWithResult(_0x3bee6d,null))[_0xf5a0('0x43')](handleError(_0x3bee6d,null));}; \ No newline at end of file +var _0x2560=['request-promise','moment','bluebird','util','sox','to-csv','ejs','fs-extra','lodash','squel','jsforce','desk.js','papaparse','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/logger','api','../../config/environment','../../config/license/util','sendStatus','status','end','json','offset','undefined','count','set','Content-Range','apply','reject','then','destroy','get','Tags','UserProfileResource','error','name','index','Tag','rawAttributes','fieldName','type','key','model','map','query','keys','filters','intersection','fields','attributes','length','hasOwnProperty','nolimit','order','sort','where','pick','merge','options','include','rows','catch','show','params','includeAll','find','create','body','user','Unable\x20to\x20retrieve\x20the\x20current\x20user','role','UserProfileSection','autoAssociation','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','update','describe','rimraf','zip-dir','fast-json-patch'];(function(_0x308e34,_0x20e557){var _0x9677b6=function(_0x596214){while(--_0x596214){_0x308e34['push'](_0x308e34['shift']());}};_0x9677b6(++_0x20e557);}(_0x2560,0xf0));var _0x0256=function(_0x5ac2e0,_0x4cdf21){_0x5ac2e0=_0x5ac2e0-0x0;var _0x23965b=_0x2560[_0x5ac2e0];return _0x23965b;};'use strict';var emlformat=require('eml-format');var rimraf=require(_0x0256('0x0'));var zipdir=require(_0x0256('0x1'));var jsonpatch=require(_0x0256('0x2'));var rp=require(_0x0256('0x3'));var moment=require(_0x0256('0x4'));var BPromise=require(_0x0256('0x5'));var Mustache=require('mustache');var util=require(_0x0256('0x6'));var path=require('path');var sox=require(_0x0256('0x7'));var csv=require(_0x0256('0x8'));var ejs=require(_0x0256('0x9'));var fs=require('fs');var fs_extra=require(_0x0256('0xa'));var _=require(_0x0256('0xb'));var squel=require(_0x0256('0xc'));var crypto=require('crypto');var jsforce=require(_0x0256('0xd'));var deskjs=require(_0x0256('0xe'));var toCsv=require(_0x0256('0x8'));var querystring=require('querystring');var Papa=require(_0x0256('0xf'));var Redis=require('ioredis');var authService=require(_0x0256('0x10'));var qs=require(_0x0256('0x11'));var as=require(_0x0256('0x12'));var hardwareService=require('../../config/license/hardware');var logger=require(_0x0256('0x13'))(_0x0256('0x14'));var utils=require('../../config/utils');var config=require(_0x0256('0x15'));var licenseUtil=require(_0x0256('0x16'));var db=require('../../mysqldb')['db'];function respondWithStatusCode(_0x3fea7f,_0x4173c9){_0x4173c9=_0x4173c9||0xcc;return function(_0x186695){if(_0x186695){return _0x3fea7f[_0x0256('0x17')](_0x4173c9);}return _0x3fea7f[_0x0256('0x18')](_0x4173c9)[_0x0256('0x19')]();};}function respondWithResult(_0x536912,_0x11b3f7){_0x11b3f7=_0x11b3f7||0xc8;return function(_0x55db70){if(_0x55db70){return _0x536912['status'](_0x11b3f7)[_0x0256('0x1a')](_0x55db70);}};}function respondWithFilteredResult(_0x1d034e,_0x35d795){return function(_0x158ed2){if(_0x158ed2){var _0x5bcf4a=typeof _0x35d795[_0x0256('0x1b')]===_0x0256('0x1c')&&typeof _0x35d795['limit']===_0x0256('0x1c');var _0x3537c0=_0x158ed2[_0x0256('0x1d')];var _0x123752=_0x5bcf4a?0x0:_0x35d795[_0x0256('0x1b')];var _0x4575f3=_0x5bcf4a?_0x158ed2[_0x0256('0x1d')]:_0x35d795[_0x0256('0x1b')]+_0x35d795['limit'];var _0x1b4157;if(_0x4575f3>=_0x3537c0){_0x4575f3=_0x3537c0;_0x1b4157=0xc8;}else{_0x1b4157=0xce;}_0x1d034e[_0x0256('0x18')](_0x1b4157);return _0x1d034e[_0x0256('0x1e')](_0x0256('0x1f'),_0x123752+'-'+_0x4575f3+'/'+_0x3537c0)[_0x0256('0x1a')](_0x158ed2);}return null;};}function patchUpdates(_0x356d41){return function(_0x19644c){try{jsonpatch[_0x0256('0x20')](_0x19644c,_0x356d41,!![]);}catch(_0x3bdb0d){return BPromise[_0x0256('0x21')](_0x3bdb0d);}return _0x19644c['save']();};}function saveUpdates(_0x3342a3,_0x3d736d){return function(_0x220ffc){if(_0x220ffc){return _0x220ffc['update'](_0x3342a3)[_0x0256('0x22')](function(_0x107e4c){return _0x107e4c;});}return null;};}function removeEntity(_0x50666f,_0x449ef2){return function(_0x283a8b){if(_0x283a8b){return _0x283a8b[_0x0256('0x23')]()[_0x0256('0x22')](function(){var _0x55f855=_0x283a8b[_0x0256('0x24')]({'plain':!![]});var _0x1bba77=_0x0256('0x25');return db[_0x0256('0x26')][_0x0256('0x23')]({'where':{'type':_0x1bba77,'resourceId':_0x55f855['id']}})[_0x0256('0x22')](function(){return _0x283a8b;});})['then'](function(){_0x50666f[_0x0256('0x18')](0xcc)[_0x0256('0x19')]();});}};}function handleEntityNotFound(_0x5c417a,_0xf42360){return function(_0x4f2b4b){if(!_0x4f2b4b){_0x5c417a[_0x0256('0x17')](0x194);}return _0x4f2b4b;};}function handleError(_0x8a02e0,_0x3232cd){_0x3232cd=_0x3232cd||0x1f4;return function(_0x304c9c){logger[_0x0256('0x27')](_0x304c9c['stack']);if(_0x304c9c[_0x0256('0x28')]){delete _0x304c9c[_0x0256('0x28')];}_0x8a02e0[_0x0256('0x18')](_0x3232cd)['send'](_0x304c9c);};}exports[_0x0256('0x29')]=function(_0x50b7c6,_0x11add5){var _0x4b3a46={},_0xb5c554={},_0xa2cec0={'count':0x0,'rows':[]};var _0x48edba=_['map'](db[_0x0256('0x2a')][_0x0256('0x2b')],function(_0x3d200e){return{'name':_0x3d200e[_0x0256('0x2c')],'type':_0x3d200e[_0x0256('0x2d')][_0x0256('0x2e')]};});_0xb5c554[_0x0256('0x2f')]=_[_0x0256('0x30')](_0x48edba,_0x0256('0x28'));_0xb5c554[_0x0256('0x31')]=_[_0x0256('0x32')](_0x50b7c6[_0x0256('0x31')]);_0xb5c554[_0x0256('0x33')]=_[_0x0256('0x34')](_0xb5c554[_0x0256('0x2f')],_0xb5c554[_0x0256('0x31')]);_0x4b3a46['attributes']=_['intersection'](_0xb5c554['model'],qs[_0x0256('0x35')](_0x50b7c6[_0x0256('0x31')][_0x0256('0x35')]));_0x4b3a46[_0x0256('0x36')]=_0x4b3a46[_0x0256('0x36')][_0x0256('0x37')]?_0x4b3a46[_0x0256('0x36')]:_0xb5c554[_0x0256('0x2f')];if(!_0x50b7c6[_0x0256('0x31')][_0x0256('0x38')](_0x0256('0x39'))){_0x4b3a46['limit']=qs['limit'](_0x50b7c6[_0x0256('0x31')]['limit']);_0x4b3a46[_0x0256('0x1b')]=qs[_0x0256('0x1b')](_0x50b7c6['query'][_0x0256('0x1b')]);}_0x4b3a46[_0x0256('0x3a')]=qs[_0x0256('0x3b')](_0x50b7c6[_0x0256('0x31')][_0x0256('0x3b')]);_0x4b3a46[_0x0256('0x3c')]=qs[_0x0256('0x33')](_[_0x0256('0x3d')](_0x50b7c6[_0x0256('0x31')],_0xb5c554[_0x0256('0x33')]),_0x48edba);if(_0x50b7c6[_0x0256('0x31')]['filter']){_0x4b3a46[_0x0256('0x3c')]=_[_0x0256('0x3e')](_0x4b3a46['where'],{'$or':_['map'](_0x48edba,function(_0x4da505){if(_0x4da505[_0x0256('0x2d')]!=='VIRTUAL'){var _0x579922={};_0x579922[_0x4da505[_0x0256('0x28')]]={'$like':'%'+_0x50b7c6[_0x0256('0x31')]['filter']+'%'};return _0x579922;}})});}_0x4b3a46=_['merge']({},_0x4b3a46,_0x50b7c6[_0x0256('0x3f')]);var _0x2a4916={'where':_0x4b3a46[_0x0256('0x3c')]};return db[_0x0256('0x2a')][_0x0256('0x1d')](_0x2a4916)['then'](function(_0x1e6d2a){_0xa2cec0[_0x0256('0x1d')]=_0x1e6d2a;if(_0x50b7c6[_0x0256('0x31')]['includeAll']){_0x4b3a46[_0x0256('0x40')]=[{'all':!![]}];}return db[_0x0256('0x2a')]['findAll'](_0x4b3a46);})[_0x0256('0x22')](function(_0x566cfd){_0xa2cec0[_0x0256('0x41')]=_0x566cfd;return _0xa2cec0;})['then'](respondWithFilteredResult(_0x11add5,_0x4b3a46))[_0x0256('0x42')](handleError(_0x11add5,null));};exports[_0x0256('0x43')]=function(_0x37f31a,_0x1b51f5){var _0x4ee422={'raw':!![],'where':{'id':_0x37f31a[_0x0256('0x44')]['id']}},_0x5ec8d3={};_0x5ec8d3[_0x0256('0x2f')]=_[_0x0256('0x32')](db['Tag'][_0x0256('0x2b')]);_0x5ec8d3[_0x0256('0x31')]=_[_0x0256('0x32')](_0x37f31a['query']);_0x5ec8d3[_0x0256('0x33')]=_[_0x0256('0x34')](_0x5ec8d3['model'],_0x5ec8d3['query']);_0x4ee422[_0x0256('0x36')]=_[_0x0256('0x34')](_0x5ec8d3[_0x0256('0x2f')],qs[_0x0256('0x35')](_0x37f31a[_0x0256('0x31')][_0x0256('0x35')]));_0x4ee422[_0x0256('0x36')]=_0x4ee422[_0x0256('0x36')][_0x0256('0x37')]?_0x4ee422[_0x0256('0x36')]:_0x5ec8d3['model'];if(_0x37f31a[_0x0256('0x31')][_0x0256('0x45')]){_0x4ee422[_0x0256('0x40')]=[{'all':!![]}];}_0x4ee422=_[_0x0256('0x3e')]({},_0x4ee422,_0x37f31a['options']);return db[_0x0256('0x2a')][_0x0256('0x46')](_0x4ee422)[_0x0256('0x22')](handleEntityNotFound(_0x1b51f5,null))[_0x0256('0x22')](respondWithResult(_0x1b51f5,null))['catch'](handleError(_0x1b51f5,null));};exports['create']=function(_0x105707,_0xab4880){return db[_0x0256('0x2a')][_0x0256('0x47')](_0x105707[_0x0256('0x48')],{})['then'](function(_0x3d90cc){var _0x1c195c=_0x105707[_0x0256('0x49')][_0x0256('0x24')]({'plain':!![]});if(!_0x1c195c)throw new Error(_0x0256('0x4a'));if(_0x1c195c[_0x0256('0x4b')]===_0x0256('0x49')){var _0x4e2fca=_0x3d90cc[_0x0256('0x24')]({'plain':!![]});var _0x5d8a9f='Tags';return db[_0x0256('0x4c')][_0x0256('0x46')]({'where':{'name':_0x5d8a9f,'userProfileId':_0x1c195c['userProfileId']},'raw':!![]})[_0x0256('0x22')](function(_0x19985a){if(_0x19985a&&_0x19985a[_0x0256('0x4d')]===0x0){return db[_0x0256('0x26')]['create']({'name':_0x4e2fca[_0x0256('0x28')],'resourceId':_0x4e2fca['id'],'type':_0x19985a[_0x0256('0x28')],'sectionId':_0x19985a['id']},{})['then'](function(){return _0x3d90cc;});}else{return _0x3d90cc;}})[_0x0256('0x42')](function(_0x12d9c7){logger['error'](_0x0256('0x4e'),_0x12d9c7);throw _0x12d9c7;});}return _0x3d90cc;})[_0x0256('0x22')](respondWithResult(_0xab4880,0xc9))[_0x0256('0x42')](handleError(_0xab4880,null));};exports[_0x0256('0x4f')]=function(_0x495bef,_0x117d36){if(_0x495bef[_0x0256('0x48')]['id']){delete _0x495bef[_0x0256('0x48')]['id'];}return db[_0x0256('0x2a')]['find']({'where':{'id':_0x495bef['params']['id']}})[_0x0256('0x22')](handleEntityNotFound(_0x117d36,null))[_0x0256('0x22')](saveUpdates(_0x495bef[_0x0256('0x48')],null))[_0x0256('0x22')](respondWithResult(_0x117d36,null))[_0x0256('0x42')](handleError(_0x117d36,null));};exports[_0x0256('0x23')]=function(_0x5a904f,_0x3d26bb){return db[_0x0256('0x2a')][_0x0256('0x46')]({'where':{'id':_0x5a904f['params']['id']}})[_0x0256('0x22')](handleEntityNotFound(_0x3d26bb,null))[_0x0256('0x22')](removeEntity(_0x3d26bb,null))[_0x0256('0x42')](handleError(_0x3d26bb,null));};exports['describe']=function(_0x12db14,_0x3a2922){return db[_0x0256('0x2a')][_0x0256('0x50')]()[_0x0256('0x22')](respondWithResult(_0x3a2922,null))[_0x0256('0x42')](handleError(_0x3a2922,null));}; \ No newline at end of file diff --git a/server/api/tag/tag.model.js b/server/api/tag/tag.model.js index b83aed6..2b988ac 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 _0x2239=['api','moment','bluebird','request-promise','path','rimraf','./tag.attributes','exports','define','Tag','util'];(function(_0x231473,_0x33b93e){var _0x16d666=function(_0x35ed3a){while(--_0x35ed3a){_0x231473['push'](_0x231473['shift']());}};_0x16d666(++_0x33b93e);}(_0x2239,0x18b));var _0x9223=function(_0x5a896a,_0x44670c){_0x5a896a=_0x5a896a-0x0;var _0x579d8d=_0x2239[_0x5a896a];return _0x579d8d;};'use strict';var _=require('lodash');var util=require(_0x9223('0x0'));var logger=require('../../config/logger')(_0x9223('0x1'));var moment=require(_0x9223('0x2'));var BPromise=require(_0x9223('0x3'));var rp=require(_0x9223('0x4'));var fs=require('fs');var path=require(_0x9223('0x5'));var rimraf=require(_0x9223('0x6'));var config=require('../../config/environment');var attributes=require(_0x9223('0x7'));module[_0x9223('0x8')]=function(_0x4333cd,_0x25ccdd){return _0x4333cd[_0x9223('0x9')](_0x9223('0xa'),attributes,{'tableName':'tools_tags','paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x52e3=['rimraf','exports','Tag','tools_tags','util','../../config/logger','moment','request-promise','path'];(function(_0x3dd15e,_0x1f0015){var _0x231fd0=function(_0x4f680a){while(--_0x4f680a){_0x3dd15e['push'](_0x3dd15e['shift']());}};_0x231fd0(++_0x1f0015);}(_0x52e3,0x11b));var _0x352e=function(_0x2f0f49,_0x2a62da){_0x2f0f49=_0x2f0f49-0x0;var _0x217418=_0x52e3[_0x2f0f49];return _0x217418;};'use strict';var _=require('lodash');var util=require(_0x352e('0x0'));var logger=require(_0x352e('0x1'))('api');var moment=require(_0x352e('0x2'));var BPromise=require('bluebird');var rp=require(_0x352e('0x3'));var fs=require('fs');var path=require(_0x352e('0x4'));var rimraf=require(_0x352e('0x5'));var config=require('../../config/environment');var attributes=require('./tag.attributes');module[_0x352e('0x6')]=function(_0x56ab4c,_0x4ea737){return _0x56ab4c['define'](_0x352e('0x7'),attributes,{'tableName':_0x352e('0x8'),'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 63ff917..429eb49 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 _0xb43b=['rpc','../../config/environment','http','request','info','request\x20sent','debug','Tag,\x20%s,\x20%s,\x20%s','stringify','error','code','message','Tag,\x20%s,\x20%s','catch','lodash','util','bluebird','randomstring','ioredis','../../config/utils','../../config/logger'];(function(_0x5b2558,_0x443139){var _0x4ff1d4=function(_0x573a9d){while(--_0x573a9d){_0x5b2558['push'](_0x5b2558['shift']());}};_0x4ff1d4(++_0x443139);}(_0xb43b,0x1b2));var _0xbb43=function(_0x32e5e7,_0x30048b){_0x32e5e7=_0x32e5e7-0x0;var _0x71ea18=_0xb43b[_0x32e5e7];return _0x71ea18;};'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')]('Tag,\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')]('Tag,\x20%s,\x20%s',_0x80fe61,_0x208c2b['error'][_0xbb43('0x12')]);return _0x29ae1a(_0x208c2b['error']['message']);}logger[_0xbb43('0x10')]('Tag,\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 +var _0xf9f7=['message','result','catch','lodash','util','moment','bluebird','randomstring','ioredis','../../config/logger','rpc','../../config/environment','jayson/promise','client','http','request','info','Tag,\x20%s,\x20%s','request\x20sent','debug','Tag,\x20%s,\x20%s,\x20%s','error'];(function(_0x5b6934,_0x3f81b7){var _0x182025=function(_0x3c273d){while(--_0x3c273d){_0x5b6934['push'](_0x5b6934['shift']());}};_0x182025(++_0x3f81b7);}(_0xf9f7,0xdf));var _0x7f9f=function(_0x29d9d5,_0x5a1bd8){_0x29d9d5=_0x29d9d5-0x0;var _0x1be395=_0xf9f7[_0x29d9d5];return _0x1be395;};'use strict';var _=require(_0x7f9f('0x0'));var util=require(_0x7f9f('0x1'));var moment=require(_0x7f9f('0x2'));var BPromise=require(_0x7f9f('0x3'));var rs=require(_0x7f9f('0x4'));var fs=require('fs');var Redis=require(_0x7f9f('0x5'));var db=require('../../mysqldb')['db'];var utils=require('../../config/utils');var logger=require(_0x7f9f('0x6'))(_0x7f9f('0x7'));var config=require(_0x7f9f('0x8'));var jayson=require(_0x7f9f('0x9'));var client=jayson[_0x7f9f('0xa')][_0x7f9f('0xb')]({'port':0x232a});function respondWithRpcPromise(_0x5b5819,_0x37e39f,_0x3da87e){return new BPromise(function(_0x181328,_0x3e9e75){return client[_0x7f9f('0xc')](_0x5b5819,_0x3da87e)['then'](function(_0x3fda85){logger[_0x7f9f('0xd')](_0x7f9f('0xe'),_0x37e39f,_0x7f9f('0xf'));logger[_0x7f9f('0x10')](_0x7f9f('0x11'),_0x37e39f,_0x7f9f('0xf'),JSON['stringify'](_0x3fda85));if(_0x3fda85[_0x7f9f('0x12')]){if(_0x3fda85[_0x7f9f('0x12')]['code']===0x1f4){logger['error'](_0x7f9f('0xe'),_0x37e39f,_0x3fda85['error'][_0x7f9f('0x13')]);return _0x3e9e75(_0x3fda85[_0x7f9f('0x12')]['message']);}logger[_0x7f9f('0x12')]('Tag,\x20%s,\x20%s',_0x37e39f,_0x3fda85[_0x7f9f('0x12')][_0x7f9f('0x13')]);return _0x181328(_0x3fda85[_0x7f9f('0x12')][_0x7f9f('0x13')]);}else{logger[_0x7f9f('0xd')]('Tag,\x20%s,\x20%s',_0x37e39f,_0x7f9f('0xf'));_0x181328(_0x3fda85[_0x7f9f('0x14')]['message']);}})[_0x7f9f('0x15')](function(_0x4a36c8){logger[_0x7f9f('0x12')](_0x7f9f('0xe'),_0x37e39f,_0x4a36c8);_0x3e9e75(_0x4a36c8);});});} \ No newline at end of file diff --git a/server/api/team/index.js b/server/api/team/index.js index b1c0938..1f77da0 100644 --- a/server/api/team/index.js +++ b/server/api/team/index.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0xa9e0=['Router','../../components/auth/service','../../components/interaction/service','../../config/environment','./team.controller','get','index','/:id','getQueues','/:id/users','isAuthenticated','getAgents','post','addQueues','addAgents','update','delete','removeAgents','multer','util','path'];(function(_0x4b369d,_0x265eb8){var _0x571a98=function(_0x56341a){while(--_0x56341a){_0x4b369d['push'](_0x4b369d['shift']());}};_0x571a98(++_0x265eb8);}(_0xa9e0,0x123));var _0x0a9e=function(_0x38a7ac,_0x45514b){_0x38a7ac=_0x38a7ac-0x0;var _0x53061a=_0xa9e0[_0x38a7ac];return _0x53061a;};'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(_0x46698a,_0x8de1e4){var _0x356db0=function(_0x19e83c){while(--_0x19e83c){_0x46698a['push'](_0x46698a['shift']());}};_0x356db0(++_0x8de1e4);}(_0xa9e0,0x123));var _0x0a9e=function(_0x2cfb58,_0x3d9412){_0x2cfb58=_0x2cfb58-0x0;var _0xd99951=_0xa9e0[_0x2cfb58];return _0xd99951;};'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 cd6dee3..f3b39fb 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(_0x4a82c4,_0x20e706){var _0x51c198=function(_0x5d2872){while(--_0x5d2872){_0x4a82c4['push'](_0x4a82c4['shift']());}};_0x51c198(++_0x20e706);}(_0x757a,0xde));var _0xa757=function(_0x1f8be3,_0x13c45d){_0x1f8be3=_0x1f8be3-0x0;var _0x2ac23c=_0x757a[_0x1f8be3];return _0x2ac23c;};'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 _0x757a=['exports','STRING'];(function(_0x18e56e,_0x270d97){var _0x4b265a=function(_0x368444){while(--_0x368444){_0x18e56e['push'](_0x18e56e['shift']());}};_0x4b265a(++_0x270d97);}(_0x757a,0xde));var _0xa757=function(_0x5a244b,_0x61c884){_0x5a244b=_0x5a244b-0x0;var _0x1aa855=_0x757a[_0x5a244b];return _0x1aa855;};'use strict';var Sequelize=require('sequelize');module[_0xa757('0x0')]={'name':{'type':Sequelize[_0xa757('0x1')],'allowNull':![],'unique':'name'},'description':{'type':Sequelize['STRING']}}; \ No newline at end of file diff --git a/server/api/team/team.controller.js b/server/api/team/team.controller.js index d2adc2a..59f8919 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 _0x407f=['interface','UserVoiceQueueRt','upsert','isNil','format','SIP/%s','TeamVoiceQueue','all','VoicePrefixId','spread','removeAgents','Chat','Sms','Fax','transaction','Queue:remove','getAgents','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','moment','bluebird','mustache','util','path','sox','to-csv','ejs','fs-extra','lodash','desk.js','querystring','papaparse','../../components/auth/service','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','redis','defaults','localhost','socket.io-emitter','./team.socket','sendStatus','status','end','json','offset','undefined','count','limit','set','Content-Range','apply','reject','save','update','error','stack','name','send','index','map','Team','rawAttributes','fieldName','type','model','keys','query','intersection','attributes','fields','length','hasOwnProperty','nolimit','sort','where','filters','pick','filter','merge','VIRTUAL','options','then','include','rows','catch','show','find','body','user','get','Unable\x20to\x20retrieve\x20the\x20current\x20user','role','userProfileId','autoAssociation','UserProfileResource','create','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','params','destroy','sequelize','SELECT','UserId','SELECT\x20VoiceQueueId\x20FROM\x20team_has_voice_queues\x20WHERE\x20TeamId\x20=\x20','Sequelize','QueryTypes','VoiceQueueId','UserVoiceQueue','MailQueueId','UserMailQueue','SELECT\x20SmsQueueId\x20FROM\x20team_has_sms_queues\x20WHERE\x20TeamId\x20=\x20','SmsQueueId','UserSmsQueue','UserChatQueue','SELECT\x20FaxQueueId\x20FROM\x20team_has_fax_queues\x20WHERE\x20TeamId\x20=\x20','UserFaxQueue','SELECT\x20OpenchannelQueueId\x20FROM\x20team_has_openchannel_queues\x20WHERE\x20TeamId\x20=\x20','UserOpenchannelQueue','SELECT\x20WhatsappQueueId\x20FROM\x20team_has_whatsapp_queues\x20WHERE\x20TeamId\x20=\x20','WhatsappQueueId','UserWhatsappQueue','TeamVoicePrefix','UserVoicePrefix','getQueues','findOne','channel','isValidChannel','ValidationError','Unknown\x20channel','capitalize','toLowerCase','Queue','order','Queues','addQueues','add','removeQueues','remove','ids','addAgents','isArray','Voice','Mail','Openchannel','Whatsapp','through','penalty','QueueId','User','findOrCreate','emit','findAll','online','voicePause'];(function(_0x5b644e,_0x2e5e07){var _0x49c6bf=function(_0x3032d9){while(--_0x3032d9){_0x5b644e['push'](_0x5b644e['shift']());}};_0x49c6bf(++_0x2e5e07);}(_0x407f,0x153));var _0xf407=function(_0x238c11,_0x2470ed){_0x238c11=_0x238c11-0x0;var _0x350d8a=_0x407f[_0x238c11];return _0x350d8a;};'use strict';var emlformat=require(_0xf407('0x0'));var rimraf=require(_0xf407('0x1'));var zipdir=require(_0xf407('0x2'));var jsonpatch=require(_0xf407('0x3'));var rp=require(_0xf407('0x4'));var moment=require(_0xf407('0x5'));var BPromise=require(_0xf407('0x6'));var Mustache=require(_0xf407('0x7'));var util=require(_0xf407('0x8'));var path=require(_0xf407('0x9'));var sox=require(_0xf407('0xa'));var csv=require(_0xf407('0xb'));var ejs=require(_0xf407('0xc'));var fs=require('fs');var fs_extra=require(_0xf407('0xd'));var _=require(_0xf407('0xe'));var squel=require('squel');var crypto=require('crypto');var jsforce=require('jsforce');var deskjs=require(_0xf407('0xf'));var toCsv=require(_0xf407('0xb'));var querystring=require(_0xf407('0x10'));var Papa=require(_0xf407('0x11'));var Redis=require('ioredis');var authService=require(_0xf407('0x12'));var qs=require('../../components/parsers/qs');var as=require('../../components/parsers/advancedSearch');var hardwareService=require(_0xf407('0x13'));var logger=require(_0xf407('0x14'))(_0xf407('0x15'));var utils=require(_0xf407('0x16'));var config=require(_0xf407('0x17'));var licenseUtil=require(_0xf407('0x18'));var db=require(_0xf407('0x19'))['db'];config[_0xf407('0x1a')]=_[_0xf407('0x1b')](config[_0xf407('0x1a')],{'host':_0xf407('0x1c'),'port':0x18eb});var socket=require(_0xf407('0x1d'))(new Redis(config[_0xf407('0x1a')]));require(_0xf407('0x1e'))['register'](socket);function respondWithStatusCode(_0x27f0cd,_0x494b43){_0x494b43=_0x494b43||0xcc;return function(_0x2fbafd){if(_0x2fbafd){return _0x27f0cd[_0xf407('0x1f')](_0x494b43);}return _0x27f0cd[_0xf407('0x20')](_0x494b43)[_0xf407('0x21')]();};}function respondWithResult(_0x22395d,_0x5ddddc){_0x5ddddc=_0x5ddddc||0xc8;return function(_0x284253){if(_0x284253){return _0x22395d[_0xf407('0x20')](_0x5ddddc)[_0xf407('0x22')](_0x284253);}};}function respondWithFilteredResult(_0x47c8b6,_0x5b9446){return function(_0x133608){if(_0x133608){var _0x124f17=typeof _0x5b9446[_0xf407('0x23')]===_0xf407('0x24')&&typeof _0x5b9446['limit']==='undefined';var _0x106af4=_0x133608[_0xf407('0x25')];var _0x810362=_0x124f17?0x0:_0x5b9446[_0xf407('0x23')];var _0x7035fb=_0x124f17?_0x133608[_0xf407('0x25')]:_0x5b9446[_0xf407('0x23')]+_0x5b9446[_0xf407('0x26')];var _0x417eed;if(_0x7035fb>=_0x106af4){_0x7035fb=_0x106af4;_0x417eed=0xc8;}else{_0x417eed=0xce;}_0x47c8b6[_0xf407('0x20')](_0x417eed);return _0x47c8b6[_0xf407('0x27')](_0xf407('0x28'),_0x810362+'-'+_0x7035fb+'/'+_0x106af4)[_0xf407('0x22')](_0x133608);}return null;};}function patchUpdates(_0x2eafdb){return function(_0x396cbd){try{jsonpatch[_0xf407('0x29')](_0x396cbd,_0x2eafdb,!![]);}catch(_0x53df0c){return BPromise[_0xf407('0x2a')](_0x53df0c);}return _0x396cbd[_0xf407('0x2b')]();};}function saveUpdates(_0x4e58d6,_0x28a694){return function(_0x44ee4b){if(_0x44ee4b){return _0x44ee4b[_0xf407('0x2c')](_0x4e58d6)['then'](function(_0x4cebb5){return _0x4cebb5;});}return null;};}function handleEntityNotFound(_0x3e2212,_0x32bf58){return function(_0x5d1061){if(!_0x5d1061){_0x3e2212[_0xf407('0x1f')](0x194);}return _0x5d1061;};}function handleError(_0x4b820a,_0x844ec1){_0x844ec1=_0x844ec1||0x1f4;return function(_0x527e82){logger[_0xf407('0x2d')](_0x527e82[_0xf407('0x2e')]);if(_0x527e82[_0xf407('0x2f')]){delete _0x527e82['name'];}_0x4b820a['status'](_0x844ec1)[_0xf407('0x30')](_0x527e82);};}exports[_0xf407('0x31')]=function(_0x19a61d,_0x56a653){var _0x4b5b26={},_0x31d5a3={},_0x223b87={'count':0x0,'rows':[]};var _0x4a2ee4=_[_0xf407('0x32')](db[_0xf407('0x33')][_0xf407('0x34')],function(_0x227dc6){return{'name':_0x227dc6[_0xf407('0x35')],'type':_0x227dc6[_0xf407('0x36')]['key']};});_0x31d5a3[_0xf407('0x37')]=_[_0xf407('0x32')](_0x4a2ee4,_0xf407('0x2f'));_0x31d5a3['query']=_[_0xf407('0x38')](_0x19a61d[_0xf407('0x39')]);_0x31d5a3['filters']=_[_0xf407('0x3a')](_0x31d5a3['model'],_0x31d5a3[_0xf407('0x39')]);_0x4b5b26[_0xf407('0x3b')]=_[_0xf407('0x3a')](_0x31d5a3[_0xf407('0x37')],qs['fields'](_0x19a61d[_0xf407('0x39')][_0xf407('0x3c')]));_0x4b5b26[_0xf407('0x3b')]=_0x4b5b26[_0xf407('0x3b')][_0xf407('0x3d')]?_0x4b5b26[_0xf407('0x3b')]:_0x31d5a3[_0xf407('0x37')];if(!_0x19a61d[_0xf407('0x39')][_0xf407('0x3e')](_0xf407('0x3f'))){_0x4b5b26[_0xf407('0x26')]=qs[_0xf407('0x26')](_0x19a61d[_0xf407('0x39')]['limit']);_0x4b5b26[_0xf407('0x23')]=qs[_0xf407('0x23')](_0x19a61d['query']['offset']);}_0x4b5b26['order']=qs[_0xf407('0x40')](_0x19a61d[_0xf407('0x39')][_0xf407('0x40')]);_0x4b5b26[_0xf407('0x41')]=qs[_0xf407('0x42')](_[_0xf407('0x43')](_0x19a61d[_0xf407('0x39')],_0x31d5a3['filters']),_0x4a2ee4);if(_0x19a61d[_0xf407('0x39')][_0xf407('0x44')]){_0x4b5b26[_0xf407('0x41')]=_[_0xf407('0x45')](_0x4b5b26[_0xf407('0x41')],{'$or':_['map'](_0x4a2ee4,function(_0x5eba26){if(_0x5eba26[_0xf407('0x36')]!==_0xf407('0x46')){var _0xbf1a7b={};_0xbf1a7b[_0x5eba26['name']]={'$like':'%'+_0x19a61d['query'][_0xf407('0x44')]+'%'};return _0xbf1a7b;}})});}_0x4b5b26=_[_0xf407('0x45')]({},_0x4b5b26,_0x19a61d[_0xf407('0x47')]);var _0x42d310={'where':_0x4b5b26['where']};return db[_0xf407('0x33')]['count'](_0x42d310)[_0xf407('0x48')](function(_0x344285){_0x223b87['count']=_0x344285;if(_0x19a61d[_0xf407('0x39')]['includeAll']){_0x4b5b26[_0xf407('0x49')]=[{'all':!![]}];}return db[_0xf407('0x33')]['findAll'](_0x4b5b26);})['then'](function(_0x3a22cf){_0x223b87[_0xf407('0x4a')]=_0x3a22cf;return _0x223b87;})[_0xf407('0x48')](respondWithFilteredResult(_0x56a653,_0x4b5b26))[_0xf407('0x4b')](handleError(_0x56a653,null));};exports[_0xf407('0x4c')]=function(_0xc14a3f,_0x28e62d){var _0x5df474={'raw':![],'where':{'id':_0xc14a3f['params']['id']}},_0x2528c2={};_0x2528c2[_0xf407('0x37')]=_[_0xf407('0x38')](db['Team']['rawAttributes']);_0x2528c2[_0xf407('0x39')]=_[_0xf407('0x38')](_0xc14a3f['query']);_0x2528c2[_0xf407('0x42')]=_[_0xf407('0x3a')](_0x2528c2[_0xf407('0x37')],_0x2528c2['query']);_0x5df474[_0xf407('0x3b')]=_[_0xf407('0x3a')](_0x2528c2[_0xf407('0x37')],qs[_0xf407('0x3c')](_0xc14a3f[_0xf407('0x39')]['fields']));_0x5df474[_0xf407('0x3b')]=_0x5df474[_0xf407('0x3b')][_0xf407('0x3d')]?_0x5df474[_0xf407('0x3b')]:_0x2528c2[_0xf407('0x37')];if(_0xc14a3f[_0xf407('0x39')]['includeAll']){_0x5df474[_0xf407('0x49')]=[{'all':!![]}];}_0x5df474=_[_0xf407('0x45')]({},_0x5df474,_0xc14a3f[_0xf407('0x47')]);return db[_0xf407('0x33')][_0xf407('0x4d')](_0x5df474)[_0xf407('0x48')](handleEntityNotFound(_0x28e62d,null))[_0xf407('0x48')](respondWithResult(_0x28e62d,null))[_0xf407('0x4b')](handleError(_0x28e62d,null));};exports['create']=function(_0x3c42f4,_0x37bcaa){return db['Team']['create'](_0x3c42f4[_0xf407('0x4e')],{})['then'](function(_0x10c29c){var _0x42f7c6=_0x3c42f4[_0xf407('0x4f')][_0xf407('0x50')]({'plain':!![]});if(!_0x42f7c6)throw new Error(_0xf407('0x51'));if(_0x42f7c6[_0xf407('0x52')]===_0xf407('0x4f')){var _0x4f11e5=_0x10c29c[_0xf407('0x50')]({'plain':!![]});var _0x4b85e2='Teams';return db['UserProfileSection'][_0xf407('0x4d')]({'where':{'name':_0x4b85e2,'userProfileId':_0x42f7c6[_0xf407('0x53')]},'raw':!![]})['then'](function(_0x4e1a54){if(_0x4e1a54&&_0x4e1a54[_0xf407('0x54')]===0x0){return db[_0xf407('0x55')][_0xf407('0x56')]({'name':_0x4f11e5[_0xf407('0x2f')],'resourceId':_0x4f11e5['id'],'type':_0x4e1a54[_0xf407('0x2f')],'sectionId':_0x4e1a54['id']},{})[_0xf407('0x48')](function(){return _0x10c29c;});}else{return _0x10c29c;}})[_0xf407('0x4b')](function(_0x4a815f){logger['error'](_0xf407('0x57'),_0x4a815f);throw _0x4a815f;});}return _0x10c29c;})['then'](respondWithResult(_0x37bcaa,0xc9))['catch'](handleError(_0x37bcaa,null));};exports[_0xf407('0x2c')]=function(_0x18e6ee,_0x5de42f){if(_0x18e6ee['body']['id']){delete _0x18e6ee[_0xf407('0x4e')]['id'];}return db[_0xf407('0x33')]['find']({'where':{'id':_0x18e6ee[_0xf407('0x58')]['id']}})[_0xf407('0x48')](handleEntityNotFound(_0x5de42f,null))[_0xf407('0x48')](saveUpdates(_0x18e6ee[_0xf407('0x4e')],null))['then'](respondWithResult(_0x5de42f,null))[_0xf407('0x4b')](handleError(_0x5de42f,null));};exports[_0xf407('0x59')]=function(_0x91b0f7,_0x1d8f22){var _0x18a356=_0x91b0f7['params']['id'];var _0xc903fd=[];return db[_0xf407('0x5a')]['transaction'](function(_0x4bd20d){var _0x1a96dd='SELECT\x20UserId\x20FROM\x20user_has_teams\x20WHERE\x20TeamId\x20=\x20'+_0x18a356;return db['sequelize'][_0xf407('0x39')](_0x1a96dd,{'type':db['Sequelize']['QueryTypes'][_0xf407('0x5b')],'raw':!![],'transaction':_0x4bd20d})[_0xf407('0x48')](function(_0x259af9){_0xc903fd=_['map'](_0x259af9,function(_0x361250){return Number(_0x361250[_0xf407('0x5c')]);});})[_0xf407('0x48')](function(){var _0x20be4c=_0xf407('0x5d')+_0x18a356;return db['sequelize'][_0xf407('0x39')](_0x20be4c,{'type':db[_0xf407('0x5e')][_0xf407('0x5f')][_0xf407('0x5b')],'raw':!![],'transaction':_0x4bd20d});})['then'](function(_0xb1ed65){var _0x5cfa1c=_[_0xf407('0x32')](_0xb1ed65,function(_0x42578c){return Number(_0x42578c[_0xf407('0x60')]);});return db[_0xf407('0x61')][_0xf407('0x59')]({'where':{'UserId':{'$in':_0xc903fd},'VoiceQueueId':{'$in':_0x5cfa1c}},'transaction':_0x4bd20d});})[_0xf407('0x48')](function(){var _0x52d93e='SELECT\x20MailQueueId\x20FROM\x20team_has_mail_queues\x20WHERE\x20TeamId\x20=\x20'+_0x18a356;return db[_0xf407('0x5a')][_0xf407('0x39')](_0x52d93e,{'type':db[_0xf407('0x5e')][_0xf407('0x5f')][_0xf407('0x5b')],'raw':!![],'transaction':_0x4bd20d});})[_0xf407('0x48')](function(_0x42d2a6){var _0x5d4402=_[_0xf407('0x32')](_0x42d2a6,function(_0x3f6c2c){return Number(_0x3f6c2c[_0xf407('0x62')]);});return db[_0xf407('0x63')]['destroy']({'where':{'UserId':{'$in':_0xc903fd},'MailQueueId':{'$in':_0x5d4402}},'transaction':_0x4bd20d});})['then'](function(){var _0x4ce655=_0xf407('0x64')+_0x18a356;return db[_0xf407('0x5a')]['query'](_0x4ce655,{'type':db[_0xf407('0x5e')][_0xf407('0x5f')][_0xf407('0x5b')],'raw':!![],'transaction':_0x4bd20d});})[_0xf407('0x48')](function(_0x5a11db){var _0x2b0c45=_[_0xf407('0x32')](_0x5a11db,function(_0x379c12){return Number(_0x379c12[_0xf407('0x65')]);});return db[_0xf407('0x66')][_0xf407('0x59')]({'where':{'UserId':{'$in':_0xc903fd},'SmsQueueId':{'$in':_0x2b0c45}},'transaction':_0x4bd20d});})[_0xf407('0x48')](function(){var _0x2911ad='SELECT\x20ChatQueueId\x20FROM\x20team_has_chat_queues\x20WHERE\x20TeamId\x20=\x20'+_0x18a356;return db['sequelize']['query'](_0x2911ad,{'type':db[_0xf407('0x5e')]['QueryTypes']['SELECT'],'raw':!![],'transaction':_0x4bd20d});})[_0xf407('0x48')](function(_0x374910){var _0x47a11b=_[_0xf407('0x32')](_0x374910,function(_0x2b83ac){return Number(_0x2b83ac['ChatQueueId']);});return db[_0xf407('0x67')][_0xf407('0x59')]({'where':{'UserId':{'$in':_0xc903fd},'ChatQueueId':{'$in':_0x47a11b}},'transaction':_0x4bd20d});})[_0xf407('0x48')](function(){var _0x31e7ae=_0xf407('0x68')+_0x18a356;return db[_0xf407('0x5a')][_0xf407('0x39')](_0x31e7ae,{'type':db[_0xf407('0x5e')][_0xf407('0x5f')][_0xf407('0x5b')],'raw':!![],'transaction':_0x4bd20d});})[_0xf407('0x48')](function(_0x439e5b){var _0x338467=_['map'](_0x439e5b,function(_0x226ea8){return Number(_0x226ea8['FaxQueueId']);});return db[_0xf407('0x69')][_0xf407('0x59')]({'where':{'UserId':{'$in':_0xc903fd},'FaxQueueId':{'$in':_0x338467}},'transaction':_0x4bd20d});})[_0xf407('0x48')](function(){var _0x551481=_0xf407('0x6a')+_0x18a356;return db[_0xf407('0x5a')][_0xf407('0x39')](_0x551481,{'type':db['Sequelize'][_0xf407('0x5f')]['SELECT'],'raw':!![],'transaction':_0x4bd20d});})[_0xf407('0x48')](function(_0x380ae6){var _0x64ff5f=_[_0xf407('0x32')](_0x380ae6,function(_0x2b8252){return Number(_0x2b8252['OpenchannelQueueId']);});return db[_0xf407('0x6b')][_0xf407('0x59')]({'where':{'UserId':{'$in':_0xc903fd},'OpenchannelQueueId':{'$in':_0x64ff5f}},'transaction':_0x4bd20d});})['then'](function(){var _0x30be40=_0xf407('0x6c')+_0x18a356;return db['sequelize']['query'](_0x30be40,{'type':db[_0xf407('0x5e')][_0xf407('0x5f')][_0xf407('0x5b')],'raw':!![],'transaction':_0x4bd20d});})[_0xf407('0x48')](function(_0xe45ecc){var _0x54f74=_[_0xf407('0x32')](_0xe45ecc,function(_0x2fd8e1){return Number(_0x2fd8e1[_0xf407('0x6d')]);});return db[_0xf407('0x6e')]['destroy']({'where':{'UserId':{'$in':_0xc903fd},'WhatsappQueueId':{'$in':_0x54f74}},'transaction':_0x4bd20d});})[_0xf407('0x48')](function(){return db[_0xf407('0x6f')][_0xf407('0x4d')]({'where':{'TeamId':_0x18a356}});})['then'](function(_0x2239cb){if(_0x2239cb===null){return;}return db[_0xf407('0x70')][_0xf407('0x59')]({'where':{'UserId':{'$in':_0xc903fd},'VoicePrefixId':_0x2239cb['VoicePrefixId']},'transaction':_0x4bd20d});})[_0xf407('0x48')](function(){return db[_0xf407('0x33')][_0xf407('0x59')]({'where':{'id':_0x18a356},'cascade':!![],'transaction':_0x4bd20d});})[_0xf407('0x48')](function(_0x207755){if(_0x207755===0x0){_0x1d8f22[_0xf407('0x1f')](0x194);}else{return db['UserProfileResource'][_0xf407('0x59')]({'where':{'type':'Teams','resourceId':_0x18a356},'cascade':!![],'transaction':_0x4bd20d})['then'](function(){_0x1d8f22[_0xf407('0x20')](0xcc)[_0xf407('0x21')]();});}})[_0xf407('0x4b')](function(_0x3e7feb){_0x1d8f22[_0xf407('0x20')](0x1f4)[_0xf407('0x30')](_0x3e7feb);});});};exports[_0xf407('0x71')]=function(_0x1e810d,_0x366e62,_0x5c6f1c){return db[_0xf407('0x33')][_0xf407('0x72')]({'where':{'id':_0x1e810d[_0xf407('0x58')]['id']}})[_0xf407('0x48')](handleEntityNotFound(_0x366e62,null))[_0xf407('0x48')](function(_0x4864fb){if(!_0x1e810d['query'][_0xf407('0x73')]||!utils[_0xf407('0x74')](_0x1e810d['query'][_0xf407('0x73')])){throw new db[(_0xf407('0x5e'))][(_0xf407('0x75'))](_0xf407('0x76'));}var _0x2626d4={};var _0x2d07ad={};_0x2d07ad[_0xf407('0x37')]=_['keys'](db[_[_0xf407('0x77')](_0x1e810d[_0xf407('0x39')]['channel'][_0xf407('0x78')]())+_0xf407('0x79')][_0xf407('0x34')]);_0x2d07ad[_0xf407('0x39')]=_[_0xf407('0x38')](_0x1e810d[_0xf407('0x39')]);_0x2d07ad[_0xf407('0x42')]=_['intersection'](_0x2d07ad[_0xf407('0x37')],_0x2d07ad[_0xf407('0x39')]);_0x2626d4['attributes']=_[_0xf407('0x3a')](_0x2d07ad['model'],qs[_0xf407('0x3c')](_0x1e810d['query']['fields']));_0x2626d4['attributes']=_0x2626d4[_0xf407('0x3b')][_0xf407('0x3d')]?_0x2626d4[_0xf407('0x3b')]:_0x2d07ad[_0xf407('0x37')];_0x2626d4[_0xf407('0x26')]=qs[_0xf407('0x26')](_0x1e810d[_0xf407('0x39')][_0xf407('0x26')]);_0x2626d4['offset']=qs[_0xf407('0x23')](_0x1e810d[_0xf407('0x39')][_0xf407('0x23')]);_0x2626d4[_0xf407('0x7a')]=qs[_0xf407('0x40')](_0x1e810d[_0xf407('0x39')][_0xf407('0x40')]);_0x2626d4['where']=qs[_0xf407('0x42')](_[_0xf407('0x43')](_0x1e810d['query'],_0x2d07ad['filters']));_0x2626d4=_[_0xf407('0x45')]({},_0x2626d4,_0x1e810d[_0xf407('0x47')]);return _0x4864fb[_0xf407('0x50')+_[_0xf407('0x77')](_0x1e810d[_0xf407('0x39')][_0xf407('0x73')][_0xf407('0x78')]())+_0xf407('0x7b')](_0x2626d4);})[_0xf407('0x48')](respondWithResult(_0x366e62,null))[_0xf407('0x4b')](handleError(_0x366e62,null));};exports[_0xf407('0x7c')]=function(_0x124fd6,_0xd38340,_0x5838bd){return db['Team'][_0xf407('0x72')]({'where':{'id':_0x124fd6['params']['id']}})['then'](function(_0xc1d447){if(_0xc1d447){if(!_0x124fd6[_0xf407('0x4e')][_0xf407('0x73')]||!utils[_0xf407('0x74')](_0x124fd6[_0xf407('0x4e')]['channel'])){throw new db['Sequelize'][(_0xf407('0x75'))]('Unknown\x20channel');}return _0xc1d447[_0xf407('0x7d')+_[_0xf407('0x77')](_0x124fd6[_0xf407('0x4e')][_0xf407('0x73')][_0xf407('0x78')]())+_0xf407('0x7b')](_0x124fd6[_0xf407('0x4e')]['ids']);}return null;})[_0xf407('0x48')](handleEntityNotFound(_0xd38340,null))['then'](respondWithStatusCode(_0xd38340,null))['catch'](handleError(_0xd38340,null));};exports[_0xf407('0x7e')]=function(_0x551ffa,_0x38cacd,_0x260d78){return db[_0xf407('0x33')][_0xf407('0x72')]({'where':{'id':_0x551ffa['params']['id']}})['then'](function(_0x177de9){if(_0x177de9){if(!_0x551ffa[_0xf407('0x39')]['channel']||!utils[_0xf407('0x74')](_0x551ffa[_0xf407('0x39')][_0xf407('0x73')])){throw new db['Sequelize'][(_0xf407('0x75'))](_0xf407('0x76'));}return _0x177de9[_0xf407('0x7f')+_[_0xf407('0x77')](_0x551ffa[_0xf407('0x39')]['channel'][_0xf407('0x78')]())+_0xf407('0x7b')](_0x551ffa[_0xf407('0x39')][_0xf407('0x80')]);}return null;})['then'](handleEntityNotFound(_0x38cacd,null))['then'](respondWithStatusCode(_0x38cacd,null))[_0xf407('0x4b')](handleError(_0x38cacd,null));};exports[_0xf407('0x81')]=function(_0x7d3f81,_0x4ebaf9){var _0x48c831=_[_0xf407('0x82')](_0x7d3f81['body']['ids'])?_0x7d3f81[_0xf407('0x4e')][_0xf407('0x80')]:[_0x7d3f81[_0xf407('0x4e')][_0xf407('0x80')]];var _0x506369=_0x7d3f81[_0xf407('0x58')]['id'];return db[_0xf407('0x33')][_0xf407('0x4d')]({'where':{'id':_0x506369}})['then'](handleEntityNotFound(_0x4ebaf9,null))[_0xf407('0x48')](function(_0xb83666){if(_0xb83666){var _0x10c87d=[_0xf407('0x83'),'Chat',_0xf407('0x84'),'Sms','Fax',_0xf407('0x85'),_0xf407('0x86')];return db[_0xf407('0x5a')]['transaction'](function(_0x131fba){var _0x132052=_[_0xf407('0x32')](_0x10c87d,function(_0x31f2b2){var _0x20e5c8={'attributes':['id','name']};if(_0x31f2b2===_0xf407('0x83')){_0x20e5c8[_0xf407('0x87')]={'attributes':[_0xf407('0x88')]};}return _0xb83666['get'+_0x31f2b2+_0xf407('0x7b')](_0x20e5c8)['then'](function(_0x5bdee2){var _0x1fb9fb=_['map'](_0x5bdee2,function(_0x4d5787){var _0x2c1de9=_[_0xf407('0x32')](_0x48c831,function(_0x469e37){var _0x1fa30d={'where':{'UserId':_0x469e37,[_0x31f2b2+_0xf407('0x89')]:_0x4d5787['id']},'transaction':_0x131fba};if(_0x31f2b2===_0xf407('0x83')){_0x1fa30d[_0xf407('0x1b')]={'penalty':_0x4d5787['TeamVoiceQueue'][_0xf407('0x88')]};}return db[_0xf407('0x8a')+_0x31f2b2+_0xf407('0x79')][_0xf407('0x8b')](_0x1fa30d)[_0xf407('0x48')](function(){socket[_0xf407('0x8c')](_0xf407('0x4f')+_0x31f2b2+'Queue:save',{'UserId':_0x469e37,[_0x31f2b2+'QueueId']:_0x4d5787['id']});if(_0x31f2b2!==_0xf407('0x83')){return;}return db[_0xf407('0x8a')][_0xf407('0x8d')]({'where':{'id':_0x48c831,'online':0x1},'attributes':['id','name',_0xf407('0x8e'),_0xf407('0x8f'),_0xf407('0x90')],'raw':!![]})['then'](function(_0x5c1490){var _0x3ca39e=_['map'](_0x5c1490,function(_0x57318b){return db[_0xf407('0x91')][_0xf407('0x92')]({'membername':_0x57318b['name'],'UserId':_0x57318b['id'],'queue_name':_0x4d5787[_0xf407('0x2f')],'VoiceQueueId':_0x4d5787['id'],'interface':_[_0xf407('0x93')](_0x57318b[_0xf407('0x90')])?util[_0xf407('0x94')](_0xf407('0x95'),_0x57318b[_0xf407('0x2f')]):_0x57318b[_0xf407('0x90')],'paused':_0x57318b['voicePause']||![],'penalty':_0x4d5787[_0xf407('0x96')][_0xf407('0x88')]},{'transaction':_0x131fba});});return Promise[_0xf407('0x97')](_0x3ca39e);});});});return Promise['all'](_0x2c1de9);});return Promise[_0xf407('0x97')](_0x1fb9fb);})[_0xf407('0x48')](function(){return db[_0xf407('0x6f')]['findOne']({'where':{'teamId':_0x506369}})[_0xf407('0x48')](function(_0x351f43){if(_0x351f43){var _0x4ce694=_[_0xf407('0x32')](_0x48c831,function(_0x19c9eb){db[_0xf407('0x70')][_0xf407('0x92')]({'UserId':_0x19c9eb,'VoicePrefixId':_0x351f43[_0xf407('0x98')]});});return Promise[_0xf407('0x97')](_0x4ce694);}});});});return Promise['all'](_0x132052)[_0xf407('0x48')](function(){return _0xb83666[_0xf407('0x81')](_0x48c831,{'transaction':_0x131fba})[_0xf407('0x99')](function(_0x3dae38){return _0x3dae38;});});});}})[_0xf407('0x48')](respondWithResult(_0x4ebaf9,null))[_0xf407('0x4b')](handleError(_0x4ebaf9,null));};exports[_0xf407('0x9a')]=function(_0x14e952,_0x4568c8){var _0x9cf491=_['isArray'](_0x14e952[_0xf407('0x39')]['ids'])?_0x14e952['query']['ids']:[_0x14e952[_0xf407('0x39')][_0xf407('0x80')]];var _0x3ed175=_0x14e952[_0xf407('0x58')]['id'];return db['Team'][_0xf407('0x4d')]({'where':{'id':_0x3ed175}})[_0xf407('0x48')](handleEntityNotFound(_0x4568c8,null))[_0xf407('0x48')](function(_0x45a3ed){if(_0x45a3ed){var _0x441df5=[_0xf407('0x83'),_0xf407('0x9b'),'Mail',_0xf407('0x9c'),_0xf407('0x9d'),_0xf407('0x85'),_0xf407('0x86')];return db[_0xf407('0x5a')][_0xf407('0x9e')](function(_0x5798f9){var _0x232b64=_[_0xf407('0x32')](_0x441df5,function(_0x27e028){var _0x233cbf={'attributes':['id',_0xf407('0x2f')]};return _0x45a3ed[_0xf407('0x50')+_0x27e028+'Queues'](_0x233cbf)[_0xf407('0x48')](function(_0x171392){var _0x3d4699=_[_0xf407('0x32')](_0x171392,function(_0x43451f){return _0x43451f[_0xf407('0x9a')](_0x9cf491,{'transaction':_0x5798f9})[_0xf407('0x48')](function(){var _0x1b930f=_[_0xf407('0x32')](_0x9cf491,function(_0x2caa64){socket[_0xf407('0x8c')]('user'+_0x27e028+_0xf407('0x9f'),{'UserId':Number(_0x2caa64),[_0x27e028+_0xf407('0x89')]:_0x43451f['id']});if(_0x27e028!==_0xf407('0x83')){return;}return db[_0xf407('0x91')]['destroy']({'where':{'VoiceQueueId':_0x43451f['id'],'UserId':_0x2caa64},'transaction':_0x5798f9});});return Promise[_0xf407('0x97')](_0x1b930f);});});return Promise[_0xf407('0x97')](_0x3d4699);});});return Promise[_0xf407('0x97')](_0x232b64)[_0xf407('0x48')](function(){return _0x45a3ed[_0xf407('0x9a')](_0x9cf491,{'transaction':_0x5798f9});})['then'](function(){return db[_0xf407('0x6f')][_0xf407('0x72')]({'where':{'teamId':_0x3ed175}})[_0xf407('0x48')](function(_0x5855b3){if(_0x5855b3){var _0x44560e=_[_0xf407('0x32')](_0x9cf491,function(_0x59f12e){db[_0xf407('0x70')][_0xf407('0x59')]({'where':{'UserId':_0x59f12e,'VoicePrefixId':_0x5855b3[_0xf407('0x98')]}});});return Promise[_0xf407('0x97')](_0x44560e);}});});});}})[_0xf407('0x48')](respondWithStatusCode(_0x4568c8,null))[_0xf407('0x4b')](handleError(_0x4568c8,null));};exports[_0xf407('0xa0')]=function(_0x37f499,_0x56e913,_0x54c68a){var _0x1c4f2b={};var _0x24ab60={};var _0x2080ab;var _0x795ce3;return db[_0xf407('0x33')]['findOne']({'where':{'id':_0x37f499[_0xf407('0x58')]['id']}})['then'](handleEntityNotFound(_0x56e913,null))[_0xf407('0x48')](function(_0x404cbf){if(_0x404cbf){_0x2080ab=_0x404cbf;_0x24ab60['model']=_[_0xf407('0x38')](db['User'][_0xf407('0x34')]);_0x24ab60['query']=_[_0xf407('0x38')](_0x37f499[_0xf407('0x39')]);_0x24ab60[_0xf407('0x42')]=_[_0xf407('0x3a')](_0x24ab60[_0xf407('0x37')],_0x24ab60[_0xf407('0x39')]);_0x1c4f2b[_0xf407('0x3b')]=_[_0xf407('0x3a')](_0x24ab60['model'],qs[_0xf407('0x3c')](_0x37f499['query']['fields']));_0x1c4f2b['attributes']=_0x1c4f2b['attributes'][_0xf407('0x3d')]?_0x1c4f2b[_0xf407('0x3b')]:_0x24ab60[_0xf407('0x37')];_0x1c4f2b[_0xf407('0x7a')]=qs['sort'](_0x37f499[_0xf407('0x39')][_0xf407('0x40')]);_0x1c4f2b[_0xf407('0x41')]=qs[_0xf407('0x42')](_[_0xf407('0x43')](_0x37f499[_0xf407('0x39')],_0x24ab60[_0xf407('0x42')]));if(_0x37f499[_0xf407('0x39')]['filter']){_0x1c4f2b[_0xf407('0x41')]=_[_0xf407('0x45')](_0x1c4f2b[_0xf407('0x41')],{'$or':_['map'](_0x1c4f2b['attributes'],function(_0x352fff){var _0x3f6c36={};_0x3f6c36[_0x352fff]={'$like':'%'+_0x37f499['query'][_0xf407('0x44')]+'%'};return _0x3f6c36;})});}_0x1c4f2b=_['merge']({},_0x1c4f2b,_0x37f499['options']);return _0x2080ab['getAgents'](_0x1c4f2b);}})[_0xf407('0x48')](function(_0x482986){if(_0x482986){_0x795ce3=_0x482986['length'];if(!_0x37f499[_0xf407('0x39')][_0xf407('0x3e')](_0xf407('0x3f'))){_0x1c4f2b[_0xf407('0x26')]=qs[_0xf407('0x26')](_0x37f499[_0xf407('0x39')][_0xf407('0x26')]);_0x1c4f2b[_0xf407('0x23')]=qs['offset'](_0x37f499[_0xf407('0x39')][_0xf407('0x23')]);}return _0x2080ab['getAgents'](_0x1c4f2b);}})[_0xf407('0x48')](function(_0x51f8a2){if(_0x51f8a2){return _0x51f8a2?{'count':_0x795ce3,'rows':_0x51f8a2}:null;}})[_0xf407('0x48')](respondWithResult(_0x56e913,null))[_0xf407('0x4b')](handleError(_0x56e913,null));}; \ No newline at end of file +var _0x2ba0=['remove','isArray','Voice','Chat','Mail','Fax','Openchannel','Whatsapp','through','QueueId','TeamVoiceQueue','penalty','User','Queue','findOrCreate','emit','Queue:save','voicePause','interface','UserVoiceQueueRt','upsert','isNil','format','SIP/%s','all','UserVoicePrefix','removeAgents','getAgents','order','hasOwnProperty','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/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/environment','../../config/license/util','redis','defaults','localhost','socket.io-emitter','./team.socket','register','sendStatus','status','end','json','offset','limit','undefined','count','set','apply','save','then','error','stack','name','send','Team','fieldName','type','key','model','map','query','keys','intersection','attributes','fields','length','nolimit','sort','where','pick','filters','filter','merge','VIRTUAL','includeAll','include','findAll','rows','show','params','rawAttributes','options','find','catch','create','body','user','get','Unable\x20to\x20retrieve\x20the\x20current\x20user','role','Teams','UserProfileSection','userProfileId','UserProfileResource','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','update','destroy','sequelize','transaction','SELECT\x20UserId\x20FROM\x20user_has_teams\x20WHERE\x20TeamId\x20=\x20','Sequelize','QueryTypes','UserId','SELECT','VoiceQueueId','UserVoiceQueue','MailQueueId','UserMailQueue','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','SELECT\x20WhatsappQueueId\x20FROM\x20team_has_whatsapp_queues\x20WHERE\x20TeamId\x20=\x20','WhatsappQueueId','UserWhatsappQueue','TeamVoicePrefix','VoicePrefixId','findOne','channel','isValidChannel','ValidationError','Unknown\x20channel','capitalize','toLowerCase','Queues','add','ids'];(function(_0xa1e3e3,_0x29fe0e){var _0xc980e9=function(_0x1f5adc){while(--_0x1f5adc){_0xa1e3e3['push'](_0xa1e3e3['shift']());}};_0xc980e9(++_0x29fe0e);}(_0x2ba0,0x15e));var _0x02ba=function(_0x1bb965,_0x4a1aa0){_0x1bb965=_0x1bb965-0x0;var _0x5c6968=_0x2ba0[_0x1bb965];return _0x5c6968;};'use strict';var emlformat=require(_0x02ba('0x0'));var rimraf=require(_0x02ba('0x1'));var zipdir=require(_0x02ba('0x2'));var jsonpatch=require(_0x02ba('0x3'));var rp=require(_0x02ba('0x4'));var moment=require(_0x02ba('0x5'));var BPromise=require(_0x02ba('0x6'));var Mustache=require(_0x02ba('0x7'));var util=require(_0x02ba('0x8'));var path=require(_0x02ba('0x9'));var sox=require(_0x02ba('0xa'));var csv=require(_0x02ba('0xb'));var ejs=require(_0x02ba('0xc'));var fs=require('fs');var fs_extra=require(_0x02ba('0xd'));var _=require(_0x02ba('0xe'));var squel=require(_0x02ba('0xf'));var crypto=require(_0x02ba('0x10'));var jsforce=require('jsforce');var deskjs=require(_0x02ba('0x11'));var toCsv=require('to-csv');var querystring=require(_0x02ba('0x12'));var Papa=require(_0x02ba('0x13'));var Redis=require(_0x02ba('0x14'));var authService=require(_0x02ba('0x15'));var qs=require('../../components/parsers/qs');var as=require(_0x02ba('0x16'));var hardwareService=require(_0x02ba('0x17'));var logger=require(_0x02ba('0x18'))(_0x02ba('0x19'));var utils=require(_0x02ba('0x1a'));var config=require(_0x02ba('0x1b'));var licenseUtil=require(_0x02ba('0x1c'));var db=require('../../mysqldb')['db'];config[_0x02ba('0x1d')]=_[_0x02ba('0x1e')](config[_0x02ba('0x1d')],{'host':_0x02ba('0x1f'),'port':0x18eb});var socket=require(_0x02ba('0x20'))(new Redis(config[_0x02ba('0x1d')]));require(_0x02ba('0x21'))[_0x02ba('0x22')](socket);function respondWithStatusCode(_0x2e553f,_0x188c77){_0x188c77=_0x188c77||0xcc;return function(_0x29e372){if(_0x29e372){return _0x2e553f[_0x02ba('0x23')](_0x188c77);}return _0x2e553f[_0x02ba('0x24')](_0x188c77)[_0x02ba('0x25')]();};}function respondWithResult(_0x1fdf73,_0x17aee5){_0x17aee5=_0x17aee5||0xc8;return function(_0x31beb5){if(_0x31beb5){return _0x1fdf73[_0x02ba('0x24')](_0x17aee5)[_0x02ba('0x26')](_0x31beb5);}};}function respondWithFilteredResult(_0x1d7654,_0x42dd73){return function(_0x13e2ec){if(_0x13e2ec){var _0xe271fa=typeof _0x42dd73[_0x02ba('0x27')]==='undefined'&&typeof _0x42dd73[_0x02ba('0x28')]===_0x02ba('0x29');var _0x5b87b0=_0x13e2ec[_0x02ba('0x2a')];var _0x546a05=_0xe271fa?0x0:_0x42dd73['offset'];var _0x486465=_0xe271fa?_0x13e2ec['count']:_0x42dd73['offset']+_0x42dd73[_0x02ba('0x28')];var _0x19b0d3;if(_0x486465>=_0x5b87b0){_0x486465=_0x5b87b0;_0x19b0d3=0xc8;}else{_0x19b0d3=0xce;}_0x1d7654['status'](_0x19b0d3);return _0x1d7654[_0x02ba('0x2b')]('Content-Range',_0x546a05+'-'+_0x486465+'/'+_0x5b87b0)[_0x02ba('0x26')](_0x13e2ec);}return null;};}function patchUpdates(_0x36c34e){return function(_0x3fe5ee){try{jsonpatch[_0x02ba('0x2c')](_0x3fe5ee,_0x36c34e,!![]);}catch(_0xfea156){return BPromise['reject'](_0xfea156);}return _0x3fe5ee[_0x02ba('0x2d')]();};}function saveUpdates(_0x1f3023,_0x37e6b1){return function(_0x6302c0){if(_0x6302c0){return _0x6302c0['update'](_0x1f3023)[_0x02ba('0x2e')](function(_0x4ecc7a){return _0x4ecc7a;});}return null;};}function handleEntityNotFound(_0x15e4a0,_0x308b52){return function(_0x1ca0b4){if(!_0x1ca0b4){_0x15e4a0[_0x02ba('0x23')](0x194);}return _0x1ca0b4;};}function handleError(_0x288973,_0x265931){_0x265931=_0x265931||0x1f4;return function(_0x3ed9f1){logger[_0x02ba('0x2f')](_0x3ed9f1[_0x02ba('0x30')]);if(_0x3ed9f1['name']){delete _0x3ed9f1[_0x02ba('0x31')];}_0x288973[_0x02ba('0x24')](_0x265931)[_0x02ba('0x32')](_0x3ed9f1);};}exports['index']=function(_0x3913bd,_0x5575fa){var _0x5b38c4={},_0x5d6383={},_0x538c55={'count':0x0,'rows':[]};var _0xce404e=_['map'](db[_0x02ba('0x33')]['rawAttributes'],function(_0x1745e8){return{'name':_0x1745e8[_0x02ba('0x34')],'type':_0x1745e8[_0x02ba('0x35')][_0x02ba('0x36')]};});_0x5d6383[_0x02ba('0x37')]=_[_0x02ba('0x38')](_0xce404e,'name');_0x5d6383[_0x02ba('0x39')]=_[_0x02ba('0x3a')](_0x3913bd[_0x02ba('0x39')]);_0x5d6383['filters']=_[_0x02ba('0x3b')](_0x5d6383[_0x02ba('0x37')],_0x5d6383[_0x02ba('0x39')]);_0x5b38c4[_0x02ba('0x3c')]=_[_0x02ba('0x3b')](_0x5d6383[_0x02ba('0x37')],qs['fields'](_0x3913bd['query'][_0x02ba('0x3d')]));_0x5b38c4['attributes']=_0x5b38c4[_0x02ba('0x3c')][_0x02ba('0x3e')]?_0x5b38c4[_0x02ba('0x3c')]:_0x5d6383[_0x02ba('0x37')];if(!_0x3913bd[_0x02ba('0x39')]['hasOwnProperty'](_0x02ba('0x3f'))){_0x5b38c4['limit']=qs['limit'](_0x3913bd['query'][_0x02ba('0x28')]);_0x5b38c4[_0x02ba('0x27')]=qs[_0x02ba('0x27')](_0x3913bd[_0x02ba('0x39')][_0x02ba('0x27')]);}_0x5b38c4['order']=qs[_0x02ba('0x40')](_0x3913bd['query']['sort']);_0x5b38c4[_0x02ba('0x41')]=qs['filters'](_[_0x02ba('0x42')](_0x3913bd[_0x02ba('0x39')],_0x5d6383[_0x02ba('0x43')]),_0xce404e);if(_0x3913bd[_0x02ba('0x39')][_0x02ba('0x44')]){_0x5b38c4[_0x02ba('0x41')]=_[_0x02ba('0x45')](_0x5b38c4[_0x02ba('0x41')],{'$or':_[_0x02ba('0x38')](_0xce404e,function(_0x31a6a3){if(_0x31a6a3[_0x02ba('0x35')]!==_0x02ba('0x46')){var _0x8b1b1c={};_0x8b1b1c[_0x31a6a3[_0x02ba('0x31')]]={'$like':'%'+_0x3913bd[_0x02ba('0x39')][_0x02ba('0x44')]+'%'};return _0x8b1b1c;}})});}_0x5b38c4=_['merge']({},_0x5b38c4,_0x3913bd['options']);var _0xf94fdd={'where':_0x5b38c4[_0x02ba('0x41')]};return db['Team']['count'](_0xf94fdd)['then'](function(_0x15927c){_0x538c55[_0x02ba('0x2a')]=_0x15927c;if(_0x3913bd[_0x02ba('0x39')][_0x02ba('0x47')]){_0x5b38c4[_0x02ba('0x48')]=[{'all':!![]}];}return db['Team'][_0x02ba('0x49')](_0x5b38c4);})[_0x02ba('0x2e')](function(_0x3d35db){_0x538c55[_0x02ba('0x4a')]=_0x3d35db;return _0x538c55;})['then'](respondWithFilteredResult(_0x5575fa,_0x5b38c4))['catch'](handleError(_0x5575fa,null));};exports[_0x02ba('0x4b')]=function(_0x38b2d0,_0x498f17){var _0x3bc898={'raw':![],'where':{'id':_0x38b2d0[_0x02ba('0x4c')]['id']}},_0x535c10={};_0x535c10[_0x02ba('0x37')]=_[_0x02ba('0x3a')](db['Team'][_0x02ba('0x4d')]);_0x535c10[_0x02ba('0x39')]=_[_0x02ba('0x3a')](_0x38b2d0[_0x02ba('0x39')]);_0x535c10['filters']=_[_0x02ba('0x3b')](_0x535c10[_0x02ba('0x37')],_0x535c10[_0x02ba('0x39')]);_0x3bc898['attributes']=_[_0x02ba('0x3b')](_0x535c10[_0x02ba('0x37')],qs[_0x02ba('0x3d')](_0x38b2d0[_0x02ba('0x39')][_0x02ba('0x3d')]));_0x3bc898[_0x02ba('0x3c')]=_0x3bc898[_0x02ba('0x3c')][_0x02ba('0x3e')]?_0x3bc898[_0x02ba('0x3c')]:_0x535c10[_0x02ba('0x37')];if(_0x38b2d0[_0x02ba('0x39')]['includeAll']){_0x3bc898['include']=[{'all':!![]}];}_0x3bc898=_[_0x02ba('0x45')]({},_0x3bc898,_0x38b2d0[_0x02ba('0x4e')]);return db[_0x02ba('0x33')][_0x02ba('0x4f')](_0x3bc898)[_0x02ba('0x2e')](handleEntityNotFound(_0x498f17,null))[_0x02ba('0x2e')](respondWithResult(_0x498f17,null))[_0x02ba('0x50')](handleError(_0x498f17,null));};exports[_0x02ba('0x51')]=function(_0x57c77c,_0x134f56){return db[_0x02ba('0x33')][_0x02ba('0x51')](_0x57c77c[_0x02ba('0x52')],{})[_0x02ba('0x2e')](function(_0x3865a9){var _0x5cd6bf=_0x57c77c[_0x02ba('0x53')][_0x02ba('0x54')]({'plain':!![]});if(!_0x5cd6bf)throw new Error(_0x02ba('0x55'));if(_0x5cd6bf[_0x02ba('0x56')]===_0x02ba('0x53')){var _0x2667ae=_0x3865a9[_0x02ba('0x54')]({'plain':!![]});var _0x277a61=_0x02ba('0x57');return db[_0x02ba('0x58')]['find']({'where':{'name':_0x277a61,'userProfileId':_0x5cd6bf[_0x02ba('0x59')]},'raw':!![]})[_0x02ba('0x2e')](function(_0x4f90de){if(_0x4f90de&&_0x4f90de['autoAssociation']===0x0){return db[_0x02ba('0x5a')][_0x02ba('0x51')]({'name':_0x2667ae[_0x02ba('0x31')],'resourceId':_0x2667ae['id'],'type':_0x4f90de[_0x02ba('0x31')],'sectionId':_0x4f90de['id']},{})[_0x02ba('0x2e')](function(){return _0x3865a9;});}else{return _0x3865a9;}})[_0x02ba('0x50')](function(_0x358c66){logger[_0x02ba('0x2f')](_0x02ba('0x5b'),_0x358c66);throw _0x358c66;});}return _0x3865a9;})[_0x02ba('0x2e')](respondWithResult(_0x134f56,0xc9))[_0x02ba('0x50')](handleError(_0x134f56,null));};exports[_0x02ba('0x5c')]=function(_0xbb3a6d,_0x2f83ea){if(_0xbb3a6d[_0x02ba('0x52')]['id']){delete _0xbb3a6d[_0x02ba('0x52')]['id'];}return db[_0x02ba('0x33')][_0x02ba('0x4f')]({'where':{'id':_0xbb3a6d['params']['id']}})['then'](handleEntityNotFound(_0x2f83ea,null))[_0x02ba('0x2e')](saveUpdates(_0xbb3a6d[_0x02ba('0x52')],null))[_0x02ba('0x2e')](respondWithResult(_0x2f83ea,null))['catch'](handleError(_0x2f83ea,null));};exports[_0x02ba('0x5d')]=function(_0x4f9d8d,_0x3b234c){var _0xd27e10=_0x4f9d8d[_0x02ba('0x4c')]['id'];var _0x3a23cf=[];return db[_0x02ba('0x5e')][_0x02ba('0x5f')](function(_0x5c4586){var _0x5bb314=_0x02ba('0x60')+_0xd27e10;return db[_0x02ba('0x5e')]['query'](_0x5bb314,{'type':db[_0x02ba('0x61')][_0x02ba('0x62')]['SELECT'],'raw':!![],'transaction':_0x5c4586})[_0x02ba('0x2e')](function(_0x176fd2){_0x3a23cf=_[_0x02ba('0x38')](_0x176fd2,function(_0x599397){return Number(_0x599397[_0x02ba('0x63')]);});})[_0x02ba('0x2e')](function(){var _0xd91ed8='SELECT\x20VoiceQueueId\x20FROM\x20team_has_voice_queues\x20WHERE\x20TeamId\x20=\x20'+_0xd27e10;return db[_0x02ba('0x5e')][_0x02ba('0x39')](_0xd91ed8,{'type':db[_0x02ba('0x61')][_0x02ba('0x62')][_0x02ba('0x64')],'raw':!![],'transaction':_0x5c4586});})['then'](function(_0x4b7e5e){var _0x4cde19=_[_0x02ba('0x38')](_0x4b7e5e,function(_0x351dff){return Number(_0x351dff[_0x02ba('0x65')]);});return db[_0x02ba('0x66')][_0x02ba('0x5d')]({'where':{'UserId':{'$in':_0x3a23cf},'VoiceQueueId':{'$in':_0x4cde19}},'transaction':_0x5c4586});})[_0x02ba('0x2e')](function(){var _0x18a5c6='SELECT\x20MailQueueId\x20FROM\x20team_has_mail_queues\x20WHERE\x20TeamId\x20=\x20'+_0xd27e10;return db[_0x02ba('0x5e')][_0x02ba('0x39')](_0x18a5c6,{'type':db['Sequelize'][_0x02ba('0x62')][_0x02ba('0x64')],'raw':!![],'transaction':_0x5c4586});})['then'](function(_0x47ed38){var _0x59ba7f=_['map'](_0x47ed38,function(_0x2fb3fa){return Number(_0x2fb3fa[_0x02ba('0x67')]);});return db[_0x02ba('0x68')][_0x02ba('0x5d')]({'where':{'UserId':{'$in':_0x3a23cf},'MailQueueId':{'$in':_0x59ba7f}},'transaction':_0x5c4586});})['then'](function(){var _0x457c4b='SELECT\x20SmsQueueId\x20FROM\x20team_has_sms_queues\x20WHERE\x20TeamId\x20=\x20'+_0xd27e10;return db[_0x02ba('0x5e')][_0x02ba('0x39')](_0x457c4b,{'type':db[_0x02ba('0x61')]['QueryTypes'][_0x02ba('0x64')],'raw':!![],'transaction':_0x5c4586});})['then'](function(_0x5488d0){var _0x2477b3=_[_0x02ba('0x38')](_0x5488d0,function(_0x56484d){return Number(_0x56484d[_0x02ba('0x69')]);});return db[_0x02ba('0x6a')][_0x02ba('0x5d')]({'where':{'UserId':{'$in':_0x3a23cf},'SmsQueueId':{'$in':_0x2477b3}},'transaction':_0x5c4586});})[_0x02ba('0x2e')](function(){var _0x9b9935=_0x02ba('0x6b')+_0xd27e10;return db[_0x02ba('0x5e')][_0x02ba('0x39')](_0x9b9935,{'type':db['Sequelize']['QueryTypes'][_0x02ba('0x64')],'raw':!![],'transaction':_0x5c4586});})['then'](function(_0x2cb1c6){var _0x586785=_['map'](_0x2cb1c6,function(_0x4c85d7){return Number(_0x4c85d7[_0x02ba('0x6c')]);});return db[_0x02ba('0x6d')][_0x02ba('0x5d')]({'where':{'UserId':{'$in':_0x3a23cf},'ChatQueueId':{'$in':_0x586785}},'transaction':_0x5c4586});})[_0x02ba('0x2e')](function(){var _0x4dcdab='SELECT\x20FaxQueueId\x20FROM\x20team_has_fax_queues\x20WHERE\x20TeamId\x20=\x20'+_0xd27e10;return db[_0x02ba('0x5e')][_0x02ba('0x39')](_0x4dcdab,{'type':db[_0x02ba('0x61')][_0x02ba('0x62')][_0x02ba('0x64')],'raw':!![],'transaction':_0x5c4586});})[_0x02ba('0x2e')](function(_0x4e0555){var _0x391df6=_[_0x02ba('0x38')](_0x4e0555,function(_0x5a8f6c){return Number(_0x5a8f6c[_0x02ba('0x6e')]);});return db[_0x02ba('0x6f')]['destroy']({'where':{'UserId':{'$in':_0x3a23cf},'FaxQueueId':{'$in':_0x391df6}},'transaction':_0x5c4586});})[_0x02ba('0x2e')](function(){var _0x309703=_0x02ba('0x70')+_0xd27e10;return db[_0x02ba('0x5e')][_0x02ba('0x39')](_0x309703,{'type':db[_0x02ba('0x61')][_0x02ba('0x62')][_0x02ba('0x64')],'raw':!![],'transaction':_0x5c4586});})[_0x02ba('0x2e')](function(_0x3b41fc){var _0x490158=_['map'](_0x3b41fc,function(_0x739cb0){return Number(_0x739cb0[_0x02ba('0x71')]);});return db[_0x02ba('0x72')][_0x02ba('0x5d')]({'where':{'UserId':{'$in':_0x3a23cf},'OpenchannelQueueId':{'$in':_0x490158}},'transaction':_0x5c4586});})['then'](function(){var _0x4a361c=_0x02ba('0x73')+_0xd27e10;return db[_0x02ba('0x5e')]['query'](_0x4a361c,{'type':db[_0x02ba('0x61')][_0x02ba('0x62')][_0x02ba('0x64')],'raw':!![],'transaction':_0x5c4586});})[_0x02ba('0x2e')](function(_0x76bc71){var _0x1bce47=_[_0x02ba('0x38')](_0x76bc71,function(_0xf7bada){return Number(_0xf7bada[_0x02ba('0x74')]);});return db[_0x02ba('0x75')]['destroy']({'where':{'UserId':{'$in':_0x3a23cf},'WhatsappQueueId':{'$in':_0x1bce47}},'transaction':_0x5c4586});})[_0x02ba('0x2e')](function(){return db[_0x02ba('0x76')]['find']({'where':{'TeamId':_0xd27e10}});})[_0x02ba('0x2e')](function(_0x4f6a63){if(_0x4f6a63===null){return;}return db['UserVoicePrefix'][_0x02ba('0x5d')]({'where':{'UserId':{'$in':_0x3a23cf},'VoicePrefixId':_0x4f6a63[_0x02ba('0x77')]},'transaction':_0x5c4586});})[_0x02ba('0x2e')](function(){return db[_0x02ba('0x33')]['destroy']({'where':{'id':_0xd27e10},'cascade':!![],'transaction':_0x5c4586});})[_0x02ba('0x2e')](function(_0x30f44d){if(_0x30f44d===0x0){_0x3b234c['sendStatus'](0x194);}else{return db[_0x02ba('0x5a')]['destroy']({'where':{'type':_0x02ba('0x57'),'resourceId':_0xd27e10},'cascade':!![],'transaction':_0x5c4586})[_0x02ba('0x2e')](function(){_0x3b234c[_0x02ba('0x24')](0xcc)['end']();});}})['catch'](function(_0x5a1241){_0x3b234c[_0x02ba('0x24')](0x1f4)[_0x02ba('0x32')](_0x5a1241);});});};exports['getQueues']=function(_0x529492,_0x2fa801,_0x159bb1){return db[_0x02ba('0x33')][_0x02ba('0x78')]({'where':{'id':_0x529492[_0x02ba('0x4c')]['id']}})[_0x02ba('0x2e')](handleEntityNotFound(_0x2fa801,null))[_0x02ba('0x2e')](function(_0x3924a6){if(!_0x529492[_0x02ba('0x39')][_0x02ba('0x79')]||!utils[_0x02ba('0x7a')](_0x529492[_0x02ba('0x39')][_0x02ba('0x79')])){throw new db[(_0x02ba('0x61'))][(_0x02ba('0x7b'))](_0x02ba('0x7c'));}var _0x63fe26={};var _0x20cfcd={};_0x20cfcd[_0x02ba('0x37')]=_['keys'](db[_[_0x02ba('0x7d')](_0x529492[_0x02ba('0x39')][_0x02ba('0x79')][_0x02ba('0x7e')]())+'Queue'][_0x02ba('0x4d')]);_0x20cfcd[_0x02ba('0x39')]=_['keys'](_0x529492[_0x02ba('0x39')]);_0x20cfcd[_0x02ba('0x43')]=_[_0x02ba('0x3b')](_0x20cfcd[_0x02ba('0x37')],_0x20cfcd[_0x02ba('0x39')]);_0x63fe26[_0x02ba('0x3c')]=_[_0x02ba('0x3b')](_0x20cfcd[_0x02ba('0x37')],qs[_0x02ba('0x3d')](_0x529492[_0x02ba('0x39')][_0x02ba('0x3d')]));_0x63fe26[_0x02ba('0x3c')]=_0x63fe26['attributes'][_0x02ba('0x3e')]?_0x63fe26[_0x02ba('0x3c')]:_0x20cfcd[_0x02ba('0x37')];_0x63fe26[_0x02ba('0x28')]=qs[_0x02ba('0x28')](_0x529492[_0x02ba('0x39')][_0x02ba('0x28')]);_0x63fe26[_0x02ba('0x27')]=qs[_0x02ba('0x27')](_0x529492[_0x02ba('0x39')][_0x02ba('0x27')]);_0x63fe26['order']=qs[_0x02ba('0x40')](_0x529492[_0x02ba('0x39')][_0x02ba('0x40')]);_0x63fe26['where']=qs[_0x02ba('0x43')](_[_0x02ba('0x42')](_0x529492[_0x02ba('0x39')],_0x20cfcd[_0x02ba('0x43')]));_0x63fe26=_['merge']({},_0x63fe26,_0x529492[_0x02ba('0x4e')]);return _0x3924a6[_0x02ba('0x54')+_[_0x02ba('0x7d')](_0x529492[_0x02ba('0x39')][_0x02ba('0x79')][_0x02ba('0x7e')]())+_0x02ba('0x7f')](_0x63fe26);})[_0x02ba('0x2e')](respondWithResult(_0x2fa801,null))[_0x02ba('0x50')](handleError(_0x2fa801,null));};exports['addQueues']=function(_0x7a1386,_0x184bfd,_0x50ade7){return db[_0x02ba('0x33')][_0x02ba('0x78')]({'where':{'id':_0x7a1386[_0x02ba('0x4c')]['id']}})[_0x02ba('0x2e')](function(_0x5407b4){if(_0x5407b4){if(!_0x7a1386[_0x02ba('0x52')][_0x02ba('0x79')]||!utils[_0x02ba('0x7a')](_0x7a1386['body'][_0x02ba('0x79')])){throw new db[(_0x02ba('0x61'))][(_0x02ba('0x7b'))](_0x02ba('0x7c'));}return _0x5407b4[_0x02ba('0x80')+_['capitalize'](_0x7a1386[_0x02ba('0x52')][_0x02ba('0x79')][_0x02ba('0x7e')]())+_0x02ba('0x7f')](_0x7a1386[_0x02ba('0x52')][_0x02ba('0x81')]);}return null;})['then'](handleEntityNotFound(_0x184bfd,null))['then'](respondWithStatusCode(_0x184bfd,null))[_0x02ba('0x50')](handleError(_0x184bfd,null));};exports['removeQueues']=function(_0xd56140,_0x3f4d60,_0x276076){return db[_0x02ba('0x33')]['findOne']({'where':{'id':_0xd56140[_0x02ba('0x4c')]['id']}})[_0x02ba('0x2e')](function(_0x435ddc){if(_0x435ddc){if(!_0xd56140[_0x02ba('0x39')]['channel']||!utils['isValidChannel'](_0xd56140[_0x02ba('0x39')][_0x02ba('0x79')])){throw new db[(_0x02ba('0x61'))][(_0x02ba('0x7b'))](_0x02ba('0x7c'));}return _0x435ddc[_0x02ba('0x82')+_[_0x02ba('0x7d')](_0xd56140[_0x02ba('0x39')][_0x02ba('0x79')]['toLowerCase']())+'Queues'](_0xd56140[_0x02ba('0x39')][_0x02ba('0x81')]);}return null;})[_0x02ba('0x2e')](handleEntityNotFound(_0x3f4d60,null))[_0x02ba('0x2e')](respondWithStatusCode(_0x3f4d60,null))['catch'](handleError(_0x3f4d60,null));};exports['addAgents']=function(_0x518d69,_0x57883d){var _0x552d42=_[_0x02ba('0x83')](_0x518d69['body'][_0x02ba('0x81')])?_0x518d69[_0x02ba('0x52')][_0x02ba('0x81')]:[_0x518d69[_0x02ba('0x52')]['ids']];var _0x3ecaf9=_0x518d69['params']['id'];return db['Team']['find']({'where':{'id':_0x3ecaf9}})[_0x02ba('0x2e')](handleEntityNotFound(_0x57883d,null))['then'](function(_0x3fd662){if(_0x3fd662){var _0x2323f1=[_0x02ba('0x84'),_0x02ba('0x85'),_0x02ba('0x86'),'Sms',_0x02ba('0x87'),_0x02ba('0x88'),_0x02ba('0x89')];return db[_0x02ba('0x5e')][_0x02ba('0x5f')](function(_0x5ad2a0){var _0x19787c=_[_0x02ba('0x38')](_0x2323f1,function(_0x55953b){var _0x23827a={'attributes':['id','name']};if(_0x55953b===_0x02ba('0x84')){_0x23827a[_0x02ba('0x8a')]={'attributes':['penalty']};}return _0x3fd662[_0x02ba('0x54')+_0x55953b+_0x02ba('0x7f')](_0x23827a)[_0x02ba('0x2e')](function(_0x14eb9b){var _0x221a63=_['map'](_0x14eb9b,function(_0x36313d){var _0x3354f6=_[_0x02ba('0x38')](_0x552d42,function(_0xad504d){var _0x219bf2={'where':{'UserId':_0xad504d,[_0x55953b+_0x02ba('0x8b')]:_0x36313d['id']},'transaction':_0x5ad2a0};if(_0x55953b===_0x02ba('0x84')){_0x219bf2[_0x02ba('0x1e')]={'penalty':_0x36313d[_0x02ba('0x8c')][_0x02ba('0x8d')]};}return db[_0x02ba('0x8e')+_0x55953b+_0x02ba('0x8f')][_0x02ba('0x90')](_0x219bf2)[_0x02ba('0x2e')](function(){socket[_0x02ba('0x91')]('user'+_0x55953b+_0x02ba('0x92'),{'UserId':_0xad504d,[_0x55953b+_0x02ba('0x8b')]:_0x36313d['id']});if(_0x55953b!==_0x02ba('0x84')){return;}return db['User'][_0x02ba('0x49')]({'where':{'id':_0x552d42,'online':0x1},'attributes':['id',_0x02ba('0x31'),'online',_0x02ba('0x93'),_0x02ba('0x94')],'raw':!![]})[_0x02ba('0x2e')](function(_0x15a0b8){var _0x543c99=_[_0x02ba('0x38')](_0x15a0b8,function(_0x181567){return db[_0x02ba('0x95')][_0x02ba('0x96')]({'membername':_0x181567[_0x02ba('0x31')],'UserId':_0x181567['id'],'queue_name':_0x36313d['name'],'VoiceQueueId':_0x36313d['id'],'interface':_[_0x02ba('0x97')](_0x181567[_0x02ba('0x94')])?util[_0x02ba('0x98')](_0x02ba('0x99'),_0x181567[_0x02ba('0x31')]):_0x181567[_0x02ba('0x94')],'paused':_0x181567[_0x02ba('0x93')]||![],'penalty':_0x36313d['TeamVoiceQueue'][_0x02ba('0x8d')]},{'transaction':_0x5ad2a0});});return Promise[_0x02ba('0x9a')](_0x543c99);});});});return Promise[_0x02ba('0x9a')](_0x3354f6);});return Promise[_0x02ba('0x9a')](_0x221a63);})[_0x02ba('0x2e')](function(){return db[_0x02ba('0x76')][_0x02ba('0x78')]({'where':{'teamId':_0x3ecaf9}})[_0x02ba('0x2e')](function(_0x3029ad){if(_0x3029ad){var _0x6acccd=_[_0x02ba('0x38')](_0x552d42,function(_0x1f7f61){db[_0x02ba('0x9b')]['upsert']({'UserId':_0x1f7f61,'VoicePrefixId':_0x3029ad[_0x02ba('0x77')]});});return Promise[_0x02ba('0x9a')](_0x6acccd);}});});});return Promise['all'](_0x19787c)['then'](function(){return _0x3fd662['addAgents'](_0x552d42,{'transaction':_0x5ad2a0})['spread'](function(_0x5eb9a4){return _0x5eb9a4;});});});}})[_0x02ba('0x2e')](respondWithResult(_0x57883d,null))[_0x02ba('0x50')](handleError(_0x57883d,null));};exports['removeAgents']=function(_0x149ee3,_0xf5e559){var _0x4f514c=_[_0x02ba('0x83')](_0x149ee3['query'][_0x02ba('0x81')])?_0x149ee3['query'][_0x02ba('0x81')]:[_0x149ee3[_0x02ba('0x39')][_0x02ba('0x81')]];var _0x2b82c5=_0x149ee3[_0x02ba('0x4c')]['id'];return db[_0x02ba('0x33')][_0x02ba('0x4f')]({'where':{'id':_0x2b82c5}})[_0x02ba('0x2e')](handleEntityNotFound(_0xf5e559,null))[_0x02ba('0x2e')](function(_0x2cdbfe){if(_0x2cdbfe){var _0x4c165c=['Voice','Chat',_0x02ba('0x86'),'Sms',_0x02ba('0x87'),_0x02ba('0x88'),_0x02ba('0x89')];return db[_0x02ba('0x5e')][_0x02ba('0x5f')](function(_0x227c39){var _0x32cb6e=_['map'](_0x4c165c,function(_0x3a9a4d){var _0x10f559={'attributes':['id','name']};return _0x2cdbfe[_0x02ba('0x54')+_0x3a9a4d+'Queues'](_0x10f559)[_0x02ba('0x2e')](function(_0x2af0bb){var _0x29177d=_[_0x02ba('0x38')](_0x2af0bb,function(_0x7403f9){return _0x7403f9[_0x02ba('0x9c')](_0x4f514c,{'transaction':_0x227c39})[_0x02ba('0x2e')](function(){var _0x2ebb54=_[_0x02ba('0x38')](_0x4f514c,function(_0x1bed2e){socket['emit'](_0x02ba('0x53')+_0x3a9a4d+'Queue:remove',{'UserId':Number(_0x1bed2e),[_0x3a9a4d+_0x02ba('0x8b')]:_0x7403f9['id']});if(_0x3a9a4d!==_0x02ba('0x84')){return;}return db[_0x02ba('0x95')]['destroy']({'where':{'VoiceQueueId':_0x7403f9['id'],'UserId':_0x1bed2e},'transaction':_0x227c39});});return Promise[_0x02ba('0x9a')](_0x2ebb54);});});return Promise['all'](_0x29177d);});});return Promise['all'](_0x32cb6e)[_0x02ba('0x2e')](function(){return _0x2cdbfe['removeAgents'](_0x4f514c,{'transaction':_0x227c39});})['then'](function(){return db[_0x02ba('0x76')][_0x02ba('0x78')]({'where':{'teamId':_0x2b82c5}})[_0x02ba('0x2e')](function(_0x992318){if(_0x992318){var _0x43f556=_[_0x02ba('0x38')](_0x4f514c,function(_0x3fe858){db[_0x02ba('0x9b')][_0x02ba('0x5d')]({'where':{'UserId':_0x3fe858,'VoicePrefixId':_0x992318[_0x02ba('0x77')]}});});return Promise[_0x02ba('0x9a')](_0x43f556);}});});});}})[_0x02ba('0x2e')](respondWithStatusCode(_0xf5e559,null))[_0x02ba('0x50')](handleError(_0xf5e559,null));};exports[_0x02ba('0x9d')]=function(_0x340e42,_0x441348,_0x5e12d8){var _0x3338a7={};var _0x57a9b0={};var _0x2c316a;var _0xd32f9e;return db[_0x02ba('0x33')][_0x02ba('0x78')]({'where':{'id':_0x340e42[_0x02ba('0x4c')]['id']}})[_0x02ba('0x2e')](handleEntityNotFound(_0x441348,null))[_0x02ba('0x2e')](function(_0x21a1d8){if(_0x21a1d8){_0x2c316a=_0x21a1d8;_0x57a9b0[_0x02ba('0x37')]=_[_0x02ba('0x3a')](db[_0x02ba('0x8e')][_0x02ba('0x4d')]);_0x57a9b0[_0x02ba('0x39')]=_[_0x02ba('0x3a')](_0x340e42[_0x02ba('0x39')]);_0x57a9b0[_0x02ba('0x43')]=_[_0x02ba('0x3b')](_0x57a9b0[_0x02ba('0x37')],_0x57a9b0[_0x02ba('0x39')]);_0x3338a7['attributes']=_[_0x02ba('0x3b')](_0x57a9b0[_0x02ba('0x37')],qs[_0x02ba('0x3d')](_0x340e42[_0x02ba('0x39')][_0x02ba('0x3d')]));_0x3338a7[_0x02ba('0x3c')]=_0x3338a7[_0x02ba('0x3c')][_0x02ba('0x3e')]?_0x3338a7[_0x02ba('0x3c')]:_0x57a9b0[_0x02ba('0x37')];_0x3338a7[_0x02ba('0x9e')]=qs[_0x02ba('0x40')](_0x340e42['query'][_0x02ba('0x40')]);_0x3338a7[_0x02ba('0x41')]=qs['filters'](_[_0x02ba('0x42')](_0x340e42[_0x02ba('0x39')],_0x57a9b0[_0x02ba('0x43')]));if(_0x340e42[_0x02ba('0x39')][_0x02ba('0x44')]){_0x3338a7[_0x02ba('0x41')]=_['merge'](_0x3338a7[_0x02ba('0x41')],{'$or':_['map'](_0x3338a7[_0x02ba('0x3c')],function(_0x57223c){var _0x590684={};_0x590684[_0x57223c]={'$like':'%'+_0x340e42[_0x02ba('0x39')]['filter']+'%'};return _0x590684;})});}_0x3338a7=_[_0x02ba('0x45')]({},_0x3338a7,_0x340e42['options']);return _0x2c316a[_0x02ba('0x9d')](_0x3338a7);}})[_0x02ba('0x2e')](function(_0x4f291c){if(_0x4f291c){_0xd32f9e=_0x4f291c[_0x02ba('0x3e')];if(!_0x340e42[_0x02ba('0x39')][_0x02ba('0x9f')](_0x02ba('0x3f'))){_0x3338a7[_0x02ba('0x28')]=qs['limit'](_0x340e42[_0x02ba('0x39')][_0x02ba('0x28')]);_0x3338a7[_0x02ba('0x27')]=qs[_0x02ba('0x27')](_0x340e42['query'][_0x02ba('0x27')]);}return _0x2c316a[_0x02ba('0x9d')](_0x3338a7);}})[_0x02ba('0x2e')](function(_0x251e33){if(_0x251e33){return _0x251e33?{'count':_0xd32f9e,'rows':_0x251e33}:null;}})[_0x02ba('0x2e')](respondWithResult(_0x441348,null))[_0x02ba('0x50')](handleError(_0x441348,null));}; \ No newline at end of file diff --git a/server/api/team/team.events.js b/server/api/team/team.events.js index 7e927ee..0783eb7 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 _0xffb9=['Team','setMaxListeners','save','update','remove','hook','events'];(function(_0x219bca,_0xe5a6e5){var _0x5e3451=function(_0x29a891){while(--_0x29a891){_0x219bca['push'](_0x219bca['shift']());}};_0x5e3451(++_0xe5a6e5);}(_0xffb9,0x1db));var _0x9ffb=function(_0x325c90,_0xef1cd3){_0x325c90=_0x325c90-0x0;var _0x4edf7f=_0xffb9[_0x325c90];return _0x4edf7f;};'use strict';var EventEmitter=require(_0x9ffb('0x0'));var Team=require('../../mysqldb')['db'][_0x9ffb('0x1')];var TeamEvents=new EventEmitter();TeamEvents[_0x9ffb('0x2')](0x0);var events={'afterCreate':_0x9ffb('0x3'),'afterUpdate':_0x9ffb('0x4'),'afterDestroy':_0x9ffb('0x5')};function emitEvent(_0x44d1e7){return function(_0x102916,_0x5babe2,_0x1f51f5){TeamEvents['emit'](_0x44d1e7+':'+_0x102916['id'],_0x102916);TeamEvents['emit'](_0x44d1e7,_0x102916);_0x1f51f5(null);};}for(var e in events){if(events['hasOwnProperty'](e)){var event=events[e];Team[_0x9ffb('0x6')](e,emitEvent(event));}}module['exports']=TeamEvents; \ No newline at end of file +var _0xec89=['events','../../mysqldb','Team','setMaxListeners','save','remove','hasOwnProperty','exports'];(function(_0x1f3807,_0x4f7a50){var _0x48bd3f=function(_0x56ec97){while(--_0x56ec97){_0x1f3807['push'](_0x1f3807['shift']());}};_0x48bd3f(++_0x4f7a50);}(_0xec89,0xf8));var _0x9ec8=function(_0x41b8f9,_0x2bce4a){_0x41b8f9=_0x41b8f9-0x0;var _0x268d5f=_0xec89[_0x41b8f9];return _0x268d5f;};'use strict';var EventEmitter=require(_0x9ec8('0x0'));var Team=require(_0x9ec8('0x1'))['db'][_0x9ec8('0x2')];var TeamEvents=new EventEmitter();TeamEvents[_0x9ec8('0x3')](0x0);var events={'afterCreate':_0x9ec8('0x4'),'afterUpdate':'update','afterDestroy':_0x9ec8('0x5')};function emitEvent(_0x10147d){return function(_0x5078a0,_0x3a3041,_0x2c93bb){TeamEvents['emit'](_0x10147d+':'+_0x5078a0['id'],_0x5078a0);TeamEvents['emit'](_0x10147d,_0x5078a0);_0x2c93bb(null);};}for(var e in events){if(events[_0x9ec8('0x6')](e)){var event=events[e];Team['hook'](e,emitEvent(event));}}module[_0x9ec8('0x7')]=TeamEvents; \ No newline at end of file diff --git a/server/api/team/team.model.js b/server/api/team/team.model.js index cdf1406..05199c0 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 _0x6a36=['Whatsapp','resolve','all','lodash','get','Queues','then','map','setDataValue','channel','catch','exports','Team','teams','Fax','Openchannel'];(function(_0x1389ae,_0x1caf91){var _0x1514d4=function(_0x41bb97){while(--_0x41bb97){_0x1389ae['push'](_0x1389ae['shift']());}};_0x1514d4(++_0x1caf91);}(_0x6a36,0xc3));var _0x66a3=function(_0x57c73d,_0x38bf7f){_0x57c73d=_0x57c73d-0x0;var _0x2f2712=_0x6a36[_0x57c73d];return _0x2f2712;};'use strict';var _=require(_0x66a3('0x0'));var attributes=require('./team.attributes');function getQueuesByChannel(_0x19c408,_0x521c07){var _0xdd880b=_0x66a3('0x1')+_0x521c07+_0x66a3('0x2');return _0x19c408[_0xdd880b]()[_0x66a3('0x3')](function(_0x36edb9){return _[_0x66a3('0x4')](_0x36edb9,function(_0x1db048){_0x1db048[_0x66a3('0x5')](_0x66a3('0x6'),_0x521c07);return _0x1db048;});})[_0x66a3('0x7')](function(_0x2214e5){throw _0x2214e5;});}module[_0x66a3('0x8')]=function(_0x2e3e2d){return _0x2e3e2d['define'](_0x66a3('0x9'),attributes,{'tableName':_0x66a3('0xa'),'paranoid':![],'indexes':[],'timestamps':!![],'instanceMethods':{'getAssociatedQueues':function(){var _0x42a48f=this;var _0xdc54c3=['Chat',_0x66a3('0xb'),'Mail',_0x66a3('0xc'),'Sms','Voice',_0x66a3('0xd')];return Promise[_0x66a3('0xe')]()[_0x66a3('0x3')](function(){var _0x25877c=_[_0x66a3('0x4')](_0xdc54c3,function(_0x1168fe){return getQueuesByChannel(_0x42a48f,_0x1168fe);});return Promise[_0x66a3('0xf')](_0x25877c);})['catch'](function(_0x1d4c68){throw _0x1d4c68;});}}});}; \ No newline at end of file +var _0x5ce8=['all','catch','lodash','get','then','setDataValue','exports','Team','teams','Chat','Fax','Mail','Openchannel','Sms','Voice','resolve','map'];(function(_0x4dd049,_0x3b98ec){var _0x1715e9=function(_0x32354c){while(--_0x32354c){_0x4dd049['push'](_0x4dd049['shift']());}};_0x1715e9(++_0x3b98ec);}(_0x5ce8,0xbd));var _0x85ce=function(_0x5aa163,_0x2ba3b5){_0x5aa163=_0x5aa163-0x0;var _0x155b5e=_0x5ce8[_0x5aa163];return _0x155b5e;};'use strict';var _=require(_0x85ce('0x0'));var attributes=require('./team.attributes');function getQueuesByChannel(_0x5f2e85,_0x549673){var _0x420611=_0x85ce('0x1')+_0x549673+'Queues';return _0x5f2e85[_0x420611]()[_0x85ce('0x2')](function(_0x2a1b98){return _['map'](_0x2a1b98,function(_0x27d3cb){_0x27d3cb[_0x85ce('0x3')]('channel',_0x549673);return _0x27d3cb;});})['catch'](function(_0x5ee035){throw _0x5ee035;});}module[_0x85ce('0x4')]=function(_0x530af5){return _0x530af5['define'](_0x85ce('0x5'),attributes,{'tableName':_0x85ce('0x6'),'paranoid':![],'indexes':[],'timestamps':!![],'instanceMethods':{'getAssociatedQueues':function(){var _0x34c71a=this;var _0x4e5604=[_0x85ce('0x7'),_0x85ce('0x8'),_0x85ce('0x9'),_0x85ce('0xa'),_0x85ce('0xb'),_0x85ce('0xc'),'Whatsapp'];return Promise[_0x85ce('0xd')]()[_0x85ce('0x2')](function(){var _0x39534f=_[_0x85ce('0xe')](_0x4e5604,function(_0xdf479a){return getQueuesByChannel(_0x34c71a,_0xdf479a);});return Promise[_0x85ce('0xf')](_0x39534f);})[_0x85ce('0x10')](function(_0x50aaa8){throw _0x50aaa8;});}}});}; \ No newline at end of file diff --git a/server/api/team/team.rpc.js b/server/api/team/team.rpc.js index 174429e..a67e50a 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 _0x3e22=['socket.io-emitter','./team.socket','request','then','info','Team,\x20%s,\x20%s','request\x20sent','debug','stringify','error','code','message','result','lodash','util','bluebird','randomstring','ioredis','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','client','redis','defaults','localhost'];(function(_0x18de35,_0x45b68a){var _0x6a5533=function(_0x332b7a){while(--_0x332b7a){_0x18de35['push'](_0x18de35['shift']());}};_0x6a5533(++_0x45b68a);}(_0x3e22,0x11b));var _0x23e2=function(_0x1ed2af,_0x35b554){_0x1ed2af=_0x1ed2af-0x0;var _0x444c90=_0x3e22[_0x1ed2af];return _0x444c90;};'use strict';var _=require(_0x23e2('0x0'));var util=require(_0x23e2('0x1'));var moment=require('moment');var BPromise=require(_0x23e2('0x2'));var rs=require(_0x23e2('0x3'));var fs=require('fs');var Redis=require(_0x23e2('0x4'));var db=require('../../mysqldb')['db'];var utils=require(_0x23e2('0x5'));var logger=require(_0x23e2('0x6'))(_0x23e2('0x7'));var config=require(_0x23e2('0x8'));var jayson=require(_0x23e2('0x9'));var client=jayson[_0x23e2('0xa')]['http']({'port':0x232a});config[_0x23e2('0xb')]=_[_0x23e2('0xc')](config[_0x23e2('0xb')],{'host':_0x23e2('0xd'),'port':0x18eb});var socket=require(_0x23e2('0xe'))(new Redis(config[_0x23e2('0xb')]));require(_0x23e2('0xf'))['register'](socket);function respondWithRpcPromise(_0x4c65a1,_0x44e369,_0x249adc){return new BPromise(function(_0x550a0c,_0x3cda6c){return client[_0x23e2('0x10')](_0x4c65a1,_0x249adc)[_0x23e2('0x11')](function(_0x4f02fd){logger[_0x23e2('0x12')](_0x23e2('0x13'),_0x44e369,_0x23e2('0x14'));logger[_0x23e2('0x15')]('Team,\x20%s,\x20%s,\x20%s',_0x44e369,_0x23e2('0x14'),JSON[_0x23e2('0x16')](_0x4f02fd));if(_0x4f02fd[_0x23e2('0x17')]){if(_0x4f02fd['error'][_0x23e2('0x18')]===0x1f4){logger['error'](_0x23e2('0x13'),_0x44e369,_0x4f02fd[_0x23e2('0x17')]['message']);return _0x3cda6c(_0x4f02fd[_0x23e2('0x17')][_0x23e2('0x19')]);}logger['error'](_0x23e2('0x13'),_0x44e369,_0x4f02fd['error'][_0x23e2('0x19')]);return _0x550a0c(_0x4f02fd['error'][_0x23e2('0x19')]);}else{logger['info'](_0x23e2('0x13'),_0x44e369,_0x23e2('0x14'));_0x550a0c(_0x4f02fd[_0x23e2('0x1a')][_0x23e2('0x19')]);}})['catch'](function(_0x37f6dc){logger[_0x23e2('0x17')]('Team,\x20%s,\x20%s',_0x44e369,_0x37f6dc);_0x3cda6c(_0x37f6dc);});});} \ No newline at end of file +var _0x58b9=['moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','client','http','redis','defaults','localhost','socket.io-emitter','./team.socket','then','info','Team,\x20%s,\x20%s','request\x20sent','debug','stringify','error','code','message','result','catch','lodash'];(function(_0x2d3ab3,_0x47d90b){var _0x321f9e=function(_0x50a53d){while(--_0x50a53d){_0x2d3ab3['push'](_0x2d3ab3['shift']());}};_0x321f9e(++_0x47d90b);}(_0x58b9,0xad));var _0x958b=function(_0xd738ef,_0x4ea44d){_0xd738ef=_0xd738ef-0x0;var _0x19abe3=_0x58b9[_0xd738ef];return _0x19abe3;};'use strict';var _=require(_0x958b('0x0'));var util=require('util');var moment=require(_0x958b('0x1'));var BPromise=require(_0x958b('0x2'));var rs=require(_0x958b('0x3'));var fs=require('fs');var Redis=require(_0x958b('0x4'));var db=require(_0x958b('0x5'))['db'];var utils=require(_0x958b('0x6'));var logger=require(_0x958b('0x7'))(_0x958b('0x8'));var config=require(_0x958b('0x9'));var jayson=require(_0x958b('0xa'));var client=jayson[_0x958b('0xb')][_0x958b('0xc')]({'port':0x232a});config[_0x958b('0xd')]=_[_0x958b('0xe')](config[_0x958b('0xd')],{'host':_0x958b('0xf'),'port':0x18eb});var socket=require(_0x958b('0x10'))(new Redis(config[_0x958b('0xd')]));require(_0x958b('0x11'))['register'](socket);function respondWithRpcPromise(_0x12d003,_0x4eff6b,_0x1bfc75){return new BPromise(function(_0x755475,_0x361ee3){return client['request'](_0x12d003,_0x1bfc75)[_0x958b('0x12')](function(_0xc556c8){logger[_0x958b('0x13')](_0x958b('0x14'),_0x4eff6b,_0x958b('0x15'));logger[_0x958b('0x16')]('Team,\x20%s,\x20%s,\x20%s',_0x4eff6b,'request\x20sent',JSON[_0x958b('0x17')](_0xc556c8));if(_0xc556c8[_0x958b('0x18')]){if(_0xc556c8['error'][_0x958b('0x19')]===0x1f4){logger[_0x958b('0x18')]('Team,\x20%s,\x20%s',_0x4eff6b,_0xc556c8[_0x958b('0x18')][_0x958b('0x1a')]);return _0x361ee3(_0xc556c8[_0x958b('0x18')][_0x958b('0x1a')]);}logger['error'](_0x958b('0x14'),_0x4eff6b,_0xc556c8[_0x958b('0x18')]['message']);return _0x755475(_0xc556c8[_0x958b('0x18')][_0x958b('0x1a')]);}else{logger[_0x958b('0x13')](_0x958b('0x14'),_0x4eff6b,'request\x20sent');_0x755475(_0xc556c8[_0x958b('0x1b')][_0x958b('0x1a')]);}})[_0x958b('0x1c')](function(_0x358106){logger['error'](_0x958b('0x14'),_0x4eff6b,_0x358106);_0x361ee3(_0x358106);});});} \ No newline at end of file diff --git a/server/api/team/team.socket.js b/server/api/team/team.socket.js index 9347150..1d63362 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 _0x14e2=['remove','update','register','team:','./team.events'];(function(_0x673ea4,_0x449076){var _0x3e5938=function(_0x4152e0){while(--_0x4152e0){_0x673ea4['push'](_0x673ea4['shift']());}};_0x3e5938(++_0x449076);}(_0x14e2,0x12b));var _0x214e=function(_0x35387d,_0x1ba72f){_0x35387d=_0x35387d-0x0;var _0x3aba56=_0x14e2[_0x35387d];return _0x3aba56;};'use strict';var TeamEvents=require(_0x214e('0x0'));var events=['save',_0x214e('0x1'),_0x214e('0x2')];function createListener(_0xd706e9,_0x215832){return function(_0x40f08e){_0x215832['emit'](_0xd706e9,_0x40f08e);};}function removeListener(_0x40a63c,_0x2954c2){return function(){TeamEvents['removeListener'](_0x40a63c,_0x2954c2);};}exports[_0x214e('0x3')]=function(_0x51d772){for(var _0x429dcd=0x0,_0x38d1d6=events['length'];_0x429dcd<_0x38d1d6;_0x429dcd++){var _0x46acbe=events[_0x429dcd];var _0x2a7255=createListener(_0x214e('0x4')+_0x46acbe,_0x51d772);TeamEvents['on'](_0x46acbe,_0x2a7255);}}; \ No newline at end of file +var _0x071d=['removeListener','register','length','team:','remove','update','emit'];(function(_0x1facfa,_0x1acf7d){var _0x9ec701=function(_0x115e37){while(--_0x115e37){_0x1facfa['push'](_0x1facfa['shift']());}};_0x9ec701(++_0x1acf7d);}(_0x071d,0x82));var _0xd071=function(_0x100682,_0x11afec){_0x100682=_0x100682-0x0;var _0xcb6e87=_0x071d[_0x100682];return _0xcb6e87;};'use strict';var TeamEvents=require('./team.events');var events=['save',_0xd071('0x0'),_0xd071('0x1')];function createListener(_0xcc3d6,_0x25d637){return function(_0x4a7fba){_0x25d637[_0xd071('0x2')](_0xcc3d6,_0x4a7fba);};}function removeListener(_0x1a29a3,_0x54d8f0){return function(){TeamEvents[_0xd071('0x3')](_0x1a29a3,_0x54d8f0);};}exports[_0xd071('0x4')]=function(_0x187756){for(var _0x12025a=0x0,_0x30216a=events[_0xd071('0x5')];_0x12025a<_0x30216a;_0x12025a++){var _0x80236a=events[_0x12025a];var _0x3f09fb=createListener(_0xd071('0x6')+_0x80236a,_0x187756);TeamEvents['on'](_0x80236a,_0x3f09fb);}}; \ No newline at end of file diff --git a/server/api/teamVoicePrefix/teamVoicePrefix.attributes.js b/server/api/teamVoicePrefix/teamVoicePrefix.attributes.js index 563f234..888b591 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 _0x2821=['sequelize','exports','INTEGER'];(function(_0x48863d,_0xb57402){var _0x16c8f1=function(_0xbc21a4){while(--_0xbc21a4){_0x48863d['push'](_0x48863d['shift']());}};_0x16c8f1(++_0xb57402);}(_0x2821,0x87));var _0x1282=function(_0x2dcd19,_0x3f70f4){_0x2dcd19=_0x2dcd19-0x0;var _0x377f91=_0x2821[_0x2dcd19];return _0x377f91;};'use strict';var Sequelize=require(_0x1282('0x0'));module[_0x1282('0x1')]={'TeamId':{'type':Sequelize[_0x1282('0x2')]},'VoicePrefixId':{'type':Sequelize[_0x1282('0x2')]}}; \ No newline at end of file +var _0xf58e=['INTEGER','sequelize','exports'];(function(_0x5930f8,_0xccf4ef){var _0x593324=function(_0xa67b60){while(--_0xa67b60){_0x5930f8['push'](_0x5930f8['shift']());}};_0x593324(++_0xccf4ef);}(_0xf58e,0xc1));var _0xef58=function(_0x337580,_0x44203f){_0x337580=_0x337580-0x0;var _0x5c247e=_0xf58e[_0x337580];return _0x5c247e;};'use strict';var Sequelize=require(_0xef58('0x0'));module[_0xef58('0x1')]={'TeamId':{'type':Sequelize[_0xef58('0x2')]},'VoicePrefixId':{'type':Sequelize[_0xef58('0x2')]}}; \ No newline at end of file diff --git a/server/api/teamVoicePrefix/teamVoicePrefix.model.js b/server/api/teamVoicePrefix/teamVoicePrefix.model.js index ea43f9c..663618a 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 _0x1d21=['rimraf','./teamVoicePrefix.attributes','exports','define','TeamVoicePrefix','team_has_voice_prefixes','lodash','util','../../config/logger','api','bluebird','request-promise','path'];(function(_0x3688d2,_0x243eea){var _0x262ce6=function(_0x2a4aaf){while(--_0x2a4aaf){_0x3688d2['push'](_0x3688d2['shift']());}};_0x262ce6(++_0x243eea);}(_0x1d21,0x158));var _0x11d2=function(_0x482214,_0x2550ff){_0x482214=_0x482214-0x0;var _0x38d0cb=_0x1d21[_0x482214];return _0x38d0cb;};'use strict';var _=require(_0x11d2('0x0'));var util=require(_0x11d2('0x1'));var logger=require(_0x11d2('0x2'))(_0x11d2('0x3'));var moment=require('moment');var BPromise=require(_0x11d2('0x4'));var rp=require(_0x11d2('0x5'));var fs=require('fs');var path=require(_0x11d2('0x6'));var rimraf=require(_0x11d2('0x7'));var config=require('../../config/environment');var attributes=require(_0x11d2('0x8'));module[_0x11d2('0x9')]=function(_0x16e99c,_0x21a2d3){return _0x16e99c[_0x11d2('0xa')](_0x11d2('0xb'),attributes,{'tableName':_0x11d2('0xc'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0xbc4a=['lodash','util','../../config/logger','rimraf','./teamVoicePrefix.attributes','exports','define','TeamVoicePrefix','team_has_voice_prefixes'];(function(_0x3dd15e,_0x1f0015){var _0x231fd0=function(_0x4f680a){while(--_0x4f680a){_0x3dd15e['push'](_0x3dd15e['shift']());}};_0x231fd0(++_0x1f0015);}(_0xbc4a,0x1dd));var _0xabc4=function(_0x7a27b0,_0x57d22a){_0x7a27b0=_0x7a27b0-0x0;var _0x1073d9=_0xbc4a[_0x7a27b0];return _0x1073d9;};'use strict';var _=require(_0xabc4('0x0'));var util=require(_0xabc4('0x1'));var logger=require(_0xabc4('0x2'))('api');var moment=require('moment');var BPromise=require('bluebird');var rp=require('request-promise');var fs=require('fs');var path=require('path');var rimraf=require(_0xabc4('0x3'));var config=require('../../config/environment');var attributes=require(_0xabc4('0x4'));module[_0xabc4('0x5')]=function(_0x282a1e,_0x422903){return _0x282a1e[_0xabc4('0x6')](_0xabc4('0x7'),attributes,{'tableName':_0xabc4('0x8'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/teamVoiceQueue/index.js b/server/api/teamVoiceQueue/index.js index 47ebb73..2efcb6c 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 _0x70e0=['../../components/auth/service','../../components/interaction/service','exports','multer','util','path','Router','fs-extra'];(function(_0xa5bb93,_0x54fa0e){var _0x3e4d6d=function(_0x232a32){while(--_0x232a32){_0xa5bb93['push'](_0xa5bb93['shift']());}};_0x3e4d6d(++_0x54fa0e);}(_0x70e0,0x17b));var _0x070e=function(_0x23d477,_0x325f2d){_0x23d477=_0x23d477-0x0;var _0x5a4cb5=_0x70e0[_0x23d477];return _0x5a4cb5;};'use strict';var multer=require(_0x070e('0x0'));var util=require(_0x070e('0x1'));var path=require(_0x070e('0x2'));var timeout=require('connect-timeout');var express=require('express');var router=express[_0x070e('0x3')]();var fs_extra=require(_0x070e('0x4'));var auth=require(_0x070e('0x5'));var interaction=require(_0x070e('0x6'));var config=require('../../config/environment');module[_0x070e('0x7')]=router; \ No newline at end of file +var _0xd8b0=['Router','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','multer','util'];(function(_0x41f55e,_0x264009){var _0x922b33=function(_0x510189){while(--_0x510189){_0x41f55e['push'](_0x41f55e['shift']());}};_0x922b33(++_0x264009);}(_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/teamVoiceQueue/teamVoiceQueue.attributes.js b/server/api/teamVoiceQueue/teamVoiceQueue.attributes.js index dea3071..4bc45c4 100644 --- a/server/api/teamVoiceQueue/teamVoiceQueue.attributes.js +++ b/server/api/teamVoiceQueue/teamVoiceQueue.attributes.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x0c97=['exports'];(function(_0x412e27,_0x20a978){var _0x53da42=function(_0x43cae5){while(--_0x43cae5){_0x412e27['push'](_0x412e27['shift']());}};_0x53da42(++_0x20a978);}(_0x0c97,0x64));var _0x70c9=function(_0x26b80e,_0x5c9333){_0x26b80e=_0x26b80e-0x0;var _0x84a8a8=_0x0c97[_0x26b80e];return _0x84a8a8;};'use strict';var Sequelize=require('sequelize');module[_0x70c9('0x0')]={'penalty':{'type':Sequelize['INTEGER'],'defaultValue':0x0}}; \ No newline at end of file +var _0xf385=['sequelize'];(function(_0x7729b1,_0x468322){var _0x349504=function(_0x401cee){while(--_0x401cee){_0x7729b1['push'](_0x7729b1['shift']());}};_0x349504(++_0x468322);}(_0xf385,0xab));var _0x5f38=function(_0xf71120,_0x25b7f9){_0xf71120=_0xf71120-0x0;var _0xbe2fd3=_0xf385[_0xf71120];return _0xbe2fd3;};'use strict';var Sequelize=require(_0x5f38('0x0'));module['exports']={'penalty':{'type':Sequelize['INTEGER'],'defaultValue':0x0}}; \ No newline at end of file diff --git a/server/api/teamVoiceQueue/teamVoiceQueue.model.js b/server/api/teamVoiceQueue/teamVoiceQueue.model.js index 4308d2f..6f6aae4 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 _0x340c=['../../config/logger','api','bluebird','request-promise','path','rimraf','./teamVoiceQueue.attributes','exports','define','lodash','util'];(function(_0x3dd15e,_0x1f0015){var _0x231fd0=function(_0x4f680a){while(--_0x4f680a){_0x3dd15e['push'](_0x3dd15e['shift']());}};_0x231fd0(++_0x1f0015);}(_0x340c,0xe5));var _0xc340=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0x340c[_0x3dd15e];return _0x231fd0;};'use strict';var _=require(_0xc340('0x0'));var util=require(_0xc340('0x1'));var logger=require(_0xc340('0x2'))(_0xc340('0x3'));var moment=require('moment');var BPromise=require(_0xc340('0x4'));var rp=require(_0xc340('0x5'));var fs=require('fs');var path=require(_0xc340('0x6'));var rimraf=require(_0xc340('0x7'));var config=require('../../config/environment');var attributes=require(_0xc340('0x8'));module[_0xc340('0x9')]=function(_0x337a1f,_0xb55d36){return _0x337a1f[_0xc340('0xa')]('TeamVoiceQueue',attributes,{'tableName':'team_has_voice_queues','paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x6ae0=['TeamVoiceQueue','team_has_voice_queues','lodash','util','../../config/logger','api','request-promise','rimraf','./teamVoiceQueue.attributes','exports'];(function(_0x5962c2,_0x2a024e){var _0x1d593f=function(_0x5949c7){while(--_0x5949c7){_0x5962c2['push'](_0x5962c2['shift']());}};_0x1d593f(++_0x2a024e);}(_0x6ae0,0x192));var _0x06ae=function(_0x414ef3,_0x562eee){_0x414ef3=_0x414ef3-0x0;var _0x5cfd8b=_0x6ae0[_0x414ef3];return _0x5cfd8b;};'use strict';var _=require(_0x06ae('0x0'));var util=require(_0x06ae('0x1'));var logger=require(_0x06ae('0x2'))(_0x06ae('0x3'));var moment=require('moment');var BPromise=require('bluebird');var rp=require(_0x06ae('0x4'));var fs=require('fs');var path=require('path');var rimraf=require(_0x06ae('0x5'));var config=require('../../config/environment');var attributes=require(_0x06ae('0x6'));module[_0x06ae('0x7')]=function(_0x517dea,_0x17b806){return _0x517dea['define'](_0x06ae('0x8'),attributes,{'tableName':_0x06ae('0x9'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/teamVoiceQueue/teamVoiceQueue.rpc.js b/server/api/teamVoiceQueue/teamVoiceQueue.rpc.js index 3f8d4f2..7291bd5 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 _0x3cf1=['message','result','catch','lodash','moment','bluebird','randomstring','ioredis','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','client','http','request','then','request\x20sent','debug','TeamVoiceQueue,\x20%s,\x20%s,\x20%s','stringify','error','code','TeamVoiceQueue,\x20%s,\x20%s'];(function(_0x35781e,_0x16a0c5){var _0x410e84=function(_0x2aab8a){while(--_0x2aab8a){_0x35781e['push'](_0x35781e['shift']());}};_0x410e84(++_0x16a0c5);}(_0x3cf1,0x16b));var _0x13cf=function(_0x4b15bb,_0x22d09a){_0x4b15bb=_0x4b15bb-0x0;var _0x38c3f5=_0x3cf1[_0x4b15bb];return _0x38c3f5;};'use strict';var _=require(_0x13cf('0x0'));var util=require('util');var moment=require(_0x13cf('0x1'));var BPromise=require(_0x13cf('0x2'));var rs=require(_0x13cf('0x3'));var fs=require('fs');var Redis=require(_0x13cf('0x4'));var db=require('../../mysqldb')['db'];var utils=require(_0x13cf('0x5'));var logger=require(_0x13cf('0x6'))(_0x13cf('0x7'));var config=require(_0x13cf('0x8'));var jayson=require(_0x13cf('0x9'));var client=jayson[_0x13cf('0xa')][_0x13cf('0xb')]({'port':0x232a});function respondWithRpcPromise(_0x11b91b,_0x4356b3,_0x4c1fb1){return new BPromise(function(_0xc4bd78,_0x200b71){return client[_0x13cf('0xc')](_0x11b91b,_0x4c1fb1)[_0x13cf('0xd')](function(_0xc382e3){logger['info']('TeamVoiceQueue,\x20%s,\x20%s',_0x4356b3,_0x13cf('0xe'));logger[_0x13cf('0xf')](_0x13cf('0x10'),_0x4356b3,_0x13cf('0xe'),JSON[_0x13cf('0x11')](_0xc382e3));if(_0xc382e3[_0x13cf('0x12')]){if(_0xc382e3[_0x13cf('0x12')][_0x13cf('0x13')]===0x1f4){logger['error'](_0x13cf('0x14'),_0x4356b3,_0xc382e3[_0x13cf('0x12')][_0x13cf('0x15')]);return _0x200b71(_0xc382e3[_0x13cf('0x12')][_0x13cf('0x15')]);}logger[_0x13cf('0x12')](_0x13cf('0x14'),_0x4356b3,_0xc382e3['error'][_0x13cf('0x15')]);return _0xc4bd78(_0xc382e3['error'][_0x13cf('0x15')]);}else{logger['info'](_0x13cf('0x14'),_0x4356b3,_0x13cf('0xe'));_0xc4bd78(_0xc382e3[_0x13cf('0x16')][_0x13cf('0x15')]);}})[_0x13cf('0x17')](function(_0x4441d8){logger[_0x13cf('0x12')](_0x13cf('0x14'),_0x4356b3,_0x4441d8);_0x200b71(_0x4441d8);});});} \ No newline at end of file +var _0x5c88=['stringify','error','message','catch','lodash','util','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','jayson/promise','http','request','info','TeamVoiceQueue,\x20%s,\x20%s','TeamVoiceQueue,\x20%s,\x20%s,\x20%s','request\x20sent'];(function(_0x333131,_0x49affa){var _0x29af23=function(_0x3e1577){while(--_0x3e1577){_0x333131['push'](_0x333131['shift']());}};_0x29af23(++_0x49affa);}(_0x5c88,0x158));var _0x85c8=function(_0x1fc7c7,_0x4c9362){_0x1fc7c7=_0x1fc7c7-0x0;var _0x1c76f6=_0x5c88[_0x1fc7c7];return _0x1c76f6;};'use strict';var _=require(_0x85c8('0x0'));var util=require(_0x85c8('0x1'));var moment=require('moment');var BPromise=require(_0x85c8('0x2'));var rs=require(_0x85c8('0x3'));var fs=require('fs');var Redis=require(_0x85c8('0x4'));var db=require(_0x85c8('0x5'))['db'];var utils=require(_0x85c8('0x6'));var logger=require(_0x85c8('0x7'))(_0x85c8('0x8'));var config=require('../../config/environment');var jayson=require(_0x85c8('0x9'));var client=jayson['client'][_0x85c8('0xa')]({'port':0x232a});function respondWithRpcPromise(_0x3ef6cd,_0x18f023,_0x43029f){return new BPromise(function(_0x2a8ce6,_0x35e0b5){return client[_0x85c8('0xb')](_0x3ef6cd,_0x43029f)['then'](function(_0x193acc){logger[_0x85c8('0xc')](_0x85c8('0xd'),_0x18f023,'request\x20sent');logger['debug'](_0x85c8('0xe'),_0x18f023,_0x85c8('0xf'),JSON[_0x85c8('0x10')](_0x193acc));if(_0x193acc[_0x85c8('0x11')]){if(_0x193acc[_0x85c8('0x11')]['code']===0x1f4){logger['error'](_0x85c8('0xd'),_0x18f023,_0x193acc['error'][_0x85c8('0x12')]);return _0x35e0b5(_0x193acc['error'][_0x85c8('0x12')]);}logger[_0x85c8('0x11')]('TeamVoiceQueue,\x20%s,\x20%s',_0x18f023,_0x193acc[_0x85c8('0x11')][_0x85c8('0x12')]);return _0x2a8ce6(_0x193acc[_0x85c8('0x11')][_0x85c8('0x12')]);}else{logger[_0x85c8('0xc')](_0x85c8('0xd'),_0x18f023,'request\x20sent');_0x2a8ce6(_0x193acc['result'][_0x85c8('0x12')]);}})[_0x85c8('0x13')](function(_0x25f7ef){logger[_0x85c8('0x11')](_0x85c8('0xd'),_0x18f023,_0x25f7ef);_0x35e0b5(_0x25f7ef);});});} \ No newline at end of file diff --git a/server/api/template/index.js b/server/api/template/index.js index b2f1481..1bfb0b5 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 _0x45c2=['Router','fs-extra','../../components/auth/service','../../config/environment','./template.controller','get','isAuthenticated','index','/:id','show','post','create','update','destroy','multer','util','path','connect-timeout'];(function(_0x4b055c,_0x4b870b){var _0x4b62bb=function(_0x4884c2){while(--_0x4884c2){_0x4b055c['push'](_0x4b055c['shift']());}};_0x4b62bb(++_0x4b870b);}(_0x45c2,0x68));var _0x245c=function(_0x2813fa,_0x3211d4){_0x2813fa=_0x2813fa-0x0;var _0x8a2acb=_0x45c2[_0x2813fa];return _0x8a2acb;};'use strict';var multer=require(_0x245c('0x0'));var util=require(_0x245c('0x1'));var path=require(_0x245c('0x2'));var timeout=require(_0x245c('0x3'));var express=require('express');var router=express[_0x245c('0x4')]();var fs_extra=require(_0x245c('0x5'));var auth=require(_0x245c('0x6'));var interaction=require('../../components/interaction/service');var config=require(_0x245c('0x7'));var controller=require(_0x245c('0x8'));router[_0x245c('0x9')]('/',auth[_0x245c('0xa')](),controller[_0x245c('0xb')]);router[_0x245c('0x9')](_0x245c('0xc'),auth[_0x245c('0xa')](),controller[_0x245c('0xd')]);router[_0x245c('0xe')]('/',auth[_0x245c('0xa')](),controller[_0x245c('0xf')]);router['put'](_0x245c('0xc'),auth[_0x245c('0xa')](),controller[_0x245c('0x10')]);router['delete']('/:id',auth[_0x245c('0xa')](),controller[_0x245c('0x11')]);module['exports']=router; \ No newline at end of file +var _0xc113=['get','index','/:id','show','put','update','delete','destroy','exports','multer','util','path','connect-timeout','express','Router','fs-extra','../../components/auth/service','../../components/interaction/service','./template.controller'];(function(_0x20a584,_0xe384a5){var _0x4b41a8=function(_0x2127c6){while(--_0x2127c6){_0x20a584['push'](_0x20a584['shift']());}};_0x4b41a8(++_0xe384a5);}(_0xc113,0x1ab));var _0x3c11=function(_0x2c7841,_0x55fcae){_0x2c7841=_0x2c7841-0x0;var _0x3d72e7=_0xc113[_0x2c7841];return _0x3d72e7;};'use strict';var multer=require(_0x3c11('0x0'));var util=require(_0x3c11('0x1'));var path=require(_0x3c11('0x2'));var timeout=require(_0x3c11('0x3'));var express=require(_0x3c11('0x4'));var router=express[_0x3c11('0x5')]();var fs_extra=require(_0x3c11('0x6'));var auth=require(_0x3c11('0x7'));var interaction=require(_0x3c11('0x8'));var config=require('../../config/environment');var controller=require(_0x3c11('0x9'));router[_0x3c11('0xa')]('/',auth['isAuthenticated'](),controller[_0x3c11('0xb')]);router[_0x3c11('0xa')](_0x3c11('0xc'),auth['isAuthenticated'](),controller[_0x3c11('0xd')]);router['post']('/',auth['isAuthenticated'](),controller['create']);router[_0x3c11('0xe')](_0x3c11('0xc'),auth['isAuthenticated'](),controller[_0x3c11('0xf')]);router[_0x3c11('0x10')](_0x3c11('0xc'),auth['isAuthenticated'](),controller[_0x3c11('0x11')]);module[_0x3c11('0x12')]=router; \ No newline at end of file diff --git a/server/api/template/template.attributes.js b/server/api/template/template.attributes.js index 1fcf95e..090a4e1 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 _0xab21=['STRING','TEXT'];(function(_0x3dd15e,_0x1f0015){var _0x231fd0=function(_0x4f680a){while(--_0x4f680a){_0x3dd15e['push'](_0x3dd15e['shift']());}};_0x231fd0(++_0x1f0015);}(_0xab21,0x124));var _0x1ab2=function(_0xc0a3d3,_0x2c8d00){_0xc0a3d3=_0xc0a3d3-0x0;var _0x3386e8=_0xab21[_0xc0a3d3];return _0x3386e8;};'use strict';var Sequelize=require('sequelize');module['exports']={'name':{'type':Sequelize[_0x1ab2('0x0')]},'description':{'type':Sequelize['STRING']},'html':{'type':Sequelize[_0x1ab2('0x1')]}}; \ No newline at end of file +var _0x7bef=['exports','STRING','TEXT'];(function(_0x450076,_0x10983b){var _0x2029cc=function(_0x4a5e76){while(--_0x4a5e76){_0x450076['push'](_0x450076['shift']());}};_0x2029cc(++_0x10983b);}(_0x7bef,0x9c));var _0xf7be=function(_0x134de4,_0x49c839){_0x134de4=_0x134de4-0x0;var _0xe97f36=_0x7bef[_0x134de4];return _0xe97f36;};'use strict';var Sequelize=require('sequelize');module[_0xf7be('0x0')]={'name':{'type':Sequelize['STRING']},'description':{'type':Sequelize[_0xf7be('0x1')]},'html':{'type':Sequelize[_0xf7be('0x2')]}}; \ No newline at end of file diff --git a/server/api/template/template.controller.js b/server/api/template/template.controller.js index 6498b19..37cb419 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 _0x3ac1=['destroy','get','Templates','UserProfileResource','error','stack','name','send','index','rawAttributes','type','map','query','keys','filters','intersection','model','attributes','fields','nolimit','sort','where','pick','merge','VIRTUAL','filter','Template','includeAll','findAll','rows','catch','show','length','include','options','find','create','body','user','Unable\x20to\x20retrieve\x20the\x20current\x20user','UserProfileSection','autoAssociation','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','params','eml-format','rimraf','fast-json-patch','request-promise','bluebird','util','path','sox','to-csv','ejs','fs-extra','squel','crypto','jsforce','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/logger','api','../../config/environment','../../config/license/util','sendStatus','status','end','json','offset','undefined','limit','count','Content-Range','reject','save','update','then'];(function(_0x1f3870,_0x5411df){var _0x100b49=function(_0x56f21d){while(--_0x56f21d){_0x1f3870['push'](_0x1f3870['shift']());}};_0x100b49(++_0x5411df);}(_0x3ac1,0x1c1));var _0x13ac=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0x3ac1[_0x3dd15e];return _0x231fd0;};'use strict';var emlformat=require(_0x13ac('0x0'));var rimraf=require(_0x13ac('0x1'));var zipdir=require('zip-dir');var jsonpatch=require(_0x13ac('0x2'));var rp=require(_0x13ac('0x3'));var moment=require('moment');var BPromise=require(_0x13ac('0x4'));var Mustache=require('mustache');var util=require(_0x13ac('0x5'));var path=require(_0x13ac('0x6'));var sox=require(_0x13ac('0x7'));var csv=require(_0x13ac('0x8'));var ejs=require(_0x13ac('0x9'));var fs=require('fs');var fs_extra=require(_0x13ac('0xa'));var _=require('lodash');var squel=require(_0x13ac('0xb'));var crypto=require(_0x13ac('0xc'));var jsforce=require(_0x13ac('0xd'));var deskjs=require('desk.js');var toCsv=require('to-csv');var querystring=require(_0x13ac('0xe'));var Papa=require(_0x13ac('0xf'));var Redis=require(_0x13ac('0x10'));var authService=require(_0x13ac('0x11'));var qs=require(_0x13ac('0x12'));var as=require(_0x13ac('0x13'));var hardwareService=require('../../config/license/hardware');var logger=require(_0x13ac('0x14'))(_0x13ac('0x15'));var utils=require('../../config/utils');var config=require(_0x13ac('0x16'));var licenseUtil=require(_0x13ac('0x17'));var db=require('../../mysqldb')['db'];function respondWithStatusCode(_0x1e82dc,_0x358a11){_0x358a11=_0x358a11||0xcc;return function(_0x32dfb2){if(_0x32dfb2){return _0x1e82dc[_0x13ac('0x18')](_0x358a11);}return _0x1e82dc[_0x13ac('0x19')](_0x358a11)[_0x13ac('0x1a')]();};}function respondWithResult(_0x253018,_0x28f4b2){_0x28f4b2=_0x28f4b2||0xc8;return function(_0x2e3731){if(_0x2e3731){return _0x253018[_0x13ac('0x19')](_0x28f4b2)[_0x13ac('0x1b')](_0x2e3731);}};}function respondWithFilteredResult(_0x5987da,_0x337ae9){return function(_0x5c411c){if(_0x5c411c){var _0x396b92=typeof _0x337ae9[_0x13ac('0x1c')]===_0x13ac('0x1d')&&typeof _0x337ae9[_0x13ac('0x1e')]===_0x13ac('0x1d');var _0x36ed3a=_0x5c411c[_0x13ac('0x1f')];var _0x504ef5=_0x396b92?0x0:_0x337ae9[_0x13ac('0x1c')];var _0x2f4d1e=_0x396b92?_0x5c411c['count']:_0x337ae9[_0x13ac('0x1c')]+_0x337ae9[_0x13ac('0x1e')];var _0x18e10a;if(_0x2f4d1e>=_0x36ed3a){_0x2f4d1e=_0x36ed3a;_0x18e10a=0xc8;}else{_0x18e10a=0xce;}_0x5987da[_0x13ac('0x19')](_0x18e10a);return _0x5987da['set'](_0x13ac('0x20'),_0x504ef5+'-'+_0x2f4d1e+'/'+_0x36ed3a)[_0x13ac('0x1b')](_0x5c411c);}return null;};}function patchUpdates(_0x18cb1a){return function(_0x109675){try{jsonpatch['apply'](_0x109675,_0x18cb1a,!![]);}catch(_0x2cf55b){return BPromise[_0x13ac('0x21')](_0x2cf55b);}return _0x109675[_0x13ac('0x22')]();};}function saveUpdates(_0x41b248,_0x4078c6){return function(_0x3d04a3){if(_0x3d04a3){return _0x3d04a3[_0x13ac('0x23')](_0x41b248)[_0x13ac('0x24')](function(_0x56031b){return _0x56031b;});}return null;};}function removeEntity(_0x2fa827,_0x4d127a){return function(_0x1adb09){if(_0x1adb09){return _0x1adb09[_0x13ac('0x25')]()['then'](function(){var _0x5e557c=_0x1adb09[_0x13ac('0x26')]({'plain':!![]});var _0x2548a5=_0x13ac('0x27');return db[_0x13ac('0x28')][_0x13ac('0x25')]({'where':{'type':_0x2548a5,'resourceId':_0x5e557c['id']}})['then'](function(){return _0x1adb09;});})[_0x13ac('0x24')](function(){_0x2fa827[_0x13ac('0x19')](0xcc)[_0x13ac('0x1a')]();});}};}function handleEntityNotFound(_0x5e6262,_0x34c829){return function(_0x61a7b3){if(!_0x61a7b3){_0x5e6262[_0x13ac('0x18')](0x194);}return _0x61a7b3;};}function handleError(_0x59ea3d,_0xfc1bad){_0xfc1bad=_0xfc1bad||0x1f4;return function(_0x1558dd){logger[_0x13ac('0x29')](_0x1558dd[_0x13ac('0x2a')]);if(_0x1558dd[_0x13ac('0x2b')]){delete _0x1558dd[_0x13ac('0x2b')];}_0x59ea3d['status'](_0xfc1bad)[_0x13ac('0x2c')](_0x1558dd);};}exports[_0x13ac('0x2d')]=function(_0x2c6a6b,_0x13e67b){var _0x1ad6dc={},_0x51a372={},_0x2fee0b={'count':0x0,'rows':[]};var _0x316a33=_['map'](db['Template'][_0x13ac('0x2e')],function(_0x4defb6){return{'name':_0x4defb6['fieldName'],'type':_0x4defb6[_0x13ac('0x2f')]['key']};});_0x51a372['model']=_[_0x13ac('0x30')](_0x316a33,_0x13ac('0x2b'));_0x51a372[_0x13ac('0x31')]=_[_0x13ac('0x32')](_0x2c6a6b[_0x13ac('0x31')]);_0x51a372[_0x13ac('0x33')]=_[_0x13ac('0x34')](_0x51a372[_0x13ac('0x35')],_0x51a372[_0x13ac('0x31')]);_0x1ad6dc[_0x13ac('0x36')]=_[_0x13ac('0x34')](_0x51a372[_0x13ac('0x35')],qs['fields'](_0x2c6a6b[_0x13ac('0x31')][_0x13ac('0x37')]));_0x1ad6dc['attributes']=_0x1ad6dc[_0x13ac('0x36')]['length']?_0x1ad6dc[_0x13ac('0x36')]:_0x51a372['model'];if(!_0x2c6a6b['query']['hasOwnProperty'](_0x13ac('0x38'))){_0x1ad6dc['limit']=qs['limit'](_0x2c6a6b[_0x13ac('0x31')][_0x13ac('0x1e')]);_0x1ad6dc[_0x13ac('0x1c')]=qs[_0x13ac('0x1c')](_0x2c6a6b['query'][_0x13ac('0x1c')]);}_0x1ad6dc['order']=qs[_0x13ac('0x39')](_0x2c6a6b[_0x13ac('0x31')][_0x13ac('0x39')]);_0x1ad6dc[_0x13ac('0x3a')]=qs['filters'](_[_0x13ac('0x3b')](_0x2c6a6b[_0x13ac('0x31')],_0x51a372['filters']),_0x316a33);if(_0x2c6a6b[_0x13ac('0x31')]['filter']){_0x1ad6dc[_0x13ac('0x3a')]=_[_0x13ac('0x3c')](_0x1ad6dc[_0x13ac('0x3a')],{'$or':_['map'](_0x316a33,function(_0x1d1390){if(_0x1d1390[_0x13ac('0x2f')]!==_0x13ac('0x3d')){var _0x4014d3={};_0x4014d3[_0x1d1390[_0x13ac('0x2b')]]={'$like':'%'+_0x2c6a6b[_0x13ac('0x31')][_0x13ac('0x3e')]+'%'};return _0x4014d3;}})});}_0x1ad6dc=_[_0x13ac('0x3c')]({},_0x1ad6dc,_0x2c6a6b['options']);var _0x4ba6fd={'where':_0x1ad6dc[_0x13ac('0x3a')]};return db[_0x13ac('0x3f')][_0x13ac('0x1f')](_0x4ba6fd)[_0x13ac('0x24')](function(_0x526b03){_0x2fee0b[_0x13ac('0x1f')]=_0x526b03;if(_0x2c6a6b['query'][_0x13ac('0x40')]){_0x1ad6dc['include']=[{'all':!![]}];}return db[_0x13ac('0x3f')][_0x13ac('0x41')](_0x1ad6dc);})[_0x13ac('0x24')](function(_0x594112){_0x2fee0b[_0x13ac('0x42')]=_0x594112;return _0x2fee0b;})[_0x13ac('0x24')](respondWithFilteredResult(_0x13e67b,_0x1ad6dc))[_0x13ac('0x43')](handleError(_0x13e67b,null));};exports[_0x13ac('0x44')]=function(_0x513c55,_0x3be3eb){var _0xb3cf1f={'raw':!![],'where':{'id':_0x513c55['params']['id']}},_0xb4490={};_0xb4490[_0x13ac('0x35')]=_[_0x13ac('0x32')](db[_0x13ac('0x3f')][_0x13ac('0x2e')]);_0xb4490[_0x13ac('0x31')]=_[_0x13ac('0x32')](_0x513c55[_0x13ac('0x31')]);_0xb4490['filters']=_['intersection'](_0xb4490[_0x13ac('0x35')],_0xb4490['query']);_0xb3cf1f[_0x13ac('0x36')]=_['intersection'](_0xb4490[_0x13ac('0x35')],qs['fields'](_0x513c55['query'][_0x13ac('0x37')]));_0xb3cf1f[_0x13ac('0x36')]=_0xb3cf1f['attributes'][_0x13ac('0x45')]?_0xb3cf1f[_0x13ac('0x36')]:_0xb4490[_0x13ac('0x35')];if(_0x513c55[_0x13ac('0x31')][_0x13ac('0x40')]){_0xb3cf1f[_0x13ac('0x46')]=[{'all':!![]}];}_0xb3cf1f=_[_0x13ac('0x3c')]({},_0xb3cf1f,_0x513c55[_0x13ac('0x47')]);return db[_0x13ac('0x3f')][_0x13ac('0x48')](_0xb3cf1f)['then'](handleEntityNotFound(_0x3be3eb,null))[_0x13ac('0x24')](respondWithResult(_0x3be3eb,null))['catch'](handleError(_0x3be3eb,null));};exports[_0x13ac('0x49')]=function(_0x5e8505,_0x41648c){return db['Template']['create'](_0x5e8505[_0x13ac('0x4a')],{})[_0x13ac('0x24')](function(_0x3fb5f2){var _0x418633=_0x5e8505[_0x13ac('0x4b')][_0x13ac('0x26')]({'plain':!![]});if(!_0x418633)throw new Error(_0x13ac('0x4c'));if(_0x418633['role']===_0x13ac('0x4b')){var _0x48460d=_0x3fb5f2[_0x13ac('0x26')]({'plain':!![]});var _0x1bc993=_0x13ac('0x27');return db[_0x13ac('0x4d')][_0x13ac('0x48')]({'where':{'name':_0x1bc993,'userProfileId':_0x418633['userProfileId']},'raw':!![]})[_0x13ac('0x24')](function(_0x9a221a){if(_0x9a221a&&_0x9a221a[_0x13ac('0x4e')]===0x0){return db[_0x13ac('0x28')][_0x13ac('0x49')]({'name':_0x48460d[_0x13ac('0x2b')],'resourceId':_0x48460d['id'],'type':_0x9a221a['name'],'sectionId':_0x9a221a['id']},{})['then'](function(){return _0x3fb5f2;});}else{return _0x3fb5f2;}})['catch'](function(_0x54408e){logger['error'](_0x13ac('0x4f'),_0x54408e);throw _0x54408e;});}return _0x3fb5f2;})[_0x13ac('0x24')](respondWithResult(_0x41648c,0xc9))['catch'](handleError(_0x41648c,null));};exports[_0x13ac('0x23')]=function(_0x114181,_0x568a9d){if(_0x114181[_0x13ac('0x4a')]['id']){delete _0x114181[_0x13ac('0x4a')]['id'];}return db[_0x13ac('0x3f')][_0x13ac('0x48')]({'where':{'id':_0x114181[_0x13ac('0x50')]['id']}})[_0x13ac('0x24')](handleEntityNotFound(_0x568a9d,null))['then'](saveUpdates(_0x114181['body'],null))[_0x13ac('0x24')](respondWithResult(_0x568a9d,null))[_0x13ac('0x43')](handleError(_0x568a9d,null));};exports[_0x13ac('0x25')]=function(_0x462ba7,_0x7b6041){return db[_0x13ac('0x3f')]['find']({'where':{'id':_0x462ba7[_0x13ac('0x50')]['id']}})['then'](handleEntityNotFound(_0x7b6041,null))['then'](removeEntity(_0x7b6041,null))[_0x13ac('0x43')](handleError(_0x7b6041,null));}; \ No newline at end of file +var _0x6535=['index','map','Template','rawAttributes','type','key','model','query','keys','filters','intersection','attributes','fields','hasOwnProperty','order','where','filter','merge','VIRTUAL','options','includeAll','findAll','rows','catch','show','include','create','body','user','Unable\x20to\x20retrieve\x20the\x20current\x20user','get','UserProfileSection','find','userProfileId','autoAssociation','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','params','eml-format','rimraf','zip-dir','fast-json-patch','moment','bluebird','util','path','sox','to-csv','ejs','fs-extra','lodash','squel','crypto','jsforce','querystring','ioredis','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/utils','status','end','json','undefined','count','offset','limit','set','Content-Range','reject','save','update','then','destroy','Templates','UserProfileResource','sendStatus','error','stack','name','send'];(function(_0x50cc14,_0x25cb92){var _0x1a7b41=function(_0x33f15e){while(--_0x33f15e){_0x50cc14['push'](_0x50cc14['shift']());}};_0x1a7b41(++_0x25cb92);}(_0x6535,0xc9));var _0x5653=function(_0x1694f5,_0x49b7c3){_0x1694f5=_0x1694f5-0x0;var _0x5b4321=_0x6535[_0x1694f5];return _0x5b4321;};'use strict';var emlformat=require(_0x5653('0x0'));var rimraf=require(_0x5653('0x1'));var zipdir=require(_0x5653('0x2'));var jsonpatch=require(_0x5653('0x3'));var rp=require('request-promise');var moment=require(_0x5653('0x4'));var BPromise=require(_0x5653('0x5'));var Mustache=require('mustache');var util=require(_0x5653('0x6'));var path=require(_0x5653('0x7'));var sox=require(_0x5653('0x8'));var csv=require(_0x5653('0x9'));var ejs=require(_0x5653('0xa'));var fs=require('fs');var fs_extra=require(_0x5653('0xb'));var _=require(_0x5653('0xc'));var squel=require(_0x5653('0xd'));var crypto=require(_0x5653('0xe'));var jsforce=require(_0x5653('0xf'));var deskjs=require('desk.js');var toCsv=require(_0x5653('0x9'));var querystring=require(_0x5653('0x10'));var Papa=require('papaparse');var Redis=require(_0x5653('0x11'));var authService=require('../../components/auth/service');var qs=require(_0x5653('0x12'));var as=require(_0x5653('0x13'));var hardwareService=require(_0x5653('0x14'));var logger=require(_0x5653('0x15'))(_0x5653('0x16'));var utils=require(_0x5653('0x17'));var config=require('../../config/environment');var licenseUtil=require('../../config/license/util');var db=require('../../mysqldb')['db'];function respondWithStatusCode(_0x3910a9,_0x57e7ca){_0x57e7ca=_0x57e7ca||0xcc;return function(_0x24b957){if(_0x24b957){return _0x3910a9['sendStatus'](_0x57e7ca);}return _0x3910a9[_0x5653('0x18')](_0x57e7ca)[_0x5653('0x19')]();};}function respondWithResult(_0x13ed4f,_0x51af52){_0x51af52=_0x51af52||0xc8;return function(_0x4612ad){if(_0x4612ad){return _0x13ed4f['status'](_0x51af52)[_0x5653('0x1a')](_0x4612ad);}};}function respondWithFilteredResult(_0x30a175,_0x19378f){return function(_0x24e3e5){if(_0x24e3e5){var _0x45e8f0=typeof _0x19378f['offset']===_0x5653('0x1b')&&typeof _0x19378f['limit']===_0x5653('0x1b');var _0x5c36be=_0x24e3e5[_0x5653('0x1c')];var _0x1b0949=_0x45e8f0?0x0:_0x19378f['offset'];var _0x10a23c=_0x45e8f0?_0x24e3e5[_0x5653('0x1c')]:_0x19378f[_0x5653('0x1d')]+_0x19378f[_0x5653('0x1e')];var _0x2896cb;if(_0x10a23c>=_0x5c36be){_0x10a23c=_0x5c36be;_0x2896cb=0xc8;}else{_0x2896cb=0xce;}_0x30a175[_0x5653('0x18')](_0x2896cb);return _0x30a175[_0x5653('0x1f')](_0x5653('0x20'),_0x1b0949+'-'+_0x10a23c+'/'+_0x5c36be)[_0x5653('0x1a')](_0x24e3e5);}return null;};}function patchUpdates(_0x3eaf63){return function(_0x401e53){try{jsonpatch['apply'](_0x401e53,_0x3eaf63,!![]);}catch(_0x3d194b){return BPromise[_0x5653('0x21')](_0x3d194b);}return _0x401e53[_0x5653('0x22')]();};}function saveUpdates(_0x70298,_0x28dcc2){return function(_0x1b1f72){if(_0x1b1f72){return _0x1b1f72[_0x5653('0x23')](_0x70298)[_0x5653('0x24')](function(_0x383660){return _0x383660;});}return null;};}function removeEntity(_0x1f337b,_0x565932){return function(_0x583aca){if(_0x583aca){return _0x583aca[_0x5653('0x25')]()[_0x5653('0x24')](function(){var _0x1b2e44=_0x583aca['get']({'plain':!![]});var _0x29a9fa=_0x5653('0x26');return db[_0x5653('0x27')][_0x5653('0x25')]({'where':{'type':_0x29a9fa,'resourceId':_0x1b2e44['id']}})['then'](function(){return _0x583aca;});})[_0x5653('0x24')](function(){_0x1f337b[_0x5653('0x18')](0xcc)[_0x5653('0x19')]();});}};}function handleEntityNotFound(_0x1fb3b3,_0x3bc87b){return function(_0x21d956){if(!_0x21d956){_0x1fb3b3[_0x5653('0x28')](0x194);}return _0x21d956;};}function handleError(_0x5619c4,_0x3fc4ad){_0x3fc4ad=_0x3fc4ad||0x1f4;return function(_0x175c12){logger[_0x5653('0x29')](_0x175c12[_0x5653('0x2a')]);if(_0x175c12[_0x5653('0x2b')]){delete _0x175c12[_0x5653('0x2b')];}_0x5619c4[_0x5653('0x18')](_0x3fc4ad)[_0x5653('0x2c')](_0x175c12);};}exports[_0x5653('0x2d')]=function(_0x4b07b5,_0x518984){var _0x20a035={},_0x47d2f6={},_0xd128e8={'count':0x0,'rows':[]};var _0x1342a7=_[_0x5653('0x2e')](db[_0x5653('0x2f')][_0x5653('0x30')],function(_0x22e5a0){return{'name':_0x22e5a0['fieldName'],'type':_0x22e5a0[_0x5653('0x31')][_0x5653('0x32')]};});_0x47d2f6[_0x5653('0x33')]=_['map'](_0x1342a7,_0x5653('0x2b'));_0x47d2f6[_0x5653('0x34')]=_[_0x5653('0x35')](_0x4b07b5[_0x5653('0x34')]);_0x47d2f6[_0x5653('0x36')]=_[_0x5653('0x37')](_0x47d2f6[_0x5653('0x33')],_0x47d2f6['query']);_0x20a035[_0x5653('0x38')]=_[_0x5653('0x37')](_0x47d2f6[_0x5653('0x33')],qs['fields'](_0x4b07b5[_0x5653('0x34')][_0x5653('0x39')]));_0x20a035[_0x5653('0x38')]=_0x20a035[_0x5653('0x38')]['length']?_0x20a035[_0x5653('0x38')]:_0x47d2f6[_0x5653('0x33')];if(!_0x4b07b5['query'][_0x5653('0x3a')]('nolimit')){_0x20a035[_0x5653('0x1e')]=qs[_0x5653('0x1e')](_0x4b07b5[_0x5653('0x34')]['limit']);_0x20a035['offset']=qs[_0x5653('0x1d')](_0x4b07b5[_0x5653('0x34')][_0x5653('0x1d')]);}_0x20a035[_0x5653('0x3b')]=qs['sort'](_0x4b07b5[_0x5653('0x34')]['sort']);_0x20a035[_0x5653('0x3c')]=qs[_0x5653('0x36')](_['pick'](_0x4b07b5[_0x5653('0x34')],_0x47d2f6[_0x5653('0x36')]),_0x1342a7);if(_0x4b07b5[_0x5653('0x34')][_0x5653('0x3d')]){_0x20a035[_0x5653('0x3c')]=_[_0x5653('0x3e')](_0x20a035[_0x5653('0x3c')],{'$or':_[_0x5653('0x2e')](_0x1342a7,function(_0x47ec91){if(_0x47ec91['type']!==_0x5653('0x3f')){var _0x560810={};_0x560810[_0x47ec91[_0x5653('0x2b')]]={'$like':'%'+_0x4b07b5[_0x5653('0x34')][_0x5653('0x3d')]+'%'};return _0x560810;}})});}_0x20a035=_['merge']({},_0x20a035,_0x4b07b5[_0x5653('0x40')]);var _0x2fb8f6={'where':_0x20a035[_0x5653('0x3c')]};return db[_0x5653('0x2f')][_0x5653('0x1c')](_0x2fb8f6)['then'](function(_0x1e8565){_0xd128e8[_0x5653('0x1c')]=_0x1e8565;if(_0x4b07b5['query'][_0x5653('0x41')]){_0x20a035['include']=[{'all':!![]}];}return db[_0x5653('0x2f')][_0x5653('0x42')](_0x20a035);})[_0x5653('0x24')](function(_0x560de5){_0xd128e8[_0x5653('0x43')]=_0x560de5;return _0xd128e8;})[_0x5653('0x24')](respondWithFilteredResult(_0x518984,_0x20a035))[_0x5653('0x44')](handleError(_0x518984,null));};exports[_0x5653('0x45')]=function(_0xc20ee7,_0x37c390){var _0x480610={'raw':!![],'where':{'id':_0xc20ee7['params']['id']}},_0x6b8b6c={};_0x6b8b6c[_0x5653('0x33')]=_[_0x5653('0x35')](db['Template']['rawAttributes']);_0x6b8b6c[_0x5653('0x34')]=_[_0x5653('0x35')](_0xc20ee7[_0x5653('0x34')]);_0x6b8b6c[_0x5653('0x36')]=_['intersection'](_0x6b8b6c[_0x5653('0x33')],_0x6b8b6c[_0x5653('0x34')]);_0x480610['attributes']=_['intersection'](_0x6b8b6c[_0x5653('0x33')],qs['fields'](_0xc20ee7['query'][_0x5653('0x39')]));_0x480610[_0x5653('0x38')]=_0x480610[_0x5653('0x38')]['length']?_0x480610[_0x5653('0x38')]:_0x6b8b6c[_0x5653('0x33')];if(_0xc20ee7[_0x5653('0x34')]['includeAll']){_0x480610[_0x5653('0x46')]=[{'all':!![]}];}_0x480610=_[_0x5653('0x3e')]({},_0x480610,_0xc20ee7[_0x5653('0x40')]);return db[_0x5653('0x2f')]['find'](_0x480610)[_0x5653('0x24')](handleEntityNotFound(_0x37c390,null))[_0x5653('0x24')](respondWithResult(_0x37c390,null))[_0x5653('0x44')](handleError(_0x37c390,null));};exports[_0x5653('0x47')]=function(_0x523eb3,_0x16c885){return db[_0x5653('0x2f')][_0x5653('0x47')](_0x523eb3[_0x5653('0x48')],{})[_0x5653('0x24')](function(_0x22e360){var _0x229196=_0x523eb3[_0x5653('0x49')]['get']({'plain':!![]});if(!_0x229196)throw new Error(_0x5653('0x4a'));if(_0x229196['role']===_0x5653('0x49')){var _0x10989e=_0x22e360[_0x5653('0x4b')]({'plain':!![]});var _0x1caa51=_0x5653('0x26');return db[_0x5653('0x4c')][_0x5653('0x4d')]({'where':{'name':_0x1caa51,'userProfileId':_0x229196[_0x5653('0x4e')]},'raw':!![]})[_0x5653('0x24')](function(_0x30f31e){if(_0x30f31e&&_0x30f31e[_0x5653('0x4f')]===0x0){return db[_0x5653('0x27')]['create']({'name':_0x10989e[_0x5653('0x2b')],'resourceId':_0x10989e['id'],'type':_0x30f31e[_0x5653('0x2b')],'sectionId':_0x30f31e['id']},{})[_0x5653('0x24')](function(){return _0x22e360;});}else{return _0x22e360;}})[_0x5653('0x44')](function(_0x379ae4){logger[_0x5653('0x29')](_0x5653('0x50'),_0x379ae4);throw _0x379ae4;});}return _0x22e360;})['then'](respondWithResult(_0x16c885,0xc9))['catch'](handleError(_0x16c885,null));};exports[_0x5653('0x23')]=function(_0x3fc315,_0x27efc6){if(_0x3fc315[_0x5653('0x48')]['id']){delete _0x3fc315[_0x5653('0x48')]['id'];}return db[_0x5653('0x2f')][_0x5653('0x4d')]({'where':{'id':_0x3fc315[_0x5653('0x51')]['id']}})['then'](handleEntityNotFound(_0x27efc6,null))['then'](saveUpdates(_0x3fc315['body'],null))['then'](respondWithResult(_0x27efc6,null))[_0x5653('0x44')](handleError(_0x27efc6,null));};exports['destroy']=function(_0x4e50a3,_0x331088){return db['Template'][_0x5653('0x4d')]({'where':{'id':_0x4e50a3[_0x5653('0x51')]['id']}})[_0x5653('0x24')](handleEntityNotFound(_0x331088,null))[_0x5653('0x24')](removeEntity(_0x331088,null))[_0x5653('0x44')](handleError(_0x331088,null));}; \ No newline at end of file diff --git a/server/api/template/template.model.js b/server/api/template/template.model.js index 6b908fa..8ba0dd9 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 _0x406c=['lodash','../../config/logger','moment','bluebird','request-promise','path','exports','Template','tools_templates'];(function(_0x33a2ba,_0x495ca9){var _0x2d63ae=function(_0xeb3c88){while(--_0xeb3c88){_0x33a2ba['push'](_0x33a2ba['shift']());}};_0x2d63ae(++_0x495ca9);}(_0x406c,0x90));var _0xc406=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0x406c[_0x3dd15e];return _0x231fd0;};'use strict';var _=require(_0xc406('0x0'));var util=require('util');var logger=require(_0xc406('0x1'))('api');var moment=require(_0xc406('0x2'));var BPromise=require(_0xc406('0x3'));var rp=require(_0xc406('0x4'));var fs=require('fs');var path=require(_0xc406('0x5'));var rimraf=require('rimraf');var config=require('../../config/environment');var attributes=require('./template.attributes');module[_0xc406('0x6')]=function(_0x5486cd,_0x42f449){return _0x5486cd['define'](_0xc406('0x7'),attributes,{'tableName':_0xc406('0x8'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0xa70e=['api','moment','request-promise','rimraf','../../config/environment','./template.attributes','exports','tools_templates','../../config/logger'];(function(_0x273c72,_0xc4d949){var _0x164467=function(_0x372a24){while(--_0x372a24){_0x273c72['push'](_0x273c72['shift']());}};_0x164467(++_0xc4d949);}(_0xa70e,0x170));var _0xea70=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0xa70e[_0x3dd15e];return _0x231fd0;};'use strict';var _=require('lodash');var util=require('util');var logger=require(_0xea70('0x0'))(_0xea70('0x1'));var moment=require(_0xea70('0x2'));var BPromise=require('bluebird');var rp=require(_0xea70('0x3'));var fs=require('fs');var path=require('path');var rimraf=require(_0xea70('0x4'));var config=require(_0xea70('0x5'));var attributes=require(_0xea70('0x6'));module[_0xea70('0x7')]=function(_0x35464e,_0x380634){return _0x35464e['define']('Template',attributes,{'tableName':_0xea70('0x8'),'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 dc5c052..df27d32 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 _0xf806=['http','request','then','info','request\x20sent','debug','Template,\x20%s,\x20%s,\x20%s','error','Template,\x20%s,\x20%s','message','result','catch','GetTemplate','Template','findAll','options','raw','where','attributes','limit','include','model','map','stringify','lodash','util','moment','ioredis','../../mysqldb','../../config/utils','../../config/logger','../../config/environment','client'];(function(_0x810064,_0x534820){var _0x1e2adc=function(_0x335da5){while(--_0x335da5){_0x810064['push'](_0x810064['shift']());}};_0x1e2adc(++_0x534820);}(_0xf806,0x1e6));var _0x6f80=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0xf806[_0x3dd15e];return _0x231fd0;};'use strict';var _=require(_0x6f80('0x0'));var util=require(_0x6f80('0x1'));var moment=require(_0x6f80('0x2'));var BPromise=require('bluebird');var rs=require('randomstring');var fs=require('fs');var Redis=require(_0x6f80('0x3'));var db=require(_0x6f80('0x4'))['db'];var utils=require(_0x6f80('0x5'));var logger=require(_0x6f80('0x6'))('rpc');var config=require(_0x6f80('0x7'));var jayson=require('jayson/promise');var client=jayson[_0x6f80('0x8')][_0x6f80('0x9')]({'port':0x232a});function respondWithRpcPromise(_0x2573a5,_0x307772,_0x453919){return new BPromise(function(_0xcb8c0,_0x23c535){return client[_0x6f80('0xa')](_0x2573a5,_0x453919)[_0x6f80('0xb')](function(_0x172620){logger[_0x6f80('0xc')]('Template,\x20%s,\x20%s',_0x307772,_0x6f80('0xd'));logger[_0x6f80('0xe')](_0x6f80('0xf'),_0x307772,_0x6f80('0xd'),JSON['stringify'](_0x172620));if(_0x172620[_0x6f80('0x10')]){if(_0x172620[_0x6f80('0x10')]['code']===0x1f4){logger[_0x6f80('0x10')](_0x6f80('0x11'),_0x307772,_0x172620[_0x6f80('0x10')][_0x6f80('0x12')]);return _0x23c535(_0x172620['error'][_0x6f80('0x12')]);}logger['error'](_0x6f80('0x11'),_0x307772,_0x172620['error'][_0x6f80('0x12')]);return _0xcb8c0(_0x172620[_0x6f80('0x10')][_0x6f80('0x12')]);}else{logger[_0x6f80('0xc')](_0x6f80('0x11'),_0x307772,_0x6f80('0xd'));_0xcb8c0(_0x172620[_0x6f80('0x13')]['message']);}})[_0x6f80('0x14')](function(_0x18b30e){logger[_0x6f80('0x10')](_0x6f80('0x11'),_0x307772,_0x18b30e);_0x23c535(_0x18b30e);});});}exports[_0x6f80('0x15')]=function(_0x543492){var _0x577d2b=this;return new Promise(function(_0x472f1d,_0x1e3289){return db[_0x6f80('0x16')][_0x6f80('0x17')]({'raw':_0x543492['options']?_0x543492[_0x6f80('0x18')][_0x6f80('0x19')]===undefined?!![]:![]:!![],'where':_0x543492['options']?_0x543492[_0x6f80('0x18')][_0x6f80('0x1a')]||null:null,'attributes':_0x543492['options']?_0x543492[_0x6f80('0x18')][_0x6f80('0x1b')]||null:null,'limit':_0x543492['options']?_0x543492[_0x6f80('0x18')][_0x6f80('0x1c')]||null:null,'include':_0x543492[_0x6f80('0x18')]?_0x543492['options'][_0x6f80('0x1d')]?_['map'](_0x543492['options'][_0x6f80('0x1d')],function(_0x187ac4){return{'model':db[_0x187ac4[_0x6f80('0x1e')]],'as':_0x187ac4['as'],'attributes':_0x187ac4[_0x6f80('0x1b')],'include':_0x187ac4[_0x6f80('0x1d')]?_[_0x6f80('0x1f')](_0x187ac4[_0x6f80('0x1d')],function(_0x13df0d){return{'model':db[_0x13df0d['model']],'as':_0x13df0d['as'],'attributes':_0x13df0d['attributes'],'include':_0x13df0d[_0x6f80('0x1d')]?_[_0x6f80('0x1f')](_0x13df0d[_0x6f80('0x1d')],function(_0x284b19){return{'model':db[_0x284b19['model']],'as':_0x284b19['as'],'attributes':_0x284b19[_0x6f80('0x1b')]};}):[]};}):[]};}):[]:[]})['then'](function(_0x5c10ac){logger[_0x6f80('0xc')](_0x6f80('0x15'),_0x543492);logger[_0x6f80('0xe')](_0x6f80('0x15'),_0x543492,JSON[_0x6f80('0x20')](_0x5c10ac));_0x472f1d(_0x5c10ac);})[_0x6f80('0x14')](function(_0x17ea56){logger[_0x6f80('0x10')](_0x6f80('0x15'),_0x17ea56[_0x6f80('0x12')],_0x543492);_0x1e3289(_0x577d2b[_0x6f80('0x10')](0x1f4,_0x17ea56[_0x6f80('0x12')]));});});}; \ No newline at end of file +var _0xdb14=['Template,\x20%s,\x20%s,\x20%s','stringify','error','code','message','result','catch','GetTemplate','Template','findAll','options','attributes','include','map','model','then','util','moment','bluebird','randomstring','ioredis','../../config/utils','../../config/logger','../../config/environment','jayson/promise','client','request','info','Template,\x20%s,\x20%s'];(function(_0x128b50,_0x2f1cf6){var _0x4afe7f=function(_0x264036){while(--_0x264036){_0x128b50['push'](_0x128b50['shift']());}};_0x4afe7f(++_0x2f1cf6);}(_0xdb14,0xdb));var _0x4db1=function(_0x34f3d4,_0x5ae214){_0x34f3d4=_0x34f3d4-0x0;var _0x17f899=_0xdb14[_0x34f3d4];return _0x17f899;};'use strict';var _=require('lodash');var util=require(_0x4db1('0x0'));var moment=require(_0x4db1('0x1'));var BPromise=require(_0x4db1('0x2'));var rs=require(_0x4db1('0x3'));var fs=require('fs');var Redis=require(_0x4db1('0x4'));var db=require('../../mysqldb')['db'];var utils=require(_0x4db1('0x5'));var logger=require(_0x4db1('0x6'))('rpc');var config=require(_0x4db1('0x7'));var jayson=require(_0x4db1('0x8'));var client=jayson[_0x4db1('0x9')]['http']({'port':0x232a});function respondWithRpcPromise(_0x53d731,_0x252929,_0xc00cc9){return new BPromise(function(_0x435aba,_0x26ac81){return client[_0x4db1('0xa')](_0x53d731,_0xc00cc9)['then'](function(_0xb0f3f5){logger[_0x4db1('0xb')](_0x4db1('0xc'),_0x252929,'request\x20sent');logger['debug'](_0x4db1('0xd'),_0x252929,'request\x20sent',JSON[_0x4db1('0xe')](_0xb0f3f5));if(_0xb0f3f5[_0x4db1('0xf')]){if(_0xb0f3f5['error'][_0x4db1('0x10')]===0x1f4){logger[_0x4db1('0xf')](_0x4db1('0xc'),_0x252929,_0xb0f3f5[_0x4db1('0xf')][_0x4db1('0x11')]);return _0x26ac81(_0xb0f3f5[_0x4db1('0xf')][_0x4db1('0x11')]);}logger[_0x4db1('0xf')](_0x4db1('0xc'),_0x252929,_0xb0f3f5[_0x4db1('0xf')][_0x4db1('0x11')]);return _0x435aba(_0xb0f3f5['error'][_0x4db1('0x11')]);}else{logger[_0x4db1('0xb')]('Template,\x20%s,\x20%s',_0x252929,'request\x20sent');_0x435aba(_0xb0f3f5[_0x4db1('0x12')][_0x4db1('0x11')]);}})[_0x4db1('0x13')](function(_0xc95e42){logger[_0x4db1('0xf')](_0x4db1('0xc'),_0x252929,_0xc95e42);_0x26ac81(_0xc95e42);});});}exports[_0x4db1('0x14')]=function(_0x57138c){var _0x296f3d=this;return new Promise(function(_0x1d8ac6,_0x108dfc){return db[_0x4db1('0x15')][_0x4db1('0x16')]({'raw':_0x57138c[_0x4db1('0x17')]?_0x57138c[_0x4db1('0x17')]['raw']===undefined?!![]:![]:!![],'where':_0x57138c[_0x4db1('0x17')]?_0x57138c[_0x4db1('0x17')]['where']||null:null,'attributes':_0x57138c[_0x4db1('0x17')]?_0x57138c[_0x4db1('0x17')][_0x4db1('0x18')]||null:null,'limit':_0x57138c[_0x4db1('0x17')]?_0x57138c[_0x4db1('0x17')]['limit']||null:null,'include':_0x57138c['options']?_0x57138c[_0x4db1('0x17')][_0x4db1('0x19')]?_[_0x4db1('0x1a')](_0x57138c['options'][_0x4db1('0x19')],function(_0xa23270){return{'model':db[_0xa23270[_0x4db1('0x1b')]],'as':_0xa23270['as'],'attributes':_0xa23270['attributes'],'include':_0xa23270['include']?_['map'](_0xa23270[_0x4db1('0x19')],function(_0x1b0170){return{'model':db[_0x1b0170[_0x4db1('0x1b')]],'as':_0x1b0170['as'],'attributes':_0x1b0170[_0x4db1('0x18')],'include':_0x1b0170['include']?_[_0x4db1('0x1a')](_0x1b0170[_0x4db1('0x19')],function(_0x24bbd9){return{'model':db[_0x24bbd9[_0x4db1('0x1b')]],'as':_0x24bbd9['as'],'attributes':_0x24bbd9[_0x4db1('0x18')]};}):[]};}):[]};}):[]:[]})[_0x4db1('0x1c')](function(_0x576c1c){logger[_0x4db1('0xb')]('GetTemplate',_0x57138c);logger['debug'](_0x4db1('0x14'),_0x57138c,JSON[_0x4db1('0xe')](_0x576c1c));_0x1d8ac6(_0x576c1c);})['catch'](function(_0x37ad03){logger[_0x4db1('0xf')](_0x4db1('0x14'),_0x37ad03[_0x4db1('0x11')],_0x57138c);_0x108dfc(_0x296f3d[_0x4db1('0xf')](0x1f4,_0x37ad03['message']));});});}; \ No newline at end of file diff --git a/server/api/trigger/index.js b/server/api/trigger/index.js index df06224..047fcee 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 _0x0be6=['isAuthenticated','index','show','getAllConditions','getAnyConditions','getActions','post','create','/:id/all_conditions','addAllCondition','/:id/any_conditions','addAnyCondition','addAction','put','/:id','update','delete','destroy','path','connect-timeout','express','fs-extra','../../components/interaction/service','../../config/environment','get'];(function(_0x1d4578,_0x20ef02){var _0x31b91c=function(_0x2602fd){while(--_0x2602fd){_0x1d4578['push'](_0x1d4578['shift']());}};_0x31b91c(++_0x20ef02);}(_0x0be6,0xa8));var _0x60be=function(_0x2d9c7e,_0x328f1a){_0x2d9c7e=_0x2d9c7e-0x0;var _0x28ec3e=_0x0be6[_0x2d9c7e];return _0x28ec3e;};'use strict';var multer=require('multer');var util=require('util');var path=require(_0x60be('0x0'));var timeout=require(_0x60be('0x1'));var express=require(_0x60be('0x2'));var router=express['Router']();var fs_extra=require(_0x60be('0x3'));var auth=require('../../components/auth/service');var interaction=require(_0x60be('0x4'));var config=require(_0x60be('0x5'));var controller=require('./trigger.controller');router[_0x60be('0x6')]('/',auth[_0x60be('0x7')](),controller[_0x60be('0x8')]);router['get']('/:id',auth[_0x60be('0x7')](),controller[_0x60be('0x9')]);router['get']('/:id/all_conditions',auth[_0x60be('0x7')](),controller[_0x60be('0xa')]);router['get']('/:id/any_conditions',auth[_0x60be('0x7')](),controller[_0x60be('0xb')]);router[_0x60be('0x6')]('/:id/actions',auth[_0x60be('0x7')](),controller[_0x60be('0xc')]);router[_0x60be('0xd')]('/',auth[_0x60be('0x7')](),controller[_0x60be('0xe')]);router[_0x60be('0xd')](_0x60be('0xf'),auth['isAuthenticated'](),controller[_0x60be('0x10')]);router[_0x60be('0xd')](_0x60be('0x11'),auth['isAuthenticated'](),controller[_0x60be('0x12')]);router['post']('/:id/actions',auth[_0x60be('0x7')](),controller[_0x60be('0x13')]);router[_0x60be('0x14')](_0x60be('0x15'),auth[_0x60be('0x7')](),controller[_0x60be('0x16')]);router[_0x60be('0x17')](_0x60be('0x15'),auth[_0x60be('0x7')](),controller[_0x60be('0x18')]);module['exports']=router; \ No newline at end of file +var _0x40cb=['/:id/actions','getActions','post','create','addAction','put','update','delete','multer','util','path','connect-timeout','express','../../components/interaction/service','./trigger.controller','get','isAuthenticated','index','/:id','show','/:id/all_conditions','/:id/any_conditions','getAnyConditions'];(function(_0x3b8b97,_0x3f7991){var _0x34c233=function(_0x283af0){while(--_0x283af0){_0x3b8b97['push'](_0x3b8b97['shift']());}};_0x34c233(++_0x3f7991);}(_0x40cb,0x105));var _0xb40c=function(_0x41a8f1,_0x4af001){_0x41a8f1=_0x41a8f1-0x0;var _0x10badd=_0x40cb[_0x41a8f1];return _0x10badd;};'use strict';var multer=require(_0xb40c('0x0'));var util=require(_0xb40c('0x1'));var path=require(_0xb40c('0x2'));var timeout=require(_0xb40c('0x3'));var express=require(_0xb40c('0x4'));var router=express['Router']();var fs_extra=require('fs-extra');var auth=require('../../components/auth/service');var interaction=require(_0xb40c('0x5'));var config=require('../../config/environment');var controller=require(_0xb40c('0x6'));router[_0xb40c('0x7')]('/',auth[_0xb40c('0x8')](),controller[_0xb40c('0x9')]);router[_0xb40c('0x7')](_0xb40c('0xa'),auth[_0xb40c('0x8')](),controller[_0xb40c('0xb')]);router[_0xb40c('0x7')](_0xb40c('0xc'),auth['isAuthenticated'](),controller['getAllConditions']);router[_0xb40c('0x7')](_0xb40c('0xd'),auth['isAuthenticated'](),controller[_0xb40c('0xe')]);router[_0xb40c('0x7')](_0xb40c('0xf'),auth[_0xb40c('0x8')](),controller[_0xb40c('0x10')]);router[_0xb40c('0x11')]('/',auth['isAuthenticated'](),controller[_0xb40c('0x12')]);router['post'](_0xb40c('0xc'),auth[_0xb40c('0x8')](),controller['addAllCondition']);router[_0xb40c('0x11')](_0xb40c('0xd'),auth[_0xb40c('0x8')](),controller['addAnyCondition']);router[_0xb40c('0x11')](_0xb40c('0xf'),auth['isAuthenticated'](),controller[_0xb40c('0x13')]);router[_0xb40c('0x14')](_0xb40c('0xa'),auth[_0xb40c('0x8')](),controller[_0xb40c('0x15')]);router[_0xb40c('0x16')]('/:id',auth['isAuthenticated'](),controller['destroy']);module['exports']=router; \ No newline at end of file diff --git a/server/api/trigger/trigger.attributes.js b/server/api/trigger/trigger.attributes.js index a79a813..8a7637e 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 _0x87c0=['exports','STRING','BOOLEAN'];(function(_0x255391,_0x2eb094){var _0x5e4bf9=function(_0x1cad69){while(--_0x1cad69){_0x255391['push'](_0x255391['shift']());}};_0x5e4bf9(++_0x2eb094);}(_0x87c0,0x165));var _0x087c=function(_0x5519a9,_0x1c5147){_0x5519a9=_0x5519a9-0x0;var _0x32f2cc=_0x87c0[_0x5519a9];return _0x32f2cc;};'use strict';var Sequelize=require('sequelize');module[_0x087c('0x0')]={'name':{'type':Sequelize[_0x087c('0x1')]},'channel':{'type':Sequelize[_0x087c('0x1')]},'description':{'type':Sequelize[_0x087c('0x1')]},'status':{'type':Sequelize[_0x087c('0x2')],'defaultValue':![]}}; \ No newline at end of file +var _0xaf9b=['sequelize','STRING','BOOLEAN'];(function(_0x5b4e7f,_0x53e1ec){var _0x40f920=function(_0x269e61){while(--_0x269e61){_0x5b4e7f['push'](_0x5b4e7f['shift']());}};_0x40f920(++_0x53e1ec);}(_0xaf9b,0x87));var _0xbaf9=function(_0x575b13,_0x571e62){_0x575b13=_0x575b13-0x0;var _0x599005=_0xaf9b[_0x575b13];return _0x599005;};'use strict';var Sequelize=require(_0xbaf9('0x0'));module['exports']={'name':{'type':Sequelize[_0xbaf9('0x1')]},'channel':{'type':Sequelize['STRING']},'description':{'type':Sequelize[_0xbaf9('0x1')]},'status':{'type':Sequelize[_0xbaf9('0x2')],'defaultValue':![]}}; \ No newline at end of file diff --git a/server/api/trigger/trigger.controller.js b/server/api/trigger/trigger.controller.js index 64e9575..d71e1e9 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 _0xe4e6=['query','keys','intersection','attributes','fields','length','hasOwnProperty','sort','where','filters','pick','filter','merge','VIRTUAL','options','includeAll','include','findAll','rows','catch','show','params','rawAttributes','find','create','user','get','Unable\x20to\x20retrieve\x20the\x20current\x20user','role','userProfileId','autoAssociation','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','body','addAllCondition','TriggerAllId','addAnyCondition','TriggerAnyId','getAllConditions','findOne','Condition','order','getAnyConditions','getActions','Action','nolimit','eml-format','rimraf','zip-dir','fast-json-patch','moment','bluebird','mustache','util','sox','to-csv','ejs','fs-extra','lodash','crypto','jsforce','desk.js','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/utils','../../config/environment','sendStatus','end','undefined','limit','count','offset','status','set','Content-Range','json','apply','save','update','then','Triggers','UserProfileResource','destroy','error','stack','name','send','index','map','Trigger','fieldName','type','key','model'];(function(_0x583168,_0x39e7eb){var _0x5bf4c7=function(_0x503e22){while(--_0x503e22){_0x583168['push'](_0x583168['shift']());}};_0x5bf4c7(++_0x39e7eb);}(_0xe4e6,0x1b1));var _0x6e4e=function(_0x27d78f,_0x4072eb){_0x27d78f=_0x27d78f-0x0;var _0x90cc3c=_0xe4e6[_0x27d78f];return _0x90cc3c;};'use strict';var emlformat=require(_0x6e4e('0x0'));var rimraf=require(_0x6e4e('0x1'));var zipdir=require(_0x6e4e('0x2'));var jsonpatch=require(_0x6e4e('0x3'));var rp=require('request-promise');var moment=require(_0x6e4e('0x4'));var BPromise=require(_0x6e4e('0x5'));var Mustache=require(_0x6e4e('0x6'));var util=require(_0x6e4e('0x7'));var path=require('path');var sox=require(_0x6e4e('0x8'));var csv=require(_0x6e4e('0x9'));var ejs=require(_0x6e4e('0xa'));var fs=require('fs');var fs_extra=require(_0x6e4e('0xb'));var _=require(_0x6e4e('0xc'));var squel=require('squel');var crypto=require(_0x6e4e('0xd'));var jsforce=require(_0x6e4e('0xe'));var deskjs=require(_0x6e4e('0xf'));var toCsv=require(_0x6e4e('0x9'));var querystring=require(_0x6e4e('0x10'));var Papa=require(_0x6e4e('0x11'));var Redis=require(_0x6e4e('0x12'));var authService=require(_0x6e4e('0x13'));var qs=require('../../components/parsers/qs');var as=require(_0x6e4e('0x14'));var hardwareService=require(_0x6e4e('0x15'));var logger=require('../../config/logger')('api');var utils=require(_0x6e4e('0x16'));var config=require(_0x6e4e('0x17'));var licenseUtil=require('../../config/license/util');var db=require('../../mysqldb')['db'];function respondWithStatusCode(_0x1466a8,_0x18b487){_0x18b487=_0x18b487||0xcc;return function(_0x3fe381){if(_0x3fe381){return _0x1466a8[_0x6e4e('0x18')](_0x18b487);}return _0x1466a8['status'](_0x18b487)[_0x6e4e('0x19')]();};}function respondWithResult(_0x446c91,_0x56430c){_0x56430c=_0x56430c||0xc8;return function(_0x26139c){if(_0x26139c){return _0x446c91['status'](_0x56430c)['json'](_0x26139c);}};}function respondWithFilteredResult(_0x80c4ee,_0x14e2aa){return function(_0x19df9e){if(_0x19df9e){var _0xbfc7db=typeof _0x14e2aa['offset']===_0x6e4e('0x1a')&&typeof _0x14e2aa[_0x6e4e('0x1b')]===_0x6e4e('0x1a');var _0x48a629=_0x19df9e[_0x6e4e('0x1c')];var _0x4f1f16=_0xbfc7db?0x0:_0x14e2aa[_0x6e4e('0x1d')];var _0x3bb49f=_0xbfc7db?_0x19df9e[_0x6e4e('0x1c')]:_0x14e2aa[_0x6e4e('0x1d')]+_0x14e2aa[_0x6e4e('0x1b')];var _0x5b7d36;if(_0x3bb49f>=_0x48a629){_0x3bb49f=_0x48a629;_0x5b7d36=0xc8;}else{_0x5b7d36=0xce;}_0x80c4ee[_0x6e4e('0x1e')](_0x5b7d36);return _0x80c4ee[_0x6e4e('0x1f')](_0x6e4e('0x20'),_0x4f1f16+'-'+_0x3bb49f+'/'+_0x48a629)[_0x6e4e('0x21')](_0x19df9e);}return null;};}function patchUpdates(_0x429cf4){return function(_0x429866){try{jsonpatch[_0x6e4e('0x22')](_0x429866,_0x429cf4,!![]);}catch(_0x3172dc){return BPromise['reject'](_0x3172dc);}return _0x429866[_0x6e4e('0x23')]();};}function saveUpdates(_0xc55789,_0x2b88ff){return function(_0x5ae82a){if(_0x5ae82a){return _0x5ae82a[_0x6e4e('0x24')](_0xc55789)[_0x6e4e('0x25')](function(_0x3673cd){return _0x3673cd;});}return null;};}function removeEntity(_0x101cd5,_0x3b4667){return function(_0x1c4fcd){if(_0x1c4fcd){return _0x1c4fcd['destroy']()['then'](function(){var _0x2eec68=_0x1c4fcd['get']({'plain':!![]});var _0x4ccc59=_0x6e4e('0x26');return db[_0x6e4e('0x27')][_0x6e4e('0x28')]({'where':{'type':_0x4ccc59,'resourceId':_0x2eec68['id']}})[_0x6e4e('0x25')](function(){return _0x1c4fcd;});})[_0x6e4e('0x25')](function(){_0x101cd5[_0x6e4e('0x1e')](0xcc)['end']();});}};}function handleEntityNotFound(_0x5d42d1,_0xa15bb1){return function(_0x48c29e){if(!_0x48c29e){_0x5d42d1[_0x6e4e('0x18')](0x194);}return _0x48c29e;};}function handleError(_0x5b5356,_0x53b91e){_0x53b91e=_0x53b91e||0x1f4;return function(_0x55cd14){logger[_0x6e4e('0x29')](_0x55cd14[_0x6e4e('0x2a')]);if(_0x55cd14[_0x6e4e('0x2b')]){delete _0x55cd14[_0x6e4e('0x2b')];}_0x5b5356[_0x6e4e('0x1e')](_0x53b91e)[_0x6e4e('0x2c')](_0x55cd14);};}exports[_0x6e4e('0x2d')]=function(_0x27d6f5,_0x1eca74){var _0x54587d={},_0x1d0d3a={},_0x291bd0={'count':0x0,'rows':[]};var _0xf38c05=_[_0x6e4e('0x2e')](db[_0x6e4e('0x2f')]['rawAttributes'],function(_0x30155e){return{'name':_0x30155e[_0x6e4e('0x30')],'type':_0x30155e[_0x6e4e('0x31')][_0x6e4e('0x32')]};});_0x1d0d3a[_0x6e4e('0x33')]=_[_0x6e4e('0x2e')](_0xf38c05,_0x6e4e('0x2b'));_0x1d0d3a[_0x6e4e('0x34')]=_[_0x6e4e('0x35')](_0x27d6f5[_0x6e4e('0x34')]);_0x1d0d3a['filters']=_[_0x6e4e('0x36')](_0x1d0d3a['model'],_0x1d0d3a[_0x6e4e('0x34')]);_0x54587d[_0x6e4e('0x37')]=_[_0x6e4e('0x36')](_0x1d0d3a[_0x6e4e('0x33')],qs['fields'](_0x27d6f5[_0x6e4e('0x34')][_0x6e4e('0x38')]));_0x54587d[_0x6e4e('0x37')]=_0x54587d[_0x6e4e('0x37')][_0x6e4e('0x39')]?_0x54587d[_0x6e4e('0x37')]:_0x1d0d3a[_0x6e4e('0x33')];if(!_0x27d6f5['query'][_0x6e4e('0x3a')]('nolimit')){_0x54587d['limit']=qs[_0x6e4e('0x1b')](_0x27d6f5[_0x6e4e('0x34')][_0x6e4e('0x1b')]);_0x54587d[_0x6e4e('0x1d')]=qs[_0x6e4e('0x1d')](_0x27d6f5[_0x6e4e('0x34')][_0x6e4e('0x1d')]);}_0x54587d['order']=qs[_0x6e4e('0x3b')](_0x27d6f5['query'][_0x6e4e('0x3b')]);_0x54587d[_0x6e4e('0x3c')]=qs[_0x6e4e('0x3d')](_[_0x6e4e('0x3e')](_0x27d6f5[_0x6e4e('0x34')],_0x1d0d3a[_0x6e4e('0x3d')]),_0xf38c05);if(_0x27d6f5[_0x6e4e('0x34')][_0x6e4e('0x3f')]){_0x54587d['where']=_[_0x6e4e('0x40')](_0x54587d[_0x6e4e('0x3c')],{'$or':_[_0x6e4e('0x2e')](_0xf38c05,function(_0x56ebd1){if(_0x56ebd1[_0x6e4e('0x31')]!==_0x6e4e('0x41')){var _0x4c79e4={};_0x4c79e4[_0x56ebd1[_0x6e4e('0x2b')]]={'$like':'%'+_0x27d6f5[_0x6e4e('0x34')][_0x6e4e('0x3f')]+'%'};return _0x4c79e4;}})});}_0x54587d=_[_0x6e4e('0x40')]({},_0x54587d,_0x27d6f5[_0x6e4e('0x42')]);var _0x33cb4e={'where':_0x54587d[_0x6e4e('0x3c')]};return db[_0x6e4e('0x2f')][_0x6e4e('0x1c')](_0x33cb4e)[_0x6e4e('0x25')](function(_0xe6f88e){_0x291bd0['count']=_0xe6f88e;if(_0x27d6f5[_0x6e4e('0x34')][_0x6e4e('0x43')]){_0x54587d[_0x6e4e('0x44')]=[{'all':!![]}];}return db[_0x6e4e('0x2f')][_0x6e4e('0x45')](_0x54587d);})[_0x6e4e('0x25')](function(_0x372bab){_0x291bd0[_0x6e4e('0x46')]=_0x372bab;return _0x291bd0;})['then'](respondWithFilteredResult(_0x1eca74,_0x54587d))[_0x6e4e('0x47')](handleError(_0x1eca74,null));};exports[_0x6e4e('0x48')]=function(_0x3642cf,_0x1bbcca){var _0x38fd1c={'raw':![],'where':{'id':_0x3642cf[_0x6e4e('0x49')]['id']}},_0x111b20={};_0x111b20['model']=_['keys'](db['Trigger'][_0x6e4e('0x4a')]);_0x111b20['query']=_[_0x6e4e('0x35')](_0x3642cf['query']);_0x111b20[_0x6e4e('0x3d')]=_[_0x6e4e('0x36')](_0x111b20[_0x6e4e('0x33')],_0x111b20['query']);_0x38fd1c[_0x6e4e('0x37')]=_['intersection'](_0x111b20[_0x6e4e('0x33')],qs[_0x6e4e('0x38')](_0x3642cf['query'][_0x6e4e('0x38')]));_0x38fd1c[_0x6e4e('0x37')]=_0x38fd1c['attributes'][_0x6e4e('0x39')]?_0x38fd1c[_0x6e4e('0x37')]:_0x111b20['model'];if(_0x3642cf[_0x6e4e('0x34')][_0x6e4e('0x43')]){_0x38fd1c[_0x6e4e('0x44')]=[{'all':!![]}];}_0x38fd1c=_[_0x6e4e('0x40')]({},_0x38fd1c,_0x3642cf[_0x6e4e('0x42')]);return db[_0x6e4e('0x2f')][_0x6e4e('0x4b')](_0x38fd1c)[_0x6e4e('0x25')](handleEntityNotFound(_0x1bbcca,null))[_0x6e4e('0x25')](respondWithResult(_0x1bbcca,null))['catch'](handleError(_0x1bbcca,null));};exports[_0x6e4e('0x4c')]=function(_0x3c5eec,_0x47629d){return db[_0x6e4e('0x2f')]['create'](_0x3c5eec['body'],{})[_0x6e4e('0x25')](function(_0xebc82d){var _0x1a338b=_0x3c5eec[_0x6e4e('0x4d')][_0x6e4e('0x4e')]({'plain':!![]});if(!_0x1a338b)throw new Error(_0x6e4e('0x4f'));if(_0x1a338b[_0x6e4e('0x50')]===_0x6e4e('0x4d')){var _0x2d58f5=_0xebc82d[_0x6e4e('0x4e')]({'plain':!![]});var _0x234722=_0x6e4e('0x26');return db['UserProfileSection'][_0x6e4e('0x4b')]({'where':{'name':_0x234722,'userProfileId':_0x1a338b[_0x6e4e('0x51')]},'raw':!![]})['then'](function(_0xb0cf52){if(_0xb0cf52&&_0xb0cf52[_0x6e4e('0x52')]===0x0){return db[_0x6e4e('0x27')][_0x6e4e('0x4c')]({'name':_0x2d58f5[_0x6e4e('0x2b')],'resourceId':_0x2d58f5['id'],'type':_0xb0cf52[_0x6e4e('0x2b')],'sectionId':_0xb0cf52['id']},{})[_0x6e4e('0x25')](function(){return _0xebc82d;});}else{return _0xebc82d;}})[_0x6e4e('0x47')](function(_0x392fb8){logger[_0x6e4e('0x29')](_0x6e4e('0x53'),_0x392fb8);throw _0x392fb8;});}return _0xebc82d;})[_0x6e4e('0x25')](respondWithResult(_0x47629d,0xc9))[_0x6e4e('0x47')](handleError(_0x47629d,null));};exports[_0x6e4e('0x24')]=function(_0x117fdb,_0x281b29){if(_0x117fdb[_0x6e4e('0x54')]['id']){delete _0x117fdb[_0x6e4e('0x54')]['id'];}return db['Trigger'][_0x6e4e('0x4b')]({'where':{'id':_0x117fdb['params']['id']}})['then'](handleEntityNotFound(_0x281b29,null))[_0x6e4e('0x25')](saveUpdates(_0x117fdb[_0x6e4e('0x54')],null))['then'](respondWithResult(_0x281b29,null))[_0x6e4e('0x47')](handleError(_0x281b29,null));};exports['destroy']=function(_0x502c97,_0x2d7d24){return db[_0x6e4e('0x2f')][_0x6e4e('0x4b')]({'where':{'id':_0x502c97[_0x6e4e('0x49')]['id']}})[_0x6e4e('0x25')](handleEntityNotFound(_0x2d7d24,null))[_0x6e4e('0x25')](removeEntity(_0x2d7d24,null))['catch'](handleError(_0x2d7d24,null));};exports[_0x6e4e('0x55')]=function(_0xf82066,_0x1c7333,_0x5be9c8){if(_0xf82066[_0x6e4e('0x54')]['id']){delete _0xf82066[_0x6e4e('0x54')]['id'];}return db[_0x6e4e('0x2f')]['find']({'where':{'id':_0xf82066[_0x6e4e('0x49')]['id']}})['then'](handleEntityNotFound(_0x1c7333,null))['then'](function(_0x2f7627){if(_0x2f7627){_0xf82066[_0x6e4e('0x54')][_0x6e4e('0x56')]=_0x2f7627['id'];return db['Condition'][_0x6e4e('0x4c')](_0xf82066[_0x6e4e('0x54')]);}})[_0x6e4e('0x25')](respondWithResult(_0x1c7333,null))[_0x6e4e('0x47')](handleError(_0x1c7333,null));};exports[_0x6e4e('0x57')]=function(_0x4913a4,_0x46f384,_0x5a3807){if(_0x4913a4[_0x6e4e('0x54')]['id']){delete _0x4913a4[_0x6e4e('0x54')]['id'];}return db['Trigger'][_0x6e4e('0x4b')]({'where':{'id':_0x4913a4[_0x6e4e('0x49')]['id']}})[_0x6e4e('0x25')](handleEntityNotFound(_0x46f384,null))[_0x6e4e('0x25')](function(_0x88ec26){if(_0x88ec26){_0x4913a4[_0x6e4e('0x54')][_0x6e4e('0x58')]=_0x88ec26['id'];return db['Condition'][_0x6e4e('0x4c')](_0x4913a4[_0x6e4e('0x54')]);}})[_0x6e4e('0x25')](respondWithResult(_0x46f384,null))[_0x6e4e('0x47')](handleError(_0x46f384,null));};exports[_0x6e4e('0x59')]=function(_0x5f3ad9,_0x2ef052,_0x4056b1){var _0x1a4af5={};var _0x2bbd9e={};var _0x43b73b;var _0x1c6cd1;return db['Trigger'][_0x6e4e('0x5a')]({'where':{'id':_0x5f3ad9[_0x6e4e('0x49')]['id']}})[_0x6e4e('0x25')](handleEntityNotFound(_0x2ef052,null))[_0x6e4e('0x25')](function(_0x917ecb){if(_0x917ecb){_0x43b73b=_0x917ecb;_0x2bbd9e[_0x6e4e('0x33')]=_[_0x6e4e('0x35')](db['Condition'][_0x6e4e('0x4a')]);_0x2bbd9e[_0x6e4e('0x34')]=_[_0x6e4e('0x35')](_0x5f3ad9['query']);_0x2bbd9e['filters']=_['intersection'](_0x2bbd9e[_0x6e4e('0x33')],_0x2bbd9e[_0x6e4e('0x34')]);_0x1a4af5['attributes']=_['intersection'](_0x2bbd9e[_0x6e4e('0x33')],qs[_0x6e4e('0x38')](_0x5f3ad9[_0x6e4e('0x34')]['fields']));_0x1a4af5['attributes']=_0x1a4af5[_0x6e4e('0x37')]['length']?_0x1a4af5['attributes']:_0x2bbd9e[_0x6e4e('0x33')];_0x1a4af5['order']=qs['sort'](_0x5f3ad9[_0x6e4e('0x34')][_0x6e4e('0x3b')]);_0x1a4af5[_0x6e4e('0x3c')]=qs[_0x6e4e('0x3d')](_[_0x6e4e('0x3e')](_0x5f3ad9[_0x6e4e('0x34')],_0x2bbd9e[_0x6e4e('0x3d')]));if(_0x5f3ad9[_0x6e4e('0x34')][_0x6e4e('0x3f')]){_0x1a4af5[_0x6e4e('0x3c')]=_[_0x6e4e('0x40')](_0x1a4af5[_0x6e4e('0x3c')],{'$or':_[_0x6e4e('0x2e')](_0x1a4af5[_0x6e4e('0x37')],function(_0x35b32a){var _0x48693c={};_0x48693c[_0x35b32a]={'$like':'%'+_0x5f3ad9['query'][_0x6e4e('0x3f')]+'%'};return _0x48693c;})});}_0x1a4af5=_['merge']({},_0x1a4af5,_0x5f3ad9[_0x6e4e('0x42')]);return _0x43b73b[_0x6e4e('0x59')](_0x1a4af5);}})['then'](function(_0x34d135){if(_0x34d135){_0x1c6cd1=_0x34d135[_0x6e4e('0x39')];if(!_0x5f3ad9['query'][_0x6e4e('0x3a')]('nolimit')){_0x1a4af5[_0x6e4e('0x1b')]=qs[_0x6e4e('0x1b')](_0x5f3ad9[_0x6e4e('0x34')]['limit']);_0x1a4af5[_0x6e4e('0x1d')]=qs[_0x6e4e('0x1d')](_0x5f3ad9['query']['offset']);}return _0x43b73b[_0x6e4e('0x59')](_0x1a4af5);}})['then'](function(_0x1c8156){if(_0x1c8156){return _0x1c8156?{'count':_0x1c6cd1,'rows':_0x1c8156}:null;}})[_0x6e4e('0x25')](respondWithResult(_0x2ef052,null))['catch'](handleError(_0x2ef052,null));};exports['getAnyConditions']=function(_0x18e96e,_0x116611,_0x32c9fe){var _0x3e8c59={};var _0x5aa649={};var _0x311bf1;var _0x20e032;return db[_0x6e4e('0x2f')][_0x6e4e('0x5a')]({'where':{'id':_0x18e96e[_0x6e4e('0x49')]['id']}})[_0x6e4e('0x25')](handleEntityNotFound(_0x116611,null))['then'](function(_0x13ad87){if(_0x13ad87){_0x311bf1=_0x13ad87;_0x5aa649[_0x6e4e('0x33')]=_['keys'](db[_0x6e4e('0x5b')]['rawAttributes']);_0x5aa649[_0x6e4e('0x34')]=_[_0x6e4e('0x35')](_0x18e96e[_0x6e4e('0x34')]);_0x5aa649['filters']=_[_0x6e4e('0x36')](_0x5aa649[_0x6e4e('0x33')],_0x5aa649[_0x6e4e('0x34')]);_0x3e8c59[_0x6e4e('0x37')]=_[_0x6e4e('0x36')](_0x5aa649[_0x6e4e('0x33')],qs[_0x6e4e('0x38')](_0x18e96e[_0x6e4e('0x34')][_0x6e4e('0x38')]));_0x3e8c59[_0x6e4e('0x37')]=_0x3e8c59[_0x6e4e('0x37')][_0x6e4e('0x39')]?_0x3e8c59['attributes']:_0x5aa649[_0x6e4e('0x33')];_0x3e8c59[_0x6e4e('0x5c')]=qs[_0x6e4e('0x3b')](_0x18e96e[_0x6e4e('0x34')][_0x6e4e('0x3b')]);_0x3e8c59['where']=qs[_0x6e4e('0x3d')](_['pick'](_0x18e96e['query'],_0x5aa649[_0x6e4e('0x3d')]));if(_0x18e96e['query'][_0x6e4e('0x3f')]){_0x3e8c59['where']=_[_0x6e4e('0x40')](_0x3e8c59[_0x6e4e('0x3c')],{'$or':_[_0x6e4e('0x2e')](_0x3e8c59[_0x6e4e('0x37')],function(_0x1baf44){var _0x1fe13a={};_0x1fe13a[_0x1baf44]={'$like':'%'+_0x18e96e[_0x6e4e('0x34')][_0x6e4e('0x3f')]+'%'};return _0x1fe13a;})});}_0x3e8c59=_['merge']({},_0x3e8c59,_0x18e96e[_0x6e4e('0x42')]);return _0x311bf1[_0x6e4e('0x5d')](_0x3e8c59);}})['then'](function(_0x267ff3){if(_0x267ff3){_0x20e032=_0x267ff3['length'];if(!_0x18e96e[_0x6e4e('0x34')][_0x6e4e('0x3a')]('nolimit')){_0x3e8c59[_0x6e4e('0x1b')]=qs['limit'](_0x18e96e[_0x6e4e('0x34')][_0x6e4e('0x1b')]);_0x3e8c59[_0x6e4e('0x1d')]=qs[_0x6e4e('0x1d')](_0x18e96e[_0x6e4e('0x34')][_0x6e4e('0x1d')]);}return _0x311bf1[_0x6e4e('0x5d')](_0x3e8c59);}})[_0x6e4e('0x25')](function(_0x6ac64a){if(_0x6ac64a){return _0x6ac64a?{'count':_0x20e032,'rows':_0x6ac64a}:null;}})[_0x6e4e('0x25')](respondWithResult(_0x116611,null))[_0x6e4e('0x47')](handleError(_0x116611,null));};exports['addAction']=function(_0x1a2964,_0x380978,_0x26c99b){if(_0x1a2964[_0x6e4e('0x54')]['id']){delete _0x1a2964[_0x6e4e('0x54')]['id'];}return db[_0x6e4e('0x2f')][_0x6e4e('0x4b')]({'where':{'id':_0x1a2964[_0x6e4e('0x49')]['id']}})['then'](handleEntityNotFound(_0x380978,null))['then'](function(_0xb798f){if(_0xb798f){_0x1a2964[_0x6e4e('0x54')]['TriggerId']=_0xb798f['id'];return db['Action']['create'](_0x1a2964[_0x6e4e('0x54')]);}})[_0x6e4e('0x25')](respondWithResult(_0x380978,null))['catch'](handleError(_0x380978,null));};exports[_0x6e4e('0x5e')]=function(_0x14f8a7,_0x2acd07,_0x264b1d){var _0x2eba8d={};var _0x364ce1={};var _0x235efa;var _0x50c4d2;return db[_0x6e4e('0x2f')]['findOne']({'where':{'id':_0x14f8a7['params']['id']}})['then'](handleEntityNotFound(_0x2acd07,null))[_0x6e4e('0x25')](function(_0x7c7288){if(_0x7c7288){_0x235efa=_0x7c7288;_0x364ce1[_0x6e4e('0x33')]=_[_0x6e4e('0x35')](db[_0x6e4e('0x5f')][_0x6e4e('0x4a')]);_0x364ce1[_0x6e4e('0x34')]=_['keys'](_0x14f8a7[_0x6e4e('0x34')]);_0x364ce1[_0x6e4e('0x3d')]=_[_0x6e4e('0x36')](_0x364ce1[_0x6e4e('0x33')],_0x364ce1[_0x6e4e('0x34')]);_0x2eba8d[_0x6e4e('0x37')]=_[_0x6e4e('0x36')](_0x364ce1[_0x6e4e('0x33')],qs[_0x6e4e('0x38')](_0x14f8a7[_0x6e4e('0x34')][_0x6e4e('0x38')]));_0x2eba8d[_0x6e4e('0x37')]=_0x2eba8d['attributes'][_0x6e4e('0x39')]?_0x2eba8d[_0x6e4e('0x37')]:_0x364ce1['model'];_0x2eba8d[_0x6e4e('0x5c')]=qs[_0x6e4e('0x3b')](_0x14f8a7[_0x6e4e('0x34')][_0x6e4e('0x3b')]);_0x2eba8d[_0x6e4e('0x3c')]=qs[_0x6e4e('0x3d')](_[_0x6e4e('0x3e')](_0x14f8a7['query'],_0x364ce1['filters']));if(_0x14f8a7['query']['filter']){_0x2eba8d[_0x6e4e('0x3c')]=_['merge'](_0x2eba8d['where'],{'$or':_[_0x6e4e('0x2e')](_0x2eba8d[_0x6e4e('0x37')],function(_0x21c177){var _0x214bdb={};_0x214bdb[_0x21c177]={'$like':'%'+_0x14f8a7[_0x6e4e('0x34')][_0x6e4e('0x3f')]+'%'};return _0x214bdb;})});}_0x2eba8d=_[_0x6e4e('0x40')]({},_0x2eba8d,_0x14f8a7[_0x6e4e('0x42')]);return _0x235efa[_0x6e4e('0x5e')](_0x2eba8d);}})['then'](function(_0x25e8fa){if(_0x25e8fa){_0x50c4d2=_0x25e8fa['length'];if(!_0x14f8a7[_0x6e4e('0x34')][_0x6e4e('0x3a')](_0x6e4e('0x60'))){_0x2eba8d[_0x6e4e('0x1b')]=qs[_0x6e4e('0x1b')](_0x14f8a7[_0x6e4e('0x34')][_0x6e4e('0x1b')]);_0x2eba8d[_0x6e4e('0x1d')]=qs[_0x6e4e('0x1d')](_0x14f8a7['query'][_0x6e4e('0x1d')]);}return _0x235efa[_0x6e4e('0x5e')](_0x2eba8d);}})[_0x6e4e('0x25')](function(_0x1025df){if(_0x1025df){return _0x1025df?{'count':_0x50c4d2,'rows':_0x1025df}:null;}})[_0x6e4e('0x25')](respondWithResult(_0x2acd07,null))[_0x6e4e('0x47')](handleError(_0x2acd07,null));}; \ No newline at end of file +var _0xd73d=['ejs','lodash','desk.js','to-csv','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/license/util','../../mysqldb','sendStatus','end','json','offset','undefined','limit','count','status','set','Content-Range','apply','reject','save','update','destroy','then','get','Triggers','UserProfileResource','error','stack','name','send','index','Trigger','fieldName','key','model','map','query','keys','filters','intersection','attributes','fields','length','hasOwnProperty','nolimit','order','sort','where','pick','filter','merge','type','VIRTUAL','options','includeAll','include','findAll','rows','catch','show','rawAttributes','find','create','body','user','Unable\x20to\x20retrieve\x20the\x20current\x20user','UserProfileSection','userProfileId','autoAssociation','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','params','addAllCondition','TriggerAllId','Condition','addAnyCondition','TriggerAnyId','getAllConditions','findOne','getAnyConditions','Action','getActions','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','moment','bluebird','mustache','util','path'];(function(_0x8f4294,_0x259c77){var _0x114cc0=function(_0x3bcdb7){while(--_0x3bcdb7){_0x8f4294['push'](_0x8f4294['shift']());}};_0x114cc0(++_0x259c77);}(_0xd73d,0x11c));var _0xdd73=function(_0x5a89ea,_0x436388){_0x5a89ea=_0x5a89ea-0x0;var _0x21193d=_0xd73d[_0x5a89ea];return _0x21193d;};'use strict';var emlformat=require(_0xdd73('0x0'));var rimraf=require(_0xdd73('0x1'));var zipdir=require(_0xdd73('0x2'));var jsonpatch=require(_0xdd73('0x3'));var rp=require(_0xdd73('0x4'));var moment=require(_0xdd73('0x5'));var BPromise=require(_0xdd73('0x6'));var Mustache=require(_0xdd73('0x7'));var util=require(_0xdd73('0x8'));var path=require(_0xdd73('0x9'));var sox=require('sox');var csv=require('to-csv');var ejs=require(_0xdd73('0xa'));var fs=require('fs');var fs_extra=require('fs-extra');var _=require(_0xdd73('0xb'));var squel=require('squel');var crypto=require('crypto');var jsforce=require('jsforce');var deskjs=require(_0xdd73('0xc'));var toCsv=require(_0xdd73('0xd'));var querystring=require('querystring');var Papa=require('papaparse');var Redis=require(_0xdd73('0xe'));var authService=require(_0xdd73('0xf'));var qs=require(_0xdd73('0x10'));var as=require(_0xdd73('0x11'));var hardwareService=require(_0xdd73('0x12'));var logger=require(_0xdd73('0x13'))(_0xdd73('0x14'));var utils=require(_0xdd73('0x15'));var config=require('../../config/environment');var licenseUtil=require(_0xdd73('0x16'));var db=require(_0xdd73('0x17'))['db'];function respondWithStatusCode(_0x411a4c,_0x18b2c3){_0x18b2c3=_0x18b2c3||0xcc;return function(_0x529b9c){if(_0x529b9c){return _0x411a4c[_0xdd73('0x18')](_0x18b2c3);}return _0x411a4c['status'](_0x18b2c3)[_0xdd73('0x19')]();};}function respondWithResult(_0x1552fd,_0x3e964f){_0x3e964f=_0x3e964f||0xc8;return function(_0x17e1b4){if(_0x17e1b4){return _0x1552fd['status'](_0x3e964f)[_0xdd73('0x1a')](_0x17e1b4);}};}function respondWithFilteredResult(_0xffce00,_0x2e5547){return function(_0x157828){if(_0x157828){var _0x261685=typeof _0x2e5547[_0xdd73('0x1b')]===_0xdd73('0x1c')&&typeof _0x2e5547[_0xdd73('0x1d')]==='undefined';var _0x3f9b9c=_0x157828['count'];var _0x5d9bf5=_0x261685?0x0:_0x2e5547['offset'];var _0x4f2b19=_0x261685?_0x157828[_0xdd73('0x1e')]:_0x2e5547[_0xdd73('0x1b')]+_0x2e5547[_0xdd73('0x1d')];var _0x24109c;if(_0x4f2b19>=_0x3f9b9c){_0x4f2b19=_0x3f9b9c;_0x24109c=0xc8;}else{_0x24109c=0xce;}_0xffce00[_0xdd73('0x1f')](_0x24109c);return _0xffce00[_0xdd73('0x20')](_0xdd73('0x21'),_0x5d9bf5+'-'+_0x4f2b19+'/'+_0x3f9b9c)[_0xdd73('0x1a')](_0x157828);}return null;};}function patchUpdates(_0x4815a1){return function(_0x282f42){try{jsonpatch[_0xdd73('0x22')](_0x282f42,_0x4815a1,!![]);}catch(_0x5ca51d){return BPromise[_0xdd73('0x23')](_0x5ca51d);}return _0x282f42[_0xdd73('0x24')]();};}function saveUpdates(_0x85ac82,_0x371b4f){return function(_0x1e7549){if(_0x1e7549){return _0x1e7549[_0xdd73('0x25')](_0x85ac82)['then'](function(_0x42c54c){return _0x42c54c;});}return null;};}function removeEntity(_0xc5647f,_0x20dc61){return function(_0x180e0e){if(_0x180e0e){return _0x180e0e[_0xdd73('0x26')]()[_0xdd73('0x27')](function(){var _0x3bc0b0=_0x180e0e[_0xdd73('0x28')]({'plain':!![]});var _0xe92c0f=_0xdd73('0x29');return db[_0xdd73('0x2a')][_0xdd73('0x26')]({'where':{'type':_0xe92c0f,'resourceId':_0x3bc0b0['id']}})[_0xdd73('0x27')](function(){return _0x180e0e;});})[_0xdd73('0x27')](function(){_0xc5647f['status'](0xcc)['end']();});}};}function handleEntityNotFound(_0x483a66,_0x564556){return function(_0x5cf176){if(!_0x5cf176){_0x483a66['sendStatus'](0x194);}return _0x5cf176;};}function handleError(_0x5de344,_0x4a10f4){_0x4a10f4=_0x4a10f4||0x1f4;return function(_0x503ddb){logger[_0xdd73('0x2b')](_0x503ddb[_0xdd73('0x2c')]);if(_0x503ddb[_0xdd73('0x2d')]){delete _0x503ddb[_0xdd73('0x2d')];}_0x5de344[_0xdd73('0x1f')](_0x4a10f4)[_0xdd73('0x2e')](_0x503ddb);};}exports[_0xdd73('0x2f')]=function(_0x403c0c,_0x5b142b){var _0x43f346={},_0x1f5447={},_0x5c709f={'count':0x0,'rows':[]};var _0x508841=_['map'](db[_0xdd73('0x30')]['rawAttributes'],function(_0x51a271){return{'name':_0x51a271[_0xdd73('0x31')],'type':_0x51a271['type'][_0xdd73('0x32')]};});_0x1f5447[_0xdd73('0x33')]=_[_0xdd73('0x34')](_0x508841,_0xdd73('0x2d'));_0x1f5447[_0xdd73('0x35')]=_[_0xdd73('0x36')](_0x403c0c[_0xdd73('0x35')]);_0x1f5447[_0xdd73('0x37')]=_[_0xdd73('0x38')](_0x1f5447['model'],_0x1f5447[_0xdd73('0x35')]);_0x43f346[_0xdd73('0x39')]=_[_0xdd73('0x38')](_0x1f5447['model'],qs[_0xdd73('0x3a')](_0x403c0c['query']['fields']));_0x43f346[_0xdd73('0x39')]=_0x43f346['attributes'][_0xdd73('0x3b')]?_0x43f346[_0xdd73('0x39')]:_0x1f5447[_0xdd73('0x33')];if(!_0x403c0c[_0xdd73('0x35')][_0xdd73('0x3c')](_0xdd73('0x3d'))){_0x43f346[_0xdd73('0x1d')]=qs[_0xdd73('0x1d')](_0x403c0c['query'][_0xdd73('0x1d')]);_0x43f346[_0xdd73('0x1b')]=qs[_0xdd73('0x1b')](_0x403c0c[_0xdd73('0x35')][_0xdd73('0x1b')]);}_0x43f346[_0xdd73('0x3e')]=qs[_0xdd73('0x3f')](_0x403c0c[_0xdd73('0x35')][_0xdd73('0x3f')]);_0x43f346[_0xdd73('0x40')]=qs[_0xdd73('0x37')](_[_0xdd73('0x41')](_0x403c0c[_0xdd73('0x35')],_0x1f5447['filters']),_0x508841);if(_0x403c0c[_0xdd73('0x35')][_0xdd73('0x42')]){_0x43f346[_0xdd73('0x40')]=_[_0xdd73('0x43')](_0x43f346[_0xdd73('0x40')],{'$or':_[_0xdd73('0x34')](_0x508841,function(_0x554787){if(_0x554787[_0xdd73('0x44')]!==_0xdd73('0x45')){var _0x57efe4={};_0x57efe4[_0x554787[_0xdd73('0x2d')]]={'$like':'%'+_0x403c0c[_0xdd73('0x35')][_0xdd73('0x42')]+'%'};return _0x57efe4;}})});}_0x43f346=_[_0xdd73('0x43')]({},_0x43f346,_0x403c0c[_0xdd73('0x46')]);var _0x35478c={'where':_0x43f346[_0xdd73('0x40')]};return db[_0xdd73('0x30')][_0xdd73('0x1e')](_0x35478c)['then'](function(_0x5115a1){_0x5c709f[_0xdd73('0x1e')]=_0x5115a1;if(_0x403c0c[_0xdd73('0x35')][_0xdd73('0x47')]){_0x43f346[_0xdd73('0x48')]=[{'all':!![]}];}return db[_0xdd73('0x30')][_0xdd73('0x49')](_0x43f346);})[_0xdd73('0x27')](function(_0x267c97){_0x5c709f[_0xdd73('0x4a')]=_0x267c97;return _0x5c709f;})['then'](respondWithFilteredResult(_0x5b142b,_0x43f346))[_0xdd73('0x4b')](handleError(_0x5b142b,null));};exports[_0xdd73('0x4c')]=function(_0x57aa50,_0x5ca734){var _0x5d1878={'raw':![],'where':{'id':_0x57aa50['params']['id']}},_0x579625={};_0x579625[_0xdd73('0x33')]=_['keys'](db[_0xdd73('0x30')][_0xdd73('0x4d')]);_0x579625[_0xdd73('0x35')]=_[_0xdd73('0x36')](_0x57aa50['query']);_0x579625[_0xdd73('0x37')]=_[_0xdd73('0x38')](_0x579625[_0xdd73('0x33')],_0x579625[_0xdd73('0x35')]);_0x5d1878[_0xdd73('0x39')]=_['intersection'](_0x579625[_0xdd73('0x33')],qs[_0xdd73('0x3a')](_0x57aa50[_0xdd73('0x35')]['fields']));_0x5d1878[_0xdd73('0x39')]=_0x5d1878[_0xdd73('0x39')][_0xdd73('0x3b')]?_0x5d1878[_0xdd73('0x39')]:_0x579625['model'];if(_0x57aa50[_0xdd73('0x35')][_0xdd73('0x47')]){_0x5d1878['include']=[{'all':!![]}];}_0x5d1878=_['merge']({},_0x5d1878,_0x57aa50['options']);return db[_0xdd73('0x30')][_0xdd73('0x4e')](_0x5d1878)[_0xdd73('0x27')](handleEntityNotFound(_0x5ca734,null))[_0xdd73('0x27')](respondWithResult(_0x5ca734,null))[_0xdd73('0x4b')](handleError(_0x5ca734,null));};exports['create']=function(_0x55b8a5,_0x59af5f){return db[_0xdd73('0x30')][_0xdd73('0x4f')](_0x55b8a5[_0xdd73('0x50')],{})[_0xdd73('0x27')](function(_0x8e15f5){var _0x18cdb0=_0x55b8a5[_0xdd73('0x51')][_0xdd73('0x28')]({'plain':!![]});if(!_0x18cdb0)throw new Error(_0xdd73('0x52'));if(_0x18cdb0['role']===_0xdd73('0x51')){var _0x35543e=_0x8e15f5[_0xdd73('0x28')]({'plain':!![]});var _0x30eece='Triggers';return db[_0xdd73('0x53')][_0xdd73('0x4e')]({'where':{'name':_0x30eece,'userProfileId':_0x18cdb0[_0xdd73('0x54')]},'raw':!![]})[_0xdd73('0x27')](function(_0x12b5cf){if(_0x12b5cf&&_0x12b5cf[_0xdd73('0x55')]===0x0){return db['UserProfileResource']['create']({'name':_0x35543e[_0xdd73('0x2d')],'resourceId':_0x35543e['id'],'type':_0x12b5cf[_0xdd73('0x2d')],'sectionId':_0x12b5cf['id']},{})[_0xdd73('0x27')](function(){return _0x8e15f5;});}else{return _0x8e15f5;}})[_0xdd73('0x4b')](function(_0x193297){logger['error'](_0xdd73('0x56'),_0x193297);throw _0x193297;});}return _0x8e15f5;})[_0xdd73('0x27')](respondWithResult(_0x59af5f,0xc9))[_0xdd73('0x4b')](handleError(_0x59af5f,null));};exports['update']=function(_0x1becbb,_0x4e744c){if(_0x1becbb[_0xdd73('0x50')]['id']){delete _0x1becbb['body']['id'];}return db['Trigger'][_0xdd73('0x4e')]({'where':{'id':_0x1becbb[_0xdd73('0x57')]['id']}})[_0xdd73('0x27')](handleEntityNotFound(_0x4e744c,null))[_0xdd73('0x27')](saveUpdates(_0x1becbb['body'],null))[_0xdd73('0x27')](respondWithResult(_0x4e744c,null))[_0xdd73('0x4b')](handleError(_0x4e744c,null));};exports['destroy']=function(_0x4dd5ca,_0x18750b){return db[_0xdd73('0x30')][_0xdd73('0x4e')]({'where':{'id':_0x4dd5ca[_0xdd73('0x57')]['id']}})['then'](handleEntityNotFound(_0x18750b,null))[_0xdd73('0x27')](removeEntity(_0x18750b,null))[_0xdd73('0x4b')](handleError(_0x18750b,null));};exports[_0xdd73('0x58')]=function(_0x5a7244,_0x38fe53,_0x83e0de){if(_0x5a7244[_0xdd73('0x50')]['id']){delete _0x5a7244['body']['id'];}return db[_0xdd73('0x30')][_0xdd73('0x4e')]({'where':{'id':_0x5a7244[_0xdd73('0x57')]['id']}})[_0xdd73('0x27')](handleEntityNotFound(_0x38fe53,null))[_0xdd73('0x27')](function(_0x48989b){if(_0x48989b){_0x5a7244[_0xdd73('0x50')][_0xdd73('0x59')]=_0x48989b['id'];return db[_0xdd73('0x5a')][_0xdd73('0x4f')](_0x5a7244[_0xdd73('0x50')]);}})[_0xdd73('0x27')](respondWithResult(_0x38fe53,null))[_0xdd73('0x4b')](handleError(_0x38fe53,null));};exports[_0xdd73('0x5b')]=function(_0xf2c9d3,_0x23eb04,_0x595815){if(_0xf2c9d3['body']['id']){delete _0xf2c9d3[_0xdd73('0x50')]['id'];}return db[_0xdd73('0x30')][_0xdd73('0x4e')]({'where':{'id':_0xf2c9d3['params']['id']}})[_0xdd73('0x27')](handleEntityNotFound(_0x23eb04,null))[_0xdd73('0x27')](function(_0x3daf4a){if(_0x3daf4a){_0xf2c9d3[_0xdd73('0x50')][_0xdd73('0x5c')]=_0x3daf4a['id'];return db[_0xdd73('0x5a')]['create'](_0xf2c9d3[_0xdd73('0x50')]);}})[_0xdd73('0x27')](respondWithResult(_0x23eb04,null))['catch'](handleError(_0x23eb04,null));};exports[_0xdd73('0x5d')]=function(_0x5d90df,_0x320898,_0x5f46c4){var _0x185901={};var _0x39a901={};var _0xa5d0bc;var _0x56be10;return db[_0xdd73('0x30')][_0xdd73('0x5e')]({'where':{'id':_0x5d90df[_0xdd73('0x57')]['id']}})[_0xdd73('0x27')](handleEntityNotFound(_0x320898,null))[_0xdd73('0x27')](function(_0x2388a4){if(_0x2388a4){_0xa5d0bc=_0x2388a4;_0x39a901[_0xdd73('0x33')]=_[_0xdd73('0x36')](db[_0xdd73('0x5a')]['rawAttributes']);_0x39a901[_0xdd73('0x35')]=_[_0xdd73('0x36')](_0x5d90df[_0xdd73('0x35')]);_0x39a901['filters']=_[_0xdd73('0x38')](_0x39a901[_0xdd73('0x33')],_0x39a901['query']);_0x185901[_0xdd73('0x39')]=_[_0xdd73('0x38')](_0x39a901[_0xdd73('0x33')],qs[_0xdd73('0x3a')](_0x5d90df[_0xdd73('0x35')][_0xdd73('0x3a')]));_0x185901[_0xdd73('0x39')]=_0x185901[_0xdd73('0x39')][_0xdd73('0x3b')]?_0x185901[_0xdd73('0x39')]:_0x39a901[_0xdd73('0x33')];_0x185901['order']=qs[_0xdd73('0x3f')](_0x5d90df[_0xdd73('0x35')]['sort']);_0x185901['where']=qs[_0xdd73('0x37')](_[_0xdd73('0x41')](_0x5d90df[_0xdd73('0x35')],_0x39a901['filters']));if(_0x5d90df[_0xdd73('0x35')]['filter']){_0x185901[_0xdd73('0x40')]=_['merge'](_0x185901[_0xdd73('0x40')],{'$or':_['map'](_0x185901[_0xdd73('0x39')],function(_0x1ad7fb){var _0x2303ff={};_0x2303ff[_0x1ad7fb]={'$like':'%'+_0x5d90df[_0xdd73('0x35')][_0xdd73('0x42')]+'%'};return _0x2303ff;})});}_0x185901=_[_0xdd73('0x43')]({},_0x185901,_0x5d90df[_0xdd73('0x46')]);return _0xa5d0bc[_0xdd73('0x5d')](_0x185901);}})[_0xdd73('0x27')](function(_0x43b0cd){if(_0x43b0cd){_0x56be10=_0x43b0cd[_0xdd73('0x3b')];if(!_0x5d90df[_0xdd73('0x35')][_0xdd73('0x3c')]('nolimit')){_0x185901[_0xdd73('0x1d')]=qs[_0xdd73('0x1d')](_0x5d90df['query'][_0xdd73('0x1d')]);_0x185901[_0xdd73('0x1b')]=qs[_0xdd73('0x1b')](_0x5d90df[_0xdd73('0x35')][_0xdd73('0x1b')]);}return _0xa5d0bc['getAllConditions'](_0x185901);}})[_0xdd73('0x27')](function(_0x50665e){if(_0x50665e){return _0x50665e?{'count':_0x56be10,'rows':_0x50665e}:null;}})[_0xdd73('0x27')](respondWithResult(_0x320898,null))[_0xdd73('0x4b')](handleError(_0x320898,null));};exports['getAnyConditions']=function(_0x42cae2,_0x184628,_0x2d0212){var _0x35748b={};var _0x311fbc={};var _0x43cbd4;var _0x595d75;return db['Trigger'][_0xdd73('0x5e')]({'where':{'id':_0x42cae2[_0xdd73('0x57')]['id']}})[_0xdd73('0x27')](handleEntityNotFound(_0x184628,null))[_0xdd73('0x27')](function(_0x3c2eec){if(_0x3c2eec){_0x43cbd4=_0x3c2eec;_0x311fbc[_0xdd73('0x33')]=_[_0xdd73('0x36')](db[_0xdd73('0x5a')][_0xdd73('0x4d')]);_0x311fbc[_0xdd73('0x35')]=_[_0xdd73('0x36')](_0x42cae2[_0xdd73('0x35')]);_0x311fbc[_0xdd73('0x37')]=_[_0xdd73('0x38')](_0x311fbc[_0xdd73('0x33')],_0x311fbc[_0xdd73('0x35')]);_0x35748b[_0xdd73('0x39')]=_['intersection'](_0x311fbc['model'],qs[_0xdd73('0x3a')](_0x42cae2['query'][_0xdd73('0x3a')]));_0x35748b[_0xdd73('0x39')]=_0x35748b[_0xdd73('0x39')][_0xdd73('0x3b')]?_0x35748b[_0xdd73('0x39')]:_0x311fbc['model'];_0x35748b['order']=qs['sort'](_0x42cae2[_0xdd73('0x35')][_0xdd73('0x3f')]);_0x35748b[_0xdd73('0x40')]=qs[_0xdd73('0x37')](_[_0xdd73('0x41')](_0x42cae2['query'],_0x311fbc[_0xdd73('0x37')]));if(_0x42cae2[_0xdd73('0x35')][_0xdd73('0x42')]){_0x35748b[_0xdd73('0x40')]=_['merge'](_0x35748b[_0xdd73('0x40')],{'$or':_['map'](_0x35748b[_0xdd73('0x39')],function(_0x4bd9a7){var _0x1efdf6={};_0x1efdf6[_0x4bd9a7]={'$like':'%'+_0x42cae2[_0xdd73('0x35')]['filter']+'%'};return _0x1efdf6;})});}_0x35748b=_[_0xdd73('0x43')]({},_0x35748b,_0x42cae2[_0xdd73('0x46')]);return _0x43cbd4[_0xdd73('0x5f')](_0x35748b);}})[_0xdd73('0x27')](function(_0x4886fb){if(_0x4886fb){_0x595d75=_0x4886fb[_0xdd73('0x3b')];if(!_0x42cae2[_0xdd73('0x35')][_0xdd73('0x3c')](_0xdd73('0x3d'))){_0x35748b['limit']=qs[_0xdd73('0x1d')](_0x42cae2['query'][_0xdd73('0x1d')]);_0x35748b[_0xdd73('0x1b')]=qs[_0xdd73('0x1b')](_0x42cae2[_0xdd73('0x35')][_0xdd73('0x1b')]);}return _0x43cbd4[_0xdd73('0x5f')](_0x35748b);}})['then'](function(_0x4c71da){if(_0x4c71da){return _0x4c71da?{'count':_0x595d75,'rows':_0x4c71da}:null;}})[_0xdd73('0x27')](respondWithResult(_0x184628,null))[_0xdd73('0x4b')](handleError(_0x184628,null));};exports['addAction']=function(_0x2396aa,_0x1532f9,_0x5685b5){if(_0x2396aa[_0xdd73('0x50')]['id']){delete _0x2396aa[_0xdd73('0x50')]['id'];}return db[_0xdd73('0x30')]['find']({'where':{'id':_0x2396aa[_0xdd73('0x57')]['id']}})[_0xdd73('0x27')](handleEntityNotFound(_0x1532f9,null))[_0xdd73('0x27')](function(_0x3284da){if(_0x3284da){_0x2396aa[_0xdd73('0x50')]['TriggerId']=_0x3284da['id'];return db[_0xdd73('0x60')][_0xdd73('0x4f')](_0x2396aa['body']);}})[_0xdd73('0x27')](respondWithResult(_0x1532f9,null))[_0xdd73('0x4b')](handleError(_0x1532f9,null));};exports[_0xdd73('0x61')]=function(_0x59d0c5,_0x307e2e,_0x26e226){var _0x8f5c6b={};var _0x53d556={};var _0x333414;var _0x120732;return db['Trigger'][_0xdd73('0x5e')]({'where':{'id':_0x59d0c5[_0xdd73('0x57')]['id']}})[_0xdd73('0x27')](handleEntityNotFound(_0x307e2e,null))[_0xdd73('0x27')](function(_0x1270f6){if(_0x1270f6){_0x333414=_0x1270f6;_0x53d556['model']=_[_0xdd73('0x36')](db['Action'][_0xdd73('0x4d')]);_0x53d556['query']=_[_0xdd73('0x36')](_0x59d0c5[_0xdd73('0x35')]);_0x53d556['filters']=_[_0xdd73('0x38')](_0x53d556[_0xdd73('0x33')],_0x53d556[_0xdd73('0x35')]);_0x8f5c6b['attributes']=_['intersection'](_0x53d556['model'],qs[_0xdd73('0x3a')](_0x59d0c5[_0xdd73('0x35')][_0xdd73('0x3a')]));_0x8f5c6b[_0xdd73('0x39')]=_0x8f5c6b[_0xdd73('0x39')][_0xdd73('0x3b')]?_0x8f5c6b[_0xdd73('0x39')]:_0x53d556[_0xdd73('0x33')];_0x8f5c6b['order']=qs['sort'](_0x59d0c5['query'][_0xdd73('0x3f')]);_0x8f5c6b[_0xdd73('0x40')]=qs[_0xdd73('0x37')](_[_0xdd73('0x41')](_0x59d0c5[_0xdd73('0x35')],_0x53d556['filters']));if(_0x59d0c5[_0xdd73('0x35')][_0xdd73('0x42')]){_0x8f5c6b[_0xdd73('0x40')]=_[_0xdd73('0x43')](_0x8f5c6b[_0xdd73('0x40')],{'$or':_[_0xdd73('0x34')](_0x8f5c6b[_0xdd73('0x39')],function(_0xd7ae5f){var _0x51e0ad={};_0x51e0ad[_0xd7ae5f]={'$like':'%'+_0x59d0c5[_0xdd73('0x35')][_0xdd73('0x42')]+'%'};return _0x51e0ad;})});}_0x8f5c6b=_[_0xdd73('0x43')]({},_0x8f5c6b,_0x59d0c5['options']);return _0x333414[_0xdd73('0x61')](_0x8f5c6b);}})[_0xdd73('0x27')](function(_0x102be0){if(_0x102be0){_0x120732=_0x102be0[_0xdd73('0x3b')];if(!_0x59d0c5[_0xdd73('0x35')]['hasOwnProperty']('nolimit')){_0x8f5c6b[_0xdd73('0x1d')]=qs[_0xdd73('0x1d')](_0x59d0c5[_0xdd73('0x35')][_0xdd73('0x1d')]);_0x8f5c6b[_0xdd73('0x1b')]=qs[_0xdd73('0x1b')](_0x59d0c5[_0xdd73('0x35')]['offset']);}return _0x333414[_0xdd73('0x61')](_0x8f5c6b);}})[_0xdd73('0x27')](function(_0x351abb){if(_0x351abb){return _0x351abb?{'count':_0x120732,'rows':_0x351abb}:null;}})[_0xdd73('0x27')](respondWithResult(_0x307e2e,null))[_0xdd73('0x4b')](handleError(_0x307e2e,null));}; \ No newline at end of file diff --git a/server/api/trigger/trigger.model.js b/server/api/trigger/trigger.model.js index eba0a5c..c0db48f 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 _0x84ab=['request-promise','path','../../config/environment','./trigger.attributes','exports','Trigger','lodash','util','../../config/logger','api','moment'];(function(_0x3c5782,_0x21cb5a){var _0xd3256c=function(_0x4e4a11){while(--_0x4e4a11){_0x3c5782['push'](_0x3c5782['shift']());}};_0xd3256c(++_0x21cb5a);}(_0x84ab,0x12f));var _0xb84a=function(_0x26bf51,_0x5e261a){_0x26bf51=_0x26bf51-0x0;var _0x503415=_0x84ab[_0x26bf51];return _0x503415;};'use strict';var _=require(_0xb84a('0x0'));var util=require(_0xb84a('0x1'));var logger=require(_0xb84a('0x2'))(_0xb84a('0x3'));var moment=require(_0xb84a('0x4'));var BPromise=require('bluebird');var rp=require(_0xb84a('0x5'));var fs=require('fs');var path=require(_0xb84a('0x6'));var rimraf=require('rimraf');var config=require(_0xb84a('0x7'));var attributes=require(_0xb84a('0x8'));module[_0xb84a('0x9')]=function(_0x5b9def,_0x521a64){return _0x5b9def['define'](_0xb84a('0xa'),attributes,{'tableName':'tools_triggers','paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x4f99=['define','tools_triggers','lodash','util','api','moment','bluebird','path','rimraf','./trigger.attributes','exports'];(function(_0x3f94f9,_0x42774b){var _0x46f84f=function(_0xa080d8){while(--_0xa080d8){_0x3f94f9['push'](_0x3f94f9['shift']());}};_0x46f84f(++_0x42774b);}(_0x4f99,0x157));var _0x94f9=function(_0x57cf7c,_0x69b2d8){_0x57cf7c=_0x57cf7c-0x0;var _0x59916c=_0x4f99[_0x57cf7c];return _0x59916c;};'use strict';var _=require(_0x94f9('0x0'));var util=require(_0x94f9('0x1'));var logger=require('../../config/logger')(_0x94f9('0x2'));var moment=require(_0x94f9('0x3'));var BPromise=require(_0x94f9('0x4'));var rp=require('request-promise');var fs=require('fs');var path=require(_0x94f9('0x5'));var rimraf=require(_0x94f9('0x6'));var config=require('../../config/environment');var attributes=require(_0x94f9('0x7'));module[_0x94f9('0x8')]=function(_0x36d91c,_0x253a79){return _0x36d91c[_0x94f9('0x9')]('Trigger',attributes,{'tableName':_0x94f9('0xa'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/trigger/trigger.rpc.js b/server/api/trigger/trigger.rpc.js index 423124c..11a034f 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 _0xbfd3=['error','code','message','catch','Trigger','findAll','options','where','limit','include','map','model','attributes','info','GetTrigger','ShowTrigger','find','raw','lodash','util','moment','bluebird','randomstring','../../mysqldb','rpc','client','http','request','then','Trigger,\x20%s,\x20%s','request\x20sent','debug','Trigger,\x20%s,\x20%s,\x20%s','stringify'];(function(_0x49d546,_0x62cdd6){var _0x8b36eb=function(_0x6301f8){while(--_0x6301f8){_0x49d546['push'](_0x49d546['shift']());}};_0x8b36eb(++_0x62cdd6);}(_0xbfd3,0x144));var _0x3bfd=function(_0x259b9f,_0x22dda9){_0x259b9f=_0x259b9f-0x0;var _0x280d13=_0xbfd3[_0x259b9f];return _0x280d13;};'use strict';var _=require(_0x3bfd('0x0'));var util=require(_0x3bfd('0x1'));var moment=require(_0x3bfd('0x2'));var BPromise=require(_0x3bfd('0x3'));var rs=require(_0x3bfd('0x4'));var fs=require('fs');var Redis=require('ioredis');var db=require(_0x3bfd('0x5'))['db'];var utils=require('../../config/utils');var logger=require('../../config/logger')(_0x3bfd('0x6'));var config=require('../../config/environment');var jayson=require('jayson/promise');var client=jayson[_0x3bfd('0x7')][_0x3bfd('0x8')]({'port':0x232a});function respondWithRpcPromise(_0x228209,_0xb0af00,_0x3ce884){return new BPromise(function(_0x5dbe9d,_0x47d4d2){return client[_0x3bfd('0x9')](_0x228209,_0x3ce884)[_0x3bfd('0xa')](function(_0x348066){logger['info'](_0x3bfd('0xb'),_0xb0af00,_0x3bfd('0xc'));logger[_0x3bfd('0xd')](_0x3bfd('0xe'),_0xb0af00,_0x3bfd('0xc'),JSON[_0x3bfd('0xf')](_0x348066));if(_0x348066[_0x3bfd('0x10')]){if(_0x348066[_0x3bfd('0x10')][_0x3bfd('0x11')]===0x1f4){logger[_0x3bfd('0x10')](_0x3bfd('0xb'),_0xb0af00,_0x348066[_0x3bfd('0x10')]['message']);return _0x47d4d2(_0x348066[_0x3bfd('0x10')][_0x3bfd('0x12')]);}logger['error'](_0x3bfd('0xb'),_0xb0af00,_0x348066[_0x3bfd('0x10')][_0x3bfd('0x12')]);return _0x5dbe9d(_0x348066[_0x3bfd('0x10')][_0x3bfd('0x12')]);}else{logger['info'](_0x3bfd('0xb'),_0xb0af00,_0x3bfd('0xc'));_0x5dbe9d(_0x348066['result'][_0x3bfd('0x12')]);}})[_0x3bfd('0x13')](function(_0x4bb462){logger[_0x3bfd('0x10')](_0x3bfd('0xb'),_0xb0af00,_0x4bb462);_0x47d4d2(_0x4bb462);});});}exports['GetTrigger']=function(_0xfe31ed){var _0x488827=this;return new Promise(function(_0x2e6ace,_0x3f45a8){return db[_0x3bfd('0x14')][_0x3bfd('0x15')]({'raw':_0xfe31ed[_0x3bfd('0x16')]?_0xfe31ed[_0x3bfd('0x16')]['raw']===undefined?!![]:![]:!![],'where':_0xfe31ed[_0x3bfd('0x16')]?_0xfe31ed[_0x3bfd('0x16')][_0x3bfd('0x17')]||null:null,'attributes':_0xfe31ed['options']?_0xfe31ed['options']['attributes']||null:null,'limit':_0xfe31ed[_0x3bfd('0x16')]?_0xfe31ed[_0x3bfd('0x16')][_0x3bfd('0x18')]||null:null,'include':_0xfe31ed['options']?_0xfe31ed[_0x3bfd('0x16')][_0x3bfd('0x19')]?_[_0x3bfd('0x1a')](_0xfe31ed['options'][_0x3bfd('0x19')],function(_0xb8e84f){return{'model':db[_0xb8e84f[_0x3bfd('0x1b')]],'as':_0xb8e84f['as'],'attributes':_0xb8e84f[_0x3bfd('0x1c')],'include':_0xb8e84f[_0x3bfd('0x19')]?_[_0x3bfd('0x1a')](_0xb8e84f[_0x3bfd('0x19')],function(_0x5335e7){return{'model':db[_0x5335e7[_0x3bfd('0x1b')]],'as':_0x5335e7['as'],'attributes':_0x5335e7[_0x3bfd('0x1c')],'include':_0x5335e7[_0x3bfd('0x19')]?_['map'](_0x5335e7[_0x3bfd('0x19')],function(_0x3c4578){return{'model':db[_0x3c4578[_0x3bfd('0x1b')]],'as':_0x3c4578['as'],'attributes':_0x3c4578['attributes']};}):[]};}):[]};}):[]:[]})[_0x3bfd('0xa')](function(_0x2f613f){logger[_0x3bfd('0x1d')]('GetTrigger',_0xfe31ed);logger[_0x3bfd('0xd')](_0x3bfd('0x1e'),_0xfe31ed,JSON[_0x3bfd('0xf')](_0x2f613f));_0x2e6ace(_0x2f613f);})[_0x3bfd('0x13')](function(_0x316544){logger[_0x3bfd('0x10')](_0x3bfd('0x1e'),_0x316544[_0x3bfd('0x12')],_0xfe31ed);_0x3f45a8(_0x488827[_0x3bfd('0x10')](0x1f4,_0x316544[_0x3bfd('0x12')]));});});};exports[_0x3bfd('0x1f')]=function(_0x54b82c){var _0x5e55d1=this;return new Promise(function(_0x3a20e5,_0x879dc2){return db[_0x3bfd('0x14')][_0x3bfd('0x20')]({'raw':_0x54b82c[_0x3bfd('0x16')]?_0x54b82c[_0x3bfd('0x16')][_0x3bfd('0x21')]===undefined?!![]:![]:!![],'where':_0x54b82c[_0x3bfd('0x16')]?_0x54b82c[_0x3bfd('0x16')][_0x3bfd('0x17')]||null:null,'attributes':_0x54b82c['options']?_0x54b82c[_0x3bfd('0x16')]['attributes']||null:null,'include':_0x54b82c['options']?_0x54b82c[_0x3bfd('0x16')][_0x3bfd('0x19')]?_[_0x3bfd('0x1a')](_0x54b82c[_0x3bfd('0x16')][_0x3bfd('0x19')],function(_0x477a18){return{'model':db[_0x477a18[_0x3bfd('0x1b')]],'as':_0x477a18['as'],'attributes':_0x477a18[_0x3bfd('0x1c')],'include':_0x477a18[_0x3bfd('0x19')]?_['map'](_0x477a18[_0x3bfd('0x19')],function(_0x5703e0){return{'model':db[_0x5703e0[_0x3bfd('0x1b')]],'as':_0x5703e0['as'],'attributes':_0x5703e0[_0x3bfd('0x1c')],'include':_0x5703e0[_0x3bfd('0x19')]?_[_0x3bfd('0x1a')](_0x5703e0[_0x3bfd('0x19')],function(_0x2faecd){return{'model':db[_0x2faecd['model']],'as':_0x2faecd['as'],'attributes':_0x2faecd[_0x3bfd('0x1c')]};}):[]};}):[]};}):[]:[]})[_0x3bfd('0xa')](function(_0x52968f){logger[_0x3bfd('0x1d')](_0x3bfd('0x1f'),_0x54b82c);logger[_0x3bfd('0xd')](_0x3bfd('0x1f'),_0x54b82c,JSON[_0x3bfd('0xf')](_0x52968f));_0x3a20e5(_0x52968f);})[_0x3bfd('0x13')](function(_0x3ea090){logger[_0x3bfd('0x10')](_0x3bfd('0x1f'),_0x3ea090[_0x3bfd('0x12')],_0x54b82c);_0x879dc2(_0x5e55d1[_0x3bfd('0x10')](0x1f4,_0x3ea090[_0x3bfd('0x12')]));});});}; \ No newline at end of file +var _0xe6d5=['error','code','message','Trigger','options','attributes','limit','include','map','model','then','GetTrigger','catch','ShowTrigger','find','lodash','util','moment','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','jayson/promise','info','Trigger,\x20%s,\x20%s','request\x20sent','debug','stringify'];(function(_0x4314c9,_0x1a6d36){var _0x1f8798=function(_0x27858f){while(--_0x27858f){_0x4314c9['push'](_0x4314c9['shift']());}};_0x1f8798(++_0x1a6d36);}(_0xe6d5,0x1c2));var _0x5e6d=function(_0x2341c6,_0x3af092){_0x2341c6=_0x2341c6-0x0;var _0x54c34d=_0xe6d5[_0x2341c6];return _0x54c34d;};'use strict';var _=require(_0x5e6d('0x0'));var util=require(_0x5e6d('0x1'));var moment=require(_0x5e6d('0x2'));var BPromise=require('bluebird');var rs=require('randomstring');var fs=require('fs');var Redis=require(_0x5e6d('0x3'));var db=require(_0x5e6d('0x4'))['db'];var utils=require(_0x5e6d('0x5'));var logger=require(_0x5e6d('0x6'))(_0x5e6d('0x7'));var config=require('../../config/environment');var jayson=require(_0x5e6d('0x8'));var client=jayson['client']['http']({'port':0x232a});function respondWithRpcPromise(_0xfc419d,_0x31f92f,_0x5f297f){return new BPromise(function(_0x583d7c,_0x983f5e){return client['request'](_0xfc419d,_0x5f297f)['then'](function(_0x586284){logger[_0x5e6d('0x9')](_0x5e6d('0xa'),_0x31f92f,_0x5e6d('0xb'));logger[_0x5e6d('0xc')]('Trigger,\x20%s,\x20%s,\x20%s',_0x31f92f,_0x5e6d('0xb'),JSON[_0x5e6d('0xd')](_0x586284));if(_0x586284[_0x5e6d('0xe')]){if(_0x586284['error'][_0x5e6d('0xf')]===0x1f4){logger[_0x5e6d('0xe')]('Trigger,\x20%s,\x20%s',_0x31f92f,_0x586284[_0x5e6d('0xe')][_0x5e6d('0x10')]);return _0x983f5e(_0x586284['error'][_0x5e6d('0x10')]);}logger['error']('Trigger,\x20%s,\x20%s',_0x31f92f,_0x586284[_0x5e6d('0xe')][_0x5e6d('0x10')]);return _0x583d7c(_0x586284[_0x5e6d('0xe')]['message']);}else{logger[_0x5e6d('0x9')](_0x5e6d('0xa'),_0x31f92f,_0x5e6d('0xb'));_0x583d7c(_0x586284['result'][_0x5e6d('0x10')]);}})['catch'](function(_0xe65613){logger[_0x5e6d('0xe')](_0x5e6d('0xa'),_0x31f92f,_0xe65613);_0x983f5e(_0xe65613);});});}exports['GetTrigger']=function(_0x39d359){var _0x4c5291=this;return new Promise(function(_0x36ec00,_0x147b77){return db[_0x5e6d('0x11')]['findAll']({'raw':_0x39d359[_0x5e6d('0x12')]?_0x39d359['options']['raw']===undefined?!![]:![]:!![],'where':_0x39d359['options']?_0x39d359['options']['where']||null:null,'attributes':_0x39d359['options']?_0x39d359[_0x5e6d('0x12')][_0x5e6d('0x13')]||null:null,'limit':_0x39d359[_0x5e6d('0x12')]?_0x39d359[_0x5e6d('0x12')][_0x5e6d('0x14')]||null:null,'include':_0x39d359[_0x5e6d('0x12')]?_0x39d359['options'][_0x5e6d('0x15')]?_[_0x5e6d('0x16')](_0x39d359[_0x5e6d('0x12')]['include'],function(_0x4fbcba){return{'model':db[_0x4fbcba['model']],'as':_0x4fbcba['as'],'attributes':_0x4fbcba['attributes'],'include':_0x4fbcba['include']?_['map'](_0x4fbcba[_0x5e6d('0x15')],function(_0x26fb70){return{'model':db[_0x26fb70[_0x5e6d('0x17')]],'as':_0x26fb70['as'],'attributes':_0x26fb70['attributes'],'include':_0x26fb70[_0x5e6d('0x15')]?_[_0x5e6d('0x16')](_0x26fb70[_0x5e6d('0x15')],function(_0x7dce6d){return{'model':db[_0x7dce6d['model']],'as':_0x7dce6d['as'],'attributes':_0x7dce6d['attributes']};}):[]};}):[]};}):[]:[]})[_0x5e6d('0x18')](function(_0x56cc1b){logger[_0x5e6d('0x9')](_0x5e6d('0x19'),_0x39d359);logger[_0x5e6d('0xc')](_0x5e6d('0x19'),_0x39d359,JSON[_0x5e6d('0xd')](_0x56cc1b));_0x36ec00(_0x56cc1b);})[_0x5e6d('0x1a')](function(_0x15391c){logger[_0x5e6d('0xe')](_0x5e6d('0x19'),_0x15391c[_0x5e6d('0x10')],_0x39d359);_0x147b77(_0x4c5291[_0x5e6d('0xe')](0x1f4,_0x15391c[_0x5e6d('0x10')]));});});};exports[_0x5e6d('0x1b')]=function(_0x1e36af){var _0x5ed067=this;return new Promise(function(_0x5b28a4,_0xd7087d){return db[_0x5e6d('0x11')][_0x5e6d('0x1c')]({'raw':_0x1e36af[_0x5e6d('0x12')]?_0x1e36af[_0x5e6d('0x12')]['raw']===undefined?!![]:![]:!![],'where':_0x1e36af['options']?_0x1e36af['options']['where']||null:null,'attributes':_0x1e36af[_0x5e6d('0x12')]?_0x1e36af['options'][_0x5e6d('0x13')]||null:null,'include':_0x1e36af[_0x5e6d('0x12')]?_0x1e36af[_0x5e6d('0x12')]['include']?_['map'](_0x1e36af['options'][_0x5e6d('0x15')],function(_0x24965d){return{'model':db[_0x24965d[_0x5e6d('0x17')]],'as':_0x24965d['as'],'attributes':_0x24965d[_0x5e6d('0x13')],'include':_0x24965d[_0x5e6d('0x15')]?_['map'](_0x24965d[_0x5e6d('0x15')],function(_0x413c92){return{'model':db[_0x413c92['model']],'as':_0x413c92['as'],'attributes':_0x413c92[_0x5e6d('0x13')],'include':_0x413c92[_0x5e6d('0x15')]?_[_0x5e6d('0x16')](_0x413c92[_0x5e6d('0x15')],function(_0x59177d){return{'model':db[_0x59177d[_0x5e6d('0x17')]],'as':_0x59177d['as'],'attributes':_0x59177d[_0x5e6d('0x13')]};}):[]};}):[]};}):[]:[]})[_0x5e6d('0x18')](function(_0x200718){logger['info'](_0x5e6d('0x1b'),_0x1e36af);logger[_0x5e6d('0xc')](_0x5e6d('0x1b'),_0x1e36af,JSON[_0x5e6d('0xd')](_0x200718));_0x5b28a4(_0x200718);})[_0x5e6d('0x1a')](function(_0x501489){logger[_0x5e6d('0xe')]('ShowTrigger',_0x501489[_0x5e6d('0x10')],_0x1e36af);_0xd7087d(_0x5ed067[_0x5e6d('0xe')](0x1f4,_0x501489['message']));});});}; \ No newline at end of file diff --git a/server/api/trunk/index.js b/server/api/trunk/index.js index f29fb3c..d9329da 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 _0x7f91=['delete','exports','multer','util','connect-timeout','express','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','get','index','/:id','isAuthenticated','show','post','/:id/clone','put','update'];(function(_0x53cfff,_0x341a9f){var _0x4a5d72=function(_0x271ee2){while(--_0x271ee2){_0x53cfff['push'](_0x53cfff['shift']());}};_0x4a5d72(++_0x341a9f);}(_0x7f91,0x1ca));var _0x17f9=function(_0x553c2a,_0x592c23){_0x553c2a=_0x553c2a-0x0;var _0x37988b=_0x7f91[_0x553c2a];return _0x37988b;};'use strict';var multer=require(_0x17f9('0x0'));var util=require(_0x17f9('0x1'));var path=require('path');var timeout=require(_0x17f9('0x2'));var express=require(_0x17f9('0x3'));var router=express['Router']();var fs_extra=require(_0x17f9('0x4'));var auth=require(_0x17f9('0x5'));var interaction=require(_0x17f9('0x6'));var config=require(_0x17f9('0x7'));var controller=require('./trunk.controller');router[_0x17f9('0x8')]('/',auth['isAuthenticated'](),controller[_0x17f9('0x9')]);router[_0x17f9('0x8')](_0x17f9('0xa'),auth[_0x17f9('0xb')](),controller[_0x17f9('0xc')]);router[_0x17f9('0xd')](_0x17f9('0xe'),auth[_0x17f9('0xb')](),controller['clone']);router[_0x17f9('0xd')]('/',auth[_0x17f9('0xb')](),controller['create']);router[_0x17f9('0xf')](_0x17f9('0xa'),auth[_0x17f9('0xb')](),controller[_0x17f9('0x10')]);router[_0x17f9('0x11')](_0x17f9('0xa'),auth[_0x17f9('0xb')](),controller['destroy']);module[_0x17f9('0x12')]=router; \ No newline at end of file +var _0x3321=['/:id/clone','put','update','delete','destroy','exports','connect-timeout','express','Router','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','./trunk.controller','get','index','/:id','isAuthenticated','show','post'];(function(_0x20a694,_0x32aa0b){var _0x338af3=function(_0x38b573){while(--_0x38b573){_0x20a694['push'](_0x20a694['shift']());}};_0x338af3(++_0x32aa0b);}(_0x3321,0x15a));var _0x1332=function(_0x1d4313,_0x3929ab){_0x1d4313=_0x1d4313-0x0;var _0x234ad8=_0x3321[_0x1d4313];return _0x234ad8;};'use strict';var multer=require('multer');var util=require('util');var path=require('path');var timeout=require(_0x1332('0x0'));var express=require(_0x1332('0x1'));var router=express[_0x1332('0x2')]();var fs_extra=require(_0x1332('0x3'));var auth=require(_0x1332('0x4'));var interaction=require(_0x1332('0x5'));var config=require(_0x1332('0x6'));var controller=require(_0x1332('0x7'));router[_0x1332('0x8')]('/',auth['isAuthenticated'](),controller[_0x1332('0x9')]);router['get'](_0x1332('0xa'),auth[_0x1332('0xb')](),controller[_0x1332('0xc')]);router[_0x1332('0xd')](_0x1332('0xe'),auth[_0x1332('0xb')](),controller['clone']);router[_0x1332('0xd')]('/',auth[_0x1332('0xb')](),controller['create']);router[_0x1332('0xf')](_0x1332('0xa'),auth[_0x1332('0xb')](),controller[_0x1332('0x10')]);router[_0x1332('0x11')](_0x1332('0xa'),auth[_0x1332('0xb')](),controller[_0x1332('0x12')]);module[_0x1332('0x13')]=router; \ No newline at end of file diff --git a/server/api/trunk/trunk.attributes.js b/server/api/trunk/trunk.attributes.js index dfebb72..9fcea51 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 _0x8784=['always','accept','refuse','originate','uac','uas','pai','fingerprint','certificate','active','actpass','dynamic','nonat','update,nonat','BOOLEAN','sequelize','exports','STRING','ENUM','friend','peer','from-voip-provider','ALLOWED_NOT_SCREENED','ALLOWED_FAILED_SCREEN','ALLOWED','PROHIB_NOT_SCREENED','PROHIB_FAILED_SCREEN','PROHIB','udp','join','getDataValue','transport','split','String\x20is\x20deprecated.\x20Please\x20use\x20an\x20Array\x20as\x20[\x22udp\x22,\x20\x22tcp\x22]','rfc2833','info','shortinfo','inband','yes','update','outgoing','force_rport,comedia','setDataValue','nat','String\x20is\x20deprecated.\x20Please\x20use\x20an\x20Array\x20as\x20[\x22force_rport\x22,\x20\x22comedia\x22]','allow','String\x20is\x20deprecated.\x20Please\x20use\x20an\x20Array\x20as\x20[\x22ulaw\x22,\x20\x22alaw\x22,\x20\x22alaw\x22]','insecure','String\x20is\x20deprecated.\x20Please\x20use\x20an\x20Array\x20as\x20[\x22port\x22,\x20\x22invite\x22]','never','INTEGER','\x22\x22\x20<>'];(function(_0x37851a,_0x27148a){var _0xfb024a=function(_0x15e6e9){while(--_0x15e6e9){_0x37851a['push'](_0x37851a['shift']());}};_0xfb024a(++_0x27148a);}(_0x8784,0xdf));var _0x4878=function(_0x31b31b,_0x5f044e){_0x31b31b=_0x31b31b-0x0;var _0x2c8fc2=_0x8784[_0x31b31b];return _0x2c8fc2;};'use strict';var Sequelize=require(_0x4878('0x0'));module[_0x4878('0x1')]={'name':{'type':Sequelize[_0x4878('0x2')],'allowNull':![],'unique':'name','validate':{'notEmpty':!![],'is':/^[A-Za-z0-9\.\_]+$/i}},'type':{'type':Sequelize[_0x4878('0x3')](_0x4878('0x4'),'user',_0x4878('0x5')),'allowNull':![],'defaultValue':_0x4878('0x4')},'context':{'type':Sequelize[_0x4878('0x2')],'allowNull':![],'defaultValue':_0x4878('0x6')},'callingpres':{'type':Sequelize[_0x4878('0x3')](_0x4878('0x7'),'ALLOWED_PASSED_SCREEN',_0x4878('0x8'),_0x4878('0x9'),_0x4878('0xa'),'PROHIB_PASSED_SCREEN',_0x4878('0xb'),_0x4878('0xc'))},'deny':{'type':Sequelize[_0x4878('0x2')]},'permit':{'type':Sequelize['STRING']},'secret':{'type':Sequelize[_0x4878('0x2')]},'md5secret':{'type':Sequelize[_0x4878('0x2')]},'remotesecret':{'type':Sequelize[_0x4878('0x2')]},'transport':{'type':Sequelize['STRING'],'defaultValue':_0x4878('0xd'),'set':function(_0x4a627f){this['setDataValue']('transport',_0x4a627f?_0x4a627f[_0x4878('0xe')](','):null);},'get':function(){return this[_0x4878('0xf')](_0x4878('0x10'))?this['getDataValue'](_0x4878('0x10'))[_0x4878('0x11')](','):null;},'comment':_0x4878('0x12')},'dtmfmode':{'type':Sequelize[_0x4878('0x3')](_0x4878('0x13'),_0x4878('0x14'),_0x4878('0x15'),_0x4878('0x16'),'auto'),'defaultValue':'rfc2833'},'directmedia':{'type':Sequelize['ENUM'](_0x4878('0x17'),'no','nonat',_0x4878('0x18'),_0x4878('0x19')),'defaultValue':'no'},'directrtpsetup':{'type':Sequelize[_0x4878('0x3')](_0x4878('0x17'),'no'),'defaultValue':'no'},'directmediapermit':{'type':Sequelize[_0x4878('0x2')]},'directmediadeny':{'type':Sequelize[_0x4878('0x2')]},'nat':{'type':Sequelize[_0x4878('0x2')],'defaultValue':_0x4878('0x1a'),'set':function(_0x394405){this[_0x4878('0x1b')]('nat',_0x394405?_0x394405[_0x4878('0xe')](','):null);},'get':function(){return this['getDataValue'](_0x4878('0x1c'))?this[_0x4878('0xf')]('nat')[_0x4878('0x11')](','):null;},'comment':_0x4878('0x1d')},'callgroup':{'type':Sequelize[_0x4878('0x2')]},'namedcallgroup':{'type':Sequelize[_0x4878('0x2')]},'pickupgroup':{'type':Sequelize[_0x4878('0x2')]},'namedpickupgroup':{'type':Sequelize[_0x4878('0x2')]},'language':{'type':Sequelize['STRING'],'defaultValue':'en'},'tonezone':{'type':Sequelize[_0x4878('0x2')],'allowNull':!![]},'disallow':{'type':Sequelize[_0x4878('0x2')],'defaultValue':'all'},'allow':{'type':Sequelize['STRING'],'allowNull':![],'defaultValue':'ulaw;alaw;gsm','set':function(_0x3145e7){this[_0x4878('0x1b')](_0x4878('0x1e'),_0x3145e7?_0x3145e7['join'](';'):'ulaw;alaw;gsm');},'get':function(){return this[_0x4878('0xf')](_0x4878('0x1e'))?this['getDataValue']('allow')[_0x4878('0x11')](';'):null;},'comment':_0x4878('0x1f')},'autoframing':{'type':Sequelize[_0x4878('0x3')](_0x4878('0x17'),'no')},'insecure':{'type':Sequelize[_0x4878('0x2')],'defaultValue':'port,invite','set':function(_0x73cbee){this[_0x4878('0x1b')](_0x4878('0x20'),_0x73cbee?_0x73cbee[_0x4878('0xe')](','):null);},'get':function(){return this[_0x4878('0xf')](_0x4878('0x20'))?this[_0x4878('0xf')]('insecure')['split'](','):null;},'comment':_0x4878('0x21')},'trustrpid':{'type':Sequelize[_0x4878('0x3')](_0x4878('0x17'),'no'),'defaultValue':'no'},'trust_id_outbound':{'type':Sequelize[_0x4878('0x3')](_0x4878('0x17'),'no'),'defaultValue':'no'},'progressinband':{'type':Sequelize['ENUM'](_0x4878('0x17'),'no',_0x4878('0x22'))},'promiscredir':{'type':Sequelize[_0x4878('0x3')](_0x4878('0x17'),'no')},'useclientcode':{'type':Sequelize[_0x4878('0x3')](_0x4878('0x17'),'no')},'accountcode':{'type':Sequelize[_0x4878('0x23')](0xb)},'setvar':{'type':Sequelize[_0x4878('0x2')]},'callerid':{'type':Sequelize[_0x4878('0x2')],'defaultValue':_0x4878('0x24')},'amaflags':{'type':Sequelize['STRING']},'callcounter':{'type':Sequelize[_0x4878('0x3')](_0x4878('0x17'),'no'),'defaultValue':_0x4878('0x17')},'busylevel':{'type':Sequelize[_0x4878('0x23')](0xb)},'allowoverlap':{'type':Sequelize[_0x4878('0x3')](_0x4878('0x17'),'no')},'allowsubscribe':{'type':Sequelize[_0x4878('0x3')]('yes','no')},'allowtransfer':{'type':Sequelize[_0x4878('0x3')](_0x4878('0x17'),'no')},'ignoresdpversion':{'type':Sequelize[_0x4878('0x3')](_0x4878('0x17'),'no')},'subscribecontext':{'type':Sequelize[_0x4878('0x2')]},'template':{'type':Sequelize[_0x4878('0x2')]},'videosupport':{'type':Sequelize[_0x4878('0x3')](_0x4878('0x17'),'no',_0x4878('0x25')),'defaultValue':'no'},'maxcallbitrate':{'type':Sequelize[_0x4878('0x23')](0xb)},'rfc2833compensate':{'type':Sequelize[_0x4878('0x3')]('yes','no')},'mailbox':{'type':Sequelize[_0x4878('0x2')]},'session_timers':{'type':Sequelize[_0x4878('0x3')](_0x4878('0x26'),_0x4878('0x27'),_0x4878('0x28'))},'session_expires':{'type':Sequelize[_0x4878('0x23')](0xb)},'session_minse':{'type':Sequelize[_0x4878('0x23')](0xb)},'session_refresher':{'type':Sequelize[_0x4878('0x3')](_0x4878('0x29'),'uas'),'defaultValue':_0x4878('0x2a')},'t38pt_usertpsource':{'type':Sequelize[_0x4878('0x2')]},'regexten':{'type':Sequelize['STRING']},'fromdomain':{'type':Sequelize[_0x4878('0x2')]},'fromuser':{'type':Sequelize[_0x4878('0x2')]},'port':{'type':Sequelize[_0x4878('0x23')](0x5)},'qualify':{'type':Sequelize[_0x4878('0x3')](_0x4878('0x17'),'no'),'defaultValue':_0x4878('0x17')},'keepalive':{'type':Sequelize[_0x4878('0x23')](0xb)},'defaultip':{'type':Sequelize[_0x4878('0x2')]},'defaultuser':{'type':Sequelize[_0x4878('0x2')]},'rtptimeout':{'type':Sequelize['INTEGER'](0xb)},'rtpholdtimeout':{'type':Sequelize[_0x4878('0x23')](0xb)},'rtpkeepalive':{'type':Sequelize[_0x4878('0x23')](0xb)},'sendrpid':{'type':Sequelize[_0x4878('0x3')](_0x4878('0x17'),'no',_0x4878('0x2b')),'defaultValue':'no'},'outboundproxy':{'type':Sequelize[_0x4878('0x2')]},'callbackextension':{'type':Sequelize[_0x4878('0x2')]},'timert1':{'type':Sequelize[_0x4878('0x23')](0xb)},'timerb':{'type':Sequelize[_0x4878('0x23')](0xb)},'qualifyfreq':{'type':Sequelize[_0x4878('0x23')](0xb)},'contactpermit':{'type':Sequelize[_0x4878('0x2')]},'contactdeny':{'type':Sequelize['STRING']},'contactacl':{'type':Sequelize[_0x4878('0x2')]},'unsolicited_mailbox':{'type':Sequelize[_0x4878('0x2')]},'use_q850_reason':{'type':Sequelize[_0x4878('0x2')]},'maxforwards':{'type':Sequelize[_0x4878('0x23')](0xb)},'encryption':{'type':Sequelize['ENUM'](_0x4878('0x17'),'no'),'defaultValue':'no'},'avpf':{'type':Sequelize[_0x4878('0x3')](_0x4878('0x17'),'no')},'force_avp':{'type':Sequelize[_0x4878('0x3')]('yes','no')},'icesupport':{'type':Sequelize[_0x4878('0x3')]('yes','no')},'dtlsenable':{'type':Sequelize[_0x4878('0x3')]('yes','no')},'dtlsverify':{'type':Sequelize[_0x4878('0x3')]('yes','no',_0x4878('0x2c'),_0x4878('0x2d'))},'dtlsrekey':{'type':Sequelize[_0x4878('0x23')](0xb)},'dtlscertfile':{'type':Sequelize['STRING']},'dtlsprivatekey':{'type':Sequelize[_0x4878('0x2')]},'dtlscipher':{'type':Sequelize[_0x4878('0x2')]},'dtlscafile':{'type':Sequelize['STRING']},'dtlscapath':{'type':Sequelize['STRING']},'dtlssetup':{'type':Sequelize[_0x4878('0x3')](_0x4878('0x2e'),'passive',_0x4878('0x2f')),'allowNull':!![]},'dtlsfingerprint':{'type':Sequelize[_0x4878('0x2')]},'usereqphone':{'type':Sequelize['ENUM'](_0x4878('0x17'),'no'),'defaultValue':'no'},'recordonfeature':{'type':Sequelize[_0x4878('0x2')]},'recordofffeature':{'type':Sequelize[_0x4878('0x2')]},'call_limit':{'type':Sequelize['INTEGER'](0xb),'defaultValue':0x3e8},'registertrying':{'type':Sequelize[_0x4878('0x3')]('yes','no')},'subscribemwi':{'type':Sequelize[_0x4878('0x3')](_0x4878('0x17'),'no')},'vmexten':{'type':Sequelize[_0x4878('0x2')]},'mohinterpret':{'type':Sequelize[_0x4878('0x2')]},'mohsuggest':{'type':Sequelize[_0x4878('0x2')]},'parkinglot':{'type':Sequelize[_0x4878('0x2')]},'description':{'type':Sequelize['STRING']},'host':{'type':Sequelize[_0x4878('0x2')],'defaultValue':_0x4878('0x30')},'canreinvite':{'type':Sequelize['ENUM']('yes','no',_0x4878('0x31'),'update',_0x4878('0x32')),'defaultValue':'no'},'registry':{'type':Sequelize['STRING']},'otherFields':{'type':Sequelize[_0x4878('0x2')]},'active':{'type':Sequelize[_0x4878('0x33')],'allowNull':![],'defaultValue':!![]},'t38pt_udptl':{'type':Sequelize[_0x4878('0x2')],'defaultValue':'no'}}; \ No newline at end of file +var _0x2ae5=['ALLOWED_PASSED_SCREEN','PROHIB_PASSED_SCREEN','PROHIB','STRING','udp','setDataValue','transport','join','getDataValue','split','rfc2833','info','shortinfo','inband','auto','yes','nonat','update','outgoing','force_rport,comedia','nat','all','allow','String\x20is\x20deprecated.\x20Please\x20use\x20an\x20Array\x20as\x20[\x22ulaw\x22,\x20\x22alaw\x22,\x20\x22alaw\x22]','port,invite','insecure','never','INTEGER','\x22\x22\x20<>','always','refuse','originate','uac','uas','pai','fingerprint','certificate','active','passive','actpass','update,nonat','sequelize','exports','name','ENUM','friend','user','from-voip-provider'];(function(_0x1241f2,_0x3306e4){var _0x2a9acb=function(_0x6a58a){while(--_0x6a58a){_0x1241f2['push'](_0x1241f2['shift']());}};_0x2a9acb(++_0x3306e4);}(_0x2ae5,0xe9));var _0x52ae=function(_0x17d9e3,_0x1f969c){_0x17d9e3=_0x17d9e3-0x0;var _0x14192d=_0x2ae5[_0x17d9e3];return _0x14192d;};'use strict';var Sequelize=require(_0x52ae('0x0'));module[_0x52ae('0x1')]={'name':{'type':Sequelize['STRING'],'allowNull':![],'unique':_0x52ae('0x2'),'validate':{'notEmpty':!![],'is':/^[A-Za-z0-9\.\_]+$/i}},'type':{'type':Sequelize[_0x52ae('0x3')](_0x52ae('0x4'),_0x52ae('0x5'),'peer'),'allowNull':![],'defaultValue':_0x52ae('0x4')},'context':{'type':Sequelize['STRING'],'allowNull':![],'defaultValue':_0x52ae('0x6')},'callingpres':{'type':Sequelize[_0x52ae('0x3')]('ALLOWED_NOT_SCREENED',_0x52ae('0x7'),'ALLOWED_FAILED_SCREEN','ALLOWED','PROHIB_NOT_SCREENED',_0x52ae('0x8'),'PROHIB_FAILED_SCREEN',_0x52ae('0x9'))},'deny':{'type':Sequelize[_0x52ae('0xa')]},'permit':{'type':Sequelize[_0x52ae('0xa')]},'secret':{'type':Sequelize[_0x52ae('0xa')]},'md5secret':{'type':Sequelize[_0x52ae('0xa')]},'remotesecret':{'type':Sequelize[_0x52ae('0xa')]},'transport':{'type':Sequelize[_0x52ae('0xa')],'defaultValue':_0x52ae('0xb'),'set':function(_0x12e963){this[_0x52ae('0xc')](_0x52ae('0xd'),_0x12e963?_0x12e963[_0x52ae('0xe')](','):null);},'get':function(){return this[_0x52ae('0xf')](_0x52ae('0xd'))?this['getDataValue'](_0x52ae('0xd'))[_0x52ae('0x10')](','):null;},'comment':'String\x20is\x20deprecated.\x20Please\x20use\x20an\x20Array\x20as\x20[\x22udp\x22,\x20\x22tcp\x22]'},'dtmfmode':{'type':Sequelize[_0x52ae('0x3')](_0x52ae('0x11'),_0x52ae('0x12'),_0x52ae('0x13'),_0x52ae('0x14'),_0x52ae('0x15')),'defaultValue':_0x52ae('0x11')},'directmedia':{'type':Sequelize['ENUM'](_0x52ae('0x16'),'no',_0x52ae('0x17'),_0x52ae('0x18'),_0x52ae('0x19')),'defaultValue':'no'},'directrtpsetup':{'type':Sequelize['ENUM'](_0x52ae('0x16'),'no'),'defaultValue':'no'},'directmediapermit':{'type':Sequelize[_0x52ae('0xa')]},'directmediadeny':{'type':Sequelize[_0x52ae('0xa')]},'nat':{'type':Sequelize[_0x52ae('0xa')],'defaultValue':_0x52ae('0x1a'),'set':function(_0x306c43){this[_0x52ae('0xc')](_0x52ae('0x1b'),_0x306c43?_0x306c43['join'](','):null);},'get':function(){return this[_0x52ae('0xf')](_0x52ae('0x1b'))?this[_0x52ae('0xf')]('nat')['split'](','):null;},'comment':'String\x20is\x20deprecated.\x20Please\x20use\x20an\x20Array\x20as\x20[\x22force_rport\x22,\x20\x22comedia\x22]'},'callgroup':{'type':Sequelize[_0x52ae('0xa')]},'namedcallgroup':{'type':Sequelize['STRING']},'pickupgroup':{'type':Sequelize[_0x52ae('0xa')]},'namedpickupgroup':{'type':Sequelize['STRING']},'language':{'type':Sequelize[_0x52ae('0xa')],'defaultValue':'en'},'tonezone':{'type':Sequelize[_0x52ae('0xa')],'allowNull':!![]},'disallow':{'type':Sequelize['STRING'],'defaultValue':_0x52ae('0x1c')},'allow':{'type':Sequelize['STRING'],'allowNull':![],'defaultValue':'ulaw;alaw;gsm','set':function(_0x3a811c){this[_0x52ae('0xc')]('allow',_0x3a811c?_0x3a811c[_0x52ae('0xe')](';'):'ulaw;alaw;gsm');},'get':function(){return this[_0x52ae('0xf')]('allow')?this[_0x52ae('0xf')](_0x52ae('0x1d'))['split'](';'):null;},'comment':_0x52ae('0x1e')},'autoframing':{'type':Sequelize['ENUM'](_0x52ae('0x16'),'no')},'insecure':{'type':Sequelize['STRING'],'defaultValue':_0x52ae('0x1f'),'set':function(_0x3af3f7){this['setDataValue'](_0x52ae('0x20'),_0x3af3f7?_0x3af3f7[_0x52ae('0xe')](','):null);},'get':function(){return this[_0x52ae('0xf')](_0x52ae('0x20'))?this[_0x52ae('0xf')](_0x52ae('0x20'))[_0x52ae('0x10')](','):null;},'comment':'String\x20is\x20deprecated.\x20Please\x20use\x20an\x20Array\x20as\x20[\x22port\x22,\x20\x22invite\x22]'},'trustrpid':{'type':Sequelize[_0x52ae('0x3')](_0x52ae('0x16'),'no'),'defaultValue':'no'},'trust_id_outbound':{'type':Sequelize[_0x52ae('0x3')](_0x52ae('0x16'),'no'),'defaultValue':'no'},'progressinband':{'type':Sequelize['ENUM'](_0x52ae('0x16'),'no',_0x52ae('0x21'))},'promiscredir':{'type':Sequelize['ENUM'](_0x52ae('0x16'),'no')},'useclientcode':{'type':Sequelize[_0x52ae('0x3')](_0x52ae('0x16'),'no')},'accountcode':{'type':Sequelize[_0x52ae('0x22')](0xb)},'setvar':{'type':Sequelize[_0x52ae('0xa')]},'callerid':{'type':Sequelize[_0x52ae('0xa')],'defaultValue':_0x52ae('0x23')},'amaflags':{'type':Sequelize[_0x52ae('0xa')]},'callcounter':{'type':Sequelize['ENUM'](_0x52ae('0x16'),'no'),'defaultValue':_0x52ae('0x16')},'busylevel':{'type':Sequelize[_0x52ae('0x22')](0xb)},'allowoverlap':{'type':Sequelize[_0x52ae('0x3')](_0x52ae('0x16'),'no')},'allowsubscribe':{'type':Sequelize[_0x52ae('0x3')]('yes','no')},'allowtransfer':{'type':Sequelize['ENUM'](_0x52ae('0x16'),'no')},'ignoresdpversion':{'type':Sequelize[_0x52ae('0x3')](_0x52ae('0x16'),'no')},'subscribecontext':{'type':Sequelize[_0x52ae('0xa')]},'template':{'type':Sequelize[_0x52ae('0xa')]},'videosupport':{'type':Sequelize[_0x52ae('0x3')](_0x52ae('0x16'),'no',_0x52ae('0x24')),'defaultValue':'no'},'maxcallbitrate':{'type':Sequelize[_0x52ae('0x22')](0xb)},'rfc2833compensate':{'type':Sequelize[_0x52ae('0x3')]('yes','no')},'mailbox':{'type':Sequelize[_0x52ae('0xa')]},'session_timers':{'type':Sequelize[_0x52ae('0x3')]('accept',_0x52ae('0x25'),_0x52ae('0x26'))},'session_expires':{'type':Sequelize[_0x52ae('0x22')](0xb)},'session_minse':{'type':Sequelize[_0x52ae('0x22')](0xb)},'session_refresher':{'type':Sequelize[_0x52ae('0x3')](_0x52ae('0x27'),_0x52ae('0x28')),'defaultValue':_0x52ae('0x28')},'t38pt_usertpsource':{'type':Sequelize[_0x52ae('0xa')]},'regexten':{'type':Sequelize['STRING']},'fromdomain':{'type':Sequelize[_0x52ae('0xa')]},'fromuser':{'type':Sequelize[_0x52ae('0xa')]},'port':{'type':Sequelize['INTEGER'](0x5)},'qualify':{'type':Sequelize[_0x52ae('0x3')](_0x52ae('0x16'),'no'),'defaultValue':_0x52ae('0x16')},'keepalive':{'type':Sequelize[_0x52ae('0x22')](0xb)},'defaultip':{'type':Sequelize[_0x52ae('0xa')]},'defaultuser':{'type':Sequelize[_0x52ae('0xa')]},'rtptimeout':{'type':Sequelize[_0x52ae('0x22')](0xb)},'rtpholdtimeout':{'type':Sequelize[_0x52ae('0x22')](0xb)},'rtpkeepalive':{'type':Sequelize[_0x52ae('0x22')](0xb)},'sendrpid':{'type':Sequelize[_0x52ae('0x3')](_0x52ae('0x16'),'no',_0x52ae('0x29')),'defaultValue':'no'},'outboundproxy':{'type':Sequelize[_0x52ae('0xa')]},'callbackextension':{'type':Sequelize['STRING']},'timert1':{'type':Sequelize[_0x52ae('0x22')](0xb)},'timerb':{'type':Sequelize[_0x52ae('0x22')](0xb)},'qualifyfreq':{'type':Sequelize[_0x52ae('0x22')](0xb)},'contactpermit':{'type':Sequelize[_0x52ae('0xa')]},'contactdeny':{'type':Sequelize[_0x52ae('0xa')]},'contactacl':{'type':Sequelize['STRING']},'unsolicited_mailbox':{'type':Sequelize[_0x52ae('0xa')]},'use_q850_reason':{'type':Sequelize[_0x52ae('0xa')]},'maxforwards':{'type':Sequelize[_0x52ae('0x22')](0xb)},'encryption':{'type':Sequelize[_0x52ae('0x3')]('yes','no'),'defaultValue':'no'},'avpf':{'type':Sequelize['ENUM'](_0x52ae('0x16'),'no')},'force_avp':{'type':Sequelize['ENUM'](_0x52ae('0x16'),'no')},'icesupport':{'type':Sequelize[_0x52ae('0x3')](_0x52ae('0x16'),'no')},'dtlsenable':{'type':Sequelize['ENUM'](_0x52ae('0x16'),'no')},'dtlsverify':{'type':Sequelize['ENUM'](_0x52ae('0x16'),'no',_0x52ae('0x2a'),_0x52ae('0x2b'))},'dtlsrekey':{'type':Sequelize[_0x52ae('0x22')](0xb)},'dtlscertfile':{'type':Sequelize[_0x52ae('0xa')]},'dtlsprivatekey':{'type':Sequelize[_0x52ae('0xa')]},'dtlscipher':{'type':Sequelize['STRING']},'dtlscafile':{'type':Sequelize[_0x52ae('0xa')]},'dtlscapath':{'type':Sequelize[_0x52ae('0xa')]},'dtlssetup':{'type':Sequelize['ENUM'](_0x52ae('0x2c'),_0x52ae('0x2d'),_0x52ae('0x2e')),'allowNull':!![]},'dtlsfingerprint':{'type':Sequelize[_0x52ae('0xa')]},'usereqphone':{'type':Sequelize['ENUM']('yes','no'),'defaultValue':'no'},'recordonfeature':{'type':Sequelize[_0x52ae('0xa')]},'recordofffeature':{'type':Sequelize[_0x52ae('0xa')]},'call_limit':{'type':Sequelize['INTEGER'](0xb),'defaultValue':0x3e8},'registertrying':{'type':Sequelize['ENUM'](_0x52ae('0x16'),'no')},'subscribemwi':{'type':Sequelize['ENUM'](_0x52ae('0x16'),'no')},'vmexten':{'type':Sequelize[_0x52ae('0xa')]},'mohinterpret':{'type':Sequelize[_0x52ae('0xa')]},'mohsuggest':{'type':Sequelize[_0x52ae('0xa')]},'parkinglot':{'type':Sequelize[_0x52ae('0xa')]},'description':{'type':Sequelize[_0x52ae('0xa')]},'host':{'type':Sequelize[_0x52ae('0xa')],'defaultValue':'dynamic'},'canreinvite':{'type':Sequelize['ENUM'](_0x52ae('0x16'),'no',_0x52ae('0x17'),_0x52ae('0x18'),_0x52ae('0x2f')),'defaultValue':'no'},'registry':{'type':Sequelize['STRING']},'otherFields':{'type':Sequelize[_0x52ae('0xa')]},'active':{'type':Sequelize['BOOLEAN'],'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 fb10eae..5fc162d 100644 --- a/server/api/trunk/trunk.controller.js +++ b/server/api/trunk/trunk.controller.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x4b84=['omit','createdAt','updatedAt','body','Unable\x20to\x20retrieve\x20the\x20current\x20user','user','UserProfileSection','userProfileId','create','readFileSync','join','server/files/templates/trunk.ejs','utf8','root','server/files/templates/registry.ejs','render','writeFileSync','/etc/asterisk/sip_xcally_trunks.conf','registry','/etc/asterisk/sip_xcally_registers.conf','Reload','chan_sip.so','role','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','eml-format','rimraf','request-promise','mustache','util','path','fs-extra','squel','jsforce','querystring','papaparse','ioredis','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/environment','../../mysqldb','jayson/promise','http','request','then','info','Trunk,\x20%s,\x20%s,\x20%s','stringify','error','code','message','Trunk,\x20%s,\x20%s','request\x20sent','result','sendStatus','end','status','undefined','limit','count','offset','set','Content-Range','json','apply','reject','save','update','destroy','Trunks','UserProfileResource','stack','name','send','index','Trunk','rawAttributes','fieldName','type','key','model','query','keys','filters','intersection','attributes','fields','nolimit','sort','where','pick','filter','merge','map','VIRTUAL','options','include','findAll','rows','catch','show','params','length','find','includeAll','get'];(function(_0x13d07a,_0x41efc3){var _0x5ee0ee=function(_0x4ca94a){while(--_0x4ca94a){_0x13d07a['push'](_0x13d07a['shift']());}};_0x5ee0ee(++_0x41efc3);}(_0x4b84,0x1cc));var _0x44b8=function(_0x13e741,_0x5d3c24){_0x13e741=_0x13e741-0x0;var _0x3f8bb3=_0x4b84[_0x13e741];return _0x3f8bb3;};'use strict';var emlformat=require(_0x44b8('0x0'));var rimraf=require(_0x44b8('0x1'));var zipdir=require('zip-dir');var jsonpatch=require('fast-json-patch');var rp=require(_0x44b8('0x2'));var moment=require('moment');var BPromise=require('bluebird');var Mustache=require(_0x44b8('0x3'));var util=require(_0x44b8('0x4'));var path=require(_0x44b8('0x5'));var sox=require('sox');var csv=require('to-csv');var ejs=require('ejs');var fs=require('fs');var fs_extra=require(_0x44b8('0x6'));var _=require('lodash');var squel=require(_0x44b8('0x7'));var crypto=require('crypto');var jsforce=require(_0x44b8('0x8'));var deskjs=require('desk.js');var toCsv=require('to-csv');var querystring=require(_0x44b8('0x9'));var Papa=require(_0x44b8('0xa'));var Redis=require(_0x44b8('0xb'));var authService=require('../../components/auth/service');var qs=require(_0x44b8('0xc'));var as=require(_0x44b8('0xd'));var hardwareService=require(_0x44b8('0xe'));var logger=require(_0x44b8('0xf'))(_0x44b8('0x10'));var utils=require(_0x44b8('0x11'));var config=require(_0x44b8('0x12'));var licenseUtil=require('../../config/license/util');var db=require(_0x44b8('0x13'))['db'];var jayson=require(_0x44b8('0x14'));var client=jayson['client'][_0x44b8('0x15')]({'port':0x232a});function respondWithRpcPromise(_0x490bc6,_0x833ea3,_0x18d642,_0x4df670){return new BPromise(function(_0x63e8f6,_0x4be54c){var _0x54fa95=_0x4df670||client;return _0x54fa95[_0x44b8('0x16')](_0x490bc6,_0x18d642)[_0x44b8('0x17')](function(_0x1722da){logger[_0x44b8('0x18')]('Trunk,\x20%s,\x20%s',_0x833ea3,'request\x20sent');logger['debug'](_0x44b8('0x19'),_0x833ea3,'request\x20sent',JSON[_0x44b8('0x1a')](_0x1722da));if(_0x1722da[_0x44b8('0x1b')]){if(_0x1722da['error'][_0x44b8('0x1c')]===0x1f4){logger[_0x44b8('0x1b')]('Trunk,\x20%s,\x20%s',_0x833ea3,_0x1722da[_0x44b8('0x1b')][_0x44b8('0x1d')]);return _0x4be54c(_0x1722da['error'][_0x44b8('0x1d')]);}logger[_0x44b8('0x1b')](_0x44b8('0x1e'),_0x833ea3,_0x1722da[_0x44b8('0x1b')][_0x44b8('0x1d')]);return _0x63e8f6(_0x1722da[_0x44b8('0x1b')][_0x44b8('0x1d')]);}else{logger[_0x44b8('0x18')](_0x44b8('0x1e'),_0x833ea3,_0x44b8('0x1f'));_0x63e8f6(_0x1722da[_0x44b8('0x20')][_0x44b8('0x1d')]);}})['catch'](function(_0x56549a){logger[_0x44b8('0x1b')](_0x44b8('0x1e'),_0x833ea3,_0x56549a);_0x4be54c(_0x56549a);});});}function respondWithStatusCode(_0x1418db,_0x305a5c){_0x305a5c=_0x305a5c||0xcc;return function(_0x51a34a){if(_0x51a34a){return _0x1418db[_0x44b8('0x21')](_0x305a5c);}return _0x1418db['status'](_0x305a5c)[_0x44b8('0x22')]();};}function respondWithResult(_0x228c81,_0x25a0c1){_0x25a0c1=_0x25a0c1||0xc8;return function(_0x47689e){if(_0x47689e){return _0x228c81[_0x44b8('0x23')](_0x25a0c1)['json'](_0x47689e);}};}function respondWithFilteredResult(_0x474f01,_0x502acf){return function(_0x41d673){if(_0x41d673){var _0x350482=typeof _0x502acf['offset']===_0x44b8('0x24')&&typeof _0x502acf[_0x44b8('0x25')]===_0x44b8('0x24');var _0x59c1bf=_0x41d673[_0x44b8('0x26')];var _0x242342=_0x350482?0x0:_0x502acf['offset'];var _0x2e0174=_0x350482?_0x41d673['count']:_0x502acf[_0x44b8('0x27')]+_0x502acf['limit'];var _0x559f0b;if(_0x2e0174>=_0x59c1bf){_0x2e0174=_0x59c1bf;_0x559f0b=0xc8;}else{_0x559f0b=0xce;}_0x474f01['status'](_0x559f0b);return _0x474f01[_0x44b8('0x28')](_0x44b8('0x29'),_0x242342+'-'+_0x2e0174+'/'+_0x59c1bf)[_0x44b8('0x2a')](_0x41d673);}return null;};}function patchUpdates(_0x1bd1be){return function(_0x38cd17){try{jsonpatch[_0x44b8('0x2b')](_0x38cd17,_0x1bd1be,!![]);}catch(_0x2cf205){return BPromise[_0x44b8('0x2c')](_0x2cf205);}return _0x38cd17[_0x44b8('0x2d')]();};}function saveUpdates(_0x28f918,_0x5e1129){return function(_0x417d81){if(_0x417d81){return _0x417d81[_0x44b8('0x2e')](_0x28f918)['then'](function(_0x261ff2){return _0x261ff2;});}return null;};}function removeEntity(_0x538db7,_0x212983){return function(_0x1652cb){if(_0x1652cb){return _0x1652cb[_0x44b8('0x2f')]()[_0x44b8('0x17')](function(){var _0x1b63a7=_0x1652cb['get']({'plain':!![]});var _0x16b706=_0x44b8('0x30');return db[_0x44b8('0x31')][_0x44b8('0x2f')]({'where':{'type':_0x16b706,'resourceId':_0x1b63a7['id']}})[_0x44b8('0x17')](function(){return _0x1652cb;});})['then'](function(){_0x538db7[_0x44b8('0x23')](0xcc)[_0x44b8('0x22')]();});}};}function handleEntityNotFound(_0x1a30fc,_0x3e93af){return function(_0x140a79){if(!_0x140a79){_0x1a30fc[_0x44b8('0x21')](0x194);}return _0x140a79;};}function handleError(_0x2e8b88,_0x14a9d7){_0x14a9d7=_0x14a9d7||0x1f4;return function(_0x28c10d){logger[_0x44b8('0x1b')](_0x28c10d[_0x44b8('0x32')]);if(_0x28c10d[_0x44b8('0x33')]){delete _0x28c10d[_0x44b8('0x33')];}_0x2e8b88[_0x44b8('0x23')](_0x14a9d7)[_0x44b8('0x34')](_0x28c10d);};}exports[_0x44b8('0x35')]=function(_0x323c50,_0xeff999){var _0x28faa9={},_0x3984f8={},_0x2c02d6={'count':0x0,'rows':[]};var _0x282345=_['map'](db[_0x44b8('0x36')][_0x44b8('0x37')],function(_0x4fcfa0){return{'name':_0x4fcfa0[_0x44b8('0x38')],'type':_0x4fcfa0[_0x44b8('0x39')][_0x44b8('0x3a')]};});_0x3984f8[_0x44b8('0x3b')]=_['map'](_0x282345,_0x44b8('0x33'));_0x3984f8[_0x44b8('0x3c')]=_[_0x44b8('0x3d')](_0x323c50[_0x44b8('0x3c')]);_0x3984f8[_0x44b8('0x3e')]=_[_0x44b8('0x3f')](_0x3984f8[_0x44b8('0x3b')],_0x3984f8[_0x44b8('0x3c')]);_0x28faa9[_0x44b8('0x40')]=_[_0x44b8('0x3f')](_0x3984f8[_0x44b8('0x3b')],qs[_0x44b8('0x41')](_0x323c50[_0x44b8('0x3c')][_0x44b8('0x41')]));_0x28faa9[_0x44b8('0x40')]=_0x28faa9[_0x44b8('0x40')]['length']?_0x28faa9[_0x44b8('0x40')]:_0x3984f8[_0x44b8('0x3b')];if(!_0x323c50[_0x44b8('0x3c')]['hasOwnProperty'](_0x44b8('0x42'))){_0x28faa9[_0x44b8('0x25')]=qs[_0x44b8('0x25')](_0x323c50['query'][_0x44b8('0x25')]);_0x28faa9[_0x44b8('0x27')]=qs[_0x44b8('0x27')](_0x323c50[_0x44b8('0x3c')][_0x44b8('0x27')]);}_0x28faa9['order']=qs['sort'](_0x323c50[_0x44b8('0x3c')][_0x44b8('0x43')]);_0x28faa9[_0x44b8('0x44')]=qs[_0x44b8('0x3e')](_[_0x44b8('0x45')](_0x323c50[_0x44b8('0x3c')],_0x3984f8[_0x44b8('0x3e')]),_0x282345);if(_0x323c50[_0x44b8('0x3c')][_0x44b8('0x46')]){_0x28faa9[_0x44b8('0x44')]=_[_0x44b8('0x47')](_0x28faa9[_0x44b8('0x44')],{'$or':_[_0x44b8('0x48')](_0x282345,function(_0x1236c7){if(_0x1236c7[_0x44b8('0x39')]!==_0x44b8('0x49')){var _0xce06dc={};_0xce06dc[_0x1236c7[_0x44b8('0x33')]]={'$like':'%'+_0x323c50[_0x44b8('0x3c')]['filter']+'%'};return _0xce06dc;}})});}_0x28faa9=_['merge']({},_0x28faa9,_0x323c50[_0x44b8('0x4a')]);var _0x1df74b={'where':_0x28faa9[_0x44b8('0x44')]};return db[_0x44b8('0x36')][_0x44b8('0x26')](_0x1df74b)[_0x44b8('0x17')](function(_0x411ed6){_0x2c02d6['count']=_0x411ed6;if(_0x323c50[_0x44b8('0x3c')]['includeAll']){_0x28faa9[_0x44b8('0x4b')]=[{'all':!![]}];}return db[_0x44b8('0x36')][_0x44b8('0x4c')](_0x28faa9);})[_0x44b8('0x17')](function(_0x103d57){_0x2c02d6[_0x44b8('0x4d')]=_0x103d57;return _0x2c02d6;})['then'](respondWithFilteredResult(_0xeff999,_0x28faa9))[_0x44b8('0x4e')](handleError(_0xeff999,null));};exports[_0x44b8('0x4f')]=function(_0x10602c,_0x25d266){var _0x4ccc77={'raw':![],'where':{'id':_0x10602c[_0x44b8('0x50')]['id']}},_0x4e4ed1={};_0x4e4ed1[_0x44b8('0x3b')]=_[_0x44b8('0x3d')](db[_0x44b8('0x36')][_0x44b8('0x37')]);_0x4e4ed1['query']=_[_0x44b8('0x3d')](_0x10602c[_0x44b8('0x3c')]);_0x4e4ed1[_0x44b8('0x3e')]=_[_0x44b8('0x3f')](_0x4e4ed1[_0x44b8('0x3b')],_0x4e4ed1['query']);_0x4ccc77['attributes']=_[_0x44b8('0x3f')](_0x4e4ed1['model'],qs[_0x44b8('0x41')](_0x10602c['query'][_0x44b8('0x41')]));_0x4ccc77[_0x44b8('0x40')]=_0x4ccc77[_0x44b8('0x40')][_0x44b8('0x51')]?_0x4ccc77[_0x44b8('0x40')]:_0x4e4ed1[_0x44b8('0x3b')];if(_0x10602c[_0x44b8('0x3c')]['includeAll']){_0x4ccc77[_0x44b8('0x4b')]=[{'all':!![]}];}_0x4ccc77=_[_0x44b8('0x47')]({},_0x4ccc77,_0x10602c[_0x44b8('0x4a')]);return db['Trunk'][_0x44b8('0x52')](_0x4ccc77)[_0x44b8('0x17')](handleEntityNotFound(_0x25d266,null))[_0x44b8('0x17')](respondWithResult(_0x25d266,null))[_0x44b8('0x4e')](handleError(_0x25d266,null));};exports['clone']=function(_0x399d6b,_0x308f7b){var _0x4a6e55={'where':{'id':_0x399d6b[_0x44b8('0x50')]['id']}},_0x3de425={};_0x3de425[_0x44b8('0x3b')]=_[_0x44b8('0x3d')](db[_0x44b8('0x36')]['rawAttributes']);_0x4a6e55['attributes']=_[_0x44b8('0x3f')](_0x3de425[_0x44b8('0x3b')],qs[_0x44b8('0x41')](_0x399d6b[_0x44b8('0x3c')][_0x44b8('0x41')]));_0x4a6e55[_0x44b8('0x40')]=_0x4a6e55[_0x44b8('0x40')][_0x44b8('0x51')]?_0x4a6e55[_0x44b8('0x40')]:_0x3de425[_0x44b8('0x3b')];if(_0x399d6b[_0x44b8('0x3c')][_0x44b8('0x53')]){_0x4a6e55['include']=[{'all':!![]}];}_0x4a6e55=_[_0x44b8('0x47')]({},_0x4a6e55,_0x399d6b[_0x44b8('0x4a')]);return db[_0x44b8('0x36')][_0x44b8('0x52')](_0x4a6e55)[_0x44b8('0x17')](handleEntityNotFound(_0x308f7b,null))[_0x44b8('0x17')](function(_0x426a6a){if(_0x426a6a){var _0x172ff3=_0x426a6a[_0x44b8('0x54')]({'plain':!![]});_0x172ff3=qs[_0x44b8('0x55')](_0x172ff3,['id',_0x44b8('0x56'),_0x44b8('0x57')]);_0x399d6b[_0x44b8('0x58')]=_[_0x44b8('0x55')](_0x399d6b[_0x44b8('0x58')],['id',_0x44b8('0x56'),_0x44b8('0x57')]);return db[_0x44b8('0x36')]['create'](_[_0x44b8('0x47')](_0x172ff3,_0x399d6b[_0x44b8('0x58')]),{'include':_0x399d6b[_0x44b8('0x3c')][_0x44b8('0x53')]?[{'all':!![]}]:undefined})[_0x44b8('0x17')](function(_0x29ed5d){var _0x2ecf65=_0x399d6b['user'][_0x44b8('0x54')]({'plain':!![]});if(!_0x2ecf65)throw new Error(_0x44b8('0x59'));if(_0x2ecf65['role']===_0x44b8('0x5a')){var _0x3354bd=_0x29ed5d['get']({'plain':!![]});var _0x37e42e=_0x44b8('0x30');return db[_0x44b8('0x5b')]['find']({'where':{'name':_0x37e42e,'userProfileId':_0x2ecf65[_0x44b8('0x5c')]},'raw':!![]})['then'](function(_0x36cdd8){if(_0x36cdd8&&_0x36cdd8['autoAssociation']===0x0){return db[_0x44b8('0x31')][_0x44b8('0x5d')]({'name':_0x3354bd[_0x44b8('0x33')],'resourceId':_0x3354bd['id'],'type':_0x36cdd8[_0x44b8('0x33')],'sectionId':_0x36cdd8['id']},{})[_0x44b8('0x17')](function(){return _0x29ed5d;});}else{return _0x29ed5d;}})[_0x44b8('0x4e')](function(_0x4c7edd){logger[_0x44b8('0x1b')]('Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s',_0x4c7edd);throw _0x4c7edd;});}return _0x29ed5d;});}})[_0x44b8('0x17')](respondWithResult(_0x308f7b,0xc9))[_0x44b8('0x4e')](handleError(_0x308f7b,null));};exports['create']=function(_0x3f9438,_0x1ee26b,_0x1cf31f){var _0x30d60f;return db[_0x44b8('0x36')][_0x44b8('0x5d')](_0x3f9438[_0x44b8('0x58')],{'raw':!![]})[_0x44b8('0x17')](function(_0x3f9102){_0x30d60f=_0x3f9102;return db[_0x44b8('0x36')][_0x44b8('0x4c')]({'raw':!![]});})[_0x44b8('0x17')](function(_0x52381a){var _0xd20d0=fs[_0x44b8('0x5e')](path[_0x44b8('0x5f')](config['root'],_0x44b8('0x60')),_0x44b8('0x61'));var _0x5bff09=fs[_0x44b8('0x5e')](path[_0x44b8('0x5f')](config[_0x44b8('0x62')],_0x44b8('0x63')),_0x44b8('0x61'));var _0x59060b=ejs[_0x44b8('0x64')](_0xd20d0,{'trunks':_0x52381a||[]});fs[_0x44b8('0x65')](_0x44b8('0x66'),_0x59060b);if(_0x30d60f[_0x44b8('0x67')]){var _0x2e02d7=ejs[_0x44b8('0x64')](_0x5bff09,{'trunks':_0x52381a||[]});fs[_0x44b8('0x65')](_0x44b8('0x68'),_0x2e02d7);}})['then'](function(){return respondWithRpcPromise(_0x44b8('0x69'),_0x44b8('0x5d'),{'module':_0x44b8('0x6a')});})[_0x44b8('0x17')](function(){var _0x5b26e8=_0x3f9438['user']['get']({'plain':!![]});if(!_0x5b26e8)throw new Error(_0x44b8('0x59'));if(_0x5b26e8[_0x44b8('0x6b')]===_0x44b8('0x5a')){var _0x46e20f=_0x30d60f[_0x44b8('0x54')]({'plain':!![]});return db['UserProfileSection'][_0x44b8('0x52')]({'where':{'name':'Trunks','userProfileId':_0x5b26e8[_0x44b8('0x5c')]},'raw':!![]})[_0x44b8('0x17')](function(_0xea2c3e){if(_0xea2c3e&&_0xea2c3e['autoAssociation']===0x0){return db['UserProfileResource'][_0x44b8('0x5d')]({'name':_0x46e20f[_0x44b8('0x33')],'resourceId':_0x46e20f['id'],'type':_0xea2c3e[_0x44b8('0x33')],'sectionId':_0xea2c3e['id']},{})['then'](function(){return _0x30d60f;});}else{return _0x30d60f;}})[_0x44b8('0x4e')](function(_0x36f217){logger[_0x44b8('0x1b')](_0x44b8('0x6c'),_0x36f217);throw _0x36f217;});}return _0x30d60f;})[_0x44b8('0x17')](respondWithResult(_0x1ee26b,0xc9))['catch'](handleError(_0x1ee26b,null));};exports[_0x44b8('0x2e')]=function(_0x1888f8,_0xbbdab9,_0x2a8ccc){var _0x220f1b;return db['Trunk'][_0x44b8('0x52')]({'where':{'id':_0x1888f8[_0x44b8('0x50')]['id']}})[_0x44b8('0x17')](handleEntityNotFound(_0xbbdab9,null))[_0x44b8('0x17')](saveUpdates(_0x1888f8[_0x44b8('0x58')],null))[_0x44b8('0x17')](function(_0x1c7ef2){if(_0x1c7ef2){_0x220f1b=_0x1c7ef2;return db['Trunk'][_0x44b8('0x4c')]({'raw':!![]});}})[_0x44b8('0x17')](function(_0x4c3fea){if(_0x4c3fea){var _0x3bb7d8=fs[_0x44b8('0x5e')](path['join'](config[_0x44b8('0x62')],'server/files/templates/trunk.ejs'),'utf8');var _0x31d3b6=fs[_0x44b8('0x5e')](path[_0x44b8('0x5f')](config['root'],'server/files/templates/registry.ejs'),'utf8');var _0x36334a=ejs[_0x44b8('0x64')](_0x3bb7d8,{'trunks':_0x4c3fea||[]});fs[_0x44b8('0x65')](_0x44b8('0x66'),_0x36334a);var _0x1a5621=ejs[_0x44b8('0x64')](_0x31d3b6,{'trunks':_0x4c3fea||[]});fs[_0x44b8('0x65')](_0x44b8('0x68'),_0x1a5621);return respondWithRpcPromise('Reload',_0x44b8('0x2e'),{'module':'chan_sip.so'});}return null;})['then'](function(_0x55f4e4){if(_0x55f4e4){return _0x220f1b;}})[_0x44b8('0x17')](respondWithResult(_0xbbdab9,null))['catch'](handleError(_0xbbdab9,null));};exports[_0x44b8('0x2f')]=function(_0x1e37fd,_0x268e1e,_0x306793){var _0x3a9780;return db[_0x44b8('0x36')][_0x44b8('0x52')]({'where':{'id':_0x1e37fd[_0x44b8('0x50')]['id']}})['then'](handleEntityNotFound(_0x268e1e,null))[_0x44b8('0x17')](removeEntity(_0x268e1e,null))[_0x44b8('0x17')](function(){return db[_0x44b8('0x36')][_0x44b8('0x4c')]({'raw':!![]});})[_0x44b8('0x17')](function(_0xee44b3){var _0x10034d=fs[_0x44b8('0x5e')](path[_0x44b8('0x5f')](config['root'],'server/files/templates/trunk.ejs'),_0x44b8('0x61'));var _0x553aa9=fs[_0x44b8('0x5e')](path[_0x44b8('0x5f')](config[_0x44b8('0x62')],'server/files/templates/registry.ejs'),'utf8');var _0x4b22e7=ejs[_0x44b8('0x64')](_0x10034d,{'trunks':_0xee44b3});var _0x4860af=ejs[_0x44b8('0x64')](_0x553aa9,{'trunks':_0xee44b3});fs[_0x44b8('0x65')](_0x44b8('0x66'),_0x4b22e7);fs[_0x44b8('0x65')](_0x44b8('0x68'),_0x4860af);return respondWithRpcPromise(_0x44b8('0x69'),_0x44b8('0x2f'),{'module':_0x44b8('0x6a')});})[_0x44b8('0x4e')](handleError(_0x268e1e,null));}; \ No newline at end of file +var _0x9f62=['updatedAt','body','create','user','role','UserProfileSection','autoAssociation','join','root','server/files/templates/trunk.ejs','utf8','readFileSync','writeFileSync','registry','/etc/asterisk/sip_xcally_registers.conf','chan_sip.so','Unable\x20to\x20retrieve\x20the\x20current\x20user','userProfileId','render','/etc/asterisk/sip_xcally_trunks.conf','Reload','server/files/templates/registry.ejs','rimraf','fast-json-patch','request-promise','moment','util','path','sox','to-csv','fs-extra','lodash','squel','crypto','jsforce','ioredis','../../components/auth/service','../../config/license/hardware','../../config/logger','../../config/utils','../../config/environment','http','request','then','info','Trunk,\x20%s,\x20%s','request\x20sent','debug','Trunk,\x20%s,\x20%s,\x20%s','error','code','message','result','catch','sendStatus','status','json','offset','limit','undefined','count','set','Content-Range','reject','update','destroy','get','Trunks','UserProfileResource','stack','name','send','index','rawAttributes','fieldName','key','map','keys','filters','intersection','query','attributes','model','fields','length','hasOwnProperty','order','sort','where','pick','filter','merge','type','VIRTUAL','options','includeAll','include','Trunk','findAll','rows','show','params','clone','find','omit','createdAt'];(function(_0x360e5c,_0x1d60de){var _0x3629ea=function(_0x3f12b6){while(--_0x3f12b6){_0x360e5c['push'](_0x360e5c['shift']());}};_0x3629ea(++_0x1d60de);}(_0x9f62,0x154));var _0x29f6=function(_0xaaa0db,_0x3ce5f2){_0xaaa0db=_0xaaa0db-0x0;var _0x1aec37=_0x9f62[_0xaaa0db];return _0x1aec37;};'use strict';var emlformat=require('eml-format');var rimraf=require(_0x29f6('0x0'));var zipdir=require('zip-dir');var jsonpatch=require(_0x29f6('0x1'));var rp=require(_0x29f6('0x2'));var moment=require(_0x29f6('0x3'));var BPromise=require('bluebird');var Mustache=require('mustache');var util=require(_0x29f6('0x4'));var path=require(_0x29f6('0x5'));var sox=require(_0x29f6('0x6'));var csv=require(_0x29f6('0x7'));var ejs=require('ejs');var fs=require('fs');var fs_extra=require(_0x29f6('0x8'));var _=require(_0x29f6('0x9'));var squel=require(_0x29f6('0xa'));var crypto=require(_0x29f6('0xb'));var jsforce=require(_0x29f6('0xc'));var deskjs=require('desk.js');var toCsv=require('to-csv');var querystring=require('querystring');var Papa=require('papaparse');var Redis=require(_0x29f6('0xd'));var authService=require(_0x29f6('0xe'));var qs=require('../../components/parsers/qs');var as=require('../../components/parsers/advancedSearch');var hardwareService=require(_0x29f6('0xf'));var logger=require(_0x29f6('0x10'))('api');var utils=require(_0x29f6('0x11'));var config=require(_0x29f6('0x12'));var licenseUtil=require('../../config/license/util');var db=require('../../mysqldb')['db'];var jayson=require('jayson/promise');var client=jayson['client'][_0x29f6('0x13')]({'port':0x232a});function respondWithRpcPromise(_0x55cf4,_0x189344,_0x11a1fd,_0x17de6e){return new BPromise(function(_0x156c96,_0x35d2e2){var _0x2418ee=_0x17de6e||client;return _0x2418ee[_0x29f6('0x14')](_0x55cf4,_0x11a1fd)[_0x29f6('0x15')](function(_0x28d314){logger[_0x29f6('0x16')](_0x29f6('0x17'),_0x189344,_0x29f6('0x18'));logger[_0x29f6('0x19')](_0x29f6('0x1a'),_0x189344,_0x29f6('0x18'),JSON['stringify'](_0x28d314));if(_0x28d314['error']){if(_0x28d314[_0x29f6('0x1b')][_0x29f6('0x1c')]===0x1f4){logger[_0x29f6('0x1b')]('Trunk,\x20%s,\x20%s',_0x189344,_0x28d314[_0x29f6('0x1b')][_0x29f6('0x1d')]);return _0x35d2e2(_0x28d314['error'][_0x29f6('0x1d')]);}logger[_0x29f6('0x1b')](_0x29f6('0x17'),_0x189344,_0x28d314[_0x29f6('0x1b')][_0x29f6('0x1d')]);return _0x156c96(_0x28d314[_0x29f6('0x1b')]['message']);}else{logger[_0x29f6('0x16')]('Trunk,\x20%s,\x20%s',_0x189344,'request\x20sent');_0x156c96(_0x28d314[_0x29f6('0x1e')][_0x29f6('0x1d')]);}})[_0x29f6('0x1f')](function(_0xafb5dd){logger['error'](_0x29f6('0x17'),_0x189344,_0xafb5dd);_0x35d2e2(_0xafb5dd);});});}function respondWithStatusCode(_0x49f67d,_0xd4179c){_0xd4179c=_0xd4179c||0xcc;return function(_0xcce041){if(_0xcce041){return _0x49f67d[_0x29f6('0x20')](_0xd4179c);}return _0x49f67d[_0x29f6('0x21')](_0xd4179c)['end']();};}function respondWithResult(_0x4290a2,_0x4d494f){_0x4d494f=_0x4d494f||0xc8;return function(_0x47c385){if(_0x47c385){return _0x4290a2[_0x29f6('0x21')](_0x4d494f)[_0x29f6('0x22')](_0x47c385);}};}function respondWithFilteredResult(_0x2519ac,_0x342038){return function(_0x84ccb7){if(_0x84ccb7){var _0x4333bc=typeof _0x342038[_0x29f6('0x23')]==='undefined'&&typeof _0x342038[_0x29f6('0x24')]===_0x29f6('0x25');var _0x1ab8d8=_0x84ccb7[_0x29f6('0x26')];var _0xda0a63=_0x4333bc?0x0:_0x342038[_0x29f6('0x23')];var _0x3790f5=_0x4333bc?_0x84ccb7[_0x29f6('0x26')]:_0x342038[_0x29f6('0x23')]+_0x342038[_0x29f6('0x24')];var _0x2915bc;if(_0x3790f5>=_0x1ab8d8){_0x3790f5=_0x1ab8d8;_0x2915bc=0xc8;}else{_0x2915bc=0xce;}_0x2519ac[_0x29f6('0x21')](_0x2915bc);return _0x2519ac[_0x29f6('0x27')](_0x29f6('0x28'),_0xda0a63+'-'+_0x3790f5+'/'+_0x1ab8d8)[_0x29f6('0x22')](_0x84ccb7);}return null;};}function patchUpdates(_0x218931){return function(_0x3a7249){try{jsonpatch['apply'](_0x3a7249,_0x218931,!![]);}catch(_0x5582d3){return BPromise[_0x29f6('0x29')](_0x5582d3);}return _0x3a7249['save']();};}function saveUpdates(_0x341071,_0xc8d2c5){return function(_0x1e1bb6){if(_0x1e1bb6){return _0x1e1bb6[_0x29f6('0x2a')](_0x341071)['then'](function(_0x53e11f){return _0x53e11f;});}return null;};}function removeEntity(_0x1bde69,_0xa6377c){return function(_0x2edc2e){if(_0x2edc2e){return _0x2edc2e[_0x29f6('0x2b')]()[_0x29f6('0x15')](function(){var _0x20bc5e=_0x2edc2e[_0x29f6('0x2c')]({'plain':!![]});var _0x1c3f0f=_0x29f6('0x2d');return db[_0x29f6('0x2e')][_0x29f6('0x2b')]({'where':{'type':_0x1c3f0f,'resourceId':_0x20bc5e['id']}})[_0x29f6('0x15')](function(){return _0x2edc2e;});})[_0x29f6('0x15')](function(){_0x1bde69[_0x29f6('0x21')](0xcc)['end']();});}};}function handleEntityNotFound(_0x5e31dd,_0x206beb){return function(_0x44cf19){if(!_0x44cf19){_0x5e31dd[_0x29f6('0x20')](0x194);}return _0x44cf19;};}function handleError(_0x5416dc,_0x3e1e25){_0x3e1e25=_0x3e1e25||0x1f4;return function(_0x749b9d){logger[_0x29f6('0x1b')](_0x749b9d[_0x29f6('0x2f')]);if(_0x749b9d[_0x29f6('0x30')]){delete _0x749b9d['name'];}_0x5416dc[_0x29f6('0x21')](_0x3e1e25)[_0x29f6('0x31')](_0x749b9d);};}exports[_0x29f6('0x32')]=function(_0x1b51cc,_0x4f5fe1){var _0x30d747={},_0x2a09e8={},_0x14b392={'count':0x0,'rows':[]};var _0x105557=_['map'](db['Trunk'][_0x29f6('0x33')],function(_0x4bfc80){return{'name':_0x4bfc80[_0x29f6('0x34')],'type':_0x4bfc80['type'][_0x29f6('0x35')]};});_0x2a09e8['model']=_[_0x29f6('0x36')](_0x105557,_0x29f6('0x30'));_0x2a09e8['query']=_[_0x29f6('0x37')](_0x1b51cc['query']);_0x2a09e8[_0x29f6('0x38')]=_[_0x29f6('0x39')](_0x2a09e8['model'],_0x2a09e8[_0x29f6('0x3a')]);_0x30d747[_0x29f6('0x3b')]=_[_0x29f6('0x39')](_0x2a09e8[_0x29f6('0x3c')],qs['fields'](_0x1b51cc[_0x29f6('0x3a')][_0x29f6('0x3d')]));_0x30d747[_0x29f6('0x3b')]=_0x30d747[_0x29f6('0x3b')][_0x29f6('0x3e')]?_0x30d747['attributes']:_0x2a09e8[_0x29f6('0x3c')];if(!_0x1b51cc['query'][_0x29f6('0x3f')]('nolimit')){_0x30d747[_0x29f6('0x24')]=qs[_0x29f6('0x24')](_0x1b51cc['query'][_0x29f6('0x24')]);_0x30d747[_0x29f6('0x23')]=qs[_0x29f6('0x23')](_0x1b51cc[_0x29f6('0x3a')]['offset']);}_0x30d747[_0x29f6('0x40')]=qs[_0x29f6('0x41')](_0x1b51cc[_0x29f6('0x3a')]['sort']);_0x30d747[_0x29f6('0x42')]=qs['filters'](_[_0x29f6('0x43')](_0x1b51cc['query'],_0x2a09e8['filters']),_0x105557);if(_0x1b51cc['query'][_0x29f6('0x44')]){_0x30d747[_0x29f6('0x42')]=_[_0x29f6('0x45')](_0x30d747[_0x29f6('0x42')],{'$or':_[_0x29f6('0x36')](_0x105557,function(_0x270842){if(_0x270842[_0x29f6('0x46')]!==_0x29f6('0x47')){var _0x352119={};_0x352119[_0x270842[_0x29f6('0x30')]]={'$like':'%'+_0x1b51cc['query']['filter']+'%'};return _0x352119;}})});}_0x30d747=_[_0x29f6('0x45')]({},_0x30d747,_0x1b51cc[_0x29f6('0x48')]);var _0x7a65c0={'where':_0x30d747[_0x29f6('0x42')]};return db['Trunk'][_0x29f6('0x26')](_0x7a65c0)[_0x29f6('0x15')](function(_0x532df5){_0x14b392[_0x29f6('0x26')]=_0x532df5;if(_0x1b51cc[_0x29f6('0x3a')][_0x29f6('0x49')]){_0x30d747[_0x29f6('0x4a')]=[{'all':!![]}];}return db[_0x29f6('0x4b')][_0x29f6('0x4c')](_0x30d747);})[_0x29f6('0x15')](function(_0x1f03b6){_0x14b392[_0x29f6('0x4d')]=_0x1f03b6;return _0x14b392;})[_0x29f6('0x15')](respondWithFilteredResult(_0x4f5fe1,_0x30d747))[_0x29f6('0x1f')](handleError(_0x4f5fe1,null));};exports[_0x29f6('0x4e')]=function(_0x58ea69,_0x416c24){var _0x463551={'raw':![],'where':{'id':_0x58ea69[_0x29f6('0x4f')]['id']}},_0x335ec1={};_0x335ec1[_0x29f6('0x3c')]=_['keys'](db[_0x29f6('0x4b')]['rawAttributes']);_0x335ec1['query']=_[_0x29f6('0x37')](_0x58ea69[_0x29f6('0x3a')]);_0x335ec1[_0x29f6('0x38')]=_[_0x29f6('0x39')](_0x335ec1[_0x29f6('0x3c')],_0x335ec1['query']);_0x463551[_0x29f6('0x3b')]=_[_0x29f6('0x39')](_0x335ec1['model'],qs[_0x29f6('0x3d')](_0x58ea69['query'][_0x29f6('0x3d')]));_0x463551[_0x29f6('0x3b')]=_0x463551[_0x29f6('0x3b')][_0x29f6('0x3e')]?_0x463551['attributes']:_0x335ec1[_0x29f6('0x3c')];if(_0x58ea69[_0x29f6('0x3a')][_0x29f6('0x49')]){_0x463551[_0x29f6('0x4a')]=[{'all':!![]}];}_0x463551=_[_0x29f6('0x45')]({},_0x463551,_0x58ea69[_0x29f6('0x48')]);return db[_0x29f6('0x4b')]['find'](_0x463551)[_0x29f6('0x15')](handleEntityNotFound(_0x416c24,null))[_0x29f6('0x15')](respondWithResult(_0x416c24,null))[_0x29f6('0x1f')](handleError(_0x416c24,null));};exports[_0x29f6('0x50')]=function(_0x36e52c,_0x1ac20d){var _0x37c3c1={'where':{'id':_0x36e52c[_0x29f6('0x4f')]['id']}},_0x2f356d={};_0x2f356d[_0x29f6('0x3c')]=_['keys'](db['Trunk'][_0x29f6('0x33')]);_0x37c3c1[_0x29f6('0x3b')]=_[_0x29f6('0x39')](_0x2f356d['model'],qs[_0x29f6('0x3d')](_0x36e52c['query']['fields']));_0x37c3c1[_0x29f6('0x3b')]=_0x37c3c1[_0x29f6('0x3b')]['length']?_0x37c3c1['attributes']:_0x2f356d[_0x29f6('0x3c')];if(_0x36e52c[_0x29f6('0x3a')][_0x29f6('0x49')]){_0x37c3c1['include']=[{'all':!![]}];}_0x37c3c1=_[_0x29f6('0x45')]({},_0x37c3c1,_0x36e52c[_0x29f6('0x48')]);return db[_0x29f6('0x4b')][_0x29f6('0x51')](_0x37c3c1)[_0x29f6('0x15')](handleEntityNotFound(_0x1ac20d,null))[_0x29f6('0x15')](function(_0x7700da){if(_0x7700da){var _0x33b1d7=_0x7700da[_0x29f6('0x2c')]({'plain':!![]});_0x33b1d7=qs[_0x29f6('0x52')](_0x33b1d7,['id',_0x29f6('0x53'),_0x29f6('0x54')]);_0x36e52c[_0x29f6('0x55')]=_['omit'](_0x36e52c['body'],['id',_0x29f6('0x53'),'updatedAt']);return db[_0x29f6('0x4b')][_0x29f6('0x56')](_[_0x29f6('0x45')](_0x33b1d7,_0x36e52c[_0x29f6('0x55')]),{'include':_0x36e52c[_0x29f6('0x3a')]['includeAll']?[{'all':!![]}]:undefined})[_0x29f6('0x15')](function(_0x38d684){var _0x2f694e=_0x36e52c[_0x29f6('0x57')][_0x29f6('0x2c')]({'plain':!![]});if(!_0x2f694e)throw new Error('Unable\x20to\x20retrieve\x20the\x20current\x20user');if(_0x2f694e[_0x29f6('0x58')]==='user'){var _0x51b9dc=_0x38d684[_0x29f6('0x2c')]({'plain':!![]});var _0x336b8e='Trunks';return db[_0x29f6('0x59')][_0x29f6('0x51')]({'where':{'name':_0x336b8e,'userProfileId':_0x2f694e['userProfileId']},'raw':!![]})[_0x29f6('0x15')](function(_0x2ba44c){if(_0x2ba44c&&_0x2ba44c[_0x29f6('0x5a')]===0x0){return db[_0x29f6('0x2e')][_0x29f6('0x56')]({'name':_0x51b9dc[_0x29f6('0x30')],'resourceId':_0x51b9dc['id'],'type':_0x2ba44c[_0x29f6('0x30')],'sectionId':_0x2ba44c['id']},{})['then'](function(){return _0x38d684;});}else{return _0x38d684;}})[_0x29f6('0x1f')](function(_0x50ddd6){logger[_0x29f6('0x1b')]('Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s',_0x50ddd6);throw _0x50ddd6;});}return _0x38d684;});}})['then'](respondWithResult(_0x1ac20d,0xc9))[_0x29f6('0x1f')](handleError(_0x1ac20d,null));};exports[_0x29f6('0x56')]=function(_0x195887,_0x536b0c,_0x6ae738){var _0x373cf6;return db[_0x29f6('0x4b')]['create'](_0x195887[_0x29f6('0x55')],{'raw':!![]})[_0x29f6('0x15')](function(_0x66a7bb){_0x373cf6=_0x66a7bb;return db[_0x29f6('0x4b')][_0x29f6('0x4c')]({'raw':!![]});})[_0x29f6('0x15')](function(_0x6587f3){var _0x41c1b9=fs['readFileSync'](path[_0x29f6('0x5b')](config[_0x29f6('0x5c')],_0x29f6('0x5d')),_0x29f6('0x5e'));var _0x1636f1=fs[_0x29f6('0x5f')](path[_0x29f6('0x5b')](config[_0x29f6('0x5c')],'server/files/templates/registry.ejs'),_0x29f6('0x5e'));var _0x1ca187=ejs['render'](_0x41c1b9,{'trunks':_0x6587f3||[]});fs[_0x29f6('0x60')]('/etc/asterisk/sip_xcally_trunks.conf',_0x1ca187);if(_0x373cf6[_0x29f6('0x61')]){var _0x5a383f=ejs['render'](_0x1636f1,{'trunks':_0x6587f3||[]});fs[_0x29f6('0x60')](_0x29f6('0x62'),_0x5a383f);}})['then'](function(){return respondWithRpcPromise('Reload','create',{'module':_0x29f6('0x63')});})[_0x29f6('0x15')](function(){var _0x144c76=_0x195887[_0x29f6('0x57')][_0x29f6('0x2c')]({'plain':!![]});if(!_0x144c76)throw new Error(_0x29f6('0x64'));if(_0x144c76[_0x29f6('0x58')]==='user'){var _0x11ef85=_0x373cf6[_0x29f6('0x2c')]({'plain':!![]});return db[_0x29f6('0x59')][_0x29f6('0x51')]({'where':{'name':'Trunks','userProfileId':_0x144c76[_0x29f6('0x65')]},'raw':!![]})[_0x29f6('0x15')](function(_0x32a862){if(_0x32a862&&_0x32a862[_0x29f6('0x5a')]===0x0){return db[_0x29f6('0x2e')]['create']({'name':_0x11ef85[_0x29f6('0x30')],'resourceId':_0x11ef85['id'],'type':_0x32a862[_0x29f6('0x30')],'sectionId':_0x32a862['id']},{})[_0x29f6('0x15')](function(){return _0x373cf6;});}else{return _0x373cf6;}})[_0x29f6('0x1f')](function(_0x4273a3){logger[_0x29f6('0x1b')]('Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s',_0x4273a3);throw _0x4273a3;});}return _0x373cf6;})[_0x29f6('0x15')](respondWithResult(_0x536b0c,0xc9))['catch'](handleError(_0x536b0c,null));};exports['update']=function(_0x4f9907,_0x842ae3,_0x5bcf90){var _0x425da2;return db[_0x29f6('0x4b')][_0x29f6('0x51')]({'where':{'id':_0x4f9907[_0x29f6('0x4f')]['id']}})[_0x29f6('0x15')](handleEntityNotFound(_0x842ae3,null))[_0x29f6('0x15')](saveUpdates(_0x4f9907[_0x29f6('0x55')],null))['then'](function(_0x3a23f3){if(_0x3a23f3){_0x425da2=_0x3a23f3;return db['Trunk'][_0x29f6('0x4c')]({'raw':!![]});}})[_0x29f6('0x15')](function(_0x32fa77){if(_0x32fa77){var _0x1d6e32=fs[_0x29f6('0x5f')](path[_0x29f6('0x5b')](config[_0x29f6('0x5c')],_0x29f6('0x5d')),_0x29f6('0x5e'));var _0xe14459=fs[_0x29f6('0x5f')](path[_0x29f6('0x5b')](config['root'],'server/files/templates/registry.ejs'),'utf8');var _0xa31c7d=ejs[_0x29f6('0x66')](_0x1d6e32,{'trunks':_0x32fa77||[]});fs['writeFileSync'](_0x29f6('0x67'),_0xa31c7d);var _0x57b9fb=ejs[_0x29f6('0x66')](_0xe14459,{'trunks':_0x32fa77||[]});fs[_0x29f6('0x60')](_0x29f6('0x62'),_0x57b9fb);return respondWithRpcPromise(_0x29f6('0x68'),_0x29f6('0x2a'),{'module':_0x29f6('0x63')});}return null;})[_0x29f6('0x15')](function(_0x4203f1){if(_0x4203f1){return _0x425da2;}})[_0x29f6('0x15')](respondWithResult(_0x842ae3,null))[_0x29f6('0x1f')](handleError(_0x842ae3,null));};exports['destroy']=function(_0x1d61ff,_0x4c0acc,_0x16bb3c){var _0x144d8c;return db[_0x29f6('0x4b')][_0x29f6('0x51')]({'where':{'id':_0x1d61ff[_0x29f6('0x4f')]['id']}})[_0x29f6('0x15')](handleEntityNotFound(_0x4c0acc,null))[_0x29f6('0x15')](removeEntity(_0x4c0acc,null))[_0x29f6('0x15')](function(){return db['Trunk'][_0x29f6('0x4c')]({'raw':!![]});})[_0x29f6('0x15')](function(_0x4e185f){var _0x4bb53f=fs[_0x29f6('0x5f')](path[_0x29f6('0x5b')](config[_0x29f6('0x5c')],_0x29f6('0x5d')),_0x29f6('0x5e'));var _0x906098=fs[_0x29f6('0x5f')](path[_0x29f6('0x5b')](config[_0x29f6('0x5c')],_0x29f6('0x69')),_0x29f6('0x5e'));var _0x3f51fa=ejs['render'](_0x4bb53f,{'trunks':_0x4e185f});var _0x4b9631=ejs[_0x29f6('0x66')](_0x906098,{'trunks':_0x4e185f});fs[_0x29f6('0x60')]('/etc/asterisk/sip_xcally_trunks.conf',_0x3f51fa);fs[_0x29f6('0x60')](_0x29f6('0x62'),_0x4b9631);return respondWithRpcPromise(_0x29f6('0x68'),_0x29f6('0x2b'),{'module':_0x29f6('0x63')});})[_0x29f6('0x1f')](handleError(_0x4c0acc,null));}; \ No newline at end of file diff --git a/server/api/trunk/trunk.model.js b/server/api/trunk/trunk.model.js index 9bd523a..40246c8 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 _0x679b=['rimraf','./trunk.attributes','exports','Trunk','tools_trunks','lodash','../../config/logger','api','moment','bluebird','request-promise','path'];(function(_0x19e67d,_0x2fdc51){var _0x56ecb7=function(_0xe8a1e5){while(--_0xe8a1e5){_0x19e67d['push'](_0x19e67d['shift']());}};_0x56ecb7(++_0x2fdc51);}(_0x679b,0x125));var _0xb679=function(_0x15ddaa,_0x57d81c){_0x15ddaa=_0x15ddaa-0x0;var _0x1d3d88=_0x679b[_0x15ddaa];return _0x1d3d88;};'use strict';var _=require(_0xb679('0x0'));var util=require('util');var logger=require(_0xb679('0x1'))(_0xb679('0x2'));var moment=require(_0xb679('0x3'));var BPromise=require(_0xb679('0x4'));var rp=require(_0xb679('0x5'));var fs=require('fs');var path=require(_0xb679('0x6'));var rimraf=require(_0xb679('0x7'));var config=require('../../config/environment');var attributes=require(_0xb679('0x8'));module[_0xb679('0x9')]=function(_0x367524,_0x337dd8){return _0x367524['define'](_0xb679('0xa'),attributes,{'tableName':_0xb679('0xb'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x42f5=['exports','tools_trunks','lodash','util','moment','bluebird','request-promise','path','../../config/environment'];(function(_0x5f09c5,_0x2bfca0){var _0x426ad9=function(_0x18fe5f){while(--_0x18fe5f){_0x5f09c5['push'](_0x5f09c5['shift']());}};_0x426ad9(++_0x2bfca0);}(_0x42f5,0xe3));var _0x542f=function(_0x5f0089,_0x227e2c){_0x5f0089=_0x5f0089-0x0;var _0x193892=_0x42f5[_0x5f0089];return _0x193892;};'use strict';var _=require(_0x542f('0x0'));var util=require(_0x542f('0x1'));var logger=require('../../config/logger')('api');var moment=require(_0x542f('0x2'));var BPromise=require(_0x542f('0x3'));var rp=require(_0x542f('0x4'));var fs=require('fs');var path=require(_0x542f('0x5'));var rimraf=require('rimraf');var config=require(_0x542f('0x6'));var attributes=require('./trunk.attributes');module[_0x542f('0x7')]=function(_0x280e5b,_0x332392){return _0x280e5b['define']('Trunk',attributes,{'tableName':_0x542f('0x8'),'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 5789a2e..7164aca 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 _0x161b=['rpc','jayson/promise','request','then','info','Trunk,\x20%s,\x20%s','request\x20sent','debug','stringify','error','message','result','catch','Trunk','findAll','options','where','attributes','limit','include','map','model','GetTrunk','ShowTrunk','find','raw','lodash','moment','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger'];(function(_0x3794a0,_0x1a9cfc){var _0x5bdaba=function(_0x14a764){while(--_0x14a764){_0x3794a0['push'](_0x3794a0['shift']());}};_0x5bdaba(++_0x1a9cfc);}(_0x161b,0x101));var _0xb161=function(_0x39d218,_0x495f86){_0x39d218=_0x39d218-0x0;var _0x23811f=_0x161b[_0x39d218];return _0x23811f;};'use strict';var _=require(_0xb161('0x0'));var util=require('util');var moment=require(_0xb161('0x1'));var BPromise=require('bluebird');var rs=require(_0xb161('0x2'));var fs=require('fs');var Redis=require(_0xb161('0x3'));var db=require(_0xb161('0x4'))['db'];var utils=require(_0xb161('0x5'));var logger=require(_0xb161('0x6'))(_0xb161('0x7'));var config=require('../../config/environment');var jayson=require(_0xb161('0x8'));var client=jayson['client']['http']({'port':0x232a});function respondWithRpcPromise(_0x491b90,_0x1cfd32,_0xe314a4){return new BPromise(function(_0x50b0e4,_0x300595){return client[_0xb161('0x9')](_0x491b90,_0xe314a4)[_0xb161('0xa')](function(_0x3036ce){logger[_0xb161('0xb')](_0xb161('0xc'),_0x1cfd32,_0xb161('0xd'));logger[_0xb161('0xe')]('Trunk,\x20%s,\x20%s,\x20%s',_0x1cfd32,'request\x20sent',JSON[_0xb161('0xf')](_0x3036ce));if(_0x3036ce[_0xb161('0x10')]){if(_0x3036ce[_0xb161('0x10')]['code']===0x1f4){logger['error']('Trunk,\x20%s,\x20%s',_0x1cfd32,_0x3036ce[_0xb161('0x10')][_0xb161('0x11')]);return _0x300595(_0x3036ce[_0xb161('0x10')]['message']);}logger[_0xb161('0x10')](_0xb161('0xc'),_0x1cfd32,_0x3036ce[_0xb161('0x10')]['message']);return _0x50b0e4(_0x3036ce[_0xb161('0x10')][_0xb161('0x11')]);}else{logger[_0xb161('0xb')](_0xb161('0xc'),_0x1cfd32,'request\x20sent');_0x50b0e4(_0x3036ce[_0xb161('0x12')][_0xb161('0x11')]);}})[_0xb161('0x13')](function(_0x11a8ce){logger[_0xb161('0x10')]('Trunk,\x20%s,\x20%s',_0x1cfd32,_0x11a8ce);_0x300595(_0x11a8ce);});});}exports['GetTrunk']=function(_0x58e08c){var _0x38de0d=this;return new Promise(function(_0x32e06f,_0xc5eff4){return db[_0xb161('0x14')][_0xb161('0x15')]({'raw':_0x58e08c['options']?_0x58e08c[_0xb161('0x16')]['raw']===undefined?!![]:![]:!![],'where':_0x58e08c[_0xb161('0x16')]?_0x58e08c[_0xb161('0x16')][_0xb161('0x17')]||null:null,'attributes':_0x58e08c[_0xb161('0x16')]?_0x58e08c['options'][_0xb161('0x18')]||null:null,'limit':_0x58e08c[_0xb161('0x16')]?_0x58e08c[_0xb161('0x16')][_0xb161('0x19')]||null:null,'include':_0x58e08c['options']?_0x58e08c['options'][_0xb161('0x1a')]?_[_0xb161('0x1b')](_0x58e08c[_0xb161('0x16')][_0xb161('0x1a')],function(_0x31e62a){return{'model':db[_0x31e62a[_0xb161('0x1c')]],'as':_0x31e62a['as'],'attributes':_0x31e62a[_0xb161('0x18')],'include':_0x31e62a[_0xb161('0x1a')]?_['map'](_0x31e62a[_0xb161('0x1a')],function(_0x39a541){return{'model':db[_0x39a541['model']],'as':_0x39a541['as'],'attributes':_0x39a541['attributes'],'include':_0x39a541[_0xb161('0x1a')]?_[_0xb161('0x1b')](_0x39a541[_0xb161('0x1a')],function(_0x298a18){return{'model':db[_0x298a18[_0xb161('0x1c')]],'as':_0x298a18['as'],'attributes':_0x298a18['attributes']};}):[]};}):[]};}):[]:[]})['then'](function(_0x2d49b4){logger[_0xb161('0xb')]('GetTrunk',_0x58e08c);logger[_0xb161('0xe')](_0xb161('0x1d'),_0x58e08c,JSON[_0xb161('0xf')](_0x2d49b4));_0x32e06f(_0x2d49b4);})[_0xb161('0x13')](function(_0x3893aa){logger['error'](_0xb161('0x1d'),_0x3893aa[_0xb161('0x11')],_0x58e08c);_0xc5eff4(_0x38de0d['error'](0x1f4,_0x3893aa[_0xb161('0x11')]));});});};exports[_0xb161('0x1e')]=function(_0x334712){var _0x31dc25=this;return new Promise(function(_0x326e1e,_0x1db6ab){return db[_0xb161('0x14')][_0xb161('0x1f')]({'raw':_0x334712[_0xb161('0x16')]?_0x334712[_0xb161('0x16')][_0xb161('0x20')]===undefined?!![]:![]:!![],'where':_0x334712[_0xb161('0x16')]?_0x334712['options']['where']||null:null,'attributes':_0x334712[_0xb161('0x16')]?_0x334712[_0xb161('0x16')][_0xb161('0x18')]||null:null,'include':_0x334712[_0xb161('0x16')]?_0x334712[_0xb161('0x16')]['include']?_[_0xb161('0x1b')](_0x334712[_0xb161('0x16')]['include'],function(_0x125f29){return{'model':db[_0x125f29[_0xb161('0x1c')]],'as':_0x125f29['as'],'attributes':_0x125f29['attributes'],'include':_0x125f29[_0xb161('0x1a')]?_['map'](_0x125f29['include'],function(_0x2ddc06){return{'model':db[_0x2ddc06['model']],'as':_0x2ddc06['as'],'attributes':_0x2ddc06[_0xb161('0x18')],'include':_0x2ddc06[_0xb161('0x1a')]?_['map'](_0x2ddc06[_0xb161('0x1a')],function(_0x5db57e){return{'model':db[_0x5db57e[_0xb161('0x1c')]],'as':_0x5db57e['as'],'attributes':_0x5db57e[_0xb161('0x18')]};}):[]};}):[]};}):[]:[]})['then'](function(_0x2de54f){logger[_0xb161('0xb')](_0xb161('0x1e'),_0x334712);logger[_0xb161('0xe')]('ShowTrunk',_0x334712,JSON[_0xb161('0xf')](_0x2de54f));_0x326e1e(_0x2de54f);})['catch'](function(_0x1f1636){logger['error']('ShowTrunk',_0x1f1636[_0xb161('0x11')],_0x334712);_0x1db6ab(_0x31dc25[_0xb161('0x10')](0x1f4,_0x1f1636[_0xb161('0x11')]));});});}; \ No newline at end of file +var _0x3db6=['map','model','ShowTrunk','util','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/logger','../../config/environment','jayson/promise','client','request','then','Trunk,\x20%s,\x20%s','request\x20sent','debug','Trunk,\x20%s,\x20%s,\x20%s','stringify','error','code','message','info','result','catch','GetTrunk','Trunk','options','raw','where','attributes','limit','include'];(function(_0xb719cf,_0x3c342b){var _0x3e060f=function(_0x5e2e72){while(--_0x5e2e72){_0xb719cf['push'](_0xb719cf['shift']());}};_0x3e060f(++_0x3c342b);}(_0x3db6,0x113));var _0x63db=function(_0xcbaf10,_0x2a9b7f){_0xcbaf10=_0xcbaf10-0x0;var _0x1e4051=_0x3db6[_0xcbaf10];return _0x1e4051;};'use strict';var _=require('lodash');var util=require(_0x63db('0x0'));var moment=require(_0x63db('0x1'));var BPromise=require(_0x63db('0x2'));var rs=require(_0x63db('0x3'));var fs=require('fs');var Redis=require(_0x63db('0x4'));var db=require(_0x63db('0x5'))['db'];var utils=require('../../config/utils');var logger=require(_0x63db('0x6'))('rpc');var config=require(_0x63db('0x7'));var jayson=require(_0x63db('0x8'));var client=jayson[_0x63db('0x9')]['http']({'port':0x232a});function respondWithRpcPromise(_0x4b5983,_0x23b3f4,_0x4b4a13){return new BPromise(function(_0x28944d,_0x3ab3e4){return client[_0x63db('0xa')](_0x4b5983,_0x4b4a13)[_0x63db('0xb')](function(_0x241ce2){logger['info'](_0x63db('0xc'),_0x23b3f4,_0x63db('0xd'));logger[_0x63db('0xe')](_0x63db('0xf'),_0x23b3f4,'request\x20sent',JSON[_0x63db('0x10')](_0x241ce2));if(_0x241ce2[_0x63db('0x11')]){if(_0x241ce2[_0x63db('0x11')][_0x63db('0x12')]===0x1f4){logger[_0x63db('0x11')](_0x63db('0xc'),_0x23b3f4,_0x241ce2[_0x63db('0x11')][_0x63db('0x13')]);return _0x3ab3e4(_0x241ce2[_0x63db('0x11')][_0x63db('0x13')]);}logger[_0x63db('0x11')](_0x63db('0xc'),_0x23b3f4,_0x241ce2[_0x63db('0x11')]['message']);return _0x28944d(_0x241ce2['error'][_0x63db('0x13')]);}else{logger[_0x63db('0x14')](_0x63db('0xc'),_0x23b3f4,_0x63db('0xd'));_0x28944d(_0x241ce2[_0x63db('0x15')][_0x63db('0x13')]);}})[_0x63db('0x16')](function(_0x5c48b9){logger[_0x63db('0x11')](_0x63db('0xc'),_0x23b3f4,_0x5c48b9);_0x3ab3e4(_0x5c48b9);});});}exports[_0x63db('0x17')]=function(_0x25ed9e){var _0xefbebc=this;return new Promise(function(_0x523f67,_0x3adc3d){return db[_0x63db('0x18')]['findAll']({'raw':_0x25ed9e[_0x63db('0x19')]?_0x25ed9e[_0x63db('0x19')][_0x63db('0x1a')]===undefined?!![]:![]:!![],'where':_0x25ed9e[_0x63db('0x19')]?_0x25ed9e[_0x63db('0x19')][_0x63db('0x1b')]||null:null,'attributes':_0x25ed9e[_0x63db('0x19')]?_0x25ed9e[_0x63db('0x19')][_0x63db('0x1c')]||null:null,'limit':_0x25ed9e[_0x63db('0x19')]?_0x25ed9e[_0x63db('0x19')][_0x63db('0x1d')]||null:null,'include':_0x25ed9e['options']?_0x25ed9e[_0x63db('0x19')][_0x63db('0x1e')]?_[_0x63db('0x1f')](_0x25ed9e['options'][_0x63db('0x1e')],function(_0x499f38){return{'model':db[_0x499f38['model']],'as':_0x499f38['as'],'attributes':_0x499f38[_0x63db('0x1c')],'include':_0x499f38[_0x63db('0x1e')]?_[_0x63db('0x1f')](_0x499f38['include'],function(_0x3d4965){return{'model':db[_0x3d4965[_0x63db('0x20')]],'as':_0x3d4965['as'],'attributes':_0x3d4965['attributes'],'include':_0x3d4965[_0x63db('0x1e')]?_['map'](_0x3d4965['include'],function(_0x467d43){return{'model':db[_0x467d43[_0x63db('0x20')]],'as':_0x467d43['as'],'attributes':_0x467d43['attributes']};}):[]};}):[]};}):[]:[]})['then'](function(_0x1ec8d0){logger[_0x63db('0x14')](_0x63db('0x17'),_0x25ed9e);logger[_0x63db('0xe')](_0x63db('0x17'),_0x25ed9e,JSON[_0x63db('0x10')](_0x1ec8d0));_0x523f67(_0x1ec8d0);})[_0x63db('0x16')](function(_0x47bd91){logger[_0x63db('0x11')](_0x63db('0x17'),_0x47bd91[_0x63db('0x13')],_0x25ed9e);_0x3adc3d(_0xefbebc['error'](0x1f4,_0x47bd91['message']));});});};exports[_0x63db('0x21')]=function(_0x558657){var _0x46cadb=this;return new Promise(function(_0x501b99,_0x16e5ee){return db[_0x63db('0x18')]['find']({'raw':_0x558657[_0x63db('0x19')]?_0x558657[_0x63db('0x19')][_0x63db('0x1a')]===undefined?!![]:![]:!![],'where':_0x558657[_0x63db('0x19')]?_0x558657[_0x63db('0x19')][_0x63db('0x1b')]||null:null,'attributes':_0x558657[_0x63db('0x19')]?_0x558657[_0x63db('0x19')][_0x63db('0x1c')]||null:null,'include':_0x558657['options']?_0x558657['options'][_0x63db('0x1e')]?_[_0x63db('0x1f')](_0x558657[_0x63db('0x19')][_0x63db('0x1e')],function(_0x2f9a82){return{'model':db[_0x2f9a82[_0x63db('0x20')]],'as':_0x2f9a82['as'],'attributes':_0x2f9a82['attributes'],'include':_0x2f9a82[_0x63db('0x1e')]?_[_0x63db('0x1f')](_0x2f9a82[_0x63db('0x1e')],function(_0x2d99c2){return{'model':db[_0x2d99c2[_0x63db('0x20')]],'as':_0x2d99c2['as'],'attributes':_0x2d99c2['attributes'],'include':_0x2d99c2[_0x63db('0x1e')]?_[_0x63db('0x1f')](_0x2d99c2[_0x63db('0x1e')],function(_0x4c2a4d){return{'model':db[_0x4c2a4d['model']],'as':_0x4c2a4d['as'],'attributes':_0x4c2a4d[_0x63db('0x1c')]};}):[]};}):[]};}):[]:[]})[_0x63db('0xb')](function(_0x3911a2){logger[_0x63db('0x14')](_0x63db('0x21'),_0x558657);logger['debug']('ShowTrunk',_0x558657,JSON[_0x63db('0x10')](_0x3911a2));_0x501b99(_0x3911a2);})['catch'](function(_0x131574){logger[_0x63db('0x11')](_0x63db('0x21'),_0x131574[_0x63db('0x13')],_0x558657);_0x16e5ee(_0x46cadb[_0x63db('0x11')](0x1f4,_0x131574[_0x63db('0x13')]));});});}; \ No newline at end of file diff --git a/server/api/user-setting/index.js b/server/api/user-setting/index.js index 34c0b6a..a405fd4 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 _0x59bb=['express','Router','./user-setting.controller','/:id','isAuthenticated','update'];(function(_0x1f986a,_0x2e4562){var _0x323dbe=function(_0x1c4a96){while(--_0x1c4a96){_0x1f986a['push'](_0x1f986a['shift']());}};_0x323dbe(++_0x2e4562);}(_0x59bb,0x19e));var _0xb59b=function(_0x2f5ac5,_0x1ee939){_0x2f5ac5=_0x2f5ac5-0x0;var _0x37c9a8=_0x59bb[_0x2f5ac5];return _0x37c9a8;};'use strict';var express=require(_0xb59b('0x0'));var router=express[_0xb59b('0x1')]();var auth=require('../../components/auth/service');var controller=require(_0xb59b('0x2'));router['put'](_0xb59b('0x3'),auth[_0xb59b('0x4')](),controller[_0xb59b('0x5')]);module['exports']=router; \ No newline at end of file +var _0x274c=['isAuthenticated','exports','Router','../../components/auth/service','./user-setting.controller','/:id'];(function(_0x525af9,_0x4edd23){var _0x129fbf=function(_0x4f44fe){while(--_0x4f44fe){_0x525af9['push'](_0x525af9['shift']());}};_0x129fbf(++_0x4edd23);}(_0x274c,0xfe));var _0xc274=function(_0x4c0155,_0x5b20db){_0x4c0155=_0x4c0155-0x0;var _0x1276db=_0x274c[_0x4c0155];return _0x1276db;};'use strict';var express=require('express');var router=express[_0xc274('0x0')]();var auth=require(_0xc274('0x1'));var controller=require(_0xc274('0x2'));router['put'](_0xc274('0x3'),auth[_0xc274('0x4')](),controller['update']);module[_0xc274('0x5')]=router; \ No newline at end of file diff --git a/server/api/user-setting/user-setting.attributes.js b/server/api/user-setting/user-setting.attributes.js index 44c03df..1d0889a 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 _0x30d1=['TEXT','DATE','INTEGER','UserId','sequelize','error','exports'];(function(_0x2b4411,_0x2625ed){var _0x8e41ef=function(_0x2aa8c1){while(--_0x2aa8c1){_0x2b4411['push'](_0x2b4411['shift']());}};_0x8e41ef(++_0x2625ed);}(_0x30d1,0x138));var _0x130d=function(_0x467488,_0x38c7ae){_0x467488=_0x467488-0x0;var _0x56107f=_0x30d1[_0x467488];return _0x56107f;};'use strict';var Sequelize=require(_0x130d('0x0'));const CLIENT_SIDE_LOG_LEVELS=[_0x130d('0x1'),'warning','info','debug'];module[_0x130d('0x2')]={'clientSideLoggingLevel':{'type':Sequelize['ENUM'](CLIENT_SIDE_LOG_LEVELS),'allowNull':![],'defaultValue':_0x130d('0x1'),'validate':{'isIn':[CLIENT_SIDE_LOG_LEVELS]}},'clientSideLoggingEnabled':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'clientSideLoggingScopes':{'type':Sequelize[_0x130d('0x3')],'allowNull':!![]},'clientSideLoggingEnabledSince':{'type':Sequelize[_0x130d('0x4')],'allowNull':!![],'defaultValue':null},'UserId':{'type':Sequelize[_0x130d('0x5')],'unique':_0x130d('0x6')}}; \ No newline at end of file +var _0x11e2=['UserId','error','warning','info','debug','exports','ENUM','BOOLEAN','TEXT','INTEGER'];(function(_0x48e1ec,_0x35f468){var _0x3b33eb=function(_0x507bf9){while(--_0x507bf9){_0x48e1ec['push'](_0x48e1ec['shift']());}};_0x3b33eb(++_0x35f468);}(_0x11e2,0x15f));var _0x211e=function(_0x2f5ac5,_0x1ee939){_0x2f5ac5=_0x2f5ac5-0x0;var _0x37c9a8=_0x11e2[_0x2f5ac5];return _0x37c9a8;};'use strict';var Sequelize=require('sequelize');const CLIENT_SIDE_LOG_LEVELS=[_0x211e('0x0'),_0x211e('0x1'),_0x211e('0x2'),_0x211e('0x3')];module[_0x211e('0x4')]={'clientSideLoggingLevel':{'type':Sequelize[_0x211e('0x5')](CLIENT_SIDE_LOG_LEVELS),'allowNull':![],'defaultValue':'error','validate':{'isIn':[CLIENT_SIDE_LOG_LEVELS]}},'clientSideLoggingEnabled':{'type':Sequelize[_0x211e('0x6')],'defaultValue':![]},'clientSideLoggingScopes':{'type':Sequelize[_0x211e('0x7')],'allowNull':!![]},'clientSideLoggingEnabledSince':{'type':Sequelize['DATE'],'allowNull':!![],'defaultValue':null},'UserId':{'type':Sequelize[_0x211e('0x8')],'unique':_0x211e('0x9')}}; \ No newline at end of file diff --git a/server/api/user-setting/user-setting.controller.js b/server/api/user-setting/user-setting.controller.js index 984d3b8..ff12732 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 _0x2e31=['lodash','ioredis','../../config/logger','../../config/environment','../../mysqldb','./user-setting.socket','register','redis','localhost','status','json','update','then','sendStatus','error','stack','name','send','user','role','admin','params','Invalid\x20user\x20setting\x20id','body','catch'];(function(_0x114587,_0x4a45ef){var _0xe32b8d=function(_0x3ca1a1){while(--_0x3ca1a1){_0x114587['push'](_0x114587['shift']());}};_0xe32b8d(++_0x4a45ef);}(_0x2e31,0x145));var _0x12e3=function(_0x2abf7f,_0xd44770){_0x2abf7f=_0x2abf7f-0x0;var _0x5f39c0=_0x2e31[_0x2abf7f];return _0x5f39c0;};'use strict';var _=require(_0x12e3('0x0'));var Redis=require(_0x12e3('0x1'));var logger=require(_0x12e3('0x2'))('api');var config=require(_0x12e3('0x3'));var db=require(_0x12e3('0x4'))['db'];var socket=require('socket.io-emitter')(new Redis(config['redis']));require(_0x12e3('0x5'))[_0x12e3('0x6')](socket);config[_0x12e3('0x7')]=_['defaults'](config[_0x12e3('0x7')],{'host':_0x12e3('0x8'),'port':0x18eb});function respondWithResult(_0x5aefcf,_0x5f056f){_0x5f056f=_0x5f056f||0xc8;return function(_0x37f287){if(_0x37f287){return _0x5aefcf[_0x12e3('0x9')](_0x5f056f)[_0x12e3('0xa')](_0x37f287);}};}function saveUpdates(_0x33f3a2){return function(_0x493e52){if(_0x493e52){return _0x493e52[_0x12e3('0xb')](_0x33f3a2)[_0x12e3('0xc')](function(_0x40bf58){return _0x40bf58;});}return null;};}function handleEntityNotFound(_0x5208d6){return function(_0x5901b3){if(!_0x5901b3){_0x5208d6[_0x12e3('0xd')](0x194);}return _0x5901b3;};}function handleError(_0x55bb88,_0x12acc8){_0x12acc8=_0x12acc8||0x1f4;return function(_0x3d6c3c){logger[_0x12e3('0xe')](_0x3d6c3c[_0x12e3('0xf')]);if(_0x3d6c3c[_0x12e3('0x10')]){delete _0x3d6c3c[_0x12e3('0x10')];}_0x55bb88[_0x12e3('0x9')](_0x12acc8)[_0x12e3('0x11')](_0x3d6c3c);};}exports[_0x12e3('0xb')]=function(_0x4320d3,_0x5a18bb){if(_0x4320d3[_0x12e3('0x12')][_0x12e3('0x13')]!==_0x12e3('0x14'))throw new Error('Unauthorized');if(isNaN(Number(_0x4320d3[_0x12e3('0x15')]['id'])))throw new Error(_0x12e3('0x16'));return db['UserSetting']['find']({'where':{'id':_0x4320d3['params']['id']}})[_0x12e3('0xc')](handleEntityNotFound(_0x5a18bb,null))['then'](saveUpdates(_0x4320d3[_0x12e3('0x17')],null))[_0x12e3('0xc')](respondWithResult(_0x5a18bb,null))[_0x12e3('0x18')](handleError(_0x5a18bb,null));}; \ No newline at end of file +var _0x502a=['lodash','ioredis','api','../../config/environment','redis','register','defaults','localhost','then','sendStatus','error','stack','name','status','update','role','admin','Unauthorized','Invalid\x20user\x20setting\x20id','UserSetting','find','params','body','catch'];(function(_0x1facfa,_0x1acf7d){var _0x9ec701=function(_0x115e37){while(--_0x115e37){_0x1facfa['push'](_0x1facfa['shift']());}};_0x9ec701(++_0x1acf7d);}(_0x502a,0xd8));var _0xa502=function(_0x4a0fee,_0x4db798){_0x4a0fee=_0x4a0fee-0x0;var _0x1f5248=_0x502a[_0x4a0fee];return _0x1f5248;};'use strict';var _=require(_0xa502('0x0'));var Redis=require(_0xa502('0x1'));var logger=require('../../config/logger')(_0xa502('0x2'));var config=require(_0xa502('0x3'));var db=require('../../mysqldb')['db'];var socket=require('socket.io-emitter')(new Redis(config[_0xa502('0x4')]));require('./user-setting.socket')[_0xa502('0x5')](socket);config[_0xa502('0x4')]=_[_0xa502('0x6')](config[_0xa502('0x4')],{'host':_0xa502('0x7'),'port':0x18eb});function respondWithResult(_0x489407,_0x329022){_0x329022=_0x329022||0xc8;return function(_0x29fb03){if(_0x29fb03){return _0x489407['status'](_0x329022)['json'](_0x29fb03);}};}function saveUpdates(_0x13e991){return function(_0x25c147){if(_0x25c147){return _0x25c147['update'](_0x13e991)[_0xa502('0x8')](function(_0x12fb93){return _0x12fb93;});}return null;};}function handleEntityNotFound(_0x385980){return function(_0x50a924){if(!_0x50a924){_0x385980[_0xa502('0x9')](0x194);}return _0x50a924;};}function handleError(_0x9f2ebd,_0x1c2688){_0x1c2688=_0x1c2688||0x1f4;return function(_0x4e37b7){logger[_0xa502('0xa')](_0x4e37b7[_0xa502('0xb')]);if(_0x4e37b7['name']){delete _0x4e37b7[_0xa502('0xc')];}_0x9f2ebd[_0xa502('0xd')](_0x1c2688)['send'](_0x4e37b7);};}exports[_0xa502('0xe')]=function(_0x91d9e2,_0x25ed69){if(_0x91d9e2['user'][_0xa502('0xf')]!==_0xa502('0x10'))throw new Error(_0xa502('0x11'));if(isNaN(Number(_0x91d9e2['params']['id'])))throw new Error(_0xa502('0x12'));return db[_0xa502('0x13')][_0xa502('0x14')]({'where':{'id':_0x91d9e2[_0xa502('0x15')]['id']}})[_0xa502('0x8')](handleEntityNotFound(_0x25ed69,null))[_0xa502('0x8')](saveUpdates(_0x91d9e2[_0xa502('0x16')],null))[_0xa502('0x8')](respondWithResult(_0x25ed69,null))[_0xa502('0x17')](handleError(_0x25ed69,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 7bbf889..a6dbe25 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 _0x9e4b=['remove','emit','hasOwnProperty','hook','setMaxListeners','save','update'];(function(_0x43d11d,_0xccff91){var _0x38cd08=function(_0x131ae2){while(--_0x131ae2){_0x43d11d['push'](_0x43d11d['shift']());}};_0x38cd08(++_0xccff91);}(_0x9e4b,0x1d9));var _0xb9e4=function(_0x2cc437,_0x1b4c3f){_0x2cc437=_0x2cc437-0x0;var _0x2e163a=_0x9e4b[_0x2cc437];return _0x2e163a;};'use strict';var EventEmitter=require('events');var UserSetting=require('../../mysqldb')['db']['UserSetting'];var UserSettingEvents=new EventEmitter();UserSettingEvents[_0xb9e4('0x0')](0x0);var events={'afterCreate':_0xb9e4('0x1'),'afterUpdate':_0xb9e4('0x2'),'afterDestroy':_0xb9e4('0x3')};function emitEvent(_0x1c95c1){return function(_0x2b82a8,_0xd4546f,_0x4e45f0){UserSettingEvents[_0xb9e4('0x4')](_0x1c95c1+':'+_0x2b82a8['id'],_0x2b82a8);UserSettingEvents['emit'](_0x1c95c1,_0x2b82a8);_0x4e45f0(null);};}for(var e in events){if(events[_0xb9e4('0x5')](e)){var event=events[e];UserSetting[_0xb9e4('0x6')](e,emitEvent(event));}}module['exports']=UserSettingEvents; \ No newline at end of file +var _0x91f8=['hook','exports','events','../../mysqldb','UserSetting','setMaxListeners','update','remove','emit','hasOwnProperty'];(function(_0x1e5486,_0x3a73f2){var _0x57a399=function(_0x314f92){while(--_0x314f92){_0x1e5486['push'](_0x1e5486['shift']());}};_0x57a399(++_0x3a73f2);}(_0x91f8,0x188));var _0x891f=function(_0x3ee7e2,_0x15cf09){_0x3ee7e2=_0x3ee7e2-0x0;var _0x1c1f18=_0x91f8[_0x3ee7e2];return _0x1c1f18;};'use strict';var EventEmitter=require(_0x891f('0x0'));var UserSetting=require(_0x891f('0x1'))['db'][_0x891f('0x2')];var UserSettingEvents=new EventEmitter();UserSettingEvents[_0x891f('0x3')](0x0);var events={'afterCreate':'save','afterUpdate':_0x891f('0x4'),'afterDestroy':_0x891f('0x5')};function emitEvent(_0x24b067){return function(_0x169411,_0x5258c0,_0x46a3e1){UserSettingEvents[_0x891f('0x6')](_0x24b067+':'+_0x169411['id'],_0x169411);UserSettingEvents[_0x891f('0x6')](_0x24b067,_0x169411);_0x46a3e1(null);};}for(var e in events){if(events[_0x891f('0x7')](e)){var event=events[e];UserSetting[_0x891f('0x8')](e,emitEvent(event));}}module[_0x891f('0x9')]=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 fbdda51..d2fa114 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 _0xb84e=['clientSideLoggingEnabledSince','exports','define','UserSetting','clientSideLoggingEnabled'];(function(_0x4f83b9,_0x4554fa){var _0x2387ef=function(_0x2ae04f){while(--_0x2ae04f){_0x4f83b9['push'](_0x4f83b9['shift']());}};_0x2387ef(++_0x4554fa);}(_0xb84e,0xbf));var _0xeb84=function(_0x425716,_0x3e9d1c){_0x425716=_0x425716-0x0;var _0x2d39af=_0xb84e[_0x425716];return _0x2d39af;};'use strict';var attributes=require('./user-setting.attributes');module[_0xeb84('0x0')]=function(_0x6bfa05){return _0x6bfa05[_0xeb84('0x1')](_0xeb84('0x2'),attributes,{'tableName':'user_settings','paranoid':![],'indexes':[],'timestamps':!![],'hooks':{'beforeUpdate':function(_0x512746){if(!_0x512746[_0xeb84('0x3')])_0x512746[_0xeb84('0x4')]=null;else if(_0x512746[_0xeb84('0x4')]===null)_0x512746[_0xeb84('0x4')]=new Date();}}});}; \ No newline at end of file +var _0x4d46=['clientSideLoggingEnabledSince','./user-setting.attributes','exports','define','UserSetting','user_settings','clientSideLoggingEnabled'];(function(_0x1094a7,_0x123a57){var _0xbfcb6d=function(_0x2f4d13){while(--_0x2f4d13){_0x1094a7['push'](_0x1094a7['shift']());}};_0xbfcb6d(++_0x123a57);}(_0x4d46,0x197));var _0x64d4=function(_0x16cdc9,_0x3177bf){_0x16cdc9=_0x16cdc9-0x0;var _0x26a641=_0x4d46[_0x16cdc9];return _0x26a641;};'use strict';var attributes=require(_0x64d4('0x0'));module[_0x64d4('0x1')]=function(_0x74012b){return _0x74012b[_0x64d4('0x2')](_0x64d4('0x3'),attributes,{'tableName':_0x64d4('0x4'),'paranoid':![],'indexes':[],'timestamps':!![],'hooks':{'beforeUpdate':function(_0x51c43f){if(!_0x51c43f[_0x64d4('0x5')])_0x51c43f[_0x64d4('0x6')]=null;else if(_0x51c43f[_0x64d4('0x6')]===null)_0x51c43f[_0x64d4('0x6')]=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 90e10ee..b8d5836 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 _0x2bb3=['user-setting:update:user-','UserId','length','user-setting:','save','remove','update','emit','user-setting:update'];(function(_0x13b50d,_0x10a752){var _0x3179e3=function(_0x28c6af){while(--_0x28c6af){_0x13b50d['push'](_0x13b50d['shift']());}};_0x3179e3(++_0x10a752);}(_0x2bb3,0x1a2));var _0x32bb=function(_0x2a67fe,_0x295c09){_0x2a67fe=_0x2a67fe-0x0;var _0x57e726=_0x2bb3[_0x2a67fe];return _0x57e726;};'use strict';var UserSettingEvents=require('./user-setting.events');var events=[_0x32bb('0x0'),_0x32bb('0x1'),_0x32bb('0x2')];function createListener(_0x4cbfb4,_0xf40e97){return function(_0x1b8e80){_0xf40e97[_0x32bb('0x3')](_0x4cbfb4,_0x1b8e80);if(_0x4cbfb4===_0x32bb('0x4')){_0xf40e97[_0x32bb('0x3')](_0x32bb('0x5')+_0x1b8e80[_0x32bb('0x6')],_0x1b8e80);}};}exports['register']=function(_0x3f2c55){for(var _0x46fb80=0x0,_0xb295c6=events[_0x32bb('0x7')];_0x46fb80<_0xb295c6;_0x46fb80++){var _0x5cbc33=events[_0x46fb80];var _0x35dec2=createListener(_0x32bb('0x8')+_0x5cbc33,_0x3f2c55);UserSettingEvents['on'](_0x5cbc33,_0x35dec2);}}; \ No newline at end of file +var _0xba40=['emit','user-setting:update','user-setting:update:user-','UserId','length','./user-setting.events','remove','update'];(function(_0x4709c0,_0x3396c7){var _0x13348b=function(_0x426235){while(--_0x426235){_0x4709c0['push'](_0x4709c0['shift']());}};_0x13348b(++_0x3396c7);}(_0xba40,0x75));var _0x0ba4=function(_0xb42d77,_0x2ed187){_0xb42d77=_0xb42d77-0x0;var _0x2118df=_0xba40[_0xb42d77];return _0x2118df;};'use strict';var UserSettingEvents=require(_0x0ba4('0x0'));var events=['save',_0x0ba4('0x1'),_0x0ba4('0x2')];function createListener(_0x3a78ff,_0xe4bf52){return function(_0x755375){_0xe4bf52[_0x0ba4('0x3')](_0x3a78ff,_0x755375);if(_0x3a78ff===_0x0ba4('0x4')){_0xe4bf52['emit'](_0x0ba4('0x5')+_0x755375[_0x0ba4('0x6')],_0x755375);}};}exports['register']=function(_0x2544d0){for(var _0x41dfcb=0x0,_0x273782=events[_0x0ba4('0x7')];_0x41dfcb<_0x273782;_0x41dfcb++){var _0x31deb7=events[_0x41dfcb];var _0x361a4b=createListener('user-setting:'+_0x31deb7,_0x2544d0);UserSettingEvents['on'](_0x31deb7,_0x361a4b);}}; \ No newline at end of file diff --git a/server/api/user/index.js b/server/api/user/index.js index 5140f36..2f6a71d 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 _0x5973=['../../components/auth/service','./user.controller','get','index','isAuthenticated','describe','/whoami','whoami','/presence','getPresence','show','/:id/open_tabs','/:id/queues','getVoiceQueuesRt','/:id/groups','getGroups','/:id/recordings','getRecordings','/:id/chat/interactions','getOpenchannelInteractions','getMailInteractions','/:id/sms/interactions','getSmsInteractions','/:id/fax/interactions','getFaxInteractions','/:id/whatsapp/interactions','getWhatsappInteractions','/:id/teams','getTeams','getLists','/:id/agents','/:id/prefixes','getVoicePrefixes','getFaxAccounts','/:id/mail_accounts','getMailAccounts','/:id/openchannel_accounts','/:id/sms_accounts','/:id/whatsapp_accounts','getWhatsappAccounts','getScheduledCalls','/:id/api_key','post','/create_many','bulkCreate','addQueues','diskStorage','join','root','server/files/images/','format','now','originalname','/:id/avatar','file','addAvatar','/:id/login','logout','/:id/unpause','/:id/chat_interactions','/:id/mail_interactions','addMailInteractions','/:id/fax_interactions','addOpenchannelInteractions','/:id/whatsapp_interactions','addWhatsappInteractions','/:id/fax_accounts','addMailAccounts','addOpenchannelAccounts','addSmsAccounts','/:id/chat_websites','addWhatsappAccounts','put','/:id','update','/:id/password','changePassword','delete','removeQueues','removeTeams','destroy','/:id/openchannel_interactions','removeOpenchannelInteractions','removeWhatsappInteractions','removeMailAccounts','removeOpenchannelAccounts','removeSmsAccounts','removeChatWebsites','removeWhatsappAccounts','exports','multer','util','connect-timeout','express','fs-extra'];(function(_0x2d406a,_0x33d1bd){var _0x444798=function(_0x549657){while(--_0x549657){_0x2d406a['push'](_0x2d406a['shift']());}};_0x444798(++_0x33d1bd);}(_0x5973,0xb9));var _0x3597=function(_0x4dce5c,_0x3b7a0a){_0x4dce5c=_0x4dce5c-0x0;var _0x20eece=_0x5973[_0x4dce5c];return _0x20eece;};'use strict';var multer=require(_0x3597('0x0'));var util=require(_0x3597('0x1'));var path=require('path');var timeout=require(_0x3597('0x2'));var express=require(_0x3597('0x3'));var router=express['Router']();var fs_extra=require(_0x3597('0x4'));var auth=require(_0x3597('0x5'));var interaction=require('../../components/interaction/service');var config=require('../../config/environment');var controller=require(_0x3597('0x6'));router[_0x3597('0x7')]('/',auth['isAuthenticated'](),controller[_0x3597('0x8')]);router[_0x3597('0x7')]('/describe',auth[_0x3597('0x9')](),controller[_0x3597('0xa')]);router['get'](_0x3597('0xb'),auth[_0x3597('0x9')](),controller[_0x3597('0xc')]);router['get'](_0x3597('0xd'),auth['isAuthenticated'](),controller[_0x3597('0xe')]);router[_0x3597('0x7')]('/:id',auth[_0x3597('0x9')](),controller[_0x3597('0xf')]);router['get']('/:id/avatar',controller['getAvatar']);router['get'](_0x3597('0x10'),auth[_0x3597('0x9')](),controller['getOpenTabs']);router[_0x3597('0x7')]('/:id/contacts',auth['isAuthenticated'](),controller['getContacts']);router[_0x3597('0x7')](_0x3597('0x11'),auth[_0x3597('0x9')](),controller['getQueues']);router['get']('/:id/queues_rt',auth[_0x3597('0x9')](),controller[_0x3597('0x12')]);router['get'](_0x3597('0x13'),auth[_0x3597('0x9')](),controller[_0x3597('0x14')]);router[_0x3597('0x7')](_0x3597('0x15'),auth['isAuthenticated'](),controller[_0x3597('0x16')]);router['get']('/:id/screen_recordings',auth[_0x3597('0x9')](),controller['getScreenRecordings']);router[_0x3597('0x7')](_0x3597('0x17'),auth[_0x3597('0x9')](),controller['getChatInteractions']);router[_0x3597('0x7')]('/:id/openchannel/interactions',auth[_0x3597('0x9')](),controller[_0x3597('0x18')]);router['get']('/:id/mail/interactions',auth[_0x3597('0x9')](),controller[_0x3597('0x19')]);router['get'](_0x3597('0x1a'),auth['isAuthenticated'](),controller[_0x3597('0x1b')]);router[_0x3597('0x7')](_0x3597('0x1c'),auth[_0x3597('0x9')](),controller[_0x3597('0x1d')]);router['get'](_0x3597('0x1e'),auth[_0x3597('0x9')](),controller[_0x3597('0x1f')]);router[_0x3597('0x7')](_0x3597('0x20'),auth[_0x3597('0x9')](),controller[_0x3597('0x21')]);router[_0x3597('0x7')]('/:id/lists',auth[_0x3597('0x9')](),controller[_0x3597('0x22')]);router['get'](_0x3597('0x23'),auth[_0x3597('0x9')](),controller['getAgents']);router[_0x3597('0x7')](_0x3597('0x24'),auth['isAuthenticated'](),controller[_0x3597('0x25')]);router[_0x3597('0x7')]('/:id/fax_accounts',auth['isAuthenticated'](),controller[_0x3597('0x26')]);router['get'](_0x3597('0x27'),auth[_0x3597('0x9')](),controller[_0x3597('0x28')]);router[_0x3597('0x7')](_0x3597('0x29'),auth[_0x3597('0x9')](),controller['getOpenchannelAccounts']);router[_0x3597('0x7')](_0x3597('0x2a'),auth[_0x3597('0x9')](),controller['getSmsAccounts']);router[_0x3597('0x7')]('/:id/chat_websites',auth[_0x3597('0x9')](),controller['getChatWebsites']);router[_0x3597('0x7')](_0x3597('0x2b'),auth[_0x3597('0x9')](),controller[_0x3597('0x2c')]);router[_0x3597('0x7')]('/:id/scheduled_calls',auth[_0x3597('0x9')](),controller[_0x3597('0x2d')]);router[_0x3597('0x7')](_0x3597('0x2e'),auth[_0x3597('0x9')](),controller['getApiKey']);router[_0x3597('0x2f')]('/:id/contacts',auth[_0x3597('0x9')](),controller['addContacts']);router[_0x3597('0x2f')]('/',auth[_0x3597('0x9')](),controller['create']);router[_0x3597('0x2f')](_0x3597('0x30'),auth['isAuthenticated'](),controller[_0x3597('0x31')]);router[_0x3597('0x2f')](_0x3597('0x11'),auth[_0x3597('0x9')](),controller[_0x3597('0x32')]);var upload=multer({'storage':multer[_0x3597('0x33')]({'destination':function(_0x51514b,_0x86f19c,_0x19b398){_0x19b398(null,path[_0x3597('0x34')](config[_0x3597('0x35')],_0x3597('0x36')));},'filename':function(_0x36bedc,_0xf9010b,_0x274304){_0x274304(null,util[_0x3597('0x37')]('%s-%s',Date[_0x3597('0x38')](),_0xf9010b[_0x3597('0x39')]));}})});router[_0x3597('0x2f')](_0x3597('0x3a'),upload['single'](_0x3597('0x3b')),controller[_0x3597('0x3c')]);router[_0x3597('0x2f')](_0x3597('0x3d'),auth[_0x3597('0x9')](),controller['login']);router['post']('/:id/logout',auth[_0x3597('0x9')](),controller[_0x3597('0x3e')]);router[_0x3597('0x2f')]('/:id/pause',auth['isAuthenticated'](),controller['pause']);router[_0x3597('0x2f')](_0x3597('0x3f'),auth[_0x3597('0x9')](),controller['unpause']);router[_0x3597('0x2f')](_0x3597('0x20'),auth['isAuthenticated'](),controller['addTeams']);router['post'](_0x3597('0x40'),auth[_0x3597('0x9')](),controller['addChatInteractions']);router[_0x3597('0x2f')](_0x3597('0x41'),auth['isAuthenticated'](),controller[_0x3597('0x42')]);router['post'](_0x3597('0x43'),auth[_0x3597('0x9')](),controller['addFaxInteractions']);router[_0x3597('0x2f')]('/:id/sms_interactions',auth[_0x3597('0x9')](),controller['addSmsInteractions']);router[_0x3597('0x2f')]('/:id/openchannel_interactions',auth[_0x3597('0x9')](),controller[_0x3597('0x44')]);router[_0x3597('0x2f')](_0x3597('0x45'),auth[_0x3597('0x9')](),controller[_0x3597('0x46')]);router[_0x3597('0x2f')](_0x3597('0x47'),auth[_0x3597('0x9')](),controller['addFaxAccounts']);router[_0x3597('0x2f')]('/:id/mail_accounts',auth['isAuthenticated'](),controller[_0x3597('0x48')]);router[_0x3597('0x2f')](_0x3597('0x29'),auth['isAuthenticated'](),controller[_0x3597('0x49')]);router[_0x3597('0x2f')](_0x3597('0x2a'),auth[_0x3597('0x9')](),controller[_0x3597('0x4a')]);router[_0x3597('0x2f')](_0x3597('0x4b'),auth['isAuthenticated'](),controller['addChatWebsites']);router['post']('/:id/whatsapp_accounts',auth[_0x3597('0x9')](),controller[_0x3597('0x4c')]);router[_0x3597('0x2f')](_0x3597('0x2e'),auth['isAuthenticated'](),controller['createApiKey']);router[_0x3597('0x4d')](_0x3597('0x4e'),auth[_0x3597('0x9')](),controller[_0x3597('0x4f')]);router['put'](_0x3597('0x50'),auth[_0x3597('0x9')](),controller[_0x3597('0x51')]);router[_0x3597('0x52')](_0x3597('0x11'),auth['isAuthenticated'](),controller[_0x3597('0x53')]);router[_0x3597('0x52')]('/:id/teams',auth['isAuthenticated'](),controller[_0x3597('0x54')]);router[_0x3597('0x52')]('/:id',auth[_0x3597('0x9')](),controller[_0x3597('0x55')]);router[_0x3597('0x52')](_0x3597('0x40'),auth['isAuthenticated'](),controller['removeChatInteractions']);router['delete']('/:id/mail_interactions',auth['isAuthenticated'](),controller['removeMailInteractions']);router[_0x3597('0x52')](_0x3597('0x43'),auth[_0x3597('0x9')](),controller['removeFaxInteractions']);router['delete']('/:id/sms_interactions',auth[_0x3597('0x9')](),controller['removeSmsInteractions']);router[_0x3597('0x52')](_0x3597('0x56'),auth[_0x3597('0x9')](),controller[_0x3597('0x57')]);router[_0x3597('0x52')](_0x3597('0x45'),auth[_0x3597('0x9')](),controller[_0x3597('0x58')]);router[_0x3597('0x52')]('/:id/fax_accounts',auth[_0x3597('0x9')](),controller['removeFaxAccounts']);router[_0x3597('0x52')](_0x3597('0x27'),auth[_0x3597('0x9')](),controller[_0x3597('0x59')]);router['delete'](_0x3597('0x29'),auth[_0x3597('0x9')](),controller[_0x3597('0x5a')]);router[_0x3597('0x52')](_0x3597('0x2a'),auth[_0x3597('0x9')](),controller[_0x3597('0x5b')]);router['delete']('/:id/chat_websites',auth[_0x3597('0x9')](),controller[_0x3597('0x5c')]);router[_0x3597('0x52')](_0x3597('0x2b'),auth[_0x3597('0x9')](),controller[_0x3597('0x5d')]);router[_0x3597('0x52')]('/:id/api_key',auth['isAuthenticated'](),controller['removeApiKey']);router[_0x3597('0x2f')]('/:id/messengerSoundNotification',auth[_0x3597('0x9')](),controller['messengerSoundNotification']);module[_0x3597('0x5e')]=router; \ No newline at end of file +var _0xca7e=['express','../../components/auth/service','../../components/interaction/service','../../config/environment','./user.controller','get','isAuthenticated','index','/describe','describe','/presence','getPresence','/:id','show','/:id/avatar','getAvatar','/:id/open_tabs','getOpenTabs','getContacts','getVoiceQueuesRt','/:id/groups','getGroups','getRecordings','getScreenRecordings','/:id/chat/interactions','getChatInteractions','getOpenchannelInteractions','/:id/sms/interactions','getSmsInteractions','getFaxInteractions','/:id/whatsapp/interactions','getWhatsappInteractions','/:id/teams','getTeams','/:id/lists','getLists','/:id/agents','/:id/prefixes','getFaxAccounts','/:id/mail_accounts','getMailAccounts','/:id/openchannel_accounts','getOpenchannelAccounts','/:id/sms_accounts','getSmsAccounts','/:id/chat_websites','getChatWebsites','/:id/whatsapp_accounts','getWhatsappAccounts','/:id/scheduled_calls','getScheduledCalls','/:id/api_key','post','create','/create_many','bulkCreate','/:id/queues','addQueues','diskStorage','join','server/files/images/','format','%s-%s','now','originalname','addAvatar','/:id/login','login','/:id/logout','/:id/pause','pause','/:id/unpause','unpause','addTeams','/:id/chat_interactions','addChatInteractions','/:id/mail_interactions','addMailInteractions','/:id/fax_interactions','addFaxInteractions','/:id/sms_interactions','/:id/openchannel_interactions','addOpenchannelInteractions','/:id/whatsapp_interactions','addWhatsappInteractions','addFaxAccounts','addOpenchannelAccounts','addSmsAccounts','addChatWebsites','createApiKey','update','put','/:id/password','delete','removeQueues','removeTeams','destroy','removeChatInteractions','removeMailInteractions','removeFaxInteractions','removeOpenchannelInteractions','removeWhatsappInteractions','/:id/fax_accounts','removeFaxAccounts','removeMailAccounts','removeOpenchannelAccounts','removeChatWebsites','removeWhatsappAccounts','/:id/messengerSoundNotification','messengerSoundNotification','multer','path'];(function(_0x41448f,_0x5e4bb5){var _0x35517d=function(_0x14f3a6){while(--_0x14f3a6){_0x41448f['push'](_0x41448f['shift']());}};_0x35517d(++_0x5e4bb5);}(_0xca7e,0xde));var _0xeca7=function(_0x24f31b,_0x44b8f3){_0x24f31b=_0x24f31b-0x0;var _0x488401=_0xca7e[_0x24f31b];return _0x488401;};'use strict';var multer=require(_0xeca7('0x0'));var util=require('util');var path=require(_0xeca7('0x1'));var timeout=require('connect-timeout');var express=require(_0xeca7('0x2'));var router=express['Router']();var fs_extra=require('fs-extra');var auth=require(_0xeca7('0x3'));var interaction=require(_0xeca7('0x4'));var config=require(_0xeca7('0x5'));var controller=require(_0xeca7('0x6'));router[_0xeca7('0x7')]('/',auth[_0xeca7('0x8')](),controller[_0xeca7('0x9')]);router['get'](_0xeca7('0xa'),auth[_0xeca7('0x8')](),controller[_0xeca7('0xb')]);router[_0xeca7('0x7')]('/whoami',auth['isAuthenticated'](),controller['whoami']);router[_0xeca7('0x7')](_0xeca7('0xc'),auth['isAuthenticated'](),controller[_0xeca7('0xd')]);router[_0xeca7('0x7')](_0xeca7('0xe'),auth['isAuthenticated'](),controller[_0xeca7('0xf')]);router[_0xeca7('0x7')](_0xeca7('0x10'),controller[_0xeca7('0x11')]);router['get'](_0xeca7('0x12'),auth[_0xeca7('0x8')](),controller[_0xeca7('0x13')]);router[_0xeca7('0x7')]('/:id/contacts',auth[_0xeca7('0x8')](),controller[_0xeca7('0x14')]);router['get']('/:id/queues',auth[_0xeca7('0x8')](),controller['getQueues']);router[_0xeca7('0x7')]('/:id/queues_rt',auth[_0xeca7('0x8')](),controller[_0xeca7('0x15')]);router[_0xeca7('0x7')](_0xeca7('0x16'),auth[_0xeca7('0x8')](),controller[_0xeca7('0x17')]);router['get']('/:id/recordings',auth[_0xeca7('0x8')](),controller[_0xeca7('0x18')]);router[_0xeca7('0x7')]('/:id/screen_recordings',auth[_0xeca7('0x8')](),controller[_0xeca7('0x19')]);router['get'](_0xeca7('0x1a'),auth[_0xeca7('0x8')](),controller[_0xeca7('0x1b')]);router[_0xeca7('0x7')]('/:id/openchannel/interactions',auth[_0xeca7('0x8')](),controller[_0xeca7('0x1c')]);router[_0xeca7('0x7')]('/:id/mail/interactions',auth[_0xeca7('0x8')](),controller['getMailInteractions']);router[_0xeca7('0x7')](_0xeca7('0x1d'),auth[_0xeca7('0x8')](),controller[_0xeca7('0x1e')]);router[_0xeca7('0x7')]('/:id/fax/interactions',auth['isAuthenticated'](),controller[_0xeca7('0x1f')]);router['get'](_0xeca7('0x20'),auth[_0xeca7('0x8')](),controller[_0xeca7('0x21')]);router[_0xeca7('0x7')](_0xeca7('0x22'),auth[_0xeca7('0x8')](),controller[_0xeca7('0x23')]);router[_0xeca7('0x7')](_0xeca7('0x24'),auth[_0xeca7('0x8')](),controller[_0xeca7('0x25')]);router[_0xeca7('0x7')](_0xeca7('0x26'),auth['isAuthenticated'](),controller['getAgents']);router[_0xeca7('0x7')](_0xeca7('0x27'),auth['isAuthenticated'](),controller['getVoicePrefixes']);router[_0xeca7('0x7')]('/:id/fax_accounts',auth['isAuthenticated'](),controller[_0xeca7('0x28')]);router[_0xeca7('0x7')](_0xeca7('0x29'),auth[_0xeca7('0x8')](),controller[_0xeca7('0x2a')]);router[_0xeca7('0x7')](_0xeca7('0x2b'),auth[_0xeca7('0x8')](),controller[_0xeca7('0x2c')]);router[_0xeca7('0x7')](_0xeca7('0x2d'),auth[_0xeca7('0x8')](),controller[_0xeca7('0x2e')]);router['get'](_0xeca7('0x2f'),auth[_0xeca7('0x8')](),controller[_0xeca7('0x30')]);router['get'](_0xeca7('0x31'),auth[_0xeca7('0x8')](),controller[_0xeca7('0x32')]);router[_0xeca7('0x7')](_0xeca7('0x33'),auth[_0xeca7('0x8')](),controller[_0xeca7('0x34')]);router[_0xeca7('0x7')](_0xeca7('0x35'),auth[_0xeca7('0x8')](),controller['getApiKey']);router[_0xeca7('0x36')]('/:id/contacts',auth[_0xeca7('0x8')](),controller['addContacts']);router['post']('/',auth[_0xeca7('0x8')](),controller[_0xeca7('0x37')]);router['post'](_0xeca7('0x38'),auth['isAuthenticated'](),controller[_0xeca7('0x39')]);router[_0xeca7('0x36')](_0xeca7('0x3a'),auth[_0xeca7('0x8')](),controller[_0xeca7('0x3b')]);var upload=multer({'storage':multer[_0xeca7('0x3c')]({'destination':function(_0x30de6b,_0x282dcc,_0x323df9){_0x323df9(null,path[_0xeca7('0x3d')](config['root'],_0xeca7('0x3e')));},'filename':function(_0x39f32f,_0x8116af,_0x11ef99){_0x11ef99(null,util[_0xeca7('0x3f')](_0xeca7('0x40'),Date[_0xeca7('0x41')](),_0x8116af[_0xeca7('0x42')]));}})});router['post'](_0xeca7('0x10'),upload['single']('file'),controller[_0xeca7('0x43')]);router['post'](_0xeca7('0x44'),auth[_0xeca7('0x8')](),controller[_0xeca7('0x45')]);router[_0xeca7('0x36')](_0xeca7('0x46'),auth[_0xeca7('0x8')](),controller['logout']);router[_0xeca7('0x36')](_0xeca7('0x47'),auth[_0xeca7('0x8')](),controller[_0xeca7('0x48')]);router['post'](_0xeca7('0x49'),auth[_0xeca7('0x8')](),controller[_0xeca7('0x4a')]);router[_0xeca7('0x36')]('/:id/teams',auth[_0xeca7('0x8')](),controller[_0xeca7('0x4b')]);router[_0xeca7('0x36')](_0xeca7('0x4c'),auth[_0xeca7('0x8')](),controller[_0xeca7('0x4d')]);router[_0xeca7('0x36')](_0xeca7('0x4e'),auth[_0xeca7('0x8')](),controller[_0xeca7('0x4f')]);router['post'](_0xeca7('0x50'),auth[_0xeca7('0x8')](),controller[_0xeca7('0x51')]);router[_0xeca7('0x36')](_0xeca7('0x52'),auth['isAuthenticated'](),controller['addSmsInteractions']);router[_0xeca7('0x36')](_0xeca7('0x53'),auth['isAuthenticated'](),controller[_0xeca7('0x54')]);router[_0xeca7('0x36')](_0xeca7('0x55'),auth[_0xeca7('0x8')](),controller[_0xeca7('0x56')]);router[_0xeca7('0x36')]('/:id/fax_accounts',auth[_0xeca7('0x8')](),controller[_0xeca7('0x57')]);router[_0xeca7('0x36')]('/:id/mail_accounts',auth['isAuthenticated'](),controller['addMailAccounts']);router[_0xeca7('0x36')](_0xeca7('0x2b'),auth[_0xeca7('0x8')](),controller[_0xeca7('0x58')]);router[_0xeca7('0x36')](_0xeca7('0x2d'),auth[_0xeca7('0x8')](),controller[_0xeca7('0x59')]);router['post'](_0xeca7('0x2f'),auth[_0xeca7('0x8')](),controller[_0xeca7('0x5a')]);router[_0xeca7('0x36')](_0xeca7('0x31'),auth[_0xeca7('0x8')](),controller['addWhatsappAccounts']);router['post']('/:id/api_key',auth[_0xeca7('0x8')](),controller[_0xeca7('0x5b')]);router['put']('/:id',auth[_0xeca7('0x8')](),controller[_0xeca7('0x5c')]);router[_0xeca7('0x5d')](_0xeca7('0x5e'),auth[_0xeca7('0x8')](),controller['changePassword']);router[_0xeca7('0x5f')](_0xeca7('0x3a'),auth[_0xeca7('0x8')](),controller[_0xeca7('0x60')]);router[_0xeca7('0x5f')]('/:id/teams',auth[_0xeca7('0x8')](),controller[_0xeca7('0x61')]);router['delete'](_0xeca7('0xe'),auth['isAuthenticated'](),controller[_0xeca7('0x62')]);router[_0xeca7('0x5f')]('/:id/chat_interactions',auth[_0xeca7('0x8')](),controller[_0xeca7('0x63')]);router['delete'](_0xeca7('0x4e'),auth[_0xeca7('0x8')](),controller[_0xeca7('0x64')]);router[_0xeca7('0x5f')]('/:id/fax_interactions',auth[_0xeca7('0x8')](),controller[_0xeca7('0x65')]);router['delete']('/:id/sms_interactions',auth[_0xeca7('0x8')](),controller['removeSmsInteractions']);router[_0xeca7('0x5f')]('/:id/openchannel_interactions',auth[_0xeca7('0x8')](),controller[_0xeca7('0x66')]);router['delete'](_0xeca7('0x55'),auth[_0xeca7('0x8')](),controller[_0xeca7('0x67')]);router[_0xeca7('0x5f')](_0xeca7('0x68'),auth['isAuthenticated'](),controller[_0xeca7('0x69')]);router[_0xeca7('0x5f')](_0xeca7('0x29'),auth[_0xeca7('0x8')](),controller[_0xeca7('0x6a')]);router[_0xeca7('0x5f')](_0xeca7('0x2b'),auth[_0xeca7('0x8')](),controller[_0xeca7('0x6b')]);router[_0xeca7('0x5f')](_0xeca7('0x2d'),auth[_0xeca7('0x8')](),controller['removeSmsAccounts']);router['delete'](_0xeca7('0x2f'),auth['isAuthenticated'](),controller[_0xeca7('0x6c')]);router[_0xeca7('0x5f')](_0xeca7('0x31'),auth[_0xeca7('0x8')](),controller[_0xeca7('0x6d')]);router[_0xeca7('0x5f')](_0xeca7('0x35'),auth[_0xeca7('0x8')](),controller['removeApiKey']);router[_0xeca7('0x36')](_0xeca7('0x6e'),auth[_0xeca7('0x8')](),controller[_0xeca7('0x6f')]);module['exports']=router; \ No newline at end of file diff --git a/server/api/user/user.attributes.js b/server/api/user/user.attributes.js index 1511b06..0adff1d 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 _0xb7b0=['map','VIRTUAL','phoneBarEnableScreenRecordingByAgent','string','true','false','screenrecording','blocked','blockedAt','loginAttempts','UNSIGNED','sequelize','moment','util','lodash','exports','STRING','name','setDataValue','fullname','\x22%s\x22\x20<%s>','getDataValue','email','ENUM','user','agent','local','INTEGER','internal','accountcode','callerid','format','BOOLEAN','DATE','dynamic','friend','peer','from-sip','ALLOWED_PASSED_SCREEN','ALLOWED_FAILED_SCREEN','ALLOWED','PROHIB_NOT_SCREENED','PROHIB_FAILED_SCREEN','PROHIB','udp','transport','join','split','rfc2833','shortinfo','inband','auto','nonat','yes','force_rport,comedia','nat','String\x20is\x20deprecated.\x20Please\x20use\x20an\x20Array\x20as\x20[\x22force_rport\x22,\x20\x22comedia\x22]','ulaw;alaw;gsm','allow','String\x20is\x20deprecated.\x20Please\x20use\x20an\x20Array\x20as\x20[\x22ulaw\x22,\x20\x22alaw\x22,\x20\x22gsm\x22]','insecure','String\x20is\x20deprecated.\x20Please\x20use\x20an\x20Array\x20as\x20[\x22port\x22,\x20\x22invite\x22]','never','\x22\x22\x20<>','refuse','originate','uac','fingerprint','certificate','update','update,nonat','showWebBar','get','isArray','wss','encryption','avpf','force_avp','dtlsenable','dtlsverify','dtlssetup','dtlsprivatekey','icesupport','actpass','dtlscertfile','/etc/pki/tls/certs/motion.crt','/etc/pki/tls/private/motion.key','rtcp_mux','permissions'];(function(_0x533bcc,_0x1ba26f){var _0x364d38=function(_0xeec8d4){while(--_0xeec8d4){_0x533bcc['push'](_0x533bcc['shift']());}};_0x364d38(++_0x1ba26f);}(_0xb7b0,0xbd));var _0x0b7b=function(_0x38fbc2,_0x641aa1){_0x38fbc2=_0x38fbc2-0x0;var _0x43c7d4=_0xb7b0[_0x38fbc2];return _0x43c7d4;};'use strict';var Sequelize=require(_0x0b7b('0x0'));var moment=require(_0x0b7b('0x1'));var util=require(_0x0b7b('0x2'));var _=require(_0x0b7b('0x3'));module[_0x0b7b('0x4')]={'name':{'type':Sequelize[_0x0b7b('0x5')],'allowNull':![],'unique':_0x0b7b('0x6'),'validate':{'notEmpty':!![],'is':/^[A-Za-z0-9\.\_]+$/i},'set':function(_0x335582){this[_0x0b7b('0x7')]('name',_0x335582);this[_0x0b7b('0x7')]('defaultuser',_0x335582);},'comment':'The\x20name\x20of\x20the\x20user'},'fullname':{'type':Sequelize[_0x0b7b('0x5')],'allowNull':![],'set':function(_0x18c07b){this[_0x0b7b('0x7')](_0x0b7b('0x8'),_0x18c07b);this[_0x0b7b('0x7')]('callerid',util['format'](_0x0b7b('0x9'),_0x18c07b,this[_0x0b7b('0xa')]('internal')));}},'alias':{'type':Sequelize[_0x0b7b('0x5')]},'email':{'type':Sequelize[_0x0b7b('0x5')],'allowNull':![],'unique':_0x0b7b('0xb'),'validate':{'isEmail':!![]},'set':function(_0x2a3eec){if(_0x2a3eec){this[_0x0b7b('0x7')](_0x0b7b('0xb'),_0x2a3eec['toLowerCase']());}}},'role':{'type':Sequelize[_0x0b7b('0xc')]('admin',_0x0b7b('0xd'),_0x0b7b('0xe'),'telephone'),'allowNull':![]},'password':{'type':Sequelize[_0x0b7b('0x5')],'allowNull':![],'validate':{'notEmpty':!![]}},'provider':{'type':Sequelize[_0x0b7b('0x5')],'defaultValue':_0x0b7b('0xf')},'internal':{'type':Sequelize[_0x0b7b('0x10')](0xb),'allowNull':![],'unique':_0x0b7b('0x11'),'set':function(_0x273f2c){this[_0x0b7b('0x7')]('internal',_0x273f2c);this[_0x0b7b('0x7')](_0x0b7b('0x12'),_0x273f2c);this[_0x0b7b('0x7')](_0x0b7b('0x13'),util[_0x0b7b('0x14')](_0x0b7b('0x9'),this['getDataValue']('fullname'),_0x273f2c));}},'salt':{'type':Sequelize[_0x0b7b('0x5')]},'phone':{'type':Sequelize[_0x0b7b('0x5')]},'mobile':{'type':Sequelize['STRING']},'address':{'type':Sequelize[_0x0b7b('0x5')]},'zipcode':{'type':Sequelize[_0x0b7b('0x5')]},'userpic':{'type':Sequelize[_0x0b7b('0x5')]},'city':{'type':Sequelize['STRING']},'country':{'type':Sequelize[_0x0b7b('0x5')]},'online':{'type':Sequelize[_0x0b7b('0x15')],'defaultValue':![]},'lastLoginAt':{'type':Sequelize[_0x0b7b('0x16')]},'voicePause':{'type':Sequelize[_0x0b7b('0x15')],'defaultValue':![]},'chatPause':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'mailPause':{'type':Sequelize[_0x0b7b('0x15')],'defaultValue':![]},'faxPause':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'smsPause':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'whatsappPause':{'type':Sequelize[_0x0b7b('0x15')],'defaultValue':![]},'openchannelPause':{'type':Sequelize[_0x0b7b('0x15')],'defaultValue':![]},'pauseType':{'type':Sequelize['STRING'],'defaultValue':'DEFAULT\x20PAUSE'},'lastPauseAt':{'type':Sequelize[_0x0b7b('0x16')]},'chatCapacity':{'type':Sequelize[_0x0b7b('0x10')],'defaultValue':0x0},'mailCapacity':{'type':Sequelize[_0x0b7b('0x10')],'defaultValue':0x0},'faxCapacity':{'type':Sequelize[_0x0b7b('0x10')],'defaultValue':0x0},'smsCapacity':{'type':Sequelize[_0x0b7b('0x10')],'defaultValue':0x0},'whatsappCapacity':{'type':Sequelize[_0x0b7b('0x10')],'defaultValue':0x0},'openchannelCapacity':{'type':Sequelize[_0x0b7b('0x10')],'defaultValue':0x0},'phoneBarAutoAnswer':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'phoneBarEnableSettings':{'type':Sequelize[_0x0b7b('0x15')],'defaultValue':!![]},'phoneBarListenPort':{'type':Sequelize[_0x0b7b('0x10')](0x5),'defaultValue':0x1428},'phoneBarExpires':{'type':Sequelize[_0x0b7b('0x10')](0x5),'defaultValue':0x78},'phoneBarRemoteControl':{'type':Sequelize[_0x0b7b('0x15')],'defaultValue':![]},'phoneBarRemoteControlPort':{'type':Sequelize['INTEGER'],'defaultValue':0x26a0},'phoneBarEnableRecording':{'type':Sequelize[_0x0b7b('0x15')],'defaultValue':![]},'phoneBarRingInUse':{'type':Sequelize[_0x0b7b('0x15')],'defaultValue':![]},'chanspy':{'type':Sequelize[_0x0b7b('0x15')],'defaultValue':![]},'description':{'type':Sequelize[_0x0b7b('0x5')],'allowNull':!![]},'host':{'type':Sequelize[_0x0b7b('0x5')],'allowNull':!![],'defaultValue':_0x0b7b('0x17')},'ipaddr':{'type':Sequelize[_0x0b7b('0x5')],'allowNull':!![]},'port':{'type':Sequelize['INTEGER'](0x5),'allowNull':!![]},'regseconds':{'type':Sequelize['INTEGER'](0xb),'allowNull':!![]},'fullcontact':{'type':Sequelize[_0x0b7b('0x5')],'allowNull':!![]},'regserver':{'type':Sequelize[_0x0b7b('0x5')],'allowNull':!![]},'useragent':{'type':Sequelize[_0x0b7b('0x5')],'allowNull':!![]},'lastms':{'type':Sequelize[_0x0b7b('0x10')](0xb),'allowNull':!![]},'type':{'type':Sequelize[_0x0b7b('0xc')](_0x0b7b('0x18'),_0x0b7b('0xd'),_0x0b7b('0x19')),'allowNull':!![],'defaultValue':_0x0b7b('0x18')},'context':{'type':Sequelize[_0x0b7b('0x5')],'allowNull':!![],'defaultValue':_0x0b7b('0x1a')},'callingpres':{'type':Sequelize[_0x0b7b('0xc')]('ALLOWED_NOT_SCREENED',_0x0b7b('0x1b'),_0x0b7b('0x1c'),_0x0b7b('0x1d'),_0x0b7b('0x1e'),'PROHIB_PASSED_SCREEN',_0x0b7b('0x1f'),_0x0b7b('0x20')),'allowNull':!![]},'deny':{'type':Sequelize[_0x0b7b('0x5')],'allowNull':!![]},'permit':{'type':Sequelize[_0x0b7b('0x5')],'allowNull':!![]},'secret':{'type':Sequelize[_0x0b7b('0x5')],'allowNull':!![]},'md5secret':{'type':Sequelize['STRING'],'allowNull':!![]},'remotesecret':{'type':Sequelize['STRING'],'allowNull':!![]},'transport':{'type':Sequelize[_0x0b7b('0x5')],'allowNull':!![],'defaultValue':_0x0b7b('0x21'),'set':function(_0x1bce75){this[_0x0b7b('0x7')](_0x0b7b('0x22'),_0x1bce75?_0x1bce75[_0x0b7b('0x23')](','):null);},'get':function(){return this[_0x0b7b('0xa')]('transport')?this[_0x0b7b('0xa')](_0x0b7b('0x22'))[_0x0b7b('0x24')](','):null;},'comment':'String\x20is\x20deprecated.\x20Please\x20use\x20an\x20Array\x20as\x20[\x22udp\x22,\x20\x22tcp\x22]'},'dtmfmode':{'type':Sequelize[_0x0b7b('0xc')](_0x0b7b('0x25'),'info',_0x0b7b('0x26'),_0x0b7b('0x27'),_0x0b7b('0x28')),'allowNull':!![],'defaultValue':_0x0b7b('0x25')},'directmedia':{'type':Sequelize[_0x0b7b('0xc')]('yes','no',_0x0b7b('0x29'),'update','outgoing'),'allowNull':!![],'defaultValue':'no'},'directrtpsetup':{'type':Sequelize[_0x0b7b('0xc')](_0x0b7b('0x2a'),'no'),'allowNull':!![],'defaultValue':'no'},'directmediapermit':{'type':Sequelize['STRING'],'allowNull':!![]},'directmediadeny':{'type':Sequelize[_0x0b7b('0x5')],'allowNull':!![]},'nat':{'type':Sequelize[_0x0b7b('0x5')],'allowNull':!![],'defaultValue':_0x0b7b('0x2b'),'set':function(_0xb703ea){this['setDataValue'](_0x0b7b('0x2c'),_0xb703ea?_0xb703ea[_0x0b7b('0x23')](','):null);},'get':function(){return this[_0x0b7b('0xa')]('nat')?this[_0x0b7b('0xa')](_0x0b7b('0x2c'))[_0x0b7b('0x24')](','):null;},'comment':_0x0b7b('0x2d')},'callgroup':{'type':Sequelize[_0x0b7b('0x5')]},'namedcallgroup':{'type':Sequelize[_0x0b7b('0x5')]},'pickupgroup':{'type':Sequelize[_0x0b7b('0x5')]},'namedpickupgroup':{'type':Sequelize[_0x0b7b('0x5')]},'language':{'type':Sequelize['STRING'],'defaultValue':'en'},'tonezone':{'type':Sequelize[_0x0b7b('0x5')]},'disallow':{'type':Sequelize[_0x0b7b('0x5')],'allowNull':![],'defaultValue':'all'},'allow':{'type':Sequelize[_0x0b7b('0x5')],'allowNull':![],'defaultValue':_0x0b7b('0x2e'),'set':function(_0x262f6d){this[_0x0b7b('0x7')](_0x0b7b('0x2f'),_0x262f6d?_0x262f6d[_0x0b7b('0x23')](';'):_0x0b7b('0x2e'));},'get':function(){return this['getDataValue'](_0x0b7b('0x2f'))?this['getDataValue']('allow')[_0x0b7b('0x24')](';'):null;},'comment':_0x0b7b('0x30')},'autoframing':{'type':Sequelize[_0x0b7b('0xc')](_0x0b7b('0x2a'),'no'),'allowNull':!![]},'insecure':{'type':Sequelize['STRING'],'allowNull':!![],'set':function(_0x30db7a){this['setDataValue'](_0x0b7b('0x31'),_0x30db7a?_0x30db7a['join'](','):null);},'get':function(){return this[_0x0b7b('0xa')](_0x0b7b('0x31'))?this['getDataValue'](_0x0b7b('0x31'))[_0x0b7b('0x24')](','):null;},'comment':_0x0b7b('0x32')},'trustrpid':{'type':Sequelize[_0x0b7b('0xc')](_0x0b7b('0x2a'),'no'),'allowNull':!![],'defaultValue':'no'},'trust_id_outbound':{'type':Sequelize[_0x0b7b('0xc')]('yes','no'),'allowNull':!![],'defaultValue':'no'},'progressinband':{'type':Sequelize['ENUM']('yes','no',_0x0b7b('0x33')),'allowNull':!![]},'promiscredir':{'type':Sequelize[_0x0b7b('0xc')]('yes','no'),'allowNull':!![]},'useclientcode':{'type':Sequelize[_0x0b7b('0xc')](_0x0b7b('0x2a'),'no'),'allowNull':!![]},'accountcode':{'type':Sequelize[_0x0b7b('0x10')](0xb),'allowNull':!![]},'setvar':{'type':Sequelize[_0x0b7b('0x5')],'allowNull':!![]},'callerid':{'type':Sequelize[_0x0b7b('0x5')],'allowNull':!![],'defaultValue':_0x0b7b('0x34')},'amaflags':{'type':Sequelize[_0x0b7b('0x5')],'allowNull':!![]},'callcounter':{'type':Sequelize[_0x0b7b('0xc')](_0x0b7b('0x2a'),'no'),'allowNull':!![],'defaultValue':_0x0b7b('0x2a')},'busylevel':{'type':Sequelize[_0x0b7b('0x10')](0xb),'allowNull':!![]},'allowoverlap':{'type':Sequelize[_0x0b7b('0xc')](_0x0b7b('0x2a'),'no'),'allowNull':!![]},'allowsubscribe':{'type':Sequelize[_0x0b7b('0xc')](_0x0b7b('0x2a'),'no'),'allowNull':!![]},'allowtransfer':{'type':Sequelize[_0x0b7b('0xc')](_0x0b7b('0x2a'),'no'),'allowNull':!![]},'ignoresdpversion':{'type':Sequelize['ENUM'](_0x0b7b('0x2a'),'no'),'allowNull':!![]},'subscribecontext':{'type':Sequelize[_0x0b7b('0x5')],'allowNull':!![]},'template':{'type':Sequelize[_0x0b7b('0x5')],'allowNull':!![]},'videosupport':{'type':Sequelize[_0x0b7b('0xc')](_0x0b7b('0x2a'),'no','always'),'allowNull':!![],'defaultValue':'no'},'maxcallbitrate':{'type':Sequelize[_0x0b7b('0x10')](0xb),'allowNull':!![]},'rfc2833compensate':{'type':Sequelize[_0x0b7b('0xc')]('yes','no'),'allowNull':!![]},'mailbox':{'type':Sequelize['STRING'],'allowNull':!![]},'session_timers':{'type':Sequelize[_0x0b7b('0xc')]('accept',_0x0b7b('0x35'),_0x0b7b('0x36')),'allowNull':!![]},'session_expires':{'type':Sequelize[_0x0b7b('0x10')](0xb),'allowNull':!![]},'session_minse':{'type':Sequelize[_0x0b7b('0x10')](0xb),'allowNull':!![]},'session_refresher':{'type':Sequelize['ENUM'](_0x0b7b('0x37'),'uas'),'allowNull':!![],'defaultValue':'uas'},'t38pt_usertpsource':{'type':Sequelize[_0x0b7b('0x5')],'allowNull':!![]},'regexten':{'type':Sequelize[_0x0b7b('0x5')],'allowNull':!![]},'fromdomain':{'type':Sequelize[_0x0b7b('0x5')],'allowNull':!![]},'fromuser':{'type':Sequelize[_0x0b7b('0x5')],'allowNull':!![]},'qualify':{'type':Sequelize[_0x0b7b('0xc')](_0x0b7b('0x2a'),'no'),'allowNull':!![],'defaultValue':_0x0b7b('0x2a')},'keepalive':{'type':Sequelize['INTEGER'](0xb),'allowNull':!![]},'defaultip':{'type':Sequelize[_0x0b7b('0x5')],'allowNull':!![]},'defaultuser':{'type':Sequelize[_0x0b7b('0x5')],'allowNull':!![]},'rtptimeout':{'type':Sequelize['INTEGER'](0xb),'allowNull':!![]},'rtpholdtimeout':{'type':Sequelize[_0x0b7b('0x10')](0xb),'allowNull':!![]},'rtpkeepalive':{'type':Sequelize[_0x0b7b('0x10')](0xb),'allowNull':!![]},'sendrpid':{'type':Sequelize['ENUM'](_0x0b7b('0x2a'),'no'),'allowNull':!![],'defaultValue':'no'},'outboundproxy':{'type':Sequelize[_0x0b7b('0x5')],'allowNull':!![]},'callbackextension':{'type':Sequelize[_0x0b7b('0x5')],'allowNull':!![]},'timert1':{'type':Sequelize[_0x0b7b('0x10')](0xb),'allowNull':!![]},'timerb':{'type':Sequelize[_0x0b7b('0x10')](0xb),'allowNull':!![]},'qualifyfreq':{'type':Sequelize['INTEGER'](0xb),'allowNull':!![]},'contactpermit':{'type':Sequelize[_0x0b7b('0x5')],'allowNull':!![]},'contactdeny':{'type':Sequelize['STRING'],'allowNull':!![]},'contactacl':{'type':Sequelize[_0x0b7b('0x5')],'allowNull':!![]},'unsolicited_mailbox':{'type':Sequelize['STRING'],'allowNull':!![]},'use_q850_reason':{'type':Sequelize[_0x0b7b('0x5')],'allowNull':!![]},'maxforwards':{'type':Sequelize['INTEGER'](0xb),'allowNull':!![]},'encryption':{'type':Sequelize['ENUM'](_0x0b7b('0x2a'),'no'),'allowNull':!![],'defaultValue':'no'},'avpf':{'type':Sequelize[_0x0b7b('0xc')]('yes','no'),'allowNull':!![]},'force_avp':{'type':Sequelize[_0x0b7b('0xc')](_0x0b7b('0x2a'),'no'),'allowNull':!![]},'icesupport':{'type':Sequelize[_0x0b7b('0xc')](_0x0b7b('0x2a'),'no'),'allowNull':!![]},'dtlsenable':{'type':Sequelize[_0x0b7b('0xc')](_0x0b7b('0x2a'),'no'),'allowNull':!![]},'dtlsverify':{'type':Sequelize['ENUM']('yes','no',_0x0b7b('0x38'),_0x0b7b('0x39')),'allowNull':!![]},'dtlsrekey':{'type':Sequelize[_0x0b7b('0x10')](0xb),'allowNull':!![]},'dtlscertfile':{'type':Sequelize['STRING'],'allowNull':!![]},'dtlsprivatekey':{'type':Sequelize['STRING'],'allowNull':!![]},'dtlscipher':{'type':Sequelize[_0x0b7b('0x5')],'allowNull':!![]},'dtlscafile':{'type':Sequelize[_0x0b7b('0x5')],'allowNull':!![]},'dtlscapath':{'type':Sequelize['STRING'],'allowNull':!![]},'dtlssetup':{'type':Sequelize[_0x0b7b('0xc')]('active','passive','actpass'),'allowNull':!![]},'dtlsfingerprint':{'type':Sequelize[_0x0b7b('0x5')],'allowNull':!![]},'usereqphone':{'type':Sequelize[_0x0b7b('0xc')](_0x0b7b('0x2a'),'no'),'allowNull':!![],'defaultValue':'no'},'recordonfeature':{'type':Sequelize[_0x0b7b('0x5')],'allowNull':!![]},'recordofffeature':{'type':Sequelize[_0x0b7b('0x5')],'allowNull':!![]},'call_limit':{'type':Sequelize[_0x0b7b('0x10')](0xb),'allowNull':!![],'defaultValue':0xa},'registertrying':{'type':Sequelize['ENUM'](_0x0b7b('0x2a'),'no'),'allowNull':!![]},'subscribemwi':{'type':Sequelize[_0x0b7b('0xc')]('yes','no'),'allowNull':!![]},'vmexten':{'type':Sequelize['STRING'],'allowNull':!![]},'mohinterpret':{'type':Sequelize[_0x0b7b('0x5')],'allowNull':!![]},'mohsuggest':{'type':Sequelize[_0x0b7b('0x5')],'allowNull':!![]},'parkinglot':{'type':Sequelize[_0x0b7b('0x5')],'allowNull':!![]},'canreinvite':{'type':Sequelize[_0x0b7b('0xc')](_0x0b7b('0x2a'),'no',_0x0b7b('0x29'),_0x0b7b('0x3a'),_0x0b7b('0x3b')),'allowNull':!![],'defaultValue':'no'},'loginInPause':{'type':Sequelize[_0x0b7b('0x15')],'defaultValue':![]},'resetPasswordToken':{'type':Sequelize[_0x0b7b('0x5')]},'resetPasswordExpires':{'type':Sequelize[_0x0b7b('0x16')]},'passwordResetAt':{'type':Sequelize[_0x0b7b('0x16')],'defaultValue':null},'previousPasswords':{'type':Sequelize['TEXT']},'showWebBar':{'type':Sequelize['INTEGER'],'defaultValue':0x0,'set':function(_0x2fa795){this['setDataValue'](_0x0b7b('0x3c'),_0x2fa795);var _0x5d239f=this[_0x0b7b('0x3d')]({'plain':!![]});switch(_0x2fa795){case 0x0:case 0x1:var _0x4045b9=_0x5d239f['transport']?_[_0x0b7b('0x3e')](_0x5d239f[_0x0b7b('0x22')])?_0x5d239f[_0x0b7b('0x22')][_0x0b7b('0x23')]():_0x5d239f[_0x0b7b('0x22')]:'udp';if(_0x4045b9===_0x0b7b('0x3f')){_0x4045b9='udp';}this[_0x0b7b('0x7')](_0x0b7b('0x22'),_0x4045b9);this[_0x0b7b('0x7')](_0x0b7b('0x40'),'no');this[_0x0b7b('0x7')](_0x0b7b('0x41'),null);this[_0x0b7b('0x7')](_0x0b7b('0x42'),null);this[_0x0b7b('0x7')]('icesupport',null);this[_0x0b7b('0x7')](_0x0b7b('0x43'),null);this[_0x0b7b('0x7')](_0x0b7b('0x44'),null);this[_0x0b7b('0x7')](_0x0b7b('0x45'),null);this[_0x0b7b('0x7')]('dtlscertfile',null);this['setDataValue'](_0x0b7b('0x46'),null);this[_0x0b7b('0x7')]('rtcp_mux','no');break;case 0x2:this[_0x0b7b('0x7')](_0x0b7b('0x22'),_0x0b7b('0x3f'));this['setDataValue'](_0x0b7b('0x40'),'yes');this['setDataValue'](_0x0b7b('0x41'),'yes');this[_0x0b7b('0x7')]('force_avp',_0x0b7b('0x2a'));this[_0x0b7b('0x7')](_0x0b7b('0x47'),'yes');this[_0x0b7b('0x7')](_0x0b7b('0x43'),_0x0b7b('0x2a'));this[_0x0b7b('0x7')](_0x0b7b('0x44'),'no');this[_0x0b7b('0x7')](_0x0b7b('0x45'),_0x0b7b('0x48'));this[_0x0b7b('0x7')](_0x0b7b('0x49'),_0x5d239f[_0x0b7b('0x49')]||_0x0b7b('0x4a'));this[_0x0b7b('0x7')](_0x0b7b('0x46'),_0x5d239f[_0x0b7b('0x46')]||_0x0b7b('0x4b'));this[_0x0b7b('0x7')](_0x0b7b('0x4c'),_0x0b7b('0x2a'));break;default:}}},'permissions':{'type':Sequelize['TEXT'],'set':function(_0x46e10f){this[_0x0b7b('0x7')](_0x0b7b('0x4d'),_0x46e10f?_0x46e10f['join'](','):[]);},'get':function(){return this[_0x0b7b('0xa')](_0x0b7b('0x4d'))?_[_0x0b7b('0x4e')](this[_0x0b7b('0xa')](_0x0b7b('0x4d'))['split'](','),function(_0x38323c){return parseInt(_0x38323c,0xa);}):[];}},'phoneBarUnconditionalNumber':{'type':Sequelize[_0x0b7b('0x5')]},'phoneBarNoReplyNumber':{'type':Sequelize[_0x0b7b('0x5')]},'phoneBarBusyNumber':{'type':Sequelize[_0x0b7b('0x5')]},'phoneBarUnconditional':{'type':Sequelize[_0x0b7b('0x15')],'defaultValue':![]},'phoneBarNoReply':{'type':Sequelize[_0x0b7b('0x15')],'defaultValue':![]},'phoneBarBusy':{'type':Sequelize[_0x0b7b('0x15')],'defaultValue':![]},'phoneBarDnd':{'type':Sequelize[_0x0b7b('0x15')],'defaultValue':!![]},'phoneBarUnansweredCallBadge':{'type':Sequelize[_0x0b7b('0x15')],'defaultValue':!![]},'phoneBarEnableDtmfTone':{'type':Sequelize[_0x0b7b('0x15')],'defaultValue':![]},'phoneBarAutoAnswerDelay':{'type':Sequelize[_0x0b7b('0x10')],'defaultValue':0x0},'extensionMonitor':{'type':Sequelize[_0x0b7b('0x5')],'defaultValue':''},'crudPermissions':{'type':Sequelize['INTEGER'],'defaultValue':0x0},'rtcp_mux':{'type':Sequelize[_0x0b7b('0xc')](_0x0b7b('0x2a'),'no'),'defaultValue':'no'},'allowmessenger':{'type':Sequelize[_0x0b7b('0x15')],'defaultValue':!![]},'phoneBarOutboundProxy':{'type':Sequelize[_0x0b7b('0x5')]},'phoneBarEnableJaws':{'type':Sequelize[_0x0b7b('0x15')],'defaultValue':![]},'phoneBarEnableScreenRecordingByAgent':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'phoneBarEnableVideoRecording':{'type':Sequelize[_0x0b7b('0x4f')],'get':function(){return this[_0x0b7b('0xa')](_0x0b7b('0x50'))?this[_0x0b7b('0xa')](_0x0b7b('0x50')):![];}},'phoneBarEnableAutomaticScreenRecording':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'phoneBarPrefixRequired':{'type':Sequelize[_0x0b7b('0x15')],'defaultValue':![]},'hotdesk':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'interface':{'type':Sequelize[_0x0b7b('0x5')],'defaultValue':null},'privacyEnabled':{'type':Sequelize[_0x0b7b('0x15')],'defaultValue':![]},'apiKeyNonce':{'type':Sequelize[_0x0b7b('0x5')],'allowNull':!![]},'apiKeyIat':{'type':Sequelize[_0x0b7b('0x5')],'allowNull':!![]},'screenrecording':{'type':Sequelize[_0x0b7b('0x15')],'defaultValue':![],'set':function(_0x571aad){if(typeof _0x571aad===_0x0b7b('0x51')){var _0x2db46a=_0x571aad==='1'?!![]:_0x571aad==='0'?![]:_0x571aad===_0x0b7b('0x52')?!![]:_0x571aad===_0x0b7b('0x53')?![]:![];this[_0x0b7b('0x7')]('screenrecording',_0x2db46a);}else{this[_0x0b7b('0x7')](_0x0b7b('0x54'),_0x571aad);}}},'blocked':{'type':Sequelize[_0x0b7b('0x15')],'defaultValue':![],'set':function(_0x10878e){this[_0x0b7b('0x7')](_0x0b7b('0x55'),_0x10878e);if(_0x10878e===!![]){this[_0x0b7b('0x7')](_0x0b7b('0x56'),moment());this[_0x0b7b('0x7')](_0x0b7b('0x57'),0x0);}else{this[_0x0b7b('0x7')](_0x0b7b('0x56'),null);}}},'blockedAt':{'type':Sequelize[_0x0b7b('0x16')],'defaultValue':null},'loginAttempts':{'type':Sequelize[_0x0b7b('0x10')],'defaultValue':0x0},'disabled':{'type':Sequelize[_0x0b7b('0x15')],'defaultValue':![]},'settingsEnabled':{'type':Sequelize[_0x0b7b('0x15')],'defaultValue':!![]},'wssPort':{'type':Sequelize[_0x0b7b('0x10')](0x5)[_0x0b7b('0x58')],'defaultValue':0x1f99},'downloadAttachments':{'type':Sequelize[_0x0b7b('0x15')],'defaultValue':!![]},'downloadOmnichannelInteractions':{'type':Sequelize['BOOLEAN'],'defaultValue':!![]},'downloadVoiceRecordings':{'type':Sequelize[_0x0b7b('0x15')],'defaultValue':!![]},'ignorePauseForPreviewCalls':{'type':Sequelize[_0x0b7b('0x15')],'defaultValue':![]},'selectRecallMeCampaign':{'type':Sequelize[_0x0b7b('0x15')],'defaultValue':![]},'adSsoEnabled':{'type':Sequelize[_0x0b7b('0x15')],'defaultValue':![]},'chatAutoanswer':{'type':Sequelize[_0x0b7b('0x15')],'defaultValue':![]},'chatAutoanswerDelay':{'type':Sequelize['INTEGER'],'defaultValue':0x0},'emailAutoanswer':{'type':Sequelize[_0x0b7b('0x15')],'defaultValue':![]},'emailAutoanswerDelay':{'type':Sequelize['INTEGER'],'defaultValue':0x0},'smsAutoanswer':{'type':Sequelize[_0x0b7b('0x15')],'defaultValue':![]},'smsAutoanswerDelay':{'type':Sequelize['INTEGER'],'defaultValue':0x0},'openchannelAutoanswer':{'type':Sequelize[_0x0b7b('0x15')],'defaultValue':![]},'openchannelAutoanswerDelay':{'type':Sequelize[_0x0b7b('0x10')],'defaultValue':0x0},'faxAutoanswer':{'type':Sequelize[_0x0b7b('0x15')],'defaultValue':![]},'faxAutoanswerDelay':{'type':Sequelize['INTEGER'],'defaultValue':0x0},'whatsappAutoanswer':{'type':Sequelize[_0x0b7b('0x15')],'defaultValue':![]},'whatsappAutoanswerDelay':{'type':Sequelize[_0x0b7b('0x10')],'defaultValue':0x0},'messengerSoundNotification':{'type':Sequelize[_0x0b7b('0x15')],'defaultValue':![]}}; \ No newline at end of file +var _0x2073=['PROHIB','transport','join','String\x20is\x20deprecated.\x20Please\x20use\x20an\x20Array\x20as\x20[\x22udp\x22,\x20\x22tcp\x22]','rfc2833','shortinfo','inband','auto','yes','nonat','update','force_rport,comedia','nat','split','String\x20is\x20deprecated.\x20Please\x20use\x20an\x20Array\x20as\x20[\x22force_rport\x22,\x20\x22comedia\x22]','all','ulaw;alaw;gsm','allow','String\x20is\x20deprecated.\x20Please\x20use\x20an\x20Array\x20as\x20[\x22ulaw\x22,\x20\x22alaw\x22,\x20\x22gsm\x22]','insecure','String\x20is\x20deprecated.\x20Please\x20use\x20an\x20Array\x20as\x20[\x22port\x22,\x20\x22invite\x22]','never','refuse','originate','uac','uas','active','passive','TEXT','get','isArray','udp','wss','encryption','avpf','force_avp','icesupport','dtlsenable','dtlsverify','dtlssetup','dtlscertfile','rtcp_mux','actpass','dtlsprivatekey','/etc/pki/tls/private/motion.key','permissions','map','phoneBarEnableScreenRecordingByAgent','string','false','screenrecording','blockedAt','loginAttempts','UNSIGNED','util','lodash','exports','STRING','name','setDataValue','defaultuser','The\x20name\x20of\x20the\x20user','fullname','callerid','getDataValue','internal','email','ENUM','admin','user','telephone','local','INTEGER','accountcode','format','\x22%s\x22\x20<%s>','BOOLEAN','DATE','dynamic','friend','from-sip','ALLOWED_NOT_SCREENED','ALLOWED_PASSED_SCREEN','ALLOWED_FAILED_SCREEN','ALLOWED','PROHIB_NOT_SCREENED','PROHIB_PASSED_SCREEN'];(function(_0x238706,_0x36c69c){var _0x1838b1=function(_0x1f4510){while(--_0x1f4510){_0x238706['push'](_0x238706['shift']());}};_0x1838b1(++_0x36c69c);}(_0x2073,0x13b));var _0x3207=function(_0x4c05da,_0x414720){_0x4c05da=_0x4c05da-0x0;var _0x1614db=_0x2073[_0x4c05da];return _0x1614db;};'use strict';var Sequelize=require('sequelize');var moment=require('moment');var util=require(_0x3207('0x0'));var _=require(_0x3207('0x1'));module[_0x3207('0x2')]={'name':{'type':Sequelize[_0x3207('0x3')],'allowNull':![],'unique':_0x3207('0x4'),'validate':{'notEmpty':!![],'is':/^[A-Za-z0-9\.\_]+$/i},'set':function(_0x20c04a){this[_0x3207('0x5')](_0x3207('0x4'),_0x20c04a);this[_0x3207('0x5')](_0x3207('0x6'),_0x20c04a);},'comment':_0x3207('0x7')},'fullname':{'type':Sequelize['STRING'],'allowNull':![],'set':function(_0x204dc1){this[_0x3207('0x5')](_0x3207('0x8'),_0x204dc1);this['setDataValue'](_0x3207('0x9'),util['format']('\x22%s\x22\x20<%s>',_0x204dc1,this[_0x3207('0xa')](_0x3207('0xb'))));}},'alias':{'type':Sequelize[_0x3207('0x3')]},'email':{'type':Sequelize[_0x3207('0x3')],'allowNull':![],'unique':_0x3207('0xc'),'validate':{'isEmail':!![]},'set':function(_0x1492c1){if(_0x1492c1){this[_0x3207('0x5')](_0x3207('0xc'),_0x1492c1['toLowerCase']());}}},'role':{'type':Sequelize[_0x3207('0xd')](_0x3207('0xe'),_0x3207('0xf'),'agent',_0x3207('0x10')),'allowNull':![]},'password':{'type':Sequelize[_0x3207('0x3')],'allowNull':![],'validate':{'notEmpty':!![]}},'provider':{'type':Sequelize[_0x3207('0x3')],'defaultValue':_0x3207('0x11')},'internal':{'type':Sequelize[_0x3207('0x12')](0xb),'allowNull':![],'unique':_0x3207('0xb'),'set':function(_0x258636){this[_0x3207('0x5')](_0x3207('0xb'),_0x258636);this[_0x3207('0x5')](_0x3207('0x13'),_0x258636);this[_0x3207('0x5')]('callerid',util[_0x3207('0x14')](_0x3207('0x15'),this['getDataValue']('fullname'),_0x258636));}},'salt':{'type':Sequelize[_0x3207('0x3')]},'phone':{'type':Sequelize[_0x3207('0x3')]},'mobile':{'type':Sequelize['STRING']},'address':{'type':Sequelize['STRING']},'zipcode':{'type':Sequelize[_0x3207('0x3')]},'userpic':{'type':Sequelize[_0x3207('0x3')]},'city':{'type':Sequelize[_0x3207('0x3')]},'country':{'type':Sequelize[_0x3207('0x3')]},'online':{'type':Sequelize[_0x3207('0x16')],'defaultValue':![]},'lastLoginAt':{'type':Sequelize['DATE']},'voicePause':{'type':Sequelize[_0x3207('0x16')],'defaultValue':![]},'chatPause':{'type':Sequelize[_0x3207('0x16')],'defaultValue':![]},'mailPause':{'type':Sequelize[_0x3207('0x16')],'defaultValue':![]},'faxPause':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'smsPause':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'whatsappPause':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'openchannelPause':{'type':Sequelize[_0x3207('0x16')],'defaultValue':![]},'pauseType':{'type':Sequelize[_0x3207('0x3')],'defaultValue':'DEFAULT\x20PAUSE'},'lastPauseAt':{'type':Sequelize[_0x3207('0x17')]},'chatCapacity':{'type':Sequelize[_0x3207('0x12')],'defaultValue':0x0},'mailCapacity':{'type':Sequelize[_0x3207('0x12')],'defaultValue':0x0},'faxCapacity':{'type':Sequelize[_0x3207('0x12')],'defaultValue':0x0},'smsCapacity':{'type':Sequelize[_0x3207('0x12')],'defaultValue':0x0},'whatsappCapacity':{'type':Sequelize[_0x3207('0x12')],'defaultValue':0x0},'openchannelCapacity':{'type':Sequelize[_0x3207('0x12')],'defaultValue':0x0},'phoneBarAutoAnswer':{'type':Sequelize[_0x3207('0x16')],'defaultValue':![]},'phoneBarEnableSettings':{'type':Sequelize[_0x3207('0x16')],'defaultValue':!![]},'phoneBarListenPort':{'type':Sequelize['INTEGER'](0x5),'defaultValue':0x1428},'phoneBarExpires':{'type':Sequelize['INTEGER'](0x5),'defaultValue':0x78},'phoneBarRemoteControl':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'phoneBarRemoteControlPort':{'type':Sequelize[_0x3207('0x12')],'defaultValue':0x26a0},'phoneBarEnableRecording':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'phoneBarRingInUse':{'type':Sequelize[_0x3207('0x16')],'defaultValue':![]},'chanspy':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'description':{'type':Sequelize['STRING'],'allowNull':!![]},'host':{'type':Sequelize[_0x3207('0x3')],'allowNull':!![],'defaultValue':_0x3207('0x18')},'ipaddr':{'type':Sequelize[_0x3207('0x3')],'allowNull':!![]},'port':{'type':Sequelize[_0x3207('0x12')](0x5),'allowNull':!![]},'regseconds':{'type':Sequelize[_0x3207('0x12')](0xb),'allowNull':!![]},'fullcontact':{'type':Sequelize[_0x3207('0x3')],'allowNull':!![]},'regserver':{'type':Sequelize['STRING'],'allowNull':!![]},'useragent':{'type':Sequelize[_0x3207('0x3')],'allowNull':!![]},'lastms':{'type':Sequelize[_0x3207('0x12')](0xb),'allowNull':!![]},'type':{'type':Sequelize[_0x3207('0xd')](_0x3207('0x19'),_0x3207('0xf'),'peer'),'allowNull':!![],'defaultValue':_0x3207('0x19')},'context':{'type':Sequelize[_0x3207('0x3')],'allowNull':!![],'defaultValue':_0x3207('0x1a')},'callingpres':{'type':Sequelize[_0x3207('0xd')](_0x3207('0x1b'),_0x3207('0x1c'),_0x3207('0x1d'),_0x3207('0x1e'),_0x3207('0x1f'),_0x3207('0x20'),'PROHIB_FAILED_SCREEN',_0x3207('0x21')),'allowNull':!![]},'deny':{'type':Sequelize[_0x3207('0x3')],'allowNull':!![]},'permit':{'type':Sequelize['STRING'],'allowNull':!![]},'secret':{'type':Sequelize[_0x3207('0x3')],'allowNull':!![]},'md5secret':{'type':Sequelize[_0x3207('0x3')],'allowNull':!![]},'remotesecret':{'type':Sequelize['STRING'],'allowNull':!![]},'transport':{'type':Sequelize[_0x3207('0x3')],'allowNull':!![],'defaultValue':'udp','set':function(_0x38e146){this[_0x3207('0x5')](_0x3207('0x22'),_0x38e146?_0x38e146[_0x3207('0x23')](','):null);},'get':function(){return this[_0x3207('0xa')]('transport')?this[_0x3207('0xa')](_0x3207('0x22'))['split'](','):null;},'comment':_0x3207('0x24')},'dtmfmode':{'type':Sequelize[_0x3207('0xd')](_0x3207('0x25'),'info',_0x3207('0x26'),_0x3207('0x27'),_0x3207('0x28')),'allowNull':!![],'defaultValue':_0x3207('0x25')},'directmedia':{'type':Sequelize[_0x3207('0xd')](_0x3207('0x29'),'no',_0x3207('0x2a'),_0x3207('0x2b'),'outgoing'),'allowNull':!![],'defaultValue':'no'},'directrtpsetup':{'type':Sequelize[_0x3207('0xd')](_0x3207('0x29'),'no'),'allowNull':!![],'defaultValue':'no'},'directmediapermit':{'type':Sequelize['STRING'],'allowNull':!![]},'directmediadeny':{'type':Sequelize[_0x3207('0x3')],'allowNull':!![]},'nat':{'type':Sequelize[_0x3207('0x3')],'allowNull':!![],'defaultValue':_0x3207('0x2c'),'set':function(_0x2ee5b3){this[_0x3207('0x5')](_0x3207('0x2d'),_0x2ee5b3?_0x2ee5b3[_0x3207('0x23')](','):null);},'get':function(){return this['getDataValue'](_0x3207('0x2d'))?this[_0x3207('0xa')](_0x3207('0x2d'))[_0x3207('0x2e')](','):null;},'comment':_0x3207('0x2f')},'callgroup':{'type':Sequelize[_0x3207('0x3')]},'namedcallgroup':{'type':Sequelize[_0x3207('0x3')]},'pickupgroup':{'type':Sequelize[_0x3207('0x3')]},'namedpickupgroup':{'type':Sequelize[_0x3207('0x3')]},'language':{'type':Sequelize['STRING'],'defaultValue':'en'},'tonezone':{'type':Sequelize[_0x3207('0x3')]},'disallow':{'type':Sequelize[_0x3207('0x3')],'allowNull':![],'defaultValue':_0x3207('0x30')},'allow':{'type':Sequelize[_0x3207('0x3')],'allowNull':![],'defaultValue':_0x3207('0x31'),'set':function(_0x2cfde3){this[_0x3207('0x5')](_0x3207('0x32'),_0x2cfde3?_0x2cfde3[_0x3207('0x23')](';'):_0x3207('0x31'));},'get':function(){return this[_0x3207('0xa')]('allow')?this[_0x3207('0xa')]('allow')[_0x3207('0x2e')](';'):null;},'comment':_0x3207('0x33')},'autoframing':{'type':Sequelize[_0x3207('0xd')]('yes','no'),'allowNull':!![]},'insecure':{'type':Sequelize[_0x3207('0x3')],'allowNull':!![],'set':function(_0x324089){this['setDataValue'](_0x3207('0x34'),_0x324089?_0x324089[_0x3207('0x23')](','):null);},'get':function(){return this['getDataValue']('insecure')?this[_0x3207('0xa')](_0x3207('0x34'))['split'](','):null;},'comment':_0x3207('0x35')},'trustrpid':{'type':Sequelize[_0x3207('0xd')](_0x3207('0x29'),'no'),'allowNull':!![],'defaultValue':'no'},'trust_id_outbound':{'type':Sequelize[_0x3207('0xd')]('yes','no'),'allowNull':!![],'defaultValue':'no'},'progressinband':{'type':Sequelize['ENUM']('yes','no',_0x3207('0x36')),'allowNull':!![]},'promiscredir':{'type':Sequelize[_0x3207('0xd')](_0x3207('0x29'),'no'),'allowNull':!![]},'useclientcode':{'type':Sequelize[_0x3207('0xd')]('yes','no'),'allowNull':!![]},'accountcode':{'type':Sequelize[_0x3207('0x12')](0xb),'allowNull':!![]},'setvar':{'type':Sequelize[_0x3207('0x3')],'allowNull':!![]},'callerid':{'type':Sequelize[_0x3207('0x3')],'allowNull':!![],'defaultValue':'\x22\x22\x20<>'},'amaflags':{'type':Sequelize[_0x3207('0x3')],'allowNull':!![]},'callcounter':{'type':Sequelize[_0x3207('0xd')]('yes','no'),'allowNull':!![],'defaultValue':_0x3207('0x29')},'busylevel':{'type':Sequelize[_0x3207('0x12')](0xb),'allowNull':!![]},'allowoverlap':{'type':Sequelize[_0x3207('0xd')](_0x3207('0x29'),'no'),'allowNull':!![]},'allowsubscribe':{'type':Sequelize['ENUM'](_0x3207('0x29'),'no'),'allowNull':!![]},'allowtransfer':{'type':Sequelize[_0x3207('0xd')](_0x3207('0x29'),'no'),'allowNull':!![]},'ignoresdpversion':{'type':Sequelize['ENUM'](_0x3207('0x29'),'no'),'allowNull':!![]},'subscribecontext':{'type':Sequelize[_0x3207('0x3')],'allowNull':!![]},'template':{'type':Sequelize[_0x3207('0x3')],'allowNull':!![]},'videosupport':{'type':Sequelize['ENUM'](_0x3207('0x29'),'no','always'),'allowNull':!![],'defaultValue':'no'},'maxcallbitrate':{'type':Sequelize[_0x3207('0x12')](0xb),'allowNull':!![]},'rfc2833compensate':{'type':Sequelize['ENUM'](_0x3207('0x29'),'no'),'allowNull':!![]},'mailbox':{'type':Sequelize[_0x3207('0x3')],'allowNull':!![]},'session_timers':{'type':Sequelize[_0x3207('0xd')]('accept',_0x3207('0x37'),_0x3207('0x38')),'allowNull':!![]},'session_expires':{'type':Sequelize[_0x3207('0x12')](0xb),'allowNull':!![]},'session_minse':{'type':Sequelize['INTEGER'](0xb),'allowNull':!![]},'session_refresher':{'type':Sequelize['ENUM'](_0x3207('0x39'),_0x3207('0x3a')),'allowNull':!![],'defaultValue':'uas'},'t38pt_usertpsource':{'type':Sequelize[_0x3207('0x3')],'allowNull':!![]},'regexten':{'type':Sequelize[_0x3207('0x3')],'allowNull':!![]},'fromdomain':{'type':Sequelize['STRING'],'allowNull':!![]},'fromuser':{'type':Sequelize[_0x3207('0x3')],'allowNull':!![]},'qualify':{'type':Sequelize[_0x3207('0xd')](_0x3207('0x29'),'no'),'allowNull':!![],'defaultValue':_0x3207('0x29')},'keepalive':{'type':Sequelize[_0x3207('0x12')](0xb),'allowNull':!![]},'defaultip':{'type':Sequelize[_0x3207('0x3')],'allowNull':!![]},'defaultuser':{'type':Sequelize[_0x3207('0x3')],'allowNull':!![]},'rtptimeout':{'type':Sequelize['INTEGER'](0xb),'allowNull':!![]},'rtpholdtimeout':{'type':Sequelize[_0x3207('0x12')](0xb),'allowNull':!![]},'rtpkeepalive':{'type':Sequelize['INTEGER'](0xb),'allowNull':!![]},'sendrpid':{'type':Sequelize[_0x3207('0xd')](_0x3207('0x29'),'no'),'allowNull':!![],'defaultValue':'no'},'outboundproxy':{'type':Sequelize['STRING'],'allowNull':!![]},'callbackextension':{'type':Sequelize['STRING'],'allowNull':!![]},'timert1':{'type':Sequelize[_0x3207('0x12')](0xb),'allowNull':!![]},'timerb':{'type':Sequelize[_0x3207('0x12')](0xb),'allowNull':!![]},'qualifyfreq':{'type':Sequelize[_0x3207('0x12')](0xb),'allowNull':!![]},'contactpermit':{'type':Sequelize[_0x3207('0x3')],'allowNull':!![]},'contactdeny':{'type':Sequelize[_0x3207('0x3')],'allowNull':!![]},'contactacl':{'type':Sequelize[_0x3207('0x3')],'allowNull':!![]},'unsolicited_mailbox':{'type':Sequelize['STRING'],'allowNull':!![]},'use_q850_reason':{'type':Sequelize[_0x3207('0x3')],'allowNull':!![]},'maxforwards':{'type':Sequelize[_0x3207('0x12')](0xb),'allowNull':!![]},'encryption':{'type':Sequelize['ENUM'](_0x3207('0x29'),'no'),'allowNull':!![],'defaultValue':'no'},'avpf':{'type':Sequelize[_0x3207('0xd')](_0x3207('0x29'),'no'),'allowNull':!![]},'force_avp':{'type':Sequelize['ENUM'](_0x3207('0x29'),'no'),'allowNull':!![]},'icesupport':{'type':Sequelize[_0x3207('0xd')](_0x3207('0x29'),'no'),'allowNull':!![]},'dtlsenable':{'type':Sequelize[_0x3207('0xd')](_0x3207('0x29'),'no'),'allowNull':!![]},'dtlsverify':{'type':Sequelize[_0x3207('0xd')](_0x3207('0x29'),'no','fingerprint','certificate'),'allowNull':!![]},'dtlsrekey':{'type':Sequelize[_0x3207('0x12')](0xb),'allowNull':!![]},'dtlscertfile':{'type':Sequelize[_0x3207('0x3')],'allowNull':!![]},'dtlsprivatekey':{'type':Sequelize[_0x3207('0x3')],'allowNull':!![]},'dtlscipher':{'type':Sequelize[_0x3207('0x3')],'allowNull':!![]},'dtlscafile':{'type':Sequelize[_0x3207('0x3')],'allowNull':!![]},'dtlscapath':{'type':Sequelize['STRING'],'allowNull':!![]},'dtlssetup':{'type':Sequelize['ENUM'](_0x3207('0x3b'),_0x3207('0x3c'),'actpass'),'allowNull':!![]},'dtlsfingerprint':{'type':Sequelize[_0x3207('0x3')],'allowNull':!![]},'usereqphone':{'type':Sequelize[_0x3207('0xd')](_0x3207('0x29'),'no'),'allowNull':!![],'defaultValue':'no'},'recordonfeature':{'type':Sequelize[_0x3207('0x3')],'allowNull':!![]},'recordofffeature':{'type':Sequelize[_0x3207('0x3')],'allowNull':!![]},'call_limit':{'type':Sequelize[_0x3207('0x12')](0xb),'allowNull':!![],'defaultValue':0xa},'registertrying':{'type':Sequelize[_0x3207('0xd')](_0x3207('0x29'),'no'),'allowNull':!![]},'subscribemwi':{'type':Sequelize['ENUM'](_0x3207('0x29'),'no'),'allowNull':!![]},'vmexten':{'type':Sequelize[_0x3207('0x3')],'allowNull':!![]},'mohinterpret':{'type':Sequelize[_0x3207('0x3')],'allowNull':!![]},'mohsuggest':{'type':Sequelize['STRING'],'allowNull':!![]},'parkinglot':{'type':Sequelize[_0x3207('0x3')],'allowNull':!![]},'canreinvite':{'type':Sequelize[_0x3207('0xd')](_0x3207('0x29'),'no',_0x3207('0x2a'),'update','update,nonat'),'allowNull':!![],'defaultValue':'no'},'loginInPause':{'type':Sequelize[_0x3207('0x16')],'defaultValue':![]},'resetPasswordToken':{'type':Sequelize[_0x3207('0x3')]},'resetPasswordExpires':{'type':Sequelize[_0x3207('0x17')]},'passwordResetAt':{'type':Sequelize['DATE'],'defaultValue':null},'previousPasswords':{'type':Sequelize[_0x3207('0x3d')]},'showWebBar':{'type':Sequelize[_0x3207('0x12')],'defaultValue':0x0,'set':function(_0xb83c91){this[_0x3207('0x5')]('showWebBar',_0xb83c91);var _0x22703b=this[_0x3207('0x3e')]({'plain':!![]});switch(_0xb83c91){case 0x0:case 0x1:var _0x269d5c=_0x22703b[_0x3207('0x22')]?_[_0x3207('0x3f')](_0x22703b[_0x3207('0x22')])?_0x22703b[_0x3207('0x22')]['join']():_0x22703b['transport']:_0x3207('0x40');if(_0x269d5c===_0x3207('0x41')){_0x269d5c=_0x3207('0x40');}this[_0x3207('0x5')](_0x3207('0x22'),_0x269d5c);this[_0x3207('0x5')](_0x3207('0x42'),'no');this[_0x3207('0x5')](_0x3207('0x43'),null);this['setDataValue'](_0x3207('0x44'),null);this[_0x3207('0x5')](_0x3207('0x45'),null);this[_0x3207('0x5')](_0x3207('0x46'),null);this['setDataValue'](_0x3207('0x47'),null);this[_0x3207('0x5')](_0x3207('0x48'),null);this[_0x3207('0x5')](_0x3207('0x49'),null);this['setDataValue']('dtlsprivatekey',null);this[_0x3207('0x5')](_0x3207('0x4a'),'no');break;case 0x2:this['setDataValue'](_0x3207('0x22'),_0x3207('0x41'));this['setDataValue'](_0x3207('0x42'),_0x3207('0x29'));this[_0x3207('0x5')](_0x3207('0x43'),_0x3207('0x29'));this[_0x3207('0x5')]('force_avp',_0x3207('0x29'));this[_0x3207('0x5')](_0x3207('0x45'),_0x3207('0x29'));this['setDataValue']('dtlsenable','yes');this[_0x3207('0x5')](_0x3207('0x47'),'no');this[_0x3207('0x5')]('dtlssetup',_0x3207('0x4b'));this[_0x3207('0x5')](_0x3207('0x49'),_0x22703b[_0x3207('0x49')]||'/etc/pki/tls/certs/motion.crt');this[_0x3207('0x5')]('dtlsprivatekey',_0x22703b[_0x3207('0x4c')]||_0x3207('0x4d'));this[_0x3207('0x5')](_0x3207('0x4a'),'yes');break;default:}}},'permissions':{'type':Sequelize[_0x3207('0x3d')],'set':function(_0x181a9b){this['setDataValue'](_0x3207('0x4e'),_0x181a9b?_0x181a9b[_0x3207('0x23')](','):[]);},'get':function(){return this[_0x3207('0xa')](_0x3207('0x4e'))?_[_0x3207('0x4f')](this['getDataValue'](_0x3207('0x4e'))['split'](','),function(_0x1ac278){return parseInt(_0x1ac278,0xa);}):[];}},'phoneBarUnconditionalNumber':{'type':Sequelize[_0x3207('0x3')]},'phoneBarNoReplyNumber':{'type':Sequelize[_0x3207('0x3')]},'phoneBarBusyNumber':{'type':Sequelize[_0x3207('0x3')]},'phoneBarUnconditional':{'type':Sequelize[_0x3207('0x16')],'defaultValue':![]},'phoneBarNoReply':{'type':Sequelize[_0x3207('0x16')],'defaultValue':![]},'phoneBarBusy':{'type':Sequelize[_0x3207('0x16')],'defaultValue':![]},'phoneBarDnd':{'type':Sequelize[_0x3207('0x16')],'defaultValue':!![]},'phoneBarUnansweredCallBadge':{'type':Sequelize[_0x3207('0x16')],'defaultValue':!![]},'phoneBarEnableDtmfTone':{'type':Sequelize[_0x3207('0x16')],'defaultValue':![]},'phoneBarAutoAnswerDelay':{'type':Sequelize[_0x3207('0x12')],'defaultValue':0x0},'extensionMonitor':{'type':Sequelize[_0x3207('0x3')],'defaultValue':''},'crudPermissions':{'type':Sequelize[_0x3207('0x12')],'defaultValue':0x0},'rtcp_mux':{'type':Sequelize[_0x3207('0xd')]('yes','no'),'defaultValue':'no'},'allowmessenger':{'type':Sequelize[_0x3207('0x16')],'defaultValue':!![]},'phoneBarOutboundProxy':{'type':Sequelize[_0x3207('0x3')]},'phoneBarEnableJaws':{'type':Sequelize[_0x3207('0x16')],'defaultValue':![]},'phoneBarEnableScreenRecordingByAgent':{'type':Sequelize[_0x3207('0x16')],'defaultValue':![]},'phoneBarEnableVideoRecording':{'type':Sequelize['VIRTUAL'],'get':function(){return this[_0x3207('0xa')](_0x3207('0x50'))?this[_0x3207('0xa')](_0x3207('0x50')):![];}},'phoneBarEnableAutomaticScreenRecording':{'type':Sequelize[_0x3207('0x16')],'defaultValue':![]},'phoneBarPrefixRequired':{'type':Sequelize[_0x3207('0x16')],'defaultValue':![]},'hotdesk':{'type':Sequelize[_0x3207('0x16')],'defaultValue':![]},'interface':{'type':Sequelize['STRING'],'defaultValue':null},'privacyEnabled':{'type':Sequelize[_0x3207('0x16')],'defaultValue':![]},'apiKeyNonce':{'type':Sequelize[_0x3207('0x3')],'allowNull':!![]},'apiKeyIat':{'type':Sequelize[_0x3207('0x3')],'allowNull':!![]},'screenrecording':{'type':Sequelize[_0x3207('0x16')],'defaultValue':![],'set':function(_0x216be9){if(typeof _0x216be9===_0x3207('0x51')){var _0x29ce58=_0x216be9==='1'?!![]:_0x216be9==='0'?![]:_0x216be9==='true'?!![]:_0x216be9===_0x3207('0x52')?![]:![];this[_0x3207('0x5')](_0x3207('0x53'),_0x29ce58);}else{this[_0x3207('0x5')](_0x3207('0x53'),_0x216be9);}}},'blocked':{'type':Sequelize[_0x3207('0x16')],'defaultValue':![],'set':function(_0x11a59f){this[_0x3207('0x5')]('blocked',_0x11a59f);if(_0x11a59f===!![]){this[_0x3207('0x5')](_0x3207('0x54'),moment());this[_0x3207('0x5')](_0x3207('0x55'),0x0);}else{this[_0x3207('0x5')](_0x3207('0x54'),null);}}},'blockedAt':{'type':Sequelize[_0x3207('0x17')],'defaultValue':null},'loginAttempts':{'type':Sequelize['INTEGER'],'defaultValue':0x0},'disabled':{'type':Sequelize[_0x3207('0x16')],'defaultValue':![]},'settingsEnabled':{'type':Sequelize[_0x3207('0x16')],'defaultValue':!![]},'wssPort':{'type':Sequelize[_0x3207('0x12')](0x5)[_0x3207('0x56')],'defaultValue':0x1f99},'downloadAttachments':{'type':Sequelize['BOOLEAN'],'defaultValue':!![]},'downloadOmnichannelInteractions':{'type':Sequelize[_0x3207('0x16')],'defaultValue':!![]},'downloadVoiceRecordings':{'type':Sequelize[_0x3207('0x16')],'defaultValue':!![]},'ignorePauseForPreviewCalls':{'type':Sequelize[_0x3207('0x16')],'defaultValue':![]},'selectRecallMeCampaign':{'type':Sequelize[_0x3207('0x16')],'defaultValue':![]},'adSsoEnabled':{'type':Sequelize[_0x3207('0x16')],'defaultValue':![]},'chatAutoanswer':{'type':Sequelize[_0x3207('0x16')],'defaultValue':![]},'chatAutoanswerDelay':{'type':Sequelize[_0x3207('0x12')],'defaultValue':0x0},'emailAutoanswer':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'emailAutoanswerDelay':{'type':Sequelize[_0x3207('0x12')],'defaultValue':0x0},'smsAutoanswer':{'type':Sequelize[_0x3207('0x16')],'defaultValue':![]},'smsAutoanswerDelay':{'type':Sequelize[_0x3207('0x12')],'defaultValue':0x0},'openchannelAutoanswer':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'openchannelAutoanswerDelay':{'type':Sequelize['INTEGER'],'defaultValue':0x0},'faxAutoanswer':{'type':Sequelize[_0x3207('0x16')],'defaultValue':![]},'faxAutoanswerDelay':{'type':Sequelize[_0x3207('0x12')],'defaultValue':0x0},'whatsappAutoanswer':{'type':Sequelize[_0x3207('0x16')],'defaultValue':![]},'whatsappAutoanswerDelay':{'type':Sequelize['INTEGER'],'defaultValue':0x0},'messengerSoundNotification':{'type':Sequelize[_0x3207('0x16')],'defaultValue':![]}}; \ No newline at end of file diff --git a/server/api/user/user.controller.js b/server/api/user/user.controller.js index d571b99..b0d74a9 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 _0xdc18=['pick','getVoiceQueuesRt','ChatGroup','order','getGroups','getRecordings','VoiceRecording','getScreenRecordings','ScreenRecording','UserId','getChatInteractions','getOpenchannelInteractions','OpenchannelInteraction','MailInteraction','SmsInteraction','getSmsInteractions','getFaxInteractions','getWhatsappInteractions','phone','mobile','LOCAL/%s@from-sip/n','intrf','user:%s','user:forcelogout','headers','x-forwarded-for','connection','socket','remoteAddress','transaction','commit','User\x20not\x20found\x20or\x20not\x20allowed\x20to\x20perform\x20login\x20method','getVoiceQueues','UserVoiceQueue.penalty','MemberReport','forEach','getChannels','YYYY-MM-DD\x20HH:mm:ss','LOGIN','device','LOGININPAUSE','resolve','logout','pause','PAUSE','type','DEFAULT\x20PAUSE','Channel\x20parameter\x20%s\x20is\x20invalid','mailPause','chatPause','faxPause','openchannelPause','smsPause','whatsappPause','pauseType','lastPauseAt','unpause','getTeams','addTeams','Team','getAssociatedQueues','flattenDeep','addAgent','Voice','TeamVoicePrefix','UserVoicePrefix','VoicePrefixId','getDataValue','removeTeams','Query\x20parameter\x20\x27ids\x27\x20is\x20required','removeAgent','getLists','getAgents','values','User\x20with\x20id\x20%s\x20not\x20found','CmHopper','addChatInteractions','user_has_chat_interactions:save','removeChatInteractions','user_has_chat_interactions:remove','addMailInteractions','user_has_mail_interactions:save','removeMailInteractions','user_has_mail_interactions:remove','addFaxInteractions','removeFaxInteractions','user_has_fax_interactions:remove','addSmsInteractions','user_has_sms_interactions:save','removeSmsInteractions','user_has_sms_interactions:remove','addOpenchannelInteractions','user_has_openchannel_interactions:save','removeOpenchannelInteractions','user_has_openchannel_interactions:remove','addWhatsappInteractions','user_has_whatsapp_interactions:save','removeWhatsappInteractions','VoicePrefix','getVoicePrefixes','getFaxAccounts','FaxAccount','addFaxAccounts','removeFaxAccounts','getMailAccounts','MailAccount','addMailAccounts','removeMailAccounts','getOpenchannelAccounts','OpenchannelAccount','addOpenchannelAccounts','getSmsAccounts','SmsAccount','addSmsAccounts','removeSmsAccounts','ChatWebsite','getChatWebsites','addChatWebsites','removeChatWebsites','getWhatsappAccounts','addWhatsappAccounts','removeWhatsappAccounts','$and','$or','$gt','$gte','$lte','$ne','$eq','$between','$notBetween','$notIn','$notILike','$overlap','$any','lastName','dialActive','token','No\x20API\x20access\x20key\x20found!','generateApiKey','iat','nonce','You\x20don\x27t\x20have\x20sufficient\x20privileges\x20to\x20access\x20this\x20resource.','removeApiKey','whoami','getUserSetting','idle','unknown','ringing','teams','queues','inbound','flatten','toString','lower','col','asc','desc','substring','uniqBy','getRealtimeAgents','offline','voiceStatus','unavailable','busy','slice','toUpperCase','select','field','ui.','user_has_','_interactions','ui.UserId\x20=\x20?','OpenTabs','messengerSoundNotification','enabled','moment','path','lodash','squel','ioredis','jayson/promise','../../components/auth/service','../../components/contacts','../../components/parsers/qs','api','../../config/utils','../../config/environment','../../config/license/util','../../errors/api','APIBadRequestError','handleError','../../mysqldb','socket.io-emitter','redis','register','defaults','localhost','status','end','undefined','limit','count','offset','Content-Range','json','request','then','info','User,\x20%s,\x20%s','request\x20sent','debug','User,\x20%s,\x20%s,\x20%s','error','code','message','result','update','role','agent','emit','userNotification:recalc:','destroy','get','Users','user','Telephones','telephone','filter','ignore','value','includes','name','UserProfileResource','sendStatus','stack','send','User','rawAttributes','map','salt','previousPasswords','resetPasswordToken','resetPasswordExpires','md5secret','index','getOptions','where','query','includeAll','userSetting','include','attributes','push','findAll','rows','openTabs','true','length','chat','sms','dataValues','fax','openchannel','whatsapp','all','catch','show','params','UserSetting','options','find','mail','body','describe','addContacts','ids','omit','internal','Setting','securePassword','validatePasswordPattern','password','max','min_internal','isNil','sequelize','select\x20(select\x20IFNULL(max(internal)+1,1)\x20from\x20users\x20where\x20internal\x20<\x20md.internal)\x20as\x20\x27from\x27,\x20md.internal\x20-\x201\x20as\x20\x27to\x27\x20from\x20users\x20md\x20where\x20md.internal\x20!=\x201\x20and\x20not\x20exists\x20(select\x201\x20from\x20users\x20md2\x20where\x20md2.internal\x20=\x20md.internal\x20-\x201)','QueryTypes','SELECT','from','voicemail','VoiceMail','fullname','permissions','103','113','110','104','105','107','108','109','100','111','114','create','Unauthorized','admin','Unauthorized.\x20You\x20must\x20be\x20an\x20administrator\x20in\x20order\x20to\x20create\x20another\x20administrator','settingsEnabled','userProfileId','UserProfileSection','Agents','autoAssociation','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','bulkCreate','Unauthorized.\x20You\x20must\x20be\x20an\x20administrator\x20in\x20order\x20to\x20create\x20an\x20user','some','Unauthorized.\x20You\x20must\x20be\x20an\x20administrator\x20in\x20order\x20to\x20create\x20an\x20administrator','compact','oldPassword','newPassword','Sequelize','ValidationError','authenticate','Wrong\x20credentials','New\x20password\x20must\x20be\x20different\x20from\x20old\x20password','Invalid\x20body\x20format.\x20Use\x20newPassword','findOne','enforcePasswordHistory','passwordHistoryLimit','validatePasswordHistory','channel','online','loginInPause','voicePause','interface','isValidChannel','add','capitalize','toLowerCase','Queues','spread','QueueId','Queue:save','voice','VoiceQueue','format','SIP/%s','penalty','upsert','removeQueues','remove','isArray','Queue:remove','UserVoiceQueueRt','userpic','filename','getAvatar','join','root','server/files/images/logos/default_profile.png','download','existsSync','server/files/images/','ChatOpenTabs','CHAT','createdAt','FaxOpenTabs','FAX','OpenchannelOpenTabs','OPENCHANNEL','MailOpenTabs','MAIL','WHATSAPP','concat','getContacts','hasOwnProperty','CmList','List','Tag','Tags','color','tag','Unknown\x20channel','model','keys','Queue','filters','intersection','fields','sort','merge','Unknown\x20role','nolimit'];(function(_0x2f5ac5,_0x1ee939){var _0x37c9a8=function(_0x15031f){while(--_0x15031f){_0x2f5ac5['push'](_0x2f5ac5['shift']());}};_0x37c9a8(++_0x1ee939);}(_0xdc18,0xb0));var _0x8dc1=function(_0xf389bb,_0x11bce6){_0xf389bb=_0xf389bb-0x0;var _0xb03f28=_0xdc18[_0xf389bb];return _0xb03f28;};'use strict';var moment=require(_0x8dc1('0x0'));var util=require('util');var path=require(_0x8dc1('0x1'));var fs=require('fs');var _=require(_0x8dc1('0x2'));var squel=require(_0x8dc1('0x3'));var Redis=require(_0x8dc1('0x4'));var jayson=require(_0x8dc1('0x5'));var authService=require(_0x8dc1('0x6'));var contacts=require(_0x8dc1('0x7'));var qs=require(_0x8dc1('0x8'));var rta=require('../../components/realtime/agents');var logger=require('../../config/logger')(_0x8dc1('0x9'));var utils=require(_0x8dc1('0xa'));var config=require(_0x8dc1('0xb'));var licenseUtil=require(_0x8dc1('0xc'));var APIBadRequestError=require(_0x8dc1('0xd'))[_0x8dc1('0xe')];var APINotFoundError=require('../../errors/api')['APINotFoundError'];var APIForbiddenError=require('../../errors/api')['APIForbiddenrror'];var APIHandleError=require(_0x8dc1('0xd'))[_0x8dc1('0xf')];var db=require(_0x8dc1('0x10'))['db'];var socket=require(_0x8dc1('0x11'))(new Redis(config[_0x8dc1('0x12')]));require('./user.socket')[_0x8dc1('0x13')](socket);config['redis']=_[_0x8dc1('0x14')](config['redis'],{'host':_0x8dc1('0x15'),'port':0x18eb});var amiClient=jayson['client']['http']({'port':0x232a});var values;function respondWithStatusCode(_0x2816ce,_0x37018c){_0x37018c=_0x37018c||0xcc;return function(_0xd71e47){if(_0xd71e47){return _0x2816ce['sendStatus'](_0x37018c);}return _0x2816ce[_0x8dc1('0x16')](_0x37018c)[_0x8dc1('0x17')]();};}function respondWithResult(_0x1f6d30,_0xf2730b){_0xf2730b=_0xf2730b||0xc8;return function(_0x59768c){if(_0x59768c){return _0x1f6d30[_0x8dc1('0x16')](_0xf2730b)['json'](_0x59768c);}};}function respondWithFilteredResult(_0x41e11a,_0x3e87d7){return function(_0x5810b9){if(_0x5810b9){var _0x5bc5f7=typeof _0x3e87d7['offset']===_0x8dc1('0x18')&&typeof _0x3e87d7[_0x8dc1('0x19')]===_0x8dc1('0x18');var _0x39ee91=_0x5810b9[_0x8dc1('0x1a')];var _0x503d88=_0x5bc5f7?0x0:_0x3e87d7[_0x8dc1('0x1b')];var _0x53dcbc=_0x5bc5f7?_0x5810b9[_0x8dc1('0x1a')]:_0x3e87d7[_0x8dc1('0x1b')]+_0x3e87d7[_0x8dc1('0x19')];var _0x26c3f5;if(_0x53dcbc>=_0x39ee91){_0x53dcbc=_0x39ee91;_0x26c3f5=0xc8;}else{_0x26c3f5=0xce;}_0x41e11a[_0x8dc1('0x16')](_0x26c3f5);return _0x41e11a['set'](_0x8dc1('0x1c'),_0x503d88+'-'+_0x53dcbc+'/'+_0x39ee91)[_0x8dc1('0x1d')](_0x5810b9);}return null;};}function respondWithRpcPromise(_0x51df5e,_0x56734d,_0x535929,_0x35df06){return new Promise(function(_0x1bd8bc,_0x2d62a9){var _0x351a1f=_0x35df06||amiClient;return _0x351a1f[_0x8dc1('0x1e')](_0x51df5e,_0x535929)[_0x8dc1('0x1f')](function(_0x5060cd){logger[_0x8dc1('0x20')](_0x8dc1('0x21'),_0x56734d,_0x8dc1('0x22'));logger[_0x8dc1('0x23')](_0x8dc1('0x24'),_0x56734d,_0x8dc1('0x22'),JSON['stringify'](_0x5060cd));if(_0x5060cd['error']){if(_0x5060cd[_0x8dc1('0x25')][_0x8dc1('0x26')]===0x1f4){logger[_0x8dc1('0x25')](_0x8dc1('0x21'),_0x56734d,_0x5060cd[_0x8dc1('0x25')][_0x8dc1('0x27')]);return _0x2d62a9(_0x5060cd['error'][_0x8dc1('0x27')]);}logger[_0x8dc1('0x25')]('User,\x20%s,\x20%s',_0x56734d,_0x5060cd['error'][_0x8dc1('0x27')]);return _0x1bd8bc(_0x5060cd[_0x8dc1('0x25')][_0x8dc1('0x27')]);}else{logger[_0x8dc1('0x20')](_0x8dc1('0x21'),_0x56734d,_0x8dc1('0x22'));_0x1bd8bc(_0x5060cd[_0x8dc1('0x28')][_0x8dc1('0x27')]);}})['catch'](function(_0x686a08){logger[_0x8dc1('0x25')]('User,\x20%s,\x20%s',_0x56734d,_0x686a08);_0x2d62a9(_0x686a08);});});}function saveUpdates(_0x2986d9){return function(_0x43b59a){if(_0x43b59a){return _0x43b59a[_0x8dc1('0x29')](_0x2986d9)[_0x8dc1('0x1f')](function(_0x3b7ffb){if(_0x3b7ffb[_0x8dc1('0x2a')]===_0x8dc1('0x2b')){socket[_0x8dc1('0x2c')](_0x8dc1('0x2d')+_0x3b7ffb['id'],_0x3b7ffb);}return _0x3b7ffb;});}return null;};}function removeEntity(_0x4aa79a,_0x2e7ac9){return function(_0x562532){if(_0x562532){return _0x562532[_0x8dc1('0x2e')]({'transaction':_0x2e7ac9})[_0x8dc1('0x1f')](function(){var _0x41c1ad=_0x562532[_0x8dc1('0x2f')]({'plain':!![]});if(_0x41c1ad[_0x8dc1('0x2a')]==='admin')return;var _0x24bab7=[{'name':_0x8dc1('0x30'),'value':_0x8dc1('0x31'),'ignore':!![]},{'name':'Agents','value':'agent','ignore':![]},{'name':_0x8dc1('0x32'),'value':_0x8dc1('0x33'),'ignore':![]}];var _0xee85de=_(_0x24bab7)[_0x8dc1('0x34')](_0x8dc1('0x35'))['map'](_0x8dc1('0x36'))['value']();if(_[_0x8dc1('0x37')](_0xee85de,_0x41c1ad['role'])){return;}var _0x3d5129=_['find'](_0x24bab7,[_0x8dc1('0x36'),_0x41c1ad['role']])[_0x8dc1('0x38')];return db[_0x8dc1('0x39')]['destroy']({'where':{'type':_0x3d5129,'resourceId':_0x41c1ad['id']},'transaction':_0x2e7ac9})['then'](function(){return _0x562532;});})['then'](function(){_0x4aa79a[_0x8dc1('0x16')](0xcc)[_0x8dc1('0x17')]();});}};}function handleEntityNotFound(_0x4d653c){return function(_0x263a12){if(!_0x263a12){_0x4d653c[_0x8dc1('0x3a')](0x194);}return _0x263a12;};}function handleError(_0x2e208c,_0x2c7ac0){_0x2c7ac0=_0x2c7ac0||0x1f4;return function(_0x59e700){logger[_0x8dc1('0x25')](_0x59e700[_0x8dc1('0x3b')]);if(_0x59e700[_0x8dc1('0x38')]){delete _0x59e700[_0x8dc1('0x38')];}_0x2e208c[_0x8dc1('0x16')](_0x2c7ac0)[_0x8dc1('0x3c')](_0x59e700);};}function getUserAttributes(){return _(db[_0x8dc1('0x3d')][_0x8dc1('0x3e')])[_0x8dc1('0x3f')](function(_0x488f9b){return{'name':_0x488f9b['fieldName'],'type':_0x488f9b['type']['key']};})[_0x8dc1('0x34')](function(_0x4bcaa0){return!['password',_0x8dc1('0x40'),_0x8dc1('0x41'),_0x8dc1('0x42'),_0x8dc1('0x43'),_0x8dc1('0x44')][_0x8dc1('0x37')](_0x4bcaa0[_0x8dc1('0x38')]);})[_0x8dc1('0x36')]();}exports[_0x8dc1('0x45')]=function(_0x5605a1,_0x55d21b){var _0x3cb484={},_0x2622b2={'count':0x0,'rows':[]};var _0xdcf6bf=getUserAttributes();_0x3cb484=qs[_0x8dc1('0x46')](_0xdcf6bf,_0x5605a1);var _0x337aae={'where':_0x3cb484[_0x8dc1('0x47')]};return db[_0x8dc1('0x3d')][_0x8dc1('0x1a')](_0x337aae)[_0x8dc1('0x1f')](function(_0x1d1dc6){_0x2622b2[_0x8dc1('0x1a')]=_0x1d1dc6;if(_0x5605a1[_0x8dc1('0x48')][_0x8dc1('0x49')]){_0x3cb484['include']=[{'all':!![]}];}if(_0x5605a1[_0x8dc1('0x48')][_0x8dc1('0x4a')]==='true'){_0x3cb484[_0x8dc1('0x4b')]=[{'model':db['UserSetting'],'as':'userSetting'}];}if(!_[_0x8dc1('0x37')](_0x3cb484[_0x8dc1('0x4c')],'id')){_0x3cb484[_0x8dc1('0x4c')][_0x8dc1('0x4d')]('id');}return db['User'][_0x8dc1('0x4e')](_0x3cb484);})[_0x8dc1('0x1f')](function(_0x1ea516){_0x2622b2[_0x8dc1('0x4f')]=_0x1ea516;if(_0x5605a1[_0x8dc1('0x48')][_0x8dc1('0x50')]===_0x8dc1('0x51')){var _0x1f5aaa=[];for(var _0x4e95b7=0x0;_0x4e95b7<_0x2622b2[_0x8dc1('0x4f')][_0x8dc1('0x52')];_0x4e95b7++){_0x1f5aaa[_0x8dc1('0x4d')](get_open_tabs(_0x8dc1('0x53'),_0x2622b2['rows'][_0x4e95b7]['dataValues']));_0x1f5aaa[_0x8dc1('0x4d')](get_open_tabs(_0x8dc1('0x54'),_0x2622b2[_0x8dc1('0x4f')][_0x4e95b7][_0x8dc1('0x55')]));_0x1f5aaa[_0x8dc1('0x4d')](get_open_tabs(_0x8dc1('0x56'),_0x2622b2[_0x8dc1('0x4f')][_0x4e95b7][_0x8dc1('0x55')]));_0x1f5aaa[_0x8dc1('0x4d')](get_open_tabs('mail',_0x2622b2[_0x8dc1('0x4f')][_0x4e95b7][_0x8dc1('0x55')]));_0x1f5aaa[_0x8dc1('0x4d')](get_open_tabs(_0x8dc1('0x57'),_0x2622b2[_0x8dc1('0x4f')][_0x4e95b7][_0x8dc1('0x55')]));_0x1f5aaa[_0x8dc1('0x4d')](get_open_tabs(_0x8dc1('0x58'),_0x2622b2['rows'][_0x4e95b7][_0x8dc1('0x55')]));}return Promise[_0x8dc1('0x59')](_0x1f5aaa)['then'](function(){return _0x2622b2;});}else{return _0x2622b2;}})[_0x8dc1('0x1f')](respondWithFilteredResult(_0x55d21b,_0x3cb484))[_0x8dc1('0x5a')](handleError(_0x55d21b,null));};exports[_0x8dc1('0x5b')]=function(_0xa478f,_0x336f5a){var _0x1fde70=getUserAttributes();_0xa478f[_0x8dc1('0x48')]['id']=_0xa478f[_0x8dc1('0x5c')]['id'];var _0x1e74c0=qs[_0x8dc1('0x46')](_0x1fde70,_0xa478f);if(_0xa478f[_0x8dc1('0x48')][_0x8dc1('0x49')]){_0x1e74c0[_0x8dc1('0x4b')]=[{'all':!![]}];}if(_0xa478f[_0x8dc1('0x48')][_0x8dc1('0x4a')]===_0x8dc1('0x51')){_0x1e74c0[_0x8dc1('0x4b')]=[{'model':db[_0x8dc1('0x5d')],'as':_0x8dc1('0x4a')}];}_0x1e74c0=_['merge']({},_0x1e74c0,_0xa478f[_0x8dc1('0x5e')]);if(!_[_0x8dc1('0x37')](_0x1e74c0[_0x8dc1('0x4c')],'id')){_0x1e74c0[_0x8dc1('0x4c')]['push']('id');}return db['User'][_0x8dc1('0x5f')](_0x1e74c0)['then'](handleEntityNotFound(_0x336f5a,null))['then'](function(_0x1255b3){var _0x59139c=[];values=_0x1255b3;if(_0xa478f[_0x8dc1('0x48')]['openTabs']===_0x8dc1('0x51')){_0x59139c[_0x8dc1('0x4d')](get_open_tabs('chat',_0x1255b3[_0x8dc1('0x55')]));_0x59139c[_0x8dc1('0x4d')](get_open_tabs('sms',_0x1255b3[_0x8dc1('0x55')]));_0x59139c[_0x8dc1('0x4d')](get_open_tabs('openchannel',_0x1255b3['dataValues']));_0x59139c['push'](get_open_tabs(_0x8dc1('0x58'),_0x1255b3[_0x8dc1('0x55')]));_0x59139c['push'](get_open_tabs('fax',_0x1255b3[_0x8dc1('0x55')]));_0x59139c[_0x8dc1('0x4d')](get_open_tabs(_0x8dc1('0x60'),_0x1255b3[_0x8dc1('0x55')]));return Promise[_0x8dc1('0x59')](_0x59139c);}else{return values;}})[_0x8dc1('0x1f')](function(){return values;})[_0x8dc1('0x1f')](respondWithResult(_0x336f5a,null))[_0x8dc1('0x5a')](handleError(_0x336f5a,null));};exports['update']=function(_0x18d27d,_0x28c667){if(_0x18d27d['body']['id']){delete _0x18d27d[_0x8dc1('0x61')]['id'];}delete _0x18d27d[_0x8dc1('0x61')]['role'];return db[_0x8dc1('0x3d')][_0x8dc1('0x5f')]({'where':{'id':_0x18d27d[_0x8dc1('0x5c')]['id']}})['then'](handleEntityNotFound(_0x28c667,null))[_0x8dc1('0x1f')](saveUpdates(_0x18d27d['body'],null))[_0x8dc1('0x1f')](respondWithResult(_0x28c667,null))['catch'](handleError(_0x28c667,null));};exports[_0x8dc1('0x62')]=function(_0x4509b8,_0x37e662){return db[_0x8dc1('0x3d')]['describe']()[_0x8dc1('0x1f')](respondWithResult(_0x37e662,null))[_0x8dc1('0x5a')](handleError(_0x37e662,null));};exports['addContacts']=function(_0x37cb6a,_0x15f0db){return db['User']['find']({'where':{'id':_0x37cb6a[_0x8dc1('0x5c')]['id']}})[_0x8dc1('0x1f')](handleEntityNotFound(_0x15f0db,null))[_0x8dc1('0x1f')](function(_0x4a5dc3){if(_0x4a5dc3){return _0x4a5dc3[_0x8dc1('0x63')](_0x37cb6a[_0x8dc1('0x61')][_0x8dc1('0x64')],_[_0x8dc1('0x65')](_0x37cb6a[_0x8dc1('0x61')],[_0x8dc1('0x64'),'id'])||{});}})[_0x8dc1('0x1f')](respondWithResult(_0x15f0db,null))[_0x8dc1('0x5a')](handleError(_0x15f0db,null));};function validateUser(_0x5ca740){return new Promise(function(_0x531d95,_0x26a4ea){if(_0x5ca740[_0x8dc1('0x66')])return _0x531d95(_0x5ca740);return db[_0x8dc1('0x67')]['findById'](0x1)['then'](function(_0xd58fe4){if(_0xd58fe4[_0x8dc1('0x68')])authService[_0x8dc1('0x69')](_0x5ca740[_0x8dc1('0x6a')]);db[_0x8dc1('0x3d')][_0x8dc1('0x6b')]('internal')['then'](function(_0x47d163){if(_['isNil'](_0x47d163)){_0x5ca740[_0x8dc1('0x66')]=_0xd58fe4[_0x8dc1('0x6c')]||0x1;return;}if(_[_0x8dc1('0x6d')](_0xd58fe4['min_internal'])||_0xd58fe4[_0x8dc1('0x6c')]===_0x47d163){_0x5ca740[_0x8dc1('0x66')]=_0x47d163+0x1;return;}if(_0xd58fe4['min_internal']>_0x47d163){_0x5ca740[_0x8dc1('0x66')]=_0xd58fe4[_0x8dc1('0x6c')];return;}return db[_0x8dc1('0x6e')][_0x8dc1('0x48')](_0x8dc1('0x6f'),{'type':db[_0x8dc1('0x6e')][_0x8dc1('0x70')][_0x8dc1('0x71')]})['then'](function(_0x582a0){if(_0x582a0&&_0x582a0[_0x8dc1('0x52')]){for(var _0x969147=0x0,_0x5b406b=_0x582a0[_0x8dc1('0x52')];_0x969147<_0x5b406b&&_[_0x8dc1('0x6d')](_0x5ca740['internal']);_0x969147++){if(_0xd58fe4[_0x8dc1('0x6c')]<=_0x582a0[_0x969147][_0x8dc1('0x72')]){_0x5ca740['internal']=_0x582a0[_0x969147]['from'];}else if(_0xd58fe4[_0x8dc1('0x6c')]>_0x582a0[_0x969147][_0x8dc1('0x72')]&&_0xd58fe4['min_internal']<=_0x582a0[_0x969147]['to']){_0x5ca740[_0x8dc1('0x66')]=_0xd58fe4[_0x8dc1('0x6c')];}}}if(_[_0x8dc1('0x6d')](_0x5ca740[_0x8dc1('0x66')])){_0x5ca740[_0x8dc1('0x66')]=_0x47d163+0x1;}return _0x531d95(_0x5ca740);});});})['catch'](function(_0x5330fc){_0x26a4ea(_0x5330fc);});});}function updateUser(_0x453e2e){return new Promise(function(_0x5a4150,_0x35b956){try{if(_0x453e2e[_0x8dc1('0x73')]){_0x453e2e['mailbox']=_0x453e2e[_0x8dc1('0x66')];_0x453e2e[_0x8dc1('0x74')]={'mailbox':_0x453e2e[_0x8dc1('0x66')],'password':_0x453e2e[_0x8dc1('0x6a')],'fullname':_0x453e2e[_0x8dc1('0x75')],'email':_0x453e2e['email']};}if(_0x453e2e[_0x8dc1('0x2a')]==='agent'){if(!_0x453e2e[_0x8dc1('0x76')])_0x453e2e[_0x8dc1('0x76')]=['101','102',_0x8dc1('0x77'),_0x8dc1('0x78'),_0x8dc1('0x79'),_0x8dc1('0x7a'),_0x8dc1('0x7b'),'106',_0x8dc1('0x7c'),_0x8dc1('0x7d'),_0x8dc1('0x7e'),_0x8dc1('0x7f'),_0x8dc1('0x80'),_0x8dc1('0x81'),'115'];}_0x5a4150(_0x453e2e);}catch(_0x111c95){_0x35b956(_0x111c95);}});}exports[_0x8dc1('0x82')]=function(_0x4c1a1c,_0x59059a){if(_0x4c1a1c['user'][_0x8dc1('0x2a')]==='agent')throw new Error(_0x8dc1('0x83'));if(_0x4c1a1c[_0x8dc1('0x61')][_0x8dc1('0x2a')]===_0x8dc1('0x31')&&_0x4c1a1c[_0x8dc1('0x31')][_0x8dc1('0x2a')]!=='admin'){throw new Error('Unauthorized.\x20You\x20must\x20be\x20an\x20administrator\x20in\x20order\x20to\x20create\x20an\x20user');}if(_0x4c1a1c['body']['role']===_0x8dc1('0x84')&&_0x4c1a1c[_0x8dc1('0x31')]['role']!==_0x8dc1('0x84')){throw new Error(_0x8dc1('0x85'));}return licenseUtil['checkUserLimits']([_0x4c1a1c[_0x8dc1('0x61')]])[_0x8dc1('0x1f')](function(){return validateUser(_0x4c1a1c[_0x8dc1('0x61')]);})[_0x8dc1('0x1f')](function(_0x2d9cab){return updateUser(_0x2d9cab)[_0x8dc1('0x1f')](function(_0x361115){if(_0x361115['role']===_0x8dc1('0x84')){_0x361115[_0x8dc1('0x86')]=_0x4c1a1c[_0x8dc1('0x31')][_0x8dc1('0x86')];delete _0x361115[_0x8dc1('0x87')];}return _0x361115;});})[_0x8dc1('0x1f')](function(_0x431988){return db[_0x8dc1('0x3d')][_0x8dc1('0x82')](_0x431988,{'include':[{'model':db['VoiceMail'],'as':_0x8dc1('0x74')}]});})[_0x8dc1('0x1f')](function(_0x406447){if(_0x4c1a1c['body'][_0x8dc1('0x2a')]===_0x8dc1('0x31'))return _0x406447;if(_0x4c1a1c[_0x8dc1('0x31')][_0x8dc1('0x2a')]!==_0x8dc1('0x31'))return _0x406447;return db[_0x8dc1('0x88')][_0x8dc1('0x5f')]({'where':{'name':_0x406447[_0x8dc1('0x2a')]==='agent'?_0x8dc1('0x89'):_0x8dc1('0x32'),'userProfileId':_0x4c1a1c[_0x8dc1('0x31')]['userProfileId']},'raw':!![]})[_0x8dc1('0x1f')](function(_0x37c941){if(!_0x37c941||_0x37c941[_0x8dc1('0x8a')]!=0x0)return _0x406447;return db[_0x8dc1('0x39')][_0x8dc1('0x82')]({'name':_0x406447[_0x8dc1('0x38')],'resourceId':_0x406447['id'],'type':_0x37c941[_0x8dc1('0x38')],'sectionId':_0x37c941['id']},{})['then'](function(){return _0x406447;});})[_0x8dc1('0x5a')](function(_0x158461){logger[_0x8dc1('0x25')](_0x8dc1('0x8b'),_0x158461);throw _0x158461;});})[_0x8dc1('0x1f')](respondWithResult(_0x59059a,0xc9))[_0x8dc1('0x5a')](handleError(_0x59059a,null));};exports[_0x8dc1('0x8c')]=function(_0xed3436,_0x1803e1){var _0x174672=_0xed3436['body'];var _0x4c94eb=[];if(_0xed3436[_0x8dc1('0x31')][_0x8dc1('0x2a')]===_0x8dc1('0x2b'))throw new Error(_0x8dc1('0x83'));if(_['some'](_0x174672,[_0x8dc1('0x2a'),_0x8dc1('0x31')])&&_0xed3436['user'][_0x8dc1('0x2a')]!==_0x8dc1('0x84')){throw new Error(_0x8dc1('0x8d'));}if(_[_0x8dc1('0x8e')](_0x174672,[_0x8dc1('0x2a'),_0x8dc1('0x84')])&&_0xed3436[_0x8dc1('0x31')][_0x8dc1('0x2a')]!==_0x8dc1('0x84')){throw new Error(_0x8dc1('0x8f'));}return licenseUtil['checkUserLimits'](_0x174672)['then'](function(){return validateUser(_0x174672[0x0]);})[_0x8dc1('0x1f')](function(){for(var _0x421581=0x1;_0x421581<_0x174672[_0x8dc1('0x52')];_0x421581++){var _0x108b3f=_0x174672[_0x421581-0x1][_0x8dc1('0x66')];if(!_0x174672[_0x421581][_0x8dc1('0x66')])_0x174672[_0x421581][_0x8dc1('0x66')]=_0x108b3f+0x1;_0x4c94eb[_0x8dc1('0x4d')](validateUser(_0x174672[_0x421581]));}return Promise[_0x8dc1('0x59')](_0x4c94eb);})[_0x8dc1('0x1f')](function(){_0x4c94eb=[];for(var _0x3f2cad=0x0;_0x3f2cad<_0x174672[_0x8dc1('0x52')];_0x3f2cad++){_0x4c94eb['push'](updateUser(_0x174672[_0x3f2cad]));}return Promise[_0x8dc1('0x59')](_0x4c94eb);})[_0x8dc1('0x1f')](function(){_0x4c94eb=_0x174672['map'](function(_0x3ec086){return db[_0x8dc1('0x3d')][_0x8dc1('0x82')](_0x3ec086,{'include':[{'model':db['VoiceMail'],'as':_0x8dc1('0x74')}]})[_0x8dc1('0x1f')](function(_0x53834d){_0x3ec086['id']=_0x53834d['id'];return _0x3ec086;});});return Promise['all'](_0x4c94eb);})[_0x8dc1('0x1f')](function(_0x32f450){if(_0xed3436[_0x8dc1('0x61')][_0x8dc1('0x2a')]===_0x8dc1('0x31'))return _0x32f450;if(_0xed3436['user'][_0x8dc1('0x2a')]!==_0x8dc1('0x31'))return _0x32f450;var _0x4b66ae=_[_0x8dc1('0x8e')](_0x32f450,function(_0x1a84c8){return _0x1a84c8[_0x8dc1('0x2a')]==='agent'||_0x1a84c8['role']==='telephone';});if(!_0x4b66ae)return _0x32f450;return db['UserProfileSection']['findAll']({'where':{'name':{'$or':[_0x8dc1('0x89'),_0x8dc1('0x32')]},'userProfileId':_0xed3436[_0x8dc1('0x31')][_0x8dc1('0x87')]},'raw':!![]})['then'](function(_0x553e75){if(_['isEmpty'](_0x553e75)||!_[_0x8dc1('0x8e')](_0x553e75,[_0x8dc1('0x8a'),0x0]))return _0x32f450;_0x4c94eb=[];var _0x15afaf=_(_0x553e75)[_0x8dc1('0x3f')](function(_0x4a7a32){if(_0x4a7a32[_0x8dc1('0x8a')]===0x1)return;return _0x4a7a32[_0x8dc1('0x38')]===_0x8dc1('0x89')?_0x8dc1('0x2b'):_0x8dc1('0x33');})[_0x8dc1('0x90')]()['value']();for(var _0x44028d=0x0;_0x44028d<_0x32f450['length'];_0x44028d++){if(!_[_0x8dc1('0x37')](_0x15afaf,_0x32f450[_0x44028d][_0x8dc1('0x2a')]))return;var _0x1d8e94=_0x32f450[_0x44028d][_0x8dc1('0x2a')]===_0x8dc1('0x2b')?_0x8dc1('0x89'):_0x8dc1('0x32');_0x4c94eb[_0x8dc1('0x4d')](db[_0x8dc1('0x39')]['create']({'name':_0x32f450[_0x44028d][_0x8dc1('0x38')],'resourceId':_0x32f450[_0x44028d]['id'],'type':_0x1d8e94,'sectionId':_[_0x8dc1('0x5f')](_0x553e75,[_0x8dc1('0x38'),_0x1d8e94])['id']},{}));}return Promise['all'](_0x4c94eb);});})[_0x8dc1('0x1f')](respondWithResult(_0x1803e1,0xc9))[_0x8dc1('0x5a')](handleError(_0x1803e1,null));};exports['changePassword']=function(_0x5ab079,_0x5ad117){if(_0x5ab079[_0x8dc1('0x61')]['id']){delete _0x5ab079[_0x8dc1('0x61')]['id'];}return db[_0x8dc1('0x3d')]['find']({'where':{'id':_0x5ab079[_0x8dc1('0x5c')]['id']}})['then'](function(_0x41c669){if(!_0x41c669)return null;if(_0x41c669['id']===_0x5ab079[_0x8dc1('0x31')]['id']){if(!_0x5ab079['body'][_0x8dc1('0x91')]||!_0x5ab079['body'][_0x8dc1('0x92')]){throw new db[(_0x8dc1('0x93'))][(_0x8dc1('0x94'))]('Invalid\x20body\x20format.\x20Use\x20oldPassword\x20and\x20newPassword');}if(!_0x41c669[_0x8dc1('0x95')](_0x5ab079[_0x8dc1('0x61')][_0x8dc1('0x91')])){throw new db['Sequelize'][(_0x8dc1('0x94'))](_0x8dc1('0x96'));}if(_0x5ab079['body'][_0x8dc1('0x91')]===_0x5ab079[_0x8dc1('0x61')][_0x8dc1('0x92')]){throw new db[(_0x8dc1('0x93'))][(_0x8dc1('0x94'))](_0x8dc1('0x97'));}}else if(_0x5ab079[_0x8dc1('0x31')]['role']==='admin'){if(!_0x5ab079[_0x8dc1('0x61')]['newPassword']){throw new db[(_0x8dc1('0x93'))]['ValidationError'](_0x8dc1('0x98'));}}else if(_0x5ab079['user'][_0x8dc1('0x2a')]===_0x8dc1('0x31')){if(!_0x5ab079['body'][_0x8dc1('0x92')]){throw new db[(_0x8dc1('0x93'))][(_0x8dc1('0x94'))]('Invalid\x20body\x20format.\x20Use\x20newPassword');}if(_0x41c669[_0x8dc1('0x2a')]!=='agent'){throw new db[(_0x8dc1('0x93'))][(_0x8dc1('0x94'))](_0x8dc1('0x83'));}}else{throw new db[(_0x8dc1('0x93'))]['ValidationError'](_0x8dc1('0x83'));}return _0x41c669;})[_0x8dc1('0x1f')](handleEntityNotFound(_0x5ad117,null))['then'](function(_0x23ed60){return db[_0x8dc1('0x67')][_0x8dc1('0x99')]({'attributes':['id',_0x8dc1('0x68'),_0x8dc1('0x9a'),_0x8dc1('0x9b')]})[_0x8dc1('0x1f')](function(_0x1e7673){if(_0x1e7673[_0x8dc1('0x68')])authService[_0x8dc1('0x69')](_0x5ab079[_0x8dc1('0x61')]['newPassword']);if(!_0x1e7673[_0x8dc1('0x9a')]||!_0x23ed60[_0x8dc1('0x41')])return _0x23ed60;authService[_0x8dc1('0x9c')](_0x5ab079[_0x8dc1('0x61')]['newPassword'],_0x23ed60[_0x8dc1('0x41')],_0x1e7673[_0x8dc1('0x9b')]);return _0x23ed60;})[_0x8dc1('0x1f')](saveUpdates({'password':_0x5ab079[_0x8dc1('0x61')][_0x8dc1('0x92')],'passwordResetAt':_0x5ab079[_0x8dc1('0x31')]['id']==_0x5ab079['params']['id']?moment():null,'previousPasswords':authService['updatePasswordsHistory'](_0x5ab079[_0x8dc1('0x61')][_0x8dc1('0x92')],_0x23ed60['previousPasswords'])},null));})[_0x8dc1('0x1f')](respondWithResult(_0x5ad117,null))[_0x8dc1('0x5a')](handleError(_0x5ad117,null));};exports['addQueues']=function(_0x4aad73,_0x401450){var _0x6e5ac1=_0x4aad73[_0x8dc1('0x61')][_0x8dc1('0x9d')];return db[_0x8dc1('0x3d')][_0x8dc1('0x5f')]({'where':{'id':_0x4aad73['params']['id']},'attributes':['id','name',_0x8dc1('0x2a'),_0x8dc1('0x9e'),_0x8dc1('0x9f'),_0x8dc1('0xa0'),_0x8dc1('0xa1')]})[_0x8dc1('0x1f')](handleEntityNotFound(_0x401450,null))[_0x8dc1('0x1f')](function(_0x253359){if(_0x253359){if(!utils[_0x8dc1('0xa2')](_0x6e5ac1)){throw new db[(_0x8dc1('0x93'))][(_0x8dc1('0x94'))]('Unknown\x20channel');}return _0x253359[_0x8dc1('0xa3')+_[_0x8dc1('0xa4')](_0x6e5ac1[_0x8dc1('0xa5')]())+_0x8dc1('0xa6')](_0x4aad73[_0x8dc1('0x61')][_0x8dc1('0x64')],{'penalty':_0x4aad73[_0x8dc1('0x61')]['penalty']||0x0})[_0x8dc1('0xa7')](function(_0x25ee55){for(var _0x59024b=0x0;_0x59024b<_0x4aad73[_0x8dc1('0x61')][_0x8dc1('0x64')][_0x8dc1('0x52')];_0x59024b+=0x1){var _0xb394bc={'UserId':Number(_0x4aad73['params']['id'])};_0xb394bc[_[_0x8dc1('0xa4')](_0x6e5ac1[_0x8dc1('0xa5')]())+_0x8dc1('0xa8')]=Number(_0x4aad73[_0x8dc1('0x61')][_0x8dc1('0x64')][_0x59024b]);socket[_0x8dc1('0x2c')]('user'+_['capitalize'](_0x6e5ac1[_0x8dc1('0xa5')]())+_0x8dc1('0xa9'),_0xb394bc);}return _0x25ee55;})[_0x8dc1('0x1f')](function(){if(_0x6e5ac1===_0x8dc1('0xaa')){return db[_0x8dc1('0xab')][_0x8dc1('0x4e')]({'where':{'id':_0x4aad73[_0x8dc1('0x61')][_0x8dc1('0x64')]||[]},'raw':!![],'attributes':['id','name']});}})['then'](function(_0x2c51a9){var _0x14ba8d=_0x253359[_0x8dc1('0x2f')]({'plain':!![]});var _0x40895f=[];if(_0x6e5ac1===_0x8dc1('0xaa')&&_0x14ba8d['role']===_0x8dc1('0x2b')&&_0x14ba8d[_0x8dc1('0x9e')]){for(let _0x450eac=0x0;_0x450eac<_0x2c51a9[_0x8dc1('0x52')];_0x450eac+=0x1){_0x40895f[_0x8dc1('0x4d')]({'membername':_0x14ba8d[_0x8dc1('0x38')],'UserId':_0x14ba8d['id'],'queue_name':_0x2c51a9[_0x450eac][_0x8dc1('0x38')],'VoiceQueueId':_0x2c51a9[_0x450eac]['id'],'interface':_['isNil'](_0x14ba8d['interface'])?util[_0x8dc1('0xac')](_0x8dc1('0xad'),_0x14ba8d[_0x8dc1('0x38')]):_0x14ba8d[_0x8dc1('0xa1')],'paused':_0x14ba8d['voicePause']||![],'penalty':_0x4aad73[_0x8dc1('0x61')][_0x8dc1('0xae')]||0x0});}return Promise[_0x8dc1('0x59')](_0x40895f['map'](function(_0x250aac){return db['UserVoiceQueueRt'][_0x8dc1('0xaf')](_0x250aac);}));}return _0x253359;});}})[_0x8dc1('0x1f')](respondWithStatusCode(_0x401450,null))[_0x8dc1('0x5a')](handleError(_0x401450,null));};exports[_0x8dc1('0xb0')]=function(_0x5a0921,_0x15452b){var _0x41b12b,_0x391cf4;return db[_0x8dc1('0x3d')]['find']({'where':{'id':_0x5a0921['params']['id']},'attributes':['id',_0x8dc1('0x38'),_0x8dc1('0x2a')]})[_0x8dc1('0x1f')](handleEntityNotFound(_0x15452b,null))['then'](function(_0x58bcc9){if(_0x58bcc9){_0x41b12b=_0x58bcc9;if(!_0x5a0921[_0x8dc1('0x48')][_0x8dc1('0x9d')]||!utils[_0x8dc1('0xa2')](_0x5a0921[_0x8dc1('0x48')]['channel'])){throw new db[(_0x8dc1('0x93'))][(_0x8dc1('0x94'))]('Unknown\x20channel');}return _0x58bcc9[_0x8dc1('0xb1')+_['capitalize'](_0x5a0921['query'][_0x8dc1('0x9d')]['toLowerCase']())+_0x8dc1('0xa6')](_0x5a0921[_0x8dc1('0x48')]['ids']);}})['then'](function(_0x454641){if(_[_0x8dc1('0xb2')](_0x5a0921[_0x8dc1('0x48')][_0x8dc1('0x64')])){for(var _0x2be0c6=0x0;_0x2be0c6<_0x5a0921[_0x8dc1('0x48')][_0x8dc1('0x64')]['length'];_0x2be0c6+=0x1){_0x391cf4={'UserId':Number(_0x5a0921['params']['id'])};_0x391cf4[_[_0x8dc1('0xa4')](_0x5a0921[_0x8dc1('0x48')][_0x8dc1('0x9d')]['toLowerCase']())+'QueueId']=Number(_0x5a0921['query'][_0x8dc1('0x64')][_0x2be0c6]);socket[_0x8dc1('0x2c')]('user'+_[_0x8dc1('0xa4')](_0x5a0921[_0x8dc1('0x48')][_0x8dc1('0x9d')][_0x8dc1('0xa5')]())+_0x8dc1('0xb3'),_0x391cf4);}}else{_0x391cf4={'UserId':Number(_0x5a0921[_0x8dc1('0x5c')]['id'])};_0x391cf4[_[_0x8dc1('0xa4')](_0x5a0921['query']['channel'][_0x8dc1('0xa5')]())+_0x8dc1('0xa8')]=Number(_0x5a0921[_0x8dc1('0x48')]['ids']);socket['emit'](_0x8dc1('0x31')+_[_0x8dc1('0xa4')](_0x5a0921['query']['channel'][_0x8dc1('0xa5')]())+_0x8dc1('0xb3'),_0x391cf4);}return _0x454641;})[_0x8dc1('0x1f')](function(){if(_0x5a0921['query'][_0x8dc1('0x9d')]===_0x8dc1('0xaa')){return db[_0x8dc1('0xb4')][_0x8dc1('0x2e')]({'where':{'UserId':_0x5a0921[_0x8dc1('0x5c')]['id'],'VoiceQueueId':_0x5a0921[_0x8dc1('0x48')]['ids']},'individualHooks':!![]})[_0x8dc1('0x1f')](function(){return _0x41b12b;});}return _0x41b12b;})[_0x8dc1('0x1f')](respondWithStatusCode(_0x15452b,null))[_0x8dc1('0x5a')](handleError(_0x15452b,null));};exports['addAvatar']=function(_0x22a32d,_0x17d9b9){_0x22a32d[_0x8dc1('0x61')][_0x8dc1('0xb5')]=_0x22a32d['file'][_0x8dc1('0xb6')];return db['User']['find']({'where':{'id':_0x22a32d[_0x8dc1('0x5c')]['id']}})[_0x8dc1('0x1f')](handleEntityNotFound(_0x17d9b9,null))[_0x8dc1('0x1f')](saveUpdates(_0x22a32d[_0x8dc1('0x61')],null))[_0x8dc1('0x1f')](respondWithResult(_0x17d9b9,null))[_0x8dc1('0x5a')](handleError(_0x17d9b9,null));};exports[_0x8dc1('0xb7')]=function(_0x1cf035,_0x2e48cf){var _0x1d50a9=path[_0x8dc1('0xb8')](config[_0x8dc1('0xb9')],_0x8dc1('0xba'));return db[_0x8dc1('0x3d')][_0x8dc1('0x5f')]({'where':{'id':_0x1cf035[_0x8dc1('0x5c')]['id']},'attributes':['id',_0x8dc1('0xb5')],'raw':!![]})[_0x8dc1('0x1f')](handleEntityNotFound(_0x2e48cf,null))['then'](function(_0x2e765a){if(_0x2e765a){if(_['isNil'](_0x2e765a['userpic'])){return _0x2e48cf[_0x8dc1('0xbb')](_0x1d50a9);}else{if(!fs[_0x8dc1('0xbc')](path[_0x8dc1('0xb8')](config[_0x8dc1('0xb9')],_0x8dc1('0xbd'),_0x2e765a[_0x8dc1('0xb5')]))){return _0x2e48cf[_0x8dc1('0xbb')](_0x1d50a9);}return _0x2e48cf['download'](path[_0x8dc1('0xb8')](config[_0x8dc1('0xb9')],_0x8dc1('0xbd'),_0x2e765a['userpic']));}}})[_0x8dc1('0x5a')](handleError(_0x2e48cf,null));};exports['getOpenTabs']=function(_0x3de491,_0x440bb4){return db[_0x8dc1('0x3d')][_0x8dc1('0x5f')]({'where':{'id':_0x3de491[_0x8dc1('0x5c')]['id']},'attributes':['id']})[_0x8dc1('0x1f')](handleEntityNotFound(_0x440bb4,null))[_0x8dc1('0x1f')](function(_0x248215){var _0x2c1b8b=[];values=_0x248215[_0x8dc1('0x55')];_0x2c1b8b[_0x8dc1('0x4d')](get_open_tabs('chat',_0x248215[_0x8dc1('0x55')]));_0x2c1b8b['push'](get_open_tabs(_0x8dc1('0x54'),_0x248215['dataValues']));_0x2c1b8b['push'](get_open_tabs(_0x8dc1('0x57'),_0x248215[_0x8dc1('0x55')]));_0x2c1b8b[_0x8dc1('0x4d')](get_open_tabs(_0x8dc1('0x58'),_0x248215[_0x8dc1('0x55')]));_0x2c1b8b['push'](get_open_tabs(_0x8dc1('0x56'),_0x248215[_0x8dc1('0x55')]));_0x2c1b8b[_0x8dc1('0x4d')](get_open_tabs(_0x8dc1('0x60'),_0x248215[_0x8dc1('0x55')]));return Promise[_0x8dc1('0x59')](_0x2c1b8b);})[_0x8dc1('0x1f')](function(_0x173adf){if(_0x173adf){var _0x18cc6d=_[_0x8dc1('0x3f')](values[_0x8dc1('0xbe')],function(_0x24f3e7){return{'channel':_0x8dc1('0xbf'),'id':_0x24f3e7['id'],'createdAt':_0x24f3e7[_0x8dc1('0xc0')]};});var _0xcf2147=_[_0x8dc1('0x3f')](values[_0x8dc1('0xc1')],function(_0x584093){return{'channel':_0x8dc1('0xc2'),'id':_0x584093['id'],'createdAt':_0x584093['createdAt']};});var _0x41d5f3=_[_0x8dc1('0x3f')](values[_0x8dc1('0xc3')],function(_0x4d8367){return{'channel':_0x8dc1('0xc4'),'id':_0x4d8367['id'],'createdAt':_0x4d8367[_0x8dc1('0xc0')]};});var _0x471cee=_[_0x8dc1('0x3f')](values[_0x8dc1('0xc5')],function(_0x4ea74c){return{'channel':_0x8dc1('0xc6'),'id':_0x4ea74c['id'],'createdAt':_0x4ea74c[_0x8dc1('0xc0')]};});var _0x21ee82=_[_0x8dc1('0x3f')](values['SmsOpenTabs'],function(_0x352434){return{'channel':'SMS','id':_0x352434['id'],'createdAt':_0x352434['createdAt']};});var _0x13a18d=_[_0x8dc1('0x3f')](values['WhatsappOpenTabs'],function(_0xe25479){return{'channel':_0x8dc1('0xc7'),'id':_0xe25479['id'],'createdAt':_0xe25479[_0x8dc1('0xc0')]};});var _0x19f537=_[_0x8dc1('0xc8')](_0x18cc6d,_0xcf2147,_0x41d5f3,_0x471cee,_0x21ee82,_0x13a18d);var _0x3dbf95={'count':_0x19f537[_0x8dc1('0x52')],'rows':_0x19f537};return _0x3dbf95;}else return null;})[_0x8dc1('0x1f')](respondWithResult(_0x440bb4,null))['catch'](handleError(_0x440bb4,null));};exports[_0x8dc1('0xc9')]=function(_0x5ea668,_0x1a169b){var _0x54a327={};return db[_0x8dc1('0x3d')][_0x8dc1('0x99')]({'where':{'id':_0x5ea668[_0x8dc1('0x5c')]['id']}})[_0x8dc1('0x1f')](function(_0x315d12){if(!_0x315d12){throw new APINotFoundError(util[_0x8dc1('0xac')]('User\x20with\x20id\x20%s\x20not\x20found',_0x5ea668[_0x8dc1('0x5c')]['id']));}return contacts['describe']();})[_0x8dc1('0x1f')](function(_0x41c81e){_0x5ea668[_0x8dc1('0x48')][_0x8dc1('0x3d')]=_0x5ea668[_0x8dc1('0x5c')]['id'];_0x54a327=qs[_0x8dc1('0x46')](_0x41c81e,_0x5ea668);if(_0x5ea668[_0x8dc1('0x48')][_0x8dc1('0xca')](_0x8dc1('0x49'))){_0x54a327[_0x8dc1('0x4b')]=[{'model':db[_0x8dc1('0xcb')],'as':_0x8dc1('0xcc'),'required':![]},{'model':db[_0x8dc1('0xcd')],'as':_0x8dc1('0xce'),'attributes':['id',_0x8dc1('0x38'),_0x8dc1('0xcf')],'where':_0x5ea668[_0x8dc1('0x48')][_0x8dc1('0xd0')]?{'id':_0x5ea668[_0x8dc1('0x48')][_0x8dc1('0xd0')]}:undefined,'required':_0x5ea668[_0x8dc1('0x48')][_0x8dc1('0xd0')]?!![]:![]}];}return contacts[_0x8dc1('0x4e')](_0x5ea668[_0x8dc1('0x48')],_0x5ea668[_0x8dc1('0x31')],_0x54a327,_0x41c81e);})[_0x8dc1('0x1f')](respondWithFilteredResult(_0x1a169b,_0x54a327))[_0x8dc1('0x5a')](APIHandleError(_0x1a169b));};exports['getQueues']=function(_0x449c6a,_0x325931){var _0x136f31;var _0x29c8f1={};var _0x3d53b6;return db[_0x8dc1('0x3d')][_0x8dc1('0x99')]({'where':{'id':_0x449c6a[_0x8dc1('0x5c')]['id']},'attributes':['id',_0x8dc1('0x38'),_0x8dc1('0x2a')]})['then'](handleEntityNotFound(_0x325931,null))[_0x8dc1('0x1f')](function(_0x7e9de9){if(!utils['isValidChannel'](_0x449c6a[_0x8dc1('0x48')][_0x8dc1('0x9d')])){throw new db[(_0x8dc1('0x93'))][(_0x8dc1('0x94'))](_0x8dc1('0xd1'));}_0x136f31=_0x7e9de9;var _0x54f27e={};_0x54f27e[_0x8dc1('0xd2')]=_[_0x8dc1('0xd3')](db[_[_0x8dc1('0xa4')](_0x449c6a[_0x8dc1('0x48')][_0x8dc1('0x9d')])+_0x8dc1('0xd4')][_0x8dc1('0x3e')]);_0x54f27e['query']=_[_0x8dc1('0xd3')](_0x449c6a['query']);_0x54f27e[_0x8dc1('0xd5')]=_[_0x8dc1('0xd6')](_0x54f27e['model'],_0x54f27e[_0x8dc1('0x48')]);_0x29c8f1['attributes']=_['intersection'](_0x54f27e[_0x8dc1('0xd2')],qs[_0x8dc1('0xd7')](_0x449c6a[_0x8dc1('0x48')]['fields']));_0x29c8f1[_0x8dc1('0x4c')]=_0x29c8f1[_0x8dc1('0x4c')][_0x8dc1('0x52')]?_0x29c8f1['attributes']:_0x54f27e[_0x8dc1('0xd2')];_0x29c8f1['order']=qs['sort'](_0x449c6a['query'][_0x8dc1('0xd8')]);_0x29c8f1[_0x8dc1('0x47')]=qs[_0x8dc1('0xd5')](_['pick'](_0x449c6a[_0x8dc1('0x48')],_0x54f27e[_0x8dc1('0xd5')]));if(_0x449c6a[_0x8dc1('0x48')][_0x8dc1('0x34')]){_0x29c8f1[_0x8dc1('0x47')]=_[_0x8dc1('0xd9')](_0x29c8f1[_0x8dc1('0x47')],{'$or':_[_0x8dc1('0x3f')](_0x29c8f1[_0x8dc1('0x4c')],function(_0x513e7c){var _0x4aec95={};_0x4aec95[_0x513e7c]={'$like':'%'+_0x449c6a[_0x8dc1('0x48')][_0x8dc1('0x34')]+'%'};return _0x4aec95;})});}_0x29c8f1=_[_0x8dc1('0xd9')]({},_0x29c8f1,_0x449c6a[_0x8dc1('0x5e')]);switch(_0x136f31['role']){case _0x8dc1('0x84'):return db[_['capitalize'](_0x449c6a[_0x8dc1('0x48')][_0x8dc1('0x9d')])+_0x8dc1('0xd4')][_0x8dc1('0x4e')](_0x29c8f1);case'user':case _0x8dc1('0x2b'):return _0x136f31['get'+_[_0x8dc1('0xa4')](_0x449c6a[_0x8dc1('0x48')]['channel'])+_0x8dc1('0xa6')](_0x29c8f1);default:throw new db['Sequelize'][(_0x8dc1('0x94'))](_0x8dc1('0xda'));}})[_0x8dc1('0x1f')](function(_0x1a714b){_0x3d53b6=_0x1a714b[_0x8dc1('0x52')];if(!_0x449c6a[_0x8dc1('0x48')]['hasOwnProperty'](_0x8dc1('0xdb'))){_0x29c8f1['limit']=qs[_0x8dc1('0x19')](_0x449c6a['query'][_0x8dc1('0x19')]);_0x29c8f1[_0x8dc1('0x1b')]=qs[_0x8dc1('0x1b')](_0x449c6a[_0x8dc1('0x48')][_0x8dc1('0x1b')]);}switch(_0x136f31['role']){case _0x8dc1('0x84'):return db[_['capitalize'](_0x449c6a[_0x8dc1('0x48')][_0x8dc1('0x9d')])+'Queue'][_0x8dc1('0x4e')](_0x29c8f1);case _0x8dc1('0x31'):case _0x8dc1('0x2b'):return _0x136f31[_0x8dc1('0x2f')+_[_0x8dc1('0xa4')](_0x449c6a[_0x8dc1('0x48')][_0x8dc1('0x9d')])+_0x8dc1('0xa6')](_0x29c8f1);}})['then'](function(_0x5a8f88){return{'count':_0x3d53b6,'rows':_0x5a8f88};})['then'](respondWithResult(_0x325931,null))[_0x8dc1('0x5a')](handleError(_0x325931,null));};exports['getVoiceQueuesRt']=function(_0x342f1a,_0x47b519){var _0x57ed00={};var _0x5c1fc5={};var _0x309345;var _0x4d7cf3;return db[_0x8dc1('0x3d')][_0x8dc1('0x99')]({'where':{'id':_0x342f1a[_0x8dc1('0x5c')]['id']}})[_0x8dc1('0x1f')](handleEntityNotFound(_0x47b519,null))[_0x8dc1('0x1f')](function(_0x438b69){if(_0x438b69){_0x309345=_0x438b69;_0x5c1fc5['model']=_[_0x8dc1('0xd3')](db['UserVoiceQueueRt'][_0x8dc1('0x3e')]);_0x5c1fc5[_0x8dc1('0x48')]=_[_0x8dc1('0xd3')](_0x342f1a['query']);_0x5c1fc5[_0x8dc1('0xd5')]=_['intersection'](_0x5c1fc5[_0x8dc1('0xd2')],_0x5c1fc5[_0x8dc1('0x48')]);_0x57ed00[_0x8dc1('0x4c')]=_[_0x8dc1('0xd6')](_0x5c1fc5[_0x8dc1('0xd2')],qs[_0x8dc1('0xd7')](_0x342f1a['query'][_0x8dc1('0xd7')]));_0x57ed00[_0x8dc1('0x4c')]=_0x57ed00[_0x8dc1('0x4c')]['length']?_0x57ed00[_0x8dc1('0x4c')]:_0x5c1fc5[_0x8dc1('0xd2')];_0x57ed00['order']=qs['sort'](_0x342f1a[_0x8dc1('0x48')][_0x8dc1('0xd8')]);_0x57ed00[_0x8dc1('0x47')]=qs[_0x8dc1('0xd5')](_[_0x8dc1('0xdc')](_0x342f1a[_0x8dc1('0x48')],_0x5c1fc5[_0x8dc1('0xd5')]));if(_0x342f1a[_0x8dc1('0x48')][_0x8dc1('0x34')]){_0x57ed00['where']=_[_0x8dc1('0xd9')](_0x57ed00['where'],{'$or':_[_0x8dc1('0x3f')](_0x57ed00[_0x8dc1('0x4c')],function(_0x2aa066){var _0xaccce8={};_0xaccce8[_0x2aa066]={'$like':'%'+_0x342f1a['query'][_0x8dc1('0x34')]+'%'};return _0xaccce8;})});}_0x57ed00=_[_0x8dc1('0xd9')]({},_0x57ed00,_0x342f1a[_0x8dc1('0x5e')]);return _0x309345['getVoiceQueuesRt'](_0x57ed00);}})['then'](function(_0x4654b9){if(_0x4654b9){_0x4d7cf3=_0x4654b9[_0x8dc1('0x52')];if(!_0x342f1a['query'][_0x8dc1('0xca')](_0x8dc1('0xdb'))){_0x57ed00[_0x8dc1('0x19')]=qs[_0x8dc1('0x19')](_0x342f1a[_0x8dc1('0x48')][_0x8dc1('0x19')]);_0x57ed00[_0x8dc1('0x1b')]=qs['offset'](_0x342f1a[_0x8dc1('0x48')]['offset']);}return _0x309345[_0x8dc1('0xdd')](_0x57ed00);}})[_0x8dc1('0x1f')](function(_0xc30401){if(_0xc30401){return _0xc30401?{'count':_0x4d7cf3,'rows':_0xc30401}:null;}})['then'](respondWithResult(_0x47b519,null))[_0x8dc1('0x5a')](handleError(_0x47b519,null));};exports['getGroups']=function(_0x9b5505,_0x57a37b){var _0x52cec3={};var _0x29ee7={};var _0x13bcc2;var _0xd252fa;return db[_0x8dc1('0x3d')][_0x8dc1('0x99')]({'where':{'id':_0x9b5505[_0x8dc1('0x5c')]['id']}})[_0x8dc1('0x1f')](handleEntityNotFound(_0x57a37b,null))[_0x8dc1('0x1f')](function(_0xb61ccb){if(_0xb61ccb){_0x13bcc2=_0xb61ccb;_0x29ee7[_0x8dc1('0xd2')]=_[_0x8dc1('0xd3')](db[_0x8dc1('0xde')]['rawAttributes']);_0x29ee7['query']=_[_0x8dc1('0xd3')](_0x9b5505[_0x8dc1('0x48')]);_0x29ee7['filters']=_[_0x8dc1('0xd6')](_0x29ee7[_0x8dc1('0xd2')],_0x29ee7[_0x8dc1('0x48')]);_0x52cec3[_0x8dc1('0x4c')]=_['intersection'](_0x29ee7[_0x8dc1('0xd2')],qs[_0x8dc1('0xd7')](_0x9b5505[_0x8dc1('0x48')]['fields']));_0x52cec3['attributes']=_0x52cec3[_0x8dc1('0x4c')]['length']?_0x52cec3['attributes']:_0x29ee7[_0x8dc1('0xd2')];_0x52cec3[_0x8dc1('0xdf')]=qs[_0x8dc1('0xd8')](_0x9b5505[_0x8dc1('0x48')][_0x8dc1('0xd8')]);_0x52cec3[_0x8dc1('0x47')]=qs[_0x8dc1('0xd5')](_['pick'](_0x9b5505[_0x8dc1('0x48')],_0x29ee7[_0x8dc1('0xd5')]));if(_0x9b5505[_0x8dc1('0x48')][_0x8dc1('0x34')]){_0x52cec3[_0x8dc1('0x47')]=_[_0x8dc1('0xd9')](_0x52cec3['where'],{'$or':_[_0x8dc1('0x3f')](_0x52cec3[_0x8dc1('0x4c')],function(_0x330331){var _0x45808c={};_0x45808c[_0x330331]={'$like':'%'+_0x9b5505[_0x8dc1('0x48')][_0x8dc1('0x34')]+'%'};return _0x45808c;})});}_0x52cec3=_['merge']({},_0x52cec3,_0x9b5505[_0x8dc1('0x5e')]);return _0x13bcc2[_0x8dc1('0xe0')](_0x52cec3);}})[_0x8dc1('0x1f')](function(_0x38b53d){if(_0x38b53d){_0xd252fa=_0x38b53d[_0x8dc1('0x52')];if(!_0x9b5505['query'][_0x8dc1('0xca')]('nolimit')){_0x52cec3[_0x8dc1('0x19')]=qs[_0x8dc1('0x19')](_0x9b5505[_0x8dc1('0x48')][_0x8dc1('0x19')]);_0x52cec3['offset']=qs['offset'](_0x9b5505[_0x8dc1('0x48')][_0x8dc1('0x1b')]);}return _0x13bcc2['getGroups'](_0x52cec3);}})[_0x8dc1('0x1f')](function(_0x1c95a5){if(_0x1c95a5){return _0x1c95a5?{'count':_0xd252fa,'rows':_0x1c95a5}:null;}})[_0x8dc1('0x1f')](respondWithResult(_0x57a37b,null))[_0x8dc1('0x5a')](handleError(_0x57a37b,null));};exports[_0x8dc1('0xe1')]=function(_0x2fa2b5,_0x10eb94){var _0x262557={'raw':!![],'where':{}};var _0x59498b={};var _0x1102b8={'count':0x0,'rows':[]};return db[_0x8dc1('0x3d')]['findOne']({'where':{'id':_0x2fa2b5[_0x8dc1('0x5c')]['id']}})[_0x8dc1('0x1f')](handleEntityNotFound(_0x10eb94,null))[_0x8dc1('0x1f')](function(_0x1282e3){if(_0x1282e3){_0x59498b[_0x8dc1('0xd2')]=_[_0x8dc1('0xd3')](db[_0x8dc1('0xe2')]['rawAttributes']);_0x59498b[_0x8dc1('0x48')]=_['keys'](_0x2fa2b5['query']);_0x59498b['filters']=_[_0x8dc1('0xd6')](_0x59498b['model'],_0x59498b[_0x8dc1('0x48')]);_0x262557[_0x8dc1('0x4c')]=_['intersection'](_0x59498b[_0x8dc1('0xd2')],qs[_0x8dc1('0xd7')](_0x2fa2b5[_0x8dc1('0x48')][_0x8dc1('0xd7')]));_0x262557[_0x8dc1('0x4c')]=_0x262557[_0x8dc1('0x4c')][_0x8dc1('0x52')]?_0x262557[_0x8dc1('0x4c')]:_0x59498b['model'];if(!_0x2fa2b5[_0x8dc1('0x48')][_0x8dc1('0xca')](_0x8dc1('0xdb'))){_0x262557[_0x8dc1('0x19')]=qs[_0x8dc1('0x19')](_0x2fa2b5[_0x8dc1('0x48')][_0x8dc1('0x19')]);_0x262557[_0x8dc1('0x1b')]=qs[_0x8dc1('0x1b')](_0x2fa2b5['query'][_0x8dc1('0x1b')]);}_0x262557[_0x8dc1('0xdf')]=qs[_0x8dc1('0xd8')](_0x2fa2b5[_0x8dc1('0x48')]['sort']);_0x262557[_0x8dc1('0x47')]=qs[_0x8dc1('0xd5')](_[_0x8dc1('0xdc')](_0x2fa2b5[_0x8dc1('0x48')],_0x59498b[_0x8dc1('0xd5')]));_0x262557[_0x8dc1('0x47')]['UserId']=_0x1282e3['id'];if(_0x2fa2b5[_0x8dc1('0x48')][_0x8dc1('0x34')]){_0x262557['where']=_[_0x8dc1('0xd9')](_0x262557['where'],{'$or':_['map'](_0x262557[_0x8dc1('0x4c')],function(_0xb7cdd9){var _0x417fbd={};_0x417fbd[_0xb7cdd9]={'$like':'%'+_0x2fa2b5[_0x8dc1('0x48')][_0x8dc1('0x34')]+'%'};return _0x417fbd;})});}_0x262557=_[_0x8dc1('0xd9')]({},_0x262557,_0x2fa2b5[_0x8dc1('0x5e')]);return db[_0x8dc1('0xe2')][_0x8dc1('0x1a')]({'where':_0x262557[_0x8dc1('0x47')]})[_0x8dc1('0x1f')](function(_0x24ade1){_0x1102b8[_0x8dc1('0x1a')]=_0x24ade1;if(_0x2fa2b5[_0x8dc1('0x48')][_0x8dc1('0x49')]){_0x262557[_0x8dc1('0x4b')]=[{'all':!![]}];}return db['VoiceRecording'][_0x8dc1('0x4e')](_0x262557);})[_0x8dc1('0x1f')](function(_0x425a72){_0x1102b8[_0x8dc1('0x4f')]=_0x425a72;return _0x1102b8;});}})[_0x8dc1('0x1f')](respondWithFilteredResult(_0x10eb94,_0x262557))[_0x8dc1('0x5a')](handleError(_0x10eb94,null));};exports[_0x8dc1('0xe3')]=function(_0x4b5399,_0x50f8ae){var _0x182f2a={'raw':!![],'where':{}};var _0x4f7076={};var _0x37d4c0={'count':0x0,'rows':[]};return db[_0x8dc1('0x3d')][_0x8dc1('0x99')]({'where':{'id':_0x4b5399[_0x8dc1('0x5c')]['id']}})['then'](handleEntityNotFound(_0x50f8ae,null))['then'](function(_0x48bf1e){if(_0x48bf1e){_0x4f7076[_0x8dc1('0xd2')]=_[_0x8dc1('0xd3')](db[_0x8dc1('0xe4')][_0x8dc1('0x3e')]);_0x4f7076[_0x8dc1('0x48')]=_['keys'](_0x4b5399[_0x8dc1('0x48')]);_0x4f7076[_0x8dc1('0xd5')]=_['intersection'](_0x4f7076[_0x8dc1('0xd2')],_0x4f7076['query']);_0x182f2a[_0x8dc1('0x4c')]=_[_0x8dc1('0xd6')](_0x4f7076[_0x8dc1('0xd2')],qs[_0x8dc1('0xd7')](_0x4b5399[_0x8dc1('0x48')][_0x8dc1('0xd7')]));_0x182f2a[_0x8dc1('0x4c')]=_0x182f2a[_0x8dc1('0x4c')]['length']?_0x182f2a['attributes']:_0x4f7076[_0x8dc1('0xd2')];if(!_0x4b5399[_0x8dc1('0x48')]['hasOwnProperty']('nolimit')){_0x182f2a[_0x8dc1('0x19')]=qs[_0x8dc1('0x19')](_0x4b5399[_0x8dc1('0x48')][_0x8dc1('0x19')]);_0x182f2a[_0x8dc1('0x1b')]=qs[_0x8dc1('0x1b')](_0x4b5399[_0x8dc1('0x48')][_0x8dc1('0x1b')]);}_0x182f2a[_0x8dc1('0xdf')]=qs['sort'](_0x4b5399[_0x8dc1('0x48')][_0x8dc1('0xd8')]);_0x182f2a[_0x8dc1('0x47')]=qs['filters'](_['pick'](_0x4b5399[_0x8dc1('0x48')],_0x4f7076[_0x8dc1('0xd5')]));_0x182f2a[_0x8dc1('0x47')][_0x8dc1('0xe5')]=_0x48bf1e['id'];if(_0x4b5399[_0x8dc1('0x48')][_0x8dc1('0x34')]){_0x182f2a[_0x8dc1('0x47')]=_[_0x8dc1('0xd9')](_0x182f2a[_0x8dc1('0x47')],{'$or':_[_0x8dc1('0x3f')](_0x182f2a[_0x8dc1('0x4c')],function(_0x2bf6a7){var _0x3b4990={};_0x3b4990[_0x2bf6a7]={'$like':'%'+_0x4b5399[_0x8dc1('0x48')][_0x8dc1('0x34')]+'%'};return _0x3b4990;})});}_0x182f2a=_[_0x8dc1('0xd9')]({},_0x182f2a,_0x4b5399[_0x8dc1('0x5e')]);return db['ScreenRecording'][_0x8dc1('0x1a')]({'where':_0x182f2a['where']})[_0x8dc1('0x1f')](function(_0x1252df){_0x37d4c0[_0x8dc1('0x1a')]=_0x1252df;if(_0x4b5399['query'][_0x8dc1('0x49')]){_0x182f2a[_0x8dc1('0x4b')]=[{'all':!![]}];}return db['ScreenRecording'][_0x8dc1('0x4e')](_0x182f2a);})[_0x8dc1('0x1f')](function(_0x38a488){_0x37d4c0[_0x8dc1('0x4f')]=_0x38a488;return _0x37d4c0;});}})[_0x8dc1('0x1f')](respondWithFilteredResult(_0x50f8ae,_0x182f2a))[_0x8dc1('0x5a')](handleError(_0x50f8ae,null));};exports[_0x8dc1('0xe6')]=function(_0x5486e0,_0x194e8b){var _0x35e493={};var _0x14b4c7={};var _0x229fa3;var _0x13ed6e;return db[_0x8dc1('0x3d')][_0x8dc1('0x99')]({'where':{'id':_0x5486e0['params']['id']}})[_0x8dc1('0x1f')](handleEntityNotFound(_0x194e8b,null))[_0x8dc1('0x1f')](function(_0x8fea95){if(_0x8fea95){_0x229fa3=_0x8fea95;_0x14b4c7['model']=_[_0x8dc1('0xd3')](db['ChatInteraction'][_0x8dc1('0x3e')]);_0x14b4c7[_0x8dc1('0x48')]=_[_0x8dc1('0xd3')](_0x5486e0[_0x8dc1('0x48')]);_0x14b4c7[_0x8dc1('0xd5')]=_[_0x8dc1('0xd6')](_0x14b4c7[_0x8dc1('0xd2')],_0x14b4c7[_0x8dc1('0x48')]);_0x35e493[_0x8dc1('0x4c')]=_[_0x8dc1('0xd6')](_0x14b4c7[_0x8dc1('0xd2')],qs[_0x8dc1('0xd7')](_0x5486e0['query']['fields']));_0x35e493[_0x8dc1('0x4c')]=_0x35e493[_0x8dc1('0x4c')][_0x8dc1('0x52')]?_0x35e493[_0x8dc1('0x4c')]:_0x14b4c7['model'];_0x35e493['order']=qs[_0x8dc1('0xd8')](_0x5486e0[_0x8dc1('0x48')][_0x8dc1('0xd8')]);_0x35e493['where']=qs['filters'](_[_0x8dc1('0xdc')](_0x5486e0[_0x8dc1('0x48')],_0x14b4c7[_0x8dc1('0xd5')]));if(_0x5486e0[_0x8dc1('0x48')]['filter']){_0x35e493[_0x8dc1('0x47')]=_[_0x8dc1('0xd9')](_0x35e493['where'],{'$or':_[_0x8dc1('0x3f')](_0x35e493[_0x8dc1('0x4c')],function(_0x3d4e07){var _0x3511f8={};_0x3511f8[_0x3d4e07]={'$like':'%'+_0x5486e0[_0x8dc1('0x48')][_0x8dc1('0x34')]+'%'};return _0x3511f8;})});}_0x35e493=_['merge']({},_0x35e493,_0x5486e0[_0x8dc1('0x5e')]);return _0x229fa3[_0x8dc1('0xe6')](_0x35e493);}})[_0x8dc1('0x1f')](function(_0x192042){if(_0x192042){_0x13ed6e=_0x192042[_0x8dc1('0x52')];if(!_0x5486e0[_0x8dc1('0x48')][_0x8dc1('0xca')](_0x8dc1('0xdb'))){_0x35e493[_0x8dc1('0x19')]=qs[_0x8dc1('0x19')](_0x5486e0[_0x8dc1('0x48')]['limit']);_0x35e493[_0x8dc1('0x1b')]=qs[_0x8dc1('0x1b')](_0x5486e0['query']['offset']);}return _0x229fa3[_0x8dc1('0xe6')](_0x35e493);}})[_0x8dc1('0x1f')](function(_0xec538e){if(_0xec538e){return _0xec538e?{'count':_0x13ed6e,'rows':_0xec538e}:null;}})[_0x8dc1('0x1f')](respondWithResult(_0x194e8b,null))[_0x8dc1('0x5a')](handleError(_0x194e8b,null));};exports[_0x8dc1('0xe7')]=function(_0x44b5cc,_0x5d758b){var _0x362d8e={};var _0x5820bd={};var _0xbd0224;var _0x4e1450;return db['User'][_0x8dc1('0x99')]({'where':{'id':_0x44b5cc['params']['id']}})[_0x8dc1('0x1f')](handleEntityNotFound(_0x5d758b,null))[_0x8dc1('0x1f')](function(_0x1085db){if(_0x1085db){_0xbd0224=_0x1085db;_0x5820bd[_0x8dc1('0xd2')]=_[_0x8dc1('0xd3')](db[_0x8dc1('0xe8')][_0x8dc1('0x3e')]);_0x5820bd[_0x8dc1('0x48')]=_[_0x8dc1('0xd3')](_0x44b5cc[_0x8dc1('0x48')]);_0x5820bd[_0x8dc1('0xd5')]=_[_0x8dc1('0xd6')](_0x5820bd[_0x8dc1('0xd2')],_0x5820bd[_0x8dc1('0x48')]);_0x362d8e[_0x8dc1('0x4c')]=_['intersection'](_0x5820bd[_0x8dc1('0xd2')],qs[_0x8dc1('0xd7')](_0x44b5cc[_0x8dc1('0x48')]['fields']));_0x362d8e['attributes']=_0x362d8e[_0x8dc1('0x4c')][_0x8dc1('0x52')]?_0x362d8e['attributes']:_0x5820bd[_0x8dc1('0xd2')];_0x362d8e[_0x8dc1('0xdf')]=qs['sort'](_0x44b5cc[_0x8dc1('0x48')][_0x8dc1('0xd8')]);_0x362d8e[_0x8dc1('0x47')]=qs[_0x8dc1('0xd5')](_[_0x8dc1('0xdc')](_0x44b5cc[_0x8dc1('0x48')],_0x5820bd[_0x8dc1('0xd5')]));if(_0x44b5cc[_0x8dc1('0x48')][_0x8dc1('0x34')]){_0x362d8e[_0x8dc1('0x47')]=_['merge'](_0x362d8e['where'],{'$or':_[_0x8dc1('0x3f')](_0x362d8e['attributes'],function(_0x416799){var _0x8cda2e={};_0x8cda2e[_0x416799]={'$like':'%'+_0x44b5cc[_0x8dc1('0x48')][_0x8dc1('0x34')]+'%'};return _0x8cda2e;})});}_0x362d8e=_[_0x8dc1('0xd9')]({},_0x362d8e,_0x44b5cc[_0x8dc1('0x5e')]);return _0xbd0224['getOpenchannelInteractions'](_0x362d8e);}})['then'](function(_0x48d54a){if(_0x48d54a){_0x4e1450=_0x48d54a[_0x8dc1('0x52')];if(!_0x44b5cc[_0x8dc1('0x48')]['hasOwnProperty'](_0x8dc1('0xdb'))){_0x362d8e[_0x8dc1('0x19')]=qs[_0x8dc1('0x19')](_0x44b5cc[_0x8dc1('0x48')][_0x8dc1('0x19')]);_0x362d8e[_0x8dc1('0x1b')]=qs[_0x8dc1('0x1b')](_0x44b5cc[_0x8dc1('0x48')][_0x8dc1('0x1b')]);}return _0xbd0224[_0x8dc1('0xe7')](_0x362d8e);}})[_0x8dc1('0x1f')](function(_0x4f9d0f){if(_0x4f9d0f){return _0x4f9d0f?{'count':_0x4e1450,'rows':_0x4f9d0f}:null;}})['then'](respondWithResult(_0x5d758b,null))['catch'](handleError(_0x5d758b,null));};exports['getMailInteractions']=function(_0x127dd8,_0x149779){var _0x5eacec={'raw':!![],'where':{}};var _0x35ea97={};var _0x5abae6={'count':0x0,'rows':[]};return db['User'][_0x8dc1('0x99')]({'where':{'id':_0x127dd8[_0x8dc1('0x5c')]['id']}})[_0x8dc1('0x1f')](handleEntityNotFound(_0x149779,null))['then'](function(_0x5ce4f7){if(_0x5ce4f7){_0x35ea97['model']=_[_0x8dc1('0xd3')](db['MailInteraction'][_0x8dc1('0x3e')]);_0x35ea97['query']=_['keys'](_0x127dd8[_0x8dc1('0x48')]);_0x35ea97[_0x8dc1('0xd5')]=_[_0x8dc1('0xd6')](_0x35ea97[_0x8dc1('0xd2')],_0x35ea97['query']);_0x5eacec['attributes']=_[_0x8dc1('0xd6')](_0x35ea97[_0x8dc1('0xd2')],qs['fields'](_0x127dd8[_0x8dc1('0x48')]['fields']));_0x5eacec['attributes']=_0x5eacec[_0x8dc1('0x4c')]['length']?_0x5eacec[_0x8dc1('0x4c')]:_0x35ea97[_0x8dc1('0xd2')];if(!_0x127dd8[_0x8dc1('0x48')][_0x8dc1('0xca')](_0x8dc1('0xdb'))){_0x5eacec[_0x8dc1('0x19')]=qs[_0x8dc1('0x19')](_0x127dd8[_0x8dc1('0x48')][_0x8dc1('0x19')]);_0x5eacec[_0x8dc1('0x1b')]=qs[_0x8dc1('0x1b')](_0x127dd8[_0x8dc1('0x48')][_0x8dc1('0x1b')]);}_0x5eacec[_0x8dc1('0xdf')]=qs[_0x8dc1('0xd8')](_0x127dd8['query'][_0x8dc1('0xd8')]);_0x5eacec[_0x8dc1('0x47')]=qs['filters'](_['pick'](_0x127dd8['query'],_0x35ea97['filters']));_0x5eacec[_0x8dc1('0x47')][_0x8dc1('0xe5')]=_0x5ce4f7['id'];if(_0x127dd8[_0x8dc1('0x48')][_0x8dc1('0x34')]){_0x5eacec[_0x8dc1('0x47')]=_[_0x8dc1('0xd9')](_0x5eacec[_0x8dc1('0x47')],{'$or':_['map'](_0x5eacec['attributes'],function(_0x2ce83f){var _0x25e544={};_0x25e544[_0x2ce83f]={'$like':'%'+_0x127dd8[_0x8dc1('0x48')]['filter']+'%'};return _0x25e544;})});}_0x5eacec=_[_0x8dc1('0xd9')]({},_0x5eacec,_0x127dd8[_0x8dc1('0x5e')]);return db[_0x8dc1('0xe9')][_0x8dc1('0x1a')]({'where':_0x5eacec['where']})[_0x8dc1('0x1f')](function(_0x375ffc){_0x5abae6[_0x8dc1('0x1a')]=_0x375ffc;if(_0x127dd8[_0x8dc1('0x48')]['includeAll']){_0x5eacec[_0x8dc1('0x4b')]=[{'all':!![]}];}return db[_0x8dc1('0xe9')][_0x8dc1('0x4e')](_0x5eacec);})['then'](function(_0x1c7a48){_0x5abae6[_0x8dc1('0x4f')]=_0x1c7a48;return _0x5abae6;});}})[_0x8dc1('0x1f')](respondWithFilteredResult(_0x149779,_0x5eacec))[_0x8dc1('0x5a')](handleError(_0x149779,null));};exports['getSmsInteractions']=function(_0x28c735,_0x48fca6){var _0x53fa05={};var _0x223bac={};var _0x12096a;var _0x508a66;return db[_0x8dc1('0x3d')][_0x8dc1('0x99')]({'where':{'id':_0x28c735[_0x8dc1('0x5c')]['id']}})['then'](handleEntityNotFound(_0x48fca6,null))['then'](function(_0x237ec5){if(_0x237ec5){_0x12096a=_0x237ec5;_0x223bac[_0x8dc1('0xd2')]=_[_0x8dc1('0xd3')](db[_0x8dc1('0xea')][_0x8dc1('0x3e')]);_0x223bac[_0x8dc1('0x48')]=_[_0x8dc1('0xd3')](_0x28c735['query']);_0x223bac[_0x8dc1('0xd5')]=_[_0x8dc1('0xd6')](_0x223bac[_0x8dc1('0xd2')],_0x223bac[_0x8dc1('0x48')]);_0x53fa05[_0x8dc1('0x4c')]=_[_0x8dc1('0xd6')](_0x223bac[_0x8dc1('0xd2')],qs[_0x8dc1('0xd7')](_0x28c735['query'][_0x8dc1('0xd7')]));_0x53fa05['attributes']=_0x53fa05[_0x8dc1('0x4c')][_0x8dc1('0x52')]?_0x53fa05[_0x8dc1('0x4c')]:_0x223bac[_0x8dc1('0xd2')];_0x53fa05[_0x8dc1('0xdf')]=qs[_0x8dc1('0xd8')](_0x28c735[_0x8dc1('0x48')][_0x8dc1('0xd8')]);_0x53fa05['where']=qs[_0x8dc1('0xd5')](_['pick'](_0x28c735[_0x8dc1('0x48')],_0x223bac[_0x8dc1('0xd5')]));if(_0x28c735[_0x8dc1('0x48')][_0x8dc1('0x34')]){_0x53fa05['where']=_[_0x8dc1('0xd9')](_0x53fa05[_0x8dc1('0x47')],{'$or':_[_0x8dc1('0x3f')](_0x53fa05[_0x8dc1('0x4c')],function(_0x46726d){var _0x24bac6={};_0x24bac6[_0x46726d]={'$like':'%'+_0x28c735[_0x8dc1('0x48')]['filter']+'%'};return _0x24bac6;})});}_0x53fa05=_[_0x8dc1('0xd9')]({},_0x53fa05,_0x28c735[_0x8dc1('0x5e')]);return _0x12096a['getSmsInteractions'](_0x53fa05);}})[_0x8dc1('0x1f')](function(_0x13e1a4){if(_0x13e1a4){_0x508a66=_0x13e1a4[_0x8dc1('0x52')];if(!_0x28c735[_0x8dc1('0x48')]['hasOwnProperty'](_0x8dc1('0xdb'))){_0x53fa05['limit']=qs[_0x8dc1('0x19')](_0x28c735[_0x8dc1('0x48')]['limit']);_0x53fa05[_0x8dc1('0x1b')]=qs[_0x8dc1('0x1b')](_0x28c735['query'][_0x8dc1('0x1b')]);}return _0x12096a[_0x8dc1('0xeb')](_0x53fa05);}})[_0x8dc1('0x1f')](function(_0x32de4a){if(_0x32de4a){return _0x32de4a?{'count':_0x508a66,'rows':_0x32de4a}:null;}})['then'](respondWithResult(_0x48fca6,null))['catch'](handleError(_0x48fca6,null));};exports['getFaxInteractions']=function(_0x6ab7e7,_0x53000e){var _0x409ed0={};var _0x392179={};var _0x259a28;var _0x495b65;return db[_0x8dc1('0x3d')][_0x8dc1('0x99')]({'where':{'id':_0x6ab7e7[_0x8dc1('0x5c')]['id']}})[_0x8dc1('0x1f')](handleEntityNotFound(_0x53000e,null))[_0x8dc1('0x1f')](function(_0x5ba4e0){if(_0x5ba4e0){_0x259a28=_0x5ba4e0;_0x392179[_0x8dc1('0xd2')]=_['keys'](db['FaxInteraction'][_0x8dc1('0x3e')]);_0x392179[_0x8dc1('0x48')]=_['keys'](_0x6ab7e7['query']);_0x392179['filters']=_[_0x8dc1('0xd6')](_0x392179[_0x8dc1('0xd2')],_0x392179[_0x8dc1('0x48')]);_0x409ed0[_0x8dc1('0x4c')]=_['intersection'](_0x392179[_0x8dc1('0xd2')],qs['fields'](_0x6ab7e7['query']['fields']));_0x409ed0[_0x8dc1('0x4c')]=_0x409ed0[_0x8dc1('0x4c')]['length']?_0x409ed0[_0x8dc1('0x4c')]:_0x392179[_0x8dc1('0xd2')];_0x409ed0[_0x8dc1('0xdf')]=qs[_0x8dc1('0xd8')](_0x6ab7e7[_0x8dc1('0x48')][_0x8dc1('0xd8')]);_0x409ed0[_0x8dc1('0x47')]=qs[_0x8dc1('0xd5')](_[_0x8dc1('0xdc')](_0x6ab7e7[_0x8dc1('0x48')],_0x392179[_0x8dc1('0xd5')]));if(_0x6ab7e7[_0x8dc1('0x48')][_0x8dc1('0x34')]){_0x409ed0[_0x8dc1('0x47')]=_[_0x8dc1('0xd9')](_0x409ed0[_0x8dc1('0x47')],{'$or':_[_0x8dc1('0x3f')](_0x409ed0['attributes'],function(_0x3ea467){var _0x10fc33={};_0x10fc33[_0x3ea467]={'$like':'%'+_0x6ab7e7[_0x8dc1('0x48')][_0x8dc1('0x34')]+'%'};return _0x10fc33;})});}_0x409ed0=_[_0x8dc1('0xd9')]({},_0x409ed0,_0x6ab7e7['options']);return _0x259a28[_0x8dc1('0xec')](_0x409ed0);}})['then'](function(_0x539fea){if(_0x539fea){_0x495b65=_0x539fea[_0x8dc1('0x52')];if(!_0x6ab7e7[_0x8dc1('0x48')][_0x8dc1('0xca')]('nolimit')){_0x409ed0[_0x8dc1('0x19')]=qs[_0x8dc1('0x19')](_0x6ab7e7[_0x8dc1('0x48')]['limit']);_0x409ed0[_0x8dc1('0x1b')]=qs['offset'](_0x6ab7e7[_0x8dc1('0x48')][_0x8dc1('0x1b')]);}return _0x259a28[_0x8dc1('0xec')](_0x409ed0);}})['then'](function(_0x82b6da){if(_0x82b6da){return _0x82b6da?{'count':_0x495b65,'rows':_0x82b6da}:null;}})[_0x8dc1('0x1f')](respondWithResult(_0x53000e,null))['catch'](handleError(_0x53000e,null));};exports['getWhatsappInteractions']=function(_0x923aa9,_0xaff278){var _0x2a7fc2={};var _0x329a73={};var _0x50754d;var _0x437567;return db[_0x8dc1('0x3d')][_0x8dc1('0x99')]({'where':{'id':_0x923aa9[_0x8dc1('0x5c')]['id']}})[_0x8dc1('0x1f')](handleEntityNotFound(_0xaff278,null))[_0x8dc1('0x1f')](function(_0x305a3f){if(_0x305a3f){_0x50754d=_0x305a3f;_0x329a73[_0x8dc1('0xd2')]=_[_0x8dc1('0xd3')](db['WhatsappInteraction']['rawAttributes']);_0x329a73[_0x8dc1('0x48')]=_[_0x8dc1('0xd3')](_0x923aa9['query']);_0x329a73[_0x8dc1('0xd5')]=_[_0x8dc1('0xd6')](_0x329a73['model'],_0x329a73[_0x8dc1('0x48')]);_0x2a7fc2[_0x8dc1('0x4c')]=_[_0x8dc1('0xd6')](_0x329a73['model'],qs[_0x8dc1('0xd7')](_0x923aa9[_0x8dc1('0x48')]['fields']));_0x2a7fc2[_0x8dc1('0x4c')]=_0x2a7fc2[_0x8dc1('0x4c')]['length']?_0x2a7fc2['attributes']:_0x329a73['model'];_0x2a7fc2[_0x8dc1('0xdf')]=qs[_0x8dc1('0xd8')](_0x923aa9[_0x8dc1('0x48')]['sort']);_0x2a7fc2['where']=qs[_0x8dc1('0xd5')](_[_0x8dc1('0xdc')](_0x923aa9['query'],_0x329a73['filters']));if(_0x923aa9[_0x8dc1('0x48')]['filter']){_0x2a7fc2[_0x8dc1('0x47')]=_['merge'](_0x2a7fc2[_0x8dc1('0x47')],{'$or':_['map'](_0x2a7fc2[_0x8dc1('0x4c')],function(_0x389041){var _0x55db32={};_0x55db32[_0x389041]={'$like':'%'+_0x923aa9[_0x8dc1('0x48')]['filter']+'%'};return _0x55db32;})});}_0x2a7fc2=_[_0x8dc1('0xd9')]({},_0x2a7fc2,_0x923aa9[_0x8dc1('0x5e')]);return _0x50754d[_0x8dc1('0xed')](_0x2a7fc2);}})[_0x8dc1('0x1f')](function(_0x80e1d9){if(_0x80e1d9){_0x437567=_0x80e1d9[_0x8dc1('0x52')];if(!_0x923aa9['query'][_0x8dc1('0xca')](_0x8dc1('0xdb'))){_0x2a7fc2[_0x8dc1('0x19')]=qs[_0x8dc1('0x19')](_0x923aa9['query'][_0x8dc1('0x19')]);_0x2a7fc2[_0x8dc1('0x1b')]=qs['offset'](_0x923aa9[_0x8dc1('0x48')][_0x8dc1('0x1b')]);}return _0x50754d[_0x8dc1('0xed')](_0x2a7fc2);}})['then'](function(_0x32719d){if(_0x32719d){return _0x32719d?{'count':_0x437567,'rows':_0x32719d}:null;}})['then'](respondWithResult(_0xaff278,null))[_0x8dc1('0x5a')](handleError(_0xaff278,null));};exports['login']=function(_0xe4b9e2,_0x233c19,_0x561396){var _0x4a8ada;var _0x268c4c;var _0x103654;var _0x36e6cd=!_[_0x8dc1('0x6d')](_0xe4b9e2[_0x8dc1('0x5c')]['id'])?_0xe4b9e2[_0x8dc1('0x5c')]['id']:!_[_0x8dc1('0x6d')](_0xe4b9e2[_0x8dc1('0x31')]['id'])?_0xe4b9e2[_0x8dc1('0x31')]['id']:null;return db['User'][_0x8dc1('0x5f')]({'where':{'id':_0x36e6cd,'role':{'$or':[_0x8dc1('0x84'),_0x8dc1('0x31'),_0x8dc1('0x2b')]}},'attributes':['id',_0x8dc1('0x38'),_0x8dc1('0xee'),_0x8dc1('0xef'),_0x8dc1('0x2a'),_0x8dc1('0x66'),_0x8dc1('0x9f')]})[_0x8dc1('0x1f')](function(_0x5d0597){if(_0x5d0597){if(_0x5d0597[_0x8dc1('0x2a')]===_0x8dc1('0x2b')){_0x4a8ada=_0x5d0597;if(_0xe4b9e2[_0x8dc1('0x61')][_0x8dc1('0xa1')]){_0x103654=util['format'](_0x8dc1('0xf0'),_0x4a8ada[_0xe4b9e2[_0x8dc1('0x61')]['interface']]);}else if(_0xe4b9e2[_0x8dc1('0x61')][_0x8dc1('0xf1')]){_0x103654=util['format'](_0x8dc1('0xad'),_0xe4b9e2['body'][_0x8dc1('0xf1')]);}else{_0x103654=util['format'](_0x8dc1('0xad'),_0x4a8ada['name']);}socket['to'](util[_0x8dc1('0xac')](_0x8dc1('0xf2'),_0x4a8ada[_0x8dc1('0x38')]))[_0x8dc1('0x2c')](_0x8dc1('0xf3'),{'user':{'id':_0x4a8ada['id'],'name':_0x4a8ada[_0x8dc1('0x38')]},'ip':_0xe4b9e2[_0x8dc1('0xf4')][_0x8dc1('0xf5')]||_0xe4b9e2[_0x8dc1('0xf6')]['remoteAddress']||_0xe4b9e2[_0x8dc1('0xf7')][_0x8dc1('0xf8')]||_0xe4b9e2['connection'][_0x8dc1('0xf7')][_0x8dc1('0xf8')]});return new Promise(function(_0x1bb9f9,_0x22eb13){db[_0x8dc1('0x6e')][_0x8dc1('0xf9')]()[_0x8dc1('0x1f')](_0x533052=>{db['UserVoiceQueueRt'][_0x8dc1('0x2e')]({'where':{'membername':_0x4a8ada[_0x8dc1('0x38')]},'individualHooks':!![]},{'transaction':_0x533052})[_0x8dc1('0x1f')](function(){return _0x533052[_0x8dc1('0xfa')]();})['then'](_0x1bb9f9)[_0x8dc1('0x5a')](_0x22eb13);});});}}else{throw new db[(_0x8dc1('0x93'))][(_0x8dc1('0x94'))](_0x8dc1('0xfb'));}})[_0x8dc1('0x1f')](function(){if(_0x4a8ada){return _0x4a8ada[_0x8dc1('0xfc')]({'raw':!![]});}})[_0x8dc1('0x1f')](function(_0x48b39a){if(_0x4a8ada){if(_0x48b39a){_0x268c4c=_0x48b39a;if(_0x268c4c[_0x8dc1('0x52')]){var _0x3834e2=_0x268c4c[_0x8dc1('0x3f')](function(_0x20a7cb){return{'membername':_0x4a8ada[_0x8dc1('0x38')],'UserId':_0x4a8ada['id'],'queue_name':_0x20a7cb[_0x8dc1('0x38')],'VoiceQueueId':_0x20a7cb['id'],'interface':_0x103654,'paused':_0x4a8ada[_0x8dc1('0x9f')]||![],'penalty':_0x20a7cb[_0x8dc1('0xfd')]||0x0};});return db[_0x8dc1('0xb4')][_0x8dc1('0x8c')](_0x3834e2);}}}})[_0x8dc1('0x1f')](function(){if(_0x4a8ada){return db[_0x8dc1('0xfe')][_0x8dc1('0x4e')]({'where':{'membername':_0x4a8ada['name'],'exitAt':null}});}})[_0x8dc1('0x1f')](function(_0x1bf9d1){if(_0x4a8ada){var _0x2970c7=[];_0x1bf9d1[_0x8dc1('0xff')](function(_0x8a976){_0x2970c7[_0x8dc1('0x4d')](_0x8a976['update']({'exitAt':moment()[_0x8dc1('0xac')]('YYYY-MM-DD\x20HH:mm:ss')}));});return Promise[_0x8dc1('0x59')](_0x2970c7);}})[_0x8dc1('0x1f')](function(){if(_0x4a8ada){var _0x29803c=[];var _0x1ae21e=[];var _0x3b1bd6=utils[_0x8dc1('0x100')]();var _0x57a368={'membername':_0x4a8ada[_0x8dc1('0x38')],'interface':_0x103654,'enterAt':moment()['format'](_0x8dc1('0x101')),'role':_0x4a8ada[_0x8dc1('0x2a')],'internal':_0x4a8ada[_0x8dc1('0x66')]};_0x3b1bd6[_0x8dc1('0xff')](function(_0x188b14){_0x29803c[_0x8dc1('0x4d')](_[_0x8dc1('0xd9')]({'channel':_0x188b14,'type':_0x8dc1('0x102'),'data1':_0xe4b9e2[_0x8dc1('0x61')][_0x8dc1('0x103')],'data2':_0x103654},_0x57a368));if(_0x4a8ada[_0x8dc1('0x9f')]){_0x1ae21e['push'](_[_0x8dc1('0xd9')]({'channel':_0x188b14,'type':'PAUSE','data1':_0x8dc1('0x104')},_0x57a368));}});return db[_0x8dc1('0xfe')][_0x8dc1('0x8c')](_0x29803c[_0x8dc1('0xc8')](_0x1ae21e),{'individualHooks':!![]});}})[_0x8dc1('0x1f')](function(){if(_0x4a8ada){return _0x4a8ada['update']({'online':!![],'lastLoginAt':moment()[_0x8dc1('0xac')](_0x8dc1('0x101')),'voicePause':_0x4a8ada[_0x8dc1('0x9f')]||![],'mailPause':_0x4a8ada[_0x8dc1('0x9f')]||![],'chatPause':_0x4a8ada[_0x8dc1('0x9f')]||![],'faxPause':_0x4a8ada['loginInPause']||![],'smsPause':_0x4a8ada[_0x8dc1('0x9f')]||![],'openchannelPause':_0x4a8ada[_0x8dc1('0x9f')]||![],'whatsappPause':_0x4a8ada['loginInPause']||![],'pauseType':_0x4a8ada[_0x8dc1('0x9f')]?'LOGININPAUSE':null,'interface':_0x103654,'lastPauseAt':moment()[_0x8dc1('0xac')]('YYYY-MM-DD\x20HH:mm:ss')});}})['then'](function(_0x46daa8){if(_0xe4b9e2['isMiddleware']){return _0x561396();}else{return Promise[_0x8dc1('0x105')](_0x46daa8)[_0x8dc1('0x1f')](respondWithResult(_0x233c19,null));}})['catch'](handleError(_0x233c19,null));};exports[_0x8dc1('0x106')]=function(_0xf3d5e8,_0x4ba015){var _0x2be2ac;return db[_0x8dc1('0x3d')][_0x8dc1('0x5f')]({'where':{'id':_0xf3d5e8[_0x8dc1('0x5c')]['id'],'role':_0x8dc1('0x2b')},'attributes':['id',_0x8dc1('0x38'),'role']})[_0x8dc1('0x1f')](handleEntityNotFound(_0x4ba015,null))[_0x8dc1('0x1f')](function(_0x30c89d){if(_0x30c89d){_0x2be2ac=_0x30c89d;return db[_0x8dc1('0xb4')]['destroy']({'where':{'membername':_0x2be2ac['name']},'individualHooks':!![]});}})['then'](function(){return db[_0x8dc1('0xfe')][_0x8dc1('0x4e')]({'where':{'membername':_0x2be2ac[_0x8dc1('0x38')],'exitAt':null}});})['then'](function(_0x2fcac9){var _0x174075=[];_0x2fcac9[_0x8dc1('0xff')](function(_0x53fed5){_0x174075[_0x8dc1('0x4d')](_0x53fed5[_0x8dc1('0x29')]({'exitAt':moment()[_0x8dc1('0xac')](_0x8dc1('0x101'))}));});return Promise[_0x8dc1('0x59')](_0x174075);})[_0x8dc1('0x1f')](function(){return _0x2be2ac['update']({'online':![],'voicePause':![],'mailPause':![],'chatPause':![],'faxPause':![],'smsPause':![],'openchannelPause':![],'whatsappPause':![],'interface':null});})[_0x8dc1('0x1f')](respondWithResult(_0x4ba015,null))[_0x8dc1('0x5a')](handleError(_0x4ba015,null));};exports['pause']=function(_0xdae784,_0x18c288){var _0x527826;return db[_0x8dc1('0xb4')]['update']({'paused':0x1},{'where':{'UserId':_0xdae784[_0x8dc1('0x5c')]['id']},'individualHooks':!![]})['then'](function(){return db['User'][_0x8dc1('0x5f')]({'where':{'id':_0xdae784[_0x8dc1('0x5c')]['id'],'role':_0x8dc1('0x2b')},'attributes':['id',_0x8dc1('0x38'),_0x8dc1('0x2a'),_0x8dc1('0x66'),_0x8dc1('0xa1'),_0x8dc1('0x9e')]});})[_0x8dc1('0x1f')](handleEntityNotFound(_0x18c288,null))[_0x8dc1('0x1f')](function(_0x2017d0){if(_0x2017d0){_0x527826=_0x2017d0;return respondWithRpcPromise('QueuePause',_0x8dc1('0x107'),{'id':_0x527826['id'],'name':_0x527826[_0x8dc1('0x38')],'pause':!![]});}})[_0x8dc1('0x1f')](function(){if(_0x527826){return db[_0x8dc1('0xfe')][_0x8dc1('0x4e')]({'where':{'membername':_0x527826['name'],'type':_0x8dc1('0x108'),'exitAt':null}});}})[_0x8dc1('0x1f')](function(_0x3c691b){if(_0x3c691b['length']){var _0x178e13=moment()[_0x8dc1('0xac')](_0x8dc1('0x101'));for(var _0xc1b279=0x0,_0x12a36f=_0x3c691b[_0x8dc1('0x52')];_0xc1b279<_0x12a36f;_0xc1b279++){_0x3c691b[_0xc1b279]['updateAttributes']({'exitAt':_0x178e13});}}})[_0x8dc1('0x1f')](function(){var _0x27f413=[];var _0x353c64=utils[_0x8dc1('0x100')]();_0x353c64[_0x8dc1('0xff')](function(_0x1b0334){_0x27f413[_0x8dc1('0x4d')]({'channel':_0x1b0334,'membername':_0x527826['name'],'interface':_[_0x8dc1('0x6d')](_0x527826[_0x8dc1('0xa1')])?util[_0x8dc1('0xac')](_0x8dc1('0xad'),_0x527826[_0x8dc1('0x38')]):_0x527826['interface'],'type':'PAUSE','enterAt':moment()[_0x8dc1('0xac')](_0x8dc1('0x101')),'data1':_0xdae784[_0x8dc1('0x61')][_0x8dc1('0x109')]||'DEFAULT\x20PAUSE','role':_0x527826[_0x8dc1('0x2a')],'internal':_0x527826[_0x8dc1('0x66')]});});return db[_0x8dc1('0xfe')]['bulkCreate'](_0x27f413,{'individualHooks':!![]});})[_0x8dc1('0x1f')](function(){return _0x527826[_0x8dc1('0x29')]({'voicePause':!![],'mailPause':!![],'chatPause':!![],'faxPause':!![],'smsPause':!![],'whatsappPause':!![],'openchannelPause':!![],'pauseType':_0xdae784[_0x8dc1('0x61')]['type']||_0x8dc1('0x10a'),'lastPauseAt':moment()[_0x8dc1('0xac')](_0x8dc1('0x101'))});})['then'](respondWithResult(_0x18c288,null))[_0x8dc1('0x5a')](handleError(_0x18c288,null));};exports['unpause']=function(_0x4b73a9,_0x5ec667){if(_0x4b73a9[_0x8dc1('0x61')][_0x8dc1('0x9d')]&&!utils[_0x8dc1('0xa2')](_0x4b73a9[_0x8dc1('0x61')][_0x8dc1('0x9d')])){throw new APIBadRequestError(util['format'](_0x8dc1('0x10b'),_0x4b73a9[_0x8dc1('0x61')][_0x8dc1('0x9d')]));}return db[_0x8dc1('0x3d')]['find']({'where':{'id':_0x4b73a9['params']['id']},'attributes':['id',_0x8dc1('0x38'),_0x8dc1('0x2a'),_0x8dc1('0x66'),_0x8dc1('0xa1'),_0x8dc1('0x9e'),'voicePause',_0x8dc1('0x10c'),_0x8dc1('0x10d'),_0x8dc1('0x10e'),_0x8dc1('0x10f'),_0x8dc1('0x110'),_0x8dc1('0x111'),_0x8dc1('0x112'),_0x8dc1('0x113')]})[_0x8dc1('0x1f')](function(_0x5830df){if(!_0x5830df){throw new APINotFoundError(util[_0x8dc1('0xac')]('User\x20with\x20id\x20%s\x20not\x20found',_0x4b73a9['params']['id']));}return _0x5830df[_0x8dc1('0x114')](_0x4b73a9[_0x8dc1('0x61')][_0x8dc1('0x9d')]);})[_0x8dc1('0x1f')](respondWithResult(_0x5ec667,null))[_0x8dc1('0x5a')](APIHandleError(_0x5ec667));};exports[_0x8dc1('0x115')]=function(_0x3cc4ce,_0x217052){var _0x365362={};var _0x4cf3ec={};var _0xf69fe8;var _0x10a309;return db[_0x8dc1('0x3d')]['findOne']({'where':{'id':_0x3cc4ce[_0x8dc1('0x5c')]['id']}})[_0x8dc1('0x1f')](handleEntityNotFound(_0x217052,null))[_0x8dc1('0x1f')](function(_0xd2c46e){if(_0xd2c46e){_0xf69fe8=_0xd2c46e;_0x4cf3ec[_0x8dc1('0xd2')]=_['keys'](db['Team'][_0x8dc1('0x3e')]);_0x4cf3ec['query']=_[_0x8dc1('0xd3')](_0x3cc4ce[_0x8dc1('0x48')]);_0x4cf3ec['filters']=_[_0x8dc1('0xd6')](_0x4cf3ec[_0x8dc1('0xd2')],_0x4cf3ec[_0x8dc1('0x48')]);_0x365362[_0x8dc1('0x4c')]=_['intersection'](_0x4cf3ec[_0x8dc1('0xd2')],qs[_0x8dc1('0xd7')](_0x3cc4ce['query']['fields']));_0x365362['attributes']=_0x365362[_0x8dc1('0x4c')][_0x8dc1('0x52')]?_0x365362['attributes']:_0x4cf3ec['model'];_0x365362[_0x8dc1('0xdf')]=qs['sort'](_0x3cc4ce[_0x8dc1('0x48')][_0x8dc1('0xd8')]);_0x365362[_0x8dc1('0x47')]=qs[_0x8dc1('0xd5')](_[_0x8dc1('0xdc')](_0x3cc4ce[_0x8dc1('0x48')],_0x4cf3ec[_0x8dc1('0xd5')]));if(_0x3cc4ce[_0x8dc1('0x48')][_0x8dc1('0x34')]){_0x365362[_0x8dc1('0x47')]=_[_0x8dc1('0xd9')](_0x365362[_0x8dc1('0x47')],{'$or':_[_0x8dc1('0x3f')](_0x365362[_0x8dc1('0x4c')],function(_0x4b6317){var _0x1fdbf6={};_0x1fdbf6[_0x4b6317]={'$like':'%'+_0x3cc4ce[_0x8dc1('0x48')][_0x8dc1('0x34')]+'%'};return _0x1fdbf6;})});}_0x365362=_[_0x8dc1('0xd9')]({},_0x365362,_0x3cc4ce[_0x8dc1('0x5e')]);return _0xf69fe8[_0x8dc1('0x115')](_0x365362);}})['then'](function(_0x264a06){if(_0x264a06){_0x10a309=_0x264a06[_0x8dc1('0x52')];if(!_0x3cc4ce[_0x8dc1('0x48')][_0x8dc1('0xca')](_0x8dc1('0xdb'))){_0x365362[_0x8dc1('0x19')]=qs[_0x8dc1('0x19')](_0x3cc4ce[_0x8dc1('0x48')][_0x8dc1('0x19')]);_0x365362[_0x8dc1('0x1b')]=qs['offset'](_0x3cc4ce[_0x8dc1('0x48')][_0x8dc1('0x1b')]);}return _0xf69fe8[_0x8dc1('0x115')](_0x365362);}})[_0x8dc1('0x1f')](function(_0xa1532c){if(_0xa1532c){return _0xa1532c?{'count':_0x10a309,'rows':_0xa1532c}:null;}})[_0x8dc1('0x1f')](respondWithResult(_0x217052,null))[_0x8dc1('0x5a')](handleError(_0x217052,null));};exports[_0x8dc1('0x116')]=function(_0x178d13,_0x45ae26){var _0x176b7b=_0x178d13[_0x8dc1('0x5c')]['id'];var _0x5c21e9=_0x178d13['body']?_0x178d13[_0x8dc1('0x61')][_0x8dc1('0x64')]:null;var _0xb64651=[];return Promise[_0x8dc1('0x105')]()[_0x8dc1('0x1f')](function(){if(!_0x5c21e9)throw new APIBadRequestError('Body\x20parameter\x20\x27ids\x27\x20is\x20required');})['then'](function(){return db[_0x8dc1('0x3d')][_0x8dc1('0x99')]({'where':{'id':_0x176b7b}});})['then'](function(_0x3ba438){if(!_0x3ba438)throw new APINotFoundError(util[_0x8dc1('0xac')]('User\x20with\x20id\x20%s\x20not\x20found',_0x178d13[_0x8dc1('0x5c')]['id']));return db[_0x8dc1('0x6e')][_0x8dc1('0xf9')](function(_0x1d84c1){return _0x3ba438[_0x8dc1('0x116')](_0x5c21e9,{'transaction':_0x1d84c1})['then'](function(){return db[_0x8dc1('0x117')][_0x8dc1('0x4e')]({'where':{'id':{'$in':_0x5c21e9}}});})[_0x8dc1('0x1f')](function(_0x302a39){var _0x2a985e=_[_0x8dc1('0x3f')](_0x302a39,function(_0x80c239){return _0x80c239[_0x8dc1('0x118')]();});return Promise[_0x8dc1('0x59')](_0x2a985e);})[_0x8dc1('0x1f')](function(_0x3711d9){_0xb64651=_[_0x8dc1('0x119')](_0x3711d9);var _0x319c51=_['map'](_0xb64651,function(_0x2f53b9){return _0x2f53b9[_0x8dc1('0x11a')](_0x3ba438['id'],{'transaction':_0x1d84c1});});return Promise[_0x8dc1('0x59')](_0x319c51);})[_0x8dc1('0x1f')](function(){if(!_0x3ba438['online'])return;var _0x10b82c=_[_0x8dc1('0x34')](_0xb64651,function(_0x33c505){return _0x33c505['getDataValue'](_0x8dc1('0x9d'))===_0x8dc1('0x11b');});var _0x2318ef=_[_0x8dc1('0x3f')](_0x10b82c,function(_0x438e4b){return db['UserVoiceQueueRt'][_0x8dc1('0xaf')]({'membername':_0x3ba438[_0x8dc1('0x38')],'UserId':_0x3ba438['id'],'queue_name':_0x438e4b[_0x8dc1('0x38')],'VoiceQueueId':_0x438e4b['id'],'interface':_['isNil'](_0x3ba438['interface'])?util[_0x8dc1('0xac')](_0x8dc1('0xad'),_0x3ba438[_0x8dc1('0x38')]):_0x3ba438[_0x8dc1('0xa1')],'paused':_0x3ba438['voicePause']||![],'penalty':_0x3ba438['penalty']},{'transaction':_0x1d84c1});});return Promise[_0x8dc1('0x59')](_0x2318ef);})[_0x8dc1('0x1f')](function(){return db[_0x8dc1('0x11c')][_0x8dc1('0x4e')]({'where':{'teamId':{'$in':_0x5c21e9}}});})[_0x8dc1('0x1f')](function(_0x54451f){var _0x12e69e=_[_0x8dc1('0x3f')](_0x54451f,function(_0xf3b059){return db[_0x8dc1('0x11d')][_0x8dc1('0x82')]({'UserId':_0x3ba438['id'],'VoicePrefixId':_0xf3b059[_0x8dc1('0x11e')]},{'transaction':_0x1d84c1});});return Promise[_0x8dc1('0x59')](_0x12e69e);});});})[_0x8dc1('0x1f')](function(){for(var _0x5829d3=0x0;_0x5829d3<_0xb64651[_0x8dc1('0x52')];_0x5829d3++){var _0x36ebbb=_0xb64651[_0x5829d3][_0x8dc1('0x11f')](_0x8dc1('0x9d'));var _0x63cc93=_0x36ebbb+'QueueId';socket[_0x8dc1('0x2c')]('user'+_0x36ebbb+_0x8dc1('0xa9'),{'UserId':_0x176b7b,['queueField']:_0xb64651[_0x5829d3]['id']});}})['then'](respondWithStatusCode(_0x45ae26,null))[_0x8dc1('0x5a')](APIHandleError(_0x45ae26));};exports[_0x8dc1('0x120')]=function(_0x511874,_0x4024db){var _0x596f62=_0x511874[_0x8dc1('0x5c')]['id'];var _0x15831e=null;if(_0x511874['query'][_0x8dc1('0x64')]){_0x15831e=_[_0x8dc1('0xb2')](_0x511874[_0x8dc1('0x48')][_0x8dc1('0x64')])?_0x511874[_0x8dc1('0x48')][_0x8dc1('0x64')]:[_0x511874['query']['ids']];}var _0x251f4f=[];return Promise[_0x8dc1('0x105')]()['then'](function(){if(!_0x15831e)throw new APIBadRequestError(_0x8dc1('0x121'));})[_0x8dc1('0x1f')](function(){return db[_0x8dc1('0x3d')][_0x8dc1('0x99')]({'where':{'id':_0x596f62}});})['then'](function(_0xb389dd){if(!_0xb389dd)throw new APINotFoundError(util[_0x8dc1('0xac')]('User\x20with\x20id\x20%s\x20not\x20found',_0x511874[_0x8dc1('0x5c')]['id']));return db[_0x8dc1('0x6e')][_0x8dc1('0xf9')](function(_0x74f4ac){return _0xb389dd[_0x8dc1('0x120')](_0x15831e,{'transaction':_0x74f4ac})[_0x8dc1('0x1f')](function(){return db[_0x8dc1('0x117')]['findAll']({'where':{'id':{'$in':_0x15831e}}});})[_0x8dc1('0x1f')](function(_0x1837ff){var _0x37f292=_['map'](_0x1837ff,function(_0x4baeaa){return _0x4baeaa[_0x8dc1('0x118')]();});return Promise[_0x8dc1('0x59')](_0x37f292);})[_0x8dc1('0x1f')](function(_0x584920){_0x251f4f=_['flattenDeep'](_0x584920);var _0x147bb4=_[_0x8dc1('0x3f')](_0x251f4f,function(_0xc3dff0){return _0xc3dff0[_0x8dc1('0x122')](_0xb389dd['id'],{'transaction':_0x74f4ac});});return Promise[_0x8dc1('0x59')](_0x147bb4);})['then'](function(){if(!_0xb389dd[_0x8dc1('0x9e')])return;var _0x35d0cb=_[_0x8dc1('0x34')](_0x251f4f,function(_0x157f8c){return _0x157f8c[_0x8dc1('0x11f')](_0x8dc1('0x9d'))==='Voice';});var _0x1762da=_[_0x8dc1('0x3f')](_0x35d0cb,function(_0x19cc4a){return db[_0x8dc1('0xb4')][_0x8dc1('0x2e')]({'where':{'VoiceQueueId':_0x19cc4a['id'],'UserId':_0xb389dd['id']},'transaction':_0x74f4ac});});return Promise[_0x8dc1('0x59')](_0x1762da);})[_0x8dc1('0x1f')](function(){return db[_0x8dc1('0x11c')]['findAll']({'where':{'teamId':{'$in':_0x15831e}}});})[_0x8dc1('0x1f')](function(_0x411ffa){var _0x1ee354=_['map'](_0x411ffa,function(_0x153091){return db[_0x8dc1('0x11d')][_0x8dc1('0x2e')]({'where':{'UserId':_0xb389dd['id'],'VoicePrefixId':_0x153091[_0x8dc1('0x11e')]}},{'transaction':_0x74f4ac});});return Promise[_0x8dc1('0x59')](_0x1ee354);});});})[_0x8dc1('0x1f')](function(){for(var _0x1f656a=0x0;_0x1f656a<_0x251f4f[_0x8dc1('0x52')];_0x1f656a++){var _0x1d7e3a=_0x251f4f[_0x1f656a][_0x8dc1('0x11f')](_0x8dc1('0x9d'));var _0x50430b=_0x1d7e3a+'QueueId';socket['emit'](_0x8dc1('0x31')+_0x1d7e3a+_0x8dc1('0xb3'),{'UserId':_0x596f62,['queueField']:_0x251f4f[_0x1f656a]['id']});}})['then'](respondWithStatusCode(_0x4024db,null))[_0x8dc1('0x5a')](APIHandleError(_0x4024db));};exports['getLists']=function(_0x1a1906,_0x1b54e5){var _0x55486a={};var _0xa1a23d={};var _0x4619e2;var _0x1f57c5;return db[_0x8dc1('0x3d')][_0x8dc1('0x99')]({'where':{'id':_0x1a1906[_0x8dc1('0x5c')]['id']}})['then'](handleEntityNotFound(_0x1b54e5,null))[_0x8dc1('0x1f')](function(_0x4883c9){if(_0x4883c9){_0x4619e2=_0x4883c9;_0xa1a23d[_0x8dc1('0xd2')]=_[_0x8dc1('0xd3')](db[_0x8dc1('0xcb')]['rawAttributes']);_0xa1a23d[_0x8dc1('0x48')]=_[_0x8dc1('0xd3')](_0x1a1906[_0x8dc1('0x48')]);_0xa1a23d[_0x8dc1('0xd5')]=_[_0x8dc1('0xd6')](_0xa1a23d[_0x8dc1('0xd2')],_0xa1a23d['query']);_0x55486a['attributes']=_[_0x8dc1('0xd6')](_0xa1a23d[_0x8dc1('0xd2')],qs[_0x8dc1('0xd7')](_0x1a1906[_0x8dc1('0x48')]['fields']));_0x55486a[_0x8dc1('0x4c')]=_0x55486a[_0x8dc1('0x4c')][_0x8dc1('0x52')]?_0x55486a[_0x8dc1('0x4c')]:_0xa1a23d['model'];_0x55486a[_0x8dc1('0xdf')]=qs[_0x8dc1('0xd8')](_0x1a1906[_0x8dc1('0x48')][_0x8dc1('0xd8')]);_0x55486a['where']=qs[_0x8dc1('0xd5')](_[_0x8dc1('0xdc')](_0x1a1906[_0x8dc1('0x48')],_0xa1a23d[_0x8dc1('0xd5')]));if(_0x1a1906[_0x8dc1('0x48')][_0x8dc1('0x34')]){_0x55486a[_0x8dc1('0x47')]=_['merge'](_0x55486a[_0x8dc1('0x47')],{'$or':_['map'](_0x55486a[_0x8dc1('0x4c')],function(_0x220c8c){var _0xc87ec8={};_0xc87ec8[_0x220c8c]={'$like':'%'+_0x1a1906[_0x8dc1('0x48')][_0x8dc1('0x34')]+'%'};return _0xc87ec8;})});}_0x55486a=_[_0x8dc1('0xd9')]({},_0x55486a,_0x1a1906[_0x8dc1('0x5e')]);return _0x4619e2[_0x8dc1('0x123')](_0x55486a);}})['then'](function(_0x85e847){if(_0x85e847){_0x1f57c5=_0x85e847[_0x8dc1('0x52')];if(!_0x1a1906[_0x8dc1('0x48')][_0x8dc1('0xca')](_0x8dc1('0xdb'))){_0x55486a[_0x8dc1('0x19')]=qs[_0x8dc1('0x19')](_0x1a1906[_0x8dc1('0x48')][_0x8dc1('0x19')]);_0x55486a[_0x8dc1('0x1b')]=qs[_0x8dc1('0x1b')](_0x1a1906[_0x8dc1('0x48')][_0x8dc1('0x1b')]);}return _0x4619e2['getLists'](_0x55486a);}})[_0x8dc1('0x1f')](function(_0x2c4ea9){if(_0x2c4ea9){return _0x2c4ea9?{'count':_0x1f57c5,'rows':_0x2c4ea9}:null;}})[_0x8dc1('0x1f')](respondWithResult(_0x1b54e5,null))['catch'](handleError(_0x1b54e5,null));};exports[_0x8dc1('0x124')]=function(_0x3b26fa,_0x41fd6f){var _0x564f9d={};var _0x579ea2={};var _0x4fc10c;return db[_0x8dc1('0x3d')][_0x8dc1('0x99')]({'where':{'id':_0x3b26fa[_0x8dc1('0x5c')]['id']}})['then'](handleEntityNotFound(_0x41fd6f,null))['then'](function(_0x24dfe5){if(_0x24dfe5){_0x4fc10c=_0x24dfe5;_0x579ea2[_0x8dc1('0xd2')]=_[_0x8dc1('0xd3')](db[_0x8dc1('0x3d')][_0x8dc1('0x3e')]);_0x579ea2[_0x8dc1('0x48')]=_[_0x8dc1('0xd3')](_0x3b26fa[_0x8dc1('0x48')]);_0x579ea2[_0x8dc1('0xd5')]=_[_0x8dc1('0xd6')](_0x579ea2[_0x8dc1('0xd2')],_0x579ea2[_0x8dc1('0x48')]);_0x564f9d[_0x8dc1('0x4c')]=_[_0x8dc1('0xd6')](_0x579ea2[_0x8dc1('0xd2')],qs['fields'](_0x3b26fa[_0x8dc1('0x48')][_0x8dc1('0xd7')]));_0x564f9d[_0x8dc1('0x4c')]=_0x564f9d[_0x8dc1('0x4c')][_0x8dc1('0x52')]?_0x564f9d['attributes']:_0x579ea2[_0x8dc1('0xd2')];_0x564f9d[_0x8dc1('0xdf')]=qs[_0x8dc1('0xd8')](_0x3b26fa[_0x8dc1('0x48')]['sort']);_0x564f9d[_0x8dc1('0x47')]=qs[_0x8dc1('0xd5')](_[_0x8dc1('0xdc')](_0x3b26fa[_0x8dc1('0x48')],_0x579ea2[_0x8dc1('0xd5')]));if(_0x3b26fa[_0x8dc1('0x48')]['filter']){_0x564f9d[_0x8dc1('0x47')]=_[_0x8dc1('0xd9')](_0x564f9d[_0x8dc1('0x47')],{'$or':_['map'](_0x564f9d[_0x8dc1('0x4c')],function(_0x50d692){var _0x557fe8={};_0x557fe8[_0x50d692]={'$like':'%'+_0x3b26fa[_0x8dc1('0x48')][_0x8dc1('0x34')]+'%'};return _0x557fe8;})});}_0x564f9d[_0x8dc1('0xd2')]=db[_0x8dc1('0x3d')];_0x564f9d['as']=_0x8dc1('0x89');_0x564f9d=_['merge']({},_0x564f9d,_0x3b26fa[_0x8dc1('0x5e')]);return _0x4fc10c[_0x8dc1('0xfc')]({'include':[_0x564f9d]});}})[_0x8dc1('0x1f')](function(_0x3b050a){if(_0x3b050a){var _0x519d30={},_0x4ab8f1=[];for(var _0x358670=0x0;_0x358670<_0x3b050a[_0x8dc1('0x52')];_0x358670+=0x1){for(var _0xf00129=0x0,_0x5607c9;_0xf00129<_0x3b050a[_0x358670][_0x8dc1('0x89')]['length'];_0xf00129+=0x1){_0x5607c9=_0x3b050a[_0x358670][_0x8dc1('0x89')][_0xf00129][_0x8dc1('0x2f')]({'plain':!![]});_0x519d30[_0x5607c9['id']]=_0x5607c9;}}_0x519d30=_[_0x8dc1('0x125')](_0x519d30);for(var _0x36ab81=qs[_0x8dc1('0x1b')](_0x3b26fa[_0x8dc1('0x48')][_0x8dc1('0x1b')]);_0x36ab81<_0x519d30[_0x8dc1('0x52')]&&_0x4ab8f1[_0x8dc1('0x52')]=_0x261420){_0x451b9c=_0x261420;_0x34d22d=0xc8;}else{_0x34d22d=0xce;}_0x16243b[_0xfd00('0x18')](_0x34d22d);return _0x16243b[_0xfd00('0x1f')](_0xfd00('0x20'),_0x2ff1ac+'-'+_0x451b9c+'/'+_0x261420)[_0xfd00('0x1a')](_0x5ae825);}return null;};}function respondWithRpcPromise(_0x200c55,_0x568fba,_0x25aa79,_0x29a0ab){return new Promise(function(_0x119fcd,_0x571cde){var _0x7322e3=_0x29a0ab||amiClient;return _0x7322e3[_0xfd00('0x21')](_0x200c55,_0x25aa79)[_0xfd00('0x22')](function(_0x5d6b94){logger[_0xfd00('0x23')](_0xfd00('0x24'),_0x568fba,_0xfd00('0x25'));logger[_0xfd00('0x26')](_0xfd00('0x27'),_0x568fba,_0xfd00('0x25'),JSON[_0xfd00('0x28')](_0x5d6b94));if(_0x5d6b94['error']){if(_0x5d6b94[_0xfd00('0x29')]['code']===0x1f4){logger[_0xfd00('0x29')]('User,\x20%s,\x20%s',_0x568fba,_0x5d6b94['error'][_0xfd00('0x2a')]);return _0x571cde(_0x5d6b94['error'][_0xfd00('0x2a')]);}logger[_0xfd00('0x29')](_0xfd00('0x24'),_0x568fba,_0x5d6b94['error'][_0xfd00('0x2a')]);return _0x119fcd(_0x5d6b94[_0xfd00('0x29')][_0xfd00('0x2a')]);}else{logger[_0xfd00('0x23')](_0xfd00('0x24'),_0x568fba,_0xfd00('0x25'));_0x119fcd(_0x5d6b94[_0xfd00('0x2b')][_0xfd00('0x2a')]);}})[_0xfd00('0x2c')](function(_0x4b8cf7){logger[_0xfd00('0x29')](_0xfd00('0x24'),_0x568fba,_0x4b8cf7);_0x571cde(_0x4b8cf7);});});}function saveUpdates(_0x4095ec){return function(_0xeb27c0){if(_0xeb27c0){return _0xeb27c0[_0xfd00('0x2d')](_0x4095ec)[_0xfd00('0x22')](function(_0x32e167){if(_0x32e167[_0xfd00('0x2e')]===_0xfd00('0x2f')){socket['emit']('userNotification:recalc:'+_0x32e167['id'],_0x32e167);}return _0x32e167;});}return null;};}function removeEntity(_0x5ed8d8,_0xd84838){return function(_0x336a1b){if(_0x336a1b){return _0x336a1b['destroy']({'transaction':_0xd84838})[_0xfd00('0x22')](function(){var _0x3f6682=_0x336a1b[_0xfd00('0x30')]({'plain':!![]});if(_0x3f6682[_0xfd00('0x2e')]===_0xfd00('0x31'))return;var _0x13803c=[{'name':_0xfd00('0x32'),'value':_0xfd00('0x33'),'ignore':!![]},{'name':'Agents','value':_0xfd00('0x2f'),'ignore':![]},{'name':'Telephones','value':_0xfd00('0x34'),'ignore':![]}];var _0x347827=_(_0x13803c)[_0xfd00('0x35')](_0xfd00('0x36'))['map'](_0xfd00('0x37'))[_0xfd00('0x37')]();if(_[_0xfd00('0x38')](_0x347827,_0x3f6682[_0xfd00('0x2e')])){return;}var _0x20646d=_[_0xfd00('0x39')](_0x13803c,[_0xfd00('0x37'),_0x3f6682[_0xfd00('0x2e')]])[_0xfd00('0x3a')];return db[_0xfd00('0x3b')][_0xfd00('0x3c')]({'where':{'type':_0x20646d,'resourceId':_0x3f6682['id']},'transaction':_0xd84838})[_0xfd00('0x22')](function(){return _0x336a1b;});})[_0xfd00('0x22')](function(){_0x5ed8d8[_0xfd00('0x18')](0xcc)[_0xfd00('0x19')]();});}};}function handleEntityNotFound(_0x1b1449){return function(_0xb58bcd){if(!_0xb58bcd){_0x1b1449['sendStatus'](0x194);}return _0xb58bcd;};}function handleError(_0x2ebc92,_0xe8a446){_0xe8a446=_0xe8a446||0x1f4;return function(_0xb602e6){logger[_0xfd00('0x29')](_0xb602e6[_0xfd00('0x3d')]);if(_0xb602e6['name']){delete _0xb602e6[_0xfd00('0x3a')];}_0x2ebc92[_0xfd00('0x18')](_0xe8a446)[_0xfd00('0x3e')](_0xb602e6);};}function getUserAttributes(){return _(db[_0xfd00('0x3f')][_0xfd00('0x40')])[_0xfd00('0x41')](function(_0x5d93f9){return{'name':_0x5d93f9[_0xfd00('0x42')],'type':_0x5d93f9[_0xfd00('0x43')][_0xfd00('0x44')]};})['filter'](function(_0x257479){return![_0xfd00('0x45'),_0xfd00('0x46'),'previousPasswords',_0xfd00('0x47'),_0xfd00('0x48'),_0xfd00('0x49')]['includes'](_0x257479['name']);})[_0xfd00('0x37')]();}exports[_0xfd00('0x4a')]=function(_0x1e4ce5,_0x521bdc){var _0x6d8c4c={},_0x585ef6={'count':0x0,'rows':[]};var _0x244744=getUserAttributes();_0x6d8c4c=qs['getOptions'](_0x244744,_0x1e4ce5);var _0x667c80={'where':_0x6d8c4c['where']};return db[_0xfd00('0x3f')]['count'](_0x667c80)['then'](function(_0x3f8b0c){_0x585ef6['count']=_0x3f8b0c;if(_0x1e4ce5[_0xfd00('0x4b')]['includeAll']){_0x6d8c4c[_0xfd00('0x4c')]=[{'all':!![]}];}if(_0x1e4ce5[_0xfd00('0x4b')][_0xfd00('0x4d')]===_0xfd00('0x4e')){_0x6d8c4c[_0xfd00('0x4c')]=[{'model':db[_0xfd00('0x4f')],'as':_0xfd00('0x4d')}];}if(!_[_0xfd00('0x38')](_0x6d8c4c[_0xfd00('0x50')],'id')){_0x6d8c4c[_0xfd00('0x50')][_0xfd00('0x51')]('id');}return db['User'][_0xfd00('0x52')](_0x6d8c4c);})[_0xfd00('0x22')](function(_0x3f5813){_0x585ef6[_0xfd00('0x53')]=_0x3f5813;if(_0x1e4ce5[_0xfd00('0x4b')][_0xfd00('0x54')]==='true'){var _0x13cd55=[];for(var _0x3d92ff=0x0;_0x3d92ff<_0x585ef6[_0xfd00('0x53')][_0xfd00('0x55')];_0x3d92ff++){_0x13cd55[_0xfd00('0x51')](get_open_tabs('chat',_0x585ef6['rows'][_0x3d92ff][_0xfd00('0x56')]));_0x13cd55[_0xfd00('0x51')](get_open_tabs(_0xfd00('0x57'),_0x585ef6[_0xfd00('0x53')][_0x3d92ff][_0xfd00('0x56')]));_0x13cd55[_0xfd00('0x51')](get_open_tabs(_0xfd00('0x58'),_0x585ef6['rows'][_0x3d92ff][_0xfd00('0x56')]));_0x13cd55[_0xfd00('0x51')](get_open_tabs(_0xfd00('0x59'),_0x585ef6[_0xfd00('0x53')][_0x3d92ff][_0xfd00('0x56')]));_0x13cd55[_0xfd00('0x51')](get_open_tabs(_0xfd00('0x5a'),_0x585ef6[_0xfd00('0x53')][_0x3d92ff][_0xfd00('0x56')]));_0x13cd55[_0xfd00('0x51')](get_open_tabs(_0xfd00('0x5b'),_0x585ef6[_0xfd00('0x53')][_0x3d92ff]['dataValues']));}return Promise[_0xfd00('0x5c')](_0x13cd55)['then'](function(){return _0x585ef6;});}else{return _0x585ef6;}})['then'](respondWithFilteredResult(_0x521bdc,_0x6d8c4c))[_0xfd00('0x2c')](handleError(_0x521bdc,null));};exports[_0xfd00('0x5d')]=function(_0x53db96,_0x4b315d){var _0x30b321=getUserAttributes();_0x53db96[_0xfd00('0x4b')]['id']=_0x53db96[_0xfd00('0x5e')]['id'];var _0x49c3ae=qs[_0xfd00('0x5f')](_0x30b321,_0x53db96);if(_0x53db96['query'][_0xfd00('0x60')]){_0x49c3ae[_0xfd00('0x4c')]=[{'all':!![]}];}if(_0x53db96['query'][_0xfd00('0x4d')]==='true'){_0x49c3ae[_0xfd00('0x4c')]=[{'model':db[_0xfd00('0x4f')],'as':_0xfd00('0x4d')}];}_0x49c3ae=_[_0xfd00('0x61')]({},_0x49c3ae,_0x53db96[_0xfd00('0x62')]);if(!_[_0xfd00('0x38')](_0x49c3ae[_0xfd00('0x50')],'id')){_0x49c3ae[_0xfd00('0x50')][_0xfd00('0x51')]('id');}return db[_0xfd00('0x3f')]['find'](_0x49c3ae)[_0xfd00('0x22')](handleEntityNotFound(_0x4b315d,null))['then'](function(_0x29f9b4){var _0x5b3bb1=[];values=_0x29f9b4;if(_0x53db96[_0xfd00('0x4b')][_0xfd00('0x54')]===_0xfd00('0x4e')){_0x5b3bb1[_0xfd00('0x51')](get_open_tabs('chat',_0x29f9b4[_0xfd00('0x56')]));_0x5b3bb1['push'](get_open_tabs(_0xfd00('0x57'),_0x29f9b4['dataValues']));_0x5b3bb1[_0xfd00('0x51')](get_open_tabs(_0xfd00('0x5a'),_0x29f9b4[_0xfd00('0x56')]));_0x5b3bb1[_0xfd00('0x51')](get_open_tabs(_0xfd00('0x5b'),_0x29f9b4['dataValues']));_0x5b3bb1[_0xfd00('0x51')](get_open_tabs(_0xfd00('0x58'),_0x29f9b4[_0xfd00('0x56')]));_0x5b3bb1[_0xfd00('0x51')](get_open_tabs(_0xfd00('0x59'),_0x29f9b4['dataValues']));return Promise[_0xfd00('0x5c')](_0x5b3bb1);}else{return values;}})[_0xfd00('0x22')](function(){return values;})[_0xfd00('0x22')](respondWithResult(_0x4b315d,null))[_0xfd00('0x2c')](handleError(_0x4b315d,null));};exports[_0xfd00('0x2d')]=function(_0xf74852,_0x5ac6d6){if(_0xf74852['body']['id']){delete _0xf74852[_0xfd00('0x63')]['id'];}delete _0xf74852['body'][_0xfd00('0x2e')];return db[_0xfd00('0x3f')][_0xfd00('0x39')]({'where':{'id':_0xf74852[_0xfd00('0x5e')]['id']}})[_0xfd00('0x22')](handleEntityNotFound(_0x5ac6d6,null))['then'](saveUpdates(_0xf74852['body'],null))[_0xfd00('0x22')](respondWithResult(_0x5ac6d6,null))[_0xfd00('0x2c')](handleError(_0x5ac6d6,null));};exports[_0xfd00('0x64')]=function(_0x2ec7a3,_0x12b7c7){return db[_0xfd00('0x3f')]['describe']()[_0xfd00('0x22')](respondWithResult(_0x12b7c7,null))[_0xfd00('0x2c')](handleError(_0x12b7c7,null));};exports[_0xfd00('0x65')]=function(_0x39beea,_0x509607){return db[_0xfd00('0x3f')][_0xfd00('0x39')]({'where':{'id':_0x39beea[_0xfd00('0x5e')]['id']}})[_0xfd00('0x22')](handleEntityNotFound(_0x509607,null))[_0xfd00('0x22')](function(_0x42591f){if(_0x42591f){return _0x42591f[_0xfd00('0x65')](_0x39beea[_0xfd00('0x63')][_0xfd00('0x66')],_['omit'](_0x39beea['body'],['ids','id'])||{});}})['then'](respondWithResult(_0x509607,null))[_0xfd00('0x2c')](handleError(_0x509607,null));};function validateUser(_0x2a71cb){return new Promise(function(_0x12bc2c,_0x24956d){if(_0x2a71cb[_0xfd00('0x67')])return _0x12bc2c(_0x2a71cb);return db[_0xfd00('0x68')][_0xfd00('0x69')](0x1)[_0xfd00('0x22')](function(_0x1d2a40){if(_0x1d2a40[_0xfd00('0x6a')])authService['validatePasswordPattern'](_0x2a71cb[_0xfd00('0x45')]);db['User'][_0xfd00('0x6b')](_0xfd00('0x67'))[_0xfd00('0x22')](function(_0x3dad68){if(_['isNil'](_0x3dad68)){_0x2a71cb[_0xfd00('0x67')]=_0x1d2a40[_0xfd00('0x6c')]||0x1;return;}if(_[_0xfd00('0x6d')](_0x1d2a40['min_internal'])||_0x1d2a40[_0xfd00('0x6c')]===_0x3dad68){_0x2a71cb[_0xfd00('0x67')]=_0x3dad68+0x1;return;}if(_0x1d2a40[_0xfd00('0x6c')]>_0x3dad68){_0x2a71cb[_0xfd00('0x67')]=_0x1d2a40[_0xfd00('0x6c')];return;}return db[_0xfd00('0x6e')][_0xfd00('0x4b')](_0xfd00('0x6f'),{'type':db[_0xfd00('0x6e')]['QueryTypes'][_0xfd00('0x70')]})['then'](function(_0x5c10a6){if(_0x5c10a6&&_0x5c10a6[_0xfd00('0x55')]){for(var _0x1977a0=0x0,_0x255dfe=_0x5c10a6[_0xfd00('0x55')];_0x1977a0<_0x255dfe&&_['isNil'](_0x2a71cb[_0xfd00('0x67')]);_0x1977a0++){if(_0x1d2a40['min_internal']<=_0x5c10a6[_0x1977a0][_0xfd00('0x71')]){_0x2a71cb[_0xfd00('0x67')]=_0x5c10a6[_0x1977a0]['from'];}else if(_0x1d2a40[_0xfd00('0x6c')]>_0x5c10a6[_0x1977a0]['from']&&_0x1d2a40[_0xfd00('0x6c')]<=_0x5c10a6[_0x1977a0]['to']){_0x2a71cb[_0xfd00('0x67')]=_0x1d2a40['min_internal'];}}}if(_[_0xfd00('0x6d')](_0x2a71cb[_0xfd00('0x67')])){_0x2a71cb['internal']=_0x3dad68+0x1;}return _0x12bc2c(_0x2a71cb);});});})[_0xfd00('0x2c')](function(_0x457285){_0x24956d(_0x457285);});});}function updateUser(_0x172b75){return new Promise(function(_0x299301,_0xaef369){try{if(_0x172b75[_0xfd00('0x72')]){_0x172b75[_0xfd00('0x73')]=_0x172b75[_0xfd00('0x67')];_0x172b75[_0xfd00('0x74')]={'mailbox':_0x172b75['internal'],'password':_0x172b75[_0xfd00('0x45')],'fullname':_0x172b75[_0xfd00('0x75')],'email':_0x172b75[_0xfd00('0x76')]};}if(_0x172b75['role']===_0xfd00('0x2f')){if(!_0x172b75[_0xfd00('0x77')])_0x172b75[_0xfd00('0x77')]=[_0xfd00('0x78'),_0xfd00('0x79'),'103',_0xfd00('0x7a'),_0xfd00('0x7b'),_0xfd00('0x7c'),_0xfd00('0x7d'),'106',_0xfd00('0x7e'),_0xfd00('0x7f'),_0xfd00('0x80'),_0xfd00('0x81'),'111','114',_0xfd00('0x82')];}_0x299301(_0x172b75);}catch(_0x494502){_0xaef369(_0x494502);}});}exports['create']=function(_0x5c884c,_0x55a389){if(_0x5c884c[_0xfd00('0x33')][_0xfd00('0x2e')]===_0xfd00('0x2f'))throw new Error(_0xfd00('0x83'));if(_0x5c884c[_0xfd00('0x63')][_0xfd00('0x2e')]==='user'&&_0x5c884c['user'][_0xfd00('0x2e')]!==_0xfd00('0x31')){throw new Error('Unauthorized.\x20You\x20must\x20be\x20an\x20administrator\x20in\x20order\x20to\x20create\x20an\x20user');}if(_0x5c884c[_0xfd00('0x63')]['role']==='admin'&&_0x5c884c[_0xfd00('0x33')]['role']!==_0xfd00('0x31')){throw new Error(_0xfd00('0x84'));}return licenseUtil[_0xfd00('0x85')]([_0x5c884c['body']])[_0xfd00('0x22')](function(){return validateUser(_0x5c884c[_0xfd00('0x63')]);})['then'](function(_0x4cb672){return updateUser(_0x4cb672)[_0xfd00('0x22')](function(_0x164a70){if(_0x164a70[_0xfd00('0x2e')]==='admin'){_0x164a70[_0xfd00('0x86')]=_0x5c884c[_0xfd00('0x33')][_0xfd00('0x86')];delete _0x164a70[_0xfd00('0x87')];}return _0x164a70;});})[_0xfd00('0x22')](function(_0x1c01bc){return db[_0xfd00('0x3f')][_0xfd00('0x88')](_0x1c01bc,{'include':[{'model':db[_0xfd00('0x74')],'as':'VoiceMail'}]});})['then'](function(_0x483831){if(_0x5c884c[_0xfd00('0x63')]['role']===_0xfd00('0x33'))return _0x483831;if(_0x5c884c[_0xfd00('0x33')][_0xfd00('0x2e')]!=='user')return _0x483831;return db[_0xfd00('0x89')]['find']({'where':{'name':_0x483831['role']===_0xfd00('0x2f')?_0xfd00('0x8a'):_0xfd00('0x8b'),'userProfileId':_0x5c884c[_0xfd00('0x33')][_0xfd00('0x87')]},'raw':!![]})[_0xfd00('0x22')](function(_0x411438){if(!_0x411438||_0x411438[_0xfd00('0x8c')]!=0x0)return _0x483831;return db[_0xfd00('0x3b')][_0xfd00('0x88')]({'name':_0x483831[_0xfd00('0x3a')],'resourceId':_0x483831['id'],'type':_0x411438[_0xfd00('0x3a')],'sectionId':_0x411438['id']},{})['then'](function(){return _0x483831;});})[_0xfd00('0x2c')](function(_0x148537){logger[_0xfd00('0x29')](_0xfd00('0x8d'),_0x148537);throw _0x148537;});})[_0xfd00('0x22')](respondWithResult(_0x55a389,0xc9))[_0xfd00('0x2c')](handleError(_0x55a389,null));};exports[_0xfd00('0x8e')]=function(_0x23aae9,_0x1ea550){var _0x7082ad=_0x23aae9[_0xfd00('0x63')];var _0x29a5d0=[];if(_0x23aae9[_0xfd00('0x33')][_0xfd00('0x2e')]===_0xfd00('0x2f'))throw new Error(_0xfd00('0x83'));if(_[_0xfd00('0x8f')](_0x7082ad,[_0xfd00('0x2e'),_0xfd00('0x33')])&&_0x23aae9[_0xfd00('0x33')]['role']!==_0xfd00('0x31')){throw new Error(_0xfd00('0x90'));}if(_[_0xfd00('0x8f')](_0x7082ad,[_0xfd00('0x2e'),_0xfd00('0x31')])&&_0x23aae9[_0xfd00('0x33')][_0xfd00('0x2e')]!==_0xfd00('0x31')){throw new Error(_0xfd00('0x91'));}return licenseUtil[_0xfd00('0x85')](_0x7082ad)[_0xfd00('0x22')](function(){return validateUser(_0x7082ad[0x0]);})[_0xfd00('0x22')](function(){for(var _0x4608e8=0x1;_0x4608e8<_0x7082ad['length'];_0x4608e8++){var _0x31790d=_0x7082ad[_0x4608e8-0x1]['internal'];if(!_0x7082ad[_0x4608e8][_0xfd00('0x67')])_0x7082ad[_0x4608e8][_0xfd00('0x67')]=_0x31790d+0x1;_0x29a5d0[_0xfd00('0x51')](validateUser(_0x7082ad[_0x4608e8]));}return Promise[_0xfd00('0x5c')](_0x29a5d0);})['then'](function(){_0x29a5d0=[];for(var _0xd7c676=0x0;_0xd7c676<_0x7082ad[_0xfd00('0x55')];_0xd7c676++){_0x29a5d0[_0xfd00('0x51')](updateUser(_0x7082ad[_0xd7c676]));}return Promise['all'](_0x29a5d0);})['then'](function(){_0x29a5d0=_0x7082ad[_0xfd00('0x41')](function(_0x5d61d7){return db[_0xfd00('0x3f')][_0xfd00('0x88')](_0x5d61d7,{'include':[{'model':db[_0xfd00('0x74')],'as':_0xfd00('0x74')}]})[_0xfd00('0x22')](function(_0x5111c7){_0x5d61d7['id']=_0x5111c7['id'];return _0x5d61d7;});});return Promise[_0xfd00('0x5c')](_0x29a5d0);})['then'](function(_0x3a1059){if(_0x23aae9[_0xfd00('0x63')][_0xfd00('0x2e')]===_0xfd00('0x33'))return _0x3a1059;if(_0x23aae9[_0xfd00('0x33')][_0xfd00('0x2e')]!==_0xfd00('0x33'))return _0x3a1059;var _0x1f179d=_[_0xfd00('0x8f')](_0x3a1059,function(_0xdf128){return _0xdf128[_0xfd00('0x2e')]===_0xfd00('0x2f')||_0xdf128[_0xfd00('0x2e')]===_0xfd00('0x34');});if(!_0x1f179d)return _0x3a1059;return db[_0xfd00('0x89')][_0xfd00('0x52')]({'where':{'name':{'$or':['Agents',_0xfd00('0x8b')]},'userProfileId':_0x23aae9[_0xfd00('0x33')][_0xfd00('0x87')]},'raw':!![]})[_0xfd00('0x22')](function(_0x43d3a0){if(_['isEmpty'](_0x43d3a0)||!_['some'](_0x43d3a0,[_0xfd00('0x8c'),0x0]))return _0x3a1059;_0x29a5d0=[];var _0x46d319=_(_0x43d3a0)[_0xfd00('0x41')](function(_0xc748f4){if(_0xc748f4[_0xfd00('0x8c')]===0x1)return;return _0xc748f4['name']==='Agents'?_0xfd00('0x2f'):_0xfd00('0x34');})[_0xfd00('0x92')]()['value']();for(var _0x4c82b1=0x0;_0x4c82b1<_0x3a1059[_0xfd00('0x55')];_0x4c82b1++){if(!_[_0xfd00('0x38')](_0x46d319,_0x3a1059[_0x4c82b1][_0xfd00('0x2e')]))return;var _0x33b80b=_0x3a1059[_0x4c82b1][_0xfd00('0x2e')]===_0xfd00('0x2f')?'Agents':_0xfd00('0x8b');_0x29a5d0[_0xfd00('0x51')](db[_0xfd00('0x3b')][_0xfd00('0x88')]({'name':_0x3a1059[_0x4c82b1][_0xfd00('0x3a')],'resourceId':_0x3a1059[_0x4c82b1]['id'],'type':_0x33b80b,'sectionId':_[_0xfd00('0x39')](_0x43d3a0,[_0xfd00('0x3a'),_0x33b80b])['id']},{}));}return Promise[_0xfd00('0x5c')](_0x29a5d0);});})['then'](respondWithResult(_0x1ea550,0xc9))['catch'](handleError(_0x1ea550,null));};exports[_0xfd00('0x93')]=function(_0x146782,_0x55b5fc){if(_0x146782['body']['id']){delete _0x146782[_0xfd00('0x63')]['id'];}return db['User'][_0xfd00('0x39')]({'where':{'id':_0x146782[_0xfd00('0x5e')]['id']}})[_0xfd00('0x22')](function(_0x11e4ce){if(!_0x11e4ce)return null;if(_0x11e4ce['id']===_0x146782[_0xfd00('0x33')]['id']){if(!_0x146782[_0xfd00('0x63')][_0xfd00('0x94')]||!_0x146782[_0xfd00('0x63')][_0xfd00('0x95')]){throw new db[(_0xfd00('0x96'))][(_0xfd00('0x97'))](_0xfd00('0x98'));}if(!_0x11e4ce[_0xfd00('0x99')](_0x146782['body']['oldPassword'])){throw new db[(_0xfd00('0x96'))][(_0xfd00('0x97'))](_0xfd00('0x9a'));}if(_0x146782[_0xfd00('0x63')][_0xfd00('0x94')]===_0x146782[_0xfd00('0x63')][_0xfd00('0x95')]){throw new db[(_0xfd00('0x96'))]['ValidationError']('New\x20password\x20must\x20be\x20different\x20from\x20old\x20password');}}else if(_0x146782[_0xfd00('0x33')][_0xfd00('0x2e')]===_0xfd00('0x31')){if(!_0x146782['body'][_0xfd00('0x95')]){throw new db[(_0xfd00('0x96'))][(_0xfd00('0x97'))]('Invalid\x20body\x20format.\x20Use\x20newPassword');}}else if(_0x146782[_0xfd00('0x33')][_0xfd00('0x2e')]===_0xfd00('0x33')){if(!_0x146782[_0xfd00('0x63')][_0xfd00('0x95')]){throw new db[(_0xfd00('0x96'))][(_0xfd00('0x97'))](_0xfd00('0x9b'));}if(_0x11e4ce[_0xfd00('0x2e')]!==_0xfd00('0x2f')){throw new db[(_0xfd00('0x96'))]['ValidationError'](_0xfd00('0x83'));}}else{throw new db['Sequelize'][(_0xfd00('0x97'))](_0xfd00('0x83'));}return _0x11e4ce;})[_0xfd00('0x22')](handleEntityNotFound(_0x55b5fc,null))['then'](function(_0xc99f55){return db[_0xfd00('0x68')][_0xfd00('0x9c')]({'attributes':['id',_0xfd00('0x6a'),'enforcePasswordHistory',_0xfd00('0x9d')]})[_0xfd00('0x22')](function(_0x36d5a4){if(_0x36d5a4[_0xfd00('0x6a')])authService[_0xfd00('0x9e')](_0x146782[_0xfd00('0x63')][_0xfd00('0x95')]);if(!_0x36d5a4[_0xfd00('0x9f')]||!_0xc99f55[_0xfd00('0xa0')])return _0xc99f55;authService['validatePasswordHistory'](_0x146782[_0xfd00('0x63')][_0xfd00('0x95')],_0xc99f55[_0xfd00('0xa0')],_0x36d5a4['passwordHistoryLimit']);return _0xc99f55;})[_0xfd00('0x22')](saveUpdates({'password':_0x146782[_0xfd00('0x63')]['newPassword'],'passwordResetAt':_0x146782[_0xfd00('0x33')]['id']==_0x146782[_0xfd00('0x5e')]['id']?moment():null,'previousPasswords':authService[_0xfd00('0xa1')](_0x146782[_0xfd00('0x63')][_0xfd00('0x95')],_0xc99f55[_0xfd00('0xa0')])},null));})['then'](respondWithResult(_0x55b5fc,null))['catch'](handleError(_0x55b5fc,null));};exports['addQueues']=function(_0x35e1e9,_0x1808a){var _0x376936=_0x35e1e9[_0xfd00('0x63')][_0xfd00('0xa2')];return db[_0xfd00('0x3f')][_0xfd00('0x39')]({'where':{'id':_0x35e1e9[_0xfd00('0x5e')]['id']},'attributes':['id',_0xfd00('0x3a'),_0xfd00('0x2e'),_0xfd00('0xa3'),_0xfd00('0xa4'),_0xfd00('0xa5'),'interface']})['then'](handleEntityNotFound(_0x1808a,null))[_0xfd00('0x22')](function(_0x5e07b6){if(_0x5e07b6){if(!utils[_0xfd00('0xa6')](_0x376936)){throw new db[(_0xfd00('0x96'))][(_0xfd00('0x97'))](_0xfd00('0xa7'));}return _0x5e07b6[_0xfd00('0xa8')+_[_0xfd00('0xa9')](_0x376936['toLowerCase']())+'Queues'](_0x35e1e9['body'][_0xfd00('0x66')],{'penalty':_0x35e1e9['body'][_0xfd00('0xaa')]||0x0})[_0xfd00('0xab')](function(_0x233b42){for(var _0x271f75=0x0;_0x271f75<_0x35e1e9[_0xfd00('0x63')][_0xfd00('0x66')][_0xfd00('0x55')];_0x271f75+=0x1){var _0x5afd18={'UserId':Number(_0x35e1e9['params']['id'])};_0x5afd18[_['capitalize'](_0x376936['toLowerCase']())+_0xfd00('0xac')]=Number(_0x35e1e9[_0xfd00('0x63')][_0xfd00('0x66')][_0x271f75]);socket[_0xfd00('0xad')](_0xfd00('0x33')+_['capitalize'](_0x376936[_0xfd00('0xae')]())+_0xfd00('0xaf'),_0x5afd18);}return _0x233b42;})[_0xfd00('0x22')](function(){if(_0x376936===_0xfd00('0xb0')){return db[_0xfd00('0xb1')]['findAll']({'where':{'id':_0x35e1e9['body'][_0xfd00('0x66')]||[]},'raw':!![],'attributes':['id',_0xfd00('0x3a')]});}})[_0xfd00('0x22')](function(_0x35bd67){var _0x1e0934=_0x5e07b6[_0xfd00('0x30')]({'plain':!![]});var _0x52ee58=[];if(_0x376936===_0xfd00('0xb0')&&_0x1e0934[_0xfd00('0x2e')]===_0xfd00('0x2f')&&_0x1e0934[_0xfd00('0xa3')]){for(let _0x2293ee=0x0;_0x2293ee<_0x35bd67[_0xfd00('0x55')];_0x2293ee+=0x1){_0x52ee58[_0xfd00('0x51')]({'membername':_0x1e0934[_0xfd00('0x3a')],'UserId':_0x1e0934['id'],'queue_name':_0x35bd67[_0x2293ee][_0xfd00('0x3a')],'VoiceQueueId':_0x35bd67[_0x2293ee]['id'],'interface':_[_0xfd00('0x6d')](_0x1e0934[_0xfd00('0xb2')])?util['format'](_0xfd00('0xb3'),_0x1e0934[_0xfd00('0x3a')]):_0x1e0934[_0xfd00('0xb2')],'paused':_0x1e0934['voicePause']||![],'penalty':_0x35e1e9['body'][_0xfd00('0xaa')]||0x0});}return Promise['all'](_0x52ee58[_0xfd00('0x41')](function(_0xa62047){return db[_0xfd00('0xb4')]['upsert'](_0xa62047);}));}return _0x5e07b6;});}})['then'](respondWithStatusCode(_0x1808a,null))[_0xfd00('0x2c')](handleError(_0x1808a,null));};exports[_0xfd00('0xb5')]=function(_0x23f1ba,_0x427e6a){var _0x56ee19,_0x28a30f;return db[_0xfd00('0x3f')][_0xfd00('0x39')]({'where':{'id':_0x23f1ba[_0xfd00('0x5e')]['id']},'attributes':['id',_0xfd00('0x3a'),_0xfd00('0x2e')]})['then'](handleEntityNotFound(_0x427e6a,null))['then'](function(_0x3edfe7){if(_0x3edfe7){_0x56ee19=_0x3edfe7;if(!_0x23f1ba[_0xfd00('0x4b')][_0xfd00('0xa2')]||!utils['isValidChannel'](_0x23f1ba[_0xfd00('0x4b')]['channel'])){throw new db['Sequelize'][(_0xfd00('0x97'))](_0xfd00('0xa7'));}return _0x3edfe7[_0xfd00('0xb6')+_[_0xfd00('0xa9')](_0x23f1ba['query'][_0xfd00('0xa2')]['toLowerCase']())+'Queues'](_0x23f1ba[_0xfd00('0x4b')][_0xfd00('0x66')]);}})[_0xfd00('0x22')](function(_0x1eaec7){if(_['isArray'](_0x23f1ba[_0xfd00('0x4b')][_0xfd00('0x66')])){for(var _0x530a02=0x0;_0x530a02<_0x23f1ba[_0xfd00('0x4b')][_0xfd00('0x66')]['length'];_0x530a02+=0x1){_0x28a30f={'UserId':Number(_0x23f1ba[_0xfd00('0x5e')]['id'])};_0x28a30f[_[_0xfd00('0xa9')](_0x23f1ba[_0xfd00('0x4b')][_0xfd00('0xa2')][_0xfd00('0xae')]())+'QueueId']=Number(_0x23f1ba[_0xfd00('0x4b')]['ids'][_0x530a02]);socket[_0xfd00('0xad')](_0xfd00('0x33')+_[_0xfd00('0xa9')](_0x23f1ba[_0xfd00('0x4b')]['channel'][_0xfd00('0xae')]())+'Queue:remove',_0x28a30f);}}else{_0x28a30f={'UserId':Number(_0x23f1ba['params']['id'])};_0x28a30f[_[_0xfd00('0xa9')](_0x23f1ba[_0xfd00('0x4b')][_0xfd00('0xa2')]['toLowerCase']())+_0xfd00('0xac')]=Number(_0x23f1ba[_0xfd00('0x4b')]['ids']);socket['emit'](_0xfd00('0x33')+_['capitalize'](_0x23f1ba['query'][_0xfd00('0xa2')][_0xfd00('0xae')]())+_0xfd00('0xb7'),_0x28a30f);}return _0x1eaec7;})[_0xfd00('0x22')](function(){if(_0x23f1ba[_0xfd00('0x4b')][_0xfd00('0xa2')]===_0xfd00('0xb0')){return db[_0xfd00('0xb4')][_0xfd00('0x3c')]({'where':{'UserId':_0x23f1ba[_0xfd00('0x5e')]['id'],'VoiceQueueId':_0x23f1ba['query'][_0xfd00('0x66')]},'individualHooks':!![]})['then'](function(){return _0x56ee19;});}return _0x56ee19;})[_0xfd00('0x22')](respondWithStatusCode(_0x427e6a,null))[_0xfd00('0x2c')](handleError(_0x427e6a,null));};exports['addAvatar']=function(_0x2a0cc0,_0xe610e9){_0x2a0cc0[_0xfd00('0x63')]['userpic']=_0x2a0cc0[_0xfd00('0xb8')][_0xfd00('0xb9')];return db[_0xfd00('0x3f')][_0xfd00('0x39')]({'where':{'id':_0x2a0cc0['params']['id']}})['then'](handleEntityNotFound(_0xe610e9,null))['then'](saveUpdates(_0x2a0cc0[_0xfd00('0x63')],null))[_0xfd00('0x22')](respondWithResult(_0xe610e9,null))[_0xfd00('0x2c')](handleError(_0xe610e9,null));};exports[_0xfd00('0xba')]=function(_0x5f0982,_0x5b263b){var _0x36b32d=path[_0xfd00('0xbb')](config[_0xfd00('0xbc')],'server/files/images/logos/default_profile.png');return db['User'][_0xfd00('0x39')]({'where':{'id':_0x5f0982[_0xfd00('0x5e')]['id']},'attributes':['id',_0xfd00('0xbd')],'raw':!![]})['then'](handleEntityNotFound(_0x5b263b,null))['then'](function(_0x448667){if(_0x448667){if(_['isNil'](_0x448667[_0xfd00('0xbd')])){return _0x5b263b['download'](_0x36b32d);}else{if(!fs['existsSync'](path[_0xfd00('0xbb')](config[_0xfd00('0xbc')],_0xfd00('0xbe'),_0x448667[_0xfd00('0xbd')]))){return _0x5b263b['download'](_0x36b32d);}return _0x5b263b[_0xfd00('0xbf')](path[_0xfd00('0xbb')](config[_0xfd00('0xbc')],'server/files/images/',_0x448667[_0xfd00('0xbd')]));}}})[_0xfd00('0x2c')](handleError(_0x5b263b,null));};exports[_0xfd00('0xc0')]=function(_0x533d44,_0xae0d44){return db[_0xfd00('0x3f')]['find']({'where':{'id':_0x533d44[_0xfd00('0x5e')]['id']},'attributes':['id']})[_0xfd00('0x22')](handleEntityNotFound(_0xae0d44,null))['then'](function(_0x4a3257){var _0x46652c=[];values=_0x4a3257[_0xfd00('0x56')];_0x46652c['push'](get_open_tabs(_0xfd00('0xc1'),_0x4a3257[_0xfd00('0x56')]));_0x46652c[_0xfd00('0x51')](get_open_tabs(_0xfd00('0x57'),_0x4a3257['dataValues']));_0x46652c[_0xfd00('0x51')](get_open_tabs('openchannel',_0x4a3257[_0xfd00('0x56')]));_0x46652c[_0xfd00('0x51')](get_open_tabs(_0xfd00('0x5b'),_0x4a3257[_0xfd00('0x56')]));_0x46652c[_0xfd00('0x51')](get_open_tabs(_0xfd00('0x58'),_0x4a3257['dataValues']));_0x46652c['push'](get_open_tabs(_0xfd00('0x59'),_0x4a3257[_0xfd00('0x56')]));return Promise[_0xfd00('0x5c')](_0x46652c);})[_0xfd00('0x22')](function(_0x6d8d02){if(_0x6d8d02){var _0x56e29c=_[_0xfd00('0x41')](values[_0xfd00('0xc2')],function(_0x4f6445){return{'channel':_0xfd00('0xc3'),'id':_0x4f6445['id'],'createdAt':_0x4f6445[_0xfd00('0xc4')]};});var _0x285c54=_['map'](values['FaxOpenTabs'],function(_0x2ec0ab){return{'channel':_0xfd00('0xc5'),'id':_0x2ec0ab['id'],'createdAt':_0x2ec0ab[_0xfd00('0xc4')]};});var _0x3dc12a=_[_0xfd00('0x41')](values[_0xfd00('0xc6')],function(_0x5ef788){return{'channel':_0xfd00('0xc7'),'id':_0x5ef788['id'],'createdAt':_0x5ef788['createdAt']};});var _0x18c462=_[_0xfd00('0x41')](values['MailOpenTabs'],function(_0x152740){return{'channel':_0xfd00('0xc8'),'id':_0x152740['id'],'createdAt':_0x152740[_0xfd00('0xc4')]};});var _0x1954c7=_[_0xfd00('0x41')](values[_0xfd00('0xc9')],function(_0x1a993c){return{'channel':_0xfd00('0xca'),'id':_0x1a993c['id'],'createdAt':_0x1a993c[_0xfd00('0xc4')]};});var _0x2278ac=_['map'](values['WhatsappOpenTabs'],function(_0x412d4c){return{'channel':_0xfd00('0xcb'),'id':_0x412d4c['id'],'createdAt':_0x412d4c[_0xfd00('0xc4')]};});var _0x4d7958=_[_0xfd00('0xcc')](_0x56e29c,_0x285c54,_0x3dc12a,_0x18c462,_0x1954c7,_0x2278ac);var _0x595f6d={'count':_0x4d7958[_0xfd00('0x55')],'rows':_0x4d7958};return _0x595f6d;}else return null;})[_0xfd00('0x22')](respondWithResult(_0xae0d44,null))[_0xfd00('0x2c')](handleError(_0xae0d44,null));};exports[_0xfd00('0xcd')]=function(_0x302313,_0x969ee1){var _0x12014a={};return db[_0xfd00('0x3f')]['findOne']({'where':{'id':_0x302313['params']['id']}})[_0xfd00('0x22')](function(_0xbf9f6d){if(!_0xbf9f6d){throw new APINotFoundError(util['format']('User\x20with\x20id\x20%s\x20not\x20found',_0x302313[_0xfd00('0x5e')]['id']));}return contacts['describe']();})[_0xfd00('0x22')](function(_0x685f90){_0x302313[_0xfd00('0x4b')][_0xfd00('0x3f')]=_0x302313[_0xfd00('0x5e')]['id'];_0x12014a=qs[_0xfd00('0x5f')](_0x685f90,_0x302313);if(_0x302313[_0xfd00('0x4b')][_0xfd00('0xce')](_0xfd00('0x60'))){_0x12014a[_0xfd00('0x4c')]=[{'model':db[_0xfd00('0xcf')],'as':_0xfd00('0xd0'),'required':![]},{'model':db['Tag'],'as':_0xfd00('0xd1'),'attributes':['id','name',_0xfd00('0xd2')],'where':_0x302313['query'][_0xfd00('0xd3')]?{'id':_0x302313[_0xfd00('0x4b')][_0xfd00('0xd3')]}:undefined,'required':_0x302313['query'][_0xfd00('0xd3')]?!![]:![]}];}return contacts['findAll'](_0x302313[_0xfd00('0x4b')],_0x302313['user'],_0x12014a,_0x685f90);})[_0xfd00('0x22')](respondWithFilteredResult(_0x969ee1,_0x12014a))[_0xfd00('0x2c')](APIHandleError(_0x969ee1));};exports['getQueues']=function(_0xcd731a,_0x576f21){var _0x46e7b4;var _0x11430a={};var _0x50bc9b;return db[_0xfd00('0x3f')][_0xfd00('0x9c')]({'where':{'id':_0xcd731a[_0xfd00('0x5e')]['id']},'attributes':['id',_0xfd00('0x3a'),_0xfd00('0x2e')]})[_0xfd00('0x22')](handleEntityNotFound(_0x576f21,null))[_0xfd00('0x22')](function(_0x5c7110){if(!utils[_0xfd00('0xa6')](_0xcd731a['query'][_0xfd00('0xa2')])){throw new db[(_0xfd00('0x96'))][(_0xfd00('0x97'))]('Unknown\x20channel');}_0x46e7b4=_0x5c7110;var _0x404f1c={};_0x404f1c[_0xfd00('0xd4')]=_['keys'](db[_['capitalize'](_0xcd731a['query'][_0xfd00('0xa2')])+_0xfd00('0xd5')][_0xfd00('0x40')]);_0x404f1c[_0xfd00('0x4b')]=_[_0xfd00('0xd6')](_0xcd731a[_0xfd00('0x4b')]);_0x404f1c[_0xfd00('0xd7')]=_[_0xfd00('0xd8')](_0x404f1c[_0xfd00('0xd4')],_0x404f1c[_0xfd00('0x4b')]);_0x11430a[_0xfd00('0x50')]=_['intersection'](_0x404f1c[_0xfd00('0xd4')],qs[_0xfd00('0xd9')](_0xcd731a['query'][_0xfd00('0xd9')]));_0x11430a[_0xfd00('0x50')]=_0x11430a[_0xfd00('0x50')][_0xfd00('0x55')]?_0x11430a[_0xfd00('0x50')]:_0x404f1c[_0xfd00('0xd4')];_0x11430a[_0xfd00('0xda')]=qs[_0xfd00('0xdb')](_0xcd731a[_0xfd00('0x4b')]['sort']);_0x11430a[_0xfd00('0xdc')]=qs[_0xfd00('0xd7')](_[_0xfd00('0xdd')](_0xcd731a[_0xfd00('0x4b')],_0x404f1c[_0xfd00('0xd7')]));if(_0xcd731a[_0xfd00('0x4b')]['filter']){_0x11430a['where']=_['merge'](_0x11430a[_0xfd00('0xdc')],{'$or':_[_0xfd00('0x41')](_0x11430a['attributes'],function(_0x8ecb97){var _0x3b4f7b={};_0x3b4f7b[_0x8ecb97]={'$like':'%'+_0xcd731a['query'][_0xfd00('0x35')]+'%'};return _0x3b4f7b;})});}_0x11430a=_[_0xfd00('0x61')]({},_0x11430a,_0xcd731a['options']);switch(_0x46e7b4[_0xfd00('0x2e')]){case _0xfd00('0x31'):return db[_[_0xfd00('0xa9')](_0xcd731a[_0xfd00('0x4b')]['channel'])+'Queue']['findAll'](_0x11430a);case _0xfd00('0x33'):case'agent':return _0x46e7b4['get'+_[_0xfd00('0xa9')](_0xcd731a['query'][_0xfd00('0xa2')])+_0xfd00('0xde')](_0x11430a);default:throw new db[(_0xfd00('0x96'))][(_0xfd00('0x97'))](_0xfd00('0xdf'));}})['then'](function(_0x4863fd){_0x50bc9b=_0x4863fd[_0xfd00('0x55')];if(!_0xcd731a[_0xfd00('0x4b')]['hasOwnProperty']('nolimit')){_0x11430a[_0xfd00('0x1d')]=qs[_0xfd00('0x1d')](_0xcd731a['query']['limit']);_0x11430a[_0xfd00('0x1b')]=qs[_0xfd00('0x1b')](_0xcd731a[_0xfd00('0x4b')][_0xfd00('0x1b')]);}switch(_0x46e7b4['role']){case _0xfd00('0x31'):return db[_['capitalize'](_0xcd731a['query'][_0xfd00('0xa2')])+'Queue'][_0xfd00('0x52')](_0x11430a);case _0xfd00('0x33'):case _0xfd00('0x2f'):return _0x46e7b4[_0xfd00('0x30')+_[_0xfd00('0xa9')](_0xcd731a[_0xfd00('0x4b')][_0xfd00('0xa2')])+_0xfd00('0xde')](_0x11430a);}})[_0xfd00('0x22')](function(_0x4b120d){return{'count':_0x50bc9b,'rows':_0x4b120d};})['then'](respondWithResult(_0x576f21,null))[_0xfd00('0x2c')](handleError(_0x576f21,null));};exports[_0xfd00('0xe0')]=function(_0x32a650,_0x2685fb){var _0x4692d7={};var _0x1eb502={};var _0xad897a;var _0x611856;return db[_0xfd00('0x3f')][_0xfd00('0x9c')]({'where':{'id':_0x32a650[_0xfd00('0x5e')]['id']}})[_0xfd00('0x22')](handleEntityNotFound(_0x2685fb,null))[_0xfd00('0x22')](function(_0x5d4b91){if(_0x5d4b91){_0xad897a=_0x5d4b91;_0x1eb502['model']=_[_0xfd00('0xd6')](db['UserVoiceQueueRt'][_0xfd00('0x40')]);_0x1eb502[_0xfd00('0x4b')]=_['keys'](_0x32a650['query']);_0x1eb502[_0xfd00('0xd7')]=_[_0xfd00('0xd8')](_0x1eb502[_0xfd00('0xd4')],_0x1eb502[_0xfd00('0x4b')]);_0x4692d7[_0xfd00('0x50')]=_['intersection'](_0x1eb502[_0xfd00('0xd4')],qs[_0xfd00('0xd9')](_0x32a650['query'][_0xfd00('0xd9')]));_0x4692d7[_0xfd00('0x50')]=_0x4692d7[_0xfd00('0x50')][_0xfd00('0x55')]?_0x4692d7[_0xfd00('0x50')]:_0x1eb502[_0xfd00('0xd4')];_0x4692d7[_0xfd00('0xda')]=qs[_0xfd00('0xdb')](_0x32a650[_0xfd00('0x4b')]['sort']);_0x4692d7[_0xfd00('0xdc')]=qs['filters'](_[_0xfd00('0xdd')](_0x32a650['query'],_0x1eb502[_0xfd00('0xd7')]));if(_0x32a650['query']['filter']){_0x4692d7['where']=_['merge'](_0x4692d7[_0xfd00('0xdc')],{'$or':_[_0xfd00('0x41')](_0x4692d7[_0xfd00('0x50')],function(_0x222dc0){var _0x3c2e73={};_0x3c2e73[_0x222dc0]={'$like':'%'+_0x32a650[_0xfd00('0x4b')][_0xfd00('0x35')]+'%'};return _0x3c2e73;})});}_0x4692d7=_[_0xfd00('0x61')]({},_0x4692d7,_0x32a650[_0xfd00('0x62')]);return _0xad897a[_0xfd00('0xe0')](_0x4692d7);}})[_0xfd00('0x22')](function(_0x5c1712){if(_0x5c1712){_0x611856=_0x5c1712['length'];if(!_0x32a650[_0xfd00('0x4b')][_0xfd00('0xce')](_0xfd00('0xe1'))){_0x4692d7[_0xfd00('0x1d')]=qs[_0xfd00('0x1d')](_0x32a650[_0xfd00('0x4b')][_0xfd00('0x1d')]);_0x4692d7[_0xfd00('0x1b')]=qs[_0xfd00('0x1b')](_0x32a650['query'][_0xfd00('0x1b')]);}return _0xad897a['getVoiceQueuesRt'](_0x4692d7);}})['then'](function(_0x57ec43){if(_0x57ec43){return _0x57ec43?{'count':_0x611856,'rows':_0x57ec43}:null;}})[_0xfd00('0x22')](respondWithResult(_0x2685fb,null))[_0xfd00('0x2c')](handleError(_0x2685fb,null));};exports['getGroups']=function(_0x28b120,_0x5b23ca){var _0x2b9b3b={};var _0x416d44={};var _0x392df5;var _0x5637d2;return db[_0xfd00('0x3f')]['findOne']({'where':{'id':_0x28b120[_0xfd00('0x5e')]['id']}})['then'](handleEntityNotFound(_0x5b23ca,null))[_0xfd00('0x22')](function(_0x58e09d){if(_0x58e09d){_0x392df5=_0x58e09d;_0x416d44[_0xfd00('0xd4')]=_[_0xfd00('0xd6')](db[_0xfd00('0xe2')][_0xfd00('0x40')]);_0x416d44[_0xfd00('0x4b')]=_[_0xfd00('0xd6')](_0x28b120[_0xfd00('0x4b')]);_0x416d44[_0xfd00('0xd7')]=_[_0xfd00('0xd8')](_0x416d44[_0xfd00('0xd4')],_0x416d44[_0xfd00('0x4b')]);_0x2b9b3b['attributes']=_[_0xfd00('0xd8')](_0x416d44[_0xfd00('0xd4')],qs['fields'](_0x28b120[_0xfd00('0x4b')][_0xfd00('0xd9')]));_0x2b9b3b[_0xfd00('0x50')]=_0x2b9b3b['attributes'][_0xfd00('0x55')]?_0x2b9b3b['attributes']:_0x416d44['model'];_0x2b9b3b[_0xfd00('0xda')]=qs['sort'](_0x28b120[_0xfd00('0x4b')][_0xfd00('0xdb')]);_0x2b9b3b['where']=qs[_0xfd00('0xd7')](_[_0xfd00('0xdd')](_0x28b120[_0xfd00('0x4b')],_0x416d44[_0xfd00('0xd7')]));if(_0x28b120[_0xfd00('0x4b')]['filter']){_0x2b9b3b[_0xfd00('0xdc')]=_['merge'](_0x2b9b3b[_0xfd00('0xdc')],{'$or':_[_0xfd00('0x41')](_0x2b9b3b[_0xfd00('0x50')],function(_0x799607){var _0x69d7b1={};_0x69d7b1[_0x799607]={'$like':'%'+_0x28b120[_0xfd00('0x4b')][_0xfd00('0x35')]+'%'};return _0x69d7b1;})});}_0x2b9b3b=_['merge']({},_0x2b9b3b,_0x28b120[_0xfd00('0x62')]);return _0x392df5[_0xfd00('0xe3')](_0x2b9b3b);}})[_0xfd00('0x22')](function(_0x1f0dd6){if(_0x1f0dd6){_0x5637d2=_0x1f0dd6['length'];if(!_0x28b120[_0xfd00('0x4b')]['hasOwnProperty'](_0xfd00('0xe1'))){_0x2b9b3b[_0xfd00('0x1d')]=qs[_0xfd00('0x1d')](_0x28b120[_0xfd00('0x4b')][_0xfd00('0x1d')]);_0x2b9b3b[_0xfd00('0x1b')]=qs['offset'](_0x28b120[_0xfd00('0x4b')][_0xfd00('0x1b')]);}return _0x392df5[_0xfd00('0xe3')](_0x2b9b3b);}})['then'](function(_0x4b3696){if(_0x4b3696){return _0x4b3696?{'count':_0x5637d2,'rows':_0x4b3696}:null;}})[_0xfd00('0x22')](respondWithResult(_0x5b23ca,null))[_0xfd00('0x2c')](handleError(_0x5b23ca,null));};exports[_0xfd00('0xe4')]=function(_0x3f4637,_0x3e797f){var _0x36afca={'raw':!![],'where':{}};var _0x5684aa={};var _0x97a7e6={'count':0x0,'rows':[]};return db['User'][_0xfd00('0x9c')]({'where':{'id':_0x3f4637[_0xfd00('0x5e')]['id']}})[_0xfd00('0x22')](handleEntityNotFound(_0x3e797f,null))[_0xfd00('0x22')](function(_0x19d827){if(_0x19d827){_0x5684aa[_0xfd00('0xd4')]=_[_0xfd00('0xd6')](db[_0xfd00('0xe5')][_0xfd00('0x40')]);_0x5684aa[_0xfd00('0x4b')]=_['keys'](_0x3f4637[_0xfd00('0x4b')]);_0x5684aa['filters']=_[_0xfd00('0xd8')](_0x5684aa[_0xfd00('0xd4')],_0x5684aa[_0xfd00('0x4b')]);_0x36afca['attributes']=_[_0xfd00('0xd8')](_0x5684aa['model'],qs[_0xfd00('0xd9')](_0x3f4637['query'][_0xfd00('0xd9')]));_0x36afca[_0xfd00('0x50')]=_0x36afca[_0xfd00('0x50')]['length']?_0x36afca[_0xfd00('0x50')]:_0x5684aa[_0xfd00('0xd4')];if(!_0x3f4637['query'][_0xfd00('0xce')](_0xfd00('0xe1'))){_0x36afca[_0xfd00('0x1d')]=qs['limit'](_0x3f4637[_0xfd00('0x4b')][_0xfd00('0x1d')]);_0x36afca[_0xfd00('0x1b')]=qs[_0xfd00('0x1b')](_0x3f4637['query']['offset']);}_0x36afca['order']=qs[_0xfd00('0xdb')](_0x3f4637['query'][_0xfd00('0xdb')]);_0x36afca[_0xfd00('0xdc')]=qs[_0xfd00('0xd7')](_[_0xfd00('0xdd')](_0x3f4637[_0xfd00('0x4b')],_0x5684aa[_0xfd00('0xd7')]));_0x36afca[_0xfd00('0xdc')]['UserId']=_0x19d827['id'];if(_0x3f4637['query'][_0xfd00('0x35')]){_0x36afca[_0xfd00('0xdc')]=_['merge'](_0x36afca[_0xfd00('0xdc')],{'$or':_[_0xfd00('0x41')](_0x36afca[_0xfd00('0x50')],function(_0x1c8778){var _0x159372={};_0x159372[_0x1c8778]={'$like':'%'+_0x3f4637[_0xfd00('0x4b')]['filter']+'%'};return _0x159372;})});}_0x36afca=_[_0xfd00('0x61')]({},_0x36afca,_0x3f4637[_0xfd00('0x62')]);return db[_0xfd00('0xe5')][_0xfd00('0x1e')]({'where':_0x36afca[_0xfd00('0xdc')]})[_0xfd00('0x22')](function(_0x3854d6){_0x97a7e6['count']=_0x3854d6;if(_0x3f4637[_0xfd00('0x4b')]['includeAll']){_0x36afca[_0xfd00('0x4c')]=[{'all':!![]}];}return db[_0xfd00('0xe5')][_0xfd00('0x52')](_0x36afca);})[_0xfd00('0x22')](function(_0xee9beb){_0x97a7e6[_0xfd00('0x53')]=_0xee9beb;return _0x97a7e6;});}})['then'](respondWithFilteredResult(_0x3e797f,_0x36afca))[_0xfd00('0x2c')](handleError(_0x3e797f,null));};exports[_0xfd00('0xe6')]=function(_0x1516c0,_0x1b2e8e){var _0x428462={'raw':!![],'where':{}};var _0x11de89={};var _0x491e39={'count':0x0,'rows':[]};return db[_0xfd00('0x3f')]['findOne']({'where':{'id':_0x1516c0[_0xfd00('0x5e')]['id']}})['then'](handleEntityNotFound(_0x1b2e8e,null))[_0xfd00('0x22')](function(_0x3c06c6){if(_0x3c06c6){_0x11de89[_0xfd00('0xd4')]=_[_0xfd00('0xd6')](db[_0xfd00('0xe7')][_0xfd00('0x40')]);_0x11de89[_0xfd00('0x4b')]=_['keys'](_0x1516c0[_0xfd00('0x4b')]);_0x11de89[_0xfd00('0xd7')]=_[_0xfd00('0xd8')](_0x11de89[_0xfd00('0xd4')],_0x11de89[_0xfd00('0x4b')]);_0x428462[_0xfd00('0x50')]=_[_0xfd00('0xd8')](_0x11de89[_0xfd00('0xd4')],qs['fields'](_0x1516c0[_0xfd00('0x4b')][_0xfd00('0xd9')]));_0x428462[_0xfd00('0x50')]=_0x428462[_0xfd00('0x50')][_0xfd00('0x55')]?_0x428462[_0xfd00('0x50')]:_0x11de89[_0xfd00('0xd4')];if(!_0x1516c0[_0xfd00('0x4b')][_0xfd00('0xce')]('nolimit')){_0x428462[_0xfd00('0x1d')]=qs[_0xfd00('0x1d')](_0x1516c0[_0xfd00('0x4b')][_0xfd00('0x1d')]);_0x428462['offset']=qs['offset'](_0x1516c0['query']['offset']);}_0x428462[_0xfd00('0xda')]=qs[_0xfd00('0xdb')](_0x1516c0[_0xfd00('0x4b')]['sort']);_0x428462[_0xfd00('0xdc')]=qs[_0xfd00('0xd7')](_['pick'](_0x1516c0[_0xfd00('0x4b')],_0x11de89[_0xfd00('0xd7')]));_0x428462[_0xfd00('0xdc')]['UserId']=_0x3c06c6['id'];if(_0x1516c0[_0xfd00('0x4b')]['filter']){_0x428462['where']=_[_0xfd00('0x61')](_0x428462[_0xfd00('0xdc')],{'$or':_['map'](_0x428462[_0xfd00('0x50')],function(_0xc85d3d){var _0x10f678={};_0x10f678[_0xc85d3d]={'$like':'%'+_0x1516c0['query'][_0xfd00('0x35')]+'%'};return _0x10f678;})});}_0x428462=_['merge']({},_0x428462,_0x1516c0[_0xfd00('0x62')]);return db[_0xfd00('0xe7')][_0xfd00('0x1e')]({'where':_0x428462[_0xfd00('0xdc')]})[_0xfd00('0x22')](function(_0x17558a){_0x491e39[_0xfd00('0x1e')]=_0x17558a;if(_0x1516c0[_0xfd00('0x4b')][_0xfd00('0x60')]){_0x428462[_0xfd00('0x4c')]=[{'all':!![]}];}return db[_0xfd00('0xe7')][_0xfd00('0x52')](_0x428462);})[_0xfd00('0x22')](function(_0x3b56d6){_0x491e39[_0xfd00('0x53')]=_0x3b56d6;return _0x491e39;});}})[_0xfd00('0x22')](respondWithFilteredResult(_0x1b2e8e,_0x428462))[_0xfd00('0x2c')](handleError(_0x1b2e8e,null));};exports[_0xfd00('0xe8')]=function(_0x18708a,_0x4e0c3f){var _0x20eadf={};var _0x5c2344={};var _0x52925c;var _0x22256e;return db['User'][_0xfd00('0x9c')]({'where':{'id':_0x18708a[_0xfd00('0x5e')]['id']}})[_0xfd00('0x22')](handleEntityNotFound(_0x4e0c3f,null))['then'](function(_0x490a22){if(_0x490a22){_0x52925c=_0x490a22;_0x5c2344[_0xfd00('0xd4')]=_[_0xfd00('0xd6')](db[_0xfd00('0xe9')][_0xfd00('0x40')]);_0x5c2344[_0xfd00('0x4b')]=_[_0xfd00('0xd6')](_0x18708a[_0xfd00('0x4b')]);_0x5c2344[_0xfd00('0xd7')]=_[_0xfd00('0xd8')](_0x5c2344['model'],_0x5c2344[_0xfd00('0x4b')]);_0x20eadf[_0xfd00('0x50')]=_['intersection'](_0x5c2344[_0xfd00('0xd4')],qs[_0xfd00('0xd9')](_0x18708a['query'][_0xfd00('0xd9')]));_0x20eadf[_0xfd00('0x50')]=_0x20eadf[_0xfd00('0x50')][_0xfd00('0x55')]?_0x20eadf['attributes']:_0x5c2344[_0xfd00('0xd4')];_0x20eadf[_0xfd00('0xda')]=qs['sort'](_0x18708a['query'][_0xfd00('0xdb')]);_0x20eadf[_0xfd00('0xdc')]=qs[_0xfd00('0xd7')](_[_0xfd00('0xdd')](_0x18708a[_0xfd00('0x4b')],_0x5c2344['filters']));if(_0x18708a[_0xfd00('0x4b')][_0xfd00('0x35')]){_0x20eadf['where']=_[_0xfd00('0x61')](_0x20eadf['where'],{'$or':_['map'](_0x20eadf['attributes'],function(_0x1f8926){var _0x3ceb2c={};_0x3ceb2c[_0x1f8926]={'$like':'%'+_0x18708a[_0xfd00('0x4b')][_0xfd00('0x35')]+'%'};return _0x3ceb2c;})});}_0x20eadf=_[_0xfd00('0x61')]({},_0x20eadf,_0x18708a[_0xfd00('0x62')]);return _0x52925c[_0xfd00('0xe8')](_0x20eadf);}})[_0xfd00('0x22')](function(_0x7450dc){if(_0x7450dc){_0x22256e=_0x7450dc[_0xfd00('0x55')];if(!_0x18708a[_0xfd00('0x4b')][_0xfd00('0xce')]('nolimit')){_0x20eadf[_0xfd00('0x1d')]=qs[_0xfd00('0x1d')](_0x18708a[_0xfd00('0x4b')][_0xfd00('0x1d')]);_0x20eadf['offset']=qs[_0xfd00('0x1b')](_0x18708a['query'][_0xfd00('0x1b')]);}return _0x52925c[_0xfd00('0xe8')](_0x20eadf);}})[_0xfd00('0x22')](function(_0x1f3da4){if(_0x1f3da4){return _0x1f3da4?{'count':_0x22256e,'rows':_0x1f3da4}:null;}})[_0xfd00('0x22')](respondWithResult(_0x4e0c3f,null))[_0xfd00('0x2c')](handleError(_0x4e0c3f,null));};exports[_0xfd00('0xea')]=function(_0x2ecf3c,_0x3c3a3d){var _0x3ffb44={};var _0x5edb67={};var _0x46c252;var _0x49200e;return db[_0xfd00('0x3f')]['findOne']({'where':{'id':_0x2ecf3c['params']['id']}})[_0xfd00('0x22')](handleEntityNotFound(_0x3c3a3d,null))['then'](function(_0x5d80f0){if(_0x5d80f0){_0x46c252=_0x5d80f0;_0x5edb67['model']=_[_0xfd00('0xd6')](db[_0xfd00('0xeb')]['rawAttributes']);_0x5edb67[_0xfd00('0x4b')]=_['keys'](_0x2ecf3c['query']);_0x5edb67[_0xfd00('0xd7')]=_['intersection'](_0x5edb67[_0xfd00('0xd4')],_0x5edb67['query']);_0x3ffb44['attributes']=_[_0xfd00('0xd8')](_0x5edb67[_0xfd00('0xd4')],qs[_0xfd00('0xd9')](_0x2ecf3c[_0xfd00('0x4b')][_0xfd00('0xd9')]));_0x3ffb44[_0xfd00('0x50')]=_0x3ffb44['attributes']['length']?_0x3ffb44[_0xfd00('0x50')]:_0x5edb67[_0xfd00('0xd4')];_0x3ffb44[_0xfd00('0xda')]=qs[_0xfd00('0xdb')](_0x2ecf3c[_0xfd00('0x4b')][_0xfd00('0xdb')]);_0x3ffb44[_0xfd00('0xdc')]=qs[_0xfd00('0xd7')](_['pick'](_0x2ecf3c['query'],_0x5edb67['filters']));if(_0x2ecf3c[_0xfd00('0x4b')]['filter']){_0x3ffb44[_0xfd00('0xdc')]=_[_0xfd00('0x61')](_0x3ffb44[_0xfd00('0xdc')],{'$or':_['map'](_0x3ffb44[_0xfd00('0x50')],function(_0x1dbf5d){var _0x1b1198={};_0x1b1198[_0x1dbf5d]={'$like':'%'+_0x2ecf3c[_0xfd00('0x4b')][_0xfd00('0x35')]+'%'};return _0x1b1198;})});}_0x3ffb44=_[_0xfd00('0x61')]({},_0x3ffb44,_0x2ecf3c[_0xfd00('0x62')]);return _0x46c252[_0xfd00('0xea')](_0x3ffb44);}})[_0xfd00('0x22')](function(_0x54e062){if(_0x54e062){_0x49200e=_0x54e062[_0xfd00('0x55')];if(!_0x2ecf3c[_0xfd00('0x4b')]['hasOwnProperty'](_0xfd00('0xe1'))){_0x3ffb44[_0xfd00('0x1d')]=qs['limit'](_0x2ecf3c[_0xfd00('0x4b')][_0xfd00('0x1d')]);_0x3ffb44[_0xfd00('0x1b')]=qs[_0xfd00('0x1b')](_0x2ecf3c[_0xfd00('0x4b')][_0xfd00('0x1b')]);}return _0x46c252[_0xfd00('0xea')](_0x3ffb44);}})['then'](function(_0x3465f3){if(_0x3465f3){return _0x3465f3?{'count':_0x49200e,'rows':_0x3465f3}:null;}})[_0xfd00('0x22')](respondWithResult(_0x3c3a3d,null))[_0xfd00('0x2c')](handleError(_0x3c3a3d,null));};exports[_0xfd00('0xec')]=function(_0x5a32e9,_0x4a5177){var _0x5cec54={'raw':!![],'where':{}};var _0x4c7275={};var _0xefde70={'count':0x0,'rows':[]};return db[_0xfd00('0x3f')]['findOne']({'where':{'id':_0x5a32e9[_0xfd00('0x5e')]['id']}})[_0xfd00('0x22')](handleEntityNotFound(_0x4a5177,null))[_0xfd00('0x22')](function(_0x1d373b){if(_0x1d373b){_0x4c7275['model']=_[_0xfd00('0xd6')](db[_0xfd00('0xed')][_0xfd00('0x40')]);_0x4c7275['query']=_[_0xfd00('0xd6')](_0x5a32e9[_0xfd00('0x4b')]);_0x4c7275['filters']=_[_0xfd00('0xd8')](_0x4c7275['model'],_0x4c7275[_0xfd00('0x4b')]);_0x5cec54[_0xfd00('0x50')]=_[_0xfd00('0xd8')](_0x4c7275[_0xfd00('0xd4')],qs['fields'](_0x5a32e9[_0xfd00('0x4b')]['fields']));_0x5cec54[_0xfd00('0x50')]=_0x5cec54[_0xfd00('0x50')][_0xfd00('0x55')]?_0x5cec54['attributes']:_0x4c7275[_0xfd00('0xd4')];if(!_0x5a32e9[_0xfd00('0x4b')][_0xfd00('0xce')](_0xfd00('0xe1'))){_0x5cec54[_0xfd00('0x1d')]=qs[_0xfd00('0x1d')](_0x5a32e9[_0xfd00('0x4b')][_0xfd00('0x1d')]);_0x5cec54[_0xfd00('0x1b')]=qs['offset'](_0x5a32e9[_0xfd00('0x4b')]['offset']);}_0x5cec54[_0xfd00('0xda')]=qs[_0xfd00('0xdb')](_0x5a32e9[_0xfd00('0x4b')]['sort']);_0x5cec54['where']=qs['filters'](_[_0xfd00('0xdd')](_0x5a32e9[_0xfd00('0x4b')],_0x4c7275[_0xfd00('0xd7')]));_0x5cec54[_0xfd00('0xdc')]['UserId']=_0x1d373b['id'];if(_0x5a32e9[_0xfd00('0x4b')][_0xfd00('0x35')]){_0x5cec54[_0xfd00('0xdc')]=_['merge'](_0x5cec54[_0xfd00('0xdc')],{'$or':_['map'](_0x5cec54['attributes'],function(_0x458720){var _0x4e48df={};_0x4e48df[_0x458720]={'$like':'%'+_0x5a32e9[_0xfd00('0x4b')][_0xfd00('0x35')]+'%'};return _0x4e48df;})});}_0x5cec54=_[_0xfd00('0x61')]({},_0x5cec54,_0x5a32e9[_0xfd00('0x62')]);return db['MailInteraction'][_0xfd00('0x1e')]({'where':_0x5cec54[_0xfd00('0xdc')]})[_0xfd00('0x22')](function(_0xfa6c5d){_0xefde70['count']=_0xfa6c5d;if(_0x5a32e9[_0xfd00('0x4b')][_0xfd00('0x60')]){_0x5cec54[_0xfd00('0x4c')]=[{'all':!![]}];}return db[_0xfd00('0xed')][_0xfd00('0x52')](_0x5cec54);})[_0xfd00('0x22')](function(_0x441e37){_0xefde70[_0xfd00('0x53')]=_0x441e37;return _0xefde70;});}})['then'](respondWithFilteredResult(_0x4a5177,_0x5cec54))['catch'](handleError(_0x4a5177,null));};exports[_0xfd00('0xee')]=function(_0x284c2b,_0x4dd601){var _0x5ca887={};var _0x4db4df={};var _0x56c452;var _0x2b6370;return db[_0xfd00('0x3f')][_0xfd00('0x9c')]({'where':{'id':_0x284c2b[_0xfd00('0x5e')]['id']}})[_0xfd00('0x22')](handleEntityNotFound(_0x4dd601,null))['then'](function(_0x1c0404){if(_0x1c0404){_0x56c452=_0x1c0404;_0x4db4df[_0xfd00('0xd4')]=_[_0xfd00('0xd6')](db[_0xfd00('0xef')][_0xfd00('0x40')]);_0x4db4df['query']=_[_0xfd00('0xd6')](_0x284c2b['query']);_0x4db4df[_0xfd00('0xd7')]=_[_0xfd00('0xd8')](_0x4db4df[_0xfd00('0xd4')],_0x4db4df[_0xfd00('0x4b')]);_0x5ca887['attributes']=_[_0xfd00('0xd8')](_0x4db4df[_0xfd00('0xd4')],qs[_0xfd00('0xd9')](_0x284c2b['query'][_0xfd00('0xd9')]));_0x5ca887['attributes']=_0x5ca887[_0xfd00('0x50')]['length']?_0x5ca887[_0xfd00('0x50')]:_0x4db4df['model'];_0x5ca887[_0xfd00('0xda')]=qs['sort'](_0x284c2b[_0xfd00('0x4b')][_0xfd00('0xdb')]);_0x5ca887[_0xfd00('0xdc')]=qs[_0xfd00('0xd7')](_[_0xfd00('0xdd')](_0x284c2b['query'],_0x4db4df[_0xfd00('0xd7')]));if(_0x284c2b[_0xfd00('0x4b')]['filter']){_0x5ca887[_0xfd00('0xdc')]=_[_0xfd00('0x61')](_0x5ca887[_0xfd00('0xdc')],{'$or':_[_0xfd00('0x41')](_0x5ca887['attributes'],function(_0x138c0e){var _0xbd29e5={};_0xbd29e5[_0x138c0e]={'$like':'%'+_0x284c2b[_0xfd00('0x4b')]['filter']+'%'};return _0xbd29e5;})});}_0x5ca887=_[_0xfd00('0x61')]({},_0x5ca887,_0x284c2b[_0xfd00('0x62')]);return _0x56c452[_0xfd00('0xee')](_0x5ca887);}})[_0xfd00('0x22')](function(_0x3313b6){if(_0x3313b6){_0x2b6370=_0x3313b6['length'];if(!_0x284c2b[_0xfd00('0x4b')][_0xfd00('0xce')](_0xfd00('0xe1'))){_0x5ca887['limit']=qs['limit'](_0x284c2b[_0xfd00('0x4b')][_0xfd00('0x1d')]);_0x5ca887['offset']=qs[_0xfd00('0x1b')](_0x284c2b[_0xfd00('0x4b')][_0xfd00('0x1b')]);}return _0x56c452['getSmsInteractions'](_0x5ca887);}})[_0xfd00('0x22')](function(_0xc73e85){if(_0xc73e85){return _0xc73e85?{'count':_0x2b6370,'rows':_0xc73e85}:null;}})[_0xfd00('0x22')](respondWithResult(_0x4dd601,null))[_0xfd00('0x2c')](handleError(_0x4dd601,null));};exports[_0xfd00('0xf0')]=function(_0x2e5f15,_0x3e15a2){var _0x54d404={};var _0x1491bd={};var _0x2769d4;var _0x3a2da9;return db[_0xfd00('0x3f')]['findOne']({'where':{'id':_0x2e5f15[_0xfd00('0x5e')]['id']}})[_0xfd00('0x22')](handleEntityNotFound(_0x3e15a2,null))[_0xfd00('0x22')](function(_0x460dd6){if(_0x460dd6){_0x2769d4=_0x460dd6;_0x1491bd[_0xfd00('0xd4')]=_[_0xfd00('0xd6')](db[_0xfd00('0xf1')]['rawAttributes']);_0x1491bd[_0xfd00('0x4b')]=_[_0xfd00('0xd6')](_0x2e5f15['query']);_0x1491bd['filters']=_['intersection'](_0x1491bd[_0xfd00('0xd4')],_0x1491bd[_0xfd00('0x4b')]);_0x54d404[_0xfd00('0x50')]=_['intersection'](_0x1491bd[_0xfd00('0xd4')],qs['fields'](_0x2e5f15[_0xfd00('0x4b')]['fields']));_0x54d404['attributes']=_0x54d404[_0xfd00('0x50')][_0xfd00('0x55')]?_0x54d404['attributes']:_0x1491bd[_0xfd00('0xd4')];_0x54d404[_0xfd00('0xda')]=qs[_0xfd00('0xdb')](_0x2e5f15[_0xfd00('0x4b')][_0xfd00('0xdb')]);_0x54d404['where']=qs['filters'](_[_0xfd00('0xdd')](_0x2e5f15[_0xfd00('0x4b')],_0x1491bd[_0xfd00('0xd7')]));if(_0x2e5f15[_0xfd00('0x4b')][_0xfd00('0x35')]){_0x54d404[_0xfd00('0xdc')]=_[_0xfd00('0x61')](_0x54d404[_0xfd00('0xdc')],{'$or':_[_0xfd00('0x41')](_0x54d404[_0xfd00('0x50')],function(_0x5641ee){var _0x27f5f4={};_0x27f5f4[_0x5641ee]={'$like':'%'+_0x2e5f15[_0xfd00('0x4b')]['filter']+'%'};return _0x27f5f4;})});}_0x54d404=_[_0xfd00('0x61')]({},_0x54d404,_0x2e5f15[_0xfd00('0x62')]);return _0x2769d4[_0xfd00('0xf0')](_0x54d404);}})[_0xfd00('0x22')](function(_0x22c4cd){if(_0x22c4cd){_0x3a2da9=_0x22c4cd[_0xfd00('0x55')];if(!_0x2e5f15[_0xfd00('0x4b')][_0xfd00('0xce')](_0xfd00('0xe1'))){_0x54d404[_0xfd00('0x1d')]=qs[_0xfd00('0x1d')](_0x2e5f15['query'][_0xfd00('0x1d')]);_0x54d404[_0xfd00('0x1b')]=qs[_0xfd00('0x1b')](_0x2e5f15[_0xfd00('0x4b')]['offset']);}return _0x2769d4[_0xfd00('0xf0')](_0x54d404);}})[_0xfd00('0x22')](function(_0x5b30b7){if(_0x5b30b7){return _0x5b30b7?{'count':_0x3a2da9,'rows':_0x5b30b7}:null;}})['then'](respondWithResult(_0x3e15a2,null))[_0xfd00('0x2c')](handleError(_0x3e15a2,null));};exports['getWhatsappInteractions']=function(_0x381728,_0x14f24a){var _0xf88c2f={};var _0x438878={};var _0x121965;var _0x5b15d9;return db['User']['findOne']({'where':{'id':_0x381728[_0xfd00('0x5e')]['id']}})[_0xfd00('0x22')](handleEntityNotFound(_0x14f24a,null))[_0xfd00('0x22')](function(_0x1f4ac7){if(_0x1f4ac7){_0x121965=_0x1f4ac7;_0x438878[_0xfd00('0xd4')]=_[_0xfd00('0xd6')](db['WhatsappInteraction'][_0xfd00('0x40')]);_0x438878[_0xfd00('0x4b')]=_[_0xfd00('0xd6')](_0x381728[_0xfd00('0x4b')]);_0x438878['filters']=_['intersection'](_0x438878[_0xfd00('0xd4')],_0x438878[_0xfd00('0x4b')]);_0xf88c2f[_0xfd00('0x50')]=_['intersection'](_0x438878[_0xfd00('0xd4')],qs['fields'](_0x381728[_0xfd00('0x4b')][_0xfd00('0xd9')]));_0xf88c2f[_0xfd00('0x50')]=_0xf88c2f[_0xfd00('0x50')][_0xfd00('0x55')]?_0xf88c2f['attributes']:_0x438878['model'];_0xf88c2f[_0xfd00('0xda')]=qs[_0xfd00('0xdb')](_0x381728[_0xfd00('0x4b')][_0xfd00('0xdb')]);_0xf88c2f[_0xfd00('0xdc')]=qs['filters'](_[_0xfd00('0xdd')](_0x381728['query'],_0x438878[_0xfd00('0xd7')]));if(_0x381728[_0xfd00('0x4b')][_0xfd00('0x35')]){_0xf88c2f[_0xfd00('0xdc')]=_[_0xfd00('0x61')](_0xf88c2f[_0xfd00('0xdc')],{'$or':_[_0xfd00('0x41')](_0xf88c2f[_0xfd00('0x50')],function(_0x1bdb60){var _0x57b431={};_0x57b431[_0x1bdb60]={'$like':'%'+_0x381728[_0xfd00('0x4b')]['filter']+'%'};return _0x57b431;})});}_0xf88c2f=_[_0xfd00('0x61')]({},_0xf88c2f,_0x381728[_0xfd00('0x62')]);return _0x121965[_0xfd00('0xf2')](_0xf88c2f);}})[_0xfd00('0x22')](function(_0x14a20c){if(_0x14a20c){_0x5b15d9=_0x14a20c[_0xfd00('0x55')];if(!_0x381728[_0xfd00('0x4b')][_0xfd00('0xce')](_0xfd00('0xe1'))){_0xf88c2f[_0xfd00('0x1d')]=qs[_0xfd00('0x1d')](_0x381728[_0xfd00('0x4b')]['limit']);_0xf88c2f[_0xfd00('0x1b')]=qs[_0xfd00('0x1b')](_0x381728[_0xfd00('0x4b')][_0xfd00('0x1b')]);}return _0x121965[_0xfd00('0xf2')](_0xf88c2f);}})[_0xfd00('0x22')](function(_0x4399db){if(_0x4399db){return _0x4399db?{'count':_0x5b15d9,'rows':_0x4399db}:null;}})[_0xfd00('0x22')](respondWithResult(_0x14f24a,null))[_0xfd00('0x2c')](handleError(_0x14f24a,null));};exports[_0xfd00('0xf3')]=function(_0x529342,_0x188f3c,_0xc00ec5){var _0x1c7af4;var _0x263e1f;var _0x437642;var _0x540f00=!_[_0xfd00('0x6d')](_0x529342[_0xfd00('0x5e')]['id'])?_0x529342[_0xfd00('0x5e')]['id']:!_[_0xfd00('0x6d')](_0x529342[_0xfd00('0x33')]['id'])?_0x529342[_0xfd00('0x33')]['id']:null;return db[_0xfd00('0x3f')][_0xfd00('0x39')]({'where':{'id':_0x540f00,'role':{'$or':['admin',_0xfd00('0x33'),'agent']}},'attributes':['id','name','phone',_0xfd00('0xf4'),_0xfd00('0x2e'),_0xfd00('0x67'),_0xfd00('0xa4')]})[_0xfd00('0x22')](function(_0x1ee169){if(_0x1ee169){if(_0x1ee169['role']==='agent'){_0x1c7af4=_0x1ee169;if(_0x529342[_0xfd00('0x63')]['interface']){_0x437642=util[_0xfd00('0xf5')](_0xfd00('0xf6'),_0x1c7af4[_0x529342[_0xfd00('0x63')][_0xfd00('0xb2')]]);}else if(_0x529342[_0xfd00('0x63')][_0xfd00('0xf7')]){_0x437642=util[_0xfd00('0xf5')]('SIP/%s',_0x529342[_0xfd00('0x63')][_0xfd00('0xf7')]);}else{_0x437642=util[_0xfd00('0xf5')](_0xfd00('0xb3'),_0x1c7af4[_0xfd00('0x3a')]);}socket['to'](util[_0xfd00('0xf5')]('user:%s',_0x1c7af4[_0xfd00('0x3a')]))[_0xfd00('0xad')](_0xfd00('0xf8'),{'user':{'id':_0x1c7af4['id'],'name':_0x1c7af4[_0xfd00('0x3a')]},'ip':_0x529342[_0xfd00('0xf9')][_0xfd00('0xfa')]||_0x529342[_0xfd00('0xfb')][_0xfd00('0xfc')]||_0x529342['socket']['remoteAddress']||_0x529342['connection']['socket'][_0xfd00('0xfc')]});return new Promise(function(_0x522485,_0x3e6431){db[_0xfd00('0x6e')][_0xfd00('0xfd')]()[_0xfd00('0x22')](_0x2922ff=>{db[_0xfd00('0xb4')]['destroy']({'where':{'membername':_0x1c7af4[_0xfd00('0x3a')]},'individualHooks':!![]},{'transaction':_0x2922ff})[_0xfd00('0x22')](function(){return _0x2922ff['commit']();})[_0xfd00('0x22')](_0x522485)[_0xfd00('0x2c')](_0x3e6431);});});}}else{throw new db[(_0xfd00('0x96'))][(_0xfd00('0x97'))](_0xfd00('0xfe'));}})[_0xfd00('0x22')](function(){if(_0x1c7af4){return _0x1c7af4[_0xfd00('0xff')]({'raw':!![]});}})[_0xfd00('0x22')](function(_0x4bc5ba){if(_0x1c7af4){if(_0x4bc5ba){_0x263e1f=_0x4bc5ba;if(_0x263e1f[_0xfd00('0x55')]){var _0x483aa4=_0x263e1f[_0xfd00('0x41')](function(_0x509dfd){return{'membername':_0x1c7af4[_0xfd00('0x3a')],'UserId':_0x1c7af4['id'],'queue_name':_0x509dfd['name'],'VoiceQueueId':_0x509dfd['id'],'interface':_0x437642,'paused':_0x1c7af4['loginInPause']||![],'penalty':_0x509dfd[_0xfd00('0x100')]||0x0};});return db[_0xfd00('0xb4')][_0xfd00('0x8e')](_0x483aa4);}}}})[_0xfd00('0x22')](function(){if(_0x1c7af4){return db[_0xfd00('0x101')][_0xfd00('0x52')]({'where':{'membername':_0x1c7af4[_0xfd00('0x3a')],'exitAt':null}});}})[_0xfd00('0x22')](function(_0x1ec0a0){if(_0x1c7af4){var _0x223e05=[];_0x1ec0a0[_0xfd00('0x102')](function(_0x5e247c){_0x223e05[_0xfd00('0x51')](_0x5e247c['update']({'exitAt':moment()['format'](_0xfd00('0x103'))}));});return Promise[_0xfd00('0x5c')](_0x223e05);}})[_0xfd00('0x22')](function(){if(_0x1c7af4){var _0x4e947c=[];var _0x46192f=[];var _0x1fd6ae=utils[_0xfd00('0x104')]();var _0x9e010c={'membername':_0x1c7af4['name'],'interface':_0x437642,'enterAt':moment()['format'](_0xfd00('0x103')),'role':_0x1c7af4[_0xfd00('0x2e')],'internal':_0x1c7af4['internal']};_0x1fd6ae[_0xfd00('0x102')](function(_0x2ee82d){_0x4e947c[_0xfd00('0x51')](_[_0xfd00('0x61')]({'channel':_0x2ee82d,'type':_0xfd00('0x105'),'data1':_0x529342['body']['device'],'data2':_0x437642},_0x9e010c));if(_0x1c7af4[_0xfd00('0xa4')]){_0x46192f[_0xfd00('0x51')](_[_0xfd00('0x61')]({'channel':_0x2ee82d,'type':_0xfd00('0x106'),'data1':_0xfd00('0x107')},_0x9e010c));}});return db[_0xfd00('0x101')]['bulkCreate'](_0x4e947c[_0xfd00('0xcc')](_0x46192f),{'individualHooks':!![]});}})['then'](function(){if(_0x1c7af4){return _0x1c7af4[_0xfd00('0x2d')]({'online':!![],'lastLoginAt':moment()['format'](_0xfd00('0x103')),'voicePause':_0x1c7af4['loginInPause']||![],'mailPause':_0x1c7af4[_0xfd00('0xa4')]||![],'chatPause':_0x1c7af4[_0xfd00('0xa4')]||![],'faxPause':_0x1c7af4[_0xfd00('0xa4')]||![],'smsPause':_0x1c7af4[_0xfd00('0xa4')]||![],'openchannelPause':_0x1c7af4[_0xfd00('0xa4')]||![],'whatsappPause':_0x1c7af4[_0xfd00('0xa4')]||![],'pauseType':_0x1c7af4[_0xfd00('0xa4')]?_0xfd00('0x107'):null,'interface':_0x437642,'lastPauseAt':moment()[_0xfd00('0xf5')](_0xfd00('0x103'))});}})[_0xfd00('0x22')](function(_0x865828){if(_0x529342[_0xfd00('0x108')]){return _0xc00ec5();}else{return Promise[_0xfd00('0x109')](_0x865828)['then'](respondWithResult(_0x188f3c,null));}})[_0xfd00('0x2c')](handleError(_0x188f3c,null));};exports['logout']=function(_0x2c3425,_0x1f0dd4){var _0x453b3f;return db[_0xfd00('0x3f')]['find']({'where':{'id':_0x2c3425[_0xfd00('0x5e')]['id'],'role':_0xfd00('0x2f')},'attributes':['id',_0xfd00('0x3a'),_0xfd00('0x2e')]})[_0xfd00('0x22')](handleEntityNotFound(_0x1f0dd4,null))['then'](function(_0x31a397){if(_0x31a397){_0x453b3f=_0x31a397;return db[_0xfd00('0xb4')]['destroy']({'where':{'membername':_0x453b3f[_0xfd00('0x3a')]},'individualHooks':!![]});}})[_0xfd00('0x22')](function(){return db['MemberReport'][_0xfd00('0x52')]({'where':{'membername':_0x453b3f['name'],'exitAt':null}});})[_0xfd00('0x22')](function(_0x19f47c){var _0x972f7a=[];_0x19f47c[_0xfd00('0x102')](function(_0x4bde58){_0x972f7a['push'](_0x4bde58[_0xfd00('0x2d')]({'exitAt':moment()[_0xfd00('0xf5')]('YYYY-MM-DD\x20HH:mm:ss')}));});return Promise[_0xfd00('0x5c')](_0x972f7a);})['then'](function(){return _0x453b3f[_0xfd00('0x2d')]({'online':![],'voicePause':![],'mailPause':![],'chatPause':![],'faxPause':![],'smsPause':![],'openchannelPause':![],'whatsappPause':![],'interface':null});})[_0xfd00('0x22')](respondWithResult(_0x1f0dd4,null))[_0xfd00('0x2c')](handleError(_0x1f0dd4,null));};exports[_0xfd00('0x10a')]=function(_0x531d64,_0x32d655){var _0x312925;return db[_0xfd00('0xb4')][_0xfd00('0x2d')]({'paused':0x1},{'where':{'UserId':_0x531d64['params']['id']},'individualHooks':!![]})[_0xfd00('0x22')](function(){return db[_0xfd00('0x3f')][_0xfd00('0x39')]({'where':{'id':_0x531d64[_0xfd00('0x5e')]['id'],'role':_0xfd00('0x2f')},'attributes':['id','name',_0xfd00('0x2e'),_0xfd00('0x67'),_0xfd00('0xb2'),_0xfd00('0xa3')]});})[_0xfd00('0x22')](handleEntityNotFound(_0x32d655,null))['then'](function(_0x272e3c){if(_0x272e3c){_0x312925=_0x272e3c;return respondWithRpcPromise('QueuePause','pause',{'id':_0x312925['id'],'name':_0x312925[_0xfd00('0x3a')],'pause':!![]});}})[_0xfd00('0x22')](function(){if(_0x312925){return db[_0xfd00('0x101')][_0xfd00('0x52')]({'where':{'membername':_0x312925[_0xfd00('0x3a')],'type':_0xfd00('0x106'),'exitAt':null}});}})['then'](function(_0x262a7e){if(_0x262a7e[_0xfd00('0x55')]){var _0x48ecbc=moment()[_0xfd00('0xf5')](_0xfd00('0x103'));for(var _0x329eb1=0x0,_0x43784c=_0x262a7e[_0xfd00('0x55')];_0x329eb1<_0x43784c;_0x329eb1++){_0x262a7e[_0x329eb1][_0xfd00('0x10b')]({'exitAt':_0x48ecbc});}}})[_0xfd00('0x22')](function(){var _0x1d4ca7=[];var _0x29b75e=utils[_0xfd00('0x104')]();_0x29b75e[_0xfd00('0x102')](function(_0xf0fa09){_0x1d4ca7[_0xfd00('0x51')]({'channel':_0xf0fa09,'membername':_0x312925['name'],'interface':_[_0xfd00('0x6d')](_0x312925[_0xfd00('0xb2')])?util[_0xfd00('0xf5')](_0xfd00('0xb3'),_0x312925[_0xfd00('0x3a')]):_0x312925[_0xfd00('0xb2')],'type':_0xfd00('0x106'),'enterAt':moment()[_0xfd00('0xf5')](_0xfd00('0x103')),'data1':_0x531d64[_0xfd00('0x63')][_0xfd00('0x43')]||'DEFAULT\x20PAUSE','role':_0x312925[_0xfd00('0x2e')],'internal':_0x312925[_0xfd00('0x67')]});});return db[_0xfd00('0x101')][_0xfd00('0x8e')](_0x1d4ca7,{'individualHooks':!![]});})[_0xfd00('0x22')](function(){return _0x312925[_0xfd00('0x2d')]({'voicePause':!![],'mailPause':!![],'chatPause':!![],'faxPause':!![],'smsPause':!![],'whatsappPause':!![],'openchannelPause':!![],'pauseType':_0x531d64['body'][_0xfd00('0x43')]||'DEFAULT\x20PAUSE','lastPauseAt':moment()['format'](_0xfd00('0x103'))});})[_0xfd00('0x22')](respondWithResult(_0x32d655,null))['catch'](handleError(_0x32d655,null));};exports[_0xfd00('0x10c')]=function(_0x3c2419,_0x114ba8){if(_0x3c2419[_0xfd00('0x63')]['channel']&&!utils['isValidChannel'](_0x3c2419[_0xfd00('0x63')][_0xfd00('0xa2')])){throw new APIBadRequestError(util['format']('Channel\x20parameter\x20%s\x20is\x20invalid',_0x3c2419['body'][_0xfd00('0xa2')]));}return db[_0xfd00('0x3f')][_0xfd00('0x39')]({'where':{'id':_0x3c2419['params']['id']},'attributes':['id','name',_0xfd00('0x2e'),_0xfd00('0x67'),'interface','online',_0xfd00('0xa5'),'mailPause',_0xfd00('0x10d'),_0xfd00('0x10e'),_0xfd00('0x10f'),_0xfd00('0x110'),_0xfd00('0x111'),_0xfd00('0x112'),_0xfd00('0x113')]})['then'](function(_0x756658){if(!_0x756658){throw new APINotFoundError(util['format'](_0xfd00('0x114'),_0x3c2419[_0xfd00('0x5e')]['id']));}return _0x756658[_0xfd00('0x10c')](_0x3c2419[_0xfd00('0x63')][_0xfd00('0xa2')]);})[_0xfd00('0x22')](respondWithResult(_0x114ba8,null))[_0xfd00('0x2c')](APIHandleError(_0x114ba8));};exports[_0xfd00('0x115')]=function(_0x3485a4,_0x5b226f){var _0x4d3270={};var _0x14511b={};var _0x5da934;var _0x5965c1;return db[_0xfd00('0x3f')][_0xfd00('0x9c')]({'where':{'id':_0x3485a4[_0xfd00('0x5e')]['id']}})[_0xfd00('0x22')](handleEntityNotFound(_0x5b226f,null))[_0xfd00('0x22')](function(_0xf26a55){if(_0xf26a55){_0x5da934=_0xf26a55;_0x14511b[_0xfd00('0xd4')]=_[_0xfd00('0xd6')](db[_0xfd00('0x116')][_0xfd00('0x40')]);_0x14511b[_0xfd00('0x4b')]=_['keys'](_0x3485a4[_0xfd00('0x4b')]);_0x14511b['filters']=_['intersection'](_0x14511b[_0xfd00('0xd4')],_0x14511b[_0xfd00('0x4b')]);_0x4d3270['attributes']=_[_0xfd00('0xd8')](_0x14511b['model'],qs[_0xfd00('0xd9')](_0x3485a4['query'][_0xfd00('0xd9')]));_0x4d3270[_0xfd00('0x50')]=_0x4d3270['attributes'][_0xfd00('0x55')]?_0x4d3270['attributes']:_0x14511b[_0xfd00('0xd4')];_0x4d3270['order']=qs[_0xfd00('0xdb')](_0x3485a4[_0xfd00('0x4b')][_0xfd00('0xdb')]);_0x4d3270[_0xfd00('0xdc')]=qs[_0xfd00('0xd7')](_[_0xfd00('0xdd')](_0x3485a4['query'],_0x14511b[_0xfd00('0xd7')]));if(_0x3485a4['query'][_0xfd00('0x35')]){_0x4d3270['where']=_[_0xfd00('0x61')](_0x4d3270[_0xfd00('0xdc')],{'$or':_[_0xfd00('0x41')](_0x4d3270['attributes'],function(_0x266a60){var _0x4a38e4={};_0x4a38e4[_0x266a60]={'$like':'%'+_0x3485a4[_0xfd00('0x4b')][_0xfd00('0x35')]+'%'};return _0x4a38e4;})});}_0x4d3270=_[_0xfd00('0x61')]({},_0x4d3270,_0x3485a4[_0xfd00('0x62')]);return _0x5da934[_0xfd00('0x115')](_0x4d3270);}})[_0xfd00('0x22')](function(_0x5c79dd){if(_0x5c79dd){_0x5965c1=_0x5c79dd[_0xfd00('0x55')];if(!_0x3485a4[_0xfd00('0x4b')][_0xfd00('0xce')](_0xfd00('0xe1'))){_0x4d3270[_0xfd00('0x1d')]=qs[_0xfd00('0x1d')](_0x3485a4[_0xfd00('0x4b')][_0xfd00('0x1d')]);_0x4d3270[_0xfd00('0x1b')]=qs['offset'](_0x3485a4['query']['offset']);}return _0x5da934[_0xfd00('0x115')](_0x4d3270);}})[_0xfd00('0x22')](function(_0x30d559){if(_0x30d559){return _0x30d559?{'count':_0x5965c1,'rows':_0x30d559}:null;}})[_0xfd00('0x22')](respondWithResult(_0x5b226f,null))[_0xfd00('0x2c')](handleError(_0x5b226f,null));};exports['addTeams']=function(_0x2345ff,_0x379a1b){var _0x485780=_0x2345ff['params']['id'];var _0x3ec5eb=_0x2345ff['body']?_0x2345ff[_0xfd00('0x63')][_0xfd00('0x66')]:null;var _0x98b093=[];return Promise[_0xfd00('0x109')]()['then'](function(){if(!_0x3ec5eb)throw new APIBadRequestError(_0xfd00('0x117'));})[_0xfd00('0x22')](function(){return db[_0xfd00('0x3f')][_0xfd00('0x9c')]({'where':{'id':_0x485780}});})[_0xfd00('0x22')](function(_0x4dae93){if(!_0x4dae93)throw new APINotFoundError(util[_0xfd00('0xf5')](_0xfd00('0x114'),_0x2345ff[_0xfd00('0x5e')]['id']));return db[_0xfd00('0x6e')][_0xfd00('0xfd')](function(_0x276270){return _0x4dae93[_0xfd00('0x118')](_0x3ec5eb,{'transaction':_0x276270})[_0xfd00('0x22')](function(){return db[_0xfd00('0x116')][_0xfd00('0x52')]({'where':{'id':{'$in':_0x3ec5eb}}});})[_0xfd00('0x22')](function(_0x5f4a4f){var _0x21ecdf=_[_0xfd00('0x41')](_0x5f4a4f,function(_0x2ec35d){return _0x2ec35d[_0xfd00('0x119')]();});return Promise[_0xfd00('0x5c')](_0x21ecdf);})[_0xfd00('0x22')](function(_0x24b483){_0x98b093=_[_0xfd00('0x11a')](_0x24b483);var _0x406780=_['map'](_0x98b093,function(_0x18f065){return _0x18f065['addAgent'](_0x4dae93['id'],{'transaction':_0x276270});});return Promise[_0xfd00('0x5c')](_0x406780);})[_0xfd00('0x22')](function(){if(!_0x4dae93['online'])return;var _0x2ad288=_[_0xfd00('0x35')](_0x98b093,function(_0x5d39df){return _0x5d39df['getDataValue'](_0xfd00('0xa2'))==='Voice';});var _0x12c59e=_[_0xfd00('0x41')](_0x2ad288,function(_0x3e18c4){return db[_0xfd00('0xb4')][_0xfd00('0x11b')]({'membername':_0x4dae93[_0xfd00('0x3a')],'UserId':_0x4dae93['id'],'queue_name':_0x3e18c4[_0xfd00('0x3a')],'VoiceQueueId':_0x3e18c4['id'],'interface':_['isNil'](_0x4dae93[_0xfd00('0xb2')])?util[_0xfd00('0xf5')](_0xfd00('0xb3'),_0x4dae93[_0xfd00('0x3a')]):_0x4dae93['interface'],'paused':_0x4dae93[_0xfd00('0xa5')]||![],'penalty':_0x4dae93[_0xfd00('0xaa')]},{'transaction':_0x276270});});return Promise['all'](_0x12c59e);})[_0xfd00('0x22')](function(){return db['TeamVoicePrefix']['findAll']({'where':{'teamId':{'$in':_0x3ec5eb}}});})['then'](function(_0x24c326){var _0x2aa629=_['map'](_0x24c326,function(_0x51176b){return db[_0xfd00('0x11c')][_0xfd00('0x88')]({'UserId':_0x4dae93['id'],'VoicePrefixId':_0x51176b[_0xfd00('0x11d')]},{'transaction':_0x276270});});return Promise[_0xfd00('0x5c')](_0x2aa629);});});})[_0xfd00('0x22')](function(){for(var _0x20753a=0x0;_0x20753a<_0x98b093[_0xfd00('0x55')];_0x20753a++){var _0x2b19ae=_0x98b093[_0x20753a][_0xfd00('0x11e')]('channel');var _0x2d23b2=_0x2b19ae+'QueueId';socket[_0xfd00('0xad')](_0xfd00('0x33')+_0x2b19ae+_0xfd00('0xaf'),{'UserId':_0x485780,['queueField']:_0x98b093[_0x20753a]['id']});}})[_0xfd00('0x22')](respondWithStatusCode(_0x379a1b,null))[_0xfd00('0x2c')](APIHandleError(_0x379a1b));};exports['removeTeams']=function(_0x5bad3d,_0x9d7981){var _0x45c8d3=_0x5bad3d[_0xfd00('0x5e')]['id'];var _0x2f5dad=null;if(_0x5bad3d[_0xfd00('0x4b')][_0xfd00('0x66')]){_0x2f5dad=_[_0xfd00('0x11f')](_0x5bad3d[_0xfd00('0x4b')][_0xfd00('0x66')])?_0x5bad3d['query'][_0xfd00('0x66')]:[_0x5bad3d[_0xfd00('0x4b')][_0xfd00('0x66')]];}var _0xe7cbfe=[];return Promise['resolve']()[_0xfd00('0x22')](function(){if(!_0x2f5dad)throw new APIBadRequestError(_0xfd00('0x120'));})[_0xfd00('0x22')](function(){return db[_0xfd00('0x3f')]['findOne']({'where':{'id':_0x45c8d3}});})[_0xfd00('0x22')](function(_0xaa3575){if(!_0xaa3575)throw new APINotFoundError(util[_0xfd00('0xf5')]('User\x20with\x20id\x20%s\x20not\x20found',_0x5bad3d[_0xfd00('0x5e')]['id']));return db['sequelize']['transaction'](function(_0x46b5b3){return _0xaa3575[_0xfd00('0x121')](_0x2f5dad,{'transaction':_0x46b5b3})[_0xfd00('0x22')](function(){return db[_0xfd00('0x116')][_0xfd00('0x52')]({'where':{'id':{'$in':_0x2f5dad}}});})[_0xfd00('0x22')](function(_0x4a2020){var _0x192344=_['map'](_0x4a2020,function(_0xc98a88){return _0xc98a88[_0xfd00('0x119')]();});return Promise[_0xfd00('0x5c')](_0x192344);})[_0xfd00('0x22')](function(_0x4e6f54){_0xe7cbfe=_[_0xfd00('0x11a')](_0x4e6f54);var _0x53d534=_[_0xfd00('0x41')](_0xe7cbfe,function(_0x189846){return _0x189846[_0xfd00('0x122')](_0xaa3575['id'],{'transaction':_0x46b5b3});});return Promise['all'](_0x53d534);})[_0xfd00('0x22')](function(){if(!_0xaa3575[_0xfd00('0xa3')])return;var _0x94a0f4=_[_0xfd00('0x35')](_0xe7cbfe,function(_0x299290){return _0x299290['getDataValue'](_0xfd00('0xa2'))==='Voice';});var _0x2b50f4=_[_0xfd00('0x41')](_0x94a0f4,function(_0x267c43){return db[_0xfd00('0xb4')]['destroy']({'where':{'VoiceQueueId':_0x267c43['id'],'UserId':_0xaa3575['id']},'transaction':_0x46b5b3});});return Promise[_0xfd00('0x5c')](_0x2b50f4);})[_0xfd00('0x22')](function(){return db[_0xfd00('0x123')][_0xfd00('0x52')]({'where':{'teamId':{'$in':_0x2f5dad}}});})[_0xfd00('0x22')](function(_0x5b96fe){var _0x3c2c07=_[_0xfd00('0x41')](_0x5b96fe,function(_0x336f14){return db['UserVoicePrefix'][_0xfd00('0x3c')]({'where':{'UserId':_0xaa3575['id'],'VoicePrefixId':_0x336f14[_0xfd00('0x11d')]}},{'transaction':_0x46b5b3});});return Promise['all'](_0x3c2c07);});});})[_0xfd00('0x22')](function(){for(var _0x4fc9ce=0x0;_0x4fc9ce<_0xe7cbfe['length'];_0x4fc9ce++){var _0x57de97=_0xe7cbfe[_0x4fc9ce]['getDataValue']('channel');var _0x2181ef=_0x57de97+_0xfd00('0xac');socket[_0xfd00('0xad')](_0xfd00('0x33')+_0x57de97+_0xfd00('0xb7'),{'UserId':_0x45c8d3,['queueField']:_0xe7cbfe[_0x4fc9ce]['id']});}})[_0xfd00('0x22')](respondWithStatusCode(_0x9d7981,null))[_0xfd00('0x2c')](APIHandleError(_0x9d7981));};exports[_0xfd00('0x124')]=function(_0x102cbe,_0x2e2aa4){var _0x2f0ec7={};var _0x3d71f6={};var _0x4c84db;var _0x2d56d3;return db[_0xfd00('0x3f')][_0xfd00('0x9c')]({'where':{'id':_0x102cbe[_0xfd00('0x5e')]['id']}})[_0xfd00('0x22')](handleEntityNotFound(_0x2e2aa4,null))['then'](function(_0x231f25){if(_0x231f25){_0x4c84db=_0x231f25;_0x3d71f6[_0xfd00('0xd4')]=_[_0xfd00('0xd6')](db[_0xfd00('0xcf')]['rawAttributes']);_0x3d71f6['query']=_[_0xfd00('0xd6')](_0x102cbe['query']);_0x3d71f6[_0xfd00('0xd7')]=_['intersection'](_0x3d71f6[_0xfd00('0xd4')],_0x3d71f6[_0xfd00('0x4b')]);_0x2f0ec7[_0xfd00('0x50')]=_['intersection'](_0x3d71f6[_0xfd00('0xd4')],qs[_0xfd00('0xd9')](_0x102cbe[_0xfd00('0x4b')][_0xfd00('0xd9')]));_0x2f0ec7['attributes']=_0x2f0ec7[_0xfd00('0x50')][_0xfd00('0x55')]?_0x2f0ec7['attributes']:_0x3d71f6[_0xfd00('0xd4')];_0x2f0ec7[_0xfd00('0xda')]=qs['sort'](_0x102cbe[_0xfd00('0x4b')][_0xfd00('0xdb')]);_0x2f0ec7[_0xfd00('0xdc')]=qs[_0xfd00('0xd7')](_[_0xfd00('0xdd')](_0x102cbe[_0xfd00('0x4b')],_0x3d71f6[_0xfd00('0xd7')]));if(_0x102cbe['query'][_0xfd00('0x35')]){_0x2f0ec7[_0xfd00('0xdc')]=_[_0xfd00('0x61')](_0x2f0ec7[_0xfd00('0xdc')],{'$or':_[_0xfd00('0x41')](_0x2f0ec7[_0xfd00('0x50')],function(_0xa6cf9a){var _0x219231={};_0x219231[_0xa6cf9a]={'$like':'%'+_0x102cbe[_0xfd00('0x4b')][_0xfd00('0x35')]+'%'};return _0x219231;})});}_0x2f0ec7=_[_0xfd00('0x61')]({},_0x2f0ec7,_0x102cbe[_0xfd00('0x62')]);return _0x4c84db[_0xfd00('0x124')](_0x2f0ec7);}})['then'](function(_0x5e10ef){if(_0x5e10ef){_0x2d56d3=_0x5e10ef[_0xfd00('0x55')];if(!_0x102cbe['query'][_0xfd00('0xce')](_0xfd00('0xe1'))){_0x2f0ec7[_0xfd00('0x1d')]=qs[_0xfd00('0x1d')](_0x102cbe[_0xfd00('0x4b')][_0xfd00('0x1d')]);_0x2f0ec7[_0xfd00('0x1b')]=qs[_0xfd00('0x1b')](_0x102cbe[_0xfd00('0x4b')]['offset']);}return _0x4c84db[_0xfd00('0x124')](_0x2f0ec7);}})['then'](function(_0x389cf6){if(_0x389cf6){return _0x389cf6?{'count':_0x2d56d3,'rows':_0x389cf6}:null;}})['then'](respondWithResult(_0x2e2aa4,null))[_0xfd00('0x2c')](handleError(_0x2e2aa4,null));};exports['getAgents']=function(_0x5a5755,_0x3b2f10){var _0x20055f={};var _0x3ac63e={};var _0x5ad7fe;return db['User']['findOne']({'where':{'id':_0x5a5755[_0xfd00('0x5e')]['id']}})['then'](handleEntityNotFound(_0x3b2f10,null))[_0xfd00('0x22')](function(_0x569402){if(_0x569402){_0x5ad7fe=_0x569402;_0x3ac63e[_0xfd00('0xd4')]=_[_0xfd00('0xd6')](db[_0xfd00('0x3f')][_0xfd00('0x40')]);_0x3ac63e['query']=_[_0xfd00('0xd6')](_0x5a5755[_0xfd00('0x4b')]);_0x3ac63e[_0xfd00('0xd7')]=_[_0xfd00('0xd8')](_0x3ac63e[_0xfd00('0xd4')],_0x3ac63e[_0xfd00('0x4b')]);_0x20055f['attributes']=_[_0xfd00('0xd8')](_0x3ac63e[_0xfd00('0xd4')],qs[_0xfd00('0xd9')](_0x5a5755[_0xfd00('0x4b')][_0xfd00('0xd9')]));_0x20055f['attributes']=_0x20055f[_0xfd00('0x50')][_0xfd00('0x55')]?_0x20055f[_0xfd00('0x50')]:_0x3ac63e[_0xfd00('0xd4')];_0x20055f[_0xfd00('0xda')]=qs[_0xfd00('0xdb')](_0x5a5755[_0xfd00('0x4b')][_0xfd00('0xdb')]);_0x20055f[_0xfd00('0xdc')]=qs[_0xfd00('0xd7')](_[_0xfd00('0xdd')](_0x5a5755['query'],_0x3ac63e[_0xfd00('0xd7')]));if(_0x5a5755['query'][_0xfd00('0x35')]){_0x20055f[_0xfd00('0xdc')]=_[_0xfd00('0x61')](_0x20055f[_0xfd00('0xdc')],{'$or':_[_0xfd00('0x41')](_0x20055f['attributes'],function(_0x11754b){var _0x14eb9f={};_0x14eb9f[_0x11754b]={'$like':'%'+_0x5a5755[_0xfd00('0x4b')][_0xfd00('0x35')]+'%'};return _0x14eb9f;})});}_0x20055f[_0xfd00('0xd4')]=db['User'];_0x20055f['as']=_0xfd00('0x8a');_0x20055f=_[_0xfd00('0x61')]({},_0x20055f,_0x5a5755[_0xfd00('0x62')]);return _0x5ad7fe[_0xfd00('0xff')]({'include':[_0x20055f]});}})[_0xfd00('0x22')](function(_0x13c561){if(_0x13c561){var _0x20afe9={},_0x5c31df=[];for(var _0x2dd9a5=0x0;_0x2dd9a5<_0x13c561[_0xfd00('0x55')];_0x2dd9a5+=0x1){for(var _0x50d573=0x0,_0x1e677a;_0x50d573<_0x13c561[_0x2dd9a5]['Agents'][_0xfd00('0x55')];_0x50d573+=0x1){_0x1e677a=_0x13c561[_0x2dd9a5][_0xfd00('0x8a')][_0x50d573][_0xfd00('0x30')]({'plain':!![]});_0x20afe9[_0x1e677a['id']]=_0x1e677a;}}_0x20afe9=_[_0xfd00('0x125')](_0x20afe9);for(var _0x575fd1=qs[_0xfd00('0x1b')](_0x5a5755['query'][_0xfd00('0x1b')]);_0x575fd1<_0x20afe9[_0xfd00('0x55')]&&_0x5c31df['length']=_0x5e1798[_0x18ae('0x53')]){throw new Error(_0x18ae('0x54'));}})[_0x18ae('0x17')](function(){if(_0x525b86){return db['UserVoiceQueueRt'][_0x18ae('0x49')]({'where':{'membername':_0x525b86[_0x18ae('0x29')]},'individualHooks':!![]});}})[_0x18ae('0x17')](function(){if(_0x525b86){return _0x525b86['getVoiceQueues']({'raw':!![]});}})[_0x18ae('0x17')](function(_0x351a4d){if(_0x525b86){if(_0x351a4d){var _0xd81c6a=[];_0x534bb3=_0x351a4d;if(_0x534bb3[_0x18ae('0x2b')]){for(var _0x2eec9d=0x0;_0x2eec9d<_0x534bb3[_0x18ae('0x2b')];_0x2eec9d++){_0xd81c6a[_0x18ae('0x2f')](db[_0x18ae('0x27')][_0x18ae('0x55')]({'membername':_0x525b86[_0x18ae('0x29')],'UserId':_0x525b86['id'],'queue_name':_0x534bb3[_0x2eec9d]['name'],'VoiceQueueId':_0x534bb3[_0x2eec9d]['id'],'interface':_0x26f44c,'paused':_0x525b86[_0x18ae('0x4e')]||![],'penalty':_0x534bb3[_0x2eec9d][_0x18ae('0x56')]||0x0}));}return BPromise[_0x18ae('0x4a')](_0xd81c6a);}}}})['then'](function(){if(_0x525b86){return db[_0x18ae('0x35')][_0x18ae('0xf')]({'where':{'membername':_0x525b86['name'],'exitAt':null}});}})[_0x18ae('0x17')](function(_0x188b1f){if(_0x525b86){if(_0x188b1f&&_0x188b1f[_0x18ae('0x2b')]){var _0x5dcb0c=[];_0x188b1f['forEach'](function(_0x1faf72){_0x5dcb0c['push'](_0x1faf72['update']({'exitAt':moment()[_0x18ae('0x25')](_0x18ae('0x37'))}));});return BPromise[_0x18ae('0x4a')](_0x5dcb0c);}}})[_0x18ae('0x17')](function(){if(_0x525b86){var _0x2a0335=[];var _0x130446=[];var _0x37e41a=utils[_0x18ae('0x2d')]();var _0x3c6ee0={'membername':_0x525b86['name'],'interface':_0x26f44c,'enterAt':moment()[_0x18ae('0x25')](_0x18ae('0x37')),'role':_0x525b86[_0x18ae('0x22')],'internal':_0x525b86[_0x18ae('0x23')]};_0x37e41a[_0x18ae('0x2e')](function(_0x97e133){_0x2a0335[_0x18ae('0x2f')](_['merge']({'channel':_0x97e133,'type':_0x18ae('0x57'),'data1':_0x18ae('0x58'),'data2':_0x26f44c},_0x3c6ee0));if(_0x525b86['loginInPause']){_0x130446[_0x18ae('0x2f')](_[_0x18ae('0x59')]({'channel':_0x97e133,'type':_0x18ae('0x2a'),'data1':_0x18ae('0x5a')},_0x3c6ee0));}});return db['MemberReport'][_0x18ae('0x36')](_0x2a0335[_0x18ae('0x5b')](_0x130446),{'individualHooks':!![]});}})[_0x18ae('0x17')](function(){if(_0x525b86){return _0x525b86[_0x18ae('0x28')]({'online':!![],'lastLoginAt':moment()[_0x18ae('0x25')](_0x18ae('0x37')),'voicePause':_0x525b86[_0x18ae('0x4e')]||![],'mailPause':_0x525b86[_0x18ae('0x4e')]||![],'chatPause':_0x525b86[_0x18ae('0x4e')]||![],'faxPause':_0x525b86[_0x18ae('0x4e')]||![],'smsPause':_0x525b86[_0x18ae('0x4e')]||![],'openchannelPause':_0x525b86['loginInPause']||![],'pauseType':_0x525b86[_0x18ae('0x4e')]?_0x18ae('0x5a'):null,'lastPauseAt':moment()[_0x18ae('0x25')](_0x18ae('0x37')),'interface':_0x26f44c});}})[_0x18ae('0x17')](function(_0x2407d4){_0x7ed7c2(_0x2407d4);})[_0x18ae('0x1b')](function(_0x29d67e){_0x4d3da0(_0x322439[_0x18ae('0x1c')](0x1f4,_0x29d67e[_0x18ae('0x1d')]));});});}; \ No newline at end of file +var _0xb998=['rpc','../../config/environment','redis','defaults','localhost','socket.io-emitter','register','GetUser','User','findAll','options','raw','where','limit','include','model','attributes','map','then','info','stringify','message','ShowUser','find','catch','error','PauseUser','internal','interface','format','params','UserVoiceQueueRt','update','MemberReport','name','PAUSE','length','YYYY-MM-DD\x20HH:mm:ss','updateAttributes','getChannels','isNil','SIP/%s','body','type','DEFAULT\x20PAUSE','role','uniqueid','UnpauseUser','resolve','channel','isValidChannel','Channel\x20parameter\x20%s\x20is\x20invalid','findOne','online','voicePause','mailPause','faxPause','openchannelPause','smsPause','pauseType','lastPauseAt','unpause','LogoutUser','destroy','forEach','push','all','LoginUser','mobile','loginInPause','count','agent','../../config/license/util','getLicense','agents','getVoiceQueues','upsert','UserVoiceQueue.penalty','merge','LOGIN','callysquare','LOGININPAUSE','bulkCreate','concat','lodash','util','moment','bluebird','../../mysqldb','../../config/logger'];(function(_0x1c24b0,_0xc377a1){var _0x110c17=function(_0x4301fe){while(--_0x4301fe){_0x1c24b0['push'](_0x1c24b0['shift']());}};_0x110c17(++_0xc377a1);}(_0xb998,0xae));var _0x8b99=function(_0x124936,_0x5dc71b){_0x124936=_0x124936-0x0;var _0x410f67=_0xb998[_0x124936];return _0x410f67;};'use strict';var _=require(_0x8b99('0x0'));var util=require(_0x8b99('0x1'));var moment=require(_0x8b99('0x2'));var BPromise=require(_0x8b99('0x3'));var Redis=require('ioredis');var db=require(_0x8b99('0x4'))['db'];var utils=require('../../config/utils');var logger=require(_0x8b99('0x5'))(_0x8b99('0x6'));var config=require(_0x8b99('0x7'));config[_0x8b99('0x8')]=_[_0x8b99('0x9')](config[_0x8b99('0x8')],{'host':_0x8b99('0xa'),'port':0x18eb});var socket=require(_0x8b99('0xb'))(new Redis(config[_0x8b99('0x8')]));require('./user.socket')[_0x8b99('0xc')](socket);exports[_0x8b99('0xd')]=function(_0x47d139){var _0xf3e208=this;return new Promise(function(_0x42178f,_0x217372){return db[_0x8b99('0xe')][_0x8b99('0xf')]({'raw':_0x47d139[_0x8b99('0x10')]?_0x47d139['options'][_0x8b99('0x11')]===undefined?!![]:![]:!![],'where':_0x47d139[_0x8b99('0x10')]?_0x47d139[_0x8b99('0x10')][_0x8b99('0x12')]||null:null,'attributes':_0x47d139['options']?_0x47d139[_0x8b99('0x10')]['attributes']||null:null,'limit':_0x47d139['options']?_0x47d139['options'][_0x8b99('0x13')]||null:null,'include':_0x47d139[_0x8b99('0x10')]?_0x47d139[_0x8b99('0x10')][_0x8b99('0x14')]?_['map'](_0x47d139[_0x8b99('0x10')]['include'],function(_0x411977){return{'model':db[_0x411977[_0x8b99('0x15')]],'as':_0x411977['as'],'attributes':_0x411977[_0x8b99('0x16')],'include':_0x411977['include']?_[_0x8b99('0x17')](_0x411977[_0x8b99('0x14')],function(_0x48e6e2){return{'model':db[_0x48e6e2['model']],'as':_0x48e6e2['as'],'attributes':_0x48e6e2[_0x8b99('0x16')],'include':_0x48e6e2[_0x8b99('0x14')]?_[_0x8b99('0x17')](_0x48e6e2[_0x8b99('0x14')],function(_0x60eb8){return{'model':db[_0x60eb8[_0x8b99('0x15')]],'as':_0x60eb8['as'],'attributes':_0x60eb8[_0x8b99('0x16')]};}):[]};}):[]};}):[]:[]})[_0x8b99('0x18')](function(_0x384b59){logger[_0x8b99('0x19')](_0x8b99('0xd'),_0x47d139);logger['debug'](_0x8b99('0xd'),_0x47d139,JSON[_0x8b99('0x1a')](_0x384b59));_0x42178f(_0x384b59);})['catch'](function(_0x35a85e){logger['error'](_0x8b99('0xd'),_0x35a85e[_0x8b99('0x1b')],_0x47d139);_0x217372(_0xf3e208['error'](0x1f4,_0x35a85e[_0x8b99('0x1b')]));});});};exports[_0x8b99('0x1c')]=function(_0x197514){var _0x2f93d7=this;return new Promise(function(_0x15dae4,_0x1aa340){return db[_0x8b99('0xe')][_0x8b99('0x1d')]({'raw':_0x197514[_0x8b99('0x10')]?_0x197514['options'][_0x8b99('0x11')]===undefined?!![]:![]:!![],'where':_0x197514[_0x8b99('0x10')]?_0x197514['options'][_0x8b99('0x12')]||null:null,'attributes':_0x197514[_0x8b99('0x10')]?_0x197514[_0x8b99('0x10')]['attributes']||null:null,'include':_0x197514['options']?_0x197514['options']['include']?_[_0x8b99('0x17')](_0x197514[_0x8b99('0x10')]['include'],function(_0x3d2787){return{'model':db[_0x3d2787[_0x8b99('0x15')]],'as':_0x3d2787['as'],'attributes':_0x3d2787[_0x8b99('0x16')],'include':_0x3d2787[_0x8b99('0x14')]?_['map'](_0x3d2787[_0x8b99('0x14')],function(_0x5cea81){return{'model':db[_0x5cea81['model']],'as':_0x5cea81['as'],'attributes':_0x5cea81[_0x8b99('0x16')],'include':_0x5cea81['include']?_[_0x8b99('0x17')](_0x5cea81[_0x8b99('0x14')],function(_0x212059){return{'model':db[_0x212059[_0x8b99('0x15')]],'as':_0x212059['as'],'attributes':_0x212059['attributes']};}):[]};}):[]};}):[]:[]})[_0x8b99('0x18')](function(_0x2a2a90){logger['info'](_0x8b99('0x1c'),_0x197514);logger['debug']('ShowUser',_0x197514,JSON[_0x8b99('0x1a')](_0x2a2a90));_0x15dae4(_0x2a2a90);})[_0x8b99('0x1e')](function(_0x2cdd62){logger[_0x8b99('0x1f')]('ShowUser',_0x2cdd62[_0x8b99('0x1b')],_0x197514);_0x1aa340(_0x2f93d7[_0x8b99('0x1f')](0x1f4,_0x2cdd62[_0x8b99('0x1b')]));});});};exports[_0x8b99('0x20')]=function(_0x43eae0){var _0x320e1b;return db[_0x8b99('0xe')][_0x8b99('0x1d')]({'where':_0x43eae0[_0x8b99('0x10')]['where']||{},'attributes':['id','name','role',_0x8b99('0x21'),_0x8b99('0x22')]})['then'](function(_0x4b3028){if(!_0x4b3028){throw new Error(util[_0x8b99('0x23')]('User\x20with\x20id\x20%s\x20not\x20found',_0x43eae0[_0x8b99('0x24')]['id']));}_0x320e1b=_0x4b3028;return db[_0x8b99('0x25')][_0x8b99('0x26')]({'paused':0x1},{'where':{'UserId':_0x320e1b['id']},'individualHooks':!![]});})[_0x8b99('0x18')](function(){return db[_0x8b99('0x27')][_0x8b99('0xf')]({'where':{'membername':_0x320e1b[_0x8b99('0x28')],'type':_0x8b99('0x29'),'exitAt':null}});})[_0x8b99('0x18')](function(_0x45b3e8){if(_0x45b3e8&&_0x45b3e8[_0x8b99('0x2a')]){var _0x310ac9=moment()[_0x8b99('0x23')](_0x8b99('0x2b'));for(var _0x1e45ee=0x0,_0x5c0335=_0x45b3e8['length'];_0x1e45ee<_0x5c0335;_0x1e45ee++){_0x45b3e8[_0x1e45ee][_0x8b99('0x2c')]({'exitAt':_0x310ac9});}}})['then'](function(){var _0x349bcc=[];var _0x55b691=utils[_0x8b99('0x2d')]();_0x55b691['forEach'](function(_0x231201){_0x349bcc['push']({'channel':_0x231201,'membername':_0x320e1b['name'],'interface':_[_0x8b99('0x2e')](_0x320e1b[_0x8b99('0x22')])?util['format'](_0x8b99('0x2f'),_0x320e1b[_0x8b99('0x28')]):_0x320e1b['interface'],'type':_0x8b99('0x29'),'enterAt':moment()['format'](_0x8b99('0x2b')),'data1':_0x43eae0[_0x8b99('0x30')][_0x8b99('0x31')]||_0x8b99('0x32'),'role':_0x320e1b[_0x8b99('0x33')],'internal':_0x320e1b[_0x8b99('0x21')],'uniqueid':_0x43eae0[_0x8b99('0x30')][_0x8b99('0x34')]||null});});return db['MemberReport']['bulkCreate'](_0x349bcc,{'individualHooks':!![]});})[_0x8b99('0x18')](function(){return _0x320e1b[_0x8b99('0x26')]({'voicePause':!![],'mailPause':!![],'chatPause':!![],'faxPause':!![],'smsPause':!![],'openchannelPause':!![],'whatsappPause':!![],'pauseType':_0x43eae0['body'][_0x8b99('0x31')]||_0x8b99('0x32'),'lastPauseAt':moment()['format']('YYYY-MM-DD\x20HH:mm:ss')});})[_0x8b99('0x1e')](function(_0x1f8966){throw _0x1f8966;});};exports[_0x8b99('0x35')]=function(_0x1446bf){return Promise[_0x8b99('0x36')]()[_0x8b99('0x18')](function(){if(_0x1446bf[_0x8b99('0x30')][_0x8b99('0x37')]&&!utils[_0x8b99('0x38')](_0x1446bf[_0x8b99('0x30')][_0x8b99('0x37')])){throw new Error(util[_0x8b99('0x23')](_0x8b99('0x39'),_0x1446bf[_0x8b99('0x30')]['channel']));}return db[_0x8b99('0xe')][_0x8b99('0x3a')]({'where':_0x1446bf['options'][_0x8b99('0x12')]||{},'attributes':['id','name',_0x8b99('0x33'),'internal',_0x8b99('0x22'),_0x8b99('0x3b'),_0x8b99('0x3c'),_0x8b99('0x3d'),'chatPause',_0x8b99('0x3e'),_0x8b99('0x3f'),_0x8b99('0x40'),'whatsappPause',_0x8b99('0x41'),_0x8b99('0x42')]});})['then'](function(_0xbaf059){if(!_0xbaf059){throw new Error(util['format']('User\x20with\x20id\x20%s\x20not\x20found',_0x1446bf[_0x8b99('0x24')]['id']));}return _0xbaf059[_0x8b99('0x43')](_0x1446bf['body'][_0x8b99('0x37')],'system');})[_0x8b99('0x1e')](function(_0xca3553){throw _0xca3553;});};exports[_0x8b99('0x44')]=function(_0x3ccb77){var _0x1b99fd=this;return new Promise(function(_0x2a09ea,_0x403def){var _0x4a0f38;return db[_0x8b99('0xe')][_0x8b99('0x3a')]({'where':_0x3ccb77['options'][_0x8b99('0x12')]||{},'attributes':['id',_0x8b99('0x28')]})[_0x8b99('0x18')](function(_0x15f893){if(_0x15f893){_0x4a0f38=_0x15f893;return db[_0x8b99('0x25')][_0x8b99('0x45')]({'where':{'membername':_0x4a0f38[_0x8b99('0x28')]},'individualHooks':!![]});}})[_0x8b99('0x18')](function(){if(_0x4a0f38){return db[_0x8b99('0x27')]['findAll']({'where':{'membername':_0x4a0f38['name'],'exitAt':null}});}})['then'](function(_0x14bda7){if(_0x4a0f38){if(_0x14bda7&&_0x14bda7[_0x8b99('0x2a')]){var _0x393dc4=[];_0x14bda7[_0x8b99('0x46')](function(_0x2b2fb1){_0x393dc4[_0x8b99('0x47')](_0x2b2fb1[_0x8b99('0x26')]({'exitAt':moment()[_0x8b99('0x23')]('YYYY-MM-DD\x20HH:mm:ss')}));});return BPromise[_0x8b99('0x48')](_0x393dc4);}}})['then'](function(){if(_0x4a0f38){return _0x4a0f38[_0x8b99('0x26')]({'online':![],'voicePause':![],'mailPause':![],'chatPause':![],'faxPause':![],'smsPause':![],'openchannelPause':![]});}})['then'](function(_0x1bd76f){_0x2a09ea(_0x1bd76f);})['catch'](function(_0x122c6d){_0x403def(_0x1b99fd[_0x8b99('0x1f')](0x1f4,_0x122c6d[_0x8b99('0x1b')]));});});};exports[_0x8b99('0x49')]=function(_0x5a3afc){var _0xb2a26c=this;return new Promise(function(_0x52c860,_0x27ab9a){var _0x29a968;var _0xab9c13;var _0x11511d;var _0x2c1657;return db[_0x8b99('0xe')][_0x8b99('0x3a')]({'where':_0x5a3afc[_0x8b99('0x10')][_0x8b99('0x12')]||{},'attributes':['id',_0x8b99('0x28'),'role',_0x8b99('0x4a'),'phone',_0x8b99('0x21'),_0x8b99('0x4b'),_0x8b99('0x22')]})[_0x8b99('0x18')](function(_0x3d0e08){if(_0x3d0e08){_0x29a968=_0x3d0e08;_0x2c1657=_0x5a3afc[_0x8b99('0x30')][_0x8b99('0x22')]?_0x5a3afc[_0x8b99('0x30')][_0x8b99('0x22')]:util[_0x8b99('0x23')](_0x8b99('0x2f'),_0x29a968[_0x8b99('0x28')]);return db[_0x8b99('0xe')][_0x8b99('0x4c')]({'where':{'role':_0x8b99('0x4d'),'online':!![],'id':{'$ne':_0x29a968['id']}}});}})['then'](function(_0x4a6270){if(_0x4a6270){_0x11511d=_0x4a6270;return require(_0x8b99('0x4e'))[_0x8b99('0x4f')]();}})[_0x8b99('0x18')](function(_0x21f430){if(_0x21f430&&_0x21f430[_0x8b99('0x50')]&&_0x11511d>=_0x21f430['agents']){throw new Error('Maximum\x20login\x20has\x20been\x20reached');}})[_0x8b99('0x18')](function(){if(_0x29a968){return db[_0x8b99('0x25')][_0x8b99('0x45')]({'where':{'membername':_0x29a968[_0x8b99('0x28')]},'individualHooks':!![]});}})[_0x8b99('0x18')](function(){if(_0x29a968){return _0x29a968[_0x8b99('0x51')]({'raw':!![]});}})[_0x8b99('0x18')](function(_0x22325a){if(_0x29a968){if(_0x22325a){var _0x228314=[];_0xab9c13=_0x22325a;if(_0xab9c13[_0x8b99('0x2a')]){for(var _0x1d1839=0x0;_0x1d1839<_0xab9c13[_0x8b99('0x2a')];_0x1d1839++){_0x228314[_0x8b99('0x47')](db['UserVoiceQueueRt'][_0x8b99('0x52')]({'membername':_0x29a968[_0x8b99('0x28')],'UserId':_0x29a968['id'],'queue_name':_0xab9c13[_0x1d1839][_0x8b99('0x28')],'VoiceQueueId':_0xab9c13[_0x1d1839]['id'],'interface':_0x2c1657,'paused':_0x29a968[_0x8b99('0x4b')]||![],'penalty':_0xab9c13[_0x1d1839][_0x8b99('0x53')]||0x0}));}return BPromise['all'](_0x228314);}}}})[_0x8b99('0x18')](function(){if(_0x29a968){return db[_0x8b99('0x27')]['findAll']({'where':{'membername':_0x29a968['name'],'exitAt':null}});}})['then'](function(_0x2fea4b){if(_0x29a968){if(_0x2fea4b&&_0x2fea4b['length']){var _0x3fe15e=[];_0x2fea4b[_0x8b99('0x46')](function(_0x39ac71){_0x3fe15e[_0x8b99('0x47')](_0x39ac71['update']({'exitAt':moment()[_0x8b99('0x23')](_0x8b99('0x2b'))}));});return BPromise[_0x8b99('0x48')](_0x3fe15e);}}})['then'](function(){if(_0x29a968){var _0x2efa1d=[];var _0x207c46=[];var _0x33694a=utils['getChannels']();var _0x1d7a4c={'membername':_0x29a968[_0x8b99('0x28')],'interface':_0x2c1657,'enterAt':moment()[_0x8b99('0x23')]('YYYY-MM-DD\x20HH:mm:ss'),'role':_0x29a968[_0x8b99('0x33')],'internal':_0x29a968[_0x8b99('0x21')]};_0x33694a['forEach'](function(_0x2b1625){_0x2efa1d[_0x8b99('0x47')](_[_0x8b99('0x54')]({'channel':_0x2b1625,'type':_0x8b99('0x55'),'data1':_0x8b99('0x56'),'data2':_0x2c1657},_0x1d7a4c));if(_0x29a968[_0x8b99('0x4b')]){_0x207c46[_0x8b99('0x47')](_['merge']({'channel':_0x2b1625,'type':'PAUSE','data1':_0x8b99('0x57')},_0x1d7a4c));}});return db[_0x8b99('0x27')][_0x8b99('0x58')](_0x2efa1d[_0x8b99('0x59')](_0x207c46),{'individualHooks':!![]});}})['then'](function(){if(_0x29a968){return _0x29a968[_0x8b99('0x26')]({'online':!![],'lastLoginAt':moment()[_0x8b99('0x23')](_0x8b99('0x2b')),'voicePause':_0x29a968[_0x8b99('0x4b')]||![],'mailPause':_0x29a968[_0x8b99('0x4b')]||![],'chatPause':_0x29a968['loginInPause']||![],'faxPause':_0x29a968[_0x8b99('0x4b')]||![],'smsPause':_0x29a968[_0x8b99('0x4b')]||![],'openchannelPause':_0x29a968[_0x8b99('0x4b')]||![],'pauseType':_0x29a968[_0x8b99('0x4b')]?_0x8b99('0x57'):null,'lastPauseAt':moment()[_0x8b99('0x23')](_0x8b99('0x2b')),'interface':_0x2c1657});}})[_0x8b99('0x18')](function(_0xcbbb4b){_0x52c860(_0xcbbb4b);})[_0x8b99('0x1e')](function(_0x1c4560){_0x27ab9a(_0xb2a26c[_0x8b99('0x1f')](0x1f4,_0x1c4560[_0x8b99('0x1b')]));});});}; \ No newline at end of file diff --git a/server/api/user/user.socket.js b/server/api/user/user.socket.js index 8996392..eeed68a 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 _0x0476=['remove','update','emit','removeListener','register','length','user:','save'];(function(_0x212721,_0x1c0edc){var _0x369f08=function(_0x1c6077){while(--_0x1c6077){_0x212721['push'](_0x212721['shift']());}};_0x369f08(++_0x1c0edc);}(_0x0476,0x77));var _0x6047=function(_0x9d639c,_0x524dbe){_0x9d639c=_0x9d639c-0x0;var _0x1671de=_0x0476[_0x9d639c];return _0x1671de;};'use strict';var UserEvents=require('./user.events');var events=[_0x6047('0x0'),_0x6047('0x1'),_0x6047('0x2')];function createListener(_0xb8fd26,_0x53cf67){return function(_0x910daf){_0x53cf67[_0x6047('0x3')](_0xb8fd26,_0x910daf);};}function removeListener(_0x25ba24,_0xb82a6c){return function(){UserEvents[_0x6047('0x4')](_0x25ba24,_0xb82a6c);};}exports[_0x6047('0x5')]=function(_0x43247e){for(var _0x342763=0x0,_0x5181ab=events[_0x6047('0x6')];_0x342763<_0x5181ab;_0x342763++){var _0x26e48b=events[_0x342763];var _0x5a028b=createListener(_0x6047('0x7')+_0x26e48b,_0x43247e);UserEvents['on'](_0x26e48b,_0x5a028b);}}; \ No newline at end of file +var _0xe8cb=['remove','emit','register','length','user:','./user.events','save'];(function(_0x5d9be2,_0x599f90){var _0x3a1bfa=function(_0x45fb21){while(--_0x45fb21){_0x5d9be2['push'](_0x5d9be2['shift']());}};_0x3a1bfa(++_0x599f90);}(_0xe8cb,0x12b));var _0xbe8c=function(_0x53c6b5,_0x921d39){_0x53c6b5=_0x53c6b5-0x0;var _0xba12d6=_0xe8cb[_0x53c6b5];return _0xba12d6;};'use strict';var UserEvents=require(_0xbe8c('0x0'));var events=[_0xbe8c('0x1'),_0xbe8c('0x2'),'update'];function createListener(_0x32c09a,_0x300265){return function(_0x46dd32){_0x300265[_0xbe8c('0x3')](_0x32c09a,_0x46dd32);};}function removeListener(_0xec494c,_0x6268fe){return function(){UserEvents['removeListener'](_0xec494c,_0x6268fe);};}exports[_0xbe8c('0x4')]=function(_0xdca5d9){for(var _0xadc13d=0x0,_0x53c335=events[_0xbe8c('0x5')];_0xadc13d<_0x53c335;_0xadc13d++){var _0x1137f6=events[_0xadc13d];var _0x18902d=createListener(_0xbe8c('0x6')+_0x1137f6,_0xdca5d9);UserEvents['on'](_0x1137f6,_0x18902d);}}; \ No newline at end of file diff --git a/server/api/userChatQueue/index.js b/server/api/userChatQueue/index.js index 98ba338..5f0b6c5 100644 --- a/server/api/userChatQueue/index.js +++ b/server/api/userChatQueue/index.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0xcb91=['express','Router','../../components/auth/service','../../components/interaction/service','exports','path','connect-timeout'];(function(_0x58a467,_0x4ea04b){var _0x166204=function(_0x2fb423){while(--_0x2fb423){_0x58a467['push'](_0x58a467['shift']());}};_0x166204(++_0x4ea04b);}(_0xcb91,0x1a9));var _0x1cb9=function(_0x274dd7,_0x2e6051){_0x274dd7=_0x274dd7-0x0;var _0x148829=_0xcb91[_0x274dd7];return _0x148829;};'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 _0xa9e0=['../../components/interaction/service','../../config/environment','exports','multer','util','path','Router','../../components/auth/service'];(function(_0x2f0366,_0x10885f){var _0x5e1c27=function(_0x3495c0){while(--_0x3495c0){_0x2f0366['push'](_0x2f0366['shift']());}};_0x5e1c27(++_0x10885f);}(_0xa9e0,0x123));var _0x0a9e=function(_0x3e112d,_0x2bb132){_0x3e112d=_0x3e112d-0x0;var _0x531c31=_0xa9e0[_0x3e112d];return _0x531c31;};'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 ba80d91..5e1d75f 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 _0x4e8d=['sequelize','INTEGER'];(function(_0x5f0225,_0x52631a){var _0x2cef4b=function(_0x5a29c6){while(--_0x5a29c6){_0x5f0225['push'](_0x5f0225['shift']());}};_0x2cef4b(++_0x52631a);}(_0x4e8d,0x156));var _0xd4e8=function(_0x377c14,_0x28a875){_0x377c14=_0x377c14-0x0;var _0x5b131a=_0x4e8d[_0x377c14];return _0x5b131a;};'use strict';var Sequelize=require(_0xd4e8('0x0'));module['exports']={'penalty':{'type':Sequelize[_0xd4e8('0x1')],'defaultValue':0x0}}; \ No newline at end of file +var _0x63af=['exports','INTEGER','sequelize'];(function(_0x26f518,_0x5a6c2d){var _0x3666d=function(_0x38ef7f){while(--_0x38ef7f){_0x26f518['push'](_0x26f518['shift']());}};_0x3666d(++_0x5a6c2d);}(_0x63af,0x68));var _0xf63a=function(_0x470651,_0x2774a5){_0x470651=_0x470651-0x0;var _0x4c3597=_0x63af[_0x470651];return _0x4c3597;};'use strict';var Sequelize=require(_0xf63a('0x0'));module[_0xf63a('0x1')]={'penalty':{'type':Sequelize[_0xf63a('0x2')],'defaultValue':0x0}}; \ No newline at end of file diff --git a/server/api/userChatQueue/userChatQueue.model.js b/server/api/userChatQueue/userChatQueue.model.js index c583f21..68b755b 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 _0xe19b=['path','rimraf','../../config/environment','./userChatQueue.attributes','UserChatQueue','lodash','util','../../config/logger','api','moment','request-promise'];(function(_0x3858e1,_0x6edcc7){var _0x1c35bd=function(_0x5684e1){while(--_0x5684e1){_0x3858e1['push'](_0x3858e1['shift']());}};_0x1c35bd(++_0x6edcc7);}(_0xe19b,0x14f));var _0xbe19=function(_0x1aebbb,_0x57b9b0){_0x1aebbb=_0x1aebbb-0x0;var _0x508369=_0xe19b[_0x1aebbb];return _0x508369;};'use strict';var _=require(_0xbe19('0x0'));var util=require(_0xbe19('0x1'));var logger=require(_0xbe19('0x2'))(_0xbe19('0x3'));var moment=require(_0xbe19('0x4'));var BPromise=require('bluebird');var rp=require(_0xbe19('0x5'));var fs=require('fs');var path=require(_0xbe19('0x6'));var rimraf=require(_0xbe19('0x7'));var config=require(_0xbe19('0x8'));var attributes=require(_0xbe19('0x9'));module['exports']=function(_0x34e49c,_0x319fdc){return _0x34e49c['define'](_0xbe19('0xa'),attributes,{'tableName':'user_has_chat_queues','paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x54b6=['moment','bluebird','path','rimraf','../../config/environment','exports','UserChatQueue','util','api'];(function(_0x34dcfb,_0x583e26){var _0x283d5a=function(_0x22de8b){while(--_0x22de8b){_0x34dcfb['push'](_0x34dcfb['shift']());}};_0x283d5a(++_0x583e26);}(_0x54b6,0x139));var _0x654b=function(_0x1e3c16,_0x372caa){_0x1e3c16=_0x1e3c16-0x0;var _0x47a0c9=_0x54b6[_0x1e3c16];return _0x47a0c9;};'use strict';var _=require('lodash');var util=require(_0x654b('0x0'));var logger=require('../../config/logger')(_0x654b('0x1'));var moment=require(_0x654b('0x2'));var BPromise=require(_0x654b('0x3'));var rp=require('request-promise');var fs=require('fs');var path=require(_0x654b('0x4'));var rimraf=require(_0x654b('0x5'));var config=require(_0x654b('0x6'));var attributes=require('./userChatQueue.attributes');module[_0x654b('0x7')]=function(_0xeb57b0,_0x71bf95){return _0xeb57b0['define'](_0x654b('0x8'),attributes,{'tableName':'user_has_chat_queues','paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/userChatQueue/userChatQueue.rpc.js b/server/api/userChatQueue/userChatQueue.rpc.js index e4779d6..287e7b9 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 _0xd589=['lodash','bluebird','randomstring','../../mysqldb','../../config/utils','rpc','../../config/environment','jayson/promise','client','request','then','info','debug','UserChatQueue,\x20%s,\x20%s,\x20%s','request\x20sent','stringify','error','code','message','UserChatQueue,\x20%s,\x20%s','result','catch'];(function(_0x14cf3f,_0x5df113){var _0x17a1bf=function(_0x2c7b85){while(--_0x2c7b85){_0x14cf3f['push'](_0x14cf3f['shift']());}};_0x17a1bf(++_0x5df113);}(_0xd589,0xb0));var _0x9d58=function(_0x563a10,_0x42b291){_0x563a10=_0x563a10-0x0;var _0x2934a2=_0xd589[_0x563a10];return _0x2934a2;};'use strict';var _=require(_0x9d58('0x0'));var util=require('util');var moment=require('moment');var BPromise=require(_0x9d58('0x1'));var rs=require(_0x9d58('0x2'));var fs=require('fs');var Redis=require('ioredis');var db=require(_0x9d58('0x3'))['db'];var utils=require(_0x9d58('0x4'));var logger=require('../../config/logger')(_0x9d58('0x5'));var config=require(_0x9d58('0x6'));var jayson=require(_0x9d58('0x7'));var client=jayson[_0x9d58('0x8')]['http']({'port':0x232a});function respondWithRpcPromise(_0x225f1e,_0x381fa6,_0x5d4240){return new BPromise(function(_0x38b2df,_0x5aaf73){return client[_0x9d58('0x9')](_0x225f1e,_0x5d4240)[_0x9d58('0xa')](function(_0xd66ce4){logger[_0x9d58('0xb')]('UserChatQueue,\x20%s,\x20%s',_0x381fa6,'request\x20sent');logger[_0x9d58('0xc')](_0x9d58('0xd'),_0x381fa6,_0x9d58('0xe'),JSON[_0x9d58('0xf')](_0xd66ce4));if(_0xd66ce4[_0x9d58('0x10')]){if(_0xd66ce4[_0x9d58('0x10')][_0x9d58('0x11')]===0x1f4){logger['error']('UserChatQueue,\x20%s,\x20%s',_0x381fa6,_0xd66ce4[_0x9d58('0x10')][_0x9d58('0x12')]);return _0x5aaf73(_0xd66ce4[_0x9d58('0x10')]['message']);}logger[_0x9d58('0x10')](_0x9d58('0x13'),_0x381fa6,_0xd66ce4[_0x9d58('0x10')][_0x9d58('0x12')]);return _0x38b2df(_0xd66ce4[_0x9d58('0x10')]['message']);}else{logger[_0x9d58('0xb')](_0x9d58('0x13'),_0x381fa6,_0x9d58('0xe'));_0x38b2df(_0xd66ce4[_0x9d58('0x14')]['message']);}})[_0x9d58('0x15')](function(_0x3bd243){logger[_0x9d58('0x10')](_0x9d58('0x13'),_0x381fa6,_0x3bd243);_0x5aaf73(_0x3bd243);});});} \ No newline at end of file +var _0x40ab=['UserChatQueue,\x20%s,\x20%s','request\x20sent','UserChatQueue,\x20%s,\x20%s,\x20%s','stringify','error','message','result','catch','util','moment','randomstring','../../config/utils','../../config/logger','rpc','../../config/environment','client','http','then','info'];(function(_0x3468ae,_0x5393ff){var _0x5e672c=function(_0x5ab6b7){while(--_0x5ab6b7){_0x3468ae['push'](_0x3468ae['shift']());}};_0x5e672c(++_0x5393ff);}(_0x40ab,0x1d0));var _0xb40a=function(_0x22c09c,_0x764590){_0x22c09c=_0x22c09c-0x0;var _0x397cc0=_0x40ab[_0x22c09c];return _0x397cc0;};'use strict';var _=require('lodash');var util=require(_0xb40a('0x0'));var moment=require(_0xb40a('0x1'));var BPromise=require('bluebird');var rs=require(_0xb40a('0x2'));var fs=require('fs');var Redis=require('ioredis');var db=require('../../mysqldb')['db'];var utils=require(_0xb40a('0x3'));var logger=require(_0xb40a('0x4'))(_0xb40a('0x5'));var config=require(_0xb40a('0x6'));var jayson=require('jayson/promise');var client=jayson[_0xb40a('0x7')][_0xb40a('0x8')]({'port':0x232a});function respondWithRpcPromise(_0xced2e9,_0x3cd989,_0x47335f){return new BPromise(function(_0x107548,_0x1de750){return client['request'](_0xced2e9,_0x47335f)[_0xb40a('0x9')](function(_0x3ccd0e){logger[_0xb40a('0xa')](_0xb40a('0xb'),_0x3cd989,_0xb40a('0xc'));logger['debug'](_0xb40a('0xd'),_0x3cd989,_0xb40a('0xc'),JSON[_0xb40a('0xe')](_0x3ccd0e));if(_0x3ccd0e[_0xb40a('0xf')]){if(_0x3ccd0e['error']['code']===0x1f4){logger[_0xb40a('0xf')]('UserChatQueue,\x20%s,\x20%s',_0x3cd989,_0x3ccd0e[_0xb40a('0xf')]['message']);return _0x1de750(_0x3ccd0e[_0xb40a('0xf')][_0xb40a('0x10')]);}logger[_0xb40a('0xf')](_0xb40a('0xb'),_0x3cd989,_0x3ccd0e[_0xb40a('0xf')][_0xb40a('0x10')]);return _0x107548(_0x3ccd0e['error']['message']);}else{logger[_0xb40a('0xa')](_0xb40a('0xb'),_0x3cd989,'request\x20sent');_0x107548(_0x3ccd0e[_0xb40a('0x11')]['message']);}})[_0xb40a('0x12')](function(_0xf3b4a9){logger[_0xb40a('0xf')](_0xb40a('0xb'),_0x3cd989,_0xf3b4a9);_0x1de750(_0xf3b4a9);});});} \ No newline at end of file diff --git a/server/api/userFaxQueue/index.js b/server/api/userFaxQueue/index.js index abc1e73..856ca77 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 _0x70e0=['../../components/auth/service','../../components/interaction/service','exports','multer','util','path','Router','fs-extra'];(function(_0x55829a,_0x47eaad){var _0x45af29=function(_0x41a80b){while(--_0x41a80b){_0x55829a['push'](_0x55829a['shift']());}};_0x45af29(++_0x47eaad);}(_0x70e0,0x17b));var _0x070e=function(_0x39eede,_0x403333){_0x39eede=_0x39eede-0x0;var _0x278ff5=_0x70e0[_0x39eede];return _0x278ff5;};'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(_0xd07895,_0x1424c9){var _0x22a8e7=function(_0x445b7f){while(--_0x445b7f){_0xd07895['push'](_0xd07895['shift']());}};_0x22a8e7(++_0x1424c9);}(_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/userFaxQueue/userFaxQueue.attributes.js b/server/api/userFaxQueue/userFaxQueue.attributes.js index 7d5a562..9ff7285 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 _0xdcd7=['STRING','sequelize','exports','INTEGER'];(function(_0x14bee8,_0x5a92a9){var _0x5569be=function(_0x270577){while(--_0x270577){_0x14bee8['push'](_0x14bee8['shift']());}};_0x5569be(++_0x5a92a9);}(_0xdcd7,0x129));var _0x7dcd=function(_0x3d7d62,_0x110895){_0x3d7d62=_0x3d7d62-0x0;var _0x50c07c=_0xdcd7[_0x3d7d62];return _0x50c07c;};'use strict';var Sequelize=require(_0x7dcd('0x0'));module[_0x7dcd('0x1')]={'penalty':{'type':Sequelize['INTEGER'],'defaultValue':0x0},'assigned':{'type':Sequelize[_0x7dcd('0x2')],'defaultValue':0x0},'queue':{'type':Sequelize[_0x7dcd('0x3')]}}; \ No newline at end of file +var _0xd32c=['exports','INTEGER','STRING','sequelize'];(function(_0x2e16d0,_0x5a60eb){var _0x3b95cc=function(_0x211d5d){while(--_0x211d5d){_0x2e16d0['push'](_0x2e16d0['shift']());}};_0x3b95cc(++_0x5a60eb);}(_0xd32c,0x1cf));var _0xcd32=function(_0x1850e2,_0x7dab61){_0x1850e2=_0x1850e2-0x0;var _0x1f5de4=_0xd32c[_0x1850e2];return _0x1f5de4;};'use strict';var Sequelize=require(_0xcd32('0x0'));module[_0xcd32('0x1')]={'penalty':{'type':Sequelize[_0xcd32('0x2')],'defaultValue':0x0},'assigned':{'type':Sequelize['INTEGER'],'defaultValue':0x0},'queue':{'type':Sequelize[_0xcd32('0x3')]}}; \ No newline at end of file diff --git a/server/api/userFaxQueue/userFaxQueue.model.js b/server/api/userFaxQueue/userFaxQueue.model.js index c0e8a29..ea4055c 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 _0xc23c=['./userFaxQueue.attributes','define','UserFaxQueue','util','../../config/logger','moment','bluebird','request-promise','path','rimraf','../../config/environment'];(function(_0x19950b,_0x53d0d7){var _0x3c6b41=function(_0x3924ad){while(--_0x3924ad){_0x19950b['push'](_0x19950b['shift']());}};_0x3c6b41(++_0x53d0d7);}(_0xc23c,0x1dc));var _0xcc23=function(_0x10bbd1,_0x4a57fe){_0x10bbd1=_0x10bbd1-0x0;var _0x200332=_0xc23c[_0x10bbd1];return _0x200332;};'use strict';var _=require('lodash');var util=require(_0xcc23('0x0'));var logger=require(_0xcc23('0x1'))('api');var moment=require(_0xcc23('0x2'));var BPromise=require(_0xcc23('0x3'));var rp=require(_0xcc23('0x4'));var fs=require('fs');var path=require(_0xcc23('0x5'));var rimraf=require(_0xcc23('0x6'));var config=require(_0xcc23('0x7'));var attributes=require(_0xcc23('0x8'));module['exports']=function(_0x5a3a00,_0x49af60){return _0x5a3a00[_0xcc23('0x9')](_0xcc23('0xa'),attributes,{'tableName':'user_has_fax_queues','paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x4d80=['bluebird','request-promise','path','rimraf','./userFaxQueue.attributes','exports','define','UserFaxQueue','user_has_fax_queues','lodash','util','../../config/logger','api'];(function(_0x26eee0,_0x3b555){var _0x31bcbe=function(_0x45d12a){while(--_0x45d12a){_0x26eee0['push'](_0x26eee0['shift']());}};_0x31bcbe(++_0x3b555);}(_0x4d80,0x168));var _0x04d8=function(_0x1d1779,_0x284147){_0x1d1779=_0x1d1779-0x0;var _0x2377e9=_0x4d80[_0x1d1779];return _0x2377e9;};'use strict';var _=require(_0x04d8('0x0'));var util=require(_0x04d8('0x1'));var logger=require(_0x04d8('0x2'))(_0x04d8('0x3'));var moment=require('moment');var BPromise=require(_0x04d8('0x4'));var rp=require(_0x04d8('0x5'));var fs=require('fs');var path=require(_0x04d8('0x6'));var rimraf=require(_0x04d8('0x7'));var config=require('../../config/environment');var attributes=require(_0x04d8('0x8'));module[_0x04d8('0x9')]=function(_0x46848e,_0x13d022){return _0x46848e[_0x04d8('0xa')](_0x04d8('0xb'),attributes,{'tableName':_0x04d8('0xc'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/userFaxQueue/userFaxQueue.rpc.js b/server/api/userFaxQueue/userFaxQueue.rpc.js index 0cec720..6716fa6 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 _0x1a02=['client','info','UserFaxQueue,\x20%s,\x20%s','request\x20sent','error','message','result','catch','lodash','util','bluebird','randomstring','../../config/utils','rpc','jayson/promise'];(function(_0x19e369,_0x348000){var _0x30230e=function(_0x208ca1){while(--_0x208ca1){_0x19e369['push'](_0x19e369['shift']());}};_0x30230e(++_0x348000);}(_0x1a02,0x1bb));var _0x21a0=function(_0x5678e8,_0x1deff6){_0x5678e8=_0x5678e8-0x0;var _0x3ad338=_0x1a02[_0x5678e8];return _0x3ad338;};'use strict';var _=require(_0x21a0('0x0'));var util=require(_0x21a0('0x1'));var moment=require('moment');var BPromise=require(_0x21a0('0x2'));var rs=require(_0x21a0('0x3'));var fs=require('fs');var Redis=require('ioredis');var db=require('../../mysqldb')['db'];var utils=require(_0x21a0('0x4'));var logger=require('../../config/logger')(_0x21a0('0x5'));var config=require('../../config/environment');var jayson=require(_0x21a0('0x6'));var client=jayson[_0x21a0('0x7')]['http']({'port':0x232a});function respondWithRpcPromise(_0x39350b,_0x2564ce,_0x38caa9){return new BPromise(function(_0x5bc8c3,_0x517f9e){return client['request'](_0x39350b,_0x38caa9)['then'](function(_0x2643e7){logger[_0x21a0('0x8')](_0x21a0('0x9'),_0x2564ce,_0x21a0('0xa'));logger['debug']('UserFaxQueue,\x20%s,\x20%s,\x20%s',_0x2564ce,_0x21a0('0xa'),JSON['stringify'](_0x2643e7));if(_0x2643e7[_0x21a0('0xb')]){if(_0x2643e7['error']['code']===0x1f4){logger[_0x21a0('0xb')](_0x21a0('0x9'),_0x2564ce,_0x2643e7[_0x21a0('0xb')][_0x21a0('0xc')]);return _0x517f9e(_0x2643e7[_0x21a0('0xb')][_0x21a0('0xc')]);}logger[_0x21a0('0xb')]('UserFaxQueue,\x20%s,\x20%s',_0x2564ce,_0x2643e7[_0x21a0('0xb')][_0x21a0('0xc')]);return _0x5bc8c3(_0x2643e7[_0x21a0('0xb')]['message']);}else{logger[_0x21a0('0x8')](_0x21a0('0x9'),_0x2564ce,'request\x20sent');_0x5bc8c3(_0x2643e7[_0x21a0('0xd')][_0x21a0('0xc')]);}})[_0x21a0('0xe')](function(_0x24d21b){logger[_0x21a0('0xb')]('UserFaxQueue,\x20%s,\x20%s',_0x2564ce,_0x24d21b);_0x517f9e(_0x24d21b);});});} \ No newline at end of file +var _0x964a=['randomstring','ioredis','rpc','jayson/promise','client','http','request','then','info','UserFaxQueue,\x20%s,\x20%s','request\x20sent','UserFaxQueue,\x20%s,\x20%s,\x20%s','stringify','error','code','message','result','lodash','util'];(function(_0x616fb8,_0x177e11){var _0x739e20=function(_0xfe27e9){while(--_0xfe27e9){_0x616fb8['push'](_0x616fb8['shift']());}};_0x739e20(++_0x177e11);}(_0x964a,0x154));var _0xa964=function(_0xa70c8a,_0x5f1334){_0xa70c8a=_0xa70c8a-0x0;var _0x3ad556=_0x964a[_0xa70c8a];return _0x3ad556;};'use strict';var _=require(_0xa964('0x0'));var util=require(_0xa964('0x1'));var moment=require('moment');var BPromise=require('bluebird');var rs=require(_0xa964('0x2'));var fs=require('fs');var Redis=require(_0xa964('0x3'));var db=require('../../mysqldb')['db'];var utils=require('../../config/utils');var logger=require('../../config/logger')(_0xa964('0x4'));var config=require('../../config/environment');var jayson=require(_0xa964('0x5'));var client=jayson[_0xa964('0x6')][_0xa964('0x7')]({'port':0x232a});function respondWithRpcPromise(_0x41644a,_0x35b728,_0x46533c){return new BPromise(function(_0x2875a8,_0x3945f3){return client[_0xa964('0x8')](_0x41644a,_0x46533c)[_0xa964('0x9')](function(_0xd57075){logger[_0xa964('0xa')](_0xa964('0xb'),_0x35b728,_0xa964('0xc'));logger['debug'](_0xa964('0xd'),_0x35b728,_0xa964('0xc'),JSON[_0xa964('0xe')](_0xd57075));if(_0xd57075[_0xa964('0xf')]){if(_0xd57075['error'][_0xa964('0x10')]===0x1f4){logger[_0xa964('0xf')](_0xa964('0xb'),_0x35b728,_0xd57075[_0xa964('0xf')][_0xa964('0x11')]);return _0x3945f3(_0xd57075['error'][_0xa964('0x11')]);}logger['error'](_0xa964('0xb'),_0x35b728,_0xd57075[_0xa964('0xf')][_0xa964('0x11')]);return _0x2875a8(_0xd57075[_0xa964('0xf')][_0xa964('0x11')]);}else{logger[_0xa964('0xa')]('UserFaxQueue,\x20%s,\x20%s',_0x35b728,_0xa964('0xc'));_0x2875a8(_0xd57075[_0xa964('0x12')][_0xa964('0x11')]);}})['catch'](function(_0x4cdc4c){logger[_0xa964('0xf')](_0xa964('0xb'),_0x35b728,_0x4cdc4c);_0x3945f3(_0x4cdc4c);});});} \ No newline at end of file diff --git a/server/api/userMailQueue/index.js b/server/api/userMailQueue/index.js index 149e61b..9917002 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(_0x1f0b55,_0x20360a){var _0x49df7e=function(_0x27cde8){while(--_0x27cde8){_0x1f0b55['push'](_0x1f0b55['shift']());}};_0x49df7e(++_0x20360a);}(_0xa9e0,0x123));var _0x0a9e=function(_0x2b4411,_0x2625ed){_0x2b4411=_0x2b4411-0x0;var _0x8e41ef=_0xa9e0[_0x2b4411];return _0x8e41ef;};'use strict';var multer=require(_0x0a9e('0x0'));var util=require(_0x0a9e('0x1'));var path=require(_0x0a9e('0x2'));var timeout=require('connect-timeout');var express=require('express');var router=express[_0x0a9e('0x3')]();var fs_extra=require('fs-extra');var auth=require(_0x0a9e('0x4'));var interaction=require(_0x0a9e('0x5'));var config=require(_0x0a9e('0x6'));module[_0x0a9e('0x7')]=router; \ No newline at end of file +var _0xe706=['../../components/interaction/service','../../config/environment','exports','multer','util','path','express','Router','fs-extra','../../components/auth/service'];(function(_0x58715c,_0x521ae5){var _0x580e4d=function(_0x81ecb5){while(--_0x81ecb5){_0x58715c['push'](_0x58715c['shift']());}};_0x580e4d(++_0x521ae5);}(_0xe706,0xa3));var _0x6e70=function(_0x483afe,_0x4f6d9c){_0x483afe=_0x483afe-0x0;var _0x2303e5=_0xe706[_0x483afe];return _0x2303e5;};'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/userMailQueue/userMailQueue.attributes.js b/server/api/userMailQueue/userMailQueue.attributes.js index c688918..c9fdf49 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 _0xc506=['INTEGER','sequelize','exports'];(function(_0x5ce1f4,_0x3d4d52){var _0x3cf822=function(_0x21108f){while(--_0x21108f){_0x5ce1f4['push'](_0x5ce1f4['shift']());}};_0x3cf822(++_0x3d4d52);}(_0xc506,0xc1));var _0x6c50=function(_0x58e32c,_0x309781){_0x58e32c=_0x58e32c-0x0;var _0x481e60=_0xc506[_0x58e32c];return _0x481e60;};'use strict';var Sequelize=require(_0x6c50('0x0'));module[_0x6c50('0x1')]={'penalty':{'type':Sequelize[_0x6c50('0x2')],'defaultValue':0x0}}; \ No newline at end of file +var _0x6e83=['INTEGER','exports'];(function(_0xe6aead,_0x229019){var _0x176ccf=function(_0x1a511f){while(--_0x1a511f){_0xe6aead['push'](_0xe6aead['shift']());}};_0x176ccf(++_0x229019);}(_0x6e83,0x1ef));var _0x36e8=function(_0x1a48f2,_0x5d2109){_0x1a48f2=_0x1a48f2-0x0;var _0x2b46c6=_0x6e83[_0x1a48f2];return _0x2b46c6;};'use strict';var Sequelize=require('sequelize');module[_0x36e8('0x0')]={'penalty':{'type':Sequelize[_0x36e8('0x1')],'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 919c1c1..1e3906c 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 _0xce08=['path','rimraf','../../config/environment','./userMailQueue.attributes','exports','define','UserMailQueue','user_has_mail_queues','lodash','util','api','moment','bluebird'];(function(_0x20589d,_0x55d5bf){var _0x422de9=function(_0x44cbbb){while(--_0x44cbbb){_0x20589d['push'](_0x20589d['shift']());}};_0x422de9(++_0x55d5bf);}(_0xce08,0x10c));var _0x8ce0=function(_0x4fabcc,_0x12f3f5){_0x4fabcc=_0x4fabcc-0x0;var _0x4ee1a6=_0xce08[_0x4fabcc];return _0x4ee1a6;};'use strict';var _=require(_0x8ce0('0x0'));var util=require(_0x8ce0('0x1'));var logger=require('../../config/logger')(_0x8ce0('0x2'));var moment=require(_0x8ce0('0x3'));var BPromise=require(_0x8ce0('0x4'));var rp=require('request-promise');var fs=require('fs');var path=require(_0x8ce0('0x5'));var rimraf=require(_0x8ce0('0x6'));var config=require(_0x8ce0('0x7'));var attributes=require(_0x8ce0('0x8'));module[_0x8ce0('0x9')]=function(_0x1781b1,_0x41f922){return _0x1781b1[_0x8ce0('0xa')](_0x8ce0('0xb'),attributes,{'tableName':_0x8ce0('0xc'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0xfe0b=['define','user_has_mail_queues','util','api','moment','bluebird','request-promise','path','rimraf','./userMailQueue.attributes','exports'];(function(_0x37ac95,_0x2d39e4){var _0x4001f6=function(_0x226667){while(--_0x226667){_0x37ac95['push'](_0x37ac95['shift']());}};_0x4001f6(++_0x2d39e4);}(_0xfe0b,0x1a4));var _0xbfe0=function(_0x19e35c,_0x29cd1e){_0x19e35c=_0x19e35c-0x0;var _0x3e1fe8=_0xfe0b[_0x19e35c];return _0x3e1fe8;};'use strict';var _=require('lodash');var util=require(_0xbfe0('0x0'));var logger=require('../../config/logger')(_0xbfe0('0x1'));var moment=require(_0xbfe0('0x2'));var BPromise=require(_0xbfe0('0x3'));var rp=require(_0xbfe0('0x4'));var fs=require('fs');var path=require(_0xbfe0('0x5'));var rimraf=require(_0xbfe0('0x6'));var config=require('../../config/environment');var attributes=require(_0xbfe0('0x7'));module[_0xbfe0('0x8')]=function(_0xed114b,_0x58a04c){return _0xed114b[_0xbfe0('0x9')]('UserMailQueue',attributes,{'tableName':_0xbfe0('0xa'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/userMailQueue/userMailQueue.rpc.js b/server/api/userMailQueue/userMailQueue.rpc.js index bc19fcf..b64e539 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 _0x7217=['stringify','error','code','message','result','catch','lodash','moment','bluebird','randomstring','ioredis','../../mysqldb','rpc','../../config/environment','jayson/promise','client','http','request','then','info','UserMailQueue,\x20%s,\x20%s','debug','UserMailQueue,\x20%s,\x20%s,\x20%s','request\x20sent'];(function(_0x3de8a4,_0x289a5c){var _0x4635cf=function(_0x2bddb8){while(--_0x2bddb8){_0x3de8a4['push'](_0x3de8a4['shift']());}};_0x4635cf(++_0x289a5c);}(_0x7217,0x19e));var _0x7721=function(_0x220dbb,_0x99328d){_0x220dbb=_0x220dbb-0x0;var _0x2b77de=_0x7217[_0x220dbb];return _0x2b77de;};'use strict';var _=require(_0x7721('0x0'));var util=require('util');var moment=require(_0x7721('0x1'));var BPromise=require(_0x7721('0x2'));var rs=require(_0x7721('0x3'));var fs=require('fs');var Redis=require(_0x7721('0x4'));var db=require(_0x7721('0x5'))['db'];var utils=require('../../config/utils');var logger=require('../../config/logger')(_0x7721('0x6'));var config=require(_0x7721('0x7'));var jayson=require(_0x7721('0x8'));var client=jayson[_0x7721('0x9')][_0x7721('0xa')]({'port':0x232a});function respondWithRpcPromise(_0xf7ff37,_0x18ab6b,_0x21f680){return new BPromise(function(_0x225610,_0x2f99ed){return client[_0x7721('0xb')](_0xf7ff37,_0x21f680)[_0x7721('0xc')](function(_0xfa8835){logger[_0x7721('0xd')](_0x7721('0xe'),_0x18ab6b,'request\x20sent');logger[_0x7721('0xf')](_0x7721('0x10'),_0x18ab6b,_0x7721('0x11'),JSON[_0x7721('0x12')](_0xfa8835));if(_0xfa8835[_0x7721('0x13')]){if(_0xfa8835[_0x7721('0x13')][_0x7721('0x14')]===0x1f4){logger[_0x7721('0x13')]('UserMailQueue,\x20%s,\x20%s',_0x18ab6b,_0xfa8835[_0x7721('0x13')][_0x7721('0x15')]);return _0x2f99ed(_0xfa8835['error'][_0x7721('0x15')]);}logger[_0x7721('0x13')](_0x7721('0xe'),_0x18ab6b,_0xfa8835[_0x7721('0x13')]['message']);return _0x225610(_0xfa8835[_0x7721('0x13')][_0x7721('0x15')]);}else{logger['info']('UserMailQueue,\x20%s,\x20%s',_0x18ab6b,'request\x20sent');_0x225610(_0xfa8835[_0x7721('0x16')][_0x7721('0x15')]);}})[_0x7721('0x17')](function(_0x32550d){logger['error'](_0x7721('0xe'),_0x18ab6b,_0x32550d);_0x2f99ed(_0x32550d);});});} \ No newline at end of file +var _0x5fc3=['../../config/environment','jayson/promise','request','then','info','request\x20sent','debug','stringify','error','code','message','UserMailQueue,\x20%s,\x20%s','result','catch','lodash','util','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','rpc'];(function(_0x2a3fe6,_0x41b527){var _0x175c3b=function(_0x388b1e){while(--_0x388b1e){_0x2a3fe6['push'](_0x2a3fe6['shift']());}};_0x175c3b(++_0x41b527);}(_0x5fc3,0xa8));var _0x35fc=function(_0x18f152,_0x41585a){_0x18f152=_0x18f152-0x0;var _0xa10b34=_0x5fc3[_0x18f152];return _0xa10b34;};'use strict';var _=require(_0x35fc('0x0'));var util=require(_0x35fc('0x1'));var moment=require('moment');var BPromise=require(_0x35fc('0x2'));var rs=require(_0x35fc('0x3'));var fs=require('fs');var Redis=require(_0x35fc('0x4'));var db=require(_0x35fc('0x5'))['db'];var utils=require(_0x35fc('0x6'));var logger=require('../../config/logger')(_0x35fc('0x7'));var config=require(_0x35fc('0x8'));var jayson=require(_0x35fc('0x9'));var client=jayson['client']['http']({'port':0x232a});function respondWithRpcPromise(_0x19a0d1,_0x508b32,_0x16e153){return new BPromise(function(_0x27524f,_0xc72d93){return client[_0x35fc('0xa')](_0x19a0d1,_0x16e153)[_0x35fc('0xb')](function(_0xf9d3a6){logger[_0x35fc('0xc')]('UserMailQueue,\x20%s,\x20%s',_0x508b32,_0x35fc('0xd'));logger[_0x35fc('0xe')]('UserMailQueue,\x20%s,\x20%s,\x20%s',_0x508b32,_0x35fc('0xd'),JSON[_0x35fc('0xf')](_0xf9d3a6));if(_0xf9d3a6['error']){if(_0xf9d3a6[_0x35fc('0x10')][_0x35fc('0x11')]===0x1f4){logger['error']('UserMailQueue,\x20%s,\x20%s',_0x508b32,_0xf9d3a6[_0x35fc('0x10')]['message']);return _0xc72d93(_0xf9d3a6[_0x35fc('0x10')][_0x35fc('0x12')]);}logger[_0x35fc('0x10')](_0x35fc('0x13'),_0x508b32,_0xf9d3a6[_0x35fc('0x10')]['message']);return _0x27524f(_0xf9d3a6['error']['message']);}else{logger['info'](_0x35fc('0x13'),_0x508b32,_0x35fc('0xd'));_0x27524f(_0xf9d3a6[_0x35fc('0x14')][_0x35fc('0x12')]);}})[_0x35fc('0x15')](function(_0x1121fa){logger['error'](_0x35fc('0x13'),_0x508b32,_0x1121fa);_0xc72d93(_0x1121fa);});});} \ No newline at end of file diff --git a/server/api/userNotification/index.js b/server/api/userNotification/index.js index 57487b3..257b3bb 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 _0x5368=['exports','multer','util','path','connect-timeout','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','./userNotification.controller','post','isAuthenticated','sendUserNotification'];(function(_0x24f31b,_0x44b8f3){var _0x488401=function(_0x204caf){while(--_0x204caf){_0x24f31b['push'](_0x24f31b['shift']());}};_0x488401(++_0x44b8f3);}(_0x5368,0xf8));var _0x8536=function(_0x3dfd0e,_0x4b1372){_0x3dfd0e=_0x3dfd0e-0x0;var _0x35469b=_0x5368[_0x3dfd0e];return _0x35469b;};'use strict';var multer=require(_0x8536('0x0'));var util=require(_0x8536('0x1'));var path=require(_0x8536('0x2'));var timeout=require(_0x8536('0x3'));var express=require('express');var router=express['Router']();var fs_extra=require(_0x8536('0x4'));var auth=require(_0x8536('0x5'));var interaction=require(_0x8536('0x6'));var config=require(_0x8536('0x7'));var controller=require(_0x8536('0x8'));router[_0x8536('0x9')]('/',auth[_0x8536('0xa')](),controller[_0x8536('0xb')]);module[_0x8536('0xc')]=router; \ No newline at end of file +var _0x28ef=['connect-timeout','express','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','post','isAuthenticated','sendUserNotification','exports','util','path'];(function(_0x5dc5d6,_0x180df9){var _0x44e6ee=function(_0x66f260){while(--_0x66f260){_0x5dc5d6['push'](_0x5dc5d6['shift']());}};_0x44e6ee(++_0x180df9);}(_0x28ef,0x1c6));var _0xf28e=function(_0x106d47,_0x12d0e6){_0x106d47=_0x106d47-0x0;var _0x25d4d2=_0x28ef[_0x106d47];return _0x25d4d2;};'use strict';var multer=require('multer');var util=require(_0xf28e('0x0'));var path=require(_0xf28e('0x1'));var timeout=require(_0xf28e('0x2'));var express=require(_0xf28e('0x3'));var router=express['Router']();var fs_extra=require(_0xf28e('0x4'));var auth=require(_0xf28e('0x5'));var interaction=require(_0xf28e('0x6'));var config=require(_0xf28e('0x7'));var controller=require('./userNotification.controller');router[_0xf28e('0x8')]('/',auth[_0xf28e('0x9')](),controller[_0xf28e('0xa')]);module[_0xf28e('0xb')]=router; \ No newline at end of file diff --git a/server/api/userNotification/userNotification.attributes.js b/server/api/userNotification/userNotification.attributes.js index f6ae1c9..82a7121 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 _0x907c=['sequelize','exports','TEXT','STRING','BOOLEAN'];(function(_0x50a0c2,_0x4befab){var _0x5ebadd=function(_0x3a3342){while(--_0x3a3342){_0x50a0c2['push'](_0x50a0c2['shift']());}};_0x5ebadd(++_0x4befab);}(_0x907c,0xff));var _0xc907=function(_0x404538,_0x2fe051){_0x404538=_0x404538-0x0;var _0x1b8690=_0x907c[_0x404538];return _0x1b8690;};'use strict';var Sequelize=require(_0xc907('0x0'));module[_0xc907('0x1')]={'body':{'type':Sequelize[_0xc907('0x2')]},'senderName':{'type':Sequelize[_0xc907('0x3')]},'recipientsId':{'type':Sequelize[_0xc907('0x2')]},'recipientsDescription':{'type':Sequelize[_0xc907('0x3')]},'beep':{'type':Sequelize[_0xc907('0x4')]}}; \ No newline at end of file +var _0xbf0d=['TEXT','STRING','BOOLEAN','sequelize','exports'];(function(_0x3dd15e,_0x1f0015){var _0x231fd0=function(_0x4f680a){while(--_0x4f680a){_0x3dd15e['push'](_0x3dd15e['shift']());}};_0x231fd0(++_0x1f0015);}(_0xbf0d,0x161));var _0xdbf0=function(_0x3236e8,_0x1e5fd2){_0x3236e8=_0x3236e8-0x0;var _0x543a2b=_0xbf0d[_0x3236e8];return _0x543a2b;};'use strict';var Sequelize=require(_0xdbf0('0x0'));module[_0xdbf0('0x1')]={'body':{'type':Sequelize[_0xdbf0('0x2')]},'senderName':{'type':Sequelize['STRING']},'recipientsId':{'type':Sequelize[_0xdbf0('0x2')]},'recipientsDescription':{'type':Sequelize[_0xdbf0('0x3')]},'beep':{'type':Sequelize[_0xdbf0('0x4')]}}; \ No newline at end of file diff --git a/server/api/userNotification/userNotification.controller.js b/server/api/userNotification/userNotification.controller.js index 9a29fbe..c936f31 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 _0x1ab2=['socket.io-emitter','./userNotification.socket','register','sendStatus','end','json','offset','undefined','limit','count','status','set','Content-Range','apply','reject','save','update','then','error','stack','name','send','sendUserNotification','body','hasOwnProperty','text','TemplateId','Sequelize','ValidationError','Must\x20specify\x20at\x20least\x20one\x20argument\x20for\x20\x27text\x27\x20or\x20\x27TemplateId\x27','view','Missing\x20\x27view\x27\x20parameter','recipients','parse','chatqueue','faxqueue','mailqueue','smsqueue','voicequeue','whatsappqueue','team','some','includes','model','toLowerCase','Invalid\x20model\x20in\x20\x27recipients\x27\x20object','senderName','user','isEmpty','beep','SenderId','recipientsId','sortBy','join','sequelize','UserNotification','create','recipient','userNotification:send','catch','Template','findOne','html','Invalid\x20\x27TemplateId\x27\x20parameter','render','forEach','User','union','queue','replace','Queue','ids','push','flatten','getAgents','map','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','moment','bluebird','util','path','sox','to-csv','ejs','fs-extra','lodash','crypto','jsforce','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','api','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','redis','defaults','localhost'];(function(_0x332c1b,_0x28d711){var _0x21b49b=function(_0x3f00fd){while(--_0x3f00fd){_0x332c1b['push'](_0x332c1b['shift']());}};_0x21b49b(++_0x28d711);}(_0x1ab2,0xb6));var _0x21ab=function(_0x293657,_0xa77e39){_0x293657=_0x293657-0x0;var _0x171211=_0x1ab2[_0x293657];return _0x171211;};'use strict';var emlformat=require(_0x21ab('0x0'));var rimraf=require(_0x21ab('0x1'));var zipdir=require(_0x21ab('0x2'));var jsonpatch=require(_0x21ab('0x3'));var rp=require(_0x21ab('0x4'));var moment=require(_0x21ab('0x5'));var BPromise=require(_0x21ab('0x6'));var Mustache=require('mustache');var util=require(_0x21ab('0x7'));var path=require(_0x21ab('0x8'));var sox=require(_0x21ab('0x9'));var csv=require(_0x21ab('0xa'));var ejs=require(_0x21ab('0xb'));var fs=require('fs');var fs_extra=require(_0x21ab('0xc'));var _=require(_0x21ab('0xd'));var squel=require('squel');var crypto=require(_0x21ab('0xe'));var jsforce=require(_0x21ab('0xf'));var deskjs=require('desk.js');var toCsv=require(_0x21ab('0xa'));var querystring=require(_0x21ab('0x10'));var Papa=require(_0x21ab('0x11'));var Redis=require(_0x21ab('0x12'));var authService=require(_0x21ab('0x13'));var qs=require(_0x21ab('0x14'));var as=require(_0x21ab('0x15'));var hardwareService=require('../../config/license/hardware');var logger=require('../../config/logger')(_0x21ab('0x16'));var utils=require(_0x21ab('0x17'));var config=require(_0x21ab('0x18'));var licenseUtil=require(_0x21ab('0x19'));var db=require(_0x21ab('0x1a'))['db'];config[_0x21ab('0x1b')]=_[_0x21ab('0x1c')](config[_0x21ab('0x1b')],{'host':_0x21ab('0x1d'),'port':0x18eb});var socket=require(_0x21ab('0x1e'))(new Redis(config['redis']));require(_0x21ab('0x1f'))[_0x21ab('0x20')](socket);function respondWithStatusCode(_0x49653e,_0xfdc49c){_0xfdc49c=_0xfdc49c||0xcc;return function(_0x153277){if(_0x153277){return _0x49653e[_0x21ab('0x21')](_0xfdc49c);}return _0x49653e['status'](_0xfdc49c)[_0x21ab('0x22')]();};}function respondWithResult(_0x284dc5,_0x130d96){_0x130d96=_0x130d96||0xc8;return function(_0x34ea45){if(_0x34ea45){return _0x284dc5['status'](_0x130d96)[_0x21ab('0x23')](_0x34ea45);}};}function respondWithFilteredResult(_0x39e00f,_0x1a97ec){return function(_0x182f4e){if(_0x182f4e){var _0x5c4467=typeof _0x1a97ec[_0x21ab('0x24')]===_0x21ab('0x25')&&typeof _0x1a97ec[_0x21ab('0x26')]===_0x21ab('0x25');var _0x249c3e=_0x182f4e[_0x21ab('0x27')];var _0xb7d798=_0x5c4467?0x0:_0x1a97ec[_0x21ab('0x24')];var _0x52c9e7=_0x5c4467?_0x182f4e[_0x21ab('0x27')]:_0x1a97ec[_0x21ab('0x24')]+_0x1a97ec[_0x21ab('0x26')];var _0x30a373;if(_0x52c9e7>=_0x249c3e){_0x52c9e7=_0x249c3e;_0x30a373=0xc8;}else{_0x30a373=0xce;}_0x39e00f[_0x21ab('0x28')](_0x30a373);return _0x39e00f[_0x21ab('0x29')](_0x21ab('0x2a'),_0xb7d798+'-'+_0x52c9e7+'/'+_0x249c3e)[_0x21ab('0x23')](_0x182f4e);}return null;};}function patchUpdates(_0x5f2f2c){return function(_0x3fecb4){try{jsonpatch[_0x21ab('0x2b')](_0x3fecb4,_0x5f2f2c,!![]);}catch(_0x474ff2){return BPromise[_0x21ab('0x2c')](_0x474ff2);}return _0x3fecb4[_0x21ab('0x2d')]();};}function saveUpdates(_0x1cb25e,_0x2decd7){return function(_0x4fb8d9){if(_0x4fb8d9){return _0x4fb8d9[_0x21ab('0x2e')](_0x1cb25e)['then'](function(_0x3cd740){return _0x3cd740;});}return null;};}function removeEntity(_0x1113f2,_0x502195){return function(_0x52ffc0){if(_0x52ffc0){return _0x52ffc0['destroy']()[_0x21ab('0x2f')](function(){_0x1113f2[_0x21ab('0x28')](0xcc)[_0x21ab('0x22')]();});}};}function handleEntityNotFound(_0xe986f4,_0x2dd25d){return function(_0x59f85e){if(!_0x59f85e){_0xe986f4[_0x21ab('0x21')](0x194);}return _0x59f85e;};}function handleError(_0x76ca73,_0x487339){_0x487339=_0x487339||0x1f4;return function(_0xb5caba){logger[_0x21ab('0x30')](_0xb5caba[_0x21ab('0x31')]);if(_0xb5caba[_0x21ab('0x32')]){delete _0xb5caba['name'];}_0x76ca73[_0x21ab('0x28')](_0x487339)[_0x21ab('0x33')](_0xb5caba);};}exports[_0x21ab('0x34')]=function(_0x1a243b,_0x3efa2c,_0x50aa96){if(!_0x1a243b[_0x21ab('0x35')][_0x21ab('0x36')](_0x21ab('0x37'))&&!_0x1a243b[_0x21ab('0x35')][_0x21ab('0x36')](_0x21ab('0x38'))){throw new db[(_0x21ab('0x39'))][(_0x21ab('0x3a'))](_0x21ab('0x3b'));}else{if(_0x1a243b[_0x21ab('0x35')]['hasOwnProperty'](_0x21ab('0x38'))&&!_0x1a243b[_0x21ab('0x35')][_0x21ab('0x36')](_0x21ab('0x3c'))){throw new db['Sequelize'][(_0x21ab('0x3a'))](_0x21ab('0x3d'));}if(!_0x1a243b[_0x21ab('0x35')][_0x21ab('0x36')](_0x21ab('0x3e'))){throw new db[(_0x21ab('0x39'))][(_0x21ab('0x3a'))]('Missing\x20\x27recipients\x27\x20parameter');}else{try{var _0x4a97e4=JSON[_0x21ab('0x3f')](_0x1a243b['body'][_0x21ab('0x3e')]);}catch(_0x566d59){logger[_0x21ab('0x30')](_0x566d59);throw new db[(_0x21ab('0x39'))][(_0x21ab('0x3a'))]('Invalid\x20\x27recipients\x27\x20object');}var _0x2d666b=[_0x21ab('0x40'),_0x21ab('0x41'),_0x21ab('0x42'),'openchannelqueue',_0x21ab('0x43'),_0x21ab('0x44'),_0x21ab('0x45'),_0x21ab('0x46'),'user'];if(_[_0x21ab('0x47')](_0x4a97e4,function(_0x59f8fa){return!_[_0x21ab('0x48')](_0x2d666b,_0x59f8fa[_0x21ab('0x49')][_0x21ab('0x4a')]());})){throw new db[(_0x21ab('0x39'))][(_0x21ab('0x3a'))](_0x21ab('0x4b'));}}}var _0x4a8d20={};_0x4a8d20['senderName']=_0x1a243b[_0x21ab('0x35')][_0x21ab('0x36')](_0x21ab('0x4c'))?_0x1a243b['body']['senderName']:_0x1a243b[_0x21ab('0x4d')]['fullname'];_0x4a8d20['recipientsDescription']=_[_0x21ab('0x4e')](_0x1a243b[_0x21ab('0x35')]['recipientsDescription'])?null:_0x1a243b[_0x21ab('0x35')]['recipientsDescription'];_0x4a8d20[_0x21ab('0x4f')]=_0x1a243b[_0x21ab('0x35')][_0x21ab('0x4f')]||![];_0x4a8d20[_0x21ab('0x50')]=_0x1a243b['user']['id'];return getContent(_0x1a243b['body'])['then'](function(_0x14c9d2){_0x4a8d20[_0x21ab('0x35')]=_0x14c9d2;return getRecipients(_0x4a97e4);})['then'](function(_0x3a3aab){_0x4a8d20[_0x21ab('0x51')]=_[_0x21ab('0x52')](_0x3a3aab)[_0x21ab('0x53')](',');return db[_0x21ab('0x54')]['transaction'](function(_0x293e38){return db[_0x21ab('0x55')][_0x21ab('0x56')](_0x4a8d20,{'raw':!![],'transaction':_0x293e38})['then'](function(_0x2212a2){var _0x3857aa={'sender':_0x4a8d20[_0x21ab('0x4c')],'description':_0x4a8d20['recipientsDescription'],'content':_0x4a8d20[_0x21ab('0x35')],'beep':_0x4a8d20[_0x21ab('0x4f')]};_0x3a3aab['forEach'](function(_0x2a5326){_0x3857aa[_0x21ab('0x57')]=_0x2a5326;socket['emit'](_0x21ab('0x58'),_0x3857aa);});return _0x2212a2;});});})[_0x21ab('0x2f')](respondWithResult(_0x3efa2c,0xc9))[_0x21ab('0x59')](handleError(_0x3efa2c,null));};function getContent(_0x500e40){return new BPromise(function(_0x1b5df7,_0x457944){if(_0x500e40['text']){_0x1b5df7(_0x500e40[_0x21ab('0x37')]);return;}return db[_0x21ab('0x5a')][_0x21ab('0x5b')]({'attributes':[_0x21ab('0x5c')],'where':{'id':_0x500e40[_0x21ab('0x38')]},'raw':!![]})[_0x21ab('0x2f')](function(_0x2682ef){if(!_0x2682ef)throw new db[(_0x21ab('0x39'))]['ValidationError'](_0x21ab('0x5d'));var _0x574eb6=Mustache[_0x21ab('0x5e')](_0x2682ef['html'],_0x500e40[_0x21ab('0x3c')]);_0x1b5df7(_0x574eb6);})[_0x21ab('0x59')](function(_0x4dfcec){_0x457944(_0x4dfcec);});});}function getRecipients(_0x2c0a85){return new BPromise(function(_0x285cd0,_0x5e7a67){var _0x23bfb0=[];var _0x34db69=[];_0x2c0a85[_0x21ab('0x5f')](function(_0x25ec70){var _0x39150e=_['startCase'](_0x25ec70['model']['toLowerCase']());if(_0x39150e===_0x21ab('0x60')){_0x23bfb0=_[_0x21ab('0x61')](_0x23bfb0,_0x25ec70['ids']);}else{if(_[_0x21ab('0x48')](_0x39150e,_0x21ab('0x62')))_0x39150e=_0x39150e[_0x21ab('0x63')](_0x21ab('0x62'),_0x21ab('0x64'));_0x25ec70[_0x21ab('0x65')][_0x21ab('0x5f')](function(_0xc3148a){_0x34db69[_0x21ab('0x66')](getAgents(_0x39150e,_0xc3148a));});}});return BPromise['all'](_0x34db69)[_0x21ab('0x2f')](function(_0x1c5425){_0x23bfb0=_[_0x21ab('0x61')](_0x23bfb0,_[_0x21ab('0x67')](_0x1c5425));_0x285cd0(_0x23bfb0);})[_0x21ab('0x59')](function(_0x14a73a){_0x5e7a67(_0x14a73a);});});}function getAgents(_0x57ac5d,_0xf61af9){return new BPromise(function(_0x1c0f88,_0x3bff0b){return db[_0x57ac5d][_0x21ab('0x5b')]({'where':{'id':_0xf61af9}})[_0x21ab('0x2f')](function(_0x115de4){return _0x115de4[_0x21ab('0x68')]({'attributes':['id'],'raw':!![]})[_0x21ab('0x2f')](function(_0xddee60){var _0x1b9b37=_[_0x21ab('0x69')](_0xddee60,'id');_0x1c0f88(_0x1b9b37);});})[_0x21ab('0x59')](function(_0x17426b){_0x3bff0b(_0x17426b);});});} \ No newline at end of file +var _0xdb3c=['limit','count','offset','apply','reject','save','then','destroy','sendStatus','error','stack','name','send','sendUserNotification','body','hasOwnProperty','ValidationError','TemplateId','view','Sequelize','Missing\x20\x27view\x27\x20parameter','recipients','Missing\x20\x27recipients\x27\x20parameter','parse','Invalid\x20\x27recipients\x27\x20object','chatqueue','faxqueue','openchannelqueue','smsqueue','whatsappqueue','team','includes','model','toLowerCase','Invalid\x20model\x20in\x20\x27recipients\x27\x20object','senderName','user','fullname','recipientsDescription','isEmpty','beep','recipientsId','sequelize','transaction','UserNotification','create','recipient','userNotification:send','text','Template','findOne','html','render','catch','forEach','startCase','User','union','queue','ids','push','all','flatten','map','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','util','sox','fs-extra','lodash','squel','crypto','jsforce','to-csv','querystring','papaparse','../../components/auth/service','../../components/parsers/qs','../../config/logger','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','redis','defaults','localhost','socket.io-emitter','./userNotification.socket','register','status','end','json','undefined'];(function(_0x19396c,_0x32e002){var _0x40a360=function(_0x4db6c7){while(--_0x4db6c7){_0x19396c['push'](_0x19396c['shift']());}};_0x40a360(++_0x32e002);}(_0xdb3c,0x160));var _0xcdb3=function(_0x45508e,_0x59708d){_0x45508e=_0x45508e-0x0;var _0xeea413=_0xdb3c[_0x45508e];return _0xeea413;};'use strict';var emlformat=require(_0xcdb3('0x0'));var rimraf=require(_0xcdb3('0x1'));var zipdir=require(_0xcdb3('0x2'));var jsonpatch=require(_0xcdb3('0x3'));var rp=require(_0xcdb3('0x4'));var moment=require('moment');var BPromise=require('bluebird');var Mustache=require('mustache');var util=require(_0xcdb3('0x5'));var path=require('path');var sox=require(_0xcdb3('0x6'));var csv=require('to-csv');var ejs=require('ejs');var fs=require('fs');var fs_extra=require(_0xcdb3('0x7'));var _=require(_0xcdb3('0x8'));var squel=require(_0xcdb3('0x9'));var crypto=require(_0xcdb3('0xa'));var jsforce=require(_0xcdb3('0xb'));var deskjs=require('desk.js');var toCsv=require(_0xcdb3('0xc'));var querystring=require(_0xcdb3('0xd'));var Papa=require(_0xcdb3('0xe'));var Redis=require('ioredis');var authService=require(_0xcdb3('0xf'));var qs=require(_0xcdb3('0x10'));var as=require('../../components/parsers/advancedSearch');var hardwareService=require('../../config/license/hardware');var logger=require(_0xcdb3('0x11'))('api');var utils=require(_0xcdb3('0x12'));var config=require(_0xcdb3('0x13'));var licenseUtil=require(_0xcdb3('0x14'));var db=require(_0xcdb3('0x15'))['db'];config[_0xcdb3('0x16')]=_[_0xcdb3('0x17')](config[_0xcdb3('0x16')],{'host':_0xcdb3('0x18'),'port':0x18eb});var socket=require(_0xcdb3('0x19'))(new Redis(config[_0xcdb3('0x16')]));require(_0xcdb3('0x1a'))[_0xcdb3('0x1b')](socket);function respondWithStatusCode(_0x5a30dc,_0xdf8825){_0xdf8825=_0xdf8825||0xcc;return function(_0x483762){if(_0x483762){return _0x5a30dc['sendStatus'](_0xdf8825);}return _0x5a30dc[_0xcdb3('0x1c')](_0xdf8825)[_0xcdb3('0x1d')]();};}function respondWithResult(_0x39fd80,_0x209d19){_0x209d19=_0x209d19||0xc8;return function(_0x506fb3){if(_0x506fb3){return _0x39fd80['status'](_0x209d19)[_0xcdb3('0x1e')](_0x506fb3);}};}function respondWithFilteredResult(_0x18a90d,_0x5e873d){return function(_0x19b9c0){if(_0x19b9c0){var _0x106a08=typeof _0x5e873d['offset']===_0xcdb3('0x1f')&&typeof _0x5e873d[_0xcdb3('0x20')]===_0xcdb3('0x1f');var _0x138dec=_0x19b9c0[_0xcdb3('0x21')];var _0x51ddff=_0x106a08?0x0:_0x5e873d[_0xcdb3('0x22')];var _0x305565=_0x106a08?_0x19b9c0['count']:_0x5e873d['offset']+_0x5e873d['limit'];var _0x5bd7e6;if(_0x305565>=_0x138dec){_0x305565=_0x138dec;_0x5bd7e6=0xc8;}else{_0x5bd7e6=0xce;}_0x18a90d['status'](_0x5bd7e6);return _0x18a90d['set']('Content-Range',_0x51ddff+'-'+_0x305565+'/'+_0x138dec)[_0xcdb3('0x1e')](_0x19b9c0);}return null;};}function patchUpdates(_0x56a805){return function(_0x587b46){try{jsonpatch[_0xcdb3('0x23')](_0x587b46,_0x56a805,!![]);}catch(_0xa3d329){return BPromise[_0xcdb3('0x24')](_0xa3d329);}return _0x587b46[_0xcdb3('0x25')]();};}function saveUpdates(_0x4b1f5f,_0x410640){return function(_0x17eb53){if(_0x17eb53){return _0x17eb53['update'](_0x4b1f5f)[_0xcdb3('0x26')](function(_0x22738c){return _0x22738c;});}return null;};}function removeEntity(_0x3bcfbb,_0x11e309){return function(_0x3059ba){if(_0x3059ba){return _0x3059ba[_0xcdb3('0x27')]()['then'](function(){_0x3bcfbb[_0xcdb3('0x1c')](0xcc)[_0xcdb3('0x1d')]();});}};}function handleEntityNotFound(_0x5c850a,_0xd0f22f){return function(_0x1d4df5){if(!_0x1d4df5){_0x5c850a[_0xcdb3('0x28')](0x194);}return _0x1d4df5;};}function handleError(_0x1202c3,_0x42083c){_0x42083c=_0x42083c||0x1f4;return function(_0x7adfb2){logger[_0xcdb3('0x29')](_0x7adfb2[_0xcdb3('0x2a')]);if(_0x7adfb2[_0xcdb3('0x2b')]){delete _0x7adfb2[_0xcdb3('0x2b')];}_0x1202c3[_0xcdb3('0x1c')](_0x42083c)[_0xcdb3('0x2c')](_0x7adfb2);};}exports[_0xcdb3('0x2d')]=function(_0x42d96d,_0x2a5eb7,_0x1eec62){if(!_0x42d96d[_0xcdb3('0x2e')][_0xcdb3('0x2f')]('text')&&!_0x42d96d[_0xcdb3('0x2e')][_0xcdb3('0x2f')]('TemplateId')){throw new db['Sequelize'][(_0xcdb3('0x30'))]('Must\x20specify\x20at\x20least\x20one\x20argument\x20for\x20\x27text\x27\x20or\x20\x27TemplateId\x27');}else{if(_0x42d96d[_0xcdb3('0x2e')][_0xcdb3('0x2f')](_0xcdb3('0x31'))&&!_0x42d96d['body'][_0xcdb3('0x2f')](_0xcdb3('0x32'))){throw new db[(_0xcdb3('0x33'))][(_0xcdb3('0x30'))](_0xcdb3('0x34'));}if(!_0x42d96d[_0xcdb3('0x2e')]['hasOwnProperty'](_0xcdb3('0x35'))){throw new db[(_0xcdb3('0x33'))][(_0xcdb3('0x30'))](_0xcdb3('0x36'));}else{try{var _0x21d4d3=JSON[_0xcdb3('0x37')](_0x42d96d[_0xcdb3('0x2e')][_0xcdb3('0x35')]);}catch(_0x5aeff4){logger[_0xcdb3('0x29')](_0x5aeff4);throw new db[(_0xcdb3('0x33'))][(_0xcdb3('0x30'))](_0xcdb3('0x38'));}var _0x5e6459=[_0xcdb3('0x39'),_0xcdb3('0x3a'),'mailqueue',_0xcdb3('0x3b'),_0xcdb3('0x3c'),'voicequeue',_0xcdb3('0x3d'),_0xcdb3('0x3e'),'user'];if(_['some'](_0x21d4d3,function(_0x2d87e3){return!_[_0xcdb3('0x3f')](_0x5e6459,_0x2d87e3[_0xcdb3('0x40')][_0xcdb3('0x41')]());})){throw new db[(_0xcdb3('0x33'))][(_0xcdb3('0x30'))](_0xcdb3('0x42'));}}}var _0x44601a={};_0x44601a[_0xcdb3('0x43')]=_0x42d96d[_0xcdb3('0x2e')]['hasOwnProperty'](_0xcdb3('0x43'))?_0x42d96d[_0xcdb3('0x2e')][_0xcdb3('0x43')]:_0x42d96d[_0xcdb3('0x44')][_0xcdb3('0x45')];_0x44601a[_0xcdb3('0x46')]=_[_0xcdb3('0x47')](_0x42d96d[_0xcdb3('0x2e')][_0xcdb3('0x46')])?null:_0x42d96d[_0xcdb3('0x2e')]['recipientsDescription'];_0x44601a[_0xcdb3('0x48')]=_0x42d96d[_0xcdb3('0x2e')]['beep']||![];_0x44601a['SenderId']=_0x42d96d[_0xcdb3('0x44')]['id'];return getContent(_0x42d96d[_0xcdb3('0x2e')])[_0xcdb3('0x26')](function(_0x55705b){_0x44601a[_0xcdb3('0x2e')]=_0x55705b;return getRecipients(_0x21d4d3);})[_0xcdb3('0x26')](function(_0x24b953){_0x44601a[_0xcdb3('0x49')]=_['sortBy'](_0x24b953)['join'](',');return db[_0xcdb3('0x4a')][_0xcdb3('0x4b')](function(_0x4599df){return db[_0xcdb3('0x4c')][_0xcdb3('0x4d')](_0x44601a,{'raw':!![],'transaction':_0x4599df})[_0xcdb3('0x26')](function(_0x26210a){var _0x313ab2={'sender':_0x44601a['senderName'],'description':_0x44601a[_0xcdb3('0x46')],'content':_0x44601a['body'],'beep':_0x44601a[_0xcdb3('0x48')]};_0x24b953['forEach'](function(_0x3c261a){_0x313ab2[_0xcdb3('0x4e')]=_0x3c261a;socket['emit'](_0xcdb3('0x4f'),_0x313ab2);});return _0x26210a;});});})[_0xcdb3('0x26')](respondWithResult(_0x2a5eb7,0xc9))['catch'](handleError(_0x2a5eb7,null));};function getContent(_0x30caec){return new BPromise(function(_0x167b6e,_0x1ec6d2){if(_0x30caec[_0xcdb3('0x50')]){_0x167b6e(_0x30caec['text']);return;}return db[_0xcdb3('0x51')][_0xcdb3('0x52')]({'attributes':[_0xcdb3('0x53')],'where':{'id':_0x30caec[_0xcdb3('0x31')]},'raw':!![]})[_0xcdb3('0x26')](function(_0x2f5c6a){if(!_0x2f5c6a)throw new db[(_0xcdb3('0x33'))][(_0xcdb3('0x30'))]('Invalid\x20\x27TemplateId\x27\x20parameter');var _0x3dac8=Mustache[_0xcdb3('0x54')](_0x2f5c6a[_0xcdb3('0x53')],_0x30caec['view']);_0x167b6e(_0x3dac8);})[_0xcdb3('0x55')](function(_0x58e0bc){_0x1ec6d2(_0x58e0bc);});});}function getRecipients(_0x1c252b){return new BPromise(function(_0x1aebd2,_0x5ceb14){var _0x43d2d0=[];var _0x34f4e2=[];_0x1c252b[_0xcdb3('0x56')](function(_0x40818d){var _0x342d9c=_[_0xcdb3('0x57')](_0x40818d[_0xcdb3('0x40')][_0xcdb3('0x41')]());if(_0x342d9c===_0xcdb3('0x58')){_0x43d2d0=_[_0xcdb3('0x59')](_0x43d2d0,_0x40818d['ids']);}else{if(_[_0xcdb3('0x3f')](_0x342d9c,_0xcdb3('0x5a')))_0x342d9c=_0x342d9c['replace'](_0xcdb3('0x5a'),'Queue');_0x40818d[_0xcdb3('0x5b')]['forEach'](function(_0x51a4fd){_0x34f4e2[_0xcdb3('0x5c')](getAgents(_0x342d9c,_0x51a4fd));});}});return BPromise[_0xcdb3('0x5d')](_0x34f4e2)[_0xcdb3('0x26')](function(_0x293729){_0x43d2d0=_[_0xcdb3('0x59')](_0x43d2d0,_[_0xcdb3('0x5e')](_0x293729));_0x1aebd2(_0x43d2d0);})[_0xcdb3('0x55')](function(_0x25bd9c){_0x5ceb14(_0x25bd9c);});});}function getAgents(_0x19e51c,_0x5be9e5){return new BPromise(function(_0x1fd593,_0x222cfd){return db[_0x19e51c][_0xcdb3('0x52')]({'where':{'id':_0x5be9e5}})['then'](function(_0xfb0142){return _0xfb0142['getAgents']({'attributes':['id'],'raw':!![]})[_0xcdb3('0x26')](function(_0x5ed3af){var _0x51ddbe=_[_0xcdb3('0x5f')](_0x5ed3af,'id');_0x1fd593(_0x51ddbe);});})[_0xcdb3('0x55')](function(_0x23e047){_0x222cfd(_0x23e047);});});} \ No newline at end of file diff --git a/server/api/userNotification/userNotification.events.js b/server/api/userNotification/userNotification.events.js index b15d542..fdc05e1 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 _0xd7cc=['remove','emit','hasOwnProperty','events','../../mysqldb','UserNotification','save'];(function(_0x57971a,_0x21508a){var _0x31f761=function(_0x76377f){while(--_0x76377f){_0x57971a['push'](_0x57971a['shift']());}};_0x31f761(++_0x21508a);}(_0xd7cc,0x145));var _0xcd7c=function(_0x45f1b5,_0x331b73){_0x45f1b5=_0x45f1b5-0x0;var _0x467c4f=_0xd7cc[_0x45f1b5];return _0x467c4f;};'use strict';var EventEmitter=require(_0xcd7c('0x0'));var UserNotification=require(_0xcd7c('0x1'))['db'][_0xcd7c('0x2')];var UserNotificationEvents=new EventEmitter();UserNotificationEvents['setMaxListeners'](0x0);var events={'afterCreate':_0xcd7c('0x3'),'afterUpdate':'update','afterDestroy':_0xcd7c('0x4')};function emitEvent(_0x15fe75){return function(_0x5c60b2,_0x5c4071,_0x5c33ed){UserNotificationEvents['emit'](_0x15fe75+':'+_0x5c60b2['id'],_0x5c60b2);UserNotificationEvents[_0xcd7c('0x5')](_0x15fe75,_0x5c60b2);_0x5c33ed(null);};}for(var e in events){if(events[_0xcd7c('0x6')](e)){var event=events[e];UserNotification['hook'](e,emitEvent(event));}}module['exports']=UserNotificationEvents; \ No newline at end of file +var _0x4092=['../../mysqldb','UserNotification','setMaxListeners','update','remove','emit','hasOwnProperty','hook','exports'];(function(_0x329814,_0x37da13){var _0x59cd16=function(_0x2fa8fd){while(--_0x2fa8fd){_0x329814['push'](_0x329814['shift']());}};_0x59cd16(++_0x37da13);}(_0x4092,0x1a7));var _0x2409=function(_0x1c8fb1,_0xb39e81){_0x1c8fb1=_0x1c8fb1-0x0;var _0x57f8e8=_0x4092[_0x1c8fb1];return _0x57f8e8;};'use strict';var EventEmitter=require('events');var UserNotification=require(_0x2409('0x0'))['db'][_0x2409('0x1')];var UserNotificationEvents=new EventEmitter();UserNotificationEvents[_0x2409('0x2')](0x0);var events={'afterCreate':'save','afterUpdate':_0x2409('0x3'),'afterDestroy':_0x2409('0x4')};function emitEvent(_0x508b46){return function(_0x44b459,_0x4883be,_0xb08f13){UserNotificationEvents[_0x2409('0x5')](_0x508b46+':'+_0x44b459['id'],_0x44b459);UserNotificationEvents[_0x2409('0x5')](_0x508b46,_0x44b459);_0xb08f13(null);};}for(var e in events){if(events[_0x2409('0x6')](e)){var event=events[e];UserNotification[_0x2409('0x7')](e,emitEvent(event));}}module[_0x2409('0x8')]=UserNotificationEvents; \ No newline at end of file diff --git a/server/api/userNotification/userNotification.model.js b/server/api/userNotification/userNotification.model.js index 37651ef..7e49a0a 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 _0x3d27=['../../config/logger','moment','bluebird','request-promise','path','rimraf','../../config/environment','./userNotification.attributes','exports','define','UserNotification','userNotifications','utf8mb4','utf8mb4_unicode_ci','lodash'];(function(_0x2afccc,_0x443a1a){var _0x485666=function(_0x3ce6a8){while(--_0x3ce6a8){_0x2afccc['push'](_0x2afccc['shift']());}};_0x485666(++_0x443a1a);}(_0x3d27,0xd1));var _0x73d2=function(_0x28f32c,_0x4cc342){_0x28f32c=_0x28f32c-0x0;var _0x355402=_0x3d27[_0x28f32c];return _0x355402;};'use strict';var _=require(_0x73d2('0x0'));var util=require('util');var logger=require(_0x73d2('0x1'))('api');var moment=require(_0x73d2('0x2'));var BPromise=require(_0x73d2('0x3'));var rp=require(_0x73d2('0x4'));var fs=require('fs');var path=require(_0x73d2('0x5'));var rimraf=require(_0x73d2('0x6'));var config=require(_0x73d2('0x7'));var attributes=require(_0x73d2('0x8'));module[_0x73d2('0x9')]=function(_0x283ff8,_0x385e8c){return _0x283ff8[_0x73d2('0xa')](_0x73d2('0xb'),attributes,{'tableName':_0x73d2('0xc'),'paranoid':![],'indexes':[],'timestamps':!![],'charset':_0x73d2('0xd'),'collate':_0x73d2('0xe')});}; \ No newline at end of file +var _0xa264=['utf8mb4','utf8mb4_unicode_ci','lodash','util','../../config/logger','api','bluebird','request-promise','path','rimraf','../../config/environment','./userNotification.attributes','exports','define','userNotifications'];(function(_0x37a349,_0x536584){var _0x51068e=function(_0x4194b5){while(--_0x4194b5){_0x37a349['push'](_0x37a349['shift']());}};_0x51068e(++_0x536584);}(_0xa264,0x6b));var _0x4a26=function(_0x310a1b,_0x4c9129){_0x310a1b=_0x310a1b-0x0;var _0xdea206=_0xa264[_0x310a1b];return _0xdea206;};'use strict';var _=require(_0x4a26('0x0'));var util=require(_0x4a26('0x1'));var logger=require(_0x4a26('0x2'))(_0x4a26('0x3'));var moment=require('moment');var BPromise=require(_0x4a26('0x4'));var rp=require(_0x4a26('0x5'));var fs=require('fs');var path=require(_0x4a26('0x6'));var rimraf=require(_0x4a26('0x7'));var config=require(_0x4a26('0x8'));var attributes=require(_0x4a26('0x9'));module[_0x4a26('0xa')]=function(_0x4a5849,_0x13e21d){return _0x4a5849[_0x4a26('0xb')]('UserNotification',attributes,{'tableName':_0x4a26('0xc'),'paranoid':![],'indexes':[],'timestamps':!![],'charset':_0x4a26('0xd'),'collate':_0x4a26('0xe')});}; \ No newline at end of file diff --git a/server/api/userNotification/userNotification.rpc.js b/server/api/userNotification/userNotification.rpc.js index fbf7e89..e2af2af 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 _0x23db=['then','info','UserNotification,\x20%s,\x20%s','request\x20sent','UserNotification,\x20%s,\x20%s,\x20%s','code','error','message','result','lodash','moment','bluebird','randomstring','ioredis','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','client','http','redis','defaults','localhost','socket.io-emitter','register','request'];(function(_0x23ed66,_0x1418f5){var _0x493c6b=function(_0x14c5eb){while(--_0x14c5eb){_0x23ed66['push'](_0x23ed66['shift']());}};_0x493c6b(++_0x1418f5);}(_0x23db,0xe1));var _0xb23d=function(_0x278e3c,_0x1c9cfd){_0x278e3c=_0x278e3c-0x0;var _0x3e2d9b=_0x23db[_0x278e3c];return _0x3e2d9b;};'use strict';var _=require(_0xb23d('0x0'));var util=require('util');var moment=require(_0xb23d('0x1'));var BPromise=require(_0xb23d('0x2'));var rs=require(_0xb23d('0x3'));var fs=require('fs');var Redis=require(_0xb23d('0x4'));var db=require('../../mysqldb')['db'];var utils=require(_0xb23d('0x5'));var logger=require(_0xb23d('0x6'))(_0xb23d('0x7'));var config=require(_0xb23d('0x8'));var jayson=require(_0xb23d('0x9'));var client=jayson[_0xb23d('0xa')][_0xb23d('0xb')]({'port':0x232a});config[_0xb23d('0xc')]=_[_0xb23d('0xd')](config[_0xb23d('0xc')],{'host':_0xb23d('0xe'),'port':0x18eb});var socket=require(_0xb23d('0xf'))(new Redis(config[_0xb23d('0xc')]));require('./userNotification.socket')[_0xb23d('0x10')](socket);function respondWithRpcPromise(_0x391635,_0x1fb2ac,_0x5afab4){return new BPromise(function(_0x40c829,_0x1e8eeb){return client[_0xb23d('0x11')](_0x391635,_0x5afab4)[_0xb23d('0x12')](function(_0x1a4fe8){logger[_0xb23d('0x13')](_0xb23d('0x14'),_0x1fb2ac,_0xb23d('0x15'));logger['debug'](_0xb23d('0x16'),_0x1fb2ac,_0xb23d('0x15'),JSON['stringify'](_0x1a4fe8));if(_0x1a4fe8['error']){if(_0x1a4fe8['error'][_0xb23d('0x17')]===0x1f4){logger[_0xb23d('0x18')](_0xb23d('0x14'),_0x1fb2ac,_0x1a4fe8['error'][_0xb23d('0x19')]);return _0x1e8eeb(_0x1a4fe8[_0xb23d('0x18')]['message']);}logger['error'](_0xb23d('0x14'),_0x1fb2ac,_0x1a4fe8[_0xb23d('0x18')][_0xb23d('0x19')]);return _0x40c829(_0x1a4fe8['error'][_0xb23d('0x19')]);}else{logger[_0xb23d('0x13')](_0xb23d('0x14'),_0x1fb2ac,'request\x20sent');_0x40c829(_0x1a4fe8[_0xb23d('0x1a')][_0xb23d('0x19')]);}})['catch'](function(_0x218402){logger[_0xb23d('0x18')]('UserNotification,\x20%s,\x20%s',_0x1fb2ac,_0x218402);_0x1e8eeb(_0x218402);});});} \ No newline at end of file +var _0x3cbb=['error','code','message','result','catch','lodash','util','bluebird','../../config/utils','../../config/logger','jayson/promise','client','http','redis','localhost','socket.io-emitter','./userNotification.socket','request','then','info','UserNotification,\x20%s,\x20%s','request\x20sent','UserNotification,\x20%s,\x20%s,\x20%s','stringify'];(function(_0x2b8347,_0x14e3f2){var _0x15e93e=function(_0x2b046b){while(--_0x2b046b){_0x2b8347['push'](_0x2b8347['shift']());}};_0x15e93e(++_0x14e3f2);}(_0x3cbb,0x10d));var _0xb3cb=function(_0x134c2e,_0x3573c4){_0x134c2e=_0x134c2e-0x0;var _0x2825db=_0x3cbb[_0x134c2e];return _0x2825db;};'use strict';var _=require(_0xb3cb('0x0'));var util=require(_0xb3cb('0x1'));var moment=require('moment');var BPromise=require(_0xb3cb('0x2'));var rs=require('randomstring');var fs=require('fs');var Redis=require('ioredis');var db=require('../../mysqldb')['db'];var utils=require(_0xb3cb('0x3'));var logger=require(_0xb3cb('0x4'))('rpc');var config=require('../../config/environment');var jayson=require(_0xb3cb('0x5'));var client=jayson[_0xb3cb('0x6')][_0xb3cb('0x7')]({'port':0x232a});config[_0xb3cb('0x8')]=_['defaults'](config[_0xb3cb('0x8')],{'host':_0xb3cb('0x9'),'port':0x18eb});var socket=require(_0xb3cb('0xa'))(new Redis(config[_0xb3cb('0x8')]));require(_0xb3cb('0xb'))['register'](socket);function respondWithRpcPromise(_0xc49d38,_0x20052a,_0x5711ea){return new BPromise(function(_0x26021a,_0x59dd7f){return client[_0xb3cb('0xc')](_0xc49d38,_0x5711ea)[_0xb3cb('0xd')](function(_0x1b6070){logger[_0xb3cb('0xe')](_0xb3cb('0xf'),_0x20052a,_0xb3cb('0x10'));logger['debug'](_0xb3cb('0x11'),_0x20052a,_0xb3cb('0x10'),JSON[_0xb3cb('0x12')](_0x1b6070));if(_0x1b6070[_0xb3cb('0x13')]){if(_0x1b6070[_0xb3cb('0x13')][_0xb3cb('0x14')]===0x1f4){logger[_0xb3cb('0x13')]('UserNotification,\x20%s,\x20%s',_0x20052a,_0x1b6070[_0xb3cb('0x13')][_0xb3cb('0x15')]);return _0x59dd7f(_0x1b6070[_0xb3cb('0x13')][_0xb3cb('0x15')]);}logger[_0xb3cb('0x13')](_0xb3cb('0xf'),_0x20052a,_0x1b6070[_0xb3cb('0x13')][_0xb3cb('0x15')]);return _0x26021a(_0x1b6070[_0xb3cb('0x13')]['message']);}else{logger[_0xb3cb('0xe')](_0xb3cb('0xf'),_0x20052a,_0xb3cb('0x10'));_0x26021a(_0x1b6070[_0xb3cb('0x16')][_0xb3cb('0x15')]);}})[_0xb3cb('0x17')](function(_0x1144ce){logger['error'](_0xb3cb('0xf'),_0x20052a,_0x1144ce);_0x59dd7f(_0x1144ce);});});} \ No newline at end of file diff --git a/server/api/userNotification/userNotification.socket.js b/server/api/userNotification/userNotification.socket.js index 0f0a6fb..ba9d6a4 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 _0xdf42=['emit','removeListener','length','userNotification:','./userNotification.events','save','update'];(function(_0x520236,_0x5c8564){var _0x4d6664=function(_0x398c51){while(--_0x398c51){_0x520236['push'](_0x520236['shift']());}};_0x4d6664(++_0x5c8564);}(_0xdf42,0x82));var _0x2df4=function(_0x45d3f0,_0x4be53f){_0x45d3f0=_0x45d3f0-0x0;var _0x314b79=_0xdf42[_0x45d3f0];return _0x314b79;};'use strict';var UserNotificationEvents=require(_0x2df4('0x0'));var events=[_0x2df4('0x1'),'remove',_0x2df4('0x2')];function createListener(_0x292a28,_0x506933){return function(_0x58ffc1){_0x506933[_0x2df4('0x3')](_0x292a28,_0x58ffc1);};}function removeListener(_0x1b4698,_0x1222c1){return function(){UserNotificationEvents[_0x2df4('0x4')](_0x1b4698,_0x1222c1);};}exports['register']=function(_0x334376){for(var _0x2052c3=0x0,_0x2e3597=events[_0x2df4('0x5')];_0x2052c3<_0x2e3597;_0x2052c3++){var _0x1003d1=events[_0x2052c3];var _0xd6f4ff=createListener(_0x2df4('0x6')+_0x1003d1,_0x334376);UserNotificationEvents['on'](_0x1003d1,_0xd6f4ff);}}; \ No newline at end of file +var _0xf500=['length','userNotification:','save','update','emit','register'];(function(_0x4b7268,_0x2564bf){var _0x229cca=function(_0x418216){while(--_0x418216){_0x4b7268['push'](_0x4b7268['shift']());}};_0x229cca(++_0x2564bf);}(_0xf500,0x16a));var _0x0f50=function(_0x40b3f2,_0x2c4f5f){_0x40b3f2=_0x40b3f2-0x0;var _0x4ce90c=_0xf500[_0x40b3f2];return _0x4ce90c;};'use strict';var UserNotificationEvents=require('./userNotification.events');var events=[_0x0f50('0x0'),'remove',_0x0f50('0x1')];function createListener(_0x465434,_0x766717){return function(_0x4b58f5){_0x766717[_0x0f50('0x2')](_0x465434,_0x4b58f5);};}function removeListener(_0xeda9bd,_0x278005){return function(){UserNotificationEvents['removeListener'](_0xeda9bd,_0x278005);};}exports[_0x0f50('0x3')]=function(_0x43e061){for(var _0x4bdd83=0x0,_0x1542d0=events[_0x0f50('0x4')];_0x4bdd83<_0x1542d0;_0x4bdd83++){var _0x492579=events[_0x4bdd83];var _0x193a9e=createListener(_0x0f50('0x5')+_0x492579,_0x43e061);UserNotificationEvents['on'](_0x492579,_0x193a9e);}}; \ No newline at end of file diff --git a/server/api/userOpenchannelQueue/index.js b/server/api/userOpenchannelQueue/index.js index 30cb599..3dcab5f 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 _0xa9e0=['../../components/interaction/service','../../config/environment','exports','multer','util','path','Router','../../components/auth/service'];(function(_0x478c71,_0x256526){var _0x50c512=function(_0x358f69){while(--_0x358f69){_0x478c71['push'](_0x478c71['shift']());}};_0x50c512(++_0x256526);}(_0xa9e0,0x123));var _0x0a9e=function(_0x173d7e,_0x3242fd){_0x173d7e=_0x173d7e-0x0;var _0x2220d6=_0xa9e0[_0x173d7e];return _0x2220d6;};'use strict';var multer=require(_0x0a9e('0x0'));var util=require(_0x0a9e('0x1'));var path=require(_0x0a9e('0x2'));var timeout=require('connect-timeout');var express=require('express');var router=express[_0x0a9e('0x3')]();var fs_extra=require('fs-extra');var auth=require(_0x0a9e('0x4'));var interaction=require(_0x0a9e('0x5'));var config=require(_0x0a9e('0x6'));module[_0x0a9e('0x7')]=router; \ No newline at end of file +var _0x0713=['../../config/environment','exports','path','connect-timeout','express','Router','fs-extra','../../components/interaction/service'];(function(_0x3c6cdf,_0x169915){var _0x44b777=function(_0x429bcf){while(--_0x429bcf){_0x3c6cdf['push'](_0x3c6cdf['shift']());}};_0x44b777(++_0x169915);}(_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/userOpenchannelQueue/userOpenchannelQueue.attributes.js b/server/api/userOpenchannelQueue/userOpenchannelQueue.attributes.js index 4731a99..f9f6c17 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 _0x8bc7=['sequelize','INTEGER'];(function(_0x578f66,_0x52d310){var _0x54db87=function(_0x105246){while(--_0x105246){_0x578f66['push'](_0x578f66['shift']());}};_0x54db87(++_0x52d310);}(_0x8bc7,0x70));var _0x78bc=function(_0x27501b,_0x1fcb0e){_0x27501b=_0x27501b-0x0;var _0x4ba5f1=_0x8bc7[_0x27501b];return _0x4ba5f1;};'use strict';var Sequelize=require(_0x78bc('0x0'));module['exports']={'penalty':{'type':Sequelize[_0x78bc('0x1')],'defaultValue':0x0}}; \ No newline at end of file +var _0xb1b0=['exports','INTEGER'];(function(_0x56ab10,_0x3af0c9){var _0x5eecf6=function(_0x5f6e31){while(--_0x5f6e31){_0x56ab10['push'](_0x56ab10['shift']());}};_0x5eecf6(++_0x3af0c9);}(_0xb1b0,0x1c6));var _0x0b1b=function(_0x57b54c,_0x54ce0d){_0x57b54c=_0x57b54c-0x0;var _0x59cc19=_0xb1b0[_0x57b54c];return _0x59cc19;};'use strict';var Sequelize=require('sequelize');module[_0x0b1b('0x0')]={'penalty':{'type':Sequelize[_0x0b1b('0x1')],'defaultValue':0x0}}; \ No newline at end of file diff --git a/server/api/userOpenchannelQueue/userOpenchannelQueue.model.js b/server/api/userOpenchannelQueue/userOpenchannelQueue.model.js index ba666ff..7c28017 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 _0x1921=['bluebird','request-promise','path','./userOpenchannelQueue.attributes','exports','define','user_has_openchannel_queues','lodash','api','moment'];(function(_0x3747ae,_0x408e61){var _0x339035=function(_0x83be87){while(--_0x83be87){_0x3747ae['push'](_0x3747ae['shift']());}};_0x339035(++_0x408e61);}(_0x1921,0xcf));var _0x1192=function(_0x22ae06,_0xfa881c){_0x22ae06=_0x22ae06-0x0;var _0x312c1c=_0x1921[_0x22ae06];return _0x312c1c;};'use strict';var _=require(_0x1192('0x0'));var util=require('util');var logger=require('../../config/logger')(_0x1192('0x1'));var moment=require(_0x1192('0x2'));var BPromise=require(_0x1192('0x3'));var rp=require(_0x1192('0x4'));var fs=require('fs');var path=require(_0x1192('0x5'));var rimraf=require('rimraf');var config=require('../../config/environment');var attributes=require(_0x1192('0x6'));module[_0x1192('0x7')]=function(_0x5c41d5,_0x3dc4b9){return _0x5c41d5[_0x1192('0x8')]('UserOpenchannelQueue',attributes,{'tableName':_0x1192('0x9'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x74b6=['util','api','moment','rimraf','./userOpenchannelQueue.attributes','exports','define','UserOpenchannelQueue','user_has_openchannel_queues'];(function(_0x1b375e,_0x3f28df){var _0x1f2b8c=function(_0x513baf){while(--_0x513baf){_0x1b375e['push'](_0x1b375e['shift']());}};_0x1f2b8c(++_0x3f28df);}(_0x74b6,0xc6));var _0x674b=function(_0x412a8f,_0x59f9b5){_0x412a8f=_0x412a8f-0x0;var _0x20043f=_0x74b6[_0x412a8f];return _0x20043f;};'use strict';var _=require('lodash');var util=require(_0x674b('0x0'));var logger=require('../../config/logger')(_0x674b('0x1'));var moment=require(_0x674b('0x2'));var BPromise=require('bluebird');var rp=require('request-promise');var fs=require('fs');var path=require('path');var rimraf=require(_0x674b('0x3'));var config=require('../../config/environment');var attributes=require(_0x674b('0x4'));module[_0x674b('0x5')]=function(_0x5dd1b1,_0x2cade4){return _0x5dd1b1[_0x674b('0x6')](_0x674b('0x7'),attributes,{'tableName':_0x674b('0x8'),'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 f8fc812..5042d84 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 _0xc220=['../../config/logger','../../config/environment','jayson/promise','client','http','request','then','info','UserOpenchannelQueue,\x20%s,\x20%s','request\x20sent','UserOpenchannelQueue,\x20%s,\x20%s,\x20%s','stringify','error','code','message','result','catch','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils'];(function(_0x4da572,_0x326408){var _0x378393=function(_0x1357e4){while(--_0x1357e4){_0x4da572['push'](_0x4da572['shift']());}};_0x378393(++_0x326408);}(_0xc220,0x1af));var _0x0c22=function(_0x5d3cd3,_0x6bd4b9){_0x5d3cd3=_0x5d3cd3-0x0;var _0xc64ee1=_0xc220[_0x5d3cd3];return _0xc64ee1;};'use strict';var _=require('lodash');var util=require('util');var moment=require(_0x0c22('0x0'));var BPromise=require(_0x0c22('0x1'));var rs=require(_0x0c22('0x2'));var fs=require('fs');var Redis=require(_0x0c22('0x3'));var db=require(_0x0c22('0x4'))['db'];var utils=require(_0x0c22('0x5'));var logger=require(_0x0c22('0x6'))('rpc');var config=require(_0x0c22('0x7'));var jayson=require(_0x0c22('0x8'));var client=jayson[_0x0c22('0x9')][_0x0c22('0xa')]({'port':0x232a});function respondWithRpcPromise(_0x1816e7,_0x7ecfd7,_0x490cb1){return new BPromise(function(_0x49268e,_0x2b8555){return client[_0x0c22('0xb')](_0x1816e7,_0x490cb1)[_0x0c22('0xc')](function(_0x572829){logger[_0x0c22('0xd')](_0x0c22('0xe'),_0x7ecfd7,_0x0c22('0xf'));logger['debug'](_0x0c22('0x10'),_0x7ecfd7,_0x0c22('0xf'),JSON[_0x0c22('0x11')](_0x572829));if(_0x572829[_0x0c22('0x12')]){if(_0x572829[_0x0c22('0x12')][_0x0c22('0x13')]===0x1f4){logger['error']('UserOpenchannelQueue,\x20%s,\x20%s',_0x7ecfd7,_0x572829[_0x0c22('0x12')][_0x0c22('0x14')]);return _0x2b8555(_0x572829[_0x0c22('0x12')]['message']);}logger[_0x0c22('0x12')](_0x0c22('0xe'),_0x7ecfd7,_0x572829[_0x0c22('0x12')][_0x0c22('0x14')]);return _0x49268e(_0x572829[_0x0c22('0x12')][_0x0c22('0x14')]);}else{logger[_0x0c22('0xd')](_0x0c22('0xe'),_0x7ecfd7,_0x0c22('0xf'));_0x49268e(_0x572829[_0x0c22('0x15')][_0x0c22('0x14')]);}})[_0x0c22('0x16')](function(_0xaffc12){logger[_0x0c22('0x12')]('UserOpenchannelQueue,\x20%s,\x20%s',_0x7ecfd7,_0xaffc12);_0x2b8555(_0xaffc12);});});} \ No newline at end of file +var _0x802d=['util','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/logger','rpc','jayson/promise','client','http','request','info','UserOpenchannelQueue,\x20%s,\x20%s','request\x20sent','debug','stringify','error','code','message','result','catch'];(function(_0x572dd8,_0x227286){var _0x4e3e5a=function(_0x4ee034){while(--_0x4ee034){_0x572dd8['push'](_0x572dd8['shift']());}};_0x4e3e5a(++_0x227286);}(_0x802d,0xb0));var _0xd802=function(_0x186376,_0x5d988a){_0x186376=_0x186376-0x0;var _0x2dbdd9=_0x802d[_0x186376];return _0x2dbdd9;};'use strict';var _=require('lodash');var util=require(_0xd802('0x0'));var moment=require(_0xd802('0x1'));var BPromise=require(_0xd802('0x2'));var rs=require(_0xd802('0x3'));var fs=require('fs');var Redis=require(_0xd802('0x4'));var db=require(_0xd802('0x5'))['db'];var utils=require('../../config/utils');var logger=require(_0xd802('0x6'))(_0xd802('0x7'));var config=require('../../config/environment');var jayson=require(_0xd802('0x8'));var client=jayson[_0xd802('0x9')][_0xd802('0xa')]({'port':0x232a});function respondWithRpcPromise(_0x5f4764,_0x15f8fc,_0x5850de){return new BPromise(function(_0xbcc94b,_0x43a71f){return client[_0xd802('0xb')](_0x5f4764,_0x5850de)['then'](function(_0x48d4ad){logger[_0xd802('0xc')](_0xd802('0xd'),_0x15f8fc,_0xd802('0xe'));logger[_0xd802('0xf')]('UserOpenchannelQueue,\x20%s,\x20%s,\x20%s',_0x15f8fc,_0xd802('0xe'),JSON[_0xd802('0x10')](_0x48d4ad));if(_0x48d4ad[_0xd802('0x11')]){if(_0x48d4ad['error'][_0xd802('0x12')]===0x1f4){logger[_0xd802('0x11')](_0xd802('0xd'),_0x15f8fc,_0x48d4ad[_0xd802('0x11')][_0xd802('0x13')]);return _0x43a71f(_0x48d4ad['error'][_0xd802('0x13')]);}logger[_0xd802('0x11')](_0xd802('0xd'),_0x15f8fc,_0x48d4ad['error'][_0xd802('0x13')]);return _0xbcc94b(_0x48d4ad[_0xd802('0x11')][_0xd802('0x13')]);}else{logger[_0xd802('0xc')]('UserOpenchannelQueue,\x20%s,\x20%s',_0x15f8fc,_0xd802('0xe'));_0xbcc94b(_0x48d4ad[_0xd802('0x14')]['message']);}})[_0xd802('0x15')](function(_0x52e9cc){logger['error'](_0xd802('0xd'),_0x15f8fc,_0x52e9cc);_0x43a71f(_0x52e9cc);});});} \ No newline at end of file diff --git a/server/api/userProfile/index.js b/server/api/userProfile/index.js index 2cb2ac9..63066e0 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 _0xed2e=['put','update','delete','destroy','removeSections','removeResources','exports','util','path','connect-timeout','Router','fs-extra','../../components/auth/service','../../config/environment','./userProfile.controller','get','isAuthenticated','index','/describe','describe','/:id','/:id/sections','getResources','post','create','/:id/clone','addSections','/:id/resources'];(function(_0x306aa3,_0x521e99){var _0x2d1a2a=function(_0x315428){while(--_0x315428){_0x306aa3['push'](_0x306aa3['shift']());}};_0x2d1a2a(++_0x521e99);}(_0xed2e,0x11f));var _0xeed2=function(_0xb91b53,_0x5e017d){_0xb91b53=_0xb91b53-0x0;var _0x35de26=_0xed2e[_0xb91b53];return _0x35de26;};'use strict';var multer=require('multer');var util=require(_0xeed2('0x0'));var path=require(_0xeed2('0x1'));var timeout=require(_0xeed2('0x2'));var express=require('express');var router=express[_0xeed2('0x3')]();var fs_extra=require(_0xeed2('0x4'));var auth=require(_0xeed2('0x5'));var interaction=require('../../components/interaction/service');var config=require(_0xeed2('0x6'));var controller=require(_0xeed2('0x7'));router[_0xeed2('0x8')]('/',auth[_0xeed2('0x9')](),controller[_0xeed2('0xa')]);router[_0xeed2('0x8')](_0xeed2('0xb'),auth[_0xeed2('0x9')](),controller[_0xeed2('0xc')]);router[_0xeed2('0x8')](_0xeed2('0xd'),auth[_0xeed2('0x9')](),controller['show']);router[_0xeed2('0x8')](_0xeed2('0xe'),auth[_0xeed2('0x9')](),controller['getSections']);router[_0xeed2('0x8')]('/:id/resources',auth[_0xeed2('0x9')](),controller[_0xeed2('0xf')]);router[_0xeed2('0x10')]('/',auth[_0xeed2('0x9')](),controller[_0xeed2('0x11')]);router[_0xeed2('0x10')](_0xeed2('0x12'),auth[_0xeed2('0x9')](),controller['clone']);router[_0xeed2('0x10')](_0xeed2('0xe'),auth[_0xeed2('0x9')](),controller[_0xeed2('0x13')]);router[_0xeed2('0x10')](_0xeed2('0x14'),auth[_0xeed2('0x9')](),controller['addResources']);router[_0xeed2('0x15')]('/:id',auth[_0xeed2('0x9')](),controller[_0xeed2('0x16')]);router[_0xeed2('0x17')](_0xeed2('0xd'),auth[_0xeed2('0x9')](),controller[_0xeed2('0x18')]);router[_0xeed2('0x17')](_0xeed2('0xe'),auth[_0xeed2('0x9')](),controller[_0xeed2('0x19')]);router[_0xeed2('0x17')](_0xeed2('0x14'),auth[_0xeed2('0x9')](),controller[_0xeed2('0x1a')]);module[_0xeed2('0x1b')]=router; \ No newline at end of file +var _0xd21c=['../../config/environment','get','isAuthenticated','index','/describe','describe','/:id','/:id/sections','getSections','/:id/resources','getResources','post','create','/:id/clone','clone','delete','destroy','removeResources','util','path','connect-timeout','express','Router','fs-extra','../../components/auth/service'];(function(_0x573852,_0x185a49){var _0x550f8c=function(_0x3b7723){while(--_0x3b7723){_0x573852['push'](_0x573852['shift']());}};_0x550f8c(++_0x185a49);}(_0xd21c,0xf3));var _0xcd21=function(_0x3a9083,_0x3c9f8d){_0x3a9083=_0x3a9083-0x0;var _0x160306=_0xd21c[_0x3a9083];return _0x160306;};'use strict';var multer=require('multer');var util=require(_0xcd21('0x0'));var path=require(_0xcd21('0x1'));var timeout=require(_0xcd21('0x2'));var express=require(_0xcd21('0x3'));var router=express[_0xcd21('0x4')]();var fs_extra=require(_0xcd21('0x5'));var auth=require(_0xcd21('0x6'));var interaction=require('../../components/interaction/service');var config=require(_0xcd21('0x7'));var controller=require('./userProfile.controller');router[_0xcd21('0x8')]('/',auth[_0xcd21('0x9')](),controller[_0xcd21('0xa')]);router[_0xcd21('0x8')](_0xcd21('0xb'),auth[_0xcd21('0x9')](),controller[_0xcd21('0xc')]);router[_0xcd21('0x8')](_0xcd21('0xd'),auth[_0xcd21('0x9')](),controller['show']);router[_0xcd21('0x8')](_0xcd21('0xe'),auth[_0xcd21('0x9')](),controller[_0xcd21('0xf')]);router[_0xcd21('0x8')](_0xcd21('0x10'),auth[_0xcd21('0x9')](),controller[_0xcd21('0x11')]);router[_0xcd21('0x12')]('/',auth['isAuthenticated'](),controller[_0xcd21('0x13')]);router[_0xcd21('0x12')](_0xcd21('0x14'),auth[_0xcd21('0x9')](),controller[_0xcd21('0x15')]);router[_0xcd21('0x12')](_0xcd21('0xe'),auth[_0xcd21('0x9')](),controller['addSections']);router[_0xcd21('0x12')](_0xcd21('0x10'),auth[_0xcd21('0x9')](),controller['addResources']);router['put'](_0xcd21('0xd'),auth[_0xcd21('0x9')](),controller['update']);router[_0xcd21('0x16')](_0xcd21('0xd'),auth[_0xcd21('0x9')](),controller[_0xcd21('0x17')]);router['delete']('/:id/sections',auth[_0xcd21('0x9')](),controller['removeSections']);router['delete']('/:id/resources',auth['isAuthenticated'](),controller[_0xcd21('0x18')]);module['exports']=router; \ No newline at end of file diff --git a/server/api/userProfile/userProfile.attributes.js b/server/api/userProfile/userProfile.attributes.js index 7adea6d..867bd98 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 _0xe510=['split','BOOLEAN','sequelize','exports','STRING','name','setDataValue','crudPermissions','getDataValue'];(function(_0x2d728e,_0x1db3d8){var _0x1788a1=function(_0x19d5df){while(--_0x19d5df){_0x2d728e['push'](_0x2d728e['shift']());}};_0x1788a1(++_0x1db3d8);}(_0xe510,0x107));var _0x0e51=function(_0x4a53d,_0x58a95e){_0x4a53d=_0x4a53d-0x0;var _0x27410e=_0xe510[_0x4a53d];return _0x27410e;};'use strict';var Sequelize=require(_0x0e51('0x0'));module[_0x0e51('0x1')]={'name':{'type':Sequelize[_0x0e51('0x2')],'allowNull':![],'unique':_0x0e51('0x3')},'crudPermissions':{'type':Sequelize[_0x0e51('0x2')],'set':function(_0x411885){this[_0x0e51('0x4')](_0x0e51('0x5'),_0x411885?_0x411885['join'](''):[]);},'get':function(){return this[_0x0e51('0x6')](_0x0e51('0x5'))?this['getDataValue']('crudPermissions')[_0x0e51('0x7')](''):[];},'allowNull':![],'defaultValue':'r'},'description':{'type':Sequelize['STRING'],'allowNull':!![]},'privacyEnabled':{'type':Sequelize[_0x0e51('0x8')],'defaultValue':![]},'downloadAttachments':{'type':Sequelize[_0x0e51('0x8')],'defaultValue':!![]},'downloadCallySquareRecordings':{'type':Sequelize[_0x0e51('0x8')],'defaultValue':!![]},'downloadContactManagerLists':{'type':Sequelize[_0x0e51('0x8')],'defaultValue':!![]},'downloadJscriptySessions':{'type':Sequelize['BOOLEAN'],'defaultValue':!![]},'downloadOmnichannelInteractions':{'type':Sequelize[_0x0e51('0x8')],'defaultValue':!![]},'downloadScreenRecordings':{'type':Sequelize[_0x0e51('0x8')],'defaultValue':!![]},'downloadVoiceRecordings':{'type':Sequelize['BOOLEAN'],'defaultValue':!![]}}; \ No newline at end of file +var _0x7e49=['crudPermissions','join','getDataValue','split','BOOLEAN','sequelize','exports','STRING'];(function(_0x2071ce,_0x234f59){var _0x75f0ce=function(_0x39771b){while(--_0x39771b){_0x2071ce['push'](_0x2071ce['shift']());}};_0x75f0ce(++_0x234f59);}(_0x7e49,0x12d));var _0x97e4=function(_0x1913d0,_0x7df191){_0x1913d0=_0x1913d0-0x0;var _0x2aac66=_0x7e49[_0x1913d0];return _0x2aac66;};'use strict';var Sequelize=require(_0x97e4('0x0'));module[_0x97e4('0x1')]={'name':{'type':Sequelize[_0x97e4('0x2')],'allowNull':![],'unique':'name'},'crudPermissions':{'type':Sequelize[_0x97e4('0x2')],'set':function(_0x4f5e18){this['setDataValue'](_0x97e4('0x3'),_0x4f5e18?_0x4f5e18[_0x97e4('0x4')](''):[]);},'get':function(){return this[_0x97e4('0x5')]('crudPermissions')?this[_0x97e4('0x5')](_0x97e4('0x3'))[_0x97e4('0x6')](''):[];},'allowNull':![],'defaultValue':'r'},'description':{'type':Sequelize[_0x97e4('0x2')],'allowNull':!![]},'privacyEnabled':{'type':Sequelize[_0x97e4('0x7')],'defaultValue':![]},'downloadAttachments':{'type':Sequelize[_0x97e4('0x7')],'defaultValue':!![]},'downloadCallySquareRecordings':{'type':Sequelize[_0x97e4('0x7')],'defaultValue':!![]},'downloadContactManagerLists':{'type':Sequelize[_0x97e4('0x7')],'defaultValue':!![]},'downloadJscriptySessions':{'type':Sequelize['BOOLEAN'],'defaultValue':!![]},'downloadOmnichannelInteractions':{'type':Sequelize[_0x97e4('0x7')],'defaultValue':!![]},'downloadScreenRecordings':{'type':Sequelize[_0x97e4('0x7')],'defaultValue':!![]},'downloadVoiceRecordings':{'type':Sequelize['BOOLEAN'],'defaultValue':!![]}}; \ No newline at end of file diff --git a/server/api/userProfile/userProfile.controller.js b/server/api/userProfile/userProfile.controller.js index 23630e5..f0d5a69 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 _0xa301=['../../config/logger','api','../../config/utils','../../config/license/util','../../mysqldb','redis','defaults','sendStatus','status','end','offset','count','set','Content-Range','json','apply','reject','save','update','then','error','stack','name','send','index','map','UserProfile','rawAttributes','fieldName','type','key','model','query','filters','attributes','intersection','fields','hasOwnProperty','nolimit','limit','order','sort','where','pick','merge','VIRTUAL','options','includeAll','include','findAll','rows','catch','params','keys','length','find','create','body','clone','get','omit','createdAt','updatedAt','sequelize','transaction','UserProfileSection','each','autoAssociation','UserProfileResource','sectionId','userProfileId','destroy','describe','addSections','push','removeSections','ids','getSections','filter','enabled','includes','isEmpty','subsections','concat','findOne','Dashboard','forEach','Plugin','resourceId','addResources','bulkCreate','removeResources','getResources','section','Missing\x20section\x20parameter','No\x20User\x20Profile\x20found\x20for\x20id\x20','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','moment','util','sox','to-csv','ejs','fs-extra','lodash','jsforce','desk.js','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware'];(function(_0x5a0eeb,_0x3d8c6d){var _0x2f9775=function(_0xbcd934){while(--_0xbcd934){_0x5a0eeb['push'](_0x5a0eeb['shift']());}};_0x2f9775(++_0x3d8c6d);}(_0xa301,0x1bf));var _0x1a30=function(_0x221e72,_0x2d90da){_0x221e72=_0x221e72-0x0;var _0x387822=_0xa301[_0x221e72];return _0x387822;};'use strict';var emlformat=require(_0x1a30('0x0'));var rimraf=require(_0x1a30('0x1'));var zipdir=require(_0x1a30('0x2'));var jsonpatch=require(_0x1a30('0x3'));var rp=require(_0x1a30('0x4'));var moment=require(_0x1a30('0x5'));var BPromise=require('bluebird');var Mustache=require('mustache');var util=require(_0x1a30('0x6'));var path=require('path');var sox=require(_0x1a30('0x7'));var csv=require(_0x1a30('0x8'));var ejs=require(_0x1a30('0x9'));var fs=require('fs');var fs_extra=require(_0x1a30('0xa'));var _=require(_0x1a30('0xb'));var squel=require('squel');var crypto=require('crypto');var jsforce=require(_0x1a30('0xc'));var deskjs=require(_0x1a30('0xd'));var toCsv=require(_0x1a30('0x8'));var querystring=require(_0x1a30('0xe'));var Papa=require(_0x1a30('0xf'));var Redis=require(_0x1a30('0x10'));var authService=require(_0x1a30('0x11'));var qs=require(_0x1a30('0x12'));var as=require(_0x1a30('0x13'));var hardwareService=require(_0x1a30('0x14'));var logger=require(_0x1a30('0x15'))(_0x1a30('0x16'));var utils=require(_0x1a30('0x17'));var config=require('../../config/environment');var licenseUtil=require(_0x1a30('0x18'));var db=require(_0x1a30('0x19'))['db'];config[_0x1a30('0x1a')]=_[_0x1a30('0x1b')](config[_0x1a30('0x1a')],{'host':'localhost','port':0x18eb});var socket=require('socket.io-emitter')(new Redis(config[_0x1a30('0x1a')]));require('./userProfile.socket')['register'](socket);function respondWithStatusCode(_0x3a4ac4,_0x1883d4){_0x1883d4=_0x1883d4||0xcc;return function(_0x5661f5){if(_0x5661f5){return _0x3a4ac4[_0x1a30('0x1c')](_0x1883d4);}return _0x3a4ac4[_0x1a30('0x1d')](_0x1883d4)[_0x1a30('0x1e')]();};}function respondWithResult(_0x36df0d,_0x3d1dc5){_0x3d1dc5=_0x3d1dc5||0xc8;return function(_0x43f989){if(_0x43f989){return _0x36df0d[_0x1a30('0x1d')](_0x3d1dc5)['json'](_0x43f989);}};}function respondWithFilteredResult(_0x3ec96f,_0x1e4037){return function(_0xba495){if(_0xba495){var _0x17d9a8=typeof _0x1e4037[_0x1a30('0x1f')]==='undefined'&&typeof _0x1e4037['limit']==='undefined';var _0x295d29=_0xba495['count'];var _0x3f9007=_0x17d9a8?0x0:_0x1e4037[_0x1a30('0x1f')];var _0x442748=_0x17d9a8?_0xba495[_0x1a30('0x20')]:_0x1e4037[_0x1a30('0x1f')]+_0x1e4037['limit'];var _0x5cc2fd;if(_0x442748>=_0x295d29){_0x442748=_0x295d29;_0x5cc2fd=0xc8;}else{_0x5cc2fd=0xce;}_0x3ec96f[_0x1a30('0x1d')](_0x5cc2fd);return _0x3ec96f[_0x1a30('0x21')](_0x1a30('0x22'),_0x3f9007+'-'+_0x442748+'/'+_0x295d29)[_0x1a30('0x23')](_0xba495);}return null;};}function patchUpdates(_0xbf3836){return function(_0xd527fe){try{jsonpatch[_0x1a30('0x24')](_0xd527fe,_0xbf3836,!![]);}catch(_0x4c0ac8){return BPromise[_0x1a30('0x25')](_0x4c0ac8);}return _0xd527fe[_0x1a30('0x26')]();};}function saveUpdates(_0xdc7c76,_0x4eb54b){return function(_0x42b185){if(_0x42b185){return _0x42b185[_0x1a30('0x27')](_0xdc7c76)[_0x1a30('0x28')](function(_0x4ff322){return _0x4ff322;});}return null;};}function removeEntity(_0x478afb,_0x5ed516){return function(_0x151213){if(_0x151213){return _0x151213['destroy']()['then'](function(){_0x478afb[_0x1a30('0x1d')](0xcc)['end']();});}};}function handleEntityNotFound(_0x38570e,_0x39585d){return function(_0x271b07){if(!_0x271b07){_0x38570e['sendStatus'](0x194);}return _0x271b07;};}function handleError(_0xd30f74,_0xcc9d8e){_0xcc9d8e=_0xcc9d8e||0x1f4;return function(_0x2fee0e){logger[_0x1a30('0x29')](_0x2fee0e[_0x1a30('0x2a')]);if(_0x2fee0e[_0x1a30('0x2b')]){delete _0x2fee0e[_0x1a30('0x2b')];}_0xd30f74[_0x1a30('0x1d')](_0xcc9d8e)[_0x1a30('0x2c')](_0x2fee0e);};}exports[_0x1a30('0x2d')]=function(_0x4893d0,_0x225944){var _0x4d93b5={},_0x17ae86={},_0x18710b={'count':0x0,'rows':[]};var _0x5129a3=_[_0x1a30('0x2e')](db[_0x1a30('0x2f')][_0x1a30('0x30')],function(_0x391b87){return{'name':_0x391b87[_0x1a30('0x31')],'type':_0x391b87[_0x1a30('0x32')][_0x1a30('0x33')]};});_0x17ae86[_0x1a30('0x34')]=_['map'](_0x5129a3,_0x1a30('0x2b'));_0x17ae86[_0x1a30('0x35')]=_['keys'](_0x4893d0[_0x1a30('0x35')]);_0x17ae86[_0x1a30('0x36')]=_['intersection'](_0x17ae86[_0x1a30('0x34')],_0x17ae86[_0x1a30('0x35')]);_0x4d93b5[_0x1a30('0x37')]=_[_0x1a30('0x38')](_0x17ae86[_0x1a30('0x34')],qs[_0x1a30('0x39')](_0x4893d0[_0x1a30('0x35')][_0x1a30('0x39')]));_0x4d93b5[_0x1a30('0x37')]=_0x4d93b5[_0x1a30('0x37')]['length']?_0x4d93b5['attributes']:_0x17ae86[_0x1a30('0x34')];if(!_0x4893d0[_0x1a30('0x35')][_0x1a30('0x3a')](_0x1a30('0x3b'))){_0x4d93b5[_0x1a30('0x3c')]=qs[_0x1a30('0x3c')](_0x4893d0[_0x1a30('0x35')][_0x1a30('0x3c')]);_0x4d93b5[_0x1a30('0x1f')]=qs['offset'](_0x4893d0[_0x1a30('0x35')][_0x1a30('0x1f')]);}_0x4d93b5[_0x1a30('0x3d')]=qs[_0x1a30('0x3e')](_0x4893d0[_0x1a30('0x35')][_0x1a30('0x3e')]);_0x4d93b5[_0x1a30('0x3f')]=qs[_0x1a30('0x36')](_[_0x1a30('0x40')](_0x4893d0[_0x1a30('0x35')],_0x17ae86[_0x1a30('0x36')]),_0x5129a3);if(_0x4893d0['query']['filter']){_0x4d93b5[_0x1a30('0x3f')]=_[_0x1a30('0x41')](_0x4d93b5['where'],{'$or':_[_0x1a30('0x2e')](_0x5129a3,function(_0x509168){if(_0x509168['type']!==_0x1a30('0x42')){var _0x4edfd9={};_0x4edfd9[_0x509168[_0x1a30('0x2b')]]={'$like':'%'+_0x4893d0['query']['filter']+'%'};return _0x4edfd9;}})});}_0x4d93b5=_['merge']({},_0x4d93b5,_0x4893d0[_0x1a30('0x43')]);var _0x10ec1={'where':_0x4d93b5[_0x1a30('0x3f')]};return db[_0x1a30('0x2f')][_0x1a30('0x20')](_0x10ec1)[_0x1a30('0x28')](function(_0x432dfc){_0x18710b[_0x1a30('0x20')]=_0x432dfc;if(_0x4893d0[_0x1a30('0x35')][_0x1a30('0x44')]){_0x4d93b5[_0x1a30('0x45')]=[{'all':!![]}];}return db[_0x1a30('0x2f')][_0x1a30('0x46')](_0x4d93b5);})[_0x1a30('0x28')](function(_0x4cafa2){_0x18710b[_0x1a30('0x47')]=_0x4cafa2;return _0x18710b;})[_0x1a30('0x28')](respondWithFilteredResult(_0x225944,_0x4d93b5))[_0x1a30('0x48')](handleError(_0x225944,null));};exports['show']=function(_0x55263c,_0x3e75a8){var _0x5ed016={'raw':![],'where':{'id':_0x55263c[_0x1a30('0x49')]['id']}},_0x20d475={};_0x20d475[_0x1a30('0x34')]=_[_0x1a30('0x4a')](db[_0x1a30('0x2f')][_0x1a30('0x30')]);_0x20d475['query']=_[_0x1a30('0x4a')](_0x55263c[_0x1a30('0x35')]);_0x20d475[_0x1a30('0x36')]=_[_0x1a30('0x38')](_0x20d475[_0x1a30('0x34')],_0x20d475['query']);_0x5ed016[_0x1a30('0x37')]=_[_0x1a30('0x38')](_0x20d475['model'],qs['fields'](_0x55263c[_0x1a30('0x35')]['fields']));_0x5ed016[_0x1a30('0x37')]=_0x5ed016['attributes'][_0x1a30('0x4b')]?_0x5ed016[_0x1a30('0x37')]:_0x20d475['model'];if(_0x55263c[_0x1a30('0x35')][_0x1a30('0x44')]){_0x5ed016[_0x1a30('0x45')]=[{'all':!![]}];}_0x5ed016=_['merge']({},_0x5ed016,_0x55263c['options']);return db[_0x1a30('0x2f')][_0x1a30('0x4c')](_0x5ed016)[_0x1a30('0x28')](handleEntityNotFound(_0x3e75a8,null))[_0x1a30('0x28')](respondWithResult(_0x3e75a8,null))[_0x1a30('0x48')](handleError(_0x3e75a8,null));};exports[_0x1a30('0x4d')]=function(_0x4bfa65,_0x343786){return db[_0x1a30('0x2f')][_0x1a30('0x4d')](_0x4bfa65[_0x1a30('0x4e')],{})[_0x1a30('0x28')](respondWithResult(_0x343786,0xc9))[_0x1a30('0x48')](handleError(_0x343786,null));};exports[_0x1a30('0x4f')]=function(_0x35abbe,_0x451542){var _0x2f460d={'where':{'id':_0x35abbe[_0x1a30('0x49')]['id']}},_0x1fb144={};_0x1fb144['model']=_['keys'](db[_0x1a30('0x2f')][_0x1a30('0x30')]);_0x2f460d[_0x1a30('0x37')]=_[_0x1a30('0x38')](_0x1fb144[_0x1a30('0x34')],qs['fields'](_0x35abbe[_0x1a30('0x35')][_0x1a30('0x39')]));_0x2f460d[_0x1a30('0x37')]=_0x2f460d[_0x1a30('0x37')][_0x1a30('0x4b')]?_0x2f460d[_0x1a30('0x37')]:_0x1fb144[_0x1a30('0x34')];if(_0x35abbe['query']['includeAll']){_0x2f460d[_0x1a30('0x45')]=[{'all':!![]}];}_0x2f460d=_['merge']({},_0x2f460d,_0x35abbe['options']);return db[_0x1a30('0x2f')]['find'](_0x2f460d)[_0x1a30('0x28')](handleEntityNotFound(_0x451542,null))[_0x1a30('0x28')](function(_0x4d3556){if(_0x4d3556){var _0x172f57=_0x4d3556[_0x1a30('0x50')]({'plain':!![]});_0x172f57=qs[_0x1a30('0x51')](_0x172f57,['id',_0x1a30('0x52'),_0x1a30('0x53'),'crudPermissions']);_0x35abbe['body']=_[_0x1a30('0x51')](_0x35abbe['body'],['id',_0x1a30('0x52'),'updatedAt']);return db[_0x1a30('0x54')][_0x1a30('0x55')](function(_0x11b396){return db[_0x1a30('0x2f')]['create'](_[_0x1a30('0x41')](_0x172f57,_0x35abbe[_0x1a30('0x4e')]),{'include':_0x35abbe[_0x1a30('0x35')]['includeAll']?[{'all':!![]}]:undefined,'transaction':_0x11b396})[_0x1a30('0x28')](function(_0x541d74){var _0x4e84b7=_0x541d74[_0x1a30('0x50')]({'plain':!![]});return db[_0x1a30('0x56')][_0x1a30('0x46')]({'where':{'userProfileId':_0x35abbe['params']['id']},'raw':!![]})['then'](function(_0x20673b){if(_0x20673b){return BPromise[_0x1a30('0x57')](_0x20673b,function(_0x1d5028){return new BPromise(function(_0x35e2f2,_0x2f9165){if(_0x1d5028[_0x1a30('0x58')]===null||_0x1d5028['autoAssociation']===0x1)_0x35e2f2(null);return db[_0x1a30('0x59')][_0x1a30('0x46')]({'where':{'sectionId':_0x1d5028['id']},'raw':!![]})['then'](function(_0x77c0ab){var _0x4a927d=_['map'](_0x77c0ab,function(_0x164992){return qs[_0x1a30('0x51')](_0x164992,['id','createdAt',_0x1a30('0x53'),_0x1a30('0x5a')]);});_0x35e2f2(_0x4a927d);})[_0x1a30('0x48')](function(_0x438335){_0x2f9165(_0x438335);});})[_0x1a30('0x28')](function(_0x255c7f){var _0x4fc8be=qs['omit'](_0x1d5028,['id','createdAt','updatedAt']);_0x4fc8be[_0x1a30('0x5b')]=_0x4e84b7['id'];if(_0x255c7f)_0x4fc8be['Resources']=_0x255c7f;return _0x4fc8be;})[_0x1a30('0x28')](function(_0x3ae94f){return db[_0x1a30('0x56')][_0x1a30('0x4d')](_0x3ae94f,{'include':[{'model':db['UserProfileResource'],'as':'Resources'}],'raw':!![],'transaction':_0x11b396});});})[_0x1a30('0x28')](function(){return _0x4e84b7;});}});});});}})[_0x1a30('0x28')](respondWithResult(_0x451542,0xc9))[_0x1a30('0x48')](handleError(_0x451542,null));};exports['update']=function(_0x26c21e,_0x98cc7b){if(_0x26c21e[_0x1a30('0x4e')]['id']){delete _0x26c21e[_0x1a30('0x4e')]['id'];}return db[_0x1a30('0x2f')]['find']({'where':{'id':_0x26c21e[_0x1a30('0x49')]['id']}})['then'](handleEntityNotFound(_0x98cc7b,null))[_0x1a30('0x28')](saveUpdates(_0x26c21e[_0x1a30('0x4e')],null))[_0x1a30('0x28')](respondWithResult(_0x98cc7b,null))['catch'](handleError(_0x98cc7b,null));};exports[_0x1a30('0x5c')]=function(_0x5a2e02,_0x3cd18f){return db[_0x1a30('0x2f')][_0x1a30('0x4c')]({'where':{'id':_0x5a2e02[_0x1a30('0x49')]['id']}})[_0x1a30('0x28')](handleEntityNotFound(_0x3cd18f,null))[_0x1a30('0x28')](removeEntity(_0x3cd18f,null))[_0x1a30('0x48')](handleError(_0x3cd18f,null));};exports[_0x1a30('0x5d')]=function(_0x5dd084,_0x57e06f){return db[_0x1a30('0x2f')][_0x1a30('0x5d')]()[_0x1a30('0x28')](respondWithResult(_0x57e06f,null))['catch'](handleError(_0x57e06f,null));};exports[_0x1a30('0x5e')]=function(_0x4334e4,_0x4ab4ab){var _0xa76103=_0x4334e4['body'];return db['UserProfile'][_0x1a30('0x4c')]({'where':{'id':_0x4334e4['params']['id']}})[_0x1a30('0x28')](handleEntityNotFound(_0x4ab4ab,null))[_0x1a30('0x28')](function(_0x238c1a){if(_0x238c1a){return db[_0x1a30('0x54')]['transaction'](function(_0x343c2c){return db['UserProfileSection'][_0x1a30('0x5c')]({'where':{'userProfileId':_0x4334e4[_0x1a30('0x49')]['id'],'sectionId':_[_0x1a30('0x2e')](_0xa76103,function(_0x222733){return _0x222733[_0x1a30('0x5a')];})},'transaction':_0x343c2c})[_0x1a30('0x28')](function(){var _0x59235d=_[_0x1a30('0x2e')](_0xa76103,function(_0x549282){_0x549282['userProfileId']=_0x4334e4['params']['id'];return _0x549282;});var _0x4c742f=[];return BPromise[_0x1a30('0x57')](_0x59235d,function(_0x10ad4d){return db[_0x1a30('0x56')][_0x1a30('0x4d')](_0x10ad4d,{'include':[{'model':db[_0x1a30('0x59')],'as':'Resources'}],'raw':!![],'transaction':_0x343c2c})[_0x1a30('0x28')](function(_0x2ff634){_0x4c742f[_0x1a30('0x5f')](_0x2ff634[_0x1a30('0x50')]({'plain':!![]}));});})[_0x1a30('0x28')](function(){return _0x4c742f;});});});}})[_0x1a30('0x28')](function(_0x550127){return _0x550127;})[_0x1a30('0x28')](respondWithResult(_0x4ab4ab,null))[_0x1a30('0x48')](handleError(_0x4ab4ab,null));};exports[_0x1a30('0x60')]=function(_0x293718,_0x3a4de5){var _0x5bd86b;return db[_0x1a30('0x2f')]['find']({'where':{'id':_0x293718['params']['id']},'attributes':['id',_0x1a30('0x2b')]})[_0x1a30('0x28')](handleEntityNotFound(_0x3a4de5,null))[_0x1a30('0x28')](function(_0x109edf){if(_0x109edf){_0x5bd86b=_0x109edf;return db[_0x1a30('0x56')][_0x1a30('0x5c')]({'where':{'userProfileId':_0x293718['params']['id'],'sectionId':_0x293718[_0x1a30('0x35')][_0x1a30('0x61')]}});}})[_0x1a30('0x28')](function(){return _0x5bd86b;})[_0x1a30('0x28')](respondWithStatusCode(_0x3a4de5,null))[_0x1a30('0x48')](handleError(_0x3a4de5,null));};exports[_0x1a30('0x62')]=function(_0x138ae6,_0x9753c0){var _0x3732e2=[];var _0x278b4c=[];return db[_0x1a30('0x56')][_0x1a30('0x46')]({'where':{'userProfileId':_0x138ae6[_0x1a30('0x49')]['id']},'raw':!![]})[_0x1a30('0x28')](function(_0x34830b){_0x3732e2=_[_0x1a30('0x63')](_0x34830b,function(_0x2d191f){return _0x2d191f[_0x1a30('0x64')]===0x1||_[_0x1a30('0x65')]([0x3eb,0x709],_0x2d191f[_0x1a30('0x5a')]);});if(!_[_0x1a30('0x66')](_0x3732e2)){return _[_0x1a30('0x2e')](_0x3732e2,function(_0xf6423f){return _0xf6423f[_0x1a30('0x5a')];});}else{return;}})['then'](function(_0x1a79ac){if(_0x1a79ac)_0x278b4c=_0x1a79ac;if(_[_0x1a30('0x65')](_0x278b4c,0x64)){var _0x58990f=_[_0x1a30('0x4c')](_0x3732e2,{'sectionId':0x64});return hasDefaultDashboard(_0x58990f)[_0x1a30('0x28')](function(_0x4a5302){return _[_0x1a30('0x2e')](_0x3732e2,function(_0x1122d8){if(_0x1122d8[_0x1a30('0x5a')]===0x64){_0x1122d8['subsections']=_0x4a5302;}return _0x1122d8;});});}else{return;}})[_0x1a30('0x28')](function(_0x7ca543){if(_0x7ca543)_0x3732e2=_0x7ca543;if(_[_0x1a30('0x65')](_0x278b4c,0x3eb)){var _0xc8c72f=_[_0x1a30('0x4c')](_0x3732e2,{'sectionId':0x3eb});return getCustomDashboards(_0xc8c72f)[_0x1a30('0x28')](function(_0xad7c1b){return _[_0x1a30('0x2e')](_0x3732e2,function(_0x3f7124){if(_0xc8c72f['enabled']){if(_0x3f7124[_0x1a30('0x5a')]===0x3eb){_0x3f7124[_0x1a30('0x67')]=_0xad7c1b;}}else{if(_0x3f7124[_0x1a30('0x5a')]===0x64){if(!_0x3f7124[_0x1a30('0x67')]){_0x3f7124[_0x1a30('0x67')]=[];}_0x3f7124['subsections']=_0x3f7124[_0x1a30('0x67')][_0x1a30('0x68')](_0xad7c1b);}}return _0x3f7124;});});}else{return;}})[_0x1a30('0x28')](function(_0xb01113){if(_0xb01113)_0x3732e2=_0xb01113;if(_['includes'](_0x278b4c,0x709)){var _0x4a97d7=_[_0x1a30('0x4c')](_0x3732e2,{'sectionId':0x709});return getPlugins(_0x4a97d7)[_0x1a30('0x28')](function(_0x22ce3e){if(_0x4a97d7['enabled']){return _[_0x1a30('0x2e')](_0x3732e2,function(_0x304b6b){if(_0x304b6b['sectionId']===0x709){_0x304b6b['subsections']=_0x22ce3e;}return _0x304b6b;});}else{var _0x5eb8f9={'sectionId':0x76c,'enabled':0x1,'subsections':_0x22ce3e};var _0x2d9d7f=_['map'](_0x3732e2);_0x2d9d7f[_0x1a30('0x5f')](_0x5eb8f9);return _0x2d9d7f;}});}else{return;}})[_0x1a30('0x28')](function(_0xe56221){if(_0xe56221)_0x3732e2=_0xe56221;return _[_0x1a30('0x63')](_0x3732e2,[_0x1a30('0x64'),0x1]);})[_0x1a30('0x28')](respondWithResult(_0x9753c0,null))['catch'](handleError(_0x9753c0,null));};function hasDefaultDashboard(_0x39898c){var _0xf073da=[0x65];return new BPromise(function(_0x3aab46,_0x440af5){try{if(_0x39898c[_0x1a30('0x58')]){_0x3aab46(_0xf073da);}else{return db['UserProfileResource'][_0x1a30('0x69')]({'where':{'sectionId':_0x39898c['id']},'raw':!![]})[_0x1a30('0x28')](function(_0x13b1ce){_0x13b1ce?_0x3aab46(_0xf073da):_0x3aab46();});}}catch(_0x581c91){_0x440af5(_0x581c91);}});}function getCustomDashboards(_0x5e2c00){var _0x3240e5=[];return new BPromise(function(_0x326ceb,_0x1c95a1){try{if(_0x5e2c00[_0x1a30('0x58')]){return db[_0x1a30('0x6a')][_0x1a30('0x46')]({'raw':!![]})[_0x1a30('0x28')](function(_0x2adc36){_0x2adc36[_0x1a30('0x6b')](function(_0x39710b){_0x3240e5['push'](_0x39710b['id']+0x1869f);});_0x326ceb(_0x3240e5);});}else{return db[_0x1a30('0x59')][_0x1a30('0x46')]({'where':{'sectionId':_0x5e2c00['id']},'raw':!![]})['then'](function(_0x42ca86){_0x42ca86[_0x1a30('0x6b')](function(_0x39ea20){_0x3240e5[_0x1a30('0x5f')](_0x39ea20['resourceId']+0x1869f);});_0x326ceb(_0x3240e5);});}}catch(_0x564f1b){_0x1c95a1(_0x564f1b);}});}function getPlugins(_0x5a422e){var _0x450161=[];return new BPromise(function(_0x223016,_0x435cf6){try{if(_0x5a422e['autoAssociation']){return db[_0x1a30('0x6c')][_0x1a30('0x46')]({'raw':!![]})[_0x1a30('0x28')](function(_0x371889){_0x371889[_0x1a30('0x6b')](function(_0x30ce6e){_0x450161[_0x1a30('0x5f')](_0x30ce6e['id']+0x15b38);});_0x223016(_0x450161);});}else{return db[_0x1a30('0x59')]['findAll']({'where':{'sectionId':_0x5a422e['id']},'raw':!![]})[_0x1a30('0x28')](function(_0x342945){_0x342945[_0x1a30('0x6b')](function(_0x298d26){_0x450161['push'](_0x298d26[_0x1a30('0x6d')]+0x15b38);});_0x223016(_0x450161);});}}catch(_0x68c948){_0x435cf6(_0x68c948);}});}exports[_0x1a30('0x6e')]=function(_0x16de74,_0x284b1f){return db[_0x1a30('0x2f')]['find']({'where':{'id':_0x16de74[_0x1a30('0x49')]['id']}})[_0x1a30('0x28')](handleEntityNotFound(_0x284b1f,null))[_0x1a30('0x28')](function(_0x1501b2){if(_0x1501b2){return db[_0x1a30('0x54')][_0x1a30('0x55')](function(_0x31c0fd){return db['UserProfileSection'][_0x1a30('0x46')]({'where':{'userProfileId':_0x16de74[_0x1a30('0x49')]['id']},'attributes':['id'],'raw':!![]})[_0x1a30('0x28')](function(_0x42b729){if(_0x42b729){return db[_0x1a30('0x56')][_0x1a30('0x5c')]({'where':{'userProfileId':_0x16de74[_0x1a30('0x49')]['id'],'id':_[_0x1a30('0x2e')](_0x42b729,function(_0x4681cb){return _0x4681cb['id'];})},'transaction':_0x31c0fd});}})[_0x1a30('0x28')](function(_0x89e1b){var _0x3b56d3=_['map'](_0x16de74[_0x1a30('0x4e')],function(_0x7ecdf5){_0x7ecdf5[_0x1a30('0x5b')]=_0x16de74['params']['id'];return _0x7ecdf5;});return db[_0x1a30('0x56')][_0x1a30('0x6f')](_0x3b56d3,{'raw':!![],'transaction':_0x31c0fd});})[_0x1a30('0x28')](function(_0x5a6ccb){var _0x2a7334=_[_0x1a30('0x63')](_[_0x1a30('0x2e')](_0x5a6ccb,function(_0x99f736){return _0x99f736['get']({'plain':!![]});}),{'includeAll':![]});if(_0x2a7334){return db['UserProfileSection'][_0x1a30('0x46')]({'where':{'userProfileId':_0x16de74[_0x1a30('0x49')]['id'],'sectionId':_[_0x1a30('0x2e')](_0x2a7334,function(_0x264198){return _0x264198[_0x1a30('0x5a')];})},'attributes':['id','sectionId'],'raw':!![]})[_0x1a30('0x28')](function(_0x1bb868){var _0x3da0e0=_[_0x1a30('0x2e')](_0x16de74['body'],function(_0x270b5e){_0x270b5e[_0x1a30('0x5b')]=_0x16de74[_0x1a30('0x49')]['id'];return _0x270b5e;});return db[_0x1a30('0x59')][_0x1a30('0x6f')](_0x3da0e0,{'raw':!![],'transaction':_0x31c0fd});});}})[_0x1a30('0x48')](handleError(_0x284b1f,null));});}})[_0x1a30('0x28')](function(_0x2a5990){var _0x386078=_[_0x1a30('0x2e')](_0x2a5990,function(_0x526a40){return _0x526a40[_0x1a30('0x50')]({'plain':!![]});});})['then'](respondWithResult(_0x284b1f,null))[_0x1a30('0x48')](handleError(_0x284b1f,null));};exports[_0x1a30('0x70')]=function(_0x5af541,_0x27e8f8,_0x4e0c54){return db[_0x1a30('0x2f')]['find']({'where':{'id':_0x5af541[_0x1a30('0x49')]['id']}})['then'](handleEntityNotFound(_0x27e8f8,null))[_0x1a30('0x28')](function(_0x29f809){if(_0x29f809){return _0x29f809[_0x1a30('0x70')](_0x5af541[_0x1a30('0x35')][_0x1a30('0x61')]);}})[_0x1a30('0x28')](respondWithStatusCode(_0x27e8f8,null))[_0x1a30('0x48')](handleError(_0x27e8f8,null));};exports[_0x1a30('0x71')]=function(_0x47c309,_0x313f5d){var _0x537da0={};if(!_0x47c309['query'][_0x1a30('0x72')])throw new Error(_0x1a30('0x73'));if(!_0x47c309['query']['hasOwnProperty'](_0x1a30('0x3b'))){_0x537da0[_0x1a30('0x3c')]=qs[_0x1a30('0x3c')](_0x47c309[_0x1a30('0x35')][_0x1a30('0x3c')]);_0x537da0[_0x1a30('0x1f')]=qs[_0x1a30('0x1f')](_0x47c309[_0x1a30('0x35')]['offset']);}return db[_0x1a30('0x2f')][_0x1a30('0x4c')]({'where':{'id':_0x47c309[_0x1a30('0x49')]['id']}})[_0x1a30('0x28')](function(_0x91dddf){if(!_0x91dddf)throw new Error(_0x1a30('0x74')+_0x47c309['params']['id']);return db[_0x1a30('0x2f')][_0x1a30('0x71')](_0x47c309);})[_0x1a30('0x28')](respondWithFilteredResult(_0x313f5d,_0x537da0))[_0x1a30('0x48')](handleError(_0x313f5d,null));}; \ No newline at end of file +var _0xe132=['VIRTUAL','options','includeAll','include','findAll','rows','show','params','rawAttributes','catch','create','clone','omit','createdAt','updatedAt','body','sequelize','transaction','get','UserProfileSection','autoAssociation','sectionId','userProfileId','Resources','UserProfileResource','update','find','describe','addSections','push','removeSections','getSections','enabled','isEmpty','includes','subsections','findOne','Dashboard','forEach','resourceId','Plugin','bulkCreate','ids','getResources','Missing\x20section\x20parameter','rimraf','zip-dir','fast-json-patch','request-promise','moment','bluebird','mustache','util','path','to-csv','fs-extra','lodash','squel','crypto','jsforce','desk.js','papaparse','../../config/license/hardware','../../config/environment','../../config/license/util','../../mysqldb','redis','defaults','socket.io-emitter','./userProfile.socket','register','sendStatus','status','end','json','offset','limit','undefined','count','set','Content-Range','save','then','destroy','error','stack','name','send','map','UserProfile','fieldName','key','model','keys','query','filters','intersection','attributes','fields','length','hasOwnProperty','order','sort','where','pick','filter','merge','type'];(function(_0x343f59,_0x1c3071){var _0x444858=function(_0x25d7c6){while(--_0x25d7c6){_0x343f59['push'](_0x343f59['shift']());}};_0x444858(++_0x1c3071);}(_0xe132,0x99));var _0x2e13=function(_0x4dccbd,_0x56b9d9){_0x4dccbd=_0x4dccbd-0x0;var _0x160afd=_0xe132[_0x4dccbd];return _0x160afd;};'use strict';var emlformat=require('eml-format');var rimraf=require(_0x2e13('0x0'));var zipdir=require(_0x2e13('0x1'));var jsonpatch=require(_0x2e13('0x2'));var rp=require(_0x2e13('0x3'));var moment=require(_0x2e13('0x4'));var BPromise=require(_0x2e13('0x5'));var Mustache=require(_0x2e13('0x6'));var util=require(_0x2e13('0x7'));var path=require(_0x2e13('0x8'));var sox=require('sox');var csv=require(_0x2e13('0x9'));var ejs=require('ejs');var fs=require('fs');var fs_extra=require(_0x2e13('0xa'));var _=require(_0x2e13('0xb'));var squel=require(_0x2e13('0xc'));var crypto=require(_0x2e13('0xd'));var jsforce=require(_0x2e13('0xe'));var deskjs=require(_0x2e13('0xf'));var toCsv=require('to-csv');var querystring=require('querystring');var Papa=require(_0x2e13('0x10'));var Redis=require('ioredis');var authService=require('../../components/auth/service');var qs=require('../../components/parsers/qs');var as=require('../../components/parsers/advancedSearch');var hardwareService=require(_0x2e13('0x11'));var logger=require('../../config/logger')('api');var utils=require('../../config/utils');var config=require(_0x2e13('0x12'));var licenseUtil=require(_0x2e13('0x13'));var db=require(_0x2e13('0x14'))['db'];config[_0x2e13('0x15')]=_[_0x2e13('0x16')](config['redis'],{'host':'localhost','port':0x18eb});var socket=require(_0x2e13('0x17'))(new Redis(config['redis']));require(_0x2e13('0x18'))[_0x2e13('0x19')](socket);function respondWithStatusCode(_0x8f49f4,_0x28f512){_0x28f512=_0x28f512||0xcc;return function(_0x12349d){if(_0x12349d){return _0x8f49f4[_0x2e13('0x1a')](_0x28f512);}return _0x8f49f4[_0x2e13('0x1b')](_0x28f512)[_0x2e13('0x1c')]();};}function respondWithResult(_0x1cd797,_0x30ed47){_0x30ed47=_0x30ed47||0xc8;return function(_0x124d38){if(_0x124d38){return _0x1cd797[_0x2e13('0x1b')](_0x30ed47)[_0x2e13('0x1d')](_0x124d38);}};}function respondWithFilteredResult(_0x208575,_0x1e9af4){return function(_0x7a911e){if(_0x7a911e){var _0x5ef006=typeof _0x1e9af4[_0x2e13('0x1e')]==='undefined'&&typeof _0x1e9af4[_0x2e13('0x1f')]===_0x2e13('0x20');var _0x12fb1e=_0x7a911e[_0x2e13('0x21')];var _0x553155=_0x5ef006?0x0:_0x1e9af4[_0x2e13('0x1e')];var _0x53a815=_0x5ef006?_0x7a911e[_0x2e13('0x21')]:_0x1e9af4[_0x2e13('0x1e')]+_0x1e9af4['limit'];var _0x3ddbeb;if(_0x53a815>=_0x12fb1e){_0x53a815=_0x12fb1e;_0x3ddbeb=0xc8;}else{_0x3ddbeb=0xce;}_0x208575['status'](_0x3ddbeb);return _0x208575[_0x2e13('0x22')](_0x2e13('0x23'),_0x553155+'-'+_0x53a815+'/'+_0x12fb1e)['json'](_0x7a911e);}return null;};}function patchUpdates(_0x5e3bc1){return function(_0xd97526){try{jsonpatch['apply'](_0xd97526,_0x5e3bc1,!![]);}catch(_0x4ccebe){return BPromise['reject'](_0x4ccebe);}return _0xd97526[_0x2e13('0x24')]();};}function saveUpdates(_0x341332,_0xf0f3c7){return function(_0x4a5136){if(_0x4a5136){return _0x4a5136['update'](_0x341332)[_0x2e13('0x25')](function(_0x3a8faa){return _0x3a8faa;});}return null;};}function removeEntity(_0x54cb26,_0x25184a){return function(_0x48645d){if(_0x48645d){return _0x48645d[_0x2e13('0x26')]()[_0x2e13('0x25')](function(){_0x54cb26['status'](0xcc)[_0x2e13('0x1c')]();});}};}function handleEntityNotFound(_0x11161e,_0x31ae60){return function(_0x48dff7){if(!_0x48dff7){_0x11161e[_0x2e13('0x1a')](0x194);}return _0x48dff7;};}function handleError(_0x3dde82,_0x324011){_0x324011=_0x324011||0x1f4;return function(_0x2d98db){logger[_0x2e13('0x27')](_0x2d98db[_0x2e13('0x28')]);if(_0x2d98db['name']){delete _0x2d98db[_0x2e13('0x29')];}_0x3dde82[_0x2e13('0x1b')](_0x324011)[_0x2e13('0x2a')](_0x2d98db);};}exports['index']=function(_0x6e5101,_0x5717bb){var _0x2cf553={},_0x10b8bb={},_0x48c26a={'count':0x0,'rows':[]};var _0x11e989=_[_0x2e13('0x2b')](db[_0x2e13('0x2c')]['rawAttributes'],function(_0xe557d9){return{'name':_0xe557d9[_0x2e13('0x2d')],'type':_0xe557d9['type'][_0x2e13('0x2e')]};});_0x10b8bb[_0x2e13('0x2f')]=_[_0x2e13('0x2b')](_0x11e989,_0x2e13('0x29'));_0x10b8bb['query']=_[_0x2e13('0x30')](_0x6e5101[_0x2e13('0x31')]);_0x10b8bb[_0x2e13('0x32')]=_[_0x2e13('0x33')](_0x10b8bb['model'],_0x10b8bb[_0x2e13('0x31')]);_0x2cf553[_0x2e13('0x34')]=_[_0x2e13('0x33')](_0x10b8bb['model'],qs[_0x2e13('0x35')](_0x6e5101[_0x2e13('0x31')]['fields']));_0x2cf553[_0x2e13('0x34')]=_0x2cf553[_0x2e13('0x34')][_0x2e13('0x36')]?_0x2cf553[_0x2e13('0x34')]:_0x10b8bb[_0x2e13('0x2f')];if(!_0x6e5101[_0x2e13('0x31')][_0x2e13('0x37')]('nolimit')){_0x2cf553[_0x2e13('0x1f')]=qs[_0x2e13('0x1f')](_0x6e5101['query'][_0x2e13('0x1f')]);_0x2cf553[_0x2e13('0x1e')]=qs[_0x2e13('0x1e')](_0x6e5101[_0x2e13('0x31')][_0x2e13('0x1e')]);}_0x2cf553[_0x2e13('0x38')]=qs[_0x2e13('0x39')](_0x6e5101[_0x2e13('0x31')][_0x2e13('0x39')]);_0x2cf553[_0x2e13('0x3a')]=qs[_0x2e13('0x32')](_[_0x2e13('0x3b')](_0x6e5101[_0x2e13('0x31')],_0x10b8bb[_0x2e13('0x32')]),_0x11e989);if(_0x6e5101[_0x2e13('0x31')][_0x2e13('0x3c')]){_0x2cf553[_0x2e13('0x3a')]=_[_0x2e13('0x3d')](_0x2cf553['where'],{'$or':_[_0x2e13('0x2b')](_0x11e989,function(_0x578555){if(_0x578555[_0x2e13('0x3e')]!==_0x2e13('0x3f')){var _0x425c99={};_0x425c99[_0x578555[_0x2e13('0x29')]]={'$like':'%'+_0x6e5101[_0x2e13('0x31')][_0x2e13('0x3c')]+'%'};return _0x425c99;}})});}_0x2cf553=_[_0x2e13('0x3d')]({},_0x2cf553,_0x6e5101[_0x2e13('0x40')]);var _0x95dc84={'where':_0x2cf553[_0x2e13('0x3a')]};return db[_0x2e13('0x2c')][_0x2e13('0x21')](_0x95dc84)[_0x2e13('0x25')](function(_0x49a1cd){_0x48c26a[_0x2e13('0x21')]=_0x49a1cd;if(_0x6e5101[_0x2e13('0x31')][_0x2e13('0x41')]){_0x2cf553[_0x2e13('0x42')]=[{'all':!![]}];}return db[_0x2e13('0x2c')][_0x2e13('0x43')](_0x2cf553);})[_0x2e13('0x25')](function(_0x5aa7ec){_0x48c26a[_0x2e13('0x44')]=_0x5aa7ec;return _0x48c26a;})[_0x2e13('0x25')](respondWithFilteredResult(_0x5717bb,_0x2cf553))['catch'](handleError(_0x5717bb,null));};exports[_0x2e13('0x45')]=function(_0x290a9e,_0x40f134){var _0x26ada1={'raw':![],'where':{'id':_0x290a9e[_0x2e13('0x46')]['id']}},_0x6b1952={};_0x6b1952[_0x2e13('0x2f')]=_[_0x2e13('0x30')](db[_0x2e13('0x2c')][_0x2e13('0x47')]);_0x6b1952[_0x2e13('0x31')]=_[_0x2e13('0x30')](_0x290a9e[_0x2e13('0x31')]);_0x6b1952['filters']=_[_0x2e13('0x33')](_0x6b1952[_0x2e13('0x2f')],_0x6b1952[_0x2e13('0x31')]);_0x26ada1[_0x2e13('0x34')]=_['intersection'](_0x6b1952[_0x2e13('0x2f')],qs[_0x2e13('0x35')](_0x290a9e[_0x2e13('0x31')][_0x2e13('0x35')]));_0x26ada1[_0x2e13('0x34')]=_0x26ada1[_0x2e13('0x34')][_0x2e13('0x36')]?_0x26ada1[_0x2e13('0x34')]:_0x6b1952[_0x2e13('0x2f')];if(_0x290a9e[_0x2e13('0x31')]['includeAll']){_0x26ada1['include']=[{'all':!![]}];}_0x26ada1=_[_0x2e13('0x3d')]({},_0x26ada1,_0x290a9e[_0x2e13('0x40')]);return db['UserProfile']['find'](_0x26ada1)[_0x2e13('0x25')](handleEntityNotFound(_0x40f134,null))['then'](respondWithResult(_0x40f134,null))[_0x2e13('0x48')](handleError(_0x40f134,null));};exports['create']=function(_0x33eea0,_0x3d8712){return db[_0x2e13('0x2c')][_0x2e13('0x49')](_0x33eea0['body'],{})[_0x2e13('0x25')](respondWithResult(_0x3d8712,0xc9))[_0x2e13('0x48')](handleError(_0x3d8712,null));};exports[_0x2e13('0x4a')]=function(_0x40a905,_0xb58a9a){var _0x1395b9={'where':{'id':_0x40a905[_0x2e13('0x46')]['id']}},_0x396bef={};_0x396bef[_0x2e13('0x2f')]=_[_0x2e13('0x30')](db[_0x2e13('0x2c')][_0x2e13('0x47')]);_0x1395b9[_0x2e13('0x34')]=_[_0x2e13('0x33')](_0x396bef[_0x2e13('0x2f')],qs[_0x2e13('0x35')](_0x40a905['query'][_0x2e13('0x35')]));_0x1395b9[_0x2e13('0x34')]=_0x1395b9[_0x2e13('0x34')]['length']?_0x1395b9['attributes']:_0x396bef[_0x2e13('0x2f')];if(_0x40a905[_0x2e13('0x31')][_0x2e13('0x41')]){_0x1395b9[_0x2e13('0x42')]=[{'all':!![]}];}_0x1395b9=_[_0x2e13('0x3d')]({},_0x1395b9,_0x40a905[_0x2e13('0x40')]);return db[_0x2e13('0x2c')]['find'](_0x1395b9)[_0x2e13('0x25')](handleEntityNotFound(_0xb58a9a,null))[_0x2e13('0x25')](function(_0x40e9ce){if(_0x40e9ce){var _0x70328d=_0x40e9ce['get']({'plain':!![]});_0x70328d=qs[_0x2e13('0x4b')](_0x70328d,['id',_0x2e13('0x4c'),_0x2e13('0x4d'),'crudPermissions']);_0x40a905[_0x2e13('0x4e')]=_[_0x2e13('0x4b')](_0x40a905[_0x2e13('0x4e')],['id',_0x2e13('0x4c'),_0x2e13('0x4d')]);return db[_0x2e13('0x4f')][_0x2e13('0x50')](function(_0x2d7c7f){return db[_0x2e13('0x2c')][_0x2e13('0x49')](_[_0x2e13('0x3d')](_0x70328d,_0x40a905[_0x2e13('0x4e')]),{'include':_0x40a905[_0x2e13('0x31')][_0x2e13('0x41')]?[{'all':!![]}]:undefined,'transaction':_0x2d7c7f})[_0x2e13('0x25')](function(_0x416c6c){var _0x248b00=_0x416c6c[_0x2e13('0x51')]({'plain':!![]});return db[_0x2e13('0x52')]['findAll']({'where':{'userProfileId':_0x40a905[_0x2e13('0x46')]['id']},'raw':!![]})['then'](function(_0x420bc6){if(_0x420bc6){return BPromise['each'](_0x420bc6,function(_0x23b5db){return new BPromise(function(_0x48394c,_0x282c2f){if(_0x23b5db[_0x2e13('0x53')]===null||_0x23b5db[_0x2e13('0x53')]===0x1)_0x48394c(null);return db['UserProfileResource'][_0x2e13('0x43')]({'where':{'sectionId':_0x23b5db['id']},'raw':!![]})['then'](function(_0x12832e){var _0x43fac5=_[_0x2e13('0x2b')](_0x12832e,function(_0x89e642){return qs[_0x2e13('0x4b')](_0x89e642,['id',_0x2e13('0x4c'),'updatedAt',_0x2e13('0x54')]);});_0x48394c(_0x43fac5);})['catch'](function(_0x4a84c9){_0x282c2f(_0x4a84c9);});})['then'](function(_0x3dbbc1){var _0x49dc3c=qs[_0x2e13('0x4b')](_0x23b5db,['id',_0x2e13('0x4c'),_0x2e13('0x4d')]);_0x49dc3c[_0x2e13('0x55')]=_0x248b00['id'];if(_0x3dbbc1)_0x49dc3c[_0x2e13('0x56')]=_0x3dbbc1;return _0x49dc3c;})['then'](function(_0x2be032){return db['UserProfileSection']['create'](_0x2be032,{'include':[{'model':db[_0x2e13('0x57')],'as':_0x2e13('0x56')}],'raw':!![],'transaction':_0x2d7c7f});});})[_0x2e13('0x25')](function(){return _0x248b00;});}});});});}})[_0x2e13('0x25')](respondWithResult(_0xb58a9a,0xc9))['catch'](handleError(_0xb58a9a,null));};exports[_0x2e13('0x58')]=function(_0x4c9ba0,_0x3bb4dc){if(_0x4c9ba0[_0x2e13('0x4e')]['id']){delete _0x4c9ba0['body']['id'];}return db['UserProfile'][_0x2e13('0x59')]({'where':{'id':_0x4c9ba0[_0x2e13('0x46')]['id']}})[_0x2e13('0x25')](handleEntityNotFound(_0x3bb4dc,null))[_0x2e13('0x25')](saveUpdates(_0x4c9ba0['body'],null))[_0x2e13('0x25')](respondWithResult(_0x3bb4dc,null))[_0x2e13('0x48')](handleError(_0x3bb4dc,null));};exports[_0x2e13('0x26')]=function(_0x15223c,_0x55ece4){return db['UserProfile']['find']({'where':{'id':_0x15223c[_0x2e13('0x46')]['id']}})[_0x2e13('0x25')](handleEntityNotFound(_0x55ece4,null))['then'](removeEntity(_0x55ece4,null))[_0x2e13('0x48')](handleError(_0x55ece4,null));};exports[_0x2e13('0x5a')]=function(_0x1e82a0,_0x525877){return db[_0x2e13('0x2c')]['describe']()['then'](respondWithResult(_0x525877,null))[_0x2e13('0x48')](handleError(_0x525877,null));};exports[_0x2e13('0x5b')]=function(_0x5c94e4,_0x281acf){var _0x34e6b9=_0x5c94e4[_0x2e13('0x4e')];return db[_0x2e13('0x2c')][_0x2e13('0x59')]({'where':{'id':_0x5c94e4['params']['id']}})[_0x2e13('0x25')](handleEntityNotFound(_0x281acf,null))[_0x2e13('0x25')](function(_0x38dc25){if(_0x38dc25){return db[_0x2e13('0x4f')][_0x2e13('0x50')](function(_0x5ec067){return db[_0x2e13('0x52')][_0x2e13('0x26')]({'where':{'userProfileId':_0x5c94e4['params']['id'],'sectionId':_[_0x2e13('0x2b')](_0x34e6b9,function(_0x5f40c6){return _0x5f40c6['sectionId'];})},'transaction':_0x5ec067})[_0x2e13('0x25')](function(){var _0x11a986=_[_0x2e13('0x2b')](_0x34e6b9,function(_0x1f60a9){_0x1f60a9[_0x2e13('0x55')]=_0x5c94e4[_0x2e13('0x46')]['id'];return _0x1f60a9;});var _0x576893=[];return BPromise['each'](_0x11a986,function(_0x4b0997){return db[_0x2e13('0x52')][_0x2e13('0x49')](_0x4b0997,{'include':[{'model':db[_0x2e13('0x57')],'as':'Resources'}],'raw':!![],'transaction':_0x5ec067})[_0x2e13('0x25')](function(_0x5349ab){_0x576893[_0x2e13('0x5c')](_0x5349ab[_0x2e13('0x51')]({'plain':!![]}));});})['then'](function(){return _0x576893;});});});}})[_0x2e13('0x25')](function(_0xf1a55d){return _0xf1a55d;})[_0x2e13('0x25')](respondWithResult(_0x281acf,null))['catch'](handleError(_0x281acf,null));};exports[_0x2e13('0x5d')]=function(_0x512107,_0x2bf23c){var _0x5e59ea;return db[_0x2e13('0x2c')]['find']({'where':{'id':_0x512107[_0x2e13('0x46')]['id']},'attributes':['id',_0x2e13('0x29')]})[_0x2e13('0x25')](handleEntityNotFound(_0x2bf23c,null))['then'](function(_0x593e86){if(_0x593e86){_0x5e59ea=_0x593e86;return db['UserProfileSection'][_0x2e13('0x26')]({'where':{'userProfileId':_0x512107['params']['id'],'sectionId':_0x512107[_0x2e13('0x31')]['ids']}});}})[_0x2e13('0x25')](function(){return _0x5e59ea;})[_0x2e13('0x25')](respondWithStatusCode(_0x2bf23c,null))['catch'](handleError(_0x2bf23c,null));};exports[_0x2e13('0x5e')]=function(_0x2e0e4a,_0x29c9a8){var _0x3251d0=[];var _0x334d1d=[];return db[_0x2e13('0x52')]['findAll']({'where':{'userProfileId':_0x2e0e4a[_0x2e13('0x46')]['id']},'raw':!![]})[_0x2e13('0x25')](function(_0xf6b197){_0x3251d0=_[_0x2e13('0x3c')](_0xf6b197,function(_0xe5711a){return _0xe5711a[_0x2e13('0x5f')]===0x1||_['includes']([0x3eb,0x709],_0xe5711a[_0x2e13('0x54')]);});if(!_[_0x2e13('0x60')](_0x3251d0)){return _[_0x2e13('0x2b')](_0x3251d0,function(_0x4bccfc){return _0x4bccfc[_0x2e13('0x54')];});}else{return;}})['then'](function(_0x9a0bfa){if(_0x9a0bfa)_0x334d1d=_0x9a0bfa;if(_[_0x2e13('0x61')](_0x334d1d,0x64)){var _0x39912d=_[_0x2e13('0x59')](_0x3251d0,{'sectionId':0x64});return hasDefaultDashboard(_0x39912d)[_0x2e13('0x25')](function(_0x45a79b){return _[_0x2e13('0x2b')](_0x3251d0,function(_0x49d2c4){if(_0x49d2c4[_0x2e13('0x54')]===0x64){_0x49d2c4['subsections']=_0x45a79b;}return _0x49d2c4;});});}else{return;}})[_0x2e13('0x25')](function(_0x25613f){if(_0x25613f)_0x3251d0=_0x25613f;if(_[_0x2e13('0x61')](_0x334d1d,0x3eb)){var _0x40aedb=_['find'](_0x3251d0,{'sectionId':0x3eb});return getCustomDashboards(_0x40aedb)['then'](function(_0x565b76){return _['map'](_0x3251d0,function(_0x21c2c1){if(_0x40aedb[_0x2e13('0x5f')]){if(_0x21c2c1[_0x2e13('0x54')]===0x3eb){_0x21c2c1[_0x2e13('0x62')]=_0x565b76;}}else{if(_0x21c2c1['sectionId']===0x64){if(!_0x21c2c1[_0x2e13('0x62')]){_0x21c2c1[_0x2e13('0x62')]=[];}_0x21c2c1[_0x2e13('0x62')]=_0x21c2c1[_0x2e13('0x62')]['concat'](_0x565b76);}}return _0x21c2c1;});});}else{return;}})['then'](function(_0x12f276){if(_0x12f276)_0x3251d0=_0x12f276;if(_[_0x2e13('0x61')](_0x334d1d,0x709)){var _0x3d1e35=_['find'](_0x3251d0,{'sectionId':0x709});return getPlugins(_0x3d1e35)['then'](function(_0x184d2a){if(_0x3d1e35[_0x2e13('0x5f')]){return _[_0x2e13('0x2b')](_0x3251d0,function(_0x9be896){if(_0x9be896['sectionId']===0x709){_0x9be896['subsections']=_0x184d2a;}return _0x9be896;});}else{var _0x2a0a0e={'sectionId':0x76c,'enabled':0x1,'subsections':_0x184d2a};var _0x53ae53=_[_0x2e13('0x2b')](_0x3251d0);_0x53ae53[_0x2e13('0x5c')](_0x2a0a0e);return _0x53ae53;}});}else{return;}})['then'](function(_0x3721d7){if(_0x3721d7)_0x3251d0=_0x3721d7;return _[_0x2e13('0x3c')](_0x3251d0,[_0x2e13('0x5f'),0x1]);})[_0x2e13('0x25')](respondWithResult(_0x29c9a8,null))[_0x2e13('0x48')](handleError(_0x29c9a8,null));};function hasDefaultDashboard(_0x42f181){var _0x425596=[0x65];return new BPromise(function(_0x541dff,_0x8364f){try{if(_0x42f181[_0x2e13('0x53')]){_0x541dff(_0x425596);}else{return db[_0x2e13('0x57')][_0x2e13('0x63')]({'where':{'sectionId':_0x42f181['id']},'raw':!![]})[_0x2e13('0x25')](function(_0x25fa02){_0x25fa02?_0x541dff(_0x425596):_0x541dff();});}}catch(_0x34c70f){_0x8364f(_0x34c70f);}});}function getCustomDashboards(_0x2447e8){var _0x41a92f=[];return new BPromise(function(_0x390827,_0x20fa31){try{if(_0x2447e8[_0x2e13('0x53')]){return db[_0x2e13('0x64')][_0x2e13('0x43')]({'raw':!![]})[_0x2e13('0x25')](function(_0xf1f8c4){_0xf1f8c4['forEach'](function(_0x4b9ad2){_0x41a92f[_0x2e13('0x5c')](_0x4b9ad2['id']+0x1869f);});_0x390827(_0x41a92f);});}else{return db[_0x2e13('0x57')][_0x2e13('0x43')]({'where':{'sectionId':_0x2447e8['id']},'raw':!![]})['then'](function(_0x5c9b14){_0x5c9b14[_0x2e13('0x65')](function(_0x37ab58){_0x41a92f[_0x2e13('0x5c')](_0x37ab58[_0x2e13('0x66')]+0x1869f);});_0x390827(_0x41a92f);});}}catch(_0x5ef555){_0x20fa31(_0x5ef555);}});}function getPlugins(_0x4cf834){var _0x434c80=[];return new BPromise(function(_0x3a101e,_0x139083){try{if(_0x4cf834['autoAssociation']){return db[_0x2e13('0x67')]['findAll']({'raw':!![]})[_0x2e13('0x25')](function(_0x381c50){_0x381c50[_0x2e13('0x65')](function(_0x468be2){_0x434c80['push'](_0x468be2['id']+0x15b38);});_0x3a101e(_0x434c80);});}else{return db[_0x2e13('0x57')][_0x2e13('0x43')]({'where':{'sectionId':_0x4cf834['id']},'raw':!![]})['then'](function(_0x555ba8){_0x555ba8[_0x2e13('0x65')](function(_0x3f35ab){_0x434c80[_0x2e13('0x5c')](_0x3f35ab[_0x2e13('0x66')]+0x15b38);});_0x3a101e(_0x434c80);});}}catch(_0x1fcb4c){_0x139083(_0x1fcb4c);}});}exports['addResources']=function(_0x44878b,_0x186166){return db[_0x2e13('0x2c')][_0x2e13('0x59')]({'where':{'id':_0x44878b[_0x2e13('0x46')]['id']}})[_0x2e13('0x25')](handleEntityNotFound(_0x186166,null))[_0x2e13('0x25')](function(_0x1f038b){if(_0x1f038b){return db[_0x2e13('0x4f')][_0x2e13('0x50')](function(_0x5c4dce){return db[_0x2e13('0x52')][_0x2e13('0x43')]({'where':{'userProfileId':_0x44878b[_0x2e13('0x46')]['id']},'attributes':['id'],'raw':!![]})[_0x2e13('0x25')](function(_0x5283b7){if(_0x5283b7){return db[_0x2e13('0x52')][_0x2e13('0x26')]({'where':{'userProfileId':_0x44878b['params']['id'],'id':_['map'](_0x5283b7,function(_0x16d9c2){return _0x16d9c2['id'];})},'transaction':_0x5c4dce});}})['then'](function(_0x396bad){var _0xb5f2d0=_['map'](_0x44878b[_0x2e13('0x4e')],function(_0x3d25be){_0x3d25be[_0x2e13('0x55')]=_0x44878b[_0x2e13('0x46')]['id'];return _0x3d25be;});return db[_0x2e13('0x52')][_0x2e13('0x68')](_0xb5f2d0,{'raw':!![],'transaction':_0x5c4dce});})[_0x2e13('0x25')](function(_0x5ca70c){var _0x226d3e=_['filter'](_['map'](_0x5ca70c,function(_0x20e247){return _0x20e247[_0x2e13('0x51')]({'plain':!![]});}),{'includeAll':![]});if(_0x226d3e){return db[_0x2e13('0x52')][_0x2e13('0x43')]({'where':{'userProfileId':_0x44878b[_0x2e13('0x46')]['id'],'sectionId':_[_0x2e13('0x2b')](_0x226d3e,function(_0x21ef9c){return _0x21ef9c['sectionId'];})},'attributes':['id',_0x2e13('0x54')],'raw':!![]})[_0x2e13('0x25')](function(_0x15247a){var _0x41bdf1=_['map'](_0x44878b[_0x2e13('0x4e')],function(_0x5249da){_0x5249da[_0x2e13('0x55')]=_0x44878b[_0x2e13('0x46')]['id'];return _0x5249da;});return db[_0x2e13('0x57')][_0x2e13('0x68')](_0x41bdf1,{'raw':!![],'transaction':_0x5c4dce});});}})[_0x2e13('0x48')](handleError(_0x186166,null));});}})[_0x2e13('0x25')](function(_0x35b907){var _0x44bb90=_[_0x2e13('0x2b')](_0x35b907,function(_0x1af3cd){return _0x1af3cd[_0x2e13('0x51')]({'plain':!![]});});})['then'](respondWithResult(_0x186166,null))[_0x2e13('0x48')](handleError(_0x186166,null));};exports['removeResources']=function(_0x33c169,_0x91d563,_0x4496b0){return db[_0x2e13('0x2c')]['find']({'where':{'id':_0x33c169[_0x2e13('0x46')]['id']}})['then'](handleEntityNotFound(_0x91d563,null))[_0x2e13('0x25')](function(_0x270165){if(_0x270165){return _0x270165['removeResources'](_0x33c169['query'][_0x2e13('0x69')]);}})[_0x2e13('0x25')](respondWithStatusCode(_0x91d563,null))[_0x2e13('0x48')](handleError(_0x91d563,null));};exports[_0x2e13('0x6a')]=function(_0x4047db,_0x797e22){var _0x1b2bff={};if(!_0x4047db[_0x2e13('0x31')]['section'])throw new Error(_0x2e13('0x6b'));if(!_0x4047db[_0x2e13('0x31')][_0x2e13('0x37')]('nolimit')){_0x1b2bff[_0x2e13('0x1f')]=qs[_0x2e13('0x1f')](_0x4047db[_0x2e13('0x31')][_0x2e13('0x1f')]);_0x1b2bff[_0x2e13('0x1e')]=qs[_0x2e13('0x1e')](_0x4047db[_0x2e13('0x31')][_0x2e13('0x1e')]);}return db['UserProfile'][_0x2e13('0x59')]({'where':{'id':_0x4047db['params']['id']}})[_0x2e13('0x25')](function(_0x3810ee){if(!_0x3810ee)throw new Error('No\x20User\x20Profile\x20found\x20for\x20id\x20'+_0x4047db[_0x2e13('0x46')]['id']);return db[_0x2e13('0x2c')][_0x2e13('0x6a')](_0x4047db);})[_0x2e13('0x25')](respondWithFilteredResult(_0x797e22,_0x1b2bff))['catch'](handleError(_0x797e22,null));}; \ No newline at end of file diff --git a/server/api/userProfile/userProfile.events.js b/server/api/userProfile/userProfile.events.js index 6fb3df1..a559082 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 _0x1b9b=['exports','events','UserProfile','setMaxListeners','save','update','emit','hasOwnProperty'];(function(_0x42a584,_0x2d9ee3){var _0x56be59=function(_0x5809dd){while(--_0x5809dd){_0x42a584['push'](_0x42a584['shift']());}};_0x56be59(++_0x2d9ee3);}(_0x1b9b,0x89));var _0xb1b9=function(_0x1adcc0,_0x2f659e){_0x1adcc0=_0x1adcc0-0x0;var _0x2f9237=_0x1b9b[_0x1adcc0];return _0x2f9237;};'use strict';var EventEmitter=require(_0xb1b9('0x0'));var UserProfile=require('../../mysqldb')['db'][_0xb1b9('0x1')];var UserProfileEvents=new EventEmitter();UserProfileEvents[_0xb1b9('0x2')](0x0);var events={'afterCreate':_0xb1b9('0x3'),'afterUpdate':_0xb1b9('0x4'),'afterDestroy':'remove'};function emitEvent(_0x38f77a){return function(_0x411464,_0x597f8f,_0x5c24be){UserProfileEvents['emit'](_0x38f77a+':'+_0x411464['id'],_0x411464);UserProfileEvents[_0xb1b9('0x5')](_0x38f77a,_0x411464);_0x5c24be(null);};}for(var e in events){if(events[_0xb1b9('0x6')](e)){var event=events[e];UserProfile['hook'](e,emitEvent(event));}}module[_0xb1b9('0x7')]=UserProfileEvents; \ No newline at end of file +var _0x7eff=['hasOwnProperty','hook','exports','../../mysqldb','UserProfile','setMaxListeners','update','remove','emit'];(function(_0x1486ce,_0x233c7f){var _0x10a7b2=function(_0xd96f47){while(--_0xd96f47){_0x1486ce['push'](_0x1486ce['shift']());}};_0x10a7b2(++_0x233c7f);}(_0x7eff,0x162));var _0xf7ef=function(_0x321bb2,_0x202794){_0x321bb2=_0x321bb2-0x0;var _0x9c12ed=_0x7eff[_0x321bb2];return _0x9c12ed;};'use strict';var EventEmitter=require('events');var UserProfile=require(_0xf7ef('0x0'))['db'][_0xf7ef('0x1')];var UserProfileEvents=new EventEmitter();UserProfileEvents[_0xf7ef('0x2')](0x0);var events={'afterCreate':'save','afterUpdate':_0xf7ef('0x3'),'afterDestroy':_0xf7ef('0x4')};function emitEvent(_0xc0c7ba){return function(_0x4db614,_0x58a651,_0x4a4573){UserProfileEvents[_0xf7ef('0x5')](_0xc0c7ba+':'+_0x4db614['id'],_0x4db614);UserProfileEvents[_0xf7ef('0x5')](_0xc0c7ba,_0x4db614);_0x4a4573(null);};}for(var e in events){if(events[_0xf7ef('0x6')](e)){var event=events[e];UserProfile[_0xf7ef('0x7')](e,emitEvent(event));}}module[_0xf7ef('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 3f8c725..a8375a4 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 _0x62cc=['chatwebsites','ChatWebsite','faxqueues','FaxQueue','faxaccounts','FaxAccount','inboundroutes','internalroutes','outboundroutes','VoiceExtension','VoiceMail','voicerecordings','VoiceRecording','Agents','role','agent','Telephones','membername','User','telephone','VoiceQueues','VoiceQueue','inbound','QueueCampaigns','outbound','musiconholds','VoiceMusicOnHold','VoiceChanSpy','MailQueue','mailaccounts','mailsubstatuses','MailSubstatus','OpenchannelQueue','openchannelaccounts','OpenchannelAccount','smsqueues','SmsQueue','smsaccounts','SmsAccount','whatsappqueues','WhatsappAccount','teams','Team','voicequeues','queuecampaigns','users','agents','telephones','Users','admin','ZendeskAccount','salesforceaccounts','SalesforceAccount','freshdeskaccounts','sugarcrmaccounts','SugarcrmAccount','DeskAccount','zohoaccounts','ZohoAccount','vtigeraccounts','cannedanswers','Disposition','customdashboards','Dashboard','intervals','Interval','pauses','Pause','sounds','Sound','tags','Tag','templates','Template','triggers','Trigger','trunks','variables','Variable','extractedreports','metrics','charAt','toUpperCase','slice','Sequelize','QueryTypes','SELECT','select','InteractionId','ui.createdAt','from','user_has_','sequelize','query','toString','define','UserProfile','user_profiles','../../components/parsers/qs','mergeResources','Invalid\x20section\x20\x27','length','push','UserProfileSection','find','params','all','isEmpty','union','ignore','autoAssociation','rawAttributes','keys','attributes','intersection','fields','hasOwnProperty','nolimit','limit','offset','order','sort','filters','where','VIRTUAL','foreignKey','merge','options','includeAll','include','reportType','default','reportId','custom','rows','ids','customSorting','extraQueryConditions','count','Tags','tag','ThroughTags','color','openTabs','true','chat','dataValues','sms','fax','openchannel','whatsapp','lodash','./userProfile.attributes','squel','exports','models','filter','field','value','findAll','then','associatedResources','map','catch','model','name','AnalyticExtractedReport','type','resourceId','toLowerCase','squareprojects','childModel','odbc','SquareOdbc','squarerecordings','SquareRecording','parentSections','SquareProjects','JscriptyProject','contacts','CmContact','Lists','ListId','lists','companies','CmCompany','globalcustomfields','CmCustomField'];(function(_0x45f06d,_0x27c585){var _0x465e68=function(_0x1e6e5d){while(--_0x1e6e5d){_0x45f06d['push'](_0x45f06d['shift']());}};_0x465e68(++_0x27c585);}(_0x62cc,0x153));var _0xc62c=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0x62cc[_0x3dd15e];return _0x231fd0;};'use strict';var _=require(_0xc62c('0x0'));var attributes=require(_0xc62c('0x1'));var squel=require(_0xc62c('0x2'));module[_0xc62c('0x3')]=function(_0x168558){var _0x20fe75=_0x168558[_0xc62c('0x4')];function _0xc574f3(_0x706df0,_0x4a7c3c){return new Promise(function(_0x3538e8,_0x4a2fe4){if(!_0x4a7c3c)return _0x3538e8(null);var _0x2ce5fa=_0x4a7c3c[_0xc62c('0x5')]?{[_0x4a7c3c[_0xc62c('0x5')][_0xc62c('0x6')]]:_0x4a7c3c['filter'][_0xc62c('0x7')]}:undefined;return _0x20fe75[_0x706df0][_0xc62c('0x8')]({'where':_0x2ce5fa,'raw':!![]})[_0xc62c('0x9')](function(_0x479f8b){_0x4a7c3c[_0xc62c('0xa')]=_[_0xc62c('0xb')](_0x479f8b,'id');_0x3538e8(_0x4a7c3c);})[_0xc62c('0xc')](function(_0xf0fdc2){_0x4a2fe4(_0xf0fdc2);});});}function _0xde6e8d(_0x4e19bb,_0x5b6391){return new Promise(function(_0x3ccdda,_0x34caad){var _0x2abe17=_0x4e19bb[_0xc62c('0x5')]?{[_0x4e19bb[_0xc62c('0x5')][_0xc62c('0x6')]]:_0x4e19bb[_0xc62c('0x5')]['value']}:undefined;return _0x20fe75[_0x4e19bb[_0xc62c('0xd')]][_0xc62c('0x8')]({'where':_0x2abe17,'raw':!![]})[_0xc62c('0x9')](function(_0x552db4){_0x5b6391[_0xc62c('0xa')]=_['map'](_0x552db4,function(_0x2d6ce7){return _0x2d6ce7[_0xc62c('0xe')];});_0x3ccdda(_0x5b6391);})['catch'](function(_0x1fdff3){_0x34caad(_0x1fdff3);});});}function _0x2dfe50(_0xb27184,_0x88525f,_0x33410c){if(!_0x88525f)return Promise['resolve'](null);return new Promise(function(_0x1180a9,_0x2b0a92){return _0x20fe75['UserProfileResource'][_0xc62c('0x8')]({'where':{'sectionId':_0x88525f['id']},'raw':!![]})[_0xc62c('0x9')](function(_0x390d0a){if(_0xb27184[_0xc62c('0x6')]&&_0xb27184[_0xc62c('0x6')]!=='id'){_0x88525f[_0xc62c('0xa')]=_[_0xc62c('0xb')](_0x390d0a,function(_0x370a82){return _0x370a82[_0xb27184[_0xc62c('0x6')]];});}else{if(_0x33410c===_0xc62c('0xf')){_0x88525f['associatedResources']=_[_0xc62c('0xb')](_0x390d0a,function(_0x196c50){return{'id':_0x196c50['resourceId'],'type':_0x196c50[_0xc62c('0x10')]};});}else{_0x88525f[_0xc62c('0xa')]=_['map'](_0x390d0a,function(_0x30e5a2){return _0x30e5a2[_0xc62c('0x11')];});}}_0x1180a9(_0x88525f);})[_0xc62c('0xc')](function(_0xf2810d){_0x2b0a92(_0xf2810d);});});}function _0x42cbcf(_0x4f1ef2,_0x160d2d){var _0x2058f8={'parentSections':[]};switch(_0x4f1ef2[_0xc62c('0x12')]()){case _0xc62c('0x13'):_0x2058f8[_0xc62c('0x14')]='SquareProject';break;case _0xc62c('0x15'):_0x2058f8[_0xc62c('0x14')]=_0xc62c('0x16');break;case _0xc62c('0x17'):_0x2058f8[_0xc62c('0x14')]=_0xc62c('0x18');_0x2058f8[_0xc62c('0x19')]=[{'name':_0xc62c('0x1a'),'field':_0xc62c('0xe'),'foreignKey':'projectName'}];break;case'projects':_0x2058f8[_0xc62c('0x14')]=_0xc62c('0x1b');break;case _0xc62c('0x1c'):_0x2058f8[_0xc62c('0x14')]=_0xc62c('0x1d');_0x2058f8[_0xc62c('0x19')]=[{'name':_0xc62c('0x1e'),'field':'id','foreignKey':_0xc62c('0x1f')}];break;case _0xc62c('0x20'):_0x2058f8[_0xc62c('0x14')]='CmList';break;case _0xc62c('0x21'):_0x2058f8[_0xc62c('0x14')]=_0xc62c('0x22');break;case _0xc62c('0x23'):_0x2058f8['childModel']=_0xc62c('0x24');break;case'chatqueues':_0x2058f8[_0xc62c('0x14')]='ChatQueue';break;case _0xc62c('0x25'):_0x2058f8[_0xc62c('0x14')]=_0xc62c('0x26');break;case _0xc62c('0x27'):_0x2058f8[_0xc62c('0x14')]=_0xc62c('0x28');break;case _0xc62c('0x29'):_0x2058f8[_0xc62c('0x14')]=_0xc62c('0x2a');break;case _0xc62c('0x2b'):case _0xc62c('0x2c'):case _0xc62c('0x2d'):_0x2058f8[_0xc62c('0x14')]=_0xc62c('0x2e');break;case'contexts':_0x2058f8[_0xc62c('0x14')]='VoiceContext';break;case'voicemails':_0x2058f8['childModel']=_0xc62c('0x2f');break;case _0xc62c('0x30'):_0x2058f8[_0xc62c('0x14')]=_0xc62c('0x31');_0x2058f8[_0xc62c('0x19')]=[{'name':_0xc62c('0x32'),'field':_0xc62c('0xe'),'foreignKey':'membername','model':'User','filter':{'field':_0xc62c('0x33'),'value':[_0xc62c('0x34')]}},{'name':_0xc62c('0x35'),'field':'name','foreignKey':_0xc62c('0x36'),'model':_0xc62c('0x37'),'filter':{'field':_0xc62c('0x33'),'value':[_0xc62c('0x38')]}},{'name':_0xc62c('0x39'),'field':'name','foreignKey':'queue','model':_0xc62c('0x3a'),'filter':{'field':_0xc62c('0x10'),'value':[_0xc62c('0x3b')]}},{'name':_0xc62c('0x3c'),'field':_0xc62c('0xe'),'foreignKey':'queue','model':_0xc62c('0x3a'),'filter':{'field':'type','value':[_0xc62c('0x3d')]}}];break;case _0xc62c('0x3e'):_0x2058f8[_0xc62c('0x14')]=_0xc62c('0x3f');break;case'chanspies':_0x2058f8[_0xc62c('0x14')]=_0xc62c('0x40');break;case'voiceprefixes':_0x2058f8[_0xc62c('0x14')]='VoicePrefix';break;case'ivrcampaigns':_0x2058f8[_0xc62c('0x14')]='Campaign';break;case'mailqueues':_0x2058f8['childModel']=_0xc62c('0x41');break;case _0xc62c('0x42'):_0x2058f8['childModel']='MailAccount';break;case _0xc62c('0x43'):_0x2058f8['childModel']=_0xc62c('0x44');break;case'openchannelqueues':_0x2058f8[_0xc62c('0x14')]=_0xc62c('0x45');break;case _0xc62c('0x46'):_0x2058f8[_0xc62c('0x14')]=_0xc62c('0x47');break;case _0xc62c('0x48'):_0x2058f8[_0xc62c('0x14')]=_0xc62c('0x49');break;case _0xc62c('0x4a'):_0x2058f8[_0xc62c('0x14')]=_0xc62c('0x4b');break;case _0xc62c('0x4c'):_0x2058f8[_0xc62c('0x14')]='WhatsappQueue';break;case'whatsappaccounts':_0x2058f8[_0xc62c('0x14')]=_0xc62c('0x4d');break;case _0xc62c('0x4e'):_0x2058f8[_0xc62c('0x14')]=_0xc62c('0x4f');break;case _0xc62c('0x50'):case _0xc62c('0x51'):_0x2058f8[_0xc62c('0x14')]=_0xc62c('0x3a');if(_0x160d2d){_0x2058f8[_0xc62c('0x19')]=[{'name':_0xc62c('0x39')},{'name':_0xc62c('0x3c')}];}break;case _0xc62c('0x52'):case _0xc62c('0x53'):case _0xc62c('0x54'):_0x2058f8[_0xc62c('0x14')]='User';if(_0x160d2d){_0x2058f8['parentSections']=[{'name':_0xc62c('0x55'),'filter':{'field':_0xc62c('0x33'),'value':[_0xc62c('0x56'),'user']},'ignore':!![]},{'name':_0xc62c('0x32')},{'name':_0xc62c('0x35')}];}break;case'zendeskaccounts':_0x2058f8[_0xc62c('0x14')]=_0xc62c('0x57');break;case _0xc62c('0x58'):_0x2058f8['childModel']=_0xc62c('0x59');break;case _0xc62c('0x5a'):_0x2058f8['childModel']='FreshdeskAccount';break;case _0xc62c('0x5b'):_0x2058f8[_0xc62c('0x14')]=_0xc62c('0x5c');break;case'deskaccounts':_0x2058f8[_0xc62c('0x14')]=_0xc62c('0x5d');break;case _0xc62c('0x5e'):_0x2058f8[_0xc62c('0x14')]=_0xc62c('0x5f');break;case _0xc62c('0x60'):_0x2058f8['childModel']=_0xc62c('0x37');break;case _0xc62c('0x61'):_0x2058f8[_0xc62c('0x14')]='CannedAnswer';break;case'dispositions':_0x2058f8[_0xc62c('0x14')]=_0xc62c('0x62');break;case _0xc62c('0x63'):_0x2058f8[_0xc62c('0x14')]=_0xc62c('0x64');break;case _0xc62c('0x65'):_0x2058f8[_0xc62c('0x14')]=_0xc62c('0x66');break;case _0xc62c('0x67'):_0x2058f8[_0xc62c('0x14')]=_0xc62c('0x68');break;case'scheduler':_0x2058f8['childModel']='Schedule';break;case _0xc62c('0x69'):_0x2058f8[_0xc62c('0x14')]=_0xc62c('0x6a');break;case _0xc62c('0x6b'):_0x2058f8[_0xc62c('0x14')]=_0xc62c('0x6c');break;case _0xc62c('0x6d'):_0x2058f8[_0xc62c('0x14')]=_0xc62c('0x6e');break;case _0xc62c('0x6f'):_0x2058f8[_0xc62c('0x14')]=_0xc62c('0x70');break;case _0xc62c('0x71'):_0x2058f8['childModel']='Trunk';break;case _0xc62c('0x72'):_0x2058f8['childModel']=_0xc62c('0x73');break;case'plugins':_0x2058f8['childModel']='Plugin';break;case _0xc62c('0x74'):_0x2058f8[_0xc62c('0x14')]='AnalyticExtractedReport';_0x2058f8[_0xc62c('0x19')]=[{'name':'Reports','field':'id','foreignKey':'reportId'}];break;case _0xc62c('0x75'):_0x2058f8[_0xc62c('0x14')]='AnalyticMetric';break;}return _0x2058f8;}function _0x168c74(_0x427aa8,_0x4f14e3){var _0x293c0d=_0x427aa8[_0xc62c('0x76')](0x0)[_0xc62c('0x77')]()+_0x427aa8[_0xc62c('0x78')](0x1);var _0x35b1f8={'type':_0x20fe75[_0xc62c('0x79')][_0xc62c('0x7a')][_0xc62c('0x7b')],'raw':!![]};return new Promise(function(_0x4f6b35,_0x14f15b){var _0xec49ed=squel[_0xc62c('0x7c')]()[_0xc62c('0x6')]('ui.'+_0x293c0d+_0xc62c('0x7d'),'id')[_0xc62c('0x6')](_0xc62c('0x7e'))[_0xc62c('0x7f')](_0xc62c('0x80')+_0x427aa8+'_interactions','ui')['where']('ui.UserId\x20=\x20?',_0x4f14e3['id']);return _0x20fe75[_0xc62c('0x81')][_0xc62c('0x82')](_0xec49ed[_0xc62c('0x83')](),_0x35b1f8)[_0xc62c('0x9')](function(_0x36de65){_0x4f14e3[_0x293c0d+'OpenTabs']=_0x36de65;_0x4f6b35(_0x36de65);})[_0xc62c('0xc')](function(_0x140451){_0x14f15b(_0x140451);});});}return _0x168558[_0xc62c('0x84')](_0xc62c('0x85'),attributes,{'tableName':_0xc62c('0x86'),'paranoid':![],'indexes':[],'timestamps':!![],'classMethods':{'getResources':function(_0x55848a){var _0x18d9b7=require(_0xc62c('0x87'));var _0x1e7aab={'raw':_0x55848a[_0xc62c('0x82')]['raw'],'where':{}};var _0x4f3e5b={};var _0x4fc14b={'count':0x0,'rows':[]};var _0x223ba5=_0x55848a[_0xc62c('0x82')]['section'];var _0x5ab561=_0x55848a['query'][_0xc62c('0x88')]||![];var _0xf1731a=_0x42cbcf(_0x223ba5,_0x5ab561);if(!_0xf1731a[_0xc62c('0x14')])throw new Error(_0xc62c('0x89')+_0x223ba5+'\x27');var _0x197899=[{'name':_0x223ba5}];if(!_['isEmpty'](_0xf1731a[_0xc62c('0x19')]))_0x197899=_0xf1731a['parentSections'];var _0x2ccdb7=[];for(var _0x333be2=0x0;_0x333be2<_0x197899[_0xc62c('0x8a')];_0x333be2++){_0x2ccdb7[_0xc62c('0x8b')](_0x20fe75[_0xc62c('0x8c')][_0xc62c('0x8d')]({'where':{'userProfileId':_0x55848a[_0xc62c('0x8e')]['id'],'name':_0x197899[_0x333be2][_0xc62c('0xe')]},'raw':!![]}));}return Promise[_0xc62c('0x8f')](_0x2ccdb7)[_0xc62c('0x9')](function(_0xedcd7){var _0x355eff=_[_0xc62c('0x5')](_0xedcd7,function(_0x1b8d87){return _0x1b8d87?_0x1b8d87:undefined;});var _0x94e30d=_['filter'](_0x197899,['ignore',!![]]);var _0x38f8ef=_['isEmpty'](_0x355eff)&&_[_0xc62c('0x90')](_0x94e30d)?null:_[_0xc62c('0x91')](_0x94e30d,_0x355eff);if(!_0x38f8ef)return null;var _0x50e909=[];for(var _0x4e4a18=0x0;_0x4e4a18<_0x38f8ef[_0xc62c('0x8a')];_0x4e4a18++){var _0x2f2c03=_[_0xc62c('0x8d')](_0x197899,function(_0x20f18e){return _0x38f8ef[_0x4e4a18]?_0x20f18e['name']===_0x38f8ef[_0x4e4a18][_0xc62c('0xe')]:null;});if(_0x2f2c03){if(_0x38f8ef[_0x4e4a18][_0xc62c('0x92')]){_0x50e909[_0xc62c('0x8b')](_0xc574f3(_0xf1731a[_0xc62c('0x14')],_0x38f8ef[_0x4e4a18]));}else{if(!_0x38f8ef[_0x4e4a18][_0xc62c('0x93')]){_0x50e909[_0xc62c('0x8b')](_0x2dfe50(_0x2f2c03,_0x38f8ef[_0x4e4a18],_0xf1731a[_0xc62c('0x14')]));}else{if(_0x2f2c03['model']){_0x50e909[_0xc62c('0x8b')](_0xde6e8d(_0x2f2c03,_0x38f8ef[_0x4e4a18]));}}}}}return Promise[_0xc62c('0x8f')](_0x50e909);})['then'](function(_0x1eada7){var _0x171d9a=_0x1eada7;var _0xb5da86=null;if(_0x171d9a){_0xb5da86=_0x171d9a['length']===0x1?_0x171d9a[0x0]:null;}if(!_0xb5da86&&!_0x171d9a)return _0x4fc14b;var _0x332f4b=_0x20fe75[_0xf1731a[_0xc62c('0x14')]][_0xc62c('0x94')];_0x4f3e5b[_0xc62c('0xd')]=_[_0xc62c('0x95')](_0x332f4b);_0x4f3e5b[_0xc62c('0x82')]=_[_0xc62c('0x95')](_0x55848a['query']);_0x4f3e5b['filters']=_['intersection'](_0x4f3e5b[_0xc62c('0xd')],_0x4f3e5b[_0xc62c('0x82')]);_0x1e7aab[_0xc62c('0x96')]=_[_0xc62c('0x97')](_0x4f3e5b[_0xc62c('0xd')],_0x18d9b7[_0xc62c('0x98')](_0x55848a[_0xc62c('0x82')]['fields']));_0x1e7aab[_0xc62c('0x96')]=_0x1e7aab[_0xc62c('0x96')][_0xc62c('0x8a')]?_0x1e7aab[_0xc62c('0x96')]:_0x4f3e5b[_0xc62c('0xd')];if(!_0x55848a[_0xc62c('0x82')][_0xc62c('0x99')](_0xc62c('0x9a'))){_0x1e7aab[_0xc62c('0x9b')]=_0x18d9b7[_0xc62c('0x9b')](_0x55848a[_0xc62c('0x82')][_0xc62c('0x9b')]);_0x1e7aab[_0xc62c('0x9c')]=_0x18d9b7[_0xc62c('0x9c')](_0x55848a[_0xc62c('0x82')][_0xc62c('0x9c')]);}_0x1e7aab[_0xc62c('0x9d')]=_0x18d9b7[_0xc62c('0x9e')](_0x55848a[_0xc62c('0x82')][_0xc62c('0x9e')]);_0x1e7aab['where']=_0x18d9b7[_0xc62c('0x9f')](_['pick'](_0x55848a[_0xc62c('0x82')],_0x4f3e5b[_0xc62c('0x9f')]));if(_0x55848a[_0xc62c('0x82')][_0xc62c('0x5')]){_0x1e7aab['where']=_['merge'](_0x1e7aab[_0xc62c('0xa0')],{'$or':_[_0xc62c('0xb')](_0x332f4b,function(_0x4e219c){if(_0x4e219c[_0xc62c('0x10')]['key']!==_0xc62c('0xa1')){var _0x4815cc={};_0x4815cc[_0x4e219c[_0xc62c('0x6')]]={'$like':'%'+_0x55848a['query'][_0xc62c('0x5')]+'%'};return _0x4815cc;}})});}var _0x215ccd=[];var _0x2069d1=null;var _0x32bc50={};if(_0xb5da86){_0x2069d1=_[_0xc62c('0x8d')](_0x197899,['name',_0xb5da86[_0xc62c('0xe')]]);if(_0x2069d1[_0xc62c('0x6')]){_0x32bc50={};if(_0xf1731a[_0xc62c('0x14')]===_0xc62c('0xf')){_0x32bc50[_0x2069d1[_0xc62c('0xa2')]]=_['map'](_0xb5da86[_0xc62c('0xa')],'id');}else{_0x32bc50[_0x2069d1['foreignKey']]=_0xb5da86[_0xc62c('0xa')];}_0x215ccd[_0xc62c('0x8b')](_0x32bc50);}else{_0x1e7aab[_0xc62c('0xa0')]['id']=_0xb5da86[_0xc62c('0xa')];}}else{for(var _0x5001d4=0x0;_0x5001d4<_0x171d9a[_0xc62c('0x8a')];_0x5001d4++){_0x2069d1=_[_0xc62c('0x8d')](_0x197899,[_0xc62c('0xe'),_0x171d9a[_0x5001d4]['name']]);if(_0x2069d1[_0xc62c('0x6')]){_0x32bc50={};_0x32bc50[_0x2069d1[_0xc62c('0xa2')]]=_0x171d9a[_0x5001d4][_0xc62c('0xa')];_0x215ccd['push'](_0x32bc50);}else{if(!_0x1e7aab[_0xc62c('0xa0')]['id'])_0x1e7aab[_0xc62c('0xa0')]['id']=[];_0x171d9a[_0x5001d4]['associatedResources']['forEach'](function(_0x113224){_0x1e7aab[_0xc62c('0xa0')]['id'][_0xc62c('0x8b')](_0x113224);});}}}if(!_[_0xc62c('0x90')](_0x215ccd)){_0x1e7aab[_0xc62c('0xa0')]=_[_0xc62c('0xa3')](_0x1e7aab[_0xc62c('0xa0')],{'$and':{'$or':_0x215ccd}});}_0x1e7aab=_[_0xc62c('0xa3')]({},_0x1e7aab,_0x55848a[_0xc62c('0xa4')]);if(_0xb5da86&&!_0xb5da86[_0xc62c('0x93')]&&_0xf1731a[_0xc62c('0x14')]===_0xc62c('0xf')){if(_0x55848a[_0xc62c('0x82')][_0xc62c('0xa5')]){_0x1e7aab[_0xc62c('0xa6')]=[{'all':!![]}];}return _0x20fe75[_0xf1731a['childModel']][_0xc62c('0x8')](_0x1e7aab)[_0xc62c('0x9')](function(_0x3a23e5){var _0x280a96=[];_0x3a23e5['forEach'](function(_0x4e8bb4){var _0x4cbe56;switch(_0x4e8bb4[_0xc62c('0xa7')]){case _0xc62c('0xa8'):_0x4cbe56=_[_0xc62c('0x8d')](_0xb5da86['associatedResources'],function(_0x5d7d67){return _0x5d7d67['id']===_0x4e8bb4[_0xc62c('0xa9')]&&_0x5d7d67['type']==='DefaultReports';});break;case _0xc62c('0xaa'):_0x4cbe56=_['find'](_0xb5da86[_0xc62c('0xa')],function(_0x1a7ab8){return _0x1a7ab8['id']===_0x4e8bb4[_0xc62c('0xa9')]&&_0x1a7ab8[_0xc62c('0x10')]==='CustomReports';});break;}if(_0x4cbe56)_0x280a96[_0xc62c('0x8b')](_0x4e8bb4);});_0x4fc14b['count']=_0x280a96[_0xc62c('0x8a')];_0x4fc14b[_0xc62c('0xab')]=_0x280a96;return _0x4fc14b;});}else{if(!_[_0xc62c('0x90')](_0x55848a[_0xc62c('0x82')][_0xc62c('0xac')])){_0x1e7aab[_0xc62c('0xa0')]['id']=_0x1e7aab[_0xc62c('0xa0')]['id']?_[_0xc62c('0x97')](_0x1e7aab['where']['id'],_0x55848a[_0xc62c('0x82')]['ids']):_0x55848a[_0xc62c('0x82')][_0xc62c('0xac')];if(_0x55848a['query'][_0xc62c('0xad')]){_0x1e7aab['order']=_0x55848a['query']['customSorting'];}}if(_0x55848a[_0xc62c('0x82')][_0xc62c('0xae')]){_0x1e7aab[_0xc62c('0xa0')]=_['merge'](_0x1e7aab[_0xc62c('0xa0')],{'$and':_0x55848a[_0xc62c('0x82')][_0xc62c('0xae')]});}return _0x20fe75[_0xf1731a[_0xc62c('0x14')]][_0xc62c('0xaf')]({'where':_0x1e7aab[_0xc62c('0xa0')]})[_0xc62c('0x9')](function(_0x654382){_0x4fc14b[_0xc62c('0xaf')]=_0x654382;if(_0x55848a['query'][_0xc62c('0xa5')]){if(_0xf1731a[_0xc62c('0x14')]===_0xc62c('0x1d')){_0x1e7aab[_0xc62c('0xa6')]=[{'model':_0x20fe75[_0xc62c('0x6c')],'as':_0xc62c('0xb0'),'attributes':['id','name','color'],'required':_0x55848a[_0xc62c('0x82')][_0xc62c('0xb1')]?!![]:![]},{'model':_0x20fe75[_0xc62c('0x6c')],'as':_0xc62c('0xb2'),'attributes':['id','name',_0xc62c('0xb3')],'through':_0x55848a[_0xc62c('0x82')][_0xc62c('0xb1')]?{'attributes':[],'where':{'TagId':_0x55848a[_0xc62c('0x82')]['tag']||undefined}}:{},'required':_0x55848a[_0xc62c('0x82')][_0xc62c('0xb1')]?!![]:![]}];}else{_0x1e7aab[_0xc62c('0xa6')]=[{'all':!![]}];}}return _0x20fe75[_0xf1731a[_0xc62c('0x14')]]['findAll'](_0x1e7aab);})[_0xc62c('0x9')](function(_0x1e01bf){_0x4fc14b[_0xc62c('0xab')]=_0x1e01bf;if(_0x223ba5===_0xc62c('0x32')&&_0x55848a[_0xc62c('0x82')][_0xc62c('0xb4')]===_0xc62c('0xb5')){var _0x5be7f0=[];for(var _0x2c4a16=0x0;_0x2c4a16<_0x4fc14b[_0xc62c('0xab')]['length'];_0x2c4a16++){_0x5be7f0[_0xc62c('0x8b')](_0x168c74(_0xc62c('0xb6'),_0x4fc14b['rows'][_0x2c4a16][_0xc62c('0xb7')]));_0x5be7f0[_0xc62c('0x8b')](_0x168c74(_0xc62c('0xb8'),_0x4fc14b[_0xc62c('0xab')][_0x2c4a16]['dataValues']));_0x5be7f0['push'](_0x168c74(_0xc62c('0xb9'),_0x4fc14b[_0xc62c('0xab')][_0x2c4a16][_0xc62c('0xb7')]));_0x5be7f0[_0xc62c('0x8b')](_0x168c74('mail',_0x4fc14b[_0xc62c('0xab')][_0x2c4a16][_0xc62c('0xb7')]));_0x5be7f0[_0xc62c('0x8b')](_0x168c74(_0xc62c('0xba'),_0x4fc14b[_0xc62c('0xab')][_0x2c4a16][_0xc62c('0xb7')]));_0x5be7f0[_0xc62c('0x8b')](_0x168c74(_0xc62c('0xbb'),_0x4fc14b[_0xc62c('0xab')][_0x2c4a16][_0xc62c('0xb7')]));}return Promise[_0xc62c('0x8f')](_0x5be7f0)[_0xc62c('0x9')](function(){return _0x4fc14b;});}return _0x4fc14b;});}});}}});}; \ No newline at end of file +var _0x36f7=['whatsappaccounts','teams','voicequeues','users','agents','telephones','User','Users','user','Agents','Telephones','zendeskaccounts','ZendeskAccount','salesforceaccounts','SalesforceAccount','freshdeskaccounts','FreshdeskAccount','sugarcrmaccounts','SugarcrmAccount','deskaccounts','DeskAccount','zohoaccounts','ZohoAccount','vtigeraccounts','dispositions','customdashboards','intervals','Interval','pauses','Pause','scheduler','Sound','Tag','triggers','Trigger','trunks','Trunk','variables','plugins','extractedreports','reportId','metrics','AnalyticMetric','charAt','toUpperCase','SELECT','ui.','InteractionId','from','sequelize','OpenTabs','define','UserProfile','user_profiles','../../components/parsers/qs','raw','query','section','mergeResources','push','UserProfileSection','params','ignore','isEmpty','union','length','find','autoAssociation','all','rawAttributes','keys','filters','attributes','intersection','fields','limit','offset','order','sort','where','pick','merge','key','VIRTUAL','foreignKey','forEach','options','include','default','count','rows','ids','customSorting','extraQueryConditions','includeAll','color','tag','ThroughTags','openTabs','true','dataValues','mail','whatsapp','lodash','squel','exports','filter','field','value','findAll','then','associatedResources','catch','model','map','name','resolve','UserProfileResource','AnalyticExtractedReport','resourceId','childModel','odbc','SquareOdbc','squarerecordings','SquareRecording','parentSections','SquareProjects','projectName','projects','JscriptyProject','contacts','CmContact','lists','CmList','companies','CmCompany','chatqueues','ChatQueue','ChatWebsite','faxqueues','FaxQueue','FaxAccount','inboundroutes','VoiceExtension','contexts','VoiceContext','voicemails','VoiceMail','voicerecordings','VoiceRecording','agent','membername','role','VoiceQueues','type','inbound','QueueCampaigns','queue','VoiceQueue','musiconholds','chanspies','VoiceChanSpy','voiceprefixes','VoicePrefix','ivrcampaigns','Campaign','mailqueues','MailQueue','MailSubstatus','openchannelqueues','OpenchannelQueue','openchannelaccounts','OpenchannelAccount','smsqueues','smsaccounts','whatsappqueues','WhatsappQueue'];(function(_0x54b9c6,_0x2c697e){var _0x251824=function(_0x269f7c){while(--_0x269f7c){_0x54b9c6['push'](_0x54b9c6['shift']());}};_0x251824(++_0x2c697e);}(_0x36f7,0x1c9));var _0x736f=function(_0x44ee77,_0x4335dd){_0x44ee77=_0x44ee77-0x0;var _0x3a9657=_0x36f7[_0x44ee77];return _0x3a9657;};'use strict';var _=require(_0x736f('0x0'));var attributes=require('./userProfile.attributes');var squel=require(_0x736f('0x1'));module[_0x736f('0x2')]=function(_0x4d2663){var _0x2a1714=_0x4d2663['models'];function _0x21541a(_0x4295a7,_0x58267c){return new Promise(function(_0x5b60e4,_0x4761e1){if(!_0x58267c)return _0x5b60e4(null);var _0x343f82=_0x58267c['filter']?{[_0x58267c[_0x736f('0x3')][_0x736f('0x4')]]:_0x58267c[_0x736f('0x3')][_0x736f('0x5')]}:undefined;return _0x2a1714[_0x4295a7][_0x736f('0x6')]({'where':_0x343f82,'raw':!![]})[_0x736f('0x7')](function(_0x491cc9){_0x58267c[_0x736f('0x8')]=_['map'](_0x491cc9,'id');_0x5b60e4(_0x58267c);})[_0x736f('0x9')](function(_0x57e8d1){_0x4761e1(_0x57e8d1);});});}function _0x665189(_0x213f6,_0x5cef47){return new Promise(function(_0x172d35,_0x872072){var _0x444c43=_0x213f6[_0x736f('0x3')]?{[_0x213f6[_0x736f('0x3')][_0x736f('0x4')]]:_0x213f6['filter'][_0x736f('0x5')]}:undefined;return _0x2a1714[_0x213f6[_0x736f('0xa')]][_0x736f('0x6')]({'where':_0x444c43,'raw':!![]})[_0x736f('0x7')](function(_0x535829){_0x5cef47[_0x736f('0x8')]=_[_0x736f('0xb')](_0x535829,function(_0x2a98d6){return _0x2a98d6[_0x736f('0xc')];});_0x172d35(_0x5cef47);})[_0x736f('0x9')](function(_0x289c79){_0x872072(_0x289c79);});});}function _0x4946e0(_0x165aa3,_0x4c86cf,_0x258272){if(!_0x4c86cf)return Promise[_0x736f('0xd')](null);return new Promise(function(_0x484250,_0x1afdc9){return _0x2a1714[_0x736f('0xe')][_0x736f('0x6')]({'where':{'sectionId':_0x4c86cf['id']},'raw':!![]})['then'](function(_0x31b622){if(_0x165aa3[_0x736f('0x4')]&&_0x165aa3[_0x736f('0x4')]!=='id'){_0x4c86cf[_0x736f('0x8')]=_[_0x736f('0xb')](_0x31b622,function(_0x50b933){return _0x50b933[_0x165aa3[_0x736f('0x4')]];});}else{if(_0x258272===_0x736f('0xf')){_0x4c86cf[_0x736f('0x8')]=_[_0x736f('0xb')](_0x31b622,function(_0x1882d4){return{'id':_0x1882d4[_0x736f('0x10')],'type':_0x1882d4['type']};});}else{_0x4c86cf[_0x736f('0x8')]=_[_0x736f('0xb')](_0x31b622,function(_0x213925){return _0x213925[_0x736f('0x10')];});}}_0x484250(_0x4c86cf);})['catch'](function(_0x4897b2){_0x1afdc9(_0x4897b2);});});}function _0x11b200(_0x5db2aa,_0x1cd47d){var _0x2519e0={'parentSections':[]};switch(_0x5db2aa['toLowerCase']()){case'squareprojects':_0x2519e0[_0x736f('0x11')]='SquareProject';break;case _0x736f('0x12'):_0x2519e0[_0x736f('0x11')]=_0x736f('0x13');break;case _0x736f('0x14'):_0x2519e0[_0x736f('0x11')]=_0x736f('0x15');_0x2519e0[_0x736f('0x16')]=[{'name':_0x736f('0x17'),'field':'name','foreignKey':_0x736f('0x18')}];break;case _0x736f('0x19'):_0x2519e0[_0x736f('0x11')]=_0x736f('0x1a');break;case _0x736f('0x1b'):_0x2519e0[_0x736f('0x11')]=_0x736f('0x1c');_0x2519e0['parentSections']=[{'name':'Lists','field':'id','foreignKey':'ListId'}];break;case _0x736f('0x1d'):_0x2519e0['childModel']=_0x736f('0x1e');break;case _0x736f('0x1f'):_0x2519e0[_0x736f('0x11')]=_0x736f('0x20');break;case'globalcustomfields':_0x2519e0[_0x736f('0x11')]='CmCustomField';break;case _0x736f('0x21'):_0x2519e0[_0x736f('0x11')]=_0x736f('0x22');break;case'chatwebsites':_0x2519e0['childModel']=_0x736f('0x23');break;case _0x736f('0x24'):_0x2519e0[_0x736f('0x11')]=_0x736f('0x25');break;case'faxaccounts':_0x2519e0['childModel']=_0x736f('0x26');break;case _0x736f('0x27'):case'internalroutes':case'outboundroutes':_0x2519e0[_0x736f('0x11')]=_0x736f('0x28');break;case _0x736f('0x29'):_0x2519e0['childModel']=_0x736f('0x2a');break;case _0x736f('0x2b'):_0x2519e0[_0x736f('0x11')]=_0x736f('0x2c');break;case _0x736f('0x2d'):_0x2519e0[_0x736f('0x11')]=_0x736f('0x2e');_0x2519e0[_0x736f('0x16')]=[{'name':'Agents','field':'name','foreignKey':'membername','model':'User','filter':{'field':'role','value':[_0x736f('0x2f')]}},{'name':'Telephones','field':_0x736f('0xc'),'foreignKey':_0x736f('0x30'),'model':'User','filter':{'field':_0x736f('0x31'),'value':['telephone']}},{'name':_0x736f('0x32'),'field':_0x736f('0xc'),'foreignKey':'queue','model':'VoiceQueue','filter':{'field':_0x736f('0x33'),'value':[_0x736f('0x34')]}},{'name':_0x736f('0x35'),'field':_0x736f('0xc'),'foreignKey':_0x736f('0x36'),'model':_0x736f('0x37'),'filter':{'field':'type','value':['outbound']}}];break;case _0x736f('0x38'):_0x2519e0[_0x736f('0x11')]='VoiceMusicOnHold';break;case _0x736f('0x39'):_0x2519e0[_0x736f('0x11')]=_0x736f('0x3a');break;case _0x736f('0x3b'):_0x2519e0[_0x736f('0x11')]=_0x736f('0x3c');break;case _0x736f('0x3d'):_0x2519e0[_0x736f('0x11')]=_0x736f('0x3e');break;case _0x736f('0x3f'):_0x2519e0[_0x736f('0x11')]=_0x736f('0x40');break;case'mailaccounts':_0x2519e0[_0x736f('0x11')]='MailAccount';break;case'mailsubstatuses':_0x2519e0[_0x736f('0x11')]=_0x736f('0x41');break;case _0x736f('0x42'):_0x2519e0[_0x736f('0x11')]=_0x736f('0x43');break;case _0x736f('0x44'):_0x2519e0[_0x736f('0x11')]=_0x736f('0x45');break;case _0x736f('0x46'):_0x2519e0[_0x736f('0x11')]='SmsQueue';break;case _0x736f('0x47'):_0x2519e0[_0x736f('0x11')]='SmsAccount';break;case _0x736f('0x48'):_0x2519e0[_0x736f('0x11')]=_0x736f('0x49');break;case _0x736f('0x4a'):_0x2519e0[_0x736f('0x11')]='WhatsappAccount';break;case _0x736f('0x4b'):_0x2519e0[_0x736f('0x11')]='Team';break;case _0x736f('0x4c'):case'queuecampaigns':_0x2519e0[_0x736f('0x11')]=_0x736f('0x37');if(_0x1cd47d){_0x2519e0[_0x736f('0x16')]=[{'name':_0x736f('0x32')},{'name':_0x736f('0x35')}];}break;case _0x736f('0x4d'):case _0x736f('0x4e'):case _0x736f('0x4f'):_0x2519e0['childModel']=_0x736f('0x50');if(_0x1cd47d){_0x2519e0[_0x736f('0x16')]=[{'name':_0x736f('0x51'),'filter':{'field':'role','value':['admin',_0x736f('0x52')]},'ignore':!![]},{'name':_0x736f('0x53')},{'name':_0x736f('0x54')}];}break;case _0x736f('0x55'):_0x2519e0['childModel']=_0x736f('0x56');break;case _0x736f('0x57'):_0x2519e0[_0x736f('0x11')]=_0x736f('0x58');break;case _0x736f('0x59'):_0x2519e0[_0x736f('0x11')]=_0x736f('0x5a');break;case _0x736f('0x5b'):_0x2519e0[_0x736f('0x11')]=_0x736f('0x5c');break;case _0x736f('0x5d'):_0x2519e0[_0x736f('0x11')]=_0x736f('0x5e');break;case _0x736f('0x5f'):_0x2519e0[_0x736f('0x11')]=_0x736f('0x60');break;case _0x736f('0x61'):_0x2519e0[_0x736f('0x11')]=_0x736f('0x50');break;case'cannedanswers':_0x2519e0[_0x736f('0x11')]='CannedAnswer';break;case _0x736f('0x62'):_0x2519e0[_0x736f('0x11')]='Disposition';break;case _0x736f('0x63'):_0x2519e0[_0x736f('0x11')]='Dashboard';break;case _0x736f('0x64'):_0x2519e0[_0x736f('0x11')]=_0x736f('0x65');break;case _0x736f('0x66'):_0x2519e0[_0x736f('0x11')]=_0x736f('0x67');break;case _0x736f('0x68'):_0x2519e0[_0x736f('0x11')]='Schedule';break;case'sounds':_0x2519e0['childModel']=_0x736f('0x69');break;case'tags':_0x2519e0[_0x736f('0x11')]=_0x736f('0x6a');break;case'templates':_0x2519e0[_0x736f('0x11')]='Template';break;case _0x736f('0x6b'):_0x2519e0[_0x736f('0x11')]=_0x736f('0x6c');break;case _0x736f('0x6d'):_0x2519e0[_0x736f('0x11')]=_0x736f('0x6e');break;case _0x736f('0x6f'):_0x2519e0['childModel']='Variable';break;case _0x736f('0x70'):_0x2519e0[_0x736f('0x11')]='Plugin';break;case _0x736f('0x71'):_0x2519e0[_0x736f('0x11')]='AnalyticExtractedReport';_0x2519e0[_0x736f('0x16')]=[{'name':'Reports','field':'id','foreignKey':_0x736f('0x72')}];break;case _0x736f('0x73'):_0x2519e0['childModel']=_0x736f('0x74');break;}return _0x2519e0;}function _0xc748da(_0x560374,_0x4654d0){var _0x513fd3=_0x560374[_0x736f('0x75')](0x0)[_0x736f('0x76')]()+_0x560374['slice'](0x1);var _0x2fb35c={'type':_0x2a1714['Sequelize']['QueryTypes'][_0x736f('0x77')],'raw':!![]};return new Promise(function(_0x2f5ae8,_0x5a04ce){var _0x4de1c9=squel['select']()[_0x736f('0x4')](_0x736f('0x78')+_0x513fd3+_0x736f('0x79'),'id')[_0x736f('0x4')]('ui.createdAt')[_0x736f('0x7a')]('user_has_'+_0x560374+'_interactions','ui')['where']('ui.UserId\x20=\x20?',_0x4654d0['id']);return _0x2a1714[_0x736f('0x7b')]['query'](_0x4de1c9['toString'](),_0x2fb35c)[_0x736f('0x7')](function(_0x227b36){_0x4654d0[_0x513fd3+_0x736f('0x7c')]=_0x227b36;_0x2f5ae8(_0x227b36);})[_0x736f('0x9')](function(_0x7004a7){_0x5a04ce(_0x7004a7);});});}return _0x4d2663[_0x736f('0x7d')](_0x736f('0x7e'),attributes,{'tableName':_0x736f('0x7f'),'paranoid':![],'indexes':[],'timestamps':!![],'classMethods':{'getResources':function(_0x2728ff){var _0x2ab78a=require(_0x736f('0x80'));var _0x20ed25={'raw':_0x2728ff['query'][_0x736f('0x81')],'where':{}};var _0x561c22={};var _0x334a78={'count':0x0,'rows':[]};var _0x42d98a=_0x2728ff[_0x736f('0x82')][_0x736f('0x83')];var _0x568355=_0x2728ff['query'][_0x736f('0x84')]||![];var _0x290e0d=_0x11b200(_0x42d98a,_0x568355);if(!_0x290e0d[_0x736f('0x11')])throw new Error('Invalid\x20section\x20\x27'+_0x42d98a+'\x27');var _0x37bee8=[{'name':_0x42d98a}];if(!_['isEmpty'](_0x290e0d[_0x736f('0x16')]))_0x37bee8=_0x290e0d[_0x736f('0x16')];var _0x2b5a2b=[];for(var _0x306d8b=0x0;_0x306d8b<_0x37bee8['length'];_0x306d8b++){_0x2b5a2b[_0x736f('0x85')](_0x2a1714[_0x736f('0x86')]['find']({'where':{'userProfileId':_0x2728ff[_0x736f('0x87')]['id'],'name':_0x37bee8[_0x306d8b]['name']},'raw':!![]}));}return Promise['all'](_0x2b5a2b)[_0x736f('0x7')](function(_0x1b2a6e){var _0x18ec29=_[_0x736f('0x3')](_0x1b2a6e,function(_0x83958f){return _0x83958f?_0x83958f:undefined;});var _0x78e8d=_[_0x736f('0x3')](_0x37bee8,[_0x736f('0x88'),!![]]);var _0x3c158e=_[_0x736f('0x89')](_0x18ec29)&&_[_0x736f('0x89')](_0x78e8d)?null:_[_0x736f('0x8a')](_0x78e8d,_0x18ec29);if(!_0x3c158e)return null;var _0x34cad5=[];for(var _0x192002=0x0;_0x192002<_0x3c158e[_0x736f('0x8b')];_0x192002++){var _0xdea31c=_[_0x736f('0x8c')](_0x37bee8,function(_0xac8178){return _0x3c158e[_0x192002]?_0xac8178[_0x736f('0xc')]===_0x3c158e[_0x192002][_0x736f('0xc')]:null;});if(_0xdea31c){if(_0x3c158e[_0x192002][_0x736f('0x88')]){_0x34cad5[_0x736f('0x85')](_0x21541a(_0x290e0d[_0x736f('0x11')],_0x3c158e[_0x192002]));}else{if(!_0x3c158e[_0x192002][_0x736f('0x8d')]){_0x34cad5[_0x736f('0x85')](_0x4946e0(_0xdea31c,_0x3c158e[_0x192002],_0x290e0d['childModel']));}else{if(_0xdea31c[_0x736f('0xa')]){_0x34cad5[_0x736f('0x85')](_0x665189(_0xdea31c,_0x3c158e[_0x192002]));}}}}}return Promise[_0x736f('0x8e')](_0x34cad5);})[_0x736f('0x7')](function(_0x5a4736){var _0x463af7=_0x5a4736;var _0x38fa93=null;if(_0x463af7){_0x38fa93=_0x463af7['length']===0x1?_0x463af7[0x0]:null;}if(!_0x38fa93&&!_0x463af7)return _0x334a78;var _0x3a7ab7=_0x2a1714[_0x290e0d[_0x736f('0x11')]][_0x736f('0x8f')];_0x561c22[_0x736f('0xa')]=_['keys'](_0x3a7ab7);_0x561c22[_0x736f('0x82')]=_[_0x736f('0x90')](_0x2728ff['query']);_0x561c22[_0x736f('0x91')]=_['intersection'](_0x561c22[_0x736f('0xa')],_0x561c22[_0x736f('0x82')]);_0x20ed25[_0x736f('0x92')]=_[_0x736f('0x93')](_0x561c22[_0x736f('0xa')],_0x2ab78a[_0x736f('0x94')](_0x2728ff[_0x736f('0x82')]['fields']));_0x20ed25[_0x736f('0x92')]=_0x20ed25['attributes'][_0x736f('0x8b')]?_0x20ed25[_0x736f('0x92')]:_0x561c22['model'];if(!_0x2728ff[_0x736f('0x82')]['hasOwnProperty']('nolimit')){_0x20ed25[_0x736f('0x95')]=_0x2ab78a['limit'](_0x2728ff['query'][_0x736f('0x95')]);_0x20ed25[_0x736f('0x96')]=_0x2ab78a['offset'](_0x2728ff['query']['offset']);}_0x20ed25[_0x736f('0x97')]=_0x2ab78a['sort'](_0x2728ff['query'][_0x736f('0x98')]);_0x20ed25[_0x736f('0x99')]=_0x2ab78a[_0x736f('0x91')](_[_0x736f('0x9a')](_0x2728ff['query'],_0x561c22[_0x736f('0x91')]));if(_0x2728ff['query']['filter']){_0x20ed25['where']=_[_0x736f('0x9b')](_0x20ed25[_0x736f('0x99')],{'$or':_[_0x736f('0xb')](_0x3a7ab7,function(_0x40d88d){if(_0x40d88d[_0x736f('0x33')][_0x736f('0x9c')]!==_0x736f('0x9d')){var _0x4f6ef4={};_0x4f6ef4[_0x40d88d[_0x736f('0x4')]]={'$like':'%'+_0x2728ff[_0x736f('0x82')][_0x736f('0x3')]+'%'};return _0x4f6ef4;}})});}var _0x381f95=[];var _0x5ddeb3=null;var _0x3db650={};if(_0x38fa93){_0x5ddeb3=_[_0x736f('0x8c')](_0x37bee8,[_0x736f('0xc'),_0x38fa93[_0x736f('0xc')]]);if(_0x5ddeb3[_0x736f('0x4')]){_0x3db650={};if(_0x290e0d[_0x736f('0x11')]==='AnalyticExtractedReport'){_0x3db650[_0x5ddeb3[_0x736f('0x9e')]]=_[_0x736f('0xb')](_0x38fa93['associatedResources'],'id');}else{_0x3db650[_0x5ddeb3[_0x736f('0x9e')]]=_0x38fa93[_0x736f('0x8')];}_0x381f95[_0x736f('0x85')](_0x3db650);}else{_0x20ed25['where']['id']=_0x38fa93[_0x736f('0x8')];}}else{for(var _0x47d4a6=0x0;_0x47d4a6<_0x463af7[_0x736f('0x8b')];_0x47d4a6++){_0x5ddeb3=_[_0x736f('0x8c')](_0x37bee8,['name',_0x463af7[_0x47d4a6]['name']]);if(_0x5ddeb3[_0x736f('0x4')]){_0x3db650={};_0x3db650[_0x5ddeb3[_0x736f('0x9e')]]=_0x463af7[_0x47d4a6][_0x736f('0x8')];_0x381f95[_0x736f('0x85')](_0x3db650);}else{if(!_0x20ed25['where']['id'])_0x20ed25[_0x736f('0x99')]['id']=[];_0x463af7[_0x47d4a6][_0x736f('0x8')][_0x736f('0x9f')](function(_0xe90df2){_0x20ed25[_0x736f('0x99')]['id'][_0x736f('0x85')](_0xe90df2);});}}}if(!_['isEmpty'](_0x381f95)){_0x20ed25[_0x736f('0x99')]=_['merge'](_0x20ed25[_0x736f('0x99')],{'$and':{'$or':_0x381f95}});}_0x20ed25=_['merge']({},_0x20ed25,_0x2728ff[_0x736f('0xa0')]);if(_0x38fa93&&!_0x38fa93['autoAssociation']&&_0x290e0d[_0x736f('0x11')]==='AnalyticExtractedReport'){if(_0x2728ff[_0x736f('0x82')]['includeAll']){_0x20ed25[_0x736f('0xa1')]=[{'all':!![]}];}return _0x2a1714[_0x290e0d[_0x736f('0x11')]][_0x736f('0x6')](_0x20ed25)[_0x736f('0x7')](function(_0x4868cd){var _0x28504a=[];_0x4868cd[_0x736f('0x9f')](function(_0x1b8a39){var _0x4596c2;switch(_0x1b8a39['reportType']){case _0x736f('0xa2'):_0x4596c2=_['find'](_0x38fa93[_0x736f('0x8')],function(_0x4dce3d){return _0x4dce3d['id']===_0x1b8a39[_0x736f('0x72')]&&_0x4dce3d[_0x736f('0x33')]==='DefaultReports';});break;case'custom':_0x4596c2=_[_0x736f('0x8c')](_0x38fa93[_0x736f('0x8')],function(_0x320fa1){return _0x320fa1['id']===_0x1b8a39['reportId']&&_0x320fa1[_0x736f('0x33')]==='CustomReports';});break;}if(_0x4596c2)_0x28504a['push'](_0x1b8a39);});_0x334a78[_0x736f('0xa3')]=_0x28504a[_0x736f('0x8b')];_0x334a78[_0x736f('0xa4')]=_0x28504a;return _0x334a78;});}else{if(!_[_0x736f('0x89')](_0x2728ff['query'][_0x736f('0xa5')])){_0x20ed25[_0x736f('0x99')]['id']=_0x20ed25[_0x736f('0x99')]['id']?_['intersection'](_0x20ed25[_0x736f('0x99')]['id'],_0x2728ff['query'][_0x736f('0xa5')]):_0x2728ff[_0x736f('0x82')][_0x736f('0xa5')];if(_0x2728ff[_0x736f('0x82')][_0x736f('0xa6')]){_0x20ed25[_0x736f('0x97')]=_0x2728ff[_0x736f('0x82')][_0x736f('0xa6')];}}if(_0x2728ff['query'][_0x736f('0xa7')]){_0x20ed25[_0x736f('0x99')]=_[_0x736f('0x9b')](_0x20ed25[_0x736f('0x99')],{'$and':_0x2728ff[_0x736f('0x82')][_0x736f('0xa7')]});}return _0x2a1714[_0x290e0d[_0x736f('0x11')]][_0x736f('0xa3')]({'where':_0x20ed25[_0x736f('0x99')]})['then'](function(_0x517205){_0x334a78[_0x736f('0xa3')]=_0x517205;if(_0x2728ff[_0x736f('0x82')][_0x736f('0xa8')]){if(_0x290e0d[_0x736f('0x11')]==='CmContact'){_0x20ed25[_0x736f('0xa1')]=[{'model':_0x2a1714[_0x736f('0x6a')],'as':'Tags','attributes':['id',_0x736f('0xc'),_0x736f('0xa9')],'required':_0x2728ff['query'][_0x736f('0xaa')]?!![]:![]},{'model':_0x2a1714[_0x736f('0x6a')],'as':_0x736f('0xab'),'attributes':['id',_0x736f('0xc'),'color'],'through':_0x2728ff[_0x736f('0x82')][_0x736f('0xaa')]?{'attributes':[],'where':{'TagId':_0x2728ff[_0x736f('0x82')][_0x736f('0xaa')]||undefined}}:{},'required':_0x2728ff['query'][_0x736f('0xaa')]?!![]:![]}];}else{_0x20ed25['include']=[{'all':!![]}];}}return _0x2a1714[_0x290e0d[_0x736f('0x11')]]['findAll'](_0x20ed25);})[_0x736f('0x7')](function(_0x151023){_0x334a78['rows']=_0x151023;if(_0x42d98a===_0x736f('0x53')&&_0x2728ff['query'][_0x736f('0xac')]===_0x736f('0xad')){var _0x5a7cbd=[];for(var _0x4e0271=0x0;_0x4e0271<_0x334a78['rows']['length'];_0x4e0271++){_0x5a7cbd[_0x736f('0x85')](_0xc748da('chat',_0x334a78[_0x736f('0xa4')][_0x4e0271][_0x736f('0xae')]));_0x5a7cbd['push'](_0xc748da('sms',_0x334a78['rows'][_0x4e0271]['dataValues']));_0x5a7cbd[_0x736f('0x85')](_0xc748da('fax',_0x334a78[_0x736f('0xa4')][_0x4e0271][_0x736f('0xae')]));_0x5a7cbd['push'](_0xc748da(_0x736f('0xaf'),_0x334a78[_0x736f('0xa4')][_0x4e0271][_0x736f('0xae')]));_0x5a7cbd[_0x736f('0x85')](_0xc748da('openchannel',_0x334a78[_0x736f('0xa4')][_0x4e0271][_0x736f('0xae')]));_0x5a7cbd['push'](_0xc748da(_0x736f('0xb0'),_0x334a78['rows'][_0x4e0271][_0x736f('0xae')]));}return Promise[_0x736f('0x8e')](_0x5a7cbd)['then'](function(){return _0x334a78;});}return _0x334a78;});}});}}});}; \ No newline at end of file diff --git a/server/api/userProfile/userProfile.rpc.js b/server/api/userProfile/userProfile.rpc.js index 339ae86..81e85b0 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 _0x1419=['info','UserProfile,\x20%s,\x20%s','debug','UserProfile,\x20%s,\x20%s,\x20%s','request\x20sent','stringify','error','message','result','lodash','util','moment','bluebird','randomstring','../../config/utils','../../config/logger','jayson/promise','client','http','redis','defaults','localhost','socket.io-emitter','./userProfile.socket','request','then'];(function(_0x4808f4,_0x8a03ba){var _0x12dd7f=function(_0x396f5f){while(--_0x396f5f){_0x4808f4['push'](_0x4808f4['shift']());}};_0x12dd7f(++_0x8a03ba);}(_0x1419,0x127));var _0x9141=function(_0x47e87b,_0x2eff4f){_0x47e87b=_0x47e87b-0x0;var _0x5cc652=_0x1419[_0x47e87b];return _0x5cc652;};'use strict';var _=require(_0x9141('0x0'));var util=require(_0x9141('0x1'));var moment=require(_0x9141('0x2'));var BPromise=require(_0x9141('0x3'));var rs=require(_0x9141('0x4'));var fs=require('fs');var Redis=require('ioredis');var db=require('../../mysqldb')['db'];var utils=require(_0x9141('0x5'));var logger=require(_0x9141('0x6'))('rpc');var config=require('../../config/environment');var jayson=require(_0x9141('0x7'));var client=jayson[_0x9141('0x8')][_0x9141('0x9')]({'port':0x232a});config[_0x9141('0xa')]=_[_0x9141('0xb')](config[_0x9141('0xa')],{'host':_0x9141('0xc'),'port':0x18eb});var socket=require(_0x9141('0xd'))(new Redis(config[_0x9141('0xa')]));require(_0x9141('0xe'))['register'](socket);function respondWithRpcPromise(_0xb3ee2e,_0x406153,_0x30ce0b){return new BPromise(function(_0x1de00d,_0x2d35e3){return client[_0x9141('0xf')](_0xb3ee2e,_0x30ce0b)[_0x9141('0x10')](function(_0x1847c4){logger[_0x9141('0x11')](_0x9141('0x12'),_0x406153,'request\x20sent');logger[_0x9141('0x13')](_0x9141('0x14'),_0x406153,_0x9141('0x15'),JSON[_0x9141('0x16')](_0x1847c4));if(_0x1847c4[_0x9141('0x17')]){if(_0x1847c4[_0x9141('0x17')]['code']===0x1f4){logger['error'](_0x9141('0x12'),_0x406153,_0x1847c4[_0x9141('0x17')][_0x9141('0x18')]);return _0x2d35e3(_0x1847c4[_0x9141('0x17')][_0x9141('0x18')]);}logger[_0x9141('0x17')](_0x9141('0x12'),_0x406153,_0x1847c4[_0x9141('0x17')][_0x9141('0x18')]);return _0x1de00d(_0x1847c4['error'][_0x9141('0x18')]);}else{logger[_0x9141('0x11')]('UserProfile,\x20%s,\x20%s',_0x406153,'request\x20sent');_0x1de00d(_0x1847c4[_0x9141('0x19')]['message']);}})['catch'](function(_0x4e5a9c){logger['error'](_0x9141('0x12'),_0x406153,_0x4e5a9c);_0x2d35e3(_0x4e5a9c);});});} \ No newline at end of file +var _0x6bfc=['util','moment','bluebird','ioredis','../../config/utils','rpc','../../config/environment','jayson/promise','http','redis','defaults','localhost','socket.io-emitter','./userProfile.socket','then','request\x20sent','debug','stringify','error','code','message','UserProfile,\x20%s,\x20%s','catch'];(function(_0x1044b5,_0x33afe7){var _0x4cd7d7=function(_0x8616a7){while(--_0x8616a7){_0x1044b5['push'](_0x1044b5['shift']());}};_0x4cd7d7(++_0x33afe7);}(_0x6bfc,0x159));var _0xc6bf=function(_0x39285c,_0x25a9b9){_0x39285c=_0x39285c-0x0;var _0x4f24d0=_0x6bfc[_0x39285c];return _0x4f24d0;};'use strict';var _=require('lodash');var util=require(_0xc6bf('0x0'));var moment=require(_0xc6bf('0x1'));var BPromise=require(_0xc6bf('0x2'));var rs=require('randomstring');var fs=require('fs');var Redis=require(_0xc6bf('0x3'));var db=require('../../mysqldb')['db'];var utils=require(_0xc6bf('0x4'));var logger=require('../../config/logger')(_0xc6bf('0x5'));var config=require(_0xc6bf('0x6'));var jayson=require(_0xc6bf('0x7'));var client=jayson['client'][_0xc6bf('0x8')]({'port':0x232a});config[_0xc6bf('0x9')]=_[_0xc6bf('0xa')](config[_0xc6bf('0x9')],{'host':_0xc6bf('0xb'),'port':0x18eb});var socket=require(_0xc6bf('0xc'))(new Redis(config[_0xc6bf('0x9')]));require(_0xc6bf('0xd'))['register'](socket);function respondWithRpcPromise(_0x3beb64,_0x39aa81,_0x1cb846){return new BPromise(function(_0x343148,_0x5f2f8f){return client['request'](_0x3beb64,_0x1cb846)[_0xc6bf('0xe')](function(_0x3e9c8a){logger['info']('UserProfile,\x20%s,\x20%s',_0x39aa81,_0xc6bf('0xf'));logger[_0xc6bf('0x10')]('UserProfile,\x20%s,\x20%s,\x20%s',_0x39aa81,_0xc6bf('0xf'),JSON[_0xc6bf('0x11')](_0x3e9c8a));if(_0x3e9c8a[_0xc6bf('0x12')]){if(_0x3e9c8a[_0xc6bf('0x12')][_0xc6bf('0x13')]===0x1f4){logger['error']('UserProfile,\x20%s,\x20%s',_0x39aa81,_0x3e9c8a[_0xc6bf('0x12')][_0xc6bf('0x14')]);return _0x5f2f8f(_0x3e9c8a[_0xc6bf('0x12')][_0xc6bf('0x14')]);}logger[_0xc6bf('0x12')](_0xc6bf('0x15'),_0x39aa81,_0x3e9c8a[_0xc6bf('0x12')]['message']);return _0x343148(_0x3e9c8a[_0xc6bf('0x12')]['message']);}else{logger['info'](_0xc6bf('0x15'),_0x39aa81,_0xc6bf('0xf'));_0x343148(_0x3e9c8a['result'][_0xc6bf('0x14')]);}})[_0xc6bf('0x16')](function(_0x498c02){logger[_0xc6bf('0x12')]('UserProfile,\x20%s,\x20%s',_0x39aa81,_0x498c02);_0x5f2f8f(_0x498c02);});});} \ No newline at end of file diff --git a/server/api/userProfile/userProfile.socket.js b/server/api/userProfile/userProfile.socket.js index 45c16bc..79d714b 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 _0xf1ab=['length','userProfile:','save','remove','emit','removeListener','register'];(function(_0x4a9fb1,_0x273043){var _0x348672=function(_0x142b69){while(--_0x142b69){_0x4a9fb1['push'](_0x4a9fb1['shift']());}};_0x348672(++_0x273043);}(_0xf1ab,0x159));var _0xbf1a=function(_0x255cf3,_0x5f47c9){_0x255cf3=_0x255cf3-0x0;var _0x1a6dc5=_0xf1ab[_0x255cf3];return _0x1a6dc5;};'use strict';var UserProfileEvents=require('./userProfile.events');var events=[_0xbf1a('0x0'),_0xbf1a('0x1'),'update'];function createListener(_0x49a56d,_0x3989a7){return function(_0x54cea0){_0x3989a7[_0xbf1a('0x2')](_0x49a56d,_0x54cea0);};}function removeListener(_0x499621,_0x57ec43){return function(){UserProfileEvents[_0xbf1a('0x3')](_0x499621,_0x57ec43);};}exports[_0xbf1a('0x4')]=function(_0xba6b23){for(var _0x5f14cc=0x0,_0x300598=events[_0xbf1a('0x5')];_0x5f14cc<_0x300598;_0x5f14cc++){var _0x51d334=events[_0x5f14cc];var _0x3d532d=createListener(_0xbf1a('0x6')+_0x51d334,_0xba6b23);UserProfileEvents['on'](_0x51d334,_0x3d532d);}}; \ No newline at end of file +var _0x7238=['emit','register','length','./userProfile.events','save','remove','update'];(function(_0x153bbc,_0x449019){var _0x387901=function(_0x749c9e){while(--_0x749c9e){_0x153bbc['push'](_0x153bbc['shift']());}};_0x387901(++_0x449019);}(_0x7238,0x7a));var _0x8723=function(_0x10f6b6,_0x390cf9){_0x10f6b6=_0x10f6b6-0x0;var _0x4c3636=_0x7238[_0x10f6b6];return _0x4c3636;};'use strict';var UserProfileEvents=require(_0x8723('0x0'));var events=[_0x8723('0x1'),_0x8723('0x2'),_0x8723('0x3')];function createListener(_0x1d8145,_0x27e05d){return function(_0x1f6286){_0x27e05d[_0x8723('0x4')](_0x1d8145,_0x1f6286);};}function removeListener(_0x448189,_0x587e6c){return function(){UserProfileEvents['removeListener'](_0x448189,_0x587e6c);};}exports[_0x8723('0x5')]=function(_0x40faa6){for(var _0x38eb8c=0x0,_0x38cf9b=events[_0x8723('0x6')];_0x38eb8c<_0x38cf9b;_0x38eb8c++){var _0xd66a3=events[_0x38eb8c];var _0x1c6ac4=createListener('userProfile:'+_0xd66a3,_0x40faa6);UserProfileEvents['on'](_0xd66a3,_0x1c6ac4);}}; \ No newline at end of file diff --git a/server/api/userProfileResource/index.js b/server/api/userProfileResource/index.js index 79e9a70..94cb332 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 _0x810f=['multer','util','Router','fs-extra','../../components/auth/service','../../config/environment','get','isAuthenticated','index','/describe','describe','/:id','show','post','create','put','update','delete','destroy'];(function(_0x4a93bb,_0x495404){var _0x208468=function(_0x1d82b7){while(--_0x1d82b7){_0x4a93bb['push'](_0x4a93bb['shift']());}};_0x208468(++_0x495404);}(_0x810f,0x1ee));var _0xf810=function(_0x28d18d,_0x55896b){_0x28d18d=_0x28d18d-0x0;var _0x470640=_0x810f[_0x28d18d];return _0x470640;};'use strict';var multer=require(_0xf810('0x0'));var util=require(_0xf810('0x1'));var path=require('path');var timeout=require('connect-timeout');var express=require('express');var router=express[_0xf810('0x2')]();var fs_extra=require(_0xf810('0x3'));var auth=require(_0xf810('0x4'));var interaction=require('../../components/interaction/service');var config=require(_0xf810('0x5'));var controller=require('./userProfileResource.controller');router[_0xf810('0x6')]('/',auth[_0xf810('0x7')](),controller[_0xf810('0x8')]);router[_0xf810('0x6')](_0xf810('0x9'),auth['isAuthenticated'](),controller[_0xf810('0xa')]);router[_0xf810('0x6')](_0xf810('0xb'),auth[_0xf810('0x7')](),controller[_0xf810('0xc')]);router[_0xf810('0xd')]('/',auth[_0xf810('0x7')](),controller[_0xf810('0xe')]);router[_0xf810('0xf')](_0xf810('0xb'),auth[_0xf810('0x7')](),controller[_0xf810('0x10')]);router[_0xf810('0x11')](_0xf810('0xb'),auth['isAuthenticated'](),controller[_0xf810('0x12')]);module['exports']=router; \ No newline at end of file +var _0x4b4e=['create','put','update','delete','destroy','exports','multer','connect-timeout','express','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','./userProfileResource.controller','get','isAuthenticated','index','describe','/:id','show','post'];(function(_0x3dd15e,_0x1f0015){var _0x231fd0=function(_0x4f680a){while(--_0x4f680a){_0x3dd15e['push'](_0x3dd15e['shift']());}};_0x231fd0(++_0x1f0015);}(_0x4b4e,0x180));var _0xe4b4=function(_0x3cc4e0,_0x384674){_0x3cc4e0=_0x3cc4e0-0x0;var _0x80f02=_0x4b4e[_0x3cc4e0];return _0x80f02;};'use strict';var multer=require(_0xe4b4('0x0'));var util=require('util');var path=require('path');var timeout=require(_0xe4b4('0x1'));var express=require(_0xe4b4('0x2'));var router=express['Router']();var fs_extra=require(_0xe4b4('0x3'));var auth=require(_0xe4b4('0x4'));var interaction=require(_0xe4b4('0x5'));var config=require(_0xe4b4('0x6'));var controller=require(_0xe4b4('0x7'));router[_0xe4b4('0x8')]('/',auth[_0xe4b4('0x9')](),controller[_0xe4b4('0xa')]);router[_0xe4b4('0x8')]('/describe',auth[_0xe4b4('0x9')](),controller[_0xe4b4('0xb')]);router['get'](_0xe4b4('0xc'),auth[_0xe4b4('0x9')](),controller[_0xe4b4('0xd')]);router[_0xe4b4('0xe')]('/',auth[_0xe4b4('0x9')](),controller[_0xe4b4('0xf')]);router[_0xe4b4('0x10')](_0xe4b4('0xc'),auth['isAuthenticated'](),controller[_0xe4b4('0x11')]);router[_0xe4b4('0x12')](_0xe4b4('0xc'),auth[_0xe4b4('0x9')](),controller[_0xe4b4('0x13')]);module[_0xe4b4('0x14')]=router; \ No newline at end of file diff --git a/server/api/userProfileResource/userProfileResource.attributes.js b/server/api/userProfileResource/userProfileResource.attributes.js index 88c3487..6eff17e 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 _0xe4b5=['exports','INTEGER','sequelize'];(function(_0x3a6a63,_0x2210fb){var _0x2d85ac=function(_0x56cc0b){while(--_0x56cc0b){_0x3a6a63['push'](_0x3a6a63['shift']());}};_0x2d85ac(++_0x2210fb);}(_0xe4b5,0x125));var _0x5e4b=function(_0x24f1ac,_0x68f7fd){_0x24f1ac=_0x24f1ac-0x0;var _0x1f8ac2=_0xe4b5[_0x24f1ac];return _0x1f8ac2;};'use strict';var Sequelize=require(_0x5e4b('0x0'));module[_0x5e4b('0x1')]={'name':{'type':Sequelize['STRING'],'allowNull':![]},'resourceId':{'type':Sequelize[_0x5e4b('0x2')],'allowNull':![]},'type':{'type':Sequelize['STRING'],'allowNull':![]}}; \ No newline at end of file +var _0xd380=['STRING','sequelize','exports','INTEGER'];(function(_0x1a7a39,_0x47b900){var _0x24af5b=function(_0x170c75){while(--_0x170c75){_0x1a7a39['push'](_0x1a7a39['shift']());}};_0x24af5b(++_0x47b900);}(_0xd380,0x79));var _0x0d38=function(_0x39e7bb,_0x523400){_0x39e7bb=_0x39e7bb-0x0;var _0x4f35c3=_0xd380[_0x39e7bb];return _0x4f35c3;};'use strict';var Sequelize=require(_0x0d38('0x0'));module[_0x0d38('0x1')]={'name':{'type':Sequelize['STRING'],'allowNull':![]},'resourceId':{'type':Sequelize[_0x0d38('0x2')],'allowNull':![]},'type':{'type':Sequelize[_0x0d38('0x3')],'allowNull':![]}}; \ No newline at end of file diff --git a/server/api/userProfileResource/userProfileResource.controller.js b/server/api/userProfileResource/userProfileResource.controller.js index bfcd854..02480f3 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 _0xe2fe=['find','body','params','describe','eml-format','fast-json-patch','moment','bluebird','mustache','util','path','to-csv','ejs','lodash','squel','jsforce','querystring','ioredis','../../components/auth/service','api','../../mysqldb','sendStatus','status','offset','limit','count','set','Content-Range','json','reject','save','update','then','destroy','end','name','send','index','map','UserProfileResource','rawAttributes','type','key','keys','query','intersection','model','fields','attributes','length','hasOwnProperty','nolimit','order','sort','where','filters','pick','filter','merge','VIRTUAL','options','includeAll','include','catch','show'];(function(_0x57baa6,_0x3af298){var _0x303fbf=function(_0x24c318){while(--_0x24c318){_0x57baa6['push'](_0x57baa6['shift']());}};_0x303fbf(++_0x3af298);}(_0xe2fe,0x86));var _0xee2f=function(_0x14add3,_0x13ce8d){_0x14add3=_0x14add3-0x0;var _0x4a174f=_0xe2fe[_0x14add3];return _0x4a174f;};'use strict';var emlformat=require(_0xee2f('0x0'));var rimraf=require('rimraf');var zipdir=require('zip-dir');var jsonpatch=require(_0xee2f('0x1'));var rp=require('request-promise');var moment=require(_0xee2f('0x2'));var BPromise=require(_0xee2f('0x3'));var Mustache=require(_0xee2f('0x4'));var util=require(_0xee2f('0x5'));var path=require(_0xee2f('0x6'));var sox=require('sox');var csv=require(_0xee2f('0x7'));var ejs=require(_0xee2f('0x8'));var fs=require('fs');var fs_extra=require('fs-extra');var _=require(_0xee2f('0x9'));var squel=require(_0xee2f('0xa'));var crypto=require('crypto');var jsforce=require(_0xee2f('0xb'));var deskjs=require('desk.js');var toCsv=require(_0xee2f('0x7'));var querystring=require(_0xee2f('0xc'));var Papa=require('papaparse');var Redis=require(_0xee2f('0xd'));var authService=require(_0xee2f('0xe'));var qs=require('../../components/parsers/qs');var as=require('../../components/parsers/advancedSearch');var hardwareService=require('../../config/license/hardware');var logger=require('../../config/logger')(_0xee2f('0xf'));var utils=require('../../config/utils');var config=require('../../config/environment');var licenseUtil=require('../../config/license/util');var db=require(_0xee2f('0x10'))['db'];function respondWithStatusCode(_0x346dbc,_0xa13e7b){_0xa13e7b=_0xa13e7b||0xcc;return function(_0x100449){if(_0x100449){return _0x346dbc[_0xee2f('0x11')](_0xa13e7b);}return _0x346dbc[_0xee2f('0x12')](_0xa13e7b)['end']();};}function respondWithResult(_0x3861e6,_0x531c3a){_0x531c3a=_0x531c3a||0xc8;return function(_0x36db10){if(_0x36db10){return _0x3861e6[_0xee2f('0x12')](_0x531c3a)['json'](_0x36db10);}};}function respondWithFilteredResult(_0x445ba8,_0x145241){return function(_0x28b614){if(_0x28b614){var _0x1bbf7d=typeof _0x145241[_0xee2f('0x13')]==='undefined'&&typeof _0x145241[_0xee2f('0x14')]==='undefined';var _0x17d288=_0x28b614[_0xee2f('0x15')];var _0x502eb6=_0x1bbf7d?0x0:_0x145241['offset'];var _0x40b5bc=_0x1bbf7d?_0x28b614['count']:_0x145241[_0xee2f('0x13')]+_0x145241[_0xee2f('0x14')];var _0x28549d;if(_0x40b5bc>=_0x17d288){_0x40b5bc=_0x17d288;_0x28549d=0xc8;}else{_0x28549d=0xce;}_0x445ba8['status'](_0x28549d);return _0x445ba8[_0xee2f('0x16')](_0xee2f('0x17'),_0x502eb6+'-'+_0x40b5bc+'/'+_0x17d288)[_0xee2f('0x18')](_0x28b614);}return null;};}function patchUpdates(_0x21fdf4){return function(_0x3d892d){try{jsonpatch['apply'](_0x3d892d,_0x21fdf4,!![]);}catch(_0x5e73ad){return BPromise[_0xee2f('0x19')](_0x5e73ad);}return _0x3d892d[_0xee2f('0x1a')]();};}function saveUpdates(_0x1ea808,_0x203b2f){return function(_0x472e3b){if(_0x472e3b){return _0x472e3b[_0xee2f('0x1b')](_0x1ea808)[_0xee2f('0x1c')](function(_0x4d68d3){return _0x4d68d3;});}return null;};}function removeEntity(_0x250399,_0x2c47c5){return function(_0x15ceda){if(_0x15ceda){return _0x15ceda[_0xee2f('0x1d')]()[_0xee2f('0x1c')](function(){_0x250399[_0xee2f('0x12')](0xcc)[_0xee2f('0x1e')]();});}};}function handleEntityNotFound(_0x13013f,_0x382174){return function(_0x1e394f){if(!_0x1e394f){_0x13013f[_0xee2f('0x11')](0x194);}return _0x1e394f;};}function handleError(_0x168adc,_0x1c8454){_0x1c8454=_0x1c8454||0x1f4;return function(_0x45c4a0){logger['error'](_0x45c4a0['stack']);if(_0x45c4a0['name']){delete _0x45c4a0[_0xee2f('0x1f')];}_0x168adc[_0xee2f('0x12')](_0x1c8454)[_0xee2f('0x20')](_0x45c4a0);};}exports[_0xee2f('0x21')]=function(_0x892a4e,_0x3737fd){var _0x4d8398={},_0x3d3806={},_0x52e1fa={'count':0x0,'rows':[]};var _0x235697=_[_0xee2f('0x22')](db[_0xee2f('0x23')][_0xee2f('0x24')],function(_0x3ddbe3){return{'name':_0x3ddbe3['fieldName'],'type':_0x3ddbe3[_0xee2f('0x25')][_0xee2f('0x26')]};});_0x3d3806['model']=_['map'](_0x235697,_0xee2f('0x1f'));_0x3d3806['query']=_[_0xee2f('0x27')](_0x892a4e[_0xee2f('0x28')]);_0x3d3806['filters']=_[_0xee2f('0x29')](_0x3d3806['model'],_0x3d3806['query']);_0x4d8398['attributes']=_[_0xee2f('0x29')](_0x3d3806[_0xee2f('0x2a')],qs['fields'](_0x892a4e[_0xee2f('0x28')][_0xee2f('0x2b')]));_0x4d8398[_0xee2f('0x2c')]=_0x4d8398[_0xee2f('0x2c')][_0xee2f('0x2d')]?_0x4d8398['attributes']:_0x3d3806[_0xee2f('0x2a')];if(!_0x892a4e['query'][_0xee2f('0x2e')](_0xee2f('0x2f'))){_0x4d8398[_0xee2f('0x14')]=qs['limit'](_0x892a4e[_0xee2f('0x28')]['limit']);_0x4d8398[_0xee2f('0x13')]=qs['offset'](_0x892a4e[_0xee2f('0x28')][_0xee2f('0x13')]);}_0x4d8398[_0xee2f('0x30')]=qs[_0xee2f('0x31')](_0x892a4e[_0xee2f('0x28')][_0xee2f('0x31')]);_0x4d8398[_0xee2f('0x32')]=qs[_0xee2f('0x33')](_[_0xee2f('0x34')](_0x892a4e[_0xee2f('0x28')],_0x3d3806[_0xee2f('0x33')]),_0x235697);if(_0x892a4e['query'][_0xee2f('0x35')]){_0x4d8398['where']=_[_0xee2f('0x36')](_0x4d8398[_0xee2f('0x32')],{'$or':_[_0xee2f('0x22')](_0x235697,function(_0x2cbb89){if(_0x2cbb89[_0xee2f('0x25')]!==_0xee2f('0x37')){var _0x694950={};_0x694950[_0x2cbb89[_0xee2f('0x1f')]]={'$like':'%'+_0x892a4e['query']['filter']+'%'};return _0x694950;}})});}_0x4d8398=_['merge']({},_0x4d8398,_0x892a4e[_0xee2f('0x38')]);var _0x5483ae={'where':_0x4d8398[_0xee2f('0x32')]};return db['UserProfileResource']['count'](_0x5483ae)['then'](function(_0x58e361){_0x52e1fa[_0xee2f('0x15')]=_0x58e361;if(_0x892a4e[_0xee2f('0x28')][_0xee2f('0x39')]){_0x4d8398[_0xee2f('0x3a')]=[{'all':!![]}];}return db['UserProfileResource']['findAll'](_0x4d8398);})[_0xee2f('0x1c')](function(_0x5e12b7){_0x52e1fa['rows']=_0x5e12b7;return _0x52e1fa;})[_0xee2f('0x1c')](respondWithFilteredResult(_0x3737fd,_0x4d8398))[_0xee2f('0x3b')](handleError(_0x3737fd,null));};exports[_0xee2f('0x3c')]=function(_0x54130b,_0x3bc173){var _0x27c447={'raw':![],'where':{'id':_0x54130b['params']['id']}},_0x19bd4d={};_0x19bd4d['model']=_[_0xee2f('0x27')](db[_0xee2f('0x23')][_0xee2f('0x24')]);_0x19bd4d[_0xee2f('0x28')]=_['keys'](_0x54130b[_0xee2f('0x28')]);_0x19bd4d[_0xee2f('0x33')]=_[_0xee2f('0x29')](_0x19bd4d[_0xee2f('0x2a')],_0x19bd4d[_0xee2f('0x28')]);_0x27c447[_0xee2f('0x2c')]=_[_0xee2f('0x29')](_0x19bd4d[_0xee2f('0x2a')],qs[_0xee2f('0x2b')](_0x54130b[_0xee2f('0x28')]['fields']));_0x27c447['attributes']=_0x27c447['attributes']['length']?_0x27c447[_0xee2f('0x2c')]:_0x19bd4d[_0xee2f('0x2a')];if(_0x54130b[_0xee2f('0x28')][_0xee2f('0x39')]){_0x27c447[_0xee2f('0x3a')]=[{'all':!![]}];}_0x27c447=_['merge']({},_0x27c447,_0x54130b[_0xee2f('0x38')]);return db[_0xee2f('0x23')][_0xee2f('0x3d')](_0x27c447)[_0xee2f('0x1c')](handleEntityNotFound(_0x3bc173,null))['then'](respondWithResult(_0x3bc173,null))['catch'](handleError(_0x3bc173,null));};exports['create']=function(_0x1609f0,_0x54cc44){return db['UserProfileResource']['create'](_0x1609f0['body'],{})[_0xee2f('0x1c')](respondWithResult(_0x54cc44,0xc9))[_0xee2f('0x3b')](handleError(_0x54cc44,null));};exports[_0xee2f('0x1b')]=function(_0x584383,_0x22506e){if(_0x584383['body']['id']){delete _0x584383[_0xee2f('0x3e')]['id'];}return db[_0xee2f('0x23')][_0xee2f('0x3d')]({'where':{'id':_0x584383[_0xee2f('0x3f')]['id']}})[_0xee2f('0x1c')](handleEntityNotFound(_0x22506e,null))['then'](saveUpdates(_0x584383['body'],null))[_0xee2f('0x1c')](respondWithResult(_0x22506e,null))['catch'](handleError(_0x22506e,null));};exports[_0xee2f('0x1d')]=function(_0x282e89,_0x1928f8){return db[_0xee2f('0x23')]['find']({'where':{'id':_0x282e89['params']['id']}})[_0xee2f('0x1c')](handleEntityNotFound(_0x1928f8,null))[_0xee2f('0x1c')](removeEntity(_0x1928f8,null))[_0xee2f('0x3b')](handleError(_0x1928f8,null));};exports[_0xee2f('0x40')]=function(_0x3acae6,_0x2a450f){return db[_0xee2f('0x23')][_0xee2f('0x40')]()[_0xee2f('0x1c')](respondWithResult(_0x2a450f,null))[_0xee2f('0x3b')](handleError(_0x2a450f,null));}; \ No newline at end of file +var _0x7880=['destroy','error','stack','name','send','index','UserProfileResource','rawAttributes','fieldName','type','key','model','map','query','filters','intersection','attributes','fields','hasOwnProperty','nolimit','order','sort','pick','filter','merge','VIRTUAL','include','findAll','rows','catch','show','params','keys','options','find','create','body','describe','rimraf','zip-dir','fast-json-patch','request-promise','moment','bluebird','util','path','sox','to-csv','ejs','fs-extra','lodash','squel','crypto','jsforce','papaparse','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','status','end','offset','undefined','count','limit','set','json','apply','reject','save','update','then'];(function(_0x51eb77,_0x436673){var _0x4b26fe=function(_0x4db9dc){while(--_0x4db9dc){_0x51eb77['push'](_0x51eb77['shift']());}};_0x4b26fe(++_0x436673);}(_0x7880,0x1f4));var _0x0788=function(_0x525673,_0xb429c2){_0x525673=_0x525673-0x0;var _0x8f7574=_0x7880[_0x525673];return _0x8f7574;};'use strict';var emlformat=require('eml-format');var rimraf=require(_0x0788('0x0'));var zipdir=require(_0x0788('0x1'));var jsonpatch=require(_0x0788('0x2'));var rp=require(_0x0788('0x3'));var moment=require(_0x0788('0x4'));var BPromise=require(_0x0788('0x5'));var Mustache=require('mustache');var util=require(_0x0788('0x6'));var path=require(_0x0788('0x7'));var sox=require(_0x0788('0x8'));var csv=require(_0x0788('0x9'));var ejs=require(_0x0788('0xa'));var fs=require('fs');var fs_extra=require(_0x0788('0xb'));var _=require(_0x0788('0xc'));var squel=require(_0x0788('0xd'));var crypto=require(_0x0788('0xe'));var jsforce=require(_0x0788('0xf'));var deskjs=require('desk.js');var toCsv=require(_0x0788('0x9'));var querystring=require('querystring');var Papa=require(_0x0788('0x10'));var Redis=require('ioredis');var authService=require(_0x0788('0x11'));var qs=require(_0x0788('0x12'));var as=require(_0x0788('0x13'));var hardwareService=require(_0x0788('0x14'));var logger=require(_0x0788('0x15'))('api');var utils=require(_0x0788('0x16'));var config=require(_0x0788('0x17'));var licenseUtil=require(_0x0788('0x18'));var db=require(_0x0788('0x19'))['db'];function respondWithStatusCode(_0x311729,_0xce4342){_0xce4342=_0xce4342||0xcc;return function(_0x261ebc){if(_0x261ebc){return _0x311729['sendStatus'](_0xce4342);}return _0x311729[_0x0788('0x1a')](_0xce4342)[_0x0788('0x1b')]();};}function respondWithResult(_0x3bdcdf,_0x13cf07){_0x13cf07=_0x13cf07||0xc8;return function(_0x51e5d3){if(_0x51e5d3){return _0x3bdcdf[_0x0788('0x1a')](_0x13cf07)['json'](_0x51e5d3);}};}function respondWithFilteredResult(_0x195f14,_0x170d56){return function(_0x3fd1e4){if(_0x3fd1e4){var _0xb406fb=typeof _0x170d56[_0x0788('0x1c')]===_0x0788('0x1d')&&typeof _0x170d56['limit']==='undefined';var _0x17d805=_0x3fd1e4[_0x0788('0x1e')];var _0x5b2bdc=_0xb406fb?0x0:_0x170d56[_0x0788('0x1c')];var _0x415f19=_0xb406fb?_0x3fd1e4[_0x0788('0x1e')]:_0x170d56['offset']+_0x170d56[_0x0788('0x1f')];var _0x3fb723;if(_0x415f19>=_0x17d805){_0x415f19=_0x17d805;_0x3fb723=0xc8;}else{_0x3fb723=0xce;}_0x195f14['status'](_0x3fb723);return _0x195f14[_0x0788('0x20')]('Content-Range',_0x5b2bdc+'-'+_0x415f19+'/'+_0x17d805)[_0x0788('0x21')](_0x3fd1e4);}return null;};}function patchUpdates(_0x48bc5f){return function(_0x17cca3){try{jsonpatch[_0x0788('0x22')](_0x17cca3,_0x48bc5f,!![]);}catch(_0x18ff22){return BPromise[_0x0788('0x23')](_0x18ff22);}return _0x17cca3[_0x0788('0x24')]();};}function saveUpdates(_0x4f0005,_0x48ec43){return function(_0x2270d4){if(_0x2270d4){return _0x2270d4[_0x0788('0x25')](_0x4f0005)[_0x0788('0x26')](function(_0x7a99a1){return _0x7a99a1;});}return null;};}function removeEntity(_0x5ba1da,_0x4d5c93){return function(_0x79204e){if(_0x79204e){return _0x79204e[_0x0788('0x27')]()[_0x0788('0x26')](function(){_0x5ba1da['status'](0xcc)['end']();});}};}function handleEntityNotFound(_0x240459,_0xa1f7dc){return function(_0x5f2dda){if(!_0x5f2dda){_0x240459['sendStatus'](0x194);}return _0x5f2dda;};}function handleError(_0x5a54a5,_0x44798c){_0x44798c=_0x44798c||0x1f4;return function(_0x57fda1){logger[_0x0788('0x28')](_0x57fda1[_0x0788('0x29')]);if(_0x57fda1[_0x0788('0x2a')]){delete _0x57fda1[_0x0788('0x2a')];}_0x5a54a5[_0x0788('0x1a')](_0x44798c)[_0x0788('0x2b')](_0x57fda1);};}exports[_0x0788('0x2c')]=function(_0x3ffe4f,_0x5b7594){var _0x5a5178={},_0x3c5246={},_0x40d345={'count':0x0,'rows':[]};var _0x54979a=_['map'](db[_0x0788('0x2d')][_0x0788('0x2e')],function(_0x20fcd8){return{'name':_0x20fcd8[_0x0788('0x2f')],'type':_0x20fcd8[_0x0788('0x30')][_0x0788('0x31')]};});_0x3c5246[_0x0788('0x32')]=_[_0x0788('0x33')](_0x54979a,_0x0788('0x2a'));_0x3c5246[_0x0788('0x34')]=_['keys'](_0x3ffe4f[_0x0788('0x34')]);_0x3c5246[_0x0788('0x35')]=_[_0x0788('0x36')](_0x3c5246[_0x0788('0x32')],_0x3c5246[_0x0788('0x34')]);_0x5a5178[_0x0788('0x37')]=_[_0x0788('0x36')](_0x3c5246[_0x0788('0x32')],qs[_0x0788('0x38')](_0x3ffe4f[_0x0788('0x34')]['fields']));_0x5a5178['attributes']=_0x5a5178['attributes']['length']?_0x5a5178['attributes']:_0x3c5246['model'];if(!_0x3ffe4f[_0x0788('0x34')][_0x0788('0x39')](_0x0788('0x3a'))){_0x5a5178['limit']=qs[_0x0788('0x1f')](_0x3ffe4f[_0x0788('0x34')][_0x0788('0x1f')]);_0x5a5178[_0x0788('0x1c')]=qs['offset'](_0x3ffe4f[_0x0788('0x34')]['offset']);}_0x5a5178[_0x0788('0x3b')]=qs['sort'](_0x3ffe4f[_0x0788('0x34')][_0x0788('0x3c')]);_0x5a5178['where']=qs[_0x0788('0x35')](_[_0x0788('0x3d')](_0x3ffe4f['query'],_0x3c5246[_0x0788('0x35')]),_0x54979a);if(_0x3ffe4f['query'][_0x0788('0x3e')]){_0x5a5178['where']=_[_0x0788('0x3f')](_0x5a5178['where'],{'$or':_[_0x0788('0x33')](_0x54979a,function(_0x57fec9){if(_0x57fec9['type']!==_0x0788('0x40')){var _0x68d9d4={};_0x68d9d4[_0x57fec9[_0x0788('0x2a')]]={'$like':'%'+_0x3ffe4f[_0x0788('0x34')][_0x0788('0x3e')]+'%'};return _0x68d9d4;}})});}_0x5a5178=_['merge']({},_0x5a5178,_0x3ffe4f['options']);var _0x530d83={'where':_0x5a5178['where']};return db[_0x0788('0x2d')][_0x0788('0x1e')](_0x530d83)[_0x0788('0x26')](function(_0x358a22){_0x40d345[_0x0788('0x1e')]=_0x358a22;if(_0x3ffe4f['query']['includeAll']){_0x5a5178[_0x0788('0x41')]=[{'all':!![]}];}return db[_0x0788('0x2d')][_0x0788('0x42')](_0x5a5178);})[_0x0788('0x26')](function(_0x236b63){_0x40d345[_0x0788('0x43')]=_0x236b63;return _0x40d345;})[_0x0788('0x26')](respondWithFilteredResult(_0x5b7594,_0x5a5178))[_0x0788('0x44')](handleError(_0x5b7594,null));};exports[_0x0788('0x45')]=function(_0x50e8f5,_0x5581e6){var _0x441aec={'raw':![],'where':{'id':_0x50e8f5[_0x0788('0x46')]['id']}},_0x1d579d={};_0x1d579d['model']=_['keys'](db['UserProfileResource'][_0x0788('0x2e')]);_0x1d579d[_0x0788('0x34')]=_[_0x0788('0x47')](_0x50e8f5[_0x0788('0x34')]);_0x1d579d[_0x0788('0x35')]=_[_0x0788('0x36')](_0x1d579d[_0x0788('0x32')],_0x1d579d[_0x0788('0x34')]);_0x441aec['attributes']=_[_0x0788('0x36')](_0x1d579d[_0x0788('0x32')],qs[_0x0788('0x38')](_0x50e8f5[_0x0788('0x34')]['fields']));_0x441aec[_0x0788('0x37')]=_0x441aec[_0x0788('0x37')]['length']?_0x441aec['attributes']:_0x1d579d['model'];if(_0x50e8f5[_0x0788('0x34')]['includeAll']){_0x441aec[_0x0788('0x41')]=[{'all':!![]}];}_0x441aec=_[_0x0788('0x3f')]({},_0x441aec,_0x50e8f5[_0x0788('0x48')]);return db[_0x0788('0x2d')][_0x0788('0x49')](_0x441aec)[_0x0788('0x26')](handleEntityNotFound(_0x5581e6,null))[_0x0788('0x26')](respondWithResult(_0x5581e6,null))[_0x0788('0x44')](handleError(_0x5581e6,null));};exports['create']=function(_0x4c6366,_0x39c3cc){return db[_0x0788('0x2d')][_0x0788('0x4a')](_0x4c6366['body'],{})[_0x0788('0x26')](respondWithResult(_0x39c3cc,0xc9))[_0x0788('0x44')](handleError(_0x39c3cc,null));};exports[_0x0788('0x25')]=function(_0x4563cd,_0x2395ad){if(_0x4563cd['body']['id']){delete _0x4563cd['body']['id'];}return db[_0x0788('0x2d')][_0x0788('0x49')]({'where':{'id':_0x4563cd['params']['id']}})[_0x0788('0x26')](handleEntityNotFound(_0x2395ad,null))['then'](saveUpdates(_0x4563cd[_0x0788('0x4b')],null))[_0x0788('0x26')](respondWithResult(_0x2395ad,null))[_0x0788('0x44')](handleError(_0x2395ad,null));};exports[_0x0788('0x27')]=function(_0x3c757a,_0x379928){return db[_0x0788('0x2d')][_0x0788('0x49')]({'where':{'id':_0x3c757a['params']['id']}})[_0x0788('0x26')](handleEntityNotFound(_0x379928,null))[_0x0788('0x26')](removeEntity(_0x379928,null))[_0x0788('0x44')](handleError(_0x379928,null));};exports['describe']=function(_0x1693d0,_0x5d32ae){return db['UserProfileResource'][_0x0788('0x4c')]()[_0x0788('0x26')](respondWithResult(_0x5d32ae,null))[_0x0788('0x44')](handleError(_0x5d32ae,null));}; \ No newline at end of file diff --git a/server/api/userProfileResource/userProfileResource.model.js b/server/api/userProfileResource/userProfileResource.model.js index 8fb5ed4..f52fca4 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 _0xf2ee=['rimraf','./userProfileResource.attributes','exports','define','UserProfileResource','compositeIndex','sectionId','util','../../config/logger','api','moment','request-promise','path'];(function(_0x3b17a0,_0x1856cf){var _0x4b4a04=function(_0x36649c){while(--_0x36649c){_0x3b17a0['push'](_0x3b17a0['shift']());}};_0x4b4a04(++_0x1856cf);}(_0xf2ee,0x159));var _0xef2e=function(_0x1bba75,_0x26cdc5){_0x1bba75=_0x1bba75-0x0;var _0x34decd=_0xf2ee[_0x1bba75];return _0x34decd;};'use strict';var _=require('lodash');var util=require(_0xef2e('0x0'));var logger=require(_0xef2e('0x1'))(_0xef2e('0x2'));var moment=require(_0xef2e('0x3'));var BPromise=require('bluebird');var rp=require(_0xef2e('0x4'));var fs=require('fs');var path=require(_0xef2e('0x5'));var rimraf=require(_0xef2e('0x6'));var config=require('../../config/environment');var attributes=require(_0xef2e('0x7'));module[_0xef2e('0x8')]=function(_0x506245,_0xfac539){return _0x506245[_0xef2e('0x9')](_0xef2e('0xa'),attributes,{'tableName':'user_profile_has_resources','paranoid':![],'indexes':[{'name':_0xef2e('0xb'),'fields':['resourceId',_0xef2e('0xc')]}],'timestamps':!![]});}; \ No newline at end of file +var _0x9f76=['../../config/logger','api','moment','bluebird','request-promise','rimraf','./userProfileResource.attributes','exports','define','UserProfileResource','user_profile_has_resources','compositeIndex','sectionId','lodash','util'];(function(_0x216428,_0x5d20ea){var _0x313dd4=function(_0x447e0d){while(--_0x447e0d){_0x216428['push'](_0x216428['shift']());}};_0x313dd4(++_0x5d20ea);}(_0x9f76,0x94));var _0x69f7=function(_0x30ae5e,_0x391fc4){_0x30ae5e=_0x30ae5e-0x0;var _0x1f2e93=_0x9f76[_0x30ae5e];return _0x1f2e93;};'use strict';var _=require(_0x69f7('0x0'));var util=require(_0x69f7('0x1'));var logger=require(_0x69f7('0x2'))(_0x69f7('0x3'));var moment=require(_0x69f7('0x4'));var BPromise=require(_0x69f7('0x5'));var rp=require(_0x69f7('0x6'));var fs=require('fs');var path=require('path');var rimraf=require(_0x69f7('0x7'));var config=require('../../config/environment');var attributes=require(_0x69f7('0x8'));module[_0x69f7('0x9')]=function(_0xe5eb19,_0x2cf947){return _0xe5eb19[_0x69f7('0xa')](_0x69f7('0xb'),attributes,{'tableName':_0x69f7('0xc'),'paranoid':![],'indexes':[{'name':_0x69f7('0xd'),'fields':['resourceId',_0x69f7('0xe')]}],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/userProfileResource/userProfileResource.rpc.js b/server/api/userProfileResource/userProfileResource.rpc.js index b152634..d8b212c 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 _0x13b7=['error','message','info','catch','bluebird','randomstring','../../config/utils','rpc','../../config/environment','jayson/promise','http','UserProfileResource,\x20%s,\x20%s','request\x20sent','stringify'];(function(_0x2d555a,_0x27c112){var _0x52593d=function(_0x45aeee){while(--_0x45aeee){_0x2d555a['push'](_0x2d555a['shift']());}};_0x52593d(++_0x27c112);}(_0x13b7,0x1a8));var _0x713b=function(_0x41da73,_0x2415ed){_0x41da73=_0x41da73-0x0;var _0x4f3cb1=_0x13b7[_0x41da73];return _0x4f3cb1;};'use strict';var _=require('lodash');var util=require('util');var moment=require('moment');var BPromise=require(_0x713b('0x0'));var rs=require(_0x713b('0x1'));var fs=require('fs');var Redis=require('ioredis');var db=require('../../mysqldb')['db'];var utils=require(_0x713b('0x2'));var logger=require('../../config/logger')(_0x713b('0x3'));var config=require(_0x713b('0x4'));var jayson=require(_0x713b('0x5'));var client=jayson['client'][_0x713b('0x6')]({'port':0x232a});function respondWithRpcPromise(_0x1d658d,_0x81d9b,_0x2b119b){return new BPromise(function(_0x57fe86,_0x1c111f){return client['request'](_0x1d658d,_0x2b119b)['then'](function(_0x29b5a8){logger['info'](_0x713b('0x7'),_0x81d9b,'request\x20sent');logger['debug']('UserProfileResource,\x20%s,\x20%s,\x20%s',_0x81d9b,_0x713b('0x8'),JSON[_0x713b('0x9')](_0x29b5a8));if(_0x29b5a8[_0x713b('0xa')]){if(_0x29b5a8[_0x713b('0xa')]['code']===0x1f4){logger['error'](_0x713b('0x7'),_0x81d9b,_0x29b5a8[_0x713b('0xa')]['message']);return _0x1c111f(_0x29b5a8[_0x713b('0xa')]['message']);}logger[_0x713b('0xa')](_0x713b('0x7'),_0x81d9b,_0x29b5a8[_0x713b('0xa')][_0x713b('0xb')]);return _0x57fe86(_0x29b5a8['error'][_0x713b('0xb')]);}else{logger[_0x713b('0xc')](_0x713b('0x7'),_0x81d9b,_0x713b('0x8'));_0x57fe86(_0x29b5a8['result'][_0x713b('0xb')]);}})[_0x713b('0xd')](function(_0x22283c){logger[_0x713b('0xa')](_0x713b('0x7'),_0x81d9b,_0x22283c);_0x1c111f(_0x22283c);});});} \ No newline at end of file +var _0xd2ee=['request','then','info','request\x20sent','debug','stringify','error','code','UserProfileResource,\x20%s,\x20%s','message','catch','util','bluebird','../../config/utils','../../config/logger','rpc','../../config/environment','client','http'];(function(_0x5c2b1f,_0x17a149){var _0xf95d71=function(_0x18a112){while(--_0x18a112){_0x5c2b1f['push'](_0x5c2b1f['shift']());}};_0xf95d71(++_0x17a149);}(_0xd2ee,0x161));var _0xed2e=function(_0x283c82,_0x13d00e){_0x283c82=_0x283c82-0x0;var _0x1982bb=_0xd2ee[_0x283c82];return _0x1982bb;};'use strict';var _=require('lodash');var util=require(_0xed2e('0x0'));var moment=require('moment');var BPromise=require(_0xed2e('0x1'));var rs=require('randomstring');var fs=require('fs');var Redis=require('ioredis');var db=require('../../mysqldb')['db'];var utils=require(_0xed2e('0x2'));var logger=require(_0xed2e('0x3'))(_0xed2e('0x4'));var config=require(_0xed2e('0x5'));var jayson=require('jayson/promise');var client=jayson[_0xed2e('0x6')][_0xed2e('0x7')]({'port':0x232a});function respondWithRpcPromise(_0x314c3d,_0x500bb7,_0x45b13e){return new BPromise(function(_0x1ea222,_0x405061){return client[_0xed2e('0x8')](_0x314c3d,_0x45b13e)[_0xed2e('0x9')](function(_0x1b71f6){logger[_0xed2e('0xa')]('UserProfileResource,\x20%s,\x20%s',_0x500bb7,_0xed2e('0xb'));logger[_0xed2e('0xc')]('UserProfileResource,\x20%s,\x20%s,\x20%s',_0x500bb7,'request\x20sent',JSON[_0xed2e('0xd')](_0x1b71f6));if(_0x1b71f6[_0xed2e('0xe')]){if(_0x1b71f6['error'][_0xed2e('0xf')]===0x1f4){logger['error'](_0xed2e('0x10'),_0x500bb7,_0x1b71f6[_0xed2e('0xe')][_0xed2e('0x11')]);return _0x405061(_0x1b71f6[_0xed2e('0xe')][_0xed2e('0x11')]);}logger[_0xed2e('0xe')](_0xed2e('0x10'),_0x500bb7,_0x1b71f6[_0xed2e('0xe')]['message']);return _0x1ea222(_0x1b71f6[_0xed2e('0xe')]['message']);}else{logger['info'](_0xed2e('0x10'),_0x500bb7,'request\x20sent');_0x1ea222(_0x1b71f6['result'][_0xed2e('0x11')]);}})[_0xed2e('0x12')](function(_0x35a4c7){logger[_0xed2e('0xe')](_0xed2e('0x10'),_0x500bb7,_0x35a4c7);_0x405061(_0x35a4c7);});});} \ No newline at end of file diff --git a/server/api/userProfileSection/index.js b/server/api/userProfileSection/index.js index 921d362..0819c61 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 _0xedbd=['../../components/interaction/service','../../config/environment','get','index','isAuthenticated','describe','post','create','put','/:id','update','delete','destroy','exports','path','Router','fs-extra','../../components/auth/service'];(function(_0x2dafbe,_0x5d04de){var _0x58a45a=function(_0x50ac96){while(--_0x50ac96){_0x2dafbe['push'](_0x2dafbe['shift']());}};_0x58a45a(++_0x5d04de);}(_0xedbd,0xf8));var _0xdedb=function(_0x10566a,_0x153a58){_0x10566a=_0x10566a-0x0;var _0xc37f1f=_0xedbd[_0x10566a];return _0xc37f1f;};'use strict';var multer=require('multer');var util=require('util');var path=require(_0xdedb('0x0'));var timeout=require('connect-timeout');var express=require('express');var router=express[_0xdedb('0x1')]();var fs_extra=require(_0xdedb('0x2'));var auth=require(_0xdedb('0x3'));var interaction=require(_0xdedb('0x4'));var config=require(_0xdedb('0x5'));var controller=require('./userProfileSection.controller');router[_0xdedb('0x6')]('/',auth['isAuthenticated'](),controller[_0xdedb('0x7')]);router['get']('/describe',auth[_0xdedb('0x8')](),controller[_0xdedb('0x9')]);router[_0xdedb('0x6')]('/:id',auth[_0xdedb('0x8')](),controller['show']);router[_0xdedb('0xa')]('/',auth['isAuthenticated'](),controller[_0xdedb('0xb')]);router[_0xdedb('0xc')](_0xdedb('0xd'),auth['isAuthenticated'](),controller[_0xdedb('0xe')]);router[_0xdedb('0xf')](_0xdedb('0xd'),auth[_0xdedb('0x8')](),controller[_0xdedb('0x10')]);module[_0xdedb('0x11')]=router; \ No newline at end of file +var _0xf697=['../../components/auth/service','../../config/environment','./userProfileSection.controller','get','isAuthenticated','index','describe','show','post','create','/:id','update','delete','destroy','exports','multer','util','path','connect-timeout','express','Router','fs-extra'];(function(_0x33554b,_0x48162b){var _0x256954=function(_0x185f66){while(--_0x185f66){_0x33554b['push'](_0x33554b['shift']());}};_0x256954(++_0x48162b);}(_0xf697,0x1c7));var _0x7f69=function(_0x2b6d46,_0x11867e){_0x2b6d46=_0x2b6d46-0x0;var _0x555bdb=_0xf697[_0x2b6d46];return _0x555bdb;};'use strict';var multer=require(_0x7f69('0x0'));var util=require(_0x7f69('0x1'));var path=require(_0x7f69('0x2'));var timeout=require(_0x7f69('0x3'));var express=require(_0x7f69('0x4'));var router=express[_0x7f69('0x5')]();var fs_extra=require(_0x7f69('0x6'));var auth=require(_0x7f69('0x7'));var interaction=require('../../components/interaction/service');var config=require(_0x7f69('0x8'));var controller=require(_0x7f69('0x9'));router[_0x7f69('0xa')]('/',auth[_0x7f69('0xb')](),controller[_0x7f69('0xc')]);router['get']('/describe',auth[_0x7f69('0xb')](),controller[_0x7f69('0xd')]);router[_0x7f69('0xa')]('/:id',auth['isAuthenticated'](),controller[_0x7f69('0xe')]);router[_0x7f69('0xf')]('/',auth[_0x7f69('0xb')](),controller[_0x7f69('0x10')]);router['put'](_0x7f69('0x11'),auth[_0x7f69('0xb')](),controller[_0x7f69('0x12')]);router[_0x7f69('0x13')](_0x7f69('0x11'),auth[_0x7f69('0xb')](),controller[_0x7f69('0x14')]);module[_0x7f69('0x15')]=router; \ No newline at end of file diff --git a/server/api/userProfileSection/userProfileSection.attributes.js b/server/api/userProfileSection/userProfileSection.attributes.js index 66f8139..6d0c6cb 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 _0xcf66=['getDataValue','crudPermissions','split','sequelize','exports','STRING','INTEGER','BOOLEAN','setDataValue','join'];(function(_0x447e2c,_0x1b56c0){var _0x49c472=function(_0x2cae0c){while(--_0x2cae0c){_0x447e2c['push'](_0x447e2c['shift']());}};_0x49c472(++_0x1b56c0);}(_0xcf66,0x71));var _0x6cf6=function(_0x1fd49a,_0x3d0b30){_0x1fd49a=_0x1fd49a-0x0;var _0x798f38=_0xcf66[_0x1fd49a];return _0x798f38;};'use strict';var Sequelize=require(_0x6cf6('0x0'));module[_0x6cf6('0x1')]={'name':{'type':Sequelize[_0x6cf6('0x2')],'allowNull':![]},'category':{'type':Sequelize['STRING'],'allowNull':![]},'sectionId':{'type':Sequelize[_0x6cf6('0x3')],'allowNull':![]},'enabled':{'type':Sequelize[_0x6cf6('0x4')],'defaultValue':null},'autoAssociation':{'type':Sequelize['BOOLEAN'],'defaultValue':null},'crudPermissions':{'type':Sequelize['STRING'],'set':function(_0x1c599d){this[_0x6cf6('0x5')]('crudPermissions',_0x1c599d?_0x1c599d[_0x6cf6('0x6')](''):[]);},'get':function(){return this[_0x6cf6('0x7')](_0x6cf6('0x8'))?this['getDataValue'](_0x6cf6('0x8'))[_0x6cf6('0x9')](''):[];}}}; \ No newline at end of file +var _0x5b12=['split','sequelize','exports','STRING','INTEGER','BOOLEAN','setDataValue','getDataValue','crudPermissions'];(function(_0x51dc2e,_0x4d561e){var _0x253536=function(_0x2c610e){while(--_0x2c610e){_0x51dc2e['push'](_0x51dc2e['shift']());}};_0x253536(++_0x4d561e);}(_0x5b12,0xa3));var _0x25b1=function(_0x95d6ca,_0x348619){_0x95d6ca=_0x95d6ca-0x0;var _0xd18dd4=_0x5b12[_0x95d6ca];return _0xd18dd4;};'use strict';var Sequelize=require(_0x25b1('0x0'));module[_0x25b1('0x1')]={'name':{'type':Sequelize[_0x25b1('0x2')],'allowNull':![]},'category':{'type':Sequelize['STRING'],'allowNull':![]},'sectionId':{'type':Sequelize[_0x25b1('0x3')],'allowNull':![]},'enabled':{'type':Sequelize['BOOLEAN'],'defaultValue':null},'autoAssociation':{'type':Sequelize[_0x25b1('0x4')],'defaultValue':null},'crudPermissions':{'type':Sequelize[_0x25b1('0x2')],'set':function(_0x47995b){this[_0x25b1('0x5')]('crudPermissions',_0x47995b?_0x47995b['join'](''):[]);},'get':function(){return this[_0x25b1('0x6')]('crudPermissions')?this['getDataValue'](_0x25b1('0x7'))[_0x25b1('0x8')](''):[];}}}; \ No newline at end of file diff --git a/server/api/userProfileSection/userProfileSection.controller.js b/server/api/userProfileSection/userProfileSection.controller.js index 264b512..a65b8aa 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 _0x5d94=['fs-extra','lodash','squel','crypto','jsforce','querystring','../../components/parsers/advancedSearch','../../config/logger','api','../../config/environment','../../config/license/util','../../mysqldb','sendStatus','end','status','offset','undefined','limit','count','set','Content-Range','json','apply','reject','save','update','error','stack','name','send','map','UserProfileSection','rawAttributes','fieldName','key','query','keys','filters','attributes','intersection','model','fields','hasOwnProperty','nolimit','sort','where','filter','merge','type','VIRTUAL','options','then','findAll','rows','catch','params','length','includeAll','include','create','body','find','describe','rimraf','zip-dir','fast-json-patch','request-promise','mustache','util','path','sox','to-csv','ejs'];(function(_0x50b1ff,_0x1165ba){var _0xda0c37=function(_0x4d0d22){while(--_0x4d0d22){_0x50b1ff['push'](_0x50b1ff['shift']());}};_0xda0c37(++_0x1165ba);}(_0x5d94,0x88));var _0x45d9=function(_0x24d7ce,_0x36bd1b){_0x24d7ce=_0x24d7ce-0x0;var _0x154930=_0x5d94[_0x24d7ce];return _0x154930;};'use strict';var emlformat=require('eml-format');var rimraf=require(_0x45d9('0x0'));var zipdir=require(_0x45d9('0x1'));var jsonpatch=require(_0x45d9('0x2'));var rp=require(_0x45d9('0x3'));var moment=require('moment');var BPromise=require('bluebird');var Mustache=require(_0x45d9('0x4'));var util=require(_0x45d9('0x5'));var path=require(_0x45d9('0x6'));var sox=require(_0x45d9('0x7'));var csv=require(_0x45d9('0x8'));var ejs=require(_0x45d9('0x9'));var fs=require('fs');var fs_extra=require(_0x45d9('0xa'));var _=require(_0x45d9('0xb'));var squel=require(_0x45d9('0xc'));var crypto=require(_0x45d9('0xd'));var jsforce=require(_0x45d9('0xe'));var deskjs=require('desk.js');var toCsv=require(_0x45d9('0x8'));var querystring=require(_0x45d9('0xf'));var Papa=require('papaparse');var Redis=require('ioredis');var authService=require('../../components/auth/service');var qs=require('../../components/parsers/qs');var as=require(_0x45d9('0x10'));var hardwareService=require('../../config/license/hardware');var logger=require(_0x45d9('0x11'))(_0x45d9('0x12'));var utils=require('../../config/utils');var config=require(_0x45d9('0x13'));var licenseUtil=require(_0x45d9('0x14'));var db=require(_0x45d9('0x15'))['db'];function respondWithStatusCode(_0xa58321,_0xd369b7){_0xd369b7=_0xd369b7||0xcc;return function(_0x16fb14){if(_0x16fb14){return _0xa58321[_0x45d9('0x16')](_0xd369b7);}return _0xa58321['status'](_0xd369b7)[_0x45d9('0x17')]();};}function respondWithResult(_0x3fb2c3,_0x4ddd78){_0x4ddd78=_0x4ddd78||0xc8;return function(_0x2b143b){if(_0x2b143b){return _0x3fb2c3[_0x45d9('0x18')](_0x4ddd78)['json'](_0x2b143b);}};}function respondWithFilteredResult(_0xc8fb24,_0x29e046){return function(_0x2f0886){if(_0x2f0886){var _0xf50fa=typeof _0x29e046[_0x45d9('0x19')]===_0x45d9('0x1a')&&typeof _0x29e046[_0x45d9('0x1b')]==='undefined';var _0xbde1a2=_0x2f0886['count'];var _0x45e2a0=_0xf50fa?0x0:_0x29e046[_0x45d9('0x19')];var _0x6c1126=_0xf50fa?_0x2f0886[_0x45d9('0x1c')]:_0x29e046[_0x45d9('0x19')]+_0x29e046[_0x45d9('0x1b')];var _0x274ea4;if(_0x6c1126>=_0xbde1a2){_0x6c1126=_0xbde1a2;_0x274ea4=0xc8;}else{_0x274ea4=0xce;}_0xc8fb24[_0x45d9('0x18')](_0x274ea4);return _0xc8fb24[_0x45d9('0x1d')](_0x45d9('0x1e'),_0x45e2a0+'-'+_0x6c1126+'/'+_0xbde1a2)[_0x45d9('0x1f')](_0x2f0886);}return null;};}function patchUpdates(_0x48039f){return function(_0x1bc471){try{jsonpatch[_0x45d9('0x20')](_0x1bc471,_0x48039f,!![]);}catch(_0x209ef1){return BPromise[_0x45d9('0x21')](_0x209ef1);}return _0x1bc471[_0x45d9('0x22')]();};}function saveUpdates(_0x2b47e4,_0xb110ae){return function(_0x1bf4e4){if(_0x1bf4e4){return _0x1bf4e4[_0x45d9('0x23')](_0x2b47e4)['then'](function(_0x405993){return _0x405993;});}return null;};}function removeEntity(_0xa5b752,_0x36666e){return function(_0x903fde){if(_0x903fde){return _0x903fde['destroy']()['then'](function(){_0xa5b752[_0x45d9('0x18')](0xcc)['end']();});}};}function handleEntityNotFound(_0x548c3f,_0x50fb43){return function(_0x277b29){if(!_0x277b29){_0x548c3f[_0x45d9('0x16')](0x194);}return _0x277b29;};}function handleError(_0x2ae2fa,_0x51921b){_0x51921b=_0x51921b||0x1f4;return function(_0x6b774a){logger[_0x45d9('0x24')](_0x6b774a[_0x45d9('0x25')]);if(_0x6b774a[_0x45d9('0x26')]){delete _0x6b774a[_0x45d9('0x26')];}_0x2ae2fa[_0x45d9('0x18')](_0x51921b)[_0x45d9('0x27')](_0x6b774a);};}exports['index']=function(_0x543a59,_0x41b6e4){var _0x2f85ae={},_0x56dd0c={},_0xedbcd0={'count':0x0,'rows':[]};var _0x2b2446=_[_0x45d9('0x28')](db[_0x45d9('0x29')][_0x45d9('0x2a')],function(_0x24ca68){return{'name':_0x24ca68[_0x45d9('0x2b')],'type':_0x24ca68['type'][_0x45d9('0x2c')]};});_0x56dd0c['model']=_[_0x45d9('0x28')](_0x2b2446,_0x45d9('0x26'));_0x56dd0c[_0x45d9('0x2d')]=_[_0x45d9('0x2e')](_0x543a59[_0x45d9('0x2d')]);_0x56dd0c[_0x45d9('0x2f')]=_['intersection'](_0x56dd0c['model'],_0x56dd0c['query']);_0x2f85ae[_0x45d9('0x30')]=_[_0x45d9('0x31')](_0x56dd0c[_0x45d9('0x32')],qs[_0x45d9('0x33')](_0x543a59[_0x45d9('0x2d')]['fields']));_0x2f85ae[_0x45d9('0x30')]=_0x2f85ae['attributes']['length']?_0x2f85ae['attributes']:_0x56dd0c['model'];if(!_0x543a59[_0x45d9('0x2d')][_0x45d9('0x34')](_0x45d9('0x35'))){_0x2f85ae[_0x45d9('0x1b')]=qs['limit'](_0x543a59['query'][_0x45d9('0x1b')]);_0x2f85ae[_0x45d9('0x19')]=qs['offset'](_0x543a59[_0x45d9('0x2d')][_0x45d9('0x19')]);}_0x2f85ae['order']=qs['sort'](_0x543a59['query'][_0x45d9('0x36')]);_0x2f85ae[_0x45d9('0x37')]=qs['filters'](_['pick'](_0x543a59[_0x45d9('0x2d')],_0x56dd0c['filters']),_0x2b2446);if(_0x543a59[_0x45d9('0x2d')][_0x45d9('0x38')]){_0x2f85ae[_0x45d9('0x37')]=_[_0x45d9('0x39')](_0x2f85ae[_0x45d9('0x37')],{'$or':_[_0x45d9('0x28')](_0x2b2446,function(_0x17cf6c){if(_0x17cf6c[_0x45d9('0x3a')]!==_0x45d9('0x3b')){var _0x445218={};_0x445218[_0x17cf6c['name']]={'$like':'%'+_0x543a59[_0x45d9('0x2d')][_0x45d9('0x38')]+'%'};return _0x445218;}})});}_0x2f85ae=_[_0x45d9('0x39')]({},_0x2f85ae,_0x543a59[_0x45d9('0x3c')]);var _0x13434c={'where':_0x2f85ae[_0x45d9('0x37')]};return db['UserProfileSection'][_0x45d9('0x1c')](_0x13434c)[_0x45d9('0x3d')](function(_0x17c518){_0xedbcd0[_0x45d9('0x1c')]=_0x17c518;if(_0x543a59[_0x45d9('0x2d')]['includeAll']){_0x2f85ae['include']=[{'all':!![]}];}return db[_0x45d9('0x29')][_0x45d9('0x3e')](_0x2f85ae);})[_0x45d9('0x3d')](function(_0x41a119){_0xedbcd0[_0x45d9('0x3f')]=_0x41a119;return _0xedbcd0;})[_0x45d9('0x3d')](respondWithFilteredResult(_0x41b6e4,_0x2f85ae))[_0x45d9('0x40')](handleError(_0x41b6e4,null));};exports['show']=function(_0x4438bd,_0x45c7d3){var _0x12d3a2={'raw':![],'where':{'id':_0x4438bd[_0x45d9('0x41')]['id']}},_0x4535ce={};_0x4535ce[_0x45d9('0x32')]=_['keys'](db[_0x45d9('0x29')][_0x45d9('0x2a')]);_0x4535ce['query']=_[_0x45d9('0x2e')](_0x4438bd[_0x45d9('0x2d')]);_0x4535ce['filters']=_[_0x45d9('0x31')](_0x4535ce[_0x45d9('0x32')],_0x4535ce[_0x45d9('0x2d')]);_0x12d3a2[_0x45d9('0x30')]=_[_0x45d9('0x31')](_0x4535ce[_0x45d9('0x32')],qs['fields'](_0x4438bd[_0x45d9('0x2d')][_0x45d9('0x33')]));_0x12d3a2[_0x45d9('0x30')]=_0x12d3a2['attributes'][_0x45d9('0x42')]?_0x12d3a2[_0x45d9('0x30')]:_0x4535ce[_0x45d9('0x32')];if(_0x4438bd[_0x45d9('0x2d')][_0x45d9('0x43')]){_0x12d3a2[_0x45d9('0x44')]=[{'all':!![]}];}_0x12d3a2=_[_0x45d9('0x39')]({},_0x12d3a2,_0x4438bd[_0x45d9('0x3c')]);return db[_0x45d9('0x29')]['find'](_0x12d3a2)[_0x45d9('0x3d')](handleEntityNotFound(_0x45c7d3,null))[_0x45d9('0x3d')](respondWithResult(_0x45c7d3,null))[_0x45d9('0x40')](handleError(_0x45c7d3,null));};exports[_0x45d9('0x45')]=function(_0x175744,_0x59505b){return db[_0x45d9('0x29')][_0x45d9('0x45')](_0x175744[_0x45d9('0x46')],{})[_0x45d9('0x3d')](respondWithResult(_0x59505b,0xc9))['catch'](handleError(_0x59505b,null));};exports[_0x45d9('0x23')]=function(_0x3df159,_0x50b3f5){if(_0x3df159[_0x45d9('0x46')]['id']){delete _0x3df159[_0x45d9('0x46')]['id'];}return db[_0x45d9('0x29')][_0x45d9('0x47')]({'where':{'id':_0x3df159['params']['id']}})[_0x45d9('0x3d')](handleEntityNotFound(_0x50b3f5,null))[_0x45d9('0x3d')](saveUpdates(_0x3df159[_0x45d9('0x46')],null))[_0x45d9('0x3d')](respondWithResult(_0x50b3f5,null))[_0x45d9('0x40')](handleError(_0x50b3f5,null));};exports['destroy']=function(_0x4082df,_0x4cced7){return db[_0x45d9('0x29')][_0x45d9('0x47')]({'where':{'id':_0x4082df[_0x45d9('0x41')]['id']}})['then'](handleEntityNotFound(_0x4cced7,null))['then'](removeEntity(_0x4cced7,null))[_0x45d9('0x40')](handleError(_0x4cced7,null));};exports['describe']=function(_0x192396,_0x1cc16e){return db[_0x45d9('0x29')][_0x45d9('0x48')]()[_0x45d9('0x3d')](respondWithResult(_0x1cc16e,null))[_0x45d9('0x40')](handleError(_0x1cc16e,null));}; \ No newline at end of file +var _0x0fc5=['apply','reject','update','error','stack','name','send','index','map','UserProfileSection','rawAttributes','fieldName','type','key','model','keys','query','filters','intersection','attributes','fields','hasOwnProperty','order','sort','where','merge','VIRTUAL','filter','options','includeAll','findAll','then','rows','catch','show','find','create','body','params','destroy','describe','eml-format','rimraf','fast-json-patch','request-promise','moment','util','path','sox','ejs','fs-extra','squel','crypto','jsforce','desk.js','to-csv','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/utils','../../mysqldb','sendStatus','status','end','offset','undefined','limit','count','set','Content-Range','json'];(function(_0x2394aa,_0x4f353a){var _0x2fd34e=function(_0x48bf81){while(--_0x48bf81){_0x2394aa['push'](_0x2394aa['shift']());}};_0x2fd34e(++_0x4f353a);}(_0x0fc5,0x1f1));var _0x50fc=function(_0x2c5b4e,_0x6e9df5){_0x2c5b4e=_0x2c5b4e-0x0;var _0x20f9bd=_0x0fc5[_0x2c5b4e];return _0x20f9bd;};'use strict';var emlformat=require(_0x50fc('0x0'));var rimraf=require(_0x50fc('0x1'));var zipdir=require('zip-dir');var jsonpatch=require(_0x50fc('0x2'));var rp=require(_0x50fc('0x3'));var moment=require(_0x50fc('0x4'));var BPromise=require('bluebird');var Mustache=require('mustache');var util=require(_0x50fc('0x5'));var path=require(_0x50fc('0x6'));var sox=require(_0x50fc('0x7'));var csv=require('to-csv');var ejs=require(_0x50fc('0x8'));var fs=require('fs');var fs_extra=require(_0x50fc('0x9'));var _=require('lodash');var squel=require(_0x50fc('0xa'));var crypto=require(_0x50fc('0xb'));var jsforce=require(_0x50fc('0xc'));var deskjs=require(_0x50fc('0xd'));var toCsv=require(_0x50fc('0xe'));var querystring=require(_0x50fc('0xf'));var Papa=require(_0x50fc('0x10'));var Redis=require(_0x50fc('0x11'));var authService=require(_0x50fc('0x12'));var qs=require('../../components/parsers/qs');var as=require(_0x50fc('0x13'));var hardwareService=require(_0x50fc('0x14'));var logger=require(_0x50fc('0x15'))(_0x50fc('0x16'));var utils=require(_0x50fc('0x17'));var config=require('../../config/environment');var licenseUtil=require('../../config/license/util');var db=require(_0x50fc('0x18'))['db'];function respondWithStatusCode(_0x5c2053,_0x1f4e05){_0x1f4e05=_0x1f4e05||0xcc;return function(_0x37eb31){if(_0x37eb31){return _0x5c2053[_0x50fc('0x19')](_0x1f4e05);}return _0x5c2053[_0x50fc('0x1a')](_0x1f4e05)[_0x50fc('0x1b')]();};}function respondWithResult(_0x1a26a2,_0x3ebef3){_0x3ebef3=_0x3ebef3||0xc8;return function(_0x3c79e0){if(_0x3c79e0){return _0x1a26a2[_0x50fc('0x1a')](_0x3ebef3)['json'](_0x3c79e0);}};}function respondWithFilteredResult(_0x9c191,_0x511901){return function(_0x50ee04){if(_0x50ee04){var _0x1b3342=typeof _0x511901[_0x50fc('0x1c')]===_0x50fc('0x1d')&&typeof _0x511901[_0x50fc('0x1e')]===_0x50fc('0x1d');var _0x10a8f5=_0x50ee04[_0x50fc('0x1f')];var _0x58d0e9=_0x1b3342?0x0:_0x511901[_0x50fc('0x1c')];var _0x57cb36=_0x1b3342?_0x50ee04['count']:_0x511901[_0x50fc('0x1c')]+_0x511901[_0x50fc('0x1e')];var _0xe4e0ae;if(_0x57cb36>=_0x10a8f5){_0x57cb36=_0x10a8f5;_0xe4e0ae=0xc8;}else{_0xe4e0ae=0xce;}_0x9c191['status'](_0xe4e0ae);return _0x9c191[_0x50fc('0x20')](_0x50fc('0x21'),_0x58d0e9+'-'+_0x57cb36+'/'+_0x10a8f5)[_0x50fc('0x22')](_0x50ee04);}return null;};}function patchUpdates(_0x1691a1){return function(_0x5dcbdc){try{jsonpatch[_0x50fc('0x23')](_0x5dcbdc,_0x1691a1,!![]);}catch(_0x396c16){return BPromise[_0x50fc('0x24')](_0x396c16);}return _0x5dcbdc['save']();};}function saveUpdates(_0x45c1cf,_0x21f7b7){return function(_0x3f4653){if(_0x3f4653){return _0x3f4653[_0x50fc('0x25')](_0x45c1cf)['then'](function(_0xded907){return _0xded907;});}return null;};}function removeEntity(_0x23c477,_0x52509a){return function(_0x5b5685){if(_0x5b5685){return _0x5b5685['destroy']()['then'](function(){_0x23c477[_0x50fc('0x1a')](0xcc)[_0x50fc('0x1b')]();});}};}function handleEntityNotFound(_0x250f80,_0x44fa8e){return function(_0x4d83df){if(!_0x4d83df){_0x250f80['sendStatus'](0x194);}return _0x4d83df;};}function handleError(_0x19eb0d,_0xd9babd){_0xd9babd=_0xd9babd||0x1f4;return function(_0x529663){logger[_0x50fc('0x26')](_0x529663[_0x50fc('0x27')]);if(_0x529663[_0x50fc('0x28')]){delete _0x529663[_0x50fc('0x28')];}_0x19eb0d[_0x50fc('0x1a')](_0xd9babd)[_0x50fc('0x29')](_0x529663);};}exports[_0x50fc('0x2a')]=function(_0x34145a,_0x4159cb){var _0x583da8={},_0x554d58={},_0x8c90c={'count':0x0,'rows':[]};var _0x30893a=_[_0x50fc('0x2b')](db[_0x50fc('0x2c')][_0x50fc('0x2d')],function(_0x544a52){return{'name':_0x544a52[_0x50fc('0x2e')],'type':_0x544a52[_0x50fc('0x2f')][_0x50fc('0x30')]};});_0x554d58[_0x50fc('0x31')]=_[_0x50fc('0x2b')](_0x30893a,_0x50fc('0x28'));_0x554d58['query']=_[_0x50fc('0x32')](_0x34145a[_0x50fc('0x33')]);_0x554d58[_0x50fc('0x34')]=_[_0x50fc('0x35')](_0x554d58[_0x50fc('0x31')],_0x554d58[_0x50fc('0x33')]);_0x583da8[_0x50fc('0x36')]=_['intersection'](_0x554d58[_0x50fc('0x31')],qs[_0x50fc('0x37')](_0x34145a[_0x50fc('0x33')]['fields']));_0x583da8['attributes']=_0x583da8[_0x50fc('0x36')]['length']?_0x583da8[_0x50fc('0x36')]:_0x554d58['model'];if(!_0x34145a['query'][_0x50fc('0x38')]('nolimit')){_0x583da8[_0x50fc('0x1e')]=qs['limit'](_0x34145a[_0x50fc('0x33')][_0x50fc('0x1e')]);_0x583da8['offset']=qs[_0x50fc('0x1c')](_0x34145a[_0x50fc('0x33')][_0x50fc('0x1c')]);}_0x583da8[_0x50fc('0x39')]=qs[_0x50fc('0x3a')](_0x34145a[_0x50fc('0x33')][_0x50fc('0x3a')]);_0x583da8[_0x50fc('0x3b')]=qs[_0x50fc('0x34')](_['pick'](_0x34145a[_0x50fc('0x33')],_0x554d58[_0x50fc('0x34')]),_0x30893a);if(_0x34145a[_0x50fc('0x33')]['filter']){_0x583da8[_0x50fc('0x3b')]=_[_0x50fc('0x3c')](_0x583da8[_0x50fc('0x3b')],{'$or':_[_0x50fc('0x2b')](_0x30893a,function(_0x49d5ce){if(_0x49d5ce['type']!==_0x50fc('0x3d')){var _0x3b784e={};_0x3b784e[_0x49d5ce[_0x50fc('0x28')]]={'$like':'%'+_0x34145a['query'][_0x50fc('0x3e')]+'%'};return _0x3b784e;}})});}_0x583da8=_['merge']({},_0x583da8,_0x34145a[_0x50fc('0x3f')]);var _0x34b69b={'where':_0x583da8[_0x50fc('0x3b')]};return db['UserProfileSection'][_0x50fc('0x1f')](_0x34b69b)['then'](function(_0x3720ba){_0x8c90c[_0x50fc('0x1f')]=_0x3720ba;if(_0x34145a[_0x50fc('0x33')][_0x50fc('0x40')]){_0x583da8['include']=[{'all':!![]}];}return db[_0x50fc('0x2c')][_0x50fc('0x41')](_0x583da8);})[_0x50fc('0x42')](function(_0x4f0cb8){_0x8c90c[_0x50fc('0x43')]=_0x4f0cb8;return _0x8c90c;})[_0x50fc('0x42')](respondWithFilteredResult(_0x4159cb,_0x583da8))[_0x50fc('0x44')](handleError(_0x4159cb,null));};exports[_0x50fc('0x45')]=function(_0x18fcdf,_0x341d22){var _0xf20eb0={'raw':![],'where':{'id':_0x18fcdf['params']['id']}},_0x37e1ba={};_0x37e1ba[_0x50fc('0x31')]=_[_0x50fc('0x32')](db[_0x50fc('0x2c')][_0x50fc('0x2d')]);_0x37e1ba['query']=_[_0x50fc('0x32')](_0x18fcdf['query']);_0x37e1ba['filters']=_[_0x50fc('0x35')](_0x37e1ba['model'],_0x37e1ba['query']);_0xf20eb0[_0x50fc('0x36')]=_[_0x50fc('0x35')](_0x37e1ba[_0x50fc('0x31')],qs[_0x50fc('0x37')](_0x18fcdf[_0x50fc('0x33')][_0x50fc('0x37')]));_0xf20eb0[_0x50fc('0x36')]=_0xf20eb0['attributes']['length']?_0xf20eb0[_0x50fc('0x36')]:_0x37e1ba[_0x50fc('0x31')];if(_0x18fcdf['query'][_0x50fc('0x40')]){_0xf20eb0['include']=[{'all':!![]}];}_0xf20eb0=_['merge']({},_0xf20eb0,_0x18fcdf[_0x50fc('0x3f')]);return db[_0x50fc('0x2c')][_0x50fc('0x46')](_0xf20eb0)[_0x50fc('0x42')](handleEntityNotFound(_0x341d22,null))['then'](respondWithResult(_0x341d22,null))[_0x50fc('0x44')](handleError(_0x341d22,null));};exports[_0x50fc('0x47')]=function(_0x2d745d,_0x2b62e0){return db[_0x50fc('0x2c')][_0x50fc('0x47')](_0x2d745d[_0x50fc('0x48')],{})['then'](respondWithResult(_0x2b62e0,0xc9))[_0x50fc('0x44')](handleError(_0x2b62e0,null));};exports['update']=function(_0x5572e7,_0x448dd2){if(_0x5572e7[_0x50fc('0x48')]['id']){delete _0x5572e7[_0x50fc('0x48')]['id'];}return db[_0x50fc('0x2c')][_0x50fc('0x46')]({'where':{'id':_0x5572e7[_0x50fc('0x49')]['id']}})[_0x50fc('0x42')](handleEntityNotFound(_0x448dd2,null))['then'](saveUpdates(_0x5572e7['body'],null))[_0x50fc('0x42')](respondWithResult(_0x448dd2,null))[_0x50fc('0x44')](handleError(_0x448dd2,null));};exports[_0x50fc('0x4a')]=function(_0x40bfcc,_0x4bc7a4){return db['UserProfileSection'][_0x50fc('0x46')]({'where':{'id':_0x40bfcc[_0x50fc('0x49')]['id']}})[_0x50fc('0x42')](handleEntityNotFound(_0x4bc7a4,null))[_0x50fc('0x42')](removeEntity(_0x4bc7a4,null))[_0x50fc('0x44')](handleError(_0x4bc7a4,null));};exports[_0x50fc('0x4b')]=function(_0x1f3583,_0x166c21){return db[_0x50fc('0x2c')][_0x50fc('0x4b')]()[_0x50fc('0x42')](respondWithResult(_0x166c21,null))['catch'](handleError(_0x166c21,null));}; \ No newline at end of file diff --git a/server/api/userProfileSection/userProfileSection.model.js b/server/api/userProfileSection/userProfileSection.model.js index 2dcc73b..e6b13ae 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 _0x95eb=['moment','request-promise','path','rimraf','../../config/environment','./userProfileSection.attributes','exports','define','UserProfileSection','user_profile_has_sections','compositeIndex','sectionId','lodash','util','../../config/logger','api'];(function(_0x3c4737,_0x2329ec){var _0x2bb926=function(_0x3b9605){while(--_0x3b9605){_0x3c4737['push'](_0x3c4737['shift']());}};_0x2bb926(++_0x2329ec);}(_0x95eb,0x1cc));var _0xb95e=function(_0x5ef0b7,_0x2485ec){_0x5ef0b7=_0x5ef0b7-0x0;var _0x58f6ea=_0x95eb[_0x5ef0b7];return _0x58f6ea;};'use strict';var _=require(_0xb95e('0x0'));var util=require(_0xb95e('0x1'));var logger=require(_0xb95e('0x2'))(_0xb95e('0x3'));var moment=require(_0xb95e('0x4'));var BPromise=require('bluebird');var rp=require(_0xb95e('0x5'));var fs=require('fs');var path=require(_0xb95e('0x6'));var rimraf=require(_0xb95e('0x7'));var config=require(_0xb95e('0x8'));var attributes=require(_0xb95e('0x9'));module[_0xb95e('0xa')]=function(_0x37fd7b,_0x2a95cc){return _0x37fd7b[_0xb95e('0xb')](_0xb95e('0xc'),attributes,{'tableName':_0xb95e('0xd'),'paranoid':![],'indexes':[{'name':_0xb95e('0xe'),'fields':[_0xb95e('0xf'),'userProfileId']}],'timestamps':!![]});}; \ No newline at end of file +var _0x1a98=['bluebird','request-promise','rimraf','../../config/environment','./userProfileSection.attributes','exports','define','sectionId','userProfileId','lodash','util','../../config/logger','moment'];(function(_0x33f31b,_0x550ae9){var _0x33514e=function(_0x266538){while(--_0x266538){_0x33f31b['push'](_0x33f31b['shift']());}};_0x33514e(++_0x550ae9);}(_0x1a98,0x134));var _0x81a9=function(_0x4ddf09,_0x48d926){_0x4ddf09=_0x4ddf09-0x0;var _0x24784f=_0x1a98[_0x4ddf09];return _0x24784f;};'use strict';var _=require(_0x81a9('0x0'));var util=require(_0x81a9('0x1'));var logger=require(_0x81a9('0x2'))('api');var moment=require(_0x81a9('0x3'));var BPromise=require(_0x81a9('0x4'));var rp=require(_0x81a9('0x5'));var fs=require('fs');var path=require('path');var rimraf=require(_0x81a9('0x6'));var config=require(_0x81a9('0x7'));var attributes=require(_0x81a9('0x8'));module[_0x81a9('0x9')]=function(_0x29de7e,_0x262e0b){return _0x29de7e[_0x81a9('0xa')]('UserProfileSection',attributes,{'tableName':'user_profile_has_sections','paranoid':![],'indexes':[{'name':'compositeIndex','fields':[_0x81a9('0xb'),_0x81a9('0xc')]}],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/userProfileSection/userProfileSection.rpc.js b/server/api/userProfileSection/userProfileSection.rpc.js index f0034bd..44f33c0 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 _0xaefe=['error','code','UserProfileSection,\x20%s,\x20%s','message','request\x20sent','result','catch','lodash','util','moment','bluebird','randomstring','../../mysqldb','../../config/utils','../../config/environment','jayson/promise','http','request','then','info','debug','UserProfileSection,\x20%s,\x20%s,\x20%s','stringify'];(function(_0x5363df,_0x1c9aa3){var _0x2166a5=function(_0x3348c0){while(--_0x3348c0){_0x5363df['push'](_0x5363df['shift']());}};_0x2166a5(++_0x1c9aa3);}(_0xaefe,0x91));var _0xeaef=function(_0xed4881,_0x45771c){_0xed4881=_0xed4881-0x0;var _0x7fcbd5=_0xaefe[_0xed4881];return _0x7fcbd5;};'use strict';var _=require(_0xeaef('0x0'));var util=require(_0xeaef('0x1'));var moment=require(_0xeaef('0x2'));var BPromise=require(_0xeaef('0x3'));var rs=require(_0xeaef('0x4'));var fs=require('fs');var Redis=require('ioredis');var db=require(_0xeaef('0x5'))['db'];var utils=require(_0xeaef('0x6'));var logger=require('../../config/logger')('rpc');var config=require(_0xeaef('0x7'));var jayson=require(_0xeaef('0x8'));var client=jayson['client'][_0xeaef('0x9')]({'port':0x232a});function respondWithRpcPromise(_0x353428,_0x20f0fb,_0x5cf22c){return new BPromise(function(_0x4afe9a,_0x9e3c9a){return client[_0xeaef('0xa')](_0x353428,_0x5cf22c)[_0xeaef('0xb')](function(_0x38d22d){logger[_0xeaef('0xc')]('UserProfileSection,\x20%s,\x20%s',_0x20f0fb,'request\x20sent');logger[_0xeaef('0xd')](_0xeaef('0xe'),_0x20f0fb,'request\x20sent',JSON[_0xeaef('0xf')](_0x38d22d));if(_0x38d22d['error']){if(_0x38d22d[_0xeaef('0x10')][_0xeaef('0x11')]===0x1f4){logger[_0xeaef('0x10')](_0xeaef('0x12'),_0x20f0fb,_0x38d22d[_0xeaef('0x10')][_0xeaef('0x13')]);return _0x9e3c9a(_0x38d22d[_0xeaef('0x10')][_0xeaef('0x13')]);}logger[_0xeaef('0x10')](_0xeaef('0x12'),_0x20f0fb,_0x38d22d[_0xeaef('0x10')]['message']);return _0x4afe9a(_0x38d22d[_0xeaef('0x10')][_0xeaef('0x13')]);}else{logger['info'](_0xeaef('0x12'),_0x20f0fb,_0xeaef('0x14'));_0x4afe9a(_0x38d22d[_0xeaef('0x15')]['message']);}})[_0xeaef('0x16')](function(_0x2e356d){logger[_0xeaef('0x10')](_0xeaef('0x12'),_0x20f0fb,_0x2e356d);_0x9e3c9a(_0x2e356d);});});} \ No newline at end of file +var _0xbdda=['ioredis','../../config/logger','jayson/promise','client','http','request','info','UserProfileSection,\x20%s,\x20%s','debug','UserProfileSection,\x20%s,\x20%s,\x20%s','request\x20sent','stringify','error','code','message','result','catch','util','moment','bluebird','randomstring'];(function(_0x11c943,_0xff373){var _0x18fd0f=function(_0x45890d){while(--_0x45890d){_0x11c943['push'](_0x11c943['shift']());}};_0x18fd0f(++_0xff373);}(_0xbdda,0x137));var _0xabdd=function(_0x157d8c,_0x5f447c){_0x157d8c=_0x157d8c-0x0;var _0x42a515=_0xbdda[_0x157d8c];return _0x42a515;};'use strict';var _=require('lodash');var util=require(_0xabdd('0x0'));var moment=require(_0xabdd('0x1'));var BPromise=require(_0xabdd('0x2'));var rs=require(_0xabdd('0x3'));var fs=require('fs');var Redis=require(_0xabdd('0x4'));var db=require('../../mysqldb')['db'];var utils=require('../../config/utils');var logger=require(_0xabdd('0x5'))('rpc');var config=require('../../config/environment');var jayson=require(_0xabdd('0x6'));var client=jayson[_0xabdd('0x7')][_0xabdd('0x8')]({'port':0x232a});function respondWithRpcPromise(_0x253b8c,_0x1bfcb6,_0x49e074){return new BPromise(function(_0x341894,_0x5f1f5e){return client[_0xabdd('0x9')](_0x253b8c,_0x49e074)['then'](function(_0x1742d4){logger[_0xabdd('0xa')](_0xabdd('0xb'),_0x1bfcb6,'request\x20sent');logger[_0xabdd('0xc')](_0xabdd('0xd'),_0x1bfcb6,_0xabdd('0xe'),JSON[_0xabdd('0xf')](_0x1742d4));if(_0x1742d4[_0xabdd('0x10')]){if(_0x1742d4[_0xabdd('0x10')][_0xabdd('0x11')]===0x1f4){logger[_0xabdd('0x10')](_0xabdd('0xb'),_0x1bfcb6,_0x1742d4[_0xabdd('0x10')][_0xabdd('0x12')]);return _0x5f1f5e(_0x1742d4[_0xabdd('0x10')][_0xabdd('0x12')]);}logger[_0xabdd('0x10')](_0xabdd('0xb'),_0x1bfcb6,_0x1742d4[_0xabdd('0x10')]['message']);return _0x341894(_0x1742d4[_0xabdd('0x10')][_0xabdd('0x12')]);}else{logger['info'](_0xabdd('0xb'),_0x1bfcb6,_0xabdd('0xe'));_0x341894(_0x1742d4[_0xabdd('0x13')][_0xabdd('0x12')]);}})[_0xabdd('0x14')](function(_0xd6ad20){logger[_0xabdd('0x10')]('UserProfileSection,\x20%s,\x20%s',_0x1bfcb6,_0xd6ad20);_0x5f1f5e(_0xd6ad20);});});} \ No newline at end of file diff --git a/server/api/userSmsQueue/index.js b/server/api/userSmsQueue/index.js index 23999c6..278b536 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(_0x2d641e,_0x7b60eb){var _0x57dfc4=function(_0xb2289b){while(--_0xb2289b){_0x2d641e['push'](_0x2d641e['shift']());}};_0x57dfc4(++_0x7b60eb);}(_0xcb91,0x1a9));var _0x1cb9=function(_0x562f3b,_0x4c65ae){_0x562f3b=_0x562f3b-0x0;var _0x1edd55=_0xcb91[_0x562f3b];return _0x1edd55;};'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(_0x49a141,_0x201be4){var _0xc3c314=function(_0x548692){while(--_0x548692){_0x49a141['push'](_0x49a141['shift']());}};_0xc3c314(++_0x201be4);}(_0xd8b0,0xad));var _0x0d8b=function(_0x122ef9,_0x451d2a){_0x122ef9=_0x122ef9-0x0;var _0x42fba0=_0xd8b0[_0x122ef9];return _0x42fba0;};'use strict';var multer=require(_0x0d8b('0x0'));var util=require(_0x0d8b('0x1'));var path=require('path');var timeout=require('connect-timeout');var express=require('express');var router=express[_0x0d8b('0x2')]();var fs_extra=require(_0x0d8b('0x3'));var auth=require(_0x0d8b('0x4'));var interaction=require(_0x0d8b('0x5'));var config=require(_0x0d8b('0x6'));module['exports']=router; \ No newline at end of file diff --git a/server/api/userSmsQueue/userSmsQueue.attributes.js b/server/api/userSmsQueue/userSmsQueue.attributes.js index 2cea087..a79cb48 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 _0xeb48=['INTEGER','sequelize','exports'];(function(_0x1575fb,_0x48554c){var _0x1e5f78=function(_0x2d4a0e){while(--_0x2d4a0e){_0x1575fb['push'](_0x1575fb['shift']());}};_0x1e5f78(++_0x48554c);}(_0xeb48,0x88));var _0x8eb4=function(_0x5adb0a,_0x3db047){_0x5adb0a=_0x5adb0a-0x0;var _0x454aa6=_0xeb48[_0x5adb0a];return _0x454aa6;};'use strict';var Sequelize=require(_0x8eb4('0x0'));module[_0x8eb4('0x1')]={'penalty':{'type':Sequelize[_0x8eb4('0x2')],'defaultValue':0x0}}; \ No newline at end of file +var _0xdcde=['INTEGER'];(function(_0x2f3848,_0x48564d){var _0x102668=function(_0x5e32ab){while(--_0x5e32ab){_0x2f3848['push'](_0x2f3848['shift']());}};_0x102668(++_0x48564d);}(_0xdcde,0x8b));var _0xedcd=function(_0x880e15,_0x598416){_0x880e15=_0x880e15-0x0;var _0x4ce3c9=_0xdcde[_0x880e15];return _0x4ce3c9;};'use strict';var Sequelize=require('sequelize');module['exports']={'penalty':{'type':Sequelize[_0xedcd('0x0')],'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 baca8dd..7e030f6 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 _0xc2c7=['rimraf','exports','util','../../config/logger','api','moment','bluebird','request-promise','path'];(function(_0x569631,_0x370ee1){var _0x10a8f6=function(_0x32e09d){while(--_0x32e09d){_0x569631['push'](_0x569631['shift']());}};_0x10a8f6(++_0x370ee1);}(_0xc2c7,0x134));var _0x7c2c=function(_0x21180a,_0x4c9c6e){_0x21180a=_0x21180a-0x0;var _0x2d0712=_0xc2c7[_0x21180a];return _0x2d0712;};'use strict';var _=require('lodash');var util=require(_0x7c2c('0x0'));var logger=require(_0x7c2c('0x1'))(_0x7c2c('0x2'));var moment=require(_0x7c2c('0x3'));var BPromise=require(_0x7c2c('0x4'));var rp=require(_0x7c2c('0x5'));var fs=require('fs');var path=require(_0x7c2c('0x6'));var rimraf=require(_0x7c2c('0x7'));var config=require('../../config/environment');var attributes=require('./userSmsQueue.attributes');module[_0x7c2c('0x8')]=function(_0x42ecc9,_0x23c038){return _0x42ecc9['define']('UserSmsQueue',attributes,{'tableName':'user_has_sms_queues','paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0xbff5=['lodash','util','../../config/logger','api','moment','bluebird','request-promise','rimraf','exports','define','UserSmsQueue','user_has_sms_queues'];(function(_0x286f35,_0x6c9c65){var _0x1d2934=function(_0x40db89){while(--_0x40db89){_0x286f35['push'](_0x286f35['shift']());}};_0x1d2934(++_0x6c9c65);}(_0xbff5,0x1bc));var _0x5bff=function(_0x27ed3b,_0x10506b){_0x27ed3b=_0x27ed3b-0x0;var _0x3e84e6=_0xbff5[_0x27ed3b];return _0x3e84e6;};'use strict';var _=require(_0x5bff('0x0'));var util=require(_0x5bff('0x1'));var logger=require(_0x5bff('0x2'))(_0x5bff('0x3'));var moment=require(_0x5bff('0x4'));var BPromise=require(_0x5bff('0x5'));var rp=require(_0x5bff('0x6'));var fs=require('fs');var path=require('path');var rimraf=require(_0x5bff('0x7'));var config=require('../../config/environment');var attributes=require('./userSmsQueue.attributes');module[_0x5bff('0x8')]=function(_0x1d8650,_0x151add){return _0x1d8650[_0x5bff('0x9')](_0x5bff('0xa'),attributes,{'tableName':_0x5bff('0xb'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/userSmsQueue/userSmsQueue.rpc.js b/server/api/userSmsQueue/userSmsQueue.rpc.js index ba7370c..74eebe3 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 _0x5cdd=['bluebird','randomstring','ioredis','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','client','http','request','then','info','request\x20sent','stringify','error','code','message','UserSmsQueue,\x20%s,\x20%s','result','catch','lodash','util','moment'];(function(_0x4bbd93,_0x205605){var _0x669c4=function(_0x12a82f){while(--_0x12a82f){_0x4bbd93['push'](_0x4bbd93['shift']());}};_0x669c4(++_0x205605);}(_0x5cdd,0x8d));var _0xd5cd=function(_0x42cae2,_0x284ef8){_0x42cae2=_0x42cae2-0x0;var _0x5f256f=_0x5cdd[_0x42cae2];return _0x5f256f;};'use strict';var _=require(_0xd5cd('0x0'));var util=require(_0xd5cd('0x1'));var moment=require(_0xd5cd('0x2'));var BPromise=require(_0xd5cd('0x3'));var rs=require(_0xd5cd('0x4'));var fs=require('fs');var Redis=require(_0xd5cd('0x5'));var db=require('../../mysqldb')['db'];var utils=require(_0xd5cd('0x6'));var logger=require(_0xd5cd('0x7'))(_0xd5cd('0x8'));var config=require(_0xd5cd('0x9'));var jayson=require(_0xd5cd('0xa'));var client=jayson[_0xd5cd('0xb')][_0xd5cd('0xc')]({'port':0x232a});function respondWithRpcPromise(_0x5b1bb1,_0x39d471,_0x481e04){return new BPromise(function(_0x1882bc,_0x57494e){return client[_0xd5cd('0xd')](_0x5b1bb1,_0x481e04)[_0xd5cd('0xe')](function(_0x4da046){logger[_0xd5cd('0xf')]('UserSmsQueue,\x20%s,\x20%s',_0x39d471,_0xd5cd('0x10'));logger['debug']('UserSmsQueue,\x20%s,\x20%s,\x20%s',_0x39d471,'request\x20sent',JSON[_0xd5cd('0x11')](_0x4da046));if(_0x4da046[_0xd5cd('0x12')]){if(_0x4da046[_0xd5cd('0x12')][_0xd5cd('0x13')]===0x1f4){logger['error']('UserSmsQueue,\x20%s,\x20%s',_0x39d471,_0x4da046[_0xd5cd('0x12')][_0xd5cd('0x14')]);return _0x57494e(_0x4da046[_0xd5cd('0x12')][_0xd5cd('0x14')]);}logger[_0xd5cd('0x12')]('UserSmsQueue,\x20%s,\x20%s',_0x39d471,_0x4da046[_0xd5cd('0x12')][_0xd5cd('0x14')]);return _0x1882bc(_0x4da046['error']['message']);}else{logger[_0xd5cd('0xf')](_0xd5cd('0x15'),_0x39d471,_0xd5cd('0x10'));_0x1882bc(_0x4da046[_0xd5cd('0x16')]['message']);}})[_0xd5cd('0x17')](function(_0x11794f){logger[_0xd5cd('0x12')](_0xd5cd('0x15'),_0x39d471,_0x11794f);_0x57494e(_0x11794f);});});} \ No newline at end of file +var _0x97c0=['randomstring','ioredis','../../mysqldb','../../config/utils','rpc','jayson/promise','then','info','UserSmsQueue,\x20%s,\x20%s','request\x20sent','debug','UserSmsQueue,\x20%s,\x20%s,\x20%s','stringify','error','code','message','result','catch','lodash','util','bluebird'];(function(_0x50874a,_0x1d8a34){var _0x4d8ae0=function(_0x4bee82){while(--_0x4bee82){_0x50874a['push'](_0x50874a['shift']());}};_0x4d8ae0(++_0x1d8a34);}(_0x97c0,0x1cb));var _0x097c=function(_0x1ffc5f,_0x37a8b8){_0x1ffc5f=_0x1ffc5f-0x0;var _0x1c89bd=_0x97c0[_0x1ffc5f];return _0x1c89bd;};'use strict';var _=require(_0x097c('0x0'));var util=require(_0x097c('0x1'));var moment=require('moment');var BPromise=require(_0x097c('0x2'));var rs=require(_0x097c('0x3'));var fs=require('fs');var Redis=require(_0x097c('0x4'));var db=require(_0x097c('0x5'))['db'];var utils=require(_0x097c('0x6'));var logger=require('../../config/logger')(_0x097c('0x7'));var config=require('../../config/environment');var jayson=require(_0x097c('0x8'));var client=jayson['client']['http']({'port':0x232a});function respondWithRpcPromise(_0x4663b2,_0x35f8df,_0x1e8e5e){return new BPromise(function(_0x1cc861,_0x41ce41){return client['request'](_0x4663b2,_0x1e8e5e)[_0x097c('0x9')](function(_0x38736d){logger[_0x097c('0xa')](_0x097c('0xb'),_0x35f8df,_0x097c('0xc'));logger[_0x097c('0xd')](_0x097c('0xe'),_0x35f8df,'request\x20sent',JSON[_0x097c('0xf')](_0x38736d));if(_0x38736d['error']){if(_0x38736d[_0x097c('0x10')][_0x097c('0x11')]===0x1f4){logger['error'](_0x097c('0xb'),_0x35f8df,_0x38736d[_0x097c('0x10')][_0x097c('0x12')]);return _0x41ce41(_0x38736d['error'][_0x097c('0x12')]);}logger[_0x097c('0x10')](_0x097c('0xb'),_0x35f8df,_0x38736d['error'][_0x097c('0x12')]);return _0x1cc861(_0x38736d[_0x097c('0x10')][_0x097c('0x12')]);}else{logger[_0x097c('0xa')](_0x097c('0xb'),_0x35f8df,_0x097c('0xc'));_0x1cc861(_0x38736d[_0x097c('0x13')][_0x097c('0x12')]);}})[_0x097c('0x14')](function(_0x7aa547){logger[_0x097c('0x10')](_0x097c('0xb'),_0x35f8df,_0x7aa547);_0x41ce41(_0x7aa547);});});} \ No newline at end of file diff --git a/server/api/userVoicePrefix/userVoicePrefix.attributes.js b/server/api/userVoicePrefix/userVoicePrefix.attributes.js index 16ca187..dcf020b 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 _0x84fd=['sequelize','exports','INTEGER'];(function(_0x22c29f,_0x4805ea){var _0x2b16c4=function(_0x525d45){while(--_0x525d45){_0x22c29f['push'](_0x22c29f['shift']());}};_0x2b16c4(++_0x4805ea);}(_0x84fd,0x1ec));var _0xd84f=function(_0x49e2a,_0xb4b7b1){_0x49e2a=_0x49e2a-0x0;var _0x21ae1c=_0x84fd[_0x49e2a];return _0x21ae1c;};'use strict';var Sequelize=require(_0xd84f('0x0'));module[_0xd84f('0x1')]={'UserId':{'type':Sequelize[_0xd84f('0x2')]},'VoicePrefixId':{'type':Sequelize[_0xd84f('0x2')]}}; \ No newline at end of file +var _0xa003=['exports','INTEGER'];(function(_0x60286b,_0x3247c1){var _0x5dff69=function(_0x4ecfcf){while(--_0x4ecfcf){_0x60286b['push'](_0x60286b['shift']());}};_0x5dff69(++_0x3247c1);}(_0xa003,0x134));var _0x3a00=function(_0x363177,_0x5aff67){_0x363177=_0x363177-0x0;var _0x533f51=_0xa003[_0x363177];return _0x533f51;};'use strict';var Sequelize=require('sequelize');module[_0x3a00('0x0')]={'UserId':{'type':Sequelize[_0x3a00('0x1')]},'VoicePrefixId':{'type':Sequelize[_0x3a00('0x1')]}}; \ No newline at end of file diff --git a/server/api/userVoicePrefix/userVoicePrefix.model.js b/server/api/userVoicePrefix/userVoicePrefix.model.js index a91574c..eb78e6c 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(_0x33e504,_0x40dc6f){var _0x1a349f=function(_0x41927c){while(--_0x41927c){_0x33e504['push'](_0x33e504['shift']());}};_0x1a349f(++_0x40dc6f);}(_0xa9e0,0x123));var _0x0a9e=function(_0x5783f4,_0x4a9e0a){_0x5783f4=_0x5783f4-0x0;var _0x28e380=_0xa9e0[_0x5783f4];return _0x28e380;};'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(_0x4ed89f,_0x51cdb0){var _0x15446b=function(_0x57c418){while(--_0x57c418){_0x4ed89f['push'](_0x4ed89f['shift']());}};_0x15446b(++_0x51cdb0);}(_0xa9e0,0x123));var _0x0a9e=function(_0x2f5ac5,_0x1ee939){_0x2f5ac5=_0x2f5ac5-0x0;var _0x37c9a8=_0xa9e0[_0x2f5ac5];return _0x37c9a8;};'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 4b080a5..3e35fde 100644 --- a/server/api/userVoiceQueue/index.js +++ b/server/api/userVoiceQueue/index.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0xa9e0=['../../components/interaction/service','../../config/environment','exports','multer','util','path','Router','../../components/auth/service'];(function(_0x126252,_0x2e41d4){var _0x589e99=function(_0x313b0b){while(--_0x313b0b){_0x126252['push'](_0x126252['shift']());}};_0x589e99(++_0x2e41d4);}(_0xa9e0,0x123));var _0x0a9e=function(_0x54d4fe,_0x55e869){_0x54d4fe=_0x54d4fe-0x0;var _0x1ab5bb=_0xa9e0[_0x54d4fe];return _0x1ab5bb;};'use strict';var multer=require(_0x0a9e('0x0'));var util=require(_0x0a9e('0x1'));var path=require(_0x0a9e('0x2'));var timeout=require('connect-timeout');var express=require('express');var router=express[_0x0a9e('0x3')]();var fs_extra=require('fs-extra');var auth=require(_0x0a9e('0x4'));var interaction=require(_0x0a9e('0x5'));var config=require(_0x0a9e('0x6'));module[_0x0a9e('0x7')]=router; \ No newline at end of file +var _0x0713=['../../config/environment','exports','path','connect-timeout','express','Router','fs-extra','../../components/interaction/service'];(function(_0x228265,_0x1aada6){var _0x32b20e=function(_0x3482d5){while(--_0x3482d5){_0x228265['push'](_0x228265['shift']());}};_0x32b20e(++_0x1aada6);}(_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 f50b13b..49ed8e6 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 _0xf763=['INTEGER','sequelize'];(function(_0x391cbb,_0x1e7a8e){var _0x3d5576=function(_0x1063c8){while(--_0x1063c8){_0x391cbb['push'](_0x391cbb['shift']());}};_0x3d5576(++_0x1e7a8e);}(_0xf763,0x1eb));var _0x3f76=function(_0x3a9dcd,_0x264f8b){_0x3a9dcd=_0x3a9dcd-0x0;var _0x196a2f=_0xf763[_0x3a9dcd];return _0x196a2f;};'use strict';var Sequelize=require(_0x3f76('0x0'));module['exports']={'penalty':{'type':Sequelize[_0x3f76('0x1')],'defaultValue':0x0}}; \ No newline at end of file +var _0x6cb7=['sequelize','exports','INTEGER'];(function(_0x20a584,_0xe384a5){var _0x4b41a8=function(_0x2127c6){while(--_0x2127c6){_0x20a584['push'](_0x20a584['shift']());}};_0x4b41a8(++_0xe384a5);}(_0x6cb7,0x114));var _0x76cb=function(_0x289a75,_0x553456){_0x289a75=_0x289a75-0x0;var _0x33055d=_0x6cb7[_0x289a75];return _0x33055d;};'use strict';var Sequelize=require(_0x76cb('0x0'));module[_0x76cb('0x1')]={'penalty':{'type':Sequelize[_0x76cb('0x2')],'defaultValue':0x0}}; \ No newline at end of file diff --git a/server/api/userVoiceQueue/userVoiceQueue.model.js b/server/api/userVoiceQueue/userVoiceQueue.model.js index 96dd553..107b485 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 _0xa017=['user_has_voice_queues','lodash','util','../../config/logger','moment','rimraf','./userVoiceQueue.attributes','exports','define'];(function(_0x3528cc,_0xa07a14){var _0x31ae08=function(_0x1b3827){while(--_0x1b3827){_0x3528cc['push'](_0x3528cc['shift']());}};_0x31ae08(++_0xa07a14);}(_0xa017,0x118));var _0x7a01=function(_0xe6164f,_0x47e826){_0xe6164f=_0xe6164f-0x0;var _0x557c61=_0xa017[_0xe6164f];return _0x557c61;};'use strict';var _=require(_0x7a01('0x0'));var util=require(_0x7a01('0x1'));var logger=require(_0x7a01('0x2'))('api');var moment=require(_0x7a01('0x3'));var BPromise=require('bluebird');var rp=require('request-promise');var fs=require('fs');var path=require('path');var rimraf=require(_0x7a01('0x4'));var config=require('../../config/environment');var attributes=require(_0x7a01('0x5'));module[_0x7a01('0x6')]=function(_0x1c7daf,_0x4302fe){return _0x1c7daf[_0x7a01('0x7')]('UserVoiceQueue',attributes,{'tableName':_0x7a01('0x8'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x5b42=['bluebird','request-promise','path','rimraf','exports','define','UserVoiceQueue','lodash','../../config/logger','api','moment'];(function(_0x2dafbe,_0x5d04de){var _0x58a45a=function(_0x50ac96){while(--_0x50ac96){_0x2dafbe['push'](_0x2dafbe['shift']());}};_0x58a45a(++_0x5d04de);}(_0x5b42,0xa1));var _0x25b4=function(_0x49537d,_0x7ecddb){_0x49537d=_0x49537d-0x0;var _0x1f4a4b=_0x5b42[_0x49537d];return _0x1f4a4b;};'use strict';var _=require(_0x25b4('0x0'));var util=require('util');var logger=require(_0x25b4('0x1'))(_0x25b4('0x2'));var moment=require(_0x25b4('0x3'));var BPromise=require(_0x25b4('0x4'));var rp=require(_0x25b4('0x5'));var fs=require('fs');var path=require(_0x25b4('0x6'));var rimraf=require(_0x25b4('0x7'));var config=require('../../config/environment');var attributes=require('./userVoiceQueue.attributes');module[_0x25b4('0x8')]=function(_0x3c6604,_0x46e9c1){return _0x3c6604[_0x25b4('0x9')](_0x25b4('0xa'),attributes,{'tableName':'user_has_voice_queues','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 d48e4a7..b12e190 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 _0xf1fb=['catch','util','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/environment','jayson/promise','http','request','then','UserVoiceQueue,\x20%s,\x20%s','request\x20sent','stringify','error','message','info','result'];(function(_0x550aed,_0x1ba6cb){var _0x1c43a5=function(_0x39e5f7){while(--_0x39e5f7){_0x550aed['push'](_0x550aed['shift']());}};_0x1c43a5(++_0x1ba6cb);}(_0xf1fb,0x12d));var _0xbf1f=function(_0x1a9204,_0x1c9e00){_0x1a9204=_0x1a9204-0x0;var _0x17ca68=_0xf1fb[_0x1a9204];return _0x17ca68;};'use strict';var _=require('lodash');var util=require(_0xbf1f('0x0'));var moment=require(_0xbf1f('0x1'));var BPromise=require(_0xbf1f('0x2'));var rs=require(_0xbf1f('0x3'));var fs=require('fs');var Redis=require(_0xbf1f('0x4'));var db=require(_0xbf1f('0x5'))['db'];var utils=require(_0xbf1f('0x6'));var logger=require('../../config/logger')('rpc');var config=require(_0xbf1f('0x7'));var jayson=require(_0xbf1f('0x8'));var client=jayson['client'][_0xbf1f('0x9')]({'port':0x232a});function respondWithRpcPromise(_0x2f4906,_0x651dd2,_0x929f45){return new BPromise(function(_0x1a2a17,_0x2e016f){return client[_0xbf1f('0xa')](_0x2f4906,_0x929f45)[_0xbf1f('0xb')](function(_0x4648e8){logger['info'](_0xbf1f('0xc'),_0x651dd2,'request\x20sent');logger['debug']('UserVoiceQueue,\x20%s,\x20%s,\x20%s',_0x651dd2,_0xbf1f('0xd'),JSON[_0xbf1f('0xe')](_0x4648e8));if(_0x4648e8['error']){if(_0x4648e8[_0xbf1f('0xf')]['code']===0x1f4){logger[_0xbf1f('0xf')](_0xbf1f('0xc'),_0x651dd2,_0x4648e8['error'][_0xbf1f('0x10')]);return _0x2e016f(_0x4648e8[_0xbf1f('0xf')][_0xbf1f('0x10')]);}logger['error'](_0xbf1f('0xc'),_0x651dd2,_0x4648e8[_0xbf1f('0xf')][_0xbf1f('0x10')]);return _0x1a2a17(_0x4648e8[_0xbf1f('0xf')][_0xbf1f('0x10')]);}else{logger[_0xbf1f('0x11')](_0xbf1f('0xc'),_0x651dd2,_0xbf1f('0xd'));_0x1a2a17(_0x4648e8[_0xbf1f('0x12')][_0xbf1f('0x10')]);}})[_0xbf1f('0x13')](function(_0x241c34){logger[_0xbf1f('0xf')]('UserVoiceQueue,\x20%s,\x20%s',_0x651dd2,_0x241c34);_0x2e016f(_0x241c34);});});} \ No newline at end of file +var _0x4215=['jayson/promise','http','then','info','UserVoiceQueue,\x20%s,\x20%s','request\x20sent','debug','stringify','error','message','lodash','util','moment','bluebird','randomstring','../../config/utils','../../config/logger','rpc','../../config/environment'];(function(_0x59ee6f,_0x450239){var _0x4c0979=function(_0x565e92){while(--_0x565e92){_0x59ee6f['push'](_0x59ee6f['shift']());}};_0x4c0979(++_0x450239);}(_0x4215,0x1ac));var _0x5421=function(_0x2c6200,_0x5e083f){_0x2c6200=_0x2c6200-0x0;var _0x1d43e9=_0x4215[_0x2c6200];return _0x1d43e9;};'use strict';var _=require(_0x5421('0x0'));var util=require(_0x5421('0x1'));var moment=require(_0x5421('0x2'));var BPromise=require(_0x5421('0x3'));var rs=require(_0x5421('0x4'));var fs=require('fs');var Redis=require('ioredis');var db=require('../../mysqldb')['db'];var utils=require(_0x5421('0x5'));var logger=require(_0x5421('0x6'))(_0x5421('0x7'));var config=require(_0x5421('0x8'));var jayson=require(_0x5421('0x9'));var client=jayson['client'][_0x5421('0xa')]({'port':0x232a});function respondWithRpcPromise(_0x1ad132,_0xb14bae,_0x13e0d7){return new BPromise(function(_0x49c01f,_0x497d56){return client['request'](_0x1ad132,_0x13e0d7)[_0x5421('0xb')](function(_0x11d3e9){logger[_0x5421('0xc')](_0x5421('0xd'),_0xb14bae,_0x5421('0xe'));logger[_0x5421('0xf')]('UserVoiceQueue,\x20%s,\x20%s,\x20%s',_0xb14bae,_0x5421('0xe'),JSON[_0x5421('0x10')](_0x11d3e9));if(_0x11d3e9[_0x5421('0x11')]){if(_0x11d3e9[_0x5421('0x11')]['code']===0x1f4){logger[_0x5421('0x11')](_0x5421('0xd'),_0xb14bae,_0x11d3e9[_0x5421('0x11')][_0x5421('0x12')]);return _0x497d56(_0x11d3e9[_0x5421('0x11')]['message']);}logger['error']('UserVoiceQueue,\x20%s,\x20%s',_0xb14bae,_0x11d3e9[_0x5421('0x11')][_0x5421('0x12')]);return _0x49c01f(_0x11d3e9[_0x5421('0x11')][_0x5421('0x12')]);}else{logger['info'](_0x5421('0xd'),_0xb14bae,'request\x20sent');_0x49c01f(_0x11d3e9['result'][_0x5421('0x12')]);}})['catch'](function(_0x406d3d){logger['error'](_0x5421('0xd'),_0xb14bae,_0x406d3d);_0x497d56(_0x406d3d);});});} \ No newline at end of file diff --git a/server/api/userVoiceQueueRt/index.js b/server/api/userVoiceQueueRt/index.js index 6333227..619f496 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(_0x2e439e,_0x1e92af){var _0x312866=function(_0x201d22){while(--_0x201d22){_0x2e439e['push'](_0x2e439e['shift']());}};_0x312866(++_0x1e92af);}(_0x70e0,0x17b));var _0x070e=function(_0x18b2a6,_0x9a66ec){_0x18b2a6=_0x18b2a6-0x0;var _0x78b233=_0x70e0[_0x18b2a6];return _0x78b233;};'use strict';var multer=require(_0x070e('0x0'));var util=require(_0x070e('0x1'));var path=require(_0x070e('0x2'));var timeout=require('connect-timeout');var express=require('express');var router=express[_0x070e('0x3')]();var fs_extra=require(_0x070e('0x4'));var auth=require(_0x070e('0x5'));var interaction=require(_0x070e('0x6'));var config=require('../../config/environment');module[_0x070e('0x7')]=router; \ No newline at end of file +var _0xa9e0=['../../components/interaction/service','../../config/environment','exports','multer','util','path','Router','../../components/auth/service'];(function(_0x4671a5,_0x1db5f4){var _0x12f1ac=function(_0x3f09de){while(--_0x3f09de){_0x4671a5['push'](_0x4671a5['shift']());}};_0x12f1ac(++_0x1db5f4);}(_0xa9e0,0x123));var _0x0a9e=function(_0x40ac5e,_0x2de228){_0x40ac5e=_0x40ac5e-0x0;var _0x2839d6=_0xa9e0[_0x40ac5e];return _0x2839d6;};'use strict';var multer=require(_0x0a9e('0x0'));var util=require(_0x0a9e('0x1'));var path=require(_0x0a9e('0x2'));var timeout=require('connect-timeout');var express=require('express');var router=express[_0x0a9e('0x3')]();var fs_extra=require('fs-extra');var auth=require(_0x0a9e('0x4'));var interaction=require(_0x0a9e('0x5'));var config=require(_0x0a9e('0x6'));module[_0x0a9e('0x7')]=router; \ No newline at end of file diff --git a/server/api/userVoiceQueueRt/userVoiceQueueRt.attributes.js b/server/api/userVoiceQueueRt/userVoiceQueueRt.attributes.js index 7429781..acc51af 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 _0x34af=['INTEGER','Required\x20by\x20Asterisk','STRING','queue_interface','sequelize','exports'];(function(_0x244bc5,_0x1bb259){var _0x15586f=function(_0x30bc87){while(--_0x30bc87){_0x244bc5['push'](_0x244bc5['shift']());}};_0x15586f(++_0x1bb259);}(_0x34af,0x18a));var _0xf34a=function(_0x54e1d2,_0x288fc5){_0x54e1d2=_0x54e1d2-0x0;var _0x21d1ec=_0x34af[_0x54e1d2];return _0x21d1ec;};'use strict';var Sequelize=require(_0xf34a('0x0'));module[_0xf34a('0x1')]={'uniqueid':{'type':Sequelize[_0xf34a('0x2')],'primaryKey':!![],'autoIncrement':!![],'comment':_0xf34a('0x3')},'membername':{'type':Sequelize[_0xf34a('0x4')],'allowNull':![],'comment':_0xf34a('0x3')},'UserId':{'type':Sequelize[_0xf34a('0x2')],'allowNull':![]},'queue_name':{'type':Sequelize[_0xf34a('0x4')],'allowNull':![],'unique':_0xf34a('0x5'),'comment':'Required\x20by\x20Asterisk'},'VoiceQueueId':{'type':Sequelize['INTEGER'],'allowNull':![]},'interface':{'type':Sequelize[_0xf34a('0x4')],'allowNull':![],'unique':'queue_interface','comment':_0xf34a('0x3')},'penalty':{'type':Sequelize[_0xf34a('0x2')](0xb),'defaultValue':0x0,'comment':_0xf34a('0x3')},'paused':{'type':Sequelize[_0xf34a('0x2')](0xb),'defaultValue':0x0,'comment':_0xf34a('0x3')}}; \ No newline at end of file +var _0x74bb=['Required\x20by\x20Asterisk','STRING','sequelize','INTEGER'];(function(_0x3c8d87,_0x4f156a){var _0x42a735=function(_0x5bbfde){while(--_0x5bbfde){_0x3c8d87['push'](_0x3c8d87['shift']());}};_0x42a735(++_0x4f156a);}(_0x74bb,0x1de));var _0xb74b=function(_0x2030d2,_0x3d0ffe){_0x2030d2=_0x2030d2-0x0;var _0x19523a=_0x74bb[_0x2030d2];return _0x19523a;};'use strict';var Sequelize=require(_0xb74b('0x0'));module['exports']={'uniqueid':{'type':Sequelize[_0xb74b('0x1')],'primaryKey':!![],'autoIncrement':!![],'comment':_0xb74b('0x2')},'membername':{'type':Sequelize[_0xb74b('0x3')],'allowNull':![],'comment':_0xb74b('0x2')},'UserId':{'type':Sequelize[_0xb74b('0x1')],'allowNull':![]},'queue_name':{'type':Sequelize[_0xb74b('0x3')],'allowNull':![],'unique':'queue_interface','comment':_0xb74b('0x2')},'VoiceQueueId':{'type':Sequelize[_0xb74b('0x1')],'allowNull':![]},'interface':{'type':Sequelize[_0xb74b('0x3')],'allowNull':![],'unique':'queue_interface','comment':'Required\x20by\x20Asterisk'},'penalty':{'type':Sequelize[_0xb74b('0x1')](0xb),'defaultValue':0x0,'comment':_0xb74b('0x2')},'paused':{'type':Sequelize[_0xb74b('0x1')](0xb),'defaultValue':0x0,'comment':_0xb74b('0x2')}}; \ No newline at end of file diff --git a/server/api/userVoiceQueueRt/userVoiceQueueRt.events.js b/server/api/userVoiceQueueRt/userVoiceQueueRt.events.js index cf8b3f0..cc40049 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 _0x45c1=['setMaxListeners','save','update','remove','emit','hasOwnProperty','hook','events','../../mysqldb','UserVoiceQueueRt'];(function(_0x26fe14,_0x1bbdd2){var _0x2af07e=function(_0x49d32b){while(--_0x49d32b){_0x26fe14['push'](_0x26fe14['shift']());}};_0x2af07e(++_0x1bbdd2);}(_0x45c1,0x115));var _0x145c=function(_0x38a3b4,_0x4f46f1){_0x38a3b4=_0x38a3b4-0x0;var _0xf47560=_0x45c1[_0x38a3b4];return _0xf47560;};'use strict';var EventEmitter=require(_0x145c('0x0'));var UserVoiceQueueRt=require(_0x145c('0x1'))['db'][_0x145c('0x2')];var UserVoiceQueueRtEvents=new EventEmitter();UserVoiceQueueRtEvents[_0x145c('0x3')](0x0);var events={'afterCreate':_0x145c('0x4'),'afterUpdate':_0x145c('0x5'),'afterDestroy':_0x145c('0x6')};function emitEvent(_0x5858a9){return function(_0x4ff9ba,_0x584125,_0x56d1cc){UserVoiceQueueRtEvents['emit'](_0x5858a9+':'+_0x4ff9ba['id'],_0x4ff9ba);UserVoiceQueueRtEvents[_0x145c('0x7')](_0x5858a9,_0x4ff9ba);_0x56d1cc(null);};}for(var e in events){if(events[_0x145c('0x8')](e)){var event=events[e];UserVoiceQueueRt[_0x145c('0x9')](e,emitEvent(event));}}module['exports']=UserVoiceQueueRtEvents; \ No newline at end of file +var _0x2fac=['../../mysqldb','UserVoiceQueueRt','setMaxListeners','save','update','remove','emit','hasOwnProperty','hook','exports'];(function(_0x19e35c,_0x29cd1e){var _0x3e1fe8=function(_0x17258b){while(--_0x17258b){_0x19e35c['push'](_0x19e35c['shift']());}};_0x3e1fe8(++_0x29cd1e);}(_0x2fac,0x136));var _0xc2fa=function(_0x32efbb,_0x57681a){_0x32efbb=_0x32efbb-0x0;var _0x250000=_0x2fac[_0x32efbb];return _0x250000;};'use strict';var EventEmitter=require('events');var UserVoiceQueueRt=require(_0xc2fa('0x0'))['db'][_0xc2fa('0x1')];var UserVoiceQueueRtEvents=new EventEmitter();UserVoiceQueueRtEvents[_0xc2fa('0x2')](0x0);var events={'afterCreate':_0xc2fa('0x3'),'afterUpdate':_0xc2fa('0x4'),'afterDestroy':_0xc2fa('0x5')};function emitEvent(_0x3a9f67){return function(_0x5a434e,_0x398faf,_0x3b7051){UserVoiceQueueRtEvents[_0xc2fa('0x6')](_0x3a9f67+':'+_0x5a434e['id'],_0x5a434e);UserVoiceQueueRtEvents[_0xc2fa('0x6')](_0x3a9f67,_0x5a434e);_0x3b7051(null);};}for(var e in events){if(events[_0xc2fa('0x7')](e)){var event=events[e];UserVoiceQueueRt[_0xc2fa('0x8')](e,emitEvent(event));}}module[_0xc2fa('0x9')]=UserVoiceQueueRtEvents; \ No newline at end of file diff --git a/server/api/userVoiceQueueRt/userVoiceQueueRt.model.js b/server/api/userVoiceQueueRt/userVoiceQueueRt.model.js index 51f9451..a1fac0d 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 _0xd417=['./userVoiceQueueRt.attributes','exports','define','UserVoiceQueueRt','user_has_voice_queues_rt','lodash','util','../../config/logger','api','moment','bluebird','request-promise','path','../../config/environment'];(function(_0x280d83,_0x6575e9){var _0x586f6f=function(_0x3f4b63){while(--_0x3f4b63){_0x280d83['push'](_0x280d83['shift']());}};_0x586f6f(++_0x6575e9);}(_0xd417,0x1c5));var _0x7d41=function(_0x39435a,_0xe25c1d){_0x39435a=_0x39435a-0x0;var _0x574361=_0xd417[_0x39435a];return _0x574361;};'use strict';var _=require(_0x7d41('0x0'));var util=require(_0x7d41('0x1'));var logger=require(_0x7d41('0x2'))(_0x7d41('0x3'));var moment=require(_0x7d41('0x4'));var BPromise=require(_0x7d41('0x5'));var rp=require(_0x7d41('0x6'));var fs=require('fs');var path=require(_0x7d41('0x7'));var rimraf=require('rimraf');var config=require(_0x7d41('0x8'));var attributes=require(_0x7d41('0x9'));module[_0x7d41('0xa')]=function(_0x2e50b3,_0xc0284d){return _0x2e50b3[_0x7d41('0xb')](_0x7d41('0xc'),attributes,{'tableName':_0x7d41('0xd'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x6adf=['request-promise','path','rimraf','../../config/environment','UserVoiceQueueRt','user_has_voice_queues_rt','../../config/logger','api','moment','bluebird'];(function(_0x31dde9,_0x12e816){var _0x1fbf2d=function(_0x1d1bf6){while(--_0x1d1bf6){_0x31dde9['push'](_0x31dde9['shift']());}};_0x1fbf2d(++_0x12e816);}(_0x6adf,0x16e));var _0xf6ad=function(_0x409a88,_0xf5db6a){_0x409a88=_0x409a88-0x0;var _0x2562c9=_0x6adf[_0x409a88];return _0x2562c9;};'use strict';var _=require('lodash');var util=require('util');var logger=require(_0xf6ad('0x0'))(_0xf6ad('0x1'));var moment=require(_0xf6ad('0x2'));var BPromise=require(_0xf6ad('0x3'));var rp=require(_0xf6ad('0x4'));var fs=require('fs');var path=require(_0xf6ad('0x5'));var rimraf=require(_0xf6ad('0x6'));var config=require(_0xf6ad('0x7'));var attributes=require('./userVoiceQueueRt.attributes');module['exports']=function(_0x499788,_0x35bcba){return _0x499788['define'](_0xf6ad('0x8'),attributes,{'tableName':_0xf6ad('0x9'),'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 ab4addf..e436db4 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 _0xcc15=['../../mysqldb','../../config/utils','../../config/environment','client','defaults','redis','socket.io-emitter','./userVoiceQueueRt.socket','register','request','then','info','debug','request\x20sent','stringify','error','code','UserVoiceQueueRt,\x20%s,\x20%s','message','result','GetVoiceQueueRtPauses','UserVoiceQueueRt','findAll','options','raw','sequelize','COUNT','literal','outboundQueuePauses','lodash','util','moment','bluebird','randomstring','ioredis'];(function(_0x2bd7c7,_0x466b72){var _0x4c7158=function(_0x53ff99){while(--_0x53ff99){_0x2bd7c7['push'](_0x2bd7c7['shift']());}};_0x4c7158(++_0x466b72);}(_0xcc15,0xa9));var _0x5cc1=function(_0x4e676e,_0x2a7c6d){_0x4e676e=_0x4e676e-0x0;var _0x336a3c=_0xcc15[_0x4e676e];return _0x336a3c;};'use strict';var _=require(_0x5cc1('0x0'));var util=require(_0x5cc1('0x1'));var moment=require(_0x5cc1('0x2'));var BPromise=require(_0x5cc1('0x3'));var rs=require(_0x5cc1('0x4'));var fs=require('fs');var Redis=require(_0x5cc1('0x5'));var db=require(_0x5cc1('0x6'))['db'];var utils=require(_0x5cc1('0x7'));var logger=require('../../config/logger')('rpc');var config=require(_0x5cc1('0x8'));var jayson=require('jayson/promise');var client=jayson[_0x5cc1('0x9')]['http']({'port':0x232a});config['redis']=_[_0x5cc1('0xa')](config[_0x5cc1('0xb')],{'host':'localhost','port':0x18eb});var socket=require(_0x5cc1('0xc'))(new Redis(config[_0x5cc1('0xb')]));require(_0x5cc1('0xd'))[_0x5cc1('0xe')](socket);function respondWithRpcPromise(_0x5366c3,_0x416de4,_0x30bfdd){return new BPromise(function(_0x21fbf8,_0x5aa523){return client[_0x5cc1('0xf')](_0x5366c3,_0x30bfdd)[_0x5cc1('0x10')](function(_0x6b053b){logger[_0x5cc1('0x11')]('UserVoiceQueueRt,\x20%s,\x20%s',_0x416de4,'request\x20sent');logger[_0x5cc1('0x12')]('UserVoiceQueueRt,\x20%s,\x20%s,\x20%s',_0x416de4,_0x5cc1('0x13'),JSON[_0x5cc1('0x14')](_0x6b053b));if(_0x6b053b[_0x5cc1('0x15')]){if(_0x6b053b[_0x5cc1('0x15')][_0x5cc1('0x16')]===0x1f4){logger[_0x5cc1('0x15')](_0x5cc1('0x17'),_0x416de4,_0x6b053b['error']['message']);return _0x5aa523(_0x6b053b[_0x5cc1('0x15')][_0x5cc1('0x18')]);}logger[_0x5cc1('0x15')](_0x5cc1('0x17'),_0x416de4,_0x6b053b[_0x5cc1('0x15')][_0x5cc1('0x18')]);return _0x21fbf8(_0x6b053b[_0x5cc1('0x15')][_0x5cc1('0x18')]);}else{logger[_0x5cc1('0x11')](_0x5cc1('0x17'),_0x416de4,_0x5cc1('0x13'));_0x21fbf8(_0x6b053b[_0x5cc1('0x19')]['message']);}})['catch'](function(_0xc65f17){logger[_0x5cc1('0x15')]('UserVoiceQueueRt,\x20%s,\x20%s',_0x416de4,_0xc65f17);_0x5aa523(_0xc65f17);});});}exports[_0x5cc1('0x1a')]=function(_0x4e049a){var _0x45364c=this;return new Promise(function(_0x3ac114,_0x20c14c){return db[_0x5cc1('0x1b')][_0x5cc1('0x1c')]({'raw':_0x4e049a['options']?_0x4e049a[_0x5cc1('0x1d')][_0x5cc1('0x1e')]===undefined?!![]:![]:!![],'where':_0x4e049a[_0x5cc1('0x1d')]?_0x4e049a[_0x5cc1('0x1d')]['where']||null:null,'attributes':[[db[_0x5cc1('0x1f')]['fn'](_0x5cc1('0x20'),db[_0x5cc1('0x1f')]['fn']('IF',db[_0x5cc1('0x1f')][_0x5cc1('0x21')]('`paused`\x20=\x201,\x201,\x20null'))),_0x5cc1('0x22')]]})[_0x5cc1('0x10')](function(_0x5f06c6){logger[_0x5cc1('0x11')](_0x5cc1('0x1a'),_0x4e049a);logger[_0x5cc1('0x12')](_0x5cc1('0x1a'),_0x4e049a,JSON['stringify'](_0x5f06c6));_0x3ac114(_0x5f06c6);})['catch'](function(_0x146fea){logger[_0x5cc1('0x15')](_0x5cc1('0x1a'),_0x146fea['message'],_0x4e049a);_0x20c14c(_0x45364c[_0x5cc1('0x15')](0x1f4,_0x146fea[_0x5cc1('0x18')]));});});}; \ No newline at end of file +var _0x43fc=['error','message','catch','GetVoiceQueueRtPauses','UserVoiceQueueRt','findAll','options','raw','where','sequelize','COUNT','literal','outboundQueuePauses','lodash','util','moment','randomstring','ioredis','../../mysqldb','../../config/logger','rpc','../../config/environment','jayson/promise','client','http','redis','defaults','socket.io-emitter','./userVoiceQueueRt.socket','register','request','then','info','UserVoiceQueueRt,\x20%s,\x20%s','request\x20sent','debug','UserVoiceQueueRt,\x20%s,\x20%s,\x20%s'];(function(_0x3d44b0,_0x3fa11d){var _0xdef3a4=function(_0x5e55c1){while(--_0x5e55c1){_0x3d44b0['push'](_0x3d44b0['shift']());}};_0xdef3a4(++_0x3fa11d);}(_0x43fc,0x1a4));var _0xc43f=function(_0x5be603,_0x5bd09e){_0x5be603=_0x5be603-0x0;var _0x256463=_0x43fc[_0x5be603];return _0x256463;};'use strict';var _=require(_0xc43f('0x0'));var util=require(_0xc43f('0x1'));var moment=require(_0xc43f('0x2'));var BPromise=require('bluebird');var rs=require(_0xc43f('0x3'));var fs=require('fs');var Redis=require(_0xc43f('0x4'));var db=require(_0xc43f('0x5'))['db'];var utils=require('../../config/utils');var logger=require(_0xc43f('0x6'))(_0xc43f('0x7'));var config=require(_0xc43f('0x8'));var jayson=require(_0xc43f('0x9'));var client=jayson[_0xc43f('0xa')][_0xc43f('0xb')]({'port':0x232a});config[_0xc43f('0xc')]=_[_0xc43f('0xd')](config[_0xc43f('0xc')],{'host':'localhost','port':0x18eb});var socket=require(_0xc43f('0xe'))(new Redis(config['redis']));require(_0xc43f('0xf'))[_0xc43f('0x10')](socket);function respondWithRpcPromise(_0x3710b1,_0x781539,_0x3fc7a1){return new BPromise(function(_0x481b2b,_0x1900a5){return client[_0xc43f('0x11')](_0x3710b1,_0x3fc7a1)[_0xc43f('0x12')](function(_0x2b4b05){logger[_0xc43f('0x13')](_0xc43f('0x14'),_0x781539,_0xc43f('0x15'));logger[_0xc43f('0x16')](_0xc43f('0x17'),_0x781539,_0xc43f('0x15'),JSON['stringify'](_0x2b4b05));if(_0x2b4b05[_0xc43f('0x18')]){if(_0x2b4b05[_0xc43f('0x18')]['code']===0x1f4){logger[_0xc43f('0x18')](_0xc43f('0x14'),_0x781539,_0x2b4b05[_0xc43f('0x18')][_0xc43f('0x19')]);return _0x1900a5(_0x2b4b05[_0xc43f('0x18')]['message']);}logger[_0xc43f('0x18')]('UserVoiceQueueRt,\x20%s,\x20%s',_0x781539,_0x2b4b05[_0xc43f('0x18')]['message']);return _0x481b2b(_0x2b4b05[_0xc43f('0x18')][_0xc43f('0x19')]);}else{logger[_0xc43f('0x13')](_0xc43f('0x14'),_0x781539,'request\x20sent');_0x481b2b(_0x2b4b05['result']['message']);}})[_0xc43f('0x1a')](function(_0x101bce){logger[_0xc43f('0x18')](_0xc43f('0x14'),_0x781539,_0x101bce);_0x1900a5(_0x101bce);});});}exports[_0xc43f('0x1b')]=function(_0x45e82f){var _0x4638b4=this;return new Promise(function(_0xbd2cc6,_0x32107d){return db[_0xc43f('0x1c')][_0xc43f('0x1d')]({'raw':_0x45e82f[_0xc43f('0x1e')]?_0x45e82f[_0xc43f('0x1e')][_0xc43f('0x1f')]===undefined?!![]:![]:!![],'where':_0x45e82f[_0xc43f('0x1e')]?_0x45e82f['options'][_0xc43f('0x20')]||null:null,'attributes':[[db[_0xc43f('0x21')]['fn'](_0xc43f('0x22'),db['sequelize']['fn']('IF',db['sequelize'][_0xc43f('0x23')]('`paused`\x20=\x201,\x201,\x20null'))),_0xc43f('0x24')]]})[_0xc43f('0x12')](function(_0x57f5b3){logger['info'](_0xc43f('0x1b'),_0x45e82f);logger[_0xc43f('0x16')](_0xc43f('0x1b'),_0x45e82f,JSON['stringify'](_0x57f5b3));_0xbd2cc6(_0x57f5b3);})['catch'](function(_0x59f6ae){logger[_0xc43f('0x18')](_0xc43f('0x1b'),_0x59f6ae[_0xc43f('0x19')],_0x45e82f);_0x32107d(_0x4638b4[_0xc43f('0x18')](0x1f4,_0x59f6ae['message']));});});}; \ No newline at end of file diff --git a/server/api/userVoiceQueueRt/userVoiceQueueRt.socket.js b/server/api/userVoiceQueueRt/userVoiceQueueRt.socket.js index 0483fc3..a25b9df 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 _0xd7ce=['register','length','userVoiceQueueRt:','./userVoiceQueueRt.events','save','remove','update','removeListener'];(function(_0x3dd15e,_0x1f0015){var _0x231fd0=function(_0x4f680a){while(--_0x4f680a){_0x3dd15e['push'](_0x3dd15e['shift']());}};_0x231fd0(++_0x1f0015);}(_0xd7ce,0x16b));var _0xed7c=function(_0x2c69a1,_0x201903){_0x2c69a1=_0x2c69a1-0x0;var _0x24bb91=_0xd7ce[_0x2c69a1];return _0x24bb91;};'use strict';var UserVoiceQueueRtEvents=require(_0xed7c('0x0'));var events=[_0xed7c('0x1'),_0xed7c('0x2'),_0xed7c('0x3')];function createListener(_0x4ce2a9,_0x4fe5c1){return function(_0x1230ec){_0x4fe5c1['emit'](_0x4ce2a9,_0x1230ec);};}function removeListener(_0x4a6138,_0x587c5a){return function(){UserVoiceQueueRtEvents[_0xed7c('0x4')](_0x4a6138,_0x587c5a);};}exports[_0xed7c('0x5')]=function(_0x194d4b){for(var _0x1aa7a0=0x0,_0x34bbd7=events[_0xed7c('0x6')];_0x1aa7a0<_0x34bbd7;_0x1aa7a0++){var _0x41afb9=events[_0x1aa7a0];var _0x270db6=createListener(_0xed7c('0x7')+_0x41afb9,_0x194d4b);UserVoiceQueueRtEvents['on'](_0x41afb9,_0x270db6);}}; \ No newline at end of file +var _0xc92f=['update','emit','userVoiceQueueRt:','./userVoiceQueueRt.events','save'];(function(_0x15b28c,_0x3a2422){var _0x5e2b99=function(_0x286db3){while(--_0x286db3){_0x15b28c['push'](_0x15b28c['shift']());}};_0x5e2b99(++_0x3a2422);}(_0xc92f,0xf3));var _0xfc92=function(_0x202dd8,_0x2e6830){_0x202dd8=_0x202dd8-0x0;var _0x1f6021=_0xc92f[_0x202dd8];return _0x1f6021;};'use strict';var UserVoiceQueueRtEvents=require(_0xfc92('0x0'));var events=[_0xfc92('0x1'),'remove',_0xfc92('0x2')];function createListener(_0x19f2d4,_0x355614){return function(_0x4a76e2){_0x355614[_0xfc92('0x3')](_0x19f2d4,_0x4a76e2);};}function removeListener(_0x21f567,_0x35780b){return function(){UserVoiceQueueRtEvents['removeListener'](_0x21f567,_0x35780b);};}exports['register']=function(_0x930bab){for(var _0x47abee=0x0,_0x394026=events['length'];_0x47abee<_0x394026;_0x47abee++){var _0xd80968=events[_0x47abee];var _0x49db29=createListener(_0xfc92('0x4')+_0xd80968,_0x930bab);UserVoiceQueueRtEvents['on'](_0xd80968,_0x49db29);}}; \ No newline at end of file diff --git a/server/api/userWhatsappQueue/index.js b/server/api/userWhatsappQueue/index.js index 6fe79b7..1fb929c 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 _0x70e0=['../../components/auth/service','../../components/interaction/service','exports','multer','util','path','Router','fs-extra'];(function(_0x53b203,_0x5e12fb){var _0x43f9a2=function(_0x478ba1){while(--_0x478ba1){_0x53b203['push'](_0x53b203['shift']());}};_0x43f9a2(++_0x5e12fb);}(_0x70e0,0x17b));var _0x070e=function(_0xc17b9f,_0x17a254){_0xc17b9f=_0xc17b9f-0x0;var _0x19ff4d=_0x70e0[_0xc17b9f];return _0x19ff4d;};'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(_0x2b7c7d,_0x3df22b){var _0x4775a6=function(_0x19ef87){while(--_0x19ef87){_0x2b7c7d['push'](_0x2b7c7d['shift']());}};_0x4775a6(++_0x3df22b);}(_0x0713,0x1ba));var _0x3071=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0x0713[_0x3dd15e];return _0x231fd0;};'use strict';var multer=require('multer');var util=require('util');var path=require(_0x3071('0x0'));var timeout=require(_0x3071('0x1'));var express=require(_0x3071('0x2'));var router=express[_0x3071('0x3')]();var fs_extra=require(_0x3071('0x4'));var auth=require('../../components/auth/service');var interaction=require(_0x3071('0x5'));var config=require(_0x3071('0x6'));module[_0x3071('0x7')]=router; \ No newline at end of file diff --git a/server/api/userWhatsappQueue/userWhatsappQueue.attributes.js b/server/api/userWhatsappQueue/userWhatsappQueue.attributes.js index 9006424..c9a2b22 100644 --- a/server/api/userWhatsappQueue/userWhatsappQueue.attributes.js +++ b/server/api/userWhatsappQueue/userWhatsappQueue.attributes.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -'use strict';var Sequelize=require('sequelize');module['exports']={'penalty':{'type':Sequelize['INTEGER'],'defaultValue':0x0}}; \ No newline at end of file +var _0x7458=['exports','INTEGER'];(function(_0x3dd15e,_0x1f0015){var _0x231fd0=function(_0x4f680a){while(--_0x4f680a){_0x3dd15e['push'](_0x3dd15e['shift']());}};_0x231fd0(++_0x1f0015);}(_0x7458,0x7c));var _0x8745=function(_0x5af23d,_0x885330){_0x5af23d=_0x5af23d-0x0;var _0x538053=_0x7458[_0x5af23d];return _0x538053;};'use strict';var Sequelize=require('sequelize');module[_0x8745('0x0')]={'penalty':{'type':Sequelize[_0x8745('0x1')],'defaultValue':0x0}}; \ No newline at end of file diff --git a/server/api/userWhatsappQueue/userWhatsappQueue.model.js b/server/api/userWhatsappQueue/userWhatsappQueue.model.js index 82ea8d7..93c3947 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 _0x9dd4=['api','moment','bluebird','request-promise','path','rimraf','../../config/environment','exports','define','UserWhatsappQueue','user_has_whatsapp_queues','lodash','util','../../config/logger'];(function(_0x369151,_0x179f72){var _0x4292d5=function(_0x330422){while(--_0x330422){_0x369151['push'](_0x369151['shift']());}};_0x4292d5(++_0x179f72);}(_0x9dd4,0x115));var _0x49dd=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0x9dd4[_0x3dd15e];return _0x231fd0;};'use strict';var _=require(_0x49dd('0x0'));var util=require(_0x49dd('0x1'));var logger=require(_0x49dd('0x2'))(_0x49dd('0x3'));var moment=require(_0x49dd('0x4'));var BPromise=require(_0x49dd('0x5'));var rp=require(_0x49dd('0x6'));var fs=require('fs');var path=require(_0x49dd('0x7'));var rimraf=require(_0x49dd('0x8'));var config=require(_0x49dd('0x9'));var attributes=require('./userWhatsappQueue.attributes');module[_0x49dd('0xa')]=function(_0x38b4df,_0x32976c){return _0x38b4df[_0x49dd('0xb')](_0x49dd('0xc'),attributes,{'tableName':_0x49dd('0xd'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x6e96=['moment','bluebird','rimraf','./userWhatsappQueue.attributes','define','UserWhatsappQueue','util','../../config/logger','api'];(function(_0x5e2b76,_0x12f3bb){var _0x15a3d5=function(_0xebd866){while(--_0xebd866){_0x5e2b76['push'](_0x5e2b76['shift']());}};_0x15a3d5(++_0x12f3bb);}(_0x6e96,0x1a4));var _0x66e9=function(_0xd8bc32,_0x20611a){_0xd8bc32=_0xd8bc32-0x0;var _0x499a37=_0x6e96[_0xd8bc32];return _0x499a37;};'use strict';var _=require('lodash');var util=require(_0x66e9('0x0'));var logger=require(_0x66e9('0x1'))(_0x66e9('0x2'));var moment=require(_0x66e9('0x3'));var BPromise=require(_0x66e9('0x4'));var rp=require('request-promise');var fs=require('fs');var path=require('path');var rimraf=require(_0x66e9('0x5'));var config=require('../../config/environment');var attributes=require(_0x66e9('0x6'));module['exports']=function(_0x482cea,_0x31e1e0){return _0x482cea[_0x66e9('0x7')](_0x66e9('0x8'),attributes,{'tableName':'user_has_whatsapp_queues','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 82a9b99..969ec0b 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 _0xa5d8=['UserWhatsappQueue,\x20%s,\x20%s','message','result','util','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','client','http','request','info','request\x20sent','debug','UserWhatsappQueue,\x20%s,\x20%s,\x20%s','stringify','error'];(function(_0x1227ef,_0x44099f){var _0x7636f2=function(_0x4d6a4a){while(--_0x4d6a4a){_0x1227ef['push'](_0x1227ef['shift']());}};_0x7636f2(++_0x44099f);}(_0xa5d8,0x9d));var _0x8a5d=function(_0x5187ee,_0x184b0c){_0x5187ee=_0x5187ee-0x0;var _0xe05230=_0xa5d8[_0x5187ee];return _0xe05230;};'use strict';var _=require('lodash');var util=require(_0x8a5d('0x0'));var moment=require('moment');var BPromise=require(_0x8a5d('0x1'));var rs=require(_0x8a5d('0x2'));var fs=require('fs');var Redis=require(_0x8a5d('0x3'));var db=require(_0x8a5d('0x4'))['db'];var utils=require(_0x8a5d('0x5'));var logger=require(_0x8a5d('0x6'))(_0x8a5d('0x7'));var config=require(_0x8a5d('0x8'));var jayson=require(_0x8a5d('0x9'));var client=jayson[_0x8a5d('0xa')][_0x8a5d('0xb')]({'port':0x232a});function respondWithRpcPromise(_0x1c3b1f,_0xa77245,_0x52986a){return new BPromise(function(_0x457179,_0x22d579){return client[_0x8a5d('0xc')](_0x1c3b1f,_0x52986a)['then'](function(_0xf298ae){logger[_0x8a5d('0xd')]('UserWhatsappQueue,\x20%s,\x20%s',_0xa77245,_0x8a5d('0xe'));logger[_0x8a5d('0xf')](_0x8a5d('0x10'),_0xa77245,'request\x20sent',JSON[_0x8a5d('0x11')](_0xf298ae));if(_0xf298ae[_0x8a5d('0x12')]){if(_0xf298ae[_0x8a5d('0x12')]['code']===0x1f4){logger[_0x8a5d('0x12')](_0x8a5d('0x13'),_0xa77245,_0xf298ae[_0x8a5d('0x12')]['message']);return _0x22d579(_0xf298ae[_0x8a5d('0x12')][_0x8a5d('0x14')]);}logger[_0x8a5d('0x12')](_0x8a5d('0x13'),_0xa77245,_0xf298ae[_0x8a5d('0x12')][_0x8a5d('0x14')]);return _0x457179(_0xf298ae[_0x8a5d('0x12')][_0x8a5d('0x14')]);}else{logger[_0x8a5d('0xd')](_0x8a5d('0x13'),_0xa77245,'request\x20sent');_0x457179(_0xf298ae[_0x8a5d('0x15')][_0x8a5d('0x14')]);}})['catch'](function(_0x22ad29){logger['error'](_0x8a5d('0x13'),_0xa77245,_0x22ad29);_0x22d579(_0x22ad29);});});} \ No newline at end of file +var _0xb27c=['message','catch','lodash','util','moment','bluebird','../../mysqldb','../../config/utils','../../config/logger','rpc','jayson/promise','client','request','then','UserWhatsappQueue,\x20%s,\x20%s','request\x20sent','debug','UserWhatsappQueue,\x20%s,\x20%s,\x20%s','stringify','error'];(function(_0x74f52,_0x15fb1d){var _0x2d5b52=function(_0x48ee75){while(--_0x48ee75){_0x74f52['push'](_0x74f52['shift']());}};_0x2d5b52(++_0x15fb1d);}(_0xb27c,0x142));var _0xcb27=function(_0x474bc0,_0x26989c){_0x474bc0=_0x474bc0-0x0;var _0x4b24cf=_0xb27c[_0x474bc0];return _0x4b24cf;};'use strict';var _=require(_0xcb27('0x0'));var util=require(_0xcb27('0x1'));var moment=require(_0xcb27('0x2'));var BPromise=require(_0xcb27('0x3'));var rs=require('randomstring');var fs=require('fs');var Redis=require('ioredis');var db=require(_0xcb27('0x4'))['db'];var utils=require(_0xcb27('0x5'));var logger=require(_0xcb27('0x6'))(_0xcb27('0x7'));var config=require('../../config/environment');var jayson=require(_0xcb27('0x8'));var client=jayson[_0xcb27('0x9')]['http']({'port':0x232a});function respondWithRpcPromise(_0x1924e0,_0x42d46f,_0x352d97){return new BPromise(function(_0x187428,_0x58fa16){return client[_0xcb27('0xa')](_0x1924e0,_0x352d97)[_0xcb27('0xb')](function(_0x4b316c){logger['info'](_0xcb27('0xc'),_0x42d46f,_0xcb27('0xd'));logger[_0xcb27('0xe')](_0xcb27('0xf'),_0x42d46f,_0xcb27('0xd'),JSON[_0xcb27('0x10')](_0x4b316c));if(_0x4b316c['error']){if(_0x4b316c[_0xcb27('0x11')]['code']===0x1f4){logger['error'](_0xcb27('0xc'),_0x42d46f,_0x4b316c[_0xcb27('0x11')][_0xcb27('0x12')]);return _0x58fa16(_0x4b316c['error'][_0xcb27('0x12')]);}logger[_0xcb27('0x11')](_0xcb27('0xc'),_0x42d46f,_0x4b316c[_0xcb27('0x11')][_0xcb27('0x12')]);return _0x187428(_0x4b316c[_0xcb27('0x11')][_0xcb27('0x12')]);}else{logger['info'](_0xcb27('0xc'),_0x42d46f,_0xcb27('0xd'));_0x187428(_0x4b316c['result'][_0xcb27('0x12')]);}})[_0xcb27('0x13')](function(_0x3a605b){logger[_0xcb27('0x11')](_0xcb27('0xc'),_0x42d46f,_0x3a605b);_0x58fa16(_0x3a605b);});});} \ No newline at end of file diff --git a/server/api/variable/index.js b/server/api/variable/index.js index 024c6d0..83444e8 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 _0x1d25=['post','put','/:id','update','destroy','exports','multer','util','path','connect-timeout','express','fs-extra','../../components/auth/service','../../config/environment','./variable.controller','get','isAuthenticated','index'];(function(_0x2e2880,_0x51a12f){var _0x3cc5e5=function(_0x32c433){while(--_0x32c433){_0x2e2880['push'](_0x2e2880['shift']());}};_0x3cc5e5(++_0x51a12f);}(_0x1d25,0xba));var _0x51d2=function(_0x40a045,_0x516f0e){_0x40a045=_0x40a045-0x0;var _0x1a687c=_0x1d25[_0x40a045];return _0x1a687c;};'use strict';var multer=require(_0x51d2('0x0'));var util=require(_0x51d2('0x1'));var path=require(_0x51d2('0x2'));var timeout=require(_0x51d2('0x3'));var express=require(_0x51d2('0x4'));var router=express['Router']();var fs_extra=require(_0x51d2('0x5'));var auth=require(_0x51d2('0x6'));var interaction=require('../../components/interaction/service');var config=require(_0x51d2('0x7'));var controller=require(_0x51d2('0x8'));router[_0x51d2('0x9')]('/',auth[_0x51d2('0xa')](),controller[_0x51d2('0xb')]);router[_0x51d2('0x9')]('/:id',auth[_0x51d2('0xa')](),controller['show']);router[_0x51d2('0xc')]('/',auth['isAuthenticated'](),controller['create']);router[_0x51d2('0xd')](_0x51d2('0xe'),auth[_0x51d2('0xa')](),controller[_0x51d2('0xf')]);router['delete'](_0x51d2('0xe'),auth[_0x51d2('0xa')](),controller[_0x51d2('0x10')]);module[_0x51d2('0x11')]=router; \ No newline at end of file +var _0x60c2=['delete','destroy','exports','util','path','connect-timeout','express','Router','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','./variable.controller','get','isAuthenticated','/:id','show','create','put','update'];(function(_0x56252e,_0x5a4ea8){var _0x251ef7=function(_0x2bff0d){while(--_0x2bff0d){_0x56252e['push'](_0x56252e['shift']());}};_0x251ef7(++_0x5a4ea8);}(_0x60c2,0x8f));var _0x260c=function(_0x17d9e3,_0x1f969c){_0x17d9e3=_0x17d9e3-0x0;var _0x14192d=_0x60c2[_0x17d9e3];return _0x14192d;};'use strict';var multer=require('multer');var util=require(_0x260c('0x0'));var path=require(_0x260c('0x1'));var timeout=require(_0x260c('0x2'));var express=require(_0x260c('0x3'));var router=express[_0x260c('0x4')]();var fs_extra=require(_0x260c('0x5'));var auth=require(_0x260c('0x6'));var interaction=require(_0x260c('0x7'));var config=require(_0x260c('0x8'));var controller=require(_0x260c('0x9'));router[_0x260c('0xa')]('/',auth[_0x260c('0xb')](),controller['index']);router[_0x260c('0xa')](_0x260c('0xc'),auth[_0x260c('0xb')](),controller[_0x260c('0xd')]);router['post']('/',auth[_0x260c('0xb')](),controller[_0x260c('0xe')]);router[_0x260c('0xf')](_0x260c('0xc'),auth[_0x260c('0xb')](),controller[_0x260c('0x10')]);router[_0x260c('0x11')]('/:id',auth[_0x260c('0xb')](),controller[_0x260c('0x12')]);module[_0x260c('0x13')]=router; \ No newline at end of file diff --git a/server/api/variable/variable.attributes.js b/server/api/variable/variable.attributes.js index b0a4cbc..8ef5c7e 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 _0xd88b=['STRING','name','sequelize'];(function(_0x32ccbe,_0x52281e){var _0x4cf281=function(_0x4f1c42){while(--_0x4f1c42){_0x32ccbe['push'](_0x32ccbe['shift']());}};_0x4cf281(++_0x52281e);}(_0xd88b,0xa7));var _0xbd88=function(_0x3bb591,_0x548752){_0x3bb591=_0x3bb591-0x0;var _0x2b789a=_0xd88b[_0x3bb591];return _0x2b789a;};'use strict';var Sequelize=require(_0xbd88('0x0'));module['exports']={'name':{'type':Sequelize[_0xbd88('0x1')],'unique':_0xbd88('0x2'),'allowNull':![],'validate':{'notEmpty':!![]}},'description':{'type':Sequelize[_0xbd88('0x1')]}}; \ No newline at end of file +var _0x330c=['STRING','name','sequelize','exports'];(function(_0x2c60d1,_0x5b778f){var _0xdf6e43=function(_0x58ec7c){while(--_0x58ec7c){_0x2c60d1['push'](_0x2c60d1['shift']());}};_0xdf6e43(++_0x5b778f);}(_0x330c,0x186));var _0xc330=function(_0x3341a5,_0xee8867){_0x3341a5=_0x3341a5-0x0;var _0x3af5c9=_0x330c[_0x3341a5];return _0x3af5c9;};'use strict';var Sequelize=require(_0xc330('0x0'));module[_0xc330('0x1')]={'name':{'type':Sequelize[_0xc330('0x2')],'unique':_0xc330('0x3'),'allowNull':![],'validate':{'notEmpty':!![]}},'description':{'type':Sequelize['STRING']}}; \ No newline at end of file diff --git a/server/api/variable/variable.controller.js b/server/api/variable/variable.controller.js index 4aeec6f..a0f88ba 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 _0xe72d=['Unable\x20to\x20retrieve\x20the\x20current\x20user','role','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','update','body','params','rimraf','zip-dir','bluebird','mustache','util','path','sox','to-csv','crypto','jsforce','desk.js','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','sendStatus','end','json','undefined','limit','count','offset','status','set','Content-Range','reject','save','destroy','then','get','Variables','UserProfileResource','error','stack','name','send','index','map','Variable','rawAttributes','type','keys','query','filters','model','attributes','intersection','fields','hasOwnProperty','sort','where','filter','merge','options','includeAll','include','findAll','rows','catch','show','length','find','create','user'];(function(_0x3ec739,_0x4f80aa){var _0x551fb3=function(_0x5e0bab){while(--_0x5e0bab){_0x3ec739['push'](_0x3ec739['shift']());}};_0x551fb3(++_0x4f80aa);}(_0xe72d,0xf0));var _0xde72=function(_0x344a3f,_0x579a22){_0x344a3f=_0x344a3f-0x0;var _0x264712=_0xe72d[_0x344a3f];return _0x264712;};'use strict';var emlformat=require('eml-format');var rimraf=require(_0xde72('0x0'));var zipdir=require(_0xde72('0x1'));var jsonpatch=require('fast-json-patch');var rp=require('request-promise');var moment=require('moment');var BPromise=require(_0xde72('0x2'));var Mustache=require(_0xde72('0x3'));var util=require(_0xde72('0x4'));var path=require(_0xde72('0x5'));var sox=require(_0xde72('0x6'));var csv=require(_0xde72('0x7'));var ejs=require('ejs');var fs=require('fs');var fs_extra=require('fs-extra');var _=require('lodash');var squel=require('squel');var crypto=require(_0xde72('0x8'));var jsforce=require(_0xde72('0x9'));var deskjs=require(_0xde72('0xa'));var toCsv=require(_0xde72('0x7'));var querystring=require(_0xde72('0xb'));var Papa=require(_0xde72('0xc'));var Redis=require(_0xde72('0xd'));var authService=require(_0xde72('0xe'));var qs=require(_0xde72('0xf'));var as=require('../../components/parsers/advancedSearch');var hardwareService=require(_0xde72('0x10'));var logger=require(_0xde72('0x11'))(_0xde72('0x12'));var utils=require(_0xde72('0x13'));var config=require(_0xde72('0x14'));var licenseUtil=require(_0xde72('0x15'));var db=require(_0xde72('0x16'))['db'];function respondWithStatusCode(_0x4906e3,_0x452294){_0x452294=_0x452294||0xcc;return function(_0x24741f){if(_0x24741f){return _0x4906e3[_0xde72('0x17')](_0x452294);}return _0x4906e3['status'](_0x452294)[_0xde72('0x18')]();};}function respondWithResult(_0x3bef63,_0x483e98){_0x483e98=_0x483e98||0xc8;return function(_0x4eb201){if(_0x4eb201){return _0x3bef63['status'](_0x483e98)[_0xde72('0x19')](_0x4eb201);}};}function respondWithFilteredResult(_0x1fb472,_0x17f8c9){return function(_0x35e539){if(_0x35e539){var _0x1a34a6=typeof _0x17f8c9['offset']===_0xde72('0x1a')&&typeof _0x17f8c9[_0xde72('0x1b')]==='undefined';var _0x394555=_0x35e539[_0xde72('0x1c')];var _0x23a13f=_0x1a34a6?0x0:_0x17f8c9[_0xde72('0x1d')];var _0x400b8e=_0x1a34a6?_0x35e539[_0xde72('0x1c')]:_0x17f8c9[_0xde72('0x1d')]+_0x17f8c9[_0xde72('0x1b')];var _0x29690a;if(_0x400b8e>=_0x394555){_0x400b8e=_0x394555;_0x29690a=0xc8;}else{_0x29690a=0xce;}_0x1fb472[_0xde72('0x1e')](_0x29690a);return _0x1fb472[_0xde72('0x1f')](_0xde72('0x20'),_0x23a13f+'-'+_0x400b8e+'/'+_0x394555)['json'](_0x35e539);}return null;};}function patchUpdates(_0x568348){return function(_0x1e53e4){try{jsonpatch['apply'](_0x1e53e4,_0x568348,!![]);}catch(_0x1b1375){return BPromise[_0xde72('0x21')](_0x1b1375);}return _0x1e53e4[_0xde72('0x22')]();};}function saveUpdates(_0x62b5c6,_0x263793){return function(_0x3b7842){if(_0x3b7842){return _0x3b7842['update'](_0x62b5c6)['then'](function(_0x31aa33){return _0x31aa33;});}return null;};}function removeEntity(_0x446933,_0x300eb3){return function(_0x404cc3){if(_0x404cc3){return _0x404cc3[_0xde72('0x23')]()[_0xde72('0x24')](function(){var _0x263294=_0x404cc3[_0xde72('0x25')]({'plain':!![]});var _0x2adf1a=_0xde72('0x26');return db[_0xde72('0x27')][_0xde72('0x23')]({'where':{'type':_0x2adf1a,'resourceId':_0x263294['id']}})[_0xde72('0x24')](function(){return _0x404cc3;});})[_0xde72('0x24')](function(){_0x446933[_0xde72('0x1e')](0xcc)[_0xde72('0x18')]();});}};}function handleEntityNotFound(_0x3f6e64,_0x289c3c){return function(_0x256731){if(!_0x256731){_0x3f6e64[_0xde72('0x17')](0x194);}return _0x256731;};}function handleError(_0x5f30b8,_0xede688){_0xede688=_0xede688||0x1f4;return function(_0x2105a0){logger[_0xde72('0x28')](_0x2105a0[_0xde72('0x29')]);if(_0x2105a0[_0xde72('0x2a')]){delete _0x2105a0[_0xde72('0x2a')];}_0x5f30b8[_0xde72('0x1e')](_0xede688)[_0xde72('0x2b')](_0x2105a0);};}exports[_0xde72('0x2c')]=function(_0x3af14f,_0xe68f23){var _0x1b05e6={},_0x5398b8={},_0x2a27f1={'count':0x0,'rows':[]};var _0x178029=_[_0xde72('0x2d')](db[_0xde72('0x2e')][_0xde72('0x2f')],function(_0x38d2e1){return{'name':_0x38d2e1['fieldName'],'type':_0x38d2e1[_0xde72('0x30')]['key']};});_0x5398b8['model']=_[_0xde72('0x2d')](_0x178029,_0xde72('0x2a'));_0x5398b8['query']=_[_0xde72('0x31')](_0x3af14f[_0xde72('0x32')]);_0x5398b8[_0xde72('0x33')]=_['intersection'](_0x5398b8[_0xde72('0x34')],_0x5398b8[_0xde72('0x32')]);_0x1b05e6[_0xde72('0x35')]=_[_0xde72('0x36')](_0x5398b8[_0xde72('0x34')],qs[_0xde72('0x37')](_0x3af14f[_0xde72('0x32')][_0xde72('0x37')]));_0x1b05e6['attributes']=_0x1b05e6[_0xde72('0x35')]['length']?_0x1b05e6[_0xde72('0x35')]:_0x5398b8[_0xde72('0x34')];if(!_0x3af14f[_0xde72('0x32')][_0xde72('0x38')]('nolimit')){_0x1b05e6[_0xde72('0x1b')]=qs['limit'](_0x3af14f['query'][_0xde72('0x1b')]);_0x1b05e6['offset']=qs[_0xde72('0x1d')](_0x3af14f[_0xde72('0x32')][_0xde72('0x1d')]);}_0x1b05e6['order']=qs[_0xde72('0x39')](_0x3af14f[_0xde72('0x32')][_0xde72('0x39')]);_0x1b05e6[_0xde72('0x3a')]=qs[_0xde72('0x33')](_['pick'](_0x3af14f[_0xde72('0x32')],_0x5398b8['filters']),_0x178029);if(_0x3af14f[_0xde72('0x32')][_0xde72('0x3b')]){_0x1b05e6['where']=_['merge'](_0x1b05e6[_0xde72('0x3a')],{'$or':_['map'](_0x178029,function(_0x4117f7){if(_0x4117f7['type']!=='VIRTUAL'){var _0x423ad4={};_0x423ad4[_0x4117f7[_0xde72('0x2a')]]={'$like':'%'+_0x3af14f[_0xde72('0x32')]['filter']+'%'};return _0x423ad4;}})});}_0x1b05e6=_[_0xde72('0x3c')]({},_0x1b05e6,_0x3af14f[_0xde72('0x3d')]);var _0x48196d={'where':_0x1b05e6[_0xde72('0x3a')]};return db[_0xde72('0x2e')][_0xde72('0x1c')](_0x48196d)['then'](function(_0x25bf2f){_0x2a27f1[_0xde72('0x1c')]=_0x25bf2f;if(_0x3af14f['query'][_0xde72('0x3e')]){_0x1b05e6[_0xde72('0x3f')]=[{'all':!![]}];}return db['Variable'][_0xde72('0x40')](_0x1b05e6);})['then'](function(_0x4fb688){_0x2a27f1[_0xde72('0x41')]=_0x4fb688;return _0x2a27f1;})[_0xde72('0x24')](respondWithFilteredResult(_0xe68f23,_0x1b05e6))[_0xde72('0x42')](handleError(_0xe68f23,null));};exports[_0xde72('0x43')]=function(_0x5a599a,_0x1dc337){var _0x214f47={'raw':!![],'where':{'id':_0x5a599a['params']['id']}},_0x5e5f73={};_0x5e5f73['model']=_[_0xde72('0x31')](db[_0xde72('0x2e')]['rawAttributes']);_0x5e5f73[_0xde72('0x32')]=_[_0xde72('0x31')](_0x5a599a[_0xde72('0x32')]);_0x5e5f73['filters']=_[_0xde72('0x36')](_0x5e5f73['model'],_0x5e5f73[_0xde72('0x32')]);_0x214f47[_0xde72('0x35')]=_[_0xde72('0x36')](_0x5e5f73['model'],qs[_0xde72('0x37')](_0x5a599a[_0xde72('0x32')][_0xde72('0x37')]));_0x214f47['attributes']=_0x214f47[_0xde72('0x35')][_0xde72('0x44')]?_0x214f47[_0xde72('0x35')]:_0x5e5f73[_0xde72('0x34')];if(_0x5a599a[_0xde72('0x32')][_0xde72('0x3e')]){_0x214f47[_0xde72('0x3f')]=[{'all':!![]}];}_0x214f47=_['merge']({},_0x214f47,_0x5a599a[_0xde72('0x3d')]);return db[_0xde72('0x2e')][_0xde72('0x45')](_0x214f47)[_0xde72('0x24')](handleEntityNotFound(_0x1dc337,null))[_0xde72('0x24')](respondWithResult(_0x1dc337,null))[_0xde72('0x42')](handleError(_0x1dc337,null));};exports[_0xde72('0x46')]=function(_0x411b59,_0x26e6ba){return db['Variable'][_0xde72('0x46')](_0x411b59['body'],{})[_0xde72('0x24')](function(_0x545fed){var _0x1b8b63=_0x411b59[_0xde72('0x47')][_0xde72('0x25')]({'plain':!![]});if(!_0x1b8b63)throw new Error(_0xde72('0x48'));if(_0x1b8b63[_0xde72('0x49')]==='user'){var _0x20ee3c=_0x545fed[_0xde72('0x25')]({'plain':!![]});var _0x50a22f=_0xde72('0x26');return db['UserProfileSection'][_0xde72('0x45')]({'where':{'name':_0x50a22f,'userProfileId':_0x1b8b63['userProfileId']},'raw':!![]})['then'](function(_0x33ab73){if(_0x33ab73&&_0x33ab73['autoAssociation']===0x0){return db[_0xde72('0x27')][_0xde72('0x46')]({'name':_0x20ee3c[_0xde72('0x2a')],'resourceId':_0x20ee3c['id'],'type':_0x33ab73[_0xde72('0x2a')],'sectionId':_0x33ab73['id']},{})['then'](function(){return _0x545fed;});}else{return _0x545fed;}})[_0xde72('0x42')](function(_0x4abaf9){logger[_0xde72('0x28')](_0xde72('0x4a'),_0x4abaf9);throw _0x4abaf9;});}return _0x545fed;})[_0xde72('0x24')](respondWithResult(_0x26e6ba,0xc9))[_0xde72('0x42')](handleError(_0x26e6ba,null));};exports[_0xde72('0x4b')]=function(_0x1d92dc,_0xb67df1){if(_0x1d92dc[_0xde72('0x4c')]['id']){delete _0x1d92dc['body']['id'];}return db[_0xde72('0x2e')][_0xde72('0x45')]({'where':{'id':_0x1d92dc[_0xde72('0x4d')]['id']}})[_0xde72('0x24')](handleEntityNotFound(_0xb67df1,null))[_0xde72('0x24')](saveUpdates(_0x1d92dc[_0xde72('0x4c')],null))[_0xde72('0x24')](respondWithResult(_0xb67df1,null))['catch'](handleError(_0xb67df1,null));};exports['destroy']=function(_0x28f95b,_0x494b18){return db[_0xde72('0x2e')][_0xde72('0x45')]({'where':{'id':_0x28f95b[_0xde72('0x4d')]['id']}})['then'](handleEntityNotFound(_0x494b18,null))[_0xde72('0x24')](removeEntity(_0x494b18,null))['catch'](handleError(_0x494b18,null));}; \ No newline at end of file +var _0xed7f=['limit','Content-Range','apply','reject','save','update','then','destroy','get','Variables','UserProfileResource','end','error','stack','name','send','index','map','Variable','rawAttributes','fieldName','type','model','query','keys','filters','intersection','attributes','fields','length','hasOwnProperty','order','sort','where','pick','filter','VIRTUAL','options','count','includeAll','include','findAll','rows','catch','show','merge','create','body','user','Unable\x20to\x20retrieve\x20the\x20current\x20user','role','UserProfileSection','autoAssociation','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','find','params','eml-format','rimraf','zip-dir','request-promise','moment','path','sox','to-csv','ejs','lodash','squel','crypto','jsforce','querystring','ioredis','../../components/auth/service','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','sendStatus','status','json','offset','undefined'];(function(_0x2899e4,_0x45a511){var _0x11d791=function(_0x53c8a2){while(--_0x53c8a2){_0x2899e4['push'](_0x2899e4['shift']());}};_0x11d791(++_0x45a511);}(_0xed7f,0x1e1));var _0xfed7=function(_0x5e1f0f,_0x45a0e7){_0x5e1f0f=_0x5e1f0f-0x0;var _0x99c34a=_0xed7f[_0x5e1f0f];return _0x99c34a;};'use strict';var emlformat=require(_0xfed7('0x0'));var rimraf=require(_0xfed7('0x1'));var zipdir=require(_0xfed7('0x2'));var jsonpatch=require('fast-json-patch');var rp=require(_0xfed7('0x3'));var moment=require(_0xfed7('0x4'));var BPromise=require('bluebird');var Mustache=require('mustache');var util=require('util');var path=require(_0xfed7('0x5'));var sox=require(_0xfed7('0x6'));var csv=require(_0xfed7('0x7'));var ejs=require(_0xfed7('0x8'));var fs=require('fs');var fs_extra=require('fs-extra');var _=require(_0xfed7('0x9'));var squel=require(_0xfed7('0xa'));var crypto=require(_0xfed7('0xb'));var jsforce=require(_0xfed7('0xc'));var deskjs=require('desk.js');var toCsv=require(_0xfed7('0x7'));var querystring=require(_0xfed7('0xd'));var Papa=require('papaparse');var Redis=require(_0xfed7('0xe'));var authService=require(_0xfed7('0xf'));var qs=require('../../components/parsers/qs');var as=require(_0xfed7('0x10'));var hardwareService=require(_0xfed7('0x11'));var logger=require(_0xfed7('0x12'))(_0xfed7('0x13'));var utils=require(_0xfed7('0x14'));var config=require(_0xfed7('0x15'));var licenseUtil=require(_0xfed7('0x16'));var db=require(_0xfed7('0x17'))['db'];function respondWithStatusCode(_0x19ac90,_0x5a1a0a){_0x5a1a0a=_0x5a1a0a||0xcc;return function(_0x2e2fff){if(_0x2e2fff){return _0x19ac90[_0xfed7('0x18')](_0x5a1a0a);}return _0x19ac90[_0xfed7('0x19')](_0x5a1a0a)['end']();};}function respondWithResult(_0x3aa0cc,_0x51da39){_0x51da39=_0x51da39||0xc8;return function(_0x2a87c7){if(_0x2a87c7){return _0x3aa0cc[_0xfed7('0x19')](_0x51da39)[_0xfed7('0x1a')](_0x2a87c7);}};}function respondWithFilteredResult(_0x4b2694,_0x43f17d){return function(_0x405379){if(_0x405379){var _0x26b68d=typeof _0x43f17d[_0xfed7('0x1b')]===_0xfed7('0x1c')&&typeof _0x43f17d[_0xfed7('0x1d')]===_0xfed7('0x1c');var _0x307acd=_0x405379['count'];var _0x2bc6fb=_0x26b68d?0x0:_0x43f17d[_0xfed7('0x1b')];var _0x137d15=_0x26b68d?_0x405379['count']:_0x43f17d[_0xfed7('0x1b')]+_0x43f17d[_0xfed7('0x1d')];var _0x41e604;if(_0x137d15>=_0x307acd){_0x137d15=_0x307acd;_0x41e604=0xc8;}else{_0x41e604=0xce;}_0x4b2694[_0xfed7('0x19')](_0x41e604);return _0x4b2694['set'](_0xfed7('0x1e'),_0x2bc6fb+'-'+_0x137d15+'/'+_0x307acd)[_0xfed7('0x1a')](_0x405379);}return null;};}function patchUpdates(_0x5508cb){return function(_0x42bce8){try{jsonpatch[_0xfed7('0x1f')](_0x42bce8,_0x5508cb,!![]);}catch(_0x59dde0){return BPromise[_0xfed7('0x20')](_0x59dde0);}return _0x42bce8[_0xfed7('0x21')]();};}function saveUpdates(_0x3f94ad,_0x2d6ef0){return function(_0x270afa){if(_0x270afa){return _0x270afa[_0xfed7('0x22')](_0x3f94ad)[_0xfed7('0x23')](function(_0x218b0a){return _0x218b0a;});}return null;};}function removeEntity(_0x58e248,_0x3cb653){return function(_0x1c4971){if(_0x1c4971){return _0x1c4971[_0xfed7('0x24')]()[_0xfed7('0x23')](function(){var _0x1f4d73=_0x1c4971[_0xfed7('0x25')]({'plain':!![]});var _0x6a1835=_0xfed7('0x26');return db[_0xfed7('0x27')]['destroy']({'where':{'type':_0x6a1835,'resourceId':_0x1f4d73['id']}})['then'](function(){return _0x1c4971;});})['then'](function(){_0x58e248[_0xfed7('0x19')](0xcc)[_0xfed7('0x28')]();});}};}function handleEntityNotFound(_0x5ef16c,_0x3fb302){return function(_0xb5abce){if(!_0xb5abce){_0x5ef16c[_0xfed7('0x18')](0x194);}return _0xb5abce;};}function handleError(_0x13a0c6,_0x3f2440){_0x3f2440=_0x3f2440||0x1f4;return function(_0x279415){logger[_0xfed7('0x29')](_0x279415[_0xfed7('0x2a')]);if(_0x279415[_0xfed7('0x2b')]){delete _0x279415[_0xfed7('0x2b')];}_0x13a0c6['status'](_0x3f2440)[_0xfed7('0x2c')](_0x279415);};}exports[_0xfed7('0x2d')]=function(_0x46c459,_0x1aa464){var _0x4c19b3={},_0x42dc43={},_0x2b04d3={'count':0x0,'rows':[]};var _0x2ca077=_[_0xfed7('0x2e')](db[_0xfed7('0x2f')][_0xfed7('0x30')],function(_0x27d475){return{'name':_0x27d475[_0xfed7('0x31')],'type':_0x27d475[_0xfed7('0x32')]['key']};});_0x42dc43[_0xfed7('0x33')]=_[_0xfed7('0x2e')](_0x2ca077,_0xfed7('0x2b'));_0x42dc43[_0xfed7('0x34')]=_[_0xfed7('0x35')](_0x46c459[_0xfed7('0x34')]);_0x42dc43[_0xfed7('0x36')]=_[_0xfed7('0x37')](_0x42dc43[_0xfed7('0x33')],_0x42dc43[_0xfed7('0x34')]);_0x4c19b3[_0xfed7('0x38')]=_['intersection'](_0x42dc43[_0xfed7('0x33')],qs[_0xfed7('0x39')](_0x46c459[_0xfed7('0x34')][_0xfed7('0x39')]));_0x4c19b3[_0xfed7('0x38')]=_0x4c19b3[_0xfed7('0x38')][_0xfed7('0x3a')]?_0x4c19b3[_0xfed7('0x38')]:_0x42dc43[_0xfed7('0x33')];if(!_0x46c459['query'][_0xfed7('0x3b')]('nolimit')){_0x4c19b3['limit']=qs[_0xfed7('0x1d')](_0x46c459[_0xfed7('0x34')]['limit']);_0x4c19b3[_0xfed7('0x1b')]=qs[_0xfed7('0x1b')](_0x46c459[_0xfed7('0x34')][_0xfed7('0x1b')]);}_0x4c19b3[_0xfed7('0x3c')]=qs[_0xfed7('0x3d')](_0x46c459[_0xfed7('0x34')]['sort']);_0x4c19b3[_0xfed7('0x3e')]=qs[_0xfed7('0x36')](_[_0xfed7('0x3f')](_0x46c459[_0xfed7('0x34')],_0x42dc43[_0xfed7('0x36')]),_0x2ca077);if(_0x46c459['query'][_0xfed7('0x40')]){_0x4c19b3[_0xfed7('0x3e')]=_['merge'](_0x4c19b3['where'],{'$or':_[_0xfed7('0x2e')](_0x2ca077,function(_0xf65ad7){if(_0xf65ad7['type']!==_0xfed7('0x41')){var _0x3529e9={};_0x3529e9[_0xf65ad7['name']]={'$like':'%'+_0x46c459['query']['filter']+'%'};return _0x3529e9;}})});}_0x4c19b3=_['merge']({},_0x4c19b3,_0x46c459[_0xfed7('0x42')]);var _0x47969b={'where':_0x4c19b3[_0xfed7('0x3e')]};return db[_0xfed7('0x2f')][_0xfed7('0x43')](_0x47969b)[_0xfed7('0x23')](function(_0x4f744d){_0x2b04d3['count']=_0x4f744d;if(_0x46c459[_0xfed7('0x34')][_0xfed7('0x44')]){_0x4c19b3[_0xfed7('0x45')]=[{'all':!![]}];}return db[_0xfed7('0x2f')][_0xfed7('0x46')](_0x4c19b3);})[_0xfed7('0x23')](function(_0x1b50e6){_0x2b04d3[_0xfed7('0x47')]=_0x1b50e6;return _0x2b04d3;})['then'](respondWithFilteredResult(_0x1aa464,_0x4c19b3))[_0xfed7('0x48')](handleError(_0x1aa464,null));};exports[_0xfed7('0x49')]=function(_0x196bba,_0x5da10f){var _0x49b830={'raw':!![],'where':{'id':_0x196bba['params']['id']}},_0x5ccc23={};_0x5ccc23[_0xfed7('0x33')]=_[_0xfed7('0x35')](db[_0xfed7('0x2f')][_0xfed7('0x30')]);_0x5ccc23[_0xfed7('0x34')]=_[_0xfed7('0x35')](_0x196bba['query']);_0x5ccc23[_0xfed7('0x36')]=_[_0xfed7('0x37')](_0x5ccc23[_0xfed7('0x33')],_0x5ccc23[_0xfed7('0x34')]);_0x49b830['attributes']=_[_0xfed7('0x37')](_0x5ccc23[_0xfed7('0x33')],qs[_0xfed7('0x39')](_0x196bba[_0xfed7('0x34')][_0xfed7('0x39')]));_0x49b830[_0xfed7('0x38')]=_0x49b830['attributes'][_0xfed7('0x3a')]?_0x49b830[_0xfed7('0x38')]:_0x5ccc23[_0xfed7('0x33')];if(_0x196bba[_0xfed7('0x34')][_0xfed7('0x44')]){_0x49b830[_0xfed7('0x45')]=[{'all':!![]}];}_0x49b830=_[_0xfed7('0x4a')]({},_0x49b830,_0x196bba[_0xfed7('0x42')]);return db[_0xfed7('0x2f')]['find'](_0x49b830)[_0xfed7('0x23')](handleEntityNotFound(_0x5da10f,null))[_0xfed7('0x23')](respondWithResult(_0x5da10f,null))[_0xfed7('0x48')](handleError(_0x5da10f,null));};exports['create']=function(_0x14ab3f,_0x3c5881){return db[_0xfed7('0x2f')][_0xfed7('0x4b')](_0x14ab3f[_0xfed7('0x4c')],{})['then'](function(_0x266332){var _0x4190ab=_0x14ab3f[_0xfed7('0x4d')][_0xfed7('0x25')]({'plain':!![]});if(!_0x4190ab)throw new Error(_0xfed7('0x4e'));if(_0x4190ab[_0xfed7('0x4f')]==='user'){var _0x469eb8=_0x266332[_0xfed7('0x25')]({'plain':!![]});var _0x13c3cb=_0xfed7('0x26');return db[_0xfed7('0x50')]['find']({'where':{'name':_0x13c3cb,'userProfileId':_0x4190ab['userProfileId']},'raw':!![]})[_0xfed7('0x23')](function(_0x459689){if(_0x459689&&_0x459689[_0xfed7('0x51')]===0x0){return db['UserProfileResource'][_0xfed7('0x4b')]({'name':_0x469eb8[_0xfed7('0x2b')],'resourceId':_0x469eb8['id'],'type':_0x459689[_0xfed7('0x2b')],'sectionId':_0x459689['id']},{})[_0xfed7('0x23')](function(){return _0x266332;});}else{return _0x266332;}})[_0xfed7('0x48')](function(_0x58a5ea){logger[_0xfed7('0x29')](_0xfed7('0x52'),_0x58a5ea);throw _0x58a5ea;});}return _0x266332;})[_0xfed7('0x23')](respondWithResult(_0x3c5881,0xc9))[_0xfed7('0x48')](handleError(_0x3c5881,null));};exports[_0xfed7('0x22')]=function(_0x47f66a,_0x55aa6d){if(_0x47f66a[_0xfed7('0x4c')]['id']){delete _0x47f66a[_0xfed7('0x4c')]['id'];}return db[_0xfed7('0x2f')][_0xfed7('0x53')]({'where':{'id':_0x47f66a[_0xfed7('0x54')]['id']}})['then'](handleEntityNotFound(_0x55aa6d,null))[_0xfed7('0x23')](saveUpdates(_0x47f66a[_0xfed7('0x4c')],null))[_0xfed7('0x23')](respondWithResult(_0x55aa6d,null))['catch'](handleError(_0x55aa6d,null));};exports[_0xfed7('0x24')]=function(_0x16efd3,_0x381629){return db[_0xfed7('0x2f')][_0xfed7('0x53')]({'where':{'id':_0x16efd3['params']['id']}})[_0xfed7('0x23')](handleEntityNotFound(_0x381629,null))[_0xfed7('0x23')](removeEntity(_0x381629,null))['catch'](handleError(_0x381629,null));}; \ No newline at end of file diff --git a/server/api/variable/variable.model.js b/server/api/variable/variable.model.js index 8be43e9..f7d5e30 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 _0x0294=['util','../../config/logger','moment','bluebird','request-promise','../../config/environment','./variable.attributes','exports','define','Variable','tools_variables','lodash'];(function(_0x2212d1,_0x483fc8){var _0x15eec5=function(_0x15e6ac){while(--_0x15e6ac){_0x2212d1['push'](_0x2212d1['shift']());}};_0x15eec5(++_0x483fc8);}(_0x0294,0xb3));var _0x4029=function(_0x5d28b5,_0x264f0e){_0x5d28b5=_0x5d28b5-0x0;var _0x1d251c=_0x0294[_0x5d28b5];return _0x1d251c;};'use strict';var _=require(_0x4029('0x0'));var util=require(_0x4029('0x1'));var logger=require(_0x4029('0x2'))('api');var moment=require(_0x4029('0x3'));var BPromise=require(_0x4029('0x4'));var rp=require(_0x4029('0x5'));var fs=require('fs');var path=require('path');var rimraf=require('rimraf');var config=require(_0x4029('0x6'));var attributes=require(_0x4029('0x7'));module[_0x4029('0x8')]=function(_0x4cf226,_0x67b6c){return _0x4cf226[_0x4029('0x9')](_0x4029('0xa'),attributes,{'tableName':_0x4029('0xb'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x552f=['lodash','util','../../config/logger','moment','rimraf','exports','Variable','tools_variables'];(function(_0x165b78,_0x2702a8){var _0x29bec1=function(_0x356404){while(--_0x356404){_0x165b78['push'](_0x165b78['shift']());}};_0x29bec1(++_0x2702a8);}(_0x552f,0x160));var _0xf552=function(_0x420d8d,_0x78b67f){_0x420d8d=_0x420d8d-0x0;var _0x4865d7=_0x552f[_0x420d8d];return _0x4865d7;};'use strict';var _=require(_0xf552('0x0'));var util=require(_0xf552('0x1'));var logger=require(_0xf552('0x2'))('api');var moment=require(_0xf552('0x3'));var BPromise=require('bluebird');var rp=require('request-promise');var fs=require('fs');var path=require('path');var rimraf=require(_0xf552('0x4'));var config=require('../../config/environment');var attributes=require('./variable.attributes');module[_0xf552('0x5')]=function(_0x330220,_0x46e87d){return _0x330220['define'](_0xf552('0x6'),attributes,{'tableName':_0xf552('0x7'),'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 fdbb3bb..61b5754 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 _0x5fc3=['info','request\x20sent','debug','stringify','error','code','message','Variable,\x20%s,\x20%s','result','catch','ShowVariable','find','options','where','attributes','include','map','model','lodash','util','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','rpc','../../config/environment','jayson/promise','request','then'];(function(_0x5b083b,_0x145a9b){var _0x6c2225=function(_0xcc6435){while(--_0xcc6435){_0x5b083b['push'](_0x5b083b['shift']());}};_0x6c2225(++_0x145a9b);}(_0x5fc3,0xa8));var _0x35fc=function(_0x41d02a,_0x355e19){_0x41d02a=_0x41d02a-0x0;var _0x4c3983=_0x5fc3[_0x41d02a];return _0x4c3983;};'use strict';var _=require(_0x35fc('0x0'));var util=require(_0x35fc('0x1'));var moment=require('moment');var BPromise=require(_0x35fc('0x2'));var rs=require(_0x35fc('0x3'));var fs=require('fs');var Redis=require(_0x35fc('0x4'));var db=require(_0x35fc('0x5'))['db'];var utils=require(_0x35fc('0x6'));var logger=require('../../config/logger')(_0x35fc('0x7'));var config=require(_0x35fc('0x8'));var jayson=require(_0x35fc('0x9'));var client=jayson['client']['http']({'port':0x232a});function respondWithRpcPromise(_0x19a0d1,_0x508b32,_0x16e153){return new BPromise(function(_0x27524f,_0xc72d93){return client[_0x35fc('0xa')](_0x19a0d1,_0x16e153)[_0x35fc('0xb')](function(_0xf9d3a6){logger[_0x35fc('0xc')]('Variable,\x20%s,\x20%s',_0x508b32,_0x35fc('0xd'));logger[_0x35fc('0xe')]('Variable,\x20%s,\x20%s,\x20%s',_0x508b32,_0x35fc('0xd'),JSON[_0x35fc('0xf')](_0xf9d3a6));if(_0xf9d3a6['error']){if(_0xf9d3a6[_0x35fc('0x10')][_0x35fc('0x11')]===0x1f4){logger['error']('Variable,\x20%s,\x20%s',_0x508b32,_0xf9d3a6[_0x35fc('0x10')]['message']);return _0xc72d93(_0xf9d3a6[_0x35fc('0x10')][_0x35fc('0x12')]);}logger[_0x35fc('0x10')](_0x35fc('0x13'),_0x508b32,_0xf9d3a6[_0x35fc('0x10')]['message']);return _0x27524f(_0xf9d3a6['error']['message']);}else{logger['info'](_0x35fc('0x13'),_0x508b32,_0x35fc('0xd'));_0x27524f(_0xf9d3a6[_0x35fc('0x14')][_0x35fc('0x12')]);}})[_0x35fc('0x15')](function(_0x1121fa){logger['error'](_0x35fc('0x13'),_0x508b32,_0x1121fa);_0xc72d93(_0x1121fa);});});}exports[_0x35fc('0x16')]=function(_0x553677){var _0x41e165=this;return new Promise(function(_0x363e47,_0x2e513b){return db['Variable'][_0x35fc('0x17')]({'raw':_0x553677[_0x35fc('0x18')]?_0x553677[_0x35fc('0x18')]['raw']===undefined?!![]:![]:!![],'where':_0x553677[_0x35fc('0x18')]?_0x553677[_0x35fc('0x18')][_0x35fc('0x19')]||null:null,'attributes':_0x553677[_0x35fc('0x18')]?_0x553677[_0x35fc('0x18')][_0x35fc('0x1a')]||null:null,'include':_0x553677[_0x35fc('0x18')]?_0x553677[_0x35fc('0x18')][_0x35fc('0x1b')]?_[_0x35fc('0x1c')](_0x553677['options'][_0x35fc('0x1b')],function(_0xd5399f){return{'model':db[_0xd5399f[_0x35fc('0x1d')]],'as':_0xd5399f['as'],'attributes':_0xd5399f[_0x35fc('0x1a')],'include':_0xd5399f[_0x35fc('0x1b')]?_['map'](_0xd5399f[_0x35fc('0x1b')],function(_0x4c587a){return{'model':db[_0x4c587a['model']],'as':_0x4c587a['as'],'attributes':_0x4c587a[_0x35fc('0x1a')],'include':_0x4c587a[_0x35fc('0x1b')]?_[_0x35fc('0x1c')](_0x4c587a['include'],function(_0x4086e9){return{'model':db[_0x4086e9['model']],'as':_0x4086e9['as'],'attributes':_0x4086e9[_0x35fc('0x1a')]};}):[]};}):[]};}):[]:[]})[_0x35fc('0xb')](function(_0x5cb986){logger['info'](_0x35fc('0x16'),_0x553677);logger['debug'](_0x35fc('0x16'),_0x553677,JSON[_0x35fc('0xf')](_0x5cb986));_0x363e47(_0x5cb986);})['catch'](function(_0x26b7cb){logger[_0x35fc('0x10')](_0x35fc('0x16'),_0x26b7cb[_0x35fc('0x12')],_0x553677);_0x2e513b(_0x41e165[_0x35fc('0x10')](0x1f4,_0x26b7cb[_0x35fc('0x12')]));});});}; \ No newline at end of file +var _0xe14b=['ioredis','../../config/utils','../../config/environment','jayson/promise','client','http','then','info','Variable,\x20%s,\x20%s','Variable,\x20%s,\x20%s,\x20%s','request\x20sent','error','code','message','result','catch','ShowVariable','Variable','find','options','raw','where','attributes','map','include','model','stringify','lodash','util','randomstring'];(function(_0x3ad93e,_0x2888b7){var _0xac1b20=function(_0x368bdf){while(--_0x368bdf){_0x3ad93e['push'](_0x3ad93e['shift']());}};_0xac1b20(++_0x2888b7);}(_0xe14b,0x93));var _0xbe14=function(_0x100aed,_0x2a0114){_0x100aed=_0x100aed-0x0;var _0x2ca9ca=_0xe14b[_0x100aed];return _0x2ca9ca;};'use strict';var _=require(_0xbe14('0x0'));var util=require(_0xbe14('0x1'));var moment=require('moment');var BPromise=require('bluebird');var rs=require(_0xbe14('0x2'));var fs=require('fs');var Redis=require(_0xbe14('0x3'));var db=require('../../mysqldb')['db'];var utils=require(_0xbe14('0x4'));var logger=require('../../config/logger')('rpc');var config=require(_0xbe14('0x5'));var jayson=require(_0xbe14('0x6'));var client=jayson[_0xbe14('0x7')][_0xbe14('0x8')]({'port':0x232a});function respondWithRpcPromise(_0x1d9ade,_0x39387e,_0x196fca){return new BPromise(function(_0x566ae7,_0x50f909){return client['request'](_0x1d9ade,_0x196fca)[_0xbe14('0x9')](function(_0x6fceff){logger[_0xbe14('0xa')](_0xbe14('0xb'),_0x39387e,'request\x20sent');logger['debug'](_0xbe14('0xc'),_0x39387e,_0xbe14('0xd'),JSON['stringify'](_0x6fceff));if(_0x6fceff[_0xbe14('0xe')]){if(_0x6fceff[_0xbe14('0xe')][_0xbe14('0xf')]===0x1f4){logger[_0xbe14('0xe')](_0xbe14('0xb'),_0x39387e,_0x6fceff[_0xbe14('0xe')][_0xbe14('0x10')]);return _0x50f909(_0x6fceff[_0xbe14('0xe')][_0xbe14('0x10')]);}logger[_0xbe14('0xe')](_0xbe14('0xb'),_0x39387e,_0x6fceff[_0xbe14('0xe')][_0xbe14('0x10')]);return _0x566ae7(_0x6fceff['error']['message']);}else{logger[_0xbe14('0xa')](_0xbe14('0xb'),_0x39387e,_0xbe14('0xd'));_0x566ae7(_0x6fceff[_0xbe14('0x11')]['message']);}})[_0xbe14('0x12')](function(_0xe9c3ec){logger[_0xbe14('0xe')](_0xbe14('0xb'),_0x39387e,_0xe9c3ec);_0x50f909(_0xe9c3ec);});});}exports[_0xbe14('0x13')]=function(_0x29ab73){var _0x17ae86=this;return new Promise(function(_0x5ea1f8,_0x137ee5){return db[_0xbe14('0x14')][_0xbe14('0x15')]({'raw':_0x29ab73[_0xbe14('0x16')]?_0x29ab73[_0xbe14('0x16')][_0xbe14('0x17')]===undefined?!![]:![]:!![],'where':_0x29ab73['options']?_0x29ab73[_0xbe14('0x16')][_0xbe14('0x18')]||null:null,'attributes':_0x29ab73[_0xbe14('0x16')]?_0x29ab73[_0xbe14('0x16')][_0xbe14('0x19')]||null:null,'include':_0x29ab73['options']?_0x29ab73[_0xbe14('0x16')]['include']?_[_0xbe14('0x1a')](_0x29ab73['options'][_0xbe14('0x1b')],function(_0x4a25fa){return{'model':db[_0x4a25fa[_0xbe14('0x1c')]],'as':_0x4a25fa['as'],'attributes':_0x4a25fa[_0xbe14('0x19')],'include':_0x4a25fa['include']?_[_0xbe14('0x1a')](_0x4a25fa['include'],function(_0x4587a8){return{'model':db[_0x4587a8['model']],'as':_0x4587a8['as'],'attributes':_0x4587a8[_0xbe14('0x19')],'include':_0x4587a8[_0xbe14('0x1b')]?_[_0xbe14('0x1a')](_0x4587a8[_0xbe14('0x1b')],function(_0x15ef02){return{'model':db[_0x15ef02[_0xbe14('0x1c')]],'as':_0x15ef02['as'],'attributes':_0x15ef02['attributes']};}):[]};}):[]};}):[]:[]})[_0xbe14('0x9')](function(_0x1ba46a){logger[_0xbe14('0xa')](_0xbe14('0x13'),_0x29ab73);logger['debug'](_0xbe14('0x13'),_0x29ab73,JSON[_0xbe14('0x1d')](_0x1ba46a));_0x5ea1f8(_0x1ba46a);})['catch'](function(_0x3c3613){logger[_0xbe14('0xe')](_0xbe14('0x13'),_0x3c3613[_0xbe14('0x10')],_0x29ab73);_0x137ee5(_0x17ae86[_0xbe14('0xe')](0x1f4,_0x3c3613[_0xbe14('0x10')]));});});}; \ No newline at end of file diff --git a/server/api/version/index.js b/server/api/version/index.js index 468de95..13412d5 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 _0xef63=['get','index','/fetch','isAuthenticated','canUpdate','fetch','/reset','/pull','pull','/restart','/migrations','migrations','exports','express','Router','../../components/auth/service','./version.controller'];(function(_0x2fff75,_0x573671){var _0x5b3f36=function(_0x1c3efb){while(--_0x1c3efb){_0x2fff75['push'](_0x2fff75['shift']());}};_0x5b3f36(++_0x573671);}(_0xef63,0x84));var _0x3ef6=function(_0x431713,_0x5f5520){_0x431713=_0x431713-0x0;var _0x4511a6=_0xef63[_0x431713];return _0x4511a6;};'use strict';var express=require(_0x3ef6('0x0'));var router=express[_0x3ef6('0x1')]();var auth=require(_0x3ef6('0x2'));var controller=require(_0x3ef6('0x3'));router[_0x3ef6('0x4')]('/',controller[_0x3ef6('0x5')]);router[_0x3ef6('0x4')](_0x3ef6('0x6'),auth[_0x3ef6('0x7')](),auth[_0x3ef6('0x8')](),controller[_0x3ef6('0x9')]);router[_0x3ef6('0x4')](_0x3ef6('0xa'),auth[_0x3ef6('0x7')](),auth['canUpdate'](),controller['reset']);router[_0x3ef6('0x4')](_0x3ef6('0xb'),auth[_0x3ef6('0x7')](),auth['canUpdate'](),controller[_0x3ef6('0xc')]);router['get'](_0x3ef6('0xd'),auth[_0x3ef6('0x7')](),controller['restart']);router[_0x3ef6('0x4')](_0x3ef6('0xe'),controller[_0x3ef6('0xf')]);module[_0x3ef6('0x10')]=router; \ No newline at end of file +var _0x0119=['/restart','/migrations','migrations','exports','express','Router','../../components/auth/service','./version.controller','get','index','/fetch','isAuthenticated','canUpdate','fetch','reset','/pull','pull'];(function(_0x456f04,_0x2c65ae){var _0x377def=function(_0x5e038b){while(--_0x5e038b){_0x456f04['push'](_0x456f04['shift']());}};_0x377def(++_0x2c65ae);}(_0x0119,0x147));var _0x9011=function(_0xfae23b,_0x2be4ba){_0xfae23b=_0xfae23b-0x0;var _0x200640=_0x0119[_0xfae23b];return _0x200640;};'use strict';var express=require(_0x9011('0x0'));var router=express[_0x9011('0x1')]();var auth=require(_0x9011('0x2'));var controller=require(_0x9011('0x3'));router[_0x9011('0x4')]('/',controller[_0x9011('0x5')]);router[_0x9011('0x4')](_0x9011('0x6'),auth[_0x9011('0x7')](),auth[_0x9011('0x8')](),controller[_0x9011('0x9')]);router[_0x9011('0x4')]('/reset',auth[_0x9011('0x7')](),auth['canUpdate'](),controller[_0x9011('0xa')]);router[_0x9011('0x4')](_0x9011('0xb'),auth[_0x9011('0x7')](),auth['canUpdate'](),controller[_0x9011('0xc')]);router[_0x9011('0x4')](_0x9011('0xd'),auth[_0x9011('0x7')](),controller['restart']);router[_0x9011('0x4')](_0x9011('0xe'),controller[_0x9011('0xf')]);module[_0x9011('0x10')]=router; \ No newline at end of file diff --git a/server/api/version/version.controller.js b/server/api/version/version.controller.js index a8a7597..2203f94 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 _0x869d=['pm2\x20restart\x20motion\x20%s','Your\x20system\x20has\x20been\x20restart\x20successfully','join','migrations','replace','.js','push','sort','sequelize','Migration','constructor','Migration\x20tried\x20to\x20use\x20old\x20style\x20\x22done\x22\x20callback.\x20Please\x20upgrade\x20to\x20\x22umzug\x22\x20and\x20return\x20a\x20promise\x20instead.','map','then','\x20to\x20','last','UniqueConstraintError','Database\x20already\x20up-to-date','umzug','path','compare-versions','../../mysqldb','../../config/environment','../../config/pm2','../../config/logger','simple-git','root','exports','version','query','latest','fetch','2.0.0','status','json','info','git\x20fetch','git\x20fetch\x20origin\x20master','reset','--hard','error','git\x20reset\x20--hard\x20FETCH_HEAD','git\x20reset\x20--hard','pull','npm\x20install\x20--production','restart','motion2'];(function(_0x26462c,_0xd20a35){var _0x509a42=function(_0x1b22c9){while(--_0x1b22c9){_0x26462c['push'](_0x26462c['shift']());}};_0x509a42(++_0xd20a35);}(_0x869d,0x12c));var _0xd869=function(_0x299d43,_0x4ebe75){_0x299d43=_0x299d43-0x0;var _0x2173b6=_0x869d[_0x299d43];return _0x2173b6;};'use strict';var Umzug=require(_0xd869('0x0'));var path=require(_0xd869('0x1'));var fs=require('fs');var _=require('lodash');var pkginfo=require('pkginfo')(module,'version');var compareVersions=require(_0xd869('0x2'));var exec=require('child_process')['exec'];var db=require(_0xd869('0x3'))['db'];var config=require(_0xd869('0x4'));var pm2=require(_0xd869('0x5'));var logger=require(_0xd869('0x6'))('update');var git=require(_0xd869('0x7'))(config[_0xd869('0x8')]);exports['index']=function(_0x1c96e3,_0x5b0350){var _0x4607bb={'current':module[_0xd869('0x9')][_0xd869('0xa')],'phonebar':0x2};if(_0x1c96e3['query']&&_0x1c96e3[_0xd869('0xb')][_0xd869('0xc')]){return git[_0xd869('0xd')]()['tags'](function(_0x422622,_0x4ff382){_0x4607bb[_0xd869('0xc')]=(_0x422622?module['exports'][_0xd869('0xa')]:_0x4ff382[_0xd869('0xc')])||_0xd869('0xe');return _0x5b0350[_0xd869('0xf')](0xc8)['json'](_0x4607bb);});}else{return _0x5b0350[_0xd869('0xf')](0xc8)[_0xd869('0x10')](_0x4607bb);}};exports[_0xd869('0xd')]=function(_0x2f457a,_0x7a5820){return git[_0xd869('0xd')](['origin','master'],function(_0x303891){if(_0x303891){logger['error'](_0x303891);return _0x7a5820[_0xd869('0xf')](0x1f4)[_0xd869('0x10')](_0x303891);}logger[_0xd869('0x11')](_0xd869('0x12'));return _0x7a5820[_0xd869('0xf')](0xc8)[_0xd869('0x10')]({'output':_0xd869('0x13')});});};exports[_0xd869('0x14')]=function(_0x1be76d,_0x33ae05){return git[_0xd869('0x14')]([_0xd869('0x15'),'FETCH_HEAD'],function(_0x2a8b25){if(_0x2a8b25){logger[_0xd869('0x16')](_0x2a8b25);return _0x33ae05['status'](0x1f4)[_0xd869('0x10')](_0x2a8b25);}logger[_0xd869('0x11')](_0xd869('0x17'));return _0x33ae05[_0xd869('0xf')](0xc8)[_0xd869('0x10')]({'output':_0xd869('0x18')});});};exports[_0xd869('0x19')]=function(_0x42aef3,_0x106814){exec(_0xd869('0x1a'),function(_0x26b4f7,_0x6255d7,_0x1b7107){logger[_0xd869('0x11')](_0x6255d7);logger[_0xd869('0x11')](_0x1b7107);if(_0x26b4f7){logger[_0xd869('0x16')](_0x26b4f7);return _0x106814[_0xd869('0xf')](0x1f4)['json'](_0x26b4f7);}return _0x106814[_0xd869('0xf')](0xc8)[_0xd869('0x10')]({'output':_0x6255d7});});};exports[_0xd869('0x1b')]=function(_0x2b9c53,_0x45b891){return pm2[_0xd869('0x1b')](_0xd869('0x1c'))['then'](function(_0x19d219){logger[_0xd869('0x11')](_0xd869('0x1d'),_0x19d219);return _0x45b891['status'](0xc8)['json']({'output':_0xd869('0x1e')});})['catch'](function(_0x96be7c){logger[_0xd869('0x16')](_0x96be7c);return _0x45b891[_0xd869('0xf')](0x1f4)[_0xd869('0x10')](_0x96be7c);});};exports['migrations']=function(_0x2d3589,_0x481a06){var _0x15797a=fs['readdirSync'](path[_0xd869('0x1f')](config[_0xd869('0x8')],'server',_0xd869('0x20')));var _0x5f1149=[];for(var _0x146fa1=0x0;_0x146fa1<_0x15797a['length'];_0x146fa1++){var _0x468d5c=_0x15797a[_0x146fa1][_0xd869('0x21')](_0xd869('0x22'),'');if(compareVersions(module[_0xd869('0x9')][_0xd869('0xa')],_0x468d5c)===-0x1){_0x5f1149[_0xd869('0x23')](_0x468d5c);}}if(_0x5f1149['length']){var _0x55e849=_0x5f1149[_0xd869('0x24')](compareVersions);var _0x582278=new Umzug({'storage':_0xd869('0x25'),'storageOptions':{'model':db[_0xd869('0x26')],'modelName':_0xd869('0x26'),'columnName':_0xd869('0xa')},'migrations':{'params':[db[_0xd869('0x25')]['getQueryInterface'](),db[_0xd869('0x25')][_0xd869('0x27')],function(){throw new Error(_0xd869('0x28'));}],'path':path[_0xd869('0x1f')](config['root'],'server',_0xd869('0x20')),'pattern':/\.js$/}});_0x582278['up']({'migrations':_[_0xd869('0x29')](_0x55e849,function(_0x41a7c0){return _0x41a7c0+_0xd869('0x22');})})[_0xd869('0x2a')](function(){return _0x481a06[_0xd869('0xf')](0xc8)[_0xd869('0x10')]({'output':'Database\x20migrated\x20successfully\x20from\x20version\x20'+module[_0xd869('0x9')]['version']+_0xd869('0x2b')+_[_0xd869('0x2c')](_0x55e849),'migrations':_[_0xd869('0x1f')](_0x55e849)});})['catch'](function(_0x334c14){if(_0x334c14 instanceof db['sequelize'][_0xd869('0x2d')]){return _0x481a06[_0xd869('0xf')](0xc8)[_0xd869('0x10')]({'output':_0xd869('0x2e')});}else{return _0x481a06[_0xd869('0xf')](0x1f4)[_0xd869('0x10')](_0x334c14);}});}else{return _0x481a06[_0xd869('0xf')](0xc8)['json']({'output':_0xd869('0x2e')});}}; \ No newline at end of file +var _0xb2ee=['constructor','Migration\x20tried\x20to\x20use\x20old\x20style\x20\x22done\x22\x20callback.\x20Please\x20upgrade\x20to\x20\x22umzug\x22\x20and\x20return\x20a\x20promise\x20instead.','map','\x20to\x20','last','UniqueConstraintError','Database\x20already\x20up-to-date','path','child_process','exec','../../mysqldb','../../config/environment','../../config/pm2','../../config/logger','update','root','exports','version','query','latest','fetch','tags','status','json','master','error','info','git\x20fetch','git\x20fetch\x20origin\x20master','--hard','FETCH_HEAD','git\x20reset\x20--hard\x20FETCH_HEAD','pull','npm\x20install\x20--production','restart','motion2','pm2\x20restart\x20motion\x20%s','Your\x20system\x20has\x20been\x20restart\x20successfully','catch','migrations','readdirSync','join','server','length','.js','push','sequelize','Migration','getQueryInterface'];(function(_0x390894,_0x475606){var _0x1dad92=function(_0x454ae6){while(--_0x454ae6){_0x390894['push'](_0x390894['shift']());}};_0x1dad92(++_0x475606);}(_0xb2ee,0x1f1));var _0xeb2e=function(_0x58a8fb,_0x13c226){_0x58a8fb=_0x58a8fb-0x0;var _0x3d7804=_0xb2ee[_0x58a8fb];return _0x3d7804;};'use strict';var Umzug=require('umzug');var path=require(_0xeb2e('0x0'));var fs=require('fs');var _=require('lodash');var pkginfo=require('pkginfo')(module,'version');var compareVersions=require('compare-versions');var exec=require(_0xeb2e('0x1'))[_0xeb2e('0x2')];var db=require(_0xeb2e('0x3'))['db'];var config=require(_0xeb2e('0x4'));var pm2=require(_0xeb2e('0x5'));var logger=require(_0xeb2e('0x6'))(_0xeb2e('0x7'));var git=require('simple-git')(config[_0xeb2e('0x8')]);exports['index']=function(_0x3a580d,_0x549b90){var _0x33df37={'current':module[_0xeb2e('0x9')][_0xeb2e('0xa')],'phonebar':0x2};if(_0x3a580d[_0xeb2e('0xb')]&&_0x3a580d[_0xeb2e('0xb')][_0xeb2e('0xc')]){return git[_0xeb2e('0xd')]()[_0xeb2e('0xe')](function(_0x24fcb5,_0xb20817){_0x33df37['latest']=(_0x24fcb5?module[_0xeb2e('0x9')][_0xeb2e('0xa')]:_0xb20817[_0xeb2e('0xc')])||'2.0.0';return _0x549b90[_0xeb2e('0xf')](0xc8)[_0xeb2e('0x10')](_0x33df37);});}else{return _0x549b90[_0xeb2e('0xf')](0xc8)['json'](_0x33df37);}};exports[_0xeb2e('0xd')]=function(_0x1e4888,_0x4aac76){return git['fetch'](['origin',_0xeb2e('0x11')],function(_0x8bba38){if(_0x8bba38){logger[_0xeb2e('0x12')](_0x8bba38);return _0x4aac76[_0xeb2e('0xf')](0x1f4)[_0xeb2e('0x10')](_0x8bba38);}logger[_0xeb2e('0x13')](_0xeb2e('0x14'));return _0x4aac76['status'](0xc8)[_0xeb2e('0x10')]({'output':_0xeb2e('0x15')});});};exports['reset']=function(_0x1444d8,_0x4303b0){return git['reset']([_0xeb2e('0x16'),_0xeb2e('0x17')],function(_0x386c5b){if(_0x386c5b){logger[_0xeb2e('0x12')](_0x386c5b);return _0x4303b0['status'](0x1f4)['json'](_0x386c5b);}logger[_0xeb2e('0x13')](_0xeb2e('0x18'));return _0x4303b0[_0xeb2e('0xf')](0xc8)[_0xeb2e('0x10')]({'output':'git\x20reset\x20--hard'});});};exports[_0xeb2e('0x19')]=function(_0x1f650e,_0x4d9465){exec(_0xeb2e('0x1a'),function(_0x285d04,_0x244f2b,_0x24a6bc){logger[_0xeb2e('0x13')](_0x244f2b);logger[_0xeb2e('0x13')](_0x24a6bc);if(_0x285d04){logger[_0xeb2e('0x12')](_0x285d04);return _0x4d9465[_0xeb2e('0xf')](0x1f4)['json'](_0x285d04);}return _0x4d9465[_0xeb2e('0xf')](0xc8)['json']({'output':_0x244f2b});});};exports[_0xeb2e('0x1b')]=function(_0x148a74,_0x4a17ec){return pm2['restart'](_0xeb2e('0x1c'))['then'](function(_0x22742b){logger['info'](_0xeb2e('0x1d'),_0x22742b);return _0x4a17ec['status'](0xc8)[_0xeb2e('0x10')]({'output':_0xeb2e('0x1e')});})[_0xeb2e('0x1f')](function(_0x1b2180){logger['error'](_0x1b2180);return _0x4a17ec['status'](0x1f4)[_0xeb2e('0x10')](_0x1b2180);});};exports[_0xeb2e('0x20')]=function(_0x24e2e6,_0x3db714){var _0x4fa9d2=fs[_0xeb2e('0x21')](path[_0xeb2e('0x22')](config[_0xeb2e('0x8')],_0xeb2e('0x23'),'migrations'));var _0xfb6585=[];for(var _0x524ac9=0x0;_0x524ac9<_0x4fa9d2[_0xeb2e('0x24')];_0x524ac9++){var _0x531442=_0x4fa9d2[_0x524ac9]['replace'](_0xeb2e('0x25'),'');if(compareVersions(module[_0xeb2e('0x9')]['version'],_0x531442)===-0x1){_0xfb6585[_0xeb2e('0x26')](_0x531442);}}if(_0xfb6585[_0xeb2e('0x24')]){var _0xca1ee8=_0xfb6585['sort'](compareVersions);var _0x348a66=new Umzug({'storage':_0xeb2e('0x27'),'storageOptions':{'model':db[_0xeb2e('0x28')],'modelName':'Migration','columnName':_0xeb2e('0xa')},'migrations':{'params':[db[_0xeb2e('0x27')][_0xeb2e('0x29')](),db['sequelize'][_0xeb2e('0x2a')],function(){throw new Error(_0xeb2e('0x2b'));}],'path':path['join'](config['root'],_0xeb2e('0x23'),_0xeb2e('0x20')),'pattern':/\.js$/}});_0x348a66['up']({'migrations':_[_0xeb2e('0x2c')](_0xca1ee8,function(_0x40ee29){return _0x40ee29+'.js';})})['then'](function(){return _0x3db714[_0xeb2e('0xf')](0xc8)[_0xeb2e('0x10')]({'output':'Database\x20migrated\x20successfully\x20from\x20version\x20'+module[_0xeb2e('0x9')][_0xeb2e('0xa')]+_0xeb2e('0x2d')+_[_0xeb2e('0x2e')](_0xca1ee8),'migrations':_[_0xeb2e('0x22')](_0xca1ee8)});})[_0xeb2e('0x1f')](function(_0x3cdf73){if(_0x3cdf73 instanceof db['sequelize'][_0xeb2e('0x2f')]){return _0x3db714[_0xeb2e('0xf')](0xc8)[_0xeb2e('0x10')]({'output':'Database\x20already\x20up-to-date'});}else{return _0x3db714[_0xeb2e('0xf')](0x1f4)[_0xeb2e('0x10')](_0x3cdf73);}});}else{return _0x3db714[_0xeb2e('0xf')](0xc8)[_0xeb2e('0x10')]({'output':_0xeb2e('0x30')});}}; \ No newline at end of file diff --git a/server/api/voiceAgentReport/index.js b/server/api/voiceAgentReport/index.js index daa76da..2f0f956 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 _0xa837=['../../components/auth/service','../../components/interaction/service','../../config/environment','./voiceAgentReport.controller','get','isAuthenticated','index','/describe','describe','post','create','put','/:id','delete','destroy','exports','multer','util','path','connect-timeout','express','Router'];(function(_0x2ff511,_0x5cedb5){var _0x22cbf0=function(_0x377b2b){while(--_0x377b2b){_0x2ff511['push'](_0x2ff511['shift']());}};_0x22cbf0(++_0x5cedb5);}(_0xa837,0xc0));var _0x7a83=function(_0x321bb2,_0x202794){_0x321bb2=_0x321bb2-0x0;var _0x9c12ed=_0xa837[_0x321bb2];return _0x9c12ed;};'use strict';var multer=require(_0x7a83('0x0'));var util=require(_0x7a83('0x1'));var path=require(_0x7a83('0x2'));var timeout=require(_0x7a83('0x3'));var express=require(_0x7a83('0x4'));var router=express[_0x7a83('0x5')]();var fs_extra=require('fs-extra');var auth=require(_0x7a83('0x6'));var interaction=require(_0x7a83('0x7'));var config=require(_0x7a83('0x8'));var controller=require(_0x7a83('0x9'));router[_0x7a83('0xa')]('/',auth[_0x7a83('0xb')](),controller[_0x7a83('0xc')]);router[_0x7a83('0xa')](_0x7a83('0xd'),auth[_0x7a83('0xb')](),controller[_0x7a83('0xe')]);router[_0x7a83('0xa')]('/:id',auth[_0x7a83('0xb')](),controller['show']);router[_0x7a83('0xf')]('/',auth['isAuthenticated'](),controller[_0x7a83('0x10')]);router[_0x7a83('0x11')](_0x7a83('0x12'),auth[_0x7a83('0xb')](),controller['update']);router[_0x7a83('0x13')](_0x7a83('0x12'),auth[_0x7a83('0xb')](),controller[_0x7a83('0x14')]);module[_0x7a83('0x15')]=router; \ No newline at end of file +var _0xee64=['isAuthenticated','get','show','post','create','/:id','update','delete','destroy','exports','multer','util','path','connect-timeout','express','Router','fs-extra','../../components/auth/service','../../components/interaction/service'];(function(_0x2eaebe,_0x1d7f6c){var _0x147431=function(_0x3e4f2b){while(--_0x3e4f2b){_0x2eaebe['push'](_0x2eaebe['shift']());}};_0x147431(++_0x1d7f6c);}(_0xee64,0x14d));var _0x4ee6=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0xee64[_0x3dd15e];return _0x231fd0;};'use strict';var multer=require(_0x4ee6('0x0'));var util=require(_0x4ee6('0x1'));var path=require(_0x4ee6('0x2'));var timeout=require(_0x4ee6('0x3'));var express=require(_0x4ee6('0x4'));var router=express[_0x4ee6('0x5')]();var fs_extra=require(_0x4ee6('0x6'));var auth=require(_0x4ee6('0x7'));var interaction=require(_0x4ee6('0x8'));var config=require('../../config/environment');var controller=require('./voiceAgentReport.controller');router['get']('/',auth[_0x4ee6('0x9')](),controller['index']);router[_0x4ee6('0xa')]('/describe',auth['isAuthenticated'](),controller['describe']);router[_0x4ee6('0xa')]('/:id',auth['isAuthenticated'](),controller[_0x4ee6('0xb')]);router[_0x4ee6('0xc')]('/',auth[_0x4ee6('0x9')](),controller[_0x4ee6('0xd')]);router['put'](_0x4ee6('0xe'),auth[_0x4ee6('0x9')](),controller[_0x4ee6('0xf')]);router[_0x4ee6('0x10')](_0x4ee6('0xe'),auth[_0x4ee6('0x9')](),controller[_0x4ee6('0x11')]);module[_0x4ee6('0x12')]=router; \ No newline at end of file diff --git a/server/api/voiceAgentReport/voiceAgentReport.attributes.js b/server/api/voiceAgentReport/voiceAgentReport.attributes.js index a69b9cc..ceca84b 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 _0x4325=['sequelize','exports','STRING','DATE','BOOLEAN','INTEGER'];(function(_0x53a7a8,_0xed2bff){var _0x555f71=function(_0x48e696){while(--_0x48e696){_0x53a7a8['push'](_0x53a7a8['shift']());}};_0x555f71(++_0xed2bff);}(_0x4325,0x1da));var _0x5432=function(_0x397e5f,_0x454c8f){_0x397e5f=_0x397e5f-0x0;var _0x5302b8=_0x4325[_0x397e5f];return _0x5302b8;};'use strict';var Sequelize=require(_0x5432('0x0'));module[_0x5432('0x1')]={'type':{'type':Sequelize['STRING']},'uniqueid':{'type':Sequelize[_0x5432('0x2')]},'calleridnum':{'type':Sequelize[_0x5432('0x2')]},'calleridname':{'type':Sequelize[_0x5432('0x2')]},'queue':{'type':Sequelize['STRING']},'interface':{'type':Sequelize['STRING']},'membername':{'type':Sequelize[_0x5432('0x2')]},'agentcalledAt':{'type':Sequelize[_0x5432('0x3')]},'agentconnectAt':{'type':Sequelize[_0x5432('0x3')]},'agentcompleteAt':{'type':Sequelize['DATE']},'agentringnoanswerAt':{'type':Sequelize[_0x5432('0x3')]},'agentdumpAt':{'type':Sequelize[_0x5432('0x3')]},'holdtime':{'type':Sequelize['INTEGER']},'agentcomplete':{'type':Sequelize[_0x5432('0x4')],'defaultValue':![]},'agentringnoanswer':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'agentdump':{'type':Sequelize[_0x5432('0x4')],'defaultValue':![]},'talktime':{'type':Sequelize[_0x5432('0x5')]},'agentacw':{'type':Sequelize[_0x5432('0x4')],'defaultValue':![]},'acwtime':{'type':Sequelize[_0x5432('0x5')]},'reason':{'type':Sequelize[_0x5432('0x2')]},'lastevent':{'type':Sequelize['STRING']},'channel':{'type':Sequelize[_0x5432('0x2')]},'channelstate':{'type':Sequelize['INTEGER']},'channelstatedesc':{'type':Sequelize[_0x5432('0x2')]},'connectedlinenum':{'type':Sequelize[_0x5432('0x2')]},'connectedlinename':{'type':Sequelize[_0x5432('0x2')]},'language':{'type':Sequelize[_0x5432('0x2')]},'accountcode':{'type':Sequelize['STRING']},'context':{'type':Sequelize['STRING']},'exten':{'type':Sequelize[_0x5432('0x2')]},'priority':{'type':Sequelize[_0x5432('0x2')]},'destchannel':{'type':Sequelize['STRING']},'destchannelstate':{'type':Sequelize[_0x5432('0x5')]},'destchannelstatedesc':{'type':Sequelize[_0x5432('0x2')]},'destcalleridnum':{'type':Sequelize[_0x5432('0x2')]},'destcalleridname':{'type':Sequelize[_0x5432('0x2')]},'destconnectedlinenum':{'type':Sequelize[_0x5432('0x2')]},'destconnectedlinename':{'type':Sequelize[_0x5432('0x2')]},'destlanguage':{'type':Sequelize['STRING']},'destaccountcode':{'type':Sequelize['STRING']},'destcontext':{'type':Sequelize[_0x5432('0x2')]},'destexten':{'type':Sequelize[_0x5432('0x2')]},'destpriority':{'type':Sequelize[_0x5432('0x2')]},'destuniqueid':{'type':Sequelize[_0x5432('0x2')]},'answeredelsewheredestinationuniqueid':{'type':Sequelize[_0x5432('0x2')]},'answeredelsewheremembername':{'type':Sequelize[_0x5432('0x2')]},'transfer':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'transfertype':{'type':Sequelize[_0x5432('0x2')],'comment':'FORWARD,\x20BLIND,\x20ATTENDED'},'transferexten':{'type':Sequelize[_0x5432('0x2')]},'transferuniqueid':{'type':Sequelize[_0x5432('0x2')]},'agententerreason':{'type':Sequelize[_0x5432('0x5')],'defaultValue':0x0}}; \ No newline at end of file +var _0x0570=['DATE','BOOLEAN','INTEGER','FORWARD,\x20BLIND,\x20ATTENDED','exports','STRING'];(function(_0x313454,_0x26ee63){var _0x967832=function(_0x3205a9){while(--_0x3205a9){_0x313454['push'](_0x313454['shift']());}};_0x967832(++_0x26ee63);}(_0x0570,0x172));var _0x0057=function(_0x5c8d26,_0x4af2f3){_0x5c8d26=_0x5c8d26-0x0;var _0x450a6b=_0x0570[_0x5c8d26];return _0x450a6b;};'use strict';var Sequelize=require('sequelize');module[_0x0057('0x0')]={'type':{'type':Sequelize[_0x0057('0x1')]},'uniqueid':{'type':Sequelize[_0x0057('0x1')]},'calleridnum':{'type':Sequelize['STRING']},'calleridname':{'type':Sequelize[_0x0057('0x1')]},'queue':{'type':Sequelize['STRING']},'interface':{'type':Sequelize[_0x0057('0x1')]},'membername':{'type':Sequelize['STRING']},'agentcalledAt':{'type':Sequelize[_0x0057('0x2')]},'agentconnectAt':{'type':Sequelize[_0x0057('0x2')]},'agentcompleteAt':{'type':Sequelize[_0x0057('0x2')]},'agentringnoanswerAt':{'type':Sequelize[_0x0057('0x2')]},'agentdumpAt':{'type':Sequelize[_0x0057('0x2')]},'holdtime':{'type':Sequelize['INTEGER']},'agentcomplete':{'type':Sequelize[_0x0057('0x3')],'defaultValue':![]},'agentringnoanswer':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'agentdump':{'type':Sequelize[_0x0057('0x3')],'defaultValue':![]},'talktime':{'type':Sequelize[_0x0057('0x4')]},'agentacw':{'type':Sequelize[_0x0057('0x3')],'defaultValue':![]},'acwtime':{'type':Sequelize[_0x0057('0x4')]},'reason':{'type':Sequelize[_0x0057('0x1')]},'lastevent':{'type':Sequelize['STRING']},'channel':{'type':Sequelize[_0x0057('0x1')]},'channelstate':{'type':Sequelize[_0x0057('0x4')]},'channelstatedesc':{'type':Sequelize[_0x0057('0x1')]},'connectedlinenum':{'type':Sequelize['STRING']},'connectedlinename':{'type':Sequelize[_0x0057('0x1')]},'language':{'type':Sequelize[_0x0057('0x1')]},'accountcode':{'type':Sequelize['STRING']},'context':{'type':Sequelize['STRING']},'exten':{'type':Sequelize[_0x0057('0x1')]},'priority':{'type':Sequelize[_0x0057('0x1')]},'destchannel':{'type':Sequelize[_0x0057('0x1')]},'destchannelstate':{'type':Sequelize['INTEGER']},'destchannelstatedesc':{'type':Sequelize[_0x0057('0x1')]},'destcalleridnum':{'type':Sequelize[_0x0057('0x1')]},'destcalleridname':{'type':Sequelize[_0x0057('0x1')]},'destconnectedlinenum':{'type':Sequelize[_0x0057('0x1')]},'destconnectedlinename':{'type':Sequelize['STRING']},'destlanguage':{'type':Sequelize[_0x0057('0x1')]},'destaccountcode':{'type':Sequelize[_0x0057('0x1')]},'destcontext':{'type':Sequelize['STRING']},'destexten':{'type':Sequelize[_0x0057('0x1')]},'destpriority':{'type':Sequelize[_0x0057('0x1')]},'destuniqueid':{'type':Sequelize['STRING']},'answeredelsewheredestinationuniqueid':{'type':Sequelize[_0x0057('0x1')]},'answeredelsewheremembername':{'type':Sequelize['STRING']},'transfer':{'type':Sequelize[_0x0057('0x3')],'defaultValue':![]},'transfertype':{'type':Sequelize['STRING'],'comment':_0x0057('0x5')},'transferexten':{'type':Sequelize[_0x0057('0x1')]},'transferuniqueid':{'type':Sequelize['STRING']},'agententerreason':{'type':Sequelize['INTEGER'],'defaultValue':0x0}}; \ No newline at end of file diff --git a/server/api/voiceAgentReport/voiceAgentReport.controller.js b/server/api/voiceAgentReport/voiceAgentReport.controller.js index ff3cbd0..6e1393f 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(_0x500419,_0x549162){var _0x241c1a=function(_0x3bea1a){while(--_0x3bea1a){_0x500419['push'](_0x500419['shift']());}};_0x241c1a(++_0x549162);}(_0xa9e0,0x123));var _0x0a9e=function(_0x38a7ac,_0x45514b){_0x38a7ac=_0x38a7ac-0x0;var _0x53061a=_0xa9e0[_0x38a7ac];return _0x53061a;};'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(_0x8a969d,_0x339d9f){var _0x1d8dc7=function(_0x283ec0){while(--_0x283ec0){_0x8a969d['push'](_0x8a969d['shift']());}};_0x1d8dc7(++_0x339d9f);}(_0xa9e0,0x123));var _0x0a9e=function(_0x5783f4,_0x4a9e0a){_0x5783f4=_0x5783f4-0x0;var _0x28e380=_0xa9e0[_0x5783f4];return _0x28e380;};'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 ecf15fd..928a6d9 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 _0xeb5d=['../../config/logger','api','moment','path','rimraf','./voiceAgentReport.attributes','exports','define','VoiceAgentReport','report_agent','uniqueid','destuniqueid','util'];(function(_0x2e1104,_0x169fc2){var _0x56d154=function(_0x32d143){while(--_0x32d143){_0x2e1104['push'](_0x2e1104['shift']());}};_0x56d154(++_0x169fc2);}(_0xeb5d,0x16b));var _0xdeb5=function(_0x4e676e,_0x2a7c6d){_0x4e676e=_0x4e676e-0x0;var _0x336a3c=_0xeb5d[_0x4e676e];return _0x336a3c;};'use strict';var _=require('lodash');var util=require(_0xdeb5('0x0'));var logger=require(_0xdeb5('0x1'))(_0xdeb5('0x2'));var moment=require(_0xdeb5('0x3'));var BPromise=require('bluebird');var rp=require('request-promise');var fs=require('fs');var path=require(_0xdeb5('0x4'));var rimraf=require(_0xdeb5('0x5'));var config=require('../../config/environment');var attributes=require(_0xdeb5('0x6'));module[_0xdeb5('0x7')]=function(_0x164ecb,_0x33af72){return _0x164ecb[_0xdeb5('0x8')](_0xdeb5('0x9'),attributes,{'tableName':_0xdeb5('0xa'),'paranoid':![],'indexes':[{'fields':[_0xdeb5('0xb'),_0xdeb5('0xc')]}],'timestamps':!![]});}; \ No newline at end of file +var _0xf452=['request-promise','path','rimraf','../../config/environment','./voiceAgentReport.attributes','exports','define','VoiceAgentReport','report_agent','uniqueid','destuniqueid','lodash','util','api','moment','bluebird'];(function(_0x1053e4,_0x4788ab){var _0x433648=function(_0x5d2f23){while(--_0x5d2f23){_0x1053e4['push'](_0x1053e4['shift']());}};_0x433648(++_0x4788ab);}(_0xf452,0x13b));var _0x2f45=function(_0x5b40cf,_0x1fc148){_0x5b40cf=_0x5b40cf-0x0;var _0x5ce758=_0xf452[_0x5b40cf];return _0x5ce758;};'use strict';var _=require(_0x2f45('0x0'));var util=require(_0x2f45('0x1'));var logger=require('../../config/logger')(_0x2f45('0x2'));var moment=require(_0x2f45('0x3'));var BPromise=require(_0x2f45('0x4'));var rp=require(_0x2f45('0x5'));var fs=require('fs');var path=require(_0x2f45('0x6'));var rimraf=require(_0x2f45('0x7'));var config=require(_0x2f45('0x8'));var attributes=require(_0x2f45('0x9'));module[_0x2f45('0xa')]=function(_0x416e83,_0x1a53cf){return _0x416e83[_0x2f45('0xb')](_0x2f45('0xc'),attributes,{'tableName':_0x2f45('0xd'),'paranoid':![],'indexes':[{'fields':[_0x2f45('0xe'),_0x2f45('0xf')]}],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/voiceAgentReport/voiceAgentReport.rpc.js b/server/api/voiceAgentReport/voiceAgentReport.rpc.js index 5ceac1a..d0be1ae 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 _0x6b80=['VoiceAgentReport,\x20%s,\x20%s,\x20%s','request\x20sent','stringify','error','code','VoiceAgentReport,\x20%s,\x20%s','message','info','result','catch','CreateVoiceAgentReport','VoiceAgentReport','create','body','options','raw','UpdateVoiceAgentReport','where','attributes','lodash','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/logger','rpc','../../config/environment','client','http','request','then','debug'];(function(_0x3dee92,_0x55e1eb){var _0x44d36e=function(_0x34de1a){while(--_0x34de1a){_0x3dee92['push'](_0x3dee92['shift']());}};_0x44d36e(++_0x55e1eb);}(_0x6b80,0x17e));var _0x06b8=function(_0x46efd7,_0x43f84d){_0x46efd7=_0x46efd7-0x0;var _0x5637e4=_0x6b80[_0x46efd7];return _0x5637e4;};'use strict';var _=require(_0x06b8('0x0'));var util=require('util');var moment=require(_0x06b8('0x1'));var BPromise=require(_0x06b8('0x2'));var rs=require(_0x06b8('0x3'));var fs=require('fs');var Redis=require(_0x06b8('0x4'));var db=require(_0x06b8('0x5'))['db'];var utils=require('../../config/utils');var logger=require(_0x06b8('0x6'))(_0x06b8('0x7'));var config=require(_0x06b8('0x8'));var jayson=require('jayson/promise');var client=jayson[_0x06b8('0x9')][_0x06b8('0xa')]({'port':0x232a});function respondWithRpcPromise(_0x16f90c,_0x5008ea,_0x335c72){return new BPromise(function(_0x168f21,_0xbe267b){return client[_0x06b8('0xb')](_0x16f90c,_0x335c72)[_0x06b8('0xc')](function(_0x4afd21){logger['info']('VoiceAgentReport,\x20%s,\x20%s',_0x5008ea,'request\x20sent');logger[_0x06b8('0xd')](_0x06b8('0xe'),_0x5008ea,_0x06b8('0xf'),JSON[_0x06b8('0x10')](_0x4afd21));if(_0x4afd21['error']){if(_0x4afd21[_0x06b8('0x11')][_0x06b8('0x12')]===0x1f4){logger['error'](_0x06b8('0x13'),_0x5008ea,_0x4afd21[_0x06b8('0x11')][_0x06b8('0x14')]);return _0xbe267b(_0x4afd21[_0x06b8('0x11')][_0x06b8('0x14')]);}logger['error'](_0x06b8('0x13'),_0x5008ea,_0x4afd21[_0x06b8('0x11')][_0x06b8('0x14')]);return _0x168f21(_0x4afd21[_0x06b8('0x11')][_0x06b8('0x14')]);}else{logger[_0x06b8('0x15')](_0x06b8('0x13'),_0x5008ea,_0x06b8('0xf'));_0x168f21(_0x4afd21[_0x06b8('0x16')]['message']);}})[_0x06b8('0x17')](function(_0x1b9ad6){logger[_0x06b8('0x11')](_0x06b8('0x13'),_0x5008ea,_0x1b9ad6);_0xbe267b(_0x1b9ad6);});});}exports[_0x06b8('0x18')]=function(_0x19f0a8){var _0x46adf2=this;return new Promise(function(_0x10bca4,_0x407e0a){return db[_0x06b8('0x19')][_0x06b8('0x1a')](_0x19f0a8[_0x06b8('0x1b')],{'raw':_0x19f0a8['options']?_0x19f0a8[_0x06b8('0x1c')][_0x06b8('0x1d')]===undefined?!![]:![]:!![]})[_0x06b8('0xc')](function(_0x54e9a0){logger['info'](_0x06b8('0x18'),_0x19f0a8);logger[_0x06b8('0xd')](_0x06b8('0x18'),_0x19f0a8,JSON[_0x06b8('0x10')](_0x54e9a0));_0x10bca4(_0x54e9a0);})[_0x06b8('0x17')](function(_0x4aa485){logger[_0x06b8('0x11')](_0x06b8('0x18'),_0x4aa485[_0x06b8('0x14')],_0x19f0a8);_0x407e0a(_0x46adf2['error'](0x1f4,_0x4aa485[_0x06b8('0x14')]));});});};exports[_0x06b8('0x1e')]=function(_0x5b162c){var _0x56f5da=this;return new Promise(function(_0x34c304,_0x555b6f){return db['VoiceAgentReport']['update'](_0x5b162c[_0x06b8('0x1b')],{'raw':_0x5b162c['options']?_0x5b162c[_0x06b8('0x1c')][_0x06b8('0x1d')]===undefined?!![]:![]:!![],'individualHooks':!![],'where':_0x5b162c[_0x06b8('0x1c')]?_0x5b162c[_0x06b8('0x1c')][_0x06b8('0x1f')]||null:null,'attributes':_0x5b162c[_0x06b8('0x1c')]?_0x5b162c[_0x06b8('0x1c')][_0x06b8('0x20')]||null:null,'limit':_0x5b162c[_0x06b8('0x1c')]?_0x5b162c[_0x06b8('0x1c')]['limit']||null:null})[_0x06b8('0xc')](function(_0x31a4af){logger[_0x06b8('0x15')](_0x06b8('0x1e'),_0x5b162c);logger[_0x06b8('0xd')](_0x06b8('0x1e'),_0x5b162c,JSON[_0x06b8('0x10')](_0x31a4af));_0x34c304(_0x31a4af);})['catch'](function(_0x5ac6d2){logger[_0x06b8('0x11')]('UpdateVoiceAgentReport',_0x5ac6d2[_0x06b8('0x14')],_0x5b162c);_0x555b6f(_0x56f5da[_0x06b8('0x11')](0x1f4,_0x5ac6d2[_0x06b8('0x14')]));});});}; \ No newline at end of file +var _0x7f45=['../../config/environment','jayson/promise','client','http','request','then','VoiceAgentReport,\x20%s,\x20%s','debug','stringify','error','message','request\x20sent','result','CreateVoiceAgentReport','VoiceAgentReport','create','options','raw','info','catch','UpdateVoiceAgentReport','update','body','where','attributes','limit','lodash','moment','bluebird','randomstring','ioredis','../../config/logger','rpc'];(function(_0x229e80,_0x414425){var _0x30c4a4=function(_0x249225){while(--_0x249225){_0x229e80['push'](_0x229e80['shift']());}};_0x30c4a4(++_0x414425);}(_0x7f45,0x7d));var _0x57f4=function(_0x1e2a22,_0x582948){_0x1e2a22=_0x1e2a22-0x0;var _0x3dd61c=_0x7f45[_0x1e2a22];return _0x3dd61c;};'use strict';var _=require(_0x57f4('0x0'));var util=require('util');var moment=require(_0x57f4('0x1'));var BPromise=require(_0x57f4('0x2'));var rs=require(_0x57f4('0x3'));var fs=require('fs');var Redis=require(_0x57f4('0x4'));var db=require('../../mysqldb')['db'];var utils=require('../../config/utils');var logger=require(_0x57f4('0x5'))(_0x57f4('0x6'));var config=require(_0x57f4('0x7'));var jayson=require(_0x57f4('0x8'));var client=jayson[_0x57f4('0x9')][_0x57f4('0xa')]({'port':0x232a});function respondWithRpcPromise(_0x2f633d,_0x4863f1,_0x2f734a){return new BPromise(function(_0xa760e,_0x48dfc5){return client[_0x57f4('0xb')](_0x2f633d,_0x2f734a)[_0x57f4('0xc')](function(_0xef39e2){logger['info'](_0x57f4('0xd'),_0x4863f1,'request\x20sent');logger[_0x57f4('0xe')]('VoiceAgentReport,\x20%s,\x20%s,\x20%s',_0x4863f1,'request\x20sent',JSON[_0x57f4('0xf')](_0xef39e2));if(_0xef39e2['error']){if(_0xef39e2[_0x57f4('0x10')]['code']===0x1f4){logger['error'](_0x57f4('0xd'),_0x4863f1,_0xef39e2[_0x57f4('0x10')][_0x57f4('0x11')]);return _0x48dfc5(_0xef39e2[_0x57f4('0x10')][_0x57f4('0x11')]);}logger[_0x57f4('0x10')](_0x57f4('0xd'),_0x4863f1,_0xef39e2[_0x57f4('0x10')][_0x57f4('0x11')]);return _0xa760e(_0xef39e2[_0x57f4('0x10')]['message']);}else{logger['info'](_0x57f4('0xd'),_0x4863f1,_0x57f4('0x12'));_0xa760e(_0xef39e2[_0x57f4('0x13')][_0x57f4('0x11')]);}})['catch'](function(_0x41c281){logger[_0x57f4('0x10')](_0x57f4('0xd'),_0x4863f1,_0x41c281);_0x48dfc5(_0x41c281);});});}exports[_0x57f4('0x14')]=function(_0x4a96a4){var _0x4e2826=this;return new Promise(function(_0x4ed2a9,_0x492a28){return db[_0x57f4('0x15')][_0x57f4('0x16')](_0x4a96a4['body'],{'raw':_0x4a96a4[_0x57f4('0x17')]?_0x4a96a4[_0x57f4('0x17')][_0x57f4('0x18')]===undefined?!![]:![]:!![]})['then'](function(_0x2640b0){logger[_0x57f4('0x19')](_0x57f4('0x14'),_0x4a96a4);logger[_0x57f4('0xe')](_0x57f4('0x14'),_0x4a96a4,JSON[_0x57f4('0xf')](_0x2640b0));_0x4ed2a9(_0x2640b0);})[_0x57f4('0x1a')](function(_0x4bd12a){logger[_0x57f4('0x10')]('CreateVoiceAgentReport',_0x4bd12a[_0x57f4('0x11')],_0x4a96a4);_0x492a28(_0x4e2826[_0x57f4('0x10')](0x1f4,_0x4bd12a[_0x57f4('0x11')]));});});};exports[_0x57f4('0x1b')]=function(_0x3b4318){var _0x161747=this;return new Promise(function(_0x5e3aef,_0x40a77a){return db[_0x57f4('0x15')][_0x57f4('0x1c')](_0x3b4318[_0x57f4('0x1d')],{'raw':_0x3b4318['options']?_0x3b4318[_0x57f4('0x17')][_0x57f4('0x18')]===undefined?!![]:![]:!![],'individualHooks':!![],'where':_0x3b4318['options']?_0x3b4318[_0x57f4('0x17')][_0x57f4('0x1e')]||null:null,'attributes':_0x3b4318['options']?_0x3b4318['options'][_0x57f4('0x1f')]||null:null,'limit':_0x3b4318[_0x57f4('0x17')]?_0x3b4318['options'][_0x57f4('0x20')]||null:null})[_0x57f4('0xc')](function(_0x27fc8c){logger['info'](_0x57f4('0x1b'),_0x3b4318);logger[_0x57f4('0xe')](_0x57f4('0x1b'),_0x3b4318,JSON[_0x57f4('0xf')](_0x27fc8c));_0x5e3aef(_0x27fc8c);})[_0x57f4('0x1a')](function(_0x397a54){logger['error']('UpdateVoiceAgentReport',_0x397a54[_0x57f4('0x11')],_0x3b4318);_0x40a77a(_0x161747[_0x57f4('0x10')](0x1f4,_0x397a54[_0x57f4('0x11')]));});});}; \ No newline at end of file diff --git a/server/api/voiceCallReport/index.js b/server/api/voiceCallReport/index.js index c96b866..933c91b 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 _0x1e78=['express','Router','./voiceCallReport.controller','isAuthenticated','index','get','describe','show','post','create','put','/:id','update','/with-retry/:id','updateWithRetry','delete','destroy','exports'];(function(_0x318666,_0x58de8f){var _0x251b10=function(_0x43d92f){while(--_0x43d92f){_0x318666['push'](_0x318666['shift']());}};_0x251b10(++_0x58de8f);}(_0x1e78,0x7e));var _0x81e7=function(_0x32fa5b,_0x337ba8){_0x32fa5b=_0x32fa5b-0x0;var _0x33cb35=_0x1e78[_0x32fa5b];return _0x33cb35;};'use strict';var express=require(_0x81e7('0x0'));var router=express[_0x81e7('0x1')]();var auth=require('../../components/auth/service');var controller=require(_0x81e7('0x2'));router['get']('/',auth[_0x81e7('0x3')](),controller[_0x81e7('0x4')]);router[_0x81e7('0x5')]('/describe',auth[_0x81e7('0x3')](),controller[_0x81e7('0x6')]);router[_0x81e7('0x5')]('/:id',auth[_0x81e7('0x3')](),controller[_0x81e7('0x7')]);router[_0x81e7('0x8')]('/',auth['isAuthenticated'](),controller[_0x81e7('0x9')]);router[_0x81e7('0xa')](_0x81e7('0xb'),auth['isAuthenticated'](),controller[_0x81e7('0xc')]);router[_0x81e7('0xa')](_0x81e7('0xd'),auth[_0x81e7('0x3')](),controller[_0x81e7('0xe')]);router[_0x81e7('0xf')](_0x81e7('0xb'),auth[_0x81e7('0x3')](),controller[_0x81e7('0x10')]);module[_0x81e7('0x11')]=router; \ No newline at end of file +var _0x39ee=['get','index','/describe','isAuthenticated','describe','/:id','show','create','update','put','updateWithRetry','destroy','express','Router','../../components/auth/service','./voiceCallReport.controller'];(function(_0x4ec653,_0x4bd68f){var _0x88994e=function(_0x58e672){while(--_0x58e672){_0x4ec653['push'](_0x4ec653['shift']());}};_0x88994e(++_0x4bd68f);}(_0x39ee,0x8c));var _0xe39e=function(_0x20a584,_0xe384a5){_0x20a584=_0x20a584-0x0;var _0x4b41a8=_0x39ee[_0x20a584];return _0x4b41a8;};'use strict';var express=require(_0xe39e('0x0'));var router=express[_0xe39e('0x1')]();var auth=require(_0xe39e('0x2'));var controller=require(_0xe39e('0x3'));router[_0xe39e('0x4')]('/',auth['isAuthenticated'](),controller[_0xe39e('0x5')]);router[_0xe39e('0x4')](_0xe39e('0x6'),auth[_0xe39e('0x7')](),controller[_0xe39e('0x8')]);router[_0xe39e('0x4')](_0xe39e('0x9'),auth[_0xe39e('0x7')](),controller[_0xe39e('0xa')]);router['post']('/',auth[_0xe39e('0x7')](),controller[_0xe39e('0xb')]);router['put'](_0xe39e('0x9'),auth[_0xe39e('0x7')](),controller[_0xe39e('0xc')]);router[_0xe39e('0xd')]('/with-retry/:id',auth[_0xe39e('0x7')](),controller[_0xe39e('0xe')]);router['delete'](_0xe39e('0x9'),auth[_0xe39e('0x7')](),controller[_0xe39e('0xf')]);module['exports']=router; \ No newline at end of file diff --git a/server/api/voiceCallReport/voiceCallReport.attributes.js b/server/api/voiceCallReport/voiceCallReport.attributes.js index 1f4d73d..5b1ff57 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 _0xce31=['internal','outbound','dialer','STRING','TEXT','DATE','INTEGER','sequelize','exports','ENUM','inbound'];(function(_0x79702,_0x34931c){var _0x417e6b=function(_0x55294a){while(--_0x55294a){_0x79702['push'](_0x79702['shift']());}};_0x417e6b(++_0x34931c);}(_0xce31,0x1d5));var _0x1ce3=function(_0x9eb03b,_0x51b94d){_0x9eb03b=_0x9eb03b-0x0;var _0x55a6ac=_0xce31[_0x9eb03b];return _0x55a6ac;};'use strict';var Sequelize=require(_0x1ce3('0x0'));module[_0x1ce3('0x1')]={'uniqueid':{'type':Sequelize['STRING']},'type':{'type':Sequelize[_0x1ce3('0x2')](_0x1ce3('0x3'),_0x1ce3('0x4'),_0x1ce3('0x5'),'inbound-fax','outbound-fax',_0x1ce3('0x6'))},'tag':{'type':Sequelize[_0x1ce3('0x7')]},'accountcode':{'type':Sequelize['STRING']},'source':{'type':Sequelize[_0x1ce3('0x7')]},'destination':{'type':Sequelize['STRING']},'destinationcontext':{'type':Sequelize[_0x1ce3('0x7')]},'callerid':{'type':Sequelize['STRING']},'channel':{'type':Sequelize['STRING']},'destinationchannel':{'type':Sequelize[_0x1ce3('0x7')]},'lastapplication':{'type':Sequelize[_0x1ce3('0x7')]},'lastdata':{'type':Sequelize[_0x1ce3('0x8')]},'starttime':{'type':Sequelize[_0x1ce3('0x9')]},'systemanswertime':{'type':Sequelize[_0x1ce3('0x9')]},'answertime':{'type':Sequelize[_0x1ce3('0x9')]},'endtime':{'type':Sequelize[_0x1ce3('0x9')]},'duration':{'type':Sequelize[_0x1ce3('0xa')]},'billableseconds':{'type':Sequelize[_0x1ce3('0xa')]},'mohtime':{'type':Sequelize[_0x1ce3('0xa')],'defaultValue':0x0},'disposition':{'type':Sequelize[_0x1ce3('0x7')]},'amaflags':{'type':Sequelize[_0x1ce3('0x7')]},'userfield':{'type':Sequelize[_0x1ce3('0x7')]},'userDisposition':{'type':Sequelize[_0x1ce3('0x7')]},'userSecondDisposition':{'type':Sequelize['STRING']},'userThirdDisposition':{'type':Sequelize[_0x1ce3('0x7')]},'note':{'type':Sequelize[_0x1ce3('0x7')]},'prefix':{'type':Sequelize[_0x1ce3('0x7')]},'routeid':{'type':Sequelize[_0x1ce3('0xa')]},'sipcallid':{'type':Sequelize[_0x1ce3('0x7')]}}; \ No newline at end of file +var _0x034e=['sequelize','STRING','inbound','internal','outbound','inbound-fax','outbound-fax','dialer','DATE','INTEGER'];(function(_0x29ceac,_0x5abe5f){var _0x368c91=function(_0x3611e3){while(--_0x3611e3){_0x29ceac['push'](_0x29ceac['shift']());}};_0x368c91(++_0x5abe5f);}(_0x034e,0x118));var _0xe034=function(_0x3c312c,_0x41f47d){_0x3c312c=_0x3c312c-0x0;var _0x2eaa74=_0x034e[_0x3c312c];return _0x2eaa74;};'use strict';var Sequelize=require(_0xe034('0x0'));module['exports']={'uniqueid':{'type':Sequelize[_0xe034('0x1')]},'type':{'type':Sequelize['ENUM'](_0xe034('0x2'),_0xe034('0x3'),_0xe034('0x4'),_0xe034('0x5'),_0xe034('0x6'),_0xe034('0x7'))},'tag':{'type':Sequelize[_0xe034('0x1')]},'accountcode':{'type':Sequelize[_0xe034('0x1')]},'source':{'type':Sequelize[_0xe034('0x1')]},'destination':{'type':Sequelize['STRING']},'destinationcontext':{'type':Sequelize[_0xe034('0x1')]},'callerid':{'type':Sequelize[_0xe034('0x1')]},'channel':{'type':Sequelize[_0xe034('0x1')]},'destinationchannel':{'type':Sequelize[_0xe034('0x1')]},'lastapplication':{'type':Sequelize[_0xe034('0x1')]},'lastdata':{'type':Sequelize['TEXT']},'starttime':{'type':Sequelize['DATE']},'systemanswertime':{'type':Sequelize[_0xe034('0x8')]},'answertime':{'type':Sequelize[_0xe034('0x8')]},'endtime':{'type':Sequelize[_0xe034('0x8')]},'duration':{'type':Sequelize[_0xe034('0x9')]},'billableseconds':{'type':Sequelize['INTEGER']},'mohtime':{'type':Sequelize[_0xe034('0x9')],'defaultValue':0x0},'disposition':{'type':Sequelize[_0xe034('0x1')]},'amaflags':{'type':Sequelize[_0xe034('0x1')]},'userfield':{'type':Sequelize['STRING']},'userDisposition':{'type':Sequelize[_0xe034('0x1')]},'userSecondDisposition':{'type':Sequelize['STRING']},'userThirdDisposition':{'type':Sequelize[_0xe034('0x1')]},'note':{'type':Sequelize['STRING']},'prefix':{'type':Sequelize[_0xe034('0x1')]},'routeid':{'type':Sequelize['INTEGER']},'sipcallid':{'type':Sequelize['STRING']}}; \ No newline at end of file diff --git a/server/api/voiceCallReport/voiceCallReport.controller.js b/server/api/voiceCallReport/voiceCallReport.controller.js index 8a7fcda..3e53b5c 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 _0x014c=['No\x20such\x20report','../../components/parsers/qs','api','../../mysqldb','promise-retry','status','json','offset','limit','count','Content-Range','update','then','destroy','sendStatus','stack','name','map','VoiceCallReport','rawAttributes','fieldName','key','model','query','keys','intersection','attributes','fields','length','hasOwnProperty','order','sort','where','filters','pick','type','VIRTUAL','filter','merge','options','includeAll','include','fullname','alias','User','rows','catch','show','params','find','create','body','describe','uniqueid'];(function(_0x5e9396,_0x161fdd){var _0x4172e3=function(_0x4acd42){while(--_0x4acd42){_0x5e9396['push'](_0x5e9396['shift']());}};_0x4172e3(++_0x161fdd);}(_0x014c,0x17b));var _0xc014=function(_0xb7cb72,_0x19d391){_0xb7cb72=_0xb7cb72-0x0;var _0x4b7570=_0x014c[_0xb7cb72];return _0x4b7570;};'use strict';var _=require('lodash');var qs=require(_0xc014('0x0'));var logger=require('../../config/logger')(_0xc014('0x1'));var db=require(_0xc014('0x2'))['db'];const promiseRetry=require(_0xc014('0x3'));function respondWithResult(_0x4c56cf,_0x583f00){_0x583f00=_0x583f00||0xc8;return function(_0x2d449e){if(_0x2d449e){return _0x4c56cf[_0xc014('0x4')](_0x583f00)[_0xc014('0x5')](_0x2d449e);}};}function respondWithFilteredResult(_0x5248a0,_0x10f3cb){return function(_0x5138a8){if(_0x5138a8){var _0x398960=typeof _0x10f3cb[_0xc014('0x6')]==='undefined'&&typeof _0x10f3cb[_0xc014('0x7')]==='undefined';var _0x3b2fe9=_0x5138a8[_0xc014('0x8')];var _0x5701db=_0x398960?0x0:_0x10f3cb['offset'];var _0x77540e=_0x398960?_0x5138a8[_0xc014('0x8')]:_0x10f3cb[_0xc014('0x6')]+_0x10f3cb[_0xc014('0x7')];var _0x554c1d;if(_0x77540e>=_0x3b2fe9){_0x77540e=_0x3b2fe9;_0x554c1d=0xc8;}else{_0x554c1d=0xce;}_0x5248a0[_0xc014('0x4')](_0x554c1d);return _0x5248a0['set'](_0xc014('0x9'),_0x5701db+'-'+_0x77540e+'/'+_0x3b2fe9)['json'](_0x5138a8);}return null;};}function saveUpdates(_0x2ae990){return function(_0xcde2d3){if(_0xcde2d3){return _0xcde2d3[_0xc014('0xa')](_0x2ae990)[_0xc014('0xb')](function(_0x59f78d){return _0x59f78d;});}return null;};}function removeEntity(_0x3fdef0){return function(_0x300aaf){if(_0x300aaf){return _0x300aaf[_0xc014('0xc')]()['then'](function(){_0x3fdef0[_0xc014('0x4')](0xcc)['end']();});}};}function handleEntityNotFound(_0x458195){return function(_0x1c4d3b){if(!_0x1c4d3b){_0x458195[_0xc014('0xd')](0x194);}return _0x1c4d3b;};}function handleError(_0x26f264,_0x9f6a26){_0x9f6a26=_0x9f6a26||0x1f4;return function(_0x9791b9){logger['error'](_0x9791b9[_0xc014('0xe')]);if(_0x9791b9[_0xc014('0xf')]){delete _0x9791b9[_0xc014('0xf')];}_0x26f264[_0xc014('0x4')](_0x9f6a26)['send'](_0x9791b9);};}exports['index']=function(_0x42f93d,_0x4b5f22){var _0x5226ee={},_0x2261b0={},_0x4287fe={'count':0x0,'rows':[]};var _0x4a3823=_[_0xc014('0x10')](db[_0xc014('0x11')][_0xc014('0x12')],function(_0x2dac66){return{'name':_0x2dac66[_0xc014('0x13')],'type':_0x2dac66['type'][_0xc014('0x14')]};});_0x2261b0[_0xc014('0x15')]=_[_0xc014('0x10')](_0x4a3823,_0xc014('0xf'));_0x2261b0[_0xc014('0x16')]=_[_0xc014('0x17')](_0x42f93d[_0xc014('0x16')]);_0x2261b0['filters']=_[_0xc014('0x18')](_0x2261b0[_0xc014('0x15')],_0x2261b0[_0xc014('0x16')]);_0x5226ee[_0xc014('0x19')]=_[_0xc014('0x18')](_0x2261b0[_0xc014('0x15')],qs[_0xc014('0x1a')](_0x42f93d[_0xc014('0x16')][_0xc014('0x1a')]));_0x5226ee[_0xc014('0x19')]=_0x5226ee['attributes'][_0xc014('0x1b')]?_0x5226ee[_0xc014('0x19')]:_0x2261b0[_0xc014('0x15')];if(!_0x42f93d[_0xc014('0x16')][_0xc014('0x1c')]('nolimit')){_0x5226ee[_0xc014('0x7')]=qs[_0xc014('0x7')](_0x42f93d[_0xc014('0x16')][_0xc014('0x7')]);_0x5226ee['offset']=qs[_0xc014('0x6')](_0x42f93d[_0xc014('0x16')][_0xc014('0x6')]);}_0x5226ee[_0xc014('0x1d')]=qs[_0xc014('0x1e')](_0x42f93d[_0xc014('0x16')][_0xc014('0x1e')]);_0x5226ee[_0xc014('0x1f')]=qs[_0xc014('0x20')](_[_0xc014('0x21')](_0x42f93d[_0xc014('0x16')],_0x2261b0['filters']),_0x4a3823);if(_0x42f93d[_0xc014('0x16')]['filter']){_0x5226ee['where']=_['merge'](_0x5226ee[_0xc014('0x1f')],{'$or':_[_0xc014('0x10')](_0x4a3823,function(_0x5aeb3b){if(_0x5aeb3b[_0xc014('0x22')]!==_0xc014('0x23')){var _0x2d1859={};_0x2d1859[_0x5aeb3b[_0xc014('0xf')]]={'$like':'%'+_0x42f93d[_0xc014('0x16')][_0xc014('0x24')]+'%'};return _0x2d1859;}})});}_0x5226ee=_[_0xc014('0x25')]({},_0x5226ee,_0x42f93d[_0xc014('0x26')]);var _0x22cc4f={'where':_0x5226ee[_0xc014('0x1f')]};return db[_0xc014('0x11')][_0xc014('0x8')](_0x22cc4f)['then'](function(_0x40fd69){_0x4287fe['count']=_0x40fd69;if(_0x42f93d[_0xc014('0x16')][_0xc014('0x27')]){_0x5226ee[_0xc014('0x28')]=[{'attributes':['id',_0xc014('0xf'),_0xc014('0x29'),_0xc014('0x2a')],'model':db[_0xc014('0x2b')],'as':'User'}];}return db[_0xc014('0x11')]['findAll'](_0x5226ee);})[_0xc014('0xb')](function(_0x3182ef){_0x4287fe[_0xc014('0x2c')]=_0x3182ef;return _0x4287fe;})[_0xc014('0xb')](respondWithFilteredResult(_0x4b5f22,_0x5226ee))[_0xc014('0x2d')](handleError(_0x4b5f22,null));};exports[_0xc014('0x2e')]=function(_0x37ee2c,_0x5ca18b){var _0x94723c={'raw':!![],'where':{'id':_0x37ee2c[_0xc014('0x2f')]['id']}},_0xef647b={};_0xef647b['model']=_[_0xc014('0x17')](db[_0xc014('0x11')][_0xc014('0x12')]);_0xef647b['query']=_[_0xc014('0x17')](_0x37ee2c['query']);_0xef647b[_0xc014('0x20')]=_[_0xc014('0x18')](_0xef647b[_0xc014('0x15')],_0xef647b[_0xc014('0x16')]);_0x94723c[_0xc014('0x19')]=_[_0xc014('0x18')](_0xef647b[_0xc014('0x15')],qs[_0xc014('0x1a')](_0x37ee2c[_0xc014('0x16')][_0xc014('0x1a')]));_0x94723c[_0xc014('0x19')]=_0x94723c[_0xc014('0x19')]['length']?_0x94723c[_0xc014('0x19')]:_0xef647b[_0xc014('0x15')];if(_0x37ee2c[_0xc014('0x16')][_0xc014('0x27')]){_0x94723c['include']=[{'all':!![]}];}_0x94723c=_[_0xc014('0x25')]({},_0x94723c,_0x37ee2c['options']);return db[_0xc014('0x11')][_0xc014('0x30')](_0x94723c)[_0xc014('0xb')](handleEntityNotFound(_0x5ca18b,null))[_0xc014('0xb')](respondWithResult(_0x5ca18b,null))[_0xc014('0x2d')](handleError(_0x5ca18b,null));};exports[_0xc014('0x31')]=function(_0x1f7dfb,_0x2a0265){return db[_0xc014('0x11')][_0xc014('0x31')](_0x1f7dfb[_0xc014('0x32')],{})['then'](respondWithResult(_0x2a0265,0xc9))[_0xc014('0x2d')](handleError(_0x2a0265,null));};exports['destroy']=function(_0x48c68b,_0x12dad4){return db[_0xc014('0x11')][_0xc014('0x30')]({'where':{'id':_0x48c68b[_0xc014('0x2f')]['id']}})[_0xc014('0xb')](handleEntityNotFound(_0x12dad4,null))['then'](removeEntity(_0x12dad4,null))[_0xc014('0x2d')](handleError(_0x12dad4,null));};exports[_0xc014('0x33')]=function(_0x501a3e,_0x1b145f){return db[_0xc014('0x11')][_0xc014('0x33')]()[_0xc014('0xb')](respondWithResult(_0x1b145f,null))[_0xc014('0x2d')](handleError(_0x1b145f,null));};function findForUpdate(_0x21748b){return db[_0xc014('0x11')][_0xc014('0x30')]({'where':{'uniqueid':_0x21748b[_0xc014('0x2f')]['id'],'UserId':{'$or':[null,_0x21748b['user']['id']]}}});}exports[_0xc014('0xa')]=function(_0xef6993,_0x3dd71b){if(_0xef6993[_0xc014('0x32')][_0xc014('0x34')]){delete _0xef6993[_0xc014('0x32')][_0xc014('0x34')];}return findForUpdate(_0xef6993)[_0xc014('0xb')](handleEntityNotFound(_0x3dd71b,null))[_0xc014('0xb')](saveUpdates(_0xef6993['body'],null))[_0xc014('0xb')](respondWithResult(_0x3dd71b,null))['catch'](handleError(_0x3dd71b,null));};exports['updateWithRetry']=function(_0x184fae,_0x5ee1ee,_0x13a328){if(_0x184fae[_0xc014('0x32')]['uniqueid']){delete _0x184fae[_0xc014('0x32')][_0xc014('0x34')];}promiseRetry(function(_0x383e99){return findForUpdate(_0x184fae)[_0xc014('0xb')](function(_0x8a5ebd){if(_0x8a5ebd!==null){return _0x8a5ebd;}else{_0x383e99(new Error(_0xc014('0x35')));}});},{'retries':0x4,'minTimeout':0xfa})['then'](function(_0x1b0738){if(!_0x1b0738){return new Promise(function(_0x1d85d1){_0x1d85d1(handleEntityNotFound(_0x5ee1ee)());});}else{return _0x1b0738[_0xc014('0xa')](_0x184fae[_0xc014('0x32')])[_0xc014('0xb')](function(_0x464d3e){return respondWithResult(_0x5ee1ee)(_0x464d3e);});}},function(){handleEntityNotFound(_0x5ee1ee)();});}; \ No newline at end of file +var _0x8921=['stack','name','index','map','VoiceCallReport','rawAttributes','model','query','keys','filters','attributes','intersection','fields','length','hasOwnProperty','nolimit','order','sort','where','pick','filter','merge','type','VIRTUAL','options','fullname','User','findAll','rows','catch','show','includeAll','include','find','create','params','describe','user','body','uniqueid','lodash','../../config/logger','api','../../mysqldb','promise-retry','status','json','offset','undefined','limit','count','set','Content-Range','update','then','destroy','error'];(function(_0xf518d5,_0x2c2e32){var _0x2c99d2=function(_0x3c655d){while(--_0x3c655d){_0xf518d5['push'](_0xf518d5['shift']());}};_0x2c99d2(++_0x2c2e32);}(_0x8921,0x9a));var _0x1892=function(_0x32e912,_0x2b13c0){_0x32e912=_0x32e912-0x0;var _0x4edd64=_0x8921[_0x32e912];return _0x4edd64;};'use strict';var _=require(_0x1892('0x0'));var qs=require('../../components/parsers/qs');var logger=require(_0x1892('0x1'))(_0x1892('0x2'));var db=require(_0x1892('0x3'))['db'];const promiseRetry=require(_0x1892('0x4'));function respondWithResult(_0x42f951,_0x110b75){_0x110b75=_0x110b75||0xc8;return function(_0x28a89b){if(_0x28a89b){return _0x42f951[_0x1892('0x5')](_0x110b75)[_0x1892('0x6')](_0x28a89b);}};}function respondWithFilteredResult(_0x1ec03f,_0x40e2e5){return function(_0x238d31){if(_0x238d31){var _0x504741=typeof _0x40e2e5[_0x1892('0x7')]===_0x1892('0x8')&&typeof _0x40e2e5[_0x1892('0x9')]===_0x1892('0x8');var _0x1e8c17=_0x238d31[_0x1892('0xa')];var _0x4d15a4=_0x504741?0x0:_0x40e2e5[_0x1892('0x7')];var _0x3d3168=_0x504741?_0x238d31[_0x1892('0xa')]:_0x40e2e5[_0x1892('0x7')]+_0x40e2e5[_0x1892('0x9')];var _0x1af810;if(_0x3d3168>=_0x1e8c17){_0x3d3168=_0x1e8c17;_0x1af810=0xc8;}else{_0x1af810=0xce;}_0x1ec03f[_0x1892('0x5')](_0x1af810);return _0x1ec03f[_0x1892('0xb')](_0x1892('0xc'),_0x4d15a4+'-'+_0x3d3168+'/'+_0x1e8c17)[_0x1892('0x6')](_0x238d31);}return null;};}function saveUpdates(_0xe5ef78){return function(_0x5b8534){if(_0x5b8534){return _0x5b8534[_0x1892('0xd')](_0xe5ef78)[_0x1892('0xe')](function(_0x102096){return _0x102096;});}return null;};}function removeEntity(_0x53c709){return function(_0x474d22){if(_0x474d22){return _0x474d22[_0x1892('0xf')]()[_0x1892('0xe')](function(){_0x53c709[_0x1892('0x5')](0xcc)['end']();});}};}function handleEntityNotFound(_0x5e436d){return function(_0x934968){if(!_0x934968){_0x5e436d['sendStatus'](0x194);}return _0x934968;};}function handleError(_0x1fafe1,_0x4b3757){_0x4b3757=_0x4b3757||0x1f4;return function(_0x10b5f7){logger[_0x1892('0x10')](_0x10b5f7[_0x1892('0x11')]);if(_0x10b5f7[_0x1892('0x12')]){delete _0x10b5f7[_0x1892('0x12')];}_0x1fafe1['status'](_0x4b3757)['send'](_0x10b5f7);};}exports[_0x1892('0x13')]=function(_0x49937d,_0x437502){var _0x5f29b5={},_0x11c2e6={},_0x148da7={'count':0x0,'rows':[]};var _0x4c2e74=_[_0x1892('0x14')](db[_0x1892('0x15')][_0x1892('0x16')],function(_0xf4d237){return{'name':_0xf4d237['fieldName'],'type':_0xf4d237['type']['key']};});_0x11c2e6[_0x1892('0x17')]=_[_0x1892('0x14')](_0x4c2e74,'name');_0x11c2e6[_0x1892('0x18')]=_[_0x1892('0x19')](_0x49937d[_0x1892('0x18')]);_0x11c2e6[_0x1892('0x1a')]=_['intersection'](_0x11c2e6[_0x1892('0x17')],_0x11c2e6[_0x1892('0x18')]);_0x5f29b5[_0x1892('0x1b')]=_[_0x1892('0x1c')](_0x11c2e6['model'],qs[_0x1892('0x1d')](_0x49937d[_0x1892('0x18')][_0x1892('0x1d')]));_0x5f29b5[_0x1892('0x1b')]=_0x5f29b5[_0x1892('0x1b')][_0x1892('0x1e')]?_0x5f29b5[_0x1892('0x1b')]:_0x11c2e6[_0x1892('0x17')];if(!_0x49937d[_0x1892('0x18')][_0x1892('0x1f')](_0x1892('0x20'))){_0x5f29b5['limit']=qs[_0x1892('0x9')](_0x49937d[_0x1892('0x18')]['limit']);_0x5f29b5[_0x1892('0x7')]=qs['offset'](_0x49937d[_0x1892('0x18')][_0x1892('0x7')]);}_0x5f29b5[_0x1892('0x21')]=qs[_0x1892('0x22')](_0x49937d[_0x1892('0x18')]['sort']);_0x5f29b5[_0x1892('0x23')]=qs[_0x1892('0x1a')](_[_0x1892('0x24')](_0x49937d[_0x1892('0x18')],_0x11c2e6[_0x1892('0x1a')]),_0x4c2e74);if(_0x49937d[_0x1892('0x18')][_0x1892('0x25')]){_0x5f29b5[_0x1892('0x23')]=_[_0x1892('0x26')](_0x5f29b5['where'],{'$or':_['map'](_0x4c2e74,function(_0x49d5d4){if(_0x49d5d4[_0x1892('0x27')]!==_0x1892('0x28')){var _0x55f751={};_0x55f751[_0x49d5d4['name']]={'$like':'%'+_0x49937d[_0x1892('0x18')][_0x1892('0x25')]+'%'};return _0x55f751;}})});}_0x5f29b5=_['merge']({},_0x5f29b5,_0x49937d[_0x1892('0x29')]);var _0x48a78b={'where':_0x5f29b5[_0x1892('0x23')]};return db[_0x1892('0x15')]['count'](_0x48a78b)[_0x1892('0xe')](function(_0x24b7f7){_0x148da7['count']=_0x24b7f7;if(_0x49937d[_0x1892('0x18')]['includeAll']){_0x5f29b5['include']=[{'attributes':['id',_0x1892('0x12'),_0x1892('0x2a'),'alias'],'model':db[_0x1892('0x2b')],'as':_0x1892('0x2b')}];}return db[_0x1892('0x15')][_0x1892('0x2c')](_0x5f29b5);})[_0x1892('0xe')](function(_0x147108){_0x148da7[_0x1892('0x2d')]=_0x147108;return _0x148da7;})[_0x1892('0xe')](respondWithFilteredResult(_0x437502,_0x5f29b5))[_0x1892('0x2e')](handleError(_0x437502,null));};exports[_0x1892('0x2f')]=function(_0x4974f7,_0x2e1aaf){var _0x7524c2={'raw':!![],'where':{'id':_0x4974f7['params']['id']}},_0x1ac7bd={};_0x1ac7bd[_0x1892('0x17')]=_[_0x1892('0x19')](db[_0x1892('0x15')][_0x1892('0x16')]);_0x1ac7bd['query']=_[_0x1892('0x19')](_0x4974f7[_0x1892('0x18')]);_0x1ac7bd[_0x1892('0x1a')]=_[_0x1892('0x1c')](_0x1ac7bd[_0x1892('0x17')],_0x1ac7bd[_0x1892('0x18')]);_0x7524c2[_0x1892('0x1b')]=_[_0x1892('0x1c')](_0x1ac7bd[_0x1892('0x17')],qs[_0x1892('0x1d')](_0x4974f7[_0x1892('0x18')]['fields']));_0x7524c2[_0x1892('0x1b')]=_0x7524c2[_0x1892('0x1b')][_0x1892('0x1e')]?_0x7524c2[_0x1892('0x1b')]:_0x1ac7bd[_0x1892('0x17')];if(_0x4974f7[_0x1892('0x18')][_0x1892('0x30')]){_0x7524c2[_0x1892('0x31')]=[{'all':!![]}];}_0x7524c2=_[_0x1892('0x26')]({},_0x7524c2,_0x4974f7[_0x1892('0x29')]);return db[_0x1892('0x15')][_0x1892('0x32')](_0x7524c2)['then'](handleEntityNotFound(_0x2e1aaf,null))['then'](respondWithResult(_0x2e1aaf,null))['catch'](handleError(_0x2e1aaf,null));};exports['create']=function(_0x53a7cc,_0x17b833){return db['VoiceCallReport'][_0x1892('0x33')](_0x53a7cc['body'],{})[_0x1892('0xe')](respondWithResult(_0x17b833,0xc9))[_0x1892('0x2e')](handleError(_0x17b833,null));};exports[_0x1892('0xf')]=function(_0x2ebb0d,_0x445849){return db[_0x1892('0x15')][_0x1892('0x32')]({'where':{'id':_0x2ebb0d[_0x1892('0x34')]['id']}})[_0x1892('0xe')](handleEntityNotFound(_0x445849,null))[_0x1892('0xe')](removeEntity(_0x445849,null))[_0x1892('0x2e')](handleError(_0x445849,null));};exports[_0x1892('0x35')]=function(_0x40a7f6,_0x551398){return db[_0x1892('0x15')]['describe']()['then'](respondWithResult(_0x551398,null))[_0x1892('0x2e')](handleError(_0x551398,null));};function findForUpdate(_0x5886cf){return db[_0x1892('0x15')][_0x1892('0x32')]({'where':{'uniqueid':_0x5886cf[_0x1892('0x34')]['id'],'UserId':{'$or':[null,_0x5886cf[_0x1892('0x36')]['id']]}}});}exports['update']=function(_0x5f431f,_0x11ab70){if(_0x5f431f[_0x1892('0x37')]['uniqueid']){delete _0x5f431f[_0x1892('0x37')]['uniqueid'];}return findForUpdate(_0x5f431f)[_0x1892('0xe')](handleEntityNotFound(_0x11ab70,null))[_0x1892('0xe')](saveUpdates(_0x5f431f[_0x1892('0x37')],null))[_0x1892('0xe')](respondWithResult(_0x11ab70,null))[_0x1892('0x2e')](handleError(_0x11ab70,null));};exports['updateWithRetry']=function(_0x124e03,_0x4db765,_0x532b40){if(_0x124e03[_0x1892('0x37')][_0x1892('0x38')]){delete _0x124e03[_0x1892('0x37')][_0x1892('0x38')];}promiseRetry(function(_0x37de60){return findForUpdate(_0x124e03)[_0x1892('0xe')](function(_0x10bdc5){if(_0x10bdc5!==null){return _0x10bdc5;}else{_0x37de60(new Error('No\x20such\x20report'));}});},{'retries':0x4,'minTimeout':0xfa})[_0x1892('0xe')](function(_0x370352){if(!_0x370352){return new Promise(function(_0x352ce6){_0x352ce6(handleEntityNotFound(_0x4db765)());});}else{return _0x370352[_0x1892('0xd')](_0x124e03[_0x1892('0x37')])[_0x1892('0xe')](function(_0x5366cf){return respondWithResult(_0x4db765)(_0x5366cf);});}},function(){handleEntityNotFound(_0x4db765)();});}; \ No newline at end of file diff --git a/server/api/voiceCallReport/voiceCallReport.model.js b/server/api/voiceCallReport/voiceCallReport.model.js index 0fd0a7a..5cd0fa9 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 _0x1ee7=['../../config/logger','request-promise','path','rimraf','./voiceCallReport.attributes','exports','lodash','util'];(function(_0x12c289,_0x3376b8){var _0x9e28d5=function(_0x33cb58){while(--_0x33cb58){_0x12c289['push'](_0x12c289['shift']());}};_0x9e28d5(++_0x3376b8);}(_0x1ee7,0xce));var _0x71ee=function(_0x2fd675,_0xb2f5a9){_0x2fd675=_0x2fd675-0x0;var _0x4d6fdb=_0x1ee7[_0x2fd675];return _0x4d6fdb;};'use strict';var _=require(_0x71ee('0x0'));var util=require(_0x71ee('0x1'));var logger=require(_0x71ee('0x2'))('api');var moment=require('moment');var BPromise=require('bluebird');var rp=require(_0x71ee('0x3'));var fs=require('fs');var path=require(_0x71ee('0x4'));var rimraf=require(_0x71ee('0x5'));var config=require('../../config/environment');var attributes=require(_0x71ee('0x6'));module[_0x71ee('0x7')]=function(_0x39e402,_0x5d7d53){return _0x39e402['define']('VoiceCallReport',attributes,{'tableName':'report_call','paranoid':![],'indexes':[{'fields':['uniqueid']}],'timestamps':!![]});}; \ No newline at end of file +var _0xada1=['VoiceCallReport','uniqueid','lodash','util','api','request-promise','path','../../config/environment','exports'];(function(_0x382469,_0x9fb53a){var _0x1c3e9c=function(_0x1363ea){while(--_0x1363ea){_0x382469['push'](_0x382469['shift']());}};_0x1c3e9c(++_0x9fb53a);}(_0xada1,0xfe));var _0x1ada=function(_0x4c12ec,_0x2e9103){_0x4c12ec=_0x4c12ec-0x0;var _0x3ae42c=_0xada1[_0x4c12ec];return _0x3ae42c;};'use strict';var _=require(_0x1ada('0x0'));var util=require(_0x1ada('0x1'));var logger=require('../../config/logger')(_0x1ada('0x2'));var moment=require('moment');var BPromise=require('bluebird');var rp=require(_0x1ada('0x3'));var fs=require('fs');var path=require(_0x1ada('0x4'));var rimraf=require('rimraf');var config=require(_0x1ada('0x5'));var attributes=require('./voiceCallReport.attributes');module[_0x1ada('0x6')]=function(_0x469fab,_0x4b89e3){return _0x469fab['define'](_0x1ada('0x7'),attributes,{'tableName':'report_call','paranoid':![],'indexes':[{'fields':[_0x1ada('0x8')]}],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/voiceCallReport/voiceCallReport.rpc.js b/server/api/voiceCallReport/voiceCallReport.rpc.js index 8952128..8c3083c 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 _0x3715=['GetVoiceCallReport','VoiceCallReport','options','raw','attributes','limit','include','map','model','debug','CreateVoiceCallReport','create','body','UpdateVoiceCallReport','where','lodash','util','moment','bluebird','randomstring','ioredis','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','client','http','then','info','VoiceCallReport,\x20%s,\x20%s,\x20%s','request\x20sent','stringify','error','code','VoiceCallReport,\x20%s,\x20%s','message','result','catch'];(function(_0x5a8358,_0x31d034){var _0x2fa5b3=function(_0x4a1f9b){while(--_0x4a1f9b){_0x5a8358['push'](_0x5a8358['shift']());}};_0x2fa5b3(++_0x31d034);}(_0x3715,0x120));var _0x5371=function(_0x5a59d7,_0x1a5203){_0x5a59d7=_0x5a59d7-0x0;var _0x22145d=_0x3715[_0x5a59d7];return _0x22145d;};'use strict';var _=require(_0x5371('0x0'));var util=require(_0x5371('0x1'));var moment=require(_0x5371('0x2'));var BPromise=require(_0x5371('0x3'));var rs=require(_0x5371('0x4'));var fs=require('fs');var Redis=require(_0x5371('0x5'));var db=require('../../mysqldb')['db'];var utils=require(_0x5371('0x6'));var logger=require(_0x5371('0x7'))(_0x5371('0x8'));var config=require(_0x5371('0x9'));var jayson=require(_0x5371('0xa'));var client=jayson[_0x5371('0xb')][_0x5371('0xc')]({'port':0x232a});function respondWithRpcPromise(_0x29f5a9,_0x20b52b,_0x2327ec){return new BPromise(function(_0x5b2b3e,_0x53893e){return client['request'](_0x29f5a9,_0x2327ec)[_0x5371('0xd')](function(_0x517c19){logger[_0x5371('0xe')]('VoiceCallReport,\x20%s,\x20%s',_0x20b52b,'request\x20sent');logger['debug'](_0x5371('0xf'),_0x20b52b,_0x5371('0x10'),JSON[_0x5371('0x11')](_0x517c19));if(_0x517c19[_0x5371('0x12')]){if(_0x517c19[_0x5371('0x12')][_0x5371('0x13')]===0x1f4){logger[_0x5371('0x12')](_0x5371('0x14'),_0x20b52b,_0x517c19[_0x5371('0x12')][_0x5371('0x15')]);return _0x53893e(_0x517c19[_0x5371('0x12')]['message']);}logger[_0x5371('0x12')](_0x5371('0x14'),_0x20b52b,_0x517c19[_0x5371('0x12')][_0x5371('0x15')]);return _0x5b2b3e(_0x517c19['error'][_0x5371('0x15')]);}else{logger[_0x5371('0xe')](_0x5371('0x14'),_0x20b52b,'request\x20sent');_0x5b2b3e(_0x517c19[_0x5371('0x16')][_0x5371('0x15')]);}})[_0x5371('0x17')](function(_0x4922c8){logger[_0x5371('0x12')](_0x5371('0x14'),_0x20b52b,_0x4922c8);_0x53893e(_0x4922c8);});});}exports[_0x5371('0x18')]=function(_0x187f02){var _0x3e4ef9=this;return new Promise(function(_0x317abf,_0x1b12b7){return db[_0x5371('0x19')]['findAll']({'raw':_0x187f02['options']?_0x187f02[_0x5371('0x1a')][_0x5371('0x1b')]===undefined?!![]:![]:!![],'where':_0x187f02[_0x5371('0x1a')]?_0x187f02[_0x5371('0x1a')]['where']||null:null,'attributes':_0x187f02[_0x5371('0x1a')]?_0x187f02[_0x5371('0x1a')][_0x5371('0x1c')]||null:null,'limit':_0x187f02[_0x5371('0x1a')]?_0x187f02[_0x5371('0x1a')][_0x5371('0x1d')]||null:null,'include':_0x187f02[_0x5371('0x1a')]?_0x187f02['options'][_0x5371('0x1e')]?_[_0x5371('0x1f')](_0x187f02[_0x5371('0x1a')][_0x5371('0x1e')],function(_0x582c78){return{'model':db[_0x582c78[_0x5371('0x20')]],'as':_0x582c78['as'],'attributes':_0x582c78['attributes'],'include':_0x582c78[_0x5371('0x1e')]?_[_0x5371('0x1f')](_0x582c78[_0x5371('0x1e')],function(_0x2965a6){return{'model':db[_0x2965a6[_0x5371('0x20')]],'as':_0x2965a6['as'],'attributes':_0x2965a6[_0x5371('0x1c')],'include':_0x2965a6['include']?_['map'](_0x2965a6[_0x5371('0x1e')],function(_0x42c633){return{'model':db[_0x42c633[_0x5371('0x20')]],'as':_0x42c633['as'],'attributes':_0x42c633['attributes']};}):[]};}):[]};}):[]:[]})[_0x5371('0xd')](function(_0x8278a1){logger[_0x5371('0xe')](_0x5371('0x18'),_0x187f02);logger[_0x5371('0x21')]('GetVoiceCallReport',_0x187f02,JSON[_0x5371('0x11')](_0x8278a1));_0x317abf(_0x8278a1);})[_0x5371('0x17')](function(_0x324e4e){logger[_0x5371('0x12')](_0x5371('0x18'),_0x324e4e[_0x5371('0x15')],_0x187f02);_0x1b12b7(_0x3e4ef9['error'](0x1f4,_0x324e4e[_0x5371('0x15')]));});});};exports[_0x5371('0x22')]=function(_0x3e23cc){var _0x31af49=this;return new Promise(function(_0x2ef86a,_0x53ebd6){return db[_0x5371('0x19')][_0x5371('0x23')](_0x3e23cc[_0x5371('0x24')],{'raw':_0x3e23cc['options']?_0x3e23cc[_0x5371('0x1a')][_0x5371('0x1b')]===undefined?!![]:![]:!![]})[_0x5371('0xd')](function(_0x16bb38){logger['info'](_0x5371('0x22'),_0x3e23cc);logger[_0x5371('0x21')]('CreateVoiceCallReport',_0x3e23cc,JSON['stringify'](_0x16bb38));_0x2ef86a(_0x16bb38);})[_0x5371('0x17')](function(_0x332e5d){logger[_0x5371('0x12')](_0x5371('0x22'),_0x332e5d[_0x5371('0x15')],_0x3e23cc);_0x53ebd6(_0x31af49[_0x5371('0x12')](0x1f4,_0x332e5d[_0x5371('0x15')]));});});};exports[_0x5371('0x25')]=function(_0x2d1cb8){var _0x372888=this;return new Promise(function(_0x4d829e,_0x3f17c1){return db[_0x5371('0x19')]['update'](_0x2d1cb8[_0x5371('0x24')],{'raw':_0x2d1cb8[_0x5371('0x1a')]?_0x2d1cb8[_0x5371('0x1a')][_0x5371('0x1b')]===undefined?!![]:![]:!![],'individualHooks':!![],'where':_0x2d1cb8[_0x5371('0x1a')]?_0x2d1cb8['options'][_0x5371('0x26')]||null:null,'attributes':_0x2d1cb8['options']?_0x2d1cb8[_0x5371('0x1a')][_0x5371('0x1c')]||null:null,'limit':_0x2d1cb8['options']?_0x2d1cb8[_0x5371('0x1a')][_0x5371('0x1d')]||null:null})['then'](function(_0xd6e6d9){logger[_0x5371('0xe')](_0x5371('0x25'),_0x2d1cb8);logger['debug']('UpdateVoiceCallReport',_0x2d1cb8,JSON[_0x5371('0x11')](_0xd6e6d9));_0x4d829e(_0xd6e6d9);})[_0x5371('0x17')](function(_0x42adf4){logger['error'](_0x5371('0x25'),_0x42adf4[_0x5371('0x15')],_0x2d1cb8);_0x3f17c1(_0x372888['error'](0x1f4,_0x42adf4[_0x5371('0x15')]));});});}; \ No newline at end of file +var _0x415c=['http','request','then','VoiceCallReport,\x20%s,\x20%s','debug','VoiceCallReport,\x20%s,\x20%s,\x20%s','request\x20sent','stringify','error','code','message','result','GetVoiceCallReport','VoiceCallReport','options','where','attributes','limit','include','map','model','info','catch','CreateVoiceCallReport','create','body','raw','UpdateVoiceCallReport','update','lodash','moment','bluebird','randomstring','../../mysqldb','../../config/logger','rpc','../../config/environment'];(function(_0x11df3e,_0x21249e){var _0x5139c4=function(_0x5d8f55){while(--_0x5d8f55){_0x11df3e['push'](_0x11df3e['shift']());}};_0x5139c4(++_0x21249e);}(_0x415c,0xb1));var _0xc415=function(_0x48162d,_0x5a9dd9){_0x48162d=_0x48162d-0x0;var _0x56191a=_0x415c[_0x48162d];return _0x56191a;};'use strict';var _=require(_0xc415('0x0'));var util=require('util');var moment=require(_0xc415('0x1'));var BPromise=require(_0xc415('0x2'));var rs=require(_0xc415('0x3'));var fs=require('fs');var Redis=require('ioredis');var db=require(_0xc415('0x4'))['db'];var utils=require('../../config/utils');var logger=require(_0xc415('0x5'))(_0xc415('0x6'));var config=require(_0xc415('0x7'));var jayson=require('jayson/promise');var client=jayson['client'][_0xc415('0x8')]({'port':0x232a});function respondWithRpcPromise(_0x54743f,_0x53085c,_0x26cdc3){return new BPromise(function(_0x3d6b2e,_0x4c9771){return client[_0xc415('0x9')](_0x54743f,_0x26cdc3)[_0xc415('0xa')](function(_0x476765){logger['info'](_0xc415('0xb'),_0x53085c,'request\x20sent');logger[_0xc415('0xc')](_0xc415('0xd'),_0x53085c,_0xc415('0xe'),JSON[_0xc415('0xf')](_0x476765));if(_0x476765[_0xc415('0x10')]){if(_0x476765[_0xc415('0x10')][_0xc415('0x11')]===0x1f4){logger[_0xc415('0x10')](_0xc415('0xb'),_0x53085c,_0x476765[_0xc415('0x10')]['message']);return _0x4c9771(_0x476765[_0xc415('0x10')][_0xc415('0x12')]);}logger[_0xc415('0x10')](_0xc415('0xb'),_0x53085c,_0x476765[_0xc415('0x10')][_0xc415('0x12')]);return _0x3d6b2e(_0x476765[_0xc415('0x10')][_0xc415('0x12')]);}else{logger['info'](_0xc415('0xb'),_0x53085c,_0xc415('0xe'));_0x3d6b2e(_0x476765[_0xc415('0x13')][_0xc415('0x12')]);}})['catch'](function(_0x49908e){logger[_0xc415('0x10')](_0xc415('0xb'),_0x53085c,_0x49908e);_0x4c9771(_0x49908e);});});}exports[_0xc415('0x14')]=function(_0x492bf3){var _0x3d9695=this;return new Promise(function(_0x1de42d,_0xd5e86c){return db[_0xc415('0x15')]['findAll']({'raw':_0x492bf3['options']?_0x492bf3['options']['raw']===undefined?!![]:![]:!![],'where':_0x492bf3[_0xc415('0x16')]?_0x492bf3[_0xc415('0x16')][_0xc415('0x17')]||null:null,'attributes':_0x492bf3[_0xc415('0x16')]?_0x492bf3[_0xc415('0x16')][_0xc415('0x18')]||null:null,'limit':_0x492bf3[_0xc415('0x16')]?_0x492bf3['options'][_0xc415('0x19')]||null:null,'include':_0x492bf3[_0xc415('0x16')]?_0x492bf3['options'][_0xc415('0x1a')]?_[_0xc415('0x1b')](_0x492bf3[_0xc415('0x16')]['include'],function(_0x657755){return{'model':db[_0x657755[_0xc415('0x1c')]],'as':_0x657755['as'],'attributes':_0x657755['attributes'],'include':_0x657755[_0xc415('0x1a')]?_[_0xc415('0x1b')](_0x657755[_0xc415('0x1a')],function(_0x2f1eaa){return{'model':db[_0x2f1eaa[_0xc415('0x1c')]],'as':_0x2f1eaa['as'],'attributes':_0x2f1eaa[_0xc415('0x18')],'include':_0x2f1eaa[_0xc415('0x1a')]?_[_0xc415('0x1b')](_0x2f1eaa[_0xc415('0x1a')],function(_0x40e15d){return{'model':db[_0x40e15d[_0xc415('0x1c')]],'as':_0x40e15d['as'],'attributes':_0x40e15d['attributes']};}):[]};}):[]};}):[]:[]})[_0xc415('0xa')](function(_0x4a7b92){logger[_0xc415('0x1d')]('GetVoiceCallReport',_0x492bf3);logger[_0xc415('0xc')](_0xc415('0x14'),_0x492bf3,JSON['stringify'](_0x4a7b92));_0x1de42d(_0x4a7b92);})[_0xc415('0x1e')](function(_0x1087f1){logger[_0xc415('0x10')]('GetVoiceCallReport',_0x1087f1[_0xc415('0x12')],_0x492bf3);_0xd5e86c(_0x3d9695[_0xc415('0x10')](0x1f4,_0x1087f1[_0xc415('0x12')]));});});};exports[_0xc415('0x1f')]=function(_0x1b5eda){var _0x4b9238=this;return new Promise(function(_0x4c0a52,_0xe76288){return db[_0xc415('0x15')][_0xc415('0x20')](_0x1b5eda[_0xc415('0x21')],{'raw':_0x1b5eda[_0xc415('0x16')]?_0x1b5eda['options'][_0xc415('0x22')]===undefined?!![]:![]:!![]})[_0xc415('0xa')](function(_0x559c27){logger[_0xc415('0x1d')]('CreateVoiceCallReport',_0x1b5eda);logger[_0xc415('0xc')]('CreateVoiceCallReport',_0x1b5eda,JSON['stringify'](_0x559c27));_0x4c0a52(_0x559c27);})[_0xc415('0x1e')](function(_0x492c94){logger[_0xc415('0x10')](_0xc415('0x1f'),_0x492c94[_0xc415('0x12')],_0x1b5eda);_0xe76288(_0x4b9238[_0xc415('0x10')](0x1f4,_0x492c94[_0xc415('0x12')]));});});};exports[_0xc415('0x23')]=function(_0xca5628){var _0x264847=this;return new Promise(function(_0x2c5173,_0x49e65d){return db[_0xc415('0x15')][_0xc415('0x24')](_0xca5628['body'],{'raw':_0xca5628[_0xc415('0x16')]?_0xca5628['options'][_0xc415('0x22')]===undefined?!![]:![]:!![],'individualHooks':!![],'where':_0xca5628[_0xc415('0x16')]?_0xca5628['options']['where']||null:null,'attributes':_0xca5628[_0xc415('0x16')]?_0xca5628['options'][_0xc415('0x18')]||null:null,'limit':_0xca5628[_0xc415('0x16')]?_0xca5628[_0xc415('0x16')][_0xc415('0x19')]||null:null})[_0xc415('0xa')](function(_0x46e7ff){logger['info']('UpdateVoiceCallReport',_0xca5628);logger[_0xc415('0xc')](_0xc415('0x23'),_0xca5628,JSON[_0xc415('0xf')](_0x46e7ff));_0x2c5173(_0x46e7ff);})[_0xc415('0x1e')](function(_0x4b5907){logger[_0xc415('0x10')](_0xc415('0x23'),_0x4b5907[_0xc415('0x12')],_0xca5628);_0x49e65d(_0x264847[_0xc415('0x10')](0x1f4,_0x4b5907['message']));});});}; \ No newline at end of file diff --git a/server/api/voiceChanSpy/index.js b/server/api/voiceChanSpy/index.js index de8430a..9c81b8b 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 _0x3bed=['Router','fs-extra','../../components/auth/service','../../components/interaction/service','get','isAuthenticated','show','post','create','put','update','/:id','destroy','exports','multer','path','connect-timeout','express'];(function(_0x3f266c,_0x373b2f){var _0x5f13c5=function(_0x257f85){while(--_0x257f85){_0x3f266c['push'](_0x3f266c['shift']());}};_0x5f13c5(++_0x373b2f);}(_0x3bed,0x188));var _0xd3be=function(_0xe2b149,_0x3c1439){_0xe2b149=_0xe2b149-0x0;var _0xc689fe=_0x3bed[_0xe2b149];return _0xc689fe;};'use strict';var multer=require(_0xd3be('0x0'));var util=require('util');var path=require(_0xd3be('0x1'));var timeout=require(_0xd3be('0x2'));var express=require(_0xd3be('0x3'));var router=express[_0xd3be('0x4')]();var fs_extra=require(_0xd3be('0x5'));var auth=require(_0xd3be('0x6'));var interaction=require(_0xd3be('0x7'));var config=require('../../config/environment');var controller=require('./voiceChanSpy.controller');router[_0xd3be('0x8')]('/',auth['isAuthenticated'](),controller['index']);router[_0xd3be('0x8')]('/:id',auth[_0xd3be('0x9')](),controller[_0xd3be('0xa')]);router[_0xd3be('0xb')]('/',auth[_0xd3be('0x9')](),controller[_0xd3be('0xc')]);router[_0xd3be('0xd')]('/:id',auth[_0xd3be('0x9')](),controller[_0xd3be('0xe')]);router['delete'](_0xd3be('0xf'),auth[_0xd3be('0x9')](),controller[_0xd3be('0x10')]);module[_0xd3be('0x11')]=router; \ No newline at end of file +var _0x63ad=['post','create','put','update','delete','destroy','multer','path','connect-timeout','express','Router','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','./voiceChanSpy.controller','isAuthenticated','index','/:id','show'];(function(_0x90f34f,_0x404021){var _0x4b18cf=function(_0x25112d){while(--_0x25112d){_0x90f34f['push'](_0x90f34f['shift']());}};_0x4b18cf(++_0x404021);}(_0x63ad,0x6a));var _0xd63a=function(_0x41451f,_0x1c5b9c){_0x41451f=_0x41451f-0x0;var _0x2b288f=_0x63ad[_0x41451f];return _0x2b288f;};'use strict';var multer=require(_0xd63a('0x0'));var util=require('util');var path=require(_0xd63a('0x1'));var timeout=require(_0xd63a('0x2'));var express=require(_0xd63a('0x3'));var router=express[_0xd63a('0x4')]();var fs_extra=require(_0xd63a('0x5'));var auth=require(_0xd63a('0x6'));var interaction=require(_0xd63a('0x7'));var config=require(_0xd63a('0x8'));var controller=require(_0xd63a('0x9'));router['get']('/',auth[_0xd63a('0xa')](),controller[_0xd63a('0xb')]);router['get'](_0xd63a('0xc'),auth[_0xd63a('0xa')](),controller[_0xd63a('0xd')]);router[_0xd63a('0xe')]('/',auth[_0xd63a('0xa')](),controller[_0xd63a('0xf')]);router[_0xd63a('0x10')]('/:id',auth[_0xd63a('0xa')](),controller[_0xd63a('0x11')]);router[_0xd63a('0x12')](_0xd63a('0xc'),auth[_0xd63a('0xa')](),controller[_0xd63a('0x13')]);module['exports']=router; \ No newline at end of file diff --git a/server/api/voiceChanSpy/voiceChanSpy.attributes.js b/server/api/voiceChanSpy/voiceChanSpy.attributes.js index 81b110f..4407baa 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 _0x32e5=['options','join','getDataValue','split','BOOLEAN','sequelize','exports','STRING','name','setDataValue'];(function(_0x5471a2,_0x2a3571){var _0x18e4de=function(_0x4e19ba){while(--_0x4e19ba){_0x5471a2['push'](_0x5471a2['shift']());}};_0x18e4de(++_0x2a3571);}(_0x32e5,0x181));var _0x532e=function(_0x501510,_0x61caa9){_0x501510=_0x501510-0x0;var _0x1e6ee5=_0x32e5[_0x501510];return _0x1e6ee5;};'use strict';var Sequelize=require(_0x532e('0x0'));module[_0x532e('0x1')]={'name':{'type':Sequelize[_0x532e('0x2')]},'prefix':{'type':Sequelize[_0x532e('0x2')],'unique':_0x532e('0x3'),'allowNull':![]},'options':{'type':Sequelize['STRING'],'set':function(_0x3f7130){this[_0x532e('0x4')](_0x532e('0x5'),_0x3f7130?_0x3f7130[_0x532e('0x6')](''):[]);},'get':function(){return this[_0x532e('0x7')]('options')?this['getDataValue']('options')[_0x532e('0x8')](''):[];}},'auth':{'type':Sequelize[_0x532e('0x9')],'defaultValue':![]},'password':{'type':Sequelize[_0x532e('0x2')]},'record':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'recordingFormat':{'type':Sequelize['STRING']},'description':{'type':Sequelize[_0x532e('0x2')]}}; \ No newline at end of file +var _0xdb61=['getDataValue','split','BOOLEAN','sequelize','exports','STRING','setDataValue','options','join'];(function(_0x5aa5ec,_0x112dce){var _0x2ae23d=function(_0x4c53ac){while(--_0x4c53ac){_0x5aa5ec['push'](_0x5aa5ec['shift']());}};_0x2ae23d(++_0x112dce);}(_0xdb61,0x1e0));var _0x1db6=function(_0x151e5b,_0x4bb7ef){_0x151e5b=_0x151e5b-0x0;var _0x3c4d55=_0xdb61[_0x151e5b];return _0x3c4d55;};'use strict';var Sequelize=require(_0x1db6('0x0'));module[_0x1db6('0x1')]={'name':{'type':Sequelize[_0x1db6('0x2')]},'prefix':{'type':Sequelize[_0x1db6('0x2')],'unique':'name','allowNull':![]},'options':{'type':Sequelize[_0x1db6('0x2')],'set':function(_0x432f8d){this[_0x1db6('0x3')](_0x1db6('0x4'),_0x432f8d?_0x432f8d[_0x1db6('0x5')](''):[]);},'get':function(){return this[_0x1db6('0x6')](_0x1db6('0x4'))?this[_0x1db6('0x6')](_0x1db6('0x4'))[_0x1db6('0x7')](''):[];}},'auth':{'type':Sequelize[_0x1db6('0x8')],'defaultValue':![]},'password':{'type':Sequelize['STRING']},'record':{'type':Sequelize[_0x1db6('0x8')],'defaultValue':![]},'recordingFormat':{'type':Sequelize[_0x1db6('0x2')]},'description':{'type':Sequelize[_0x1db6('0x2')]}}; \ No newline at end of file diff --git a/server/api/voiceChanSpy/voiceChanSpy.controller.js b/server/api/voiceChanSpy/voiceChanSpy.controller.js index a1a0002..9974511 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 _0x6c4b=['../../config/environment','../../config/license/util','../../mysqldb','sendStatus','status','json','offset','limit','undefined','count','set','Content-Range','apply','reject','save','update','then','get','ChanSpies','UserProfileResource','destroy','end','stack','name','send','index','rawAttributes','fieldName','model','map','query','keys','filters','intersection','attributes','fields','length','hasOwnProperty','sort','where','pick','filter','merge','type','VIRTUAL','options','includeAll','include','VoiceChanSpy','findAll','rows','catch','find','create','body','user','Unable\x20to\x20retrieve\x20the\x20current\x20user','role','userProfileId','autoAssociation','error','params','eml-format','rimraf','zip-dir','request-promise','moment','bluebird','mustache','util','path','ejs','lodash','squel','jsforce','desk.js','to-csv','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api'];(function(_0x16deae,_0x58546a){var _0x27d43b=function(_0x2df2ba){while(--_0x2df2ba){_0x16deae['push'](_0x16deae['shift']());}};_0x27d43b(++_0x58546a);}(_0x6c4b,0x93));var _0xb6c4=function(_0x256da0,_0x2d1a68){_0x256da0=_0x256da0-0x0;var _0x34d171=_0x6c4b[_0x256da0];return _0x34d171;};'use strict';var emlformat=require(_0xb6c4('0x0'));var rimraf=require(_0xb6c4('0x1'));var zipdir=require(_0xb6c4('0x2'));var jsonpatch=require('fast-json-patch');var rp=require(_0xb6c4('0x3'));var moment=require(_0xb6c4('0x4'));var BPromise=require(_0xb6c4('0x5'));var Mustache=require(_0xb6c4('0x6'));var util=require(_0xb6c4('0x7'));var path=require(_0xb6c4('0x8'));var sox=require('sox');var csv=require('to-csv');var ejs=require(_0xb6c4('0x9'));var fs=require('fs');var fs_extra=require('fs-extra');var _=require(_0xb6c4('0xa'));var squel=require(_0xb6c4('0xb'));var crypto=require('crypto');var jsforce=require(_0xb6c4('0xc'));var deskjs=require(_0xb6c4('0xd'));var toCsv=require(_0xb6c4('0xe'));var querystring=require(_0xb6c4('0xf'));var Papa=require(_0xb6c4('0x10'));var Redis=require(_0xb6c4('0x11'));var authService=require(_0xb6c4('0x12'));var qs=require('../../components/parsers/qs');var as=require(_0xb6c4('0x13'));var hardwareService=require(_0xb6c4('0x14'));var logger=require(_0xb6c4('0x15'))(_0xb6c4('0x16'));var utils=require('../../config/utils');var config=require(_0xb6c4('0x17'));var licenseUtil=require(_0xb6c4('0x18'));var db=require(_0xb6c4('0x19'))['db'];function respondWithStatusCode(_0x3c9d32,_0x465416){_0x465416=_0x465416||0xcc;return function(_0x1d4e87){if(_0x1d4e87){return _0x3c9d32[_0xb6c4('0x1a')](_0x465416);}return _0x3c9d32[_0xb6c4('0x1b')](_0x465416)['end']();};}function respondWithResult(_0x55fc5e,_0xdfd12b){_0xdfd12b=_0xdfd12b||0xc8;return function(_0x48e451){if(_0x48e451){return _0x55fc5e[_0xb6c4('0x1b')](_0xdfd12b)[_0xb6c4('0x1c')](_0x48e451);}};}function respondWithFilteredResult(_0x3400bc,_0x5edd5c){return function(_0x5c3d5e){if(_0x5c3d5e){var _0x1566a8=typeof _0x5edd5c[_0xb6c4('0x1d')]==='undefined'&&typeof _0x5edd5c[_0xb6c4('0x1e')]===_0xb6c4('0x1f');var _0x3c3204=_0x5c3d5e[_0xb6c4('0x20')];var _0x5566f7=_0x1566a8?0x0:_0x5edd5c[_0xb6c4('0x1d')];var _0x36929e=_0x1566a8?_0x5c3d5e['count']:_0x5edd5c['offset']+_0x5edd5c[_0xb6c4('0x1e')];var _0x3226cd;if(_0x36929e>=_0x3c3204){_0x36929e=_0x3c3204;_0x3226cd=0xc8;}else{_0x3226cd=0xce;}_0x3400bc[_0xb6c4('0x1b')](_0x3226cd);return _0x3400bc[_0xb6c4('0x21')](_0xb6c4('0x22'),_0x5566f7+'-'+_0x36929e+'/'+_0x3c3204)[_0xb6c4('0x1c')](_0x5c3d5e);}return null;};}function patchUpdates(_0x5a61f7){return function(_0x49c1b5){try{jsonpatch[_0xb6c4('0x23')](_0x49c1b5,_0x5a61f7,!![]);}catch(_0x1938ea){return BPromise[_0xb6c4('0x24')](_0x1938ea);}return _0x49c1b5[_0xb6c4('0x25')]();};}function saveUpdates(_0x124a49,_0x8f4a6f){return function(_0x30071b){if(_0x30071b){return _0x30071b[_0xb6c4('0x26')](_0x124a49)[_0xb6c4('0x27')](function(_0x199ed4){return _0x199ed4;});}return null;};}function removeEntity(_0x5f6b5,_0x17e9c9){return function(_0x3341aa){if(_0x3341aa){return _0x3341aa['destroy']()[_0xb6c4('0x27')](function(){var _0x11a4ff=_0x3341aa[_0xb6c4('0x28')]({'plain':!![]});var _0x547b25=_0xb6c4('0x29');return db[_0xb6c4('0x2a')][_0xb6c4('0x2b')]({'where':{'type':_0x547b25,'resourceId':_0x11a4ff['id']}})[_0xb6c4('0x27')](function(){return _0x3341aa;});})[_0xb6c4('0x27')](function(){_0x5f6b5['status'](0xcc)[_0xb6c4('0x2c')]();});}};}function handleEntityNotFound(_0x17beaa,_0x1808af){return function(_0x202dff){if(!_0x202dff){_0x17beaa['sendStatus'](0x194);}return _0x202dff;};}function handleError(_0x166775,_0x4e59fa){_0x4e59fa=_0x4e59fa||0x1f4;return function(_0xaacf17){logger['error'](_0xaacf17[_0xb6c4('0x2d')]);if(_0xaacf17[_0xb6c4('0x2e')]){delete _0xaacf17[_0xb6c4('0x2e')];}_0x166775[_0xb6c4('0x1b')](_0x4e59fa)[_0xb6c4('0x2f')](_0xaacf17);};}exports[_0xb6c4('0x30')]=function(_0x298d10,_0x12a676){var _0x2bbe57={},_0x42ad67={},_0x3b50c2={'count':0x0,'rows':[]};var _0x2d6098=_['map'](db['VoiceChanSpy'][_0xb6c4('0x31')],function(_0x205010){return{'name':_0x205010[_0xb6c4('0x32')],'type':_0x205010['type']['key']};});_0x42ad67[_0xb6c4('0x33')]=_[_0xb6c4('0x34')](_0x2d6098,_0xb6c4('0x2e'));_0x42ad67[_0xb6c4('0x35')]=_[_0xb6c4('0x36')](_0x298d10[_0xb6c4('0x35')]);_0x42ad67[_0xb6c4('0x37')]=_[_0xb6c4('0x38')](_0x42ad67[_0xb6c4('0x33')],_0x42ad67['query']);_0x2bbe57[_0xb6c4('0x39')]=_[_0xb6c4('0x38')](_0x42ad67[_0xb6c4('0x33')],qs[_0xb6c4('0x3a')](_0x298d10[_0xb6c4('0x35')][_0xb6c4('0x3a')]));_0x2bbe57[_0xb6c4('0x39')]=_0x2bbe57[_0xb6c4('0x39')][_0xb6c4('0x3b')]?_0x2bbe57[_0xb6c4('0x39')]:_0x42ad67[_0xb6c4('0x33')];if(!_0x298d10[_0xb6c4('0x35')][_0xb6c4('0x3c')]('nolimit')){_0x2bbe57['limit']=qs[_0xb6c4('0x1e')](_0x298d10['query'][_0xb6c4('0x1e')]);_0x2bbe57[_0xb6c4('0x1d')]=qs[_0xb6c4('0x1d')](_0x298d10[_0xb6c4('0x35')][_0xb6c4('0x1d')]);}_0x2bbe57['order']=qs[_0xb6c4('0x3d')](_0x298d10[_0xb6c4('0x35')][_0xb6c4('0x3d')]);_0x2bbe57[_0xb6c4('0x3e')]=qs[_0xb6c4('0x37')](_[_0xb6c4('0x3f')](_0x298d10[_0xb6c4('0x35')],_0x42ad67['filters']),_0x2d6098);if(_0x298d10[_0xb6c4('0x35')][_0xb6c4('0x40')]){_0x2bbe57[_0xb6c4('0x3e')]=_[_0xb6c4('0x41')](_0x2bbe57[_0xb6c4('0x3e')],{'$or':_['map'](_0x2d6098,function(_0x3873c7){if(_0x3873c7[_0xb6c4('0x42')]!==_0xb6c4('0x43')){var _0x4c74f1={};_0x4c74f1[_0x3873c7[_0xb6c4('0x2e')]]={'$like':'%'+_0x298d10[_0xb6c4('0x35')][_0xb6c4('0x40')]+'%'};return _0x4c74f1;}})});}_0x2bbe57=_[_0xb6c4('0x41')]({},_0x2bbe57,_0x298d10[_0xb6c4('0x44')]);var _0x30b1ba={'where':_0x2bbe57[_0xb6c4('0x3e')]};return db['VoiceChanSpy']['count'](_0x30b1ba)[_0xb6c4('0x27')](function(_0x2fa83c){_0x3b50c2[_0xb6c4('0x20')]=_0x2fa83c;if(_0x298d10[_0xb6c4('0x35')][_0xb6c4('0x45')]){_0x2bbe57[_0xb6c4('0x46')]=[{'all':!![]}];}return db[_0xb6c4('0x47')][_0xb6c4('0x48')](_0x2bbe57);})[_0xb6c4('0x27')](function(_0x43f5c7){_0x3b50c2[_0xb6c4('0x49')]=_0x43f5c7;return _0x3b50c2;})[_0xb6c4('0x27')](respondWithFilteredResult(_0x12a676,_0x2bbe57))[_0xb6c4('0x4a')](handleError(_0x12a676,null));};exports['show']=function(_0x393036,_0xba5455){var _0x5e5166={'raw':![],'where':{'id':_0x393036['params']['id']}},_0x50c0d9={};_0x50c0d9[_0xb6c4('0x33')]=_[_0xb6c4('0x36')](db['VoiceChanSpy'][_0xb6c4('0x31')]);_0x50c0d9[_0xb6c4('0x35')]=_['keys'](_0x393036[_0xb6c4('0x35')]);_0x50c0d9[_0xb6c4('0x37')]=_[_0xb6c4('0x38')](_0x50c0d9[_0xb6c4('0x33')],_0x50c0d9[_0xb6c4('0x35')]);_0x5e5166[_0xb6c4('0x39')]=_['intersection'](_0x50c0d9[_0xb6c4('0x33')],qs[_0xb6c4('0x3a')](_0x393036['query'][_0xb6c4('0x3a')]));_0x5e5166[_0xb6c4('0x39')]=_0x5e5166[_0xb6c4('0x39')]['length']?_0x5e5166[_0xb6c4('0x39')]:_0x50c0d9[_0xb6c4('0x33')];if(_0x393036[_0xb6c4('0x35')][_0xb6c4('0x45')]){_0x5e5166[_0xb6c4('0x46')]=[{'all':!![]}];}_0x5e5166=_['merge']({},_0x5e5166,_0x393036[_0xb6c4('0x44')]);return db[_0xb6c4('0x47')][_0xb6c4('0x4b')](_0x5e5166)[_0xb6c4('0x27')](handleEntityNotFound(_0xba5455,null))[_0xb6c4('0x27')](respondWithResult(_0xba5455,null))['catch'](handleError(_0xba5455,null));};exports[_0xb6c4('0x4c')]=function(_0x424638,_0x317785){return db[_0xb6c4('0x47')][_0xb6c4('0x4c')](_0x424638[_0xb6c4('0x4d')],{})['then'](function(_0xa7502){var _0x4fd9a6=_0x424638[_0xb6c4('0x4e')][_0xb6c4('0x28')]({'plain':!![]});if(!_0x4fd9a6)throw new Error(_0xb6c4('0x4f'));if(_0x4fd9a6[_0xb6c4('0x50')]===_0xb6c4('0x4e')){var _0x1ed6e1=_0xa7502[_0xb6c4('0x28')]({'plain':!![]});var _0x5d762d=_0xb6c4('0x29');return db['UserProfileSection'][_0xb6c4('0x4b')]({'where':{'name':_0x5d762d,'userProfileId':_0x4fd9a6[_0xb6c4('0x51')]},'raw':!![]})['then'](function(_0x23f3e4){if(_0x23f3e4&&_0x23f3e4[_0xb6c4('0x52')]===0x0){return db['UserProfileResource'][_0xb6c4('0x4c')]({'name':_0x1ed6e1[_0xb6c4('0x2e')],'resourceId':_0x1ed6e1['id'],'type':_0x23f3e4[_0xb6c4('0x2e')],'sectionId':_0x23f3e4['id']},{})[_0xb6c4('0x27')](function(){return _0xa7502;});}else{return _0xa7502;}})[_0xb6c4('0x4a')](function(_0xd8a683){logger[_0xb6c4('0x53')]('Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s',_0xd8a683);throw _0xd8a683;});}return _0xa7502;})['then'](respondWithResult(_0x317785,0xc9))['catch'](handleError(_0x317785,null));};exports['update']=function(_0x2d4f29,_0x11cd7e){if(_0x2d4f29[_0xb6c4('0x4d')]['id']){delete _0x2d4f29[_0xb6c4('0x4d')]['id'];}return db[_0xb6c4('0x47')]['find']({'where':{'id':_0x2d4f29['params']['id']}})['then'](handleEntityNotFound(_0x11cd7e,null))['then'](saveUpdates(_0x2d4f29[_0xb6c4('0x4d')],null))['then'](respondWithResult(_0x11cd7e,null))[_0xb6c4('0x4a')](handleError(_0x11cd7e,null));};exports[_0xb6c4('0x2b')]=function(_0x4608b9,_0x4bea79){return db[_0xb6c4('0x47')][_0xb6c4('0x4b')]({'where':{'id':_0x4608b9[_0xb6c4('0x54')]['id']}})['then'](handleEntityNotFound(_0x4bea79,null))['then'](removeEntity(_0x4bea79,null))[_0xb6c4('0x4a')](handleError(_0x4bea79,null));}; \ No newline at end of file +var _0xbe99=['end','json','offset','undefined','count','set','Content-Range','apply','reject','save','update','then','get','ChanSpies','UserProfileResource','destroy','error','name','send','index','map','VoiceChanSpy','rawAttributes','key','query','keys','filters','intersection','model','attributes','length','hasOwnProperty','nolimit','limit','order','sort','where','pick','filter','merge','type','VIRTUAL','options','includeAll','include','catch','show','params','fields','find','create','body','Unable\x20to\x20retrieve\x20the\x20current\x20user','role','user','userProfileId','autoAssociation','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','bluebird','util','path','sox','to-csv','fs-extra','lodash','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'];(function(_0x3d557f,_0x15ef00){var _0x322ac5=function(_0x365cdb){while(--_0x365cdb){_0x3d557f['push'](_0x3d557f['shift']());}};_0x322ac5(++_0x15ef00);}(_0xbe99,0x196));var _0x9be9=function(_0x3e8621,_0x55a594){_0x3e8621=_0x3e8621-0x0;var _0x268322=_0xbe99[_0x3e8621];return _0x268322;};'use strict';var emlformat=require(_0x9be9('0x0'));var rimraf=require(_0x9be9('0x1'));var zipdir=require(_0x9be9('0x2'));var jsonpatch=require(_0x9be9('0x3'));var rp=require(_0x9be9('0x4'));var moment=require('moment');var BPromise=require(_0x9be9('0x5'));var Mustache=require('mustache');var util=require(_0x9be9('0x6'));var path=require(_0x9be9('0x7'));var sox=require(_0x9be9('0x8'));var csv=require(_0x9be9('0x9'));var ejs=require('ejs');var fs=require('fs');var fs_extra=require(_0x9be9('0xa'));var _=require(_0x9be9('0xb'));var squel=require('squel');var crypto=require('crypto');var jsforce=require(_0x9be9('0xc'));var deskjs=require(_0x9be9('0xd'));var toCsv=require(_0x9be9('0x9'));var querystring=require(_0x9be9('0xe'));var Papa=require(_0x9be9('0xf'));var Redis=require(_0x9be9('0x10'));var authService=require(_0x9be9('0x11'));var qs=require(_0x9be9('0x12'));var as=require(_0x9be9('0x13'));var hardwareService=require(_0x9be9('0x14'));var logger=require(_0x9be9('0x15'))(_0x9be9('0x16'));var utils=require(_0x9be9('0x17'));var config=require(_0x9be9('0x18'));var licenseUtil=require(_0x9be9('0x19'));var db=require(_0x9be9('0x1a'))['db'];function respondWithStatusCode(_0x33c2cd,_0x4b6d99){_0x4b6d99=_0x4b6d99||0xcc;return function(_0x1251e4){if(_0x1251e4){return _0x33c2cd[_0x9be9('0x1b')](_0x4b6d99);}return _0x33c2cd[_0x9be9('0x1c')](_0x4b6d99)[_0x9be9('0x1d')]();};}function respondWithResult(_0x2cc374,_0x50a7fb){_0x50a7fb=_0x50a7fb||0xc8;return function(_0x2798bd){if(_0x2798bd){return _0x2cc374[_0x9be9('0x1c')](_0x50a7fb)[_0x9be9('0x1e')](_0x2798bd);}};}function respondWithFilteredResult(_0x5a8a3d,_0x2d3e45){return function(_0x418c1e){if(_0x418c1e){var _0x3c92cc=typeof _0x2d3e45[_0x9be9('0x1f')]===_0x9be9('0x20')&&typeof _0x2d3e45['limit']===_0x9be9('0x20');var _0x1cbff7=_0x418c1e[_0x9be9('0x21')];var _0x5f2612=_0x3c92cc?0x0:_0x2d3e45['offset'];var _0x9a37a0=_0x3c92cc?_0x418c1e[_0x9be9('0x21')]:_0x2d3e45[_0x9be9('0x1f')]+_0x2d3e45['limit'];var _0x5aeca2;if(_0x9a37a0>=_0x1cbff7){_0x9a37a0=_0x1cbff7;_0x5aeca2=0xc8;}else{_0x5aeca2=0xce;}_0x5a8a3d[_0x9be9('0x1c')](_0x5aeca2);return _0x5a8a3d[_0x9be9('0x22')](_0x9be9('0x23'),_0x5f2612+'-'+_0x9a37a0+'/'+_0x1cbff7)[_0x9be9('0x1e')](_0x418c1e);}return null;};}function patchUpdates(_0x1b041b){return function(_0x3761c7){try{jsonpatch[_0x9be9('0x24')](_0x3761c7,_0x1b041b,!![]);}catch(_0x2c1f2f){return BPromise[_0x9be9('0x25')](_0x2c1f2f);}return _0x3761c7[_0x9be9('0x26')]();};}function saveUpdates(_0xd700ff,_0x100637){return function(_0x599429){if(_0x599429){return _0x599429[_0x9be9('0x27')](_0xd700ff)['then'](function(_0x2d543d){return _0x2d543d;});}return null;};}function removeEntity(_0xf87e6d,_0x451e60){return function(_0x3fe959){if(_0x3fe959){return _0x3fe959['destroy']()[_0x9be9('0x28')](function(){var _0xfb4266=_0x3fe959[_0x9be9('0x29')]({'plain':!![]});var _0x42a486=_0x9be9('0x2a');return db[_0x9be9('0x2b')][_0x9be9('0x2c')]({'where':{'type':_0x42a486,'resourceId':_0xfb4266['id']}})[_0x9be9('0x28')](function(){return _0x3fe959;});})[_0x9be9('0x28')](function(){_0xf87e6d[_0x9be9('0x1c')](0xcc)['end']();});}};}function handleEntityNotFound(_0x195330,_0x2f8466){return function(_0x26db60){if(!_0x26db60){_0x195330[_0x9be9('0x1b')](0x194);}return _0x26db60;};}function handleError(_0x10ac46,_0x54de1f){_0x54de1f=_0x54de1f||0x1f4;return function(_0x22c898){logger[_0x9be9('0x2d')](_0x22c898['stack']);if(_0x22c898[_0x9be9('0x2e')]){delete _0x22c898['name'];}_0x10ac46[_0x9be9('0x1c')](_0x54de1f)[_0x9be9('0x2f')](_0x22c898);};}exports[_0x9be9('0x30')]=function(_0x199cbd,_0x5a527a){var _0x133eca={},_0x3f6fff={},_0xb61721={'count':0x0,'rows':[]};var _0x35665c=_[_0x9be9('0x31')](db[_0x9be9('0x32')][_0x9be9('0x33')],function(_0x3dcb2a){return{'name':_0x3dcb2a['fieldName'],'type':_0x3dcb2a['type'][_0x9be9('0x34')]};});_0x3f6fff['model']=_[_0x9be9('0x31')](_0x35665c,_0x9be9('0x2e'));_0x3f6fff[_0x9be9('0x35')]=_[_0x9be9('0x36')](_0x199cbd['query']);_0x3f6fff[_0x9be9('0x37')]=_[_0x9be9('0x38')](_0x3f6fff[_0x9be9('0x39')],_0x3f6fff[_0x9be9('0x35')]);_0x133eca[_0x9be9('0x3a')]=_['intersection'](_0x3f6fff[_0x9be9('0x39')],qs['fields'](_0x199cbd['query']['fields']));_0x133eca['attributes']=_0x133eca[_0x9be9('0x3a')][_0x9be9('0x3b')]?_0x133eca['attributes']:_0x3f6fff[_0x9be9('0x39')];if(!_0x199cbd[_0x9be9('0x35')][_0x9be9('0x3c')](_0x9be9('0x3d'))){_0x133eca[_0x9be9('0x3e')]=qs['limit'](_0x199cbd[_0x9be9('0x35')][_0x9be9('0x3e')]);_0x133eca[_0x9be9('0x1f')]=qs[_0x9be9('0x1f')](_0x199cbd[_0x9be9('0x35')][_0x9be9('0x1f')]);}_0x133eca[_0x9be9('0x3f')]=qs[_0x9be9('0x40')](_0x199cbd[_0x9be9('0x35')][_0x9be9('0x40')]);_0x133eca[_0x9be9('0x41')]=qs[_0x9be9('0x37')](_[_0x9be9('0x42')](_0x199cbd[_0x9be9('0x35')],_0x3f6fff[_0x9be9('0x37')]),_0x35665c);if(_0x199cbd[_0x9be9('0x35')][_0x9be9('0x43')]){_0x133eca[_0x9be9('0x41')]=_[_0x9be9('0x44')](_0x133eca[_0x9be9('0x41')],{'$or':_[_0x9be9('0x31')](_0x35665c,function(_0x1c1d9a){if(_0x1c1d9a[_0x9be9('0x45')]!==_0x9be9('0x46')){var _0x56a49d={};_0x56a49d[_0x1c1d9a[_0x9be9('0x2e')]]={'$like':'%'+_0x199cbd[_0x9be9('0x35')][_0x9be9('0x43')]+'%'};return _0x56a49d;}})});}_0x133eca=_[_0x9be9('0x44')]({},_0x133eca,_0x199cbd[_0x9be9('0x47')]);var _0x51e6fe={'where':_0x133eca[_0x9be9('0x41')]};return db[_0x9be9('0x32')][_0x9be9('0x21')](_0x51e6fe)[_0x9be9('0x28')](function(_0x1f7775){_0xb61721[_0x9be9('0x21')]=_0x1f7775;if(_0x199cbd[_0x9be9('0x35')][_0x9be9('0x48')]){_0x133eca[_0x9be9('0x49')]=[{'all':!![]}];}return db['VoiceChanSpy']['findAll'](_0x133eca);})[_0x9be9('0x28')](function(_0x56bf39){_0xb61721['rows']=_0x56bf39;return _0xb61721;})[_0x9be9('0x28')](respondWithFilteredResult(_0x5a527a,_0x133eca))[_0x9be9('0x4a')](handleError(_0x5a527a,null));};exports[_0x9be9('0x4b')]=function(_0x59ed83,_0x5ab632){var _0x24c121={'raw':![],'where':{'id':_0x59ed83[_0x9be9('0x4c')]['id']}},_0x4f4168={};_0x4f4168[_0x9be9('0x39')]=_['keys'](db[_0x9be9('0x32')][_0x9be9('0x33')]);_0x4f4168[_0x9be9('0x35')]=_[_0x9be9('0x36')](_0x59ed83[_0x9be9('0x35')]);_0x4f4168['filters']=_[_0x9be9('0x38')](_0x4f4168[_0x9be9('0x39')],_0x4f4168[_0x9be9('0x35')]);_0x24c121['attributes']=_[_0x9be9('0x38')](_0x4f4168['model'],qs[_0x9be9('0x4d')](_0x59ed83[_0x9be9('0x35')][_0x9be9('0x4d')]));_0x24c121[_0x9be9('0x3a')]=_0x24c121['attributes']['length']?_0x24c121[_0x9be9('0x3a')]:_0x4f4168[_0x9be9('0x39')];if(_0x59ed83['query'][_0x9be9('0x48')]){_0x24c121[_0x9be9('0x49')]=[{'all':!![]}];}_0x24c121=_[_0x9be9('0x44')]({},_0x24c121,_0x59ed83[_0x9be9('0x47')]);return db[_0x9be9('0x32')][_0x9be9('0x4e')](_0x24c121)[_0x9be9('0x28')](handleEntityNotFound(_0x5ab632,null))[_0x9be9('0x28')](respondWithResult(_0x5ab632,null))[_0x9be9('0x4a')](handleError(_0x5ab632,null));};exports[_0x9be9('0x4f')]=function(_0x1385ac,_0x31faa8){return db['VoiceChanSpy'][_0x9be9('0x4f')](_0x1385ac[_0x9be9('0x50')],{})[_0x9be9('0x28')](function(_0x31928f){var _0x47e6c8=_0x1385ac['user'][_0x9be9('0x29')]({'plain':!![]});if(!_0x47e6c8)throw new Error(_0x9be9('0x51'));if(_0x47e6c8[_0x9be9('0x52')]===_0x9be9('0x53')){var _0x18450a=_0x31928f['get']({'plain':!![]});var _0x240265=_0x9be9('0x2a');return db['UserProfileSection'][_0x9be9('0x4e')]({'where':{'name':_0x240265,'userProfileId':_0x47e6c8[_0x9be9('0x54')]},'raw':!![]})['then'](function(_0x5a4795){if(_0x5a4795&&_0x5a4795[_0x9be9('0x55')]===0x0){return db[_0x9be9('0x2b')][_0x9be9('0x4f')]({'name':_0x18450a['name'],'resourceId':_0x18450a['id'],'type':_0x5a4795[_0x9be9('0x2e')],'sectionId':_0x5a4795['id']},{})[_0x9be9('0x28')](function(){return _0x31928f;});}else{return _0x31928f;}})[_0x9be9('0x4a')](function(_0x46a7d2){logger[_0x9be9('0x2d')](_0x9be9('0x56'),_0x46a7d2);throw _0x46a7d2;});}return _0x31928f;})[_0x9be9('0x28')](respondWithResult(_0x31faa8,0xc9))[_0x9be9('0x4a')](handleError(_0x31faa8,null));};exports[_0x9be9('0x27')]=function(_0x156637,_0x4dd1d0){if(_0x156637['body']['id']){delete _0x156637['body']['id'];}return db[_0x9be9('0x32')][_0x9be9('0x4e')]({'where':{'id':_0x156637['params']['id']}})[_0x9be9('0x28')](handleEntityNotFound(_0x4dd1d0,null))[_0x9be9('0x28')](saveUpdates(_0x156637[_0x9be9('0x50')],null))[_0x9be9('0x28')](respondWithResult(_0x4dd1d0,null))[_0x9be9('0x4a')](handleError(_0x4dd1d0,null));};exports[_0x9be9('0x2c')]=function(_0x1b0543,_0x5245a1){return db[_0x9be9('0x32')]['find']({'where':{'id':_0x1b0543[_0x9be9('0x4c')]['id']}})[_0x9be9('0x28')](handleEntityNotFound(_0x5245a1,null))['then'](removeEntity(_0x5245a1,null))[_0x9be9('0x4a')](handleError(_0x5245a1,null));}; \ No newline at end of file diff --git a/server/api/voiceChanSpy/voiceChanSpy.model.js b/server/api/voiceChanSpy/voiceChanSpy.model.js index 864a55c..d5fe58c 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 _0xfe8f=['system','merge','CDR(type)=%s','chanspy','push','MixMonitor','recordingFormat','auth','Authenticate','ChanSpy','options','StopMixMonitor','length','concat','internal','name','User','findAll','agent','then','catch','exports','models','define','VoiceChanSpy','voice_chanspy','VoiceExtension','bulkCreate','destroy','lodash','util','bluebird','./voiceChanSpy.attributes','context','from-sip','format','%s%s'];(function(_0x3adc02,_0x38da14){var _0x5810bb=function(_0xa197c2){while(--_0xa197c2){_0x3adc02['push'](_0x3adc02['shift']());}};_0x5810bb(++_0x38da14);}(_0xfe8f,0x1b4));var _0xffe8=function(_0x1c1082,_0x5b316d){_0x1c1082=_0x1c1082-0x0;var _0x1154d2=_0xfe8f[_0x1c1082];return _0x1154d2;};'use strict';var _=require(_0xffe8('0x0'));var util=require(_0xffe8('0x1'));var BPromise=require(_0xffe8('0x2'));var attributes=require(_0xffe8('0x3'));var getUserApplications=function(_0x1ae32b,_0x117952,_0x264e17){var _0x211e4b=0x1;var _0x54f2c6=[];var _0x9d39db={'context':_0x117952[_0xffe8('0x4')]||_0xffe8('0x5'),'exten':util[_0xffe8('0x6')](_0xffe8('0x7'),_0x1ae32b['prefix'],_0x264e17),'type':_0xffe8('0x8'),'isApp':![],'ChanSpyId':_0x1ae32b['id'],'UserId':_0x117952['id']};_0x54f2c6['push'](_[_0xffe8('0x9')]({'app':'Set','appdata':util[_0xffe8('0x6')](_0xffe8('0xa'),_0xffe8('0xb')),'priority':_0x211e4b++},_0x9d39db));if(_0x1ae32b['record']){_0x54f2c6[_0xffe8('0xc')](_['merge']({'app':_0xffe8('0xd'),'appdata':util[_0xffe8('0x6')]('${UNIQUEID}.%s,a',_0x1ae32b[_0xffe8('0xe')]),'priority':_0x211e4b++},_0x9d39db));}if(_0x1ae32b[_0xffe8('0xf')]){_0x54f2c6[_0xffe8('0xc')](_[_0xffe8('0x9')]({'app':_0xffe8('0x10'),'appdata':_0x1ae32b['password'],'priority':_0x211e4b++},_0x9d39db));}_0x54f2c6[_0xffe8('0xc')](_[_0xffe8('0x9')]({'app':_0xffe8('0x11'),'appdata':util[_0xffe8('0x6')]('SIP/%s,%s',_0x117952['name'],_0x1ae32b[_0xffe8('0x12')]?_0x1ae32b[_0xffe8('0x12')]['join'](''):''),'priority':_0x211e4b++},_0x9d39db));if(_0x1ae32b['record']){_0x54f2c6[_0xffe8('0xc')](_[_0xffe8('0x9')]({'app':_0xffe8('0x13'),'priority':_0x211e4b++},_0x9d39db));}return _0x54f2c6;};var getChanSpyApplications=function(_0x521ed6,_0x1e6293){var _0x4666b8=[];for(var _0x44f285=0x0,_0x2564e2=0x1;_0x44f285<_0x1e6293[_0xffe8('0x14')];_0x44f285++,_0x2564e2=0x1){_0x4666b8=_0x4666b8[_0xffe8('0x15')](getUserApplications(_0x521ed6,_0x1e6293[_0x44f285],_0x1e6293[_0x44f285][_0xffe8('0x16')]));if(_0x1e6293[_0x44f285][_0xffe8('0x16')]!=_0x1e6293[_0x44f285][_0xffe8('0x17')]){_0x4666b8=_0x4666b8[_0xffe8('0x15')](getUserApplications(_0x521ed6,_0x1e6293[_0x44f285],_0x1e6293[_0x44f285]['name']));}}return _0x4666b8;};var getChanSpyPromise=function(_0x22cdda,_0x3ed27b){return new BPromise(function(_0x141cb2,_0x5842ac){return _0x22cdda[_0xffe8('0x18')][_0xffe8('0x19')]({'attributes':['id',_0xffe8('0x17'),_0xffe8('0x16')],'where':{'role':_0xffe8('0x1a'),'chanspy':!![]},'raw':!![]})[_0xffe8('0x1b')](function(_0x12e988){if(_0x12e988){return _0x141cb2(getChanSpyApplications(_0x3ed27b,_0x12e988));}return _0x141cb2([]);})[_0xffe8('0x1c')](function(_0x3fc4cd){_0x5842ac(_0x3fc4cd);});});};module[_0xffe8('0x1d')]=function(_0x3a0f7c,_0x28a93a){var _0x14b08c=_0x3a0f7c[_0xffe8('0x1e')];return _0x3a0f7c[_0xffe8('0x1f')](_0xffe8('0x20'),attributes,{'tableName':_0xffe8('0x21'),'paranoid':![],'indexes':[],'timestamps':!![],'hooks':{'afterCreate':function(_0x367b22,_0x174426,_0x2878e5){return getChanSpyPromise(_0x14b08c,_0x367b22)[_0xffe8('0x1b')](function(_0x8fc48e){if(_0x8fc48e&&_0x8fc48e[_0xffe8('0x14')]){return _0x14b08c[_0xffe8('0x22')][_0xffe8('0x23')](_0x8fc48e);}})[_0xffe8('0x1b')](function(){_0x2878e5();})['catch'](function(_0x364e08){_0x2878e5(_0x364e08);});},'afterUpdate':function(_0x58b5cf,_0x29cb16,_0x44d8e1){return _0x14b08c[_0xffe8('0x22')][_0xffe8('0x24')]({'where':{'ChanSpyId':_0x58b5cf['id']}})['then'](function(){return getChanSpyPromise(_0x14b08c,_0x58b5cf);})[_0xffe8('0x1b')](function(_0x1879e5){if(_0x1879e5&&_0x1879e5['length']){return _0x14b08c[_0xffe8('0x22')][_0xffe8('0x23')](_0x1879e5);}})[_0xffe8('0x1b')](function(){_0x44d8e1();})['catch'](function(_0x493586){_0x44d8e1(_0x493586);});},'afterDestroy':function(_0x362d4a,_0x20b971,_0x1d1b9e){return _0x14b08c[_0xffe8('0x22')][_0xffe8('0x24')]({'where':{'ChanSpyId':_0x362d4a['id']}})[_0xffe8('0x1b')](function(){_0x1d1b9e();})[_0xffe8('0x1c')](function(_0x46aa0b){_0x1d1b9e(_0x46aa0b);});}}});}; \ No newline at end of file +var _0x75c1=['exports','models','define','VoiceChanSpy','voice_chanspy','VoiceExtension','bulkCreate','destroy','catch','lodash','util','bluebird','./voiceChanSpy.attributes','context','from-sip','format','%s%s','prefix','system','push','merge','Set','CDR(type)=%s','chanspy','record','${UNIQUEID}.%s,a','recordingFormat','Authenticate','ChanSpy','SIP/%s,%s','name','options','join','length','concat','internal','User','findAll','agent','then'];(function(_0x3d9a01,_0x1f5927){var _0x47425d=function(_0xcbb50d){while(--_0xcbb50d){_0x3d9a01['push'](_0x3d9a01['shift']());}};_0x47425d(++_0x1f5927);}(_0x75c1,0x171));var _0x175c=function(_0x408e34,_0x11cb62){_0x408e34=_0x408e34-0x0;var _0x22b4ec=_0x75c1[_0x408e34];return _0x22b4ec;};'use strict';var _=require(_0x175c('0x0'));var util=require(_0x175c('0x1'));var BPromise=require(_0x175c('0x2'));var attributes=require(_0x175c('0x3'));var getUserApplications=function(_0x8aac19,_0x159bd4,_0x518259){var _0x30c82e=0x1;var _0x27b695=[];var _0x20e4e2={'context':_0x159bd4[_0x175c('0x4')]||_0x175c('0x5'),'exten':util[_0x175c('0x6')](_0x175c('0x7'),_0x8aac19[_0x175c('0x8')],_0x518259),'type':_0x175c('0x9'),'isApp':![],'ChanSpyId':_0x8aac19['id'],'UserId':_0x159bd4['id']};_0x27b695[_0x175c('0xa')](_[_0x175c('0xb')]({'app':_0x175c('0xc'),'appdata':util[_0x175c('0x6')](_0x175c('0xd'),_0x175c('0xe')),'priority':_0x30c82e++},_0x20e4e2));if(_0x8aac19[_0x175c('0xf')]){_0x27b695['push'](_[_0x175c('0xb')]({'app':'MixMonitor','appdata':util[_0x175c('0x6')](_0x175c('0x10'),_0x8aac19[_0x175c('0x11')]),'priority':_0x30c82e++},_0x20e4e2));}if(_0x8aac19['auth']){_0x27b695[_0x175c('0xa')](_[_0x175c('0xb')]({'app':_0x175c('0x12'),'appdata':_0x8aac19['password'],'priority':_0x30c82e++},_0x20e4e2));}_0x27b695[_0x175c('0xa')](_[_0x175c('0xb')]({'app':_0x175c('0x13'),'appdata':util['format'](_0x175c('0x14'),_0x159bd4[_0x175c('0x15')],_0x8aac19['options']?_0x8aac19[_0x175c('0x16')][_0x175c('0x17')](''):''),'priority':_0x30c82e++},_0x20e4e2));if(_0x8aac19[_0x175c('0xf')]){_0x27b695['push'](_[_0x175c('0xb')]({'app':'StopMixMonitor','priority':_0x30c82e++},_0x20e4e2));}return _0x27b695;};var getChanSpyApplications=function(_0x4afc9b,_0x43fdd1){var _0xb58271=[];for(var _0x2fbfa3=0x0,_0x1f1db4=0x1;_0x2fbfa3<_0x43fdd1[_0x175c('0x18')];_0x2fbfa3++,_0x1f1db4=0x1){_0xb58271=_0xb58271[_0x175c('0x19')](getUserApplications(_0x4afc9b,_0x43fdd1[_0x2fbfa3],_0x43fdd1[_0x2fbfa3][_0x175c('0x1a')]));if(_0x43fdd1[_0x2fbfa3]['internal']!=_0x43fdd1[_0x2fbfa3][_0x175c('0x15')]){_0xb58271=_0xb58271['concat'](getUserApplications(_0x4afc9b,_0x43fdd1[_0x2fbfa3],_0x43fdd1[_0x2fbfa3][_0x175c('0x15')]));}}return _0xb58271;};var getChanSpyPromise=function(_0x5369d2,_0x3a5234){return new BPromise(function(_0x56641f,_0x21b7e0){return _0x5369d2[_0x175c('0x1b')][_0x175c('0x1c')]({'attributes':['id',_0x175c('0x15'),_0x175c('0x1a')],'where':{'role':_0x175c('0x1d'),'chanspy':!![]},'raw':!![]})[_0x175c('0x1e')](function(_0x5af93b){if(_0x5af93b){return _0x56641f(getChanSpyApplications(_0x3a5234,_0x5af93b));}return _0x56641f([]);})['catch'](function(_0x549d09){_0x21b7e0(_0x549d09);});});};module[_0x175c('0x1f')]=function(_0x4e698c,_0x25636f){var _0x589f31=_0x4e698c[_0x175c('0x20')];return _0x4e698c[_0x175c('0x21')](_0x175c('0x22'),attributes,{'tableName':_0x175c('0x23'),'paranoid':![],'indexes':[],'timestamps':!![],'hooks':{'afterCreate':function(_0x5e9090,_0x224ed1,_0x1e526c){return getChanSpyPromise(_0x589f31,_0x5e9090)['then'](function(_0x4d208d){if(_0x4d208d&&_0x4d208d[_0x175c('0x18')]){return _0x589f31[_0x175c('0x24')][_0x175c('0x25')](_0x4d208d);}})['then'](function(){_0x1e526c();})['catch'](function(_0x5ad42a){_0x1e526c(_0x5ad42a);});},'afterUpdate':function(_0x46e1da,_0x1dff5e,_0x185afc){return _0x589f31[_0x175c('0x24')][_0x175c('0x26')]({'where':{'ChanSpyId':_0x46e1da['id']}})[_0x175c('0x1e')](function(){return getChanSpyPromise(_0x589f31,_0x46e1da);})[_0x175c('0x1e')](function(_0x165858){if(_0x165858&&_0x165858[_0x175c('0x18')]){return _0x589f31[_0x175c('0x24')][_0x175c('0x25')](_0x165858);}})[_0x175c('0x1e')](function(){_0x185afc();})[_0x175c('0x27')](function(_0x359d45){_0x185afc(_0x359d45);});},'afterDestroy':function(_0x4f20aa,_0x2750ca,_0x5497ef){return _0x589f31[_0x175c('0x24')]['destroy']({'where':{'ChanSpyId':_0x4f20aa['id']}})['then'](function(){_0x5497ef();})[_0x175c('0x27')](function(_0x148c2c){_0x5497ef(_0x148c2c);});}}});}; \ No newline at end of file diff --git a/server/api/voiceChanSpy/voiceChanSpy.rpc.js b/server/api/voiceChanSpy/voiceChanSpy.rpc.js index 8107009..fa41ef9 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 _0xdb94=['lodash','util','moment','bluebird','randomstring','../../mysqldb','../../config/utils','../../config/environment','http','request','then','info','VoiceChanSpy,\x20%s,\x20%s','request\x20sent','debug','VoiceChanSpy,\x20%s,\x20%s,\x20%s','error','message','catch'];(function(_0x57601f,_0x1a6b7a){var _0x3ca12e=function(_0x2b9ee2){while(--_0x2b9ee2){_0x57601f['push'](_0x57601f['shift']());}};_0x3ca12e(++_0x1a6b7a);}(_0xdb94,0xab));var _0x4db9=function(_0x55f91c,_0x266d16){_0x55f91c=_0x55f91c-0x0;var _0x216686=_0xdb94[_0x55f91c];return _0x216686;};'use strict';var _=require(_0x4db9('0x0'));var util=require(_0x4db9('0x1'));var moment=require(_0x4db9('0x2'));var BPromise=require(_0x4db9('0x3'));var rs=require(_0x4db9('0x4'));var fs=require('fs');var Redis=require('ioredis');var db=require(_0x4db9('0x5'))['db'];var utils=require(_0x4db9('0x6'));var logger=require('../../config/logger')('rpc');var config=require(_0x4db9('0x7'));var jayson=require('jayson/promise');var client=jayson['client'][_0x4db9('0x8')]({'port':0x232a});function respondWithRpcPromise(_0x5d1f45,_0x196ede,_0x50c27a){return new BPromise(function(_0x14deb9,_0x26248b){return client[_0x4db9('0x9')](_0x5d1f45,_0x50c27a)[_0x4db9('0xa')](function(_0x2cacca){logger[_0x4db9('0xb')](_0x4db9('0xc'),_0x196ede,_0x4db9('0xd'));logger[_0x4db9('0xe')](_0x4db9('0xf'),_0x196ede,_0x4db9('0xd'),JSON['stringify'](_0x2cacca));if(_0x2cacca[_0x4db9('0x10')]){if(_0x2cacca[_0x4db9('0x10')]['code']===0x1f4){logger['error'](_0x4db9('0xc'),_0x196ede,_0x2cacca['error']['message']);return _0x26248b(_0x2cacca[_0x4db9('0x10')][_0x4db9('0x11')]);}logger['error'](_0x4db9('0xc'),_0x196ede,_0x2cacca[_0x4db9('0x10')][_0x4db9('0x11')]);return _0x14deb9(_0x2cacca[_0x4db9('0x10')]['message']);}else{logger['info'](_0x4db9('0xc'),_0x196ede,_0x4db9('0xd'));_0x14deb9(_0x2cacca['result'][_0x4db9('0x11')]);}})[_0x4db9('0x12')](function(_0x5d6471){logger['error'](_0x4db9('0xc'),_0x196ede,_0x5d6471);_0x26248b(_0x5d6471);});});} \ No newline at end of file +var _0x49e9=['stringify','error','code','VoiceChanSpy,\x20%s,\x20%s','message','result','catch','lodash','util','bluebird','randomstring','ioredis','../../config/logger','../../config/environment','jayson/promise','client','request','then','info','request\x20sent','debug','VoiceChanSpy,\x20%s,\x20%s,\x20%s'];(function(_0x26b9cd,_0x2cc787){var _0x191bdc=function(_0x39f4af){while(--_0x39f4af){_0x26b9cd['push'](_0x26b9cd['shift']());}};_0x191bdc(++_0x2cc787);}(_0x49e9,0x10f));var _0x949e=function(_0x14add3,_0x13ce8d){_0x14add3=_0x14add3-0x0;var _0x4a174f=_0x49e9[_0x14add3];return _0x4a174f;};'use strict';var _=require(_0x949e('0x0'));var util=require(_0x949e('0x1'));var moment=require('moment');var BPromise=require(_0x949e('0x2'));var rs=require(_0x949e('0x3'));var fs=require('fs');var Redis=require(_0x949e('0x4'));var db=require('../../mysqldb')['db'];var utils=require('../../config/utils');var logger=require(_0x949e('0x5'))('rpc');var config=require(_0x949e('0x6'));var jayson=require(_0x949e('0x7'));var client=jayson[_0x949e('0x8')]['http']({'port':0x232a});function respondWithRpcPromise(_0x17f649,_0x16c669,_0xfc4f8a){return new BPromise(function(_0x34ee57,_0x40d442){return client[_0x949e('0x9')](_0x17f649,_0xfc4f8a)[_0x949e('0xa')](function(_0x56e31d){logger[_0x949e('0xb')]('VoiceChanSpy,\x20%s,\x20%s',_0x16c669,_0x949e('0xc'));logger[_0x949e('0xd')](_0x949e('0xe'),_0x16c669,'request\x20sent',JSON[_0x949e('0xf')](_0x56e31d));if(_0x56e31d[_0x949e('0x10')]){if(_0x56e31d[_0x949e('0x10')][_0x949e('0x11')]===0x1f4){logger[_0x949e('0x10')](_0x949e('0x12'),_0x16c669,_0x56e31d[_0x949e('0x10')][_0x949e('0x13')]);return _0x40d442(_0x56e31d[_0x949e('0x10')][_0x949e('0x13')]);}logger[_0x949e('0x10')](_0x949e('0x12'),_0x16c669,_0x56e31d[_0x949e('0x10')][_0x949e('0x13')]);return _0x34ee57(_0x56e31d[_0x949e('0x10')]['message']);}else{logger[_0x949e('0xb')](_0x949e('0x12'),_0x16c669,_0x949e('0xc'));_0x34ee57(_0x56e31d[_0x949e('0x14')]['message']);}})[_0x949e('0x15')](function(_0x441b80){logger['error'](_0x949e('0x12'),_0x16c669,_0x441b80);_0x40d442(_0x441b80);});});} \ No newline at end of file diff --git a/server/api/voiceContext/index.js b/server/api/voiceContext/index.js index 73bba74..4d8ccc1 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 _0x3b38=['exports','util','path','connect-timeout','express','../../components/auth/service','../../components/interaction/service','../../config/environment','./voiceContext.controller','isAuthenticated','index','/:id','show','post','create','put','destroy'];(function(_0x220f3f,_0x11c540){var _0x1f170e=function(_0x2c0ec9){while(--_0x2c0ec9){_0x220f3f['push'](_0x220f3f['shift']());}};_0x1f170e(++_0x11c540);}(_0x3b38,0x1cc));var _0x83b3=function(_0x109258,_0x5ad065){_0x109258=_0x109258-0x0;var _0xa5b9b3=_0x3b38[_0x109258];return _0xa5b9b3;};'use strict';var multer=require('multer');var util=require(_0x83b3('0x0'));var path=require(_0x83b3('0x1'));var timeout=require(_0x83b3('0x2'));var express=require(_0x83b3('0x3'));var router=express['Router']();var fs_extra=require('fs-extra');var auth=require(_0x83b3('0x4'));var interaction=require(_0x83b3('0x5'));var config=require(_0x83b3('0x6'));var controller=require(_0x83b3('0x7'));router['get']('/',auth[_0x83b3('0x8')](),controller[_0x83b3('0x9')]);router['get'](_0x83b3('0xa'),auth[_0x83b3('0x8')](),controller[_0x83b3('0xb')]);router[_0x83b3('0xc')]('/',auth[_0x83b3('0x8')](),controller[_0x83b3('0xd')]);router[_0x83b3('0xe')](_0x83b3('0xa'),auth[_0x83b3('0x8')](),controller['update']);router['delete'](_0x83b3('0xa'),auth['isAuthenticated'](),controller[_0x83b3('0xf')]);module[_0x83b3('0x10')]=router; \ No newline at end of file +var _0x9d60=['isAuthenticated','index','/:id','post','create','put','update','delete','destroy','connect-timeout','express','Router','fs-extra','../../config/environment','./voiceContext.controller','get'];(function(_0x5f002f,_0x4aab75){var _0x929486=function(_0xd3d31d){while(--_0xd3d31d){_0x5f002f['push'](_0x5f002f['shift']());}};_0x929486(++_0x4aab75);}(_0x9d60,0xd9));var _0x09d6=function(_0x35f83e,_0x30ec55){_0x35f83e=_0x35f83e-0x0;var _0x249b05=_0x9d60[_0x35f83e];return _0x249b05;};'use strict';var multer=require('multer');var util=require('util');var path=require('path');var timeout=require(_0x09d6('0x0'));var express=require(_0x09d6('0x1'));var router=express[_0x09d6('0x2')]();var fs_extra=require(_0x09d6('0x3'));var auth=require('../../components/auth/service');var interaction=require('../../components/interaction/service');var config=require(_0x09d6('0x4'));var controller=require(_0x09d6('0x5'));router[_0x09d6('0x6')]('/',auth[_0x09d6('0x7')](),controller[_0x09d6('0x8')]);router[_0x09d6('0x6')](_0x09d6('0x9'),auth[_0x09d6('0x7')](),controller['show']);router[_0x09d6('0xa')]('/',auth[_0x09d6('0x7')](),controller[_0x09d6('0xb')]);router[_0x09d6('0xc')](_0x09d6('0x9'),auth[_0x09d6('0x7')](),controller[_0x09d6('0xd')]);router[_0x09d6('0xe')]('/:id',auth[_0x09d6('0x7')](),controller[_0x09d6('0xf')]);module['exports']=router; \ No newline at end of file diff --git a/server/api/voiceContext/voiceContext.attributes.js b/server/api/voiceContext/voiceContext.attributes.js index 9f4ad27..cd1a22f 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 _0x573e=['exports','STRING','name','BOOLEAN','sequelize'];(function(_0x110e03,_0xab389e){var _0x1d1b49=function(_0x4b67b1){while(--_0x4b67b1){_0x110e03['push'](_0x110e03['shift']());}};_0x1d1b49(++_0xab389e);}(_0x573e,0x16c));var _0xe573=function(_0x32c01d,_0xd0506a){_0x32c01d=_0x32c01d-0x0;var _0x2bf41b=_0x573e[_0x32c01d];return _0x2bf41b;};'use strict';var Sequelize=require(_0xe573('0x0'));module[_0xe573('0x1')]={'name':{'type':Sequelize[_0xe573('0x2')],'unique':_0xe573('0x3')},'description':{'type':Sequelize[_0xe573('0x2')],'allowNull':!![]},'defaultEntry':{'type':Sequelize[_0xe573('0x4')],'defaultValue':0x0}}; \ No newline at end of file +var _0x77f8=['BOOLEAN','sequelize','STRING','name'];(function(_0x48e92a,_0x1d411a){var _0x5db8db=function(_0x39ee67){while(--_0x39ee67){_0x48e92a['push'](_0x48e92a['shift']());}};_0x5db8db(++_0x1d411a);}(_0x77f8,0xd9));var _0x877f=function(_0xdea41a,_0x552987){_0xdea41a=_0xdea41a-0x0;var _0x15d0d8=_0x77f8[_0xdea41a];return _0x15d0d8;};'use strict';var Sequelize=require(_0x877f('0x0'));module['exports']={'name':{'type':Sequelize[_0x877f('0x1')],'unique':_0x877f('0x2')},'description':{'type':Sequelize[_0x877f('0x1')],'allowNull':!![]},'defaultEntry':{'type':Sequelize[_0x877f('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 e77d9a4..456dbb9 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 _0x482e=['squel','crypto','jsforce','desk.js','ioredis','../../components/auth/service','../../components/parsers/advancedSearch','../../config/license/hardware','api','../../config/environment','../../config/license/util','../../mysqldb','jayson/promise','http','request','then','info','VoiceContext,\x20%s,\x20%s','request\x20sent','VoiceContext,\x20%s,\x20%s,\x20%s','stringify','error','code','message','catch','sendStatus','status','end','json','offset','undefined','count','limit','Content-Range','get','Contexts','UserProfileResource','stack','name','index','map','VoiceContext','rawAttributes','fieldName','type','key','model','keys','query','filters','intersection','attributes','fields','length','hasOwnProperty','nolimit','order','sort','where','pick','filter','VIRTUAL','merge','options','findAll','params','includeAll','include','find','create','body','readFileSync','join','server/files/templates/context.ejs','utf8','render','writeFileSync','/etc/asterisk/extensions_xcally_contexts.conf','Reload','chan_sip.so','user','Unable\x20to\x20retrieve\x20the\x20current\x20user','role','UserProfileSection','userProfileId','autoAssociation','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','root','update','destroy','eml-format','rimraf','fast-json-patch','request-promise','path','sox','to-csv','ejs','fs-extra'];(function(_0x21087d,_0x191d21){var _0xe084ee=function(_0x34b6e2){while(--_0x34b6e2){_0x21087d['push'](_0x21087d['shift']());}};_0xe084ee(++_0x191d21);}(_0x482e,0x120));var _0xe482=function(_0x26f702,_0x3919bf){_0x26f702=_0x26f702-0x0;var _0x11417d=_0x482e[_0x26f702];return _0x11417d;};'use strict';var emlformat=require(_0xe482('0x0'));var rimraf=require(_0xe482('0x1'));var zipdir=require('zip-dir');var jsonpatch=require(_0xe482('0x2'));var rp=require(_0xe482('0x3'));var moment=require('moment');var BPromise=require('bluebird');var Mustache=require('mustache');var util=require('util');var path=require(_0xe482('0x4'));var sox=require(_0xe482('0x5'));var csv=require(_0xe482('0x6'));var ejs=require(_0xe482('0x7'));var fs=require('fs');var fs_extra=require(_0xe482('0x8'));var _=require('lodash');var squel=require(_0xe482('0x9'));var crypto=require(_0xe482('0xa'));var jsforce=require(_0xe482('0xb'));var deskjs=require(_0xe482('0xc'));var toCsv=require(_0xe482('0x6'));var querystring=require('querystring');var Papa=require('papaparse');var Redis=require(_0xe482('0xd'));var authService=require(_0xe482('0xe'));var qs=require('../../components/parsers/qs');var as=require(_0xe482('0xf'));var hardwareService=require(_0xe482('0x10'));var logger=require('../../config/logger')(_0xe482('0x11'));var utils=require('../../config/utils');var config=require(_0xe482('0x12'));var licenseUtil=require(_0xe482('0x13'));var db=require(_0xe482('0x14'))['db'];var jayson=require(_0xe482('0x15'));var client=jayson['client'][_0xe482('0x16')]({'port':0x232a});function respondWithRpcPromise(_0x3aa212,_0x95a891,_0x1bc98a,_0xf01c23){return new BPromise(function(_0x46989b,_0x190253){var _0x99bdf2=_0xf01c23||client;return _0x99bdf2[_0xe482('0x17')](_0x3aa212,_0x1bc98a)[_0xe482('0x18')](function(_0xe8e512){logger[_0xe482('0x19')](_0xe482('0x1a'),_0x95a891,_0xe482('0x1b'));logger['debug'](_0xe482('0x1c'),_0x95a891,_0xe482('0x1b'),JSON[_0xe482('0x1d')](_0xe8e512));if(_0xe8e512[_0xe482('0x1e')]){if(_0xe8e512[_0xe482('0x1e')][_0xe482('0x1f')]===0x1f4){logger[_0xe482('0x1e')](_0xe482('0x1a'),_0x95a891,_0xe8e512[_0xe482('0x1e')][_0xe482('0x20')]);return _0x190253(_0xe8e512[_0xe482('0x1e')][_0xe482('0x20')]);}logger[_0xe482('0x1e')](_0xe482('0x1a'),_0x95a891,_0xe8e512[_0xe482('0x1e')][_0xe482('0x20')]);return _0x46989b(_0xe8e512[_0xe482('0x1e')]['message']);}else{logger[_0xe482('0x19')](_0xe482('0x1a'),_0x95a891,_0xe482('0x1b'));_0x46989b(_0xe8e512['result'][_0xe482('0x20')]);}})[_0xe482('0x21')](function(_0x1ae9b0){logger[_0xe482('0x1e')](_0xe482('0x1a'),_0x95a891,_0x1ae9b0);_0x190253(_0x1ae9b0);});});}function respondWithStatusCode(_0x5eea1b,_0x1c79ea){_0x1c79ea=_0x1c79ea||0xcc;return function(_0x368836){if(_0x368836){return _0x5eea1b[_0xe482('0x22')](_0x1c79ea);}return _0x5eea1b[_0xe482('0x23')](_0x1c79ea)[_0xe482('0x24')]();};}function respondWithResult(_0x4fdd7f,_0x32d129){_0x32d129=_0x32d129||0xc8;return function(_0x5f2a6a){if(_0x5f2a6a){return _0x4fdd7f['status'](_0x32d129)[_0xe482('0x25')](_0x5f2a6a);}};}function respondWithFilteredResult(_0x166c76,_0x38bbe7){return function(_0x57ca73){if(_0x57ca73){var _0x211174=typeof _0x38bbe7[_0xe482('0x26')]===_0xe482('0x27')&&typeof _0x38bbe7['limit']===_0xe482('0x27');var _0x217bc7=_0x57ca73['count'];var _0x506dd7=_0x211174?0x0:_0x38bbe7[_0xe482('0x26')];var _0x39db74=_0x211174?_0x57ca73[_0xe482('0x28')]:_0x38bbe7[_0xe482('0x26')]+_0x38bbe7[_0xe482('0x29')];var _0x55b106;if(_0x39db74>=_0x217bc7){_0x39db74=_0x217bc7;_0x55b106=0xc8;}else{_0x55b106=0xce;}_0x166c76[_0xe482('0x23')](_0x55b106);return _0x166c76['set'](_0xe482('0x2a'),_0x506dd7+'-'+_0x39db74+'/'+_0x217bc7)['json'](_0x57ca73);}return null;};}function patchUpdates(_0x26ccdb){return function(_0x3b2c3d){try{jsonpatch['apply'](_0x3b2c3d,_0x26ccdb,!![]);}catch(_0x43488b){return BPromise['reject'](_0x43488b);}return _0x3b2c3d['save']();};}function saveUpdates(_0x52be11,_0x33d953){return function(_0xe5b33d){if(_0xe5b33d){return _0xe5b33d['update'](_0x52be11)[_0xe482('0x18')](function(_0x17f950){return _0x17f950;});}return null;};}function removeEntity(_0x37fc56,_0x3b6e0c){return function(_0x565d17){if(_0x565d17){return _0x565d17['destroy']()['then'](function(){var _0x173aba=_0x565d17[_0xe482('0x2b')]({'plain':!![]});var _0xef0958=_0xe482('0x2c');return db[_0xe482('0x2d')]['destroy']({'where':{'type':_0xef0958,'resourceId':_0x173aba['id']}})[_0xe482('0x18')](function(){return _0x565d17;});})[_0xe482('0x18')](function(){_0x37fc56[_0xe482('0x23')](0xcc)[_0xe482('0x24')]();});}};}function handleEntityNotFound(_0x457611,_0x507b53){return function(_0x2235a7){if(!_0x2235a7){_0x457611[_0xe482('0x22')](0x194);}return _0x2235a7;};}function handleError(_0x213d68,_0x2f0d81){_0x2f0d81=_0x2f0d81||0x1f4;return function(_0xb8450e){logger['error'](_0xb8450e[_0xe482('0x2e')]);if(_0xb8450e[_0xe482('0x2f')]){delete _0xb8450e[_0xe482('0x2f')];}_0x213d68['status'](_0x2f0d81)['send'](_0xb8450e);};}exports[_0xe482('0x30')]=function(_0x5a1526,_0x2a38fe){var _0x3715ef={},_0x43d353={},_0x2909da={'count':0x0,'rows':[]};var _0x1dac71=_[_0xe482('0x31')](db[_0xe482('0x32')][_0xe482('0x33')],function(_0x29f7d8){return{'name':_0x29f7d8[_0xe482('0x34')],'type':_0x29f7d8[_0xe482('0x35')][_0xe482('0x36')]};});_0x43d353[_0xe482('0x37')]=_['map'](_0x1dac71,_0xe482('0x2f'));_0x43d353['query']=_[_0xe482('0x38')](_0x5a1526[_0xe482('0x39')]);_0x43d353[_0xe482('0x3a')]=_[_0xe482('0x3b')](_0x43d353[_0xe482('0x37')],_0x43d353[_0xe482('0x39')]);_0x3715ef[_0xe482('0x3c')]=_[_0xe482('0x3b')](_0x43d353['model'],qs[_0xe482('0x3d')](_0x5a1526[_0xe482('0x39')]['fields']));_0x3715ef[_0xe482('0x3c')]=_0x3715ef['attributes'][_0xe482('0x3e')]?_0x3715ef[_0xe482('0x3c')]:_0x43d353[_0xe482('0x37')];if(!_0x5a1526[_0xe482('0x39')][_0xe482('0x3f')](_0xe482('0x40'))){_0x3715ef['limit']=qs[_0xe482('0x29')](_0x5a1526['query'][_0xe482('0x29')]);_0x3715ef[_0xe482('0x26')]=qs[_0xe482('0x26')](_0x5a1526[_0xe482('0x39')][_0xe482('0x26')]);}_0x3715ef[_0xe482('0x41')]=qs['sort'](_0x5a1526[_0xe482('0x39')][_0xe482('0x42')]);_0x3715ef[_0xe482('0x43')]=qs['filters'](_[_0xe482('0x44')](_0x5a1526[_0xe482('0x39')],_0x43d353[_0xe482('0x3a')]),_0x1dac71);if(_0x5a1526[_0xe482('0x39')][_0xe482('0x45')]){_0x3715ef['where']=_['merge'](_0x3715ef[_0xe482('0x43')],{'$or':_[_0xe482('0x31')](_0x1dac71,function(_0x514a3c){if(_0x514a3c[_0xe482('0x35')]!==_0xe482('0x46')){var _0x6eded1={};_0x6eded1[_0x514a3c[_0xe482('0x2f')]]={'$like':'%'+_0x5a1526[_0xe482('0x39')][_0xe482('0x45')]+'%'};return _0x6eded1;}})});}_0x3715ef=_[_0xe482('0x47')]({},_0x3715ef,_0x5a1526[_0xe482('0x48')]);var _0x1328a1={'where':_0x3715ef[_0xe482('0x43')]};return db[_0xe482('0x32')][_0xe482('0x28')](_0x1328a1)['then'](function(_0x14de09){_0x2909da[_0xe482('0x28')]=_0x14de09;if(_0x5a1526[_0xe482('0x39')]['includeAll']){_0x3715ef['include']=[{'all':!![]}];}return db[_0xe482('0x32')][_0xe482('0x49')](_0x3715ef);})[_0xe482('0x18')](function(_0x1121b2){_0x2909da['rows']=_0x1121b2;return _0x2909da;})[_0xe482('0x18')](respondWithFilteredResult(_0x2a38fe,_0x3715ef))['catch'](handleError(_0x2a38fe,null));};exports['show']=function(_0x17d199,_0x225b72){var _0x888e95={'raw':![],'where':{'id':_0x17d199[_0xe482('0x4a')]['id']}},_0x1f58af={};_0x1f58af[_0xe482('0x37')]=_['keys'](db[_0xe482('0x32')]['rawAttributes']);_0x1f58af['query']=_['keys'](_0x17d199[_0xe482('0x39')]);_0x1f58af[_0xe482('0x3a')]=_[_0xe482('0x3b')](_0x1f58af['model'],_0x1f58af[_0xe482('0x39')]);_0x888e95[_0xe482('0x3c')]=_[_0xe482('0x3b')](_0x1f58af[_0xe482('0x37')],qs[_0xe482('0x3d')](_0x17d199[_0xe482('0x39')]['fields']));_0x888e95['attributes']=_0x888e95[_0xe482('0x3c')]['length']?_0x888e95[_0xe482('0x3c')]:_0x1f58af[_0xe482('0x37')];if(_0x17d199[_0xe482('0x39')][_0xe482('0x4b')]){_0x888e95[_0xe482('0x4c')]=[{'all':!![]}];}_0x888e95=_['merge']({},_0x888e95,_0x17d199['options']);return db[_0xe482('0x32')][_0xe482('0x4d')](_0x888e95)[_0xe482('0x18')](handleEntityNotFound(_0x225b72,null))[_0xe482('0x18')](respondWithResult(_0x225b72,null))[_0xe482('0x21')](handleError(_0x225b72,null));};exports[_0xe482('0x4e')]=function(_0x3cb97f,_0x29696b,_0x58d472){var _0x3400e0;return db['VoiceContext'][_0xe482('0x4e')](_0x3cb97f[_0xe482('0x4f')],{'raw':!![]})[_0xe482('0x18')](function(_0x27df66){_0x3400e0=_0x27df66;return db[_0xe482('0x32')][_0xe482('0x49')]({'raw':!![]});})[_0xe482('0x18')](function(_0x1d5bf1){var _0xb756a1=fs[_0xe482('0x50')](path[_0xe482('0x51')](config['root'],_0xe482('0x52')),_0xe482('0x53'));var _0x13f902=ejs[_0xe482('0x54')](_0xb756a1,{'contexts':_0x1d5bf1||[]});fs[_0xe482('0x55')](_0xe482('0x56'),_0x13f902);})[_0xe482('0x18')](function(){return respondWithRpcPromise(_0xe482('0x57'),_0xe482('0x4e'),{'module':_0xe482('0x58')});})[_0xe482('0x18')](function(){var _0x5d3b83=_0x3cb97f[_0xe482('0x59')][_0xe482('0x2b')]({'plain':!![]});if(!_0x5d3b83)throw new Error(_0xe482('0x5a'));if(_0x5d3b83[_0xe482('0x5b')]===_0xe482('0x59')){var _0x45b611=_0x3400e0['get']({'plain':!![]});return db[_0xe482('0x5c')][_0xe482('0x4d')]({'where':{'name':_0xe482('0x2c'),'userProfileId':_0x5d3b83[_0xe482('0x5d')]},'raw':!![]})[_0xe482('0x18')](function(_0x487051){if(_0x487051&&_0x487051[_0xe482('0x5e')]===0x0){return db[_0xe482('0x2d')][_0xe482('0x4e')]({'name':_0x45b611['name'],'resourceId':_0x45b611['id'],'type':_0x487051[_0xe482('0x2f')],'sectionId':_0x487051['id']},{})[_0xe482('0x18')](function(){return _0x3400e0;});}else{return _0x3400e0;}})['catch'](function(_0x739b8b){logger['error'](_0xe482('0x5f'),_0x739b8b);throw _0x739b8b;});}return _0x3400e0;})[_0xe482('0x18')](respondWithResult(_0x29696b,0xc9))[_0xe482('0x21')](handleError(_0x29696b,null));};exports['update']=function(_0x1ed56a,_0x35ca59,_0x146bdd){var _0x1d3d63;return db[_0xe482('0x32')][_0xe482('0x4d')]({'where':{'id':_0x1ed56a[_0xe482('0x4a')]['id']}})[_0xe482('0x18')](handleEntityNotFound(_0x35ca59,null))[_0xe482('0x18')](saveUpdates(_0x1ed56a[_0xe482('0x4f')],null))['then'](function(_0x5e2695){if(_0x5e2695){_0x1d3d63=_0x5e2695;return db[_0xe482('0x32')][_0xe482('0x49')]({'raw':!![]});}})[_0xe482('0x18')](function(_0xe7a831){var _0x23b643=fs['readFileSync'](path[_0xe482('0x51')](config[_0xe482('0x60')],'server/files/templates/context.ejs'),_0xe482('0x53'));var _0x5c8d83=ejs[_0xe482('0x54')](_0x23b643,{'contexts':_0xe7a831||[]});fs[_0xe482('0x55')](_0xe482('0x56'),_0x5c8d83);})['then'](function(){return respondWithRpcPromise(_0xe482('0x57'),_0xe482('0x61'),{'module':_0xe482('0x58')});})[_0xe482('0x18')](function(){return _0x1d3d63;})['then'](respondWithResult(_0x35ca59,null))[_0xe482('0x21')](handleError(_0x35ca59,null));};exports[_0xe482('0x62')]=function(_0x255f8b,_0x407eac,_0x56ace0){var _0x1a7b5a;return db[_0xe482('0x32')]['find']({'where':{'id':_0x255f8b[_0xe482('0x4a')]['id']}})[_0xe482('0x18')](handleEntityNotFound(_0x407eac,null))[_0xe482('0x18')](removeEntity(_0x407eac,null))['then'](function(){return db['VoiceContext'][_0xe482('0x49')]({'raw':!![]});})[_0xe482('0x18')](function(_0x369200){var _0x568fba=fs[_0xe482('0x50')](path[_0xe482('0x51')](config[_0xe482('0x60')],_0xe482('0x52')),_0xe482('0x53'));var _0x41d467=ejs[_0xe482('0x54')](_0x568fba,{'contexts':_0x369200});fs[_0xe482('0x55')](_0xe482('0x56'),_0x41d467);return respondWithRpcPromise(_0xe482('0x57'),'destroy',{'module':_0xe482('0x58')});})[_0xe482('0x21')](handleError(_0x407eac,null));}; \ No newline at end of file +var _0x5e3b=['rawAttributes','type','key','query','keys','filters','intersection','model','fields','attributes','length','hasOwnProperty','nolimit','order','sort','where','pick','VIRTUAL','filter','merge','options','includeAll','include','findAll','create','readFileSync','root','server/files/templates/context.ejs','render','writeFileSync','/etc/asterisk/extensions_xcally_contexts.conf','Reload','chan_sip.so','user','Unable\x20to\x20retrieve\x20the\x20current\x20user','UserProfileSection','find','autoAssociation','params','join','utf8','rimraf','zip-dir','fast-json-patch','request-promise','moment','bluebird','path','to-csv','ejs','fs-extra','lodash','desk.js','querystring','papaparse','ioredis','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/logger','../../config/utils','../../config/license/util','jayson/promise','client','then','VoiceContext,\x20%s,\x20%s','request\x20sent','debug','VoiceContext,\x20%s,\x20%s,\x20%s','stringify','error','code','message','result','catch','sendStatus','status','end','offset','undefined','limit','count','set','Content-Range','reject','save','update','get','UserProfileResource','destroy','stack','name','send','index','map','VoiceContext'];(function(_0x99692,_0x32528e){var _0xe5fbb4=function(_0x58a4e1){while(--_0x58a4e1){_0x99692['push'](_0x99692['shift']());}};_0xe5fbb4(++_0x32528e);}(_0x5e3b,0xe7));var _0xb5e3=function(_0x262000,_0x1b190b){_0x262000=_0x262000-0x0;var _0x3f4adc=_0x5e3b[_0x262000];return _0x3f4adc;};'use strict';var emlformat=require('eml-format');var rimraf=require(_0xb5e3('0x0'));var zipdir=require(_0xb5e3('0x1'));var jsonpatch=require(_0xb5e3('0x2'));var rp=require(_0xb5e3('0x3'));var moment=require(_0xb5e3('0x4'));var BPromise=require(_0xb5e3('0x5'));var Mustache=require('mustache');var util=require('util');var path=require(_0xb5e3('0x6'));var sox=require('sox');var csv=require(_0xb5e3('0x7'));var ejs=require(_0xb5e3('0x8'));var fs=require('fs');var fs_extra=require(_0xb5e3('0x9'));var _=require(_0xb5e3('0xa'));var squel=require('squel');var crypto=require('crypto');var jsforce=require('jsforce');var deskjs=require(_0xb5e3('0xb'));var toCsv=require(_0xb5e3('0x7'));var querystring=require(_0xb5e3('0xc'));var Papa=require(_0xb5e3('0xd'));var Redis=require(_0xb5e3('0xe'));var authService=require('../../components/auth/service');var qs=require(_0xb5e3('0xf'));var as=require(_0xb5e3('0x10'));var hardwareService=require('../../config/license/hardware');var logger=require(_0xb5e3('0x11'))('api');var utils=require(_0xb5e3('0x12'));var config=require('../../config/environment');var licenseUtil=require(_0xb5e3('0x13'));var db=require('../../mysqldb')['db'];var jayson=require(_0xb5e3('0x14'));var client=jayson[_0xb5e3('0x15')]['http']({'port':0x232a});function respondWithRpcPromise(_0x1a7287,_0x157601,_0x4881ba,_0x4c19bb){return new BPromise(function(_0x591db5,_0x56ae61){var _0x3d64da=_0x4c19bb||client;return _0x3d64da['request'](_0x1a7287,_0x4881ba)[_0xb5e3('0x16')](function(_0x2460c1){logger['info'](_0xb5e3('0x17'),_0x157601,_0xb5e3('0x18'));logger[_0xb5e3('0x19')](_0xb5e3('0x1a'),_0x157601,_0xb5e3('0x18'),JSON[_0xb5e3('0x1b')](_0x2460c1));if(_0x2460c1[_0xb5e3('0x1c')]){if(_0x2460c1[_0xb5e3('0x1c')][_0xb5e3('0x1d')]===0x1f4){logger[_0xb5e3('0x1c')](_0xb5e3('0x17'),_0x157601,_0x2460c1[_0xb5e3('0x1c')][_0xb5e3('0x1e')]);return _0x56ae61(_0x2460c1[_0xb5e3('0x1c')][_0xb5e3('0x1e')]);}logger[_0xb5e3('0x1c')](_0xb5e3('0x17'),_0x157601,_0x2460c1[_0xb5e3('0x1c')][_0xb5e3('0x1e')]);return _0x591db5(_0x2460c1[_0xb5e3('0x1c')][_0xb5e3('0x1e')]);}else{logger['info']('VoiceContext,\x20%s,\x20%s',_0x157601,_0xb5e3('0x18'));_0x591db5(_0x2460c1[_0xb5e3('0x1f')][_0xb5e3('0x1e')]);}})[_0xb5e3('0x20')](function(_0x4ec625){logger['error'](_0xb5e3('0x17'),_0x157601,_0x4ec625);_0x56ae61(_0x4ec625);});});}function respondWithStatusCode(_0x3af8ac,_0x2f0052){_0x2f0052=_0x2f0052||0xcc;return function(_0x48dd97){if(_0x48dd97){return _0x3af8ac[_0xb5e3('0x21')](_0x2f0052);}return _0x3af8ac[_0xb5e3('0x22')](_0x2f0052)[_0xb5e3('0x23')]();};}function respondWithResult(_0xfa8cc1,_0x5d0bae){_0x5d0bae=_0x5d0bae||0xc8;return function(_0x1a6cd8){if(_0x1a6cd8){return _0xfa8cc1[_0xb5e3('0x22')](_0x5d0bae)['json'](_0x1a6cd8);}};}function respondWithFilteredResult(_0x4eb275,_0x4c08a1){return function(_0x4069a9){if(_0x4069a9){var _0x870cac=typeof _0x4c08a1[_0xb5e3('0x24')]===_0xb5e3('0x25')&&typeof _0x4c08a1[_0xb5e3('0x26')]===_0xb5e3('0x25');var _0x3466b6=_0x4069a9[_0xb5e3('0x27')];var _0x443b53=_0x870cac?0x0:_0x4c08a1[_0xb5e3('0x24')];var _0x1adb36=_0x870cac?_0x4069a9['count']:_0x4c08a1[_0xb5e3('0x24')]+_0x4c08a1['limit'];var _0x326ce9;if(_0x1adb36>=_0x3466b6){_0x1adb36=_0x3466b6;_0x326ce9=0xc8;}else{_0x326ce9=0xce;}_0x4eb275[_0xb5e3('0x22')](_0x326ce9);return _0x4eb275[_0xb5e3('0x28')](_0xb5e3('0x29'),_0x443b53+'-'+_0x1adb36+'/'+_0x3466b6)['json'](_0x4069a9);}return null;};}function patchUpdates(_0x424c0e){return function(_0x2be4b1){try{jsonpatch['apply'](_0x2be4b1,_0x424c0e,!![]);}catch(_0x346c89){return BPromise[_0xb5e3('0x2a')](_0x346c89);}return _0x2be4b1[_0xb5e3('0x2b')]();};}function saveUpdates(_0x59706e,_0x5d1bf8){return function(_0xf684fd){if(_0xf684fd){return _0xf684fd[_0xb5e3('0x2c')](_0x59706e)[_0xb5e3('0x16')](function(_0x2fcac6){return _0x2fcac6;});}return null;};}function removeEntity(_0x408e0f,_0x2a75b0){return function(_0x16a238){if(_0x16a238){return _0x16a238['destroy']()[_0xb5e3('0x16')](function(){var _0x1eb7be=_0x16a238[_0xb5e3('0x2d')]({'plain':!![]});var _0x2cf339='Contexts';return db[_0xb5e3('0x2e')][_0xb5e3('0x2f')]({'where':{'type':_0x2cf339,'resourceId':_0x1eb7be['id']}})[_0xb5e3('0x16')](function(){return _0x16a238;});})[_0xb5e3('0x16')](function(){_0x408e0f[_0xb5e3('0x22')](0xcc)[_0xb5e3('0x23')]();});}};}function handleEntityNotFound(_0x4fb124,_0x427f07){return function(_0x5f46eb){if(!_0x5f46eb){_0x4fb124['sendStatus'](0x194);}return _0x5f46eb;};}function handleError(_0x427c3e,_0xd66517){_0xd66517=_0xd66517||0x1f4;return function(_0x543b8f){logger[_0xb5e3('0x1c')](_0x543b8f[_0xb5e3('0x30')]);if(_0x543b8f['name']){delete _0x543b8f[_0xb5e3('0x31')];}_0x427c3e['status'](_0xd66517)[_0xb5e3('0x32')](_0x543b8f);};}exports[_0xb5e3('0x33')]=function(_0x414ca1,_0xf2d1da){var _0x1e4f35={},_0x762e9={},_0x422f4a={'count':0x0,'rows':[]};var _0x123d50=_[_0xb5e3('0x34')](db[_0xb5e3('0x35')][_0xb5e3('0x36')],function(_0x44392b){return{'name':_0x44392b['fieldName'],'type':_0x44392b[_0xb5e3('0x37')][_0xb5e3('0x38')]};});_0x762e9['model']=_['map'](_0x123d50,_0xb5e3('0x31'));_0x762e9[_0xb5e3('0x39')]=_[_0xb5e3('0x3a')](_0x414ca1[_0xb5e3('0x39')]);_0x762e9[_0xb5e3('0x3b')]=_[_0xb5e3('0x3c')](_0x762e9['model'],_0x762e9['query']);_0x1e4f35['attributes']=_['intersection'](_0x762e9[_0xb5e3('0x3d')],qs[_0xb5e3('0x3e')](_0x414ca1[_0xb5e3('0x39')][_0xb5e3('0x3e')]));_0x1e4f35[_0xb5e3('0x3f')]=_0x1e4f35[_0xb5e3('0x3f')][_0xb5e3('0x40')]?_0x1e4f35[_0xb5e3('0x3f')]:_0x762e9[_0xb5e3('0x3d')];if(!_0x414ca1[_0xb5e3('0x39')][_0xb5e3('0x41')](_0xb5e3('0x42'))){_0x1e4f35['limit']=qs[_0xb5e3('0x26')](_0x414ca1[_0xb5e3('0x39')][_0xb5e3('0x26')]);_0x1e4f35[_0xb5e3('0x24')]=qs[_0xb5e3('0x24')](_0x414ca1[_0xb5e3('0x39')][_0xb5e3('0x24')]);}_0x1e4f35[_0xb5e3('0x43')]=qs[_0xb5e3('0x44')](_0x414ca1[_0xb5e3('0x39')][_0xb5e3('0x44')]);_0x1e4f35[_0xb5e3('0x45')]=qs[_0xb5e3('0x3b')](_[_0xb5e3('0x46')](_0x414ca1[_0xb5e3('0x39')],_0x762e9[_0xb5e3('0x3b')]),_0x123d50);if(_0x414ca1[_0xb5e3('0x39')]['filter']){_0x1e4f35[_0xb5e3('0x45')]=_['merge'](_0x1e4f35[_0xb5e3('0x45')],{'$or':_[_0xb5e3('0x34')](_0x123d50,function(_0x49eb9b){if(_0x49eb9b[_0xb5e3('0x37')]!==_0xb5e3('0x47')){var _0x31b01c={};_0x31b01c[_0x49eb9b['name']]={'$like':'%'+_0x414ca1[_0xb5e3('0x39')][_0xb5e3('0x48')]+'%'};return _0x31b01c;}})});}_0x1e4f35=_[_0xb5e3('0x49')]({},_0x1e4f35,_0x414ca1[_0xb5e3('0x4a')]);var _0xe4ee5a={'where':_0x1e4f35[_0xb5e3('0x45')]};return db['VoiceContext'][_0xb5e3('0x27')](_0xe4ee5a)[_0xb5e3('0x16')](function(_0x37d02a){_0x422f4a[_0xb5e3('0x27')]=_0x37d02a;if(_0x414ca1[_0xb5e3('0x39')][_0xb5e3('0x4b')]){_0x1e4f35[_0xb5e3('0x4c')]=[{'all':!![]}];}return db[_0xb5e3('0x35')][_0xb5e3('0x4d')](_0x1e4f35);})[_0xb5e3('0x16')](function(_0x275229){_0x422f4a['rows']=_0x275229;return _0x422f4a;})[_0xb5e3('0x16')](respondWithFilteredResult(_0xf2d1da,_0x1e4f35))[_0xb5e3('0x20')](handleError(_0xf2d1da,null));};exports['show']=function(_0x1b0e62,_0x3ffff0){var _0x4fae75={'raw':![],'where':{'id':_0x1b0e62['params']['id']}},_0x83c94e={};_0x83c94e[_0xb5e3('0x3d')]=_[_0xb5e3('0x3a')](db[_0xb5e3('0x35')][_0xb5e3('0x36')]);_0x83c94e[_0xb5e3('0x39')]=_[_0xb5e3('0x3a')](_0x1b0e62['query']);_0x83c94e[_0xb5e3('0x3b')]=_[_0xb5e3('0x3c')](_0x83c94e[_0xb5e3('0x3d')],_0x83c94e[_0xb5e3('0x39')]);_0x4fae75[_0xb5e3('0x3f')]=_['intersection'](_0x83c94e[_0xb5e3('0x3d')],qs[_0xb5e3('0x3e')](_0x1b0e62[_0xb5e3('0x39')][_0xb5e3('0x3e')]));_0x4fae75[_0xb5e3('0x3f')]=_0x4fae75[_0xb5e3('0x3f')][_0xb5e3('0x40')]?_0x4fae75[_0xb5e3('0x3f')]:_0x83c94e[_0xb5e3('0x3d')];if(_0x1b0e62[_0xb5e3('0x39')][_0xb5e3('0x4b')]){_0x4fae75['include']=[{'all':!![]}];}_0x4fae75=_[_0xb5e3('0x49')]({},_0x4fae75,_0x1b0e62['options']);return db[_0xb5e3('0x35')]['find'](_0x4fae75)['then'](handleEntityNotFound(_0x3ffff0,null))['then'](respondWithResult(_0x3ffff0,null))[_0xb5e3('0x20')](handleError(_0x3ffff0,null));};exports['create']=function(_0x4be0e8,_0x49aad8,_0x5f4465){var _0x87dfbd;return db[_0xb5e3('0x35')][_0xb5e3('0x4e')](_0x4be0e8['body'],{'raw':!![]})['then'](function(_0x3a41f1){_0x87dfbd=_0x3a41f1;return db[_0xb5e3('0x35')]['findAll']({'raw':!![]});})[_0xb5e3('0x16')](function(_0x51ba03){var _0x29f528=fs[_0xb5e3('0x4f')](path['join'](config[_0xb5e3('0x50')],_0xb5e3('0x51')),'utf8');var _0x4cd1c3=ejs[_0xb5e3('0x52')](_0x29f528,{'contexts':_0x51ba03||[]});fs[_0xb5e3('0x53')](_0xb5e3('0x54'),_0x4cd1c3);})[_0xb5e3('0x16')](function(){return respondWithRpcPromise(_0xb5e3('0x55'),'create',{'module':_0xb5e3('0x56')});})['then'](function(){var _0x21818e=_0x4be0e8[_0xb5e3('0x57')]['get']({'plain':!![]});if(!_0x21818e)throw new Error(_0xb5e3('0x58'));if(_0x21818e['role']===_0xb5e3('0x57')){var _0x5bd5f3=_0x87dfbd[_0xb5e3('0x2d')]({'plain':!![]});return db[_0xb5e3('0x59')][_0xb5e3('0x5a')]({'where':{'name':'Contexts','userProfileId':_0x21818e['userProfileId']},'raw':!![]})[_0xb5e3('0x16')](function(_0x346098){if(_0x346098&&_0x346098[_0xb5e3('0x5b')]===0x0){return db[_0xb5e3('0x2e')]['create']({'name':_0x5bd5f3[_0xb5e3('0x31')],'resourceId':_0x5bd5f3['id'],'type':_0x346098[_0xb5e3('0x31')],'sectionId':_0x346098['id']},{})[_0xb5e3('0x16')](function(){return _0x87dfbd;});}else{return _0x87dfbd;}})[_0xb5e3('0x20')](function(_0x513882){logger['error']('Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s',_0x513882);throw _0x513882;});}return _0x87dfbd;})[_0xb5e3('0x16')](respondWithResult(_0x49aad8,0xc9))['catch'](handleError(_0x49aad8,null));};exports[_0xb5e3('0x2c')]=function(_0x146a2f,_0x5b7d97,_0x35bc07){var _0x3f86b6;return db[_0xb5e3('0x35')][_0xb5e3('0x5a')]({'where':{'id':_0x146a2f[_0xb5e3('0x5c')]['id']}})[_0xb5e3('0x16')](handleEntityNotFound(_0x5b7d97,null))[_0xb5e3('0x16')](saveUpdates(_0x146a2f['body'],null))[_0xb5e3('0x16')](function(_0x370920){if(_0x370920){_0x3f86b6=_0x370920;return db['VoiceContext'][_0xb5e3('0x4d')]({'raw':!![]});}})[_0xb5e3('0x16')](function(_0x361fdd){var _0x23c1e9=fs['readFileSync'](path[_0xb5e3('0x5d')](config[_0xb5e3('0x50')],'server/files/templates/context.ejs'),_0xb5e3('0x5e'));var _0x3d62ae=ejs[_0xb5e3('0x52')](_0x23c1e9,{'contexts':_0x361fdd||[]});fs['writeFileSync'](_0xb5e3('0x54'),_0x3d62ae);})[_0xb5e3('0x16')](function(){return respondWithRpcPromise(_0xb5e3('0x55'),_0xb5e3('0x2c'),{'module':_0xb5e3('0x56')});})[_0xb5e3('0x16')](function(){return _0x3f86b6;})[_0xb5e3('0x16')](respondWithResult(_0x5b7d97,null))[_0xb5e3('0x20')](handleError(_0x5b7d97,null));};exports[_0xb5e3('0x2f')]=function(_0x384c3b,_0x568287,_0x93388a){var _0x17fcac;return db[_0xb5e3('0x35')][_0xb5e3('0x5a')]({'where':{'id':_0x384c3b[_0xb5e3('0x5c')]['id']}})[_0xb5e3('0x16')](handleEntityNotFound(_0x568287,null))['then'](removeEntity(_0x568287,null))[_0xb5e3('0x16')](function(){return db[_0xb5e3('0x35')][_0xb5e3('0x4d')]({'raw':!![]});})[_0xb5e3('0x16')](function(_0x314fc){var _0x56090e=fs[_0xb5e3('0x4f')](path[_0xb5e3('0x5d')](config[_0xb5e3('0x50')],_0xb5e3('0x51')),'utf8');var _0x5a37b9=ejs[_0xb5e3('0x52')](_0x56090e,{'contexts':_0x314fc});fs[_0xb5e3('0x53')]('/etc/asterisk/extensions_xcally_contexts.conf',_0x5a37b9);return respondWithRpcPromise(_0xb5e3('0x55'),_0xb5e3('0x2f'),{'module':_0xb5e3('0x56')});})[_0xb5e3('0x20')](handleError(_0x568287,null));}; \ No newline at end of file diff --git a/server/api/voiceContext/voiceContext.model.js b/server/api/voiceContext/voiceContext.model.js index 185effe..941bc6b 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 _0xc9ea=['request-promise','path','rimraf','./voiceContext.attributes','voice_contexts','lodash','util','../../config/logger','api','moment','bluebird'];(function(_0x5e6ba1,_0x58cfaa){var _0x5f24c1=function(_0x311f63){while(--_0x311f63){_0x5e6ba1['push'](_0x5e6ba1['shift']());}};_0x5f24c1(++_0x58cfaa);}(_0xc9ea,0x186));var _0xac9e=function(_0x19994a,_0x2df597){_0x19994a=_0x19994a-0x0;var _0x2952a8=_0xc9ea[_0x19994a];return _0x2952a8;};'use strict';var _=require(_0xac9e('0x0'));var util=require(_0xac9e('0x1'));var logger=require(_0xac9e('0x2'))(_0xac9e('0x3'));var moment=require(_0xac9e('0x4'));var BPromise=require(_0xac9e('0x5'));var rp=require(_0xac9e('0x6'));var fs=require('fs');var path=require(_0xac9e('0x7'));var rimraf=require(_0xac9e('0x8'));var config=require('../../config/environment');var attributes=require(_0xac9e('0x9'));module['exports']=function(_0x3153cf,_0x1657b4){return _0x3153cf['define']('VoiceContext',attributes,{'tableName':_0xac9e('0xa'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x98d8=['moment','bluebird','request-promise','path','../../config/environment','define','VoiceContext','voice_contexts','lodash','../../config/logger'];(function(_0x2cc676,_0x317691){var _0x5b9da9=function(_0x3bafdf){while(--_0x3bafdf){_0x2cc676['push'](_0x2cc676['shift']());}};_0x5b9da9(++_0x317691);}(_0x98d8,0x184));var _0x898d=function(_0x3da3c4,_0x2b874d){_0x3da3c4=_0x3da3c4-0x0;var _0x36a3af=_0x98d8[_0x3da3c4];return _0x36a3af;};'use strict';var _=require(_0x898d('0x0'));var util=require('util');var logger=require(_0x898d('0x1'))('api');var moment=require(_0x898d('0x2'));var BPromise=require(_0x898d('0x3'));var rp=require(_0x898d('0x4'));var fs=require('fs');var path=require(_0x898d('0x5'));var rimraf=require('rimraf');var config=require(_0x898d('0x6'));var attributes=require('./voiceContext.attributes');module['exports']=function(_0x195056,_0x561b76){return _0x195056[_0x898d('0x7')](_0x898d('0x8'),attributes,{'tableName':_0x898d('0x9'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/voiceContext/voiceContext.rpc.js b/server/api/voiceContext/voiceContext.rpc.js index a62dcea..cd63ac5 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 _0xeae6=['code','VoiceContext,\x20%s,\x20%s','message','info','result','catch','lodash','util','moment','ioredis','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','client','http','then','request\x20sent','stringify','error'];(function(_0x2faddb,_0xc18b78){var _0x273c05=function(_0x1a3785){while(--_0x1a3785){_0x2faddb['push'](_0x2faddb['shift']());}};_0x273c05(++_0xc18b78);}(_0xeae6,0xc3));var _0x6eae=function(_0x321bb2,_0x202794){_0x321bb2=_0x321bb2-0x0;var _0x9c12ed=_0xeae6[_0x321bb2];return _0x9c12ed;};'use strict';var _=require(_0x6eae('0x0'));var util=require(_0x6eae('0x1'));var moment=require(_0x6eae('0x2'));var BPromise=require('bluebird');var rs=require('randomstring');var fs=require('fs');var Redis=require(_0x6eae('0x3'));var db=require('../../mysqldb')['db'];var utils=require(_0x6eae('0x4'));var logger=require(_0x6eae('0x5'))(_0x6eae('0x6'));var config=require(_0x6eae('0x7'));var jayson=require(_0x6eae('0x8'));var client=jayson[_0x6eae('0x9')][_0x6eae('0xa')]({'port':0x232a});function respondWithRpcPromise(_0x778b34,_0x543c50,_0x57c926){return new BPromise(function(_0x397f64,_0x2d45b0){return client['request'](_0x778b34,_0x57c926)[_0x6eae('0xb')](function(_0x213684){logger['info']('VoiceContext,\x20%s,\x20%s',_0x543c50,_0x6eae('0xc'));logger['debug']('VoiceContext,\x20%s,\x20%s,\x20%s',_0x543c50,'request\x20sent',JSON[_0x6eae('0xd')](_0x213684));if(_0x213684[_0x6eae('0xe')]){if(_0x213684['error'][_0x6eae('0xf')]===0x1f4){logger[_0x6eae('0xe')](_0x6eae('0x10'),_0x543c50,_0x213684[_0x6eae('0xe')][_0x6eae('0x11')]);return _0x2d45b0(_0x213684[_0x6eae('0xe')][_0x6eae('0x11')]);}logger['error'](_0x6eae('0x10'),_0x543c50,_0x213684[_0x6eae('0xe')][_0x6eae('0x11')]);return _0x397f64(_0x213684[_0x6eae('0xe')][_0x6eae('0x11')]);}else{logger[_0x6eae('0x12')](_0x6eae('0x10'),_0x543c50,_0x6eae('0xc'));_0x397f64(_0x213684[_0x6eae('0x13')][_0x6eae('0x11')]);}})[_0x6eae('0x14')](function(_0x309190){logger[_0x6eae('0xe')](_0x6eae('0x10'),_0x543c50,_0x309190);_0x2d45b0(_0x309190);});});} \ No newline at end of file +var _0xaac0=['result','catch','lodash','util','bluebird','randomstring','ioredis','../../config/utils','rpc','../../config/environment','client','http','info','VoiceContext,\x20%s,\x20%s','request\x20sent','VoiceContext,\x20%s,\x20%s,\x20%s','stringify','error','message'];(function(_0x4fa438,_0x1f15a7){var _0x4e3958=function(_0x28f510){while(--_0x28f510){_0x4fa438['push'](_0x4fa438['shift']());}};_0x4e3958(++_0x1f15a7);}(_0xaac0,0x10c));var _0x0aac=function(_0x415b51,_0x1a29ee){_0x415b51=_0x415b51-0x0;var _0x1dd82c=_0xaac0[_0x415b51];return _0x1dd82c;};'use strict';var _=require(_0x0aac('0x0'));var util=require(_0x0aac('0x1'));var moment=require('moment');var BPromise=require(_0x0aac('0x2'));var rs=require(_0x0aac('0x3'));var fs=require('fs');var Redis=require(_0x0aac('0x4'));var db=require('../../mysqldb')['db'];var utils=require(_0x0aac('0x5'));var logger=require('../../config/logger')(_0x0aac('0x6'));var config=require(_0x0aac('0x7'));var jayson=require('jayson/promise');var client=jayson[_0x0aac('0x8')][_0x0aac('0x9')]({'port':0x232a});function respondWithRpcPromise(_0x21bc06,_0x1147e7,_0x1f2ebf){return new BPromise(function(_0x1f4a36,_0x12c247){return client['request'](_0x21bc06,_0x1f2ebf)['then'](function(_0x5bb044){logger[_0x0aac('0xa')](_0x0aac('0xb'),_0x1147e7,_0x0aac('0xc'));logger['debug'](_0x0aac('0xd'),_0x1147e7,_0x0aac('0xc'),JSON[_0x0aac('0xe')](_0x5bb044));if(_0x5bb044['error']){if(_0x5bb044['error']['code']===0x1f4){logger[_0x0aac('0xf')]('VoiceContext,\x20%s,\x20%s',_0x1147e7,_0x5bb044['error'][_0x0aac('0x10')]);return _0x12c247(_0x5bb044[_0x0aac('0xf')]['message']);}logger[_0x0aac('0xf')](_0x0aac('0xb'),_0x1147e7,_0x5bb044[_0x0aac('0xf')][_0x0aac('0x10')]);return _0x1f4a36(_0x5bb044[_0x0aac('0xf')][_0x0aac('0x10')]);}else{logger[_0x0aac('0xa')](_0x0aac('0xb'),_0x1147e7,_0x0aac('0xc'));_0x1f4a36(_0x5bb044[_0x0aac('0x11')][_0x0aac('0x10')]);}})[_0x0aac('0x12')](function(_0x2807a8){logger[_0x0aac('0xf')]('VoiceContext,\x20%s,\x20%s',_0x1147e7,_0x2807a8);_0x12c247(_0x2807a8);});});} \ No newline at end of file diff --git a/server/api/voiceDialReport/index.js b/server/api/voiceDialReport/index.js index d7cafe8..b8f6141 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 _0x51ba=['delete','util','path','connect-timeout','express','Router','../../components/auth/service','get','isAuthenticated','index','/:id','show','post','put','update'];(function(_0x59e3e7,_0x3bc4e4){var _0x5a8f5f=function(_0x569164){while(--_0x569164){_0x59e3e7['push'](_0x59e3e7['shift']());}};_0x5a8f5f(++_0x3bc4e4);}(_0x51ba,0x169));var _0xa51b=function(_0x2cfe24,_0x465e80){_0x2cfe24=_0x2cfe24-0x0;var _0x407a70=_0x51ba[_0x2cfe24];return _0x407a70;};'use strict';var multer=require('multer');var util=require(_0xa51b('0x0'));var path=require(_0xa51b('0x1'));var timeout=require(_0xa51b('0x2'));var express=require(_0xa51b('0x3'));var router=express[_0xa51b('0x4')]();var fs_extra=require('fs-extra');var auth=require(_0xa51b('0x5'));var interaction=require('../../components/interaction/service');var config=require('../../config/environment');var controller=require('./voiceDialReport.controller');router[_0xa51b('0x6')]('/',auth[_0xa51b('0x7')](),controller[_0xa51b('0x8')]);router[_0xa51b('0x6')]('/describe',auth[_0xa51b('0x7')](),controller['describe']);router['get'](_0xa51b('0x9'),auth[_0xa51b('0x7')](),controller[_0xa51b('0xa')]);router[_0xa51b('0xb')]('/',auth[_0xa51b('0x7')](),controller['create']);router[_0xa51b('0xc')](_0xa51b('0x9'),auth['isAuthenticated'](),controller[_0xa51b('0xd')]);router[_0xa51b('0xe')](_0xa51b('0x9'),auth[_0xa51b('0x7')](),controller['destroy']);module['exports']=router; \ No newline at end of file +var _0xbab9=['show','create','put','update','delete','exports','multer','util','connect-timeout','express','Router','../../components/auth/service','../../components/interaction/service','../../config/environment','./voiceDialReport.controller','get','isAuthenticated','index','describe','/:id'];(function(_0x59ee6f,_0x450239){var _0x4c0979=function(_0x565e92){while(--_0x565e92){_0x59ee6f['push'](_0x59ee6f['shift']());}};_0x4c0979(++_0x450239);}(_0xbab9,0x1d2));var _0x9bab=function(_0x394fd5,_0xaa97d9){_0x394fd5=_0x394fd5-0x0;var _0x4f7471=_0xbab9[_0x394fd5];return _0x4f7471;};'use strict';var multer=require(_0x9bab('0x0'));var util=require(_0x9bab('0x1'));var path=require('path');var timeout=require(_0x9bab('0x2'));var express=require(_0x9bab('0x3'));var router=express[_0x9bab('0x4')]();var fs_extra=require('fs-extra');var auth=require(_0x9bab('0x5'));var interaction=require(_0x9bab('0x6'));var config=require(_0x9bab('0x7'));var controller=require(_0x9bab('0x8'));router[_0x9bab('0x9')]('/',auth[_0x9bab('0xa')](),controller[_0x9bab('0xb')]);router[_0x9bab('0x9')]('/describe',auth[_0x9bab('0xa')](),controller[_0x9bab('0xc')]);router[_0x9bab('0x9')](_0x9bab('0xd'),auth[_0x9bab('0xa')](),controller[_0x9bab('0xe')]);router['post']('/',auth[_0x9bab('0xa')](),controller[_0x9bab('0xf')]);router[_0x9bab('0x10')]('/:id',auth[_0x9bab('0xa')](),controller[_0x9bab('0x11')]);router[_0x9bab('0x12')]('/:id',auth['isAuthenticated'](),controller['destroy']);module[_0x9bab('0x13')]=router; \ No newline at end of file diff --git a/server/api/voiceDialReport/voiceDialReport.attributes.js b/server/api/voiceDialReport/voiceDialReport.attributes.js index 92e95dc..0dd50d8 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 _0xd6d6=['STRING','INTEGER','DATE','called,connect,complete','sequelize','exports'];(function(_0x1ae0f5,_0x25d756){var _0xa96dc1=function(_0xe9a62){while(--_0xe9a62){_0x1ae0f5['push'](_0x1ae0f5['shift']());}};_0xa96dc1(++_0x25d756);}(_0xd6d6,0xbe));var _0x6d6d=function(_0x359161,_0x4e05c2){_0x359161=_0x359161-0x0;var _0x4b8e3f=_0xd6d6[_0x359161];return _0x4b8e3f;};'use strict';var Sequelize=require(_0x6d6d('0x0'));module[_0x6d6d('0x1')]={'privilege':{'type':Sequelize[_0x6d6d('0x2')]},'channel':{'type':Sequelize[_0x6d6d('0x2')]},'channelstate':{'type':Sequelize['INTEGER']},'channelstatedesc':{'type':Sequelize[_0x6d6d('0x2')]},'calleridnum':{'type':Sequelize[_0x6d6d('0x2')]},'calleridname':{'type':Sequelize[_0x6d6d('0x2')]},'connectedlinenum':{'type':Sequelize[_0x6d6d('0x2')]},'connectedlinename':{'type':Sequelize[_0x6d6d('0x2')]},'language':{'type':Sequelize[_0x6d6d('0x2')]},'accountcode':{'type':Sequelize[_0x6d6d('0x2')]},'context':{'type':Sequelize['STRING']},'exten':{'type':Sequelize[_0x6d6d('0x2')]},'priority':{'type':Sequelize[_0x6d6d('0x3')]},'uniqueid':{'type':Sequelize[_0x6d6d('0x2')]},'linkedid':{'type':Sequelize[_0x6d6d('0x2')]},'destchannel':{'type':Sequelize[_0x6d6d('0x2')]},'destchannelstate':{'type':Sequelize[_0x6d6d('0x3')]},'destchannelstatedesc':{'type':Sequelize[_0x6d6d('0x2')]},'destcalleridnum':{'type':Sequelize['STRING']},'destcalleridname':{'type':Sequelize['STRING']},'destconnectedlinenum':{'type':Sequelize[_0x6d6d('0x2')]},'destconnectedlinename':{'type':Sequelize[_0x6d6d('0x2')]},'destlanguage':{'type':Sequelize[_0x6d6d('0x2')]},'destaccountcode':{'type':Sequelize[_0x6d6d('0x2')]},'destcontext':{'type':Sequelize[_0x6d6d('0x2')]},'destexten':{'type':Sequelize['STRING']},'destpriority':{'type':Sequelize[_0x6d6d('0x3')]},'destuniqueid':{'type':Sequelize[_0x6d6d('0x2')]},'destlinkedid':{'type':Sequelize['STRING']},'dialstring':{'type':Sequelize['STRING']},'dialstatus':{'type':Sequelize[_0x6d6d('0x2')]},'starttime':{'type':Sequelize[_0x6d6d('0x4')]},'answertime':{'type':Sequelize[_0x6d6d('0x4')]},'endtime':{'type':Sequelize[_0x6d6d('0x4')]},'lastevent':{'type':Sequelize[_0x6d6d('0x2')],'comment':_0x6d6d('0x5')},'routeId':{'type':Sequelize[_0x6d6d('0x3')]},'duration':{'type':Sequelize[_0x6d6d('0x3')]},'holdtime':{'type':Sequelize['INTEGER']},'billableseconds':{'type':Sequelize[_0x6d6d('0x3')]}}; \ No newline at end of file +var _0x34e8=['sequelize','exports','STRING','INTEGER','DATE','called,connect,complete'];(function(_0xfd9730,_0x29666e){var _0x17c1a0=function(_0x16808e){while(--_0x16808e){_0xfd9730['push'](_0xfd9730['shift']());}};_0x17c1a0(++_0x29666e);}(_0x34e8,0x12c));var _0x834e=function(_0x38975b,_0x329e54){_0x38975b=_0x38975b-0x0;var _0x352059=_0x34e8[_0x38975b];return _0x352059;};'use strict';var Sequelize=require(_0x834e('0x0'));module[_0x834e('0x1')]={'privilege':{'type':Sequelize[_0x834e('0x2')]},'channel':{'type':Sequelize[_0x834e('0x2')]},'channelstate':{'type':Sequelize['INTEGER']},'channelstatedesc':{'type':Sequelize[_0x834e('0x2')]},'calleridnum':{'type':Sequelize[_0x834e('0x2')]},'calleridname':{'type':Sequelize[_0x834e('0x2')]},'connectedlinenum':{'type':Sequelize[_0x834e('0x2')]},'connectedlinename':{'type':Sequelize[_0x834e('0x2')]},'language':{'type':Sequelize[_0x834e('0x2')]},'accountcode':{'type':Sequelize[_0x834e('0x2')]},'context':{'type':Sequelize['STRING']},'exten':{'type':Sequelize[_0x834e('0x2')]},'priority':{'type':Sequelize['INTEGER']},'uniqueid':{'type':Sequelize[_0x834e('0x2')]},'linkedid':{'type':Sequelize[_0x834e('0x2')]},'destchannel':{'type':Sequelize[_0x834e('0x2')]},'destchannelstate':{'type':Sequelize[_0x834e('0x3')]},'destchannelstatedesc':{'type':Sequelize[_0x834e('0x2')]},'destcalleridnum':{'type':Sequelize[_0x834e('0x2')]},'destcalleridname':{'type':Sequelize[_0x834e('0x2')]},'destconnectedlinenum':{'type':Sequelize[_0x834e('0x2')]},'destconnectedlinename':{'type':Sequelize[_0x834e('0x2')]},'destlanguage':{'type':Sequelize[_0x834e('0x2')]},'destaccountcode':{'type':Sequelize[_0x834e('0x2')]},'destcontext':{'type':Sequelize[_0x834e('0x2')]},'destexten':{'type':Sequelize[_0x834e('0x2')]},'destpriority':{'type':Sequelize[_0x834e('0x3')]},'destuniqueid':{'type':Sequelize[_0x834e('0x2')]},'destlinkedid':{'type':Sequelize[_0x834e('0x2')]},'dialstring':{'type':Sequelize[_0x834e('0x2')]},'dialstatus':{'type':Sequelize['STRING']},'starttime':{'type':Sequelize[_0x834e('0x4')]},'answertime':{'type':Sequelize[_0x834e('0x4')]},'endtime':{'type':Sequelize['DATE']},'lastevent':{'type':Sequelize[_0x834e('0x2')],'comment':_0x834e('0x5')},'routeId':{'type':Sequelize[_0x834e('0x3')]},'duration':{'type':Sequelize[_0x834e('0x3')]},'holdtime':{'type':Sequelize['INTEGER']},'billableseconds':{'type':Sequelize[_0x834e('0x3')]}}; \ No newline at end of file diff --git a/server/api/voiceDialReport/voiceDialReport.controller.js b/server/api/voiceDialReport/voiceDialReport.controller.js index f094c0b..0c37189 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 _0x2a65=['../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/environment','../../config/license/util','sendStatus','status','end','json','offset','undefined','count','set','Content-Range','apply','save','update','then','destroy','error','name','send','index','map','VoiceDialReport','rawAttributes','fieldName','type','key','model','keys','query','intersection','attributes','fields','hasOwnProperty','nolimit','limit','order','sort','where','pick','filters','merge','VIRTUAL','options','include','findAll','rows','catch','show','params','length','includeAll','find','create','body','describe','eml-format','rimraf','zip-dir','request-promise','moment','mustache','util','path','sox','to-csv','fs-extra','lodash','squel','crypto','jsforce','desk.js','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch'];(function(_0x1b2c50,_0x140d94){var _0x52bd3f=function(_0x334465){while(--_0x334465){_0x1b2c50['push'](_0x1b2c50['shift']());}};_0x52bd3f(++_0x140d94);}(_0x2a65,0x1cb));var _0x52a6=function(_0x4421b5,_0x13d0f6){_0x4421b5=_0x4421b5-0x0;var _0x26cca3=_0x2a65[_0x4421b5];return _0x26cca3;};'use strict';var emlformat=require(_0x52a6('0x0'));var rimraf=require(_0x52a6('0x1'));var zipdir=require(_0x52a6('0x2'));var jsonpatch=require('fast-json-patch');var rp=require(_0x52a6('0x3'));var moment=require(_0x52a6('0x4'));var BPromise=require('bluebird');var Mustache=require(_0x52a6('0x5'));var util=require(_0x52a6('0x6'));var path=require(_0x52a6('0x7'));var sox=require(_0x52a6('0x8'));var csv=require(_0x52a6('0x9'));var ejs=require('ejs');var fs=require('fs');var fs_extra=require(_0x52a6('0xa'));var _=require(_0x52a6('0xb'));var squel=require(_0x52a6('0xc'));var crypto=require(_0x52a6('0xd'));var jsforce=require(_0x52a6('0xe'));var deskjs=require(_0x52a6('0xf'));var toCsv=require(_0x52a6('0x9'));var querystring=require('querystring');var Papa=require(_0x52a6('0x10'));var Redis=require(_0x52a6('0x11'));var authService=require(_0x52a6('0x12'));var qs=require(_0x52a6('0x13'));var as=require(_0x52a6('0x14'));var hardwareService=require(_0x52a6('0x15'));var logger=require(_0x52a6('0x16'))(_0x52a6('0x17'));var utils=require(_0x52a6('0x18'));var config=require(_0x52a6('0x19'));var licenseUtil=require(_0x52a6('0x1a'));var db=require('../../mysqldb')['db'];function respondWithStatusCode(_0x3384c6,_0x2b3fea){_0x2b3fea=_0x2b3fea||0xcc;return function(_0x37a5c6){if(_0x37a5c6){return _0x3384c6[_0x52a6('0x1b')](_0x2b3fea);}return _0x3384c6[_0x52a6('0x1c')](_0x2b3fea)[_0x52a6('0x1d')]();};}function respondWithResult(_0x4c180c,_0x2a2905){_0x2a2905=_0x2a2905||0xc8;return function(_0x1180fd){if(_0x1180fd){return _0x4c180c[_0x52a6('0x1c')](_0x2a2905)[_0x52a6('0x1e')](_0x1180fd);}};}function respondWithFilteredResult(_0xe34981,_0xe8edaf){return function(_0x5581ec){if(_0x5581ec){var _0x36675a=typeof _0xe8edaf[_0x52a6('0x1f')]==='undefined'&&typeof _0xe8edaf['limit']===_0x52a6('0x20');var _0x276cd1=_0x5581ec[_0x52a6('0x21')];var _0x181883=_0x36675a?0x0:_0xe8edaf[_0x52a6('0x1f')];var _0xd14533=_0x36675a?_0x5581ec[_0x52a6('0x21')]:_0xe8edaf['offset']+_0xe8edaf['limit'];var _0x17df3f;if(_0xd14533>=_0x276cd1){_0xd14533=_0x276cd1;_0x17df3f=0xc8;}else{_0x17df3f=0xce;}_0xe34981['status'](_0x17df3f);return _0xe34981[_0x52a6('0x22')](_0x52a6('0x23'),_0x181883+'-'+_0xd14533+'/'+_0x276cd1)[_0x52a6('0x1e')](_0x5581ec);}return null;};}function patchUpdates(_0x146a92){return function(_0x40a9d2){try{jsonpatch[_0x52a6('0x24')](_0x40a9d2,_0x146a92,!![]);}catch(_0x5d8b1f){return BPromise['reject'](_0x5d8b1f);}return _0x40a9d2[_0x52a6('0x25')]();};}function saveUpdates(_0x71bb51,_0x5e21ca){return function(_0x340a14){if(_0x340a14){return _0x340a14[_0x52a6('0x26')](_0x71bb51)[_0x52a6('0x27')](function(_0x237d0b){return _0x237d0b;});}return null;};}function removeEntity(_0x3d0bc1,_0xd0821c){return function(_0x447171){if(_0x447171){return _0x447171[_0x52a6('0x28')]()['then'](function(){_0x3d0bc1[_0x52a6('0x1c')](0xcc)[_0x52a6('0x1d')]();});}};}function handleEntityNotFound(_0x374a44,_0x45bb68){return function(_0x3009e9){if(!_0x3009e9){_0x374a44['sendStatus'](0x194);}return _0x3009e9;};}function handleError(_0x255541,_0x12912d){_0x12912d=_0x12912d||0x1f4;return function(_0x4df465){logger[_0x52a6('0x29')](_0x4df465['stack']);if(_0x4df465[_0x52a6('0x2a')]){delete _0x4df465[_0x52a6('0x2a')];}_0x255541[_0x52a6('0x1c')](_0x12912d)[_0x52a6('0x2b')](_0x4df465);};}exports[_0x52a6('0x2c')]=function(_0x66331f,_0x3e56e1){var _0x8c432d={},_0x3ecb39={},_0x59556d={'count':0x0,'rows':[]};var _0x3d9c43=_[_0x52a6('0x2d')](db[_0x52a6('0x2e')][_0x52a6('0x2f')],function(_0xd0d00e){return{'name':_0xd0d00e[_0x52a6('0x30')],'type':_0xd0d00e[_0x52a6('0x31')][_0x52a6('0x32')]};});_0x3ecb39[_0x52a6('0x33')]=_['map'](_0x3d9c43,_0x52a6('0x2a'));_0x3ecb39['query']=_[_0x52a6('0x34')](_0x66331f[_0x52a6('0x35')]);_0x3ecb39['filters']=_[_0x52a6('0x36')](_0x3ecb39['model'],_0x3ecb39[_0x52a6('0x35')]);_0x8c432d[_0x52a6('0x37')]=_[_0x52a6('0x36')](_0x3ecb39[_0x52a6('0x33')],qs[_0x52a6('0x38')](_0x66331f['query']['fields']));_0x8c432d[_0x52a6('0x37')]=_0x8c432d['attributes']['length']?_0x8c432d[_0x52a6('0x37')]:_0x3ecb39[_0x52a6('0x33')];if(!_0x66331f[_0x52a6('0x35')][_0x52a6('0x39')](_0x52a6('0x3a'))){_0x8c432d[_0x52a6('0x3b')]=qs[_0x52a6('0x3b')](_0x66331f[_0x52a6('0x35')][_0x52a6('0x3b')]);_0x8c432d['offset']=qs[_0x52a6('0x1f')](_0x66331f['query'][_0x52a6('0x1f')]);}_0x8c432d[_0x52a6('0x3c')]=qs[_0x52a6('0x3d')](_0x66331f['query'][_0x52a6('0x3d')]);_0x8c432d[_0x52a6('0x3e')]=qs['filters'](_[_0x52a6('0x3f')](_0x66331f[_0x52a6('0x35')],_0x3ecb39[_0x52a6('0x40')]),_0x3d9c43);if(_0x66331f[_0x52a6('0x35')]['filter']){_0x8c432d[_0x52a6('0x3e')]=_[_0x52a6('0x41')](_0x8c432d[_0x52a6('0x3e')],{'$or':_[_0x52a6('0x2d')](_0x3d9c43,function(_0x28943d){if(_0x28943d['type']!==_0x52a6('0x42')){var _0x4232ae={};_0x4232ae[_0x28943d[_0x52a6('0x2a')]]={'$like':'%'+_0x66331f[_0x52a6('0x35')]['filter']+'%'};return _0x4232ae;}})});}_0x8c432d=_['merge']({},_0x8c432d,_0x66331f[_0x52a6('0x43')]);var _0x704228={'where':_0x8c432d[_0x52a6('0x3e')]};return db[_0x52a6('0x2e')][_0x52a6('0x21')](_0x704228)[_0x52a6('0x27')](function(_0x117c56){_0x59556d[_0x52a6('0x21')]=_0x117c56;if(_0x66331f[_0x52a6('0x35')]['includeAll']){_0x8c432d[_0x52a6('0x44')]=[{'all':!![]}];}return db[_0x52a6('0x2e')][_0x52a6('0x45')](_0x8c432d);})['then'](function(_0x3ccef7){_0x59556d[_0x52a6('0x46')]=_0x3ccef7;return _0x59556d;})[_0x52a6('0x27')](respondWithFilteredResult(_0x3e56e1,_0x8c432d))[_0x52a6('0x47')](handleError(_0x3e56e1,null));};exports[_0x52a6('0x48')]=function(_0x3020b2,_0x344030){var _0x37df36={'raw':!![],'where':{'id':_0x3020b2[_0x52a6('0x49')]['id']}},_0x3fe785={};_0x3fe785['model']=_['keys'](db[_0x52a6('0x2e')][_0x52a6('0x2f')]);_0x3fe785[_0x52a6('0x35')]=_[_0x52a6('0x34')](_0x3020b2['query']);_0x3fe785['filters']=_['intersection'](_0x3fe785['model'],_0x3fe785['query']);_0x37df36[_0x52a6('0x37')]=_[_0x52a6('0x36')](_0x3fe785[_0x52a6('0x33')],qs['fields'](_0x3020b2['query'][_0x52a6('0x38')]));_0x37df36[_0x52a6('0x37')]=_0x37df36[_0x52a6('0x37')][_0x52a6('0x4a')]?_0x37df36[_0x52a6('0x37')]:_0x3fe785[_0x52a6('0x33')];if(_0x3020b2[_0x52a6('0x35')][_0x52a6('0x4b')]){_0x37df36[_0x52a6('0x44')]=[{'all':!![]}];}_0x37df36=_[_0x52a6('0x41')]({},_0x37df36,_0x3020b2[_0x52a6('0x43')]);return db[_0x52a6('0x2e')][_0x52a6('0x4c')](_0x37df36)['then'](handleEntityNotFound(_0x344030,null))[_0x52a6('0x27')](respondWithResult(_0x344030,null))['catch'](handleError(_0x344030,null));};exports[_0x52a6('0x4d')]=function(_0xd80dae,_0x55ab7c){return db['VoiceDialReport']['create'](_0xd80dae[_0x52a6('0x4e')],{})['then'](respondWithResult(_0x55ab7c,0xc9))[_0x52a6('0x47')](handleError(_0x55ab7c,null));};exports[_0x52a6('0x26')]=function(_0x496d93,_0x34ac05){if(_0x496d93[_0x52a6('0x4e')]['id']){delete _0x496d93[_0x52a6('0x4e')]['id'];}return db[_0x52a6('0x2e')][_0x52a6('0x4c')]({'where':{'id':_0x496d93['params']['id']}})[_0x52a6('0x27')](handleEntityNotFound(_0x34ac05,null))[_0x52a6('0x27')](saveUpdates(_0x496d93[_0x52a6('0x4e')],null))[_0x52a6('0x27')](respondWithResult(_0x34ac05,null))[_0x52a6('0x47')](handleError(_0x34ac05,null));};exports['destroy']=function(_0x2b95c9,_0x125be6){return db[_0x52a6('0x2e')][_0x52a6('0x4c')]({'where':{'id':_0x2b95c9[_0x52a6('0x49')]['id']}})[_0x52a6('0x27')](handleEntityNotFound(_0x125be6,null))['then'](removeEntity(_0x125be6,null))[_0x52a6('0x47')](handleError(_0x125be6,null));};exports[_0x52a6('0x4f')]=function(_0x5419a1,_0x33715f){return db['VoiceDialReport'][_0x52a6('0x4f')]()[_0x52a6('0x27')](respondWithResult(_0x33715f,null))[_0x52a6('0x47')](handleError(_0x33715f,null));}; \ No newline at end of file +var _0xfb8c=['undefined','count','set','apply','save','then','destroy','error','stack','name','send','index','map','VoiceDialReport','key','model','query','keys','intersection','attributes','fields','nolimit','order','sort','where','filters','filter','merge','type','findAll','rows','catch','rawAttributes','length','includeAll','include','find','create','body','update','params','describe','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','moment','mustache','path','sox','to-csv','ejs','fs-extra','lodash','squel','crypto','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','api','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','sendStatus','status','end','json','offset','limit'];(function(_0x5b78e8,_0x55096b){var _0xf2c321=function(_0x4e0cff){while(--_0x4e0cff){_0x5b78e8['push'](_0x5b78e8['shift']());}};_0xf2c321(++_0x55096b);}(_0xfb8c,0x152));var _0xcfb8=function(_0x3c4e6a,_0x5ddc5f){_0x3c4e6a=_0x3c4e6a-0x0;var _0x4a724f=_0xfb8c[_0x3c4e6a];return _0x4a724f;};'use strict';var emlformat=require(_0xcfb8('0x0'));var rimraf=require(_0xcfb8('0x1'));var zipdir=require(_0xcfb8('0x2'));var jsonpatch=require(_0xcfb8('0x3'));var rp=require(_0xcfb8('0x4'));var moment=require(_0xcfb8('0x5'));var BPromise=require('bluebird');var Mustache=require(_0xcfb8('0x6'));var util=require('util');var path=require(_0xcfb8('0x7'));var sox=require(_0xcfb8('0x8'));var csv=require(_0xcfb8('0x9'));var ejs=require(_0xcfb8('0xa'));var fs=require('fs');var fs_extra=require(_0xcfb8('0xb'));var _=require(_0xcfb8('0xc'));var squel=require(_0xcfb8('0xd'));var crypto=require(_0xcfb8('0xe'));var jsforce=require('jsforce');var deskjs=require('desk.js');var toCsv=require(_0xcfb8('0x9'));var querystring=require('querystring');var Papa=require(_0xcfb8('0xf'));var Redis=require(_0xcfb8('0x10'));var authService=require(_0xcfb8('0x11'));var qs=require(_0xcfb8('0x12'));var as=require(_0xcfb8('0x13'));var hardwareService=require(_0xcfb8('0x14'));var logger=require('../../config/logger')(_0xcfb8('0x15'));var utils=require(_0xcfb8('0x16'));var config=require(_0xcfb8('0x17'));var licenseUtil=require(_0xcfb8('0x18'));var db=require(_0xcfb8('0x19'))['db'];function respondWithStatusCode(_0x35eeb2,_0x3ee3c4){_0x3ee3c4=_0x3ee3c4||0xcc;return function(_0x3ba119){if(_0x3ba119){return _0x35eeb2[_0xcfb8('0x1a')](_0x3ee3c4);}return _0x35eeb2[_0xcfb8('0x1b')](_0x3ee3c4)[_0xcfb8('0x1c')]();};}function respondWithResult(_0x516563,_0x4b0064){_0x4b0064=_0x4b0064||0xc8;return function(_0x1c7e9d){if(_0x1c7e9d){return _0x516563[_0xcfb8('0x1b')](_0x4b0064)[_0xcfb8('0x1d')](_0x1c7e9d);}};}function respondWithFilteredResult(_0x47f2af,_0x17cc20){return function(_0xb6ac87){if(_0xb6ac87){var _0x23d33e=typeof _0x17cc20[_0xcfb8('0x1e')]==='undefined'&&typeof _0x17cc20[_0xcfb8('0x1f')]===_0xcfb8('0x20');var _0x51eea2=_0xb6ac87[_0xcfb8('0x21')];var _0xb9682f=_0x23d33e?0x0:_0x17cc20['offset'];var _0x18244d=_0x23d33e?_0xb6ac87[_0xcfb8('0x21')]:_0x17cc20[_0xcfb8('0x1e')]+_0x17cc20['limit'];var _0x43a5be;if(_0x18244d>=_0x51eea2){_0x18244d=_0x51eea2;_0x43a5be=0xc8;}else{_0x43a5be=0xce;}_0x47f2af[_0xcfb8('0x1b')](_0x43a5be);return _0x47f2af[_0xcfb8('0x22')]('Content-Range',_0xb9682f+'-'+_0x18244d+'/'+_0x51eea2)['json'](_0xb6ac87);}return null;};}function patchUpdates(_0x225346){return function(_0x24c827){try{jsonpatch[_0xcfb8('0x23')](_0x24c827,_0x225346,!![]);}catch(_0x43d4df){return BPromise['reject'](_0x43d4df);}return _0x24c827[_0xcfb8('0x24')]();};}function saveUpdates(_0x549212,_0x29ec75){return function(_0x1d661f){if(_0x1d661f){return _0x1d661f['update'](_0x549212)[_0xcfb8('0x25')](function(_0xb7e99){return _0xb7e99;});}return null;};}function removeEntity(_0x2351d,_0x222377){return function(_0x10bbba){if(_0x10bbba){return _0x10bbba[_0xcfb8('0x26')]()['then'](function(){_0x2351d[_0xcfb8('0x1b')](0xcc)[_0xcfb8('0x1c')]();});}};}function handleEntityNotFound(_0x30e33b,_0x50e3ac){return function(_0x2c9c6a){if(!_0x2c9c6a){_0x30e33b['sendStatus'](0x194);}return _0x2c9c6a;};}function handleError(_0x48205f,_0xa00fc4){_0xa00fc4=_0xa00fc4||0x1f4;return function(_0x2188d6){logger[_0xcfb8('0x27')](_0x2188d6[_0xcfb8('0x28')]);if(_0x2188d6[_0xcfb8('0x29')]){delete _0x2188d6[_0xcfb8('0x29')];}_0x48205f['status'](_0xa00fc4)[_0xcfb8('0x2a')](_0x2188d6);};}exports[_0xcfb8('0x2b')]=function(_0x144a5d,_0x134a30){var _0x3502bf={},_0x482ba3={},_0x4ca5a5={'count':0x0,'rows':[]};var _0x470c11=_[_0xcfb8('0x2c')](db[_0xcfb8('0x2d')]['rawAttributes'],function(_0x451621){return{'name':_0x451621['fieldName'],'type':_0x451621['type'][_0xcfb8('0x2e')]};});_0x482ba3[_0xcfb8('0x2f')]=_[_0xcfb8('0x2c')](_0x470c11,'name');_0x482ba3[_0xcfb8('0x30')]=_[_0xcfb8('0x31')](_0x144a5d[_0xcfb8('0x30')]);_0x482ba3['filters']=_[_0xcfb8('0x32')](_0x482ba3[_0xcfb8('0x2f')],_0x482ba3[_0xcfb8('0x30')]);_0x3502bf[_0xcfb8('0x33')]=_[_0xcfb8('0x32')](_0x482ba3[_0xcfb8('0x2f')],qs['fields'](_0x144a5d[_0xcfb8('0x30')][_0xcfb8('0x34')]));_0x3502bf[_0xcfb8('0x33')]=_0x3502bf['attributes']['length']?_0x3502bf[_0xcfb8('0x33')]:_0x482ba3[_0xcfb8('0x2f')];if(!_0x144a5d['query']['hasOwnProperty'](_0xcfb8('0x35'))){_0x3502bf['limit']=qs[_0xcfb8('0x1f')](_0x144a5d[_0xcfb8('0x30')]['limit']);_0x3502bf[_0xcfb8('0x1e')]=qs['offset'](_0x144a5d[_0xcfb8('0x30')][_0xcfb8('0x1e')]);}_0x3502bf[_0xcfb8('0x36')]=qs[_0xcfb8('0x37')](_0x144a5d[_0xcfb8('0x30')][_0xcfb8('0x37')]);_0x3502bf[_0xcfb8('0x38')]=qs[_0xcfb8('0x39')](_['pick'](_0x144a5d[_0xcfb8('0x30')],_0x482ba3[_0xcfb8('0x39')]),_0x470c11);if(_0x144a5d[_0xcfb8('0x30')][_0xcfb8('0x3a')]){_0x3502bf[_0xcfb8('0x38')]=_[_0xcfb8('0x3b')](_0x3502bf[_0xcfb8('0x38')],{'$or':_[_0xcfb8('0x2c')](_0x470c11,function(_0x452e06){if(_0x452e06[_0xcfb8('0x3c')]!=='VIRTUAL'){var _0x16ba96={};_0x16ba96[_0x452e06[_0xcfb8('0x29')]]={'$like':'%'+_0x144a5d[_0xcfb8('0x30')]['filter']+'%'};return _0x16ba96;}})});}_0x3502bf=_[_0xcfb8('0x3b')]({},_0x3502bf,_0x144a5d['options']);var _0x3c3283={'where':_0x3502bf[_0xcfb8('0x38')]};return db[_0xcfb8('0x2d')][_0xcfb8('0x21')](_0x3c3283)['then'](function(_0x57a165){_0x4ca5a5[_0xcfb8('0x21')]=_0x57a165;if(_0x144a5d[_0xcfb8('0x30')]['includeAll']){_0x3502bf['include']=[{'all':!![]}];}return db[_0xcfb8('0x2d')][_0xcfb8('0x3d')](_0x3502bf);})['then'](function(_0x2e2a60){_0x4ca5a5[_0xcfb8('0x3e')]=_0x2e2a60;return _0x4ca5a5;})[_0xcfb8('0x25')](respondWithFilteredResult(_0x134a30,_0x3502bf))[_0xcfb8('0x3f')](handleError(_0x134a30,null));};exports['show']=function(_0x2a5db0,_0xc087c3){var _0x39a543={'raw':!![],'where':{'id':_0x2a5db0['params']['id']}},_0x255cc6={};_0x255cc6[_0xcfb8('0x2f')]=_[_0xcfb8('0x31')](db['VoiceDialReport'][_0xcfb8('0x40')]);_0x255cc6[_0xcfb8('0x30')]=_['keys'](_0x2a5db0['query']);_0x255cc6[_0xcfb8('0x39')]=_['intersection'](_0x255cc6[_0xcfb8('0x2f')],_0x255cc6[_0xcfb8('0x30')]);_0x39a543[_0xcfb8('0x33')]=_[_0xcfb8('0x32')](_0x255cc6['model'],qs[_0xcfb8('0x34')](_0x2a5db0[_0xcfb8('0x30')][_0xcfb8('0x34')]));_0x39a543[_0xcfb8('0x33')]=_0x39a543[_0xcfb8('0x33')][_0xcfb8('0x41')]?_0x39a543[_0xcfb8('0x33')]:_0x255cc6['model'];if(_0x2a5db0[_0xcfb8('0x30')][_0xcfb8('0x42')]){_0x39a543[_0xcfb8('0x43')]=[{'all':!![]}];}_0x39a543=_[_0xcfb8('0x3b')]({},_0x39a543,_0x2a5db0['options']);return db[_0xcfb8('0x2d')][_0xcfb8('0x44')](_0x39a543)[_0xcfb8('0x25')](handleEntityNotFound(_0xc087c3,null))[_0xcfb8('0x25')](respondWithResult(_0xc087c3,null))['catch'](handleError(_0xc087c3,null));};exports['create']=function(_0x5b66cc,_0x4142d5){return db[_0xcfb8('0x2d')][_0xcfb8('0x45')](_0x5b66cc[_0xcfb8('0x46')],{})[_0xcfb8('0x25')](respondWithResult(_0x4142d5,0xc9))[_0xcfb8('0x3f')](handleError(_0x4142d5,null));};exports[_0xcfb8('0x47')]=function(_0x4a92a1,_0x41ded9){if(_0x4a92a1[_0xcfb8('0x46')]['id']){delete _0x4a92a1['body']['id'];}return db[_0xcfb8('0x2d')]['find']({'where':{'id':_0x4a92a1[_0xcfb8('0x48')]['id']}})[_0xcfb8('0x25')](handleEntityNotFound(_0x41ded9,null))[_0xcfb8('0x25')](saveUpdates(_0x4a92a1[_0xcfb8('0x46')],null))[_0xcfb8('0x25')](respondWithResult(_0x41ded9,null))[_0xcfb8('0x3f')](handleError(_0x41ded9,null));};exports[_0xcfb8('0x26')]=function(_0x5cb28a,_0x53b875){return db[_0xcfb8('0x2d')]['find']({'where':{'id':_0x5cb28a[_0xcfb8('0x48')]['id']}})['then'](handleEntityNotFound(_0x53b875,null))['then'](removeEntity(_0x53b875,null))['catch'](handleError(_0x53b875,null));};exports[_0xcfb8('0x49')]=function(_0x3103b7,_0x4c2ee8){return db['VoiceDialReport'][_0xcfb8('0x49')]()[_0xcfb8('0x25')](respondWithResult(_0x4c2ee8,null))[_0xcfb8('0x3f')](handleError(_0x4c2ee8,null));}; \ No newline at end of file diff --git a/server/api/voiceDialReport/voiceDialReport.model.js b/server/api/voiceDialReport/voiceDialReport.model.js index 09801a2..0d7bd1b 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 _0x2123=['bluebird','request-promise','path','rimraf','../../config/environment','./voiceDialReport.attributes','exports','define','VoiceDialReport','uniqueid','lodash','util','../../config/logger','api','moment'];(function(_0x397e5f,_0x454c8f){var _0x5302b8=function(_0x1a29ef){while(--_0x1a29ef){_0x397e5f['push'](_0x397e5f['shift']());}};_0x5302b8(++_0x454c8f);}(_0x2123,0x190));var _0x3212=function(_0x3fcaf6,_0x5d3940){_0x3fcaf6=_0x3fcaf6-0x0;var _0x42eb77=_0x2123[_0x3fcaf6];return _0x42eb77;};'use strict';var _=require(_0x3212('0x0'));var util=require(_0x3212('0x1'));var logger=require(_0x3212('0x2'))(_0x3212('0x3'));var moment=require(_0x3212('0x4'));var BPromise=require(_0x3212('0x5'));var rp=require(_0x3212('0x6'));var fs=require('fs');var path=require(_0x3212('0x7'));var rimraf=require(_0x3212('0x8'));var config=require(_0x3212('0x9'));var attributes=require(_0x3212('0xa'));module[_0x3212('0xb')]=function(_0x5d9d36,_0x3859e4){return _0x5d9d36[_0x3212('0xc')](_0x3212('0xd'),attributes,{'tableName':'report_dial','paranoid':![],'indexes':[{'fields':[_0x3212('0xe')]}],'timestamps':!![]});}; \ No newline at end of file +var _0x818f=['../../config/logger','api','moment','bluebird','path','rimraf','../../config/environment','./voiceDialReport.attributes','exports','define','VoiceDialReport','uniqueid','lodash','util'];(function(_0x5316d3,_0x5cba98){var _0x27d9fa=function(_0x4c6d92){while(--_0x4c6d92){_0x5316d3['push'](_0x5316d3['shift']());}};_0x27d9fa(++_0x5cba98);}(_0x818f,0x1da));var _0xf818=function(_0x1d7058,_0x5141f8){_0x1d7058=_0x1d7058-0x0;var _0x2c97c3=_0x818f[_0x1d7058];return _0x2c97c3;};'use strict';var _=require(_0xf818('0x0'));var util=require(_0xf818('0x1'));var logger=require(_0xf818('0x2'))(_0xf818('0x3'));var moment=require(_0xf818('0x4'));var BPromise=require(_0xf818('0x5'));var rp=require('request-promise');var fs=require('fs');var path=require(_0xf818('0x6'));var rimraf=require(_0xf818('0x7'));var config=require(_0xf818('0x8'));var attributes=require(_0xf818('0x9'));module[_0xf818('0xa')]=function(_0x41310f,_0x27119b){return _0x41310f[_0xf818('0xb')](_0xf818('0xc'),attributes,{'tableName':'report_dial','paranoid':![],'indexes':[{'fields':[_0xf818('0xd')]}],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/voiceDialReport/voiceDialReport.rpc.js b/server/api/voiceDialReport/voiceDialReport.rpc.js index d5da0a5..2bcd920 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 _0x0b17=['VoiceDialReport,\x20%s,\x20%s','debug','request\x20sent','stringify','error','code','message','result','VoiceDialReport','create','body','options','raw','then','CreateVoiceDialReport','UpdateVoiceDialReport','update','where','attributes','limit','catch','lodash','util','moment','bluebird','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','jayson/promise','client','request','info'];(function(_0x43c34e,_0x1610e0){var _0x4f0250=function(_0x526c95){while(--_0x526c95){_0x43c34e['push'](_0x43c34e['shift']());}};_0x4f0250(++_0x1610e0);}(_0x0b17,0x1ad));var _0x70b1=function(_0x50a463,_0x517a1a){_0x50a463=_0x50a463-0x0;var _0x2971df=_0x0b17[_0x50a463];return _0x2971df;};'use strict';var _=require(_0x70b1('0x0'));var util=require(_0x70b1('0x1'));var moment=require(_0x70b1('0x2'));var BPromise=require(_0x70b1('0x3'));var rs=require('randomstring');var fs=require('fs');var Redis=require(_0x70b1('0x4'));var db=require(_0x70b1('0x5'))['db'];var utils=require(_0x70b1('0x6'));var logger=require(_0x70b1('0x7'))(_0x70b1('0x8'));var config=require('../../config/environment');var jayson=require(_0x70b1('0x9'));var client=jayson[_0x70b1('0xa')]['http']({'port':0x232a});function respondWithRpcPromise(_0x4ddb5b,_0x47830e,_0x53e9a6){return new BPromise(function(_0x53b109,_0x326c46){return client[_0x70b1('0xb')](_0x4ddb5b,_0x53e9a6)['then'](function(_0x17d043){logger[_0x70b1('0xc')](_0x70b1('0xd'),_0x47830e,'request\x20sent');logger[_0x70b1('0xe')]('VoiceDialReport,\x20%s,\x20%s,\x20%s',_0x47830e,_0x70b1('0xf'),JSON[_0x70b1('0x10')](_0x17d043));if(_0x17d043[_0x70b1('0x11')]){if(_0x17d043['error'][_0x70b1('0x12')]===0x1f4){logger['error'](_0x70b1('0xd'),_0x47830e,_0x17d043[_0x70b1('0x11')][_0x70b1('0x13')]);return _0x326c46(_0x17d043[_0x70b1('0x11')][_0x70b1('0x13')]);}logger[_0x70b1('0x11')](_0x70b1('0xd'),_0x47830e,_0x17d043[_0x70b1('0x11')][_0x70b1('0x13')]);return _0x53b109(_0x17d043[_0x70b1('0x11')][_0x70b1('0x13')]);}else{logger[_0x70b1('0xc')](_0x70b1('0xd'),_0x47830e,'request\x20sent');_0x53b109(_0x17d043[_0x70b1('0x14')][_0x70b1('0x13')]);}})['catch'](function(_0x3e9e18){logger[_0x70b1('0x11')](_0x70b1('0xd'),_0x47830e,_0x3e9e18);_0x326c46(_0x3e9e18);});});}exports['CreateVoiceDialReport']=function(_0x5816eb){var _0x4082df=this;return new Promise(function(_0x3cfe92,_0x49fb4f){return db[_0x70b1('0x15')][_0x70b1('0x16')](_0x5816eb[_0x70b1('0x17')],{'raw':_0x5816eb[_0x70b1('0x18')]?_0x5816eb[_0x70b1('0x18')][_0x70b1('0x19')]===undefined?!![]:![]:!![]})[_0x70b1('0x1a')](function(_0x48636d){logger['info'](_0x70b1('0x1b'),_0x5816eb);logger['debug'](_0x70b1('0x1b'),_0x5816eb,JSON[_0x70b1('0x10')](_0x48636d));_0x3cfe92(_0x48636d);})['catch'](function(_0x2a1d4c){logger[_0x70b1('0x11')]('CreateVoiceDialReport',_0x2a1d4c['message'],_0x5816eb);_0x49fb4f(_0x4082df[_0x70b1('0x11')](0x1f4,_0x2a1d4c[_0x70b1('0x13')]));});});};exports[_0x70b1('0x1c')]=function(_0x2776d2){var _0x6e144=this;return new Promise(function(_0xa957ec,_0x1f71a0){return db[_0x70b1('0x15')][_0x70b1('0x1d')](_0x2776d2[_0x70b1('0x17')],{'raw':_0x2776d2[_0x70b1('0x18')]?_0x2776d2[_0x70b1('0x18')]['raw']===undefined?!![]:![]:!![],'individualHooks':!![],'where':_0x2776d2[_0x70b1('0x18')]?_0x2776d2[_0x70b1('0x18')][_0x70b1('0x1e')]||null:null,'attributes':_0x2776d2[_0x70b1('0x18')]?_0x2776d2['options'][_0x70b1('0x1f')]||null:null,'limit':_0x2776d2[_0x70b1('0x18')]?_0x2776d2['options'][_0x70b1('0x20')]||null:null})[_0x70b1('0x1a')](function(_0x128d32){logger[_0x70b1('0xc')](_0x70b1('0x1c'),_0x2776d2);logger[_0x70b1('0xe')](_0x70b1('0x1c'),_0x2776d2,JSON[_0x70b1('0x10')](_0x128d32));_0xa957ec(_0x128d32);})[_0x70b1('0x21')](function(_0x286370){logger['error'](_0x70b1('0x1c'),_0x286370[_0x70b1('0x13')],_0x2776d2);_0x1f71a0(_0x6e144[_0x70b1('0x11')](0x1f4,_0x286370[_0x70b1('0x13')]));});});}; \ No newline at end of file +var _0x1445=['VoiceDialReport,\x20%s,\x20%s','message','info','result','CreateVoiceDialReport','VoiceDialReport','body','options','raw','catch','UpdateVoiceDialReport','update','attributes','limit','util','moment','randomstring','../../mysqldb','../../config/utils','rpc','../../config/environment','jayson/promise','then','request\x20sent','debug','VoiceDialReport,\x20%s,\x20%s,\x20%s','stringify','error','code'];(function(_0x5247f5,_0xf02748){var _0x517e39=function(_0x2cda49){while(--_0x2cda49){_0x5247f5['push'](_0x5247f5['shift']());}};_0x517e39(++_0xf02748);}(_0x1445,0x65));var _0x5144=function(_0x29f6cd,_0x4f0f88){_0x29f6cd=_0x29f6cd-0x0;var _0xb25b30=_0x1445[_0x29f6cd];return _0xb25b30;};'use strict';var _=require('lodash');var util=require(_0x5144('0x0'));var moment=require(_0x5144('0x1'));var BPromise=require('bluebird');var rs=require(_0x5144('0x2'));var fs=require('fs');var Redis=require('ioredis');var db=require(_0x5144('0x3'))['db'];var utils=require(_0x5144('0x4'));var logger=require('../../config/logger')(_0x5144('0x5'));var config=require(_0x5144('0x6'));var jayson=require(_0x5144('0x7'));var client=jayson['client']['http']({'port':0x232a});function respondWithRpcPromise(_0x9f7dec,_0x43e8d0,_0x226a09){return new BPromise(function(_0x1d1db5,_0x345725){return client['request'](_0x9f7dec,_0x226a09)[_0x5144('0x8')](function(_0x227461){logger['info']('VoiceDialReport,\x20%s,\x20%s',_0x43e8d0,_0x5144('0x9'));logger[_0x5144('0xa')](_0x5144('0xb'),_0x43e8d0,_0x5144('0x9'),JSON[_0x5144('0xc')](_0x227461));if(_0x227461[_0x5144('0xd')]){if(_0x227461[_0x5144('0xd')][_0x5144('0xe')]===0x1f4){logger[_0x5144('0xd')](_0x5144('0xf'),_0x43e8d0,_0x227461[_0x5144('0xd')][_0x5144('0x10')]);return _0x345725(_0x227461[_0x5144('0xd')][_0x5144('0x10')]);}logger[_0x5144('0xd')]('VoiceDialReport,\x20%s,\x20%s',_0x43e8d0,_0x227461[_0x5144('0xd')][_0x5144('0x10')]);return _0x1d1db5(_0x227461[_0x5144('0xd')][_0x5144('0x10')]);}else{logger[_0x5144('0x11')](_0x5144('0xf'),_0x43e8d0,_0x5144('0x9'));_0x1d1db5(_0x227461[_0x5144('0x12')][_0x5144('0x10')]);}})['catch'](function(_0x90bcc9){logger[_0x5144('0xd')](_0x5144('0xf'),_0x43e8d0,_0x90bcc9);_0x345725(_0x90bcc9);});});}exports[_0x5144('0x13')]=function(_0x93e818){var _0x35b2a3=this;return new Promise(function(_0x291fe9,_0x63dabb){return db[_0x5144('0x14')]['create'](_0x93e818[_0x5144('0x15')],{'raw':_0x93e818[_0x5144('0x16')]?_0x93e818[_0x5144('0x16')][_0x5144('0x17')]===undefined?!![]:![]:!![]})[_0x5144('0x8')](function(_0x5eb9c4){logger['info'](_0x5144('0x13'),_0x93e818);logger[_0x5144('0xa')]('CreateVoiceDialReport',_0x93e818,JSON[_0x5144('0xc')](_0x5eb9c4));_0x291fe9(_0x5eb9c4);})[_0x5144('0x18')](function(_0x53fde1){logger[_0x5144('0xd')](_0x5144('0x13'),_0x53fde1[_0x5144('0x10')],_0x93e818);_0x63dabb(_0x35b2a3['error'](0x1f4,_0x53fde1[_0x5144('0x10')]));});});};exports[_0x5144('0x19')]=function(_0x3dd211){var _0x5389c1=this;return new Promise(function(_0x354e4a,_0x2ada96){return db[_0x5144('0x14')][_0x5144('0x1a')](_0x3dd211['body'],{'raw':_0x3dd211[_0x5144('0x16')]?_0x3dd211[_0x5144('0x16')][_0x5144('0x17')]===undefined?!![]:![]:!![],'individualHooks':!![],'where':_0x3dd211['options']?_0x3dd211['options']['where']||null:null,'attributes':_0x3dd211[_0x5144('0x16')]?_0x3dd211[_0x5144('0x16')][_0x5144('0x1b')]||null:null,'limit':_0x3dd211[_0x5144('0x16')]?_0x3dd211[_0x5144('0x16')][_0x5144('0x1c')]||null:null})[_0x5144('0x8')](function(_0x53c940){logger[_0x5144('0x11')](_0x5144('0x19'),_0x3dd211);logger[_0x5144('0xa')](_0x5144('0x19'),_0x3dd211,JSON[_0x5144('0xc')](_0x53c940));_0x354e4a(_0x53c940);})[_0x5144('0x18')](function(_0x454d5e){logger[_0x5144('0xd')](_0x5144('0x19'),_0x454d5e[_0x5144('0x10')],_0x3dd211);_0x2ada96(_0x5389c1[_0x5144('0xd')](0x1f4,_0x454d5e[_0x5144('0x10')]));});});}; \ No newline at end of file diff --git a/server/api/voiceExtension/index.js b/server/api/voiceExtension/index.js index 2dd453a..c8a9eae 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 _0x6891=['addApplications','put','update','delete','destroy','multer','util','path','connect-timeout','express','fs-extra','../../components/interaction/service','../../config/environment','isAuthenticated','/:id','post','create','/:id/applications'];(function(_0x4f1864,_0x230a6b){var _0x2868ec=function(_0x319d86){while(--_0x319d86){_0x4f1864['push'](_0x4f1864['shift']());}};_0x2868ec(++_0x230a6b);}(_0x6891,0x1b5));var _0x1689=function(_0x1071d6,_0x293323){_0x1071d6=_0x1071d6-0x0;var _0x4c6be4=_0x6891[_0x1071d6];return _0x4c6be4;};'use strict';var multer=require(_0x1689('0x0'));var util=require(_0x1689('0x1'));var path=require(_0x1689('0x2'));var timeout=require(_0x1689('0x3'));var express=require(_0x1689('0x4'));var router=express['Router']();var fs_extra=require(_0x1689('0x5'));var auth=require('../../components/auth/service');var interaction=require(_0x1689('0x6'));var config=require(_0x1689('0x7'));var controller=require('./voiceExtension.controller');router['get']('/',auth[_0x1689('0x8')](),controller['index']);router['get'](_0x1689('0x9'),auth[_0x1689('0x8')](),controller['show']);router[_0x1689('0xa')]('/',auth[_0x1689('0x8')](),controller[_0x1689('0xb')]);router[_0x1689('0xa')](_0x1689('0xc'),auth[_0x1689('0x8')](),controller[_0x1689('0xd')]);router[_0x1689('0xe')](_0x1689('0x9'),auth[_0x1689('0x8')](),controller[_0x1689('0xf')]);router[_0x1689('0x10')](_0x1689('0x9'),auth[_0x1689('0x8')](),controller[_0x1689('0x11')]);module['exports']=router; \ No newline at end of file +var _0x797c=['multer','util','path','connect-timeout','express','Router','../../components/auth/service','../../components/interaction/service','isAuthenticated','index','/:id','show','post','create','addApplications','update','exports'];(function(_0x3e23b2,_0x508205){var _0x477941=function(_0x1de429){while(--_0x1de429){_0x3e23b2['push'](_0x3e23b2['shift']());}};_0x477941(++_0x508205);}(_0x797c,0xee));var _0xc797=function(_0x309d93,_0x157662){_0x309d93=_0x309d93-0x0;var _0x2dd61d=_0x797c[_0x309d93];return _0x2dd61d;};'use strict';var multer=require(_0xc797('0x0'));var util=require(_0xc797('0x1'));var path=require(_0xc797('0x2'));var timeout=require(_0xc797('0x3'));var express=require(_0xc797('0x4'));var router=express[_0xc797('0x5')]();var fs_extra=require('fs-extra');var auth=require(_0xc797('0x6'));var interaction=require(_0xc797('0x7'));var config=require('../../config/environment');var controller=require('./voiceExtension.controller');router['get']('/',auth[_0xc797('0x8')](),controller[_0xc797('0x9')]);router['get'](_0xc797('0xa'),auth['isAuthenticated'](),controller[_0xc797('0xb')]);router[_0xc797('0xc')]('/',auth[_0xc797('0x8')](),controller[_0xc797('0xd')]);router['post']('/:id/applications',auth[_0xc797('0x8')](),controller[_0xc797('0xe')]);router['put']('/:id',auth['isAuthenticated'](),controller[_0xc797('0xf')]);router['delete'](_0xc797('0xa'),auth['isAuthenticated'](),controller['destroy']);module[_0xc797('0x10')]=router; \ No newline at end of file diff --git a/server/api/voiceExtension/voiceExtension.attributes.js b/server/api/voiceExtension/voiceExtension.attributes.js index a3b3cfa..c2ace34 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 _0xb7e7=['BOOLEAN','wav','VIRTUAL','getDataValue','sequelize','STRING','NoOp','inbound','outbound','internal','outbound-fax','system','any','*,*,*,*','INTEGER'];(function(_0x4c4fec,_0x3ef349){var _0x1b7e54=function(_0x21bc78){while(--_0x21bc78){_0x4c4fec['push'](_0x4c4fec['shift']());}};_0x1b7e54(++_0x3ef349);}(_0xb7e7,0x121));var _0x7b7e=function(_0xc67528,_0x24e2fb){_0xc67528=_0xc67528-0x0;var _0x38e26d=_0xb7e7[_0xc67528];return _0x38e26d;};'use strict';var Sequelize=require(_0x7b7e('0x0'));module['exports']={'context':{'type':Sequelize[_0x7b7e('0x1')],'allowNull':![],'unique':'compositeIndex','validate':{'notEmpty':!![],'is':/[A-Za-z0-9._\+*!\-\[\]]+$/i}},'exten':{'type':Sequelize[_0x7b7e('0x1')],'allowNull':![],'unique':'compositeIndex'},'priority':{'type':Sequelize[_0x7b7e('0x1')],'allowNull':![],'defaultValue':'1','unique':'compositeIndex'},'tag':{'type':Sequelize[_0x7b7e('0x1')],'allowNull':![],'defaultValue':'--'},'app':{'type':Sequelize[_0x7b7e('0x1')],'allowNull':![],'defaultValue':_0x7b7e('0x2')},'appdata':{'type':Sequelize['STRING'](0x1000),'allowNull':!![],'defaultValue':''},'type':{'type':Sequelize['ENUM'](_0x7b7e('0x3'),_0x7b7e('0x4'),_0x7b7e('0x5'),'inbound-fax',_0x7b7e('0x6'),_0x7b7e('0x7'),_0x7b7e('0x8')),'allowNull':![]},'description':{'type':Sequelize[_0x7b7e('0x1')]},'interval':{'type':Sequelize[_0x7b7e('0x1')],'allowNull':![],'defaultValue':_0x7b7e('0x9')},'IntervalId':{'type':Sequelize[_0x7b7e('0xa')]},'isApp':{'type':Sequelize['BOOLEAN'],'allowNull':![],'defaultValue':![]},'appType':{'type':Sequelize[_0x7b7e('0x1')],'defaultValue':null},'callerID':{'type':Sequelize[_0x7b7e('0x1')],'allowNull':!![]},'record':{'type':Sequelize[_0x7b7e('0xb')],'defaultValue':![]},'cutdigits':{'type':Sequelize[_0x7b7e('0xa')]},'recordingFormat':{'type':Sequelize[_0x7b7e('0x1')],'defaultValue':_0x7b7e('0xc')},'answer':{'type':Sequelize[_0x7b7e('0xb')],'defaultValue':!![]},'name':{'type':Sequelize[_0x7b7e('0xd')],'get':function(){return this[_0x7b7e('0xe')]('exten');}}}; \ No newline at end of file +var _0xe706=['VIRTUAL','getDataValue','exten','sequelize','exports','STRING','compositeIndex','NoOp','ENUM','inbound','outbound','internal','inbound-fax','outbound-fax','system','any','*,*,*,*','INTEGER','BOOLEAN','wav'];(function(_0x3c1b2c,_0x440b45){var _0x4533e9=function(_0x5afd93){while(--_0x5afd93){_0x3c1b2c['push'](_0x3c1b2c['shift']());}};_0x4533e9(++_0x440b45);}(_0xe706,0xa3));var _0x6e70=function(_0x32d457,_0x1a39c9){_0x32d457=_0x32d457-0x0;var _0x338386=_0xe706[_0x32d457];return _0x338386;};'use strict';var Sequelize=require(_0x6e70('0x0'));module[_0x6e70('0x1')]={'context':{'type':Sequelize[_0x6e70('0x2')],'allowNull':![],'unique':'compositeIndex','validate':{'notEmpty':!![],'is':/[A-Za-z0-9._\+*!\-\[\]]+$/i}},'exten':{'type':Sequelize[_0x6e70('0x2')],'allowNull':![],'unique':_0x6e70('0x3')},'priority':{'type':Sequelize[_0x6e70('0x2')],'allowNull':![],'defaultValue':'1','unique':_0x6e70('0x3')},'tag':{'type':Sequelize[_0x6e70('0x2')],'allowNull':![],'defaultValue':'--'},'app':{'type':Sequelize[_0x6e70('0x2')],'allowNull':![],'defaultValue':_0x6e70('0x4')},'appdata':{'type':Sequelize[_0x6e70('0x2')](0x1000),'allowNull':!![],'defaultValue':''},'type':{'type':Sequelize[_0x6e70('0x5')](_0x6e70('0x6'),_0x6e70('0x7'),_0x6e70('0x8'),_0x6e70('0x9'),_0x6e70('0xa'),_0x6e70('0xb'),_0x6e70('0xc')),'allowNull':![]},'description':{'type':Sequelize[_0x6e70('0x2')]},'interval':{'type':Sequelize[_0x6e70('0x2')],'allowNull':![],'defaultValue':_0x6e70('0xd')},'IntervalId':{'type':Sequelize[_0x6e70('0xe')]},'isApp':{'type':Sequelize[_0x6e70('0xf')],'allowNull':![],'defaultValue':![]},'appType':{'type':Sequelize[_0x6e70('0x2')],'defaultValue':null},'callerID':{'type':Sequelize[_0x6e70('0x2')],'allowNull':!![]},'record':{'type':Sequelize[_0x6e70('0xf')],'defaultValue':![]},'cutdigits':{'type':Sequelize['INTEGER']},'recordingFormat':{'type':Sequelize['STRING'],'defaultValue':_0x6e70('0x10')},'answer':{'type':Sequelize[_0x6e70('0xf')],'defaultValue':!![]},'name':{'type':Sequelize[_0x6e70('0x11')],'get':function(){return this[_0x6e70('0x12')](_0x6e70('0x13'));}}}; \ No newline at end of file diff --git a/server/api/voiceExtension/voiceExtension.controller.js b/server/api/voiceExtension/voiceExtension.controller.js index a1db678..6242d62 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 _0xd0f7=['alias','addApplications','sequelize','transaction','Transaction','findOne','VoiceExtensionId','isApp','bulkCreate','findAndCountAll','finally','ioredis','../../components/parsers/qs','../../config/logger','api','../../config/environment','../../mysqldb','redis','defaults','register','status','json','undefined','count','offset','limit','set','Content-Range','then','get','inbound','OutboundRoutes','outbound','InternalRoutes','map','value','includes','type','find','name','end','sendStatus','error','stack','send','index','fieldName','key','query','keys','filters','intersection','model','attributes','fields','length','hasOwnProperty','nolimit','order','sort','where','pick','filter','merge','VIRTUAL','options','VoiceExtension','includeAll','include','findAll','rows','show','params','rawAttributes','catch','destroy','create','body','startsWith','exten','concat','user','Unable\x20to\x20retrieve\x20the\x20current\x20user','InboundRoutes','UserProfileSection','userProfileId','autoAssociation','UserProfileResource','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','update','context','description','recordingFormat','cutdigits','mandatoryDisposition'];(function(_0x7c305b,_0x5512fd){var _0x33260f=function(_0x2bf39d){while(--_0x2bf39d){_0x7c305b['push'](_0x7c305b['shift']());}};_0x33260f(++_0x5512fd);}(_0xd0f7,0x1e6));var _0x7d0f=function(_0x465c69,_0x4f7ef4){_0x465c69=_0x465c69-0x0;var _0x21ca82=_0xd0f7[_0x465c69];return _0x21ca82;};'use strict';var _=require('lodash');var Redis=require(_0x7d0f('0x0'));var qs=require(_0x7d0f('0x1'));var logger=require(_0x7d0f('0x2'))(_0x7d0f('0x3'));var config=require(_0x7d0f('0x4'));var db=require(_0x7d0f('0x5'))['db'];config[_0x7d0f('0x6')]=_[_0x7d0f('0x7')](config[_0x7d0f('0x6')],{'host':'localhost','port':0x18eb});var socket=require('socket.io-emitter')(new Redis(config[_0x7d0f('0x6')]));require('./voiceExtension.socket')[_0x7d0f('0x8')](socket);function respondWithStatusCode(_0x110667,_0xc1ff17){_0xc1ff17=_0xc1ff17||0xcc;return function(_0x374207){if(_0x374207){return _0x110667['sendStatus'](_0xc1ff17);}return _0x110667['status'](_0xc1ff17)['end']();};}function respondWithResult(_0x531d86,_0x507ce5){_0x507ce5=_0x507ce5||0xc8;return function(_0x5b9b33){if(_0x5b9b33){return _0x531d86[_0x7d0f('0x9')](_0x507ce5)[_0x7d0f('0xa')](_0x5b9b33);}};}function respondWithFilteredResult(_0x18a08f,_0x3592d6){return function(_0x53a634){if(_0x53a634){var _0xde1b7c=typeof _0x3592d6['offset']===_0x7d0f('0xb')&&typeof _0x3592d6['limit']==='undefined';var _0x9299bf=_0x53a634[_0x7d0f('0xc')];var _0x45e738=_0xde1b7c?0x0:_0x3592d6[_0x7d0f('0xd')];var _0x46e242=_0xde1b7c?_0x53a634[_0x7d0f('0xc')]:_0x3592d6[_0x7d0f('0xd')]+_0x3592d6[_0x7d0f('0xe')];var _0x1ab4e3;if(_0x46e242>=_0x9299bf){_0x46e242=_0x9299bf;_0x1ab4e3=0xc8;}else{_0x1ab4e3=0xce;}_0x18a08f[_0x7d0f('0x9')](_0x1ab4e3);return _0x18a08f[_0x7d0f('0xf')](_0x7d0f('0x10'),_0x45e738+'-'+_0x46e242+'/'+_0x9299bf)[_0x7d0f('0xa')](_0x53a634);}return null;};}function removeEntity(_0x3f8f20){return function(_0x164103){if(_0x164103){return _0x164103['destroy']()[_0x7d0f('0x11')](function(){var _0x3d587a=_0x164103[_0x7d0f('0x12')]({'plain':!![]});var _0x138005=[{'name':'InboundRoutes','value':_0x7d0f('0x13'),'ignore':![]},{'name':_0x7d0f('0x14'),'value':_0x7d0f('0x15'),'ignore':![]},{'name':_0x7d0f('0x16'),'value':'internal','ignore':![]}];var _0x11b8c8=_(_0x138005)['filter']('ignore')[_0x7d0f('0x17')](_0x7d0f('0x18'))[_0x7d0f('0x18')]();if(_[_0x7d0f('0x19')](_0x11b8c8,_0x3d587a[_0x7d0f('0x1a')])){return;}var _0xe1bd9e=_[_0x7d0f('0x1b')](_0x138005,[_0x7d0f('0x18'),_0x3d587a['type']])[_0x7d0f('0x1c')];return db['UserProfileResource']['destroy']({'where':{'type':_0xe1bd9e,'resourceId':_0x3d587a['id']}})['then'](function(){return _0x164103;});})['then'](function(){_0x3f8f20[_0x7d0f('0x9')](0xcc)[_0x7d0f('0x1d')]();});}};}function handleEntityNotFound(_0x2ad0dd){return function(_0x39f091){if(!_0x39f091){_0x2ad0dd[_0x7d0f('0x1e')](0x194);}return _0x39f091;};}function handleError(_0x41e482,_0xb9a718){_0xb9a718=_0xb9a718||0x1f4;return function(_0x452c9a){logger[_0x7d0f('0x1f')](_0x452c9a[_0x7d0f('0x20')]);if(_0x452c9a[_0x7d0f('0x1c')]){delete _0x452c9a[_0x7d0f('0x1c')];}_0x41e482[_0x7d0f('0x9')](_0xb9a718)[_0x7d0f('0x21')](_0x452c9a);};}exports[_0x7d0f('0x22')]=function(_0x1290e4,_0x481638){var _0x5ec875={},_0x3e9834={},_0x481754={'count':0x0,'rows':[]};var _0x2a63e1=_[_0x7d0f('0x17')](db['VoiceExtension']['rawAttributes'],function(_0x59cc2e){return{'name':_0x59cc2e[_0x7d0f('0x23')],'type':_0x59cc2e[_0x7d0f('0x1a')][_0x7d0f('0x24')]};});_0x3e9834['model']=_['map'](_0x2a63e1,_0x7d0f('0x1c'));_0x3e9834[_0x7d0f('0x25')]=_[_0x7d0f('0x26')](_0x1290e4[_0x7d0f('0x25')]);_0x3e9834[_0x7d0f('0x27')]=_[_0x7d0f('0x28')](_0x3e9834[_0x7d0f('0x29')],_0x3e9834[_0x7d0f('0x25')]);_0x5ec875[_0x7d0f('0x2a')]=_[_0x7d0f('0x28')](_0x3e9834[_0x7d0f('0x29')],qs[_0x7d0f('0x2b')](_0x1290e4[_0x7d0f('0x25')][_0x7d0f('0x2b')]));_0x5ec875[_0x7d0f('0x2a')]=_0x5ec875[_0x7d0f('0x2a')][_0x7d0f('0x2c')]?_0x5ec875[_0x7d0f('0x2a')]:_0x3e9834[_0x7d0f('0x29')];if(!_0x1290e4['query'][_0x7d0f('0x2d')](_0x7d0f('0x2e'))){_0x5ec875[_0x7d0f('0xe')]=qs[_0x7d0f('0xe')](_0x1290e4['query'][_0x7d0f('0xe')]);_0x5ec875[_0x7d0f('0xd')]=qs[_0x7d0f('0xd')](_0x1290e4[_0x7d0f('0x25')][_0x7d0f('0xd')]);}_0x5ec875[_0x7d0f('0x2f')]=qs[_0x7d0f('0x30')](_0x1290e4[_0x7d0f('0x25')][_0x7d0f('0x30')]);_0x5ec875[_0x7d0f('0x31')]=qs[_0x7d0f('0x27')](_[_0x7d0f('0x32')](_0x1290e4['query'],_0x3e9834[_0x7d0f('0x27')]),_0x2a63e1);if(_0x1290e4['query'][_0x7d0f('0x33')]){_0x5ec875[_0x7d0f('0x31')]=_[_0x7d0f('0x34')](_0x5ec875[_0x7d0f('0x31')],{'$or':_[_0x7d0f('0x17')](_0x2a63e1,function(_0x429035){if(_0x429035[_0x7d0f('0x1a')]!==_0x7d0f('0x35')){var _0x20b755={};_0x20b755[_0x429035[_0x7d0f('0x1c')]]={'$like':'%'+_0x1290e4['query'][_0x7d0f('0x33')]+'%'};return _0x20b755;}})});}_0x5ec875=_[_0x7d0f('0x34')]({},_0x5ec875,_0x1290e4[_0x7d0f('0x36')]);var _0x1e339a={'where':_0x5ec875[_0x7d0f('0x31')]};return db[_0x7d0f('0x37')][_0x7d0f('0xc')](_0x1e339a)['then'](function(_0x5704c1){_0x481754['count']=_0x5704c1;if(_0x1290e4['query'][_0x7d0f('0x38')]){_0x5ec875[_0x7d0f('0x39')]=[{'all':!![]}];}return db[_0x7d0f('0x37')][_0x7d0f('0x3a')](_0x5ec875);})[_0x7d0f('0x11')](function(_0x3ddc52){_0x481754[_0x7d0f('0x3b')]=_0x3ddc52;return _0x481754;})[_0x7d0f('0x11')](respondWithFilteredResult(_0x481638,_0x5ec875))['catch'](handleError(_0x481638,null));};exports[_0x7d0f('0x3c')]=function(_0x42af49,_0x141baa){var _0x43f372={'raw':![],'where':{'id':_0x42af49[_0x7d0f('0x3d')]['id']}},_0x20ff13={};_0x20ff13['model']=_['keys'](db[_0x7d0f('0x37')][_0x7d0f('0x3e')]);_0x20ff13[_0x7d0f('0x25')]=_[_0x7d0f('0x26')](_0x42af49['query']);_0x20ff13[_0x7d0f('0x27')]=_[_0x7d0f('0x28')](_0x20ff13['model'],_0x20ff13['query']);_0x43f372[_0x7d0f('0x2a')]=_['intersection'](_0x20ff13[_0x7d0f('0x29')],qs[_0x7d0f('0x2b')](_0x42af49[_0x7d0f('0x25')]['fields']));_0x43f372[_0x7d0f('0x2a')]=_0x43f372[_0x7d0f('0x2a')][_0x7d0f('0x2c')]?_0x43f372[_0x7d0f('0x2a')]:_0x20ff13[_0x7d0f('0x29')];if(_0x42af49['query'][_0x7d0f('0x38')]){_0x43f372[_0x7d0f('0x39')]=[{'all':!![]}];}_0x43f372=_[_0x7d0f('0x34')]({},_0x43f372,_0x42af49[_0x7d0f('0x36')]);return db[_0x7d0f('0x37')][_0x7d0f('0x1b')](_0x43f372)[_0x7d0f('0x11')](handleEntityNotFound(_0x141baa,null))[_0x7d0f('0x11')](respondWithResult(_0x141baa,null))[_0x7d0f('0x3f')](handleError(_0x141baa,null));};exports[_0x7d0f('0x40')]=function(_0x1b51e8,_0x2da788){return db[_0x7d0f('0x37')][_0x7d0f('0x1b')]({'where':{'id':_0x1b51e8[_0x7d0f('0x3d')]['id']}})[_0x7d0f('0x11')](handleEntityNotFound(_0x2da788,null))[_0x7d0f('0x11')](removeEntity(_0x2da788,null))[_0x7d0f('0x3f')](handleError(_0x2da788,null));};exports[_0x7d0f('0x41')]=function(_0x105252,_0xe8d78b){if(_0x105252[_0x7d0f('0x42')]['type']===_0x7d0f('0x15')&&!_[_0x7d0f('0x43')](_0x105252[_0x7d0f('0x42')]['exten'],'_')){_0x105252[_0x7d0f('0x42')][_0x7d0f('0x44')]='_'[_0x7d0f('0x45')](_0x105252['body'][_0x7d0f('0x44')]);}return db['VoiceExtension']['create'](_0x105252[_0x7d0f('0x42')],{'raw':![]})['then'](function(_0x8d543f){var _0x3c87f4=_0x105252[_0x7d0f('0x46')][_0x7d0f('0x12')]({'plain':!![]});if(!_0x3c87f4)throw new Error(_0x7d0f('0x47'));if(_0x3c87f4['role']===_0x7d0f('0x46')){var _0x886d3b=_0x8d543f[_0x7d0f('0x12')]({'plain':!![]});var _0x28a4b7=[{'name':_0x7d0f('0x48'),'value':_0x7d0f('0x13')},{'name':_0x7d0f('0x14'),'value':_0x7d0f('0x15')},{'name':_0x7d0f('0x16'),'value':'internal'}];var _0x25f3dc=_[_0x7d0f('0x1b')](_0x28a4b7,[_0x7d0f('0x18'),_0x886d3b[_0x7d0f('0x1a')]])[_0x7d0f('0x1c')];return db[_0x7d0f('0x49')]['find']({'where':{'name':_0x25f3dc,'userProfileId':_0x3c87f4[_0x7d0f('0x4a')]},'raw':!![]})[_0x7d0f('0x11')](function(_0xa4fa19){if(_0xa4fa19&&_0xa4fa19[_0x7d0f('0x4b')]===0x0){return db[_0x7d0f('0x4c')][_0x7d0f('0x41')]({'name':_0x886d3b[_0x7d0f('0x1c')],'resourceId':_0x886d3b['id'],'type':_0xa4fa19[_0x7d0f('0x1c')],'sectionId':_0xa4fa19['id']},{})[_0x7d0f('0x11')](function(){return _0x8d543f;});}else{return _0x8d543f;}})[_0x7d0f('0x3f')](function(_0x407ab3){logger['error'](_0x7d0f('0x4d'),_0x407ab3);throw _0x407ab3;});}return _0x8d543f;})[_0x7d0f('0x11')](respondWithResult(_0xe8d78b,0xc9))[_0x7d0f('0x3f')](handleError(_0xe8d78b,null));};exports['update']=function(_0x5e5492,_0x1ee11c){if(_0x5e5492[_0x7d0f('0x42')]['id']){delete _0x5e5492[_0x7d0f('0x42')]['id'];}return db[_0x7d0f('0x37')][_0x7d0f('0x1b')]({'where':{'id':_0x5e5492['params']['id']}})['then'](handleEntityNotFound(_0x1ee11c,null))[_0x7d0f('0x11')](function(_0x582295){if(_0x582295){return db[_0x7d0f('0x37')][_0x7d0f('0x4e')](_[_0x7d0f('0x32')](_0x5e5492[_0x7d0f('0x42')],[_0x7d0f('0x44'),_0x7d0f('0x4f'),_0x7d0f('0x50'),_0x7d0f('0x51'),_0x7d0f('0x52'),_0x7d0f('0x53'),_0x7d0f('0x54')]),{'where':{'context':_0x582295[_0x7d0f('0x4f')],'exten':_0x582295['exten']},'individualHooks':!![]})[_0x7d0f('0x11')](function(_0x3d49ce){return _0x3d49ce;});}return null;})[_0x7d0f('0x11')](respondWithStatusCode(_0x1ee11c,null))['catch'](handleError(_0x1ee11c,null));};exports[_0x7d0f('0x55')]=function(_0x5d3537,_0x2c7c91){var _0x3b6647=_0x5d3537['params']['id'];var _0x5c9708=_0x5d3537['body'];var _0x581825=0xc8;var _0x1476e2=null;return db[_0x7d0f('0x56')][_0x7d0f('0x57')]({'isolationLevel':db[_0x7d0f('0x56')][_0x7d0f('0x58')]['ISOLATION_LEVELS']['READ_COMMITTED']},function(_0x4b953a){return db[_0x7d0f('0x37')][_0x7d0f('0x59')]({'where':{'id':_0x3b6647},'transaction':_0x4b953a})[_0x7d0f('0x11')](function(_0x3233a6){if(_0x3233a6){return db['VoiceExtension'][_0x7d0f('0x40')]({'where':{'VoiceExtensionId':_0x3b6647},'transaction':_0x4b953a})[_0x7d0f('0x11')](function(){var _0x8cb67c=_[_0x7d0f('0x17')](_0x5c9708,function(_0x2b3c82){_0x2b3c82[_0x7d0f('0x5a')]=_0x3b6647;_0x2b3c82[_0x7d0f('0x5b')]=!![];return _0x2b3c82;});return _0x3233a6['createRouting'](_0x8cb67c);})[_0x7d0f('0x11')](function(_0x1ac9c8){return db['VoiceExtension'][_0x7d0f('0x5c')](_0x1ac9c8,{'transaction':_0x4b953a});});}else{_0x581825=0x194;_0x1476e2=[];}});})[_0x7d0f('0x11')](function(){if(_0x581825!==0x194){return db['VoiceExtension'][_0x7d0f('0x5d')]({'where':{'isApp':!![],'VoiceExtensionId':_0x3b6647},'order':'cast(priority\x20as\x20unsigned)'})[_0x7d0f('0x11')](function(_0xe1652d){_0x1476e2=_0xe1652d;});}})[_0x7d0f('0x3f')](function(_0x40e1e7){_0x581825=0x1f4;logger['error'](_0x40e1e7['stack']);if(_0x40e1e7[_0x7d0f('0x1c')]){delete _0x40e1e7[_0x7d0f('0x1c')];}_0x1476e2=_0x40e1e7;})[_0x7d0f('0x5e')](function(){if(_0x1476e2===null){_0x2c7c91[_0x7d0f('0x1e')](_0x581825);}else{if(_0x581825===0x1f4){_0x2c7c91['status'](_0x581825)[_0x7d0f('0x21')](_0x1476e2);}else{_0x2c7c91[_0x7d0f('0x9')](_0x581825)[_0x7d0f('0xa')](_0x1476e2);}}});}; \ No newline at end of file +var _0xe07c=['alias','addApplications','params','sequelize','transaction','Transaction','READ_COMMITTED','findOne','VoiceExtensionId','createRouting','bulkCreate','findAndCountAll','cast(priority\x20as\x20unsigned)','finally','lodash','../../components/parsers/qs','../../config/logger','api','../../config/environment','../../mysqldb','redis','defaults','localhost','socket.io-emitter','sendStatus','status','json','offset','undefined','limit','count','set','Content-Range','destroy','then','get','InboundRoutes','inbound','OutboundRoutes','outbound','InternalRoutes','internal','ignore','map','value','includes','type','find','name','UserProfileResource','end','error','stack','send','VoiceExtension','fieldName','key','model','query','keys','filters','intersection','fields','attributes','length','hasOwnProperty','nolimit','order','sort','where','filter','merge','VIRTUAL','options','includeAll','include','rows','catch','show','rawAttributes','create','body','startsWith','exten','Unable\x20to\x20retrieve\x20the\x20current\x20user','autoAssociation','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','update','pick','context','description','recordingFormat','mandatoryDisposition'];(function(_0x13ff4f,_0x4defc2){var _0xd04dee=function(_0x516beb){while(--_0x516beb){_0x13ff4f['push'](_0x13ff4f['shift']());}};_0xd04dee(++_0x4defc2);}(_0xe07c,0x182));var _0xce07=function(_0x1b6186,_0x1ec7f2){_0x1b6186=_0x1b6186-0x0;var _0x186121=_0xe07c[_0x1b6186];return _0x186121;};'use strict';var _=require(_0xce07('0x0'));var Redis=require('ioredis');var qs=require(_0xce07('0x1'));var logger=require(_0xce07('0x2'))(_0xce07('0x3'));var config=require(_0xce07('0x4'));var db=require(_0xce07('0x5'))['db'];config[_0xce07('0x6')]=_[_0xce07('0x7')](config['redis'],{'host':_0xce07('0x8'),'port':0x18eb});var socket=require(_0xce07('0x9'))(new Redis(config[_0xce07('0x6')]));require('./voiceExtension.socket')['register'](socket);function respondWithStatusCode(_0x7fd4f9,_0x965254){_0x965254=_0x965254||0xcc;return function(_0xfd7cc){if(_0xfd7cc){return _0x7fd4f9[_0xce07('0xa')](_0x965254);}return _0x7fd4f9[_0xce07('0xb')](_0x965254)['end']();};}function respondWithResult(_0x2ead44,_0x3c4746){_0x3c4746=_0x3c4746||0xc8;return function(_0x186191){if(_0x186191){return _0x2ead44['status'](_0x3c4746)[_0xce07('0xc')](_0x186191);}};}function respondWithFilteredResult(_0x1728a2,_0x278e9d){return function(_0x5d02e1){if(_0x5d02e1){var _0x5d953e=typeof _0x278e9d[_0xce07('0xd')]===_0xce07('0xe')&&typeof _0x278e9d[_0xce07('0xf')]===_0xce07('0xe');var _0x58672d=_0x5d02e1[_0xce07('0x10')];var _0x378dee=_0x5d953e?0x0:_0x278e9d['offset'];var _0x576fb6=_0x5d953e?_0x5d02e1[_0xce07('0x10')]:_0x278e9d[_0xce07('0xd')]+_0x278e9d['limit'];var _0x4782ed;if(_0x576fb6>=_0x58672d){_0x576fb6=_0x58672d;_0x4782ed=0xc8;}else{_0x4782ed=0xce;}_0x1728a2[_0xce07('0xb')](_0x4782ed);return _0x1728a2[_0xce07('0x11')](_0xce07('0x12'),_0x378dee+'-'+_0x576fb6+'/'+_0x58672d)[_0xce07('0xc')](_0x5d02e1);}return null;};}function removeEntity(_0x2fd949){return function(_0x54644f){if(_0x54644f){return _0x54644f[_0xce07('0x13')]()[_0xce07('0x14')](function(){var _0x53dae0=_0x54644f[_0xce07('0x15')]({'plain':!![]});var _0x4deb4d=[{'name':_0xce07('0x16'),'value':_0xce07('0x17'),'ignore':![]},{'name':_0xce07('0x18'),'value':_0xce07('0x19'),'ignore':![]},{'name':_0xce07('0x1a'),'value':_0xce07('0x1b'),'ignore':![]}];var _0x52437a=_(_0x4deb4d)['filter'](_0xce07('0x1c'))[_0xce07('0x1d')](_0xce07('0x1e'))[_0xce07('0x1e')]();if(_[_0xce07('0x1f')](_0x52437a,_0x53dae0[_0xce07('0x20')])){return;}var _0x2a1e42=_[_0xce07('0x21')](_0x4deb4d,['value',_0x53dae0[_0xce07('0x20')]])[_0xce07('0x22')];return db[_0xce07('0x23')][_0xce07('0x13')]({'where':{'type':_0x2a1e42,'resourceId':_0x53dae0['id']}})[_0xce07('0x14')](function(){return _0x54644f;});})['then'](function(){_0x2fd949[_0xce07('0xb')](0xcc)[_0xce07('0x24')]();});}};}function handleEntityNotFound(_0x5b5edd){return function(_0x26c0c9){if(!_0x26c0c9){_0x5b5edd[_0xce07('0xa')](0x194);}return _0x26c0c9;};}function handleError(_0x7ebeaa,_0x1c718e){_0x1c718e=_0x1c718e||0x1f4;return function(_0x201597){logger[_0xce07('0x25')](_0x201597[_0xce07('0x26')]);if(_0x201597[_0xce07('0x22')]){delete _0x201597[_0xce07('0x22')];}_0x7ebeaa[_0xce07('0xb')](_0x1c718e)[_0xce07('0x27')](_0x201597);};}exports['index']=function(_0x5b5b40,_0x4fa845){var _0x2b693b={},_0x5cef01={},_0x4f0f09={'count':0x0,'rows':[]};var _0x37724b=_['map'](db[_0xce07('0x28')]['rawAttributes'],function(_0x399825){return{'name':_0x399825[_0xce07('0x29')],'type':_0x399825['type'][_0xce07('0x2a')]};});_0x5cef01[_0xce07('0x2b')]=_[_0xce07('0x1d')](_0x37724b,'name');_0x5cef01[_0xce07('0x2c')]=_[_0xce07('0x2d')](_0x5b5b40[_0xce07('0x2c')]);_0x5cef01[_0xce07('0x2e')]=_[_0xce07('0x2f')](_0x5cef01[_0xce07('0x2b')],_0x5cef01[_0xce07('0x2c')]);_0x2b693b['attributes']=_[_0xce07('0x2f')](_0x5cef01[_0xce07('0x2b')],qs[_0xce07('0x30')](_0x5b5b40[_0xce07('0x2c')][_0xce07('0x30')]));_0x2b693b[_0xce07('0x31')]=_0x2b693b[_0xce07('0x31')][_0xce07('0x32')]?_0x2b693b[_0xce07('0x31')]:_0x5cef01['model'];if(!_0x5b5b40[_0xce07('0x2c')][_0xce07('0x33')](_0xce07('0x34'))){_0x2b693b[_0xce07('0xf')]=qs[_0xce07('0xf')](_0x5b5b40['query'][_0xce07('0xf')]);_0x2b693b['offset']=qs[_0xce07('0xd')](_0x5b5b40[_0xce07('0x2c')]['offset']);}_0x2b693b[_0xce07('0x35')]=qs[_0xce07('0x36')](_0x5b5b40[_0xce07('0x2c')][_0xce07('0x36')]);_0x2b693b[_0xce07('0x37')]=qs['filters'](_['pick'](_0x5b5b40['query'],_0x5cef01[_0xce07('0x2e')]),_0x37724b);if(_0x5b5b40['query'][_0xce07('0x38')]){_0x2b693b['where']=_[_0xce07('0x39')](_0x2b693b[_0xce07('0x37')],{'$or':_[_0xce07('0x1d')](_0x37724b,function(_0x287cd3){if(_0x287cd3[_0xce07('0x20')]!==_0xce07('0x3a')){var _0x1dbe39={};_0x1dbe39[_0x287cd3[_0xce07('0x22')]]={'$like':'%'+_0x5b5b40[_0xce07('0x2c')]['filter']+'%'};return _0x1dbe39;}})});}_0x2b693b=_[_0xce07('0x39')]({},_0x2b693b,_0x5b5b40[_0xce07('0x3b')]);var _0x228249={'where':_0x2b693b[_0xce07('0x37')]};return db[_0xce07('0x28')][_0xce07('0x10')](_0x228249)[_0xce07('0x14')](function(_0x30a37b){_0x4f0f09['count']=_0x30a37b;if(_0x5b5b40[_0xce07('0x2c')][_0xce07('0x3c')]){_0x2b693b[_0xce07('0x3d')]=[{'all':!![]}];}return db['VoiceExtension']['findAll'](_0x2b693b);})[_0xce07('0x14')](function(_0x3aab0d){_0x4f0f09[_0xce07('0x3e')]=_0x3aab0d;return _0x4f0f09;})[_0xce07('0x14')](respondWithFilteredResult(_0x4fa845,_0x2b693b))[_0xce07('0x3f')](handleError(_0x4fa845,null));};exports[_0xce07('0x40')]=function(_0x3d3fbd,_0x3243e3){var _0x7452c3={'raw':![],'where':{'id':_0x3d3fbd['params']['id']}},_0x1dedba={};_0x1dedba['model']=_[_0xce07('0x2d')](db['VoiceExtension'][_0xce07('0x41')]);_0x1dedba[_0xce07('0x2c')]=_[_0xce07('0x2d')](_0x3d3fbd[_0xce07('0x2c')]);_0x1dedba[_0xce07('0x2e')]=_[_0xce07('0x2f')](_0x1dedba['model'],_0x1dedba[_0xce07('0x2c')]);_0x7452c3[_0xce07('0x31')]=_['intersection'](_0x1dedba[_0xce07('0x2b')],qs[_0xce07('0x30')](_0x3d3fbd[_0xce07('0x2c')][_0xce07('0x30')]));_0x7452c3['attributes']=_0x7452c3[_0xce07('0x31')]['length']?_0x7452c3[_0xce07('0x31')]:_0x1dedba[_0xce07('0x2b')];if(_0x3d3fbd[_0xce07('0x2c')][_0xce07('0x3c')]){_0x7452c3[_0xce07('0x3d')]=[{'all':!![]}];}_0x7452c3=_[_0xce07('0x39')]({},_0x7452c3,_0x3d3fbd['options']);return db[_0xce07('0x28')][_0xce07('0x21')](_0x7452c3)['then'](handleEntityNotFound(_0x3243e3,null))['then'](respondWithResult(_0x3243e3,null))[_0xce07('0x3f')](handleError(_0x3243e3,null));};exports[_0xce07('0x13')]=function(_0x4e5e49,_0x2ffb0b){return db[_0xce07('0x28')][_0xce07('0x21')]({'where':{'id':_0x4e5e49['params']['id']}})['then'](handleEntityNotFound(_0x2ffb0b,null))['then'](removeEntity(_0x2ffb0b,null))[_0xce07('0x3f')](handleError(_0x2ffb0b,null));};exports[_0xce07('0x42')]=function(_0x43a5d8,_0x40dc73){if(_0x43a5d8[_0xce07('0x43')][_0xce07('0x20')]===_0xce07('0x19')&&!_[_0xce07('0x44')](_0x43a5d8[_0xce07('0x43')]['exten'],'_')){_0x43a5d8[_0xce07('0x43')][_0xce07('0x45')]='_'['concat'](_0x43a5d8[_0xce07('0x43')]['exten']);}return db[_0xce07('0x28')][_0xce07('0x42')](_0x43a5d8[_0xce07('0x43')],{'raw':![]})[_0xce07('0x14')](function(_0x3a8196){var _0x28aeb2=_0x43a5d8['user'][_0xce07('0x15')]({'plain':!![]});if(!_0x28aeb2)throw new Error(_0xce07('0x46'));if(_0x28aeb2['role']==='user'){var _0x5ceb7=_0x3a8196[_0xce07('0x15')]({'plain':!![]});var _0x166c8e=[{'name':_0xce07('0x16'),'value':_0xce07('0x17')},{'name':_0xce07('0x18'),'value':_0xce07('0x19')},{'name':'InternalRoutes','value':_0xce07('0x1b')}];var _0x483ce8=_[_0xce07('0x21')](_0x166c8e,[_0xce07('0x1e'),_0x5ceb7[_0xce07('0x20')]])[_0xce07('0x22')];return db['UserProfileSection'][_0xce07('0x21')]({'where':{'name':_0x483ce8,'userProfileId':_0x28aeb2['userProfileId']},'raw':!![]})[_0xce07('0x14')](function(_0x1072ce){if(_0x1072ce&&_0x1072ce[_0xce07('0x47')]===0x0){return db[_0xce07('0x23')]['create']({'name':_0x5ceb7[_0xce07('0x22')],'resourceId':_0x5ceb7['id'],'type':_0x1072ce[_0xce07('0x22')],'sectionId':_0x1072ce['id']},{})[_0xce07('0x14')](function(){return _0x3a8196;});}else{return _0x3a8196;}})[_0xce07('0x3f')](function(_0x31cb05){logger[_0xce07('0x25')](_0xce07('0x48'),_0x31cb05);throw _0x31cb05;});}return _0x3a8196;})[_0xce07('0x14')](respondWithResult(_0x40dc73,0xc9))[_0xce07('0x3f')](handleError(_0x40dc73,null));};exports[_0xce07('0x49')]=function(_0x18997b,_0x45a725){if(_0x18997b[_0xce07('0x43')]['id']){delete _0x18997b[_0xce07('0x43')]['id'];}return db[_0xce07('0x28')]['find']({'where':{'id':_0x18997b['params']['id']}})[_0xce07('0x14')](handleEntityNotFound(_0x45a725,null))['then'](function(_0x1ef55f){if(_0x1ef55f){return db['VoiceExtension'][_0xce07('0x49')](_[_0xce07('0x4a')](_0x18997b[_0xce07('0x43')],['exten',_0xce07('0x4b'),_0xce07('0x4c'),_0xce07('0x4d'),'cutdigits',_0xce07('0x4e'),_0xce07('0x4f')]),{'where':{'context':_0x1ef55f['context'],'exten':_0x1ef55f[_0xce07('0x45')]},'individualHooks':!![]})[_0xce07('0x14')](function(_0x576be5){return _0x576be5;});}return null;})[_0xce07('0x14')](respondWithStatusCode(_0x45a725,null))[_0xce07('0x3f')](handleError(_0x45a725,null));};exports[_0xce07('0x50')]=function(_0x4980fb,_0x4bf60e){var _0x29e558=_0x4980fb[_0xce07('0x51')]['id'];var _0x9c0906=_0x4980fb[_0xce07('0x43')];var _0x28692c=0xc8;var _0x454f33=null;return db[_0xce07('0x52')][_0xce07('0x53')]({'isolationLevel':db['sequelize'][_0xce07('0x54')]['ISOLATION_LEVELS'][_0xce07('0x55')]},function(_0x2a2ddc){return db[_0xce07('0x28')][_0xce07('0x56')]({'where':{'id':_0x29e558},'transaction':_0x2a2ddc})[_0xce07('0x14')](function(_0x27d3da){if(_0x27d3da){return db[_0xce07('0x28')][_0xce07('0x13')]({'where':{'VoiceExtensionId':_0x29e558},'transaction':_0x2a2ddc})[_0xce07('0x14')](function(){var _0x301c40=_[_0xce07('0x1d')](_0x9c0906,function(_0x410a57){_0x410a57[_0xce07('0x57')]=_0x29e558;_0x410a57['isApp']=!![];return _0x410a57;});return _0x27d3da[_0xce07('0x58')](_0x301c40);})[_0xce07('0x14')](function(_0x6442f1){return db[_0xce07('0x28')][_0xce07('0x59')](_0x6442f1,{'transaction':_0x2a2ddc});});}else{_0x28692c=0x194;_0x454f33=[];}});})[_0xce07('0x14')](function(){if(_0x28692c!==0x194){return db[_0xce07('0x28')][_0xce07('0x5a')]({'where':{'isApp':!![],'VoiceExtensionId':_0x29e558},'order':_0xce07('0x5b')})['then'](function(_0x22c122){_0x454f33=_0x22c122;});}})[_0xce07('0x3f')](function(_0x55784b){_0x28692c=0x1f4;logger[_0xce07('0x25')](_0x55784b['stack']);if(_0x55784b[_0xce07('0x22')]){delete _0x55784b[_0xce07('0x22')];}_0x454f33=_0x55784b;})[_0xce07('0x5c')](function(){if(_0x454f33===null){_0x4bf60e[_0xce07('0xa')](_0x28692c);}else{if(_0x28692c===0x1f4){_0x4bf60e[_0xce07('0xb')](_0x28692c)[_0xce07('0x27')](_0x454f33);}else{_0x4bf60e[_0xce07('0xb')](_0x28692c)[_0xce07('0xc')](_0x454f33);}}});}; \ No newline at end of file diff --git a/server/api/voiceExtension/voiceExtension.events.js b/server/api/voiceExtension/voiceExtension.events.js index e796f97..81c07e8 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 _0x1c12=['remove','emit','hasOwnProperty','hook','events','VoiceExtension','setMaxListeners'];(function(_0x4314c4,_0x4a21db){var _0x315931=function(_0x38e0c7){while(--_0x38e0c7){_0x4314c4['push'](_0x4314c4['shift']());}};_0x315931(++_0x4a21db);}(_0x1c12,0x89));var _0x21c1=function(_0x4ea6e9,_0x58b52c){_0x4ea6e9=_0x4ea6e9-0x0;var _0x5e8988=_0x1c12[_0x4ea6e9];return _0x5e8988;};'use strict';var EventEmitter=require(_0x21c1('0x0'));var VoiceExtension=require('../../mysqldb')['db'][_0x21c1('0x1')];var VoiceExtensionEvents=new EventEmitter();VoiceExtensionEvents[_0x21c1('0x2')](0x0);var events={'afterCreate':'save','afterUpdate':'update','afterDestroy':_0x21c1('0x3')};function emitEvent(_0xa3df6){return function(_0x1e0f56,_0x192ad9,_0x5c71fd){VoiceExtensionEvents['emit'](_0xa3df6+':'+_0x1e0f56['id'],_0x1e0f56);VoiceExtensionEvents[_0x21c1('0x4')](_0xa3df6,_0x1e0f56);_0x5c71fd(null);};}for(var e in events){if(events[_0x21c1('0x5')](e)){var event=events[e];VoiceExtension[_0x21c1('0x6')](e,emitEvent(event));}}module['exports']=VoiceExtensionEvents; \ No newline at end of file +var _0x992c=['hasOwnProperty','exports','events','../../mysqldb','VoiceExtension','update','remove','emit'];(function(_0x581fac,_0x165cbc){var _0x207776=function(_0x3a2b5e){while(--_0x3a2b5e){_0x581fac['push'](_0x581fac['shift']());}};_0x207776(++_0x165cbc);}(_0x992c,0x102));var _0xc992=function(_0x1f7ed8,_0x2cc952){_0x1f7ed8=_0x1f7ed8-0x0;var _0x226012=_0x992c[_0x1f7ed8];return _0x226012;};'use strict';var EventEmitter=require(_0xc992('0x0'));var VoiceExtension=require(_0xc992('0x1'))['db'][_0xc992('0x2')];var VoiceExtensionEvents=new EventEmitter();VoiceExtensionEvents['setMaxListeners'](0x0);var events={'afterCreate':'save','afterUpdate':_0xc992('0x3'),'afterDestroy':_0xc992('0x4')};function emitEvent(_0x2e2200){return function(_0x460c43,_0x184703,_0x4139fa){VoiceExtensionEvents['emit'](_0x2e2200+':'+_0x460c43['id'],_0x460c43);VoiceExtensionEvents[_0xc992('0x5')](_0x2e2200,_0x460c43);_0x4139fa(null);};}for(var e in events){if(events[_0xc992('0x6')](e)){var event=events[e];VoiceExtension['hook'](e,emitEvent(event));}}module[_0xc992('0x7')]=VoiceExtensionEvents; \ No newline at end of file diff --git a/server/api/voiceExtension/voiceExtension.model.js b/server/api/voiceExtension/voiceExtension.model.js index fb8536f..035412d 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 _0x3a05=['type','exten','inbound','push','context','XCALLY-MOTION-ANSWER=0','XCALLY-MOTION-PROGRESS=0','MONITOR_OPTIONS=ab','outbound','CDR(type)=outbound','CDR(destination)=','cutdigits','${EXTEN:','${EXTEN}','CDR(routeid)=','ExecIf','):Goto(','CDR(prefix)=${EXTEN:0:','CDR(prefix)=noprefix','recordingFormat','_XCALLY_MIXMONITOR_UNIQUEID=${UNIQUEID}','wav','trunk','options','url','split','length','name','param','phone','prefix','SIP','join','none','indexOf','U(xcally-mixmonitor-context)','replace','isEmpty','Interval','findAll','interval','IntervalId','then','intervals','filter','hasOwnProperty','tag','toLowerCase','CDR(tag)=','$[${LEN(${PREFIX-CALLERIDALL})}\x20>\x200]?Set(CALLERID(all)=${PREFIX-CALLERIDALL}):','Set(CALLERID(all)=','callerID','queue','playback','includes','app','appType','custom','answer','$[${XCALLY-MOTION-PROGRESS}=0]?Progress','XCALLY-MOTION-PROGRESS=1','splice','GotoIfTime',',${EXTEN},','outboundDial','appdata','XMCS-UNIQUEID=${CHANNEL(LINKEDID)}','priority','last','concat','catch','define','VoiceExtension','voice_extensions','get','Hangup','lodash','./voiceExtension.attributes','exports','Set','CDR(type)='];(function(_0x36450b,_0x2e17ee){var _0x333864=function(_0x3ed5a6){while(--_0x3ed5a6){_0x36450b['push'](_0x36450b['shift']());}};_0x333864(++_0x2e17ee);}(_0x3a05,0x9d));var _0x53a0=function(_0x54d849,_0x509049){_0x54d849=_0x54d849-0x0;var _0x174f32=_0x3a05[_0x54d849];return _0x174f32;};'use strict';var _=require(_0x53a0('0x0'));var attributes=require(_0x53a0('0x1'));module[_0x53a0('0x2')]=function(_0x57e97b){var _0x504edf=_0x57e97b['models'];function _0x184e8c(_0x324dc0){var _0x27ece0=0x2;var _0x5c375d=[{'type':_0x324dc0['type'],'app':_0x53a0('0x3'),'appdata':_0x53a0('0x4')+_0x324dc0[_0x53a0('0x5')],'context':_0x324dc0['context'],'exten':_0x324dc0[_0x53a0('0x6')],'priority':_0x27ece0++,'VoiceExtensionId':_0x324dc0['id']}];if(_0x324dc0[_0x53a0('0x5')]===_0x53a0('0x7')){_0x5c375d[_0x53a0('0x8')]({'type':_0x53a0('0x7'),'app':_0x53a0('0x3'),'appdata':'CDR(routeid)='+_0x324dc0['id'],'context':_0x324dc0[_0x53a0('0x9')],'exten':_0x324dc0[_0x53a0('0x6')],'priority':_0x27ece0++,'VoiceExtensionId':_0x324dc0['id']});}_0x5c375d['push']({'type':_0x324dc0['type'],'app':'Set','appdata':_0x53a0('0xa'),'context':_0x324dc0[_0x53a0('0x9')],'exten':_0x324dc0[_0x53a0('0x6')],'priority':_0x27ece0++,'VoiceExtensionId':_0x324dc0['id']},{'type':_0x324dc0['type'],'app':_0x53a0('0x3'),'appdata':_0x53a0('0xb'),'context':_0x324dc0[_0x53a0('0x9')],'exten':_0x324dc0[_0x53a0('0x6')],'priority':_0x27ece0++,'VoiceExtensionId':_0x324dc0['id']},{'type':_0x324dc0[_0x53a0('0x5')],'app':_0x53a0('0x3'),'appdata':_0x53a0('0xc'),'context':_0x324dc0[_0x53a0('0x9')],'exten':_0x324dc0[_0x53a0('0x6')],'priority':_0x27ece0++,'VoiceExtensionId':_0x324dc0['id']});return _0x5c375d;}function _0x533e7d(_0x2f0ef5){var _0x411bac=0x2;var _0xe7fbef=[{'type':_0x53a0('0xd'),'app':_0x53a0('0x3'),'appdata':_0x53a0('0xe'),'context':_0x2f0ef5[_0x53a0('0x9')],'exten':_0x2f0ef5[_0x53a0('0x6')],'priority':_0x411bac++,'VoiceExtensionId':_0x2f0ef5['id']},{'type':_0x53a0('0xd'),'app':_0x53a0('0x3'),'appdata':_0x53a0('0xf')+(_0x2f0ef5[_0x53a0('0x10')]?_0x53a0('0x11')+_0x2f0ef5[_0x53a0('0x10')]+'}':_0x53a0('0x12')),'context':_0x2f0ef5['context'],'exten':_0x2f0ef5[_0x53a0('0x6')],'priority':_0x411bac++,'VoiceExtensionId':_0x2f0ef5['id']},{'type':_0x53a0('0xd'),'app':_0x53a0('0x3'),'appdata':_0x53a0('0x13')+_0x2f0ef5['id'],'context':_0x2f0ef5[_0x53a0('0x9')],'exten':_0x2f0ef5['exten'],'priority':_0x411bac++,'VoiceExtensionId':_0x2f0ef5['id']},{'type':'outbound','app':_0x53a0('0x14'),'appdata':'$[${LEN(${CDR(prefix)})}\x20>\x200]?Goto('+(_0x411bac+0x2)+_0x53a0('0x15')+(_0x411bac+0x1)+')','context':_0x2f0ef5[_0x53a0('0x9')],'exten':_0x2f0ef5[_0x53a0('0x6')],'priority':_0x411bac++,'VoiceExtensionId':_0x2f0ef5['id']},{'type':'outbound','app':_0x53a0('0x3'),'appdata':_0x2f0ef5[_0x53a0('0x10')]?_0x53a0('0x16')+_0x2f0ef5[_0x53a0('0x10')]+'}':_0x53a0('0x17'),'context':_0x2f0ef5[_0x53a0('0x9')],'exten':_0x2f0ef5[_0x53a0('0x6')],'priority':_0x411bac++,'VoiceExtensionId':_0x2f0ef5['id']},{'type':_0x53a0('0xd'),'app':_0x53a0('0x3'),'appdata':'XCALLY-MOTION-ANSWER=0','context':_0x2f0ef5['context'],'exten':_0x2f0ef5[_0x53a0('0x6')],'priority':_0x411bac++,'VoiceExtensionId':_0x2f0ef5['id']},{'type':'outbound','app':_0x53a0('0x3'),'appdata':_0x53a0('0xb'),'context':_0x2f0ef5[_0x53a0('0x9')],'exten':_0x2f0ef5['exten'],'priority':_0x411bac++,'VoiceExtensionId':_0x2f0ef5['id']},{'type':_0x53a0('0xd'),'app':_0x53a0('0x3'),'appdata':_0x53a0('0xc'),'context':_0x2f0ef5[_0x53a0('0x9')],'exten':_0x2f0ef5[_0x53a0('0x6')],'priority':_0x411bac++,'VoiceExtensionId':_0x2f0ef5['id']},{'type':'outbound','app':'Set','appdata':'outboundrouteid='+_0x2f0ef5['id'],'context':_0x2f0ef5[_0x53a0('0x9')],'exten':_0x2f0ef5[_0x53a0('0x6')],'priority':_0x411bac++,'VoiceExtensionId':_0x2f0ef5['id']}];if(_0x2f0ef5['hasOwnProperty'](_0x53a0('0x18'))&&_0x2f0ef5[_0x53a0('0x18')]!=='none'){_0xe7fbef[_0x53a0('0x8')]({'type':'outbound','app':_0x53a0('0x3'),'appdata':_0x53a0('0x19'),'context':_0x2f0ef5[_0x53a0('0x9')],'exten':_0x2f0ef5[_0x53a0('0x6')],'priority':_0x411bac++,'VoiceExtensionId':_0x2f0ef5['id']},{'type':_0x53a0('0xd'),'app':_0x53a0('0x3'),'appdata':'_XCALLY_MIXMONITOR_FORMAT='+_0x2f0ef5[_0x53a0('0x18')]||_0x53a0('0x1a'),'context':_0x2f0ef5[_0x53a0('0x9')],'exten':_0x2f0ef5[_0x53a0('0x6')],'priority':_0x411bac++,'VoiceExtensionId':_0x2f0ef5['id']});}return _0xe7fbef;}function _0x56a2c0(_0x45064d,_0x21f3c7){var _0x1e0646=[{'name':_0x53a0('0x1b'),'param':0x0},{'name':'timeout','param':0x1},{'name':_0x53a0('0x1c'),'param':0x2},{'name':_0x53a0('0x1d'),'param':0x3}];var _0x19172c={};var _0x53ad6f=_0x21f3c7[_0x53a0('0x1e')](',');var _0x1b400b=[];for(var _0x1bbe72=0x0;_0x1bbe72<_0x1e0646[_0x53a0('0x1f')];_0x1bbe72++){switch(_0x1e0646[_0x1bbe72][_0x53a0('0x20')]){case _0x53a0('0x1b'):_0x19172c['trunk']=_0x53ad6f[_0x1e0646[_0x1bbe72][_0x53a0('0x21')]][_0x53a0('0x1e')]('/')[0x1];_0x19172c[_0x53a0('0x22')]=_0x53ad6f[_0x1e0646[_0x1bbe72]['param']][_0x53a0('0x1e')]('/')[0x2];_0x19172c[_0x53a0('0x23')]=_0x19172c[_0x53a0('0x22')]?_0x19172c[_0x53a0('0x22')]['split']('$')[0x0]:undefined;_0x19172c[_0x53a0('0x22')]=_0x45064d[_0x53a0('0x10')]?(_0x19172c[_0x53a0('0x23')]||'')+_0x53a0('0x11')+_0x45064d[_0x53a0('0x10')]+'}':(_0x19172c[_0x53a0('0x23')]||'')+_0x53a0('0x12');_0x1b400b[_0x1e0646[_0x1bbe72][_0x53a0('0x21')]]=[_0x53a0('0x24'),_0x19172c['trunk'],_0x19172c[_0x53a0('0x22')]][_0x53a0('0x25')]('/');break;case'options':_0x19172c[_0x53a0('0x1c')]=_0x53ad6f[_0x1e0646[_0x1bbe72][_0x53a0('0x21')]];if(_0x45064d[_0x53a0('0x18')]!==_0x53a0('0x26')){if(_0x19172c['options'][_0x53a0('0x27')](_0x53a0('0x28'))<0x0){_0x19172c[_0x53a0('0x1c')]+=_0x53a0('0x28');}}else{_0x19172c[_0x53a0('0x1c')]=_0x19172c[_0x53a0('0x1c')][_0x53a0('0x29')](_0x53a0('0x28'),'');}_0x1b400b[_0x1e0646[_0x1bbe72][_0x53a0('0x21')]]=_0x19172c[_0x53a0('0x1c')];break;default:_0x1b400b[_0x1e0646[_0x1bbe72][_0x53a0('0x21')]]=_0x53ad6f[_0x1e0646[_0x1bbe72][_0x53a0('0x21')]];}}return _0x1b400b[_0x53a0('0x25')](',');}function _0x4bad1c(_0x399ea1,_0x76e314,_0x5db5d3){return new Promise(function(_0x26d1ec,_0x2df901){var _0x20fedf=[];if(_[_0x53a0('0x2a')](_0x76e314))return _0x26d1ec(_0x20fedf);_0x504edf[_0x53a0('0x2b')][_0x53a0('0x2c')]({'attributes':['id',_0x53a0('0x2d'),_0x53a0('0x2e')],'raw':!![]})[_0x53a0('0x2f')](function(_0x4d4a35){for(var _0x4077f2=0x0,_0xe01b93=0x0;_0x4077f2<_0x76e314[_0x53a0('0x1f')];_0x4077f2++,_0xe01b93=0x0){var _0x293204=_0x76e314[_0x4077f2];var _0xa5ae92=[];var _0x55e2cf=[];delete _0x293204['id'];if(_0x293204['interval']!=='*,*,*,*'){_0x293204['intervals']=[_0x293204[_0x53a0('0x2d')]];}else{_0x293204[_0x53a0('0x30')]=_0x293204['IntervalId']?_['map'](_[_0x53a0('0x31')](_0x4d4a35,{'IntervalId':_0x293204[_0x53a0('0x2e')]}),_0x53a0('0x2d')):[];}_0x293204[_0x53a0('0x9')]=_0x399ea1[_0x53a0('0x9')];_0x293204[_0x53a0('0x6')]=_0x399ea1[_0x53a0('0x6')];if(_0x293204['type'])_0x293204['type']=_0x293204[_0x53a0('0x5')]['toLowerCase']();if(_0x399ea1[_0x53a0('0x5')]===_0x53a0('0xd')){if(_0x293204[_0x53a0('0x32')](_0x53a0('0x33'))&&_0x293204[_0x53a0('0x33')]&&_0x293204['tag']!=='--'){_0xa5ae92[_0x53a0('0x8')]({'type':_0x293204['type'][_0x53a0('0x34')](),'app':_0x53a0('0x3'),'appdata':_0x53a0('0x35')+_0x293204[_0x53a0('0x33')],'context':_0x399ea1[_0x53a0('0x9')],'exten':_0x399ea1['exten'],'priority':_0x293204[_0x53a0('0x30')][_0x53a0('0x1f')]+_0x5db5d3+_0xe01b93++,'VoiceExtensionId':_0x399ea1['id']});}_0xa5ae92[_0x53a0('0x8')]({'type':_0x293204[_0x53a0('0x5')][_0x53a0('0x34')](),'app':_0x53a0('0x14'),'appdata':_0x53a0('0x36')+(_0x293204['callerID']?_0x53a0('0x37')+_0x293204[_0x53a0('0x38')]+')':'NoOp(No\x20number\x20available)'),'context':_0x399ea1[_0x53a0('0x9')],'exten':_0x399ea1[_0x53a0('0x6')],'priority':_0x293204['intervals'][_0x53a0('0x1f')]+_0x5db5d3+_0xe01b93++,'VoiceExtensionId':_0x399ea1['id']});}else{if(_0x293204[_0x53a0('0x32')]('answer')){if([_0x53a0('0x39'),_0x53a0('0x3a')][_0x53a0('0x3b')](_0x293204[_0x53a0('0x3c')][_0x53a0('0x34')]())&&_0x293204[_0x53a0('0x3d')]!==_0x53a0('0x3e')){if(_0x293204[_0x53a0('0x3f')]){_0xa5ae92['push']({'type':_0x293204[_0x53a0('0x5')]['toLowerCase'](),'app':_0x53a0('0x14'),'appdata':'$[${XCALLY-MOTION-ANSWER}=0]?Answer','context':_0x399ea1[_0x53a0('0x9')],'exten':_0x399ea1[_0x53a0('0x6')],'priority':_0x293204[_0x53a0('0x30')][_0x53a0('0x1f')]+_0x5db5d3+_0xe01b93++,'VoiceExtensionId':_0x399ea1['id']});_0xa5ae92[_0x53a0('0x8')]({'type':_0x293204[_0x53a0('0x5')][_0x53a0('0x34')](),'app':_0x53a0('0x3'),'appdata':'XCALLY-MOTION-ANSWER=1','context':_0x399ea1['context'],'exten':_0x399ea1[_0x53a0('0x6')],'priority':_0x293204[_0x53a0('0x30')][_0x53a0('0x1f')]+_0x5db5d3+_0xe01b93++,'VoiceExtensionId':_0x399ea1['id']});}else{_0xa5ae92[_0x53a0('0x8')]({'type':_0x293204[_0x53a0('0x5')][_0x53a0('0x34')](),'app':'ExecIf','appdata':_0x53a0('0x40'),'context':_0x399ea1[_0x53a0('0x9')],'exten':_0x399ea1[_0x53a0('0x6')],'priority':_0x293204[_0x53a0('0x30')][_0x53a0('0x1f')]+_0x5db5d3+_0xe01b93++,'VoiceExtensionId':_0x399ea1['id']});_0xa5ae92[_0x53a0('0x8')]({'type':_0x293204[_0x53a0('0x5')][_0x53a0('0x34')](),'app':_0x53a0('0x3'),'appdata':_0x53a0('0x41'),'context':_0x399ea1['context'],'exten':_0x399ea1[_0x53a0('0x6')],'priority':_0x293204[_0x53a0('0x30')]['length']+_0x5db5d3+_0xe01b93++,'VoiceExtensionId':_0x399ea1['id']});}}}}for(var _0x6b514a=0x0;_0x6b514a<_0x293204[_0x53a0('0x30')][_0x53a0('0x1f')];_0x6b514a++){var _0x28e371=_0x5db5d3+_0x293204[_0x53a0('0x30')]['length'];var _0x2bc74b=_0x6b514a===_0x293204[_0x53a0('0x30')]['length']-0x1?_0x5db5d3+_0xa5ae92['length']+_0x55e2cf[_0x53a0('0x1f')]+0x2:_0x5db5d3+_0x6b514a+0x1;_0xa5ae92[_0x53a0('0x42')](_0x6b514a,0x0,{'type':_0x399ea1['type'],'app':_0x53a0('0x43'),'appdata':_0x293204['intervals'][_0x6b514a]+'?'+_0x399ea1[_0x53a0('0x9')]+',${EXTEN},'+_0x28e371+':'+_0x399ea1[_0x53a0('0x9')]+_0x53a0('0x44')+_0x2bc74b,'exten':_0x399ea1[_0x53a0('0x6')],'context':_0x399ea1[_0x53a0('0x9')],'priority':_0x5db5d3+_0x6b514a,'VoiceExtensionId':_0x399ea1['id']});}if(_0x293204[_0x53a0('0x3d')]===_0x53a0('0x45')){_0x293204[_0x53a0('0x46')]=_0x56a2c0(_0x399ea1,_0x293204['appdata']);}if(_0x293204[_0x53a0('0x3d')]==='agi'){_0xa5ae92['push']({'type':_0x293204['type']['toLowerCase'](),'app':_0x53a0('0x3'),'appdata':_0x53a0('0x47'),'context':_0x399ea1[_0x53a0('0x9')],'exten':_0x399ea1[_0x53a0('0x6')],'priority':_0x293204[_0x53a0('0x30')][_0x53a0('0x1f')]+_0x5db5d3+_0xe01b93++,'VoiceExtensionId':_0x399ea1['id']});}_0x293204[_0x53a0('0x48')]=_0xa5ae92[_0x53a0('0x1f')]?_[_0x53a0('0x49')](_0xa5ae92)[_0x53a0('0x48')]+0x1:_0x5db5d3;_0x20fedf=_[_0x53a0('0x4a')](_0x20fedf,_0xa5ae92,[_0x293204],_0x55e2cf);_0x5db5d3=_[_0x53a0('0x49')](_0x20fedf)[_0x53a0('0x48')]+0x1;}return _0x26d1ec(_0x20fedf);})[_0x53a0('0x4b')](function(_0x1eae30){_0x2df901(_0x1eae30);});});}return _0x57e97b[_0x53a0('0x4c')](_0x53a0('0x4d'),attributes,{'tableName':_0x53a0('0x4e'),'paranoid':![],'indexes':[],'timestamps':!![],'instanceMethods':{'createRouting':function(_0x492bfd){var _0x54b609=this[_0x53a0('0x4f')]({'plain':!![]});var _0x16e41f=_0x54b609[_0x53a0('0x5')]==='outbound'?_0x533e7d(_0x54b609):_0x184e8c(_0x54b609);return _0x4bad1c(_0x54b609,_0x492bfd,_['last'](_0x16e41f)['priority']+0x1)['then'](function(_0x287493){var _0x5b1a77=_[_0x53a0('0x4a')](_0x16e41f,_0x287493);_0x5b1a77[_0x53a0('0x8')]({'type':_0x54b609[_0x53a0('0x5')],'app':_0x53a0('0x50'),'exten':_0x54b609[_0x53a0('0x6')],'context':_0x54b609[_0x53a0('0x9')],'priority':_['last'](_0x5b1a77)['priority']+0x1,'VoiceExtensionId':_0x54b609['id']});return _0x5b1a77;});}}});}; \ No newline at end of file +var _0xf70f=['callerID','Set(CALLERID(all)=','NoOp(No\x20number\x20available)','intervals','queue','playback','includes','app','appType','custom','XCALLY-MOTION-ANSWER=1','$[${XCALLY-MOTION-PROGRESS}=0]?Progress','XCALLY-MOTION-PROGRESS=1','GotoIfTime',',${EXTEN},','outboundDial','appdata','agi','priority','concat','catch','define','VoiceExtension','voice_extensions','get','Hangup','last','lodash','./voiceExtension.attributes','exports','models','type','context','exten','inbound','push','Set','CDR(routeid)=','XCALLY-MOTION-ANSWER=0','XCALLY-MOTION-PROGRESS=0','MONITOR_OPTIONS=ab','outbound','CDR(type)=outbound','CDR(destination)=','cutdigits','${EXTEN:','ExecIf','$[${LEN(${CDR(prefix)})}\x20>\x200]?Goto(','):Goto(','CDR(prefix)=${EXTEN:0:','CDR(prefix)=noprefix','outboundrouteid=','hasOwnProperty','recordingFormat','none','_XCALLY_MIXMONITOR_UNIQUEID=${UNIQUEID}','_XCALLY_MIXMONITOR_FORMAT=','wav','trunk','timeout','options','url','split','length','param','phone','prefix','${EXTEN}','join','indexOf','replace','U(xcally-mixmonitor-context)','isEmpty','Interval','interval','IntervalId','then','map','filter','tag','CDR(tag)=','toLowerCase','$[${LEN(${PREFIX-CALLERIDALL})}\x20>\x200]?Set(CALLERID(all)=${PREFIX-CALLERIDALL}):'];(function(_0x1aeda2,_0x1217eb){var _0x32dc6d=function(_0x34a460){while(--_0x34a460){_0x1aeda2['push'](_0x1aeda2['shift']());}};_0x32dc6d(++_0x1217eb);}(_0xf70f,0x6e));var _0xff70=function(_0x3c691c,_0x75c10a){_0x3c691c=_0x3c691c-0x0;var _0x5703a0=_0xf70f[_0x3c691c];return _0x5703a0;};'use strict';var _=require(_0xff70('0x0'));var attributes=require(_0xff70('0x1'));module[_0xff70('0x2')]=function(_0x24eb75){var _0x275842=_0x24eb75[_0xff70('0x3')];function _0x5664bf(_0xf3c678){var _0x133a2e=0x2;var _0x45427c=[{'type':_0xf3c678['type'],'app':'Set','appdata':'CDR(type)='+_0xf3c678[_0xff70('0x4')],'context':_0xf3c678[_0xff70('0x5')],'exten':_0xf3c678[_0xff70('0x6')],'priority':_0x133a2e++,'VoiceExtensionId':_0xf3c678['id']}];if(_0xf3c678[_0xff70('0x4')]===_0xff70('0x7')){_0x45427c[_0xff70('0x8')]({'type':'inbound','app':_0xff70('0x9'),'appdata':_0xff70('0xa')+_0xf3c678['id'],'context':_0xf3c678[_0xff70('0x5')],'exten':_0xf3c678[_0xff70('0x6')],'priority':_0x133a2e++,'VoiceExtensionId':_0xf3c678['id']});}_0x45427c[_0xff70('0x8')]({'type':_0xf3c678[_0xff70('0x4')],'app':_0xff70('0x9'),'appdata':_0xff70('0xb'),'context':_0xf3c678[_0xff70('0x5')],'exten':_0xf3c678[_0xff70('0x6')],'priority':_0x133a2e++,'VoiceExtensionId':_0xf3c678['id']},{'type':_0xf3c678[_0xff70('0x4')],'app':_0xff70('0x9'),'appdata':_0xff70('0xc'),'context':_0xf3c678[_0xff70('0x5')],'exten':_0xf3c678[_0xff70('0x6')],'priority':_0x133a2e++,'VoiceExtensionId':_0xf3c678['id']},{'type':_0xf3c678['type'],'app':'Set','appdata':_0xff70('0xd'),'context':_0xf3c678[_0xff70('0x5')],'exten':_0xf3c678[_0xff70('0x6')],'priority':_0x133a2e++,'VoiceExtensionId':_0xf3c678['id']});return _0x45427c;}function _0x30cc28(_0x229380){var _0x3fe451=0x2;var _0x7384a=[{'type':_0xff70('0xe'),'app':'Set','appdata':_0xff70('0xf'),'context':_0x229380[_0xff70('0x5')],'exten':_0x229380[_0xff70('0x6')],'priority':_0x3fe451++,'VoiceExtensionId':_0x229380['id']},{'type':_0xff70('0xe'),'app':_0xff70('0x9'),'appdata':_0xff70('0x10')+(_0x229380[_0xff70('0x11')]?_0xff70('0x12')+_0x229380[_0xff70('0x11')]+'}':'${EXTEN}'),'context':_0x229380['context'],'exten':_0x229380[_0xff70('0x6')],'priority':_0x3fe451++,'VoiceExtensionId':_0x229380['id']},{'type':'outbound','app':_0xff70('0x9'),'appdata':_0xff70('0xa')+_0x229380['id'],'context':_0x229380[_0xff70('0x5')],'exten':_0x229380[_0xff70('0x6')],'priority':_0x3fe451++,'VoiceExtensionId':_0x229380['id']},{'type':_0xff70('0xe'),'app':_0xff70('0x13'),'appdata':_0xff70('0x14')+(_0x3fe451+0x2)+_0xff70('0x15')+(_0x3fe451+0x1)+')','context':_0x229380['context'],'exten':_0x229380[_0xff70('0x6')],'priority':_0x3fe451++,'VoiceExtensionId':_0x229380['id']},{'type':_0xff70('0xe'),'app':_0xff70('0x9'),'appdata':_0x229380[_0xff70('0x11')]?_0xff70('0x16')+_0x229380[_0xff70('0x11')]+'}':_0xff70('0x17'),'context':_0x229380['context'],'exten':_0x229380[_0xff70('0x6')],'priority':_0x3fe451++,'VoiceExtensionId':_0x229380['id']},{'type':_0xff70('0xe'),'app':_0xff70('0x9'),'appdata':_0xff70('0xb'),'context':_0x229380['context'],'exten':_0x229380[_0xff70('0x6')],'priority':_0x3fe451++,'VoiceExtensionId':_0x229380['id']},{'type':_0xff70('0xe'),'app':_0xff70('0x9'),'appdata':_0xff70('0xc'),'context':_0x229380[_0xff70('0x5')],'exten':_0x229380[_0xff70('0x6')],'priority':_0x3fe451++,'VoiceExtensionId':_0x229380['id']},{'type':_0xff70('0xe'),'app':_0xff70('0x9'),'appdata':_0xff70('0xd'),'context':_0x229380[_0xff70('0x5')],'exten':_0x229380[_0xff70('0x6')],'priority':_0x3fe451++,'VoiceExtensionId':_0x229380['id']},{'type':_0xff70('0xe'),'app':_0xff70('0x9'),'appdata':_0xff70('0x18')+_0x229380['id'],'context':_0x229380['context'],'exten':_0x229380[_0xff70('0x6')],'priority':_0x3fe451++,'VoiceExtensionId':_0x229380['id']}];if(_0x229380[_0xff70('0x19')](_0xff70('0x1a'))&&_0x229380['recordingFormat']!==_0xff70('0x1b')){_0x7384a[_0xff70('0x8')]({'type':_0xff70('0xe'),'app':'Set','appdata':_0xff70('0x1c'),'context':_0x229380[_0xff70('0x5')],'exten':_0x229380[_0xff70('0x6')],'priority':_0x3fe451++,'VoiceExtensionId':_0x229380['id']},{'type':_0xff70('0xe'),'app':_0xff70('0x9'),'appdata':_0xff70('0x1d')+_0x229380[_0xff70('0x1a')]||_0xff70('0x1e'),'context':_0x229380['context'],'exten':_0x229380[_0xff70('0x6')],'priority':_0x3fe451++,'VoiceExtensionId':_0x229380['id']});}return _0x7384a;}function _0x5c5803(_0x21e83e,_0x59115e){var _0x1269df=[{'name':_0xff70('0x1f'),'param':0x0},{'name':_0xff70('0x20'),'param':0x1},{'name':_0xff70('0x21'),'param':0x2},{'name':_0xff70('0x22'),'param':0x3}];var _0x41756d={};var _0x1a22da=_0x59115e[_0xff70('0x23')](',');var _0x56be38=[];for(var _0x143c49=0x0;_0x143c49<_0x1269df[_0xff70('0x24')];_0x143c49++){switch(_0x1269df[_0x143c49]['name']){case _0xff70('0x1f'):_0x41756d[_0xff70('0x1f')]=_0x1a22da[_0x1269df[_0x143c49][_0xff70('0x25')]][_0xff70('0x23')]('/')[0x1];_0x41756d[_0xff70('0x26')]=_0x1a22da[_0x1269df[_0x143c49][_0xff70('0x25')]][_0xff70('0x23')]('/')[0x2];_0x41756d[_0xff70('0x27')]=_0x41756d['phone']?_0x41756d[_0xff70('0x26')][_0xff70('0x23')]('$')[0x0]:undefined;_0x41756d['phone']=_0x21e83e[_0xff70('0x11')]?(_0x41756d['prefix']||'')+_0xff70('0x12')+_0x21e83e[_0xff70('0x11')]+'}':(_0x41756d['prefix']||'')+_0xff70('0x28');_0x56be38[_0x1269df[_0x143c49][_0xff70('0x25')]]=['SIP',_0x41756d[_0xff70('0x1f')],_0x41756d['phone']][_0xff70('0x29')]('/');break;case _0xff70('0x21'):_0x41756d[_0xff70('0x21')]=_0x1a22da[_0x1269df[_0x143c49][_0xff70('0x25')]];if(_0x21e83e['recordingFormat']!==_0xff70('0x1b')){if(_0x41756d[_0xff70('0x21')][_0xff70('0x2a')]('U(xcally-mixmonitor-context)')<0x0){_0x41756d[_0xff70('0x21')]+='U(xcally-mixmonitor-context)';}}else{_0x41756d['options']=_0x41756d['options'][_0xff70('0x2b')](_0xff70('0x2c'),'');}_0x56be38[_0x1269df[_0x143c49][_0xff70('0x25')]]=_0x41756d[_0xff70('0x21')];break;default:_0x56be38[_0x1269df[_0x143c49][_0xff70('0x25')]]=_0x1a22da[_0x1269df[_0x143c49][_0xff70('0x25')]];}}return _0x56be38[_0xff70('0x29')](',');}function _0x4df67a(_0x1f2af3,_0x49c184,_0x4c04dc){return new Promise(function(_0x30e961,_0xf91627){var _0x40bf0b=[];if(_[_0xff70('0x2d')](_0x49c184))return _0x30e961(_0x40bf0b);_0x275842[_0xff70('0x2e')]['findAll']({'attributes':['id',_0xff70('0x2f'),_0xff70('0x30')],'raw':!![]})[_0xff70('0x31')](function(_0x284f40){for(var _0x2bc548=0x0,_0x59c70e=0x0;_0x2bc548<_0x49c184[_0xff70('0x24')];_0x2bc548++,_0x59c70e=0x0){var _0x5b6cd4=_0x49c184[_0x2bc548];var _0x54ceab=[];var _0x4f2039=[];delete _0x5b6cd4['id'];if(_0x5b6cd4[_0xff70('0x2f')]!=='*,*,*,*'){_0x5b6cd4['intervals']=[_0x5b6cd4[_0xff70('0x2f')]];}else{_0x5b6cd4['intervals']=_0x5b6cd4[_0xff70('0x30')]?_[_0xff70('0x32')](_[_0xff70('0x33')](_0x284f40,{'IntervalId':_0x5b6cd4['IntervalId']}),_0xff70('0x2f')):[];}_0x5b6cd4[_0xff70('0x5')]=_0x1f2af3['context'];_0x5b6cd4[_0xff70('0x6')]=_0x1f2af3['exten'];if(_0x5b6cd4['type'])_0x5b6cd4['type']=_0x5b6cd4['type']['toLowerCase']();if(_0x1f2af3[_0xff70('0x4')]===_0xff70('0xe')){if(_0x5b6cd4[_0xff70('0x19')](_0xff70('0x34'))&&_0x5b6cd4[_0xff70('0x34')]&&_0x5b6cd4[_0xff70('0x34')]!=='--'){_0x54ceab[_0xff70('0x8')]({'type':_0x5b6cd4['type']['toLowerCase'](),'app':_0xff70('0x9'),'appdata':_0xff70('0x35')+_0x5b6cd4[_0xff70('0x34')],'context':_0x1f2af3[_0xff70('0x5')],'exten':_0x1f2af3['exten'],'priority':_0x5b6cd4['intervals'][_0xff70('0x24')]+_0x4c04dc+_0x59c70e++,'VoiceExtensionId':_0x1f2af3['id']});}_0x54ceab['push']({'type':_0x5b6cd4[_0xff70('0x4')][_0xff70('0x36')](),'app':_0xff70('0x13'),'appdata':_0xff70('0x37')+(_0x5b6cd4[_0xff70('0x38')]?_0xff70('0x39')+_0x5b6cd4[_0xff70('0x38')]+')':_0xff70('0x3a')),'context':_0x1f2af3[_0xff70('0x5')],'exten':_0x1f2af3['exten'],'priority':_0x5b6cd4[_0xff70('0x3b')][_0xff70('0x24')]+_0x4c04dc+_0x59c70e++,'VoiceExtensionId':_0x1f2af3['id']});}else{if(_0x5b6cd4['hasOwnProperty']('answer')){if([_0xff70('0x3c'),_0xff70('0x3d')][_0xff70('0x3e')](_0x5b6cd4[_0xff70('0x3f')][_0xff70('0x36')]())&&_0x5b6cd4[_0xff70('0x40')]!==_0xff70('0x41')){if(_0x5b6cd4['answer']){_0x54ceab[_0xff70('0x8')]({'type':_0x5b6cd4['type'][_0xff70('0x36')](),'app':_0xff70('0x13'),'appdata':'$[${XCALLY-MOTION-ANSWER}=0]?Answer','context':_0x1f2af3[_0xff70('0x5')],'exten':_0x1f2af3[_0xff70('0x6')],'priority':_0x5b6cd4[_0xff70('0x3b')][_0xff70('0x24')]+_0x4c04dc+_0x59c70e++,'VoiceExtensionId':_0x1f2af3['id']});_0x54ceab[_0xff70('0x8')]({'type':_0x5b6cd4['type'][_0xff70('0x36')](),'app':_0xff70('0x9'),'appdata':_0xff70('0x42'),'context':_0x1f2af3[_0xff70('0x5')],'exten':_0x1f2af3['exten'],'priority':_0x5b6cd4[_0xff70('0x3b')]['length']+_0x4c04dc+_0x59c70e++,'VoiceExtensionId':_0x1f2af3['id']});}else{_0x54ceab['push']({'type':_0x5b6cd4[_0xff70('0x4')][_0xff70('0x36')](),'app':_0xff70('0x13'),'appdata':_0xff70('0x43'),'context':_0x1f2af3['context'],'exten':_0x1f2af3[_0xff70('0x6')],'priority':_0x5b6cd4[_0xff70('0x3b')][_0xff70('0x24')]+_0x4c04dc+_0x59c70e++,'VoiceExtensionId':_0x1f2af3['id']});_0x54ceab[_0xff70('0x8')]({'type':_0x5b6cd4[_0xff70('0x4')]['toLowerCase'](),'app':_0xff70('0x9'),'appdata':_0xff70('0x44'),'context':_0x1f2af3[_0xff70('0x5')],'exten':_0x1f2af3[_0xff70('0x6')],'priority':_0x5b6cd4[_0xff70('0x3b')][_0xff70('0x24')]+_0x4c04dc+_0x59c70e++,'VoiceExtensionId':_0x1f2af3['id']});}}}}for(var _0x2f67eb=0x0;_0x2f67eb<_0x5b6cd4['intervals'][_0xff70('0x24')];_0x2f67eb++){var _0x479acd=_0x4c04dc+_0x5b6cd4[_0xff70('0x3b')][_0xff70('0x24')];var _0x1fb8bc=_0x2f67eb===_0x5b6cd4['intervals'][_0xff70('0x24')]-0x1?_0x4c04dc+_0x54ceab['length']+_0x4f2039[_0xff70('0x24')]+0x2:_0x4c04dc+_0x2f67eb+0x1;_0x54ceab['splice'](_0x2f67eb,0x0,{'type':_0x1f2af3['type'],'app':_0xff70('0x45'),'appdata':_0x5b6cd4[_0xff70('0x3b')][_0x2f67eb]+'?'+_0x1f2af3[_0xff70('0x5')]+_0xff70('0x46')+_0x479acd+':'+_0x1f2af3[_0xff70('0x5')]+_0xff70('0x46')+_0x1fb8bc,'exten':_0x1f2af3[_0xff70('0x6')],'context':_0x1f2af3[_0xff70('0x5')],'priority':_0x4c04dc+_0x2f67eb,'VoiceExtensionId':_0x1f2af3['id']});}if(_0x5b6cd4[_0xff70('0x40')]===_0xff70('0x47')){_0x5b6cd4[_0xff70('0x48')]=_0x5c5803(_0x1f2af3,_0x5b6cd4[_0xff70('0x48')]);}if(_0x5b6cd4[_0xff70('0x40')]===_0xff70('0x49')){_0x54ceab[_0xff70('0x8')]({'type':_0x5b6cd4['type'][_0xff70('0x36')](),'app':_0xff70('0x9'),'appdata':'XMCS-UNIQUEID=${CHANNEL(LINKEDID)}','context':_0x1f2af3[_0xff70('0x5')],'exten':_0x1f2af3[_0xff70('0x6')],'priority':_0x5b6cd4[_0xff70('0x3b')]['length']+_0x4c04dc+_0x59c70e++,'VoiceExtensionId':_0x1f2af3['id']});}_0x5b6cd4[_0xff70('0x4a')]=_0x54ceab['length']?_['last'](_0x54ceab)['priority']+0x1:_0x4c04dc;_0x40bf0b=_[_0xff70('0x4b')](_0x40bf0b,_0x54ceab,[_0x5b6cd4],_0x4f2039);_0x4c04dc=_['last'](_0x40bf0b)[_0xff70('0x4a')]+0x1;}return _0x30e961(_0x40bf0b);})[_0xff70('0x4c')](function(_0x169634){_0xf91627(_0x169634);});});}return _0x24eb75[_0xff70('0x4d')](_0xff70('0x4e'),attributes,{'tableName':_0xff70('0x4f'),'paranoid':![],'indexes':[],'timestamps':!![],'instanceMethods':{'createRouting':function(_0x26cd6f){var _0x1865ec=this[_0xff70('0x50')]({'plain':!![]});var _0x409c5f=_0x1865ec['type']===_0xff70('0xe')?_0x30cc28(_0x1865ec):_0x5664bf(_0x1865ec);return _0x4df67a(_0x1865ec,_0x26cd6f,_['last'](_0x409c5f)['priority']+0x1)['then'](function(_0x2bacdd){var _0x37fb3b=_[_0xff70('0x4b')](_0x409c5f,_0x2bacdd);_0x37fb3b[_0xff70('0x8')]({'type':_0x1865ec['type'],'app':_0xff70('0x51'),'exten':_0x1865ec['exten'],'context':_0x1865ec['context'],'priority':_[_0xff70('0x52')](_0x37fb3b)['priority']+0x1,'VoiceExtensionId':_0x1865ec['id']});return _0x37fb3b;});}}});}; \ No newline at end of file diff --git a/server/api/voiceExtension/voiceExtension.rpc.js b/server/api/voiceExtension/voiceExtension.rpc.js index 3937ab1..c11859a 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 _0x6fc4=['VoiceExtension,\x20%s,\x20%s','request\x20sent','debug','VoiceExtension,\x20%s,\x20%s,\x20%s','stringify','error','code','message','result','catch','GetVoiceExtension','VoiceExtension','options','raw','limit','include','model','attributes','map','then','lodash','util','randomstring','../../config/logger','rpc','../../config/environment','jayson/promise','client','http','redis','defaults','socket.io-emitter','./voiceExtension.socket','register','request','info'];(function(_0x31a9be,_0x5e6257){var _0x1c59ce=function(_0x1b93c2){while(--_0x1b93c2){_0x31a9be['push'](_0x31a9be['shift']());}};_0x1c59ce(++_0x5e6257);}(_0x6fc4,0x1a0));var _0x46fc=function(_0x316904,_0x1e8b77){_0x316904=_0x316904-0x0;var _0xfa9a21=_0x6fc4[_0x316904];return _0xfa9a21;};'use strict';var _=require(_0x46fc('0x0'));var util=require(_0x46fc('0x1'));var moment=require('moment');var BPromise=require('bluebird');var rs=require(_0x46fc('0x2'));var fs=require('fs');var Redis=require('ioredis');var db=require('../../mysqldb')['db'];var utils=require('../../config/utils');var logger=require(_0x46fc('0x3'))(_0x46fc('0x4'));var config=require(_0x46fc('0x5'));var jayson=require(_0x46fc('0x6'));var client=jayson[_0x46fc('0x7')][_0x46fc('0x8')]({'port':0x232a});config[_0x46fc('0x9')]=_[_0x46fc('0xa')](config['redis'],{'host':'localhost','port':0x18eb});var socket=require(_0x46fc('0xb'))(new Redis(config[_0x46fc('0x9')]));require(_0x46fc('0xc'))[_0x46fc('0xd')](socket);function respondWithRpcPromise(_0x5ef080,_0x51d875,_0x1fbb9b){return new BPromise(function(_0xa1283a,_0x5431e8){return client[_0x46fc('0xe')](_0x5ef080,_0x1fbb9b)['then'](function(_0x2f9efa){logger[_0x46fc('0xf')](_0x46fc('0x10'),_0x51d875,_0x46fc('0x11'));logger[_0x46fc('0x12')](_0x46fc('0x13'),_0x51d875,_0x46fc('0x11'),JSON[_0x46fc('0x14')](_0x2f9efa));if(_0x2f9efa[_0x46fc('0x15')]){if(_0x2f9efa[_0x46fc('0x15')][_0x46fc('0x16')]===0x1f4){logger[_0x46fc('0x15')](_0x46fc('0x10'),_0x51d875,_0x2f9efa[_0x46fc('0x15')][_0x46fc('0x17')]);return _0x5431e8(_0x2f9efa[_0x46fc('0x15')][_0x46fc('0x17')]);}logger[_0x46fc('0x15')]('VoiceExtension,\x20%s,\x20%s',_0x51d875,_0x2f9efa[_0x46fc('0x15')][_0x46fc('0x17')]);return _0xa1283a(_0x2f9efa[_0x46fc('0x15')][_0x46fc('0x17')]);}else{logger[_0x46fc('0xf')]('VoiceExtension,\x20%s,\x20%s',_0x51d875,_0x46fc('0x11'));_0xa1283a(_0x2f9efa[_0x46fc('0x18')][_0x46fc('0x17')]);}})[_0x46fc('0x19')](function(_0x1c3730){logger[_0x46fc('0x15')]('VoiceExtension,\x20%s,\x20%s',_0x51d875,_0x1c3730);_0x5431e8(_0x1c3730);});});}exports[_0x46fc('0x1a')]=function(_0x54a60f){var _0x35b58e=this;return new Promise(function(_0xf47662,_0x1e6f26){return db[_0x46fc('0x1b')]['findAll']({'raw':_0x54a60f['options']?_0x54a60f[_0x46fc('0x1c')][_0x46fc('0x1d')]===undefined?!![]:![]:!![],'where':_0x54a60f[_0x46fc('0x1c')]?_0x54a60f['options']['where']||null:null,'attributes':_0x54a60f[_0x46fc('0x1c')]?_0x54a60f[_0x46fc('0x1c')]['attributes']||null:null,'limit':_0x54a60f[_0x46fc('0x1c')]?_0x54a60f[_0x46fc('0x1c')][_0x46fc('0x1e')]||null:null,'include':_0x54a60f[_0x46fc('0x1c')]?_0x54a60f[_0x46fc('0x1c')][_0x46fc('0x1f')]?_['map'](_0x54a60f[_0x46fc('0x1c')][_0x46fc('0x1f')],function(_0x4f8ad7){return{'model':db[_0x4f8ad7[_0x46fc('0x20')]],'as':_0x4f8ad7['as'],'attributes':_0x4f8ad7[_0x46fc('0x21')],'include':_0x4f8ad7['include']?_[_0x46fc('0x22')](_0x4f8ad7[_0x46fc('0x1f')],function(_0x11bb8a){return{'model':db[_0x11bb8a[_0x46fc('0x20')]],'as':_0x11bb8a['as'],'attributes':_0x11bb8a[_0x46fc('0x21')],'include':_0x11bb8a[_0x46fc('0x1f')]?_[_0x46fc('0x22')](_0x11bb8a[_0x46fc('0x1f')],function(_0x448f91){return{'model':db[_0x448f91[_0x46fc('0x20')]],'as':_0x448f91['as'],'attributes':_0x448f91[_0x46fc('0x21')]};}):[]};}):[]};}):[]:[]})[_0x46fc('0x23')](function(_0x3df7ef){logger[_0x46fc('0xf')](_0x46fc('0x1a'),_0x54a60f);logger[_0x46fc('0x12')]('GetVoiceExtension',_0x54a60f,JSON[_0x46fc('0x14')](_0x3df7ef));_0xf47662(_0x3df7ef);})[_0x46fc('0x19')](function(_0x3f00fb){logger[_0x46fc('0x15')](_0x46fc('0x1a'),_0x3f00fb[_0x46fc('0x17')],_0x54a60f);_0x1e6f26(_0x35b58e['error'](0x1f4,_0x3f00fb[_0x46fc('0x17')]));});});}; \ No newline at end of file +var _0xa93e=['GetVoiceExtension','debug','stringify','moment','bluebird','ioredis','../../config/utils','../../config/environment','jayson/promise','client','http','redis','defaults','localhost','register','request','then','info','VoiceExtension,\x20%s,\x20%s','request\x20sent','VoiceExtension,\x20%s,\x20%s,\x20%s','error','code','message','result','catch','VoiceExtension','options','where','attributes','limit','include','model','map'];(function(_0x4724d9,_0x2be8f6){var _0x3c168d=function(_0x29d647){while(--_0x29d647){_0x4724d9['push'](_0x4724d9['shift']());}};_0x3c168d(++_0x2be8f6);}(_0xa93e,0x1df));var _0xea93=function(_0x1cea8a,_0x50d533){_0x1cea8a=_0x1cea8a-0x0;var _0x5d4d04=_0xa93e[_0x1cea8a];return _0x5d4d04;};'use strict';var _=require('lodash');var util=require('util');var moment=require(_0xea93('0x0'));var BPromise=require(_0xea93('0x1'));var rs=require('randomstring');var fs=require('fs');var Redis=require(_0xea93('0x2'));var db=require('../../mysqldb')['db'];var utils=require(_0xea93('0x3'));var logger=require('../../config/logger')('rpc');var config=require(_0xea93('0x4'));var jayson=require(_0xea93('0x5'));var client=jayson[_0xea93('0x6')][_0xea93('0x7')]({'port':0x232a});config[_0xea93('0x8')]=_[_0xea93('0x9')](config['redis'],{'host':_0xea93('0xa'),'port':0x18eb});var socket=require('socket.io-emitter')(new Redis(config['redis']));require('./voiceExtension.socket')[_0xea93('0xb')](socket);function respondWithRpcPromise(_0x43c7e2,_0x598546,_0x1229f9){return new BPromise(function(_0x2306b6,_0x50c822){return client[_0xea93('0xc')](_0x43c7e2,_0x1229f9)[_0xea93('0xd')](function(_0xa45e13){logger[_0xea93('0xe')](_0xea93('0xf'),_0x598546,_0xea93('0x10'));logger['debug'](_0xea93('0x11'),_0x598546,'request\x20sent',JSON['stringify'](_0xa45e13));if(_0xa45e13[_0xea93('0x12')]){if(_0xa45e13[_0xea93('0x12')][_0xea93('0x13')]===0x1f4){logger[_0xea93('0x12')](_0xea93('0xf'),_0x598546,_0xa45e13[_0xea93('0x12')]['message']);return _0x50c822(_0xa45e13[_0xea93('0x12')]['message']);}logger[_0xea93('0x12')](_0xea93('0xf'),_0x598546,_0xa45e13[_0xea93('0x12')][_0xea93('0x14')]);return _0x2306b6(_0xa45e13[_0xea93('0x12')][_0xea93('0x14')]);}else{logger[_0xea93('0xe')](_0xea93('0xf'),_0x598546,_0xea93('0x10'));_0x2306b6(_0xa45e13[_0xea93('0x15')][_0xea93('0x14')]);}})[_0xea93('0x16')](function(_0xc05867){logger['error'](_0xea93('0xf'),_0x598546,_0xc05867);_0x50c822(_0xc05867);});});}exports['GetVoiceExtension']=function(_0x2a78d6){var _0x388d0f=this;return new Promise(function(_0x41193e,_0xea0f1b){return db[_0xea93('0x17')]['findAll']({'raw':_0x2a78d6[_0xea93('0x18')]?_0x2a78d6['options']['raw']===undefined?!![]:![]:!![],'where':_0x2a78d6[_0xea93('0x18')]?_0x2a78d6[_0xea93('0x18')][_0xea93('0x19')]||null:null,'attributes':_0x2a78d6[_0xea93('0x18')]?_0x2a78d6['options'][_0xea93('0x1a')]||null:null,'limit':_0x2a78d6[_0xea93('0x18')]?_0x2a78d6[_0xea93('0x18')][_0xea93('0x1b')]||null:null,'include':_0x2a78d6[_0xea93('0x18')]?_0x2a78d6[_0xea93('0x18')][_0xea93('0x1c')]?_['map'](_0x2a78d6[_0xea93('0x18')]['include'],function(_0x46ef0e){return{'model':db[_0x46ef0e[_0xea93('0x1d')]],'as':_0x46ef0e['as'],'attributes':_0x46ef0e['attributes'],'include':_0x46ef0e[_0xea93('0x1c')]?_[_0xea93('0x1e')](_0x46ef0e[_0xea93('0x1c')],function(_0x380071){return{'model':db[_0x380071['model']],'as':_0x380071['as'],'attributes':_0x380071[_0xea93('0x1a')],'include':_0x380071[_0xea93('0x1c')]?_['map'](_0x380071[_0xea93('0x1c')],function(_0xe48fd1){return{'model':db[_0xe48fd1[_0xea93('0x1d')]],'as':_0xe48fd1['as'],'attributes':_0xe48fd1[_0xea93('0x1a')]};}):[]};}):[]};}):[]:[]})['then'](function(_0x2ca687){logger[_0xea93('0xe')](_0xea93('0x1f'),_0x2a78d6);logger[_0xea93('0x20')](_0xea93('0x1f'),_0x2a78d6,JSON[_0xea93('0x21')](_0x2ca687));_0x41193e(_0x2ca687);})['catch'](function(_0x297fb5){logger[_0xea93('0x12')](_0xea93('0x1f'),_0x297fb5[_0xea93('0x14')],_0x2a78d6);_0xea0f1b(_0x388d0f[_0xea93('0x12')](0x1f4,_0x297fb5['message']));});});}; \ No newline at end of file diff --git a/server/api/voiceExtension/voiceExtension.socket.js b/server/api/voiceExtension/voiceExtension.socket.js index 8060ca9..b778b51 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 _0xe14b=['removeListener','register','length','./voiceExtension.events','save','emit'];(function(_0x5e6bea,_0x152b43){var _0x28f05f=function(_0x2dbb20){while(--_0x2dbb20){_0x5e6bea['push'](_0x5e6bea['shift']());}};_0x28f05f(++_0x152b43);}(_0xe14b,0x93));var _0xbe14=function(_0x2571c8,_0x1cb8c5){_0x2571c8=_0x2571c8-0x0;var _0x9b2f8f=_0xe14b[_0x2571c8];return _0x9b2f8f;};'use strict';var VoiceExtensionEvents=require(_0xbe14('0x0'));var events=[_0xbe14('0x1'),'remove','update'];function createListener(_0x11c3a0,_0x36393a){return function(_0x48a116){_0x36393a[_0xbe14('0x2')](_0x11c3a0,_0x48a116);};}function removeListener(_0x5ce8fb,_0x496c04){return function(){VoiceExtensionEvents[_0xbe14('0x3')](_0x5ce8fb,_0x496c04);};}exports[_0xbe14('0x4')]=function(_0x1fe204){for(var _0x1ff100=0x0,_0x1d9ade=events[_0xbe14('0x5')];_0x1ff100<_0x1d9ade;_0x1ff100++){var _0x196fca=events[_0x1ff100];var _0x566ae7=createListener('voiceExtension:'+_0x196fca,_0x1fe204);VoiceExtensionEvents['on'](_0x196fca,_0x566ae7);}}; \ No newline at end of file +var _0x7a54=['remove','emit','removeListener','register','length','voiceExtension:','./voiceExtension.events','save'];(function(_0x793c73,_0x467d33){var _0x32ffb0=function(_0x4ca120){while(--_0x4ca120){_0x793c73['push'](_0x793c73['shift']());}};_0x32ffb0(++_0x467d33);}(_0x7a54,0x106));var _0x47a5=function(_0x3294c8,_0x4cb2f1){_0x3294c8=_0x3294c8-0x0;var _0x1cf1b8=_0x7a54[_0x3294c8];return _0x1cf1b8;};'use strict';var VoiceExtensionEvents=require(_0x47a5('0x0'));var events=[_0x47a5('0x1'),_0x47a5('0x2'),'update'];function createListener(_0x1d33e,_0x4086cd){return function(_0x4880bf){_0x4086cd[_0x47a5('0x3')](_0x1d33e,_0x4880bf);};}function removeListener(_0x11bf85,_0x2a1a7e){return function(){VoiceExtensionEvents[_0x47a5('0x4')](_0x11bf85,_0x2a1a7e);};}exports[_0x47a5('0x5')]=function(_0x545a97){for(var _0x3d5629=0x0,_0x59199c=events[_0x47a5('0x6')];_0x3d5629<_0x59199c;_0x3d5629++){var _0x30e405=events[_0x3d5629];var _0x506eda=createListener(_0x47a5('0x7')+_0x30e405,_0x545a97);VoiceExtensionEvents['on'](_0x30e405,_0x506eda);}}; \ No newline at end of file diff --git a/server/api/voiceMail/index.js b/server/api/voiceMail/index.js index 36ca89a..e46eaba 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 _0x0424=['delete','destroy','exports','path','connect-timeout','express','Router','../../components/auth/service','./voiceMail.controller','get','isAuthenticated','index','/:id','/:id/messages','getMessages','create','put','update'];(function(_0x1ae5ab,_0xc5d441){var _0x1ce001=function(_0x5ef96d){while(--_0x5ef96d){_0x1ae5ab['push'](_0x1ae5ab['shift']());}};_0x1ce001(++_0xc5d441);}(_0x0424,0x159));var _0x4042=function(_0x5b7695,_0x139b46){_0x5b7695=_0x5b7695-0x0;var _0xae72fb=_0x0424[_0x5b7695];return _0xae72fb;};'use strict';var multer=require('multer');var util=require('util');var path=require(_0x4042('0x0'));var timeout=require(_0x4042('0x1'));var express=require(_0x4042('0x2'));var router=express[_0x4042('0x3')]();var fs_extra=require('fs-extra');var auth=require(_0x4042('0x4'));var interaction=require('../../components/interaction/service');var config=require('../../config/environment');var controller=require(_0x4042('0x5'));router[_0x4042('0x6')]('/',auth[_0x4042('0x7')](),controller[_0x4042('0x8')]);router[_0x4042('0x6')](_0x4042('0x9'),auth[_0x4042('0x7')](),controller['show']);router['get'](_0x4042('0xa'),auth[_0x4042('0x7')](),controller[_0x4042('0xb')]);router['post']('/',auth[_0x4042('0x7')](),controller[_0x4042('0xc')]);router[_0x4042('0xd')](_0x4042('0x9'),auth[_0x4042('0x7')](),controller[_0x4042('0xe')]);router[_0x4042('0xf')](_0x4042('0x9'),auth['isAuthenticated'](),controller[_0x4042('0x10')]);module[_0x4042('0x11')]=router; \ No newline at end of file +var _0x5fdc=['delete','multer','util','path','connect-timeout','express','Router','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','./voiceMail.controller','get','isAuthenticated','index','/:id/messages','getMessages','create','put','/:id','update'];(function(_0x1a36a5,_0x746928){var _0x746243=function(_0x481966){while(--_0x481966){_0x1a36a5['push'](_0x1a36a5['shift']());}};_0x746243(++_0x746928);}(_0x5fdc,0x127));var _0xc5fd=function(_0x31e12a,_0x57e3ea){_0x31e12a=_0x31e12a-0x0;var _0x14210a=_0x5fdc[_0x31e12a];return _0x14210a;};'use strict';var multer=require(_0xc5fd('0x0'));var util=require(_0xc5fd('0x1'));var path=require(_0xc5fd('0x2'));var timeout=require(_0xc5fd('0x3'));var express=require(_0xc5fd('0x4'));var router=express[_0xc5fd('0x5')]();var fs_extra=require(_0xc5fd('0x6'));var auth=require(_0xc5fd('0x7'));var interaction=require(_0xc5fd('0x8'));var config=require(_0xc5fd('0x9'));var controller=require(_0xc5fd('0xa'));router[_0xc5fd('0xb')]('/',auth[_0xc5fd('0xc')](),controller[_0xc5fd('0xd')]);router[_0xc5fd('0xb')]('/:id',auth['isAuthenticated'](),controller['show']);router[_0xc5fd('0xb')](_0xc5fd('0xe'),auth[_0xc5fd('0xc')](),controller[_0xc5fd('0xf')]);router['post']('/',auth['isAuthenticated'](),controller[_0xc5fd('0x10')]);router[_0xc5fd('0x11')](_0xc5fd('0x12'),auth[_0xc5fd('0xc')](),controller[_0xc5fd('0x13')]);router[_0xc5fd('0x14')]('/:id',auth[_0xc5fd('0xc')](),controller['destroy']);module['exports']=router; \ No newline at end of file diff --git a/server/api/voiceMail/voiceMail.attributes.js b/server/api/voiceMail/voiceMail.attributes.js index d208142..37c9424 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 _0x3990=['\x20-\x20','mailbox','STRING','from-voicemail','contest_mailbox','setDataValue','email','trim','ENUM','yes','TINYINT(4)','TIMESTAMP','INTEGER','VIRTUAL','getDataValue','fullname'];(function(_0x3b5250,_0x7a0b2c){var _0xc844a1=function(_0x2fbc98){while(--_0x2fbc98){_0x3b5250['push'](_0x3b5250['shift']());}};_0xc844a1(++_0x7a0b2c);}(_0x3990,0x1b2));var _0x0399=function(_0x4f6395,_0x38d77a){_0x4f6395=_0x4f6395-0x0;var _0x13dc86=_0x3990[_0x4f6395];return _0x13dc86;};'use strict';var Sequelize=require('sequelize');module['exports']={'customer_id':{'type':Sequelize['STRING']},'context':{'type':Sequelize[_0x0399('0x0')],'defaultValue':_0x0399('0x1'),'unique':_0x0399('0x2')},'mailbox':{'type':Sequelize[_0x0399('0x0')],'defaultValue':'','allowNull':![],'unique':'contest_mailbox'},'password':{'type':Sequelize[_0x0399('0x0')]},'fullname':{'type':Sequelize['STRING']},'email':{'type':Sequelize['STRING'],'validate':{'isEmail':!![]},'set':function(_0x2cc82b){this[_0x0399('0x3')](_0x0399('0x4'),typeof _0x2cc82b==='string'&&_0x2cc82b[_0x0399('0x5')]()?_0x2cc82b['trim']():null);}},'pager':{'type':Sequelize[_0x0399('0x0')]},'tz':{'type':Sequelize[_0x0399('0x0')],'defaultValue':'central'},'attach':{'type':Sequelize[_0x0399('0x6')]('yes','no'),'defaultValue':'yes','allowNull':![]},'saycid':{'type':Sequelize['ENUM'](_0x0399('0x7'),'no'),'defaultValue':_0x0399('0x7'),'allowNull':![]},'dialout':{'type':Sequelize['STRING']},'callback':{'type':Sequelize[_0x0399('0x0')]},'review':{'type':Sequelize['ENUM'](_0x0399('0x7'),'no'),'defaultValue':'no','allowNull':![]},'operator':{'type':Sequelize[_0x0399('0x6')]('yes','no'),'defaultValue':'no','allowNull':![]},'envelope':{'type':Sequelize[_0x0399('0x6')](_0x0399('0x7'),'no'),'defaultValue':'no','allowNull':![]},'sayduration':{'type':Sequelize[_0x0399('0x6')](_0x0399('0x7'),'no'),'defaultValue':'no','allowNull':![]},'saydurationm':{'type':_0x0399('0x8'),'defaultValue':0x1,'allowNull':![]},'sendvoicemail':{'type':Sequelize[_0x0399('0x6')](_0x0399('0x7'),'no'),'defaultValue':'no','allowNull':![]},'delete':{'type':Sequelize[_0x0399('0x6')](_0x0399('0x7'),'no'),'defaultValue':'no','allowNull':![]},'nextaftercmd':{'type':Sequelize[_0x0399('0x6')](_0x0399('0x7'),'no'),'defaultValue':'yes','allowNull':![]},'forcename':{'type':Sequelize[_0x0399('0x6')](_0x0399('0x7'),'no'),'defaultValue':'no','allowNull':![]},'forcegreetings':{'type':Sequelize[_0x0399('0x6')](_0x0399('0x7'),'no'),'defaultValue':'no','allowNull':![]},'hidefromdir':{'type':Sequelize[_0x0399('0x6')](_0x0399('0x7'),'no'),'defaultValue':'yes','allowNull':![]},'stamp':{'type':_0x0399('0x9')},'emailsubject':{'type':Sequelize[_0x0399('0x0')]},'emailbody':{'type':Sequelize[_0x0399('0x0')]},'maxsecs':{'type':Sequelize[_0x0399('0xa')](0xff),'defaultValue':0xb4,'allowNull':![]},'maxmsg':{'type':Sequelize['INTEGER'](0xff),'defaultValue':0x64,'allowNull':![]},'name':{'type':Sequelize[_0x0399('0xb')],'get':function(){return this[_0x0399('0xc')](_0x0399('0xd'))+_0x0399('0xe')+this[_0x0399('0xc')](_0x0399('0xf'));}}}; \ No newline at end of file +var _0x60fd=['email','string','trim','central','ENUM','yes','TIMESTAMP','INTEGER','fullname','\x20-\x20','getDataValue','mailbox','sequelize','exports','STRING','from-voicemail','contest_mailbox','setDataValue'];(function(_0x29b37f,_0x1d02b4){var _0x58f976=function(_0x173de7){while(--_0x173de7){_0x29b37f['push'](_0x29b37f['shift']());}};_0x58f976(++_0x1d02b4);}(_0x60fd,0x13e));var _0xd60f=function(_0x108440,_0x3f34d7){_0x108440=_0x108440-0x0;var _0x1407d9=_0x60fd[_0x108440];return _0x1407d9;};'use strict';var Sequelize=require(_0xd60f('0x0'));module[_0xd60f('0x1')]={'customer_id':{'type':Sequelize[_0xd60f('0x2')]},'context':{'type':Sequelize['STRING'],'defaultValue':_0xd60f('0x3'),'unique':_0xd60f('0x4')},'mailbox':{'type':Sequelize['STRING'],'defaultValue':'','allowNull':![],'unique':'contest_mailbox'},'password':{'type':Sequelize[_0xd60f('0x2')]},'fullname':{'type':Sequelize[_0xd60f('0x2')]},'email':{'type':Sequelize[_0xd60f('0x2')],'validate':{'isEmail':!![]},'set':function(_0x57560e){this[_0xd60f('0x5')](_0xd60f('0x6'),typeof _0x57560e===_0xd60f('0x7')&&_0x57560e['trim']()?_0x57560e[_0xd60f('0x8')]():null);}},'pager':{'type':Sequelize[_0xd60f('0x2')]},'tz':{'type':Sequelize[_0xd60f('0x2')],'defaultValue':_0xd60f('0x9')},'attach':{'type':Sequelize[_0xd60f('0xa')]('yes','no'),'defaultValue':_0xd60f('0xb'),'allowNull':![]},'saycid':{'type':Sequelize[_0xd60f('0xa')](_0xd60f('0xb'),'no'),'defaultValue':_0xd60f('0xb'),'allowNull':![]},'dialout':{'type':Sequelize[_0xd60f('0x2')]},'callback':{'type':Sequelize[_0xd60f('0x2')]},'review':{'type':Sequelize[_0xd60f('0xa')](_0xd60f('0xb'),'no'),'defaultValue':'no','allowNull':![]},'operator':{'type':Sequelize[_0xd60f('0xa')]('yes','no'),'defaultValue':'no','allowNull':![]},'envelope':{'type':Sequelize['ENUM'](_0xd60f('0xb'),'no'),'defaultValue':'no','allowNull':![]},'sayduration':{'type':Sequelize[_0xd60f('0xa')]('yes','no'),'defaultValue':'no','allowNull':![]},'saydurationm':{'type':'TINYINT(4)','defaultValue':0x1,'allowNull':![]},'sendvoicemail':{'type':Sequelize[_0xd60f('0xa')]('yes','no'),'defaultValue':'no','allowNull':![]},'delete':{'type':Sequelize['ENUM'](_0xd60f('0xb'),'no'),'defaultValue':'no','allowNull':![]},'nextaftercmd':{'type':Sequelize['ENUM'](_0xd60f('0xb'),'no'),'defaultValue':_0xd60f('0xb'),'allowNull':![]},'forcename':{'type':Sequelize['ENUM'](_0xd60f('0xb'),'no'),'defaultValue':'no','allowNull':![]},'forcegreetings':{'type':Sequelize[_0xd60f('0xa')]('yes','no'),'defaultValue':'no','allowNull':![]},'hidefromdir':{'type':Sequelize[_0xd60f('0xa')](_0xd60f('0xb'),'no'),'defaultValue':_0xd60f('0xb'),'allowNull':![]},'stamp':{'type':_0xd60f('0xc')},'emailsubject':{'type':Sequelize[_0xd60f('0x2')]},'emailbody':{'type':Sequelize[_0xd60f('0x2')]},'maxsecs':{'type':Sequelize[_0xd60f('0xd')](0xff),'defaultValue':0xb4,'allowNull':![]},'maxmsg':{'type':Sequelize['INTEGER'](0xff),'defaultValue':0x64,'allowNull':![]},'name':{'type':Sequelize['VIRTUAL'],'get':function(){return this['getDataValue'](_0xd60f('0xe'))+_0xd60f('0xf')+this[_0xd60f('0x10')](_0xd60f('0x11'));}}}; \ No newline at end of file diff --git a/server/api/voiceMail/voiceMail.controller.js b/server/api/voiceMail/voiceMail.controller.js index 50ada72..0baded1 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 _0xe605=['count','set','Content-Range','apply','save','update','then','destroy','Voicemails','UserProfileResource','name','send','index','rawAttributes','fieldName','type','key','model','map','query','keys','filters','attributes','fields','length','nolimit','order','sort','where','pick','filter','merge','VIRTUAL','options','includeAll','include','VoiceMail','findAll','rows','show','params','intersection','find','catch','create','body','user','get','UserProfileSection','userProfileId','autoAssociation','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','getMessages','findOne','VoiceMailMessage','hasOwnProperty','mailbox','eml-format','rimraf','fast-json-patch','request-promise','moment','bluebird','mustache','util','path','sox','to-csv','ejs','fs-extra','lodash','crypto','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/logger','../../config/utils','../../config/environment','../../config/license/util','sendStatus','status','end','json','offset','limit','undefined'];(function(_0x3a10b6,_0x3181f0){var _0x463dc3=function(_0x5e37f2){while(--_0x5e37f2){_0x3a10b6['push'](_0x3a10b6['shift']());}};_0x463dc3(++_0x3181f0);}(_0xe605,0x92));var _0x5e60=function(_0x484bf1,_0x1ff972){_0x484bf1=_0x484bf1-0x0;var _0xe3a758=_0xe605[_0x484bf1];return _0xe3a758;};'use strict';var emlformat=require(_0x5e60('0x0'));var rimraf=require(_0x5e60('0x1'));var zipdir=require('zip-dir');var jsonpatch=require(_0x5e60('0x2'));var rp=require(_0x5e60('0x3'));var moment=require(_0x5e60('0x4'));var BPromise=require(_0x5e60('0x5'));var Mustache=require(_0x5e60('0x6'));var util=require(_0x5e60('0x7'));var path=require(_0x5e60('0x8'));var sox=require(_0x5e60('0x9'));var csv=require(_0x5e60('0xa'));var ejs=require(_0x5e60('0xb'));var fs=require('fs');var fs_extra=require(_0x5e60('0xc'));var _=require(_0x5e60('0xd'));var squel=require('squel');var crypto=require(_0x5e60('0xe'));var jsforce=require('jsforce');var deskjs=require('desk.js');var toCsv=require('to-csv');var querystring=require(_0x5e60('0xf'));var Papa=require(_0x5e60('0x10'));var Redis=require(_0x5e60('0x11'));var authService=require(_0x5e60('0x12'));var qs=require(_0x5e60('0x13'));var as=require(_0x5e60('0x14'));var hardwareService=require('../../config/license/hardware');var logger=require(_0x5e60('0x15'))('api');var utils=require(_0x5e60('0x16'));var config=require(_0x5e60('0x17'));var licenseUtil=require(_0x5e60('0x18'));var db=require('../../mysqldb')['db'];function respondWithStatusCode(_0x371df7,_0x178782){_0x178782=_0x178782||0xcc;return function(_0x1f4e14){if(_0x1f4e14){return _0x371df7[_0x5e60('0x19')](_0x178782);}return _0x371df7[_0x5e60('0x1a')](_0x178782)[_0x5e60('0x1b')]();};}function respondWithResult(_0x4fd10e,_0x209adb){_0x209adb=_0x209adb||0xc8;return function(_0x45304f){if(_0x45304f){return _0x4fd10e[_0x5e60('0x1a')](_0x209adb)[_0x5e60('0x1c')](_0x45304f);}};}function respondWithFilteredResult(_0x5b028f,_0x20af5f){return function(_0x529ffe){if(_0x529ffe){var _0x1ffd77=typeof _0x20af5f[_0x5e60('0x1d')]==='undefined'&&typeof _0x20af5f[_0x5e60('0x1e')]===_0x5e60('0x1f');var _0xaa7d05=_0x529ffe[_0x5e60('0x20')];var _0x5c485d=_0x1ffd77?0x0:_0x20af5f[_0x5e60('0x1d')];var _0x22d718=_0x1ffd77?_0x529ffe['count']:_0x20af5f[_0x5e60('0x1d')]+_0x20af5f[_0x5e60('0x1e')];var _0x17c630;if(_0x22d718>=_0xaa7d05){_0x22d718=_0xaa7d05;_0x17c630=0xc8;}else{_0x17c630=0xce;}_0x5b028f[_0x5e60('0x1a')](_0x17c630);return _0x5b028f[_0x5e60('0x21')](_0x5e60('0x22'),_0x5c485d+'-'+_0x22d718+'/'+_0xaa7d05)[_0x5e60('0x1c')](_0x529ffe);}return null;};}function patchUpdates(_0x524c93){return function(_0x3282e4){try{jsonpatch[_0x5e60('0x23')](_0x3282e4,_0x524c93,!![]);}catch(_0x228f13){return BPromise['reject'](_0x228f13);}return _0x3282e4[_0x5e60('0x24')]();};}function saveUpdates(_0x5d77dd,_0x376069){return function(_0x1a44e5){if(_0x1a44e5){return _0x1a44e5[_0x5e60('0x25')](_0x5d77dd)[_0x5e60('0x26')](function(_0x34e98d){return _0x34e98d;});}return null;};}function removeEntity(_0x2a499e,_0x2636f1){return function(_0x5d2c03){if(_0x5d2c03){return _0x5d2c03[_0x5e60('0x27')]()[_0x5e60('0x26')](function(){var _0x19f37b=_0x5d2c03['get']({'plain':!![]});var _0x45cb62=_0x5e60('0x28');return db[_0x5e60('0x29')][_0x5e60('0x27')]({'where':{'type':_0x45cb62,'resourceId':_0x19f37b['id']}})['then'](function(){return _0x5d2c03;});})[_0x5e60('0x26')](function(){_0x2a499e['status'](0xcc)[_0x5e60('0x1b')]();});}};}function handleEntityNotFound(_0x221322,_0x4ba727){return function(_0x46691f){if(!_0x46691f){_0x221322[_0x5e60('0x19')](0x194);}return _0x46691f;};}function handleError(_0x5b1b46,_0x1ee931){_0x1ee931=_0x1ee931||0x1f4;return function(_0xac9c7a){logger['error'](_0xac9c7a['stack']);if(_0xac9c7a['name']){delete _0xac9c7a[_0x5e60('0x2a')];}_0x5b1b46[_0x5e60('0x1a')](_0x1ee931)[_0x5e60('0x2b')](_0xac9c7a);};}exports[_0x5e60('0x2c')]=function(_0x3ccfee,_0x558197){var _0x168ce6={},_0x405461={},_0x4d4b55={'count':0x0,'rows':[]};var _0x11fc87=_['map'](db['VoiceMail'][_0x5e60('0x2d')],function(_0x3c4340){return{'name':_0x3c4340[_0x5e60('0x2e')],'type':_0x3c4340[_0x5e60('0x2f')][_0x5e60('0x30')]};});_0x405461[_0x5e60('0x31')]=_[_0x5e60('0x32')](_0x11fc87,_0x5e60('0x2a'));_0x405461[_0x5e60('0x33')]=_[_0x5e60('0x34')](_0x3ccfee['query']);_0x405461[_0x5e60('0x35')]=_['intersection'](_0x405461['model'],_0x405461[_0x5e60('0x33')]);_0x168ce6[_0x5e60('0x36')]=_['intersection'](_0x405461[_0x5e60('0x31')],qs['fields'](_0x3ccfee[_0x5e60('0x33')][_0x5e60('0x37')]));_0x168ce6[_0x5e60('0x36')]=_0x168ce6[_0x5e60('0x36')][_0x5e60('0x38')]?_0x168ce6[_0x5e60('0x36')]:_0x405461[_0x5e60('0x31')];if(!_0x3ccfee[_0x5e60('0x33')]['hasOwnProperty'](_0x5e60('0x39'))){_0x168ce6[_0x5e60('0x1e')]=qs[_0x5e60('0x1e')](_0x3ccfee[_0x5e60('0x33')][_0x5e60('0x1e')]);_0x168ce6[_0x5e60('0x1d')]=qs[_0x5e60('0x1d')](_0x3ccfee['query'][_0x5e60('0x1d')]);}_0x168ce6[_0x5e60('0x3a')]=qs['sort'](_0x3ccfee['query'][_0x5e60('0x3b')]);_0x168ce6[_0x5e60('0x3c')]=qs[_0x5e60('0x35')](_[_0x5e60('0x3d')](_0x3ccfee[_0x5e60('0x33')],_0x405461['filters']),_0x11fc87);if(_0x3ccfee[_0x5e60('0x33')][_0x5e60('0x3e')]){_0x168ce6[_0x5e60('0x3c')]=_[_0x5e60('0x3f')](_0x168ce6[_0x5e60('0x3c')],{'$or':_[_0x5e60('0x32')](_0x11fc87,function(_0x2b635a){if(_0x2b635a['type']!==_0x5e60('0x40')){var _0x1f95b2={};_0x1f95b2[_0x2b635a['name']]={'$like':'%'+_0x3ccfee['query']['filter']+'%'};return _0x1f95b2;}})});}_0x168ce6=_[_0x5e60('0x3f')]({},_0x168ce6,_0x3ccfee[_0x5e60('0x41')]);var _0x2c6d5b={'where':_0x168ce6[_0x5e60('0x3c')]};return db['VoiceMail'][_0x5e60('0x20')](_0x2c6d5b)[_0x5e60('0x26')](function(_0x4b6192){_0x4d4b55['count']=_0x4b6192;if(_0x3ccfee[_0x5e60('0x33')][_0x5e60('0x42')]){_0x168ce6[_0x5e60('0x43')]=[{'all':!![]}];}return db[_0x5e60('0x44')][_0x5e60('0x45')](_0x168ce6);})[_0x5e60('0x26')](function(_0x2522d2){_0x4d4b55[_0x5e60('0x46')]=_0x2522d2;return _0x4d4b55;})[_0x5e60('0x26')](respondWithFilteredResult(_0x558197,_0x168ce6))['catch'](handleError(_0x558197,null));};exports[_0x5e60('0x47')]=function(_0x2bb154,_0x59a2eb){var _0x1b1567={'raw':!![],'where':{'id':_0x2bb154[_0x5e60('0x48')]['id']}},_0x4aac07={};_0x4aac07[_0x5e60('0x31')]=_[_0x5e60('0x34')](db['VoiceMail'][_0x5e60('0x2d')]);_0x4aac07[_0x5e60('0x33')]=_[_0x5e60('0x34')](_0x2bb154[_0x5e60('0x33')]);_0x4aac07['filters']=_['intersection'](_0x4aac07['model'],_0x4aac07[_0x5e60('0x33')]);_0x1b1567[_0x5e60('0x36')]=_[_0x5e60('0x49')](_0x4aac07[_0x5e60('0x31')],qs[_0x5e60('0x37')](_0x2bb154[_0x5e60('0x33')]['fields']));_0x1b1567[_0x5e60('0x36')]=_0x1b1567[_0x5e60('0x36')][_0x5e60('0x38')]?_0x1b1567[_0x5e60('0x36')]:_0x4aac07[_0x5e60('0x31')];if(_0x2bb154[_0x5e60('0x33')][_0x5e60('0x42')]){_0x1b1567['include']=[{'all':!![]}];}_0x1b1567=_[_0x5e60('0x3f')]({},_0x1b1567,_0x2bb154[_0x5e60('0x41')]);return db[_0x5e60('0x44')][_0x5e60('0x4a')](_0x1b1567)[_0x5e60('0x26')](handleEntityNotFound(_0x59a2eb,null))[_0x5e60('0x26')](respondWithResult(_0x59a2eb,null))[_0x5e60('0x4b')](handleError(_0x59a2eb,null));};exports[_0x5e60('0x4c')]=function(_0x1518bd,_0x350d6d){return db[_0x5e60('0x44')][_0x5e60('0x4c')](_0x1518bd[_0x5e60('0x4d')],{})[_0x5e60('0x26')](function(_0x1aa381){var _0x176ef3=_0x1518bd[_0x5e60('0x4e')][_0x5e60('0x4f')]({'plain':!![]});if(!_0x176ef3)throw new Error('Unable\x20to\x20retrieve\x20the\x20current\x20user');if(_0x176ef3['role']===_0x5e60('0x4e')){var _0x4d3588=_0x1aa381[_0x5e60('0x4f')]({'plain':!![]});var _0x1d247e=_0x5e60('0x28');return db[_0x5e60('0x50')][_0x5e60('0x4a')]({'where':{'name':_0x1d247e,'userProfileId':_0x176ef3[_0x5e60('0x51')]},'raw':!![]})['then'](function(_0x48bea6){if(_0x48bea6&&_0x48bea6[_0x5e60('0x52')]===0x0){return db[_0x5e60('0x29')][_0x5e60('0x4c')]({'name':_0x4d3588['name'],'resourceId':_0x4d3588['id'],'type':_0x48bea6['name'],'sectionId':_0x48bea6['id']},{})[_0x5e60('0x26')](function(){return _0x1aa381;});}else{return _0x1aa381;}})[_0x5e60('0x4b')](function(_0x179cc6){logger['error'](_0x5e60('0x53'),_0x179cc6);throw _0x179cc6;});}return _0x1aa381;})[_0x5e60('0x26')](respondWithResult(_0x350d6d,0xc9))[_0x5e60('0x4b')](handleError(_0x350d6d,null));};exports[_0x5e60('0x25')]=function(_0x17d002,_0x148204){if(_0x17d002['body']['id']){delete _0x17d002[_0x5e60('0x4d')]['id'];}return db[_0x5e60('0x44')]['find']({'where':{'id':_0x17d002[_0x5e60('0x48')]['id']}})[_0x5e60('0x26')](handleEntityNotFound(_0x148204,null))[_0x5e60('0x26')](saveUpdates(_0x17d002['body'],null))[_0x5e60('0x26')](respondWithResult(_0x148204,null))[_0x5e60('0x4b')](handleError(_0x148204,null));};exports['destroy']=function(_0x26e129,_0x367208){return db[_0x5e60('0x44')][_0x5e60('0x4a')]({'where':{'id':_0x26e129['params']['id']}})[_0x5e60('0x26')](handleEntityNotFound(_0x367208,null))[_0x5e60('0x26')](removeEntity(_0x367208,null))['catch'](handleError(_0x367208,null));};exports[_0x5e60('0x54')]=function(_0x4cb322,_0x8d00b9,_0x5220fc){return db[_0x5e60('0x44')][_0x5e60('0x55')]({'where':{'id':_0x4cb322['params']['id']}})[_0x5e60('0x26')](handleEntityNotFound(_0x8d00b9,null))['then'](function(_0x1a2094){var _0x566fc7;var _0x157787={},_0x5b4daa={};_0x5b4daa[_0x5e60('0x31')]=_[_0x5e60('0x34')](db[_0x5e60('0x56')][_0x5e60('0x2d')]);_0x5b4daa[_0x5e60('0x33')]=_[_0x5e60('0x34')](_0x4cb322[_0x5e60('0x33')]);_0x5b4daa['filters']=_[_0x5e60('0x49')](_0x5b4daa[_0x5e60('0x31')],_0x5b4daa[_0x5e60('0x33')]);_0x157787[_0x5e60('0x36')]=_[_0x5e60('0x49')](_0x5b4daa[_0x5e60('0x31')],qs['fields'](_0x4cb322['query']['fields']));_0x157787[_0x5e60('0x36')]=_0x157787[_0x5e60('0x36')]['length']?_0x157787[_0x5e60('0x36')]:_0x5b4daa[_0x5e60('0x31')];if(!_0x4cb322['query'][_0x5e60('0x57')](_0x5e60('0x39'))){_0x157787[_0x5e60('0x1e')]=qs[_0x5e60('0x1e')](_0x4cb322[_0x5e60('0x33')][_0x5e60('0x1e')]);_0x157787[_0x5e60('0x1d')]=qs[_0x5e60('0x1d')](_0x4cb322[_0x5e60('0x33')][_0x5e60('0x1d')]);}_0x157787[_0x5e60('0x3a')]=qs[_0x5e60('0x3b')](_0x4cb322[_0x5e60('0x33')][_0x5e60('0x3b')]);_0x157787[_0x5e60('0x3c')]=qs[_0x5e60('0x35')](_[_0x5e60('0x3d')](_0x4cb322['query'],_0x5b4daa[_0x5e60('0x35')]));if(_0x4cb322[_0x5e60('0x33')][_0x5e60('0x3e')]){_0x157787['where']=_[_0x5e60('0x3f')](_0x157787[_0x5e60('0x3c')],{'$or':_['map'](_0x157787[_0x5e60('0x36')],function(_0x6f4d2f){var _0x5bbaaf={};_0x5bbaaf[_0x6f4d2f]={'$like':'%'+_0x4cb322[_0x5e60('0x33')][_0x5e60('0x3e')]+'%'};return _0x5bbaaf;})});}_0x157787[_0x5e60('0x3c')]=_[_0x5e60('0x3f')](_0x157787[_0x5e60('0x3c')],{'mailboxuser':_0x1a2094[_0x5e60('0x58')]});_0x157787=_[_0x5e60('0x3f')]({},_0x157787,_0x4cb322[_0x5e60('0x41')]);return db[_0x5e60('0x56')]['findAndCountAll'](_0x157787)[_0x5e60('0x26')](respondWithFilteredResult(_0x8d00b9,_0x157787));})[_0x5e60('0x4b')](handleError(_0x8d00b9,null));}; \ No newline at end of file +var _0x7af2=['Unable\x20to\x20retrieve\x20the\x20current\x20user','role','user','UserProfileSection','userProfileId','autoAssociation','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','body','destroy','getMessages','findOne','VoiceMailMessage','rawAttributes','mailbox','rimraf','zip-dir','fast-json-patch','request-promise','bluebird','mustache','util','path','sox','to-csv','ejs','fs-extra','lodash','crypto','jsforce','desk.js','querystring','papaparse','ioredis','../../components/parsers/qs','../../config/logger','../../config/environment','../../mysqldb','sendStatus','status','end','json','offset','undefined','limit','count','Content-Range','apply','reject','update','then','get','Voicemails','UserProfileResource','error','stack','name','send','index','map','VoiceMail','fieldName','type','model','query','keys','filters','intersection','attributes','fields','hasOwnProperty','nolimit','order','sort','where','pick','filter','merge','VIRTUAL','options','includeAll','findAll','rows','catch','show','params','length','include','find','create'];(function(_0x5b9776,_0x1aa187){var _0x3586a6=function(_0x5dbd8d){while(--_0x5dbd8d){_0x5b9776['push'](_0x5b9776['shift']());}};_0x3586a6(++_0x1aa187);}(_0x7af2,0x119));var _0x27af=function(_0x1ba691,_0x59087e){_0x1ba691=_0x1ba691-0x0;var _0xa6091c=_0x7af2[_0x1ba691];return _0xa6091c;};'use strict';var emlformat=require('eml-format');var rimraf=require(_0x27af('0x0'));var zipdir=require(_0x27af('0x1'));var jsonpatch=require(_0x27af('0x2'));var rp=require(_0x27af('0x3'));var moment=require('moment');var BPromise=require(_0x27af('0x4'));var Mustache=require(_0x27af('0x5'));var util=require(_0x27af('0x6'));var path=require(_0x27af('0x7'));var sox=require(_0x27af('0x8'));var csv=require(_0x27af('0x9'));var ejs=require(_0x27af('0xa'));var fs=require('fs');var fs_extra=require(_0x27af('0xb'));var _=require(_0x27af('0xc'));var squel=require('squel');var crypto=require(_0x27af('0xd'));var jsforce=require(_0x27af('0xe'));var deskjs=require(_0x27af('0xf'));var toCsv=require('to-csv');var querystring=require(_0x27af('0x10'));var Papa=require(_0x27af('0x11'));var Redis=require(_0x27af('0x12'));var authService=require('../../components/auth/service');var qs=require(_0x27af('0x13'));var as=require('../../components/parsers/advancedSearch');var hardwareService=require('../../config/license/hardware');var logger=require(_0x27af('0x14'))('api');var utils=require('../../config/utils');var config=require(_0x27af('0x15'));var licenseUtil=require('../../config/license/util');var db=require(_0x27af('0x16'))['db'];function respondWithStatusCode(_0x49a883,_0x406340){_0x406340=_0x406340||0xcc;return function(_0x203501){if(_0x203501){return _0x49a883[_0x27af('0x17')](_0x406340);}return _0x49a883[_0x27af('0x18')](_0x406340)[_0x27af('0x19')]();};}function respondWithResult(_0x1edb50,_0x234825){_0x234825=_0x234825||0xc8;return function(_0x3da435){if(_0x3da435){return _0x1edb50[_0x27af('0x18')](_0x234825)[_0x27af('0x1a')](_0x3da435);}};}function respondWithFilteredResult(_0x30f675,_0x9c2d4b){return function(_0x2d7800){if(_0x2d7800){var _0x3102c4=typeof _0x9c2d4b[_0x27af('0x1b')]===_0x27af('0x1c')&&typeof _0x9c2d4b[_0x27af('0x1d')]===_0x27af('0x1c');var _0x58583a=_0x2d7800[_0x27af('0x1e')];var _0x31d702=_0x3102c4?0x0:_0x9c2d4b['offset'];var _0x4e6e2f=_0x3102c4?_0x2d7800[_0x27af('0x1e')]:_0x9c2d4b[_0x27af('0x1b')]+_0x9c2d4b[_0x27af('0x1d')];var _0x31573a;if(_0x4e6e2f>=_0x58583a){_0x4e6e2f=_0x58583a;_0x31573a=0xc8;}else{_0x31573a=0xce;}_0x30f675[_0x27af('0x18')](_0x31573a);return _0x30f675['set'](_0x27af('0x1f'),_0x31d702+'-'+_0x4e6e2f+'/'+_0x58583a)[_0x27af('0x1a')](_0x2d7800);}return null;};}function patchUpdates(_0xcb4b90){return function(_0x5e7c19){try{jsonpatch[_0x27af('0x20')](_0x5e7c19,_0xcb4b90,!![]);}catch(_0x2eec5f){return BPromise[_0x27af('0x21')](_0x2eec5f);}return _0x5e7c19['save']();};}function saveUpdates(_0x2dce2b,_0x2460f4){return function(_0x30720b){if(_0x30720b){return _0x30720b[_0x27af('0x22')](_0x2dce2b)[_0x27af('0x23')](function(_0x396156){return _0x396156;});}return null;};}function removeEntity(_0x43dd9e,_0x35b36d){return function(_0x2e1bb0){if(_0x2e1bb0){return _0x2e1bb0['destroy']()['then'](function(){var _0x4b8fe6=_0x2e1bb0[_0x27af('0x24')]({'plain':!![]});var _0x4feaf1=_0x27af('0x25');return db[_0x27af('0x26')]['destroy']({'where':{'type':_0x4feaf1,'resourceId':_0x4b8fe6['id']}})[_0x27af('0x23')](function(){return _0x2e1bb0;});})[_0x27af('0x23')](function(){_0x43dd9e[_0x27af('0x18')](0xcc)[_0x27af('0x19')]();});}};}function handleEntityNotFound(_0x39b8ee,_0x3ca40e){return function(_0x775d4e){if(!_0x775d4e){_0x39b8ee['sendStatus'](0x194);}return _0x775d4e;};}function handleError(_0x14d5fc,_0x250d5b){_0x250d5b=_0x250d5b||0x1f4;return function(_0xadd38e){logger[_0x27af('0x27')](_0xadd38e[_0x27af('0x28')]);if(_0xadd38e[_0x27af('0x29')]){delete _0xadd38e[_0x27af('0x29')];}_0x14d5fc[_0x27af('0x18')](_0x250d5b)[_0x27af('0x2a')](_0xadd38e);};}exports[_0x27af('0x2b')]=function(_0x205e41,_0x4f4955){var _0x15e867={},_0x14b2e7={},_0x3800a1={'count':0x0,'rows':[]};var _0x575887=_[_0x27af('0x2c')](db[_0x27af('0x2d')]['rawAttributes'],function(_0x51bc97){return{'name':_0x51bc97[_0x27af('0x2e')],'type':_0x51bc97[_0x27af('0x2f')]['key']};});_0x14b2e7[_0x27af('0x30')]=_[_0x27af('0x2c')](_0x575887,_0x27af('0x29'));_0x14b2e7[_0x27af('0x31')]=_[_0x27af('0x32')](_0x205e41[_0x27af('0x31')]);_0x14b2e7[_0x27af('0x33')]=_[_0x27af('0x34')](_0x14b2e7[_0x27af('0x30')],_0x14b2e7[_0x27af('0x31')]);_0x15e867[_0x27af('0x35')]=_['intersection'](_0x14b2e7['model'],qs[_0x27af('0x36')](_0x205e41[_0x27af('0x31')]['fields']));_0x15e867[_0x27af('0x35')]=_0x15e867[_0x27af('0x35')]['length']?_0x15e867[_0x27af('0x35')]:_0x14b2e7[_0x27af('0x30')];if(!_0x205e41[_0x27af('0x31')][_0x27af('0x37')](_0x27af('0x38'))){_0x15e867['limit']=qs[_0x27af('0x1d')](_0x205e41[_0x27af('0x31')]['limit']);_0x15e867['offset']=qs[_0x27af('0x1b')](_0x205e41[_0x27af('0x31')][_0x27af('0x1b')]);}_0x15e867[_0x27af('0x39')]=qs[_0x27af('0x3a')](_0x205e41[_0x27af('0x31')]['sort']);_0x15e867[_0x27af('0x3b')]=qs['filters'](_[_0x27af('0x3c')](_0x205e41[_0x27af('0x31')],_0x14b2e7[_0x27af('0x33')]),_0x575887);if(_0x205e41[_0x27af('0x31')][_0x27af('0x3d')]){_0x15e867['where']=_[_0x27af('0x3e')](_0x15e867[_0x27af('0x3b')],{'$or':_[_0x27af('0x2c')](_0x575887,function(_0x3faebd){if(_0x3faebd[_0x27af('0x2f')]!==_0x27af('0x3f')){var _0x415d9f={};_0x415d9f[_0x3faebd[_0x27af('0x29')]]={'$like':'%'+_0x205e41[_0x27af('0x31')][_0x27af('0x3d')]+'%'};return _0x415d9f;}})});}_0x15e867=_[_0x27af('0x3e')]({},_0x15e867,_0x205e41[_0x27af('0x40')]);var _0x24ee9b={'where':_0x15e867[_0x27af('0x3b')]};return db['VoiceMail'][_0x27af('0x1e')](_0x24ee9b)[_0x27af('0x23')](function(_0x44534b){_0x3800a1[_0x27af('0x1e')]=_0x44534b;if(_0x205e41['query'][_0x27af('0x41')]){_0x15e867['include']=[{'all':!![]}];}return db['VoiceMail'][_0x27af('0x42')](_0x15e867);})[_0x27af('0x23')](function(_0x279f99){_0x3800a1[_0x27af('0x43')]=_0x279f99;return _0x3800a1;})[_0x27af('0x23')](respondWithFilteredResult(_0x4f4955,_0x15e867))[_0x27af('0x44')](handleError(_0x4f4955,null));};exports[_0x27af('0x45')]=function(_0x26eb28,_0x2269e8){var _0x100fcb={'raw':!![],'where':{'id':_0x26eb28[_0x27af('0x46')]['id']}},_0x1e3c35={};_0x1e3c35['model']=_[_0x27af('0x32')](db[_0x27af('0x2d')]['rawAttributes']);_0x1e3c35['query']=_[_0x27af('0x32')](_0x26eb28[_0x27af('0x31')]);_0x1e3c35[_0x27af('0x33')]=_[_0x27af('0x34')](_0x1e3c35[_0x27af('0x30')],_0x1e3c35['query']);_0x100fcb[_0x27af('0x35')]=_['intersection'](_0x1e3c35[_0x27af('0x30')],qs[_0x27af('0x36')](_0x26eb28[_0x27af('0x31')][_0x27af('0x36')]));_0x100fcb[_0x27af('0x35')]=_0x100fcb[_0x27af('0x35')][_0x27af('0x47')]?_0x100fcb['attributes']:_0x1e3c35['model'];if(_0x26eb28[_0x27af('0x31')]['includeAll']){_0x100fcb[_0x27af('0x48')]=[{'all':!![]}];}_0x100fcb=_[_0x27af('0x3e')]({},_0x100fcb,_0x26eb28[_0x27af('0x40')]);return db[_0x27af('0x2d')][_0x27af('0x49')](_0x100fcb)[_0x27af('0x23')](handleEntityNotFound(_0x2269e8,null))[_0x27af('0x23')](respondWithResult(_0x2269e8,null))['catch'](handleError(_0x2269e8,null));};exports[_0x27af('0x4a')]=function(_0xc7e2a8,_0x20e180){return db[_0x27af('0x2d')][_0x27af('0x4a')](_0xc7e2a8['body'],{})[_0x27af('0x23')](function(_0x25f960){var _0x28ba64=_0xc7e2a8['user']['get']({'plain':!![]});if(!_0x28ba64)throw new Error(_0x27af('0x4b'));if(_0x28ba64[_0x27af('0x4c')]===_0x27af('0x4d')){var _0x5be44f=_0x25f960['get']({'plain':!![]});var _0x2fad23='Voicemails';return db[_0x27af('0x4e')][_0x27af('0x49')]({'where':{'name':_0x2fad23,'userProfileId':_0x28ba64[_0x27af('0x4f')]},'raw':!![]})[_0x27af('0x23')](function(_0x38aa14){if(_0x38aa14&&_0x38aa14[_0x27af('0x50')]===0x0){return db[_0x27af('0x26')][_0x27af('0x4a')]({'name':_0x5be44f[_0x27af('0x29')],'resourceId':_0x5be44f['id'],'type':_0x38aa14[_0x27af('0x29')],'sectionId':_0x38aa14['id']},{})[_0x27af('0x23')](function(){return _0x25f960;});}else{return _0x25f960;}})['catch'](function(_0x76ed78){logger[_0x27af('0x27')](_0x27af('0x51'),_0x76ed78);throw _0x76ed78;});}return _0x25f960;})[_0x27af('0x23')](respondWithResult(_0x20e180,0xc9))[_0x27af('0x44')](handleError(_0x20e180,null));};exports[_0x27af('0x22')]=function(_0x20c155,_0x31eaa9){if(_0x20c155['body']['id']){delete _0x20c155[_0x27af('0x52')]['id'];}return db['VoiceMail'][_0x27af('0x49')]({'where':{'id':_0x20c155[_0x27af('0x46')]['id']}})[_0x27af('0x23')](handleEntityNotFound(_0x31eaa9,null))['then'](saveUpdates(_0x20c155[_0x27af('0x52')],null))['then'](respondWithResult(_0x31eaa9,null))[_0x27af('0x44')](handleError(_0x31eaa9,null));};exports[_0x27af('0x53')]=function(_0x4769ff,_0x5bf8b0){return db[_0x27af('0x2d')]['find']({'where':{'id':_0x4769ff[_0x27af('0x46')]['id']}})['then'](handleEntityNotFound(_0x5bf8b0,null))[_0x27af('0x23')](removeEntity(_0x5bf8b0,null))[_0x27af('0x44')](handleError(_0x5bf8b0,null));};exports[_0x27af('0x54')]=function(_0x571064,_0x4bc851,_0x5eab7d){return db[_0x27af('0x2d')][_0x27af('0x55')]({'where':{'id':_0x571064[_0x27af('0x46')]['id']}})['then'](handleEntityNotFound(_0x4bc851,null))[_0x27af('0x23')](function(_0x306c56){var _0x6761d4;var _0x34c855={},_0x299f63={};_0x299f63[_0x27af('0x30')]=_['keys'](db[_0x27af('0x56')][_0x27af('0x57')]);_0x299f63[_0x27af('0x31')]=_[_0x27af('0x32')](_0x571064['query']);_0x299f63[_0x27af('0x33')]=_['intersection'](_0x299f63[_0x27af('0x30')],_0x299f63[_0x27af('0x31')]);_0x34c855['attributes']=_[_0x27af('0x34')](_0x299f63[_0x27af('0x30')],qs['fields'](_0x571064['query'][_0x27af('0x36')]));_0x34c855[_0x27af('0x35')]=_0x34c855[_0x27af('0x35')]['length']?_0x34c855[_0x27af('0x35')]:_0x299f63[_0x27af('0x30')];if(!_0x571064['query'][_0x27af('0x37')](_0x27af('0x38'))){_0x34c855['limit']=qs['limit'](_0x571064[_0x27af('0x31')][_0x27af('0x1d')]);_0x34c855['offset']=qs['offset'](_0x571064[_0x27af('0x31')][_0x27af('0x1b')]);}_0x34c855[_0x27af('0x39')]=qs[_0x27af('0x3a')](_0x571064[_0x27af('0x31')][_0x27af('0x3a')]);_0x34c855[_0x27af('0x3b')]=qs['filters'](_['pick'](_0x571064[_0x27af('0x31')],_0x299f63[_0x27af('0x33')]));if(_0x571064[_0x27af('0x31')][_0x27af('0x3d')]){_0x34c855[_0x27af('0x3b')]=_[_0x27af('0x3e')](_0x34c855[_0x27af('0x3b')],{'$or':_[_0x27af('0x2c')](_0x34c855[_0x27af('0x35')],function(_0x13c9ff){var _0x444f21={};_0x444f21[_0x13c9ff]={'$like':'%'+_0x571064[_0x27af('0x31')][_0x27af('0x3d')]+'%'};return _0x444f21;})});}_0x34c855[_0x27af('0x3b')]=_[_0x27af('0x3e')](_0x34c855[_0x27af('0x3b')],{'mailboxuser':_0x306c56[_0x27af('0x58')]});_0x34c855=_['merge']({},_0x34c855,_0x571064[_0x27af('0x40')]);return db[_0x27af('0x56')]['findAndCountAll'](_0x34c855)[_0x27af('0x23')](respondWithFilteredResult(_0x4bc851,_0x34c855));})[_0x27af('0x44')](handleError(_0x4bc851,null));}; \ No newline at end of file diff --git a/server/api/voiceMail/voiceMail.model.js b/server/api/voiceMail/voiceMail.model.js index 0409ab9..4c24f68 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 _0xc9f1=['rimraf','../../config/environment','./voiceMail.attributes','define','VoiceMail','voice_voicemail','mailbox','context','lodash','util','../../config/logger','api','moment','request-promise','path'];(function(_0x2cfc09,_0x44388){var _0x2e7be6=function(_0x352aa1){while(--_0x352aa1){_0x2cfc09['push'](_0x2cfc09['shift']());}};_0x2e7be6(++_0x44388);}(_0xc9f1,0x161));var _0x1c9f=function(_0x52bbc9,_0x3524f0){_0x52bbc9=_0x52bbc9-0x0;var _0x26e579=_0xc9f1[_0x52bbc9];return _0x26e579;};'use strict';var _=require(_0x1c9f('0x0'));var util=require(_0x1c9f('0x1'));var logger=require(_0x1c9f('0x2'))(_0x1c9f('0x3'));var moment=require(_0x1c9f('0x4'));var BPromise=require('bluebird');var rp=require(_0x1c9f('0x5'));var fs=require('fs');var path=require(_0x1c9f('0x6'));var rimraf=require(_0x1c9f('0x7'));var config=require(_0x1c9f('0x8'));var attributes=require(_0x1c9f('0x9'));module['exports']=function(_0x485bbf,_0x5c9536){return _0x485bbf[_0x1c9f('0xa')](_0x1c9f('0xb'),attributes,{'tableName':_0x1c9f('0xc'),'paranoid':![],'indexes':[{'name':'mailbox_context','fields':[_0x1c9f('0xd'),_0x1c9f('0xe')]}],'timestamps':!![]});}; \ No newline at end of file +var _0x16b1=['moment','path','../../config/environment','exports','define','VoiceMail','voice_voicemail','mailbox_context','mailbox','lodash','util','../../config/logger','api'];(function(_0x4cbd76,_0x57b358){var _0x5e8c41=function(_0x1b4508){while(--_0x1b4508){_0x4cbd76['push'](_0x4cbd76['shift']());}};_0x5e8c41(++_0x57b358);}(_0x16b1,0x134));var _0x116b=function(_0x362996,_0x55e220){_0x362996=_0x362996-0x0;var _0xf20bc2=_0x16b1[_0x362996];return _0xf20bc2;};'use strict';var _=require(_0x116b('0x0'));var util=require(_0x116b('0x1'));var logger=require(_0x116b('0x2'))(_0x116b('0x3'));var moment=require(_0x116b('0x4'));var BPromise=require('bluebird');var rp=require('request-promise');var fs=require('fs');var path=require(_0x116b('0x5'));var rimraf=require('rimraf');var config=require(_0x116b('0x6'));var attributes=require('./voiceMail.attributes');module[_0x116b('0x7')]=function(_0x5c98ef,_0x1b4b77){return _0x5c98ef[_0x116b('0x8')](_0x116b('0x9'),attributes,{'tableName':_0x116b('0xa'),'paranoid':![],'indexes':[{'name':_0x116b('0xb'),'fields':[_0x116b('0xc'),'context']}],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/voiceMail/voiceMail.rpc.js b/server/api/voiceMail/voiceMail.rpc.js index 1629b1e..5311ccb 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 _0xc398=['catch','lodash','util','bluebird','randomstring','ioredis','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','client','info','VoiceMail,\x20%s,\x20%s','request\x20sent','debug','VoiceMail,\x20%s,\x20%s,\x20%s','stringify','error','code','message'];(function(_0x1185bc,_0x96e77){var _0x4f58ef=function(_0x3946e4){while(--_0x3946e4){_0x1185bc['push'](_0x1185bc['shift']());}};_0x4f58ef(++_0x96e77);}(_0xc398,0x112));var _0x8c39=function(_0x53f04f,_0x419aa8){_0x53f04f=_0x53f04f-0x0;var _0x16a824=_0xc398[_0x53f04f];return _0x16a824;};'use strict';var _=require(_0x8c39('0x0'));var util=require(_0x8c39('0x1'));var moment=require('moment');var BPromise=require(_0x8c39('0x2'));var rs=require(_0x8c39('0x3'));var fs=require('fs');var Redis=require(_0x8c39('0x4'));var db=require('../../mysqldb')['db'];var utils=require(_0x8c39('0x5'));var logger=require(_0x8c39('0x6'))(_0x8c39('0x7'));var config=require(_0x8c39('0x8'));var jayson=require(_0x8c39('0x9'));var client=jayson[_0x8c39('0xa')]['http']({'port':0x232a});function respondWithRpcPromise(_0x2dfd88,_0x3e0cc7,_0x46ac88){return new BPromise(function(_0x1e5641,_0x3d69cf){return client['request'](_0x2dfd88,_0x46ac88)['then'](function(_0x3386c0){logger[_0x8c39('0xb')](_0x8c39('0xc'),_0x3e0cc7,_0x8c39('0xd'));logger[_0x8c39('0xe')](_0x8c39('0xf'),_0x3e0cc7,'request\x20sent',JSON[_0x8c39('0x10')](_0x3386c0));if(_0x3386c0[_0x8c39('0x11')]){if(_0x3386c0[_0x8c39('0x11')][_0x8c39('0x12')]===0x1f4){logger[_0x8c39('0x11')](_0x8c39('0xc'),_0x3e0cc7,_0x3386c0[_0x8c39('0x11')]['message']);return _0x3d69cf(_0x3386c0[_0x8c39('0x11')]['message']);}logger[_0x8c39('0x11')](_0x8c39('0xc'),_0x3e0cc7,_0x3386c0[_0x8c39('0x11')]['message']);return _0x1e5641(_0x3386c0['error'][_0x8c39('0x13')]);}else{logger[_0x8c39('0xb')](_0x8c39('0xc'),_0x3e0cc7,_0x8c39('0xd'));_0x1e5641(_0x3386c0['result'][_0x8c39('0x13')]);}})[_0x8c39('0x14')](function(_0x4f7063){logger[_0x8c39('0x11')](_0x8c39('0xc'),_0x3e0cc7,_0x4f7063);_0x3d69cf(_0x4f7063);});});} \ No newline at end of file +var _0x9f3f=['code','error','message','result','lodash','util','moment','bluebird','randomstring','ioredis','rpc','../../config/environment','client','http','request','then','info','VoiceMail,\x20%s,\x20%s','VoiceMail,\x20%s,\x20%s,\x20%s','request\x20sent','stringify'];(function(_0x27af45,_0x1b57aa){var _0x18df21=function(_0x4b7679){while(--_0x4b7679){_0x27af45['push'](_0x27af45['shift']());}};_0x18df21(++_0x1b57aa);}(_0x9f3f,0x17e));var _0xf9f3=function(_0x2b41e8,_0x86e285){_0x2b41e8=_0x2b41e8-0x0;var _0x396ab3=_0x9f3f[_0x2b41e8];return _0x396ab3;};'use strict';var _=require(_0xf9f3('0x0'));var util=require(_0xf9f3('0x1'));var moment=require(_0xf9f3('0x2'));var BPromise=require(_0xf9f3('0x3'));var rs=require(_0xf9f3('0x4'));var fs=require('fs');var Redis=require(_0xf9f3('0x5'));var db=require('../../mysqldb')['db'];var utils=require('../../config/utils');var logger=require('../../config/logger')(_0xf9f3('0x6'));var config=require(_0xf9f3('0x7'));var jayson=require('jayson/promise');var client=jayson[_0xf9f3('0x8')][_0xf9f3('0x9')]({'port':0x232a});function respondWithRpcPromise(_0x57a804,_0x3b91b9,_0x2c8740){return new BPromise(function(_0x21fa0a,_0xe619e6){return client[_0xf9f3('0xa')](_0x57a804,_0x2c8740)[_0xf9f3('0xb')](function(_0x13f357){logger[_0xf9f3('0xc')](_0xf9f3('0xd'),_0x3b91b9,'request\x20sent');logger['debug'](_0xf9f3('0xe'),_0x3b91b9,_0xf9f3('0xf'),JSON[_0xf9f3('0x10')](_0x13f357));if(_0x13f357['error']){if(_0x13f357['error'][_0xf9f3('0x11')]===0x1f4){logger[_0xf9f3('0x12')](_0xf9f3('0xd'),_0x3b91b9,_0x13f357['error'][_0xf9f3('0x13')]);return _0xe619e6(_0x13f357['error'][_0xf9f3('0x13')]);}logger['error']('VoiceMail,\x20%s,\x20%s',_0x3b91b9,_0x13f357[_0xf9f3('0x12')][_0xf9f3('0x13')]);return _0x21fa0a(_0x13f357[_0xf9f3('0x12')][_0xf9f3('0x13')]);}else{logger[_0xf9f3('0xc')](_0xf9f3('0xd'),_0x3b91b9,_0xf9f3('0xf'));_0x21fa0a(_0x13f357[_0xf9f3('0x14')][_0xf9f3('0x13')]);}})['catch'](function(_0x27e1ce){logger[_0xf9f3('0x12')](_0xf9f3('0xd'),_0x3b91b9,_0x27e1ce);_0xe619e6(_0x27e1ce);});});} \ No newline at end of file diff --git a/server/api/voiceMailMessage/index.js b/server/api/voiceMailMessage/index.js index f1b5b90..4a0bed7 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 _0xed74=['delete','destroy','exports','multer','util','path','connect-timeout','express','Router','fs-extra','../../components/auth/service','../../config/environment','./voiceMailMessage.controller','isAuthenticated','index','get','/:id/download','download','post','create','put','/:id','update'];(function(_0x1752dc,_0x564306){var _0x216466=function(_0x58cad9){while(--_0x58cad9){_0x1752dc['push'](_0x1752dc['shift']());}};_0x216466(++_0x564306);}(_0xed74,0x117));var _0x4ed7=function(_0x576139,_0x4d401d){_0x576139=_0x576139-0x0;var _0x3519cc=_0xed74[_0x576139];return _0x3519cc;};'use strict';var multer=require(_0x4ed7('0x0'));var util=require(_0x4ed7('0x1'));var path=require(_0x4ed7('0x2'));var timeout=require(_0x4ed7('0x3'));var express=require(_0x4ed7('0x4'));var router=express[_0x4ed7('0x5')]();var fs_extra=require(_0x4ed7('0x6'));var auth=require(_0x4ed7('0x7'));var interaction=require('../../components/interaction/service');var config=require(_0x4ed7('0x8'));var controller=require(_0x4ed7('0x9'));router['get']('/',auth[_0x4ed7('0xa')](),controller[_0x4ed7('0xb')]);router[_0x4ed7('0xc')]('/:id',auth[_0x4ed7('0xa')](),controller['show']);router[_0x4ed7('0xc')](_0x4ed7('0xd'),auth['isAuthenticated'](),controller[_0x4ed7('0xe')]);router[_0x4ed7('0xf')]('/',auth[_0x4ed7('0xa')](),controller[_0x4ed7('0x10')]);router[_0x4ed7('0x11')](_0x4ed7('0x12'),auth[_0x4ed7('0xa')](),controller[_0x4ed7('0x13')]);router[_0x4ed7('0x14')]('/:id',auth[_0x4ed7('0xa')](),controller[_0x4ed7('0x15')]);module[_0x4ed7('0x16')]=router; \ No newline at end of file +var _0x5263=['post','create','put','update','delete','destroy','exports','util','connect-timeout','Router','fs-extra','../../config/environment','./voiceMailMessage.controller','isAuthenticated','index','get','/:id','show','/:id/download','download'];(function(_0x1a2413,_0x54bad2){var _0x14b2a0=function(_0xc2628a){while(--_0xc2628a){_0x1a2413['push'](_0x1a2413['shift']());}};_0x14b2a0(++_0x54bad2);}(_0x5263,0xa7));var _0x3526=function(_0x273c39,_0x1052e6){_0x273c39=_0x273c39-0x0;var _0x46d6b5=_0x5263[_0x273c39];return _0x46d6b5;};'use strict';var multer=require('multer');var util=require(_0x3526('0x0'));var path=require('path');var timeout=require(_0x3526('0x1'));var express=require('express');var router=express[_0x3526('0x2')]();var fs_extra=require(_0x3526('0x3'));var auth=require('../../components/auth/service');var interaction=require('../../components/interaction/service');var config=require(_0x3526('0x4'));var controller=require(_0x3526('0x5'));router['get']('/',auth[_0x3526('0x6')](),controller[_0x3526('0x7')]);router[_0x3526('0x8')](_0x3526('0x9'),auth[_0x3526('0x6')](),controller[_0x3526('0xa')]);router['get'](_0x3526('0xb'),auth[_0x3526('0x6')](),controller[_0x3526('0xc')]);router[_0x3526('0xd')]('/',auth['isAuthenticated'](),controller[_0x3526('0xe')]);router[_0x3526('0xf')](_0x3526('0x9'),auth[_0x3526('0x6')](),controller[_0x3526('0x10')]);router[_0x3526('0x11')](_0x3526('0x9'),auth[_0x3526('0x6')](),controller[_0x3526('0x12')]);module[_0x3526('0x13')]=router; \ No newline at end of file diff --git a/server/api/voiceMailMessage/voiceMailMessage.attributes.js b/server/api/voiceMailMessage/voiceMailMessage.attributes.js index 5d852f2..52b0376 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 _0xcf78=['INTEGER','STRING','BLOB','long','TIMESTAMP','CURRENT_TIMESTAMP\x20ON\x20UPDATE\x20CURRENT_TIMESTAMP','sequelize','exports','VIRTUAL','getDataValue'];(function(_0x5b68a3,_0x3e48f5){var _0x20332f=function(_0x425a94){while(--_0x425a94){_0x5b68a3['push'](_0x5b68a3['shift']());}};_0x20332f(++_0x3e48f5);}(_0xcf78,0xb0));var _0x8cf7=function(_0x4f3522,_0x3e9fb){_0x4f3522=_0x4f3522-0x0;var _0x5b4de7=_0xcf78[_0x4f3522];return _0x5b4de7;};'use strict';var Sequelize=require(_0x8cf7('0x0'));module[_0x8cf7('0x1')]={'name':{'type':Sequelize[_0x8cf7('0x2')],'get':function(_0x18e274){return this[_0x8cf7('0x3')]('id');}},'msgnum':{'type':Sequelize[_0x8cf7('0x4')](0xb),'defaultValue':0x0,'allowNull':![]},'dir':{'type':Sequelize['STRING'],'defaultValue':''},'context':{'type':Sequelize['STRING'],'defaultValue':''},'macrocontext':{'type':Sequelize['STRING'],'defaultValue':''},'callerid':{'type':Sequelize[_0x8cf7('0x5')],'defaultValue':''},'origtime':{'type':Sequelize['STRING'],'defaultValue':''},'duration':{'type':Sequelize[_0x8cf7('0x5')],'defaultValue':''},'mailboxuser':{'type':Sequelize[_0x8cf7('0x5')],'defaultValue':''},'mailboxcontext':{'type':Sequelize['STRING'],'defaultValue':''},'recording':{'type':Sequelize[_0x8cf7('0x6')](_0x8cf7('0x7')),'defaultValue':null},'flag':{'type':Sequelize['STRING'],'defaultValue':''},'msg_id':{'type':Sequelize['STRING'],'defaultValue':''},'stamp':{'type':_0x8cf7('0x8'),'defaultValue':Sequelize['literal'](_0x8cf7('0x9'))}}; \ No newline at end of file +var _0x92c0=['literal','CURRENT_TIMESTAMP\x20ON\x20UPDATE\x20CURRENT_TIMESTAMP','sequelize','exports','getDataValue','STRING','BLOB','TIMESTAMP'];(function(_0x31c371,_0x47300f){var _0xa4b455=function(_0x19b5a4){while(--_0x19b5a4){_0x31c371['push'](_0x31c371['shift']());}};_0xa4b455(++_0x47300f);}(_0x92c0,0x16a));var _0x092c=function(_0x1f054a,_0x513d26){_0x1f054a=_0x1f054a-0x0;var _0x330d08=_0x92c0[_0x1f054a];return _0x330d08;};'use strict';var Sequelize=require(_0x092c('0x0'));module[_0x092c('0x1')]={'name':{'type':Sequelize['VIRTUAL'],'get':function(_0x41f487){return this[_0x092c('0x2')]('id');}},'msgnum':{'type':Sequelize['INTEGER'](0xb),'defaultValue':0x0,'allowNull':![]},'dir':{'type':Sequelize[_0x092c('0x3')],'defaultValue':''},'context':{'type':Sequelize[_0x092c('0x3')],'defaultValue':''},'macrocontext':{'type':Sequelize[_0x092c('0x3')],'defaultValue':''},'callerid':{'type':Sequelize['STRING'],'defaultValue':''},'origtime':{'type':Sequelize['STRING'],'defaultValue':''},'duration':{'type':Sequelize[_0x092c('0x3')],'defaultValue':''},'mailboxuser':{'type':Sequelize[_0x092c('0x3')],'defaultValue':''},'mailboxcontext':{'type':Sequelize[_0x092c('0x3')],'defaultValue':''},'recording':{'type':Sequelize[_0x092c('0x4')]('long'),'defaultValue':null},'flag':{'type':Sequelize['STRING'],'defaultValue':''},'msg_id':{'type':Sequelize['STRING'],'defaultValue':''},'stamp':{'type':_0x092c('0x5'),'defaultValue':Sequelize[_0x092c('0x6')](_0x092c('0x7'))}}; \ No newline at end of file diff --git a/server/api/voiceMailMessage/voiceMailMessage.controller.js b/server/api/voiceMailMessage/voiceMailMessage.controller.js index 966152d..573ef27 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 _0x53f9=['rimraf','zip-dir','fast-json-patch','request-promise','moment','mustache','to-csv','ejs','lodash','squel','jsforce','desk.js','querystring','papaparse','ioredis','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/license/util','../../mysqldb','sendStatus','end','status','json','undefined','limit','count','offset','set','Content-Range','reject','save','then','error','stack','name','VoiceMailMessage','rawAttributes','fieldName','type','key','model','map','query','keys','filters','intersection','attributes','fields','length','hasOwnProperty','nolimit','order','sort','where','filter','merge','VIRTUAL','options','includeAll','include','findAll','rows','catch','show','params','create','body','update','find','download','ValidationError','VoiceMailMessage\x20not\x20found','audio/wav','attachment','msg_id','.wav\x22','send','recording','eml-format'];(function(_0x5bc6c7,_0x1cfb29){var _0x17aec5=function(_0x3204f8){while(--_0x3204f8){_0x5bc6c7['push'](_0x5bc6c7['shift']());}};_0x17aec5(++_0x1cfb29);}(_0x53f9,0x147));var _0x953f=function(_0x1ee0a1,_0x51058e){_0x1ee0a1=_0x1ee0a1-0x0;var _0x1d2d5b=_0x53f9[_0x1ee0a1];return _0x1d2d5b;};'use strict';var emlformat=require(_0x953f('0x0'));var rimraf=require(_0x953f('0x1'));var zipdir=require(_0x953f('0x2'));var jsonpatch=require(_0x953f('0x3'));var rp=require(_0x953f('0x4'));var moment=require(_0x953f('0x5'));var BPromise=require('bluebird');var Mustache=require(_0x953f('0x6'));var util=require('util');var path=require('path');var sox=require('sox');var csv=require(_0x953f('0x7'));var ejs=require(_0x953f('0x8'));var fs=require('fs');var fs_extra=require('fs-extra');var _=require(_0x953f('0x9'));var squel=require(_0x953f('0xa'));var crypto=require('crypto');var jsforce=require(_0x953f('0xb'));var deskjs=require(_0x953f('0xc'));var toCsv=require(_0x953f('0x7'));var querystring=require(_0x953f('0xd'));var Papa=require(_0x953f('0xe'));var Redis=require(_0x953f('0xf'));var authService=require('../../components/auth/service');var qs=require('../../components/parsers/qs');var as=require(_0x953f('0x10'));var hardwareService=require(_0x953f('0x11'));var logger=require(_0x953f('0x12'))(_0x953f('0x13'));var utils=require(_0x953f('0x14'));var config=require('../../config/environment');var licenseUtil=require(_0x953f('0x15'));var db=require(_0x953f('0x16'))['db'];function respondWithStatusCode(_0xa80119,_0x4cf443){_0x4cf443=_0x4cf443||0xcc;return function(_0x32d3d1){if(_0x32d3d1){return _0xa80119[_0x953f('0x17')](_0x4cf443);}return _0xa80119['status'](_0x4cf443)[_0x953f('0x18')]();};}function respondWithResult(_0x1a3a71,_0x39f5db){_0x39f5db=_0x39f5db||0xc8;return function(_0x3d4a3c){if(_0x3d4a3c){return _0x1a3a71[_0x953f('0x19')](_0x39f5db)[_0x953f('0x1a')](_0x3d4a3c);}};}function respondWithFilteredResult(_0x197c95,_0x399927){return function(_0x58da76){if(_0x58da76){var _0xb2e11=typeof _0x399927['offset']===_0x953f('0x1b')&&typeof _0x399927[_0x953f('0x1c')]===_0x953f('0x1b');var _0x523437=_0x58da76[_0x953f('0x1d')];var _0x126c96=_0xb2e11?0x0:_0x399927['offset'];var _0x20028b=_0xb2e11?_0x58da76[_0x953f('0x1d')]:_0x399927[_0x953f('0x1e')]+_0x399927[_0x953f('0x1c')];var _0x50a278;if(_0x20028b>=_0x523437){_0x20028b=_0x523437;_0x50a278=0xc8;}else{_0x50a278=0xce;}_0x197c95[_0x953f('0x19')](_0x50a278);return _0x197c95[_0x953f('0x1f')](_0x953f('0x20'),_0x126c96+'-'+_0x20028b+'/'+_0x523437)[_0x953f('0x1a')](_0x58da76);}return null;};}function patchUpdates(_0x320d9b){return function(_0x3d139c){try{jsonpatch['apply'](_0x3d139c,_0x320d9b,!![]);}catch(_0x61626){return BPromise[_0x953f('0x21')](_0x61626);}return _0x3d139c[_0x953f('0x22')]();};}function saveUpdates(_0x1c29f8,_0x1fdd3f){return function(_0x4f4683){if(_0x4f4683){return _0x4f4683['update'](_0x1c29f8)[_0x953f('0x23')](function(_0x3b42f1){return _0x3b42f1;});}return null;};}function removeEntity(_0x472016,_0x40d7d9){return function(_0x5c6bc2){if(_0x5c6bc2){return _0x5c6bc2['destroy']()[_0x953f('0x23')](function(){_0x472016[_0x953f('0x19')](0xcc)[_0x953f('0x18')]();});}};}function handleEntityNotFound(_0x29089e,_0x436fa4){return function(_0x115fab){if(!_0x115fab){_0x29089e[_0x953f('0x17')](0x194);}return _0x115fab;};}function handleError(_0x13082a,_0x26fc39){_0x26fc39=_0x26fc39||0x1f4;return function(_0x29e3dd){logger[_0x953f('0x24')](_0x29e3dd[_0x953f('0x25')]);if(_0x29e3dd[_0x953f('0x26')]){delete _0x29e3dd[_0x953f('0x26')];}_0x13082a['status'](_0x26fc39)['send'](_0x29e3dd);};}exports['index']=function(_0x3a24a0,_0x35a79a){var _0x43d0cb={},_0x4009b8={},_0x2c5d87={'count':0x0,'rows':[]};var _0x33b0ab=_['map'](db[_0x953f('0x27')][_0x953f('0x28')],function(_0x470205){return{'name':_0x470205[_0x953f('0x29')],'type':_0x470205[_0x953f('0x2a')][_0x953f('0x2b')]};});_0x4009b8[_0x953f('0x2c')]=_['differenceBy'](_[_0x953f('0x2d')](_0x33b0ab,'name'),[_0x953f('0x26')]);_0x4009b8[_0x953f('0x2e')]=_[_0x953f('0x2f')](_0x3a24a0[_0x953f('0x2e')]);_0x4009b8[_0x953f('0x30')]=_[_0x953f('0x31')](_0x4009b8[_0x953f('0x2c')],_0x4009b8[_0x953f('0x2e')]);_0x43d0cb[_0x953f('0x32')]=_[_0x953f('0x31')](_0x4009b8[_0x953f('0x2c')],qs[_0x953f('0x33')](_0x3a24a0['query']['fields']));_0x43d0cb[_0x953f('0x32')]=_0x43d0cb[_0x953f('0x32')][_0x953f('0x34')]?_0x43d0cb[_0x953f('0x32')]:_0x4009b8[_0x953f('0x2c')];if(!_0x3a24a0['query'][_0x953f('0x35')](_0x953f('0x36'))){_0x43d0cb[_0x953f('0x1c')]=qs[_0x953f('0x1c')](_0x3a24a0['query'][_0x953f('0x1c')]);_0x43d0cb[_0x953f('0x1e')]=qs[_0x953f('0x1e')](_0x3a24a0[_0x953f('0x2e')]['offset']);}_0x43d0cb[_0x953f('0x37')]=qs['sort'](_0x3a24a0[_0x953f('0x2e')][_0x953f('0x38')]);_0x43d0cb[_0x953f('0x39')]=qs[_0x953f('0x30')](_['pick'](_0x3a24a0[_0x953f('0x2e')],_0x4009b8[_0x953f('0x30')]),_0x33b0ab);if(_0x3a24a0[_0x953f('0x2e')][_0x953f('0x3a')]){_0x43d0cb['where']=_[_0x953f('0x3b')](_0x43d0cb[_0x953f('0x39')],{'$or':_[_0x953f('0x2d')](_0x33b0ab,function(_0x570a5b){if(_0x570a5b[_0x953f('0x2a')]!==_0x953f('0x3c')){var _0x500f16={};_0x500f16[_0x570a5b[_0x953f('0x26')]]={'$like':'%'+_0x3a24a0[_0x953f('0x2e')][_0x953f('0x3a')]+'%'};return _0x500f16;}})});}_0x43d0cb=_['merge']({},_0x43d0cb,_0x3a24a0[_0x953f('0x3d')]);var _0x1d4d90={'where':_0x43d0cb[_0x953f('0x39')]};return db[_0x953f('0x27')][_0x953f('0x1d')](_0x1d4d90)[_0x953f('0x23')](function(_0x1f652d){_0x2c5d87[_0x953f('0x1d')]=_0x1f652d;if(_0x3a24a0[_0x953f('0x2e')][_0x953f('0x3e')]){_0x43d0cb[_0x953f('0x3f')]=[{'all':!![]}];}return db[_0x953f('0x27')][_0x953f('0x40')](_0x43d0cb);})['then'](function(_0x1549e6){_0x2c5d87[_0x953f('0x41')]=_0x1549e6;return _0x2c5d87;})['then'](respondWithFilteredResult(_0x35a79a,_0x43d0cb))[_0x953f('0x42')](handleError(_0x35a79a,null));};exports[_0x953f('0x43')]=function(_0x739e77,_0x2d7ace){var _0x31cde2={'raw':!![],'where':{'id':_0x739e77[_0x953f('0x44')]['id']}},_0x2ef6e9={};_0x2ef6e9[_0x953f('0x2c')]=_[_0x953f('0x2f')](db[_0x953f('0x27')][_0x953f('0x28')]);_0x2ef6e9[_0x953f('0x2e')]=_[_0x953f('0x2f')](_0x739e77[_0x953f('0x2e')]);_0x2ef6e9[_0x953f('0x30')]=_[_0x953f('0x31')](_0x2ef6e9[_0x953f('0x2c')],_0x2ef6e9['query']);_0x31cde2[_0x953f('0x32')]=_[_0x953f('0x31')](_0x2ef6e9[_0x953f('0x2c')],qs[_0x953f('0x33')](_0x739e77['query']['fields']));_0x31cde2[_0x953f('0x32')]=_0x31cde2[_0x953f('0x32')]['length']?_0x31cde2[_0x953f('0x32')]:_0x2ef6e9[_0x953f('0x2c')];if(_0x739e77[_0x953f('0x2e')][_0x953f('0x3e')]){_0x31cde2[_0x953f('0x3f')]=[{'all':!![]}];}_0x31cde2=_[_0x953f('0x3b')]({},_0x31cde2,_0x739e77[_0x953f('0x3d')]);return db[_0x953f('0x27')]['find'](_0x31cde2)[_0x953f('0x23')](handleEntityNotFound(_0x2d7ace,null))['then'](respondWithResult(_0x2d7ace,null))['catch'](handleError(_0x2d7ace,null));};exports[_0x953f('0x45')]=function(_0xe002e1,_0xa91b14){return db[_0x953f('0x27')][_0x953f('0x45')](_0xe002e1[_0x953f('0x46')],{})['then'](respondWithResult(_0xa91b14,0xc9))[_0x953f('0x42')](handleError(_0xa91b14,null));};exports[_0x953f('0x47')]=function(_0xfa349a,_0x28f7ad){if(_0xfa349a['body']['id']){delete _0xfa349a[_0x953f('0x46')]['id'];}return db['VoiceMailMessage'][_0x953f('0x48')]({'where':{'id':_0xfa349a[_0x953f('0x44')]['id']}})['then'](handleEntityNotFound(_0x28f7ad,null))['then'](saveUpdates(_0xfa349a[_0x953f('0x46')],null))[_0x953f('0x23')](respondWithResult(_0x28f7ad,null))['catch'](handleError(_0x28f7ad,null));};exports['destroy']=function(_0x13b86d,_0x310c70){return db['VoiceMailMessage']['find']({'where':{'id':_0x13b86d[_0x953f('0x44')]['id']}})[_0x953f('0x23')](handleEntityNotFound(_0x310c70,null))[_0x953f('0x23')](removeEntity(_0x310c70,null))[_0x953f('0x42')](handleError(_0x310c70,null));};exports[_0x953f('0x49')]=function(_0x524e7e,_0x298020,_0x2b8368){return db[_0x953f('0x27')][_0x953f('0x48')]({'where':{'id':_0x524e7e[_0x953f('0x44')]['id']},'attributes':['id','recording','msg_id']})[_0x953f('0x23')](handleEntityNotFound(_0x298020,null))[_0x953f('0x23')](function(_0x2c5880){if(_0x2c5880){if(!_0x2c5880['recording']){throw new db['Sequelize'][(_0x953f('0x4a'))](_0x953f('0x4b'));}var _0x27cc4d={'Content-Type':_0x953f('0x4c'),'Content-Disposition':_0x953f('0x4d')};if(_0x2c5880[_0x953f('0x4e')]){_0x27cc4d['Content-Disposition']='attachment;\x20filename=\x22'+_0x2c5880[_0x953f('0x4e')]+_0x953f('0x4f');}_0x298020[_0x953f('0x1f')](_0x27cc4d);return _0x298020[_0x953f('0x50')](new Buffer(_0x2c5880[_0x953f('0x51')]));}})[_0x953f('0x42')](handleError(_0x298020,null));}; \ No newline at end of file +var _0x9802=['jsforce','desk.js','papaparse','ioredis','../../components/auth/service','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','../../config/environment','../../config/license/util','sendStatus','json','offset','undefined','limit','count','set','apply','reject','save','update','then','destroy','end','error','stack','name','status','send','map','VoiceMailMessage','type','differenceBy','query','keys','intersection','model','attributes','fields','length','nolimit','order','sort','filters','filter','merge','where','VIRTUAL','options','includeAll','include','findAll','rows','catch','show','params','create','body','download','find','recording','msg_id','Sequelize','ValidationError','VoiceMailMessage\x20not\x20found','Content-Disposition','attachment;\x20filename=\x22','.wav\x22','rimraf','zip-dir','fast-json-patch','request-promise','moment','bluebird','util','sox','to-csv','ejs','squel','crypto'];(function(_0x327995,_0x202e8d){var _0x557fbf=function(_0x544d03){while(--_0x544d03){_0x327995['push'](_0x327995['shift']());}};_0x557fbf(++_0x202e8d);}(_0x9802,0x94));var _0x2980=function(_0x255d5b,_0x4f6f35){_0x255d5b=_0x255d5b-0x0;var _0x3e141a=_0x9802[_0x255d5b];return _0x3e141a;};'use strict';var emlformat=require('eml-format');var rimraf=require(_0x2980('0x0'));var zipdir=require(_0x2980('0x1'));var jsonpatch=require(_0x2980('0x2'));var rp=require(_0x2980('0x3'));var moment=require(_0x2980('0x4'));var BPromise=require(_0x2980('0x5'));var Mustache=require('mustache');var util=require(_0x2980('0x6'));var path=require('path');var sox=require(_0x2980('0x7'));var csv=require(_0x2980('0x8'));var ejs=require(_0x2980('0x9'));var fs=require('fs');var fs_extra=require('fs-extra');var _=require('lodash');var squel=require(_0x2980('0xa'));var crypto=require(_0x2980('0xb'));var jsforce=require(_0x2980('0xc'));var deskjs=require(_0x2980('0xd'));var toCsv=require(_0x2980('0x8'));var querystring=require('querystring');var Papa=require(_0x2980('0xe'));var Redis=require(_0x2980('0xf'));var authService=require(_0x2980('0x10'));var qs=require('../../components/parsers/qs');var as=require(_0x2980('0x11'));var hardwareService=require(_0x2980('0x12'));var logger=require(_0x2980('0x13'))('api');var utils=require('../../config/utils');var config=require(_0x2980('0x14'));var licenseUtil=require(_0x2980('0x15'));var db=require('../../mysqldb')['db'];function respondWithStatusCode(_0x3c989d,_0x34d0d4){_0x34d0d4=_0x34d0d4||0xcc;return function(_0x306e72){if(_0x306e72){return _0x3c989d[_0x2980('0x16')](_0x34d0d4);}return _0x3c989d['status'](_0x34d0d4)['end']();};}function respondWithResult(_0x4e5797,_0x3af81e){_0x3af81e=_0x3af81e||0xc8;return function(_0x25a04f){if(_0x25a04f){return _0x4e5797['status'](_0x3af81e)[_0x2980('0x17')](_0x25a04f);}};}function respondWithFilteredResult(_0x786bbf,_0x4522da){return function(_0xea34d8){if(_0xea34d8){var _0x52eaa6=typeof _0x4522da[_0x2980('0x18')]===_0x2980('0x19')&&typeof _0x4522da[_0x2980('0x1a')]==='undefined';var _0x215d85=_0xea34d8[_0x2980('0x1b')];var _0x3c609e=_0x52eaa6?0x0:_0x4522da[_0x2980('0x18')];var _0xe20996=_0x52eaa6?_0xea34d8[_0x2980('0x1b')]:_0x4522da[_0x2980('0x18')]+_0x4522da[_0x2980('0x1a')];var _0x4c060d;if(_0xe20996>=_0x215d85){_0xe20996=_0x215d85;_0x4c060d=0xc8;}else{_0x4c060d=0xce;}_0x786bbf['status'](_0x4c060d);return _0x786bbf[_0x2980('0x1c')]('Content-Range',_0x3c609e+'-'+_0xe20996+'/'+_0x215d85)[_0x2980('0x17')](_0xea34d8);}return null;};}function patchUpdates(_0x486bb7){return function(_0x1e448b){try{jsonpatch[_0x2980('0x1d')](_0x1e448b,_0x486bb7,!![]);}catch(_0x3ca319){return BPromise[_0x2980('0x1e')](_0x3ca319);}return _0x1e448b[_0x2980('0x1f')]();};}function saveUpdates(_0x6a6f84,_0x18c87b){return function(_0x22611a){if(_0x22611a){return _0x22611a[_0x2980('0x20')](_0x6a6f84)[_0x2980('0x21')](function(_0x4b6893){return _0x4b6893;});}return null;};}function removeEntity(_0x184853,_0x2ba4bf){return function(_0x5f45ae){if(_0x5f45ae){return _0x5f45ae[_0x2980('0x22')]()[_0x2980('0x21')](function(){_0x184853['status'](0xcc)[_0x2980('0x23')]();});}};}function handleEntityNotFound(_0x4e38df,_0x4124fb){return function(_0x19a46c){if(!_0x19a46c){_0x4e38df[_0x2980('0x16')](0x194);}return _0x19a46c;};}function handleError(_0x4da6d7,_0xac9f19){_0xac9f19=_0xac9f19||0x1f4;return function(_0x37ecff){logger[_0x2980('0x24')](_0x37ecff[_0x2980('0x25')]);if(_0x37ecff[_0x2980('0x26')]){delete _0x37ecff[_0x2980('0x26')];}_0x4da6d7[_0x2980('0x27')](_0xac9f19)[_0x2980('0x28')](_0x37ecff);};}exports['index']=function(_0x26f855,_0x5f3e7a){var _0x3777a5={},_0x422f1a={},_0x272fa1={'count':0x0,'rows':[]};var _0x1274b1=_[_0x2980('0x29')](db[_0x2980('0x2a')]['rawAttributes'],function(_0x26e249){return{'name':_0x26e249['fieldName'],'type':_0x26e249[_0x2980('0x2b')]['key']};});_0x422f1a['model']=_[_0x2980('0x2c')](_[_0x2980('0x29')](_0x1274b1,'name'),[_0x2980('0x26')]);_0x422f1a[_0x2980('0x2d')]=_[_0x2980('0x2e')](_0x26f855[_0x2980('0x2d')]);_0x422f1a['filters']=_[_0x2980('0x2f')](_0x422f1a[_0x2980('0x30')],_0x422f1a[_0x2980('0x2d')]);_0x3777a5[_0x2980('0x31')]=_[_0x2980('0x2f')](_0x422f1a['model'],qs[_0x2980('0x32')](_0x26f855[_0x2980('0x2d')][_0x2980('0x32')]));_0x3777a5[_0x2980('0x31')]=_0x3777a5['attributes'][_0x2980('0x33')]?_0x3777a5[_0x2980('0x31')]:_0x422f1a[_0x2980('0x30')];if(!_0x26f855[_0x2980('0x2d')]['hasOwnProperty'](_0x2980('0x34'))){_0x3777a5[_0x2980('0x1a')]=qs[_0x2980('0x1a')](_0x26f855['query'][_0x2980('0x1a')]);_0x3777a5['offset']=qs[_0x2980('0x18')](_0x26f855['query']['offset']);}_0x3777a5[_0x2980('0x35')]=qs[_0x2980('0x36')](_0x26f855['query'][_0x2980('0x36')]);_0x3777a5['where']=qs['filters'](_['pick'](_0x26f855[_0x2980('0x2d')],_0x422f1a[_0x2980('0x37')]),_0x1274b1);if(_0x26f855[_0x2980('0x2d')][_0x2980('0x38')]){_0x3777a5['where']=_[_0x2980('0x39')](_0x3777a5[_0x2980('0x3a')],{'$or':_[_0x2980('0x29')](_0x1274b1,function(_0x19f00a){if(_0x19f00a[_0x2980('0x2b')]!==_0x2980('0x3b')){var _0x804c9b={};_0x804c9b[_0x19f00a['name']]={'$like':'%'+_0x26f855[_0x2980('0x2d')]['filter']+'%'};return _0x804c9b;}})});}_0x3777a5=_[_0x2980('0x39')]({},_0x3777a5,_0x26f855[_0x2980('0x3c')]);var _0x2b3682={'where':_0x3777a5[_0x2980('0x3a')]};return db[_0x2980('0x2a')][_0x2980('0x1b')](_0x2b3682)[_0x2980('0x21')](function(_0x179a14){_0x272fa1[_0x2980('0x1b')]=_0x179a14;if(_0x26f855[_0x2980('0x2d')][_0x2980('0x3d')]){_0x3777a5[_0x2980('0x3e')]=[{'all':!![]}];}return db['VoiceMailMessage'][_0x2980('0x3f')](_0x3777a5);})[_0x2980('0x21')](function(_0x4af540){_0x272fa1[_0x2980('0x40')]=_0x4af540;return _0x272fa1;})[_0x2980('0x21')](respondWithFilteredResult(_0x5f3e7a,_0x3777a5))[_0x2980('0x41')](handleError(_0x5f3e7a,null));};exports[_0x2980('0x42')]=function(_0x8af09f,_0x5d0911){var _0x48e8a7={'raw':!![],'where':{'id':_0x8af09f[_0x2980('0x43')]['id']}},_0x441d3a={};_0x441d3a[_0x2980('0x30')]=_[_0x2980('0x2e')](db[_0x2980('0x2a')]['rawAttributes']);_0x441d3a[_0x2980('0x2d')]=_[_0x2980('0x2e')](_0x8af09f[_0x2980('0x2d')]);_0x441d3a[_0x2980('0x37')]=_['intersection'](_0x441d3a['model'],_0x441d3a[_0x2980('0x2d')]);_0x48e8a7[_0x2980('0x31')]=_['intersection'](_0x441d3a['model'],qs[_0x2980('0x32')](_0x8af09f[_0x2980('0x2d')][_0x2980('0x32')]));_0x48e8a7[_0x2980('0x31')]=_0x48e8a7['attributes'][_0x2980('0x33')]?_0x48e8a7[_0x2980('0x31')]:_0x441d3a['model'];if(_0x8af09f[_0x2980('0x2d')][_0x2980('0x3d')]){_0x48e8a7[_0x2980('0x3e')]=[{'all':!![]}];}_0x48e8a7=_['merge']({},_0x48e8a7,_0x8af09f[_0x2980('0x3c')]);return db[_0x2980('0x2a')]['find'](_0x48e8a7)[_0x2980('0x21')](handleEntityNotFound(_0x5d0911,null))[_0x2980('0x21')](respondWithResult(_0x5d0911,null))[_0x2980('0x41')](handleError(_0x5d0911,null));};exports[_0x2980('0x44')]=function(_0x1bd3ca,_0x27b35b){return db['VoiceMailMessage'][_0x2980('0x44')](_0x1bd3ca[_0x2980('0x45')],{})[_0x2980('0x21')](respondWithResult(_0x27b35b,0xc9))[_0x2980('0x41')](handleError(_0x27b35b,null));};exports['update']=function(_0x1c85a6,_0x21eb21){if(_0x1c85a6[_0x2980('0x45')]['id']){delete _0x1c85a6[_0x2980('0x45')]['id'];}return db[_0x2980('0x2a')]['find']({'where':{'id':_0x1c85a6[_0x2980('0x43')]['id']}})[_0x2980('0x21')](handleEntityNotFound(_0x21eb21,null))[_0x2980('0x21')](saveUpdates(_0x1c85a6[_0x2980('0x45')],null))[_0x2980('0x21')](respondWithResult(_0x21eb21,null))[_0x2980('0x41')](handleError(_0x21eb21,null));};exports[_0x2980('0x22')]=function(_0x2061a5,_0x5f38b3){return db[_0x2980('0x2a')]['find']({'where':{'id':_0x2061a5[_0x2980('0x43')]['id']}})[_0x2980('0x21')](handleEntityNotFound(_0x5f38b3,null))[_0x2980('0x21')](removeEntity(_0x5f38b3,null))[_0x2980('0x41')](handleError(_0x5f38b3,null));};exports[_0x2980('0x46')]=function(_0x30c1be,_0x4fa69f,_0x5aa116){return db['VoiceMailMessage'][_0x2980('0x47')]({'where':{'id':_0x30c1be[_0x2980('0x43')]['id']},'attributes':['id',_0x2980('0x48'),_0x2980('0x49')]})[_0x2980('0x21')](handleEntityNotFound(_0x4fa69f,null))[_0x2980('0x21')](function(_0x814e4b){if(_0x814e4b){if(!_0x814e4b[_0x2980('0x48')]){throw new db[(_0x2980('0x4a'))][(_0x2980('0x4b'))](_0x2980('0x4c'));}var _0x9ec3af={'Content-Type':'audio/wav','Content-Disposition':'attachment'};if(_0x814e4b[_0x2980('0x49')]){_0x9ec3af[_0x2980('0x4d')]=_0x2980('0x4e')+_0x814e4b[_0x2980('0x49')]+_0x2980('0x4f');}_0x4fa69f[_0x2980('0x1c')](_0x9ec3af);return _0x4fa69f[_0x2980('0x28')](new Buffer(_0x814e4b[_0x2980('0x48')]));}})[_0x2980('0x41')](handleError(_0x4fa69f,null));}; \ No newline at end of file diff --git a/server/api/voiceMailMessage/voiceMailMessage.model.js b/server/api/voiceMailMessage/voiceMailMessage.model.js index a373f62..44733dc 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 _0x206d=['define','VoiceMailMessage','voice_voicemail_messages','../../config/logger','moment','bluebird','request-promise','rimraf','./voiceMailMessage.attributes','exports'];(function(_0x132f0f,_0x45fef7){var _0x4128f2=function(_0x4335a4){while(--_0x4335a4){_0x132f0f['push'](_0x132f0f['shift']());}};_0x4128f2(++_0x45fef7);}(_0x206d,0x17f));var _0xd206=function(_0x29a9cb,_0x4f9f3f){_0x29a9cb=_0x29a9cb-0x0;var _0x2b357b=_0x206d[_0x29a9cb];return _0x2b357b;};'use strict';var _=require('lodash');var util=require('util');var logger=require(_0xd206('0x0'))('api');var moment=require(_0xd206('0x1'));var BPromise=require(_0xd206('0x2'));var rp=require(_0xd206('0x3'));var fs=require('fs');var path=require('path');var rimraf=require(_0xd206('0x4'));var config=require('../../config/environment');var attributes=require(_0xd206('0x5'));module[_0xd206('0x6')]=function(_0x5cc7ab,_0x38f147){return _0x5cc7ab[_0xd206('0x7')](_0xd206('0x8'),attributes,{'tableName':_0xd206('0x9'),'paranoid':![],'indexes':[{'name':'dir','fields':['dir']}],'timestamps':![]});}; \ No newline at end of file +var _0x33d5=['rimraf','../../config/environment','exports','define','VoiceMailMessage','voice_voicemail_messages','dir','lodash','../../config/logger','api','moment','bluebird','request-promise','path'];(function(_0x3b5a5d,_0x432c64){var _0x2d2034=function(_0x15aac8){while(--_0x15aac8){_0x3b5a5d['push'](_0x3b5a5d['shift']());}};_0x2d2034(++_0x432c64);}(_0x33d5,0x13b));var _0x533d=function(_0x234987,_0x433dcb){_0x234987=_0x234987-0x0;var _0x27c52d=_0x33d5[_0x234987];return _0x27c52d;};'use strict';var _=require(_0x533d('0x0'));var util=require('util');var logger=require(_0x533d('0x1'))(_0x533d('0x2'));var moment=require(_0x533d('0x3'));var BPromise=require(_0x533d('0x4'));var rp=require(_0x533d('0x5'));var fs=require('fs');var path=require(_0x533d('0x6'));var rimraf=require(_0x533d('0x7'));var config=require(_0x533d('0x8'));var attributes=require('./voiceMailMessage.attributes');module[_0x533d('0x9')]=function(_0x32e42f,_0x3dcc8c){return _0x32e42f[_0x533d('0xa')](_0x533d('0xb'),attributes,{'tableName':_0x533d('0xc'),'paranoid':![],'indexes':[{'name':_0x533d('0xd'),'fields':['dir']}],'timestamps':![]});}; \ No newline at end of file diff --git a/server/api/voiceMailMessage/voiceMailMessage.rpc.js b/server/api/voiceMailMessage/voiceMailMessage.rpc.js index 9615299..11ffb67 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 _0xafde=['error','VoiceMailMessage,\x20%s,\x20%s','message','result','lodash','util','moment','bluebird','randomstring','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','client','http','request','then','info','request\x20sent','VoiceMailMessage,\x20%s,\x20%s,\x20%s','stringify'];(function(_0x289891,_0x49a0fa){var _0x31cf2e=function(_0x8cebce){while(--_0x8cebce){_0x289891['push'](_0x289891['shift']());}};_0x31cf2e(++_0x49a0fa);}(_0xafde,0x77));var _0xeafd=function(_0x133c45,_0x2f8396){_0x133c45=_0x133c45-0x0;var _0x42448e=_0xafde[_0x133c45];return _0x42448e;};'use strict';var _=require(_0xeafd('0x0'));var util=require(_0xeafd('0x1'));var moment=require(_0xeafd('0x2'));var BPromise=require(_0xeafd('0x3'));var rs=require(_0xeafd('0x4'));var fs=require('fs');var Redis=require('ioredis');var db=require(_0xeafd('0x5'))['db'];var utils=require(_0xeafd('0x6'));var logger=require(_0xeafd('0x7'))(_0xeafd('0x8'));var config=require(_0xeafd('0x9'));var jayson=require(_0xeafd('0xa'));var client=jayson[_0xeafd('0xb')][_0xeafd('0xc')]({'port':0x232a});function respondWithRpcPromise(_0x282193,_0x458dd9,_0x2c36b3){return new BPromise(function(_0x3e851f,_0x5cf1e3){return client[_0xeafd('0xd')](_0x282193,_0x2c36b3)[_0xeafd('0xe')](function(_0x49206a){logger[_0xeafd('0xf')]('VoiceMailMessage,\x20%s,\x20%s',_0x458dd9,_0xeafd('0x10'));logger['debug'](_0xeafd('0x11'),_0x458dd9,_0xeafd('0x10'),JSON[_0xeafd('0x12')](_0x49206a));if(_0x49206a['error']){if(_0x49206a['error']['code']===0x1f4){logger[_0xeafd('0x13')](_0xeafd('0x14'),_0x458dd9,_0x49206a[_0xeafd('0x13')][_0xeafd('0x15')]);return _0x5cf1e3(_0x49206a[_0xeafd('0x13')][_0xeafd('0x15')]);}logger[_0xeafd('0x13')]('VoiceMailMessage,\x20%s,\x20%s',_0x458dd9,_0x49206a[_0xeafd('0x13')]['message']);return _0x3e851f(_0x49206a['error'][_0xeafd('0x15')]);}else{logger[_0xeafd('0xf')](_0xeafd('0x14'),_0x458dd9,_0xeafd('0x10'));_0x3e851f(_0x49206a[_0xeafd('0x16')]['message']);}})['catch'](function(_0x5bd730){logger[_0xeafd('0x13')](_0xeafd('0x14'),_0x458dd9,_0x5bd730);_0x5cf1e3(_0x5bd730);});});} \ No newline at end of file +var _0x47ab=['../../config/environment','jayson/promise','client','http','then','debug','request\x20sent','error','code','VoiceMailMessage,\x20%s,\x20%s','message','info','catch','lodash','util','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc'];(function(_0x53cf8e,_0x3d290f){var _0x459197=function(_0x67073c){while(--_0x67073c){_0x53cf8e['push'](_0x53cf8e['shift']());}};_0x459197(++_0x3d290f);}(_0x47ab,0xf3));var _0xb47a=function(_0x114167,_0x5f520c){_0x114167=_0x114167-0x0;var _0x3ae271=_0x47ab[_0x114167];return _0x3ae271;};'use strict';var _=require(_0xb47a('0x0'));var util=require(_0xb47a('0x1'));var moment=require(_0xb47a('0x2'));var BPromise=require(_0xb47a('0x3'));var rs=require(_0xb47a('0x4'));var fs=require('fs');var Redis=require(_0xb47a('0x5'));var db=require(_0xb47a('0x6'))['db'];var utils=require(_0xb47a('0x7'));var logger=require(_0xb47a('0x8'))(_0xb47a('0x9'));var config=require(_0xb47a('0xa'));var jayson=require(_0xb47a('0xb'));var client=jayson[_0xb47a('0xc')][_0xb47a('0xd')]({'port':0x232a});function respondWithRpcPromise(_0x1578b9,_0x5f142d,_0x485362){return new BPromise(function(_0x48583b,_0x4a3c85){return client['request'](_0x1578b9,_0x485362)[_0xb47a('0xe')](function(_0x5de5db){logger['info']('VoiceMailMessage,\x20%s,\x20%s',_0x5f142d,'request\x20sent');logger[_0xb47a('0xf')]('VoiceMailMessage,\x20%s,\x20%s,\x20%s',_0x5f142d,_0xb47a('0x10'),JSON['stringify'](_0x5de5db));if(_0x5de5db['error']){if(_0x5de5db[_0xb47a('0x11')][_0xb47a('0x12')]===0x1f4){logger[_0xb47a('0x11')](_0xb47a('0x13'),_0x5f142d,_0x5de5db[_0xb47a('0x11')][_0xb47a('0x14')]);return _0x4a3c85(_0x5de5db['error']['message']);}logger[_0xb47a('0x11')](_0xb47a('0x13'),_0x5f142d,_0x5de5db[_0xb47a('0x11')][_0xb47a('0x14')]);return _0x48583b(_0x5de5db[_0xb47a('0x11')]['message']);}else{logger[_0xb47a('0x15')]('VoiceMailMessage,\x20%s,\x20%s',_0x5f142d,_0xb47a('0x10'));_0x48583b(_0x5de5db['result']['message']);}})[_0xb47a('0x16')](function(_0x5ecec4){logger[_0xb47a('0x11')](_0xb47a('0x13'),_0x5f142d,_0x5ecec4);_0x4a3c85(_0x5ecec4);});});} \ No newline at end of file diff --git a/server/api/voiceMusicOnHold/index.js b/server/api/voiceMusicOnHold/index.js index 8f4525f..2dff5ac 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 _0x8d11=['Router','../../components/auth/service','../../components/interaction/service','../../config/environment','get','isAuthenticated','index','/:id/sounds','getSounds','post','addSound','/:id','update','delete','removeSound','exports','multer','util','express'];(function(_0x19e35c,_0x29cd1e){var _0x3e1fe8=function(_0x17258b){while(--_0x17258b){_0x19e35c['push'](_0x19e35c['shift']());}};_0x3e1fe8(++_0x29cd1e);}(_0x8d11,0x140));var _0x18d1=function(_0xaa0309,_0x1c8008){_0xaa0309=_0xaa0309-0x0;var _0x5de7ce=_0x8d11[_0xaa0309];return _0x5de7ce;};'use strict';var multer=require(_0x18d1('0x0'));var util=require(_0x18d1('0x1'));var path=require('path');var timeout=require('connect-timeout');var express=require(_0x18d1('0x2'));var router=express[_0x18d1('0x3')]();var fs_extra=require('fs-extra');var auth=require(_0x18d1('0x4'));var interaction=require(_0x18d1('0x5'));var config=require(_0x18d1('0x6'));var controller=require('./voiceMusicOnHold.controller');router[_0x18d1('0x7')]('/',auth[_0x18d1('0x8')](),controller[_0x18d1('0x9')]);router['get']('/:id',auth['isAuthenticated'](),controller['show']);router[_0x18d1('0x7')](_0x18d1('0xa'),auth[_0x18d1('0x8')](),controller[_0x18d1('0xb')]);router[_0x18d1('0xc')]('/',auth[_0x18d1('0x8')](),controller['create']);router['post'](_0x18d1('0xa'),auth[_0x18d1('0x8')](),controller[_0x18d1('0xd')]);router['put'](_0x18d1('0xe'),auth['isAuthenticated'](),controller[_0x18d1('0xf')]);router['delete']('/:id',auth[_0x18d1('0x8')](),controller['destroy']);router[_0x18d1('0x10')]('/:id/sounds/:id2',auth[_0x18d1('0x8')](),controller[_0x18d1('0x11')]);module[_0x18d1('0x12')]=router; \ No newline at end of file +var _0x0e3d=['./voiceMusicOnHold.controller','isAuthenticated','index','get','/:id','show','/:id/sounds','getSounds','create','post','addSound','update','delete','destroy','/:id/sounds/:id2','removeSound','exports','multer','connect-timeout','express','Router','../../components/auth/service','../../components/interaction/service','../../config/environment'];(function(_0xbca1b1,_0x33f0ce){var _0x4e1686=function(_0x58a80c){while(--_0x58a80c){_0xbca1b1['push'](_0xbca1b1['shift']());}};_0x4e1686(++_0x33f0ce);}(_0x0e3d,0x191));var _0xd0e3=function(_0x130f91,_0x682006){_0x130f91=_0x130f91-0x0;var _0x31c056=_0x0e3d[_0x130f91];return _0x31c056;};'use strict';var multer=require(_0xd0e3('0x0'));var util=require('util');var path=require('path');var timeout=require(_0xd0e3('0x1'));var express=require(_0xd0e3('0x2'));var router=express[_0xd0e3('0x3')]();var fs_extra=require('fs-extra');var auth=require(_0xd0e3('0x4'));var interaction=require(_0xd0e3('0x5'));var config=require(_0xd0e3('0x6'));var controller=require(_0xd0e3('0x7'));router['get']('/',auth[_0xd0e3('0x8')](),controller[_0xd0e3('0x9')]);router[_0xd0e3('0xa')](_0xd0e3('0xb'),auth[_0xd0e3('0x8')](),controller[_0xd0e3('0xc')]);router[_0xd0e3('0xa')](_0xd0e3('0xd'),auth[_0xd0e3('0x8')](),controller[_0xd0e3('0xe')]);router['post']('/',auth[_0xd0e3('0x8')](),controller[_0xd0e3('0xf')]);router[_0xd0e3('0x10')](_0xd0e3('0xd'),auth[_0xd0e3('0x8')](),controller[_0xd0e3('0x11')]);router['put'](_0xd0e3('0xb'),auth[_0xd0e3('0x8')](),controller[_0xd0e3('0x12')]);router[_0xd0e3('0x13')](_0xd0e3('0xb'),auth[_0xd0e3('0x8')](),controller[_0xd0e3('0x14')]);router[_0xd0e3('0x13')](_0xd0e3('0x15'),auth[_0xd0e3('0x8')](),controller[_0xd0e3('0x16')]);module[_0xd0e3('0x17')]=router; \ No newline at end of file diff --git a/server/api/voiceMusicOnHold/voiceMusicOnHold.attributes.js b/server/api/voiceMusicOnHold/voiceMusicOnHold.attributes.js index cbb118c..680e4f5 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 _0x0afc=['files','quietmp3nb','quietmp3','mp3','alpha','TIMESTAMP','BOOLEAN','sequelize','exports','STRING','name','ENUM','custom'];(function(_0x1deb03,_0xd05ad8){var _0x189fe7=function(_0x321225){while(--_0x321225){_0x1deb03['push'](_0x1deb03['shift']());}};_0x189fe7(++_0xd05ad8);}(_0x0afc,0x1db));var _0xc0af=function(_0x4725dc,_0x459d24){_0x4725dc=_0x4725dc-0x0;var _0x539615=_0x0afc[_0x4725dc];return _0x539615;};'use strict';var Sequelize=require(_0xc0af('0x0'));module[_0xc0af('0x1')]={'name':{'type':Sequelize[_0xc0af('0x2')],'allowNull':![],'unique':_0xc0af('0x3')},'mode':{'type':Sequelize[_0xc0af('0x4')](_0xc0af('0x5'),_0xc0af('0x6'),'mp3nb',_0xc0af('0x7'),_0xc0af('0x8'),_0xc0af('0x9')),'allowNull':!![],'defaultValue':_0xc0af('0x6')},'directory':{'type':Sequelize[_0xc0af('0x2')],'allowNull':!![]},'application':{'type':Sequelize[_0xc0af('0x2')],'allowNull':!![]},'digit':{'type':Sequelize[_0xc0af('0x2')],'allowNull':!![]},'sort':{'type':Sequelize[_0xc0af('0x2')],'allowNull':!![],'defaultValue':_0xc0af('0xa')},'format':{'type':Sequelize['STRING'],'allowNull':!![]},'stamp':{'type':_0xc0af('0xb')},'defaultEntry':{'type':Sequelize[_0xc0af('0xc')],'defaultValue':0x0}}; \ No newline at end of file +var _0x6b09=['TIMESTAMP','BOOLEAN','exports','name','ENUM','files','mp3nb','quietmp3nb','quietmp3','mp3','STRING','alpha'];(function(_0x831870,_0x1caff7){var _0x5995e9=function(_0x18a9d0){while(--_0x18a9d0){_0x831870['push'](_0x831870['shift']());}};_0x5995e9(++_0x1caff7);}(_0x6b09,0x1b2));var _0x96b0=function(_0x59d369,_0x56a533){_0x59d369=_0x59d369-0x0;var _0x58c3eb=_0x6b09[_0x59d369];return _0x58c3eb;};'use strict';var Sequelize=require('sequelize');module[_0x96b0('0x0')]={'name':{'type':Sequelize['STRING'],'allowNull':![],'unique':_0x96b0('0x1')},'mode':{'type':Sequelize[_0x96b0('0x2')]('custom',_0x96b0('0x3'),_0x96b0('0x4'),_0x96b0('0x5'),_0x96b0('0x6'),_0x96b0('0x7')),'allowNull':!![],'defaultValue':_0x96b0('0x3')},'directory':{'type':Sequelize[_0x96b0('0x8')],'allowNull':!![]},'application':{'type':Sequelize[_0x96b0('0x8')],'allowNull':!![]},'digit':{'type':Sequelize[_0x96b0('0x8')],'allowNull':!![]},'sort':{'type':Sequelize['STRING'],'allowNull':!![],'defaultValue':_0x96b0('0x9')},'format':{'type':Sequelize[_0x96b0('0x8')],'allowNull':!![]},'stamp':{'type':_0x96b0('0xa')},'defaultEntry':{'type':Sequelize[_0x96b0('0xb')],'defaultValue':0x0}}; \ No newline at end of file diff --git a/server/api/voiceMusicOnHold/voiceMusicOnHold.controller.js b/server/api/voiceMusicOnHold/voiceMusicOnHold.controller.js index b6200c8..b1b7cfa 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 _0x952b=['removeSound','id2','Sequelize','message','getSounds','order','eml-format','rimraf','zip-dir','request-promise','moment','mustache','util','path','sox','to-csv','lodash','squel','crypto','jsforce','desk.js','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','sendStatus','status','json','undefined','limit','count','offset','apply','save','update','then','destroy','MusicOnHolds','UserProfileResource','end','error','stack','name','send','fieldName','type','key','model','map','query','keys','filters','intersection','attributes','fields','length','hasOwnProperty','nolimit','sort','where','pick','filter','merge','VIRTUAL','options','VoiceMusicOnHold','includeAll','findAll','rows','catch','show','params','rawAttributes','find','body','create','sequelize','transaction','mode','directory','join','root','server/files/moh','files','mkdirSync','0777','user','get','role','UserProfileSection','userProfileId','autoAssociation','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','readdirSync','forEach','unlinkSync','rmdirSync','addSound','Sound','findOne','save_name','converted_format','server/files/sounds/converted','%s.%s','basename','symlinkSync'];(function(_0x36211c,_0x178508){var _0xd2487b=function(_0x101cd8){while(--_0x101cd8){_0x36211c['push'](_0x36211c['shift']());}};_0xd2487b(++_0x178508);}(_0x952b,0x15c));var _0xb952=function(_0x3007d3,_0x2a17da){_0x3007d3=_0x3007d3-0x0;var _0x4e01a7=_0x952b[_0x3007d3];return _0x4e01a7;};'use strict';var emlformat=require(_0xb952('0x0'));var rimraf=require(_0xb952('0x1'));var zipdir=require(_0xb952('0x2'));var jsonpatch=require('fast-json-patch');var rp=require(_0xb952('0x3'));var moment=require(_0xb952('0x4'));var BPromise=require('bluebird');var Mustache=require(_0xb952('0x5'));var util=require(_0xb952('0x6'));var path=require(_0xb952('0x7'));var sox=require(_0xb952('0x8'));var csv=require(_0xb952('0x9'));var ejs=require('ejs');var fs=require('fs');var fs_extra=require('fs-extra');var _=require(_0xb952('0xa'));var squel=require(_0xb952('0xb'));var crypto=require(_0xb952('0xc'));var jsforce=require(_0xb952('0xd'));var deskjs=require(_0xb952('0xe'));var toCsv=require(_0xb952('0x9'));var querystring=require('querystring');var Papa=require(_0xb952('0xf'));var Redis=require(_0xb952('0x10'));var authService=require(_0xb952('0x11'));var qs=require(_0xb952('0x12'));var as=require(_0xb952('0x13'));var hardwareService=require(_0xb952('0x14'));var logger=require(_0xb952('0x15'))(_0xb952('0x16'));var utils=require(_0xb952('0x17'));var config=require(_0xb952('0x18'));var licenseUtil=require(_0xb952('0x19'));var db=require(_0xb952('0x1a'))['db'];function respondWithStatusCode(_0xc72213,_0x31bf82){_0x31bf82=_0x31bf82||0xcc;return function(_0x38e5f0){if(_0x38e5f0){return _0xc72213[_0xb952('0x1b')](_0x31bf82);}return _0xc72213[_0xb952('0x1c')](_0x31bf82)['end']();};}function respondWithResult(_0x178e88,_0x33027a){_0x33027a=_0x33027a||0xc8;return function(_0x441558){if(_0x441558){return _0x178e88['status'](_0x33027a)[_0xb952('0x1d')](_0x441558);}};}function respondWithFilteredResult(_0x34ac6b,_0x262d8e){return function(_0xd847be){if(_0xd847be){var _0x1b8df6=typeof _0x262d8e['offset']===_0xb952('0x1e')&&typeof _0x262d8e[_0xb952('0x1f')]===_0xb952('0x1e');var _0x10d8d6=_0xd847be[_0xb952('0x20')];var _0x373a0a=_0x1b8df6?0x0:_0x262d8e[_0xb952('0x21')];var _0xf823a7=_0x1b8df6?_0xd847be['count']:_0x262d8e[_0xb952('0x21')]+_0x262d8e[_0xb952('0x1f')];var _0x5a86a1;if(_0xf823a7>=_0x10d8d6){_0xf823a7=_0x10d8d6;_0x5a86a1=0xc8;}else{_0x5a86a1=0xce;}_0x34ac6b[_0xb952('0x1c')](_0x5a86a1);return _0x34ac6b['set']('Content-Range',_0x373a0a+'-'+_0xf823a7+'/'+_0x10d8d6)[_0xb952('0x1d')](_0xd847be);}return null;};}function patchUpdates(_0x1f956e){return function(_0xdeea91){try{jsonpatch[_0xb952('0x22')](_0xdeea91,_0x1f956e,!![]);}catch(_0x2b056f){return BPromise['reject'](_0x2b056f);}return _0xdeea91[_0xb952('0x23')]();};}function saveUpdates(_0x22bfb1,_0x233006){return function(_0x5f4265){if(_0x5f4265){return _0x5f4265[_0xb952('0x24')](_0x22bfb1)[_0xb952('0x25')](function(_0x2b0e77){return _0x2b0e77;});}return null;};}function removeEntity(_0x313f5f,_0x57f4e7){return function(_0x2835b8){if(_0x2835b8){return _0x2835b8[_0xb952('0x26')]()['then'](function(){var _0x27cea7=_0x2835b8['get']({'plain':!![]});var _0x5dcb5c=_0xb952('0x27');return db[_0xb952('0x28')][_0xb952('0x26')]({'where':{'type':_0x5dcb5c,'resourceId':_0x27cea7['id']}})[_0xb952('0x25')](function(){return _0x2835b8;});})[_0xb952('0x25')](function(){_0x313f5f['status'](0xcc)[_0xb952('0x29')]();});}};}function handleEntityNotFound(_0x1df9ae,_0x20adb4){return function(_0xd4777e){if(!_0xd4777e){_0x1df9ae['sendStatus'](0x194);}return _0xd4777e;};}function handleError(_0xf7b0f,_0x55c83d){_0x55c83d=_0x55c83d||0x1f4;return function(_0x1dd236){logger[_0xb952('0x2a')](_0x1dd236[_0xb952('0x2b')]);if(_0x1dd236[_0xb952('0x2c')]){delete _0x1dd236[_0xb952('0x2c')];}_0xf7b0f[_0xb952('0x1c')](_0x55c83d)[_0xb952('0x2d')](_0x1dd236);};}exports['index']=function(_0x14290f,_0x5b25f6){var _0x56a660={},_0x23f865={},_0x4ea111={'count':0x0,'rows':[]};var _0x5b8cf7=_['map'](db['VoiceMusicOnHold']['rawAttributes'],function(_0x50dd38){return{'name':_0x50dd38[_0xb952('0x2e')],'type':_0x50dd38[_0xb952('0x2f')][_0xb952('0x30')]};});_0x23f865[_0xb952('0x31')]=_[_0xb952('0x32')](_0x5b8cf7,_0xb952('0x2c'));_0x23f865[_0xb952('0x33')]=_[_0xb952('0x34')](_0x14290f['query']);_0x23f865[_0xb952('0x35')]=_[_0xb952('0x36')](_0x23f865['model'],_0x23f865[_0xb952('0x33')]);_0x56a660[_0xb952('0x37')]=_['intersection'](_0x23f865[_0xb952('0x31')],qs[_0xb952('0x38')](_0x14290f[_0xb952('0x33')][_0xb952('0x38')]));_0x56a660[_0xb952('0x37')]=_0x56a660[_0xb952('0x37')][_0xb952('0x39')]?_0x56a660[_0xb952('0x37')]:_0x23f865[_0xb952('0x31')];if(!_0x14290f['query'][_0xb952('0x3a')](_0xb952('0x3b'))){_0x56a660[_0xb952('0x1f')]=qs[_0xb952('0x1f')](_0x14290f[_0xb952('0x33')][_0xb952('0x1f')]);_0x56a660[_0xb952('0x21')]=qs[_0xb952('0x21')](_0x14290f[_0xb952('0x33')][_0xb952('0x21')]);}_0x56a660['order']=qs[_0xb952('0x3c')](_0x14290f[_0xb952('0x33')][_0xb952('0x3c')]);delete _0x14290f[_0xb952('0x33')][_0xb952('0x3c')];_0x56a660[_0xb952('0x3d')]=qs[_0xb952('0x35')](_[_0xb952('0x3e')](_0x14290f['query'],_0x23f865['filters']),_0x5b8cf7);if(_0x14290f[_0xb952('0x33')][_0xb952('0x3f')]){_0x56a660[_0xb952('0x3d')]=_[_0xb952('0x40')](_0x56a660[_0xb952('0x3d')],{'$or':_[_0xb952('0x32')](_0x5b8cf7,function(_0x5a08ec){if(_0x5a08ec[_0xb952('0x2f')]!==_0xb952('0x41')){var _0x127663={};_0x127663[_0x5a08ec['name']]={'$like':'%'+_0x14290f[_0xb952('0x33')][_0xb952('0x3f')]+'%'};return _0x127663;}})});}_0x56a660=_[_0xb952('0x40')]({},_0x56a660,_0x14290f[_0xb952('0x42')]);var _0x28d7fd={'where':_0x56a660[_0xb952('0x3d')]};return db[_0xb952('0x43')]['count'](_0x28d7fd)[_0xb952('0x25')](function(_0x289467){_0x4ea111[_0xb952('0x20')]=_0x289467;if(_0x14290f[_0xb952('0x33')][_0xb952('0x44')]){_0x56a660['include']=[{'all':!![]}];}return db[_0xb952('0x43')][_0xb952('0x45')](_0x56a660);})[_0xb952('0x25')](function(_0x1358bf){_0x4ea111[_0xb952('0x46')]=_0x1358bf;return _0x4ea111;})[_0xb952('0x25')](respondWithFilteredResult(_0x5b25f6,_0x56a660))[_0xb952('0x47')](handleError(_0x5b25f6,null));};exports[_0xb952('0x48')]=function(_0x59b2d0,_0x2a151f){var _0x4cea3b={'raw':![],'where':{'id':_0x59b2d0[_0xb952('0x49')]['id']}},_0x1dd462={};_0x1dd462[_0xb952('0x31')]=_['keys'](db[_0xb952('0x43')][_0xb952('0x4a')]);_0x1dd462[_0xb952('0x33')]=_[_0xb952('0x34')](_0x59b2d0[_0xb952('0x33')]);_0x1dd462[_0xb952('0x35')]=_[_0xb952('0x36')](_0x1dd462[_0xb952('0x31')],_0x1dd462[_0xb952('0x33')]);_0x4cea3b[_0xb952('0x37')]=_['intersection'](_0x1dd462[_0xb952('0x31')],qs[_0xb952('0x38')](_0x59b2d0[_0xb952('0x33')][_0xb952('0x38')]));_0x4cea3b['attributes']=_0x4cea3b[_0xb952('0x37')][_0xb952('0x39')]?_0x4cea3b[_0xb952('0x37')]:_0x1dd462[_0xb952('0x31')];if(_0x59b2d0['query'][_0xb952('0x44')]){_0x4cea3b['include']=[{'all':!![]}];}_0x4cea3b=_[_0xb952('0x40')]({},_0x4cea3b,_0x59b2d0[_0xb952('0x42')]);return db[_0xb952('0x43')][_0xb952('0x4b')](_0x4cea3b)['then'](handleEntityNotFound(_0x2a151f,null))[_0xb952('0x25')](respondWithResult(_0x2a151f,null))[_0xb952('0x47')](handleError(_0x2a151f,null));};exports[_0xb952('0x24')]=function(_0x389d63,_0x46a55b){if(_0x389d63[_0xb952('0x4c')]['id']){delete _0x389d63[_0xb952('0x4c')]['id'];}return db[_0xb952('0x43')][_0xb952('0x4b')]({'where':{'id':_0x389d63[_0xb952('0x49')]['id']}})['then'](handleEntityNotFound(_0x46a55b,null))[_0xb952('0x25')](saveUpdates(_0x389d63[_0xb952('0x4c')],null))[_0xb952('0x25')](respondWithResult(_0x46a55b,null))[_0xb952('0x47')](handleError(_0x46a55b,null));};exports[_0xb952('0x4d')]=function(_0x1f6a0c,_0x1f3ebb,_0x20568a){return db[_0xb952('0x4e')][_0xb952('0x4f')](function(_0x2d4e47){if(_0x1f6a0c[_0xb952('0x4c')][_0xb952('0x50')]==='files'){_0x1f6a0c[_0xb952('0x4c')][_0xb952('0x51')]=path[_0xb952('0x52')](config[_0xb952('0x53')],_0xb952('0x54'),_0x1f6a0c[_0xb952('0x4c')][_0xb952('0x2c')]);}return db['VoiceMusicOnHold'][_0xb952('0x4d')](_0x1f6a0c[_0xb952('0x4c')],{'transaction':_0x2d4e47})[_0xb952('0x25')](function(_0x388053){if(_0x1f6a0c[_0xb952('0x4c')]['mode']===_0xb952('0x55')){fs[_0xb952('0x56')](_0x388053[_0xb952('0x51')],parseInt(_0xb952('0x57'),0x8));}var _0x3395bd=_0x1f6a0c[_0xb952('0x58')][_0xb952('0x59')]({'plain':!![]});if(!_0x3395bd)throw new Error('Unable\x20to\x20retrieve\x20the\x20current\x20user');if(_0x3395bd[_0xb952('0x5a')]===_0xb952('0x58')){var _0x53dfe2=_0x388053[_0xb952('0x59')]({'plain':!![]});return db[_0xb952('0x5b')][_0xb952('0x4b')]({'where':{'name':_0xb952('0x27'),'userProfileId':_0x3395bd[_0xb952('0x5c')]},'raw':!![]})[_0xb952('0x25')](function(_0x37ca59){if(_0x37ca59&&_0x37ca59[_0xb952('0x5d')]===0x0){return db[_0xb952('0x28')][_0xb952('0x4d')]({'name':_0x53dfe2[_0xb952('0x2c')],'resourceId':_0x53dfe2['id'],'type':_0x37ca59[_0xb952('0x2c')],'sectionId':_0x37ca59['id']},{})[_0xb952('0x25')](function(){return _0x388053;});}else{return _0x388053;}})['catch'](function(_0x1d27bb){logger[_0xb952('0x2a')](_0xb952('0x5e'),_0x1d27bb);});}return _0x388053;});})[_0xb952('0x25')](respondWithResult(_0x1f3ebb,0xc9))[_0xb952('0x47')](handleError(_0x1f3ebb,null));};exports[_0xb952('0x26')]=function(_0x52ab46,_0x5d08b0,_0x9b444b){var _0x458b27;return db[_0xb952('0x43')][_0xb952('0x4b')]({'where':{'id':_0x52ab46[_0xb952('0x49')]['id']}})[_0xb952('0x25')](function(_0x4106d2){if(_0x4106d2){return db[_0xb952('0x4e')]['transaction'](function(_0x206210){return _0x4106d2['destroy']({'transaction':_0x206210,'raw':!![]})[_0xb952('0x25')](function(_0x5056d5){if(_0x5056d5['directory']){fs[_0xb952('0x5f')](_0x5056d5[_0xb952('0x51')])[_0xb952('0x60')](function(_0x1dfedc){fs[_0xb952('0x61')](path[_0xb952('0x52')](_0x5056d5['directory'],_0x1dfedc));});fs[_0xb952('0x62')](_0x5056d5[_0xb952('0x51')]);}return _0x5056d5;});})['catch'](function(_0x37a8d3){throw new db['Sequelize']['ValidationError'](_0x37a8d3['message']);});}})[_0xb952('0x25')](handleEntityNotFound(_0x5d08b0,null))['then'](removeEntity(_0x5d08b0,null))['catch'](handleError(_0x5d08b0,null));};exports['addSound']=function(_0x14a0a6,_0x20572f,_0x1a23fd){return db['sequelize'][_0xb952('0x4f')](function(_0x1ecf13){var _0x437cae;return db[_0xb952('0x43')]['find']({'where':{'id':_0x14a0a6[_0xb952('0x49')]['id']}})[_0xb952('0x25')](function(_0x1544f8){if(_0x1544f8){_0x437cae=_0x1544f8;return _0x1544f8[_0xb952('0x63')](_0x14a0a6[_0xb952('0x4c')]['id'],{'transaction':_0x1ecf13});}})['then'](function(_0x1e4ed3){if(_0x1e4ed3){return db[_0xb952('0x64')][_0xb952('0x65')]({'where':{'id':_0x14a0a6[_0xb952('0x4c')]['id']},'attributes':['id',_0xb952('0x2c'),_0xb952('0x66'),_0xb952('0x67'),'createdAt'],'raw':!![]});}})[_0xb952('0x25')](function(_0x2ff8eb){if(_0x2ff8eb){var _0x160db5=path[_0xb952('0x52')](config['root'],_0xb952('0x68'),util['format'](_0xb952('0x69'),path[_0xb952('0x6a')](_0x2ff8eb[_0xb952('0x66')],path['extname'](_0x2ff8eb[_0xb952('0x66')])),_0x2ff8eb[_0xb952('0x67')]));var _0x420b48=path['join'](config[_0xb952('0x53')],'server/files/moh',_0x437cae[_0xb952('0x2c')],util['format'](_0xb952('0x69'),_0x2ff8eb[_0xb952('0x2c')],_0x2ff8eb[_0xb952('0x67')]));fs[_0xb952('0x6b')](_0x160db5,_0x420b48);return _0x2ff8eb;}})[_0xb952('0x47')](function(_0x6e6aa4){throw new db['Sequelize']['ValidationError'](_0x6e6aa4['message']);});})[_0xb952('0x25')](handleEntityNotFound(_0x20572f,null))[_0xb952('0x25')](respondWithResult(_0x20572f,0xc9))[_0xb952('0x47')](handleError(_0x20572f,null));};exports[_0xb952('0x6c')]=function(_0x2a5532,_0x776415,_0x2bca2a){return db[_0xb952('0x4e')]['transaction'](function(_0x4b4279){var _0x1a8148;return db[_0xb952('0x43')]['findOne']({'where':{'id':_0x2a5532['params']['id']}})['then'](handleEntityNotFound(_0x776415,null))[_0xb952('0x25')](function(_0x40592c){if(_0x40592c){_0x1a8148=_0x40592c;return _0x40592c[_0xb952('0x6c')](_0x2a5532['params'][_0xb952('0x6d')]);}})[_0xb952('0x25')](function(_0x2e9a6f){if(_0x2e9a6f){return db[_0xb952('0x64')][_0xb952('0x65')]({'where':{'id':_0x2a5532[_0xb952('0x49')][_0xb952('0x6d')]},'attributes':['id',_0xb952('0x2c'),_0xb952('0x66'),'converted_format','createdAt'],'raw':!![]});}})[_0xb952('0x25')](function(_0x1c765c){if(_0x1c765c){fs['unlinkSync'](path[_0xb952('0x52')](_0x1a8148[_0xb952('0x51')],util['format'](_0xb952('0x69'),_0x1c765c[_0xb952('0x2c')],_0x1c765c[_0xb952('0x67')])));return _0x1c765c;}})[_0xb952('0x47')](function(_0x4871d2){throw new db[(_0xb952('0x6e'))]['ValidationError'](_0x4871d2[_0xb952('0x6f')]);});})[_0xb952('0x25')](handleEntityNotFound(_0x776415,null))['then'](respondWithStatusCode(_0x776415,0xcc))[_0xb952('0x47')](handleError(_0x776415,null));};exports[_0xb952('0x70')]=function(_0x186ebd,_0x3ef96f,_0x4d8932){var _0x96d0b8={};var _0x4a1e09={};var _0x252dd5;var _0x3495d0;return db[_0xb952('0x43')]['findOne']({'where':{'id':_0x186ebd[_0xb952('0x49')]['id']}})[_0xb952('0x25')](handleEntityNotFound(_0x3ef96f,null))[_0xb952('0x25')](function(_0x12db2c){if(_0x12db2c){_0x252dd5=_0x12db2c;_0x4a1e09[_0xb952('0x31')]=_[_0xb952('0x34')](db[_0xb952('0x64')]['rawAttributes']);_0x4a1e09[_0xb952('0x33')]=_[_0xb952('0x34')](_0x186ebd['query']);_0x4a1e09[_0xb952('0x35')]=_['intersection'](_0x4a1e09[_0xb952('0x31')],_0x4a1e09[_0xb952('0x33')]);_0x96d0b8['attributes']=_[_0xb952('0x36')](_0x4a1e09['model'],qs[_0xb952('0x38')](_0x186ebd[_0xb952('0x33')][_0xb952('0x38')]));_0x96d0b8[_0xb952('0x37')]=_0x96d0b8[_0xb952('0x37')][_0xb952('0x39')]?_0x96d0b8[_0xb952('0x37')]:_0x4a1e09[_0xb952('0x31')];_0x96d0b8[_0xb952('0x71')]=qs['sort'](_0x186ebd[_0xb952('0x33')]['sort']);_0x96d0b8[_0xb952('0x3d')]=qs[_0xb952('0x35')](_[_0xb952('0x3e')](_0x186ebd['query'],_0x4a1e09[_0xb952('0x35')]));if(_0x186ebd[_0xb952('0x33')][_0xb952('0x3f')]){_0x96d0b8[_0xb952('0x3d')]=_['merge'](_0x96d0b8[_0xb952('0x3d')],{'$or':_[_0xb952('0x32')](_0x96d0b8[_0xb952('0x37')],function(_0xa95491){var _0x5604dd={};_0x5604dd[_0xa95491]={'$like':'%'+_0x186ebd[_0xb952('0x33')][_0xb952('0x3f')]+'%'};return _0x5604dd;})});}_0x96d0b8=_[_0xb952('0x40')]({},_0x96d0b8,_0x186ebd[_0xb952('0x42')]);return _0x252dd5[_0xb952('0x70')](_0x96d0b8);}})['then'](function(_0xdd1b46){if(_0xdd1b46){_0x3495d0=_0xdd1b46[_0xb952('0x39')];if(!_0x186ebd[_0xb952('0x33')][_0xb952('0x3a')](_0xb952('0x3b'))){_0x96d0b8[_0xb952('0x1f')]=qs[_0xb952('0x1f')](_0x186ebd['query'][_0xb952('0x1f')]);_0x96d0b8[_0xb952('0x21')]=qs['offset'](_0x186ebd['query'][_0xb952('0x21')]);}return _0x252dd5[_0xb952('0x70')](_0x96d0b8);}})[_0xb952('0x25')](function(_0x5f1918){if(_0x5f1918){return _0x5f1918?{'count':_0x3495d0,'rows':_0x5f1918}:null;}})[_0xb952('0x25')](respondWithResult(_0x3ef96f,null))[_0xb952('0x47')](handleError(_0x3ef96f,null));}; \ No newline at end of file +var _0x1157=['status','end','offset','undefined','limit','set','Content-Range','json','update','then','destroy','get','MusicOnHolds','UserProfileResource','error','stack','name','rawAttributes','fieldName','type','model','query','keys','filters','attributes','intersection','fields','nolimit','order','sort','where','pick','filter','merge','map','VIRTUAL','options','count','includeAll','include','VoiceMusicOnHold','rows','catch','show','params','length','find','body','create','mode','files','directory','join','root','server/files/moh','mkdirSync','0777','user','Unable\x20to\x20retrieve\x20the\x20current\x20user','UserProfileSection','userProfileId','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','sequelize','transaction','readdirSync','forEach','unlinkSync','rmdirSync','ValidationError','addSound','findOne','save_name','converted_format','createdAt','server/files/sounds/converted','format','%s.%s','basename','symlinkSync','Sequelize','message','removeSound','id2','Sound','getSounds','hasOwnProperty','rimraf','zip-dir','fast-json-patch','request-promise','moment','mustache','path','sox','to-csv','ejs','fs-extra','crypto','jsforce','desk.js','querystring','papaparse','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/environment','../../mysqldb','sendStatus'];(function(_0x22b70f,_0x4c853f){var _0x100985=function(_0x18628e){while(--_0x18628e){_0x22b70f['push'](_0x22b70f['shift']());}};_0x100985(++_0x4c853f);}(_0x1157,0xc5));var _0x7115=function(_0x3e2b00,_0x1bad69){_0x3e2b00=_0x3e2b00-0x0;var _0x2d9ffa=_0x1157[_0x3e2b00];return _0x2d9ffa;};'use strict';var emlformat=require('eml-format');var rimraf=require(_0x7115('0x0'));var zipdir=require(_0x7115('0x1'));var jsonpatch=require(_0x7115('0x2'));var rp=require(_0x7115('0x3'));var moment=require(_0x7115('0x4'));var BPromise=require('bluebird');var Mustache=require(_0x7115('0x5'));var util=require('util');var path=require(_0x7115('0x6'));var sox=require(_0x7115('0x7'));var csv=require(_0x7115('0x8'));var ejs=require(_0x7115('0x9'));var fs=require('fs');var fs_extra=require(_0x7115('0xa'));var _=require('lodash');var squel=require('squel');var crypto=require(_0x7115('0xb'));var jsforce=require(_0x7115('0xc'));var deskjs=require(_0x7115('0xd'));var toCsv=require(_0x7115('0x8'));var querystring=require(_0x7115('0xe'));var Papa=require(_0x7115('0xf'));var Redis=require('ioredis');var authService=require('../../components/auth/service');var qs=require(_0x7115('0x10'));var as=require(_0x7115('0x11'));var hardwareService=require(_0x7115('0x12'));var logger=require(_0x7115('0x13'))(_0x7115('0x14'));var utils=require(_0x7115('0x15'));var config=require(_0x7115('0x16'));var licenseUtil=require('../../config/license/util');var db=require(_0x7115('0x17'))['db'];function respondWithStatusCode(_0x4f3735,_0x19702f){_0x19702f=_0x19702f||0xcc;return function(_0x4f03f6){if(_0x4f03f6){return _0x4f3735[_0x7115('0x18')](_0x19702f);}return _0x4f3735[_0x7115('0x19')](_0x19702f)[_0x7115('0x1a')]();};}function respondWithResult(_0x40397,_0x27770c){_0x27770c=_0x27770c||0xc8;return function(_0x35a952){if(_0x35a952){return _0x40397[_0x7115('0x19')](_0x27770c)['json'](_0x35a952);}};}function respondWithFilteredResult(_0x29a126,_0x630954){return function(_0x573c1b){if(_0x573c1b){var _0x4b4662=typeof _0x630954[_0x7115('0x1b')]==='undefined'&&typeof _0x630954['limit']===_0x7115('0x1c');var _0x4f3eb1=_0x573c1b['count'];var _0x3ffde0=_0x4b4662?0x0:_0x630954[_0x7115('0x1b')];var _0x24774f=_0x4b4662?_0x573c1b['count']:_0x630954[_0x7115('0x1b')]+_0x630954[_0x7115('0x1d')];var _0x53dcd3;if(_0x24774f>=_0x4f3eb1){_0x24774f=_0x4f3eb1;_0x53dcd3=0xc8;}else{_0x53dcd3=0xce;}_0x29a126['status'](_0x53dcd3);return _0x29a126[_0x7115('0x1e')](_0x7115('0x1f'),_0x3ffde0+'-'+_0x24774f+'/'+_0x4f3eb1)[_0x7115('0x20')](_0x573c1b);}return null;};}function patchUpdates(_0x4ab6e7){return function(_0x2ae485){try{jsonpatch['apply'](_0x2ae485,_0x4ab6e7,!![]);}catch(_0x141036){return BPromise['reject'](_0x141036);}return _0x2ae485['save']();};}function saveUpdates(_0x2ef3a6,_0x59c54a){return function(_0x2cd68c){if(_0x2cd68c){return _0x2cd68c[_0x7115('0x21')](_0x2ef3a6)[_0x7115('0x22')](function(_0x5e8758){return _0x5e8758;});}return null;};}function removeEntity(_0x25a3cb,_0x35704c){return function(_0x44c54c){if(_0x44c54c){return _0x44c54c[_0x7115('0x23')]()['then'](function(){var _0x413049=_0x44c54c[_0x7115('0x24')]({'plain':!![]});var _0x3c96de=_0x7115('0x25');return db[_0x7115('0x26')][_0x7115('0x23')]({'where':{'type':_0x3c96de,'resourceId':_0x413049['id']}})[_0x7115('0x22')](function(){return _0x44c54c;});})[_0x7115('0x22')](function(){_0x25a3cb[_0x7115('0x19')](0xcc)[_0x7115('0x1a')]();});}};}function handleEntityNotFound(_0x26e03a,_0x49ad65){return function(_0x30befb){if(!_0x30befb){_0x26e03a['sendStatus'](0x194);}return _0x30befb;};}function handleError(_0x1519ec,_0x1b8c74){_0x1b8c74=_0x1b8c74||0x1f4;return function(_0x3601d2){logger[_0x7115('0x27')](_0x3601d2[_0x7115('0x28')]);if(_0x3601d2['name']){delete _0x3601d2[_0x7115('0x29')];}_0x1519ec[_0x7115('0x19')](_0x1b8c74)['send'](_0x3601d2);};}exports['index']=function(_0x1b6d0e,_0x153e6f){var _0x2b5552={},_0x4f2808={},_0xdb04d4={'count':0x0,'rows':[]};var _0x2692da=_['map'](db['VoiceMusicOnHold'][_0x7115('0x2a')],function(_0x5e7d6f){return{'name':_0x5e7d6f[_0x7115('0x2b')],'type':_0x5e7d6f[_0x7115('0x2c')]['key']};});_0x4f2808[_0x7115('0x2d')]=_['map'](_0x2692da,_0x7115('0x29'));_0x4f2808[_0x7115('0x2e')]=_[_0x7115('0x2f')](_0x1b6d0e['query']);_0x4f2808[_0x7115('0x30')]=_['intersection'](_0x4f2808[_0x7115('0x2d')],_0x4f2808[_0x7115('0x2e')]);_0x2b5552[_0x7115('0x31')]=_[_0x7115('0x32')](_0x4f2808['model'],qs[_0x7115('0x33')](_0x1b6d0e[_0x7115('0x2e')][_0x7115('0x33')]));_0x2b5552['attributes']=_0x2b5552[_0x7115('0x31')]['length']?_0x2b5552[_0x7115('0x31')]:_0x4f2808[_0x7115('0x2d')];if(!_0x1b6d0e[_0x7115('0x2e')]['hasOwnProperty'](_0x7115('0x34'))){_0x2b5552['limit']=qs[_0x7115('0x1d')](_0x1b6d0e[_0x7115('0x2e')][_0x7115('0x1d')]);_0x2b5552['offset']=qs['offset'](_0x1b6d0e[_0x7115('0x2e')][_0x7115('0x1b')]);}_0x2b5552[_0x7115('0x35')]=qs[_0x7115('0x36')](_0x1b6d0e['query']['sort']);delete _0x1b6d0e[_0x7115('0x2e')][_0x7115('0x36')];_0x2b5552[_0x7115('0x37')]=qs[_0x7115('0x30')](_[_0x7115('0x38')](_0x1b6d0e['query'],_0x4f2808[_0x7115('0x30')]),_0x2692da);if(_0x1b6d0e[_0x7115('0x2e')][_0x7115('0x39')]){_0x2b5552[_0x7115('0x37')]=_[_0x7115('0x3a')](_0x2b5552[_0x7115('0x37')],{'$or':_[_0x7115('0x3b')](_0x2692da,function(_0x229ebf){if(_0x229ebf[_0x7115('0x2c')]!==_0x7115('0x3c')){var _0x1de8d1={};_0x1de8d1[_0x229ebf['name']]={'$like':'%'+_0x1b6d0e[_0x7115('0x2e')][_0x7115('0x39')]+'%'};return _0x1de8d1;}})});}_0x2b5552=_['merge']({},_0x2b5552,_0x1b6d0e[_0x7115('0x3d')]);var _0x23b061={'where':_0x2b5552[_0x7115('0x37')]};return db['VoiceMusicOnHold'][_0x7115('0x3e')](_0x23b061)[_0x7115('0x22')](function(_0x525b79){_0xdb04d4['count']=_0x525b79;if(_0x1b6d0e['query'][_0x7115('0x3f')]){_0x2b5552[_0x7115('0x40')]=[{'all':!![]}];}return db[_0x7115('0x41')]['findAll'](_0x2b5552);})[_0x7115('0x22')](function(_0x3a3a32){_0xdb04d4[_0x7115('0x42')]=_0x3a3a32;return _0xdb04d4;})['then'](respondWithFilteredResult(_0x153e6f,_0x2b5552))[_0x7115('0x43')](handleError(_0x153e6f,null));};exports[_0x7115('0x44')]=function(_0x3638a4,_0x5df848){var _0x3e790e={'raw':![],'where':{'id':_0x3638a4[_0x7115('0x45')]['id']}},_0x3eab49={};_0x3eab49[_0x7115('0x2d')]=_[_0x7115('0x2f')](db['VoiceMusicOnHold'][_0x7115('0x2a')]);_0x3eab49[_0x7115('0x2e')]=_[_0x7115('0x2f')](_0x3638a4[_0x7115('0x2e')]);_0x3eab49['filters']=_[_0x7115('0x32')](_0x3eab49[_0x7115('0x2d')],_0x3eab49[_0x7115('0x2e')]);_0x3e790e[_0x7115('0x31')]=_['intersection'](_0x3eab49['model'],qs[_0x7115('0x33')](_0x3638a4['query'][_0x7115('0x33')]));_0x3e790e[_0x7115('0x31')]=_0x3e790e[_0x7115('0x31')][_0x7115('0x46')]?_0x3e790e[_0x7115('0x31')]:_0x3eab49[_0x7115('0x2d')];if(_0x3638a4[_0x7115('0x2e')]['includeAll']){_0x3e790e[_0x7115('0x40')]=[{'all':!![]}];}_0x3e790e=_['merge']({},_0x3e790e,_0x3638a4[_0x7115('0x3d')]);return db[_0x7115('0x41')][_0x7115('0x47')](_0x3e790e)['then'](handleEntityNotFound(_0x5df848,null))[_0x7115('0x22')](respondWithResult(_0x5df848,null))['catch'](handleError(_0x5df848,null));};exports[_0x7115('0x21')]=function(_0x3938ad,_0x37dd39){if(_0x3938ad[_0x7115('0x48')]['id']){delete _0x3938ad['body']['id'];}return db[_0x7115('0x41')][_0x7115('0x47')]({'where':{'id':_0x3938ad[_0x7115('0x45')]['id']}})[_0x7115('0x22')](handleEntityNotFound(_0x37dd39,null))['then'](saveUpdates(_0x3938ad[_0x7115('0x48')],null))['then'](respondWithResult(_0x37dd39,null))['catch'](handleError(_0x37dd39,null));};exports[_0x7115('0x49')]=function(_0xef8461,_0x48ac19,_0x5c6c92){return db['sequelize']['transaction'](function(_0x9c90){if(_0xef8461[_0x7115('0x48')][_0x7115('0x4a')]===_0x7115('0x4b')){_0xef8461[_0x7115('0x48')][_0x7115('0x4c')]=path[_0x7115('0x4d')](config[_0x7115('0x4e')],_0x7115('0x4f'),_0xef8461[_0x7115('0x48')][_0x7115('0x29')]);}return db[_0x7115('0x41')][_0x7115('0x49')](_0xef8461['body'],{'transaction':_0x9c90})[_0x7115('0x22')](function(_0x3985cf){if(_0xef8461[_0x7115('0x48')][_0x7115('0x4a')]==='files'){fs[_0x7115('0x50')](_0x3985cf[_0x7115('0x4c')],parseInt(_0x7115('0x51'),0x8));}var _0x3a5d70=_0xef8461[_0x7115('0x52')]['get']({'plain':!![]});if(!_0x3a5d70)throw new Error(_0x7115('0x53'));if(_0x3a5d70['role']===_0x7115('0x52')){var _0x5f12c4=_0x3985cf[_0x7115('0x24')]({'plain':!![]});return db[_0x7115('0x54')]['find']({'where':{'name':_0x7115('0x25'),'userProfileId':_0x3a5d70[_0x7115('0x55')]},'raw':!![]})[_0x7115('0x22')](function(_0x1e4d84){if(_0x1e4d84&&_0x1e4d84['autoAssociation']===0x0){return db[_0x7115('0x26')][_0x7115('0x49')]({'name':_0x5f12c4[_0x7115('0x29')],'resourceId':_0x5f12c4['id'],'type':_0x1e4d84[_0x7115('0x29')],'sectionId':_0x1e4d84['id']},{})[_0x7115('0x22')](function(){return _0x3985cf;});}else{return _0x3985cf;}})[_0x7115('0x43')](function(_0x5ed253){logger[_0x7115('0x27')](_0x7115('0x56'),_0x5ed253);});}return _0x3985cf;});})[_0x7115('0x22')](respondWithResult(_0x48ac19,0xc9))['catch'](handleError(_0x48ac19,null));};exports['destroy']=function(_0x1cb71e,_0x4fca2d,_0x1bf92f){var _0x42aef7;return db[_0x7115('0x41')]['find']({'where':{'id':_0x1cb71e[_0x7115('0x45')]['id']}})['then'](function(_0x1ac912){if(_0x1ac912){return db[_0x7115('0x57')][_0x7115('0x58')](function(_0x43dd21){return _0x1ac912[_0x7115('0x23')]({'transaction':_0x43dd21,'raw':!![]})[_0x7115('0x22')](function(_0x505682){if(_0x505682['directory']){fs[_0x7115('0x59')](_0x505682[_0x7115('0x4c')])[_0x7115('0x5a')](function(_0x427535){fs[_0x7115('0x5b')](path[_0x7115('0x4d')](_0x505682['directory'],_0x427535));});fs[_0x7115('0x5c')](_0x505682['directory']);}return _0x505682;});})[_0x7115('0x43')](function(_0x3f566f){throw new db['Sequelize'][(_0x7115('0x5d'))](_0x3f566f['message']);});}})[_0x7115('0x22')](handleEntityNotFound(_0x4fca2d,null))[_0x7115('0x22')](removeEntity(_0x4fca2d,null))[_0x7115('0x43')](handleError(_0x4fca2d,null));};exports['addSound']=function(_0x1f3a17,_0x1cad04,_0x1011fb){return db[_0x7115('0x57')][_0x7115('0x58')](function(_0x28a52a){var _0x38a807;return db[_0x7115('0x41')][_0x7115('0x47')]({'where':{'id':_0x1f3a17[_0x7115('0x45')]['id']}})['then'](function(_0xa5640f){if(_0xa5640f){_0x38a807=_0xa5640f;return _0xa5640f[_0x7115('0x5e')](_0x1f3a17[_0x7115('0x48')]['id'],{'transaction':_0x28a52a});}})[_0x7115('0x22')](function(_0x5b1e48){if(_0x5b1e48){return db['Sound'][_0x7115('0x5f')]({'where':{'id':_0x1f3a17[_0x7115('0x48')]['id']},'attributes':['id',_0x7115('0x29'),_0x7115('0x60'),_0x7115('0x61'),_0x7115('0x62')],'raw':!![]});}})[_0x7115('0x22')](function(_0x4a6f5e){if(_0x4a6f5e){var _0x2385d2=path[_0x7115('0x4d')](config[_0x7115('0x4e')],_0x7115('0x63'),util[_0x7115('0x64')](_0x7115('0x65'),path[_0x7115('0x66')](_0x4a6f5e[_0x7115('0x60')],path['extname'](_0x4a6f5e[_0x7115('0x60')])),_0x4a6f5e[_0x7115('0x61')]));var _0x4d654d=path['join'](config[_0x7115('0x4e')],'server/files/moh',_0x38a807['name'],util[_0x7115('0x64')](_0x7115('0x65'),_0x4a6f5e[_0x7115('0x29')],_0x4a6f5e[_0x7115('0x61')]));fs[_0x7115('0x67')](_0x2385d2,_0x4d654d);return _0x4a6f5e;}})[_0x7115('0x43')](function(_0x4875f3){throw new db[(_0x7115('0x68'))]['ValidationError'](_0x4875f3[_0x7115('0x69')]);});})[_0x7115('0x22')](handleEntityNotFound(_0x1cad04,null))[_0x7115('0x22')](respondWithResult(_0x1cad04,0xc9))[_0x7115('0x43')](handleError(_0x1cad04,null));};exports[_0x7115('0x6a')]=function(_0x3b7031,_0x4ea041,_0x6bb597){return db['sequelize'][_0x7115('0x58')](function(_0x50e49f){var _0x5972f3;return db[_0x7115('0x41')][_0x7115('0x5f')]({'where':{'id':_0x3b7031[_0x7115('0x45')]['id']}})[_0x7115('0x22')](handleEntityNotFound(_0x4ea041,null))[_0x7115('0x22')](function(_0xa68f34){if(_0xa68f34){_0x5972f3=_0xa68f34;return _0xa68f34[_0x7115('0x6a')](_0x3b7031['params'][_0x7115('0x6b')]);}})[_0x7115('0x22')](function(_0x2deb1d){if(_0x2deb1d){return db[_0x7115('0x6c')][_0x7115('0x5f')]({'where':{'id':_0x3b7031[_0x7115('0x45')][_0x7115('0x6b')]},'attributes':['id',_0x7115('0x29'),_0x7115('0x60'),_0x7115('0x61'),'createdAt'],'raw':!![]});}})[_0x7115('0x22')](function(_0x45efa9){if(_0x45efa9){fs['unlinkSync'](path[_0x7115('0x4d')](_0x5972f3[_0x7115('0x4c')],util[_0x7115('0x64')]('%s.%s',_0x45efa9[_0x7115('0x29')],_0x45efa9[_0x7115('0x61')])));return _0x45efa9;}})[_0x7115('0x43')](function(_0x1255e2){throw new db[(_0x7115('0x68'))][(_0x7115('0x5d'))](_0x1255e2[_0x7115('0x69')]);});})['then'](handleEntityNotFound(_0x4ea041,null))[_0x7115('0x22')](respondWithStatusCode(_0x4ea041,0xcc))[_0x7115('0x43')](handleError(_0x4ea041,null));};exports[_0x7115('0x6d')]=function(_0x5c13cb,_0x2af07c,_0x527fb3){var _0x58826d={};var _0x55c268={};var _0x38f974;var _0x315d47;return db['VoiceMusicOnHold'][_0x7115('0x5f')]({'where':{'id':_0x5c13cb[_0x7115('0x45')]['id']}})[_0x7115('0x22')](handleEntityNotFound(_0x2af07c,null))[_0x7115('0x22')](function(_0x578dda){if(_0x578dda){_0x38f974=_0x578dda;_0x55c268[_0x7115('0x2d')]=_[_0x7115('0x2f')](db[_0x7115('0x6c')][_0x7115('0x2a')]);_0x55c268[_0x7115('0x2e')]=_[_0x7115('0x2f')](_0x5c13cb[_0x7115('0x2e')]);_0x55c268[_0x7115('0x30')]=_['intersection'](_0x55c268[_0x7115('0x2d')],_0x55c268[_0x7115('0x2e')]);_0x58826d[_0x7115('0x31')]=_['intersection'](_0x55c268[_0x7115('0x2d')],qs[_0x7115('0x33')](_0x5c13cb[_0x7115('0x2e')]['fields']));_0x58826d['attributes']=_0x58826d[_0x7115('0x31')][_0x7115('0x46')]?_0x58826d['attributes']:_0x55c268[_0x7115('0x2d')];_0x58826d[_0x7115('0x35')]=qs[_0x7115('0x36')](_0x5c13cb['query'][_0x7115('0x36')]);_0x58826d[_0x7115('0x37')]=qs[_0x7115('0x30')](_['pick'](_0x5c13cb['query'],_0x55c268[_0x7115('0x30')]));if(_0x5c13cb[_0x7115('0x2e')]['filter']){_0x58826d[_0x7115('0x37')]=_[_0x7115('0x3a')](_0x58826d[_0x7115('0x37')],{'$or':_[_0x7115('0x3b')](_0x58826d['attributes'],function(_0x14bbb7){var _0x13e006={};_0x13e006[_0x14bbb7]={'$like':'%'+_0x5c13cb[_0x7115('0x2e')][_0x7115('0x39')]+'%'};return _0x13e006;})});}_0x58826d=_[_0x7115('0x3a')]({},_0x58826d,_0x5c13cb[_0x7115('0x3d')]);return _0x38f974['getSounds'](_0x58826d);}})[_0x7115('0x22')](function(_0x1e8b41){if(_0x1e8b41){_0x315d47=_0x1e8b41[_0x7115('0x46')];if(!_0x5c13cb[_0x7115('0x2e')][_0x7115('0x6e')](_0x7115('0x34'))){_0x58826d['limit']=qs['limit'](_0x5c13cb[_0x7115('0x2e')][_0x7115('0x1d')]);_0x58826d['offset']=qs['offset'](_0x5c13cb['query']['offset']);}return _0x38f974['getSounds'](_0x58826d);}})[_0x7115('0x22')](function(_0x490c83){if(_0x490c83){return _0x490c83?{'count':_0x315d47,'rows':_0x490c83}:null;}})[_0x7115('0x22')](respondWithResult(_0x2af07c,null))['catch'](handleError(_0x2af07c,null));}; \ No newline at end of file diff --git a/server/api/voiceMusicOnHold/voiceMusicOnHold.model.js b/server/api/voiceMusicOnHold/voiceMusicOnHold.model.js index 1230888..64f69ee 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 _0x6c4e=['bluebird','request-promise','rimraf','../../config/environment','./voiceMusicOnHold.attributes','exports','define','VoiceMusicOnHold','lodash','util','api','moment'];(function(_0x32805a,_0x2b434f){var _0x2a0615=function(_0x2c44d3){while(--_0x2c44d3){_0x32805a['push'](_0x32805a['shift']());}};_0x2a0615(++_0x2b434f);}(_0x6c4e,0x1ac));var _0xe6c4=function(_0x41b773,_0x38dc08){_0x41b773=_0x41b773-0x0;var _0x19a630=_0x6c4e[_0x41b773];return _0x19a630;};'use strict';var _=require(_0xe6c4('0x0'));var util=require(_0xe6c4('0x1'));var logger=require('../../config/logger')(_0xe6c4('0x2'));var moment=require(_0xe6c4('0x3'));var BPromise=require(_0xe6c4('0x4'));var rp=require(_0xe6c4('0x5'));var fs=require('fs');var path=require('path');var rimraf=require(_0xe6c4('0x6'));var config=require(_0xe6c4('0x7'));var attributes=require(_0xe6c4('0x8'));module[_0xe6c4('0x9')]=function(_0x3df6e0,_0x42ab83){return _0x3df6e0[_0xe6c4('0xa')](_0xe6c4('0xb'),attributes,{'tableName':'voice_musiconhold','paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0xcc48=['bluebird','path','rimraf','../../config/environment','./voiceMusicOnHold.attributes','exports','define','VoiceMusicOnHold','lodash','util','api'];(function(_0x412af8,_0x112ae2){var _0x336d99=function(_0x523707){while(--_0x523707){_0x412af8['push'](_0x412af8['shift']());}};_0x336d99(++_0x112ae2);}(_0xcc48,0x1c0));var _0x8cc4=function(_0x5a2d6e,_0x3d3a47){_0x5a2d6e=_0x5a2d6e-0x0;var _0x30ff59=_0xcc48[_0x5a2d6e];return _0x30ff59;};'use strict';var _=require(_0x8cc4('0x0'));var util=require(_0x8cc4('0x1'));var logger=require('../../config/logger')(_0x8cc4('0x2'));var moment=require('moment');var BPromise=require(_0x8cc4('0x3'));var rp=require('request-promise');var fs=require('fs');var path=require(_0x8cc4('0x4'));var rimraf=require(_0x8cc4('0x5'));var config=require(_0x8cc4('0x6'));var attributes=require(_0x8cc4('0x7'));module[_0x8cc4('0x8')]=function(_0x24c28f,_0x5d6453){return _0x24c28f[_0x8cc4('0x9')](_0x8cc4('0xa'),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 6f5acec..33f717e 100644 --- a/server/api/voiceMusicOnHold/voiceMusicOnHold.rpc.js +++ b/server/api/voiceMusicOnHold/voiceMusicOnHold.rpc.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0xa9e0=['http','info','VoiceMusicOnHold,\x20%s,\x20%s','request\x20sent','debug','VoiceMusicOnHold,\x20%s,\x20%s,\x20%s','code','error','message','result','catch','lodash','util','moment','ioredis','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise'];(function(_0x1b6f70,_0x481c19){var _0x58e1a2=function(_0x374d0d){while(--_0x374d0d){_0x1b6f70['push'](_0x1b6f70['shift']());}};_0x58e1a2(++_0x481c19);}(_0xa9e0,0x123));var _0x0a9e=function(_0x36dfbd,_0x5bfe2d){_0x36dfbd=_0x36dfbd-0x0;var _0x4ecad9=_0xa9e0[_0x36dfbd];return _0x4ecad9;};'use strict';var _=require(_0x0a9e('0x0'));var util=require(_0x0a9e('0x1'));var moment=require(_0x0a9e('0x2'));var BPromise=require('bluebird');var rs=require('randomstring');var fs=require('fs');var Redis=require(_0x0a9e('0x3'));var db=require('../../mysqldb')['db'];var utils=require(_0x0a9e('0x4'));var logger=require(_0x0a9e('0x5'))(_0x0a9e('0x6'));var config=require(_0x0a9e('0x7'));var jayson=require(_0x0a9e('0x8'));var client=jayson['client'][_0x0a9e('0x9')]({'port':0x232a});function respondWithRpcPromise(_0x441e3a,_0x2cc193,_0x5f41ea){return new BPromise(function(_0x503809,_0xe42b77){return client['request'](_0x441e3a,_0x5f41ea)['then'](function(_0x39753a){logger[_0x0a9e('0xa')](_0x0a9e('0xb'),_0x2cc193,_0x0a9e('0xc'));logger[_0x0a9e('0xd')](_0x0a9e('0xe'),_0x2cc193,'request\x20sent',JSON['stringify'](_0x39753a));if(_0x39753a['error']){if(_0x39753a['error'][_0x0a9e('0xf')]===0x1f4){logger[_0x0a9e('0x10')](_0x0a9e('0xb'),_0x2cc193,_0x39753a[_0x0a9e('0x10')][_0x0a9e('0x11')]);return _0xe42b77(_0x39753a[_0x0a9e('0x10')]['message']);}logger[_0x0a9e('0x10')](_0x0a9e('0xb'),_0x2cc193,_0x39753a[_0x0a9e('0x10')][_0x0a9e('0x11')]);return _0x503809(_0x39753a[_0x0a9e('0x10')][_0x0a9e('0x11')]);}else{logger['info'](_0x0a9e('0xb'),_0x2cc193,'request\x20sent');_0x503809(_0x39753a[_0x0a9e('0x12')]['message']);}})[_0x0a9e('0x13')](function(_0x12066b){logger['error'](_0x0a9e('0xb'),_0x2cc193,_0x12066b);_0xe42b77(_0x12066b);});});} \ No newline at end of file +var _0xedd9=['moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','../../config/environment','jayson/promise','client','http','request','then','info','request\x20sent','debug','stringify','error','code','VoiceMusicOnHold,\x20%s,\x20%s','message','catch','util'];(function(_0x5cb665,_0x39e787){var _0x13ef84=function(_0x59f459){while(--_0x59f459){_0x5cb665['push'](_0x5cb665['shift']());}};_0x13ef84(++_0x39e787);}(_0xedd9,0xfc));var _0x9edd=function(_0x3d248e,_0x497324){_0x3d248e=_0x3d248e-0x0;var _0x553b8e=_0xedd9[_0x3d248e];return _0x553b8e;};'use strict';var _=require('lodash');var util=require(_0x9edd('0x0'));var moment=require(_0x9edd('0x1'));var BPromise=require(_0x9edd('0x2'));var rs=require(_0x9edd('0x3'));var fs=require('fs');var Redis=require(_0x9edd('0x4'));var db=require(_0x9edd('0x5'))['db'];var utils=require(_0x9edd('0x6'));var logger=require(_0x9edd('0x7'))('rpc');var config=require(_0x9edd('0x8'));var jayson=require(_0x9edd('0x9'));var client=jayson[_0x9edd('0xa')][_0x9edd('0xb')]({'port':0x232a});function respondWithRpcPromise(_0x5319f7,_0xf0b2d8,_0x571af9){return new BPromise(function(_0x172522,_0x190185){return client[_0x9edd('0xc')](_0x5319f7,_0x571af9)[_0x9edd('0xd')](function(_0x49d5e3){logger[_0x9edd('0xe')]('VoiceMusicOnHold,\x20%s,\x20%s',_0xf0b2d8,_0x9edd('0xf'));logger[_0x9edd('0x10')]('VoiceMusicOnHold,\x20%s,\x20%s,\x20%s',_0xf0b2d8,_0x9edd('0xf'),JSON[_0x9edd('0x11')](_0x49d5e3));if(_0x49d5e3['error']){if(_0x49d5e3[_0x9edd('0x12')][_0x9edd('0x13')]===0x1f4){logger[_0x9edd('0x12')](_0x9edd('0x14'),_0xf0b2d8,_0x49d5e3[_0x9edd('0x12')][_0x9edd('0x15')]);return _0x190185(_0x49d5e3[_0x9edd('0x12')][_0x9edd('0x15')]);}logger['error'](_0x9edd('0x14'),_0xf0b2d8,_0x49d5e3[_0x9edd('0x12')][_0x9edd('0x15')]);return _0x172522(_0x49d5e3[_0x9edd('0x12')][_0x9edd('0x15')]);}else{logger[_0x9edd('0xe')](_0x9edd('0x14'),_0xf0b2d8,_0x9edd('0xf'));_0x172522(_0x49d5e3['result'][_0x9edd('0x15')]);}})[_0x9edd('0x16')](function(_0x449cee){logger['error'](_0x9edd('0x14'),_0xf0b2d8,_0x449cee);_0x190185(_0x449cee);});});} \ No newline at end of file diff --git a/server/api/voicePrefix/index.js b/server/api/voicePrefix/index.js index 75ca379..9ab27e0 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 _0x1134=['show','getAgents','/:id/teams','getTeams','post','create','put','destroy','delete','/:id/users','removeAgents','exports','multer','util','connect-timeout','express','fs-extra','../../components/auth/service','../../config/environment','get','index','/describe','isAuthenticated','describe','/:id'];(function(_0x19950b,_0x53d0d7){var _0x3c6b41=function(_0x3924ad){while(--_0x3924ad){_0x19950b['push'](_0x19950b['shift']());}};_0x3c6b41(++_0x53d0d7);}(_0x1134,0x19c));var _0x4113=function(_0x5f38c3,_0x478e38){_0x5f38c3=_0x5f38c3-0x0;var _0x353cd8=_0x1134[_0x5f38c3];return _0x353cd8;};'use strict';var multer=require(_0x4113('0x0'));var util=require(_0x4113('0x1'));var path=require('path');var timeout=require(_0x4113('0x2'));var express=require(_0x4113('0x3'));var router=express['Router']();var fs_extra=require(_0x4113('0x4'));var auth=require(_0x4113('0x5'));var interaction=require('../../components/interaction/service');var config=require(_0x4113('0x6'));var controller=require('./voicePrefix.controller');router[_0x4113('0x7')]('/',auth['isAuthenticated'](),controller[_0x4113('0x8')]);router['get'](_0x4113('0x9'),auth[_0x4113('0xa')](),controller[_0x4113('0xb')]);router[_0x4113('0x7')](_0x4113('0xc'),auth[_0x4113('0xa')](),controller[_0x4113('0xd')]);router[_0x4113('0x7')]('/:id/users',auth[_0x4113('0xa')](),controller[_0x4113('0xe')]);router[_0x4113('0x7')](_0x4113('0xf'),auth[_0x4113('0xa')](),controller[_0x4113('0x10')]);router[_0x4113('0x11')]('/',auth[_0x4113('0xa')](),controller[_0x4113('0x12')]);router[_0x4113('0x11')]('/:id/users',auth['isAuthenticated'](),controller['addAgents']);router[_0x4113('0x11')](_0x4113('0xf'),auth['isAuthenticated'](),controller['addTeams']);router[_0x4113('0x13')]('/:id',auth[_0x4113('0xa')](),controller['update']);router['delete'](_0x4113('0xc'),auth[_0x4113('0xa')](),controller[_0x4113('0x14')]);router[_0x4113('0x15')](_0x4113('0x16'),auth[_0x4113('0xa')](),controller[_0x4113('0x17')]);router[_0x4113('0x15')](_0x4113('0xf'),auth[_0x4113('0xa')](),controller['removeTeams']);module[_0x4113('0x18')]=router; \ No newline at end of file +var _0xa915=['removeAgents','removeTeams','exports','util','path','connect-timeout','fs-extra','../../components/auth/service','../../config/environment','get','isAuthenticated','index','/describe','describe','/:id','show','/:id/users','getAgents','/:id/teams','getTeams','create','post','addTeams','update','destroy','delete'];(function(_0x36372a,_0x33e13c){var _0x28c6f3=function(_0x26614e){while(--_0x26614e){_0x36372a['push'](_0x36372a['shift']());}};_0x28c6f3(++_0x33e13c);}(_0xa915,0x1d7));var _0x5a91=function(_0x1aff63,_0x43ad49){_0x1aff63=_0x1aff63-0x0;var _0x400511=_0xa915[_0x1aff63];return _0x400511;};'use strict';var multer=require('multer');var util=require(_0x5a91('0x0'));var path=require(_0x5a91('0x1'));var timeout=require(_0x5a91('0x2'));var express=require('express');var router=express['Router']();var fs_extra=require(_0x5a91('0x3'));var auth=require(_0x5a91('0x4'));var interaction=require('../../components/interaction/service');var config=require(_0x5a91('0x5'));var controller=require('./voicePrefix.controller');router[_0x5a91('0x6')]('/',auth[_0x5a91('0x7')](),controller[_0x5a91('0x8')]);router[_0x5a91('0x6')](_0x5a91('0x9'),auth[_0x5a91('0x7')](),controller[_0x5a91('0xa')]);router[_0x5a91('0x6')](_0x5a91('0xb'),auth[_0x5a91('0x7')](),controller[_0x5a91('0xc')]);router[_0x5a91('0x6')](_0x5a91('0xd'),auth[_0x5a91('0x7')](),controller[_0x5a91('0xe')]);router[_0x5a91('0x6')](_0x5a91('0xf'),auth['isAuthenticated'](),controller[_0x5a91('0x10')]);router['post']('/',auth[_0x5a91('0x7')](),controller[_0x5a91('0x11')]);router[_0x5a91('0x12')]('/:id/users',auth[_0x5a91('0x7')](),controller['addAgents']);router[_0x5a91('0x12')](_0x5a91('0xf'),auth[_0x5a91('0x7')](),controller[_0x5a91('0x13')]);router['put'](_0x5a91('0xb'),auth[_0x5a91('0x7')](),controller[_0x5a91('0x14')]);router['delete'](_0x5a91('0xb'),auth[_0x5a91('0x7')](),controller[_0x5a91('0x15')]);router[_0x5a91('0x16')](_0x5a91('0xd'),auth['isAuthenticated'](),controller[_0x5a91('0x17')]);router['delete'](_0x5a91('0xf'),auth['isAuthenticated'](),controller[_0x5a91('0x18')]);module[_0x5a91('0x19')]=router; \ No newline at end of file diff --git a/server/api/voicePrefix/voicePrefix.attributes.js b/server/api/voicePrefix/voicePrefix.attributes.js index c174407..ffdf5f7 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 _0xfd78=['VIRTUAL','system-','getDataValue','INTEGER','sequelize','exports','STRING'];(function(_0x161f85,_0x1b1968){var _0x3f98ad=function(_0x44b3d5){while(--_0x44b3d5){_0x161f85['push'](_0x161f85['shift']());}};_0x3f98ad(++_0x1b1968);}(_0xfd78,0x9e));var _0x8fd7=function(_0xe7015c,_0x187b21){_0xe7015c=_0xe7015c-0x0;var _0x587140=_0xfd78[_0xe7015c];return _0x587140;};'use strict';var Sequelize=require(_0x8fd7('0x0'));module[_0x8fd7('0x1')]={'name':{'type':Sequelize[_0x8fd7('0x2')],'allowNull':![],'unique':'name'},'prefix':{'type':Sequelize[_0x8fd7('0x3')],'get':function(_0x177e3d){return _0x8fd7('0x4')+this[_0x8fd7('0x5')]('name')+'-';}},'description':{'type':Sequelize[_0x8fd7('0x2')]},'callerIdAll':{'type':Sequelize[_0x8fd7('0x2')]},'VoiceExtensionId':{'type':Sequelize[_0x8fd7('0x6')]}}; \ No newline at end of file +var _0x9384=['STRING','name','VIRTUAL','system-','getDataValue','INTEGER','sequelize'];(function(_0x2b564d,_0x5401fd){var _0x4d7330=function(_0x9f8585){while(--_0x9f8585){_0x2b564d['push'](_0x2b564d['shift']());}};_0x4d7330(++_0x5401fd);}(_0x9384,0x1c6));var _0x4938=function(_0x12f688,_0x585c25){_0x12f688=_0x12f688-0x0;var _0x59c3de=_0x9384[_0x12f688];return _0x59c3de;};'use strict';var Sequelize=require(_0x4938('0x0'));module['exports']={'name':{'type':Sequelize[_0x4938('0x1')],'allowNull':![],'unique':_0x4938('0x2')},'prefix':{'type':Sequelize[_0x4938('0x3')],'get':function(_0x5aae7d){return _0x4938('0x4')+this[_0x4938('0x5')](_0x4938('0x2'))+'-';}},'description':{'type':Sequelize['STRING']},'callerIdAll':{'type':Sequelize['STRING']},'VoiceExtensionId':{'type':Sequelize[_0x4938('0x6')]}}; \ No newline at end of file diff --git a/server/api/voicePrefix/voicePrefix.controller.js b/server/api/voicePrefix/voicePrefix.controller.js index ffdf831..6c0b198 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 _0x5423=['user','UserProfileSection','userProfileId','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','context','from-sip','app','system','description','Voice\x20Prefix\x20Extension','priority','NoOp','Voice\x20Prefix','VoicePrefixId','bulkCreate','Extensions\x20creation\x20failed','prefix','push','CDR(prefix)=','callerIdAll','Set','PREFIX-CALLERIDALL=','goto','${EXTEN:','charAt','system-','findById','addAgents','ids','omit','emit','userVoicePrefix:save','removeAgents','isArray','userVoicePrefix:remove','findOne','User','filter','getAgents','getTeams','addTeams','Team','Agents','online','voicePause','interface','flatMap','transaction','each','upsert','UserVoicePrefix','forEach','removeTeams','select','field','from','team_has_voice_prefixes','join','user_has_teams','ut.TeamId\x20=\x20tq.TeamId','VoicePrefixId\x20=\x20?','clone','ut.UserId\x20=\x20?','toString','QueryTypes','SELECT','TeamId','includes','all','compact','isEmpty','eml-format','rimraf','fast-json-patch','request-promise','bluebird','mustache','util','path','to-csv','ejs','fs-extra','lodash','squel','desk.js','papaparse','ioredis','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/logger','api','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','redis','defaults','localhost','socket.io-emitter','./voicePrefix.socket','sendStatus','status','json','offset','limit','undefined','count','Content-Range','reject','update','then','destroy','get','VoicePrefixes','UserProfileResource','end','error','stack','name','send','index','VoicePrefix','fieldName','model','map','keys','filters','intersection','query','fields','attributes','length','hasOwnProperty','nolimit','sort','where','pick','type','VIRTUAL','merge','options','includeAll','include','findAll','catch','show','params','rawAttributes','find','describe','sequelize','body','VoiceExtension','VoiceExtensionId','Unable\x20to\x20retrieve\x20the\x20current\x20user','role'];(function(_0x440506,_0x3e10fd){var _0x4ac632=function(_0x56dfb4){while(--_0x56dfb4){_0x440506['push'](_0x440506['shift']());}};_0x4ac632(++_0x3e10fd);}(_0x5423,0xe3));var _0x3542=function(_0x440176,_0x2883ff){_0x440176=_0x440176-0x0;var _0x39cd06=_0x5423[_0x440176];return _0x39cd06;};'use strict';var emlformat=require(_0x3542('0x0'));var rimraf=require(_0x3542('0x1'));var zipdir=require('zip-dir');var jsonpatch=require(_0x3542('0x2'));var rp=require(_0x3542('0x3'));var moment=require('moment');var BPromise=require(_0x3542('0x4'));var Mustache=require(_0x3542('0x5'));var util=require(_0x3542('0x6'));var path=require(_0x3542('0x7'));var sox=require('sox');var csv=require(_0x3542('0x8'));var ejs=require(_0x3542('0x9'));var fs=require('fs');var fs_extra=require(_0x3542('0xa'));var _=require(_0x3542('0xb'));var squel=require(_0x3542('0xc'));var crypto=require('crypto');var jsforce=require('jsforce');var deskjs=require(_0x3542('0xd'));var toCsv=require(_0x3542('0x8'));var querystring=require('querystring');var Papa=require(_0x3542('0xe'));var Redis=require(_0x3542('0xf'));var authService=require('../../components/auth/service');var qs=require(_0x3542('0x10'));var as=require(_0x3542('0x11'));var hardwareService=require('../../config/license/hardware');var logger=require(_0x3542('0x12'))(_0x3542('0x13'));var utils=require(_0x3542('0x14'));var config=require(_0x3542('0x15'));var licenseUtil=require(_0x3542('0x16'));var db=require(_0x3542('0x17'))['db'];config[_0x3542('0x18')]=_[_0x3542('0x19')](config[_0x3542('0x18')],{'host':_0x3542('0x1a'),'port':0x18eb});var socket=require(_0x3542('0x1b'))(new Redis(config[_0x3542('0x18')]));require(_0x3542('0x1c'))['register'](socket);function respondWithStatusCode(_0x14fe57,_0x4fb366){_0x4fb366=_0x4fb366||0xcc;return function(_0x3bfb33){if(_0x3bfb33){return _0x14fe57[_0x3542('0x1d')](_0x4fb366);}return _0x14fe57[_0x3542('0x1e')](_0x4fb366)['end']();};}function respondWithResult(_0x270312,_0x177fb9){_0x177fb9=_0x177fb9||0xc8;return function(_0x347ac8){if(_0x347ac8){return _0x270312['status'](_0x177fb9)[_0x3542('0x1f')](_0x347ac8);}};}function respondWithFilteredResult(_0x23b0de,_0x116859){return function(_0x3d5199){if(_0x3d5199){var _0x493d95=typeof _0x116859[_0x3542('0x20')]==='undefined'&&typeof _0x116859[_0x3542('0x21')]===_0x3542('0x22');var _0x4d93bc=_0x3d5199[_0x3542('0x23')];var _0x199f7d=_0x493d95?0x0:_0x116859[_0x3542('0x20')];var _0x1302fb=_0x493d95?_0x3d5199[_0x3542('0x23')]:_0x116859['offset']+_0x116859['limit'];var _0x4c58f1;if(_0x1302fb>=_0x4d93bc){_0x1302fb=_0x4d93bc;_0x4c58f1=0xc8;}else{_0x4c58f1=0xce;}_0x23b0de[_0x3542('0x1e')](_0x4c58f1);return _0x23b0de['set'](_0x3542('0x24'),_0x199f7d+'-'+_0x1302fb+'/'+_0x4d93bc)['json'](_0x3d5199);}return null;};}function patchUpdates(_0x1d5f1e){return function(_0x55774d){try{jsonpatch['apply'](_0x55774d,_0x1d5f1e,!![]);}catch(_0x3eacd0){return BPromise[_0x3542('0x25')](_0x3eacd0);}return _0x55774d['save']();};}function saveUpdates(_0x5d05b2,_0x3fc964){return function(_0x5123f0){if(_0x5123f0){return _0x5123f0[_0x3542('0x26')](_0x5d05b2)[_0x3542('0x27')](function(_0x1e0723){return _0x1e0723;});}return null;};}function removeEntity(_0x2f2e63,_0x298763){return function(_0xf1f7d0){if(_0xf1f7d0){return _0xf1f7d0[_0x3542('0x28')]()[_0x3542('0x27')](function(){var _0x18dc6c=_0xf1f7d0[_0x3542('0x29')]({'plain':!![]});var _0xfdfe62=_0x3542('0x2a');return db[_0x3542('0x2b')][_0x3542('0x28')]({'where':{'type':_0xfdfe62,'resourceId':_0x18dc6c['id']}})[_0x3542('0x27')](function(){return _0xf1f7d0;});})[_0x3542('0x27')](function(){_0x2f2e63[_0x3542('0x1e')](0xcc)[_0x3542('0x2c')]();});}};}function handleEntityNotFound(_0x3bd666,_0x5590a2){return function(_0x31ad47){if(!_0x31ad47){_0x3bd666[_0x3542('0x1d')](0x194);}return _0x31ad47;};}function handleError(_0x2aec76,_0x4a3ad0){_0x4a3ad0=_0x4a3ad0||0x1f4;return function(_0x402c97){logger[_0x3542('0x2d')](_0x402c97[_0x3542('0x2e')]);if(_0x402c97[_0x3542('0x2f')]){delete _0x402c97['name'];}_0x2aec76['status'](_0x4a3ad0)[_0x3542('0x30')](_0x402c97);};}exports[_0x3542('0x31')]=function(_0xd19bf4,_0x44e8f7){var _0x209e7f={},_0x1e5789={},_0x1f43d2={'count':0x0,'rows':[]};var _0x49b18a=_['map'](db[_0x3542('0x32')]['rawAttributes'],function(_0x4ec0c1){return{'name':_0x4ec0c1[_0x3542('0x33')],'type':_0x4ec0c1['type']['key']};});_0x1e5789[_0x3542('0x34')]=_[_0x3542('0x35')](_0x49b18a,_0x3542('0x2f'));_0x1e5789['query']=_[_0x3542('0x36')](_0xd19bf4['query']);_0x1e5789[_0x3542('0x37')]=_[_0x3542('0x38')](_0x1e5789['model'],_0x1e5789[_0x3542('0x39')]);_0x209e7f['attributes']=_[_0x3542('0x38')](_0x1e5789[_0x3542('0x34')],qs[_0x3542('0x3a')](_0xd19bf4['query'][_0x3542('0x3a')]));_0x209e7f['attributes']=_0x209e7f[_0x3542('0x3b')][_0x3542('0x3c')]?_0x209e7f[_0x3542('0x3b')]:_0x1e5789[_0x3542('0x34')];if(!_0xd19bf4[_0x3542('0x39')][_0x3542('0x3d')](_0x3542('0x3e'))){_0x209e7f[_0x3542('0x21')]=qs[_0x3542('0x21')](_0xd19bf4[_0x3542('0x39')][_0x3542('0x21')]);_0x209e7f[_0x3542('0x20')]=qs[_0x3542('0x20')](_0xd19bf4['query'][_0x3542('0x20')]);}_0x209e7f['order']=qs['sort'](_0xd19bf4[_0x3542('0x39')][_0x3542('0x3f')]);_0x209e7f[_0x3542('0x40')]=qs[_0x3542('0x37')](_[_0x3542('0x41')](_0xd19bf4[_0x3542('0x39')],_0x1e5789[_0x3542('0x37')]),_0x49b18a);if(_0xd19bf4[_0x3542('0x39')]['filter']){_0x209e7f[_0x3542('0x40')]=_['merge'](_0x209e7f[_0x3542('0x40')],{'$or':_[_0x3542('0x35')](_0x49b18a,function(_0x57900f){if(_0x57900f[_0x3542('0x42')]!==_0x3542('0x43')){var _0x49d879={};_0x49d879[_0x57900f[_0x3542('0x2f')]]={'$like':'%'+_0xd19bf4[_0x3542('0x39')]['filter']+'%'};return _0x49d879;}})});}_0x209e7f=_[_0x3542('0x44')]({},_0x209e7f,_0xd19bf4[_0x3542('0x45')]);var _0x18c5aa={'where':_0x209e7f[_0x3542('0x40')]};return db[_0x3542('0x32')][_0x3542('0x23')](_0x18c5aa)[_0x3542('0x27')](function(_0x4bf45a){_0x1f43d2['count']=_0x4bf45a;if(_0xd19bf4[_0x3542('0x39')][_0x3542('0x46')]){_0x209e7f[_0x3542('0x47')]=[{'all':!![]}];}return db[_0x3542('0x32')][_0x3542('0x48')](_0x209e7f);})['then'](function(_0x3e6a49){_0x1f43d2['rows']=_0x3e6a49;return _0x1f43d2;})[_0x3542('0x27')](respondWithFilteredResult(_0x44e8f7,_0x209e7f))[_0x3542('0x49')](handleError(_0x44e8f7,null));};exports[_0x3542('0x4a')]=function(_0x5255a3,_0x1ea685){var _0x2c2bb2={'raw':![],'where':{'id':_0x5255a3[_0x3542('0x4b')]['id']}},_0x524925={};_0x524925[_0x3542('0x34')]=_[_0x3542('0x36')](db[_0x3542('0x32')][_0x3542('0x4c')]);_0x524925[_0x3542('0x39')]=_[_0x3542('0x36')](_0x5255a3[_0x3542('0x39')]);_0x524925['filters']=_['intersection'](_0x524925['model'],_0x524925[_0x3542('0x39')]);_0x2c2bb2[_0x3542('0x3b')]=_[_0x3542('0x38')](_0x524925[_0x3542('0x34')],qs[_0x3542('0x3a')](_0x5255a3[_0x3542('0x39')][_0x3542('0x3a')]));_0x2c2bb2['attributes']=_0x2c2bb2[_0x3542('0x3b')][_0x3542('0x3c')]?_0x2c2bb2[_0x3542('0x3b')]:_0x524925[_0x3542('0x34')];if(_0x5255a3['query'][_0x3542('0x46')]){_0x2c2bb2[_0x3542('0x47')]=[{'all':!![]}];}_0x2c2bb2=_['merge']({},_0x2c2bb2,_0x5255a3['options']);return db[_0x3542('0x32')][_0x3542('0x4d')](_0x2c2bb2)[_0x3542('0x27')](handleEntityNotFound(_0x1ea685,null))[_0x3542('0x27')](respondWithResult(_0x1ea685,null))[_0x3542('0x49')](handleError(_0x1ea685,null));};exports[_0x3542('0x28')]=function(_0x42cf91,_0x594189){return db[_0x3542('0x32')][_0x3542('0x4d')]({'where':{'id':_0x42cf91[_0x3542('0x4b')]['id']}})[_0x3542('0x27')](handleEntityNotFound(_0x594189,null))[_0x3542('0x27')](removeEntity(_0x594189,null))[_0x3542('0x49')](handleError(_0x594189,null));};exports[_0x3542('0x4e')]=function(_0x331506,_0xaf8f1){return db['VoicePrefix']['describe']()[_0x3542('0x27')](respondWithResult(_0xaf8f1,null))['catch'](handleError(_0xaf8f1,null));};exports['create']=function(_0x572e7a,_0x286222){var _0xd5c5c3;return db[_0x3542('0x4f')]['transaction'](function(_0x2db495){return db[_0x3542('0x32')]['create'](_0x572e7a[_0x3542('0x50')],{'transaction':_0x2db495})[_0x3542('0x27')](function(_0x442000){_0xd5c5c3=_0x442000[_0x3542('0x29')]({'plain':!![]});return db[_0x3542('0x51')]['find']({'where':{'id':_0xd5c5c3[_0x3542('0x52')]},'raw':!![]})[_0x3542('0x27')](function(_0x2989c3){return createVoicePrefixExtensions(_0xd5c5c3,_0x2989c3,_0x2db495);});});})[_0x3542('0x27')](function(){var _0xbf9a5=_0x572e7a['user']['get']({'plain':!![]});if(!_0xbf9a5)throw new Error(_0x3542('0x53'));if(_0xbf9a5[_0x3542('0x54')]===_0x3542('0x55')){var _0x5de994=_0xd5c5c3;return db[_0x3542('0x56')][_0x3542('0x4d')]({'where':{'name':_0x3542('0x2a'),'userProfileId':_0xbf9a5[_0x3542('0x57')]},'raw':!![]})[_0x3542('0x27')](function(_0x5d49cc){if(_0x5d49cc&&_0x5d49cc['autoAssociation']===0x0){return db[_0x3542('0x2b')]['create']({'name':_0x5de994[_0x3542('0x2f')],'resourceId':_0x5de994['id'],'type':_0x5d49cc[_0x3542('0x2f')],'sectionId':_0x5d49cc['id']},{})['then'](function(){return _0xd5c5c3;});}else{return _0xd5c5c3;}})[_0x3542('0x49')](function(_0x422535){logger[_0x3542('0x2d')](_0x3542('0x58'),_0x422535);throw _0x422535;});}return _0xd5c5c3;})[_0x3542('0x27')](respondWithResult(_0x286222,null))['catch'](handleError(_0x286222,null));};function Extension(_0x4cb73f,_0x271dd0,_0x56b920,_0x1ffa0a){this[_0x3542('0x59')]=_0x3542('0x5a');this['exten']=_0x4cb73f;this[_0x3542('0x5b')]=_0x56b920;this[_0x3542('0x42')]=_0x3542('0x5c');this[_0x3542('0x5d')]=_0x3542('0x5e');this[_0x3542('0x5f')]=_0x271dd0;this['appdata']=_0x1ffa0a;}function createVoicePrefixExtensions(_0x2e75a1,_0x3ee446,_0x44c95a){return new BPromise(function(_0x411de1,_0x302bed){var _0x43dd32=new Extension(formatPrefixName(_0x2e75a1['prefix']),0x1,_0x3542('0x60'),_0x3542('0x61'));_0x43dd32[_0x3542('0x62')]=_0x2e75a1['id'];return db[_0x3542('0x51')]['create'](_0x43dd32,{'transaction':_0x44c95a})[_0x3542('0x27')](function(_0x2bb95c){var _0x5349a8=_0x2bb95c['get']({'plain':!![]});var _0x2908e5=_['map'](addVoicePrefixExtensions(_0x2e75a1,_0x3ee446),function(_0x3be40e){_0x3be40e['VoiceExtensionId']=_0x5349a8['id'];_0x3be40e['VoicePrefixId']=_0x2e75a1['id'];return _0x3be40e;});return db[_0x3542('0x51')][_0x3542('0x63')](_0x2908e5,{'transaction':_0x44c95a})[_0x3542('0x27')](function(_0x3bba0d){if(!_0x3bba0d){return _0x302bed(_0x3542('0x64'));}else{return _0x411de1(_0x3bba0d);}})[_0x3542('0x49')](function(_0x32b137){return _0x302bed(_0x32b137);});});;});};function addVoicePrefixExtensions(_0x557c5c,_0x365947){var _0xf1cf57=[];var _0x16faf1=formatPrefixName(_0x557c5c[_0x3542('0x65')]);_0xf1cf57[_0x3542('0x66')](new Extension(_0x16faf1,0x2,'Set',_0x3542('0x67')+_0x557c5c[_0x3542('0x2f')]));if(_0x557c5c[_0x3542('0x68')]){_0xf1cf57[_0x3542('0x66')](new Extension(_0x16faf1,0x3,_0x3542('0x69'),_0x3542('0x6a')+_0x557c5c[_0x3542('0x68')]));}else{_0xf1cf57['push'](new Extension(_0x16faf1,0x3,_0x3542('0x60'),'No\x20callerid\x20available'));}_0xf1cf57[_0x3542('0x66')](new Extension(_0x16faf1,0x4,_0x3542('0x6b'),_0x365947[_0x3542('0x59')]+','+_0x3542('0x6c')+(0x8+_0x557c5c['name']['length'])+'}'+','+0x1));return _0xf1cf57;}function formatPrefixName(_0x5b3d44){var _0x2f36c6='_';for(var _0x349a9e=0x0;_0x349a9e<_0x5b3d44[_0x3542('0x3c')];_0x349a9e++){if(_0x5b3d44[_0x3542('0x6d')](_0x349a9e)=='-'){_0x2f36c6+=_0x5b3d44[_0x3542('0x6d')](_0x349a9e);}else{_0x2f36c6+='['+_0x5b3d44[_0x3542('0x6d')](_0x349a9e)+']';}}_0x2f36c6+='.';return _0x2f36c6;}exports[_0x3542('0x26')]=function(_0x77f0af,_0x2b0de0,_0x5c8061){var _0x37ce35=_0x77f0af[_0x3542('0x50')];_0x37ce35[_0x3542('0x65')]=_0x3542('0x6e')+_0x37ce35[_0x3542('0x2f')]+'-';return db['sequelize']['transaction'](function(_0x51b83c){return db[_0x3542('0x32')]['update'](_0x37ce35,{'where':{'id':_0x37ce35['id']},'transaction':_0x51b83c})[_0x3542('0x27')](function(){return db['VoiceExtension'][_0x3542('0x28')]({'where':{'VoicePrefixId':_0x37ce35['id']},'transaction':_0x51b83c})['then'](function(){return db[_0x3542('0x51')][_0x3542('0x4d')]({'where':{'id':_0x37ce35['VoiceExtensionId']},'raw':!![]})['then'](function(_0x5488f8){return createVoicePrefixExtensions(_0x37ce35,_0x5488f8,_0x51b83c);});});});})[_0x3542('0x27')](function(){return db['VoicePrefix'][_0x3542('0x6f')](_0x37ce35['id']);})[_0x3542('0x27')](respondWithResult(_0x2b0de0,null))['catch'](handleError(_0x2b0de0,null));};exports[_0x3542('0x70')]=function(_0x345082,_0x12d32a,_0x51d0a8){return db[_0x3542('0x32')]['find']({'where':{'id':_0x345082[_0x3542('0x4b')]['id']}})['then'](handleEntityNotFound(_0x12d32a,null))[_0x3542('0x27')](function(_0xf10a99){if(_0xf10a99){return _0xf10a99[_0x3542('0x70')](_0x345082['body'][_0x3542('0x71')],_[_0x3542('0x72')](_0x345082[_0x3542('0x50')],[_0x3542('0x71'),'id'])||{})['spread'](function(_0x5b2016){for(var _0x3f9cdb=0x0;_0x3f9cdb<_0x345082[_0x3542('0x50')][_0x3542('0x71')][_0x3542('0x3c')];_0x3f9cdb+=0x1){socket[_0x3542('0x73')](_0x3542('0x74'),{'UserId':Number(_0x345082[_0x3542('0x50')][_0x3542('0x71')][_0x3f9cdb]),'VoicePrefixId':Number(_0x345082[_0x3542('0x4b')]['id'])});}return _0x5b2016;});}})[_0x3542('0x27')](respondWithResult(_0x12d32a,null))[_0x3542('0x49')](handleError(_0x12d32a,null));};exports[_0x3542('0x75')]=function(_0x23f092,_0x8a72fb,_0x33719d){return db[_0x3542('0x32')][_0x3542('0x4d')]({'where':{'id':_0x23f092[_0x3542('0x4b')]['id']}})['then'](handleEntityNotFound(_0x8a72fb,null))[_0x3542('0x27')](function(_0x10f7d2){if(_0x10f7d2){return _0x10f7d2['removeAgents'](_0x23f092['query'][_0x3542('0x71')])[_0x3542('0x27')](function(){if(_[_0x3542('0x76')](_0x23f092[_0x3542('0x39')]['ids'])){for(var _0x263ff6=0x0;_0x263ff6<_0x23f092[_0x3542('0x39')]['ids'][_0x3542('0x3c')];_0x263ff6+=0x1){socket['emit'](_0x3542('0x77'),{'UserId':Number(_0x23f092['query'][_0x3542('0x71')][_0x263ff6]),'VoicePrefixId':Number(_0x23f092[_0x3542('0x4b')]['id'])});}}else{socket[_0x3542('0x73')](_0x3542('0x77'),{'UserId':Number(_0x23f092[_0x3542('0x39')][_0x3542('0x71')]),'VoicePrefixId':Number(_0x23f092[_0x3542('0x4b')]['id'])});}});}})['then'](respondWithStatusCode(_0x8a72fb,null))[_0x3542('0x49')](handleError(_0x8a72fb,null));};exports['getAgents']=function(_0x55c2a7,_0x3c47c1,_0x1a9a73){var _0x2c6f2b={};var _0x40c19c={};var _0x593bf1;var _0x468804;return db[_0x3542('0x32')][_0x3542('0x78')]({'where':{'id':_0x55c2a7[_0x3542('0x4b')]['id']}})[_0x3542('0x27')](handleEntityNotFound(_0x3c47c1,null))[_0x3542('0x27')](function(_0x1bc57f){if(_0x1bc57f){_0x593bf1=_0x1bc57f;_0x40c19c[_0x3542('0x34')]=_[_0x3542('0x36')](db[_0x3542('0x79')]['rawAttributes']);_0x40c19c['query']=_[_0x3542('0x36')](_0x55c2a7['query']);_0x40c19c[_0x3542('0x37')]=_[_0x3542('0x38')](_0x40c19c[_0x3542('0x34')],_0x40c19c['query']);_0x2c6f2b[_0x3542('0x3b')]=_[_0x3542('0x38')](_0x40c19c[_0x3542('0x34')],qs['fields'](_0x55c2a7[_0x3542('0x39')]['fields']));_0x2c6f2b[_0x3542('0x3b')]=_0x2c6f2b[_0x3542('0x3b')][_0x3542('0x3c')]?_0x2c6f2b['attributes']:_0x40c19c[_0x3542('0x34')];_0x2c6f2b['order']=qs[_0x3542('0x3f')](_0x55c2a7['query']['sort']);_0x2c6f2b[_0x3542('0x40')]=qs[_0x3542('0x37')](_['pick'](_0x55c2a7[_0x3542('0x39')],_0x40c19c['filters']));if(_0x55c2a7[_0x3542('0x39')]['filter']){_0x2c6f2b[_0x3542('0x40')]=_[_0x3542('0x44')](_0x2c6f2b[_0x3542('0x40')],{'$or':_[_0x3542('0x35')](_0x2c6f2b[_0x3542('0x3b')],function(_0x4accdb){var _0x40ad35={};_0x40ad35[_0x4accdb]={'$like':'%'+_0x55c2a7[_0x3542('0x39')][_0x3542('0x7a')]+'%'};return _0x40ad35;})});}_0x2c6f2b=_['merge']({},_0x2c6f2b,_0x55c2a7[_0x3542('0x45')]);return _0x593bf1[_0x3542('0x7b')](_0x2c6f2b);}})[_0x3542('0x27')](function(_0x32a91e){if(_0x32a91e){_0x468804=_0x32a91e[_0x3542('0x3c')];if(!_0x55c2a7[_0x3542('0x39')][_0x3542('0x3d')]('nolimit')){_0x2c6f2b[_0x3542('0x21')]=qs[_0x3542('0x21')](_0x55c2a7['query']['limit']);_0x2c6f2b['offset']=qs[_0x3542('0x20')](_0x55c2a7[_0x3542('0x39')][_0x3542('0x20')]);}return _0x593bf1[_0x3542('0x7b')](_0x2c6f2b);}})[_0x3542('0x27')](function(_0x47a913){if(_0x47a913){return _0x47a913?{'count':_0x468804,'rows':_0x47a913}:null;}})['then'](respondWithResult(_0x3c47c1,null))[_0x3542('0x49')](handleError(_0x3c47c1,null));};exports['getTeams']=function(_0x41157c,_0x446817,_0x1d275b){var _0x7c8e51={};var _0x5912ef={};var _0x4737ee;var _0x40fa0d;return db[_0x3542('0x32')][_0x3542('0x78')]({'where':{'id':_0x41157c[_0x3542('0x4b')]['id']}})[_0x3542('0x27')](handleEntityNotFound(_0x446817,null))[_0x3542('0x27')](function(_0x5481e9){if(_0x5481e9){_0x4737ee=_0x5481e9;_0x5912ef['model']=_[_0x3542('0x36')](db['Team'][_0x3542('0x4c')]);_0x5912ef[_0x3542('0x39')]=_[_0x3542('0x36')](_0x41157c[_0x3542('0x39')]);_0x5912ef['filters']=_[_0x3542('0x38')](_0x5912ef[_0x3542('0x34')],_0x5912ef['query']);_0x7c8e51[_0x3542('0x3b')]=_[_0x3542('0x38')](_0x5912ef[_0x3542('0x34')],qs[_0x3542('0x3a')](_0x41157c[_0x3542('0x39')][_0x3542('0x3a')]));_0x7c8e51[_0x3542('0x3b')]=_0x7c8e51['attributes']['length']?_0x7c8e51[_0x3542('0x3b')]:_0x5912ef['model'];_0x7c8e51['order']=qs['sort'](_0x41157c[_0x3542('0x39')][_0x3542('0x3f')]);_0x7c8e51['where']=qs[_0x3542('0x37')](_[_0x3542('0x41')](_0x41157c[_0x3542('0x39')],_0x5912ef[_0x3542('0x37')]));if(_0x41157c[_0x3542('0x39')]['filter']){_0x7c8e51[_0x3542('0x40')]=_['merge'](_0x7c8e51[_0x3542('0x40')],{'$or':_['map'](_0x7c8e51[_0x3542('0x3b')],function(_0x32b2d1){var _0x4ad1e2={};_0x4ad1e2[_0x32b2d1]={'$like':'%'+_0x41157c['query'][_0x3542('0x7a')]+'%'};return _0x4ad1e2;})});}_0x7c8e51=_['merge']({},_0x7c8e51,_0x41157c[_0x3542('0x45')]);return _0x4737ee[_0x3542('0x7c')](_0x7c8e51);}})[_0x3542('0x27')](function(_0x2f86ef){if(_0x2f86ef){_0x40fa0d=_0x2f86ef['length'];if(!_0x41157c[_0x3542('0x39')]['hasOwnProperty'](_0x3542('0x3e'))){_0x7c8e51[_0x3542('0x21')]=qs[_0x3542('0x21')](_0x41157c[_0x3542('0x39')][_0x3542('0x21')]);_0x7c8e51[_0x3542('0x20')]=qs[_0x3542('0x20')](_0x41157c[_0x3542('0x39')]['offset']);}return _0x4737ee[_0x3542('0x7c')](_0x7c8e51);}})[_0x3542('0x27')](function(_0x97014){if(_0x97014){return _0x97014?{'count':_0x40fa0d,'rows':_0x97014}:null;}})[_0x3542('0x27')](respondWithResult(_0x446817,null))[_0x3542('0x49')](handleError(_0x446817,null));};exports[_0x3542('0x7d')]=function(_0x903746,_0x363be1,_0x537baf){var _0x40f0ea=_0x903746[_0x3542('0x50')][_0x3542('0x71')];var _0x43c45a;return db[_0x3542('0x7e')]['findAll']({'where':{'id':_0x40f0ea},'attributes':['id'],'include':[{'model':db[_0x3542('0x79')],'as':_0x3542('0x7f'),'attributes':['id',_0x3542('0x2f'),_0x3542('0x80'),_0x3542('0x81'),_0x3542('0x82')],'raw':!![]}]})['then'](function(_0x2dccea){if(_0x2dccea){_0x43c45a=_0x2dccea;var _0x404b41=_[_0x3542('0x83')](_0x2dccea,function(_0x3f4459){var _0x39fda0=_0x3f4459['get']({'plain':!![]});return _0x39fda0[_0x3542('0x7f')];});return db[_0x3542('0x32')][_0x3542('0x4d')]({'where':{'id':_0x903746['params']['id']}})[_0x3542('0x27')](function(_0x3517aa){return db[_0x3542('0x4f')][_0x3542('0x84')](function(_0x5be1ce){return _0x3517aa[_0x3542('0x7d')](_0x40f0ea,{'transaction':_0x5be1ce})[_0x3542('0x27')](function(){return BPromise[_0x3542('0x85')](_0x43c45a,function(_0x4e5ca6){return db['TeamVoicePrefix'][_0x3542('0x86')]({'TeamId':_0x4e5ca6['id'],'VoicePrefixId':_0x903746[_0x3542('0x4b')]['id']},{'transaction':_0x5be1ce});});})[_0x3542('0x27')](function(){return BPromise[_0x3542('0x85')](_0x404b41,function(_0xdd4842){return db[_0x3542('0x87')]['findOrCreate']({'where':{'UserId':_0xdd4842['id'],'VoicePrefixId':_0x903746[_0x3542('0x4b')]['id']},'transaction':_0x5be1ce});});})[_0x3542('0x27')](function(){_0x404b41[_0x3542('0x88')](function(_0x51d0bb){socket[_0x3542('0x73')](_0x3542('0x74'),{'UserId':_0x51d0bb['id'],'VoicePrefixId':_0x3517aa['id']});});});});});}})[_0x3542('0x27')](respondWithStatusCode(_0x363be1,null))[_0x3542('0x49')](handleError(_0x363be1,null));};exports[_0x3542('0x89')]=function(_0x1ab57e,_0x299d11,_0x1e2111){return db[_0x3542('0x7e')]['findAll']({'where':{'id':_0x1ab57e[_0x3542('0x39')][_0x3542('0x71')]},'attributes':['id'],'include':[{'model':db[_0x3542('0x79')],'as':_0x3542('0x7f'),'attributes':['id'],'raw':!![]}]})[_0x3542('0x27')](handleEntityNotFound(_0x299d11,null))['then'](function(_0x1c0bfd){var _0x2f3ad3=_[_0x3542('0x35')](_0x1c0bfd,'id');var _0x30a535=[];var _0x1fdf10=[];var _0x415044=squel[_0x3542('0x8a')]();_0x415044[_0x3542('0x8b')]('tq.TeamId')[_0x3542('0x8c')](_0x3542('0x8d'),'tq')[_0x3542('0x8e')](_0x3542('0x8f'),'ut',_0x3542('0x90'))[_0x3542('0x40')](_0x3542('0x91'),_0x1ab57e[_0x3542('0x4b')]['id']);for(var _0x5afb14=0x0;_0x5afb14<_0x1c0bfd['length'];_0x5afb14+=0x1){let _0x404cf0=_0x1c0bfd[_0x5afb14];for(var _0x1e9d45=0x0;_0x1e9d45<_0x404cf0[_0x3542('0x7f')]['length'];_0x1e9d45+=0x1){let _0x5c2675=_0x404cf0[_0x3542('0x7f')][_0x1e9d45];var _0x57859a=_0x415044[_0x3542('0x92')]();_0x57859a['where'](_0x3542('0x93'),_0x5c2675['id']);_0x1fdf10[_0x3542('0x66')](db[_0x3542('0x4f')][_0x3542('0x39')](_0x57859a[_0x3542('0x94')](),{'type':db[_0x3542('0x4f')][_0x3542('0x95')][_0x3542('0x96')]})[_0x3542('0x27')](function(_0x518344){if(_0x518344[_0x3542('0x3c')]===0x1){return _0x5c2675['id'];}else{var _0x5d9869=_['every'](_[_0x3542('0x35')](_0x518344,_0x3542('0x97')),function(_0x5927a7){return _[_0x3542('0x98')](_0x2f3ad3,_0x5927a7);});if(_0x5d9869){return _0x5c2675['id'];}}}));}}return BPromise[_0x3542('0x99')](_0x1fdf10)[_0x3542('0x27')](function(_0x2da3a5){_0x30a535=_(_0x30a535)['union'](_0x2da3a5)[_0x3542('0x9a')]()['value']();return db['VoicePrefix'][_0x3542('0x4d')]({'where':{'id':_0x1ab57e[_0x3542('0x4b')]['id']}})[_0x3542('0x27')](function(_0x51ac4a){return db[_0x3542('0x4f')]['transaction'](function(_0x32712f){return _0x51ac4a[_0x3542('0x89')](_0x1ab57e[_0x3542('0x39')][_0x3542('0x71')],{'transaction':_0x32712f})[_0x3542('0x27')](function(){if(!_[_0x3542('0x9b')](_0x30a535)){return _0x51ac4a[_0x3542('0x75')](_0x30a535,{'transaction':_0x32712f});}})[_0x3542('0x27')](function(){_0x30a535[_0x3542('0x88')](function(_0x5815b5){socket[_0x3542('0x73')](_0x3542('0x77'),{'UserId':_0x5815b5,'VoicePrefixId':_0x51ac4a['id']});});});});});});})['then'](respondWithStatusCode(_0x299d11,null))[_0x3542('0x49')](handleError(_0x299d11,null));}; \ No newline at end of file +var _0xb9be=['addAgents','emit','userVoicePrefix:save','ids','isArray','userVoicePrefix:remove','getAgents','findOne','order','Team','pick','getTeams','addTeams','Agents','online','voicePause','interface','flatMap','each','TeamVoicePrefix','UserVoicePrefix','findOrCreate','forEach','removeTeams','User','select','field','tq.TeamId','team_has_voice_prefixes','user_has_teams','ut.TeamId\x20=\x20tq.TeamId','VoicePrefixId\x20=\x20?','clone','ut.UserId\x20=\x20?','toString','SELECT','every','TeamId','union','compact','value','isEmpty','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','moment','bluebird','mustache','util','to-csv','ejs','fs-extra','squel','crypto','jsforce','desk.js','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/advancedSearch','api','../../config/utils','../../config/license/util','../../mysqldb','redis','defaults','./voicePrefix.socket','register','sendStatus','status','end','offset','undefined','limit','count','set','Content-Range','json','apply','reject','save','update','then','destroy','get','VoicePrefixes','error','name','index','map','VoicePrefix','rawAttributes','fieldName','key','model','query','keys','intersection','fields','attributes','length','hasOwnProperty','nolimit','sort','where','filters','filter','merge','type','VIRTUAL','options','includeAll','include','findAll','show','params','find','catch','create','sequelize','transaction','body','Unable\x20to\x20retrieve\x20the\x20current\x20user','role','user','userProfileId','autoAssociation','UserProfileResource','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','context','from-sip','app','system','description','Voice\x20Prefix\x20Extension','priority','appdata','NoOp','VoicePrefixId','VoiceExtension','bulkCreate','prefix','push','CDR(prefix)=','Set','PREFIX-CALLERIDALL=','callerIdAll','No\x20callerid\x20available','goto','${EXTEN:','charAt','system-'];(function(_0x503d00,_0x323df1){var _0x2263d8=function(_0x441850){while(--_0x441850){_0x503d00['push'](_0x503d00['shift']());}};_0x2263d8(++_0x323df1);}(_0xb9be,0xc5));var _0xeb9b=function(_0x32f7d7,_0x54231b){_0x32f7d7=_0x32f7d7-0x0;var _0x133d09=_0xb9be[_0x32f7d7];return _0x133d09;};'use strict';var emlformat=require(_0xeb9b('0x0'));var rimraf=require(_0xeb9b('0x1'));var zipdir=require(_0xeb9b('0x2'));var jsonpatch=require(_0xeb9b('0x3'));var rp=require(_0xeb9b('0x4'));var moment=require(_0xeb9b('0x5'));var BPromise=require(_0xeb9b('0x6'));var Mustache=require(_0xeb9b('0x7'));var util=require(_0xeb9b('0x8'));var path=require('path');var sox=require('sox');var csv=require(_0xeb9b('0x9'));var ejs=require(_0xeb9b('0xa'));var fs=require('fs');var fs_extra=require(_0xeb9b('0xb'));var _=require('lodash');var squel=require(_0xeb9b('0xc'));var crypto=require(_0xeb9b('0xd'));var jsforce=require(_0xeb9b('0xe'));var deskjs=require(_0xeb9b('0xf'));var toCsv=require(_0xeb9b('0x9'));var querystring=require(_0xeb9b('0x10'));var Papa=require(_0xeb9b('0x11'));var Redis=require(_0xeb9b('0x12'));var authService=require(_0xeb9b('0x13'));var qs=require('../../components/parsers/qs');var as=require(_0xeb9b('0x14'));var hardwareService=require('../../config/license/hardware');var logger=require('../../config/logger')(_0xeb9b('0x15'));var utils=require(_0xeb9b('0x16'));var config=require('../../config/environment');var licenseUtil=require(_0xeb9b('0x17'));var db=require(_0xeb9b('0x18'))['db'];config[_0xeb9b('0x19')]=_[_0xeb9b('0x1a')](config['redis'],{'host':'localhost','port':0x18eb});var socket=require('socket.io-emitter')(new Redis(config[_0xeb9b('0x19')]));require(_0xeb9b('0x1b'))[_0xeb9b('0x1c')](socket);function respondWithStatusCode(_0x4ec46d,_0x5926e1){_0x5926e1=_0x5926e1||0xcc;return function(_0x4f8182){if(_0x4f8182){return _0x4ec46d[_0xeb9b('0x1d')](_0x5926e1);}return _0x4ec46d[_0xeb9b('0x1e')](_0x5926e1)[_0xeb9b('0x1f')]();};}function respondWithResult(_0x3fa308,_0x2c9aa6){_0x2c9aa6=_0x2c9aa6||0xc8;return function(_0x10da6e){if(_0x10da6e){return _0x3fa308[_0xeb9b('0x1e')](_0x2c9aa6)['json'](_0x10da6e);}};}function respondWithFilteredResult(_0x2e8645,_0x36e871){return function(_0x21aca6){if(_0x21aca6){var _0x3a11e3=typeof _0x36e871[_0xeb9b('0x20')]===_0xeb9b('0x21')&&typeof _0x36e871[_0xeb9b('0x22')]===_0xeb9b('0x21');var _0x2c199f=_0x21aca6[_0xeb9b('0x23')];var _0x4f436e=_0x3a11e3?0x0:_0x36e871[_0xeb9b('0x20')];var _0x5a7ffd=_0x3a11e3?_0x21aca6['count']:_0x36e871[_0xeb9b('0x20')]+_0x36e871[_0xeb9b('0x22')];var _0x4ab4b8;if(_0x5a7ffd>=_0x2c199f){_0x5a7ffd=_0x2c199f;_0x4ab4b8=0xc8;}else{_0x4ab4b8=0xce;}_0x2e8645[_0xeb9b('0x1e')](_0x4ab4b8);return _0x2e8645[_0xeb9b('0x24')](_0xeb9b('0x25'),_0x4f436e+'-'+_0x5a7ffd+'/'+_0x2c199f)[_0xeb9b('0x26')](_0x21aca6);}return null;};}function patchUpdates(_0x3c8be7){return function(_0x43dab8){try{jsonpatch[_0xeb9b('0x27')](_0x43dab8,_0x3c8be7,!![]);}catch(_0x15e5b8){return BPromise[_0xeb9b('0x28')](_0x15e5b8);}return _0x43dab8[_0xeb9b('0x29')]();};}function saveUpdates(_0x61c86d,_0x296f95){return function(_0x1a4faf){if(_0x1a4faf){return _0x1a4faf[_0xeb9b('0x2a')](_0x61c86d)[_0xeb9b('0x2b')](function(_0x434461){return _0x434461;});}return null;};}function removeEntity(_0x4c997e,_0xd57390){return function(_0x4ed960){if(_0x4ed960){return _0x4ed960[_0xeb9b('0x2c')]()['then'](function(){var _0x347ec1=_0x4ed960[_0xeb9b('0x2d')]({'plain':!![]});var _0x7e0134=_0xeb9b('0x2e');return db['UserProfileResource'][_0xeb9b('0x2c')]({'where':{'type':_0x7e0134,'resourceId':_0x347ec1['id']}})[_0xeb9b('0x2b')](function(){return _0x4ed960;});})['then'](function(){_0x4c997e[_0xeb9b('0x1e')](0xcc)[_0xeb9b('0x1f')]();});}};}function handleEntityNotFound(_0x5ce745,_0x2a4b51){return function(_0x2ea20f){if(!_0x2ea20f){_0x5ce745[_0xeb9b('0x1d')](0x194);}return _0x2ea20f;};}function handleError(_0x48c5f4,_0x309bad){_0x309bad=_0x309bad||0x1f4;return function(_0x5336f2){logger[_0xeb9b('0x2f')](_0x5336f2['stack']);if(_0x5336f2[_0xeb9b('0x30')]){delete _0x5336f2['name'];}_0x48c5f4[_0xeb9b('0x1e')](_0x309bad)['send'](_0x5336f2);};}exports[_0xeb9b('0x31')]=function(_0x4c8e4c,_0x25b8da){var _0x370dbe={},_0x20e577={},_0x2e6034={'count':0x0,'rows':[]};var _0x112129=_[_0xeb9b('0x32')](db[_0xeb9b('0x33')][_0xeb9b('0x34')],function(_0x41e6c4){return{'name':_0x41e6c4[_0xeb9b('0x35')],'type':_0x41e6c4['type'][_0xeb9b('0x36')]};});_0x20e577[_0xeb9b('0x37')]=_[_0xeb9b('0x32')](_0x112129,_0xeb9b('0x30'));_0x20e577[_0xeb9b('0x38')]=_[_0xeb9b('0x39')](_0x4c8e4c[_0xeb9b('0x38')]);_0x20e577['filters']=_[_0xeb9b('0x3a')](_0x20e577[_0xeb9b('0x37')],_0x20e577[_0xeb9b('0x38')]);_0x370dbe['attributes']=_[_0xeb9b('0x3a')](_0x20e577[_0xeb9b('0x37')],qs[_0xeb9b('0x3b')](_0x4c8e4c[_0xeb9b('0x38')][_0xeb9b('0x3b')]));_0x370dbe[_0xeb9b('0x3c')]=_0x370dbe['attributes'][_0xeb9b('0x3d')]?_0x370dbe[_0xeb9b('0x3c')]:_0x20e577['model'];if(!_0x4c8e4c[_0xeb9b('0x38')][_0xeb9b('0x3e')](_0xeb9b('0x3f'))){_0x370dbe[_0xeb9b('0x22')]=qs[_0xeb9b('0x22')](_0x4c8e4c[_0xeb9b('0x38')][_0xeb9b('0x22')]);_0x370dbe['offset']=qs[_0xeb9b('0x20')](_0x4c8e4c[_0xeb9b('0x38')][_0xeb9b('0x20')]);}_0x370dbe['order']=qs['sort'](_0x4c8e4c['query'][_0xeb9b('0x40')]);_0x370dbe[_0xeb9b('0x41')]=qs[_0xeb9b('0x42')](_['pick'](_0x4c8e4c[_0xeb9b('0x38')],_0x20e577[_0xeb9b('0x42')]),_0x112129);if(_0x4c8e4c[_0xeb9b('0x38')][_0xeb9b('0x43')]){_0x370dbe[_0xeb9b('0x41')]=_[_0xeb9b('0x44')](_0x370dbe[_0xeb9b('0x41')],{'$or':_['map'](_0x112129,function(_0x5e597a){if(_0x5e597a[_0xeb9b('0x45')]!==_0xeb9b('0x46')){var _0x4ee3cd={};_0x4ee3cd[_0x5e597a['name']]={'$like':'%'+_0x4c8e4c[_0xeb9b('0x38')][_0xeb9b('0x43')]+'%'};return _0x4ee3cd;}})});}_0x370dbe=_['merge']({},_0x370dbe,_0x4c8e4c[_0xeb9b('0x47')]);var _0x535e73={'where':_0x370dbe[_0xeb9b('0x41')]};return db[_0xeb9b('0x33')][_0xeb9b('0x23')](_0x535e73)[_0xeb9b('0x2b')](function(_0xbee63e){_0x2e6034[_0xeb9b('0x23')]=_0xbee63e;if(_0x4c8e4c[_0xeb9b('0x38')][_0xeb9b('0x48')]){_0x370dbe[_0xeb9b('0x49')]=[{'all':!![]}];}return db[_0xeb9b('0x33')][_0xeb9b('0x4a')](_0x370dbe);})[_0xeb9b('0x2b')](function(_0x5e270a){_0x2e6034['rows']=_0x5e270a;return _0x2e6034;})[_0xeb9b('0x2b')](respondWithFilteredResult(_0x25b8da,_0x370dbe))['catch'](handleError(_0x25b8da,null));};exports[_0xeb9b('0x4b')]=function(_0x232731,_0x2c00ed){var _0x5eee9b={'raw':![],'where':{'id':_0x232731[_0xeb9b('0x4c')]['id']}},_0x1e2d25={};_0x1e2d25['model']=_[_0xeb9b('0x39')](db[_0xeb9b('0x33')][_0xeb9b('0x34')]);_0x1e2d25[_0xeb9b('0x38')]=_[_0xeb9b('0x39')](_0x232731[_0xeb9b('0x38')]);_0x1e2d25[_0xeb9b('0x42')]=_[_0xeb9b('0x3a')](_0x1e2d25['model'],_0x1e2d25['query']);_0x5eee9b[_0xeb9b('0x3c')]=_['intersection'](_0x1e2d25['model'],qs[_0xeb9b('0x3b')](_0x232731[_0xeb9b('0x38')][_0xeb9b('0x3b')]));_0x5eee9b[_0xeb9b('0x3c')]=_0x5eee9b[_0xeb9b('0x3c')][_0xeb9b('0x3d')]?_0x5eee9b['attributes']:_0x1e2d25['model'];if(_0x232731['query'][_0xeb9b('0x48')]){_0x5eee9b['include']=[{'all':!![]}];}_0x5eee9b=_[_0xeb9b('0x44')]({},_0x5eee9b,_0x232731[_0xeb9b('0x47')]);return db[_0xeb9b('0x33')][_0xeb9b('0x4d')](_0x5eee9b)[_0xeb9b('0x2b')](handleEntityNotFound(_0x2c00ed,null))[_0xeb9b('0x2b')](respondWithResult(_0x2c00ed,null))[_0xeb9b('0x4e')](handleError(_0x2c00ed,null));};exports[_0xeb9b('0x2c')]=function(_0x34755f,_0x28968b){return db['VoicePrefix']['find']({'where':{'id':_0x34755f[_0xeb9b('0x4c')]['id']}})[_0xeb9b('0x2b')](handleEntityNotFound(_0x28968b,null))['then'](removeEntity(_0x28968b,null))[_0xeb9b('0x4e')](handleError(_0x28968b,null));};exports['describe']=function(_0x2ceb23,_0x1f7b31){return db['VoicePrefix']['describe']()['then'](respondWithResult(_0x1f7b31,null))[_0xeb9b('0x4e')](handleError(_0x1f7b31,null));};exports[_0xeb9b('0x4f')]=function(_0x263453,_0x4fe9d0){var _0x4ded40;return db[_0xeb9b('0x50')][_0xeb9b('0x51')](function(_0x3e6e73){return db[_0xeb9b('0x33')][_0xeb9b('0x4f')](_0x263453[_0xeb9b('0x52')],{'transaction':_0x3e6e73})['then'](function(_0x20dbea){_0x4ded40=_0x20dbea[_0xeb9b('0x2d')]({'plain':!![]});return db['VoiceExtension'][_0xeb9b('0x4d')]({'where':{'id':_0x4ded40['VoiceExtensionId']},'raw':!![]})[_0xeb9b('0x2b')](function(_0x12f8d6){return createVoicePrefixExtensions(_0x4ded40,_0x12f8d6,_0x3e6e73);});});})['then'](function(){var _0x396aa9=_0x263453['user'][_0xeb9b('0x2d')]({'plain':!![]});if(!_0x396aa9)throw new Error(_0xeb9b('0x53'));if(_0x396aa9[_0xeb9b('0x54')]===_0xeb9b('0x55')){var _0x5c769e=_0x4ded40;return db['UserProfileSection'][_0xeb9b('0x4d')]({'where':{'name':_0xeb9b('0x2e'),'userProfileId':_0x396aa9[_0xeb9b('0x56')]},'raw':!![]})['then'](function(_0x3126d9){if(_0x3126d9&&_0x3126d9[_0xeb9b('0x57')]===0x0){return db[_0xeb9b('0x58')][_0xeb9b('0x4f')]({'name':_0x5c769e[_0xeb9b('0x30')],'resourceId':_0x5c769e['id'],'type':_0x3126d9[_0xeb9b('0x30')],'sectionId':_0x3126d9['id']},{})[_0xeb9b('0x2b')](function(){return _0x4ded40;});}else{return _0x4ded40;}})[_0xeb9b('0x4e')](function(_0x2f8b0f){logger[_0xeb9b('0x2f')](_0xeb9b('0x59'),_0x2f8b0f);throw _0x2f8b0f;});}return _0x4ded40;})['then'](respondWithResult(_0x4fe9d0,null))['catch'](handleError(_0x4fe9d0,null));};function Extension(_0x4b2506,_0x83d48a,_0x4cf8bf,_0x34ff5f){this[_0xeb9b('0x5a')]=_0xeb9b('0x5b');this['exten']=_0x4b2506;this[_0xeb9b('0x5c')]=_0x4cf8bf;this[_0xeb9b('0x45')]=_0xeb9b('0x5d');this[_0xeb9b('0x5e')]=_0xeb9b('0x5f');this[_0xeb9b('0x60')]=_0x83d48a;this[_0xeb9b('0x61')]=_0x34ff5f;}function createVoicePrefixExtensions(_0x295d81,_0x58a3e2,_0x5b55a6){return new BPromise(function(_0x27a445,_0x37f20c){var _0xa0146b=new Extension(formatPrefixName(_0x295d81['prefix']),0x1,_0xeb9b('0x62'),'Voice\x20Prefix');_0xa0146b[_0xeb9b('0x63')]=_0x295d81['id'];return db['VoiceExtension'][_0xeb9b('0x4f')](_0xa0146b,{'transaction':_0x5b55a6})[_0xeb9b('0x2b')](function(_0x3d223f){var _0x1b2a7a=_0x3d223f[_0xeb9b('0x2d')]({'plain':!![]});var _0x4be938=_[_0xeb9b('0x32')](addVoicePrefixExtensions(_0x295d81,_0x58a3e2),function(_0x1c7569){_0x1c7569['VoiceExtensionId']=_0x1b2a7a['id'];_0x1c7569['VoicePrefixId']=_0x295d81['id'];return _0x1c7569;});return db[_0xeb9b('0x64')][_0xeb9b('0x65')](_0x4be938,{'transaction':_0x5b55a6})['then'](function(_0xeb81b9){if(!_0xeb81b9){return _0x37f20c('Extensions\x20creation\x20failed');}else{return _0x27a445(_0xeb81b9);}})[_0xeb9b('0x4e')](function(_0x515a97){return _0x37f20c(_0x515a97);});});;});};function addVoicePrefixExtensions(_0x36376f,_0x382d3a){var _0x417221=[];var _0x1fea34=formatPrefixName(_0x36376f[_0xeb9b('0x66')]);_0x417221[_0xeb9b('0x67')](new Extension(_0x1fea34,0x2,'Set',_0xeb9b('0x68')+_0x36376f[_0xeb9b('0x30')]));if(_0x36376f['callerIdAll']){_0x417221[_0xeb9b('0x67')](new Extension(_0x1fea34,0x3,_0xeb9b('0x69'),_0xeb9b('0x6a')+_0x36376f[_0xeb9b('0x6b')]));}else{_0x417221['push'](new Extension(_0x1fea34,0x3,_0xeb9b('0x62'),_0xeb9b('0x6c')));}_0x417221['push'](new Extension(_0x1fea34,0x4,_0xeb9b('0x6d'),_0x382d3a[_0xeb9b('0x5a')]+','+_0xeb9b('0x6e')+(0x8+_0x36376f[_0xeb9b('0x30')][_0xeb9b('0x3d')])+'}'+','+0x1));return _0x417221;}function formatPrefixName(_0x48b0ec){var _0x3f9ce0='_';for(var _0x4a48f6=0x0;_0x4a48f6<_0x48b0ec[_0xeb9b('0x3d')];_0x4a48f6++){if(_0x48b0ec[_0xeb9b('0x6f')](_0x4a48f6)=='-'){_0x3f9ce0+=_0x48b0ec['charAt'](_0x4a48f6);}else{_0x3f9ce0+='['+_0x48b0ec[_0xeb9b('0x6f')](_0x4a48f6)+']';}}_0x3f9ce0+='.';return _0x3f9ce0;}exports[_0xeb9b('0x2a')]=function(_0x2fb07e,_0x25398e,_0x51de75){var _0xb0080f=_0x2fb07e[_0xeb9b('0x52')];_0xb0080f[_0xeb9b('0x66')]=_0xeb9b('0x70')+_0xb0080f[_0xeb9b('0x30')]+'-';return db[_0xeb9b('0x50')][_0xeb9b('0x51')](function(_0x3836bd){return db[_0xeb9b('0x33')][_0xeb9b('0x2a')](_0xb0080f,{'where':{'id':_0xb0080f['id']},'transaction':_0x3836bd})[_0xeb9b('0x2b')](function(){return db[_0xeb9b('0x64')][_0xeb9b('0x2c')]({'where':{'VoicePrefixId':_0xb0080f['id']},'transaction':_0x3836bd})[_0xeb9b('0x2b')](function(){return db[_0xeb9b('0x64')][_0xeb9b('0x4d')]({'where':{'id':_0xb0080f['VoiceExtensionId']},'raw':!![]})[_0xeb9b('0x2b')](function(_0x3e4ef2){return createVoicePrefixExtensions(_0xb0080f,_0x3e4ef2,_0x3836bd);});});});})[_0xeb9b('0x2b')](function(){return db['VoicePrefix']['findById'](_0xb0080f['id']);})[_0xeb9b('0x2b')](respondWithResult(_0x25398e,null))['catch'](handleError(_0x25398e,null));};exports[_0xeb9b('0x71')]=function(_0x463767,_0x279f71,_0x12a271){return db[_0xeb9b('0x33')][_0xeb9b('0x4d')]({'where':{'id':_0x463767[_0xeb9b('0x4c')]['id']}})[_0xeb9b('0x2b')](handleEntityNotFound(_0x279f71,null))[_0xeb9b('0x2b')](function(_0x46ce60){if(_0x46ce60){return _0x46ce60[_0xeb9b('0x71')](_0x463767[_0xeb9b('0x52')]['ids'],_['omit'](_0x463767[_0xeb9b('0x52')],['ids','id'])||{})['spread'](function(_0x95e1d0){for(var _0x4bdaf5=0x0;_0x4bdaf5<_0x463767['body']['ids'][_0xeb9b('0x3d')];_0x4bdaf5+=0x1){socket[_0xeb9b('0x72')](_0xeb9b('0x73'),{'UserId':Number(_0x463767[_0xeb9b('0x52')]['ids'][_0x4bdaf5]),'VoicePrefixId':Number(_0x463767[_0xeb9b('0x4c')]['id'])});}return _0x95e1d0;});}})[_0xeb9b('0x2b')](respondWithResult(_0x279f71,null))[_0xeb9b('0x4e')](handleError(_0x279f71,null));};exports['removeAgents']=function(_0x5c010d,_0x3ea644,_0x4ffa9e){return db[_0xeb9b('0x33')]['find']({'where':{'id':_0x5c010d['params']['id']}})[_0xeb9b('0x2b')](handleEntityNotFound(_0x3ea644,null))['then'](function(_0x3aca78){if(_0x3aca78){return _0x3aca78['removeAgents'](_0x5c010d['query'][_0xeb9b('0x74')])[_0xeb9b('0x2b')](function(){if(_[_0xeb9b('0x75')](_0x5c010d[_0xeb9b('0x38')]['ids'])){for(var _0x193ffc=0x0;_0x193ffc<_0x5c010d[_0xeb9b('0x38')][_0xeb9b('0x74')][_0xeb9b('0x3d')];_0x193ffc+=0x1){socket[_0xeb9b('0x72')](_0xeb9b('0x76'),{'UserId':Number(_0x5c010d['query'][_0xeb9b('0x74')][_0x193ffc]),'VoicePrefixId':Number(_0x5c010d['params']['id'])});}}else{socket[_0xeb9b('0x72')](_0xeb9b('0x76'),{'UserId':Number(_0x5c010d['query'][_0xeb9b('0x74')]),'VoicePrefixId':Number(_0x5c010d['params']['id'])});}});}})[_0xeb9b('0x2b')](respondWithStatusCode(_0x3ea644,null))['catch'](handleError(_0x3ea644,null));};exports[_0xeb9b('0x77')]=function(_0x36af5a,_0x41af31,_0x14db1d){var _0x31b0c5={};var _0x24bac5={};var _0x462fa2;var _0x5bf4a4;return db[_0xeb9b('0x33')][_0xeb9b('0x78')]({'where':{'id':_0x36af5a['params']['id']}})[_0xeb9b('0x2b')](handleEntityNotFound(_0x41af31,null))[_0xeb9b('0x2b')](function(_0x16f500){if(_0x16f500){_0x462fa2=_0x16f500;_0x24bac5['model']=_['keys'](db['User'][_0xeb9b('0x34')]);_0x24bac5[_0xeb9b('0x38')]=_['keys'](_0x36af5a[_0xeb9b('0x38')]);_0x24bac5[_0xeb9b('0x42')]=_[_0xeb9b('0x3a')](_0x24bac5[_0xeb9b('0x37')],_0x24bac5[_0xeb9b('0x38')]);_0x31b0c5[_0xeb9b('0x3c')]=_['intersection'](_0x24bac5[_0xeb9b('0x37')],qs[_0xeb9b('0x3b')](_0x36af5a[_0xeb9b('0x38')][_0xeb9b('0x3b')]));_0x31b0c5[_0xeb9b('0x3c')]=_0x31b0c5[_0xeb9b('0x3c')][_0xeb9b('0x3d')]?_0x31b0c5[_0xeb9b('0x3c')]:_0x24bac5[_0xeb9b('0x37')];_0x31b0c5[_0xeb9b('0x79')]=qs[_0xeb9b('0x40')](_0x36af5a['query'][_0xeb9b('0x40')]);_0x31b0c5[_0xeb9b('0x41')]=qs['filters'](_['pick'](_0x36af5a[_0xeb9b('0x38')],_0x24bac5[_0xeb9b('0x42')]));if(_0x36af5a['query'][_0xeb9b('0x43')]){_0x31b0c5[_0xeb9b('0x41')]=_[_0xeb9b('0x44')](_0x31b0c5[_0xeb9b('0x41')],{'$or':_[_0xeb9b('0x32')](_0x31b0c5[_0xeb9b('0x3c')],function(_0x3cb938){var _0x44562a={};_0x44562a[_0x3cb938]={'$like':'%'+_0x36af5a[_0xeb9b('0x38')]['filter']+'%'};return _0x44562a;})});}_0x31b0c5=_[_0xeb9b('0x44')]({},_0x31b0c5,_0x36af5a[_0xeb9b('0x47')]);return _0x462fa2[_0xeb9b('0x77')](_0x31b0c5);}})[_0xeb9b('0x2b')](function(_0x4d894e){if(_0x4d894e){_0x5bf4a4=_0x4d894e[_0xeb9b('0x3d')];if(!_0x36af5a['query']['hasOwnProperty'](_0xeb9b('0x3f'))){_0x31b0c5[_0xeb9b('0x22')]=qs[_0xeb9b('0x22')](_0x36af5a[_0xeb9b('0x38')][_0xeb9b('0x22')]);_0x31b0c5['offset']=qs[_0xeb9b('0x20')](_0x36af5a['query'][_0xeb9b('0x20')]);}return _0x462fa2[_0xeb9b('0x77')](_0x31b0c5);}})[_0xeb9b('0x2b')](function(_0x51628d){if(_0x51628d){return _0x51628d?{'count':_0x5bf4a4,'rows':_0x51628d}:null;}})[_0xeb9b('0x2b')](respondWithResult(_0x41af31,null))['catch'](handleError(_0x41af31,null));};exports['getTeams']=function(_0x3f9806,_0x3332ba,_0x25e684){var _0x841fc6={};var _0x175afe={};var _0x57a99e;var _0x2ee62d;return db[_0xeb9b('0x33')]['findOne']({'where':{'id':_0x3f9806[_0xeb9b('0x4c')]['id']}})[_0xeb9b('0x2b')](handleEntityNotFound(_0x3332ba,null))[_0xeb9b('0x2b')](function(_0x4c303d){if(_0x4c303d){_0x57a99e=_0x4c303d;_0x175afe[_0xeb9b('0x37')]=_[_0xeb9b('0x39')](db[_0xeb9b('0x7a')][_0xeb9b('0x34')]);_0x175afe[_0xeb9b('0x38')]=_[_0xeb9b('0x39')](_0x3f9806['query']);_0x175afe[_0xeb9b('0x42')]=_[_0xeb9b('0x3a')](_0x175afe[_0xeb9b('0x37')],_0x175afe[_0xeb9b('0x38')]);_0x841fc6[_0xeb9b('0x3c')]=_[_0xeb9b('0x3a')](_0x175afe[_0xeb9b('0x37')],qs[_0xeb9b('0x3b')](_0x3f9806[_0xeb9b('0x38')][_0xeb9b('0x3b')]));_0x841fc6[_0xeb9b('0x3c')]=_0x841fc6['attributes'][_0xeb9b('0x3d')]?_0x841fc6[_0xeb9b('0x3c')]:_0x175afe[_0xeb9b('0x37')];_0x841fc6[_0xeb9b('0x79')]=qs['sort'](_0x3f9806['query'][_0xeb9b('0x40')]);_0x841fc6[_0xeb9b('0x41')]=qs[_0xeb9b('0x42')](_[_0xeb9b('0x7b')](_0x3f9806[_0xeb9b('0x38')],_0x175afe[_0xeb9b('0x42')]));if(_0x3f9806[_0xeb9b('0x38')][_0xeb9b('0x43')]){_0x841fc6[_0xeb9b('0x41')]=_[_0xeb9b('0x44')](_0x841fc6[_0xeb9b('0x41')],{'$or':_[_0xeb9b('0x32')](_0x841fc6[_0xeb9b('0x3c')],function(_0x5b456a){var _0x13db61={};_0x13db61[_0x5b456a]={'$like':'%'+_0x3f9806[_0xeb9b('0x38')]['filter']+'%'};return _0x13db61;})});}_0x841fc6=_[_0xeb9b('0x44')]({},_0x841fc6,_0x3f9806[_0xeb9b('0x47')]);return _0x57a99e[_0xeb9b('0x7c')](_0x841fc6);}})['then'](function(_0x5c0da1){if(_0x5c0da1){_0x2ee62d=_0x5c0da1[_0xeb9b('0x3d')];if(!_0x3f9806['query'][_0xeb9b('0x3e')](_0xeb9b('0x3f'))){_0x841fc6[_0xeb9b('0x22')]=qs[_0xeb9b('0x22')](_0x3f9806[_0xeb9b('0x38')][_0xeb9b('0x22')]);_0x841fc6[_0xeb9b('0x20')]=qs[_0xeb9b('0x20')](_0x3f9806['query'][_0xeb9b('0x20')]);}return _0x57a99e[_0xeb9b('0x7c')](_0x841fc6);}})[_0xeb9b('0x2b')](function(_0x5e7146){if(_0x5e7146){return _0x5e7146?{'count':_0x2ee62d,'rows':_0x5e7146}:null;}})[_0xeb9b('0x2b')](respondWithResult(_0x3332ba,null))['catch'](handleError(_0x3332ba,null));};exports[_0xeb9b('0x7d')]=function(_0x26d380,_0x3d3b2c,_0x50dae3){var _0x461392=_0x26d380[_0xeb9b('0x52')]['ids'];var _0x33adad;return db[_0xeb9b('0x7a')]['findAll']({'where':{'id':_0x461392},'attributes':['id'],'include':[{'model':db['User'],'as':_0xeb9b('0x7e'),'attributes':['id',_0xeb9b('0x30'),_0xeb9b('0x7f'),_0xeb9b('0x80'),_0xeb9b('0x81')],'raw':!![]}]})[_0xeb9b('0x2b')](function(_0x1a49a7){if(_0x1a49a7){_0x33adad=_0x1a49a7;var _0x40c30f=_[_0xeb9b('0x82')](_0x1a49a7,function(_0xcda621){var _0xb409e0=_0xcda621[_0xeb9b('0x2d')]({'plain':!![]});return _0xb409e0[_0xeb9b('0x7e')];});return db['VoicePrefix'][_0xeb9b('0x4d')]({'where':{'id':_0x26d380[_0xeb9b('0x4c')]['id']}})[_0xeb9b('0x2b')](function(_0x52bd7a){return db[_0xeb9b('0x50')][_0xeb9b('0x51')](function(_0x33e5c3){return _0x52bd7a[_0xeb9b('0x7d')](_0x461392,{'transaction':_0x33e5c3})[_0xeb9b('0x2b')](function(){return BPromise[_0xeb9b('0x83')](_0x33adad,function(_0x45b94f){return db[_0xeb9b('0x84')]['upsert']({'TeamId':_0x45b94f['id'],'VoicePrefixId':_0x26d380[_0xeb9b('0x4c')]['id']},{'transaction':_0x33e5c3});});})[_0xeb9b('0x2b')](function(){return BPromise[_0xeb9b('0x83')](_0x40c30f,function(_0x193304){return db[_0xeb9b('0x85')][_0xeb9b('0x86')]({'where':{'UserId':_0x193304['id'],'VoicePrefixId':_0x26d380['params']['id']},'transaction':_0x33e5c3});});})[_0xeb9b('0x2b')](function(){_0x40c30f[_0xeb9b('0x87')](function(_0xe7dcc5){socket['emit']('userVoicePrefix:save',{'UserId':_0xe7dcc5['id'],'VoicePrefixId':_0x52bd7a['id']});});});});});}})[_0xeb9b('0x2b')](respondWithStatusCode(_0x3d3b2c,null))[_0xeb9b('0x4e')](handleError(_0x3d3b2c,null));};exports[_0xeb9b('0x88')]=function(_0x122550,_0x3e804b,_0x41659f){return db[_0xeb9b('0x7a')][_0xeb9b('0x4a')]({'where':{'id':_0x122550[_0xeb9b('0x38')][_0xeb9b('0x74')]},'attributes':['id'],'include':[{'model':db[_0xeb9b('0x89')],'as':_0xeb9b('0x7e'),'attributes':['id'],'raw':!![]}]})['then'](handleEntityNotFound(_0x3e804b,null))[_0xeb9b('0x2b')](function(_0x4b273d){var _0x16c4a5=_['map'](_0x4b273d,'id');var _0x4d39a7=[];var _0x384fba=[];var _0x23893b=squel[_0xeb9b('0x8a')]();_0x23893b[_0xeb9b('0x8b')](_0xeb9b('0x8c'))['from'](_0xeb9b('0x8d'),'tq')['join'](_0xeb9b('0x8e'),'ut',_0xeb9b('0x8f'))[_0xeb9b('0x41')](_0xeb9b('0x90'),_0x122550['params']['id']);for(var _0x1a9933=0x0;_0x1a9933<_0x4b273d[_0xeb9b('0x3d')];_0x1a9933+=0x1){let _0x2bc3b5=_0x4b273d[_0x1a9933];for(var _0x3b28ef=0x0;_0x3b28ef<_0x2bc3b5[_0xeb9b('0x7e')][_0xeb9b('0x3d')];_0x3b28ef+=0x1){let _0x427672=_0x2bc3b5['Agents'][_0x3b28ef];var _0x276e1f=_0x23893b[_0xeb9b('0x91')]();_0x276e1f[_0xeb9b('0x41')](_0xeb9b('0x92'),_0x427672['id']);_0x384fba['push'](db[_0xeb9b('0x50')][_0xeb9b('0x38')](_0x276e1f[_0xeb9b('0x93')](),{'type':db[_0xeb9b('0x50')]['QueryTypes'][_0xeb9b('0x94')]})[_0xeb9b('0x2b')](function(_0x519eff){if(_0x519eff['length']===0x1){return _0x427672['id'];}else{var _0x564125=_[_0xeb9b('0x95')](_['map'](_0x519eff,_0xeb9b('0x96')),function(_0x44ba4b){return _['includes'](_0x16c4a5,_0x44ba4b);});if(_0x564125){return _0x427672['id'];}}}));}}return BPromise['all'](_0x384fba)[_0xeb9b('0x2b')](function(_0x245892){_0x4d39a7=_(_0x4d39a7)[_0xeb9b('0x97')](_0x245892)[_0xeb9b('0x98')]()[_0xeb9b('0x99')]();return db[_0xeb9b('0x33')][_0xeb9b('0x4d')]({'where':{'id':_0x122550[_0xeb9b('0x4c')]['id']}})[_0xeb9b('0x2b')](function(_0x4d5919){return db[_0xeb9b('0x50')][_0xeb9b('0x51')](function(_0x5d3fdf){return _0x4d5919[_0xeb9b('0x88')](_0x122550['query'][_0xeb9b('0x74')],{'transaction':_0x5d3fdf})[_0xeb9b('0x2b')](function(){if(!_[_0xeb9b('0x9a')](_0x4d39a7)){return _0x4d5919['removeAgents'](_0x4d39a7,{'transaction':_0x5d3fdf});}})['then'](function(){_0x4d39a7['forEach'](function(_0x8680da){socket[_0xeb9b('0x72')]('userVoicePrefix:remove',{'UserId':_0x8680da,'VoicePrefixId':_0x4d5919['id']});});});});});});})[_0xeb9b('0x2b')](respondWithStatusCode(_0x3e804b,null))[_0xeb9b('0x4e')](handleError(_0x3e804b,null));}; \ No newline at end of file diff --git a/server/api/voicePrefix/voicePrefix.events.js b/server/api/voicePrefix/voicePrefix.events.js index 97947ee..257f16b 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 _0x245b=['../../mysqldb','save','update','emit','hasOwnProperty','hook','exports','events'];(function(_0x1da04e,_0x31024b){var _0xdd8c41=function(_0x2036f9){while(--_0x2036f9){_0x1da04e['push'](_0x1da04e['shift']());}};_0xdd8c41(++_0x31024b);}(_0x245b,0x137));var _0xb245=function(_0x5ea928,_0x38d0f1){_0x5ea928=_0x5ea928-0x0;var _0x8c993f=_0x245b[_0x5ea928];return _0x8c993f;};'use strict';var EventEmitter=require(_0xb245('0x0'));var VoicePrefix=require(_0xb245('0x1'))['db']['VoicePrefix'];var VoicePrefixEvents=new EventEmitter();VoicePrefixEvents['setMaxListeners'](0x0);var events={'afterCreate':_0xb245('0x2'),'afterUpdate':_0xb245('0x3'),'afterDestroy':'remove'};function emitEvent(_0x9b553){return function(_0x12134a,_0x1b410d,_0x26c5da){VoicePrefixEvents[_0xb245('0x4')](_0x9b553+':'+_0x12134a['id'],_0x12134a);VoicePrefixEvents[_0xb245('0x4')](_0x9b553,_0x12134a);_0x26c5da(null);};}for(var e in events){if(events[_0xb245('0x5')](e)){var event=events[e];VoicePrefix[_0xb245('0x6')](e,emitEvent(event));}}module[_0xb245('0x7')]=VoicePrefixEvents; \ No newline at end of file +var _0xdad6=['hasOwnProperty','hook','exports','events','VoicePrefix','save','update','remove','emit'];(function(_0x2532ae,_0x8318d6){var _0x2ab761=function(_0x35a169){while(--_0x35a169){_0x2532ae['push'](_0x2532ae['shift']());}};_0x2ab761(++_0x8318d6);}(_0xdad6,0x1aa));var _0x6dad=function(_0x577c5c,_0x4d585f){_0x577c5c=_0x577c5c-0x0;var _0x492376=_0xdad6[_0x577c5c];return _0x492376;};'use strict';var EventEmitter=require(_0x6dad('0x0'));var VoicePrefix=require('../../mysqldb')['db'][_0x6dad('0x1')];var VoicePrefixEvents=new EventEmitter();VoicePrefixEvents['setMaxListeners'](0x0);var events={'afterCreate':_0x6dad('0x2'),'afterUpdate':_0x6dad('0x3'),'afterDestroy':_0x6dad('0x4')};function emitEvent(_0x583e6a){return function(_0x332595,_0x336c07,_0x5c22ae){VoicePrefixEvents[_0x6dad('0x5')](_0x583e6a+':'+_0x332595['id'],_0x332595);VoicePrefixEvents[_0x6dad('0x5')](_0x583e6a,_0x332595);_0x5c22ae(null);};}for(var e in events){if(events[_0x6dad('0x6')](e)){var event=events[e];VoicePrefix[_0x6dad('0x7')](e,emitEvent(event));}}module[_0x6dad('0x8')]=VoicePrefixEvents; \ No newline at end of file diff --git a/server/api/voicePrefix/voicePrefix.model.js b/server/api/voicePrefix/voicePrefix.model.js index ab54ea1..570335b 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 _0x655a=['exports','define','VoicePrefix','voice_prefixes','lodash','util','api','request-promise','../../config/environment'];(function(_0x298f3d,_0x14114f){var _0x862e10=function(_0x55d82f){while(--_0x55d82f){_0x298f3d['push'](_0x298f3d['shift']());}};_0x862e10(++_0x14114f);}(_0x655a,0x1d8));var _0xa655=function(_0x1ab78a,_0x190807){_0x1ab78a=_0x1ab78a-0x0;var _0x18c15d=_0x655a[_0x1ab78a];return _0x18c15d;};'use strict';var _=require(_0xa655('0x0'));var util=require(_0xa655('0x1'));var logger=require('../../config/logger')(_0xa655('0x2'));var moment=require('moment');var BPromise=require('bluebird');var rp=require(_0xa655('0x3'));var fs=require('fs');var path=require('path');var rimraf=require('rimraf');var config=require(_0xa655('0x4'));var attributes=require('./voicePrefix.attributes');module[_0xa655('0x5')]=function(_0x3a3f8f,_0x169106){return _0x3a3f8f[_0xa655('0x6')](_0xa655('0x7'),attributes,{'tableName':_0xa655('0x8'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x4d23=['exports','VoicePrefix','voice_prefixes','lodash','util','api','bluebird','path','rimraf','./voicePrefix.attributes'];(function(_0x1e418e,_0x3dcbbd){var _0xf466de=function(_0x198bfd){while(--_0x198bfd){_0x1e418e['push'](_0x1e418e['shift']());}};_0xf466de(++_0x3dcbbd);}(_0x4d23,0x19d));var _0x34d2=function(_0x1ae44e,_0x40bb1b){_0x1ae44e=_0x1ae44e-0x0;var _0x1d869f=_0x4d23[_0x1ae44e];return _0x1d869f;};'use strict';var _=require(_0x34d2('0x0'));var util=require(_0x34d2('0x1'));var logger=require('../../config/logger')(_0x34d2('0x2'));var moment=require('moment');var BPromise=require(_0x34d2('0x3'));var rp=require('request-promise');var fs=require('fs');var path=require(_0x34d2('0x4'));var rimraf=require(_0x34d2('0x5'));var config=require('../../config/environment');var attributes=require(_0x34d2('0x6'));module[_0x34d2('0x7')]=function(_0x321cb5,_0x156918){return _0x321cb5['define'](_0x34d2('0x8'),attributes,{'tableName':_0x34d2('0x9'),'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 3cecc49..23a378c 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 _0x9ade=['result','catch','lodash','util','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','jayson/promise','redis','defaults','localhost','socket.io-emitter','./voicePrefix.socket','register','request','info','VoicePrefix,\x20%s,\x20%s','debug','stringify','error','code','message','request\x20sent'];(function(_0x3ed077,_0x4c0723){var _0x893393=function(_0x46c5ce){while(--_0x46c5ce){_0x3ed077['push'](_0x3ed077['shift']());}};_0x893393(++_0x4c0723);}(_0x9ade,0x8e));var _0xe9ad=function(_0x433650,_0x2780ed){_0x433650=_0x433650-0x0;var _0x13ce1d=_0x9ade[_0x433650];return _0x13ce1d;};'use strict';var _=require(_0xe9ad('0x0'));var util=require(_0xe9ad('0x1'));var moment=require(_0xe9ad('0x2'));var BPromise=require(_0xe9ad('0x3'));var rs=require(_0xe9ad('0x4'));var fs=require('fs');var Redis=require(_0xe9ad('0x5'));var db=require(_0xe9ad('0x6'))['db'];var utils=require(_0xe9ad('0x7'));var logger=require(_0xe9ad('0x8'))(_0xe9ad('0x9'));var config=require('../../config/environment');var jayson=require(_0xe9ad('0xa'));var client=jayson['client']['http']({'port':0x232a});config[_0xe9ad('0xb')]=_[_0xe9ad('0xc')](config[_0xe9ad('0xb')],{'host':_0xe9ad('0xd'),'port':0x18eb});var socket=require(_0xe9ad('0xe'))(new Redis(config[_0xe9ad('0xb')]));require(_0xe9ad('0xf'))[_0xe9ad('0x10')](socket);function respondWithRpcPromise(_0x3a8a47,_0x2fb264,_0x2aabf3){return new BPromise(function(_0x5c3981,_0x153f7e){return client[_0xe9ad('0x11')](_0x3a8a47,_0x2aabf3)['then'](function(_0x418e9d){logger[_0xe9ad('0x12')](_0xe9ad('0x13'),_0x2fb264,'request\x20sent');logger[_0xe9ad('0x14')]('VoicePrefix,\x20%s,\x20%s,\x20%s',_0x2fb264,'request\x20sent',JSON[_0xe9ad('0x15')](_0x418e9d));if(_0x418e9d[_0xe9ad('0x16')]){if(_0x418e9d[_0xe9ad('0x16')][_0xe9ad('0x17')]===0x1f4){logger[_0xe9ad('0x16')](_0xe9ad('0x13'),_0x2fb264,_0x418e9d[_0xe9ad('0x16')][_0xe9ad('0x18')]);return _0x153f7e(_0x418e9d['error'][_0xe9ad('0x18')]);}logger[_0xe9ad('0x16')](_0xe9ad('0x13'),_0x2fb264,_0x418e9d[_0xe9ad('0x16')][_0xe9ad('0x18')]);return _0x5c3981(_0x418e9d[_0xe9ad('0x16')]['message']);}else{logger[_0xe9ad('0x12')](_0xe9ad('0x13'),_0x2fb264,_0xe9ad('0x19'));_0x5c3981(_0x418e9d[_0xe9ad('0x1a')][_0xe9ad('0x18')]);}})[_0xe9ad('0x1b')](function(_0x25ccc4){logger[_0xe9ad('0x16')](_0xe9ad('0x13'),_0x2fb264,_0x25ccc4);_0x153f7e(_0x25ccc4);});});} \ No newline at end of file +var _0x5f71=['catch','lodash','moment','randomstring','../../config/logger','rpc','jayson/promise','client','http','redis','defaults','localhost','socket.io-emitter','./voicePrefix.socket','register','then','info','VoicePrefix,\x20%s,\x20%s','request\x20sent','debug','VoicePrefix,\x20%s,\x20%s,\x20%s','stringify','error','message','result'];(function(_0x480052,_0x3c1579){var _0x31cd8b=function(_0x2e46c4){while(--_0x2e46c4){_0x480052['push'](_0x480052['shift']());}};_0x31cd8b(++_0x3c1579);}(_0x5f71,0xc9));var _0x15f7=function(_0x49db2c,_0x3edcf2){_0x49db2c=_0x49db2c-0x0;var _0xdb9ba=_0x5f71[_0x49db2c];return _0xdb9ba;};'use strict';var _=require(_0x15f7('0x0'));var util=require('util');var moment=require(_0x15f7('0x1'));var BPromise=require('bluebird');var rs=require(_0x15f7('0x2'));var fs=require('fs');var Redis=require('ioredis');var db=require('../../mysqldb')['db'];var utils=require('../../config/utils');var logger=require(_0x15f7('0x3'))(_0x15f7('0x4'));var config=require('../../config/environment');var jayson=require(_0x15f7('0x5'));var client=jayson[_0x15f7('0x6')][_0x15f7('0x7')]({'port':0x232a});config[_0x15f7('0x8')]=_[_0x15f7('0x9')](config[_0x15f7('0x8')],{'host':_0x15f7('0xa'),'port':0x18eb});var socket=require(_0x15f7('0xb'))(new Redis(config[_0x15f7('0x8')]));require(_0x15f7('0xc'))[_0x15f7('0xd')](socket);function respondWithRpcPromise(_0x40dbfa,_0x4b53ab,_0x4f09e7){return new BPromise(function(_0x4fddfc,_0x121607){return client['request'](_0x40dbfa,_0x4f09e7)[_0x15f7('0xe')](function(_0x9cbf6){logger[_0x15f7('0xf')](_0x15f7('0x10'),_0x4b53ab,_0x15f7('0x11'));logger[_0x15f7('0x12')](_0x15f7('0x13'),_0x4b53ab,'request\x20sent',JSON[_0x15f7('0x14')](_0x9cbf6));if(_0x9cbf6[_0x15f7('0x15')]){if(_0x9cbf6[_0x15f7('0x15')]['code']===0x1f4){logger[_0x15f7('0x15')](_0x15f7('0x10'),_0x4b53ab,_0x9cbf6['error'][_0x15f7('0x16')]);return _0x121607(_0x9cbf6[_0x15f7('0x15')][_0x15f7('0x16')]);}logger[_0x15f7('0x15')](_0x15f7('0x10'),_0x4b53ab,_0x9cbf6[_0x15f7('0x15')][_0x15f7('0x16')]);return _0x4fddfc(_0x9cbf6['error'][_0x15f7('0x16')]);}else{logger[_0x15f7('0xf')]('VoicePrefix,\x20%s,\x20%s',_0x4b53ab,_0x15f7('0x11'));_0x4fddfc(_0x9cbf6[_0x15f7('0x17')][_0x15f7('0x16')]);}})[_0x15f7('0x18')](function(_0x26627b){logger[_0x15f7('0x15')](_0x15f7('0x10'),_0x4b53ab,_0x26627b);_0x121607(_0x26627b);});});} \ No newline at end of file diff --git a/server/api/voicePrefix/voicePrefix.socket.js b/server/api/voicePrefix/voicePrefix.socket.js index 5ed5c30..9cb5b26 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 _0xc112=['removeListener','register','length','voicePrefix:','./voicePrefix.events','save','remove','emit'];(function(_0x128a58,_0x1b70f4){var _0x45605f=function(_0x4efbe8){while(--_0x4efbe8){_0x128a58['push'](_0x128a58['shift']());}};_0x45605f(++_0x1b70f4);}(_0xc112,0xec));var _0x2c11=function(_0x15c8e1,_0x3f3cf1){_0x15c8e1=_0x15c8e1-0x0;var _0x289092=_0xc112[_0x15c8e1];return _0x289092;};'use strict';var VoicePrefixEvents=require(_0x2c11('0x0'));var events=[_0x2c11('0x1'),_0x2c11('0x2'),'update'];function createListener(_0x8542d8,_0x40da2e){return function(_0x26e2a3){_0x40da2e[_0x2c11('0x3')](_0x8542d8,_0x26e2a3);};}function removeListener(_0xaa8492,_0x3a1cda){return function(){VoicePrefixEvents[_0x2c11('0x4')](_0xaa8492,_0x3a1cda);};}exports[_0x2c11('0x5')]=function(_0x2337d0){for(var _0x5c4748=0x0,_0x5c2399=events[_0x2c11('0x6')];_0x5c4748<_0x5c2399;_0x5c4748++){var _0x1fada4=events[_0x5c4748];var _0x29dfcf=createListener(_0x2c11('0x7')+_0x1fada4,_0x2337d0);VoicePrefixEvents['on'](_0x1fada4,_0x29dfcf);}}; \ No newline at end of file +var _0x9063=['register','voicePrefix:','./voicePrefix.events','save','remove','update','emit','removeListener'];(function(_0x802708,_0x3e3405){var _0x307919=function(_0x3b5197){while(--_0x3b5197){_0x802708['push'](_0x802708['shift']());}};_0x307919(++_0x3e3405);}(_0x9063,0x1a2));var _0x3906=function(_0x139a3c,_0x4fc883){_0x139a3c=_0x139a3c-0x0;var _0x2b375b=_0x9063[_0x139a3c];return _0x2b375b;};'use strict';var VoicePrefixEvents=require(_0x3906('0x0'));var events=[_0x3906('0x1'),_0x3906('0x2'),_0x3906('0x3')];function createListener(_0x1937cc,_0x203f56){return function(_0x30ced4){_0x203f56[_0x3906('0x4')](_0x1937cc,_0x30ced4);};}function removeListener(_0x5ed74f,_0x3583bd){return function(){VoicePrefixEvents[_0x3906('0x5')](_0x5ed74f,_0x3583bd);};}exports[_0x3906('0x6')]=function(_0x17c286){for(var _0x79d5ae=0x0,_0x522b71=events['length'];_0x79d5ae<_0x522b71;_0x79d5ae++){var _0x4a8864=events[_0x79d5ae];var _0x331b42=createListener(_0x3906('0x7')+_0x4a8864,_0x17c286);VoicePrefixEvents['on'](_0x4a8864,_0x331b42);}}; \ No newline at end of file diff --git a/server/api/voiceQueue/index.js b/server/api/voiceQueue/index.js index d8ef132..e635654 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(_0x2abafc,_0x588cd7){var _0x1d35f2=function(_0xcb930a){while(--_0xcb930a){_0x2abafc['push'](_0x2abafc['shift']());}};_0x1d35f2(++_0x588cd7);}(_0xa9e0,0x123));var _0x0a9e=function(_0xea8947,_0x1b573d){_0xea8947=_0xea8947-0x0;var _0x2455e9=_0xa9e0[_0xea8947];return _0x2455e9;};'use strict';var multer=require(_0x0a9e('0x0'));var util=require(_0x0a9e('0x1'));var path=require(_0x0a9e('0x2'));var timeout=require('connect-timeout');var express=require('express');var router=express[_0x0a9e('0x3')]();var fs_extra=require('fs-extra');var auth=require(_0x0a9e('0x4'));var interaction=require(_0x0a9e('0x5'));var config=require(_0x0a9e('0x6'));var controller=require(_0x0a9e('0x7'));router[_0x0a9e('0x8')]('/',auth['isAuthenticated'](),controller[_0x0a9e('0x9')]);router[_0x0a9e('0x8')](_0x0a9e('0xa'),auth['isAuthenticated'](),controller['show']);router[_0x0a9e('0x8')]('/:id/hoppers',auth['isAuthenticated'](),controller[_0x0a9e('0xb')]);router[_0x0a9e('0x8')](_0x0a9e('0xc'),auth[_0x0a9e('0xd')](),controller[_0x0a9e('0xe')]);router[_0x0a9e('0x8')]('/:id/hopper_finals',auth['isAuthenticated'](),controller['getHopperFinals']);router['get'](_0x0a9e('0xf'),auth[_0x0a9e('0xd')](),controller[_0x0a9e('0x10')]);router[_0x0a9e('0x8')](_0x0a9e('0x11'),auth[_0x0a9e('0xd')](),controller['getTeams']);router[_0x0a9e('0x8')](_0x0a9e('0x12'),auth[_0x0a9e('0xd')](),controller[_0x0a9e('0x13')]);router[_0x0a9e('0x8')](_0x0a9e('0x14'),auth['isAuthenticated'](),controller[_0x0a9e('0x15')]);router['get'](_0x0a9e('0x16'),auth['isAuthenticated'](),controller[_0x0a9e('0x17')]);router[_0x0a9e('0x8')]('/:id/blacklists',auth[_0x0a9e('0xd')](),controller['getBlackLists']);router[_0x0a9e('0x18')]('/',auth[_0x0a9e('0xd')](),controller[_0x0a9e('0x19')]);router[_0x0a9e('0x18')](_0x0a9e('0x1a'),auth[_0x0a9e('0xd')](),controller[_0x0a9e('0x1b')]);router[_0x0a9e('0x18')](_0x0a9e('0x11'),auth[_0x0a9e('0xd')](),controller[_0x0a9e('0x1c')]);router[_0x0a9e('0x18')]('/:id/users',auth[_0x0a9e('0xd')](),controller[_0x0a9e('0x1d')]);router['post'](_0x0a9e('0x16'),auth['isAuthenticated'](),controller['addLists']);router[_0x0a9e('0x18')](_0x0a9e('0x1e'),auth[_0x0a9e('0xd')](),controller[_0x0a9e('0x1f')]);router['put'](_0x0a9e('0xa'),auth[_0x0a9e('0xd')](),controller[_0x0a9e('0x20')]);router[_0x0a9e('0x21')](_0x0a9e('0xa'),auth[_0x0a9e('0xd')](),controller[_0x0a9e('0x22')]);router['delete']('/:id/teams',auth[_0x0a9e('0xd')](),controller[_0x0a9e('0x23')]);router[_0x0a9e('0x21')](_0x0a9e('0x12'),auth['isAuthenticated'](),controller[_0x0a9e('0x24')]);router['delete'](_0x0a9e('0x16'),auth['isAuthenticated'](),controller[_0x0a9e('0x25')]);router[_0x0a9e('0x21')](_0x0a9e('0x1e'),auth[_0x0a9e('0xd')](),controller[_0x0a9e('0x26')]);module[_0x0a9e('0x27')]=router; \ No newline at end of file +var _0xa9e0=['addAgents','/:id/blacklists','addBlackLists','update','delete','destroy','removeTeams','removeAgents','removeLists','removeBlackLists','exports','multer','util','path','Router','../../components/auth/service','../../components/interaction/service','../../config/environment','./voiceQueue.controller','get','index','/:id','getHoppers','/:id/hopper_histories','isAuthenticated','getHopperHistories','/:id/hopper_black','getHopperBlacks','/:id/teams','/:id/users','getAgents','/:id/members','getMembers','/:id/lists','getLists','post','create','/:id/clone','clone','addTeams'];(function(_0x109a2d,_0x46b62d){var _0x5dd79b=function(_0x2ad8c9){while(--_0x2ad8c9){_0x109a2d['push'](_0x109a2d['shift']());}};_0x5dd79b(++_0x46b62d);}(_0xa9e0,0x123));var _0x0a9e=function(_0x491a7f,_0x28bb80){_0x491a7f=_0x491a7f-0x0;var _0x3d8f44=_0xa9e0[_0x491a7f];return _0x3d8f44;};'use strict';var multer=require(_0x0a9e('0x0'));var util=require(_0x0a9e('0x1'));var path=require(_0x0a9e('0x2'));var timeout=require('connect-timeout');var express=require('express');var router=express[_0x0a9e('0x3')]();var fs_extra=require('fs-extra');var auth=require(_0x0a9e('0x4'));var interaction=require(_0x0a9e('0x5'));var config=require(_0x0a9e('0x6'));var controller=require(_0x0a9e('0x7'));router[_0x0a9e('0x8')]('/',auth['isAuthenticated'](),controller[_0x0a9e('0x9')]);router[_0x0a9e('0x8')](_0x0a9e('0xa'),auth['isAuthenticated'](),controller['show']);router[_0x0a9e('0x8')]('/:id/hoppers',auth['isAuthenticated'](),controller[_0x0a9e('0xb')]);router[_0x0a9e('0x8')](_0x0a9e('0xc'),auth[_0x0a9e('0xd')](),controller[_0x0a9e('0xe')]);router[_0x0a9e('0x8')]('/:id/hopper_finals',auth['isAuthenticated'](),controller['getHopperFinals']);router['get'](_0x0a9e('0xf'),auth[_0x0a9e('0xd')](),controller[_0x0a9e('0x10')]);router[_0x0a9e('0x8')](_0x0a9e('0x11'),auth[_0x0a9e('0xd')](),controller['getTeams']);router[_0x0a9e('0x8')](_0x0a9e('0x12'),auth[_0x0a9e('0xd')](),controller[_0x0a9e('0x13')]);router[_0x0a9e('0x8')](_0x0a9e('0x14'),auth['isAuthenticated'](),controller[_0x0a9e('0x15')]);router['get'](_0x0a9e('0x16'),auth['isAuthenticated'](),controller[_0x0a9e('0x17')]);router[_0x0a9e('0x8')]('/:id/blacklists',auth[_0x0a9e('0xd')](),controller['getBlackLists']);router[_0x0a9e('0x18')]('/',auth[_0x0a9e('0xd')](),controller[_0x0a9e('0x19')]);router[_0x0a9e('0x18')](_0x0a9e('0x1a'),auth[_0x0a9e('0xd')](),controller[_0x0a9e('0x1b')]);router[_0x0a9e('0x18')](_0x0a9e('0x11'),auth[_0x0a9e('0xd')](),controller[_0x0a9e('0x1c')]);router[_0x0a9e('0x18')]('/:id/users',auth[_0x0a9e('0xd')](),controller[_0x0a9e('0x1d')]);router['post'](_0x0a9e('0x16'),auth['isAuthenticated'](),controller['addLists']);router[_0x0a9e('0x18')](_0x0a9e('0x1e'),auth[_0x0a9e('0xd')](),controller[_0x0a9e('0x1f')]);router['put'](_0x0a9e('0xa'),auth[_0x0a9e('0xd')](),controller[_0x0a9e('0x20')]);router[_0x0a9e('0x21')](_0x0a9e('0xa'),auth[_0x0a9e('0xd')](),controller[_0x0a9e('0x22')]);router['delete']('/:id/teams',auth[_0x0a9e('0xd')](),controller[_0x0a9e('0x23')]);router[_0x0a9e('0x21')](_0x0a9e('0x12'),auth['isAuthenticated'](),controller[_0x0a9e('0x24')]);router['delete'](_0x0a9e('0x16'),auth['isAuthenticated'](),controller[_0x0a9e('0x25')]);router[_0x0a9e('0x21')](_0x0a9e('0x1e'),auth[_0x0a9e('0xd')](),controller[_0x0a9e('0x26')]);module[_0x0a9e('0x27')]=router; \ No newline at end of file diff --git a/server/api/voiceQueue/voiceQueue.attributes.js b/server/api/voiceQueue/voiceQueue.attributes.js index a09a636..a623971 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 _0xe223=['dialMethod','preview','booked','roundrobin','includes','INTEGER','yes','all','once','TEXT','periodic_announce','join','split','setDataValue','joinempty','leavewhenempty','BOOLEAN','wrapuptime','progressive','Dial\x20Method.','UNSIGNED','Max\x209999\x20channels,\x200\x20means\x20unlimited.','Max\x209999\x20member\x20in\x20queue(min:1,\x20max:9999),\x200\x20means\x20unlimited.','FLOAT','Power\x20Level:\x20Calls\x20for\x20agents\x20(min:1,\x20max:10).','agentBusyFactor','dropRate','Only\x20for\x20predictive\x20method.','Interval\x20Predictive\x20Minutes\x20(min:5\x20max:30)','tTxX','Queue\x20Timeout\x20Seconds\x20(min:1,\x20max:999)','AGI\x20queue\x20option\x20(use:\x20agi://127.0.0.1/square,)','#Congestion\x20Retry\x20(min:1,\x20max:999)','#Busy\x20Retry\x20(min:1,\x20max:999)','NoAnswer\x20Retry\x20Frequency\x20Minutes\x20(min:1,\x20max:99999)','07:00-22:00,*,*,*','always','never','onlyIfOpen','#AMD\x20Initial\x20Silence','#AMD\x20Greeting','#AMD\x20After\x20Greeting\x20Silence','#AMD\x20Total\x20Analysis\x20Time','#AMD\x20Min\x20Word\x20Length','#AMD\x20Between\x20Words\x20Silence','#AMD\x20Maximum\x20Number\x20Of\x20Words','#AMD\x20Silence\x20Threshold\x20(min:0,\x20max:32767)','Active/Disactive\x20Recall\x20In\x20Queue','DESC','ASC','Random\x20Last\x20Digit\x20(min:1,\x20max:15)','Cut\x20Digit\x20(min:1,\x20max:15)','#NoSuchNumber\x20Retry\x20(min:1,\x20max:999)','NoSuchNumber\x20Retry\x20Frequency\x20Minutes\x20(min:1,\x20max:99999)','#Drop\x20Retry\x20(min:1,\x20max:999)','Drop\x20Retry\x20Frequency\x20Minutes\x20(min:1,\x20max:99999)','#Abandoned\x20Retry\x20(min:1,\x20max:999)','#Machine\x20Retry\x20(min:1,\x20max:999)','Machine\x20Retry\x20Frequency\x20Minutes\x20(min:1,\x20max:99999)','AgentReject\x20Retry\x20Frequency\x20Minutes\x20(min:1,\x20max:99999)','Enabled/disables\x20mandatory\x20dispo\x20on\x20a\x20queue','mandatoryDispositionPauseId','mandatoryDisposition','exports','name','ENUM','inbound','outbound','STRING','default','ringall','fewestcalls','random','rrmemory','linear','wrandom','strategy','getDataValue','type'];(function(_0x2b62d8,_0x3004a8){var _0x37ffdb=function(_0x1675b0){while(--_0x1675b0){_0x2b62d8['push'](_0x2b62d8['shift']());}};_0x37ffdb(++_0x3004a8);}(_0xe223,0x1ca));var _0x3e22=function(_0x4e28c0,_0x1ef470){_0x4e28c0=_0x4e28c0-0x0;var _0x4039d4=_0xe223[_0x4e28c0];return _0x4039d4;};'use strict';var Sequelize=require('sequelize');module[_0x3e22('0x0')]={'name':{'type':Sequelize['STRING'],'allowNull':![],'unique':_0x3e22('0x1'),'validate':{'notEmpty':!![],'is':/^[A-Za-z0-9\.\_]+$/i}},'type':{'type':Sequelize[_0x3e22('0x2')](_0x3e22('0x3'),_0x3e22('0x4')),'allowNull':![],'defaultValue':'inbound'},'musiconhold':{'type':Sequelize[_0x3e22('0x5')],'defaultValue':_0x3e22('0x6')},'announce':{'type':Sequelize[_0x3e22('0x5')],'defaultValue':''},'strategy':{'type':Sequelize[_0x3e22('0x2')]('rr',_0x3e22('0x7'),'leastrecent',_0x3e22('0x8'),_0x3e22('0x9'),_0x3e22('0xa'),_0x3e22('0xb'),_0x3e22('0xc'),'rrordered'),'allowNull':![],'defaultValue':_0x3e22('0x7'),'set':function(_0x5b7a66){this['setDataValue'](_0x3e22('0xd'),_0x5b7a66?_0x5b7a66:'rrmemory');},'get':function(){var _0x2df623=this[_0x3e22('0xe')](_0x3e22('0xf'));var _0x182a60=this['getDataValue'](_0x3e22('0x10'));var _0x57813c=this[_0x3e22('0xe')](_0x3e22('0xd'));if(_0x2df623==='outbound'){if(_0x182a60===_0x3e22('0x11')){return null;}if(_0x182a60===_0x3e22('0x12')&&!['rrmemory',_0x3e22('0x13')][_0x3e22('0x14')](_0x57813c)){this['setDataValue'](_0x3e22('0xd'),_0x3e22('0xa'));}}return _0x57813c;}},'servicelevel':{'type':Sequelize[_0x3e22('0x15')](0xb),'defaultValue':0x0},'context':{'type':Sequelize['STRING'],'defaultValue':null},'penaltymemberslimit':{'type':Sequelize['INTEGER'](0xb)},'timeout':{'type':Sequelize['INTEGER'](0xb),'defaultValue':0xf},'retry':{'type':Sequelize['INTEGER'](0xb),'defaultValue':0x2},'timeoutpriority':{'type':Sequelize[_0x3e22('0x5')]},'weight':{'type':Sequelize[_0x3e22('0x15')](0xb),'allowNull':!![],'defaultValue':0x0},'wrapuptime':{'type':Sequelize['INTEGER'](0xb),'defaultValue':0x0},'autofill':{'type':Sequelize[_0x3e22('0x2')](_0x3e22('0x16'),'no'),'defaultValue':_0x3e22('0x16')},'autopause':{'type':Sequelize[_0x3e22('0x2')]('yes','no',_0x3e22('0x17')),'defaultValue':'no'},'autopausedelay':{'type':Sequelize[_0x3e22('0x15')](0xb)},'autopausebusy':{'type':Sequelize[_0x3e22('0x2')](_0x3e22('0x16'),'no'),'defaultValue':'no'},'autopauseunavail':{'type':Sequelize['ENUM'](_0x3e22('0x16'),'no'),'defaultValue':'no'},'maxlen':{'type':Sequelize[_0x3e22('0x15')](0xb),'defaultValue':0x0},'setinterfacevar':{'type':Sequelize[_0x3e22('0x2')](_0x3e22('0x16'),'no'),'defaultValue':'no'},'setqueueentryvar':{'type':Sequelize[_0x3e22('0x2')](_0x3e22('0x16'),'no'),'defautValue':'no'},'setqueuevar':{'type':Sequelize[_0x3e22('0x2')]('yes','no'),'defaultValue':'no'},'eventmemberstatus':{'type':Sequelize[_0x3e22('0x2')](_0x3e22('0x16'),'no'),'defaultValue':'no'},'membermacro':{'type':Sequelize[_0x3e22('0x5')],'allowNull':!![]},'membergosub':{'type':Sequelize[_0x3e22('0x5')],'allowNull':!![]},'announce_frequency':{'type':Sequelize[_0x3e22('0x15')](0xb),'defaultValue':0x0},'min_announce_frequency':{'type':Sequelize[_0x3e22('0x15')](0xb),'defaultValue':0x0},'periodic_announce_frequency':{'type':Sequelize[_0x3e22('0x15')](0xb),'defaultValue':0x0},'random_periodic_announce':{'type':Sequelize[_0x3e22('0x2')](_0x3e22('0x16'),'no'),'defaultValue':'no'},'relative_periodic_announce':{'type':Sequelize[_0x3e22('0x2')](_0x3e22('0x16'),'no'),'defaultValue':_0x3e22('0x16')},'announce_holdtime':{'type':Sequelize[_0x3e22('0x2')](_0x3e22('0x16'),'no',_0x3e22('0x18')),'defaultValue':'no'},'announce_position':{'type':Sequelize['STRING'],'defaultValue':'no'},'announce_to_first_user':{'type':Sequelize['ENUM'](_0x3e22('0x16'),'no')},'announce_position_limit':{'type':Sequelize[_0x3e22('0x15')](0xb)},'announce_round_seconds':{'type':Sequelize['ENUM']('0','5','10','15','20','30'),'defaultValue':'0'},'monitor_format':{'type':Sequelize[_0x3e22('0x5')],'defaultValue':''},'monitor_type':{'type':Sequelize[_0x3e22('0x5')]},'queue_youarenext':{'type':Sequelize[_0x3e22('0x5')],'defaultValue':null},'queue_thereare':{'type':Sequelize[_0x3e22('0x5')],'defaultValue':null},'queue_callswaiting':{'type':Sequelize[_0x3e22('0x5')],'defaultValue':null},'queue_holdtime':{'type':Sequelize[_0x3e22('0x5')],'defaultValue':null},'queue_minute':{'type':Sequelize['STRING'],'allowNull':!![],'defaultValue':null},'queue_minutes':{'type':Sequelize['STRING'],'defaultValue':null},'queue_seconds':{'type':Sequelize[_0x3e22('0x5')],'defaultValue':null},'queue_thankyou':{'type':Sequelize[_0x3e22('0x5')],'defaultValue':null},'queue_reporthold':{'type':Sequelize[_0x3e22('0x5')]},'queue_quantity1':{'type':Sequelize['STRING']},'queue_quantity2':{'type':Sequelize[_0x3e22('0x5')]},'queue_periodic_announce':{'type':Sequelize[_0x3e22('0x5')]},'queue_less_than':{'type':Sequelize[_0x3e22('0x5')]},'periodic_announce':{'type':Sequelize[_0x3e22('0x19')],'set':function(_0xb14be8){this['setDataValue'](_0x3e22('0x1a'),_0xb14be8?_0xb14be8[_0x3e22('0x1b')](','):[]);},'get':function(){return this[_0x3e22('0xe')](_0x3e22('0x1a'))?this['getDataValue']('periodic_announce')[_0x3e22('0x1c')](','):[];}},'joinempty':{'type':Sequelize['STRING'],'defaultValue':_0x3e22('0x16'),'set':function(_0x26506){this[_0x3e22('0x1d')]('joinempty',_0x26506?_0x26506[_0x3e22('0x1b')](','):undefined);},'get':function(){return this[_0x3e22('0xe')]('joinempty')?this[_0x3e22('0xe')](_0x3e22('0x1e'))[_0x3e22('0x1c')](','):undefined;}},'leavewhenempty':{'type':Sequelize['STRING'],'defaultValue':'no','set':function(_0x56d863){this[_0x3e22('0x1d')]('leavewhenempty',_0x56d863?_0x56d863[_0x3e22('0x1b')](','):undefined);},'get':function(){return this[_0x3e22('0xe')](_0x3e22('0x1f'))?this['getDataValue']('leavewhenempty')['split'](','):undefined;}},'reportholdtime':{'type':Sequelize[_0x3e22('0x2')](_0x3e22('0x16'),'no'),'defaultValue':'no'},'ringinuse':{'type':Sequelize[_0x3e22('0x2')](_0x3e22('0x16'),'no'),'defaultValue':'no'},'memberdelay':{'type':Sequelize[_0x3e22('0x15')](0xb),'defaultValue':0x0},'timeoutrestart':{'type':Sequelize[_0x3e22('0x2')]('yes','no'),'defaultValue':'no'},'defaultrule':{'type':Sequelize[_0x3e22('0x5')]},'description':{'type':Sequelize[_0x3e22('0x5')]},'acw':{'type':Sequelize[_0x3e22('0x20')],'defaultValue':0x0,'set':function(_0x1423af){this[_0x3e22('0x1d')]('acw',_0x1423af);if(_0x1423af){if(this['getDataValue'](_0x3e22('0x21'))<0x2){this[_0x3e22('0x1d')](_0x3e22('0x21'),0x2);}}}},'acwTimeout':{'type':Sequelize[_0x3e22('0x15')](0xb),'defaultValue':0xa},'dialActive':{'type':Sequelize[_0x3e22('0x20')],'defaultValue':0x0,'comment':'Active/Disactive\x20Campaign'},'dialMethod':{'type':Sequelize[_0x3e22('0x2')]('preview',_0x3e22('0x22'),'power','predictive',_0x3e22('0x12')),'defaultValue':_0x3e22('0x22'),'comment':_0x3e22('0x23')},'dialLimitChannel':{'type':Sequelize[_0x3e22('0x15')](0x4)[_0x3e22('0x24')],'defaultValue':0x0,'validate':{'min':0x0,'max':0x270f},'comment':_0x3e22('0x25')},'dialLimitQueue':{'type':Sequelize[_0x3e22('0x15')](0x4)[_0x3e22('0x24')],'defaultValue':0x0,'validate':{'min':0x0,'max':0x270f},'comment':_0x3e22('0x26')},'dialPowerLevel':{'type':Sequelize[_0x3e22('0x27')](0x2)[_0x3e22('0x24')],'defaultValue':0x1,'validate':{'min':0x1,'max':0xa},'comment':_0x3e22('0x28')},'dialPredictiveOptimization':{'type':Sequelize['ENUM'](_0x3e22('0x29'),_0x3e22('0x2a')),'defaultValue':'dropRate','comment':_0x3e22('0x2b')},'dialPredictiveOptimizationPercentage':{'type':Sequelize[_0x3e22('0x27')](0x2)[_0x3e22('0x24')],'defaultValue':0x3,'validate':{'min':0x1,'max':0x5f},'comment':'Predictive\x20Optimization\x20Percentage\x20(min:\x201,\x20max:\x2095)'},'dialPredictiveInterval':{'type':Sequelize['INTEGER'](0x3)[_0x3e22('0x24')],'defaultValue':0xa,'validate':{'min':0x5,'max':0x1e},'comment':_0x3e22('0x2c')},'dialOriginateCallerIdName':{'type':Sequelize['STRING']},'dialOriginateCallerIdNumber':{'type':Sequelize[_0x3e22('0x5')]},'dialOriginateTimeout':{'type':Sequelize[_0x3e22('0x15')](0x3)[_0x3e22('0x24')],'defaultValue':0x1e,'validate':{'min':0x1,'max':0x3e7},'comment':'Originate\x20Timeout\x20Seconds\x20(min:1,\x20max:999)'},'dialQueueOptions':{'type':Sequelize[_0x3e22('0x5')],'defaultValue':_0x3e22('0x2d'),'comment':'https://wiki.asterisk.org/wiki/display/AST/Asterisk+13+Application_Queue'},'dialQueueTimeout':{'type':Sequelize[_0x3e22('0x15')](0x3)[_0x3e22('0x24')],'defaultValue':0x3,'validate':{'min':0x1,'max':0x3e7},'comment':_0x3e22('0x2e')},'dialQueueProject':{'type':Sequelize[_0x3e22('0x5')],'comment':_0x3e22('0x2f')},'dialCongestionMaxRetry':{'type':Sequelize['INTEGER'](0x3)[_0x3e22('0x24')],'defaultValue':0x3,'validate':{'min':0x1,'max':0x3e7},'comment':_0x3e22('0x30')},'dialCongestionRetryFrequency':{'type':Sequelize[_0x3e22('0x15')](0x5)['UNSIGNED'],'validate':{'min':0x1,'max':0x1869f},'defaultValue':0x96,'comment':'Congestion\x20Retry\x20Frequency\x20Minutes\x20(min:1,\x20max:99999)'},'dialBusyMaxRetry':{'type':Sequelize[_0x3e22('0x15')](0x3)[_0x3e22('0x24')],'defaultValue':0x3,'validate':{'min':0x1,'max':0x3e7},'comment':_0x3e22('0x31')},'dialBusyRetryFrequency':{'type':Sequelize[_0x3e22('0x15')](0x5)[_0x3e22('0x24')],'validate':{'min':0x1,'max':0x1869f},'defaultValue':0x96,'comment':'Busy\x20Retry\x20Frequency\x20Minutes\x20(min:1,\x20max:99999)'},'dialNoAnswerMaxRetry':{'type':Sequelize[_0x3e22('0x15')](0x3)[_0x3e22('0x24')],'defaultValue':0x3,'comment':'#NoAnswer\x20Retry\x20(min:1,\x20max:999)'},'dialNoAnswerRetryFrequency':{'type':Sequelize['INTEGER'](0x5)['UNSIGNED'],'validate':{'min':0x1,'max':0x1869f},'defaultValue':0x96,'comment':_0x3e22('0x32')},'dialGlobalMaxRetry':{'type':Sequelize[_0x3e22('0x15')](0x3)[_0x3e22('0x24')],'validate':{'min':0x1,'max':0x3e7},'defaultValue':0x4,'comment':'#Global\x20Max\x20Retry\x20(min:1,\x20max:999)'},'dialTimezone':{'type':Sequelize[_0x3e22('0x5')],'defaultValue':null},'dialGlobalInterval':{'type':Sequelize[_0x3e22('0x5')],'defaultValue':_0x3e22('0x33')},'dialPrefix':{'type':Sequelize[_0x3e22('0x5')],'defaultValue':null},'dialCheckDuplicateType':{'type':Sequelize['ENUM'](_0x3e22('0x34'),_0x3e22('0x35'),_0x3e22('0x36')),'defaultValue':_0x3e22('0x34')},'dialAMDActive':{'type':Sequelize[_0x3e22('0x20')],'defaultValue':0x0,'comment':'Active/Disactive\x20AMD'},'dialAMDInitialSilence':{'type':Sequelize['INTEGER'](0x9)[_0x3e22('0x24')],'defaultValue':0x9c4,'validate':{'min':0x0},'comment':_0x3e22('0x37')},'dialAMDGreeting':{'type':Sequelize[_0x3e22('0x15')](0x9)['UNSIGNED'],'defaultValue':0x5dc,'validate':{'min':0x0},'comment':_0x3e22('0x38')},'dialAMDAfterGreetingSilence':{'type':Sequelize[_0x3e22('0x15')](0x9)[_0x3e22('0x24')],'defaultValue':0x320,'validate':{'min':0x0},'comment':_0x3e22('0x39')},'dialAMDTotalAnalysisTime':{'type':Sequelize[_0x3e22('0x15')](0x9)[_0x3e22('0x24')],'defaultValue':0x1388,'validate':{'min':0x0},'comment':_0x3e22('0x3a')},'dialAMDMinWordLength':{'type':Sequelize[_0x3e22('0x15')](0x9)['UNSIGNED'],'defaultValue':0x64,'validate':{'min':0x0},'comment':_0x3e22('0x3b')},'dialAMDBetweenWordsSilence':{'type':Sequelize[_0x3e22('0x15')](0x9)[_0x3e22('0x24')],'defaultValue':0x32,'validate':{'min':0x0},'comment':_0x3e22('0x3c')},'dialAMDMaximumNumberOfWords':{'type':Sequelize['INTEGER'](0x9)[_0x3e22('0x24')],'defaultValue':0x3,'validate':{'min':0x0},'comment':_0x3e22('0x3d')},'dialAMDSilenceThreshold':{'type':Sequelize['INTEGER'](0x5)['UNSIGNED'],'validate':{'min':0x0,'max':0x7fff},'defaultValue':0x100,'comment':_0x3e22('0x3e')},'dialAMDMaximumWordLength':{'type':Sequelize[_0x3e22('0x15')](0x9)[_0x3e22('0x24')],'defaultValue':0x1388,'validate':{'min':0x0},'comment':'#AMD\x20Maximum\x20Word\x20Length'},'dialRecallMeTimeout':{'type':Sequelize[_0x3e22('0x15')](0x5)[_0x3e22('0x24')],'validate':{'min':0x1},'defaultValue':0x1e,'comment':'#RecallMe\x20Timeout\x20(min:1)'},'dialRecallInQueue':{'type':Sequelize[_0x3e22('0x20')],'defaultValue':0x0,'comment':_0x3e22('0x3f')},'dialOrderByScheduledAt':{'type':Sequelize[_0x3e22('0x2')](_0x3e22('0x40'),_0x3e22('0x41')),'defaultValue':_0x3e22('0x40')},'dialQueueProject2':{'type':Sequelize[_0x3e22('0x5')],'comment':_0x3e22('0x2f')},'dialAgiAfterHangupClient':{'type':Sequelize[_0x3e22('0x20')],'defaultValue':![]},'dialAgiAfterHangupAgent':{'type':Sequelize[_0x3e22('0x20')],'defaultValue':![]},'dialRandomLastDigitCallerIdNumber':{'type':Sequelize[_0x3e22('0x15')](0x3)['UNSIGNED'],'validate':{'min':0x0,'max':0xf},'defaultValue':0x0,'comment':_0x3e22('0x42')},'dialCutDigit':{'type':Sequelize[_0x3e22('0x15')](0x3)['UNSIGNED'],'validate':{'min':0x0,'max':0xf},'defaultValue':0x0,'comment':_0x3e22('0x43')},'dialNoSuchNumberMaxRetry':{'type':Sequelize[_0x3e22('0x15')](0x3)['UNSIGNED'],'defaultValue':0x3,'validate':{'min':0x1,'max':0x3e7},'comment':_0x3e22('0x44')},'dialNoSuchNumberRetryFrequency':{'type':Sequelize[_0x3e22('0x15')](0x5)['UNSIGNED'],'validate':{'min':0x1,'max':0x1869f},'defaultValue':0x96,'comment':_0x3e22('0x45')},'dialDropMaxRetry':{'type':Sequelize[_0x3e22('0x15')](0x3)[_0x3e22('0x24')],'defaultValue':0x3,'validate':{'min':0x1,'max':0x3e7},'comment':_0x3e22('0x46')},'dialDropRetryFrequency':{'type':Sequelize[_0x3e22('0x15')](0x5)[_0x3e22('0x24')],'validate':{'min':0x1,'max':0x1869f},'defaultValue':0x96,'comment':_0x3e22('0x47')},'dialAbandonedMaxRetry':{'type':Sequelize[_0x3e22('0x15')](0x3)[_0x3e22('0x24')],'defaultValue':0x3,'validate':{'min':0x1,'max':0x3e7},'comment':_0x3e22('0x48')},'dialAbandonedRetryFrequency':{'type':Sequelize[_0x3e22('0x15')](0x5)[_0x3e22('0x24')],'validate':{'min':0x1,'max':0x1869f},'defaultValue':0x96,'comment':'Abandoned\x20Retry\x20Frequency\x20Minutes\x20(min:1,\x20max:99999)'},'dialMachineMaxRetry':{'type':Sequelize['INTEGER'](0x3)[_0x3e22('0x24')],'defaultValue':0x3,'validate':{'min':0x1,'max':0x3e7},'comment':_0x3e22('0x49')},'dialMachineRetryFrequency':{'type':Sequelize[_0x3e22('0x15')](0x5)[_0x3e22('0x24')],'validate':{'min':0x1,'max':0x1869f},'defaultValue':0x96,'comment':_0x3e22('0x4a')},'dialAgentRejectMaxRetry':{'type':Sequelize[_0x3e22('0x15')](0x3)['UNSIGNED'],'defaultValue':0x3,'validate':{'min':0x1,'max':0x3e7},'comment':'#AgentReject\x20Retry\x20(min:1,\x20max:999)'},'dialAgentRejectRetryFrequency':{'type':Sequelize[_0x3e22('0x15')](0x5)[_0x3e22('0x24')],'validate':{'min':0x1,'max':0x1869f},'defaultValue':0x96,'comment':_0x3e22('0x4b')},'mandatoryDispositionPauseId':{'type':Sequelize['INTEGER'],'allowNull':!![],'comment':'Status\x20to\x20put\x20when\x20mandatory\x20disposition\x20is\x20enabled'},'mandatoryDisposition':{'type':Sequelize[_0x3e22('0x20')],'defaultValue':![],'comment':_0x3e22('0x4c'),'set':function(_0x5ee5d9){if(!_0x5ee5d9)this[_0x3e22('0x1d')](_0x3e22('0x4d'),null);this[_0x3e22('0x1d')](_0x3e22('0x4e'),_0x5ee5d9);}},'dialPredictiveIntervalMaxThreshold':{'type':Sequelize['INTEGER'](0x3)[_0x3e22('0x24')],'defaultValue':0x14,'validate':{'min':0x1,'max':0x64}},'dialPredictiveIntervalMinThreshold':{'type':Sequelize['INTEGER'](0x3)['UNSIGNED'],'defaultValue':0xa,'validate':{'min':0x1,'max':0x64}},'dialPreviewAutoRecallMe':{'type':Sequelize[_0x3e22('0x20')],'defaultValue':!![]},'callAdditionalPhoneAfterMin':{'type':Sequelize[_0x3e22('0x15')](0x3)[_0x3e22('0x24')],'defaultValue':0x4},'dialPreviewRecallmeReminder':{'type':Sequelize[_0x3e22('0x20')],'defaultValue':![]}}; \ No newline at end of file +var _0x92b5=['Active/Disactive\x20Campaign','progressive','booked','Dial\x20Method.','UNSIGNED','Max\x209999\x20channels,\x200\x20means\x20unlimited.','Max\x209999\x20member\x20in\x20queue(min:1,\x20max:9999),\x200\x20means\x20unlimited.','FLOAT','Power\x20Level:\x20Calls\x20for\x20agents\x20(min:1,\x20max:10).','dropRate','Only\x20for\x20predictive\x20method.','Predictive\x20Optimization\x20Percentage\x20(min:\x201,\x20max:\x2095)','Interval\x20Predictive\x20Minutes\x20(min:5\x20max:30)','Originate\x20Timeout\x20Seconds\x20(min:1,\x20max:999)','tTxX','https://wiki.asterisk.org/wiki/display/AST/Asterisk+13+Application_Queue','Queue\x20Timeout\x20Seconds\x20(min:1,\x20max:999)','AGI\x20queue\x20option\x20(use:\x20agi://127.0.0.1/square,)','#Busy\x20Retry\x20(min:1,\x20max:999)','#NoAnswer\x20Retry\x20(min:1,\x20max:999)','#Global\x20Max\x20Retry\x20(min:1,\x20max:999)','07:00-22:00,*,*,*','always','never','onlyIfOpen','Active/Disactive\x20AMD','#AMD\x20Initial\x20Silence','#AMD\x20After\x20Greeting\x20Silence','#AMD\x20Total\x20Analysis\x20Time','#AMD\x20Min\x20Word\x20Length','#AMD\x20Between\x20Words\x20Silence','#AMD\x20Maximum\x20Number\x20Of\x20Words','#AMD\x20Silence\x20Threshold\x20(min:0,\x20max:32767)','#AMD\x20Maximum\x20Word\x20Length','#RecallMe\x20Timeout\x20(min:1)','Active/Disactive\x20Recall\x20In\x20Queue','DESC','ASC','Random\x20Last\x20Digit\x20(min:1,\x20max:15)','Cut\x20Digit\x20(min:1,\x20max:15)','#NoSuchNumber\x20Retry\x20(min:1,\x20max:999)','NoSuchNumber\x20Retry\x20Frequency\x20Minutes\x20(min:1,\x20max:99999)','Drop\x20Retry\x20Frequency\x20Minutes\x20(min:1,\x20max:99999)','#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','mandatoryDisposition','sequelize','exports','name','ENUM','inbound','outbound','STRING','default','ringall','leastrecent','random','rrmemory','wrandom','rrordered','setDataValue','strategy','type','dialMethod','preview','roundrobin','includes','INTEGER','yes','TEXT','join','getDataValue','periodic_announce','split','joinempty','leavewhenempty','BOOLEAN','wrapuptime'];(function(_0x610621,_0x146b2f){var _0x583794=function(_0x2d60e8){while(--_0x2d60e8){_0x610621['push'](_0x610621['shift']());}};_0x583794(++_0x146b2f);}(_0x92b5,0x1cc));var _0x592b=function(_0x4fc9e6,_0xc51915){_0x4fc9e6=_0x4fc9e6-0x0;var _0x551d28=_0x92b5[_0x4fc9e6];return _0x551d28;};'use strict';var Sequelize=require(_0x592b('0x0'));module[_0x592b('0x1')]={'name':{'type':Sequelize['STRING'],'allowNull':![],'unique':_0x592b('0x2'),'validate':{'notEmpty':!![],'is':/^[A-Za-z0-9\.\_]+$/i}},'type':{'type':Sequelize[_0x592b('0x3')](_0x592b('0x4'),_0x592b('0x5')),'allowNull':![],'defaultValue':_0x592b('0x4')},'musiconhold':{'type':Sequelize[_0x592b('0x6')],'defaultValue':_0x592b('0x7')},'announce':{'type':Sequelize[_0x592b('0x6')],'defaultValue':''},'strategy':{'type':Sequelize['ENUM']('rr',_0x592b('0x8'),_0x592b('0x9'),'fewestcalls',_0x592b('0xa'),_0x592b('0xb'),'linear',_0x592b('0xc'),_0x592b('0xd')),'allowNull':![],'defaultValue':_0x592b('0x8'),'set':function(_0x38e92e){this[_0x592b('0xe')](_0x592b('0xf'),_0x38e92e?_0x38e92e:_0x592b('0xb'));},'get':function(){var _0x38ff23=this['getDataValue'](_0x592b('0x10'));var _0x28f3eb=this['getDataValue'](_0x592b('0x11'));var _0x42f6b8=this['getDataValue']('strategy');if(_0x38ff23==='outbound'){if(_0x28f3eb===_0x592b('0x12')){return null;}if(_0x28f3eb==='booked'&&![_0x592b('0xb'),_0x592b('0x13')][_0x592b('0x14')](_0x42f6b8)){this[_0x592b('0xe')](_0x592b('0xf'),_0x592b('0xb'));}}return _0x42f6b8;}},'servicelevel':{'type':Sequelize['INTEGER'](0xb),'defaultValue':0x0},'context':{'type':Sequelize[_0x592b('0x6')],'defaultValue':null},'penaltymemberslimit':{'type':Sequelize[_0x592b('0x15')](0xb)},'timeout':{'type':Sequelize[_0x592b('0x15')](0xb),'defaultValue':0xf},'retry':{'type':Sequelize[_0x592b('0x15')](0xb),'defaultValue':0x2},'timeoutpriority':{'type':Sequelize[_0x592b('0x6')]},'weight':{'type':Sequelize[_0x592b('0x15')](0xb),'allowNull':!![],'defaultValue':0x0},'wrapuptime':{'type':Sequelize[_0x592b('0x15')](0xb),'defaultValue':0x0},'autofill':{'type':Sequelize[_0x592b('0x3')](_0x592b('0x16'),'no'),'defaultValue':_0x592b('0x16')},'autopause':{'type':Sequelize[_0x592b('0x3')](_0x592b('0x16'),'no','all'),'defaultValue':'no'},'autopausedelay':{'type':Sequelize[_0x592b('0x15')](0xb)},'autopausebusy':{'type':Sequelize[_0x592b('0x3')](_0x592b('0x16'),'no'),'defaultValue':'no'},'autopauseunavail':{'type':Sequelize['ENUM'](_0x592b('0x16'),'no'),'defaultValue':'no'},'maxlen':{'type':Sequelize[_0x592b('0x15')](0xb),'defaultValue':0x0},'setinterfacevar':{'type':Sequelize['ENUM'](_0x592b('0x16'),'no'),'defaultValue':'no'},'setqueueentryvar':{'type':Sequelize[_0x592b('0x3')]('yes','no'),'defautValue':'no'},'setqueuevar':{'type':Sequelize[_0x592b('0x3')](_0x592b('0x16'),'no'),'defaultValue':'no'},'eventmemberstatus':{'type':Sequelize['ENUM']('yes','no'),'defaultValue':'no'},'membermacro':{'type':Sequelize['STRING'],'allowNull':!![]},'membergosub':{'type':Sequelize[_0x592b('0x6')],'allowNull':!![]},'announce_frequency':{'type':Sequelize[_0x592b('0x15')](0xb),'defaultValue':0x0},'min_announce_frequency':{'type':Sequelize[_0x592b('0x15')](0xb),'defaultValue':0x0},'periodic_announce_frequency':{'type':Sequelize[_0x592b('0x15')](0xb),'defaultValue':0x0},'random_periodic_announce':{'type':Sequelize[_0x592b('0x3')](_0x592b('0x16'),'no'),'defaultValue':'no'},'relative_periodic_announce':{'type':Sequelize[_0x592b('0x3')](_0x592b('0x16'),'no'),'defaultValue':_0x592b('0x16')},'announce_holdtime':{'type':Sequelize[_0x592b('0x3')](_0x592b('0x16'),'no','once'),'defaultValue':'no'},'announce_position':{'type':Sequelize[_0x592b('0x6')],'defaultValue':'no'},'announce_to_first_user':{'type':Sequelize['ENUM'](_0x592b('0x16'),'no')},'announce_position_limit':{'type':Sequelize['INTEGER'](0xb)},'announce_round_seconds':{'type':Sequelize[_0x592b('0x3')]('0','5','10','15','20','30'),'defaultValue':'0'},'monitor_format':{'type':Sequelize[_0x592b('0x6')],'defaultValue':''},'monitor_type':{'type':Sequelize[_0x592b('0x6')]},'queue_youarenext':{'type':Sequelize[_0x592b('0x6')],'defaultValue':null},'queue_thereare':{'type':Sequelize[_0x592b('0x6')],'defaultValue':null},'queue_callswaiting':{'type':Sequelize[_0x592b('0x6')],'defaultValue':null},'queue_holdtime':{'type':Sequelize[_0x592b('0x6')],'defaultValue':null},'queue_minute':{'type':Sequelize[_0x592b('0x6')],'allowNull':!![],'defaultValue':null},'queue_minutes':{'type':Sequelize['STRING'],'defaultValue':null},'queue_seconds':{'type':Sequelize[_0x592b('0x6')],'defaultValue':null},'queue_thankyou':{'type':Sequelize[_0x592b('0x6')],'defaultValue':null},'queue_reporthold':{'type':Sequelize[_0x592b('0x6')]},'queue_quantity1':{'type':Sequelize[_0x592b('0x6')]},'queue_quantity2':{'type':Sequelize[_0x592b('0x6')]},'queue_periodic_announce':{'type':Sequelize[_0x592b('0x6')]},'queue_less_than':{'type':Sequelize[_0x592b('0x6')]},'periodic_announce':{'type':Sequelize[_0x592b('0x17')],'set':function(_0x78047e){this['setDataValue']('periodic_announce',_0x78047e?_0x78047e[_0x592b('0x18')](','):[]);},'get':function(){return this[_0x592b('0x19')](_0x592b('0x1a'))?this[_0x592b('0x19')]('periodic_announce')[_0x592b('0x1b')](','):[];}},'joinempty':{'type':Sequelize[_0x592b('0x6')],'defaultValue':'yes','set':function(_0x36e86f){this[_0x592b('0xe')](_0x592b('0x1c'),_0x36e86f?_0x36e86f[_0x592b('0x18')](','):undefined);},'get':function(){return this['getDataValue']('joinempty')?this[_0x592b('0x19')](_0x592b('0x1c'))['split'](','):undefined;}},'leavewhenempty':{'type':Sequelize['STRING'],'defaultValue':'no','set':function(_0x1e17b6){this['setDataValue']('leavewhenempty',_0x1e17b6?_0x1e17b6[_0x592b('0x18')](','):undefined);},'get':function(){return this[_0x592b('0x19')](_0x592b('0x1d'))?this[_0x592b('0x19')](_0x592b('0x1d'))[_0x592b('0x1b')](','):undefined;}},'reportholdtime':{'type':Sequelize['ENUM'](_0x592b('0x16'),'no'),'defaultValue':'no'},'ringinuse':{'type':Sequelize[_0x592b('0x3')]('yes','no'),'defaultValue':'no'},'memberdelay':{'type':Sequelize[_0x592b('0x15')](0xb),'defaultValue':0x0},'timeoutrestart':{'type':Sequelize['ENUM'](_0x592b('0x16'),'no'),'defaultValue':'no'},'defaultrule':{'type':Sequelize[_0x592b('0x6')]},'description':{'type':Sequelize['STRING']},'acw':{'type':Sequelize[_0x592b('0x1e')],'defaultValue':0x0,'set':function(_0x18a1fe){this[_0x592b('0xe')]('acw',_0x18a1fe);if(_0x18a1fe){if(this['getDataValue'](_0x592b('0x1f'))<0x2){this['setDataValue'](_0x592b('0x1f'),0x2);}}}},'acwTimeout':{'type':Sequelize[_0x592b('0x15')](0xb),'defaultValue':0xa},'dialActive':{'type':Sequelize[_0x592b('0x1e')],'defaultValue':0x0,'comment':_0x592b('0x20')},'dialMethod':{'type':Sequelize['ENUM'](_0x592b('0x12'),_0x592b('0x21'),'power','predictive',_0x592b('0x22')),'defaultValue':'progressive','comment':_0x592b('0x23')},'dialLimitChannel':{'type':Sequelize[_0x592b('0x15')](0x4)[_0x592b('0x24')],'defaultValue':0x0,'validate':{'min':0x0,'max':0x270f},'comment':_0x592b('0x25')},'dialLimitQueue':{'type':Sequelize[_0x592b('0x15')](0x4)[_0x592b('0x24')],'defaultValue':0x0,'validate':{'min':0x0,'max':0x270f},'comment':_0x592b('0x26')},'dialPowerLevel':{'type':Sequelize[_0x592b('0x27')](0x2)[_0x592b('0x24')],'defaultValue':0x1,'validate':{'min':0x1,'max':0xa},'comment':_0x592b('0x28')},'dialPredictiveOptimization':{'type':Sequelize[_0x592b('0x3')]('agentBusyFactor',_0x592b('0x29')),'defaultValue':_0x592b('0x29'),'comment':_0x592b('0x2a')},'dialPredictiveOptimizationPercentage':{'type':Sequelize[_0x592b('0x27')](0x2)[_0x592b('0x24')],'defaultValue':0x3,'validate':{'min':0x1,'max':0x5f},'comment':_0x592b('0x2b')},'dialPredictiveInterval':{'type':Sequelize[_0x592b('0x15')](0x3)['UNSIGNED'],'defaultValue':0xa,'validate':{'min':0x5,'max':0x1e},'comment':_0x592b('0x2c')},'dialOriginateCallerIdName':{'type':Sequelize['STRING']},'dialOriginateCallerIdNumber':{'type':Sequelize[_0x592b('0x6')]},'dialOriginateTimeout':{'type':Sequelize[_0x592b('0x15')](0x3)[_0x592b('0x24')],'defaultValue':0x1e,'validate':{'min':0x1,'max':0x3e7},'comment':_0x592b('0x2d')},'dialQueueOptions':{'type':Sequelize[_0x592b('0x6')],'defaultValue':_0x592b('0x2e'),'comment':_0x592b('0x2f')},'dialQueueTimeout':{'type':Sequelize[_0x592b('0x15')](0x3)[_0x592b('0x24')],'defaultValue':0x3,'validate':{'min':0x1,'max':0x3e7},'comment':_0x592b('0x30')},'dialQueueProject':{'type':Sequelize['STRING'],'comment':_0x592b('0x31')},'dialCongestionMaxRetry':{'type':Sequelize[_0x592b('0x15')](0x3)[_0x592b('0x24')],'defaultValue':0x3,'validate':{'min':0x1,'max':0x3e7},'comment':'#Congestion\x20Retry\x20(min:1,\x20max:999)'},'dialCongestionRetryFrequency':{'type':Sequelize['INTEGER'](0x5)[_0x592b('0x24')],'validate':{'min':0x1,'max':0x1869f},'defaultValue':0x96,'comment':'Congestion\x20Retry\x20Frequency\x20Minutes\x20(min:1,\x20max:99999)'},'dialBusyMaxRetry':{'type':Sequelize['INTEGER'](0x3)['UNSIGNED'],'defaultValue':0x3,'validate':{'min':0x1,'max':0x3e7},'comment':_0x592b('0x32')},'dialBusyRetryFrequency':{'type':Sequelize[_0x592b('0x15')](0x5)[_0x592b('0x24')],'validate':{'min':0x1,'max':0x1869f},'defaultValue':0x96,'comment':'Busy\x20Retry\x20Frequency\x20Minutes\x20(min:1,\x20max:99999)'},'dialNoAnswerMaxRetry':{'type':Sequelize['INTEGER'](0x3)[_0x592b('0x24')],'defaultValue':0x3,'comment':_0x592b('0x33')},'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[_0x592b('0x15')](0x3)['UNSIGNED'],'validate':{'min':0x1,'max':0x3e7},'defaultValue':0x4,'comment':_0x592b('0x34')},'dialTimezone':{'type':Sequelize[_0x592b('0x6')],'defaultValue':null},'dialGlobalInterval':{'type':Sequelize['STRING'],'defaultValue':_0x592b('0x35')},'dialPrefix':{'type':Sequelize[_0x592b('0x6')],'defaultValue':null},'dialCheckDuplicateType':{'type':Sequelize[_0x592b('0x3')](_0x592b('0x36'),_0x592b('0x37'),_0x592b('0x38')),'defaultValue':_0x592b('0x36')},'dialAMDActive':{'type':Sequelize[_0x592b('0x1e')],'defaultValue':0x0,'comment':_0x592b('0x39')},'dialAMDInitialSilence':{'type':Sequelize['INTEGER'](0x9)[_0x592b('0x24')],'defaultValue':0x9c4,'validate':{'min':0x0},'comment':_0x592b('0x3a')},'dialAMDGreeting':{'type':Sequelize[_0x592b('0x15')](0x9)[_0x592b('0x24')],'defaultValue':0x5dc,'validate':{'min':0x0},'comment':'#AMD\x20Greeting'},'dialAMDAfterGreetingSilence':{'type':Sequelize[_0x592b('0x15')](0x9)[_0x592b('0x24')],'defaultValue':0x320,'validate':{'min':0x0},'comment':_0x592b('0x3b')},'dialAMDTotalAnalysisTime':{'type':Sequelize['INTEGER'](0x9)['UNSIGNED'],'defaultValue':0x1388,'validate':{'min':0x0},'comment':_0x592b('0x3c')},'dialAMDMinWordLength':{'type':Sequelize[_0x592b('0x15')](0x9)['UNSIGNED'],'defaultValue':0x64,'validate':{'min':0x0},'comment':_0x592b('0x3d')},'dialAMDBetweenWordsSilence':{'type':Sequelize[_0x592b('0x15')](0x9)[_0x592b('0x24')],'defaultValue':0x32,'validate':{'min':0x0},'comment':_0x592b('0x3e')},'dialAMDMaximumNumberOfWords':{'type':Sequelize[_0x592b('0x15')](0x9)[_0x592b('0x24')],'defaultValue':0x3,'validate':{'min':0x0},'comment':_0x592b('0x3f')},'dialAMDSilenceThreshold':{'type':Sequelize[_0x592b('0x15')](0x5)[_0x592b('0x24')],'validate':{'min':0x0,'max':0x7fff},'defaultValue':0x100,'comment':_0x592b('0x40')},'dialAMDMaximumWordLength':{'type':Sequelize[_0x592b('0x15')](0x9)['UNSIGNED'],'defaultValue':0x1388,'validate':{'min':0x0},'comment':_0x592b('0x41')},'dialRecallMeTimeout':{'type':Sequelize[_0x592b('0x15')](0x5)[_0x592b('0x24')],'validate':{'min':0x1},'defaultValue':0x1e,'comment':_0x592b('0x42')},'dialRecallInQueue':{'type':Sequelize[_0x592b('0x1e')],'defaultValue':0x0,'comment':_0x592b('0x43')},'dialOrderByScheduledAt':{'type':Sequelize[_0x592b('0x3')](_0x592b('0x44'),_0x592b('0x45')),'defaultValue':_0x592b('0x44')},'dialQueueProject2':{'type':Sequelize[_0x592b('0x6')],'comment':_0x592b('0x31')},'dialAgiAfterHangupClient':{'type':Sequelize[_0x592b('0x1e')],'defaultValue':![]},'dialAgiAfterHangupAgent':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'dialRandomLastDigitCallerIdNumber':{'type':Sequelize[_0x592b('0x15')](0x3)[_0x592b('0x24')],'validate':{'min':0x0,'max':0xf},'defaultValue':0x0,'comment':_0x592b('0x46')},'dialCutDigit':{'type':Sequelize['INTEGER'](0x3)[_0x592b('0x24')],'validate':{'min':0x0,'max':0xf},'defaultValue':0x0,'comment':_0x592b('0x47')},'dialNoSuchNumberMaxRetry':{'type':Sequelize[_0x592b('0x15')](0x3)['UNSIGNED'],'defaultValue':0x3,'validate':{'min':0x1,'max':0x3e7},'comment':_0x592b('0x48')},'dialNoSuchNumberRetryFrequency':{'type':Sequelize[_0x592b('0x15')](0x5)['UNSIGNED'],'validate':{'min':0x1,'max':0x1869f},'defaultValue':0x96,'comment':_0x592b('0x49')},'dialDropMaxRetry':{'type':Sequelize['INTEGER'](0x3)[_0x592b('0x24')],'defaultValue':0x3,'validate':{'min':0x1,'max':0x3e7},'comment':'#Drop\x20Retry\x20(min:1,\x20max:999)'},'dialDropRetryFrequency':{'type':Sequelize[_0x592b('0x15')](0x5)[_0x592b('0x24')],'validate':{'min':0x1,'max':0x1869f},'defaultValue':0x96,'comment':_0x592b('0x4a')},'dialAbandonedMaxRetry':{'type':Sequelize[_0x592b('0x15')](0x3)['UNSIGNED'],'defaultValue':0x3,'validate':{'min':0x1,'max':0x3e7},'comment':_0x592b('0x4b')},'dialAbandonedRetryFrequency':{'type':Sequelize[_0x592b('0x15')](0x5)[_0x592b('0x24')],'validate':{'min':0x1,'max':0x1869f},'defaultValue':0x96,'comment':_0x592b('0x4c')},'dialMachineMaxRetry':{'type':Sequelize[_0x592b('0x15')](0x3)['UNSIGNED'],'defaultValue':0x3,'validate':{'min':0x1,'max':0x3e7},'comment':'#Machine\x20Retry\x20(min:1,\x20max:999)'},'dialMachineRetryFrequency':{'type':Sequelize[_0x592b('0x15')](0x5)[_0x592b('0x24')],'validate':{'min':0x1,'max':0x1869f},'defaultValue':0x96,'comment':_0x592b('0x4d')},'dialAgentRejectMaxRetry':{'type':Sequelize[_0x592b('0x15')](0x3)['UNSIGNED'],'defaultValue':0x3,'validate':{'min':0x1,'max':0x3e7},'comment':_0x592b('0x4e')},'dialAgentRejectRetryFrequency':{'type':Sequelize['INTEGER'](0x5)[_0x592b('0x24')],'validate':{'min':0x1,'max':0x1869f},'defaultValue':0x96,'comment':_0x592b('0x4f')},'mandatoryDispositionPauseId':{'type':Sequelize[_0x592b('0x15')],'allowNull':!![],'comment':_0x592b('0x50')},'mandatoryDisposition':{'type':Sequelize['BOOLEAN'],'defaultValue':![],'comment':'Enabled/disables\x20mandatory\x20dispo\x20on\x20a\x20queue','set':function(_0x4c3887){if(!_0x4c3887)this[_0x592b('0xe')]('mandatoryDispositionPauseId',null);this['setDataValue'](_0x592b('0x51'),_0x4c3887);}},'dialPredictiveIntervalMaxThreshold':{'type':Sequelize[_0x592b('0x15')](0x3)[_0x592b('0x24')],'defaultValue':0x14,'validate':{'min':0x1,'max':0x64}},'dialPredictiveIntervalMinThreshold':{'type':Sequelize[_0x592b('0x15')](0x3)[_0x592b('0x24')],'defaultValue':0xa,'validate':{'min':0x1,'max':0x64}},'dialPreviewAutoRecallMe':{'type':Sequelize[_0x592b('0x1e')],'defaultValue':!![]},'callAdditionalPhoneAfterMin':{'type':Sequelize['INTEGER'](0x3)[_0x592b('0x24')],'defaultValue':0x4},'dialPreviewRecallmeReminder':{'type':Sequelize[_0x592b('0x1e')],'defaultValue':![]}}; \ No newline at end of file diff --git a/server/api/voiceQueue/voiceQueue.controller.js b/server/api/voiceQueue/voiceQueue.controller.js index b87a0cf..a1c3fd5 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 _0xe14b=['QueueCampaigns','outbound','filter','map','value','type','find','name','end','error','stack','index','VoiceQueue','rawAttributes','fieldName','key','getOptions','where','include','show','params','model','keys','query','intersection','attributes','fields','length','includeAll','options','catch','create','body','user','Unable\x20to\x20retrieve\x20the\x20current\x20user','role','VoiceQueues','UserProfileSection','autoAssociation','UserProfileResource','clone','merge','omit','createdAt','updatedAt','userProfileId','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','getHoppers','CmHopper','filters','hasOwnProperty','nolimit','order','sort','pick','VoiceQueueId','findAll','rows','getHopperHistories','findOne','CmHopperHistory','getHopperFinals','CmHopperFinal','getHopperBlacks','CmHopperBlack','getTeams','Team','addTeams','Agents','online','interface','flatMap','penalty','sequelize','UserVoiceQueue','UserVoiceQueueRt','upsert','isNil','format','voicePause','forEach','emit','userVoiceQueue:save','ids','User','select','field','tq.TeamId','from','team_has_voice_queues','join','VoiceQueueId\x20=\x20?','ut.UserId\x20=\x20?','push','toString','QueryTypes','SELECT','every','TeamId','all','compact','transaction','removeTeams','isEmpty','removeAgents','userVoiceQueue:remove','addAgents','spread','isArray','getAgents','getMembers','getLists','CmList','addLists','dialCheckDuplicateType','insert','into','cm_hopper','fromQuery','phone','scheduledAt','ContactId','ListId','CmListId','ListId\x20=\x20?','phone\x20IS\x20NOT\x20NULL','phone\x20NOT\x20IN\x20(?)','COALESCE(calleridnum,\x27\x27)','cm_hopper_final','COALESCE(phone,\x27\x27)','onlyIfOpen','cm_contacts','deletedAt\x20IS\x20NULL','cm_hopper_additional_phones','CmHopperId','OrderBy','ci.item','ci.OrderBy+1','cm_contact_has_items','h.scheduledat=?','ci.ItemClass=?','PHONE','removeLists','getBlackLists','cm_hopper_black','NOW()','removeBlackLists','moment','bluebird','squel','ioredis','../../config/logger','../../mysqldb','redis','defaults','localhost','socket.io-emitter','sendStatus','status','json','offset','undefined','limit','count','Content-Range','update','then','destroy','get','inbound'];(function(_0x43e30c,_0x289d3c){var _0x4ea9a7=function(_0x2130cb){while(--_0x2130cb){_0x43e30c['push'](_0x43e30c['shift']());}};_0x4ea9a7(++_0x289d3c);}(_0xe14b,0x93));var _0xbe14=function(_0x1f6a01,_0x2e08c6){_0x1f6a01=_0x1f6a01-0x0;var _0x315d71=_0xe14b[_0x1f6a01];return _0x315d71;};'use strict';var moment=require(_0xbe14('0x0'));var BPromise=require(_0xbe14('0x1'));var util=require('util');var _=require('lodash');var squel=require(_0xbe14('0x2'));var Redis=require(_0xbe14('0x3'));var qs=require('../../components/parsers/qs');var logger=require(_0xbe14('0x4'))('api');var config=require('../../config/environment');var db=require(_0xbe14('0x5'))['db'];config[_0xbe14('0x6')]=_[_0xbe14('0x7')](config[_0xbe14('0x6')],{'host':_0xbe14('0x8'),'port':0x18eb});var socket=require(_0xbe14('0x9'))(new Redis(config[_0xbe14('0x6')]));require('./voiceQueue.socket')['register'](socket);function respondWithStatusCode(_0x496063,_0x30c355){_0x30c355=_0x30c355||0xcc;return function(_0x6fceff){if(_0x6fceff){return _0x496063[_0xbe14('0xa')](_0x30c355);}return _0x496063[_0xbe14('0xb')](_0x30c355)['end']();};}function respondWithResult(_0x5b9fc6,_0x113243){_0x113243=_0x113243||0xc8;return function(_0x3f70cb){if(_0x3f70cb){return _0x5b9fc6['status'](_0x113243)[_0xbe14('0xc')](_0x3f70cb);}};}function respondWithFilteredResult(_0x35aa19,_0x886a5e){return function(_0x3d38c2){if(_0x3d38c2){var _0x27792f=typeof _0x886a5e[_0xbe14('0xd')]===_0xbe14('0xe')&&typeof _0x886a5e[_0xbe14('0xf')]===_0xbe14('0xe');var _0xa2cf72=_0x3d38c2[_0xbe14('0x10')];var _0x33fd54=_0x27792f?0x0:_0x886a5e[_0xbe14('0xd')];var _0x530538=_0x27792f?_0x3d38c2['count']:_0x886a5e[_0xbe14('0xd')]+_0x886a5e[_0xbe14('0xf')];var _0xf4ac9;if(_0x530538>=_0xa2cf72){_0x530538=_0xa2cf72;_0xf4ac9=0xc8;}else{_0xf4ac9=0xce;}_0x35aa19[_0xbe14('0xb')](_0xf4ac9);return _0x35aa19['set'](_0xbe14('0x11'),_0x33fd54+'-'+_0x530538+'/'+_0xa2cf72)[_0xbe14('0xc')](_0x3d38c2);}return null;};}function saveUpdates(_0xfd7b8f){return function(_0x123ede){if(_0x123ede){return _0x123ede[_0xbe14('0x12')](_0xfd7b8f)[_0xbe14('0x13')](function(_0x17ae86){return _0x17ae86;});}return null;};}function removeEntity(_0x5ea1f8){return function(_0x137ee5){if(_0x137ee5){return _0x137ee5[_0xbe14('0x14')]()[_0xbe14('0x13')](function(){var _0x433459=_0x137ee5[_0xbe14('0x15')]({'plain':!![]});var _0x37e4c1=[{'name':'VoiceQueues','value':_0xbe14('0x16'),'ignore':![]},{'name':_0xbe14('0x17'),'value':_0xbe14('0x18'),'ignore':![]}];var _0xc12977=_(_0x37e4c1)[_0xbe14('0x19')]('ignore')[_0xbe14('0x1a')]('value')[_0xbe14('0x1b')]();if(_['includes'](_0xc12977,_0x433459[_0xbe14('0x1c')])){return;}var _0x4a25fa=_[_0xbe14('0x1d')](_0x37e4c1,[_0xbe14('0x1b'),_0x433459['type']])[_0xbe14('0x1e')];return db['UserProfileResource'][_0xbe14('0x14')]({'where':{'type':_0x4a25fa,'resourceId':_0x433459['id']}})['then'](function(){return _0x137ee5;});})[_0xbe14('0x13')](function(){_0x5ea1f8[_0xbe14('0xb')](0xcc)[_0xbe14('0x1f')]();});}};}function handleEntityNotFound(_0x39cc81){return function(_0x15ef02){if(!_0x15ef02){_0x39cc81[_0xbe14('0xa')](0x194);}return _0x15ef02;};}function handleError(_0x55d001,_0x1822e0){_0x1822e0=_0x1822e0||0x1f4;return function(_0x1ba46a){logger[_0xbe14('0x20')](_0x1ba46a[_0xbe14('0x21')]);if(_0x1ba46a['name']){delete _0x1ba46a[_0xbe14('0x1e')];}_0x55d001[_0xbe14('0xb')](_0x1822e0)['send'](_0x1ba46a);};}exports[_0xbe14('0x22')]=function(_0x3b3e84,_0x1c7cc7){var _0x19252f={};var _0x34d648={'count':0x0,'rows':[]};var _0x36d4b2=_[_0xbe14('0x1a')](db[_0xbe14('0x23')][_0xbe14('0x24')],function(_0x16a159){return{'name':_0x16a159[_0xbe14('0x25')],'type':_0x16a159[_0xbe14('0x1c')][_0xbe14('0x26')]};});_0x19252f=qs[_0xbe14('0x27')](_0x36d4b2,_0x3b3e84);var _0x223f7a={'where':_0x19252f[_0xbe14('0x28')]};return db[_0xbe14('0x23')][_0xbe14('0x10')](_0x223f7a)[_0xbe14('0x13')](function(_0x14e7c4){_0x34d648['count']=_0x14e7c4;_0x19252f[_0xbe14('0x29')]=qs['include'](_0x3b3e84['query']);return db[_0xbe14('0x23')]['findAll'](_0x19252f);})[_0xbe14('0x13')](function(_0x345b0){_0x34d648['rows']=_0x345b0;return _0x34d648;})['then'](respondWithFilteredResult(_0x1c7cc7,_0x19252f))['catch'](handleError(_0x1c7cc7,null));};exports[_0xbe14('0x2a')]=function(_0xa3d24,_0x5f27b6){var _0x46c570={'raw':![],'where':{'id':_0xa3d24[_0xbe14('0x2b')]['id']}},_0x1faf3e={};_0x1faf3e[_0xbe14('0x2c')]=_[_0xbe14('0x2d')](db['VoiceQueue']['rawAttributes']);_0x1faf3e[_0xbe14('0x2e')]=_['keys'](_0xa3d24['query']);_0x1faf3e['filters']=_[_0xbe14('0x2f')](_0x1faf3e[_0xbe14('0x2c')],_0x1faf3e[_0xbe14('0x2e')]);_0x46c570[_0xbe14('0x30')]=_[_0xbe14('0x2f')](_0x1faf3e[_0xbe14('0x2c')],qs[_0xbe14('0x31')](_0xa3d24[_0xbe14('0x2e')][_0xbe14('0x31')]));_0x46c570[_0xbe14('0x30')]=_0x46c570[_0xbe14('0x30')][_0xbe14('0x32')]?_0x46c570['attributes']:_0x1faf3e['model'];if(_0xa3d24[_0xbe14('0x2e')][_0xbe14('0x33')]){_0x46c570[_0xbe14('0x29')]=[{'all':!![]}];}_0x46c570=_['merge']({},_0x46c570,_0xa3d24[_0xbe14('0x34')]);return db[_0xbe14('0x23')][_0xbe14('0x1d')](_0x46c570)[_0xbe14('0x13')](handleEntityNotFound(_0x5f27b6,null))[_0xbe14('0x13')](respondWithResult(_0x5f27b6,null))[_0xbe14('0x35')](handleError(_0x5f27b6,null));};exports[_0xbe14('0x36')]=function(_0x128843,_0x1b2608){return db['VoiceQueue'][_0xbe14('0x36')](_0x128843[_0xbe14('0x37')],{})[_0xbe14('0x13')](function(_0x1b3118){var _0x3287b9=_0x128843[_0xbe14('0x38')]['get']({'plain':!![]});if(!_0x3287b9)throw new Error(_0xbe14('0x39'));if(_0x3287b9[_0xbe14('0x3a')]===_0xbe14('0x38')){var _0x36263c=_0x1b3118['get']({'plain':!![]});var _0x4bfa96=[{'name':_0xbe14('0x3b'),'value':_0xbe14('0x16')},{'name':_0xbe14('0x17'),'value':'outbound'}];var _0x5d5318=_[_0xbe14('0x1d')](_0x4bfa96,['value',_0x36263c['type']])[_0xbe14('0x1e')];return db[_0xbe14('0x3c')][_0xbe14('0x1d')]({'where':{'name':_0x5d5318,'userProfileId':_0x3287b9['userProfileId']},'raw':!![]})['then'](function(_0x5aaa4f){if(_0x5aaa4f&&_0x5aaa4f[_0xbe14('0x3d')]===0x0){return db[_0xbe14('0x3e')][_0xbe14('0x36')]({'name':_0x36263c['name'],'resourceId':_0x36263c['id'],'type':_0x5aaa4f[_0xbe14('0x1e')],'sectionId':_0x5aaa4f['id']},{})[_0xbe14('0x13')](function(){return _0x1b3118;});}else{return _0x1b3118;}})[_0xbe14('0x35')](function(_0x3ab0f6){logger['error']('Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s',_0x3ab0f6);throw _0x3ab0f6;});}return _0x1b3118;})[_0xbe14('0x13')](respondWithResult(_0x1b2608,0xc9))[_0xbe14('0x35')](handleError(_0x1b2608,null));};exports[_0xbe14('0x3f')]=function(_0xb2b285,_0x2550dc){var _0x4f2d95={'where':{'id':_0xb2b285[_0xbe14('0x2b')]['id']}},_0x51023a={};_0x51023a[_0xbe14('0x2c')]=_[_0xbe14('0x2d')](db[_0xbe14('0x23')]['rawAttributes']);_0x4f2d95[_0xbe14('0x30')]=_[_0xbe14('0x2f')](_0x51023a['model'],qs[_0xbe14('0x31')](_0xb2b285[_0xbe14('0x2e')][_0xbe14('0x31')]));_0x4f2d95[_0xbe14('0x30')]=_0x4f2d95['attributes']['length']?_0x4f2d95[_0xbe14('0x30')]:_0x51023a[_0xbe14('0x2c')];if(_0xb2b285['query']['includeAll']){_0x4f2d95[_0xbe14('0x29')]=[{'all':!![]}];}_0x4f2d95=_[_0xbe14('0x40')]({},_0x4f2d95,_0xb2b285[_0xbe14('0x34')]);return db[_0xbe14('0x23')][_0xbe14('0x1d')](_0x4f2d95)[_0xbe14('0x13')](handleEntityNotFound(_0x2550dc,null))[_0xbe14('0x13')](function(_0x5a4068){if(_0x5a4068){var _0xf32e93=_0x5a4068[_0xbe14('0x15')]({'plain':!![]});_0xf32e93=qs[_0xbe14('0x41')](_0xf32e93,['id',_0xbe14('0x42'),_0xbe14('0x43')]);_0xb2b285['body']=_[_0xbe14('0x41')](_0xb2b285[_0xbe14('0x37')],['id',_0xbe14('0x42'),_0xbe14('0x43')]);return db[_0xbe14('0x23')][_0xbe14('0x36')](_['merge'](_0xf32e93,_0xb2b285['body']),{'include':_0xb2b285[_0xbe14('0x2e')][_0xbe14('0x33')]?[{'all':!![]}]:undefined})[_0xbe14('0x13')](function(_0x48554a){var _0x497b00=_0xb2b285[_0xbe14('0x38')][_0xbe14('0x15')]({'plain':!![]});if(!_0x497b00)throw new Error('Unable\x20to\x20retrieve\x20the\x20current\x20user');if(_0x497b00[_0xbe14('0x3a')]===_0xbe14('0x38')){var _0x50c2a0=_0x48554a[_0xbe14('0x15')]({'plain':!![]});var _0x4a40d2=[{'name':_0xbe14('0x3b'),'value':_0xbe14('0x16')},{'name':_0xbe14('0x17'),'value':'outbound'}];var _0x435c8d=_[_0xbe14('0x1d')](_0x4a40d2,['value',_0x50c2a0[_0xbe14('0x1c')]])[_0xbe14('0x1e')];return db[_0xbe14('0x3c')][_0xbe14('0x1d')]({'where':{'name':_0x435c8d,'userProfileId':_0x497b00[_0xbe14('0x44')]},'raw':!![]})['then'](function(_0x42a346){if(_0x42a346&&_0x42a346[_0xbe14('0x3d')]===0x0){return db[_0xbe14('0x3e')][_0xbe14('0x36')]({'name':_0x50c2a0[_0xbe14('0x1e')],'resourceId':_0x50c2a0['id'],'type':_0x42a346[_0xbe14('0x1e')],'sectionId':_0x42a346['id']},{})[_0xbe14('0x13')](function(){return _0x48554a;});}else{return _0x48554a;}})['catch'](function(_0x72c875){logger[_0xbe14('0x20')](_0xbe14('0x45'),_0x72c875);throw _0x72c875;});}return _0x48554a;});}})[_0xbe14('0x13')](respondWithResult(_0x2550dc,0xc9))[_0xbe14('0x35')](handleError(_0x2550dc,null));};exports[_0xbe14('0x12')]=function(_0xd8f78f,_0x32df3c){if(_0xd8f78f[_0xbe14('0x37')]['id']){delete _0xd8f78f[_0xbe14('0x37')]['id'];}return db[_0xbe14('0x23')]['find']({'where':{'id':_0xd8f78f['params']['id']}})['then'](handleEntityNotFound(_0x32df3c,null))[_0xbe14('0x13')](saveUpdates(_0xd8f78f[_0xbe14('0x37')],null))[_0xbe14('0x13')](respondWithResult(_0x32df3c,null))[_0xbe14('0x35')](handleError(_0x32df3c,null));};exports[_0xbe14('0x14')]=function(_0x66ddf,_0x16ee48){return db[_0xbe14('0x23')][_0xbe14('0x1d')]({'where':{'id':_0x66ddf[_0xbe14('0x2b')]['id']}})[_0xbe14('0x13')](handleEntityNotFound(_0x16ee48,null))[_0xbe14('0x13')](removeEntity(_0x16ee48,null))[_0xbe14('0x35')](handleError(_0x16ee48,null));};exports[_0xbe14('0x46')]=function(_0x1c831a,_0xcef8e3){var _0x179077={'raw':![],'where':{}};var _0x2225d9={};var _0x29761b={'count':0x0,'rows':[]};return db[_0xbe14('0x23')]['findOne']({'where':{'id':_0x1c831a[_0xbe14('0x2b')]['id']}})[_0xbe14('0x13')](handleEntityNotFound(_0xcef8e3,null))[_0xbe14('0x13')](function(_0x46b49c){if(_0x46b49c){_0x2225d9[_0xbe14('0x2c')]=_[_0xbe14('0x2d')](db[_0xbe14('0x47')][_0xbe14('0x24')]);_0x2225d9[_0xbe14('0x2e')]=_[_0xbe14('0x2d')](_0x1c831a['query']);_0x2225d9[_0xbe14('0x48')]=_[_0xbe14('0x2f')](_0x2225d9[_0xbe14('0x2c')],_0x2225d9[_0xbe14('0x2e')]);_0x179077[_0xbe14('0x30')]=_['intersection'](_0x2225d9[_0xbe14('0x2c')],qs[_0xbe14('0x31')](_0x1c831a[_0xbe14('0x2e')][_0xbe14('0x31')]));_0x179077[_0xbe14('0x30')]=_0x179077['attributes'][_0xbe14('0x32')]?_0x179077[_0xbe14('0x30')]:_0x2225d9[_0xbe14('0x2c')];if(!_0x1c831a[_0xbe14('0x2e')][_0xbe14('0x49')](_0xbe14('0x4a'))){_0x179077[_0xbe14('0xf')]=qs[_0xbe14('0xf')](_0x1c831a['query'][_0xbe14('0xf')]);_0x179077[_0xbe14('0xd')]=qs[_0xbe14('0xd')](_0x1c831a[_0xbe14('0x2e')][_0xbe14('0xd')]);}_0x179077[_0xbe14('0x4b')]=qs[_0xbe14('0x4c')](_0x1c831a['query']['sort']);_0x179077[_0xbe14('0x28')]=qs[_0xbe14('0x48')](_[_0xbe14('0x4d')](_0x1c831a[_0xbe14('0x2e')],_0x2225d9[_0xbe14('0x48')]));_0x179077[_0xbe14('0x28')][_0xbe14('0x4e')]=_0x46b49c['id'];if(_0x1c831a[_0xbe14('0x2e')]['filter']){_0x179077['where']=_[_0xbe14('0x40')](_0x179077[_0xbe14('0x28')],{'$or':_[_0xbe14('0x1a')](_0x179077['attributes'],function(_0x76e91e){var _0x16bca1={};_0x16bca1[_0x76e91e]={'$like':'%'+_0x1c831a[_0xbe14('0x2e')][_0xbe14('0x19')]+'%'};return _0x16bca1;})});}_0x179077=_[_0xbe14('0x40')]({},_0x179077,_0x1c831a[_0xbe14('0x34')]);return db[_0xbe14('0x47')]['count']({'where':_0x179077[_0xbe14('0x28')]})[_0xbe14('0x13')](function(_0x3baa26){_0x29761b[_0xbe14('0x10')]=_0x3baa26;if(_0x1c831a[_0xbe14('0x2e')][_0xbe14('0x33')]){_0x179077[_0xbe14('0x29')]=[{'all':!![]}];}return db['CmHopper'][_0xbe14('0x4f')](_0x179077);})[_0xbe14('0x13')](function(_0x3cd17e){_0x29761b[_0xbe14('0x50')]=_0x3cd17e;return _0x29761b;});}})[_0xbe14('0x13')](respondWithFilteredResult(_0xcef8e3,_0x179077))[_0xbe14('0x35')](handleError(_0xcef8e3,null));};exports[_0xbe14('0x51')]=function(_0xd756b2,_0x5d064e){var _0x1e5ce1={'raw':!![],'where':{}};var _0x401968={};var _0x362999={'count':0x0,'rows':[]};return db[_0xbe14('0x23')][_0xbe14('0x52')]({'where':{'id':_0xd756b2[_0xbe14('0x2b')]['id']}})['then'](handleEntityNotFound(_0x5d064e,null))[_0xbe14('0x13')](function(_0x175213){if(_0x175213){_0x401968[_0xbe14('0x2c')]=_[_0xbe14('0x2d')](db['CmHopperHistory'][_0xbe14('0x24')]);_0x401968[_0xbe14('0x2e')]=_[_0xbe14('0x2d')](_0xd756b2[_0xbe14('0x2e')]);_0x401968[_0xbe14('0x48')]=_[_0xbe14('0x2f')](_0x401968[_0xbe14('0x2c')],_0x401968['query']);_0x1e5ce1[_0xbe14('0x30')]=_['intersection'](_0x401968[_0xbe14('0x2c')],qs['fields'](_0xd756b2[_0xbe14('0x2e')][_0xbe14('0x31')]));_0x1e5ce1[_0xbe14('0x30')]=_0x1e5ce1['attributes'][_0xbe14('0x32')]?_0x1e5ce1[_0xbe14('0x30')]:_0x401968[_0xbe14('0x2c')];if(!_0xd756b2['query'][_0xbe14('0x49')](_0xbe14('0x4a'))){_0x1e5ce1[_0xbe14('0xf')]=qs[_0xbe14('0xf')](_0xd756b2['query'][_0xbe14('0xf')]);_0x1e5ce1[_0xbe14('0xd')]=qs[_0xbe14('0xd')](_0xd756b2[_0xbe14('0x2e')][_0xbe14('0xd')]);}_0x1e5ce1[_0xbe14('0x4b')]=qs[_0xbe14('0x4c')](_0xd756b2['query'][_0xbe14('0x4c')]);_0x1e5ce1[_0xbe14('0x28')]=qs[_0xbe14('0x48')](_['pick'](_0xd756b2[_0xbe14('0x2e')],_0x401968[_0xbe14('0x48')]));_0x1e5ce1[_0xbe14('0x28')]['VoiceQueueId']=_0x175213['id'];if(_0xd756b2[_0xbe14('0x2e')][_0xbe14('0x19')]){_0x1e5ce1['where']=_[_0xbe14('0x40')](_0x1e5ce1['where'],{'$or':_[_0xbe14('0x1a')](_0x1e5ce1[_0xbe14('0x30')],function(_0x4dfa19){var _0x55d729={};_0x55d729[_0x4dfa19]={'$like':'%'+_0xd756b2[_0xbe14('0x2e')][_0xbe14('0x19')]+'%'};return _0x55d729;})});}_0x1e5ce1=_[_0xbe14('0x40')]({},_0x1e5ce1,_0xd756b2['options']);return db[_0xbe14('0x53')][_0xbe14('0x10')]({'where':_0x1e5ce1[_0xbe14('0x28')]})[_0xbe14('0x13')](function(_0x5ee624){_0x362999['count']=_0x5ee624;if(_0xd756b2[_0xbe14('0x2e')][_0xbe14('0x33')]){_0x1e5ce1[_0xbe14('0x29')]=[{'all':!![]}];}return db[_0xbe14('0x53')][_0xbe14('0x4f')](_0x1e5ce1);})[_0xbe14('0x13')](function(_0x139aab){_0x362999['rows']=_0x139aab;return _0x362999;});}})[_0xbe14('0x13')](respondWithFilteredResult(_0x5d064e,_0x1e5ce1))['catch'](handleError(_0x5d064e,null));};exports[_0xbe14('0x54')]=function(_0x3a01bb,_0x8d47f2){var _0x2382c4={'raw':!![],'where':{}};var _0x55a3ae={};var _0x1e160b={'count':0x0,'rows':[]};return db[_0xbe14('0x23')][_0xbe14('0x52')]({'where':{'id':_0x3a01bb['params']['id']}})[_0xbe14('0x13')](handleEntityNotFound(_0x8d47f2,null))[_0xbe14('0x13')](function(_0x4090bc){if(_0x4090bc){_0x55a3ae[_0xbe14('0x2c')]=_[_0xbe14('0x2d')](db[_0xbe14('0x55')][_0xbe14('0x24')]);_0x55a3ae[_0xbe14('0x2e')]=_[_0xbe14('0x2d')](_0x3a01bb[_0xbe14('0x2e')]);_0x55a3ae[_0xbe14('0x48')]=_[_0xbe14('0x2f')](_0x55a3ae[_0xbe14('0x2c')],_0x55a3ae[_0xbe14('0x2e')]);_0x2382c4[_0xbe14('0x30')]=_[_0xbe14('0x2f')](_0x55a3ae[_0xbe14('0x2c')],qs[_0xbe14('0x31')](_0x3a01bb[_0xbe14('0x2e')][_0xbe14('0x31')]));_0x2382c4['attributes']=_0x2382c4[_0xbe14('0x30')]['length']?_0x2382c4[_0xbe14('0x30')]:_0x55a3ae[_0xbe14('0x2c')];if(!_0x3a01bb[_0xbe14('0x2e')][_0xbe14('0x49')](_0xbe14('0x4a'))){_0x2382c4['limit']=qs['limit'](_0x3a01bb[_0xbe14('0x2e')][_0xbe14('0xf')]);_0x2382c4[_0xbe14('0xd')]=qs[_0xbe14('0xd')](_0x3a01bb['query'][_0xbe14('0xd')]);}_0x2382c4[_0xbe14('0x4b')]=qs['sort'](_0x3a01bb[_0xbe14('0x2e')][_0xbe14('0x4c')]);_0x2382c4[_0xbe14('0x28')]=qs[_0xbe14('0x48')](_['pick'](_0x3a01bb[_0xbe14('0x2e')],_0x55a3ae['filters']));_0x2382c4['where'][_0xbe14('0x4e')]=_0x4090bc['id'];if(_0x3a01bb[_0xbe14('0x2e')][_0xbe14('0x19')]){_0x2382c4[_0xbe14('0x28')]=_[_0xbe14('0x40')](_0x2382c4['where'],{'$or':_[_0xbe14('0x1a')](_0x2382c4[_0xbe14('0x30')],function(_0x5dc793){var _0x4e35ed={};_0x4e35ed[_0x5dc793]={'$like':'%'+_0x3a01bb[_0xbe14('0x2e')][_0xbe14('0x19')]+'%'};return _0x4e35ed;})});}_0x2382c4=_['merge']({},_0x2382c4,_0x3a01bb[_0xbe14('0x34')]);return db['CmHopperFinal'][_0xbe14('0x10')]({'where':_0x2382c4['where']})[_0xbe14('0x13')](function(_0x5d4431){_0x1e160b[_0xbe14('0x10')]=_0x5d4431;if(_0x3a01bb['query'][_0xbe14('0x33')]){_0x2382c4[_0xbe14('0x29')]=[{'all':!![]}];}return db['CmHopperFinal']['findAll'](_0x2382c4);})[_0xbe14('0x13')](function(_0x4db7e8){_0x1e160b['rows']=_0x4db7e8;return _0x1e160b;});}})[_0xbe14('0x13')](respondWithFilteredResult(_0x8d47f2,_0x2382c4))[_0xbe14('0x35')](handleError(_0x8d47f2,null));};exports[_0xbe14('0x56')]=function(_0x11c341,_0x1a780a){var _0x313a87={'raw':!![],'where':{}};var _0x30d2b0={};var _0x57ad22={'count':0x0,'rows':[]};return db[_0xbe14('0x23')][_0xbe14('0x52')]({'where':{'id':_0x11c341[_0xbe14('0x2b')]['id']}})[_0xbe14('0x13')](handleEntityNotFound(_0x1a780a,null))['then'](function(_0x26372a){if(_0x26372a){_0x30d2b0[_0xbe14('0x2c')]=_[_0xbe14('0x2d')](db['CmHopperBlack'][_0xbe14('0x24')]);_0x30d2b0[_0xbe14('0x2e')]=_['keys'](_0x11c341[_0xbe14('0x2e')]);_0x30d2b0['filters']=_[_0xbe14('0x2f')](_0x30d2b0[_0xbe14('0x2c')],_0x30d2b0[_0xbe14('0x2e')]);_0x313a87['attributes']=_[_0xbe14('0x2f')](_0x30d2b0['model'],qs[_0xbe14('0x31')](_0x11c341['query']['fields']));_0x313a87[_0xbe14('0x30')]=_0x313a87['attributes'][_0xbe14('0x32')]?_0x313a87['attributes']:_0x30d2b0[_0xbe14('0x2c')];if(!_0x11c341[_0xbe14('0x2e')][_0xbe14('0x49')](_0xbe14('0x4a'))){_0x313a87[_0xbe14('0xf')]=qs[_0xbe14('0xf')](_0x11c341[_0xbe14('0x2e')][_0xbe14('0xf')]);_0x313a87[_0xbe14('0xd')]=qs[_0xbe14('0xd')](_0x11c341[_0xbe14('0x2e')][_0xbe14('0xd')]);}_0x313a87[_0xbe14('0x4b')]=qs['sort'](_0x11c341[_0xbe14('0x2e')][_0xbe14('0x4c')]);_0x313a87[_0xbe14('0x28')]=qs[_0xbe14('0x48')](_[_0xbe14('0x4d')](_0x11c341['query'],_0x30d2b0['filters']));_0x313a87[_0xbe14('0x28')][_0xbe14('0x4e')]=_0x26372a['id'];if(_0x11c341[_0xbe14('0x2e')][_0xbe14('0x19')]){_0x313a87[_0xbe14('0x28')]=_[_0xbe14('0x40')](_0x313a87[_0xbe14('0x28')],{'$or':_[_0xbe14('0x1a')](_0x313a87[_0xbe14('0x30')],function(_0x26e7a7){var _0x761b3d={};_0x761b3d[_0x26e7a7]={'$like':'%'+_0x11c341[_0xbe14('0x2e')][_0xbe14('0x19')]+'%'};return _0x761b3d;})});}_0x313a87=_[_0xbe14('0x40')]({},_0x313a87,_0x11c341[_0xbe14('0x34')]);return db[_0xbe14('0x57')][_0xbe14('0x10')]({'where':_0x313a87[_0xbe14('0x28')]})[_0xbe14('0x13')](function(_0x28a1e9){_0x57ad22[_0xbe14('0x10')]=_0x28a1e9;if(_0x11c341[_0xbe14('0x2e')][_0xbe14('0x33')]){_0x313a87[_0xbe14('0x29')]=[{'all':!![]}];}return db[_0xbe14('0x57')]['findAll'](_0x313a87);})[_0xbe14('0x13')](function(_0x3303a4){_0x57ad22[_0xbe14('0x50')]=_0x3303a4;return _0x57ad22;});}})[_0xbe14('0x13')](respondWithFilteredResult(_0x1a780a,_0x313a87))[_0xbe14('0x35')](handleError(_0x1a780a,null));};exports[_0xbe14('0x58')]=function(_0x52b75d,_0x5b161c){var _0x165b7a={};var _0x4a44e0={};var _0x3730d1;var _0x4babba;return db[_0xbe14('0x23')]['findOne']({'where':{'id':_0x52b75d[_0xbe14('0x2b')]['id']}})[_0xbe14('0x13')](handleEntityNotFound(_0x5b161c,null))[_0xbe14('0x13')](function(_0x12498f){if(_0x12498f){_0x3730d1=_0x12498f;_0x4a44e0[_0xbe14('0x2c')]=_[_0xbe14('0x2d')](db[_0xbe14('0x59')][_0xbe14('0x24')]);_0x4a44e0[_0xbe14('0x2e')]=_['keys'](_0x52b75d[_0xbe14('0x2e')]);_0x4a44e0[_0xbe14('0x48')]=_[_0xbe14('0x2f')](_0x4a44e0[_0xbe14('0x2c')],_0x4a44e0['query']);_0x165b7a[_0xbe14('0x30')]=_['intersection'](_0x4a44e0[_0xbe14('0x2c')],qs['fields'](_0x52b75d[_0xbe14('0x2e')][_0xbe14('0x31')]));_0x165b7a[_0xbe14('0x30')]=_0x165b7a['attributes'][_0xbe14('0x32')]?_0x165b7a['attributes']:_0x4a44e0[_0xbe14('0x2c')];_0x165b7a[_0xbe14('0x4b')]=qs[_0xbe14('0x4c')](_0x52b75d[_0xbe14('0x2e')][_0xbe14('0x4c')]);_0x165b7a[_0xbe14('0x28')]=qs[_0xbe14('0x48')](_[_0xbe14('0x4d')](_0x52b75d[_0xbe14('0x2e')],_0x4a44e0['filters']));if(_0x52b75d[_0xbe14('0x2e')]['filter']){_0x165b7a[_0xbe14('0x28')]=_[_0xbe14('0x40')](_0x165b7a[_0xbe14('0x28')],{'$or':_['map'](_0x165b7a[_0xbe14('0x30')],function(_0x1c5fbc){var _0x219403={};_0x219403[_0x1c5fbc]={'$like':'%'+_0x52b75d[_0xbe14('0x2e')][_0xbe14('0x19')]+'%'};return _0x219403;})});}_0x165b7a=_['merge']({},_0x165b7a,_0x52b75d['options']);return _0x3730d1[_0xbe14('0x58')](_0x165b7a);}})['then'](function(_0x16b1c8){if(_0x16b1c8){_0x4babba=_0x16b1c8[_0xbe14('0x32')];if(!_0x52b75d[_0xbe14('0x2e')][_0xbe14('0x49')]('nolimit')){_0x165b7a[_0xbe14('0xf')]=qs[_0xbe14('0xf')](_0x52b75d['query'][_0xbe14('0xf')]);_0x165b7a[_0xbe14('0xd')]=qs[_0xbe14('0xd')](_0x52b75d[_0xbe14('0x2e')]['offset']);}return _0x3730d1[_0xbe14('0x58')](_0x165b7a);}})[_0xbe14('0x13')](function(_0x37aff6){if(_0x37aff6){return _0x37aff6?{'count':_0x4babba,'rows':_0x37aff6}:null;}})[_0xbe14('0x13')](respondWithResult(_0x5b161c,null))[_0xbe14('0x35')](handleError(_0x5b161c,null));};exports[_0xbe14('0x5a')]=function(_0x208fae,_0x310d42){var _0x9c229f=_0x208fae[_0xbe14('0x37')]['teams'];var _0xdb5515=_[_0xbe14('0x1a')](_0x9c229f,'id');return db[_0xbe14('0x59')][_0xbe14('0x4f')]({'where':{'id':_0xdb5515},'attributes':['id'],'include':[{'model':db['User'],'as':_0xbe14('0x5b'),'attributes':['id',_0xbe14('0x1e'),_0xbe14('0x5c'),'voicePause',_0xbe14('0x5d')],'raw':!![]}]})[_0xbe14('0x13')](function(_0x1ec868){if(_0x1ec868){var _0x1a7321=_[_0xbe14('0x5e')](_0x1ec868,function(_0x2306f6){var _0x426189=_0x2306f6['get']({'plain':!![]});_0x426189[_0xbe14('0x5b')]['forEach'](function(_0x24d528){_0x24d528[_0xbe14('0x5f')]=_[_0xbe14('0x1d')](_0x9c229f,{'id':_0x426189['id']})[_0xbe14('0x5f')];});return _0x426189[_0xbe14('0x5b')];});return db['VoiceQueue']['find']({'where':{'id':_0x208fae[_0xbe14('0x2b')]['id']}})[_0xbe14('0x13')](function(_0x29a892){return db[_0xbe14('0x60')]['transaction'](function(_0x46a251){return _0x29a892[_0xbe14('0x5a')](_0xdb5515,{'transaction':_0x46a251})[_0xbe14('0x13')](function(){return BPromise['each'](_0x9c229f,function(_0xe69b0e){return db['TeamVoiceQueue']['upsert']({'TeamId':_0xe69b0e['id'],'VoiceQueueId':_0x208fae[_0xbe14('0x2b')]['id'],'penalty':_0xe69b0e[_0xbe14('0x5f')]},{'transaction':_0x46a251});});})[_0xbe14('0x13')](function(){return BPromise['each'](_0x1a7321,function(_0x3ea9c2){return db[_0xbe14('0x61')]['findOrCreate']({'where':{'UserId':_0x3ea9c2['id'],'VoiceQueueId':_0x208fae[_0xbe14('0x2b')]['id']},'defaults':{'penalty':_0x3ea9c2[_0xbe14('0x5f')]},'transaction':_0x46a251});});})[_0xbe14('0x13')](function(){return BPromise['each'](_[_0xbe14('0x19')](_0x1a7321,{'online':!![]}),function(_0x1e2559){return db[_0xbe14('0x62')][_0xbe14('0x63')]({'membername':_0x1e2559[_0xbe14('0x1e')],'UserId':_0x1e2559['id'],'queue_name':_0x29a892['name'],'VoiceQueueId':_0x29a892['id'],'interface':_[_0xbe14('0x64')](_0x1e2559[_0xbe14('0x5d')])?util[_0xbe14('0x65')]('SIP/%s',_0x1e2559[_0xbe14('0x1e')]):_0x1e2559[_0xbe14('0x5d')],'paused':_0x1e2559[_0xbe14('0x66')]||![],'penalty':_0x1e2559[_0xbe14('0x5f')]},{'transaction':_0x46a251});});})[_0xbe14('0x13')](function(){_0x1a7321[_0xbe14('0x67')](function(_0x1b22a0){socket[_0xbe14('0x68')](_0xbe14('0x69'),{'UserId':_0x1b22a0['id'],'VoiceQueueId':_0x29a892['id']});});});});});}})[_0xbe14('0x13')](respondWithStatusCode(_0x310d42,null))[_0xbe14('0x35')](handleError(_0x310d42,null));};exports['removeTeams']=function(_0xf549ec,_0x2c3647){return db[_0xbe14('0x59')]['findAll']({'where':{'id':_0xf549ec[_0xbe14('0x2e')][_0xbe14('0x6a')]},'attributes':['id'],'include':[{'model':db[_0xbe14('0x6b')],'as':'Agents','attributes':['id'],'raw':!![]}]})[_0xbe14('0x13')](handleEntityNotFound(_0x2c3647,null))['then'](function(_0x2d4b18){var _0xcd8cf6=_['map'](_0x2d4b18,'id');var _0x269e5a=[];var _0x4c7e2b=[];var _0x587f58=squel[_0xbe14('0x6c')]();_0x587f58[_0xbe14('0x6d')](_0xbe14('0x6e'))[_0xbe14('0x6f')](_0xbe14('0x70'),'tq')[_0xbe14('0x71')]('user_has_teams','ut','ut.TeamId\x20=\x20tq.TeamId')[_0xbe14('0x28')](_0xbe14('0x72'),_0xf549ec[_0xbe14('0x2b')]['id']);for(var _0x3c23fc=0x0;_0x3c23fc<_0x2d4b18['length'];_0x3c23fc+=0x1){let _0x1d5333=_0x2d4b18[_0x3c23fc];for(var _0x4cb29c=0x0;_0x4cb29c<_0x1d5333[_0xbe14('0x5b')][_0xbe14('0x32')];_0x4cb29c+=0x1){let _0x5270b2=_0x1d5333[_0xbe14('0x5b')][_0x4cb29c];var _0x273df5=_0x587f58[_0xbe14('0x3f')]();_0x273df5[_0xbe14('0x28')](_0xbe14('0x73'),_0x5270b2['id']);_0x4c7e2b[_0xbe14('0x74')](db[_0xbe14('0x60')][_0xbe14('0x2e')](_0x273df5[_0xbe14('0x75')](),{'type':db[_0xbe14('0x60')][_0xbe14('0x76')][_0xbe14('0x77')]})['then'](function(_0x20f196){if(_0x20f196[_0xbe14('0x32')]===0x1){return _0x5270b2['id'];}else{var _0x1eb33b=_[_0xbe14('0x78')](_['map'](_0x20f196,_0xbe14('0x79')),function(_0xede1c1){return _['includes'](_0xcd8cf6,_0xede1c1);});if(_0x1eb33b){return _0x5270b2['id'];}}}));}}return BPromise[_0xbe14('0x7a')](_0x4c7e2b)[_0xbe14('0x13')](function(_0x11085c){_0x269e5a=_(_0x269e5a)['union'](_0x11085c)[_0xbe14('0x7b')]()[_0xbe14('0x1b')]();return db[_0xbe14('0x23')][_0xbe14('0x1d')]({'where':{'id':_0xf549ec[_0xbe14('0x2b')]['id']}})['then'](function(_0x23208d){return db[_0xbe14('0x60')][_0xbe14('0x7c')](function(_0x3f7732){return _0x23208d[_0xbe14('0x7d')](_0xf549ec['query'][_0xbe14('0x6a')],{'transaction':_0x3f7732})[_0xbe14('0x13')](function(){if(!_[_0xbe14('0x7e')](_0x269e5a)){return _0x23208d[_0xbe14('0x7f')](_0x269e5a,{'transaction':_0x3f7732})[_0xbe14('0x13')](function(){return db[_0xbe14('0x62')][_0xbe14('0x14')]({'where':{'VoiceQueueId':_0xf549ec[_0xbe14('0x2b')]['id'],'UserId':_0x269e5a},'transaction':_0x3f7732});});}})['then'](function(){_0x269e5a['forEach'](function(_0x129ef6){socket[_0xbe14('0x68')](_0xbe14('0x80'),{'UserId':_0x129ef6,'VoiceQueueId':_0x23208d['id']});});});});});});})[_0xbe14('0x13')](respondWithStatusCode(_0x2c3647,null))[_0xbe14('0x35')](handleError(_0x2c3647,null));};exports['addAgents']=function(_0x15c93c,_0xf6ff8){var _0x3eaabe,_0x1ea11a;return db[_0xbe14('0x23')][_0xbe14('0x1d')]({'where':{'id':_0x15c93c[_0xbe14('0x2b')]['id']}})[_0xbe14('0x13')](handleEntityNotFound(_0xf6ff8,null))['then'](function(_0xf6da38){if(_0xf6da38){_0x1ea11a=_0xf6da38;return _0xf6da38[_0xbe14('0x81')](_0x15c93c['body']['ids'],_[_0xbe14('0x41')](_0x15c93c['body'],[_0xbe14('0x6a'),'id'])||{})[_0xbe14('0x82')](function(_0x776e93){for(var _0x3f5ca3=0x0;_0x3f5ca3<_0x15c93c[_0xbe14('0x37')]['ids'][_0xbe14('0x32')];_0x3f5ca3+=0x1){socket[_0xbe14('0x68')](_0xbe14('0x69'),{'UserId':Number(_0x15c93c[_0xbe14('0x37')][_0xbe14('0x6a')][_0x3f5ca3]),'VoiceQueueId':Number(_0x15c93c[_0xbe14('0x2b')]['id'])});}return _0x776e93;});}})['then'](function(_0x4eea48){_0x3eaabe=_0x4eea48||[];if(_0x1ea11a){return db[_0xbe14('0x6b')]['findAll']({'where':{'id':_0x15c93c[_0xbe14('0x37')][_0xbe14('0x6a')]},'attributes':['id',_0xbe14('0x1e'),'online',_0xbe14('0x66'),_0xbe14('0x5d')],'raw':!![]});}})[_0xbe14('0x13')](function(_0x1ad15d){if(!_[_0xbe14('0x7e')](_0x1ad15d)){var _0x2e5106=[];for(var _0x156fb3=0x0;_0x156fb3<_0x1ad15d['length'];_0x156fb3++){if(_0x1ad15d[_0x156fb3][_0xbe14('0x5c')]){_0x2e5106['push'](db['UserVoiceQueueRt']['upsert']({'membername':_0x1ad15d[_0x156fb3]['name'],'UserId':_0x1ad15d[_0x156fb3]['id'],'queue_name':_0x1ea11a[_0xbe14('0x1e')],'VoiceQueueId':_0x1ea11a['id'],'interface':_[_0xbe14('0x64')](_0x1ad15d[_0x156fb3]['interface'])?util[_0xbe14('0x65')]('SIP/%s',_0x1ad15d[_0x156fb3][_0xbe14('0x1e')]):_0x1ad15d[_0x156fb3]['interface'],'paused':_0x1ad15d[_0x156fb3][_0xbe14('0x66')]||![],'penalty':_0x15c93c[_0xbe14('0x37')][_0xbe14('0x5f')]||0x0}));}}return BPromise[_0xbe14('0x7a')](_0x2e5106);}})[_0xbe14('0x13')](function(){return _0x3eaabe;})['then'](respondWithResult(_0xf6ff8,null))[_0xbe14('0x35')](handleError(_0xf6ff8,null));};exports[_0xbe14('0x7f')]=function(_0x3aaa54,_0x413893){return db['VoiceQueue']['find']({'where':{'id':_0x3aaa54['params']['id']}})[_0xbe14('0x13')](handleEntityNotFound(_0x413893,null))[_0xbe14('0x13')](function(_0x3826cf){if(_0x3826cf){return _0x3826cf[_0xbe14('0x7f')](_0x3aaa54[_0xbe14('0x2e')]['ids'])['then'](function(){if(_[_0xbe14('0x83')](_0x3aaa54[_0xbe14('0x2e')][_0xbe14('0x6a')])){for(var _0x26092b=0x0;_0x26092b<_0x3aaa54[_0xbe14('0x2e')]['ids'][_0xbe14('0x32')];_0x26092b+=0x1){socket['emit'](_0xbe14('0x80'),{'UserId':Number(_0x3aaa54[_0xbe14('0x2e')][_0xbe14('0x6a')][_0x26092b]),'VoiceQueueId':Number(_0x3aaa54[_0xbe14('0x2b')]['id'])});}}else{socket['emit'](_0xbe14('0x80'),{'UserId':Number(_0x3aaa54[_0xbe14('0x2e')][_0xbe14('0x6a')]),'VoiceQueueId':Number(_0x3aaa54[_0xbe14('0x2b')]['id'])});}});}})['then'](function(_0x44c341){return db[_0xbe14('0x62')][_0xbe14('0x14')]({'where':{'VoiceQueueId':_0x3aaa54['params']['id'],'UserId':_0x3aaa54['query'][_0xbe14('0x6a')]}})[_0xbe14('0x13')](function(){return _0x44c341;});})[_0xbe14('0x13')](respondWithStatusCode(_0x413893,null))['catch'](handleError(_0x413893,null));};exports[_0xbe14('0x84')]=function(_0x2f0d14,_0x180e61){var _0x952322={};var _0x3ae00b={};var _0x41962a;var _0x4ebf01;return db[_0xbe14('0x23')][_0xbe14('0x52')]({'where':{'id':_0x2f0d14[_0xbe14('0x2b')]['id']}})[_0xbe14('0x13')](handleEntityNotFound(_0x180e61,null))[_0xbe14('0x13')](function(_0x5f28dd){if(_0x5f28dd){_0x41962a=_0x5f28dd;_0x3ae00b['model']=_[_0xbe14('0x2d')](db['User'][_0xbe14('0x24')]);_0x3ae00b['query']=_[_0xbe14('0x2d')](_0x2f0d14[_0xbe14('0x2e')]);_0x3ae00b[_0xbe14('0x48')]=_['intersection'](_0x3ae00b[_0xbe14('0x2c')],_0x3ae00b[_0xbe14('0x2e')]);_0x952322[_0xbe14('0x30')]=_[_0xbe14('0x2f')](_0x3ae00b[_0xbe14('0x2c')],qs[_0xbe14('0x31')](_0x2f0d14[_0xbe14('0x2e')][_0xbe14('0x31')]));_0x952322[_0xbe14('0x30')]=_0x952322[_0xbe14('0x30')]['length']?_0x952322[_0xbe14('0x30')]:_0x3ae00b[_0xbe14('0x2c')];_0x952322[_0xbe14('0x4b')]=qs[_0xbe14('0x4c')](_0x2f0d14[_0xbe14('0x2e')][_0xbe14('0x4c')]);_0x952322[_0xbe14('0x28')]=qs[_0xbe14('0x48')](_['pick'](_0x2f0d14[_0xbe14('0x2e')],_0x3ae00b[_0xbe14('0x48')]));if(_0x2f0d14[_0xbe14('0x2e')][_0xbe14('0x19')]){_0x952322[_0xbe14('0x28')]=_[_0xbe14('0x40')](_0x952322['where'],{'$or':_['map'](_0x952322['attributes'],function(_0x598ccc){var _0x446b3f={};_0x446b3f[_0x598ccc]={'$like':'%'+_0x2f0d14[_0xbe14('0x2e')]['filter']+'%'};return _0x446b3f;})});}_0x952322=_[_0xbe14('0x40')]({},_0x952322,_0x2f0d14['options']);return _0x41962a[_0xbe14('0x84')](_0x952322);}})[_0xbe14('0x13')](function(_0x111ff0){if(_0x111ff0){_0x4ebf01=_0x111ff0[_0xbe14('0x32')];if(!_0x2f0d14[_0xbe14('0x2e')][_0xbe14('0x49')]('nolimit')){_0x952322[_0xbe14('0xf')]=qs[_0xbe14('0xf')](_0x2f0d14[_0xbe14('0x2e')][_0xbe14('0xf')]);_0x952322[_0xbe14('0xd')]=qs[_0xbe14('0xd')](_0x2f0d14[_0xbe14('0x2e')][_0xbe14('0xd')]);}return _0x41962a[_0xbe14('0x84')](_0x952322);}})['then'](function(_0x2eb5e6){if(_0x2eb5e6){return _0x2eb5e6?{'count':_0x4ebf01,'rows':_0x2eb5e6}:null;}})['then'](respondWithResult(_0x180e61,null))[_0xbe14('0x35')](handleError(_0x180e61,null));};exports['getMembers']=function(_0x49cddc,_0x3bdbf7){var _0x19a1ae={};var _0x167dee={};var _0x4f6252;var _0x4536b9;return db['VoiceQueue'][_0xbe14('0x52')]({'where':{'id':_0x49cddc['params']['id']}})[_0xbe14('0x13')](handleEntityNotFound(_0x3bdbf7,null))[_0xbe14('0x13')](function(_0x21f14e){if(_0x21f14e){_0x4f6252=_0x21f14e;_0x167dee[_0xbe14('0x2c')]=_[_0xbe14('0x2d')](db[_0xbe14('0x62')]['rawAttributes']);_0x167dee[_0xbe14('0x2e')]=_[_0xbe14('0x2d')](_0x49cddc['query']);_0x167dee['filters']=_['intersection'](_0x167dee[_0xbe14('0x2c')],_0x167dee[_0xbe14('0x2e')]);_0x19a1ae[_0xbe14('0x30')]=_[_0xbe14('0x2f')](_0x167dee[_0xbe14('0x2c')],qs[_0xbe14('0x31')](_0x49cddc[_0xbe14('0x2e')]['fields']));_0x19a1ae[_0xbe14('0x30')]=_0x19a1ae[_0xbe14('0x30')][_0xbe14('0x32')]?_0x19a1ae['attributes']:_0x167dee[_0xbe14('0x2c')];_0x19a1ae[_0xbe14('0x4b')]=qs[_0xbe14('0x4c')](_0x49cddc['query']['sort']);_0x19a1ae[_0xbe14('0x28')]=qs['filters'](_[_0xbe14('0x4d')](_0x49cddc[_0xbe14('0x2e')],_0x167dee[_0xbe14('0x48')]));if(_0x49cddc[_0xbe14('0x2e')][_0xbe14('0x19')]){_0x19a1ae[_0xbe14('0x28')]=_['merge'](_0x19a1ae[_0xbe14('0x28')],{'$or':_['map'](_0x19a1ae[_0xbe14('0x30')],function(_0x2d0568){var _0x26bb56={};_0x26bb56[_0x2d0568]={'$like':'%'+_0x49cddc['query'][_0xbe14('0x19')]+'%'};return _0x26bb56;})});}_0x19a1ae=_[_0xbe14('0x40')]({},_0x19a1ae,_0x49cddc['options']);return _0x4f6252['getMembers'](_0x19a1ae);}})[_0xbe14('0x13')](function(_0x3d9061){if(_0x3d9061){_0x4536b9=_0x3d9061[_0xbe14('0x32')];if(!_0x49cddc['query'][_0xbe14('0x49')](_0xbe14('0x4a'))){_0x19a1ae['limit']=qs['limit'](_0x49cddc['query']['limit']);_0x19a1ae[_0xbe14('0xd')]=qs[_0xbe14('0xd')](_0x49cddc['query']['offset']);}return _0x4f6252[_0xbe14('0x85')](_0x19a1ae);}})[_0xbe14('0x13')](function(_0x1046a0){return _0x1046a0?{'count':_0x4536b9,'rows':_0x1046a0}:null;})['then'](respondWithResult(_0x3bdbf7,null))[_0xbe14('0x35')](handleError(_0x3bdbf7,null));};exports[_0xbe14('0x86')]=function(_0x3933c7,_0x416c65){var _0x56f870={};var _0x28b3c4={};var _0x6fe862;var _0x5f4675;return db[_0xbe14('0x23')][_0xbe14('0x52')]({'where':{'id':_0x3933c7[_0xbe14('0x2b')]['id']}})[_0xbe14('0x13')](handleEntityNotFound(_0x416c65,null))[_0xbe14('0x13')](function(_0x4c4ab9){if(_0x4c4ab9){_0x6fe862=_0x4c4ab9;_0x28b3c4['model']=_[_0xbe14('0x2d')](db[_0xbe14('0x87')][_0xbe14('0x24')]);_0x28b3c4[_0xbe14('0x2e')]=_['keys'](_0x3933c7[_0xbe14('0x2e')]);_0x28b3c4[_0xbe14('0x48')]=_['intersection'](_0x28b3c4[_0xbe14('0x2c')],_0x28b3c4['query']);_0x56f870[_0xbe14('0x30')]=_[_0xbe14('0x2f')](_0x28b3c4['model'],qs[_0xbe14('0x31')](_0x3933c7[_0xbe14('0x2e')][_0xbe14('0x31')]));_0x56f870[_0xbe14('0x30')]=_0x56f870[_0xbe14('0x30')][_0xbe14('0x32')]?_0x56f870[_0xbe14('0x30')]:_0x28b3c4[_0xbe14('0x2c')];_0x56f870['order']=qs[_0xbe14('0x4c')](_0x3933c7[_0xbe14('0x2e')][_0xbe14('0x4c')]);_0x56f870['where']=qs['filters'](_['pick'](_0x3933c7[_0xbe14('0x2e')],_0x28b3c4[_0xbe14('0x48')]));if(_0x3933c7[_0xbe14('0x2e')]['filter']){_0x56f870['where']=_[_0xbe14('0x40')](_0x56f870[_0xbe14('0x28')],{'$or':_[_0xbe14('0x1a')](_0x56f870[_0xbe14('0x30')],function(_0x2ac6c0){var _0x3d381e={};_0x3d381e[_0x2ac6c0]={'$like':'%'+_0x3933c7[_0xbe14('0x2e')][_0xbe14('0x19')]+'%'};return _0x3d381e;})});}_0x56f870=_[_0xbe14('0x40')]({},_0x56f870,_0x3933c7['options']);return _0x6fe862[_0xbe14('0x86')](_0x56f870);}})[_0xbe14('0x13')](function(_0x2ca4de){if(_0x2ca4de){_0x5f4675=_0x2ca4de[_0xbe14('0x32')];if(!_0x3933c7[_0xbe14('0x2e')]['hasOwnProperty'](_0xbe14('0x4a'))){_0x56f870['limit']=qs['limit'](_0x3933c7[_0xbe14('0x2e')][_0xbe14('0xf')]);_0x56f870['offset']=qs['offset'](_0x3933c7[_0xbe14('0x2e')][_0xbe14('0xd')]);}return _0x6fe862[_0xbe14('0x86')](_0x56f870);}})[_0xbe14('0x13')](function(_0x2e7c31){if(_0x2e7c31){return _0x2e7c31?{'count':_0x5f4675,'rows':_0x2e7c31}:null;}})['then'](respondWithResult(_0x416c65,null))['catch'](handleError(_0x416c65,null));};exports[_0xbe14('0x88')]=function(_0x4b07fc,_0x76e84){var _0x3f687f=moment()['format']('YYYY-MM-DD\x20HH:mm:ss');var _0x4f4b69,_0x43d760;return db['VoiceQueue'][_0xbe14('0x1d')]({'where':{'id':_0x4b07fc[_0xbe14('0x2b')]['id']}})['then'](handleEntityNotFound(_0x76e84,null))[_0xbe14('0x13')](function(_0x30657c){if(_0x30657c){_0x43d760=_0x30657c;return _0x30657c[_0xbe14('0x88')](_0x4b07fc[_0xbe14('0x37')][_0xbe14('0x6a')],_['omit'](_0x4b07fc[_0xbe14('0x37')],[_0xbe14('0x6a'),'id'])||{});}return null;})[_0xbe14('0x82')](function(_0xd97d02){var _0x15082b;_0x4f4b69=_0xd97d02||[];var _0x5d15c7=[];if(_0xd97d02){for(var _0x66b6a7=0x0;_0x66b6a7<_0xd97d02[_0xbe14('0x32')];_0x66b6a7+=0x1){var _0x4dfe2c=_0xd97d02[_0x66b6a7][_0xbe14('0x15')]({'plain':!![]});_0x43d760['dialCheckDuplicateType']=_0x4b07fc[_0xbe14('0x37')][_0xbe14('0x89')]?_0x4b07fc[_0xbe14('0x37')][_0xbe14('0x89')]:_0x43d760[_0xbe14('0x89')];switch(_0x43d760[_0xbe14('0x89')]){case'always':_0x15082b=squel[_0xbe14('0x8a')]()[_0xbe14('0x8b')](_0xbe14('0x8c'))[_0xbe14('0x8d')]([_0xbe14('0x8e'),_0xbe14('0x8f'),_0xbe14('0x90'),_0xbe14('0x91'),_0xbe14('0x4e'),_0xbe14('0x42'),'updatedAt'],squel[_0xbe14('0x6c')]()[_0xbe14('0x6d')]('phone',_0xbe14('0x8e'))[_0xbe14('0x6d')]('\x27'+_0x3f687f+'\x27',_0xbe14('0x8f'))[_0xbe14('0x6d')]('id',_0xbe14('0x90'))[_0xbe14('0x6d')](_0x4dfe2c[_0xbe14('0x92')][_0xbe14('0x75')](),'ListId')[_0xbe14('0x6d')](_0x4b07fc['params']['id'][_0xbe14('0x75')](),_0xbe14('0x4e'))[_0xbe14('0x6d')]('\x27'+_0x3f687f+'\x27',_0xbe14('0x42'))[_0xbe14('0x6d')]('\x27'+_0x3f687f+'\x27',_0xbe14('0x43'))[_0xbe14('0x6f')]('cm_contacts')['where']('deletedAt\x20IS\x20NULL')[_0xbe14('0x28')](_0xbe14('0x93'),_0x4dfe2c['CmListId'][_0xbe14('0x75')]())[_0xbe14('0x28')](_0xbe14('0x94'))[_0xbe14('0x28')](_0xbe14('0x95'),squel[_0xbe14('0x6c')]()[_0xbe14('0x6d')](_0xbe14('0x96'))[_0xbe14('0x6f')](_0xbe14('0x97'))[_0xbe14('0x28')]('VoiceQueueId\x20=\x20?',_0x4b07fc[_0xbe14('0x2b')]['id']['toString']()))[_0xbe14('0x28')](_0xbe14('0x95'),squel[_0xbe14('0x6c')]()['field'](_0xbe14('0x98'))[_0xbe14('0x6f')]('cm_hopper')[_0xbe14('0x28')](_0xbe14('0x72'),_0x4b07fc[_0xbe14('0x2b')]['id']['toString']())))[_0xbe14('0x75')]();break;case _0xbe14('0x99'):_0x15082b=squel['insert']()[_0xbe14('0x8b')]('cm_hopper')[_0xbe14('0x8d')]([_0xbe14('0x8e'),_0xbe14('0x8f'),_0xbe14('0x90'),'ListId','VoiceQueueId',_0xbe14('0x42'),_0xbe14('0x43')],squel['select']()['field'](_0xbe14('0x8e'),'phone')[_0xbe14('0x6d')]('\x27'+_0x3f687f+'\x27',_0xbe14('0x8f'))[_0xbe14('0x6d')]('id',_0xbe14('0x90'))[_0xbe14('0x6d')](_0x4dfe2c[_0xbe14('0x92')][_0xbe14('0x75')](),_0xbe14('0x91'))[_0xbe14('0x6d')](_0x4b07fc[_0xbe14('0x2b')]['id']['toString'](),'VoiceQueueId')['field']('\x27'+_0x3f687f+'\x27',_0xbe14('0x42'))[_0xbe14('0x6d')]('\x27'+_0x3f687f+'\x27',_0xbe14('0x43'))[_0xbe14('0x6f')](_0xbe14('0x9a'))[_0xbe14('0x28')](_0xbe14('0x9b'))[_0xbe14('0x28')](_0xbe14('0x93'),_0x4dfe2c['CmListId'][_0xbe14('0x75')]())[_0xbe14('0x28')](_0xbe14('0x94'))['where'](_0xbe14('0x95'),squel[_0xbe14('0x6c')]()[_0xbe14('0x6d')](_0xbe14('0x98'))[_0xbe14('0x6f')](_0xbe14('0x8c'))[_0xbe14('0x28')]('VoiceQueueId\x20=\x20?',_0x4b07fc[_0xbe14('0x2b')]['id'][_0xbe14('0x75')]())))['toString']();break;default:_0x15082b=squel['insert']()[_0xbe14('0x8b')](_0xbe14('0x8c'))[_0xbe14('0x8d')](['phone',_0xbe14('0x8f'),_0xbe14('0x90'),_0xbe14('0x91'),_0xbe14('0x4e'),_0xbe14('0x42'),_0xbe14('0x43')],squel['select']()[_0xbe14('0x6d')]('phone',_0xbe14('0x8e'))[_0xbe14('0x6d')]('\x27'+_0x3f687f+'\x27',_0xbe14('0x8f'))['field']('id',_0xbe14('0x90'))[_0xbe14('0x6d')](_0x4dfe2c['CmListId'][_0xbe14('0x75')](),'ListId')[_0xbe14('0x6d')](_0x4b07fc['params']['id'][_0xbe14('0x75')](),'VoiceQueueId')[_0xbe14('0x6d')]('\x27'+_0x3f687f+'\x27',_0xbe14('0x42'))[_0xbe14('0x6d')]('\x27'+_0x3f687f+'\x27',_0xbe14('0x43'))[_0xbe14('0x6f')]('cm_contacts')[_0xbe14('0x28')](_0xbe14('0x9b'))['where'](_0xbe14('0x93'),_0x4dfe2c[_0xbe14('0x92')]['toString']())[_0xbe14('0x28')](_0xbe14('0x94')))[_0xbe14('0x75')]();}_0x5d15c7['push'](db[_0xbe14('0x60')][_0xbe14('0x2e')](_0x15082b));}return BPromise[_0xbe14('0x7a')](_0x5d15c7);}})[_0xbe14('0x13')](function(){var _0x4bc564=[];var _0x19e7ce=squel[_0xbe14('0x8a')]()[_0xbe14('0x8b')](_0xbe14('0x9c'))[_0xbe14('0x8d')]([_0xbe14('0x9d'),_0xbe14('0x8e'),_0xbe14('0x9e'),_0xbe14('0x42'),'updatedAt'],squel[_0xbe14('0x6c')]()['field']('h.id')[_0xbe14('0x6d')](_0xbe14('0x9f'))['field'](_0xbe14('0xa0'))[_0xbe14('0x6d')]('\x27'+_0x3f687f+'\x27','createdAt')[_0xbe14('0x6d')]('\x27'+_0x3f687f+'\x27',_0xbe14('0x43'))[_0xbe14('0x6f')](_0xbe14('0xa1'),'ci')[_0xbe14('0x71')](_0xbe14('0x8c'),'h','h.ContactId=ci.CmContactId')['where'](_0xbe14('0xa2'),_0x3f687f)['where'](_0xbe14('0xa3'),_0xbe14('0xa4')))['toString']();_0x4bc564[_0xbe14('0x74')](db[_0xbe14('0x60')][_0xbe14('0x2e')](_0x19e7ce));return BPromise[_0xbe14('0x7a')](_0x4bc564);})[_0xbe14('0x13')](function(){return _0x4f4b69;})[_0xbe14('0x13')](respondWithResult(_0x76e84,null))[_0xbe14('0x35')](handleError(_0x76e84,null));};exports['removeLists']=function(_0x4ceca6,_0x23f4a3){return db[_0xbe14('0x23')][_0xbe14('0x1d')]({'where':{'id':_0x4ceca6[_0xbe14('0x2b')]['id']}})[_0xbe14('0x13')](handleEntityNotFound(_0x23f4a3,null))[_0xbe14('0x13')](function(_0x2fe8b0){if(_0x2fe8b0){return _0x2fe8b0[_0xbe14('0xa5')](_0x4ceca6['query'][_0xbe14('0x6a')]);}})[_0xbe14('0x13')](function(_0x186284){if(_0x186284){return db['CmHopper'][_0xbe14('0x14')]({'where':{'ListId':_0x4ceca6[_0xbe14('0x2e')][_0xbe14('0x6a')],'VoiceQueueId':_0x4ceca6[_0xbe14('0x2b')]['id']}})[_0xbe14('0x13')](function(){return _0x186284;});}})['then'](respondWithStatusCode(_0x23f4a3,null))[_0xbe14('0x35')](handleError(_0x23f4a3,null));};exports[_0xbe14('0xa6')]=function(_0x4c9319,_0x1173f0){var _0x1e0c81={};var _0x5349a7={};var _0x5e3819;var _0x28c5fe;return db[_0xbe14('0x23')][_0xbe14('0x52')]({'where':{'id':_0x4c9319['params']['id']}})[_0xbe14('0x13')](handleEntityNotFound(_0x1173f0,null))[_0xbe14('0x13')](function(_0x59434a){if(_0x59434a){_0x5e3819=_0x59434a;_0x5349a7[_0xbe14('0x2c')]=_[_0xbe14('0x2d')](db[_0xbe14('0x87')]['rawAttributes']);_0x5349a7[_0xbe14('0x2e')]=_[_0xbe14('0x2d')](_0x4c9319[_0xbe14('0x2e')]);_0x5349a7[_0xbe14('0x48')]=_[_0xbe14('0x2f')](_0x5349a7[_0xbe14('0x2c')],_0x5349a7[_0xbe14('0x2e')]);_0x1e0c81[_0xbe14('0x30')]=_['intersection'](_0x5349a7[_0xbe14('0x2c')],qs[_0xbe14('0x31')](_0x4c9319[_0xbe14('0x2e')][_0xbe14('0x31')]));_0x1e0c81[_0xbe14('0x30')]=_0x1e0c81['attributes'][_0xbe14('0x32')]?_0x1e0c81[_0xbe14('0x30')]:_0x5349a7[_0xbe14('0x2c')];_0x1e0c81[_0xbe14('0x4b')]=qs[_0xbe14('0x4c')](_0x4c9319[_0xbe14('0x2e')]['sort']);_0x1e0c81['where']=qs['filters'](_[_0xbe14('0x4d')](_0x4c9319[_0xbe14('0x2e')],_0x5349a7['filters']));if(_0x4c9319[_0xbe14('0x2e')][_0xbe14('0x19')]){_0x1e0c81[_0xbe14('0x28')]=_[_0xbe14('0x40')](_0x1e0c81['where'],{'$or':_[_0xbe14('0x1a')](_0x1e0c81[_0xbe14('0x30')],function(_0x52bbc1){var _0x2797ef={};_0x2797ef[_0x52bbc1]={'$like':'%'+_0x4c9319['query']['filter']+'%'};return _0x2797ef;})});}_0x1e0c81=_[_0xbe14('0x40')]({},_0x1e0c81,_0x4c9319[_0xbe14('0x34')]);return _0x5e3819[_0xbe14('0xa6')](_0x1e0c81);}})[_0xbe14('0x13')](function(_0x47bba1){if(_0x47bba1){_0x28c5fe=_0x47bba1[_0xbe14('0x32')];if(!_0x4c9319[_0xbe14('0x2e')][_0xbe14('0x49')](_0xbe14('0x4a'))){_0x1e0c81['limit']=qs[_0xbe14('0xf')](_0x4c9319[_0xbe14('0x2e')][_0xbe14('0xf')]);_0x1e0c81[_0xbe14('0xd')]=qs[_0xbe14('0xd')](_0x4c9319[_0xbe14('0x2e')][_0xbe14('0xd')]);}return _0x5e3819[_0xbe14('0xa6')](_0x1e0c81);}})['then'](function(_0x2592ab){if(_0x2592ab){return _0x2592ab?{'count':_0x28c5fe,'rows':_0x2592ab}:null;}})[_0xbe14('0x13')](respondWithResult(_0x1173f0,null))['catch'](handleError(_0x1173f0,null));};exports['addBlackLists']=function(_0x6a0f29,_0x3d04b9){var _0x21f793;return db[_0xbe14('0x23')][_0xbe14('0x1d')]({'where':{'id':_0x6a0f29[_0xbe14('0x2b')]['id']}})['then'](handleEntityNotFound(_0x3d04b9,null))[_0xbe14('0x13')](function(_0x37e5e8){if(_0x37e5e8){return _0x37e5e8['addBlackLists'](_0x6a0f29[_0xbe14('0x37')][_0xbe14('0x6a')],_[_0xbe14('0x41')](_0x6a0f29[_0xbe14('0x37')],[_0xbe14('0x6a'),'id'])||{});}return null;})[_0xbe14('0x82')](function(_0x14cec7){var _0x524603;_0x21f793=_0x14cec7||[];var _0x38d720=[];if(_0x14cec7){for(var _0x379446=0x0;_0x379446<_0x14cec7[_0xbe14('0x32')];_0x379446+=0x1){var _0x1489c9=_0x14cec7[_0x379446][_0xbe14('0x15')]({'plain':!![]});_0x524603=squel[_0xbe14('0x8a')]()[_0xbe14('0x8b')](_0xbe14('0xa7'))['fromQuery']([_0xbe14('0x8e'),_0xbe14('0x90'),_0xbe14('0x91'),'VoiceQueueId',_0xbe14('0x42'),_0xbe14('0x43')],squel[_0xbe14('0x6c')]()['field'](_0xbe14('0x8e'),'phone')[_0xbe14('0x6d')]('id',_0xbe14('0x90'))[_0xbe14('0x6d')](_0x1489c9[_0xbe14('0x92')][_0xbe14('0x75')](),_0xbe14('0x91'))[_0xbe14('0x6d')](_0x6a0f29['params']['id'][_0xbe14('0x75')](),_0xbe14('0x4e'))[_0xbe14('0x6d')](_0xbe14('0xa8'),_0xbe14('0x42'))[_0xbe14('0x6d')](_0xbe14('0xa8'),'updatedAt')[_0xbe14('0x6f')](_0xbe14('0x9a'))[_0xbe14('0x28')](_0xbe14('0x9b'))[_0xbe14('0x28')](_0xbe14('0x93'),_0x1489c9[_0xbe14('0x92')][_0xbe14('0x75')]())[_0xbe14('0x28')](_0xbe14('0x94')))[_0xbe14('0x75')]();_0x38d720[_0xbe14('0x74')](db['sequelize'][_0xbe14('0x2e')](_0x524603));}return BPromise[_0xbe14('0x7a')](_0x38d720);}})['then'](function(){return _0x21f793;})['then'](respondWithResult(_0x3d04b9,null))[_0xbe14('0x35')](handleError(_0x3d04b9,null));};exports[_0xbe14('0xa9')]=function(_0x7533c3,_0x3ec670){return db[_0xbe14('0x23')][_0xbe14('0x1d')]({'where':{'id':_0x7533c3[_0xbe14('0x2b')]['id']}})[_0xbe14('0x13')](handleEntityNotFound(_0x3ec670,null))['then'](function(_0x3ee9e2){if(_0x3ee9e2){return _0x3ee9e2['removeBlackLists'](_0x7533c3[_0xbe14('0x2e')][_0xbe14('0x6a')]);}})[_0xbe14('0x13')](function(_0x1d343a){if(_0x1d343a){return db[_0xbe14('0x57')][_0xbe14('0x14')]({'where':{'ListId':_0x7533c3['query']['ids'],'VoiceQueueId':_0x7533c3['params']['id']}})['then'](function(){return _0x1d343a;});}})['then'](respondWithStatusCode(_0x3ec670,null))[_0xbe14('0x35')](handleError(_0x3ec670,null));}; \ No newline at end of file +var _0x5fc3=['redis','localhost','./voiceQueue.socket','register','sendStatus','end','status','offset','limit','undefined','count','set','Content-Range','json','update','then','get','VoiceQueues','inbound','QueueCampaigns','outbound','filter','ignore','map','value','type','find','UserProfileResource','destroy','stack','name','index','VoiceQueue','fieldName','getOptions','where','include','findAll','rows','catch','show','params','model','keys','query','intersection','attributes','length','includeAll','merge','options','create','body','user','Unable\x20to\x20retrieve\x20the\x20current\x20user','role','rawAttributes','fields','omit','createdAt','updatedAt','UserProfileSection','autoAssociation','error','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','getHoppers','CmHopper','filters','nolimit','order','sort','pick','VoiceQueueId','getHopperHistories','findOne','CmHopperHistory','hasOwnProperty','CmHopperFinal','getHopperBlacks','CmHopperBlack','getTeams','addTeams','teams','Team','online','voicePause','interface','flatMap','forEach','penalty','Agents','sequelize','transaction','upsert','findOrCreate','UserVoiceQueueRt','isNil','format','emit','ids','field','tq.TeamId','from','team_has_voice_queues','join','user_has_teams','ut.TeamId\x20=\x20tq.TeamId','VoiceQueueId\x20=\x20?','clone','ut.UserId\x20=\x20?','push','toString','QueryTypes','SELECT','every','TeamId','includes','all','removeTeams','isEmpty','removeAgents','userVoiceQueue:remove','addAgents','spread','userVoiceQueue:save','User','isArray','getAgents','getMembers','getLists','CmList','addLists','YYYY-MM-DD\x20HH:mm:ss','dialCheckDuplicateType','always','into','cm_hopper','fromQuery','scheduledAt','ContactId','ListId','phone','CmListId','cm_contacts','deletedAt\x20IS\x20NULL','ListId\x20=\x20?','phone\x20IS\x20NOT\x20NULL','phone\x20NOT\x20IN\x20(?)','select','COALESCE(calleridnum,\x27\x27)','cm_hopper_final','COALESCE(phone,\x27\x27)','onlyIfOpen','insert','cm_hopper_additional_phones','CmHopperId','OrderBy','ci.item','cm_contact_has_items','h.ContactId=ci.CmContactId','h.scheduledat=?','ci.ItemClass=?','PHONE','removeLists','getBlackLists','addBlackLists','NOW()','removeBlackLists','moment','bluebird','lodash','squel','ioredis','../../components/parsers/qs','../../config/logger','../../config/environment','../../mysqldb'];(function(_0x4df5dc,_0x4410b4){var _0x41ac39=function(_0x43f40a){while(--_0x43f40a){_0x4df5dc['push'](_0x4df5dc['shift']());}};_0x41ac39(++_0x4410b4);}(_0x5fc3,0xa8));var _0x35fc=function(_0x22663b,_0xc8c6e3){_0x22663b=_0x22663b-0x0;var _0x310d0a=_0x5fc3[_0x22663b];return _0x310d0a;};'use strict';var moment=require(_0x35fc('0x0'));var BPromise=require(_0x35fc('0x1'));var util=require('util');var _=require(_0x35fc('0x2'));var squel=require(_0x35fc('0x3'));var Redis=require(_0x35fc('0x4'));var qs=require(_0x35fc('0x5'));var logger=require(_0x35fc('0x6'))('api');var config=require(_0x35fc('0x7'));var db=require(_0x35fc('0x8'))['db'];config[_0x35fc('0x9')]=_['defaults'](config['redis'],{'host':_0x35fc('0xa'),'port':0x18eb});var socket=require('socket.io-emitter')(new Redis(config[_0x35fc('0x9')]));require(_0x35fc('0xb'))[_0x35fc('0xc')](socket);function respondWithStatusCode(_0x1e5f90,_0x34ff19){_0x34ff19=_0x34ff19||0xcc;return function(_0xf9d3a6){if(_0xf9d3a6){return _0x1e5f90[_0x35fc('0xd')](_0x34ff19);}return _0x1e5f90['status'](_0x34ff19)[_0x35fc('0xe')]();};}function respondWithResult(_0x2a1084,_0x4fdca1){_0x4fdca1=_0x4fdca1||0xc8;return function(_0x471549){if(_0x471549){return _0x2a1084[_0x35fc('0xf')](_0x4fdca1)['json'](_0x471549);}};}function respondWithFilteredResult(_0xda83fb,_0x1a9f2b){return function(_0x5469f5){if(_0x5469f5){var _0x4cbe74=typeof _0x1a9f2b[_0x35fc('0x10')]==='undefined'&&typeof _0x1a9f2b[_0x35fc('0x11')]===_0x35fc('0x12');var _0x2a6ad2=_0x5469f5[_0x35fc('0x13')];var _0x38d9f2=_0x4cbe74?0x0:_0x1a9f2b['offset'];var _0x59507a=_0x4cbe74?_0x5469f5['count']:_0x1a9f2b['offset']+_0x1a9f2b[_0x35fc('0x11')];var _0x229d56;if(_0x59507a>=_0x2a6ad2){_0x59507a=_0x2a6ad2;_0x229d56=0xc8;}else{_0x229d56=0xce;}_0xda83fb[_0x35fc('0xf')](_0x229d56);return _0xda83fb[_0x35fc('0x14')](_0x35fc('0x15'),_0x38d9f2+'-'+_0x59507a+'/'+_0x2a6ad2)[_0x35fc('0x16')](_0x5469f5);}return null;};}function saveUpdates(_0x480851){return function(_0x26ba54){if(_0x26ba54){return _0x26ba54[_0x35fc('0x17')](_0x480851)['then'](function(_0x41e165){return _0x41e165;});}return null;};}function removeEntity(_0x363e47){return function(_0x2e513b){if(_0x2e513b){return _0x2e513b['destroy']()[_0x35fc('0x18')](function(){var _0x3c58ea=_0x2e513b[_0x35fc('0x19')]({'plain':!![]});var _0x488234=[{'name':_0x35fc('0x1a'),'value':_0x35fc('0x1b'),'ignore':![]},{'name':_0x35fc('0x1c'),'value':_0x35fc('0x1d'),'ignore':![]}];var _0x20ffde=_(_0x488234)[_0x35fc('0x1e')](_0x35fc('0x1f'))[_0x35fc('0x20')](_0x35fc('0x21'))[_0x35fc('0x21')]();if(_['includes'](_0x20ffde,_0x3c58ea[_0x35fc('0x22')])){return;}var _0xd5399f=_[_0x35fc('0x23')](_0x488234,[_0x35fc('0x21'),_0x3c58ea[_0x35fc('0x22')]])['name'];return db[_0x35fc('0x24')][_0x35fc('0x25')]({'where':{'type':_0xd5399f,'resourceId':_0x3c58ea['id']}})['then'](function(){return _0x2e513b;});})[_0x35fc('0x18')](function(){_0x363e47[_0x35fc('0xf')](0xcc)[_0x35fc('0xe')]();});}};}function handleEntityNotFound(_0x51cfec){return function(_0x4086e9){if(!_0x4086e9){_0x51cfec['sendStatus'](0x194);}return _0x4086e9;};}function handleError(_0x1bf180,_0xdfab9f){_0xdfab9f=_0xdfab9f||0x1f4;return function(_0x5cb986){logger['error'](_0x5cb986[_0x35fc('0x26')]);if(_0x5cb986['name']){delete _0x5cb986[_0x35fc('0x27')];}_0x1bf180[_0x35fc('0xf')](_0xdfab9f)['send'](_0x5cb986);};}exports[_0x35fc('0x28')]=function(_0x645eac,_0x383837){var _0x9f3c8a={};var _0x3735da={'count':0x0,'rows':[]};var _0x134dfa=_[_0x35fc('0x20')](db[_0x35fc('0x29')]['rawAttributes'],function(_0x1cd1ae){return{'name':_0x1cd1ae[_0x35fc('0x2a')],'type':_0x1cd1ae[_0x35fc('0x22')]['key']};});_0x9f3c8a=qs[_0x35fc('0x2b')](_0x134dfa,_0x645eac);var _0x16f067={'where':_0x9f3c8a[_0x35fc('0x2c')]};return db[_0x35fc('0x29')][_0x35fc('0x13')](_0x16f067)[_0x35fc('0x18')](function(_0x222ddb){_0x3735da[_0x35fc('0x13')]=_0x222ddb;_0x9f3c8a[_0x35fc('0x2d')]=qs[_0x35fc('0x2d')](_0x645eac['query']);return db['VoiceQueue'][_0x35fc('0x2e')](_0x9f3c8a);})['then'](function(_0x37b394){_0x3735da[_0x35fc('0x2f')]=_0x37b394;return _0x3735da;})[_0x35fc('0x18')](respondWithFilteredResult(_0x383837,_0x9f3c8a))[_0x35fc('0x30')](handleError(_0x383837,null));};exports[_0x35fc('0x31')]=function(_0x12e78f,_0x4e43b4){var _0x3fe193={'raw':![],'where':{'id':_0x12e78f[_0x35fc('0x32')]['id']}},_0x330a14={};_0x330a14[_0x35fc('0x33')]=_[_0x35fc('0x34')](db[_0x35fc('0x29')]['rawAttributes']);_0x330a14[_0x35fc('0x35')]=_[_0x35fc('0x34')](_0x12e78f[_0x35fc('0x35')]);_0x330a14['filters']=_[_0x35fc('0x36')](_0x330a14['model'],_0x330a14[_0x35fc('0x35')]);_0x3fe193[_0x35fc('0x37')]=_[_0x35fc('0x36')](_0x330a14[_0x35fc('0x33')],qs['fields'](_0x12e78f['query']['fields']));_0x3fe193[_0x35fc('0x37')]=_0x3fe193['attributes'][_0x35fc('0x38')]?_0x3fe193['attributes']:_0x330a14[_0x35fc('0x33')];if(_0x12e78f[_0x35fc('0x35')][_0x35fc('0x39')]){_0x3fe193[_0x35fc('0x2d')]=[{'all':!![]}];}_0x3fe193=_[_0x35fc('0x3a')]({},_0x3fe193,_0x12e78f[_0x35fc('0x3b')]);return db[_0x35fc('0x29')]['find'](_0x3fe193)[_0x35fc('0x18')](handleEntityNotFound(_0x4e43b4,null))[_0x35fc('0x18')](respondWithResult(_0x4e43b4,null))['catch'](handleError(_0x4e43b4,null));};exports[_0x35fc('0x3c')]=function(_0x1ccc41,_0x1aac67){return db[_0x35fc('0x29')][_0x35fc('0x3c')](_0x1ccc41[_0x35fc('0x3d')],{})['then'](function(_0x3f6480){var _0x267858=_0x1ccc41[_0x35fc('0x3e')]['get']({'plain':!![]});if(!_0x267858)throw new Error(_0x35fc('0x3f'));if(_0x267858[_0x35fc('0x40')]==='user'){var _0x237548=_0x3f6480[_0x35fc('0x19')]({'plain':!![]});var _0x43b77c=[{'name':_0x35fc('0x1a'),'value':_0x35fc('0x1b')},{'name':_0x35fc('0x1c'),'value':_0x35fc('0x1d')}];var _0x3ec51f=_['find'](_0x43b77c,['value',_0x237548[_0x35fc('0x22')]])[_0x35fc('0x27')];return db['UserProfileSection']['find']({'where':{'name':_0x3ec51f,'userProfileId':_0x267858['userProfileId']},'raw':!![]})[_0x35fc('0x18')](function(_0x10f98b){if(_0x10f98b&&_0x10f98b['autoAssociation']===0x0){return db[_0x35fc('0x24')][_0x35fc('0x3c')]({'name':_0x237548[_0x35fc('0x27')],'resourceId':_0x237548['id'],'type':_0x10f98b[_0x35fc('0x27')],'sectionId':_0x10f98b['id']},{})['then'](function(){return _0x3f6480;});}else{return _0x3f6480;}})['catch'](function(_0x5bf2f4){logger['error']('Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s',_0x5bf2f4);throw _0x5bf2f4;});}return _0x3f6480;})[_0x35fc('0x18')](respondWithResult(_0x1aac67,0xc9))[_0x35fc('0x30')](handleError(_0x1aac67,null));};exports['clone']=function(_0x119925,_0x56cf1f){var _0x13d16c={'where':{'id':_0x119925[_0x35fc('0x32')]['id']}},_0x40797d={};_0x40797d[_0x35fc('0x33')]=_[_0x35fc('0x34')](db['VoiceQueue'][_0x35fc('0x41')]);_0x13d16c[_0x35fc('0x37')]=_['intersection'](_0x40797d[_0x35fc('0x33')],qs[_0x35fc('0x42')](_0x119925[_0x35fc('0x35')][_0x35fc('0x42')]));_0x13d16c['attributes']=_0x13d16c[_0x35fc('0x37')]['length']?_0x13d16c['attributes']:_0x40797d[_0x35fc('0x33')];if(_0x119925[_0x35fc('0x35')][_0x35fc('0x39')]){_0x13d16c[_0x35fc('0x2d')]=[{'all':!![]}];}_0x13d16c=_[_0x35fc('0x3a')]({},_0x13d16c,_0x119925[_0x35fc('0x3b')]);return db[_0x35fc('0x29')][_0x35fc('0x23')](_0x13d16c)['then'](handleEntityNotFound(_0x56cf1f,null))[_0x35fc('0x18')](function(_0x91d7c0){if(_0x91d7c0){var _0xeca02e=_0x91d7c0[_0x35fc('0x19')]({'plain':!![]});_0xeca02e=qs[_0x35fc('0x43')](_0xeca02e,['id',_0x35fc('0x44'),_0x35fc('0x45')]);_0x119925[_0x35fc('0x3d')]=_[_0x35fc('0x43')](_0x119925[_0x35fc('0x3d')],['id',_0x35fc('0x44'),_0x35fc('0x45')]);return db[_0x35fc('0x29')][_0x35fc('0x3c')](_['merge'](_0xeca02e,_0x119925['body']),{'include':_0x119925[_0x35fc('0x35')][_0x35fc('0x39')]?[{'all':!![]}]:undefined})[_0x35fc('0x18')](function(_0x2bf0b0){var _0x3ee296=_0x119925[_0x35fc('0x3e')]['get']({'plain':!![]});if(!_0x3ee296)throw new Error('Unable\x20to\x20retrieve\x20the\x20current\x20user');if(_0x3ee296[_0x35fc('0x40')]===_0x35fc('0x3e')){var _0x395d63=_0x2bf0b0[_0x35fc('0x19')]({'plain':!![]});var _0x5b2595=[{'name':_0x35fc('0x1a'),'value':_0x35fc('0x1b')},{'name':'QueueCampaigns','value':_0x35fc('0x1d')}];var _0x2536d3=_['find'](_0x5b2595,[_0x35fc('0x21'),_0x395d63[_0x35fc('0x22')]])[_0x35fc('0x27')];return db[_0x35fc('0x46')]['find']({'where':{'name':_0x2536d3,'userProfileId':_0x3ee296['userProfileId']},'raw':!![]})['then'](function(_0x240338){if(_0x240338&&_0x240338[_0x35fc('0x47')]===0x0){return db['UserProfileResource'][_0x35fc('0x3c')]({'name':_0x395d63[_0x35fc('0x27')],'resourceId':_0x395d63['id'],'type':_0x240338[_0x35fc('0x27')],'sectionId':_0x240338['id']},{})[_0x35fc('0x18')](function(){return _0x2bf0b0;});}else{return _0x2bf0b0;}})[_0x35fc('0x30')](function(_0x538be0){logger[_0x35fc('0x48')](_0x35fc('0x49'),_0x538be0);throw _0x538be0;});}return _0x2bf0b0;});}})[_0x35fc('0x18')](respondWithResult(_0x56cf1f,0xc9))['catch'](handleError(_0x56cf1f,null));};exports[_0x35fc('0x17')]=function(_0x1dbf5a,_0x47fb1a){if(_0x1dbf5a[_0x35fc('0x3d')]['id']){delete _0x1dbf5a[_0x35fc('0x3d')]['id'];}return db[_0x35fc('0x29')][_0x35fc('0x23')]({'where':{'id':_0x1dbf5a[_0x35fc('0x32')]['id']}})[_0x35fc('0x18')](handleEntityNotFound(_0x47fb1a,null))[_0x35fc('0x18')](saveUpdates(_0x1dbf5a[_0x35fc('0x3d')],null))['then'](respondWithResult(_0x47fb1a,null))[_0x35fc('0x30')](handleError(_0x47fb1a,null));};exports[_0x35fc('0x25')]=function(_0x303927,_0x4fabd4){return db[_0x35fc('0x29')]['find']({'where':{'id':_0x303927['params']['id']}})['then'](handleEntityNotFound(_0x4fabd4,null))[_0x35fc('0x18')](removeEntity(_0x4fabd4,null))[_0x35fc('0x30')](handleError(_0x4fabd4,null));};exports[_0x35fc('0x4a')]=function(_0x13901c,_0x3d06b8){var _0x4bbea0={'raw':![],'where':{}};var _0x579f5a={};var _0x5353ea={'count':0x0,'rows':[]};return db['VoiceQueue']['findOne']({'where':{'id':_0x13901c[_0x35fc('0x32')]['id']}})[_0x35fc('0x18')](handleEntityNotFound(_0x3d06b8,null))[_0x35fc('0x18')](function(_0x3ef680){if(_0x3ef680){_0x579f5a['model']=_[_0x35fc('0x34')](db[_0x35fc('0x4b')][_0x35fc('0x41')]);_0x579f5a[_0x35fc('0x35')]=_[_0x35fc('0x34')](_0x13901c[_0x35fc('0x35')]);_0x579f5a[_0x35fc('0x4c')]=_[_0x35fc('0x36')](_0x579f5a[_0x35fc('0x33')],_0x579f5a['query']);_0x4bbea0[_0x35fc('0x37')]=_['intersection'](_0x579f5a[_0x35fc('0x33')],qs[_0x35fc('0x42')](_0x13901c[_0x35fc('0x35')][_0x35fc('0x42')]));_0x4bbea0['attributes']=_0x4bbea0[_0x35fc('0x37')]['length']?_0x4bbea0['attributes']:_0x579f5a['model'];if(!_0x13901c[_0x35fc('0x35')]['hasOwnProperty'](_0x35fc('0x4d'))){_0x4bbea0['limit']=qs[_0x35fc('0x11')](_0x13901c['query'][_0x35fc('0x11')]);_0x4bbea0[_0x35fc('0x10')]=qs[_0x35fc('0x10')](_0x13901c[_0x35fc('0x35')]['offset']);}_0x4bbea0[_0x35fc('0x4e')]=qs[_0x35fc('0x4f')](_0x13901c[_0x35fc('0x35')]['sort']);_0x4bbea0[_0x35fc('0x2c')]=qs[_0x35fc('0x4c')](_[_0x35fc('0x50')](_0x13901c[_0x35fc('0x35')],_0x579f5a[_0x35fc('0x4c')]));_0x4bbea0[_0x35fc('0x2c')][_0x35fc('0x51')]=_0x3ef680['id'];if(_0x13901c[_0x35fc('0x35')]['filter']){_0x4bbea0[_0x35fc('0x2c')]=_[_0x35fc('0x3a')](_0x4bbea0[_0x35fc('0x2c')],{'$or':_['map'](_0x4bbea0[_0x35fc('0x37')],function(_0x1b76f0){var _0x586729={};_0x586729[_0x1b76f0]={'$like':'%'+_0x13901c['query'][_0x35fc('0x1e')]+'%'};return _0x586729;})});}_0x4bbea0=_['merge']({},_0x4bbea0,_0x13901c[_0x35fc('0x3b')]);return db[_0x35fc('0x4b')][_0x35fc('0x13')]({'where':_0x4bbea0[_0x35fc('0x2c')]})[_0x35fc('0x18')](function(_0x20ddc6){_0x5353ea[_0x35fc('0x13')]=_0x20ddc6;if(_0x13901c[_0x35fc('0x35')][_0x35fc('0x39')]){_0x4bbea0[_0x35fc('0x2d')]=[{'all':!![]}];}return db[_0x35fc('0x4b')][_0x35fc('0x2e')](_0x4bbea0);})[_0x35fc('0x18')](function(_0x9f034e){_0x5353ea[_0x35fc('0x2f')]=_0x9f034e;return _0x5353ea;});}})[_0x35fc('0x18')](respondWithFilteredResult(_0x3d06b8,_0x4bbea0))[_0x35fc('0x30')](handleError(_0x3d06b8,null));};exports[_0x35fc('0x52')]=function(_0x3b2160,_0x3f3f36){var _0x4ba1b0={'raw':!![],'where':{}};var _0x1797d0={};var _0x55cb69={'count':0x0,'rows':[]};return db[_0x35fc('0x29')][_0x35fc('0x53')]({'where':{'id':_0x3b2160[_0x35fc('0x32')]['id']}})[_0x35fc('0x18')](handleEntityNotFound(_0x3f3f36,null))[_0x35fc('0x18')](function(_0x3f56f4){if(_0x3f56f4){_0x1797d0[_0x35fc('0x33')]=_[_0x35fc('0x34')](db[_0x35fc('0x54')][_0x35fc('0x41')]);_0x1797d0[_0x35fc('0x35')]=_['keys'](_0x3b2160[_0x35fc('0x35')]);_0x1797d0[_0x35fc('0x4c')]=_[_0x35fc('0x36')](_0x1797d0[_0x35fc('0x33')],_0x1797d0[_0x35fc('0x35')]);_0x4ba1b0[_0x35fc('0x37')]=_['intersection'](_0x1797d0[_0x35fc('0x33')],qs[_0x35fc('0x42')](_0x3b2160[_0x35fc('0x35')][_0x35fc('0x42')]));_0x4ba1b0[_0x35fc('0x37')]=_0x4ba1b0[_0x35fc('0x37')][_0x35fc('0x38')]?_0x4ba1b0[_0x35fc('0x37')]:_0x1797d0[_0x35fc('0x33')];if(!_0x3b2160['query'][_0x35fc('0x55')]('nolimit')){_0x4ba1b0[_0x35fc('0x11')]=qs[_0x35fc('0x11')](_0x3b2160['query'][_0x35fc('0x11')]);_0x4ba1b0[_0x35fc('0x10')]=qs[_0x35fc('0x10')](_0x3b2160[_0x35fc('0x35')][_0x35fc('0x10')]);}_0x4ba1b0[_0x35fc('0x4e')]=qs[_0x35fc('0x4f')](_0x3b2160[_0x35fc('0x35')][_0x35fc('0x4f')]);_0x4ba1b0['where']=qs['filters'](_['pick'](_0x3b2160['query'],_0x1797d0[_0x35fc('0x4c')]));_0x4ba1b0[_0x35fc('0x2c')][_0x35fc('0x51')]=_0x3f56f4['id'];if(_0x3b2160[_0x35fc('0x35')][_0x35fc('0x1e')]){_0x4ba1b0['where']=_[_0x35fc('0x3a')](_0x4ba1b0[_0x35fc('0x2c')],{'$or':_[_0x35fc('0x20')](_0x4ba1b0[_0x35fc('0x37')],function(_0x584a58){var _0x15e936={};_0x15e936[_0x584a58]={'$like':'%'+_0x3b2160[_0x35fc('0x35')][_0x35fc('0x1e')]+'%'};return _0x15e936;})});}_0x4ba1b0=_['merge']({},_0x4ba1b0,_0x3b2160[_0x35fc('0x3b')]);return db[_0x35fc('0x54')][_0x35fc('0x13')]({'where':_0x4ba1b0[_0x35fc('0x2c')]})[_0x35fc('0x18')](function(_0x31d276){_0x55cb69[_0x35fc('0x13')]=_0x31d276;if(_0x3b2160[_0x35fc('0x35')]['includeAll']){_0x4ba1b0[_0x35fc('0x2d')]=[{'all':!![]}];}return db[_0x35fc('0x54')][_0x35fc('0x2e')](_0x4ba1b0);})[_0x35fc('0x18')](function(_0x221c5b){_0x55cb69[_0x35fc('0x2f')]=_0x221c5b;return _0x55cb69;});}})['then'](respondWithFilteredResult(_0x3f3f36,_0x4ba1b0))[_0x35fc('0x30')](handleError(_0x3f3f36,null));};exports['getHopperFinals']=function(_0x4855ee,_0x1a2da0){var _0x597670={'raw':!![],'where':{}};var _0x1246c7={};var _0x233b7d={'count':0x0,'rows':[]};return db[_0x35fc('0x29')]['findOne']({'where':{'id':_0x4855ee[_0x35fc('0x32')]['id']}})[_0x35fc('0x18')](handleEntityNotFound(_0x1a2da0,null))[_0x35fc('0x18')](function(_0x1beb46){if(_0x1beb46){_0x1246c7[_0x35fc('0x33')]=_['keys'](db['CmHopperFinal']['rawAttributes']);_0x1246c7[_0x35fc('0x35')]=_['keys'](_0x4855ee[_0x35fc('0x35')]);_0x1246c7[_0x35fc('0x4c')]=_[_0x35fc('0x36')](_0x1246c7[_0x35fc('0x33')],_0x1246c7['query']);_0x597670[_0x35fc('0x37')]=_[_0x35fc('0x36')](_0x1246c7[_0x35fc('0x33')],qs['fields'](_0x4855ee[_0x35fc('0x35')][_0x35fc('0x42')]));_0x597670[_0x35fc('0x37')]=_0x597670['attributes']['length']?_0x597670['attributes']:_0x1246c7[_0x35fc('0x33')];if(!_0x4855ee[_0x35fc('0x35')][_0x35fc('0x55')](_0x35fc('0x4d'))){_0x597670['limit']=qs[_0x35fc('0x11')](_0x4855ee[_0x35fc('0x35')]['limit']);_0x597670['offset']=qs[_0x35fc('0x10')](_0x4855ee[_0x35fc('0x35')][_0x35fc('0x10')]);}_0x597670['order']=qs['sort'](_0x4855ee[_0x35fc('0x35')][_0x35fc('0x4f')]);_0x597670['where']=qs[_0x35fc('0x4c')](_[_0x35fc('0x50')](_0x4855ee[_0x35fc('0x35')],_0x1246c7['filters']));_0x597670[_0x35fc('0x2c')][_0x35fc('0x51')]=_0x1beb46['id'];if(_0x4855ee[_0x35fc('0x35')][_0x35fc('0x1e')]){_0x597670['where']=_[_0x35fc('0x3a')](_0x597670[_0x35fc('0x2c')],{'$or':_[_0x35fc('0x20')](_0x597670['attributes'],function(_0x96dfc){var _0x26d242={};_0x26d242[_0x96dfc]={'$like':'%'+_0x4855ee[_0x35fc('0x35')]['filter']+'%'};return _0x26d242;})});}_0x597670=_[_0x35fc('0x3a')]({},_0x597670,_0x4855ee[_0x35fc('0x3b')]);return db['CmHopperFinal'][_0x35fc('0x13')]({'where':_0x597670[_0x35fc('0x2c')]})[_0x35fc('0x18')](function(_0x45eaae){_0x233b7d[_0x35fc('0x13')]=_0x45eaae;if(_0x4855ee[_0x35fc('0x35')][_0x35fc('0x39')]){_0x597670[_0x35fc('0x2d')]=[{'all':!![]}];}return db[_0x35fc('0x56')]['findAll'](_0x597670);})[_0x35fc('0x18')](function(_0x3fc6cc){_0x233b7d[_0x35fc('0x2f')]=_0x3fc6cc;return _0x233b7d;});}})[_0x35fc('0x18')](respondWithFilteredResult(_0x1a2da0,_0x597670))['catch'](handleError(_0x1a2da0,null));};exports[_0x35fc('0x57')]=function(_0x1808a3,_0x209d7a){var _0x7b633a={'raw':!![],'where':{}};var _0x4684b6={};var _0x319998={'count':0x0,'rows':[]};return db[_0x35fc('0x29')][_0x35fc('0x53')]({'where':{'id':_0x1808a3['params']['id']}})['then'](handleEntityNotFound(_0x209d7a,null))[_0x35fc('0x18')](function(_0xafa771){if(_0xafa771){_0x4684b6[_0x35fc('0x33')]=_['keys'](db[_0x35fc('0x58')][_0x35fc('0x41')]);_0x4684b6[_0x35fc('0x35')]=_[_0x35fc('0x34')](_0x1808a3['query']);_0x4684b6['filters']=_[_0x35fc('0x36')](_0x4684b6['model'],_0x4684b6[_0x35fc('0x35')]);_0x7b633a[_0x35fc('0x37')]=_['intersection'](_0x4684b6['model'],qs[_0x35fc('0x42')](_0x1808a3[_0x35fc('0x35')][_0x35fc('0x42')]));_0x7b633a['attributes']=_0x7b633a[_0x35fc('0x37')][_0x35fc('0x38')]?_0x7b633a[_0x35fc('0x37')]:_0x4684b6['model'];if(!_0x1808a3[_0x35fc('0x35')][_0x35fc('0x55')](_0x35fc('0x4d'))){_0x7b633a[_0x35fc('0x11')]=qs['limit'](_0x1808a3[_0x35fc('0x35')][_0x35fc('0x11')]);_0x7b633a[_0x35fc('0x10')]=qs[_0x35fc('0x10')](_0x1808a3[_0x35fc('0x35')][_0x35fc('0x10')]);}_0x7b633a['order']=qs[_0x35fc('0x4f')](_0x1808a3[_0x35fc('0x35')]['sort']);_0x7b633a[_0x35fc('0x2c')]=qs[_0x35fc('0x4c')](_['pick'](_0x1808a3[_0x35fc('0x35')],_0x4684b6[_0x35fc('0x4c')]));_0x7b633a[_0x35fc('0x2c')][_0x35fc('0x51')]=_0xafa771['id'];if(_0x1808a3[_0x35fc('0x35')]['filter']){_0x7b633a[_0x35fc('0x2c')]=_[_0x35fc('0x3a')](_0x7b633a[_0x35fc('0x2c')],{'$or':_['map'](_0x7b633a[_0x35fc('0x37')],function(_0x5a8641){var _0x58d3d5={};_0x58d3d5[_0x5a8641]={'$like':'%'+_0x1808a3[_0x35fc('0x35')][_0x35fc('0x1e')]+'%'};return _0x58d3d5;})});}_0x7b633a=_[_0x35fc('0x3a')]({},_0x7b633a,_0x1808a3[_0x35fc('0x3b')]);return db[_0x35fc('0x58')]['count']({'where':_0x7b633a[_0x35fc('0x2c')]})[_0x35fc('0x18')](function(_0x44683e){_0x319998['count']=_0x44683e;if(_0x1808a3[_0x35fc('0x35')][_0x35fc('0x39')]){_0x7b633a[_0x35fc('0x2d')]=[{'all':!![]}];}return db[_0x35fc('0x58')][_0x35fc('0x2e')](_0x7b633a);})['then'](function(_0x1a2d73){_0x319998[_0x35fc('0x2f')]=_0x1a2d73;return _0x319998;});}})['then'](respondWithFilteredResult(_0x209d7a,_0x7b633a))['catch'](handleError(_0x209d7a,null));};exports[_0x35fc('0x59')]=function(_0x44b356,_0x207336){var _0x2b16b2={};var _0x405a43={};var _0x2b2a87;var _0x8c80ca;return db['VoiceQueue']['findOne']({'where':{'id':_0x44b356[_0x35fc('0x32')]['id']}})[_0x35fc('0x18')](handleEntityNotFound(_0x207336,null))[_0x35fc('0x18')](function(_0x1a92fa){if(_0x1a92fa){_0x2b2a87=_0x1a92fa;_0x405a43[_0x35fc('0x33')]=_['keys'](db['Team'][_0x35fc('0x41')]);_0x405a43[_0x35fc('0x35')]=_[_0x35fc('0x34')](_0x44b356[_0x35fc('0x35')]);_0x405a43['filters']=_['intersection'](_0x405a43[_0x35fc('0x33')],_0x405a43[_0x35fc('0x35')]);_0x2b16b2[_0x35fc('0x37')]=_[_0x35fc('0x36')](_0x405a43['model'],qs['fields'](_0x44b356[_0x35fc('0x35')][_0x35fc('0x42')]));_0x2b16b2['attributes']=_0x2b16b2[_0x35fc('0x37')][_0x35fc('0x38')]?_0x2b16b2[_0x35fc('0x37')]:_0x405a43[_0x35fc('0x33')];_0x2b16b2[_0x35fc('0x4e')]=qs[_0x35fc('0x4f')](_0x44b356[_0x35fc('0x35')][_0x35fc('0x4f')]);_0x2b16b2[_0x35fc('0x2c')]=qs[_0x35fc('0x4c')](_[_0x35fc('0x50')](_0x44b356[_0x35fc('0x35')],_0x405a43[_0x35fc('0x4c')]));if(_0x44b356[_0x35fc('0x35')][_0x35fc('0x1e')]){_0x2b16b2[_0x35fc('0x2c')]=_['merge'](_0x2b16b2[_0x35fc('0x2c')],{'$or':_['map'](_0x2b16b2[_0x35fc('0x37')],function(_0x5d677a){var _0x5aa072={};_0x5aa072[_0x5d677a]={'$like':'%'+_0x44b356[_0x35fc('0x35')][_0x35fc('0x1e')]+'%'};return _0x5aa072;})});}_0x2b16b2=_[_0x35fc('0x3a')]({},_0x2b16b2,_0x44b356['options']);return _0x2b2a87[_0x35fc('0x59')](_0x2b16b2);}})[_0x35fc('0x18')](function(_0xe9c7c2){if(_0xe9c7c2){_0x8c80ca=_0xe9c7c2[_0x35fc('0x38')];if(!_0x44b356[_0x35fc('0x35')][_0x35fc('0x55')]('nolimit')){_0x2b16b2['limit']=qs[_0x35fc('0x11')](_0x44b356['query']['limit']);_0x2b16b2[_0x35fc('0x10')]=qs['offset'](_0x44b356['query']['offset']);}return _0x2b2a87[_0x35fc('0x59')](_0x2b16b2);}})['then'](function(_0x355154){if(_0x355154){return _0x355154?{'count':_0x8c80ca,'rows':_0x355154}:null;}})[_0x35fc('0x18')](respondWithResult(_0x207336,null))[_0x35fc('0x30')](handleError(_0x207336,null));};exports[_0x35fc('0x5a')]=function(_0x392212,_0x201dfa){var _0x4ab6f9=_0x392212['body'][_0x35fc('0x5b')];var _0x5994ec=_[_0x35fc('0x20')](_0x4ab6f9,'id');return db[_0x35fc('0x5c')]['findAll']({'where':{'id':_0x5994ec},'attributes':['id'],'include':[{'model':db['User'],'as':'Agents','attributes':['id',_0x35fc('0x27'),_0x35fc('0x5d'),_0x35fc('0x5e'),_0x35fc('0x5f')],'raw':!![]}]})[_0x35fc('0x18')](function(_0x28525f){if(_0x28525f){var _0x9116b1=_[_0x35fc('0x60')](_0x28525f,function(_0x4818ea){var _0x5436a3=_0x4818ea['get']({'plain':!![]});_0x5436a3['Agents'][_0x35fc('0x61')](function(_0x4c9c90){_0x4c9c90[_0x35fc('0x62')]=_['find'](_0x4ab6f9,{'id':_0x5436a3['id']})[_0x35fc('0x62')];});return _0x5436a3[_0x35fc('0x63')];});return db['VoiceQueue']['find']({'where':{'id':_0x392212[_0x35fc('0x32')]['id']}})[_0x35fc('0x18')](function(_0x10ef95){return db[_0x35fc('0x64')][_0x35fc('0x65')](function(_0x4ff80c){return _0x10ef95['addTeams'](_0x5994ec,{'transaction':_0x4ff80c})[_0x35fc('0x18')](function(){return BPromise['each'](_0x4ab6f9,function(_0x15b6be){return db['TeamVoiceQueue'][_0x35fc('0x66')]({'TeamId':_0x15b6be['id'],'VoiceQueueId':_0x392212[_0x35fc('0x32')]['id'],'penalty':_0x15b6be[_0x35fc('0x62')]},{'transaction':_0x4ff80c});});})[_0x35fc('0x18')](function(){return BPromise['each'](_0x9116b1,function(_0x29a77a){return db['UserVoiceQueue'][_0x35fc('0x67')]({'where':{'UserId':_0x29a77a['id'],'VoiceQueueId':_0x392212['params']['id']},'defaults':{'penalty':_0x29a77a['penalty']},'transaction':_0x4ff80c});});})[_0x35fc('0x18')](function(){return BPromise['each'](_[_0x35fc('0x1e')](_0x9116b1,{'online':!![]}),function(_0x2c8361){return db[_0x35fc('0x68')][_0x35fc('0x66')]({'membername':_0x2c8361[_0x35fc('0x27')],'UserId':_0x2c8361['id'],'queue_name':_0x10ef95[_0x35fc('0x27')],'VoiceQueueId':_0x10ef95['id'],'interface':_[_0x35fc('0x69')](_0x2c8361[_0x35fc('0x5f')])?util[_0x35fc('0x6a')]('SIP/%s',_0x2c8361[_0x35fc('0x27')]):_0x2c8361[_0x35fc('0x5f')],'paused':_0x2c8361[_0x35fc('0x5e')]||![],'penalty':_0x2c8361[_0x35fc('0x62')]},{'transaction':_0x4ff80c});});})[_0x35fc('0x18')](function(){_0x9116b1[_0x35fc('0x61')](function(_0x4020ae){socket[_0x35fc('0x6b')]('userVoiceQueue:save',{'UserId':_0x4020ae['id'],'VoiceQueueId':_0x10ef95['id']});});});});});}})['then'](respondWithStatusCode(_0x201dfa,null))['catch'](handleError(_0x201dfa,null));};exports['removeTeams']=function(_0x5c8419,_0x271087){return db[_0x35fc('0x5c')][_0x35fc('0x2e')]({'where':{'id':_0x5c8419[_0x35fc('0x35')][_0x35fc('0x6c')]},'attributes':['id'],'include':[{'model':db['User'],'as':_0x35fc('0x63'),'attributes':['id'],'raw':!![]}]})[_0x35fc('0x18')](handleEntityNotFound(_0x271087,null))[_0x35fc('0x18')](function(_0x2f450e){var _0x370e99=_['map'](_0x2f450e,'id');var _0x195ca3=[];var _0x398359=[];var _0x4188bc=squel['select']();_0x4188bc[_0x35fc('0x6d')](_0x35fc('0x6e'))[_0x35fc('0x6f')](_0x35fc('0x70'),'tq')[_0x35fc('0x71')](_0x35fc('0x72'),'ut',_0x35fc('0x73'))[_0x35fc('0x2c')](_0x35fc('0x74'),_0x5c8419[_0x35fc('0x32')]['id']);for(var _0x3aba1c=0x0;_0x3aba1c<_0x2f450e[_0x35fc('0x38')];_0x3aba1c+=0x1){let _0x225eb1=_0x2f450e[_0x3aba1c];for(var _0x206f0b=0x0;_0x206f0b<_0x225eb1[_0x35fc('0x63')]['length'];_0x206f0b+=0x1){let _0x4ae3d8=_0x225eb1[_0x35fc('0x63')][_0x206f0b];var _0x6a0c44=_0x4188bc[_0x35fc('0x75')]();_0x6a0c44[_0x35fc('0x2c')](_0x35fc('0x76'),_0x4ae3d8['id']);_0x398359[_0x35fc('0x77')](db[_0x35fc('0x64')][_0x35fc('0x35')](_0x6a0c44[_0x35fc('0x78')](),{'type':db[_0x35fc('0x64')][_0x35fc('0x79')][_0x35fc('0x7a')]})[_0x35fc('0x18')](function(_0x336c4a){if(_0x336c4a[_0x35fc('0x38')]===0x1){return _0x4ae3d8['id'];}else{var _0x5824a0=_[_0x35fc('0x7b')](_[_0x35fc('0x20')](_0x336c4a,_0x35fc('0x7c')),function(_0x34e007){return _[_0x35fc('0x7d')](_0x370e99,_0x34e007);});if(_0x5824a0){return _0x4ae3d8['id'];}}}));}}return BPromise[_0x35fc('0x7e')](_0x398359)[_0x35fc('0x18')](function(_0xa4c51a){_0x195ca3=_(_0x195ca3)['union'](_0xa4c51a)['compact']()[_0x35fc('0x21')]();return db[_0x35fc('0x29')]['find']({'where':{'id':_0x5c8419[_0x35fc('0x32')]['id']}})[_0x35fc('0x18')](function(_0x43a794){return db[_0x35fc('0x64')]['transaction'](function(_0x42912c){return _0x43a794[_0x35fc('0x7f')](_0x5c8419[_0x35fc('0x35')][_0x35fc('0x6c')],{'transaction':_0x42912c})['then'](function(){if(!_[_0x35fc('0x80')](_0x195ca3)){return _0x43a794[_0x35fc('0x81')](_0x195ca3,{'transaction':_0x42912c})['then'](function(){return db[_0x35fc('0x68')][_0x35fc('0x25')]({'where':{'VoiceQueueId':_0x5c8419[_0x35fc('0x32')]['id'],'UserId':_0x195ca3},'transaction':_0x42912c});});}})['then'](function(){_0x195ca3[_0x35fc('0x61')](function(_0x4de072){socket[_0x35fc('0x6b')](_0x35fc('0x82'),{'UserId':_0x4de072,'VoiceQueueId':_0x43a794['id']});});});});});});})['then'](respondWithStatusCode(_0x271087,null))[_0x35fc('0x30')](handleError(_0x271087,null));};exports[_0x35fc('0x83')]=function(_0x139065,_0x25aedf){var _0x316d37,_0x3fd897;return db[_0x35fc('0x29')]['find']({'where':{'id':_0x139065['params']['id']}})[_0x35fc('0x18')](handleEntityNotFound(_0x25aedf,null))[_0x35fc('0x18')](function(_0x2463dd){if(_0x2463dd){_0x3fd897=_0x2463dd;return _0x2463dd[_0x35fc('0x83')](_0x139065[_0x35fc('0x3d')][_0x35fc('0x6c')],_[_0x35fc('0x43')](_0x139065['body'],[_0x35fc('0x6c'),'id'])||{})[_0x35fc('0x84')](function(_0x46b9b6){for(var _0x4cdc31=0x0;_0x4cdc31<_0x139065[_0x35fc('0x3d')][_0x35fc('0x6c')][_0x35fc('0x38')];_0x4cdc31+=0x1){socket[_0x35fc('0x6b')](_0x35fc('0x85'),{'UserId':Number(_0x139065[_0x35fc('0x3d')][_0x35fc('0x6c')][_0x4cdc31]),'VoiceQueueId':Number(_0x139065[_0x35fc('0x32')]['id'])});}return _0x46b9b6;});}})[_0x35fc('0x18')](function(_0x14e414){_0x316d37=_0x14e414||[];if(_0x3fd897){return db[_0x35fc('0x86')][_0x35fc('0x2e')]({'where':{'id':_0x139065[_0x35fc('0x3d')][_0x35fc('0x6c')]},'attributes':['id',_0x35fc('0x27'),_0x35fc('0x5d'),_0x35fc('0x5e'),_0x35fc('0x5f')],'raw':!![]});}})[_0x35fc('0x18')](function(_0x4949ed){if(!_[_0x35fc('0x80')](_0x4949ed)){var _0x4f74ff=[];for(var _0x28cbc8=0x0;_0x28cbc8<_0x4949ed[_0x35fc('0x38')];_0x28cbc8++){if(_0x4949ed[_0x28cbc8]['online']){_0x4f74ff[_0x35fc('0x77')](db[_0x35fc('0x68')][_0x35fc('0x66')]({'membername':_0x4949ed[_0x28cbc8][_0x35fc('0x27')],'UserId':_0x4949ed[_0x28cbc8]['id'],'queue_name':_0x3fd897[_0x35fc('0x27')],'VoiceQueueId':_0x3fd897['id'],'interface':_[_0x35fc('0x69')](_0x4949ed[_0x28cbc8][_0x35fc('0x5f')])?util[_0x35fc('0x6a')]('SIP/%s',_0x4949ed[_0x28cbc8][_0x35fc('0x27')]):_0x4949ed[_0x28cbc8][_0x35fc('0x5f')],'paused':_0x4949ed[_0x28cbc8][_0x35fc('0x5e')]||![],'penalty':_0x139065[_0x35fc('0x3d')]['penalty']||0x0}));}}return BPromise['all'](_0x4f74ff);}})['then'](function(){return _0x316d37;})['then'](respondWithResult(_0x25aedf,null))[_0x35fc('0x30')](handleError(_0x25aedf,null));};exports['removeAgents']=function(_0xcbabdf,_0x2475d6){return db[_0x35fc('0x29')][_0x35fc('0x23')]({'where':{'id':_0xcbabdf[_0x35fc('0x32')]['id']}})[_0x35fc('0x18')](handleEntityNotFound(_0x2475d6,null))[_0x35fc('0x18')](function(_0x41cbaa){if(_0x41cbaa){return _0x41cbaa[_0x35fc('0x81')](_0xcbabdf[_0x35fc('0x35')][_0x35fc('0x6c')])[_0x35fc('0x18')](function(){if(_[_0x35fc('0x87')](_0xcbabdf['query'][_0x35fc('0x6c')])){for(var _0x3e8580=0x0;_0x3e8580<_0xcbabdf[_0x35fc('0x35')][_0x35fc('0x6c')]['length'];_0x3e8580+=0x1){socket[_0x35fc('0x6b')](_0x35fc('0x82'),{'UserId':Number(_0xcbabdf[_0x35fc('0x35')][_0x35fc('0x6c')][_0x3e8580]),'VoiceQueueId':Number(_0xcbabdf[_0x35fc('0x32')]['id'])});}}else{socket[_0x35fc('0x6b')](_0x35fc('0x82'),{'UserId':Number(_0xcbabdf[_0x35fc('0x35')][_0x35fc('0x6c')]),'VoiceQueueId':Number(_0xcbabdf[_0x35fc('0x32')]['id'])});}});}})[_0x35fc('0x18')](function(_0xa39c4c){return db[_0x35fc('0x68')][_0x35fc('0x25')]({'where':{'VoiceQueueId':_0xcbabdf[_0x35fc('0x32')]['id'],'UserId':_0xcbabdf[_0x35fc('0x35')][_0x35fc('0x6c')]}})[_0x35fc('0x18')](function(){return _0xa39c4c;});})[_0x35fc('0x18')](respondWithStatusCode(_0x2475d6,null))[_0x35fc('0x30')](handleError(_0x2475d6,null));};exports[_0x35fc('0x88')]=function(_0x11d0f4,_0x4f150a){var _0x12238e={};var _0x16b52f={};var _0x238242;var _0x452f30;return db[_0x35fc('0x29')]['findOne']({'where':{'id':_0x11d0f4[_0x35fc('0x32')]['id']}})['then'](handleEntityNotFound(_0x4f150a,null))[_0x35fc('0x18')](function(_0x156c24){if(_0x156c24){_0x238242=_0x156c24;_0x16b52f[_0x35fc('0x33')]=_[_0x35fc('0x34')](db[_0x35fc('0x86')][_0x35fc('0x41')]);_0x16b52f[_0x35fc('0x35')]=_[_0x35fc('0x34')](_0x11d0f4[_0x35fc('0x35')]);_0x16b52f[_0x35fc('0x4c')]=_[_0x35fc('0x36')](_0x16b52f[_0x35fc('0x33')],_0x16b52f[_0x35fc('0x35')]);_0x12238e[_0x35fc('0x37')]=_[_0x35fc('0x36')](_0x16b52f[_0x35fc('0x33')],qs[_0x35fc('0x42')](_0x11d0f4[_0x35fc('0x35')][_0x35fc('0x42')]));_0x12238e[_0x35fc('0x37')]=_0x12238e['attributes'][_0x35fc('0x38')]?_0x12238e[_0x35fc('0x37')]:_0x16b52f[_0x35fc('0x33')];_0x12238e['order']=qs[_0x35fc('0x4f')](_0x11d0f4[_0x35fc('0x35')]['sort']);_0x12238e['where']=qs['filters'](_[_0x35fc('0x50')](_0x11d0f4[_0x35fc('0x35')],_0x16b52f['filters']));if(_0x11d0f4[_0x35fc('0x35')][_0x35fc('0x1e')]){_0x12238e[_0x35fc('0x2c')]=_[_0x35fc('0x3a')](_0x12238e[_0x35fc('0x2c')],{'$or':_[_0x35fc('0x20')](_0x12238e['attributes'],function(_0x13534c){var _0x3be339={};_0x3be339[_0x13534c]={'$like':'%'+_0x11d0f4[_0x35fc('0x35')][_0x35fc('0x1e')]+'%'};return _0x3be339;})});}_0x12238e=_[_0x35fc('0x3a')]({},_0x12238e,_0x11d0f4['options']);return _0x238242[_0x35fc('0x88')](_0x12238e);}})[_0x35fc('0x18')](function(_0x52f355){if(_0x52f355){_0x452f30=_0x52f355[_0x35fc('0x38')];if(!_0x11d0f4[_0x35fc('0x35')][_0x35fc('0x55')](_0x35fc('0x4d'))){_0x12238e[_0x35fc('0x11')]=qs[_0x35fc('0x11')](_0x11d0f4[_0x35fc('0x35')][_0x35fc('0x11')]);_0x12238e[_0x35fc('0x10')]=qs['offset'](_0x11d0f4[_0x35fc('0x35')][_0x35fc('0x10')]);}return _0x238242['getAgents'](_0x12238e);}})[_0x35fc('0x18')](function(_0x4ffbf9){if(_0x4ffbf9){return _0x4ffbf9?{'count':_0x452f30,'rows':_0x4ffbf9}:null;}})[_0x35fc('0x18')](respondWithResult(_0x4f150a,null))[_0x35fc('0x30')](handleError(_0x4f150a,null));};exports[_0x35fc('0x89')]=function(_0x206491,_0x536837){var _0x3cfbd4={};var _0x3ac7fb={};var _0x3916e7;var _0x4bcc53;return db[_0x35fc('0x29')]['findOne']({'where':{'id':_0x206491[_0x35fc('0x32')]['id']}})[_0x35fc('0x18')](handleEntityNotFound(_0x536837,null))[_0x35fc('0x18')](function(_0x3da024){if(_0x3da024){_0x3916e7=_0x3da024;_0x3ac7fb[_0x35fc('0x33')]=_[_0x35fc('0x34')](db[_0x35fc('0x68')][_0x35fc('0x41')]);_0x3ac7fb[_0x35fc('0x35')]=_[_0x35fc('0x34')](_0x206491[_0x35fc('0x35')]);_0x3ac7fb[_0x35fc('0x4c')]=_[_0x35fc('0x36')](_0x3ac7fb[_0x35fc('0x33')],_0x3ac7fb[_0x35fc('0x35')]);_0x3cfbd4['attributes']=_[_0x35fc('0x36')](_0x3ac7fb[_0x35fc('0x33')],qs[_0x35fc('0x42')](_0x206491[_0x35fc('0x35')][_0x35fc('0x42')]));_0x3cfbd4[_0x35fc('0x37')]=_0x3cfbd4[_0x35fc('0x37')]['length']?_0x3cfbd4['attributes']:_0x3ac7fb['model'];_0x3cfbd4['order']=qs[_0x35fc('0x4f')](_0x206491['query'][_0x35fc('0x4f')]);_0x3cfbd4[_0x35fc('0x2c')]=qs[_0x35fc('0x4c')](_[_0x35fc('0x50')](_0x206491[_0x35fc('0x35')],_0x3ac7fb[_0x35fc('0x4c')]));if(_0x206491['query'][_0x35fc('0x1e')]){_0x3cfbd4['where']=_[_0x35fc('0x3a')](_0x3cfbd4['where'],{'$or':_['map'](_0x3cfbd4[_0x35fc('0x37')],function(_0x472e13){var _0x2d0512={};_0x2d0512[_0x472e13]={'$like':'%'+_0x206491['query']['filter']+'%'};return _0x2d0512;})});}_0x3cfbd4=_['merge']({},_0x3cfbd4,_0x206491['options']);return _0x3916e7[_0x35fc('0x89')](_0x3cfbd4);}})[_0x35fc('0x18')](function(_0x131db6){if(_0x131db6){_0x4bcc53=_0x131db6[_0x35fc('0x38')];if(!_0x206491[_0x35fc('0x35')][_0x35fc('0x55')](_0x35fc('0x4d'))){_0x3cfbd4[_0x35fc('0x11')]=qs[_0x35fc('0x11')](_0x206491['query']['limit']);_0x3cfbd4[_0x35fc('0x10')]=qs[_0x35fc('0x10')](_0x206491[_0x35fc('0x35')][_0x35fc('0x10')]);}return _0x3916e7[_0x35fc('0x89')](_0x3cfbd4);}})[_0x35fc('0x18')](function(_0x4f4c68){return _0x4f4c68?{'count':_0x4bcc53,'rows':_0x4f4c68}:null;})[_0x35fc('0x18')](respondWithResult(_0x536837,null))[_0x35fc('0x30')](handleError(_0x536837,null));};exports[_0x35fc('0x8a')]=function(_0x4f9a00,_0x5c097d){var _0x11c117={};var _0x26b1cb={};var _0x84e749;var _0x4f9685;return db[_0x35fc('0x29')][_0x35fc('0x53')]({'where':{'id':_0x4f9a00[_0x35fc('0x32')]['id']}})['then'](handleEntityNotFound(_0x5c097d,null))[_0x35fc('0x18')](function(_0x546d2e){if(_0x546d2e){_0x84e749=_0x546d2e;_0x26b1cb[_0x35fc('0x33')]=_['keys'](db[_0x35fc('0x8b')][_0x35fc('0x41')]);_0x26b1cb['query']=_[_0x35fc('0x34')](_0x4f9a00[_0x35fc('0x35')]);_0x26b1cb['filters']=_[_0x35fc('0x36')](_0x26b1cb[_0x35fc('0x33')],_0x26b1cb[_0x35fc('0x35')]);_0x11c117[_0x35fc('0x37')]=_[_0x35fc('0x36')](_0x26b1cb[_0x35fc('0x33')],qs['fields'](_0x4f9a00[_0x35fc('0x35')][_0x35fc('0x42')]));_0x11c117[_0x35fc('0x37')]=_0x11c117[_0x35fc('0x37')][_0x35fc('0x38')]?_0x11c117['attributes']:_0x26b1cb[_0x35fc('0x33')];_0x11c117[_0x35fc('0x4e')]=qs[_0x35fc('0x4f')](_0x4f9a00[_0x35fc('0x35')][_0x35fc('0x4f')]);_0x11c117[_0x35fc('0x2c')]=qs[_0x35fc('0x4c')](_[_0x35fc('0x50')](_0x4f9a00[_0x35fc('0x35')],_0x26b1cb['filters']));if(_0x4f9a00[_0x35fc('0x35')][_0x35fc('0x1e')]){_0x11c117[_0x35fc('0x2c')]=_['merge'](_0x11c117[_0x35fc('0x2c')],{'$or':_['map'](_0x11c117[_0x35fc('0x37')],function(_0x413a4b){var _0x599121={};_0x599121[_0x413a4b]={'$like':'%'+_0x4f9a00[_0x35fc('0x35')][_0x35fc('0x1e')]+'%'};return _0x599121;})});}_0x11c117=_[_0x35fc('0x3a')]({},_0x11c117,_0x4f9a00[_0x35fc('0x3b')]);return _0x84e749[_0x35fc('0x8a')](_0x11c117);}})[_0x35fc('0x18')](function(_0x411d09){if(_0x411d09){_0x4f9685=_0x411d09['length'];if(!_0x4f9a00[_0x35fc('0x35')][_0x35fc('0x55')](_0x35fc('0x4d'))){_0x11c117['limit']=qs['limit'](_0x4f9a00[_0x35fc('0x35')][_0x35fc('0x11')]);_0x11c117[_0x35fc('0x10')]=qs[_0x35fc('0x10')](_0x4f9a00[_0x35fc('0x35')][_0x35fc('0x10')]);}return _0x84e749[_0x35fc('0x8a')](_0x11c117);}})[_0x35fc('0x18')](function(_0x214f01){if(_0x214f01){return _0x214f01?{'count':_0x4f9685,'rows':_0x214f01}:null;}})[_0x35fc('0x18')](respondWithResult(_0x5c097d,null))[_0x35fc('0x30')](handleError(_0x5c097d,null));};exports[_0x35fc('0x8c')]=function(_0xae43b4,_0x3c5524){var _0x2ceb04=moment()[_0x35fc('0x6a')](_0x35fc('0x8d'));var _0x605f3b,_0x43bb43;return db['VoiceQueue'][_0x35fc('0x23')]({'where':{'id':_0xae43b4['params']['id']}})['then'](handleEntityNotFound(_0x3c5524,null))[_0x35fc('0x18')](function(_0x1d7881){if(_0x1d7881){_0x43bb43=_0x1d7881;return _0x1d7881[_0x35fc('0x8c')](_0xae43b4[_0x35fc('0x3d')][_0x35fc('0x6c')],_[_0x35fc('0x43')](_0xae43b4[_0x35fc('0x3d')],[_0x35fc('0x6c'),'id'])||{});}return null;})[_0x35fc('0x84')](function(_0x3e0ebb){var _0x138fe5;_0x605f3b=_0x3e0ebb||[];var _0x3033a0=[];if(_0x3e0ebb){for(var _0x228bb9=0x0;_0x228bb9<_0x3e0ebb[_0x35fc('0x38')];_0x228bb9+=0x1){var _0x163afe=_0x3e0ebb[_0x228bb9][_0x35fc('0x19')]({'plain':!![]});_0x43bb43[_0x35fc('0x8e')]=_0xae43b4[_0x35fc('0x3d')][_0x35fc('0x8e')]?_0xae43b4[_0x35fc('0x3d')]['dialCheckDuplicateType']:_0x43bb43[_0x35fc('0x8e')];switch(_0x43bb43[_0x35fc('0x8e')]){case _0x35fc('0x8f'):_0x138fe5=squel['insert']()[_0x35fc('0x90')](_0x35fc('0x91'))[_0x35fc('0x92')](['phone',_0x35fc('0x93'),_0x35fc('0x94'),_0x35fc('0x95'),'VoiceQueueId',_0x35fc('0x44'),_0x35fc('0x45')],squel['select']()[_0x35fc('0x6d')](_0x35fc('0x96'),_0x35fc('0x96'))[_0x35fc('0x6d')]('\x27'+_0x2ceb04+'\x27','scheduledAt')['field']('id','ContactId')[_0x35fc('0x6d')](_0x163afe[_0x35fc('0x97')]['toString'](),_0x35fc('0x95'))[_0x35fc('0x6d')](_0xae43b4[_0x35fc('0x32')]['id'][_0x35fc('0x78')](),_0x35fc('0x51'))['field']('\x27'+_0x2ceb04+'\x27',_0x35fc('0x44'))[_0x35fc('0x6d')]('\x27'+_0x2ceb04+'\x27','updatedAt')[_0x35fc('0x6f')](_0x35fc('0x98'))[_0x35fc('0x2c')](_0x35fc('0x99'))[_0x35fc('0x2c')](_0x35fc('0x9a'),_0x163afe[_0x35fc('0x97')][_0x35fc('0x78')]())['where'](_0x35fc('0x9b'))['where'](_0x35fc('0x9c'),squel[_0x35fc('0x9d')]()[_0x35fc('0x6d')](_0x35fc('0x9e'))[_0x35fc('0x6f')](_0x35fc('0x9f'))['where']('VoiceQueueId\x20=\x20?',_0xae43b4['params']['id'][_0x35fc('0x78')]()))[_0x35fc('0x2c')](_0x35fc('0x9c'),squel['select']()[_0x35fc('0x6d')](_0x35fc('0xa0'))[_0x35fc('0x6f')](_0x35fc('0x91'))[_0x35fc('0x2c')](_0x35fc('0x74'),_0xae43b4[_0x35fc('0x32')]['id'][_0x35fc('0x78')]())))[_0x35fc('0x78')]();break;case _0x35fc('0xa1'):_0x138fe5=squel[_0x35fc('0xa2')]()['into'](_0x35fc('0x91'))[_0x35fc('0x92')](['phone',_0x35fc('0x93'),_0x35fc('0x94'),'ListId','VoiceQueueId',_0x35fc('0x44'),_0x35fc('0x45')],squel[_0x35fc('0x9d')]()[_0x35fc('0x6d')](_0x35fc('0x96'),_0x35fc('0x96'))[_0x35fc('0x6d')]('\x27'+_0x2ceb04+'\x27',_0x35fc('0x93'))['field']('id',_0x35fc('0x94'))[_0x35fc('0x6d')](_0x163afe[_0x35fc('0x97')]['toString'](),_0x35fc('0x95'))['field'](_0xae43b4[_0x35fc('0x32')]['id'][_0x35fc('0x78')](),_0x35fc('0x51'))[_0x35fc('0x6d')]('\x27'+_0x2ceb04+'\x27',_0x35fc('0x44'))['field']('\x27'+_0x2ceb04+'\x27',_0x35fc('0x45'))['from']('cm_contacts')[_0x35fc('0x2c')](_0x35fc('0x99'))[_0x35fc('0x2c')]('ListId\x20=\x20?',_0x163afe[_0x35fc('0x97')][_0x35fc('0x78')]())[_0x35fc('0x2c')](_0x35fc('0x9b'))[_0x35fc('0x2c')](_0x35fc('0x9c'),squel[_0x35fc('0x9d')]()['field']('COALESCE(phone,\x27\x27)')[_0x35fc('0x6f')](_0x35fc('0x91'))['where'](_0x35fc('0x74'),_0xae43b4['params']['id'][_0x35fc('0x78')]())))[_0x35fc('0x78')]();break;default:_0x138fe5=squel[_0x35fc('0xa2')]()[_0x35fc('0x90')]('cm_hopper')[_0x35fc('0x92')](['phone',_0x35fc('0x93'),_0x35fc('0x94'),_0x35fc('0x95'),'VoiceQueueId',_0x35fc('0x44'),_0x35fc('0x45')],squel[_0x35fc('0x9d')]()[_0x35fc('0x6d')](_0x35fc('0x96'),_0x35fc('0x96'))['field']('\x27'+_0x2ceb04+'\x27',_0x35fc('0x93'))[_0x35fc('0x6d')]('id','ContactId')[_0x35fc('0x6d')](_0x163afe['CmListId']['toString'](),'ListId')[_0x35fc('0x6d')](_0xae43b4[_0x35fc('0x32')]['id'][_0x35fc('0x78')](),_0x35fc('0x51'))[_0x35fc('0x6d')]('\x27'+_0x2ceb04+'\x27',_0x35fc('0x44'))[_0x35fc('0x6d')]('\x27'+_0x2ceb04+'\x27',_0x35fc('0x45'))[_0x35fc('0x6f')](_0x35fc('0x98'))[_0x35fc('0x2c')](_0x35fc('0x99'))['where'](_0x35fc('0x9a'),_0x163afe[_0x35fc('0x97')][_0x35fc('0x78')]())[_0x35fc('0x2c')](_0x35fc('0x9b')))[_0x35fc('0x78')]();}_0x3033a0[_0x35fc('0x77')](db['sequelize'][_0x35fc('0x35')](_0x138fe5));}return BPromise['all'](_0x3033a0);}})[_0x35fc('0x18')](function(){var _0x477d70=[];var _0x28533f=squel['insert']()[_0x35fc('0x90')](_0x35fc('0xa3'))[_0x35fc('0x92')]([_0x35fc('0xa4'),_0x35fc('0x96'),_0x35fc('0xa5'),'createdAt',_0x35fc('0x45')],squel['select']()[_0x35fc('0x6d')]('h.id')['field'](_0x35fc('0xa6'))[_0x35fc('0x6d')]('ci.OrderBy+1')[_0x35fc('0x6d')]('\x27'+_0x2ceb04+'\x27',_0x35fc('0x44'))[_0x35fc('0x6d')]('\x27'+_0x2ceb04+'\x27','updatedAt')[_0x35fc('0x6f')](_0x35fc('0xa7'),'ci')[_0x35fc('0x71')]('cm_hopper','h',_0x35fc('0xa8'))[_0x35fc('0x2c')](_0x35fc('0xa9'),_0x2ceb04)[_0x35fc('0x2c')](_0x35fc('0xaa'),_0x35fc('0xab')))[_0x35fc('0x78')]();_0x477d70[_0x35fc('0x77')](db[_0x35fc('0x64')][_0x35fc('0x35')](_0x28533f));return BPromise[_0x35fc('0x7e')](_0x477d70);})[_0x35fc('0x18')](function(){return _0x605f3b;})[_0x35fc('0x18')](respondWithResult(_0x3c5524,null))[_0x35fc('0x30')](handleError(_0x3c5524,null));};exports['removeLists']=function(_0x57b3f1,_0x8fa3cf){return db[_0x35fc('0x29')][_0x35fc('0x23')]({'where':{'id':_0x57b3f1[_0x35fc('0x32')]['id']}})[_0x35fc('0x18')](handleEntityNotFound(_0x8fa3cf,null))[_0x35fc('0x18')](function(_0x293c2d){if(_0x293c2d){return _0x293c2d[_0x35fc('0xac')](_0x57b3f1[_0x35fc('0x35')][_0x35fc('0x6c')]);}})['then'](function(_0x4860b4){if(_0x4860b4){return db[_0x35fc('0x4b')][_0x35fc('0x25')]({'where':{'ListId':_0x57b3f1[_0x35fc('0x35')][_0x35fc('0x6c')],'VoiceQueueId':_0x57b3f1[_0x35fc('0x32')]['id']}})[_0x35fc('0x18')](function(){return _0x4860b4;});}})[_0x35fc('0x18')](respondWithStatusCode(_0x8fa3cf,null))[_0x35fc('0x30')](handleError(_0x8fa3cf,null));};exports[_0x35fc('0xad')]=function(_0x55d140,_0x488cea){var _0x1a5f12={};var _0x4c40e5={};var _0x3afdf3;var _0x3b64de;return db['VoiceQueue'][_0x35fc('0x53')]({'where':{'id':_0x55d140['params']['id']}})[_0x35fc('0x18')](handleEntityNotFound(_0x488cea,null))[_0x35fc('0x18')](function(_0xa46452){if(_0xa46452){_0x3afdf3=_0xa46452;_0x4c40e5[_0x35fc('0x33')]=_[_0x35fc('0x34')](db['CmList'][_0x35fc('0x41')]);_0x4c40e5[_0x35fc('0x35')]=_[_0x35fc('0x34')](_0x55d140['query']);_0x4c40e5[_0x35fc('0x4c')]=_[_0x35fc('0x36')](_0x4c40e5[_0x35fc('0x33')],_0x4c40e5['query']);_0x1a5f12[_0x35fc('0x37')]=_[_0x35fc('0x36')](_0x4c40e5[_0x35fc('0x33')],qs[_0x35fc('0x42')](_0x55d140[_0x35fc('0x35')][_0x35fc('0x42')]));_0x1a5f12[_0x35fc('0x37')]=_0x1a5f12[_0x35fc('0x37')][_0x35fc('0x38')]?_0x1a5f12[_0x35fc('0x37')]:_0x4c40e5[_0x35fc('0x33')];_0x1a5f12[_0x35fc('0x4e')]=qs[_0x35fc('0x4f')](_0x55d140[_0x35fc('0x35')][_0x35fc('0x4f')]);_0x1a5f12[_0x35fc('0x2c')]=qs[_0x35fc('0x4c')](_[_0x35fc('0x50')](_0x55d140[_0x35fc('0x35')],_0x4c40e5[_0x35fc('0x4c')]));if(_0x55d140['query'][_0x35fc('0x1e')]){_0x1a5f12[_0x35fc('0x2c')]=_['merge'](_0x1a5f12[_0x35fc('0x2c')],{'$or':_[_0x35fc('0x20')](_0x1a5f12[_0x35fc('0x37')],function(_0x55c126){var _0x9e7561={};_0x9e7561[_0x55c126]={'$like':'%'+_0x55d140[_0x35fc('0x35')][_0x35fc('0x1e')]+'%'};return _0x9e7561;})});}_0x1a5f12=_[_0x35fc('0x3a')]({},_0x1a5f12,_0x55d140[_0x35fc('0x3b')]);return _0x3afdf3[_0x35fc('0xad')](_0x1a5f12);}})[_0x35fc('0x18')](function(_0x5545e9){if(_0x5545e9){_0x3b64de=_0x5545e9[_0x35fc('0x38')];if(!_0x55d140[_0x35fc('0x35')][_0x35fc('0x55')](_0x35fc('0x4d'))){_0x1a5f12[_0x35fc('0x11')]=qs[_0x35fc('0x11')](_0x55d140[_0x35fc('0x35')][_0x35fc('0x11')]);_0x1a5f12['offset']=qs['offset'](_0x55d140[_0x35fc('0x35')][_0x35fc('0x10')]);}return _0x3afdf3['getBlackLists'](_0x1a5f12);}})[_0x35fc('0x18')](function(_0x2c1181){if(_0x2c1181){return _0x2c1181?{'count':_0x3b64de,'rows':_0x2c1181}:null;}})[_0x35fc('0x18')](respondWithResult(_0x488cea,null))[_0x35fc('0x30')](handleError(_0x488cea,null));};exports[_0x35fc('0xae')]=function(_0x3f7fd7,_0x5e16f1){var _0xa46ffd;return db[_0x35fc('0x29')][_0x35fc('0x23')]({'where':{'id':_0x3f7fd7[_0x35fc('0x32')]['id']}})[_0x35fc('0x18')](handleEntityNotFound(_0x5e16f1,null))[_0x35fc('0x18')](function(_0x4abeb5){if(_0x4abeb5){return _0x4abeb5[_0x35fc('0xae')](_0x3f7fd7[_0x35fc('0x3d')][_0x35fc('0x6c')],_[_0x35fc('0x43')](_0x3f7fd7[_0x35fc('0x3d')],[_0x35fc('0x6c'),'id'])||{});}return null;})[_0x35fc('0x84')](function(_0x4007f9){var _0x58d0b1;_0xa46ffd=_0x4007f9||[];var _0x4bf83e=[];if(_0x4007f9){for(var _0x1afe94=0x0;_0x1afe94<_0x4007f9[_0x35fc('0x38')];_0x1afe94+=0x1){var _0x108366=_0x4007f9[_0x1afe94][_0x35fc('0x19')]({'plain':!![]});_0x58d0b1=squel['insert']()[_0x35fc('0x90')]('cm_hopper_black')['fromQuery']([_0x35fc('0x96'),_0x35fc('0x94'),_0x35fc('0x95'),_0x35fc('0x51'),_0x35fc('0x44'),_0x35fc('0x45')],squel[_0x35fc('0x9d')]()['field'](_0x35fc('0x96'),_0x35fc('0x96'))[_0x35fc('0x6d')]('id',_0x35fc('0x94'))['field'](_0x108366[_0x35fc('0x97')][_0x35fc('0x78')](),_0x35fc('0x95'))[_0x35fc('0x6d')](_0x3f7fd7[_0x35fc('0x32')]['id']['toString'](),_0x35fc('0x51'))[_0x35fc('0x6d')](_0x35fc('0xaf'),_0x35fc('0x44'))[_0x35fc('0x6d')]('NOW()','updatedAt')[_0x35fc('0x6f')](_0x35fc('0x98'))[_0x35fc('0x2c')](_0x35fc('0x99'))[_0x35fc('0x2c')](_0x35fc('0x9a'),_0x108366[_0x35fc('0x97')]['toString']())[_0x35fc('0x2c')](_0x35fc('0x9b')))['toString']();_0x4bf83e[_0x35fc('0x77')](db[_0x35fc('0x64')][_0x35fc('0x35')](_0x58d0b1));}return BPromise[_0x35fc('0x7e')](_0x4bf83e);}})[_0x35fc('0x18')](function(){return _0xa46ffd;})[_0x35fc('0x18')](respondWithResult(_0x5e16f1,null))[_0x35fc('0x30')](handleError(_0x5e16f1,null));};exports[_0x35fc('0xb0')]=function(_0x4fd3d4,_0x2dff64){return db[_0x35fc('0x29')][_0x35fc('0x23')]({'where':{'id':_0x4fd3d4['params']['id']}})['then'](handleEntityNotFound(_0x2dff64,null))[_0x35fc('0x18')](function(_0x409a32){if(_0x409a32){return _0x409a32['removeBlackLists'](_0x4fd3d4[_0x35fc('0x35')][_0x35fc('0x6c')]);}})[_0x35fc('0x18')](function(_0x2c0bf5){if(_0x2c0bf5){return db['CmHopperBlack'][_0x35fc('0x25')]({'where':{'ListId':_0x4fd3d4['query']['ids'],'VoiceQueueId':_0x4fd3d4[_0x35fc('0x32')]['id']}})[_0x35fc('0x18')](function(){return _0x2c0bf5;});}})[_0x35fc('0x18')](respondWithStatusCode(_0x2dff64,null))[_0x35fc('0x30')](handleError(_0x2dff64,null));}; \ No newline at end of file diff --git a/server/api/voiceQueue/voiceQueue.events.js b/server/api/voiceQueue/voiceQueue.events.js index affcb89..cd3bd7a 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 _0xbd71=['hasOwnProperty','hook','exports','events','../../mysqldb','VoiceQueue','setMaxListeners','update','remove','emit'];(function(_0x58331c,_0x151ee3){var _0x2ba2f3=function(_0x37292e){while(--_0x37292e){_0x58331c['push'](_0x58331c['shift']());}};_0x2ba2f3(++_0x151ee3);}(_0xbd71,0xcb));var _0x1bd7=function(_0x17b9c4,_0x46e7e4){_0x17b9c4=_0x17b9c4-0x0;var _0x38ef65=_0xbd71[_0x17b9c4];return _0x38ef65;};'use strict';var EventEmitter=require(_0x1bd7('0x0'));var VoiceQueue=require(_0x1bd7('0x1'))['db'][_0x1bd7('0x2')];var VoiceQueueEvents=new EventEmitter();VoiceQueueEvents[_0x1bd7('0x3')](0x0);var events={'afterCreate':'save','afterUpdate':_0x1bd7('0x4'),'afterDestroy':_0x1bd7('0x5')};function emitEvent(_0x29c262){return function(_0xd6b1b2,_0x5651ba,_0x5d49b4){VoiceQueueEvents[_0x1bd7('0x6')](_0x29c262+':'+_0xd6b1b2['id'],_0xd6b1b2);VoiceQueueEvents['emit'](_0x29c262,_0xd6b1b2);_0x5d49b4(null);};}for(var e in events){if(events[_0x1bd7('0x7')](e)){var event=events[e];VoiceQueue[_0x1bd7('0x8')](e,emitEvent(event));}}module[_0x1bd7('0x9')]=VoiceQueueEvents; \ No newline at end of file +var _0xc6e3=['emit','hasOwnProperty','exports','events','../../mysqldb','VoiceQueue','save','update','remove'];(function(_0x53ccf2,_0x13cb67){var _0x5a2964=function(_0x3b0514){while(--_0x3b0514){_0x53ccf2['push'](_0x53ccf2['shift']());}};_0x5a2964(++_0x13cb67);}(_0xc6e3,0x147));var _0x3c6e=function(_0x243f86,_0x1ce8f3){_0x243f86=_0x243f86-0x0;var _0x1decdc=_0xc6e3[_0x243f86];return _0x1decdc;};'use strict';var EventEmitter=require(_0x3c6e('0x0'));var VoiceQueue=require(_0x3c6e('0x1'))['db'][_0x3c6e('0x2')];var VoiceQueueEvents=new EventEmitter();VoiceQueueEvents['setMaxListeners'](0x0);var events={'afterCreate':_0x3c6e('0x3'),'afterUpdate':_0x3c6e('0x4'),'afterDestroy':_0x3c6e('0x5')};function emitEvent(_0x6064ab){return function(_0x4a7c0d,_0x24cb46,_0x23e287){VoiceQueueEvents['emit'](_0x6064ab+':'+_0x4a7c0d['id'],_0x4a7c0d);VoiceQueueEvents[_0x3c6e('0x6')](_0x6064ab,_0x4a7c0d);_0x23e287(null);};}for(var e in events){if(events[_0x3c6e('0x7')](e)){var event=events[e];VoiceQueue['hook'](e,emitEvent(event));}}module[_0x3c6e('0x8')]=VoiceQueueEvents; \ No newline at end of file diff --git a/server/api/voiceQueue/voiceQueue.model.js b/server/api/voiceQueue/voiceQueue.model.js index c8634c9..193a0fe 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(_0x1c0028,_0x1ffe06){var _0x4c3b77=function(_0x389b78){while(--_0x389b78){_0x1c0028['push'](_0x1c0028['shift']());}};_0x4c3b77(++_0x1ffe06);}(_0x008c,0x188));var _0xc008=function(_0xc9b988,_0x429150){_0xc9b988=_0xc9b988-0x0;var _0x5f14fe=_0x008c[_0xc9b988];return _0x5f14fe;};'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 _0x70e0=['voice_queues','lodash','util','../../config/logger','bluebird','request-promise','path','rimraf','./voiceQueue.attributes'];(function(_0x4d1536,_0x146875){var _0x17ce2c=function(_0x4b0c03){while(--_0x4b0c03){_0x4d1536['push'](_0x4d1536['shift']());}};_0x17ce2c(++_0x146875);}(_0x70e0,0x17b));var _0x070e=function(_0x349244,_0x42d38f){_0x349244=_0x349244-0x0;var _0x19d745=_0x70e0[_0x349244];return _0x19d745;};'use strict';var _=require(_0x070e('0x0'));var util=require(_0x070e('0x1'));var logger=require(_0x070e('0x2'))('api');var moment=require('moment');var BPromise=require(_0x070e('0x3'));var rp=require(_0x070e('0x4'));var fs=require('fs');var path=require(_0x070e('0x5'));var rimraf=require(_0x070e('0x6'));var config=require('../../config/environment');var attributes=require(_0x070e('0x7'));module['exports']=function(_0x46fe68,_0x4b041d){return _0x46fe68['define']('VoiceQueue',attributes,{'tableName':_0x070e('0x8'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/voiceQueue/voiceQueue.rpc.js b/server/api/voiceQueue/voiceQueue.rpc.js index bd27e50..65b8248 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 _0x4997=['GetVoiceQueue','VoiceQueue','findAll','options','where','attributes','limit','map','include','model','catch','ShowVoiceQueue','find','then','lodash','util','bluebird','../../mysqldb','rpc','../../config/environment','jayson/promise','http','redis','defaults','localhost','socket.io-emitter','./voiceQueue.socket','request\x20sent','debug','VoiceQueue,\x20%s,\x20%s,\x20%s','stringify','error','code','VoiceQueue,\x20%s,\x20%s','message','info','result'];(function(_0x896445,_0x5c5ada){var _0x44ca8b=function(_0x5677fb){while(--_0x5677fb){_0x896445['push'](_0x896445['shift']());}};_0x44ca8b(++_0x5c5ada);}(_0x4997,0xa2));var _0x7499=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0x4997[_0x3dd15e];return _0x231fd0;};'use strict';var _=require(_0x7499('0x0'));var util=require(_0x7499('0x1'));var moment=require('moment');var BPromise=require(_0x7499('0x2'));var rs=require('randomstring');var fs=require('fs');var Redis=require('ioredis');var db=require(_0x7499('0x3'))['db'];var utils=require('../../config/utils');var logger=require('../../config/logger')(_0x7499('0x4'));var config=require(_0x7499('0x5'));var jayson=require(_0x7499('0x6'));var client=jayson['client'][_0x7499('0x7')]({'port':0x232a});config[_0x7499('0x8')]=_[_0x7499('0x9')](config[_0x7499('0x8')],{'host':_0x7499('0xa'),'port':0x18eb});var socket=require(_0x7499('0xb'))(new Redis(config['redis']));require(_0x7499('0xc'))['register'](socket);function respondWithRpcPromise(_0x2dd249,_0x73bb7f,_0x297129){return new BPromise(function(_0x3ac80c,_0x46e1bc){return client['request'](_0x2dd249,_0x297129)['then'](function(_0x3570a0){logger['info']('VoiceQueue,\x20%s,\x20%s',_0x73bb7f,_0x7499('0xd'));logger[_0x7499('0xe')](_0x7499('0xf'),_0x73bb7f,_0x7499('0xd'),JSON[_0x7499('0x10')](_0x3570a0));if(_0x3570a0[_0x7499('0x11')]){if(_0x3570a0[_0x7499('0x11')][_0x7499('0x12')]===0x1f4){logger[_0x7499('0x11')](_0x7499('0x13'),_0x73bb7f,_0x3570a0['error'][_0x7499('0x14')]);return _0x46e1bc(_0x3570a0[_0x7499('0x11')]['message']);}logger['error']('VoiceQueue,\x20%s,\x20%s',_0x73bb7f,_0x3570a0[_0x7499('0x11')][_0x7499('0x14')]);return _0x3ac80c(_0x3570a0[_0x7499('0x11')][_0x7499('0x14')]);}else{logger[_0x7499('0x15')](_0x7499('0x13'),_0x73bb7f,_0x7499('0xd'));_0x3ac80c(_0x3570a0[_0x7499('0x16')][_0x7499('0x14')]);}})['catch'](function(_0x401633){logger[_0x7499('0x11')](_0x7499('0x13'),_0x73bb7f,_0x401633);_0x46e1bc(_0x401633);});});}exports[_0x7499('0x17')]=function(_0x4ead5f){var _0x1ad4fa=this;return new Promise(function(_0x404353,_0x50bfad){return db[_0x7499('0x18')][_0x7499('0x19')]({'raw':_0x4ead5f[_0x7499('0x1a')]?_0x4ead5f[_0x7499('0x1a')]['raw']===undefined?!![]:![]:!![],'where':_0x4ead5f[_0x7499('0x1a')]?_0x4ead5f[_0x7499('0x1a')][_0x7499('0x1b')]||null:null,'attributes':_0x4ead5f['options']?_0x4ead5f[_0x7499('0x1a')][_0x7499('0x1c')]||null:null,'limit':_0x4ead5f['options']?_0x4ead5f[_0x7499('0x1a')][_0x7499('0x1d')]||null:null,'include':_0x4ead5f[_0x7499('0x1a')]?_0x4ead5f[_0x7499('0x1a')]['include']?_[_0x7499('0x1e')](_0x4ead5f[_0x7499('0x1a')][_0x7499('0x1f')],function(_0x1e1fcb){return{'model':db[_0x1e1fcb['model']],'as':_0x1e1fcb['as'],'attributes':_0x1e1fcb[_0x7499('0x1c')],'include':_0x1e1fcb[_0x7499('0x1f')]?_[_0x7499('0x1e')](_0x1e1fcb[_0x7499('0x1f')],function(_0x4a500e){return{'model':db[_0x4a500e[_0x7499('0x20')]],'as':_0x4a500e['as'],'attributes':_0x4a500e[_0x7499('0x1c')],'include':_0x4a500e['include']?_[_0x7499('0x1e')](_0x4a500e[_0x7499('0x1f')],function(_0x5c6d45){return{'model':db[_0x5c6d45[_0x7499('0x20')]],'as':_0x5c6d45['as'],'attributes':_0x5c6d45[_0x7499('0x1c')]};}):[]};}):[]};}):[]:[]})['then'](function(_0x153bf9){logger[_0x7499('0x15')](_0x7499('0x17'),_0x4ead5f);logger[_0x7499('0xe')](_0x7499('0x17'),_0x4ead5f,JSON[_0x7499('0x10')](_0x153bf9));_0x404353(_0x153bf9);})[_0x7499('0x21')](function(_0x24ec70){logger[_0x7499('0x11')]('GetVoiceQueue',_0x24ec70['message'],_0x4ead5f);_0x50bfad(_0x1ad4fa[_0x7499('0x11')](0x1f4,_0x24ec70['message']));});});};exports[_0x7499('0x22')]=function(_0x54175c){var _0x4e4772=this;return new Promise(function(_0x35b5a1,_0x200d9f){return db['VoiceQueue'][_0x7499('0x23')]({'raw':_0x54175c[_0x7499('0x1a')]?_0x54175c['options']['raw']===undefined?!![]:![]:!![],'where':_0x54175c[_0x7499('0x1a')]?_0x54175c[_0x7499('0x1a')]['where']||null:null,'attributes':_0x54175c[_0x7499('0x1a')]?_0x54175c[_0x7499('0x1a')]['attributes']||null:null,'include':_0x54175c[_0x7499('0x1a')]?_0x54175c['options']['include']?_[_0x7499('0x1e')](_0x54175c[_0x7499('0x1a')][_0x7499('0x1f')],function(_0x210632){return{'model':db[_0x210632['model']],'as':_0x210632['as'],'attributes':_0x210632[_0x7499('0x1c')],'include':_0x210632[_0x7499('0x1f')]?_[_0x7499('0x1e')](_0x210632['include'],function(_0x57dc88){return{'model':db[_0x57dc88[_0x7499('0x20')]],'as':_0x57dc88['as'],'attributes':_0x57dc88[_0x7499('0x1c')],'include':_0x57dc88[_0x7499('0x1f')]?_[_0x7499('0x1e')](_0x57dc88[_0x7499('0x1f')],function(_0x18c787){return{'model':db[_0x18c787['model']],'as':_0x18c787['as'],'attributes':_0x18c787[_0x7499('0x1c')]};}):[]};}):[]};}):[]:[]})[_0x7499('0x24')](function(_0x42d07d){logger[_0x7499('0x15')](_0x7499('0x22'),_0x54175c);logger[_0x7499('0xe')](_0x7499('0x22'),_0x54175c,JSON[_0x7499('0x10')](_0x42d07d));_0x35b5a1(_0x42d07d);})[_0x7499('0x21')](function(_0x249653){logger[_0x7499('0x11')](_0x7499('0x22'),_0x249653[_0x7499('0x14')],_0x54175c);_0x200d9f(_0x4e4772['error'](0x1f4,_0x249653[_0x7499('0x14')]));});});}; \ No newline at end of file +var _0x751a=['request','then','VoiceQueue,\x20%s,\x20%s','request\x20sent','VoiceQueue,\x20%s,\x20%s,\x20%s','error','message','info','result','VoiceQueue','options','raw','where','limit','include','map','model','attributes','GetVoiceQueue','catch','ShowVoiceQueue','find','debug','lodash','util','bluebird','ioredis','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','redis','defaults','localhost','socket.io-emitter','./voiceQueue.socket','register'];(function(_0x13da58,_0x43517a){var _0x482462=function(_0x11220d){while(--_0x11220d){_0x13da58['push'](_0x13da58['shift']());}};_0x482462(++_0x43517a);}(_0x751a,0x89));var _0xa751=function(_0x54d4a8,_0x585a59){_0x54d4a8=_0x54d4a8-0x0;var _0x3b321b=_0x751a[_0x54d4a8];return _0x3b321b;};'use strict';var _=require(_0xa751('0x0'));var util=require(_0xa751('0x1'));var moment=require('moment');var BPromise=require(_0xa751('0x2'));var rs=require('randomstring');var fs=require('fs');var Redis=require(_0xa751('0x3'));var db=require('../../mysqldb')['db'];var utils=require(_0xa751('0x4'));var logger=require(_0xa751('0x5'))(_0xa751('0x6'));var config=require(_0xa751('0x7'));var jayson=require(_0xa751('0x8'));var client=jayson['client']['http']({'port':0x232a});config[_0xa751('0x9')]=_[_0xa751('0xa')](config[_0xa751('0x9')],{'host':_0xa751('0xb'),'port':0x18eb});var socket=require(_0xa751('0xc'))(new Redis(config['redis']));require(_0xa751('0xd'))[_0xa751('0xe')](socket);function respondWithRpcPromise(_0x2ad8b5,_0x294d59,_0x4a465b){return new BPromise(function(_0x47e6b6,_0x326309){return client[_0xa751('0xf')](_0x2ad8b5,_0x4a465b)[_0xa751('0x10')](function(_0x1e2560){logger['info'](_0xa751('0x11'),_0x294d59,_0xa751('0x12'));logger['debug'](_0xa751('0x13'),_0x294d59,_0xa751('0x12'),JSON['stringify'](_0x1e2560));if(_0x1e2560[_0xa751('0x14')]){if(_0x1e2560['error']['code']===0x1f4){logger['error'](_0xa751('0x11'),_0x294d59,_0x1e2560[_0xa751('0x14')][_0xa751('0x15')]);return _0x326309(_0x1e2560['error'][_0xa751('0x15')]);}logger[_0xa751('0x14')]('VoiceQueue,\x20%s,\x20%s',_0x294d59,_0x1e2560[_0xa751('0x14')][_0xa751('0x15')]);return _0x47e6b6(_0x1e2560[_0xa751('0x14')]['message']);}else{logger[_0xa751('0x16')](_0xa751('0x11'),_0x294d59,'request\x20sent');_0x47e6b6(_0x1e2560[_0xa751('0x17')]['message']);}})['catch'](function(_0x1e0741){logger[_0xa751('0x14')](_0xa751('0x11'),_0x294d59,_0x1e0741);_0x326309(_0x1e0741);});});}exports['GetVoiceQueue']=function(_0x200af5){var _0x2240a5=this;return new Promise(function(_0x726e86,_0x2cb7a6){return db[_0xa751('0x18')]['findAll']({'raw':_0x200af5[_0xa751('0x19')]?_0x200af5[_0xa751('0x19')][_0xa751('0x1a')]===undefined?!![]:![]:!![],'where':_0x200af5['options']?_0x200af5[_0xa751('0x19')][_0xa751('0x1b')]||null:null,'attributes':_0x200af5[_0xa751('0x19')]?_0x200af5[_0xa751('0x19')]['attributes']||null:null,'limit':_0x200af5[_0xa751('0x19')]?_0x200af5[_0xa751('0x19')][_0xa751('0x1c')]||null:null,'include':_0x200af5[_0xa751('0x19')]?_0x200af5[_0xa751('0x19')][_0xa751('0x1d')]?_[_0xa751('0x1e')](_0x200af5[_0xa751('0x19')][_0xa751('0x1d')],function(_0x3551b7){return{'model':db[_0x3551b7[_0xa751('0x1f')]],'as':_0x3551b7['as'],'attributes':_0x3551b7[_0xa751('0x20')],'include':_0x3551b7['include']?_[_0xa751('0x1e')](_0x3551b7[_0xa751('0x1d')],function(_0x2b8728){return{'model':db[_0x2b8728[_0xa751('0x1f')]],'as':_0x2b8728['as'],'attributes':_0x2b8728[_0xa751('0x20')],'include':_0x2b8728['include']?_['map'](_0x2b8728['include'],function(_0x46464b){return{'model':db[_0x46464b[_0xa751('0x1f')]],'as':_0x46464b['as'],'attributes':_0x46464b[_0xa751('0x20')]};}):[]};}):[]};}):[]:[]})[_0xa751('0x10')](function(_0x5a92a2){logger['info'](_0xa751('0x21'),_0x200af5);logger['debug'](_0xa751('0x21'),_0x200af5,JSON['stringify'](_0x5a92a2));_0x726e86(_0x5a92a2);})[_0xa751('0x22')](function(_0x2bcdbf){logger[_0xa751('0x14')](_0xa751('0x21'),_0x2bcdbf[_0xa751('0x15')],_0x200af5);_0x2cb7a6(_0x2240a5[_0xa751('0x14')](0x1f4,_0x2bcdbf[_0xa751('0x15')]));});});};exports[_0xa751('0x23')]=function(_0x54c908){var _0x38877b=this;return new Promise(function(_0x132b70,_0xd7eeea){return db[_0xa751('0x18')][_0xa751('0x24')]({'raw':_0x54c908[_0xa751('0x19')]?_0x54c908['options'][_0xa751('0x1a')]===undefined?!![]:![]:!![],'where':_0x54c908[_0xa751('0x19')]?_0x54c908['options'][_0xa751('0x1b')]||null:null,'attributes':_0x54c908[_0xa751('0x19')]?_0x54c908[_0xa751('0x19')][_0xa751('0x20')]||null:null,'include':_0x54c908['options']?_0x54c908[_0xa751('0x19')][_0xa751('0x1d')]?_[_0xa751('0x1e')](_0x54c908['options'][_0xa751('0x1d')],function(_0x7d8476){return{'model':db[_0x7d8476[_0xa751('0x1f')]],'as':_0x7d8476['as'],'attributes':_0x7d8476[_0xa751('0x20')],'include':_0x7d8476[_0xa751('0x1d')]?_[_0xa751('0x1e')](_0x7d8476['include'],function(_0x7acde4){return{'model':db[_0x7acde4[_0xa751('0x1f')]],'as':_0x7acde4['as'],'attributes':_0x7acde4[_0xa751('0x20')],'include':_0x7acde4[_0xa751('0x1d')]?_[_0xa751('0x1e')](_0x7acde4[_0xa751('0x1d')],function(_0x4d2075){return{'model':db[_0x4d2075[_0xa751('0x1f')]],'as':_0x4d2075['as'],'attributes':_0x4d2075[_0xa751('0x20')]};}):[]};}):[]};}):[]:[]})[_0xa751('0x10')](function(_0x337f45){logger['info']('ShowVoiceQueue',_0x54c908);logger[_0xa751('0x25')]('ShowVoiceQueue',_0x54c908,JSON['stringify'](_0x337f45));_0x132b70(_0x337f45);})[_0xa751('0x22')](function(_0x22055c){logger[_0xa751('0x14')](_0xa751('0x23'),_0x22055c['message'],_0x54c908);_0xd7eeea(_0x38877b[_0xa751('0x14')](0x1f4,_0x22055c[_0xa751('0x15')]));});});}; \ No newline at end of file diff --git a/server/api/voiceQueue/voiceQueue.socket.js b/server/api/voiceQueue/voiceQueue.socket.js index f7223a1..39ae4b6 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 _0xcd4a=['removeListener','length','voiceQueue:','save','remove','update'];(function(_0x40b3f2,_0x2c4f5f){var _0x4ce90c=function(_0x516f31){while(--_0x516f31){_0x40b3f2['push'](_0x40b3f2['shift']());}};_0x4ce90c(++_0x2c4f5f);}(_0xcd4a,0x19b));var _0xacd4=function(_0x962de1,_0x361057){_0x962de1=_0x962de1-0x0;var _0x14085a=_0xcd4a[_0x962de1];return _0x14085a;};'use strict';var VoiceQueueEvents=require('./voiceQueue.events');var events=[_0xacd4('0x0'),_0xacd4('0x1'),_0xacd4('0x2')];function createListener(_0x5b141f,_0x56d578){return function(_0x32810a){_0x56d578['emit'](_0x5b141f,_0x32810a);};}function removeListener(_0x2ce47d,_0x251c52){return function(){VoiceQueueEvents[_0xacd4('0x3')](_0x2ce47d,_0x251c52);};}exports['register']=function(_0x1c7fa8){for(var _0x14d6b9=0x0,_0x315248=events[_0xacd4('0x4')];_0x14d6b9<_0x315248;_0x14d6b9++){var _0x3a8884=events[_0x14d6b9];var _0x364dd2=createListener(_0xacd4('0x5')+_0x3a8884,_0x1c7fa8);VoiceQueueEvents['on'](_0x3a8884,_0x364dd2);}}; \ No newline at end of file +var _0xfb18=['update','emit','removeListener','register','length','voiceQueue:','save','remove'];(function(_0x19311a,_0x2d2679){var _0x42617c=function(_0x43227d){while(--_0x43227d){_0x19311a['push'](_0x19311a['shift']());}};_0x42617c(++_0x2d2679);}(_0xfb18,0x10e));var _0x8fb1=function(_0x319cb9,_0x4b8d35){_0x319cb9=_0x319cb9-0x0;var _0x1735fc=_0xfb18[_0x319cb9];return _0x1735fc;};'use strict';var VoiceQueueEvents=require('./voiceQueue.events');var events=[_0x8fb1('0x0'),_0x8fb1('0x1'),_0x8fb1('0x2')];function createListener(_0x45f7bb,_0x2e501d){return function(_0x1f04ac){_0x2e501d[_0x8fb1('0x3')](_0x45f7bb,_0x1f04ac);};}function removeListener(_0x2027eb,_0x4184c2){return function(){VoiceQueueEvents[_0x8fb1('0x4')](_0x2027eb,_0x4184c2);};}exports[_0x8fb1('0x5')]=function(_0x138fa2){for(var _0x3ddd52=0x0,_0xdb15cf=events[_0x8fb1('0x6')];_0x3ddd52<_0xdb15cf;_0x3ddd52++){var _0x5d16e0=events[_0x3ddd52];var _0xfcd221=createListener(_0x8fb1('0x7')+_0x5d16e0,_0x138fa2);VoiceQueueEvents['on'](_0x5d16e0,_0xfcd221);}}; \ No newline at end of file diff --git a/server/api/voiceQueueReport/index.js b/server/api/voiceQueueReport/index.js index 10a16b2..4012b88 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 _0xfdfd=['post','create','put','/:id','update','delete','destroy','exports','multer','util','path','connect-timeout','express','fs-extra','../../components/auth/service','../../config/environment','./voiceQueueReport.controller','get','isAuthenticated','describe','/index','getVoiceQueuesReport','show'];(function(_0x3dd15e,_0x1f0015){var _0x231fd0=function(_0x4f680a){while(--_0x4f680a){_0x3dd15e['push'](_0x3dd15e['shift']());}};_0x231fd0(++_0x1f0015);}(_0xfdfd,0xc0));var _0xdfdf=function(_0x14fc5d,_0x1a9e86){_0x14fc5d=_0x14fc5d-0x0;var _0x4deced=_0xfdfd[_0x14fc5d];return _0x4deced;};'use strict';var multer=require(_0xdfdf('0x0'));var util=require(_0xdfdf('0x1'));var path=require(_0xdfdf('0x2'));var timeout=require(_0xdfdf('0x3'));var express=require(_0xdfdf('0x4'));var router=express['Router']();var fs_extra=require(_0xdfdf('0x5'));var auth=require(_0xdfdf('0x6'));var interaction=require('../../components/interaction/service');var config=require(_0xdfdf('0x7'));var controller=require(_0xdfdf('0x8'));router[_0xdfdf('0x9')]('/',auth[_0xdfdf('0xa')](),controller['index']);router[_0xdfdf('0x9')]('/describe',auth['isAuthenticated'](),controller[_0xdfdf('0xb')]);router[_0xdfdf('0x9')](_0xdfdf('0xc'),auth['isAuthenticated'](),controller[_0xdfdf('0xd')]);router['get']('/:id',auth[_0xdfdf('0xa')](),controller[_0xdfdf('0xe')]);router[_0xdfdf('0xf')]('/',auth['isAuthenticated'](),controller[_0xdfdf('0x10')]);router[_0xdfdf('0x11')](_0xdfdf('0x12'),auth['isAuthenticated'](),controller[_0xdfdf('0x13')]);router[_0xdfdf('0x14')](_0xdfdf('0x12'),auth[_0xdfdf('0xa')](),controller[_0xdfdf('0x15')]);module[_0xdfdf('0x16')]=router; \ No newline at end of file +var _0x605a=['Router','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','./voiceQueueReport.controller','get','isAuthenticated','index','describe','/index','getVoiceQueuesReport','/:id','show','post','create','put','update','delete','destroy','exports','multer','path','connect-timeout','express'];(function(_0x235a8b,_0x333f40){var _0x5ea4e0=function(_0x2d2a01){while(--_0x2d2a01){_0x235a8b['push'](_0x235a8b['shift']());}};_0x5ea4e0(++_0x333f40);}(_0x605a,0x1d7));var _0xa605=function(_0x39329a,_0x445ef9){_0x39329a=_0x39329a-0x0;var _0x2d7f04=_0x605a[_0x39329a];return _0x2d7f04;};'use strict';var multer=require(_0xa605('0x0'));var util=require('util');var path=require(_0xa605('0x1'));var timeout=require(_0xa605('0x2'));var express=require(_0xa605('0x3'));var router=express[_0xa605('0x4')]();var fs_extra=require(_0xa605('0x5'));var auth=require(_0xa605('0x6'));var interaction=require(_0xa605('0x7'));var config=require(_0xa605('0x8'));var controller=require(_0xa605('0x9'));router[_0xa605('0xa')]('/',auth[_0xa605('0xb')](),controller[_0xa605('0xc')]);router['get']('/describe',auth[_0xa605('0xb')](),controller[_0xa605('0xd')]);router[_0xa605('0xa')](_0xa605('0xe'),auth[_0xa605('0xb')](),controller[_0xa605('0xf')]);router[_0xa605('0xa')](_0xa605('0x10'),auth[_0xa605('0xb')](),controller[_0xa605('0x11')]);router[_0xa605('0x12')]('/',auth[_0xa605('0xb')](),controller[_0xa605('0x13')]);router[_0xa605('0x14')](_0xa605('0x10'),auth[_0xa605('0xb')](),controller[_0xa605('0x15')]);router[_0xa605('0x16')](_0xa605('0x10'),auth['isAuthenticated'](),controller[_0xa605('0x17')]);module[_0xa605('0x18')]=router; \ No newline at end of file diff --git a/server/api/voiceQueueReport/voiceQueueReport.attributes.js b/server/api/voiceQueueReport/voiceQueueReport.attributes.js index d0a5335..f90c8d1 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 _0x49c2=['exports','STRING','DATE','getDataValue','queuecallerjoinAt','format','YYYY-MM-DD\x20HH:mm:ss','seconds','setDataValue','queuecallerleaveAt','INTEGER','BOOLEAN','FORWARD,\x20BLIND,\x20ATTENDED','sequelize','moment'];(function(_0x3d6907,_0x2f08fb){var _0x2ab3aa=function(_0x5f2f01){while(--_0x5f2f01){_0x3d6907['push'](_0x3d6907['shift']());}};_0x2ab3aa(++_0x2f08fb);}(_0x49c2,0xdf));var _0x249c=function(_0x5d0746,_0x511b2d){_0x5d0746=_0x5d0746-0x0;var _0x19a392=_0x49c2[_0x5d0746];return _0x19a392;};'use strict';var Sequelize=require(_0x249c('0x0'));var moment=require(_0x249c('0x1'));module[_0x249c('0x2')]={'type':{'type':Sequelize[_0x249c('0x3')]},'uniqueid':{'type':Sequelize[_0x249c('0x3')]},'calleridnum':{'type':Sequelize[_0x249c('0x3')]},'calleridname':{'type':Sequelize[_0x249c('0x3')]},'queue':{'type':Sequelize['STRING']},'queuecallerjoinAt':{'type':Sequelize[_0x249c('0x4')]},'queuecallerleaveAt':{'type':Sequelize[_0x249c('0x4')],'set':function(_0xfbc625){var _0x4517d8=moment(_0xfbc625);var _0x2afb29=moment(this[_0x249c('0x5')](_0x249c('0x6')))[_0x249c('0x7')](_0x249c('0x8'));var _0x5da7e4=_0x4517d8['diff'](_0x2afb29,_0x249c('0x9'));this[_0x249c('0xa')](_0x249c('0xb'),_0xfbc625);this['setDataValue']('holdtime',_0x5da7e4||null);}},'position':{'type':Sequelize['INTEGER']},'count':{'type':Sequelize[_0x249c('0xc')]},'queuecallerabandon':{'type':Sequelize[_0x249c('0xd')],'defaultValue':![]},'queuecallerabandonAt':{'type':Sequelize[_0x249c('0x4')]},'queuecallercomplete':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'queuecallercompleteAt':{'type':Sequelize[_0x249c('0x4')]},'queuecallerexit':{'type':Sequelize[_0x249c('0xd')],'defaultValue':![]},'queuecallerexitAt':{'type':Sequelize[_0x249c('0x4')]},'queuecallerexitreason':{'type':Sequelize[_0x249c('0x3')],'comment':'COMPLETEDBYCALLER,\x20COMPLETEDBYAGENT,\x20FORWARDTRANFER,\x20BLINDTRANSFER,\x20ATTENDEDTRANSFER,\x20EXITWITHKEY,\x20TIMEOUT'},'originalposition':{'type':Sequelize[_0x249c('0xc')]},'channel':{'type':Sequelize['STRING']},'connectedlinenum':{'type':Sequelize[_0x249c('0x3')]},'connectedlinename':{'type':Sequelize[_0x249c('0x3')]},'accountcode':{'type':Sequelize[_0x249c('0x3')]},'context':{'type':Sequelize['STRING']},'exten':{'type':Sequelize[_0x249c('0x3')]},'priority':{'type':Sequelize[_0x249c('0x3')]},'holdtime':{'type':Sequelize[_0x249c('0xc')]},'mohtime':{'type':Sequelize[_0x249c('0xc')],'defaultValue':0x0},'assigned':{'type':Sequelize[_0x249c('0xd')],'defaultValue':![]},'lastAssignedTo':{'type':Sequelize[_0x249c('0x3')]},'transfer':{'type':Sequelize[_0x249c('0xd')],'defaultValue':![]},'transfertype':{'type':Sequelize['STRING'],'comment':_0x249c('0xe')},'transferexten':{'type':Sequelize[_0x249c('0x3')]},'transferuniqueid':{'type':Sequelize[_0x249c('0x3')]},'disposition':{'type':Sequelize[_0x249c('0x3')]},'secondDisposition':{'type':Sequelize[_0x249c('0x3')]},'thirdDisposition':{'type':Sequelize['STRING']},'queuecallerenterreason':{'type':Sequelize[_0x249c('0xc')],'defaultValue':0x0},'note':{'type':Sequelize[_0x249c('0x3')]}}; \ No newline at end of file +var _0x241e=['moment','STRING','DATE','getDataValue','queuecallerjoinAt','format','YYYY-MM-DD\x20HH:mm:ss','diff','seconds','setDataValue','queuecallerleaveAt','holdtime','INTEGER','BOOLEAN','COMPLETEDBYCALLER,\x20COMPLETEDBYAGENT,\x20FORWARDTRANFER,\x20BLINDTRANSFER,\x20ATTENDEDTRANSFER,\x20EXITWITHKEY,\x20TIMEOUT'];(function(_0x4cbaa3,_0x48d3e6){var _0xad02f9=function(_0x1ebffd){while(--_0x1ebffd){_0x4cbaa3['push'](_0x4cbaa3['shift']());}};_0xad02f9(++_0x48d3e6);}(_0x241e,0x87));var _0xe241=function(_0x5df6d2,_0x2c3245){_0x5df6d2=_0x5df6d2-0x0;var _0x2cdd47=_0x241e[_0x5df6d2];return _0x2cdd47;};'use strict';var Sequelize=require('sequelize');var moment=require(_0xe241('0x0'));module['exports']={'type':{'type':Sequelize[_0xe241('0x1')]},'uniqueid':{'type':Sequelize['STRING']},'calleridnum':{'type':Sequelize[_0xe241('0x1')]},'calleridname':{'type':Sequelize[_0xe241('0x1')]},'queue':{'type':Sequelize[_0xe241('0x1')]},'queuecallerjoinAt':{'type':Sequelize[_0xe241('0x2')]},'queuecallerleaveAt':{'type':Sequelize[_0xe241('0x2')],'set':function(_0x419d9f){var _0x5460e0=moment(_0x419d9f);var _0x1fb663=moment(this[_0xe241('0x3')](_0xe241('0x4')))[_0xe241('0x5')](_0xe241('0x6'));var _0x25cac0=_0x5460e0[_0xe241('0x7')](_0x1fb663,_0xe241('0x8'));this[_0xe241('0x9')](_0xe241('0xa'),_0x419d9f);this[_0xe241('0x9')](_0xe241('0xb'),_0x25cac0||null);}},'position':{'type':Sequelize[_0xe241('0xc')]},'count':{'type':Sequelize['INTEGER']},'queuecallerabandon':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'queuecallerabandonAt':{'type':Sequelize['DATE']},'queuecallercomplete':{'type':Sequelize[_0xe241('0xd')],'defaultValue':![]},'queuecallercompleteAt':{'type':Sequelize['DATE']},'queuecallerexit':{'type':Sequelize[_0xe241('0xd')],'defaultValue':![]},'queuecallerexitAt':{'type':Sequelize[_0xe241('0x2')]},'queuecallerexitreason':{'type':Sequelize[_0xe241('0x1')],'comment':_0xe241('0xe')},'originalposition':{'type':Sequelize[_0xe241('0xc')]},'channel':{'type':Sequelize['STRING']},'connectedlinenum':{'type':Sequelize[_0xe241('0x1')]},'connectedlinename':{'type':Sequelize[_0xe241('0x1')]},'accountcode':{'type':Sequelize[_0xe241('0x1')]},'context':{'type':Sequelize['STRING']},'exten':{'type':Sequelize[_0xe241('0x1')]},'priority':{'type':Sequelize['STRING']},'holdtime':{'type':Sequelize['INTEGER']},'mohtime':{'type':Sequelize['INTEGER'],'defaultValue':0x0},'assigned':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'lastAssignedTo':{'type':Sequelize[_0xe241('0x1')]},'transfer':{'type':Sequelize[_0xe241('0xd')],'defaultValue':![]},'transfertype':{'type':Sequelize[_0xe241('0x1')],'comment':'FORWARD,\x20BLIND,\x20ATTENDED'},'transferexten':{'type':Sequelize[_0xe241('0x1')]},'transferuniqueid':{'type':Sequelize[_0xe241('0x1')]},'disposition':{'type':Sequelize[_0xe241('0x1')]},'secondDisposition':{'type':Sequelize['STRING']},'thirdDisposition':{'type':Sequelize[_0xe241('0x1')]},'queuecallerenterreason':{'type':Sequelize['INTEGER'],'defaultValue':0x0},'note':{'type':Sequelize[_0xe241('0x1')]}}; \ No newline at end of file diff --git a/server/api/voiceQueueReport/voiceQueueReport.controller.js b/server/api/voiceQueueReport/voiceQueueReport.controller.js index 856f175..f9c0ee4 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 _0x4cef=['request-promise','moment','mustache','util','path','sox','to-csv','ejs','fs-extra','lodash','squel','desk.js','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../config/license/hardware','api','../../config/environment','../../mysqldb','defaults','redis','localhost','socket.io-emitter','register','sendStatus','status','end','json','offset','undefined','limit','count','set','Content-Range','reject','save','update','then','destroy','error','stack','name','index','map','VoiceQueueReport','fieldName','key','query','keys','intersection','model','attributes','fields','hasOwnProperty','nolimit','sort','where','pick','filters','filter','type','VIRTUAL','options','catch','show','params','rawAttributes','length','includeAll','include','find','body','describe','getVoiceQueuesReport','order','merge','findAll','rows','eml-format','rimraf','zip-dir','fast-json-patch'];(function(_0x52e363,_0x48062a){var _0x3fc2b5=function(_0x1b0cf9){while(--_0x1b0cf9){_0x52e363['push'](_0x52e363['shift']());}};_0x3fc2b5(++_0x48062a);}(_0x4cef,0x14c));var _0xf4ce=function(_0x16d1b6,_0x5912db){_0x16d1b6=_0x16d1b6-0x0;var _0x2ca1f5=_0x4cef[_0x16d1b6];return _0x2ca1f5;};'use strict';var emlformat=require(_0xf4ce('0x0'));var rimraf=require(_0xf4ce('0x1'));var zipdir=require(_0xf4ce('0x2'));var jsonpatch=require(_0xf4ce('0x3'));var rp=require(_0xf4ce('0x4'));var moment=require(_0xf4ce('0x5'));var BPromise=require('bluebird');var Mustache=require(_0xf4ce('0x6'));var util=require(_0xf4ce('0x7'));var path=require(_0xf4ce('0x8'));var sox=require(_0xf4ce('0x9'));var csv=require(_0xf4ce('0xa'));var ejs=require(_0xf4ce('0xb'));var fs=require('fs');var fs_extra=require(_0xf4ce('0xc'));var _=require(_0xf4ce('0xd'));var squel=require(_0xf4ce('0xe'));var crypto=require('crypto');var jsforce=require('jsforce');var deskjs=require(_0xf4ce('0xf'));var toCsv=require(_0xf4ce('0xa'));var querystring=require(_0xf4ce('0x10'));var Papa=require(_0xf4ce('0x11'));var Redis=require(_0xf4ce('0x12'));var authService=require(_0xf4ce('0x13'));var qs=require(_0xf4ce('0x14'));var as=require('../../components/parsers/advancedSearch');var hardwareService=require(_0xf4ce('0x15'));var logger=require('../../config/logger')(_0xf4ce('0x16'));var utils=require('../../config/utils');var config=require(_0xf4ce('0x17'));var licenseUtil=require('../../config/license/util');var db=require(_0xf4ce('0x18'))['db'];config['redis']=_[_0xf4ce('0x19')](config[_0xf4ce('0x1a')],{'host':_0xf4ce('0x1b'),'port':0x18eb});var socket=require(_0xf4ce('0x1c'))(new Redis(config[_0xf4ce('0x1a')]));require('./voiceQueueReport.socket')[_0xf4ce('0x1d')](socket);function respondWithStatusCode(_0x444415,_0x38038e){_0x38038e=_0x38038e||0xcc;return function(_0xdb2429){if(_0xdb2429){return _0x444415[_0xf4ce('0x1e')](_0x38038e);}return _0x444415[_0xf4ce('0x1f')](_0x38038e)[_0xf4ce('0x20')]();};}function respondWithResult(_0x45b0fd,_0x259bdf){_0x259bdf=_0x259bdf||0xc8;return function(_0x261167){if(_0x261167){return _0x45b0fd[_0xf4ce('0x1f')](_0x259bdf)[_0xf4ce('0x21')](_0x261167);}};}function respondWithFilteredResult(_0x737f6b,_0x4abdc3){return function(_0x53d15e){if(_0x53d15e){var _0x17da11=typeof _0x4abdc3[_0xf4ce('0x22')]===_0xf4ce('0x23')&&typeof _0x4abdc3[_0xf4ce('0x24')]===_0xf4ce('0x23');var _0xbc606=_0x53d15e['count'];var _0x1af6d3=_0x17da11?0x0:_0x4abdc3['offset'];var _0xf016=_0x17da11?_0x53d15e[_0xf4ce('0x25')]:_0x4abdc3['offset']+_0x4abdc3['limit'];var _0x5ed42b;if(_0xf016>=_0xbc606){_0xf016=_0xbc606;_0x5ed42b=0xc8;}else{_0x5ed42b=0xce;}_0x737f6b['status'](_0x5ed42b);return _0x737f6b[_0xf4ce('0x26')](_0xf4ce('0x27'),_0x1af6d3+'-'+_0xf016+'/'+_0xbc606)['json'](_0x53d15e);}return null;};}function patchUpdates(_0x3128c3){return function(_0x21e334){try{jsonpatch['apply'](_0x21e334,_0x3128c3,!![]);}catch(_0x525994){return BPromise[_0xf4ce('0x28')](_0x525994);}return _0x21e334[_0xf4ce('0x29')]();};}function saveUpdates(_0x1e1aed,_0x3f8e81){return function(_0x51f3c7){if(_0x51f3c7){return _0x51f3c7[_0xf4ce('0x2a')](_0x1e1aed)[_0xf4ce('0x2b')](function(_0x582c36){return _0x582c36;});}return null;};}function removeEntity(_0x1ccff0,_0x3de972){return function(_0x4a377e){if(_0x4a377e){return _0x4a377e[_0xf4ce('0x2c')]()[_0xf4ce('0x2b')](function(){_0x1ccff0['status'](0xcc)[_0xf4ce('0x20')]();});}};}function handleEntityNotFound(_0x170ecc,_0x5de47b){return function(_0x212d49){if(!_0x212d49){_0x170ecc[_0xf4ce('0x1e')](0x194);}return _0x212d49;};}function handleError(_0x4a3667,_0x17f4dd){_0x17f4dd=_0x17f4dd||0x1f4;return function(_0x2630d5){logger[_0xf4ce('0x2d')](_0x2630d5[_0xf4ce('0x2e')]);if(_0x2630d5[_0xf4ce('0x2f')]){delete _0x2630d5['name'];}_0x4a3667[_0xf4ce('0x1f')](_0x17f4dd)['send'](_0x2630d5);};}exports[_0xf4ce('0x30')]=function(_0xfa4e5b,_0x6432e2){var _0x2cd2b5={},_0x25b85d={},_0x227f5b={'count':0x0,'rows':[]};var _0x57ee14=_[_0xf4ce('0x31')](db[_0xf4ce('0x32')]['rawAttributes'],function(_0x839643){return{'name':_0x839643[_0xf4ce('0x33')],'type':_0x839643['type'][_0xf4ce('0x34')]};});_0x25b85d['model']=_['map'](_0x57ee14,'name');_0x25b85d[_0xf4ce('0x35')]=_[_0xf4ce('0x36')](_0xfa4e5b[_0xf4ce('0x35')]);_0x25b85d['filters']=_[_0xf4ce('0x37')](_0x25b85d[_0xf4ce('0x38')],_0x25b85d[_0xf4ce('0x35')]);_0x2cd2b5[_0xf4ce('0x39')]=_[_0xf4ce('0x37')](_0x25b85d[_0xf4ce('0x38')],qs[_0xf4ce('0x3a')](_0xfa4e5b[_0xf4ce('0x35')][_0xf4ce('0x3a')]));_0x2cd2b5[_0xf4ce('0x39')]=_0x2cd2b5[_0xf4ce('0x39')]['length']?_0x2cd2b5[_0xf4ce('0x39')]:_0x25b85d[_0xf4ce('0x38')];if(!_0xfa4e5b[_0xf4ce('0x35')][_0xf4ce('0x3b')](_0xf4ce('0x3c'))){_0x2cd2b5['limit']=qs[_0xf4ce('0x24')](_0xfa4e5b['query']['limit']);_0x2cd2b5[_0xf4ce('0x22')]=qs[_0xf4ce('0x22')](_0xfa4e5b['query'][_0xf4ce('0x22')]);}_0x2cd2b5['order']=qs[_0xf4ce('0x3d')](_0xfa4e5b[_0xf4ce('0x35')]['sort']);_0x2cd2b5[_0xf4ce('0x3e')]=qs['filters'](_[_0xf4ce('0x3f')](_0xfa4e5b['query'],_0x25b85d[_0xf4ce('0x40')]),_0x57ee14);if(_0xfa4e5b[_0xf4ce('0x35')][_0xf4ce('0x41')]){_0x2cd2b5['where']=_['merge'](_0x2cd2b5[_0xf4ce('0x3e')],{'$or':_[_0xf4ce('0x31')](_0x57ee14,function(_0x56c36f){if(_0x56c36f[_0xf4ce('0x42')]!==_0xf4ce('0x43')){var _0x417eb8={};_0x417eb8[_0x56c36f[_0xf4ce('0x2f')]]={'$like':'%'+_0xfa4e5b[_0xf4ce('0x35')][_0xf4ce('0x41')]+'%'};return _0x417eb8;}})});}_0x2cd2b5=_['merge']({},_0x2cd2b5,_0xfa4e5b[_0xf4ce('0x44')]);var _0x762bf4={'where':_0x2cd2b5[_0xf4ce('0x3e')]};return db[_0xf4ce('0x32')][_0xf4ce('0x25')](_0x762bf4)[_0xf4ce('0x2b')](function(_0x378e76){_0x227f5b[_0xf4ce('0x25')]=_0x378e76;if(_0xfa4e5b[_0xf4ce('0x35')]['includeAll']){_0x2cd2b5['include']=[{'all':!![]}];}return db[_0xf4ce('0x32')]['findAll'](_0x2cd2b5);})[_0xf4ce('0x2b')](function(_0x3d2709){_0x227f5b['rows']=_0x3d2709;return _0x227f5b;})['then'](respondWithFilteredResult(_0x6432e2,_0x2cd2b5))[_0xf4ce('0x45')](handleError(_0x6432e2,null));};exports[_0xf4ce('0x46')]=function(_0x1eb945,_0x29207c){var _0x44dc36={'raw':![],'where':{'id':_0x1eb945[_0xf4ce('0x47')]['id']}},_0x3b79ce={};_0x3b79ce[_0xf4ce('0x38')]=_['keys'](db['VoiceQueueReport'][_0xf4ce('0x48')]);_0x3b79ce[_0xf4ce('0x35')]=_[_0xf4ce('0x36')](_0x1eb945[_0xf4ce('0x35')]);_0x3b79ce[_0xf4ce('0x40')]=_[_0xf4ce('0x37')](_0x3b79ce['model'],_0x3b79ce['query']);_0x44dc36['attributes']=_[_0xf4ce('0x37')](_0x3b79ce[_0xf4ce('0x38')],qs['fields'](_0x1eb945[_0xf4ce('0x35')][_0xf4ce('0x3a')]));_0x44dc36[_0xf4ce('0x39')]=_0x44dc36['attributes'][_0xf4ce('0x49')]?_0x44dc36[_0xf4ce('0x39')]:_0x3b79ce['model'];if(_0x1eb945['query'][_0xf4ce('0x4a')]){_0x44dc36[_0xf4ce('0x4b')]=[{'all':!![]}];}_0x44dc36=_['merge']({},_0x44dc36,_0x1eb945[_0xf4ce('0x44')]);return db['VoiceQueueReport'][_0xf4ce('0x4c')](_0x44dc36)['then'](handleEntityNotFound(_0x29207c,null))['then'](respondWithResult(_0x29207c,null))[_0xf4ce('0x45')](handleError(_0x29207c,null));};exports['create']=function(_0xbb6c02,_0x2d78c6){return db[_0xf4ce('0x32')]['create'](_0xbb6c02['body'],{})[_0xf4ce('0x2b')](respondWithResult(_0x2d78c6,0xc9))['catch'](handleError(_0x2d78c6,null));};exports[_0xf4ce('0x2a')]=function(_0x199a8b,_0x8b1294){if(_0x199a8b[_0xf4ce('0x4d')]['id']){delete _0x199a8b[_0xf4ce('0x4d')]['id'];}return db[_0xf4ce('0x32')]['find']({'where':{'id':_0x199a8b[_0xf4ce('0x47')]['id']}})[_0xf4ce('0x2b')](handleEntityNotFound(_0x8b1294,null))[_0xf4ce('0x2b')](saveUpdates(_0x199a8b['body'],null))['then'](respondWithResult(_0x8b1294,null))[_0xf4ce('0x45')](handleError(_0x8b1294,null));};exports[_0xf4ce('0x2c')]=function(_0x39ef26,_0x35a24b){return db['VoiceQueueReport'][_0xf4ce('0x4c')]({'where':{'id':_0x39ef26[_0xf4ce('0x47')]['id']}})['then'](handleEntityNotFound(_0x35a24b,null))[_0xf4ce('0x2b')](removeEntity(_0x35a24b,null))[_0xf4ce('0x45')](handleError(_0x35a24b,null));};exports['describe']=function(_0x1689d5,_0x368018){return db[_0xf4ce('0x32')][_0xf4ce('0x4e')]()[_0xf4ce('0x2b')](respondWithResult(_0x368018,null))[_0xf4ce('0x45')](handleError(_0x368018,null));};exports[_0xf4ce('0x4f')]=function(_0x1e38cc,_0x939407){var _0x297d75={},_0x348e45={},_0x149a1c={'count':0x0,'rows':[]};_0x348e45[_0xf4ce('0x38')]=_['keys'](db[_0xf4ce('0x32')][_0xf4ce('0x48')]);_0x348e45[_0xf4ce('0x35')]=_[_0xf4ce('0x36')](_0x1e38cc['query']);_0x348e45[_0xf4ce('0x40')]=_[_0xf4ce('0x37')](_0x348e45[_0xf4ce('0x38')],_0x348e45['query']);_0x297d75[_0xf4ce('0x39')]=_[_0xf4ce('0x37')](_0x348e45[_0xf4ce('0x38')],qs[_0xf4ce('0x3a')](_0x1e38cc[_0xf4ce('0x35')][_0xf4ce('0x3a')]));_0x297d75[_0xf4ce('0x39')]=_0x297d75[_0xf4ce('0x39')]['length']?_0x297d75[_0xf4ce('0x39')]:_0x348e45['model'];if(!_0x1e38cc[_0xf4ce('0x35')][_0xf4ce('0x3b')](_0xf4ce('0x3c'))){_0x297d75[_0xf4ce('0x24')]=qs['limit'](_0x1e38cc[_0xf4ce('0x35')][_0xf4ce('0x24')]);_0x297d75['offset']=qs[_0xf4ce('0x22')](_0x1e38cc[_0xf4ce('0x35')][_0xf4ce('0x22')]);}_0x297d75[_0xf4ce('0x50')]=qs[_0xf4ce('0x3d')](_0x1e38cc[_0xf4ce('0x35')][_0xf4ce('0x3d')]);_0x297d75[_0xf4ce('0x3e')]=qs[_0xf4ce('0x40')](_['pick'](_0x1e38cc[_0xf4ce('0x35')],_0x348e45[_0xf4ce('0x40')]));if(_0x1e38cc['query'][_0xf4ce('0x41')]){_0x297d75[_0xf4ce('0x3e')]=_[_0xf4ce('0x51')](_0x297d75[_0xf4ce('0x3e')],{'$or':_[_0xf4ce('0x31')](_0x297d75[_0xf4ce('0x39')],function(_0x145014){var _0x5e31e5={};_0x5e31e5[_0x145014]={'$like':'%'+_0x1e38cc[_0xf4ce('0x35')]['filter']+'%'};return _0x5e31e5;})});}_0x297d75=_[_0xf4ce('0x51')]({},_0x297d75,_0x1e38cc['options']);var _0x18e5ed={'where':_0x297d75['where']};return db['VoiceQueueReport']['count'](_0x18e5ed)[_0xf4ce('0x2b')](function(_0x517f9d){_0x149a1c[_0xf4ce('0x25')]=_0x517f9d;if(_0x1e38cc[_0xf4ce('0x35')]['includeAll']){_0x297d75[_0xf4ce('0x4b')]=[{'all':!![]}];}return db[_0xf4ce('0x32')][_0xf4ce('0x52')](_0x297d75);})[_0xf4ce('0x2b')](function(_0x2641af){_0x149a1c[_0xf4ce('0x53')]=_0x2641af;return _0x149a1c;})[_0xf4ce('0x2b')](respondWithFilteredResult(_0x939407,_0x297d75,'getVoiceQueuesReport'))[_0xf4ce('0x45')](handleError(_0x939407,null,_0xf4ce('0x4f')));}; \ No newline at end of file +var _0xa851=['zip-dir','fast-json-patch','request-promise','mustache','util','path','sox','ejs','fs-extra','lodash','squel','crypto','jsforce','to-csv','papaparse','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','../../config/environment','redis','defaults','localhost','socket.io-emitter','./voiceQueueReport.socket','status','json','offset','undefined','limit','count','Content-Range','apply','reject','save','update','then','end','sendStatus','error','name','send','VoiceQueueReport','rawAttributes','fieldName','type','key','map','query','filters','intersection','model','attributes','fields','length','hasOwnProperty','order','sort','where','pick','filter','VIRTUAL','merge','options','includeAll','include','findAll','catch','params','find','create','body','destroy','describe','getVoiceQueuesReport','keys','rows','rimraf'];(function(_0x16e8f8,_0xd7ac55){var _0x57d5d5=function(_0x3545ac){while(--_0x3545ac){_0x16e8f8['push'](_0x16e8f8['shift']());}};_0x57d5d5(++_0xd7ac55);}(_0xa851,0x13b));var _0x1a85=function(_0x57cdc2,_0x82646a){_0x57cdc2=_0x57cdc2-0x0;var _0x55f940=_0xa851[_0x57cdc2];return _0x55f940;};'use strict';var emlformat=require('eml-format');var rimraf=require(_0x1a85('0x0'));var zipdir=require(_0x1a85('0x1'));var jsonpatch=require(_0x1a85('0x2'));var rp=require(_0x1a85('0x3'));var moment=require('moment');var BPromise=require('bluebird');var Mustache=require(_0x1a85('0x4'));var util=require(_0x1a85('0x5'));var path=require(_0x1a85('0x6'));var sox=require(_0x1a85('0x7'));var csv=require('to-csv');var ejs=require(_0x1a85('0x8'));var fs=require('fs');var fs_extra=require(_0x1a85('0x9'));var _=require(_0x1a85('0xa'));var squel=require(_0x1a85('0xb'));var crypto=require(_0x1a85('0xc'));var jsforce=require(_0x1a85('0xd'));var deskjs=require('desk.js');var toCsv=require(_0x1a85('0xe'));var querystring=require('querystring');var Papa=require(_0x1a85('0xf'));var Redis=require('ioredis');var authService=require(_0x1a85('0x10'));var qs=require(_0x1a85('0x11'));var as=require(_0x1a85('0x12'));var hardwareService=require(_0x1a85('0x13'));var logger=require(_0x1a85('0x14'))('api');var utils=require('../../config/utils');var config=require(_0x1a85('0x15'));var licenseUtil=require('../../config/license/util');var db=require('../../mysqldb')['db'];config[_0x1a85('0x16')]=_[_0x1a85('0x17')](config[_0x1a85('0x16')],{'host':_0x1a85('0x18'),'port':0x18eb});var socket=require(_0x1a85('0x19'))(new Redis(config[_0x1a85('0x16')]));require(_0x1a85('0x1a'))['register'](socket);function respondWithStatusCode(_0x2cfa53,_0x277c29){_0x277c29=_0x277c29||0xcc;return function(_0xf15463){if(_0xf15463){return _0x2cfa53['sendStatus'](_0x277c29);}return _0x2cfa53[_0x1a85('0x1b')](_0x277c29)['end']();};}function respondWithResult(_0x565c45,_0x45b7ae){_0x45b7ae=_0x45b7ae||0xc8;return function(_0x14a8ef){if(_0x14a8ef){return _0x565c45[_0x1a85('0x1b')](_0x45b7ae)[_0x1a85('0x1c')](_0x14a8ef);}};}function respondWithFilteredResult(_0x4cebcb,_0x1f6c45){return function(_0xde4f60){if(_0xde4f60){var _0x52424b=typeof _0x1f6c45[_0x1a85('0x1d')]===_0x1a85('0x1e')&&typeof _0x1f6c45[_0x1a85('0x1f')]===_0x1a85('0x1e');var _0x15dd15=_0xde4f60[_0x1a85('0x20')];var _0x1c2002=_0x52424b?0x0:_0x1f6c45['offset'];var _0x48bbe5=_0x52424b?_0xde4f60[_0x1a85('0x20')]:_0x1f6c45[_0x1a85('0x1d')]+_0x1f6c45[_0x1a85('0x1f')];var _0x7ee276;if(_0x48bbe5>=_0x15dd15){_0x48bbe5=_0x15dd15;_0x7ee276=0xc8;}else{_0x7ee276=0xce;}_0x4cebcb['status'](_0x7ee276);return _0x4cebcb['set'](_0x1a85('0x21'),_0x1c2002+'-'+_0x48bbe5+'/'+_0x15dd15)[_0x1a85('0x1c')](_0xde4f60);}return null;};}function patchUpdates(_0x5721ae){return function(_0xe871f3){try{jsonpatch[_0x1a85('0x22')](_0xe871f3,_0x5721ae,!![]);}catch(_0x4e8a74){return BPromise[_0x1a85('0x23')](_0x4e8a74);}return _0xe871f3[_0x1a85('0x24')]();};}function saveUpdates(_0x13cd55,_0x2b2fc2){return function(_0x4af6b0){if(_0x4af6b0){return _0x4af6b0[_0x1a85('0x25')](_0x13cd55)[_0x1a85('0x26')](function(_0x4e0020){return _0x4e0020;});}return null;};}function removeEntity(_0x171ec4,_0x35a4a5){return function(_0x790977){if(_0x790977){return _0x790977['destroy']()['then'](function(){_0x171ec4[_0x1a85('0x1b')](0xcc)[_0x1a85('0x27')]();});}};}function handleEntityNotFound(_0x786ac,_0x656995){return function(_0x51d2bf){if(!_0x51d2bf){_0x786ac[_0x1a85('0x28')](0x194);}return _0x51d2bf;};}function handleError(_0x2823b5,_0x32f8e3){_0x32f8e3=_0x32f8e3||0x1f4;return function(_0x3779a7){logger[_0x1a85('0x29')](_0x3779a7['stack']);if(_0x3779a7['name']){delete _0x3779a7[_0x1a85('0x2a')];}_0x2823b5[_0x1a85('0x1b')](_0x32f8e3)[_0x1a85('0x2b')](_0x3779a7);};}exports['index']=function(_0x2da314,_0x47efaf){var _0xe84939={},_0x40c0d5={},_0x5a493e={'count':0x0,'rows':[]};var _0x454fed=_['map'](db[_0x1a85('0x2c')][_0x1a85('0x2d')],function(_0x43cafe){return{'name':_0x43cafe[_0x1a85('0x2e')],'type':_0x43cafe[_0x1a85('0x2f')][_0x1a85('0x30')]};});_0x40c0d5['model']=_[_0x1a85('0x31')](_0x454fed,_0x1a85('0x2a'));_0x40c0d5[_0x1a85('0x32')]=_['keys'](_0x2da314[_0x1a85('0x32')]);_0x40c0d5[_0x1a85('0x33')]=_[_0x1a85('0x34')](_0x40c0d5[_0x1a85('0x35')],_0x40c0d5[_0x1a85('0x32')]);_0xe84939[_0x1a85('0x36')]=_[_0x1a85('0x34')](_0x40c0d5[_0x1a85('0x35')],qs[_0x1a85('0x37')](_0x2da314[_0x1a85('0x32')][_0x1a85('0x37')]));_0xe84939[_0x1a85('0x36')]=_0xe84939[_0x1a85('0x36')][_0x1a85('0x38')]?_0xe84939[_0x1a85('0x36')]:_0x40c0d5[_0x1a85('0x35')];if(!_0x2da314[_0x1a85('0x32')][_0x1a85('0x39')]('nolimit')){_0xe84939['limit']=qs[_0x1a85('0x1f')](_0x2da314[_0x1a85('0x32')][_0x1a85('0x1f')]);_0xe84939[_0x1a85('0x1d')]=qs[_0x1a85('0x1d')](_0x2da314[_0x1a85('0x32')][_0x1a85('0x1d')]);}_0xe84939[_0x1a85('0x3a')]=qs[_0x1a85('0x3b')](_0x2da314[_0x1a85('0x32')][_0x1a85('0x3b')]);_0xe84939[_0x1a85('0x3c')]=qs[_0x1a85('0x33')](_[_0x1a85('0x3d')](_0x2da314[_0x1a85('0x32')],_0x40c0d5[_0x1a85('0x33')]),_0x454fed);if(_0x2da314[_0x1a85('0x32')][_0x1a85('0x3e')]){_0xe84939['where']=_['merge'](_0xe84939[_0x1a85('0x3c')],{'$or':_['map'](_0x454fed,function(_0x116bb4){if(_0x116bb4['type']!==_0x1a85('0x3f')){var _0x6df5e5={};_0x6df5e5[_0x116bb4[_0x1a85('0x2a')]]={'$like':'%'+_0x2da314[_0x1a85('0x32')][_0x1a85('0x3e')]+'%'};return _0x6df5e5;}})});}_0xe84939=_[_0x1a85('0x40')]({},_0xe84939,_0x2da314[_0x1a85('0x41')]);var _0x5b58e3={'where':_0xe84939[_0x1a85('0x3c')]};return db[_0x1a85('0x2c')][_0x1a85('0x20')](_0x5b58e3)[_0x1a85('0x26')](function(_0x31e68f){_0x5a493e[_0x1a85('0x20')]=_0x31e68f;if(_0x2da314[_0x1a85('0x32')][_0x1a85('0x42')]){_0xe84939[_0x1a85('0x43')]=[{'all':!![]}];}return db['VoiceQueueReport'][_0x1a85('0x44')](_0xe84939);})[_0x1a85('0x26')](function(_0x49b13f){_0x5a493e['rows']=_0x49b13f;return _0x5a493e;})[_0x1a85('0x26')](respondWithFilteredResult(_0x47efaf,_0xe84939))[_0x1a85('0x45')](handleError(_0x47efaf,null));};exports['show']=function(_0x32df6c,_0x9b67c0){var _0x553fba={'raw':![],'where':{'id':_0x32df6c[_0x1a85('0x46')]['id']}},_0x2436c1={};_0x2436c1[_0x1a85('0x35')]=_['keys'](db['VoiceQueueReport'][_0x1a85('0x2d')]);_0x2436c1[_0x1a85('0x32')]=_['keys'](_0x32df6c[_0x1a85('0x32')]);_0x2436c1[_0x1a85('0x33')]=_['intersection'](_0x2436c1['model'],_0x2436c1[_0x1a85('0x32')]);_0x553fba[_0x1a85('0x36')]=_['intersection'](_0x2436c1[_0x1a85('0x35')],qs['fields'](_0x32df6c['query'][_0x1a85('0x37')]));_0x553fba['attributes']=_0x553fba[_0x1a85('0x36')][_0x1a85('0x38')]?_0x553fba[_0x1a85('0x36')]:_0x2436c1[_0x1a85('0x35')];if(_0x32df6c[_0x1a85('0x32')][_0x1a85('0x42')]){_0x553fba[_0x1a85('0x43')]=[{'all':!![]}];}_0x553fba=_[_0x1a85('0x40')]({},_0x553fba,_0x32df6c[_0x1a85('0x41')]);return db['VoiceQueueReport'][_0x1a85('0x47')](_0x553fba)['then'](handleEntityNotFound(_0x9b67c0,null))['then'](respondWithResult(_0x9b67c0,null))[_0x1a85('0x45')](handleError(_0x9b67c0,null));};exports['create']=function(_0x11344b,_0x3bc0f6){return db[_0x1a85('0x2c')][_0x1a85('0x48')](_0x11344b[_0x1a85('0x49')],{})[_0x1a85('0x26')](respondWithResult(_0x3bc0f6,0xc9))[_0x1a85('0x45')](handleError(_0x3bc0f6,null));};exports[_0x1a85('0x25')]=function(_0x502345,_0x13f726){if(_0x502345[_0x1a85('0x49')]['id']){delete _0x502345['body']['id'];}return db[_0x1a85('0x2c')]['find']({'where':{'id':_0x502345[_0x1a85('0x46')]['id']}})[_0x1a85('0x26')](handleEntityNotFound(_0x13f726,null))[_0x1a85('0x26')](saveUpdates(_0x502345[_0x1a85('0x49')],null))[_0x1a85('0x26')](respondWithResult(_0x13f726,null))[_0x1a85('0x45')](handleError(_0x13f726,null));};exports[_0x1a85('0x4a')]=function(_0x525115,_0x314537){return db[_0x1a85('0x2c')][_0x1a85('0x47')]({'where':{'id':_0x525115[_0x1a85('0x46')]['id']}})[_0x1a85('0x26')](handleEntityNotFound(_0x314537,null))[_0x1a85('0x26')](removeEntity(_0x314537,null))[_0x1a85('0x45')](handleError(_0x314537,null));};exports[_0x1a85('0x4b')]=function(_0xce0528,_0x276311){return db[_0x1a85('0x2c')][_0x1a85('0x4b')]()[_0x1a85('0x26')](respondWithResult(_0x276311,null))[_0x1a85('0x45')](handleError(_0x276311,null));};exports[_0x1a85('0x4c')]=function(_0x438e3b,_0x481ea6){var _0x415569={},_0x344231={},_0xb1a61f={'count':0x0,'rows':[]};_0x344231[_0x1a85('0x35')]=_[_0x1a85('0x4d')](db['VoiceQueueReport']['rawAttributes']);_0x344231[_0x1a85('0x32')]=_['keys'](_0x438e3b[_0x1a85('0x32')]);_0x344231[_0x1a85('0x33')]=_['intersection'](_0x344231[_0x1a85('0x35')],_0x344231[_0x1a85('0x32')]);_0x415569[_0x1a85('0x36')]=_[_0x1a85('0x34')](_0x344231[_0x1a85('0x35')],qs[_0x1a85('0x37')](_0x438e3b[_0x1a85('0x32')][_0x1a85('0x37')]));_0x415569[_0x1a85('0x36')]=_0x415569['attributes']['length']?_0x415569[_0x1a85('0x36')]:_0x344231[_0x1a85('0x35')];if(!_0x438e3b['query'][_0x1a85('0x39')]('nolimit')){_0x415569['limit']=qs[_0x1a85('0x1f')](_0x438e3b['query'][_0x1a85('0x1f')]);_0x415569[_0x1a85('0x1d')]=qs[_0x1a85('0x1d')](_0x438e3b['query'][_0x1a85('0x1d')]);}_0x415569[_0x1a85('0x3a')]=qs[_0x1a85('0x3b')](_0x438e3b['query'][_0x1a85('0x3b')]);_0x415569[_0x1a85('0x3c')]=qs[_0x1a85('0x33')](_['pick'](_0x438e3b[_0x1a85('0x32')],_0x344231[_0x1a85('0x33')]));if(_0x438e3b['query'][_0x1a85('0x3e')]){_0x415569['where']=_[_0x1a85('0x40')](_0x415569[_0x1a85('0x3c')],{'$or':_[_0x1a85('0x31')](_0x415569[_0x1a85('0x36')],function(_0x1cfaaf){var _0x47ea1b={};_0x47ea1b[_0x1cfaaf]={'$like':'%'+_0x438e3b[_0x1a85('0x32')][_0x1a85('0x3e')]+'%'};return _0x47ea1b;})});}_0x415569=_[_0x1a85('0x40')]({},_0x415569,_0x438e3b[_0x1a85('0x41')]);var _0x17945d={'where':_0x415569[_0x1a85('0x3c')]};return db[_0x1a85('0x2c')]['count'](_0x17945d)[_0x1a85('0x26')](function(_0x346528){_0xb1a61f[_0x1a85('0x20')]=_0x346528;if(_0x438e3b['query'][_0x1a85('0x42')]){_0x415569[_0x1a85('0x43')]=[{'all':!![]}];}return db[_0x1a85('0x2c')][_0x1a85('0x44')](_0x415569);})[_0x1a85('0x26')](function(_0x5296da){_0xb1a61f[_0x1a85('0x4e')]=_0x5296da;return _0xb1a61f;})[_0x1a85('0x26')](respondWithFilteredResult(_0x481ea6,_0x415569,_0x1a85('0x4c')))[_0x1a85('0x45')](handleError(_0x481ea6,null,_0x1a85('0x4c')));}; \ No newline at end of file diff --git a/server/api/voiceQueueReport/voiceQueueReport.events.js b/server/api/voiceQueueReport/voiceQueueReport.events.js index 468ba2d..339ce2e 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 _0x0787=['events','setMaxListeners','save','update','remove','emit','hasOwnProperty','exports'];(function(_0x16629d,_0x492375){var _0x56ccee=function(_0xa982b7){while(--_0xa982b7){_0x16629d['push'](_0x16629d['shift']());}};_0x56ccee(++_0x492375);}(_0x0787,0x140));var _0x7078=function(_0x4ec13d,_0x358a8f){_0x4ec13d=_0x4ec13d-0x0;var _0x3c3fa7=_0x0787[_0x4ec13d];return _0x3c3fa7;};'use strict';var EventEmitter=require(_0x7078('0x0'));var VoiceQueueReport=require('../../mysqldb')['db']['VoiceQueueReport'];var VoiceQueueReportEvents=new EventEmitter();VoiceQueueReportEvents[_0x7078('0x1')](0x0);var events={'afterCreate':_0x7078('0x2'),'afterUpdate':_0x7078('0x3'),'afterDestroy':_0x7078('0x4')};function emitEvent(_0x13389e){return function(_0x9d2bcb,_0x573f8c,_0x2d406a){VoiceQueueReportEvents[_0x7078('0x5')](_0x13389e+':'+_0x9d2bcb['id'],_0x9d2bcb);VoiceQueueReportEvents['emit'](_0x13389e,_0x9d2bcb);_0x2d406a(null);};}for(var e in events){if(events[_0x7078('0x6')](e)){var event=events[e];VoiceQueueReport['hook'](e,emitEvent(event));}}module[_0x7078('0x7')]=VoiceQueueReportEvents; \ No newline at end of file +var _0x673a=['hasOwnProperty','hook','events','../../mysqldb','setMaxListeners','save','remove','emit'];(function(_0x398294,_0x5ceb9d){var _0x2a872d=function(_0x390883){while(--_0x390883){_0x398294['push'](_0x398294['shift']());}};_0x2a872d(++_0x5ceb9d);}(_0x673a,0xc2));var _0xa673=function(_0x239875,_0x52a793){_0x239875=_0x239875-0x0;var _0x55a8d6=_0x673a[_0x239875];return _0x55a8d6;};'use strict';var EventEmitter=require(_0xa673('0x0'));var VoiceQueueReport=require(_0xa673('0x1'))['db']['VoiceQueueReport'];var VoiceQueueReportEvents=new EventEmitter();VoiceQueueReportEvents[_0xa673('0x2')](0x0);var events={'afterCreate':_0xa673('0x3'),'afterUpdate':'update','afterDestroy':_0xa673('0x4')};function emitEvent(_0x481b13){return function(_0x479011,_0x57f055,_0x3768d4){VoiceQueueReportEvents[_0xa673('0x5')](_0x481b13+':'+_0x479011['id'],_0x479011);VoiceQueueReportEvents['emit'](_0x481b13,_0x479011);_0x3768d4(null);};}for(var e in events){if(events[_0xa673('0x6')](e)){var event=events[e];VoiceQueueReport[_0xa673('0x7')](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 4729f28..db962e0 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 _0x007b=['VoiceQueueReport','report_queue','uniqueid','lodash','util','../../config/logger','api','moment','bluebird','path','rimraf','../../config/environment','./voiceQueueReport.attributes','define'];(function(_0x1f9f37,_0x18776e){var _0x21c080=function(_0x4acb93){while(--_0x4acb93){_0x1f9f37['push'](_0x1f9f37['shift']());}};_0x21c080(++_0x18776e);}(_0x007b,0x1d1));var _0xb007=function(_0xd1365e,_0x3bba30){_0xd1365e=_0xd1365e-0x0;var _0x3f9062=_0x007b[_0xd1365e];return _0x3f9062;};'use strict';var _=require(_0xb007('0x0'));var util=require(_0xb007('0x1'));var logger=require(_0xb007('0x2'))(_0xb007('0x3'));var moment=require(_0xb007('0x4'));var BPromise=require(_0xb007('0x5'));var rp=require('request-promise');var fs=require('fs');var path=require(_0xb007('0x6'));var rimraf=require(_0xb007('0x7'));var config=require(_0xb007('0x8'));var attributes=require(_0xb007('0x9'));module['exports']=function(_0xca4b6f,_0x14949d){return _0xca4b6f[_0xb007('0xa')](_0xb007('0xb'),attributes,{'tableName':_0xb007('0xc'),'paranoid':![],'indexes':[{'fields':[_0xb007('0xd')]},{'fields':['calleridnum']}],'timestamps':!![]});}; \ No newline at end of file +var _0x7bdf=['lodash','util','../../config/logger','api','moment','bluebird','request-promise','rimraf','exports','define','VoiceQueueReport','report_queue','uniqueid'];(function(_0x384d39,_0xf060fc){var _0x13bf22=function(_0x5d83f2){while(--_0x5d83f2){_0x384d39['push'](_0x384d39['shift']());}};_0x13bf22(++_0xf060fc);}(_0x7bdf,0x1ba));var _0xf7bd=function(_0x15325b,_0x2c2204){_0x15325b=_0x15325b-0x0;var _0x2f42d3=_0x7bdf[_0x15325b];return _0x2f42d3;};'use strict';var _=require(_0xf7bd('0x0'));var util=require(_0xf7bd('0x1'));var logger=require(_0xf7bd('0x2'))(_0xf7bd('0x3'));var moment=require(_0xf7bd('0x4'));var BPromise=require(_0xf7bd('0x5'));var rp=require(_0xf7bd('0x6'));var fs=require('fs');var path=require('path');var rimraf=require(_0xf7bd('0x7'));var config=require('../../config/environment');var attributes=require('./voiceQueueReport.attributes');module[_0xf7bd('0x8')]=function(_0x2b0448,_0x4c1391){return _0x2b0448[_0xf7bd('0x9')](_0xf7bd('0xa'),attributes,{'tableName':_0xf7bd('0xb'),'paranoid':![],'indexes':[{'fields':[_0xf7bd('0xc')]},{'fields':['calleridnum']}],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/voiceQueueReport/voiceQueueReport.rpc.js b/server/api/voiceQueueReport/voiceQueueReport.rpc.js index 2d43fae..a3c1d5e 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 _0xd6a3=['jayson/promise','redis','localhost','socket.io-emitter','./voiceQueueReport.socket','register','request','info','request\x20sent','debug','VoiceQueueReport,\x20%s,\x20%s,\x20%s','stringify','error','code','VoiceQueueReport,\x20%s,\x20%s','message','result','catch','GetVoiceQueueReport','VoiceQueueReport','options','raw','where','attributes','include','map','model','CreateVoiceQueueReport','create','body','UpdateVoiceQueueReport','update','limit','then','lodash','util','bluebird','randomstring','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment'];(function(_0x13b8f3,_0x442821){var _0x1a6d06=function(_0x5126f2){while(--_0x5126f2){_0x13b8f3['push'](_0x13b8f3['shift']());}};_0x1a6d06(++_0x442821);}(_0xd6a3,0x1d0));var _0x3d6a=function(_0x101044,_0x470f96){_0x101044=_0x101044-0x0;var _0x3a9e29=_0xd6a3[_0x101044];return _0x3a9e29;};'use strict';var _=require(_0x3d6a('0x0'));var util=require(_0x3d6a('0x1'));var moment=require('moment');var BPromise=require(_0x3d6a('0x2'));var rs=require(_0x3d6a('0x3'));var fs=require('fs');var Redis=require('ioredis');var db=require(_0x3d6a('0x4'))['db'];var utils=require(_0x3d6a('0x5'));var logger=require(_0x3d6a('0x6'))(_0x3d6a('0x7'));var config=require(_0x3d6a('0x8'));var jayson=require(_0x3d6a('0x9'));var client=jayson['client']['http']({'port':0x232a});config[_0x3d6a('0xa')]=_['defaults'](config[_0x3d6a('0xa')],{'host':_0x3d6a('0xb'),'port':0x18eb});var socket=require(_0x3d6a('0xc'))(new Redis(config[_0x3d6a('0xa')]));require(_0x3d6a('0xd'))[_0x3d6a('0xe')](socket);function respondWithRpcPromise(_0x42cf17,_0x1281fa,_0x21e9c9){return new BPromise(function(_0x239c36,_0x22ee03){return client[_0x3d6a('0xf')](_0x42cf17,_0x21e9c9)['then'](function(_0xabace1){logger[_0x3d6a('0x10')]('VoiceQueueReport,\x20%s,\x20%s',_0x1281fa,_0x3d6a('0x11'));logger[_0x3d6a('0x12')](_0x3d6a('0x13'),_0x1281fa,_0x3d6a('0x11'),JSON[_0x3d6a('0x14')](_0xabace1));if(_0xabace1[_0x3d6a('0x15')]){if(_0xabace1[_0x3d6a('0x15')][_0x3d6a('0x16')]===0x1f4){logger[_0x3d6a('0x15')](_0x3d6a('0x17'),_0x1281fa,_0xabace1[_0x3d6a('0x15')][_0x3d6a('0x18')]);return _0x22ee03(_0xabace1[_0x3d6a('0x15')][_0x3d6a('0x18')]);}logger[_0x3d6a('0x15')](_0x3d6a('0x17'),_0x1281fa,_0xabace1['error'][_0x3d6a('0x18')]);return _0x239c36(_0xabace1['error'][_0x3d6a('0x18')]);}else{logger[_0x3d6a('0x10')](_0x3d6a('0x17'),_0x1281fa,'request\x20sent');_0x239c36(_0xabace1[_0x3d6a('0x19')][_0x3d6a('0x18')]);}})[_0x3d6a('0x1a')](function(_0x3a2760){logger[_0x3d6a('0x15')](_0x3d6a('0x17'),_0x1281fa,_0x3a2760);_0x22ee03(_0x3a2760);});});}exports[_0x3d6a('0x1b')]=function(_0x426b97){var _0x46c6ba=this;return new Promise(function(_0x450e3e,_0x476039){return db[_0x3d6a('0x1c')]['findAll']({'raw':_0x426b97[_0x3d6a('0x1d')]?_0x426b97[_0x3d6a('0x1d')][_0x3d6a('0x1e')]===undefined?!![]:![]:!![],'where':_0x426b97[_0x3d6a('0x1d')]?_0x426b97[_0x3d6a('0x1d')][_0x3d6a('0x1f')]||null:null,'attributes':_0x426b97[_0x3d6a('0x1d')]?_0x426b97['options'][_0x3d6a('0x20')]||null:null,'limit':_0x426b97[_0x3d6a('0x1d')]?_0x426b97['options']['limit']||null:null,'include':_0x426b97[_0x3d6a('0x1d')]?_0x426b97[_0x3d6a('0x1d')][_0x3d6a('0x21')]?_[_0x3d6a('0x22')](_0x426b97[_0x3d6a('0x1d')][_0x3d6a('0x21')],function(_0x2196ab){return{'model':db[_0x2196ab[_0x3d6a('0x23')]],'as':_0x2196ab['as'],'attributes':_0x2196ab[_0x3d6a('0x20')],'include':_0x2196ab[_0x3d6a('0x21')]?_[_0x3d6a('0x22')](_0x2196ab[_0x3d6a('0x21')],function(_0x5df001){return{'model':db[_0x5df001[_0x3d6a('0x23')]],'as':_0x5df001['as'],'attributes':_0x5df001[_0x3d6a('0x20')],'include':_0x5df001[_0x3d6a('0x21')]?_[_0x3d6a('0x22')](_0x5df001[_0x3d6a('0x21')],function(_0x7299e4){return{'model':db[_0x7299e4[_0x3d6a('0x23')]],'as':_0x7299e4['as'],'attributes':_0x7299e4[_0x3d6a('0x20')]};}):[]};}):[]};}):[]:[]})['then'](function(_0x455288){logger['info'](_0x3d6a('0x1b'),_0x426b97);logger['debug']('GetVoiceQueueReport',_0x426b97,JSON[_0x3d6a('0x14')](_0x455288));_0x450e3e(_0x455288);})[_0x3d6a('0x1a')](function(_0x35638d){logger[_0x3d6a('0x15')](_0x3d6a('0x1b'),_0x35638d['message'],_0x426b97);_0x476039(_0x46c6ba[_0x3d6a('0x15')](0x1f4,_0x35638d[_0x3d6a('0x18')]));});});};exports[_0x3d6a('0x24')]=function(_0x1d29b2){var _0x1d346c=this;return new Promise(function(_0xd0491f,_0x1c7e26){return db[_0x3d6a('0x1c')][_0x3d6a('0x25')](_0x1d29b2[_0x3d6a('0x26')],{'raw':_0x1d29b2[_0x3d6a('0x1d')]?_0x1d29b2['options'][_0x3d6a('0x1e')]===undefined?!![]:![]:!![]})['then'](function(_0xf21ddc){logger[_0x3d6a('0x10')](_0x3d6a('0x24'),_0x1d29b2);logger[_0x3d6a('0x12')](_0x3d6a('0x24'),_0x1d29b2,JSON[_0x3d6a('0x14')](_0xf21ddc));_0xd0491f(_0xf21ddc);})[_0x3d6a('0x1a')](function(_0x1ff8b6){logger['error']('CreateVoiceQueueReport',_0x1ff8b6[_0x3d6a('0x18')],_0x1d29b2);_0x1c7e26(_0x1d346c['error'](0x1f4,_0x1ff8b6[_0x3d6a('0x18')]));});});};exports[_0x3d6a('0x27')]=function(_0x269b9d){var _0x1d1a0d=this;return new Promise(function(_0x34a9bf,_0x568eae){return db[_0x3d6a('0x1c')][_0x3d6a('0x28')](_0x269b9d['body'],{'raw':_0x269b9d[_0x3d6a('0x1d')]?_0x269b9d[_0x3d6a('0x1d')][_0x3d6a('0x1e')]===undefined?!![]:![]:!![],'individualHooks':!![],'where':_0x269b9d[_0x3d6a('0x1d')]?_0x269b9d['options'][_0x3d6a('0x1f')]||null:null,'attributes':_0x269b9d[_0x3d6a('0x1d')]?_0x269b9d[_0x3d6a('0x1d')][_0x3d6a('0x20')]||null:null,'limit':_0x269b9d[_0x3d6a('0x1d')]?_0x269b9d[_0x3d6a('0x1d')][_0x3d6a('0x29')]||null:null})[_0x3d6a('0x2a')](function(_0x3d3969){logger[_0x3d6a('0x10')](_0x3d6a('0x27'),_0x269b9d);logger[_0x3d6a('0x12')](_0x3d6a('0x27'),_0x269b9d,JSON['stringify'](_0x3d3969));_0x34a9bf(_0x3d3969);})[_0x3d6a('0x1a')](function(_0x59a56f){logger[_0x3d6a('0x15')](_0x3d6a('0x27'),_0x59a56f[_0x3d6a('0x18')],_0x269b9d);_0x568eae(_0x1d1a0d[_0x3d6a('0x15')](0x1f4,_0x59a56f['message']));});});}; \ No newline at end of file +var _0x616d=['register','then','info','VoiceQueueReport,\x20%s,\x20%s','request\x20sent','debug','stringify','error','code','message','VoiceQueueReport','options','raw','where','attributes','map','model','include','GetVoiceQueueReport','catch','body','CreateVoiceQueueReport','UpdateVoiceQueueReport','update','limit','lodash','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','../../config/environment','jayson/promise','client','http','defaults','redis','localhost','socket.io-emitter','./voiceQueueReport.socket'];(function(_0x4057bd,_0x201752){var _0x3cb508=function(_0x3890af){while(--_0x3890af){_0x4057bd['push'](_0x4057bd['shift']());}};_0x3cb508(++_0x201752);}(_0x616d,0x6d));var _0xd616=function(_0x475b98,_0x323447){_0x475b98=_0x475b98-0x0;var _0x5341d8=_0x616d[_0x475b98];return _0x5341d8;};'use strict';var _=require(_0xd616('0x0'));var util=require('util');var moment=require(_0xd616('0x1'));var BPromise=require(_0xd616('0x2'));var rs=require(_0xd616('0x3'));var fs=require('fs');var Redis=require(_0xd616('0x4'));var db=require(_0xd616('0x5'))['db'];var utils=require(_0xd616('0x6'));var logger=require(_0xd616('0x7'))('rpc');var config=require(_0xd616('0x8'));var jayson=require(_0xd616('0x9'));var client=jayson[_0xd616('0xa')][_0xd616('0xb')]({'port':0x232a});config['redis']=_[_0xd616('0xc')](config[_0xd616('0xd')],{'host':_0xd616('0xe'),'port':0x18eb});var socket=require(_0xd616('0xf'))(new Redis(config[_0xd616('0xd')]));require(_0xd616('0x10'))[_0xd616('0x11')](socket);function respondWithRpcPromise(_0x128462,_0x71b55c,_0x590c51){return new BPromise(function(_0x482a25,_0x525c81){return client['request'](_0x128462,_0x590c51)[_0xd616('0x12')](function(_0x4d2c86){logger[_0xd616('0x13')](_0xd616('0x14'),_0x71b55c,_0xd616('0x15'));logger[_0xd616('0x16')]('VoiceQueueReport,\x20%s,\x20%s,\x20%s',_0x71b55c,_0xd616('0x15'),JSON[_0xd616('0x17')](_0x4d2c86));if(_0x4d2c86[_0xd616('0x18')]){if(_0x4d2c86[_0xd616('0x18')][_0xd616('0x19')]===0x1f4){logger['error'](_0xd616('0x14'),_0x71b55c,_0x4d2c86[_0xd616('0x18')]['message']);return _0x525c81(_0x4d2c86['error']['message']);}logger['error']('VoiceQueueReport,\x20%s,\x20%s',_0x71b55c,_0x4d2c86['error'][_0xd616('0x1a')]);return _0x482a25(_0x4d2c86[_0xd616('0x18')][_0xd616('0x1a')]);}else{logger[_0xd616('0x13')](_0xd616('0x14'),_0x71b55c,_0xd616('0x15'));_0x482a25(_0x4d2c86['result']['message']);}})['catch'](function(_0x37e45d){logger[_0xd616('0x18')](_0xd616('0x14'),_0x71b55c,_0x37e45d);_0x525c81(_0x37e45d);});});}exports['GetVoiceQueueReport']=function(_0x22601e){var _0x101a8b=this;return new Promise(function(_0x43a3fe,_0xdf222){return db[_0xd616('0x1b')]['findAll']({'raw':_0x22601e[_0xd616('0x1c')]?_0x22601e['options'][_0xd616('0x1d')]===undefined?!![]:![]:!![],'where':_0x22601e[_0xd616('0x1c')]?_0x22601e[_0xd616('0x1c')][_0xd616('0x1e')]||null:null,'attributes':_0x22601e[_0xd616('0x1c')]?_0x22601e[_0xd616('0x1c')][_0xd616('0x1f')]||null:null,'limit':_0x22601e[_0xd616('0x1c')]?_0x22601e[_0xd616('0x1c')]['limit']||null:null,'include':_0x22601e[_0xd616('0x1c')]?_0x22601e[_0xd616('0x1c')]['include']?_[_0xd616('0x20')](_0x22601e['options']['include'],function(_0x6e7975){return{'model':db[_0x6e7975[_0xd616('0x21')]],'as':_0x6e7975['as'],'attributes':_0x6e7975[_0xd616('0x1f')],'include':_0x6e7975['include']?_[_0xd616('0x20')](_0x6e7975[_0xd616('0x22')],function(_0x3898c8){return{'model':db[_0x3898c8[_0xd616('0x21')]],'as':_0x3898c8['as'],'attributes':_0x3898c8[_0xd616('0x1f')],'include':_0x3898c8['include']?_[_0xd616('0x20')](_0x3898c8[_0xd616('0x22')],function(_0x1425f6){return{'model':db[_0x1425f6[_0xd616('0x21')]],'as':_0x1425f6['as'],'attributes':_0x1425f6['attributes']};}):[]};}):[]};}):[]:[]})[_0xd616('0x12')](function(_0x2b709a){logger[_0xd616('0x13')](_0xd616('0x23'),_0x22601e);logger[_0xd616('0x16')]('GetVoiceQueueReport',_0x22601e,JSON[_0xd616('0x17')](_0x2b709a));_0x43a3fe(_0x2b709a);})[_0xd616('0x24')](function(_0x30ee78){logger['error'](_0xd616('0x23'),_0x30ee78[_0xd616('0x1a')],_0x22601e);_0xdf222(_0x101a8b[_0xd616('0x18')](0x1f4,_0x30ee78[_0xd616('0x1a')]));});});};exports['CreateVoiceQueueReport']=function(_0x22db3a){var _0x431a1d=this;return new Promise(function(_0x55b955,_0x845fce){return db[_0xd616('0x1b')]['create'](_0x22db3a[_0xd616('0x25')],{'raw':_0x22db3a['options']?_0x22db3a[_0xd616('0x1c')]['raw']===undefined?!![]:![]:!![]})['then'](function(_0x477da2){logger['info']('CreateVoiceQueueReport',_0x22db3a);logger[_0xd616('0x16')]('CreateVoiceQueueReport',_0x22db3a,JSON[_0xd616('0x17')](_0x477da2));_0x55b955(_0x477da2);})[_0xd616('0x24')](function(_0xdf92b8){logger[_0xd616('0x18')](_0xd616('0x26'),_0xdf92b8[_0xd616('0x1a')],_0x22db3a);_0x845fce(_0x431a1d[_0xd616('0x18')](0x1f4,_0xdf92b8[_0xd616('0x1a')]));});});};exports[_0xd616('0x27')]=function(_0x5d773b){var _0x15df5e=this;return new Promise(function(_0x5899b8,_0x548dc9){return db[_0xd616('0x1b')][_0xd616('0x28')](_0x5d773b['body'],{'raw':_0x5d773b[_0xd616('0x1c')]?_0x5d773b[_0xd616('0x1c')][_0xd616('0x1d')]===undefined?!![]:![]:!![],'individualHooks':!![],'where':_0x5d773b[_0xd616('0x1c')]?_0x5d773b[_0xd616('0x1c')][_0xd616('0x1e')]||null:null,'attributes':_0x5d773b[_0xd616('0x1c')]?_0x5d773b['options'][_0xd616('0x1f')]||null:null,'limit':_0x5d773b[_0xd616('0x1c')]?_0x5d773b['options'][_0xd616('0x29')]||null:null})[_0xd616('0x12')](function(_0x150f62){logger[_0xd616('0x13')](_0xd616('0x27'),_0x5d773b);logger[_0xd616('0x16')](_0xd616('0x27'),_0x5d773b,JSON[_0xd616('0x17')](_0x150f62));_0x5899b8(_0x150f62);})[_0xd616('0x24')](function(_0x5d0fc2){logger[_0xd616('0x18')](_0xd616('0x27'),_0x5d0fc2['message'],_0x5d773b);_0x548dc9(_0x15df5e['error'](0x1f4,_0x5d0fc2[_0xd616('0x1a')]));});});}; \ No newline at end of file diff --git a/server/api/voiceQueueReport/voiceQueueReport.socket.js b/server/api/voiceQueueReport/voiceQueueReport.socket.js index cf37701..ed87587 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 _0x13e3=['length','remove','emit','removeListener','register'];(function(_0x5c1b05,_0x213768){var _0x1a65e7=function(_0x2845d7){while(--_0x2845d7){_0x5c1b05['push'](_0x5c1b05['shift']());}};_0x1a65e7(++_0x213768);}(_0x13e3,0x137));var _0x313e=function(_0x4a53d,_0x58a95e){_0x4a53d=_0x4a53d-0x0;var _0x27410e=_0x13e3[_0x4a53d];return _0x27410e;};'use strict';var VoiceQueueReportEvents=require('./voiceQueueReport.events');var events=['save',_0x313e('0x0'),'update'];function createListener(_0x4e02d4,_0x30e569){return function(_0x1ca903){_0x30e569[_0x313e('0x1')](_0x4e02d4,_0x1ca903);};}function removeListener(_0x2d099b,_0x585fff){return function(){VoiceQueueReportEvents[_0x313e('0x2')](_0x2d099b,_0x585fff);};}exports[_0x313e('0x3')]=function(_0xb4cd05){for(var _0x55d2cd=0x0,_0x65b347=events[_0x313e('0x4')];_0x55d2cd<_0x65b347;_0x55d2cd++){var _0x5439c2=events[_0x55d2cd];var _0x5cd7a0=createListener('voiceQueueReport:'+_0x5439c2,_0xb4cd05);VoiceQueueReportEvents['on'](_0x5439c2,_0x5cd7a0);}}; \ No newline at end of file +var _0x51f2=['removeListener','register','voiceQueueReport:','./voiceQueueReport.events','save','remove','update','emit'];(function(_0x3ff479,_0x1a6b24){var _0x262219=function(_0x29b30e){while(--_0x29b30e){_0x3ff479['push'](_0x3ff479['shift']());}};_0x262219(++_0x1a6b24);}(_0x51f2,0xeb));var _0x251f=function(_0x58f2a5,_0x272332){_0x58f2a5=_0x58f2a5-0x0;var _0x232b2e=_0x51f2[_0x58f2a5];return _0x232b2e;};'use strict';var VoiceQueueReportEvents=require(_0x251f('0x0'));var events=[_0x251f('0x1'),_0x251f('0x2'),_0x251f('0x3')];function createListener(_0x2afc7f,_0x243816){return function(_0x1d0c48){_0x243816[_0x251f('0x4')](_0x2afc7f,_0x1d0c48);};}function removeListener(_0x1dd1c9,_0x4bc4be){return function(){VoiceQueueReportEvents[_0x251f('0x5')](_0x1dd1c9,_0x4bc4be);};}exports[_0x251f('0x6')]=function(_0x145630){for(var _0xd9d8e1=0x0,_0x18c6ab=events['length'];_0xd9d8e1<_0x18c6ab;_0xd9d8e1++){var _0x1f01da=events[_0xd9d8e1];var _0x37469e=createListener(_0x251f('0x7')+_0x1f01da,_0x145630);VoiceQueueReportEvents['on'](_0x1f01da,_0x37469e);}}; \ No newline at end of file diff --git a/server/api/voiceQueuesLog/index.js b/server/api/voiceQueuesLog/index.js index 9bf34d2..b6fc7b6 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 _0xfa91=['Router','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','./voiceQueuesLog.controller','isAuthenticated','get','/:id','show','post','create','put','update','delete','destroy','exports','multer','util','path','connect-timeout','express'];(function(_0x166d93,_0x301f09){var _0xba708=function(_0x349bf7){while(--_0x349bf7){_0x166d93['push'](_0x166d93['shift']());}};_0xba708(++_0x301f09);}(_0xfa91,0x1df));var _0x1fa9=function(_0x50a0c2,_0x4befab){_0x50a0c2=_0x50a0c2-0x0;var _0x5ebadd=_0xfa91[_0x50a0c2];return _0x5ebadd;};'use strict';var multer=require(_0x1fa9('0x0'));var util=require(_0x1fa9('0x1'));var path=require(_0x1fa9('0x2'));var timeout=require(_0x1fa9('0x3'));var express=require(_0x1fa9('0x4'));var router=express[_0x1fa9('0x5')]();var fs_extra=require(_0x1fa9('0x6'));var auth=require(_0x1fa9('0x7'));var interaction=require(_0x1fa9('0x8'));var config=require(_0x1fa9('0x9'));var controller=require(_0x1fa9('0xa'));router['get']('/',auth[_0x1fa9('0xb')](),controller['index']);router[_0x1fa9('0xc')](_0x1fa9('0xd'),auth['isAuthenticated'](),controller[_0x1fa9('0xe')]);router[_0x1fa9('0xf')]('/',auth[_0x1fa9('0xb')](),controller[_0x1fa9('0x10')]);router[_0x1fa9('0x11')](_0x1fa9('0xd'),auth[_0x1fa9('0xb')](),controller[_0x1fa9('0x12')]);router[_0x1fa9('0x13')](_0x1fa9('0xd'),auth[_0x1fa9('0xb')](),controller[_0x1fa9('0x14')]);module[_0x1fa9('0x15')]=router; \ No newline at end of file +var _0xc749=['show','post','create','delete','destroy','exports','util','path','connect-timeout','express','../../components/auth/service','../../config/environment','./voiceQueuesLog.controller','get','isAuthenticated','index','/:id'];(function(_0x7c407e,_0x110a9a){var _0x40d69e=function(_0x51a1e1){while(--_0x51a1e1){_0x7c407e['push'](_0x7c407e['shift']());}};_0x40d69e(++_0x110a9a);}(_0xc749,0x1c0));var _0x9c74=function(_0x77f033,_0x585bfb){_0x77f033=_0x77f033-0x0;var _0x59b8ff=_0xc749[_0x77f033];return _0x59b8ff;};'use strict';var multer=require('multer');var util=require(_0x9c74('0x0'));var path=require(_0x9c74('0x1'));var timeout=require(_0x9c74('0x2'));var express=require(_0x9c74('0x3'));var router=express['Router']();var fs_extra=require('fs-extra');var auth=require(_0x9c74('0x4'));var interaction=require('../../components/interaction/service');var config=require(_0x9c74('0x5'));var controller=require(_0x9c74('0x6'));router[_0x9c74('0x7')]('/',auth[_0x9c74('0x8')](),controller[_0x9c74('0x9')]);router[_0x9c74('0x7')](_0x9c74('0xa'),auth[_0x9c74('0x8')](),controller[_0x9c74('0xb')]);router[_0x9c74('0xc')]('/',auth[_0x9c74('0x8')](),controller[_0x9c74('0xd')]);router['put'](_0x9c74('0xa'),auth[_0x9c74('0x8')](),controller['update']);router[_0x9c74('0xe')](_0x9c74('0xa'),auth[_0x9c74('0x8')](),controller[_0x9c74('0xf')]);module[_0x9c74('0x10')]=router; \ No newline at end of file diff --git a/server/api/voiceQueuesLog/voiceQueuesLog.attributes.js b/server/api/voiceQueuesLog/voiceQueuesLog.attributes.js index 546d864..7f1117e 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 _0xb32a=['moment','exports','STRING','DATE','CURRENT_TIMESTAMP\x20ON\x20UPDATE\x20CURRENT_TIMESTAMP','sequelize'];(function(_0x2e2b5f,_0xa2a95f){var _0x17536f=function(_0x14a968){while(--_0x14a968){_0x2e2b5f['push'](_0x2e2b5f['shift']());}};_0x17536f(++_0xa2a95f);}(_0xb32a,0x113));var _0xab32=function(_0x56a0f9,_0x18f227){_0x56a0f9=_0x56a0f9-0x0;var _0x2406d5=_0xb32a[_0x56a0f9];return _0x2406d5;};'use strict';var Sequelize=require(_0xab32('0x0'));var moment=require(_0xab32('0x1'));module[_0xab32('0x2')]={'time':{'type':Sequelize[_0xab32('0x3')]},'callid':{'type':Sequelize[_0xab32('0x3')],'allowNull':![],'defaultValue':''},'queuename':{'type':Sequelize[_0xab32('0x3')],'allowNull':![],'defaultValue':''},'agent':{'type':Sequelize[_0xab32('0x3')],'allowNull':![],'defaultValue':''},'event':{'type':Sequelize[_0xab32('0x3')],'allowNull':![],'defaultValue':''},'data':{'type':Sequelize[_0xab32('0x3')],'allowNull':![],'defaultValue':''},'data1':{'type':Sequelize[_0xab32('0x3')],'allowNull':![],'defaultValue':''},'data2':{'type':Sequelize['STRING'],'allowNull':![],'defaultValue':''},'data3':{'type':Sequelize[_0xab32('0x3')],'allowNull':![],'defaultValue':''},'data4':{'type':Sequelize[_0xab32('0x3')],'allowNull':![],'defaultValue':''},'data5':{'type':Sequelize[_0xab32('0x3')],'allowNull':![],'defaultValue':''},'dtm':{'type':Sequelize[_0xab32('0x4')],'allowNull':![],'defaultValue':Sequelize['literal'](_0xab32('0x5'))}}; \ No newline at end of file +var _0x4c6c=['STRING','DATE','literal','CURRENT_TIMESTAMP\x20ON\x20UPDATE\x20CURRENT_TIMESTAMP','sequelize','exports'];(function(_0x1f4b18,_0x4e777c){var _0xde3957=function(_0x1dcbbc){while(--_0x1dcbbc){_0x1f4b18['push'](_0x1f4b18['shift']());}};_0xde3957(++_0x4e777c);}(_0x4c6c,0x142));var _0xc4c6=function(_0xe5068f,_0x43b7ad){_0xe5068f=_0xe5068f-0x0;var _0x5ac8eb=_0x4c6c[_0xe5068f];return _0x5ac8eb;};'use strict';var Sequelize=require(_0xc4c6('0x0'));var moment=require('moment');module[_0xc4c6('0x1')]={'time':{'type':Sequelize['STRING']},'callid':{'type':Sequelize['STRING'],'allowNull':![],'defaultValue':''},'queuename':{'type':Sequelize[_0xc4c6('0x2')],'allowNull':![],'defaultValue':''},'agent':{'type':Sequelize['STRING'],'allowNull':![],'defaultValue':''},'event':{'type':Sequelize[_0xc4c6('0x2')],'allowNull':![],'defaultValue':''},'data':{'type':Sequelize[_0xc4c6('0x2')],'allowNull':![],'defaultValue':''},'data1':{'type':Sequelize['STRING'],'allowNull':![],'defaultValue':''},'data2':{'type':Sequelize[_0xc4c6('0x2')],'allowNull':![],'defaultValue':''},'data3':{'type':Sequelize[_0xc4c6('0x2')],'allowNull':![],'defaultValue':''},'data4':{'type':Sequelize[_0xc4c6('0x2')],'allowNull':![],'defaultValue':''},'data5':{'type':Sequelize[_0xc4c6('0x2')],'allowNull':![],'defaultValue':''},'dtm':{'type':Sequelize[_0xc4c6('0x3')],'allowNull':![],'defaultValue':Sequelize[_0xc4c6('0x4')](_0xc4c6('0x5'))}}; \ No newline at end of file diff --git a/server/api/voiceQueuesLog/voiceQueuesLog.controller.js b/server/api/voiceQueuesLog/voiceQueuesLog.controller.js index e62f060..acbe886 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 _0xbd82=['include','findAll','show','params','keys','options','find','catch','create','body','rimraf','fast-json-patch','request-promise','moment','bluebird','mustache','util','sox','to-csv','fs-extra','squel','jsforce','desk.js','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/environment','sendStatus','status','end','json','undefined','limit','count','offset','set','Content-Range','apply','reject','update','destroy','then','error','stack','name','index','map','VoiceQueuesLog','rawAttributes','fieldName','type','key','query','filters','intersection','attributes','model','fields','length','hasOwnProperty','nolimit','order','sort','pick','where','merge','VIRTUAL','filter','includeAll'];(function(_0x28a6ad,_0x351697){var _0xbb804=function(_0x165d37){while(--_0x165d37){_0x28a6ad['push'](_0x28a6ad['shift']());}};_0xbb804(++_0x351697);}(_0xbd82,0x136));var _0x2bd8=function(_0x4e1ecf,_0x2d4b41){_0x4e1ecf=_0x4e1ecf-0x0;var _0x3394e4=_0xbd82[_0x4e1ecf];return _0x3394e4;};'use strict';var emlformat=require('eml-format');var rimraf=require(_0x2bd8('0x0'));var zipdir=require('zip-dir');var jsonpatch=require(_0x2bd8('0x1'));var rp=require(_0x2bd8('0x2'));var moment=require(_0x2bd8('0x3'));var BPromise=require(_0x2bd8('0x4'));var Mustache=require(_0x2bd8('0x5'));var util=require(_0x2bd8('0x6'));var path=require('path');var sox=require(_0x2bd8('0x7'));var csv=require(_0x2bd8('0x8'));var ejs=require('ejs');var fs=require('fs');var fs_extra=require(_0x2bd8('0x9'));var _=require('lodash');var squel=require(_0x2bd8('0xa'));var crypto=require('crypto');var jsforce=require(_0x2bd8('0xb'));var deskjs=require(_0x2bd8('0xc'));var toCsv=require('to-csv');var querystring=require(_0x2bd8('0xd'));var Papa=require(_0x2bd8('0xe'));var Redis=require(_0x2bd8('0xf'));var authService=require(_0x2bd8('0x10'));var qs=require(_0x2bd8('0x11'));var as=require('../../components/parsers/advancedSearch');var hardwareService=require(_0x2bd8('0x12'));var logger=require(_0x2bd8('0x13'))(_0x2bd8('0x14'));var utils=require(_0x2bd8('0x15'));var config=require(_0x2bd8('0x16'));var licenseUtil=require('../../config/license/util');var db=require('../../mysqldb')['db'];function respondWithStatusCode(_0x576d90,_0x5c026d){_0x5c026d=_0x5c026d||0xcc;return function(_0x1c3a76){if(_0x1c3a76){return _0x576d90[_0x2bd8('0x17')](_0x5c026d);}return _0x576d90[_0x2bd8('0x18')](_0x5c026d)[_0x2bd8('0x19')]();};}function respondWithResult(_0x4c1392,_0x11de64){_0x11de64=_0x11de64||0xc8;return function(_0x3fc031){if(_0x3fc031){return _0x4c1392[_0x2bd8('0x18')](_0x11de64)[_0x2bd8('0x1a')](_0x3fc031);}};}function respondWithFilteredResult(_0x429c67,_0x3e7604){return function(_0x473574){if(_0x473574){var _0x565aa4=typeof _0x3e7604['offset']===_0x2bd8('0x1b')&&typeof _0x3e7604[_0x2bd8('0x1c')]===_0x2bd8('0x1b');var _0x3d76db=_0x473574[_0x2bd8('0x1d')];var _0x510897=_0x565aa4?0x0:_0x3e7604[_0x2bd8('0x1e')];var _0x19fed2=_0x565aa4?_0x473574[_0x2bd8('0x1d')]:_0x3e7604[_0x2bd8('0x1e')]+_0x3e7604[_0x2bd8('0x1c')];var _0x2734b0;if(_0x19fed2>=_0x3d76db){_0x19fed2=_0x3d76db;_0x2734b0=0xc8;}else{_0x2734b0=0xce;}_0x429c67[_0x2bd8('0x18')](_0x2734b0);return _0x429c67[_0x2bd8('0x1f')](_0x2bd8('0x20'),_0x510897+'-'+_0x19fed2+'/'+_0x3d76db)['json'](_0x473574);}return null;};}function patchUpdates(_0x49dd24){return function(_0x581eb0){try{jsonpatch[_0x2bd8('0x21')](_0x581eb0,_0x49dd24,!![]);}catch(_0x38d542){return BPromise[_0x2bd8('0x22')](_0x38d542);}return _0x581eb0['save']();};}function saveUpdates(_0x5e143a,_0x52bf23){return function(_0x1a5a5f){if(_0x1a5a5f){return _0x1a5a5f[_0x2bd8('0x23')](_0x5e143a)['then'](function(_0x377e0a){return _0x377e0a;});}return null;};}function removeEntity(_0x310be4,_0x305913){return function(_0x5e5a11){if(_0x5e5a11){return _0x5e5a11[_0x2bd8('0x24')]()[_0x2bd8('0x25')](function(){_0x310be4[_0x2bd8('0x18')](0xcc)[_0x2bd8('0x19')]();});}};}function handleEntityNotFound(_0xab0168,_0x273bdb){return function(_0x1c83ed){if(!_0x1c83ed){_0xab0168[_0x2bd8('0x17')](0x194);}return _0x1c83ed;};}function handleError(_0x281e3b,_0x488e27){_0x488e27=_0x488e27||0x1f4;return function(_0x59f4aa){logger[_0x2bd8('0x26')](_0x59f4aa[_0x2bd8('0x27')]);if(_0x59f4aa[_0x2bd8('0x28')]){delete _0x59f4aa['name'];}_0x281e3b[_0x2bd8('0x18')](_0x488e27)['send'](_0x59f4aa);};}exports[_0x2bd8('0x29')]=function(_0xad07de,_0x4074d9){var _0x218cd5={},_0x8c2c0e={},_0x409b57={'count':0x0,'rows':[]};var _0x200410=_[_0x2bd8('0x2a')](db[_0x2bd8('0x2b')][_0x2bd8('0x2c')],function(_0xa8fab0){return{'name':_0xa8fab0[_0x2bd8('0x2d')],'type':_0xa8fab0[_0x2bd8('0x2e')][_0x2bd8('0x2f')]};});_0x8c2c0e['model']=_[_0x2bd8('0x2a')](_0x200410,_0x2bd8('0x28'));_0x8c2c0e['query']=_['keys'](_0xad07de[_0x2bd8('0x30')]);_0x8c2c0e[_0x2bd8('0x31')]=_[_0x2bd8('0x32')](_0x8c2c0e['model'],_0x8c2c0e[_0x2bd8('0x30')]);_0x218cd5[_0x2bd8('0x33')]=_[_0x2bd8('0x32')](_0x8c2c0e[_0x2bd8('0x34')],qs[_0x2bd8('0x35')](_0xad07de[_0x2bd8('0x30')][_0x2bd8('0x35')]));_0x218cd5[_0x2bd8('0x33')]=_0x218cd5[_0x2bd8('0x33')][_0x2bd8('0x36')]?_0x218cd5[_0x2bd8('0x33')]:_0x8c2c0e['model'];if(!_0xad07de[_0x2bd8('0x30')][_0x2bd8('0x37')](_0x2bd8('0x38'))){_0x218cd5[_0x2bd8('0x1c')]=qs[_0x2bd8('0x1c')](_0xad07de['query'][_0x2bd8('0x1c')]);_0x218cd5[_0x2bd8('0x1e')]=qs[_0x2bd8('0x1e')](_0xad07de[_0x2bd8('0x30')][_0x2bd8('0x1e')]);}_0x218cd5[_0x2bd8('0x39')]=qs['sort'](_0xad07de[_0x2bd8('0x30')][_0x2bd8('0x3a')]);_0x218cd5['where']=qs['filters'](_[_0x2bd8('0x3b')](_0xad07de['query'],_0x8c2c0e[_0x2bd8('0x31')]),_0x200410);if(_0xad07de['query']['filter']){_0x218cd5[_0x2bd8('0x3c')]=_[_0x2bd8('0x3d')](_0x218cd5[_0x2bd8('0x3c')],{'$or':_[_0x2bd8('0x2a')](_0x200410,function(_0x937f0f){if(_0x937f0f[_0x2bd8('0x2e')]!==_0x2bd8('0x3e')){var _0xc7a7bc={};_0xc7a7bc[_0x937f0f['name']]={'$like':'%'+_0xad07de[_0x2bd8('0x30')][_0x2bd8('0x3f')]+'%'};return _0xc7a7bc;}})});}_0x218cd5=_[_0x2bd8('0x3d')]({},_0x218cd5,_0xad07de['options']);var _0x939931={'where':_0x218cd5['where']};return db[_0x2bd8('0x2b')][_0x2bd8('0x1d')](_0x939931)[_0x2bd8('0x25')](function(_0x207031){_0x409b57['count']=_0x207031;if(_0xad07de[_0x2bd8('0x30')][_0x2bd8('0x40')]){_0x218cd5[_0x2bd8('0x41')]=[{'all':!![]}];}return db[_0x2bd8('0x2b')][_0x2bd8('0x42')](_0x218cd5);})[_0x2bd8('0x25')](function(_0x36ec33){_0x409b57['rows']=_0x36ec33;return _0x409b57;})[_0x2bd8('0x25')](respondWithFilteredResult(_0x4074d9,_0x218cd5))['catch'](handleError(_0x4074d9,null));};exports[_0x2bd8('0x43')]=function(_0x88ce79,_0x42cf51){var _0x4c0c9d={'raw':!![],'where':{'id':_0x88ce79[_0x2bd8('0x44')]['id']}},_0x5bd72a={};_0x5bd72a['model']=_['keys'](db[_0x2bd8('0x2b')]['rawAttributes']);_0x5bd72a[_0x2bd8('0x30')]=_[_0x2bd8('0x45')](_0x88ce79[_0x2bd8('0x30')]);_0x5bd72a[_0x2bd8('0x31')]=_[_0x2bd8('0x32')](_0x5bd72a['model'],_0x5bd72a['query']);_0x4c0c9d[_0x2bd8('0x33')]=_[_0x2bd8('0x32')](_0x5bd72a[_0x2bd8('0x34')],qs[_0x2bd8('0x35')](_0x88ce79[_0x2bd8('0x30')][_0x2bd8('0x35')]));_0x4c0c9d[_0x2bd8('0x33')]=_0x4c0c9d[_0x2bd8('0x33')][_0x2bd8('0x36')]?_0x4c0c9d['attributes']:_0x5bd72a[_0x2bd8('0x34')];if(_0x88ce79[_0x2bd8('0x30')][_0x2bd8('0x40')]){_0x4c0c9d[_0x2bd8('0x41')]=[{'all':!![]}];}_0x4c0c9d=_[_0x2bd8('0x3d')]({},_0x4c0c9d,_0x88ce79[_0x2bd8('0x46')]);return db[_0x2bd8('0x2b')][_0x2bd8('0x47')](_0x4c0c9d)[_0x2bd8('0x25')](handleEntityNotFound(_0x42cf51,null))[_0x2bd8('0x25')](respondWithResult(_0x42cf51,null))[_0x2bd8('0x48')](handleError(_0x42cf51,null));};exports[_0x2bd8('0x49')]=function(_0x103bf3,_0x4415ef){return db['VoiceQueuesLog'][_0x2bd8('0x49')](_0x103bf3[_0x2bd8('0x4a')],{})['then'](respondWithResult(_0x4415ef,0xc9))[_0x2bd8('0x48')](handleError(_0x4415ef,null));};exports[_0x2bd8('0x23')]=function(_0x148761,_0x5940fa){if(_0x148761['body']['id']){delete _0x148761[_0x2bd8('0x4a')]['id'];}return db[_0x2bd8('0x2b')][_0x2bd8('0x47')]({'where':{'id':_0x148761[_0x2bd8('0x44')]['id']}})[_0x2bd8('0x25')](handleEntityNotFound(_0x5940fa,null))['then'](saveUpdates(_0x148761[_0x2bd8('0x4a')],null))[_0x2bd8('0x25')](respondWithResult(_0x5940fa,null))[_0x2bd8('0x48')](handleError(_0x5940fa,null));};exports[_0x2bd8('0x24')]=function(_0x27134f,_0x273d75){return db[_0x2bd8('0x2b')][_0x2bd8('0x47')]({'where':{'id':_0x27134f[_0x2bd8('0x44')]['id']}})[_0x2bd8('0x25')](handleEntityNotFound(_0x273d75,null))[_0x2bd8('0x25')](removeEntity(_0x273d75,null))[_0x2bd8('0x48')](handleError(_0x273d75,null));}; \ No newline at end of file +var _0x0348=['querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/logger','../../config/environment','../../config/license/util','../../mysqldb','sendStatus','end','status','json','offset','undefined','limit','count','set','Content-Range','apply','update','destroy','then','error','name','send','index','VoiceQueuesLog','rawAttributes','fieldName','key','map','query','keys','filters','intersection','model','attributes','fields','length','hasOwnProperty','nolimit','order','sort','where','filter','merge','type','VIRTUAL','options','includeAll','include','findAll','rows','show','params','find','catch','create','body','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','bluebird','mustache','util','ejs','fs-extra','lodash','squel','crypto','jsforce','desk.js'];(function(_0x24d15c,_0x49fe71){var _0x39c2f1=function(_0xb0d56c){while(--_0xb0d56c){_0x24d15c['push'](_0x24d15c['shift']());}};_0x39c2f1(++_0x49fe71);}(_0x0348,0x1b9));var _0x8034=function(_0x5b080b,_0xe34631){_0x5b080b=_0x5b080b-0x0;var _0x3d724c=_0x0348[_0x5b080b];return _0x3d724c;};'use strict';var emlformat=require(_0x8034('0x0'));var rimraf=require(_0x8034('0x1'));var zipdir=require(_0x8034('0x2'));var jsonpatch=require(_0x8034('0x3'));var rp=require(_0x8034('0x4'));var moment=require('moment');var BPromise=require(_0x8034('0x5'));var Mustache=require(_0x8034('0x6'));var util=require(_0x8034('0x7'));var path=require('path');var sox=require('sox');var csv=require('to-csv');var ejs=require(_0x8034('0x8'));var fs=require('fs');var fs_extra=require(_0x8034('0x9'));var _=require(_0x8034('0xa'));var squel=require(_0x8034('0xb'));var crypto=require(_0x8034('0xc'));var jsforce=require(_0x8034('0xd'));var deskjs=require(_0x8034('0xe'));var toCsv=require('to-csv');var querystring=require(_0x8034('0xf'));var Papa=require(_0x8034('0x10'));var Redis=require(_0x8034('0x11'));var authService=require(_0x8034('0x12'));var qs=require(_0x8034('0x13'));var as=require(_0x8034('0x14'));var hardwareService=require('../../config/license/hardware');var logger=require(_0x8034('0x15'))('api');var utils=require('../../config/utils');var config=require(_0x8034('0x16'));var licenseUtil=require(_0x8034('0x17'));var db=require(_0x8034('0x18'))['db'];function respondWithStatusCode(_0x372fdd,_0x28271f){_0x28271f=_0x28271f||0xcc;return function(_0x33014a){if(_0x33014a){return _0x372fdd[_0x8034('0x19')](_0x28271f);}return _0x372fdd['status'](_0x28271f)[_0x8034('0x1a')]();};}function respondWithResult(_0x5b9216,_0x4922f4){_0x4922f4=_0x4922f4||0xc8;return function(_0x3c4abd){if(_0x3c4abd){return _0x5b9216[_0x8034('0x1b')](_0x4922f4)[_0x8034('0x1c')](_0x3c4abd);}};}function respondWithFilteredResult(_0x24baca,_0x205bde){return function(_0x3fe113){if(_0x3fe113){var _0x24a76a=typeof _0x205bde[_0x8034('0x1d')]===_0x8034('0x1e')&&typeof _0x205bde[_0x8034('0x1f')]==='undefined';var _0x3e2f22=_0x3fe113[_0x8034('0x20')];var _0x4b8385=_0x24a76a?0x0:_0x205bde[_0x8034('0x1d')];var _0x655129=_0x24a76a?_0x3fe113[_0x8034('0x20')]:_0x205bde[_0x8034('0x1d')]+_0x205bde[_0x8034('0x1f')];var _0x5d717f;if(_0x655129>=_0x3e2f22){_0x655129=_0x3e2f22;_0x5d717f=0xc8;}else{_0x5d717f=0xce;}_0x24baca[_0x8034('0x1b')](_0x5d717f);return _0x24baca[_0x8034('0x21')](_0x8034('0x22'),_0x4b8385+'-'+_0x655129+'/'+_0x3e2f22)[_0x8034('0x1c')](_0x3fe113);}return null;};}function patchUpdates(_0x3ba763){return function(_0x32a966){try{jsonpatch[_0x8034('0x23')](_0x32a966,_0x3ba763,!![]);}catch(_0x24ac65){return BPromise['reject'](_0x24ac65);}return _0x32a966['save']();};}function saveUpdates(_0x5b52d9,_0xc7a6c){return function(_0x3946a1){if(_0x3946a1){return _0x3946a1[_0x8034('0x24')](_0x5b52d9)['then'](function(_0x42090c){return _0x42090c;});}return null;};}function removeEntity(_0x4a8f61,_0x26319d){return function(_0x22343c){if(_0x22343c){return _0x22343c[_0x8034('0x25')]()[_0x8034('0x26')](function(){_0x4a8f61[_0x8034('0x1b')](0xcc)[_0x8034('0x1a')]();});}};}function handleEntityNotFound(_0x1507ee,_0x4901ce){return function(_0x53a0b6){if(!_0x53a0b6){_0x1507ee['sendStatus'](0x194);}return _0x53a0b6;};}function handleError(_0x3c0eef,_0x57ca60){_0x57ca60=_0x57ca60||0x1f4;return function(_0xb7a005){logger[_0x8034('0x27')](_0xb7a005['stack']);if(_0xb7a005[_0x8034('0x28')]){delete _0xb7a005[_0x8034('0x28')];}_0x3c0eef[_0x8034('0x1b')](_0x57ca60)[_0x8034('0x29')](_0xb7a005);};}exports[_0x8034('0x2a')]=function(_0xd03699,_0x5e0be3){var _0x49c1c6={},_0x4f1a52={},_0x176fe7={'count':0x0,'rows':[]};var _0x4e6c27=_['map'](db[_0x8034('0x2b')][_0x8034('0x2c')],function(_0x16e9e9){return{'name':_0x16e9e9[_0x8034('0x2d')],'type':_0x16e9e9['type'][_0x8034('0x2e')]};});_0x4f1a52['model']=_[_0x8034('0x2f')](_0x4e6c27,'name');_0x4f1a52[_0x8034('0x30')]=_[_0x8034('0x31')](_0xd03699[_0x8034('0x30')]);_0x4f1a52[_0x8034('0x32')]=_[_0x8034('0x33')](_0x4f1a52[_0x8034('0x34')],_0x4f1a52[_0x8034('0x30')]);_0x49c1c6[_0x8034('0x35')]=_[_0x8034('0x33')](_0x4f1a52[_0x8034('0x34')],qs[_0x8034('0x36')](_0xd03699[_0x8034('0x30')][_0x8034('0x36')]));_0x49c1c6['attributes']=_0x49c1c6[_0x8034('0x35')][_0x8034('0x37')]?_0x49c1c6['attributes']:_0x4f1a52[_0x8034('0x34')];if(!_0xd03699[_0x8034('0x30')][_0x8034('0x38')](_0x8034('0x39'))){_0x49c1c6[_0x8034('0x1f')]=qs[_0x8034('0x1f')](_0xd03699[_0x8034('0x30')][_0x8034('0x1f')]);_0x49c1c6[_0x8034('0x1d')]=qs[_0x8034('0x1d')](_0xd03699[_0x8034('0x30')][_0x8034('0x1d')]);}_0x49c1c6[_0x8034('0x3a')]=qs[_0x8034('0x3b')](_0xd03699[_0x8034('0x30')][_0x8034('0x3b')]);_0x49c1c6[_0x8034('0x3c')]=qs[_0x8034('0x32')](_['pick'](_0xd03699['query'],_0x4f1a52[_0x8034('0x32')]),_0x4e6c27);if(_0xd03699[_0x8034('0x30')][_0x8034('0x3d')]){_0x49c1c6['where']=_[_0x8034('0x3e')](_0x49c1c6[_0x8034('0x3c')],{'$or':_['map'](_0x4e6c27,function(_0xe8bfc0){if(_0xe8bfc0[_0x8034('0x3f')]!==_0x8034('0x40')){var _0x123a33={};_0x123a33[_0xe8bfc0[_0x8034('0x28')]]={'$like':'%'+_0xd03699[_0x8034('0x30')][_0x8034('0x3d')]+'%'};return _0x123a33;}})});}_0x49c1c6=_[_0x8034('0x3e')]({},_0x49c1c6,_0xd03699[_0x8034('0x41')]);var _0x271423={'where':_0x49c1c6[_0x8034('0x3c')]};return db[_0x8034('0x2b')][_0x8034('0x20')](_0x271423)['then'](function(_0x5419d6){_0x176fe7['count']=_0x5419d6;if(_0xd03699[_0x8034('0x30')][_0x8034('0x42')]){_0x49c1c6[_0x8034('0x43')]=[{'all':!![]}];}return db[_0x8034('0x2b')][_0x8034('0x44')](_0x49c1c6);})[_0x8034('0x26')](function(_0x5e8a02){_0x176fe7[_0x8034('0x45')]=_0x5e8a02;return _0x176fe7;})[_0x8034('0x26')](respondWithFilteredResult(_0x5e0be3,_0x49c1c6))['catch'](handleError(_0x5e0be3,null));};exports[_0x8034('0x46')]=function(_0x55aea0,_0x436b18){var _0x59016f={'raw':!![],'where':{'id':_0x55aea0[_0x8034('0x47')]['id']}},_0x1a166f={};_0x1a166f[_0x8034('0x34')]=_['keys'](db['VoiceQueuesLog'][_0x8034('0x2c')]);_0x1a166f[_0x8034('0x30')]=_['keys'](_0x55aea0[_0x8034('0x30')]);_0x1a166f[_0x8034('0x32')]=_[_0x8034('0x33')](_0x1a166f[_0x8034('0x34')],_0x1a166f['query']);_0x59016f[_0x8034('0x35')]=_[_0x8034('0x33')](_0x1a166f[_0x8034('0x34')],qs[_0x8034('0x36')](_0x55aea0[_0x8034('0x30')]['fields']));_0x59016f['attributes']=_0x59016f['attributes'][_0x8034('0x37')]?_0x59016f[_0x8034('0x35')]:_0x1a166f['model'];if(_0x55aea0['query'][_0x8034('0x42')]){_0x59016f[_0x8034('0x43')]=[{'all':!![]}];}_0x59016f=_[_0x8034('0x3e')]({},_0x59016f,_0x55aea0[_0x8034('0x41')]);return db[_0x8034('0x2b')][_0x8034('0x48')](_0x59016f)[_0x8034('0x26')](handleEntityNotFound(_0x436b18,null))[_0x8034('0x26')](respondWithResult(_0x436b18,null))[_0x8034('0x49')](handleError(_0x436b18,null));};exports['create']=function(_0x17f10c,_0xfe0681){return db['VoiceQueuesLog'][_0x8034('0x4a')](_0x17f10c['body'],{})['then'](respondWithResult(_0xfe0681,0xc9))[_0x8034('0x49')](handleError(_0xfe0681,null));};exports['update']=function(_0x4cb903,_0xf1e6e4){if(_0x4cb903[_0x8034('0x4b')]['id']){delete _0x4cb903[_0x8034('0x4b')]['id'];}return db[_0x8034('0x2b')][_0x8034('0x48')]({'where':{'id':_0x4cb903[_0x8034('0x47')]['id']}})[_0x8034('0x26')](handleEntityNotFound(_0xf1e6e4,null))[_0x8034('0x26')](saveUpdates(_0x4cb903[_0x8034('0x4b')],null))['then'](respondWithResult(_0xf1e6e4,null))[_0x8034('0x49')](handleError(_0xf1e6e4,null));};exports[_0x8034('0x25')]=function(_0x3220a0,_0x57570c){return db['VoiceQueuesLog'][_0x8034('0x48')]({'where':{'id':_0x3220a0[_0x8034('0x47')]['id']}})[_0x8034('0x26')](handleEntityNotFound(_0x57570c,null))['then'](removeEntity(_0x57570c,null))[_0x8034('0x49')](handleError(_0x57570c,null));}; \ No newline at end of file diff --git a/server/api/voiceQueuesLog/voiceQueuesLog.model.js b/server/api/voiceQueuesLog/voiceQueuesLog.model.js index 681628a..5a3ef31 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 _0x271e=['api','moment','bluebird','request-promise','rimraf','../../config/environment','./voiceQueuesLog.attributes','exports','event_dtm','event','dtm','lodash','util','../../config/logger'];(function(_0x50ce56,_0x14fe96){var _0x26e980=function(_0x4653d2){while(--_0x4653d2){_0x50ce56['push'](_0x50ce56['shift']());}};_0x26e980(++_0x14fe96);}(_0x271e,0x123));var _0xe271=function(_0x2f9c21,_0x55e75b){_0x2f9c21=_0x2f9c21-0x0;var _0x3895fa=_0x271e[_0x2f9c21];return _0x3895fa;};'use strict';var _=require(_0xe271('0x0'));var util=require(_0xe271('0x1'));var logger=require(_0xe271('0x2'))(_0xe271('0x3'));var moment=require(_0xe271('0x4'));var BPromise=require(_0xe271('0x5'));var rp=require(_0xe271('0x6'));var fs=require('fs');var path=require('path');var rimraf=require(_0xe271('0x7'));var config=require(_0xe271('0x8'));var attributes=require(_0xe271('0x9'));module[_0xe271('0xa')]=function(_0xc8765d,_0x27742d){return _0xc8765d['define']('VoiceQueuesLog',attributes,{'tableName':'voice_queues_log','paranoid':![],'indexes':[{'name':_0xe271('0xb'),'fields':[_0xe271('0xc'),_0xe271('0xd')]}],'timestamps':![]});}; \ No newline at end of file +var _0xa179=['util','api','moment','request-promise','rimraf','../../config/environment','./voiceQueuesLog.attributes','exports','define','VoiceQueuesLog','voice_queues_log','event_dtm','event','dtm','lodash'];(function(_0x494d1f,_0x3f72ff){var _0x457b6e=function(_0x38cb16){while(--_0x38cb16){_0x494d1f['push'](_0x494d1f['shift']());}};_0x457b6e(++_0x3f72ff);}(_0xa179,0x1c1));var _0x9a17=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0xa179[_0x3dd15e];return _0x231fd0;};'use strict';var _=require(_0x9a17('0x0'));var util=require(_0x9a17('0x1'));var logger=require('../../config/logger')(_0x9a17('0x2'));var moment=require(_0x9a17('0x3'));var BPromise=require('bluebird');var rp=require(_0x9a17('0x4'));var fs=require('fs');var path=require('path');var rimraf=require(_0x9a17('0x5'));var config=require(_0x9a17('0x6'));var attributes=require(_0x9a17('0x7'));module[_0x9a17('0x8')]=function(_0x1f565b,_0x53cee2){return _0x1f565b[_0x9a17('0x9')](_0x9a17('0xa'),attributes,{'tableName':_0x9a17('0xb'),'paranoid':![],'indexes':[{'name':_0x9a17('0xc'),'fields':[_0x9a17('0xd'),_0x9a17('0xe')]}],'timestamps':![]});}; \ No newline at end of file diff --git a/server/api/voiceQueuesLog/voiceQueuesLog.rpc.js b/server/api/voiceQueuesLog/voiceQueuesLog.rpc.js index e14297f..90af62d 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 _0x8978=['../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','client','http','request','VoiceQueuesLog,\x20%s,\x20%s','request\x20sent','debug','VoiceQueuesLog,\x20%s,\x20%s,\x20%s','stringify','error','code','message','info','result','catch','moment','randomstring'];(function(_0x544a27,_0x5914ab){var _0x1eed0b=function(_0x422a7f){while(--_0x422a7f){_0x544a27['push'](_0x544a27['shift']());}};_0x1eed0b(++_0x5914ab);}(_0x8978,0x1cc));var _0x8897=function(_0x56482c,_0x16118d){_0x56482c=_0x56482c-0x0;var _0x5aae7a=_0x8978[_0x56482c];return _0x5aae7a;};'use strict';var _=require('lodash');var util=require('util');var moment=require(_0x8897('0x0'));var BPromise=require('bluebird');var rs=require(_0x8897('0x1'));var fs=require('fs');var Redis=require('ioredis');var db=require(_0x8897('0x2'))['db'];var utils=require(_0x8897('0x3'));var logger=require(_0x8897('0x4'))(_0x8897('0x5'));var config=require(_0x8897('0x6'));var jayson=require('jayson/promise');var client=jayson[_0x8897('0x7')][_0x8897('0x8')]({'port':0x232a});function respondWithRpcPromise(_0x4db551,_0x2a5404,_0x35b124){return new BPromise(function(_0x1f1614,_0x489a48){return client[_0x8897('0x9')](_0x4db551,_0x35b124)['then'](function(_0x2416ad){logger['info'](_0x8897('0xa'),_0x2a5404,_0x8897('0xb'));logger[_0x8897('0xc')](_0x8897('0xd'),_0x2a5404,'request\x20sent',JSON[_0x8897('0xe')](_0x2416ad));if(_0x2416ad[_0x8897('0xf')]){if(_0x2416ad[_0x8897('0xf')][_0x8897('0x10')]===0x1f4){logger[_0x8897('0xf')](_0x8897('0xa'),_0x2a5404,_0x2416ad[_0x8897('0xf')]['message']);return _0x489a48(_0x2416ad[_0x8897('0xf')]['message']);}logger['error']('VoiceQueuesLog,\x20%s,\x20%s',_0x2a5404,_0x2416ad['error'][_0x8897('0x11')]);return _0x1f1614(_0x2416ad[_0x8897('0xf')][_0x8897('0x11')]);}else{logger[_0x8897('0x12')](_0x8897('0xa'),_0x2a5404,_0x8897('0xb'));_0x1f1614(_0x2416ad[_0x8897('0x13')][_0x8897('0x11')]);}})[_0x8897('0x14')](function(_0x37baaf){logger['error']('VoiceQueuesLog,\x20%s,\x20%s',_0x2a5404,_0x37baaf);_0x489a48(_0x37baaf);});});} \ No newline at end of file +var _0x8b49=['then','info','debug','request\x20sent','stringify','error','code','VoiceQueuesLog,\x20%s,\x20%s','message','catch','lodash','util','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','client','request'];(function(_0x2ca381,_0xcc3998){var _0x163128=function(_0x3b34d3){while(--_0x3b34d3){_0x2ca381['push'](_0x2ca381['shift']());}};_0x163128(++_0xcc3998);}(_0x8b49,0xb2));var _0x98b4=function(_0x4a618b,_0x11d42e){_0x4a618b=_0x4a618b-0x0;var _0x1a006d=_0x8b49[_0x4a618b];return _0x1a006d;};'use strict';var _=require(_0x98b4('0x0'));var util=require(_0x98b4('0x1'));var moment=require(_0x98b4('0x2'));var BPromise=require(_0x98b4('0x3'));var rs=require(_0x98b4('0x4'));var fs=require('fs');var Redis=require(_0x98b4('0x5'));var db=require(_0x98b4('0x6'))['db'];var utils=require(_0x98b4('0x7'));var logger=require(_0x98b4('0x8'))(_0x98b4('0x9'));var config=require(_0x98b4('0xa'));var jayson=require(_0x98b4('0xb'));var client=jayson[_0x98b4('0xc')]['http']({'port':0x232a});function respondWithRpcPromise(_0x39d3ac,_0x109207,_0x10a466){return new BPromise(function(_0x4ce75a,_0x1a99ac){return client[_0x98b4('0xd')](_0x39d3ac,_0x10a466)[_0x98b4('0xe')](function(_0x4c5771){logger[_0x98b4('0xf')]('VoiceQueuesLog,\x20%s,\x20%s',_0x109207,'request\x20sent');logger[_0x98b4('0x10')]('VoiceQueuesLog,\x20%s,\x20%s,\x20%s',_0x109207,_0x98b4('0x11'),JSON[_0x98b4('0x12')](_0x4c5771));if(_0x4c5771[_0x98b4('0x13')]){if(_0x4c5771['error'][_0x98b4('0x14')]===0x1f4){logger['error'](_0x98b4('0x15'),_0x109207,_0x4c5771[_0x98b4('0x13')]['message']);return _0x1a99ac(_0x4c5771[_0x98b4('0x13')][_0x98b4('0x16')]);}logger['error']('VoiceQueuesLog,\x20%s,\x20%s',_0x109207,_0x4c5771['error'][_0x98b4('0x16')]);return _0x4ce75a(_0x4c5771[_0x98b4('0x13')][_0x98b4('0x16')]);}else{logger[_0x98b4('0xf')](_0x98b4('0x15'),_0x109207,'request\x20sent');_0x4ce75a(_0x4c5771['result']['message']);}})[_0x98b4('0x17')](function(_0x1b82d2){logger[_0x98b4('0x13')](_0x98b4('0x15'),_0x109207,_0x1b82d2);_0x1a99ac(_0x1b82d2);});});} \ No newline at end of file diff --git a/server/api/voiceRecording/index.js b/server/api/voiceRecording/index.js index 7a8bedf..45a52fe 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 _0xa5e5=['../../components/auth/service','../../components/interaction/service','../../config/environment','./voiceRecording.controller','get','isAuthenticated','index','/describe','/:id','show','download','/:id/transcribe','downloadTranscribe','post','create','put','update','exports','path','connect-timeout','express','Router','fs-extra'];(function(_0x460e9c,_0xd3f252){var _0x390a5c=function(_0x19503b){while(--_0x19503b){_0x460e9c['push'](_0x460e9c['shift']());}};_0x390a5c(++_0xd3f252);}(_0xa5e5,0xb3));var _0x5a5e=function(_0x445101,_0x2414bf){_0x445101=_0x445101-0x0;var _0x3c3d04=_0xa5e5[_0x445101];return _0x3c3d04;};'use strict';var multer=require('multer');var util=require('util');var path=require(_0x5a5e('0x0'));var timeout=require(_0x5a5e('0x1'));var express=require(_0x5a5e('0x2'));var router=express[_0x5a5e('0x3')]();var fs_extra=require(_0x5a5e('0x4'));var auth=require(_0x5a5e('0x5'));var interaction=require(_0x5a5e('0x6'));var config=require(_0x5a5e('0x7'));var controller=require(_0x5a5e('0x8'));router[_0x5a5e('0x9')]('/',auth[_0x5a5e('0xa')](),controller[_0x5a5e('0xb')]);router[_0x5a5e('0x9')](_0x5a5e('0xc'),auth['isAuthenticated'](),controller['describe']);router[_0x5a5e('0x9')](_0x5a5e('0xd'),auth[_0x5a5e('0xa')](),controller[_0x5a5e('0xe')]);router['get']('/:id/download',auth[_0x5a5e('0xa')](),controller[_0x5a5e('0xf')]);router[_0x5a5e('0x9')]('/:id/downloads',controller['downloads']);router['get'](_0x5a5e('0x10'),auth[_0x5a5e('0xa')](),controller[_0x5a5e('0x11')]);router[_0x5a5e('0x12')]('/',auth[_0x5a5e('0xa')](),controller[_0x5a5e('0x13')]);router[_0x5a5e('0x12')](_0x5a5e('0x10'),auth[_0x5a5e('0xa')](),controller['runTranscribe']);router[_0x5a5e('0x14')](_0x5a5e('0xd'),auth[_0x5a5e('0xa')](),controller[_0x5a5e('0x15')]);router['delete'](_0x5a5e('0xd'),auth[_0x5a5e('0xa')](),controller['destroy']);module[_0x5a5e('0x16')]=router; \ No newline at end of file +var _0x1b62=['exports','multer','util','express','Router','fs-extra','../../components/interaction/service','./voiceRecording.controller','get','isAuthenticated','index','/describe','/:id','download','downloads','/:id/transcribe','create','post','runTranscribe','put','delete'];(function(_0x3952f8,_0x304d78){var _0x49ff02=function(_0x860de){while(--_0x860de){_0x3952f8['push'](_0x3952f8['shift']());}};_0x49ff02(++_0x304d78);}(_0x1b62,0x94));var _0x21b6=function(_0x49e584,_0x2886f8){_0x49e584=_0x49e584-0x0;var _0x58b1be=_0x1b62[_0x49e584];return _0x58b1be;};'use strict';var multer=require(_0x21b6('0x0'));var util=require(_0x21b6('0x1'));var path=require('path');var timeout=require('connect-timeout');var express=require(_0x21b6('0x2'));var router=express[_0x21b6('0x3')]();var fs_extra=require(_0x21b6('0x4'));var auth=require('../../components/auth/service');var interaction=require(_0x21b6('0x5'));var config=require('../../config/environment');var controller=require(_0x21b6('0x6'));router[_0x21b6('0x7')]('/',auth[_0x21b6('0x8')](),controller[_0x21b6('0x9')]);router['get'](_0x21b6('0xa'),auth[_0x21b6('0x8')](),controller['describe']);router['get'](_0x21b6('0xb'),auth['isAuthenticated'](),controller['show']);router[_0x21b6('0x7')]('/:id/download',auth[_0x21b6('0x8')](),controller[_0x21b6('0xc')]);router[_0x21b6('0x7')]('/:id/downloads',controller[_0x21b6('0xd')]);router[_0x21b6('0x7')](_0x21b6('0xe'),auth[_0x21b6('0x8')](),controller['downloadTranscribe']);router['post']('/',auth[_0x21b6('0x8')](),controller[_0x21b6('0xf')]);router[_0x21b6('0x10')](_0x21b6('0xe'),auth[_0x21b6('0x8')](),controller[_0x21b6('0x11')]);router[_0x21b6('0x12')]('/:id',auth[_0x21b6('0x8')](),controller['update']);router[_0x21b6('0x13')](_0x21b6('0xb'),auth['isAuthenticated'](),controller['destroy']);module[_0x21b6('0x14')]=router; \ No newline at end of file diff --git a/server/api/voiceRecording/voiceRecording.attributes.js b/server/api/voiceRecording/voiceRecording.attributes.js index 4e0d1be..1e478b9 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(_0x40220a,_0x22feb1){var _0x3903cc=function(_0x33a296){while(--_0x33a296){_0x40220a['push'](_0x40220a['shift']());}};_0x3903cc(++_0x22feb1);}(_0xa9e0,0x123));var _0x0a9e=function(_0x311c35,_0x534915){_0x311c35=_0x311c35-0x0;var _0x5cc50c=_0xa9e0[_0x311c35];return _0x5cc50c;};'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(_0x1ccdf7,_0x215d5a){var _0x52a0ae=function(_0x40324a){while(--_0x40324a){_0x1ccdf7['push'](_0x1ccdf7['shift']());}};_0x52a0ae(++_0x215d5a);}(_0xa9e0,0x123));var _0x0a9e=function(_0x3b5250,_0x7a0b2c){_0x3b5250=_0x3b5250-0x0;var _0xc844a1=_0xa9e0[_0x3b5250];return _0xc844a1;};'use strict';var Sequelize=require(_0x0a9e('0x0'));var moment=require(_0x0a9e('0x1'));var 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 7a99d49..efc4c3e 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 _0x32ef=['key','model','differenceBy','format','query','keys','filters','intersection','attributes','fields','length','hasOwnProperty','nolimit','order','sort','where','filter','VIRTUAL','merge','includeAll','include','findAll','rows','show','find','catch','create','body','update','params','../../components/encryptor','uniqueid','value','%s.cypher','existsSync','decryptFile','secrets','Sequelize','filename','download','extname','unlink','message','VoiceRecording\x20not\x20found','Not\x20found','downloads','sequelize','col','token','$and','push','recording','isNil','Entity\x20not\x20found','info','File:\x20\x22','\x22\x20trovato\x20eseguo\x20la\x20cancellazione','listBuckets','createBucket','upload','TranscribeService','[RUNTRANSCRIPT][%d]\x20Starting\x20voice\x20recording\x20upload\x20in\x20bucket\x20%s','basename','readFileSync','[RUNTRANSCRIPT][%d]\x20Voice\x20recording\x20uploaded\x20in\x20bucket\x20%s\x20(%s)','Location','bucket','Bucket','location','[RUNTRANSCRIPT][%d]\x20Sending\x20transcribe\x20request','[RUNTRANSCRIPT][%d]\x20Transcription\x20job\x20%s\x20created','TranscriptionJob','TranscriptionJobName','transcribeStatus','TranscriptionJobStatus','ValidationError','Setting','transcribe','transcribeAccountId','language','Transcribe\x20not\x20configured','runSentiment','sentimentAccountId','sentimentRegion','Sentiment\x20Analysis\x20not\x20configured','findOne','data2','Cloud\x20Provider\x20not\x20configured','data1','Name','transcribeRegion','[RUNTRANSCRIPT][%d]\x20Bucket\x20%s\x20available','NEW','[RUNTRANSCRIPT][%d]\x20Transcript\x20action\x20already\x20requested','IN_PROGRESS','tempSentiment','updateAttributes','fileText','root','/server/files/transcribes/transcribe_','Transcript\x20not\x20available','eml-format','rimraf','zip-dir','fast-json-patch','bluebird','mustache','util','path','sox','to-csv','fs-extra','lodash','squel','crypto','desk.js','querystring','papaparse','aws-sdk','uuid/v4','../../components/auth/service','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','status','offset','limit','undefined','count','set','json','reject','save','then','destroy','end','sendStatus','error','stack','name','send','index','map','VoiceRecording','rawAttributes','fieldName','type'];(function(_0x254b51,_0x4421bb){var _0x5be770=function(_0x2eb3cc){while(--_0x2eb3cc){_0x254b51['push'](_0x254b51['shift']());}};_0x5be770(++_0x4421bb);}(_0x32ef,0x65));var _0xf32e=function(_0x453e18,_0x240d10){_0x453e18=_0x453e18-0x0;var _0x200154=_0x32ef[_0x453e18];return _0x200154;};'use strict';var emlformat=require(_0xf32e('0x0'));var rimraf=require(_0xf32e('0x1'));var zipdir=require(_0xf32e('0x2'));var jsonpatch=require(_0xf32e('0x3'));var rp=require('request-promise');var moment=require('moment');var BPromise=require(_0xf32e('0x4'));var Mustache=require(_0xf32e('0x5'));var util=require(_0xf32e('0x6'));var path=require(_0xf32e('0x7'));var sox=require(_0xf32e('0x8'));var csv=require(_0xf32e('0x9'));var ejs=require('ejs');var fs=require('fs');var fs_extra=require(_0xf32e('0xa'));var _=require(_0xf32e('0xb'));var squel=require(_0xf32e('0xc'));var crypto=require(_0xf32e('0xd'));var jsforce=require('jsforce');var deskjs=require(_0xf32e('0xe'));var toCsv=require(_0xf32e('0x9'));var querystring=require(_0xf32e('0xf'));var Papa=require(_0xf32e('0x10'));var AWS=require(_0xf32e('0x11'));var uuidv4=require(_0xf32e('0x12'));var Redis=require('ioredis');var authService=require(_0xf32e('0x13'));var qs=require('../../components/parsers/qs');var as=require(_0xf32e('0x14'));var hardwareService=require(_0xf32e('0x15'));var logger=require(_0xf32e('0x16'))(_0xf32e('0x17'));var utils=require(_0xf32e('0x18'));var config=require(_0xf32e('0x19'));var licenseUtil=require(_0xf32e('0x1a'));var db=require(_0xf32e('0x1b'))['db'];function respondWithStatusCode(_0x51ef49,_0x4f8469){_0x4f8469=_0x4f8469||0xcc;return function(_0x386c18){if(_0x386c18){return _0x51ef49['sendStatus'](_0x4f8469);}return _0x51ef49[_0xf32e('0x1c')](_0x4f8469)['end']();};}function respondWithResult(_0x13a11e,_0x4e7d67){_0x4e7d67=_0x4e7d67||0xc8;return function(_0x28a0e0){if(_0x28a0e0){return _0x13a11e[_0xf32e('0x1c')](_0x4e7d67)['json'](_0x28a0e0);}};}function respondWithFilteredResult(_0x1ce431,_0x1dbfde){return function(_0x8df603){if(_0x8df603){var _0x4804dc=typeof _0x1dbfde[_0xf32e('0x1d')]==='undefined'&&typeof _0x1dbfde[_0xf32e('0x1e')]===_0xf32e('0x1f');var _0x3b77f7=_0x8df603[_0xf32e('0x20')];var _0x5d1267=_0x4804dc?0x0:_0x1dbfde['offset'];var _0x4f7498=_0x4804dc?_0x8df603[_0xf32e('0x20')]:_0x1dbfde[_0xf32e('0x1d')]+_0x1dbfde[_0xf32e('0x1e')];var _0x252804;if(_0x4f7498>=_0x3b77f7){_0x4f7498=_0x3b77f7;_0x252804=0xc8;}else{_0x252804=0xce;}_0x1ce431[_0xf32e('0x1c')](_0x252804);return _0x1ce431[_0xf32e('0x21')]('Content-Range',_0x5d1267+'-'+_0x4f7498+'/'+_0x3b77f7)[_0xf32e('0x22')](_0x8df603);}return null;};}function patchUpdates(_0x31e668){return function(_0x4974b4){try{jsonpatch['apply'](_0x4974b4,_0x31e668,!![]);}catch(_0x3cee84){return BPromise[_0xf32e('0x23')](_0x3cee84);}return _0x4974b4[_0xf32e('0x24')]();};}function saveUpdates(_0x4aec9d,_0x2f2078){return function(_0x312970){if(_0x312970){return _0x312970['update'](_0x4aec9d)[_0xf32e('0x25')](function(_0x2b8a5d){return _0x2b8a5d;});}return null;};}function removeEntity(_0x286e43,_0x1b2700){return function(_0x57794b){if(_0x57794b){return _0x57794b[_0xf32e('0x26')]()[_0xf32e('0x25')](function(){_0x286e43[_0xf32e('0x1c')](0xcc)[_0xf32e('0x27')]();});}};}function handleEntityNotFound(_0x4c9e77,_0x1334d6){return function(_0x5ec4f8){if(!_0x5ec4f8){_0x4c9e77[_0xf32e('0x28')](0x194);}return _0x5ec4f8;};}function handleError(_0x1a054c,_0x3e92de){_0x3e92de=_0x3e92de||0x1f4;return function(_0x2ba289){logger[_0xf32e('0x29')](_0x2ba289[_0xf32e('0x2a')]);if(_0x2ba289[_0xf32e('0x2b')]){delete _0x2ba289[_0xf32e('0x2b')];}_0x1a054c['status'](_0x3e92de)[_0xf32e('0x2c')](_0x2ba289);};}exports[_0xf32e('0x2d')]=function(_0x5c5efb,_0xe53b76){var _0x2fa17b={},_0x5a05e6={},_0x45686c={'count':0x0,'rows':[]};var _0x4590bd=_[_0xf32e('0x2e')](db[_0xf32e('0x2f')][_0xf32e('0x30')],function(_0x3ba6a8){return{'name':_0x3ba6a8[_0xf32e('0x31')],'type':_0x3ba6a8[_0xf32e('0x32')][_0xf32e('0x33')]};});_0x5a05e6[_0xf32e('0x34')]=_[_0xf32e('0x35')](_['map'](_0x4590bd,_0xf32e('0x2b')),[_0xf32e('0x36')]);_0x5a05e6[_0xf32e('0x37')]=_[_0xf32e('0x38')](_0x5c5efb['query']);_0x5a05e6[_0xf32e('0x39')]=_[_0xf32e('0x3a')](_0x5a05e6['model'],_0x5a05e6['query']);_0x2fa17b[_0xf32e('0x3b')]=_['intersection'](_0x5a05e6[_0xf32e('0x34')],qs[_0xf32e('0x3c')](_0x5c5efb[_0xf32e('0x37')]['fields']));_0x2fa17b[_0xf32e('0x3b')]=_0x2fa17b[_0xf32e('0x3b')][_0xf32e('0x3d')]?_0x2fa17b['attributes']:_0x5a05e6['model'];if(!_0x5c5efb[_0xf32e('0x37')][_0xf32e('0x3e')](_0xf32e('0x3f'))){_0x2fa17b[_0xf32e('0x1e')]=qs[_0xf32e('0x1e')](_0x5c5efb[_0xf32e('0x37')]['limit']);_0x2fa17b[_0xf32e('0x1d')]=qs['offset'](_0x5c5efb[_0xf32e('0x37')][_0xf32e('0x1d')]);}_0x2fa17b[_0xf32e('0x40')]=qs[_0xf32e('0x41')](_0x5c5efb[_0xf32e('0x37')][_0xf32e('0x41')]);_0x2fa17b[_0xf32e('0x42')]=qs['filters'](_['pick'](_0x5c5efb[_0xf32e('0x37')],_0x5a05e6[_0xf32e('0x39')]),_0x4590bd);if(_0x5c5efb[_0xf32e('0x37')][_0xf32e('0x43')]){_0x2fa17b[_0xf32e('0x42')]=_['merge'](_0x2fa17b['where'],{'$or':_[_0xf32e('0x2e')](_0x4590bd,function(_0x3d196e){if(_0x3d196e['type']!==_0xf32e('0x44')){var _0xcd5ca5={};_0xcd5ca5[_0x3d196e[_0xf32e('0x2b')]]={'$like':'%'+_0x5c5efb['query'][_0xf32e('0x43')]+'%'};return _0xcd5ca5;}})});}_0x2fa17b=_[_0xf32e('0x45')]({},_0x2fa17b,_0x5c5efb['options']);var _0x259c35={'where':_0x2fa17b['where']};return db[_0xf32e('0x2f')][_0xf32e('0x20')](_0x259c35)[_0xf32e('0x25')](function(_0x5b9ae8){_0x45686c[_0xf32e('0x20')]=_0x5b9ae8;if(_0x5c5efb['query'][_0xf32e('0x46')]){_0x2fa17b[_0xf32e('0x47')]=[{'all':!![]}];}return db[_0xf32e('0x2f')][_0xf32e('0x48')](_0x2fa17b);})[_0xf32e('0x25')](function(_0x4f0ef4){_0x45686c[_0xf32e('0x49')]=_0x4f0ef4;return _0x45686c;})[_0xf32e('0x25')](respondWithFilteredResult(_0xe53b76,_0x2fa17b))['catch'](handleError(_0xe53b76,null));};exports[_0xf32e('0x4a')]=function(_0x14c710,_0xd6c4e1){var _0x182a32={'raw':![],'where':{'id':_0x14c710['params']['id']}},_0x461aae={};_0x461aae[_0xf32e('0x34')]=_[_0xf32e('0x38')](db[_0xf32e('0x2f')]['rawAttributes']);_0x461aae[_0xf32e('0x37')]=_['keys'](_0x14c710[_0xf32e('0x37')]);_0x461aae['filters']=_[_0xf32e('0x3a')](_0x461aae['model'],_0x461aae['query']);_0x182a32[_0xf32e('0x3b')]=_[_0xf32e('0x3a')](_0x461aae[_0xf32e('0x34')],qs['fields'](_0x14c710[_0xf32e('0x37')]['fields']));_0x182a32[_0xf32e('0x3b')]=_0x182a32[_0xf32e('0x3b')][_0xf32e('0x3d')]?_0x182a32[_0xf32e('0x3b')]:_0x461aae[_0xf32e('0x34')];if(_0x14c710[_0xf32e('0x37')]['includeAll']){_0x182a32['include']=[{'all':!![]}];}_0x182a32=_['merge']({},_0x182a32,_0x14c710['options']);return db[_0xf32e('0x2f')][_0xf32e('0x4b')](_0x182a32)[_0xf32e('0x25')](handleEntityNotFound(_0xd6c4e1,null))['then'](respondWithResult(_0xd6c4e1,null))[_0xf32e('0x4c')](handleError(_0xd6c4e1,null));};exports[_0xf32e('0x4d')]=function(_0x322dff,_0x280ff4){return db[_0xf32e('0x2f')][_0xf32e('0x4d')](_0x322dff[_0xf32e('0x4e')],{})[_0xf32e('0x25')](respondWithResult(_0x280ff4,0xc9))[_0xf32e('0x4c')](handleError(_0x280ff4,null));};exports[_0xf32e('0x4f')]=function(_0x4a3527,_0x3fbab9){if(_0x4a3527[_0xf32e('0x4e')]['id']){delete _0x4a3527[_0xf32e('0x4e')]['id'];}return db[_0xf32e('0x2f')][_0xf32e('0x4b')]({'where':{'id':_0x4a3527[_0xf32e('0x50')]['id']}})[_0xf32e('0x25')](handleEntityNotFound(_0x3fbab9,null))[_0xf32e('0x25')](saveUpdates(_0x4a3527[_0xf32e('0x4e')],null))[_0xf32e('0x25')](respondWithResult(_0x3fbab9,null))['catch'](handleError(_0x3fbab9,null));};exports['describe']=function(_0x1e8bad,_0x2c35d3){return db['VoiceRecording']['describe']()[_0xf32e('0x25')](respondWithResult(_0x2c35d3,null))[_0xf32e('0x4c')](handleError(_0x2c35d3,null));};exports['download']=function(_0x517838,_0x483ba3,_0xbba197){var _0x63e150=require(_0xf32e('0x51'));var _0x205ec=![];var _0x4dd9a1={};if(_0x517838['query']['type']&&_0x517838[_0xf32e('0x37')]['type']===_0xf32e('0x52')){_0x4dd9a1[_0xf32e('0x52')]=_0x517838[_0xf32e('0x50')]['id'];}else{_0x4dd9a1['id']=_0x517838['params']['id'];}return db[_0xf32e('0x2f')][_0xf32e('0x4b')]({'where':_0x4dd9a1,'attributes':['id',_0xf32e('0x53')],'raw':!![]})[_0xf32e('0x25')](handleEntityNotFound(_0x483ba3,null))[_0xf32e('0x25')](function(_0x2e2b89){if(_0x2e2b89){var _0x1906d9=_0x2e2b89['value'];var _0x6bb426=util[_0xf32e('0x36')](_0xf32e('0x54'),_0x1906d9);if(fs[_0xf32e('0x55')](_0x6bb426)){_0x205ec=!![];return _0x63e150[_0xf32e('0x56')](_0x6bb426,_0x1906d9,config[_0xf32e('0x57')]['recording'])['then'](function(){return _0x2e2b89;});}return _0x2e2b89;}})[_0xf32e('0x25')](function(_0x2df39e){if(_0x2df39e){var _0x4bc3e4=_0x2df39e['value'];if(!fs[_0xf32e('0x55')](_0x4bc3e4)){throw new db[(_0xf32e('0x58'))]['ValidationError']('VoiceRecording\x20not\x20found');}if(_0x2df39e[_0xf32e('0x59')]){return _0x483ba3[_0xf32e('0x5a')](_0x4bc3e4,_0x2df39e[_0xf32e('0x59')]+path[_0xf32e('0x5b')](_0x4bc3e4),function(){if(_0x205ec){fs[_0xf32e('0x5c')](_0x4bc3e4);}});}else{return _0x483ba3['download'](_0x4bc3e4,function(_0x14f3c3){if(_0x205ec){fs['unlink'](_0x4bc3e4);}});}}})['catch'](function(_0x3a5d8e){if(_0x3a5d8e[_0xf32e('0x5d')]===_0xf32e('0x5e')){_0x483ba3['status'](0x194)[_0xf32e('0x2c')](_0xf32e('0x5f'));}else{return handleError(_0x483ba3,null);}});};exports[_0xf32e('0x60')]=function(_0x1b6ac3,_0x1f8fe6,_0x5dafdf){var _0x1251cf=require(_0xf32e('0x51'));var _0x1734ac=![];var _0x3c8714={'$and':[db['sequelize'][_0xf32e('0x42')](db[_0xf32e('0x61')]['fn']('MD5',db[_0xf32e('0x61')][_0xf32e('0x62')]('uniqueid')),_0x1b6ac3[_0xf32e('0x37')][_0xf32e('0x63')])]};if(_0x1b6ac3[_0xf32e('0x37')][_0xf32e('0x32')]&&_0x1b6ac3[_0xf32e('0x37')][_0xf32e('0x32')]===_0xf32e('0x52')){_0x3c8714[_0xf32e('0x64')][_0xf32e('0x65')]({'uniqueid':_0x1b6ac3['params']['id']});}else{_0x3c8714[_0xf32e('0x64')][_0xf32e('0x65')]({'id':_0x1b6ac3[_0xf32e('0x50')]['id']});}return db[_0xf32e('0x2f')][_0xf32e('0x4b')]({'where':_0x3c8714,'attributes':['id',_0xf32e('0x53')],'raw':!![]})[_0xf32e('0x25')](handleEntityNotFound(_0x1f8fe6,null))['then'](function(_0x4f4574){if(_0x4f4574){var _0x99d8fa=util[_0xf32e('0x36')](_0xf32e('0x54'),_0x4f4574[_0xf32e('0x53')]);if(fs[_0xf32e('0x55')](_0x99d8fa)){_0x1734ac=!![];return _0x1251cf[_0xf32e('0x56')](_0x99d8fa,_0x4f4574[_0xf32e('0x53')],config[_0xf32e('0x57')][_0xf32e('0x66')])['then'](function(){return _0x4f4574;});}return _0x4f4574;}})['then'](function(_0x2d6180){if(_0x2d6180){if(!fs['existsSync'](_0x2d6180[_0xf32e('0x53')])){throw new db[(_0xf32e('0x58'))]['ValidationError'](_0xf32e('0x5e'));}if(_0x2d6180[_0xf32e('0x59')]){return _0x1f8fe6[_0xf32e('0x5a')](_0x2d6180[_0xf32e('0x53')],_0x2d6180[_0xf32e('0x59')]+path[_0xf32e('0x5b')](_0x2d6180[_0xf32e('0x53')]),function(){if(_0x1734ac){fs['unlink'](_0x2d6180[_0xf32e('0x53')]);}});}else{return _0x1f8fe6[_0xf32e('0x5a')](_0x2d6180[_0xf32e('0x53')],function(_0xadeaac){if(_0x1734ac){fs['unlink'](_0x2d6180[_0xf32e('0x53')]);}});}}})[_0xf32e('0x4c')](handleError(_0x1f8fe6,null));};exports[_0xf32e('0x26')]=function(_0x5b3307,_0x215208){return db[_0xf32e('0x2f')][_0xf32e('0x4b')]({'where':{'id':_0x5b3307[_0xf32e('0x50')]['id']}})['then'](function(_0x22a17e){if(_[_0xf32e('0x67')](_0x22a17e)){throw new ReferenceError(_0xf32e('0x68'));}return _0x22a17e;})[_0xf32e('0x25')](function(_0x98c6e7){var _0x21d23f=_0x98c6e7[_0xf32e('0x53')];logger[_0xf32e('0x69')]('cancellazione\x20fisica\x20documento\x20%s',_0x21d23f);if(!_[_0xf32e('0x67')](_0x98c6e7[_0xf32e('0x53')])&&fs[_0xf32e('0x55')](_0x21d23f)){logger['info'](_0xf32e('0x6a')+_0x21d23f+_0xf32e('0x6b'));fs['unlinkSync'](_0x21d23f);}_0x21d23f=_0x21d23f+'.cypher';if(!_[_0xf32e('0x67')](_0x98c6e7[_0xf32e('0x53')])&&fs[_0xf32e('0x55')](_0x21d23f)){logger[_0xf32e('0x69')]('File:\x20\x22'+_0x21d23f+_0xf32e('0x6b'));fs['unlinkSync'](_0x21d23f);}return _0x98c6e7;})[_0xf32e('0x25')](function(_0x1a326d){if(!_0x1a326d)throw new InternalError();return _0x1a326d[_0xf32e('0x26')]();})[_0xf32e('0x25')](function(){_0x215208[_0xf32e('0x1c')](0xcc)[_0xf32e('0x27')]();})[_0xf32e('0x4c')](handleError(_0x215208,null));};function getBucketslist(_0x590dd1,_0x2c9189,_0x24c217){return new Promise(function(_0x5bf712,_0x3d259e){var _0x34bc72=new AWS['S3']({'accessKeyId':_0x2c9189,'secretAccessKey':_0x590dd1,'region':_0x24c217});_0x34bc72[_0xf32e('0x6c')]({},function(_0x5399f0,_0x38b2f1){if(_0x5399f0){return _0x3d259e(_0x5399f0);}else{return _0x5bf712(_0x38b2f1);}});});}function createBucket(_0x29b98a,_0x401cd1,_0x4dd734,_0x1dd602){return new Promise(function(_0x1ccebc,_0x3c5a2a){var _0xc614=new AWS['S3']({'accessKeyId':_0x401cd1,'secretAccessKey':_0x29b98a,'region':_0x4dd734});_0xc614[_0xf32e('0x6d')]({'Bucket':_0x1dd602},function(_0x4bdc1c,_0x308af4){if(_0x4bdc1c){return _0x3c5a2a(_0x4bdc1c);}else{return _0x1ccebc(_0x308af4);}});});}function uploadFile(_0x2bdf90,_0x537ccb,_0xc280ca,_0x2f318a,_0x1d9fd9,_0x1e73f6){return new Promise(function(_0x1c1ec4,_0x2f20af){var _0x640007=new AWS['S3']({'accessKeyId':_0x537ccb,'secretAccessKey':_0x2bdf90,'region':_0xc280ca});_0x640007[_0xf32e('0x6e')]({'Bucket':_0x2f318a,'Key':_0x1d9fd9,'Body':_0x1e73f6},function(_0x586dd7,_0x28efc8){if(_0x586dd7){return _0x2f20af(_0x586dd7);}else{return _0x1c1ec4(_0x28efc8);}});});}function startTranscribe(_0xd42483,_0x124bec,_0x512e96,_0x1de636,_0x16661d,_0x990166){return new Promise(function(_0x402791,_0x3b3fa1){var _0x45d785=new AWS[(_0xf32e('0x6f'))]({'accessKeyId':_0x124bec,'secretAccessKey':_0xd42483,'region':_0x512e96});_0x45d785['startTranscriptionJob']({'TranscriptionJobName':_0x1de636,'LanguageCode':_0x16661d,'Media':{'MediaFileUri':_0x990166}},function(_0x1c6b7a,_0x133818){if(_0x1c6b7a){return _0x3b3fa1(_0x1c6b7a);}else{return _0x402791(_0x133818);}});});}function transcribe(_0x200586,_0x4477c9,_0x20379b,_0x29a15d,_0x5ddbf0,_0x12dd24,_0x25e68b){return new Promise(function(_0x31549e,_0x153e05){var _0x1ff322={};logger[_0xf32e('0x69')](util[_0xf32e('0x36')](_0xf32e('0x70'),_0x200586,_0x5ddbf0));return uploadFile(_0x4477c9,_0x20379b,_0x29a15d,_0x5ddbf0,path[_0xf32e('0x71')](_0x12dd24),fs[_0xf32e('0x72')](_0x12dd24))['then'](function(_0x245727){logger[_0xf32e('0x69')](util[_0xf32e('0x36')](_0xf32e('0x73'),_0x200586,_0x5ddbf0,_0x245727[_0xf32e('0x74')]));_0x1ff322[_0xf32e('0x75')]=_0x245727[_0xf32e('0x76')];_0x1ff322[_0xf32e('0x77')]=_0x245727[_0xf32e('0x74')];logger[_0xf32e('0x69')](util[_0xf32e('0x36')](_0xf32e('0x78'),_0x200586));return startTranscribe(_0x4477c9,_0x20379b,_0x29a15d,uuidv4(),_0x25e68b,_0x245727['Location']);})[_0xf32e('0x25')](function(_0x56ab85){logger[_0xf32e('0x69')](util[_0xf32e('0x36')](_0xf32e('0x79'),_0x200586,_0x56ab85[_0xf32e('0x7a')][_0xf32e('0x7b')]));_0x1ff322['transcribeName']=_0x56ab85['TranscriptionJob'][_0xf32e('0x7b')];_0x1ff322[_0xf32e('0x7c')]=_0x56ab85[_0xf32e('0x7a')][_0xf32e('0x7d')];return _0x31549e(_0x1ff322);})[_0xf32e('0x4c')](function(_0x53d4e2){return _0x153e05(_0x53d4e2);});});}exports['runTranscribe']=function(_0x20ece8,_0xa143fd,_0x49b2c4){var _0xe5467f;var _0x1a3aec;var _0x3d27d3;var _0x1915eb=require(_0xf32e('0x51'));return db[_0xf32e('0x2f')]['findOne']({'where':{'id':_0x20ece8['params']['id']}})[_0xf32e('0x25')](function(_0x32b6b4){if(_0x32b6b4){var _0x5d2987=util['format']('%s.cypher',_0x32b6b4[_0xf32e('0x53')]);if(fs[_0xf32e('0x55')](_0x5d2987)){cypher=!![];return _0x1915eb[_0xf32e('0x56')](_0x5d2987,_0x32b6b4[_0xf32e('0x53')],config[_0xf32e('0x57')]['recording'])['then'](function(){return _0x32b6b4;});}return _0x32b6b4;}})[_0xf32e('0x25')](function(_0x34993e){if(!_0x34993e){throw new db[(_0xf32e('0x58'))][(_0xf32e('0x7e'))]('Voice\x20Recording\x20not\x20found');}_0x1a3aec=_0x34993e;return db[_0xf32e('0x7f')]['findOne']({'where':{'id':0x1}});})[_0xf32e('0x25')](handleEntityNotFound(_0xa143fd,null))[_0xf32e('0x25')](function(_0x44bd56){if(_0x44bd56){_0xe5467f=_0x44bd56;if(!_0xe5467f[_0xf32e('0x80')]||!_0xe5467f[_0xf32e('0x81')]||!_0xe5467f['transcribeRegion']||!_0xe5467f[_0xf32e('0x82')]||!_0xe5467f[_0xf32e('0x75')]){throw new db[(_0xf32e('0x58'))][(_0xf32e('0x7e'))](_0xf32e('0x83'));}if(_0x20ece8[_0xf32e('0x4e')][_0xf32e('0x84')]&&(!_0xe5467f['sentiment']||!_0xe5467f[_0xf32e('0x85')]||!_0xe5467f[_0xf32e('0x86')]||!_0xe5467f[_0xf32e('0x82')]||!_0xe5467f['bucket'])){throw new db[(_0xf32e('0x58'))][(_0xf32e('0x7e'))](_0xf32e('0x87'));}return db['CloudProvider'][_0xf32e('0x88')]({'where':{'id':_0xe5467f['transcribeAccountId']}});}})[_0xf32e('0x25')](function(_0x1352b9){if(!_0x1352b9){throw new db[(_0xf32e('0x58'))][(_0xf32e('0x7e'))]('Cloud\x20Provider\x20not\x20available');}if(!_0x1352b9['data1']||!_0x1352b9[_0xf32e('0x89')]){throw new db[(_0xf32e('0x58'))][(_0xf32e('0x7e'))](_0xf32e('0x8a'));}_0x3d27d3=_0x1352b9;return getBucketslist(_0x3d27d3[_0xf32e('0x8b')],_0x3d27d3[_0xf32e('0x89')],_0xe5467f['transcribeRegion']);})[_0xf32e('0x25')](function(_0x1f2ca7){if(_0x1f2ca7&&_0x1f2ca7['Buckets']){var _0x1922ed=_[_0xf32e('0x4b')](_0x1f2ca7['Buckets'],function(_0x5df736){return _0x5df736[_0xf32e('0x8c')]===_0xe5467f[_0xf32e('0x75')];});if(!_0x1922ed){logger[_0xf32e('0x69')](util[_0xf32e('0x36')]('[RUNTRANSCRIPT][%d]\x20Bucket\x20%s\x20not\x20available',_0x20ece8[_0xf32e('0x50')]['id'],_0xe5467f[_0xf32e('0x75')]));return createBucket(_0x3d27d3[_0xf32e('0x8b')],_0x3d27d3[_0xf32e('0x89')],_0xe5467f[_0xf32e('0x8d')],_0xe5467f[_0xf32e('0x75')]);}logger[_0xf32e('0x69')](util[_0xf32e('0x36')](_0xf32e('0x8e'),_0x20ece8['params']['id'],_0xe5467f[_0xf32e('0x75')]));return;}})[_0xf32e('0x25')](function(_0x2523a2){if(_0x1a3aec[_0xf32e('0x7c')]===_0xf32e('0x8f')){return transcribe(_0x20ece8[_0xf32e('0x50')]['id'],_0x3d27d3[_0xf32e('0x8b')],_0x3d27d3[_0xf32e('0x89')],_0xe5467f[_0xf32e('0x8d')],_0xe5467f[_0xf32e('0x75')],_0x1a3aec[_0xf32e('0x53')],_0xe5467f[_0xf32e('0x82')]);}else{logger[_0xf32e('0x69')](util['format'](_0xf32e('0x90'),_0x20ece8['params']['id']));return{'transcribeStatus':_0xf32e('0x91')};}})[_0xf32e('0x25')](function(_0x38a823){if(_0x38a823){_0x38a823[_0xf32e('0x92')]=_0x20ece8[_0xf32e('0x4e')]['runSentiment'];return _0x1a3aec[_0xf32e('0x93')](_0x38a823);}})[_0xf32e('0x25')](respondWithResult(_0xa143fd,null))[_0xf32e('0x4c')](handleError(_0xa143fd,null));};function writeFile(_0x54d147,_0x10bda2){return new Promise(function(_0x1a50d3,_0x25c740){fs['writeFile'](_0x10bda2,_0x54d147,function(_0x41b879,_0x207bc5){if(_0x41b879){return _0x25c740(_0x41b879);}else{return _0x1a50d3(_0x207bc5);}});});}exports['downloadTranscribe']=function(_0x32870b,_0x3e5862,_0x42f252){return db[_0xf32e('0x2f')][_0xf32e('0x88')]({'where':{'id':_0x32870b[_0xf32e('0x50')]['id']}})[_0xf32e('0x25')](handleEntityNotFound(_0x3e5862))['then'](function(_0x5d01b2){if(_0x5d01b2&&_0x5d01b2['fileText']){var _0x265297=_0x5d01b2[_0xf32e('0x94')];var _0x41b40f=config[_0xf32e('0x95')]+_0xf32e('0x96')+_0x5d01b2['id']+'.txt';if(fs[_0xf32e('0x55')](_0x41b40f)){return _0x41b40f;}return writeFile(_0x265297,_0x41b40f)[_0xf32e('0x25')](function(){return _0x41b40f;});}else{throw new db[(_0xf32e('0x58'))]['ValidationError'](_0xf32e('0x97'));}})[_0xf32e('0x25')](function(_0xc13c4c){return _0x3e5862[_0xf32e('0x5a')](_0xc13c4c);})[_0xf32e('0x4c')](handleError(_0x3e5862));}; \ No newline at end of file +var _0x8ffc=['Cloud\x20Provider\x20not\x20available','data1','data2','transcribeRegion','Buckets','Name','[RUNTRANSCRIPT][%d]\x20Bucket\x20%s\x20not\x20available','NEW','[RUNTRANSCRIPT][%d]\x20Transcript\x20action\x20already\x20requested','IN_PROGRESS','tempSentiment','updateAttributes','fileText','/server/files/transcribes/transcribe_','Transcript\x20not\x20available','eml-format','zip-dir','fast-json-patch','request-promise','moment','mustache','util','sox','to-csv','fs-extra','lodash','squel','crypto','jsforce','desk.js','querystring','papaparse','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/logger','api','../../config/environment','../../config/license/util','sendStatus','status','json','offset','count','limit','set','apply','reject','save','then','destroy','end','error','name','send','index','map','type','key','model','differenceBy','format','keys','filters','intersection','query','attributes','fields','nolimit','order','sort','where','pick','filter','merge','VIRTUAL','VoiceRecording','includeAll','include','rows','params','length','options','find','catch','create','body','update','describe','download','../../components/encryptor','uniqueid','value','existsSync','decryptFile','secrets','Sequelize','ValidationError','VoiceRecording\x20not\x20found','filename','unlink','Not\x20found','downloads','sequelize','MD5','col','$and','push','%s.cypher','recording','extname','isNil','Entity\x20not\x20found','info','cancellazione\x20fisica\x20documento\x20%s','File:\x20\x22','\x22\x20trovato\x20eseguo\x20la\x20cancellazione','unlinkSync','createBucket','TranscribeService','[RUNTRANSCRIPT][%d]\x20Starting\x20voice\x20recording\x20upload\x20in\x20bucket\x20%s','basename','[RUNTRANSCRIPT][%d]\x20Voice\x20recording\x20uploaded\x20in\x20bucket\x20%s\x20(%s)','Location','bucket','Bucket','[RUNTRANSCRIPT][%d]\x20Sending\x20transcribe\x20request','TranscriptionJob','TranscriptionJobName','transcribeStatus','TranscriptionJobStatus','findOne','Voice\x20Recording\x20not\x20found','Setting','transcribe','transcribeAccountId','Transcribe\x20not\x20configured','runSentiment','sentimentAccountId','language','Sentiment\x20Analysis\x20not\x20configured','CloudProvider'];(function(_0x5c3961,_0x29a7ab){var _0x14e351=function(_0x47cffd){while(--_0x47cffd){_0x5c3961['push'](_0x5c3961['shift']());}};_0x14e351(++_0x29a7ab);}(_0x8ffc,0x12b));var _0xc8ff=function(_0x4b2863,_0x494899){_0x4b2863=_0x4b2863-0x0;var _0x567d67=_0x8ffc[_0x4b2863];return _0x567d67;};'use strict';var emlformat=require(_0xc8ff('0x0'));var rimraf=require('rimraf');var zipdir=require(_0xc8ff('0x1'));var jsonpatch=require(_0xc8ff('0x2'));var rp=require(_0xc8ff('0x3'));var moment=require(_0xc8ff('0x4'));var BPromise=require('bluebird');var Mustache=require(_0xc8ff('0x5'));var util=require(_0xc8ff('0x6'));var path=require('path');var sox=require(_0xc8ff('0x7'));var csv=require(_0xc8ff('0x8'));var ejs=require('ejs');var fs=require('fs');var fs_extra=require(_0xc8ff('0x9'));var _=require(_0xc8ff('0xa'));var squel=require(_0xc8ff('0xb'));var crypto=require(_0xc8ff('0xc'));var jsforce=require(_0xc8ff('0xd'));var deskjs=require(_0xc8ff('0xe'));var toCsv=require(_0xc8ff('0x8'));var querystring=require(_0xc8ff('0xf'));var Papa=require(_0xc8ff('0x10'));var AWS=require('aws-sdk');var uuidv4=require('uuid/v4');var Redis=require('ioredis');var authService=require(_0xc8ff('0x11'));var qs=require(_0xc8ff('0x12'));var as=require(_0xc8ff('0x13'));var hardwareService=require('../../config/license/hardware');var logger=require(_0xc8ff('0x14'))(_0xc8ff('0x15'));var utils=require('../../config/utils');var config=require(_0xc8ff('0x16'));var licenseUtil=require(_0xc8ff('0x17'));var db=require('../../mysqldb')['db'];function respondWithStatusCode(_0x3a8467,_0x3e0642){_0x3e0642=_0x3e0642||0xcc;return function(_0x33201f){if(_0x33201f){return _0x3a8467[_0xc8ff('0x18')](_0x3e0642);}return _0x3a8467[_0xc8ff('0x19')](_0x3e0642)['end']();};}function respondWithResult(_0x2bd18e,_0x586aa9){_0x586aa9=_0x586aa9||0xc8;return function(_0x57d955){if(_0x57d955){return _0x2bd18e['status'](_0x586aa9)[_0xc8ff('0x1a')](_0x57d955);}};}function respondWithFilteredResult(_0x50c205,_0x29fa1b){return function(_0x342585){if(_0x342585){var _0x14977c=typeof _0x29fa1b[_0xc8ff('0x1b')]==='undefined'&&typeof _0x29fa1b['limit']==='undefined';var _0x4776d6=_0x342585[_0xc8ff('0x1c')];var _0x3a710a=_0x14977c?0x0:_0x29fa1b[_0xc8ff('0x1b')];var _0x34b868=_0x14977c?_0x342585[_0xc8ff('0x1c')]:_0x29fa1b['offset']+_0x29fa1b[_0xc8ff('0x1d')];var _0x33b2cc;if(_0x34b868>=_0x4776d6){_0x34b868=_0x4776d6;_0x33b2cc=0xc8;}else{_0x33b2cc=0xce;}_0x50c205[_0xc8ff('0x19')](_0x33b2cc);return _0x50c205[_0xc8ff('0x1e')]('Content-Range',_0x3a710a+'-'+_0x34b868+'/'+_0x4776d6)[_0xc8ff('0x1a')](_0x342585);}return null;};}function patchUpdates(_0x5a04a2){return function(_0x24734f){try{jsonpatch[_0xc8ff('0x1f')](_0x24734f,_0x5a04a2,!![]);}catch(_0x1eec61){return BPromise[_0xc8ff('0x20')](_0x1eec61);}return _0x24734f[_0xc8ff('0x21')]();};}function saveUpdates(_0x2c7bc3,_0xf4a5ab){return function(_0x23b9e6){if(_0x23b9e6){return _0x23b9e6['update'](_0x2c7bc3)[_0xc8ff('0x22')](function(_0x3a7350){return _0x3a7350;});}return null;};}function removeEntity(_0x31e4c1,_0x266a57){return function(_0x9a6e74){if(_0x9a6e74){return _0x9a6e74[_0xc8ff('0x23')]()[_0xc8ff('0x22')](function(){_0x31e4c1['status'](0xcc)[_0xc8ff('0x24')]();});}};}function handleEntityNotFound(_0xbd971e,_0xea7c13){return function(_0x3281e9){if(!_0x3281e9){_0xbd971e[_0xc8ff('0x18')](0x194);}return _0x3281e9;};}function handleError(_0x5eda31,_0x14f003){_0x14f003=_0x14f003||0x1f4;return function(_0x2ea304){logger[_0xc8ff('0x25')](_0x2ea304['stack']);if(_0x2ea304[_0xc8ff('0x26')]){delete _0x2ea304['name'];}_0x5eda31[_0xc8ff('0x19')](_0x14f003)[_0xc8ff('0x27')](_0x2ea304);};}exports[_0xc8ff('0x28')]=function(_0x1b15e3,_0x510f63){var _0x232bb9={},_0x3cec21={},_0x4cc631={'count':0x0,'rows':[]};var _0x20107d=_[_0xc8ff('0x29')](db['VoiceRecording']['rawAttributes'],function(_0x4838ea){return{'name':_0x4838ea['fieldName'],'type':_0x4838ea[_0xc8ff('0x2a')][_0xc8ff('0x2b')]};});_0x3cec21[_0xc8ff('0x2c')]=_[_0xc8ff('0x2d')](_[_0xc8ff('0x29')](_0x20107d,_0xc8ff('0x26')),[_0xc8ff('0x2e')]);_0x3cec21['query']=_[_0xc8ff('0x2f')](_0x1b15e3['query']);_0x3cec21[_0xc8ff('0x30')]=_[_0xc8ff('0x31')](_0x3cec21['model'],_0x3cec21[_0xc8ff('0x32')]);_0x232bb9[_0xc8ff('0x33')]=_[_0xc8ff('0x31')](_0x3cec21[_0xc8ff('0x2c')],qs[_0xc8ff('0x34')](_0x1b15e3[_0xc8ff('0x32')][_0xc8ff('0x34')]));_0x232bb9['attributes']=_0x232bb9[_0xc8ff('0x33')]['length']?_0x232bb9[_0xc8ff('0x33')]:_0x3cec21[_0xc8ff('0x2c')];if(!_0x1b15e3[_0xc8ff('0x32')]['hasOwnProperty'](_0xc8ff('0x35'))){_0x232bb9[_0xc8ff('0x1d')]=qs['limit'](_0x1b15e3['query']['limit']);_0x232bb9[_0xc8ff('0x1b')]=qs[_0xc8ff('0x1b')](_0x1b15e3['query'][_0xc8ff('0x1b')]);}_0x232bb9[_0xc8ff('0x36')]=qs[_0xc8ff('0x37')](_0x1b15e3[_0xc8ff('0x32')][_0xc8ff('0x37')]);_0x232bb9[_0xc8ff('0x38')]=qs[_0xc8ff('0x30')](_[_0xc8ff('0x39')](_0x1b15e3[_0xc8ff('0x32')],_0x3cec21[_0xc8ff('0x30')]),_0x20107d);if(_0x1b15e3[_0xc8ff('0x32')][_0xc8ff('0x3a')]){_0x232bb9[_0xc8ff('0x38')]=_[_0xc8ff('0x3b')](_0x232bb9['where'],{'$or':_['map'](_0x20107d,function(_0x2bcb4a){if(_0x2bcb4a[_0xc8ff('0x2a')]!==_0xc8ff('0x3c')){var _0x3cd614={};_0x3cd614[_0x2bcb4a['name']]={'$like':'%'+_0x1b15e3[_0xc8ff('0x32')][_0xc8ff('0x3a')]+'%'};return _0x3cd614;}})});}_0x232bb9=_[_0xc8ff('0x3b')]({},_0x232bb9,_0x1b15e3['options']);var _0x3955b5={'where':_0x232bb9[_0xc8ff('0x38')]};return db[_0xc8ff('0x3d')]['count'](_0x3955b5)[_0xc8ff('0x22')](function(_0x48d2a5){_0x4cc631[_0xc8ff('0x1c')]=_0x48d2a5;if(_0x1b15e3[_0xc8ff('0x32')][_0xc8ff('0x3e')]){_0x232bb9[_0xc8ff('0x3f')]=[{'all':!![]}];}return db[_0xc8ff('0x3d')]['findAll'](_0x232bb9);})['then'](function(_0x58c7d0){_0x4cc631[_0xc8ff('0x40')]=_0x58c7d0;return _0x4cc631;})[_0xc8ff('0x22')](respondWithFilteredResult(_0x510f63,_0x232bb9))['catch'](handleError(_0x510f63,null));};exports['show']=function(_0x5b2e29,_0x2b8125){var _0x58ddc6={'raw':![],'where':{'id':_0x5b2e29[_0xc8ff('0x41')]['id']}},_0x402bc5={};_0x402bc5[_0xc8ff('0x2c')]=_[_0xc8ff('0x2f')](db['VoiceRecording']['rawAttributes']);_0x402bc5[_0xc8ff('0x32')]=_[_0xc8ff('0x2f')](_0x5b2e29['query']);_0x402bc5[_0xc8ff('0x30')]=_['intersection'](_0x402bc5[_0xc8ff('0x2c')],_0x402bc5[_0xc8ff('0x32')]);_0x58ddc6['attributes']=_['intersection'](_0x402bc5[_0xc8ff('0x2c')],qs['fields'](_0x5b2e29[_0xc8ff('0x32')][_0xc8ff('0x34')]));_0x58ddc6[_0xc8ff('0x33')]=_0x58ddc6[_0xc8ff('0x33')][_0xc8ff('0x42')]?_0x58ddc6[_0xc8ff('0x33')]:_0x402bc5[_0xc8ff('0x2c')];if(_0x5b2e29['query'][_0xc8ff('0x3e')]){_0x58ddc6[_0xc8ff('0x3f')]=[{'all':!![]}];}_0x58ddc6=_[_0xc8ff('0x3b')]({},_0x58ddc6,_0x5b2e29[_0xc8ff('0x43')]);return db[_0xc8ff('0x3d')][_0xc8ff('0x44')](_0x58ddc6)[_0xc8ff('0x22')](handleEntityNotFound(_0x2b8125,null))[_0xc8ff('0x22')](respondWithResult(_0x2b8125,null))[_0xc8ff('0x45')](handleError(_0x2b8125,null));};exports[_0xc8ff('0x46')]=function(_0x4cc1a2,_0x3e9846){return db['VoiceRecording'][_0xc8ff('0x46')](_0x4cc1a2[_0xc8ff('0x47')],{})['then'](respondWithResult(_0x3e9846,0xc9))[_0xc8ff('0x45')](handleError(_0x3e9846,null));};exports[_0xc8ff('0x48')]=function(_0x52bc89,_0x159ec9){if(_0x52bc89[_0xc8ff('0x47')]['id']){delete _0x52bc89['body']['id'];}return db[_0xc8ff('0x3d')][_0xc8ff('0x44')]({'where':{'id':_0x52bc89['params']['id']}})[_0xc8ff('0x22')](handleEntityNotFound(_0x159ec9,null))[_0xc8ff('0x22')](saveUpdates(_0x52bc89['body'],null))[_0xc8ff('0x22')](respondWithResult(_0x159ec9,null))[_0xc8ff('0x45')](handleError(_0x159ec9,null));};exports['describe']=function(_0x3a72c0,_0x180706){return db[_0xc8ff('0x3d')][_0xc8ff('0x49')]()[_0xc8ff('0x22')](respondWithResult(_0x180706,null))[_0xc8ff('0x45')](handleError(_0x180706,null));};exports[_0xc8ff('0x4a')]=function(_0xe5cf61,_0x3e2fc6,_0x3c8450){var _0x1eb521=require(_0xc8ff('0x4b'));var _0x154f33=![];var _0x4bf9ed={};if(_0xe5cf61['query']['type']&&_0xe5cf61['query']['type']===_0xc8ff('0x4c')){_0x4bf9ed['uniqueid']=_0xe5cf61[_0xc8ff('0x41')]['id'];}else{_0x4bf9ed['id']=_0xe5cf61[_0xc8ff('0x41')]['id'];}return db[_0xc8ff('0x3d')]['find']({'where':_0x4bf9ed,'attributes':['id',_0xc8ff('0x4d')],'raw':!![]})[_0xc8ff('0x22')](handleEntityNotFound(_0x3e2fc6,null))[_0xc8ff('0x22')](function(_0x530ffe){if(_0x530ffe){var _0x1a1503=_0x530ffe['value'];var _0x46e9a2=util[_0xc8ff('0x2e')]('%s.cypher',_0x1a1503);if(fs[_0xc8ff('0x4e')](_0x46e9a2)){_0x154f33=!![];return _0x1eb521[_0xc8ff('0x4f')](_0x46e9a2,_0x1a1503,config[_0xc8ff('0x50')]['recording'])[_0xc8ff('0x22')](function(){return _0x530ffe;});}return _0x530ffe;}})[_0xc8ff('0x22')](function(_0x809720){if(_0x809720){var _0x145346=_0x809720[_0xc8ff('0x4d')];if(!fs[_0xc8ff('0x4e')](_0x145346)){throw new db[(_0xc8ff('0x51'))][(_0xc8ff('0x52'))](_0xc8ff('0x53'));}if(_0x809720[_0xc8ff('0x54')]){return _0x3e2fc6[_0xc8ff('0x4a')](_0x145346,_0x809720['filename']+path['extname'](_0x145346),function(){if(_0x154f33){fs[_0xc8ff('0x55')](_0x145346);}});}else{return _0x3e2fc6[_0xc8ff('0x4a')](_0x145346,function(_0x22c9ad){if(_0x154f33){fs[_0xc8ff('0x55')](_0x145346);}});}}})[_0xc8ff('0x45')](function(_0x5a9947){if(_0x5a9947['message']==='VoiceRecording\x20not\x20found'){_0x3e2fc6['status'](0x194)[_0xc8ff('0x27')](_0xc8ff('0x56'));}else{return handleError(_0x3e2fc6,null);}});};exports[_0xc8ff('0x57')]=function(_0x42d893,_0x3aecbf,_0x4c720d){var _0x156aed=require('../../components/encryptor');var _0x30d5d6=![];var _0x41823c={'$and':[db[_0xc8ff('0x58')][_0xc8ff('0x38')](db['sequelize']['fn'](_0xc8ff('0x59'),db[_0xc8ff('0x58')][_0xc8ff('0x5a')]('uniqueid')),_0x42d893[_0xc8ff('0x32')]['token'])]};if(_0x42d893['query'][_0xc8ff('0x2a')]&&_0x42d893['query']['type']==='uniqueid'){_0x41823c[_0xc8ff('0x5b')]['push']({'uniqueid':_0x42d893['params']['id']});}else{_0x41823c['$and'][_0xc8ff('0x5c')]({'id':_0x42d893[_0xc8ff('0x41')]['id']});}return db[_0xc8ff('0x3d')][_0xc8ff('0x44')]({'where':_0x41823c,'attributes':['id',_0xc8ff('0x4d')],'raw':!![]})[_0xc8ff('0x22')](handleEntityNotFound(_0x3aecbf,null))['then'](function(_0x3f0424){if(_0x3f0424){var _0x1be52d=util[_0xc8ff('0x2e')](_0xc8ff('0x5d'),_0x3f0424['value']);if(fs[_0xc8ff('0x4e')](_0x1be52d)){_0x30d5d6=!![];return _0x156aed[_0xc8ff('0x4f')](_0x1be52d,_0x3f0424['value'],config[_0xc8ff('0x50')][_0xc8ff('0x5e')])[_0xc8ff('0x22')](function(){return _0x3f0424;});}return _0x3f0424;}})[_0xc8ff('0x22')](function(_0x21a07b){if(_0x21a07b){if(!fs[_0xc8ff('0x4e')](_0x21a07b[_0xc8ff('0x4d')])){throw new db[(_0xc8ff('0x51'))]['ValidationError']('VoiceRecording\x20not\x20found');}if(_0x21a07b[_0xc8ff('0x54')]){return _0x3aecbf[_0xc8ff('0x4a')](_0x21a07b[_0xc8ff('0x4d')],_0x21a07b[_0xc8ff('0x54')]+path[_0xc8ff('0x5f')](_0x21a07b[_0xc8ff('0x4d')]),function(){if(_0x30d5d6){fs[_0xc8ff('0x55')](_0x21a07b[_0xc8ff('0x4d')]);}});}else{return _0x3aecbf['download'](_0x21a07b['value'],function(_0x5158fc){if(_0x30d5d6){fs[_0xc8ff('0x55')](_0x21a07b[_0xc8ff('0x4d')]);}});}}})['catch'](handleError(_0x3aecbf,null));};exports[_0xc8ff('0x23')]=function(_0x43d975,_0x2b60b1){return db['VoiceRecording'][_0xc8ff('0x44')]({'where':{'id':_0x43d975['params']['id']}})['then'](function(_0x5bed87){if(_[_0xc8ff('0x60')](_0x5bed87)){throw new ReferenceError(_0xc8ff('0x61'));}return _0x5bed87;})[_0xc8ff('0x22')](function(_0x35fe11){var _0x5adc5b=_0x35fe11[_0xc8ff('0x4d')];logger[_0xc8ff('0x62')](_0xc8ff('0x63'),_0x5adc5b);if(!_[_0xc8ff('0x60')](_0x35fe11['value'])&&fs[_0xc8ff('0x4e')](_0x5adc5b)){logger[_0xc8ff('0x62')](_0xc8ff('0x64')+_0x5adc5b+_0xc8ff('0x65'));fs[_0xc8ff('0x66')](_0x5adc5b);}_0x5adc5b=_0x5adc5b+'.cypher';if(!_[_0xc8ff('0x60')](_0x35fe11['value'])&&fs['existsSync'](_0x5adc5b)){logger[_0xc8ff('0x62')](_0xc8ff('0x64')+_0x5adc5b+_0xc8ff('0x65'));fs[_0xc8ff('0x66')](_0x5adc5b);}return _0x35fe11;})['then'](function(_0x12294d){if(!_0x12294d)throw new InternalError();return _0x12294d[_0xc8ff('0x23')]();})[_0xc8ff('0x22')](function(){_0x2b60b1[_0xc8ff('0x19')](0xcc)['end']();})[_0xc8ff('0x45')](handleError(_0x2b60b1,null));};function getBucketslist(_0x3ad564,_0x3a7a3a,_0x39b9d4){return new Promise(function(_0x5461dd,_0x314d62){var _0x216c66=new AWS['S3']({'accessKeyId':_0x3a7a3a,'secretAccessKey':_0x3ad564,'region':_0x39b9d4});_0x216c66['listBuckets']({},function(_0x319121,_0x43d985){if(_0x319121){return _0x314d62(_0x319121);}else{return _0x5461dd(_0x43d985);}});});}function createBucket(_0x2898b2,_0x55db57,_0x411ae,_0x145c4c){return new Promise(function(_0xdaf0b8,_0x1305d9){var _0x5a1599=new AWS['S3']({'accessKeyId':_0x55db57,'secretAccessKey':_0x2898b2,'region':_0x411ae});_0x5a1599[_0xc8ff('0x67')]({'Bucket':_0x145c4c},function(_0x3d1e1b,_0x5e3588){if(_0x3d1e1b){return _0x1305d9(_0x3d1e1b);}else{return _0xdaf0b8(_0x5e3588);}});});}function uploadFile(_0x477cab,_0x175701,_0x51f6f1,_0x3b1700,_0x5f5502,_0x354b97){return new Promise(function(_0x30065d,_0x29bc19){var _0x36c477=new AWS['S3']({'accessKeyId':_0x175701,'secretAccessKey':_0x477cab,'region':_0x51f6f1});_0x36c477['upload']({'Bucket':_0x3b1700,'Key':_0x5f5502,'Body':_0x354b97},function(_0x3f4468,_0x38403a){if(_0x3f4468){return _0x29bc19(_0x3f4468);}else{return _0x30065d(_0x38403a);}});});}function startTranscribe(_0x1e35c8,_0x8b39c6,_0x4e4e72,_0x319f75,_0x3df35c,_0x2f9b9c){return new Promise(function(_0x38e903,_0x55e969){var _0x4ae562=new AWS[(_0xc8ff('0x68'))]({'accessKeyId':_0x8b39c6,'secretAccessKey':_0x1e35c8,'region':_0x4e4e72});_0x4ae562['startTranscriptionJob']({'TranscriptionJobName':_0x319f75,'LanguageCode':_0x3df35c,'Media':{'MediaFileUri':_0x2f9b9c}},function(_0x29ff93,_0x3a8400){if(_0x29ff93){return _0x55e969(_0x29ff93);}else{return _0x38e903(_0x3a8400);}});});}function transcribe(_0x44b32d,_0x463fb4,_0x33e491,_0x138c05,_0x2e4f7a,_0x425ef4,_0x490e5b){return new Promise(function(_0x3fac9e,_0x1e71e5){var _0x201349={};logger[_0xc8ff('0x62')](util[_0xc8ff('0x2e')](_0xc8ff('0x69'),_0x44b32d,_0x2e4f7a));return uploadFile(_0x463fb4,_0x33e491,_0x138c05,_0x2e4f7a,path[_0xc8ff('0x6a')](_0x425ef4),fs['readFileSync'](_0x425ef4))['then'](function(_0x175af5){logger[_0xc8ff('0x62')](util[_0xc8ff('0x2e')](_0xc8ff('0x6b'),_0x44b32d,_0x2e4f7a,_0x175af5[_0xc8ff('0x6c')]));_0x201349[_0xc8ff('0x6d')]=_0x175af5[_0xc8ff('0x6e')];_0x201349['location']=_0x175af5[_0xc8ff('0x6c')];logger[_0xc8ff('0x62')](util[_0xc8ff('0x2e')](_0xc8ff('0x6f'),_0x44b32d));return startTranscribe(_0x463fb4,_0x33e491,_0x138c05,uuidv4(),_0x490e5b,_0x175af5[_0xc8ff('0x6c')]);})['then'](function(_0x2e6d83){logger[_0xc8ff('0x62')](util[_0xc8ff('0x2e')]('[RUNTRANSCRIPT][%d]\x20Transcription\x20job\x20%s\x20created',_0x44b32d,_0x2e6d83[_0xc8ff('0x70')][_0xc8ff('0x71')]));_0x201349['transcribeName']=_0x2e6d83[_0xc8ff('0x70')][_0xc8ff('0x71')];_0x201349[_0xc8ff('0x72')]=_0x2e6d83['TranscriptionJob'][_0xc8ff('0x73')];return _0x3fac9e(_0x201349);})[_0xc8ff('0x45')](function(_0x5245f9){return _0x1e71e5(_0x5245f9);});});}exports['runTranscribe']=function(_0x1bc92c,_0x313d09,_0x476d63){var _0x5a9f89;var _0x52a516;var _0x1ea098;var _0x4eef18=require('../../components/encryptor');return db['VoiceRecording'][_0xc8ff('0x74')]({'where':{'id':_0x1bc92c['params']['id']}})[_0xc8ff('0x22')](function(_0x3cb27f){if(_0x3cb27f){var _0x449ec0=util[_0xc8ff('0x2e')](_0xc8ff('0x5d'),_0x3cb27f[_0xc8ff('0x4d')]);if(fs['existsSync'](_0x449ec0)){cypher=!![];return _0x4eef18[_0xc8ff('0x4f')](_0x449ec0,_0x3cb27f[_0xc8ff('0x4d')],config[_0xc8ff('0x50')][_0xc8ff('0x5e')])['then'](function(){return _0x3cb27f;});}return _0x3cb27f;}})[_0xc8ff('0x22')](function(_0x263790){if(!_0x263790){throw new db[(_0xc8ff('0x51'))][(_0xc8ff('0x52'))](_0xc8ff('0x75'));}_0x52a516=_0x263790;return db[_0xc8ff('0x76')][_0xc8ff('0x74')]({'where':{'id':0x1}});})[_0xc8ff('0x22')](handleEntityNotFound(_0x313d09,null))[_0xc8ff('0x22')](function(_0x5158dc){if(_0x5158dc){_0x5a9f89=_0x5158dc;if(!_0x5a9f89[_0xc8ff('0x77')]||!_0x5a9f89[_0xc8ff('0x78')]||!_0x5a9f89['transcribeRegion']||!_0x5a9f89['language']||!_0x5a9f89[_0xc8ff('0x6d')]){throw new db['Sequelize'][(_0xc8ff('0x52'))](_0xc8ff('0x79'));}if(_0x1bc92c['body'][_0xc8ff('0x7a')]&&(!_0x5a9f89['sentiment']||!_0x5a9f89[_0xc8ff('0x7b')]||!_0x5a9f89['sentimentRegion']||!_0x5a9f89[_0xc8ff('0x7c')]||!_0x5a9f89[_0xc8ff('0x6d')])){throw new db[(_0xc8ff('0x51'))]['ValidationError'](_0xc8ff('0x7d'));}return db[_0xc8ff('0x7e')]['findOne']({'where':{'id':_0x5a9f89[_0xc8ff('0x78')]}});}})[_0xc8ff('0x22')](function(_0x452246){if(!_0x452246){throw new db[(_0xc8ff('0x51'))][(_0xc8ff('0x52'))](_0xc8ff('0x7f'));}if(!_0x452246[_0xc8ff('0x80')]||!_0x452246[_0xc8ff('0x81')]){throw new db[(_0xc8ff('0x51'))][(_0xc8ff('0x52'))]('Cloud\x20Provider\x20not\x20configured');}_0x1ea098=_0x452246;return getBucketslist(_0x1ea098[_0xc8ff('0x80')],_0x1ea098['data2'],_0x5a9f89[_0xc8ff('0x82')]);})[_0xc8ff('0x22')](function(_0x274f07){if(_0x274f07&&_0x274f07[_0xc8ff('0x83')]){var _0xd75d30=_[_0xc8ff('0x44')](_0x274f07[_0xc8ff('0x83')],function(_0x55217d){return _0x55217d[_0xc8ff('0x84')]===_0x5a9f89['bucket'];});if(!_0xd75d30){logger[_0xc8ff('0x62')](util[_0xc8ff('0x2e')](_0xc8ff('0x85'),_0x1bc92c[_0xc8ff('0x41')]['id'],_0x5a9f89[_0xc8ff('0x6d')]));return createBucket(_0x1ea098[_0xc8ff('0x80')],_0x1ea098[_0xc8ff('0x81')],_0x5a9f89[_0xc8ff('0x82')],_0x5a9f89[_0xc8ff('0x6d')]);}logger['info'](util[_0xc8ff('0x2e')]('[RUNTRANSCRIPT][%d]\x20Bucket\x20%s\x20available',_0x1bc92c[_0xc8ff('0x41')]['id'],_0x5a9f89[_0xc8ff('0x6d')]));return;}})['then'](function(_0x5e6249){if(_0x52a516['transcribeStatus']===_0xc8ff('0x86')){return transcribe(_0x1bc92c[_0xc8ff('0x41')]['id'],_0x1ea098['data1'],_0x1ea098[_0xc8ff('0x81')],_0x5a9f89['transcribeRegion'],_0x5a9f89[_0xc8ff('0x6d')],_0x52a516[_0xc8ff('0x4d')],_0x5a9f89[_0xc8ff('0x7c')]);}else{logger[_0xc8ff('0x62')](util[_0xc8ff('0x2e')](_0xc8ff('0x87'),_0x1bc92c[_0xc8ff('0x41')]['id']));return{'transcribeStatus':_0xc8ff('0x88')};}})[_0xc8ff('0x22')](function(_0x4d6fc8){if(_0x4d6fc8){_0x4d6fc8[_0xc8ff('0x89')]=_0x1bc92c[_0xc8ff('0x47')]['runSentiment'];return _0x52a516[_0xc8ff('0x8a')](_0x4d6fc8);}})[_0xc8ff('0x22')](respondWithResult(_0x313d09,null))[_0xc8ff('0x45')](handleError(_0x313d09,null));};function writeFile(_0x338d07,_0x14a805){return new Promise(function(_0x6dcc5b,_0x535709){fs['writeFile'](_0x14a805,_0x338d07,function(_0x115b4c,_0x16784e){if(_0x115b4c){return _0x535709(_0x115b4c);}else{return _0x6dcc5b(_0x16784e);}});});}exports['downloadTranscribe']=function(_0x105b2d,_0x2160d5,_0x3227bd){return db[_0xc8ff('0x3d')][_0xc8ff('0x74')]({'where':{'id':_0x105b2d[_0xc8ff('0x41')]['id']}})[_0xc8ff('0x22')](handleEntityNotFound(_0x2160d5))[_0xc8ff('0x22')](function(_0x526c1a){if(_0x526c1a&&_0x526c1a[_0xc8ff('0x8b')]){var _0x42443c=_0x526c1a['fileText'];var _0x1c9dd7=config['root']+_0xc8ff('0x8c')+_0x526c1a['id']+'.txt';if(fs[_0xc8ff('0x4e')](_0x1c9dd7)){return _0x1c9dd7;}return writeFile(_0x42443c,_0x1c9dd7)[_0xc8ff('0x22')](function(){return _0x1c9dd7;});}else{throw new db['Sequelize'][(_0xc8ff('0x52'))](_0xc8ff('0x8d'));}})[_0xc8ff('0x22')](function(_0x1edf35){return _0x2160d5[_0xc8ff('0x4a')](_0x1edf35);})[_0xc8ff('0x45')](handleError(_0x2160d5));}; \ No newline at end of file diff --git a/server/api/voiceRecording/voiceRecording.model.js b/server/api/voiceRecording/voiceRecording.model.js index 57d7590..b2a7410 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 _0xaefc=['uniqueid','transcribeStatus','./voiceRecording.attributes','exports','define','VoiceRecording'];(function(_0x52d238,_0x2c3a58){var _0x51520a=function(_0x4363ef){while(--_0x4363ef){_0x52d238['push'](_0x52d238['shift']());}};_0x51520a(++_0x2c3a58);}(_0xaefc,0xc8));var _0xcaef=function(_0x181d18,_0x58871b){_0x181d18=_0x181d18-0x0;var _0x1a259c=_0xaefc[_0x181d18];return _0x1a259c;};'use strict';var attributes=require(_0xcaef('0x0'));module[_0xcaef('0x1')]=function(_0x434367,_0x5e5d8b){return _0x434367[_0xcaef('0x2')](_0xcaef('0x3'),attributes,{'tableName':'voice_recordings','paranoid':![],'indexes':[{'name':'uniqueid','fields':[_0xcaef('0x4')]},{'name':_0xcaef('0x5'),'fields':['transcribeStatus']}],'timestamps':!![]});}; \ No newline at end of file +var _0x8c38=['define','VoiceRecording','voice_recordings','uniqueid','transcribeStatus','./voiceRecording.attributes','exports'];(function(_0x55dbdc,_0x2a203a){var _0x5d7a04=function(_0x44621e){while(--_0x44621e){_0x55dbdc['push'](_0x55dbdc['shift']());}};_0x5d7a04(++_0x2a203a);}(_0x8c38,0x83));var _0x88c3=function(_0x2477e7,_0x4e517e){_0x2477e7=_0x2477e7-0x0;var _0x413755=_0x8c38[_0x2477e7];return _0x413755;};'use strict';var attributes=require(_0x88c3('0x0'));module[_0x88c3('0x1')]=function(_0x51a0df,_0x143fbc){return _0x51a0df[_0x88c3('0x2')](_0x88c3('0x3'),attributes,{'tableName':_0x88c3('0x4'),'paranoid':![],'indexes':[{'name':'uniqueid','fields':[_0x88c3('0x5')]},{'name':_0x88c3('0x6'),'fields':[_0x88c3('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 ea6db11..e7cee52 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 _0x524e=['UpdateVoiceRecording','catch','CreateVoiceRecording','../../components/encryptor','Setting','findOne','callRecordingEncryption','create','body','existsSync','value','%s.cypher','recording','unlink','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','http','request','then','info','VoiceRecording,\x20%s,\x20%s','request\x20sent','debug','VoiceRecording,\x20%s,\x20%s,\x20%s','stringify','error','code','message','VoiceRecording','update','options','where','attributes','limit'];(function(_0x3947c9,_0x4d6c97){var _0x2e7871=function(_0x1236cc){while(--_0x1236cc){_0x3947c9['push'](_0x3947c9['shift']());}};_0x2e7871(++_0x4d6c97);}(_0x524e,0x15e));var _0xe524=function(_0x106bf3,_0x553c8d){_0x106bf3=_0x106bf3-0x0;var _0x4bcc2c=_0x524e[_0x106bf3];return _0x4bcc2c;};'use strict';var _=require('lodash');var util=require('util');var moment=require(_0xe524('0x0'));var BPromise=require(_0xe524('0x1'));var rs=require(_0xe524('0x2'));var fs=require('fs');var Redis=require(_0xe524('0x3'));var db=require(_0xe524('0x4'))['db'];var utils=require(_0xe524('0x5'));var logger=require(_0xe524('0x6'))(_0xe524('0x7'));var config=require(_0xe524('0x8'));var jayson=require(_0xe524('0x9'));var client=jayson['client'][_0xe524('0xa')]({'port':0x232a});function respondWithRpcPromise(_0x41e1a3,_0x347bed,_0x533c14){return new BPromise(function(_0x384935,_0x3e4cda){return client[_0xe524('0xb')](_0x41e1a3,_0x533c14)[_0xe524('0xc')](function(_0x991924){logger[_0xe524('0xd')](_0xe524('0xe'),_0x347bed,_0xe524('0xf'));logger[_0xe524('0x10')](_0xe524('0x11'),_0x347bed,_0xe524('0xf'),JSON[_0xe524('0x12')](_0x991924));if(_0x991924[_0xe524('0x13')]){if(_0x991924[_0xe524('0x13')][_0xe524('0x14')]===0x1f4){logger[_0xe524('0x13')]('VoiceRecording,\x20%s,\x20%s',_0x347bed,_0x991924['error'][_0xe524('0x15')]);return _0x3e4cda(_0x991924[_0xe524('0x13')][_0xe524('0x15')]);}logger[_0xe524('0x13')](_0xe524('0xe'),_0x347bed,_0x991924['error'][_0xe524('0x15')]);return _0x384935(_0x991924['error'][_0xe524('0x15')]);}else{logger[_0xe524('0xd')]('VoiceRecording,\x20%s,\x20%s',_0x347bed,_0xe524('0xf'));_0x384935(_0x991924['result'][_0xe524('0x15')]);}})['catch'](function(_0x29a031){logger['error']('VoiceRecording,\x20%s,\x20%s',_0x347bed,_0x29a031);_0x3e4cda(_0x29a031);});});}exports['UpdateVoiceRecording']=function(_0x3a4027){var _0x4f1dfb=this;return new Promise(function(_0x11b2a1,_0x238f8f){return db[_0xe524('0x16')][_0xe524('0x17')](_0x3a4027['body'],{'raw':_0x3a4027[_0xe524('0x18')]?_0x3a4027[_0xe524('0x18')]['raw']===undefined?!![]:![]:!![],'individualHooks':!![],'where':_0x3a4027[_0xe524('0x18')]?_0x3a4027[_0xe524('0x18')][_0xe524('0x19')]||null:null,'attributes':_0x3a4027[_0xe524('0x18')]?_0x3a4027[_0xe524('0x18')][_0xe524('0x1a')]||null:null,'limit':_0x3a4027[_0xe524('0x18')]?_0x3a4027[_0xe524('0x18')][_0xe524('0x1b')]||null:null})['then'](function(_0x7d1f92){logger['info']('UpdateVoiceRecording',_0x3a4027);logger[_0xe524('0x10')](_0xe524('0x1c'),_0x3a4027,JSON[_0xe524('0x12')](_0x7d1f92));_0x11b2a1(_0x7d1f92);})[_0xe524('0x1d')](function(_0x599d5d){logger[_0xe524('0x13')]('UpdateVoiceRecording',_0x599d5d[_0xe524('0x15')],_0x3a4027);_0x238f8f(_0x4f1dfb[_0xe524('0x13')](0x1f4,_0x599d5d[_0xe524('0x15')]));});});};exports[_0xe524('0x1e')]=function(_0x4102d9){var _0xfd5965=this;return new Promise(function(_0x2141db,_0x583cc3){var _0x58a896=require(_0xe524('0x1f'));var _0x45abad;return db[_0xe524('0x20')][_0xe524('0x21')]({'attributes':['id',_0xe524('0x22')],'where':{'id':0x1},'raw':!![]})['then'](function(_0x52f140){_0x45abad=_0x52f140;return db[_0xe524('0x16')][_0xe524('0x23')](_0x4102d9[_0xe524('0x24')]);})[_0xe524('0xc')](function(_0x25c0a1){if(_0x45abad['callRecordingEncryption']&&fs[_0xe524('0x25')](_0x25c0a1[_0xe524('0x26')])){var _0x4a4e15=util['format'](_0xe524('0x27'),_0x25c0a1[_0xe524('0x26')]);return _0x58a896['encryptFile'](_0x25c0a1[_0xe524('0x26')],_0x4a4e15,config['secrets'][_0xe524('0x28')])['then'](function(){fs[_0xe524('0x29')](_0x25c0a1[_0xe524('0x26')]);logger[_0xe524('0xd')]('CreateVoiceRecording\x20file\x20encrypted');return _0x25c0a1;});}return _0x25c0a1;})[_0xe524('0xc')](function(_0x5238c9){logger[_0xe524('0xd')](_0xe524('0x1e'),_0x4102d9);logger[_0xe524('0x10')]('CreateVoiceRecording',_0x4102d9,JSON[_0xe524('0x12')](_0x5238c9));_0x2141db(_0x5238c9);})[_0xe524('0x1d')](function(_0x49c43e){logger[_0xe524('0x13')](_0xe524('0x1e'),_0x49c43e[_0xe524('0x15')],_0x4102d9);_0x583cc3(_0xfd5965[_0xe524('0x13')](0x1f4,_0x49c43e['message']));});});}; \ No newline at end of file +var _0xa46e=['then','request\x20sent','debug','stringify','error','code','message','VoiceRecording,\x20%s,\x20%s','info','result','catch','VoiceRecording','update','options','raw','where','attributes','findOne','callRecordingEncryption','create','value','format','secrets','recording','unlink','CreateVoiceRecording\x20file\x20encrypted','CreateVoiceRecording','lodash','util','bluebird','randomstring','ioredis','../../config/utils','rpc','jayson/promise','http','request'];(function(_0x503cd5,_0x57774a){var _0x1fdf1e=function(_0x5222cc){while(--_0x5222cc){_0x503cd5['push'](_0x503cd5['shift']());}};_0x1fdf1e(++_0x57774a);}(_0xa46e,0x8a));var _0xea46=function(_0x3ed054,_0x4d4f16){_0x3ed054=_0x3ed054-0x0;var _0x16dd95=_0xa46e[_0x3ed054];return _0x16dd95;};'use strict';var _=require(_0xea46('0x0'));var util=require(_0xea46('0x1'));var moment=require('moment');var BPromise=require(_0xea46('0x2'));var rs=require(_0xea46('0x3'));var fs=require('fs');var Redis=require(_0xea46('0x4'));var db=require('../../mysqldb')['db'];var utils=require(_0xea46('0x5'));var logger=require('../../config/logger')(_0xea46('0x6'));var config=require('../../config/environment');var jayson=require(_0xea46('0x7'));var client=jayson['client'][_0xea46('0x8')]({'port':0x232a});function respondWithRpcPromise(_0x3dc26f,_0x5f1cd1,_0x2d1b30){return new BPromise(function(_0x42771a,_0xe7d428){return client[_0xea46('0x9')](_0x3dc26f,_0x2d1b30)[_0xea46('0xa')](function(_0x4cf206){logger['info']('VoiceRecording,\x20%s,\x20%s',_0x5f1cd1,_0xea46('0xb'));logger[_0xea46('0xc')]('VoiceRecording,\x20%s,\x20%s,\x20%s',_0x5f1cd1,_0xea46('0xb'),JSON[_0xea46('0xd')](_0x4cf206));if(_0x4cf206[_0xea46('0xe')]){if(_0x4cf206['error'][_0xea46('0xf')]===0x1f4){logger[_0xea46('0xe')]('VoiceRecording,\x20%s,\x20%s',_0x5f1cd1,_0x4cf206[_0xea46('0xe')][_0xea46('0x10')]);return _0xe7d428(_0x4cf206['error'][_0xea46('0x10')]);}logger['error'](_0xea46('0x11'),_0x5f1cd1,_0x4cf206[_0xea46('0xe')][_0xea46('0x10')]);return _0x42771a(_0x4cf206[_0xea46('0xe')][_0xea46('0x10')]);}else{logger[_0xea46('0x12')](_0xea46('0x11'),_0x5f1cd1,_0xea46('0xb'));_0x42771a(_0x4cf206[_0xea46('0x13')]['message']);}})[_0xea46('0x14')](function(_0xbf225e){logger[_0xea46('0xe')]('VoiceRecording,\x20%s,\x20%s',_0x5f1cd1,_0xbf225e);_0xe7d428(_0xbf225e);});});}exports['UpdateVoiceRecording']=function(_0x19d5c1){var _0x3f463d=this;return new Promise(function(_0x5cf5dd,_0x4b6745){return db[_0xea46('0x15')][_0xea46('0x16')](_0x19d5c1['body'],{'raw':_0x19d5c1[_0xea46('0x17')]?_0x19d5c1[_0xea46('0x17')][_0xea46('0x18')]===undefined?!![]:![]:!![],'individualHooks':!![],'where':_0x19d5c1[_0xea46('0x17')]?_0x19d5c1['options'][_0xea46('0x19')]||null:null,'attributes':_0x19d5c1['options']?_0x19d5c1['options'][_0xea46('0x1a')]||null:null,'limit':_0x19d5c1['options']?_0x19d5c1['options']['limit']||null:null})[_0xea46('0xa')](function(_0x36f982){logger[_0xea46('0x12')]('UpdateVoiceRecording',_0x19d5c1);logger[_0xea46('0xc')]('UpdateVoiceRecording',_0x19d5c1,JSON[_0xea46('0xd')](_0x36f982));_0x5cf5dd(_0x36f982);})[_0xea46('0x14')](function(_0x528eae){logger[_0xea46('0xe')]('UpdateVoiceRecording',_0x528eae[_0xea46('0x10')],_0x19d5c1);_0x4b6745(_0x3f463d[_0xea46('0xe')](0x1f4,_0x528eae[_0xea46('0x10')]));});});};exports['CreateVoiceRecording']=function(_0x5d2de1){var _0x44e797=this;return new Promise(function(_0x38ac07,_0x4b369c){var _0x3b3928=require('../../components/encryptor');var _0x11129d;return db['Setting'][_0xea46('0x1b')]({'attributes':['id',_0xea46('0x1c')],'where':{'id':0x1},'raw':!![]})[_0xea46('0xa')](function(_0x44517d){_0x11129d=_0x44517d;return db[_0xea46('0x15')][_0xea46('0x1d')](_0x5d2de1['body']);})[_0xea46('0xa')](function(_0x338e96){if(_0x11129d[_0xea46('0x1c')]&&fs['existsSync'](_0x338e96[_0xea46('0x1e')])){var _0x3cdf96=util[_0xea46('0x1f')]('%s.cypher',_0x338e96['value']);return _0x3b3928['encryptFile'](_0x338e96[_0xea46('0x1e')],_0x3cdf96,config[_0xea46('0x20')][_0xea46('0x21')])[_0xea46('0xa')](function(){fs[_0xea46('0x22')](_0x338e96[_0xea46('0x1e')]);logger[_0xea46('0x12')](_0xea46('0x23'));return _0x338e96;});}return _0x338e96;})[_0xea46('0xa')](function(_0x1c7201){logger[_0xea46('0x12')]('CreateVoiceRecording',_0x5d2de1);logger[_0xea46('0xc')](_0xea46('0x24'),_0x5d2de1,JSON[_0xea46('0xd')](_0x1c7201));_0x38ac07(_0x1c7201);})[_0xea46('0x14')](function(_0x1472c0){logger[_0xea46('0xe')](_0xea46('0x24'),_0x1472c0['message'],_0x5d2de1);_0x4b369c(_0x44e797[_0xea46('0xe')](0x1f4,_0x1472c0[_0xea46('0x10')]));});});}; \ No newline at end of file diff --git a/server/api/voiceTransferReport/index.js b/server/api/voiceTransferReport/index.js index 2e39b4f..a6765cb 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 _0x010c=['../../config/environment','./voiceTransferReport.controller','get','isAuthenticated','index','/:id','show','post','update','destroy','exports','multer','util','path','connect-timeout','express','Router','fs-extra','../../components/auth/service','../../components/interaction/service'];(function(_0x134cef,_0x2e67b6){var _0x1d3b37=function(_0x140c78){while(--_0x140c78){_0x134cef['push'](_0x134cef['shift']());}};_0x1d3b37(++_0x2e67b6);}(_0x010c,0x1d7));var _0xc010=function(_0x47486a,_0xae1980){_0x47486a=_0x47486a-0x0;var _0x5a1982=_0x010c[_0x47486a];return _0x5a1982;};'use strict';var multer=require(_0xc010('0x0'));var util=require(_0xc010('0x1'));var path=require(_0xc010('0x2'));var timeout=require(_0xc010('0x3'));var express=require(_0xc010('0x4'));var router=express[_0xc010('0x5')]();var fs_extra=require(_0xc010('0x6'));var auth=require(_0xc010('0x7'));var interaction=require(_0xc010('0x8'));var config=require(_0xc010('0x9'));var controller=require(_0xc010('0xa'));router[_0xc010('0xb')]('/',auth[_0xc010('0xc')](),controller[_0xc010('0xd')]);router[_0xc010('0xb')]('/describe',auth[_0xc010('0xc')](),controller['describe']);router[_0xc010('0xb')](_0xc010('0xe'),auth['isAuthenticated'](),controller[_0xc010('0xf')]);router[_0xc010('0x10')]('/',auth[_0xc010('0xc')](),controller['create']);router['put']('/:id',auth[_0xc010('0xc')](),controller[_0xc010('0x11')]);router['delete'](_0xc010('0xe'),auth[_0xc010('0xc')](),controller[_0xc010('0x12')]);module[_0xc010('0x13')]=router; \ No newline at end of file +var _0x2df7=['connect-timeout','fs-extra','../../components/interaction/service','../../config/environment','get','isAuthenticated','index','/describe','describe','/:id','delete','exports','multer','path'];(function(_0x50234b,_0x555b03){var _0x2331a5=function(_0x5003ff){while(--_0x5003ff){_0x50234b['push'](_0x50234b['shift']());}};_0x2331a5(++_0x555b03);}(_0x2df7,0x1e8));var _0x72df=function(_0x3c2aee,_0x39023d){_0x3c2aee=_0x3c2aee-0x0;var _0xd7294c=_0x2df7[_0x3c2aee];return _0xd7294c;};'use strict';var multer=require(_0x72df('0x0'));var util=require('util');var path=require(_0x72df('0x1'));var timeout=require(_0x72df('0x2'));var express=require('express');var router=express['Router']();var fs_extra=require(_0x72df('0x3'));var auth=require('../../components/auth/service');var interaction=require(_0x72df('0x4'));var config=require(_0x72df('0x5'));var controller=require('./voiceTransferReport.controller');router[_0x72df('0x6')]('/',auth[_0x72df('0x7')](),controller[_0x72df('0x8')]);router[_0x72df('0x6')](_0x72df('0x9'),auth[_0x72df('0x7')](),controller[_0x72df('0xa')]);router[_0x72df('0x6')]('/:id',auth[_0x72df('0x7')](),controller['show']);router['post']('/',auth[_0x72df('0x7')](),controller['create']);router['put'](_0x72df('0xb'),auth['isAuthenticated'](),controller['update']);router[_0x72df('0xc')](_0x72df('0xb'),auth[_0x72df('0x7')](),controller['destroy']);module[_0x72df('0xd')]=router; \ No newline at end of file diff --git a/server/api/voiceTransferReport/voiceTransferReport.attributes.js b/server/api/voiceTransferReport/voiceTransferReport.attributes.js index 9acc686..81f5cbb 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 _0x8486=['moment','exports','blind','attended','STRING','ENUM','Yes','sequelize'];(function(_0x26fbfd,_0x47f2c1){var _0x508968=function(_0x44f9dd){while(--_0x44f9dd){_0x26fbfd['push'](_0x26fbfd['shift']());}};_0x508968(++_0x47f2c1);}(_0x8486,0x1d7));var _0x6848=function(_0xa08f3b,_0x40ce28){_0xa08f3b=_0xa08f3b-0x0;var _0x72b95d=_0x8486[_0xa08f3b];return _0x72b95d;};'use strict';var Sequelize=require(_0x6848('0x0'));var moment=require(_0x6848('0x1'));module[_0x6848('0x2')]={'type':{'type':Sequelize['ENUM'](_0x6848('0x3'),_0x6848('0x4'))},'result':{'type':Sequelize['STRING']},'transfererchannel':{'type':Sequelize['STRING']},'transferercalleridnum':{'type':Sequelize[_0x6848('0x5')]},'transferercalleridname':{'type':Sequelize['STRING']},'transfererconnectedlinenum':{'type':Sequelize[_0x6848('0x5')]},'transfererconnectedlinename':{'type':Sequelize[_0x6848('0x5')]},'transfereraccountcode':{'type':Sequelize[_0x6848('0x5')]},'transferercontext':{'type':Sequelize[_0x6848('0x5')]},'transfererexten':{'type':Sequelize[_0x6848('0x5')]},'transfererlinkedid':{'type':Sequelize[_0x6848('0x5')]},'transfereechannel':{'type':Sequelize[_0x6848('0x5')]},'transfereecalleridnum':{'type':Sequelize[_0x6848('0x5')]},'transfereecalleridname':{'type':Sequelize[_0x6848('0x5')]},'transfereeconnectedlinenum':{'type':Sequelize['STRING']},'transfereeconnectedlinename':{'type':Sequelize[_0x6848('0x5')]},'transfereeaccountcode':{'type':Sequelize[_0x6848('0x5')]},'transfereecontext':{'type':Sequelize[_0x6848('0x5')]},'transfereeexten':{'type':Sequelize['STRING']},'transfereelinkedid':{'type':Sequelize[_0x6848('0x5')]},'isexternal':{'type':Sequelize[_0x6848('0x6')](_0x6848('0x7'),'No')},'context':{'type':Sequelize[_0x6848('0x5')]},'extension':{'type':Sequelize[_0x6848('0x5')]}}; \ No newline at end of file +var _0x46bc=['blind','attended','STRING','Yes','sequelize','moment','ENUM'];(function(_0x8f786b,_0xc9d621){var _0x118a41=function(_0x57859f){while(--_0x57859f){_0x8f786b['push'](_0x8f786b['shift']());}};_0x118a41(++_0xc9d621);}(_0x46bc,0x123));var _0xc46b=function(_0x54381d,_0x247b2c){_0x54381d=_0x54381d-0x0;var _0x5308a7=_0x46bc[_0x54381d];return _0x5308a7;};'use strict';var Sequelize=require(_0xc46b('0x0'));var moment=require(_0xc46b('0x1'));module['exports']={'type':{'type':Sequelize[_0xc46b('0x2')](_0xc46b('0x3'),_0xc46b('0x4'))},'result':{'type':Sequelize['STRING']},'transfererchannel':{'type':Sequelize['STRING']},'transferercalleridnum':{'type':Sequelize['STRING']},'transferercalleridname':{'type':Sequelize['STRING']},'transfererconnectedlinenum':{'type':Sequelize[_0xc46b('0x5')]},'transfererconnectedlinename':{'type':Sequelize['STRING']},'transfereraccountcode':{'type':Sequelize['STRING']},'transferercontext':{'type':Sequelize['STRING']},'transfererexten':{'type':Sequelize['STRING']},'transfererlinkedid':{'type':Sequelize[_0xc46b('0x5')]},'transfereechannel':{'type':Sequelize[_0xc46b('0x5')]},'transfereecalleridnum':{'type':Sequelize[_0xc46b('0x5')]},'transfereecalleridname':{'type':Sequelize['STRING']},'transfereeconnectedlinenum':{'type':Sequelize[_0xc46b('0x5')]},'transfereeconnectedlinename':{'type':Sequelize['STRING']},'transfereeaccountcode':{'type':Sequelize[_0xc46b('0x5')]},'transfereecontext':{'type':Sequelize[_0xc46b('0x5')]},'transfereeexten':{'type':Sequelize['STRING']},'transfereelinkedid':{'type':Sequelize[_0xc46b('0x5')]},'isexternal':{'type':Sequelize['ENUM'](_0xc46b('0x6'),'No')},'context':{'type':Sequelize['STRING']},'extension':{'type':Sequelize['STRING']}}; \ No newline at end of file diff --git a/server/api/voiceTransferReport/voiceTransferReport.controller.js b/server/api/voiceTransferReport/voiceTransferReport.controller.js index 358b84d..1f6d91a 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 _0xdc08=['includeAll','options','find','create','body','params','eml-format','rimraf','fast-json-patch','request-promise','moment','bluebird','mustache','path','ejs','fs-extra','squel','jsforce','to-csv','querystring','ioredis','../../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','save','update','then','destroy','error','send','index','rawAttributes','type','key','map','name','query','filters','intersection','model','attributes','fields','length','hasOwnProperty','nolimit','sort','where','pick','filter','VIRTUAL','merge','VoiceTransferReport','findAll','rows','catch','show','keys'];(function(_0x42f5bd,_0x3a53a7){var _0xa57338=function(_0x4b2ff5){while(--_0x4b2ff5){_0x42f5bd['push'](_0x42f5bd['shift']());}};_0xa57338(++_0x3a53a7);}(_0xdc08,0x96));var _0x8dc0=function(_0xefd519,_0xc62635){_0xefd519=_0xefd519-0x0;var _0x4bb882=_0xdc08[_0xefd519];return _0x4bb882;};'use strict';var emlformat=require(_0x8dc0('0x0'));var rimraf=require(_0x8dc0('0x1'));var zipdir=require('zip-dir');var jsonpatch=require(_0x8dc0('0x2'));var rp=require(_0x8dc0('0x3'));var moment=require(_0x8dc0('0x4'));var BPromise=require(_0x8dc0('0x5'));var Mustache=require(_0x8dc0('0x6'));var util=require('util');var path=require(_0x8dc0('0x7'));var sox=require('sox');var csv=require('to-csv');var ejs=require(_0x8dc0('0x8'));var fs=require('fs');var fs_extra=require(_0x8dc0('0x9'));var _=require('lodash');var squel=require(_0x8dc0('0xa'));var crypto=require('crypto');var jsforce=require(_0x8dc0('0xb'));var deskjs=require('desk.js');var toCsv=require(_0x8dc0('0xc'));var querystring=require(_0x8dc0('0xd'));var Papa=require('papaparse');var Redis=require(_0x8dc0('0xe'));var authService=require('../../components/auth/service');var qs=require(_0x8dc0('0xf'));var as=require(_0x8dc0('0x10'));var hardwareService=require(_0x8dc0('0x11'));var logger=require('../../config/logger')(_0x8dc0('0x12'));var utils=require(_0x8dc0('0x13'));var config=require(_0x8dc0('0x14'));var licenseUtil=require(_0x8dc0('0x15'));var db=require(_0x8dc0('0x16'))['db'];function respondWithStatusCode(_0x3c31de,_0x55cd48){_0x55cd48=_0x55cd48||0xcc;return function(_0x4d1b00){if(_0x4d1b00){return _0x3c31de['sendStatus'](_0x55cd48);}return _0x3c31de[_0x8dc0('0x17')](_0x55cd48)[_0x8dc0('0x18')]();};}function respondWithResult(_0xfe97c9,_0x3d5459){_0x3d5459=_0x3d5459||0xc8;return function(_0x5ca1b4){if(_0x5ca1b4){return _0xfe97c9['status'](_0x3d5459)[_0x8dc0('0x19')](_0x5ca1b4);}};}function respondWithFilteredResult(_0x13d4e8,_0x4666b4){return function(_0x1bcfe0){if(_0x1bcfe0){var _0x1e3024=typeof _0x4666b4[_0x8dc0('0x1a')]===_0x8dc0('0x1b')&&typeof _0x4666b4['limit']===_0x8dc0('0x1b');var _0x2632b7=_0x1bcfe0[_0x8dc0('0x1c')];var _0x2b37cb=_0x1e3024?0x0:_0x4666b4['offset'];var _0x310bf2=_0x1e3024?_0x1bcfe0[_0x8dc0('0x1c')]:_0x4666b4[_0x8dc0('0x1a')]+_0x4666b4[_0x8dc0('0x1d')];var _0x3d1511;if(_0x310bf2>=_0x2632b7){_0x310bf2=_0x2632b7;_0x3d1511=0xc8;}else{_0x3d1511=0xce;}_0x13d4e8[_0x8dc0('0x17')](_0x3d1511);return _0x13d4e8[_0x8dc0('0x1e')](_0x8dc0('0x1f'),_0x2b37cb+'-'+_0x310bf2+'/'+_0x2632b7)[_0x8dc0('0x19')](_0x1bcfe0);}return null;};}function patchUpdates(_0x1a3106){return function(_0x36d887){try{jsonpatch[_0x8dc0('0x20')](_0x36d887,_0x1a3106,!![]);}catch(_0x5b9e19){return BPromise['reject'](_0x5b9e19);}return _0x36d887[_0x8dc0('0x21')]();};}function saveUpdates(_0x3413c5,_0x5d2acc){return function(_0x3b98c8){if(_0x3b98c8){return _0x3b98c8[_0x8dc0('0x22')](_0x3413c5)[_0x8dc0('0x23')](function(_0x25fcf5){return _0x25fcf5;});}return null;};}function removeEntity(_0x32f01f,_0x5a1f01){return function(_0x11a814){if(_0x11a814){return _0x11a814[_0x8dc0('0x24')]()['then'](function(){_0x32f01f[_0x8dc0('0x17')](0xcc)[_0x8dc0('0x18')]();});}};}function handleEntityNotFound(_0x23f89a,_0x671b82){return function(_0x1529d7){if(!_0x1529d7){_0x23f89a['sendStatus'](0x194);}return _0x1529d7;};}function handleError(_0x16a1ae,_0x150321){_0x150321=_0x150321||0x1f4;return function(_0x440cdd){logger[_0x8dc0('0x25')](_0x440cdd['stack']);if(_0x440cdd['name']){delete _0x440cdd['name'];}_0x16a1ae[_0x8dc0('0x17')](_0x150321)[_0x8dc0('0x26')](_0x440cdd);};}exports[_0x8dc0('0x27')]=function(_0x1cf177,_0x354818){var _0x145d70={},_0x3dafc0={},_0x13a472={'count':0x0,'rows':[]};var _0x4fea6f=_['map'](db['VoiceTransferReport'][_0x8dc0('0x28')],function(_0x20a4d0){return{'name':_0x20a4d0['fieldName'],'type':_0x20a4d0[_0x8dc0('0x29')][_0x8dc0('0x2a')]};});_0x3dafc0['model']=_[_0x8dc0('0x2b')](_0x4fea6f,_0x8dc0('0x2c'));_0x3dafc0[_0x8dc0('0x2d')]=_['keys'](_0x1cf177[_0x8dc0('0x2d')]);_0x3dafc0[_0x8dc0('0x2e')]=_[_0x8dc0('0x2f')](_0x3dafc0[_0x8dc0('0x30')],_0x3dafc0[_0x8dc0('0x2d')]);_0x145d70[_0x8dc0('0x31')]=_[_0x8dc0('0x2f')](_0x3dafc0['model'],qs[_0x8dc0('0x32')](_0x1cf177[_0x8dc0('0x2d')][_0x8dc0('0x32')]));_0x145d70[_0x8dc0('0x31')]=_0x145d70[_0x8dc0('0x31')][_0x8dc0('0x33')]?_0x145d70[_0x8dc0('0x31')]:_0x3dafc0[_0x8dc0('0x30')];if(!_0x1cf177[_0x8dc0('0x2d')][_0x8dc0('0x34')](_0x8dc0('0x35'))){_0x145d70[_0x8dc0('0x1d')]=qs[_0x8dc0('0x1d')](_0x1cf177[_0x8dc0('0x2d')][_0x8dc0('0x1d')]);_0x145d70[_0x8dc0('0x1a')]=qs[_0x8dc0('0x1a')](_0x1cf177[_0x8dc0('0x2d')][_0x8dc0('0x1a')]);}_0x145d70['order']=qs[_0x8dc0('0x36')](_0x1cf177[_0x8dc0('0x2d')][_0x8dc0('0x36')]);_0x145d70[_0x8dc0('0x37')]=qs[_0x8dc0('0x2e')](_[_0x8dc0('0x38')](_0x1cf177[_0x8dc0('0x2d')],_0x3dafc0[_0x8dc0('0x2e')]),_0x4fea6f);if(_0x1cf177[_0x8dc0('0x2d')][_0x8dc0('0x39')]){_0x145d70[_0x8dc0('0x37')]=_['merge'](_0x145d70[_0x8dc0('0x37')],{'$or':_['map'](_0x4fea6f,function(_0x295081){if(_0x295081[_0x8dc0('0x29')]!==_0x8dc0('0x3a')){var _0x2f93a7={};_0x2f93a7[_0x295081['name']]={'$like':'%'+_0x1cf177[_0x8dc0('0x2d')][_0x8dc0('0x39')]+'%'};return _0x2f93a7;}})});}_0x145d70=_[_0x8dc0('0x3b')]({},_0x145d70,_0x1cf177['options']);var _0x4ccecb={'where':_0x145d70[_0x8dc0('0x37')]};return db[_0x8dc0('0x3c')][_0x8dc0('0x1c')](_0x4ccecb)[_0x8dc0('0x23')](function(_0x485e80){_0x13a472['count']=_0x485e80;if(_0x1cf177[_0x8dc0('0x2d')]['includeAll']){_0x145d70['include']=[{'all':!![]}];}return db['VoiceTransferReport'][_0x8dc0('0x3d')](_0x145d70);})[_0x8dc0('0x23')](function(_0xe20baf){_0x13a472[_0x8dc0('0x3e')]=_0xe20baf;return _0x13a472;})['then'](respondWithFilteredResult(_0x354818,_0x145d70))[_0x8dc0('0x3f')](handleError(_0x354818,null));};exports[_0x8dc0('0x40')]=function(_0x47b5a3,_0xbc4526){var _0x2f2d7a={'raw':!![],'where':{'id':_0x47b5a3['params']['id']}},_0x28bb76={};_0x28bb76['model']=_[_0x8dc0('0x41')](db[_0x8dc0('0x3c')][_0x8dc0('0x28')]);_0x28bb76[_0x8dc0('0x2d')]=_[_0x8dc0('0x41')](_0x47b5a3[_0x8dc0('0x2d')]);_0x28bb76[_0x8dc0('0x2e')]=_[_0x8dc0('0x2f')](_0x28bb76[_0x8dc0('0x30')],_0x28bb76[_0x8dc0('0x2d')]);_0x2f2d7a[_0x8dc0('0x31')]=_['intersection'](_0x28bb76['model'],qs[_0x8dc0('0x32')](_0x47b5a3[_0x8dc0('0x2d')][_0x8dc0('0x32')]));_0x2f2d7a[_0x8dc0('0x31')]=_0x2f2d7a[_0x8dc0('0x31')][_0x8dc0('0x33')]?_0x2f2d7a[_0x8dc0('0x31')]:_0x28bb76[_0x8dc0('0x30')];if(_0x47b5a3[_0x8dc0('0x2d')][_0x8dc0('0x42')]){_0x2f2d7a['include']=[{'all':!![]}];}_0x2f2d7a=_[_0x8dc0('0x3b')]({},_0x2f2d7a,_0x47b5a3[_0x8dc0('0x43')]);return db['VoiceTransferReport'][_0x8dc0('0x44')](_0x2f2d7a)[_0x8dc0('0x23')](handleEntityNotFound(_0xbc4526,null))[_0x8dc0('0x23')](respondWithResult(_0xbc4526,null))[_0x8dc0('0x3f')](handleError(_0xbc4526,null));};exports[_0x8dc0('0x45')]=function(_0x33aee6,_0x386405){return db[_0x8dc0('0x3c')][_0x8dc0('0x45')](_0x33aee6[_0x8dc0('0x46')],{})[_0x8dc0('0x23')](respondWithResult(_0x386405,0xc9))[_0x8dc0('0x3f')](handleError(_0x386405,null));};exports[_0x8dc0('0x22')]=function(_0x23d82a,_0x4d609a){if(_0x23d82a['body']['id']){delete _0x23d82a[_0x8dc0('0x46')]['id'];}return db['VoiceTransferReport'][_0x8dc0('0x44')]({'where':{'id':_0x23d82a[_0x8dc0('0x47')]['id']}})[_0x8dc0('0x23')](handleEntityNotFound(_0x4d609a,null))[_0x8dc0('0x23')](saveUpdates(_0x23d82a[_0x8dc0('0x46')],null))[_0x8dc0('0x23')](respondWithResult(_0x4d609a,null))['catch'](handleError(_0x4d609a,null));};exports['destroy']=function(_0x3548df,_0x510823){return db['VoiceTransferReport'][_0x8dc0('0x44')]({'where':{'id':_0x3548df['params']['id']}})[_0x8dc0('0x23')](handleEntityNotFound(_0x510823,null))[_0x8dc0('0x23')](removeEntity(_0x510823,null))[_0x8dc0('0x3f')](handleError(_0x510823,null));};exports['describe']=function(_0x35aa1a,_0x1a9fa0){return db[_0x8dc0('0x3c')]['describe']()[_0x8dc0('0x23')](respondWithResult(_0x1a9fa0,null))[_0x8dc0('0x3f')](handleError(_0x1a9fa0,null));}; \ No newline at end of file +var _0x539b=['fast-json-patch','request-promise','moment','bluebird','util','path','sox','fs-extra','lodash','squel','crypto','jsforce','desk.js','to-csv','querystring','papaparse','ioredis','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/utils','../../config/environment','../../config/license/util','sendStatus','status','end','json','offset','limit','undefined','count','set','apply','reject','then','destroy','stack','name','send','map','fieldName','type','key','model','query','keys','filters','intersection','attributes','fields','length','hasOwnProperty','sort','where','pick','filter','merge','VIRTUAL','options','VoiceTransferReport','include','findAll','show','params','includeAll','find','catch','create','update','body','describe','eml-format','rimraf','zip-dir'];(function(_0xabd650,_0xff656d){var _0x456032=function(_0x7dc3e8){while(--_0x7dc3e8){_0xabd650['push'](_0xabd650['shift']());}};_0x456032(++_0xff656d);}(_0x539b,0x121));var _0xb539=function(_0x48f628,_0x27c637){_0x48f628=_0x48f628-0x0;var _0x55c309=_0x539b[_0x48f628];return _0x55c309;};'use strict';var emlformat=require(_0xb539('0x0'));var rimraf=require(_0xb539('0x1'));var zipdir=require(_0xb539('0x2'));var jsonpatch=require(_0xb539('0x3'));var rp=require(_0xb539('0x4'));var moment=require(_0xb539('0x5'));var BPromise=require(_0xb539('0x6'));var Mustache=require('mustache');var util=require(_0xb539('0x7'));var path=require(_0xb539('0x8'));var sox=require(_0xb539('0x9'));var csv=require('to-csv');var ejs=require('ejs');var fs=require('fs');var fs_extra=require(_0xb539('0xa'));var _=require(_0xb539('0xb'));var squel=require(_0xb539('0xc'));var crypto=require(_0xb539('0xd'));var jsforce=require(_0xb539('0xe'));var deskjs=require(_0xb539('0xf'));var toCsv=require(_0xb539('0x10'));var querystring=require(_0xb539('0x11'));var Papa=require(_0xb539('0x12'));var Redis=require(_0xb539('0x13'));var authService=require('../../components/auth/service');var qs=require('../../components/parsers/qs');var as=require(_0xb539('0x14'));var hardwareService=require(_0xb539('0x15'));var logger=require('../../config/logger')('api');var utils=require(_0xb539('0x16'));var config=require(_0xb539('0x17'));var licenseUtil=require(_0xb539('0x18'));var db=require('../../mysqldb')['db'];function respondWithStatusCode(_0x2fb563,_0x32a4dd){_0x32a4dd=_0x32a4dd||0xcc;return function(_0x60a524){if(_0x60a524){return _0x2fb563[_0xb539('0x19')](_0x32a4dd);}return _0x2fb563[_0xb539('0x1a')](_0x32a4dd)[_0xb539('0x1b')]();};}function respondWithResult(_0x18adb2,_0x48b7a0){_0x48b7a0=_0x48b7a0||0xc8;return function(_0xdff6e2){if(_0xdff6e2){return _0x18adb2[_0xb539('0x1a')](_0x48b7a0)[_0xb539('0x1c')](_0xdff6e2);}};}function respondWithFilteredResult(_0x355ed8,_0x4f63b5){return function(_0x21c7d3){if(_0x21c7d3){var _0x33f1cc=typeof _0x4f63b5[_0xb539('0x1d')]==='undefined'&&typeof _0x4f63b5[_0xb539('0x1e')]===_0xb539('0x1f');var _0x397afa=_0x21c7d3['count'];var _0x1c0656=_0x33f1cc?0x0:_0x4f63b5[_0xb539('0x1d')];var _0x611e70=_0x33f1cc?_0x21c7d3[_0xb539('0x20')]:_0x4f63b5['offset']+_0x4f63b5[_0xb539('0x1e')];var _0x186237;if(_0x611e70>=_0x397afa){_0x611e70=_0x397afa;_0x186237=0xc8;}else{_0x186237=0xce;}_0x355ed8[_0xb539('0x1a')](_0x186237);return _0x355ed8[_0xb539('0x21')]('Content-Range',_0x1c0656+'-'+_0x611e70+'/'+_0x397afa)['json'](_0x21c7d3);}return null;};}function patchUpdates(_0x1cb936){return function(_0x576d35){try{jsonpatch[_0xb539('0x22')](_0x576d35,_0x1cb936,!![]);}catch(_0x457eb7){return BPromise[_0xb539('0x23')](_0x457eb7);}return _0x576d35['save']();};}function saveUpdates(_0x1a40be,_0x2ad689){return function(_0xc30cbb){if(_0xc30cbb){return _0xc30cbb['update'](_0x1a40be)[_0xb539('0x24')](function(_0x5357c6){return _0x5357c6;});}return null;};}function removeEntity(_0x4d85dd,_0x53d7d2){return function(_0x178d65){if(_0x178d65){return _0x178d65[_0xb539('0x25')]()[_0xb539('0x24')](function(){_0x4d85dd[_0xb539('0x1a')](0xcc)[_0xb539('0x1b')]();});}};}function handleEntityNotFound(_0x23e94e,_0x4cc009){return function(_0x385f69){if(!_0x385f69){_0x23e94e[_0xb539('0x19')](0x194);}return _0x385f69;};}function handleError(_0x25aa10,_0x1eacde){_0x1eacde=_0x1eacde||0x1f4;return function(_0x5d8caf){logger['error'](_0x5d8caf[_0xb539('0x26')]);if(_0x5d8caf[_0xb539('0x27')]){delete _0x5d8caf[_0xb539('0x27')];}_0x25aa10[_0xb539('0x1a')](_0x1eacde)[_0xb539('0x28')](_0x5d8caf);};}exports['index']=function(_0x97c403,_0x100901){var _0x452753={},_0x4204be={},_0x183e96={'count':0x0,'rows':[]};var _0x5d5ad4=_[_0xb539('0x29')](db['VoiceTransferReport']['rawAttributes'],function(_0x41cbc3){return{'name':_0x41cbc3[_0xb539('0x2a')],'type':_0x41cbc3[_0xb539('0x2b')][_0xb539('0x2c')]};});_0x4204be[_0xb539('0x2d')]=_['map'](_0x5d5ad4,_0xb539('0x27'));_0x4204be[_0xb539('0x2e')]=_[_0xb539('0x2f')](_0x97c403[_0xb539('0x2e')]);_0x4204be[_0xb539('0x30')]=_[_0xb539('0x31')](_0x4204be[_0xb539('0x2d')],_0x4204be['query']);_0x452753[_0xb539('0x32')]=_[_0xb539('0x31')](_0x4204be[_0xb539('0x2d')],qs[_0xb539('0x33')](_0x97c403[_0xb539('0x2e')][_0xb539('0x33')]));_0x452753[_0xb539('0x32')]=_0x452753[_0xb539('0x32')][_0xb539('0x34')]?_0x452753[_0xb539('0x32')]:_0x4204be['model'];if(!_0x97c403[_0xb539('0x2e')][_0xb539('0x35')]('nolimit')){_0x452753[_0xb539('0x1e')]=qs[_0xb539('0x1e')](_0x97c403[_0xb539('0x2e')]['limit']);_0x452753[_0xb539('0x1d')]=qs[_0xb539('0x1d')](_0x97c403[_0xb539('0x2e')][_0xb539('0x1d')]);}_0x452753['order']=qs[_0xb539('0x36')](_0x97c403[_0xb539('0x2e')][_0xb539('0x36')]);_0x452753[_0xb539('0x37')]=qs[_0xb539('0x30')](_[_0xb539('0x38')](_0x97c403[_0xb539('0x2e')],_0x4204be[_0xb539('0x30')]),_0x5d5ad4);if(_0x97c403[_0xb539('0x2e')][_0xb539('0x39')]){_0x452753[_0xb539('0x37')]=_[_0xb539('0x3a')](_0x452753[_0xb539('0x37')],{'$or':_[_0xb539('0x29')](_0x5d5ad4,function(_0x5b01c7){if(_0x5b01c7[_0xb539('0x2b')]!==_0xb539('0x3b')){var _0x284556={};_0x284556[_0x5b01c7[_0xb539('0x27')]]={'$like':'%'+_0x97c403['query']['filter']+'%'};return _0x284556;}})});}_0x452753=_[_0xb539('0x3a')]({},_0x452753,_0x97c403[_0xb539('0x3c')]);var _0x18f466={'where':_0x452753[_0xb539('0x37')]};return db[_0xb539('0x3d')][_0xb539('0x20')](_0x18f466)[_0xb539('0x24')](function(_0x2c0c91){_0x183e96[_0xb539('0x20')]=_0x2c0c91;if(_0x97c403['query']['includeAll']){_0x452753[_0xb539('0x3e')]=[{'all':!![]}];}return db['VoiceTransferReport'][_0xb539('0x3f')](_0x452753);})['then'](function(_0x48ced0){_0x183e96['rows']=_0x48ced0;return _0x183e96;})['then'](respondWithFilteredResult(_0x100901,_0x452753))['catch'](handleError(_0x100901,null));};exports[_0xb539('0x40')]=function(_0x36b0b5,_0x115bf6){var _0x1e5fb8={'raw':!![],'where':{'id':_0x36b0b5[_0xb539('0x41')]['id']}},_0x5bfc3d={};_0x5bfc3d[_0xb539('0x2d')]=_[_0xb539('0x2f')](db['VoiceTransferReport']['rawAttributes']);_0x5bfc3d[_0xb539('0x2e')]=_[_0xb539('0x2f')](_0x36b0b5[_0xb539('0x2e')]);_0x5bfc3d[_0xb539('0x30')]=_[_0xb539('0x31')](_0x5bfc3d[_0xb539('0x2d')],_0x5bfc3d[_0xb539('0x2e')]);_0x1e5fb8[_0xb539('0x32')]=_[_0xb539('0x31')](_0x5bfc3d[_0xb539('0x2d')],qs[_0xb539('0x33')](_0x36b0b5[_0xb539('0x2e')][_0xb539('0x33')]));_0x1e5fb8['attributes']=_0x1e5fb8[_0xb539('0x32')][_0xb539('0x34')]?_0x1e5fb8[_0xb539('0x32')]:_0x5bfc3d[_0xb539('0x2d')];if(_0x36b0b5[_0xb539('0x2e')][_0xb539('0x42')]){_0x1e5fb8[_0xb539('0x3e')]=[{'all':!![]}];}_0x1e5fb8=_[_0xb539('0x3a')]({},_0x1e5fb8,_0x36b0b5[_0xb539('0x3c')]);return db[_0xb539('0x3d')][_0xb539('0x43')](_0x1e5fb8)[_0xb539('0x24')](handleEntityNotFound(_0x115bf6,null))[_0xb539('0x24')](respondWithResult(_0x115bf6,null))[_0xb539('0x44')](handleError(_0x115bf6,null));};exports[_0xb539('0x45')]=function(_0x11ed1e,_0x529e0b){return db[_0xb539('0x3d')][_0xb539('0x45')](_0x11ed1e['body'],{})[_0xb539('0x24')](respondWithResult(_0x529e0b,0xc9))[_0xb539('0x44')](handleError(_0x529e0b,null));};exports[_0xb539('0x46')]=function(_0x58a95f,_0x5aaa27){if(_0x58a95f['body']['id']){delete _0x58a95f[_0xb539('0x47')]['id'];}return db[_0xb539('0x3d')][_0xb539('0x43')]({'where':{'id':_0x58a95f[_0xb539('0x41')]['id']}})[_0xb539('0x24')](handleEntityNotFound(_0x5aaa27,null))[_0xb539('0x24')](saveUpdates(_0x58a95f[_0xb539('0x47')],null))[_0xb539('0x24')](respondWithResult(_0x5aaa27,null))['catch'](handleError(_0x5aaa27,null));};exports[_0xb539('0x25')]=function(_0x38f573,_0x40df26){return db[_0xb539('0x3d')][_0xb539('0x43')]({'where':{'id':_0x38f573['params']['id']}})[_0xb539('0x24')](handleEntityNotFound(_0x40df26,null))[_0xb539('0x24')](removeEntity(_0x40df26,null))[_0xb539('0x44')](handleError(_0x40df26,null));};exports[_0xb539('0x48')]=function(_0x41602b,_0x507baa){return db[_0xb539('0x3d')]['describe']()[_0xb539('0x24')](respondWithResult(_0x507baa,null))[_0xb539('0x44')](handleError(_0x507baa,null));}; \ No newline at end of file diff --git a/server/api/voiceTransferReport/voiceTransferReport.model.js b/server/api/voiceTransferReport/voiceTransferReport.model.js index 4a0aafd..8a9329e 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 _0xdcf6=['VoiceTransferReport','report_call_transfer','lodash','util','../../config/logger','api','moment','request-promise','path','rimraf','../../config/environment','exports','define'];(function(_0x284807,_0x4be925){var _0x50c774=function(_0xf56cf7){while(--_0xf56cf7){_0x284807['push'](_0x284807['shift']());}};_0x50c774(++_0x4be925);}(_0xdcf6,0xc5));var _0x6dcf=function(_0x43a1b8,_0x1c90c8){_0x43a1b8=_0x43a1b8-0x0;var _0x324ecc=_0xdcf6[_0x43a1b8];return _0x324ecc;};'use strict';var _=require(_0x6dcf('0x0'));var util=require(_0x6dcf('0x1'));var logger=require(_0x6dcf('0x2'))(_0x6dcf('0x3'));var moment=require(_0x6dcf('0x4'));var BPromise=require('bluebird');var rp=require(_0x6dcf('0x5'));var fs=require('fs');var path=require(_0x6dcf('0x6'));var rimraf=require(_0x6dcf('0x7'));var config=require(_0x6dcf('0x8'));var attributes=require('./voiceTransferReport.attributes');module[_0x6dcf('0x9')]=function(_0x2890e1,_0x6bcd81){return _0x2890e1[_0x6dcf('0xa')](_0x6dcf('0xb'),attributes,{'tableName':_0x6dcf('0xc'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x98e7=['rimraf','../../config/environment','exports','define','VoiceTransferReport','report_call_transfer','lodash','../../config/logger','moment','bluebird','path'];(function(_0x55c141,_0x4a08d8){var _0x404e21=function(_0x3a4748){while(--_0x3a4748){_0x55c141['push'](_0x55c141['shift']());}};_0x404e21(++_0x4a08d8);}(_0x98e7,0x10e));var _0x798e=function(_0x3fadd1,_0x289fee){_0x3fadd1=_0x3fadd1-0x0;var _0x22cb57=_0x98e7[_0x3fadd1];return _0x22cb57;};'use strict';var _=require(_0x798e('0x0'));var util=require('util');var logger=require(_0x798e('0x1'))('api');var moment=require(_0x798e('0x2'));var BPromise=require(_0x798e('0x3'));var rp=require('request-promise');var fs=require('fs');var path=require(_0x798e('0x4'));var rimraf=require(_0x798e('0x5'));var config=require(_0x798e('0x6'));var attributes=require('./voiceTransferReport.attributes');module[_0x798e('0x7')]=function(_0x292da8,_0x34ef02){return _0x292da8[_0x798e('0x8')](_0x798e('0x9'),attributes,{'tableName':_0x798e('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 94ca9bf..2e037d6 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 _0x2f43=['error','code','message','request\x20sent','result','VoiceTransferReport','create','body','raw','then','CreateVoiceTransferReport','catch','lodash','util','bluebird','randomstring','ioredis','../../mysqldb','../../config/logger','rpc','../../config/environment','jayson/promise','client','http','request','info','VoiceTransferReport,\x20%s,\x20%s','debug','VoiceTransferReport,\x20%s,\x20%s,\x20%s','stringify'];(function(_0x2b0a86,_0x2ecebd){var _0x955940=function(_0x1988f8){while(--_0x1988f8){_0x2b0a86['push'](_0x2b0a86['shift']());}};_0x955940(++_0x2ecebd);}(_0x2f43,0xfc));var _0x32f4=function(_0x4ba20e,_0x5d7255){_0x4ba20e=_0x4ba20e-0x0;var _0x1cda38=_0x2f43[_0x4ba20e];return _0x1cda38;};'use strict';var _=require(_0x32f4('0x0'));var util=require(_0x32f4('0x1'));var moment=require('moment');var BPromise=require(_0x32f4('0x2'));var rs=require(_0x32f4('0x3'));var fs=require('fs');var Redis=require(_0x32f4('0x4'));var db=require(_0x32f4('0x5'))['db'];var utils=require('../../config/utils');var logger=require(_0x32f4('0x6'))(_0x32f4('0x7'));var config=require(_0x32f4('0x8'));var jayson=require(_0x32f4('0x9'));var client=jayson[_0x32f4('0xa')][_0x32f4('0xb')]({'port':0x232a});function respondWithRpcPromise(_0x539f88,_0x5d235a,_0xe1a13){return new BPromise(function(_0x435c7c,_0x5a2007){return client[_0x32f4('0xc')](_0x539f88,_0xe1a13)['then'](function(_0x510894){logger[_0x32f4('0xd')](_0x32f4('0xe'),_0x5d235a,'request\x20sent');logger[_0x32f4('0xf')](_0x32f4('0x10'),_0x5d235a,'request\x20sent',JSON[_0x32f4('0x11')](_0x510894));if(_0x510894[_0x32f4('0x12')]){if(_0x510894[_0x32f4('0x12')][_0x32f4('0x13')]===0x1f4){logger[_0x32f4('0x12')]('VoiceTransferReport,\x20%s,\x20%s',_0x5d235a,_0x510894[_0x32f4('0x12')][_0x32f4('0x14')]);return _0x5a2007(_0x510894[_0x32f4('0x12')][_0x32f4('0x14')]);}logger[_0x32f4('0x12')](_0x32f4('0xe'),_0x5d235a,_0x510894[_0x32f4('0x12')]['message']);return _0x435c7c(_0x510894[_0x32f4('0x12')][_0x32f4('0x14')]);}else{logger[_0x32f4('0xd')]('VoiceTransferReport,\x20%s,\x20%s',_0x5d235a,_0x32f4('0x15'));_0x435c7c(_0x510894[_0x32f4('0x16')][_0x32f4('0x14')]);}})['catch'](function(_0x4375c1){logger[_0x32f4('0x12')]('VoiceTransferReport,\x20%s,\x20%s',_0x5d235a,_0x4375c1);_0x5a2007(_0x4375c1);});});}exports['CreateVoiceTransferReport']=function(_0x46d135){var _0x240b55=this;return new Promise(function(_0x19322,_0x44c2a9){return db[_0x32f4('0x17')][_0x32f4('0x18')](_0x46d135[_0x32f4('0x19')],{'raw':_0x46d135['options']?_0x46d135['options'][_0x32f4('0x1a')]===undefined?!![]:![]:!![]})[_0x32f4('0x1b')](function(_0x88d094){logger['info'](_0x32f4('0x1c'),_0x46d135);logger[_0x32f4('0xf')](_0x32f4('0x1c'),_0x46d135,JSON[_0x32f4('0x11')](_0x88d094));_0x19322(_0x88d094);})[_0x32f4('0x1d')](function(_0x4a8620){logger[_0x32f4('0x12')](_0x32f4('0x1c'),_0x4a8620[_0x32f4('0x14')],_0x46d135);_0x44c2a9(_0x240b55['error'](0x1f4,_0x4a8620[_0x32f4('0x14')]));});});}; \ No newline at end of file +var _0xc9f0=['body','options','raw','debug','lodash','util','moment','randomstring','../../config/utils','../../config/logger','../../config/environment','jayson/promise','client','http','then','info','VoiceTransferReport,\x20%s,\x20%s','request\x20sent','stringify','error','message','result','CreateVoiceTransferReport','VoiceTransferReport','create'];(function(_0x17b383,_0x522725){var _0x337922=function(_0x2f4480){while(--_0x2f4480){_0x17b383['push'](_0x17b383['shift']());}};_0x337922(++_0x522725);}(_0xc9f0,0x1ad));var _0x0c9f=function(_0x184a15,_0x2e1297){_0x184a15=_0x184a15-0x0;var _0x56f793=_0xc9f0[_0x184a15];return _0x56f793;};'use strict';var _=require(_0x0c9f('0x0'));var util=require(_0x0c9f('0x1'));var moment=require(_0x0c9f('0x2'));var BPromise=require('bluebird');var rs=require(_0x0c9f('0x3'));var fs=require('fs');var Redis=require('ioredis');var db=require('../../mysqldb')['db'];var utils=require(_0x0c9f('0x4'));var logger=require(_0x0c9f('0x5'))('rpc');var config=require(_0x0c9f('0x6'));var jayson=require(_0x0c9f('0x7'));var client=jayson[_0x0c9f('0x8')][_0x0c9f('0x9')]({'port':0x232a});function respondWithRpcPromise(_0xc26a7b,_0x772de6,_0x368cfe){return new BPromise(function(_0x3808cb,_0x3b0751){return client['request'](_0xc26a7b,_0x368cfe)[_0x0c9f('0xa')](function(_0x30aff5){logger[_0x0c9f('0xb')](_0x0c9f('0xc'),_0x772de6,_0x0c9f('0xd'));logger['debug']('VoiceTransferReport,\x20%s,\x20%s,\x20%s',_0x772de6,_0x0c9f('0xd'),JSON[_0x0c9f('0xe')](_0x30aff5));if(_0x30aff5[_0x0c9f('0xf')]){if(_0x30aff5[_0x0c9f('0xf')]['code']===0x1f4){logger['error'](_0x0c9f('0xc'),_0x772de6,_0x30aff5['error'][_0x0c9f('0x10')]);return _0x3b0751(_0x30aff5[_0x0c9f('0xf')]['message']);}logger['error'](_0x0c9f('0xc'),_0x772de6,_0x30aff5[_0x0c9f('0xf')][_0x0c9f('0x10')]);return _0x3808cb(_0x30aff5[_0x0c9f('0xf')][_0x0c9f('0x10')]);}else{logger[_0x0c9f('0xb')](_0x0c9f('0xc'),_0x772de6,_0x0c9f('0xd'));_0x3808cb(_0x30aff5[_0x0c9f('0x11')][_0x0c9f('0x10')]);}})['catch'](function(_0x521776){logger[_0x0c9f('0xf')](_0x0c9f('0xc'),_0x772de6,_0x521776);_0x3b0751(_0x521776);});});}exports[_0x0c9f('0x12')]=function(_0x4088c0){var _0x38551e=this;return new Promise(function(_0x4d04d7,_0x4e657e){return db[_0x0c9f('0x13')][_0x0c9f('0x14')](_0x4088c0[_0x0c9f('0x15')],{'raw':_0x4088c0[_0x0c9f('0x16')]?_0x4088c0['options'][_0x0c9f('0x17')]===undefined?!![]:![]:!![]})['then'](function(_0x44d6aa){logger[_0x0c9f('0xb')]('CreateVoiceTransferReport',_0x4088c0);logger[_0x0c9f('0x18')](_0x0c9f('0x12'),_0x4088c0,JSON[_0x0c9f('0xe')](_0x44d6aa));_0x4d04d7(_0x44d6aa);})['catch'](function(_0x4be262){logger['error'](_0x0c9f('0x12'),_0x4be262[_0x0c9f('0x10')],_0x4088c0);_0x4e657e(_0x38551e[_0x0c9f('0xf')](0x1f4,_0x4be262[_0x0c9f('0x10')]));});});}; \ No newline at end of file diff --git a/server/api/webbar/index.js b/server/api/webbar/index.js index fcb4b36..c7d963a 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 _0xbec5=['exports','express','Router','./webbar.controller','post','/originate','isAuthenticated','isWebrtcLicence','/hangup','hangup','/answer','answer','/hold','/unhold','unhold','/calls','calls','/transfer','transfer'];(function(_0x511451,_0x206997){var _0xf39d57=function(_0x146de7){while(--_0x146de7){_0x511451['push'](_0x511451['shift']());}};_0xf39d57(++_0x206997);}(_0xbec5,0xe5));var _0x5bec=function(_0xf73c09,_0x4e424e){_0xf73c09=_0xf73c09-0x0;var _0xa8923c=_0xbec5[_0xf73c09];return _0xa8923c;};'use strict';var express=require(_0x5bec('0x0'));var router=express[_0x5bec('0x1')]();var auth=require('../../components/auth/service');var controller=require(_0x5bec('0x2'));router[_0x5bec('0x3')](_0x5bec('0x4'),auth[_0x5bec('0x5')](),auth[_0x5bec('0x6')](),controller['originate']);router[_0x5bec('0x3')](_0x5bec('0x7'),auth[_0x5bec('0x5')](),auth['isWebrtcLicence'](),controller[_0x5bec('0x8')]);router[_0x5bec('0x3')](_0x5bec('0x9'),auth[_0x5bec('0x5')](),auth[_0x5bec('0x6')](),controller[_0x5bec('0xa')]);router[_0x5bec('0x3')](_0x5bec('0xb'),auth['isAuthenticated'](),auth[_0x5bec('0x6')](),controller['hold']);router[_0x5bec('0x3')](_0x5bec('0xc'),auth[_0x5bec('0x5')](),auth['isWebrtcLicence'](),controller[_0x5bec('0xd')]);router[_0x5bec('0x3')](_0x5bec('0xe'),auth['isAuthenticated'](),auth[_0x5bec('0x6')](),controller[_0x5bec('0xf')]);router['post'](_0x5bec('0x10'),auth[_0x5bec('0x5')](),auth[_0x5bec('0x6')](),controller[_0x5bec('0x11')]);module[_0x5bec('0x12')]=router; \ No newline at end of file +var _0xe706=['/transfer','express','Router','../../components/auth/service','post','/originate','isAuthenticated','isWebrtcLicence','originate','/hangup','hangup','/answer','answer','/hold','hold','/unhold','/calls','calls'];(function(_0x47d4bc,_0x5ae490){var _0x5b6cad=function(_0x2ad822){while(--_0x2ad822){_0x47d4bc['push'](_0x47d4bc['shift']());}};_0x5b6cad(++_0x5ae490);}(_0xe706,0xa3));var _0x6e70=function(_0xa9eaa0,_0x4ba2b4){_0xa9eaa0=_0xa9eaa0-0x0;var _0x30897a=_0xe706[_0xa9eaa0];return _0x30897a;};'use strict';var express=require(_0x6e70('0x0'));var router=express[_0x6e70('0x1')]();var auth=require(_0x6e70('0x2'));var controller=require('./webbar.controller');router[_0x6e70('0x3')](_0x6e70('0x4'),auth[_0x6e70('0x5')](),auth[_0x6e70('0x6')](),controller[_0x6e70('0x7')]);router[_0x6e70('0x3')](_0x6e70('0x8'),auth[_0x6e70('0x5')](),auth[_0x6e70('0x6')](),controller[_0x6e70('0x9')]);router[_0x6e70('0x3')](_0x6e70('0xa'),auth[_0x6e70('0x5')](),auth[_0x6e70('0x6')](),controller[_0x6e70('0xb')]);router[_0x6e70('0x3')](_0x6e70('0xc'),auth[_0x6e70('0x5')](),auth[_0x6e70('0x6')](),controller[_0x6e70('0xd')]);router[_0x6e70('0x3')](_0x6e70('0xe'),auth[_0x6e70('0x5')](),auth[_0x6e70('0x6')](),controller['unhold']);router['post'](_0x6e70('0xf'),auth[_0x6e70('0x5')](),auth[_0x6e70('0x6')](),controller[_0x6e70('0x10')]);router[_0x6e70('0x3')](_0x6e70('0x11'),auth[_0x6e70('0x5')](),auth[_0x6e70('0x6')](),controller['transfer']);module['exports']=router; \ No newline at end of file diff --git a/server/api/webbar/webbar.controller.js b/server/api/webbar/webbar.controller.js index 1fbb43f..5452e76 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 _0x7f6d=['webbar:originate','originate\x20executed!','catch','hangup','hangup\x20fired:','entityFound:','format','hangup\x20executed!','answer\x20fired:','webbar:answer','webbar:hold','hold\x20executed!','unhold','unhold\x20fired:','webbar:unhold','calls','calls\x20fired:','conference','conference\x20fired:','webbar:conference','conference\x20executed!','transfer\x20fired:','transferNumber','webbar:transfer','transfer\x20executed!','path','lodash','../../config/environment','util','bluebird','jayson/promise','client','http','webbarapi','ioredis','redis','defaults','localhost','validate','number','userId\x20is\x20required','string','callNumber\x20is\x20required','sessionId\x20is\x20required','transferNumber\x20is\x20required','info','stringify','emit','log','handleError:','error','stack','name','status','send','NotFound','then','code','message','User','findOne','agent','all','filter','rows','UserId','sessionId','length','originate','originate\x20fired:','body','json','userId','callNumber','callerId','callbackUrl','user:%s'];(function(_0xb045d2,_0x258206){var _0x577872=function(_0x47317c){while(--_0x47317c){_0xb045d2['push'](_0xb045d2['shift']());}};_0x577872(++_0x258206);}(_0x7f6d,0x100));var _0xd7f6=function(_0x1caf6a,_0x26a5bf){_0x1caf6a=_0x1caf6a-0x0;var _0x1bf493=_0x7f6d[_0x1caf6a];return _0x1bf493;};'use strict';var path=require(_0xd7f6('0x0'));var fs=require('fs');var _=require(_0xd7f6('0x1'));var db=require('../../mysqldb')['db'];var config=require(_0xd7f6('0x2'));var util=require(_0xd7f6('0x3'));var BPromise=require(_0xd7f6('0x4'));var jayson=require(_0xd7f6('0x5'));var amiClient=jayson[_0xd7f6('0x6')][_0xd7f6('0x7')]({'port':0x232a});var logger=require('../../config/logger')(_0xd7f6('0x8'));var Redis=require(_0xd7f6('0x9'));config[_0xd7f6('0xa')]=_[_0xd7f6('0xb')](config[_0xd7f6('0xa')],{'host':_0xd7f6('0xc'),'port':0x18eb});var io=require('socket.io-emitter')(new Redis(config[_0xd7f6('0xa')]));var Schema=require(_0xd7f6('0xd'));var originateValidation=new Schema({'userId':{'type':_0xd7f6('0xe'),'required':[!![],_0xd7f6('0xf')]},'callNumber':{'type':_0xd7f6('0x10'),'required':[!![],_0xd7f6('0x11')]},'callerId':{'type':_0xd7f6('0x10')},'callbackUrl':{'type':'string'}});var hangupValidation=new Schema({'userId':{'type':'number','required':[!![],_0xd7f6('0xf')]},'sessionId':{'type':_0xd7f6('0x10'),'required':![]}});var answerValidation=new Schema({'userId':{'type':_0xd7f6('0xe'),'required':[!![],'userId\x20is\x20required']},'sessionId':{'type':_0xd7f6('0x10'),'required':![]}});var transferValidation=new Schema({'userId':{'type':_0xd7f6('0xe'),'required':[!![],_0xd7f6('0xf')]},'sessionId':{'type':'string','required':[!![],_0xd7f6('0x12')]},'transferNumber':{'type':_0xd7f6('0x10'),'required':[!![],_0xd7f6('0x13')]}});var holdValidation=new Schema({'userId':{'type':'number','required':[!![],'userId\x20is\x20required']},'sessionId':{'type':_0xd7f6('0x10'),'required':![]}});var unholdValidation=new Schema({'userId':{'type':_0xd7f6('0xe'),'required':[!![],_0xd7f6('0xf')]},'sessionId':{'type':_0xd7f6('0x10'),'required':![]}});var callsValidation=new Schema({'userId':{'type':_0xd7f6('0xe'),'required':[!![],_0xd7f6('0xf')]}});var conferenceValidation=new Schema({'userId':{'type':_0xd7f6('0xe'),'required':[!![],_0xd7f6('0xf')]}});function emit(_0x4a8fc0,_0x4a1a15,_0x2fc002){logger[_0xd7f6('0x14')](_0x4a8fc0,_0x4a1a15,JSON[_0xd7f6('0x15')](_0x2fc002));io['to'](_0x4a8fc0)[_0xd7f6('0x16')](_0x4a1a15,_0x2fc002);}function handleError(_0x36d04a){return function(_0x1370d6){console[_0xd7f6('0x17')](_0xd7f6('0x18'),_0x1370d6,_0x1370d6 instanceof RangeError);logger[_0xd7f6('0x19')](_0x1370d6[_0xd7f6('0x1a')]);if(_0x1370d6 instanceof RangeError){if(_0x1370d6[_0xd7f6('0x1b')]){delete _0x1370d6[_0xd7f6('0x1b')];}_0x36d04a[_0xd7f6('0x1c')](0x194)[_0xd7f6('0x1d')](_0x1370d6);}else{if(_0x1370d6[_0xd7f6('0x1b')]){delete _0x1370d6[_0xd7f6('0x1b')];}_0x36d04a[_0xd7f6('0x1c')](0x1f4)['send'](_0x1370d6);}};}function checkError(){return function(_0x1237d0){if(!_0x1237d0){throw new RangeError(_0xd7f6('0x1e'));}return _0x1237d0;};}function respondWithRpcPromise(_0x59e34c,_0x488707){return new BPromise(function(_0x548632,_0x1c8322){var _0x842674=amiClient;return _0x842674['request'](_0x59e34c,_0x488707)[_0xd7f6('0x1f')](function(_0x426cc6){if(_0x426cc6['error']){if(_0x426cc6[_0xd7f6('0x19')][_0xd7f6('0x20')]===0x1f4){return _0x1c8322(_0x426cc6['error'][_0xd7f6('0x21')]);}return _0x548632(_0x426cc6[_0xd7f6('0x19')][_0xd7f6('0x21')]);}else{_0x548632(_0x426cc6['result']);}})['catch'](function(_0x41172d){_0x1c8322(_0x41172d);});});}function getAgent(_0x5ebcb0){return db[_0xd7f6('0x22')][_0xd7f6('0x23')]({'where':{'id':_0x5ebcb0,'role':_0xd7f6('0x24')}})[_0xd7f6('0x1f')](checkError());}function getAgentCheckSession(_0x4c7d8c,_0x278217){return new BPromise(function(_0x173258,_0x1f567d){var _0x417064=respondWithRpcPromise('VoiceChannels');var _0x117132=getAgent(_0x4c7d8c);Promise[_0xd7f6('0x25')]([_0x417064,_0x117132])['then'](function(_0x4f8638){var _0x4bb69f=_0x4f8638[0x0];var _0x23254a=_0x4f8638[0x1];var _0x1c7d76=_[_0xd7f6('0x26')](_0x4bb69f[_0xd7f6('0x27')],function(_0x4f2a58){return _0x4f2a58[_0xd7f6('0x28')]==_0x23254a['id']&&_0x4f2a58[_0xd7f6('0x29')]==_0x278217;});if(_0x1c7d76[_0xd7f6('0x2a')]==0x1){_0x173258(_0x23254a);}else{_0x1f567d(new RangeError('sessionId\x20'+_0x278217+'\x20not\x20found!'));}});});}exports[_0xd7f6('0x2b')]=function(_0x5e9b4f,_0x3ead72){logger[_0xd7f6('0x14')](_0xd7f6('0x2c'),_0x5e9b4f[_0xd7f6('0x2d')]);var _0x19b977=originateValidation[_0xd7f6('0xd')](_0x5e9b4f['body']);if(_0x19b977['length']>0x0){return _0x3ead72['status'](0x190)[_0xd7f6('0x2e')](_0x19b977);}var _0x58f9c3=_0x5e9b4f['body'][_0xd7f6('0x2f')];var _0x44159d=_0x5e9b4f[_0xd7f6('0x2d')][_0xd7f6('0x30')];var _0x34f1cf=_0x5e9b4f['body'][_0xd7f6('0x31')];var _0x16b8a3=_0x5e9b4f['body'][_0xd7f6('0x32')];return getAgent(_0x58f9c3)[_0xd7f6('0x1f')](function(_0x489afc){logger[_0xd7f6('0x14')]('entityFound:',_0x489afc[_0xd7f6('0x1b')]);emit(util['format'](_0xd7f6('0x33'),_0x489afc[_0xd7f6('0x1b')]),_0xd7f6('0x34'),{'callNumber':_0x44159d,'callerId':_0x34f1cf,'callbackUrl':_0x16b8a3});return _0x3ead72[_0xd7f6('0x1c')](0xc8)[_0xd7f6('0x2e')]({'error':![],'message':_0xd7f6('0x35')});})[_0xd7f6('0x36')](handleError(_0x3ead72));};exports[_0xd7f6('0x37')]=function(_0x3479df,_0x491f32){logger[_0xd7f6('0x14')](_0xd7f6('0x38'),_0x3479df[_0xd7f6('0x2d')]);var _0x4f5ca7=hangupValidation[_0xd7f6('0xd')](_0x3479df['body']);if(_0x4f5ca7[_0xd7f6('0x2a')]>0x0){return _0x491f32['status'](0x190)[_0xd7f6('0x2e')](_0x4f5ca7);}var _0x435ba4=_0x3479df[_0xd7f6('0x2d')][_0xd7f6('0x2f')];var _0xb84604=_0x3479df[_0xd7f6('0x2d')]['sessionId'];return getAgent(_0x435ba4)[_0xd7f6('0x1f')](function(_0x355214){logger[_0xd7f6('0x14')](_0xd7f6('0x39'),_0x355214[_0xd7f6('0x1b')]);emit(util[_0xd7f6('0x3a')](_0xd7f6('0x33'),_0x355214['name']),'webbar:hangup',{'sessionId':_0xb84604});return _0x491f32[_0xd7f6('0x1c')](0xc8)['json']({'error':![],'message':_0xd7f6('0x3b')});})[_0xd7f6('0x36')](handleError(_0x491f32));};exports['answer']=function(_0x56512b,_0x3d3f27){logger['info'](_0xd7f6('0x3c'),_0x56512b[_0xd7f6('0x2d')]);var _0xe49794=answerValidation[_0xd7f6('0xd')](_0x56512b[_0xd7f6('0x2d')]);if(_0xe49794['length']>0x0){return _0x3d3f27['status'](0x190)['json'](_0xe49794);}var _0xe52ce2=_0x56512b[_0xd7f6('0x2d')][_0xd7f6('0x2f')];var _0x48b131=_0x56512b[_0xd7f6('0x2d')][_0xd7f6('0x29')];return getAgent(_0xe52ce2)[_0xd7f6('0x1f')](function(_0x4eb976){logger['info'](_0xd7f6('0x39'),_0x4eb976[_0xd7f6('0x1b')]);emit(util[_0xd7f6('0x3a')](_0xd7f6('0x33'),_0x4eb976[_0xd7f6('0x1b')]),_0xd7f6('0x3d'),{'sessionId':_0x48b131});return _0x3d3f27[_0xd7f6('0x1c')](0xc8)['json']({'error':![],'message':'answer\x20executed!'});})[_0xd7f6('0x36')](handleError(_0x3d3f27));};exports['hold']=function(_0x5387b0,_0x3e298d){logger[_0xd7f6('0x14')]('hold\x20fired:',_0x5387b0[_0xd7f6('0x2d')]);var _0x19f8ff=holdValidation[_0xd7f6('0xd')](_0x5387b0[_0xd7f6('0x2d')]);if(_0x19f8ff[_0xd7f6('0x2a')]>0x0){return _0x3e298d['status'](0x190)['json'](_0x19f8ff);}var _0x31f2e8=_0x5387b0[_0xd7f6('0x2d')][_0xd7f6('0x2f')];var _0x3f14fa=_0x5387b0[_0xd7f6('0x2d')][_0xd7f6('0x29')];return getAgent(_0x31f2e8)[_0xd7f6('0x1f')](function(_0x49f5e3){logger[_0xd7f6('0x14')]('entityFound:',_0x49f5e3[_0xd7f6('0x1b')]);emit(util[_0xd7f6('0x3a')](_0xd7f6('0x33'),_0x49f5e3[_0xd7f6('0x1b')]),_0xd7f6('0x3e'),{'sessionId':_0x3f14fa});return _0x3e298d[_0xd7f6('0x1c')](0xc8)['json']({'error':![],'message':_0xd7f6('0x3f')});})[_0xd7f6('0x36')](handleError(_0x3e298d));};exports[_0xd7f6('0x40')]=function(_0x3014f0,_0x526f21){logger[_0xd7f6('0x14')](_0xd7f6('0x41'),_0x3014f0[_0xd7f6('0x2d')]);var _0x435ce3=unholdValidation[_0xd7f6('0xd')](_0x3014f0['body']);if(_0x435ce3['length']>0x0){return _0x526f21[_0xd7f6('0x1c')](0x190)[_0xd7f6('0x2e')](_0x435ce3);}var _0x51f9c4=_0x3014f0[_0xd7f6('0x2d')][_0xd7f6('0x2f')];var _0x5a52e8=_0x3014f0['body'][_0xd7f6('0x29')];return getAgent(_0x51f9c4)['then'](function(_0x1c57c5){logger[_0xd7f6('0x14')]('entityFound:',_0x1c57c5['name']);emit(util['format'](_0xd7f6('0x33'),_0x1c57c5[_0xd7f6('0x1b')]),_0xd7f6('0x42'),{'sessionId':_0x5a52e8});return _0x526f21[_0xd7f6('0x1c')](0xc8)['json']({'error':![],'message':'unhold\x20executed!'});})[_0xd7f6('0x36')](handleError(_0x526f21));};exports[_0xd7f6('0x43')]=function(_0x475a3d,_0x3b2adc){logger[_0xd7f6('0x14')](_0xd7f6('0x44'),_0x3b2adc['body']);var _0x4072c7=callsValidation[_0xd7f6('0xd')](_0x475a3d[_0xd7f6('0x2d')]);if(_0x4072c7[_0xd7f6('0x2a')]>0x0){return _0x3b2adc[_0xd7f6('0x1c')](0x190)[_0xd7f6('0x2e')](_0x4072c7);}var _0x5b4475=_0x475a3d['body'][_0xd7f6('0x2f')];var _0x284127=respondWithRpcPromise('VoiceChannels');var _0x3a97c4=getAgent(_0x5b4475);return Promise[_0xd7f6('0x25')]([_0x284127,_0x3a97c4])['then'](function(_0x3d38cb){var _0x48b6ae=_0x3d38cb[0x0];var _0xd3aeec=_0x3d38cb[0x1];var _0x2f4e6e=_[_0xd7f6('0x26')](_0x48b6ae[_0xd7f6('0x27')],function(_0x3cb3c6){return _0x3cb3c6[_0xd7f6('0x28')]==_0xd3aeec['id'];});return _0x3b2adc[_0xd7f6('0x1c')](0xc8)[_0xd7f6('0x2e')]({'count':_0x2f4e6e['length'],'rows':_0x2f4e6e});})[_0xd7f6('0x36')](handleError(_0x3b2adc));};exports[_0xd7f6('0x45')]=function(_0x3b50c1,_0xadf9b8){logger[_0xd7f6('0x14')](_0xd7f6('0x46'),_0x3b50c1[_0xd7f6('0x2d')]);var _0x2031ae=conferenceValidation['validate'](_0x3b50c1['body']);if(_0x2031ae[_0xd7f6('0x2a')]>0x0){return _0xadf9b8[_0xd7f6('0x1c')](0x190)[_0xd7f6('0x2e')](_0x2031ae);}var _0x18858d=_0x3b50c1[_0xd7f6('0x2d')]['userId'];return getAgent(_0x18858d)[_0xd7f6('0x1f')](function(_0x6f6c6c){logger[_0xd7f6('0x14')](_0xd7f6('0x39'),_0x6f6c6c[_0xd7f6('0x1b')]);emit(util[_0xd7f6('0x3a')](_0xd7f6('0x33'),_0x6f6c6c[_0xd7f6('0x1b')]),_0xd7f6('0x47'));return _0xadf9b8[_0xd7f6('0x1c')](0xc8)[_0xd7f6('0x2e')]({'error':![],'message':_0xd7f6('0x48')});})[_0xd7f6('0x36')](handleError(_0xadf9b8));};exports['transfer']=function(_0x543339,_0xb788c){logger['info'](_0xd7f6('0x49'),_0x543339['body']);var _0x3af33a=transferValidation[_0xd7f6('0xd')](_0x543339[_0xd7f6('0x2d')]);if(_0x3af33a[_0xd7f6('0x2a')]>0x0){return _0xb788c[_0xd7f6('0x1c')](0x190)[_0xd7f6('0x2e')](_0x3af33a);}var _0x3e8531=_0x543339[_0xd7f6('0x2d')][_0xd7f6('0x2f')];var _0x59111c=_0x543339[_0xd7f6('0x2d')]['sessionId'];var _0x4df660=_0x543339['body'][_0xd7f6('0x4a')];return getAgent(_0x3e8531)['then'](function(_0x2fb572){logger[_0xd7f6('0x14')](_0xd7f6('0x39'),_0x2fb572[_0xd7f6('0x1b')]);emit(util[_0xd7f6('0x3a')](_0xd7f6('0x33'),_0x2fb572[_0xd7f6('0x1b')]),_0xd7f6('0x4b'),{'sessionId':_0x59111c,'transferNumber':_0x4df660});return _0xb788c[_0xd7f6('0x1c')](0xc8)[_0xd7f6('0x2e')]({'error':![],'message':_0xd7f6('0x4c')});})[_0xd7f6('0x36')](handleError(_0xb788c));}; \ No newline at end of file +var _0xac0b=['filter','webbar:conference','conference\x20executed!','transfer\x20fired:','transferNumber','transfer\x20executed!','path','lodash','../../mysqldb','bluebird','client','http','../../config/logger','defaults','redis','localhost','socket.io-emitter','validate','number','userId\x20is\x20required','string','callNumber\x20is\x20required','sessionId\x20is\x20required','transferNumber\x20is\x20required','info','stringify','emit','error','stack','name','status','NotFound','request','then','message','result','catch','findOne','agent','VoiceChannels','all','rows','UserId','sessionId','length','\x20not\x20found!','originate','originate\x20fired:','body','json','userId','callerId','entityFound:','format','user:%s','originate\x20executed!','hangup','hangup\x20fired:','webbar:hangup','hangup\x20executed!','answer','answer\x20fired:','webbar:answer','answer\x20executed!','hold\x20fired:','webbar:hold','unhold','webbar:unhold','unhold\x20executed!','calls'];(function(_0x3103b9,_0x5df4de){var _0x40b18c=function(_0x35b94d){while(--_0x35b94d){_0x3103b9['push'](_0x3103b9['shift']());}};_0x40b18c(++_0x5df4de);}(_0xac0b,0x164));var _0xbac0=function(_0x4a9fb1,_0x273043){_0x4a9fb1=_0x4a9fb1-0x0;var _0x348672=_0xac0b[_0x4a9fb1];return _0x348672;};'use strict';var path=require(_0xbac0('0x0'));var fs=require('fs');var _=require(_0xbac0('0x1'));var db=require(_0xbac0('0x2'))['db'];var config=require('../../config/environment');var util=require('util');var BPromise=require(_0xbac0('0x3'));var jayson=require('jayson/promise');var amiClient=jayson[_0xbac0('0x4')][_0xbac0('0x5')]({'port':0x232a});var logger=require(_0xbac0('0x6'))('webbarapi');var Redis=require('ioredis');config['redis']=_[_0xbac0('0x7')](config[_0xbac0('0x8')],{'host':_0xbac0('0x9'),'port':0x18eb});var io=require(_0xbac0('0xa'))(new Redis(config[_0xbac0('0x8')]));var Schema=require(_0xbac0('0xb'));var originateValidation=new Schema({'userId':{'type':_0xbac0('0xc'),'required':[!![],_0xbac0('0xd')]},'callNumber':{'type':_0xbac0('0xe'),'required':[!![],_0xbac0('0xf')]},'callerId':{'type':_0xbac0('0xe')},'callbackUrl':{'type':'string'}});var hangupValidation=new Schema({'userId':{'type':_0xbac0('0xc'),'required':[!![],_0xbac0('0xd')]},'sessionId':{'type':_0xbac0('0xe'),'required':![]}});var answerValidation=new Schema({'userId':{'type':_0xbac0('0xc'),'required':[!![],_0xbac0('0xd')]},'sessionId':{'type':_0xbac0('0xe'),'required':![]}});var transferValidation=new Schema({'userId':{'type':_0xbac0('0xc'),'required':[!![],_0xbac0('0xd')]},'sessionId':{'type':_0xbac0('0xe'),'required':[!![],_0xbac0('0x10')]},'transferNumber':{'type':'string','required':[!![],_0xbac0('0x11')]}});var holdValidation=new Schema({'userId':{'type':_0xbac0('0xc'),'required':[!![],_0xbac0('0xd')]},'sessionId':{'type':_0xbac0('0xe'),'required':![]}});var unholdValidation=new Schema({'userId':{'type':'number','required':[!![],_0xbac0('0xd')]},'sessionId':{'type':_0xbac0('0xe'),'required':![]}});var callsValidation=new Schema({'userId':{'type':_0xbac0('0xc'),'required':[!![],_0xbac0('0xd')]}});var conferenceValidation=new Schema({'userId':{'type':'number','required':[!![],_0xbac0('0xd')]}});function emit(_0x4204d1,_0x2b69ff,_0x38790d){logger[_0xbac0('0x12')](_0x4204d1,_0x2b69ff,JSON[_0xbac0('0x13')](_0x38790d));io['to'](_0x4204d1)[_0xbac0('0x14')](_0x2b69ff,_0x38790d);}function handleError(_0xfcc0da){return function(_0x271597){console['log']('handleError:',_0x271597,_0x271597 instanceof RangeError);logger[_0xbac0('0x15')](_0x271597[_0xbac0('0x16')]);if(_0x271597 instanceof RangeError){if(_0x271597['name']){delete _0x271597['name'];}_0xfcc0da['status'](0x194)['send'](_0x271597);}else{if(_0x271597[_0xbac0('0x17')]){delete _0x271597[_0xbac0('0x17')];}_0xfcc0da[_0xbac0('0x18')](0x1f4)['send'](_0x271597);}};}function checkError(){return function(_0x2987d5){if(!_0x2987d5){throw new RangeError(_0xbac0('0x19'));}return _0x2987d5;};}function respondWithRpcPromise(_0x3e3943,_0x38642e){return new BPromise(function(_0x4ffa35,_0x2dff0b){var _0x3a3f1d=amiClient;return _0x3a3f1d[_0xbac0('0x1a')](_0x3e3943,_0x38642e)[_0xbac0('0x1b')](function(_0x4ffb3d){if(_0x4ffb3d[_0xbac0('0x15')]){if(_0x4ffb3d['error']['code']===0x1f4){return _0x2dff0b(_0x4ffb3d[_0xbac0('0x15')][_0xbac0('0x1c')]);}return _0x4ffa35(_0x4ffb3d['error'][_0xbac0('0x1c')]);}else{_0x4ffa35(_0x4ffb3d[_0xbac0('0x1d')]);}})[_0xbac0('0x1e')](function(_0x5512ba){_0x2dff0b(_0x5512ba);});});}function getAgent(_0x356092){return db['User'][_0xbac0('0x1f')]({'where':{'id':_0x356092,'role':_0xbac0('0x20')}})[_0xbac0('0x1b')](checkError());}function getAgentCheckSession(_0x40ab39,_0x20fb6c){return new BPromise(function(_0x442395,_0x1e9810){var _0x390bb3=respondWithRpcPromise(_0xbac0('0x21'));var _0x2f8583=getAgent(_0x40ab39);Promise[_0xbac0('0x22')]([_0x390bb3,_0x2f8583])['then'](function(_0x162d09){var _0x4b8559=_0x162d09[0x0];var _0x5d1027=_0x162d09[0x1];var _0x431598=_['filter'](_0x4b8559[_0xbac0('0x23')],function(_0x42638b){return _0x42638b[_0xbac0('0x24')]==_0x5d1027['id']&&_0x42638b[_0xbac0('0x25')]==_0x20fb6c;});if(_0x431598[_0xbac0('0x26')]==0x1){_0x442395(_0x5d1027);}else{_0x1e9810(new RangeError('sessionId\x20'+_0x20fb6c+_0xbac0('0x27')));}});});}exports[_0xbac0('0x28')]=function(_0x14de4b,_0x57f4c3){logger[_0xbac0('0x12')](_0xbac0('0x29'),_0x14de4b['body']);var _0x3bfcd2=originateValidation[_0xbac0('0xb')](_0x14de4b[_0xbac0('0x2a')]);if(_0x3bfcd2['length']>0x0){return _0x57f4c3['status'](0x190)[_0xbac0('0x2b')](_0x3bfcd2);}var _0x57075b=_0x14de4b['body'][_0xbac0('0x2c')];var _0x31a241=_0x14de4b[_0xbac0('0x2a')]['callNumber'];var _0x8752a6=_0x14de4b[_0xbac0('0x2a')][_0xbac0('0x2d')];var _0x48b892=_0x14de4b[_0xbac0('0x2a')]['callbackUrl'];return getAgent(_0x57075b)[_0xbac0('0x1b')](function(_0x4cb1c2){logger[_0xbac0('0x12')](_0xbac0('0x2e'),_0x4cb1c2[_0xbac0('0x17')]);emit(util[_0xbac0('0x2f')](_0xbac0('0x30'),_0x4cb1c2[_0xbac0('0x17')]),'webbar:originate',{'callNumber':_0x31a241,'callerId':_0x8752a6,'callbackUrl':_0x48b892});return _0x57f4c3['status'](0xc8)['json']({'error':![],'message':_0xbac0('0x31')});})['catch'](handleError(_0x57f4c3));};exports[_0xbac0('0x32')]=function(_0x359d02,_0x209cba){logger['info'](_0xbac0('0x33'),_0x359d02[_0xbac0('0x2a')]);var _0x170e68=hangupValidation[_0xbac0('0xb')](_0x359d02['body']);if(_0x170e68['length']>0x0){return _0x209cba[_0xbac0('0x18')](0x190)[_0xbac0('0x2b')](_0x170e68);}var _0x1a5f37=_0x359d02['body'][_0xbac0('0x2c')];var _0x321277=_0x359d02[_0xbac0('0x2a')][_0xbac0('0x25')];return getAgent(_0x1a5f37)[_0xbac0('0x1b')](function(_0x14c6fa){logger['info'](_0xbac0('0x2e'),_0x14c6fa[_0xbac0('0x17')]);emit(util['format'](_0xbac0('0x30'),_0x14c6fa[_0xbac0('0x17')]),_0xbac0('0x34'),{'sessionId':_0x321277});return _0x209cba[_0xbac0('0x18')](0xc8)[_0xbac0('0x2b')]({'error':![],'message':_0xbac0('0x35')});})[_0xbac0('0x1e')](handleError(_0x209cba));};exports[_0xbac0('0x36')]=function(_0x3a1e61,_0x5dd461){logger[_0xbac0('0x12')](_0xbac0('0x37'),_0x3a1e61[_0xbac0('0x2a')]);var _0x20d2b3=answerValidation[_0xbac0('0xb')](_0x3a1e61[_0xbac0('0x2a')]);if(_0x20d2b3[_0xbac0('0x26')]>0x0){return _0x5dd461['status'](0x190)[_0xbac0('0x2b')](_0x20d2b3);}var _0x5940ae=_0x3a1e61['body']['userId'];var _0x380613=_0x3a1e61[_0xbac0('0x2a')][_0xbac0('0x25')];return getAgent(_0x5940ae)['then'](function(_0x5f3fb4){logger[_0xbac0('0x12')](_0xbac0('0x2e'),_0x5f3fb4['name']);emit(util['format'](_0xbac0('0x30'),_0x5f3fb4[_0xbac0('0x17')]),_0xbac0('0x38'),{'sessionId':_0x380613});return _0x5dd461['status'](0xc8)[_0xbac0('0x2b')]({'error':![],'message':_0xbac0('0x39')});})[_0xbac0('0x1e')](handleError(_0x5dd461));};exports['hold']=function(_0x44c7ee,_0x638278){logger[_0xbac0('0x12')](_0xbac0('0x3a'),_0x44c7ee[_0xbac0('0x2a')]);var _0x4f284e=holdValidation['validate'](_0x44c7ee['body']);if(_0x4f284e[_0xbac0('0x26')]>0x0){return _0x638278[_0xbac0('0x18')](0x190)[_0xbac0('0x2b')](_0x4f284e);}var _0x1f904f=_0x44c7ee[_0xbac0('0x2a')][_0xbac0('0x2c')];var _0x38d07f=_0x44c7ee[_0xbac0('0x2a')][_0xbac0('0x25')];return getAgent(_0x1f904f)[_0xbac0('0x1b')](function(_0x5c8a0e){logger[_0xbac0('0x12')](_0xbac0('0x2e'),_0x5c8a0e['name']);emit(util[_0xbac0('0x2f')](_0xbac0('0x30'),_0x5c8a0e[_0xbac0('0x17')]),_0xbac0('0x3b'),{'sessionId':_0x38d07f});return _0x638278[_0xbac0('0x18')](0xc8)['json']({'error':![],'message':'hold\x20executed!'});})[_0xbac0('0x1e')](handleError(_0x638278));};exports[_0xbac0('0x3c')]=function(_0x1529d5,_0x50c7ba){logger[_0xbac0('0x12')]('unhold\x20fired:',_0x1529d5['body']);var _0x2ac83c=unholdValidation[_0xbac0('0xb')](_0x1529d5[_0xbac0('0x2a')]);if(_0x2ac83c[_0xbac0('0x26')]>0x0){return _0x50c7ba[_0xbac0('0x18')](0x190)[_0xbac0('0x2b')](_0x2ac83c);}var _0x5de5b3=_0x1529d5[_0xbac0('0x2a')][_0xbac0('0x2c')];var _0x43acaf=_0x1529d5[_0xbac0('0x2a')][_0xbac0('0x25')];return getAgent(_0x5de5b3)['then'](function(_0x4ed7d8){logger[_0xbac0('0x12')](_0xbac0('0x2e'),_0x4ed7d8[_0xbac0('0x17')]);emit(util['format']('user:%s',_0x4ed7d8[_0xbac0('0x17')]),_0xbac0('0x3d'),{'sessionId':_0x43acaf});return _0x50c7ba[_0xbac0('0x18')](0xc8)[_0xbac0('0x2b')]({'error':![],'message':_0xbac0('0x3e')});})['catch'](handleError(_0x50c7ba));};exports[_0xbac0('0x3f')]=function(_0x2e4fc9,_0x55c531){logger[_0xbac0('0x12')]('calls\x20fired:',_0x55c531[_0xbac0('0x2a')]);var _0x4371a5=callsValidation[_0xbac0('0xb')](_0x2e4fc9[_0xbac0('0x2a')]);if(_0x4371a5[_0xbac0('0x26')]>0x0){return _0x55c531[_0xbac0('0x18')](0x190)[_0xbac0('0x2b')](_0x4371a5);}var _0x24d389=_0x2e4fc9[_0xbac0('0x2a')][_0xbac0('0x2c')];var _0x24d4be=respondWithRpcPromise(_0xbac0('0x21'));var _0xb59c95=getAgent(_0x24d389);return Promise[_0xbac0('0x22')]([_0x24d4be,_0xb59c95])[_0xbac0('0x1b')](function(_0x3c2844){var _0x573cfb=_0x3c2844[0x0];var _0x5f328d=_0x3c2844[0x1];var _0xdead3=_[_0xbac0('0x40')](_0x573cfb[_0xbac0('0x23')],function(_0x45d1f2){return _0x45d1f2[_0xbac0('0x24')]==_0x5f328d['id'];});return _0x55c531[_0xbac0('0x18')](0xc8)[_0xbac0('0x2b')]({'count':_0xdead3[_0xbac0('0x26')],'rows':_0xdead3});})[_0xbac0('0x1e')](handleError(_0x55c531));};exports['conference']=function(_0x3f7798,_0x37e95b){logger[_0xbac0('0x12')]('conference\x20fired:',_0x3f7798[_0xbac0('0x2a')]);var _0x11fcf5=conferenceValidation[_0xbac0('0xb')](_0x3f7798[_0xbac0('0x2a')]);if(_0x11fcf5[_0xbac0('0x26')]>0x0){return _0x37e95b['status'](0x190)[_0xbac0('0x2b')](_0x11fcf5);}var _0xf693de=_0x3f7798[_0xbac0('0x2a')]['userId'];return getAgent(_0xf693de)[_0xbac0('0x1b')](function(_0x44a3a7){logger[_0xbac0('0x12')]('entityFound:',_0x44a3a7[_0xbac0('0x17')]);emit(util[_0xbac0('0x2f')]('user:%s',_0x44a3a7['name']),_0xbac0('0x41'));return _0x37e95b[_0xbac0('0x18')](0xc8)[_0xbac0('0x2b')]({'error':![],'message':_0xbac0('0x42')});})[_0xbac0('0x1e')](handleError(_0x37e95b));};exports['transfer']=function(_0x293ee1,_0x2fb853){logger[_0xbac0('0x12')](_0xbac0('0x43'),_0x293ee1[_0xbac0('0x2a')]);var _0x41bde0=transferValidation[_0xbac0('0xb')](_0x293ee1[_0xbac0('0x2a')]);if(_0x41bde0['length']>0x0){return _0x2fb853['status'](0x190)[_0xbac0('0x2b')](_0x41bde0);}var _0x5e452f=_0x293ee1[_0xbac0('0x2a')][_0xbac0('0x2c')];var _0x56fd14=_0x293ee1[_0xbac0('0x2a')][_0xbac0('0x25')];var _0x18cabe=_0x293ee1[_0xbac0('0x2a')][_0xbac0('0x44')];return getAgent(_0x5e452f)[_0xbac0('0x1b')](function(_0x19ce58){logger[_0xbac0('0x12')](_0xbac0('0x2e'),_0x19ce58[_0xbac0('0x17')]);emit(util[_0xbac0('0x2f')](_0xbac0('0x30'),_0x19ce58[_0xbac0('0x17')]),'webbar:transfer',{'sessionId':_0x56fd14,'transferNumber':_0x18cabe});return _0x2fb853['status'](0xc8)[_0xbac0('0x2b')]({'error':![],'message':_0xbac0('0x45')});})[_0xbac0('0x1e')](handleError(_0x2fb853));}; \ No newline at end of file diff --git a/server/api/whatsappAccount/index.js b/server/api/whatsappAccount/index.js index 78e20f8..a8db7be 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 _0xf58c=['multer','util','path','connect-timeout','express','../../components/interaction/service','../../config/environment','get','isAuthenticated','index','/describe','/:id','/:id/dispositions','getDispositions','/:id/canned_answers','getAnswers','/:id/users','getAgents','/:id/applications','getApplications','post','create','addDisposition','addAnswer','addAgents','addApplications','/:id/notify','/:id/send','send','update','delete','destroy','removeDispositions','removeAgents','exports'];(function(_0x555ab9,_0x30c354){var _0x4c29f5=function(_0x85beff){while(--_0x85beff){_0x555ab9['push'](_0x555ab9['shift']());}};_0x4c29f5(++_0x30c354);}(_0xf58c,0x8c));var _0xcf58=function(_0x1385dc,_0x2c7fd7){_0x1385dc=_0x1385dc-0x0;var _0x2f6469=_0xf58c[_0x1385dc];return _0x2f6469;};'use strict';var multer=require(_0xcf58('0x0'));var util=require(_0xcf58('0x1'));var path=require(_0xcf58('0x2'));var timeout=require(_0xcf58('0x3'));var express=require(_0xcf58('0x4'));var router=express['Router']();var fs_extra=require('fs-extra');var auth=require('../../components/auth/service');var interaction=require(_0xcf58('0x5'));var config=require(_0xcf58('0x6'));var controller=require('./whatsappAccount.controller');router[_0xcf58('0x7')]('/',auth[_0xcf58('0x8')](),controller[_0xcf58('0x9')]);router['get'](_0xcf58('0xa'),auth['isAuthenticated'](),controller['describe']);router[_0xcf58('0x7')](_0xcf58('0xb'),auth[_0xcf58('0x8')](),controller['show']);router[_0xcf58('0x7')](_0xcf58('0xc'),auth[_0xcf58('0x8')](),controller[_0xcf58('0xd')]);router[_0xcf58('0x7')](_0xcf58('0xe'),auth[_0xcf58('0x8')](),controller[_0xcf58('0xf')]);router[_0xcf58('0x7')](_0xcf58('0x10'),auth['isAuthenticated'](),controller[_0xcf58('0x11')]);router[_0xcf58('0x7')](_0xcf58('0x12'),auth[_0xcf58('0x8')](),controller[_0xcf58('0x13')]);router[_0xcf58('0x14')]('/',auth[_0xcf58('0x8')](),controller[_0xcf58('0x15')]);router[_0xcf58('0x14')](_0xcf58('0xc'),auth[_0xcf58('0x8')](),controller[_0xcf58('0x16')]);router[_0xcf58('0x14')](_0xcf58('0xe'),auth[_0xcf58('0x8')](),controller[_0xcf58('0x17')]);router[_0xcf58('0x14')](_0xcf58('0x10'),auth[_0xcf58('0x8')](),controller[_0xcf58('0x18')]);router[_0xcf58('0x14')](_0xcf58('0x12'),auth[_0xcf58('0x8')](),controller[_0xcf58('0x19')]);router[_0xcf58('0x14')](_0xcf58('0x1a'),controller['notify']);router[_0xcf58('0x14')](_0xcf58('0x1b'),auth[_0xcf58('0x8')](),controller[_0xcf58('0x1c')]);router['put']('/:id',auth[_0xcf58('0x8')](),controller[_0xcf58('0x1d')]);router[_0xcf58('0x1e')](_0xcf58('0xb'),auth['isAuthenticated'](),controller[_0xcf58('0x1f')]);router['delete'](_0xcf58('0xc'),auth[_0xcf58('0x8')](),controller[_0xcf58('0x20')]);router[_0xcf58('0x1e')](_0xcf58('0xe'),auth[_0xcf58('0x8')](),controller['removeAnswers']);router['delete'](_0xcf58('0x10'),auth[_0xcf58('0x8')](),controller[_0xcf58('0x21')]);module[_0xcf58('0x22')]=router; \ No newline at end of file +var _0xe742=['connect-timeout','express','Router','fs-extra','../../components/auth/service','../../components/interaction/service','index','get','/describe','isAuthenticated','describe','show','/:id/dispositions','/:id/canned_answers','getAnswers','/:id/users','getAgents','/:id/applications','getApplications','post','create','addDisposition','addAgents','addApplications','/:id/notify','/:id/send','put','update','delete','/:id','destroy','removeDispositions','removeAnswers','removeAgents','multer'];(function(_0x56b7b0,_0x33fdb2){var _0x2e455d=function(_0x2805cb){while(--_0x2805cb){_0x56b7b0['push'](_0x56b7b0['shift']());}};_0x2e455d(++_0x33fdb2);}(_0xe742,0x8b));var _0x2e74=function(_0x5a2e21,_0x20573e){_0x5a2e21=_0x5a2e21-0x0;var _0x675951=_0xe742[_0x5a2e21];return _0x675951;};'use strict';var multer=require(_0x2e74('0x0'));var util=require('util');var path=require('path');var timeout=require(_0x2e74('0x1'));var express=require(_0x2e74('0x2'));var router=express[_0x2e74('0x3')]();var fs_extra=require(_0x2e74('0x4'));var auth=require(_0x2e74('0x5'));var interaction=require(_0x2e74('0x6'));var config=require('../../config/environment');var controller=require('./whatsappAccount.controller');router['get']('/',auth['isAuthenticated'](),controller[_0x2e74('0x7')]);router[_0x2e74('0x8')](_0x2e74('0x9'),auth[_0x2e74('0xa')](),controller[_0x2e74('0xb')]);router[_0x2e74('0x8')]('/:id',auth[_0x2e74('0xa')](),controller[_0x2e74('0xc')]);router[_0x2e74('0x8')](_0x2e74('0xd'),auth[_0x2e74('0xa')](),controller['getDispositions']);router[_0x2e74('0x8')](_0x2e74('0xe'),auth['isAuthenticated'](),controller[_0x2e74('0xf')]);router['get'](_0x2e74('0x10'),auth[_0x2e74('0xa')](),controller[_0x2e74('0x11')]);router['get'](_0x2e74('0x12'),auth[_0x2e74('0xa')](),controller[_0x2e74('0x13')]);router[_0x2e74('0x14')]('/',auth[_0x2e74('0xa')](),controller[_0x2e74('0x15')]);router['post']('/:id/dispositions',auth[_0x2e74('0xa')](),controller[_0x2e74('0x16')]);router[_0x2e74('0x14')](_0x2e74('0xe'),auth[_0x2e74('0xa')](),controller['addAnswer']);router[_0x2e74('0x14')](_0x2e74('0x10'),auth[_0x2e74('0xa')](),controller[_0x2e74('0x17')]);router[_0x2e74('0x14')](_0x2e74('0x12'),auth[_0x2e74('0xa')](),controller[_0x2e74('0x18')]);router[_0x2e74('0x14')](_0x2e74('0x19'),controller['notify']);router['post'](_0x2e74('0x1a'),auth[_0x2e74('0xa')](),controller['send']);router[_0x2e74('0x1b')]('/:id',auth[_0x2e74('0xa')](),controller[_0x2e74('0x1c')]);router[_0x2e74('0x1d')](_0x2e74('0x1e'),auth[_0x2e74('0xa')](),controller[_0x2e74('0x1f')]);router['delete'](_0x2e74('0xd'),auth[_0x2e74('0xa')](),controller[_0x2e74('0x20')]);router['delete'](_0x2e74('0xe'),auth[_0x2e74('0xa')](),controller[_0x2e74('0x21')]);router[_0x2e74('0x1d')](_0x2e74('0x10'),auth[_0x2e74('0xa')](),controller[_0x2e74('0x22')]);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 c591a86..e2e078f 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 _0xc40b=['twilio','sinch','BOOLEAN','INTEGER','Status\x20to\x20put\x20when\x20mandatory\x20disposition\x20is\x20enabled','Enabled/disables\x20mandatory\x20dispo\x20on\x20a\x20queue','setDataValue','mandatoryDispositionPauseId','mandatoryDisposition','sequelize','exports','STRING','generate','ENUM'];(function(_0xb4ddea,_0x2e2860){var _0x2e1969=function(_0x521a73){while(--_0x521a73){_0xb4ddea['push'](_0xb4ddea['shift']());}};_0x2e1969(++_0x2e2860);}(_0xc40b,0x79));var _0xbc40=function(_0x597db9,_0x5a8c52){_0x597db9=_0x597db9-0x0;var _0xc6120b=_0xc40b[_0x597db9];return _0xc6120b;};'use strict';var Sequelize=require(_0xbc40('0x0'));var rs=require('randomstring');module[_0xbc40('0x1')]={'name':{'type':Sequelize['STRING'],'unique':'name','allowNull':![]},'key':{'type':Sequelize[_0xbc40('0x2')],'allowNull':![]},'remote':{'type':Sequelize['STRING'],'allowNull':![]},'token':{'type':Sequelize[_0xbc40('0x2')],'defaultValue':function(){return rs[_0xbc40('0x3')]();}},'phone':{'type':Sequelize['STRING']},'type':{'type':Sequelize[_0xbc40('0x4')](_0xbc40('0x5'),_0xbc40('0x6'))},'accountSid':{'type':Sequelize[_0xbc40('0x2')]},'baseUrl':{'type':Sequelize[_0xbc40('0x2')]},'authToken':{'type':Sequelize[_0xbc40('0x2')]},'notificationTemplate':{'type':Sequelize['TEXT'],'defaultValue':function(){return'Account:\x20{{account.name}}
{{#queue}}Queue:\x20{{queue.name}}
{{/queue}}From\x20:\x20{{from}}';}},'notificationSound':{'type':Sequelize[_0xbc40('0x7')],'defaultValue':![]},'notificationShake':{'type':Sequelize[_0xbc40('0x7')],'defaultValue':![]},'waitForTheAssignedAgent':{'type':Sequelize[_0xbc40('0x8')],'validate':{'min':0x1,'max':0x20c49b},'defaultValue':0xa},'waitForTheAssignedQueue':{'type':Sequelize[_0xbc40('0x8')],'validate':{'min':0x1,'max':0x20c49b},'defaultValue':0xa},'queueTransfer':{'type':Sequelize[_0xbc40('0x7')],'defaultValue':![]},'queueTransferTimeout':{'type':Sequelize[_0xbc40('0x8')],'validate':{'min':0x1,'max':0x20c49b},'defaultValue':0x12c},'agentTransfer':{'type':Sequelize[_0xbc40('0x7')],'defaultValue':![]},'agentTransferTimeout':{'type':Sequelize[_0xbc40('0x8')],'validate':{'min':0x1,'max':0x20c49b},'defaultValue':0x12c},'mandatoryDispositionPauseId':{'type':Sequelize[_0xbc40('0x8')],'comment':_0xbc40('0x9')},'mandatoryDisposition':{'type':Sequelize[_0xbc40('0x7')],'defaultValue':![],'comment':_0xbc40('0xa'),'set':function(_0x46ef5d){if(!_0x46ef5d){this[_0xbc40('0xb')](_0xbc40('0xc'),null);}this[_0xbc40('0xb')](_0xbc40('0xd'),_0x46ef5d);}},'description':{'type':Sequelize[_0xbc40('0x2')]}}; \ No newline at end of file +var _0x696f=['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','STRING','name','generate','ENUM','twilio','sinch','TEXT'];(function(_0x5ee9a7,_0x4869b5){var _0x330bce=function(_0x349f83){while(--_0x349f83){_0x5ee9a7['push'](_0x5ee9a7['shift']());}};_0x330bce(++_0x4869b5);}(_0x696f,0x1b9));var _0xf696=function(_0x14add3,_0x13ce8d){_0x14add3=_0x14add3-0x0;var _0x4a174f=_0x696f[_0x14add3];return _0x4a174f;};'use strict';var Sequelize=require('sequelize');var rs=require('randomstring');module['exports']={'name':{'type':Sequelize[_0xf696('0x0')],'unique':_0xf696('0x1'),'allowNull':![]},'key':{'type':Sequelize[_0xf696('0x0')],'allowNull':![]},'remote':{'type':Sequelize[_0xf696('0x0')],'allowNull':![]},'token':{'type':Sequelize['STRING'],'defaultValue':function(){return rs[_0xf696('0x2')]();}},'phone':{'type':Sequelize[_0xf696('0x0')]},'type':{'type':Sequelize[_0xf696('0x3')](_0xf696('0x4'),_0xf696('0x5'))},'accountSid':{'type':Sequelize[_0xf696('0x0')]},'baseUrl':{'type':Sequelize[_0xf696('0x0')]},'authToken':{'type':Sequelize[_0xf696('0x0')]},'notificationTemplate':{'type':Sequelize[_0xf696('0x6')],'defaultValue':function(){return _0xf696('0x7');}},'notificationSound':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'notificationShake':{'type':Sequelize[_0xf696('0x8')],'defaultValue':![]},'waitForTheAssignedAgent':{'type':Sequelize[_0xf696('0x9')],'validate':{'min':0x1,'max':0x20c49b},'defaultValue':0xa},'waitForTheAssignedQueue':{'type':Sequelize['INTEGER'],'validate':{'min':0x1,'max':0x20c49b},'defaultValue':0xa},'queueTransfer':{'type':Sequelize[_0xf696('0x8')],'defaultValue':![]},'queueTransferTimeout':{'type':Sequelize[_0xf696('0x9')],'validate':{'min':0x1,'max':0x20c49b},'defaultValue':0x12c},'agentTransfer':{'type':Sequelize[_0xf696('0x8')],'defaultValue':![]},'agentTransferTimeout':{'type':Sequelize['INTEGER'],'validate':{'min':0x1,'max':0x20c49b},'defaultValue':0x12c},'mandatoryDispositionPauseId':{'type':Sequelize[_0xf696('0x9')],'comment':_0xf696('0xa')},'mandatoryDisposition':{'type':Sequelize['BOOLEAN'],'defaultValue':![],'comment':_0xf696('0xb'),'set':function(_0x5d8112){if(!_0x5d8112){this[_0xf696('0xc')](_0xf696('0xd'),null);}this[_0xf696('0xc')]('mandatoryDisposition',_0x5d8112);}},'description':{'type':Sequelize[_0xf696('0x0')]}}; \ No newline at end of file diff --git a/server/api/whatsappAccount/whatsappAccount.controller.js b/server/api/whatsappAccount/whatsappAccount.controller.js index 812c7a5..88ddab7 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 _0x8e54=['sinch','statuses','state','WhatsappMessage','timestamp','message_id','applications','orderBy','asc','CmContact','Sequelize','ValidationError','no\x20available\x20attributes','difference','createdAt','updatedAt','CompanyId','ListId','mobile','twilio','From','replace','Body','MessageSid','from','notifications','messageId','isNil','from\x20is\x20mandatory','mapKey','mapKey\x20is\x20mandatory,\x20please\x20use\x20one\x20of\x20these:\x20','mapKey\x20invalid,\x20please\x20use\x20one\x20of\x20these:\x20','CmList','Contacts','DESC','list','contact','interaction','autoclose','push','close','*,*,*,*','UserId','User','agent','waitForTheAssignedAgent','unshift','queue','waitForTheAssignedQueue','receiveMessage','debug','WhatsappAccount,\x20%s,\x20%s,\x20%s,\x20%s','entity\x20found','stringify','set','Content-Type','text/xml','to\x20is\x20mandatory','List','WhatsappInteraction','out','dataValues','Messages','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','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','../../config/utils','../../config/environment','redis','defaults','socket.io-emitter','./whatsappAccount.socket','register','jayson/promise','client','http','info','WhatsappAccount,\x20%s,\x20%s','request\x20sent','WhatsappAccount,\x20%s,\x20%s,\x20%s','error','code','message','result','catch','status','end','json','offset','undefined','limit','count','reject','save','then','destroy','WhatsappAccounts','sendStatus','stack','name','Pause','mandatoryDispositionPause','WhatsappAccount','rawAttributes','fieldName','type','key','model','map','query','keys','filters','intersection','attributes','fields','length','nolimit','order','sort','pick','filter','where','merge','VIRTUAL','includeAll','include','findAll','rows','show','params','find','body','user','get','Unable\x20to\x20retrieve\x20the\x20current\x20user','role','UserProfileSection','userProfileId','autoAssociation','UserProfileResource','create','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','update','describe','addDisposition','Disposition','getDispositions','findOne','WhatsappAccountId','removeDispositions','addAnswer','CannedAnswer','getAnswers','hasOwnProperty','options','removeAnswers','ids','addAgents','omit','spread','userWhatsappAccount:save','removeAgents','isArray','userWhatsappAccount:remove','emit','getAgents','addApplications','transaction','sequelize','ISOLATION_LEVELS','READ_COMMITTED','WhatsappApplication','bulkCreate','findAndCountAll','priority','finally','send','getApplications','notify','whatsapp','Applications','account'];(function(_0x535a6c,_0x57f223){var _0x4aceb4=function(_0x43a7bb){while(--_0x43a7bb){_0x535a6c['push'](_0x535a6c['shift']());}};_0x4aceb4(++_0x57f223);}(_0x8e54,0x108));var _0x48e5=function(_0xda803c,_0x3414ab){_0xda803c=_0xda803c-0x0;var _0x440fe2=_0x8e54[_0xda803c];return _0x440fe2;};'use strict';var emlformat=require(_0x48e5('0x0'));var rimraf=require(_0x48e5('0x1'));var zipdir=require(_0x48e5('0x2'));var jsonpatch=require(_0x48e5('0x3'));var rp=require(_0x48e5('0x4'));var moment=require(_0x48e5('0x5'));var BPromise=require(_0x48e5('0x6'));var Mustache=require(_0x48e5('0x7'));var util=require('util');var path=require(_0x48e5('0x8'));var sox=require(_0x48e5('0x9'));var csv=require(_0x48e5('0xa'));var ejs=require(_0x48e5('0xb'));var fs=require('fs');var fs_extra=require(_0x48e5('0xc'));var _=require(_0x48e5('0xd'));var squel=require(_0x48e5('0xe'));var crypto=require(_0x48e5('0xf'));var jsforce=require('jsforce');var deskjs=require(_0x48e5('0x10'));var toCsv=require(_0x48e5('0xa'));var querystring=require('querystring');var Papa=require('papaparse');var Redis=require('ioredis');var authService=require(_0x48e5('0x11'));var qs=require(_0x48e5('0x12'));var as=require(_0x48e5('0x13'));var hardwareService=require(_0x48e5('0x14'));var logger=require(_0x48e5('0x15'))('api');var utils=require(_0x48e5('0x16'));var config=require(_0x48e5('0x17'));var licenseUtil=require('../../config/license/util');var db=require('../../mysqldb')['db'];config[_0x48e5('0x18')]=_[_0x48e5('0x19')](config[_0x48e5('0x18')],{'host':'localhost','port':0x18eb});var socket=require(_0x48e5('0x1a'))(new Redis(config[_0x48e5('0x18')]));require(_0x48e5('0x1b'))[_0x48e5('0x1c')](socket);var jayson=require(_0x48e5('0x1d'));var client=jayson[_0x48e5('0x1e')][_0x48e5('0x1f')]({'port':0x232c});function respondWithRpcPromise(_0x3023f2,_0x44f1b5,_0x306785,_0x581538){return new BPromise(function(_0x30c0d8,_0x1835ed){var _0xfcdb4f=_0x581538||client;return _0xfcdb4f['request'](_0x3023f2,_0x306785)['then'](function(_0x34eb53){logger[_0x48e5('0x20')](_0x48e5('0x21'),_0x44f1b5,_0x48e5('0x22'));logger['debug'](_0x48e5('0x23'),_0x44f1b5,_0x48e5('0x22'),JSON['stringify'](_0x34eb53));if(_0x34eb53[_0x48e5('0x24')]){if(_0x34eb53[_0x48e5('0x24')][_0x48e5('0x25')]===0x1f4){logger[_0x48e5('0x24')](_0x48e5('0x21'),_0x44f1b5,_0x34eb53[_0x48e5('0x24')][_0x48e5('0x26')]);return _0x1835ed(_0x34eb53[_0x48e5('0x24')][_0x48e5('0x26')]);}logger['error'](_0x48e5('0x21'),_0x44f1b5,_0x34eb53['error']['message']);return _0x30c0d8(_0x34eb53[_0x48e5('0x24')][_0x48e5('0x26')]);}else{logger['info'](_0x48e5('0x21'),_0x44f1b5,_0x48e5('0x22'));_0x30c0d8(_0x34eb53[_0x48e5('0x27')][_0x48e5('0x26')]);}})[_0x48e5('0x28')](function(_0x1ac652){logger[_0x48e5('0x24')](_0x48e5('0x21'),_0x44f1b5,_0x1ac652);_0x1835ed(_0x1ac652);});});}function respondWithStatusCode(_0x1e65bf,_0x5bd464){_0x5bd464=_0x5bd464||0xcc;return function(_0x50ba52){if(_0x50ba52){return _0x1e65bf['sendStatus'](_0x5bd464);}return _0x1e65bf[_0x48e5('0x29')](_0x5bd464)[_0x48e5('0x2a')]();};}function respondWithResult(_0x3e6395,_0x3e82cf){_0x3e82cf=_0x3e82cf||0xc8;return function(_0x2d36cc){if(_0x2d36cc){return _0x3e6395['status'](_0x3e82cf)[_0x48e5('0x2b')](_0x2d36cc);}};}function respondWithFilteredResult(_0x45dbf0,_0x517ed8){return function(_0x76e437){if(_0x76e437){var _0x488704=typeof _0x517ed8[_0x48e5('0x2c')]===_0x48e5('0x2d')&&typeof _0x517ed8[_0x48e5('0x2e')]==='undefined';var _0x3a8a55=_0x76e437[_0x48e5('0x2f')];var _0x1a2c2a=_0x488704?0x0:_0x517ed8['offset'];var _0x49e750=_0x488704?_0x76e437['count']:_0x517ed8['offset']+_0x517ed8[_0x48e5('0x2e')];var _0x49dc9a;if(_0x49e750>=_0x3a8a55){_0x49e750=_0x3a8a55;_0x49dc9a=0xc8;}else{_0x49dc9a=0xce;}_0x45dbf0[_0x48e5('0x29')](_0x49dc9a);return _0x45dbf0['set']('Content-Range',_0x1a2c2a+'-'+_0x49e750+'/'+_0x3a8a55)['json'](_0x76e437);}return null;};}function patchUpdates(_0x1f47df){return function(_0x47ddb2){try{jsonpatch['apply'](_0x47ddb2,_0x1f47df,!![]);}catch(_0x3c671b){return BPromise[_0x48e5('0x30')](_0x3c671b);}return _0x47ddb2[_0x48e5('0x31')]();};}function saveUpdates(_0x2fe3fc,_0x35c111){return function(_0x126385){if(_0x126385){return _0x126385['update'](_0x2fe3fc)[_0x48e5('0x32')](function(_0x2f18f8){return _0x2f18f8;});}return null;};}function removeEntity(_0x23fd38,_0x2e788a){return function(_0x16787f){if(_0x16787f){return _0x16787f[_0x48e5('0x33')]()['then'](function(){var _0x5ba984=_0x16787f['get']({'plain':!![]});var _0x1a0be6=_0x48e5('0x34');return db['UserProfileResource'][_0x48e5('0x33')]({'where':{'type':_0x1a0be6,'resourceId':_0x5ba984['id']}})[_0x48e5('0x32')](function(){return _0x16787f;});})[_0x48e5('0x32')](function(){_0x23fd38[_0x48e5('0x29')](0xcc)[_0x48e5('0x2a')]();});}};}function handleEntityNotFound(_0x15b15c,_0x156458){return function(_0x47666e){if(!_0x47666e){_0x15b15c[_0x48e5('0x35')](0x194);}return _0x47666e;};}function handleError(_0x56af53,_0x283e32){_0x283e32=_0x283e32||0x1f4;return function(_0x4d6638){logger[_0x48e5('0x24')](_0x4d6638[_0x48e5('0x36')]);if(_0x4d6638[_0x48e5('0x37')]){delete _0x4d6638[_0x48e5('0x37')];}_0x56af53['status'](_0x283e32)['send'](_0x4d6638);};}exports['index']=function(_0x44f31a,_0x3d94d7){var _0x4bbaa0={'include':[{'model':db[_0x48e5('0x38')],'as':_0x48e5('0x39')}]},_0x226ec9={},_0x5b6d88={'count':0x0,'rows':[]};var _0x75fed8=_['map'](db[_0x48e5('0x3a')][_0x48e5('0x3b')],function(_0x5c4f55){return{'name':_0x5c4f55[_0x48e5('0x3c')],'type':_0x5c4f55[_0x48e5('0x3d')][_0x48e5('0x3e')]};});_0x226ec9[_0x48e5('0x3f')]=_[_0x48e5('0x40')](_0x75fed8,_0x48e5('0x37'));_0x226ec9[_0x48e5('0x41')]=_[_0x48e5('0x42')](_0x44f31a['query']);_0x226ec9[_0x48e5('0x43')]=_[_0x48e5('0x44')](_0x226ec9[_0x48e5('0x3f')],_0x226ec9[_0x48e5('0x41')]);_0x4bbaa0[_0x48e5('0x45')]=_[_0x48e5('0x44')](_0x226ec9['model'],qs[_0x48e5('0x46')](_0x44f31a[_0x48e5('0x41')][_0x48e5('0x46')]));_0x4bbaa0[_0x48e5('0x45')]=_0x4bbaa0[_0x48e5('0x45')][_0x48e5('0x47')]?_0x4bbaa0[_0x48e5('0x45')]:_0x226ec9[_0x48e5('0x3f')];if(!_0x44f31a[_0x48e5('0x41')]['hasOwnProperty'](_0x48e5('0x48'))){_0x4bbaa0[_0x48e5('0x2e')]=qs['limit'](_0x44f31a['query'][_0x48e5('0x2e')]);_0x4bbaa0['offset']=qs[_0x48e5('0x2c')](_0x44f31a['query']['offset']);}_0x4bbaa0[_0x48e5('0x49')]=qs[_0x48e5('0x4a')](_0x44f31a[_0x48e5('0x41')][_0x48e5('0x4a')]);_0x4bbaa0['where']=qs[_0x48e5('0x43')](_[_0x48e5('0x4b')](_0x44f31a[_0x48e5('0x41')],_0x226ec9['filters']),_0x75fed8);if(_0x44f31a[_0x48e5('0x41')][_0x48e5('0x4c')]){_0x4bbaa0[_0x48e5('0x4d')]=_[_0x48e5('0x4e')](_0x4bbaa0[_0x48e5('0x4d')],{'$or':_[_0x48e5('0x40')](_0x75fed8,function(_0x5c7632){if(_0x5c7632[_0x48e5('0x3d')]!==_0x48e5('0x4f')){var _0x3b3e4a={};_0x3b3e4a[_0x5c7632[_0x48e5('0x37')]]={'$like':'%'+_0x44f31a['query'][_0x48e5('0x4c')]+'%'};return _0x3b3e4a;}})});}_0x4bbaa0=_[_0x48e5('0x4e')]({},_0x4bbaa0,_0x44f31a['options']);var _0x5d1a54={'where':_0x4bbaa0['where']};return db[_0x48e5('0x3a')][_0x48e5('0x2f')](_0x5d1a54)[_0x48e5('0x32')](function(_0x1472d6){_0x5b6d88['count']=_0x1472d6;if(_0x44f31a[_0x48e5('0x41')][_0x48e5('0x50')]){_0x4bbaa0[_0x48e5('0x51')]=[{'all':!![]}];}return db[_0x48e5('0x3a')][_0x48e5('0x52')](_0x4bbaa0);})[_0x48e5('0x32')](function(_0x29cee5){_0x5b6d88[_0x48e5('0x53')]=_0x29cee5;return _0x5b6d88;})[_0x48e5('0x32')](respondWithFilteredResult(_0x3d94d7,_0x4bbaa0))['catch'](handleError(_0x3d94d7,null));};exports[_0x48e5('0x54')]=function(_0x34e42c,_0x314883){var _0x2b15e9={'raw':![],'where':{'id':_0x34e42c[_0x48e5('0x55')]['id']},'include':[{'model':db[_0x48e5('0x38')],'as':_0x48e5('0x39')}]},_0x7a5e7c={};_0x7a5e7c[_0x48e5('0x3f')]=_[_0x48e5('0x42')](db['WhatsappAccount'][_0x48e5('0x3b')]);_0x7a5e7c[_0x48e5('0x41')]=_[_0x48e5('0x42')](_0x34e42c[_0x48e5('0x41')]);_0x7a5e7c[_0x48e5('0x43')]=_[_0x48e5('0x44')](_0x7a5e7c[_0x48e5('0x3f')],_0x7a5e7c[_0x48e5('0x41')]);_0x2b15e9[_0x48e5('0x45')]=_[_0x48e5('0x44')](_0x7a5e7c[_0x48e5('0x3f')],qs[_0x48e5('0x46')](_0x34e42c[_0x48e5('0x41')][_0x48e5('0x46')]));_0x2b15e9['attributes']=_0x2b15e9[_0x48e5('0x45')][_0x48e5('0x47')]?_0x2b15e9[_0x48e5('0x45')]:_0x7a5e7c[_0x48e5('0x3f')];if(_0x34e42c['query'][_0x48e5('0x50')]){_0x2b15e9[_0x48e5('0x51')]=[{'all':!![]}];}_0x2b15e9=_[_0x48e5('0x4e')]({},_0x2b15e9,_0x34e42c['options']);return db[_0x48e5('0x3a')][_0x48e5('0x56')](_0x2b15e9)[_0x48e5('0x32')](handleEntityNotFound(_0x314883,null))['then'](respondWithResult(_0x314883,null))[_0x48e5('0x28')](handleError(_0x314883,null));};exports['create']=function(_0x57d05c,_0x5686d9){return db[_0x48e5('0x3a')]['create'](_0x57d05c[_0x48e5('0x57')],{})[_0x48e5('0x32')](function(_0x45092e){var _0x27a12c=_0x57d05c[_0x48e5('0x58')][_0x48e5('0x59')]({'plain':!![]});if(!_0x27a12c)throw new Error(_0x48e5('0x5a'));if(_0x27a12c[_0x48e5('0x5b')]===_0x48e5('0x58')){var _0x9266f8=_0x45092e['get']({'plain':!![]});var _0x5a7eb5=_0x48e5('0x34');return db[_0x48e5('0x5c')]['find']({'where':{'name':_0x5a7eb5,'userProfileId':_0x27a12c[_0x48e5('0x5d')]},'raw':!![]})[_0x48e5('0x32')](function(_0x37a45b){if(_0x37a45b&&_0x37a45b[_0x48e5('0x5e')]===0x0){return db[_0x48e5('0x5f')][_0x48e5('0x60')]({'name':_0x9266f8['name'],'resourceId':_0x9266f8['id'],'type':_0x37a45b[_0x48e5('0x37')],'sectionId':_0x37a45b['id']},{})[_0x48e5('0x32')](function(){return _0x45092e;});}else{return _0x45092e;}})[_0x48e5('0x28')](function(_0x564a22){logger['error'](_0x48e5('0x61'),_0x564a22);throw _0x564a22;});}return _0x45092e;})[_0x48e5('0x32')](respondWithResult(_0x5686d9,0xc9))['catch'](handleError(_0x5686d9,null));};exports[_0x48e5('0x62')]=function(_0x1313b0,_0x10ba67){if(_0x1313b0[_0x48e5('0x57')]['id']){delete _0x1313b0[_0x48e5('0x57')]['id'];}return db[_0x48e5('0x3a')][_0x48e5('0x56')]({'where':{'id':_0x1313b0[_0x48e5('0x55')]['id']},'include':[{'model':db[_0x48e5('0x38')],'as':_0x48e5('0x39')}]})[_0x48e5('0x32')](handleEntityNotFound(_0x10ba67,null))[_0x48e5('0x32')](saveUpdates(_0x1313b0[_0x48e5('0x57')],null))[_0x48e5('0x32')](respondWithResult(_0x10ba67,null))[_0x48e5('0x28')](handleError(_0x10ba67,null));};exports[_0x48e5('0x33')]=function(_0x48c1da,_0x3b35e9){return db[_0x48e5('0x3a')][_0x48e5('0x56')]({'where':{'id':_0x48c1da[_0x48e5('0x55')]['id']}})['then'](handleEntityNotFound(_0x3b35e9,null))[_0x48e5('0x32')](removeEntity(_0x3b35e9,null))['catch'](handleError(_0x3b35e9,null));};exports[_0x48e5('0x63')]=function(_0x203b7c,_0x2cf0b5){return db[_0x48e5('0x3a')][_0x48e5('0x63')]()[_0x48e5('0x32')](respondWithResult(_0x2cf0b5,null))[_0x48e5('0x28')](handleError(_0x2cf0b5,null));};exports[_0x48e5('0x64')]=function(_0x32a4f4,_0x2fd675,_0x27d2ae){if(_0x32a4f4['body']['id']){delete _0x32a4f4['body']['id'];}return db['WhatsappAccount']['find']({'where':{'id':_0x32a4f4[_0x48e5('0x55')]['id']}})[_0x48e5('0x32')](handleEntityNotFound(_0x2fd675,null))[_0x48e5('0x32')](function(_0x41ee9b){if(_0x41ee9b){_0x32a4f4[_0x48e5('0x57')]['WhatsappAccountId']=_0x41ee9b['id'];return db[_0x48e5('0x65')][_0x48e5('0x60')](_0x32a4f4[_0x48e5('0x57')]);}})[_0x48e5('0x32')](respondWithResult(_0x2fd675,null))[_0x48e5('0x28')](handleError(_0x2fd675,null));};exports[_0x48e5('0x66')]=function(_0x1ffa5b,_0x1c4363,_0x3f1be8){var _0x449e4a={'raw':![],'where':{}};var _0x3bad4c={};var _0x36543f={'count':0x0,'rows':[]};return db[_0x48e5('0x3a')][_0x48e5('0x67')]({'where':{'id':_0x1ffa5b[_0x48e5('0x55')]['id']}})['then'](handleEntityNotFound(_0x1c4363,null))[_0x48e5('0x32')](function(_0x4df0da){if(_0x4df0da){_0x3bad4c[_0x48e5('0x3f')]=_['keys'](db[_0x48e5('0x65')][_0x48e5('0x3b')]);_0x3bad4c['query']=_[_0x48e5('0x42')](_0x1ffa5b[_0x48e5('0x41')]);_0x3bad4c[_0x48e5('0x43')]=_[_0x48e5('0x44')](_0x3bad4c[_0x48e5('0x3f')],_0x3bad4c[_0x48e5('0x41')]);_0x449e4a[_0x48e5('0x45')]=_['intersection'](_0x3bad4c['model'],qs[_0x48e5('0x46')](_0x1ffa5b[_0x48e5('0x41')][_0x48e5('0x46')]));_0x449e4a[_0x48e5('0x45')]=_0x449e4a['attributes']['length']?_0x449e4a['attributes']:_0x3bad4c[_0x48e5('0x3f')];if(!_0x1ffa5b['query']['hasOwnProperty'](_0x48e5('0x48'))){_0x449e4a['limit']=qs[_0x48e5('0x2e')](_0x1ffa5b[_0x48e5('0x41')]['limit']);_0x449e4a['offset']=qs[_0x48e5('0x2c')](_0x1ffa5b[_0x48e5('0x41')][_0x48e5('0x2c')]);}_0x449e4a[_0x48e5('0x49')]=qs[_0x48e5('0x4a')](_0x1ffa5b['query'][_0x48e5('0x4a')]);_0x449e4a[_0x48e5('0x4d')]=qs[_0x48e5('0x43')](_[_0x48e5('0x4b')](_0x1ffa5b[_0x48e5('0x41')],_0x3bad4c[_0x48e5('0x43')]));_0x449e4a['where'][_0x48e5('0x68')]=_0x4df0da['id'];if(_0x1ffa5b[_0x48e5('0x41')][_0x48e5('0x4c')]){_0x449e4a['where']=_[_0x48e5('0x4e')](_0x449e4a[_0x48e5('0x4d')],{'$or':_[_0x48e5('0x40')](_0x449e4a[_0x48e5('0x45')],function(_0x386723){var _0x13901a={};_0x13901a[_0x386723]={'$like':'%'+_0x1ffa5b['query'][_0x48e5('0x4c')]+'%'};return _0x13901a;})});}_0x449e4a=_[_0x48e5('0x4e')]({},_0x449e4a,_0x1ffa5b['options']);return db['Disposition'][_0x48e5('0x2f')]({'where':_0x449e4a[_0x48e5('0x4d')]})[_0x48e5('0x32')](function(_0x22d776){_0x36543f['count']=_0x22d776;if(_0x1ffa5b['query']['includeAll']){_0x449e4a[_0x48e5('0x51')]=[{'all':!![]}];}return db['Disposition'][_0x48e5('0x52')](_0x449e4a);})[_0x48e5('0x32')](function(_0x178450){_0x36543f[_0x48e5('0x53')]=_0x178450;return _0x36543f;});}})['then'](respondWithFilteredResult(_0x1c4363,_0x449e4a))[_0x48e5('0x28')](handleError(_0x1c4363,null));};exports[_0x48e5('0x69')]=function(_0x27803b,_0x5802bf,_0x5704e5){return db['WhatsappAccount']['find']({'where':{'id':_0x27803b['params']['id']}})[_0x48e5('0x32')](handleEntityNotFound(_0x5802bf,null))[_0x48e5('0x32')](function(_0x560274){if(_0x560274){return _0x560274[_0x48e5('0x69')](_0x27803b[_0x48e5('0x41')]['ids']);}})[_0x48e5('0x32')](respondWithStatusCode(_0x5802bf,null))[_0x48e5('0x28')](handleError(_0x5802bf,null));};exports[_0x48e5('0x6a')]=function(_0x2c5e8c,_0x31ace9,_0x94d822){if(_0x2c5e8c[_0x48e5('0x57')]['id']){delete _0x2c5e8c[_0x48e5('0x57')]['id'];}return db[_0x48e5('0x3a')][_0x48e5('0x56')]({'where':{'id':_0x2c5e8c[_0x48e5('0x55')]['id']}})['then'](handleEntityNotFound(_0x31ace9,null))[_0x48e5('0x32')](function(_0x548e09){if(_0x548e09){_0x2c5e8c['body']['WhatsappAccountId']=_0x548e09['id'];return db[_0x48e5('0x6b')][_0x48e5('0x60')](_0x2c5e8c['body']);}})[_0x48e5('0x32')](respondWithResult(_0x31ace9,null))[_0x48e5('0x28')](handleError(_0x31ace9,null));};exports[_0x48e5('0x6c')]=function(_0x5d1163,_0x1ed8aa,_0x292c78){var _0x2a8f92={'raw':![],'where':{}};var _0x562e6d={};var _0xf46bd0={'count':0x0,'rows':[]};return db[_0x48e5('0x3a')]['findOne']({'where':{'id':_0x5d1163[_0x48e5('0x55')]['id']}})[_0x48e5('0x32')](handleEntityNotFound(_0x1ed8aa,null))['then'](function(_0x1ce123){if(_0x1ce123){_0x562e6d['model']=_[_0x48e5('0x42')](db[_0x48e5('0x6b')][_0x48e5('0x3b')]);_0x562e6d[_0x48e5('0x41')]=_[_0x48e5('0x42')](_0x5d1163[_0x48e5('0x41')]);_0x562e6d[_0x48e5('0x43')]=_[_0x48e5('0x44')](_0x562e6d[_0x48e5('0x3f')],_0x562e6d[_0x48e5('0x41')]);_0x2a8f92[_0x48e5('0x45')]=_[_0x48e5('0x44')](_0x562e6d[_0x48e5('0x3f')],qs['fields'](_0x5d1163['query'][_0x48e5('0x46')]));_0x2a8f92['attributes']=_0x2a8f92['attributes'][_0x48e5('0x47')]?_0x2a8f92[_0x48e5('0x45')]:_0x562e6d[_0x48e5('0x3f')];if(!_0x5d1163[_0x48e5('0x41')][_0x48e5('0x6d')](_0x48e5('0x48'))){_0x2a8f92[_0x48e5('0x2e')]=qs[_0x48e5('0x2e')](_0x5d1163['query'][_0x48e5('0x2e')]);_0x2a8f92['offset']=qs['offset'](_0x5d1163['query'][_0x48e5('0x2c')]);}_0x2a8f92['order']=qs[_0x48e5('0x4a')](_0x5d1163['query'][_0x48e5('0x4a')]);_0x2a8f92['where']=qs[_0x48e5('0x43')](_['pick'](_0x5d1163[_0x48e5('0x41')],_0x562e6d[_0x48e5('0x43')]));_0x2a8f92['where'][_0x48e5('0x68')]=_0x1ce123['id'];if(_0x5d1163[_0x48e5('0x41')][_0x48e5('0x4c')]){_0x2a8f92[_0x48e5('0x4d')]=_[_0x48e5('0x4e')](_0x2a8f92[_0x48e5('0x4d')],{'$or':_[_0x48e5('0x40')](_0x2a8f92['attributes'],function(_0x2fc2b5){var _0x2ca53b={};_0x2ca53b[_0x2fc2b5]={'$like':'%'+_0x5d1163['query'][_0x48e5('0x4c')]+'%'};return _0x2ca53b;})});}_0x2a8f92=_[_0x48e5('0x4e')]({},_0x2a8f92,_0x5d1163[_0x48e5('0x6e')]);return db['CannedAnswer']['count']({'where':_0x2a8f92[_0x48e5('0x4d')]})[_0x48e5('0x32')](function(_0x2824a5){_0xf46bd0[_0x48e5('0x2f')]=_0x2824a5;if(_0x5d1163[_0x48e5('0x41')][_0x48e5('0x50')]){_0x2a8f92[_0x48e5('0x51')]=[{'all':!![]}];}return db[_0x48e5('0x6b')][_0x48e5('0x52')](_0x2a8f92);})['then'](function(_0x3fb8fd){_0xf46bd0['rows']=_0x3fb8fd;return _0xf46bd0;});}})[_0x48e5('0x32')](respondWithFilteredResult(_0x1ed8aa,_0x2a8f92))[_0x48e5('0x28')](handleError(_0x1ed8aa,null));};exports[_0x48e5('0x6f')]=function(_0x15ce35,_0xac5035,_0x2644d7){return db[_0x48e5('0x3a')][_0x48e5('0x56')]({'where':{'id':_0x15ce35[_0x48e5('0x55')]['id']}})[_0x48e5('0x32')](handleEntityNotFound(_0xac5035,null))['then'](function(_0x3ce7a2){if(_0x3ce7a2){return _0x3ce7a2['removeAnswers'](_0x15ce35['query'][_0x48e5('0x70')]);}})[_0x48e5('0x32')](respondWithStatusCode(_0xac5035,null))[_0x48e5('0x28')](handleError(_0xac5035,null));};exports[_0x48e5('0x71')]=function(_0x42bc59,_0x290204,_0x13fe67){return db['WhatsappAccount'][_0x48e5('0x56')]({'where':{'id':_0x42bc59['params']['id']}})[_0x48e5('0x32')](handleEntityNotFound(_0x290204,null))[_0x48e5('0x32')](function(_0x391342){if(_0x391342){return _0x391342['addAgents'](_0x42bc59['body']['ids'],_[_0x48e5('0x72')](_0x42bc59[_0x48e5('0x57')],[_0x48e5('0x70'),'id'])||{})[_0x48e5('0x73')](function(_0x459142){for(var _0x236c15=0x0;_0x236c15<_0x42bc59[_0x48e5('0x57')][_0x48e5('0x70')]['length'];_0x236c15+=0x1){socket['emit'](_0x48e5('0x74'),{'UserId':Number(_0x42bc59['body']['ids'][_0x236c15]),'WhatsappAccountId':Number(_0x42bc59[_0x48e5('0x55')]['id'])});}return _0x459142;});}})['then'](respondWithResult(_0x290204,null))[_0x48e5('0x28')](handleError(_0x290204,null));};exports[_0x48e5('0x75')]=function(_0x54cb36,_0x30c9d5,_0xcfa248){return db[_0x48e5('0x3a')]['find']({'where':{'id':_0x54cb36[_0x48e5('0x55')]['id']}})[_0x48e5('0x32')](handleEntityNotFound(_0x30c9d5,null))[_0x48e5('0x32')](function(_0x443350){if(_0x443350){return _0x443350[_0x48e5('0x75')](_0x54cb36[_0x48e5('0x41')][_0x48e5('0x70')])['then'](function(){if(_[_0x48e5('0x76')](_0x54cb36[_0x48e5('0x41')][_0x48e5('0x70')])){for(var _0x3ec0c7=0x0;_0x3ec0c7<_0x54cb36['query'][_0x48e5('0x70')][_0x48e5('0x47')];_0x3ec0c7+=0x1){socket['emit'](_0x48e5('0x77'),{'UserId':Number(_0x54cb36[_0x48e5('0x41')]['ids'][_0x3ec0c7]),'WhatsappAccountId':Number(_0x54cb36[_0x48e5('0x55')]['id'])});}}else{socket[_0x48e5('0x78')](_0x48e5('0x77'),{'UserId':Number(_0x54cb36[_0x48e5('0x41')]['ids']),'WhatsappAccountId':Number(_0x54cb36['params']['id'])});}});}})[_0x48e5('0x32')](respondWithStatusCode(_0x30c9d5,null))[_0x48e5('0x28')](handleError(_0x30c9d5,null));};exports[_0x48e5('0x79')]=function(_0x9eb984,_0x4ecd16,_0x16310e){var _0x1c2843={};var _0xc33750={};var _0x23dac8;var _0x579bfd;return db[_0x48e5('0x3a')]['findOne']({'where':{'id':_0x9eb984[_0x48e5('0x55')]['id']}})['then'](handleEntityNotFound(_0x4ecd16,null))['then'](function(_0x5e7905){if(_0x5e7905){_0x23dac8=_0x5e7905;_0xc33750[_0x48e5('0x3f')]=_[_0x48e5('0x42')](db['User'][_0x48e5('0x3b')]);_0xc33750[_0x48e5('0x41')]=_[_0x48e5('0x42')](_0x9eb984[_0x48e5('0x41')]);_0xc33750[_0x48e5('0x43')]=_['intersection'](_0xc33750['model'],_0xc33750[_0x48e5('0x41')]);_0x1c2843['attributes']=_[_0x48e5('0x44')](_0xc33750['model'],qs[_0x48e5('0x46')](_0x9eb984['query'][_0x48e5('0x46')]));_0x1c2843['attributes']=_0x1c2843[_0x48e5('0x45')][_0x48e5('0x47')]?_0x1c2843[_0x48e5('0x45')]:_0xc33750[_0x48e5('0x3f')];_0x1c2843[_0x48e5('0x49')]=qs['sort'](_0x9eb984[_0x48e5('0x41')][_0x48e5('0x4a')]);_0x1c2843[_0x48e5('0x4d')]=qs['filters'](_['pick'](_0x9eb984[_0x48e5('0x41')],_0xc33750[_0x48e5('0x43')]));if(_0x9eb984[_0x48e5('0x41')][_0x48e5('0x4c')]){_0x1c2843['where']=_['merge'](_0x1c2843[_0x48e5('0x4d')],{'$or':_[_0x48e5('0x40')](_0x1c2843[_0x48e5('0x45')],function(_0xa22c6e){var _0x3793e2={};_0x3793e2[_0xa22c6e]={'$like':'%'+_0x9eb984[_0x48e5('0x41')][_0x48e5('0x4c')]+'%'};return _0x3793e2;})});}_0x1c2843=_[_0x48e5('0x4e')]({},_0x1c2843,_0x9eb984[_0x48e5('0x6e')]);return _0x23dac8['getAgents'](_0x1c2843);}})[_0x48e5('0x32')](function(_0x1624ab){if(_0x1624ab){_0x579bfd=_0x1624ab[_0x48e5('0x47')];if(!_0x9eb984[_0x48e5('0x41')][_0x48e5('0x6d')](_0x48e5('0x48'))){_0x1c2843[_0x48e5('0x2e')]=qs[_0x48e5('0x2e')](_0x9eb984[_0x48e5('0x41')]['limit']);_0x1c2843[_0x48e5('0x2c')]=qs[_0x48e5('0x2c')](_0x9eb984['query'][_0x48e5('0x2c')]);}return _0x23dac8[_0x48e5('0x79')](_0x1c2843);}})[_0x48e5('0x32')](function(_0x171178){if(_0x171178){return _0x171178?{'count':_0x579bfd,'rows':_0x171178}:null;}})[_0x48e5('0x32')](respondWithResult(_0x4ecd16,null))[_0x48e5('0x28')](handleError(_0x4ecd16,null));};exports[_0x48e5('0x7a')]=function(_0x344a1d,_0x1d1115){var _0x332bcb=_0x344a1d[_0x48e5('0x55')]['id'];var _0x28ef87=_0x344a1d[_0x48e5('0x57')];var _0x2ce6b7=0xc8;var _0x2287ee=null;return db['sequelize'][_0x48e5('0x7b')]({'isolationLevel':db[_0x48e5('0x7c')]['Transaction'][_0x48e5('0x7d')][_0x48e5('0x7e')]},function(_0x3d367b){return db[_0x48e5('0x3a')][_0x48e5('0x67')]({'where':{'id':_0x332bcb},'transaction':_0x3d367b})[_0x48e5('0x32')](function(_0x42c15b){if(_0x42c15b){return db[_0x48e5('0x7f')]['destroy']({'where':{'WhatsappAccountId':_0x332bcb},'transaction':_0x3d367b})[_0x48e5('0x32')](function(){var _0x240469=_['map'](_0x28ef87,function(_0x2cc8e8){_0x2cc8e8[_0x48e5('0x68')]=_0x332bcb;return _0x2cc8e8;});return db[_0x48e5('0x7f')][_0x48e5('0x80')](_0x240469,{'transaction':_0x3d367b});});}else{_0x2ce6b7=0x194;_0x2287ee=[];}});})['then'](function(){if(_0x2ce6b7!==0x194){return db[_0x48e5('0x7f')][_0x48e5('0x81')]({'where':{'WhatsappAccountId':_0x332bcb},'order':_0x48e5('0x82')})[_0x48e5('0x32')](function(_0x270608){_0x2287ee=_0x270608;});}})['catch'](function(_0x680a5d){_0x2ce6b7=0x1f4;logger[_0x48e5('0x24')](_0x680a5d['stack']);if(_0x680a5d['name']){delete _0x680a5d[_0x48e5('0x37')];}_0x2287ee=_0x680a5d;})[_0x48e5('0x83')](function(){if(_0x2287ee===null){_0x1d1115[_0x48e5('0x35')](_0x2ce6b7);}else{if(_0x2ce6b7===0x1f4){_0x1d1115['status'](_0x2ce6b7)[_0x48e5('0x84')](_0x2287ee);}else{_0x1d1115[_0x48e5('0x29')](_0x2ce6b7)[_0x48e5('0x2b')](_0x2287ee);}}});};exports[_0x48e5('0x85')]=function(_0x5ba9ae,_0x201b37,_0x71949c){var _0x457a42={};var _0x414694={};var _0x31f6ff;var _0x349001;return db[_0x48e5('0x3a')][_0x48e5('0x67')]({'where':{'id':_0x5ba9ae[_0x48e5('0x55')]['id']}})[_0x48e5('0x32')](handleEntityNotFound(_0x201b37,null))[_0x48e5('0x32')](function(_0x4232c1){if(_0x4232c1){_0x31f6ff=_0x4232c1;_0x414694[_0x48e5('0x3f')]=_['keys'](db[_0x48e5('0x7f')][_0x48e5('0x3b')]);_0x414694[_0x48e5('0x41')]=_['keys'](_0x5ba9ae[_0x48e5('0x41')]);_0x414694['filters']=_[_0x48e5('0x44')](_0x414694[_0x48e5('0x3f')],_0x414694[_0x48e5('0x41')]);_0x457a42['attributes']=_[_0x48e5('0x44')](_0x414694[_0x48e5('0x3f')],qs['fields'](_0x5ba9ae[_0x48e5('0x41')][_0x48e5('0x46')]));_0x457a42[_0x48e5('0x45')]=_0x457a42[_0x48e5('0x45')][_0x48e5('0x47')]?_0x457a42[_0x48e5('0x45')]:_0x414694[_0x48e5('0x3f')];_0x457a42['order']=qs[_0x48e5('0x4a')](_0x5ba9ae[_0x48e5('0x41')][_0x48e5('0x4a')]);_0x457a42[_0x48e5('0x4d')]=qs[_0x48e5('0x43')](_[_0x48e5('0x4b')](_0x5ba9ae[_0x48e5('0x41')],_0x414694[_0x48e5('0x43')]));if(_0x5ba9ae[_0x48e5('0x41')]['filter']){_0x457a42['where']=_[_0x48e5('0x4e')](_0x457a42[_0x48e5('0x4d')],{'$or':_[_0x48e5('0x40')](_0x457a42[_0x48e5('0x45')],function(_0x1553dc){var _0x49e6f7={};_0x49e6f7[_0x1553dc]={'$like':'%'+_0x5ba9ae[_0x48e5('0x41')][_0x48e5('0x4c')]+'%'};return _0x49e6f7;})});}_0x457a42=_[_0x48e5('0x4e')]({},_0x457a42,_0x5ba9ae[_0x48e5('0x6e')]);return _0x31f6ff[_0x48e5('0x85')](_0x457a42);}})[_0x48e5('0x32')](function(_0x2d78e6){if(_0x2d78e6){_0x349001=_0x2d78e6[_0x48e5('0x47')];if(!_0x5ba9ae[_0x48e5('0x41')][_0x48e5('0x6d')](_0x48e5('0x48'))){_0x457a42['limit']=qs[_0x48e5('0x2e')](_0x5ba9ae[_0x48e5('0x41')][_0x48e5('0x2e')]);_0x457a42[_0x48e5('0x2c')]=qs['offset'](_0x5ba9ae[_0x48e5('0x41')][_0x48e5('0x2c')]);}return _0x31f6ff[_0x48e5('0x85')](_0x457a42);}})[_0x48e5('0x32')](function(_0x1132b1){if(_0x1132b1){return _0x1132b1?{'count':_0x349001,'rows':_0x1132b1}:null;}})[_0x48e5('0x32')](respondWithResult(_0x201b37,null))[_0x48e5('0x28')](handleError(_0x201b37,null));};exports[_0x48e5('0x86')]=function(_0x1c6fb8,_0x13b839,_0x375a41){var _0x77dc7b={'channel':_0x48e5('0x87')};var _0x60efc9=[];var _0x3241e5=[];var _0x48e857={};return db[_0x48e5('0x3a')][_0x48e5('0x56')]({'where':{'id':_0x1c6fb8[_0x48e5('0x55')]['id']},'include':[{'model':db[_0x48e5('0x7f')],'as':_0x48e5('0x88')}]})[_0x48e5('0x32')](handleEntityNotFound(_0x13b839,null))['then'](function(_0x56df77){_0x77dc7b['account']=_0x56df77;if(_0x77dc7b[_0x48e5('0x89')]&&_0x77dc7b[_0x48e5('0x89')][_0x48e5('0x3d')]===_0x48e5('0x8a')&&_0x1c6fb8['body'][_0x48e5('0x8b')]){if(_0x1c6fb8[_0x48e5('0x57')][_0x48e5('0x8b')][_0x48e5('0x47')]===0x0)return;if(_0x1c6fb8['body'][_0x48e5('0x8b')][0x0][_0x48e5('0x8c')]!=='read')return;return db[_0x48e5('0x8d')][_0x48e5('0x62')]({'read':!![],'readAt':_0x1c6fb8[_0x48e5('0x57')]['statuses'][0x0][_0x48e5('0x8e')]},{'where':{'messageId':_0x1c6fb8[_0x48e5('0x57')][_0x48e5('0x8b')][0x0][_0x48e5('0x8f')]},'individualHooks':!![]})[_0x48e5('0x32')](function(_0x3e0191){return _0x13b839[_0x48e5('0x29')](0xc8)['json'](_0x3e0191);});}_0x77dc7b[_0x48e5('0x90')]=_[_0x48e5('0x91')](_0x56df77[_0x48e5('0x88')],['priority'],[_0x48e5('0x92')]);if(_0x77dc7b[_0x48e5('0x89')]['Applications']){delete _0x77dc7b['account'][_0x48e5('0x88')];}return db[_0x48e5('0x93')][_0x48e5('0x63')]()[_0x48e5('0x32')](function(_0x31eaa2){if(!_0x31eaa2){throw new db[(_0x48e5('0x94'))][(_0x48e5('0x95'))](_0x48e5('0x96'));}_0x60efc9=_[_0x48e5('0x97')](_[_0x48e5('0x42')](_0x31eaa2),[_0x48e5('0x98'),_0x48e5('0x99')]);_0x3241e5=_[_0x48e5('0x97')](_[_0x48e5('0x42')](_0x31eaa2),[_0x48e5('0x98'),_0x48e5('0x99'),_0x48e5('0x9a'),_0x48e5('0x9b')]);_0x77dc7b['body']={'mapKey':_0x48e5('0x9c')};if(_0x77dc7b[_0x48e5('0x89')]&&_0x77dc7b['account'][_0x48e5('0x3d')]===_0x48e5('0x9d')){_0x77dc7b[_0x48e5('0x57')]['from']=_0x1c6fb8['body'][_0x48e5('0x9e')][_0x48e5('0x9f')]('whatsapp:','');_0x77dc7b['body'][_0x48e5('0x57')]=_0x1c6fb8[_0x48e5('0x57')][_0x48e5('0xa0')];_0x77dc7b[_0x48e5('0x57')]['messageId']=_0x1c6fb8['body'][_0x48e5('0xa1')];}if(_0x77dc7b[_0x48e5('0x89')]&&_0x77dc7b[_0x48e5('0x89')][_0x48e5('0x3d')]===_0x48e5('0x8a')){_0x77dc7b[_0x48e5('0x57')]['from']=_0x1c6fb8[_0x48e5('0x57')]['notifications'][0x0][_0x48e5('0xa2')];_0x77dc7b[_0x48e5('0x57')]['body']=_0x1c6fb8[_0x48e5('0x57')][_0x48e5('0xa3')][0x0]['message']['body'];_0x77dc7b['body'][_0x48e5('0xa4')]=_0x1c6fb8[_0x48e5('0x57')]['notifications'][0x0][_0x48e5('0x8f')];}if(_0x77dc7b[_0x48e5('0x57')]['id']){delete _0x77dc7b[_0x48e5('0x57')]['id'];}if(_[_0x48e5('0xa5')](_0x77dc7b[_0x48e5('0x57')]['from'])){throw new db[(_0x48e5('0x94'))][(_0x48e5('0x95'))](_0x48e5('0xa6'));}if(_[_0x48e5('0xa5')](_0x77dc7b[_0x48e5('0x57')]['body'])||_0x77dc7b[_0x48e5('0x57')][_0x48e5('0x57')]===''){throw new db[(_0x48e5('0x94'))][(_0x48e5('0x95'))]('body\x20is\x20mandatory\x20and\x20not\x20empty');}if(_[_0x48e5('0xa5')](_0x77dc7b['body'][_0x48e5('0xa7')])){throw new db[(_0x48e5('0x94'))][(_0x48e5('0x95'))](_0x48e5('0xa8')+_0x3241e5);}if(!_['includes'](_0x3241e5,_0x77dc7b[_0x48e5('0x57')]['mapKey'])){throw new db['Sequelize']['ValidationError'](_0x48e5('0xa9')+_0x3241e5);}_0x48e857[_0x77dc7b[_0x48e5('0x57')][_0x48e5('0xa7')]]=_0x77dc7b[_0x48e5('0x57')][_0x48e5('0xa2')];return db[_0x48e5('0xaa')][_0x48e5('0x56')]({'where':{'id':_0x77dc7b[_0x48e5('0x89')]['ListId']},'include':[{'model':db[_0x48e5('0x93')],'as':_0x48e5('0xab'),'where':_0x48e857,'limit':0x1,'order':[[_0x48e5('0x99'),_0x48e5('0xac')]]}]});})[_0x48e5('0x32')](handleEntityNotFound(_0x13b839,null))[_0x48e5('0x32')](function(_0x20c73a){if(_0x20c73a){_0x77dc7b[_0x48e5('0xad')]=_[_0x48e5('0x72')](_0x20c73a,[_0x48e5('0xab')]);if(_0x20c73a['Contacts'][_0x48e5('0x47')]){return _0x20c73a[_0x48e5('0xab')][0x0];}var _0xaaddce=_[_0x48e5('0x19')](_0x77dc7b[_0x48e5('0x57')],{'firstName':_0x77dc7b[_0x48e5('0x57')]['from'],'ListId':_0x20c73a['id']});_0xaaddce[_0x77dc7b['body'][_0x48e5('0xa7')]]=_0x77dc7b[_0x48e5('0x57')][_0x48e5('0xa2')];return db[_0x48e5('0x93')][_0x48e5('0x60')](_0xaaddce,{'fields':_0x60efc9,'raw':!![]});}})[_0x48e5('0x32')](handleEntityNotFound(_0x13b839,null))[_0x48e5('0x32')](function(_0x28521a){if(_0x28521a){_0x77dc7b[_0x48e5('0xae')]=_0x28521a;var _0x41030c={'ContactId':_0x28521a['id'],'phone':_0x77dc7b[_0x48e5('0x57')][_0x48e5('0xa2')],'WhatsappAccountId':_0x1c6fb8[_0x48e5('0x55')]['id']};var _0x25c1ec={'ContactId':_0x28521a['id'],'WhatsappAccountId':_0x1c6fb8['params']['id'],'closed':![]};return db['WhatsappInteraction'][_0x48e5('0x56')]({'where':_0x25c1ec})[_0x48e5('0x32')](function(_0x1a75b7){if(_0x1a75b7){return[_0x1a75b7,![]];}return db['WhatsappInteraction']['create'](_0x41030c)[_0x48e5('0x32')](function(_0x21f15d){return[_0x21f15d,!![]];});});}})[_0x48e5('0x73')](function(_0x3dd2a3,_0x173151){_0x77dc7b[_0x48e5('0xaf')]=_0x3dd2a3[_0x48e5('0x59')]({'plain':!![]});_0x77dc7b[_0x48e5('0xaf')]['created']=![];if(_0x173151){if(_0x77dc7b[_0x48e5('0x89')][_0x48e5('0xb0')]){_0x77dc7b[_0x48e5('0x90')][_0x48e5('0xb1')]({'id':0x0,'priority':_0x77dc7b[_0x48e5('0x90')][_0x48e5('0x47')]+0x1,'app':_0x48e5('0xb2'),'appdata':'unmanaged','interval':_0x48e5('0xb3')});}_0x77dc7b[_0x48e5('0xaf')]['created']=!![];}return db[_0x48e5('0x8d')]['create']({'phone':_0x77dc7b[_0x48e5('0x57')][_0x48e5('0xa2')],'messageId':_0x77dc7b[_0x48e5('0x57')][_0x48e5('0xa4')],'body':_0x77dc7b[_0x48e5('0x57')][_0x48e5('0x57')],'WhatsappAccountId':_0x1c6fb8[_0x48e5('0x55')]['id'],'WhatsappInteractionId':_0x3dd2a3['id'],'direction':'in','ContactId':_0x3dd2a3['ContactId'],'AttachmentId':_0x77dc7b[_0x48e5('0x57')]['AttachmentId']});})[_0x48e5('0x32')](function(_0x7551d8){_0x77dc7b[_0x48e5('0x26')]=_0x7551d8;if(!_0x77dc7b[_0x48e5('0xaf')][_0x48e5('0xb4')])return;return db[_0x48e5('0xb5')][_0x48e5('0x56')]({'attributes':['id',_0x48e5('0x37')],'where':{'id':_0x77dc7b[_0x48e5('0xaf')][_0x48e5('0xb4')]}});})['then'](function(_0x23d755){if(_0x23d755){_0x77dc7b[_0x48e5('0x90')]['unshift']({'id':0x0,'priority':0x0,'app':_0x48e5('0xb6'),'appdata':_0x23d755[_0x48e5('0x37')]+','+(_0x77dc7b['account'][_0x48e5('0xb7')]||0xa),'interval':_0x48e5('0xb3')});}if(!_0x77dc7b['interaction']['queueId'])return;return db['WhatsappQueue']['find']({'attributes':['id',_0x48e5('0x37')],'where':{'id':_0x77dc7b[_0x48e5('0xaf')]['queueId']}});})['then'](function(_0x6a33da){if(_0x6a33da){_0x77dc7b[_0x48e5('0x90')][_0x48e5('0xb8')]({'id':0x0,'priority':0x1,'app':_0x48e5('0xb9'),'appdata':_0x6a33da[_0x48e5('0x37')]+','+(_0x77dc7b[_0x48e5('0x89')][_0x48e5('0xba')]||0x12c),'interval':'*,*,*,*'});}return respondWithRpcPromise('Start','startRouting',_0x77dc7b);})[_0x48e5('0x32')](function(_0x4f9d5d){if(_0x4f9d5d){var _0x313c27=0xc8;var _0x1664ef=_0x48e5('0xbb');logger[_0x48e5('0x20')](_0x48e5('0x23'),_0x1664ef,_0x313c27,'entity\x20found');logger[_0x48e5('0xbc')](_0x48e5('0xbd'),_0x1664ef,_0x313c27,_0x48e5('0xbe'),JSON[_0x48e5('0xbf')](_0x4f9d5d));if(_0x77dc7b['account'][_0x48e5('0x3d')]==='twilio'){return _0x13b839[_0x48e5('0x29')](_0x313c27)[_0x48e5('0xc0')](_0x48e5('0xc1'),_0x48e5('0xc2'))[_0x48e5('0x84')]('\x0a');}else{return _0x13b839[_0x48e5('0x29')](_0x313c27)[_0x48e5('0x2b')](_0x4f9d5d);}}});})[_0x48e5('0x28')](handleError(_0x13b839,null));};exports[_0x48e5('0x84')]=function(_0x5008ef,_0x8ece25,_0x198a5b){var _0x479fe6,_0x285134,_0x472305;if(_[_0x48e5('0xa5')](_0x5008ef[_0x48e5('0x57')][_0x48e5('0x57')])||_0x5008ef[_0x48e5('0x57')]['body']===''){throw new db['Sequelize'][(_0x48e5('0x95'))]('body\x20is\x20mandatory\x20and\x20not\x20empty');}if(_[_0x48e5('0xa5')](_0x5008ef[_0x48e5('0x57')]['to'])){throw new db[(_0x48e5('0x94'))]['ValidationError'](_0x48e5('0xc3'));}_0x479fe6=_0x5008ef['body']['to'];return db[_0x48e5('0x3a')][_0x48e5('0x56')]({'where':{'id':_0x5008ef[_0x48e5('0x55')]['id']},'include':[{'model':db[_0x48e5('0xaa')],'as':_0x48e5('0xc4'),'include':[{'model':db[_0x48e5('0x93')],'as':_0x48e5('0xab'),'where':{'mobile':_0x479fe6},'limit':0x1,'order':[[_0x48e5('0x99'),_0x48e5('0xac')]]}]}]})['then'](handleEntityNotFound(_0x8ece25,null))['then'](function(_0x180e24){if(_0x180e24&&_0x180e24[_0x48e5('0xc4')]){_0x285134=_0x180e24[_0x48e5('0x59')]({'plain':!![]});if(_0x285134[_0x48e5('0xc4')]&&_0x285134[_0x48e5('0xc4')]['Contacts'][_0x48e5('0x47')]){return _0x285134[_0x48e5('0xc4')][_0x48e5('0xab')][0x0];}return db[_0x48e5('0x93')][_0x48e5('0x60')](_[_0x48e5('0x19')](_0x5008ef['body'],{'firstName':_0x479fe6,'mobile':_0x479fe6,'phone':_0x479fe6,'ListId':_0x285134[_0x48e5('0x9b')]}));}})[_0x48e5('0x32')](handleEntityNotFound(_0x8ece25,null))[_0x48e5('0x32')](function(_0x2e51ff){if(_0x2e51ff){_0x472305=_0x2e51ff;return db[_0x48e5('0xc5')][_0x48e5('0x56')]({'where':{'ContactId':_0x472305['id'],'closed':![],'WhatsappAccountId':_0x285134['id']}})[_0x48e5('0x32')](function(_0x1e3dda){if(_0x1e3dda){return[_0x1e3dda,![]];}return db['WhatsappInteraction'][_0x48e5('0x60')]({'UserId':_0x5008ef[_0x48e5('0x58')]['id'],'ContactId':_0x472305['id'],'WhatsappAccountId':_0x285134['id'],'phone':_0x479fe6,'firstMsgDirection':_0x48e5('0xc6'),'Messages':[_['merge'](_0x5008ef[_0x48e5('0x57')],{'read':![],'body':_0x5008ef[_0x48e5('0x57')][_0x48e5('0x57')],'phone':_0x479fe6,'WhatsappAccountId':_0x285134['id'],'UserId':_0x5008ef[_0x48e5('0x58')]['id'],'ContactId':_0x472305['id']})]},{'include':[{'model':db[_0x48e5('0x8d')],'as':'Messages'}]})['then'](function(_0x41d0d7){return[_0x41d0d7,!![]];});});}})[_0x48e5('0x73')](function(_0x32b508,_0x45d211){if(_0x45d211){return _0x32b508;}return db['WhatsappMessage'][_0x48e5('0x60')](_[_0x48e5('0x4e')](_0x5008ef['body'],{'read':![],'body':_0x5008ef[_0x48e5('0x57')]['body'],'phone':_0x479fe6,'WhatsappAccountId':_0x285134['id'],'WhatsappInteractionId':_0x32b508['id'],'UserId':_0x5008ef[_0x48e5('0x58')]['id'],'ContactId':_0x472305['id']}))[_0x48e5('0x32')](function(_0x464cc6){_0x32b508[_0x48e5('0xc7')][_0x48e5('0xc8')]=[];_0x32b508[_0x48e5('0xc7')][_0x48e5('0xc8')][_0x48e5('0xb1')](_0x464cc6[_0x48e5('0xc7')]);return _0x32b508;});})[_0x48e5('0x32')](respondWithResult(_0x8ece25,null))[_0x48e5('0x28')](handleError(_0x8ece25,null));}; \ No newline at end of file +var _0xb44f=['status','end','json','offset','undefined','count','limit','set','apply','reject','save','update','destroy','get','name','send','index','Pause','mandatoryDispositionPause','map','type','key','model','query','filters','intersection','fields','attributes','length','nolimit','sort','where','filter','merge','VIRTUAL','options','WhatsappAccount','includeAll','include','findAll','rows','catch','show','keys','create','body','user','Unable\x20to\x20retrieve\x20the\x20current\x20user','role','WhatsappAccounts','UserProfileSection','find','userProfileId','UserProfileResource','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','params','describe','addDisposition','WhatsappAccountId','Disposition','getDispositions','findOne','rawAttributes','hasOwnProperty','order','pick','removeDispositions','CannedAnswer','removeAnswers','ids','addAgents','omit','spread','emit','userWhatsappAccount:save','removeAgents','isArray','userWhatsappAccount:remove','getAgents','User','addApplications','sequelize','Transaction','ISOLATION_LEVELS','READ_COMMITTED','WhatsappApplication','bulkCreate','priority','finally','sendStatus','getApplications','notify','whatsapp','Applications','account','sinch','statuses','state','WhatsappMessage','timestamp','message_id','asc','CmContact','ValidationError','no\x20available\x20attributes','difference','createdAt','updatedAt','CompanyId','ListId','mobile','twilio','From','replace','whatsapp:','messageId','MessageSid','notifications','from','isNil','Sequelize','from\x20is\x20mandatory','body\x20is\x20mandatory\x20and\x20not\x20empty','mapKey','mapKey\x20invalid,\x20please\x20use\x20one\x20of\x20these:\x20','CmList','DESC','list','Contacts','contact','WhatsappInteraction','created','applications','close','interaction','ContactId','UserId','unshift','waitForTheAssignedAgent','*,*,*,*','queueId','WhatsappQueue','queue','waitForTheAssignedQueue','startRouting','receiveMessage','entity\x20found','Content-Type','text/xml','\x0a','to\x20is\x20mandatory','List','out','Messages','dataValues','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','moment','bluebird','mustache','util','path','sox','ejs','lodash','squel','crypto','jsforce','desk.js','to-csv','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/logger','api','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','redis','defaults','localhost','./whatsappAccount.socket','jayson/promise','client','then','info','WhatsappAccount,\x20%s,\x20%s','request\x20sent','debug','WhatsappAccount,\x20%s,\x20%s,\x20%s','stringify','error','code','message','result'];(function(_0x593d89,_0x45145f){var _0x4aa403=function(_0x21f674){while(--_0x21f674){_0x593d89['push'](_0x593d89['shift']());}};_0x4aa403(++_0x45145f);}(_0xb44f,0x165));var _0xfb44=function(_0x6131cd,_0x4c26a1){_0x6131cd=_0x6131cd-0x0;var _0x47e916=_0xb44f[_0x6131cd];return _0x47e916;};'use strict';var emlformat=require(_0xfb44('0x0'));var rimraf=require(_0xfb44('0x1'));var zipdir=require(_0xfb44('0x2'));var jsonpatch=require(_0xfb44('0x3'));var rp=require(_0xfb44('0x4'));var moment=require(_0xfb44('0x5'));var BPromise=require(_0xfb44('0x6'));var Mustache=require(_0xfb44('0x7'));var util=require(_0xfb44('0x8'));var path=require(_0xfb44('0x9'));var sox=require(_0xfb44('0xa'));var csv=require('to-csv');var ejs=require(_0xfb44('0xb'));var fs=require('fs');var fs_extra=require('fs-extra');var _=require(_0xfb44('0xc'));var squel=require(_0xfb44('0xd'));var crypto=require(_0xfb44('0xe'));var jsforce=require(_0xfb44('0xf'));var deskjs=require(_0xfb44('0x10'));var toCsv=require(_0xfb44('0x11'));var querystring=require(_0xfb44('0x12'));var Papa=require(_0xfb44('0x13'));var Redis=require(_0xfb44('0x14'));var authService=require(_0xfb44('0x15'));var qs=require(_0xfb44('0x16'));var as=require(_0xfb44('0x17'));var hardwareService=require('../../config/license/hardware');var logger=require(_0xfb44('0x18'))(_0xfb44('0x19'));var utils=require(_0xfb44('0x1a'));var config=require(_0xfb44('0x1b'));var licenseUtil=require(_0xfb44('0x1c'));var db=require(_0xfb44('0x1d'))['db'];config[_0xfb44('0x1e')]=_[_0xfb44('0x1f')](config[_0xfb44('0x1e')],{'host':_0xfb44('0x20'),'port':0x18eb});var socket=require('socket.io-emitter')(new Redis(config['redis']));require(_0xfb44('0x21'))['register'](socket);var jayson=require(_0xfb44('0x22'));var client=jayson[_0xfb44('0x23')]['http']({'port':0x232c});function respondWithRpcPromise(_0xe36caa,_0x4ea838,_0x4b23fe,_0x281289){return new BPromise(function(_0x158829,_0x56e32c){var _0x34b6e9=_0x281289||client;return _0x34b6e9['request'](_0xe36caa,_0x4b23fe)[_0xfb44('0x24')](function(_0x20987f){logger[_0xfb44('0x25')](_0xfb44('0x26'),_0x4ea838,_0xfb44('0x27'));logger[_0xfb44('0x28')](_0xfb44('0x29'),_0x4ea838,_0xfb44('0x27'),JSON[_0xfb44('0x2a')](_0x20987f));if(_0x20987f[_0xfb44('0x2b')]){if(_0x20987f[_0xfb44('0x2b')][_0xfb44('0x2c')]===0x1f4){logger[_0xfb44('0x2b')](_0xfb44('0x26'),_0x4ea838,_0x20987f[_0xfb44('0x2b')][_0xfb44('0x2d')]);return _0x56e32c(_0x20987f[_0xfb44('0x2b')][_0xfb44('0x2d')]);}logger[_0xfb44('0x2b')]('WhatsappAccount,\x20%s,\x20%s',_0x4ea838,_0x20987f[_0xfb44('0x2b')][_0xfb44('0x2d')]);return _0x158829(_0x20987f[_0xfb44('0x2b')][_0xfb44('0x2d')]);}else{logger[_0xfb44('0x25')](_0xfb44('0x26'),_0x4ea838,_0xfb44('0x27'));_0x158829(_0x20987f[_0xfb44('0x2e')][_0xfb44('0x2d')]);}})['catch'](function(_0x2da8c7){logger[_0xfb44('0x2b')](_0xfb44('0x26'),_0x4ea838,_0x2da8c7);_0x56e32c(_0x2da8c7);});});}function respondWithStatusCode(_0x5a8bba,_0x165a80){_0x165a80=_0x165a80||0xcc;return function(_0x5b6222){if(_0x5b6222){return _0x5a8bba['sendStatus'](_0x165a80);}return _0x5a8bba[_0xfb44('0x2f')](_0x165a80)[_0xfb44('0x30')]();};}function respondWithResult(_0x494750,_0x5b1113){_0x5b1113=_0x5b1113||0xc8;return function(_0x342cc8){if(_0x342cc8){return _0x494750[_0xfb44('0x2f')](_0x5b1113)[_0xfb44('0x31')](_0x342cc8);}};}function respondWithFilteredResult(_0x4aa262,_0x5a269c){return function(_0x18ee8e){if(_0x18ee8e){var _0x9b8f1d=typeof _0x5a269c[_0xfb44('0x32')]===_0xfb44('0x33')&&typeof _0x5a269c['limit']==='undefined';var _0x4ca55e=_0x18ee8e[_0xfb44('0x34')];var _0x51289f=_0x9b8f1d?0x0:_0x5a269c[_0xfb44('0x32')];var _0x47e1fb=_0x9b8f1d?_0x18ee8e[_0xfb44('0x34')]:_0x5a269c['offset']+_0x5a269c[_0xfb44('0x35')];var _0x373096;if(_0x47e1fb>=_0x4ca55e){_0x47e1fb=_0x4ca55e;_0x373096=0xc8;}else{_0x373096=0xce;}_0x4aa262[_0xfb44('0x2f')](_0x373096);return _0x4aa262[_0xfb44('0x36')]('Content-Range',_0x51289f+'-'+_0x47e1fb+'/'+_0x4ca55e)[_0xfb44('0x31')](_0x18ee8e);}return null;};}function patchUpdates(_0x34506b){return function(_0x2a86a9){try{jsonpatch[_0xfb44('0x37')](_0x2a86a9,_0x34506b,!![]);}catch(_0x59369c){return BPromise[_0xfb44('0x38')](_0x59369c);}return _0x2a86a9[_0xfb44('0x39')]();};}function saveUpdates(_0x9103e9,_0x8b36f7){return function(_0x3bb020){if(_0x3bb020){return _0x3bb020[_0xfb44('0x3a')](_0x9103e9)[_0xfb44('0x24')](function(_0x2e5b97){return _0x2e5b97;});}return null;};}function removeEntity(_0x5be420,_0x12278f){return function(_0x1eb6a7){if(_0x1eb6a7){return _0x1eb6a7[_0xfb44('0x3b')]()[_0xfb44('0x24')](function(){var _0x50a4b0=_0x1eb6a7[_0xfb44('0x3c')]({'plain':!![]});var _0xff8cbc='WhatsappAccounts';return db['UserProfileResource'][_0xfb44('0x3b')]({'where':{'type':_0xff8cbc,'resourceId':_0x50a4b0['id']}})[_0xfb44('0x24')](function(){return _0x1eb6a7;});})['then'](function(){_0x5be420[_0xfb44('0x2f')](0xcc)[_0xfb44('0x30')]();});}};}function handleEntityNotFound(_0x4e99bd,_0x555a51){return function(_0x41b3cb){if(!_0x41b3cb){_0x4e99bd['sendStatus'](0x194);}return _0x41b3cb;};}function handleError(_0x365f47,_0x4fded2){_0x4fded2=_0x4fded2||0x1f4;return function(_0x18e0f7){logger[_0xfb44('0x2b')](_0x18e0f7['stack']);if(_0x18e0f7['name']){delete _0x18e0f7[_0xfb44('0x3d')];}_0x365f47[_0xfb44('0x2f')](_0x4fded2)[_0xfb44('0x3e')](_0x18e0f7);};}exports[_0xfb44('0x3f')]=function(_0x5986c5,_0x21a28f){var _0x5aa00d={'include':[{'model':db[_0xfb44('0x40')],'as':_0xfb44('0x41')}]},_0x11a2a7={},_0x339130={'count':0x0,'rows':[]};var _0x1f8a69=_[_0xfb44('0x42')](db['WhatsappAccount']['rawAttributes'],function(_0xff3696){return{'name':_0xff3696['fieldName'],'type':_0xff3696[_0xfb44('0x43')][_0xfb44('0x44')]};});_0x11a2a7[_0xfb44('0x45')]=_[_0xfb44('0x42')](_0x1f8a69,_0xfb44('0x3d'));_0x11a2a7[_0xfb44('0x46')]=_['keys'](_0x5986c5[_0xfb44('0x46')]);_0x11a2a7[_0xfb44('0x47')]=_[_0xfb44('0x48')](_0x11a2a7[_0xfb44('0x45')],_0x11a2a7['query']);_0x5aa00d['attributes']=_[_0xfb44('0x48')](_0x11a2a7[_0xfb44('0x45')],qs[_0xfb44('0x49')](_0x5986c5[_0xfb44('0x46')][_0xfb44('0x49')]));_0x5aa00d['attributes']=_0x5aa00d[_0xfb44('0x4a')][_0xfb44('0x4b')]?_0x5aa00d[_0xfb44('0x4a')]:_0x11a2a7[_0xfb44('0x45')];if(!_0x5986c5[_0xfb44('0x46')]['hasOwnProperty'](_0xfb44('0x4c'))){_0x5aa00d['limit']=qs[_0xfb44('0x35')](_0x5986c5[_0xfb44('0x46')]['limit']);_0x5aa00d[_0xfb44('0x32')]=qs['offset'](_0x5986c5[_0xfb44('0x46')]['offset']);}_0x5aa00d['order']=qs[_0xfb44('0x4d')](_0x5986c5[_0xfb44('0x46')]['sort']);_0x5aa00d[_0xfb44('0x4e')]=qs[_0xfb44('0x47')](_['pick'](_0x5986c5[_0xfb44('0x46')],_0x11a2a7['filters']),_0x1f8a69);if(_0x5986c5[_0xfb44('0x46')][_0xfb44('0x4f')]){_0x5aa00d['where']=_[_0xfb44('0x50')](_0x5aa00d[_0xfb44('0x4e')],{'$or':_[_0xfb44('0x42')](_0x1f8a69,function(_0x505627){if(_0x505627[_0xfb44('0x43')]!==_0xfb44('0x51')){var _0x57c763={};_0x57c763[_0x505627[_0xfb44('0x3d')]]={'$like':'%'+_0x5986c5['query'][_0xfb44('0x4f')]+'%'};return _0x57c763;}})});}_0x5aa00d=_['merge']({},_0x5aa00d,_0x5986c5[_0xfb44('0x52')]);var _0x306068={'where':_0x5aa00d[_0xfb44('0x4e')]};return db[_0xfb44('0x53')][_0xfb44('0x34')](_0x306068)['then'](function(_0x3c9113){_0x339130[_0xfb44('0x34')]=_0x3c9113;if(_0x5986c5[_0xfb44('0x46')][_0xfb44('0x54')]){_0x5aa00d[_0xfb44('0x55')]=[{'all':!![]}];}return db[_0xfb44('0x53')][_0xfb44('0x56')](_0x5aa00d);})[_0xfb44('0x24')](function(_0x16efb8){_0x339130[_0xfb44('0x57')]=_0x16efb8;return _0x339130;})[_0xfb44('0x24')](respondWithFilteredResult(_0x21a28f,_0x5aa00d))[_0xfb44('0x58')](handleError(_0x21a28f,null));};exports[_0xfb44('0x59')]=function(_0x3a55b3,_0x55e169){var _0x1fd0af={'raw':![],'where':{'id':_0x3a55b3['params']['id']},'include':[{'model':db[_0xfb44('0x40')],'as':_0xfb44('0x41')}]},_0x134444={};_0x134444[_0xfb44('0x45')]=_[_0xfb44('0x5a')](db[_0xfb44('0x53')]['rawAttributes']);_0x134444[_0xfb44('0x46')]=_[_0xfb44('0x5a')](_0x3a55b3[_0xfb44('0x46')]);_0x134444[_0xfb44('0x47')]=_[_0xfb44('0x48')](_0x134444[_0xfb44('0x45')],_0x134444[_0xfb44('0x46')]);_0x1fd0af[_0xfb44('0x4a')]=_['intersection'](_0x134444['model'],qs[_0xfb44('0x49')](_0x3a55b3[_0xfb44('0x46')][_0xfb44('0x49')]));_0x1fd0af[_0xfb44('0x4a')]=_0x1fd0af[_0xfb44('0x4a')][_0xfb44('0x4b')]?_0x1fd0af[_0xfb44('0x4a')]:_0x134444[_0xfb44('0x45')];if(_0x3a55b3['query'][_0xfb44('0x54')]){_0x1fd0af[_0xfb44('0x55')]=[{'all':!![]}];}_0x1fd0af=_[_0xfb44('0x50')]({},_0x1fd0af,_0x3a55b3['options']);return db[_0xfb44('0x53')]['find'](_0x1fd0af)['then'](handleEntityNotFound(_0x55e169,null))['then'](respondWithResult(_0x55e169,null))['catch'](handleError(_0x55e169,null));};exports[_0xfb44('0x5b')]=function(_0x247606,_0x430328){return db[_0xfb44('0x53')][_0xfb44('0x5b')](_0x247606[_0xfb44('0x5c')],{})[_0xfb44('0x24')](function(_0x482766){var _0x196feb=_0x247606[_0xfb44('0x5d')][_0xfb44('0x3c')]({'plain':!![]});if(!_0x196feb)throw new Error(_0xfb44('0x5e'));if(_0x196feb[_0xfb44('0x5f')]===_0xfb44('0x5d')){var _0x218d9f=_0x482766['get']({'plain':!![]});var _0x1bc74e=_0xfb44('0x60');return db[_0xfb44('0x61')][_0xfb44('0x62')]({'where':{'name':_0x1bc74e,'userProfileId':_0x196feb[_0xfb44('0x63')]},'raw':!![]})[_0xfb44('0x24')](function(_0x406092){if(_0x406092&&_0x406092['autoAssociation']===0x0){return db[_0xfb44('0x64')][_0xfb44('0x5b')]({'name':_0x218d9f['name'],'resourceId':_0x218d9f['id'],'type':_0x406092[_0xfb44('0x3d')],'sectionId':_0x406092['id']},{})['then'](function(){return _0x482766;});}else{return _0x482766;}})[_0xfb44('0x58')](function(_0xc9fc78){logger['error'](_0xfb44('0x65'),_0xc9fc78);throw _0xc9fc78;});}return _0x482766;})['then'](respondWithResult(_0x430328,0xc9))[_0xfb44('0x58')](handleError(_0x430328,null));};exports[_0xfb44('0x3a')]=function(_0x3da3ec,_0x1fd9b7){if(_0x3da3ec[_0xfb44('0x5c')]['id']){delete _0x3da3ec['body']['id'];}return db[_0xfb44('0x53')][_0xfb44('0x62')]({'where':{'id':_0x3da3ec[_0xfb44('0x66')]['id']},'include':[{'model':db[_0xfb44('0x40')],'as':'mandatoryDispositionPause'}]})['then'](handleEntityNotFound(_0x1fd9b7,null))[_0xfb44('0x24')](saveUpdates(_0x3da3ec[_0xfb44('0x5c')],null))[_0xfb44('0x24')](respondWithResult(_0x1fd9b7,null))[_0xfb44('0x58')](handleError(_0x1fd9b7,null));};exports[_0xfb44('0x3b')]=function(_0x5160f7,_0x5a7200){return db[_0xfb44('0x53')][_0xfb44('0x62')]({'where':{'id':_0x5160f7[_0xfb44('0x66')]['id']}})[_0xfb44('0x24')](handleEntityNotFound(_0x5a7200,null))['then'](removeEntity(_0x5a7200,null))[_0xfb44('0x58')](handleError(_0x5a7200,null));};exports['describe']=function(_0x1a1c85,_0x161998){return db[_0xfb44('0x53')][_0xfb44('0x67')]()['then'](respondWithResult(_0x161998,null))['catch'](handleError(_0x161998,null));};exports[_0xfb44('0x68')]=function(_0x1b7e26,_0x3c694b,_0x42280d){if(_0x1b7e26[_0xfb44('0x5c')]['id']){delete _0x1b7e26[_0xfb44('0x5c')]['id'];}return db[_0xfb44('0x53')][_0xfb44('0x62')]({'where':{'id':_0x1b7e26['params']['id']}})['then'](handleEntityNotFound(_0x3c694b,null))[_0xfb44('0x24')](function(_0x43a2df){if(_0x43a2df){_0x1b7e26[_0xfb44('0x5c')][_0xfb44('0x69')]=_0x43a2df['id'];return db[_0xfb44('0x6a')]['create'](_0x1b7e26[_0xfb44('0x5c')]);}})[_0xfb44('0x24')](respondWithResult(_0x3c694b,null))[_0xfb44('0x58')](handleError(_0x3c694b,null));};exports[_0xfb44('0x6b')]=function(_0x367323,_0x19791c,_0x1d979d){var _0x2fce2d={'raw':![],'where':{}};var _0x112570={};var _0x4724f3={'count':0x0,'rows':[]};return db['WhatsappAccount'][_0xfb44('0x6c')]({'where':{'id':_0x367323[_0xfb44('0x66')]['id']}})[_0xfb44('0x24')](handleEntityNotFound(_0x19791c,null))['then'](function(_0x3228d7){if(_0x3228d7){_0x112570[_0xfb44('0x45')]=_['keys'](db['Disposition'][_0xfb44('0x6d')]);_0x112570[_0xfb44('0x46')]=_[_0xfb44('0x5a')](_0x367323['query']);_0x112570[_0xfb44('0x47')]=_[_0xfb44('0x48')](_0x112570['model'],_0x112570[_0xfb44('0x46')]);_0x2fce2d[_0xfb44('0x4a')]=_[_0xfb44('0x48')](_0x112570[_0xfb44('0x45')],qs[_0xfb44('0x49')](_0x367323[_0xfb44('0x46')]['fields']));_0x2fce2d[_0xfb44('0x4a')]=_0x2fce2d['attributes']['length']?_0x2fce2d[_0xfb44('0x4a')]:_0x112570[_0xfb44('0x45')];if(!_0x367323[_0xfb44('0x46')][_0xfb44('0x6e')](_0xfb44('0x4c'))){_0x2fce2d[_0xfb44('0x35')]=qs[_0xfb44('0x35')](_0x367323['query'][_0xfb44('0x35')]);_0x2fce2d[_0xfb44('0x32')]=qs[_0xfb44('0x32')](_0x367323[_0xfb44('0x46')][_0xfb44('0x32')]);}_0x2fce2d[_0xfb44('0x6f')]=qs[_0xfb44('0x4d')](_0x367323['query'][_0xfb44('0x4d')]);_0x2fce2d[_0xfb44('0x4e')]=qs['filters'](_[_0xfb44('0x70')](_0x367323['query'],_0x112570['filters']));_0x2fce2d[_0xfb44('0x4e')]['WhatsappAccountId']=_0x3228d7['id'];if(_0x367323[_0xfb44('0x46')]['filter']){_0x2fce2d['where']=_[_0xfb44('0x50')](_0x2fce2d[_0xfb44('0x4e')],{'$or':_['map'](_0x2fce2d['attributes'],function(_0x6b313d){var _0x2e0695={};_0x2e0695[_0x6b313d]={'$like':'%'+_0x367323[_0xfb44('0x46')][_0xfb44('0x4f')]+'%'};return _0x2e0695;})});}_0x2fce2d=_[_0xfb44('0x50')]({},_0x2fce2d,_0x367323[_0xfb44('0x52')]);return db['Disposition'][_0xfb44('0x34')]({'where':_0x2fce2d[_0xfb44('0x4e')]})['then'](function(_0x304fda){_0x4724f3[_0xfb44('0x34')]=_0x304fda;if(_0x367323[_0xfb44('0x46')]['includeAll']){_0x2fce2d[_0xfb44('0x55')]=[{'all':!![]}];}return db[_0xfb44('0x6a')][_0xfb44('0x56')](_0x2fce2d);})[_0xfb44('0x24')](function(_0x3813a7){_0x4724f3[_0xfb44('0x57')]=_0x3813a7;return _0x4724f3;});}})[_0xfb44('0x24')](respondWithFilteredResult(_0x19791c,_0x2fce2d))[_0xfb44('0x58')](handleError(_0x19791c,null));};exports[_0xfb44('0x71')]=function(_0x1521dc,_0x396610,_0x3bed3c){return db[_0xfb44('0x53')][_0xfb44('0x62')]({'where':{'id':_0x1521dc['params']['id']}})[_0xfb44('0x24')](handleEntityNotFound(_0x396610,null))[_0xfb44('0x24')](function(_0x28f337){if(_0x28f337){return _0x28f337[_0xfb44('0x71')](_0x1521dc[_0xfb44('0x46')]['ids']);}})['then'](respondWithStatusCode(_0x396610,null))['catch'](handleError(_0x396610,null));};exports['addAnswer']=function(_0x3fb47d,_0x1992b2,_0x58b936){if(_0x3fb47d[_0xfb44('0x5c')]['id']){delete _0x3fb47d[_0xfb44('0x5c')]['id'];}return db[_0xfb44('0x53')]['find']({'where':{'id':_0x3fb47d[_0xfb44('0x66')]['id']}})[_0xfb44('0x24')](handleEntityNotFound(_0x1992b2,null))[_0xfb44('0x24')](function(_0x52700e){if(_0x52700e){_0x3fb47d[_0xfb44('0x5c')][_0xfb44('0x69')]=_0x52700e['id'];return db[_0xfb44('0x72')][_0xfb44('0x5b')](_0x3fb47d[_0xfb44('0x5c')]);}})[_0xfb44('0x24')](respondWithResult(_0x1992b2,null))[_0xfb44('0x58')](handleError(_0x1992b2,null));};exports['getAnswers']=function(_0x19f8cd,_0x52deb3,_0x17a3b1){var _0x4ca68e={'raw':![],'where':{}};var _0x5a99e8={};var _0x246a7a={'count':0x0,'rows':[]};return db['WhatsappAccount'][_0xfb44('0x6c')]({'where':{'id':_0x19f8cd[_0xfb44('0x66')]['id']}})[_0xfb44('0x24')](handleEntityNotFound(_0x52deb3,null))['then'](function(_0x15e2cf){if(_0x15e2cf){_0x5a99e8[_0xfb44('0x45')]=_[_0xfb44('0x5a')](db['CannedAnswer'][_0xfb44('0x6d')]);_0x5a99e8['query']=_['keys'](_0x19f8cd[_0xfb44('0x46')]);_0x5a99e8[_0xfb44('0x47')]=_[_0xfb44('0x48')](_0x5a99e8[_0xfb44('0x45')],_0x5a99e8['query']);_0x4ca68e['attributes']=_[_0xfb44('0x48')](_0x5a99e8[_0xfb44('0x45')],qs[_0xfb44('0x49')](_0x19f8cd[_0xfb44('0x46')][_0xfb44('0x49')]));_0x4ca68e['attributes']=_0x4ca68e['attributes'][_0xfb44('0x4b')]?_0x4ca68e[_0xfb44('0x4a')]:_0x5a99e8[_0xfb44('0x45')];if(!_0x19f8cd[_0xfb44('0x46')][_0xfb44('0x6e')](_0xfb44('0x4c'))){_0x4ca68e[_0xfb44('0x35')]=qs['limit'](_0x19f8cd[_0xfb44('0x46')][_0xfb44('0x35')]);_0x4ca68e[_0xfb44('0x32')]=qs['offset'](_0x19f8cd[_0xfb44('0x46')]['offset']);}_0x4ca68e[_0xfb44('0x6f')]=qs[_0xfb44('0x4d')](_0x19f8cd['query'][_0xfb44('0x4d')]);_0x4ca68e[_0xfb44('0x4e')]=qs[_0xfb44('0x47')](_['pick'](_0x19f8cd[_0xfb44('0x46')],_0x5a99e8[_0xfb44('0x47')]));_0x4ca68e[_0xfb44('0x4e')][_0xfb44('0x69')]=_0x15e2cf['id'];if(_0x19f8cd[_0xfb44('0x46')][_0xfb44('0x4f')]){_0x4ca68e[_0xfb44('0x4e')]=_[_0xfb44('0x50')](_0x4ca68e['where'],{'$or':_[_0xfb44('0x42')](_0x4ca68e[_0xfb44('0x4a')],function(_0x2c2ba0){var _0x7935aa={};_0x7935aa[_0x2c2ba0]={'$like':'%'+_0x19f8cd[_0xfb44('0x46')][_0xfb44('0x4f')]+'%'};return _0x7935aa;})});}_0x4ca68e=_[_0xfb44('0x50')]({},_0x4ca68e,_0x19f8cd[_0xfb44('0x52')]);return db[_0xfb44('0x72')][_0xfb44('0x34')]({'where':_0x4ca68e['where']})[_0xfb44('0x24')](function(_0x2b5301){_0x246a7a[_0xfb44('0x34')]=_0x2b5301;if(_0x19f8cd['query']['includeAll']){_0x4ca68e['include']=[{'all':!![]}];}return db[_0xfb44('0x72')][_0xfb44('0x56')](_0x4ca68e);})['then'](function(_0x53d265){_0x246a7a[_0xfb44('0x57')]=_0x53d265;return _0x246a7a;});}})[_0xfb44('0x24')](respondWithFilteredResult(_0x52deb3,_0x4ca68e))[_0xfb44('0x58')](handleError(_0x52deb3,null));};exports['removeAnswers']=function(_0x4e4c82,_0x13b36e,_0x456940){return db[_0xfb44('0x53')][_0xfb44('0x62')]({'where':{'id':_0x4e4c82[_0xfb44('0x66')]['id']}})[_0xfb44('0x24')](handleEntityNotFound(_0x13b36e,null))[_0xfb44('0x24')](function(_0x2577af){if(_0x2577af){return _0x2577af[_0xfb44('0x73')](_0x4e4c82[_0xfb44('0x46')][_0xfb44('0x74')]);}})[_0xfb44('0x24')](respondWithStatusCode(_0x13b36e,null))[_0xfb44('0x58')](handleError(_0x13b36e,null));};exports['addAgents']=function(_0x1791e9,_0x1c4dc2,_0x463fb1){return db[_0xfb44('0x53')][_0xfb44('0x62')]({'where':{'id':_0x1791e9[_0xfb44('0x66')]['id']}})['then'](handleEntityNotFound(_0x1c4dc2,null))['then'](function(_0x2b7b7b){if(_0x2b7b7b){return _0x2b7b7b[_0xfb44('0x75')](_0x1791e9[_0xfb44('0x5c')][_0xfb44('0x74')],_[_0xfb44('0x76')](_0x1791e9[_0xfb44('0x5c')],[_0xfb44('0x74'),'id'])||{})[_0xfb44('0x77')](function(_0x506f6f){for(var _0x3eacf9=0x0;_0x3eacf9<_0x1791e9[_0xfb44('0x5c')][_0xfb44('0x74')][_0xfb44('0x4b')];_0x3eacf9+=0x1){socket[_0xfb44('0x78')](_0xfb44('0x79'),{'UserId':Number(_0x1791e9[_0xfb44('0x5c')][_0xfb44('0x74')][_0x3eacf9]),'WhatsappAccountId':Number(_0x1791e9['params']['id'])});}return _0x506f6f;});}})[_0xfb44('0x24')](respondWithResult(_0x1c4dc2,null))[_0xfb44('0x58')](handleError(_0x1c4dc2,null));};exports[_0xfb44('0x7a')]=function(_0x18b3ea,_0x17cd9c,_0x40c7fe){return db[_0xfb44('0x53')][_0xfb44('0x62')]({'where':{'id':_0x18b3ea[_0xfb44('0x66')]['id']}})[_0xfb44('0x24')](handleEntityNotFound(_0x17cd9c,null))['then'](function(_0x25b32e){if(_0x25b32e){return _0x25b32e[_0xfb44('0x7a')](_0x18b3ea['query'][_0xfb44('0x74')])[_0xfb44('0x24')](function(){if(_[_0xfb44('0x7b')](_0x18b3ea['query'][_0xfb44('0x74')])){for(var _0x48e15d=0x0;_0x48e15d<_0x18b3ea[_0xfb44('0x46')]['ids'][_0xfb44('0x4b')];_0x48e15d+=0x1){socket[_0xfb44('0x78')](_0xfb44('0x7c'),{'UserId':Number(_0x18b3ea[_0xfb44('0x46')][_0xfb44('0x74')][_0x48e15d]),'WhatsappAccountId':Number(_0x18b3ea['params']['id'])});}}else{socket[_0xfb44('0x78')](_0xfb44('0x7c'),{'UserId':Number(_0x18b3ea['query']['ids']),'WhatsappAccountId':Number(_0x18b3ea['params']['id'])});}});}})[_0xfb44('0x24')](respondWithStatusCode(_0x17cd9c,null))[_0xfb44('0x58')](handleError(_0x17cd9c,null));};exports[_0xfb44('0x7d')]=function(_0x5579e9,_0x98537c,_0x105447){var _0x3d6f71={};var _0x4fe032={};var _0x2641d5;var _0x154b75;return db[_0xfb44('0x53')][_0xfb44('0x6c')]({'where':{'id':_0x5579e9['params']['id']}})[_0xfb44('0x24')](handleEntityNotFound(_0x98537c,null))[_0xfb44('0x24')](function(_0x5940b0){if(_0x5940b0){_0x2641d5=_0x5940b0;_0x4fe032['model']=_[_0xfb44('0x5a')](db[_0xfb44('0x7e')]['rawAttributes']);_0x4fe032[_0xfb44('0x46')]=_[_0xfb44('0x5a')](_0x5579e9[_0xfb44('0x46')]);_0x4fe032['filters']=_[_0xfb44('0x48')](_0x4fe032[_0xfb44('0x45')],_0x4fe032[_0xfb44('0x46')]);_0x3d6f71[_0xfb44('0x4a')]=_[_0xfb44('0x48')](_0x4fe032[_0xfb44('0x45')],qs[_0xfb44('0x49')](_0x5579e9[_0xfb44('0x46')][_0xfb44('0x49')]));_0x3d6f71[_0xfb44('0x4a')]=_0x3d6f71[_0xfb44('0x4a')][_0xfb44('0x4b')]?_0x3d6f71['attributes']:_0x4fe032['model'];_0x3d6f71[_0xfb44('0x6f')]=qs[_0xfb44('0x4d')](_0x5579e9['query'][_0xfb44('0x4d')]);_0x3d6f71['where']=qs['filters'](_[_0xfb44('0x70')](_0x5579e9[_0xfb44('0x46')],_0x4fe032['filters']));if(_0x5579e9[_0xfb44('0x46')][_0xfb44('0x4f')]){_0x3d6f71[_0xfb44('0x4e')]=_[_0xfb44('0x50')](_0x3d6f71[_0xfb44('0x4e')],{'$or':_['map'](_0x3d6f71[_0xfb44('0x4a')],function(_0xf1af07){var _0x5f26b0={};_0x5f26b0[_0xf1af07]={'$like':'%'+_0x5579e9[_0xfb44('0x46')][_0xfb44('0x4f')]+'%'};return _0x5f26b0;})});}_0x3d6f71=_['merge']({},_0x3d6f71,_0x5579e9[_0xfb44('0x52')]);return _0x2641d5[_0xfb44('0x7d')](_0x3d6f71);}})[_0xfb44('0x24')](function(_0x3d54ff){if(_0x3d54ff){_0x154b75=_0x3d54ff[_0xfb44('0x4b')];if(!_0x5579e9[_0xfb44('0x46')]['hasOwnProperty']('nolimit')){_0x3d6f71['limit']=qs[_0xfb44('0x35')](_0x5579e9[_0xfb44('0x46')][_0xfb44('0x35')]);_0x3d6f71[_0xfb44('0x32')]=qs[_0xfb44('0x32')](_0x5579e9[_0xfb44('0x46')][_0xfb44('0x32')]);}return _0x2641d5[_0xfb44('0x7d')](_0x3d6f71);}})['then'](function(_0x30d324){if(_0x30d324){return _0x30d324?{'count':_0x154b75,'rows':_0x30d324}:null;}})['then'](respondWithResult(_0x98537c,null))['catch'](handleError(_0x98537c,null));};exports[_0xfb44('0x7f')]=function(_0x172143,_0x310a3e){var _0x3c63f7=_0x172143[_0xfb44('0x66')]['id'];var _0x42a36b=_0x172143['body'];var _0x344795=0xc8;var _0x547629=null;return db[_0xfb44('0x80')]['transaction']({'isolationLevel':db[_0xfb44('0x80')][_0xfb44('0x81')][_0xfb44('0x82')][_0xfb44('0x83')]},function(_0x4a080b){return db[_0xfb44('0x53')]['findOne']({'where':{'id':_0x3c63f7},'transaction':_0x4a080b})[_0xfb44('0x24')](function(_0x276b8a){if(_0x276b8a){return db[_0xfb44('0x84')][_0xfb44('0x3b')]({'where':{'WhatsappAccountId':_0x3c63f7},'transaction':_0x4a080b})[_0xfb44('0x24')](function(){var _0x529eb0=_[_0xfb44('0x42')](_0x42a36b,function(_0x582279){_0x582279[_0xfb44('0x69')]=_0x3c63f7;return _0x582279;});return db[_0xfb44('0x84')][_0xfb44('0x85')](_0x529eb0,{'transaction':_0x4a080b});});}else{_0x344795=0x194;_0x547629=[];}});})[_0xfb44('0x24')](function(){if(_0x344795!==0x194){return db[_0xfb44('0x84')]['findAndCountAll']({'where':{'WhatsappAccountId':_0x3c63f7},'order':_0xfb44('0x86')})['then'](function(_0x56c71c){_0x547629=_0x56c71c;});}})[_0xfb44('0x58')](function(_0x589d50){_0x344795=0x1f4;logger[_0xfb44('0x2b')](_0x589d50['stack']);if(_0x589d50[_0xfb44('0x3d')]){delete _0x589d50[_0xfb44('0x3d')];}_0x547629=_0x589d50;})[_0xfb44('0x87')](function(){if(_0x547629===null){_0x310a3e[_0xfb44('0x88')](_0x344795);}else{if(_0x344795===0x1f4){_0x310a3e[_0xfb44('0x2f')](_0x344795)['send'](_0x547629);}else{_0x310a3e[_0xfb44('0x2f')](_0x344795)[_0xfb44('0x31')](_0x547629);}}});};exports['getApplications']=function(_0x1ce50e,_0x224e89,_0x5bbf60){var _0x3f493d={};var _0x167051={};var _0x18ef52;var _0x1d5ef8;return db[_0xfb44('0x53')][_0xfb44('0x6c')]({'where':{'id':_0x1ce50e[_0xfb44('0x66')]['id']}})['then'](handleEntityNotFound(_0x224e89,null))[_0xfb44('0x24')](function(_0x149b05){if(_0x149b05){_0x18ef52=_0x149b05;_0x167051[_0xfb44('0x45')]=_[_0xfb44('0x5a')](db['WhatsappApplication']['rawAttributes']);_0x167051[_0xfb44('0x46')]=_[_0xfb44('0x5a')](_0x1ce50e[_0xfb44('0x46')]);_0x167051[_0xfb44('0x47')]=_[_0xfb44('0x48')](_0x167051[_0xfb44('0x45')],_0x167051[_0xfb44('0x46')]);_0x3f493d[_0xfb44('0x4a')]=_['intersection'](_0x167051[_0xfb44('0x45')],qs[_0xfb44('0x49')](_0x1ce50e[_0xfb44('0x46')][_0xfb44('0x49')]));_0x3f493d[_0xfb44('0x4a')]=_0x3f493d[_0xfb44('0x4a')][_0xfb44('0x4b')]?_0x3f493d[_0xfb44('0x4a')]:_0x167051['model'];_0x3f493d[_0xfb44('0x6f')]=qs[_0xfb44('0x4d')](_0x1ce50e[_0xfb44('0x46')][_0xfb44('0x4d')]);_0x3f493d[_0xfb44('0x4e')]=qs[_0xfb44('0x47')](_[_0xfb44('0x70')](_0x1ce50e[_0xfb44('0x46')],_0x167051[_0xfb44('0x47')]));if(_0x1ce50e[_0xfb44('0x46')][_0xfb44('0x4f')]){_0x3f493d['where']=_[_0xfb44('0x50')](_0x3f493d[_0xfb44('0x4e')],{'$or':_[_0xfb44('0x42')](_0x3f493d['attributes'],function(_0x208572){var _0x660411={};_0x660411[_0x208572]={'$like':'%'+_0x1ce50e[_0xfb44('0x46')][_0xfb44('0x4f')]+'%'};return _0x660411;})});}_0x3f493d=_['merge']({},_0x3f493d,_0x1ce50e[_0xfb44('0x52')]);return _0x18ef52[_0xfb44('0x89')](_0x3f493d);}})[_0xfb44('0x24')](function(_0x73579f){if(_0x73579f){_0x1d5ef8=_0x73579f[_0xfb44('0x4b')];if(!_0x1ce50e[_0xfb44('0x46')][_0xfb44('0x6e')](_0xfb44('0x4c'))){_0x3f493d[_0xfb44('0x35')]=qs[_0xfb44('0x35')](_0x1ce50e[_0xfb44('0x46')]['limit']);_0x3f493d[_0xfb44('0x32')]=qs['offset'](_0x1ce50e[_0xfb44('0x46')][_0xfb44('0x32')]);}return _0x18ef52[_0xfb44('0x89')](_0x3f493d);}})[_0xfb44('0x24')](function(_0x5b1f27){if(_0x5b1f27){return _0x5b1f27?{'count':_0x1d5ef8,'rows':_0x5b1f27}:null;}})[_0xfb44('0x24')](respondWithResult(_0x224e89,null))[_0xfb44('0x58')](handleError(_0x224e89,null));};exports[_0xfb44('0x8a')]=function(_0x50676a,_0x22506f,_0xae1bb1){var _0x25ddd8={'channel':_0xfb44('0x8b')};var _0x1f09bb=[];var _0x34ee4c=[];var _0x260acf={};return db['WhatsappAccount']['find']({'where':{'id':_0x50676a[_0xfb44('0x66')]['id']},'include':[{'model':db['WhatsappApplication'],'as':_0xfb44('0x8c')}]})['then'](handleEntityNotFound(_0x22506f,null))[_0xfb44('0x24')](function(_0x293794){_0x25ddd8['account']=_0x293794;if(_0x25ddd8[_0xfb44('0x8d')]&&_0x25ddd8[_0xfb44('0x8d')][_0xfb44('0x43')]===_0xfb44('0x8e')&&_0x50676a[_0xfb44('0x5c')][_0xfb44('0x8f')]){if(_0x50676a[_0xfb44('0x5c')][_0xfb44('0x8f')][_0xfb44('0x4b')]===0x0)return;if(_0x50676a[_0xfb44('0x5c')][_0xfb44('0x8f')][0x0][_0xfb44('0x90')]!=='read')return;return db[_0xfb44('0x91')][_0xfb44('0x3a')]({'read':!![],'readAt':_0x50676a[_0xfb44('0x5c')][_0xfb44('0x8f')][0x0][_0xfb44('0x92')]},{'where':{'messageId':_0x50676a['body'][_0xfb44('0x8f')][0x0][_0xfb44('0x93')]},'individualHooks':!![]})[_0xfb44('0x24')](function(_0x452d42){return _0x22506f[_0xfb44('0x2f')](0xc8)[_0xfb44('0x31')](_0x452d42);});}_0x25ddd8['applications']=_['orderBy'](_0x293794[_0xfb44('0x8c')],['priority'],[_0xfb44('0x94')]);if(_0x25ddd8['account'][_0xfb44('0x8c')]){delete _0x25ddd8['account'][_0xfb44('0x8c')];}return db[_0xfb44('0x95')][_0xfb44('0x67')]()[_0xfb44('0x24')](function(_0x173a15){if(!_0x173a15){throw new db['Sequelize'][(_0xfb44('0x96'))](_0xfb44('0x97'));}_0x1f09bb=_[_0xfb44('0x98')](_[_0xfb44('0x5a')](_0x173a15),[_0xfb44('0x99'),_0xfb44('0x9a')]);_0x34ee4c=_[_0xfb44('0x98')](_['keys'](_0x173a15),[_0xfb44('0x99'),_0xfb44('0x9a'),_0xfb44('0x9b'),_0xfb44('0x9c')]);_0x25ddd8[_0xfb44('0x5c')]={'mapKey':_0xfb44('0x9d')};if(_0x25ddd8[_0xfb44('0x8d')]&&_0x25ddd8['account'][_0xfb44('0x43')]===_0xfb44('0x9e')){_0x25ddd8[_0xfb44('0x5c')]['from']=_0x50676a[_0xfb44('0x5c')][_0xfb44('0x9f')][_0xfb44('0xa0')](_0xfb44('0xa1'),'');_0x25ddd8[_0xfb44('0x5c')][_0xfb44('0x5c')]=_0x50676a[_0xfb44('0x5c')]['Body'];_0x25ddd8[_0xfb44('0x5c')][_0xfb44('0xa2')]=_0x50676a[_0xfb44('0x5c')][_0xfb44('0xa3')];}if(_0x25ddd8[_0xfb44('0x8d')]&&_0x25ddd8[_0xfb44('0x8d')]['type']===_0xfb44('0x8e')){_0x25ddd8['body']['from']=_0x50676a[_0xfb44('0x5c')][_0xfb44('0xa4')][0x0][_0xfb44('0xa5')];_0x25ddd8['body'][_0xfb44('0x5c')]=_0x50676a['body']['notifications'][0x0][_0xfb44('0x2d')][_0xfb44('0x5c')];_0x25ddd8[_0xfb44('0x5c')][_0xfb44('0xa2')]=_0x50676a['body']['notifications'][0x0][_0xfb44('0x93')];}if(_0x25ddd8[_0xfb44('0x5c')]['id']){delete _0x25ddd8[_0xfb44('0x5c')]['id'];}if(_[_0xfb44('0xa6')](_0x25ddd8[_0xfb44('0x5c')][_0xfb44('0xa5')])){throw new db[(_0xfb44('0xa7'))][(_0xfb44('0x96'))](_0xfb44('0xa8'));}if(_[_0xfb44('0xa6')](_0x25ddd8[_0xfb44('0x5c')][_0xfb44('0x5c')])||_0x25ddd8[_0xfb44('0x5c')][_0xfb44('0x5c')]===''){throw new db['Sequelize'][(_0xfb44('0x96'))](_0xfb44('0xa9'));}if(_[_0xfb44('0xa6')](_0x25ddd8[_0xfb44('0x5c')][_0xfb44('0xaa')])){throw new db['Sequelize'][(_0xfb44('0x96'))]('mapKey\x20is\x20mandatory,\x20please\x20use\x20one\x20of\x20these:\x20'+_0x34ee4c);}if(!_['includes'](_0x34ee4c,_0x25ddd8[_0xfb44('0x5c')][_0xfb44('0xaa')])){throw new db['Sequelize'][(_0xfb44('0x96'))](_0xfb44('0xab')+_0x34ee4c);}_0x260acf[_0x25ddd8['body'][_0xfb44('0xaa')]]=_0x25ddd8[_0xfb44('0x5c')]['from'];return db[_0xfb44('0xac')][_0xfb44('0x62')]({'where':{'id':_0x25ddd8[_0xfb44('0x8d')][_0xfb44('0x9c')]},'include':[{'model':db['CmContact'],'as':'Contacts','where':_0x260acf,'limit':0x1,'order':[[_0xfb44('0x9a'),_0xfb44('0xad')]]}]});})[_0xfb44('0x24')](handleEntityNotFound(_0x22506f,null))[_0xfb44('0x24')](function(_0x5912f1){if(_0x5912f1){_0x25ddd8[_0xfb44('0xae')]=_[_0xfb44('0x76')](_0x5912f1,['Contacts']);if(_0x5912f1[_0xfb44('0xaf')][_0xfb44('0x4b')]){return _0x5912f1[_0xfb44('0xaf')][0x0];}var _0x322d8c=_[_0xfb44('0x1f')](_0x25ddd8[_0xfb44('0x5c')],{'firstName':_0x25ddd8['body']['from'],'ListId':_0x5912f1['id']});_0x322d8c[_0x25ddd8['body'][_0xfb44('0xaa')]]=_0x25ddd8[_0xfb44('0x5c')][_0xfb44('0xa5')];return db[_0xfb44('0x95')][_0xfb44('0x5b')](_0x322d8c,{'fields':_0x1f09bb,'raw':!![]});}})['then'](handleEntityNotFound(_0x22506f,null))[_0xfb44('0x24')](function(_0x505016){if(_0x505016){_0x25ddd8[_0xfb44('0xb0')]=_0x505016;var _0x5abbea={'ContactId':_0x505016['id'],'phone':_0x25ddd8[_0xfb44('0x5c')][_0xfb44('0xa5')],'WhatsappAccountId':_0x50676a[_0xfb44('0x66')]['id']};var _0x34e79b={'ContactId':_0x505016['id'],'WhatsappAccountId':_0x50676a[_0xfb44('0x66')]['id'],'closed':![]};return db[_0xfb44('0xb1')][_0xfb44('0x62')]({'where':_0x34e79b})[_0xfb44('0x24')](function(_0x29fb3e){if(_0x29fb3e){return[_0x29fb3e,![]];}return db[_0xfb44('0xb1')][_0xfb44('0x5b')](_0x5abbea)[_0xfb44('0x24')](function(_0x48efa1){return[_0x48efa1,!![]];});});}})[_0xfb44('0x77')](function(_0x5a105f,_0x595fd4){_0x25ddd8['interaction']=_0x5a105f['get']({'plain':!![]});_0x25ddd8['interaction'][_0xfb44('0xb2')]=![];if(_0x595fd4){if(_0x25ddd8[_0xfb44('0x8d')]['autoclose']){_0x25ddd8[_0xfb44('0xb3')]['push']({'id':0x0,'priority':_0x25ddd8[_0xfb44('0xb3')][_0xfb44('0x4b')]+0x1,'app':_0xfb44('0xb4'),'appdata':'unmanaged','interval':'*,*,*,*'});}_0x25ddd8[_0xfb44('0xb5')]['created']=!![];}return db[_0xfb44('0x91')]['create']({'phone':_0x25ddd8[_0xfb44('0x5c')][_0xfb44('0xa5')],'messageId':_0x25ddd8[_0xfb44('0x5c')][_0xfb44('0xa2')],'body':_0x25ddd8[_0xfb44('0x5c')][_0xfb44('0x5c')],'WhatsappAccountId':_0x50676a[_0xfb44('0x66')]['id'],'WhatsappInteractionId':_0x5a105f['id'],'direction':'in','ContactId':_0x5a105f[_0xfb44('0xb6')],'AttachmentId':_0x25ddd8[_0xfb44('0x5c')]['AttachmentId']});})[_0xfb44('0x24')](function(_0x326439){_0x25ddd8[_0xfb44('0x2d')]=_0x326439;if(!_0x25ddd8[_0xfb44('0xb5')][_0xfb44('0xb7')])return;return db[_0xfb44('0x7e')][_0xfb44('0x62')]({'attributes':['id',_0xfb44('0x3d')],'where':{'id':_0x25ddd8[_0xfb44('0xb5')][_0xfb44('0xb7')]}});})['then'](function(_0x24c130){if(_0x24c130){_0x25ddd8[_0xfb44('0xb3')][_0xfb44('0xb8')]({'id':0x0,'priority':0x0,'app':'agent','appdata':_0x24c130[_0xfb44('0x3d')]+','+(_0x25ddd8['account'][_0xfb44('0xb9')]||0xa),'interval':_0xfb44('0xba')});}if(!_0x25ddd8[_0xfb44('0xb5')][_0xfb44('0xbb')])return;return db[_0xfb44('0xbc')]['find']({'attributes':['id',_0xfb44('0x3d')],'where':{'id':_0x25ddd8[_0xfb44('0xb5')][_0xfb44('0xbb')]}});})[_0xfb44('0x24')](function(_0x26b2ed){if(_0x26b2ed){_0x25ddd8[_0xfb44('0xb3')][_0xfb44('0xb8')]({'id':0x0,'priority':0x1,'app':_0xfb44('0xbd'),'appdata':_0x26b2ed[_0xfb44('0x3d')]+','+(_0x25ddd8[_0xfb44('0x8d')][_0xfb44('0xbe')]||0x12c),'interval':'*,*,*,*'});}return respondWithRpcPromise('Start',_0xfb44('0xbf'),_0x25ddd8);})[_0xfb44('0x24')](function(_0x2578bf){if(_0x2578bf){var _0x2f55ef=0xc8;var _0x545500=_0xfb44('0xc0');logger[_0xfb44('0x25')](_0xfb44('0x29'),_0x545500,_0x2f55ef,_0xfb44('0xc1'));logger[_0xfb44('0x28')]('WhatsappAccount,\x20%s,\x20%s,\x20%s,\x20%s',_0x545500,_0x2f55ef,_0xfb44('0xc1'),JSON[_0xfb44('0x2a')](_0x2578bf));if(_0x25ddd8[_0xfb44('0x8d')][_0xfb44('0x43')]===_0xfb44('0x9e')){return _0x22506f[_0xfb44('0x2f')](_0x2f55ef)[_0xfb44('0x36')](_0xfb44('0xc2'),_0xfb44('0xc3'))[_0xfb44('0x3e')](_0xfb44('0xc4'));}else{return _0x22506f[_0xfb44('0x2f')](_0x2f55ef)[_0xfb44('0x31')](_0x2578bf);}}});})[_0xfb44('0x58')](handleError(_0x22506f,null));};exports[_0xfb44('0x3e')]=function(_0x447fd9,_0x32f848,_0x4d4c54){var _0x499838,_0x5710b6,_0x52e078;if(_['isNil'](_0x447fd9[_0xfb44('0x5c')][_0xfb44('0x5c')])||_0x447fd9['body'][_0xfb44('0x5c')]===''){throw new db[(_0xfb44('0xa7'))]['ValidationError'](_0xfb44('0xa9'));}if(_[_0xfb44('0xa6')](_0x447fd9[_0xfb44('0x5c')]['to'])){throw new db[(_0xfb44('0xa7'))][(_0xfb44('0x96'))](_0xfb44('0xc5'));}_0x499838=_0x447fd9[_0xfb44('0x5c')]['to'];return db[_0xfb44('0x53')]['find']({'where':{'id':_0x447fd9['params']['id']},'include':[{'model':db[_0xfb44('0xac')],'as':'List','include':[{'model':db[_0xfb44('0x95')],'as':'Contacts','where':{'mobile':_0x499838},'limit':0x1,'order':[[_0xfb44('0x9a'),_0xfb44('0xad')]]}]}]})[_0xfb44('0x24')](handleEntityNotFound(_0x32f848,null))[_0xfb44('0x24')](function(_0x3b4a4){if(_0x3b4a4&&_0x3b4a4[_0xfb44('0xc6')]){_0x5710b6=_0x3b4a4[_0xfb44('0x3c')]({'plain':!![]});if(_0x5710b6[_0xfb44('0xc6')]&&_0x5710b6[_0xfb44('0xc6')][_0xfb44('0xaf')][_0xfb44('0x4b')]){return _0x5710b6[_0xfb44('0xc6')][_0xfb44('0xaf')][0x0];}return db['CmContact'][_0xfb44('0x5b')](_['defaults'](_0x447fd9[_0xfb44('0x5c')],{'firstName':_0x499838,'mobile':_0x499838,'phone':_0x499838,'ListId':_0x5710b6[_0xfb44('0x9c')]}));}})['then'](handleEntityNotFound(_0x32f848,null))[_0xfb44('0x24')](function(_0x3a673e){if(_0x3a673e){_0x52e078=_0x3a673e;return db[_0xfb44('0xb1')][_0xfb44('0x62')]({'where':{'ContactId':_0x52e078['id'],'closed':![],'WhatsappAccountId':_0x5710b6['id']}})[_0xfb44('0x24')](function(_0x222299){if(_0x222299){return[_0x222299,![]];}return db[_0xfb44('0xb1')][_0xfb44('0x5b')]({'UserId':_0x447fd9[_0xfb44('0x5d')]['id'],'ContactId':_0x52e078['id'],'WhatsappAccountId':_0x5710b6['id'],'phone':_0x499838,'firstMsgDirection':_0xfb44('0xc7'),'Messages':[_[_0xfb44('0x50')](_0x447fd9[_0xfb44('0x5c')],{'read':![],'body':_0x447fd9[_0xfb44('0x5c')][_0xfb44('0x5c')],'phone':_0x499838,'WhatsappAccountId':_0x5710b6['id'],'UserId':_0x447fd9[_0xfb44('0x5d')]['id'],'ContactId':_0x52e078['id']})]},{'include':[{'model':db[_0xfb44('0x91')],'as':'Messages'}]})['then'](function(_0xfd0d9d){return[_0xfd0d9d,!![]];});});}})[_0xfb44('0x77')](function(_0x333be5,_0x56bc1f){if(_0x56bc1f){return _0x333be5;}return db[_0xfb44('0x91')][_0xfb44('0x5b')](_[_0xfb44('0x50')](_0x447fd9[_0xfb44('0x5c')],{'read':![],'body':_0x447fd9['body'][_0xfb44('0x5c')],'phone':_0x499838,'WhatsappAccountId':_0x5710b6['id'],'WhatsappInteractionId':_0x333be5['id'],'UserId':_0x447fd9[_0xfb44('0x5d')]['id'],'ContactId':_0x52e078['id']}))['then'](function(_0x5bd603){_0x333be5['dataValues'][_0xfb44('0xc8')]=[];_0x333be5[_0xfb44('0xc9')][_0xfb44('0xc8')]['push'](_0x5bd603[_0xfb44('0xc9')]);return _0x333be5;});})[_0xfb44('0x24')](respondWithResult(_0x32f848,null))[_0xfb44('0x58')](handleError(_0x32f848,null));}; \ No newline at end of file diff --git a/server/api/whatsappAccount/whatsappAccount.events.js b/server/api/whatsappAccount/whatsappAccount.events.js index 5c6943b..0dfd13f 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 _0xa613=['update','emit','hasOwnProperty','hook','exports','events','../../mysqldb','WhatsappAccount','setMaxListeners','save'];(function(_0x44b8c9,_0x3ef59c){var _0x13f5b1=function(_0x38102f){while(--_0x38102f){_0x44b8c9['push'](_0x44b8c9['shift']());}};_0x13f5b1(++_0x3ef59c);}(_0xa613,0x13b));var _0x3a61=function(_0x194b25,_0x4bedc4){_0x194b25=_0x194b25-0x0;var _0x107ac5=_0xa613[_0x194b25];return _0x107ac5;};'use strict';var EventEmitter=require(_0x3a61('0x0'));var WhatsappAccount=require(_0x3a61('0x1'))['db'][_0x3a61('0x2')];var WhatsappAccountEvents=new EventEmitter();WhatsappAccountEvents[_0x3a61('0x3')](0x0);var events={'afterCreate':_0x3a61('0x4'),'afterUpdate':_0x3a61('0x5'),'afterDestroy':'remove'};function emitEvent(_0x4e5642){return function(_0x4a2154,_0x1b3a18,_0x22649d){WhatsappAccountEvents[_0x3a61('0x6')](_0x4e5642+':'+_0x4a2154['id'],_0x4a2154);WhatsappAccountEvents[_0x3a61('0x6')](_0x4e5642,_0x4a2154);_0x22649d(null);};}for(var e in events){if(events[_0x3a61('0x7')](e)){var event=events[e];WhatsappAccount[_0x3a61('0x8')](e,emitEvent(event));}}module[_0x3a61('0x9')]=WhatsappAccountEvents; \ No newline at end of file +var _0x2c29=['exports','events','../../mysqldb','WhatsappAccount','setMaxListeners','save','remove','emit','hook'];(function(_0x3d5fc3,_0x452982){var _0x53faf1=function(_0x2c2be3){while(--_0x2c2be3){_0x3d5fc3['push'](_0x3d5fc3['shift']());}};_0x53faf1(++_0x452982);}(_0x2c29,0x17b));var _0x92c2=function(_0x17d9e3,_0x1f969c){_0x17d9e3=_0x17d9e3-0x0;var _0x14192d=_0x2c29[_0x17d9e3];return _0x14192d;};'use strict';var EventEmitter=require(_0x92c2('0x0'));var WhatsappAccount=require(_0x92c2('0x1'))['db'][_0x92c2('0x2')];var WhatsappAccountEvents=new EventEmitter();WhatsappAccountEvents[_0x92c2('0x3')](0x0);var events={'afterCreate':_0x92c2('0x4'),'afterUpdate':'update','afterDestroy':_0x92c2('0x5')};function emitEvent(_0xecbcd9){return function(_0x31c3df,_0xdb6f97,_0x39a038){WhatsappAccountEvents[_0x92c2('0x6')](_0xecbcd9+':'+_0x31c3df['id'],_0x31c3df);WhatsappAccountEvents['emit'](_0xecbcd9,_0x31c3df);_0x39a038(null);};}for(var e in events){if(events['hasOwnProperty'](e)){var event=events[e];WhatsappAccount[_0x92c2('0x7')](e,emitEvent(event));}}module[_0x92c2('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 a127402..5513b56 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 _0xe2f6=['request-promise','rimraf','../../config/environment','./whatsappAccount.attributes','exports','define','WhatsappAccount','whatsapp_accounts','lodash','api','moment','bluebird'];(function(_0x4565bf,_0x5ad9d6){var _0x5610ba=function(_0x170988){while(--_0x170988){_0x4565bf['push'](_0x4565bf['shift']());}};_0x5610ba(++_0x5ad9d6);}(_0xe2f6,0xbc));var _0x6e2f=function(_0x27b92f,_0x527750){_0x27b92f=_0x27b92f-0x0;var _0x3c5199=_0xe2f6[_0x27b92f];return _0x3c5199;};'use strict';var _=require(_0x6e2f('0x0'));var util=require('util');var logger=require('../../config/logger')(_0x6e2f('0x1'));var moment=require(_0x6e2f('0x2'));var BPromise=require(_0x6e2f('0x3'));var rp=require(_0x6e2f('0x4'));var fs=require('fs');var path=require('path');var rimraf=require(_0x6e2f('0x5'));var config=require(_0x6e2f('0x6'));var attributes=require(_0x6e2f('0x7'));module[_0x6e2f('0x8')]=function(_0x4fa8b4,_0x3a4e95){return _0x4fa8b4[_0x6e2f('0x9')](_0x6e2f('0xa'),attributes,{'tableName':_0x6e2f('0xb'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x000c=['../../config/logger','api','moment','bluebird','request-promise','path','../../config/environment','exports','define','WhatsappAccount','whatsapp_accounts','lodash','util'];(function(_0x4996d5,_0x123daf){var _0x4793f9=function(_0x30c7ec){while(--_0x30c7ec){_0x4996d5['push'](_0x4996d5['shift']());}};_0x4793f9(++_0x123daf);}(_0x000c,0x177));var _0xc000=function(_0x2b8e30,_0x320557){_0x2b8e30=_0x2b8e30-0x0;var _0x210f73=_0x000c[_0x2b8e30];return _0x210f73;};'use strict';var _=require(_0xc000('0x0'));var util=require(_0xc000('0x1'));var logger=require(_0xc000('0x2'))(_0xc000('0x3'));var moment=require(_0xc000('0x4'));var BPromise=require(_0xc000('0x5'));var rp=require(_0xc000('0x6'));var fs=require('fs');var path=require(_0xc000('0x7'));var rimraf=require('rimraf');var config=require(_0xc000('0x8'));var attributes=require('./whatsappAccount.attributes');module[_0xc000('0x9')]=function(_0xa4f3af,_0x228691){return _0xa4f3af[_0xc000('0xa')](_0xc000('0xb'),attributes,{'tableName':_0xc000('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 54ceb06..68b2cc5 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 _0x0056=['model','then','moment','bluebird','ioredis','../../mysqldb','../../config/utils','../../config/logger','client','redis','defaults','socket.io-emitter','./whatsappAccount.socket','register','request','info','request\x20sent','WhatsappAccount,\x20%s,\x20%s,\x20%s','stringify','error','WhatsappAccount,\x20%s,\x20%s','message','ShowWhatsappAccount','WhatsappAccount','find','options','raw','where','attributes','map','include'];(function(_0x2ac71a,_0x1d2a02){var _0x3ee904=function(_0x5c902a){while(--_0x5c902a){_0x2ac71a['push'](_0x2ac71a['shift']());}};_0x3ee904(++_0x1d2a02);}(_0x0056,0xdb));var _0x6005=function(_0x27e811,_0x20137c){_0x27e811=_0x27e811-0x0;var _0x1627fa=_0x0056[_0x27e811];return _0x1627fa;};'use strict';var _=require('lodash');var util=require('util');var moment=require(_0x6005('0x0'));var BPromise=require(_0x6005('0x1'));var rs=require('randomstring');var fs=require('fs');var Redis=require(_0x6005('0x2'));var db=require(_0x6005('0x3'))['db'];var utils=require(_0x6005('0x4'));var logger=require(_0x6005('0x5'))('rpc');var config=require('../../config/environment');var jayson=require('jayson/promise');var client=jayson[_0x6005('0x6')]['http']({'port':0x232a});config[_0x6005('0x7')]=_[_0x6005('0x8')](config[_0x6005('0x7')],{'host':'localhost','port':0x18eb});var socket=require(_0x6005('0x9'))(new Redis(config[_0x6005('0x7')]));require(_0x6005('0xa'))[_0x6005('0xb')](socket);function respondWithRpcPromise(_0x424114,_0x2fcde2,_0x38f839){return new BPromise(function(_0x2a1c63,_0x44a502){return client[_0x6005('0xc')](_0x424114,_0x38f839)['then'](function(_0x3ba917){logger[_0x6005('0xd')]('WhatsappAccount,\x20%s,\x20%s',_0x2fcde2,_0x6005('0xe'));logger['debug'](_0x6005('0xf'),_0x2fcde2,_0x6005('0xe'),JSON[_0x6005('0x10')](_0x3ba917));if(_0x3ba917[_0x6005('0x11')]){if(_0x3ba917['error']['code']===0x1f4){logger[_0x6005('0x11')](_0x6005('0x12'),_0x2fcde2,_0x3ba917[_0x6005('0x11')]['message']);return _0x44a502(_0x3ba917[_0x6005('0x11')]['message']);}logger[_0x6005('0x11')]('WhatsappAccount,\x20%s,\x20%s',_0x2fcde2,_0x3ba917[_0x6005('0x11')][_0x6005('0x13')]);return _0x2a1c63(_0x3ba917[_0x6005('0x11')]['message']);}else{logger[_0x6005('0xd')](_0x6005('0x12'),_0x2fcde2,_0x6005('0xe'));_0x2a1c63(_0x3ba917['result'][_0x6005('0x13')]);}})['catch'](function(_0x54152c){logger['error'](_0x6005('0x12'),_0x2fcde2,_0x54152c);_0x44a502(_0x54152c);});});}exports[_0x6005('0x14')]=function(_0x1f489d){var _0x1cb020=this;return new Promise(function(_0x59c8ea,_0x53c30b){return db[_0x6005('0x15')][_0x6005('0x16')]({'raw':_0x1f489d[_0x6005('0x17')]?_0x1f489d['options'][_0x6005('0x18')]===undefined?!![]:![]:!![],'where':_0x1f489d[_0x6005('0x17')]?_0x1f489d[_0x6005('0x17')][_0x6005('0x19')]||null:null,'attributes':_0x1f489d['options']?_0x1f489d[_0x6005('0x17')][_0x6005('0x1a')]||null:null,'include':_0x1f489d[_0x6005('0x17')]?_0x1f489d['options']['include']?_[_0x6005('0x1b')](_0x1f489d['options'][_0x6005('0x1c')],function(_0xfedac8){return{'model':db[_0xfedac8['model']],'as':_0xfedac8['as'],'attributes':_0xfedac8['attributes'],'include':_0xfedac8[_0x6005('0x1c')]?_[_0x6005('0x1b')](_0xfedac8[_0x6005('0x1c')],function(_0x53f015){return{'model':db[_0x53f015[_0x6005('0x1d')]],'as':_0x53f015['as'],'attributes':_0x53f015['attributes'],'include':_0x53f015[_0x6005('0x1c')]?_[_0x6005('0x1b')](_0x53f015[_0x6005('0x1c')],function(_0xb79021){return{'model':db[_0xb79021[_0x6005('0x1d')]],'as':_0xb79021['as'],'attributes':_0xb79021[_0x6005('0x1a')]};}):[]};}):[]};}):[]:[]})[_0x6005('0x1e')](function(_0x576390){logger[_0x6005('0xd')](_0x6005('0x14'),_0x1f489d);logger['debug']('ShowWhatsappAccount',_0x1f489d,JSON['stringify'](_0x576390));_0x59c8ea(_0x576390);})['catch'](function(_0x58223c){logger['error']('ShowWhatsappAccount',_0x58223c['message'],_0x1f489d);_0x53c30b(_0x1cb020[_0x6005('0x11')](0x1f4,_0x58223c[_0x6005('0x13')]));});});}; \ No newline at end of file +var _0xe033=['raw','where','attributes','model','map','include','then','lodash','moment','bluebird','randomstring','ioredis','../../mysqldb','jayson/promise','client','http','redis','defaults','localhost','./whatsappAccount.socket','request','WhatsappAccount,\x20%s,\x20%s','request\x20sent','debug','WhatsappAccount,\x20%s,\x20%s,\x20%s','stringify','error','code','message','info','result','catch','ShowWhatsappAccount','WhatsappAccount','find','options'];(function(_0x48168a,_0xf9dfe5){var _0x346d98=function(_0x22e41f){while(--_0x22e41f){_0x48168a['push'](_0x48168a['shift']());}};_0x346d98(++_0xf9dfe5);}(_0xe033,0x103));var _0x3e03=function(_0x227922,_0x4a7991){_0x227922=_0x227922-0x0;var _0x4dab52=_0xe033[_0x227922];return _0x4dab52;};'use strict';var _=require(_0x3e03('0x0'));var util=require('util');var moment=require(_0x3e03('0x1'));var BPromise=require(_0x3e03('0x2'));var rs=require(_0x3e03('0x3'));var fs=require('fs');var Redis=require(_0x3e03('0x4'));var db=require(_0x3e03('0x5'))['db'];var utils=require('../../config/utils');var logger=require('../../config/logger')('rpc');var config=require('../../config/environment');var jayson=require(_0x3e03('0x6'));var client=jayson[_0x3e03('0x7')][_0x3e03('0x8')]({'port':0x232a});config[_0x3e03('0x9')]=_[_0x3e03('0xa')](config['redis'],{'host':_0x3e03('0xb'),'port':0x18eb});var socket=require('socket.io-emitter')(new Redis(config[_0x3e03('0x9')]));require(_0x3e03('0xc'))['register'](socket);function respondWithRpcPromise(_0x2ae9bd,_0x24e3e8,_0x1ca521){return new BPromise(function(_0x1e0735,_0x50d91f){return client[_0x3e03('0xd')](_0x2ae9bd,_0x1ca521)['then'](function(_0x94fb04){logger['info'](_0x3e03('0xe'),_0x24e3e8,_0x3e03('0xf'));logger[_0x3e03('0x10')](_0x3e03('0x11'),_0x24e3e8,'request\x20sent',JSON[_0x3e03('0x12')](_0x94fb04));if(_0x94fb04[_0x3e03('0x13')]){if(_0x94fb04[_0x3e03('0x13')][_0x3e03('0x14')]===0x1f4){logger[_0x3e03('0x13')](_0x3e03('0xe'),_0x24e3e8,_0x94fb04[_0x3e03('0x13')][_0x3e03('0x15')]);return _0x50d91f(_0x94fb04[_0x3e03('0x13')][_0x3e03('0x15')]);}logger[_0x3e03('0x13')](_0x3e03('0xe'),_0x24e3e8,_0x94fb04[_0x3e03('0x13')]['message']);return _0x1e0735(_0x94fb04[_0x3e03('0x13')]['message']);}else{logger[_0x3e03('0x16')](_0x3e03('0xe'),_0x24e3e8,'request\x20sent');_0x1e0735(_0x94fb04[_0x3e03('0x17')][_0x3e03('0x15')]);}})[_0x3e03('0x18')](function(_0x18e75f){logger[_0x3e03('0x13')](_0x3e03('0xe'),_0x24e3e8,_0x18e75f);_0x50d91f(_0x18e75f);});});}exports[_0x3e03('0x19')]=function(_0x4d0184){var _0xaa73b6=this;return new Promise(function(_0x4a8fdf,_0x173841){return db[_0x3e03('0x1a')][_0x3e03('0x1b')]({'raw':_0x4d0184[_0x3e03('0x1c')]?_0x4d0184[_0x3e03('0x1c')][_0x3e03('0x1d')]===undefined?!![]:![]:!![],'where':_0x4d0184['options']?_0x4d0184['options'][_0x3e03('0x1e')]||null:null,'attributes':_0x4d0184[_0x3e03('0x1c')]?_0x4d0184[_0x3e03('0x1c')][_0x3e03('0x1f')]||null:null,'include':_0x4d0184['options']?_0x4d0184[_0x3e03('0x1c')]['include']?_['map'](_0x4d0184[_0x3e03('0x1c')]['include'],function(_0x54bf83){return{'model':db[_0x54bf83[_0x3e03('0x20')]],'as':_0x54bf83['as'],'attributes':_0x54bf83[_0x3e03('0x1f')],'include':_0x54bf83['include']?_[_0x3e03('0x21')](_0x54bf83[_0x3e03('0x22')],function(_0x406845){return{'model':db[_0x406845[_0x3e03('0x20')]],'as':_0x406845['as'],'attributes':_0x406845['attributes'],'include':_0x406845[_0x3e03('0x22')]?_[_0x3e03('0x21')](_0x406845['include'],function(_0x12f026){return{'model':db[_0x12f026[_0x3e03('0x20')]],'as':_0x12f026['as'],'attributes':_0x12f026[_0x3e03('0x1f')]};}):[]};}):[]};}):[]:[]})[_0x3e03('0x23')](function(_0x418ac4){logger[_0x3e03('0x16')](_0x3e03('0x19'),_0x4d0184);logger[_0x3e03('0x10')]('ShowWhatsappAccount',_0x4d0184,JSON[_0x3e03('0x12')](_0x418ac4));_0x4a8fdf(_0x418ac4);})[_0x3e03('0x18')](function(_0x2ebd02){logger[_0x3e03('0x13')](_0x3e03('0x19'),_0x2ebd02[_0x3e03('0x15')],_0x4d0184);_0x173841(_0xaa73b6['error'](0x1f4,_0x2ebd02[_0x3e03('0x15')]));});});}; \ No newline at end of file diff --git a/server/api/whatsappAccount/whatsappAccount.socket.js b/server/api/whatsappAccount/whatsappAccount.socket.js index 01c6bb4..d7b25f8 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 _0xa03d=['removeListener','register','length','whatsappAccount:','save','remove','update','emit'];(function(_0x4ba218,_0x48d5a9){var _0x1a6fd5=function(_0x3feded){while(--_0x3feded){_0x4ba218['push'](_0x4ba218['shift']());}};_0x1a6fd5(++_0x48d5a9);}(_0xa03d,0x1bc));var _0xda03=function(_0xbd2eb0,_0x5d63a9){_0xbd2eb0=_0xbd2eb0-0x0;var _0x4dfad0=_0xa03d[_0xbd2eb0];return _0x4dfad0;};'use strict';var WhatsappAccountEvents=require('./whatsappAccount.events');var events=[_0xda03('0x0'),_0xda03('0x1'),_0xda03('0x2')];function createListener(_0x3c2fdd,_0x1133ad){return function(_0x2ca84a){_0x1133ad[_0xda03('0x3')](_0x3c2fdd,_0x2ca84a);};}function removeListener(_0x2011f5,_0x175d43){return function(){WhatsappAccountEvents[_0xda03('0x4')](_0x2011f5,_0x175d43);};}exports[_0xda03('0x5')]=function(_0x44d599){for(var _0x468241=0x0,_0x2f5715=events[_0xda03('0x6')];_0x468241<_0x2f5715;_0x468241++){var _0x19b761=events[_0x468241];var _0x558fa5=createListener(_0xda03('0x7')+_0x19b761,_0x44d599);WhatsappAccountEvents['on'](_0x19b761,_0x558fa5);}}; \ No newline at end of file +var _0xfb97=['removeListener','register','length','whatsappAccount:','./whatsappAccount.events','save','remove','update','emit'];(function(_0x2bf16e,_0x21eace){var _0x164de8=function(_0x12c51b){while(--_0x12c51b){_0x2bf16e['push'](_0x2bf16e['shift']());}};_0x164de8(++_0x21eace);}(_0xfb97,0x1d8));var _0x7fb9=function(_0x2d582c,_0x424a15){_0x2d582c=_0x2d582c-0x0;var _0x37e92a=_0xfb97[_0x2d582c];return _0x37e92a;};'use strict';var WhatsappAccountEvents=require(_0x7fb9('0x0'));var events=[_0x7fb9('0x1'),_0x7fb9('0x2'),_0x7fb9('0x3')];function createListener(_0xc1784a,_0x32986e){return function(_0x1a24dc){_0x32986e[_0x7fb9('0x4')](_0xc1784a,_0x1a24dc);};}function removeListener(_0x2b740,_0x2551c9){return function(){WhatsappAccountEvents[_0x7fb9('0x5')](_0x2b740,_0x2551c9);};}exports[_0x7fb9('0x6')]=function(_0x4c48b8){for(var _0x3509a6=0x0,_0x40ed70=events[_0x7fb9('0x7')];_0x3509a6<_0x40ed70;_0x3509a6++){var _0x5f2e1c=events[_0x3509a6];var _0x4440e0=createListener(_0x7fb9('0x8')+_0x5f2e1c,_0x4c48b8);WhatsappAccountEvents['on'](_0x5f2e1c,_0x4440e0);}}; \ No newline at end of file diff --git a/server/api/whatsappApplication/index.js b/server/api/whatsappApplication/index.js index bda0acf..6e1ab36 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 _0xd3c0=['exports','util','path','connect-timeout','express','Router','fs-extra','../../config/environment','get','isAuthenticated','index','show','post','create','/:id','update','destroy'];(function(_0x31cf7b,_0x4906a4){var _0x2f518d=function(_0x4604ad){while(--_0x4604ad){_0x31cf7b['push'](_0x31cf7b['shift']());}};_0x2f518d(++_0x4906a4);}(_0xd3c0,0x1cc));var _0x0d3c=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0xd3c0[_0x3dd15e];return _0x231fd0;};'use strict';var multer=require('multer');var util=require(_0x0d3c('0x0'));var path=require(_0x0d3c('0x1'));var timeout=require(_0x0d3c('0x2'));var express=require(_0x0d3c('0x3'));var router=express[_0x0d3c('0x4')]();var fs_extra=require(_0x0d3c('0x5'));var auth=require('../../components/auth/service');var interaction=require('../../components/interaction/service');var config=require(_0x0d3c('0x6'));var controller=require('./whatsappApplication.controller');router[_0x0d3c('0x7')]('/',auth[_0x0d3c('0x8')](),controller[_0x0d3c('0x9')]);router[_0x0d3c('0x7')]('/:id',auth[_0x0d3c('0x8')](),controller[_0x0d3c('0xa')]);router[_0x0d3c('0xb')]('/',auth[_0x0d3c('0x8')](),controller[_0x0d3c('0xc')]);router['put'](_0x0d3c('0xd'),auth[_0x0d3c('0x8')](),controller[_0x0d3c('0xe')]);router['delete'](_0x0d3c('0xd'),auth[_0x0d3c('0x8')](),controller[_0x0d3c('0xf')]);module[_0x0d3c('0x10')]=router; \ No newline at end of file +var _0x062b=['exports','connect-timeout','express','Router','fs-extra','../../components/interaction/service','../../config/environment','./whatsappApplication.controller','get','/:id','isAuthenticated','show','post','put','update','delete','destroy'];(function(_0x5b2d8d,_0x10aeec){var _0x5231b2=function(_0x19ba74){while(--_0x19ba74){_0x5b2d8d['push'](_0x5b2d8d['shift']());}};_0x5231b2(++_0x10aeec);}(_0x062b,0x9a));var _0xb062=function(_0xa4688f,_0x157f6b){_0xa4688f=_0xa4688f-0x0;var _0x22acf7=_0x062b[_0xa4688f];return _0x22acf7;};'use strict';var multer=require('multer');var util=require('util');var path=require('path');var timeout=require(_0xb062('0x0'));var express=require(_0xb062('0x1'));var router=express[_0xb062('0x2')]();var fs_extra=require(_0xb062('0x3'));var auth=require('../../components/auth/service');var interaction=require(_0xb062('0x4'));var config=require(_0xb062('0x5'));var controller=require(_0xb062('0x6'));router[_0xb062('0x7')]('/',auth['isAuthenticated'](),controller['index']);router[_0xb062('0x7')](_0xb062('0x8'),auth[_0xb062('0x9')](),controller[_0xb062('0xa')]);router[_0xb062('0xb')]('/',auth[_0xb062('0x9')](),controller['create']);router[_0xb062('0xc')](_0xb062('0x8'),auth[_0xb062('0x9')](),controller[_0xb062('0xd')]);router[_0xb062('0xe')](_0xb062('0x8'),auth[_0xb062('0x9')](),controller[_0xb062('0xf')]);module[_0xb062('0x10')]=router; \ No newline at end of file diff --git a/server/api/whatsappApplication/whatsappApplication.attributes.js b/server/api/whatsappApplication/whatsappApplication.attributes.js index 3e21ab0..d8ecd8a 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 _0xb3a6=['STRING','TEXT','exports','INTEGER'];(function(_0x471bd1,_0x4a9445){var _0x259e20=function(_0x53ae6d){while(--_0x53ae6d){_0x471bd1['push'](_0x471bd1['shift']());}};_0x259e20(++_0x4a9445);}(_0xb3a6,0x10e));var _0x6b3a=function(_0x46ae5a,_0x2a38d0){_0x46ae5a=_0x46ae5a-0x0;var _0x434986=_0xb3a6[_0x46ae5a];return _0x434986;};'use strict';var Sequelize=require('sequelize');module[_0x6b3a('0x0')]={'priority':{'type':Sequelize[_0x6b3a('0x1')],'allowNull':![]},'app':{'type':Sequelize[_0x6b3a('0x2')],'allowNull':![],'defaultValue':'noop'},'appdata':{'type':Sequelize[_0x6b3a('0x3')]()},'description':{'type':Sequelize[_0x6b3a('0x2')]},'interval':{'type':Sequelize[_0x6b3a('0x2')],'defaultValue':'*,*,*,*'}}; \ No newline at end of file +var _0xc4ff=['noop','TEXT','*,*,*,*','exports','INTEGER','STRING'];(function(_0x479fca,_0x5466c5){var _0x5f0526=function(_0x295081){while(--_0x295081){_0x479fca['push'](_0x479fca['shift']());}};_0x5f0526(++_0x5466c5);}(_0xc4ff,0x111));var _0xfc4f=function(_0x395309,_0x3e10c5){_0x395309=_0x395309-0x0;var _0x1391b3=_0xc4ff[_0x395309];return _0x1391b3;};'use strict';var Sequelize=require('sequelize');module[_0xfc4f('0x0')]={'priority':{'type':Sequelize[_0xfc4f('0x1')],'allowNull':![]},'app':{'type':Sequelize[_0xfc4f('0x2')],'allowNull':![],'defaultValue':_0xfc4f('0x3')},'appdata':{'type':Sequelize[_0xfc4f('0x4')]()},'description':{'type':Sequelize['STRING']},'interval':{'type':Sequelize[_0xfc4f('0x2')],'defaultValue':_0xfc4f('0x5')}}; \ No newline at end of file diff --git a/server/api/whatsappApplication/whatsappApplication.controller.js b/server/api/whatsappApplication/whatsappApplication.controller.js index d18dc06..e18258b 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 _0x4b17=['status','set','Content-Range','apply','save','update','then','destroy','end','error','stack','name','send','index','map','WhatsappApplication','fieldName','type','model','query','keys','filters','intersection','attributes','fields','length','hasOwnProperty','nolimit','order','sort','where','pick','filter','VIRTUAL','merge','include','findAll','rows','show','params','rawAttributes','options','find','catch','create','body','eml-format','zip-dir','request-promise','moment','mustache','sox','to-csv','ejs','fs-extra','lodash','squel','crypto','desk.js','querystring','papaparse','ioredis','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/logger','api','../../config/utils','../../config/environment','../../mysqldb','sendStatus','json','offset','limit','undefined','count'];(function(_0xa8f776,_0x420cbf){var _0x435961=function(_0x241c69){while(--_0x241c69){_0xa8f776['push'](_0xa8f776['shift']());}};_0x435961(++_0x420cbf);}(_0x4b17,0x10f));var _0x74b1=function(_0x1b76e6,_0x598520){_0x1b76e6=_0x1b76e6-0x0;var _0x333b53=_0x4b17[_0x1b76e6];return _0x333b53;};'use strict';var emlformat=require(_0x74b1('0x0'));var rimraf=require('rimraf');var zipdir=require(_0x74b1('0x1'));var jsonpatch=require('fast-json-patch');var rp=require(_0x74b1('0x2'));var moment=require(_0x74b1('0x3'));var BPromise=require('bluebird');var Mustache=require(_0x74b1('0x4'));var util=require('util');var path=require('path');var sox=require(_0x74b1('0x5'));var csv=require(_0x74b1('0x6'));var ejs=require(_0x74b1('0x7'));var fs=require('fs');var fs_extra=require(_0x74b1('0x8'));var _=require(_0x74b1('0x9'));var squel=require(_0x74b1('0xa'));var crypto=require(_0x74b1('0xb'));var jsforce=require('jsforce');var deskjs=require(_0x74b1('0xc'));var toCsv=require(_0x74b1('0x6'));var querystring=require(_0x74b1('0xd'));var Papa=require(_0x74b1('0xe'));var Redis=require(_0x74b1('0xf'));var authService=require('../../components/auth/service');var qs=require(_0x74b1('0x10'));var as=require(_0x74b1('0x11'));var hardwareService=require('../../config/license/hardware');var logger=require(_0x74b1('0x12'))(_0x74b1('0x13'));var utils=require(_0x74b1('0x14'));var config=require(_0x74b1('0x15'));var licenseUtil=require('../../config/license/util');var db=require(_0x74b1('0x16'))['db'];function respondWithStatusCode(_0x5cfe85,_0x5f2865){_0x5f2865=_0x5f2865||0xcc;return function(_0x239d04){if(_0x239d04){return _0x5cfe85[_0x74b1('0x17')](_0x5f2865);}return _0x5cfe85['status'](_0x5f2865)['end']();};}function respondWithResult(_0x500ce2,_0x86390){_0x86390=_0x86390||0xc8;return function(_0x5c12eb){if(_0x5c12eb){return _0x500ce2['status'](_0x86390)[_0x74b1('0x18')](_0x5c12eb);}};}function respondWithFilteredResult(_0x12a2c0,_0x3779c5){return function(_0x420662){if(_0x420662){var _0x16b147=typeof _0x3779c5[_0x74b1('0x19')]==='undefined'&&typeof _0x3779c5[_0x74b1('0x1a')]===_0x74b1('0x1b');var _0x1a0851=_0x420662[_0x74b1('0x1c')];var _0xde2736=_0x16b147?0x0:_0x3779c5[_0x74b1('0x19')];var _0x1ab838=_0x16b147?_0x420662['count']:_0x3779c5[_0x74b1('0x19')]+_0x3779c5[_0x74b1('0x1a')];var _0x524ece;if(_0x1ab838>=_0x1a0851){_0x1ab838=_0x1a0851;_0x524ece=0xc8;}else{_0x524ece=0xce;}_0x12a2c0[_0x74b1('0x1d')](_0x524ece);return _0x12a2c0[_0x74b1('0x1e')](_0x74b1('0x1f'),_0xde2736+'-'+_0x1ab838+'/'+_0x1a0851)[_0x74b1('0x18')](_0x420662);}return null;};}function patchUpdates(_0x13bb44){return function(_0x33fee9){try{jsonpatch[_0x74b1('0x20')](_0x33fee9,_0x13bb44,!![]);}catch(_0xaac5f7){return BPromise['reject'](_0xaac5f7);}return _0x33fee9[_0x74b1('0x21')]();};}function saveUpdates(_0x4f1ec9,_0x5da0f7){return function(_0x481bf2){if(_0x481bf2){return _0x481bf2[_0x74b1('0x22')](_0x4f1ec9)[_0x74b1('0x23')](function(_0x405a22){return _0x405a22;});}return null;};}function removeEntity(_0x44bf7e,_0x563781){return function(_0x4ee88b){if(_0x4ee88b){return _0x4ee88b[_0x74b1('0x24')]()['then'](function(){_0x44bf7e[_0x74b1('0x1d')](0xcc)[_0x74b1('0x25')]();});}};}function handleEntityNotFound(_0xb5af0,_0x14a651){return function(_0x3239d8){if(!_0x3239d8){_0xb5af0[_0x74b1('0x17')](0x194);}return _0x3239d8;};}function handleError(_0x115918,_0x33fa8e){_0x33fa8e=_0x33fa8e||0x1f4;return function(_0x4c7f05){logger[_0x74b1('0x26')](_0x4c7f05[_0x74b1('0x27')]);if(_0x4c7f05[_0x74b1('0x28')]){delete _0x4c7f05['name'];}_0x115918[_0x74b1('0x1d')](_0x33fa8e)[_0x74b1('0x29')](_0x4c7f05);};}exports[_0x74b1('0x2a')]=function(_0x1b011a,_0x26d9f1){var _0x273ff1={},_0x436eda={},_0x3ce043={'count':0x0,'rows':[]};var _0x4fbe3d=_[_0x74b1('0x2b')](db[_0x74b1('0x2c')]['rawAttributes'],function(_0x543b5){return{'name':_0x543b5[_0x74b1('0x2d')],'type':_0x543b5[_0x74b1('0x2e')]['key']};});_0x436eda[_0x74b1('0x2f')]=_[_0x74b1('0x2b')](_0x4fbe3d,'name');_0x436eda[_0x74b1('0x30')]=_[_0x74b1('0x31')](_0x1b011a[_0x74b1('0x30')]);_0x436eda[_0x74b1('0x32')]=_[_0x74b1('0x33')](_0x436eda[_0x74b1('0x2f')],_0x436eda[_0x74b1('0x30')]);_0x273ff1[_0x74b1('0x34')]=_['intersection'](_0x436eda[_0x74b1('0x2f')],qs['fields'](_0x1b011a['query'][_0x74b1('0x35')]));_0x273ff1['attributes']=_0x273ff1['attributes'][_0x74b1('0x36')]?_0x273ff1[_0x74b1('0x34')]:_0x436eda[_0x74b1('0x2f')];if(!_0x1b011a[_0x74b1('0x30')][_0x74b1('0x37')](_0x74b1('0x38'))){_0x273ff1[_0x74b1('0x1a')]=qs[_0x74b1('0x1a')](_0x1b011a['query']['limit']);_0x273ff1['offset']=qs[_0x74b1('0x19')](_0x1b011a['query']['offset']);}_0x273ff1[_0x74b1('0x39')]=qs[_0x74b1('0x3a')](_0x1b011a[_0x74b1('0x30')]['sort']);_0x273ff1[_0x74b1('0x3b')]=qs['filters'](_[_0x74b1('0x3c')](_0x1b011a[_0x74b1('0x30')],_0x436eda['filters']),_0x4fbe3d);if(_0x1b011a['query'][_0x74b1('0x3d')]){_0x273ff1[_0x74b1('0x3b')]=_['merge'](_0x273ff1['where'],{'$or':_[_0x74b1('0x2b')](_0x4fbe3d,function(_0x5298f6){if(_0x5298f6[_0x74b1('0x2e')]!==_0x74b1('0x3e')){var _0x15e695={};_0x15e695[_0x5298f6[_0x74b1('0x28')]]={'$like':'%'+_0x1b011a[_0x74b1('0x30')]['filter']+'%'};return _0x15e695;}})});}_0x273ff1=_[_0x74b1('0x3f')]({},_0x273ff1,_0x1b011a['options']);var _0x41a78b={'where':_0x273ff1['where']};return db[_0x74b1('0x2c')]['count'](_0x41a78b)['then'](function(_0xcdb873){_0x3ce043[_0x74b1('0x1c')]=_0xcdb873;if(_0x1b011a[_0x74b1('0x30')]['includeAll']){_0x273ff1[_0x74b1('0x40')]=[{'all':!![]}];}return db[_0x74b1('0x2c')][_0x74b1('0x41')](_0x273ff1);})['then'](function(_0xfecdc){_0x3ce043[_0x74b1('0x42')]=_0xfecdc;return _0x3ce043;})['then'](respondWithFilteredResult(_0x26d9f1,_0x273ff1))['catch'](handleError(_0x26d9f1,null));};exports[_0x74b1('0x43')]=function(_0x2dcaf6,_0x416c8d){var _0x444870={'raw':!![],'where':{'id':_0x2dcaf6[_0x74b1('0x44')]['id']}},_0x1d9f5b={};_0x1d9f5b[_0x74b1('0x2f')]=_['keys'](db[_0x74b1('0x2c')][_0x74b1('0x45')]);_0x1d9f5b[_0x74b1('0x30')]=_[_0x74b1('0x31')](_0x2dcaf6[_0x74b1('0x30')]);_0x1d9f5b['filters']=_[_0x74b1('0x33')](_0x1d9f5b[_0x74b1('0x2f')],_0x1d9f5b['query']);_0x444870['attributes']=_[_0x74b1('0x33')](_0x1d9f5b[_0x74b1('0x2f')],qs['fields'](_0x2dcaf6[_0x74b1('0x30')][_0x74b1('0x35')]));_0x444870[_0x74b1('0x34')]=_0x444870[_0x74b1('0x34')][_0x74b1('0x36')]?_0x444870[_0x74b1('0x34')]:_0x1d9f5b[_0x74b1('0x2f')];if(_0x2dcaf6['query']['includeAll']){_0x444870['include']=[{'all':!![]}];}_0x444870=_[_0x74b1('0x3f')]({},_0x444870,_0x2dcaf6[_0x74b1('0x46')]);return db[_0x74b1('0x2c')][_0x74b1('0x47')](_0x444870)[_0x74b1('0x23')](handleEntityNotFound(_0x416c8d,null))['then'](respondWithResult(_0x416c8d,null))[_0x74b1('0x48')](handleError(_0x416c8d,null));};exports[_0x74b1('0x49')]=function(_0x18687c,_0x33c215){return db[_0x74b1('0x2c')][_0x74b1('0x49')](_0x18687c[_0x74b1('0x4a')],{})[_0x74b1('0x23')](respondWithResult(_0x33c215,0xc9))[_0x74b1('0x48')](handleError(_0x33c215,null));};exports[_0x74b1('0x22')]=function(_0x186516,_0x3038f9){if(_0x186516['body']['id']){delete _0x186516[_0x74b1('0x4a')]['id'];}return db[_0x74b1('0x2c')]['find']({'where':{'id':_0x186516[_0x74b1('0x44')]['id']}})['then'](handleEntityNotFound(_0x3038f9,null))[_0x74b1('0x23')](saveUpdates(_0x186516[_0x74b1('0x4a')],null))['then'](respondWithResult(_0x3038f9,null))[_0x74b1('0x48')](handleError(_0x3038f9,null));};exports[_0x74b1('0x24')]=function(_0x326b98,_0x549f03){return db[_0x74b1('0x2c')][_0x74b1('0x47')]({'where':{'id':_0x326b98[_0x74b1('0x44')]['id']}})[_0x74b1('0x23')](handleEntityNotFound(_0x549f03,null))[_0x74b1('0x23')](removeEntity(_0x549f03,null))['catch'](handleError(_0x549f03,null));}; \ No newline at end of file +var _0x937d=['crypto','desk.js','querystring','papaparse','ioredis','../../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','apply','reject','update','then','destroy','name','send','index','WhatsappApplication','rawAttributes','fieldName','key','model','map','query','keys','filters','intersection','attributes','fields','length','hasOwnProperty','nolimit','sort','where','pick','filter','merge','type','VIRTUAL','options','include','rows','catch','show','includeAll','find','create','body','params','eml-format','request-promise','moment','bluebird','mustache','util','path','to-csv','ejs','fs-extra','squel'];(function(_0x3818c0,_0x542521){var _0x55ec33=function(_0x2be9ea){while(--_0x2be9ea){_0x3818c0['push'](_0x3818c0['shift']());}};_0x55ec33(++_0x542521);}(_0x937d,0x1f4));var _0xd937=function(_0x276666,_0x5ce5e6){_0x276666=_0x276666-0x0;var _0x4e3cf1=_0x937d[_0x276666];return _0x4e3cf1;};'use strict';var emlformat=require(_0xd937('0x0'));var rimraf=require('rimraf');var zipdir=require('zip-dir');var jsonpatch=require('fast-json-patch');var rp=require(_0xd937('0x1'));var moment=require(_0xd937('0x2'));var BPromise=require(_0xd937('0x3'));var Mustache=require(_0xd937('0x4'));var util=require(_0xd937('0x5'));var path=require(_0xd937('0x6'));var sox=require('sox');var csv=require(_0xd937('0x7'));var ejs=require(_0xd937('0x8'));var fs=require('fs');var fs_extra=require(_0xd937('0x9'));var _=require('lodash');var squel=require(_0xd937('0xa'));var crypto=require(_0xd937('0xb'));var jsforce=require('jsforce');var deskjs=require(_0xd937('0xc'));var toCsv=require(_0xd937('0x7'));var querystring=require(_0xd937('0xd'));var Papa=require(_0xd937('0xe'));var Redis=require(_0xd937('0xf'));var authService=require('../../components/auth/service');var qs=require(_0xd937('0x10'));var as=require('../../components/parsers/advancedSearch');var hardwareService=require(_0xd937('0x11'));var logger=require('../../config/logger')(_0xd937('0x12'));var utils=require(_0xd937('0x13'));var config=require(_0xd937('0x14'));var licenseUtil=require(_0xd937('0x15'));var db=require(_0xd937('0x16'))['db'];function respondWithStatusCode(_0x518621,_0xb3a15a){_0xb3a15a=_0xb3a15a||0xcc;return function(_0xa12849){if(_0xa12849){return _0x518621[_0xd937('0x17')](_0xb3a15a);}return _0x518621[_0xd937('0x18')](_0xb3a15a)[_0xd937('0x19')]();};}function respondWithResult(_0x5361d,_0x3e9e5b){_0x3e9e5b=_0x3e9e5b||0xc8;return function(_0x174ddf){if(_0x174ddf){return _0x5361d[_0xd937('0x18')](_0x3e9e5b)[_0xd937('0x1a')](_0x174ddf);}};}function respondWithFilteredResult(_0x5e9642,_0x2f5ef4){return function(_0x10910c){if(_0x10910c){var _0x295a82=typeof _0x2f5ef4['offset']===_0xd937('0x1b')&&typeof _0x2f5ef4[_0xd937('0x1c')]===_0xd937('0x1b');var _0x4e72fe=_0x10910c[_0xd937('0x1d')];var _0x3d6b1c=_0x295a82?0x0:_0x2f5ef4[_0xd937('0x1e')];var _0x1bd7ee=_0x295a82?_0x10910c[_0xd937('0x1d')]:_0x2f5ef4[_0xd937('0x1e')]+_0x2f5ef4[_0xd937('0x1c')];var _0x311f08;if(_0x1bd7ee>=_0x4e72fe){_0x1bd7ee=_0x4e72fe;_0x311f08=0xc8;}else{_0x311f08=0xce;}_0x5e9642[_0xd937('0x18')](_0x311f08);return _0x5e9642[_0xd937('0x1f')](_0xd937('0x20'),_0x3d6b1c+'-'+_0x1bd7ee+'/'+_0x4e72fe)[_0xd937('0x1a')](_0x10910c);}return null;};}function patchUpdates(_0x2c18ea){return function(_0x166cb9){try{jsonpatch[_0xd937('0x21')](_0x166cb9,_0x2c18ea,!![]);}catch(_0x2699e8){return BPromise[_0xd937('0x22')](_0x2699e8);}return _0x166cb9['save']();};}function saveUpdates(_0x7362d9,_0x168f3e){return function(_0x86c492){if(_0x86c492){return _0x86c492[_0xd937('0x23')](_0x7362d9)[_0xd937('0x24')](function(_0x31ff83){return _0x31ff83;});}return null;};}function removeEntity(_0x475080,_0x325e68){return function(_0x194fe5){if(_0x194fe5){return _0x194fe5[_0xd937('0x25')]()[_0xd937('0x24')](function(){_0x475080['status'](0xcc)['end']();});}};}function handleEntityNotFound(_0x541ded,_0x22ed55){return function(_0x1d5a26){if(!_0x1d5a26){_0x541ded['sendStatus'](0x194);}return _0x1d5a26;};}function handleError(_0x143f65,_0x2a741b){_0x2a741b=_0x2a741b||0x1f4;return function(_0x15919f){logger['error'](_0x15919f['stack']);if(_0x15919f[_0xd937('0x26')]){delete _0x15919f[_0xd937('0x26')];}_0x143f65[_0xd937('0x18')](_0x2a741b)[_0xd937('0x27')](_0x15919f);};}exports[_0xd937('0x28')]=function(_0x46c855,_0x291fb7){var _0x2d29c0={},_0x40b26b={},_0x33b7d9={'count':0x0,'rows':[]};var _0x11aa02=_['map'](db[_0xd937('0x29')][_0xd937('0x2a')],function(_0xaba6e0){return{'name':_0xaba6e0[_0xd937('0x2b')],'type':_0xaba6e0['type'][_0xd937('0x2c')]};});_0x40b26b[_0xd937('0x2d')]=_[_0xd937('0x2e')](_0x11aa02,_0xd937('0x26'));_0x40b26b[_0xd937('0x2f')]=_[_0xd937('0x30')](_0x46c855[_0xd937('0x2f')]);_0x40b26b[_0xd937('0x31')]=_[_0xd937('0x32')](_0x40b26b[_0xd937('0x2d')],_0x40b26b[_0xd937('0x2f')]);_0x2d29c0[_0xd937('0x33')]=_[_0xd937('0x32')](_0x40b26b[_0xd937('0x2d')],qs['fields'](_0x46c855['query'][_0xd937('0x34')]));_0x2d29c0[_0xd937('0x33')]=_0x2d29c0[_0xd937('0x33')][_0xd937('0x35')]?_0x2d29c0[_0xd937('0x33')]:_0x40b26b[_0xd937('0x2d')];if(!_0x46c855[_0xd937('0x2f')][_0xd937('0x36')](_0xd937('0x37'))){_0x2d29c0[_0xd937('0x1c')]=qs[_0xd937('0x1c')](_0x46c855['query']['limit']);_0x2d29c0['offset']=qs[_0xd937('0x1e')](_0x46c855['query'][_0xd937('0x1e')]);}_0x2d29c0['order']=qs[_0xd937('0x38')](_0x46c855[_0xd937('0x2f')][_0xd937('0x38')]);_0x2d29c0[_0xd937('0x39')]=qs[_0xd937('0x31')](_[_0xd937('0x3a')](_0x46c855[_0xd937('0x2f')],_0x40b26b[_0xd937('0x31')]),_0x11aa02);if(_0x46c855[_0xd937('0x2f')][_0xd937('0x3b')]){_0x2d29c0[_0xd937('0x39')]=_[_0xd937('0x3c')](_0x2d29c0[_0xd937('0x39')],{'$or':_[_0xd937('0x2e')](_0x11aa02,function(_0x203c51){if(_0x203c51[_0xd937('0x3d')]!==_0xd937('0x3e')){var _0x52435f={};_0x52435f[_0x203c51[_0xd937('0x26')]]={'$like':'%'+_0x46c855[_0xd937('0x2f')][_0xd937('0x3b')]+'%'};return _0x52435f;}})});}_0x2d29c0=_[_0xd937('0x3c')]({},_0x2d29c0,_0x46c855[_0xd937('0x3f')]);var _0x20b7c2={'where':_0x2d29c0['where']};return db[_0xd937('0x29')]['count'](_0x20b7c2)[_0xd937('0x24')](function(_0x6ad956){_0x33b7d9[_0xd937('0x1d')]=_0x6ad956;if(_0x46c855[_0xd937('0x2f')]['includeAll']){_0x2d29c0[_0xd937('0x40')]=[{'all':!![]}];}return db[_0xd937('0x29')]['findAll'](_0x2d29c0);})[_0xd937('0x24')](function(_0x3a1eb3){_0x33b7d9[_0xd937('0x41')]=_0x3a1eb3;return _0x33b7d9;})[_0xd937('0x24')](respondWithFilteredResult(_0x291fb7,_0x2d29c0))[_0xd937('0x42')](handleError(_0x291fb7,null));};exports[_0xd937('0x43')]=function(_0x4b8263,_0x58b070){var _0x3d84ce={'raw':!![],'where':{'id':_0x4b8263['params']['id']}},_0x26b615={};_0x26b615['model']=_[_0xd937('0x30')](db['WhatsappApplication'][_0xd937('0x2a')]);_0x26b615[_0xd937('0x2f')]=_[_0xd937('0x30')](_0x4b8263[_0xd937('0x2f')]);_0x26b615[_0xd937('0x31')]=_[_0xd937('0x32')](_0x26b615[_0xd937('0x2d')],_0x26b615[_0xd937('0x2f')]);_0x3d84ce[_0xd937('0x33')]=_[_0xd937('0x32')](_0x26b615['model'],qs[_0xd937('0x34')](_0x4b8263[_0xd937('0x2f')][_0xd937('0x34')]));_0x3d84ce[_0xd937('0x33')]=_0x3d84ce[_0xd937('0x33')]['length']?_0x3d84ce['attributes']:_0x26b615['model'];if(_0x4b8263[_0xd937('0x2f')][_0xd937('0x44')]){_0x3d84ce[_0xd937('0x40')]=[{'all':!![]}];}_0x3d84ce=_[_0xd937('0x3c')]({},_0x3d84ce,_0x4b8263[_0xd937('0x3f')]);return db[_0xd937('0x29')][_0xd937('0x45')](_0x3d84ce)[_0xd937('0x24')](handleEntityNotFound(_0x58b070,null))[_0xd937('0x24')](respondWithResult(_0x58b070,null))['catch'](handleError(_0x58b070,null));};exports['create']=function(_0x3c184f,_0x5cbff6){return db[_0xd937('0x29')][_0xd937('0x46')](_0x3c184f[_0xd937('0x47')],{})[_0xd937('0x24')](respondWithResult(_0x5cbff6,0xc9))[_0xd937('0x42')](handleError(_0x5cbff6,null));};exports[_0xd937('0x23')]=function(_0x27c5eb,_0x463da0){if(_0x27c5eb[_0xd937('0x47')]['id']){delete _0x27c5eb[_0xd937('0x47')]['id'];}return db[_0xd937('0x29')]['find']({'where':{'id':_0x27c5eb[_0xd937('0x48')]['id']}})['then'](handleEntityNotFound(_0x463da0,null))[_0xd937('0x24')](saveUpdates(_0x27c5eb[_0xd937('0x47')],null))[_0xd937('0x24')](respondWithResult(_0x463da0,null))[_0xd937('0x42')](handleError(_0x463da0,null));};exports['destroy']=function(_0x3d2821,_0x45621e){return db[_0xd937('0x29')][_0xd937('0x45')]({'where':{'id':_0x3d2821[_0xd937('0x48')]['id']}})[_0xd937('0x24')](handleEntityNotFound(_0x45621e,null))[_0xd937('0x24')](removeEntity(_0x45621e,null))[_0xd937('0x42')](handleError(_0x45621e,null));}; \ No newline at end of file diff --git a/server/api/whatsappApplication/whatsappApplication.model.js b/server/api/whatsappApplication/whatsappApplication.model.js index c121461..5a45853 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 _0xfa2b=['exports','define','WhatsappApplication','utf8mb4','lodash','util','../../config/logger','api','moment','bluebird','request-promise','path','rimraf','../../config/environment','./whatsappApplication.attributes'];(function(_0x19950b,_0x53d0d7){var _0x3c6b41=function(_0x3924ad){while(--_0x3924ad){_0x19950b['push'](_0x19950b['shift']());}};_0x3c6b41(++_0x53d0d7);}(_0xfa2b,0x1b7));var _0xbfa2=function(_0x511f72,_0x2c3047){_0x511f72=_0x511f72-0x0;var _0x4d8b55=_0xfa2b[_0x511f72];return _0x4d8b55;};'use strict';var _=require(_0xbfa2('0x0'));var util=require(_0xbfa2('0x1'));var logger=require(_0xbfa2('0x2'))(_0xbfa2('0x3'));var moment=require(_0xbfa2('0x4'));var BPromise=require(_0xbfa2('0x5'));var rp=require(_0xbfa2('0x6'));var fs=require('fs');var path=require(_0xbfa2('0x7'));var rimraf=require(_0xbfa2('0x8'));var config=require(_0xbfa2('0x9'));var attributes=require(_0xbfa2('0xa'));module[_0xbfa2('0xb')]=function(_0x12d71e,_0x237a99){return _0x12d71e[_0xbfa2('0xc')](_0xbfa2('0xd'),attributes,{'tableName':'whatsapp_applications','paranoid':![],'indexes':[],'timestamps':!![],'charset':_0xbfa2('0xe'),'collate':'utf8mb4_unicode_ci'});}; \ No newline at end of file +var _0xac31=['request-promise','rimraf','../../config/environment','define','WhatsappApplication','whatsapp_applications','utf8mb4_unicode_ci','lodash','util','../../config/logger','api','moment','bluebird'];(function(_0x5ec3e2,_0x5294df){var _0x152654=function(_0x4c1669){while(--_0x4c1669){_0x5ec3e2['push'](_0x5ec3e2['shift']());}};_0x152654(++_0x5294df);}(_0xac31,0xca));var _0x1ac3=function(_0x5eca16,_0x1fb504){_0x5eca16=_0x5eca16-0x0;var _0x104870=_0xac31[_0x5eca16];return _0x104870;};'use strict';var _=require(_0x1ac3('0x0'));var util=require(_0x1ac3('0x1'));var logger=require(_0x1ac3('0x2'))(_0x1ac3('0x3'));var moment=require(_0x1ac3('0x4'));var BPromise=require(_0x1ac3('0x5'));var rp=require(_0x1ac3('0x6'));var fs=require('fs');var path=require('path');var rimraf=require(_0x1ac3('0x7'));var config=require(_0x1ac3('0x8'));var attributes=require('./whatsappApplication.attributes');module['exports']=function(_0xbe22b7,_0x20027f){return _0xbe22b7[_0x1ac3('0x9')](_0x1ac3('0xa'),attributes,{'tableName':_0x1ac3('0xb'),'paranoid':![],'indexes':[],'timestamps':!![],'charset':'utf8mb4','collate':_0x1ac3('0xc')});}; \ No newline at end of file diff --git a/server/api/whatsappApplication/whatsappApplication.rpc.js b/server/api/whatsappApplication/whatsappApplication.rpc.js index 417d5a6..c9f8027 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 _0xed1f=['request','then','info','WhatsappApplication,\x20%s,\x20%s','debug','request\x20sent','stringify','code','error','message','lodash','util','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','client','http'];(function(_0x2b52b2,_0x56cae5){var _0x4a72b1=function(_0x1d6fca){while(--_0x1d6fca){_0x2b52b2['push'](_0x2b52b2['shift']());}};_0x4a72b1(++_0x56cae5);}(_0xed1f,0x6a));var _0xfed1=function(_0x3740fe,_0x6c543c){_0x3740fe=_0x3740fe-0x0;var _0x55492b=_0xed1f[_0x3740fe];return _0x55492b;};'use strict';var _=require(_0xfed1('0x0'));var util=require(_0xfed1('0x1'));var moment=require(_0xfed1('0x2'));var BPromise=require(_0xfed1('0x3'));var rs=require(_0xfed1('0x4'));var fs=require('fs');var Redis=require(_0xfed1('0x5'));var db=require(_0xfed1('0x6'))['db'];var utils=require(_0xfed1('0x7'));var logger=require(_0xfed1('0x8'))(_0xfed1('0x9'));var config=require(_0xfed1('0xa'));var jayson=require(_0xfed1('0xb'));var client=jayson[_0xfed1('0xc')][_0xfed1('0xd')]({'port':0x232a});function respondWithRpcPromise(_0x380e18,_0x612b38,_0x2a6082){return new BPromise(function(_0x2967ef,_0x568d48){return client[_0xfed1('0xe')](_0x380e18,_0x2a6082)[_0xfed1('0xf')](function(_0x48862d){logger[_0xfed1('0x10')](_0xfed1('0x11'),_0x612b38,'request\x20sent');logger[_0xfed1('0x12')]('WhatsappApplication,\x20%s,\x20%s,\x20%s',_0x612b38,_0xfed1('0x13'),JSON[_0xfed1('0x14')](_0x48862d));if(_0x48862d['error']){if(_0x48862d['error'][_0xfed1('0x15')]===0x1f4){logger[_0xfed1('0x16')]('WhatsappApplication,\x20%s,\x20%s',_0x612b38,_0x48862d[_0xfed1('0x16')]['message']);return _0x568d48(_0x48862d['error'][_0xfed1('0x17')]);}logger[_0xfed1('0x16')]('WhatsappApplication,\x20%s,\x20%s',_0x612b38,_0x48862d[_0xfed1('0x16')]['message']);return _0x2967ef(_0x48862d['error'][_0xfed1('0x17')]);}else{logger[_0xfed1('0x10')](_0xfed1('0x11'),_0x612b38,_0xfed1('0x13'));_0x2967ef(_0x48862d['result'][_0xfed1('0x17')]);}})['catch'](function(_0x36ff34){logger[_0xfed1('0x16')]('WhatsappApplication,\x20%s,\x20%s',_0x612b38,_0x36ff34);_0x568d48(_0x36ff34);});});} \ No newline at end of file +var _0x6aa7=['result','catch','lodash','moment','bluebird','randomstring','ioredis','../../config/utils','../../config/logger','rpc','client','request','then','info','WhatsappApplication,\x20%s,\x20%s','request\x20sent','debug','WhatsappApplication,\x20%s,\x20%s,\x20%s','stringify','error','code','message'];(function(_0x175479,_0x461b1f){var _0x4d8163=function(_0x1bcd45){while(--_0x1bcd45){_0x175479['push'](_0x175479['shift']());}};_0x4d8163(++_0x461b1f);}(_0x6aa7,0x178));var _0x76aa=function(_0x2ea3b4,_0x559d62){_0x2ea3b4=_0x2ea3b4-0x0;var _0x2228d2=_0x6aa7[_0x2ea3b4];return _0x2228d2;};'use strict';var _=require(_0x76aa('0x0'));var util=require('util');var moment=require(_0x76aa('0x1'));var BPromise=require(_0x76aa('0x2'));var rs=require(_0x76aa('0x3'));var fs=require('fs');var Redis=require(_0x76aa('0x4'));var db=require('../../mysqldb')['db'];var utils=require(_0x76aa('0x5'));var logger=require(_0x76aa('0x6'))(_0x76aa('0x7'));var config=require('../../config/environment');var jayson=require('jayson/promise');var client=jayson[_0x76aa('0x8')]['http']({'port':0x232a});function respondWithRpcPromise(_0x32dee5,_0x36d12b,_0xa9b695){return new BPromise(function(_0x56d6bc,_0x3dae33){return client[_0x76aa('0x9')](_0x32dee5,_0xa9b695)[_0x76aa('0xa')](function(_0x557d69){logger[_0x76aa('0xb')](_0x76aa('0xc'),_0x36d12b,_0x76aa('0xd'));logger[_0x76aa('0xe')](_0x76aa('0xf'),_0x36d12b,_0x76aa('0xd'),JSON[_0x76aa('0x10')](_0x557d69));if(_0x557d69[_0x76aa('0x11')]){if(_0x557d69[_0x76aa('0x11')][_0x76aa('0x12')]===0x1f4){logger['error'](_0x76aa('0xc'),_0x36d12b,_0x557d69['error'][_0x76aa('0x13')]);return _0x3dae33(_0x557d69[_0x76aa('0x11')][_0x76aa('0x13')]);}logger[_0x76aa('0x11')](_0x76aa('0xc'),_0x36d12b,_0x557d69['error']['message']);return _0x56d6bc(_0x557d69[_0x76aa('0x11')]['message']);}else{logger[_0x76aa('0xb')](_0x76aa('0xc'),_0x36d12b,'request\x20sent');_0x56d6bc(_0x557d69[_0x76aa('0x14')]['message']);}})[_0x76aa('0x15')](function(_0x5181d2){logger[_0x76aa('0x11')](_0x76aa('0xc'),_0x36d12b,_0x5181d2);_0x3dae33(_0x5181d2);});});} \ No newline at end of file diff --git a/server/api/whatsappInteraction/index.js b/server/api/whatsappInteraction/index.js index 5d73c01..c2b8542 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 _0xd101=['getMessages','/:id/download','download','post','create','addMessage','/:id/tags','tracked','whatsappinteraction:addtags','addTags','put','whatsapp','whatsappinteraction:update','update','delete','whatsappinteraction:destroy','destroy','exports','multer','path','connect-timeout','express','Router','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','get','isAuthenticated','index','/describe','describe','/:id','show','/:id/messages'];(function(_0x3f5d0f,_0x24cdc1){var _0xa9c6e4=function(_0x8f32c1){while(--_0x8f32c1){_0x3f5d0f['push'](_0x3f5d0f['shift']());}};_0xa9c6e4(++_0x24cdc1);}(_0xd101,0xc1));var _0x1d10=function(_0xc14c21,_0x2a7b8e){_0xc14c21=_0xc14c21-0x0;var _0xbf837e=_0xd101[_0xc14c21];return _0xbf837e;};'use strict';var multer=require(_0x1d10('0x0'));var util=require('util');var path=require(_0x1d10('0x1'));var timeout=require(_0x1d10('0x2'));var express=require(_0x1d10('0x3'));var router=express[_0x1d10('0x4')]();var fs_extra=require(_0x1d10('0x5'));var auth=require(_0x1d10('0x6'));var interaction=require(_0x1d10('0x7'));var config=require(_0x1d10('0x8'));var controller=require('./whatsappInteraction.controller');router[_0x1d10('0x9')]('/',auth[_0x1d10('0xa')](),controller[_0x1d10('0xb')]);router[_0x1d10('0x9')](_0x1d10('0xc'),auth[_0x1d10('0xa')](),controller[_0x1d10('0xd')]);router[_0x1d10('0x9')](_0x1d10('0xe'),auth[_0x1d10('0xa')](),controller[_0x1d10('0xf')]);router[_0x1d10('0x9')](_0x1d10('0x10'),auth[_0x1d10('0xa')](),controller[_0x1d10('0x11')]);router[_0x1d10('0x9')](_0x1d10('0x12'),auth['isAuthenticated'](),controller[_0x1d10('0x13')]);router[_0x1d10('0x14')]('/',auth[_0x1d10('0xa')](),controller[_0x1d10('0x15')]);router[_0x1d10('0x14')]('/:id/messages',auth[_0x1d10('0xa')](),controller[_0x1d10('0x16')]);router[_0x1d10('0x14')](_0x1d10('0x17'),auth[_0x1d10('0xa')](),interaction[_0x1d10('0x18')]('whatsapp',_0x1d10('0x19')),controller[_0x1d10('0x1a')]);router[_0x1d10('0x1b')](_0x1d10('0xe'),auth['isAuthenticated'](),interaction[_0x1d10('0x18')](_0x1d10('0x1c'),_0x1d10('0x1d')),controller[_0x1d10('0x1e')]);router[_0x1d10('0x1f')](_0x1d10('0xe'),auth[_0x1d10('0xa')](),interaction['tracked'](_0x1d10('0x1c'),_0x1d10('0x20')),controller[_0x1d10('0x21')]);router[_0x1d10('0x1f')](_0x1d10('0x17'),auth['isAuthenticated'](),controller['removeTags']);module[_0x1d10('0x22')]=router; \ No newline at end of file +var _0x5d17=['whatsapp','whatsappinteraction:update','update','delete','whatsappinteraction:destroy','exports','multer','util','express','Router','fs-extra','../../components/interaction/service','../../config/environment','./whatsappInteraction.controller','get','index','/describe','isAuthenticated','describe','/:id','getMessages','download','post','create','addMessage','/:id/tags','whatsappinteraction:addtags','addTags','put','tracked'];(function(_0x1ad41d,_0x1e8af9){var _0x2899f7=function(_0x3f514f){while(--_0x3f514f){_0x1ad41d['push'](_0x1ad41d['shift']());}};_0x2899f7(++_0x1e8af9);}(_0x5d17,0x114));var _0x75d1=function(_0x3a2295,_0x3064c9){_0x3a2295=_0x3a2295-0x0;var _0x569710=_0x5d17[_0x3a2295];return _0x569710;};'use strict';var multer=require(_0x75d1('0x0'));var util=require(_0x75d1('0x1'));var path=require('path');var timeout=require('connect-timeout');var express=require(_0x75d1('0x2'));var router=express[_0x75d1('0x3')]();var fs_extra=require(_0x75d1('0x4'));var auth=require('../../components/auth/service');var interaction=require(_0x75d1('0x5'));var config=require(_0x75d1('0x6'));var controller=require(_0x75d1('0x7'));router[_0x75d1('0x8')]('/',auth['isAuthenticated'](),controller[_0x75d1('0x9')]);router[_0x75d1('0x8')](_0x75d1('0xa'),auth[_0x75d1('0xb')](),controller[_0x75d1('0xc')]);router[_0x75d1('0x8')](_0x75d1('0xd'),auth['isAuthenticated'](),controller['show']);router[_0x75d1('0x8')]('/:id/messages',auth['isAuthenticated'](),controller[_0x75d1('0xe')]);router[_0x75d1('0x8')]('/:id/download',auth[_0x75d1('0xb')](),controller[_0x75d1('0xf')]);router[_0x75d1('0x10')]('/',auth[_0x75d1('0xb')](),controller[_0x75d1('0x11')]);router[_0x75d1('0x10')]('/:id/messages',auth[_0x75d1('0xb')](),controller[_0x75d1('0x12')]);router[_0x75d1('0x10')](_0x75d1('0x13'),auth['isAuthenticated'](),interaction['tracked']('whatsapp',_0x75d1('0x14')),controller[_0x75d1('0x15')]);router[_0x75d1('0x16')]('/:id',auth[_0x75d1('0xb')](),interaction[_0x75d1('0x17')](_0x75d1('0x18'),_0x75d1('0x19')),controller[_0x75d1('0x1a')]);router[_0x75d1('0x1b')](_0x75d1('0xd'),auth[_0x75d1('0xb')](),interaction[_0x75d1('0x17')](_0x75d1('0x18'),_0x75d1('0x1c')),controller['destroy']);router['delete'](_0x75d1('0x13'),auth[_0x75d1('0xb')](),controller['removeTags']);module[_0x75d1('0x1d')]=router; \ No newline at end of file diff --git a/server/api/whatsappInteraction/whatsappInteraction.attributes.js b/server/api/whatsappInteraction/whatsappInteraction.attributes.js index 71a9394..659f584 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 _0x7d25=['BOOLEAN','DATE','STRING','out','ENUM','moment','exports'];(function(_0x28e8c9,_0x4d236a){var _0x437ac9=function(_0x1e5244){while(--_0x1e5244){_0x28e8c9['push'](_0x28e8c9['shift']());}};_0x437ac9(++_0x4d236a);}(_0x7d25,0x8a));var _0x57d2=function(_0x27af45,_0x1b57aa){_0x27af45=_0x27af45-0x0;var _0x18df21=_0x7d25[_0x27af45];return _0x18df21;};'use strict';var Sequelize=require('sequelize');var moment=require(_0x57d2('0x0'));module[_0x57d2('0x1')]={'closed':{'type':Sequelize[_0x57d2('0x2')],'defaultValue':![]},'closedAt':{'type':Sequelize[_0x57d2('0x3')]},'disposition':{'type':Sequelize[_0x57d2('0x4')]},'secondDisposition':{'type':Sequelize[_0x57d2('0x4')]},'thirdDisposition':{'type':Sequelize[_0x57d2('0x4')]},'note':{'type':Sequelize['STRING']},'phone':{'type':Sequelize['STRING']},'read1stAt':{'type':Sequelize['DATE']},'firstMsgDirection':{'type':Sequelize['ENUM']('in',_0x57d2('0x5')),'defaultValue':'in','allowNull':![]},'lastMsgAt':{'type':Sequelize['DATE']},'lastMsgDirection':{'type':Sequelize[_0x57d2('0x6')]('in',_0x57d2('0x5')),'defaultValue':'in','allowNull':![]},'autoreplyExecuted':{'type':Sequelize[_0x57d2('0x2')],'defaultValue':![]},'queueId':{'type':Sequelize['INTEGER']}}; \ No newline at end of file +var _0x7fb3=['out','sequelize','moment','exports','BOOLEAN','STRING','DATE','ENUM'];(function(_0x3ba288,_0x109e03){var _0x4f1796=function(_0x4976bd){while(--_0x4976bd){_0x3ba288['push'](_0x3ba288['shift']());}};_0x4f1796(++_0x109e03);}(_0x7fb3,0xf9));var _0x37fb=function(_0x4c586e,_0x2571ae){_0x4c586e=_0x4c586e-0x0;var _0x40d9a5=_0x7fb3[_0x4c586e];return _0x40d9a5;};'use strict';var Sequelize=require(_0x37fb('0x0'));var moment=require(_0x37fb('0x1'));module[_0x37fb('0x2')]={'closed':{'type':Sequelize[_0x37fb('0x3')],'defaultValue':![]},'closedAt':{'type':Sequelize['DATE']},'disposition':{'type':Sequelize[_0x37fb('0x4')]},'secondDisposition':{'type':Sequelize[_0x37fb('0x4')]},'thirdDisposition':{'type':Sequelize[_0x37fb('0x4')]},'note':{'type':Sequelize[_0x37fb('0x4')]},'phone':{'type':Sequelize['STRING']},'read1stAt':{'type':Sequelize[_0x37fb('0x5')]},'firstMsgDirection':{'type':Sequelize[_0x37fb('0x6')]('in',_0x37fb('0x7')),'defaultValue':'in','allowNull':![]},'lastMsgAt':{'type':Sequelize[_0x37fb('0x5')]},'lastMsgDirection':{'type':Sequelize[_0x37fb('0x6')]('in',_0x37fb('0x7')),'defaultValue':'in','allowNull':![]},'autoreplyExecuted':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'queueId':{'type':Sequelize['INTEGER']}}; \ No newline at end of file diff --git a/server/api/whatsappInteraction/whatsappInteraction.controller.js b/server/api/whatsappInteraction/whatsappInteraction.controller.js index f3be9c1..4f9f44d 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 _0x1a20=['join','root','server','files','tmp','attachments','format','push','User','fullname','CmContact','firstName','lastName','Attachment','Messages','direction','read','WhatsappAccount','Owner','get','mkdirSync','Whatsapp','Account','createdAt','closed','disposition','filter','basename','existsSync','createReadStream','createWriteStream','out','System','Contact','secret','value','renderFile','downloadInteraction.ejs','transcript-','.pdf','createPdfFromHTML','rimraf','moment','bluebird','util','ejs','lodash','ioredis','../../components/parsers/qs','../../components/export/pdf','../../config/logger','api','../../config/environment','../../mysqldb','defaults','socket.io-emitter','redis','register','status','end','json','offset','undefined','limit','count','set','Content-Range','update','then','destroy','sendStatus','error','stack','name','send','index','map','WhatsappInteraction','rawAttributes','type','key','getOptions','whatsapp','query','catch','show','params','keys','filters','intersection','model','attributes','fields','includeAll','merge','find','create','body','describe','addMessage','ids','omit','getMessages','findOne','length','hasOwnProperty','nolimit','order','sort','where','pick','WhatsappInteractionId','$gte','YYYY-MM-DD\x20HH:mm:ss','options','include','WhatsappMessage','findAll','rows','spread','Tag','color','emit','removeTags','download','toString'];(function(_0x6695c4,_0x2b0578){var _0x99b1e9=function(_0x4c4b77){while(--_0x4c4b77){_0x6695c4['push'](_0x6695c4['shift']());}};_0x99b1e9(++_0x2b0578);}(_0x1a20,0xa7));var _0x01a2=function(_0x2dafbe,_0x5d04de){_0x2dafbe=_0x2dafbe-0x0;var _0x58a45a=_0x1a20[_0x2dafbe];return _0x58a45a;};'use strict';var rimraf=require(_0x01a2('0x0'));var zipdir=require('zip-dir');var moment=require(_0x01a2('0x1'));var BPromise=require(_0x01a2('0x2'));var util=require(_0x01a2('0x3'));var path=require('path');var ejs=require(_0x01a2('0x4'));var fs=require('fs');var _=require(_0x01a2('0x5'));var Redis=require(_0x01a2('0x6'));var interaction=require('../../components/interaction/service');var qs=require(_0x01a2('0x7'));var pdf=require(_0x01a2('0x8'));var logger=require(_0x01a2('0x9'))(_0x01a2('0xa'));var config=require(_0x01a2('0xb'));var db=require(_0x01a2('0xc'))['db'];config['redis']=_[_0x01a2('0xd')](config['redis'],{'host':'localhost','port':0x18eb});var socket=require(_0x01a2('0xe'))(new Redis(config[_0x01a2('0xf')]));require('./whatsappInteraction.socket')[_0x01a2('0x10')](socket);function respondWithStatusCode(_0x181f50,_0x2cd2cc){_0x2cd2cc=_0x2cd2cc||0xcc;return function(_0x4462ea){if(_0x4462ea){return _0x181f50['sendStatus'](_0x2cd2cc);}return _0x181f50[_0x01a2('0x11')](_0x2cd2cc)[_0x01a2('0x12')]();};}function respondWithResult(_0x1a7404,_0x337a0c){_0x337a0c=_0x337a0c||0xc8;return function(_0x153244){if(_0x153244){return _0x1a7404['status'](_0x337a0c)[_0x01a2('0x13')](_0x153244);}};}function respondWithFilteredResult(_0x5b8a55,_0x3a4cf6){return function(_0x2e7948){if(_0x2e7948){var _0x2288c7=typeof _0x3a4cf6[_0x01a2('0x14')]===_0x01a2('0x15')&&typeof _0x3a4cf6[_0x01a2('0x16')]===_0x01a2('0x15');var _0xf2ffc9=_0x2e7948[_0x01a2('0x17')];var _0x2a9d63=_0x2288c7?0x0:_0x3a4cf6[_0x01a2('0x14')];var _0x5140f3=_0x2288c7?_0x2e7948[_0x01a2('0x17')]:_0x3a4cf6[_0x01a2('0x14')]+_0x3a4cf6[_0x01a2('0x16')];var _0x9ce177;if(_0x5140f3>=_0xf2ffc9){_0x5140f3=_0xf2ffc9;_0x9ce177=0xc8;}else{_0x9ce177=0xce;}_0x5b8a55['status'](_0x9ce177);return _0x5b8a55[_0x01a2('0x18')](_0x01a2('0x19'),_0x2a9d63+'-'+_0x5140f3+'/'+_0xf2ffc9)[_0x01a2('0x13')](_0x2e7948);}return null;};}function saveUpdates(_0x452f13){return function(_0x214a4f){if(_0x214a4f){return _0x214a4f[_0x01a2('0x1a')](_0x452f13)[_0x01a2('0x1b')](function(_0x3b7cb3){return _0x3b7cb3;});}return null;};}function removeEntity(_0x3f5c84){return function(_0x4b3082){if(_0x4b3082){return _0x4b3082[_0x01a2('0x1c')]()[_0x01a2('0x1b')](function(){_0x3f5c84[_0x01a2('0x11')](0xcc)[_0x01a2('0x12')]();});}};}function handleEntityNotFound(_0x364cff){return function(_0x48207b){if(!_0x48207b){_0x364cff[_0x01a2('0x1d')](0x194);}return _0x48207b;};}function handleError(_0x2d0369,_0x3d140a){_0x3d140a=_0x3d140a||0x1f4;return function(_0xe4b5a){logger[_0x01a2('0x1e')](_0xe4b5a[_0x01a2('0x1f')]);if(_0xe4b5a[_0x01a2('0x20')]){delete _0xe4b5a[_0x01a2('0x20')];}_0x2d0369[_0x01a2('0x11')](_0x3d140a)[_0x01a2('0x21')](_0xe4b5a);};}exports[_0x01a2('0x22')]=function(_0xe54061,_0x1a6b22){var _0x51b2ab={};var _0x36c8f2=_[_0x01a2('0x23')](db[_0x01a2('0x24')][_0x01a2('0x25')],function(_0x285290){return{'name':_0x285290['fieldName'],'type':_0x285290[_0x01a2('0x26')][_0x01a2('0x27')]};});_0x51b2ab=qs[_0x01a2('0x28')](_0x36c8f2,_0xe54061);return interaction['findAll'](_0x01a2('0x29'),_0xe54061[_0x01a2('0x2a')],_0xe54061['user'],_0x51b2ab,_0x36c8f2)[_0x01a2('0x1b')](respondWithFilteredResult(_0x1a6b22,_0x51b2ab))[_0x01a2('0x2b')](handleError(_0x1a6b22,null));};exports[_0x01a2('0x2c')]=function(_0x5d9bda,_0x31bb7f){var _0x3134b9={'raw':![],'where':{'id':_0x5d9bda[_0x01a2('0x2d')]['id']}},_0x637329={};_0x637329['model']=_[_0x01a2('0x2e')](db[_0x01a2('0x24')][_0x01a2('0x25')]);_0x637329[_0x01a2('0x2a')]=_[_0x01a2('0x2e')](_0x5d9bda['query']);_0x637329[_0x01a2('0x2f')]=_[_0x01a2('0x30')](_0x637329[_0x01a2('0x31')],_0x637329[_0x01a2('0x2a')]);_0x3134b9[_0x01a2('0x32')]=_['intersection'](_0x637329[_0x01a2('0x31')],qs[_0x01a2('0x33')](_0x5d9bda[_0x01a2('0x2a')]['fields']));_0x3134b9[_0x01a2('0x32')]=_0x3134b9[_0x01a2('0x32')]['length']?_0x3134b9['attributes']:_0x637329[_0x01a2('0x31')];if(_0x5d9bda[_0x01a2('0x2a')][_0x01a2('0x34')]){_0x3134b9['include']=[{'all':!![]}];}_0x3134b9=_[_0x01a2('0x35')]({},_0x3134b9,_0x5d9bda['options']);return db['WhatsappInteraction'][_0x01a2('0x36')](_0x3134b9)['then'](handleEntityNotFound(_0x31bb7f,null))[_0x01a2('0x1b')](respondWithResult(_0x31bb7f,null))[_0x01a2('0x2b')](handleError(_0x31bb7f,null));};exports['create']=function(_0x55146d,_0x347e36){return db['WhatsappInteraction'][_0x01a2('0x37')](_0x55146d[_0x01a2('0x38')],{})[_0x01a2('0x1b')](respondWithResult(_0x347e36,0xc9))[_0x01a2('0x2b')](handleError(_0x347e36,null));};exports[_0x01a2('0x1a')]=function(_0x1c5de5,_0x4299ad){if(_0x1c5de5[_0x01a2('0x38')]['id']){delete _0x1c5de5[_0x01a2('0x38')]['id'];}return db[_0x01a2('0x24')][_0x01a2('0x36')]({'where':{'id':_0x1c5de5['params']['id']}})[_0x01a2('0x1b')](handleEntityNotFound(_0x4299ad,null))[_0x01a2('0x1b')](saveUpdates(_0x1c5de5[_0x01a2('0x38')],null))[_0x01a2('0x1b')](respondWithResult(_0x4299ad,null))[_0x01a2('0x2b')](handleError(_0x4299ad,null));};exports[_0x01a2('0x1c')]=function(_0x187942,_0xaf8833){return db[_0x01a2('0x24')][_0x01a2('0x36')]({'where':{'id':_0x187942[_0x01a2('0x2d')]['id']}})['then'](handleEntityNotFound(_0xaf8833,null))[_0x01a2('0x1b')](removeEntity(_0xaf8833,null))['catch'](handleError(_0xaf8833,null));};exports['describe']=function(_0xdafba9,_0x958f11){return db[_0x01a2('0x24')][_0x01a2('0x39')]()[_0x01a2('0x1b')](respondWithResult(_0x958f11,null))[_0x01a2('0x2b')](handleError(_0x958f11,null));};exports[_0x01a2('0x3a')]=function(_0x100840,_0x52ed7b){return db['WhatsappMessage'][_0x01a2('0x36')]({'where':{'id':_0x100840[_0x01a2('0x2d')]['id']}})['then'](handleEntityNotFound(_0x52ed7b,null))[_0x01a2('0x1b')](function(_0x57301d){if(_0x57301d){return _0x57301d[_0x01a2('0x3a')](_0x100840[_0x01a2('0x38')][_0x01a2('0x3b')],_[_0x01a2('0x3c')](_0x100840['body'],[_0x01a2('0x3b'),'id'])||{});}})['then'](respondWithResult(_0x52ed7b,null))['catch'](handleError(_0x52ed7b,null));};exports[_0x01a2('0x3d')]=function(_0x532599,_0x1436d0){var _0x9ebc2a={'raw':![],'where':{}};var _0x3fde0a={};var _0x3fcec6={'count':0x0,'rows':[]};return db[_0x01a2('0x24')][_0x01a2('0x3e')]({'where':{'id':_0x532599['params']['id']}})['then'](handleEntityNotFound(_0x1436d0,null))['then'](function(_0x538bef){if(_0x538bef){_0x3fde0a[_0x01a2('0x31')]=_[_0x01a2('0x2e')](db['WhatsappMessage'][_0x01a2('0x25')]);_0x3fde0a[_0x01a2('0x2a')]=_[_0x01a2('0x2e')](_0x532599[_0x01a2('0x2a')]);_0x3fde0a[_0x01a2('0x2f')]=_[_0x01a2('0x30')](_0x3fde0a[_0x01a2('0x31')],_0x3fde0a[_0x01a2('0x2a')]);_0x9ebc2a[_0x01a2('0x32')]=_[_0x01a2('0x30')](_0x3fde0a[_0x01a2('0x31')],qs[_0x01a2('0x33')](_0x532599[_0x01a2('0x2a')][_0x01a2('0x33')]));_0x9ebc2a[_0x01a2('0x32')]=_0x9ebc2a[_0x01a2('0x32')][_0x01a2('0x3f')]?_0x9ebc2a[_0x01a2('0x32')]:_0x3fde0a[_0x01a2('0x31')];if(!_0x532599[_0x01a2('0x2a')][_0x01a2('0x40')](_0x01a2('0x41'))){_0x9ebc2a[_0x01a2('0x16')]=qs[_0x01a2('0x16')](_0x532599[_0x01a2('0x2a')]['limit']);_0x9ebc2a[_0x01a2('0x14')]=qs['offset'](_0x532599[_0x01a2('0x2a')][_0x01a2('0x14')]);}_0x9ebc2a[_0x01a2('0x42')]=qs[_0x01a2('0x43')](_0x532599[_0x01a2('0x2a')][_0x01a2('0x43')]);_0x9ebc2a[_0x01a2('0x44')]=qs[_0x01a2('0x2f')](_[_0x01a2('0x45')](_0x532599['query'],_0x3fde0a['filters']));_0x9ebc2a[_0x01a2('0x44')][_0x01a2('0x46')]=_0x538bef['id'];if(_0x532599[_0x01a2('0x2a')]['filter']){_0x9ebc2a[_0x01a2('0x44')]=_[_0x01a2('0x35')](_0x9ebc2a[_0x01a2('0x44')],{'$or':_[_0x01a2('0x23')](_0x9ebc2a[_0x01a2('0x32')],function(_0x447b3c){var _0x3a3500={};_0x3a3500[_0x447b3c]={'$like':'%'+_0x532599[_0x01a2('0x2a')]['filter']+'%'};return _0x3a3500;})});}if(_0x532599['query']['$gte']){var _0x57bf5b=_0x532599[_0x01a2('0x2a')][_0x01a2('0x47')]['split'](',');var _0xdb4d7d={};_0xdb4d7d[_0x57bf5b[0x0]]={'$gte':moment(_0x57bf5b[0x1])['format'](_0x01a2('0x48'))};_0x9ebc2a[_0x01a2('0x44')]=_[_0x01a2('0x35')](_0x9ebc2a['where'],_0xdb4d7d);}_0x9ebc2a=_[_0x01a2('0x35')]({},_0x9ebc2a,_0x532599[_0x01a2('0x49')]);return db['WhatsappMessage'][_0x01a2('0x17')]({'where':_0x9ebc2a[_0x01a2('0x44')]})['then'](function(_0x23e2c3){_0x3fcec6['count']=_0x23e2c3;if(_0x532599['query'][_0x01a2('0x34')]){_0x9ebc2a[_0x01a2('0x4a')]=[{'all':!![]}];}return db[_0x01a2('0x4b')][_0x01a2('0x4c')](_0x9ebc2a);})[_0x01a2('0x1b')](function(_0x4c2645){_0x3fcec6[_0x01a2('0x4d')]=_0x4c2645;return _0x3fcec6;});}})['then'](respondWithFilteredResult(_0x1436d0,_0x9ebc2a))[_0x01a2('0x2b')](handleError(_0x1436d0,null));};exports['addTags']=function(_0x571894,_0x3bbef0){return db[_0x01a2('0x24')][_0x01a2('0x36')]({'where':{'id':_0x571894[_0x01a2('0x2d')]['id']}})[_0x01a2('0x1b')](handleEntityNotFound(_0x3bbef0,null))['then'](function(_0x19832b){if(_0x19832b){return _0x19832b['setTags'](_0x571894[_0x01a2('0x38')][_0x01a2('0x3b')],_[_0x01a2('0x3c')](_0x571894[_0x01a2('0x38')],[_0x01a2('0x3b'),'id'])||{})[_0x01a2('0x4e')](function(){return db[_0x01a2('0x4f')][_0x01a2('0x4c')]({'attributes':['id',_0x01a2('0x20'),_0x01a2('0x50')],'where':{'id':_0x571894[_0x01a2('0x38')]['ids']}});})['then'](function(_0x447e5b){socket[_0x01a2('0x51')]('whatsappInteractionTags:save',{'id':Number(_0x571894[_0x01a2('0x2d')]['id']),'tags':_0x447e5b||[]});return{'id':Number(_0x571894[_0x01a2('0x2d')]['id']),'tags':_0x447e5b||[]};});}})[_0x01a2('0x1b')](respondWithResult(_0x3bbef0,null))['catch'](handleError(_0x3bbef0,null));};exports[_0x01a2('0x52')]=function(_0x440636,_0x16b78d){return db[_0x01a2('0x24')]['find']({'where':{'id':_0x440636[_0x01a2('0x2d')]['id']}})['then'](handleEntityNotFound(_0x16b78d,null))[_0x01a2('0x1b')](function(_0x313f16){if(_0x313f16){return _0x313f16[_0x01a2('0x52')](_0x440636[_0x01a2('0x2a')][_0x01a2('0x3b')]);}})[_0x01a2('0x1b')](respondWithStatusCode(_0x16b78d,null))[_0x01a2('0x2b')](handleError(_0x16b78d,null));};exports[_0x01a2('0x53')]=function(_0x4af412,_0x2ab92a){var _0x280202=moment()['unix']()[_0x01a2('0x54')]();var _0x3c8e49=path[_0x01a2('0x55')](config[_0x01a2('0x56')],_0x01a2('0x57'),_0x01a2('0x58'),_0x01a2('0x59'));var _0x580f45=path[_0x01a2('0x55')](config['root'],'server',_0x01a2('0x58'),_0x01a2('0x5a'));var _0x54af18=path[_0x01a2('0x55')](_0x3c8e49,_0x280202);var _0x187eab=util[_0x01a2('0x5b')]('transcript-%d-%s.zip',_0x4af412[_0x01a2('0x2d')]['id'],_0x280202);var _0x4fdefb=path[_0x01a2('0x55')](_0x3c8e49,_0x187eab);var _0xfd736c=[];_0xfd736c[_0x01a2('0x5c')]({'model':db[_0x01a2('0x5d')],'as':_0x01a2('0x5d'),'attributes':['id',_0x01a2('0x5e')],'raw':!![]});_0xfd736c['push']({'model':db[_0x01a2('0x5f')],'as':'Contact','attributes':['id',_0x01a2('0x60'),_0x01a2('0x61')],'raw':!![]});if(_0x4af412[_0x01a2('0x2a')][_0x01a2('0x5a')]){_0xfd736c[_0x01a2('0x5c')]({'model':db[_0x01a2('0x62')],'as':_0x01a2('0x62'),'raw':!![]});}var _0x4163ee=[{'model':db['WhatsappMessage'],'as':_0x01a2('0x63'),'attributes':['id',_0x01a2('0x38'),'createdAt',_0x01a2('0x64'),'secret',_0x01a2('0x65')],'include':_0xfd736c}];_0x4163ee[_0x01a2('0x5c')]({'model':db[_0x01a2('0x66')],'as':'Account','attributes':['id',_0x01a2('0x20')]});_0x4163ee[_0x01a2('0x5c')]({'model':db[_0x01a2('0x5d')],'as':_0x01a2('0x67'),'attributes':['id','fullname']});return db[_0x01a2('0x24')][_0x01a2('0x36')]({'where':{'id':_0x4af412[_0x01a2('0x2d')]['id']},'include':_0x4163ee})[_0x01a2('0x1b')](handleEntityNotFound(_0x2ab92a,null))[_0x01a2('0x1b')](function(_0x2a7b2f){if(_0x2a7b2f){var _0x3e9177=_0x2a7b2f[_0x01a2('0x68')]({'plain':!![]});fs[_0x01a2('0x69')](_0x54af18);var _0x8a73a7={'channel':_0x01a2('0x6a'),'account':_0x3e9177[_0x01a2('0x6b')][_0x01a2('0x20')],'agent':_0x3e9177[_0x01a2('0x67')]?_0x3e9177[_0x01a2('0x67')][_0x01a2('0x5e')]:'N.A.','createdAt':moment(_0x3e9177[_0x01a2('0x6c')])[_0x01a2('0x5b')](_0x01a2('0x48'))[_0x01a2('0x54')](),'closedAt':_0x3e9177[_0x01a2('0x6d')]?moment(_0x3e9177['closedAt'])['format'](_0x01a2('0x48'))['toString']():'','disposition':_0x3e9177[_0x01a2('0x6e')],'messages':_(_0x3e9177['Messages'])[_0x01a2('0x6f')]({'secret':![]})[_0x01a2('0x23')](function(_0x14043f){if(_0x14043f[_0x01a2('0x62')]){var _0x209856=path[_0x01a2('0x55')](_0x580f45,_0x14043f['Attachment'][_0x01a2('0x70')]);if(fs[_0x01a2('0x71')](_0x209856)){fs[_0x01a2('0x72')](_0x209856)['pipe'](fs[_0x01a2('0x73')](path[_0x01a2('0x55')](_0x54af18,_0x14043f[_0x01a2('0x62')][_0x01a2('0x70')])));}}return{'date':moment(_0x14043f['createdAt'])[_0x01a2('0x5b')]('YYYY-MM-DD\x20HH:mm:ss')[_0x01a2('0x54')](),'sender':_0x14043f[_0x01a2('0x64')]===_0x01a2('0x74')?_0x14043f[_0x01a2('0x5d')]?_0x14043f[_0x01a2('0x5d')][_0x01a2('0x5e')]:_0x01a2('0x75'):_0x14043f['Contact'][_0x01a2('0x60')]+(_0x14043f[_0x01a2('0x76')][_0x01a2('0x61')]?'\x20'+_0x14043f[_0x01a2('0x76')][_0x01a2('0x61')]:''),'body':_0x14043f[_0x01a2('0x62')]?_0x14043f['Attachment'][_0x01a2('0x70')]:_0x14043f[_0x01a2('0x38')],'direction':_0x14043f[_0x01a2('0x64')]===_0x01a2('0x74')?'A':'C','secret':_0x14043f[_0x01a2('0x77')],'read':_0x14043f[_0x01a2('0x65')],'attachment':_0x14043f['Attachment']};})[_0x01a2('0x78')]()};return ejs[_0x01a2('0x79')](path[_0x01a2('0x55')](config['root'],'server','views',_0x01a2('0x7a')),{'interaction':_0x8a73a7})[_0x01a2('0x1b')](function(_0x41f763){var _0x2cd15e=path['join'](_0x54af18,_0x01a2('0x7b')+_0x3e9177['id']+'-'+_0x280202+_0x01a2('0x7c'));var _0x3358ff={'path':_0x2cd15e,'channel':_0x01a2('0x6a'),'interactionId':_0x3e9177['id']};return pdf[_0x01a2('0x7d')](_0x41f763,_0x3358ff);})[_0x01a2('0x1b')](function(){return new BPromise(function(_0xae5994,_0x1d0138){zipdir(_0x54af18,{'saveTo':_0x4fdefb},function(_0x35628e,_0x13229c){if(_0x35628e)return _0x1d0138(_0x35628e);return _0xae5994(_0x13229c);});})[_0x01a2('0x1b')](function(){return new BPromise(function(_0x365a9a,_0x23d751){rimraf(_0x54af18,function(_0x4d0cfd){if(_0x4d0cfd)_0x23d751(_0x4d0cfd);return _0x365a9a();});});})[_0x01a2('0x1b')](function(){return _0x2ab92a[_0x01a2('0x53')](_0x4fdefb,_0x187eab,function(_0x44b27b){if(_0x44b27b){console['log']('err',_0x44b27b);}else{fs['unlinkSync'](_0x4fdefb);}});});});}else{return _0x2ab92a[_0x01a2('0x1d')](0xc8);}})[_0x01a2('0x2b')](handleError(_0x2ab92a,null));}; \ No newline at end of file +var _0xfa8d=['error','name','send','index','WhatsappInteraction','fieldName','type','key','getOptions','findAll','user','catch','params','keys','rawAttributes','query','filters','intersection','model','attributes','fields','length','includeAll','merge','options','find','create','update','body','describe','addMessage','WhatsappMessage','omit','ids','getMessages','nolimit','order','sort','pick','where','WhatsappInteractionId','filter','map','$gte','split','format','YYYY-MM-DD\x20HH:mm:ss','include','setTags','Tag','emit','whatsappInteractionTags:save','removeTags','unix','root','server','files','tmp','join','transcript-%d-%s.zip','User','fullname','push','CmContact','firstName','lastName','attachments','Attachment','createdAt','direction','secret','read','Account','get','mkdirSync','Whatsapp','Owner','N.A.','closed','toString','disposition','Messages','existsSync','createReadStream','pipe','createWriteStream','basename','out','System','Contact','renderFile','views','transcript-','createPdfFromHTML','log','err','unlinkSync','zip-dir','bluebird','util','path','ejs','ioredis','../../components/interaction/service','../../components/export/pdf','../../config/logger','api','../../mysqldb','redis','localhost','socket.io-emitter','./whatsappInteraction.socket','sendStatus','status','end','json','offset','limit','undefined','count','set','Content-Range','then','destroy'];(function(_0x1fb37e,_0x49de19){var _0x15177d=function(_0xb07731){while(--_0xb07731){_0x1fb37e['push'](_0x1fb37e['shift']());}};_0x15177d(++_0x49de19);}(_0xfa8d,0x159));var _0xdfa8=function(_0x4da32e,_0xecd637){_0x4da32e=_0x4da32e-0x0;var _0x4c39d7=_0xfa8d[_0x4da32e];return _0x4c39d7;};'use strict';var rimraf=require('rimraf');var zipdir=require(_0xdfa8('0x0'));var moment=require('moment');var BPromise=require(_0xdfa8('0x1'));var util=require(_0xdfa8('0x2'));var path=require(_0xdfa8('0x3'));var ejs=require(_0xdfa8('0x4'));var fs=require('fs');var _=require('lodash');var Redis=require(_0xdfa8('0x5'));var interaction=require(_0xdfa8('0x6'));var qs=require('../../components/parsers/qs');var pdf=require(_0xdfa8('0x7'));var logger=require(_0xdfa8('0x8'))(_0xdfa8('0x9'));var config=require('../../config/environment');var db=require(_0xdfa8('0xa'))['db'];config[_0xdfa8('0xb')]=_['defaults'](config[_0xdfa8('0xb')],{'host':_0xdfa8('0xc'),'port':0x18eb});var socket=require(_0xdfa8('0xd'))(new Redis(config[_0xdfa8('0xb')]));require(_0xdfa8('0xe'))['register'](socket);function respondWithStatusCode(_0x21f418,_0x59b793){_0x59b793=_0x59b793||0xcc;return function(_0x52ebff){if(_0x52ebff){return _0x21f418[_0xdfa8('0xf')](_0x59b793);}return _0x21f418[_0xdfa8('0x10')](_0x59b793)[_0xdfa8('0x11')]();};}function respondWithResult(_0x3adea4,_0x2487df){_0x2487df=_0x2487df||0xc8;return function(_0x45e8f3){if(_0x45e8f3){return _0x3adea4[_0xdfa8('0x10')](_0x2487df)[_0xdfa8('0x12')](_0x45e8f3);}};}function respondWithFilteredResult(_0x482e44,_0x178f93){return function(_0x86672d){if(_0x86672d){var _0x45b096=typeof _0x178f93[_0xdfa8('0x13')]==='undefined'&&typeof _0x178f93[_0xdfa8('0x14')]===_0xdfa8('0x15');var _0x2ec9d7=_0x86672d[_0xdfa8('0x16')];var _0x185c92=_0x45b096?0x0:_0x178f93[_0xdfa8('0x13')];var _0x294318=_0x45b096?_0x86672d[_0xdfa8('0x16')]:_0x178f93['offset']+_0x178f93[_0xdfa8('0x14')];var _0x323b9b;if(_0x294318>=_0x2ec9d7){_0x294318=_0x2ec9d7;_0x323b9b=0xc8;}else{_0x323b9b=0xce;}_0x482e44[_0xdfa8('0x10')](_0x323b9b);return _0x482e44[_0xdfa8('0x17')](_0xdfa8('0x18'),_0x185c92+'-'+_0x294318+'/'+_0x2ec9d7)[_0xdfa8('0x12')](_0x86672d);}return null;};}function saveUpdates(_0x2ca46e){return function(_0x499208){if(_0x499208){return _0x499208['update'](_0x2ca46e)[_0xdfa8('0x19')](function(_0x370d7f){return _0x370d7f;});}return null;};}function removeEntity(_0x51668a){return function(_0x27755f){if(_0x27755f){return _0x27755f[_0xdfa8('0x1a')]()[_0xdfa8('0x19')](function(){_0x51668a[_0xdfa8('0x10')](0xcc)[_0xdfa8('0x11')]();});}};}function handleEntityNotFound(_0xe9e359){return function(_0x379629){if(!_0x379629){_0xe9e359[_0xdfa8('0xf')](0x194);}return _0x379629;};}function handleError(_0x4c9178,_0x1b46cd){_0x1b46cd=_0x1b46cd||0x1f4;return function(_0x390cb2){logger[_0xdfa8('0x1b')](_0x390cb2['stack']);if(_0x390cb2[_0xdfa8('0x1c')]){delete _0x390cb2['name'];}_0x4c9178['status'](_0x1b46cd)[_0xdfa8('0x1d')](_0x390cb2);};}exports[_0xdfa8('0x1e')]=function(_0x47e07f,_0x707534){var _0x2f4ba2={};var _0x47c54a=_['map'](db[_0xdfa8('0x1f')]['rawAttributes'],function(_0x33ec40){return{'name':_0x33ec40[_0xdfa8('0x20')],'type':_0x33ec40[_0xdfa8('0x21')][_0xdfa8('0x22')]};});_0x2f4ba2=qs[_0xdfa8('0x23')](_0x47c54a,_0x47e07f);return interaction[_0xdfa8('0x24')]('whatsapp',_0x47e07f['query'],_0x47e07f[_0xdfa8('0x25')],_0x2f4ba2,_0x47c54a)['then'](respondWithFilteredResult(_0x707534,_0x2f4ba2))[_0xdfa8('0x26')](handleError(_0x707534,null));};exports['show']=function(_0x425bee,_0x1a67a4){var _0x281cac={'raw':![],'where':{'id':_0x425bee[_0xdfa8('0x27')]['id']}},_0xab43ec={};_0xab43ec['model']=_[_0xdfa8('0x28')](db['WhatsappInteraction'][_0xdfa8('0x29')]);_0xab43ec[_0xdfa8('0x2a')]=_['keys'](_0x425bee['query']);_0xab43ec[_0xdfa8('0x2b')]=_[_0xdfa8('0x2c')](_0xab43ec[_0xdfa8('0x2d')],_0xab43ec[_0xdfa8('0x2a')]);_0x281cac[_0xdfa8('0x2e')]=_[_0xdfa8('0x2c')](_0xab43ec['model'],qs[_0xdfa8('0x2f')](_0x425bee[_0xdfa8('0x2a')]['fields']));_0x281cac[_0xdfa8('0x2e')]=_0x281cac[_0xdfa8('0x2e')][_0xdfa8('0x30')]?_0x281cac[_0xdfa8('0x2e')]:_0xab43ec[_0xdfa8('0x2d')];if(_0x425bee[_0xdfa8('0x2a')][_0xdfa8('0x31')]){_0x281cac['include']=[{'all':!![]}];}_0x281cac=_[_0xdfa8('0x32')]({},_0x281cac,_0x425bee[_0xdfa8('0x33')]);return db[_0xdfa8('0x1f')][_0xdfa8('0x34')](_0x281cac)[_0xdfa8('0x19')](handleEntityNotFound(_0x1a67a4,null))[_0xdfa8('0x19')](respondWithResult(_0x1a67a4,null))[_0xdfa8('0x26')](handleError(_0x1a67a4,null));};exports['create']=function(_0xdd4c0d,_0x478383){return db[_0xdfa8('0x1f')][_0xdfa8('0x35')](_0xdd4c0d['body'],{})[_0xdfa8('0x19')](respondWithResult(_0x478383,0xc9))[_0xdfa8('0x26')](handleError(_0x478383,null));};exports[_0xdfa8('0x36')]=function(_0x24ed0e,_0x13ad2f){if(_0x24ed0e[_0xdfa8('0x37')]['id']){delete _0x24ed0e[_0xdfa8('0x37')]['id'];}return db[_0xdfa8('0x1f')][_0xdfa8('0x34')]({'where':{'id':_0x24ed0e[_0xdfa8('0x27')]['id']}})['then'](handleEntityNotFound(_0x13ad2f,null))[_0xdfa8('0x19')](saveUpdates(_0x24ed0e[_0xdfa8('0x37')],null))[_0xdfa8('0x19')](respondWithResult(_0x13ad2f,null))[_0xdfa8('0x26')](handleError(_0x13ad2f,null));};exports[_0xdfa8('0x1a')]=function(_0x24c298,_0x126188){return db[_0xdfa8('0x1f')][_0xdfa8('0x34')]({'where':{'id':_0x24c298[_0xdfa8('0x27')]['id']}})[_0xdfa8('0x19')](handleEntityNotFound(_0x126188,null))[_0xdfa8('0x19')](removeEntity(_0x126188,null))['catch'](handleError(_0x126188,null));};exports[_0xdfa8('0x38')]=function(_0x453179,_0xa40fbd){return db[_0xdfa8('0x1f')][_0xdfa8('0x38')]()[_0xdfa8('0x19')](respondWithResult(_0xa40fbd,null))['catch'](handleError(_0xa40fbd,null));};exports[_0xdfa8('0x39')]=function(_0x1dd387,_0x3650c1){return db[_0xdfa8('0x3a')][_0xdfa8('0x34')]({'where':{'id':_0x1dd387[_0xdfa8('0x27')]['id']}})[_0xdfa8('0x19')](handleEntityNotFound(_0x3650c1,null))[_0xdfa8('0x19')](function(_0x91bed5){if(_0x91bed5){return _0x91bed5[_0xdfa8('0x39')](_0x1dd387[_0xdfa8('0x37')]['ids'],_[_0xdfa8('0x3b')](_0x1dd387[_0xdfa8('0x37')],[_0xdfa8('0x3c'),'id'])||{});}})[_0xdfa8('0x19')](respondWithResult(_0x3650c1,null))['catch'](handleError(_0x3650c1,null));};exports[_0xdfa8('0x3d')]=function(_0x40a97a,_0x27ec01){var _0x311289={'raw':![],'where':{}};var _0x54382a={};var _0x55412a={'count':0x0,'rows':[]};return db[_0xdfa8('0x1f')]['findOne']({'where':{'id':_0x40a97a[_0xdfa8('0x27')]['id']}})[_0xdfa8('0x19')](handleEntityNotFound(_0x27ec01,null))[_0xdfa8('0x19')](function(_0x3acb59){if(_0x3acb59){_0x54382a[_0xdfa8('0x2d')]=_[_0xdfa8('0x28')](db[_0xdfa8('0x3a')][_0xdfa8('0x29')]);_0x54382a[_0xdfa8('0x2a')]=_[_0xdfa8('0x28')](_0x40a97a[_0xdfa8('0x2a')]);_0x54382a[_0xdfa8('0x2b')]=_[_0xdfa8('0x2c')](_0x54382a[_0xdfa8('0x2d')],_0x54382a[_0xdfa8('0x2a')]);_0x311289[_0xdfa8('0x2e')]=_[_0xdfa8('0x2c')](_0x54382a[_0xdfa8('0x2d')],qs[_0xdfa8('0x2f')](_0x40a97a[_0xdfa8('0x2a')]['fields']));_0x311289[_0xdfa8('0x2e')]=_0x311289[_0xdfa8('0x2e')][_0xdfa8('0x30')]?_0x311289[_0xdfa8('0x2e')]:_0x54382a['model'];if(!_0x40a97a[_0xdfa8('0x2a')]['hasOwnProperty'](_0xdfa8('0x3e'))){_0x311289[_0xdfa8('0x14')]=qs[_0xdfa8('0x14')](_0x40a97a[_0xdfa8('0x2a')][_0xdfa8('0x14')]);_0x311289[_0xdfa8('0x13')]=qs['offset'](_0x40a97a['query']['offset']);}_0x311289[_0xdfa8('0x3f')]=qs['sort'](_0x40a97a[_0xdfa8('0x2a')][_0xdfa8('0x40')]);_0x311289['where']=qs[_0xdfa8('0x2b')](_[_0xdfa8('0x41')](_0x40a97a[_0xdfa8('0x2a')],_0x54382a['filters']));_0x311289[_0xdfa8('0x42')][_0xdfa8('0x43')]=_0x3acb59['id'];if(_0x40a97a['query'][_0xdfa8('0x44')]){_0x311289[_0xdfa8('0x42')]=_[_0xdfa8('0x32')](_0x311289[_0xdfa8('0x42')],{'$or':_[_0xdfa8('0x45')](_0x311289[_0xdfa8('0x2e')],function(_0x46d0bf){var _0x5ad067={};_0x5ad067[_0x46d0bf]={'$like':'%'+_0x40a97a[_0xdfa8('0x2a')][_0xdfa8('0x44')]+'%'};return _0x5ad067;})});}if(_0x40a97a[_0xdfa8('0x2a')][_0xdfa8('0x46')]){var _0x5c4d8a=_0x40a97a[_0xdfa8('0x2a')][_0xdfa8('0x46')][_0xdfa8('0x47')](',');var _0x2feebe={};_0x2feebe[_0x5c4d8a[0x0]]={'$gte':moment(_0x5c4d8a[0x1])[_0xdfa8('0x48')](_0xdfa8('0x49'))};_0x311289[_0xdfa8('0x42')]=_[_0xdfa8('0x32')](_0x311289[_0xdfa8('0x42')],_0x2feebe);}_0x311289=_[_0xdfa8('0x32')]({},_0x311289,_0x40a97a['options']);return db[_0xdfa8('0x3a')]['count']({'where':_0x311289[_0xdfa8('0x42')]})['then'](function(_0x3d7ffb){_0x55412a[_0xdfa8('0x16')]=_0x3d7ffb;if(_0x40a97a[_0xdfa8('0x2a')][_0xdfa8('0x31')]){_0x311289[_0xdfa8('0x4a')]=[{'all':!![]}];}return db[_0xdfa8('0x3a')][_0xdfa8('0x24')](_0x311289);})[_0xdfa8('0x19')](function(_0x5e67da){_0x55412a['rows']=_0x5e67da;return _0x55412a;});}})[_0xdfa8('0x19')](respondWithFilteredResult(_0x27ec01,_0x311289))[_0xdfa8('0x26')](handleError(_0x27ec01,null));};exports['addTags']=function(_0x2df0d4,_0x5664f6){return db[_0xdfa8('0x1f')][_0xdfa8('0x34')]({'where':{'id':_0x2df0d4[_0xdfa8('0x27')]['id']}})['then'](handleEntityNotFound(_0x5664f6,null))[_0xdfa8('0x19')](function(_0x314511){if(_0x314511){return _0x314511[_0xdfa8('0x4b')](_0x2df0d4[_0xdfa8('0x37')][_0xdfa8('0x3c')],_['omit'](_0x2df0d4['body'],[_0xdfa8('0x3c'),'id'])||{})['spread'](function(){return db[_0xdfa8('0x4c')][_0xdfa8('0x24')]({'attributes':['id','name','color'],'where':{'id':_0x2df0d4['body'][_0xdfa8('0x3c')]}});})['then'](function(_0x6ce69c){socket[_0xdfa8('0x4d')](_0xdfa8('0x4e'),{'id':Number(_0x2df0d4[_0xdfa8('0x27')]['id']),'tags':_0x6ce69c||[]});return{'id':Number(_0x2df0d4[_0xdfa8('0x27')]['id']),'tags':_0x6ce69c||[]};});}})[_0xdfa8('0x19')](respondWithResult(_0x5664f6,null))['catch'](handleError(_0x5664f6,null));};exports['removeTags']=function(_0x43068b,_0x1f48f9){return db[_0xdfa8('0x1f')][_0xdfa8('0x34')]({'where':{'id':_0x43068b[_0xdfa8('0x27')]['id']}})[_0xdfa8('0x19')](handleEntityNotFound(_0x1f48f9,null))[_0xdfa8('0x19')](function(_0x323510){if(_0x323510){return _0x323510[_0xdfa8('0x4f')](_0x43068b[_0xdfa8('0x2a')][_0xdfa8('0x3c')]);}})['then'](respondWithStatusCode(_0x1f48f9,null))['catch'](handleError(_0x1f48f9,null));};exports['download']=function(_0x3f3494,_0x5e37ce){var _0x759a86=moment()[_0xdfa8('0x50')]()['toString']();var _0x4e6600=path['join'](config[_0xdfa8('0x51')],_0xdfa8('0x52'),_0xdfa8('0x53'),_0xdfa8('0x54'));var _0x428e2c=path[_0xdfa8('0x55')](config[_0xdfa8('0x51')],'server',_0xdfa8('0x53'),'attachments');var _0x564554=path[_0xdfa8('0x55')](_0x4e6600,_0x759a86);var _0x55dded=util['format'](_0xdfa8('0x56'),_0x3f3494[_0xdfa8('0x27')]['id'],_0x759a86);var _0xf42ae=path[_0xdfa8('0x55')](_0x4e6600,_0x55dded);var _0x4604d5=[];_0x4604d5['push']({'model':db[_0xdfa8('0x57')],'as':_0xdfa8('0x57'),'attributes':['id',_0xdfa8('0x58')],'raw':!![]});_0x4604d5[_0xdfa8('0x59')]({'model':db[_0xdfa8('0x5a')],'as':'Contact','attributes':['id',_0xdfa8('0x5b'),_0xdfa8('0x5c')],'raw':!![]});if(_0x3f3494[_0xdfa8('0x2a')][_0xdfa8('0x5d')]){_0x4604d5[_0xdfa8('0x59')]({'model':db[_0xdfa8('0x5e')],'as':_0xdfa8('0x5e'),'raw':!![]});}var _0x926662=[{'model':db['WhatsappMessage'],'as':'Messages','attributes':['id',_0xdfa8('0x37'),_0xdfa8('0x5f'),_0xdfa8('0x60'),_0xdfa8('0x61'),_0xdfa8('0x62')],'include':_0x4604d5}];_0x926662[_0xdfa8('0x59')]({'model':db['WhatsappAccount'],'as':_0xdfa8('0x63'),'attributes':['id',_0xdfa8('0x1c')]});_0x926662[_0xdfa8('0x59')]({'model':db[_0xdfa8('0x57')],'as':'Owner','attributes':['id','fullname']});return db[_0xdfa8('0x1f')][_0xdfa8('0x34')]({'where':{'id':_0x3f3494[_0xdfa8('0x27')]['id']},'include':_0x926662})[_0xdfa8('0x19')](handleEntityNotFound(_0x5e37ce,null))['then'](function(_0x429f2d){if(_0x429f2d){var _0x235ff5=_0x429f2d[_0xdfa8('0x64')]({'plain':!![]});fs[_0xdfa8('0x65')](_0x564554);var _0x212349={'channel':_0xdfa8('0x66'),'account':_0x235ff5['Account'][_0xdfa8('0x1c')],'agent':_0x235ff5[_0xdfa8('0x67')]?_0x235ff5[_0xdfa8('0x67')][_0xdfa8('0x58')]:_0xdfa8('0x68'),'createdAt':moment(_0x235ff5[_0xdfa8('0x5f')])[_0xdfa8('0x48')](_0xdfa8('0x49'))['toString'](),'closedAt':_0x235ff5[_0xdfa8('0x69')]?moment(_0x235ff5['closedAt'])['format'](_0xdfa8('0x49'))[_0xdfa8('0x6a')]():'','disposition':_0x235ff5[_0xdfa8('0x6b')],'messages':_(_0x235ff5[_0xdfa8('0x6c')])[_0xdfa8('0x44')]({'secret':![]})[_0xdfa8('0x45')](function(_0x56294a){if(_0x56294a[_0xdfa8('0x5e')]){var _0x382d92=path['join'](_0x428e2c,_0x56294a[_0xdfa8('0x5e')]['basename']);if(fs[_0xdfa8('0x6d')](_0x382d92)){fs[_0xdfa8('0x6e')](_0x382d92)[_0xdfa8('0x6f')](fs[_0xdfa8('0x70')](path['join'](_0x564554,_0x56294a['Attachment'][_0xdfa8('0x71')])));}}return{'date':moment(_0x56294a[_0xdfa8('0x5f')])['format'](_0xdfa8('0x49'))[_0xdfa8('0x6a')](),'sender':_0x56294a['direction']===_0xdfa8('0x72')?_0x56294a[_0xdfa8('0x57')]?_0x56294a[_0xdfa8('0x57')][_0xdfa8('0x58')]:_0xdfa8('0x73'):_0x56294a['Contact'][_0xdfa8('0x5b')]+(_0x56294a[_0xdfa8('0x74')][_0xdfa8('0x5c')]?'\x20'+_0x56294a[_0xdfa8('0x74')][_0xdfa8('0x5c')]:''),'body':_0x56294a[_0xdfa8('0x5e')]?_0x56294a['Attachment']['basename']:_0x56294a[_0xdfa8('0x37')],'direction':_0x56294a[_0xdfa8('0x60')]===_0xdfa8('0x72')?'A':'C','secret':_0x56294a[_0xdfa8('0x61')],'read':_0x56294a[_0xdfa8('0x62')],'attachment':_0x56294a[_0xdfa8('0x5e')]};})['value']()};return ejs[_0xdfa8('0x75')](path[_0xdfa8('0x55')](config['root'],_0xdfa8('0x52'),_0xdfa8('0x76'),'downloadInteraction.ejs'),{'interaction':_0x212349})[_0xdfa8('0x19')](function(_0x303c38){var _0x42e116=path[_0xdfa8('0x55')](_0x564554,_0xdfa8('0x77')+_0x235ff5['id']+'-'+_0x759a86+'.pdf');var _0xe1fbae={'path':_0x42e116,'channel':'Whatsapp','interactionId':_0x235ff5['id']};return pdf[_0xdfa8('0x78')](_0x303c38,_0xe1fbae);})[_0xdfa8('0x19')](function(){return new BPromise(function(_0x1f94a5,_0x207522){zipdir(_0x564554,{'saveTo':_0xf42ae},function(_0x4173af,_0x51fcc5){if(_0x4173af)return _0x207522(_0x4173af);return _0x1f94a5(_0x51fcc5);});})[_0xdfa8('0x19')](function(){return new BPromise(function(_0x418744,_0x52252d){rimraf(_0x564554,function(_0x595147){if(_0x595147)_0x52252d(_0x595147);return _0x418744();});});})['then'](function(){return _0x5e37ce['download'](_0xf42ae,_0x55dded,function(_0x463556){if(_0x463556){console[_0xdfa8('0x79')](_0xdfa8('0x7a'),_0x463556);}else{fs[_0xdfa8('0x7b')](_0xf42ae);}});});});}else{return _0x5e37ce[_0xdfa8('0xf')](0xc8);}})[_0xdfa8('0x26')](handleError(_0x5e37ce,null));}; \ No newline at end of file diff --git a/server/api/whatsappInteraction/whatsappInteraction.events.js b/server/api/whatsappInteraction/whatsappInteraction.events.js index 435d092..6901924 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 _0x6427=['setDataValue','Users','findAll','unreadMessages','length','emit','catch','hasOwnProperty','hook','exports','../../mysqldb','WhatsappInteraction','WhatsappMessage','setMaxListeners','save','remove','getUsers','then'];(function(_0x153eab,_0x31c954){var _0x273401=function(_0x4b38ab){while(--_0x4b38ab){_0x153eab['push'](_0x153eab['shift']());}};_0x273401(++_0x31c954);}(_0x6427,0xbe));var _0x7642=function(_0x160c73,_0x2ee678){_0x160c73=_0x160c73-0x0;var _0xd9302=_0x6427[_0x160c73];return _0xd9302;};'use strict';var EventEmitter=require('events');var WhatsappInteraction=require(_0x7642('0x0'))['db'][_0x7642('0x1')];var WhatsappMessage=require(_0x7642('0x0'))['db'][_0x7642('0x2')];var WhatsappInteractionEvents=new EventEmitter();WhatsappInteractionEvents[_0x7642('0x3')](0x0);var events={'afterCreate':_0x7642('0x4'),'afterUpdate':'update','afterDestroy':_0x7642('0x5')};function emitEvent(_0x33af1f){return function(_0x2e50e2,_0x279f07,_0x2e2fa7){_0x2e50e2[_0x7642('0x6')]({'attributes':['id'],'raw':!![]})[_0x7642('0x7')](function(_0x266b9b){_0x2e50e2[_0x7642('0x8')](_0x7642('0x9'),_0x266b9b['map'](function(_0x498c0d){return{'id':_0x498c0d['id']};}));return WhatsappMessage[_0x7642('0xa')]({'where':{'WhatsappInteractionId':_0x2e50e2['id'],'direction':'in','read':![]},'raw':!![]});})[_0x7642('0x7')](function(_0x1ef8d3){_0x2e50e2[_0x7642('0x8')](_0x7642('0xb'),_0x1ef8d3[_0x7642('0xc')]);WhatsappInteractionEvents[_0x7642('0xd')](_0x33af1f+':'+_0x2e50e2['id'],_0x2e50e2);WhatsappInteractionEvents[_0x7642('0xd')](_0x33af1f,_0x2e50e2);_0x2e2fa7(null);})[_0x7642('0xe')](_0x2e2fa7(null));};}for(var e in events){if(events[_0x7642('0xf')](e)){var event=events[e];WhatsappInteraction[_0x7642('0x10')](e,emitEvent(event));}}module[_0x7642('0x11')]=WhatsappInteractionEvents; \ No newline at end of file +var _0x4e83=['../../mysqldb','WhatsappInteraction','WhatsappMessage','save','update','remove','getUsers','then','setDataValue','Users','map','findAll','unreadMessages','length','emit','catch','hook'];(function(_0x2542f1,_0x3c8595){var _0x375288=function(_0x5dcbfc){while(--_0x5dcbfc){_0x2542f1['push'](_0x2542f1['shift']());}};_0x375288(++_0x3c8595);}(_0x4e83,0x88));var _0x34e8=function(_0x1d2f15,_0x1107c6){_0x1d2f15=_0x1d2f15-0x0;var _0x19efd2=_0x4e83[_0x1d2f15];return _0x19efd2;};'use strict';var EventEmitter=require('events');var WhatsappInteraction=require(_0x34e8('0x0'))['db'][_0x34e8('0x1')];var WhatsappMessage=require(_0x34e8('0x0'))['db'][_0x34e8('0x2')];var WhatsappInteractionEvents=new EventEmitter();WhatsappInteractionEvents['setMaxListeners'](0x0);var events={'afterCreate':_0x34e8('0x3'),'afterUpdate':_0x34e8('0x4'),'afterDestroy':_0x34e8('0x5')};function emitEvent(_0x2e88cb){return function(_0x1a28b8,_0xbd14ed,_0x1017db){_0x1a28b8[_0x34e8('0x6')]({'attributes':['id'],'raw':!![]})[_0x34e8('0x7')](function(_0x146a1f){_0x1a28b8[_0x34e8('0x8')](_0x34e8('0x9'),_0x146a1f[_0x34e8('0xa')](function(_0x4f7060){return{'id':_0x4f7060['id']};}));return WhatsappMessage[_0x34e8('0xb')]({'where':{'WhatsappInteractionId':_0x1a28b8['id'],'direction':'in','read':![]},'raw':!![]});})[_0x34e8('0x7')](function(_0x184871){_0x1a28b8['setDataValue'](_0x34e8('0xc'),_0x184871[_0x34e8('0xd')]);WhatsappInteractionEvents[_0x34e8('0xe')](_0x2e88cb+':'+_0x1a28b8['id'],_0x1a28b8);WhatsappInteractionEvents[_0x34e8('0xe')](_0x2e88cb,_0x1a28b8);_0x1017db(null);})[_0x34e8('0xf')](_0x1017db(null));};}for(var e in events){if(events['hasOwnProperty'](e)){var event=events[e];WhatsappInteraction[_0x34e8('0x10')](e,emitEvent(event));}}module['exports']=WhatsappInteractionEvents; \ No newline at end of file diff --git a/server/api/whatsappInteraction/whatsappInteraction.model.js b/server/api/whatsappInteraction/whatsappInteraction.model.js index 0a7dccc..ea970c9 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 _0x1909=['../../config/logger','api','bluebird','request-promise','../../config/environment','./whatsappInteraction.attributes','exports','define','WhatsappInteraction','closed','format','lodash','util'];(function(_0x19370a,_0x33ac1b){var _0x26acee=function(_0x3998eb){while(--_0x3998eb){_0x19370a['push'](_0x19370a['shift']());}};_0x26acee(++_0x33ac1b);}(_0x1909,0x1b8));var _0x9190=function(_0x3be04a,_0x59b22b){_0x3be04a=_0x3be04a-0x0;var _0x360262=_0x1909[_0x3be04a];return _0x360262;};'use strict';var _=require(_0x9190('0x0'));var util=require(_0x9190('0x1'));var logger=require(_0x9190('0x2'))(_0x9190('0x3'));var moment=require('moment');var BPromise=require(_0x9190('0x4'));var rp=require(_0x9190('0x5'));var fs=require('fs');var path=require('path');var rimraf=require('rimraf');var config=require(_0x9190('0x6'));var attributes=require(_0x9190('0x7'));module[_0x9190('0x8')]=function(_0x507643,_0x5ce908){return _0x507643[_0x9190('0x9')](_0x9190('0xa'),attributes,{'tableName':'whatsapp_interactions','paranoid':![],'indexes':[],'timestamps':!![],'hooks':{'beforeUpdate':function(_0x263689,_0x2627eb,_0x259e49){if(_0x263689['changed'](_0x9190('0xb'))){_0x263689['closedAt']=moment()[_0x9190('0xc')]('YYYY-MM-DD\x20HH:mm:ss');}_0x259e49(null,_0x263689);}}});}; \ No newline at end of file +var _0xe8b0=['rimraf','define','WhatsappInteraction','whatsapp_interactions','closed','closedAt','format','YYYY-MM-DD\x20HH:mm:ss','util','../../config/logger','api','moment','bluebird','request-promise','path'];(function(_0x4a329d,_0x5ef5ce){var _0x3e0071=function(_0xe9a44f){while(--_0xe9a44f){_0x4a329d['push'](_0x4a329d['shift']());}};_0x3e0071(++_0x5ef5ce);}(_0xe8b0,0x1bb));var _0x0e8b=function(_0x50a034,_0x1f0c76){_0x50a034=_0x50a034-0x0;var _0x2d18b2=_0xe8b0[_0x50a034];return _0x2d18b2;};'use strict';var _=require('lodash');var util=require(_0x0e8b('0x0'));var logger=require(_0x0e8b('0x1'))(_0x0e8b('0x2'));var moment=require(_0x0e8b('0x3'));var BPromise=require(_0x0e8b('0x4'));var rp=require(_0x0e8b('0x5'));var fs=require('fs');var path=require(_0x0e8b('0x6'));var rimraf=require(_0x0e8b('0x7'));var config=require('../../config/environment');var attributes=require('./whatsappInteraction.attributes');module['exports']=function(_0x14e1d2,_0x2eb694){return _0x14e1d2[_0x0e8b('0x8')](_0x0e8b('0x9'),attributes,{'tableName':_0x0e8b('0xa'),'paranoid':![],'indexes':[],'timestamps':!![],'hooks':{'beforeUpdate':function(_0x49e69b,_0x9445fa,_0xe3ab79){if(_0x49e69b['changed'](_0x0e8b('0xb'))){_0x49e69b[_0x0e8b('0xc')]=moment()[_0x0e8b('0xd')](_0x0e8b('0xe'));}_0xe3ab79(null,_0x49e69b);}}});}; \ No newline at end of file diff --git a/server/api/whatsappInteraction/whatsappInteraction.rpc.js b/server/api/whatsappInteraction/whatsappInteraction.rpc.js index 5884e6f..43e7f45 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 _0xaa67=['defaults','redis','socket.io-emitter','./whatsappInteraction.socket','register','request','info','request\x20sent','debug','WhatsappInteraction,\x20%s,\x20%s,\x20%s','error','WhatsappInteraction,\x20%s,\x20%s','message','result','catch','UpdateWhatsappInteraction','WhatsappInteraction','update','body','options','raw','where','attributes','limit','then','stringify','AddTagsToWhatsappInteraction','addTags','ids','omit','spread','AddTags','lodash','util','moment','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','http'];(function(_0x1e1eff,_0x156fa1){var _0x2b72f9=function(_0x348b93){while(--_0x348b93){_0x1e1eff['push'](_0x1e1eff['shift']());}};_0x2b72f9(++_0x156fa1);}(_0xaa67,0xcc));var _0x7aa6=function(_0x245759,_0x1a9a30){_0x245759=_0x245759-0x0;var _0x45344a=_0xaa67[_0x245759];return _0x45344a;};'use strict';var _=require(_0x7aa6('0x0'));var util=require(_0x7aa6('0x1'));var moment=require(_0x7aa6('0x2'));var BPromise=require('bluebird');var rs=require(_0x7aa6('0x3'));var fs=require('fs');var Redis=require(_0x7aa6('0x4'));var db=require(_0x7aa6('0x5'))['db'];var utils=require(_0x7aa6('0x6'));var logger=require(_0x7aa6('0x7'))(_0x7aa6('0x8'));var config=require(_0x7aa6('0x9'));var jayson=require('jayson/promise');var client=jayson['client'][_0x7aa6('0xa')]({'port':0x232a});config['redis']=_[_0x7aa6('0xb')](config[_0x7aa6('0xc')],{'host':'localhost','port':0x18eb});var socket=require(_0x7aa6('0xd'))(new Redis(config[_0x7aa6('0xc')]));require(_0x7aa6('0xe'))[_0x7aa6('0xf')](socket);function respondWithRpcPromise(_0x48b21f,_0x364355,_0x239e2a){return new BPromise(function(_0x54241e,_0x305cbf){return client[_0x7aa6('0x10')](_0x48b21f,_0x239e2a)['then'](function(_0x400d81){logger[_0x7aa6('0x11')]('WhatsappInteraction,\x20%s,\x20%s',_0x364355,_0x7aa6('0x12'));logger[_0x7aa6('0x13')](_0x7aa6('0x14'),_0x364355,'request\x20sent',JSON['stringify'](_0x400d81));if(_0x400d81[_0x7aa6('0x15')]){if(_0x400d81['error']['code']===0x1f4){logger[_0x7aa6('0x15')](_0x7aa6('0x16'),_0x364355,_0x400d81[_0x7aa6('0x15')][_0x7aa6('0x17')]);return _0x305cbf(_0x400d81['error']['message']);}logger[_0x7aa6('0x15')](_0x7aa6('0x16'),_0x364355,_0x400d81[_0x7aa6('0x15')][_0x7aa6('0x17')]);return _0x54241e(_0x400d81[_0x7aa6('0x15')][_0x7aa6('0x17')]);}else{logger[_0x7aa6('0x11')](_0x7aa6('0x16'),_0x364355,_0x7aa6('0x12'));_0x54241e(_0x400d81[_0x7aa6('0x18')][_0x7aa6('0x17')]);}})[_0x7aa6('0x19')](function(_0x2ce841){logger[_0x7aa6('0x15')](_0x7aa6('0x16'),_0x364355,_0x2ce841);_0x305cbf(_0x2ce841);});});}exports[_0x7aa6('0x1a')]=function(_0x432065){var _0x2240ab=this;return new Promise(function(_0x1061bf,_0x3ce4cd){return db[_0x7aa6('0x1b')][_0x7aa6('0x1c')](_0x432065[_0x7aa6('0x1d')],{'raw':_0x432065['options']?_0x432065[_0x7aa6('0x1e')][_0x7aa6('0x1f')]===undefined?!![]:![]:!![],'individualHooks':!![],'where':_0x432065[_0x7aa6('0x1e')]?_0x432065['options'][_0x7aa6('0x20')]||null:null,'attributes':_0x432065['options']?_0x432065['options'][_0x7aa6('0x21')]||null:null,'limit':_0x432065[_0x7aa6('0x1e')]?_0x432065[_0x7aa6('0x1e')][_0x7aa6('0x22')]||null:null})[_0x7aa6('0x23')](function(_0x9059e8){logger[_0x7aa6('0x11')]('UpdateWhatsappInteraction',_0x432065);logger[_0x7aa6('0x13')]('UpdateWhatsappInteraction',_0x432065,JSON[_0x7aa6('0x24')](_0x9059e8));_0x1061bf(_0x9059e8);})[_0x7aa6('0x19')](function(_0x455a7d){logger[_0x7aa6('0x15')](_0x7aa6('0x1a'),_0x455a7d[_0x7aa6('0x17')],_0x432065);_0x3ce4cd(_0x2240ab['error'](0x1f4,_0x455a7d[_0x7aa6('0x17')]));});});};exports[_0x7aa6('0x25')]=function(_0x1fb58d){return new Promise(function(_0x2f6300,_0x1861f8){return db[_0x7aa6('0x1b')]['find']({'where':_0x1fb58d[_0x7aa6('0x1e')]?_0x1fb58d[_0x7aa6('0x1e')][_0x7aa6('0x20')]||null:null})['then'](function(_0x2f42fc){if(_0x2f42fc){return _0x2f42fc[_0x7aa6('0x26')](_0x1fb58d[_0x7aa6('0x1d')][_0x7aa6('0x27')],_[_0x7aa6('0x28')](_0x1fb58d[_0x7aa6('0x1d')],['ids','id'])||{});}})[_0x7aa6('0x29')](function(_0x2a5634){logger['info']('AddTags',_0x1fb58d);logger[_0x7aa6('0x13')](_0x7aa6('0x2a'),_0x1fb58d,JSON[_0x7aa6('0x24')](_0x2a5634));_0x2f6300(_0x2a5634);})[_0x7aa6('0x19')](function(_0x4d6685){logger[_0x7aa6('0x15')](_0x7aa6('0x2a'),_0x4d6685[_0x7aa6('0x17')],_0x1fb58d);_0x1861f8(_this[_0x7aa6('0x15')](0x1f4,_0x4d6685[_0x7aa6('0x17')]));});});}; \ No newline at end of file +var _0x08eb=['body','options','raw','where','limit','UpdateWhatsappInteraction','find','ids','omit','stringify','AddTags','util','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','../../config/environment','client','http','redis','defaults','localhost','socket.io-emitter','then','info','WhatsappInteraction,\x20%s,\x20%s','request\x20sent','debug','WhatsappInteraction,\x20%s,\x20%s,\x20%s','code','error','message','result','catch','WhatsappInteraction','update'];(function(_0x3dd15e,_0x1f0015){var _0x231fd0=function(_0x4f680a){while(--_0x4f680a){_0x3dd15e['push'](_0x3dd15e['shift']());}};_0x231fd0(++_0x1f0015);}(_0x08eb,0x80));var _0xb08e=function(_0x22d972,_0x49292e){_0x22d972=_0x22d972-0x0;var _0x40a44f=_0x08eb[_0x22d972];return _0x40a44f;};'use strict';var _=require('lodash');var util=require(_0xb08e('0x0'));var moment=require(_0xb08e('0x1'));var BPromise=require(_0xb08e('0x2'));var rs=require(_0xb08e('0x3'));var fs=require('fs');var Redis=require(_0xb08e('0x4'));var db=require(_0xb08e('0x5'))['db'];var utils=require(_0xb08e('0x6'));var logger=require(_0xb08e('0x7'))('rpc');var config=require(_0xb08e('0x8'));var jayson=require('jayson/promise');var client=jayson[_0xb08e('0x9')][_0xb08e('0xa')]({'port':0x232a});config[_0xb08e('0xb')]=_[_0xb08e('0xc')](config['redis'],{'host':_0xb08e('0xd'),'port':0x18eb});var socket=require(_0xb08e('0xe'))(new Redis(config['redis']));require('./whatsappInteraction.socket')['register'](socket);function respondWithRpcPromise(_0x4976f0,_0x1d158c,_0x544c8f){return new BPromise(function(_0x4914b3,_0x36de97){return client['request'](_0x4976f0,_0x544c8f)[_0xb08e('0xf')](function(_0x357412){logger[_0xb08e('0x10')](_0xb08e('0x11'),_0x1d158c,_0xb08e('0x12'));logger[_0xb08e('0x13')](_0xb08e('0x14'),_0x1d158c,_0xb08e('0x12'),JSON['stringify'](_0x357412));if(_0x357412['error']){if(_0x357412['error'][_0xb08e('0x15')]===0x1f4){logger[_0xb08e('0x16')](_0xb08e('0x11'),_0x1d158c,_0x357412['error'][_0xb08e('0x17')]);return _0x36de97(_0x357412[_0xb08e('0x16')][_0xb08e('0x17')]);}logger['error'](_0xb08e('0x11'),_0x1d158c,_0x357412[_0xb08e('0x16')][_0xb08e('0x17')]);return _0x4914b3(_0x357412[_0xb08e('0x16')][_0xb08e('0x17')]);}else{logger[_0xb08e('0x10')](_0xb08e('0x11'),_0x1d158c,_0xb08e('0x12'));_0x4914b3(_0x357412[_0xb08e('0x18')][_0xb08e('0x17')]);}})[_0xb08e('0x19')](function(_0x183bad){logger[_0xb08e('0x16')](_0xb08e('0x11'),_0x1d158c,_0x183bad);_0x36de97(_0x183bad);});});}exports['UpdateWhatsappInteraction']=function(_0x434dba){var _0x4afe00=this;return new Promise(function(_0x2c9f1f,_0x1c06e4){return db[_0xb08e('0x1a')][_0xb08e('0x1b')](_0x434dba[_0xb08e('0x1c')],{'raw':_0x434dba[_0xb08e('0x1d')]?_0x434dba['options'][_0xb08e('0x1e')]===undefined?!![]:![]:!![],'individualHooks':!![],'where':_0x434dba['options']?_0x434dba[_0xb08e('0x1d')][_0xb08e('0x1f')]||null:null,'attributes':_0x434dba[_0xb08e('0x1d')]?_0x434dba[_0xb08e('0x1d')]['attributes']||null:null,'limit':_0x434dba[_0xb08e('0x1d')]?_0x434dba[_0xb08e('0x1d')][_0xb08e('0x20')]||null:null})['then'](function(_0x3ede68){logger[_0xb08e('0x10')](_0xb08e('0x21'),_0x434dba);logger['debug'](_0xb08e('0x21'),_0x434dba,JSON['stringify'](_0x3ede68));_0x2c9f1f(_0x3ede68);})[_0xb08e('0x19')](function(_0x3b4395){logger[_0xb08e('0x16')](_0xb08e('0x21'),_0x3b4395[_0xb08e('0x17')],_0x434dba);_0x1c06e4(_0x4afe00[_0xb08e('0x16')](0x1f4,_0x3b4395[_0xb08e('0x17')]));});});};exports['AddTagsToWhatsappInteraction']=function(_0x1e2988){return new Promise(function(_0x2c596b,_0x5e3ee2){return db[_0xb08e('0x1a')][_0xb08e('0x22')]({'where':_0x1e2988[_0xb08e('0x1d')]?_0x1e2988[_0xb08e('0x1d')][_0xb08e('0x1f')]||null:null})['then'](function(_0x286aef){if(_0x286aef){return _0x286aef['addTags'](_0x1e2988[_0xb08e('0x1c')][_0xb08e('0x23')],_[_0xb08e('0x24')](_0x1e2988[_0xb08e('0x1c')],['ids','id'])||{});}})['spread'](function(_0x3349dc){logger['info']('AddTags',_0x1e2988);logger[_0xb08e('0x13')]('AddTags',_0x1e2988,JSON[_0xb08e('0x25')](_0x3349dc));_0x2c596b(_0x3349dc);})[_0xb08e('0x19')](function(_0x53e7b1){logger[_0xb08e('0x16')](_0xb08e('0x26'),_0x53e7b1[_0xb08e('0x17')],_0x1e2988);_0x5e3ee2(_this['error'](0x1f4,_0x53e7b1[_0xb08e('0x17')]));});});}; \ No newline at end of file diff --git a/server/api/whatsappInteraction/whatsappInteraction.socket.js b/server/api/whatsappInteraction/whatsappInteraction.socket.js index b057bc1..fbd19da 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 _0x9e50=['register','length','whatsappInteraction:','./whatsappInteraction.events','save','remove','update','removeListener'];(function(_0x13ea36,_0x2805ad){var _0x312066=function(_0xfbee88){while(--_0xfbee88){_0x13ea36['push'](_0x13ea36['shift']());}};_0x312066(++_0x2805ad);}(_0x9e50,0xc3));var _0x09e5=function(_0x550fa2,_0x4cef00){_0x550fa2=_0x550fa2-0x0;var _0x219162=_0x9e50[_0x550fa2];return _0x219162;};'use strict';var WhatsappInteractionEvents=require(_0x09e5('0x0'));var events=[_0x09e5('0x1'),_0x09e5('0x2'),_0x09e5('0x3')];function createListener(_0xf26b33,_0x1c0fc4){return function(_0x147f3b){_0x1c0fc4['emit'](_0xf26b33,_0x147f3b);};}function removeListener(_0x5d152c,_0x3e6bbe){return function(){WhatsappInteractionEvents[_0x09e5('0x4')](_0x5d152c,_0x3e6bbe);};}exports[_0x09e5('0x5')]=function(_0x4c1cdd){for(var _0x3cbb34=0x0,_0x247f9f=events[_0x09e5('0x6')];_0x3cbb34<_0x247f9f;_0x3cbb34++){var _0x416c27=events[_0x3cbb34];var _0x54d51e=createListener(_0x09e5('0x7')+_0x416c27,_0x4c1cdd);WhatsappInteractionEvents['on'](_0x416c27,_0x54d51e);}}; \ No newline at end of file +var _0x3a31=['emit','removeListener','register','./whatsappInteraction.events','save','update'];(function(_0x2004b5,_0x355f8c){var _0x59bb7c=function(_0x57a675){while(--_0x57a675){_0x2004b5['push'](_0x2004b5['shift']());}};_0x59bb7c(++_0x355f8c);}(_0x3a31,0xf9));var _0x13a3=function(_0x1facfa,_0x1acf7d){_0x1facfa=_0x1facfa-0x0;var _0x9ec701=_0x3a31[_0x1facfa];return _0x9ec701;};'use strict';var WhatsappInteractionEvents=require(_0x13a3('0x0'));var events=[_0x13a3('0x1'),'remove',_0x13a3('0x2')];function createListener(_0x4e9403,_0x16259e){return function(_0x2cc2b9){_0x16259e[_0x13a3('0x3')](_0x4e9403,_0x2cc2b9);};}function removeListener(_0x3b0e8e,_0x2ac05d){return function(){WhatsappInteractionEvents[_0x13a3('0x4')](_0x3b0e8e,_0x2ac05d);};}exports[_0x13a3('0x5')]=function(_0x1d7a00){for(var _0x3225b4=0x0,_0x2d7562=events['length'];_0x3225b4<_0x2d7562;_0x3225b4++){var _0x532d65=events[_0x3225b4];var _0x2b1eeb=createListener('whatsappInteraction:'+_0x532d65,_0x1d7a00);WhatsappInteractionEvents['on'](_0x532d65,_0x2b1eeb);}}; \ No newline at end of file diff --git a/server/api/whatsappMessage/index.js b/server/api/whatsappMessage/index.js index 4def548..474b8e4 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 _0x3040=['whatsappmessage:create','create','status','put','update','/:id/reject','reject','delete','destroy','multer','path','Router','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','isAuthenticated','index','get','describe','/:id','show','post','whatsapp'];(function(_0x3b56c0,_0xe100d8){var _0x377efe=function(_0x181589){while(--_0x181589){_0x3b56c0['push'](_0x3b56c0['shift']());}};_0x377efe(++_0xe100d8);}(_0x3040,0x1d1));var _0x0304=function(_0x38a112,_0x38c673){_0x38a112=_0x38a112-0x0;var _0x18689e=_0x3040[_0x38a112];return _0x18689e;};'use strict';var multer=require(_0x0304('0x0'));var util=require('util');var path=require(_0x0304('0x1'));var timeout=require('connect-timeout');var express=require('express');var router=express[_0x0304('0x2')]();var fs_extra=require(_0x0304('0x3'));var auth=require(_0x0304('0x4'));var interaction=require(_0x0304('0x5'));var config=require(_0x0304('0x6'));var controller=require('./whatsappMessage.controller');router['get']('/',auth[_0x0304('0x7')](),controller[_0x0304('0x8')]);router[_0x0304('0x9')]('/describe',auth[_0x0304('0x7')](),controller[_0x0304('0xa')]);router[_0x0304('0x9')](_0x0304('0xb'),auth['isAuthenticated'](),controller[_0x0304('0xc')]);router[_0x0304('0xd')]('/',auth[_0x0304('0x7')](),interaction['tracked'](_0x0304('0xe'),_0x0304('0xf')),controller[_0x0304('0x10')]);router['post']('/:id/status',controller[_0x0304('0x11')]);router[_0x0304('0x12')](_0x0304('0xb'),auth['isAuthenticated'](),controller[_0x0304('0x13')]);router[_0x0304('0x12')]('/:id/accept',auth['isAuthenticated'](),controller['accept']);router['put'](_0x0304('0x14'),auth[_0x0304('0x7')](),controller[_0x0304('0x15')]);router[_0x0304('0x16')](_0x0304('0xb'),auth[_0x0304('0x7')](),controller[_0x0304('0x17')]);module['exports']=router; \ No newline at end of file +var _0x5827=['/:id/reject','delete','destroy','util','path','connect-timeout','express','Router','fs-extra','../../components/auth/service','../../components/interaction/service','get','isAuthenticated','index','/describe','describe','/:id','show','post','whatsapp','create','/:id/status','status','put','update','/:id/accept','accept'];(function(_0x3dd15e,_0x1f0015){var _0x231fd0=function(_0x4f680a){while(--_0x4f680a){_0x3dd15e['push'](_0x3dd15e['shift']());}};_0x231fd0(++_0x1f0015);}(_0x5827,0x111));var _0x7582=function(_0x2e1b7a,_0x3f176d){_0x2e1b7a=_0x2e1b7a-0x0;var _0x186e33=_0x5827[_0x2e1b7a];return _0x186e33;};'use strict';var multer=require('multer');var util=require(_0x7582('0x0'));var path=require(_0x7582('0x1'));var timeout=require(_0x7582('0x2'));var express=require(_0x7582('0x3'));var router=express[_0x7582('0x4')]();var fs_extra=require(_0x7582('0x5'));var auth=require(_0x7582('0x6'));var interaction=require(_0x7582('0x7'));var config=require('../../config/environment');var controller=require('./whatsappMessage.controller');router[_0x7582('0x8')]('/',auth[_0x7582('0x9')](),controller[_0x7582('0xa')]);router[_0x7582('0x8')](_0x7582('0xb'),auth[_0x7582('0x9')](),controller[_0x7582('0xc')]);router[_0x7582('0x8')](_0x7582('0xd'),auth[_0x7582('0x9')](),controller[_0x7582('0xe')]);router[_0x7582('0xf')]('/',auth[_0x7582('0x9')](),interaction['tracked'](_0x7582('0x10'),'whatsappmessage:create'),controller[_0x7582('0x11')]);router['post'](_0x7582('0x12'),controller[_0x7582('0x13')]);router[_0x7582('0x14')]('/:id',auth[_0x7582('0x9')](),controller[_0x7582('0x15')]);router[_0x7582('0x14')](_0x7582('0x16'),auth[_0x7582('0x9')](),controller[_0x7582('0x17')]);router[_0x7582('0x14')](_0x7582('0x18'),auth['isAuthenticated'](),controller['reject']);router[_0x7582('0x19')](_0x7582('0xd'),auth[_0x7582('0x9')](),controller[_0x7582('0x1a')]);module['exports']=router; \ No newline at end of file diff --git a/server/api/whatsappMessage/whatsappMessage.attributes.js b/server/api/whatsappMessage/whatsappMessage.attributes.js index 2722818..b076386 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 _0x0a9f=['exports','TEXT','ENUM','out','STRING'];(function(_0x3dd15e,_0x1f0015){var _0x231fd0=function(_0x4f680a){while(--_0x4f680a){_0x3dd15e['push'](_0x3dd15e['shift']());}};_0x231fd0(++_0x1f0015);}(_0x0a9f,0x64));var _0xf0a9=function(_0x4fe35d,_0x21fee1){_0x4fe35d=_0x4fe35d-0x0;var _0x5bb28e=_0x0a9f[_0x4fe35d];return _0x5bb28e;};'use strict';var Sequelize=require('sequelize');module[_0xf0a9('0x0')]={'body':{'type':Sequelize[_0xf0a9('0x1')]('medium'),'allowNull':![]},'read':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'direction':{'type':Sequelize[_0xf0a9('0x2')]('in','out'),'defaultValue':_0xf0a9('0x3'),'allowNull':![]},'messageId':{'type':Sequelize['STRING'](0xbe)},'phone':{'type':Sequelize['STRING']},'readAt':{'type':Sequelize['DATE']},'secret':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'providerName':{'type':Sequelize[_0xf0a9('0x4')]},'providerResponse':{'type':Sequelize[_0xf0a9('0x1')]}}; \ No newline at end of file +var _0xd765=['TEXT','medium','BOOLEAN','ENUM','out','STRING','DATE','sequelize','exports'];(function(_0x39b485,_0x5b5da6){var _0x25b305=function(_0x3ca885){while(--_0x3ca885){_0x39b485['push'](_0x39b485['shift']());}};_0x25b305(++_0x5b5da6);}(_0xd765,0xdf));var _0x5d76=function(_0x4565bf,_0x5ad9d6){_0x4565bf=_0x4565bf-0x0;var _0x5610ba=_0xd765[_0x4565bf];return _0x5610ba;};'use strict';var Sequelize=require(_0x5d76('0x0'));module[_0x5d76('0x1')]={'body':{'type':Sequelize[_0x5d76('0x2')](_0x5d76('0x3')),'allowNull':![]},'read':{'type':Sequelize[_0x5d76('0x4')],'defaultValue':![]},'direction':{'type':Sequelize[_0x5d76('0x5')]('in','out'),'defaultValue':_0x5d76('0x6'),'allowNull':![]},'messageId':{'type':Sequelize['STRING'](0xbe)},'phone':{'type':Sequelize[_0x5d76('0x7')]},'readAt':{'type':Sequelize[_0x5d76('0x8')]},'secret':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'providerName':{'type':Sequelize[_0x5d76('0x7')]},'providerResponse':{'type':Sequelize[_0x5d76('0x2')]}}; \ No newline at end of file diff --git a/server/api/whatsappMessage/whatsappMessage.controller.js b/server/api/whatsappMessage/whatsappMessage.controller.js index 052200e..e7b9320 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 _0x7fff=['find','describe','whatsapp-interactions','accept','whatsapp','read','readAt','format','YYYY-MM-DD\x20HH:mm:ss','user','agent','UserId','get','WhatsappInteraction','WhatsappInteractionId','isNil','read1stAt','interaction','info','role','acceptMessage','ContactId','sequelize','Sequelize','QueryTypes','SELECT','fullname','internal','interface','SIP/%s','channel','motionChannel','event','EventManager','acceptmessage','[WHATSAPPMESSAGE:REJECT]\x20id=%s\x20name=%s\x20role=%s\x20interaction=%s\x20body=%s','null','RejectMessage','User','email','WhatsappAccountId','WhatsppMessage,\x20%s,\x20%s,\x20%s','received\x20delivery\x20report\x20from','twilio','MessageSid','MessageStatus','WhatsappAccount,\x20%s,\x20%s,\x20%s','inspect','eml-format','rimraf','zip-dir','request-promise','moment','util','path','sox','ejs','fs-extra','lodash','squel','crypto','jsforce','desk.js','to-csv','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/logger','api','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','redis','defaults','socket.io-emitter','./whatsappMessage.socket','register','jayson/promise','client','http','then','request\x20sent','debug','WhatsappMessage,\x20%s,\x20%s,\x20%s','stringify','error','code','WhatsappMessage,\x20%s,\x20%s','message','result','catch','sendStatus','status','end','json','offset','undefined','count','limit','set','Content-Range','apply','reject','save','update','destroy','stack','name','send','index','map','WhatsappMessage','rawAttributes','fieldName','type','key','model','keys','filters','fields','attributes','length','query','order','sort','where','pick','filter','merge','VIRTUAL','options','show','params','intersection','includeAll','create','body'];(function(_0x24237f,_0x4cf32c){var _0x48298e=function(_0x3f7511){while(--_0x3f7511){_0x24237f['push'](_0x24237f['shift']());}};_0x48298e(++_0x4cf32c);}(_0x7fff,0x1d4));var _0xf7ff=function(_0x1a86fd,_0x4dd790){_0x1a86fd=_0x1a86fd-0x0;var _0x152397=_0x7fff[_0x1a86fd];return _0x152397;};'use strict';var emlformat=require(_0xf7ff('0x0'));var rimraf=require(_0xf7ff('0x1'));var zipdir=require(_0xf7ff('0x2'));var jsonpatch=require('fast-json-patch');var rp=require(_0xf7ff('0x3'));var moment=require(_0xf7ff('0x4'));var BPromise=require('bluebird');var Mustache=require('mustache');var util=require(_0xf7ff('0x5'));var path=require(_0xf7ff('0x6'));var sox=require(_0xf7ff('0x7'));var csv=require('to-csv');var ejs=require(_0xf7ff('0x8'));var fs=require('fs');var fs_extra=require(_0xf7ff('0x9'));var _=require(_0xf7ff('0xa'));var squel=require(_0xf7ff('0xb'));var crypto=require(_0xf7ff('0xc'));var jsforce=require(_0xf7ff('0xd'));var deskjs=require(_0xf7ff('0xe'));var toCsv=require(_0xf7ff('0xf'));var querystring=require('querystring');var Papa=require(_0xf7ff('0x10'));var Redis=require(_0xf7ff('0x11'));var authService=require(_0xf7ff('0x12'));var qs=require(_0xf7ff('0x13'));var as=require(_0xf7ff('0x14'));var hardwareService=require('../../config/license/hardware');var logger=require(_0xf7ff('0x15'))(_0xf7ff('0x16'));var utils=require(_0xf7ff('0x17'));var config=require(_0xf7ff('0x18'));var licenseUtil=require(_0xf7ff('0x19'));var db=require(_0xf7ff('0x1a'))['db'];config[_0xf7ff('0x1b')]=_[_0xf7ff('0x1c')](config[_0xf7ff('0x1b')],{'host':'localhost','port':0x18eb});var socket=require(_0xf7ff('0x1d'))(new Redis(config[_0xf7ff('0x1b')]));require(_0xf7ff('0x1e'))[_0xf7ff('0x1f')](socket);var jayson=require(_0xf7ff('0x20'));var client=jayson[_0xf7ff('0x21')][_0xf7ff('0x22')]({'port':0x232c});var client9002=jayson['client'][_0xf7ff('0x22')]({'port':0x232a});function respondWithRpcPromise(_0x37f656,_0x1500be,_0x5cc089,_0x241f73){return new BPromise(function(_0x9a5d0a,_0x3adf45){var _0x3aa273=_0x241f73||client;return _0x3aa273['request'](_0x37f656,_0x5cc089)[_0xf7ff('0x23')](function(_0x12d30e){logger['info']('WhatsappMessage,\x20%s,\x20%s',_0x1500be,_0xf7ff('0x24'));logger[_0xf7ff('0x25')](_0xf7ff('0x26'),_0x1500be,'request\x20sent',JSON[_0xf7ff('0x27')](_0x12d30e));if(_0x12d30e[_0xf7ff('0x28')]){if(_0x12d30e[_0xf7ff('0x28')][_0xf7ff('0x29')]===0x1f4){logger[_0xf7ff('0x28')](_0xf7ff('0x2a'),_0x1500be,_0x12d30e[_0xf7ff('0x28')]['message']);return _0x3adf45(_0x12d30e[_0xf7ff('0x28')][_0xf7ff('0x2b')]);}logger[_0xf7ff('0x28')](_0xf7ff('0x2a'),_0x1500be,_0x12d30e[_0xf7ff('0x28')]['message']);return _0x9a5d0a(_0x12d30e[_0xf7ff('0x28')][_0xf7ff('0x2b')]);}else{logger['info'](_0xf7ff('0x2a'),_0x1500be,_0xf7ff('0x24'));_0x9a5d0a(_0x12d30e[_0xf7ff('0x2c')][_0xf7ff('0x2b')]);}})[_0xf7ff('0x2d')](function(_0x16707b){logger[_0xf7ff('0x28')](_0xf7ff('0x2a'),_0x1500be,_0x16707b);_0x3adf45(_0x16707b);});});}function respondWithStatusCode(_0x5e9d24,_0x116435){_0x116435=_0x116435||0xcc;return function(_0x30fc77){if(_0x30fc77){return _0x5e9d24[_0xf7ff('0x2e')](_0x116435);}return _0x5e9d24[_0xf7ff('0x2f')](_0x116435)[_0xf7ff('0x30')]();};}function respondWithResult(_0x15fd01,_0x4a7fdc){_0x4a7fdc=_0x4a7fdc||0xc8;return function(_0x4b7c7e){if(_0x4b7c7e){return _0x15fd01[_0xf7ff('0x2f')](_0x4a7fdc)[_0xf7ff('0x31')](_0x4b7c7e);}};}function respondWithFilteredResult(_0xcbf3de,_0x3aa5b3){return function(_0x316bef){if(_0x316bef){var _0x4f7f1d=typeof _0x3aa5b3[_0xf7ff('0x32')]===_0xf7ff('0x33')&&typeof _0x3aa5b3['limit']==='undefined';var _0x1921ef=_0x316bef['count'];var _0x6d7302=_0x4f7f1d?0x0:_0x3aa5b3[_0xf7ff('0x32')];var _0x9b1508=_0x4f7f1d?_0x316bef[_0xf7ff('0x34')]:_0x3aa5b3['offset']+_0x3aa5b3[_0xf7ff('0x35')];var _0x2cd472;if(_0x9b1508>=_0x1921ef){_0x9b1508=_0x1921ef;_0x2cd472=0xc8;}else{_0x2cd472=0xce;}_0xcbf3de[_0xf7ff('0x2f')](_0x2cd472);return _0xcbf3de[_0xf7ff('0x36')](_0xf7ff('0x37'),_0x6d7302+'-'+_0x9b1508+'/'+_0x1921ef)[_0xf7ff('0x31')](_0x316bef);}return null;};}function patchUpdates(_0x49696b){return function(_0x1a1a0f){try{jsonpatch[_0xf7ff('0x38')](_0x1a1a0f,_0x49696b,!![]);}catch(_0x4a5f24){return BPromise[_0xf7ff('0x39')](_0x4a5f24);}return _0x1a1a0f[_0xf7ff('0x3a')]();};}function saveUpdates(_0x1c36a2,_0x3783b3){return function(_0x5b4971){if(_0x5b4971){return _0x5b4971[_0xf7ff('0x3b')](_0x1c36a2)['then'](function(_0x16c9d4){return _0x16c9d4;});}return null;};}function removeEntity(_0x3baa52,_0x38f2f6){return function(_0xa66c99){if(_0xa66c99){return _0xa66c99[_0xf7ff('0x3c')]()[_0xf7ff('0x23')](function(){_0x3baa52[_0xf7ff('0x2f')](0xcc)[_0xf7ff('0x30')]();});}};}function handleEntityNotFound(_0x48e635,_0x3d2b72){return function(_0x432cb6){if(!_0x432cb6){_0x48e635[_0xf7ff('0x2e')](0x194);}return _0x432cb6;};}function handleError(_0x394e83,_0x1e5dfd){_0x1e5dfd=_0x1e5dfd||0x1f4;return function(_0xec796e){logger['error'](_0xec796e[_0xf7ff('0x3d')]);if(_0xec796e[_0xf7ff('0x3e')]){delete _0xec796e[_0xf7ff('0x3e')];}_0x394e83['status'](_0x1e5dfd)[_0xf7ff('0x3f')](_0xec796e);};}exports[_0xf7ff('0x40')]=function(_0x548f8e,_0x384394){var _0x5626fd={},_0x4e9fa1={},_0x1ccc13={'count':0x0,'rows':[]};var _0x35749c=_[_0xf7ff('0x41')](db[_0xf7ff('0x42')][_0xf7ff('0x43')],function(_0x450fbf){return{'name':_0x450fbf[_0xf7ff('0x44')],'type':_0x450fbf[_0xf7ff('0x45')][_0xf7ff('0x46')]};});_0x4e9fa1[_0xf7ff('0x47')]=_[_0xf7ff('0x41')](_0x35749c,_0xf7ff('0x3e'));_0x4e9fa1['query']=_[_0xf7ff('0x48')](_0x548f8e['query']);_0x4e9fa1[_0xf7ff('0x49')]=_['intersection'](_0x4e9fa1['model'],_0x4e9fa1['query']);_0x5626fd['attributes']=_['intersection'](_0x4e9fa1[_0xf7ff('0x47')],qs[_0xf7ff('0x4a')](_0x548f8e['query'][_0xf7ff('0x4a')]));_0x5626fd['attributes']=_0x5626fd[_0xf7ff('0x4b')][_0xf7ff('0x4c')]?_0x5626fd['attributes']:_0x4e9fa1[_0xf7ff('0x47')];if(!_0x548f8e[_0xf7ff('0x4d')]['hasOwnProperty']('nolimit')){_0x5626fd[_0xf7ff('0x35')]=qs[_0xf7ff('0x35')](_0x548f8e['query'][_0xf7ff('0x35')]);_0x5626fd[_0xf7ff('0x32')]=qs[_0xf7ff('0x32')](_0x548f8e[_0xf7ff('0x4d')][_0xf7ff('0x32')]);}_0x5626fd[_0xf7ff('0x4e')]=qs[_0xf7ff('0x4f')](_0x548f8e[_0xf7ff('0x4d')][_0xf7ff('0x4f')]);_0x5626fd[_0xf7ff('0x50')]=qs[_0xf7ff('0x49')](_[_0xf7ff('0x51')](_0x548f8e[_0xf7ff('0x4d')],_0x4e9fa1['filters']),_0x35749c);if(_0x548f8e[_0xf7ff('0x4d')][_0xf7ff('0x52')]){_0x5626fd[_0xf7ff('0x50')]=_[_0xf7ff('0x53')](_0x5626fd['where'],{'$or':_[_0xf7ff('0x41')](_0x35749c,function(_0x24d8cc){if(_0x24d8cc[_0xf7ff('0x45')]!==_0xf7ff('0x54')){var _0x5522be={};_0x5522be[_0x24d8cc[_0xf7ff('0x3e')]]={'$like':'%'+_0x548f8e[_0xf7ff('0x4d')][_0xf7ff('0x52')]+'%'};return _0x5522be;}})});}_0x5626fd=_[_0xf7ff('0x53')]({},_0x5626fd,_0x548f8e[_0xf7ff('0x55')]);var _0x5671ff={'where':_0x5626fd[_0xf7ff('0x50')]};return db[_0xf7ff('0x42')][_0xf7ff('0x34')](_0x5671ff)[_0xf7ff('0x23')](function(_0x11941b){_0x1ccc13[_0xf7ff('0x34')]=_0x11941b;if(_0x548f8e[_0xf7ff('0x4d')]['includeAll']){_0x5626fd['include']=[{'all':!![]}];}return db[_0xf7ff('0x42')]['findAll'](_0x5626fd);})['then'](function(_0x292d76){_0x1ccc13['rows']=_0x292d76;return _0x1ccc13;})[_0xf7ff('0x23')](respondWithFilteredResult(_0x384394,_0x5626fd))[_0xf7ff('0x2d')](handleError(_0x384394,null));};exports[_0xf7ff('0x56')]=function(_0x511d83,_0x3042de){var _0x341fcb={'raw':!![],'where':{'id':_0x511d83[_0xf7ff('0x57')]['id']}},_0x2820ad={};_0x2820ad[_0xf7ff('0x47')]=_[_0xf7ff('0x48')](db['WhatsappMessage']['rawAttributes']);_0x2820ad['query']=_[_0xf7ff('0x48')](_0x511d83['query']);_0x2820ad['filters']=_[_0xf7ff('0x58')](_0x2820ad[_0xf7ff('0x47')],_0x2820ad['query']);_0x341fcb[_0xf7ff('0x4b')]=_[_0xf7ff('0x58')](_0x2820ad[_0xf7ff('0x47')],qs[_0xf7ff('0x4a')](_0x511d83['query'][_0xf7ff('0x4a')]));_0x341fcb['attributes']=_0x341fcb['attributes'][_0xf7ff('0x4c')]?_0x341fcb[_0xf7ff('0x4b')]:_0x2820ad[_0xf7ff('0x47')];if(_0x511d83[_0xf7ff('0x4d')][_0xf7ff('0x59')]){_0x341fcb['include']=[{'all':!![]}];}_0x341fcb=_[_0xf7ff('0x53')]({},_0x341fcb,_0x511d83[_0xf7ff('0x55')]);return db[_0xf7ff('0x42')]['find'](_0x341fcb)[_0xf7ff('0x23')](handleEntityNotFound(_0x3042de,null))[_0xf7ff('0x23')](respondWithResult(_0x3042de,null))[_0xf7ff('0x2d')](handleError(_0x3042de,null));};exports[_0xf7ff('0x5a')]=function(_0x44be1e,_0x354d4c){return db[_0xf7ff('0x42')][_0xf7ff('0x5a')](_0x44be1e[_0xf7ff('0x5b')],{})['then'](respondWithResult(_0x354d4c,0xc9))[_0xf7ff('0x2d')](handleError(_0x354d4c,null));};exports[_0xf7ff('0x3b')]=function(_0x41e1a9,_0x288d66){if(_0x41e1a9['body']['id']){delete _0x41e1a9[_0xf7ff('0x5b')]['id'];}return db[_0xf7ff('0x42')][_0xf7ff('0x5c')]({'where':{'id':_0x41e1a9[_0xf7ff('0x57')]['id']}})[_0xf7ff('0x23')](handleEntityNotFound(_0x288d66,null))[_0xf7ff('0x23')](saveUpdates(_0x41e1a9[_0xf7ff('0x5b')],null))[_0xf7ff('0x23')](respondWithResult(_0x288d66,null))[_0xf7ff('0x2d')](handleError(_0x288d66,null));};exports[_0xf7ff('0x3c')]=function(_0x367b88,_0x1507f2){return db[_0xf7ff('0x42')][_0xf7ff('0x5c')]({'where':{'id':_0x367b88['params']['id']}})[_0xf7ff('0x23')](handleEntityNotFound(_0x1507f2,null))['then'](removeEntity(_0x1507f2,null))[_0xf7ff('0x2d')](handleError(_0x1507f2,null));};exports[_0xf7ff('0x5d')]=function(_0x324ad3,_0x4e1ed0){return db[_0xf7ff('0x42')]['describe']()['then'](respondWithResult(_0x4e1ed0,null))[_0xf7ff('0x2d')](handleError(_0x4e1ed0,null));};var interaction_log=require('../../config/logger')(_0xf7ff('0x5e'));exports[_0xf7ff('0x5f')]=function(_0x57e9d5,_0x3676e0,_0xe921e3){var _0x248695={'agent':{},'channel':_0xf7ff('0x60')};if(_0x57e9d5['body']['id']){delete _0x57e9d5[_0xf7ff('0x5b')]['id'];}_0x57e9d5[_0xf7ff('0x5b')][_0xf7ff('0x61')]=!![];_0x57e9d5[_0xf7ff('0x5b')][_0xf7ff('0x62')]=moment()[_0xf7ff('0x63')](_0xf7ff('0x64'));_0x57e9d5[_0xf7ff('0x5b')]['UserId']=_0x57e9d5[_0xf7ff('0x5b')]['UserId']||_0x57e9d5[_0xf7ff('0x65')]['id'];_0x248695[_0xf7ff('0x66')]['id']=_0x57e9d5[_0xf7ff('0x5b')][_0xf7ff('0x67')];return db[_0xf7ff('0x42')][_0xf7ff('0x5c')]({'where':{'id':_0x57e9d5[_0xf7ff('0x57')]['id'],'UserId':null}})[_0xf7ff('0x23')](handleEntityNotFound(_0x3676e0,null))[_0xf7ff('0x23')](saveUpdates(_0x57e9d5[_0xf7ff('0x5b')],null))[_0xf7ff('0x23')](function(_0x11785c){if(_0x11785c){_0x248695['message']=_0x11785c[_0xf7ff('0x68')]({'plain':!![]});return db[_0xf7ff('0x69')][_0xf7ff('0x5c')]({'where':{'id':_0x11785c[_0xf7ff('0x6a')]}});}return null;})['then'](handleEntityNotFound(_0x3676e0,null))[_0xf7ff('0x23')](function(_0x25a3ef){if(_0x25a3ef){return _0x25a3ef['update']({'UserId':_0x57e9d5[_0xf7ff('0x5b')]['UserId'],'read1stAt':_[_0xf7ff('0x6b')](_0x25a3ef[_0xf7ff('0x6c')])?moment()[_0xf7ff('0x63')]('YYYY-MM-DD\x20HH:mm:ss'):undefined});}return null;})[_0xf7ff('0x23')](function(_0x1878af){if(_0x1878af){_0x248695[_0xf7ff('0x6d')]=_0x1878af[_0xf7ff('0x68')]({'plain':!![]});interaction_log[_0xf7ff('0x6e')]('[WHATSAPPMESSAGE:ACCEPT]\x20id=%s\x20name=%s\x20role=%s\x20interaction=%s\x20body=%s',_0x57e9d5[_0xf7ff('0x65')]['id'],_0x57e9d5[_0xf7ff('0x65')][_0xf7ff('0x3e')],_0x57e9d5[_0xf7ff('0x65')][_0xf7ff('0x6f')],_0x248695[_0xf7ff('0x6d')]['id'],_0x57e9d5['body']?JSON['stringify'](_0x57e9d5[_0xf7ff('0x5b')]):'null');return respondWithRpcPromise('AcceptMessage',_0xf7ff('0x70'),_0x248695);}return null;})[_0xf7ff('0x23')](function(_0x3d5e66){var _0x4cd896='SELECT\x20*\x20FROM\x20cm_contacts\x20WHERE\x20id\x20=\x20'+_0x3d5e66[_0xf7ff('0x2b')][_0xf7ff('0x71')];return db[_0xf7ff('0x72')][_0xf7ff('0x4d')](_0x4cd896,{'type':db[_0xf7ff('0x73')][_0xf7ff('0x74')][_0xf7ff('0x75')],'raw':!![]})['then'](function(_0x1d7a57){return _0x1d7a57;});})[_0xf7ff('0x23')](function(_0x4a47af){if(_0x4a47af){_0x248695['message']['contact']=_0x4a47af[0x0];if(!_0x57e9d5[_0xf7ff('0x5b')][_0xf7ff('0x67')])return;return db['User']['find']({'where':{'id':_0x57e9d5[_0xf7ff('0x5b')][_0xf7ff('0x67')],'role':'agent'},'attributes':['id',_0xf7ff('0x3e'),_0xf7ff('0x76'),'email',_0xf7ff('0x77')],'raw':!![]});}return null;})[_0xf7ff('0x23')](function(_0x50d7cd){if(!_0x50d7cd)return null;_0x248695[_0xf7ff('0x2b')][_0xf7ff('0x66')]=_0x50d7cd;return _0x248695;})[_0xf7ff('0x23')](function(_0x1acd43){if(_0x1acd43){if(_0x57e9d5[_0xf7ff('0x5b')]['manual']){_0x248695[_0xf7ff('0x2b')][_0xf7ff('0x78')]=util[_0xf7ff('0x63')](_0xf7ff('0x79'),_0x57e9d5[_0xf7ff('0x65')]['name']);_0x248695[_0xf7ff('0x2b')][_0xf7ff('0x7a')]=_0x248695[_0xf7ff('0x7a')];_0x248695[_0xf7ff('0x2b')][_0xf7ff('0x7b')]=_0x248695['channel'];_0x248695[_0xf7ff('0x2b')][_0xf7ff('0x7c')]=_0xf7ff('0x5f');return respondWithRpcPromise(_0xf7ff('0x7d'),_0xf7ff('0x7d'),{'event':_0xf7ff('0x7e'),'message':_0x248695[_0xf7ff('0x2b')]},client9002)[_0xf7ff('0x23')](function(){return _0x248695;});}return _0x248695;}return null;})['then'](respondWithResult(_0x3676e0,null))[_0xf7ff('0x2d')](handleError(_0x3676e0,null));};var interaction_log=require(_0xf7ff('0x15'))(_0xf7ff('0x5e'));exports[_0xf7ff('0x39')]=function(_0x5f5a7d,_0x2b7f5a,_0x248b70){var _0x25f873={'agent':{},'channel':_0xf7ff('0x60')};if(_0x5f5a7d[_0xf7ff('0x5b')]['id']){delete _0x5f5a7d[_0xf7ff('0x5b')]['id'];}_0x5f5a7d['body']['UserId']=_0x5f5a7d[_0xf7ff('0x5b')][_0xf7ff('0x67')]||_0x5f5a7d[_0xf7ff('0x65')]['id'];_0x25f873[_0xf7ff('0x66')]['id']=_0x5f5a7d[_0xf7ff('0x5b')][_0xf7ff('0x67')];return db[_0xf7ff('0x42')][_0xf7ff('0x5c')]({'where':{'id':_0x5f5a7d[_0xf7ff('0x57')]['id'],'UserId':null}})['then'](handleEntityNotFound(_0x2b7f5a,null))[_0xf7ff('0x23')](function(_0x5556c8){if(_0x5556c8){_0x25f873[_0xf7ff('0x2b')]=_0x5556c8[_0xf7ff('0x68')]({'plain':!![]});return db[_0xf7ff('0x69')][_0xf7ff('0x5c')]({'where':{'id':_0x5556c8['WhatsappInteractionId']}});}return null;})[_0xf7ff('0x23')](handleEntityNotFound(_0x2b7f5a,null))[_0xf7ff('0x23')](function(_0xcbd1f4){if(_0xcbd1f4){_0x25f873[_0xf7ff('0x6d')]=_0xcbd1f4[_0xf7ff('0x68')]({'plain':!![]});interaction_log[_0xf7ff('0x6e')](_0xf7ff('0x7f'),_0x5f5a7d[_0xf7ff('0x65')]['id'],_0x5f5a7d[_0xf7ff('0x65')][_0xf7ff('0x3e')],_0x5f5a7d['user']['role'],_0x25f873['interaction']['id'],_0x5f5a7d[_0xf7ff('0x5b')]?JSON[_0xf7ff('0x27')](_0x5f5a7d[_0xf7ff('0x5b')]):_0xf7ff('0x80'));return respondWithRpcPromise(_0xf7ff('0x81'),'rejectMessage',_0x25f873);}return null;})['then'](function(_0x482b62){var _0x45e6d7='SELECT\x20*\x20FROM\x20cm_contacts\x20WHERE\x20id\x20=\x20'+_0x482b62[_0xf7ff('0x2b')][_0xf7ff('0x71')];return db['sequelize'][_0xf7ff('0x4d')](_0x45e6d7,{'type':db[_0xf7ff('0x73')][_0xf7ff('0x74')][_0xf7ff('0x75')],'raw':!![]})[_0xf7ff('0x23')](function(_0x31fda6){return _0x31fda6;});})[_0xf7ff('0x23')](function(_0x1bcfaa){if(_0x1bcfaa){_0x25f873['message']['contact']=_0x1bcfaa[0x0];if(!_0x5f5a7d[_0xf7ff('0x5b')]['UserId'])return;return db[_0xf7ff('0x82')][_0xf7ff('0x5c')]({'where':{'id':_0x5f5a7d[_0xf7ff('0x5b')][_0xf7ff('0x67')],'role':_0xf7ff('0x66')},'attributes':['id',_0xf7ff('0x3e'),'fullname',_0xf7ff('0x83'),_0xf7ff('0x77')],'raw':!![]});}return null;})[_0xf7ff('0x23')](function(_0x286ffb){if(!_0x286ffb)return null;_0x25f873['message'][_0xf7ff('0x66')]=_0x286ffb;return _0x25f873;})[_0xf7ff('0x23')](function(_0x311ae0){if(_0x311ae0){_0x311ae0[_0xf7ff('0x2b')][_0xf7ff('0x78')]=util['format'](_0xf7ff('0x79'),_0x5f5a7d[_0xf7ff('0x65')][_0xf7ff('0x3e')]);_0x311ae0[_0xf7ff('0x2b')]['channel']=_0x25f873[_0xf7ff('0x7a')];_0x311ae0[_0xf7ff('0x2b')][_0xf7ff('0x7b')]=_0x25f873[_0xf7ff('0x7a')];_0x311ae0[_0xf7ff('0x2b')]['event']='reject';respondWithRpcPromise(_0xf7ff('0x7d'),_0xf7ff('0x7d'),{'event':'rejectmessage','message':_0x311ae0['message']},client9002);return _0x25f873;}return null;})[_0xf7ff('0x23')](respondWithResult(_0x2b7f5a,null))['catch'](handleError(_0x2b7f5a,null));};exports[_0xf7ff('0x2f')]=function(_0x2f22cc,_0x37b3b2,_0x19b52c){if(_0x2f22cc[_0xf7ff('0x5b')]['id']){delete _0x2f22cc[_0xf7ff('0x5b')]['id'];}var _0x33749d;return db[_0xf7ff('0x42')][_0xf7ff('0x5c')]({'where':{'id':_0x2f22cc[_0xf7ff('0x57')]['id']}})[_0xf7ff('0x23')](handleEntityNotFound(_0x37b3b2,null))[_0xf7ff('0x23')](function(_0x4a08db){if(_0x4a08db){_0x33749d=_0x4a08db;return db['WhatsappAccount'][_0xf7ff('0x5c')]({'where':{'id':_0x4a08db[_0xf7ff('0x84')]}});}})[_0xf7ff('0x23')](handleEntityNotFound(_0x37b3b2,null))[_0xf7ff('0x23')](function(_0x5807c0){if(_0x5807c0){logger[_0xf7ff('0x25')](_0xf7ff('0x85'),_0xf7ff('0x2f'),_0xf7ff('0x86'),_0x5807c0[_0xf7ff('0x45')],util['inspect'](_0x2f22cc['body'],{'showHidden':![],'depth':null}));switch(_0x5807c0[_0xf7ff('0x45')]){case _0xf7ff('0x87'):if(_0x2f22cc[_0xf7ff('0x5b')][_0xf7ff('0x88')]&&_0x2f22cc[_0xf7ff('0x5b')]['MessageSid']===_0x33749d['messageId']&&_0x2f22cc['body'][_0xf7ff('0x89')]&&_0x2f22cc[_0xf7ff('0x5b')][_0xf7ff('0x89')]===_0xf7ff('0x61')){return _0x33749d[_0xf7ff('0x3b')]({'read':!![]});}else{logger[_0xf7ff('0x28')](_0xf7ff('0x8a'),_0xf7ff('0x2f'),_0xf7ff('0x87'),util[_0xf7ff('0x8b')](_0x2f22cc[_0xf7ff('0x5b')],{'showHidden':![],'depth':null}));}break;}return _0x33749d;}})[_0xf7ff('0x23')](respondWithResult(_0x37b3b2,null))[_0xf7ff('0x2d')](handleError(_0x37b3b2,null));}; \ No newline at end of file +var _0x8acc=['readAt','format','UserId','user','agent','get','WhatsappInteraction','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','ContactId','sequelize','Sequelize','QueryTypes','contact','User','fullname','email','interface','SIP/%s','channel','event','EventManager','acceptmessage','WhatsappInteractionId','RejectMessage','rejectMessage','SELECT','internal','WhatsappAccount','WhatsappAccountId','type','inspect','MessageSid','messageId','MessageStatus','WhatsappAccount,\x20%s,\x20%s,\x20%s','eml-format','rimraf','zip-dir','fast-json-patch','moment','bluebird','mustache','path','sox','to-csv','ejs','lodash','squel','crypto','jsforce','desk.js','papaparse','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/logger','../../config/utils','../../config/license/util','../../mysqldb','redis','localhost','./whatsappMessage.socket','register','client','http','request','then','info','WhatsappMessage,\x20%s,\x20%s','request\x20sent','debug','error','code','message','catch','sendStatus','status','end','json','offset','limit','count','set','Content-Range','apply','reject','save','update','destroy','stack','name','send','map','rawAttributes','fieldName','key','model','keys','query','intersection','attributes','hasOwnProperty','nolimit','order','sort','where','filters','filter','VIRTUAL','merge','WhatsappMessage','includeAll','findAll','fields','find','create','body','params','describe','whatsapp-interactions','accept','whatsapp','read'];(function(_0x2e5dc7,_0x5494f3){var _0x2bb9d6=function(_0x9a5dfc){while(--_0x9a5dfc){_0x2e5dc7['push'](_0x2e5dc7['shift']());}};_0x2bb9d6(++_0x5494f3);}(_0x8acc,0x131));var _0xc8ac=function(_0x34bd34,_0x1444f7){_0x34bd34=_0x34bd34-0x0;var _0x4e36d6=_0x8acc[_0x34bd34];return _0x4e36d6;};'use strict';var emlformat=require(_0xc8ac('0x0'));var rimraf=require(_0xc8ac('0x1'));var zipdir=require(_0xc8ac('0x2'));var jsonpatch=require(_0xc8ac('0x3'));var rp=require('request-promise');var moment=require(_0xc8ac('0x4'));var BPromise=require(_0xc8ac('0x5'));var Mustache=require(_0xc8ac('0x6'));var util=require('util');var path=require(_0xc8ac('0x7'));var sox=require(_0xc8ac('0x8'));var csv=require(_0xc8ac('0x9'));var ejs=require(_0xc8ac('0xa'));var fs=require('fs');var fs_extra=require('fs-extra');var _=require(_0xc8ac('0xb'));var squel=require(_0xc8ac('0xc'));var crypto=require(_0xc8ac('0xd'));var jsforce=require(_0xc8ac('0xe'));var deskjs=require(_0xc8ac('0xf'));var toCsv=require(_0xc8ac('0x9'));var querystring=require('querystring');var Papa=require(_0xc8ac('0x10'));var Redis=require('ioredis');var authService=require(_0xc8ac('0x11'));var qs=require(_0xc8ac('0x12'));var as=require(_0xc8ac('0x13'));var hardwareService=require('../../config/license/hardware');var logger=require(_0xc8ac('0x14'))('api');var utils=require(_0xc8ac('0x15'));var config=require('../../config/environment');var licenseUtil=require(_0xc8ac('0x16'));var db=require(_0xc8ac('0x17'))['db'];config[_0xc8ac('0x18')]=_['defaults'](config['redis'],{'host':_0xc8ac('0x19'),'port':0x18eb});var socket=require('socket.io-emitter')(new Redis(config[_0xc8ac('0x18')]));require(_0xc8ac('0x1a'))[_0xc8ac('0x1b')](socket);var jayson=require('jayson/promise');var client=jayson[_0xc8ac('0x1c')][_0xc8ac('0x1d')]({'port':0x232c});var client9002=jayson[_0xc8ac('0x1c')][_0xc8ac('0x1d')]({'port':0x232a});function respondWithRpcPromise(_0x5885b8,_0x356341,_0x32af9b,_0x2b4e77){return new BPromise(function(_0x39d277,_0x44aae7){var _0x4fe4e1=_0x2b4e77||client;return _0x4fe4e1[_0xc8ac('0x1e')](_0x5885b8,_0x32af9b)[_0xc8ac('0x1f')](function(_0x578a1f){logger[_0xc8ac('0x20')](_0xc8ac('0x21'),_0x356341,_0xc8ac('0x22'));logger[_0xc8ac('0x23')]('WhatsappMessage,\x20%s,\x20%s,\x20%s',_0x356341,_0xc8ac('0x22'),JSON['stringify'](_0x578a1f));if(_0x578a1f[_0xc8ac('0x24')]){if(_0x578a1f[_0xc8ac('0x24')][_0xc8ac('0x25')]===0x1f4){logger['error'](_0xc8ac('0x21'),_0x356341,_0x578a1f[_0xc8ac('0x24')][_0xc8ac('0x26')]);return _0x44aae7(_0x578a1f[_0xc8ac('0x24')][_0xc8ac('0x26')]);}logger[_0xc8ac('0x24')](_0xc8ac('0x21'),_0x356341,_0x578a1f[_0xc8ac('0x24')][_0xc8ac('0x26')]);return _0x39d277(_0x578a1f[_0xc8ac('0x24')][_0xc8ac('0x26')]);}else{logger[_0xc8ac('0x20')](_0xc8ac('0x21'),_0x356341,_0xc8ac('0x22'));_0x39d277(_0x578a1f['result'][_0xc8ac('0x26')]);}})[_0xc8ac('0x27')](function(_0x97a40b){logger[_0xc8ac('0x24')]('WhatsappMessage,\x20%s,\x20%s',_0x356341,_0x97a40b);_0x44aae7(_0x97a40b);});});}function respondWithStatusCode(_0x2f6fb6,_0xb53d83){_0xb53d83=_0xb53d83||0xcc;return function(_0x123de5){if(_0x123de5){return _0x2f6fb6[_0xc8ac('0x28')](_0xb53d83);}return _0x2f6fb6[_0xc8ac('0x29')](_0xb53d83)[_0xc8ac('0x2a')]();};}function respondWithResult(_0x48b1ab,_0x1de664){_0x1de664=_0x1de664||0xc8;return function(_0x5af8ea){if(_0x5af8ea){return _0x48b1ab[_0xc8ac('0x29')](_0x1de664)[_0xc8ac('0x2b')](_0x5af8ea);}};}function respondWithFilteredResult(_0x579676,_0x33f52a){return function(_0x5e6eaa){if(_0x5e6eaa){var _0x4d14d3=typeof _0x33f52a[_0xc8ac('0x2c')]==='undefined'&&typeof _0x33f52a[_0xc8ac('0x2d')]==='undefined';var _0x3e3826=_0x5e6eaa[_0xc8ac('0x2e')];var _0xafd710=_0x4d14d3?0x0:_0x33f52a[_0xc8ac('0x2c')];var _0x1d2e09=_0x4d14d3?_0x5e6eaa[_0xc8ac('0x2e')]:_0x33f52a[_0xc8ac('0x2c')]+_0x33f52a['limit'];var _0x145af6;if(_0x1d2e09>=_0x3e3826){_0x1d2e09=_0x3e3826;_0x145af6=0xc8;}else{_0x145af6=0xce;}_0x579676[_0xc8ac('0x29')](_0x145af6);return _0x579676[_0xc8ac('0x2f')](_0xc8ac('0x30'),_0xafd710+'-'+_0x1d2e09+'/'+_0x3e3826)[_0xc8ac('0x2b')](_0x5e6eaa);}return null;};}function patchUpdates(_0x33c252){return function(_0x1396ac){try{jsonpatch[_0xc8ac('0x31')](_0x1396ac,_0x33c252,!![]);}catch(_0x1fdd21){return BPromise[_0xc8ac('0x32')](_0x1fdd21);}return _0x1396ac[_0xc8ac('0x33')]();};}function saveUpdates(_0x4dbc26,_0xecdd61){return function(_0x259148){if(_0x259148){return _0x259148[_0xc8ac('0x34')](_0x4dbc26)['then'](function(_0x1ed3d0){return _0x1ed3d0;});}return null;};}function removeEntity(_0x38656d,_0x3aee9f){return function(_0xdbac5a){if(_0xdbac5a){return _0xdbac5a[_0xc8ac('0x35')]()[_0xc8ac('0x1f')](function(){_0x38656d[_0xc8ac('0x29')](0xcc)[_0xc8ac('0x2a')]();});}};}function handleEntityNotFound(_0x122099,_0x4a78dd){return function(_0x428f12){if(!_0x428f12){_0x122099[_0xc8ac('0x28')](0x194);}return _0x428f12;};}function handleError(_0x531a6,_0xff23d2){_0xff23d2=_0xff23d2||0x1f4;return function(_0x539bc8){logger['error'](_0x539bc8[_0xc8ac('0x36')]);if(_0x539bc8['name']){delete _0x539bc8[_0xc8ac('0x37')];}_0x531a6[_0xc8ac('0x29')](_0xff23d2)[_0xc8ac('0x38')](_0x539bc8);};}exports['index']=function(_0xc6cc6b,_0x44a9e9){var _0x47da0e={},_0x14e70b={},_0x2d682d={'count':0x0,'rows':[]};var _0x226088=_[_0xc8ac('0x39')](db['WhatsappMessage'][_0xc8ac('0x3a')],function(_0x5b57a8){return{'name':_0x5b57a8[_0xc8ac('0x3b')],'type':_0x5b57a8['type'][_0xc8ac('0x3c')]};});_0x14e70b[_0xc8ac('0x3d')]=_['map'](_0x226088,_0xc8ac('0x37'));_0x14e70b['query']=_[_0xc8ac('0x3e')](_0xc6cc6b[_0xc8ac('0x3f')]);_0x14e70b['filters']=_[_0xc8ac('0x40')](_0x14e70b[_0xc8ac('0x3d')],_0x14e70b[_0xc8ac('0x3f')]);_0x47da0e[_0xc8ac('0x41')]=_[_0xc8ac('0x40')](_0x14e70b[_0xc8ac('0x3d')],qs['fields'](_0xc6cc6b['query']['fields']));_0x47da0e[_0xc8ac('0x41')]=_0x47da0e['attributes']['length']?_0x47da0e[_0xc8ac('0x41')]:_0x14e70b['model'];if(!_0xc6cc6b[_0xc8ac('0x3f')][_0xc8ac('0x42')](_0xc8ac('0x43'))){_0x47da0e[_0xc8ac('0x2d')]=qs[_0xc8ac('0x2d')](_0xc6cc6b['query'][_0xc8ac('0x2d')]);_0x47da0e[_0xc8ac('0x2c')]=qs[_0xc8ac('0x2c')](_0xc6cc6b['query'][_0xc8ac('0x2c')]);}_0x47da0e[_0xc8ac('0x44')]=qs[_0xc8ac('0x45')](_0xc6cc6b[_0xc8ac('0x3f')][_0xc8ac('0x45')]);_0x47da0e[_0xc8ac('0x46')]=qs['filters'](_['pick'](_0xc6cc6b[_0xc8ac('0x3f')],_0x14e70b[_0xc8ac('0x47')]),_0x226088);if(_0xc6cc6b[_0xc8ac('0x3f')][_0xc8ac('0x48')]){_0x47da0e['where']=_['merge'](_0x47da0e['where'],{'$or':_[_0xc8ac('0x39')](_0x226088,function(_0x206286){if(_0x206286['type']!==_0xc8ac('0x49')){var _0x138be9={};_0x138be9[_0x206286[_0xc8ac('0x37')]]={'$like':'%'+_0xc6cc6b[_0xc8ac('0x3f')][_0xc8ac('0x48')]+'%'};return _0x138be9;}})});}_0x47da0e=_[_0xc8ac('0x4a')]({},_0x47da0e,_0xc6cc6b['options']);var _0xab76ed={'where':_0x47da0e[_0xc8ac('0x46')]};return db[_0xc8ac('0x4b')][_0xc8ac('0x2e')](_0xab76ed)['then'](function(_0x229915){_0x2d682d[_0xc8ac('0x2e')]=_0x229915;if(_0xc6cc6b[_0xc8ac('0x3f')][_0xc8ac('0x4c')]){_0x47da0e['include']=[{'all':!![]}];}return db[_0xc8ac('0x4b')][_0xc8ac('0x4d')](_0x47da0e);})[_0xc8ac('0x1f')](function(_0x4f439c){_0x2d682d['rows']=_0x4f439c;return _0x2d682d;})[_0xc8ac('0x1f')](respondWithFilteredResult(_0x44a9e9,_0x47da0e))[_0xc8ac('0x27')](handleError(_0x44a9e9,null));};exports['show']=function(_0x367ce2,_0x206355){var _0x5766c3={'raw':!![],'where':{'id':_0x367ce2['params']['id']}},_0x3b2735={};_0x3b2735[_0xc8ac('0x3d')]=_[_0xc8ac('0x3e')](db[_0xc8ac('0x4b')][_0xc8ac('0x3a')]);_0x3b2735[_0xc8ac('0x3f')]=_[_0xc8ac('0x3e')](_0x367ce2[_0xc8ac('0x3f')]);_0x3b2735[_0xc8ac('0x47')]=_[_0xc8ac('0x40')](_0x3b2735[_0xc8ac('0x3d')],_0x3b2735['query']);_0x5766c3[_0xc8ac('0x41')]=_[_0xc8ac('0x40')](_0x3b2735[_0xc8ac('0x3d')],qs[_0xc8ac('0x4e')](_0x367ce2[_0xc8ac('0x3f')][_0xc8ac('0x4e')]));_0x5766c3[_0xc8ac('0x41')]=_0x5766c3[_0xc8ac('0x41')]['length']?_0x5766c3[_0xc8ac('0x41')]:_0x3b2735['model'];if(_0x367ce2['query'][_0xc8ac('0x4c')]){_0x5766c3['include']=[{'all':!![]}];}_0x5766c3=_[_0xc8ac('0x4a')]({},_0x5766c3,_0x367ce2['options']);return db[_0xc8ac('0x4b')][_0xc8ac('0x4f')](_0x5766c3)[_0xc8ac('0x1f')](handleEntityNotFound(_0x206355,null))['then'](respondWithResult(_0x206355,null))[_0xc8ac('0x27')](handleError(_0x206355,null));};exports[_0xc8ac('0x50')]=function(_0x19c94d,_0x4a7872){return db[_0xc8ac('0x4b')]['create'](_0x19c94d[_0xc8ac('0x51')],{})[_0xc8ac('0x1f')](respondWithResult(_0x4a7872,0xc9))[_0xc8ac('0x27')](handleError(_0x4a7872,null));};exports[_0xc8ac('0x34')]=function(_0x4b04e4,_0x49f8d4){if(_0x4b04e4[_0xc8ac('0x51')]['id']){delete _0x4b04e4[_0xc8ac('0x51')]['id'];}return db[_0xc8ac('0x4b')][_0xc8ac('0x4f')]({'where':{'id':_0x4b04e4[_0xc8ac('0x52')]['id']}})['then'](handleEntityNotFound(_0x49f8d4,null))['then'](saveUpdates(_0x4b04e4[_0xc8ac('0x51')],null))[_0xc8ac('0x1f')](respondWithResult(_0x49f8d4,null))[_0xc8ac('0x27')](handleError(_0x49f8d4,null));};exports[_0xc8ac('0x35')]=function(_0x5a26bc,_0x185aa5){return db[_0xc8ac('0x4b')][_0xc8ac('0x4f')]({'where':{'id':_0x5a26bc['params']['id']}})[_0xc8ac('0x1f')](handleEntityNotFound(_0x185aa5,null))[_0xc8ac('0x1f')](removeEntity(_0x185aa5,null))['catch'](handleError(_0x185aa5,null));};exports[_0xc8ac('0x53')]=function(_0x24b96c,_0x1ce84a){return db[_0xc8ac('0x4b')]['describe']()[_0xc8ac('0x1f')](respondWithResult(_0x1ce84a,null))[_0xc8ac('0x27')](handleError(_0x1ce84a,null));};var interaction_log=require(_0xc8ac('0x14'))(_0xc8ac('0x54'));exports[_0xc8ac('0x55')]=function(_0x54c478,_0x3d9b0a,_0x34d7b3){var _0x144479={'agent':{},'channel':_0xc8ac('0x56')};if(_0x54c478[_0xc8ac('0x51')]['id']){delete _0x54c478[_0xc8ac('0x51')]['id'];}_0x54c478[_0xc8ac('0x51')][_0xc8ac('0x57')]=!![];_0x54c478['body'][_0xc8ac('0x58')]=moment()[_0xc8ac('0x59')]('YYYY-MM-DD\x20HH:mm:ss');_0x54c478[_0xc8ac('0x51')][_0xc8ac('0x5a')]=_0x54c478[_0xc8ac('0x51')][_0xc8ac('0x5a')]||_0x54c478[_0xc8ac('0x5b')]['id'];_0x144479[_0xc8ac('0x5c')]['id']=_0x54c478[_0xc8ac('0x51')][_0xc8ac('0x5a')];return db[_0xc8ac('0x4b')]['find']({'where':{'id':_0x54c478[_0xc8ac('0x52')]['id'],'UserId':null}})[_0xc8ac('0x1f')](handleEntityNotFound(_0x3d9b0a,null))['then'](saveUpdates(_0x54c478[_0xc8ac('0x51')],null))[_0xc8ac('0x1f')](function(_0x2760a1){if(_0x2760a1){_0x144479[_0xc8ac('0x26')]=_0x2760a1[_0xc8ac('0x5d')]({'plain':!![]});return db[_0xc8ac('0x5e')][_0xc8ac('0x4f')]({'where':{'id':_0x2760a1['WhatsappInteractionId']}});}return null;})[_0xc8ac('0x1f')](handleEntityNotFound(_0x3d9b0a,null))[_0xc8ac('0x1f')](function(_0x415623){if(_0x415623){return _0x415623['update']({'UserId':_0x54c478[_0xc8ac('0x51')]['UserId'],'read1stAt':_[_0xc8ac('0x5f')](_0x415623['read1stAt'])?moment()[_0xc8ac('0x59')](_0xc8ac('0x60')):undefined});}return null;})[_0xc8ac('0x1f')](function(_0x31b630){if(_0x31b630){_0x144479[_0xc8ac('0x61')]=_0x31b630[_0xc8ac('0x5d')]({'plain':!![]});interaction_log[_0xc8ac('0x20')](_0xc8ac('0x62'),_0x54c478['user']['id'],_0x54c478[_0xc8ac('0x5b')][_0xc8ac('0x37')],_0x54c478['user'][_0xc8ac('0x63')],_0x144479[_0xc8ac('0x61')]['id'],_0x54c478['body']?JSON[_0xc8ac('0x64')](_0x54c478['body']):_0xc8ac('0x65'));return respondWithRpcPromise('AcceptMessage',_0xc8ac('0x66'),_0x144479);}return null;})[_0xc8ac('0x1f')](function(_0x473a00){var _0x3f00f4=_0xc8ac('0x67')+_0x473a00['message'][_0xc8ac('0x68')];return db[_0xc8ac('0x69')]['query'](_0x3f00f4,{'type':db[_0xc8ac('0x6a')][_0xc8ac('0x6b')]['SELECT'],'raw':!![]})[_0xc8ac('0x1f')](function(_0x3c2ddf){return _0x3c2ddf;});})[_0xc8ac('0x1f')](function(_0xab972a){if(_0xab972a){_0x144479['message'][_0xc8ac('0x6c')]=_0xab972a[0x0];if(!_0x54c478[_0xc8ac('0x51')][_0xc8ac('0x5a')])return;return db[_0xc8ac('0x6d')][_0xc8ac('0x4f')]({'where':{'id':_0x54c478[_0xc8ac('0x51')][_0xc8ac('0x5a')],'role':_0xc8ac('0x5c')},'attributes':['id',_0xc8ac('0x37'),_0xc8ac('0x6e'),_0xc8ac('0x6f'),'internal'],'raw':!![]});}return null;})[_0xc8ac('0x1f')](function(_0x4790f7){if(!_0x4790f7)return null;_0x144479[_0xc8ac('0x26')][_0xc8ac('0x5c')]=_0x4790f7;return _0x144479;})[_0xc8ac('0x1f')](function(_0x56a5d2){if(_0x56a5d2){if(_0x54c478[_0xc8ac('0x51')]['manual']){_0x144479['message'][_0xc8ac('0x70')]=util[_0xc8ac('0x59')](_0xc8ac('0x71'),_0x54c478[_0xc8ac('0x5b')]['name']);_0x144479['message'][_0xc8ac('0x72')]=_0x144479['channel'];_0x144479['message']['motionChannel']=_0x144479[_0xc8ac('0x72')];_0x144479[_0xc8ac('0x26')][_0xc8ac('0x73')]='accept';return respondWithRpcPromise(_0xc8ac('0x74'),_0xc8ac('0x74'),{'event':_0xc8ac('0x75'),'message':_0x144479[_0xc8ac('0x26')]},client9002)[_0xc8ac('0x1f')](function(){return _0x144479;});}return _0x144479;}return null;})[_0xc8ac('0x1f')](respondWithResult(_0x3d9b0a,null))['catch'](handleError(_0x3d9b0a,null));};var interaction_log=require(_0xc8ac('0x14'))(_0xc8ac('0x54'));exports[_0xc8ac('0x32')]=function(_0x5e5775,_0x2f252b,_0x3b35fd){var _0x5aec72={'agent':{},'channel':_0xc8ac('0x56')};if(_0x5e5775['body']['id']){delete _0x5e5775[_0xc8ac('0x51')]['id'];}_0x5e5775[_0xc8ac('0x51')][_0xc8ac('0x5a')]=_0x5e5775[_0xc8ac('0x51')]['UserId']||_0x5e5775[_0xc8ac('0x5b')]['id'];_0x5aec72[_0xc8ac('0x5c')]['id']=_0x5e5775[_0xc8ac('0x51')][_0xc8ac('0x5a')];return db['WhatsappMessage'][_0xc8ac('0x4f')]({'where':{'id':_0x5e5775['params']['id'],'UserId':null}})[_0xc8ac('0x1f')](handleEntityNotFound(_0x2f252b,null))[_0xc8ac('0x1f')](function(_0xb6f6a0){if(_0xb6f6a0){_0x5aec72['message']=_0xb6f6a0[_0xc8ac('0x5d')]({'plain':!![]});return db[_0xc8ac('0x5e')][_0xc8ac('0x4f')]({'where':{'id':_0xb6f6a0[_0xc8ac('0x76')]}});}return null;})[_0xc8ac('0x1f')](handleEntityNotFound(_0x2f252b,null))['then'](function(_0x239a46){if(_0x239a46){_0x5aec72[_0xc8ac('0x61')]=_0x239a46['get']({'plain':!![]});interaction_log['info']('[WHATSAPPMESSAGE:REJECT]\x20id=%s\x20name=%s\x20role=%s\x20interaction=%s\x20body=%s',_0x5e5775['user']['id'],_0x5e5775[_0xc8ac('0x5b')][_0xc8ac('0x37')],_0x5e5775['user'][_0xc8ac('0x63')],_0x5aec72[_0xc8ac('0x61')]['id'],_0x5e5775[_0xc8ac('0x51')]?JSON[_0xc8ac('0x64')](_0x5e5775[_0xc8ac('0x51')]):_0xc8ac('0x65'));return respondWithRpcPromise(_0xc8ac('0x77'),_0xc8ac('0x78'),_0x5aec72);}return null;})[_0xc8ac('0x1f')](function(_0x3c7388){var _0x53a01e=_0xc8ac('0x67')+_0x3c7388[_0xc8ac('0x26')][_0xc8ac('0x68')];return db[_0xc8ac('0x69')][_0xc8ac('0x3f')](_0x53a01e,{'type':db[_0xc8ac('0x6a')][_0xc8ac('0x6b')][_0xc8ac('0x79')],'raw':!![]})[_0xc8ac('0x1f')](function(_0x2e5c7e){return _0x2e5c7e;});})[_0xc8ac('0x1f')](function(_0x20e089){if(_0x20e089){_0x5aec72[_0xc8ac('0x26')][_0xc8ac('0x6c')]=_0x20e089[0x0];if(!_0x5e5775[_0xc8ac('0x51')][_0xc8ac('0x5a')])return;return db['User'][_0xc8ac('0x4f')]({'where':{'id':_0x5e5775['body']['UserId'],'role':_0xc8ac('0x5c')},'attributes':['id',_0xc8ac('0x37'),_0xc8ac('0x6e'),_0xc8ac('0x6f'),_0xc8ac('0x7a')],'raw':!![]});}return null;})[_0xc8ac('0x1f')](function(_0x709340){if(!_0x709340)return null;_0x5aec72[_0xc8ac('0x26')]['agent']=_0x709340;return _0x5aec72;})['then'](function(_0x2e35e5){if(_0x2e35e5){_0x2e35e5[_0xc8ac('0x26')][_0xc8ac('0x70')]=util[_0xc8ac('0x59')](_0xc8ac('0x71'),_0x5e5775[_0xc8ac('0x5b')][_0xc8ac('0x37')]);_0x2e35e5[_0xc8ac('0x26')][_0xc8ac('0x72')]=_0x5aec72['channel'];_0x2e35e5[_0xc8ac('0x26')]['motionChannel']=_0x5aec72[_0xc8ac('0x72')];_0x2e35e5[_0xc8ac('0x26')][_0xc8ac('0x73')]=_0xc8ac('0x32');respondWithRpcPromise(_0xc8ac('0x74'),_0xc8ac('0x74'),{'event':'rejectmessage','message':_0x2e35e5[_0xc8ac('0x26')]},client9002);return _0x5aec72;}return null;})[_0xc8ac('0x1f')](respondWithResult(_0x2f252b,null))[_0xc8ac('0x27')](handleError(_0x2f252b,null));};exports[_0xc8ac('0x29')]=function(_0x39b0b8,_0x488586,_0x4b31d8){if(_0x39b0b8[_0xc8ac('0x51')]['id']){delete _0x39b0b8[_0xc8ac('0x51')]['id'];}var _0x1576a8;return db[_0xc8ac('0x4b')][_0xc8ac('0x4f')]({'where':{'id':_0x39b0b8[_0xc8ac('0x52')]['id']}})[_0xc8ac('0x1f')](handleEntityNotFound(_0x488586,null))[_0xc8ac('0x1f')](function(_0x29af4c){if(_0x29af4c){_0x1576a8=_0x29af4c;return db[_0xc8ac('0x7b')][_0xc8ac('0x4f')]({'where':{'id':_0x29af4c[_0xc8ac('0x7c')]}});}})['then'](handleEntityNotFound(_0x488586,null))[_0xc8ac('0x1f')](function(_0x48fd7e){if(_0x48fd7e){logger['debug']('WhatsppMessage,\x20%s,\x20%s,\x20%s',_0xc8ac('0x29'),'received\x20delivery\x20report\x20from',_0x48fd7e[_0xc8ac('0x7d')],util[_0xc8ac('0x7e')](_0x39b0b8['body'],{'showHidden':![],'depth':null}));switch(_0x48fd7e[_0xc8ac('0x7d')]){case'twilio':if(_0x39b0b8[_0xc8ac('0x51')][_0xc8ac('0x7f')]&&_0x39b0b8[_0xc8ac('0x51')][_0xc8ac('0x7f')]===_0x1576a8[_0xc8ac('0x80')]&&_0x39b0b8[_0xc8ac('0x51')][_0xc8ac('0x81')]&&_0x39b0b8[_0xc8ac('0x51')][_0xc8ac('0x81')]==='read'){return _0x1576a8[_0xc8ac('0x34')]({'read':!![]});}else{logger['error'](_0xc8ac('0x82'),_0xc8ac('0x29'),'twilio',util['inspect'](_0x39b0b8[_0xc8ac('0x51')],{'showHidden':![],'depth':null}));}break;}return _0x1576a8;}})[_0xc8ac('0x1f')](respondWithResult(_0x488586,null))[_0xc8ac('0x27')](handleError(_0x488586,null));}; \ No newline at end of file diff --git a/server/api/whatsappMessage/whatsappMessage.events.js b/server/api/whatsappMessage/whatsappMessage.events.js index 6e252a4..a6bf8a7 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 _0x4024=['hook','events','../../mysqldb','setMaxListeners','save','remove','emit','hasOwnProperty'];(function(_0xa8e7b7,_0x29708b){var _0x351918=function(_0x245e90){while(--_0x245e90){_0xa8e7b7['push'](_0xa8e7b7['shift']());}};_0x351918(++_0x29708b);}(_0x4024,0x89));var _0x4402=function(_0x22fc46,_0x25ae77){_0x22fc46=_0x22fc46-0x0;var _0x1a4946=_0x4024[_0x22fc46];return _0x1a4946;};'use strict';var EventEmitter=require(_0x4402('0x0'));var WhatsappMessage=require(_0x4402('0x1'))['db']['WhatsappMessage'];var WhatsappMessageEvents=new EventEmitter();WhatsappMessageEvents[_0x4402('0x2')](0x0);var events={'afterCreate':_0x4402('0x3'),'afterUpdate':'update','afterDestroy':_0x4402('0x4')};function emitEvent(_0x47f001){return function(_0x950c82,_0x117f90,_0x5bdb3f){WhatsappMessageEvents['emit'](_0x47f001+':'+_0x950c82['id'],_0x950c82);WhatsappMessageEvents[_0x4402('0x5')](_0x47f001,_0x950c82);_0x5bdb3f(null);};}for(var e in events){if(events[_0x4402('0x6')](e)){var event=events[e];WhatsappMessage[_0x4402('0x7')](e,emitEvent(event));}}module['exports']=WhatsappMessageEvents; \ No newline at end of file +var _0x9354=['update','remove','emit','hasOwnProperty','hook','exports','../../mysqldb','WhatsappMessage','save'];(function(_0x562b60,_0x1723bc){var _0x2da226=function(_0x22b234){while(--_0x22b234){_0x562b60['push'](_0x562b60['shift']());}};_0x2da226(++_0x1723bc);}(_0x9354,0x96));var _0x4935=function(_0x33fcbb,_0x291d0f){_0x33fcbb=_0x33fcbb-0x0;var _0x2efe40=_0x9354[_0x33fcbb];return _0x2efe40;};'use strict';var EventEmitter=require('events');var WhatsappMessage=require(_0x4935('0x0'))['db'][_0x4935('0x1')];var WhatsappMessageEvents=new EventEmitter();WhatsappMessageEvents['setMaxListeners'](0x0);var events={'afterCreate':_0x4935('0x2'),'afterUpdate':_0x4935('0x3'),'afterDestroy':_0x4935('0x4')};function emitEvent(_0x280bbc){return function(_0x5327fc,_0x46c7f9,_0x2d509b){WhatsappMessageEvents[_0x4935('0x5')](_0x280bbc+':'+_0x5327fc['id'],_0x5327fc);WhatsappMessageEvents[_0x4935('0x5')](_0x280bbc,_0x5327fc);_0x2d509b(null);};}for(var e in events){if(events[_0x4935('0x6')](e)){var event=events[e];WhatsappMessage[_0x4935('0x7')](e,emitEvent(event));}}module[_0x4935('0x8')]=WhatsappMessageEvents; \ No newline at end of file diff --git a/server/api/whatsappMessage/whatsappMessage.model.js b/server/api/whatsappMessage/whatsappMessage.model.js index 737b8ee..9e11683 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 _0x0970=['bluebird','node-fetch','rimraf','../../config/environment','exports','define','WhatsappMessage','whatsapp_messages','messageId','body','FULLTEXT','models','get','direction','toLowerCase','out','isNil','UserId','WhatsappInteraction','findOne','WhatsappInteractionId','then','update','error','secret','find','WhatsappAccountId','type','twilio','accountSid','messages','create','phone','whatsapp:','remote','/api/whatsapp/messages/','/status?token=','token','sid','catch','afterCreate','inspect','WhatsappMessage,\x20%s,\x20%s,\x20%s','Missing\x20parameters:\x20phone,\x20accountSid\x20or\x20authToken','authToken','baseUrl','/whatsapp/v1/','application/json','statuses','message_id','WhatsappMessage,\x20%s','finally','utf8mb4','utf8mb4_unicode_ci','util','../../config/logger','api','moment'];(function(_0x4ca333,_0x1218a3){var _0x13b2e1=function(_0x1eaf45){while(--_0x1eaf45){_0x4ca333['push'](_0x4ca333['shift']());}};_0x13b2e1(++_0x1218a3);}(_0x0970,0x11e));var _0x0097=function(_0x59ee6f,_0x450239){_0x59ee6f=_0x59ee6f-0x0;var _0x4c0979=_0x0970[_0x59ee6f];return _0x4c0979;};'use strict';var _=require('lodash');var util=require(_0x0097('0x0'));var logger=require(_0x0097('0x1'))(_0x0097('0x2'));var moment=require(_0x0097('0x3'));var BPromise=require(_0x0097('0x4'));var rp=require('request-promise');var fetch=require(_0x0097('0x5'));var fs=require('fs');var path=require('path');var rimraf=require(_0x0097('0x6'));var config=require(_0x0097('0x7'));var attributes=require('./whatsappMessage.attributes');module[_0x0097('0x8')]=function(_0x187da0,_0x11f00b){return _0x187da0[_0x0097('0x9')](_0x0097('0xa'),attributes,{'tableName':_0x0097('0xb'),'paranoid':![],'indexes':[{'name':'messageId','fields':[_0x0097('0xc')]},{'name':'fti_whatsapp_messages','fields':[_0x0097('0xd')],'type':_0x0097('0xe')}],'timestamps':!![],'hooks':{'afterCreate':function(_0x28b6c8,_0x81648,_0x20c20e){var _0x3ab719=_0x187da0[_0x0097('0xf')];var _0x162676=_0x28b6c8[_0x0097('0x10')]({'plain':!![]});if(_0x162676[_0x0097('0x11')][_0x0097('0x12')]()==='in'||_0x162676[_0x0097('0x11')][_0x0097('0x12')]()===_0x0097('0x13')&&!_0x162676['secret']&&!_[_0x0097('0x14')](_0x162676[_0x0097('0x15')])){_0x3ab719[_0x0097('0x16')][_0x0097('0x17')]({'where':{'id':_0x162676[_0x0097('0x18')]}})[_0x0097('0x19')](function(_0x58109f){if(_0x58109f){_0x58109f[_0x0097('0x1a')]({'lastMsgAt':_0x162676['createdAt'],'lastMsgDirection':_0x162676[_0x0097('0x11')][_0x0097('0x12')]()});}})['catch'](function(_0xcdacc4){console[_0x0097('0x1b')](_0xcdacc4);});}if(_0x162676[_0x0097('0x11')]==='out'&&!_0x162676[_0x0097('0x1c')]){var _0x3c2904;_0x3ab719['WhatsappAccount'][_0x0097('0x1d')]({'where':{'id':_0x162676[_0x0097('0x1e')]},'raw':!![]})[_0x0097('0x19')](function(_0x5b1cbd){_0x3c2904=_0x5b1cbd;if(_0x3c2904&&_0x3c2904[_0x0097('0x1f')]){switch(_0x3c2904[_0x0097('0x1f')]){case _0x0097('0x20'):var _0x5168dc=require(_0x0097('0x20'));if(_0x3c2904[_0x0097('0x21')]&&_0x3c2904['authToken']&&_0x3c2904['phone']){var _0x6e5bb0=new _0x5168dc(_0x3c2904[_0x0097('0x21')],_0x3c2904['authToken']);_0x6e5bb0[_0x0097('0x22')][_0x0097('0x23')]({'body':_0x162676[_0x0097('0xd')],'to':'whatsapp:'+_0x162676[_0x0097('0x24')],'from':_0x0097('0x25')+_0x3c2904[_0x0097('0x24')],'statusCallback':_0x3c2904[_0x0097('0x26')]+_0x0097('0x27')+_0x162676['id']+_0x0097('0x28')+_0x3c2904[_0x0097('0x29')]})[_0x0097('0x19')](function(_0x1ee304){if(_0x1ee304[_0x0097('0x2a')]){return _0x28b6c8['update']({'messageId':_0x1ee304['sid']});}})[_0x0097('0x2b')](function(_0x552d76){logger[_0x0097('0x1b')]('WhatsappMessage,\x20%s,\x20%s,\x20%s',_0x0097('0x2c'),'twilio',util[_0x0097('0x2d')](_0x552d76,{'showHidden':![],'depth':null}));});}else{logger[_0x0097('0x1b')](_0x0097('0x2e'),_0x0097('0x2c'),_0x0097('0x20'),_0x0097('0x2f'));}break;case'sinch':var _0x330c5c=_0x3c2904[_0x0097('0x21')];var _0xeaf625=_0x3c2904[_0x0097('0x30')];var _0x5c6ec9=_0x3c2904[_0x0097('0x31')]+_0x0097('0x32')+_0x330c5c+'/messages/';var _0x29457b={'to':[_0x162676[_0x0097('0x24')]],'message':{'type':'text','text':_0x162676[_0x0097('0xd')]}};var _0x22dad8={'method':'POST','uri':_0x5c6ec9,'headers':{'Authorization':'Bearer\x20'+_0xeaf625,'Content-Type':_0x0097('0x33')},'body':_0x29457b,'json':!![]};rp(_0x22dad8)[_0x0097('0x19')](function(_0x1e20d4){if(_0x1e20d4[_0x0097('0x34')][0x0][_0x0097('0x35')]){return _0x28b6c8[_0x0097('0x1a')]({'messageId':_0x1e20d4[_0x0097('0x34')][0x0]['message_id']});}})[_0x0097('0x2b')](function(_0x40bf2d){logger['err'](_0x0097('0x36'),_0x40bf2d);});break;}}})[_0x0097('0x37')](function(){_0x20c20e();});}else{_0x20c20e();}}},'charset':_0x0097('0x38'),'collate':_0x0097('0x39')});}; \ No newline at end of file +var _0x6f93=['statuses','message_id','catch','err','WhatsappMessage,\x20%s','finally','utf8mb4','utf8mb4_unicode_ci','lodash','util','../../config/logger','api','request-promise','rimraf','../../config/environment','./whatsappMessage.attributes','exports','define','whatsapp_messages','messageId','FULLTEXT','direction','toLowerCase','out','secret','isNil','UserId','WhatsappInteraction','findOne','WhatsappInteractionId','then','update','createdAt','error','WhatsappAccount','find','type','twilio','accountSid','authToken','phone','messages','create','body','whatsapp:','remote','/api/whatsapp/messages/','/status?token=','sid','afterCreate','Missing\x20parameters:\x20phone,\x20accountSid\x20or\x20authToken','sinch','baseUrl','/messages/','text','POST','application/json'];(function(_0x28f00a,_0x2f8daa){var _0xf27eb7=function(_0x755918){while(--_0x755918){_0x28f00a['push'](_0x28f00a['shift']());}};_0xf27eb7(++_0x2f8daa);}(_0x6f93,0xb3));var _0x36f9=function(_0x4656fb,_0x3e5507){_0x4656fb=_0x4656fb-0x0;var _0x16b9ac=_0x6f93[_0x4656fb];return _0x16b9ac;};'use strict';var _=require(_0x36f9('0x0'));var util=require(_0x36f9('0x1'));var logger=require(_0x36f9('0x2'))(_0x36f9('0x3'));var moment=require('moment');var BPromise=require('bluebird');var rp=require(_0x36f9('0x4'));var fetch=require('node-fetch');var fs=require('fs');var path=require('path');var rimraf=require(_0x36f9('0x5'));var config=require(_0x36f9('0x6'));var attributes=require(_0x36f9('0x7'));module[_0x36f9('0x8')]=function(_0x5f218c,_0x59ffc0){return _0x5f218c[_0x36f9('0x9')]('WhatsappMessage',attributes,{'tableName':_0x36f9('0xa'),'paranoid':![],'indexes':[{'name':_0x36f9('0xb'),'fields':[_0x36f9('0xb')]},{'name':'fti_whatsapp_messages','fields':['body'],'type':_0x36f9('0xc')}],'timestamps':!![],'hooks':{'afterCreate':function(_0x466f5d,_0x6a1fcf,_0x42437a){var _0x3580ed=_0x5f218c['models'];var _0x5cc29a=_0x466f5d['get']({'plain':!![]});if(_0x5cc29a[_0x36f9('0xd')][_0x36f9('0xe')]()==='in'||_0x5cc29a['direction'][_0x36f9('0xe')]()===_0x36f9('0xf')&&!_0x5cc29a[_0x36f9('0x10')]&&!_[_0x36f9('0x11')](_0x5cc29a[_0x36f9('0x12')])){_0x3580ed[_0x36f9('0x13')][_0x36f9('0x14')]({'where':{'id':_0x5cc29a[_0x36f9('0x15')]}})[_0x36f9('0x16')](function(_0x428569){if(_0x428569){_0x428569[_0x36f9('0x17')]({'lastMsgAt':_0x5cc29a[_0x36f9('0x18')],'lastMsgDirection':_0x5cc29a['direction'][_0x36f9('0xe')]()});}})['catch'](function(_0x1cb856){console[_0x36f9('0x19')](_0x1cb856);});}if(_0x5cc29a[_0x36f9('0xd')]===_0x36f9('0xf')&&!_0x5cc29a['secret']){var _0x2b36b9;_0x3580ed[_0x36f9('0x1a')][_0x36f9('0x1b')]({'where':{'id':_0x5cc29a['WhatsappAccountId']},'raw':!![]})[_0x36f9('0x16')](function(_0x4d79fa){_0x2b36b9=_0x4d79fa;if(_0x2b36b9&&_0x2b36b9[_0x36f9('0x1c')]){switch(_0x2b36b9['type']){case _0x36f9('0x1d'):var _0x2021e8=require('twilio');if(_0x2b36b9[_0x36f9('0x1e')]&&_0x2b36b9[_0x36f9('0x1f')]&&_0x2b36b9[_0x36f9('0x20')]){var _0x4c3fbf=new _0x2021e8(_0x2b36b9[_0x36f9('0x1e')],_0x2b36b9['authToken']);_0x4c3fbf[_0x36f9('0x21')][_0x36f9('0x22')]({'body':_0x5cc29a[_0x36f9('0x23')],'to':_0x36f9('0x24')+_0x5cc29a[_0x36f9('0x20')],'from':_0x36f9('0x24')+_0x2b36b9[_0x36f9('0x20')],'statusCallback':_0x2b36b9[_0x36f9('0x25')]+_0x36f9('0x26')+_0x5cc29a['id']+_0x36f9('0x27')+_0x2b36b9['token']})[_0x36f9('0x16')](function(_0x2cdb7e){if(_0x2cdb7e[_0x36f9('0x28')]){return _0x466f5d[_0x36f9('0x17')]({'messageId':_0x2cdb7e[_0x36f9('0x28')]});}})['catch'](function(_0x598573){logger['error']('WhatsappMessage,\x20%s,\x20%s,\x20%s',_0x36f9('0x29'),_0x36f9('0x1d'),util['inspect'](_0x598573,{'showHidden':![],'depth':null}));});}else{logger[_0x36f9('0x19')]('WhatsappMessage,\x20%s,\x20%s,\x20%s',_0x36f9('0x29'),'twilio',_0x36f9('0x2a'));}break;case _0x36f9('0x2b'):var _0x8052ec=_0x2b36b9[_0x36f9('0x1e')];var _0x3c7a80=_0x2b36b9[_0x36f9('0x1f')];var _0x5bb989=_0x2b36b9[_0x36f9('0x2c')]+'/whatsapp/v1/'+_0x8052ec+_0x36f9('0x2d');var _0x134fa3={'to':[_0x5cc29a[_0x36f9('0x20')]],'message':{'type':_0x36f9('0x2e'),'text':_0x5cc29a[_0x36f9('0x23')]}};var _0x4e3b22={'method':_0x36f9('0x2f'),'uri':_0x5bb989,'headers':{'Authorization':'Bearer\x20'+_0x3c7a80,'Content-Type':_0x36f9('0x30')},'body':_0x134fa3,'json':!![]};rp(_0x4e3b22)[_0x36f9('0x16')](function(_0x53432d){if(_0x53432d[_0x36f9('0x31')][0x0][_0x36f9('0x32')]){return _0x466f5d[_0x36f9('0x17')]({'messageId':_0x53432d[_0x36f9('0x31')][0x0][_0x36f9('0x32')]});}})[_0x36f9('0x33')](function(_0x3e1990){logger[_0x36f9('0x34')](_0x36f9('0x35'),_0x3e1990);});break;}}})[_0x36f9('0x36')](function(){_0x42437a();});}else{_0x42437a();}}},'charset':_0x36f9('0x37'),'collate':_0x36f9('0x38')});}; \ No newline at end of file diff --git a/server/api/whatsappMessage/whatsappMessage.rpc.js b/server/api/whatsappMessage/whatsappMessage.rpc.js index 3e2ee27..1aa6f2a 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 _0x3e3a=['moment','randomstring','../../mysqldb','../../config/logger','../../config/environment','client','http','redis','defaults','socket.io-emitter','./whatsappMessage.socket','register','request','then','info','debug','WhatsappMessage,\x20%s,\x20%s,\x20%s','request\x20sent','stringify','error','code','message','WhatsappMessage,\x20%s,\x20%s','result','catch','CreateWhatsappMessage','WhatsappMessage','create','body','options','raw','lodash','util'];(function(_0x1ccb0d,_0xeadc5d){var _0x247222=function(_0x55890f){while(--_0x55890f){_0x1ccb0d['push'](_0x1ccb0d['shift']());}};_0x247222(++_0xeadc5d);}(_0x3e3a,0x1cc));var _0xa3e3=function(_0x4b369d,_0x265eb8){_0x4b369d=_0x4b369d-0x0;var _0x571a98=_0x3e3a[_0x4b369d];return _0x571a98;};'use strict';var _=require(_0xa3e3('0x0'));var util=require(_0xa3e3('0x1'));var moment=require(_0xa3e3('0x2'));var BPromise=require('bluebird');var rs=require(_0xa3e3('0x3'));var fs=require('fs');var Redis=require('ioredis');var db=require(_0xa3e3('0x4'))['db'];var utils=require('../../config/utils');var logger=require(_0xa3e3('0x5'))('rpc');var config=require(_0xa3e3('0x6'));var jayson=require('jayson/promise');var client=jayson[_0xa3e3('0x7')][_0xa3e3('0x8')]({'port':0x232a});config[_0xa3e3('0x9')]=_[_0xa3e3('0xa')](config['redis'],{'host':'localhost','port':0x18eb});var socket=require(_0xa3e3('0xb'))(new Redis(config[_0xa3e3('0x9')]));require(_0xa3e3('0xc'))[_0xa3e3('0xd')](socket);function respondWithRpcPromise(_0x1c4210,_0x11da61,_0x4d35e6){return new BPromise(function(_0x4fc550,_0x57df0a){return client[_0xa3e3('0xe')](_0x1c4210,_0x4d35e6)[_0xa3e3('0xf')](function(_0x3c8bf8){logger[_0xa3e3('0x10')]('WhatsappMessage,\x20%s,\x20%s',_0x11da61,'request\x20sent');logger[_0xa3e3('0x11')](_0xa3e3('0x12'),_0x11da61,_0xa3e3('0x13'),JSON[_0xa3e3('0x14')](_0x3c8bf8));if(_0x3c8bf8[_0xa3e3('0x15')]){if(_0x3c8bf8['error'][_0xa3e3('0x16')]===0x1f4){logger['error']('WhatsappMessage,\x20%s,\x20%s',_0x11da61,_0x3c8bf8[_0xa3e3('0x15')][_0xa3e3('0x17')]);return _0x57df0a(_0x3c8bf8[_0xa3e3('0x15')][_0xa3e3('0x17')]);}logger['error'](_0xa3e3('0x18'),_0x11da61,_0x3c8bf8['error'][_0xa3e3('0x17')]);return _0x4fc550(_0x3c8bf8[_0xa3e3('0x15')][_0xa3e3('0x17')]);}else{logger[_0xa3e3('0x10')](_0xa3e3('0x18'),_0x11da61,_0xa3e3('0x13'));_0x4fc550(_0x3c8bf8[_0xa3e3('0x19')][_0xa3e3('0x17')]);}})[_0xa3e3('0x1a')](function(_0xba774f){logger[_0xa3e3('0x15')](_0xa3e3('0x18'),_0x11da61,_0xba774f);_0x57df0a(_0xba774f);});});}exports[_0xa3e3('0x1b')]=function(_0x2d0c06){var _0x5259e9=this;return new Promise(function(_0x42078e,_0x47646f){return db[_0xa3e3('0x1c')][_0xa3e3('0x1d')](_0x2d0c06[_0xa3e3('0x1e')],{'raw':_0x2d0c06['options']?_0x2d0c06[_0xa3e3('0x1f')][_0xa3e3('0x20')]===undefined?!![]:![]:!![]})[_0xa3e3('0xf')](function(_0x8dfccc){logger[_0xa3e3('0x10')](_0xa3e3('0x1b'),_0x2d0c06);logger['debug'](_0xa3e3('0x1b'),_0x2d0c06,JSON[_0xa3e3('0x14')](_0x8dfccc));_0x42078e(_0x8dfccc);})[_0xa3e3('0x1a')](function(_0x4b5834){logger[_0xa3e3('0x15')](_0xa3e3('0x1b'),_0x4b5834['message'],_0x2d0c06);_0x47646f(_0x5259e9['error'](0x1f4,_0x4b5834['message']));});});}; \ No newline at end of file +var _0x55dc=['then','info','WhatsappMessage,\x20%s,\x20%s','request\x20sent','debug','WhatsappMessage,\x20%s,\x20%s,\x20%s','stringify','error','message','catch','CreateWhatsappMessage','WhatsappMessage','create','body','options','raw','lodash','util','moment','randomstring','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','http','redis','defaults','localhost','./whatsappMessage.socket','register','request'];(function(_0x216e34,_0x34e5c3){var _0x36217b=function(_0x32bc56){while(--_0x32bc56){_0x216e34['push'](_0x216e34['shift']());}};_0x36217b(++_0x34e5c3);}(_0x55dc,0xb5));var _0xc55d=function(_0x18a0ef,_0x2ea8cf){_0x18a0ef=_0x18a0ef-0x0;var _0x57300b=_0x55dc[_0x18a0ef];return _0x57300b;};'use strict';var _=require(_0xc55d('0x0'));var util=require(_0xc55d('0x1'));var moment=require(_0xc55d('0x2'));var BPromise=require('bluebird');var rs=require(_0xc55d('0x3'));var fs=require('fs');var Redis=require('ioredis');var db=require(_0xc55d('0x4'))['db'];var utils=require(_0xc55d('0x5'));var logger=require(_0xc55d('0x6'))(_0xc55d('0x7'));var config=require(_0xc55d('0x8'));var jayson=require(_0xc55d('0x9'));var client=jayson['client'][_0xc55d('0xa')]({'port':0x232a});config[_0xc55d('0xb')]=_[_0xc55d('0xc')](config[_0xc55d('0xb')],{'host':_0xc55d('0xd'),'port':0x18eb});var socket=require('socket.io-emitter')(new Redis(config[_0xc55d('0xb')]));require(_0xc55d('0xe'))[_0xc55d('0xf')](socket);function respondWithRpcPromise(_0x382be2,_0x15d30b,_0xd77e16){return new BPromise(function(_0x4e2369,_0x4d2991){return client[_0xc55d('0x10')](_0x382be2,_0xd77e16)[_0xc55d('0x11')](function(_0x4d1792){logger[_0xc55d('0x12')](_0xc55d('0x13'),_0x15d30b,_0xc55d('0x14'));logger[_0xc55d('0x15')](_0xc55d('0x16'),_0x15d30b,'request\x20sent',JSON[_0xc55d('0x17')](_0x4d1792));if(_0x4d1792[_0xc55d('0x18')]){if(_0x4d1792[_0xc55d('0x18')]['code']===0x1f4){logger[_0xc55d('0x18')]('WhatsappMessage,\x20%s,\x20%s',_0x15d30b,_0x4d1792[_0xc55d('0x18')][_0xc55d('0x19')]);return _0x4d2991(_0x4d1792[_0xc55d('0x18')][_0xc55d('0x19')]);}logger[_0xc55d('0x18')](_0xc55d('0x13'),_0x15d30b,_0x4d1792[_0xc55d('0x18')][_0xc55d('0x19')]);return _0x4e2369(_0x4d1792[_0xc55d('0x18')][_0xc55d('0x19')]);}else{logger[_0xc55d('0x12')](_0xc55d('0x13'),_0x15d30b,_0xc55d('0x14'));_0x4e2369(_0x4d1792['result'][_0xc55d('0x19')]);}})[_0xc55d('0x1a')](function(_0x3a5a15){logger[_0xc55d('0x18')](_0xc55d('0x13'),_0x15d30b,_0x3a5a15);_0x4d2991(_0x3a5a15);});});}exports[_0xc55d('0x1b')]=function(_0x1122be){var _0x223b6b=this;return new Promise(function(_0x464008,_0x1e9f53){return db[_0xc55d('0x1c')][_0xc55d('0x1d')](_0x1122be[_0xc55d('0x1e')],{'raw':_0x1122be['options']?_0x1122be[_0xc55d('0x1f')][_0xc55d('0x20')]===undefined?!![]:![]:!![]})['then'](function(_0x247b2d){logger[_0xc55d('0x12')](_0xc55d('0x1b'),_0x1122be);logger[_0xc55d('0x15')](_0xc55d('0x1b'),_0x1122be,JSON['stringify'](_0x247b2d));_0x464008(_0x247b2d);})['catch'](function(_0x547cf0){logger[_0xc55d('0x18')]('CreateWhatsappMessage',_0x547cf0[_0xc55d('0x19')],_0x1122be);_0x1e9f53(_0x223b6b[_0xc55d('0x18')](0x1f4,_0x547cf0[_0xc55d('0x19')]));});});}; \ No newline at end of file diff --git a/server/api/whatsappMessage/whatsappMessage.socket.js b/server/api/whatsappMessage/whatsappMessage.socket.js index 2809ac7..470d89d 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 _0x4f3f=['emit','removeListener','register','./whatsappMessage.events','save','remove','update'];(function(_0x10577f,_0x3cdeaf){var _0x4b9c9f=function(_0x16cdce){while(--_0x16cdce){_0x10577f['push'](_0x10577f['shift']());}};_0x4b9c9f(++_0x3cdeaf);}(_0x4f3f,0x137));var _0xf4f3=function(_0x35dd9d,_0x3ae3aa){_0x35dd9d=_0x35dd9d-0x0;var _0x54f5ea=_0x4f3f[_0x35dd9d];return _0x54f5ea;};'use strict';var WhatsappMessageEvents=require(_0xf4f3('0x0'));var events=[_0xf4f3('0x1'),_0xf4f3('0x2'),_0xf4f3('0x3')];function createListener(_0x14c4dd,_0x3e109d){return function(_0x2d5010){_0x3e109d[_0xf4f3('0x4')](_0x14c4dd,_0x2d5010);};}function removeListener(_0x506b0c,_0x297fa4){return function(){WhatsappMessageEvents[_0xf4f3('0x5')](_0x506b0c,_0x297fa4);};}exports[_0xf4f3('0x6')]=function(_0x375fc8){for(var _0x58732c=0x0,_0x89b832=events['length'];_0x58732c<_0x89b832;_0x58732c++){var _0x17585b=events[_0x58732c];var _0x173984=createListener('whatsappMessage:'+_0x17585b,_0x375fc8);WhatsappMessageEvents['on'](_0x17585b,_0x173984);}}; \ No newline at end of file +var _0x8623=['length','whatsappMessage:','./whatsappMessage.events','save','update','emit'];(function(_0x1afa30,_0xc036d5){var _0x45e4e6=function(_0x10c0ba){while(--_0x10c0ba){_0x1afa30['push'](_0x1afa30['shift']());}};_0x45e4e6(++_0xc036d5);}(_0x8623,0x80));var _0x3862=function(_0x30309e,_0x32cc9f){_0x30309e=_0x30309e-0x0;var _0x305081=_0x8623[_0x30309e];return _0x305081;};'use strict';var WhatsappMessageEvents=require(_0x3862('0x0'));var events=[_0x3862('0x1'),'remove',_0x3862('0x2')];function createListener(_0x520a2e,_0x4560cb){return function(_0x3a0fe5){_0x4560cb[_0x3862('0x3')](_0x520a2e,_0x3a0fe5);};}function removeListener(_0xbcb9c7,_0x45214a){return function(){WhatsappMessageEvents['removeListener'](_0xbcb9c7,_0x45214a);};}exports['register']=function(_0x5baa87){for(var _0xb281fb=0x0,_0xbbc07c=events[_0x3862('0x4')];_0xb281fb<_0xbbc07c;_0xb281fb++){var _0x4c7f19=events[_0xb281fb];var _0x36a883=createListener(_0x3862('0x5')+_0x4c7f19,_0x5baa87);WhatsappMessageEvents['on'](_0x4c7f19,_0x36a883);}}; \ No newline at end of file diff --git a/server/api/whatsappQueue/index.js b/server/api/whatsappQueue/index.js index 569d2a7..23d6a01 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 _0x8e04=['util','path','Router','../../components/auth/service','../../components/interaction/service','../../config/environment','./whatsappQueue.controller','get','isAuthenticated','index','/describe','/:id','show','/:id/members','getMembers','/:id/teams','getTeams','/:id/users','getAgents','post','create','put','update','destroy','delete','removeTeams','removeAgents','multer'];(function(_0x2e7147,_0x1369d8){var _0x4f203d=function(_0x1afe24){while(--_0x1afe24){_0x2e7147['push'](_0x2e7147['shift']());}};_0x4f203d(++_0x1369d8);}(_0x8e04,0x117));var _0x48e0=function(_0xe155f0,_0x2989c8){_0xe155f0=_0xe155f0-0x0;var _0x453005=_0x8e04[_0xe155f0];return _0x453005;};'use strict';var multer=require(_0x48e0('0x0'));var util=require(_0x48e0('0x1'));var path=require(_0x48e0('0x2'));var timeout=require('connect-timeout');var express=require('express');var router=express[_0x48e0('0x3')]();var fs_extra=require('fs-extra');var auth=require(_0x48e0('0x4'));var interaction=require(_0x48e0('0x5'));var config=require(_0x48e0('0x6'));var controller=require(_0x48e0('0x7'));router[_0x48e0('0x8')]('/',auth[_0x48e0('0x9')](),controller[_0x48e0('0xa')]);router[_0x48e0('0x8')](_0x48e0('0xb'),auth[_0x48e0('0x9')](),controller['describe']);router[_0x48e0('0x8')](_0x48e0('0xc'),auth[_0x48e0('0x9')](),controller[_0x48e0('0xd')]);router['get'](_0x48e0('0xe'),auth['isAuthenticated'](),controller[_0x48e0('0xf')]);router[_0x48e0('0x8')](_0x48e0('0x10'),auth['isAuthenticated'](),controller[_0x48e0('0x11')]);router['get'](_0x48e0('0x12'),auth[_0x48e0('0x9')](),controller[_0x48e0('0x13')]);router[_0x48e0('0x14')]('/',auth[_0x48e0('0x9')](),controller[_0x48e0('0x15')]);router[_0x48e0('0x14')]('/:id/teams',auth[_0x48e0('0x9')](),controller['addTeams']);router[_0x48e0('0x14')](_0x48e0('0x12'),auth['isAuthenticated'](),controller['addAgents']);router[_0x48e0('0x16')](_0x48e0('0xc'),auth['isAuthenticated'](),controller[_0x48e0('0x17')]);router['delete'](_0x48e0('0xc'),auth[_0x48e0('0x9')](),controller[_0x48e0('0x18')]);router[_0x48e0('0x19')]('/:id/teams',auth[_0x48e0('0x9')](),controller[_0x48e0('0x1a')]);router[_0x48e0('0x19')](_0x48e0('0x12'),auth['isAuthenticated'](),controller[_0x48e0('0x1b')]);module['exports']=router; \ No newline at end of file +var _0x1065=['addAgents','put','/:id','update','delete','destroy','removeTeams','removeAgents','exports','util','connect-timeout','express','Router','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','./whatsappQueue.controller','isAuthenticated','index','get','/describe','describe','show','/:id/members','/:id/teams','getTeams','/:id/users','getAgents','create','post'];(function(_0x96be88,_0x2c01a4){var _0x1c14c0=function(_0x20aeff){while(--_0x20aeff){_0x96be88['push'](_0x96be88['shift']());}};_0x1c14c0(++_0x2c01a4);}(_0x1065,0x15e));var _0x5106=function(_0x641f18,_0x2919e8){_0x641f18=_0x641f18-0x0;var _0x16eefe=_0x1065[_0x641f18];return _0x16eefe;};'use strict';var multer=require('multer');var util=require(_0x5106('0x0'));var path=require('path');var timeout=require(_0x5106('0x1'));var express=require(_0x5106('0x2'));var router=express[_0x5106('0x3')]();var fs_extra=require(_0x5106('0x4'));var auth=require(_0x5106('0x5'));var interaction=require(_0x5106('0x6'));var config=require(_0x5106('0x7'));var controller=require(_0x5106('0x8'));router['get']('/',auth[_0x5106('0x9')](),controller[_0x5106('0xa')]);router[_0x5106('0xb')](_0x5106('0xc'),auth[_0x5106('0x9')](),controller[_0x5106('0xd')]);router['get']('/:id',auth[_0x5106('0x9')](),controller[_0x5106('0xe')]);router[_0x5106('0xb')](_0x5106('0xf'),auth[_0x5106('0x9')](),controller['getMembers']);router['get'](_0x5106('0x10'),auth[_0x5106('0x9')](),controller[_0x5106('0x11')]);router[_0x5106('0xb')](_0x5106('0x12'),auth[_0x5106('0x9')](),controller[_0x5106('0x13')]);router['post']('/',auth['isAuthenticated'](),controller[_0x5106('0x14')]);router[_0x5106('0x15')](_0x5106('0x10'),auth['isAuthenticated'](),controller['addTeams']);router[_0x5106('0x15')](_0x5106('0x12'),auth['isAuthenticated'](),controller[_0x5106('0x16')]);router[_0x5106('0x17')](_0x5106('0x18'),auth[_0x5106('0x9')](),controller[_0x5106('0x19')]);router[_0x5106('0x1a')](_0x5106('0x18'),auth[_0x5106('0x9')](),controller[_0x5106('0x1b')]);router[_0x5106('0x1a')]('/:id/teams',auth[_0x5106('0x9')](),controller[_0x5106('0x1c')]);router[_0x5106('0x1a')](_0x5106('0x12'),auth['isAuthenticated'](),controller[_0x5106('0x1d')]);module[_0x5106('0x1e')]=router; \ No newline at end of file diff --git a/server/api/whatsappQueue/whatsappQueue.attributes.js b/server/api/whatsappQueue/whatsappQueue.attributes.js index 3f4f11b..4352e79 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 _0xa1fd=['roundrobin','sequelize','exports','STRING','name','ENUM','rrmemory','beepall'];(function(_0x158f01,_0x12af3e){var _0x5ef74e=function(_0x5e7adc){while(--_0x5e7adc){_0x158f01['push'](_0x158f01['shift']());}};_0x5ef74e(++_0x12af3e);}(_0xa1fd,0x1b9));var _0xda1f=function(_0x55fa03,_0xcb96c2){_0x55fa03=_0x55fa03-0x0;var _0x2cd7cd=_0xa1fd[_0x55fa03];return _0x2cd7cd;};'use strict';var Sequelize=require(_0xda1f('0x0'));module[_0xda1f('0x1')]={'name':{'type':Sequelize[_0xda1f('0x2')],'unique':_0xda1f('0x3'),'validate':{'notEmpty':!![],'is':/^[A-Za-z0-9\.\_]+$/i}},'timeout':{'type':Sequelize['INTEGER'],'validate':{'min':0x1,'max':0x20c49b}},'strategy':{'type':Sequelize[_0xda1f('0x4')](_0xda1f('0x5'),_0xda1f('0x6'),_0xda1f('0x7'))},'description':{'type':Sequelize[_0xda1f('0x2')]}}; \ No newline at end of file +var _0x1fdc=['rrmemory','beepall','roundrobin','STRING','sequelize','exports','name','INTEGER','ENUM'];(function(_0x3bf348,_0x3ea4bc){var _0xbe3d06=function(_0x401bf1){while(--_0x401bf1){_0x3bf348['push'](_0x3bf348['shift']());}};_0xbe3d06(++_0x3ea4bc);}(_0x1fdc,0x8b));var _0xc1fd=function(_0x1943d9,_0x245bb8){_0x1943d9=_0x1943d9-0x0;var _0x4b4f3f=_0x1fdc[_0x1943d9];return _0x4b4f3f;};'use strict';var Sequelize=require(_0xc1fd('0x0'));module[_0xc1fd('0x1')]={'name':{'type':Sequelize['STRING'],'unique':_0xc1fd('0x2'),'validate':{'notEmpty':!![],'is':/^[A-Za-z0-9\.\_]+$/i}},'timeout':{'type':Sequelize[_0xc1fd('0x3')],'validate':{'min':0x1,'max':0x20c49b}},'strategy':{'type':Sequelize[_0xc1fd('0x4')](_0xc1fd('0x5'),_0xc1fd('0x6'),_0xc1fd('0x7'))},'description':{'type':Sequelize[_0xc1fd('0x8')]}}; \ No newline at end of file diff --git a/server/api/whatsappQueue/whatsappQueue.controller.js b/server/api/whatsappQueue/whatsappQueue.controller.js index 4c89277..f612744 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 _0x1582=['model','keys','filters','intersection','fields','attributes','length','includeAll','merge','options','find','create','user','Unable\x20to\x20retrieve\x20the\x20current\x20user','userProfileId','UserProfileResource','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','update','body','params','describe','findOne','hasOwnProperty','nolimit','limit','sort','pick','where','WhatsappQueueId','filter','map','UserWhatsappQueue','findAll','User','findAndCountAll','UserId','agent','whatsappPause','updatedAt','createdAt','%s/%s','SIP','getTeams','Team','addTeams','Agents','online','voicePause','flatMap','sequelize','transaction','findOrCreate','emit','userWhatsappQueue:save','ids','select','field','tq.TeamId','from','team_has_whatsapp_queues','join','user_has_teams','WhatsappQueueId\x20=\x20?','ut.UserId\x20=\x20?','push','toString','QueryTypes','SELECT','every','TeamId','all','compact','value','removeTeams','isEmpty','forEach','userWhatsappQueue:remove','addAgents','omit','spread','removeAgents','isArray','getAgents','order','util','lodash','ioredis','../../components/parsers/qs','../../config/logger','api','../../mysqldb','defaults','redis','localhost','./whatsappQueue.socket','register','status','end','json','offset','undefined','count','then','destroy','get','WhatsappQueues','sendStatus','error','name','send','index','WhatsappQueue','rawAttributes','key','getOptions','include','query','rows','catch','show'];(function(_0xa388a2,_0x40bde6){var _0x7ce7f6=function(_0x5a242a){while(--_0x5a242a){_0xa388a2['push'](_0xa388a2['shift']());}};_0x7ce7f6(++_0x40bde6);}(_0x1582,0x144));var _0x2158=function(_0xac3328,_0x23745a){_0xac3328=_0xac3328-0x0;var _0x33aec4=_0x1582[_0xac3328];return _0x33aec4;};'use strict';var BPromise=require('bluebird');var util=require(_0x2158('0x0'));var _=require(_0x2158('0x1'));var squel=require('squel');var Redis=require(_0x2158('0x2'));var qs=require(_0x2158('0x3'));var logger=require(_0x2158('0x4'))(_0x2158('0x5'));var config=require('../../config/environment');var db=require(_0x2158('0x6'))['db'];config['redis']=_[_0x2158('0x7')](config[_0x2158('0x8')],{'host':_0x2158('0x9'),'port':0x18eb});var socket=require('socket.io-emitter')(new Redis(config[_0x2158('0x8')]));require(_0x2158('0xa'))[_0x2158('0xb')](socket);function respondWithStatusCode(_0x23df90,_0x259cfe){_0x259cfe=_0x259cfe||0xcc;return function(_0x5a6d6b){if(_0x5a6d6b){return _0x23df90['sendStatus'](_0x259cfe);}return _0x23df90[_0x2158('0xc')](_0x259cfe)[_0x2158('0xd')]();};}function respondWithResult(_0x4cfb2d,_0x51b050){_0x51b050=_0x51b050||0xc8;return function(_0x2d2452){if(_0x2d2452){return _0x4cfb2d[_0x2158('0xc')](_0x51b050)[_0x2158('0xe')](_0x2d2452);}};}function respondWithFilteredResult(_0x195cb3,_0x2b2316){return function(_0x2e91cd){if(_0x2e91cd){var _0x188561=typeof _0x2b2316[_0x2158('0xf')]===_0x2158('0x10')&&typeof _0x2b2316['limit']===_0x2158('0x10');var _0x4c394c=_0x2e91cd[_0x2158('0x11')];var _0x4cd2b3=_0x188561?0x0:_0x2b2316[_0x2158('0xf')];var _0x383e38=_0x188561?_0x2e91cd[_0x2158('0x11')]:_0x2b2316[_0x2158('0xf')]+_0x2b2316['limit'];var _0x2e37b9;if(_0x383e38>=_0x4c394c){_0x383e38=_0x4c394c;_0x2e37b9=0xc8;}else{_0x2e37b9=0xce;}_0x195cb3['status'](_0x2e37b9);return _0x195cb3['set']('Content-Range',_0x4cd2b3+'-'+_0x383e38+'/'+_0x4c394c)[_0x2158('0xe')](_0x2e91cd);}return null;};}function saveUpdates(_0x2151d9){return function(_0x1886b2){if(_0x1886b2){return _0x1886b2['update'](_0x2151d9)[_0x2158('0x12')](function(_0x1108e5){return _0x1108e5;});}return null;};}function removeEntity(_0x1325df){return function(_0x25d4e8){if(_0x25d4e8){return _0x25d4e8[_0x2158('0x13')]()['then'](function(){var _0x28b5ea=_0x25d4e8[_0x2158('0x14')]({'plain':!![]});var _0x3ef071=_0x2158('0x15');return db['UserProfileResource']['destroy']({'where':{'type':_0x3ef071,'resourceId':_0x28b5ea['id']}})['then'](function(){return _0x25d4e8;});})[_0x2158('0x12')](function(){_0x1325df['status'](0xcc)[_0x2158('0xd')]();});}};}function handleEntityNotFound(_0x142188){return function(_0x159669){if(!_0x159669){_0x142188[_0x2158('0x16')](0x194);}return _0x159669;};}function handleError(_0x356d3d,_0x124baf){_0x124baf=_0x124baf||0x1f4;return function(_0x429276){logger[_0x2158('0x17')](_0x429276['stack']);if(_0x429276[_0x2158('0x18')]){delete _0x429276[_0x2158('0x18')];}_0x356d3d[_0x2158('0xc')](_0x124baf)[_0x2158('0x19')](_0x429276);};}exports[_0x2158('0x1a')]=function(_0x2a4952,_0x2e496a){var _0x595cc7={};var _0x4a4d45={'count':0x0,'rows':[]};var _0x444cbb=_['map'](db[_0x2158('0x1b')][_0x2158('0x1c')],function(_0xbaafd3){return{'name':_0xbaafd3['fieldName'],'type':_0xbaafd3['type'][_0x2158('0x1d')]};});_0x595cc7=qs[_0x2158('0x1e')](_0x444cbb,_0x2a4952);var _0x36661a={'where':_0x595cc7['where']};return db[_0x2158('0x1b')][_0x2158('0x11')](_0x36661a)[_0x2158('0x12')](function(_0x46aa70){_0x4a4d45[_0x2158('0x11')]=_0x46aa70;_0x595cc7[_0x2158('0x1f')]=qs[_0x2158('0x1f')](_0x2a4952[_0x2158('0x20')]);return db[_0x2158('0x1b')]['findAll'](_0x595cc7);})[_0x2158('0x12')](function(_0x1fbc07){_0x4a4d45[_0x2158('0x21')]=_0x1fbc07;return _0x4a4d45;})[_0x2158('0x12')](respondWithFilteredResult(_0x2e496a,_0x595cc7))[_0x2158('0x22')](handleError(_0x2e496a,null));};exports[_0x2158('0x23')]=function(_0x4753dd,_0x1a625d){var _0xf59c69={'raw':!![],'where':{'id':_0x4753dd['params']['id']}},_0x2e3cd8={};_0x2e3cd8[_0x2158('0x24')]=_[_0x2158('0x25')](db[_0x2158('0x1b')][_0x2158('0x1c')]);_0x2e3cd8[_0x2158('0x20')]=_[_0x2158('0x25')](_0x4753dd[_0x2158('0x20')]);_0x2e3cd8[_0x2158('0x26')]=_['intersection'](_0x2e3cd8['model'],_0x2e3cd8[_0x2158('0x20')]);_0xf59c69['attributes']=_[_0x2158('0x27')](_0x2e3cd8[_0x2158('0x24')],qs[_0x2158('0x28')](_0x4753dd[_0x2158('0x20')][_0x2158('0x28')]));_0xf59c69[_0x2158('0x29')]=_0xf59c69[_0x2158('0x29')][_0x2158('0x2a')]?_0xf59c69['attributes']:_0x2e3cd8[_0x2158('0x24')];if(_0x4753dd[_0x2158('0x20')][_0x2158('0x2b')]){_0xf59c69[_0x2158('0x1f')]=[{'all':!![]}];}_0xf59c69=_[_0x2158('0x2c')]({},_0xf59c69,_0x4753dd[_0x2158('0x2d')]);return db['WhatsappQueue'][_0x2158('0x2e')](_0xf59c69)[_0x2158('0x12')](handleEntityNotFound(_0x1a625d,null))[_0x2158('0x12')](respondWithResult(_0x1a625d,null))[_0x2158('0x22')](handleError(_0x1a625d,null));};exports[_0x2158('0x2f')]=function(_0x3f28a1,_0x5c3a00){return db[_0x2158('0x1b')][_0x2158('0x2f')](_0x3f28a1['body'],{})[_0x2158('0x12')](function(_0x3822a2){var _0x36e2b8=_0x3f28a1[_0x2158('0x30')][_0x2158('0x14')]({'plain':!![]});if(!_0x36e2b8)throw new Error(_0x2158('0x31'));if(_0x36e2b8['role']===_0x2158('0x30')){var _0x3c70e9=_0x3822a2['get']({'plain':!![]});var _0x26c717=_0x2158('0x15');return db['UserProfileSection'][_0x2158('0x2e')]({'where':{'name':_0x26c717,'userProfileId':_0x36e2b8[_0x2158('0x32')]},'raw':!![]})['then'](function(_0x2f7115){if(_0x2f7115&&_0x2f7115['autoAssociation']===0x0){return db[_0x2158('0x33')]['create']({'name':_0x3c70e9[_0x2158('0x18')],'resourceId':_0x3c70e9['id'],'type':_0x2f7115[_0x2158('0x18')],'sectionId':_0x2f7115['id']},{})[_0x2158('0x12')](function(){return _0x3822a2;});}else{return _0x3822a2;}})[_0x2158('0x22')](function(_0x12214f){logger['error'](_0x2158('0x34'),_0x12214f);throw _0x12214f;});}return _0x3822a2;})[_0x2158('0x12')](respondWithResult(_0x5c3a00,0xc9))[_0x2158('0x22')](handleError(_0x5c3a00,null));};exports[_0x2158('0x35')]=function(_0x2f39ed,_0x85853c){if(_0x2f39ed[_0x2158('0x36')]['id']){delete _0x2f39ed[_0x2158('0x36')]['id'];}return db[_0x2158('0x1b')][_0x2158('0x2e')]({'where':{'id':_0x2f39ed[_0x2158('0x37')]['id']}})[_0x2158('0x12')](handleEntityNotFound(_0x85853c,null))[_0x2158('0x12')](saveUpdates(_0x2f39ed['body'],null))[_0x2158('0x12')](respondWithResult(_0x85853c,null))['catch'](handleError(_0x85853c,null));};exports[_0x2158('0x13')]=function(_0xdae2c8,_0x39f60c){return db['WhatsappQueue']['find']({'where':{'id':_0xdae2c8[_0x2158('0x37')]['id']}})[_0x2158('0x12')](handleEntityNotFound(_0x39f60c,null))[_0x2158('0x12')](removeEntity(_0x39f60c,null))[_0x2158('0x22')](handleError(_0x39f60c,null));};exports[_0x2158('0x38')]=function(_0x217c49,_0x381326){return db['WhatsappQueue']['describe']()[_0x2158('0x12')](respondWithResult(_0x381326,null))[_0x2158('0x22')](handleError(_0x381326,null));};exports['getMembers']=function(_0x15473b,_0x3b0f77){var _0x3cb5db={'raw':!![],'where':{}},_0x48d7fa={},_0x5bfb67;return db[_0x2158('0x1b')][_0x2158('0x39')]({'where':{'id':_0x15473b[_0x2158('0x37')]['id']}})[_0x2158('0x12')](handleEntityNotFound(_0x3b0f77,null))[_0x2158('0x12')](function(_0x542729){if(_0x542729){_0x5bfb67=_0x542729[_0x2158('0x14')]({'plain':!![]});_0x48d7fa[_0x2158('0x24')]=_[_0x2158('0x25')](db['UserWhatsappQueue']['rawAttributes']);_0x48d7fa[_0x2158('0x20')]=_['keys'](_0x15473b['query']);_0x48d7fa[_0x2158('0x26')]=_[_0x2158('0x27')](_0x48d7fa[_0x2158('0x24')],_0x48d7fa['query']);_0x3cb5db['attributes']=_['intersection'](_0x48d7fa[_0x2158('0x24')],qs[_0x2158('0x28')](_0x15473b[_0x2158('0x20')][_0x2158('0x28')]));_0x3cb5db['attributes']=_0x3cb5db[_0x2158('0x29')][_0x2158('0x2a')]?_0x3cb5db[_0x2158('0x29')]:_0x48d7fa[_0x2158('0x24')];if(!_0x15473b[_0x2158('0x20')][_0x2158('0x3a')](_0x2158('0x3b'))){_0x3cb5db['limit']=qs[_0x2158('0x3c')](_0x15473b['query'][_0x2158('0x3c')]);_0x3cb5db[_0x2158('0xf')]=qs['offset'](_0x15473b['query'][_0x2158('0xf')]);}_0x3cb5db['order']=qs[_0x2158('0x3d')](_0x15473b['query'][_0x2158('0x3d')]);_0x3cb5db['where']=qs[_0x2158('0x26')](_[_0x2158('0x3e')](_0x15473b['query'],_0x48d7fa['filters']));_0x3cb5db[_0x2158('0x3f')][_0x2158('0x40')]=_0x542729['id'];if(_0x15473b['query'][_0x2158('0x41')]){_0x3cb5db[_0x2158('0x3f')]=_[_0x2158('0x2c')](_0x3cb5db['where'],{'$or':_[_0x2158('0x42')](_0x3cb5db[_0x2158('0x29')],function(_0x37e037){var _0xda0eca={};_0xda0eca[_0x37e037]={'$like':'%'+_0x15473b[_0x2158('0x20')][_0x2158('0x41')]+'%'};return _0xda0eca;})});}_0x3cb5db=_[_0x2158('0x2c')]({},_0x3cb5db,_0x15473b['options']);return db[_0x2158('0x43')][_0x2158('0x44')](_0x3cb5db);}})[_0x2158('0x12')](function(_0x3cbf86){if(_0x3cbf86){return db[_0x2158('0x45')][_0x2158('0x46')]({'where':{'id':_[_0x2158('0x42')](_0x3cbf86,_0x2158('0x47')),'role':_0x2158('0x48')},'attributes':['id',_0x2158('0x18'),_0x2158('0x49'),_0x2158('0x4a'),_0x2158('0x4b')]});}})['then'](function(_0x87f14){if(_0x87f14){return{'count':_0x87f14[_0x2158('0x11')],'rows':_[_0x2158('0x42')](_0x87f14['rows'],function(_0x1661f2){return{'membername':_0x1661f2[_0x2158('0x18')],'UserId':_0x1661f2['id'],'queue_name':_0x5bfb67[_0x2158('0x18')],'WhatsappQueueId':_0x5bfb67['id'],'interface':util['format'](_0x2158('0x4c'),_0x2158('0x4d'),_0x1661f2[_0x2158('0x18')]),'penalty':0x0,'paused':_0x1661f2[_0x2158('0x49')],'createdAt':_0x1661f2[_0x2158('0x4b')],'updatedAt':_0x1661f2[_0x2158('0x4a')]};})};}else{return{'count':0x0,'rows':[]};}})[_0x2158('0x12')](respondWithFilteredResult(_0x3b0f77,_0x3cb5db))[_0x2158('0x22')](handleError(_0x3b0f77,null));};exports[_0x2158('0x4e')]=function(_0x2eef6b,_0x4b9b98){var _0x169a0e={};var _0x3a68bf={};var _0x1c8b39;var _0x1c296b;return db[_0x2158('0x1b')][_0x2158('0x39')]({'where':{'id':_0x2eef6b[_0x2158('0x37')]['id']}})['then'](handleEntityNotFound(_0x4b9b98,null))[_0x2158('0x12')](function(_0x597133){if(_0x597133){_0x1c8b39=_0x597133;_0x3a68bf[_0x2158('0x24')]=_[_0x2158('0x25')](db[_0x2158('0x4f')][_0x2158('0x1c')]);_0x3a68bf['query']=_[_0x2158('0x25')](_0x2eef6b['query']);_0x3a68bf[_0x2158('0x26')]=_[_0x2158('0x27')](_0x3a68bf[_0x2158('0x24')],_0x3a68bf['query']);_0x169a0e['attributes']=_['intersection'](_0x3a68bf[_0x2158('0x24')],qs[_0x2158('0x28')](_0x2eef6b['query'][_0x2158('0x28')]));_0x169a0e[_0x2158('0x29')]=_0x169a0e[_0x2158('0x29')]['length']?_0x169a0e[_0x2158('0x29')]:_0x3a68bf[_0x2158('0x24')];_0x169a0e['order']=qs[_0x2158('0x3d')](_0x2eef6b[_0x2158('0x20')][_0x2158('0x3d')]);_0x169a0e[_0x2158('0x3f')]=qs['filters'](_['pick'](_0x2eef6b[_0x2158('0x20')],_0x3a68bf[_0x2158('0x26')]));if(_0x2eef6b['query']['filter']){_0x169a0e[_0x2158('0x3f')]=_[_0x2158('0x2c')](_0x169a0e[_0x2158('0x3f')],{'$or':_[_0x2158('0x42')](_0x169a0e[_0x2158('0x29')],function(_0x4d73d2){var _0x8447d8={};_0x8447d8[_0x4d73d2]={'$like':'%'+_0x2eef6b[_0x2158('0x20')][_0x2158('0x41')]+'%'};return _0x8447d8;})});}_0x169a0e=_['merge']({},_0x169a0e,_0x2eef6b[_0x2158('0x2d')]);return _0x1c8b39[_0x2158('0x4e')](_0x169a0e);}})[_0x2158('0x12')](function(_0x4123e7){if(_0x4123e7){_0x1c296b=_0x4123e7['length'];if(!_0x2eef6b[_0x2158('0x20')]['hasOwnProperty']('nolimit')){_0x169a0e[_0x2158('0x3c')]=qs['limit'](_0x2eef6b[_0x2158('0x20')][_0x2158('0x3c')]);_0x169a0e[_0x2158('0xf')]=qs['offset'](_0x2eef6b[_0x2158('0x20')][_0x2158('0xf')]);}return _0x1c8b39[_0x2158('0x4e')](_0x169a0e);}})[_0x2158('0x12')](function(_0x36e1b3){if(_0x36e1b3){return _0x36e1b3?{'count':_0x1c296b,'rows':_0x36e1b3}:null;}})[_0x2158('0x12')](respondWithResult(_0x4b9b98,null))['catch'](handleError(_0x4b9b98,null));};exports[_0x2158('0x50')]=function(_0x5ca785,_0x8dfbf0){var _0x339d03=_0x5ca785[_0x2158('0x36')]['ids'];return db[_0x2158('0x4f')][_0x2158('0x44')]({'where':{'id':_0x339d03},'attributes':['id'],'include':[{'model':db[_0x2158('0x45')],'as':_0x2158('0x51'),'attributes':['id','name',_0x2158('0x52'),_0x2158('0x53'),'interface'],'raw':!![]}]})['then'](function(_0x359501){if(_0x359501){var _0x5c4cdc=_[_0x2158('0x54')](_0x359501,function(_0x1b8129){var _0x466595=_0x1b8129[_0x2158('0x14')]({'plain':!![]});return _0x466595['Agents'];});return db[_0x2158('0x1b')][_0x2158('0x2e')]({'where':{'id':_0x5ca785[_0x2158('0x37')]['id']}})[_0x2158('0x12')](function(_0x1bd2a4){return db[_0x2158('0x55')][_0x2158('0x56')](function(_0x16c664){return _0x1bd2a4[_0x2158('0x50')](_0x339d03,{'transaction':_0x16c664})[_0x2158('0x12')](function(){return BPromise['each'](_0x5c4cdc,function(_0xbbc31e){return db['UserWhatsappQueue'][_0x2158('0x57')]({'where':{'UserId':_0xbbc31e['id'],'WhatsappQueueId':_0x5ca785[_0x2158('0x37')]['id']},'transaction':_0x16c664});});})[_0x2158('0x12')](function(){_0x5c4cdc['forEach'](function(_0x5e0f59){socket[_0x2158('0x58')](_0x2158('0x59'),{'UserId':_0x5e0f59['id'],'WhatsappQueueId':_0x1bd2a4['id']});});});});});}})[_0x2158('0x12')](respondWithStatusCode(_0x8dfbf0,null))['catch'](handleError(_0x8dfbf0,null));};exports['removeTeams']=function(_0x1eaa15,_0x447556){return db[_0x2158('0x4f')][_0x2158('0x44')]({'where':{'id':_0x1eaa15[_0x2158('0x20')][_0x2158('0x5a')]},'attributes':['id'],'include':[{'model':db[_0x2158('0x45')],'as':_0x2158('0x51'),'attributes':['id'],'raw':!![]}]})['then'](handleEntityNotFound(_0x447556,null))['then'](function(_0x4b52ad){var _0x222bc8=_[_0x2158('0x42')](_0x4b52ad,'id');var _0xecee8c=[];var _0x50cd83=[];var _0x10b155=squel[_0x2158('0x5b')]();_0x10b155[_0x2158('0x5c')](_0x2158('0x5d'))[_0x2158('0x5e')](_0x2158('0x5f'),'tq')[_0x2158('0x60')](_0x2158('0x61'),'ut','ut.TeamId\x20=\x20tq.TeamId')[_0x2158('0x3f')](_0x2158('0x62'),_0x1eaa15[_0x2158('0x37')]['id']);for(var _0xacd608=0x0;_0xacd608<_0x4b52ad[_0x2158('0x2a')];_0xacd608+=0x1){let _0x345e9a=_0x4b52ad[_0xacd608];for(var _0x32a971=0x0;_0x32a971<_0x345e9a[_0x2158('0x51')]['length'];_0x32a971+=0x1){let _0x330dda=_0x345e9a[_0x2158('0x51')][_0x32a971];var _0x482751=_0x10b155['clone']();_0x482751['where'](_0x2158('0x63'),_0x330dda['id']);_0x50cd83[_0x2158('0x64')](db['sequelize'][_0x2158('0x20')](_0x482751[_0x2158('0x65')](),{'type':db[_0x2158('0x55')][_0x2158('0x66')][_0x2158('0x67')]})[_0x2158('0x12')](function(_0x3cb6c9){if(_0x3cb6c9[_0x2158('0x2a')]===0x1){return _0x330dda['id'];}else{var _0x1fa337=_[_0x2158('0x68')](_[_0x2158('0x42')](_0x3cb6c9,_0x2158('0x69')),function(_0x49f33f){return _['includes'](_0x222bc8,_0x49f33f);});if(_0x1fa337){return _0x330dda['id'];}}}));}}return BPromise[_0x2158('0x6a')](_0x50cd83)[_0x2158('0x12')](function(_0x56fbc9){_0xecee8c=_(_0xecee8c)['union'](_0x56fbc9)[_0x2158('0x6b')]()[_0x2158('0x6c')]();return db[_0x2158('0x1b')][_0x2158('0x2e')]({'where':{'id':_0x1eaa15[_0x2158('0x37')]['id']}})[_0x2158('0x12')](function(_0xb065f5){return db['sequelize'][_0x2158('0x56')](function(_0x14bd92){return _0xb065f5[_0x2158('0x6d')](_0x1eaa15[_0x2158('0x20')][_0x2158('0x5a')],{'transaction':_0x14bd92})['then'](function(){if(!_[_0x2158('0x6e')](_0xecee8c)){return _0xb065f5['removeAgents'](_0xecee8c,{'transaction':_0x14bd92});}})[_0x2158('0x12')](function(){_0xecee8c[_0x2158('0x6f')](function(_0x533170){socket['emit'](_0x2158('0x70'),{'UserId':_0x533170,'WhatsappQueueId':_0xb065f5['id']});});});});});});})['then'](respondWithStatusCode(_0x447556,null))['catch'](handleError(_0x447556,null));};exports[_0x2158('0x71')]=function(_0x10f8b6,_0x421220){return db[_0x2158('0x1b')][_0x2158('0x2e')]({'where':{'id':_0x10f8b6[_0x2158('0x37')]['id']}})[_0x2158('0x12')](handleEntityNotFound(_0x421220,null))['then'](function(_0x190d4d){if(_0x190d4d){return _0x190d4d['addAgents'](_0x10f8b6[_0x2158('0x36')][_0x2158('0x5a')],_[_0x2158('0x72')](_0x10f8b6[_0x2158('0x36')],['ids','id'])||{})[_0x2158('0x73')](function(_0x220b05){for(var _0x20908e=0x0;_0x20908e<_0x10f8b6[_0x2158('0x36')][_0x2158('0x5a')][_0x2158('0x2a')];_0x20908e+=0x1){socket[_0x2158('0x58')]('userWhatsappQueue:save',{'UserId':Number(_0x10f8b6[_0x2158('0x36')][_0x2158('0x5a')][_0x20908e]),'WhatsappQueueId':Number(_0x10f8b6['params']['id'])});}return _0x220b05;});}})[_0x2158('0x12')](respondWithResult(_0x421220,null))[_0x2158('0x22')](handleError(_0x421220,null));};exports[_0x2158('0x74')]=function(_0x4e342c,_0x524fe3){return db['WhatsappQueue']['find']({'where':{'id':_0x4e342c[_0x2158('0x37')]['id']}})[_0x2158('0x12')](handleEntityNotFound(_0x524fe3,null))[_0x2158('0x12')](function(_0x5a073c){if(_0x5a073c){return _0x5a073c[_0x2158('0x74')](_0x4e342c[_0x2158('0x20')]['ids'])[_0x2158('0x12')](function(){if(_[_0x2158('0x75')](_0x4e342c[_0x2158('0x20')][_0x2158('0x5a')])){for(var _0x30e6ba=0x0;_0x30e6ba<_0x4e342c[_0x2158('0x20')][_0x2158('0x5a')][_0x2158('0x2a')];_0x30e6ba+=0x1){socket[_0x2158('0x58')](_0x2158('0x70'),{'UserId':Number(_0x4e342c['query'][_0x2158('0x5a')][_0x30e6ba]),'WhatsappQueueId':Number(_0x4e342c[_0x2158('0x37')]['id'])});}}else{socket[_0x2158('0x58')](_0x2158('0x70'),{'UserId':Number(_0x4e342c[_0x2158('0x20')]['ids']),'WhatsappQueueId':Number(_0x4e342c[_0x2158('0x37')]['id'])});}});}})['then'](respondWithStatusCode(_0x524fe3,null))[_0x2158('0x22')](handleError(_0x524fe3,null));};exports[_0x2158('0x76')]=function(_0x4c3c78,_0x1671e6){var _0x36484e={};var _0x253323={};var _0x1fa4fb;var _0x498f07;return db[_0x2158('0x1b')][_0x2158('0x39')]({'where':{'id':_0x4c3c78[_0x2158('0x37')]['id']}})['then'](handleEntityNotFound(_0x1671e6,null))[_0x2158('0x12')](function(_0x57c51f){if(_0x57c51f){_0x1fa4fb=_0x57c51f;_0x253323[_0x2158('0x24')]=_['keys'](db[_0x2158('0x45')][_0x2158('0x1c')]);_0x253323['query']=_[_0x2158('0x25')](_0x4c3c78[_0x2158('0x20')]);_0x253323[_0x2158('0x26')]=_['intersection'](_0x253323[_0x2158('0x24')],_0x253323[_0x2158('0x20')]);_0x36484e[_0x2158('0x29')]=_['intersection'](_0x253323[_0x2158('0x24')],qs[_0x2158('0x28')](_0x4c3c78[_0x2158('0x20')][_0x2158('0x28')]));_0x36484e[_0x2158('0x29')]=_0x36484e[_0x2158('0x29')][_0x2158('0x2a')]?_0x36484e[_0x2158('0x29')]:_0x253323[_0x2158('0x24')];_0x36484e[_0x2158('0x77')]=qs['sort'](_0x4c3c78['query'][_0x2158('0x3d')]);_0x36484e['where']=qs[_0x2158('0x26')](_[_0x2158('0x3e')](_0x4c3c78['query'],_0x253323[_0x2158('0x26')]));if(_0x4c3c78[_0x2158('0x20')][_0x2158('0x41')]){_0x36484e['where']=_['merge'](_0x36484e['where'],{'$or':_[_0x2158('0x42')](_0x36484e[_0x2158('0x29')],function(_0x4ca80c){var _0x329786={};_0x329786[_0x4ca80c]={'$like':'%'+_0x4c3c78[_0x2158('0x20')][_0x2158('0x41')]+'%'};return _0x329786;})});}_0x36484e=_[_0x2158('0x2c')]({},_0x36484e,_0x4c3c78[_0x2158('0x2d')]);return _0x1fa4fb[_0x2158('0x76')](_0x36484e);}})[_0x2158('0x12')](function(_0x4c1629){if(_0x4c1629){_0x498f07=_0x4c1629[_0x2158('0x2a')];if(!_0x4c3c78['query'][_0x2158('0x3a')](_0x2158('0x3b'))){_0x36484e[_0x2158('0x3c')]=qs[_0x2158('0x3c')](_0x4c3c78[_0x2158('0x20')][_0x2158('0x3c')]);_0x36484e['offset']=qs[_0x2158('0xf')](_0x4c3c78['query'][_0x2158('0xf')]);}return _0x1fa4fb[_0x2158('0x76')](_0x36484e);}})['then'](function(_0x9f441a){if(_0x9f441a){return _0x9f441a?{'count':_0x498f07,'rows':_0x9f441a}:null;}})[_0x2158('0x12')](respondWithResult(_0x1671e6,null))['catch'](handleError(_0x1671e6,null));}; \ No newline at end of file +var _0xa78b=['filters','attributes','intersection','fields','include','merge','options','catch','create','body','Unable\x20to\x20retrieve\x20the\x20current\x20user','role','user','UserProfileSection','find','autoAssociation','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','describe','getMembers','UserWhatsappQueue','length','hasOwnProperty','nolimit','sort','filter','findAndCountAll','UserId','agent','createdAt','format','%s/%s','whatsappPause','getTeams','findOne','Team','order','pick','addTeams','User','Agents','voicePause','interface','sequelize','transaction','findOrCreate','emit','userWhatsappQueue:save','removeTeams','ids','field','tq.TeamId','from','team_has_whatsapp_queues','user_has_teams','WhatsappQueueId\x20=\x20?','clone','ut.UserId\x20=\x20?','push','toString','SELECT','every','TeamId','includes','all','union','compact','value','isEmpty','forEach','userWhatsappQueue:remove','addAgents','omit','spread','removeAgents','isArray','getAgents','bluebird','lodash','squel','../../components/parsers/qs','../../config/environment','../../mysqldb','redis','defaults','localhost','./whatsappQueue.socket','register','end','json','offset','limit','undefined','count','status','update','then','get','WhatsappQueues','UserProfileResource','destroy','sendStatus','error','stack','name','send','index','map','rawAttributes','fieldName','type','key','getOptions','where','WhatsappQueue','findAll','rows','show','params','model','keys','query'];(function(_0x344145,_0x15437e){var _0x2ffc00=function(_0x55961e){while(--_0x55961e){_0x344145['push'](_0x344145['shift']());}};_0x2ffc00(++_0x15437e);}(_0xa78b,0xc5));var _0xba78=function(_0x12cb42,_0x429d51){_0x12cb42=_0x12cb42-0x0;var _0x2b72d0=_0xa78b[_0x12cb42];return _0x2b72d0;};'use strict';var BPromise=require(_0xba78('0x0'));var util=require('util');var _=require(_0xba78('0x1'));var squel=require(_0xba78('0x2'));var Redis=require('ioredis');var qs=require(_0xba78('0x3'));var logger=require('../../config/logger')('api');var config=require(_0xba78('0x4'));var db=require(_0xba78('0x5'))['db'];config[_0xba78('0x6')]=_[_0xba78('0x7')](config['redis'],{'host':_0xba78('0x8'),'port':0x18eb});var socket=require('socket.io-emitter')(new Redis(config['redis']));require(_0xba78('0x9'))[_0xba78('0xa')](socket);function respondWithStatusCode(_0x50105b,_0x3a75d4){_0x3a75d4=_0x3a75d4||0xcc;return function(_0x1754ff){if(_0x1754ff){return _0x50105b['sendStatus'](_0x3a75d4);}return _0x50105b['status'](_0x3a75d4)[_0xba78('0xb')]();};}function respondWithResult(_0x386f0d,_0x5c9930){_0x5c9930=_0x5c9930||0xc8;return function(_0x349199){if(_0x349199){return _0x386f0d['status'](_0x5c9930)[_0xba78('0xc')](_0x349199);}};}function respondWithFilteredResult(_0x49962f,_0x54bb2e){return function(_0x52a7cf){if(_0x52a7cf){var _0x4f0dca=typeof _0x54bb2e[_0xba78('0xd')]==='undefined'&&typeof _0x54bb2e[_0xba78('0xe')]===_0xba78('0xf');var _0x5a3338=_0x52a7cf[_0xba78('0x10')];var _0x2c5920=_0x4f0dca?0x0:_0x54bb2e[_0xba78('0xd')];var _0x3137ee=_0x4f0dca?_0x52a7cf[_0xba78('0x10')]:_0x54bb2e[_0xba78('0xd')]+_0x54bb2e[_0xba78('0xe')];var _0x3d68f9;if(_0x3137ee>=_0x5a3338){_0x3137ee=_0x5a3338;_0x3d68f9=0xc8;}else{_0x3d68f9=0xce;}_0x49962f[_0xba78('0x11')](_0x3d68f9);return _0x49962f['set']('Content-Range',_0x2c5920+'-'+_0x3137ee+'/'+_0x5a3338)[_0xba78('0xc')](_0x52a7cf);}return null;};}function saveUpdates(_0x54dd69){return function(_0xde0340){if(_0xde0340){return _0xde0340[_0xba78('0x12')](_0x54dd69)[_0xba78('0x13')](function(_0x5551f5){return _0x5551f5;});}return null;};}function removeEntity(_0x13515f){return function(_0x442aa3){if(_0x442aa3){return _0x442aa3['destroy']()[_0xba78('0x13')](function(){var _0x184746=_0x442aa3[_0xba78('0x14')]({'plain':!![]});var _0x3d44f1=_0xba78('0x15');return db[_0xba78('0x16')][_0xba78('0x17')]({'where':{'type':_0x3d44f1,'resourceId':_0x184746['id']}})[_0xba78('0x13')](function(){return _0x442aa3;});})[_0xba78('0x13')](function(){_0x13515f['status'](0xcc)['end']();});}};}function handleEntityNotFound(_0x4ff2a1){return function(_0x51e777){if(!_0x51e777){_0x4ff2a1[_0xba78('0x18')](0x194);}return _0x51e777;};}function handleError(_0x29cf6b,_0x9cca83){_0x9cca83=_0x9cca83||0x1f4;return function(_0x50e07e){logger[_0xba78('0x19')](_0x50e07e[_0xba78('0x1a')]);if(_0x50e07e[_0xba78('0x1b')]){delete _0x50e07e[_0xba78('0x1b')];}_0x29cf6b[_0xba78('0x11')](_0x9cca83)[_0xba78('0x1c')](_0x50e07e);};}exports[_0xba78('0x1d')]=function(_0x3cf7cd,_0x585243){var _0x4f88be={};var _0x3bfbcd={'count':0x0,'rows':[]};var _0x296cfc=_[_0xba78('0x1e')](db['WhatsappQueue'][_0xba78('0x1f')],function(_0xdff652){return{'name':_0xdff652[_0xba78('0x20')],'type':_0xdff652[_0xba78('0x21')][_0xba78('0x22')]};});_0x4f88be=qs[_0xba78('0x23')](_0x296cfc,_0x3cf7cd);var _0xce6533={'where':_0x4f88be[_0xba78('0x24')]};return db[_0xba78('0x25')][_0xba78('0x10')](_0xce6533)[_0xba78('0x13')](function(_0x3331db){_0x3bfbcd[_0xba78('0x10')]=_0x3331db;_0x4f88be['include']=qs['include'](_0x3cf7cd['query']);return db[_0xba78('0x25')][_0xba78('0x26')](_0x4f88be);})[_0xba78('0x13')](function(_0x575ba6){_0x3bfbcd[_0xba78('0x27')]=_0x575ba6;return _0x3bfbcd;})['then'](respondWithFilteredResult(_0x585243,_0x4f88be))['catch'](handleError(_0x585243,null));};exports[_0xba78('0x28')]=function(_0x14f5d2,_0x49b3c4){var _0x2f4be8={'raw':!![],'where':{'id':_0x14f5d2[_0xba78('0x29')]['id']}},_0x592b0e={};_0x592b0e[_0xba78('0x2a')]=_[_0xba78('0x2b')](db[_0xba78('0x25')][_0xba78('0x1f')]);_0x592b0e[_0xba78('0x2c')]=_[_0xba78('0x2b')](_0x14f5d2[_0xba78('0x2c')]);_0x592b0e[_0xba78('0x2d')]=_['intersection'](_0x592b0e[_0xba78('0x2a')],_0x592b0e[_0xba78('0x2c')]);_0x2f4be8[_0xba78('0x2e')]=_[_0xba78('0x2f')](_0x592b0e[_0xba78('0x2a')],qs[_0xba78('0x30')](_0x14f5d2['query'][_0xba78('0x30')]));_0x2f4be8['attributes']=_0x2f4be8[_0xba78('0x2e')]['length']?_0x2f4be8[_0xba78('0x2e')]:_0x592b0e['model'];if(_0x14f5d2[_0xba78('0x2c')]['includeAll']){_0x2f4be8[_0xba78('0x31')]=[{'all':!![]}];}_0x2f4be8=_[_0xba78('0x32')]({},_0x2f4be8,_0x14f5d2[_0xba78('0x33')]);return db['WhatsappQueue']['find'](_0x2f4be8)[_0xba78('0x13')](handleEntityNotFound(_0x49b3c4,null))[_0xba78('0x13')](respondWithResult(_0x49b3c4,null))[_0xba78('0x34')](handleError(_0x49b3c4,null));};exports[_0xba78('0x35')]=function(_0x18767f,_0x56dd05){return db[_0xba78('0x25')]['create'](_0x18767f[_0xba78('0x36')],{})['then'](function(_0x4d7fed){var _0x5b86af=_0x18767f['user'][_0xba78('0x14')]({'plain':!![]});if(!_0x5b86af)throw new Error(_0xba78('0x37'));if(_0x5b86af[_0xba78('0x38')]===_0xba78('0x39')){var _0x9d3e25=_0x4d7fed[_0xba78('0x14')]({'plain':!![]});var _0x326606=_0xba78('0x15');return db[_0xba78('0x3a')][_0xba78('0x3b')]({'where':{'name':_0x326606,'userProfileId':_0x5b86af['userProfileId']},'raw':!![]})[_0xba78('0x13')](function(_0x19d95a){if(_0x19d95a&&_0x19d95a[_0xba78('0x3c')]===0x0){return db[_0xba78('0x16')]['create']({'name':_0x9d3e25[_0xba78('0x1b')],'resourceId':_0x9d3e25['id'],'type':_0x19d95a[_0xba78('0x1b')],'sectionId':_0x19d95a['id']},{})[_0xba78('0x13')](function(){return _0x4d7fed;});}else{return _0x4d7fed;}})[_0xba78('0x34')](function(_0x1ac31d){logger[_0xba78('0x19')](_0xba78('0x3d'),_0x1ac31d);throw _0x1ac31d;});}return _0x4d7fed;})[_0xba78('0x13')](respondWithResult(_0x56dd05,0xc9))[_0xba78('0x34')](handleError(_0x56dd05,null));};exports['update']=function(_0x569f72,_0x48bd7f){if(_0x569f72[_0xba78('0x36')]['id']){delete _0x569f72['body']['id'];}return db['WhatsappQueue'][_0xba78('0x3b')]({'where':{'id':_0x569f72['params']['id']}})[_0xba78('0x13')](handleEntityNotFound(_0x48bd7f,null))[_0xba78('0x13')](saveUpdates(_0x569f72[_0xba78('0x36')],null))['then'](respondWithResult(_0x48bd7f,null))[_0xba78('0x34')](handleError(_0x48bd7f,null));};exports['destroy']=function(_0x58634c,_0x2659c7){return db[_0xba78('0x25')][_0xba78('0x3b')]({'where':{'id':_0x58634c[_0xba78('0x29')]['id']}})[_0xba78('0x13')](handleEntityNotFound(_0x2659c7,null))[_0xba78('0x13')](removeEntity(_0x2659c7,null))['catch'](handleError(_0x2659c7,null));};exports[_0xba78('0x3e')]=function(_0x1d8659,_0x1b2994){return db['WhatsappQueue']['describe']()['then'](respondWithResult(_0x1b2994,null))[_0xba78('0x34')](handleError(_0x1b2994,null));};exports[_0xba78('0x3f')]=function(_0x1a2ec3,_0x3f4987){var _0x3727ff={'raw':!![],'where':{}},_0x49171d={},_0xe8ffaf;return db[_0xba78('0x25')]['findOne']({'where':{'id':_0x1a2ec3[_0xba78('0x29')]['id']}})['then'](handleEntityNotFound(_0x3f4987,null))['then'](function(_0x554c92){if(_0x554c92){_0xe8ffaf=_0x554c92[_0xba78('0x14')]({'plain':!![]});_0x49171d[_0xba78('0x2a')]=_['keys'](db[_0xba78('0x40')][_0xba78('0x1f')]);_0x49171d[_0xba78('0x2c')]=_[_0xba78('0x2b')](_0x1a2ec3[_0xba78('0x2c')]);_0x49171d[_0xba78('0x2d')]=_[_0xba78('0x2f')](_0x49171d[_0xba78('0x2a')],_0x49171d[_0xba78('0x2c')]);_0x3727ff[_0xba78('0x2e')]=_[_0xba78('0x2f')](_0x49171d[_0xba78('0x2a')],qs[_0xba78('0x30')](_0x1a2ec3['query'][_0xba78('0x30')]));_0x3727ff[_0xba78('0x2e')]=_0x3727ff[_0xba78('0x2e')][_0xba78('0x41')]?_0x3727ff['attributes']:_0x49171d['model'];if(!_0x1a2ec3['query'][_0xba78('0x42')](_0xba78('0x43'))){_0x3727ff[_0xba78('0xe')]=qs[_0xba78('0xe')](_0x1a2ec3['query'][_0xba78('0xe')]);_0x3727ff[_0xba78('0xd')]=qs[_0xba78('0xd')](_0x1a2ec3['query'][_0xba78('0xd')]);}_0x3727ff['order']=qs[_0xba78('0x44')](_0x1a2ec3[_0xba78('0x2c')][_0xba78('0x44')]);_0x3727ff[_0xba78('0x24')]=qs[_0xba78('0x2d')](_['pick'](_0x1a2ec3[_0xba78('0x2c')],_0x49171d[_0xba78('0x2d')]));_0x3727ff[_0xba78('0x24')]['WhatsappQueueId']=_0x554c92['id'];if(_0x1a2ec3[_0xba78('0x2c')][_0xba78('0x45')]){_0x3727ff[_0xba78('0x24')]=_[_0xba78('0x32')](_0x3727ff[_0xba78('0x24')],{'$or':_[_0xba78('0x1e')](_0x3727ff[_0xba78('0x2e')],function(_0x299dbc){var _0x4335e1={};_0x4335e1[_0x299dbc]={'$like':'%'+_0x1a2ec3[_0xba78('0x2c')][_0xba78('0x45')]+'%'};return _0x4335e1;})});}_0x3727ff=_[_0xba78('0x32')]({},_0x3727ff,_0x1a2ec3[_0xba78('0x33')]);return db[_0xba78('0x40')][_0xba78('0x26')](_0x3727ff);}})[_0xba78('0x13')](function(_0x3b29b7){if(_0x3b29b7){return db['User'][_0xba78('0x46')]({'where':{'id':_[_0xba78('0x1e')](_0x3b29b7,_0xba78('0x47')),'role':_0xba78('0x48')},'attributes':['id','name','whatsappPause','updatedAt',_0xba78('0x49')]});}})[_0xba78('0x13')](function(_0x1a0752){if(_0x1a0752){return{'count':_0x1a0752['count'],'rows':_['map'](_0x1a0752['rows'],function(_0x58d335){return{'membername':_0x58d335[_0xba78('0x1b')],'UserId':_0x58d335['id'],'queue_name':_0xe8ffaf['name'],'WhatsappQueueId':_0xe8ffaf['id'],'interface':util[_0xba78('0x4a')](_0xba78('0x4b'),'SIP',_0x58d335[_0xba78('0x1b')]),'penalty':0x0,'paused':_0x58d335[_0xba78('0x4c')],'createdAt':_0x58d335[_0xba78('0x49')],'updatedAt':_0x58d335['updatedAt']};})};}else{return{'count':0x0,'rows':[]};}})[_0xba78('0x13')](respondWithFilteredResult(_0x3f4987,_0x3727ff))[_0xba78('0x34')](handleError(_0x3f4987,null));};exports[_0xba78('0x4d')]=function(_0x184872,_0xf4b650){var _0x1243dc={};var _0x8931d={};var _0x5f3687;var _0x4fa048;return db[_0xba78('0x25')][_0xba78('0x4e')]({'where':{'id':_0x184872[_0xba78('0x29')]['id']}})['then'](handleEntityNotFound(_0xf4b650,null))['then'](function(_0x123378){if(_0x123378){_0x5f3687=_0x123378;_0x8931d[_0xba78('0x2a')]=_[_0xba78('0x2b')](db[_0xba78('0x4f')][_0xba78('0x1f')]);_0x8931d[_0xba78('0x2c')]=_['keys'](_0x184872[_0xba78('0x2c')]);_0x8931d[_0xba78('0x2d')]=_[_0xba78('0x2f')](_0x8931d[_0xba78('0x2a')],_0x8931d[_0xba78('0x2c')]);_0x1243dc['attributes']=_[_0xba78('0x2f')](_0x8931d[_0xba78('0x2a')],qs[_0xba78('0x30')](_0x184872[_0xba78('0x2c')][_0xba78('0x30')]));_0x1243dc[_0xba78('0x2e')]=_0x1243dc[_0xba78('0x2e')]['length']?_0x1243dc[_0xba78('0x2e')]:_0x8931d[_0xba78('0x2a')];_0x1243dc[_0xba78('0x50')]=qs[_0xba78('0x44')](_0x184872['query']['sort']);_0x1243dc[_0xba78('0x24')]=qs[_0xba78('0x2d')](_[_0xba78('0x51')](_0x184872[_0xba78('0x2c')],_0x8931d[_0xba78('0x2d')]));if(_0x184872['query'][_0xba78('0x45')]){_0x1243dc[_0xba78('0x24')]=_[_0xba78('0x32')](_0x1243dc['where'],{'$or':_[_0xba78('0x1e')](_0x1243dc[_0xba78('0x2e')],function(_0x53f61f){var _0x1a73ea={};_0x1a73ea[_0x53f61f]={'$like':'%'+_0x184872['query'][_0xba78('0x45')]+'%'};return _0x1a73ea;})});}_0x1243dc=_['merge']({},_0x1243dc,_0x184872[_0xba78('0x33')]);return _0x5f3687['getTeams'](_0x1243dc);}})[_0xba78('0x13')](function(_0x4052e3){if(_0x4052e3){_0x4fa048=_0x4052e3['length'];if(!_0x184872[_0xba78('0x2c')][_0xba78('0x42')]('nolimit')){_0x1243dc[_0xba78('0xe')]=qs[_0xba78('0xe')](_0x184872[_0xba78('0x2c')][_0xba78('0xe')]);_0x1243dc['offset']=qs[_0xba78('0xd')](_0x184872[_0xba78('0x2c')]['offset']);}return _0x5f3687[_0xba78('0x4d')](_0x1243dc);}})[_0xba78('0x13')](function(_0x2b7b4a){if(_0x2b7b4a){return _0x2b7b4a?{'count':_0x4fa048,'rows':_0x2b7b4a}:null;}})['then'](respondWithResult(_0xf4b650,null))['catch'](handleError(_0xf4b650,null));};exports[_0xba78('0x52')]=function(_0x43d1c6,_0x13c326){var _0xd7a761=_0x43d1c6[_0xba78('0x36')]['ids'];return db['Team']['findAll']({'where':{'id':_0xd7a761},'attributes':['id'],'include':[{'model':db[_0xba78('0x53')],'as':_0xba78('0x54'),'attributes':['id','name','online',_0xba78('0x55'),_0xba78('0x56')],'raw':!![]}]})[_0xba78('0x13')](function(_0x1bc86a){if(_0x1bc86a){var _0x5c1c58=_['flatMap'](_0x1bc86a,function(_0x46396e){var _0x143306=_0x46396e[_0xba78('0x14')]({'plain':!![]});return _0x143306['Agents'];});return db[_0xba78('0x25')][_0xba78('0x3b')]({'where':{'id':_0x43d1c6['params']['id']}})[_0xba78('0x13')](function(_0x172de2){return db[_0xba78('0x57')][_0xba78('0x58')](function(_0x1881cc){return _0x172de2[_0xba78('0x52')](_0xd7a761,{'transaction':_0x1881cc})[_0xba78('0x13')](function(){return BPromise['each'](_0x5c1c58,function(_0x3762fb){return db[_0xba78('0x40')][_0xba78('0x59')]({'where':{'UserId':_0x3762fb['id'],'WhatsappQueueId':_0x43d1c6['params']['id']},'transaction':_0x1881cc});});})[_0xba78('0x13')](function(){_0x5c1c58['forEach'](function(_0x1d5ab8){socket[_0xba78('0x5a')](_0xba78('0x5b'),{'UserId':_0x1d5ab8['id'],'WhatsappQueueId':_0x172de2['id']});});});});});}})[_0xba78('0x13')](respondWithStatusCode(_0x13c326,null))[_0xba78('0x34')](handleError(_0x13c326,null));};exports[_0xba78('0x5c')]=function(_0x37dd5c,_0x3fd540){return db[_0xba78('0x4f')][_0xba78('0x26')]({'where':{'id':_0x37dd5c[_0xba78('0x2c')][_0xba78('0x5d')]},'attributes':['id'],'include':[{'model':db[_0xba78('0x53')],'as':_0xba78('0x54'),'attributes':['id'],'raw':!![]}]})[_0xba78('0x13')](handleEntityNotFound(_0x3fd540,null))[_0xba78('0x13')](function(_0x4cce1a){var _0x412bfb=_[_0xba78('0x1e')](_0x4cce1a,'id');var _0x52f359=[];var _0x48bcc0=[];var _0x3c7ed0=squel['select']();_0x3c7ed0[_0xba78('0x5e')](_0xba78('0x5f'))[_0xba78('0x60')](_0xba78('0x61'),'tq')['join'](_0xba78('0x62'),'ut','ut.TeamId\x20=\x20tq.TeamId')['where'](_0xba78('0x63'),_0x37dd5c[_0xba78('0x29')]['id']);for(var _0x445827=0x0;_0x445827<_0x4cce1a['length'];_0x445827+=0x1){let _0x110eed=_0x4cce1a[_0x445827];for(var _0x30d1d1=0x0;_0x30d1d1<_0x110eed[_0xba78('0x54')][_0xba78('0x41')];_0x30d1d1+=0x1){let _0x4c3fca=_0x110eed[_0xba78('0x54')][_0x30d1d1];var _0x29f967=_0x3c7ed0[_0xba78('0x64')]();_0x29f967[_0xba78('0x24')](_0xba78('0x65'),_0x4c3fca['id']);_0x48bcc0[_0xba78('0x66')](db[_0xba78('0x57')][_0xba78('0x2c')](_0x29f967[_0xba78('0x67')](),{'type':db[_0xba78('0x57')]['QueryTypes'][_0xba78('0x68')]})[_0xba78('0x13')](function(_0x59165e){if(_0x59165e[_0xba78('0x41')]===0x1){return _0x4c3fca['id'];}else{var _0x144ba2=_[_0xba78('0x69')](_[_0xba78('0x1e')](_0x59165e,_0xba78('0x6a')),function(_0x425f84){return _[_0xba78('0x6b')](_0x412bfb,_0x425f84);});if(_0x144ba2){return _0x4c3fca['id'];}}}));}}return BPromise[_0xba78('0x6c')](_0x48bcc0)[_0xba78('0x13')](function(_0x56f850){_0x52f359=_(_0x52f359)[_0xba78('0x6d')](_0x56f850)[_0xba78('0x6e')]()[_0xba78('0x6f')]();return db[_0xba78('0x25')][_0xba78('0x3b')]({'where':{'id':_0x37dd5c[_0xba78('0x29')]['id']}})[_0xba78('0x13')](function(_0x14f527){return db[_0xba78('0x57')]['transaction'](function(_0x1ed5ca){return _0x14f527['removeTeams'](_0x37dd5c[_0xba78('0x2c')][_0xba78('0x5d')],{'transaction':_0x1ed5ca})['then'](function(){if(!_[_0xba78('0x70')](_0x52f359)){return _0x14f527['removeAgents'](_0x52f359,{'transaction':_0x1ed5ca});}})[_0xba78('0x13')](function(){_0x52f359[_0xba78('0x71')](function(_0x220da9){socket[_0xba78('0x5a')](_0xba78('0x72'),{'UserId':_0x220da9,'WhatsappQueueId':_0x14f527['id']});});});});});});})[_0xba78('0x13')](respondWithStatusCode(_0x3fd540,null))[_0xba78('0x34')](handleError(_0x3fd540,null));};exports[_0xba78('0x73')]=function(_0x33b505,_0x1e5bb3){return db[_0xba78('0x25')][_0xba78('0x3b')]({'where':{'id':_0x33b505[_0xba78('0x29')]['id']}})[_0xba78('0x13')](handleEntityNotFound(_0x1e5bb3,null))['then'](function(_0x3df306){if(_0x3df306){return _0x3df306[_0xba78('0x73')](_0x33b505['body']['ids'],_[_0xba78('0x74')](_0x33b505[_0xba78('0x36')],[_0xba78('0x5d'),'id'])||{})[_0xba78('0x75')](function(_0x5e1056){for(var _0x3d0df3=0x0;_0x3d0df3<_0x33b505[_0xba78('0x36')][_0xba78('0x5d')][_0xba78('0x41')];_0x3d0df3+=0x1){socket[_0xba78('0x5a')](_0xba78('0x5b'),{'UserId':Number(_0x33b505[_0xba78('0x36')][_0xba78('0x5d')][_0x3d0df3]),'WhatsappQueueId':Number(_0x33b505[_0xba78('0x29')]['id'])});}return _0x5e1056;});}})['then'](respondWithResult(_0x1e5bb3,null))[_0xba78('0x34')](handleError(_0x1e5bb3,null));};exports[_0xba78('0x76')]=function(_0x41b127,_0x29b4d0){return db[_0xba78('0x25')][_0xba78('0x3b')]({'where':{'id':_0x41b127[_0xba78('0x29')]['id']}})[_0xba78('0x13')](handleEntityNotFound(_0x29b4d0,null))[_0xba78('0x13')](function(_0x2d6f74){if(_0x2d6f74){return _0x2d6f74[_0xba78('0x76')](_0x41b127[_0xba78('0x2c')][_0xba78('0x5d')])[_0xba78('0x13')](function(){if(_[_0xba78('0x77')](_0x41b127['query'][_0xba78('0x5d')])){for(var _0x346d93=0x0;_0x346d93<_0x41b127[_0xba78('0x2c')][_0xba78('0x5d')][_0xba78('0x41')];_0x346d93+=0x1){socket[_0xba78('0x5a')](_0xba78('0x72'),{'UserId':Number(_0x41b127[_0xba78('0x2c')]['ids'][_0x346d93]),'WhatsappQueueId':Number(_0x41b127[_0xba78('0x29')]['id'])});}}else{socket[_0xba78('0x5a')](_0xba78('0x72'),{'UserId':Number(_0x41b127[_0xba78('0x2c')][_0xba78('0x5d')]),'WhatsappQueueId':Number(_0x41b127['params']['id'])});}});}})['then'](respondWithStatusCode(_0x29b4d0,null))[_0xba78('0x34')](handleError(_0x29b4d0,null));};exports[_0xba78('0x78')]=function(_0xfdeb47,_0x99b878){var _0x595762={};var _0x44e6ad={};var _0x415cda;var _0x385df9;return db[_0xba78('0x25')][_0xba78('0x4e')]({'where':{'id':_0xfdeb47[_0xba78('0x29')]['id']}})[_0xba78('0x13')](handleEntityNotFound(_0x99b878,null))[_0xba78('0x13')](function(_0xd9c87d){if(_0xd9c87d){_0x415cda=_0xd9c87d;_0x44e6ad[_0xba78('0x2a')]=_[_0xba78('0x2b')](db['User']['rawAttributes']);_0x44e6ad[_0xba78('0x2c')]=_['keys'](_0xfdeb47[_0xba78('0x2c')]);_0x44e6ad[_0xba78('0x2d')]=_[_0xba78('0x2f')](_0x44e6ad[_0xba78('0x2a')],_0x44e6ad[_0xba78('0x2c')]);_0x595762['attributes']=_[_0xba78('0x2f')](_0x44e6ad['model'],qs[_0xba78('0x30')](_0xfdeb47[_0xba78('0x2c')][_0xba78('0x30')]));_0x595762[_0xba78('0x2e')]=_0x595762['attributes'][_0xba78('0x41')]?_0x595762[_0xba78('0x2e')]:_0x44e6ad[_0xba78('0x2a')];_0x595762[_0xba78('0x50')]=qs['sort'](_0xfdeb47[_0xba78('0x2c')][_0xba78('0x44')]);_0x595762['where']=qs[_0xba78('0x2d')](_['pick'](_0xfdeb47[_0xba78('0x2c')],_0x44e6ad['filters']));if(_0xfdeb47[_0xba78('0x2c')][_0xba78('0x45')]){_0x595762[_0xba78('0x24')]=_['merge'](_0x595762[_0xba78('0x24')],{'$or':_['map'](_0x595762[_0xba78('0x2e')],function(_0x549e95){var _0x52e258={};_0x52e258[_0x549e95]={'$like':'%'+_0xfdeb47['query'][_0xba78('0x45')]+'%'};return _0x52e258;})});}_0x595762=_['merge']({},_0x595762,_0xfdeb47[_0xba78('0x33')]);return _0x415cda['getAgents'](_0x595762);}})[_0xba78('0x13')](function(_0x31a10e){if(_0x31a10e){_0x385df9=_0x31a10e['length'];if(!_0xfdeb47[_0xba78('0x2c')][_0xba78('0x42')](_0xba78('0x43'))){_0x595762['limit']=qs[_0xba78('0xe')](_0xfdeb47[_0xba78('0x2c')][_0xba78('0xe')]);_0x595762[_0xba78('0xd')]=qs[_0xba78('0xd')](_0xfdeb47[_0xba78('0x2c')]['offset']);}return _0x415cda[_0xba78('0x78')](_0x595762);}})[_0xba78('0x13')](function(_0x39f425){if(_0x39f425){return _0x39f425?{'count':_0x385df9,'rows':_0x39f425}:null;}})[_0xba78('0x13')](respondWithResult(_0x99b878,null))[_0xba78('0x34')](handleError(_0x99b878,null));}; \ No newline at end of file diff --git a/server/api/whatsappQueue/whatsappQueue.events.js b/server/api/whatsappQueue/whatsappQueue.events.js index b80af43..5a6498b 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 _0x4235=['save','update','emit','hasOwnProperty','exports','events','../../mysqldb','WhatsappQueue','setMaxListeners'];(function(_0x5f0fda,_0x4a7ed3){var _0x31a74f=function(_0x5d5b66){while(--_0x5d5b66){_0x5f0fda['push'](_0x5f0fda['shift']());}};_0x31a74f(++_0x4a7ed3);}(_0x4235,0x188));var _0x5423=function(_0x303986,_0x5c751c){_0x303986=_0x303986-0x0;var _0x4c4431=_0x4235[_0x303986];return _0x4c4431;};'use strict';var EventEmitter=require(_0x5423('0x0'));var WhatsappQueue=require(_0x5423('0x1'))['db'][_0x5423('0x2')];var WhatsappQueueEvents=new EventEmitter();WhatsappQueueEvents[_0x5423('0x3')](0x0);var events={'afterCreate':_0x5423('0x4'),'afterUpdate':_0x5423('0x5'),'afterDestroy':'remove'};function emitEvent(_0x3c76c7){return function(_0x4666c2,_0x1d4390,_0x5c5c20){WhatsappQueueEvents[_0x5423('0x6')](_0x3c76c7+':'+_0x4666c2['id'],_0x4666c2);WhatsappQueueEvents[_0x5423('0x6')](_0x3c76c7,_0x4666c2);_0x5c5c20(null);};}for(var e in events){if(events[_0x5423('0x7')](e)){var event=events[e];WhatsappQueue['hook'](e,emitEvent(event));}}module[_0x5423('0x8')]=WhatsappQueueEvents; \ No newline at end of file +var _0x3eda=['update','emit','hasOwnProperty','hook','exports','events','../../mysqldb','setMaxListeners'];(function(_0x3b2246,_0x5bf396){var _0x7d5300=function(_0xce3885){while(--_0xce3885){_0x3b2246['push'](_0x3b2246['shift']());}};_0x7d5300(++_0x5bf396);}(_0x3eda,0x185));var _0xa3ed=function(_0x3b4624,_0x1e3626){_0x3b4624=_0x3b4624-0x0;var _0x335bac=_0x3eda[_0x3b4624];return _0x335bac;};'use strict';var EventEmitter=require(_0xa3ed('0x0'));var WhatsappQueue=require(_0xa3ed('0x1'))['db']['WhatsappQueue'];var WhatsappQueueEvents=new EventEmitter();WhatsappQueueEvents[_0xa3ed('0x2')](0x0);var events={'afterCreate':'save','afterUpdate':_0xa3ed('0x3'),'afterDestroy':'remove'};function emitEvent(_0x470550){return function(_0x501164,_0x5882c5,_0x45835a){WhatsappQueueEvents[_0xa3ed('0x4')](_0x470550+':'+_0x501164['id'],_0x501164);WhatsappQueueEvents[_0xa3ed('0x4')](_0x470550,_0x501164);_0x45835a(null);};}for(var e in events){if(events[_0xa3ed('0x5')](e)){var event=events[e];WhatsappQueue[_0xa3ed('0x6')](e,emitEvent(event));}}module[_0xa3ed('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 ae9b6a4..94e1ee0 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 _0x0d38=['util','../../config/logger','api','moment','bluebird','request-promise','path','rimraf','../../config/environment','./whatsappQueue.attributes','define','WhatsappQueue','whatsapp_queues','lodash'];(function(_0xa2721d,_0x1367cb){var _0xc5224c=function(_0x391cf1){while(--_0x391cf1){_0xa2721d['push'](_0xa2721d['shift']());}};_0xc5224c(++_0x1367cb);}(_0x0d38,0x1cd));var _0x80d3=function(_0x3ed850,_0x83663c){_0x3ed850=_0x3ed850-0x0;var _0x141ee0=_0x0d38[_0x3ed850];return _0x141ee0;};'use strict';var _=require(_0x80d3('0x0'));var util=require(_0x80d3('0x1'));var logger=require(_0x80d3('0x2'))(_0x80d3('0x3'));var moment=require(_0x80d3('0x4'));var BPromise=require(_0x80d3('0x5'));var rp=require(_0x80d3('0x6'));var fs=require('fs');var path=require(_0x80d3('0x7'));var rimraf=require(_0x80d3('0x8'));var config=require(_0x80d3('0x9'));var attributes=require(_0x80d3('0xa'));module['exports']=function(_0x4dc93e,_0x204d14){return _0x4dc93e[_0x80d3('0xb')](_0x80d3('0xc'),attributes,{'tableName':_0x80d3('0xd'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0xf941=['util','../../config/logger','api','bluebird','request-promise','rimraf','./whatsappQueue.attributes','exports','define'];(function(_0x233fbf,_0x205245){var _0x36ffff=function(_0x392992){while(--_0x392992){_0x233fbf['push'](_0x233fbf['shift']());}};_0x36ffff(++_0x205245);}(_0xf941,0xd8));var _0x1f94=function(_0x618414,_0x1a7a60){_0x618414=_0x618414-0x0;var _0x21c19a=_0xf941[_0x618414];return _0x21c19a;};'use strict';var _=require('lodash');var util=require(_0x1f94('0x0'));var logger=require(_0x1f94('0x1'))(_0x1f94('0x2'));var moment=require('moment');var BPromise=require(_0x1f94('0x3'));var rp=require(_0x1f94('0x4'));var fs=require('fs');var path=require('path');var rimraf=require(_0x1f94('0x5'));var config=require('../../config/environment');var attributes=require(_0x1f94('0x6'));module[_0x1f94('0x7')]=function(_0x28488d,_0x12e421){return _0x28488d[_0x1f94('0x8')]('WhatsappQueue',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 4b2f962..5b24ba8 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 _0x9ed6=['error','code','message','result','catch','GetWhatsappQueue','findAll','options','raw','where','attributes','include','map','model','stringify','WhatsappQueue','find','ShowWhatsappQueue','lodash','util','moment','bluebird','randomstring','ioredis','../../mysqldb','rpc','../../config/environment','jayson/promise','client','http','redis','localhost','socket.io-emitter','./whatsappQueue.socket','register','request','then','info','WhatsappQueue,\x20%s,\x20%s','request\x20sent','debug','WhatsappQueue,\x20%s,\x20%s,\x20%s'];(function(_0xcb496b,_0x3ba29e){var _0x300adf=function(_0x591cc7){while(--_0x591cc7){_0xcb496b['push'](_0xcb496b['shift']());}};_0x300adf(++_0x3ba29e);}(_0x9ed6,0x1b6));var _0x69ed=function(_0x22b8a8,_0x3da28e){_0x22b8a8=_0x22b8a8-0x0;var _0x293391=_0x9ed6[_0x22b8a8];return _0x293391;};'use strict';var _=require(_0x69ed('0x0'));var util=require(_0x69ed('0x1'));var moment=require(_0x69ed('0x2'));var BPromise=require(_0x69ed('0x3'));var rs=require(_0x69ed('0x4'));var fs=require('fs');var Redis=require(_0x69ed('0x5'));var db=require(_0x69ed('0x6'))['db'];var utils=require('../../config/utils');var logger=require('../../config/logger')(_0x69ed('0x7'));var config=require(_0x69ed('0x8'));var jayson=require(_0x69ed('0x9'));var client=jayson[_0x69ed('0xa')][_0x69ed('0xb')]({'port':0x232a});config[_0x69ed('0xc')]=_['defaults'](config[_0x69ed('0xc')],{'host':_0x69ed('0xd'),'port':0x18eb});var socket=require(_0x69ed('0xe'))(new Redis(config['redis']));require(_0x69ed('0xf'))[_0x69ed('0x10')](socket);function respondWithRpcPromise(_0x1898bc,_0x513b19,_0x1943fd){return new BPromise(function(_0x2c0bf6,_0x57fc19){return client[_0x69ed('0x11')](_0x1898bc,_0x1943fd)[_0x69ed('0x12')](function(_0x261777){logger[_0x69ed('0x13')](_0x69ed('0x14'),_0x513b19,_0x69ed('0x15'));logger[_0x69ed('0x16')](_0x69ed('0x17'),_0x513b19,_0x69ed('0x15'),JSON['stringify'](_0x261777));if(_0x261777['error']){if(_0x261777[_0x69ed('0x18')][_0x69ed('0x19')]===0x1f4){logger['error']('WhatsappQueue,\x20%s,\x20%s',_0x513b19,_0x261777[_0x69ed('0x18')][_0x69ed('0x1a')]);return _0x57fc19(_0x261777[_0x69ed('0x18')][_0x69ed('0x1a')]);}logger[_0x69ed('0x18')](_0x69ed('0x14'),_0x513b19,_0x261777[_0x69ed('0x18')][_0x69ed('0x1a')]);return _0x2c0bf6(_0x261777['error'][_0x69ed('0x1a')]);}else{logger[_0x69ed('0x13')]('WhatsappQueue,\x20%s,\x20%s',_0x513b19,_0x69ed('0x15'));_0x2c0bf6(_0x261777[_0x69ed('0x1b')][_0x69ed('0x1a')]);}})[_0x69ed('0x1c')](function(_0x121b1d){logger[_0x69ed('0x18')](_0x69ed('0x14'),_0x513b19,_0x121b1d);_0x57fc19(_0x121b1d);});});}exports[_0x69ed('0x1d')]=function(_0x17f217){var _0x123a2a=this;return new Promise(function(_0x430a18,_0x4b529b){return db['WhatsappQueue'][_0x69ed('0x1e')]({'raw':_0x17f217[_0x69ed('0x1f')]?_0x17f217[_0x69ed('0x1f')][_0x69ed('0x20')]===undefined?!![]:![]:!![],'where':_0x17f217[_0x69ed('0x1f')]?_0x17f217['options'][_0x69ed('0x21')]||null:null,'attributes':_0x17f217['options']?_0x17f217[_0x69ed('0x1f')][_0x69ed('0x22')]||null:null,'limit':_0x17f217[_0x69ed('0x1f')]?_0x17f217[_0x69ed('0x1f')]['limit']||null:null,'include':_0x17f217[_0x69ed('0x1f')]?_0x17f217[_0x69ed('0x1f')][_0x69ed('0x23')]?_[_0x69ed('0x24')](_0x17f217[_0x69ed('0x1f')]['include'],function(_0x53fc0d){return{'model':db[_0x53fc0d['model']],'as':_0x53fc0d['as'],'attributes':_0x53fc0d['attributes'],'include':_0x53fc0d['include']?_[_0x69ed('0x24')](_0x53fc0d[_0x69ed('0x23')],function(_0x42f2a0){return{'model':db[_0x42f2a0[_0x69ed('0x25')]],'as':_0x42f2a0['as'],'attributes':_0x42f2a0[_0x69ed('0x22')],'include':_0x42f2a0[_0x69ed('0x23')]?_[_0x69ed('0x24')](_0x42f2a0[_0x69ed('0x23')],function(_0x358cb5){return{'model':db[_0x358cb5['model']],'as':_0x358cb5['as'],'attributes':_0x358cb5[_0x69ed('0x22')]};}):[]};}):[]};}):[]:[]})[_0x69ed('0x12')](function(_0x4de568){logger[_0x69ed('0x13')](_0x69ed('0x1d'),_0x17f217);logger['debug'](_0x69ed('0x1d'),_0x17f217,JSON[_0x69ed('0x26')](_0x4de568));_0x430a18(_0x4de568);})[_0x69ed('0x1c')](function(_0x6eb33f){logger[_0x69ed('0x18')](_0x69ed('0x1d'),_0x6eb33f[_0x69ed('0x1a')],_0x17f217);_0x4b529b(_0x123a2a[_0x69ed('0x18')](0x1f4,_0x6eb33f['message']));});});};exports['ShowWhatsappQueue']=function(_0x1f6bf1){var _0x3f91de=this;return new Promise(function(_0x4f7209,_0x1faee9){return db[_0x69ed('0x27')][_0x69ed('0x28')]({'raw':_0x1f6bf1[_0x69ed('0x1f')]?_0x1f6bf1[_0x69ed('0x1f')][_0x69ed('0x20')]===undefined?!![]:![]:!![],'where':_0x1f6bf1[_0x69ed('0x1f')]?_0x1f6bf1[_0x69ed('0x1f')][_0x69ed('0x21')]||null:null,'attributes':_0x1f6bf1[_0x69ed('0x1f')]?_0x1f6bf1[_0x69ed('0x1f')]['attributes']||null:null,'include':_0x1f6bf1[_0x69ed('0x1f')]?_0x1f6bf1[_0x69ed('0x1f')][_0x69ed('0x23')]?_['map'](_0x1f6bf1[_0x69ed('0x1f')][_0x69ed('0x23')],function(_0x1cbf57){return{'model':db[_0x1cbf57['model']],'as':_0x1cbf57['as'],'attributes':_0x1cbf57['attributes'],'include':_0x1cbf57[_0x69ed('0x23')]?_[_0x69ed('0x24')](_0x1cbf57[_0x69ed('0x23')],function(_0x22428c){return{'model':db[_0x22428c[_0x69ed('0x25')]],'as':_0x22428c['as'],'attributes':_0x22428c[_0x69ed('0x22')],'include':_0x22428c[_0x69ed('0x23')]?_[_0x69ed('0x24')](_0x22428c['include'],function(_0x564ea1){return{'model':db[_0x564ea1[_0x69ed('0x25')]],'as':_0x564ea1['as'],'attributes':_0x564ea1[_0x69ed('0x22')]};}):[]};}):[]};}):[]:[]})[_0x69ed('0x12')](function(_0x472abc){logger['info'](_0x69ed('0x29'),_0x1f6bf1);logger[_0x69ed('0x16')](_0x69ed('0x29'),_0x1f6bf1,JSON[_0x69ed('0x26')](_0x472abc));_0x4f7209(_0x472abc);})['catch'](function(_0x5f039c){logger['error'](_0x69ed('0x29'),_0x5f039c[_0x69ed('0x1a')],_0x1f6bf1);_0x1faee9(_0x3f91de[_0x69ed('0x18')](0x1f4,_0x5f039c['message']));});});}; \ No newline at end of file +var _0xdbf6=['ShowWhatsappQueue','find','util','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','client','redis','defaults','localhost','socket.io-emitter','./whatsappQueue.socket','register','request','then','info','request\x20sent','debug','stringify','error','code','WhatsappQueue,\x20%s,\x20%s','message','result','GetWhatsappQueue','WhatsappQueue','options','raw','where','limit','map','include','model','attributes'];(function(_0x142691,_0x281ee4){var _0x7ff861=function(_0x19f6a3){while(--_0x19f6a3){_0x142691['push'](_0x142691['shift']());}};_0x7ff861(++_0x281ee4);}(_0xdbf6,0x1a4));var _0x6dbf=function(_0x163dcc,_0x34245a){_0x163dcc=_0x163dcc-0x0;var _0x2aea67=_0xdbf6[_0x163dcc];return _0x2aea67;};'use strict';var _=require('lodash');var util=require(_0x6dbf('0x0'));var moment=require('moment');var BPromise=require('bluebird');var rs=require('randomstring');var fs=require('fs');var Redis=require(_0x6dbf('0x1'));var db=require(_0x6dbf('0x2'))['db'];var utils=require(_0x6dbf('0x3'));var logger=require(_0x6dbf('0x4'))(_0x6dbf('0x5'));var config=require(_0x6dbf('0x6'));var jayson=require(_0x6dbf('0x7'));var client=jayson[_0x6dbf('0x8')]['http']({'port':0x232a});config[_0x6dbf('0x9')]=_[_0x6dbf('0xa')](config[_0x6dbf('0x9')],{'host':_0x6dbf('0xb'),'port':0x18eb});var socket=require(_0x6dbf('0xc'))(new Redis(config[_0x6dbf('0x9')]));require(_0x6dbf('0xd'))[_0x6dbf('0xe')](socket);function respondWithRpcPromise(_0x4d5649,_0x284c14,_0x1b3463){return new BPromise(function(_0x5116cd,_0x1714c3){return client[_0x6dbf('0xf')](_0x4d5649,_0x1b3463)[_0x6dbf('0x10')](function(_0x5cb0ff){logger[_0x6dbf('0x11')]('WhatsappQueue,\x20%s,\x20%s',_0x284c14,_0x6dbf('0x12'));logger[_0x6dbf('0x13')]('WhatsappQueue,\x20%s,\x20%s,\x20%s',_0x284c14,_0x6dbf('0x12'),JSON[_0x6dbf('0x14')](_0x5cb0ff));if(_0x5cb0ff[_0x6dbf('0x15')]){if(_0x5cb0ff[_0x6dbf('0x15')][_0x6dbf('0x16')]===0x1f4){logger[_0x6dbf('0x15')](_0x6dbf('0x17'),_0x284c14,_0x5cb0ff['error'][_0x6dbf('0x18')]);return _0x1714c3(_0x5cb0ff[_0x6dbf('0x15')][_0x6dbf('0x18')]);}logger[_0x6dbf('0x15')](_0x6dbf('0x17'),_0x284c14,_0x5cb0ff[_0x6dbf('0x15')][_0x6dbf('0x18')]);return _0x5116cd(_0x5cb0ff[_0x6dbf('0x15')][_0x6dbf('0x18')]);}else{logger[_0x6dbf('0x11')](_0x6dbf('0x17'),_0x284c14,_0x6dbf('0x12'));_0x5116cd(_0x5cb0ff[_0x6dbf('0x19')][_0x6dbf('0x18')]);}})['catch'](function(_0x50ea02){logger[_0x6dbf('0x15')](_0x6dbf('0x17'),_0x284c14,_0x50ea02);_0x1714c3(_0x50ea02);});});}exports[_0x6dbf('0x1a')]=function(_0x7ed90b){var _0x35e3fb=this;return new Promise(function(_0x237698,_0xadd4b6){return db[_0x6dbf('0x1b')]['findAll']({'raw':_0x7ed90b[_0x6dbf('0x1c')]?_0x7ed90b[_0x6dbf('0x1c')][_0x6dbf('0x1d')]===undefined?!![]:![]:!![],'where':_0x7ed90b[_0x6dbf('0x1c')]?_0x7ed90b[_0x6dbf('0x1c')][_0x6dbf('0x1e')]||null:null,'attributes':_0x7ed90b[_0x6dbf('0x1c')]?_0x7ed90b['options']['attributes']||null:null,'limit':_0x7ed90b['options']?_0x7ed90b[_0x6dbf('0x1c')][_0x6dbf('0x1f')]||null:null,'include':_0x7ed90b[_0x6dbf('0x1c')]?_0x7ed90b[_0x6dbf('0x1c')]['include']?_[_0x6dbf('0x20')](_0x7ed90b[_0x6dbf('0x1c')][_0x6dbf('0x21')],function(_0x25d0ec){return{'model':db[_0x25d0ec[_0x6dbf('0x22')]],'as':_0x25d0ec['as'],'attributes':_0x25d0ec[_0x6dbf('0x23')],'include':_0x25d0ec['include']?_[_0x6dbf('0x20')](_0x25d0ec[_0x6dbf('0x21')],function(_0xdd4c30){return{'model':db[_0xdd4c30['model']],'as':_0xdd4c30['as'],'attributes':_0xdd4c30[_0x6dbf('0x23')],'include':_0xdd4c30[_0x6dbf('0x21')]?_[_0x6dbf('0x20')](_0xdd4c30[_0x6dbf('0x21')],function(_0x4f779b){return{'model':db[_0x4f779b[_0x6dbf('0x22')]],'as':_0x4f779b['as'],'attributes':_0x4f779b[_0x6dbf('0x23')]};}):[]};}):[]};}):[]:[]})['then'](function(_0x227c17){logger[_0x6dbf('0x11')](_0x6dbf('0x1a'),_0x7ed90b);logger[_0x6dbf('0x13')]('GetWhatsappQueue',_0x7ed90b,JSON[_0x6dbf('0x14')](_0x227c17));_0x237698(_0x227c17);})['catch'](function(_0x511f4e){logger[_0x6dbf('0x15')]('GetWhatsappQueue',_0x511f4e[_0x6dbf('0x18')],_0x7ed90b);_0xadd4b6(_0x35e3fb[_0x6dbf('0x15')](0x1f4,_0x511f4e[_0x6dbf('0x18')]));});});};exports[_0x6dbf('0x24')]=function(_0x47ec78){var _0x4be9ee=this;return new Promise(function(_0x328879,_0x12a7f6){return db[_0x6dbf('0x1b')][_0x6dbf('0x25')]({'raw':_0x47ec78[_0x6dbf('0x1c')]?_0x47ec78[_0x6dbf('0x1c')][_0x6dbf('0x1d')]===undefined?!![]:![]:!![],'where':_0x47ec78['options']?_0x47ec78[_0x6dbf('0x1c')]['where']||null:null,'attributes':_0x47ec78[_0x6dbf('0x1c')]?_0x47ec78[_0x6dbf('0x1c')]['attributes']||null:null,'include':_0x47ec78[_0x6dbf('0x1c')]?_0x47ec78[_0x6dbf('0x1c')][_0x6dbf('0x21')]?_[_0x6dbf('0x20')](_0x47ec78['options'][_0x6dbf('0x21')],function(_0x36d149){return{'model':db[_0x36d149['model']],'as':_0x36d149['as'],'attributes':_0x36d149[_0x6dbf('0x23')],'include':_0x36d149[_0x6dbf('0x21')]?_['map'](_0x36d149[_0x6dbf('0x21')],function(_0x5d726c){return{'model':db[_0x5d726c[_0x6dbf('0x22')]],'as':_0x5d726c['as'],'attributes':_0x5d726c['attributes'],'include':_0x5d726c[_0x6dbf('0x21')]?_[_0x6dbf('0x20')](_0x5d726c[_0x6dbf('0x21')],function(_0x2f1a8d){return{'model':db[_0x2f1a8d[_0x6dbf('0x22')]],'as':_0x2f1a8d['as'],'attributes':_0x2f1a8d['attributes']};}):[]};}):[]};}):[]:[]})[_0x6dbf('0x10')](function(_0x2314e0){logger[_0x6dbf('0x11')](_0x6dbf('0x24'),_0x47ec78);logger[_0x6dbf('0x13')](_0x6dbf('0x24'),_0x47ec78,JSON[_0x6dbf('0x14')](_0x2314e0));_0x328879(_0x2314e0);})['catch'](function(_0xab4cf8){logger[_0x6dbf('0x15')](_0x6dbf('0x24'),_0xab4cf8['message'],_0x47ec78);_0x12a7f6(_0x4be9ee[_0x6dbf('0x15')](0x1f4,_0xab4cf8['message']));});});}; \ No newline at end of file diff --git a/server/api/whatsappQueue/whatsappQueue.socket.js b/server/api/whatsappQueue/whatsappQueue.socket.js index 2263655..1697117 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 _0xa12a=['removeListener','register','length','save','remove','emit'];(function(_0x4d01a8,_0x2fafe7){var _0xd9f475=function(_0x47ff57){while(--_0x47ff57){_0x4d01a8['push'](_0x4d01a8['shift']());}};_0xd9f475(++_0x2fafe7);}(_0xa12a,0x105));var _0xaa12=function(_0x47b58b,_0x41a189){_0x47b58b=_0x47b58b-0x0;var _0x46bebe=_0xa12a[_0x47b58b];return _0x46bebe;};'use strict';var WhatsappQueueEvents=require('./whatsappQueue.events');var events=[_0xaa12('0x0'),_0xaa12('0x1'),'update'];function createListener(_0x428ec5,_0x2dcc36){return function(_0x189f67){_0x2dcc36[_0xaa12('0x2')](_0x428ec5,_0x189f67);};}function removeListener(_0x48e3ee,_0x26d3eb){return function(){WhatsappQueueEvents[_0xaa12('0x3')](_0x48e3ee,_0x26d3eb);};}exports[_0xaa12('0x4')]=function(_0x397677){for(var _0x1a6ab=0x0,_0x1af612=events[_0xaa12('0x5')];_0x1a6ab<_0x1af612;_0x1a6ab++){var _0x33aad0=events[_0x1a6ab];var _0x3e8340=createListener('whatsappQueue:'+_0x33aad0,_0x397677);WhatsappQueueEvents['on'](_0x33aad0,_0x3e8340);}}; \ No newline at end of file +var _0xc99c=['emit','removeListener','register','length','whatsappQueue:','./whatsappQueue.events','remove','update'];(function(_0x899a7b,_0x47f3fe){var _0x501574=function(_0x721be2){while(--_0x721be2){_0x899a7b['push'](_0x899a7b['shift']());}};_0x501574(++_0x47f3fe);}(_0xc99c,0x1e5));var _0xcc99=function(_0x5ab3a6,_0x40d1b3){_0x5ab3a6=_0x5ab3a6-0x0;var _0x5699c9=_0xc99c[_0x5ab3a6];return _0x5699c9;};'use strict';var WhatsappQueueEvents=require(_0xcc99('0x0'));var events=['save',_0xcc99('0x1'),_0xcc99('0x2')];function createListener(_0x57650d,_0x32017f){return function(_0x5b9828){_0x32017f[_0xcc99('0x3')](_0x57650d,_0x5b9828);};}function removeListener(_0x4fef57,_0x5b5b31){return function(){WhatsappQueueEvents[_0xcc99('0x4')](_0x4fef57,_0x5b5b31);};}exports[_0xcc99('0x5')]=function(_0x5632a4){for(var _0x4fa677=0x0,_0x326264=events[_0xcc99('0x6')];_0x4fa677<_0x326264;_0x4fa677++){var _0x4c36a3=events[_0x4fa677];var _0xbefdbe=createListener(_0xcc99('0x7')+_0x4c36a3,_0x5632a4);WhatsappQueueEvents['on'](_0x4c36a3,_0xbefdbe);}}; \ No newline at end of file diff --git a/server/api/whatsappQueueReport/index.js b/server/api/whatsappQueueReport/index.js index d610609..21cabbb 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 _0xb225=['get','/describe','describe','/:id','show','post','create','put','update','destroy','exports','multer','path','connect-timeout','express','fs-extra','../../components/auth/service','../../components/interaction/service','./whatsappQueueReport.controller','isAuthenticated','index'];(function(_0x10c01b,_0x428686){var _0x1faf3c=function(_0x3135f7){while(--_0x3135f7){_0x10c01b['push'](_0x10c01b['shift']());}};_0x1faf3c(++_0x428686);}(_0xb225,0x1c4));var _0x5b22=function(_0x8a969d,_0x339d9f){_0x8a969d=_0x8a969d-0x0;var _0x1d8dc7=_0xb225[_0x8a969d];return _0x1d8dc7;};'use strict';var multer=require(_0x5b22('0x0'));var util=require('util');var path=require(_0x5b22('0x1'));var timeout=require(_0x5b22('0x2'));var express=require(_0x5b22('0x3'));var router=express['Router']();var fs_extra=require(_0x5b22('0x4'));var auth=require(_0x5b22('0x5'));var interaction=require(_0x5b22('0x6'));var config=require('../../config/environment');var controller=require(_0x5b22('0x7'));router['get']('/',auth[_0x5b22('0x8')](),controller[_0x5b22('0x9')]);router[_0x5b22('0xa')](_0x5b22('0xb'),auth[_0x5b22('0x8')](),controller[_0x5b22('0xc')]);router[_0x5b22('0xa')](_0x5b22('0xd'),auth[_0x5b22('0x8')](),controller[_0x5b22('0xe')]);router[_0x5b22('0xf')]('/',auth['isAuthenticated'](),controller[_0x5b22('0x10')]);router[_0x5b22('0x11')]('/:id',auth[_0x5b22('0x8')](),controller[_0x5b22('0x12')]);router['delete']('/:id',auth[_0x5b22('0x8')](),controller[_0x5b22('0x13')]);module[_0x5b22('0x14')]=router; \ No newline at end of file +var _0xc674=['path','connect-timeout','Router','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','./whatsappQueueReport.controller','get','index','/describe','describe','/:id','isAuthenticated','show','post','create','put','update','delete','destroy','exports'];(function(_0x25c94d,_0x757dec){var _0x31a8d6=function(_0x491cd9){while(--_0x491cd9){_0x25c94d['push'](_0x25c94d['shift']());}};_0x31a8d6(++_0x757dec);}(_0xc674,0xc6));var _0x4c67=function(_0x2abc3d,_0x48edca){_0x2abc3d=_0x2abc3d-0x0;var _0x252745=_0xc674[_0x2abc3d];return _0x252745;};'use strict';var multer=require('multer');var util=require('util');var path=require(_0x4c67('0x0'));var timeout=require(_0x4c67('0x1'));var express=require('express');var router=express[_0x4c67('0x2')]();var fs_extra=require(_0x4c67('0x3'));var auth=require(_0x4c67('0x4'));var interaction=require(_0x4c67('0x5'));var config=require(_0x4c67('0x6'));var controller=require(_0x4c67('0x7'));router[_0x4c67('0x8')]('/',auth['isAuthenticated'](),controller[_0x4c67('0x9')]);router[_0x4c67('0x8')](_0x4c67('0xa'),auth['isAuthenticated'](),controller[_0x4c67('0xb')]);router[_0x4c67('0x8')](_0x4c67('0xc'),auth[_0x4c67('0xd')](),controller[_0x4c67('0xe')]);router[_0x4c67('0xf')]('/',auth[_0x4c67('0xd')](),controller[_0x4c67('0x10')]);router[_0x4c67('0x11')]('/:id',auth[_0x4c67('0xd')](),controller[_0x4c67('0x12')]);router[_0x4c67('0x13')]('/:id',auth['isAuthenticated'](),controller[_0x4c67('0x14')]);module[_0x4c67('0x15')]=router; \ No newline at end of file diff --git a/server/api/whatsappQueueReport/whatsappQueueReport.attributes.js b/server/api/whatsappQueueReport/whatsappQueueReport.attributes.js index a08ffa6..cc74762 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(_0x2dcd7d,_0x83786e){var _0x399477=function(_0x21a9d7){while(--_0x21a9d7){_0x2dcd7d['push'](_0x2dcd7d['shift']());}};_0x399477(++_0x83786e);}(_0x7a54,0x106));var _0x47a5=function(_0x51dad0,_0x3a7143){_0x51dad0=_0x51dad0-0x0;var _0x3459f9=_0x7a54[_0x51dad0];return _0x3459f9;};'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(_0x5f1621,_0x5ec623){var _0x27230e=function(_0x4ccd34){while(--_0x4ccd34){_0x5f1621['push'](_0x5f1621['shift']());}};_0x27230e(++_0x5ec623);}(_0x7a54,0x106));var _0x47a5=function(_0x35d4fa,_0xb57b8a){_0x35d4fa=_0x35d4fa-0x0;var _0x462835=_0x7a54[_0x35d4fa];return _0x462835;};'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 ddd21c5..37e0b04 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 _0xe5b5=['ioredis','../../components/parsers/qs','../../config/license/hardware','../../config/logger','api','../../config/utils','sendStatus','status','end','offset','undefined','count','Content-Range','json','apply','reject','save','update','then','destroy','stack','name','send','index','rawAttributes','fieldName','type','key','map','query','keys','filters','model','intersection','fields','attributes','length','hasOwnProperty','nolimit','limit','order','sort','pick','filter','where','VIRTUAL','merge','options','WhatsappQueueReport','includeAll','include','findAll','rows','catch','show','create','body','find','params','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','moment','bluebird','mustache','util','path','sox','to-csv','ejs','fs-extra','lodash','squel','crypto','jsforce','desk.js','querystring','papaparse'];(function(_0x42c492,_0x234290){var _0x28073c=function(_0x4d79db){while(--_0x4d79db){_0x42c492['push'](_0x42c492['shift']());}};_0x28073c(++_0x234290);}(_0xe5b5,0x12b));var _0x5e5b=function(_0x42bc91,_0x41f40a){_0x42bc91=_0x42bc91-0x0;var _0x3f5507=_0xe5b5[_0x42bc91];return _0x3f5507;};'use strict';var emlformat=require(_0x5e5b('0x0'));var rimraf=require(_0x5e5b('0x1'));var zipdir=require(_0x5e5b('0x2'));var jsonpatch=require(_0x5e5b('0x3'));var rp=require(_0x5e5b('0x4'));var moment=require(_0x5e5b('0x5'));var BPromise=require(_0x5e5b('0x6'));var Mustache=require(_0x5e5b('0x7'));var util=require(_0x5e5b('0x8'));var path=require(_0x5e5b('0x9'));var sox=require(_0x5e5b('0xa'));var csv=require(_0x5e5b('0xb'));var ejs=require(_0x5e5b('0xc'));var fs=require('fs');var fs_extra=require(_0x5e5b('0xd'));var _=require(_0x5e5b('0xe'));var squel=require(_0x5e5b('0xf'));var crypto=require(_0x5e5b('0x10'));var jsforce=require(_0x5e5b('0x11'));var deskjs=require(_0x5e5b('0x12'));var toCsv=require(_0x5e5b('0xb'));var querystring=require(_0x5e5b('0x13'));var Papa=require(_0x5e5b('0x14'));var Redis=require(_0x5e5b('0x15'));var authService=require('../../components/auth/service');var qs=require(_0x5e5b('0x16'));var as=require('../../components/parsers/advancedSearch');var hardwareService=require(_0x5e5b('0x17'));var logger=require(_0x5e5b('0x18'))(_0x5e5b('0x19'));var utils=require(_0x5e5b('0x1a'));var config=require('../../config/environment');var licenseUtil=require('../../config/license/util');var db=require('../../mysqldb')['db'];function respondWithStatusCode(_0x310f71,_0x18434e){_0x18434e=_0x18434e||0xcc;return function(_0x4559a0){if(_0x4559a0){return _0x310f71[_0x5e5b('0x1b')](_0x18434e);}return _0x310f71[_0x5e5b('0x1c')](_0x18434e)[_0x5e5b('0x1d')]();};}function respondWithResult(_0x2e331d,_0x49edd0){_0x49edd0=_0x49edd0||0xc8;return function(_0x2b37fa){if(_0x2b37fa){return _0x2e331d[_0x5e5b('0x1c')](_0x49edd0)['json'](_0x2b37fa);}};}function respondWithFilteredResult(_0x227417,_0x578c14){return function(_0x4e9509){if(_0x4e9509){var _0x13a1cb=typeof _0x578c14[_0x5e5b('0x1e')]===_0x5e5b('0x1f')&&typeof _0x578c14['limit']===_0x5e5b('0x1f');var _0x4d490c=_0x4e9509[_0x5e5b('0x20')];var _0x45a091=_0x13a1cb?0x0:_0x578c14['offset'];var _0xe5aa6b=_0x13a1cb?_0x4e9509[_0x5e5b('0x20')]:_0x578c14[_0x5e5b('0x1e')]+_0x578c14['limit'];var _0x2bf0b7;if(_0xe5aa6b>=_0x4d490c){_0xe5aa6b=_0x4d490c;_0x2bf0b7=0xc8;}else{_0x2bf0b7=0xce;}_0x227417[_0x5e5b('0x1c')](_0x2bf0b7);return _0x227417['set'](_0x5e5b('0x21'),_0x45a091+'-'+_0xe5aa6b+'/'+_0x4d490c)[_0x5e5b('0x22')](_0x4e9509);}return null;};}function patchUpdates(_0x3c488e){return function(_0x2d8252){try{jsonpatch[_0x5e5b('0x23')](_0x2d8252,_0x3c488e,!![]);}catch(_0x33d61b){return BPromise[_0x5e5b('0x24')](_0x33d61b);}return _0x2d8252[_0x5e5b('0x25')]();};}function saveUpdates(_0x4a78e3,_0x512e46){return function(_0x256a00){if(_0x256a00){return _0x256a00[_0x5e5b('0x26')](_0x4a78e3)[_0x5e5b('0x27')](function(_0xe1c268){return _0xe1c268;});}return null;};}function removeEntity(_0x2e38ed,_0x28cd95){return function(_0x135c6c){if(_0x135c6c){return _0x135c6c[_0x5e5b('0x28')]()[_0x5e5b('0x27')](function(){_0x2e38ed[_0x5e5b('0x1c')](0xcc)[_0x5e5b('0x1d')]();});}};}function handleEntityNotFound(_0x4da321,_0x1ebb11){return function(_0x75800d){if(!_0x75800d){_0x4da321[_0x5e5b('0x1b')](0x194);}return _0x75800d;};}function handleError(_0x5a2ba8,_0x988e5d){_0x988e5d=_0x988e5d||0x1f4;return function(_0xdb2863){logger['error'](_0xdb2863[_0x5e5b('0x29')]);if(_0xdb2863[_0x5e5b('0x2a')]){delete _0xdb2863[_0x5e5b('0x2a')];}_0x5a2ba8[_0x5e5b('0x1c')](_0x988e5d)[_0x5e5b('0x2b')](_0xdb2863);};}exports[_0x5e5b('0x2c')]=function(_0x2cb695,_0x2b4351){var _0x3f6b25={},_0x42da3b={},_0xcb272c={'count':0x0,'rows':[]};var _0x28157a=_['map'](db['WhatsappQueueReport'][_0x5e5b('0x2d')],function(_0x289f54){return{'name':_0x289f54[_0x5e5b('0x2e')],'type':_0x289f54[_0x5e5b('0x2f')][_0x5e5b('0x30')]};});_0x42da3b['model']=_[_0x5e5b('0x31')](_0x28157a,'name');_0x42da3b[_0x5e5b('0x32')]=_[_0x5e5b('0x33')](_0x2cb695[_0x5e5b('0x32')]);_0x42da3b[_0x5e5b('0x34')]=_['intersection'](_0x42da3b[_0x5e5b('0x35')],_0x42da3b[_0x5e5b('0x32')]);_0x3f6b25['attributes']=_[_0x5e5b('0x36')](_0x42da3b[_0x5e5b('0x35')],qs[_0x5e5b('0x37')](_0x2cb695[_0x5e5b('0x32')][_0x5e5b('0x37')]));_0x3f6b25[_0x5e5b('0x38')]=_0x3f6b25[_0x5e5b('0x38')][_0x5e5b('0x39')]?_0x3f6b25['attributes']:_0x42da3b[_0x5e5b('0x35')];if(!_0x2cb695[_0x5e5b('0x32')][_0x5e5b('0x3a')](_0x5e5b('0x3b'))){_0x3f6b25[_0x5e5b('0x3c')]=qs[_0x5e5b('0x3c')](_0x2cb695['query']['limit']);_0x3f6b25[_0x5e5b('0x1e')]=qs[_0x5e5b('0x1e')](_0x2cb695[_0x5e5b('0x32')]['offset']);}_0x3f6b25[_0x5e5b('0x3d')]=qs[_0x5e5b('0x3e')](_0x2cb695[_0x5e5b('0x32')][_0x5e5b('0x3e')]);_0x3f6b25['where']=qs[_0x5e5b('0x34')](_[_0x5e5b('0x3f')](_0x2cb695['query'],_0x42da3b['filters']),_0x28157a);if(_0x2cb695[_0x5e5b('0x32')][_0x5e5b('0x40')]){_0x3f6b25[_0x5e5b('0x41')]=_['merge'](_0x3f6b25[_0x5e5b('0x41')],{'$or':_['map'](_0x28157a,function(_0x5cb741){if(_0x5cb741[_0x5e5b('0x2f')]!==_0x5e5b('0x42')){var _0xef0295={};_0xef0295[_0x5cb741[_0x5e5b('0x2a')]]={'$like':'%'+_0x2cb695[_0x5e5b('0x32')][_0x5e5b('0x40')]+'%'};return _0xef0295;}})});}_0x3f6b25=_[_0x5e5b('0x43')]({},_0x3f6b25,_0x2cb695[_0x5e5b('0x44')]);var _0x1034fa={'where':_0x3f6b25['where']};return db[_0x5e5b('0x45')][_0x5e5b('0x20')](_0x1034fa)['then'](function(_0x204487){_0xcb272c['count']=_0x204487;if(_0x2cb695[_0x5e5b('0x32')][_0x5e5b('0x46')]){_0x3f6b25[_0x5e5b('0x47')]=[{'all':!![]}];}return db[_0x5e5b('0x45')][_0x5e5b('0x48')](_0x3f6b25);})[_0x5e5b('0x27')](function(_0x371550){_0xcb272c[_0x5e5b('0x49')]=_0x371550;return _0xcb272c;})[_0x5e5b('0x27')](respondWithFilteredResult(_0x2b4351,_0x3f6b25))[_0x5e5b('0x4a')](handleError(_0x2b4351,null));};exports[_0x5e5b('0x4b')]=function(_0x4e6fe2,_0x2b81dd){var _0x40e8ce={'raw':!![],'where':{'id':_0x4e6fe2['params']['id']}},_0x46fec9={};_0x46fec9[_0x5e5b('0x35')]=_[_0x5e5b('0x33')](db['WhatsappQueueReport'][_0x5e5b('0x2d')]);_0x46fec9[_0x5e5b('0x32')]=_['keys'](_0x4e6fe2[_0x5e5b('0x32')]);_0x46fec9['filters']=_['intersection'](_0x46fec9['model'],_0x46fec9[_0x5e5b('0x32')]);_0x40e8ce['attributes']=_[_0x5e5b('0x36')](_0x46fec9['model'],qs[_0x5e5b('0x37')](_0x4e6fe2[_0x5e5b('0x32')][_0x5e5b('0x37')]));_0x40e8ce[_0x5e5b('0x38')]=_0x40e8ce[_0x5e5b('0x38')][_0x5e5b('0x39')]?_0x40e8ce[_0x5e5b('0x38')]:_0x46fec9['model'];if(_0x4e6fe2['query'][_0x5e5b('0x46')]){_0x40e8ce['include']=[{'all':!![]}];}_0x40e8ce=_['merge']({},_0x40e8ce,_0x4e6fe2['options']);return db[_0x5e5b('0x45')]['find'](_0x40e8ce)[_0x5e5b('0x27')](handleEntityNotFound(_0x2b81dd,null))[_0x5e5b('0x27')](respondWithResult(_0x2b81dd,null))[_0x5e5b('0x4a')](handleError(_0x2b81dd,null));};exports[_0x5e5b('0x4c')]=function(_0x2982e7,_0x192445){return db['WhatsappQueueReport'][_0x5e5b('0x4c')](_0x2982e7[_0x5e5b('0x4d')],{})['then'](respondWithResult(_0x192445,0xc9))[_0x5e5b('0x4a')](handleError(_0x192445,null));};exports['update']=function(_0x41e4b3,_0x36d8fa){if(_0x41e4b3[_0x5e5b('0x4d')]['id']){delete _0x41e4b3[_0x5e5b('0x4d')]['id'];}return db['WhatsappQueueReport'][_0x5e5b('0x4e')]({'where':{'id':_0x41e4b3[_0x5e5b('0x4f')]['id']}})['then'](handleEntityNotFound(_0x36d8fa,null))[_0x5e5b('0x27')](saveUpdates(_0x41e4b3[_0x5e5b('0x4d')],null))[_0x5e5b('0x27')](respondWithResult(_0x36d8fa,null))[_0x5e5b('0x4a')](handleError(_0x36d8fa,null));};exports[_0x5e5b('0x28')]=function(_0x5ae8d0,_0x50fc9c){return db[_0x5e5b('0x45')][_0x5e5b('0x4e')]({'where':{'id':_0x5ae8d0['params']['id']}})[_0x5e5b('0x27')](handleEntityNotFound(_0x50fc9c,null))[_0x5e5b('0x27')](removeEntity(_0x50fc9c,null))[_0x5e5b('0x4a')](handleError(_0x50fc9c,null));};exports['describe']=function(_0x3f9d26,_0x3e0ce5){return db[_0x5e5b('0x45')]['describe']()[_0x5e5b('0x27')](respondWithResult(_0x3e0ce5,null))[_0x5e5b('0x4a')](handleError(_0x3e0ce5,null));}; \ No newline at end of file +var _0xe1e3=['path','sox','to-csv','ejs','fs-extra','squel','crypto','jsforce','desk.js','querystring','../../components/parsers/qs','../../config/license/hardware','../../config/logger','api','../../config/environment','sendStatus','offset','limit','count','status','set','Content-Range','apply','reject','destroy','then','end','name','index','map','rawAttributes','key','query','keys','filters','intersection','model','fields','attributes','length','nolimit','order','sort','where','pick','filter','merge','type','VIRTUAL','WhatsappQueueReport','includeAll','include','catch','show','params','options','find','create','body','eml-format','rimraf','fast-json-patch','bluebird','util'];(function(_0xa60623,_0x2d4e4f){var _0x4a6487=function(_0xba6cbe){while(--_0xba6cbe){_0xa60623['push'](_0xa60623['shift']());}};_0x4a6487(++_0x2d4e4f);}(_0xe1e3,0x1bb));var _0x3e1e=function(_0xe28ca8,_0x3bf50f){_0xe28ca8=_0xe28ca8-0x0;var _0x2da94f=_0xe1e3[_0xe28ca8];return _0x2da94f;};'use strict';var emlformat=require(_0x3e1e('0x0'));var rimraf=require(_0x3e1e('0x1'));var zipdir=require('zip-dir');var jsonpatch=require(_0x3e1e('0x2'));var rp=require('request-promise');var moment=require('moment');var BPromise=require(_0x3e1e('0x3'));var Mustache=require('mustache');var util=require(_0x3e1e('0x4'));var path=require(_0x3e1e('0x5'));var sox=require(_0x3e1e('0x6'));var csv=require(_0x3e1e('0x7'));var ejs=require(_0x3e1e('0x8'));var fs=require('fs');var fs_extra=require(_0x3e1e('0x9'));var _=require('lodash');var squel=require(_0x3e1e('0xa'));var crypto=require(_0x3e1e('0xb'));var jsforce=require(_0x3e1e('0xc'));var deskjs=require(_0x3e1e('0xd'));var toCsv=require(_0x3e1e('0x7'));var querystring=require(_0x3e1e('0xe'));var Papa=require('papaparse');var Redis=require('ioredis');var authService=require('../../components/auth/service');var qs=require(_0x3e1e('0xf'));var as=require('../../components/parsers/advancedSearch');var hardwareService=require(_0x3e1e('0x10'));var logger=require(_0x3e1e('0x11'))(_0x3e1e('0x12'));var utils=require('../../config/utils');var config=require(_0x3e1e('0x13'));var licenseUtil=require('../../config/license/util');var db=require('../../mysqldb')['db'];function respondWithStatusCode(_0x4e47b9,_0x536129){_0x536129=_0x536129||0xcc;return function(_0x5c09a2){if(_0x5c09a2){return _0x4e47b9[_0x3e1e('0x14')](_0x536129);}return _0x4e47b9['status'](_0x536129)['end']();};}function respondWithResult(_0x3a9375,_0x8bd4cd){_0x8bd4cd=_0x8bd4cd||0xc8;return function(_0x78ee54){if(_0x78ee54){return _0x3a9375['status'](_0x8bd4cd)['json'](_0x78ee54);}};}function respondWithFilteredResult(_0x4131a1,_0x1b62e6){return function(_0x4dca60){if(_0x4dca60){var _0x26cb35=typeof _0x1b62e6[_0x3e1e('0x15')]==='undefined'&&typeof _0x1b62e6[_0x3e1e('0x16')]==='undefined';var _0x23228c=_0x4dca60[_0x3e1e('0x17')];var _0x1d786c=_0x26cb35?0x0:_0x1b62e6[_0x3e1e('0x15')];var _0x791ed8=_0x26cb35?_0x4dca60[_0x3e1e('0x17')]:_0x1b62e6['offset']+_0x1b62e6['limit'];var _0x4a9497;if(_0x791ed8>=_0x23228c){_0x791ed8=_0x23228c;_0x4a9497=0xc8;}else{_0x4a9497=0xce;}_0x4131a1[_0x3e1e('0x18')](_0x4a9497);return _0x4131a1[_0x3e1e('0x19')](_0x3e1e('0x1a'),_0x1d786c+'-'+_0x791ed8+'/'+_0x23228c)['json'](_0x4dca60);}return null;};}function patchUpdates(_0x1c5acd){return function(_0x530815){try{jsonpatch[_0x3e1e('0x1b')](_0x530815,_0x1c5acd,!![]);}catch(_0x33ec1d){return BPromise[_0x3e1e('0x1c')](_0x33ec1d);}return _0x530815['save']();};}function saveUpdates(_0x53e051,_0x96396){return function(_0xefa098){if(_0xefa098){return _0xefa098['update'](_0x53e051)['then'](function(_0x13d7ac){return _0x13d7ac;});}return null;};}function removeEntity(_0x1b5097,_0x488f9f){return function(_0x60e6bc){if(_0x60e6bc){return _0x60e6bc[_0x3e1e('0x1d')]()[_0x3e1e('0x1e')](function(){_0x1b5097[_0x3e1e('0x18')](0xcc)[_0x3e1e('0x1f')]();});}};}function handleEntityNotFound(_0x159212,_0x43d583){return function(_0x21c898){if(!_0x21c898){_0x159212['sendStatus'](0x194);}return _0x21c898;};}function handleError(_0x5d908e,_0x44e419){_0x44e419=_0x44e419||0x1f4;return function(_0x541ef1){logger['error'](_0x541ef1['stack']);if(_0x541ef1['name']){delete _0x541ef1[_0x3e1e('0x20')];}_0x5d908e[_0x3e1e('0x18')](_0x44e419)['send'](_0x541ef1);};}exports[_0x3e1e('0x21')]=function(_0x5ac814,_0xdfcd93){var _0x176bb4={},_0x53a6ff={},_0x43e029={'count':0x0,'rows':[]};var _0x210a84=_[_0x3e1e('0x22')](db['WhatsappQueueReport'][_0x3e1e('0x23')],function(_0x4ec149){return{'name':_0x4ec149['fieldName'],'type':_0x4ec149['type'][_0x3e1e('0x24')]};});_0x53a6ff['model']=_['map'](_0x210a84,_0x3e1e('0x20'));_0x53a6ff[_0x3e1e('0x25')]=_[_0x3e1e('0x26')](_0x5ac814[_0x3e1e('0x25')]);_0x53a6ff[_0x3e1e('0x27')]=_['intersection'](_0x53a6ff['model'],_0x53a6ff['query']);_0x176bb4['attributes']=_[_0x3e1e('0x28')](_0x53a6ff[_0x3e1e('0x29')],qs[_0x3e1e('0x2a')](_0x5ac814[_0x3e1e('0x25')][_0x3e1e('0x2a')]));_0x176bb4[_0x3e1e('0x2b')]=_0x176bb4[_0x3e1e('0x2b')][_0x3e1e('0x2c')]?_0x176bb4['attributes']:_0x53a6ff[_0x3e1e('0x29')];if(!_0x5ac814[_0x3e1e('0x25')]['hasOwnProperty'](_0x3e1e('0x2d'))){_0x176bb4[_0x3e1e('0x16')]=qs[_0x3e1e('0x16')](_0x5ac814[_0x3e1e('0x25')]['limit']);_0x176bb4['offset']=qs[_0x3e1e('0x15')](_0x5ac814[_0x3e1e('0x25')]['offset']);}_0x176bb4[_0x3e1e('0x2e')]=qs[_0x3e1e('0x2f')](_0x5ac814['query'][_0x3e1e('0x2f')]);_0x176bb4[_0x3e1e('0x30')]=qs[_0x3e1e('0x27')](_[_0x3e1e('0x31')](_0x5ac814[_0x3e1e('0x25')],_0x53a6ff['filters']),_0x210a84);if(_0x5ac814[_0x3e1e('0x25')][_0x3e1e('0x32')]){_0x176bb4[_0x3e1e('0x30')]=_[_0x3e1e('0x33')](_0x176bb4['where'],{'$or':_[_0x3e1e('0x22')](_0x210a84,function(_0xf973c9){if(_0xf973c9[_0x3e1e('0x34')]!==_0x3e1e('0x35')){var _0x2cc5c7={};_0x2cc5c7[_0xf973c9[_0x3e1e('0x20')]]={'$like':'%'+_0x5ac814[_0x3e1e('0x25')]['filter']+'%'};return _0x2cc5c7;}})});}_0x176bb4=_[_0x3e1e('0x33')]({},_0x176bb4,_0x5ac814['options']);var _0x53bdf5={'where':_0x176bb4[_0x3e1e('0x30')]};return db[_0x3e1e('0x36')][_0x3e1e('0x17')](_0x53bdf5)['then'](function(_0x3dbd2a){_0x43e029[_0x3e1e('0x17')]=_0x3dbd2a;if(_0x5ac814['query'][_0x3e1e('0x37')]){_0x176bb4[_0x3e1e('0x38')]=[{'all':!![]}];}return db['WhatsappQueueReport']['findAll'](_0x176bb4);})[_0x3e1e('0x1e')](function(_0x49e4cb){_0x43e029['rows']=_0x49e4cb;return _0x43e029;})[_0x3e1e('0x1e')](respondWithFilteredResult(_0xdfcd93,_0x176bb4))[_0x3e1e('0x39')](handleError(_0xdfcd93,null));};exports[_0x3e1e('0x3a')]=function(_0x202748,_0x377a06){var _0x55ea1d={'raw':!![],'where':{'id':_0x202748[_0x3e1e('0x3b')]['id']}},_0x5b32ad={};_0x5b32ad[_0x3e1e('0x29')]=_[_0x3e1e('0x26')](db['WhatsappQueueReport'][_0x3e1e('0x23')]);_0x5b32ad[_0x3e1e('0x25')]=_[_0x3e1e('0x26')](_0x202748['query']);_0x5b32ad[_0x3e1e('0x27')]=_['intersection'](_0x5b32ad['model'],_0x5b32ad[_0x3e1e('0x25')]);_0x55ea1d[_0x3e1e('0x2b')]=_[_0x3e1e('0x28')](_0x5b32ad[_0x3e1e('0x29')],qs['fields'](_0x202748['query']['fields']));_0x55ea1d['attributes']=_0x55ea1d[_0x3e1e('0x2b')][_0x3e1e('0x2c')]?_0x55ea1d['attributes']:_0x5b32ad['model'];if(_0x202748[_0x3e1e('0x25')][_0x3e1e('0x37')]){_0x55ea1d[_0x3e1e('0x38')]=[{'all':!![]}];}_0x55ea1d=_['merge']({},_0x55ea1d,_0x202748[_0x3e1e('0x3c')]);return db['WhatsappQueueReport'][_0x3e1e('0x3d')](_0x55ea1d)[_0x3e1e('0x1e')](handleEntityNotFound(_0x377a06,null))[_0x3e1e('0x1e')](respondWithResult(_0x377a06,null))[_0x3e1e('0x39')](handleError(_0x377a06,null));};exports[_0x3e1e('0x3e')]=function(_0x3de309,_0x53d32b){return db[_0x3e1e('0x36')][_0x3e1e('0x3e')](_0x3de309['body'],{})[_0x3e1e('0x1e')](respondWithResult(_0x53d32b,0xc9))[_0x3e1e('0x39')](handleError(_0x53d32b,null));};exports['update']=function(_0x1cc820,_0x347b3f){if(_0x1cc820[_0x3e1e('0x3f')]['id']){delete _0x1cc820[_0x3e1e('0x3f')]['id'];}return db['WhatsappQueueReport'][_0x3e1e('0x3d')]({'where':{'id':_0x1cc820[_0x3e1e('0x3b')]['id']}})[_0x3e1e('0x1e')](handleEntityNotFound(_0x347b3f,null))[_0x3e1e('0x1e')](saveUpdates(_0x1cc820['body'],null))[_0x3e1e('0x1e')](respondWithResult(_0x347b3f,null))[_0x3e1e('0x39')](handleError(_0x347b3f,null));};exports[_0x3e1e('0x1d')]=function(_0x25ddf7,_0xe2516c){return db[_0x3e1e('0x36')][_0x3e1e('0x3d')]({'where':{'id':_0x25ddf7[_0x3e1e('0x3b')]['id']}})['then'](handleEntityNotFound(_0xe2516c,null))[_0x3e1e('0x1e')](removeEntity(_0xe2516c,null))['catch'](handleError(_0xe2516c,null));};exports['describe']=function(_0x4c8583,_0x1c4269){return db[_0x3e1e('0x36')]['describe']()[_0x3e1e('0x1e')](respondWithResult(_0x1c4269,null))['catch'](handleError(_0x1c4269,null));}; \ No newline at end of file diff --git a/server/api/whatsappQueueReport/whatsappQueueReport.model.js b/server/api/whatsappQueueReport/whatsappQueueReport.model.js index 6eba594..248bf14 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 _0x37ec=['rimraf','../../config/environment','define','lodash','util','../../config/logger','bluebird','request-promise','path'];(function(_0xc67084,_0x3e2efc){var _0x4d06c6=function(_0x2eb951){while(--_0x2eb951){_0xc67084['push'](_0xc67084['shift']());}};_0x4d06c6(++_0x3e2efc);}(_0x37ec,0xc9));var _0xc37e=function(_0x88c88b,_0x18d9ba){_0x88c88b=_0x88c88b-0x0;var _0x4a3fc0=_0x37ec[_0x88c88b];return _0x4a3fc0;};'use strict';var _=require(_0xc37e('0x0'));var util=require(_0xc37e('0x1'));var logger=require(_0xc37e('0x2'))('api');var moment=require('moment');var BPromise=require(_0xc37e('0x3'));var rp=require(_0xc37e('0x4'));var fs=require('fs');var path=require(_0xc37e('0x5'));var rimraf=require(_0xc37e('0x6'));var config=require(_0xc37e('0x7'));var attributes=require('./whatsappQueueReport.attributes');module['exports']=function(_0x29b3f1,_0xaac0a6){return _0x29b3f1[_0xc37e('0x8')]('WhatsappQueueReport',attributes,{'tableName':'report_whatsapp_queue','paranoid':![],'indexes':[{'name':'uniqueid','fields':['uniqueid']}],'timestamps':!![]});}; \ No newline at end of file +var _0x14c3=['api','moment','bluebird','request-promise','path','rimraf','./whatsappQueueReport.attributes','WhatsappQueueReport','report_whatsapp_queue','lodash','util','../../config/logger'];(function(_0x4707a3,_0x106fd8){var _0x33dc9b=function(_0x35f934){while(--_0x35f934){_0x4707a3['push'](_0x4707a3['shift']());}};_0x33dc9b(++_0x106fd8);}(_0x14c3,0x165));var _0x314c=function(_0x242d02,_0x54ebea){_0x242d02=_0x242d02-0x0;var _0xae4c35=_0x14c3[_0x242d02];return _0xae4c35;};'use strict';var _=require(_0x314c('0x0'));var util=require(_0x314c('0x1'));var logger=require(_0x314c('0x2'))(_0x314c('0x3'));var moment=require(_0x314c('0x4'));var BPromise=require(_0x314c('0x5'));var rp=require(_0x314c('0x6'));var fs=require('fs');var path=require(_0x314c('0x7'));var rimraf=require(_0x314c('0x8'));var config=require('../../config/environment');var attributes=require(_0x314c('0x9'));module['exports']=function(_0x23a5b6,_0x127318){return _0x23a5b6['define'](_0x314c('0xa'),attributes,{'tableName':_0x314c('0xb'),'paranoid':![],'indexes':[{'name':'uniqueid','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 980c4b9..08c8e2f 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 _0x773c=['rpc','../../config/environment','jayson/promise','client','http','request','then','info','WhatsappQueueReport,\x20%s,\x20%s','WhatsappQueueReport,\x20%s,\x20%s,\x20%s','request\x20sent','stringify','error','code','message','result','catch','CreateWhatsappQueueReport','body','options','raw','debug','UpdateWhatsappQueueReport','WhatsappQueueReport','update','attributes','limit','util','moment','bluebird','randomstring','../../config/utils','../../config/logger'];(function(_0x17d9e3,_0x1f969c){var _0x14192d=function(_0x159745){while(--_0x159745){_0x17d9e3['push'](_0x17d9e3['shift']());}};_0x14192d(++_0x1f969c);}(_0x773c,0x9f));var _0xc773=function(_0x4fa438,_0x1f15a7){_0x4fa438=_0x4fa438-0x0;var _0x4e3958=_0x773c[_0x4fa438];return _0x4e3958;};'use strict';var _=require('lodash');var util=require(_0xc773('0x0'));var moment=require(_0xc773('0x1'));var BPromise=require(_0xc773('0x2'));var rs=require(_0xc773('0x3'));var fs=require('fs');var Redis=require('ioredis');var db=require('../../mysqldb')['db'];var utils=require(_0xc773('0x4'));var logger=require(_0xc773('0x5'))(_0xc773('0x6'));var config=require(_0xc773('0x7'));var jayson=require(_0xc773('0x8'));var client=jayson[_0xc773('0x9')][_0xc773('0xa')]({'port':0x232a});function respondWithRpcPromise(_0x13597e,_0x6ae152,_0xfad679){return new BPromise(function(_0x2c6e84,_0x21bc8b){return client[_0xc773('0xb')](_0x13597e,_0xfad679)[_0xc773('0xc')](function(_0x1e4789){logger[_0xc773('0xd')](_0xc773('0xe'),_0x6ae152,'request\x20sent');logger['debug'](_0xc773('0xf'),_0x6ae152,_0xc773('0x10'),JSON[_0xc773('0x11')](_0x1e4789));if(_0x1e4789[_0xc773('0x12')]){if(_0x1e4789[_0xc773('0x12')][_0xc773('0x13')]===0x1f4){logger[_0xc773('0x12')]('WhatsappQueueReport,\x20%s,\x20%s',_0x6ae152,_0x1e4789[_0xc773('0x12')][_0xc773('0x14')]);return _0x21bc8b(_0x1e4789[_0xc773('0x12')][_0xc773('0x14')]);}logger[_0xc773('0x12')](_0xc773('0xe'),_0x6ae152,_0x1e4789[_0xc773('0x12')]['message']);return _0x2c6e84(_0x1e4789['error']['message']);}else{logger[_0xc773('0xd')](_0xc773('0xe'),_0x6ae152,_0xc773('0x10'));_0x2c6e84(_0x1e4789[_0xc773('0x15')][_0xc773('0x14')]);}})[_0xc773('0x16')](function(_0x43e92e){logger[_0xc773('0x12')]('WhatsappQueueReport,\x20%s,\x20%s',_0x6ae152,_0x43e92e);_0x21bc8b(_0x43e92e);});});}exports[_0xc773('0x17')]=function(_0x2105f7){var _0x248afa=this;return new Promise(function(_0x36c509,_0x1697bd){return db['WhatsappQueueReport']['create'](_0x2105f7[_0xc773('0x18')],{'raw':_0x2105f7[_0xc773('0x19')]?_0x2105f7[_0xc773('0x19')][_0xc773('0x1a')]===undefined?!![]:![]:!![]})[_0xc773('0xc')](function(_0xdc711){logger[_0xc773('0xd')](_0xc773('0x17'),_0x2105f7);logger[_0xc773('0x1b')](_0xc773('0x17'),_0x2105f7,JSON[_0xc773('0x11')](_0xdc711));_0x36c509(_0xdc711);})[_0xc773('0x16')](function(_0x250720){logger[_0xc773('0x12')]('CreateWhatsappQueueReport',_0x250720[_0xc773('0x14')],_0x2105f7);_0x1697bd(_0x248afa['error'](0x1f4,_0x250720['message']));});});};exports[_0xc773('0x1c')]=function(_0x444ffb){var _0x227fb7=this;return new Promise(function(_0x536984,_0x88a981){return db[_0xc773('0x1d')][_0xc773('0x1e')](_0x444ffb[_0xc773('0x18')],{'raw':_0x444ffb[_0xc773('0x19')]?_0x444ffb[_0xc773('0x19')][_0xc773('0x1a')]===undefined?!![]:![]:!![],'individualHooks':!![],'where':_0x444ffb[_0xc773('0x19')]?_0x444ffb['options']['where']||null:null,'attributes':_0x444ffb[_0xc773('0x19')]?_0x444ffb[_0xc773('0x19')][_0xc773('0x1f')]||null:null,'limit':_0x444ffb['options']?_0x444ffb[_0xc773('0x19')][_0xc773('0x20')]||null:null})['then'](function(_0x2bd23c){logger[_0xc773('0xd')](_0xc773('0x1c'),_0x444ffb);logger[_0xc773('0x1b')](_0xc773('0x1c'),_0x444ffb,JSON[_0xc773('0x11')](_0x2bd23c));_0x536984(_0x2bd23c);})[_0xc773('0x16')](function(_0x226fdd){logger[_0xc773('0x12')](_0xc773('0x1c'),_0x226fdd[_0xc773('0x14')],_0x444ffb);_0x88a981(_0x227fb7[_0xc773('0x12')](0x1f4,_0x226fdd[_0xc773('0x14')]));});});}; \ No newline at end of file +var _0x749d=['error','WhatsappQueueReport,\x20%s,\x20%s','message','catch','CreateWhatsappQueueReport','WhatsappQueueReport','create','body','options','raw','then','update','where','limit','UpdateWhatsappQueueReport','util','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','../../config/environment','jayson/promise','client','info','debug','request\x20sent','stringify'];(function(_0x567a26,_0x873234){var _0x3d90e8=function(_0x5e28df){while(--_0x5e28df){_0x567a26['push'](_0x567a26['shift']());}};_0x3d90e8(++_0x873234);}(_0x749d,0x87));var _0xd749=function(_0x34d130,_0x4697fa){_0x34d130=_0x34d130-0x0;var _0x12e979=_0x749d[_0x34d130];return _0x12e979;};'use strict';var _=require('lodash');var util=require(_0xd749('0x0'));var moment=require(_0xd749('0x1'));var BPromise=require(_0xd749('0x2'));var rs=require(_0xd749('0x3'));var fs=require('fs');var Redis=require(_0xd749('0x4'));var db=require(_0xd749('0x5'))['db'];var utils=require(_0xd749('0x6'));var logger=require(_0xd749('0x7'))('rpc');var config=require(_0xd749('0x8'));var jayson=require(_0xd749('0x9'));var client=jayson[_0xd749('0xa')]['http']({'port':0x232a});function respondWithRpcPromise(_0x495c30,_0x5b503a,_0x40aea6){return new BPromise(function(_0x4ce4b1,_0x2c4ed8){return client['request'](_0x495c30,_0x40aea6)['then'](function(_0x3f44c2){logger[_0xd749('0xb')]('WhatsappQueueReport,\x20%s,\x20%s',_0x5b503a,'request\x20sent');logger[_0xd749('0xc')]('WhatsappQueueReport,\x20%s,\x20%s,\x20%s',_0x5b503a,_0xd749('0xd'),JSON[_0xd749('0xe')](_0x3f44c2));if(_0x3f44c2['error']){if(_0x3f44c2[_0xd749('0xf')]['code']===0x1f4){logger[_0xd749('0xf')](_0xd749('0x10'),_0x5b503a,_0x3f44c2[_0xd749('0xf')][_0xd749('0x11')]);return _0x2c4ed8(_0x3f44c2[_0xd749('0xf')][_0xd749('0x11')]);}logger['error'](_0xd749('0x10'),_0x5b503a,_0x3f44c2[_0xd749('0xf')][_0xd749('0x11')]);return _0x4ce4b1(_0x3f44c2[_0xd749('0xf')]['message']);}else{logger[_0xd749('0xb')](_0xd749('0x10'),_0x5b503a,_0xd749('0xd'));_0x4ce4b1(_0x3f44c2['result'][_0xd749('0x11')]);}})[_0xd749('0x12')](function(_0x781bc1){logger[_0xd749('0xf')](_0xd749('0x10'),_0x5b503a,_0x781bc1);_0x2c4ed8(_0x781bc1);});});}exports[_0xd749('0x13')]=function(_0x24e107){var _0x39e75e=this;return new Promise(function(_0x2c8176,_0x275797){return db[_0xd749('0x14')][_0xd749('0x15')](_0x24e107[_0xd749('0x16')],{'raw':_0x24e107[_0xd749('0x17')]?_0x24e107[_0xd749('0x17')][_0xd749('0x18')]===undefined?!![]:![]:!![]})[_0xd749('0x19')](function(_0x3cceac){logger[_0xd749('0xb')](_0xd749('0x13'),_0x24e107);logger[_0xd749('0xc')](_0xd749('0x13'),_0x24e107,JSON[_0xd749('0xe')](_0x3cceac));_0x2c8176(_0x3cceac);})[_0xd749('0x12')](function(_0x51ae28){logger[_0xd749('0xf')]('CreateWhatsappQueueReport',_0x51ae28[_0xd749('0x11')],_0x24e107);_0x275797(_0x39e75e[_0xd749('0xf')](0x1f4,_0x51ae28['message']));});});};exports['UpdateWhatsappQueueReport']=function(_0x28e041){var _0x2e3208=this;return new Promise(function(_0x464013,_0x190a99){return db[_0xd749('0x14')][_0xd749('0x1a')](_0x28e041[_0xd749('0x16')],{'raw':_0x28e041[_0xd749('0x17')]?_0x28e041[_0xd749('0x17')][_0xd749('0x18')]===undefined?!![]:![]:!![],'individualHooks':!![],'where':_0x28e041[_0xd749('0x17')]?_0x28e041[_0xd749('0x17')][_0xd749('0x1b')]||null:null,'attributes':_0x28e041[_0xd749('0x17')]?_0x28e041[_0xd749('0x17')]['attributes']||null:null,'limit':_0x28e041['options']?_0x28e041['options'][_0xd749('0x1c')]||null:null})['then'](function(_0x507454){logger[_0xd749('0xb')]('UpdateWhatsappQueueReport',_0x28e041);logger['debug'](_0xd749('0x1d'),_0x28e041,JSON[_0xd749('0xe')](_0x507454));_0x464013(_0x507454);})[_0xd749('0x12')](function(_0x23d0c2){logger[_0xd749('0xf')](_0xd749('0x1d'),_0x23d0c2[_0xd749('0x11')],_0x28e041);_0x190a99(_0x2e3208[_0xd749('0xf')](0x1f4,_0x23d0c2[_0xd749('0x11')]));});});}; \ No newline at end of file diff --git a/server/api/whatsappTransferReport/index.js b/server/api/whatsappTransferReport/index.js index 39139a2..35c9215 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 _0xcb3e=['get','isAuthenticated','/:id','show','post','create','exports','util','path','connect-timeout','express','Router','fs-extra','../../components/auth/service','../../components/interaction/service'];(function(_0x18a942,_0x4574b4){var _0x255c5f=function(_0x1b7f26){while(--_0x1b7f26){_0x18a942['push'](_0x18a942['shift']());}};_0x255c5f(++_0x4574b4);}(_0xcb3e,0xf7));var _0xecb3=function(_0x39d024,_0x5c5797){_0x39d024=_0x39d024-0x0;var _0x311bdd=_0xcb3e[_0x39d024];return _0x311bdd;};'use strict';var multer=require('multer');var util=require(_0xecb3('0x0'));var path=require(_0xecb3('0x1'));var timeout=require(_0xecb3('0x2'));var express=require(_0xecb3('0x3'));var router=express[_0xecb3('0x4')]();var fs_extra=require(_0xecb3('0x5'));var auth=require(_0xecb3('0x6'));var interaction=require(_0xecb3('0x7'));var config=require('../../config/environment');var controller=require('./whatsappTransferReport.controller');router[_0xecb3('0x8')]('/',auth['isAuthenticated'](),controller['index']);router[_0xecb3('0x8')]('/describe',auth[_0xecb3('0x9')](),controller['describe']);router[_0xecb3('0x8')](_0xecb3('0xa'),auth[_0xecb3('0x9')](),controller[_0xecb3('0xb')]);router[_0xecb3('0xc')]('/',auth[_0xecb3('0x9')](),controller[_0xecb3('0xd')]);router['put'](_0xecb3('0xa'),auth[_0xecb3('0x9')](),controller['update']);router['delete'](_0xecb3('0xa'),auth[_0xecb3('0x9')](),controller['destroy']);module[_0xecb3('0xe')]=router; \ No newline at end of file +var _0x754d=['create','put','/:id','update','delete','destroy','exports','util','connect-timeout','express','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','get','isAuthenticated','index','describe','show','post'];(function(_0x452ac2,_0x45f034){var _0x5a589a=function(_0x3c3fe8){while(--_0x3c3fe8){_0x452ac2['push'](_0x452ac2['shift']());}};_0x5a589a(++_0x45f034);}(_0x754d,0x133));var _0xd754=function(_0x4be00f,_0x376e69){_0x4be00f=_0x4be00f-0x0;var _0x497069=_0x754d[_0x4be00f];return _0x497069;};'use strict';var multer=require('multer');var util=require(_0xd754('0x0'));var path=require('path');var timeout=require(_0xd754('0x1'));var express=require(_0xd754('0x2'));var router=express['Router']();var fs_extra=require(_0xd754('0x3'));var auth=require(_0xd754('0x4'));var interaction=require(_0xd754('0x5'));var config=require(_0xd754('0x6'));var controller=require('./whatsappTransferReport.controller');router[_0xd754('0x7')]('/',auth[_0xd754('0x8')](),controller[_0xd754('0x9')]);router[_0xd754('0x7')]('/describe',auth[_0xd754('0x8')](),controller[_0xd754('0xa')]);router[_0xd754('0x7')]('/:id',auth['isAuthenticated'](),controller[_0xd754('0xb')]);router[_0xd754('0xc')]('/',auth[_0xd754('0x8')](),controller[_0xd754('0xd')]);router[_0xd754('0xe')](_0xd754('0xf'),auth['isAuthenticated'](),controller[_0xd754('0x10')]);router[_0xd754('0x11')](_0xd754('0xf'),auth[_0xd754('0x8')](),controller[_0xd754('0x12')]);module[_0xd754('0x13')]=router; \ No newline at end of file diff --git a/server/api/whatsappTransferReport/whatsappTransferReport.attributes.js b/server/api/whatsappTransferReport/whatsappTransferReport.attributes.js index a59fdca..2abc97d 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 _0x4c71=['ENUM','account','agent','queue','DATE','sequelize','exports'];(function(_0x2e7ad9,_0x17c7a8){var _0x381f8e=function(_0x3bb3ec){while(--_0x3bb3ec){_0x2e7ad9['push'](_0x2e7ad9['shift']());}};_0x381f8e(++_0x17c7a8);}(_0x4c71,0x12b));var _0x14c7=function(_0x1694f5,_0x49b7c3){_0x1694f5=_0x1694f5-0x0;var _0x5b4321=_0x4c71[_0x1694f5];return _0x5b4321;};'use strict';var Sequelize=require(_0x14c7('0x0'));module[_0x14c7('0x1')]={'uniqueid':{'type':Sequelize['STRING'],'allowNull':![]},'type':{'type':Sequelize[_0x14c7('0x2')](_0x14c7('0x3'),_0x14c7('0x4'),_0x14c7('0x5')),'allowNull':![]},'transferredAt':{'type':Sequelize[_0x14c7('0x6')]}}; \ No newline at end of file +var _0x58d6=['STRING','account','DATE','exports'];(function(_0x5ee61e,_0x8b8882){var _0x51ec1c=function(_0x43cea6){while(--_0x43cea6){_0x5ee61e['push'](_0x5ee61e['shift']());}};_0x51ec1c(++_0x8b8882);}(_0x58d6,0x1d3));var _0x658d=function(_0x34947e,_0x45c404){_0x34947e=_0x34947e-0x0;var _0x87404f=_0x58d6[_0x34947e];return _0x87404f;};'use strict';var Sequelize=require('sequelize');module[_0x658d('0x0')]={'uniqueid':{'type':Sequelize[_0x658d('0x1')],'allowNull':![]},'type':{'type':Sequelize['ENUM'](_0x658d('0x2'),'agent','queue'),'allowNull':![]},'transferredAt':{'type':Sequelize[_0x658d('0x3')]}}; \ No newline at end of file diff --git a/server/api/whatsappTransferReport/whatsappTransferReport.controller.js b/server/api/whatsappTransferReport/whatsappTransferReport.controller.js index bb8bf08..9a3c9f8 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 _0x80cd=['query','keys','filters','model','intersection','fields','attributes','length','hasOwnProperty','nolimit','sort','where','merge','VIRTUAL','options','include','findAll','rows','catch','show','params','includeAll','find','body','destroy','describe','rimraf','zip-dir','fast-json-patch','request-promise','moment','bluebird','mustache','util','sox','to-csv','ejs','fs-extra','squel','crypto','jsforce','desk.js','querystring','../../components/auth/service','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/environment','../../config/license/util','sendStatus','status','end','json','undefined','limit','count','offset','Content-Range','apply','save','update','then','error','stack','name','send','index','map','WhatsappTransferReport','rawAttributes','fieldName','type','key'];(function(_0x10422d,_0x135aa9){var _0x49d2d3=function(_0x321593){while(--_0x321593){_0x10422d['push'](_0x10422d['shift']());}};_0x49d2d3(++_0x135aa9);}(_0x80cd,0x146));var _0xd80c=function(_0x3d27a,_0x31311d){_0x3d27a=_0x3d27a-0x0;var _0x314fd7=_0x80cd[_0x3d27a];return _0x314fd7;};'use strict';var emlformat=require('eml-format');var rimraf=require(_0xd80c('0x0'));var zipdir=require(_0xd80c('0x1'));var jsonpatch=require(_0xd80c('0x2'));var rp=require(_0xd80c('0x3'));var moment=require(_0xd80c('0x4'));var BPromise=require(_0xd80c('0x5'));var Mustache=require(_0xd80c('0x6'));var util=require(_0xd80c('0x7'));var path=require('path');var sox=require(_0xd80c('0x8'));var csv=require(_0xd80c('0x9'));var ejs=require(_0xd80c('0xa'));var fs=require('fs');var fs_extra=require(_0xd80c('0xb'));var _=require('lodash');var squel=require(_0xd80c('0xc'));var crypto=require(_0xd80c('0xd'));var jsforce=require(_0xd80c('0xe'));var deskjs=require(_0xd80c('0xf'));var toCsv=require('to-csv');var querystring=require(_0xd80c('0x10'));var Papa=require('papaparse');var Redis=require('ioredis');var authService=require(_0xd80c('0x11'));var qs=require('../../components/parsers/qs');var as=require(_0xd80c('0x12'));var hardwareService=require(_0xd80c('0x13'));var logger=require(_0xd80c('0x14'))(_0xd80c('0x15'));var utils=require(_0xd80c('0x16'));var config=require(_0xd80c('0x17'));var licenseUtil=require(_0xd80c('0x18'));var db=require('../../mysqldb')['db'];function respondWithStatusCode(_0x35c7e6,_0x107c85){_0x107c85=_0x107c85||0xcc;return function(_0x40f3c3){if(_0x40f3c3){return _0x35c7e6[_0xd80c('0x19')](_0x107c85);}return _0x35c7e6[_0xd80c('0x1a')](_0x107c85)[_0xd80c('0x1b')]();};}function respondWithResult(_0x326efa,_0xe621c7){_0xe621c7=_0xe621c7||0xc8;return function(_0x67c0d1){if(_0x67c0d1){return _0x326efa['status'](_0xe621c7)[_0xd80c('0x1c')](_0x67c0d1);}};}function respondWithFilteredResult(_0x17e98,_0x44b267){return function(_0x315efb){if(_0x315efb){var _0x34419c=typeof _0x44b267['offset']===_0xd80c('0x1d')&&typeof _0x44b267[_0xd80c('0x1e')]===_0xd80c('0x1d');var _0x233677=_0x315efb[_0xd80c('0x1f')];var _0x41aac6=_0x34419c?0x0:_0x44b267[_0xd80c('0x20')];var _0x44fc81=_0x34419c?_0x315efb['count']:_0x44b267[_0xd80c('0x20')]+_0x44b267[_0xd80c('0x1e')];var _0x229710;if(_0x44fc81>=_0x233677){_0x44fc81=_0x233677;_0x229710=0xc8;}else{_0x229710=0xce;}_0x17e98[_0xd80c('0x1a')](_0x229710);return _0x17e98['set'](_0xd80c('0x21'),_0x41aac6+'-'+_0x44fc81+'/'+_0x233677)[_0xd80c('0x1c')](_0x315efb);}return null;};}function patchUpdates(_0x3efb50){return function(_0x52e446){try{jsonpatch[_0xd80c('0x22')](_0x52e446,_0x3efb50,!![]);}catch(_0x1b29a6){return BPromise['reject'](_0x1b29a6);}return _0x52e446[_0xd80c('0x23')]();};}function saveUpdates(_0x588f18,_0x4e7569){return function(_0x5d73b4){if(_0x5d73b4){return _0x5d73b4[_0xd80c('0x24')](_0x588f18)[_0xd80c('0x25')](function(_0x205124){return _0x205124;});}return null;};}function removeEntity(_0x3e564c,_0x391956){return function(_0x48c1b1){if(_0x48c1b1){return _0x48c1b1['destroy']()[_0xd80c('0x25')](function(){_0x3e564c['status'](0xcc)[_0xd80c('0x1b')]();});}};}function handleEntityNotFound(_0x38de68,_0xaed56f){return function(_0x3f0d7e){if(!_0x3f0d7e){_0x38de68['sendStatus'](0x194);}return _0x3f0d7e;};}function handleError(_0x25a220,_0x337fd0){_0x337fd0=_0x337fd0||0x1f4;return function(_0x3bbf75){logger[_0xd80c('0x26')](_0x3bbf75[_0xd80c('0x27')]);if(_0x3bbf75[_0xd80c('0x28')]){delete _0x3bbf75[_0xd80c('0x28')];}_0x25a220[_0xd80c('0x1a')](_0x337fd0)[_0xd80c('0x29')](_0x3bbf75);};}exports[_0xd80c('0x2a')]=function(_0x2829a3,_0x1a7a2c){var _0x473a69={},_0x3d36ca={},_0x2b1ca8={'count':0x0,'rows':[]};var _0x525612=_[_0xd80c('0x2b')](db[_0xd80c('0x2c')][_0xd80c('0x2d')],function(_0x240267){return{'name':_0x240267[_0xd80c('0x2e')],'type':_0x240267[_0xd80c('0x2f')][_0xd80c('0x30')]};});_0x3d36ca['model']=_[_0xd80c('0x2b')](_0x525612,_0xd80c('0x28'));_0x3d36ca[_0xd80c('0x31')]=_[_0xd80c('0x32')](_0x2829a3['query']);_0x3d36ca[_0xd80c('0x33')]=_['intersection'](_0x3d36ca[_0xd80c('0x34')],_0x3d36ca[_0xd80c('0x31')]);_0x473a69['attributes']=_[_0xd80c('0x35')](_0x3d36ca['model'],qs[_0xd80c('0x36')](_0x2829a3[_0xd80c('0x31')]['fields']));_0x473a69[_0xd80c('0x37')]=_0x473a69[_0xd80c('0x37')][_0xd80c('0x38')]?_0x473a69[_0xd80c('0x37')]:_0x3d36ca[_0xd80c('0x34')];if(!_0x2829a3[_0xd80c('0x31')][_0xd80c('0x39')](_0xd80c('0x3a'))){_0x473a69['limit']=qs[_0xd80c('0x1e')](_0x2829a3[_0xd80c('0x31')][_0xd80c('0x1e')]);_0x473a69['offset']=qs[_0xd80c('0x20')](_0x2829a3[_0xd80c('0x31')][_0xd80c('0x20')]);}_0x473a69['order']=qs['sort'](_0x2829a3[_0xd80c('0x31')][_0xd80c('0x3b')]);_0x473a69[_0xd80c('0x3c')]=qs[_0xd80c('0x33')](_['pick'](_0x2829a3[_0xd80c('0x31')],_0x3d36ca[_0xd80c('0x33')]),_0x525612);if(_0x2829a3['query']['filter']){_0x473a69['where']=_[_0xd80c('0x3d')](_0x473a69[_0xd80c('0x3c')],{'$or':_[_0xd80c('0x2b')](_0x525612,function(_0xb1dd27){if(_0xb1dd27[_0xd80c('0x2f')]!==_0xd80c('0x3e')){var _0x36a4e7={};_0x36a4e7[_0xb1dd27[_0xd80c('0x28')]]={'$like':'%'+_0x2829a3[_0xd80c('0x31')]['filter']+'%'};return _0x36a4e7;}})});}_0x473a69=_['merge']({},_0x473a69,_0x2829a3[_0xd80c('0x3f')]);var _0x508f7e={'where':_0x473a69[_0xd80c('0x3c')]};return db[_0xd80c('0x2c')][_0xd80c('0x1f')](_0x508f7e)[_0xd80c('0x25')](function(_0xa39162){_0x2b1ca8[_0xd80c('0x1f')]=_0xa39162;if(_0x2829a3[_0xd80c('0x31')]['includeAll']){_0x473a69[_0xd80c('0x40')]=[{'all':!![]}];}return db[_0xd80c('0x2c')][_0xd80c('0x41')](_0x473a69);})[_0xd80c('0x25')](function(_0x1a2637){_0x2b1ca8[_0xd80c('0x42')]=_0x1a2637;return _0x2b1ca8;})[_0xd80c('0x25')](respondWithFilteredResult(_0x1a7a2c,_0x473a69))[_0xd80c('0x43')](handleError(_0x1a7a2c,null));};exports[_0xd80c('0x44')]=function(_0x1920c5,_0x32d4fa){var _0x58bdf0={'raw':!![],'where':{'id':_0x1920c5[_0xd80c('0x45')]['id']}},_0x55a494={};_0x55a494['model']=_[_0xd80c('0x32')](db['WhatsappTransferReport'][_0xd80c('0x2d')]);_0x55a494[_0xd80c('0x31')]=_[_0xd80c('0x32')](_0x1920c5[_0xd80c('0x31')]);_0x55a494[_0xd80c('0x33')]=_[_0xd80c('0x35')](_0x55a494[_0xd80c('0x34')],_0x55a494[_0xd80c('0x31')]);_0x58bdf0['attributes']=_['intersection'](_0x55a494[_0xd80c('0x34')],qs[_0xd80c('0x36')](_0x1920c5['query']['fields']));_0x58bdf0[_0xd80c('0x37')]=_0x58bdf0['attributes']['length']?_0x58bdf0[_0xd80c('0x37')]:_0x55a494['model'];if(_0x1920c5['query'][_0xd80c('0x46')]){_0x58bdf0['include']=[{'all':!![]}];}_0x58bdf0=_[_0xd80c('0x3d')]({},_0x58bdf0,_0x1920c5['options']);return db[_0xd80c('0x2c')][_0xd80c('0x47')](_0x58bdf0)['then'](handleEntityNotFound(_0x32d4fa,null))[_0xd80c('0x25')](respondWithResult(_0x32d4fa,null))[_0xd80c('0x43')](handleError(_0x32d4fa,null));};exports['create']=function(_0x4fcddd,_0x154633){return db[_0xd80c('0x2c')]['create'](_0x4fcddd[_0xd80c('0x48')],{})['then'](respondWithResult(_0x154633,0xc9))[_0xd80c('0x43')](handleError(_0x154633,null));};exports['update']=function(_0xde4804,_0xdd2aa2){if(_0xde4804[_0xd80c('0x48')]['id']){delete _0xde4804[_0xd80c('0x48')]['id'];}return db[_0xd80c('0x2c')][_0xd80c('0x47')]({'where':{'id':_0xde4804[_0xd80c('0x45')]['id']}})['then'](handleEntityNotFound(_0xdd2aa2,null))[_0xd80c('0x25')](saveUpdates(_0xde4804[_0xd80c('0x48')],null))[_0xd80c('0x25')](respondWithResult(_0xdd2aa2,null))['catch'](handleError(_0xdd2aa2,null));};exports[_0xd80c('0x49')]=function(_0x11c2b2,_0x27ce81){return db[_0xd80c('0x2c')][_0xd80c('0x47')]({'where':{'id':_0x11c2b2['params']['id']}})['then'](handleEntityNotFound(_0x27ce81,null))[_0xd80c('0x25')](removeEntity(_0x27ce81,null))[_0xd80c('0x43')](handleError(_0x27ce81,null));};exports[_0xd80c('0x4a')]=function(_0x104398,_0x395666){return db[_0xd80c('0x2c')][_0xd80c('0x4a')]()[_0xd80c('0x25')](respondWithResult(_0x395666,null))[_0xd80c('0x43')](handleError(_0x395666,null));}; \ No newline at end of file +var _0x6ff6=['sendStatus','stack','name','send','index','map','fieldName','type','model','keys','query','filters','intersection','fields','attributes','length','nolimit','where','pick','filter','merge','VIRTUAL','WhatsappTransferReport','includeAll','include','findAll','rows','catch','show','params','rawAttributes','options','find','create','body','describe','zip-dir','fast-json-patch','request-promise','moment','bluebird','mustache','util','to-csv','ejs','squel','crypto','desk.js','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/environment','../../config/license/util','../../mysqldb','status','end','offset','limit','undefined','count','set','Content-Range','apply','reject','update','then','destroy'];(function(_0x25e7cb,_0x3579b7){var _0x375d92=function(_0xe8cf3b){while(--_0xe8cf3b){_0x25e7cb['push'](_0x25e7cb['shift']());}};_0x375d92(++_0x3579b7);}(_0x6ff6,0x182));var _0x66ff=function(_0x5df88d,_0x1da123){_0x5df88d=_0x5df88d-0x0;var _0x5217d3=_0x6ff6[_0x5df88d];return _0x5217d3;};'use strict';var emlformat=require('eml-format');var rimraf=require('rimraf');var zipdir=require(_0x66ff('0x0'));var jsonpatch=require(_0x66ff('0x1'));var rp=require(_0x66ff('0x2'));var moment=require(_0x66ff('0x3'));var BPromise=require(_0x66ff('0x4'));var Mustache=require(_0x66ff('0x5'));var util=require(_0x66ff('0x6'));var path=require('path');var sox=require('sox');var csv=require(_0x66ff('0x7'));var ejs=require(_0x66ff('0x8'));var fs=require('fs');var fs_extra=require('fs-extra');var _=require('lodash');var squel=require(_0x66ff('0x9'));var crypto=require(_0x66ff('0xa'));var jsforce=require('jsforce');var deskjs=require(_0x66ff('0xb'));var toCsv=require(_0x66ff('0x7'));var querystring=require(_0x66ff('0xc'));var Papa=require(_0x66ff('0xd'));var Redis=require(_0x66ff('0xe'));var authService=require(_0x66ff('0xf'));var qs=require(_0x66ff('0x10'));var as=require(_0x66ff('0x11'));var hardwareService=require('../../config/license/hardware');var logger=require('../../config/logger')('api');var utils=require('../../config/utils');var config=require(_0x66ff('0x12'));var licenseUtil=require(_0x66ff('0x13'));var db=require(_0x66ff('0x14'))['db'];function respondWithStatusCode(_0x2b0af7,_0x5711f7){_0x5711f7=_0x5711f7||0xcc;return function(_0x216b61){if(_0x216b61){return _0x2b0af7['sendStatus'](_0x5711f7);}return _0x2b0af7[_0x66ff('0x15')](_0x5711f7)[_0x66ff('0x16')]();};}function respondWithResult(_0x210cdd,_0x4633ba){_0x4633ba=_0x4633ba||0xc8;return function(_0xaea9ff){if(_0xaea9ff){return _0x210cdd[_0x66ff('0x15')](_0x4633ba)['json'](_0xaea9ff);}};}function respondWithFilteredResult(_0x16b1d8,_0x126107){return function(_0x36b0be){if(_0x36b0be){var _0x55d1d1=typeof _0x126107[_0x66ff('0x17')]==='undefined'&&typeof _0x126107[_0x66ff('0x18')]===_0x66ff('0x19');var _0x402cae=_0x36b0be[_0x66ff('0x1a')];var _0x33188b=_0x55d1d1?0x0:_0x126107[_0x66ff('0x17')];var _0x1eaade=_0x55d1d1?_0x36b0be[_0x66ff('0x1a')]:_0x126107[_0x66ff('0x17')]+_0x126107[_0x66ff('0x18')];var _0x3e5e2d;if(_0x1eaade>=_0x402cae){_0x1eaade=_0x402cae;_0x3e5e2d=0xc8;}else{_0x3e5e2d=0xce;}_0x16b1d8[_0x66ff('0x15')](_0x3e5e2d);return _0x16b1d8[_0x66ff('0x1b')](_0x66ff('0x1c'),_0x33188b+'-'+_0x1eaade+'/'+_0x402cae)['json'](_0x36b0be);}return null;};}function patchUpdates(_0x25646d){return function(_0x55cb9d){try{jsonpatch[_0x66ff('0x1d')](_0x55cb9d,_0x25646d,!![]);}catch(_0x5e6e3b){return BPromise[_0x66ff('0x1e')](_0x5e6e3b);}return _0x55cb9d['save']();};}function saveUpdates(_0x4841f3,_0x231d23){return function(_0x1b89d2){if(_0x1b89d2){return _0x1b89d2[_0x66ff('0x1f')](_0x4841f3)[_0x66ff('0x20')](function(_0x30ec8f){return _0x30ec8f;});}return null;};}function removeEntity(_0x131d60,_0x26ddb6){return function(_0x17ed70){if(_0x17ed70){return _0x17ed70[_0x66ff('0x21')]()[_0x66ff('0x20')](function(){_0x131d60[_0x66ff('0x15')](0xcc)[_0x66ff('0x16')]();});}};}function handleEntityNotFound(_0x317fca,_0x62b38a){return function(_0x1b9292){if(!_0x1b9292){_0x317fca[_0x66ff('0x22')](0x194);}return _0x1b9292;};}function handleError(_0x8b656c,_0x5da57d){_0x5da57d=_0x5da57d||0x1f4;return function(_0x1dac84){logger['error'](_0x1dac84[_0x66ff('0x23')]);if(_0x1dac84['name']){delete _0x1dac84[_0x66ff('0x24')];}_0x8b656c['status'](_0x5da57d)[_0x66ff('0x25')](_0x1dac84);};}exports[_0x66ff('0x26')]=function(_0x61b09b,_0x1a62c9){var _0x1d4b6f={},_0xa13f2b={},_0x4a37af={'count':0x0,'rows':[]};var _0x12b1e1=_[_0x66ff('0x27')](db['WhatsappTransferReport']['rawAttributes'],function(_0x318888){return{'name':_0x318888[_0x66ff('0x28')],'type':_0x318888[_0x66ff('0x29')]['key']};});_0xa13f2b[_0x66ff('0x2a')]=_['map'](_0x12b1e1,'name');_0xa13f2b['query']=_[_0x66ff('0x2b')](_0x61b09b[_0x66ff('0x2c')]);_0xa13f2b[_0x66ff('0x2d')]=_[_0x66ff('0x2e')](_0xa13f2b[_0x66ff('0x2a')],_0xa13f2b[_0x66ff('0x2c')]);_0x1d4b6f['attributes']=_[_0x66ff('0x2e')](_0xa13f2b['model'],qs[_0x66ff('0x2f')](_0x61b09b['query'][_0x66ff('0x2f')]));_0x1d4b6f[_0x66ff('0x30')]=_0x1d4b6f[_0x66ff('0x30')][_0x66ff('0x31')]?_0x1d4b6f[_0x66ff('0x30')]:_0xa13f2b[_0x66ff('0x2a')];if(!_0x61b09b[_0x66ff('0x2c')]['hasOwnProperty'](_0x66ff('0x32'))){_0x1d4b6f[_0x66ff('0x18')]=qs['limit'](_0x61b09b[_0x66ff('0x2c')][_0x66ff('0x18')]);_0x1d4b6f[_0x66ff('0x17')]=qs[_0x66ff('0x17')](_0x61b09b['query'][_0x66ff('0x17')]);}_0x1d4b6f['order']=qs['sort'](_0x61b09b[_0x66ff('0x2c')]['sort']);_0x1d4b6f[_0x66ff('0x33')]=qs[_0x66ff('0x2d')](_[_0x66ff('0x34')](_0x61b09b[_0x66ff('0x2c')],_0xa13f2b['filters']),_0x12b1e1);if(_0x61b09b[_0x66ff('0x2c')][_0x66ff('0x35')]){_0x1d4b6f[_0x66ff('0x33')]=_[_0x66ff('0x36')](_0x1d4b6f['where'],{'$or':_[_0x66ff('0x27')](_0x12b1e1,function(_0x580d45){if(_0x580d45[_0x66ff('0x29')]!==_0x66ff('0x37')){var _0xab1153={};_0xab1153[_0x580d45[_0x66ff('0x24')]]={'$like':'%'+_0x61b09b['query'][_0x66ff('0x35')]+'%'};return _0xab1153;}})});}_0x1d4b6f=_['merge']({},_0x1d4b6f,_0x61b09b['options']);var _0x3b55e4={'where':_0x1d4b6f[_0x66ff('0x33')]};return db[_0x66ff('0x38')][_0x66ff('0x1a')](_0x3b55e4)[_0x66ff('0x20')](function(_0x420bdc){_0x4a37af[_0x66ff('0x1a')]=_0x420bdc;if(_0x61b09b[_0x66ff('0x2c')][_0x66ff('0x39')]){_0x1d4b6f[_0x66ff('0x3a')]=[{'all':!![]}];}return db[_0x66ff('0x38')][_0x66ff('0x3b')](_0x1d4b6f);})[_0x66ff('0x20')](function(_0x1d15df){_0x4a37af[_0x66ff('0x3c')]=_0x1d15df;return _0x4a37af;})[_0x66ff('0x20')](respondWithFilteredResult(_0x1a62c9,_0x1d4b6f))[_0x66ff('0x3d')](handleError(_0x1a62c9,null));};exports[_0x66ff('0x3e')]=function(_0x3ca809,_0x3edd24){var _0x910843={'raw':!![],'where':{'id':_0x3ca809[_0x66ff('0x3f')]['id']}},_0x3a9fc7={};_0x3a9fc7['model']=_[_0x66ff('0x2b')](db[_0x66ff('0x38')][_0x66ff('0x40')]);_0x3a9fc7[_0x66ff('0x2c')]=_[_0x66ff('0x2b')](_0x3ca809['query']);_0x3a9fc7[_0x66ff('0x2d')]=_['intersection'](_0x3a9fc7[_0x66ff('0x2a')],_0x3a9fc7[_0x66ff('0x2c')]);_0x910843[_0x66ff('0x30')]=_[_0x66ff('0x2e')](_0x3a9fc7[_0x66ff('0x2a')],qs[_0x66ff('0x2f')](_0x3ca809[_0x66ff('0x2c')][_0x66ff('0x2f')]));_0x910843['attributes']=_0x910843[_0x66ff('0x30')][_0x66ff('0x31')]?_0x910843[_0x66ff('0x30')]:_0x3a9fc7['model'];if(_0x3ca809[_0x66ff('0x2c')][_0x66ff('0x39')]){_0x910843['include']=[{'all':!![]}];}_0x910843=_[_0x66ff('0x36')]({},_0x910843,_0x3ca809[_0x66ff('0x41')]);return db[_0x66ff('0x38')][_0x66ff('0x42')](_0x910843)[_0x66ff('0x20')](handleEntityNotFound(_0x3edd24,null))[_0x66ff('0x20')](respondWithResult(_0x3edd24,null))[_0x66ff('0x3d')](handleError(_0x3edd24,null));};exports[_0x66ff('0x43')]=function(_0x3f8f3f,_0x29e97d){return db[_0x66ff('0x38')][_0x66ff('0x43')](_0x3f8f3f[_0x66ff('0x44')],{})[_0x66ff('0x20')](respondWithResult(_0x29e97d,0xc9))['catch'](handleError(_0x29e97d,null));};exports[_0x66ff('0x1f')]=function(_0x4c80a5,_0x2988c0){if(_0x4c80a5['body']['id']){delete _0x4c80a5[_0x66ff('0x44')]['id'];}return db[_0x66ff('0x38')][_0x66ff('0x42')]({'where':{'id':_0x4c80a5[_0x66ff('0x3f')]['id']}})[_0x66ff('0x20')](handleEntityNotFound(_0x2988c0,null))[_0x66ff('0x20')](saveUpdates(_0x4c80a5[_0x66ff('0x44')],null))[_0x66ff('0x20')](respondWithResult(_0x2988c0,null))[_0x66ff('0x3d')](handleError(_0x2988c0,null));};exports['destroy']=function(_0x5b8c5e,_0x8b495a){return db[_0x66ff('0x38')][_0x66ff('0x42')]({'where':{'id':_0x5b8c5e[_0x66ff('0x3f')]['id']}})[_0x66ff('0x20')](handleEntityNotFound(_0x8b495a,null))[_0x66ff('0x20')](removeEntity(_0x8b495a,null))[_0x66ff('0x3d')](handleError(_0x8b495a,null));};exports[_0x66ff('0x45')]=function(_0x222fac,_0x437c46){return db[_0x66ff('0x38')][_0x66ff('0x45')]()[_0x66ff('0x20')](respondWithResult(_0x437c46,null))[_0x66ff('0x3d')](handleError(_0x437c46,null));}; \ No newline at end of file diff --git a/server/api/whatsappTransferReport/whatsappTransferReport.model.js b/server/api/whatsappTransferReport/whatsappTransferReport.model.js index d3b75b3..4346e83 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 _0xc2e3=['rimraf','../../config/environment','exports','define','WhatsappTransferReport','report_whatsapp_transfer','uniqueid','lodash','util','../../config/logger','moment','bluebird','request-promise'];(function(_0x4ae6ef,_0xc2af80){var _0x3cbb4e=function(_0x569ad5){while(--_0x569ad5){_0x4ae6ef['push'](_0x4ae6ef['shift']());}};_0x3cbb4e(++_0xc2af80);}(_0xc2e3,0xa3));var _0x3c2e=function(_0x49439f,_0x318d0f){_0x49439f=_0x49439f-0x0;var _0x5a76f9=_0xc2e3[_0x49439f];return _0x5a76f9;};'use strict';var _=require(_0x3c2e('0x0'));var util=require(_0x3c2e('0x1'));var logger=require(_0x3c2e('0x2'))('api');var moment=require(_0x3c2e('0x3'));var BPromise=require(_0x3c2e('0x4'));var rp=require(_0x3c2e('0x5'));var fs=require('fs');var path=require('path');var rimraf=require(_0x3c2e('0x6'));var config=require(_0x3c2e('0x7'));var attributes=require('./whatsappTransferReport.attributes');module[_0x3c2e('0x8')]=function(_0x43b69e,_0x1a655d){return _0x43b69e[_0x3c2e('0x9')](_0x3c2e('0xa'),attributes,{'tableName':_0x3c2e('0xb'),'paranoid':![],'indexes':[{'name':_0x3c2e('0xc'),'fields':[_0x3c2e('0xc')]}],'timestamps':!![]});}; \ No newline at end of file +var _0x573b=['lodash','util','../../config/logger','moment','bluebird','request-promise','path','rimraf','../../config/environment','./whatsappTransferReport.attributes','WhatsappTransferReport','report_whatsapp_transfer','uniqueid'];(function(_0x5ca644,_0x3d2165){var _0x5c87a2=function(_0x3dc7d9){while(--_0x3dc7d9){_0x5ca644['push'](_0x5ca644['shift']());}};_0x5c87a2(++_0x3d2165);}(_0x573b,0x82));var _0xb573=function(_0x242e2a,_0x28ca81){_0x242e2a=_0x242e2a-0x0;var _0x5c2e4d=_0x573b[_0x242e2a];return _0x5c2e4d;};'use strict';var _=require(_0xb573('0x0'));var util=require(_0xb573('0x1'));var logger=require(_0xb573('0x2'))('api');var moment=require(_0xb573('0x3'));var BPromise=require(_0xb573('0x4'));var rp=require(_0xb573('0x5'));var fs=require('fs');var path=require(_0xb573('0x6'));var rimraf=require(_0xb573('0x7'));var config=require(_0xb573('0x8'));var attributes=require(_0xb573('0x9'));module['exports']=function(_0x1de747,_0x170bd1){return _0x1de747['define'](_0xb573('0xa'),attributes,{'tableName':_0xb573('0xb'),'paranoid':![],'indexes':[{'name':_0xb573('0xc'),'fields':[_0xb573('0xc')]}],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/whatsappTransferReport/whatsappTransferReport.rpc.js b/server/api/whatsappTransferReport/whatsappTransferReport.rpc.js index a8624ec..e8cf1ca 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 _0xad13=['client','http','request','then','info','WhatsappTransferReport,\x20%s,\x20%s','debug','WhatsappTransferReport,\x20%s,\x20%s,\x20%s','request\x20sent','stringify','error','code','message','result','lodash','util','moment','bluebird','ioredis','../../mysqldb','../../config/utils','../../config/environment','jayson/promise'];(function(_0x565719,_0x4d27a6){var _0x37bc1b=function(_0x2725c0){while(--_0x2725c0){_0x565719['push'](_0x565719['shift']());}};_0x37bc1b(++_0x4d27a6);}(_0xad13,0x122));var _0x3ad1=function(_0x3ae260,_0xb767ec){_0x3ae260=_0x3ae260-0x0;var _0x588590=_0xad13[_0x3ae260];return _0x588590;};'use strict';var _=require(_0x3ad1('0x0'));var util=require(_0x3ad1('0x1'));var moment=require(_0x3ad1('0x2'));var BPromise=require(_0x3ad1('0x3'));var rs=require('randomstring');var fs=require('fs');var Redis=require(_0x3ad1('0x4'));var db=require(_0x3ad1('0x5'))['db'];var utils=require(_0x3ad1('0x6'));var logger=require('../../config/logger')('rpc');var config=require(_0x3ad1('0x7'));var jayson=require(_0x3ad1('0x8'));var client=jayson[_0x3ad1('0x9')][_0x3ad1('0xa')]({'port':0x232a});function respondWithRpcPromise(_0x469002,_0x43a0ff,_0x5815fb){return new BPromise(function(_0x28be06,_0x471470){return client[_0x3ad1('0xb')](_0x469002,_0x5815fb)[_0x3ad1('0xc')](function(_0x49b27f){logger[_0x3ad1('0xd')](_0x3ad1('0xe'),_0x43a0ff,'request\x20sent');logger[_0x3ad1('0xf')](_0x3ad1('0x10'),_0x43a0ff,_0x3ad1('0x11'),JSON[_0x3ad1('0x12')](_0x49b27f));if(_0x49b27f[_0x3ad1('0x13')]){if(_0x49b27f[_0x3ad1('0x13')][_0x3ad1('0x14')]===0x1f4){logger[_0x3ad1('0x13')]('WhatsappTransferReport,\x20%s,\x20%s',_0x43a0ff,_0x49b27f[_0x3ad1('0x13')][_0x3ad1('0x15')]);return _0x471470(_0x49b27f[_0x3ad1('0x13')][_0x3ad1('0x15')]);}logger[_0x3ad1('0x13')](_0x3ad1('0xe'),_0x43a0ff,_0x49b27f[_0x3ad1('0x13')]['message']);return _0x28be06(_0x49b27f['error']['message']);}else{logger[_0x3ad1('0xd')](_0x3ad1('0xe'),_0x43a0ff,_0x3ad1('0x11'));_0x28be06(_0x49b27f[_0x3ad1('0x16')][_0x3ad1('0x15')]);}})['catch'](function(_0x378b6d){logger[_0x3ad1('0x13')]('WhatsappTransferReport,\x20%s,\x20%s',_0x43a0ff,_0x378b6d);_0x471470(_0x378b6d);});});} \ No newline at end of file +var _0x5729=['../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','client','http','request','then','request\x20sent','debug','WhatsappTransferReport,\x20%s,\x20%s,\x20%s','stringify','error','code','WhatsappTransferReport,\x20%s,\x20%s','message','info','util','moment','bluebird','randomstring','ioredis'];(function(_0x39ab27,_0x2c7e2d){var _0x2345bc=function(_0x29d18a){while(--_0x29d18a){_0x39ab27['push'](_0x39ab27['shift']());}};_0x2345bc(++_0x2c7e2d);}(_0x5729,0xe1));var _0x9572=function(_0x25c988,_0xce8221){_0x25c988=_0x25c988-0x0;var _0x45fcc2=_0x5729[_0x25c988];return _0x45fcc2;};'use strict';var _=require('lodash');var util=require(_0x9572('0x0'));var moment=require(_0x9572('0x1'));var BPromise=require(_0x9572('0x2'));var rs=require(_0x9572('0x3'));var fs=require('fs');var Redis=require(_0x9572('0x4'));var db=require(_0x9572('0x5'))['db'];var utils=require(_0x9572('0x6'));var logger=require(_0x9572('0x7'))(_0x9572('0x8'));var config=require(_0x9572('0x9'));var jayson=require('jayson/promise');var client=jayson[_0x9572('0xa')][_0x9572('0xb')]({'port':0x232a});function respondWithRpcPromise(_0x56b482,_0x2890dd,_0x44075c){return new BPromise(function(_0xc757e0,_0x48f674){return client[_0x9572('0xc')](_0x56b482,_0x44075c)[_0x9572('0xd')](function(_0x5c0a55){logger['info']('WhatsappTransferReport,\x20%s,\x20%s',_0x2890dd,_0x9572('0xe'));logger[_0x9572('0xf')](_0x9572('0x10'),_0x2890dd,_0x9572('0xe'),JSON[_0x9572('0x11')](_0x5c0a55));if(_0x5c0a55['error']){if(_0x5c0a55[_0x9572('0x12')][_0x9572('0x13')]===0x1f4){logger[_0x9572('0x12')](_0x9572('0x14'),_0x2890dd,_0x5c0a55[_0x9572('0x12')][_0x9572('0x15')]);return _0x48f674(_0x5c0a55[_0x9572('0x12')][_0x9572('0x15')]);}logger[_0x9572('0x12')](_0x9572('0x14'),_0x2890dd,_0x5c0a55[_0x9572('0x12')][_0x9572('0x15')]);return _0xc757e0(_0x5c0a55[_0x9572('0x12')][_0x9572('0x15')]);}else{logger[_0x9572('0x16')]('WhatsappTransferReport,\x20%s,\x20%s',_0x2890dd,_0x9572('0xe'));_0xc757e0(_0x5c0a55['result'][_0x9572('0x15')]);}})['catch'](function(_0x1aed3a){logger['error'](_0x9572('0x14'),_0x2890dd,_0x1aed3a);_0x48f674(_0x1aed3a);});});} \ No newline at end of file diff --git a/server/app.js b/server/app.js index a9bc0d7..95d6dff 100644 --- a/server/app.js +++ b/server/app.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0xdb70=['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','./config/logger','app','./config/pm2','./config/pm2/config','./config/schedule','./config/schedule/chat','./config/schedule/whatsapp','./config/schedule/transcribe','./config/schedule/cloud-provider','sync','then','seedDB','default','listen','info','start','filter','exitCode','number','length','\x20processes\x20failed\x20at\x20startup:\x20','map','pm2_env','name','online','Offline\x20apps:','status','log','App\x20Ready!','catch'];(function(_0x24259d,_0x64a194){var _0x5a701=function(_0x204516){while(--_0x204516){_0x24259d['push'](_0x24259d['shift']());}};_0x5a701(++_0x64a194);}(_0xdb70,0xa0));var _0x0db7=function(_0x411a57,_0x569f06){_0x411a57=_0x411a57-0x0;var _0x482ac9=_0xdb70[_0x411a57];return _0x482ac9;};'use strict';var _=require(_0x0db7('0x0'));var db=require(_0x0db7('0x1'))['db'];var seedDb=require(_0x0db7('0x2'));var checkLicense=require('./config/license');var rpc=require(_0x0db7('0x3'));var config=require(_0x0db7('0x4'));var logger=require(_0x0db7('0x5'))(_0x0db7('0x6'));var pm2=require(_0x0db7('0x7'));var pm2Config=require(_0x0db7('0x8'));var schedule=require(_0x0db7('0x9'));var chat=require(_0x0db7('0xa'));var whatsapp=require(_0x0db7('0xb'));var transcribe=require(_0x0db7('0xc'));var provider=require(_0x0db7('0xd'));function main(){return db['sequelize'][_0x0db7('0xe')]()[_0x0db7('0xf')](function(){if(config[_0x0db7('0x10')]){return seedDb[_0x0db7('0x11')]();}})[_0x0db7('0xf')](function(){return checkLicense[_0x0db7('0x11')]();})['then'](function(){return rpc[_0x0db7('0x12')]();})[_0x0db7('0xf')](function(_0x5c14dc){logger[_0x0db7('0x13')](_0x5c14dc);return chat[_0x0db7('0x14')]();})[_0x0db7('0xf')](function(){return whatsapp[_0x0db7('0x14')]();})['then'](function(){return schedule[_0x0db7('0x14')]();})['then'](function(){return transcribe[_0x0db7('0x14')]();})[_0x0db7('0xf')](function(){return provider[_0x0db7('0x14')]();})[_0x0db7('0xf')](function(_0x1ef17d){logger['info'](_0x1ef17d);return pm2[_0x0db7('0x14')](pm2Config);})[_0x0db7('0xf')](function(_0x45f594){var _0x27137d=_0x45f594[_0x0db7('0x15')](function(_0x446448){return typeof _0x446448[_0x0db7('0x16')]===_0x0db7('0x17')&&_0x446448[_0x0db7('0x16')]>=0x0;});if(_0x27137d[_0x0db7('0x18')]>0x0){throw new Error(_0x27137d['length']+_0x0db7('0x19')+_[_0x0db7('0x1a')](_0x27137d,function(_0x18cf37){return'\x22'+_0x18cf37[_0x0db7('0x1b')][_0x0db7('0x1c')]+'\x22';}));}logger[_0x0db7('0x13')]('Online\x20apps:',_['map'](_[_0x0db7('0x15')](_0x45f594,{'status':_0x0db7('0x1d')}),_0x0db7('0x1c'))['join']());logger[_0x0db7('0x13')](_0x0db7('0x1e'),_[_0x0db7('0x1a')](_[_0x0db7('0x15')](_0x45f594,function(_0x5a0b04){return _0x5a0b04[_0x0db7('0x1f')]!=='online';}),_0x0db7('0x1c'))['join']()||'None');console[_0x0db7('0x20')](_0x0db7('0x21'));})[_0x0db7('0x22')](function(_0x26c2b2){console[_0x0db7('0x20')](_0x0db7('0x23'),_0x26c2b2);logger[_0x0db7('0x24')](_0x0db7('0x25'),_0x26c2b2);process[_0x0db7('0x26')](0x1);});}main(); \ No newline at end of file +var _0xeecc=['./config/pm2/config','./config/schedule','./config/schedule/chat','./config/schedule/whatsapp','./config/schedule/cloud-provider','sync','then','seedDB','default','info','start','filter','exitCode','number','length','\x20processes\x20failed\x20at\x20startup:\x20','map','pm2_env','name','online','join','Offline\x20apps:','None','App\x20Ready!','log','Server\x20failed\x20to\x20start\x20due\x20to\x20error!','error','Server\x20failed\x20to\x20start\x20due\x20to\x20error:\x20%s','exit','lodash','./mysqldb','./config/seedDB','./config/license','./config/environment'];(function(_0x3dd15e,_0x1f0015){var _0x231fd0=function(_0x4f680a){while(--_0x4f680a){_0x3dd15e['push'](_0x3dd15e['shift']());}};_0x231fd0(++_0x1f0015);}(_0xeecc,0x12d));var _0xceec=function(_0x311179,_0x5d935e){_0x311179=_0x311179-0x0;var _0x562c42=_0xeecc[_0x311179];return _0x562c42;};'use strict';var _=require(_0xceec('0x0'));var db=require(_0xceec('0x1'))['db'];var seedDb=require(_0xceec('0x2'));var checkLicense=require(_0xceec('0x3'));var rpc=require('./rpc');var config=require(_0xceec('0x4'));var logger=require('./config/logger')('app');var pm2=require('./config/pm2');var pm2Config=require(_0xceec('0x5'));var schedule=require(_0xceec('0x6'));var chat=require(_0xceec('0x7'));var whatsapp=require(_0xceec('0x8'));var transcribe=require('./config/schedule/transcribe');var provider=require(_0xceec('0x9'));function main(){return db['sequelize'][_0xceec('0xa')]()[_0xceec('0xb')](function(){if(config[_0xceec('0xc')]){return seedDb[_0xceec('0xd')]();}})[_0xceec('0xb')](function(){return checkLicense[_0xceec('0xd')]();})[_0xceec('0xb')](function(){return rpc['listen']();})[_0xceec('0xb')](function(_0x11f15f){logger[_0xceec('0xe')](_0x11f15f);return chat[_0xceec('0xf')]();})[_0xceec('0xb')](function(){return whatsapp['start']();})[_0xceec('0xb')](function(){return schedule[_0xceec('0xf')]();})[_0xceec('0xb')](function(){return transcribe[_0xceec('0xf')]();})[_0xceec('0xb')](function(){return provider['start']();})[_0xceec('0xb')](function(_0x5b8216){logger[_0xceec('0xe')](_0x5b8216);return pm2[_0xceec('0xf')](pm2Config);})[_0xceec('0xb')](function(_0x5c1306){var _0x578e51=_0x5c1306[_0xceec('0x10')](function(_0x51f24d){return typeof _0x51f24d[_0xceec('0x11')]===_0xceec('0x12')&&_0x51f24d[_0xceec('0x11')]>=0x0;});if(_0x578e51[_0xceec('0x13')]>0x0){throw new Error(_0x578e51[_0xceec('0x13')]+_0xceec('0x14')+_[_0xceec('0x15')](_0x578e51,function(_0x1c8429){return'\x22'+_0x1c8429[_0xceec('0x16')][_0xceec('0x17')]+'\x22';}));}logger[_0xceec('0xe')]('Online\x20apps:',_[_0xceec('0x15')](_[_0xceec('0x10')](_0x5c1306,{'status':_0xceec('0x18')}),_0xceec('0x17'))[_0xceec('0x19')]());logger[_0xceec('0xe')](_0xceec('0x1a'),_[_0xceec('0x15')](_[_0xceec('0x10')](_0x5c1306,function(_0x134002){return _0x134002['status']!==_0xceec('0x18');}),'name')[_0xceec('0x19')]()||_0xceec('0x1b'));console['log'](_0xceec('0x1c'));})['catch'](function(_0x25121c){console[_0xceec('0x1d')](_0xceec('0x1e'),_0x25121c);logger[_0xceec('0x1f')](_0xceec('0x20'),_0x25121c);process[_0xceec('0x21')](0x1);});}main(); \ No newline at end of file diff --git a/server/components/auth/service.js b/server/components/auth/service.js index e1be635..fbc030d 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 _0x7b19=['Please\x20use\x20the\x20previous\x20API\x20access\x20key\x20to\x20generate\x20a\x20new\x20one','validatePasswordPattern','test','Sequelize','ValidationError','The\x20password\x20must\x20be\x20at\x20least\x208\x20characters\x20long\x20and\x20have\x201\x20lowercase\x20character,\x201\x20uppercase\x20character,\x201\x20number\x20and\x201\x20special\x20character\x20~!@#$%^&-_=+[{]}.','validatePasswordHistory','decryptString','split','toLowerCase','format','The\x20password\x20must\x20be\x20different\x20from\x20the\x20previous\x20%d\x20passwords.\x20Please\x20choose\x20another\x20one.','updatePasswordsHistory','length','splice','join','promisify','sign','secret','payload','options','randomBytes','floor','now','../../mysqldb','../../config/environment','../../config/license/hardware','lodash','jsonwebtoken','express-jwt','composable-middleware','basic-auth','crypto','bluebird','moment','secrets','session','role','name','email','userpic','permissions','voicePause','chatPause','mailPause','faxPause','smsPause','pauseType','lastLoginAt','lastPauseAt','allowmessenger','alias','phoneBarDnd','phoneBarEnableRecording','phoneBarEnableDtmfTone','phoneBarEnableSettings','phoneBarExpires','phoneBarPrefixRequired','hotdesk','interface','userProfileId','wssPort','downloadVoiceRecordings','downloadAttachments','ignorePauseForPreviewCalls','selectRecallMeCampaign','chatAutoanswer','chatAutoanswerDelay','emailAutoanswerDelay','smsAutoanswer','smsAutoanswerDelay','openchannelAutoanswer','openchannelAutoanswerDelay','faxAutoanswerDelay','whatsappAutoanswer','whatsappAutoanswerDelay','messengerSoundNotification','isChatInteractionAuthorized','isAuthenticated','use','user','ChatInteraction','params','then','closed','query','forceDownload','status','disposition','json','unmanaged','Unmanaged.','catch','headers','authorization','startsWith','Basic','User','find','authenticate','pass','Wrong\x20credentials.','Bearer','Unknown\x20authorization\x20format','apikey','getUuid','sub','Setting','allowedLoginAttempts','isEqual','apiKeyNonce','nonce','API\x20access\x20key\x20is\x20not\x20valid\x20anymore','Invalid\x20API\x20access\x20key','blockDuration','minutes','canUpdate','getLicense','update','Forbidden','isWebrtcLicence','isMiddleware','signToken','setTokenCookie','It\x20looks\x20like\x20you\x20aren\x27t\x20logged\x20in,\x20please\x20try\x20again.','motion.token','/dashboards/general','send','retrieveApiKey','isNil','apiKeyIat','generateApiKey'];(function(_0x2796a2,_0x11b621){var _0x48523f=function(_0x3cc35a){while(--_0x3cc35a){_0x2796a2['push'](_0x2796a2['shift']());}};_0x48523f(++_0x11b621);}(_0x7b19,0x120));var _0x97b1=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0x7b19[_0x3dd15e];return _0x231fd0;};'use strict';var db=require(_0x97b1('0x0'))['db'];var config=require(_0x97b1('0x1'));var hardwareConf=require(_0x97b1('0x2'));var licenseUtil=require('../../config/license/util');var encryptor=require('../encryptor');var _=require(_0x97b1('0x3'));var jwt=require(_0x97b1('0x4'));var expressJwt=require(_0x97b1('0x5'));var compose=require(_0x97b1('0x6'));var basicAuth=require(_0x97b1('0x7'));var crypto=require(_0x97b1('0x8'));var BPromise=require(_0x97b1('0x9'));var util=require('util');var moment=require(_0x97b1('0xa'));var validateJwt=expressJwt({'secret':config[_0x97b1('0xb')][_0x97b1('0xc')]});var userAttributes=['id',_0x97b1('0xd'),'fullname',_0x97b1('0xe'),'internal',_0x97b1('0xf'),_0x97b1('0x10'),_0x97b1('0x11'),'md5secret',_0x97b1('0x12'),_0x97b1('0x13'),_0x97b1('0x14'),_0x97b1('0x15'),_0x97b1('0x16'),'openchannelPause',_0x97b1('0x17'),'showWebBar',_0x97b1('0x18'),_0x97b1('0x19'),'crudPermissions',_0x97b1('0x1a'),'passwordResetAt',_0x97b1('0x1b'),'phoneBarAutoAnswer','phoneBarAutoAnswerDelay',_0x97b1('0x1c'),_0x97b1('0x1d'),_0x97b1('0x1e'),_0x97b1('0x1f'),_0x97b1('0x20'),_0x97b1('0x21'),'phoneBarRemoteControl','phoneBarRemoteControlPort',_0x97b1('0x22'),_0x97b1('0x23'),_0x97b1('0x24'),'privacyEnabled','settingsEnabled',_0x97b1('0x25'),_0x97b1('0x26'),'downloadOmnichannelInteractions',_0x97b1('0x27'),_0x97b1('0x28'),_0x97b1('0x29'),_0x97b1('0x2a'),_0x97b1('0x2b'),'emailAutoanswer',_0x97b1('0x2c'),_0x97b1('0x2d'),_0x97b1('0x2e'),_0x97b1('0x2f'),_0x97b1('0x30'),'faxAutoanswer',_0x97b1('0x31'),_0x97b1('0x32'),_0x97b1('0x33'),_0x97b1('0x34')];exports[_0x97b1('0x35')]=function(){return this[_0x97b1('0x36')](!![])[_0x97b1('0x37')](function(_0x186e8e,_0x50950f,_0x569f96){if(_0x186e8e[_0x97b1('0x38')]){_0x569f96();}else{return db[_0x97b1('0x39')]['findOne']({'where':{'id':_0x186e8e[_0x97b1('0x3a')]['id']},'attributes':['id','closed','disposition'],'raw':!![]})[_0x97b1('0x3b')](function(_0x2e4fc0){if(_0x2e4fc0&&_0x2e4fc0[_0x97b1('0x3c')]&&!_0x186e8e[_0x97b1('0x3d')][_0x97b1('0x3e')]){return _0x50950f[_0x97b1('0x3f')](_0x2e4fc0[_0x97b1('0x40')]==='unmanaged'?0x195:0x193)[_0x97b1('0x41')]({'message':_0x2e4fc0[_0x97b1('0x40')]===_0x97b1('0x42')?_0x97b1('0x43'):'Forbidden.'});}else{_0x569f96();}})[_0x97b1('0x44')](function(_0xd41c19){_0x569f96(_0xd41c19);});}});};exports[_0x97b1('0x36')]=function isAuthenticated(_0x335c0a){return compose()[_0x97b1('0x37')](function(_0x2c462c,_0x688972,_0x4aa1f7){var _0x13a8f9;if(_0x2c462c[_0x97b1('0x45')][_0x97b1('0x46')]){if(_[_0x97b1('0x47')](_0x2c462c[_0x97b1('0x45')][_0x97b1('0x46')],_0x97b1('0x48'))){var _0xef2422=basicAuth(_0x2c462c);db[_0x97b1('0x49')][_0x97b1('0x4a')]({'where':{'name':_0xef2422[_0x97b1('0xe')]}})['then'](function(_0x4ebc13){if(!_0x4ebc13||!_0x4ebc13[_0x97b1('0x4b')](_0xef2422[_0x97b1('0x4c')])){return _0x688972[_0x97b1('0x3f')](0x191)['json']({'message':_0x97b1('0x4d')});}_0x2c462c['user']={'id':_0x4ebc13['id']};_0x4aa1f7();})[_0x97b1('0x44')](function(_0x951d7a){_0x4aa1f7(_0x951d7a);});}else if(_[_0x97b1('0x47')](_0x2c462c['headers'][_0x97b1('0x46')],_0x97b1('0x4e'))){validateJwt(_0x2c462c,_0x688972,_0x4aa1f7);}else{if(_0x335c0a){_0x4aa1f7();}else{return _0x688972['status'](0x193)[_0x97b1('0x41')]({'message':_0x97b1('0x4f')});}}}else if(_0x2c462c[_0x97b1('0x3d')][_0x97b1('0x50')]){try{var _0x3bb92e={'audience':hardwareConf['getUuid'](),'issuer':hardwareConf[_0x97b1('0x51')]()};verifyJwt(_0x2c462c['query'][_0x97b1('0x50')],_0x3bb92e)[_0x97b1('0x3b')](function(_0x528957){return db[_0x97b1('0x49')][_0x97b1('0x4a')]({'where':{'id':_0x528957[_0x97b1('0x52')]}})[_0x97b1('0x3b')](function(_0x3838d8){_0x13a8f9=_0x3838d8;return db[_0x97b1('0x53')]['findOne']({'where':{'id':0x1},'attributes':[_0x97b1('0x54'),'blockDuration'],'raw':!![]});})[_0x97b1('0x3b')](function(_0x4d045e){if(!_0x13a8f9||!_[_0x97b1('0x55')](_0x13a8f9[_0x97b1('0x56')],_0x528957[_0x97b1('0x57')])){return _0x688972[_0x97b1('0x3f')](0x191)[_0x97b1('0x41')]({'message':_0x97b1('0x58')});}if(_0x13a8f9['disabled']){return _0x688972[_0x97b1('0x3f')](0x191)[_0x97b1('0x41')]({'message':_0x97b1('0x59')});}if(_0x13a8f9['blocked']){if(_0x4d045e[_0x97b1('0x5a')]>0x0){if(moment(_0x13a8f9['blockedAt'])['add'](_0x4d045e['blockDuration'],_0x97b1('0x5b'))>moment()){return _0x688972[_0x97b1('0x3f')](0x191)[_0x97b1('0x41')]({'message':_0x97b1('0x59')});}}else{return _0x688972[_0x97b1('0x3f')](0x191)['json']({'message':'Invalid\x20API\x20access\x20key'});}}_0x2c462c[_0x97b1('0x38')]={'id':_0x13a8f9['id']};_0x4aa1f7();});})[_0x97b1('0x44')](function(){return _0x688972[_0x97b1('0x3f')](0x191)[_0x97b1('0x41')]({'message':'Invalid\x20API\x20access\x20key'});});}catch(_0x49102d){_0x4aa1f7(_0x49102d);}}else if(_0x335c0a){_0x4aa1f7();}else{return _0x688972[_0x97b1('0x3f')](0x193)['json']({'message':_0x97b1('0x4f')});}})['use'](function(_0x225717,_0x140b64,_0x1b1de4){if(_0x225717[_0x97b1('0x38')]){db['User'][_0x97b1('0x4a')]({'where':{'id':_0x225717[_0x97b1('0x38')]['id']},'attributes':userAttributes})[_0x97b1('0x3b')](function(_0x1083a1){if(!_0x1083a1){return _0x140b64[_0x97b1('0x3f')](0x194)[_0x97b1('0x41')]({'message':'User\x20not\x20found.'});}_0x225717['user']=_0x1083a1;_0x1b1de4();})[_0x97b1('0x44')](function(_0x5da373){_0x1b1de4(_0x5da373);});}else if(_0x335c0a){_0x1b1de4();}else{return _0x140b64[_0x97b1('0x3f')](0x194)[_0x97b1('0x41')]({'message':'User\x20object\x20not\x20found.'});}});};exports[_0x97b1('0x5c')]=function canUpdate(){return compose()[_0x97b1('0x37')](function(_0x4bbe1b,_0x5d66b2,_0x268066){return licenseUtil[_0x97b1('0x5d')]()['then'](function(_0x79004e){if(_0x79004e[_0x97b1('0x5e')]){_0x268066();}else{return _0x5d66b2[_0x97b1('0x3f')](0x193)[_0x97b1('0x41')]({'message':_0x97b1('0x5f')});}})[_0x97b1('0x44')](function(_0x55743d){_0x268066(_0x55743d);});});};exports[_0x97b1('0x60')]=function isWebrtcLicence(){return compose()[_0x97b1('0x37')](function(_0x50094a,_0x4a8a4d,_0x161b2c){return licenseUtil['getLicense']()[_0x97b1('0x3b')](function(_0x4fbc41){if(_0x4fbc41['webrtc']){_0x161b2c();}else{return _0x4a8a4d[_0x97b1('0x3f')](0x193)[_0x97b1('0x41')]({'message':_0x97b1('0x5f')});}})[_0x97b1('0x44')](function(_0x1fb865){_0x161b2c(_0x1fb865);});});};exports[_0x97b1('0x61')]=function(_0x5b8ba4,_0x1304c7,_0xc4f92f){_0x5b8ba4[_0x97b1('0x61')]=!![];return _0xc4f92f();};exports[_0x97b1('0x62')]=function signToken(_0xbac419){return signJwt(_0xbac419);};exports[_0x97b1('0x63')]=function(_0x150e15,_0x179fe6){if(!_0x150e15['user']){return _0x179fe6[_0x97b1('0x3f')](0x194)['json']({'message':_0x97b1('0x64')});}var _0x5be55d={'payload':{'id':_0x150e15[_0x97b1('0x38')]['id'],'role':_0x150e15['user'][_0x97b1('0xd')]},'options':{'expiresIn':0x15180}};return signJwt(_0x5be55d)['then'](function(_0x114045){_0x179fe6['cookie'](_0x97b1('0x65'),_0x114045);_0x179fe6['redirect'](_0x97b1('0x66'));})[_0x97b1('0x44')](function(_0x30c603){return _0x179fe6[_0x97b1('0x3f')](0x1f4)[_0x97b1('0x67')](_0x30c603);});};exports[_0x97b1('0x68')]=function(_0x349206){if(_[_0x97b1('0x69')](_0x349206['apiKeyNonce'])||_['isNil'](_0x349206[_0x97b1('0x6a')])){return null;}else{return createJwt(_0x349206);}};exports[_0x97b1('0x6b')]=function(_0x3ffef6){_0x3ffef6[_0x97b1('0x56')]=generateNonce();_0x3ffef6['apiKeyIat']=generateIssuedAt();return createJwt(_0x3ffef6);};exports['regenerateApiKey']=function(_0x32d3bd,_0x5d2800){var _0x216b1c=_0x32d3bd['query'][_0x97b1('0x50')];if(_0x216b1c){var _0x2b51f5={'nonce':_0x5d2800['apiKeyNonce'],'iat':_0x5d2800['apiKeyIat'],'audience':hardwareConf['getUuid'](),'issuer':hardwareConf[_0x97b1('0x51')]()};return verifyJwt(_0x216b1c,_0x2b51f5)[_0x97b1('0x3b')](function(){return generateApiKey(_0x5d2800);});}else{throw{'message':_0x97b1('0x6c')};}};exports[_0x97b1('0x6d')]=function(_0x3bd5c1){var _0x573694=new RegExp(/(?=.*[a-z])(?=.*[A-Z])(?=.*[0-9])(?=.*[?!@#\$%\^&\*~\-_=+[{\]\}])(?=.{8,})/);if(!_0x573694[_0x97b1('0x6e')](_0x3bd5c1))throw new db[(_0x97b1('0x6f'))][(_0x97b1('0x70'))](_0x97b1('0x71'));return;};exports[_0x97b1('0x72')]=function(_0x398ea5,_0x1a93db,_0x5e2304){var _0x3e4597=encryptor[_0x97b1('0x73')](_0x1a93db)[_0x97b1('0x74')](',');for(var _0x3329da=0x0;_0x3329da<_0x5e2304;_0x3329da++){if(!_0x3e4597[_0x3329da])break;if(_0x398ea5[_0x97b1('0x75')]()===_0x3e4597[_0x3329da][_0x97b1('0x75')]()){var _0x3bf0d5=util[_0x97b1('0x76')](_0x97b1('0x77'),_0x5e2304);if(_0x5e2304===0x1){_0x3bf0d5='The\x20password\x20must\x20be\x20different\x20from\x20the\x20last\x20one.\x20Please\x20choose\x20another\x20one.';}throw new db['Sequelize'][(_0x97b1('0x70'))](_0x3bf0d5);}}return;};exports[_0x97b1('0x78')]=function(_0x3b09ae,_0x1c727c){var _0x3095d2=_0x1c727c?encryptor[_0x97b1('0x73')](_0x1c727c)['split'](','):[];if(_0x3095d2[_0x97b1('0x79')]===0x5){_0x3095d2[_0x97b1('0x7a')](-0x1,0x1);}_0x3095d2['unshift'](_0x3b09ae);return encryptor['encryptString'](_0x3095d2[_0x97b1('0x7b')](','));};function signJwt(_0x3006e0){var _0x59253d=BPromise[_0x97b1('0x7c')](jwt[_0x97b1('0x7d')],{'context':jwt});var _0x3fbeeb=_0x3006e0[_0x97b1('0x7e')]||config[_0x97b1('0xb')][_0x97b1('0xc')];return new BPromise(function(_0x37e04f,_0x1d3990){_0x59253d(_0x3006e0[_0x97b1('0x7f')],_0x3fbeeb,_0x3006e0[_0x97b1('0x80')])[_0x97b1('0x3b')](function(_0xa97a81){_0x37e04f(_0xa97a81);})[_0x97b1('0x44')](function(_0x45baac){_0x1d3990(_0x45baac);});});}function verifyJwt(_0x2c90a1,_0x101983,_0x31a64c){var _0x4b9e6f=BPromise['promisify'](jwt['verify'],{'context':jwt});var _0x1ca9e7=_0x31a64c||config['secrets'][_0x97b1('0xc')];return new BPromise(function(_0x24ee0e,_0x1f47ef){_0x4b9e6f(_0x2c90a1,_0x1ca9e7,_0x101983)[_0x97b1('0x3b')](function(_0x53d266){_0x24ee0e(_0x53d266);})['catch'](function(_0x2aba7e){_0x1f47ef(_0x2aba7e);});});}function generateNonce(){return crypto[_0x97b1('0x81')](0x10)['toString']('hex');}function generateIssuedAt(){return Math[_0x97b1('0x82')](Date[_0x97b1('0x83')]()/0x3e8)['toString']();}function createJwt(_0x549617){var _0x4c8a50={'payload':{'iat':_0x549617[_0x97b1('0x6a')],'nonce':_0x549617[_0x97b1('0x56')]},'options':{'algorithm':'HS512','subject':_0x549617['id']['toString'](),'issuer':hardwareConf[_0x97b1('0x51')](),'audience':hardwareConf[_0x97b1('0x51')]()}};return signJwt(_0x4c8a50)[_0x97b1('0x3b')](function(_0x405e4f){return{'iat':_0x549617[_0x97b1('0x6a')],'nonce':_0x549617[_0x97b1('0x56')],'token':_0x405e4f};});} \ No newline at end of file +var _0x5f33=['pass','Wrong\x20credentials.','Bearer','apikey','getUuid','sub','allowedLoginAttempts','isEqual','nonce','API\x20access\x20key\x20is\x20not\x20valid\x20anymore','disabled','blockedAt','add','blockDuration','minutes','Invalid\x20API\x20access\x20key','Unknown\x20authorization\x20format','User\x20object\x20not\x20found.','canUpdate','getLicense','Forbidden','isWebrtcLicence','webrtc','isMiddleware','signToken','It\x20looks\x20like\x20you\x20aren\x27t\x20logged\x20in,\x20please\x20try\x20again.','role','cookie','motion.token','redirect','/dashboards/general','retrieveApiKey','isNil','generateApiKey','apiKeyIat','apiKeyNonce','Please\x20use\x20the\x20previous\x20API\x20access\x20key\x20to\x20generate\x20a\x20new\x20one','test','ValidationError','The\x20password\x20must\x20be\x20at\x20least\x208\x20characters\x20long\x20and\x20have\x201\x20lowercase\x20character,\x201\x20uppercase\x20character,\x201\x20number\x20and\x201\x20special\x20character\x20~!@#$%^&-_=+[{]}.','validatePasswordHistory','decryptString','split','toLowerCase','format','splice','encryptString','promisify','secret','payload','verify','randomBytes','toString','hex','floor','now','HS512','../../mysqldb','../../config/environment','../../config/license/util','../encryptor','jsonwebtoken','composable-middleware','basic-auth','util','moment','secrets','session','fullname','name','internal','userpic','permissions','md5secret','voicePause','chatPause','smsPause','openchannelPause','lastLoginAt','crudPermissions','allowmessenger','passwordResetAt','alias','phoneBarAutoAnswer','phoneBarAutoAnswerDelay','phoneBarEnableRecording','phoneBarEnableDtmfTone','phoneBarEnableSettings','phoneBarPrefixRequired','phoneBarRemoteControl','phoneBarRemoteControlPort','hotdesk','interface','userProfileId','settingsEnabled','wssPort','downloadVoiceRecordings','downloadOmnichannelInteractions','downloadAttachments','ignorePauseForPreviewCalls','selectRecallMeCampaign','chatAutoanswerDelay','emailAutoanswer','emailAutoanswerDelay','smsAutoanswer','openchannelAutoanswer','openchannelAutoanswerDelay','faxAutoanswer','faxAutoanswerDelay','whatsappAutoanswer','whatsappAutoanswerDelay','isChatInteractionAuthorized','isAuthenticated','user','ChatInteraction','findOne','params','closed','disposition','then','query','forceDownload','status','unmanaged','json','Unmanaged.','Forbidden.','catch','use','authorization','startsWith','headers','User','find','authenticate'];(function(_0xf2c6bb,_0x3ebb2c){var _0x4cde19=function(_0x47ce13){while(--_0x47ce13){_0xf2c6bb['push'](_0xf2c6bb['shift']());}};_0x4cde19(++_0x3ebb2c);}(_0x5f33,0x147));var _0x35f3=function(_0x35779b,_0x4d5e22){_0x35779b=_0x35779b-0x0;var _0x441486=_0x5f33[_0x35779b];return _0x441486;};'use strict';var db=require(_0x35f3('0x0'))['db'];var config=require(_0x35f3('0x1'));var hardwareConf=require('../../config/license/hardware');var licenseUtil=require(_0x35f3('0x2'));var encryptor=require(_0x35f3('0x3'));var _=require('lodash');var jwt=require(_0x35f3('0x4'));var expressJwt=require('express-jwt');var compose=require(_0x35f3('0x5'));var basicAuth=require(_0x35f3('0x6'));var crypto=require('crypto');var BPromise=require('bluebird');var util=require(_0x35f3('0x7'));var moment=require(_0x35f3('0x8'));var validateJwt=expressJwt({'secret':config[_0x35f3('0x9')][_0x35f3('0xa')]});var userAttributes=['id','role',_0x35f3('0xb'),_0x35f3('0xc'),_0x35f3('0xd'),'email',_0x35f3('0xe'),_0x35f3('0xf'),_0x35f3('0x10'),_0x35f3('0x11'),_0x35f3('0x12'),'mailPause','faxPause',_0x35f3('0x13'),_0x35f3('0x14'),'pauseType','showWebBar',_0x35f3('0x15'),'lastPauseAt',_0x35f3('0x16'),_0x35f3('0x17'),_0x35f3('0x18'),_0x35f3('0x19'),_0x35f3('0x1a'),_0x35f3('0x1b'),'phoneBarDnd',_0x35f3('0x1c'),_0x35f3('0x1d'),_0x35f3('0x1e'),'phoneBarExpires',_0x35f3('0x1f'),_0x35f3('0x20'),_0x35f3('0x21'),_0x35f3('0x22'),_0x35f3('0x23'),_0x35f3('0x24'),'privacyEnabled',_0x35f3('0x25'),_0x35f3('0x26'),_0x35f3('0x27'),_0x35f3('0x28'),_0x35f3('0x29'),_0x35f3('0x2a'),_0x35f3('0x2b'),'chatAutoanswer',_0x35f3('0x2c'),_0x35f3('0x2d'),_0x35f3('0x2e'),_0x35f3('0x2f'),'smsAutoanswerDelay',_0x35f3('0x30'),_0x35f3('0x31'),_0x35f3('0x32'),_0x35f3('0x33'),_0x35f3('0x34'),_0x35f3('0x35'),'messengerSoundNotification'];exports[_0x35f3('0x36')]=function(){return this[_0x35f3('0x37')](!![])['use'](function(_0x437d64,_0x2fa8ff,_0x250ca3){if(_0x437d64[_0x35f3('0x38')]){_0x250ca3();}else{return db[_0x35f3('0x39')][_0x35f3('0x3a')]({'where':{'id':_0x437d64[_0x35f3('0x3b')]['id']},'attributes':['id',_0x35f3('0x3c'),_0x35f3('0x3d')],'raw':!![]})[_0x35f3('0x3e')](function(_0x3e96d9){if(_0x3e96d9&&_0x3e96d9[_0x35f3('0x3c')]&&!_0x437d64[_0x35f3('0x3f')][_0x35f3('0x40')]){return _0x2fa8ff[_0x35f3('0x41')](_0x3e96d9[_0x35f3('0x3d')]===_0x35f3('0x42')?0x195:0x193)[_0x35f3('0x43')]({'message':_0x3e96d9[_0x35f3('0x3d')]==='unmanaged'?_0x35f3('0x44'):_0x35f3('0x45')});}else{_0x250ca3();}})[_0x35f3('0x46')](function(_0x5c0b9d){_0x250ca3(_0x5c0b9d);});}});};exports[_0x35f3('0x37')]=function isAuthenticated(_0x4a9e39){return compose()[_0x35f3('0x47')](function(_0x4bae74,_0x18a123,_0x1dbbe1){var _0x187f3a;if(_0x4bae74['headers'][_0x35f3('0x48')]){if(_[_0x35f3('0x49')](_0x4bae74[_0x35f3('0x4a')][_0x35f3('0x48')],'Basic')){var _0x1f5ffb=basicAuth(_0x4bae74);db[_0x35f3('0x4b')][_0x35f3('0x4c')]({'where':{'name':_0x1f5ffb[_0x35f3('0xc')]}})['then'](function(_0x1258aa){if(!_0x1258aa||!_0x1258aa[_0x35f3('0x4d')](_0x1f5ffb[_0x35f3('0x4e')])){return _0x18a123['status'](0x191)[_0x35f3('0x43')]({'message':_0x35f3('0x4f')});}_0x4bae74[_0x35f3('0x38')]={'id':_0x1258aa['id']};_0x1dbbe1();})[_0x35f3('0x46')](function(_0x438ac8){_0x1dbbe1(_0x438ac8);});}else if(_[_0x35f3('0x49')](_0x4bae74[_0x35f3('0x4a')][_0x35f3('0x48')],_0x35f3('0x50'))){validateJwt(_0x4bae74,_0x18a123,_0x1dbbe1);}else{if(_0x4a9e39){_0x1dbbe1();}else{return _0x18a123[_0x35f3('0x41')](0x193)[_0x35f3('0x43')]({'message':'Unknown\x20authorization\x20format'});}}}else if(_0x4bae74[_0x35f3('0x3f')][_0x35f3('0x51')]){try{var _0x8dad72={'audience':hardwareConf[_0x35f3('0x52')](),'issuer':hardwareConf[_0x35f3('0x52')]()};verifyJwt(_0x4bae74[_0x35f3('0x3f')][_0x35f3('0x51')],_0x8dad72)[_0x35f3('0x3e')](function(_0xda18bb){return db[_0x35f3('0x4b')][_0x35f3('0x4c')]({'where':{'id':_0xda18bb[_0x35f3('0x53')]}})[_0x35f3('0x3e')](function(_0x2752ab){_0x187f3a=_0x2752ab;return db['Setting'][_0x35f3('0x3a')]({'where':{'id':0x1},'attributes':[_0x35f3('0x54'),'blockDuration'],'raw':!![]});})[_0x35f3('0x3e')](function(_0x5380f5){if(!_0x187f3a||!_[_0x35f3('0x55')](_0x187f3a['apiKeyNonce'],_0xda18bb[_0x35f3('0x56')])){return _0x18a123[_0x35f3('0x41')](0x191)[_0x35f3('0x43')]({'message':_0x35f3('0x57')});}if(_0x187f3a[_0x35f3('0x58')]){return _0x18a123[_0x35f3('0x41')](0x191)[_0x35f3('0x43')]({'message':'Invalid\x20API\x20access\x20key'});}if(_0x187f3a['blocked']){if(_0x5380f5['blockDuration']>0x0){if(moment(_0x187f3a[_0x35f3('0x59')])[_0x35f3('0x5a')](_0x5380f5[_0x35f3('0x5b')],_0x35f3('0x5c'))>moment()){return _0x18a123[_0x35f3('0x41')](0x191)['json']({'message':'Invalid\x20API\x20access\x20key'});}}else{return _0x18a123[_0x35f3('0x41')](0x191)[_0x35f3('0x43')]({'message':'Invalid\x20API\x20access\x20key'});}}_0x4bae74[_0x35f3('0x38')]={'id':_0x187f3a['id']};_0x1dbbe1();});})[_0x35f3('0x46')](function(){return _0x18a123[_0x35f3('0x41')](0x191)[_0x35f3('0x43')]({'message':_0x35f3('0x5d')});});}catch(_0x479562){_0x1dbbe1(_0x479562);}}else if(_0x4a9e39){_0x1dbbe1();}else{return _0x18a123['status'](0x193)[_0x35f3('0x43')]({'message':_0x35f3('0x5e')});}})[_0x35f3('0x47')](function(_0x47817d,_0x413cd8,_0x5bdb83){if(_0x47817d[_0x35f3('0x38')]){db[_0x35f3('0x4b')][_0x35f3('0x4c')]({'where':{'id':_0x47817d['user']['id']},'attributes':userAttributes})[_0x35f3('0x3e')](function(_0x38c3e7){if(!_0x38c3e7){return _0x413cd8[_0x35f3('0x41')](0x194)[_0x35f3('0x43')]({'message':'User\x20not\x20found.'});}_0x47817d[_0x35f3('0x38')]=_0x38c3e7;_0x5bdb83();})['catch'](function(_0x312d9d){_0x5bdb83(_0x312d9d);});}else if(_0x4a9e39){_0x5bdb83();}else{return _0x413cd8['status'](0x194)[_0x35f3('0x43')]({'message':_0x35f3('0x5f')});}});};exports[_0x35f3('0x60')]=function canUpdate(){return compose()['use'](function(_0x39c5c0,_0xa753ea,_0x392df2){return licenseUtil[_0x35f3('0x61')]()['then'](function(_0x4a26c4){if(_0x4a26c4['update']){_0x392df2();}else{return _0xa753ea[_0x35f3('0x41')](0x193)[_0x35f3('0x43')]({'message':_0x35f3('0x62')});}})[_0x35f3('0x46')](function(_0x5791b9){_0x392df2(_0x5791b9);});});};exports[_0x35f3('0x63')]=function isWebrtcLicence(){return compose()[_0x35f3('0x47')](function(_0x1afe13,_0x233cf4,_0x41f109){return licenseUtil['getLicense']()[_0x35f3('0x3e')](function(_0x4f2099){if(_0x4f2099[_0x35f3('0x64')]){_0x41f109();}else{return _0x233cf4[_0x35f3('0x41')](0x193)['json']({'message':_0x35f3('0x62')});}})[_0x35f3('0x46')](function(_0x1e5d19){_0x41f109(_0x1e5d19);});});};exports[_0x35f3('0x65')]=function(_0xb8b5bb,_0x5b6f29,_0x24a61f){_0xb8b5bb[_0x35f3('0x65')]=!![];return _0x24a61f();};exports[_0x35f3('0x66')]=function signToken(_0x43909e){return signJwt(_0x43909e);};exports['setTokenCookie']=function(_0x254a49,_0x1a988c){if(!_0x254a49[_0x35f3('0x38')]){return _0x1a988c[_0x35f3('0x41')](0x194)['json']({'message':_0x35f3('0x67')});}var _0xdbb24a={'payload':{'id':_0x254a49[_0x35f3('0x38')]['id'],'role':_0x254a49[_0x35f3('0x38')][_0x35f3('0x68')]},'options':{'expiresIn':0x15180}};return signJwt(_0xdbb24a)[_0x35f3('0x3e')](function(_0x11d00e){_0x1a988c[_0x35f3('0x69')](_0x35f3('0x6a'),_0x11d00e);_0x1a988c[_0x35f3('0x6b')](_0x35f3('0x6c'));})[_0x35f3('0x46')](function(_0x36e8bf){return _0x1a988c['status'](0x1f4)['send'](_0x36e8bf);});};exports[_0x35f3('0x6d')]=function(_0x137293){if(_[_0x35f3('0x6e')](_0x137293['apiKeyNonce'])||_[_0x35f3('0x6e')](_0x137293['apiKeyIat'])){return null;}else{return createJwt(_0x137293);}};exports[_0x35f3('0x6f')]=function(_0x1b311c){_0x1b311c['apiKeyNonce']=generateNonce();_0x1b311c[_0x35f3('0x70')]=generateIssuedAt();return createJwt(_0x1b311c);};exports['regenerateApiKey']=function(_0x1abfa7,_0x102504){var _0x269ff6=_0x1abfa7[_0x35f3('0x3f')][_0x35f3('0x51')];if(_0x269ff6){var _0x1b34a7={'nonce':_0x102504[_0x35f3('0x71')],'iat':_0x102504[_0x35f3('0x70')],'audience':hardwareConf[_0x35f3('0x52')](),'issuer':hardwareConf['getUuid']()};return verifyJwt(_0x269ff6,_0x1b34a7)[_0x35f3('0x3e')](function(){return generateApiKey(_0x102504);});}else{throw{'message':_0x35f3('0x72')};}};exports['validatePasswordPattern']=function(_0x2d1afd){var _0x3fd50a=new RegExp(/(?=.*[a-z])(?=.*[A-Z])(?=.*[0-9])(?=.*[?!@#\$%\^&\*~\-_=+[{\]\}])(?=.{8,})/);if(!_0x3fd50a[_0x35f3('0x73')](_0x2d1afd))throw new db['Sequelize'][(_0x35f3('0x74'))](_0x35f3('0x75'));return;};exports[_0x35f3('0x76')]=function(_0xd34290,_0x406770,_0x3be69b){var _0x1cc9b0=encryptor[_0x35f3('0x77')](_0x406770)[_0x35f3('0x78')](',');for(var _0x53665e=0x0;_0x53665e<_0x3be69b;_0x53665e++){if(!_0x1cc9b0[_0x53665e])break;if(_0xd34290[_0x35f3('0x79')]()===_0x1cc9b0[_0x53665e][_0x35f3('0x79')]()){var _0x469890=util[_0x35f3('0x7a')]('The\x20password\x20must\x20be\x20different\x20from\x20the\x20previous\x20%d\x20passwords.\x20Please\x20choose\x20another\x20one.',_0x3be69b);if(_0x3be69b===0x1){_0x469890='The\x20password\x20must\x20be\x20different\x20from\x20the\x20last\x20one.\x20Please\x20choose\x20another\x20one.';}throw new db['Sequelize'][(_0x35f3('0x74'))](_0x469890);}}return;};exports['updatePasswordsHistory']=function(_0x3be96f,_0x5b876f){var _0x90f032=_0x5b876f?encryptor[_0x35f3('0x77')](_0x5b876f)[_0x35f3('0x78')](','):[];if(_0x90f032['length']===0x5){_0x90f032[_0x35f3('0x7b')](-0x1,0x1);}_0x90f032['unshift'](_0x3be96f);return encryptor[_0x35f3('0x7c')](_0x90f032['join'](','));};function signJwt(_0x1632f6){var _0x3c5dc3=BPromise[_0x35f3('0x7d')](jwt['sign'],{'context':jwt});var _0x4acc84=_0x1632f6[_0x35f3('0x7e')]||config[_0x35f3('0x9')][_0x35f3('0xa')];return new BPromise(function(_0x273b72,_0x498c89){_0x3c5dc3(_0x1632f6[_0x35f3('0x7f')],_0x4acc84,_0x1632f6['options'])[_0x35f3('0x3e')](function(_0x37916a){_0x273b72(_0x37916a);})[_0x35f3('0x46')](function(_0x1fc623){_0x498c89(_0x1fc623);});});}function verifyJwt(_0x3706d0,_0x1abc9d,_0x50604c){var _0x1c2243=BPromise[_0x35f3('0x7d')](jwt[_0x35f3('0x80')],{'context':jwt});var _0x5385df=_0x50604c||config[_0x35f3('0x9')][_0x35f3('0xa')];return new BPromise(function(_0x3af1b5,_0x5c9e63){_0x1c2243(_0x3706d0,_0x5385df,_0x1abc9d)[_0x35f3('0x3e')](function(_0x261f6c){_0x3af1b5(_0x261f6c);})['catch'](function(_0x326cdd){_0x5c9e63(_0x326cdd);});});}function generateNonce(){return crypto[_0x35f3('0x81')](0x10)[_0x35f3('0x82')](_0x35f3('0x83'));}function generateIssuedAt(){return Math[_0x35f3('0x84')](Date[_0x35f3('0x85')]()/0x3e8)['toString']();}function createJwt(_0x596c9e){var _0x3232e2={'payload':{'iat':_0x596c9e[_0x35f3('0x70')],'nonce':_0x596c9e['apiKeyNonce']},'options':{'algorithm':_0x35f3('0x86'),'subject':_0x596c9e['id'][_0x35f3('0x82')](),'issuer':hardwareConf[_0x35f3('0x52')](),'audience':hardwareConf[_0x35f3('0x52')]()}};return signJwt(_0x3232e2)[_0x35f3('0x3e')](function(_0x252cb4){return{'iat':_0x596c9e['apiKeyIat'],'nonce':_0x596c9e[_0x35f3('0x71')],'token':_0x252cb4};});} \ No newline at end of file diff --git a/server/components/contacts/index.js b/server/components/contacts/index.js index ba94252..13844b0 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 _0x9d4e=['filter','user','clause','skip','checkListsRestrictions','ids','tag','countFilteredContacts','count','buildContactsQuery','getFilteredContacts','catch','CmContact','keys','startsWith','cf_','map','findOne','slice','all','type','lodash','./sql-utils','findAll','skipContactsQuery','resolve','getContactsSubquery','then','search','parseAdvancedSearchFilter','parseQueryParameters','where','default','fields'];(function(_0x36cb29,_0x2718a0){var _0x135d03=function(_0x49f038){while(--_0x49f038){_0x36cb29['push'](_0x36cb29['shift']());}};_0x135d03(++_0x2718a0);}(_0x9d4e,0x103));var _0xe9d4=function(_0x13ee83,_0x456ca6){_0x13ee83=_0x13ee83-0x0;var _0x43c870=_0x9d4e[_0x13ee83];return _0x43c870;};'use strict';var _=require(_0xe9d4('0x0'));var sqlUtils=require(_0xe9d4('0x1'));var db=require('../../mysqldb')['db'];exports[_0xe9d4('0x2')]=function(_0x59a653,_0x11cc28,_0x288f39,_0x4231a1){var _0x34fe8c={'count':0x0,'rows':[]};var _0x1e7b58=sqlUtils[_0xe9d4('0x3')](_0x11cc28,_0x59a653);if(_0x1e7b58){return Promise[_0xe9d4('0x4')](_0x34fe8c);}var _0x3679da=sqlUtils[_0xe9d4('0x5')]();var _0x2b15f9={};var _0x689d13=![];var _0x2c0319=![];return Promise[_0xe9d4('0x4')]()[_0xe9d4('0x6')](function(){if(_0x59a653[_0xe9d4('0x7')]){return sqlUtils[_0xe9d4('0x8')](_0x59a653[_0xe9d4('0x7')],_0x4231a1);}else{return sqlUtils[_0xe9d4('0x9')](_0x59a653,_0x4231a1);}})['then'](function(_0x21809b){_0x3679da[_0xe9d4('0xa')](_0x21809b[_0xe9d4('0xb')]);_0x3679da[_0xe9d4('0xa')](_0x21809b[_0xe9d4('0xc')]);_0x3679da[_0xe9d4('0xa')](_0x21809b[_0xe9d4('0xd')]);_0x3679da[_0xe9d4('0xa')](_0x21809b[_0xe9d4('0xe')][_0xe9d4('0xf')]);_0x2b15f9=_0x21809b['tags'];_0x2c0319=_0x21809b[_0xe9d4('0xe')][_0xe9d4('0x10')];return sqlUtils[_0xe9d4('0x11')](_0x11cc28,_0x59a653,_0x2c0319);})[_0xe9d4('0x6')](function(_0x3f518b){_0x3679da[_0xe9d4('0xa')](_0x3f518b);var _0x585015=_0x59a653[_0xe9d4('0x7')]?_0x2b15f9[_0xe9d4('0x12')]:_0x59a653[_0xe9d4('0x13')];_0x689d13=_0x585015?!![]:![];return sqlUtils[_0xe9d4('0x14')](_0x3679da,_0x585015);})[_0xe9d4('0x6')](function(_0x1ee1c7){_0x34fe8c[_0xe9d4('0x15')]=_0x1ee1c7;if(_0x34fe8c['count']===0x0){return;}if(_0x59a653['User']){_0x2c0319=!![];}return sqlUtils[_0xe9d4('0x16')](_0x3679da,_0x59a653['fields'],_0x288f39,_0x689d13,_0x2b15f9[_0xe9d4('0xf')],_0x2c0319);})[_0xe9d4('0x6')](function(_0x1af9c9){if(!_0x1af9c9){return[];}return sqlUtils[_0xe9d4('0x17')](_0x1af9c9,_0x59a653,_0x288f39);})[_0xe9d4('0x6')](function(_0xf37a0b){_0x34fe8c['rows']=_0xf37a0b;return _0x34fe8c;})[_0xe9d4('0x18')](function(_0x75c64a){throw _0x75c64a;});};exports['describe']=function(){var _0x4ccfcc={};var _0x1d3ae8=[];return db[_0xe9d4('0x19')]['describe']()['then'](function(_0x3cd1da){_0x4ccfcc=_0x3cd1da;var _0x5a359f=Object[_0xe9d4('0x1a')](_0x4ccfcc)[_0xe9d4('0xd')](function(_0x6d9a00){return _[_0xe9d4('0x1b')](_0x6d9a00,_0xe9d4('0x1c'))?_0x6d9a00:undefined;});var _0x2d66c5=_0x5a359f[_0xe9d4('0x1d')](function(_0x4cba52){return db['CmCustomField'][_0xe9d4('0x1e')]({'where':{'id':_0x4cba52[_0xe9d4('0x1f')](0x3)},'raw':!![]});});return Promise[_0xe9d4('0x20')](_0x2d66c5);})[_0xe9d4('0x6')](function(_0x217987){for(var _0x13bba6=0x0;_0x13bba6<_0x217987['length'];_0x13bba6++){if(_0x217987[_0x13bba6]){var _0x142000=_0xe9d4('0x1c')+_0x217987[_0x13bba6]['id'];_0x4ccfcc[_0x142000]['fieldType']=_0x217987[_0x13bba6][_0xe9d4('0x21')];}}_0x1d3ae8=_[_0xe9d4('0x1d')](Object['keys'](_0x4ccfcc),function(_0x596401){return{'name':_0x596401,'type':_0x4ccfcc[_0x596401]['type']};});return _0x1d3ae8;})[_0xe9d4('0x18')](function(_0x38295b){throw _0x38295b;});}; \ No newline at end of file +var _0x6f85=['default','fields','filter','user','tags','skip','checkListsRestrictions','ids','tag','countFilteredContacts','count','User','buildContactsQuery','clause','getFilteredContacts','rows','catch','describe','CmContact','startsWith','cf_','CmCustomField','findOne','slice','all','length','fieldType','map','keys','type','./sql-utils','../../mysqldb','findAll','skipContactsQuery','resolve','getContactsSubquery','then','search','parseQueryParameters','where'];(function(_0x270adf,_0x1daaa3){var _0x29eda9=function(_0x40afec){while(--_0x40afec){_0x270adf['push'](_0x270adf['shift']());}};_0x29eda9(++_0x1daaa3);}(_0x6f85,0x1ae));var _0x56f8=function(_0x13137e,_0x29c0f3){_0x13137e=_0x13137e-0x0;var _0x346261=_0x6f85[_0x13137e];return _0x346261;};'use strict';var _=require('lodash');var sqlUtils=require(_0x56f8('0x0'));var db=require(_0x56f8('0x1'))['db'];exports[_0x56f8('0x2')]=function(_0x476433,_0x2e3ad0,_0x17ecea,_0x5ed6ee){var _0x299ff5={'count':0x0,'rows':[]};var _0x2b4d1d=sqlUtils[_0x56f8('0x3')](_0x2e3ad0,_0x476433);if(_0x2b4d1d){return Promise[_0x56f8('0x4')](_0x299ff5);}var _0x299f0f=sqlUtils[_0x56f8('0x5')]();var _0x112ec2={};var _0x104b88=![];var _0x33b76a=![];return Promise['resolve']()[_0x56f8('0x6')](function(){if(_0x476433['search']){return sqlUtils['parseAdvancedSearchFilter'](_0x476433[_0x56f8('0x7')],_0x5ed6ee);}else{return sqlUtils[_0x56f8('0x8')](_0x476433,_0x5ed6ee);}})[_0x56f8('0x6')](function(_0x5aeb34){_0x299f0f[_0x56f8('0x9')](_0x5aeb34[_0x56f8('0xa')]);_0x299f0f[_0x56f8('0x9')](_0x5aeb34[_0x56f8('0xb')]);_0x299f0f[_0x56f8('0x9')](_0x5aeb34[_0x56f8('0xc')]);_0x299f0f[_0x56f8('0x9')](_0x5aeb34[_0x56f8('0xd')]['clause']);_0x112ec2=_0x5aeb34[_0x56f8('0xe')];_0x33b76a=_0x5aeb34['user'][_0x56f8('0xf')];return sqlUtils[_0x56f8('0x10')](_0x2e3ad0,_0x476433,_0x33b76a);})[_0x56f8('0x6')](function(_0x367db0){_0x299f0f[_0x56f8('0x9')](_0x367db0);var _0x93f7a4=_0x476433[_0x56f8('0x7')]?_0x112ec2[_0x56f8('0x11')]:_0x476433[_0x56f8('0x12')];_0x104b88=_0x93f7a4?!![]:![];return sqlUtils[_0x56f8('0x13')](_0x299f0f,_0x93f7a4);})['then'](function(_0xaef6e1){_0x299ff5[_0x56f8('0x14')]=_0xaef6e1;if(_0x299ff5['count']===0x0){return;}if(_0x476433[_0x56f8('0x15')]){_0x33b76a=!![];}return sqlUtils[_0x56f8('0x16')](_0x299f0f,_0x476433[_0x56f8('0xb')],_0x17ecea,_0x104b88,_0x112ec2[_0x56f8('0x17')],_0x33b76a);})[_0x56f8('0x6')](function(_0xb2d9f5){if(!_0xb2d9f5){return[];}return sqlUtils[_0x56f8('0x18')](_0xb2d9f5,_0x476433,_0x17ecea);})[_0x56f8('0x6')](function(_0x35212e){_0x299ff5[_0x56f8('0x19')]=_0x35212e;return _0x299ff5;})[_0x56f8('0x1a')](function(_0x5e9d3c){throw _0x5e9d3c;});};exports[_0x56f8('0x1b')]=function(){var _0x549fc7={};var _0x4f554f=[];return db[_0x56f8('0x1c')][_0x56f8('0x1b')]()[_0x56f8('0x6')](function(_0x156544){_0x549fc7=_0x156544;var _0x1ca248=Object['keys'](_0x549fc7)[_0x56f8('0xc')](function(_0x2b2744){return _[_0x56f8('0x1d')](_0x2b2744,_0x56f8('0x1e'))?_0x2b2744:undefined;});var _0x366bd8=_0x1ca248['map'](function(_0x120683){return db[_0x56f8('0x1f')][_0x56f8('0x20')]({'where':{'id':_0x120683[_0x56f8('0x21')](0x3)},'raw':!![]});});return Promise[_0x56f8('0x22')](_0x366bd8);})[_0x56f8('0x6')](function(_0x16c421){for(var _0x342ed3=0x0;_0x342ed3<_0x16c421[_0x56f8('0x23')];_0x342ed3++){if(_0x16c421[_0x342ed3]){var _0x507e55=_0x56f8('0x1e')+_0x16c421[_0x342ed3]['id'];_0x549fc7[_0x507e55][_0x56f8('0x24')]=_0x16c421[_0x342ed3]['type'];}}_0x4f554f=_[_0x56f8('0x25')](Object[_0x56f8('0x26')](_0x549fc7),function(_0x3104b1){return{'name':_0x3104b1,'type':_0x549fc7[_0x3104b1][_0x56f8('0x27')]};});return _0x4f554f;})[_0x56f8('0x1a')](function(_0x5e8f0f){throw _0x5e8f0f;});}; \ No newline at end of file diff --git a/server/components/contacts/sql-utils.js b/server/components/contacts/sql-utils.js index ea3a302..9be7411 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 _0xe94a=['DESC','subqry.','color','keyBy','Sequelize','QueryTypes','SELECT','CmContact','sequelize','query','toString','Tags','clone','isEmpty','t.id\x20IN\x20?','COUNT(*)','exports','lodash','squel','../parsers/advancedSearch','../parsers/qs','../../mysqldb','role','agent','search','ListId','true','select','from','cm_contacts','where','c.deletedAt\x20IS\x20NULL','subqry','left_join','cm_user_has_contacts','uc.CmContactId\x20=\x20','.id','cm_contact_has_tags','tools_tags','t.id\x20=\x20ct.TagId','phone','mobile','fax','email','CompanyId','createdAt','updatedAt','TagIds','forEach','field','GROUP_CONCAT(DISTINCT\x20t.id)','expr','getSelectedTags','CONCAT(\x27,\x27,\x20subqry.TagIds,\x20\x27,\x27)\x20LIKE\x20?','replace','escapeLIKESpecialChars','split','MATCH\x20(c.firstName,\x20c.lastName,\x20c.phone,\x20c.mobile,\x20c.fax,\x20c.email)\x20AGAINST\x20(?\x20IN\x20BOOLEAN\x20MODE)','getFullTextValue','c.id\x20LIKE\x20?','c.phone\x20LIKE\x20?','c.mobile\x20LIKE\x20?','c.fax\x20LIKE\x20?','c.email\x20LIKE\x20?','c.firstName\x20LIKE\x20?','parseSearch','conditions','length','find','name','dateOfBirth','datetime','castTo','DATE','buildExpression','type','value','end','Tag','map','tags','clause','and','ids','User','user','uc.UserId\x20=\x20?','skip','keys','some','compact','push','c.ListId\x20IN\x20?','concat','\x20=\x20?','then','filter','resolve','group','limit','offset','subqry.id','having','order'];(function(_0x1f0bcf,_0x5ec36f){var _0x27c1f2=function(_0x3c4c1d){while(--_0x3c4c1d){_0x1f0bcf['push'](_0x1f0bcf['shift']());}};_0x27c1f2(++_0x5ec36f);}(_0xe94a,0x1b1));var _0xae94=function(_0x552fce,_0x3f24bc){_0x552fce=_0x552fce-0x0;var _0x3e27a2=_0xe94a[_0x552fce];return _0x3e27a2;};'use strict';var _=require(_0xae94('0x0'));var squel=require(_0xae94('0x1'));var as=require(_0xae94('0x2'));var qs=require(_0xae94('0x3'));var utils=require('../interaction/utils');var db=require(_0xae94('0x4'))['db'];function skipContactsQuery(_0x11e083,_0x3ef751){var _0x56d264=![];if(_0x11e083[_0xae94('0x5')]===_0xae94('0x6')&&!_0x3ef751[_0xae94('0x7')]&&!_0x3ef751[_0xae94('0x8')]&&_0x3ef751['autocomplete']!==_0xae94('0x9')){_0x56d264=!![];}return _0x56d264;}function getContactsSubquery(){return squel[_0xae94('0xa')]()[_0xae94('0xb')](_0xae94('0xc'),'c')[_0xae94('0xd')](_0xae94('0xe'));}function applyJoinClauses(_0x1ff929,_0x2db41f){var _0x107841=_0x2db41f?'c':_0xae94('0xf');_0x1ff929[_0xae94('0x10')](_0xae94('0x11'),'uc',_0xae94('0x12')+_0x107841+_0xae94('0x13'))[_0xae94('0x10')](_0xae94('0x14'),'ct','ct.CmContactId\x20=\x20'+_0x107841+_0xae94('0x13'))['left_join'](_0xae94('0x15'),'t',_0xae94('0x16'));return _0x1ff929;}function addFieldsToQuery(_0x30418c,_0x580d81,_0x5521c2,_0x24195a,_0x114ca0){var _0x5c0942=_0x114ca0?'c':_0xae94('0xf');if(!_0x580d81){_0x580d81=['id','firstName','lastName',_0xae94('0x17'),_0xae94('0x18'),_0xae94('0x19'),_0xae94('0x1a'),'ListId',_0xae94('0x1b'),_0xae94('0x1c'),_0xae94('0x1d'),'deletedAt',_0xae94('0x1e')];}else if(!_0x580d81['includes']('id')){_0x580d81['push']('id');}var _0x12f83a=_0x5521c2&&_0x114ca0||!_0x5521c2&&!_0x114ca0;if(_0x24195a){_0x12f83a=_0x24195a&&_0x114ca0||!_0x24195a&&!_0x114ca0;}_0x580d81[_0xae94('0x1f')](function(_0x1441ef){if(_0x1441ef===_0xae94('0x1e')){if(_0x12f83a){_0x30418c[_0xae94('0x20')](_0xae94('0x21'),_0x1441ef);}else if(_0x5521c2||_0x24195a){_0x30418c[_0xae94('0x20')](_0x5c0942+'.'+_0x1441ef);}}else{_0x30418c[_0xae94('0x20')](_0x5c0942+'.'+_0x1441ef);}});return _0x30418c;}function getSqlClauses(){var _0x5ea9e1={'default':squel[_0xae94('0x22')](),'fields':squel['expr'](),'filter':squel[_0xae94('0x22')](),'tags':{'clause':squel[_0xae94('0x22')](),'ids':null},'user':{'clause':squel[_0xae94('0x22')](),'skip':![]}};return _0x5ea9e1;}function parseTagParameter(_0x210d0c){var _0x448e43=squel[_0xae94('0x22')]();if(_0x210d0c){var _0x239161=utils[_0xae94('0x23')](_0x210d0c);_0x239161[_0xae94('0x1f')](function(_0x106b79){_0x448e43['or'](_0xae94('0x24'),'%,'+_0x106b79+',%');});}return _0x448e43;}function parseSearchFilter(_0x22841f){var _0x565d6d=squel[_0xae94('0x22')]();if(_0x22841f){var _0x243298=_0x22841f[_0xae94('0x25')]('\x5c','\x5c\x5c')[_0xae94('0x25')](/'/g,'\x27\x27');var _0x3fb080=qs[_0xae94('0x26')](_0x243298);if(_0x243298[_0xae94('0x27')]('\x20')['length']>0x1){_0x565d6d['or'](_0xae94('0x28'),qs[_0xae94('0x29')](_0x243298,!![]),null);}else{if(qs['isNumeric'](_0x243298)){_0x565d6d['or'](_0xae94('0x2a'),_0x3fb080+'%');_0x565d6d['or'](_0xae94('0x2b'),_0x3fb080+'%');_0x565d6d['or'](_0xae94('0x2c'),_0x3fb080+'%');_0x565d6d['or'](_0xae94('0x2d'),_0x3fb080+'%');}else if(qs['isEmail'](_0x243298)){_0x565d6d['or'](_0xae94('0x2e'),_0x3fb080+'%');}else{_0x565d6d['or'](_0xae94('0x2f'),'%'+_0x3fb080+'%');_0x565d6d['or']('c.lastName\x20LIKE\x20?','%'+_0x3fb080+'%');_0x565d6d['or'](_0xae94('0x2e'),'%'+_0x3fb080+'%');}}}return _0x565d6d;}function parseAdvancedSearchFilter(_0x217503,_0x5c0727){var _0x56f4a4=getSqlClauses();var _0x254c12=as[_0xae94('0x30')](_0x217503);var _0x526f9c=_0x254c12['sqlOperator'];for(var _0x5cd1e4=0x0;_0x5cd1e4<_0x254c12[_0xae94('0x31')][_0xae94('0x32')];_0x5cd1e4++){var _0x4ca3a8=_0x254c12[_0xae94('0x31')][_0x5cd1e4];var _0x51090a='c';var _0x413958=_[_0xae94('0x33')](_0x5c0727,[_0xae94('0x34'),_0x4ca3a8[_0xae94('0x20')]]);if(_0x413958){if(_0x4ca3a8['field']===_0xae94('0x35')||_0x413958['fieldType']===_0xae94('0x36')){_0x4ca3a8[_0xae94('0x37')]=_0xae94('0x38');}var _0x46ed6c=as[_0xae94('0x39')](_0x51090a,_0x413958[_0xae94('0x3a')],_0x4ca3a8);_0x56f4a4['default'][_0x526f9c](_0x46ed6c['text'],_0x46ed6c[_0xae94('0x3b')]['start'],_0x46ed6c[_0xae94('0x3b')][_0xae94('0x3c')]);}else{if(_0x4ca3a8[_0xae94('0x20')]===_0xae94('0x3d')){var _0x3f0f43=_0x4ca3a8[_0xae94('0x3b')][_0xae94('0x27')](',')[_0xae94('0x3e')](function(_0xec16cb){return Number(_0xec16cb);});var _0x42d3bc=parseTagParameter(_0x3f0f43);_0x56f4a4[_0xae94('0x3f')][_0xae94('0x40')][_0xae94('0x41')](_0x42d3bc);_0x56f4a4['tags'][_0xae94('0x42')]=_0x3f0f43;}else if(_0x4ca3a8[_0xae94('0x20')]===_0xae94('0x43')){_0x56f4a4[_0xae94('0x44')][_0xae94('0x40')][_0xae94('0x41')](_0xae94('0x45'),_0x4ca3a8['value']);_0x56f4a4[_0xae94('0x44')][_0xae94('0x46')]=!![];}}}return _0x56f4a4;}function parseModelFields(_0x829efd,_0x554f13){var _0x90ad9=squel[_0xae94('0x22')]();var _0x5226a=_(_0x829efd)[_0xae94('0x47')]()[_0xae94('0x3e')](function(_0x325351){return _[_0xae94('0x48')](_0x554f13,[_0xae94('0x34'),_0x325351])?_0x325351:undefined;})[_0xae94('0x49')]()[_0xae94('0x3b')]();if(_0x829efd['Contact']){_0x5226a[_0xae94('0x4a')]('Contact');}if(_0x829efd[_0xae94('0x43')]){_0x5226a[_0xae94('0x4a')](_0xae94('0x43'));}if(_0x5226a[_0xae94('0x32')]>0x0){_0x5226a[_0xae94('0x1f')](function(_0xe55758){if(_0xe55758===_0xae94('0x8')){_0x90ad9['and'](_0xae94('0x4b'),[][_0xae94('0x4c')](_0x829efd[_0xe55758]));}else if(_0xe55758==='Contact'){var _0x4b4d40='%'+_0x829efd[_0xe55758]+'%';_0x90ad9[_0xae94('0x41')]('CONCAT_WS(\x27\x20\x27,\x20c.firstName,\x20c.lastName,\x20c.email)\x20LIKE\x20?',_0x4b4d40);}else if(_0xe55758===_0xae94('0x43')){_0x90ad9[_0xae94('0x41')]('uc.UserId\x20=\x20?',_0x829efd[_0xe55758]);}else{_0x90ad9[_0xae94('0x41')]('c.'+_0xe55758+_0xae94('0x4d'),_0x829efd[_0xe55758]);}});}return _0x90ad9;}function parseQueryParameters(_0x59db46,_0x3f3555){var _0xc1734e=getSqlClauses();return Promise['resolve']()[_0xae94('0x4e')](function(){return parseModelFields(_0x59db46,_0x3f3555);})[_0xae94('0x4e')](function(_0x28b7e3){_0xc1734e['fields']['and'](_0x28b7e3);return parseTagParameter(_0x59db46['tag']);})[_0xae94('0x4e')](function(_0x5cbcc2){_0xc1734e[_0xae94('0x3f')]['clause']['and'](_0x5cbcc2);return parseSearchFilter(_0x59db46[_0xae94('0x4f')]);})[_0xae94('0x4e')](function(_0x5279bf){_0xc1734e[_0xae94('0x4f')]=_0x5279bf;return _0xc1734e;});}function checkListsRestrictions(_0x24ee85,_0x40ff0b,_0x540119){var _0x14819b=squel[_0xae94('0x22')]();return Promise[_0xae94('0x50')]()[_0xae94('0x4e')](function(){if(_0x40ff0b[_0xae94('0x7')]&&_0x24ee85['role']===_0xae94('0x6')&&!_0x540119){return _0x24ee85['getLists']({'attributes':['id'],'raw':!![]});}})[_0xae94('0x4e')](function(_0xe7fa2){if(_0xe7fa2){if(_0xe7fa2[_0xae94('0x32')]===0x0){_0x14819b[_0xae94('0x41')]('c.ListId\x20IS\x20NULL');}else{_0x14819b[_0xae94('0x41')](_0xae94('0x4b'),_[_0xae94('0x3e')](_0xe7fa2,'id'));}}})[_0xae94('0x4e')](function(){return _0x14819b;});}function buildContactsQuery(_0x2c9f66,_0x9b3269,_0x2a31c7,_0x35ec51,_0x13483a,_0x2119c7){if(_0x9b3269){_0x9b3269=_0x2a31c7['attributes'];}_0x2c9f66=addFieldsToQuery(_0x2c9f66,_0x9b3269,_0x35ec51,_0x2119c7,!![]);var _0x40ddfe=squel[_0xae94('0xa')]();_0x40ddfe=addFieldsToQuery(_0x40ddfe,_0x9b3269,_0x35ec51,_0x2119c7,![]);if(_0x35ec51||_0x2119c7){_0x2c9f66=applyJoinClauses(_0x2c9f66,!![]);_0x2c9f66[_0xae94('0x51')]('c.id');if(_0x2a31c7[_0xae94('0x52')]){_0x40ddfe['limit'](_0x2a31c7['limit']);}if(_0x2a31c7[_0xae94('0x53')]){_0x40ddfe[_0xae94('0x53')](_0x2a31c7[_0xae94('0x53')]);}}else{_0x40ddfe=applyJoinClauses(_0x40ddfe,![]);_0x40ddfe[_0xae94('0x51')](_0xae94('0x54'));if(_0x2a31c7[_0xae94('0x52')]){_0x2c9f66[_0xae94('0x52')](_0x2a31c7[_0xae94('0x52')]);}if(_0x2a31c7[_0xae94('0x53')]){_0x2c9f66[_0xae94('0x53')](_0x2a31c7[_0xae94('0x53')]);}}_0x40ddfe[_0xae94('0x55')](_0x13483a);if(_0x2a31c7[_0xae94('0x56')]){_0x2a31c7[_0xae94('0x56')][_0xae94('0x1f')](function(_0x5ca073){_0x2c9f66[_0xae94('0x56')]('c.'+_0x5ca073[0x0],_0x5ca073[0x1]===_0xae94('0x57')?![]:!![]);_0x40ddfe[_0xae94('0x56')](_0xae94('0x58')+_0x5ca073[0x0],_0x5ca073[0x1]===_0xae94('0x57')?![]:!![]);});}_0x40ddfe[_0xae94('0xb')](_0x2c9f66,'subqry');return _0x40ddfe;}function getFilteredContacts(_0x517f5){var _0x19b4dc=[];return db[_0xae94('0x3d')]['findAll']({'attributes':['id','name',_0xae94('0x59')],'raw':!![]})[_0xae94('0x4e')](function(_0x3035a9){_0x19b4dc=_[_0xae94('0x5a')](_0x3035a9,'id');var _0x1d3763={'type':db[_0xae94('0x5b')][_0xae94('0x5c')][_0xae94('0x5d')],'model':db[_0xae94('0x5e')],'mapToModel':!![],'nest':!![],'raw':!![]};return db[_0xae94('0x5f')][_0xae94('0x60')](_0x517f5[_0xae94('0x61')](),_0x1d3763);})['then'](function(_0x5141cc){_0x5141cc[_0xae94('0x1f')](function(_0x45fc38){if(_0x45fc38[_0xae94('0x1e')]){_0x45fc38[_0xae94('0x62')]=[];_0x45fc38[_0xae94('0x1e')]['split'](',')[_0xae94('0x1f')](function(_0x124339){_0x45fc38['Tags'][_0xae94('0x4a')](_0x19b4dc[_0x124339]);});}delete _0x45fc38['TagIds'];});return _0x5141cc;});}function countFilteredContacts(_0x32a7f9,_0x3e4d5f){var _0x5b45ff=_0x32a7f9[_0xae94('0x63')]();_0x5b45ff[_0xae94('0x20')]('COUNT(*)');_0x5b45ff=applyJoinClauses(_0x5b45ff,!![]);_0x32a7f9[_0xae94('0x51')]('c.id');var _0xdf6e38=utils['getSelectedTags'](_0x3e4d5f);if(!_[_0xae94('0x64')](_0xdf6e38)){_0x5b45ff['where'](_0xae94('0x65'),_0xdf6e38);}var _0x31aabc={'type':db[_0xae94('0x5b')][_0xae94('0x5c')]['SELECT'],'raw':!![]};return db[_0xae94('0x5f')][_0xae94('0x60')](_0x5b45ff[_0xae94('0x61')](),_0x31aabc)[_0xae94('0x4e')](function(_0x4b774c){return _0x4b774c[0x0][_0xae94('0x66')];});}module[_0xae94('0x67')]={'buildContactsQuery':buildContactsQuery,'checkListsRestrictions':checkListsRestrictions,'countFilteredContacts':countFilteredContacts,'getContactsSubquery':getContactsSubquery,'getFilteredContacts':getFilteredContacts,'parseAdvancedSearchFilter':parseAdvancedSearchFilter,'parseQueryParameters':parseQueryParameters,'skipContactsQuery':skipContactsQuery}; \ No newline at end of file +var _0x7359=['\x20=\x20?','resolve','fields','tag','filter','then','getLists','c.ListId\x20IS\x20NULL','attributes','group','c.id','limit','offset','subqry.id','having','order','subqry.','DESC','subqry','color','keyBy','Sequelize','QueryTypes','CmContact','sequelize','query','toString','Tags','clone','COUNT(*)','isEmpty','where','t.id\x20IN\x20?','SELECT','exports','lodash','squel','../parsers/qs','../interaction/utils','role','agent','search','ListId','autocomplete','true','select','from','cm_contacts','c.deletedAt\x20IS\x20NULL','left_join','uc.CmContactId\x20=\x20','cm_contact_has_tags','ct.CmContactId\x20=\x20','.id','t.id\x20=\x20ct.TagId','phone','mobile','fax','CompanyId','updatedAt','deletedAt','TagIds','includes','push','forEach','field','GROUP_CONCAT(DISTINCT\x20t.id)','expr','getSelectedTags','CONCAT(\x27,\x27,\x20subqry.TagIds,\x20\x27,\x27)\x20LIKE\x20?','replace','escapeLIKESpecialChars','length','MATCH\x20(c.firstName,\x20c.lastName,\x20c.phone,\x20c.mobile,\x20c.fax,\x20c.email)\x20AGAINST\x20(?\x20IN\x20BOOLEAN\x20MODE)','isNumeric','c.id\x20LIKE\x20?','c.phone\x20LIKE\x20?','c.mobile\x20LIKE\x20?','isEmail','c.firstName\x20LIKE\x20?','c.lastName\x20LIKE\x20?','parseSearch','sqlOperator','conditions','dateOfBirth','fieldType','datetime','castTo','buildExpression','default','text','start','value','end','Tag','split','map','tags','clause','User','user','and','uc.UserId\x20=\x20?','skip','some','name','compact','Contact','c.ListId\x20IN\x20?','concat','CONCAT_WS(\x27\x20\x27,\x20c.firstName,\x20c.lastName,\x20c.email)\x20LIKE\x20?'];(function(_0x286314,_0x199345){var _0x713f9b=function(_0xa4325){while(--_0xa4325){_0x286314['push'](_0x286314['shift']());}};_0x713f9b(++_0x199345);}(_0x7359,0x101));var _0x9735=function(_0x18ab2a,_0x4debcd){_0x18ab2a=_0x18ab2a-0x0;var _0x16dcee=_0x7359[_0x18ab2a];return _0x16dcee;};'use strict';var _=require(_0x9735('0x0'));var squel=require(_0x9735('0x1'));var as=require('../parsers/advancedSearch');var qs=require(_0x9735('0x2'));var utils=require(_0x9735('0x3'));var db=require('../../mysqldb')['db'];function skipContactsQuery(_0x337770,_0x414132){var _0x48df98=![];if(_0x337770[_0x9735('0x4')]===_0x9735('0x5')&&!_0x414132[_0x9735('0x6')]&&!_0x414132[_0x9735('0x7')]&&_0x414132[_0x9735('0x8')]!==_0x9735('0x9')){_0x48df98=!![];}return _0x48df98;}function getContactsSubquery(){return squel[_0x9735('0xa')]()[_0x9735('0xb')](_0x9735('0xc'),'c')['where'](_0x9735('0xd'));}function applyJoinClauses(_0x4c795b,_0x45a473){var _0x58bd0c=_0x45a473?'c':'subqry';_0x4c795b[_0x9735('0xe')]('cm_user_has_contacts','uc',_0x9735('0xf')+_0x58bd0c+'.id')['left_join'](_0x9735('0x10'),'ct',_0x9735('0x11')+_0x58bd0c+_0x9735('0x12'))[_0x9735('0xe')]('tools_tags','t',_0x9735('0x13'));return _0x4c795b;}function addFieldsToQuery(_0x415d87,_0x44c42d,_0x3e8400,_0x41c63e,_0x55cf5e){var _0x29b472=_0x55cf5e?'c':'subqry';if(!_0x44c42d){_0x44c42d=['id','firstName','lastName',_0x9735('0x14'),_0x9735('0x15'),_0x9735('0x16'),'email',_0x9735('0x7'),_0x9735('0x17'),'createdAt',_0x9735('0x18'),_0x9735('0x19'),_0x9735('0x1a')];}else if(!_0x44c42d[_0x9735('0x1b')]('id')){_0x44c42d[_0x9735('0x1c')]('id');}var _0x135c7f=_0x3e8400&&_0x55cf5e||!_0x3e8400&&!_0x55cf5e;if(_0x41c63e){_0x135c7f=_0x41c63e&&_0x55cf5e||!_0x41c63e&&!_0x55cf5e;}_0x44c42d[_0x9735('0x1d')](function(_0x502e75){if(_0x502e75==='TagIds'){if(_0x135c7f){_0x415d87[_0x9735('0x1e')](_0x9735('0x1f'),_0x502e75);}else if(_0x3e8400||_0x41c63e){_0x415d87[_0x9735('0x1e')](_0x29b472+'.'+_0x502e75);}}else{_0x415d87[_0x9735('0x1e')](_0x29b472+'.'+_0x502e75);}});return _0x415d87;}function getSqlClauses(){var _0x53711c={'default':squel[_0x9735('0x20')](),'fields':squel[_0x9735('0x20')](),'filter':squel[_0x9735('0x20')](),'tags':{'clause':squel['expr'](),'ids':null},'user':{'clause':squel[_0x9735('0x20')](),'skip':![]}};return _0x53711c;}function parseTagParameter(_0x1c9bd0){var _0x233200=squel[_0x9735('0x20')]();if(_0x1c9bd0){var _0x5226a1=utils[_0x9735('0x21')](_0x1c9bd0);_0x5226a1[_0x9735('0x1d')](function(_0x57dcca){_0x233200['or'](_0x9735('0x22'),'%,'+_0x57dcca+',%');});}return _0x233200;}function parseSearchFilter(_0x414443){var _0x59b1a9=squel[_0x9735('0x20')]();if(_0x414443){var _0x74855c=_0x414443[_0x9735('0x23')]('\x5c','\x5c\x5c')[_0x9735('0x23')](/'/g,'\x27\x27');var _0x547d9d=qs[_0x9735('0x24')](_0x74855c);if(_0x74855c['split']('\x20')[_0x9735('0x25')]>0x1){_0x59b1a9['or'](_0x9735('0x26'),qs['getFullTextValue'](_0x74855c,!![]),null);}else{if(qs[_0x9735('0x27')](_0x74855c)){_0x59b1a9['or'](_0x9735('0x28'),_0x547d9d+'%');_0x59b1a9['or'](_0x9735('0x29'),_0x547d9d+'%');_0x59b1a9['or'](_0x9735('0x2a'),_0x547d9d+'%');_0x59b1a9['or']('c.fax\x20LIKE\x20?',_0x547d9d+'%');}else if(qs[_0x9735('0x2b')](_0x74855c)){_0x59b1a9['or']('c.email\x20LIKE\x20?',_0x547d9d+'%');}else{_0x59b1a9['or'](_0x9735('0x2c'),'%'+_0x547d9d+'%');_0x59b1a9['or'](_0x9735('0x2d'),'%'+_0x547d9d+'%');_0x59b1a9['or']('c.email\x20LIKE\x20?','%'+_0x547d9d+'%');}}}return _0x59b1a9;}function parseAdvancedSearchFilter(_0x1f506b,_0x54f541){var _0x3c5858=getSqlClauses();var _0x234e99=as[_0x9735('0x2e')](_0x1f506b);var _0x4035f4=_0x234e99[_0x9735('0x2f')];for(var _0x31706d=0x0;_0x31706d<_0x234e99['conditions']['length'];_0x31706d++){var _0x59b0bb=_0x234e99[_0x9735('0x30')][_0x31706d];var _0x39fd42='c';var _0x4da498=_['find'](_0x54f541,['name',_0x59b0bb[_0x9735('0x1e')]]);if(_0x4da498){if(_0x59b0bb['field']===_0x9735('0x31')||_0x4da498[_0x9735('0x32')]===_0x9735('0x33')){_0x59b0bb[_0x9735('0x34')]='DATE';}var _0x4bbc81=as[_0x9735('0x35')](_0x39fd42,_0x4da498['type'],_0x59b0bb);_0x3c5858[_0x9735('0x36')][_0x4035f4](_0x4bbc81[_0x9735('0x37')],_0x4bbc81['value'][_0x9735('0x38')],_0x4bbc81[_0x9735('0x39')][_0x9735('0x3a')]);}else{if(_0x59b0bb['field']===_0x9735('0x3b')){var _0x4d1a0f=_0x59b0bb[_0x9735('0x39')][_0x9735('0x3c')](',')[_0x9735('0x3d')](function(_0x422d77){return Number(_0x422d77);});var _0x3186fe=parseTagParameter(_0x4d1a0f);_0x3c5858[_0x9735('0x3e')][_0x9735('0x3f')]['and'](_0x3186fe);_0x3c5858[_0x9735('0x3e')]['ids']=_0x4d1a0f;}else if(_0x59b0bb[_0x9735('0x1e')]===_0x9735('0x40')){_0x3c5858[_0x9735('0x41')][_0x9735('0x3f')][_0x9735('0x42')](_0x9735('0x43'),_0x59b0bb['value']);_0x3c5858[_0x9735('0x41')][_0x9735('0x44')]=!![];}}}return _0x3c5858;}function parseModelFields(_0x565327,_0x486b02){var _0x858e25=squel[_0x9735('0x20')]();var _0x1a7a76=_(_0x565327)['keys']()[_0x9735('0x3d')](function(_0x567aea){return _[_0x9735('0x45')](_0x486b02,[_0x9735('0x46'),_0x567aea])?_0x567aea:undefined;})[_0x9735('0x47')]()[_0x9735('0x39')]();if(_0x565327[_0x9735('0x48')]){_0x1a7a76['push'](_0x9735('0x48'));}if(_0x565327['User']){_0x1a7a76[_0x9735('0x1c')]('User');}if(_0x1a7a76['length']>0x0){_0x1a7a76['forEach'](function(_0x4f56cc){if(_0x4f56cc==='ListId'){_0x858e25[_0x9735('0x42')](_0x9735('0x49'),[][_0x9735('0x4a')](_0x565327[_0x4f56cc]));}else if(_0x4f56cc==='Contact'){var _0x41bcc2='%'+_0x565327[_0x4f56cc]+'%';_0x858e25[_0x9735('0x42')](_0x9735('0x4b'),_0x41bcc2);}else if(_0x4f56cc===_0x9735('0x40')){_0x858e25[_0x9735('0x42')](_0x9735('0x43'),_0x565327[_0x4f56cc]);}else{_0x858e25[_0x9735('0x42')]('c.'+_0x4f56cc+_0x9735('0x4c'),_0x565327[_0x4f56cc]);}});}return _0x858e25;}function parseQueryParameters(_0x1b7b5f,_0x5113c9){var _0x6df960=getSqlClauses();return Promise[_0x9735('0x4d')]()['then'](function(){return parseModelFields(_0x1b7b5f,_0x5113c9);})['then'](function(_0x30831e){_0x6df960[_0x9735('0x4e')][_0x9735('0x42')](_0x30831e);return parseTagParameter(_0x1b7b5f[_0x9735('0x4f')]);})['then'](function(_0x2ead5d){_0x6df960['tags'][_0x9735('0x3f')]['and'](_0x2ead5d);return parseSearchFilter(_0x1b7b5f[_0x9735('0x50')]);})['then'](function(_0x180e83){_0x6df960['filter']=_0x180e83;return _0x6df960;});}function checkListsRestrictions(_0x17ba8a,_0x10f54d,_0x3194da){var _0x3c614d=squel[_0x9735('0x20')]();return Promise[_0x9735('0x4d')]()[_0x9735('0x51')](function(){if(_0x10f54d[_0x9735('0x6')]&&_0x17ba8a[_0x9735('0x4')]===_0x9735('0x5')&&!_0x3194da){return _0x17ba8a[_0x9735('0x52')]({'attributes':['id'],'raw':!![]});}})[_0x9735('0x51')](function(_0x5a0187){if(_0x5a0187){if(_0x5a0187['length']===0x0){_0x3c614d[_0x9735('0x42')](_0x9735('0x53'));}else{_0x3c614d[_0x9735('0x42')](_0x9735('0x49'),_[_0x9735('0x3d')](_0x5a0187,'id'));}}})[_0x9735('0x51')](function(){return _0x3c614d;});}function buildContactsQuery(_0x21e4ff,_0xe22747,_0x15da8e,_0x2e6029,_0x1cda7b,_0x45e52c){if(_0xe22747){_0xe22747=_0x15da8e[_0x9735('0x54')];}_0x21e4ff=addFieldsToQuery(_0x21e4ff,_0xe22747,_0x2e6029,_0x45e52c,!![]);var _0x17b5e8=squel[_0x9735('0xa')]();_0x17b5e8=addFieldsToQuery(_0x17b5e8,_0xe22747,_0x2e6029,_0x45e52c,![]);if(_0x2e6029||_0x45e52c){_0x21e4ff=applyJoinClauses(_0x21e4ff,!![]);_0x21e4ff[_0x9735('0x55')](_0x9735('0x56'));if(_0x15da8e[_0x9735('0x57')]){_0x17b5e8[_0x9735('0x57')](_0x15da8e[_0x9735('0x57')]);}if(_0x15da8e['offset']){_0x17b5e8[_0x9735('0x58')](_0x15da8e['offset']);}}else{_0x17b5e8=applyJoinClauses(_0x17b5e8,![]);_0x17b5e8['group'](_0x9735('0x59'));if(_0x15da8e[_0x9735('0x57')]){_0x21e4ff[_0x9735('0x57')](_0x15da8e['limit']);}if(_0x15da8e['offset']){_0x21e4ff[_0x9735('0x58')](_0x15da8e[_0x9735('0x58')]);}}_0x17b5e8[_0x9735('0x5a')](_0x1cda7b);if(_0x15da8e['order']){_0x15da8e['order'][_0x9735('0x1d')](function(_0x437f65){_0x21e4ff['order']('c.'+_0x437f65[0x0],_0x437f65[0x1]==='DESC'?![]:!![]);_0x17b5e8[_0x9735('0x5b')](_0x9735('0x5c')+_0x437f65[0x0],_0x437f65[0x1]===_0x9735('0x5d')?![]:!![]);});}_0x17b5e8[_0x9735('0xb')](_0x21e4ff,_0x9735('0x5e'));return _0x17b5e8;}function getFilteredContacts(_0x191415){var _0x58ad01=[];return db[_0x9735('0x3b')]['findAll']({'attributes':['id',_0x9735('0x46'),_0x9735('0x5f')],'raw':!![]})[_0x9735('0x51')](function(_0x105154){_0x58ad01=_[_0x9735('0x60')](_0x105154,'id');var _0x143d80={'type':db[_0x9735('0x61')][_0x9735('0x62')]['SELECT'],'model':db[_0x9735('0x63')],'mapToModel':!![],'nest':!![],'raw':!![]};return db[_0x9735('0x64')][_0x9735('0x65')](_0x191415[_0x9735('0x66')](),_0x143d80);})[_0x9735('0x51')](function(_0x5a933c){_0x5a933c['forEach'](function(_0x1579c7){if(_0x1579c7['TagIds']){_0x1579c7[_0x9735('0x67')]=[];_0x1579c7[_0x9735('0x1a')][_0x9735('0x3c')](',')[_0x9735('0x1d')](function(_0x35430d){_0x1579c7[_0x9735('0x67')][_0x9735('0x1c')](_0x58ad01[_0x35430d]);});}delete _0x1579c7[_0x9735('0x1a')];});return _0x5a933c;});}function countFilteredContacts(_0x1c1ed7,_0x4773e1){var _0x451aa5=_0x1c1ed7[_0x9735('0x68')]();_0x451aa5[_0x9735('0x1e')](_0x9735('0x69'));_0x451aa5=applyJoinClauses(_0x451aa5,!![]);_0x1c1ed7['group'](_0x9735('0x56'));var _0x473ad3=utils[_0x9735('0x21')](_0x4773e1);if(!_[_0x9735('0x6a')](_0x473ad3)){_0x451aa5[_0x9735('0x6b')](_0x9735('0x6c'),_0x473ad3);}var _0x6abfbf={'type':db[_0x9735('0x61')][_0x9735('0x62')][_0x9735('0x6d')],'raw':!![]};return db[_0x9735('0x64')][_0x9735('0x65')](_0x451aa5['toString'](),_0x6abfbf)[_0x9735('0x51')](function(_0x314a62){return _0x314a62[0x0][_0x9735('0x69')];});}module[_0x9735('0x6e')]={'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 5bb9dd5..8692a23 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 _0xe07a=['createReadStream','createWriteStream','createCipher','data','update','write','end','final','binary','close','unlink','encryptString','base64','decryptString','createDecipher','utf8','crypto','bluebird','lodash','../../config/logger','secrets','session','aes192','encrypt','algorithm','join','is\x20not\x20a\x20supported\x20algorithm.\x20Your\x20system\x20supports\x20the\x20following\x20algorithms:','getCiphers','filter','indexOf','hasOwnProperty','encryptFile'];(function(_0x18bb7e,_0x3255b7){var _0x5309de=function(_0x3b84a0){while(--_0x3b84a0){_0x18bb7e['push'](_0x18bb7e['shift']());}};_0x5309de(++_0x3255b7);}(_0xe07a,0x190));var _0xae07=function(_0x53683e,_0x21a875){_0x53683e=_0x53683e-0x0;var _0x5f3c6d=_0xe07a[_0x53683e];return _0x5f3c6d;};'use strict';var crypto=require(_0xae07('0x0'));var fs=require('fs');var BPromise=require(_0xae07('0x1'));var _=require(_0xae07('0x2'));var config=require('../../config/environment');var logger=require(_0xae07('0x3'))('app');const AES_SUPPORTED_RX=/^aes(-)?\d{3}(-(cbc|cfb|ctr)(1|8)?){0,1}$/;const stringOptions={'secret':config[_0xae07('0x4')][_0xae07('0x5')],'algorithm':'aes-256-ctr'};const fileOptions={'algorithm':_0xae07('0x6')};if(config['encrypt']&&config[_0xae07('0x7')][_0xae07('0x8')]){var isSupported=isAlgorithmSupported(config[_0xae07('0x7')][_0xae07('0x8')]);if(isSupported){fileOptions['algorithm']=config[_0xae07('0x7')]['algorithm'];}else{var supportedAlgorithms=getSupportedCiphers()[_0xae07('0x9')](',\x20');logger['error'](config['encrypt']['algorithm'],_0xae07('0xa'),supportedAlgorithms);}}function isASupportedCipher(_0x4bc10d){return AES_SUPPORTED_RX['test'](_0x4bc10d);}function getSupportedCiphers(){return crypto[_0xae07('0xb')]()[_0xae07('0xc')](isASupportedCipher);}function isAlgorithmSupported(_0x1bbf74){return getSupportedCiphers()[_0xae07('0xd')](_0x1bbf74)>-0x1;}function combineOptions(_0xe43db7){var _0x1634d8={};for(var _0x43e517 in fileOptions){if(fileOptions[_0xae07('0xe')](_0x43e517)){_0x1634d8[_0x43e517]=fileOptions[_0x43e517];}}if(_0xe43db7){for(var _0x25c73b in _0xe43db7){if(_0xe43db7[_0xae07('0xe')](_0x25c73b)){_0x1634d8[_0x25c73b]=_0xe43db7[_0x25c73b];}}}return _0x1634d8;}exports[_0xae07('0xf')]=function(_0x37ef37,_0x50525b,_0x153c03,_0x3787c5){return new BPromise(function(_0x53ec3a,_0xa3a4c1){_0x3787c5=combineOptions(_0x3787c5);var _0x18da14=new Buffer(_0x153c03);var _0x4ae0e6=fs[_0xae07('0x10')](_0x37ef37);var _0x3772ee=fs[_0xae07('0x11')](_0x50525b);var _0x34145b=crypto[_0xae07('0x12')](_0x3787c5[_0xae07('0x8')],_0x18da14);_0x4ae0e6['on'](_0xae07('0x13'),function(_0x527ce7){var _0x4e595d=new Buffer(_0x34145b[_0xae07('0x14')](_0x527ce7),'binary');_0x3772ee[_0xae07('0x15')](_0x4e595d);});_0x4ae0e6['on'](_0xae07('0x16'),function(){try{var _0x4213a5=new Buffer(_0x34145b[_0xae07('0x17')](_0xae07('0x18')),_0xae07('0x18'));_0x3772ee[_0xae07('0x15')](_0x4213a5);_0x3772ee[_0xae07('0x16')]();_0x3772ee['on'](_0xae07('0x19'),function(){return _0x53ec3a(_0x50525b);});}catch(_0x43c528){fs[_0xae07('0x1a')](_0x50525b);return _0xa3a4c1(_0x43c528);}});});};exports['decryptFile']=function(_0x126aa6,_0x583972,_0x12981b,_0x2283be){return new BPromise(function(_0x1b1115,_0x2d796e){_0x2283be=combineOptions(_0x2283be);var _0xe7ad53=new Buffer(_0x12981b);var _0x308305=fs[_0xae07('0x10')](_0x126aa6);var _0x102254=fs[_0xae07('0x11')](_0x583972);var _0x2c20f6=crypto['createDecipher'](_0x2283be[_0xae07('0x8')],_0xe7ad53);_0x308305['on']('data',function(_0x498f08){var _0x35b57b=new Buffer(_0x2c20f6[_0xae07('0x14')](_0x498f08),_0xae07('0x18'));_0x102254[_0xae07('0x15')](_0x35b57b);});_0x308305['on']('end',function(){try{var _0x366d46=new Buffer(_0x2c20f6[_0xae07('0x17')]('binary'),'binary');_0x102254['write'](_0x366d46);_0x102254[_0xae07('0x16')]();_0x102254['on']('close',function(){return _0x1b1115(_0x583972);});}catch(_0x1fc8e9){fs[_0xae07('0x1a')](_0x583972);return _0x2d796e(_0x1fc8e9);}});});};exports[_0xae07('0x1b')]=function(_0x722a61,_0x1e659e,_0x4bb4d0){var _0x4af4b8=_0x4bb4d0||stringOptions[_0xae07('0x8')];var _0x1b979d=_0x1e659e||stringOptions['secret'];var _0x1d615d=crypto[_0xae07('0x12')](_0x4af4b8,_0x1b979d);var _0x213c0=_0x1d615d[_0xae07('0x14')](_0x722a61,'utf8',_0xae07('0x1c'));_0x213c0+=_0x1d615d['final'](_0xae07('0x1c'));return _0x213c0;};exports[_0xae07('0x1d')]=function(_0x36da19,_0xd0bf6e,_0x57e358){var _0x1fdbb7=_0x57e358||stringOptions['algorithm'];var _0x55baac=_0xd0bf6e||stringOptions['secret'];var _0x127f8e=crypto[_0xae07('0x1e')](_0x1fdbb7,_0x55baac);var _0x988b41=_0x127f8e[_0xae07('0x14')](_0x36da19,_0xae07('0x1c'),_0xae07('0x1f'));_0x988b41+=_0x127f8e['final'](_0xae07('0x1f'));return _0x988b41;}; \ No newline at end of file +var _0x4a4b=['getCiphers','hasOwnProperty','createWriteStream','data','binary','write','end','final','close','unlink','decryptFile','createReadStream','createDecipher','secret','createCipher','utf8','base64','decryptString','update','crypto','bluebird','lodash','../../config/environment','../../config/logger','session','aes-256-ctr','aes192','encrypt','algorithm','join','error','test'];(function(_0x6c7f06,_0x524713){var _0xf1551=function(_0x12b6bf){while(--_0x12b6bf){_0x6c7f06['push'](_0x6c7f06['shift']());}};_0xf1551(++_0x524713);}(_0x4a4b,0x133));var _0xb4a4=function(_0x4983f9,_0x5ce44b){_0x4983f9=_0x4983f9-0x0;var _0x35f4cd=_0x4a4b[_0x4983f9];return _0x35f4cd;};'use strict';var crypto=require(_0xb4a4('0x0'));var fs=require('fs');var BPromise=require(_0xb4a4('0x1'));var _=require(_0xb4a4('0x2'));var config=require(_0xb4a4('0x3'));var logger=require(_0xb4a4('0x4'))('app');const AES_SUPPORTED_RX=/^aes(-)?\d{3}(-(cbc|cfb|ctr)(1|8)?){0,1}$/;const stringOptions={'secret':config['secrets'][_0xb4a4('0x5')],'algorithm':_0xb4a4('0x6')};const fileOptions={'algorithm':_0xb4a4('0x7')};if(config[_0xb4a4('0x8')]&&config[_0xb4a4('0x8')][_0xb4a4('0x9')]){var isSupported=isAlgorithmSupported(config[_0xb4a4('0x8')][_0xb4a4('0x9')]);if(isSupported){fileOptions[_0xb4a4('0x9')]=config[_0xb4a4('0x8')][_0xb4a4('0x9')];}else{var supportedAlgorithms=getSupportedCiphers()[_0xb4a4('0xa')](',\x20');logger[_0xb4a4('0xb')](config[_0xb4a4('0x8')][_0xb4a4('0x9')],'is\x20not\x20a\x20supported\x20algorithm.\x20Your\x20system\x20supports\x20the\x20following\x20algorithms:',supportedAlgorithms);}}function isASupportedCipher(_0x531237){return AES_SUPPORTED_RX[_0xb4a4('0xc')](_0x531237);}function getSupportedCiphers(){return crypto[_0xb4a4('0xd')]()['filter'](isASupportedCipher);}function isAlgorithmSupported(_0x594869){return getSupportedCiphers()['indexOf'](_0x594869)>-0x1;}function combineOptions(_0x280149){var _0x20798e={};for(var _0x5ccc24 in fileOptions){if(fileOptions[_0xb4a4('0xe')](_0x5ccc24)){_0x20798e[_0x5ccc24]=fileOptions[_0x5ccc24];}}if(_0x280149){for(var _0x3535e1 in _0x280149){if(_0x280149[_0xb4a4('0xe')](_0x3535e1)){_0x20798e[_0x3535e1]=_0x280149[_0x3535e1];}}}return _0x20798e;}exports['encryptFile']=function(_0x14331a,_0x5b6813,_0x1d3a66,_0x2d7e86){return new BPromise(function(_0x1139d0,_0x2da23d){_0x2d7e86=combineOptions(_0x2d7e86);var _0x2ab901=new Buffer(_0x1d3a66);var _0x5b69e1=fs['createReadStream'](_0x14331a);var _0x36061a=fs[_0xb4a4('0xf')](_0x5b6813);var _0x34091c=crypto['createCipher'](_0x2d7e86['algorithm'],_0x2ab901);_0x5b69e1['on'](_0xb4a4('0x10'),function(_0x1e0d75){var _0x1c97f9=new Buffer(_0x34091c['update'](_0x1e0d75),_0xb4a4('0x11'));_0x36061a[_0xb4a4('0x12')](_0x1c97f9);});_0x5b69e1['on'](_0xb4a4('0x13'),function(){try{var _0x2bb839=new Buffer(_0x34091c[_0xb4a4('0x14')]('binary'),'binary');_0x36061a[_0xb4a4('0x12')](_0x2bb839);_0x36061a[_0xb4a4('0x13')]();_0x36061a['on'](_0xb4a4('0x15'),function(){return _0x1139d0(_0x5b6813);});}catch(_0x1cec7e){fs[_0xb4a4('0x16')](_0x5b6813);return _0x2da23d(_0x1cec7e);}});});};exports[_0xb4a4('0x17')]=function(_0x521084,_0x119ee0,_0x1fee4d,_0xe0526d){return new BPromise(function(_0x1b15f3,_0xbd4b6c){_0xe0526d=combineOptions(_0xe0526d);var _0x3f3d80=new Buffer(_0x1fee4d);var _0x15d1eb=fs[_0xb4a4('0x18')](_0x521084);var _0x3e7429=fs[_0xb4a4('0xf')](_0x119ee0);var _0x2e523f=crypto[_0xb4a4('0x19')](_0xe0526d[_0xb4a4('0x9')],_0x3f3d80);_0x15d1eb['on'](_0xb4a4('0x10'),function(_0x7748b3){var _0x424461=new Buffer(_0x2e523f['update'](_0x7748b3),'binary');_0x3e7429[_0xb4a4('0x12')](_0x424461);});_0x15d1eb['on'](_0xb4a4('0x13'),function(){try{var _0x1c8218=new Buffer(_0x2e523f['final']('binary'),'binary');_0x3e7429[_0xb4a4('0x12')](_0x1c8218);_0x3e7429[_0xb4a4('0x13')]();_0x3e7429['on'](_0xb4a4('0x15'),function(){return _0x1b15f3(_0x119ee0);});}catch(_0x4d747a){fs[_0xb4a4('0x16')](_0x119ee0);return _0xbd4b6c(_0x4d747a);}});});};exports['encryptString']=function(_0x190de8,_0x377fd0,_0x2868d3){var _0x212fb8=_0x2868d3||stringOptions['algorithm'];var _0x10aa77=_0x377fd0||stringOptions[_0xb4a4('0x1a')];var _0x29c7f2=crypto[_0xb4a4('0x1b')](_0x212fb8,_0x10aa77);var _0x30583e=_0x29c7f2['update'](_0x190de8,_0xb4a4('0x1c'),_0xb4a4('0x1d'));_0x30583e+=_0x29c7f2[_0xb4a4('0x14')](_0xb4a4('0x1d'));return _0x30583e;};exports[_0xb4a4('0x1e')]=function(_0x4a1ebe,_0x4798fd,_0x4a2b68){var _0x26f39f=_0x4a2b68||stringOptions['algorithm'];var _0x12ad42=_0x4798fd||stringOptions[_0xb4a4('0x1a')];var _0x2c53dc=crypto['createDecipher'](_0x26f39f,_0x12ad42);var _0x38926b=_0x2c53dc[_0xb4a4('0x1f')](_0x4a1ebe,'base64',_0xb4a4('0x1c'));_0x38926b+=_0x2c53dc[_0xb4a4('0x14')](_0xb4a4('0x1c'));return _0x38926b;}; \ No newline at end of file diff --git a/server/components/export/csv.js b/server/components/export/csv.js index 3d421fa..37ee514 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 _0xbc69=['Start\x20extraction\x20report\x20with\x20id\x20%d\x20in\x20%s\x20format','CSV','Setting','find','split','splitSizeCsv','then','sequelize','query','SELECT\x20count(*)\x20as\x20num\x20FROM\x20(%s)\x20t','SELECT','num','Empty','length','range','isInteger','push','%s\x20limit\x20%d\x20OFFSET\x20%d','QueryTypes','dirname','.csv','existsSync','mkdirSync','join','each','%s%d.%s','%s.%s','csv','zip','zip\x20finished','info','Completed','catch','Error\x20during\x20extraction\x20report\x20with\x20id\x20%d\x20in\x20%s\x20format','inspect','finally','exit','path','lodash','to-csv','bluebird','zip-dir','rimraf','../../mysqldb','../../config/logger','analytics','argv','savename','AnalyticExtractedReport','update','format'];(function(_0x3dd15e,_0x1f0015){var _0x231fd0=function(_0x4f680a){while(--_0x4f680a){_0x3dd15e['push'](_0x3dd15e['shift']());}};_0x231fd0(++_0x1f0015);}(_0xbc69,0x157));var _0x9bc6=function(_0x4709c0,_0x3396c7){_0x4709c0=_0x4709c0-0x0;var _0x13348b=_0xbc69[_0x4709c0];return _0x13348b;};'use strict';var util=require('util');var path=require(_0x9bc6('0x0'));var _=require(_0x9bc6('0x1'));var csv=require(_0x9bc6('0x2'));var fs=require('fs');var BPromise=require(_0x9bc6('0x3'));var zipdir=require(_0x9bc6('0x4'));var rimraf=require(_0x9bc6('0x5'));var db=require(_0x9bc6('0x6'))['db'];var dbH=require(_0x9bc6('0x6'))['dbH'];var logger=require(_0x9bc6('0x7'))(_0x9bc6('0x8'));var EXTRACTED_REPORT_ID=Number(process[_0x9bc6('0x9')][0x2]);var QUERY=process[_0x9bc6('0x9')][0x3];var PATH=process['argv'][0x4];var EXIT_CODE=0x0;function analyticExtractedReport(_0x3d46a1,_0x46347b){var _0x3a5f90={'status':_0x3d46a1};var _0x3d5be5={'where':{'id':EXTRACTED_REPORT_ID}};if(_0x46347b){_0x3a5f90[_0x9bc6('0xa')]=_0x46347b;}return db[_0x9bc6('0xb')][_0x9bc6('0xc')](_0x3a5f90,_0x3d5be5);}function main(){var _0x11c023=0x1388;var _0x4c8be0;logger['info'](util[_0x9bc6('0xd')](_0x9bc6('0xe'),EXTRACTED_REPORT_ID,_0x9bc6('0xf')));return db[_0x9bc6('0x10')][_0x9bc6('0x11')]({'where':{'id':0x1},'raw':!![],'attributes':['id',_0x9bc6('0x12'),'splitSizeCsv']})['then'](function(_0x409417){if(_0x409417){_0x4c8be0=_0x409417;_0x11c023=_0x4c8be0[_0x9bc6('0x13')]||0x1388;}})[_0x9bc6('0x14')](function(){return dbH[_0x9bc6('0x15')][_0x9bc6('0x16')](util[_0x9bc6('0xd')](_0x9bc6('0x17'),QUERY),{'type':dbH[_0x9bc6('0x15')]['QueryTypes'][_0x9bc6('0x18')]});})[_0x9bc6('0x14')](function(_0x4f7033){if(!_0x4f7033[0x0][_0x9bc6('0x19')]){return analyticExtractedReport(_0x9bc6('0x1a'));}var _0x4aba35=[];var _0x561b67=0x0;if(_0x4c8be0[_0x9bc6('0x12')]){if(_0x4f7033&&_0x4f7033[_0x9bc6('0x1b')]){var _0x388d2e=_[_0x9bc6('0x1c')](_0x4f7033[0x0]['num']/_0x11c023);var _0x3e3f0b=Number[_0x9bc6('0x1d')](_0x4f7033[0x0][_0x9bc6('0x19')]/_0x11c023)?_0x4f7033[0x0][_0x9bc6('0x19')]%_0x11c023:0x0;_0x388d2e['forEach'](function(_0xba6814){if(_0xba6814>0x0){_0x561b67+=_0x11c023;}_0x4aba35[_0x9bc6('0x1e')](dbH[_0x9bc6('0x15')]['query'](util['format'](_0x9bc6('0x1f'),QUERY,_0x11c023,_0x561b67),{'type':dbH['sequelize'][_0x9bc6('0x20')][_0x9bc6('0x18')]}));});if(_0x3e3f0b>0x0){_0x561b67+=_0x11c023;_0x4aba35[_0x9bc6('0x1e')](dbH[_0x9bc6('0x15')][_0x9bc6('0x16')](util['format'](_0x9bc6('0x1f'),QUERY,_0x3e3f0b,_0x561b67),{'type':dbH['sequelize'][_0x9bc6('0x20')][_0x9bc6('0x18')]}));}}}else{_0x4aba35[_0x9bc6('0x1e')](dbH[_0x9bc6('0x15')][_0x9bc6('0x16')](QUERY,{'type':dbH['sequelize'][_0x9bc6('0x20')][_0x9bc6('0x18')]}));}var _0x2a8e48=path[_0x9bc6('0x21')](PATH);var _0x447044=path['basename'](PATH,_0x9bc6('0x22'));var _0x2f819b=_0x4c8be0['split']&&_0x4aba35[_0x9bc6('0x1b')]>0x1;var _0x17dfe7=[];if(!fs[_0x9bc6('0x23')](path['join'](_0x2a8e48,_0x447044))&&_0x2f819b){fs[_0x9bc6('0x24')](path[_0x9bc6('0x25')](_0x2a8e48,_0x447044));}return BPromise[_0x9bc6('0x26')](_0x4aba35,function(_0x17b6c2){_0x17dfe7[_0x9bc6('0x1e')](_0x17b6c2);})[_0x9bc6('0x14')](function(){for(var _0x45bc53=0x0;_0x45bc53<_0x17dfe7[_0x9bc6('0x1b')];_0x45bc53+=0x1){var _0x574b5b;var _0x41e847=_0x17dfe7[_0x45bc53];if(_0x2f819b){_0x574b5b=path[_0x9bc6('0x25')](_0x2a8e48,_0x447044,util['format'](_0x9bc6('0x27'),_0x447044,_0x45bc53,'csv'));}else{_0x574b5b=path['join'](_0x2a8e48,util[_0x9bc6('0xd')](_0x9bc6('0x28'),_0x447044,_0x9bc6('0x29')));}fs['writeFileSync'](_0x574b5b,csv(_0x41e847));}})['then'](function(){if(_0x2f819b){return new Promise(function(_0x3fa7fa){zipdir(path[_0x9bc6('0x25')](_0x2a8e48,_0x447044),{'saveTo':path['join'](_0x2a8e48,util['format']('%s.%s',_0x447044,_0x9bc6('0x2a')))},function(_0x531e66,_0x566fdf){rimraf(path[_0x9bc6('0x25')](_0x2a8e48,_0x447044),function(){});_0x3fa7fa(_0x9bc6('0x2b'));});});}})[_0x9bc6('0x14')](function(){logger[_0x9bc6('0x2c')](util[_0x9bc6('0xd')]('Extraction\x20report\x20with\x20id\x20%d\x20in\x20%s\x20format\x20completed',EXTRACTED_REPORT_ID,_0x9bc6('0xf')));return analyticExtractedReport(_0x9bc6('0x2d'),_0x2f819b?util['format']('%s.%s',_0x447044,_0x2f819b?_0x9bc6('0x2a'):_0x9bc6('0x29')):null);});})[_0x9bc6('0x2e')](function(_0x305392){logger[_0x9bc6('0x2c')](util['format'](_0x9bc6('0x2f'),EXTRACTED_REPORT_ID,_0x9bc6('0xf')),util[_0x9bc6('0x30')](_0x305392,{'showHidden':![],'depth':null}));EXIT_CODE=0x1;return analyticExtractedReport('Failed');})[_0x9bc6('0x31')](function(){process[_0x9bc6('0x32')](EXIT_CODE);});}main(); \ No newline at end of file +var _0xd068=['Extraction\x20report\x20with\x20id\x20%d\x20in\x20%s\x20format\x20completed','CSV','Completed','catch','Error\x20during\x20extraction\x20report\x20with\x20id\x20%d\x20in\x20%s\x20format','inspect','Failed','finally','exit','util','path','lodash','to-csv','zip-dir','rimraf','../../mysqldb','dbH','analytics','argv','update','info','find','split','splitSizeCsv','then','sequelize','query','format','SELECT\x20count(*)\x20as\x20num\x20FROM\x20(%s)\x20t','QueryTypes','SELECT','num','Empty','length','isInteger','push','%s\x20limit\x20%d\x20OFFSET\x20%d','basename','.csv','existsSync','mkdirSync','join','each','csv','%s.%s','zip'];(function(_0x1169cc,_0x2f2297){var _0x25554f=function(_0x36ed60){while(--_0x36ed60){_0x1169cc['push'](_0x1169cc['shift']());}};_0x25554f(++_0x2f2297);}(_0xd068,0x93));var _0x8d06=function(_0x1229d0,_0x1a77f9){_0x1229d0=_0x1229d0-0x0;var _0x88d89a=_0xd068[_0x1229d0];return _0x88d89a;};'use strict';var util=require(_0x8d06('0x0'));var path=require(_0x8d06('0x1'));var _=require(_0x8d06('0x2'));var csv=require(_0x8d06('0x3'));var fs=require('fs');var BPromise=require('bluebird');var zipdir=require(_0x8d06('0x4'));var rimraf=require(_0x8d06('0x5'));var db=require(_0x8d06('0x6'))['db'];var dbH=require(_0x8d06('0x6'))[_0x8d06('0x7')];var logger=require('../../config/logger')(_0x8d06('0x8'));var EXTRACTED_REPORT_ID=Number(process[_0x8d06('0x9')][0x2]);var QUERY=process[_0x8d06('0x9')][0x3];var PATH=process[_0x8d06('0x9')][0x4];var EXIT_CODE=0x0;function analyticExtractedReport(_0x474ef8,_0xf95dc9){var _0x3b2450={'status':_0x474ef8};var _0x3df197={'where':{'id':EXTRACTED_REPORT_ID}};if(_0xf95dc9){_0x3b2450['savename']=_0xf95dc9;}return db['AnalyticExtractedReport'][_0x8d06('0xa')](_0x3b2450,_0x3df197);}function main(){var _0x13828c=0x1388;var _0x9341b6;logger[_0x8d06('0xb')](util['format']('Start\x20extraction\x20report\x20with\x20id\x20%d\x20in\x20%s\x20format',EXTRACTED_REPORT_ID,'CSV'));return db['Setting'][_0x8d06('0xc')]({'where':{'id':0x1},'raw':!![],'attributes':['id',_0x8d06('0xd'),'splitSizeCsv']})['then'](function(_0x4b49e7){if(_0x4b49e7){_0x9341b6=_0x4b49e7;_0x13828c=_0x9341b6[_0x8d06('0xe')]||0x1388;}})[_0x8d06('0xf')](function(){return dbH[_0x8d06('0x10')][_0x8d06('0x11')](util[_0x8d06('0x12')](_0x8d06('0x13'),QUERY),{'type':dbH['sequelize'][_0x8d06('0x14')][_0x8d06('0x15')]});})['then'](function(_0x4be052){if(!_0x4be052[0x0][_0x8d06('0x16')]){return analyticExtractedReport(_0x8d06('0x17'));}var _0x5be9ce=[];var _0x1ed51e=0x0;if(_0x9341b6[_0x8d06('0xd')]){if(_0x4be052&&_0x4be052[_0x8d06('0x18')]){var _0x321f89=_['range'](_0x4be052[0x0][_0x8d06('0x16')]/_0x13828c);var _0x341bd4=Number[_0x8d06('0x19')](_0x4be052[0x0]['num']/_0x13828c)?_0x4be052[0x0][_0x8d06('0x16')]%_0x13828c:0x0;_0x321f89['forEach'](function(_0x179315){if(_0x179315>0x0){_0x1ed51e+=_0x13828c;}_0x5be9ce[_0x8d06('0x1a')](dbH[_0x8d06('0x10')][_0x8d06('0x11')](util['format'](_0x8d06('0x1b'),QUERY,_0x13828c,_0x1ed51e),{'type':dbH[_0x8d06('0x10')][_0x8d06('0x14')]['SELECT']}));});if(_0x341bd4>0x0){_0x1ed51e+=_0x13828c;_0x5be9ce[_0x8d06('0x1a')](dbH[_0x8d06('0x10')]['query'](util['format']('%s\x20limit\x20%d\x20OFFSET\x20%d',QUERY,_0x341bd4,_0x1ed51e),{'type':dbH[_0x8d06('0x10')][_0x8d06('0x14')]['SELECT']}));}}}else{_0x5be9ce[_0x8d06('0x1a')](dbH[_0x8d06('0x10')]['query'](QUERY,{'type':dbH[_0x8d06('0x10')][_0x8d06('0x14')][_0x8d06('0x15')]}));}var _0x2939a5=path['dirname'](PATH);var _0x2a8b9c=path[_0x8d06('0x1c')](PATH,_0x8d06('0x1d'));var _0x113d1b=_0x9341b6[_0x8d06('0xd')]&&_0x5be9ce[_0x8d06('0x18')]>0x1;var _0x2816cb=[];if(!fs[_0x8d06('0x1e')](path['join'](_0x2939a5,_0x2a8b9c))&&_0x113d1b){fs[_0x8d06('0x1f')](path[_0x8d06('0x20')](_0x2939a5,_0x2a8b9c));}return BPromise[_0x8d06('0x21')](_0x5be9ce,function(_0x9bb613){_0x2816cb[_0x8d06('0x1a')](_0x9bb613);})[_0x8d06('0xf')](function(){for(var _0x301321=0x0;_0x301321<_0x2816cb[_0x8d06('0x18')];_0x301321+=0x1){var _0xe0d46a;var _0x1971e6=_0x2816cb[_0x301321];if(_0x113d1b){_0xe0d46a=path['join'](_0x2939a5,_0x2a8b9c,util[_0x8d06('0x12')]('%s%d.%s',_0x2a8b9c,_0x301321,_0x8d06('0x22')));}else{_0xe0d46a=path['join'](_0x2939a5,util['format'](_0x8d06('0x23'),_0x2a8b9c,_0x8d06('0x22')));}fs['writeFileSync'](_0xe0d46a,csv(_0x1971e6));}})[_0x8d06('0xf')](function(){if(_0x113d1b){return new Promise(function(_0x55107e){zipdir(path['join'](_0x2939a5,_0x2a8b9c),{'saveTo':path[_0x8d06('0x20')](_0x2939a5,util[_0x8d06('0x12')](_0x8d06('0x23'),_0x2a8b9c,_0x8d06('0x24')))},function(_0x483248,_0x5f051e){rimraf(path[_0x8d06('0x20')](_0x2939a5,_0x2a8b9c),function(){});_0x55107e('zip\x20finished');});});}})[_0x8d06('0xf')](function(){logger['info'](util[_0x8d06('0x12')](_0x8d06('0x25'),EXTRACTED_REPORT_ID,_0x8d06('0x26')));return analyticExtractedReport(_0x8d06('0x27'),_0x113d1b?util[_0x8d06('0x12')](_0x8d06('0x23'),_0x2a8b9c,_0x113d1b?_0x8d06('0x24'):_0x8d06('0x22')):null);});})[_0x8d06('0x28')](function(_0x263e1b){logger['info'](util['format'](_0x8d06('0x29'),EXTRACTED_REPORT_ID,_0x8d06('0x26')),util[_0x8d06('0x2a')](_0x263e1b,{'showHidden':![],'depth':null}));EXIT_CODE=0x1;return analyticExtractedReport(_0x8d06('0x2b'));})[_0x8d06('0x2c')](function(){process[_0x8d06('0x2d')](EXIT_CODE);});}main(); \ No newline at end of file diff --git a/server/components/export/pdf.js b/server/components/export/pdf.js index ff05e45..a372ce8 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 _0x94ff=['join','flatten','createPdfKitDocument','%s%d.%s','pdf','%s.%s','all','zip','zip\x20finished','info','Extraction\x20report\x20with\x20id\x20%d\x20in\x20%s\x20format\x20completed','PDF','findOne','SELECT\x20count(*)\x20as\x20num\x20FROM\x20(%s)\x20t','catch','Error\x20during\x20extraction\x20report\x20with\x20id\x20%d\x20in\x20%s\x20format','inspect','exit','/fonts/arial-regular.ttf','/fonts/arial-bold.ttf','%s\x20#%d','channel','YYYY-MM-DD','toString','Arial','center','Interaction\x20Transcript','\x09\x09XCALLY\x20Motion\x20-\x20%s\x09\x09\x09\x09%d/%d\x09\x09\x09\x09%s','pipe','createWriteStream','finish','error','end','createPdfFromHTML','lodash','util','path','moment','html-to-pdfmake','pdfmake/src/printer','zip-dir','rimraf','jsdom','JSDOM','window','../../mysqldb','dbH','../../config/logger','analytics','argv','MMMM\x20Do\x20YYYY,\x20h:mm:ss\x20a','savename','AnalyticExtractedReport','update','map','tableHeader','value','fill','length','auto','body','push','concat','chunk','keys','format','Name:\x20%s\x0aReport:\x20%s\x0aFrom:\x20%s\x20To:\x20%s','name','startDate','endDate','header','pageBreak','before','margin','footer','black','right','num','Empty','find','splitSizePdf','then','split','range','forEach','sequelize','QueryTypes','SELECT','query','%s\x20limit\x20%d\x20OFFSET\x20%d','dirname','basename','.pdf','existsSync'];(function(_0x328b1c,_0xec0b4f){var _0x4dbeaa=function(_0x432519){while(--_0x432519){_0x328b1c['push'](_0x328b1c['shift']());}};_0x4dbeaa(++_0xec0b4f);}(_0x94ff,0x19a));var _0xf94f=function(_0x330faf,_0x4834ad){_0x330faf=_0x330faf-0x0;var _0x239bee=_0x94ff[_0x330faf];return _0x239bee;};'use strict';var _=require(_0xf94f('0x0'));var fs=require('fs');var util=require(_0xf94f('0x1'));var path=require(_0xf94f('0x2'));var moment=require(_0xf94f('0x3'));var htmlToPdfmake=require(_0xf94f('0x4'));var PdfPrinter=require(_0xf94f('0x5'));var zipdir=require(_0xf94f('0x6'));var rimraf=require(_0xf94f('0x7'));var JSDOM=require(_0xf94f('0x8'))[_0xf94f('0x9')];var window=new JSDOM('')[_0xf94f('0xa')];var BPromise=require('bluebird');var db=require(_0xf94f('0xb'))['db'];var dbH=require(_0xf94f('0xb'))[_0xf94f('0xc')];var logger=require(_0xf94f('0xd'))(_0xf94f('0xe'));var EXTRACTED_REPORT_ID=Number(process[_0xf94f('0xf')][0x2]);var QUERY=process[_0xf94f('0xf')][0x3];var PATH=process['argv'][0x4];var NAME=process[_0xf94f('0xf')][0x5];var FORMAT=_0xf94f('0x10');var EXTRACTED_REPORT;var EXIT_CODE=0x0;function analyticExtractedReport(_0x21cad9,_0x35c920){var _0x53e313={'status':_0x21cad9};var _0x3bbd16={'where':{'id':EXTRACTED_REPORT_ID}};if(_0x35c920){_0x53e313[_0xf94f('0x11')]=_0x35c920;}return db[_0xf94f('0x12')][_0xf94f('0x13')](_0x53e313,_0x3bbd16);}function getHeaders(_0x20e5cd){return _[_0xf94f('0x14')](_0x20e5cd,function(_0xdb8543){return{'text':_0xdb8543,'style':_0xf94f('0x15')};});}function getRows(_0x3e0c9c,_0x47395a){return _[_0xf94f('0x14')](_0x47395a,function(_0x57cb31){return _(_0x57cb31)['pick'](_0x3e0c9c)[_0xf94f('0x14')](function(_0x2ef51e){return _0x2ef51e?_['toString'](_0x2ef51e):'';})[_0xf94f('0x16')]();});}function createTable(_0x1110f8,_0x10b504){var _0x4c4743={'widths':_[_0xf94f('0x17')](Array(_0x1110f8[_0xf94f('0x18')]),0x91),'heights':function(_0x212075){return _0x212075===0x0?_0xf94f('0x19'):0x32;},'dontBreakRows':!![],'headerRows':0x1,'body':[]};var _0x331633=getHeaders(_0x1110f8);_0x4c4743[_0xf94f('0x1a')][_0xf94f('0x1b')](_0x331633);var _0x3e6e83=getRows(_0x1110f8,_0x10b504);_0x4c4743[_0xf94f('0x1a')]=_0x4c4743[_0xf94f('0x1a')][_0xf94f('0x1c')](_0x3e6e83);return _0x4c4743;}function createTables(_0x491c2e){var _0x534b2d=[];var _0x174ed3=_[_0xf94f('0x1d')](Object[_0xf94f('0x1e')](_0x491c2e[0x0]),0x5);_0x174ed3['forEach'](function(_0xf34352){_0x534b2d['push'](createTable(_0xf34352,_0x491c2e));});return _0x534b2d;}function getPDFDocDefinition(_0x59f589){var _0x5b1775=util[_0xf94f('0x1f')](_0xf94f('0x20'),NAME,EXTRACTED_REPORT[_0xf94f('0x21')],moment(EXTRACTED_REPORT[_0xf94f('0x22')])[_0xf94f('0x1f')](FORMAT),moment(EXTRACTED_REPORT[_0xf94f('0x23')])[_0xf94f('0x1f')](FORMAT));var _0x47cdd0=[];for(var _0x763821=0x0;_0x763821<_0x59f589['length'];_0x763821++){var _0x1f2dd0=[];if(_0x763821===0x0){_0x1f2dd0['push']({'text':_0x5b1775,'style':_0xf94f('0x24')});}var _0x5f2388={'table':_0x59f589[_0x763821]};if(_0x763821>0x0){_0x5f2388[_0xf94f('0x25')]=_0xf94f('0x26');_0x5f2388[_0xf94f('0x27')]=[0x0,0x46,0x0,0x0];}_0x1f2dd0[_0xf94f('0x1b')](_0x5f2388);_0x47cdd0['push'](_0x1f2dd0);}return{'pageSize':'A4','pageOrientation':'landscape','content':_0x47cdd0,'footer':function(_0x2edcac,_0x47260c){return{'text':_0x2edcac['toString']()+'\x20/\x20'+_0x47260c,'style':_0xf94f('0x28')};},'defaultStyle':{'font':'Arial'},'styles':{'header':{'fontSize':0x12,'bold':!![],'margin':[0x0,0x0,0x0,0xa]},'tableHeader':{'bold':!![],'fontSize':0xd,'color':_0xf94f('0x29')},'footer':{'alignment':_0xf94f('0x2a'),'margin':[0x0,0x0,0x28,0x0]}}};}function extractReport(_0x4ac520){var _0x4149b6=0x1388;var _0x6bccd5;if(!_0x4ac520[0x0][_0xf94f('0x2b')]){return analyticExtractedReport(_0xf94f('0x2c'));}return db['Setting'][_0xf94f('0x2d')]({'where':{'id':0x1},'raw':!![],'attributes':['id','split',_0xf94f('0x2e')]})[_0xf94f('0x2f')](function(_0x1f2276){if(_0x1f2276){_0x6bccd5=_0x1f2276;_0x4149b6=_0x6bccd5[_0xf94f('0x2e')]||0x3e8;}})[_0xf94f('0x2f')](function(){var _0x379358=[];var _0x22c9e5=0x0;if(_0x6bccd5[_0xf94f('0x30')]){if(_0x4ac520&&_0x4ac520[_0xf94f('0x18')]){var _0x38ba3f=_[_0xf94f('0x31')](_0x4ac520[0x0]['num']/_0x4149b6);var _0x5842be=Number['isInteger'](_0x4ac520[0x0][_0xf94f('0x2b')]/_0x4149b6)?_0x4ac520[0x0][_0xf94f('0x2b')]%_0x4149b6:0x0;_0x38ba3f[_0xf94f('0x32')](function(_0x8e742b){if(_0x8e742b>0x0){_0x22c9e5+=_0x4149b6;}_0x379358[_0xf94f('0x1b')](dbH[_0xf94f('0x33')]['query'](util[_0xf94f('0x1f')]('%s\x20limit\x20%d\x20OFFSET\x20%d',QUERY,_0x4149b6,_0x22c9e5),{'type':dbH['sequelize'][_0xf94f('0x34')][_0xf94f('0x35')]}));});if(_0x5842be>0x0){_0x22c9e5+=_0x4149b6;_0x379358[_0xf94f('0x1b')](dbH[_0xf94f('0x33')][_0xf94f('0x36')](util[_0xf94f('0x1f')](_0xf94f('0x37'),QUERY,_0x5842be,_0x22c9e5),{'type':dbH[_0xf94f('0x33')]['QueryTypes']['SELECT']}));}}}else{_0x379358['push'](dbH[_0xf94f('0x33')][_0xf94f('0x36')](QUERY,{'type':dbH[_0xf94f('0x33')][_0xf94f('0x34')][_0xf94f('0x35')]}));}var _0xa4d214=path[_0xf94f('0x38')](PATH);var _0x49a89f=path[_0xf94f('0x39')](PATH,_0xf94f('0x3a'));var _0x3ccbad=_0x6bccd5[_0xf94f('0x30')]&&_0x379358['length']>0x1;var _0x27c525=[];if(!fs[_0xf94f('0x3b')](path['join'](_0xa4d214,_0x49a89f))&&_0x3ccbad){fs['mkdirSync'](path[_0xf94f('0x3c')](_0xa4d214,_0x49a89f));}return BPromise['each'](_0x379358,function(_0x1dee8e){_0x27c525[_0xf94f('0x1b')](_0x1dee8e);})[_0xf94f('0x2f')](function(){var _0x2c6bd8=[];for(var _0x45d6ea=0x0;_0x45d6ea<_0x27c525[_0xf94f('0x18')];_0x45d6ea+=0x1){var _0x223843=_0x27c525[_0x45d6ea];var _0x49dd4a=createTables(_[_0xf94f('0x3d')](_0x223843));var _0xdf5e42;var _0x16a101=getPDFDocDefinition(_0x49dd4a);var _0x15070f=getPDFPrinter();var _0x4ac9d7=_0x15070f[_0xf94f('0x3e')](_0x16a101);if(_0x3ccbad){_0xdf5e42=path[_0xf94f('0x3c')](_0xa4d214,_0x49a89f,util['format'](_0xf94f('0x3f'),_0x49a89f,_0x45d6ea,_0xf94f('0x40')));}else{_0xdf5e42=path[_0xf94f('0x3c')](_0xa4d214,util[_0xf94f('0x1f')](_0xf94f('0x41'),_0x49a89f,'pdf'));}_0x2c6bd8[_0xf94f('0x1b')](writePDFDocument(_0x4ac9d7,_0xdf5e42));}return Promise[_0xf94f('0x42')](_0x2c6bd8);})[_0xf94f('0x2f')](function(){if(_0x3ccbad){return new Promise(function(_0x5e8f3c){zipdir(path['join'](_0xa4d214,_0x49a89f),{'saveTo':path[_0xf94f('0x3c')](_0xa4d214,util['format']('%s.%s',_0x49a89f,_0xf94f('0x43')))},function(){rimraf(path[_0xf94f('0x3c')](_0xa4d214,_0x49a89f),function(){});_0x5e8f3c(_0xf94f('0x44'));});});}})[_0xf94f('0x2f')](function(){if(!_0x3ccbad)return;rimraf(path['join'](_0xa4d214,_0x49a89f),function(){});})[_0xf94f('0x2f')](function(){logger[_0xf94f('0x45')](util[_0xf94f('0x1f')](_0xf94f('0x46'),EXTRACTED_REPORT_ID,_0xf94f('0x47')));return analyticExtractedReport('Completed',_0x3ccbad?util[_0xf94f('0x1f')]('%s.%s',_0x49a89f,_0x3ccbad?'zip':_0xf94f('0x40')):null);});});}function main(){if(!EXTRACTED_REPORT_ID)return;logger[_0xf94f('0x45')](util[_0xf94f('0x1f')]('Start\x20extraction\x20report\x20with\x20id\x20%d\x20in\x20%s\x20format',EXTRACTED_REPORT_ID,_0xf94f('0x47')));return db[_0xf94f('0x12')][_0xf94f('0x48')]({'where':{'id':EXTRACTED_REPORT_ID}})[_0xf94f('0x2f')](function(_0x221620){EXTRACTED_REPORT=_0x221620;return dbH[_0xf94f('0x33')][_0xf94f('0x36')](util[_0xf94f('0x1f')](_0xf94f('0x49'),QUERY),{'type':dbH[_0xf94f('0x33')][_0xf94f('0x34')][_0xf94f('0x35')]});})[_0xf94f('0x2f')](extractReport)[_0xf94f('0x4a')](function(_0x5db024){logger[_0xf94f('0x45')](util['format'](_0xf94f('0x4b'),EXTRACTED_REPORT_ID,_0xf94f('0x47')),util[_0xf94f('0x4c')](_0x5db024,{'showHidden':![],'depth':null}));EXIT_CODE=0x1;return analyticExtractedReport('Failed');})['finally'](function(){process[_0xf94f('0x4d')](EXIT_CODE);});}main();function getPDFPrinter(){var _0x21504b=new PdfPrinter({'Arial':{'normal':__dirname+_0xf94f('0x4e'),'bold':__dirname+_0xf94f('0x4f'),'italics':__dirname+'/fonts/arial-italic.ttf','bolditalics':__dirname+'/fonts/arial-bold-italic.ttf'}});return _0x21504b;}function getPDFDocDefinitionFromHTML(_0xf08096,_0x330950){var _0x46cc86=util['format'](_0xf94f('0x50'),_0x330950[_0xf94f('0x51')],_0x330950['interactionId']);var _0x50de3a=moment()[_0xf94f('0x1f')](_0xf94f('0x52'))[_0xf94f('0x53')]();var _0x4a3d5d=htmlToPdfmake(_0xf08096,{'window':window,'tableAutoSize':!![]});return{'content':[_0x4a3d5d],'defaultStyle':{'font':_0xf94f('0x54')},'styles':{'header':{'fontSize':0x12,'bold':!![],'alignment':_0xf94f('0x55'),'margin':[0xa,0xa,0xa,0xa]},'footer':{'fontSize':0x9,'alignment':_0xf94f('0x55'),'margin':[0xa,0x14,0xa,0xa]},'textblock':{'fontSize':0xb},'textfield':{'bold':!![]},'messageContainer':{'fontSize':0xa},'messageInfo':{'bold':!![]},'interactionData':{'alignment':'center'}},'header':function(){return[{'text':_0xf94f('0x56'),'style':_0xf94f('0x24')}];},'footer':function(_0x2ec461,_0xcebf86){return[{'text':util['format'](_0xf94f('0x57'),_0x46cc86,_0x2ec461,_0xcebf86,_0x50de3a),'style':_0xf94f('0x28')}];}};}function writePDFDocument(_0x1cf2ae,_0x439a45){return new Promise(function(_0x11e2bc,_0x3b7bf8){var _0x45532b=_0x1cf2ae[_0xf94f('0x58')](fs[_0xf94f('0x59')](_0x439a45));_0x45532b['on']('finish',function(){_0x11e2bc(_0xf94f('0x5a'));});_0x45532b['on'](_0xf94f('0x5b'),function(_0x58bf2f){_0x3b7bf8(_0x58bf2f);});_0x1cf2ae[_0xf94f('0x5c')]();});}exports[_0xf94f('0x5d')]=function(_0x173869,_0x2f3fd0){var _0x30eb82=getPDFPrinter();var _0x4c1f57=getPDFDocDefinitionFromHTML(_0x173869,_0x2f3fd0);var _0x4fd144=_0x30eb82[_0xf94f('0x3e')](_0x4c1f57);return writePDFDocument(_0x4fd144,_0x2f3fd0['path'])[_0xf94f('0x4a')](function(_0x4f5073){throw _0x4f5073;});}; \ No newline at end of file +var _0xf4f7=['finally','exit','/fonts/arial-regular.ttf','/fonts/arial-italic.ttf','/fonts/arial-bold-italic.ttf','%s\x20#%d','channel','YYYY-MM-DD','Arial','center','createWriteStream','finish','end','createPdfFromHTML','lodash','path','html-to-pdfmake','pdfmake/src/printer','zip-dir','rimraf','jsdom','JSDOM','window','bluebird','../../mysqldb','dbH','analytics','argv','MMMM\x20Do\x20YYYY,\x20h:mm:ss\x20a','savename','AnalyticExtractedReport','update','map','toString','value','fill','body','chunk','keys','forEach','push','format','Name:\x20%s\x0aReport:\x20%s\x0aFrom:\x20%s\x20To:\x20%s','name','endDate','length','header','pageBreak','before','landscape','\x20/\x20','footer','black','right','Empty','Setting','find','split','then','splitSizePdf','range','num','isInteger','sequelize','query','%s\x20limit\x20%d\x20OFFSET\x20%d','QueryTypes','SELECT','dirname','basename','existsSync','join','mkdirSync','each','flatten','createPdfKitDocument','pdf','%s.%s','all','zip','PDF','Completed','info','Start\x20extraction\x20report\x20with\x20id\x20%d\x20in\x20%s\x20format','catch','Failed'];(function(_0x109db5,_0x1da358){var _0x5b1dc9=function(_0x5b51c2){while(--_0x5b51c2){_0x109db5['push'](_0x109db5['shift']());}};_0x5b1dc9(++_0x1da358);}(_0xf4f7,0x110));var _0x7f4f=function(_0x43776a,_0x4eb74c){_0x43776a=_0x43776a-0x0;var _0x18eb8f=_0xf4f7[_0x43776a];return _0x18eb8f;};'use strict';var _=require(_0x7f4f('0x0'));var fs=require('fs');var util=require('util');var path=require(_0x7f4f('0x1'));var moment=require('moment');var htmlToPdfmake=require(_0x7f4f('0x2'));var PdfPrinter=require(_0x7f4f('0x3'));var zipdir=require(_0x7f4f('0x4'));var rimraf=require(_0x7f4f('0x5'));var JSDOM=require(_0x7f4f('0x6'))[_0x7f4f('0x7')];var window=new JSDOM('')[_0x7f4f('0x8')];var BPromise=require(_0x7f4f('0x9'));var db=require('../../mysqldb')['db'];var dbH=require(_0x7f4f('0xa'))[_0x7f4f('0xb')];var logger=require('../../config/logger')(_0x7f4f('0xc'));var EXTRACTED_REPORT_ID=Number(process[_0x7f4f('0xd')][0x2]);var QUERY=process[_0x7f4f('0xd')][0x3];var PATH=process[_0x7f4f('0xd')][0x4];var NAME=process[_0x7f4f('0xd')][0x5];var FORMAT=_0x7f4f('0xe');var EXTRACTED_REPORT;var EXIT_CODE=0x0;function analyticExtractedReport(_0x59e0cb,_0x642eea){var _0x2daa80={'status':_0x59e0cb};var _0x55b10b={'where':{'id':EXTRACTED_REPORT_ID}};if(_0x642eea){_0x2daa80[_0x7f4f('0xf')]=_0x642eea;}return db[_0x7f4f('0x10')][_0x7f4f('0x11')](_0x2daa80,_0x55b10b);}function getHeaders(_0x33978f){return _[_0x7f4f('0x12')](_0x33978f,function(_0x8ba06a){return{'text':_0x8ba06a,'style':'tableHeader'};});}function getRows(_0xcbdf89,_0x1071b4){return _[_0x7f4f('0x12')](_0x1071b4,function(_0x44fff7){return _(_0x44fff7)['pick'](_0xcbdf89)[_0x7f4f('0x12')](function(_0x125576){return _0x125576?_[_0x7f4f('0x13')](_0x125576):'';})[_0x7f4f('0x14')]();});}function createTable(_0x59a36c,_0x5a154d){var _0x973eb9={'widths':_[_0x7f4f('0x15')](Array(_0x59a36c['length']),0x91),'heights':function(_0x389f5c){return _0x389f5c===0x0?'auto':0x32;},'dontBreakRows':!![],'headerRows':0x1,'body':[]};var _0x3dec02=getHeaders(_0x59a36c);_0x973eb9['body']['push'](_0x3dec02);var _0x37a190=getRows(_0x59a36c,_0x5a154d);_0x973eb9[_0x7f4f('0x16')]=_0x973eb9[_0x7f4f('0x16')]['concat'](_0x37a190);return _0x973eb9;}function createTables(_0x11fdf5){var _0x393789=[];var _0xb93744=_[_0x7f4f('0x17')](Object[_0x7f4f('0x18')](_0x11fdf5[0x0]),0x5);_0xb93744[_0x7f4f('0x19')](function(_0x446ec6){_0x393789[_0x7f4f('0x1a')](createTable(_0x446ec6,_0x11fdf5));});return _0x393789;}function getPDFDocDefinition(_0x85f3d6){var _0x5ea967=util[_0x7f4f('0x1b')](_0x7f4f('0x1c'),NAME,EXTRACTED_REPORT[_0x7f4f('0x1d')],moment(EXTRACTED_REPORT['startDate'])[_0x7f4f('0x1b')](FORMAT),moment(EXTRACTED_REPORT[_0x7f4f('0x1e')])[_0x7f4f('0x1b')](FORMAT));var _0x181d7c=[];for(var _0x512847=0x0;_0x512847<_0x85f3d6[_0x7f4f('0x1f')];_0x512847++){var _0x30c228=[];if(_0x512847===0x0){_0x30c228[_0x7f4f('0x1a')]({'text':_0x5ea967,'style':_0x7f4f('0x20')});}var _0x300caf={'table':_0x85f3d6[_0x512847]};if(_0x512847>0x0){_0x300caf[_0x7f4f('0x21')]=_0x7f4f('0x22');_0x300caf['margin']=[0x0,0x46,0x0,0x0];}_0x30c228[_0x7f4f('0x1a')](_0x300caf);_0x181d7c[_0x7f4f('0x1a')](_0x30c228);}return{'pageSize':'A4','pageOrientation':_0x7f4f('0x23'),'content':_0x181d7c,'footer':function(_0x54e53b,_0x351996){return{'text':_0x54e53b[_0x7f4f('0x13')]()+_0x7f4f('0x24')+_0x351996,'style':_0x7f4f('0x25')};},'defaultStyle':{'font':'Arial'},'styles':{'header':{'fontSize':0x12,'bold':!![],'margin':[0x0,0x0,0x0,0xa]},'tableHeader':{'bold':!![],'fontSize':0xd,'color':_0x7f4f('0x26')},'footer':{'alignment':_0x7f4f('0x27'),'margin':[0x0,0x0,0x28,0x0]}}};}function extractReport(_0x22a2d4){var _0x56cc93=0x1388;var _0x1c6670;if(!_0x22a2d4[0x0]['num']){return analyticExtractedReport(_0x7f4f('0x28'));}return db[_0x7f4f('0x29')][_0x7f4f('0x2a')]({'where':{'id':0x1},'raw':!![],'attributes':['id',_0x7f4f('0x2b'),'splitSizePdf']})[_0x7f4f('0x2c')](function(_0x5b2fdd){if(_0x5b2fdd){_0x1c6670=_0x5b2fdd;_0x56cc93=_0x1c6670[_0x7f4f('0x2d')]||0x3e8;}})[_0x7f4f('0x2c')](function(){var _0xb7eaab=[];var _0x1bb932=0x0;if(_0x1c6670[_0x7f4f('0x2b')]){if(_0x22a2d4&&_0x22a2d4['length']){var _0x43058c=_[_0x7f4f('0x2e')](_0x22a2d4[0x0][_0x7f4f('0x2f')]/_0x56cc93);var _0x3f02d5=Number[_0x7f4f('0x30')](_0x22a2d4[0x0]['num']/_0x56cc93)?_0x22a2d4[0x0][_0x7f4f('0x2f')]%_0x56cc93:0x0;_0x43058c[_0x7f4f('0x19')](function(_0x2ccfb1){if(_0x2ccfb1>0x0){_0x1bb932+=_0x56cc93;}_0xb7eaab[_0x7f4f('0x1a')](dbH[_0x7f4f('0x31')][_0x7f4f('0x32')](util[_0x7f4f('0x1b')](_0x7f4f('0x33'),QUERY,_0x56cc93,_0x1bb932),{'type':dbH[_0x7f4f('0x31')][_0x7f4f('0x34')]['SELECT']}));});if(_0x3f02d5>0x0){_0x1bb932+=_0x56cc93;_0xb7eaab[_0x7f4f('0x1a')](dbH[_0x7f4f('0x31')][_0x7f4f('0x32')](util[_0x7f4f('0x1b')](_0x7f4f('0x33'),QUERY,_0x3f02d5,_0x1bb932),{'type':dbH[_0x7f4f('0x31')][_0x7f4f('0x34')][_0x7f4f('0x35')]}));}}}else{_0xb7eaab[_0x7f4f('0x1a')](dbH[_0x7f4f('0x31')]['query'](QUERY,{'type':dbH[_0x7f4f('0x31')][_0x7f4f('0x34')][_0x7f4f('0x35')]}));}var _0x10eb24=path[_0x7f4f('0x36')](PATH);var _0x1f3b68=path[_0x7f4f('0x37')](PATH,'.pdf');var _0x44e30=_0x1c6670['split']&&_0xb7eaab['length']>0x1;var _0xd75485=[];if(!fs[_0x7f4f('0x38')](path[_0x7f4f('0x39')](_0x10eb24,_0x1f3b68))&&_0x44e30){fs[_0x7f4f('0x3a')](path[_0x7f4f('0x39')](_0x10eb24,_0x1f3b68));}return BPromise[_0x7f4f('0x3b')](_0xb7eaab,function(_0xb60894){_0xd75485[_0x7f4f('0x1a')](_0xb60894);})[_0x7f4f('0x2c')](function(){var _0xb32422=[];for(var _0x3de691=0x0;_0x3de691<_0xd75485[_0x7f4f('0x1f')];_0x3de691+=0x1){var _0x53dfd7=_0xd75485[_0x3de691];var _0x225fe2=createTables(_[_0x7f4f('0x3c')](_0x53dfd7));var _0x24e5d8;var _0x152d25=getPDFDocDefinition(_0x225fe2);var _0x403f3a=getPDFPrinter();var _0x1dade2=_0x403f3a[_0x7f4f('0x3d')](_0x152d25);if(_0x44e30){_0x24e5d8=path[_0x7f4f('0x39')](_0x10eb24,_0x1f3b68,util[_0x7f4f('0x1b')]('%s%d.%s',_0x1f3b68,_0x3de691,_0x7f4f('0x3e')));}else{_0x24e5d8=path['join'](_0x10eb24,util[_0x7f4f('0x1b')](_0x7f4f('0x3f'),_0x1f3b68,_0x7f4f('0x3e')));}_0xb32422['push'](writePDFDocument(_0x1dade2,_0x24e5d8));}return Promise[_0x7f4f('0x40')](_0xb32422);})[_0x7f4f('0x2c')](function(){if(_0x44e30){return new Promise(function(_0x57e7f3){zipdir(path[_0x7f4f('0x39')](_0x10eb24,_0x1f3b68),{'saveTo':path[_0x7f4f('0x39')](_0x10eb24,util[_0x7f4f('0x1b')](_0x7f4f('0x3f'),_0x1f3b68,_0x7f4f('0x41')))},function(){rimraf(path[_0x7f4f('0x39')](_0x10eb24,_0x1f3b68),function(){});_0x57e7f3('zip\x20finished');});});}})[_0x7f4f('0x2c')](function(){if(!_0x44e30)return;rimraf(path[_0x7f4f('0x39')](_0x10eb24,_0x1f3b68),function(){});})[_0x7f4f('0x2c')](function(){logger['info'](util['format']('Extraction\x20report\x20with\x20id\x20%d\x20in\x20%s\x20format\x20completed',EXTRACTED_REPORT_ID,_0x7f4f('0x42')));return analyticExtractedReport(_0x7f4f('0x43'),_0x44e30?util['format'](_0x7f4f('0x3f'),_0x1f3b68,_0x44e30?_0x7f4f('0x41'):'pdf'):null);});});}function main(){if(!EXTRACTED_REPORT_ID)return;logger[_0x7f4f('0x44')](util[_0x7f4f('0x1b')](_0x7f4f('0x45'),EXTRACTED_REPORT_ID,_0x7f4f('0x42')));return db[_0x7f4f('0x10')]['findOne']({'where':{'id':EXTRACTED_REPORT_ID}})['then'](function(_0xbd44dd){EXTRACTED_REPORT=_0xbd44dd;return dbH[_0x7f4f('0x31')]['query'](util[_0x7f4f('0x1b')]('SELECT\x20count(*)\x20as\x20num\x20FROM\x20(%s)\x20t',QUERY),{'type':dbH['sequelize'][_0x7f4f('0x34')][_0x7f4f('0x35')]});})['then'](extractReport)[_0x7f4f('0x46')](function(_0x5726e3){logger['info'](util[_0x7f4f('0x1b')]('Error\x20during\x20extraction\x20report\x20with\x20id\x20%d\x20in\x20%s\x20format',EXTRACTED_REPORT_ID,_0x7f4f('0x42')),util['inspect'](_0x5726e3,{'showHidden':![],'depth':null}));EXIT_CODE=0x1;return analyticExtractedReport(_0x7f4f('0x47'));})[_0x7f4f('0x48')](function(){process[_0x7f4f('0x49')](EXIT_CODE);});}main();function getPDFPrinter(){var _0x56533b=new PdfPrinter({'Arial':{'normal':__dirname+_0x7f4f('0x4a'),'bold':__dirname+'/fonts/arial-bold.ttf','italics':__dirname+_0x7f4f('0x4b'),'bolditalics':__dirname+_0x7f4f('0x4c')}});return _0x56533b;}function getPDFDocDefinitionFromHTML(_0x52a351,_0x4d1e92){var _0x3f469f=util[_0x7f4f('0x1b')](_0x7f4f('0x4d'),_0x4d1e92[_0x7f4f('0x4e')],_0x4d1e92['interactionId']);var _0x2f8018=moment()[_0x7f4f('0x1b')](_0x7f4f('0x4f'))['toString']();var _0x523cc4=htmlToPdfmake(_0x52a351,{'window':window,'tableAutoSize':!![]});return{'content':[_0x523cc4],'defaultStyle':{'font':_0x7f4f('0x50')},'styles':{'header':{'fontSize':0x12,'bold':!![],'alignment':'center','margin':[0xa,0xa,0xa,0xa]},'footer':{'fontSize':0x9,'alignment':_0x7f4f('0x51'),'margin':[0xa,0x14,0xa,0xa]},'textblock':{'fontSize':0xb},'textfield':{'bold':!![]},'messageContainer':{'fontSize':0xa},'messageInfo':{'bold':!![]},'interactionData':{'alignment':_0x7f4f('0x51')}},'header':function(){return[{'text':'Interaction\x20Transcript','style':_0x7f4f('0x20')}];},'footer':function(_0x3efab2,_0x54fbd6){return[{'text':util[_0x7f4f('0x1b')]('\x09\x09XCALLY\x20Motion\x20-\x20%s\x09\x09\x09\x09%d/%d\x09\x09\x09\x09%s',_0x3f469f,_0x3efab2,_0x54fbd6,_0x2f8018),'style':_0x7f4f('0x25')}];}};}function writePDFDocument(_0x38054c,_0x44bc2d){return new Promise(function(_0x560ce0,_0x2b81ca){var _0x38b9e4=_0x38054c['pipe'](fs[_0x7f4f('0x52')](_0x44bc2d));_0x38b9e4['on'](_0x7f4f('0x53'),function(){_0x560ce0(_0x7f4f('0x53'));});_0x38b9e4['on']('error',function(_0x577be5){_0x2b81ca(_0x577be5);});_0x38054c[_0x7f4f('0x54')]();});}exports[_0x7f4f('0x55')]=function(_0x11584b,_0x482a5f){var _0x1be1cc=getPDFPrinter();var _0x25c29c=getPDFDocDefinitionFromHTML(_0x11584b,_0x482a5f);var _0x4b54d4=_0x1be1cc[_0x7f4f('0x3d')](_0x25c29c);return writePDFDocument(_0x4b54d4,_0x482a5f['path'])[_0x7f4f('0x46')](function(_0x4cc4c3){throw _0x4cc4c3;});}; \ No newline at end of file diff --git a/server/components/export/xlsx.js b/server/components/export/xlsx.js index 4c7887c..3840d9c 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 _0xd0d5=['QueryTypes','SELECT','Empty','length','num','isInteger','push','%s\x20limit\x20%d\x20OFFSET\x20%d','dirname','.xlsx','join','%s%d.%s','xlsx','%s.%s','zip','zip\x20finished','Completed','catch','Error\x20during\x20extraction\x20report\x20with\x20id\x20%d\x20in\x20%s\x20format','inspect','Failed','finally','exit','util','lodash','json2xls','bluebird','zip-dir','rimraf','../../mysqldb','dbH','../../config/logger','analytics','argv','AnalyticExtractedReport','update','format','Start\x20extraction\x20report\x20with\x20id\x20%d\x20in\x20%s\x20format','XLSX','Setting','split','splitSizeXlsx','then','query','SELECT\x20count(*)\x20as\x20num\x20FROM\x20(%s)\x20t','sequelize'];(function(_0xc3978,_0x562d02){var _0x5ce9f1=function(_0x131081){while(--_0x131081){_0xc3978['push'](_0xc3978['shift']());}};_0x5ce9f1(++_0x562d02);}(_0xd0d5,0x1e3));var _0x5d0d=function(_0x132e80,_0x252c23){_0x132e80=_0x132e80-0x0;var _0x1b4d90=_0xd0d5[_0x132e80];return _0x1b4d90;};'use strict';var util=require(_0x5d0d('0x0'));var path=require('path');var _=require(_0x5d0d('0x1'));var fs=require('fs');var json2xls=require(_0x5d0d('0x2'));var BPromise=require(_0x5d0d('0x3'));var zipdir=require(_0x5d0d('0x4'));var rimraf=require(_0x5d0d('0x5'));var db=require(_0x5d0d('0x6'))['db'];var dbH=require(_0x5d0d('0x6'))[_0x5d0d('0x7')];var logger=require(_0x5d0d('0x8'))(_0x5d0d('0x9'));var EXTRACTED_REPORT_ID=Number(process[_0x5d0d('0xa')][0x2]);var QUERY=process[_0x5d0d('0xa')][0x3];var PATH=process['argv'][0x4];var EXIT_CODE=0x0;function analyticExtractedReport(_0x3e85b4,_0x2ab362){var _0x5019d5={'status':_0x3e85b4};var _0x68bc77={'where':{'id':EXTRACTED_REPORT_ID}};if(_0x2ab362){_0x5019d5['savename']=_0x2ab362;}return db[_0x5d0d('0xb')][_0x5d0d('0xc')](_0x5019d5,_0x68bc77);}function main(){var _0x1ad570=0x1388;var _0x491bea;logger['info'](util[_0x5d0d('0xd')](_0x5d0d('0xe'),EXTRACTED_REPORT_ID,_0x5d0d('0xf')));return db[_0x5d0d('0x10')]['find']({'where':{'id':0x1},'raw':!![],'attributes':['id',_0x5d0d('0x11'),_0x5d0d('0x12')]})['then'](function(_0x3ec862){if(_0x3ec862){_0x491bea=_0x3ec862;_0x1ad570=_0x491bea['splitSizeXlsx']||0x1388;}})[_0x5d0d('0x13')](function(){return dbH['sequelize'][_0x5d0d('0x14')](util[_0x5d0d('0xd')](_0x5d0d('0x15'),QUERY),{'type':dbH[_0x5d0d('0x16')][_0x5d0d('0x17')][_0x5d0d('0x18')]});})[_0x5d0d('0x13')](function(_0x318f04){if(!_0x318f04[0x0]['num']){return analyticExtractedReport(_0x5d0d('0x19'));}var _0x3e141c=[];var _0x2148c2=0x0;if(_0x491bea[_0x5d0d('0x11')]){if(_0x318f04&&_0x318f04[_0x5d0d('0x1a')]){var _0x3e9c43=_['range'](_0x318f04[0x0][_0x5d0d('0x1b')]/_0x1ad570);var _0x16c9e5=Number[_0x5d0d('0x1c')](_0x318f04[0x0][_0x5d0d('0x1b')]/_0x1ad570)?_0x318f04[0x0][_0x5d0d('0x1b')]%_0x1ad570:0x0;_0x3e9c43['forEach'](function(_0x14a9d0){if(_0x14a9d0>0x0){_0x2148c2+=_0x1ad570;}_0x3e141c[_0x5d0d('0x1d')](dbH[_0x5d0d('0x16')][_0x5d0d('0x14')](util['format'](_0x5d0d('0x1e'),QUERY,_0x1ad570,_0x2148c2),{'type':dbH[_0x5d0d('0x16')][_0x5d0d('0x17')][_0x5d0d('0x18')]}));});if(_0x16c9e5>0x0){_0x2148c2+=_0x1ad570;_0x3e141c[_0x5d0d('0x1d')](dbH[_0x5d0d('0x16')][_0x5d0d('0x14')](util[_0x5d0d('0xd')](_0x5d0d('0x1e'),QUERY,_0x16c9e5,_0x2148c2),{'type':dbH['sequelize'][_0x5d0d('0x17')][_0x5d0d('0x18')]}));}}}else{_0x3e141c[_0x5d0d('0x1d')](dbH[_0x5d0d('0x16')]['query'](QUERY,{'type':dbH[_0x5d0d('0x16')]['QueryTypes'][_0x5d0d('0x18')]}));}var _0xf0df0e=path[_0x5d0d('0x1f')](PATH);var _0x32e22e=path['basename'](PATH,_0x5d0d('0x20'));var _0x2b02ea=_0x491bea[_0x5d0d('0x11')]&&_0x3e141c[_0x5d0d('0x1a')]>0x1;var _0x179eb3=[];if(!fs['existsSync'](path[_0x5d0d('0x21')](_0xf0df0e,_0x32e22e))&&_0x2b02ea){fs['mkdirSync'](path['join'](_0xf0df0e,_0x32e22e));}return BPromise['each'](_0x3e141c,function(_0x2550aa){_0x179eb3['push'](_0x2550aa);})[_0x5d0d('0x13')](function(){for(var _0x4e7be0=0x0;_0x4e7be0<_0x179eb3['length'];_0x4e7be0+=0x1){var _0x244e69;var _0x177792=_0x179eb3[_0x4e7be0];if(_0x2b02ea){_0x244e69=path[_0x5d0d('0x21')](_0xf0df0e,_0x32e22e,util[_0x5d0d('0xd')](_0x5d0d('0x22'),_0x32e22e,_0x4e7be0,_0x5d0d('0x23')));}else{_0x244e69=path[_0x5d0d('0x21')](_0xf0df0e,util['format'](_0x5d0d('0x24'),_0x32e22e,_0x5d0d('0x23')));}fs['writeFileSync'](_0x244e69,json2xls(_0x177792),'binary');}})[_0x5d0d('0x13')](function(){if(_0x2b02ea){return new Promise(function(_0xfd49d7){zipdir(path['join'](_0xf0df0e,_0x32e22e),{'saveTo':path['join'](_0xf0df0e,util[_0x5d0d('0xd')](_0x5d0d('0x24'),_0x32e22e,_0x5d0d('0x25')))},function(_0x4d780a,_0x278f0d){rimraf(path[_0x5d0d('0x21')](_0xf0df0e,_0x32e22e),function(){});_0xfd49d7(_0x5d0d('0x26'));});});}})[_0x5d0d('0x13')](function(){logger['info'](util[_0x5d0d('0xd')]('Extraction\x20report\x20with\x20id\x20%d\x20in\x20%s\x20format\x20completed',EXTRACTED_REPORT_ID,_0x5d0d('0xf')));return analyticExtractedReport(_0x5d0d('0x27'),_0x2b02ea?util[_0x5d0d('0xd')]('%s.%s',_0x32e22e,_0x2b02ea?'zip':_0x5d0d('0x23')):null);});})[_0x5d0d('0x28')](function(_0x33a164){logger['info'](util[_0x5d0d('0xd')](_0x5d0d('0x29'),EXTRACTED_REPORT_ID,'XLSX'),util[_0x5d0d('0x2a')](_0x33a164,{'showHidden':![],'depth':null}));EXIT_CODE=0x1;return analyticExtractedReport(_0x5d0d('0x2b'));})[_0x5d0d('0x2c')](function(){process[_0x5d0d('0x2d')](EXIT_CODE);});}main(); \ No newline at end of file +var _0x46d9=['Error\x20during\x20extraction\x20report\x20with\x20id\x20%d\x20in\x20%s\x20format','inspect','Failed','finally','exit','util','path','lodash','json2xls','bluebird','zip-dir','rimraf','../../mysqldb','dbH','../../config/logger','analytics','argv','savename','AnalyticExtractedReport','update','info','format','Start\x20extraction\x20report\x20with\x20id\x20%d\x20in\x20%s\x20format','XLSX','split','splitSizeXlsx','then','sequelize','query','SELECT\x20count(*)\x20as\x20num\x20FROM\x20(%s)\x20t','QueryTypes','SELECT','Empty','length','num','forEach','push','%s\x20limit\x20%d\x20OFFSET\x20%d','.xlsx','existsSync','join','each','%s%d.%s','xlsx','%s.%s','writeFileSync','binary','zip','Extraction\x20report\x20with\x20id\x20%d\x20in\x20%s\x20format\x20completed','Completed','catch'];(function(_0x41d4bf,_0x4e6790){var _0x58f411=function(_0x574d33){while(--_0x574d33){_0x41d4bf['push'](_0x41d4bf['shift']());}};_0x58f411(++_0x4e6790);}(_0x46d9,0x16a));var _0x946d=function(_0x31d025,_0x3237e1){_0x31d025=_0x31d025-0x0;var _0x1d69df=_0x46d9[_0x31d025];return _0x1d69df;};'use strict';var util=require(_0x946d('0x0'));var path=require(_0x946d('0x1'));var _=require(_0x946d('0x2'));var fs=require('fs');var json2xls=require(_0x946d('0x3'));var BPromise=require(_0x946d('0x4'));var zipdir=require(_0x946d('0x5'));var rimraf=require(_0x946d('0x6'));var db=require('../../mysqldb')['db'];var dbH=require(_0x946d('0x7'))[_0x946d('0x8')];var logger=require(_0x946d('0x9'))(_0x946d('0xa'));var EXTRACTED_REPORT_ID=Number(process[_0x946d('0xb')][0x2]);var QUERY=process[_0x946d('0xb')][0x3];var PATH=process[_0x946d('0xb')][0x4];var EXIT_CODE=0x0;function analyticExtractedReport(_0x1fa598,_0x4d4d2d){var _0x40b800={'status':_0x1fa598};var _0xf7200a={'where':{'id':EXTRACTED_REPORT_ID}};if(_0x4d4d2d){_0x40b800[_0x946d('0xc')]=_0x4d4d2d;}return db[_0x946d('0xd')][_0x946d('0xe')](_0x40b800,_0xf7200a);}function main(){var _0x3c1612=0x1388;var _0xac810f;logger[_0x946d('0xf')](util[_0x946d('0x10')](_0x946d('0x11'),EXTRACTED_REPORT_ID,_0x946d('0x12')));return db['Setting']['find']({'where':{'id':0x1},'raw':!![],'attributes':['id',_0x946d('0x13'),_0x946d('0x14')]})[_0x946d('0x15')](function(_0x510f49){if(_0x510f49){_0xac810f=_0x510f49;_0x3c1612=_0xac810f['splitSizeXlsx']||0x1388;}})[_0x946d('0x15')](function(){return dbH[_0x946d('0x16')][_0x946d('0x17')](util[_0x946d('0x10')](_0x946d('0x18'),QUERY),{'type':dbH[_0x946d('0x16')][_0x946d('0x19')][_0x946d('0x1a')]});})[_0x946d('0x15')](function(_0x597bbb){if(!_0x597bbb[0x0]['num']){return analyticExtractedReport(_0x946d('0x1b'));}var _0x307eeb=[];var _0x30412c=0x0;if(_0xac810f[_0x946d('0x13')]){if(_0x597bbb&&_0x597bbb[_0x946d('0x1c')]){var _0x483235=_['range'](_0x597bbb[0x0][_0x946d('0x1d')]/_0x3c1612);var _0x207953=Number['isInteger'](_0x597bbb[0x0][_0x946d('0x1d')]/_0x3c1612)?_0x597bbb[0x0]['num']%_0x3c1612:0x0;_0x483235[_0x946d('0x1e')](function(_0x47cf91){if(_0x47cf91>0x0){_0x30412c+=_0x3c1612;}_0x307eeb['push'](dbH[_0x946d('0x16')][_0x946d('0x17')](util[_0x946d('0x10')]('%s\x20limit\x20%d\x20OFFSET\x20%d',QUERY,_0x3c1612,_0x30412c),{'type':dbH[_0x946d('0x16')][_0x946d('0x19')]['SELECT']}));});if(_0x207953>0x0){_0x30412c+=_0x3c1612;_0x307eeb[_0x946d('0x1f')](dbH[_0x946d('0x16')]['query'](util[_0x946d('0x10')](_0x946d('0x20'),QUERY,_0x207953,_0x30412c),{'type':dbH[_0x946d('0x16')][_0x946d('0x19')][_0x946d('0x1a')]}));}}}else{_0x307eeb['push'](dbH['sequelize'][_0x946d('0x17')](QUERY,{'type':dbH[_0x946d('0x16')][_0x946d('0x19')]['SELECT']}));}var _0x2a0a9e=path['dirname'](PATH);var _0x3d756c=path['basename'](PATH,_0x946d('0x21'));var _0x22e5f2=_0xac810f[_0x946d('0x13')]&&_0x307eeb['length']>0x1;var _0x249ffb=[];if(!fs[_0x946d('0x22')](path[_0x946d('0x23')](_0x2a0a9e,_0x3d756c))&&_0x22e5f2){fs['mkdirSync'](path[_0x946d('0x23')](_0x2a0a9e,_0x3d756c));}return BPromise[_0x946d('0x24')](_0x307eeb,function(_0x17f268){_0x249ffb[_0x946d('0x1f')](_0x17f268);})[_0x946d('0x15')](function(){for(var _0x7b41e5=0x0;_0x7b41e5<_0x249ffb[_0x946d('0x1c')];_0x7b41e5+=0x1){var _0x315f89;var _0x2490e1=_0x249ffb[_0x7b41e5];if(_0x22e5f2){_0x315f89=path[_0x946d('0x23')](_0x2a0a9e,_0x3d756c,util[_0x946d('0x10')](_0x946d('0x25'),_0x3d756c,_0x7b41e5,_0x946d('0x26')));}else{_0x315f89=path['join'](_0x2a0a9e,util[_0x946d('0x10')](_0x946d('0x27'),_0x3d756c,_0x946d('0x26')));}fs[_0x946d('0x28')](_0x315f89,json2xls(_0x2490e1),_0x946d('0x29'));}})[_0x946d('0x15')](function(){if(_0x22e5f2){return new Promise(function(_0x119a4a){zipdir(path['join'](_0x2a0a9e,_0x3d756c),{'saveTo':path[_0x946d('0x23')](_0x2a0a9e,util[_0x946d('0x10')](_0x946d('0x27'),_0x3d756c,_0x946d('0x2a')))},function(_0x4dbffc,_0x4be787){rimraf(path[_0x946d('0x23')](_0x2a0a9e,_0x3d756c),function(){});_0x119a4a('zip\x20finished');});});}})[_0x946d('0x15')](function(){logger['info'](util[_0x946d('0x10')](_0x946d('0x2b'),EXTRACTED_REPORT_ID,_0x946d('0x12')));return analyticExtractedReport(_0x946d('0x2c'),_0x22e5f2?util[_0x946d('0x10')](_0x946d('0x27'),_0x3d756c,_0x22e5f2?'zip':'xlsx'):null);});})[_0x946d('0x2d')](function(_0x4d74e9){logger[_0x946d('0xf')](util['format'](_0x946d('0x2e'),EXTRACTED_REPORT_ID,_0x946d('0x12')),util[_0x946d('0x2f')](_0x4d74e9,{'showHidden':![],'depth':null}));EXIT_CODE=0x1;return analyticExtractedReport(_0x946d('0x30'));})[_0x946d('0x31')](function(){process[_0x946d('0x32')](EXIT_CODE);});}main(); \ No newline at end of file diff --git a/server/components/extensions/rewrite.js b/server/components/extensions/rewrite.js index 67c39c7..418f7f6 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 _0x7d82=['XCALLY-MOTION-ANSWER=0','XCALLY-MOTION-PROGRESS=0','MONITOR_OPTIONS=ab','length','toLowerCase','updatedAt','interval','*,*,*,*','tag','CDR(tag)=','callerID','ExecIf','$[${LEN(${PREFIX-CALLERIDALL})}\x20>\x200]?Set(CALLERID(all)=${PREFIX-CALLERIDALL}):Set(CALLERID(all)=','$[${LEN(${PREFIX-CALLERIDALL})}\x20>\x200]?Set(CALLERID(all)=${PREFIX-CALLERIDALL}):NoOp(No\x20number\x20available)','answer','indexOf','app','custom','XCALLY-MOTION-ANSWER=1','$[${XCALLY-MOTION-PROGRESS}=0]?Progress','XCALLY-MOTION-PROGRESS=1','GotoIfTime',',${EXTEN},','last','concat','Hangup','transaction','sortBy','catch','error','rewrite','lodash','util','models','Interval','findAll','IntervalId','VoiceExtension','uniq','map','exten','CAST(priority\x20AS\x20UNSIGNED)','then','filter','groupBy','queue','playback','hasOwnProperty','extensions','find','push','type','format','CDR(type)=%s','context','priority','VoiceExtensionId','inbound','Set','CDR(routeid)=','outbound','extension','CDR(destination)=','cutdigits','$[${LEN(${CDR(prefix)})}\x20>\x200]?Goto(','):Goto(','CDR(prefix)=${EXTEN:0:','CDR(prefix)=noprefix','outboundrouteid=','recordingFormat','none','_XCALLY_MIXMONITOR_UNIQUEID=${UNIQUEID}','wav'];(function(_0x228f0b,_0x3ec198){var _0x573788=function(_0x1c344e){while(--_0x1c344e){_0x228f0b['push'](_0x228f0b['shift']());}};_0x573788(++_0x3ec198);}(_0x7d82,0x68));var _0x27d8=function(_0x493763,_0x35a980){_0x493763=_0x493763-0x0;var _0x2224b5=_0x7d82[_0x493763];return _0x2224b5;};'use strict';var _=require(_0x27d8('0x0'));var util=require(_0x27d8('0x1'));function rewrite(_0x165da0,_0x57d7c0){var _0x40706b=this;return _0x165da0[_0x27d8('0x2')][_0x27d8('0x3')][_0x27d8('0x4')]({'raw':!![]})['then'](function(_0xf525a3){_0x40706b['intervals']=_0xf525a3;return _0x165da0[_0x27d8('0x2')]['VoiceExtension'][_0x27d8('0x4')]({'where':{'IntervalId':_0x57d7c0[_0x27d8('0x5')]},'raw':!![]});})['then'](function(_0x5c9c04){return _0x165da0[_0x27d8('0x2')][_0x27d8('0x6')][_0x27d8('0x4')]({'where':{'exten':{'$in':_[_0x27d8('0x7')](_[_0x27d8('0x8')](_0x5c9c04,_0x27d8('0x9')))}},'order':[{'raw':_0x27d8('0xa')}],'raw':!![]});})[_0x27d8('0xb')](function(_0x10a9f1){var _0x4e8412=_[_0x27d8('0xc')](_0x10a9f1,{'priority':'1'});var _0x3d6aed=_[_0x27d8('0xc')](_0x10a9f1,{'isApp':0x1});var _0x8486ae=_[_0x27d8('0xd')](_0x3d6aed,_0x27d8('0x9'));var _0x3807e6=[_0x27d8('0xe'),_0x27d8('0xf')];var _0x54ee10=[];var _0x36aba5=[];for(var _0x52b697 in _0x8486ae){if(_0x8486ae[_0x27d8('0x10')](_0x52b697)){_0x40706b['priority']=0x2;_0x40706b[_0x27d8('0x11')]=[];_0x40706b['extension']=_[_0x27d8('0x12')](_0x4e8412,{'exten':_0x8486ae[_0x52b697][0x0][_0x27d8('0x9')]});_0x40706b[_0x27d8('0x11')][_0x27d8('0x13')]({'type':_0x8486ae[_0x52b697][0x0][_0x27d8('0x14')],'app':'Set','appdata':util[_0x27d8('0x15')](_0x27d8('0x16'),_0x8486ae[_0x52b697][0x0]['type']),'context':_0x8486ae[_0x52b697][0x0][_0x27d8('0x17')],'exten':_0x8486ae[_0x52b697][0x0][_0x27d8('0x9')],'priority':_0x40706b[_0x27d8('0x18')]++,'VoiceExtensionId':_0x8486ae[_0x52b697][0x0][_0x27d8('0x19')]});if(_0x8486ae[_0x52b697][0x0][_0x27d8('0x14')]===_0x27d8('0x1a')){_0x40706b[_0x27d8('0x11')][_0x27d8('0x13')]({'type':_0x8486ae[_0x52b697][0x0][_0x27d8('0x14')],'app':_0x27d8('0x1b'),'appdata':_0x27d8('0x1c')+_0x8486ae[_0x52b697][0x0][_0x27d8('0x19')],'context':_0x8486ae[_0x52b697][0x0]['context'],'exten':_0x8486ae[_0x52b697][0x0][_0x27d8('0x9')],'priority':_0x40706b['priority']++,'VoiceExtensionId':_0x8486ae[_0x52b697][0x0][_0x27d8('0x19')]});}else if(_0x8486ae[_0x52b697][0x0][_0x27d8('0x14')]===_0x27d8('0x1d')){if(_0x40706b[_0x27d8('0x1e')]){_0x40706b[_0x27d8('0x11')]['push']({'type':_0x8486ae[_0x52b697][0x0][_0x27d8('0x14')],'app':_0x27d8('0x1b'),'appdata':_0x27d8('0x1f')+(_0x40706b[_0x27d8('0x1e')][_0x27d8('0x20')]?'${EXTEN:'+_0x40706b[_0x27d8('0x1e')][_0x27d8('0x20')]+'}':'${EXTEN}'),'context':_0x8486ae[_0x52b697][0x0]['context'],'exten':_0x8486ae[_0x52b697][0x0]['exten'],'priority':_0x40706b[_0x27d8('0x18')]++,'VoiceExtensionId':_0x8486ae[_0x52b697][0x0][_0x27d8('0x19')]});}_0x40706b[_0x27d8('0x11')]['push']({'type':_0x8486ae[_0x52b697][0x0][_0x27d8('0x14')],'app':_0x27d8('0x1b'),'appdata':'CDR(routeid)='+_0x8486ae[_0x52b697][0x0][_0x27d8('0x19')],'context':_0x8486ae[_0x52b697][0x0]['context'],'exten':_0x8486ae[_0x52b697][0x0][_0x27d8('0x9')],'priority':_0x40706b[_0x27d8('0x18')]++,'VoiceExtensionId':_0x8486ae[_0x52b697][0x0]['VoiceExtensionId']});var _0x302612=_0x40706b[_0x27d8('0x18')]++;_0x40706b[_0x27d8('0x11')]['push']({'type':_0x8486ae[_0x52b697][0x0][_0x27d8('0x14')],'app':'ExecIf','appdata':_0x27d8('0x21')+(_0x302612+0x2)+_0x27d8('0x22')+(_0x302612+0x1)+')','context':_0x8486ae[_0x52b697][0x0][_0x27d8('0x17')],'exten':_0x8486ae[_0x52b697][0x0][_0x27d8('0x9')],'priority':_0x302612,'VoiceExtensionId':_0x8486ae[_0x52b697][0x0][_0x27d8('0x19')]});if(_0x40706b[_0x27d8('0x1e')]){_0x40706b['extensions'][_0x27d8('0x13')]({'type':_0x8486ae[_0x52b697][0x0]['type'],'app':'Set','appdata':_0x40706b[_0x27d8('0x1e')][_0x27d8('0x20')]?_0x27d8('0x23')+_0x40706b[_0x27d8('0x1e')][_0x27d8('0x20')]+'}':_0x27d8('0x24'),'context':_0x8486ae[_0x52b697][0x0][_0x27d8('0x17')],'exten':_0x8486ae[_0x52b697][0x0][_0x27d8('0x9')],'priority':_0x40706b[_0x27d8('0x18')]++,'VoiceExtensionId':_0x8486ae[_0x52b697][0x0][_0x27d8('0x19')]});}_0x40706b[_0x27d8('0x11')][_0x27d8('0x13')]({'type':_0x8486ae[_0x52b697][0x0]['type'],'app':'Set','appdata':_0x27d8('0x25')+_0x8486ae[_0x52b697][0x0][_0x27d8('0x19')],'context':_0x8486ae[_0x52b697][0x0][_0x27d8('0x17')],'exten':_0x8486ae[_0x52b697][0x0][_0x27d8('0x9')],'priority':_0x40706b[_0x27d8('0x18')]++,'VoiceExtensionId':_0x8486ae[_0x52b697][0x0][_0x27d8('0x19')]});if(_0x40706b['extension']&&_0x40706b['extension'][_0x27d8('0x10')](_0x27d8('0x26'))&&_0x40706b[_0x27d8('0x1e')][_0x27d8('0x26')]!==_0x27d8('0x27')){_0x40706b['extensions'][_0x27d8('0x13')]({'type':_0x8486ae[_0x52b697][0x0][_0x27d8('0x14')],'app':_0x27d8('0x1b'),'appdata':_0x27d8('0x28'),'context':_0x8486ae[_0x52b697][0x0][_0x27d8('0x17')],'exten':_0x8486ae[_0x52b697][0x0][_0x27d8('0x9')],'priority':_0x40706b[_0x27d8('0x18')]++,'VoiceExtensionId':_0x8486ae[_0x52b697][0x0][_0x27d8('0x19')]});_0x40706b['extensions']['push']({'type':_0x8486ae[_0x52b697][0x0][_0x27d8('0x14')],'app':_0x27d8('0x1b'),'appdata':'_XCALLY_MIXMONITOR_FORMAT='+_0x40706b[_0x27d8('0x1e')][_0x27d8('0x26')]||_0x27d8('0x29'),'context':_0x8486ae[_0x52b697][0x0]['context'],'exten':_0x8486ae[_0x52b697][0x0]['exten'],'priority':_0x40706b['priority']++,'VoiceExtensionId':_0x8486ae[_0x52b697][0x0][_0x27d8('0x19')]});}}_0x40706b[_0x27d8('0x11')][_0x27d8('0x13')]({'type':_0x8486ae[_0x52b697][0x0][_0x27d8('0x14')],'app':_0x27d8('0x1b'),'appdata':_0x27d8('0x2a'),'context':_0x8486ae[_0x52b697][0x0]['context'],'exten':_0x8486ae[_0x52b697][0x0][_0x27d8('0x9')],'priority':_0x40706b['priority']++,'VoiceExtensionId':_0x8486ae[_0x52b697][0x0][_0x27d8('0x19')]});_0x40706b[_0x27d8('0x11')]['push']({'type':_0x8486ae[_0x52b697][0x0][_0x27d8('0x14')],'app':_0x27d8('0x1b'),'appdata':_0x27d8('0x2b'),'context':_0x8486ae[_0x52b697][0x0][_0x27d8('0x17')],'exten':_0x8486ae[_0x52b697][0x0]['exten'],'priority':_0x40706b[_0x27d8('0x18')]++,'VoiceExtensionId':_0x8486ae[_0x52b697][0x0][_0x27d8('0x19')]});_0x40706b[_0x27d8('0x11')][_0x27d8('0x13')]({'type':_0x8486ae[_0x52b697][0x0]['type'],'app':_0x27d8('0x1b'),'appdata':_0x27d8('0x2c'),'context':_0x8486ae[_0x52b697][0x0]['context'],'exten':_0x8486ae[_0x52b697][0x0][_0x27d8('0x9')],'priority':_0x40706b[_0x27d8('0x18')]++,'VoiceExtensionId':_0x8486ae[_0x52b697][0x0]['VoiceExtensionId']});for(var _0x5f2b5b=0x0,_0x3d6f47=0x0;_0x5f2b5b<_0x8486ae[_0x52b697][_0x27d8('0x2d')];_0x5f2b5b+=0x1,_0x3d6f47=0x0){var _0x315027=_0x8486ae[_0x52b697][_0x5f2b5b];if(_0x315027[_0x27d8('0x14')]){_0x315027['type']=_0x315027[_0x27d8('0x14')][_0x27d8('0x2e')]();}var _0x4f0b29=[];var _0x2ee12b=[];delete _0x315027['id'];delete _0x315027['createdAt'];delete _0x315027[_0x27d8('0x2f')];var _0x19953a=_0x315027[_0x27d8('0x30')]!==_0x27d8('0x31')?[_0x315027[_0x27d8('0x30')]]:_0x315027[_0x27d8('0x5')]?_[_0x27d8('0x8')](_[_0x27d8('0xc')](_0x40706b['intervals'],{'IntervalId':_0x315027[_0x27d8('0x5')]}),_0x27d8('0x30')):[];if(_0x315027[_0x27d8('0x10')](_0x27d8('0x32'))){if(_0x315027[_0x27d8('0x32')]&&_0x315027['tag']!=='--'){_0x4f0b29['push']({'type':_0x315027['type'],'app':'Set','appdata':_0x27d8('0x33')+_0x315027[_0x27d8('0x32')],'context':_0x315027[_0x27d8('0x17')],'exten':_0x315027['exten'],'priority':_0x19953a[_0x27d8('0x2d')]+_0x40706b[_0x27d8('0x18')]+_0x3d6f47++,'VoiceExtensionId':_0x315027[_0x27d8('0x19')]});}}if(_0x315027[_0x27d8('0x14')]===_0x27d8('0x1d')&&_0x315027[_0x27d8('0x10')](_0x27d8('0x34'))){if(_0x315027['callerID']){_0x4f0b29[_0x27d8('0x13')]({'type':_0x315027[_0x27d8('0x14')],'app':_0x27d8('0x35'),'appdata':_0x27d8('0x36')+_0x315027[_0x27d8('0x34')]+')','context':_0x315027[_0x27d8('0x17')],'exten':_0x315027['exten'],'priority':_0x19953a[_0x27d8('0x2d')]+_0x40706b[_0x27d8('0x18')]+_0x3d6f47++,'VoiceExtensionId':_0x315027[_0x27d8('0x19')]});}else{_0x4f0b29[_0x27d8('0x13')]({'type':_0x315027[_0x27d8('0x14')],'app':_0x27d8('0x35'),'appdata':_0x27d8('0x37'),'context':_0x315027[_0x27d8('0x17')],'exten':_0x315027[_0x27d8('0x9')],'priority':_0x19953a[_0x27d8('0x2d')]+_0x40706b[_0x27d8('0x18')]+_0x3d6f47++,'VoiceExtensionId':_0x315027[_0x27d8('0x19')]});}}if(_0x315027[_0x27d8('0x10')](_0x27d8('0x38'))){if(_0x3807e6[_0x27d8('0x39')](_0x315027[_0x27d8('0x3a')][_0x27d8('0x2e')]())>=0x0&&_0x315027['appType']!==_0x27d8('0x3b')){if(_0x315027[_0x27d8('0x38')]){_0x4f0b29[_0x27d8('0x13')]({'type':_0x315027['type'],'app':_0x27d8('0x35'),'appdata':'$[${XCALLY-MOTION-ANSWER}=0]?Answer','context':_0x315027[_0x27d8('0x17')],'exten':_0x315027[_0x27d8('0x9')],'priority':_0x19953a[_0x27d8('0x2d')]+_0x40706b[_0x27d8('0x18')]+_0x3d6f47++,'VoiceExtensionId':_0x315027[_0x27d8('0x19')]});_0x4f0b29['push']({'type':_0x315027['type'],'app':_0x27d8('0x1b'),'appdata':_0x27d8('0x3c'),'context':_0x315027[_0x27d8('0x17')],'exten':_0x315027['exten'],'priority':_0x19953a['length']+_0x40706b[_0x27d8('0x18')]+_0x3d6f47++,'VoiceExtensionId':_0x315027[_0x27d8('0x19')]});}else{_0x4f0b29[_0x27d8('0x13')]({'type':_0x315027[_0x27d8('0x14')],'app':_0x27d8('0x35'),'appdata':_0x27d8('0x3d'),'context':_0x315027[_0x27d8('0x17')],'exten':_0x315027['exten'],'priority':_0x19953a['length']+_0x40706b['priority']+_0x3d6f47++,'VoiceExtensionId':_0x315027['VoiceExtensionId']});_0x4f0b29['push']({'type':_0x315027[_0x27d8('0x14')],'app':_0x27d8('0x1b'),'appdata':_0x27d8('0x3e'),'context':_0x315027[_0x27d8('0x17')],'exten':_0x315027[_0x27d8('0x9')],'priority':_0x19953a[_0x27d8('0x2d')]+_0x40706b[_0x27d8('0x18')]+_0x3d6f47++,'VoiceExtensionId':_0x315027[_0x27d8('0x19')]});}}}for(var _0x9b46ee=0x0;_0x9b46ee<_0x19953a[_0x27d8('0x2d')];_0x9b46ee+=0x1){var _0x5eb3f1=_0x40706b['priority']+_0x19953a[_0x27d8('0x2d')];var _0x295d1e=_0x9b46ee===_0x19953a[_0x27d8('0x2d')]-0x1?_0x40706b[_0x27d8('0x18')]+_0x4f0b29[_0x27d8('0x2d')]+_0x2ee12b[_0x27d8('0x2d')]+0x2:_0x40706b[_0x27d8('0x18')]+_0x9b46ee+0x1;_0x4f0b29['splice'](_0x9b46ee,0x0,{'type':_0x315027['type'],'app':_0x27d8('0x3f'),'appdata':_0x19953a[_0x9b46ee]+'?'+_0x315027[_0x27d8('0x17')]+_0x27d8('0x40')+_0x5eb3f1+':'+_0x315027[_0x27d8('0x17')]+_0x27d8('0x40')+_0x295d1e,'exten':_0x315027[_0x27d8('0x9')],'context':_0x315027[_0x27d8('0x17')],'priority':_0x40706b[_0x27d8('0x18')]+_0x9b46ee,'VoiceExtensionId':_0x8486ae[_0x52b697][0x0][_0x27d8('0x19')]});}_0x315027[_0x27d8('0x18')]=_0x4f0b29[_0x27d8('0x2d')]?_['last'](_0x4f0b29)[_0x27d8('0x18')]+0x1:_0x40706b[_0x27d8('0x18')];_0x40706b[_0x27d8('0x18')]=(_0x2ee12b[_0x27d8('0x2d')]?_[_0x27d8('0x41')](_0x2ee12b)['priority']:_0x315027['priority'])+0x1;_0x40706b['extensions']=_[_0x27d8('0x42')](_0x40706b[_0x27d8('0x11')],_0x4f0b29,[_0x315027],_0x2ee12b);}_0x40706b['extensions'][_0x27d8('0x13')]({'type':_0x8486ae[_0x52b697][0x0][_0x27d8('0x14')],'app':_0x27d8('0x43'),'exten':_0x8486ae[_0x52b697][0x0][_0x27d8('0x9')],'context':_0x8486ae[_0x52b697][0x0][_0x27d8('0x17')],'priority':_0x40706b['priority'],'VoiceExtensionId':_0x8486ae[_0x52b697][0x0]['VoiceExtensionId']});_0x54ee10[_0x27d8('0x13')](_0x8486ae[_0x52b697][0x0][_0x27d8('0x19')]);_0x36aba5=_[_0x27d8('0x42')](_0x36aba5,_0x40706b[_0x27d8('0x11')]);}}return _0x165da0[_0x27d8('0x44')](function(_0xfabb75){return _0x165da0['models']['VoiceExtension']['destroy']({'where':{'VoiceExtensionId':{'$in':_0x54ee10}},'transaction':_0xfabb75})[_0x27d8('0xb')](function(_0x211671){return _0x165da0[_0x27d8('0x2')][_0x27d8('0x6')]['bulkCreate'](_[_0x27d8('0x45')](_0x36aba5,_0x27d8('0x18')),{'transaction':_0xfabb75});});});})[_0x27d8('0x46')](function(_0x1f10a5){console[_0x27d8('0x47')](_0x1f10a5);});}exports[_0x27d8('0x48')]=rewrite; \ No newline at end of file +var _0x163a=['CDR(prefix)=noprefix','outboundrouteid=','recordingFormat','none','_XCALLY_MIXMONITOR_UNIQUEID=${UNIQUEID}','wav','XCALLY-MOTION-ANSWER=0','XCALLY-MOTION-PROGRESS=0','MONITOR_OPTIONS=ab','createdAt','updatedAt','*,*,*,*','interval','map','tag','CDR(tag)=','callerID','$[${LEN(${PREFIX-CALLERIDALL})}\x20>\x200]?Set(CALLERID(all)=${PREFIX-CALLERIDALL}):Set(CALLERID(all)=','length','indexOf','app','appType','custom','answer','XCALLY-MOTION-ANSWER=1','$[${XCALLY-MOTION-PROGRESS}=0]?Progress','XCALLY-MOTION-PROGRESS=1','splice','last','Hangup','concat','transaction','bulkCreate','sortBy','catch','error','rewrite','lodash','Interval','findAll','then','models','VoiceExtension','IntervalId','exten','CAST(priority\x20AS\x20UNSIGNED)','filter','groupBy','queue','playback','hasOwnProperty','extension','find','extensions','push','Set','format','CDR(type)=%s','type','context','priority','VoiceExtensionId','inbound','outbound','CDR(destination)=','cutdigits','${EXTEN}','CDR(routeid)=','ExecIf','$[${LEN(${CDR(prefix)})}\x20>\x200]?Goto(','):Goto(','CDR(prefix)=${EXTEN:0:'];(function(_0x5248fc,_0x50ff3b){var _0x391990=function(_0x3b3754){while(--_0x3b3754){_0x5248fc['push'](_0x5248fc['shift']());}};_0x391990(++_0x50ff3b);}(_0x163a,0x1d5));var _0xa163=function(_0x2283dc,_0x2fcfc5){_0x2283dc=_0x2283dc-0x0;var _0x16db90=_0x163a[_0x2283dc];return _0x16db90;};'use strict';var _=require(_0xa163('0x0'));var util=require('util');function rewrite(_0xeccf51,_0x5304ac){var _0x13abcf=this;return _0xeccf51['models'][_0xa163('0x1')][_0xa163('0x2')]({'raw':!![]})[_0xa163('0x3')](function(_0x5cca01){_0x13abcf['intervals']=_0x5cca01;return _0xeccf51[_0xa163('0x4')][_0xa163('0x5')][_0xa163('0x2')]({'where':{'IntervalId':_0x5304ac[_0xa163('0x6')]},'raw':!![]});})[_0xa163('0x3')](function(_0x73c62f){return _0xeccf51[_0xa163('0x4')][_0xa163('0x5')][_0xa163('0x2')]({'where':{'exten':{'$in':_['uniq'](_['map'](_0x73c62f,_0xa163('0x7')))}},'order':[{'raw':_0xa163('0x8')}],'raw':!![]});})[_0xa163('0x3')](function(_0xbf6d3a){var _0x1c0577=_[_0xa163('0x9')](_0xbf6d3a,{'priority':'1'});var _0x4ce2b3=_[_0xa163('0x9')](_0xbf6d3a,{'isApp':0x1});var _0x50e00e=_[_0xa163('0xa')](_0x4ce2b3,'exten');var _0x482cbc=[_0xa163('0xb'),_0xa163('0xc')];var _0x593b1e=[];var _0x4ad24a=[];for(var _0x1554a5 in _0x50e00e){if(_0x50e00e[_0xa163('0xd')](_0x1554a5)){_0x13abcf['priority']=0x2;_0x13abcf['extensions']=[];_0x13abcf[_0xa163('0xe')]=_[_0xa163('0xf')](_0x1c0577,{'exten':_0x50e00e[_0x1554a5][0x0]['exten']});_0x13abcf[_0xa163('0x10')][_0xa163('0x11')]({'type':_0x50e00e[_0x1554a5][0x0]['type'],'app':_0xa163('0x12'),'appdata':util[_0xa163('0x13')](_0xa163('0x14'),_0x50e00e[_0x1554a5][0x0][_0xa163('0x15')]),'context':_0x50e00e[_0x1554a5][0x0][_0xa163('0x16')],'exten':_0x50e00e[_0x1554a5][0x0][_0xa163('0x7')],'priority':_0x13abcf[_0xa163('0x17')]++,'VoiceExtensionId':_0x50e00e[_0x1554a5][0x0][_0xa163('0x18')]});if(_0x50e00e[_0x1554a5][0x0]['type']===_0xa163('0x19')){_0x13abcf[_0xa163('0x10')][_0xa163('0x11')]({'type':_0x50e00e[_0x1554a5][0x0][_0xa163('0x15')],'app':'Set','appdata':'CDR(routeid)='+_0x50e00e[_0x1554a5][0x0]['VoiceExtensionId'],'context':_0x50e00e[_0x1554a5][0x0][_0xa163('0x16')],'exten':_0x50e00e[_0x1554a5][0x0][_0xa163('0x7')],'priority':_0x13abcf['priority']++,'VoiceExtensionId':_0x50e00e[_0x1554a5][0x0][_0xa163('0x18')]});}else if(_0x50e00e[_0x1554a5][0x0][_0xa163('0x15')]===_0xa163('0x1a')){if(_0x13abcf[_0xa163('0xe')]){_0x13abcf[_0xa163('0x10')][_0xa163('0x11')]({'type':_0x50e00e[_0x1554a5][0x0][_0xa163('0x15')],'app':_0xa163('0x12'),'appdata':_0xa163('0x1b')+(_0x13abcf[_0xa163('0xe')]['cutdigits']?'${EXTEN:'+_0x13abcf[_0xa163('0xe')][_0xa163('0x1c')]+'}':_0xa163('0x1d')),'context':_0x50e00e[_0x1554a5][0x0][_0xa163('0x16')],'exten':_0x50e00e[_0x1554a5][0x0][_0xa163('0x7')],'priority':_0x13abcf['priority']++,'VoiceExtensionId':_0x50e00e[_0x1554a5][0x0][_0xa163('0x18')]});}_0x13abcf[_0xa163('0x10')][_0xa163('0x11')]({'type':_0x50e00e[_0x1554a5][0x0][_0xa163('0x15')],'app':'Set','appdata':_0xa163('0x1e')+_0x50e00e[_0x1554a5][0x0]['VoiceExtensionId'],'context':_0x50e00e[_0x1554a5][0x0][_0xa163('0x16')],'exten':_0x50e00e[_0x1554a5][0x0][_0xa163('0x7')],'priority':_0x13abcf[_0xa163('0x17')]++,'VoiceExtensionId':_0x50e00e[_0x1554a5][0x0][_0xa163('0x18')]});var _0x24bbbe=_0x13abcf[_0xa163('0x17')]++;_0x13abcf[_0xa163('0x10')][_0xa163('0x11')]({'type':_0x50e00e[_0x1554a5][0x0][_0xa163('0x15')],'app':_0xa163('0x1f'),'appdata':_0xa163('0x20')+(_0x24bbbe+0x2)+_0xa163('0x21')+(_0x24bbbe+0x1)+')','context':_0x50e00e[_0x1554a5][0x0]['context'],'exten':_0x50e00e[_0x1554a5][0x0][_0xa163('0x7')],'priority':_0x24bbbe,'VoiceExtensionId':_0x50e00e[_0x1554a5][0x0][_0xa163('0x18')]});if(_0x13abcf['extension']){_0x13abcf[_0xa163('0x10')][_0xa163('0x11')]({'type':_0x50e00e[_0x1554a5][0x0]['type'],'app':_0xa163('0x12'),'appdata':_0x13abcf[_0xa163('0xe')][_0xa163('0x1c')]?_0xa163('0x22')+_0x13abcf[_0xa163('0xe')][_0xa163('0x1c')]+'}':_0xa163('0x23'),'context':_0x50e00e[_0x1554a5][0x0][_0xa163('0x16')],'exten':_0x50e00e[_0x1554a5][0x0]['exten'],'priority':_0x13abcf[_0xa163('0x17')]++,'VoiceExtensionId':_0x50e00e[_0x1554a5][0x0][_0xa163('0x18')]});}_0x13abcf[_0xa163('0x10')][_0xa163('0x11')]({'type':_0x50e00e[_0x1554a5][0x0][_0xa163('0x15')],'app':'Set','appdata':_0xa163('0x24')+_0x50e00e[_0x1554a5][0x0]['VoiceExtensionId'],'context':_0x50e00e[_0x1554a5][0x0]['context'],'exten':_0x50e00e[_0x1554a5][0x0][_0xa163('0x7')],'priority':_0x13abcf['priority']++,'VoiceExtensionId':_0x50e00e[_0x1554a5][0x0][_0xa163('0x18')]});if(_0x13abcf[_0xa163('0xe')]&&_0x13abcf[_0xa163('0xe')]['hasOwnProperty'](_0xa163('0x25'))&&_0x13abcf[_0xa163('0xe')][_0xa163('0x25')]!==_0xa163('0x26')){_0x13abcf[_0xa163('0x10')][_0xa163('0x11')]({'type':_0x50e00e[_0x1554a5][0x0][_0xa163('0x15')],'app':'Set','appdata':_0xa163('0x27'),'context':_0x50e00e[_0x1554a5][0x0][_0xa163('0x16')],'exten':_0x50e00e[_0x1554a5][0x0][_0xa163('0x7')],'priority':_0x13abcf[_0xa163('0x17')]++,'VoiceExtensionId':_0x50e00e[_0x1554a5][0x0]['VoiceExtensionId']});_0x13abcf[_0xa163('0x10')][_0xa163('0x11')]({'type':_0x50e00e[_0x1554a5][0x0][_0xa163('0x15')],'app':'Set','appdata':'_XCALLY_MIXMONITOR_FORMAT='+_0x13abcf[_0xa163('0xe')][_0xa163('0x25')]||_0xa163('0x28'),'context':_0x50e00e[_0x1554a5][0x0]['context'],'exten':_0x50e00e[_0x1554a5][0x0]['exten'],'priority':_0x13abcf[_0xa163('0x17')]++,'VoiceExtensionId':_0x50e00e[_0x1554a5][0x0][_0xa163('0x18')]});}}_0x13abcf[_0xa163('0x10')][_0xa163('0x11')]({'type':_0x50e00e[_0x1554a5][0x0][_0xa163('0x15')],'app':'Set','appdata':_0xa163('0x29'),'context':_0x50e00e[_0x1554a5][0x0][_0xa163('0x16')],'exten':_0x50e00e[_0x1554a5][0x0][_0xa163('0x7')],'priority':_0x13abcf[_0xa163('0x17')]++,'VoiceExtensionId':_0x50e00e[_0x1554a5][0x0][_0xa163('0x18')]});_0x13abcf[_0xa163('0x10')][_0xa163('0x11')]({'type':_0x50e00e[_0x1554a5][0x0]['type'],'app':_0xa163('0x12'),'appdata':_0xa163('0x2a'),'context':_0x50e00e[_0x1554a5][0x0][_0xa163('0x16')],'exten':_0x50e00e[_0x1554a5][0x0][_0xa163('0x7')],'priority':_0x13abcf[_0xa163('0x17')]++,'VoiceExtensionId':_0x50e00e[_0x1554a5][0x0][_0xa163('0x18')]});_0x13abcf[_0xa163('0x10')][_0xa163('0x11')]({'type':_0x50e00e[_0x1554a5][0x0][_0xa163('0x15')],'app':_0xa163('0x12'),'appdata':_0xa163('0x2b'),'context':_0x50e00e[_0x1554a5][0x0][_0xa163('0x16')],'exten':_0x50e00e[_0x1554a5][0x0]['exten'],'priority':_0x13abcf[_0xa163('0x17')]++,'VoiceExtensionId':_0x50e00e[_0x1554a5][0x0][_0xa163('0x18')]});for(var _0x365797=0x0,_0x1c3732=0x0;_0x365797<_0x50e00e[_0x1554a5]['length'];_0x365797+=0x1,_0x1c3732=0x0){var _0x17f960=_0x50e00e[_0x1554a5][_0x365797];if(_0x17f960['type']){_0x17f960[_0xa163('0x15')]=_0x17f960[_0xa163('0x15')]['toLowerCase']();}var _0x464c3f=[];var _0x4ca9c4=[];delete _0x17f960['id'];delete _0x17f960[_0xa163('0x2c')];delete _0x17f960[_0xa163('0x2d')];var _0x6848a4=_0x17f960['interval']!==_0xa163('0x2e')?[_0x17f960[_0xa163('0x2f')]]:_0x17f960['IntervalId']?_[_0xa163('0x30')](_[_0xa163('0x9')](_0x13abcf['intervals'],{'IntervalId':_0x17f960['IntervalId']}),_0xa163('0x2f')):[];if(_0x17f960['hasOwnProperty'](_0xa163('0x31'))){if(_0x17f960[_0xa163('0x31')]&&_0x17f960[_0xa163('0x31')]!=='--'){_0x464c3f[_0xa163('0x11')]({'type':_0x17f960['type'],'app':_0xa163('0x12'),'appdata':_0xa163('0x32')+_0x17f960[_0xa163('0x31')],'context':_0x17f960['context'],'exten':_0x17f960[_0xa163('0x7')],'priority':_0x6848a4['length']+_0x13abcf['priority']+_0x1c3732++,'VoiceExtensionId':_0x17f960['VoiceExtensionId']});}}if(_0x17f960[_0xa163('0x15')]===_0xa163('0x1a')&&_0x17f960[_0xa163('0xd')](_0xa163('0x33'))){if(_0x17f960[_0xa163('0x33')]){_0x464c3f['push']({'type':_0x17f960[_0xa163('0x15')],'app':_0xa163('0x1f'),'appdata':_0xa163('0x34')+_0x17f960[_0xa163('0x33')]+')','context':_0x17f960['context'],'exten':_0x17f960[_0xa163('0x7')],'priority':_0x6848a4[_0xa163('0x35')]+_0x13abcf[_0xa163('0x17')]+_0x1c3732++,'VoiceExtensionId':_0x17f960['VoiceExtensionId']});}else{_0x464c3f[_0xa163('0x11')]({'type':_0x17f960[_0xa163('0x15')],'app':_0xa163('0x1f'),'appdata':'$[${LEN(${PREFIX-CALLERIDALL})}\x20>\x200]?Set(CALLERID(all)=${PREFIX-CALLERIDALL}):NoOp(No\x20number\x20available)','context':_0x17f960[_0xa163('0x16')],'exten':_0x17f960['exten'],'priority':_0x6848a4[_0xa163('0x35')]+_0x13abcf[_0xa163('0x17')]+_0x1c3732++,'VoiceExtensionId':_0x17f960[_0xa163('0x18')]});}}if(_0x17f960[_0xa163('0xd')]('answer')){if(_0x482cbc[_0xa163('0x36')](_0x17f960[_0xa163('0x37')]['toLowerCase']())>=0x0&&_0x17f960[_0xa163('0x38')]!==_0xa163('0x39')){if(_0x17f960[_0xa163('0x3a')]){_0x464c3f[_0xa163('0x11')]({'type':_0x17f960[_0xa163('0x15')],'app':_0xa163('0x1f'),'appdata':'$[${XCALLY-MOTION-ANSWER}=0]?Answer','context':_0x17f960[_0xa163('0x16')],'exten':_0x17f960[_0xa163('0x7')],'priority':_0x6848a4[_0xa163('0x35')]+_0x13abcf['priority']+_0x1c3732++,'VoiceExtensionId':_0x17f960['VoiceExtensionId']});_0x464c3f[_0xa163('0x11')]({'type':_0x17f960['type'],'app':_0xa163('0x12'),'appdata':_0xa163('0x3b'),'context':_0x17f960[_0xa163('0x16')],'exten':_0x17f960[_0xa163('0x7')],'priority':_0x6848a4[_0xa163('0x35')]+_0x13abcf['priority']+_0x1c3732++,'VoiceExtensionId':_0x17f960['VoiceExtensionId']});}else{_0x464c3f[_0xa163('0x11')]({'type':_0x17f960[_0xa163('0x15')],'app':_0xa163('0x1f'),'appdata':_0xa163('0x3c'),'context':_0x17f960[_0xa163('0x16')],'exten':_0x17f960[_0xa163('0x7')],'priority':_0x6848a4[_0xa163('0x35')]+_0x13abcf[_0xa163('0x17')]+_0x1c3732++,'VoiceExtensionId':_0x17f960['VoiceExtensionId']});_0x464c3f[_0xa163('0x11')]({'type':_0x17f960[_0xa163('0x15')],'app':'Set','appdata':_0xa163('0x3d'),'context':_0x17f960[_0xa163('0x16')],'exten':_0x17f960[_0xa163('0x7')],'priority':_0x6848a4[_0xa163('0x35')]+_0x13abcf['priority']+_0x1c3732++,'VoiceExtensionId':_0x17f960['VoiceExtensionId']});}}}for(var _0x45240b=0x0;_0x45240b<_0x6848a4['length'];_0x45240b+=0x1){var _0x24f89f=_0x13abcf[_0xa163('0x17')]+_0x6848a4[_0xa163('0x35')];var _0x24092f=_0x45240b===_0x6848a4[_0xa163('0x35')]-0x1?_0x13abcf[_0xa163('0x17')]+_0x464c3f[_0xa163('0x35')]+_0x4ca9c4[_0xa163('0x35')]+0x2:_0x13abcf[_0xa163('0x17')]+_0x45240b+0x1;_0x464c3f[_0xa163('0x3e')](_0x45240b,0x0,{'type':_0x17f960[_0xa163('0x15')],'app':'GotoIfTime','appdata':_0x6848a4[_0x45240b]+'?'+_0x17f960['context']+',${EXTEN},'+_0x24f89f+':'+_0x17f960[_0xa163('0x16')]+',${EXTEN},'+_0x24092f,'exten':_0x17f960[_0xa163('0x7')],'context':_0x17f960[_0xa163('0x16')],'priority':_0x13abcf[_0xa163('0x17')]+_0x45240b,'VoiceExtensionId':_0x50e00e[_0x1554a5][0x0]['VoiceExtensionId']});}_0x17f960[_0xa163('0x17')]=_0x464c3f[_0xa163('0x35')]?_[_0xa163('0x3f')](_0x464c3f)[_0xa163('0x17')]+0x1:_0x13abcf[_0xa163('0x17')];_0x13abcf[_0xa163('0x17')]=(_0x4ca9c4[_0xa163('0x35')]?_['last'](_0x4ca9c4)[_0xa163('0x17')]:_0x17f960[_0xa163('0x17')])+0x1;_0x13abcf[_0xa163('0x10')]=_['concat'](_0x13abcf[_0xa163('0x10')],_0x464c3f,[_0x17f960],_0x4ca9c4);}_0x13abcf[_0xa163('0x10')][_0xa163('0x11')]({'type':_0x50e00e[_0x1554a5][0x0][_0xa163('0x15')],'app':_0xa163('0x40'),'exten':_0x50e00e[_0x1554a5][0x0][_0xa163('0x7')],'context':_0x50e00e[_0x1554a5][0x0][_0xa163('0x16')],'priority':_0x13abcf[_0xa163('0x17')],'VoiceExtensionId':_0x50e00e[_0x1554a5][0x0]['VoiceExtensionId']});_0x593b1e[_0xa163('0x11')](_0x50e00e[_0x1554a5][0x0]['VoiceExtensionId']);_0x4ad24a=_[_0xa163('0x41')](_0x4ad24a,_0x13abcf[_0xa163('0x10')]);}}return _0xeccf51[_0xa163('0x42')](function(_0x20f7e0){return _0xeccf51[_0xa163('0x4')][_0xa163('0x5')]['destroy']({'where':{'VoiceExtensionId':{'$in':_0x593b1e}},'transaction':_0x20f7e0})['then'](function(_0x20f180){return _0xeccf51[_0xa163('0x4')][_0xa163('0x5')][_0xa163('0x43')](_[_0xa163('0x44')](_0x4ad24a,_0xa163('0x17')),{'transaction':_0x20f7e0});});});})[_0xa163('0x45')](function(_0xf4311){console[_0xa163('0x46')](_0xf4311);});}exports[_0xa163('0x47')]=rewrite; \ No newline at end of file diff --git a/server/components/import/cm/csv.js b/server/components/import/cm/csv.js index f84930e..aea0a82 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 _0xe9ce=['keys','then','push','pick','Error\x20while\x20creating\x20contact:\x20','stringify','cmContact','inspect','into','fromQuery','scheduledAt','ListId','createdAt','updatedAt','select','field','NOW()','ContactId','toString','from','cm_contacts','where','deletedAt\x20IS\x20NULL','ListId\x20=\x20?','phone\x20NOT\x20IN\x20(?)','cm_hopper','id\x20IN\x20?','str','phone\x20IS\x20NOT\x20NULL','cm_hopper_final','\x20=\x20?','insert','cm_hopper_black','findAll','dialCheckDuplicateType','CmList','always','query','VoiceQueueId','catch','onlyIfOpen','sequelize','all','VoiceQueue','BlackLists','get','Campaign','Lists','CampaignId','cmContact,\x20%s,\x20%s','generalCheckHopper','Error\x20processing\x20rows\x20block:','finally','emit','contact:csv_','unlinkSync','Unable\x20to\x20delete\x20temp\x20file:','exit','SIGINT','info','CSV\x20import\x20process\x20stopped!','resolve','createReadStream','parse','pause','CSV\x20parsed\x20correctly!','CSV\x20parse\x20error','bluebird','util','lodash','squel','papaparse','ioredis','../../../mysqldb','../../../config/environment','../../../config/logger','api','defaults','redis','localhost','socket.io-emitter','register','argv','null','Missing\x20filepath\x20parameter!','undefined','Missing\x20binding\x20parameters!','split','Missing\x20socket_timestamp\x20parameter!','error','contact','index','test','errors','map','message','join','hasOwnProperty','data','firstName\x20not\x20specified!','phone','phone\x20not\x20specified!','birthDate','YYYY-MM-DD','isValid','email','email\x20format\x20is\x20not\x20valid!','CompanyId','length','find','duplicate','CmContact','create'];(function(_0x420932,_0x32730d){var _0xdb5362=function(_0x42f128){while(--_0x42f128){_0x420932['push'](_0x420932['shift']());}};_0xdb5362(++_0x32730d);}(_0xe9ce,0xb4));var _0xee9c=function(_0x2b6977,_0x1739ef){_0x2b6977=_0x2b6977-0x0;var _0x2aca61=_0xe9ce[_0x2b6977];return _0x2aca61;};'use strict';var BPromise=require(_0xee9c('0x0'));var util=require(_0xee9c('0x1'));var _=require(_0xee9c('0x2'));var fs=require('fs');var squel=require(_0xee9c('0x3'));var Papa=require(_0xee9c('0x4'));var Redis=require(_0xee9c('0x5'));var db=require(_0xee9c('0x6'))['db'];var config=require(_0xee9c('0x7'));var logger=require(_0xee9c('0x8'))(_0xee9c('0x9'));config['redis']=_[_0xee9c('0xa')](config[_0xee9c('0xb')],{'host':_0xee9c('0xc'),'port':0x18eb});var socket=require(_0xee9c('0xd'))(new Redis(config[_0xee9c('0xb')]));require('../../../api/cmContact/cmContact.socket')[_0xee9c('0xe')](socket);try{if(!process[_0xee9c('0xf')][0x2]||process[_0xee9c('0xf')][0x2]==='undefined'||process[_0xee9c('0xf')][0x2]===_0xee9c('0x10')){throw new Error(_0xee9c('0x11'));}var FILEPATH=process[_0xee9c('0xf')][0x2];if(!process[_0xee9c('0xf')][0x3]||process[_0xee9c('0xf')][0x3]==='undefined'||process['argv'][0x3]===_0xee9c('0x10')||!process['argv'][0x4]||process[_0xee9c('0xf')][0x4]===_0xee9c('0x12')||process[_0xee9c('0xf')][0x4]===_0xee9c('0x10')){throw new Error(_0xee9c('0x13'));}var FIELDS=_['zipObject'](process[_0xee9c('0xf')][0x3][_0xee9c('0x14')](','),process[_0xee9c('0xf')][0x4]['split'](','));if(!process[_0xee9c('0xf')][0x5]||process[_0xee9c('0xf')][0x5]===_0xee9c('0x12')||process[_0xee9c('0xf')][0x5]===_0xee9c('0x10')){throw new Error('Missing\x20ListId\x20parameter!');}var LISTID=process[_0xee9c('0xf')][0x5];var COMPANYID=process['argv'][0x6]&&process['argv'][0x6]!==_0xee9c('0x12')&&process[_0xee9c('0xf')][0x6]!==_0xee9c('0x10')?process[_0xee9c('0xf')][0x6]:null;var DUPLICATES=process[_0xee9c('0xf')][0x7]&&process[_0xee9c('0xf')][0x7]!==_0xee9c('0x12')&&process[_0xee9c('0xf')][0x7]!=='null'?process[_0xee9c('0xf')][0x7]:null;if(!process[_0xee9c('0xf')][0x8]||process['argv'][0x8]==='undefined'||process[_0xee9c('0xf')][0x8]===_0xee9c('0x10')){throw new Error(_0xee9c('0x15'));}var SOCKET_TIMESTAMP=process[_0xee9c('0xf')][0x8];}catch(_0x273a1b){logger[_0xee9c('0x16')](_0x273a1b);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(_0x263828,_0x383de2,_0x4683ca,_0x4ae773){var _0x6ab755={'message':_0x383de2};_0x6ab755[_0x263828]=!![];if(_0x4683ca){_0x6ab755[_0xee9c('0x17')]=_0x4683ca;}if(_0x4ae773){_0x6ab755[_0xee9c('0x18')]=_0x4ae773;}return _0x6ab755;}function isEmail(_0x5eb154){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))*$/[_0xee9c('0x19')](_0x5eb154);}function checkRow(_0x2f4f4b,_0x44c153,_0x283bc8){return new BPromise(function(_0x4521a0,_0x4eede5){if(_['isNil'](_0x2f4f4b)){return _0x4eede5(handleCheckRowError('error','The\x20row\x20is\x20empty\x20or\x20the\x20number\x20of\x20parameters\x20does\x20not\x20match\x20the\x20columns!',null,_0x283bc8));}if(_0x2f4f4b[_0xee9c('0x1a')]&&_0x2f4f4b['errors']['length']){var _0x219bb2=_[_0xee9c('0x1b')](_0x2f4f4b[_0xee9c('0x1a')],_0xee9c('0x1c'))[_0xee9c('0x1d')](';');return _0x4eede5(handleCheckRowError(_0xee9c('0x16'),_0x219bb2,null,_0x283bc8));}var _0x47697a={};for(var _0x9260ab in FIELDS){if(FIELDS[_0xee9c('0x1e')](_0x9260ab)&&FIELDS[_0x9260ab]){_0x47697a[_0x9260ab]=_0x2f4f4b[_0xee9c('0x1f')][0x0][FIELDS[_0x9260ab]]||_0x2f4f4b[_0xee9c('0x1f')][0x0]['\ufeff'+FIELDS[_0x9260ab]];}}if(!_0x47697a['firstName']){return _0x4eede5(handleCheckRowError(_0xee9c('0x16'),_0xee9c('0x20'),null,_0x283bc8));}if(!_0x47697a[_0xee9c('0x21')]){return _0x4eede5(handleCheckRowError(_0xee9c('0x16'),_0xee9c('0x22'),null,_0x283bc8));}if(_0x47697a[_0xee9c('0x23')]){var _0x5321ae=moment(_0x47697a[_0xee9c('0x23')],_0xee9c('0x24'));if(!_0x5321ae[_0xee9c('0x25')]()){return _0x4eede5(handleCheckRowError('error','birthDate\x20format\x20is\x20invalid,\x20YYYY-MM-DD\x20format\x20is\x20supported!',null,_0x283bc8));}}if(_0x47697a['email']){if(!isEmail(_0x47697a[_0xee9c('0x26')])){return _0x4eede5(handleCheckRowError(_0xee9c('0x16'),_0xee9c('0x27'),null,_0x283bc8));}}_0x47697a['ListId']=LISTID;_0x47697a[_0xee9c('0x28')]=COMPANYID||undefined;if(DUPLICATES&&DUPLICATES[_0xee9c('0x29')]&&_0x44c153){var _0x315e18={};for(var _0x5bc55f=0x0,_0x18640a=DUPLICATES[_0xee9c('0x29')];_0x5bc55f<_0x18640a;_0x5bc55f+=0x1){_0x315e18[DUPLICATES[_0x5bc55f]]=_0x47697a[DUPLICATES[_0x5bc55f]];}var _0x58fec5=_[_0xee9c('0x2a')](_0x44c153,_0x315e18);if(_0x58fec5){return _0x4eede5(handleCheckRowError(_0xee9c('0x2b'),'Duplicate\x20Contact',_0x58fec5,_0x283bc8));}}return db[_0xee9c('0x2c')][_0xee9c('0x2d')](_0x47697a,{'raw':!![],'hooks':![],'fields':_[_0xee9c('0x2e')](_0x47697a)})[_0xee9c('0x2f')](function(_0x5d975f){if(DUPLICATES&&DUPLICATES['length']&&_0x44c153){_0x44c153[_0xee9c('0x30')](_[_0xee9c('0x31')](_0x47697a,DUPLICATES));}hopperContacts+=(hopperContacts?',':'')+_0x5d975f['id'];return _0x4521a0();})['catch'](function(_0x498d40){return _0x4eede5(handleCheckRowError(_0xee9c('0x16'),_0xee9c('0x32')+(_0x498d40['message']||JSON[_0xee9c('0x33')](_0x498d40)),null,_0x283bc8));});});}function checkHopper(){function _0x381841(){return function(_0x6425b0){logger[_0xee9c('0x16')](_0xee9c('0x34'),'checkHopper',util[_0xee9c('0x35')](_0x6425b0,{'showHidden':![],'depth':null}));};}var _0x2bde47=function(_0x44dd35,_0x32882d){var _0x33758c=squel['insert']()[_0xee9c('0x36')]('cm_hopper')[_0xee9c('0x37')](['phone',_0xee9c('0x38'),'ContactId',_0xee9c('0x39'),_0x32882d,_0xee9c('0x3a'),_0xee9c('0x3b')],squel[_0xee9c('0x3c')]()[_0xee9c('0x3d')]('phone',_0xee9c('0x21'))[_0xee9c('0x3d')](_0xee9c('0x3e'),_0xee9c('0x38'))[_0xee9c('0x3d')]('id',_0xee9c('0x3f'))[_0xee9c('0x3d')](LISTID[_0xee9c('0x40')](),_0xee9c('0x39'))[_0xee9c('0x3d')](_0x44dd35['id'][_0xee9c('0x40')](),_0x32882d)[_0xee9c('0x3d')]('NOW()',_0xee9c('0x3a'))['field'](_0xee9c('0x3e'),_0xee9c('0x3b'))[_0xee9c('0x41')](_0xee9c('0x42'))[_0xee9c('0x43')](_0xee9c('0x44'))[_0xee9c('0x43')](_0xee9c('0x45'),LISTID['toString']())[_0xee9c('0x43')]('phone\x20IS\x20NOT\x20NULL')[_0xee9c('0x43')](_0xee9c('0x46'),squel[_0xee9c('0x3c')]()[_0xee9c('0x3d')]('phone')[_0xee9c('0x41')]('cm_hopper')['where'](_0x32882d+'\x20=\x20?',_0x44dd35['id'][_0xee9c('0x40')]())))['toString']();return _0x33758c;};var _0x221814=function(_0x5b019a,_0x4cc95b){var _0x561b78=squel['insert']()[_0xee9c('0x36')](_0xee9c('0x47'))[_0xee9c('0x37')]([_0xee9c('0x21'),_0xee9c('0x38'),'ContactId','ListId',_0x4cc95b,_0xee9c('0x3a'),_0xee9c('0x3b')],squel['select']()[_0xee9c('0x3d')](_0xee9c('0x21'),'phone')[_0xee9c('0x3d')](_0xee9c('0x3e'),_0xee9c('0x38'))[_0xee9c('0x3d')]('id','ContactId')['field'](LISTID[_0xee9c('0x40')](),_0xee9c('0x39'))[_0xee9c('0x3d')](_0x5b019a['id']['toString'](),_0x4cc95b)[_0xee9c('0x3d')]('NOW()',_0xee9c('0x3a'))['field'](_0xee9c('0x3e'),_0xee9c('0x3b'))[_0xee9c('0x41')](_0xee9c('0x42'))[_0xee9c('0x43')]('deletedAt\x20IS\x20NULL')['where'](_0xee9c('0x45'),LISTID[_0xee9c('0x40')]())['where'](_0xee9c('0x48'),squel[_0xee9c('0x49')](hopperContacts))[_0xee9c('0x43')](_0xee9c('0x4a'))['where'](_0xee9c('0x46'),squel[_0xee9c('0x3c')]()['field']('calleridnum')['from'](_0xee9c('0x4b'))[_0xee9c('0x43')](_0x4cc95b+_0xee9c('0x4c'),_0x5b019a['id']['toString']()))[_0xee9c('0x43')](_0xee9c('0x46'),squel[_0xee9c('0x3c')]()[_0xee9c('0x3d')](_0xee9c('0x21'))[_0xee9c('0x41')]('cm_hopper')['where'](_0x4cc95b+_0xee9c('0x4c'),_0x5b019a['id']['toString']())))[_0xee9c('0x40')]();return _0x561b78;};function _0x58cb9d(_0x4f1b90,_0x33c1c9){var _0x22a9f9=squel[_0xee9c('0x4d')]()['into'](_0xee9c('0x47'))['fromQuery'](['phone','scheduledAt',_0xee9c('0x3f'),_0xee9c('0x39'),_0x33c1c9,'createdAt',_0xee9c('0x3b')],squel[_0xee9c('0x3c')]()[_0xee9c('0x3d')](_0xee9c('0x21'),_0xee9c('0x21'))['field']('NOW()',_0xee9c('0x38'))[_0xee9c('0x3d')]('id','ContactId')[_0xee9c('0x3d')](LISTID['toString'](),'ListId')[_0xee9c('0x3d')](_0x4f1b90['id'][_0xee9c('0x40')](),_0x33c1c9)[_0xee9c('0x3d')](_0xee9c('0x3e'),'createdAt')[_0xee9c('0x3d')]('NOW()',_0xee9c('0x3b'))['from'](_0xee9c('0x42'))['where']('deletedAt\x20IS\x20NULL')[_0xee9c('0x43')]('ListId\x20=\x20?',LISTID[_0xee9c('0x40')]())[_0xee9c('0x43')](_0xee9c('0x48'),squel['str'](hopperContacts))[_0xee9c('0x43')](_0xee9c('0x4a')))[_0xee9c('0x40')]();return _0x22a9f9;}function _0x4ec0f4(_0x3baebf,_0x1b0c95){var _0x312cb4=squel[_0xee9c('0x4d')]()['into'](_0xee9c('0x4e'))[_0xee9c('0x37')]([_0xee9c('0x21'),_0xee9c('0x3f'),'ListId',_0x1b0c95,_0xee9c('0x3a'),'updatedAt'],squel['select']()[_0xee9c('0x3d')](_0xee9c('0x21'),_0xee9c('0x21'))[_0xee9c('0x3d')]('id',_0xee9c('0x3f'))[_0xee9c('0x3d')](LISTID[_0xee9c('0x40')](),_0xee9c('0x39'))[_0xee9c('0x3d')](_0x3baebf['id'][_0xee9c('0x40')](),_0x1b0c95)[_0xee9c('0x3d')](_0xee9c('0x3e'),_0xee9c('0x3a'))[_0xee9c('0x3d')](_0xee9c('0x3e'),_0xee9c('0x3b'))['from'](_0xee9c('0x42'))[_0xee9c('0x43')](_0xee9c('0x44'))[_0xee9c('0x43')]('ListId\x20=\x20?',LISTID[_0xee9c('0x40')]())[_0xee9c('0x43')](_0xee9c('0x48'),squel[_0xee9c('0x49')](hopperContacts))[_0xee9c('0x43')]('phone\x20IS\x20NOT\x20NULL'))[_0xee9c('0x40')]();return _0x312cb4;}return db['VoiceQueue'][_0xee9c('0x4f')]({'where':{'type':'outbound'},'attributes':['id',_0xee9c('0x50')],'include':[{'model':db[_0xee9c('0x51')],'as':'Lists','where':{'id':LISTID}}]})[_0xee9c('0x2f')](function(_0x15b117){var _0x372354=[];if(_0x15b117){var _0x3e8148;for(var _0x16996f=0x0,_0xbcc026;_0x16996f<_0x15b117['length'];_0x16996f+=0x1){_0xbcc026=_0x15b117[_0x16996f]['get']({'plain':!![]});switch(_0xbcc026[_0xee9c('0x50')]){case _0xee9c('0x52'):_0x372354[_0xee9c('0x30')](db['sequelize'][_0xee9c('0x53')](_0x221814(_0xbcc026,_0xee9c('0x54')))['then'](function(){})[_0xee9c('0x55')](_0x381841()));break;case _0xee9c('0x56'):_0x372354[_0xee9c('0x30')](db[_0xee9c('0x57')]['query'](_0x2bde47(_0xbcc026,_0xee9c('0x54')))[_0xee9c('0x2f')](function(){})[_0xee9c('0x55')](_0x381841()));break;default:_0x372354[_0xee9c('0x30')](db[_0xee9c('0x57')][_0xee9c('0x53')](_0x58cb9d(_0xbcc026,_0xee9c('0x54')))['then'](function(){})[_0xee9c('0x55')](_0x381841()));}}}return _0x372354;})[_0xee9c('0x58')]()['then'](function(){return db[_0xee9c('0x59')][_0xee9c('0x4f')]({'where':{'type':'outbound'},'attributes':['id'],'include':[{'model':db[_0xee9c('0x51')],'as':_0xee9c('0x5a'),'where':{'id':LISTID}}]})[_0xee9c('0x2f')](function(_0x5a2de0){var _0x386884=[];if(_0x5a2de0){var _0x38e958;for(var _0x38be1a=0x0,_0xf993c7;_0x38be1a<_0x5a2de0['length'];_0x38be1a+=0x1){_0xf993c7=_0x5a2de0[_0x38be1a][_0xee9c('0x5b')]({'plain':!![]});_0x386884[_0xee9c('0x30')](db['sequelize'][_0xee9c('0x53')](_0x4ec0f4(_0xf993c7,_0xee9c('0x54')))[_0xee9c('0x2f')](function(){})[_0xee9c('0x55')](_0x381841()));}}return _0x386884;})[_0xee9c('0x58')]();})[_0xee9c('0x2f')](function(){return db[_0xee9c('0x5c')][_0xee9c('0x4f')]({'attributes':['id',_0xee9c('0x50')],'include':[{'model':db[_0xee9c('0x51')],'as':_0xee9c('0x5d'),'where':{'id':LISTID}}]})[_0xee9c('0x2f')](function(_0x2890dd){var _0x5e69ea=[];if(_0x2890dd){for(var _0x4242e0=0x0,_0x2699bb;_0x4242e0<_0x2890dd[_0xee9c('0x29')];_0x4242e0+=0x1){_0x2699bb=_0x2890dd[_0x4242e0][_0xee9c('0x5b')]({'plain':!![]});switch(_0x2699bb[_0xee9c('0x50')]){case _0xee9c('0x52'):_0x5e69ea[_0xee9c('0x30')](db[_0xee9c('0x57')][_0xee9c('0x53')](_0x221814(_0x2699bb,_0xee9c('0x5e')))[_0xee9c('0x2f')](function(){})[_0xee9c('0x55')](_0x381841()));break;case _0xee9c('0x56'):_0x5e69ea[_0xee9c('0x30')](db[_0xee9c('0x57')][_0xee9c('0x53')](_0x2bde47(_0x2699bb,_0xee9c('0x5e')))['then'](function(){})['catch'](_0x381841()));break;default:_0x5e69ea[_0xee9c('0x30')](db[_0xee9c('0x57')][_0xee9c('0x53')](_0x58cb9d(_0x2699bb,'CampaignId'))[_0xee9c('0x2f')](function(){})[_0xee9c('0x55')](_0x381841()));}}}return _0x5e69ea;})[_0xee9c('0x58')]();})[_0xee9c('0x2f')](function(){return db[_0xee9c('0x5c')][_0xee9c('0x4f')]({'attributes':['id'],'include':[{'model':db[_0xee9c('0x51')],'as':_0xee9c('0x5a'),'where':{'id':LISTID}}]})[_0xee9c('0x2f')](function(_0x2f3c16){var _0x3e43c4=[];if(_0x2f3c16){for(var _0x70a6d6=0x0,_0x14cabf;_0x70a6d6<_0x2f3c16[_0xee9c('0x29')];_0x70a6d6+=0x1){_0x14cabf=_0x2f3c16[_0x70a6d6]['get']({'plain':!![]});_0x3e43c4[_0xee9c('0x30')](db[_0xee9c('0x57')]['query'](_0x4ec0f4(_0x14cabf,_0xee9c('0x5e')))['then'](function(){})['catch'](_0x381841()));}}return _0x3e43c4;})[_0xee9c('0x58')]();})[_0xee9c('0x55')](function(_0xea28d4){logger['error'](_0xee9c('0x5f'),_0xee9c('0x60'),_0xea28d4[_0xee9c('0x1c')]);});}var processPromises=function(_0x2d9674){return BPromise[_0xee9c('0x58')](promises)[_0xee9c('0x2f')](function(_0x47c495){})['catch'](function(_0x20d84b){logger[_0xee9c('0x16')](_0xee9c('0x61'),JSON[_0xee9c('0x33')](_0x20d84b));})[_0xee9c('0x62')](function(){socket[_0xee9c('0x63')](_0xee9c('0x64')+SOCKET_TIMESTAMP,{'success':success,'errors':errors,'duplicates':duplicates,'rows':rows});promises=[];success=0x0;errors=0x0;duplicates=0x0;rows=[];if(_0x2d9674){return _0x2d9674['resume']();}});};var endCsv=function(){return BPromise['resolve']()[_0xee9c('0x2f')](function(){if(hopperContacts){return checkHopper();}})['then'](function(){socket[_0xee9c('0x63')](_0xee9c('0x64')+SOCKET_TIMESTAMP,{'finished':!![],'success':success,'errors':errors,'duplicates':duplicates,'rows':rows});try{fs[_0xee9c('0x65')](FILEPATH);}catch(_0xa1bed2){logger[_0xee9c('0x16')](_0xee9c('0x66'),JSON[_0xee9c('0x33')](_0xa1bed2));}finally{process[_0xee9c('0x67')](0x0);}});};process['on'](_0xee9c('0x68'),function(){logger[_0xee9c('0x69')](_0xee9c('0x6a'));endCsv();});function main(){return BPromise[_0xee9c('0x6b')]()[_0xee9c('0x2f')](function(){if(DUPLICATES){DUPLICATES=DUPLICATES[_0xee9c('0x14')](',');return db[_0xee9c('0x2c')]['findAll']({'where':{'ListId':LISTID},'attributes':DUPLICATES,'raw':!![]});}})[_0xee9c('0x2f')](function(_0x681a88){var _0x37259a=fs[_0xee9c('0x6c')](FILEPATH,{'highWaterMark':0xf*0x400*0x400});Papa[_0xee9c('0x6d')](_0x37259a,{'header':!![],'skipEmptyLines':!![],'step':function(_0x3cae09,_0x21c5b0){total+=0x1;var _0xa1dad2=total;promises[_0xee9c('0x30')](checkRow(_0x3cae09,_0x681a88,_0xa1dad2)[_0xee9c('0x2f')](function(){success+=0x1;})['catch'](function(_0x155125){if(_0x155125[_0xee9c('0x16')]){errors+=0x1;delete _0x155125['error'];}else if(_0x155125['duplicate']){duplicates+=0x1;delete _0x155125[_0xee9c('0x2b')];}rows[_0xee9c('0x30')](_0x155125);}));if(total%0xc8===0x0){_0x21c5b0[_0xee9c('0x6e')]();return processPromises(_0x21c5b0);}},'complete':function(){return processPromises()[_0xee9c('0x2f')](function(){logger['info'](_0xee9c('0x6f'));endCsv();});},'error':function(_0x21f6ef,_0x1062e6){logger['info'](_0xee9c('0x70'),JSON[_0xee9c('0x33')](_0x21f6ef));endCsv();}});})[_0xee9c('0x55')](function(_0x1a1488){logger['error']('Error\x20executing\x20contact\x20csv\x20import:',JSON[_0xee9c('0x33')](_0x1a1488));});}main(); \ No newline at end of file +var _0x3e03=['redis','defaults','localhost','socket.io-emitter','../../../api/cmContact/cmContact.socket','register','argv','undefined','null','Missing\x20binding\x20parameters!','zipObject','split','Missing\x20ListId\x20parameter!','Missing\x20socket_timestamp\x20parameter!','error','contact','test','isNil','The\x20row\x20is\x20empty\x20or\x20the\x20number\x20of\x20parameters\x20does\x20not\x20match\x20the\x20columns!','map','errors','message','data','firstName\x20not\x20specified!','phone','phone\x20not\x20specified!','birthDate','YYYY-MM-DD','isValid','birthDate\x20format\x20is\x20invalid,\x20YYYY-MM-DD\x20format\x20is\x20supported!','email','email\x20format\x20is\x20not\x20valid!','length','find','duplicate','Duplicate\x20Contact','CmContact','create','keys','then','push','pick','catch','Error\x20while\x20creating\x20contact:\x20','stringify','cmContact','inspect','insert','scheduledAt','ContactId','createdAt','updatedAt','field','NOW()','toString','ListId','from','cm_contacts','where','deletedAt\x20IS\x20NULL','ListId\x20=\x20?','phone\x20NOT\x20IN\x20(?)','select','cm_hopper','\x20=\x20?','into','fromQuery','id\x20IN\x20?','str','phone\x20IS\x20NOT\x20NULL','calleridnum','cm_hopper_black','VoiceQueue','findAll','outbound','dialCheckDuplicateType','CmList','Lists','get','always','query','VoiceQueueId','onlyIfOpen','sequelize','all','BlackLists','Campaign','CampaignId','cmContact,\x20%s,\x20%s','generalCheckHopper','Error\x20processing\x20rows\x20block:','finally','emit','contact:csv_','resume','resolve','Unable\x20to\x20delete\x20temp\x20file:','exit','info','createReadStream','parse','pause','CSV\x20parsed\x20correctly!','CSV\x20parse\x20error','bluebird','papaparse','ioredis','../../../mysqldb','../../../config/environment','../../../config/logger','api'];(function(_0x51e123,_0x36c704){var _0x4b0b09=function(_0x566025){while(--_0x566025){_0x51e123['push'](_0x51e123['shift']());}};_0x4b0b09(++_0x36c704);}(_0x3e03,0x1b5));var _0x33e0=function(_0x547af,_0x17abff){_0x547af=_0x547af-0x0;var _0x22f7f4=_0x3e03[_0x547af];return _0x22f7f4;};'use strict';var BPromise=require(_0x33e0('0x0'));var util=require('util');var _=require('lodash');var fs=require('fs');var squel=require('squel');var Papa=require(_0x33e0('0x1'));var Redis=require(_0x33e0('0x2'));var db=require(_0x33e0('0x3'))['db'];var config=require(_0x33e0('0x4'));var logger=require(_0x33e0('0x5'))(_0x33e0('0x6'));config[_0x33e0('0x7')]=_[_0x33e0('0x8')](config['redis'],{'host':_0x33e0('0x9'),'port':0x18eb});var socket=require(_0x33e0('0xa'))(new Redis(config[_0x33e0('0x7')]));require(_0x33e0('0xb'))[_0x33e0('0xc')](socket);try{if(!process[_0x33e0('0xd')][0x2]||process['argv'][0x2]===_0x33e0('0xe')||process[_0x33e0('0xd')][0x2]==='null'){throw new Error('Missing\x20filepath\x20parameter!');}var FILEPATH=process['argv'][0x2];if(!process['argv'][0x3]||process['argv'][0x3]===_0x33e0('0xe')||process[_0x33e0('0xd')][0x3]===_0x33e0('0xf')||!process['argv'][0x4]||process['argv'][0x4]===_0x33e0('0xe')||process[_0x33e0('0xd')][0x4]===_0x33e0('0xf')){throw new Error(_0x33e0('0x10'));}var FIELDS=_[_0x33e0('0x11')](process[_0x33e0('0xd')][0x3][_0x33e0('0x12')](','),process[_0x33e0('0xd')][0x4][_0x33e0('0x12')](','));if(!process[_0x33e0('0xd')][0x5]||process[_0x33e0('0xd')][0x5]==='undefined'||process[_0x33e0('0xd')][0x5]==='null'){throw new Error(_0x33e0('0x13'));}var LISTID=process[_0x33e0('0xd')][0x5];var COMPANYID=process[_0x33e0('0xd')][0x6]&&process['argv'][0x6]!=='undefined'&&process[_0x33e0('0xd')][0x6]!=='null'?process[_0x33e0('0xd')][0x6]:null;var DUPLICATES=process[_0x33e0('0xd')][0x7]&&process[_0x33e0('0xd')][0x7]!==_0x33e0('0xe')&&process[_0x33e0('0xd')][0x7]!=='null'?process[_0x33e0('0xd')][0x7]:null;if(!process[_0x33e0('0xd')][0x8]||process[_0x33e0('0xd')][0x8]==='undefined'||process[_0x33e0('0xd')][0x8]===_0x33e0('0xf')){throw new Error(_0x33e0('0x14'));}var SOCKET_TIMESTAMP=process[_0x33e0('0xd')][0x8];}catch(_0x14ff04){logger[_0x33e0('0x15')](_0x14ff04);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(_0x329af5,_0x24b600,_0x5cf552,_0x219a23){var _0x25bdb9={'message':_0x24b600};_0x25bdb9[_0x329af5]=!![];if(_0x5cf552){_0x25bdb9[_0x33e0('0x16')]=_0x5cf552;}if(_0x219a23){_0x25bdb9['index']=_0x219a23;}return _0x25bdb9;}function isEmail(_0x4c9eb2){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))*$/[_0x33e0('0x17')](_0x4c9eb2);}function checkRow(_0x5ee034,_0x19f5e7,_0x12491d){return new BPromise(function(_0x1b4c37,_0x210ae9){if(_[_0x33e0('0x18')](_0x5ee034)){return _0x210ae9(handleCheckRowError(_0x33e0('0x15'),_0x33e0('0x19'),null,_0x12491d));}if(_0x5ee034['errors']&&_0x5ee034['errors']['length']){var _0xa2a2e2=_[_0x33e0('0x1a')](_0x5ee034[_0x33e0('0x1b')],_0x33e0('0x1c'))['join'](';');return _0x210ae9(handleCheckRowError(_0x33e0('0x15'),_0xa2a2e2,null,_0x12491d));}var _0x57fdf9={};for(var _0xcfdc3e in FIELDS){if(FIELDS['hasOwnProperty'](_0xcfdc3e)&&FIELDS[_0xcfdc3e]){_0x57fdf9[_0xcfdc3e]=_0x5ee034[_0x33e0('0x1d')][0x0][FIELDS[_0xcfdc3e]]||_0x5ee034[_0x33e0('0x1d')][0x0]['\ufeff'+FIELDS[_0xcfdc3e]];}}if(!_0x57fdf9['firstName']){return _0x210ae9(handleCheckRowError(_0x33e0('0x15'),_0x33e0('0x1e'),null,_0x12491d));}if(!_0x57fdf9[_0x33e0('0x1f')]){return _0x210ae9(handleCheckRowError(_0x33e0('0x15'),_0x33e0('0x20'),null,_0x12491d));}if(_0x57fdf9['birthDate']){var _0x20a174=moment(_0x57fdf9[_0x33e0('0x21')],_0x33e0('0x22'));if(!_0x20a174[_0x33e0('0x23')]()){return _0x210ae9(handleCheckRowError(_0x33e0('0x15'),_0x33e0('0x24'),null,_0x12491d));}}if(_0x57fdf9[_0x33e0('0x25')]){if(!isEmail(_0x57fdf9['email'])){return _0x210ae9(handleCheckRowError(_0x33e0('0x15'),_0x33e0('0x26'),null,_0x12491d));}}_0x57fdf9['ListId']=LISTID;_0x57fdf9['CompanyId']=COMPANYID||undefined;if(DUPLICATES&&DUPLICATES[_0x33e0('0x27')]&&_0x19f5e7){var _0x2e9790={};for(var _0xb8df0a=0x0,_0x2fe57d=DUPLICATES[_0x33e0('0x27')];_0xb8df0a<_0x2fe57d;_0xb8df0a+=0x1){_0x2e9790[DUPLICATES[_0xb8df0a]]=_0x57fdf9[DUPLICATES[_0xb8df0a]];}var _0x11a4dd=_[_0x33e0('0x28')](_0x19f5e7,_0x2e9790);if(_0x11a4dd){return _0x210ae9(handleCheckRowError(_0x33e0('0x29'),_0x33e0('0x2a'),_0x11a4dd,_0x12491d));}}return db[_0x33e0('0x2b')][_0x33e0('0x2c')](_0x57fdf9,{'raw':!![],'hooks':![],'fields':_[_0x33e0('0x2d')](_0x57fdf9)})[_0x33e0('0x2e')](function(_0x3de45e){if(DUPLICATES&&DUPLICATES[_0x33e0('0x27')]&&_0x19f5e7){_0x19f5e7[_0x33e0('0x2f')](_[_0x33e0('0x30')](_0x57fdf9,DUPLICATES));}hopperContacts+=(hopperContacts?',':'')+_0x3de45e['id'];return _0x1b4c37();})[_0x33e0('0x31')](function(_0x1dd7a){return _0x210ae9(handleCheckRowError(_0x33e0('0x15'),_0x33e0('0x32')+(_0x1dd7a[_0x33e0('0x1c')]||JSON[_0x33e0('0x33')](_0x1dd7a)),null,_0x12491d));});});}function checkHopper(){function _0x579363(){return function(_0x5dc4af){logger['error'](_0x33e0('0x34'),'checkHopper',util[_0x33e0('0x35')](_0x5dc4af,{'showHidden':![],'depth':null}));};}var _0x690a98=function(_0xf73c50,_0x25f297){var _0x1cd3ea=squel[_0x33e0('0x36')]()['into']('cm_hopper')['fromQuery']([_0x33e0('0x1f'),_0x33e0('0x37'),_0x33e0('0x38'),'ListId',_0x25f297,_0x33e0('0x39'),_0x33e0('0x3a')],squel['select']()[_0x33e0('0x3b')](_0x33e0('0x1f'),_0x33e0('0x1f'))[_0x33e0('0x3b')](_0x33e0('0x3c'),_0x33e0('0x37'))[_0x33e0('0x3b')]('id',_0x33e0('0x38'))[_0x33e0('0x3b')](LISTID[_0x33e0('0x3d')](),_0x33e0('0x3e'))[_0x33e0('0x3b')](_0xf73c50['id'][_0x33e0('0x3d')](),_0x25f297)[_0x33e0('0x3b')]('NOW()',_0x33e0('0x39'))['field'](_0x33e0('0x3c'),_0x33e0('0x3a'))[_0x33e0('0x3f')](_0x33e0('0x40'))[_0x33e0('0x41')](_0x33e0('0x42'))[_0x33e0('0x41')](_0x33e0('0x43'),LISTID['toString']())[_0x33e0('0x41')]('phone\x20IS\x20NOT\x20NULL')[_0x33e0('0x41')](_0x33e0('0x44'),squel[_0x33e0('0x45')]()[_0x33e0('0x3b')](_0x33e0('0x1f'))[_0x33e0('0x3f')](_0x33e0('0x46'))['where'](_0x25f297+_0x33e0('0x47'),_0xf73c50['id']['toString']())))[_0x33e0('0x3d')]();return _0x1cd3ea;};var _0x90d777=function(_0x50838d,_0x167b95){var _0x31f744=squel[_0x33e0('0x36')]()[_0x33e0('0x48')](_0x33e0('0x46'))[_0x33e0('0x49')]([_0x33e0('0x1f'),_0x33e0('0x37'),_0x33e0('0x38'),'ListId',_0x167b95,_0x33e0('0x39'),_0x33e0('0x3a')],squel['select']()[_0x33e0('0x3b')](_0x33e0('0x1f'),_0x33e0('0x1f'))['field'](_0x33e0('0x3c'),_0x33e0('0x37'))[_0x33e0('0x3b')]('id','ContactId')[_0x33e0('0x3b')](LISTID[_0x33e0('0x3d')](),_0x33e0('0x3e'))['field'](_0x50838d['id'][_0x33e0('0x3d')](),_0x167b95)[_0x33e0('0x3b')](_0x33e0('0x3c'),_0x33e0('0x39'))[_0x33e0('0x3b')](_0x33e0('0x3c'),_0x33e0('0x3a'))['from'](_0x33e0('0x40'))[_0x33e0('0x41')]('deletedAt\x20IS\x20NULL')[_0x33e0('0x41')](_0x33e0('0x43'),LISTID['toString']())[_0x33e0('0x41')](_0x33e0('0x4a'),squel[_0x33e0('0x4b')](hopperContacts))[_0x33e0('0x41')](_0x33e0('0x4c'))[_0x33e0('0x41')](_0x33e0('0x44'),squel[_0x33e0('0x45')]()[_0x33e0('0x3b')](_0x33e0('0x4d'))[_0x33e0('0x3f')]('cm_hopper_final')[_0x33e0('0x41')](_0x167b95+_0x33e0('0x47'),_0x50838d['id'][_0x33e0('0x3d')]()))[_0x33e0('0x41')]('phone\x20NOT\x20IN\x20(?)',squel[_0x33e0('0x45')]()[_0x33e0('0x3b')]('phone')[_0x33e0('0x3f')](_0x33e0('0x46'))['where'](_0x167b95+_0x33e0('0x47'),_0x50838d['id'][_0x33e0('0x3d')]())))[_0x33e0('0x3d')]();return _0x31f744;};function _0x45657f(_0x8356b1,_0x5e8c16){var _0x3402ab=squel[_0x33e0('0x36')]()[_0x33e0('0x48')](_0x33e0('0x46'))[_0x33e0('0x49')]([_0x33e0('0x1f'),'scheduledAt',_0x33e0('0x38'),'ListId',_0x5e8c16,_0x33e0('0x39'),_0x33e0('0x3a')],squel[_0x33e0('0x45')]()[_0x33e0('0x3b')]('phone',_0x33e0('0x1f'))[_0x33e0('0x3b')]('NOW()',_0x33e0('0x37'))[_0x33e0('0x3b')]('id',_0x33e0('0x38'))[_0x33e0('0x3b')](LISTID[_0x33e0('0x3d')](),_0x33e0('0x3e'))[_0x33e0('0x3b')](_0x8356b1['id']['toString'](),_0x5e8c16)[_0x33e0('0x3b')](_0x33e0('0x3c'),_0x33e0('0x39'))['field'](_0x33e0('0x3c'),_0x33e0('0x3a'))[_0x33e0('0x3f')](_0x33e0('0x40'))[_0x33e0('0x41')]('deletedAt\x20IS\x20NULL')[_0x33e0('0x41')](_0x33e0('0x43'),LISTID[_0x33e0('0x3d')]())[_0x33e0('0x41')]('id\x20IN\x20?',squel['str'](hopperContacts))[_0x33e0('0x41')](_0x33e0('0x4c')))['toString']();return _0x3402ab;}function _0x23f743(_0x37c2e5,_0x2919e8){var _0x1a46f9=squel[_0x33e0('0x36')]()['into'](_0x33e0('0x4e'))[_0x33e0('0x49')]([_0x33e0('0x1f'),'ContactId',_0x33e0('0x3e'),_0x2919e8,_0x33e0('0x39'),_0x33e0('0x3a')],squel[_0x33e0('0x45')]()[_0x33e0('0x3b')](_0x33e0('0x1f'),_0x33e0('0x1f'))['field']('id',_0x33e0('0x38'))[_0x33e0('0x3b')](LISTID[_0x33e0('0x3d')](),_0x33e0('0x3e'))[_0x33e0('0x3b')](_0x37c2e5['id'][_0x33e0('0x3d')](),_0x2919e8)[_0x33e0('0x3b')](_0x33e0('0x3c'),_0x33e0('0x39'))[_0x33e0('0x3b')]('NOW()',_0x33e0('0x3a'))[_0x33e0('0x3f')](_0x33e0('0x40'))['where']('deletedAt\x20IS\x20NULL')[_0x33e0('0x41')]('ListId\x20=\x20?',LISTID[_0x33e0('0x3d')]())[_0x33e0('0x41')](_0x33e0('0x4a'),squel['str'](hopperContacts))['where'](_0x33e0('0x4c')))[_0x33e0('0x3d')]();return _0x1a46f9;}return db[_0x33e0('0x4f')][_0x33e0('0x50')]({'where':{'type':_0x33e0('0x51')},'attributes':['id',_0x33e0('0x52')],'include':[{'model':db[_0x33e0('0x53')],'as':_0x33e0('0x54'),'where':{'id':LISTID}}]})[_0x33e0('0x2e')](function(_0x2ab128){var _0x429f8d=[];if(_0x2ab128){var _0x15d29a;for(var _0x3318a8=0x0,_0x433a91;_0x3318a8<_0x2ab128[_0x33e0('0x27')];_0x3318a8+=0x1){_0x433a91=_0x2ab128[_0x3318a8][_0x33e0('0x55')]({'plain':!![]});switch(_0x433a91[_0x33e0('0x52')]){case _0x33e0('0x56'):_0x429f8d['push'](db['sequelize'][_0x33e0('0x57')](_0x90d777(_0x433a91,_0x33e0('0x58')))[_0x33e0('0x2e')](function(){})[_0x33e0('0x31')](_0x579363()));break;case _0x33e0('0x59'):_0x429f8d['push'](db[_0x33e0('0x5a')][_0x33e0('0x57')](_0x690a98(_0x433a91,'VoiceQueueId'))[_0x33e0('0x2e')](function(){})[_0x33e0('0x31')](_0x579363()));break;default:_0x429f8d[_0x33e0('0x2f')](db[_0x33e0('0x5a')][_0x33e0('0x57')](_0x45657f(_0x433a91,_0x33e0('0x58')))['then'](function(){})[_0x33e0('0x31')](_0x579363()));}}}return _0x429f8d;})[_0x33e0('0x5b')]()[_0x33e0('0x2e')](function(){return db[_0x33e0('0x4f')][_0x33e0('0x50')]({'where':{'type':_0x33e0('0x51')},'attributes':['id'],'include':[{'model':db[_0x33e0('0x53')],'as':_0x33e0('0x5c'),'where':{'id':LISTID}}]})[_0x33e0('0x2e')](function(_0x36c3cd){var _0x2c501c=[];if(_0x36c3cd){var _0x42ce1f;for(var _0x54712d=0x0,_0x160bd9;_0x54712d<_0x36c3cd['length'];_0x54712d+=0x1){_0x160bd9=_0x36c3cd[_0x54712d][_0x33e0('0x55')]({'plain':!![]});_0x2c501c[_0x33e0('0x2f')](db[_0x33e0('0x5a')]['query'](_0x23f743(_0x160bd9,_0x33e0('0x58')))[_0x33e0('0x2e')](function(){})[_0x33e0('0x31')](_0x579363()));}}return _0x2c501c;})[_0x33e0('0x5b')]();})[_0x33e0('0x2e')](function(){return db[_0x33e0('0x5d')][_0x33e0('0x50')]({'attributes':['id','dialCheckDuplicateType'],'include':[{'model':db[_0x33e0('0x53')],'as':_0x33e0('0x54'),'where':{'id':LISTID}}]})['then'](function(_0x20f7a7){var _0x185308=[];if(_0x20f7a7){for(var _0x3ac588=0x0,_0x37db7d;_0x3ac588<_0x20f7a7[_0x33e0('0x27')];_0x3ac588+=0x1){_0x37db7d=_0x20f7a7[_0x3ac588][_0x33e0('0x55')]({'plain':!![]});switch(_0x37db7d[_0x33e0('0x52')]){case'always':_0x185308[_0x33e0('0x2f')](db[_0x33e0('0x5a')][_0x33e0('0x57')](_0x90d777(_0x37db7d,_0x33e0('0x5e')))[_0x33e0('0x2e')](function(){})['catch'](_0x579363()));break;case _0x33e0('0x59'):_0x185308['push'](db['sequelize'][_0x33e0('0x57')](_0x690a98(_0x37db7d,_0x33e0('0x5e')))[_0x33e0('0x2e')](function(){})[_0x33e0('0x31')](_0x579363()));break;default:_0x185308['push'](db[_0x33e0('0x5a')][_0x33e0('0x57')](_0x45657f(_0x37db7d,_0x33e0('0x5e')))[_0x33e0('0x2e')](function(){})[_0x33e0('0x31')](_0x579363()));}}}return _0x185308;})['all']();})['then'](function(){return db[_0x33e0('0x5d')][_0x33e0('0x50')]({'attributes':['id'],'include':[{'model':db['CmList'],'as':_0x33e0('0x5c'),'where':{'id':LISTID}}]})['then'](function(_0x2c6519){var _0x4ec717=[];if(_0x2c6519){for(var _0x7ba31f=0x0,_0x3ff4df;_0x7ba31f<_0x2c6519[_0x33e0('0x27')];_0x7ba31f+=0x1){_0x3ff4df=_0x2c6519[_0x7ba31f][_0x33e0('0x55')]({'plain':!![]});_0x4ec717['push'](db[_0x33e0('0x5a')][_0x33e0('0x57')](_0x23f743(_0x3ff4df,_0x33e0('0x5e')))[_0x33e0('0x2e')](function(){})['catch'](_0x579363()));}}return _0x4ec717;})[_0x33e0('0x5b')]();})[_0x33e0('0x31')](function(_0x1f7369){logger[_0x33e0('0x15')](_0x33e0('0x5f'),_0x33e0('0x60'),_0x1f7369[_0x33e0('0x1c')]);});}var processPromises=function(_0x1dc4f8){return BPromise['all'](promises)['then'](function(_0x4c1d16){})[_0x33e0('0x31')](function(_0x1261de){logger['error'](_0x33e0('0x61'),JSON['stringify'](_0x1261de));})[_0x33e0('0x62')](function(){socket[_0x33e0('0x63')](_0x33e0('0x64')+SOCKET_TIMESTAMP,{'success':success,'errors':errors,'duplicates':duplicates,'rows':rows});promises=[];success=0x0;errors=0x0;duplicates=0x0;rows=[];if(_0x1dc4f8){return _0x1dc4f8[_0x33e0('0x65')]();}});};var endCsv=function(){return BPromise[_0x33e0('0x66')]()[_0x33e0('0x2e')](function(){if(hopperContacts){return checkHopper();}})[_0x33e0('0x2e')](function(){socket['emit']('contact:csv_'+SOCKET_TIMESTAMP,{'finished':!![],'success':success,'errors':errors,'duplicates':duplicates,'rows':rows});try{fs['unlinkSync'](FILEPATH);}catch(_0xc34d13){logger[_0x33e0('0x15')](_0x33e0('0x67'),JSON['stringify'](_0xc34d13));}finally{process[_0x33e0('0x68')](0x0);}});};process['on']('SIGINT',function(){logger[_0x33e0('0x69')]('CSV\x20import\x20process\x20stopped!');endCsv();});function main(){return BPromise[_0x33e0('0x66')]()[_0x33e0('0x2e')](function(){if(DUPLICATES){DUPLICATES=DUPLICATES[_0x33e0('0x12')](',');return db[_0x33e0('0x2b')][_0x33e0('0x50')]({'where':{'ListId':LISTID},'attributes':DUPLICATES,'raw':!![]});}})[_0x33e0('0x2e')](function(_0x554210){var _0xe4e84e=fs[_0x33e0('0x6a')](FILEPATH,{'highWaterMark':0xf*0x400*0x400});Papa[_0x33e0('0x6b')](_0xe4e84e,{'header':!![],'skipEmptyLines':!![],'step':function(_0x5bb89f,_0x36b18c){total+=0x1;var _0x29dd19=total;promises[_0x33e0('0x2f')](checkRow(_0x5bb89f,_0x554210,_0x29dd19)[_0x33e0('0x2e')](function(){success+=0x1;})[_0x33e0('0x31')](function(_0x19a017){if(_0x19a017[_0x33e0('0x15')]){errors+=0x1;delete _0x19a017[_0x33e0('0x15')];}else if(_0x19a017['duplicate']){duplicates+=0x1;delete _0x19a017[_0x33e0('0x29')];}rows[_0x33e0('0x2f')](_0x19a017);}));if(total%0xc8===0x0){_0x36b18c[_0x33e0('0x6c')]();return processPromises(_0x36b18c);}},'complete':function(){return processPromises()['then'](function(){logger[_0x33e0('0x69')](_0x33e0('0x6d'));endCsv();});},'error':function(_0xbe101c,_0x14397e){logger[_0x33e0('0x69')](_0x33e0('0x6e'),JSON['stringify'](_0xbe101c));endCsv();}});})['catch'](function(_0x5e46d6){logger[_0x33e0('0x15')]('Error\x20executing\x20contact\x20csv\x20import:',JSON['stringify'](_0x5e46d6));});}main(); \ No newline at end of file diff --git a/server/components/import/cm/csv2.js b/server/components/import/cm/csv2.js index 0b41eec..1cd6b60 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 _0x06e6=['appendFileSync','emit','contact:import:','Abort\x20parser','SystemError','cm_contacts_','CREATE\x20TABLE\x20','(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()','duplicates','DROP\x20TABLE\x20','orderBy','voice_queues','VoiceQueueId','CampaignId','campaigns_has_cm_blacklists','voice_queues_has_cm_blacklists','finish','affectedRows','unlink','complete','argv','arguments\x20\x20\x20','existsSync','file\x20doesn\x27t\x20exists','parse','binding\x20doesn\x27t\x20exists','phone\x20is\x20mandatory','firstName','ListId\x20is\x20mandatory','body\x20id\x20mandatory','map','No\x20agent\x20available','uncaughtException','path','lodash','util','moment','squel','ioredis','../../../mysqldb','../../../config/environment','../../../config/environment/shared','../../../config/logger','import','redis','defaults','localhost','format','YYYY-MM-DD\x20HH:mm:ss','test','select','field','phone','.id\x20=\x20','where','\x20=\x20','.dialCheckDuplicateType\x20IN\x20(','join','CmContact','findAll','AdditionalPhones','all','then','push','length','split','isNil','filter','findOne','CmContactHasItem','update','updated','PHONE','inserted','cm_contacts.phone','cm_contacts.ListId','cm_contacts.updatedAt','cm_contacts.priority','insert','fromQuery','ContactId','ListId','UserId','fields','from','cm_contacts','cm_contacts.ListId\x20=\x20','.CmListId','.CmListId\x20=\x20?','cm_contacts.createdAt\x20=\x20?','cm_contacts.phone\x20NOT\x20IN\x20(?)','cm_hopper','\x22always\x22','\x22onlyIfOpen\x22','toString','cm_contacts.id','into','createdAt','updatedAt','cm_hopper_black','ListId\x20=\x20?','.offset-cm_contacts.utcOffset\x20minute)','cm_contacts.createdAt','cm_contacts.UserId','scheduledat','priority','recallme','cm_hopper.id','cm_contact_has_items.item','cm_contact_has_items.OrderBy','cm_contact_has_items.createdAt','cm_hopper_additional_phones','CmHopperId','OrderBy','cm_contacts.id\x20=\x20cm_hopper.ContactId','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?','group','info','Received\x20SIGINT','error','message','exit','errors','query','catch','campaigns.id','campaigns.dialTimezone','campaigns','campaigns_has_cm_lists','campaigns.id\x20=\x20campaigns_has_cm_lists.CampaignId','campaigns_has_cm_lists.CmListId=','sequelize','spread','voice_queues.id','voice_queues.dialTimezone','voice_queues_has_cm_lists','voice_queues_has_cm_lists.CmListId=','timezones','dialTimezone','utcOffset','set','main','stringify','send','start','binding','clone','socket_timestamp','root','server/files/tmp','.csv','includes','header','ContactItemType','name','_description','createReadStream','data','rows','find','hasOwnProperty','trim','replace','isValid','isNaN','isNumber','agent\x20not\x20exists','email','dateOfBirth','dateOfBirth\x20wrong\x20format\x20(YYYY-MM-DD)','\x20not\x20specified','itemTypeId','SystemRow'];(function(_0x263754,_0x5cd642){var _0x16d109=function(_0x1cd382){while(--_0x1cd382){_0x263754['push'](_0x263754['shift']());}};_0x16d109(++_0x5cd642);}(_0x06e6,0x193));var _0x606e=function(_0x259e71,_0x178636){_0x259e71=_0x259e71-0x0;var _0x4cde6f=_0x06e6[_0x259e71];return _0x4cde6f;};'use strict';var fs=require('fs');var path=require(_0x606e('0x0'));var _=require(_0x606e('0x1'));var Papa=require('papaparse');var util=require(_0x606e('0x2'));var BPromise=require('bluebird');var moment=require(_0x606e('0x3'));var squel=require(_0x606e('0x4'));var Redis=require(_0x606e('0x5'));var db=require(_0x606e('0x6'))['db'];var config=require(_0x606e('0x7'));var shared=require(_0x606e('0x8'));var logger=require(_0x606e('0x9'))(_0x606e('0xa'));config[_0x606e('0xb')]=_[_0x606e('0xc')](config[_0x606e('0xb')],{'host':_0x606e('0xd'),'port':0x18eb});var socket=require('socket.io-emitter')(new Redis(config[_0x606e('0xb')]));var stats={'finish':![],'errors':[],'rows':0x0,'affectedRows':0x0};var results=[];var promisesAdditionalPhones=[];var orderBy=0x0;var stopped=![];var NOW=moment()[_0x606e('0xe')](_0x606e('0xf'));var contactItemTypes=[];var phoneDescriptions=[];var hasAdditionalPhones=![];var tmp_voice_queues;var tmp_campaigns;var tzOffset=0x0;var hasTZ;var NOW=moment()[_0x606e('0xe')](_0x606e('0xf'));function isEmail(_0xea2937){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))*$/[_0x606e('0x10')](_0xea2937);}function selectNotIn(_0x55e327,_0x2e5698,_0x15521d,_0x526141,_0x121c1f){return squel[_0x606e('0x11')]()[_0x606e('0x12')](_0x606e('0x13'))['from'](_0x526141)['join'](_0x2e5698,null,_0x2e5698+_0x606e('0x14')+_0x526141+'.'+_0x15521d)[_0x606e('0x15')](_0x526141+'.'+_0x15521d+_0x606e('0x16')+_0x55e327+'.'+_0x15521d)[_0x606e('0x15')](_0x2e5698+_0x606e('0x17')+_0x121c1f[_0x606e('0x18')]()+')');}function handleAdditionalPhones(){return new Promise(function(_0x5f16b2,_0x41bdce){promisesAdditionalPhones=[];return db[_0x606e('0x19')][_0x606e('0x1a')]({'raw':!![],'attributes':['id',_0x606e('0x1b')],'where':{'createdAt':NOW,'AdditionalPhones':{'$ne':null}}})['then'](function(_0x4ac783){if(_0x4ac783!==null){var _0x582114=[];for(var _0x13eabe=0x0;_0x13eabe<_0x4ac783['length'];_0x13eabe++){var _0x2015fa=_0x4ac783[_0x13eabe];_0x582114['push'](insertAdditionalPhones(_0x2015fa));}}Promise[_0x606e('0x1c')](_0x582114)[_0x606e('0x1d')](function(){_0x5f16b2({'val':0x1});});});});}function insertAdditionalPhones(_0x514768){return new Promise(function(_0x8cc100,_0x86d176){var _0x28e53b=_0x514768['AdditionalPhones'];var _0x17d301=_0x28e53b['split'](';');var _0x1faf4c=[];orderBy=0x0;for(var _0x43ceab=0x0;_0x43ceab<_0x17d301['length'];_0x43ceab++){_0x1faf4c[_0x606e('0x1e')](splitAdditionalPhone(_0x514768['id'],_0x17d301[_0x43ceab]));}Promise['all'](_0x1faf4c)[_0x606e('0x1d')](function(){_0x8cc100({'val':_0x17d301[_0x606e('0x1f')]});});});}function splitAdditionalPhone(_0x56eeb5,_0x1a6258){return new Promise(function(_0x387e03,_0x234593){var _0x563bfb=_0x1a6258[_0x606e('0x20')](':');var _0x22e5e7=_0x563bfb[0x0];var _0x1955c6=_0x563bfb[0x1];if(!_[_0x606e('0x21')](_0x1955c6)){var _0x4d0da4=_0x1955c6[_0x606e('0x20')]('|');var _0x244e5d=[];for(var _0x475a22=0x0;_0x475a22<_0x4d0da4[_0x606e('0x1f')];_0x475a22++){if(_0x4d0da4[_0x475a22]!==''){var _0x4f9f6a=_[_0x606e('0x22')](promisesAdditionalPhones,{'contactId':_0x56eeb5,'phone':_0x4d0da4[_0x475a22]});if(_0x4f9f6a[_0x606e('0x1f')]==0x0){orderBy++;promisesAdditionalPhones[_0x606e('0x1e')]({'contactId':_0x56eeb5,'contactTypeId':_0x22e5e7,'phone':_0x4d0da4[_0x475a22],'orderBy':orderBy});}}}_0x387e03({'ok':0x1});}else _0x387e03({'res':0x0});});}function createAdditionalPhone(_0x3a98ef,_0x3195b3,_0x1f3ee8,_0x467aac){var _0x174190='';var _0x3f1691='';var _0x2a1f29=_0x1f3ee8[_0x606e('0x20')]('§');_0x174190=_0x2a1f29[0x0];if(_0x2a1f29[_0x606e('0x1f')]==0x2)_0x3f1691=_0x2a1f29[0x1];return new Promise(function(_0x506d0a,_0x385ec2){return db['CmContactHasItem'][_0x606e('0x23')]({'where':{'CmContactId':_0x3a98ef,'item':_0x174190}})[_0x606e('0x1d')](function(_0x5319bf){if(_0x5319bf){return db[_0x606e('0x24')][_0x606e('0x25')]({'ItemTypeId':_0x3195b3,'description':_0x3f1691,'OrderBy':_0x467aac},{'where':{'CmContactId':_0x3a98ef,'item':_0x174190}})[_0x606e('0x1d')](function(_0x4ff6bc){_0x506d0a({'res':_0x606e('0x26')});});}else{return db['CmContactHasItem']['create']({'CmContactId':_0x3a98ef,'item':_0x174190,'description':_0x3f1691,'ItemTypeId':_0x3195b3,'OrderBy':_0x467aac,'ItemClass':_0x606e('0x27')})[_0x606e('0x1d')](function(_0x14a59f){_0x506d0a({'res':_0x606e('0x28')});});}});});}function insertCmHopper(_0x203875,_0x2ca991,_0x5aa178,_0x2d4544,_0x3fa10e){var _0x17e169=[_0x606e('0x29'),'cm_contacts.scheduledat','cm_contacts.id',_0x606e('0x2a'),_0x2ca991+'.'+_0x2d4544,'cm_contacts.createdAt',_0x606e('0x2b'),_0x606e('0x2c'),'cm_contacts.UserId','\x22'+_0x3fa10e+'\x22'];return squel[_0x606e('0x2d')]()['into']('cm_hopper')[_0x606e('0x2e')]([_0x606e('0x13'),'scheduledat',_0x606e('0x2f'),_0x606e('0x30'),_0x2d4544,'createdAt','updatedAt','priority',_0x606e('0x31'),'recallme'],squel['select']()[_0x606e('0x32')](_0x17e169)[_0x606e('0x33')](_0x2ca991)[_0x606e('0x18')](_0x606e('0x34'),null,_0x606e('0x35')+_0x2ca991+_0x606e('0x36'))[_0x606e('0x18')](_0x5aa178,null,_0x5aa178+_0x606e('0x14')+_0x2ca991+'.'+_0x2d4544)[_0x606e('0x15')](_0x2ca991+_0x606e('0x37'),_0x203875)[_0x606e('0x15')](_0x606e('0x38'),NOW)[_0x606e('0x15')](_0x606e('0x39'),selectNotIn(_0x2ca991,_0x5aa178,_0x2d4544,_0x606e('0x3a'),[_0x606e('0x3b'),_0x606e('0x3c')]))['where']('cm_contacts.phone\x20NOT\x20IN\x20(?)',selectNotIn(_0x2ca991,_0x5aa178,_0x2d4544,'cm_hopper',['\x22always\x22'])))[_0x606e('0x3d')]();}function insertCmHopperBlack(_0x2991c8,_0xffc0a0,_0x24d5c3,_0x5e5c7f){var _0x40432a=[_0x606e('0x29'),_0x606e('0x3e'),_0x606e('0x2a'),_0xffc0a0+'.'+_0x5e5c7f,'cm_contacts.createdAt',_0x606e('0x2b')];return squel[_0x606e('0x2d')]()[_0x606e('0x3f')]('cm_hopper_black')[_0x606e('0x2e')](['phone',_0x606e('0x2f'),_0x606e('0x30'),_0x5e5c7f,_0x606e('0x40'),_0x606e('0x41')],squel[_0x606e('0x11')]()[_0x606e('0x32')](_0x40432a)['from'](_0xffc0a0)[_0x606e('0x18')]('cm_contacts',null,'cm_contacts.ListId\x20=\x20'+_0xffc0a0+_0x606e('0x36'))[_0x606e('0x18')](_0x24d5c3,null,_0x24d5c3+_0x606e('0x14')+_0xffc0a0+'.'+_0x5e5c7f)[_0x606e('0x15')](_0xffc0a0+'.CmListId\x20=\x20?',_0x2991c8)[_0x606e('0x15')]('cm_contacts.createdAt\x20=\x20?',NOW)[_0x606e('0x15')](_0x606e('0x39'),squel['select']()[_0x606e('0x12')](_0x606e('0x13'))[_0x606e('0x33')](_0x606e('0x42'))[_0x606e('0x15')](_0x606e('0x43'),_0x2991c8)[_0x606e('0x15')](_0x5e5c7f+_0x606e('0x16')+_0xffc0a0+'.'+_0x5e5c7f)))['toString']();}function insertTzCmHopper(_0x47de8d,_0x1d8120,_0x1cd515,_0x32540a,_0x311b35,_0x52a7b1){var _0x4a54ff=[_0x606e('0x29'),'date_add(cm_contacts.scheduledat,interval\x20'+_0x52a7b1+_0x606e('0x44'),_0x606e('0x3e'),_0x606e('0x2a'),_0x1d8120+'.'+_0x32540a,_0x606e('0x45'),_0x606e('0x2b'),_0x606e('0x2c'),_0x606e('0x46'),'\x22'+_0x311b35+'\x22'];var _0x3077a4=squel[_0x606e('0x2d')]()[_0x606e('0x3f')](_0x606e('0x3a'))[_0x606e('0x2e')](['phone',_0x606e('0x47'),'ContactId',_0x606e('0x30'),_0x32540a,_0x606e('0x40'),_0x606e('0x41'),_0x606e('0x48'),_0x606e('0x31'),_0x606e('0x49')],squel[_0x606e('0x11')]()[_0x606e('0x32')](_0x4a54ff)[_0x606e('0x33')](_0x1d8120)[_0x606e('0x18')]('cm_contacts',null,_0x606e('0x35')+_0x1d8120+_0x606e('0x36'))['join'](_0x1cd515,null,_0x1cd515+_0x606e('0x14')+_0x1d8120+'.'+_0x32540a)['join'](_0x52a7b1,null,_0x52a7b1+_0x606e('0x14')+_0x1d8120+'.'+_0x32540a)[_0x606e('0x15')](_0x1d8120+_0x606e('0x37'),_0x47de8d)[_0x606e('0x15')]('cm_contacts.createdAt\x20=\x20?',NOW)[_0x606e('0x15')](_0x606e('0x39'),selectNotIn(_0x1d8120,_0x1cd515,_0x32540a,'cm_hopper',['\x22always\x22',_0x606e('0x3c')]))['where'](_0x606e('0x39'),selectNotIn(_0x1d8120,_0x1cd515,_0x32540a,'cm_hopper',[_0x606e('0x3b')])))[_0x606e('0x3d')]();return _0x3077a4;}function insertTzCmHopperBlack(_0x1fb936,_0xfa12ff,_0xb316ea,_0x5e20c5){var _0x348a7e=[_0x606e('0x29'),_0x606e('0x3e'),'cm_contacts.ListId',_0xfa12ff+'.'+_0x5e20c5,_0x606e('0x45'),_0x606e('0x2b')];return squel[_0x606e('0x2d')]()[_0x606e('0x3f')](_0x606e('0x42'))['fromQuery']([_0x606e('0x13'),_0x606e('0x2f'),_0x606e('0x30'),_0x5e20c5,_0x606e('0x40'),_0x606e('0x41')],squel[_0x606e('0x11')]()[_0x606e('0x32')](_0x348a7e)[_0x606e('0x33')](_0xfa12ff)[_0x606e('0x18')](_0x606e('0x34'),null,_0x606e('0x35')+_0xfa12ff+_0x606e('0x36'))[_0x606e('0x18')](_0xb316ea,null,_0xb316ea+_0x606e('0x14')+_0xfa12ff+'.'+_0x5e20c5)['where'](_0xfa12ff+'.CmListId\x20=\x20?',_0x1fb936)['where'](_0x606e('0x38'),NOW)[_0x606e('0x15')](_0x606e('0x39'),squel[_0x606e('0x11')]()[_0x606e('0x12')](_0x606e('0x13'))[_0x606e('0x33')](_0x606e('0x42'))[_0x606e('0x15')](_0x606e('0x43'),_0x1fb936)[_0x606e('0x15')](_0x5e20c5+_0x606e('0x16')+_0xfa12ff+'.'+_0x5e20c5)))[_0x606e('0x3d')]();}function insertCmHopperAdditionalPhones(_0x46de7c){var _0x18a979=[_0x606e('0x4a'),_0x606e('0x4b'),_0x606e('0x4c'),_0x606e('0x4d'),'cm_contact_has_items.updatedAt'];return squel[_0x606e('0x2d')]()[_0x606e('0x3f')](_0x606e('0x4e'))['fromQuery']([_0x606e('0x4f'),_0x606e('0x13'),_0x606e('0x50'),'createdAt','updatedAt'],squel[_0x606e('0x11')]()['fields'](_0x18a979)[_0x606e('0x33')](_0x606e('0x3a'))['join'](_0x606e('0x34'),null,_0x606e('0x51'))['join']('cm_contact_has_items',null,_0x606e('0x52'))[_0x606e('0x15')](_0x606e('0x53'),_0x46de7c)[_0x606e('0x15')](_0x606e('0x38'),NOW))[_0x606e('0x3d')]();}function insertCmContact(_0x351564,_0x17a520,_0x5d2664,_0x571a17){var _0x4bb2ce=_['concat'](_[_0x606e('0x54')](_0x571a17),[_0x606e('0x30'),_0x606e('0x55'),_0x606e('0x40'),_0x606e('0x41'),'scheduledAt']);return squel[_0x606e('0x2d')]()[_0x606e('0x3f')](_0x606e('0x34'))[_0x606e('0x2e')](_0x4bb2ce,squel[_0x606e('0x11')]()[_0x606e('0x32')](_0x4bb2ce)[_0x606e('0x33')](_0x17a520)[_0x606e('0x15')]('('+_0x5d2664[_0x606e('0x18')](',')+_0x606e('0x56'),squel['select']()[_0x606e('0x32')](_0x5d2664)[_0x606e('0x33')]('cm_contacts')['where'](_0x606e('0x43'),_0x351564)[_0x606e('0x15')](_0x606e('0x57')))[_0x606e('0x15')](_0x606e('0x58'),squel[_0x606e('0x11')]()[_0x606e('0x12')]('MIN(id)','min_id')[_0x606e('0x33')](_0x17a520)[_0x606e('0x59')](_0x5d2664[_0x606e('0x18')](','))))[_0x606e('0x3d')]();}function handleStop(){logger[_0x606e('0x5a')](_0x606e('0x5b'));stopped=!![];}function handleUncaughtException(_0x5db522){logger[_0x606e('0x5c')](_0x5db522[_0x606e('0x5d')]);process[_0x606e('0x5e')](0x1);}function handleError(_0x5dc85f,_0x496cfc){stats[_0x606e('0x5f')]['push']({'name':_0x496cfc['code'],'message':_0x496cfc[_0x606e('0x5d')],'row':_0x5dc85f});}function handleQuery(_0x4b0743){logger[_0x606e('0x5a')](_0x4b0743);return db['sequelize'][_0x606e('0x60')](_0x4b0743)['spread'](function(_0x22043a){results[_0x606e('0x1e')](_0x22043a);})[_0x606e('0x61')](function(_0x18523f){logger[_0x606e('0x5c')](_0x18523f['message']);});}function updateTzCampaigns(_0x27ad4d){return new Promise(function(_0x223002,_0x369eda){var _0x202382=squel[_0x606e('0x11')]()['fields']([_0x606e('0x62'),_0x606e('0x63')])[_0x606e('0x33')](_0x606e('0x64'))[_0x606e('0x18')](_0x606e('0x65'),null,_0x606e('0x66'))[_0x606e('0x15')](_0x606e('0x67')+_0x27ad4d);db[_0x606e('0x68')][_0x606e('0x60')](_0x202382[_0x606e('0x3d')]())[_0x606e('0x69')](function(_0x25edbc){var _0x3d40d4=[];for(var _0x25adbe=0x0;_0x25adbe<_0x25edbc[_0x606e('0x1f')];_0x25adbe++){_0x3d40d4['push'](getTimezoneData(_0x25edbc[_0x25adbe],tmp_campaigns));}BPromise[_0x606e('0x1c')](_0x3d40d4)['then'](function(){_0x223002({'val':0x1});});})[_0x606e('0x61')](function(_0x30df64){logger[_0x606e('0x5c')](_0x30df64[_0x606e('0x5d')]);_0x223002({'val':0x0});});});}function updateTzVoiceQueues(_0x48ab8f){return new Promise(function(_0x4e2de9,_0x388c50){var _0x4fb731=squel[_0x606e('0x11')]()[_0x606e('0x32')]([_0x606e('0x6a'),_0x606e('0x6b')])[_0x606e('0x33')]('voice_queues')[_0x606e('0x18')](_0x606e('0x6c'),null,'voice_queues.id\x20=\x20voice_queues_has_cm_lists.VoiceQueueId')[_0x606e('0x15')](_0x606e('0x6d')+_0x48ab8f);db[_0x606e('0x68')][_0x606e('0x60')](_0x4fb731[_0x606e('0x3d')]())[_0x606e('0x69')](function(_0x2310fd){var _0x28f217=[];for(var _0x493af1=0x0;_0x493af1<_0x2310fd[_0x606e('0x1f')];_0x493af1++){_0x28f217[_0x606e('0x1e')](getTimezoneData(_0x2310fd[_0x493af1],tmp_voice_queues));}BPromise[_0x606e('0x1c')](_0x28f217)[_0x606e('0x1d')](function(){_0x4e2de9({'val':0x1});});})[_0x606e('0x61')](function(_0x1bd296){logger[_0x606e('0x5c')](_0x1bd296[_0x606e('0x5d')]);_0x4e2de9({'val':0x0});});});}function getTimezoneData(_0xd5ae1f,_0x183376){return new Promise(function(_0x3cac4d,_0x534cb2){var _0x215da8=shared[_0x606e('0x6e')];var _0x1b9ef5=_0x215da8[_0xd5ae1f[_0x606e('0x6f')]];if(_['isNil'](_0x1b9ef5)){_0x3cac4d({'ret':0x1});}else{var _0xe21cec=_0x1b9ef5[_0x606e('0x70')];var _0x30fd6e=squel[_0x606e('0x2d')]()['into'](_0x183376)[_0x606e('0x71')]('id',_0xd5ae1f['id'])['set']('offset',_0xe21cec)[_0x606e('0x71')]('dialTimezone',_0xd5ae1f[_0x606e('0x6f')])[_0x606e('0x3d')]();return db[_0x606e('0x68')][_0x606e('0x60')](_0x30fd6e)['spread'](function(_0x13bd33){_0x3cac4d({'ret':0x1});})[_0x606e('0x61')](function(_0xd0615){logger[_0x606e('0x5c')](_0xd0615[_0x606e('0x5d')]);_0x534cb2({'ret':0x1});});}});}function handleTZQuery(_0x133246){logger[_0x606e('0x5a')](_0x133246);return db[_0x606e('0x68')][_0x606e('0x60')](_0x133246)[_0x606e('0x69')](function(_0x497b02){})[_0x606e('0x61')](function(_0x506595){logger['error'](_0x506595[_0x606e('0x5d')]);});}function main(_0x37a9d6,_0x19b72f,_0x545e28,_0x364052){logger['info'](_0x606e('0x72'),_0x37a9d6,JSON[_0x606e('0x73')](_0x19b72f));process[_0x606e('0x74')](_0x606e('0x75'));var _0x2f7769=_0x19b72f[_0x606e('0x76')];var _0x58580d=_[_0x606e('0x77')](_0x2f7769);var _0x47a72b=_0x19b72f[_0x606e('0x78')];var _0x4ab5e4=path[_0x606e('0x18')](config[_0x606e('0x79')],_0x606e('0x7a'),_0x47a72b+_0x606e('0x7b'));hasTZ=_[_0x606e('0x54')](_0x2f7769)[_0x606e('0x7c')](_0x606e('0x6f'));var _0x3ce641=_[_0x606e('0x54')](_0x2f7769)[_0x606e('0x18')]();logger[_0x606e('0x5a')](_0x606e('0x7d'),_0x3ce641);db[_0x606e('0x7e')][_0x606e('0x1a')]({'raw':!![],'attributes':['id',_0x606e('0x7f')]})[_0x606e('0x1d')](function(_0x4ed85f){for(var _0x415cb9=0x0;_0x415cb9<_0x4ed85f[_0x606e('0x1f')];_0x415cb9++){if(_0x4ed85f[_0x415cb9][_0x606e('0x7f')]in _0x2f7769){contactItemTypes[_0x606e('0x1e')](_0x4ed85f[_0x415cb9]);delete _0x58580d[_0x4ed85f[_0x415cb9][_0x606e('0x7f')]];hasAdditionalPhones=!![];}for(var _0x2e17d2 in _0x2f7769){if(_0x4ed85f[_0x415cb9][_0x606e('0x7f')]+_0x606e('0x80')===_0x2e17d2){phoneDescriptions[_0x606e('0x1e')]({'itemTypeId':_0x4ed85f[_0x415cb9]['id'],'description':_0x2e17d2});delete _0x58580d[_0x2e17d2];}}}if(hasAdditionalPhones)_0x58580d[_0x606e('0x1b')]='';var _0x1c67a9=_[_0x606e('0x54')](_0x58580d)[_0x606e('0x18')]();logger[_0x606e('0x5a')]('header',_0x1c67a9);fs['writeFileSync'](_0x4ab5e4,_0x1c67a9+'\x0a');Papa['parse'](fs[_0x606e('0x81')](_0x37a9d6),{'header':!![],'skipEmptyLines':!![],'step':function(_0x3b9241,_0xad3b93){try{for(var _0x3ec82=0x0,_0x8c7830=[];_0x3ec82<_0x3b9241[_0x606e('0x82')][_0x606e('0x1f')];_0x3ec82++){stats[_0x606e('0x83')]+=0x1;if(_0x3b9241[_0x606e('0x5f')][_0x3ec82]){handleError(_0x3b9241[_0x606e('0x82')][_0x3ec82],_0x3b9241['errors'][_0x3ec82]);}else{var _0x4f6d11=[];var _0x40e698=[];var _0x31821d={};for(var _0x29a1d7 in _0x2f7769){let _0x2ac127=contactItemTypes['find'](_0xce7480=>_0xce7480[_0x606e('0x7f')]===_0x29a1d7);let _0x1cd038=contactItemTypes[_0x606e('0x84')](_0xb50d83=>_0xb50d83[_0x606e('0x7f')]+'_description'===_0x29a1d7);if(_[_0x606e('0x21')](_0x2ac127)&&_[_0x606e('0x21')](_0x1cd038)){if(_0x2f7769[_0x606e('0x85')](_0x29a1d7)){if(_0x3b9241['data'][_0x3ec82][_0x2f7769[_0x29a1d7]]){var _0x59bc71=_[_0x606e('0x86')](_0x3b9241['data'][_0x3ec82][_0x2f7769[_0x29a1d7]][_0x606e('0x87')](/"/g,'\x27'));switch(_0x29a1d7){case _0x606e('0x47'):var _0x312a3a=moment(_0x59bc71,_0x606e('0xf'),!![]);if(_0x312a3a[_0x606e('0x88')]()){_0x8c7830['push']('\x22'+_0x59bc71+'\x22');}else{_0x4f6d11[_0x606e('0x1e')]('scheduledat\x20wrong\x20format\x20(YYYY-MM-DD\x20HH:mm:ss)');}break;case _0x606e('0x48'):var _0x463885=parseInt(_0x59bc71);_0x59bc71=_[_0x606e('0x89')](_0x463885)||_0x463885<0x0||_0x463885>0x4?_0x364052?0x3:0x2:_0x463885;_0x8c7830[_0x606e('0x1e')]('\x22'+_0x59bc71+'\x22');break;case _0x606e('0x31'):var _0x2b114d=parseInt(_0x59bc71);if(_[_0x606e('0x8a')](_0x2b114d)&&_['includes'](_0x545e28,_0x2b114d)){_0x8c7830[_0x606e('0x1e')]('\x22'+_0x2b114d+'\x22');}else{_0x4f6d11['push'](_0x606e('0x8b'));}break;case _0x606e('0x8c'):if(isEmail(_0x59bc71)){_0x8c7830['push']('\x22'+_0x59bc71+'\x22');}else{_0x4f6d11[_0x606e('0x1e')]('email\x20wrong\x20format');}break;case _0x606e('0x8d'):var _0x1d29aa=moment(_0x59bc71,'YYYY-MM-DD',!![]);if(_0x1d29aa[_0x606e('0x88')]()){_0x8c7830[_0x606e('0x1e')]('\x22'+_0x59bc71+'\x22');}else{_0x4f6d11[_0x606e('0x1e')](_0x606e('0x8e'));}break;case'dialTimezone':var _0x41316c=shared[_0x606e('0x6e')];var _0x1bc38e=_0x41316c[_0x59bc71];if(!_['isNil'](_0x1bc38e)){var _0x21b6fe=_0x1bc38e['utcOffset'];_0x8c7830['push']('\x22'+_0x59bc71+'\x22');_0x8c7830[_0x606e('0x1e')]('\x22'+_0x21b6fe+'\x22');}break;default:_0x8c7830[_0x606e('0x1e')]('\x22'+_0x59bc71+'\x22');}}else{switch(_0x29a1d7){case'firstName':case _0x606e('0x13'):_0x4f6d11[_0x606e('0x1e')](_0x29a1d7+_0x606e('0x8f'));break;default:_0x8c7830[_0x606e('0x1e')]('\x22\x22');}}}}else{var _0x11ec03='';if(!_[_0x606e('0x21')](_0x2ac127)){if(!_0x31821d['hasOwnProperty'](_0x2ac127['id'])){if(!_[_0x606e('0x21')](_0x3b9241[_0x606e('0x82')][_0x3ec82][_0x2f7769[_0x29a1d7]])){var _0x59bc71=_[_0x606e('0x86')](_0x3b9241['data'][_0x3ec82][_0x2f7769[_0x29a1d7]][_0x606e('0x87')](/"/g,'\x27'));var _0x525445=phoneDescriptions[_0x606e('0x84')](_0x442a27=>_0x442a27[_0x606e('0x90')]===_0x2ac127['id']);if(!_['isNil'](_0x525445)){var _0x4ae497=_[_0x606e('0x86')](_0x3b9241[_0x606e('0x82')][_0x3ec82][_0x2f7769[_0x525445['description']]]['replace'](/"/g,'\x27'));if(!_[_0x606e('0x21')](_0x4ae497))_0x59bc71=_0x59bc71+'§'+_0x4ae497;}if(_0x11ec03=='')_0x11ec03=_0x59bc71;else _0x11ec03+='|'+_0x59bc71;}_0x40e698[_0x606e('0x1e')](_0x2ac127['id']+':'+_0x11ec03);_0x31821d[_0x2ac127['id']]=0x1;}}}}if(hasAdditionalPhones){_0x8c7830[_0x606e('0x1e')]('\x22'+_0x40e698['join'](';')+'\x22');}if(_0x4f6d11['length']){handleError(_0x3b9241[_0x606e('0x82')][_0x3ec82],{'code':_0x606e('0x91'),'message':_0x4f6d11['join']()});}else{fs[_0x606e('0x92')](_0x4ab5e4,_0x8c7830[_0x606e('0x18')]()+'\x0a');}_0x8c7830=[];}if(!(stats[_0x606e('0x83')]%0xc8)){socket[_0x606e('0x93')](_0x606e('0x94')+_0x47a72b,stats);stats[_0x606e('0x5f')]=[];}}if(stopped){logger[_0x606e('0x5a')](_0x606e('0x95'));_0xad3b93['abort']();}}catch(_0x5f4b97){handleError(_0x3b9241[_0x606e('0x82')][_0x3ec82],{'code':_0x606e('0x96'),'message':_0x5f4b97[_0x606e('0x5d')]});logger[_0x606e('0x5c')]('step',_0x5f4b97[_0x606e('0x5d')]);}},'complete':function(){try{var _0x5e28e2=[];var _0x498f1a=[];var _0x25cbaa=_0x606e('0x34');if(_0x19b72f['duplicates']&&_0x19b72f['duplicates'][_0x606e('0x1f')]){_0x25cbaa=_0x606e('0x97')+_0x47a72b;_0x5e28e2['push'](_0x606e('0x98')+_0x25cbaa+'\x20LIKE\x20cm_contacts;');}tmp_campaigns='campaigns_'+_0x47a72b;tmp_voice_queues='voice_queues_'+_0x47a72b;_0x498f1a[_0x606e('0x1e')](_0x606e('0x98')+tmp_campaigns+_0x606e('0x99'));_0x498f1a[_0x606e('0x1e')](_0x606e('0x98')+tmp_voice_queues+'(id\x20int,dialTimezone\x20varchar(255),offset\x20int);');BPromise[_0x606e('0x9a')](_0x498f1a,handleTZQuery)[_0x606e('0x1d')](function(_0x58c7db){updateTzCampaigns(_0x19b72f[_0x606e('0x30')])[_0x606e('0x1d')](function(_0x3045dc){updateTzVoiceQueues(_0x19b72f[_0x606e('0x30')])['then'](function(_0x217d3f){if(hasTZ)_0x1c67a9=_0x1c67a9[_0x606e('0x87')](_0x606e('0x6f'),_0x606e('0x9b'));var _0x4aeaa6=util['format'](_0x606e('0x9c'),_0x4ab5e4,_0x25cbaa,_0x1c67a9,_0x19b72f['ListId'],_0x19b72f[_0x606e('0x55')]||null,NOW,NOW);if(_['isNil'](_0x2f7769['scheduledat'])){_0x4aeaa6+=_0x606e('0x9d');}_0x5e28e2[_0x606e('0x1e')](_0x4aeaa6);if(_0x19b72f[_0x606e('0x9e')]&&_0x19b72f['duplicates'][_0x606e('0x1f')]){_0x5e28e2['push'](insertCmContact(_0x19b72f[_0x606e('0x30')],_0x25cbaa,_0x19b72f[_0x606e('0x9e')],_0x2f7769));_0x5e28e2[_0x606e('0x1e')](_0x606e('0x9f')+_0x25cbaa+';');}BPromise[_0x606e('0x9a')](_0x5e28e2,handleQuery)[_0x606e('0x1d')](function(_0x1c0144){BPromise[_0x606e('0x1c')]([handleAdditionalPhones()])['then'](function(){_0x5e28e2=[];for(var _0x14cd51=0x0;_0x14cd51\x20\x20','existsSync','file\x20doesn\x27t\x20exists','binding\x20doesn\x27t\x20exists','firstName\x20is\x20mandatory','map','No\x20agent\x20available','SIGINT','uncaughtException','lodash','papaparse','util','bluebird','moment','squel','ioredis','../../../mysqldb','../../../config/environment','../../../config/environment/shared','import','redis','defaults','localhost','socket.io-emitter','format','YYYY-MM-DD\x20HH:mm:ss','select','field','phone','from','join','.id\x20=\x20','where','\x20=\x20','.dialCheckDuplicateType\x20IN\x20(','CmContact','AdditionalPhones','length','push','all','then','split','isNil','filter','CmContactHasItem','findOne','update','updated','create','inserted','cm_contacts.phone','cm_contacts.scheduledat','cm_contacts.id','cm_contacts.ListId','cm_contacts.createdAt','cm_contacts.updatedAt','cm_contacts.priority','cm_contacts.UserId','insert','into','cm_hopper','fromQuery','scheduledat','ContactId','ListId','createdAt','updatedAt','priority','cm_contacts','.CmListId','.CmListId\x20=\x20?','cm_contacts.phone\x20NOT\x20IN\x20(?)','\x22always\x22','\x22onlyIfOpen\x22','toString','cm_hopper_black','fields','cm_contacts.ListId\x20=\x20','cm_contacts.createdAt\x20=\x20?','ListId\x20=\x20?','cm_hopper.id','cm_contact_has_items.item','cm_contact_has_items.createdAt','cm_contact_has_items.updatedAt','cm_hopper_additional_phones','CmHopperId','OrderBy','cm_contact_has_items','cm_hopper.ListId\x20=\x20?','concat','keys','CompanyId','scheduledAt',')\x20NOT\x20IN\x20?','deletedAt\x20IS\x20NULL','id\x20IN\x20?','MIN(id)','group','info','Received\x20SIGINT','error','message','exit','code','sequelize','query','spread','catch','campaigns.id','campaigns','campaigns_has_cm_lists','campaigns.id\x20=\x20campaigns_has_cm_lists.CampaignId','voice_queues.id','voice_queues.dialTimezone','voice_queues','voice_queues_has_cm_lists'];(function(_0xb72129,_0x5294a0){var _0x361588=function(_0x522619){while(--_0x522619){_0xb72129['push'](_0xb72129['shift']());}};_0x361588(++_0x5294a0);}(_0xa7b8,0x1b7));var _0x8a7b=function(_0xc5f80e,_0x2b31ff){_0xc5f80e=_0xc5f80e-0x0;var _0x322c2f=_0xa7b8[_0xc5f80e];return _0x322c2f;};'use strict';var fs=require('fs');var path=require('path');var _=require(_0x8a7b('0x0'));var Papa=require(_0x8a7b('0x1'));var util=require(_0x8a7b('0x2'));var BPromise=require(_0x8a7b('0x3'));var moment=require(_0x8a7b('0x4'));var squel=require(_0x8a7b('0x5'));var Redis=require(_0x8a7b('0x6'));var db=require(_0x8a7b('0x7'))['db'];var config=require(_0x8a7b('0x8'));var shared=require(_0x8a7b('0x9'));var logger=require('../../../config/logger')(_0x8a7b('0xa'));config[_0x8a7b('0xb')]=_[_0x8a7b('0xc')](config['redis'],{'host':_0x8a7b('0xd'),'port':0x18eb});var socket=require(_0x8a7b('0xe'))(new Redis(config[_0x8a7b('0xb')]));var stats={'finish':![],'errors':[],'rows':0x0,'affectedRows':0x0};var results=[];var promisesAdditionalPhones=[];var orderBy=0x0;var stopped=![];var NOW=moment()[_0x8a7b('0xf')](_0x8a7b('0x10'));var contactItemTypes=[];var phoneDescriptions=[];var hasAdditionalPhones=![];var tmp_voice_queues;var tmp_campaigns;var tzOffset=0x0;var hasTZ;var NOW=moment()[_0x8a7b('0xf')](_0x8a7b('0x10'));function isEmail(_0x4dda83){return/^([^\x00-\x20\x22\x28\x29\x2c\x2e\x3a-\x3c\x3e\x40\x5b-\x5d\x7f-\xff]+|\x22([^\x0d\x22\x5c\x80-\xff]|\x5c[\x00-\x7f])*\x22)(\x2e([^\x00-\x20\x22\x28\x29\x2c\x2e\x3a-\x3c\x3e\x40\x5b-\x5d\x7f-\xff]+|\x22([^\x0d\x22\x5c\x80-\xff]|\x5c[\x00-\x7f])*\x22))*\x40([^\x00-\x20\x22\x28\x29\x2c\x2e\x3a-\x3c\x3e\x40\x5b-\x5d\x7f-\xff]+|\x5b([^\x0d\x5b-\x5d\x80-\xff]|\x5c[\x00-\x7f])*\x5d)(\x2e([^\x00-\x20\x22\x28\x29\x2c\x2e\x3a-\x3c\x3e\x40\x5b-\x5d\x7f-\xff]+|\x5b([^\x0d\x5b-\x5d\x80-\xff]|\x5c[\x00-\x7f])*\x5d))*$/['test'](_0x4dda83);}function selectNotIn(_0x4b132a,_0x267885,_0x33eceb,_0x511ec4,_0x1d1919){return squel[_0x8a7b('0x11')]()[_0x8a7b('0x12')](_0x8a7b('0x13'))[_0x8a7b('0x14')](_0x511ec4)[_0x8a7b('0x15')](_0x267885,null,_0x267885+_0x8a7b('0x16')+_0x511ec4+'.'+_0x33eceb)[_0x8a7b('0x17')](_0x511ec4+'.'+_0x33eceb+_0x8a7b('0x18')+_0x4b132a+'.'+_0x33eceb)[_0x8a7b('0x17')](_0x267885+_0x8a7b('0x19')+_0x1d1919[_0x8a7b('0x15')]()+')');}function handleAdditionalPhones(){return new Promise(function(_0x44ab17,_0x4e3827){promisesAdditionalPhones=[];return db[_0x8a7b('0x1a')]['findAll']({'raw':!![],'attributes':['id',_0x8a7b('0x1b')],'where':{'createdAt':NOW,'AdditionalPhones':{'$ne':null}}})['then'](function(_0x4f708a){if(_0x4f708a!==null){var _0x48afae=[];for(var _0x29618d=0x0;_0x29618d<_0x4f708a[_0x8a7b('0x1c')];_0x29618d++){var _0x1e3585=_0x4f708a[_0x29618d];_0x48afae[_0x8a7b('0x1d')](insertAdditionalPhones(_0x1e3585));}}Promise[_0x8a7b('0x1e')](_0x48afae)[_0x8a7b('0x1f')](function(){_0x44ab17({'val':0x1});});});});}function insertAdditionalPhones(_0x35b9b4){return new Promise(function(_0x2657b0,_0x19e9a6){var _0x4a833b=_0x35b9b4[_0x8a7b('0x1b')];var _0x5dd310=_0x4a833b[_0x8a7b('0x20')](';');var _0x7581b1=[];orderBy=0x0;for(var _0x48ee05=0x0;_0x48ee05<_0x5dd310[_0x8a7b('0x1c')];_0x48ee05++){_0x7581b1[_0x8a7b('0x1d')](splitAdditionalPhone(_0x35b9b4['id'],_0x5dd310[_0x48ee05]));}Promise[_0x8a7b('0x1e')](_0x7581b1)[_0x8a7b('0x1f')](function(){_0x2657b0({'val':_0x5dd310[_0x8a7b('0x1c')]});});});}function splitAdditionalPhone(_0x1cee51,_0x3335e7){return new Promise(function(_0x487748,_0x45ece0){var _0x4f77b1=_0x3335e7[_0x8a7b('0x20')](':');var _0x5c887c=_0x4f77b1[0x0];var _0x1c1df1=_0x4f77b1[0x1];if(!_[_0x8a7b('0x21')](_0x1c1df1)){var _0xbf80bb=_0x1c1df1[_0x8a7b('0x20')]('|');var _0x1971ff=[];for(var _0x12dc6f=0x0;_0x12dc6f<_0xbf80bb['length'];_0x12dc6f++){if(_0xbf80bb[_0x12dc6f]!==''){var _0x4e1e99=_[_0x8a7b('0x22')](promisesAdditionalPhones,{'contactId':_0x1cee51,'phone':_0xbf80bb[_0x12dc6f]});if(_0x4e1e99[_0x8a7b('0x1c')]==0x0){orderBy++;promisesAdditionalPhones['push']({'contactId':_0x1cee51,'contactTypeId':_0x5c887c,'phone':_0xbf80bb[_0x12dc6f],'orderBy':orderBy});}}}_0x487748({'ok':0x1});}else _0x487748({'res':0x0});});}function createAdditionalPhone(_0x143e26,_0x217266,_0x29a509,_0x1a3040){var _0x2ff145='';var _0x5af7c4='';var _0x15b85d=_0x29a509['split']('§');_0x2ff145=_0x15b85d[0x0];if(_0x15b85d[_0x8a7b('0x1c')]==0x2)_0x5af7c4=_0x15b85d[0x1];return new Promise(function(_0x270b69,_0x5cd104){return db[_0x8a7b('0x23')][_0x8a7b('0x24')]({'where':{'CmContactId':_0x143e26,'item':_0x2ff145}})[_0x8a7b('0x1f')](function(_0x2823e0){if(_0x2823e0){return db[_0x8a7b('0x23')][_0x8a7b('0x25')]({'ItemTypeId':_0x217266,'description':_0x5af7c4,'OrderBy':_0x1a3040},{'where':{'CmContactId':_0x143e26,'item':_0x2ff145}})[_0x8a7b('0x1f')](function(_0x3049ef){_0x270b69({'res':_0x8a7b('0x26')});});}else{return db['CmContactHasItem'][_0x8a7b('0x27')]({'CmContactId':_0x143e26,'item':_0x2ff145,'description':_0x5af7c4,'ItemTypeId':_0x217266,'OrderBy':_0x1a3040,'ItemClass':'PHONE'})[_0x8a7b('0x1f')](function(_0x48b28f){_0x270b69({'res':_0x8a7b('0x28')});});}});});}function insertCmHopper(_0x2ef676,_0x3b8c43,_0x5aead9,_0x52fd64,_0x33d9bd){var _0x26dbb4=[_0x8a7b('0x29'),_0x8a7b('0x2a'),_0x8a7b('0x2b'),_0x8a7b('0x2c'),_0x3b8c43+'.'+_0x52fd64,_0x8a7b('0x2d'),_0x8a7b('0x2e'),_0x8a7b('0x2f'),_0x8a7b('0x30'),'\x22'+_0x33d9bd+'\x22'];return squel[_0x8a7b('0x31')]()[_0x8a7b('0x32')](_0x8a7b('0x33'))[_0x8a7b('0x34')]([_0x8a7b('0x13'),_0x8a7b('0x35'),_0x8a7b('0x36'),_0x8a7b('0x37'),_0x52fd64,_0x8a7b('0x38'),_0x8a7b('0x39'),_0x8a7b('0x3a'),'UserId','recallme'],squel[_0x8a7b('0x11')]()['fields'](_0x26dbb4)[_0x8a7b('0x14')](_0x3b8c43)[_0x8a7b('0x15')](_0x8a7b('0x3b'),null,'cm_contacts.ListId\x20=\x20'+_0x3b8c43+_0x8a7b('0x3c'))[_0x8a7b('0x15')](_0x5aead9,null,_0x5aead9+_0x8a7b('0x16')+_0x3b8c43+'.'+_0x52fd64)[_0x8a7b('0x17')](_0x3b8c43+_0x8a7b('0x3d'),_0x2ef676)[_0x8a7b('0x17')]('cm_contacts.createdAt\x20=\x20?',NOW)['where'](_0x8a7b('0x3e'),selectNotIn(_0x3b8c43,_0x5aead9,_0x52fd64,_0x8a7b('0x33'),[_0x8a7b('0x3f'),_0x8a7b('0x40')]))['where'](_0x8a7b('0x3e'),selectNotIn(_0x3b8c43,_0x5aead9,_0x52fd64,_0x8a7b('0x33'),['\x22always\x22'])))[_0x8a7b('0x41')]();}function insertCmHopperBlack(_0x4a2ef8,_0x23f893,_0x35e994,_0x12e569){var _0x4cf02f=[_0x8a7b('0x29'),'cm_contacts.id',_0x8a7b('0x2c'),_0x23f893+'.'+_0x12e569,_0x8a7b('0x2d'),'cm_contacts.updatedAt'];return squel[_0x8a7b('0x31')]()['into'](_0x8a7b('0x42'))['fromQuery'](['phone',_0x8a7b('0x36'),'ListId',_0x12e569,_0x8a7b('0x38'),'updatedAt'],squel['select']()[_0x8a7b('0x43')](_0x4cf02f)[_0x8a7b('0x14')](_0x23f893)[_0x8a7b('0x15')](_0x8a7b('0x3b'),null,_0x8a7b('0x44')+_0x23f893+_0x8a7b('0x3c'))[_0x8a7b('0x15')](_0x35e994,null,_0x35e994+_0x8a7b('0x16')+_0x23f893+'.'+_0x12e569)[_0x8a7b('0x17')](_0x23f893+_0x8a7b('0x3d'),_0x4a2ef8)['where'](_0x8a7b('0x45'),NOW)[_0x8a7b('0x17')](_0x8a7b('0x3e'),squel['select']()[_0x8a7b('0x12')]('phone')['from'](_0x8a7b('0x42'))['where'](_0x8a7b('0x46'),_0x4a2ef8)['where'](_0x12e569+'\x20=\x20'+_0x23f893+'.'+_0x12e569)))[_0x8a7b('0x41')]();}function insertTzCmHopper(_0x5e7b6a,_0x5a82f6,_0x2406f4,_0x27b89c,_0x18308f,_0x266ff7){var _0x94831a=['cm_contacts.phone','date_add(cm_contacts.scheduledat,interval\x20'+_0x266ff7+'.offset-cm_contacts.utcOffset\x20minute)',_0x8a7b('0x2b'),_0x8a7b('0x2c'),_0x5a82f6+'.'+_0x27b89c,_0x8a7b('0x2d'),'cm_contacts.updatedAt',_0x8a7b('0x2f'),_0x8a7b('0x30'),'\x22'+_0x18308f+'\x22'];var _0x2b54c9=squel[_0x8a7b('0x31')]()[_0x8a7b('0x32')]('cm_hopper')[_0x8a7b('0x34')]([_0x8a7b('0x13'),'scheduledat',_0x8a7b('0x36'),_0x8a7b('0x37'),_0x27b89c,_0x8a7b('0x38'),_0x8a7b('0x39'),_0x8a7b('0x3a'),'UserId','recallme'],squel[_0x8a7b('0x11')]()[_0x8a7b('0x43')](_0x94831a)[_0x8a7b('0x14')](_0x5a82f6)[_0x8a7b('0x15')]('cm_contacts',null,_0x8a7b('0x44')+_0x5a82f6+_0x8a7b('0x3c'))[_0x8a7b('0x15')](_0x2406f4,null,_0x2406f4+_0x8a7b('0x16')+_0x5a82f6+'.'+_0x27b89c)[_0x8a7b('0x15')](_0x266ff7,null,_0x266ff7+_0x8a7b('0x16')+_0x5a82f6+'.'+_0x27b89c)[_0x8a7b('0x17')](_0x5a82f6+_0x8a7b('0x3d'),_0x5e7b6a)[_0x8a7b('0x17')]('cm_contacts.createdAt\x20=\x20?',NOW)[_0x8a7b('0x17')]('cm_contacts.phone\x20NOT\x20IN\x20(?)',selectNotIn(_0x5a82f6,_0x2406f4,_0x27b89c,'cm_hopper',[_0x8a7b('0x3f'),_0x8a7b('0x40')]))[_0x8a7b('0x17')](_0x8a7b('0x3e'),selectNotIn(_0x5a82f6,_0x2406f4,_0x27b89c,_0x8a7b('0x33'),[_0x8a7b('0x3f')])))[_0x8a7b('0x41')]();return _0x2b54c9;}function insertTzCmHopperBlack(_0x3c336f,_0x3c0830,_0x4148ab,_0x372f97){var _0x2933d6=['cm_contacts.phone',_0x8a7b('0x2b'),'cm_contacts.ListId',_0x3c0830+'.'+_0x372f97,_0x8a7b('0x2d'),_0x8a7b('0x2e')];return squel[_0x8a7b('0x31')]()[_0x8a7b('0x32')](_0x8a7b('0x42'))['fromQuery'](['phone',_0x8a7b('0x36'),_0x8a7b('0x37'),_0x372f97,_0x8a7b('0x38'),_0x8a7b('0x39')],squel[_0x8a7b('0x11')]()[_0x8a7b('0x43')](_0x2933d6)['from'](_0x3c0830)[_0x8a7b('0x15')](_0x8a7b('0x3b'),null,_0x8a7b('0x44')+_0x3c0830+_0x8a7b('0x3c'))[_0x8a7b('0x15')](_0x4148ab,null,_0x4148ab+_0x8a7b('0x16')+_0x3c0830+'.'+_0x372f97)[_0x8a7b('0x17')](_0x3c0830+_0x8a7b('0x3d'),_0x3c336f)[_0x8a7b('0x17')](_0x8a7b('0x45'),NOW)[_0x8a7b('0x17')](_0x8a7b('0x3e'),squel[_0x8a7b('0x11')]()['field'](_0x8a7b('0x13'))[_0x8a7b('0x14')](_0x8a7b('0x42'))[_0x8a7b('0x17')](_0x8a7b('0x46'),_0x3c336f)[_0x8a7b('0x17')](_0x372f97+'\x20=\x20'+_0x3c0830+'.'+_0x372f97)))[_0x8a7b('0x41')]();}function insertCmHopperAdditionalPhones(_0x2e67c8){var _0x3befff=[_0x8a7b('0x47'),_0x8a7b('0x48'),'cm_contact_has_items.OrderBy',_0x8a7b('0x49'),_0x8a7b('0x4a')];return squel['insert']()[_0x8a7b('0x32')](_0x8a7b('0x4b'))[_0x8a7b('0x34')]([_0x8a7b('0x4c'),_0x8a7b('0x13'),_0x8a7b('0x4d'),_0x8a7b('0x38'),'updatedAt'],squel[_0x8a7b('0x11')]()[_0x8a7b('0x43')](_0x3befff)[_0x8a7b('0x14')](_0x8a7b('0x33'))[_0x8a7b('0x15')](_0x8a7b('0x3b'),null,'cm_contacts.id\x20=\x20cm_hopper.ContactId')[_0x8a7b('0x15')](_0x8a7b('0x4e'),null,'cm_contacts.id\x20=\x20cm_contact_has_items.CmContactId')[_0x8a7b('0x17')](_0x8a7b('0x4f'),_0x2e67c8)['where'](_0x8a7b('0x45'),NOW))[_0x8a7b('0x41')]();}function insertCmContact(_0x39ac35,_0x5e2c60,_0x3fafb8,_0x341005){var _0x30c866=_[_0x8a7b('0x50')](_[_0x8a7b('0x51')](_0x341005),['ListId',_0x8a7b('0x52'),_0x8a7b('0x38'),_0x8a7b('0x39'),_0x8a7b('0x53')]);return squel[_0x8a7b('0x31')]()[_0x8a7b('0x32')](_0x8a7b('0x3b'))[_0x8a7b('0x34')](_0x30c866,squel['select']()['fields'](_0x30c866)['from'](_0x5e2c60)[_0x8a7b('0x17')]('('+_0x3fafb8['join'](',')+_0x8a7b('0x54'),squel[_0x8a7b('0x11')]()[_0x8a7b('0x43')](_0x3fafb8)['from'](_0x8a7b('0x3b'))['where'](_0x8a7b('0x46'),_0x39ac35)[_0x8a7b('0x17')](_0x8a7b('0x55')))[_0x8a7b('0x17')](_0x8a7b('0x56'),squel[_0x8a7b('0x11')]()['field'](_0x8a7b('0x57'),'min_id')[_0x8a7b('0x14')](_0x5e2c60)[_0x8a7b('0x58')](_0x3fafb8[_0x8a7b('0x15')](','))))[_0x8a7b('0x41')]();}function handleStop(){logger[_0x8a7b('0x59')](_0x8a7b('0x5a'));stopped=!![];}function handleUncaughtException(_0x262a2b){logger[_0x8a7b('0x5b')](_0x262a2b[_0x8a7b('0x5c')]);process[_0x8a7b('0x5d')](0x1);}function handleError(_0x33d9e5,_0x2f78de){stats['errors'][_0x8a7b('0x1d')]({'name':_0x2f78de[_0x8a7b('0x5e')],'message':_0x2f78de[_0x8a7b('0x5c')],'row':_0x33d9e5});}function handleQuery(_0x457015){logger[_0x8a7b('0x59')](_0x457015);return db[_0x8a7b('0x5f')][_0x8a7b('0x60')](_0x457015)[_0x8a7b('0x61')](function(_0x51acd4){results[_0x8a7b('0x1d')](_0x51acd4);})[_0x8a7b('0x62')](function(_0x1fc63a){logger[_0x8a7b('0x5b')](_0x1fc63a[_0x8a7b('0x5c')]);});}function updateTzCampaigns(_0x358a0a){return new Promise(function(_0x2548ae,_0x231d51){var _0x1ce95b=squel[_0x8a7b('0x11')]()[_0x8a7b('0x43')]([_0x8a7b('0x63'),'campaigns.dialTimezone'])[_0x8a7b('0x14')](_0x8a7b('0x64'))[_0x8a7b('0x15')](_0x8a7b('0x65'),null,_0x8a7b('0x66'))[_0x8a7b('0x17')]('campaigns_has_cm_lists.CmListId='+_0x358a0a);db[_0x8a7b('0x5f')]['query'](_0x1ce95b[_0x8a7b('0x41')]())[_0x8a7b('0x61')](function(_0x3a9a76){var _0x370221=[];for(var _0x1f54b1=0x0;_0x1f54b1<_0x3a9a76[_0x8a7b('0x1c')];_0x1f54b1++){_0x370221[_0x8a7b('0x1d')](getTimezoneData(_0x3a9a76[_0x1f54b1],tmp_campaigns));}BPromise['all'](_0x370221)[_0x8a7b('0x1f')](function(){_0x2548ae({'val':0x1});});})['catch'](function(_0x5a5307){logger[_0x8a7b('0x5b')](_0x5a5307[_0x8a7b('0x5c')]);_0x2548ae({'val':0x0});});});}function updateTzVoiceQueues(_0x4cd3e7){return new Promise(function(_0x11cbee,_0x4b838e){var _0x1aa486=squel[_0x8a7b('0x11')]()[_0x8a7b('0x43')]([_0x8a7b('0x67'),_0x8a7b('0x68')])['from'](_0x8a7b('0x69'))[_0x8a7b('0x15')](_0x8a7b('0x6a'),null,_0x8a7b('0x6b'))['where']('voice_queues_has_cm_lists.CmListId='+_0x4cd3e7);db['sequelize'][_0x8a7b('0x60')](_0x1aa486['toString']())['spread'](function(_0x4efa76){var _0x124831=[];for(var _0x475523=0x0;_0x475523<_0x4efa76['length'];_0x475523++){_0x124831[_0x8a7b('0x1d')](getTimezoneData(_0x4efa76[_0x475523],tmp_voice_queues));}BPromise[_0x8a7b('0x1e')](_0x124831)[_0x8a7b('0x1f')](function(){_0x11cbee({'val':0x1});});})[_0x8a7b('0x62')](function(_0x17f014){logger[_0x8a7b('0x5b')](_0x17f014['message']);_0x11cbee({'val':0x0});});});}function getTimezoneData(_0x5d445f,_0x51cf6d){return new Promise(function(_0x50e4e2,_0x6cb54d){var _0x5620e7=shared[_0x8a7b('0x6c')];var _0x2323f0=_0x5620e7[_0x5d445f['dialTimezone']];if(_[_0x8a7b('0x21')](_0x2323f0)){_0x50e4e2({'ret':0x1});}else{var _0x65a13b=_0x2323f0[_0x8a7b('0x6d')];var _0x41f897=squel[_0x8a7b('0x31')]()[_0x8a7b('0x32')](_0x51cf6d)['set']('id',_0x5d445f['id'])[_0x8a7b('0x6e')](_0x8a7b('0x6f'),_0x65a13b)[_0x8a7b('0x6e')](_0x8a7b('0x70'),_0x5d445f['dialTimezone'])['toString']();return db[_0x8a7b('0x5f')][_0x8a7b('0x60')](_0x41f897)[_0x8a7b('0x61')](function(_0x980069){_0x50e4e2({'ret':0x1});})[_0x8a7b('0x62')](function(_0x4db216){logger[_0x8a7b('0x5b')](_0x4db216[_0x8a7b('0x5c')]);_0x6cb54d({'ret':0x1});});}});}function handleTZQuery(_0x385ac6){logger[_0x8a7b('0x59')](_0x385ac6);return db[_0x8a7b('0x5f')]['query'](_0x385ac6)[_0x8a7b('0x61')](function(_0x3329e3){})['catch'](function(_0x26e324){logger[_0x8a7b('0x5b')](_0x26e324[_0x8a7b('0x5c')]);});}function main(_0x15db57,_0x52b499,_0x363101,_0x4dd0b6){logger[_0x8a7b('0x59')]('main',_0x15db57,JSON[_0x8a7b('0x71')](_0x52b499));process['send']('start');var _0x5ebfdd=_0x52b499[_0x8a7b('0x72')];var _0x5ef744=_[_0x8a7b('0x73')](_0x5ebfdd);var _0x1b7713=_0x52b499['socket_timestamp'];var _0x358a1f=path[_0x8a7b('0x15')](config[_0x8a7b('0x74')],_0x8a7b('0x75'),_0x1b7713+_0x8a7b('0x76'));hasTZ=_['keys'](_0x5ebfdd)['includes']('dialTimezone');var _0x417ba2=_[_0x8a7b('0x51')](_0x5ebfdd)[_0x8a7b('0x15')]();logger[_0x8a7b('0x59')](_0x8a7b('0x77'),_0x417ba2);db[_0x8a7b('0x78')][_0x8a7b('0x79')]({'raw':!![],'attributes':['id',_0x8a7b('0x7a')]})[_0x8a7b('0x1f')](function(_0x485424){for(var _0xd59ff=0x0;_0xd59ff<_0x485424['length'];_0xd59ff++){if(_0x485424[_0xd59ff][_0x8a7b('0x7a')]in _0x5ebfdd){contactItemTypes[_0x8a7b('0x1d')](_0x485424[_0xd59ff]);delete _0x5ef744[_0x485424[_0xd59ff][_0x8a7b('0x7a')]];hasAdditionalPhones=!![];}for(var _0x59a6cb in _0x5ebfdd){if(_0x485424[_0xd59ff][_0x8a7b('0x7a')]+_0x8a7b('0x7b')===_0x59a6cb){phoneDescriptions['push']({'itemTypeId':_0x485424[_0xd59ff]['id'],'description':_0x59a6cb});delete _0x5ef744[_0x59a6cb];}}}if(hasAdditionalPhones)_0x5ef744['AdditionalPhones']='';var _0x52c26c=_[_0x8a7b('0x51')](_0x5ef744)[_0x8a7b('0x15')]();logger['info'](_0x8a7b('0x77'),_0x52c26c);fs[_0x8a7b('0x7c')](_0x358a1f,_0x52c26c+'\x0a');Papa[_0x8a7b('0x7d')](fs['createReadStream'](_0x15db57),{'header':!![],'skipEmptyLines':!![],'step':function(_0x3ab7fa,_0x325d80){try{for(var _0x3908a0=0x0,_0x35ac56=[];_0x3908a0<_0x3ab7fa[_0x8a7b('0x7e')][_0x8a7b('0x1c')];_0x3908a0++){stats[_0x8a7b('0x7f')]+=0x1;if(_0x3ab7fa[_0x8a7b('0x80')][_0x3908a0]){handleError(_0x3ab7fa[_0x8a7b('0x7e')][_0x3908a0],_0x3ab7fa['errors'][_0x3908a0]);}else{var _0x49128b=[];var _0x4d64ec=[];var _0x5eb947={};for(var _0x34dd50 in _0x5ebfdd){let _0x39e44c=contactItemTypes[_0x8a7b('0x81')](_0x4746e8=>_0x4746e8[_0x8a7b('0x7a')]===_0x34dd50);let _0x160782=contactItemTypes[_0x8a7b('0x81')](_0x35b845=>_0x35b845[_0x8a7b('0x7a')]+_0x8a7b('0x7b')===_0x34dd50);if(_[_0x8a7b('0x21')](_0x39e44c)&&_[_0x8a7b('0x21')](_0x160782)){if(_0x5ebfdd[_0x8a7b('0x82')](_0x34dd50)){if(_0x3ab7fa['data'][_0x3908a0][_0x5ebfdd[_0x34dd50]]){var _0x227cc9=_[_0x8a7b('0x83')](_0x3ab7fa['data'][_0x3908a0][_0x5ebfdd[_0x34dd50]][_0x8a7b('0x84')](/"/g,'\x27'));switch(_0x34dd50){case _0x8a7b('0x35'):var _0x32734d=moment(_0x227cc9,_0x8a7b('0x10'),!![]);if(_0x32734d[_0x8a7b('0x85')]()){_0x35ac56[_0x8a7b('0x1d')]('\x22'+_0x227cc9+'\x22');}else{_0x49128b[_0x8a7b('0x1d')](_0x8a7b('0x86'));}break;case _0x8a7b('0x3a'):var _0x3b6129=parseInt(_0x227cc9);_0x227cc9=_[_0x8a7b('0x87')](_0x3b6129)||_0x3b6129<0x0||_0x3b6129>0x4?_0x4dd0b6?0x3:0x2:_0x3b6129;_0x35ac56[_0x8a7b('0x1d')]('\x22'+_0x227cc9+'\x22');break;case _0x8a7b('0x88'):var _0x2bfed6=parseInt(_0x227cc9);if(_[_0x8a7b('0x89')](_0x2bfed6)&&_[_0x8a7b('0x8a')](_0x363101,_0x2bfed6)){_0x35ac56['push']('\x22'+_0x2bfed6+'\x22');}else{_0x49128b[_0x8a7b('0x1d')](_0x8a7b('0x8b'));}break;case'email':if(isEmail(_0x227cc9)){_0x35ac56[_0x8a7b('0x1d')]('\x22'+_0x227cc9+'\x22');}else{_0x49128b[_0x8a7b('0x1d')]('email\x20wrong\x20format');}break;case _0x8a7b('0x8c'):var _0x45c7f8=moment(_0x227cc9,_0x8a7b('0x8d'),!![]);if(_0x45c7f8[_0x8a7b('0x85')]()){_0x35ac56['push']('\x22'+_0x227cc9+'\x22');}else{_0x49128b['push'](_0x8a7b('0x8e'));}break;case _0x8a7b('0x70'):var _0x34b6f4=shared['timezones'];var _0xf656af=_0x34b6f4[_0x227cc9];if(!_[_0x8a7b('0x21')](_0xf656af)){var _0x4041df=_0xf656af['utcOffset'];_0x35ac56[_0x8a7b('0x1d')]('\x22'+_0x227cc9+'\x22');_0x35ac56[_0x8a7b('0x1d')]('\x22'+_0x4041df+'\x22');}break;default:_0x35ac56[_0x8a7b('0x1d')]('\x22'+_0x227cc9+'\x22');}}else{switch(_0x34dd50){case _0x8a7b('0x8f'):case _0x8a7b('0x13'):_0x49128b['push'](_0x34dd50+'\x20not\x20specified');break;default:_0x35ac56[_0x8a7b('0x1d')]('\x22\x22');}}}}else{var _0x26ce16='';if(!_['isNil'](_0x39e44c)){if(!_0x5eb947['hasOwnProperty'](_0x39e44c['id'])){if(!_[_0x8a7b('0x21')](_0x3ab7fa[_0x8a7b('0x7e')][_0x3908a0][_0x5ebfdd[_0x34dd50]])){var _0x227cc9=_[_0x8a7b('0x83')](_0x3ab7fa[_0x8a7b('0x7e')][_0x3908a0][_0x5ebfdd[_0x34dd50]][_0x8a7b('0x84')](/"/g,'\x27'));var _0x1381c0=phoneDescriptions[_0x8a7b('0x81')](_0x3f0ca9=>_0x3f0ca9[_0x8a7b('0x90')]===_0x39e44c['id']);if(!_[_0x8a7b('0x21')](_0x1381c0)){var _0xde303f=_['trim'](_0x3ab7fa['data'][_0x3908a0][_0x5ebfdd[_0x1381c0['description']]]['replace'](/"/g,'\x27'));if(!_[_0x8a7b('0x21')](_0xde303f))_0x227cc9=_0x227cc9+'§'+_0xde303f;}if(_0x26ce16=='')_0x26ce16=_0x227cc9;else _0x26ce16+='|'+_0x227cc9;}_0x4d64ec[_0x8a7b('0x1d')](_0x39e44c['id']+':'+_0x26ce16);_0x5eb947[_0x39e44c['id']]=0x1;}}}}if(hasAdditionalPhones){_0x35ac56['push']('\x22'+_0x4d64ec[_0x8a7b('0x15')](';')+'\x22');}if(_0x49128b[_0x8a7b('0x1c')]){handleError(_0x3ab7fa['data'][_0x3908a0],{'code':_0x8a7b('0x91'),'message':_0x49128b[_0x8a7b('0x15')]()});}else{fs[_0x8a7b('0x92')](_0x358a1f,_0x35ac56['join']()+'\x0a');}_0x35ac56=[];}if(!(stats[_0x8a7b('0x7f')]%0xc8)){socket[_0x8a7b('0x93')](_0x8a7b('0x94')+_0x1b7713,stats);stats[_0x8a7b('0x80')]=[];}}if(stopped){logger[_0x8a7b('0x59')]('Abort\x20parser');_0x325d80[_0x8a7b('0x95')]();}}catch(_0x59349d){handleError(_0x3ab7fa[_0x8a7b('0x7e')][_0x3908a0],{'code':_0x8a7b('0x96'),'message':_0x59349d[_0x8a7b('0x5c')]});logger[_0x8a7b('0x5b')](_0x8a7b('0x97'),_0x59349d['message']);}},'complete':function(){try{var _0x477246=[];var _0x46a6ef=[];var _0x474e5c='cm_contacts';if(_0x52b499[_0x8a7b('0x98')]&&_0x52b499[_0x8a7b('0x98')][_0x8a7b('0x1c')]){_0x474e5c=_0x8a7b('0x99')+_0x1b7713;_0x477246[_0x8a7b('0x1d')](_0x8a7b('0x9a')+_0x474e5c+'\x20LIKE\x20cm_contacts;');}tmp_campaigns=_0x8a7b('0x9b')+_0x1b7713;tmp_voice_queues=_0x8a7b('0x9c')+_0x1b7713;_0x46a6ef[_0x8a7b('0x1d')](_0x8a7b('0x9a')+tmp_campaigns+_0x8a7b('0x9d'));_0x46a6ef[_0x8a7b('0x1d')]('CREATE\x20TABLE\x20'+tmp_voice_queues+_0x8a7b('0x9d'));BPromise[_0x8a7b('0x9e')](_0x46a6ef,handleTZQuery)[_0x8a7b('0x1f')](function(_0x17ede3){updateTzCampaigns(_0x52b499[_0x8a7b('0x37')])[_0x8a7b('0x1f')](function(_0x1716ef){updateTzVoiceQueues(_0x52b499['ListId'])[_0x8a7b('0x1f')](function(_0x5081fb){if(hasTZ)_0x52c26c=_0x52c26c['replace'](_0x8a7b('0x70'),_0x8a7b('0x9f'));var _0x1ac92a=util[_0x8a7b('0xf')](_0x8a7b('0xa0'),_0x358a1f,_0x474e5c,_0x52c26c,_0x52b499[_0x8a7b('0x37')],_0x52b499[_0x8a7b('0x52')]||null,NOW,NOW);if(_['isNil'](_0x5ebfdd[_0x8a7b('0x35')])){_0x1ac92a+=_0x8a7b('0xa1');}_0x477246[_0x8a7b('0x1d')](_0x1ac92a);if(_0x52b499[_0x8a7b('0x98')]&&_0x52b499['duplicates'][_0x8a7b('0x1c')]){_0x477246[_0x8a7b('0x1d')](insertCmContact(_0x52b499['ListId'],_0x474e5c,_0x52b499[_0x8a7b('0x98')],_0x5ebfdd));_0x477246[_0x8a7b('0x1d')](_0x8a7b('0xa2')+_0x474e5c+';');}BPromise[_0x8a7b('0x9e')](_0x477246,handleQuery)['then'](function(_0x34a2bc){BPromise[_0x8a7b('0x1e')]([handleAdditionalPhones()])[_0x8a7b('0x1f')](function(){_0x477246=[];for(var _0x20bbbb=0x0;_0x20bbbb_0x2e9bc6[_0x5d11('0x62')]===_0x5e9548);let _0x67e9c9=contactItemTypes['find'](_0x296a0c=>_0x296a0c[_0x5d11('0x62')]+'_description'===_0x5e9548);if(_['isNil'](_0xd59ac8)&&_['isNil'](_0x67e9c9)){if(_0x145a22['hasOwnProperty'](_0x5e9548)){if(_0x511ab7['data'][_0x4d9e2a][_0x145a22[_0x5e9548]]){var _0x19c68f=_[_0x5d11('0x69')](_0x511ab7['data'][_0x4d9e2a][_0x145a22[_0x5e9548]][_0x5d11('0x6a')](/"/g,'\x27'));switch(_0x5e9548){case _0x5d11('0x32'):var _0x130ce7=moment(_0x19c68f,_0x5d11('0xb'),!![]);if(_0x130ce7[_0x5d11('0x6b')]()){_0x29e01d[_0x5d11('0x1a')]('\x22'+_0x19c68f+'\x22');}else{_0x333327[_0x5d11('0x1a')]('scheduledat\x20wrong\x20format\x20(YYYY-MM-DD\x20HH:mm:ss)');}break;case'priority':var _0x16a5c3=parseInt(_0x19c68f);_0x19c68f=_['isNaN'](_0x16a5c3)||_0x16a5c3<0x0||_0x16a5c3>0x4?_0x274280?0x3:0x2:_0x16a5c3;_0x29e01d[_0x5d11('0x1a')]('\x22'+_0x19c68f+'\x22');break;case _0x5d11('0x6c'):var _0x20a363=parseInt(_0x19c68f);if(_[_0x5d11('0x6d')](_0x20a363)&&_[_0x5d11('0x6e')](_0x19f83f,_0x20a363)){_0x29e01d['push']('\x22'+_0x20a363+'\x22');}else{_0x333327[_0x5d11('0x1a')]('agent\x20not\x20exists');}break;case _0x5d11('0x6f'):if(isEmail(_0x19c68f)){_0x29e01d[_0x5d11('0x1a')]('\x22'+_0x19c68f+'\x22');}else{_0x333327['push'](_0x5d11('0x70'));}break;case _0x5d11('0x71'):var _0x29d81a=moment(_0x19c68f,_0x5d11('0x72'),!![]);if(_0x29d81a[_0x5d11('0x6b')]()){_0x29e01d[_0x5d11('0x1a')]('\x22'+_0x19c68f+'\x22');}else{_0x333327[_0x5d11('0x1a')]('dateOfBirth\x20wrong\x20format\x20(YYYY-MM-DD)');}break;default:_0x29e01d[_0x5d11('0x1a')]('\x22'+_0x19c68f+'\x22');}}else{switch(_0x5e9548){case _0x5d11('0x73'):case'phone':_0x333327['push'](_0x5e9548+_0x5d11('0x74'));break;default:_0x29e01d[_0x5d11('0x1a')]('\x22\x22');}}}}else{var _0xcc463f='';if(!_[_0x5d11('0x19')](_0xd59ac8)){if(!_0x151807['hasOwnProperty'](_0xd59ac8['id'])){for(var _0x1b8a85=0x0;_0x1b8a85<_0x145a22[_0x5e9548][_0x5d11('0x17')];_0x1b8a85++){var _0x19c68f=_[_0x5d11('0x69')](_0x511ab7[_0x5d11('0x67')][_0x4d9e2a][_0x145a22[_0x5e9548][_0x1b8a85]]['replace'](/"/g,'\x27'));var _0x48272c=phoneDescriptions[_0x5d11('0x68')](_0x28ac3a=>_0x28ac3a[_0x5d11('0x75')]===_0xd59ac8['id']);if(!_['isNil'](_0x48272c)){var _0x53e9f7=_[_0x5d11('0x69')](_0x511ab7[_0x5d11('0x67')][_0x4d9e2a][_0x145a22[_0x48272c[_0x5d11('0x76')]][0x0]][_0x5d11('0x6a')](/"/g,'\x27'));if(!_[_0x5d11('0x19')](_0x53e9f7))_0x19c68f=_0x19c68f+'§'+_0x53e9f7;}if(_0xcc463f=='')_0xcc463f=_0x19c68f;else _0xcc463f+='|'+_0x19c68f;}_0x5f3af2[_0x5d11('0x1a')](_0xd59ac8['id']+':'+_0xcc463f);_0x151807[_0xd59ac8['id']]=0x1;}}}}if(hasAdditionalPhones){_0x29e01d[_0x5d11('0x1a')]('\x22'+_0x5f3af2[_0x5d11('0x10')](';')+'\x22');}if(_0x333327[_0x5d11('0x17')]){handleError(_0x511ab7[_0x5d11('0x67')][_0x4d9e2a],{'code':_0x5d11('0x77'),'message':_0x333327[_0x5d11('0x10')]()});}else{fs[_0x5d11('0x78')](_0x5d5e9d,_0x29e01d[_0x5d11('0x10')]()+'\x0a');}_0x29e01d=[];}if(!(stats['rows']%0xc8)){socket[_0x5d11('0x79')](_0x5d11('0x7a')+_0x506d30,stats);stats[_0x5d11('0x5b')]=[];}}if(stopped){logger[_0x5d11('0x57')](_0x5d11('0x7b'));_0x2b0a65[_0x5d11('0x7c')]();}}catch(_0x3d1012){handleError(_0x511ab7[_0x5d11('0x67')][_0x4d9e2a],{'code':'SystemError','message':_0x3d1012['message']});logger['error'](_0x5d11('0x7d'),_0x3d1012[_0x5d11('0x59')]);}},'complete':function(){try{var _0x373b12=[];var _0x182ee1=tempTableName;_0x373b12['push'](_0x5d11('0x7e')+_0x182ee1+_0x5d11('0x7f'));logger['info'](_0x5d11('0x80'),contactItemTypes[_0x5d11('0x17')]);var _0x147c5f=util[_0x5d11('0xa')](_0x5d11('0x81'),_0x5d5e9d,_0x182ee1,_0x19e108,_0x101fec['ListId'],_0x101fec[_0x5d11('0x82')]||null,NOW,NOW);if(_[_0x5d11('0x19')](_0x145a22['scheduledat'])){_0x147c5f+=_0x5d11('0x83');}_0x373b12[_0x5d11('0x1a')](_0x147c5f);BPromise['each'](_0x373b12,handleQuery)[_0x5d11('0x20')](function(_0x560118){BPromise['all']([handleAdditionalPhones()])[_0x5d11('0x20')](function(){_0x373b12=[];for(var _0x12581e=0x0;_0x12581e\x20\x20');}var _0x1078d6=path[_0x5d11('0x10')](config[_0x5d11('0x8b')],_0x5d11('0x60'),process['argv'][0x2]);if(!fs[_0x5d11('0x8c')](_0x1078d6)){throw new Error(_0x5d11('0x8d'));}var _0x2cd08e={};try{_0x2cd08e=JSON[_0x5d11('0x64')](process[_0x5d11('0x8a')][0x3]);if(!_0x2cd08e['binding']){throw new Error(_0x5d11('0x8e'));}var _0x16a6d3=0x0;if(_0x2cd08e[_0x5d11('0x8f')][_0x5d11('0x6c')]){_0x16a6d3=0x1;}if(!_0x2cd08e['ListId']){throw new Error(_0x5d11('0x90'));}}catch(_0x521770){throw new Error(_0x5d11('0x91'));}var _0x25e476=[];try{_0x25e476=_[_0x5d11('0x92')](JSON[_0x5d11('0x64')](process['argv'][0x4]),'id');}catch(_0x3edbde){logger[_0x5d11('0x57')](_0x5d11('0x93'));}main(_0x1078d6,_0x2cd08e,_0x25e476,_0x16a6d3);}validate();process['on'](_0x5d11('0x94'),handleStop);process['on']('uncaughtException',handleUncaughtException); \ No newline at end of file +var _0x91ab=['then','filter','CmContactHasItem','findOne','update','create','PHONE','inserted','cm_contacts.phone','cm_contacts.scheduledat','cm_contacts.id','cm_contacts.ListId','cm_contacts.updatedAt','cm_contacts.priority','into','cm_hopper','scheduledat','ContactId','ListId','createdAt','updatedAt','UserId','fields','from','cm_contacts.ListId\x20=\x20','.CmListId','.CmListId\x20=\x20?','cm_contacts.createdAt\x20=\x20?','cm_contacts.phone\x20NOT\x20IN\x20(?)','\x22always\x22','\x22onlyIfOpen\x22','toString','cm_contacts.createdAt','cm_hopper_black','\x20=\x20?','cm_hopper.id','cm_contact_has_items.item','cm_contact_has_items.OrderBy','cm_contact_has_items.createdAt','cm_contact_has_items.updatedAt','insert','cm_hopper_additional_phones','CmHopperId','cm_contacts','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?','CompanyId',')\x20NOT\x20IN\x20?','id\x20IN\x20?','MIN(id)','min_id','group','info','Received\x20SIGINT','exit','errors','code','sequelize','stringify','send','start','binding','clone','socket_timestamp','root','.csv','body','ContactItemType','name','_description','keys','header','writeFileSync','parse','createReadStream','data','rows','find','hasOwnProperty','trim','replace','scheduledat\x20wrong\x20format\x20(YYYY-MM-DD\x20HH:mm:ss)','priority','isNaN','isNumber','includes','agent\x20not\x20exists','email','email\x20wrong\x20format','dateOfBirth','YYYY-MM-DD','isValid','dateOfBirth\x20wrong\x20format\x20(YYYY-MM-DD)','\x20not\x20specified','itemTypeId','description','SystemRow','appendFileSync','emit','contact:import:','abort','SystemError','step','CIS\x20len','LOAD\x20DATA\x20LOCAL\x20INFILE\x20\x27%s\x27\x20INTO\x20TABLE\x20%s\x20CHARACTER\x20SET\x20UTF8\x20FIELDS\x20TERMINATED\x20BY\x20\x27,\x27\x20ENCLOSED\x20BY\x20\x27\x22\x27\x20LINES\x20TERMINATED\x20BY\x20\x27\x0a\x27\x20IGNORE\x201\x20ROWS\x20(%s)\x20SET\x20ListId\x20=\x20%s,\x20CompanyId\x20=\x20%s,\x20createdAt\x20=\x20\x27%s\x27,\x20updatedAt\x20=\x20\x27%s\x27','each','contact','contactId','contactTypeId','orderBy','affectedRows','unlink','complete','argv','arguments\x20\x20\x20','server/files/tmp','existsSync','ListId\x20is\x20mandatory','map','No\x20agent\x20available','uncaughtException','lodash','util','bluebird','moment','squel','../../../config/environment','import','redis','socket.io-emitter','format','YYYY-MM-DD\x20HH:mm:ss','cm_contacts_temp_','YYYYMMDDHHmmss','test','select','field','phone','join','.id\x20=\x20','where','\x20=\x20','.dialCheckDuplicateType\x20IN\x20(','query','select\x20*\x20from\x20','spread','length','isNil','AdditionalPhones','push','all','catch','error','message','split'];(function(_0x321bb2,_0x202794){var _0x9c12ed=function(_0x263dd3){while(--_0x263dd3){_0x321bb2['push'](_0x321bb2['shift']());}};_0x9c12ed(++_0x202794);}(_0x91ab,0x7b));var _0xb91a=function(_0x2f1762,_0xab43df){_0x2f1762=_0x2f1762-0x0;var _0x8ab21=_0x91ab[_0x2f1762];return _0x8ab21;};'use strict';var fs=require('fs');var path=require('path');var _=require(_0xb91a('0x0'));var Papa=require('papaparse');var util=require(_0xb91a('0x1'));var BPromise=require(_0xb91a('0x2'));var moment=require(_0xb91a('0x3'));var squel=require(_0xb91a('0x4'));var Redis=require('ioredis');var db=require('../../../mysqldb')['db'];var config=require(_0xb91a('0x5'));var logger=require('../../../config/logger')(_0xb91a('0x6'));config['redis']=_['defaults'](config[_0xb91a('0x7')],{'host':'localhost','port':0x18eb});var socket=require(_0xb91a('0x8'))(new Redis(config['redis']));var stats={'finish':![],'errors':[],'rows':0x0,'affectedRows':0x0};var results=[];var promisesAdditionalPhones=[];var promisesContact=[];var orderBy=0x0;var updatedRows=0x0;var stopped=![];var NOW=moment()[_0xb91a('0x9')](_0xb91a('0xa'));var tempTableName=_0xb91a('0xb')+moment()['format'](_0xb91a('0xc'));var contactItemTypes=[];var phoneDescriptions=[];var hasAdditionalPhones=![];function isEmail(_0x362b43){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))*$/[_0xb91a('0xd')](_0x362b43);}function selectNotIn(_0x2146d2,_0x3828b8,_0x5cce82,_0x1e0fbf,_0x527a5d){return squel[_0xb91a('0xe')]()[_0xb91a('0xf')](_0xb91a('0x10'))['from'](_0x1e0fbf)[_0xb91a('0x11')](_0x3828b8,null,_0x3828b8+_0xb91a('0x12')+_0x1e0fbf+'.'+_0x5cce82)[_0xb91a('0x13')](_0x1e0fbf+'.'+_0x5cce82+_0xb91a('0x14')+_0x2146d2+'.'+_0x5cce82)[_0xb91a('0x13')](_0x3828b8+_0xb91a('0x15')+_0x527a5d[_0xb91a('0x11')]()+')');}function handleAdditionalPhones(){return new Promise(function(_0x108713,_0x535c21){promisesAdditionalPhones=[];promisesContact=[];return db['sequelize'][_0xb91a('0x16')](_0xb91a('0x17')+tempTableName)[_0xb91a('0x18')](function(_0x3b154c){if(_0x3b154c!==null){var _0x1a10a2=[];for(var _0x56cc19=0x0;_0x56cc19<_0x3b154c[_0xb91a('0x19')];_0x56cc19++){var _0xc8fa46=_0x3b154c[_0x56cc19];if(!_[_0xb91a('0x1a')](_0xc8fa46['phone'])){if(!_[_0xb91a('0x1a')](_0xc8fa46[_0xb91a('0x1b')]))_0x1a10a2[_0xb91a('0x1c')](insertAdditionalPhones(_0xc8fa46));promisesContact[_0xb91a('0x1c')]({'contact':_0xc8fa46});}}}Promise[_0xb91a('0x1d')](_0x1a10a2)['then'](function(){_0x108713({'val':0x1});});})[_0xb91a('0x1e')](function(_0x1921b8){logger[_0xb91a('0x1f')](_0x1921b8[_0xb91a('0x20')]);});});}function insertAdditionalPhones(_0x521234){return new Promise(function(_0x5e62b6,_0x31e5a8){var _0x2beb77=_0x521234[_0xb91a('0x1b')];if(_['isNil'](_0x2beb77))_0x31e5a8({'val':0x0});else{var _0x1f4ab3=_0x2beb77[_0xb91a('0x21')](';');var _0x9cca7e=[];orderBy=0x0;for(var _0x42b565=0x0;_0x42b565<_0x1f4ab3[_0xb91a('0x19')];_0x42b565++){_0x9cca7e[_0xb91a('0x1c')](splitAdditionalPhone(_0x521234['id'],_0x1f4ab3[_0x42b565]));}Promise[_0xb91a('0x1d')](_0x9cca7e)[_0xb91a('0x22')](function(){_0x5e62b6({'val':_0x1f4ab3[_0xb91a('0x19')]});});}});}function splitAdditionalPhone(_0x2a4a8b,_0x78d92b){return new Promise(function(_0x52fd67,_0x1e001a){var _0x4b65ef=_0x78d92b[_0xb91a('0x21')](':');var _0x40175c=_0x4b65ef[0x0];var _0x3520af=_0x4b65ef[0x1];if(_0x3520af!==''){var _0x3ef361=_0x3520af[_0xb91a('0x21')]('|');var _0x9c7753=[];for(var _0x437d2=0x0;_0x437d2<_0x3ef361[_0xb91a('0x19')];_0x437d2++){if(_0x3ef361[_0x437d2]!==''){var _0x374a4b=_[_0xb91a('0x23')](promisesAdditionalPhones,{'contactId':_0x2a4a8b,'phone':_0x3ef361[_0x437d2]});if(_0x374a4b[_0xb91a('0x19')]==0x0){orderBy++;promisesAdditionalPhones[_0xb91a('0x1c')]({'contactId':_0x2a4a8b,'contactTypeId':_0x40175c,'phone':_0x3ef361[_0x437d2],'orderBy':orderBy});}}}_0x52fd67({'ok':0x1});}else _0x52fd67({'res':0x0});});}function createAdditionalPhone(_0x3be1f5,_0x469384,_0x2570ac,_0x286e3d){var _0x975134='';var _0x1d4f85='';var _0x2f60ca=_0x2570ac[_0xb91a('0x21')]('§');_0x975134=_0x2f60ca[0x0];if(_0x2f60ca[_0xb91a('0x19')]==0x2)_0x1d4f85=_0x2f60ca[0x1];return new Promise(function(_0x5c7400,_0x31682c){return db[_0xb91a('0x24')][_0xb91a('0x25')]({'where':{'CmContactId':_0x3be1f5,'item':_0x975134}})['then'](function(_0x1bcaa9){if(_0x1bcaa9){return db[_0xb91a('0x24')][_0xb91a('0x26')]({'ItemTypeId':_0x469384,'description':_0x1d4f85,'OrderBy':_0x286e3d},{'where':{'CmContactId':_0x3be1f5,'item':_0x975134}})[_0xb91a('0x22')](function(_0x2c8e15){_0x5c7400({'res':'updated'});});}else{return db['CmContactHasItem'][_0xb91a('0x27')]({'CmContactId':_0x3be1f5,'item':_0x975134,'ItemTypeId':_0x469384,'description':_0x1d4f85,'OrderBy':_0x286e3d,'ItemClass':_0xb91a('0x28')})[_0xb91a('0x22')](function(_0x56b401){_0x5c7400({'res':_0xb91a('0x29')});});}});});}function updateContact(_0x1b40cf){return new Promise(function(_0x5d905c,_0x10029b){var _0x25649d=_0x1b40cf['id'];delete _0x1b40cf['id'];return db['CmContact']['update'](_0x1b40cf,{'where':{'id':_0x25649d}})[_0xb91a('0x22')](function(_0x13b409){updatedRows+=0x1;return db['CmHopper'][_0xb91a('0x26')]({'phone':_0x1b40cf[_0xb91a('0x10')]},{'where':{'ContactId':_0x25649d}})['then'](function(_0x5e99){_0x5d905c({'ret':'OK'});});});});}function insertCmHopper(_0x35f2e8,_0x169b35,_0x582006,_0x4e02ae,_0x6d21ba){var _0x3423be=[_0xb91a('0x2a'),_0xb91a('0x2b'),_0xb91a('0x2c'),_0xb91a('0x2d'),_0x169b35+'.'+_0x4e02ae,'cm_contacts.createdAt',_0xb91a('0x2e'),_0xb91a('0x2f'),'cm_contacts.UserId','\x22'+_0x6d21ba+'\x22'];return squel['insert']()[_0xb91a('0x30')](_0xb91a('0x31'))['fromQuery']([_0xb91a('0x10'),_0xb91a('0x32'),_0xb91a('0x33'),_0xb91a('0x34'),_0x4e02ae,_0xb91a('0x35'),_0xb91a('0x36'),'priority',_0xb91a('0x37'),'recallme'],squel[_0xb91a('0xe')]()[_0xb91a('0x38')](_0x3423be)[_0xb91a('0x39')](_0x169b35)[_0xb91a('0x11')]('cm_contacts',null,_0xb91a('0x3a')+_0x169b35+_0xb91a('0x3b'))[_0xb91a('0x11')](_0x582006,null,_0x582006+'.id\x20=\x20'+_0x169b35+'.'+_0x4e02ae)[_0xb91a('0x13')](_0x169b35+_0xb91a('0x3c'),_0x35f2e8)[_0xb91a('0x13')](_0xb91a('0x3d'),NOW)[_0xb91a('0x13')](_0xb91a('0x3e'),selectNotIn(_0x169b35,_0x582006,_0x4e02ae,_0xb91a('0x31'),[_0xb91a('0x3f'),_0xb91a('0x40')]))[_0xb91a('0x13')](_0xb91a('0x3e'),selectNotIn(_0x169b35,_0x582006,_0x4e02ae,_0xb91a('0x31'),['\x22always\x22'])))[_0xb91a('0x41')]();}function insertCmHopperBlack(_0x2739ef,_0x490345,_0x4a9499,_0x576207){var _0x3f0228=[_0xb91a('0x2a'),_0xb91a('0x2c'),'cm_contacts.ListId',_0x490345+'.'+_0x576207,_0xb91a('0x42'),_0xb91a('0x2e')];return squel['insert']()[_0xb91a('0x30')]('cm_hopper_black')['fromQuery']([_0xb91a('0x10'),_0xb91a('0x33'),_0xb91a('0x34'),_0x576207,'createdAt',_0xb91a('0x36')],squel[_0xb91a('0xe')]()[_0xb91a('0x38')](_0x3f0228)['from'](_0x490345)[_0xb91a('0x11')]('cm_contacts',null,_0xb91a('0x3a')+_0x490345+_0xb91a('0x3b'))[_0xb91a('0x11')](_0x4a9499,null,_0x4a9499+_0xb91a('0x12')+_0x490345+'.'+_0x576207)[_0xb91a('0x13')](_0x490345+'.CmListId\x20=\x20?',_0x2739ef)[_0xb91a('0x13')](_0xb91a('0x3d'),NOW)[_0xb91a('0x13')](_0xb91a('0x3e'),squel[_0xb91a('0xe')]()[_0xb91a('0xf')]('phone')['from'](_0xb91a('0x43'))[_0xb91a('0x13')]('ListId\x20=\x20?',_0x2739ef)[_0xb91a('0x13')](_0x576207+_0xb91a('0x44'),_0x490345+'.'+_0x576207)))[_0xb91a('0x41')]();}function insertCmHopperAdditionalPhones(_0x34cc6a){var _0x380339=[_0xb91a('0x45'),_0xb91a('0x46'),_0xb91a('0x47'),_0xb91a('0x48'),_0xb91a('0x49')];return squel[_0xb91a('0x4a')]()[_0xb91a('0x30')](_0xb91a('0x4b'))['fromQuery']([_0xb91a('0x4c'),_0xb91a('0x10'),'OrderBy','createdAt',_0xb91a('0x36')],squel['select']()[_0xb91a('0x38')](_0x380339)[_0xb91a('0x39')](_0xb91a('0x31'))[_0xb91a('0x11')](_0xb91a('0x4d'),null,_0xb91a('0x4e'))[_0xb91a('0x11')](_0xb91a('0x4f'),null,_0xb91a('0x50'))[_0xb91a('0x13')](_0xb91a('0x51'),_0x34cc6a)[_0xb91a('0x13')](_0xb91a('0x3d'),NOW))[_0xb91a('0x41')]();}function insertCmContact(_0x93fd8d,_0x39422b,_0x29d89c,_0x749be6){var _0x15f58a=_['concat'](_['keys'](_0x749be6),[_0xb91a('0x34'),_0xb91a('0x52'),_0xb91a('0x35'),_0xb91a('0x36')]);return squel[_0xb91a('0x4a')]()[_0xb91a('0x30')](_0xb91a('0x4d'))['fromQuery'](_0x15f58a,squel['select']()[_0xb91a('0x38')](_0x15f58a)[_0xb91a('0x39')](_0x39422b)[_0xb91a('0x13')]('('+_0x29d89c[_0xb91a('0x11')](',')+_0xb91a('0x53'),squel[_0xb91a('0xe')]()[_0xb91a('0x38')](_0x29d89c)[_0xb91a('0x39')](_0xb91a('0x4d'))[_0xb91a('0x13')]('ListId\x20=\x20?',_0x93fd8d))[_0xb91a('0x13')](_0xb91a('0x54'),squel[_0xb91a('0xe')]()['field'](_0xb91a('0x55'),_0xb91a('0x56'))[_0xb91a('0x39')](_0x39422b)[_0xb91a('0x57')](_0x29d89c['join'](','))))[_0xb91a('0x41')]();}function handleStop(){logger[_0xb91a('0x58')](_0xb91a('0x59'));stopped=!![];}function handleUncaughtException(_0x5cf2b8){logger['error'](_0x5cf2b8[_0xb91a('0x20')]);process[_0xb91a('0x5a')](0x1);}function handleError(_0x5f2799,_0x2b658c){stats[_0xb91a('0x5b')][_0xb91a('0x1c')]({'name':_0x2b658c[_0xb91a('0x5c')],'message':_0x2b658c[_0xb91a('0x20')],'row':_0x5f2799});}function handleQuery(_0x58da6d){logger[_0xb91a('0x58')](_0x58da6d);return db[_0xb91a('0x5d')]['query'](_0x58da6d)['spread'](function(_0x58f07a){results['push'](_0x58f07a);})[_0xb91a('0x1e')](function(_0x4eaf3c){logger[_0xb91a('0x1f')](_0x4eaf3c['message']);});}function main(_0x7255f1,_0x1ddb42,_0x278d36,_0x5c36bf){logger['info']('main',_0x7255f1,JSON[_0xb91a('0x5e')](_0x1ddb42));process[_0xb91a('0x5f')](_0xb91a('0x60'));var _0x34fd21=_0x1ddb42[_0xb91a('0x61')];var _0xbe3f9=_[_0xb91a('0x62')](_0x34fd21);var _0x368472=_0x1ddb42[_0xb91a('0x63')];var _0xc6547f=path[_0xb91a('0x11')](config[_0xb91a('0x64')],'server/files/tmp',_0x368472+_0xb91a('0x65'));logger[_0xb91a('0x58')](_0xb91a('0x66'),_0x1ddb42);db[_0xb91a('0x67')]['findAll']({'raw':!![],'attributes':['id',_0xb91a('0x68')]})[_0xb91a('0x22')](function(_0x141eab){for(var _0x4db1be=0x0;_0x4db1be<_0x141eab[_0xb91a('0x19')];_0x4db1be++){if(_0x141eab[_0x4db1be][_0xb91a('0x68')]in _0x34fd21){contactItemTypes[_0xb91a('0x1c')](_0x141eab[_0x4db1be]);delete _0xbe3f9[_0x141eab[_0x4db1be][_0xb91a('0x68')]];hasAdditionalPhones=!![];}for(var _0x152d32 in _0x34fd21){if(_0x141eab[_0x4db1be][_0xb91a('0x68')]+_0xb91a('0x69')===_0x152d32){phoneDescriptions['push']({'itemTypeId':_0x141eab[_0x4db1be]['id'],'description':_0x152d32});delete _0xbe3f9[_0x152d32];}}}if(hasAdditionalPhones)_0xbe3f9[_0xb91a('0x1b')]='';var _0x4dbaf3=_[_0xb91a('0x6a')](_0xbe3f9)['join']();logger['info'](_0xb91a('0x6b'),_0x4dbaf3);fs[_0xb91a('0x6c')](_0xc6547f,_0x4dbaf3+'\x0a');Papa[_0xb91a('0x6d')](fs[_0xb91a('0x6e')](_0x7255f1),{'header':!![],'skipEmptyLines':!![],'step':function(_0x3b0b9e,_0x467939){try{for(var _0x41f815=0x0,_0x74135e=[];_0x41f815<_0x3b0b9e[_0xb91a('0x6f')][_0xb91a('0x19')];_0x41f815++){stats[_0xb91a('0x70')]+=0x1;if(_0x3b0b9e[_0xb91a('0x5b')][_0x41f815]){handleError(_0x3b0b9e[_0xb91a('0x6f')][_0x41f815],_0x3b0b9e[_0xb91a('0x5b')][_0x41f815]);}else{var _0x8f455d=[];var _0x1079b8=[];var _0x11626b={};for(var _0x2651d5 in _0x34fd21){let _0x387ed5=contactItemTypes[_0xb91a('0x71')](_0x15c10e=>_0x15c10e[_0xb91a('0x68')]===_0x2651d5);let _0x41ff5e=contactItemTypes[_0xb91a('0x71')](_0x316b35=>_0x316b35[_0xb91a('0x68')]+'_description'===_0x2651d5);if(_['isNil'](_0x387ed5)&&_[_0xb91a('0x1a')](_0x41ff5e)){if(_0x34fd21[_0xb91a('0x72')](_0x2651d5)){if(_0x3b0b9e['data'][_0x41f815][_0x34fd21[_0x2651d5]]){var _0x3ef762=_[_0xb91a('0x73')](_0x3b0b9e['data'][_0x41f815][_0x34fd21[_0x2651d5]][_0xb91a('0x74')](/"/g,'\x27'));switch(_0x2651d5){case'scheduledat':var _0x4bd410=moment(_0x3ef762,_0xb91a('0xa'),!![]);if(_0x4bd410['isValid']()){_0x74135e[_0xb91a('0x1c')]('\x22'+_0x3ef762+'\x22');}else{_0x8f455d[_0xb91a('0x1c')](_0xb91a('0x75'));}break;case _0xb91a('0x76'):var _0x58b859=parseInt(_0x3ef762);_0x3ef762=_[_0xb91a('0x77')](_0x58b859)||_0x58b859<0x0||_0x58b859>0x4?_0x5c36bf?0x3:0x2:_0x58b859;_0x74135e[_0xb91a('0x1c')]('\x22'+_0x3ef762+'\x22');break;case'UserId':var _0x1131e9=parseInt(_0x3ef762);if(_[_0xb91a('0x78')](_0x1131e9)&&_[_0xb91a('0x79')](_0x278d36,_0x1131e9)){_0x74135e[_0xb91a('0x1c')]('\x22'+_0x1131e9+'\x22');}else{_0x8f455d[_0xb91a('0x1c')](_0xb91a('0x7a'));}break;case _0xb91a('0x7b'):if(isEmail(_0x3ef762)){_0x74135e[_0xb91a('0x1c')]('\x22'+_0x3ef762+'\x22');}else{_0x8f455d[_0xb91a('0x1c')](_0xb91a('0x7c'));}break;case _0xb91a('0x7d'):var _0x497811=moment(_0x3ef762,_0xb91a('0x7e'),!![]);if(_0x497811[_0xb91a('0x7f')]()){_0x74135e[_0xb91a('0x1c')]('\x22'+_0x3ef762+'\x22');}else{_0x8f455d[_0xb91a('0x1c')](_0xb91a('0x80'));}break;default:_0x74135e[_0xb91a('0x1c')]('\x22'+_0x3ef762+'\x22');}}else{switch(_0x2651d5){case'firstName':case _0xb91a('0x10'):_0x8f455d['push'](_0x2651d5+_0xb91a('0x81'));break;default:_0x74135e[_0xb91a('0x1c')]('\x22\x22');}}}}else{var _0x2a4544='';if(!_[_0xb91a('0x1a')](_0x387ed5)){if(!_0x11626b[_0xb91a('0x72')](_0x387ed5['id'])){for(var _0x1b4cd8=0x0;_0x1b4cd8<_0x34fd21[_0x2651d5][_0xb91a('0x19')];_0x1b4cd8++){var _0x3ef762=_['trim'](_0x3b0b9e['data'][_0x41f815][_0x34fd21[_0x2651d5][_0x1b4cd8]]['replace'](/"/g,'\x27'));var _0x1ddc58=phoneDescriptions[_0xb91a('0x71')](_0x396013=>_0x396013[_0xb91a('0x82')]===_0x387ed5['id']);if(!_[_0xb91a('0x1a')](_0x1ddc58)){var _0x176c8f=_[_0xb91a('0x73')](_0x3b0b9e['data'][_0x41f815][_0x34fd21[_0x1ddc58[_0xb91a('0x83')]][0x0]][_0xb91a('0x74')](/"/g,'\x27'));if(!_['isNil'](_0x176c8f))_0x3ef762=_0x3ef762+'§'+_0x176c8f;}if(_0x2a4544=='')_0x2a4544=_0x3ef762;else _0x2a4544+='|'+_0x3ef762;}_0x1079b8['push'](_0x387ed5['id']+':'+_0x2a4544);_0x11626b[_0x387ed5['id']]=0x1;}}}}if(hasAdditionalPhones){_0x74135e[_0xb91a('0x1c')]('\x22'+_0x1079b8[_0xb91a('0x11')](';')+'\x22');}if(_0x8f455d[_0xb91a('0x19')]){handleError(_0x3b0b9e[_0xb91a('0x6f')][_0x41f815],{'code':_0xb91a('0x84'),'message':_0x8f455d[_0xb91a('0x11')]()});}else{fs[_0xb91a('0x85')](_0xc6547f,_0x74135e[_0xb91a('0x11')]()+'\x0a');}_0x74135e=[];}if(!(stats[_0xb91a('0x70')]%0xc8)){socket[_0xb91a('0x86')](_0xb91a('0x87')+_0x368472,stats);stats[_0xb91a('0x5b')]=[];}}if(stopped){logger[_0xb91a('0x58')]('Abort\x20parser');_0x467939[_0xb91a('0x88')]();}}catch(_0x156b68){handleError(_0x3b0b9e[_0xb91a('0x6f')][_0x41f815],{'code':_0xb91a('0x89'),'message':_0x156b68[_0xb91a('0x20')]});logger['error'](_0xb91a('0x8a'),_0x156b68['message']);}},'complete':function(){try{var _0x5cfa68=[];var _0x3221be=tempTableName;_0x5cfa68['push']('CREATE\x20TABLE\x20'+_0x3221be+'\x20LIKE\x20cm_contacts;');logger[_0xb91a('0x58')](_0xb91a('0x8b'),contactItemTypes[_0xb91a('0x19')]);var _0x24e980=util['format'](_0xb91a('0x8c'),_0xc6547f,_0x3221be,_0x4dbaf3,_0x1ddb42[_0xb91a('0x34')],_0x1ddb42[_0xb91a('0x52')]||null,NOW,NOW);if(_['isNil'](_0x34fd21[_0xb91a('0x32')])){_0x24e980+=',\x20scheduledAt\x20=\x20NOW()';}_0x5cfa68['push'](_0x24e980);BPromise[_0xb91a('0x8d')](_0x5cfa68,handleQuery)[_0xb91a('0x22')](function(_0x8ff82d){BPromise[_0xb91a('0x1d')]([handleAdditionalPhones()])[_0xb91a('0x22')](function(){_0x5cfa68=[];for(var _0x31d055=0x0;_0x31d0550x0){_0xa88566['where'](_0xb87f('0x11')+_0x7e6470+_0xb87f('0x15'),_['map'](_0x1bd206,'id'));}return _0xa88566;}function getInteractionsQuery(_0x37ae8c){var _0xf409ee=utils[_0xb87f('0x16')](_0x37ae8c);var _0x17d607=utils[_0xb87f('0x17')](_0x37ae8c);var _0x22eee9=utils['getInteractionFK'](_0x37ae8c);return squel[_0xb87f('0x8')]()['from'](_0xf409ee['interactions'],'i')[_0xb87f('0x12')]('cm_contacts','c',_0xb87f('0x18'))[_0xb87f('0x12')](_0xb87f('0x19'),'o',_0xb87f('0x1a'))[_0xb87f('0x12')](_0xf409ee[_0xb87f('0x1b')],'a','a.id\x20=\x20i.'+_0x17d607)[_0xb87f('0x12')](_0xf409ee[_0xb87f('0x1c')],'me','me.'+_0x22eee9+_0xb87f('0x1d'))[_0xb87f('0x12')](_0xf409ee[_0xb87f('0x1e')],'it',_0xb87f('0x1f')+_0x22eee9+_0xb87f('0x1d'))[_0xb87f('0x12')](_0xb87f('0x20'),'t',_0xb87f('0x21'));}function getSqlClauses(){var _0x5197b9={'body':squel[_0xb87f('0x22')](),'contact':squel[_0xb87f('0x22')](),'default':squel[_0xb87f('0x22')](),'fields':squel['expr'](),'filter':squel[_0xb87f('0x22')](),'read':squel['expr'](),'tags':{'clause':squel[_0xb87f('0x22')](),'ids':null},'user':squel[_0xb87f('0x22')]()};return _0x5197b9;}function parseTagParameter(_0x526edf){var _0x44ff74=squel[_0xb87f('0x22')]();if(_0x526edf){var _0x40f742=utils[_0xb87f('0x23')](_0x526edf);_0x40f742[_0xb87f('0x24')](function(_0x35b334){_0x44ff74['or'](_0xb87f('0x25'),'%,'+_0x35b334+',%');});}return _0x44ff74;}function parseReadParameter(_0x5d16c4){var _0x26be58='';if(_0x5d16c4){_0x26be58=_0xb87f('0x26');if(_0x5d16c4==='1'){_0x26be58=_0x26be58[_0xb87f('0x27')](_0xb87f('0x28'),'=');}else{_0x26be58=_0x26be58['replace'](_0xb87f('0x28'),'>');}}return _0x26be58;}function parseSearchFilter(_0x267436,_0x33fd27){var _0x58a92d=squel['expr']();if(_0x33fd27){var _0x1ae81a=_0x33fd27[_0xb87f('0x27')]('\x5c','\x5c\x5c')[_0xb87f('0x27')](/'/g,'\x27\x27');var _0x205c9c=qs[_0xb87f('0x29')](_0x1ae81a);if(qs['isNumeric'](_0x1ae81a)){_0x58a92d['or'](_0xb87f('0x2a'),_0x205c9c+'%');if([_0xb87f('0x2b'),'whatsapp'][_0xb87f('0x2c')](_0x267436)){_0x58a92d['or'](_0xb87f('0x2d'),_0x205c9c+'%');}else if(_0x267436===_0xb87f('0x2e')){_0x58a92d['or'](_0xb87f('0x2f'),_0x205c9c+'%');}else if(_0x267436===_0xb87f('0x30')){_0x58a92d['or'](_0xb87f('0x31'),_0x205c9c+'%');}}else if(_0x267436===_0xb87f('0x32')&&qs[_0xb87f('0x33')](_0x1ae81a)){_0x58a92d['or']('c.email\x20LIKE\x20?',_0x205c9c+'%');}else{if(_0x267436==='mail'){_0x58a92d['or']('MATCH\x20(i.to,\x20i.subject)\x20AGAINST\x20(?\x20IN\x20BOOLEAN\x20MODE)',qs[_0xb87f('0x34')](_0x1ae81a,!![]))['or'](_0xb87f('0x35'),qs['getFullTextValue'](_0x1ae81a));}else if(_0x267436!=='fax'){_0x58a92d['or'](_0xb87f('0x36'),qs[_0xb87f('0x34')](_0x1ae81a));}_0x58a92d['or']('MATCH\x20(c.firstName,\x20c.lastName,\x20c.phone,\x20c.mobile,\x20c.fax,\x20c.email)\x20AGAINST\x20(?\x20IN\x20BOOLEAN\x20MODE)',qs[_0xb87f('0x34')](_0x1ae81a,!![]),null);}}return _0x58a92d;}function parseAdvancedSearchFilter(_0x1cf121,_0x2f3beb){var _0x214cc1=getSqlClauses();var _0x1a844e=as[_0xb87f('0x37')](_0x1cf121);var _0x2c5213=_0x1a844e[_0xb87f('0x38')];for(var _0x4c3f75=0x0;_0x4c3f75<_0x1a844e[_0xb87f('0x39')]['length'];_0x4c3f75++){var _0xa998f8=_0x1a844e['conditions'][_0x4c3f75];var _0x177401='i';var _0x2d7aaf=_[_0xb87f('0x3a')](_0x2f3beb,['name',_0xa998f8['field']]);if(_0x2d7aaf){var _0x3f5bf3=as[_0xb87f('0x3b')](_0x177401,_0x2d7aaf['type'],_0xa998f8);_0x214cc1['default'][_0x2c5213](_0x3f5bf3[_0xb87f('0x3c')],_0x3f5bf3[_0xb87f('0x3d')][_0xb87f('0x3e')],_0x3f5bf3[_0xb87f('0x3d')][_0xb87f('0x3f')]);}else{switch(_0xa998f8[_0xb87f('0x9')]){case _0xb87f('0x40'):var _0x48fd98=parseReadParameter(_0xa998f8[_0xb87f('0x3d')]);_0x214cc1[_0xb87f('0x41')]['and'](_0x48fd98);break;case'Contact':if(_0xa998f8[_0xb87f('0x42')]===_0xb87f('0x43')){if(_0xa998f8['value']['split']('\x20')[_0xb87f('0x14')]>0x1){_0x214cc1[_0xb87f('0x44')][_0x2c5213]('MATCH\x20(c.firstName,\x20c.lastName,\x20c.phone,\x20c.mobile,\x20c.fax,\x20c.email)\x20AGAINST\x20(?\x20IN\x20BOOLEAN\x20MODE)',qs[_0xb87f('0x34')](_0xa998f8[_0xb87f('0x3d')],!![]),null);}else{var _0x2215ef='%'+_0xa998f8[_0xb87f('0x3d')]+'%';_0x214cc1[_0xb87f('0x44')][_0x2c5213](_0xb87f('0x45'),_0x2215ef,_0x2215ef,_0x2215ef);}}else{_0x2d7aaf=_[_0xb87f('0x3a')](_0x2f3beb,['name','ContactId']);_0xa998f8[_0xb87f('0x9')]='ContactId';_0x3f5bf3=as[_0xb87f('0x3b')](_0x177401,_0x2d7aaf[_0xb87f('0x46')],_0xa998f8);_0x214cc1[_0xb87f('0x44')][_0x2c5213](_0x3f5bf3[_0xb87f('0x3c')],_0x3f5bf3[_0xb87f('0x3d')]['start'],_0x3f5bf3[_0xb87f('0x3d')][_0xb87f('0x3f')]);}break;case'Tag':var _0x1a5ef1=_0xa998f8[_0xb87f('0x3d')][_0xb87f('0x47')](',')[_0xb87f('0x48')](function(_0x4db48a){return Number(_0x4db48a);});var _0x1817f6=parseTagParameter(_0x1a5ef1);_0x214cc1[_0xb87f('0x49')][_0xb87f('0x4a')][_0xb87f('0x4b')](_0x1817f6);_0x214cc1[_0xb87f('0x49')][_0xb87f('0x4c')]=_0x1a5ef1;break;case'User':if(_0xa998f8['operator']===_0xb87f('0x43')){_0x214cc1[_0xb87f('0x4d')][_0x2c5213]('CONCAT_WS(\x27\x20\x27,\x20o.name,\x20o.fullname,\x20o.internal)\x20LIKE\x20?','%'+_0xa998f8['value']+'%',null);}else{_0x2d7aaf=_['find'](_0x2f3beb,[_0xb87f('0xa'),_0xb87f('0x4e')]);_0xa998f8[_0xb87f('0x9')]='UserId';_0x3f5bf3=as[_0xb87f('0x3b')](_0x177401,_0x2d7aaf[_0xb87f('0x46')],_0xa998f8);_0x214cc1['user'][_0x2c5213](_0x3f5bf3[_0xb87f('0x3c')],_0x3f5bf3[_0xb87f('0x3d')][_0xb87f('0x3e')],_0x3f5bf3[_0xb87f('0x3d')]['end']);}break;case _0xb87f('0x4f'):case _0xb87f('0x50'):_0x3f5bf3=as[_0xb87f('0x3b')]('me',null,_0xa998f8);_0x214cc1[_0xb87f('0x4f')][_0x2c5213](_0x3f5bf3[_0xb87f('0x3c')],_0x3f5bf3[_0xb87f('0x3d')][_0xb87f('0x3e')],_0x3f5bf3['value'][_0xb87f('0x3f')]);break;}}}return _0x214cc1;}function parseModelFields(_0x36368e,_0x5ea55c,_0x51cacf){var _0x454f86=utils['getAccountFK'](_0x36368e);var _0x113303=squel[_0xb87f('0x22')]();var _0x546fcf=_(_0x5ea55c)[_0xb87f('0x51')]()[_0xb87f('0x48')](function(_0x5d82f5){return _[_0xb87f('0x52')](_0x51cacf,['name',_0x5d82f5])?_0x5d82f5:undefined;})['compact']()[_0xb87f('0x3d')]();if(_0x546fcf[_0xb87f('0x14')]>0x0){_0x546fcf[_0xb87f('0x24')](function(_0x51cbd6){if(_0x51cbd6===_0x454f86){_0x113303[_0xb87f('0x4b')]('i.'+_0x454f86+'\x20IN\x20?',[][_0xb87f('0x53')](_0x5ea55c[_0x51cbd6]));}else if(_0x51cbd6===_0xb87f('0x54')){var _0x22e527=JSON[_0xb87f('0x55')](_0x5ea55c[_0x51cbd6])['$gte'];var _0x2c6757=JSON[_0xb87f('0x55')](_0x5ea55c[_0x51cbd6])[_0xb87f('0x56')];_0x113303[_0xb87f('0x4b')](_0xb87f('0x57'),_0x22e527,_0x2c6757);}else{if(_0x5ea55c[_0x51cbd6]===_0xb87f('0x58')){_0x113303[_0xb87f('0x4b')]('i.'+_0x51cbd6+_0xb87f('0x59'));}else{_0x113303[_0xb87f('0x4b')]('i.'+_0x51cbd6+'\x20=\x20?',_0x5ea55c[_0x51cbd6]);}}});}return _0x113303;}function parseQueryParameters(_0x45e4b8,_0x19bba7,_0x501a53){var _0x1eb8ed=getSqlClauses();return Promise[_0xb87f('0x5a')]()[_0xb87f('0x5b')](function(){return parseModelFields(_0x45e4b8,_0x19bba7,_0x501a53);})[_0xb87f('0x5b')](function(_0x58f94e){_0x1eb8ed[_0xb87f('0x5c')][_0xb87f('0x4b')](_0x58f94e);return parseReadParameter(_0x19bba7[_0xb87f('0x41')]);})['then'](function(_0x2ff1fb){_0x1eb8ed[_0xb87f('0x41')][_0xb87f('0x4b')](_0x2ff1fb);return parseTagParameter(_0x19bba7[_0xb87f('0x5d')]);})[_0xb87f('0x5b')](function(_0x214e93){_0x1eb8ed[_0xb87f('0x49')]['clause']['and'](_0x214e93);return parseSearchFilter(_0x45e4b8,_0x19bba7[_0xb87f('0x5e')]);})[_0xb87f('0x5b')](function(_0x1be07c){_0x1eb8ed[_0xb87f('0x5e')]=_0x1be07c;return _0x1eb8ed;});}function checkAccountsRestrictions(_0xf6ee3d,_0x508899,_0x324745){var _0x3e7b9e=utils[_0xb87f('0x17')](_0xf6ee3d);var _0x23eadd=_0xb87f('0x5f')+_[_0xb87f('0x60')](_0xf6ee3d)+(_0xf6ee3d===_0xb87f('0x61')?_0xb87f('0x62'):'Accounts');var _0x2960d7=squel[_0xb87f('0x22')]();return Promise[_0xb87f('0x5a')]()[_0xb87f('0x5b')](function(){if(_0x324745[_0xb87f('0x7')]&&_0x508899[_0xb87f('0x5')]===_0xb87f('0x6')){return _0x508899[_0x23eadd]({'attributes':['id'],'raw':!![]});}})[_0xb87f('0x5b')](function(_0x3571bb){if(_0x3571bb){if(_0x3571bb['length']===0x0){_0x2960d7[_0xb87f('0x4b')]('i.'+_0x3e7b9e+_0xb87f('0x59'));}else{_0x2960d7['and']('i.'+_0x3e7b9e+_0xb87f('0x15'),_[_0xb87f('0x48')](_0x3571bb,'id'));}}else if(!_0x324745[_0x3e7b9e]){_0x2960d7[_0xb87f('0x4b')]('i.'+_0x3e7b9e+'\x20IS\x20NOT\x20NULL');}})[_0xb87f('0x5b')](function(){return _0x2960d7;});}function getClosedOrderClause(_0x37e9c3,_0x3c6dd5){var _0x4f021b='';var _0x1ba838=['i.thirdDisposition',_0xb87f('0x63'),_0xb87f('0x64')];if(_0x37e9c3===_0xb87f('0x32')){_0x1ba838['unshift']('i.substatus');}if(_0x3c6dd5[_0xb87f('0x65')]==='0'&&_0x37e9c3===_0xb87f('0x32')){_0x4f021b=_0xb87f('0x66');}else{if(_0x3c6dd5[_0xb87f('0x65')]==='1'){_0x1ba838[_0xb87f('0x67')]();}_0x4f021b=_0xb87f('0x68')+_0x1ba838[_0xb87f('0x69')](',\x20')+')';}return _0x4f021b;}function getFilteredInteractions(_0x39afc7,_0x4f2682,_0x459144,_0x1035b3){var _0x4e3f56=utils[_0xb87f('0xd')](_0x39afc7);var _0x2a0f83=_[_0xb87f('0x60')](_0x39afc7)+_0xb87f('0x6a');var _0x28fea6=[];var _0x352139=getTagsQuery();var _0x2fa5d2={'type':db[_0xb87f('0x6b')]['QueryTypes'][_0xb87f('0x6c')],'raw':!![]};var _0x1c0002=[];var _0x4188b3=[];return db['sequelize']['query'](_0x352139[_0xb87f('0x6d')](),_0x2fa5d2)[_0xb87f('0x5b')](function(_0x1e1e08){_0x28fea6=_[_0xb87f('0x6e')](_0x1e1e08,'id');_0x2fa5d2=_['merge'](_0x2fa5d2,{'model':db[_0x2a0f83],'mapToModel':!![],'nest':!![]});if(_0x459144[_0xb87f('0x5c')]){_0x1035b3[_0xb87f('0x6f')]['forEach'](function(_0xc33d85){_0x4f2682['field']('i.'+_0xc33d85);});}else{_0x4f2682[_0xb87f('0x9')](_0xb87f('0x70'),'unreadMessages');_0x4f2682[_0xb87f('0x9')]('a.key','Account.key');_0x4f2682[_0xb87f('0x9')]('a.mandatoryDisposition','Account.mandatoryDisposition');if(_0x39afc7===_0xb87f('0x32')){_0x4f2682[_0xb87f('0x9')](_0xb87f('0x71'),_0xb87f('0x72'));_0x4f2682[_0xb87f('0x9')]('CASE\x20WHEN\x20i.to\x20IS\x20NOT\x20NULL\x20AND\x20i.to\x20<>\x20\x27\x27\x20AND\x20i.to\x20NOT\x20LIKE\x20CONCAT(\x27%\x27,\x20a.email,\x20\x27%\x27)\x20THEN\x20TRIM(SUBSTRING_INDEX(i.to,\x20\x27<\x27,\x201))\x20WHEN\x20(c.firstName\x20IS\x20NOT\x20NULL\x20AND\x20c.firstName\x20<>\x20\x27\x27)\x20OR\x20(c.lastName\x20IS\x20NOT\x20NULL\x20AND\x20c.lastName\x20<>\x20\x27\x27)\x20THEN\x20CONCAT(IFNULL(c.firstName,\x20\x27\x27),\x20\x27\x20\x27,\x20IFNULL(c.lastName,\x20\x27\x27))\x20ELSE\x20\x27Unknown\x27\x20END',_0xb87f('0x73'));_0x4f2682[_0xb87f('0x9')](_0xb87f('0x74'));_0x4f2682[_0xb87f('0x9')](_0xb87f('0x75'));_0x4f2682['field'](_0xb87f('0x76'));_0x4f2682[_0xb87f('0x9')]('i.closed');_0x4f2682['field'](_0xb87f('0x77'));_0x4f2682[_0xb87f('0x9')](_0xb87f('0x78'));_0x4f2682[_0xb87f('0x9')](_0xb87f('0x79'));_0x4f2682[_0xb87f('0x9')](_0xb87f('0x7a'));_0x4f2682[_0xb87f('0x9')](_0xb87f('0x7b'));_0x4f2682[_0xb87f('0x9')]('i.disposition');_0x4f2682[_0xb87f('0x9')](_0xb87f('0x63'));_0x4f2682['field']('i.thirdDisposition');_0x4f2682[_0xb87f('0x9')](_0xb87f('0x66'));_0x4f2682['field'](_0xb87f('0x7c'));_0x4f2682['field'](_0xb87f('0x7d'));_0x4f2682[_0xb87f('0x9')]('i.MailAccountId');_0x4f2682[_0xb87f('0x9')]('i.UserId');}else if(_0x39afc7===_0xb87f('0x30')){_0x4f2682[_0xb87f('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','contactName');}else{_0x4f2682['field']('CASE\x20WHEN\x20(c.firstName\x20IS\x20NOT\x20NULL\x20AND\x20c.firstName\x20<>\x20\x27\x27)\x20OR\x20(c.lastName\x20IS\x20NOT\x20NULL\x20AND\x20c.lastName\x20<>\x20\x27\x27)\x20THEN\x20CONCAT(IFNULL(c.firstName,\x20\x27\x27),\x20\x27\x20\x27,\x20IFNULL(c.lastName,\x20\x27\x27))\x20ELSE\x20\x27Unknown\x27\x20END','contactName');}if(_0x39afc7!==_0xb87f('0x32')){_0x4f2682['field']('i.*');}_0x4f2682[_0xb87f('0x9')]('c.firstName',_0xb87f('0x7e'));_0x4f2682[_0xb87f('0x9')](_0xb87f('0x7f'),_0xb87f('0x80'));_0x4f2682['field']('c.email','Contact.email');_0x4f2682[_0xb87f('0x9')]('c.phone','Contact.phone');_0x4f2682[_0xb87f('0x9')]('c.mobile','Contact.mobile');_0x4f2682[_0xb87f('0x9')](_0xb87f('0x81'),_0xb87f('0x82'));_0x4f2682['field'](_0xb87f('0x83'),_0xb87f('0x84'));_0x4f2682[_0xb87f('0x9')]('o.internal',_0xb87f('0x85'));_0x4f2682[_0xb87f('0x9')]('GROUP_CONCAT(DISTINCT\x20t.id)',_0xb87f('0x86'));}if(_0x1035b3[_0xb87f('0x87')]){_0x4f2682[_0xb87f('0x87')](_0x1035b3[_0xb87f('0x87')]);}if(_0x1035b3[_0xb87f('0x88')]){_0x4f2682[_0xb87f('0x88')](_0x1035b3[_0xb87f('0x88')]);}return db[_0xb87f('0x89')][_0xb87f('0x8a')](_0x4f2682['toString'](),_0x2fa5d2);})[_0xb87f('0x5b')](function(_0x1ddf5e){_0x1c0002=_0x1ddf5e;var _0x21a6b0=getUsersQuery(_0x39afc7,_0x1c0002);return db[_0xb87f('0x89')][_0xb87f('0x8a')](_0x21a6b0[_0xb87f('0x6d')](),_0x2fa5d2);})[_0xb87f('0x5b')](function(_0x2e1344){_0x4188b3=_[_0xb87f('0x8b')](_0x2e1344,_0x4e3f56);if(_0x39afc7==='mail'){return db[_0xb87f('0x8c')]['findOne']({'attributes':[_0xb87f('0x8d')],'raw':!![]});}})[_0xb87f('0x5b')](function(_0x443f33){var _0x21371a=_0x443f33?_0x443f33[_0xb87f('0x8d')]:undefined;var _0x5c7481=_0x1c0002['map'](function(_0x422d48){return updateInteraction(_0x422d48,_0x28fea6,_0x4188b3,_0x21371a);});return Promise[_0xb87f('0x8e')](_0x5c7481);});}function countFilteredInteractions(_0xccfcf5,_0x19a1f8){var _0x28087a=_0xccfcf5[_0xb87f('0x8f')]();_0x28087a[_0xb87f('0x9')](_0xb87f('0x90'));_0x28087a[_0xb87f('0x9')](_0xb87f('0x70'),_0xb87f('0x40'));var _0x4a750f=utils[_0xb87f('0x23')](_0x19a1f8);if(!_[_0xb87f('0x91')](_0x4a750f)){_0x28087a['where'](_0xb87f('0x92'),_0x4a750f);}var _0x1f6960={'type':db['Sequelize']['QueryTypes']['SELECT'],'raw':!![]};return db['sequelize'][_0xb87f('0x8a')](_0x28087a[_0xb87f('0x6d')](),_0x1f6960);}module[_0xb87f('0x93')]={'checkAccountsRestrictions':checkAccountsRestrictions,'countFilteredInteractions':countFilteredInteractions,'getClosedOrderClause':getClosedOrderClause,'getFilteredInteractions':getFilteredInteractions,'getInteractionsQuery':getInteractionsQuery,'parseAdvancedSearchFilter':parseAdvancedSearchFilter,'parseQueryParameters':parseQueryParameters,'skipInteractionsQuery':skipInteractionsQuery}; \ No newline at end of file +var _0x70ef=['c.email','c.phone','Contact.phone','c.mobile','c.fax','Contact.fax','o.fullname','Owner.internal','limit','offset','Setting','findOne','enableEmailPreview','all','clone','COUNT(*)','getSelectedTags','isEmpty','t.id\x20IN\x20?','exports','lodash','squel','../parsers/advancedSearch','../parsers/qs','./update-interaction','updateInteraction','./utils','../../mysqldb','getAccountFK','search','field','name','color','from','tools_tags','getInteractionFK','user_has_','_interactions','select','u.id','ui.','users','u.id\x20=\x20ui.UserId','length','where','\x20IN\x20?','map','interactions','left_join','cm_contacts','c.id\x20=\x20i.ContactId\x20AND\x20c.deletedAt\x20IS\x20NULL','o.id\x20=\x20i.UserId','accounts','a.id\x20=\x20i.','messages','me.','\x20=\x20i.id','interactionsTags','it.','expr','unreadMessages\x20{OPERATOR}\x200','replace','{OPERATOR}','escapeLIKESpecialChars','isNumeric','i.id\x20LIKE\x20?','includes','i.phone\x20LIKE\x20?','fax','i.fax\x20LIKE\x20?','i.from\x20LIKE\x20?','mail','c.email\x20LIKE\x20?','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','sqlOperator','conditions','find','buildExpression','type','default','text','value','start','end','unreadMessages','read','and','Contact','operator','$substring','split','contact','c.firstName\x20LIKE\x20?\x20OR\x20c.lastName\x20LIKE\x20?\x20OR\x20c.email\x20LIKE\x20?','ContactId','Tag','tags','clause','ids','User','UserId','user','plainBody','body','keys','some','compact','forEach','concat','createdAt','parse','$gte','$lte','i.createdAt\x20BETWEEN\x20?\x20AND\x20?','null','\x20IS\x20NULL','\x20=\x20?','then','fields','tag','filter','get','capitalize','chat','Websites','Accounts','resolve','role','agent','i.secondDisposition','i.substatus','closed','shift','CONCAT_WS(\x27\x27,\x20','Interaction','Sequelize','QueryTypes','SELECT','sequelize','query','toString','keyBy','merge','attributes','SUM(me.read\x20=\x200\x20AND\x20me.direction\x20=\x20\x27in\x27)','Account.key','a.mandatoryDisposition','Account.mandatoryDisposition','a.email','Account.email','contactName','i.id','i.createdAt','i.updatedAt','i.attach','i.lastMsgAt','i.lastMsgDirection','i.subject','i.disposition','i.thirdDisposition','i.to','i.MailAccountId','i.UserId','CASE\x20WHEN\x20i.from\x20IS\x20NOT\x20NULL\x20AND\x20i.from\x20<>\x20\x27\x27\x20THEN\x20i.from\x20WHEN\x20(c.firstName\x20IS\x20NOT\x20NULL\x20AND\x20c.firstName\x20<>\x20\x27\x27)\x20OR\x20(c.lastName\x20IS\x20NOT\x20NULL\x20AND\x20c.lastName\x20<>\x20\x27\x27)\x20THEN\x20CONCAT(IFNULL(c.firstName,\x20\x27\x27),\x20\x27\x20\x27,\x20IFNULL(c.lastName,\x20\x27\x27))\x20ELSE\x20\x27Unknown\x27\x20END','CASE\x20WHEN\x20(c.firstName\x20IS\x20NOT\x20NULL\x20AND\x20c.firstName\x20<>\x20\x27\x27)\x20OR\x20(c.lastName\x20IS\x20NOT\x20NULL\x20AND\x20c.lastName\x20<>\x20\x27\x27)\x20THEN\x20CONCAT(IFNULL(c.firstName,\x20\x27\x27),\x20\x27\x20\x27,\x20IFNULL(c.lastName,\x20\x27\x27))\x20ELSE\x20\x27Unknown\x27\x20END','c.firstName','Contact.firstName','c.lastName'];(function(_0x2b04ef,_0xe6b0f5){var _0x5af01d=function(_0x210cfb){while(--_0x210cfb){_0x2b04ef['push'](_0x2b04ef['shift']());}};_0x5af01d(++_0xe6b0f5);}(_0x70ef,0xc0));var _0xf70e=function(_0x208600,_0x7b7865){_0x208600=_0x208600-0x0;var _0x35849a=_0x70ef[_0x208600];return _0x35849a;};'use strict';var _=require(_0xf70e('0x0'));var squel=require(_0xf70e('0x1'));var as=require(_0xf70e('0x2'));var qs=require(_0xf70e('0x3'));var updateInteraction=require(_0xf70e('0x4'))[_0xf70e('0x5')];var utils=require(_0xf70e('0x6'));var db=require(_0xf70e('0x7'))['db'];function skipInteractionsQuery(_0x288900,_0x2302e9,_0x1772eb){var _0x107a3c=![];var _0x4a06dc=utils[_0xf70e('0x8')](_0x288900);if(_0x2302e9['role']==='agent'&&!_0x1772eb[_0xf70e('0x9')]&&!_0x1772eb[_0x4a06dc]){_0x107a3c=!![];}return _0x107a3c;}function getTagsQuery(){return squel['select']()['field']('id')[_0xf70e('0xa')](_0xf70e('0xb'))[_0xf70e('0xa')](_0xf70e('0xc'))[_0xf70e('0xd')](_0xf70e('0xe'));}function getUsersQuery(_0x254baa,_0x1442ea){var _0x25a8b0=utils[_0xf70e('0xf')](_0x254baa);var _0x2cb29c=_0xf70e('0x10')+_0x254baa+_0xf70e('0x11');var _0x44b067=squel[_0xf70e('0x12')]()[_0xf70e('0xa')](_0xf70e('0x13'))[_0xf70e('0xa')]('u.fullname')['field'](_0xf70e('0x14')+_0x25a8b0)[_0xf70e('0xd')](_0x2cb29c,'ui')['left_join'](_0xf70e('0x15'),'u',_0xf70e('0x16'));if(_0x1442ea[_0xf70e('0x17')]>0x0){_0x44b067[_0xf70e('0x18')](_0xf70e('0x14')+_0x25a8b0+_0xf70e('0x19'),_[_0xf70e('0x1a')](_0x1442ea,'id'));}return _0x44b067;}function getInteractionsQuery(_0x1cabb5){var _0x4ea71d=utils['getInteractionsTables'](_0x1cabb5);var _0xaa54f0=utils['getAccountFK'](_0x1cabb5);var _0x39ee19=utils['getInteractionFK'](_0x1cabb5);return squel['select']()[_0xf70e('0xd')](_0x4ea71d[_0xf70e('0x1b')],'i')[_0xf70e('0x1c')](_0xf70e('0x1d'),'c',_0xf70e('0x1e'))[_0xf70e('0x1c')](_0xf70e('0x15'),'o',_0xf70e('0x1f'))[_0xf70e('0x1c')](_0x4ea71d[_0xf70e('0x20')],'a',_0xf70e('0x21')+_0xaa54f0)[_0xf70e('0x1c')](_0x4ea71d[_0xf70e('0x22')],'me',_0xf70e('0x23')+_0x39ee19+_0xf70e('0x24'))[_0xf70e('0x1c')](_0x4ea71d[_0xf70e('0x25')],'it',_0xf70e('0x26')+_0x39ee19+_0xf70e('0x24'))[_0xf70e('0x1c')]('tools_tags','t','t.id\x20=\x20it.TagId');}function getSqlClauses(){var _0x518716={'body':squel[_0xf70e('0x27')](),'contact':squel[_0xf70e('0x27')](),'default':squel[_0xf70e('0x27')](),'fields':squel[_0xf70e('0x27')](),'filter':squel['expr'](),'read':squel[_0xf70e('0x27')](),'tags':{'clause':squel[_0xf70e('0x27')](),'ids':null},'user':squel[_0xf70e('0x27')]()};return _0x518716;}function parseTagParameter(_0x49bf50){var _0x103af1=squel[_0xf70e('0x27')]();if(_0x49bf50){var _0x41588a=utils['getSelectedTags'](_0x49bf50);_0x41588a['forEach'](function(_0x306ef8){_0x103af1['or']('CONCAT(\x27,\x27,\x20`TagIds`,\x20\x27,\x27)\x20LIKE\x20?','%,'+_0x306ef8+',%');});}return _0x103af1;}function parseReadParameter(_0x462935){var _0x24f40a='';if(_0x462935){_0x24f40a=_0xf70e('0x28');if(_0x462935==='1'){_0x24f40a=_0x24f40a[_0xf70e('0x29')](_0xf70e('0x2a'),'=');}else{_0x24f40a=_0x24f40a['replace'](_0xf70e('0x2a'),'>');}}return _0x24f40a;}function parseSearchFilter(_0x11b9cd,_0x54dd98){var _0x5d565f=squel[_0xf70e('0x27')]();if(_0x54dd98){var _0x58e122=_0x54dd98[_0xf70e('0x29')]('\x5c','\x5c\x5c')[_0xf70e('0x29')](/'/g,'\x27\x27');var _0x5a5a29=qs[_0xf70e('0x2b')](_0x58e122);if(qs[_0xf70e('0x2c')](_0x58e122)){_0x5d565f['or'](_0xf70e('0x2d'),_0x5a5a29+'%');if(['sms','whatsapp'][_0xf70e('0x2e')](_0x11b9cd)){_0x5d565f['or'](_0xf70e('0x2f'),_0x5a5a29+'%');}else if(_0x11b9cd===_0xf70e('0x30')){_0x5d565f['or'](_0xf70e('0x31'),_0x5a5a29+'%');}else if(_0x11b9cd==='openchannel'){_0x5d565f['or'](_0xf70e('0x32'),_0x5a5a29+'%');}}else if(_0x11b9cd===_0xf70e('0x33')&&qs['isEmail'](_0x58e122)){_0x5d565f['or'](_0xf70e('0x34'),_0x5a5a29+'%');}else{if(_0x11b9cd==='mail'){_0x5d565f['or'](_0xf70e('0x35'),qs[_0xf70e('0x36')](_0x58e122,!![]))['or'](_0xf70e('0x37'),qs[_0xf70e('0x36')](_0x58e122));}else if(_0x11b9cd!==_0xf70e('0x30')){_0x5d565f['or'](_0xf70e('0x38'),qs['getFullTextValue'](_0x58e122));}_0x5d565f['or'](_0xf70e('0x39'),qs['getFullTextValue'](_0x58e122,!![]),null);}}return _0x5d565f;}function parseAdvancedSearchFilter(_0x5cf8b3,_0x27f1f5){var _0x4d5175=getSqlClauses();var _0x589b2a=as[_0xf70e('0x3a')](_0x5cf8b3);var _0x3843d2=_0x589b2a[_0xf70e('0x3b')];for(var _0x2da87c=0x0;_0x2da87c<_0x589b2a[_0xf70e('0x3c')][_0xf70e('0x17')];_0x2da87c++){var _0x5802bb=_0x589b2a[_0xf70e('0x3c')][_0x2da87c];var _0x6f7dd='i';var _0x166d80=_[_0xf70e('0x3d')](_0x27f1f5,[_0xf70e('0xb'),_0x5802bb[_0xf70e('0xa')]]);if(_0x166d80){var _0x1ce045=as[_0xf70e('0x3e')](_0x6f7dd,_0x166d80[_0xf70e('0x3f')],_0x5802bb);_0x4d5175[_0xf70e('0x40')][_0x3843d2](_0x1ce045[_0xf70e('0x41')],_0x1ce045[_0xf70e('0x42')][_0xf70e('0x43')],_0x1ce045[_0xf70e('0x42')][_0xf70e('0x44')]);}else{switch(_0x5802bb['field']){case _0xf70e('0x45'):var _0x5d8b76=parseReadParameter(_0x5802bb['value']);_0x4d5175[_0xf70e('0x46')][_0xf70e('0x47')](_0x5d8b76);break;case _0xf70e('0x48'):if(_0x5802bb[_0xf70e('0x49')]===_0xf70e('0x4a')){if(_0x5802bb['value'][_0xf70e('0x4b')]('\x20')[_0xf70e('0x17')]>0x1){_0x4d5175[_0xf70e('0x4c')][_0x3843d2](_0xf70e('0x39'),qs['getFullTextValue'](_0x5802bb[_0xf70e('0x42')],!![]),null);}else{var _0x3359a4='%'+_0x5802bb['value']+'%';_0x4d5175[_0xf70e('0x4c')][_0x3843d2](_0xf70e('0x4d'),_0x3359a4,_0x3359a4,_0x3359a4);}}else{_0x166d80=_[_0xf70e('0x3d')](_0x27f1f5,[_0xf70e('0xb'),_0xf70e('0x4e')]);_0x5802bb[_0xf70e('0xa')]='ContactId';_0x1ce045=as['buildExpression'](_0x6f7dd,_0x166d80[_0xf70e('0x3f')],_0x5802bb);_0x4d5175[_0xf70e('0x4c')][_0x3843d2](_0x1ce045[_0xf70e('0x41')],_0x1ce045[_0xf70e('0x42')][_0xf70e('0x43')],_0x1ce045[_0xf70e('0x42')][_0xf70e('0x44')]);}break;case _0xf70e('0x4f'):var _0x68c6b3=_0x5802bb[_0xf70e('0x42')][_0xf70e('0x4b')](',')[_0xf70e('0x1a')](function(_0x55390d){return Number(_0x55390d);});var _0x21973d=parseTagParameter(_0x68c6b3);_0x4d5175[_0xf70e('0x50')][_0xf70e('0x51')][_0xf70e('0x47')](_0x21973d);_0x4d5175[_0xf70e('0x50')][_0xf70e('0x52')]=_0x68c6b3;break;case _0xf70e('0x53'):if(_0x5802bb[_0xf70e('0x49')]==='$substring'){_0x4d5175['user'][_0x3843d2]('CONCAT_WS(\x27\x20\x27,\x20o.name,\x20o.fullname,\x20o.internal)\x20LIKE\x20?','%'+_0x5802bb[_0xf70e('0x42')]+'%',null);}else{_0x166d80=_[_0xf70e('0x3d')](_0x27f1f5,[_0xf70e('0xb'),_0xf70e('0x54')]);_0x5802bb[_0xf70e('0xa')]='UserId';_0x1ce045=as[_0xf70e('0x3e')](_0x6f7dd,_0x166d80[_0xf70e('0x3f')],_0x5802bb);_0x4d5175[_0xf70e('0x55')][_0x3843d2](_0x1ce045['text'],_0x1ce045[_0xf70e('0x42')][_0xf70e('0x43')],_0x1ce045[_0xf70e('0x42')]['end']);}break;case'body':case _0xf70e('0x56'):_0x1ce045=as['buildExpression']('me',null,_0x5802bb);_0x4d5175[_0xf70e('0x57')][_0x3843d2](_0x1ce045[_0xf70e('0x41')],_0x1ce045[_0xf70e('0x42')][_0xf70e('0x43')],_0x1ce045[_0xf70e('0x42')][_0xf70e('0x44')]);break;}}}return _0x4d5175;}function parseModelFields(_0x42f03c,_0x1738a2,_0x1eef79){var _0x2534be=utils[_0xf70e('0x8')](_0x42f03c);var _0x3113b5=squel[_0xf70e('0x27')]();var _0x4caacb=_(_0x1738a2)[_0xf70e('0x58')]()[_0xf70e('0x1a')](function(_0xe43edc){return _[_0xf70e('0x59')](_0x1eef79,[_0xf70e('0xb'),_0xe43edc])?_0xe43edc:undefined;})[_0xf70e('0x5a')]()[_0xf70e('0x42')]();if(_0x4caacb['length']>0x0){_0x4caacb[_0xf70e('0x5b')](function(_0xcd7c7a){if(_0xcd7c7a===_0x2534be){_0x3113b5[_0xf70e('0x47')]('i.'+_0x2534be+_0xf70e('0x19'),[][_0xf70e('0x5c')](_0x1738a2[_0xcd7c7a]));}else if(_0xcd7c7a===_0xf70e('0x5d')){var _0x568028=JSON[_0xf70e('0x5e')](_0x1738a2[_0xcd7c7a])[_0xf70e('0x5f')];var _0x5b4fec=JSON['parse'](_0x1738a2[_0xcd7c7a])[_0xf70e('0x60')];_0x3113b5[_0xf70e('0x47')](_0xf70e('0x61'),_0x568028,_0x5b4fec);}else{if(_0x1738a2[_0xcd7c7a]===_0xf70e('0x62')){_0x3113b5[_0xf70e('0x47')]('i.'+_0xcd7c7a+_0xf70e('0x63'));}else{_0x3113b5[_0xf70e('0x47')]('i.'+_0xcd7c7a+_0xf70e('0x64'),_0x1738a2[_0xcd7c7a]);}}});}return _0x3113b5;}function parseQueryParameters(_0x262cbe,_0x344a49,_0x346e7c){var _0x4f46db=getSqlClauses();return Promise['resolve']()[_0xf70e('0x65')](function(){return parseModelFields(_0x262cbe,_0x344a49,_0x346e7c);})[_0xf70e('0x65')](function(_0x30e86b){_0x4f46db[_0xf70e('0x66')][_0xf70e('0x47')](_0x30e86b);return parseReadParameter(_0x344a49[_0xf70e('0x46')]);})[_0xf70e('0x65')](function(_0x4c2854){_0x4f46db[_0xf70e('0x46')][_0xf70e('0x47')](_0x4c2854);return parseTagParameter(_0x344a49[_0xf70e('0x67')]);})[_0xf70e('0x65')](function(_0x2f05d9){_0x4f46db[_0xf70e('0x50')][_0xf70e('0x51')][_0xf70e('0x47')](_0x2f05d9);return parseSearchFilter(_0x262cbe,_0x344a49['filter']);})[_0xf70e('0x65')](function(_0xd853c9){_0x4f46db[_0xf70e('0x68')]=_0xd853c9;return _0x4f46db;});}function checkAccountsRestrictions(_0x159eed,_0xa71620,_0x34b2a2){var _0x471535=utils[_0xf70e('0x8')](_0x159eed);var _0x12aea0=_0xf70e('0x69')+_[_0xf70e('0x6a')](_0x159eed)+(_0x159eed===_0xf70e('0x6b')?_0xf70e('0x6c'):_0xf70e('0x6d'));var _0x3b4a3e=squel[_0xf70e('0x27')]();return Promise[_0xf70e('0x6e')]()[_0xf70e('0x65')](function(){if(_0x34b2a2[_0xf70e('0x9')]&&_0xa71620[_0xf70e('0x6f')]===_0xf70e('0x70')){return _0xa71620[_0x12aea0]({'attributes':['id'],'raw':!![]});}})[_0xf70e('0x65')](function(_0x23a877){if(_0x23a877){if(_0x23a877[_0xf70e('0x17')]===0x0){_0x3b4a3e[_0xf70e('0x47')]('i.'+_0x471535+_0xf70e('0x63'));}else{_0x3b4a3e[_0xf70e('0x47')]('i.'+_0x471535+_0xf70e('0x19'),_[_0xf70e('0x1a')](_0x23a877,'id'));}}else if(!_0x34b2a2[_0x471535]){_0x3b4a3e['and']('i.'+_0x471535+'\x20IS\x20NOT\x20NULL');}})['then'](function(){return _0x3b4a3e;});}function getClosedOrderClause(_0x1eaa22,_0x18fcd8){var _0x3a12d9='';var _0x346124=['i.thirdDisposition',_0xf70e('0x71'),'i.disposition'];if(_0x1eaa22===_0xf70e('0x33')){_0x346124['unshift'](_0xf70e('0x72'));}if(_0x18fcd8[_0xf70e('0x73')]==='0'&&_0x1eaa22===_0xf70e('0x33')){_0x3a12d9=_0xf70e('0x72');}else{if(_0x18fcd8['closed']==='1'){_0x346124[_0xf70e('0x74')]();}_0x3a12d9=_0xf70e('0x75')+_0x346124['join'](',\x20')+')';}return _0x3a12d9;}function getFilteredInteractions(_0x363012,_0x54194a,_0x22675d,_0x4de678){var _0x24ba9a=utils[_0xf70e('0xf')](_0x363012);var _0x1b9b54=_[_0xf70e('0x6a')](_0x363012)+_0xf70e('0x76');var _0x11c19b=[];var _0x1102c7=getTagsQuery();var _0x438e74={'type':db[_0xf70e('0x77')][_0xf70e('0x78')][_0xf70e('0x79')],'raw':!![]};var _0x215139=[];var _0x44e4cb=[];return db[_0xf70e('0x7a')][_0xf70e('0x7b')](_0x1102c7[_0xf70e('0x7c')](),_0x438e74)['then'](function(_0x4d3349){_0x11c19b=_[_0xf70e('0x7d')](_0x4d3349,'id');_0x438e74=_[_0xf70e('0x7e')](_0x438e74,{'model':db[_0x1b9b54],'mapToModel':!![],'nest':!![]});if(_0x22675d[_0xf70e('0x66')]){_0x4de678[_0xf70e('0x7f')][_0xf70e('0x5b')](function(_0x4c5704){_0x54194a[_0xf70e('0xa')]('i.'+_0x4c5704);});}else{_0x54194a[_0xf70e('0xa')](_0xf70e('0x80'),_0xf70e('0x45'));_0x54194a[_0xf70e('0xa')]('a.key',_0xf70e('0x81'));_0x54194a[_0xf70e('0xa')](_0xf70e('0x82'),_0xf70e('0x83'));if(_0x363012===_0xf70e('0x33')){_0x54194a[_0xf70e('0xa')](_0xf70e('0x84'),_0xf70e('0x85'));_0x54194a['field']('CASE\x20WHEN\x20i.to\x20IS\x20NOT\x20NULL\x20AND\x20i.to\x20<>\x20\x27\x27\x20AND\x20i.to\x20NOT\x20LIKE\x20CONCAT(\x27%\x27,\x20a.email,\x20\x27%\x27)\x20THEN\x20TRIM(SUBSTRING_INDEX(i.to,\x20\x27<\x27,\x201))\x20WHEN\x20(c.firstName\x20IS\x20NOT\x20NULL\x20AND\x20c.firstName\x20<>\x20\x27\x27)\x20OR\x20(c.lastName\x20IS\x20NOT\x20NULL\x20AND\x20c.lastName\x20<>\x20\x27\x27)\x20THEN\x20CONCAT(IFNULL(c.firstName,\x20\x27\x27),\x20\x27\x20\x27,\x20IFNULL(c.lastName,\x20\x27\x27))\x20ELSE\x20\x27Unknown\x27\x20END',_0xf70e('0x86'));_0x54194a[_0xf70e('0xa')](_0xf70e('0x87'));_0x54194a[_0xf70e('0xa')](_0xf70e('0x88'));_0x54194a[_0xf70e('0xa')](_0xf70e('0x89'));_0x54194a[_0xf70e('0xa')]('i.closed');_0x54194a[_0xf70e('0xa')]('i.closedAt');_0x54194a[_0xf70e('0xa')](_0xf70e('0x8a'));_0x54194a['field'](_0xf70e('0x8b'));_0x54194a['field'](_0xf70e('0x8c'));_0x54194a[_0xf70e('0xa')](_0xf70e('0x8d'));_0x54194a[_0xf70e('0xa')](_0xf70e('0x8e'));_0x54194a[_0xf70e('0xa')](_0xf70e('0x71'));_0x54194a['field'](_0xf70e('0x8f'));_0x54194a[_0xf70e('0xa')](_0xf70e('0x72'));_0x54194a[_0xf70e('0xa')](_0xf70e('0x90'));_0x54194a[_0xf70e('0xa')]('i.ContactId');_0x54194a[_0xf70e('0xa')](_0xf70e('0x91'));_0x54194a[_0xf70e('0xa')](_0xf70e('0x92'));}else if(_0x363012==='openchannel'){_0x54194a['field'](_0xf70e('0x93'),_0xf70e('0x86'));}else{_0x54194a[_0xf70e('0xa')](_0xf70e('0x94'),_0xf70e('0x86'));}if(_0x363012!==_0xf70e('0x33')){_0x54194a['field']('i.*');}_0x54194a[_0xf70e('0xa')](_0xf70e('0x95'),_0xf70e('0x96'));_0x54194a['field'](_0xf70e('0x97'),'Contact.lastName');_0x54194a[_0xf70e('0xa')](_0xf70e('0x98'),'Contact.email');_0x54194a[_0xf70e('0xa')](_0xf70e('0x99'),_0xf70e('0x9a'));_0x54194a[_0xf70e('0xa')](_0xf70e('0x9b'),'Contact.mobile');_0x54194a[_0xf70e('0xa')](_0xf70e('0x9c'),_0xf70e('0x9d'));_0x54194a[_0xf70e('0xa')](_0xf70e('0x9e'),'Owner.fullname');_0x54194a['field']('o.internal',_0xf70e('0x9f'));_0x54194a[_0xf70e('0xa')]('GROUP_CONCAT(DISTINCT\x20t.id)','TagIds');}if(_0x4de678[_0xf70e('0xa0')]){_0x54194a[_0xf70e('0xa0')](_0x4de678[_0xf70e('0xa0')]);}if(_0x4de678['offset']){_0x54194a[_0xf70e('0xa1')](_0x4de678[_0xf70e('0xa1')]);}return db[_0xf70e('0x7a')][_0xf70e('0x7b')](_0x54194a['toString'](),_0x438e74);})['then'](function(_0x55229d){_0x215139=_0x55229d;var _0x49409e=getUsersQuery(_0x363012,_0x215139);return db[_0xf70e('0x7a')][_0xf70e('0x7b')](_0x49409e[_0xf70e('0x7c')](),_0x438e74);})['then'](function(_0x1a62d3){_0x44e4cb=_['groupBy'](_0x1a62d3,_0x24ba9a);if(_0x363012==='mail'){return db[_0xf70e('0xa2')][_0xf70e('0xa3')]({'attributes':[_0xf70e('0xa4')],'raw':!![]});}})['then'](function(_0x849231){var _0x1f7111=_0x849231?_0x849231['enableEmailPreview']:undefined;var _0x4427cb=_0x215139[_0xf70e('0x1a')](function(_0x578fae){return updateInteraction(_0x578fae,_0x11c19b,_0x44e4cb,_0x1f7111);});return Promise[_0xf70e('0xa5')](_0x4427cb);});}function countFilteredInteractions(_0x38085d,_0x309bcf){var _0x2fc138=_0x38085d[_0xf70e('0xa6')]();_0x2fc138[_0xf70e('0xa')](_0xf70e('0xa7'));_0x2fc138[_0xf70e('0xa')](_0xf70e('0x80'),'unreadMessages');var _0x8fcd65=utils[_0xf70e('0xa8')](_0x309bcf);if(!_[_0xf70e('0xa9')](_0x8fcd65)){_0x2fc138['where'](_0xf70e('0xaa'),_0x8fcd65);}var _0xea5902={'type':db['Sequelize'][_0xf70e('0x78')][_0xf70e('0x79')],'raw':!![]};return db[_0xf70e('0x7a')]['query'](_0x2fc138[_0xf70e('0x7c')](),_0xea5902);}module[_0xf70e('0xab')]={'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 2fedbf6..e34ff58 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 _0xa59a=['out','then','lastMsgText','trimStart','plainBody','catch','Users','TagIds','Tags','lodash','../../mysqldb','map','fullname','split','forEach','push','waiting','talking','answered','unmanaged','abandoned','total','closed','disposition','UserId','MailMessage','findOne'];(function(_0x379728,_0x551ed1){var _0x27a313=function(_0x315fba){while(--_0x315fba){_0x379728['push'](_0x379728['shift']());}};_0x27a313(++_0x551ed1);}(_0xa59a,0x1d4));var _0xaa59=function(_0x538d90,_0x4cd5c4){_0x538d90=_0x538d90-0x0;var _0x21b355=_0xa59a[_0x538d90];return _0x21b355;};'use strict';var _=require(_0xaa59('0x0'));var db=require(_0xaa59('0x1'))['db'];function getInteractionUsers(_0x2575b6,_0x28eccc){return new Promise(function(_0x76664b,_0x26d9ac){try{var _0x3cab8f=[];if(_0x28eccc[_0x2575b6]){_0x3cab8f=_0x28eccc[_0x2575b6][_0xaa59('0x2')](function(_0x773cf2){return{'id':_0x773cf2['id'],'fullname':_0x773cf2[_0xaa59('0x3')]};});}return _0x76664b(_0x3cab8f);}catch(_0x5755d0){_0x26d9ac(_0x5755d0);}});}function getInteractionTags(_0xbe1ad7,_0x40dd30){var _0x2a0194=[];if(_0xbe1ad7){_0xbe1ad7[_0xaa59('0x4')](',')[_0xaa59('0x5')](function(_0xebafcc){_0x2a0194[_0xaa59('0x6')](_0x40dd30[_0xebafcc]);});}return _0x2a0194;}function updateWaitingCounter(_0x50fa80){if(_0x50fa80[_0xaa59('0x7')]){_0x50fa80[_0xaa59('0x7')]-=0x1;}}function updateInteractionCounters(_0x5cde09){_0x5cde09['waiting']=0x0;_0x5cde09[_0xaa59('0x8')]=0x0;_0x5cde09[_0xaa59('0x9')]=0x0;_0x5cde09[_0xaa59('0xa')]=0x0;_0x5cde09[_0xaa59('0xb')]=0x0;_0x5cde09[_0xaa59('0xc')]=0x0;if(_0x5cde09[_0xaa59('0xd')]){if(_0x5cde09[_0xaa59('0xe')]===_0xaa59('0xb')){_0x5cde09[_0xaa59('0xb')]+=0x1;updateWaitingCounter(_0x5cde09);}if(_0x5cde09[_0xaa59('0xf')]){_0x5cde09[_0xaa59('0x9')]+=0x1;if(_0x5cde09[_0xaa59('0x8')]){_0x5cde09[_0xaa59('0x8')]-=0x1;}}else{if(_0x5cde09[_0xaa59('0xe')]){_0x5cde09[_0xaa59('0xa')]+=0x1;updateWaitingCounter(_0x5cde09);}}}else{if(!_0x5cde09[_0xaa59('0xf')]){_0x5cde09[_0xaa59('0x7')]+=0x1;}if(_0x5cde09[_0xaa59('0xf')]){_0x5cde09[_0xaa59('0x8')]+=0x1;updateWaitingCounter(_0x5cde09);}}_0x5cde09[_0xaa59('0xc')]+=0x1;return _0x5cde09;}function getLastMessageText(_0x520b8a){return db[_0xaa59('0x10')][_0xaa59('0x11')]({'where':{'$and':[{'MailInteractionId':_0x520b8a['id']},{'$or':[{'direction':'in'},{'$and':[{'direction':_0xaa59('0x12')},{'secret':![]},{'UserId':{'$ne':null}}]}]}]},'attributes':['plainBody'],'order':'-id','raw':!![]})[_0xaa59('0x13')](function(_0x1a21dd){if(_0x1a21dd&&_0x1a21dd['plainBody']){_0x520b8a[_0xaa59('0x14')]=_[_0xaa59('0x15')](_0x1a21dd[_0xaa59('0x16')]);}return _0x520b8a;})[_0xaa59('0x17')](function(_0x132fc0){throw _0x132fc0;});}exports['updateInteraction']=function(_0x8d8425,_0x351fa8,_0x576f86,_0x484217){return new Promise(function(_0x21d342,_0x82d25){return getInteractionUsers(_0x8d8425['id'],_0x576f86)[_0xaa59('0x13')](function(_0x1144ee){_0x8d8425[_0xaa59('0x18')]=_0x1144ee;return getInteractionTags(_0x8d8425[_0xaa59('0x19')],_0x351fa8);})[_0xaa59('0x13')](function(_0x4bf82b){_0x8d8425[_0xaa59('0x1a')]=_0x4bf82b;delete _0x8d8425['TagIds'];return updateInteractionCounters(_0x8d8425);})['then'](function(_0x1c22ec){if(_0x484217){return getLastMessageText(_0x1c22ec);}else{return _0x1c22ec;}})[_0xaa59('0x13')](function(_0x443072){_0x21d342(_0x443072);})[_0xaa59('0x17')](function(_0x5d91aa){_0x82d25(_0x5d91aa);});});}; \ No newline at end of file +var _0x7685=['talking','MailMessage','findOne','out','plainBody','-id','then','trimStart','catch','updateInteraction','Users','TagIds','Tags','../../mysqldb','split','forEach','push','waiting','answered','unmanaged','abandoned','total','closed','disposition','UserId'];(function(_0x5a776b,_0x46f785){var _0xbbef59=function(_0x38313e){while(--_0x38313e){_0x5a776b['push'](_0x5a776b['shift']());}};_0xbbef59(++_0x46f785);}(_0x7685,0x152));var _0x5768=function(_0x5d8414,_0xc6aab5){_0x5d8414=_0x5d8414-0x0;var _0x296851=_0x7685[_0x5d8414];return _0x296851;};'use strict';var _=require('lodash');var db=require(_0x5768('0x0'))['db'];function getInteractionUsers(_0x5da319,_0x28611b){return new Promise(function(_0xac764c,_0x49fef1){try{var _0x435a67=[];if(_0x28611b[_0x5da319]){_0x435a67=_0x28611b[_0x5da319]['map'](function(_0x31d60f){return{'id':_0x31d60f['id'],'fullname':_0x31d60f['fullname']};});}return _0xac764c(_0x435a67);}catch(_0x5114f9){_0x49fef1(_0x5114f9);}});}function getInteractionTags(_0x4a4568,_0x175386){var _0x5f049b=[];if(_0x4a4568){_0x4a4568[_0x5768('0x1')](',')[_0x5768('0x2')](function(_0x1922ab){_0x5f049b[_0x5768('0x3')](_0x175386[_0x1922ab]);});}return _0x5f049b;}function updateWaitingCounter(_0x28c97e){if(_0x28c97e[_0x5768('0x4')]){_0x28c97e[_0x5768('0x4')]-=0x1;}}function updateInteractionCounters(_0x330d98){_0x330d98[_0x5768('0x4')]=0x0;_0x330d98['talking']=0x0;_0x330d98[_0x5768('0x5')]=0x0;_0x330d98[_0x5768('0x6')]=0x0;_0x330d98[_0x5768('0x7')]=0x0;_0x330d98[_0x5768('0x8')]=0x0;if(_0x330d98[_0x5768('0x9')]){if(_0x330d98[_0x5768('0xa')]===_0x5768('0x7')){_0x330d98[_0x5768('0x7')]+=0x1;updateWaitingCounter(_0x330d98);}if(_0x330d98[_0x5768('0xb')]){_0x330d98[_0x5768('0x5')]+=0x1;if(_0x330d98[_0x5768('0xc')]){_0x330d98[_0x5768('0xc')]-=0x1;}}else{if(_0x330d98[_0x5768('0xa')]){_0x330d98[_0x5768('0x6')]+=0x1;updateWaitingCounter(_0x330d98);}}}else{if(!_0x330d98[_0x5768('0xb')]){_0x330d98['waiting']+=0x1;}if(_0x330d98[_0x5768('0xb')]){_0x330d98[_0x5768('0xc')]+=0x1;updateWaitingCounter(_0x330d98);}}_0x330d98[_0x5768('0x8')]+=0x1;return _0x330d98;}function getLastMessageText(_0x336344){return db[_0x5768('0xd')][_0x5768('0xe')]({'where':{'$and':[{'MailInteractionId':_0x336344['id']},{'$or':[{'direction':'in'},{'$and':[{'direction':_0x5768('0xf')},{'secret':![]},{'UserId':{'$ne':null}}]}]}]},'attributes':[_0x5768('0x10')],'order':_0x5768('0x11'),'raw':!![]})[_0x5768('0x12')](function(_0x34a060){if(_0x34a060&&_0x34a060[_0x5768('0x10')]){_0x336344['lastMsgText']=_[_0x5768('0x13')](_0x34a060[_0x5768('0x10')]);}return _0x336344;})[_0x5768('0x14')](function(_0x50418c){throw _0x50418c;});}exports[_0x5768('0x15')]=function(_0x431cff,_0x890b69,_0x3afb3b,_0x2fb94c){return new Promise(function(_0x49d843,_0x57504e){return getInteractionUsers(_0x431cff['id'],_0x3afb3b)[_0x5768('0x12')](function(_0x506982){_0x431cff[_0x5768('0x16')]=_0x506982;return getInteractionTags(_0x431cff[_0x5768('0x17')],_0x890b69);})['then'](function(_0x30071b){_0x431cff[_0x5768('0x18')]=_0x30071b;delete _0x431cff[_0x5768('0x17')];return updateInteractionCounters(_0x431cff);})[_0x5768('0x12')](function(_0xbdb0c3){if(_0x2fb94c){return getLastMessageText(_0xbdb0c3);}else{return _0xbdb0c3;}})[_0x5768('0x12')](function(_0x48663c){_0x49d843(_0x48663c);})[_0x5768('0x14')](function(_0x41f264){_0x57504e(_0x41f264);});});}; \ No newline at end of file diff --git a/server/components/interaction/utils.js b/server/components/interaction/utils.js index 8f2db9b..06d59e6 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 _0x65ce=['Account','upperFirst','InteractionId','unknown','websites','accounts','_messages','user_has_','isArray','[%s]\x20id=%s\x20name=%s\x20role=%s\x20interaction=%s\x20body=%s','toUpperCase','name','role','stringify','null','Interaction','findOne','update','info','catch','error','exports','lodash','../../mysqldb','../../config/logger','openchannel-interactions','mail-interactions','fax-interactions','chat-interactions','whatsapp-interactions','capitalize','chat','Website'];(function(_0x2aadba,_0x40176f){var _0x1aa1b3=function(_0x36bbe8){while(--_0x36bbe8){_0x2aadba['push'](_0x2aadba['shift']());}};_0x1aa1b3(++_0x40176f);}(_0x65ce,0xdc));var _0xe65c=function(_0x3cbc00,_0x563224){_0x3cbc00=_0x3cbc00-0x0;var _0x45dfd1=_0x65ce[_0x3cbc00];return _0x45dfd1;};'use strict';var _=require(_0xe65c('0x0'));var db=require(_0xe65c('0x1'))['db'];var loggers={'openchannel':require(_0xe65c('0x2'))(_0xe65c('0x3')),'mail':require(_0xe65c('0x2'))(_0xe65c('0x4')),'fax':require(_0xe65c('0x2'))(_0xe65c('0x5')),'sms':require(_0xe65c('0x2'))('sms-interactions'),'chat':require(_0xe65c('0x2'))(_0xe65c('0x6')),'whatsapp':require('../../config/logger')(_0xe65c('0x7'))};function getAccountFK(_0x4852f1){return _[_0xe65c('0x8')](_0x4852f1)+(_0x4852f1===_0xe65c('0x9')?_0xe65c('0xa'):_0xe65c('0xb'))+'Id';}function getInteractionFK(_0x500f26){return _[_0xe65c('0x8')](_0x500f26)+'InteractionId';}function getInteractionId(_0x3e74d9,_0x4d9afe,_0x4559be){if(_0x3e74d9&&_0x3e74d9[_[_0xe65c('0xc')](_0x4559be)+'InteractionId']){return _0x3e74d9[_[_0xe65c('0xc')](_0x4559be)+_0xe65c('0xd')];}else if(_0x3e74d9&&_0x3e74d9['id']){return _0x3e74d9['id'];}else if(_0x4d9afe&&_0x4d9afe['id']){return _0x4d9afe['id'];}else{return _0xe65c('0xe');}}function getInteractionsTables(_0x5c8617){return{'accounts':_0x5c8617+'_'+(_0x5c8617===_0xe65c('0x9')?_0xe65c('0xf'):_0xe65c('0x10')),'interactions':_0x5c8617+'_interactions','interactionsTags':_0x5c8617+'_interaction_has_tags','messages':_0x5c8617+_0xe65c('0x11'),'userInteractions':_0xe65c('0x12')+_0x5c8617+'_interactions'};}function getSelectedTags(_0x2a49a2){var _0x173e8f=[];if(_0x2a49a2){_0x173e8f=Array[_0xe65c('0x13')](_0x2a49a2)?_0x2a49a2:[_0x2a49a2];}return _0x173e8f;}function log(_0x2bd63a,_0x141223,_0x16665e,_0x492bcc,_0x580c3a,_0x4bc13b){loggers[_0x580c3a['toLowerCase']()][_0x2bd63a](_0xe65c('0x14'),_0x4bc13b[_0xe65c('0x15')](),_0x141223?_0x141223['id']:null,_0x141223?_0x141223[_0xe65c('0x16')]:null,_0x141223?_0x141223[_0xe65c('0x17')]:null,getInteractionId(_0x16665e,_0x492bcc,_0x580c3a),_0x16665e?JSON[_0xe65c('0x18')](_0x16665e):_0xe65c('0x19'));}function updateUser(_0x27d634,_0x1ff06c,_0x2c5b8f,_0x1e6c6f,_0x2d090f){db[_[_0xe65c('0xc')](_0x1e6c6f)+_0xe65c('0x1a')][_0xe65c('0x1b')]({'where':{'id':getInteractionId(_0x1ff06c,_0x2c5b8f,_0x1e6c6f)}})['then'](function(_0x159ef9){if(_0x159ef9){return _0x159ef9[_0xe65c('0x1c')]({'UserId':_0x27d634?_0x27d634['id']:null});}})['then'](function(_0x1e1a50){if(_0x1e1a50){log(_0xe65c('0x1d'),_0x27d634,_0x1ff06c,_0x2c5b8f,_0x1e6c6f,_0x2d090f);}})[_0xe65c('0x1e')](function(){log(_0xe65c('0x1f'),_0x27d634,_0x1ff06c,_0x2c5b8f,_0x1e6c6f,_0x2d090f);});}module[_0xe65c('0x20')]={'getAccountFK':getAccountFK,'getInteractionFK':getInteractionFK,'getInteractionsTables':getInteractionsTables,'getSelectedTags':getSelectedTags,'updateUser':updateUser}; \ No newline at end of file +var _0x0cc0=['InteractionId','upperFirst','websites','accounts','_interactions','_interaction_has_tags','user_has_','isArray','[%s]\x20id=%s\x20name=%s\x20role=%s\x20interaction=%s\x20body=%s','toUpperCase','name','role','stringify','null','Interaction','findOne','update','then','info','catch','error','exports','lodash','../../config/logger','openchannel-interactions','mail-interactions','fax-interactions','sms-interactions','chat-interactions','whatsapp-interactions','chat','Website','Account'];(function(_0x4a2e2c,_0x40aeb7){var _0x3c5f82=function(_0x235161){while(--_0x235161){_0x4a2e2c['push'](_0x4a2e2c['shift']());}};_0x3c5f82(++_0x40aeb7);}(_0x0cc0,0x11e));var _0x00cc=function(_0x4bfa09,_0x16e15a){_0x4bfa09=_0x4bfa09-0x0;var _0x52d256=_0x0cc0[_0x4bfa09];return _0x52d256;};'use strict';var _=require(_0x00cc('0x0'));var db=require('../../mysqldb')['db'];var loggers={'openchannel':require(_0x00cc('0x1'))(_0x00cc('0x2')),'mail':require('../../config/logger')(_0x00cc('0x3')),'fax':require(_0x00cc('0x1'))(_0x00cc('0x4')),'sms':require(_0x00cc('0x1'))(_0x00cc('0x5')),'chat':require(_0x00cc('0x1'))(_0x00cc('0x6')),'whatsapp':require(_0x00cc('0x1'))(_0x00cc('0x7'))};function getAccountFK(_0x1c4ea6){return _['capitalize'](_0x1c4ea6)+(_0x1c4ea6===_0x00cc('0x8')?_0x00cc('0x9'):_0x00cc('0xa'))+'Id';}function getInteractionFK(_0x3f43b4){return _['capitalize'](_0x3f43b4)+_0x00cc('0xb');}function getInteractionId(_0x88ad40,_0x582b11,_0x49658c){if(_0x88ad40&&_0x88ad40[_[_0x00cc('0xc')](_0x49658c)+_0x00cc('0xb')]){return _0x88ad40[_[_0x00cc('0xc')](_0x49658c)+_0x00cc('0xb')];}else if(_0x88ad40&&_0x88ad40['id']){return _0x88ad40['id'];}else if(_0x582b11&&_0x582b11['id']){return _0x582b11['id'];}else{return'unknown';}}function getInteractionsTables(_0x38d3ac){return{'accounts':_0x38d3ac+'_'+(_0x38d3ac===_0x00cc('0x8')?_0x00cc('0xd'):_0x00cc('0xe')),'interactions':_0x38d3ac+_0x00cc('0xf'),'interactionsTags':_0x38d3ac+_0x00cc('0x10'),'messages':_0x38d3ac+'_messages','userInteractions':_0x00cc('0x11')+_0x38d3ac+_0x00cc('0xf')};}function getSelectedTags(_0x1ab475){var _0x5e0dba=[];if(_0x1ab475){_0x5e0dba=Array[_0x00cc('0x12')](_0x1ab475)?_0x1ab475:[_0x1ab475];}return _0x5e0dba;}function log(_0x3aa25b,_0x347584,_0x5ea5cc,_0x220156,_0xe461bc,_0x19eed0){loggers[_0xe461bc['toLowerCase']()][_0x3aa25b](_0x00cc('0x13'),_0x19eed0[_0x00cc('0x14')](),_0x347584?_0x347584['id']:null,_0x347584?_0x347584[_0x00cc('0x15')]:null,_0x347584?_0x347584[_0x00cc('0x16')]:null,getInteractionId(_0x5ea5cc,_0x220156,_0xe461bc),_0x5ea5cc?JSON[_0x00cc('0x17')](_0x5ea5cc):_0x00cc('0x18'));}function updateUser(_0x573aee,_0x3759a8,_0xcb3262,_0x5a3113,_0x257595){db[_[_0x00cc('0xc')](_0x5a3113)+_0x00cc('0x19')][_0x00cc('0x1a')]({'where':{'id':getInteractionId(_0x3759a8,_0xcb3262,_0x5a3113)}})['then'](function(_0x4f7123){if(_0x4f7123){return _0x4f7123[_0x00cc('0x1b')]({'UserId':_0x573aee?_0x573aee['id']:null});}})[_0x00cc('0x1c')](function(_0xcc928d){if(_0xcc928d){log(_0x00cc('0x1d'),_0x573aee,_0x3759a8,_0xcb3262,_0x5a3113,_0x257595);}})[_0x00cc('0x1e')](function(){log(_0x00cc('0x1f'),_0x573aee,_0x3759a8,_0xcb3262,_0x5a3113,_0x257595);});}module[_0x00cc('0x20')]={'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 5428925..1e06ac9 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 _0x693d=['crypto','composable-middleware','../../mysqldb','../../config/environment','license','data1','split','createDecipher','aes-256-ctr','%s:%s:%s','update','utf8','final','parse','use','License','findOne','then','count','json','format','Maximum\x20%s\x20limit\x20have\x20been\x20reached','catch','users','user','isUserLimit'];(function(_0x18cac4,_0x57a4d5){var _0x2227c6=function(_0x72934d){while(--_0x72934d){_0x18cac4['push'](_0x18cac4['shift']());}};_0x2227c6(++_0x57a4d5);}(_0x693d,0x68));var _0xd693=function(_0x27b1b7,_0x15bea1){_0x27b1b7=_0x27b1b7-0x0;var _0x477555=_0x693d[_0x27b1b7];return _0x477555;};'use strict';var crypto=require(_0xd693('0x0'));var util=require('util');var compose=require(_0xd693('0x1'));var db=require(_0xd693('0x2'))['db'];var config=require(_0xd693('0x3'));function getValueFromLicense(_0x5570c3,_0x465bc3){if(_0x5570c3&&_0x465bc3){if(_0x465bc3['data1']&&_0x465bc3[_0xd693('0x4')]){var _0x135e57=_0x465bc3[_0xd693('0x5')];var _0x17dfb3=_0x465bc3[_0xd693('0x4')];var _0x58e563=_0x135e57['split']('-')[0x4];var _0x474bd5=_0x135e57[_0xd693('0x6')]('-')[0x0];var _0x23be39=crypto[_0xd693('0x7')](_0xd693('0x8'),util['format'](_0xd693('0x9'),_0x58e563,_0x135e57,_0x474bd5));var _0x5dfad2=_0x23be39[_0xd693('0xa')](_0x17dfb3,'base64',_0xd693('0xb'));_0x5dfad2+=_0x23be39[_0xd693('0xc')](_0xd693('0xb'));var _0x50840e=JSON[_0xd693('0xd')](_0x5dfad2);return _0x50840e['hasOwnProperty'](_0x5570c3)?_0x50840e[_0x5570c3]:null;}}return null;}function isLimit(_0x8428aa,_0x122e03,_0x5698ef,_0x7063ea){var _0x580fa4=_0x122e03;return compose()[_0xd693('0xe')](function(_0x41c1ce,_0x18a53a,_0x35d061){return db[_0xd693('0xf')][_0xd693('0x10')]({'where':{'id':0x1},'raw':!![]})[_0xd693('0x11')](function(_0xfc8447){var _0x5702cc=getValueFromLicense(_0x8428aa,_0xfc8447);return _0x5702cc?_0x5702cc:_0x580fa4;})[_0xd693('0x11')](function(_0x2ff03e){_0x580fa4=_0x2ff03e;return _0x5698ef[_0xd693('0x12')](_0x7063ea);})['then'](function(_0xd1b67c){if(_0xd1b67c>=_0x580fa4){return _0x18a53a['status'](0x193)[_0xd693('0x13')]({'message':util[_0xd693('0x14')](_0xd693('0x15'),_0x8428aa)});}_0x35d061();})[_0xd693('0x16')](function(_0x4fbc2a){_0x35d061(_0x4fbc2a);});});}function isUserLimit(){return isLimit(_0xd693('0x17'),0x1,db['User'],{'where':{'$or':[{'role':'admin'},{'role':_0xd693('0x18')}]}});}exports[_0xd693('0x19')]=isUserLimit; \ No newline at end of file +var _0x11f3=['split','createDecipher','format','%s:%s:%s','update','base64','final','utf8','parse','use','License','findOne','then','status','Maximum\x20%s\x20limit\x20have\x20been\x20reached','catch','isUserLimit','crypto','util','composable-middleware','../../mysqldb','data1','license'];(function(_0x5880ef,_0x5695ff){var _0x47ed37=function(_0x731ed2){while(--_0x731ed2){_0x5880ef['push'](_0x5880ef['shift']());}};_0x47ed37(++_0x5695ff);}(_0x11f3,0xf7));var _0x311f=function(_0x1cfd7c,_0x101b1d){_0x1cfd7c=_0x1cfd7c-0x0;var _0x52845d=_0x11f3[_0x1cfd7c];return _0x52845d;};'use strict';var crypto=require(_0x311f('0x0'));var util=require(_0x311f('0x1'));var compose=require(_0x311f('0x2'));var db=require(_0x311f('0x3'))['db'];var config=require('../../config/environment');function getValueFromLicense(_0x395dbf,_0x4f8ce3){if(_0x395dbf&&_0x4f8ce3){if(_0x4f8ce3[_0x311f('0x4')]&&_0x4f8ce3[_0x311f('0x5')]){var _0x10ffba=_0x4f8ce3[_0x311f('0x4')];var _0x345c72=_0x4f8ce3[_0x311f('0x5')];var _0x3aa651=_0x10ffba[_0x311f('0x6')]('-')[0x4];var _0xfd91d0=_0x10ffba[_0x311f('0x6')]('-')[0x0];var _0x3b48ce=crypto[_0x311f('0x7')]('aes-256-ctr',util[_0x311f('0x8')](_0x311f('0x9'),_0x3aa651,_0x10ffba,_0xfd91d0));var _0x1bacb7=_0x3b48ce[_0x311f('0xa')](_0x345c72,_0x311f('0xb'),'utf8');_0x1bacb7+=_0x3b48ce[_0x311f('0xc')](_0x311f('0xd'));var _0x30bfdc=JSON[_0x311f('0xe')](_0x1bacb7);return _0x30bfdc['hasOwnProperty'](_0x395dbf)?_0x30bfdc[_0x395dbf]:null;}}return null;}function isLimit(_0x15dc80,_0x2d6112,_0x5a82eb,_0x361777){var _0x49e02d=_0x2d6112;return compose()[_0x311f('0xf')](function(_0x25ead6,_0x4fe384,_0x3de978){return db[_0x311f('0x10')][_0x311f('0x11')]({'where':{'id':0x1},'raw':!![]})['then'](function(_0x3569a3){var _0x158666=getValueFromLicense(_0x15dc80,_0x3569a3);return _0x158666?_0x158666:_0x49e02d;})[_0x311f('0x12')](function(_0x398321){_0x49e02d=_0x398321;return _0x5a82eb['count'](_0x361777);})[_0x311f('0x12')](function(_0x4eb6c5){if(_0x4eb6c5>=_0x49e02d){return _0x4fe384[_0x311f('0x13')](0x193)['json']({'message':util[_0x311f('0x8')](_0x311f('0x14'),_0x15dc80)});}_0x3de978();})[_0x311f('0x15')](function(_0x7d52b8){_0x3de978(_0x7d52b8);});});}function isUserLimit(){return isLimit('users',0x1,db['User'],{'where':{'$or':[{'role':'admin'},{'role':'user'}]}});}exports[_0x311f('0x16')]=isUserLimit; \ No newline at end of file diff --git a/server/components/parsers/advancedSearch.js b/server/components/parsers/advancedSearch.js index b32308d..25102a5 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 _0x7147=['BETWEEN\x20?\x20AND\x20?','start','$endsWith','utcOffset','add','minutes','seconds','moment','parseSearch','sqlOperator','startsWith','[$or]','and','replace','split','length','slice','forEach','shift','match','indexOf','conditions','push','buildExpression','DATE','operator','$eq','$between','value','$gt','$lte','days','format','YYYY-MM-DD','castTo','text','CAST(','\x20AS\x20','field','includes','$notIn','\x20IS\x20NULL)','IN\x20?','NOT\x20IN\x20?','$ne','<>\x20?','$substring','$startsWith','LIKE\x20?','<\x20?','>\x20?','<=\x20?','$gte','>=\x20?'];(function(_0x431a22,_0x131d2d){var _0x10c558=function(_0x393b8c){while(--_0x393b8c){_0x431a22['push'](_0x431a22['shift']());}};_0x10c558(++_0x131d2d);}(_0x7147,0x14b));var _0x7714=function(_0x91384,_0x545eef){_0x91384=_0x91384-0x0;var _0x44daa0=_0x7147[_0x91384];return _0x44daa0;};'use strict';var _=require('lodash');var moment=require(_0x7714('0x0'));exports[_0x7714('0x1')]=function(_0x2739df){var _0x3fd9a9={'conditions':[]};_0x3fd9a9[_0x7714('0x2')]=_[_0x7714('0x3')](_0x2739df,_0x7714('0x4'))?'or':_0x7714('0x5');var _0x14ef0d=_0x2739df['replace']('[$and]','')[_0x7714('0x6')](_0x7714('0x4'),'')[_0x7714('0x7')]('||');for(var _0x4fd9f4=0x0;_0x4fd9f4<_0x14ef0d[_0x7714('0x8')];_0x4fd9f4++){var _0x2dd361=_0x14ef0d[_0x4fd9f4][_0x7714('0x7')](':=');var _0x122b41=_0x2dd361[0x0];var _0x91ce36=_0x2dd361[_0x7714('0x9')](0x1);_0x91ce36[_0x7714('0xa')](function(_0x1c2b2f){var _0x1e7144=_0x1c2b2f[_0x7714('0x7')]('[')[_0x7714('0xb')]();var _0x45568a=_0x1c2b2f[_0x7714('0xc')](/\[(.*?)\]/g);_0x45568a['forEach'](function(_0x2943b9){var _0x5cb639=_0x2943b9[_0x7714('0x7')]('[')['filter'](function(_0x4faf90){return _0x4faf90[_0x7714('0xd')](']')>-0x1;})['map'](function(_0x11d4e2){return _0x11d4e2[_0x7714('0x7')](']')[0x0];})[0x0];_0x3fd9a9[_0x7714('0xe')][_0x7714('0xf')]({'field':_0x122b41,'operator':_0x1e7144,'value':_0x5cb639});});});}return _0x3fd9a9;};exports[_0x7714('0x10')]=function(_0x50d6d8,_0xe565bf,_0x4b302d){var _0x2fffe1={};if(_0xe565bf===_0x7714('0x11')){if(_0x4b302d[_0x7714('0x12')]===_0x7714('0x13')){_0x4b302d['operator']=_0x7714('0x14');_0x4b302d['value']+=','+_0x4b302d[_0x7714('0x15')];}else if(_['includes']([_0x7714('0x16'),_0x7714('0x17')],_0x4b302d[_0x7714('0x12')])){_0x4b302d[_0x7714('0x15')]=moment(_0x4b302d['value'])['add'](0x1,_0x7714('0x18'))[_0x7714('0x19')](_0x7714('0x1a'));}}if(_0x4b302d[_0x7714('0x1b')]){_0xe565bf=_0x4b302d['castTo'];_0x2fffe1[_0x7714('0x1c')]=_0x7714('0x1d')+_0x50d6d8+'.'+_0x4b302d['field']+_0x7714('0x1e')+_0x4b302d[_0x7714('0x1b')]+')\x20'+parseOperator(_0x4b302d[_0x7714('0x12')]);}else{_0x2fffe1[_0x7714('0x1c')]=_0x50d6d8+'.'+_0x4b302d[_0x7714('0x1f')]+'\x20'+parseOperator(_0x4b302d[_0x7714('0x12')]);}if(_[_0x7714('0x20')](['$ne',_0x7714('0x21')],_0x4b302d['operator']))_0x2fffe1[_0x7714('0x1c')]='('+_0x2fffe1[_0x7714('0x1c')]+'\x20OR\x20'+_0x50d6d8+'.'+_0x4b302d['field']+_0x7714('0x22');_0x2fffe1[_0x7714('0x15')]=parseValue(_0xe565bf,_0x4b302d[_0x7714('0x12')],_0x4b302d[_0x7714('0x15')]);return _0x2fffe1;};function parseOperator(_0x31142a){var _0x578e7b;switch(_0x31142a){case'$in':_0x578e7b=_0x7714('0x23');break;case'$notIn':_0x578e7b=_0x7714('0x24');break;case _0x7714('0x13'):_0x578e7b='=\x20?';break;case _0x7714('0x25'):_0x578e7b=_0x7714('0x26');break;case _0x7714('0x27'):case _0x7714('0x28'):case'$endsWith':_0x578e7b=_0x7714('0x29');break;case'$lt':_0x578e7b=_0x7714('0x2a');break;case _0x7714('0x16'):_0x578e7b=_0x7714('0x2b');break;case _0x7714('0x17'):_0x578e7b=_0x7714('0x2c');break;case _0x7714('0x2d'):_0x578e7b=_0x7714('0x2e');break;case _0x7714('0x14'):_0x578e7b=_0x7714('0x2f');break;}return _0x578e7b;}function parseValue(_0x5bf50d,_0x15e436,_0x15d7a6){var _0xc8830={'start':undefined,'end':undefined};switch(_0x15e436){case'$in':case _0x7714('0x21'):_0xc8830['start']=_0x15d7a6[_0x7714('0x7')](',');break;case _0x7714('0x27'):_0xc8830[_0x7714('0x30')]='%'+_0x15d7a6+'%';break;case _0x7714('0x28'):_0xc8830['start']=_0x15d7a6+'%';break;case _0x7714('0x31'):_0xc8830['start']='%'+_0x15d7a6;break;case _0x7714('0x14'):var _0x80fcf7=_0x15d7a6['split'](',');var _0x15d7a6=_0x80fcf7[_0x7714('0xb')]();var _0x229206=_0x80fcf7['pop']();if(_0x5bf50d===_0x7714('0x11')){_0x15d7a6=moment(_0x15d7a6)['utcOffset'](0x0,!![])[_0x7714('0x19')]();_0x229206=moment(_0x229206)[_0x7714('0x32')](0x0,!![])[_0x7714('0x33')](0x17,'hours')[_0x7714('0x33')](0x3b,_0x7714('0x34'))[_0x7714('0x33')](0x3b,_0x7714('0x35'))[_0x7714('0x19')]();}_0xc8830={'start':_0x15d7a6,'end':_0x229206};break;default:_0xc8830[_0x7714('0x30')]=_0x15d7a6;break;}return _0xc8830;} \ No newline at end of file +var _0xd65c=['\x20IS\x20NULL)','$in','IN\x20?','=\x20?','<>\x20?','$substring','$startsWith','LIKE\x20?','$lt','<\x20?','$gt','>\x20?','>=\x20?','start','pop','utcOffset','seconds','lodash','moment','parseSearch','startsWith','[$or]','and','replace','[$and]','split','slice','forEach','shift','match','filter','map','conditions','push','buildExpression','DATE','operator','$eq','$between','value','includes','$lte','add','format','YYYY-MM-DD','castTo','field','\x20AS\x20','$ne','$notIn','text','\x20OR\x20'];(function(_0x343a67,_0x22d166){var _0x4954ea=function(_0xaf4b1b){while(--_0xaf4b1b){_0x343a67['push'](_0x343a67['shift']());}};_0x4954ea(++_0x22d166);}(_0xd65c,0x1b1));var _0xcd65=function(_0xe94aeb,_0x2487a0){_0xe94aeb=_0xe94aeb-0x0;var _0x39553a=_0xd65c[_0xe94aeb];return _0x39553a;};'use strict';var _=require(_0xcd65('0x0'));var moment=require(_0xcd65('0x1'));exports[_0xcd65('0x2')]=function(_0x38f78a){var _0x2aad84={'conditions':[]};_0x2aad84['sqlOperator']=_[_0xcd65('0x3')](_0x38f78a,_0xcd65('0x4'))?'or':_0xcd65('0x5');var _0x1ae03e=_0x38f78a[_0xcd65('0x6')](_0xcd65('0x7'),'')[_0xcd65('0x6')](_0xcd65('0x4'),'')[_0xcd65('0x8')]('||');for(var _0x3736fb=0x0;_0x3736fb<_0x1ae03e['length'];_0x3736fb++){var _0x55cf42=_0x1ae03e[_0x3736fb][_0xcd65('0x8')](':=');var _0x1e7645=_0x55cf42[0x0];var _0x3f3905=_0x55cf42[_0xcd65('0x9')](0x1);_0x3f3905[_0xcd65('0xa')](function(_0x564433){var _0x3af5ec=_0x564433[_0xcd65('0x8')]('[')[_0xcd65('0xb')]();var _0x255f77=_0x564433[_0xcd65('0xc')](/\[(.*?)\]/g);_0x255f77[_0xcd65('0xa')](function(_0x27c7f9){var _0x52a9a1=_0x27c7f9[_0xcd65('0x8')]('[')[_0xcd65('0xd')](function(_0x5eb3d4){return _0x5eb3d4['indexOf'](']')>-0x1;})[_0xcd65('0xe')](function(_0x41f624){return _0x41f624['split'](']')[0x0];})[0x0];_0x2aad84[_0xcd65('0xf')][_0xcd65('0x10')]({'field':_0x1e7645,'operator':_0x3af5ec,'value':_0x52a9a1});});});}return _0x2aad84;};exports[_0xcd65('0x11')]=function(_0x4cda11,_0x18ada6,_0x109da3){var _0x569e10={};if(_0x18ada6===_0xcd65('0x12')){if(_0x109da3[_0xcd65('0x13')]===_0xcd65('0x14')){_0x109da3[_0xcd65('0x13')]=_0xcd65('0x15');_0x109da3['value']+=','+_0x109da3[_0xcd65('0x16')];}else if(_[_0xcd65('0x17')](['$gt',_0xcd65('0x18')],_0x109da3[_0xcd65('0x13')])){_0x109da3['value']=moment(_0x109da3[_0xcd65('0x16')])[_0xcd65('0x19')](0x1,'days')[_0xcd65('0x1a')](_0xcd65('0x1b'));}}if(_0x109da3[_0xcd65('0x1c')]){_0x18ada6=_0x109da3[_0xcd65('0x1c')];_0x569e10['text']='CAST('+_0x4cda11+'.'+_0x109da3[_0xcd65('0x1d')]+_0xcd65('0x1e')+_0x109da3[_0xcd65('0x1c')]+')\x20'+parseOperator(_0x109da3[_0xcd65('0x13')]);}else{_0x569e10['text']=_0x4cda11+'.'+_0x109da3['field']+'\x20'+parseOperator(_0x109da3[_0xcd65('0x13')]);}if(_[_0xcd65('0x17')]([_0xcd65('0x1f'),_0xcd65('0x20')],_0x109da3['operator']))_0x569e10[_0xcd65('0x21')]='('+_0x569e10[_0xcd65('0x21')]+_0xcd65('0x22')+_0x4cda11+'.'+_0x109da3[_0xcd65('0x1d')]+_0xcd65('0x23');_0x569e10[_0xcd65('0x16')]=parseValue(_0x18ada6,_0x109da3['operator'],_0x109da3[_0xcd65('0x16')]);return _0x569e10;};function parseOperator(_0x5ceb99){var _0xf5f00a;switch(_0x5ceb99){case _0xcd65('0x24'):_0xf5f00a=_0xcd65('0x25');break;case'$notIn':_0xf5f00a='NOT\x20IN\x20?';break;case'$eq':_0xf5f00a=_0xcd65('0x26');break;case'$ne':_0xf5f00a=_0xcd65('0x27');break;case _0xcd65('0x28'):case _0xcd65('0x29'):case'$endsWith':_0xf5f00a=_0xcd65('0x2a');break;case _0xcd65('0x2b'):_0xf5f00a=_0xcd65('0x2c');break;case _0xcd65('0x2d'):_0xf5f00a=_0xcd65('0x2e');break;case'$lte':_0xf5f00a='<=\x20?';break;case'$gte':_0xf5f00a=_0xcd65('0x2f');break;case _0xcd65('0x15'):_0xf5f00a='BETWEEN\x20?\x20AND\x20?';break;}return _0xf5f00a;}function parseValue(_0x1d7db3,_0x18e458,_0x2c4b20){var _0x2f3784={'start':undefined,'end':undefined};switch(_0x18e458){case _0xcd65('0x24'):case'$notIn':_0x2f3784['start']=_0x2c4b20[_0xcd65('0x8')](',');break;case _0xcd65('0x28'):_0x2f3784[_0xcd65('0x30')]='%'+_0x2c4b20+'%';break;case _0xcd65('0x29'):_0x2f3784[_0xcd65('0x30')]=_0x2c4b20+'%';break;case'$endsWith':_0x2f3784[_0xcd65('0x30')]='%'+_0x2c4b20;break;case'$between':var _0x463337=_0x2c4b20[_0xcd65('0x8')](',');var _0x2c4b20=_0x463337[_0xcd65('0xb')]();var _0x432e98=_0x463337[_0xcd65('0x31')]();if(_0x1d7db3===_0xcd65('0x12')){_0x2c4b20=moment(_0x2c4b20)[_0xcd65('0x32')](0x0,!![])[_0xcd65('0x1a')]();_0x432e98=moment(_0x432e98)[_0xcd65('0x32')](0x0,!![])[_0xcd65('0x19')](0x17,'hours')['add'](0x3b,'minutes')[_0xcd65('0x19')](0x3b,_0xcd65('0x33'))['format']();}_0x2f3784={'start':_0x2c4b20,'end':_0x432e98};break;default:_0x2f3784['start']=_0x2c4b20;break;}return _0x2f3784;} \ No newline at end of file diff --git a/server/components/parsers/qs.js b/server/components/parsers/qs.js index 8987a8d..bb7852e 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 _0x813a=['substr','DESC','cast','length','isObject','isString','unset','hasOwnProperty','isNumeric','match','^[+]?[0-9]*$','isEmail','getFullTextValue','\x22{EXPR}\x22','replace','trim','push','{EXPR}','join','getOptions','query','$id','map','name','intersection','attributes','order','where','pick','filter','object','columns','value','merge','VIRTUAL','lower','options','include','includeAll','keys','escapeLIKESpecialChars','lodash','sequelize','moment','../../mysqldb','includes','parse','model','alias','fields','raw','split','filters','forOwn','type','isPlainObject','$gte','format','YYYY-MM-DD','utc','$lte','subtract','uniqueid','isArray','limit','offset','sort','priority','col','unsigned'];(function(_0x396797,_0x5d0b91){var _0x3f7c0a=function(_0x50e5e2){while(--_0x50e5e2){_0x396797['push'](_0x396797['shift']());}};_0x3f7c0a(++_0x5d0b91);}(_0x813a,0x1cd));var _0xa813=function(_0x2cd3c5,_0x4a7d78){_0x2cd3c5=_0x2cd3c5-0x0;var _0x12b475=_0x813a[_0x2cd3c5];return _0x12b475;};'use strict';var _=require(_0xa813('0x0'));var sequelize=require(_0xa813('0x1'));var moment=require(_0xa813('0x2'));var db=require(_0xa813('0x3'))['db'];var LIMIT_VALUE=0xfa;function hasSequelizeOperator(_0xf6d13a){var _0x2b80a5=['ne'];try{var _0x2227c0=JSON['parse'](_0xf6d13a);var _0x1473db=Object['keys'](_0x2227c0)[0x0];return _0x2b80a5[_0xa813('0x4')](_0x1473db);}catch(_0x366e54){return![];}}function getOperatorValue(_0x4ddcc3){var _0x5b015f=JSON[_0xa813('0x5')](_0x4ddcc3);var _0x519993=Object['keys'](_0x5b015f)[0x0];var _0x4cdc96=_0x5b015f[_0x519993];return{['$'+_0x519993]:_0x4cdc96};}function parseIncludeModel(_0xd42deb){var _0x85fe41=JSON['parse'](_0xd42deb);return{'model':db[_0x85fe41[_0xa813('0x6')]],'as':_0x85fe41[_0xa813('0x7')],'attributes':_0x85fe41[_0xa813('0x8')],'raw':_0x85fe41[_0xa813('0x9')]};}exports[_0xa813('0x8')]=function(_0x2e377a){var _0x278598=null;if(_0x2e377a){_0x278598=_0x2e377a[_0xa813('0xa')](',');}return _0x278598;};exports[_0xa813('0xb')]=function(_0x1b02fd,_0x20dc45){var _0x1c1904={};if(!_['isEmpty'](_0x1b02fd)){_[_0xa813('0xc')](_0x1b02fd,function(_0x5f189d,_0x173962){try{if(_0x20dc45){var _0x496c7c=_['find'](_0x20dc45,{'name':_0x173962})||{};if(hasSequelizeOperator(_0x5f189d)){_0x1c1904[_0x173962]=getOperatorValue(_0x5f189d);}else if(_0x496c7c[_0xa813('0xd')]==='DATE'&&_[_0xa813('0xe')](_0x5f189d)){var _0x14ce4b=JSON[_0xa813('0x5')](_0x5f189d);var _0x4289bc={'$gte':moment(moment(_0x14ce4b[_0xa813('0xf')])[_0xa813('0x10')](_0xa813('0x11')))[_0xa813('0x12')]()['format'](),'$lte':moment(moment(_0x14ce4b[_0xa813('0x13')])[_0xa813('0x10')](_0xa813('0x11')))[_0xa813('0x12')]()[_0xa813('0x14')](0x1,'s')[_0xa813('0x10')]()};_0x1c1904[_0x173962]=_0x4289bc;}else if(_0x496c7c['name']===_0xa813('0x15')){_0x1c1904[_0x173962]=_0x5f189d;}else{_0x1c1904[_0x173962]=_[_0xa813('0x16')](_0x5f189d)?_0x5f189d:JSON[_0xa813('0x5')](_0x5f189d);}}else{_0x1c1904[_0x173962]=_[_0xa813('0x16')](_0x5f189d)?_0x5f189d:JSON[_0xa813('0x5')](_0x5f189d);}}catch(_0x106627){_0x1c1904[_0x173962]=_0x5f189d[_0xa813('0xa')](',');}});}return _0x1c1904;};exports[_0xa813('0x17')]=function(_0x4bb624){_0x4bb624=parseInt(_0x4bb624,0xa);if(!_0x4bb624||_0x4bb624<0x0){_0x4bb624=LIMIT_VALUE;}return _0x4bb624;};exports[_0xa813('0x18')]=function(_0x128477){_0x128477=parseInt(_0x128477,0xa);if(!_0x128477||_0x128477<0x0){_0x128477=0x0;}return _0x128477;};exports[_0xa813('0x19')]=function(_0x5de0a4){var _0x15b4f7,_0x3d7e87=null;if(_0x5de0a4){_0x15b4f7=_0x5de0a4[_0xa813('0xa')](',');_0x3d7e87=_['map'](_0x15b4f7,function(_0xda4947){if(_0xda4947['indexOf']('-')===0x0){return[_0xda4947===_0xa813('0x1a')?sequelize['cast'](sequelize[_0xa813('0x1b')](_0xa813('0x1a')),_0xa813('0x1c')):_0xda4947[_0xa813('0x1d')](0x1),_0xa813('0x1e')];}else{return[_0xda4947===_0xa813('0x1a')?sequelize[_0xa813('0x1f')](sequelize[_0xa813('0x1b')]('priority'),_0xa813('0x1c')):_0xda4947,'ASC'];}});}return _0x3d7e87;};exports['omit']=function(_0x14e385,_0xb83c2d){if(_['isEmpty'](_0x14e385)){return _0x14e385;}if(_[_0xa813('0x16')](_0x14e385)){for(var _0x3ef185=0x0;_0x3ef185<_0x14e385[_0xa813('0x20')];_0x3ef185+=0x1){_0x14e385[_0x3ef185]=this['omit'](_0x14e385[_0x3ef185],_0xb83c2d);}return _0x14e385;}if(!_[_0xa813('0x21')](_0x14e385)){return _0x14e385;}if(_[_0xa813('0x22')](_0xb83c2d)){_0xb83c2d=[_0xb83c2d];}if(!_['isArray'](_0xb83c2d)){return _0x14e385;}for(var _0x439f24=0x0;_0x439f24<_0xb83c2d[_0xa813('0x20')];_0x439f24+=0x1){_[_0xa813('0x23')](_0x14e385,_0xb83c2d[_0x439f24]);}for(var _0x28f6ee in _0x14e385){if(_0x14e385[_0xa813('0x24')](_0x28f6ee)){_0x14e385[_0x28f6ee]=this['omit'](_0x14e385[_0x28f6ee],_0xb83c2d);}}return _0x14e385;};exports[_0xa813('0x25')]=function(_0xca6efb){return _0xca6efb[_0xa813('0x26')](RegExp(_0xa813('0x27')))?!![]:![];};exports[_0xa813('0x28')]=function(_0x101fda){return _0x101fda[_0xa813('0x26')](/^\S+@\S+$/)?!![]:![];};exports[_0xa813('0x29')]=function(_0x12973b,_0x29e06c){var _0x37a259=[];var _0x19c83e=/([^:]")"+/g;var _0x1e3b57=/[*<>~@-]/g;var _0x1aca40=/[ `!@#$%^&*()_\-?~<>]/;var _0x5040d7=/[ ,]+/;var _0x3311fc=_0x29e06c?_0xa813('0x2a'):'{EXPR}';if(_0x29e06c){_0x12973b=_0x12973b[_0xa813('0x2b')](_0x1e3b57,'\x20')[_0xa813('0x2c')]();}_0x12973b[_0xa813('0xa')](_0x5040d7)['forEach'](function(_0x1d1e9e){_0x1d1e9e=_0x1d1e9e[_0xa813('0x2b')](_0x19c83e,'$1');_0x1d1e9e='+'+_0x1d1e9e+'*';var _0x1119e9=_0x1d1e9e[_0xa813('0x26')](_0x1aca40);if(_0x1119e9){_0x1d1e9e='\x22'+_0x1d1e9e+'\x22';}_0x37a259[_0xa813('0x2d')](_0x1d1e9e);});_0x3311fc=_0x3311fc['replace'](_0xa813('0x2e'),_0x37a259[_0xa813('0x2f')]('\x20'));return _0x3311fc;};exports[_0xa813('0x30')]=function(_0x3fe20b,_0x323354,_0x2fb827){var _0x29a8b5={},_0x3f2cd3={};if(_0x323354[_0xa813('0x31')][_0xa813('0x32')]){_0x323354[_0xa813('0x31')]['id']=_0x323354[_0xa813('0x31')][_0xa813('0x32')];delete _0x323354[_0xa813('0x31')][_0xa813('0x32')];}_0x29a8b5[_0xa813('0x6')]=_[_0xa813('0x33')](_0x3fe20b,_0xa813('0x34'));_0x29a8b5['query']=_['keys'](_0x323354[_0xa813('0x31')]);_0x29a8b5['filters']=_[_0xa813('0x35')](_0x29a8b5[_0xa813('0x6')],_0x29a8b5[_0xa813('0x31')]);_0x3f2cd3[_0xa813('0x36')]=_['intersection'](_0x29a8b5[_0xa813('0x6')],this['fields'](_0x323354[_0xa813('0x31')][_0xa813('0x8')]));_0x3f2cd3[_0xa813('0x36')]=_0x3f2cd3['attributes'][_0xa813('0x20')]?_0x3f2cd3['attributes']:_0x29a8b5[_0xa813('0x6')];if(!_0x323354[_0xa813('0x31')][_0xa813('0x24')]('nolimit')){_0x3f2cd3[_0xa813('0x17')]=this['limit'](_0x323354[_0xa813('0x31')][_0xa813('0x17')]);_0x3f2cd3['offset']=this[_0xa813('0x18')](_0x323354[_0xa813('0x31')][_0xa813('0x18')]);}_0x3f2cd3[_0xa813('0x37')]=this[_0xa813('0x19')](_0x323354['query'][_0xa813('0x19')]);_0x3f2cd3[_0xa813('0x38')]=this[_0xa813('0xb')](_[_0xa813('0x39')](_0x323354['query'],_0x29a8b5['filters']),_0x3fe20b);if(_0x323354[_0xa813('0x31')][_0xa813('0x3a')]){var _0x283ae9=_0x3fe20b;var _0x4e37fd=_0x323354[_0xa813('0x31')][_0xa813('0x3a')];if(typeof _0x4e37fd===_0xa813('0x3b')){_0x283ae9=_['filter'](_0x3fe20b,function(_0x1c51f2){return _[_0xa813('0x4')](_0x4e37fd[_0xa813('0x3c')],_0x1c51f2[_0xa813('0x34')]);});_0x4e37fd=_0x4e37fd[_0xa813('0x3d')];}_0x3f2cd3[_0xa813('0x38')]=_[_0xa813('0x3e')](_0x3f2cd3[_0xa813('0x38')],{'$or':_['map'](_0x283ae9,function(_0x1d4083){if(_0x1d4083[_0xa813('0xd')]!==_0xa813('0x3f')){if(_0x2fb827){return sequelize[_0xa813('0x38')](sequelize['fn'](_0xa813('0x40'),sequelize[_0xa813('0x1b')](_0x1d4083[_0xa813('0x34')])),{'$like':sequelize['fn'](_0xa813('0x40'),'%'+_0x323354[_0xa813('0x31')][_0xa813('0x3a')]+'%')});}else{var _0x4f01c6={};_0x4f01c6[_0x1d4083[_0xa813('0x34')]]={'$like':'%'+_0x323354['query'][_0xa813('0x3a')]+'%'};return _0x4f01c6;}}})});}_0x3f2cd3=_[_0xa813('0x3e')]({},_0x3f2cd3,_0x323354[_0xa813('0x41')]);return _0x3f2cd3;};exports[_0xa813('0x42')]=function(_0x83b4f7){var _0x2d2639=[];if(_0x83b4f7[_0xa813('0x43')]){_0x2d2639[_0xa813('0x2d')]({'all':!![]});}else if(_0x83b4f7[_0xa813('0x42')]){if(Array[_0xa813('0x16')](_0x83b4f7[_0xa813('0x42')])){_0x2d2639=Object[_0xa813('0x44')](_0x83b4f7[_0xa813('0x42')])[_0xa813('0x33')](function(_0x2f5a97){return parseIncludeModel(_0x83b4f7[_0xa813('0x42')][_0x2f5a97]);});}else{var _0x191fb6=parseIncludeModel(_0x83b4f7[_0xa813('0x42')]);_0x2d2639[_0xa813('0x2d')](_0x191fb6);}}return _0x2d2639;};exports[_0xa813('0x45')]=function(_0x544815){return _0x544815[_0xa813('0x2b')](/[%_^-]/g,function(_0x36d658){return'\x5c'+_0x36d658;});}; \ No newline at end of file +var _0x5f1c=['include','escapeLIKESpecialChars','lodash','sequelize','moment','parse','keys','includes','alias','split','forOwn','find','type','$gte','format','YYYY-MM-DD','$lte','utc','subtract','name','uniqueid','isArray','limit','offset','sort','map','indexOf','priority','cast','col','unsigned','substr','isEmpty','length','omit','isObject','unset','hasOwnProperty','isNumeric','match','^[+]?[0-9]*$','\x22{EXPR}\x22','{EXPR}','trim','forEach','replace','push','join','$id','query','model','filters','intersection','fields','attributes','nolimit','filter','value','where','VIRTUAL','lower','merge','options'];(function(_0x48a836,_0xa1d010){var _0x249dc8=function(_0x2a95a0){while(--_0x2a95a0){_0x48a836['push'](_0x48a836['shift']());}};_0x249dc8(++_0xa1d010);}(_0x5f1c,0xbf));var _0xc5f1=function(_0x5217a9,_0x7fcb07){_0x5217a9=_0x5217a9-0x0;var _0x5e407e=_0x5f1c[_0x5217a9];return _0x5e407e;};'use strict';var _=require(_0xc5f1('0x0'));var sequelize=require(_0xc5f1('0x1'));var moment=require(_0xc5f1('0x2'));var db=require('../../mysqldb')['db'];var LIMIT_VALUE=0xfa;function hasSequelizeOperator(_0x113ccd){var _0x57fd0b=['ne'];try{var _0x10639b=JSON[_0xc5f1('0x3')](_0x113ccd);var _0x3caa87=Object[_0xc5f1('0x4')](_0x10639b)[0x0];return _0x57fd0b[_0xc5f1('0x5')](_0x3caa87);}catch(_0x3d08d7){return![];}}function getOperatorValue(_0x2111d3){var _0x157249=JSON[_0xc5f1('0x3')](_0x2111d3);var _0x5466f9=Object['keys'](_0x157249)[0x0];var _0x47bb41=_0x157249[_0x5466f9];return{['$'+_0x5466f9]:_0x47bb41};}function parseIncludeModel(_0x57736f){var _0x2e7d95=JSON[_0xc5f1('0x3')](_0x57736f);return{'model':db[_0x2e7d95['model']],'as':_0x2e7d95[_0xc5f1('0x6')],'attributes':_0x2e7d95['fields'],'raw':_0x2e7d95['raw']};}exports['fields']=function(_0x2cf442){var _0x39c8f4=null;if(_0x2cf442){_0x39c8f4=_0x2cf442[_0xc5f1('0x7')](',');}return _0x39c8f4;};exports['filters']=function(_0x5c81c7,_0x4c7060){var _0x26465f={};if(!_['isEmpty'](_0x5c81c7)){_[_0xc5f1('0x8')](_0x5c81c7,function(_0x15ec4d,_0x30d911){try{if(_0x4c7060){var _0x722630=_[_0xc5f1('0x9')](_0x4c7060,{'name':_0x30d911})||{};if(hasSequelizeOperator(_0x15ec4d)){_0x26465f[_0x30d911]=getOperatorValue(_0x15ec4d);}else if(_0x722630[_0xc5f1('0xa')]==='DATE'&&_['isPlainObject'](_0x15ec4d)){var _0x177547=JSON[_0xc5f1('0x3')](_0x15ec4d);var _0x3d6c86={'$gte':moment(moment(_0x177547[_0xc5f1('0xb')])[_0xc5f1('0xc')](_0xc5f1('0xd')))['utc']()['format'](),'$lte':moment(moment(_0x177547[_0xc5f1('0xe')])[_0xc5f1('0xc')](_0xc5f1('0xd')))[_0xc5f1('0xf')]()[_0xc5f1('0x10')](0x1,'s')['format']()};_0x26465f[_0x30d911]=_0x3d6c86;}else if(_0x722630[_0xc5f1('0x11')]===_0xc5f1('0x12')){_0x26465f[_0x30d911]=_0x15ec4d;}else{_0x26465f[_0x30d911]=_[_0xc5f1('0x13')](_0x15ec4d)?_0x15ec4d:JSON['parse'](_0x15ec4d);}}else{_0x26465f[_0x30d911]=_['isArray'](_0x15ec4d)?_0x15ec4d:JSON[_0xc5f1('0x3')](_0x15ec4d);}}catch(_0x12b17f){_0x26465f[_0x30d911]=_0x15ec4d['split'](',');}});}return _0x26465f;};exports[_0xc5f1('0x14')]=function(_0x23822e){_0x23822e=parseInt(_0x23822e,0xa);if(!_0x23822e||_0x23822e<0x0){_0x23822e=LIMIT_VALUE;}return _0x23822e;};exports[_0xc5f1('0x15')]=function(_0x341b6a){_0x341b6a=parseInt(_0x341b6a,0xa);if(!_0x341b6a||_0x341b6a<0x0){_0x341b6a=0x0;}return _0x341b6a;};exports[_0xc5f1('0x16')]=function(_0x262079){var _0x4f362d,_0x568a9c=null;if(_0x262079){_0x4f362d=_0x262079[_0xc5f1('0x7')](',');_0x568a9c=_[_0xc5f1('0x17')](_0x4f362d,function(_0x307788){if(_0x307788[_0xc5f1('0x18')]('-')===0x0){return[_0x307788===_0xc5f1('0x19')?sequelize[_0xc5f1('0x1a')](sequelize[_0xc5f1('0x1b')](_0xc5f1('0x19')),_0xc5f1('0x1c')):_0x307788[_0xc5f1('0x1d')](0x1),'DESC'];}else{return[_0x307788===_0xc5f1('0x19')?sequelize[_0xc5f1('0x1a')](sequelize['col']('priority'),_0xc5f1('0x1c')):_0x307788,'ASC'];}});}return _0x568a9c;};exports['omit']=function(_0xe3226d,_0xb34440){if(_[_0xc5f1('0x1e')](_0xe3226d)){return _0xe3226d;}if(_[_0xc5f1('0x13')](_0xe3226d)){for(var _0x37f5f0=0x0;_0x37f5f0<_0xe3226d[_0xc5f1('0x1f')];_0x37f5f0+=0x1){_0xe3226d[_0x37f5f0]=this[_0xc5f1('0x20')](_0xe3226d[_0x37f5f0],_0xb34440);}return _0xe3226d;}if(!_[_0xc5f1('0x21')](_0xe3226d)){return _0xe3226d;}if(_['isString'](_0xb34440)){_0xb34440=[_0xb34440];}if(!_[_0xc5f1('0x13')](_0xb34440)){return _0xe3226d;}for(var _0x4b9cca=0x0;_0x4b9cca<_0xb34440[_0xc5f1('0x1f')];_0x4b9cca+=0x1){_[_0xc5f1('0x22')](_0xe3226d,_0xb34440[_0x4b9cca]);}for(var _0x243773 in _0xe3226d){if(_0xe3226d[_0xc5f1('0x23')](_0x243773)){_0xe3226d[_0x243773]=this[_0xc5f1('0x20')](_0xe3226d[_0x243773],_0xb34440);}}return _0xe3226d;};exports[_0xc5f1('0x24')]=function(_0x52e944){return _0x52e944[_0xc5f1('0x25')](RegExp(_0xc5f1('0x26')))?!![]:![];};exports['isEmail']=function(_0x475f23){return _0x475f23[_0xc5f1('0x25')](/^\S+@\S+$/)?!![]:![];};exports['getFullTextValue']=function(_0x4905a8,_0x8b8dce){var _0x24af3c=[];var _0x337bae=/([^:]")"+/g;var _0x1e1368=/[*<>~@-]/g;var _0x23addb=/[ `!@#$%^&*()_\-?~<>]/;var _0x48e21e=/[ ,]+/;var _0x466e9b=_0x8b8dce?_0xc5f1('0x27'):_0xc5f1('0x28');if(_0x8b8dce){_0x4905a8=_0x4905a8['replace'](_0x1e1368,'\x20')[_0xc5f1('0x29')]();}_0x4905a8['split'](_0x48e21e)[_0xc5f1('0x2a')](function(_0x3d95cf){_0x3d95cf=_0x3d95cf[_0xc5f1('0x2b')](_0x337bae,'$1');_0x3d95cf='+'+_0x3d95cf+'*';var _0x18d402=_0x3d95cf[_0xc5f1('0x25')](_0x23addb);if(_0x18d402){_0x3d95cf='\x22'+_0x3d95cf+'\x22';}_0x24af3c[_0xc5f1('0x2c')](_0x3d95cf);});_0x466e9b=_0x466e9b['replace']('{EXPR}',_0x24af3c[_0xc5f1('0x2d')]('\x20'));return _0x466e9b;};exports['getOptions']=function(_0x1c4cc1,_0x2cfc3a,_0x57f9a0){var _0x2d9281={},_0x2e27a3={};if(_0x2cfc3a['query'][_0xc5f1('0x2e')]){_0x2cfc3a['query']['id']=_0x2cfc3a[_0xc5f1('0x2f')]['$id'];delete _0x2cfc3a[_0xc5f1('0x2f')][_0xc5f1('0x2e')];}_0x2d9281[_0xc5f1('0x30')]=_[_0xc5f1('0x17')](_0x1c4cc1,_0xc5f1('0x11'));_0x2d9281[_0xc5f1('0x2f')]=_['keys'](_0x2cfc3a['query']);_0x2d9281[_0xc5f1('0x31')]=_[_0xc5f1('0x32')](_0x2d9281[_0xc5f1('0x30')],_0x2d9281[_0xc5f1('0x2f')]);_0x2e27a3['attributes']=_['intersection'](_0x2d9281['model'],this[_0xc5f1('0x33')](_0x2cfc3a[_0xc5f1('0x2f')][_0xc5f1('0x33')]));_0x2e27a3[_0xc5f1('0x34')]=_0x2e27a3['attributes'][_0xc5f1('0x1f')]?_0x2e27a3[_0xc5f1('0x34')]:_0x2d9281[_0xc5f1('0x30')];if(!_0x2cfc3a[_0xc5f1('0x2f')]['hasOwnProperty'](_0xc5f1('0x35'))){_0x2e27a3[_0xc5f1('0x14')]=this[_0xc5f1('0x14')](_0x2cfc3a[_0xc5f1('0x2f')]['limit']);_0x2e27a3[_0xc5f1('0x15')]=this['offset'](_0x2cfc3a[_0xc5f1('0x2f')][_0xc5f1('0x15')]);}_0x2e27a3['order']=this[_0xc5f1('0x16')](_0x2cfc3a['query'][_0xc5f1('0x16')]);_0x2e27a3['where']=this['filters'](_['pick'](_0x2cfc3a[_0xc5f1('0x2f')],_0x2d9281['filters']),_0x1c4cc1);if(_0x2cfc3a[_0xc5f1('0x2f')][_0xc5f1('0x36')]){var _0x5b1461=_0x1c4cc1;var _0x3c64ff=_0x2cfc3a[_0xc5f1('0x2f')][_0xc5f1('0x36')];if(typeof _0x3c64ff==='object'){_0x5b1461=_[_0xc5f1('0x36')](_0x1c4cc1,function(_0x2f1fa1){return _[_0xc5f1('0x5')](_0x3c64ff['columns'],_0x2f1fa1[_0xc5f1('0x11')]);});_0x3c64ff=_0x3c64ff[_0xc5f1('0x37')];}_0x2e27a3[_0xc5f1('0x38')]=_['merge'](_0x2e27a3['where'],{'$or':_[_0xc5f1('0x17')](_0x5b1461,function(_0x3b2718){if(_0x3b2718[_0xc5f1('0xa')]!==_0xc5f1('0x39')){if(_0x57f9a0){return sequelize[_0xc5f1('0x38')](sequelize['fn'](_0xc5f1('0x3a'),sequelize[_0xc5f1('0x1b')](_0x3b2718[_0xc5f1('0x11')])),{'$like':sequelize['fn']('lower','%'+_0x2cfc3a[_0xc5f1('0x2f')][_0xc5f1('0x36')]+'%')});}else{var _0xe917f5={};_0xe917f5[_0x3b2718[_0xc5f1('0x11')]]={'$like':'%'+_0x2cfc3a[_0xc5f1('0x2f')]['filter']+'%'};return _0xe917f5;}}})});}_0x2e27a3=_[_0xc5f1('0x3b')]({},_0x2e27a3,_0x2cfc3a[_0xc5f1('0x3c')]);return _0x2e27a3;};exports[_0xc5f1('0x3d')]=function(_0x194916){var _0x18781e=[];if(_0x194916['includeAll']){_0x18781e['push']({'all':!![]});}else if(_0x194916[_0xc5f1('0x3d')]){if(Array[_0xc5f1('0x13')](_0x194916[_0xc5f1('0x3d')])){_0x18781e=Object[_0xc5f1('0x4')](_0x194916['include'])['map'](function(_0x34b197){return parseIncludeModel(_0x194916['include'][_0x34b197]);});}else{var _0xe6231a=parseIncludeModel(_0x194916[_0xc5f1('0x3d')]);_0x18781e[_0xc5f1('0x2c')](_0xe6231a);}}return _0x18781e;};exports[_0xc5f1('0x3e')]=function(_0x2c345e){return _0x2c345e[_0xc5f1('0x2b')](/[%_^-]/g,function(_0x515482){return'\x5c'+_0x515482;});}; \ No newline at end of file diff --git a/server/components/realtime/agents.js b/server/components/realtime/agents.js index 45b88e5..af27a1d 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 _0x42c3=['merge','getRealtimeAgents','*pause','busy','getAgentStatus','isArray','Queue','getAgents','all','flatten','map','uniq','getAgentIdsByQueues','findAll','mailPause','openchannelPause','pauseType','find','catch','getSortedAgentsIdsByStatus','includes','order','startsWith','getUpdatedSortOptions','fullname','internal','substring','indexOf','validateSortParameter','globalStatus','toLowerCase','DESC','userpic','online','lastPauseAt','chatCapacity','openchannelCapacity','mailCapacity','smsCapacity','whatsappCapacity','faxCapacity','chatCurrentCapacity','mailCurrentCapacity','smsCurrentCapacity','whatsappCurrentCapacity','faxCurrentCapacity','openchannelStatusTime','mailStatusTime','smsStatusTime','whatsappStatusTime','voiceStatusTime','queue','destconnectedlinenum','screenrecording','phoneBarEnableScreenRecordingByAgent','phoneBarEnableAutomaticScreenRecording','omit','pick','value','filterAgentAttributes','role','faxStatusTime','openchannelCurrentCapacity','getRealtimeAgentsQueryFields','lodash','jayson/promise','../../mysqldb','http','client','chatPause','faxPause','smsPause','voicePause','whatsappPause','every','filter','length','unknown','unavailable','ringing','idle','voiceStatus','pause','chatStatus','faxStatus','mailStatus','openchannelStatus','smsStatus','whatsappStatus','request','Agents','then','error','Unable\x20to\x20retrieve\x20RPC\x20agents\x20(Routing)','result'];(function(_0x14add3,_0x13ce8d){var _0x4a174f=function(_0x2b3ed7){while(--_0x2b3ed7){_0x14add3['push'](_0x14add3['shift']());}};_0x4a174f(++_0x13ce8d);}(_0x42c3,0x1bc));var _0x342c=function(_0x2baf06,_0x4511b2){_0x2baf06=_0x2baf06-0x0;var _0xb52eee=_0x42c3[_0x2baf06];return _0xb52eee;};'use strict';var _=require(_0x342c('0x0'));var jayson=require(_0x342c('0x1'));var db=require(_0x342c('0x2'))['db'];var amiClient=jayson['client'][_0x342c('0x3')]({'port':0x232a});var routingClient=jayson[_0x342c('0x4')][_0x342c('0x3')]({'port':0x232c});function isAgentPaused(_0x5ba6c8,_0x2bb759){var _0x59538e=[_0x5ba6c8[_0x342c('0x5')],_0x5ba6c8[_0x342c('0x6')],_0x5ba6c8['mailPause'],_0x5ba6c8['openchannelPause'],_0x5ba6c8[_0x342c('0x7')],_0x5ba6c8[_0x342c('0x8')],_0x5ba6c8[_0x342c('0x9')]];if(!_0x2bb759)return _[_0x342c('0xa')](_0x59538e);var _0x53e9a8=_[_0x342c('0xb')](_0x59538e);return _0x53e9a8[_0x342c('0xc')]>0x0&&_0x53e9a8[_0x342c('0xc')]<_0x59538e[_0x342c('0xc')]?!![]:![];}function isIdle(_0x3a3985){return _0x3a3985==='idle'||_0x3a3985===_0x342c('0xd')||_0x3a3985===_0x342c('0xe')||_0x3a3985===_0x342c('0xf')||_['isNil'](_0x3a3985);}function isAgentIdle(_0x5e1da1){if(_0x5e1da1['voiceStatus']!==_0x342c('0x10')&&_0x5e1da1[_0x342c('0x8')]){_0x5e1da1[_0x342c('0x11')]=_0x342c('0x12');return![];}return _[_0x342c('0xa')]([_0x5e1da1[_0x342c('0x13')],_0x5e1da1[_0x342c('0x14')],_0x5e1da1[_0x342c('0x15')],_0x5e1da1[_0x342c('0x16')],_0x5e1da1[_0x342c('0x17')],_0x5e1da1[_0x342c('0x11')],_0x5e1da1[_0x342c('0x18')]],isIdle);}function getRealtimeAgents(){return amiClient[_0x342c('0x19')](_0x342c('0x1a'),{})[_0x342c('0x1b')](function(_0x464160){if(_0x464160[_0x342c('0x1c')]){throw new Error('Unable\x20to\x20retrieve\x20RPC\x20agents\x20(AMI)');}var _0x3059ba=_0x464160['result'];return routingClient[_0x342c('0x19')](_0x342c('0x1a'),{})[_0x342c('0x1b')](function(_0x4e1355){if(_0x4e1355[_0x342c('0x1c')]){throw new Error(_0x342c('0x1d'));}var _0x3df147=_0x4e1355[_0x342c('0x1e')];return _[_0x342c('0x1f')]({},_0x3059ba,_0x3df147);});})['catch'](function(_0x418638){throw _0x418638;});}exports[_0x342c('0x20')]=getRealtimeAgents;function getAgentStatus(_0x16c1e1){var _0x495400=_0x342c('0xd');if(isAgentPaused(_0x16c1e1))_0x495400='pause';else if(isAgentPaused(_0x16c1e1,!![]))_0x495400=_0x342c('0x21');else if(isAgentIdle(_0x16c1e1))_0x495400=_0x342c('0x10');else _0x495400=_0x342c('0x22');return _0x495400;}exports[_0x342c('0x23')]=getAgentStatus;function getAgentIdsByQueues(_0x56c274,_0x5370de){var _0x58c604=_[_0x342c('0x24')](_0x56c274)?_0x56c274:[_0x56c274];var _0x30077a=_['startCase'](_0x5370de)+_0x342c('0x25');var _0x4c0cac=_['map'](_0x58c604,function(_0xa2f270){return db[_0x30077a]['findOne']({'where':{'id':_0xa2f270}})[_0x342c('0x1b')](function(_0x36ee6c){if(!_0x36ee6c)return[];return _0x36ee6c[_0x342c('0x26')]({'attributes':['id'],'raw':!![]});});});return Promise[_0x342c('0x27')](_0x4c0cac)['then'](function(_0xb76ae7){var _0x32f4fb=_(_0xb76ae7)[_0x342c('0x28')]()[_0x342c('0x29')]('id')[_0x342c('0x2a')]()['value']();return _0x32f4fb;});}exports[_0x342c('0x2b')]=getAgentIdsByQueues;function getAgentIdsByStatus(_0x15bd62,_0x42cdea,_0x116fed){try{if(_0x42cdea[_0x342c('0xc')]>0x0){_0x15bd62=_0x15bd62['filter'](function(_0xeb1b20){return _0x42cdea['includes'](_0xeb1b20['id']);});}var _0x2189ac=_0x15bd62[_0x342c('0xb')](function(_0x34f51e){var _0x13bfc9=_0x342c('0x22');if(isAgentIdle(_0x34f51e)){_0x13bfc9=_0x342c('0x10');}return _0x13bfc9===_0x116fed;});return _[_0x342c('0x29')](_0x2189ac,'id');}catch(_0x3d9912){throw _0x3d9912;}}exports['getAgentIdsByStatus']=getAgentIdsByStatus;function getSortedAgentsIdsByStatus(_0x32783e,_0x316684,_0x362056){return Promise['resolve']()[_0x342c('0x1b')](function(){if(_0x316684[_0x342c('0xc')]>0x0){_0x32783e=_0x32783e[_0x342c('0xb')](function(_0x143b32){return _0x316684['includes'](_0x143b32['id']);});}return _0x32783e;})[_0x342c('0x1b')](function(){return db['User'][_0x342c('0x2c')]({'attributes':['id','name','fullname',_0x342c('0x5'),_0x342c('0x6'),_0x342c('0x2d'),_0x342c('0x2e'),_0x342c('0x7'),_0x342c('0x8'),_0x342c('0x9'),_0x342c('0x2f')],'where':{'id':{'$in':_['map'](_0x32783e,'id')}},'raw':!![]});})[_0x342c('0x1b')](function(_0x38bf7d){return _0x38bf7d['map'](function(_0x2dda73){var _0x5b5ae1=_[_0x342c('0x30')](_0x32783e,['id',_0x2dda73['id']]);var _0x1505b9=filterAgentAttributes(_0x5b5ae1);_['merge'](_0x2dda73,_0x1505b9);_0x2dda73['globalStatus']=getAgentStatus(_0x2dda73);return _0x2dda73;});})[_0x342c('0x1b')](function(_0xf64fff){var _0x52213=sortAgentsByStatus(_0xf64fff,_0x362056);return _['map'](_0x52213,'id');})[_0x342c('0x31')](function(_0x5741bf){throw _0x5741bf;});}exports[_0x342c('0x32')]=getSortedAgentsIdsByStatus;function getUpdatedSortOptions(_0x44fa4c){var _0x158ea1={'fields':[],'order':null};var _0x30ea66=_0x44fa4c['split'](',');_0x158ea1['fields']=_[_0x342c('0xb')](_0x30ea66,function(_0x41d7f0){if(!_0x41d7f0[_0x342c('0x33')]('globalStatus')){return!![];}_0x158ea1[_0x342c('0x34')]=_[_0x342c('0x35')](_0x41d7f0,'-')?'DESC':'ASC';return![];});return _0x158ea1;}exports[_0x342c('0x36')]=getUpdatedSortOptions;function validateSortParameter(_0x1d8571){if(!_0x1d8571){_0x1d8571='fullname,internal';}if(_0x1d8571[_0x342c('0x33')](_0x342c('0x37'))&&!_0x1d8571[_0x342c('0x33')](_0x342c('0x38'))){var _0x47a2ac=_0x1d8571[_0x342c('0x39')](0x0,_0x1d8571[_0x342c('0x3a')]('fullname'));_0x1d8571+=','+_0x47a2ac+_0x342c('0x38');}return _0x1d8571;}exports[_0x342c('0x3b')]=validateSortParameter;function sortAgentsByStatus(_0x1f402b,_0x24ddb2){var _0x49f7bd=_0x1f402b['sort'](function(_0x458a44,_0x233232){if(_0x458a44[_0x342c('0x3c')]===_0x233232[_0x342c('0x3c')]){if(_0x458a44[_0x342c('0x3c')]==='pause'){if(_0x24ddb2==='DESC'){return(_0x458a44[_0x342c('0x2f')]||'')<(_0x233232[_0x342c('0x2f')]||'')||_0x458a44[_0x342c('0x37')][_0x342c('0x3d')]()>_0x233232[_0x342c('0x37')][_0x342c('0x3d')]()?0x1:-0x1;}else{return(_0x458a44[_0x342c('0x2f')]||'')<(_0x233232[_0x342c('0x2f')]||'')||_0x458a44[_0x342c('0x37')][_0x342c('0x3d')]()>_0x233232[_0x342c('0x37')]['toLowerCase']()?-0x1:0x1;}}else{if(_0x24ddb2===_0x342c('0x3e')){return _0x458a44[_0x342c('0x37')][_0x342c('0x3d')]()<_0x233232[_0x342c('0x37')][_0x342c('0x3d')]()?0x1:-0x1;}else{return _0x458a44[_0x342c('0x37')]['toLowerCase']()<_0x233232['fullname'][_0x342c('0x3d')]()?-0x1:0x1;}}}else{if(_0x24ddb2===_0x342c('0x3e')){return _0x458a44['globalStatus']<_0x233232[_0x342c('0x3c')]?0x1:-0x1;}else{return _0x458a44[_0x342c('0x3c')]<_0x233232[_0x342c('0x3c')]?-0x1:0x1;}}});return _0x49f7bd;}exports['sortAgentsByStatus']=sortAgentsByStatus;function filterAgentAttributes(_0x19a92f){var _0x163fd7=[_0x342c('0x3f'),_0x342c('0x40'),'lastLoginAt',_0x342c('0x41'),_0x342c('0x2f'),_0x342c('0x41'),'internal','address',_0x342c('0x5'),_0x342c('0x2e'),_0x342c('0x2d'),_0x342c('0x7'),_0x342c('0x9'),'faxPause',_0x342c('0x8'),_0x342c('0x42'),_0x342c('0x43'),_0x342c('0x44'),_0x342c('0x45'),_0x342c('0x46'),_0x342c('0x47'),_0x342c('0x48'),'openchannelCurrentCapacity',_0x342c('0x49'),_0x342c('0x4a'),_0x342c('0x4b'),_0x342c('0x4c'),'chatStatus',_0x342c('0x16'),_0x342c('0x15'),_0x342c('0x17'),_0x342c('0x18'),_0x342c('0x14'),'voiceStatus','chatStatusTime',_0x342c('0x4d'),_0x342c('0x4e'),_0x342c('0x4f'),_0x342c('0x50'),'faxStatusTime',_0x342c('0x51'),_0x342c('0x52'),_0x342c('0x53'),_0x342c('0x54'),_0x342c('0x55'),_0x342c('0x56')];var _0x597964=['chatPause','openchannelPause',_0x342c('0x2d'),_0x342c('0x7'),_0x342c('0x9'),_0x342c('0x6'),'voicePause',_0x342c('0x40')];var _0x390d39=_(_0x19a92f)[_0x342c('0x57')](_0x597964)[_0x342c('0x58')](_0x163fd7)[_0x342c('0x59')]();return _0x390d39;}exports[_0x342c('0x5a')]=filterAgentAttributes;function getRealtimeAgentsQueryFields(){return['id','name',_0x342c('0x37'),_0x342c('0x5b'),_0x342c('0x38'),'online',_0x342c('0x3c'),_0x342c('0x3f'),'lastLoginAt',_0x342c('0x2f'),_0x342c('0x41'),'faxPause','chatPause',_0x342c('0x2d'),'openchannelPause',_0x342c('0x7'),_0x342c('0x8'),_0x342c('0x9'),_0x342c('0x13'),'faxStatus','mailStatus',_0x342c('0x16'),_0x342c('0x17'),'voiceStatus',_0x342c('0x18'),'chatStatusTime',_0x342c('0x5c'),_0x342c('0x4e'),'openchannelStatusTime','smsStatusTime',_0x342c('0x51'),_0x342c('0x50'),_0x342c('0x42'),_0x342c('0x47'),_0x342c('0x44'),_0x342c('0x43'),_0x342c('0x45'),_0x342c('0x46'),_0x342c('0x48'),'faxCurrentCapacity','mailCurrentCapacity',_0x342c('0x5d'),_0x342c('0x4a'),_0x342c('0x4b'),'phoneBarEnableScreenRecordingByAgent',_0x342c('0x56'),_0x342c('0x53'),'onhold','queue',_0x342c('0x54')];}exports[_0x342c('0x5e')]=getRealtimeAgentsQueryFields; \ No newline at end of file +var _0x390a=['destconnectedlinenum','phoneBarEnableAutomaticScreenRecording','omit','pick','filterAgentAttributes','name','role','smsStatus','voiceStatusTime','faxCurrentCapacity','phoneBarEnableScreenRecordingByAgent','onhold','getRealtimeAgentsQueryFields','lodash','jayson/promise','../../mysqldb','client','http','chatPause','faxPause','mailPause','smsPause','voicePause','filter','length','unknown','unavailable','ringing','voiceStatus','chatStatus','faxStatus','openchannelStatus','request','then','Unable\x20to\x20retrieve\x20RPC\x20agents\x20(AMI)','error','Unable\x20to\x20retrieve\x20RPC\x20agents\x20(Routing)','result','getRealtimeAgents','*pause','idle','startCase','map','getAgents','uniq','value','getAgentIdsByQueues','includes','busy','resolve','User','fullname','whatsappPause','pauseType','find','merge','catch','fields','globalStatus','order','startsWith','DESC','fullname,internal','internal','substring','indexOf','pause','toLowerCase','sortAgentsByStatus','userpic','online','lastLoginAt','lastPauseAt','openchannelPause','chatCapacity','openchannelCapacity','mailCapacity','smsCapacity','whatsappCapacity','faxCapacity','chatCurrentCapacity','openchannelCurrentCapacity','mailCurrentCapacity','smsCurrentCapacity','whatsappCurrentCapacity','mailStatus','whatsappStatus','chatStatusTime','openchannelStatusTime','mailStatusTime','smsStatusTime','whatsappStatusTime','faxStatusTime','queue'];(function(_0x3af584,_0x1189f2){var _0x2c3ef1=function(_0xc3c740){while(--_0xc3c740){_0x3af584['push'](_0x3af584['shift']());}};_0x2c3ef1(++_0x1189f2);}(_0x390a,0xc9));var _0xa390=function(_0x292427,_0x4c82f8){_0x292427=_0x292427-0x0;var _0x3d56c3=_0x390a[_0x292427];return _0x3d56c3;};'use strict';var _=require(_0xa390('0x0'));var jayson=require(_0xa390('0x1'));var db=require(_0xa390('0x2'))['db'];var amiClient=jayson[_0xa390('0x3')]['http']({'port':0x232a});var routingClient=jayson[_0xa390('0x3')][_0xa390('0x4')]({'port':0x232c});function isAgentPaused(_0x4879dd,_0x3f1ee2){var _0x4fe49e=[_0x4879dd[_0xa390('0x5')],_0x4879dd[_0xa390('0x6')],_0x4879dd[_0xa390('0x7')],_0x4879dd['openchannelPause'],_0x4879dd[_0xa390('0x8')],_0x4879dd[_0xa390('0x9')],_0x4879dd['whatsappPause']];if(!_0x3f1ee2)return _['every'](_0x4fe49e);var _0xc8cd85=_[_0xa390('0xa')](_0x4fe49e);return _0xc8cd85[_0xa390('0xb')]>0x0&&_0xc8cd85[_0xa390('0xb')]<_0x4fe49e[_0xa390('0xb')]?!![]:![];}function isIdle(_0x5106eb){return _0x5106eb==='idle'||_0x5106eb===_0xa390('0xc')||_0x5106eb===_0xa390('0xd')||_0x5106eb===_0xa390('0xe')||_['isNil'](_0x5106eb);}function isAgentIdle(_0x41f9f2){if(_0x41f9f2[_0xa390('0xf')]!=='idle'&&_0x41f9f2[_0xa390('0x9')]){_0x41f9f2[_0xa390('0xf')]='pause';return![];}return _['every']([_0x41f9f2[_0xa390('0x10')],_0x41f9f2[_0xa390('0x11')],_0x41f9f2['mailStatus'],_0x41f9f2[_0xa390('0x12')],_0x41f9f2['smsStatus'],_0x41f9f2['voiceStatus'],_0x41f9f2['whatsappStatus']],isIdle);}function getRealtimeAgents(){return amiClient[_0xa390('0x13')]('Agents',{})[_0xa390('0x14')](function(_0x4645be){if(_0x4645be['error']){throw new Error(_0xa390('0x15'));}var _0x180429=_0x4645be['result'];return routingClient[_0xa390('0x13')]('Agents',{})[_0xa390('0x14')](function(_0x225e2c){if(_0x225e2c[_0xa390('0x16')]){throw new Error(_0xa390('0x17'));}var _0x555ade=_0x225e2c[_0xa390('0x18')];return _['merge']({},_0x180429,_0x555ade);});})['catch'](function(_0x4969c9){throw _0x4969c9;});}exports[_0xa390('0x19')]=getRealtimeAgents;function getAgentStatus(_0x555323){var _0x3815bd=_0xa390('0xc');if(isAgentPaused(_0x555323))_0x3815bd='pause';else if(isAgentPaused(_0x555323,!![]))_0x3815bd=_0xa390('0x1a');else if(isAgentIdle(_0x555323))_0x3815bd=_0xa390('0x1b');else _0x3815bd='busy';return _0x3815bd;}exports['getAgentStatus']=getAgentStatus;function getAgentIdsByQueues(_0x18a0f0,_0x374ea9){var _0x130355=_['isArray'](_0x18a0f0)?_0x18a0f0:[_0x18a0f0];var _0x4d320d=_[_0xa390('0x1c')](_0x374ea9)+'Queue';var _0x3f2840=_[_0xa390('0x1d')](_0x130355,function(_0x2aeb9f){return db[_0x4d320d]['findOne']({'where':{'id':_0x2aeb9f}})[_0xa390('0x14')](function(_0x4541a6){if(!_0x4541a6)return[];return _0x4541a6[_0xa390('0x1e')]({'attributes':['id'],'raw':!![]});});});return Promise['all'](_0x3f2840)[_0xa390('0x14')](function(_0x5a92bd){var _0x34f865=_(_0x5a92bd)['flatten']()[_0xa390('0x1d')]('id')[_0xa390('0x1f')]()[_0xa390('0x20')]();return _0x34f865;});}exports[_0xa390('0x21')]=getAgentIdsByQueues;function getAgentIdsByStatus(_0x22c5ba,_0x351913,_0x55e360){try{if(_0x351913['length']>0x0){_0x22c5ba=_0x22c5ba[_0xa390('0xa')](function(_0x5022aa){return _0x351913[_0xa390('0x22')](_0x5022aa['id']);});}var _0x45d572=_0x22c5ba[_0xa390('0xa')](function(_0x11ce69){var _0x272949=_0xa390('0x23');if(isAgentIdle(_0x11ce69)){_0x272949='idle';}return _0x272949===_0x55e360;});return _[_0xa390('0x1d')](_0x45d572,'id');}catch(_0x4234e1){throw _0x4234e1;}}exports['getAgentIdsByStatus']=getAgentIdsByStatus;function getSortedAgentsIdsByStatus(_0x2b2448,_0x421ac0,_0x4f5b64){return Promise[_0xa390('0x24')]()[_0xa390('0x14')](function(){if(_0x421ac0['length']>0x0){_0x2b2448=_0x2b2448[_0xa390('0xa')](function(_0x2601c7){return _0x421ac0[_0xa390('0x22')](_0x2601c7['id']);});}return _0x2b2448;})[_0xa390('0x14')](function(){return db[_0xa390('0x25')]['findAll']({'attributes':['id','name',_0xa390('0x26'),_0xa390('0x5'),'faxPause',_0xa390('0x7'),'openchannelPause',_0xa390('0x8'),_0xa390('0x9'),_0xa390('0x27'),_0xa390('0x28')],'where':{'id':{'$in':_[_0xa390('0x1d')](_0x2b2448,'id')}},'raw':!![]});})[_0xa390('0x14')](function(_0x385cfc){return _0x385cfc[_0xa390('0x1d')](function(_0x231616){var _0x32ba94=_[_0xa390('0x29')](_0x2b2448,['id',_0x231616['id']]);var _0x57e821=filterAgentAttributes(_0x32ba94);_[_0xa390('0x2a')](_0x231616,_0x57e821);_0x231616['globalStatus']=getAgentStatus(_0x231616);return _0x231616;});})[_0xa390('0x14')](function(_0x526dd0){var _0x1369bb=sortAgentsByStatus(_0x526dd0,_0x4f5b64);return _[_0xa390('0x1d')](_0x1369bb,'id');})[_0xa390('0x2b')](function(_0x347082){throw _0x347082;});}exports['getSortedAgentsIdsByStatus']=getSortedAgentsIdsByStatus;function getUpdatedSortOptions(_0x3bc936){var _0x5ae5f6={'fields':[],'order':null};var _0x298169=_0x3bc936['split'](',');_0x5ae5f6[_0xa390('0x2c')]=_[_0xa390('0xa')](_0x298169,function(_0x2fe9f3){if(!_0x2fe9f3[_0xa390('0x22')](_0xa390('0x2d'))){return!![];}_0x5ae5f6[_0xa390('0x2e')]=_[_0xa390('0x2f')](_0x2fe9f3,'-')?_0xa390('0x30'):'ASC';return![];});return _0x5ae5f6;}exports['getUpdatedSortOptions']=getUpdatedSortOptions;function validateSortParameter(_0x26a191){if(!_0x26a191){_0x26a191=_0xa390('0x31');}if(_0x26a191[_0xa390('0x22')](_0xa390('0x26'))&&!_0x26a191[_0xa390('0x22')](_0xa390('0x32'))){var _0x49fd4f=_0x26a191[_0xa390('0x33')](0x0,_0x26a191[_0xa390('0x34')](_0xa390('0x26')));_0x26a191+=','+_0x49fd4f+_0xa390('0x32');}return _0x26a191;}exports['validateSortParameter']=validateSortParameter;function sortAgentsByStatus(_0x176acd,_0x222b8d){var _0x5c00fd=_0x176acd['sort'](function(_0x4b8288,_0x9f74fd){if(_0x4b8288[_0xa390('0x2d')]===_0x9f74fd[_0xa390('0x2d')]){if(_0x4b8288[_0xa390('0x2d')]===_0xa390('0x35')){if(_0x222b8d===_0xa390('0x30')){return(_0x4b8288[_0xa390('0x28')]||'')<(_0x9f74fd[_0xa390('0x28')]||'')||_0x4b8288[_0xa390('0x26')]['toLowerCase']()>_0x9f74fd[_0xa390('0x26')][_0xa390('0x36')]()?0x1:-0x1;}else{return(_0x4b8288[_0xa390('0x28')]||'')<(_0x9f74fd[_0xa390('0x28')]||'')||_0x4b8288[_0xa390('0x26')][_0xa390('0x36')]()>_0x9f74fd[_0xa390('0x26')][_0xa390('0x36')]()?-0x1:0x1;}}else{if(_0x222b8d===_0xa390('0x30')){return _0x4b8288[_0xa390('0x26')][_0xa390('0x36')]()<_0x9f74fd[_0xa390('0x26')][_0xa390('0x36')]()?0x1:-0x1;}else{return _0x4b8288[_0xa390('0x26')][_0xa390('0x36')]()<_0x9f74fd[_0xa390('0x26')][_0xa390('0x36')]()?-0x1:0x1;}}}else{if(_0x222b8d===_0xa390('0x30')){return _0x4b8288[_0xa390('0x2d')]<_0x9f74fd[_0xa390('0x2d')]?0x1:-0x1;}else{return _0x4b8288[_0xa390('0x2d')]<_0x9f74fd['globalStatus']?-0x1:0x1;}}});return _0x5c00fd;}exports[_0xa390('0x37')]=sortAgentsByStatus;function filterAgentAttributes(_0x1dc90d){var _0x700837=[_0xa390('0x38'),_0xa390('0x39'),_0xa390('0x3a'),'lastPauseAt',_0xa390('0x28'),_0xa390('0x3b'),_0xa390('0x32'),'address',_0xa390('0x5'),_0xa390('0x3c'),_0xa390('0x7'),'smsPause',_0xa390('0x27'),_0xa390('0x6'),_0xa390('0x9'),_0xa390('0x3d'),_0xa390('0x3e'),_0xa390('0x3f'),_0xa390('0x40'),_0xa390('0x41'),_0xa390('0x42'),_0xa390('0x43'),_0xa390('0x44'),_0xa390('0x45'),_0xa390('0x46'),_0xa390('0x47'),'faxCurrentCapacity','chatStatus',_0xa390('0x12'),_0xa390('0x48'),'smsStatus',_0xa390('0x49'),_0xa390('0x11'),_0xa390('0xf'),_0xa390('0x4a'),_0xa390('0x4b'),_0xa390('0x4c'),_0xa390('0x4d'),_0xa390('0x4e'),_0xa390('0x4f'),'voiceStatusTime',_0xa390('0x50'),_0xa390('0x51'),'screenrecording','phoneBarEnableScreenRecordingByAgent',_0xa390('0x52')];var _0x119d25=[_0xa390('0x5'),'openchannelPause','mailPause',_0xa390('0x8'),_0xa390('0x27'),_0xa390('0x6'),_0xa390('0x9'),_0xa390('0x39')];var _0x5849d9=_(_0x1dc90d)[_0xa390('0x53')](_0x119d25)[_0xa390('0x54')](_0x700837)[_0xa390('0x20')]();return _0x5849d9;}exports[_0xa390('0x55')]=filterAgentAttributes;function getRealtimeAgentsQueryFields(){return['id',_0xa390('0x56'),_0xa390('0x26'),_0xa390('0x57'),_0xa390('0x32'),_0xa390('0x39'),_0xa390('0x2d'),'userpic',_0xa390('0x3a'),_0xa390('0x28'),_0xa390('0x3b'),_0xa390('0x6'),_0xa390('0x5'),_0xa390('0x7'),_0xa390('0x3c'),_0xa390('0x8'),_0xa390('0x9'),'whatsappPause','chatStatus',_0xa390('0x11'),_0xa390('0x48'),'openchannelStatus',_0xa390('0x58'),'voiceStatus',_0xa390('0x49'),_0xa390('0x4a'),_0xa390('0x4f'),'mailStatusTime',_0xa390('0x4b'),_0xa390('0x4d'),_0xa390('0x59'),_0xa390('0x4e'),_0xa390('0x3d'),_0xa390('0x42'),_0xa390('0x3f'),'openchannelCapacity',_0xa390('0x40'),_0xa390('0x41'),_0xa390('0x43'),_0xa390('0x5a'),_0xa390('0x45'),_0xa390('0x44'),'smsCurrentCapacity',_0xa390('0x47'),_0xa390('0x5b'),_0xa390('0x52'),_0xa390('0x51'),_0xa390('0x5c'),_0xa390('0x50'),'screenrecording'];}exports[_0xa390('0x5d')]=getRealtimeAgentsQueryFields; \ No newline at end of file diff --git a/server/components/realtime/queues.js b/server/components/realtime/queues.js index 70e7e2f..c503a34 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 _0x9947=['ringInUse','talking','unavailable','originated','message','statusMessage','dialActive','dialMethod','startPredictive','startProgressive','erlangCalls','erlangCallToSecond','erlangAbandonmentRate','erlangBusyFactor','dialPredictiveIntervalMaxThreshold','dialPredictiveIntervalMinThreshold','predictiveIntervalAvailable','predictiveIntervalTotalCalls','predictiveIntervalAnsweredCalls','predictiveIntervalDroppedCallsCallersExit','predictiveIntervalAvgHoldtime','predictiveIntervalAvgTalktime','voice','startCase','then','error','Unable\x20to\x20retrieve\x20RPC\x20%s\x20queues','result','catch','getRealtimeQueues','inbound','concat','map','loggedIn','busy','pTalking','find','merge','initializeQueues','lodash','jayson/promise','util','client','http','available','paused','waiting','invalid','loggedInDb','notInUse','onHold'];(function(_0x29e6f7,_0x5f58d7){var _0xd87394=function(_0xa08773){while(--_0xa08773){_0x29e6f7['push'](_0x29e6f7['shift']());}};_0xd87394(++_0x5f58d7);}(_0x9947,0xf3));var _0x7994=function(_0x2545d0,_0x397e79){_0x2545d0=_0x2545d0-0x0;var _0x10111b=_0x9947[_0x2545d0];return _0x10111b;};'use strict';var _=require(_0x7994('0x0'));var jayson=require(_0x7994('0x1'));var util=require(_0x7994('0x2'));var amiClient=jayson[_0x7994('0x3')][_0x7994('0x4')]({'port':0x232a});var routingClient=jayson[_0x7994('0x3')][_0x7994('0x4')]({'port':0x232c});var DEFAULT_QUEUE_ATTRIBUTES=[_0x7994('0x5'),'loggedIn',_0x7994('0x6'),_0x7994('0x7')];var VOICE_QUEUE_ATTRIBUTES=['busy','inUse',_0x7994('0x8'),_0x7994('0x9'),_0x7994('0xa'),_0x7994('0xb'),'ringing',_0x7994('0xc'),_0x7994('0xd'),_0x7994('0xe'),'unknown'];var OUTBOUND_QUEUE_ATTRIBUTES=['pTalking',_0x7994('0xf'),_0x7994('0x10'),_0x7994('0x11'),_0x7994('0x12'),_0x7994('0x13'),'Trunk',_0x7994('0x14'),_0x7994('0x15'),_0x7994('0x16'),_0x7994('0x17'),_0x7994('0x18'),_0x7994('0x19'),'dialPredictiveInterval',_0x7994('0x1a'),_0x7994('0x1b'),_0x7994('0x1c'),_0x7994('0x1d'),_0x7994('0x1e'),'predictiveIntervalDroppedCallsTimeout',_0x7994('0x1f'),_0x7994('0x20'),_0x7994('0x21')];function getRealtimeQueues(_0x565522,_0x599054){var _0x5ce314=_0x599054===_0x7994('0x22')?amiClient:routingClient;return _0x5ce314['request'](_[_0x7994('0x23')](_0x599054)+'Queues',_0x565522)[_0x7994('0x24')](function(_0x9a3484){if(_0x9a3484[_0x7994('0x25')])throw new Error(util['format'](_0x7994('0x26'),_0x599054));return _0x9a3484[_0x7994('0x27')];})[_0x7994('0x28')](function(_0x177c3e){throw _0x177c3e;});}exports[_0x7994('0x29')]=getRealtimeQueues;function initializeQueues(_0x24bc61,_0x262a62,_0x1a303a,_0x5690d4){var _0x3bbf93=DEFAULT_QUEUE_ATTRIBUTES;if(_0x1a303a===_0x7994('0x22')){if(_0x5690d4===_0x7994('0x2a')){_0x3bbf93=_0x3bbf93[_0x7994('0x2b')](VOICE_QUEUE_ATTRIBUTES);}else if(_0x5690d4==='outbound'){_0x3bbf93=_0x3bbf93['concat'](VOICE_QUEUE_ATTRIBUTES,OUTBOUND_QUEUE_ATTRIBUTES);}}return _0x24bc61[_0x7994('0x2c')](function(_0x36764b){var _0x23c02d=_0x36764b['get']({'plain':!![]});_0x23c02d['paused']=0x0;_0x23c02d[_0x7994('0x9')]=0x0;_0x23c02d[_0x7994('0x2d')]=0x0;_0x23c02d[_0x7994('0x5')]=0x0;_0x23c02d[_0x7994('0x7')]=0x0;if(_0x1a303a==='voice'){_0x23c02d[_0x7994('0xd')]=0x0;_0x23c02d[_0x7994('0x2e')]=0x0;if(_0x5690d4==='outbound'){_0x23c02d[_0x7994('0x2f')]=0x0;_0x23c02d[_0x7994('0xf')]=0x0;}}var _0x32021b=_[_0x7994('0x30')](_0x262a62,['id',_0x23c02d['id']]);if(_0x32021b){_[_0x7994('0x31')](_0x23c02d,_['pick'](_0x32021b,_0x3bbf93));}return _0x23c02d;});}exports[_0x7994('0x32')]=initializeQueues; \ No newline at end of file +var _0x4254=['erlangAbandonmentRate','erlangBusyFactor','dialPredictiveInterval','predictiveIntervalAvailable','predictiveIntervalTotalCalls','predictiveIntervalDroppedCallsTimeout','predictiveIntervalDroppedCallsCallersExit','predictiveIntervalAvgHoldtime','predictiveIntervalAvgTalktime','voice','request','startCase','Queues','then','error','format','Unable\x20to\x20retrieve\x20RPC\x20%s\x20queues','result','catch','getRealtimeQueues','concat','outbound','map','get','available','find','merge','pick','lodash','jayson/promise','util','client','http','loggedIn','paused','waiting','busy','inUse','invalid','loggedInDb','onHold','ringInUse','talking','unavailable','unknown','pTalking','originated','message','dialActive','dialMethod','startPredictive','startProgressive','erlangCallToSecond'];(function(_0x497d8c,_0x2904c9){var _0xeafed7=function(_0x3b51e8){while(--_0x3b51e8){_0x497d8c['push'](_0x497d8c['shift']());}};_0xeafed7(++_0x2904c9);}(_0x4254,0x15a));var _0x4425=function(_0x48138a,_0x42c8fd){_0x48138a=_0x48138a-0x0;var _0x7be4e9=_0x4254[_0x48138a];return _0x7be4e9;};'use strict';var _=require(_0x4425('0x0'));var jayson=require(_0x4425('0x1'));var util=require(_0x4425('0x2'));var amiClient=jayson[_0x4425('0x3')]['http']({'port':0x232a});var routingClient=jayson['client'][_0x4425('0x4')]({'port':0x232c});var DEFAULT_QUEUE_ATTRIBUTES=['available',_0x4425('0x5'),_0x4425('0x6'),_0x4425('0x7')];var VOICE_QUEUE_ATTRIBUTES=[_0x4425('0x8'),_0x4425('0x9'),_0x4425('0xa'),_0x4425('0xb'),'notInUse',_0x4425('0xc'),'ringing',_0x4425('0xd'),_0x4425('0xe'),_0x4425('0xf'),_0x4425('0x10')];var OUTBOUND_QUEUE_ATTRIBUTES=[_0x4425('0x11'),_0x4425('0x12'),_0x4425('0x13'),'statusMessage',_0x4425('0x14'),_0x4425('0x15'),'Trunk',_0x4425('0x16'),_0x4425('0x17'),'erlangCalls',_0x4425('0x18'),_0x4425('0x19'),_0x4425('0x1a'),_0x4425('0x1b'),'dialPredictiveIntervalMaxThreshold','dialPredictiveIntervalMinThreshold',_0x4425('0x1c'),_0x4425('0x1d'),'predictiveIntervalAnsweredCalls',_0x4425('0x1e'),_0x4425('0x1f'),_0x4425('0x20'),_0x4425('0x21')];function getRealtimeQueues(_0x2e5cec,_0x35b794){var _0x14413d=_0x35b794===_0x4425('0x22')?amiClient:routingClient;return _0x14413d[_0x4425('0x23')](_[_0x4425('0x24')](_0x35b794)+_0x4425('0x25'),_0x2e5cec)[_0x4425('0x26')](function(_0xc0abb7){if(_0xc0abb7[_0x4425('0x27')])throw new Error(util[_0x4425('0x28')](_0x4425('0x29'),_0x35b794));return _0xc0abb7[_0x4425('0x2a')];})[_0x4425('0x2b')](function(_0x244404){throw _0x244404;});}exports[_0x4425('0x2c')]=getRealtimeQueues;function initializeQueues(_0x20d853,_0x5bc11d,_0xe25623,_0x2e8304){var _0x2bebef=DEFAULT_QUEUE_ATTRIBUTES;if(_0xe25623===_0x4425('0x22')){if(_0x2e8304==='inbound'){_0x2bebef=_0x2bebef[_0x4425('0x2d')](VOICE_QUEUE_ATTRIBUTES);}else if(_0x2e8304===_0x4425('0x2e')){_0x2bebef=_0x2bebef[_0x4425('0x2d')](VOICE_QUEUE_ATTRIBUTES,OUTBOUND_QUEUE_ATTRIBUTES);}}return _0x20d853[_0x4425('0x2f')](function(_0x25c297){var _0x41a472=_0x25c297[_0x4425('0x30')]({'plain':!![]});_0x41a472[_0x4425('0x6')]=0x0;_0x41a472[_0x4425('0xb')]=0x0;_0x41a472['loggedIn']=0x0;_0x41a472[_0x4425('0x31')]=0x0;_0x41a472[_0x4425('0x7')]=0x0;if(_0xe25623===_0x4425('0x22')){_0x41a472[_0x4425('0xe')]=0x0;_0x41a472[_0x4425('0x8')]=0x0;if(_0x2e8304===_0x4425('0x2e')){_0x41a472[_0x4425('0x11')]=0x0;_0x41a472[_0x4425('0x12')]=0x0;}}var _0x5e0aec=_[_0x4425('0x32')](_0x5bc11d,['id',_0x41a472['id']]);if(_0x5e0aec){_[_0x4425('0x33')](_0x41a472,_[_0x4425('0x34')](_0x5e0aec,_0x2bebef));}return _0x41a472;});}exports['initializeQueues']=initializeQueues; \ No newline at end of file diff --git a/server/config/express.js b/server/config/express.js index 5e9a54e..9240778 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(_0x29d530,_0x5da0d7){var _0x242905=function(_0x5e7857){while(--_0x5e7857){_0x29d530['push'](_0x29d530['shift']());}};_0x242905(++_0x5da0d7);}(_0x9957,0x93));var _0x7995=function(_0x501510,_0x61caa9){_0x501510=_0x501510-0x0;var _0x1e6ee5=_0x9957[_0x501510];return _0x1e6ee5;};'use strict';var express=require(_0x7995('0x0'));var methodOverride=require(_0x7995('0x1'));var cookieParser=require(_0x7995('0x2'));var errorHandler=require(_0x7995('0x3'));var path=require('path');var passport=require(_0x7995('0x4'));var cors=require(_0x7995('0x5'));var config=require(_0x7995('0x6'));exports[_0x7995('0x7')]=function(_0x576d89){var _0x744bea=_0x576d89[_0x7995('0x8')](_0x7995('0x9'));if(_0x744bea===_0x7995('0xa')){_0x576d89[_0x7995('0xb')](_0x7995('0xc'),path['join'](config[_0x7995('0xd')],_0x7995('0xe')));}if(_0x744bea==='development'||_0x744bea===_0x7995('0xf')){_0x576d89[_0x7995('0xb')](_0x7995('0xc'),path[_0x7995('0x10')](config[_0x7995('0xd')],_0x7995('0x11')));_0x576d89[_0x7995('0x12')](errorHandler());}_0x576d89['set'](_0x7995('0x13'),function(_0x41c652,_0x581f22){if(this[_0x41c652]instanceof Date){_0x581f22=this[_0x41c652][_0x7995('0x14')]()[_0x7995('0x15')]('.')[0x0]+'Z';}return _0x581f22;});_0x576d89[_0x7995('0x12')](express[_0x7995('0x16')](_0x576d89[_0x7995('0x8')](_0x7995('0xc'))));_0x576d89[_0x7995('0xb')]('views',config['root']+_0x7995('0x17'));_0x576d89[_0x7995('0x18')](_0x7995('0x19'),require(_0x7995('0x1a'))[_0x7995('0x1b')]);_0x576d89[_0x7995('0xb')](_0x7995('0x1c'),_0x7995('0x19'));_0x576d89['use'](express[_0x7995('0x1d')]({'limit':'50mb','extended':!![]}));_0x576d89[_0x7995('0x12')](express[_0x7995('0x1e')]({'limit':_0x7995('0x1f')}));_0x576d89[_0x7995('0x12')](cors());_0x576d89[_0x7995('0x12')](methodOverride());_0x576d89[_0x7995('0x12')](cookieParser());_0x576d89['use'](passport['initialize']());}; \ No newline at end of file +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(_0x6330a4,_0x31ce3f){var _0x3a9b65=function(_0x5cb8d1){while(--_0x5cb8d1){_0x6330a4['push'](_0x6330a4['shift']());}};_0x3a9b65(++_0x31ce3f);}(_0x9957,0x93));var _0x7995=function(_0x1ac595,_0x5d2081){_0x1ac595=_0x1ac595-0x0;var _0x455fff=_0x9957[_0x1ac595];return _0x455fff;};'use strict';var express=require(_0x7995('0x0'));var methodOverride=require(_0x7995('0x1'));var cookieParser=require(_0x7995('0x2'));var errorHandler=require(_0x7995('0x3'));var path=require('path');var passport=require(_0x7995('0x4'));var cors=require(_0x7995('0x5'));var config=require(_0x7995('0x6'));exports[_0x7995('0x7')]=function(_0x576d89){var _0x744bea=_0x576d89[_0x7995('0x8')](_0x7995('0x9'));if(_0x744bea===_0x7995('0xa')){_0x576d89[_0x7995('0xb')](_0x7995('0xc'),path['join'](config[_0x7995('0xd')],_0x7995('0xe')));}if(_0x744bea==='development'||_0x744bea===_0x7995('0xf')){_0x576d89[_0x7995('0xb')](_0x7995('0xc'),path[_0x7995('0x10')](config[_0x7995('0xd')],_0x7995('0x11')));_0x576d89[_0x7995('0x12')](errorHandler());}_0x576d89['set'](_0x7995('0x13'),function(_0x41c652,_0x581f22){if(this[_0x41c652]instanceof Date){_0x581f22=this[_0x41c652][_0x7995('0x14')]()[_0x7995('0x15')]('.')[0x0]+'Z';}return _0x581f22;});_0x576d89[_0x7995('0x12')](express[_0x7995('0x16')](_0x576d89[_0x7995('0x8')](_0x7995('0xc'))));_0x576d89[_0x7995('0xb')]('views',config['root']+_0x7995('0x17'));_0x576d89[_0x7995('0x18')](_0x7995('0x19'),require(_0x7995('0x1a'))[_0x7995('0x1b')]);_0x576d89[_0x7995('0xb')](_0x7995('0x1c'),_0x7995('0x19'));_0x576d89['use'](express[_0x7995('0x1d')]({'limit':'50mb','extended':!![]}));_0x576d89[_0x7995('0x12')](express[_0x7995('0x1e')]({'limit':_0x7995('0x1f')}));_0x576d89[_0x7995('0x12')](cors());_0x576d89[_0x7995('0x12')](methodOverride());_0x576d89[_0x7995('0x12')](cookieParser());_0x576d89['use'](passport['initialize']());}; \ No newline at end of file diff --git a/server/config/license/hardware.js b/server/config/license/hardware.js index ad99f1f..030240e 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 _0x42e5=['hex','platform','licenseToken','test','dmidecode\x20--string\x20system-uuid','utf8','replace','hostname','macAddress','substring','bimedia-machine-uuid','child_process','execSync','orderBy','keys','length','filter','IPv4','internal','concat','head','mac','00:00:00:00:00:00','127.0.0.1','getFirstInterface','map','model','join','createHash','update','digest'];(function(_0x3dd15e,_0x1f0015){var _0x231fd0=function(_0x4f680a){while(--_0x4f680a){_0x3dd15e['push'](_0x3dd15e['shift']());}};_0x231fd0(++_0x1f0015);}(_0x42e5,0x86));var _0x542e=function(_0x5d6600,_0x9a9e9b){_0x5d6600=_0x5d6600-0x0;var _0x3c85cc=_0x42e5[_0x5d6600];return _0x3c85cc;};'use strict';var _=require('lodash');var os=require('os');var crypto=require('crypto');var machine=require(_0x542e('0x0'));var exec=require(_0x542e('0x1'))[_0x542e('0x2')];var config=require('../environment');function getInterfaces(){var _0x1817b9=[];var _0x5d9e75=os['networkInterfaces']();var _0x52755d=_[_0x542e('0x3')](_[_0x542e('0x4')](_0x5d9e75));for(var _0x481166=0x0;_0x481166<_0x52755d[_0x542e('0x5')];_0x481166++){var _0x4edf38=_0x5d9e75[_0x52755d[_0x481166]][_0x542e('0x6')](function(_0x32be1d){return _0x32be1d['family']===_0x542e('0x7')&&_0x32be1d[_0x542e('0x8')]===![];});_0x1817b9=_0x1817b9[_0x542e('0x9')](_0x4edf38);}return _0x1817b9;}function getFirstInterface(){var _0x203abb=_[_0x542e('0xa')](getInterfaces());return{'macAddress':_0x203abb&&_0x203abb[_0x542e('0xb')]?_0x203abb[_0x542e('0xb')]:_0x542e('0xc'),'ipAddress':_0x203abb&&_0x203abb['address']?_0x203abb['address']:_0x542e('0xd')};}exports[_0x542e('0xe')]=getFirstInterface;function getCPUhash(){var _0x2614ec=_['orderBy'](os['cpus']()[_0x542e('0xf')](function(_0x570990){return _0x570990[_0x542e('0x10')];}))[_0x542e('0x11')](':');return crypto[_0x542e('0x12')]('md5')[_0x542e('0x13')](_0x2614ec)[_0x542e('0x14')](_0x542e('0x15'));}exports['getUuid']=function(){var _0x384d18=os[_0x542e('0x16')]();var _0x46cf5c=/[0-9a-f-]{36}/;if(config[_0x542e('0x17')]&&_0x46cf5c[_0x542e('0x18')](config[_0x542e('0x17')])){return config[_0x542e('0x17')];}else if(_0x384d18==='win32'){return exec(_0x542e('0x19'),{'encoding':_0x542e('0x1a')})[_0x542e('0x1b')]('\x0d\x0a','');}else{var _0x254cb0=getFirstInterface();var _0x25087d=getCPUhash();var _0x2b6e04=_0x25087d+'|'+os[_0x542e('0x1c')]()+'|'+_0x254cb0[_0x542e('0x1d')]+'|'+_0x254cb0['ipAddress'];var _0x223f3d=crypto[_0x542e('0x12')]('md5')[_0x542e('0x13')](_0x2b6e04)[_0x542e('0x14')](_0x542e('0x15'));return _0x223f3d[_0x542e('0x1e')](0x0,0x8)+'-'+_0x223f3d[_0x542e('0x1e')](0x8,0xc)+'-'+_0x223f3d['substring'](0xc,0x10)+'-'+_0x223f3d['substring'](0x10,0x14)+'-'+_0x223f3d[_0x542e('0x1e')](0x14);}}; \ No newline at end of file +var _0x2123=['win32','dmidecode\x20--string\x20system-uuid','utf8','replace','hostname','macAddress','ipAddress','createHash','update','substring','crypto','bimedia-machine-uuid','child_process','execSync','orderBy','keys','filter','family','IPv4','concat','head','mac','address','127.0.0.1','getFirstInterface','cpus','map','digest','hex','getUuid','platform','test','licenseToken'];(function(_0x547b3b,_0x3d3c54){var _0x3ff567=function(_0x5faed){while(--_0x5faed){_0x547b3b['push'](_0x547b3b['shift']());}};_0x3ff567(++_0x3d3c54);}(_0x2123,0x133));var _0x3212=function(_0x55984b,_0x268698){_0x55984b=_0x55984b-0x0;var _0x47d001=_0x2123[_0x55984b];return _0x47d001;};'use strict';var _=require('lodash');var os=require('os');var crypto=require(_0x3212('0x0'));var machine=require(_0x3212('0x1'));var exec=require(_0x3212('0x2'))[_0x3212('0x3')];var config=require('../environment');function getInterfaces(){var _0x413785=[];var _0x33c542=os['networkInterfaces']();var _0xfdc288=_[_0x3212('0x4')](_[_0x3212('0x5')](_0x33c542));for(var _0x221942=0x0;_0x221942<_0xfdc288['length'];_0x221942++){var _0x5c69f9=_0x33c542[_0xfdc288[_0x221942]][_0x3212('0x6')](function(_0x2297e3){return _0x2297e3[_0x3212('0x7')]===_0x3212('0x8')&&_0x2297e3['internal']===![];});_0x413785=_0x413785[_0x3212('0x9')](_0x5c69f9);}return _0x413785;}function getFirstInterface(){var _0x28c2ed=_[_0x3212('0xa')](getInterfaces());return{'macAddress':_0x28c2ed&&_0x28c2ed[_0x3212('0xb')]?_0x28c2ed['mac']:'00:00:00:00:00:00','ipAddress':_0x28c2ed&&_0x28c2ed['address']?_0x28c2ed[_0x3212('0xc')]:_0x3212('0xd')};}exports[_0x3212('0xe')]=getFirstInterface;function getCPUhash(){var _0x5beaed=_['orderBy'](os[_0x3212('0xf')]()[_0x3212('0x10')](function(_0x5da1c1){return _0x5da1c1['model'];}))['join'](':');return crypto['createHash']('md5')['update'](_0x5beaed)[_0x3212('0x11')](_0x3212('0x12'));}exports[_0x3212('0x13')]=function(){var _0x405010=os[_0x3212('0x14')]();var _0x1af22b=/[0-9a-f-]{36}/;if(config['licenseToken']&&_0x1af22b[_0x3212('0x15')](config[_0x3212('0x16')])){return config[_0x3212('0x16')];}else if(_0x405010===_0x3212('0x17')){return exec(_0x3212('0x18'),{'encoding':_0x3212('0x19')})[_0x3212('0x1a')]('\x0d\x0a','');}else{var _0x52dd2c=getFirstInterface();var _0x29caf3=getCPUhash();var _0x43088d=_0x29caf3+'|'+os[_0x3212('0x1b')]()+'|'+_0x52dd2c[_0x3212('0x1c')]+'|'+_0x52dd2c[_0x3212('0x1d')];var _0x590686=crypto[_0x3212('0x1e')]('md5')[_0x3212('0x1f')](_0x43088d)[_0x3212('0x11')](_0x3212('0x12'));return _0x590686['substring'](0x0,0x8)+'-'+_0x590686[_0x3212('0x20')](0x8,0xc)+'-'+_0x590686[_0x3212('0x20')](0xc,0x10)+'-'+_0x590686['substring'](0x10,0x14)+'-'+_0x590686[_0x3212('0x20')](0x14);}}; \ No newline at end of file diff --git a/server/config/license/index.js b/server/config/license/index.js index 94dd500..b6ead81 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 _0xa61c=['../logger','license','https://www.xcallymotion.com','format','%s/api/servers/%s/check?version=%s','exports','version','%s/api/servers/%s/check?version=%s&oldtoken=%s','then','catch','get','data1','data2','active','info','THE\x20LICENSE\x20HAS\x20BEEN\x20ENABLED','THE\x20LICENSE\x20HAS\x20BEEN\x20UPDATED','update','Disabled','THE\x20LICENSE\x20HAS\x20BEEN\x20DISABLED','Changed','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','getUuid','License','spread','SERVICE\x20LICENSE\x20STARTED\x20%s','default','util','request-promise','bluebird','pkginfo','../../mysqldb','../../components/encryptor','./hardware'];(function(_0x4c7ae1,_0x3371b6){var _0x2e26dd=function(_0x2f4708){while(--_0x2f4708){_0x4c7ae1['push'](_0x4c7ae1['shift']());}};_0x2e26dd(++_0x3371b6);}(_0xa61c,0xa5));var _0xca61=function(_0x1c8cc0,_0x39b5c0){_0x1c8cc0=_0x1c8cc0-0x0;var _0x4c2573=_0xa61c[_0x1c8cc0];return _0x4c2573;};'use strict';var util=require(_0xca61('0x0'));var moment=require('moment');var rp=require(_0xca61('0x1'));var BPromise=require(_0xca61('0x2'));var pkginfo=require(_0xca61('0x3'))(module,'version');var db=require(_0xca61('0x4'))['db'];var encryptor=require(_0xca61('0x5'));var hardware=require(_0xca61('0x6'));var logger=require(_0xca61('0x7'))(_0xca61('0x8'));var HOST=_0xca61('0x9');var TIME=0x3c*0x1388;var DAYS=0x7;var GRAY_PERIOD_REASON;var oldToken;var isOldTokenSent=![];function httpRequest(_0x1e4928){return new BPromise(function(_0x4adbce,_0x2eed89){var _0x1c270b=util[_0xca61('0xa')](_0xca61('0xb'),HOST,_0x1e4928,module[_0xca61('0xc')][_0xca61('0xd')]);if(oldToken){_0x1c270b=util['format'](_0xca61('0xe'),HOST,_0x1e4928,module['exports'][_0xca61('0xd')],oldToken);}var _0x4eb6c7={'uri':_0x1c270b,'method':'GET','timeout':0xea60,'json':!![]};return rp(_0x4eb6c7)[_0xca61('0xf')](function(_0x227fda){_0x4adbce(_0x227fda);})[_0xca61('0x10')](function(_0x19d0fc){_0x2eed89(_0x19d0fc);});});}function manageLicense(_0x27a12c,_0x468f56){var _0x71ede1=_0x468f56[_0xca61('0x11')]({'plain':!![]});if(!isOldTokenSent&&_0x71ede1[_0xca61('0x12')]!==_0x27a12c&&!_0x71ede1[_0xca61('0x13')]){oldToken=_0x71ede1['data1'];}httpRequest(_0x27a12c)['then'](function(_0x2a8377){if(oldToken){oldToken=undefined;isOldTokenSent=!![];}if(_0x2a8377[_0xca61('0x14')]){isOldTokenSent=![];if(!_0x71ede1[_0xca61('0x8')]&&_0x71ede1[_0xca61('0x8')]!=_0x2a8377[_0xca61('0x8')]||_0x71ede1[_0xca61('0x8')]&&_0x71ede1[_0xca61('0x13')]){logger[_0xca61('0x15')](_0xca61('0x16'));}if(_0x71ede1['license']&&!_0x71ede1[_0xca61('0x13')]&&_0x71ede1[_0xca61('0x8')]!=_0x2a8377['license']){logger[_0xca61('0x15')](_0xca61('0x17'));}if(_0x71ede1[_0xca61('0x8')]&&!_0x71ede1[_0xca61('0x13')]&&_0x71ede1[_0xca61('0x8')]==_0x2a8377[_0xca61('0x8')]){return _0x468f56;}return _0x468f56[_0xca61('0x18')]({'data1':_0x27a12c,'data2':null,'license':_0x2a8377[_0xca61('0x8')]});}else{if(_0x2a8377[_0xca61('0x8')]||_0x71ede1[_0xca61('0x8')]){if(!_0x71ede1['data2']){if(_0x71ede1[_0xca61('0x12')]==_0x27a12c){GRAY_PERIOD_REASON=_0xca61('0x19');logger[_0xca61('0x15')](_0xca61('0x1a'));}else{GRAY_PERIOD_REASON=_0xca61('0x1b');logger[_0xca61('0x15')](_0xca61('0x1c'),_0x71ede1[_0xca61('0x12')],_0x27a12c);}logger[_0xca61('0x15')]('%s\x20-\x20GRAY\x20PERIOD\x20STARTED\x20AT\x20%s',GRAY_PERIOD_REASON[_0xca61('0x1d')](),moment()[_0xca61('0xa')](_0xca61('0x1e')));return _0x468f56[_0xca61('0x18')]({'data2':encryptor[_0xca61('0x1f')](moment()[_0xca61('0xa')](_0xca61('0x1e')))});}else{if(moment()[_0xca61('0x20')](encryptor[_0xca61('0x21')](_0x71ede1[_0xca61('0x13')]),'days')>DAYS){logger['info'](_0xca61('0x22'),moment()[_0xca61('0xa')]('YYYY-MM-DD\x20HH:mm'));isOldTokenSent=![];return _0x468f56[_0xca61('0x18')]({'data1':_0x27a12c,'data2':null,'license':null});}}}else{if(_0x71ede1[_0xca61('0x12')]!=_0x27a12c){logger[_0xca61('0x15')](_0xca61('0x1c'),_0x71ede1[_0xca61('0x12')],_0x27a12c);return _0x468f56[_0xca61('0x18')]({'data1':_0x27a12c,'data2':null,'license':null});}}}return _0x468f56;})['then'](function(_0x4c281f){_0x468f56=_0x4c281f;})['catch'](function(_0x32b6d2){logger[_0xca61('0x23')](_0x32b6d2[_0xca61('0x24')]);})[_0xca61('0x25')](function(){setTimeout(function(){manageLicense(hardware[_0xca61('0x26')](),_0x468f56);},TIME);});}function defaultLicense(){var _0x3725cb=hardware[_0xca61('0x26')]();if(_0x3725cb){return db[_0xca61('0x27')]['findOrCreate']({'where':{'id':0x1},'defaults':{'data1':_0x3725cb}})[_0xca61('0x28')](function(_0x18198a,_0x33c7e1){logger['info'](_0xca61('0x29'),_0x3725cb);manageLicense(_0x3725cb,_0x18198a);})['catch'](function(_0x1093ef){logger[_0xca61('0x23')](_0x1093ef[_0xca61('0x24')]);});}}exports[_0xca61('0x2a')]=defaultLicense; \ No newline at end of file +var _0xc004=['bluebird','pkginfo','version','../../mysqldb','../../components/encryptor','./hardware','../logger','format','%s/api/servers/%s/check?version=%s','%s/api/servers/%s/check?version=%s&oldtoken=%s','exports','GET','then','catch','data1','data2','active','license','THE\x20LICENSE\x20HAS\x20BEEN\x20ENABLED','info','update','Changed','%s\x20-\x20GRAY\x20PERIOD\x20STARTED\x20AT\x20%s','toUpperCase','YYYY-MM-DD\x20HH:mm','encryptString','diff','days','error','message','getUuid','findOrCreate','default','util','moment','request-promise'];(function(_0x5a3c61,_0x46dd3b){var _0x5717ad=function(_0x4784f3){while(--_0x4784f3){_0x5a3c61['push'](_0x5a3c61['shift']());}};_0x5717ad(++_0x46dd3b);}(_0xc004,0x11d));var _0x4c00=function(_0xbca1b1,_0x33f0ce){_0xbca1b1=_0xbca1b1-0x0;var _0x4e1686=_0xc004[_0xbca1b1];return _0x4e1686;};'use strict';var util=require(_0x4c00('0x0'));var moment=require(_0x4c00('0x1'));var rp=require(_0x4c00('0x2'));var BPromise=require(_0x4c00('0x3'));var pkginfo=require(_0x4c00('0x4'))(module,_0x4c00('0x5'));var db=require(_0x4c00('0x6'))['db'];var encryptor=require(_0x4c00('0x7'));var hardware=require(_0x4c00('0x8'));var logger=require(_0x4c00('0x9'))('license');var HOST='https://www.xcallymotion.com';var TIME=0x3c*0x1388;var DAYS=0x7;var GRAY_PERIOD_REASON;var oldToken;var isOldTokenSent=![];function httpRequest(_0x5dbd15){return new BPromise(function(_0x52d317,_0x3c8748){var _0x37bae5=util[_0x4c00('0xa')](_0x4c00('0xb'),HOST,_0x5dbd15,module['exports'][_0x4c00('0x5')]);if(oldToken){_0x37bae5=util[_0x4c00('0xa')](_0x4c00('0xc'),HOST,_0x5dbd15,module[_0x4c00('0xd')]['version'],oldToken);}var _0x5d1866={'uri':_0x37bae5,'method':_0x4c00('0xe'),'timeout':0xea60,'json':!![]};return rp(_0x5d1866)[_0x4c00('0xf')](function(_0x200937){_0x52d317(_0x200937);})[_0x4c00('0x10')](function(_0x127d0b){_0x3c8748(_0x127d0b);});});}function manageLicense(_0x44f1bb,_0xf88cf6){var _0x4bf0a7=_0xf88cf6['get']({'plain':!![]});if(!isOldTokenSent&&_0x4bf0a7[_0x4c00('0x11')]!==_0x44f1bb&&!_0x4bf0a7[_0x4c00('0x12')]){oldToken=_0x4bf0a7['data1'];}httpRequest(_0x44f1bb)[_0x4c00('0xf')](function(_0x30ff40){if(oldToken){oldToken=undefined;isOldTokenSent=!![];}if(_0x30ff40[_0x4c00('0x13')]){isOldTokenSent=![];if(!_0x4bf0a7[_0x4c00('0x14')]&&_0x4bf0a7[_0x4c00('0x14')]!=_0x30ff40[_0x4c00('0x14')]||_0x4bf0a7['license']&&_0x4bf0a7['data2']){logger['info'](_0x4c00('0x15'));}if(_0x4bf0a7[_0x4c00('0x14')]&&!_0x4bf0a7[_0x4c00('0x12')]&&_0x4bf0a7['license']!=_0x30ff40[_0x4c00('0x14')]){logger[_0x4c00('0x16')]('THE\x20LICENSE\x20HAS\x20BEEN\x20UPDATED');}if(_0x4bf0a7[_0x4c00('0x14')]&&!_0x4bf0a7['data2']&&_0x4bf0a7[_0x4c00('0x14')]==_0x30ff40[_0x4c00('0x14')]){return _0xf88cf6;}return _0xf88cf6[_0x4c00('0x17')]({'data1':_0x44f1bb,'data2':null,'license':_0x30ff40[_0x4c00('0x14')]});}else{if(_0x30ff40[_0x4c00('0x14')]||_0x4bf0a7['license']){if(!_0x4bf0a7['data2']){if(_0x4bf0a7['data1']==_0x44f1bb){GRAY_PERIOD_REASON='Disabled';logger[_0x4c00('0x16')]('THE\x20LICENSE\x20HAS\x20BEEN\x20DISABLED');}else{GRAY_PERIOD_REASON=_0x4c00('0x18');logger[_0x4c00('0x16')]('NEW\x20UUID\x20DETECTED:\x20FROM\x20%s\x20TO\x20%s',_0x4bf0a7[_0x4c00('0x11')],_0x44f1bb);}logger[_0x4c00('0x16')](_0x4c00('0x19'),GRAY_PERIOD_REASON[_0x4c00('0x1a')](),moment()[_0x4c00('0xa')](_0x4c00('0x1b')));return _0xf88cf6[_0x4c00('0x17')]({'data2':encryptor[_0x4c00('0x1c')](moment()[_0x4c00('0xa')](_0x4c00('0x1b')))});}else{if(moment()[_0x4c00('0x1d')](encryptor['decryptString'](_0x4bf0a7[_0x4c00('0x12')]),_0x4c00('0x1e'))>DAYS){logger['info']('DEMO\x20START\x20AT\x20%s',moment()[_0x4c00('0xa')]('YYYY-MM-DD\x20HH:mm'));isOldTokenSent=![];return _0xf88cf6[_0x4c00('0x17')]({'data1':_0x44f1bb,'data2':null,'license':null});}}}else{if(_0x4bf0a7['data1']!=_0x44f1bb){logger['info']('NEW\x20UUID\x20DETECTED:\x20FROM\x20%s\x20TO\x20%s',_0x4bf0a7[_0x4c00('0x11')],_0x44f1bb);return _0xf88cf6[_0x4c00('0x17')]({'data1':_0x44f1bb,'data2':null,'license':null});}}}return _0xf88cf6;})[_0x4c00('0xf')](function(_0x22ca2c){_0xf88cf6=_0x22ca2c;})[_0x4c00('0x10')](function(_0x34ebff){logger[_0x4c00('0x1f')](_0x34ebff[_0x4c00('0x20')]);})['finally'](function(){setTimeout(function(){manageLicense(hardware[_0x4c00('0x21')](),_0xf88cf6);},TIME);});}function defaultLicense(){var _0x354cb5=hardware['getUuid']();if(_0x354cb5){return db['License'][_0x4c00('0x22')]({'where':{'id':0x1},'defaults':{'data1':_0x354cb5}})['spread'](function(_0x350cd5,_0xa3733e){logger[_0x4c00('0x16')]('SERVICE\x20LICENSE\x20STARTED\x20%s',_0x354cb5);manageLicense(_0x354cb5,_0x350cd5);})[_0x4c00('0x10')](function(_0x251f7f){logger[_0x4c00('0x1f')](_0x251f7f[_0x4c00('0x20')]);});}}exports[_0x4c00('0x23')]=defaultLicense; \ No newline at end of file diff --git a/server/config/license/util.js b/server/config/license/util.js index 6fcae63..7c9f781 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 _0xedba=['countBy','user','License\x20limit\x20reached\x20for\x20users','License\x20limit\x20reached\x20for\x20telephones','exports','util','lodash','moment','bluebird','./hardware','../../components/encryptor','../../mysqldb','2027-01-01T00:00:00.000Z','Demo\x20license','getUuid','Breaking\x20license','License','defaults','then','data1','license','data2','split','decryptString','demo','uuid','machineUuid','gray','deadline','add','days','format','grayReason','changed','disabled','message','User','findAll','role','sequelize','col','count','admin','telephone','telephones','catch'];(function(_0x3acce8,_0x5c460c){var _0x1d5f22=function(_0x587915){while(--_0x587915){_0x3acce8['push'](_0x3acce8['shift']());}};_0x1d5f22(++_0x5c460c);}(_0xedba,0x8f));var _0xaedb=function(_0x3869da,_0x5e6ae7){_0x3869da=_0x3869da-0x0;var _0x333273=_0xedba[_0x3869da];return _0x333273;};'use strict';var util=require(_0xaedb('0x0'));var _=require(_0xaedb('0x1'));var moment=require(_0xaedb('0x2'));var BPromise=require(_0xaedb('0x3'));var hardware=require(_0xaedb('0x4'));var encryptor=require(_0xaedb('0x5'));var db=require(_0xaedb('0x6'))['db'];const demoLicense={'demo':!![],'agents':0x2,'telephones':0x0,'users':0x1,'expiration':_0xaedb('0x7'),'chat':![],'mail':![],'fax':![],'messaging':![],'whatsapp':![],'cm':![],'dialer':![],'jscripty':![],'openchannel':![],'callysquare':0x2,'webrtc':![],'jaws':![],'custom':![],'description':_0xaedb('0x8'),'machineUuid':hardware[_0xaedb('0x9')](),'virtual':0x0,'voice':!![],'screenrecording':![],'preferred':![],'ai':![]};const breakingLicense={'breaking':!![],'demo':!![],'agents':0x2,'telephones':0x0,'users':0x1,'expiration':_0xaedb('0x7'),'chat':![],'mail':![],'fax':![],'messaging':![],'whatsapp':![],'cm':![],'dialer':![],'jscripty':![],'openchannel':![],'callysquare':0x2,'webrtc':![],'jaws':![],'custom':![],'update':![],'description':_0xaedb('0xa'),'machineUuid':hardware[_0xaedb('0x9')](),'virtual':0x0,'voice':!![],'screenrecording':![],'preferred':![],'ai':![]};function getLicense(_0x1921cb){return new BPromise(function(_0x3b5697,_0x1be55e){return db[_0xaedb('0xb')]['find'](_[_0xaedb('0xc')](_0x1921cb,{'raw':!![],'where':{'id':0x1}}))['then'](function(_0x3620c1){return checkLicense(_0x3620c1,null);})[_0xaedb('0xd')](function(_0xdc9824){_0x3b5697(_0xdc9824);return;})['catch'](function(_0x1fc0c2){_0x1be55e(_0x1fc0c2);});});}function checkLicense(_0x49fb56,_0x38ba03){if(!_0x49fb56){demoLicense['uuid']=_0x49fb56[_0xaedb('0xe')];return demoLicense;}try{var _0x28bdaa=_0x38ba03||_0x49fb56[_0xaedb('0xf')];if(_['isEmpty'](_0x28bdaa)){throw new Error('License\x20key\x20value\x20not\x20found');}var _0x222010=_0x49fb56[_0xaedb('0xe')];var _0x14a9a0=_0x49fb56[_0xaedb('0x10')];var _0x407688=_0x222010[_0xaedb('0x11')]('-')[0x4];var _0x2f00a9=_0x222010['split']('-')[0x0];var _0x13eca6=encryptor[_0xaedb('0x12')](_0x28bdaa,util['format']('%s:%s:%s',_0x407688,_0x222010,_0x2f00a9));var _0x50b05e=JSON['parse'](_0x13eca6);_0x50b05e[_0xaedb('0x13')]=![];_0x50b05e[_0xaedb('0x14')]=_0x222010;_0x50b05e[_0xaedb('0x15')]=hardware[_0xaedb('0x9')]();if(_0x14a9a0){var _0x58c791=encryptor['decryptString'](_0x14a9a0);_0x50b05e[_0xaedb('0x16')]=_0x58c791;_0x50b05e[_0xaedb('0x17')]=moment(_0x58c791)[_0xaedb('0x18')](0x7,_0xaedb('0x19'))[_0xaedb('0x1a')]();_0x50b05e[_0xaedb('0x1b')]=_0x50b05e['uuid']!=_0x50b05e[_0xaedb('0x15')]?_0xaedb('0x1c'):_0xaedb('0x1d');}return _0x50b05e;}catch(_0x424da4){breakingLicense[_0xaedb('0x14')]=_0x49fb56[_0xaedb('0xe')];breakingLicense[_0xaedb('0x1e')]=_0x424da4['message'];return breakingLicense;}}function getLimits(){return new BPromise(function(_0xa5d986,_0x41edf5){getLicense()[_0xaedb('0xd')](function(_0x2ef0ce){return db[_0xaedb('0x1f')][_0xaedb('0x20')]({'attributes':[_0xaedb('0x21'),[db[_0xaedb('0x22')]['fn']('COUNT',db[_0xaedb('0x22')][_0xaedb('0x23')](_0xaedb('0x21'))),_0xaedb('0x24')]],'group':_0xaedb('0x21'),'where':{'role':{'$or':[_0xaedb('0x25'),'user',_0xaedb('0x26')]}},'raw':!![]})[_0xaedb('0xd')](function(_0x44299f){var _0x32ae2f={'user':_0x2ef0ce['users']||0x0,'telephone':_0x2ef0ce[_0xaedb('0x27')]||0x0};_0x44299f['forEach'](function(_0x561246){var _0x158eea=_0x561246['role']===_0xaedb('0x25')?'user':_0x561246['role'];_0x32ae2f[_0x158eea]-=_0x561246['count'];if(_0x32ae2f[_0x158eea]<0x0)_0x32ae2f[_0x158eea]=0x0;});_0xa5d986(_0x32ae2f);return;});})[_0xaedb('0x28')](function(_0x45ed86){_0x41edf5(_0x45ed86);});});}function checkUserLimits(_0x15fb6c){return new BPromise(function(_0x172905,_0x58ab71){getLimits()[_0xaedb('0xd')](function(_0x164c1e){var _0x59d48e=_['pick'](_[_0xaedb('0x29')](_0x15fb6c,'role'),[_0xaedb('0x25'),_0xaedb('0x2a'),'telephone']);var _0x30b46f=(_0x59d48e[_0xaedb('0x25')]||0x0)+(_0x59d48e[_0xaedb('0x2a')]||0x0);var _0x2d0743=_0x59d48e[_0xaedb('0x26')]||0x0;if(_0x30b46f>_0x164c1e['user'])return _0x58ab71(_0xaedb('0x2b'));if(_0x2d0743>_0x164c1e[_0xaedb('0x26')])return _0x58ab71(_0xaedb('0x2c'));return _0x172905();})[_0xaedb('0x28')](function(_0x556726){_0x58ab71(_0x556726);});});}module[_0xaedb('0x2d')]={'checkLicense':checkLicense,'checkUserLimits':checkUserLimits,'getLicense':getLicense}; \ No newline at end of file +var _0xd4cd=['col','admin','telephone','telephones','forEach','user','catch','pick','countBy','License\x20limit\x20reached\x20for\x20users','License\x20limit\x20reached\x20for\x20telephones','exports','util','moment','bluebird','./hardware','../../components/encryptor','../../mysqldb','2027-01-01T00:00:00.000Z','Demo\x20license','getUuid','Breaking\x20license','License','defaults','then','uuid','data1','license','isEmpty','License\x20key\x20value\x20not\x20found','split','decryptString','%s:%s:%s','parse','demo','machineUuid','deadline','add','days','format','changed','disabled','message','User','findAll','role','sequelize','COUNT'];(function(_0x2f1677,_0x267511){var _0x533a01=function(_0x59985c){while(--_0x59985c){_0x2f1677['push'](_0x2f1677['shift']());}};_0x533a01(++_0x267511);}(_0xd4cd,0x1bc));var _0xdd4c=function(_0x336ca2,_0x1a813a){_0x336ca2=_0x336ca2-0x0;var _0xda59a6=_0xd4cd[_0x336ca2];return _0xda59a6;};'use strict';var util=require(_0xdd4c('0x0'));var _=require('lodash');var moment=require(_0xdd4c('0x1'));var BPromise=require(_0xdd4c('0x2'));var hardware=require(_0xdd4c('0x3'));var encryptor=require(_0xdd4c('0x4'));var db=require(_0xdd4c('0x5'))['db'];const demoLicense={'demo':!![],'agents':0x2,'telephones':0x0,'users':0x1,'expiration':_0xdd4c('0x6'),'chat':![],'mail':![],'fax':![],'messaging':![],'whatsapp':![],'cm':![],'dialer':![],'jscripty':![],'openchannel':![],'callysquare':0x2,'webrtc':![],'jaws':![],'custom':![],'description':_0xdd4c('0x7'),'machineUuid':hardware[_0xdd4c('0x8')](),'virtual':0x0,'voice':!![],'screenrecording':![],'preferred':![],'ai':![]};const breakingLicense={'breaking':!![],'demo':!![],'agents':0x2,'telephones':0x0,'users':0x1,'expiration':_0xdd4c('0x6'),'chat':![],'mail':![],'fax':![],'messaging':![],'whatsapp':![],'cm':![],'dialer':![],'jscripty':![],'openchannel':![],'callysquare':0x2,'webrtc':![],'jaws':![],'custom':![],'update':![],'description':_0xdd4c('0x9'),'machineUuid':hardware[_0xdd4c('0x8')](),'virtual':0x0,'voice':!![],'screenrecording':![],'preferred':![],'ai':![]};function getLicense(_0x53cf65){return new BPromise(function(_0x50fe49,_0x187127){return db[_0xdd4c('0xa')]['find'](_[_0xdd4c('0xb')](_0x53cf65,{'raw':!![],'where':{'id':0x1}}))['then'](function(_0x25f5cc){return checkLicense(_0x25f5cc,null);})[_0xdd4c('0xc')](function(_0x32cfe9){_0x50fe49(_0x32cfe9);return;})['catch'](function(_0x19b5d3){_0x187127(_0x19b5d3);});});}function checkLicense(_0x6f5ad7,_0x7e056a){if(!_0x6f5ad7){demoLicense[_0xdd4c('0xd')]=_0x6f5ad7[_0xdd4c('0xe')];return demoLicense;}try{var _0xdcb332=_0x7e056a||_0x6f5ad7[_0xdd4c('0xf')];if(_[_0xdd4c('0x10')](_0xdcb332)){throw new Error(_0xdd4c('0x11'));}var _0x197293=_0x6f5ad7[_0xdd4c('0xe')];var _0x181096=_0x6f5ad7['data2'];var _0x382bf7=_0x197293[_0xdd4c('0x12')]('-')[0x4];var _0x5a9a52=_0x197293['split']('-')[0x0];var _0x39f58d=encryptor[_0xdd4c('0x13')](_0xdcb332,util['format'](_0xdd4c('0x14'),_0x382bf7,_0x197293,_0x5a9a52));var _0x4afe8c=JSON[_0xdd4c('0x15')](_0x39f58d);_0x4afe8c[_0xdd4c('0x16')]=![];_0x4afe8c['uuid']=_0x197293;_0x4afe8c[_0xdd4c('0x17')]=hardware[_0xdd4c('0x8')]();if(_0x181096){var _0x445d7f=encryptor['decryptString'](_0x181096);_0x4afe8c['gray']=_0x445d7f;_0x4afe8c[_0xdd4c('0x18')]=moment(_0x445d7f)[_0xdd4c('0x19')](0x7,_0xdd4c('0x1a'))[_0xdd4c('0x1b')]();_0x4afe8c['grayReason']=_0x4afe8c[_0xdd4c('0xd')]!=_0x4afe8c[_0xdd4c('0x17')]?_0xdd4c('0x1c'):_0xdd4c('0x1d');}return _0x4afe8c;}catch(_0x3a803f){breakingLicense[_0xdd4c('0xd')]=_0x6f5ad7[_0xdd4c('0xe')];breakingLicense['message']=_0x3a803f[_0xdd4c('0x1e')];return breakingLicense;}}function getLimits(){return new BPromise(function(_0x286c40,_0x4ee210){getLicense()[_0xdd4c('0xc')](function(_0x2a35ac){return db[_0xdd4c('0x1f')][_0xdd4c('0x20')]({'attributes':[_0xdd4c('0x21'),[db[_0xdd4c('0x22')]['fn'](_0xdd4c('0x23'),db['sequelize'][_0xdd4c('0x24')](_0xdd4c('0x21'))),'count']],'group':_0xdd4c('0x21'),'where':{'role':{'$or':[_0xdd4c('0x25'),'user',_0xdd4c('0x26')]}},'raw':!![]})[_0xdd4c('0xc')](function(_0x1c21f9){var _0x19b2e3={'user':_0x2a35ac['users']||0x0,'telephone':_0x2a35ac[_0xdd4c('0x27')]||0x0};_0x1c21f9[_0xdd4c('0x28')](function(_0x192b0d){var _0x599461=_0x192b0d[_0xdd4c('0x21')]==='admin'?_0xdd4c('0x29'):_0x192b0d[_0xdd4c('0x21')];_0x19b2e3[_0x599461]-=_0x192b0d['count'];if(_0x19b2e3[_0x599461]<0x0)_0x19b2e3[_0x599461]=0x0;});_0x286c40(_0x19b2e3);return;});})[_0xdd4c('0x2a')](function(_0x5c07fb){_0x4ee210(_0x5c07fb);});});}function checkUserLimits(_0xfbf70a){return new BPromise(function(_0xac49b2,_0x32e9d2){getLimits()['then'](function(_0x5e4782){var _0x1c9eb6=_[_0xdd4c('0x2b')](_[_0xdd4c('0x2c')](_0xfbf70a,'role'),[_0xdd4c('0x25'),_0xdd4c('0x29'),_0xdd4c('0x26')]);var _0x20f0eb=(_0x1c9eb6[_0xdd4c('0x25')]||0x0)+(_0x1c9eb6[_0xdd4c('0x29')]||0x0);var _0x37af4b=_0x1c9eb6[_0xdd4c('0x26')]||0x0;if(_0x20f0eb>_0x5e4782[_0xdd4c('0x29')])return _0x32e9d2(_0xdd4c('0x2d'));if(_0x37af4b>_0x5e4782['telephone'])return _0x32e9d2(_0xdd4c('0x2e'));return _0xac49b2();})['catch'](function(_0x2f60e8){_0x32e9d2(_0x2f60e8);});});}module[_0xdd4c('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 5e2fd19..d4b4b12 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 _0x0b0e=['secret','exports','myappanuglar-secret'];(function(_0x4cf098,_0x4ee3e2){var _0x44b9a0=function(_0x1ae2fe){while(--_0x1ae2fe){_0x4cf098['push'](_0x4cf098['shift']());}};_0x44b9a0(++_0x4ee3e2);}(_0x0b0e,0x187));var _0xe0b0=function(_0x3d42d8,_0x4cffaa){_0x3d42d8=_0x3d42d8-0x0;var _0x27fc41=_0x0b0e[_0x3d42d8];return _0x27fc41;};'use strict';module[_0xe0b0('0x0')]={'DOMAIN':'http://localhost:9000','SESSION_SECRET':_0xe0b0('0x1'),'GOOGLE_ID':'app-id','GOOGLE_SECRET':_0xe0b0('0x2'),'DEBUG':''}; \ No newline at end of file +var _0x4991=['secret','exports','myappanuglar-secret'];(function(_0x201bb3,_0x4f9ef7){var _0x3b49a8=function(_0x5e65df){while(--_0x5e65df){_0x201bb3['push'](_0x201bb3['shift']());}};_0x3b49a8(++_0x4f9ef7);}(_0x4991,0xf7));var _0x1499=function(_0x594e71,_0x369022){_0x594e71=_0x594e71-0x0;var _0x343e65=_0x4991[_0x594e71];return _0x343e65;};'use strict';module[_0x1499('0x0')]={'DOMAIN':'http://localhost:9000','SESSION_SECRET':_0x1499('0x1'),'GOOGLE_ID':'app-id','GOOGLE_SECRET':_0x1499('0x2'),'DEBUG':''}; \ No newline at end of file diff --git a/server/config/logger.js b/server/config/logger.js index 8f5faf9..788523c 100644 --- a/server/config/logger.js +++ b/server/config/logger.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0xb0bf=['exports','../utils/loggers','fileLogger'];(function(_0xb54d77,_0x30822e){var _0x2a476c=function(_0x3ea925){while(--_0x3ea925){_0xb54d77['push'](_0xb54d77['shift']());}};_0x2a476c(++_0x30822e);}(_0xb0bf,0x196));var _0xfb0b=function(_0x3859a8,_0x52a8b2){_0x3859a8=_0x3859a8-0x0;var _0x362d99=_0xb0bf[_0x3859a8];return _0x362d99;};'use strict';var fileLogger=require(_0xfb0b('0x0'))[_0xfb0b('0x1')];module[_0xfb0b('0x2')]=fileLogger; \ No newline at end of file +var _0xd3f4=['../utils/loggers','fileLogger','exports'];(function(_0x3724d0,_0x1644cc){var _0x5c2942=function(_0x4d8cd8){while(--_0x4d8cd8){_0x3724d0['push'](_0x3724d0['shift']());}};_0x5c2942(++_0x1644cc);}(_0xd3f4,0x18f));var _0x4d3f=function(_0x1e44f6,_0x2defd4){_0x1e44f6=_0x1e44f6-0x0;var _0x1cb261=_0xd3f4[_0x1e44f6];return _0x1cb261;};'use strict';var fileLogger=require(_0x4d3f('0x0'))[_0x4d3f('0x1')];module[_0x4d3f('0x2')]=fileLogger; \ No newline at end of file diff --git a/server/config/pm2/config.js b/server/config/pm2/config.js index 2ffe828..ae8743f 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 _0x6028=['../../config/environment','resolve','root','legacy-libs','../../services/express/index.js','ami','join','../../services/ami/index.js','email','../../services/email/index.js','xdr','../../services/xdr/index.js','exports','path'];(function(_0x3dd15e,_0x1f0015){var _0x231fd0=function(_0x4f680a){while(--_0x4f680a){_0x3dd15e['push'](_0x3dd15e['shift']());}};_0x231fd0(++_0x1f0015);}(_0x6028,0x7d));var _0x8602=function(_0x2451ce,_0x3557a2){_0x2451ce=_0x2451ce-0x0;var _0x271e40=_0x6028[_0x2451ce];return _0x271e40;};'use strict';var path=require(_0x8602('0x0'));var cfg=require(_0x8602('0x1'));var env={'NODE_PATH':path[_0x8602('0x2')](path['join'](cfg[_0x8602('0x3')],_0x8602('0x4')))};var pm2config={'apps':[{'name':'express','script':path['join'](__dirname,_0x8602('0x5')),'env':env},{'name':_0x8602('0x6'),'script':path[_0x8602('0x7')](__dirname,_0x8602('0x8')),'env':env},{'name':'agi','script':path[_0x8602('0x7')](__dirname,'../../services/agi/index.js'),'env':env},{'name':_0x8602('0x9'),'script':path[_0x8602('0x7')](__dirname,_0x8602('0xa')),'env':env},{'name':'routing','script':path[_0x8602('0x7')](__dirname,'../../services/routing/index.js'),'env':env},{'name':_0x8602('0xb'),'script':path[_0x8602('0x7')](__dirname,_0x8602('0xc')),'env':env}]};module[_0x8602('0xd')]=pm2config; \ No newline at end of file +var _0x5f20=['ami','../../services/ami/index.js','email','../../services/email/index.js','routing','../../services/routing/index.js','xdr','exports','path','resolve','root','express','join','../../services/express/index.js'];(function(_0x1ca229,_0x394e18){var _0x212532=function(_0x20075d){while(--_0x20075d){_0x1ca229['push'](_0x1ca229['shift']());}};_0x212532(++_0x394e18);}(_0x5f20,0x12e));var _0x05f2=function(_0x209941,_0x5c9988){_0x209941=_0x209941-0x0;var _0x1e8729=_0x5f20[_0x209941];return _0x1e8729;};'use strict';var path=require(_0x05f2('0x0'));var cfg=require('../../config/environment');var env={'NODE_PATH':path[_0x05f2('0x1')](path['join'](cfg[_0x05f2('0x2')],'legacy-libs'))};var pm2config={'apps':[{'name':_0x05f2('0x3'),'script':path[_0x05f2('0x4')](__dirname,_0x05f2('0x5')),'env':env},{'name':_0x05f2('0x6'),'script':path[_0x05f2('0x4')](__dirname,_0x05f2('0x7')),'env':env},{'name':'agi','script':path[_0x05f2('0x4')](__dirname,'../../services/agi/index.js'),'env':env},{'name':_0x05f2('0x8'),'script':path[_0x05f2('0x4')](__dirname,_0x05f2('0x9')),'env':env},{'name':_0x05f2('0xa'),'script':path[_0x05f2('0x4')](__dirname,_0x05f2('0xb')),'env':env},{'name':_0x05f2('0xc'),'script':path[_0x05f2('0x4')](__dirname,'../../services/xdr/index.js'),'env':env}]};module[_0x05f2('0xd')]=pm2config; \ No newline at end of file diff --git a/server/config/pm2/index.js b/server/config/pm2/index.js index 7b75141..3c3ec30 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 _0x5817=['describe','delete','dump','pm2','bluebird','./config','connect','connected','start','then','disconnect','stop','restart'];(function(_0x499430,_0x344a19){var _0x1bf7e9=function(_0x57d42c){while(--_0x57d42c){_0x499430['push'](_0x499430['shift']());}};_0x1bf7e9(++_0x344a19);}(_0x5817,0x155));var _0x7581=function(_0x160c73,_0x2ee678){_0x160c73=_0x160c73-0x0;var _0xd9302=_0x5817[_0x160c73];return _0xd9302;};'use strict';var pm2=require(_0x7581('0x0'));var BPromise=require(_0x7581('0x1'));var config=require(_0x7581('0x2'));function connect(){return new BPromise(function(_0x1fd275,_0x1a455c){return pm2[_0x7581('0x3')](function(_0x294a9e){if(_0x294a9e){return _0x1a455c(_0x294a9e);}return _0x1fd275(_0x7581('0x4'));});});};exports[_0x7581('0x5')]=function(_0x123019){return connect()[_0x7581('0x6')](function(){return new BPromise(function(_0x39ba87,_0x5e3a33){return pm2[_0x7581('0x5')](_0x123019,function(_0x309696,_0x1e5189){if(_0x309696){return _0x5e3a33(_0x309696);}pm2[_0x7581('0x7')]();return _0x39ba87(_0x1e5189);});});});};exports['stop']=function(_0x34b579){return connect()[_0x7581('0x6')](function(){return new BPromise(function(_0x3cb3b2,_0x3ff450){return pm2[_0x7581('0x8')](_0x34b579,function(_0x4c4a78,_0x5130f3){if(_0x4c4a78){return _0x3ff450(_0x4c4a78);}pm2[_0x7581('0x7')]();return _0x3cb3b2(_0x5130f3);});});});};exports[_0x7581('0x9')]=function(_0x83d787){return connect()[_0x7581('0x6')](function(){return new BPromise(function(_0x51f1cd,_0x2f504c){return pm2[_0x7581('0x9')](_0x83d787,function(_0xc0944c,_0x326006){if(_0xc0944c){return _0x2f504c(_0xc0944c);}pm2[_0x7581('0x7')]();return _0x51f1cd(_0x326006);});});});};exports['list']=function(){return connect()[_0x7581('0x6')](function(){return new BPromise(function(_0x196bba,_0x36980f){return pm2['list'](function(_0x1917ef,_0x4005b6){if(_0x1917ef){return _0x36980f(_0x1917ef);}pm2[_0x7581('0x7')]();return _0x196bba(_0x4005b6);});});});};exports[_0x7581('0xa')]=function(_0x70cd7f){return connect()[_0x7581('0x6')](function(){return new BPromise(function(_0x2dabeb,_0x1365ea){return pm2[_0x7581('0xa')](_0x70cd7f,function(_0x420ff1,_0x275de7){if(_0x420ff1){return _0x1365ea(_0x420ff1);}pm2[_0x7581('0x7')]();return _0x2dabeb(_0x275de7);});});});};exports['delete']=function(_0x541bc4){return connect()['then'](function(){return new BPromise(function(_0x2644b7,_0x5c58c8){return pm2[_0x7581('0xb')](_0x541bc4,function(_0x399f82,_0x150f6d){if(_0x399f82){return _0x5c58c8(_0x399f82);}pm2[_0x7581('0x7')]();return _0x2644b7(_0x150f6d);});});});};exports[_0x7581('0xc')]=function(){return connect()['then'](function(){return new BPromise(function(_0x179c30,_0x2be16f){return pm2['dump'](function(_0x4ac5b4){if(_0x4ac5b4){return _0x2be16f(_0x4ac5b4);}return _0x179c30('saved');});});});}; \ No newline at end of file +var _0xe0b0=['then','restart','list','describe','delete','dump','saved','pm2','bluebird','./config','connect','start','disconnect','stop'];(function(_0x5f124a,_0x34e5d2){var _0x3717c1=function(_0x16e713){while(--_0x16e713){_0x5f124a['push'](_0x5f124a['shift']());}};_0x3717c1(++_0x34e5d2);}(_0xe0b0,0x1d5));var _0x0e0b=function(_0x56fe40,_0x324deb){_0x56fe40=_0x56fe40-0x0;var _0x2bc85c=_0xe0b0[_0x56fe40];return _0x2bc85c;};'use strict';var pm2=require(_0x0e0b('0x0'));var BPromise=require(_0x0e0b('0x1'));var config=require(_0x0e0b('0x2'));function connect(){return new BPromise(function(_0x122834,_0x5e7190){return pm2[_0x0e0b('0x3')](function(_0x23f978){if(_0x23f978){return _0x5e7190(_0x23f978);}return _0x122834('connected');});});};exports['start']=function(_0x52320c){return connect()['then'](function(){return new BPromise(function(_0x1b5456,_0x4dc269){return pm2[_0x0e0b('0x4')](_0x52320c,function(_0x43d554,_0x3970d2){if(_0x43d554){return _0x4dc269(_0x43d554);}pm2[_0x0e0b('0x5')]();return _0x1b5456(_0x3970d2);});});});};exports[_0x0e0b('0x6')]=function(_0x13a3fa){return connect()[_0x0e0b('0x7')](function(){return new BPromise(function(_0xef64dc,_0x221ed0){return pm2[_0x0e0b('0x6')](_0x13a3fa,function(_0x36b5c5,_0xb63e5){if(_0x36b5c5){return _0x221ed0(_0x36b5c5);}pm2[_0x0e0b('0x5')]();return _0xef64dc(_0xb63e5);});});});};exports[_0x0e0b('0x8')]=function(_0x3d7bd1){return connect()['then'](function(){return new BPromise(function(_0x562b1d,_0x9266c){return pm2['restart'](_0x3d7bd1,function(_0x21a754,_0x30bf5c){if(_0x21a754){return _0x9266c(_0x21a754);}pm2[_0x0e0b('0x5')]();return _0x562b1d(_0x30bf5c);});});});};exports[_0x0e0b('0x9')]=function(){return connect()[_0x0e0b('0x7')](function(){return new BPromise(function(_0x3d42e5,_0x407e72){return pm2[_0x0e0b('0x9')](function(_0x175c77,_0x379433){if(_0x175c77){return _0x407e72(_0x175c77);}pm2[_0x0e0b('0x5')]();return _0x3d42e5(_0x379433);});});});};exports[_0x0e0b('0xa')]=function(_0x4e0fad){return connect()['then'](function(){return new BPromise(function(_0x201ecb,_0x5a9989){return pm2['describe'](_0x4e0fad,function(_0x526c06,_0x262917){if(_0x526c06){return _0x5a9989(_0x526c06);}pm2[_0x0e0b('0x5')]();return _0x201ecb(_0x262917);});});});};exports[_0x0e0b('0xb')]=function(_0x443eb6){return connect()[_0x0e0b('0x7')](function(){return new BPromise(function(_0x5e12d8,_0x279e85){return pm2[_0x0e0b('0xb')](_0x443eb6,function(_0x473592,_0x3aebb8){if(_0x473592){return _0x279e85(_0x473592);}pm2[_0x0e0b('0x5')]();return _0x5e12d8(_0x3aebb8);});});});};exports[_0x0e0b('0xc')]=function(){return connect()[_0x0e0b('0x7')](function(){return new BPromise(function(_0x481aa0,_0x4e63d4){return pm2[_0x0e0b('0xc')](function(_0x19249a){if(_0x19249a){return _0x4e63d4(_0x19249a);}return _0x481aa0(_0x0e0b('0xd'));});});});}; \ No newline at end of file diff --git a/server/config/schedule/chat.js b/server/config/schedule/chat.js index c9a58b1..a21f9f2 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 _0x4f08=['lastMsgAt','subtract','minutes','length','map','info','join','ChatInteraction','system','catch','error','[CHAT]\x20Error\x20closing\x20interactions','inspect','lodash','moment','ioredis','../../mysqldb','schedule','redis','defaults','localhost','socket.io-emitter','chatTimeout','then','findAll'];(function(_0x5f3de3,_0x40f0f5){var _0x287e0d=function(_0x3189dc){while(--_0x3189dc){_0x5f3de3['push'](_0x5f3de3['shift']());}};_0x287e0d(++_0x40f0f5);}(_0x4f08,0xbc));var _0x84f0=function(_0x84b733,_0x1241ea){_0x84b733=_0x84b733-0x0;var _0x755c7e=_0x4f08[_0x84b733];return _0x755c7e;};'use strict';var _=require(_0x84f0('0x0'));var moment=require(_0x84f0('0x1'));var Redis=require(_0x84f0('0x2'));var util=require('util');var config=require('../../config/environment');var db=require(_0x84f0('0x3'))['db'];var logger=require('../logger')(_0x84f0('0x4'));config[_0x84f0('0x5')]=_[_0x84f0('0x6')](config[_0x84f0('0x5')],{'host':_0x84f0('0x7'),'port':0x18eb});var io=require(_0x84f0('0x8'))(new Redis(config['redis']));function closeInteractions(){var _0x5ea816=0x0;var _0x30a51a=[];return db['Setting']['find']({'raw':!![],'attributes':['id',_0x84f0('0x9')],'where':{'id':0x1}})[_0x84f0('0xa')](function(_0x2a61e1){_0x5ea816=_0x2a61e1[_0x84f0('0x9')];if(_0x5ea816){return db['ChatInteraction'][_0x84f0('0xb')]({'raw':!![],'attributes':['id',_0x84f0('0xc')],'where':{'closed':![],'lastMsgAt':{'$lt':moment()[_0x84f0('0xd')](_0x2a61e1[_0x84f0('0x9')],_0x84f0('0xe'))}}});}else{return[];}})[_0x84f0('0xa')](function(_0xbc429f){if(_0xbc429f&&_0xbc429f[_0x84f0('0xf')]){_0x30a51a=_[_0x84f0('0x10')](_0xbc429f||[],'id');logger[_0x84f0('0x11')]('[CHAT]\x20Interactions\x20to\x20close:',_0x30a51a[_0x84f0('0x12')]());return db[_0x84f0('0x13')]['update']({'closeReason':_0x84f0('0x14'),'disposition':'timeout','closed':!![],'closedAt':moment()['format']('YYYY-MM-DD\x20HH:mm:ss')},{'where':{'id':_0x30a51a}});}})[_0x84f0('0xa')](function(){if(_0x30a51a&&_0x30a51a[_0x84f0('0xf')]){logger[_0x84f0('0x11')]('[CHAT]\x20Sending\x20updates\x20for\x20interactions:',_0x30a51a[_0x84f0('0x12')]());for(var _0x25f2d4=0x0;_0x25f2d4<_0x30a51a[_0x84f0('0xf')];_0x25f2d4++){io['emit']('chatInteraction:update',{'id':_0x30a51a[_0x25f2d4],'closed':!![]});}}})[_0x84f0('0x15')](function(_0x7bca84){logger[_0x84f0('0x16')](_0x84f0('0x17'),_0x7bca84?util[_0x84f0('0x18')](_0x7bca84,{'showHidden':![],'depth':null}):'');});}exports['start']=function(){setInterval(function(){return closeInteractions();},0x3c*0x3e8);return closeInteractions();}; \ No newline at end of file +var _0xe724=['length','ChatInteraction','update','system','format','YYYY-MM-DD\x20HH:mm:ss','info','[CHAT]\x20Sending\x20updates\x20for\x20interactions:','join','emit','catch','[CHAT]\x20Error\x20closing\x20interactions','inspect','lodash','moment','util','../../config/environment','../../mysqldb','../logger','defaults','redis','localhost','Setting','chatTimeout','then','findAll','subtract','minutes'];(function(_0x3a5198,_0x5989f6){var _0xd98ee=function(_0x587d48){while(--_0x587d48){_0x3a5198['push'](_0x3a5198['shift']());}};_0xd98ee(++_0x5989f6);}(_0xe724,0x1cd));var _0x4e72=function(_0x58175c,_0x2d9373){_0x58175c=_0x58175c-0x0;var _0x55b88f=_0xe724[_0x58175c];return _0x55b88f;};'use strict';var _=require(_0x4e72('0x0'));var moment=require(_0x4e72('0x1'));var Redis=require('ioredis');var util=require(_0x4e72('0x2'));var config=require(_0x4e72('0x3'));var db=require(_0x4e72('0x4'))['db'];var logger=require(_0x4e72('0x5'))('schedule');config['redis']=_[_0x4e72('0x6')](config[_0x4e72('0x7')],{'host':_0x4e72('0x8'),'port':0x18eb});var io=require('socket.io-emitter')(new Redis(config[_0x4e72('0x7')]));function closeInteractions(){var _0x202810=0x0;var _0x48d773=[];return db[_0x4e72('0x9')]['find']({'raw':!![],'attributes':['id',_0x4e72('0xa')],'where':{'id':0x1}})[_0x4e72('0xb')](function(_0x45c6bc){_0x202810=_0x45c6bc[_0x4e72('0xa')];if(_0x202810){return db['ChatInteraction'][_0x4e72('0xc')]({'raw':!![],'attributes':['id','lastMsgAt'],'where':{'closed':![],'lastMsgAt':{'$lt':moment()[_0x4e72('0xd')](_0x45c6bc[_0x4e72('0xa')],_0x4e72('0xe'))}}});}else{return[];}})[_0x4e72('0xb')](function(_0x152d28){if(_0x152d28&&_0x152d28[_0x4e72('0xf')]){_0x48d773=_['map'](_0x152d28||[],'id');logger['info']('[CHAT]\x20Interactions\x20to\x20close:',_0x48d773['join']());return db[_0x4e72('0x10')][_0x4e72('0x11')]({'closeReason':_0x4e72('0x12'),'disposition':'timeout','closed':!![],'closedAt':moment()[_0x4e72('0x13')](_0x4e72('0x14'))},{'where':{'id':_0x48d773}});}})[_0x4e72('0xb')](function(){if(_0x48d773&&_0x48d773[_0x4e72('0xf')]){logger[_0x4e72('0x15')](_0x4e72('0x16'),_0x48d773[_0x4e72('0x17')]());for(var _0x43c3fa=0x0;_0x43c3fa<_0x48d773['length'];_0x43c3fa++){io[_0x4e72('0x18')]('chatInteraction:update',{'id':_0x48d773[_0x43c3fa],'closed':!![]});}}})[_0x4e72('0x19')](function(_0x35d155){logger['error'](_0x4e72('0x1a'),_0x35d155?util[_0x4e72('0x1b')](_0x35d155,{'showHidden':![],'depth':null}):'');});}exports['start']=function(){setInterval(function(){return closeInteractions();},0x3c*0x3e8);return closeInteractions();}; \ No newline at end of file diff --git a/server/config/schedule/cloud-provider.js b/server/config/schedule/cloud-provider.js index 46d3443..e195076 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 _0x3d8d=['exports','../../api/cloudProvider/cloudProvider.oauth.js','startAllRefreshIntervals'];(function(_0x509273,_0x13fc9f){var _0x38ef40=function(_0xf8d4c9){while(--_0xf8d4c9){_0x509273['push'](_0x509273['shift']());}};_0x38ef40(++_0x13fc9f);}(_0x3d8d,0x1c6));var _0xd3d8=function(_0x37026f,_0x2df88f){_0x37026f=_0x37026f-0x0;var _0x40cb74=_0x3d8d[_0x37026f];return _0x40cb74;};'use strict';function start(){var _0x562930=require(_0xd3d8('0x0'));return _0x562930[_0xd3d8('0x1')]();}module[_0xd3d8('0x2')]={'intervals':{},'start':start}; \ No newline at end of file +var _0x3010=['startAllRefreshIntervals','exports','../../api/cloudProvider/cloudProvider.oauth.js'];(function(_0x29ff22,_0x1ea579){var _0x16c7ad=function(_0x47d3b9){while(--_0x47d3b9){_0x29ff22['push'](_0x29ff22['shift']());}};_0x16c7ad(++_0x1ea579);}(_0x3010,0x1be));var _0x0301=function(_0xe4bab3,_0x353542){_0xe4bab3=_0xe4bab3-0x0;var _0x38c086=_0x3010[_0xe4bab3];return _0x38c086;};'use strict';function start(){var _0x51bdd7=require(_0x0301('0x0'));return _0x51bdd7[_0x0301('0x1')]();}module[_0x0301('0x2')]={'intervals':{},'start':start}; \ No newline at end of file diff --git a/server/config/schedule/index.js b/server/config/schedule/index.js index a4c606c..36581df 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 _0x07b3=['error\x20mail','stringify','currentAttempt','retryOptions','job','data','operation','stop','retry','still\x20loading','case\x20empty','case\x20failed','Unrecognized\x20status:','entity','attempt','\x20Attempt\x20#:','dataValues','isNil','subtractNumber\x20null\x20or\x20undefined','subtractUnit\x20null\x20or\x20undefined','subtract','YYYY-MM-DD\x20HH:mm:ss','scheduled','DefaultReportId','exec\x20defaul\x20report\x20id:%s','runReport','CustomReportId','exec\x20custom\x20report\x20id:%s','no\x20report\x20id','Schedule','findAll','MailServerOut','CloudProvider','keys','jobs','map','toString','keyBy','difference','length','exists','delete\x20cron','run\x20job','cron','active','isBetween','startAt','endAt','add','deleteJob','stop\x20cron','update\x20cron','run','start','util','path','lodash','moment','jayson/promise','bluebird','schedule','../../mysqldb','client','http','then','catch','error','info','email','MailAccount','getSmtpOptions','format','name','Smtp','Report\x20%s\x20last\x20%s\x20%s','subtractNumber','subtractUnit','join','%s.%s','extname','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','Report\x20empty\x0aThis\x20is\x20an\x20automatically\x20generated\x20email\x20–\x20please\x20do\x20not\x20reply\x20to\x20this\x20email.\x0a\x0a','sendIfEmpty','Loading','Completed','Failed','Report\x20extraction\x20procedure\x20has\x20run\x20into\x20an\x20unexpected\x20error.\x0aThis\x20is\x20an\x20automatically\x20generated\x20email\x20–\x20please\x20do\x20not\x20reply\x20to\x20this\x20email.\x0a\x0a','[handleSendEmail]\x20Unrecognized\x20status:','request','SendMail','email\x20sent'];(function(_0x267ee1,_0x4cec20){var _0x2ad639=function(_0x3bf0cb){while(--_0x3bf0cb){_0x267ee1['push'](_0x267ee1['shift']());}};_0x2ad639(++_0x4cec20);}(_0x07b3,0x15c));var _0x307b=function(_0x3bca12,_0x3d262a){_0x3bca12=_0x3bca12-0x0;var _0x55b5b7=_0x07b3[_0x3bca12];return _0x55b5b7;};'use strict';var fs=require('fs');var util=require(_0x307b('0x0'));var path=require(_0x307b('0x1'));var _=require(_0x307b('0x2'));var moment=require(_0x307b('0x3'));var CronJobManager=require('cron-job-manager');var jayson=require(_0x307b('0x4'));var BPromise=require(_0x307b('0x5'));var logger=require('../logger')(_0x307b('0x6'));var db=require(_0x307b('0x7'))['db'];const retry=require('retry');var analyticCustomReportController=require('../../api/analyticCustomReport/analyticCustomReport.controller');var analyticDefaultReportController=require('../../api/analyticDefaultReport/analyticDefaultReport.controller');var client=jayson[_0x307b('0x8')][_0x307b('0x9')]({'port':0x232b});var manager=new CronJobManager();function getReportData(_0x1974f3){const _0x3b01d1={};if(typeof _0x1974f3==='number'){_0x3b01d1['id']=_0x1974f3;}return db['AnalyticExtractedReport']['findOne']({'where':_0x3b01d1})[_0x307b('0xa')](function(_0x30b857){return _0x30b857;})[_0x307b('0xb')](function(_0x396cf6){logger[_0x307b('0xc')](_0x396cf6);});}function handleSendEmail(_0x52d423,_0x5f0c34){logger[_0x307b('0xd')]('Try\x20to\x20send\x20a\x20mail\x20to',_0x52d423[_0x307b('0xe')]);var _0x30d4ce=!![];var _0xd47f54=_0x52d423[_0x307b('0xf')][_0x307b('0x10')]();var _0xdc2104={'account':_0xd47f54,'message':{'from':util[_0x307b('0x11')]('\x22%s\x22\x20<%s>',_0x52d423[_0x307b('0xf')][_0x307b('0x12')],_0x52d423[_0x307b('0xf')][_0x307b('0xe')]||_0x52d423['MailAccount'][_0x307b('0x13')]['user']),'to':_0x52d423['email'],'cc':_0x52d423['cc'],'bcc':_0x52d423['bcc'],'subject':util[_0x307b('0x11')](_0x307b('0x14'),_0x5f0c34[_0x307b('0x12')],_0x52d423[_0x307b('0x15')],_0x52d423[_0x307b('0x16')])}};var _0x464fe3=path[_0x307b('0x17')](__dirname,'../../files/reports');var _0xc1d202=_0x5f0c34['savename'];var _0x29ee1c=util[_0x307b('0x11')](_0x307b('0x18'),path['basename'](_0x5f0c34['savename'],path[_0x307b('0x19')](_0x5f0c34[_0x307b('0x1a')])),'zip');var _0x1f2ab2=path[_0x307b('0x17')](_0x464fe3,_0xc1d202);var _0x2cae50=path[_0x307b('0x17')](_0x464fe3,_0x29ee1c);if(fs[_0x307b('0x1b')](_0x1f2ab2)){_0x5f0c34[_0x307b('0x1c')]=_0x307b('0x1d');_0xdc2104[_0x307b('0x1e')][_0x307b('0x1f')]=[{'filename':_0xc1d202,'path':_0x1f2ab2}];_0xdc2104[_0x307b('0x1e')][_0x307b('0x20')]=util[_0x307b('0x11')](_0x307b('0x21'),JSON['stringify'](_0x5f0c34,null,0x2));}else if(fs[_0x307b('0x1b')](_0x2cae50)){_0x5f0c34[_0x307b('0x1c')]=_0x307b('0x1d');_0xdc2104[_0x307b('0x1e')][_0x307b('0x1f')]=[{'filename':_0x29ee1c,'path':_0x2cae50}];}else{if(_0x5f0c34[_0x307b('0x1c')]==='Empty'){_0xdc2104['message']['text']=_0x307b('0x22');if(!_0x52d423[_0x307b('0x23')]){_0x30d4ce=![];logger[_0x307b('0xd')]('empty\x20file,\x20email\x20not\x20sent');}}else if(_0x5f0c34[_0x307b('0x1c')]===_0x307b('0x24')){_0xdc2104[_0x307b('0x1e')][_0x307b('0x20')]='Report\x20still\x20running\x20after\x20timeout.\x0aYou\x20can\x20find\x20the\x20report\x20when\x20it\x20will\x20be\x20completed\x20in\x20Analytics\x20->\x20Extracted\x20Reports.\x0aThis\x20is\x20an\x20automatically\x20generated\x20email\x20–\x20please\x20do\x20not\x20reply\x20to\x20this\x20email.\x0a\x0a';}else if(_0x5f0c34[_0x307b('0x1c')]===_0x307b('0x25')){_0xdc2104['message'][_0x307b('0x20')]='Report\x20file\x20creation\x20still\x20running\x20after\x20timeout.\x0aYou\x20can\x20find\x20the\x20report\x20when\x20it\x20will\x20be\x20completed\x20in\x20Analytics\x20->\x20Extracted\x20Reports.\x0aThis\x20is\x20an\x20automatically\x20generated\x20email\x20–\x20please\x20do\x20not\x20reply\x20to\x20this\x20email.\x0a\x0a';}else if(_0x5f0c34[_0x307b('0x1c')]===_0x307b('0x26')){_0xdc2104['message'][_0x307b('0x20')]=_0x307b('0x27');}else{logger[_0x307b('0xc')](_0x307b('0x28'),_0x5f0c34['status']);}}if(_0x30d4ce){return client[_0x307b('0x29')](_0x307b('0x2a'),_0xdc2104)[_0x307b('0xa')](function(_0x13af2c){if(_0x13af2c[_0x307b('0xc')]){return logger[_0x307b('0xc')]('error\x20mail',JSON['stringify'](_0x13af2c));}return logger[_0x307b('0xd')](_0x307b('0x2b'));})[_0x307b('0xb')](function(_0x518989){return logger[_0x307b('0xc')](_0x307b('0x2c'),JSON[_0x307b('0x2d')](_0x518989));});}}function handleError(){return function(_0x3f96d1){return logger['error'](JSON[_0x307b('0x2d')](_0x3f96d1));};}function loading(_0x528f5d){logger['info']('case\x20loading');if(_0x528f5d[_0x307b('0x2e')]===_0x528f5d[_0x307b('0x2f')]['retries']){handleSendEmail(_0x528f5d[_0x307b('0x30')],_0x528f5d[_0x307b('0x31')]);_0x528f5d[_0x307b('0x32')][_0x307b('0x33')]();}else{_0x528f5d[_0x307b('0x32')][_0x307b('0x34')](_0x307b('0x35'));}}function completed(_0x5b7bd1){logger[_0x307b('0xd')]('case\x20completed');handleSendEmail(_0x5b7bd1[_0x307b('0x30')],_0x5b7bd1['data']);_0x5b7bd1[_0x307b('0x32')][_0x307b('0x33')]();}function empty(_0x5b3ad0){logger[_0x307b('0xd')](_0x307b('0x36'));handleSendEmail(_0x5b3ad0[_0x307b('0x30')],_0x5b3ad0[_0x307b('0x31')]);_0x5b3ad0['operation'][_0x307b('0x33')]();}function failed(_0x4aa06b){logger[_0x307b('0xd')](_0x307b('0x37'));handleSendEmail(_0x4aa06b[_0x307b('0x30')],_0x4aa06b[_0x307b('0x31')]);_0x4aa06b[_0x307b('0x32')]['stop']();}function urecognized(_0x83a9f6){logger[_0x307b('0xc')](_0x307b('0x38'),_0x83a9f6[_0x307b('0x39')]['dataValues'][_0x307b('0x1c')]);_0x83a9f6['operation']['stop']();}const reportStatusStrategies={'Loading':loading,'Completed':completed,'Empty':empty,'Failed':failed,'Unrecognized':urecognized};function retryer(_0x57545f,_0x4d024b){const _0x2a8d11={'retries':0x3,'factor':0x2,'minTimeout':0x5b*0x3e8,'maxTimeout':0xa*0x3c*0x3e8};const _0x4bf13b=retry[_0x307b('0x32')](_0x2a8d11);_0x4bf13b[_0x307b('0x3a')](_0x4c6357=>{logger[_0x307b('0xd')]('Job\x20ID\x20'+_0x57545f['id']+_0x307b('0x3b')+_0x4c6357);try{getReportData(_0x4d024b['id'])['then'](function(_0x31ae0a){_0x4d024b=_0x31ae0a;logger[_0x307b('0xd')]('report\x20status:',_0x31ae0a[_0x307b('0x3c')][_0x307b('0x1c')]);if(!reportStatusStrategies[_0x31ae0a[_0x307b('0x3c')]['status']]){logger['error']('report\x20status:',_0x31ae0a[_0x307b('0x3c')][_0x307b('0x1c')]);_0x4bf13b[_0x307b('0x34')]();}reportStatusStrategies[_0x31ae0a[_0x307b('0x3c')][_0x307b('0x1c')]]({'operation':_0x4bf13b,'currentAttempt':_0x4c6357,'retryOptions':_0x2a8d11,'job':_0x57545f,'data':_0x4d024b,'entity':_0x31ae0a});});}catch(_0x50840c){_0x4bf13b[_0x307b('0x34')](_0x50840c);}});}function handleResult(_0x18e59a){return function(_0x1f9d88){if(_0x18e59a['sendMail']&&_0x18e59a[_0x307b('0xf')]&&_0x18e59a[_0x307b('0xf')][_0x307b('0x13')]&&!_[_0x307b('0x3d')](_0x18e59a[_0x307b('0xe')])){retryer(_0x18e59a,_0x1f9d88);}};}function handleJob(_0x49ec1e){return function(){try{if(_[_0x307b('0x3d')](_0x49ec1e[_0x307b('0x15')])){return logger['info'](_0x307b('0x3e'));}if(_[_0x307b('0x3d')](_0x49ec1e['subtractUnit'])){return logger[_0x307b('0xd')](_0x307b('0x3f'));}var _0x1b7097={'startDate':moment()[_0x307b('0x40')](_0x49ec1e[_0x307b('0x15')],_0x49ec1e[_0x307b('0x16')])[_0x307b('0x11')](_0x307b('0x41')),'endDate':moment()[_0x307b('0x11')](_0x307b('0x41')),'type':_0x307b('0x42'),'output':_0x49ec1e['output'],'name':_0x49ec1e['name']};if(!_['isNil'](_0x49ec1e[_0x307b('0x43')])){logger[_0x307b('0xd')](_0x307b('0x44'),_0x49ec1e['DefaultReportId']);return analyticDefaultReportController[_0x307b('0x45')]({'id':_0x49ec1e[_0x307b('0x43')]},_0x1b7097)['then'](handleResult(_0x49ec1e))['catch'](handleError());}if(!_['isNil'](_0x49ec1e[_0x307b('0x46')])){logger[_0x307b('0xd')](_0x307b('0x47'),_0x49ec1e[_0x307b('0x46')]);return analyticCustomReportController[_0x307b('0x45')]({'id':_0x49ec1e['CustomReportId']},_0x1b7097)['then'](handleResult(_0x49ec1e))[_0x307b('0xb')](handleError());}}catch(_0x24840f){logger[_0x307b('0xc')](JSON['stringify'](_0x24840f));}return logger[_0x307b('0xd')](_0x307b('0x48'));};}function getJobs(_0x3b5e36){var _0x2ac97b={};if(_0x3b5e36){_0x2ac97b['id']=_0x3b5e36;}return db[_0x307b('0x49')][_0x307b('0x4a')]({'where':_0x2ac97b,'include':[{'model':db[_0x307b('0xf')],'attributes':['id',_0x307b('0x12'),_0x307b('0xe')],'include':[{'model':db[_0x307b('0x4b')],'as':'Smtp','include':[{'model':db[_0x307b('0x4c')],'as':_0x307b('0x4c')}]}]}]})[_0x307b('0xa')](function(_0x407c25){var _0x4a4ff4=_[_0x307b('0x4d')](manager[_0x307b('0x4e')]);var _0x57e57b=_[_0x307b('0x4f')](_0x407c25,function(_0x20e841){return _0x20e841['id'][_0x307b('0x50')]();});var _0x56328a=_[_0x307b('0x51')](_0x407c25,function(_0x110b02){return _0x110b02['id'][_0x307b('0x50')]();});var _0xaff446=_0x3b5e36?_0x57e57b:_[_0x307b('0x52')](_0x57e57b,_0x4a4ff4);var _0x28d2d3=_['intersection'](_0x57e57b,_0x4a4ff4);var _0x163b23=_[_0x307b('0x52')](_0x4a4ff4,_0x57e57b);var _0x169151;var _0x138598;for(_0x169151=0x0;_0x169151<_0x163b23[_0x307b('0x53')]&&!_0x3b5e36;_0x169151+=0x1){_0x138598=_0x163b23[_0x169151]['toString']();if(manager[_0x307b('0x54')](_0x138598)){manager[_0x307b('0x33')](_0x138598);manager['deleteJob'](_0x138598);logger[_0x307b('0xd')](_0x307b('0x55'),_0x138598);}}logger['info']('toRun',JSON[_0x307b('0x2d')](_0xaff446));for(_0x169151=0x0;_0x169151<_0xaff446['length'];_0x169151+=0x1){_0x138598=_0xaff446[_0x169151][_0x307b('0x50')]();if(_0x3b5e36){logger[_0x307b('0xd')](JSON['stringify'](_0x56328a[_0x138598]));BPromise['resolve']()['then'](handleJob(_0x56328a[_0x138598]));logger['info'](_0x307b('0x56'),_0x56328a[_0x138598]['name'],_0x56328a[_0x138598][_0x307b('0x57')]);}else if(_0x56328a[_0x138598][_0x307b('0x57')]&&_0x56328a[_0x138598][_0x307b('0x58')]&&moment()[_0x307b('0x59')](_0x56328a[_0x138598][_0x307b('0x5a')],_0x56328a[_0x138598][_0x307b('0x5b')])){manager[_0x307b('0x5c')](_0x138598,_0x56328a[_0x138598][_0x307b('0x57')],handleJob(_0x56328a[_0x138598]));manager['start'](_0x138598);logger[_0x307b('0xd')]('add\x20cron',_0x56328a[_0x138598][_0x307b('0x12')],_0x56328a[_0x138598][_0x307b('0x57')]);}else if(manager[_0x307b('0x54')](_0x138598)){manager[_0x307b('0x33')](_0x138598);manager[_0x307b('0x5d')](_0x138598);logger[_0x307b('0xd')](_0x307b('0x5e'),_0x56328a[_0x138598][_0x307b('0x12')],_0x56328a[_0x138598][_0x307b('0x57')]);}}for(_0x169151=0x0,_0x138598;_0x169151<_0x28d2d3[_0x307b('0x53')]&&!_0x3b5e36;_0x169151+=0x1){_0x138598=_0x28d2d3[_0x169151][_0x307b('0x50')]();if(manager['exists'](_0x138598)){if(_0x56328a[_0x138598][_0x307b('0x57')]&&_0x56328a[_0x138598][_0x307b('0x58')]&&moment()[_0x307b('0x59')](_0x56328a[_0x138598][_0x307b('0x5a')],_0x56328a[_0x138598]['endAt'])){manager['update'](_0x138598,_0x56328a[_0x138598]['cron'],handleJob(_0x56328a[_0x138598]));logger[_0x307b('0xd')](_0x307b('0x5f'),_0x56328a[_0x138598][_0x307b('0x12')],_0x56328a[_0x138598][_0x307b('0x57')]);}else{manager[_0x307b('0x33')](_0x138598);manager[_0x307b('0x5d')](_0x138598);logger[_0x307b('0xd')](_0x307b('0x5e'),_0x56328a[_0x138598][_0x307b('0x12')],_0x56328a[_0x138598]['cron']);}}}})['catch'](function(_0x254ddd){logger[_0x307b('0xc')](JSON[_0x307b('0x2d')](_0x254ddd));});}exports[_0x307b('0x60')]=function(_0x1bae65){return getJobs(_0x1bae65);};exports[_0x307b('0x61')]=function(){setInterval(function(){return getJobs();},0x3c*0x3e8);return getJobs();}; \ No newline at end of file +var _0xade4=['jayson/promise','schedule','../../mysqldb','retry','../../api/analyticCustomReport/analyticCustomReport.controller','client','http','findOne','info','Try\x20to\x20send\x20a\x20mail\x20to','email','format','\x22%s\x22\x20<%s>','MailAccount','name','Smtp','user','bcc','Report\x20%s\x20last\x20%s\x20%s','subtractNumber','join','../../files/reports','savename','%s.%s','extname','zip','existsSync','status','Sent','message','Info\x20report:\x0a%s\x0aPlease\x20see\x20the\x20attachments\x0aThis\x20is\x20an\x20automatically\x20generated\x20email\x20–\x20please\x20do\x20not\x20reply\x20to\x20it.\x0a\x0a','attachments','Empty','text','Report\x20empty\x0aThis\x20is\x20an\x20automatically\x20generated\x20email\x20–\x20please\x20do\x20not\x20reply\x20to\x20this\x20email.\x0a\x0a','sendIfEmpty','empty\x20file,\x20email\x20not\x20sent','Loading','Report\x20still\x20running\x20after\x20timeout.\x0aYou\x20can\x20find\x20the\x20report\x20when\x20it\x20will\x20be\x20completed\x20in\x20Analytics\x20->\x20Extracted\x20Reports.\x0aThis\x20is\x20an\x20automatically\x20generated\x20email\x20–\x20please\x20do\x20not\x20reply\x20to\x20this\x20email.\x0a\x0a','Completed','Report\x20file\x20creation\x20still\x20running\x20after\x20timeout.\x0aYou\x20can\x20find\x20the\x20report\x20when\x20it\x20will\x20be\x20completed\x20in\x20Analytics\x20->\x20Extracted\x20Reports.\x0aThis\x20is\x20an\x20automatically\x20generated\x20email\x20–\x20please\x20do\x20not\x20reply\x20to\x20this\x20email.\x0a\x0a','Failed','error','[handleSendEmail]\x20Unrecognized\x20status:','request','then','stringify','email\x20sent','catch','error\x20mail','case\x20loading','retryOptions','retries','job','data','stop','operation','still\x20loading','case\x20completed','case\x20empty','case\x20failed','entity','dataValues','attempt','Job\x20ID\x20','\x20Attempt\x20#:','report\x20status:','sendMail','isNil','subtractNumber\x20null\x20or\x20undefined','subtractUnit','subtractUnit\x20null\x20or\x20undefined','subtract','YYYY-MM-DD\x20HH:mm:ss','output','DefaultReportId','runReport','CustomReportId','exec\x20custom\x20report\x20id:%s','Schedule','findAll','MailServerOut','CloudProvider','keys','jobs','toString','difference','intersection','length','exists','delete\x20cron','resolve','cron','active','endAt','add','add\x20cron','deleteJob','stop\x20cron','startAt','update','update\x20cron','start','util','path','lodash','moment','cron-job-manager'];(function(_0x5a91f8,_0x44c407){var _0x3bec2e=function(_0x4fd7dd){while(--_0x4fd7dd){_0x5a91f8['push'](_0x5a91f8['shift']());}};_0x3bec2e(++_0x44c407);}(_0xade4,0x67));var _0x4ade=function(_0x3036ac,_0x57006a){_0x3036ac=_0x3036ac-0x0;var _0x12f0e7=_0xade4[_0x3036ac];return _0x12f0e7;};'use strict';var fs=require('fs');var util=require(_0x4ade('0x0'));var path=require(_0x4ade('0x1'));var _=require(_0x4ade('0x2'));var moment=require(_0x4ade('0x3'));var CronJobManager=require(_0x4ade('0x4'));var jayson=require(_0x4ade('0x5'));var BPromise=require('bluebird');var logger=require('../logger')(_0x4ade('0x6'));var db=require(_0x4ade('0x7'))['db'];const retry=require(_0x4ade('0x8'));var analyticCustomReportController=require(_0x4ade('0x9'));var analyticDefaultReportController=require('../../api/analyticDefaultReport/analyticDefaultReport.controller');var client=jayson[_0x4ade('0xa')][_0x4ade('0xb')]({'port':0x232b});var manager=new CronJobManager();function getReportData(_0x2769ff){const _0x479fef={};if(typeof _0x2769ff==='number'){_0x479fef['id']=_0x2769ff;}return db['AnalyticExtractedReport'][_0x4ade('0xc')]({'where':_0x479fef})['then'](function(_0x4ae067){return _0x4ae067;})['catch'](function(_0x42d6f2){logger['error'](_0x42d6f2);});}function handleSendEmail(_0x2a0219,_0x50e5b8){logger[_0x4ade('0xd')](_0x4ade('0xe'),_0x2a0219[_0x4ade('0xf')]);var _0x21a630=!![];var _0x3fa589=_0x2a0219['MailAccount']['getSmtpOptions']();var _0x3c6af9={'account':_0x3fa589,'message':{'from':util[_0x4ade('0x10')](_0x4ade('0x11'),_0x2a0219[_0x4ade('0x12')][_0x4ade('0x13')],_0x2a0219[_0x4ade('0x12')][_0x4ade('0xf')]||_0x2a0219[_0x4ade('0x12')][_0x4ade('0x14')][_0x4ade('0x15')]),'to':_0x2a0219[_0x4ade('0xf')],'cc':_0x2a0219['cc'],'bcc':_0x2a0219[_0x4ade('0x16')],'subject':util[_0x4ade('0x10')](_0x4ade('0x17'),_0x50e5b8[_0x4ade('0x13')],_0x2a0219[_0x4ade('0x18')],_0x2a0219['subtractUnit'])}};var _0x2fb2c1=path[_0x4ade('0x19')](__dirname,_0x4ade('0x1a'));var _0x4ba23d=_0x50e5b8[_0x4ade('0x1b')];var _0x52e5cd=util[_0x4ade('0x10')](_0x4ade('0x1c'),path['basename'](_0x50e5b8['savename'],path[_0x4ade('0x1d')](_0x50e5b8['savename'])),_0x4ade('0x1e'));var _0x58cf2f=path[_0x4ade('0x19')](_0x2fb2c1,_0x4ba23d);var _0x2593fc=path['join'](_0x2fb2c1,_0x52e5cd);if(fs[_0x4ade('0x1f')](_0x58cf2f)){_0x50e5b8[_0x4ade('0x20')]=_0x4ade('0x21');_0x3c6af9[_0x4ade('0x22')]['attachments']=[{'filename':_0x4ba23d,'path':_0x58cf2f}];_0x3c6af9[_0x4ade('0x22')]['text']=util[_0x4ade('0x10')](_0x4ade('0x23'),JSON['stringify'](_0x50e5b8,null,0x2));}else if(fs[_0x4ade('0x1f')](_0x2593fc)){_0x50e5b8[_0x4ade('0x20')]=_0x4ade('0x21');_0x3c6af9[_0x4ade('0x22')][_0x4ade('0x24')]=[{'filename':_0x52e5cd,'path':_0x2593fc}];}else{if(_0x50e5b8[_0x4ade('0x20')]===_0x4ade('0x25')){_0x3c6af9[_0x4ade('0x22')][_0x4ade('0x26')]=_0x4ade('0x27');if(!_0x2a0219[_0x4ade('0x28')]){_0x21a630=![];logger['info'](_0x4ade('0x29'));}}else if(_0x50e5b8[_0x4ade('0x20')]===_0x4ade('0x2a')){_0x3c6af9[_0x4ade('0x22')][_0x4ade('0x26')]=_0x4ade('0x2b');}else if(_0x50e5b8['status']===_0x4ade('0x2c')){_0x3c6af9[_0x4ade('0x22')][_0x4ade('0x26')]=_0x4ade('0x2d');}else if(_0x50e5b8[_0x4ade('0x20')]===_0x4ade('0x2e')){_0x3c6af9[_0x4ade('0x22')][_0x4ade('0x26')]='Report\x20extraction\x20procedure\x20has\x20run\x20into\x20an\x20unexpected\x20error.\x0aThis\x20is\x20an\x20automatically\x20generated\x20email\x20–\x20please\x20do\x20not\x20reply\x20to\x20this\x20email.\x0a\x0a';}else{logger[_0x4ade('0x2f')](_0x4ade('0x30'),_0x50e5b8[_0x4ade('0x20')]);}}if(_0x21a630){return client[_0x4ade('0x31')]('SendMail',_0x3c6af9)[_0x4ade('0x32')](function(_0x4e94cd){if(_0x4e94cd['error']){return logger['error']('error\x20mail',JSON[_0x4ade('0x33')](_0x4e94cd));}return logger['info'](_0x4ade('0x34'));})[_0x4ade('0x35')](function(_0x5638d1){return logger[_0x4ade('0x2f')](_0x4ade('0x36'),JSON[_0x4ade('0x33')](_0x5638d1));});}}function handleError(){return function(_0x21bcc2){return logger['error'](JSON['stringify'](_0x21bcc2));};}function loading(_0x2d2301){logger[_0x4ade('0xd')](_0x4ade('0x37'));if(_0x2d2301['currentAttempt']===_0x2d2301[_0x4ade('0x38')][_0x4ade('0x39')]){handleSendEmail(_0x2d2301[_0x4ade('0x3a')],_0x2d2301[_0x4ade('0x3b')]);_0x2d2301['operation'][_0x4ade('0x3c')]();}else{_0x2d2301[_0x4ade('0x3d')][_0x4ade('0x8')](_0x4ade('0x3e'));}}function completed(_0x5ed088){logger[_0x4ade('0xd')](_0x4ade('0x3f'));handleSendEmail(_0x5ed088[_0x4ade('0x3a')],_0x5ed088[_0x4ade('0x3b')]);_0x5ed088[_0x4ade('0x3d')][_0x4ade('0x3c')]();}function empty(_0x4fd7d4){logger['info'](_0x4ade('0x40'));handleSendEmail(_0x4fd7d4[_0x4ade('0x3a')],_0x4fd7d4['data']);_0x4fd7d4[_0x4ade('0x3d')]['stop']();}function failed(_0x36bf7c){logger[_0x4ade('0xd')](_0x4ade('0x41'));handleSendEmail(_0x36bf7c[_0x4ade('0x3a')],_0x36bf7c[_0x4ade('0x3b')]);_0x36bf7c[_0x4ade('0x3d')][_0x4ade('0x3c')]();}function urecognized(_0x1eac0a){logger['error']('Unrecognized\x20status:',_0x1eac0a[_0x4ade('0x42')][_0x4ade('0x43')]['status']);_0x1eac0a['operation'][_0x4ade('0x3c')]();}const reportStatusStrategies={'Loading':loading,'Completed':completed,'Empty':empty,'Failed':failed,'Unrecognized':urecognized};function retryer(_0x1c2bc5,_0x86b113){const _0x49c572={'retries':0x3,'factor':0x2,'minTimeout':0x5b*0x3e8,'maxTimeout':0xa*0x3c*0x3e8};const _0x73e0db=retry[_0x4ade('0x3d')](_0x49c572);_0x73e0db[_0x4ade('0x44')](_0x419816=>{logger[_0x4ade('0xd')](_0x4ade('0x45')+_0x1c2bc5['id']+_0x4ade('0x46')+_0x419816);try{getReportData(_0x86b113['id'])[_0x4ade('0x32')](function(_0x558c38){_0x86b113=_0x558c38;logger[_0x4ade('0xd')]('report\x20status:',_0x558c38[_0x4ade('0x43')][_0x4ade('0x20')]);if(!reportStatusStrategies[_0x558c38[_0x4ade('0x43')][_0x4ade('0x20')]]){logger[_0x4ade('0x2f')](_0x4ade('0x47'),_0x558c38[_0x4ade('0x43')][_0x4ade('0x20')]);_0x73e0db[_0x4ade('0x8')]();}reportStatusStrategies[_0x558c38['dataValues'][_0x4ade('0x20')]]({'operation':_0x73e0db,'currentAttempt':_0x419816,'retryOptions':_0x49c572,'job':_0x1c2bc5,'data':_0x86b113,'entity':_0x558c38});});}catch(_0x99b7ed){_0x73e0db[_0x4ade('0x8')](_0x99b7ed);}});}function handleResult(_0x4bf705){return function(_0xec2ca1){if(_0x4bf705[_0x4ade('0x48')]&&_0x4bf705[_0x4ade('0x12')]&&_0x4bf705[_0x4ade('0x12')][_0x4ade('0x14')]&&!_['isNil'](_0x4bf705[_0x4ade('0xf')])){retryer(_0x4bf705,_0xec2ca1);}};}function handleJob(_0x269007){return function(){try{if(_[_0x4ade('0x49')](_0x269007[_0x4ade('0x18')])){return logger[_0x4ade('0xd')](_0x4ade('0x4a'));}if(_[_0x4ade('0x49')](_0x269007[_0x4ade('0x4b')])){return logger[_0x4ade('0xd')](_0x4ade('0x4c'));}var _0x1a4fb6={'startDate':moment()[_0x4ade('0x4d')](_0x269007[_0x4ade('0x18')],_0x269007['subtractUnit'])[_0x4ade('0x10')]('YYYY-MM-DD\x20HH:mm:ss'),'endDate':moment()[_0x4ade('0x10')](_0x4ade('0x4e')),'type':'scheduled','output':_0x269007[_0x4ade('0x4f')],'name':_0x269007[_0x4ade('0x13')]};if(!_['isNil'](_0x269007['DefaultReportId'])){logger[_0x4ade('0xd')]('exec\x20defaul\x20report\x20id:%s',_0x269007[_0x4ade('0x50')]);return analyticDefaultReportController[_0x4ade('0x51')]({'id':_0x269007['DefaultReportId']},_0x1a4fb6)['then'](handleResult(_0x269007))[_0x4ade('0x35')](handleError());}if(!_[_0x4ade('0x49')](_0x269007[_0x4ade('0x52')])){logger['info'](_0x4ade('0x53'),_0x269007['CustomReportId']);return analyticCustomReportController[_0x4ade('0x51')]({'id':_0x269007[_0x4ade('0x52')]},_0x1a4fb6)[_0x4ade('0x32')](handleResult(_0x269007))[_0x4ade('0x35')](handleError());}}catch(_0x22500b){logger[_0x4ade('0x2f')](JSON[_0x4ade('0x33')](_0x22500b));}return logger[_0x4ade('0xd')]('no\x20report\x20id');};}function getJobs(_0xffbef){var _0x54bdf6={};if(_0xffbef){_0x54bdf6['id']=_0xffbef;}return db[_0x4ade('0x54')][_0x4ade('0x55')]({'where':_0x54bdf6,'include':[{'model':db[_0x4ade('0x12')],'attributes':['id',_0x4ade('0x13'),_0x4ade('0xf')],'include':[{'model':db[_0x4ade('0x56')],'as':_0x4ade('0x14'),'include':[{'model':db['CloudProvider'],'as':_0x4ade('0x57')}]}]}]})[_0x4ade('0x32')](function(_0x27ed75){var _0x43d9ef=_[_0x4ade('0x58')](manager[_0x4ade('0x59')]);var _0x27884d=_['map'](_0x27ed75,function(_0x558d12){return _0x558d12['id']['toString']();});var _0x74503e=_['keyBy'](_0x27ed75,function(_0x46faf0){return _0x46faf0['id'][_0x4ade('0x5a')]();});var _0x8f7bd=_0xffbef?_0x27884d:_[_0x4ade('0x5b')](_0x27884d,_0x43d9ef);var _0x39f8de=_[_0x4ade('0x5c')](_0x27884d,_0x43d9ef);var _0x12488f=_[_0x4ade('0x5b')](_0x43d9ef,_0x27884d);var _0x38f280;var _0x3a9291;for(_0x38f280=0x0;_0x38f280<_0x12488f[_0x4ade('0x5d')]&&!_0xffbef;_0x38f280+=0x1){_0x3a9291=_0x12488f[_0x38f280][_0x4ade('0x5a')]();if(manager[_0x4ade('0x5e')](_0x3a9291)){manager[_0x4ade('0x3c')](_0x3a9291);manager['deleteJob'](_0x3a9291);logger['info'](_0x4ade('0x5f'),_0x3a9291);}}logger['info']('toRun',JSON[_0x4ade('0x33')](_0x8f7bd));for(_0x38f280=0x0;_0x38f280<_0x8f7bd['length'];_0x38f280+=0x1){_0x3a9291=_0x8f7bd[_0x38f280][_0x4ade('0x5a')]();if(_0xffbef){logger[_0x4ade('0xd')](JSON[_0x4ade('0x33')](_0x74503e[_0x3a9291]));BPromise[_0x4ade('0x60')]()[_0x4ade('0x32')](handleJob(_0x74503e[_0x3a9291]));logger[_0x4ade('0xd')]('run\x20job',_0x74503e[_0x3a9291][_0x4ade('0x13')],_0x74503e[_0x3a9291][_0x4ade('0x61')]);}else if(_0x74503e[_0x3a9291][_0x4ade('0x61')]&&_0x74503e[_0x3a9291][_0x4ade('0x62')]&&moment()['isBetween'](_0x74503e[_0x3a9291]['startAt'],_0x74503e[_0x3a9291][_0x4ade('0x63')])){manager[_0x4ade('0x64')](_0x3a9291,_0x74503e[_0x3a9291][_0x4ade('0x61')],handleJob(_0x74503e[_0x3a9291]));manager['start'](_0x3a9291);logger[_0x4ade('0xd')](_0x4ade('0x65'),_0x74503e[_0x3a9291]['name'],_0x74503e[_0x3a9291][_0x4ade('0x61')]);}else if(manager[_0x4ade('0x5e')](_0x3a9291)){manager[_0x4ade('0x3c')](_0x3a9291);manager[_0x4ade('0x66')](_0x3a9291);logger[_0x4ade('0xd')](_0x4ade('0x67'),_0x74503e[_0x3a9291][_0x4ade('0x13')],_0x74503e[_0x3a9291][_0x4ade('0x61')]);}}for(_0x38f280=0x0,_0x3a9291;_0x38f280<_0x39f8de[_0x4ade('0x5d')]&&!_0xffbef;_0x38f280+=0x1){_0x3a9291=_0x39f8de[_0x38f280][_0x4ade('0x5a')]();if(manager['exists'](_0x3a9291)){if(_0x74503e[_0x3a9291][_0x4ade('0x61')]&&_0x74503e[_0x3a9291][_0x4ade('0x62')]&&moment()['isBetween'](_0x74503e[_0x3a9291][_0x4ade('0x68')],_0x74503e[_0x3a9291][_0x4ade('0x63')])){manager[_0x4ade('0x69')](_0x3a9291,_0x74503e[_0x3a9291]['cron'],handleJob(_0x74503e[_0x3a9291]));logger[_0x4ade('0xd')](_0x4ade('0x6a'),_0x74503e[_0x3a9291]['name'],_0x74503e[_0x3a9291][_0x4ade('0x61')]);}else{manager[_0x4ade('0x3c')](_0x3a9291);manager['deleteJob'](_0x3a9291);logger['info']('stop\x20cron',_0x74503e[_0x3a9291][_0x4ade('0x13')],_0x74503e[_0x3a9291][_0x4ade('0x61')]);}}}})[_0x4ade('0x35')](function(_0x2a3b81){logger[_0x4ade('0x2f')](JSON[_0x4ade('0x33')](_0x2a3b81));});}exports['run']=function(_0x37a6d0){return getJobs(_0x37a6d0);};exports[_0x4ade('0x6b')]=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 0f48ad8..807c177 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 _0x0ca5=['SentimentScore','Positive','Negative','Mixed','Neutral','FailureReason','[RECORDING:%d]\x20Transcript\x20Job\x20status\x20not\x20managed','resolve','Transcript\x20not\x20available','Cloud\x20Provider\x20not\x20available','[RECORDING:%d]\x20Requesting\x20sentiment\x20analysis','Sentiment','catch','name','SequelizeValidationError','error','[RECORDING:%d]\x20Error\x20running\x20Transcribe\x20&\x20Sentiment\x20Analysis','inspect','VoiceRecording','findAll','IN_PROGRESS','Setting','Settings\x20not\x20available','transcribeAccountId','forEach','all','start','lodash','aws-sdk','request-promise','util','bluebird','../../mysqldb','../../config/logger','transcribe','TranscribeService','detectSentiment','substring','info','format','[RECORDING:%d]\x20Get\x20status\x20for\x20transcript\x20job\x20(%s)','transcribeName','data1','transcribeRegion','then','[RECORDING:%d]\x20Status\x20of\x20transcript\x20job\x20(%s):\x20%s','TranscriptionJob','TranscriptionJobStatus','fileText','COMPLETED','Transcript','TranscriptFileUri','[RECORDING:%d]\x20Get\x20transcript','[RECORDING:%d]\x20Transcript\x20downloaded','results','transcripts','length','transcript','[RECORDING:%d]\x20Voice\x20Recording\x20entry\x20updated','tempSentiment','ValidationError','Sentiment\x20Analysis\x20not\x20requested','sentiment','sentimentAccountId','sentimentRegion','language','bucket','Sequelize','Sentiment\x20Analysis\x20not\x20configured','CloudProvider','findOne','data2','Cloud\x20Provider\x20not\x20configured','[RECORDING:%d]\x20Sentiment\x20Analysis\x20available','update'];(function(_0x462047,_0x530920){var _0x22bc1e=function(_0x4fcb41){while(--_0x4fcb41){_0x462047['push'](_0x462047['shift']());}};_0x22bc1e(++_0x530920);}(_0x0ca5,0xfc));var _0x50ca=function(_0x19918b,_0x5eb95f){_0x19918b=_0x19918b-0x0;var _0x1b4dab=_0x0ca5[_0x19918b];return _0x1b4dab;};var _=require(_0x50ca('0x0'));var AWS=require(_0x50ca('0x1'));var rp=require(_0x50ca('0x2'));var util=require(_0x50ca('0x3'));var BPromise=require(_0x50ca('0x4'));var db=require(_0x50ca('0x5'))['db'];var logger=require(_0x50ca('0x6'))(_0x50ca('0x7'));function getTranscriptionJob(_0x4e3978,_0x38120b,_0xfb584e,_0x230ee2){return new Promise(function(_0x404ab9,_0x4815d3){var _0x4e7d2c=new AWS[(_0x50ca('0x8'))]({'accessKeyId':_0x38120b,'secretAccessKey':_0x4e3978,'region':_0xfb584e});_0x4e7d2c['getTranscriptionJob']({'TranscriptionJobName':_0x230ee2},function(_0x14709d,_0x56e57a){if(_0x14709d){return _0x4815d3(_0x14709d);}else{return _0x404ab9(_0x56e57a);}});});}function sentiment(_0x29392c,_0x53f86d,_0x3ab7a0,_0x18f61c,_0x284515){return new Promise(function(_0x4045dd,_0x17b5c9){var _0x48b54a=new AWS['Comprehend']({'accessKeyId':_0x53f86d,'secretAccessKey':_0x29392c,'region':_0x3ab7a0});_0x48b54a[_0x50ca('0x9')]({'Text':_0x18f61c,'LanguageCode':_0x284515[_0x50ca('0xa')](0x0,0x2)},function(_0x1f94a1,_0x144525){if(_0x1f94a1){return _0x17b5c9(_0x1f94a1);}else{return _0x4045dd(_0x144525);}});});}function checkTranscribeJob(_0x97e3ed,_0x26797d,_0x297cb5){var _0x323ab7;return new BPromise(function(_0x183827,_0x27bf3a){logger[_0x50ca('0xb')](util[_0x50ca('0xc')](_0x50ca('0xd'),_0x97e3ed['id'],_0x97e3ed[_0x50ca('0xe')]));return getTranscriptionJob(_0x297cb5[_0x50ca('0xf')],_0x297cb5['data2'],_0x26797d[_0x50ca('0x10')],_0x97e3ed[_0x50ca('0xe')])[_0x50ca('0x11')](function(_0x3035e5){logger[_0x50ca('0xb')](util['format'](_0x50ca('0x12'),_0x97e3ed['id'],_0x97e3ed['transcribeName'],_0x3035e5[_0x50ca('0x13')][_0x50ca('0x14')]));if(!_0x97e3ed[_0x50ca('0x15')]){switch(_0x3035e5[_0x50ca('0x13')]['TranscriptionJobStatus']){case _0x50ca('0x16'):var _0x9f19a9={'transcribeStatus':_0x3035e5[_0x50ca('0x13')]['TranscriptionJobStatus'],'fileUri':_0x3035e5['TranscriptionJob'][_0x50ca('0x17')][_0x50ca('0x18')]};logger[_0x50ca('0xb')](util[_0x50ca('0xc')](_0x50ca('0x19'),_0x97e3ed['id']));return rp({'uri':_0x3035e5[_0x50ca('0x13')]['Transcript']['TranscriptFileUri'],'json':!![]})[_0x50ca('0x11')](function(_0x2e522f){logger[_0x50ca('0xb')](util[_0x50ca('0xc')](_0x50ca('0x1a'),_0x97e3ed['id']));if(_0x2e522f&&_0x2e522f[_0x50ca('0x1b')]&&_0x2e522f[_0x50ca('0x1b')][_0x50ca('0x1c')]&&_0x2e522f['results']['transcripts'][_0x50ca('0x1d')]){_0x9f19a9['fileText']='';for(var _0x2c828a=0x0;_0x2c828a<_0x2e522f[_0x50ca('0x1b')]['transcripts'][_0x50ca('0x1d')];_0x2c828a++){_0x9f19a9[_0x50ca('0x15')]+=_0x2e522f[_0x50ca('0x1b')]['transcripts'][_0x2c828a][_0x50ca('0x1e')]+'';}}return _0x97e3ed['update'](_0x9f19a9);})[_0x50ca('0x11')](function(){logger[_0x50ca('0xb')](util[_0x50ca('0xc')](_0x50ca('0x1f'),_0x97e3ed['id']));if(!_0x97e3ed[_0x50ca('0x20')]){throw new db['Sequelize'][(_0x50ca('0x21'))](_0x50ca('0x22'));}if(!_0x26797d[_0x50ca('0x23')]||!_0x26797d[_0x50ca('0x24')]||!_0x26797d[_0x50ca('0x25')]||!_0x26797d[_0x50ca('0x26')]||!_0x26797d[_0x50ca('0x27')]){throw new db[(_0x50ca('0x28'))][(_0x50ca('0x21'))](_0x50ca('0x29'));}if(!_0x9f19a9[_0x50ca('0x15')]){throw new Error('Transcript\x20not\x20available');}if(_0x26797d[_0x50ca('0x24')]===_0x297cb5['id']){return _0x297cb5;}else{return db[_0x50ca('0x2a')][_0x50ca('0x2b')]({'where':{'id':_settings[_0x50ca('0x24')]}});}})[_0x50ca('0x11')](function(_0x254259){if(!_0x254259){throw new db[(_0x50ca('0x28'))][(_0x50ca('0x21'))]('Cloud\x20Provider\x20not\x20available');}if(!_0x254259[_0x50ca('0xf')]||!_0x254259[_0x50ca('0x2c')]){throw new db[(_0x50ca('0x28'))][(_0x50ca('0x21'))](_0x50ca('0x2d'));}_0x323ab7=_0x254259;logger['info'](util[_0x50ca('0xc')]('[RECORDING:%d]\x20Requesting\x20sentiment\x20analysis',_0x97e3ed['id']));return sentiment(_0x323ab7[_0x50ca('0xf')],_0x323ab7[_0x50ca('0x2c')],_0x26797d[_0x50ca('0x25')],_0x9f19a9[_0x50ca('0x15')],_0x26797d[_0x50ca('0x26')]);})['then'](function(_0x11fa98){logger[_0x50ca('0xb')](util[_0x50ca('0xc')](_0x50ca('0x2e'),_0x97e3ed['id']));return _0x97e3ed[_0x50ca('0x2f')]({'sentiment':_0x11fa98['Sentiment'],'sPositive':_0x11fa98[_0x50ca('0x30')][_0x50ca('0x31')],'sNegative':_0x11fa98['SentimentScore'][_0x50ca('0x32')],'sMixed':_0x11fa98[_0x50ca('0x30')][_0x50ca('0x33')],'sNeutral':_0x11fa98[_0x50ca('0x30')][_0x50ca('0x34')]});})['then'](function(){logger[_0x50ca('0xb')](util[_0x50ca('0xc')](_0x50ca('0x1f'),_0x97e3ed['id']));_0x183827();});case'FAILED':return _0x97e3ed['update']({'transcribeStatus':'FAILED','failureReason':_0x3035e5['TranscriptionJob'][_0x50ca('0x35')]})['then'](function(){logger[_0x50ca('0xb')](util[_0x50ca('0xc')](_0x50ca('0x1f'),_0x97e3ed['id']));_0x183827();});default:logger[_0x50ca('0xb')](util[_0x50ca('0xc')](_0x50ca('0x36'),_0x97e3ed['id']));break;}}else{return BPromise[_0x50ca('0x37')]()[_0x50ca('0x11')](function(){if(!_0x97e3ed[_0x50ca('0x20')]){throw new db[(_0x50ca('0x28'))]['ValidationError'](_0x50ca('0x22'));}if(!_0x26797d[_0x50ca('0x23')]||!_0x26797d['sentimentAccountId']||!_0x26797d[_0x50ca('0x25')]||!_0x26797d[_0x50ca('0x26')]||!_0x26797d[_0x50ca('0x27')]){throw new db[(_0x50ca('0x28'))][(_0x50ca('0x21'))](_0x50ca('0x29'));}if(!_0x97e3ed[_0x50ca('0x15')]){throw new Error(_0x50ca('0x38'));}if(_0x26797d[_0x50ca('0x24')]===_0x297cb5['id']){return _0x297cb5;}else{return db['CloudProvider']['findOne']({'where':{'id':_settings[_0x50ca('0x24')]}});}})[_0x50ca('0x11')](function(_0x1230cf){if(!_0x1230cf){throw new db[(_0x50ca('0x28'))][(_0x50ca('0x21'))](_0x50ca('0x39'));}if(!_0x1230cf['data1']||!_0x1230cf['data2']){throw new db['Sequelize'][(_0x50ca('0x21'))]('Cloud\x20Provider\x20not\x20configured');}_0x323ab7=_0x1230cf;logger[_0x50ca('0xb')](util[_0x50ca('0xc')](_0x50ca('0x3a'),_0x97e3ed['id']));return sentiment(_0x323ab7[_0x50ca('0xf')],_0x323ab7[_0x50ca('0x2c')],_0x26797d[_0x50ca('0x25')],_0x97e3ed[_0x50ca('0x15')],_0x26797d[_0x50ca('0x26')]);})[_0x50ca('0x11')](function(_0x51854e){logger[_0x50ca('0xb')](util[_0x50ca('0xc')](_0x50ca('0x2e'),_0x97e3ed['id']));return _0x97e3ed[_0x50ca('0x2f')]({'sentiment':_0x51854e[_0x50ca('0x3b')],'sPositive':_0x51854e['SentimentScore'][_0x50ca('0x31')],'sNegative':_0x51854e[_0x50ca('0x30')][_0x50ca('0x32')],'sMixed':_0x51854e[_0x50ca('0x30')][_0x50ca('0x33')],'sNeutral':_0x51854e['SentimentScore'][_0x50ca('0x34')],'transcribeStatus':_0x50ca('0x16')});})[_0x50ca('0x11')](function(){logger[_0x50ca('0xb')](util['format'](_0x50ca('0x1f'),_0x97e3ed['id']));_0x183827();});}})[_0x50ca('0x3c')](function(_0x47fef5){if(_0x47fef5){if(!_0x47fef5[_0x50ca('0x3d')]||_0x47fef5[_0x50ca('0x3d')]!==_0x50ca('0x3e')){logger[_0x50ca('0x3f')](util[_0x50ca('0xc')](_0x50ca('0x40'),_0x97e3ed['id']),util[_0x50ca('0x41')](_0x47fef5,{'showHidden':![],'depth':null}));}}_0x183827();});});}function checkTranscribe(){var _0x33c2a7;var _0x3f3e82;var _0x2c6f55;return db[_0x50ca('0x42')][_0x50ca('0x43')]({'where':{'transcribeStatus':_0x50ca('0x44')}})[_0x50ca('0x11')](function(_0x3e861d){if(!_0x3e861d||!_0x3e861d[_0x50ca('0x1d')]){throw new db[(_0x50ca('0x28'))][(_0x50ca('0x21'))]('No\x20transcribe\x20job\x20to\x20check');}_0x33c2a7=_0x3e861d;return db[_0x50ca('0x45')][_0x50ca('0x2b')]({'where':{'id':0x1}});})['then'](function(_0x1bac1b){if(!_0x1bac1b){throw new db[(_0x50ca('0x28'))][(_0x50ca('0x21'))](_0x50ca('0x46'));}_0x3f3e82=_0x1bac1b;if(!_0x3f3e82[_0x50ca('0x7')]||!_0x3f3e82[_0x50ca('0x47')]||!_0x3f3e82[_0x50ca('0x10')]||!_0x3f3e82[_0x50ca('0x26')]||!_0x3f3e82['bucket']){throw new db[(_0x50ca('0x28'))][(_0x50ca('0x21'))]('Transcribe\x20not\x20configured');}return db[_0x50ca('0x2a')][_0x50ca('0x2b')]({'where':{'id':_0x3f3e82['transcribeAccountId']}});})[_0x50ca('0x11')](function(_0x56903a){if(!_0x56903a){throw new db[(_0x50ca('0x28'))][(_0x50ca('0x21'))]('Cloud\x20Provider\x20not\x20available');}if(!_0x56903a['data1']||!_0x56903a[_0x50ca('0x2c')]){throw new db[(_0x50ca('0x28'))]['ValidationError'](_0x50ca('0x2d'));}_0x2c6f55=_0x56903a;var _0x33625f=[];_0x33c2a7[_0x50ca('0x48')](function(_0x11811f){_0x33625f['push'](checkTranscribeJob(_0x11811f,_0x3f3e82,_0x2c6f55));});return BPromise[_0x50ca('0x49')](_0x33625f);})[_0x50ca('0x3c')](function(_0x10080c){if(_0x10080c){if(!_0x10080c[_0x50ca('0x3d')]||_0x10080c[_0x50ca('0x3d')]!==_0x50ca('0x3e')){logger[_0x50ca('0x3f')](util[_0x50ca('0x41')](_0x10080c,{'showHidden':![],'depth':null}));}}});}exports[_0x50ca('0x4a')]=function(){setInterval(function(){return checkTranscribe();},0x3c*0x3e8);return checkTranscribe();}; \ No newline at end of file +var _0x1707=['sentimentRegion','bucket','Sentiment\x20Analysis\x20not\x20configured','Transcript\x20not\x20available','findOne','Cloud\x20Provider\x20not\x20available','data1','[RECORDING:%d]\x20Requesting\x20sentiment\x20analysis','data2','[RECORDING:%d]\x20Sentiment\x20Analysis\x20available','update','Sentiment','SentimentScore','Positive','Negative','Mixed','[RECORDING:%d]\x20Voice\x20Recording\x20entry\x20updated','FAILED','FailureReason','[RECORDING:%d]\x20Transcript\x20Job\x20status\x20not\x20managed','resolve','Sentiment\x20Analysis\x20not\x20requested','language','CloudProvider','Neutral','catch','name','SequelizeValidationError','[RECORDING:%d]\x20Error\x20running\x20Transcribe\x20&\x20Sentiment\x20Analysis','inspect','VoiceRecording','IN_PROGRESS','No\x20transcribe\x20job\x20to\x20check','Settings\x20not\x20available','transcribeAccountId','Cloud\x20Provider\x20not\x20configured','forEach','push','all','error','start','lodash','bluebird','../../mysqldb','transcribe','TranscribeService','getTranscriptionJob','Comprehend','detectSentiment','substring','info','format','[RECORDING:%d]\x20Get\x20status\x20for\x20transcript\x20job\x20(%s)','transcribeName','transcribeRegion','then','TranscriptionJob','fileText','TranscriptionJobStatus','COMPLETED','Transcript','TranscriptFileUri','[RECORDING:%d]\x20Get\x20transcript','[RECORDING:%d]\x20Transcript\x20downloaded','results','transcripts','length','transcript','tempSentiment','Sequelize','ValidationError','sentiment','sentimentAccountId'];(function(_0x28d1fb,_0x1306fa){var _0x306eac=function(_0x2d0cb3){while(--_0x2d0cb3){_0x28d1fb['push'](_0x28d1fb['shift']());}};_0x306eac(++_0x1306fa);}(_0x1707,0x1df));var _0x7170=function(_0x1f5637,_0x74e0d5){_0x1f5637=_0x1f5637-0x0;var _0x51afed=_0x1707[_0x1f5637];return _0x51afed;};var _=require(_0x7170('0x0'));var AWS=require('aws-sdk');var rp=require('request-promise');var util=require('util');var BPromise=require(_0x7170('0x1'));var db=require(_0x7170('0x2'))['db'];var logger=require('../../config/logger')(_0x7170('0x3'));function getTranscriptionJob(_0x351ce0,_0xe5a03c,_0x3829bb,_0xcc6e16){return new Promise(function(_0x19d043,_0x215acb){var _0x1cfade=new AWS[(_0x7170('0x4'))]({'accessKeyId':_0xe5a03c,'secretAccessKey':_0x351ce0,'region':_0x3829bb});_0x1cfade[_0x7170('0x5')]({'TranscriptionJobName':_0xcc6e16},function(_0x1d6a14,_0x3b56ae){if(_0x1d6a14){return _0x215acb(_0x1d6a14);}else{return _0x19d043(_0x3b56ae);}});});}function sentiment(_0x33de53,_0x35771a,_0x1f6319,_0x1bf6d9,_0x929dae){return new Promise(function(_0x51da88,_0x247d85){var _0x50fb4f=new AWS[(_0x7170('0x6'))]({'accessKeyId':_0x35771a,'secretAccessKey':_0x33de53,'region':_0x1f6319});_0x50fb4f[_0x7170('0x7')]({'Text':_0x1bf6d9,'LanguageCode':_0x929dae[_0x7170('0x8')](0x0,0x2)},function(_0x4862ab,_0x59a69f){if(_0x4862ab){return _0x247d85(_0x4862ab);}else{return _0x51da88(_0x59a69f);}});});}function checkTranscribeJob(_0x4fc693,_0x3fd8c1,_0x3193c7){var _0x58c1ec;return new BPromise(function(_0x42911e,_0x352b43){logger[_0x7170('0x9')](util[_0x7170('0xa')](_0x7170('0xb'),_0x4fc693['id'],_0x4fc693[_0x7170('0xc')]));return getTranscriptionJob(_0x3193c7['data1'],_0x3193c7['data2'],_0x3fd8c1[_0x7170('0xd')],_0x4fc693[_0x7170('0xc')])[_0x7170('0xe')](function(_0xabf79a){logger['info'](util[_0x7170('0xa')]('[RECORDING:%d]\x20Status\x20of\x20transcript\x20job\x20(%s):\x20%s',_0x4fc693['id'],_0x4fc693[_0x7170('0xc')],_0xabf79a[_0x7170('0xf')]['TranscriptionJobStatus']));if(!_0x4fc693[_0x7170('0x10')]){switch(_0xabf79a['TranscriptionJob'][_0x7170('0x11')]){case _0x7170('0x12'):var _0x5cf09a={'transcribeStatus':_0xabf79a[_0x7170('0xf')]['TranscriptionJobStatus'],'fileUri':_0xabf79a['TranscriptionJob'][_0x7170('0x13')][_0x7170('0x14')]};logger[_0x7170('0x9')](util[_0x7170('0xa')](_0x7170('0x15'),_0x4fc693['id']));return rp({'uri':_0xabf79a[_0x7170('0xf')][_0x7170('0x13')]['TranscriptFileUri'],'json':!![]})[_0x7170('0xe')](function(_0x26551f){logger[_0x7170('0x9')](util[_0x7170('0xa')](_0x7170('0x16'),_0x4fc693['id']));if(_0x26551f&&_0x26551f[_0x7170('0x17')]&&_0x26551f[_0x7170('0x17')][_0x7170('0x18')]&&_0x26551f['results'][_0x7170('0x18')][_0x7170('0x19')]){_0x5cf09a[_0x7170('0x10')]='';for(var _0x5555b7=0x0;_0x5555b7<_0x26551f[_0x7170('0x17')][_0x7170('0x18')][_0x7170('0x19')];_0x5555b7++){_0x5cf09a[_0x7170('0x10')]+=_0x26551f[_0x7170('0x17')]['transcripts'][_0x5555b7][_0x7170('0x1a')]+'';}}return _0x4fc693['update'](_0x5cf09a);})[_0x7170('0xe')](function(){logger[_0x7170('0x9')](util['format']('[RECORDING:%d]\x20Voice\x20Recording\x20entry\x20updated',_0x4fc693['id']));if(!_0x4fc693[_0x7170('0x1b')]){throw new db[(_0x7170('0x1c'))][(_0x7170('0x1d'))]('Sentiment\x20Analysis\x20not\x20requested');}if(!_0x3fd8c1[_0x7170('0x1e')]||!_0x3fd8c1[_0x7170('0x1f')]||!_0x3fd8c1[_0x7170('0x20')]||!_0x3fd8c1['language']||!_0x3fd8c1[_0x7170('0x21')]){throw new db['Sequelize']['ValidationError'](_0x7170('0x22'));}if(!_0x5cf09a[_0x7170('0x10')]){throw new Error(_0x7170('0x23'));}if(_0x3fd8c1[_0x7170('0x1f')]===_0x3193c7['id']){return _0x3193c7;}else{return db['CloudProvider'][_0x7170('0x24')]({'where':{'id':_settings['sentimentAccountId']}});}})[_0x7170('0xe')](function(_0x29ec07){if(!_0x29ec07){throw new db['Sequelize'][(_0x7170('0x1d'))](_0x7170('0x25'));}if(!_0x29ec07[_0x7170('0x26')]||!_0x29ec07['data2']){throw new db['Sequelize'][(_0x7170('0x1d'))]('Cloud\x20Provider\x20not\x20configured');}_0x58c1ec=_0x29ec07;logger['info'](util[_0x7170('0xa')](_0x7170('0x27'),_0x4fc693['id']));return sentiment(_0x58c1ec['data1'],_0x58c1ec[_0x7170('0x28')],_0x3fd8c1['sentimentRegion'],_0x5cf09a[_0x7170('0x10')],_0x3fd8c1['language']);})[_0x7170('0xe')](function(_0x5ef7a7){logger[_0x7170('0x9')](util['format'](_0x7170('0x29'),_0x4fc693['id']));return _0x4fc693[_0x7170('0x2a')]({'sentiment':_0x5ef7a7[_0x7170('0x2b')],'sPositive':_0x5ef7a7[_0x7170('0x2c')][_0x7170('0x2d')],'sNegative':_0x5ef7a7[_0x7170('0x2c')][_0x7170('0x2e')],'sMixed':_0x5ef7a7['SentimentScore'][_0x7170('0x2f')],'sNeutral':_0x5ef7a7[_0x7170('0x2c')]['Neutral']});})[_0x7170('0xe')](function(){logger[_0x7170('0x9')](util['format'](_0x7170('0x30'),_0x4fc693['id']));_0x42911e();});case _0x7170('0x31'):return _0x4fc693[_0x7170('0x2a')]({'transcribeStatus':_0x7170('0x31'),'failureReason':_0xabf79a[_0x7170('0xf')][_0x7170('0x32')]})[_0x7170('0xe')](function(){logger['info'](util[_0x7170('0xa')](_0x7170('0x30'),_0x4fc693['id']));_0x42911e();});default:logger['info'](util[_0x7170('0xa')](_0x7170('0x33'),_0x4fc693['id']));break;}}else{return BPromise[_0x7170('0x34')]()[_0x7170('0xe')](function(){if(!_0x4fc693[_0x7170('0x1b')]){throw new db[(_0x7170('0x1c'))][(_0x7170('0x1d'))](_0x7170('0x35'));}if(!_0x3fd8c1[_0x7170('0x1e')]||!_0x3fd8c1[_0x7170('0x1f')]||!_0x3fd8c1[_0x7170('0x20')]||!_0x3fd8c1[_0x7170('0x36')]||!_0x3fd8c1[_0x7170('0x21')]){throw new db['Sequelize'][(_0x7170('0x1d'))]('Sentiment\x20Analysis\x20not\x20configured');}if(!_0x4fc693[_0x7170('0x10')]){throw new Error('Transcript\x20not\x20available');}if(_0x3fd8c1[_0x7170('0x1f')]===_0x3193c7['id']){return _0x3193c7;}else{return db[_0x7170('0x37')][_0x7170('0x24')]({'where':{'id':_settings[_0x7170('0x1f')]}});}})[_0x7170('0xe')](function(_0x130774){if(!_0x130774){throw new db['Sequelize'][(_0x7170('0x1d'))](_0x7170('0x25'));}if(!_0x130774[_0x7170('0x26')]||!_0x130774[_0x7170('0x28')]){throw new db[(_0x7170('0x1c'))][(_0x7170('0x1d'))]('Cloud\x20Provider\x20not\x20configured');}_0x58c1ec=_0x130774;logger[_0x7170('0x9')](util[_0x7170('0xa')](_0x7170('0x27'),_0x4fc693['id']));return sentiment(_0x58c1ec[_0x7170('0x26')],_0x58c1ec['data2'],_0x3fd8c1[_0x7170('0x20')],_0x4fc693[_0x7170('0x10')],_0x3fd8c1[_0x7170('0x36')]);})['then'](function(_0x26e923){logger[_0x7170('0x9')](util[_0x7170('0xa')](_0x7170('0x29'),_0x4fc693['id']));return _0x4fc693['update']({'sentiment':_0x26e923[_0x7170('0x2b')],'sPositive':_0x26e923['SentimentScore']['Positive'],'sNegative':_0x26e923['SentimentScore'][_0x7170('0x2e')],'sMixed':_0x26e923['SentimentScore'][_0x7170('0x2f')],'sNeutral':_0x26e923[_0x7170('0x2c')][_0x7170('0x38')],'transcribeStatus':'COMPLETED'});})[_0x7170('0xe')](function(){logger['info'](util[_0x7170('0xa')](_0x7170('0x30'),_0x4fc693['id']));_0x42911e();});}})[_0x7170('0x39')](function(_0x25d1cf){if(_0x25d1cf){if(!_0x25d1cf['name']||_0x25d1cf[_0x7170('0x3a')]!==_0x7170('0x3b')){logger['error'](util[_0x7170('0xa')](_0x7170('0x3c'),_0x4fc693['id']),util[_0x7170('0x3d')](_0x25d1cf,{'showHidden':![],'depth':null}));}}_0x42911e();});});}function checkTranscribe(){var _0x3146ac;var _0x2d7ccf;var _0x2ba08a;return db[_0x7170('0x3e')]['findAll']({'where':{'transcribeStatus':_0x7170('0x3f')}})[_0x7170('0xe')](function(_0x191e7f){if(!_0x191e7f||!_0x191e7f[_0x7170('0x19')]){throw new db[(_0x7170('0x1c'))][(_0x7170('0x1d'))](_0x7170('0x40'));}_0x3146ac=_0x191e7f;return db['Setting'][_0x7170('0x24')]({'where':{'id':0x1}});})[_0x7170('0xe')](function(_0x21b223){if(!_0x21b223){throw new db['Sequelize'][(_0x7170('0x1d'))](_0x7170('0x41'));}_0x2d7ccf=_0x21b223;if(!_0x2d7ccf[_0x7170('0x3')]||!_0x2d7ccf[_0x7170('0x42')]||!_0x2d7ccf[_0x7170('0xd')]||!_0x2d7ccf[_0x7170('0x36')]||!_0x2d7ccf[_0x7170('0x21')]){throw new db[(_0x7170('0x1c'))][(_0x7170('0x1d'))]('Transcribe\x20not\x20configured');}return db['CloudProvider'][_0x7170('0x24')]({'where':{'id':_0x2d7ccf[_0x7170('0x42')]}});})[_0x7170('0xe')](function(_0x20acb8){if(!_0x20acb8){throw new db['Sequelize']['ValidationError'](_0x7170('0x25'));}if(!_0x20acb8['data1']||!_0x20acb8[_0x7170('0x28')]){throw new db[(_0x7170('0x1c'))]['ValidationError'](_0x7170('0x43'));}_0x2ba08a=_0x20acb8;var _0x2f79d6=[];_0x3146ac[_0x7170('0x44')](function(_0xb4cd99){_0x2f79d6[_0x7170('0x45')](checkTranscribeJob(_0xb4cd99,_0x2d7ccf,_0x2ba08a));});return BPromise[_0x7170('0x46')](_0x2f79d6);})[_0x7170('0x39')](function(_0x230c9a){if(_0x230c9a){if(!_0x230c9a[_0x7170('0x3a')]||_0x230c9a[_0x7170('0x3a')]!=='SequelizeValidationError'){logger[_0x7170('0x47')](util[_0x7170('0x3d')](_0x230c9a,{'showHidden':![],'depth':null}));}}});}exports[_0x7170('0x48')]=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 5bbb144..8179b70 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 _0xf7f7=['../../mysqldb','../logger','redis','defaults','socket.io-emitter','WhatsappInteraction','findAll','subtract','hours','then','length','map','info','[WHATSAPP]\x20Interactions\x20to\x20close:','join','timeout','YYYY-MM-DD\x20HH:mm:ss','emit','whatsappInteraction:update','catch','error','lodash','moment','ioredis','util'];(function(_0x2f462e,_0x393253){var _0x24442e=function(_0x4cad44){while(--_0x4cad44){_0x2f462e['push'](_0x2f462e['shift']());}};_0x24442e(++_0x393253);}(_0xf7f7,0xf6));var _0x7f7f=function(_0x114d1f,_0x55548e){_0x114d1f=_0x114d1f-0x0;var _0x5b91d4=_0xf7f7[_0x114d1f];return _0x5b91d4;};'use strict';var _=require(_0x7f7f('0x0'));var moment=require(_0x7f7f('0x1'));var Redis=require(_0x7f7f('0x2'));var util=require(_0x7f7f('0x3'));var config=require('../../config/environment');var db=require(_0x7f7f('0x4'))['db'];var logger=require(_0x7f7f('0x5'))('schedule');config[_0x7f7f('0x6')]=_[_0x7f7f('0x7')](config[_0x7f7f('0x6')],{'host':'localhost','port':0x18eb});var io=require(_0x7f7f('0x8'))(new Redis(config[_0x7f7f('0x6')]));function closeInteractions(){var _0x48f43a=[];return db[_0x7f7f('0x9')][_0x7f7f('0xa')]({'raw':!![],'attributes':['id','lastMsgAt'],'where':{'closed':![],'lastMsgDirection':'in','lastMsgAt':{'$lt':moment()[_0x7f7f('0xb')](0x18,_0x7f7f('0xc'))}}})[_0x7f7f('0xd')](function(_0x2f95b2){if(_0x2f95b2&&_0x2f95b2[_0x7f7f('0xe')]){_0x48f43a=_[_0x7f7f('0xf')](_0x2f95b2||[],'id');logger[_0x7f7f('0x10')](_0x7f7f('0x11'),_0x48f43a[_0x7f7f('0x12')]());return db[_0x7f7f('0x9')]['update']({'closeReason':'system','disposition':_0x7f7f('0x13'),'closed':!![],'closedAt':moment()['format'](_0x7f7f('0x14'))},{'where':{'id':_0x48f43a}});}})[_0x7f7f('0xd')](function(){if(_0x48f43a&&_0x48f43a['length']){logger[_0x7f7f('0x10')]('[WHATSAPP]\x20Sending\x20updates\x20for\x20interactions:',_0x48f43a[_0x7f7f('0x12')]());for(var _0x98fb86=0x0;_0x98fb86<_0x48f43a['length'];_0x98fb86++){io[_0x7f7f('0x15')](_0x7f7f('0x16'),{'id':_0x48f43a[_0x98fb86],'closed':!![]});}}})[_0x7f7f('0x17')](function(_0x37191c){logger[_0x7f7f('0x18')]('[WHATSAPP]\x20Error\x20closing\x20interactions',_0x37191c?util['inspect'](_0x37191c,{'showHidden':![],'depth':null}):'');});}exports['start']=function(){setInterval(function(){return closeInteractions();},0x3c*0x3e8);return closeInteractions();}; \ No newline at end of file +var _0x435d=['join','system','timeout','format','[WHATSAPP]\x20Sending\x20updates\x20for\x20interactions:','emit','catch','[WHATSAPP]\x20Error\x20closing\x20interactions','inspect','start','lodash','moment','ioredis','util','../../config/environment','../../mysqldb','../logger','schedule','defaults','localhost','socket.io-emitter','redis','findAll','lastMsgAt','hours','then','length','info'];(function(_0x494c1e,_0x148572){var _0x3c2bef=function(_0x3def72){while(--_0x3def72){_0x494c1e['push'](_0x494c1e['shift']());}};_0x3c2bef(++_0x148572);}(_0x435d,0x96));var _0xd435=function(_0x24e1ef,_0xced98b){_0x24e1ef=_0x24e1ef-0x0;var _0x531bfa=_0x435d[_0x24e1ef];return _0x531bfa;};'use strict';var _=require(_0xd435('0x0'));var moment=require(_0xd435('0x1'));var Redis=require(_0xd435('0x2'));var util=require(_0xd435('0x3'));var config=require(_0xd435('0x4'));var db=require(_0xd435('0x5'))['db'];var logger=require(_0xd435('0x6'))(_0xd435('0x7'));config['redis']=_[_0xd435('0x8')](config['redis'],{'host':_0xd435('0x9'),'port':0x18eb});var io=require(_0xd435('0xa'))(new Redis(config[_0xd435('0xb')]));function closeInteractions(){var _0x55a435=[];return db['WhatsappInteraction'][_0xd435('0xc')]({'raw':!![],'attributes':['id',_0xd435('0xd')],'where':{'closed':![],'lastMsgDirection':'in','lastMsgAt':{'$lt':moment()['subtract'](0x18,_0xd435('0xe'))}}})[_0xd435('0xf')](function(_0x148c1d){if(_0x148c1d&&_0x148c1d[_0xd435('0x10')]){_0x55a435=_['map'](_0x148c1d||[],'id');logger[_0xd435('0x11')]('[WHATSAPP]\x20Interactions\x20to\x20close:',_0x55a435[_0xd435('0x12')]());return db['WhatsappInteraction']['update']({'closeReason':_0xd435('0x13'),'disposition':_0xd435('0x14'),'closed':!![],'closedAt':moment()[_0xd435('0x15')]('YYYY-MM-DD\x20HH:mm:ss')},{'where':{'id':_0x55a435}});}})['then'](function(){if(_0x55a435&&_0x55a435[_0xd435('0x10')]){logger['info'](_0xd435('0x16'),_0x55a435[_0xd435('0x12')]());for(var _0x3c59ed=0x0;_0x3c59ed<_0x55a435[_0xd435('0x10')];_0x3c59ed++){io[_0xd435('0x17')]('whatsappInteraction:update',{'id':_0x55a435[_0x3c59ed],'closed':!![]});}}})[_0xd435('0x18')](function(_0x579a4d){logger['error'](_0xd435('0x19'),_0x579a4d?util[_0xd435('0x1a')](_0x579a4d,{'showHidden':![],'depth':null}):'');});}exports[_0xd435('0x1b')]=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 69d968a..b2441a3 100644 --- a/server/config/seedContact.js +++ b/server/config/seedContact.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0xba57=['contacts2','catch','../mysqldb','Innocenzo','Biondo','innocenzo.biondo','push','now','@xcally.com','destroy','then','bulkCreate','log','finished\x20populating','CmHopper','CmContact'];(function(_0x24f420,_0x49dca8){var _0x506279=function(_0x1f226f){while(--_0x1f226f){_0x24f420['push'](_0x24f420['shift']());}};_0x506279(++_0x49dca8);}(_0xba57,0xa2));var _0x7ba5=function(_0x22b98e,_0x191c20){_0x22b98e=_0x22b98e-0x0;var _0x5dfb59=_0xba57[_0x22b98e];return _0x5dfb59;};'use strict';var util=require('util');var db=require(_0x7ba5('0x0'))['db'];var contacts=[];var hopper=[];var contacts2=[];var hopper2=[];for(var i=0x1;i<=0x4b0;i+=0x1){contacts['push']({'id':i,'firstName':_0x7ba5('0x1')+i,'lastName':_0x7ba5('0x2')+i,'phone':0xf879fb460+i,'email':_0x7ba5('0x3')+i+'@xcally.com'});}for(var i=0x1;i<=0x4b0;i+=0x1){hopper[_0x7ba5('0x4')]({'id':i,'active':![],'scheduledat':Date[_0x7ba5('0x5')](),'countbusyretry':0x0,'countcongestionretry':0x0,'countnoanswerretry':0x0,'ContactId':i,'ListId':0x1,'UserId':0x1,'VoiceQueueId':0x3fd,'createdAt':Date['now'](),'updatedAt':Date[_0x7ba5('0x5')]()});}for(var i=0x4b1;i<=0x960;i+=0x1){contacts2['push']({'id':i,'firstName':_0x7ba5('0x1')+i,'lastName':'Biondo'+i,'phone':0xf879fb460+i,'email':_0x7ba5('0x3')+i+_0x7ba5('0x6')});}for(var i=0x4b1;i<=0x960;i+=0x1){hopper2[_0x7ba5('0x4')]({'id':i,'active':![],'scheduledat':Date[_0x7ba5('0x5')](),'countbusyretry':0x0,'countcongestionretry':0x0,'countnoanswerretry':0x0,'ContactId':i,'ListId':0x1,'UserId':0x1,'VoiceQueueId':0x3fd,'createdAt':Date['now'](),'updatedAt':Date[_0x7ba5('0x5')]()});}db['CmContact'][_0x7ba5('0x7')]({'where':{}})[_0x7ba5('0x8')](function(){return db['CmContact'][_0x7ba5('0x9')](contacts);})[_0x7ba5('0x8')](function(){console[_0x7ba5('0xa')](_0x7ba5('0xb'),'contacts1');return db[_0x7ba5('0xc')][_0x7ba5('0x7')]({'where':{}});})[_0x7ba5('0x8')](function(){return db['CmHopper'][_0x7ba5('0x9')](hopper);})[_0x7ba5('0x8')](function(){console['log'](_0x7ba5('0xb'),'hopper1');return db[_0x7ba5('0xd')][_0x7ba5('0x9')](contacts2);})[_0x7ba5('0x8')](function(){console[_0x7ba5('0xa')](_0x7ba5('0xb'),_0x7ba5('0xe'));return db[_0x7ba5('0xc')][_0x7ba5('0x9')](hopper2);})[_0x7ba5('0x8')](function(){console[_0x7ba5('0xa')]('finished\x20populating','hopper2');})[_0x7ba5('0xf')](function(_0x4f5b1b){console[_0x7ba5('0xa')](_0x4f5b1b);}); \ No newline at end of file +var _0x28a0=['innocenzo.biondo','now','CmContact','destroy','then','bulkCreate','log','finished\x20populating','CmHopper','contacts2','hopper2','catch','util','../mysqldb','push','Innocenzo','Biondo'];(function(_0x17260b,_0x48a1a5){var _0x118b39=function(_0x24d8ad){while(--_0x24d8ad){_0x17260b['push'](_0x17260b['shift']());}};_0x118b39(++_0x48a1a5);}(_0x28a0,0x13e));var _0x028a=function(_0x3e5086,_0x48f4a2){_0x3e5086=_0x3e5086-0x0;var _0xfeb102=_0x28a0[_0x3e5086];return _0xfeb102;};'use strict';var util=require(_0x028a('0x0'));var db=require(_0x028a('0x1'))['db'];var contacts=[];var hopper=[];var contacts2=[];var hopper2=[];for(var i=0x1;i<=0x4b0;i+=0x1){contacts[_0x028a('0x2')]({'id':i,'firstName':_0x028a('0x3')+i,'lastName':_0x028a('0x4')+i,'phone':0xf879fb460+i,'email':_0x028a('0x5')+i+'@xcally.com'});}for(var i=0x1;i<=0x4b0;i+=0x1){hopper[_0x028a('0x2')]({'id':i,'active':![],'scheduledat':Date['now'](),'countbusyretry':0x0,'countcongestionretry':0x0,'countnoanswerretry':0x0,'ContactId':i,'ListId':0x1,'UserId':0x1,'VoiceQueueId':0x3fd,'createdAt':Date[_0x028a('0x6')](),'updatedAt':Date[_0x028a('0x6')]()});}for(var i=0x4b1;i<=0x960;i+=0x1){contacts2[_0x028a('0x2')]({'id':i,'firstName':_0x028a('0x3')+i,'lastName':_0x028a('0x4')+i,'phone':0xf879fb460+i,'email':_0x028a('0x5')+i+'@xcally.com'});}for(var i=0x4b1;i<=0x960;i+=0x1){hopper2[_0x028a('0x2')]({'id':i,'active':![],'scheduledat':Date[_0x028a('0x6')](),'countbusyretry':0x0,'countcongestionretry':0x0,'countnoanswerretry':0x0,'ContactId':i,'ListId':0x1,'UserId':0x1,'VoiceQueueId':0x3fd,'createdAt':Date[_0x028a('0x6')](),'updatedAt':Date[_0x028a('0x6')]()});}db[_0x028a('0x7')][_0x028a('0x8')]({'where':{}})[_0x028a('0x9')](function(){return db['CmContact'][_0x028a('0xa')](contacts);})[_0x028a('0x9')](function(){console[_0x028a('0xb')](_0x028a('0xc'),'contacts1');return db[_0x028a('0xd')][_0x028a('0x8')]({'where':{}});})[_0x028a('0x9')](function(){return db[_0x028a('0xd')][_0x028a('0xa')](hopper);})[_0x028a('0x9')](function(){console[_0x028a('0xb')](_0x028a('0xc'),'hopper1');return db[_0x028a('0x7')][_0x028a('0xa')](contacts2);})[_0x028a('0x9')](function(){console['log'](_0x028a('0xc'),_0x028a('0xe'));return db[_0x028a('0xd')][_0x028a('0xa')](hopper2);})[_0x028a('0x9')](function(){console[_0x028a('0xb')](_0x028a('0xc'),_0x028a('0xf'));})[_0x028a('0x10')](function(_0x46435e){console['log'](_0x46435e);}); \ No newline at end of file diff --git a/server/config/seedUsers.js b/server/config/seedUsers.js index 29af2eb..d46844f 100644 --- a/server/config/seedUsers.js +++ b/server/config/seedUsers.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0xfc0c=['actpass','\x22%s\x22\x20<%s>','User','bulkCreate','then','log','add\x20user','catch','util','../mysqldb','push','format','%s%s','agent','%s%s@xcally.com','password','friend','udp','wss','yes','/etc/pki/tls/certs/motion.crt','/etc/pki/tls/private/motion.key'];(function(_0x1c6c1c,_0x17b7c8){var _0x4292ba=function(_0x2eb86d){while(--_0x2eb86d){_0x1c6c1c['push'](_0x1c6c1c['shift']());}};_0x4292ba(++_0x17b7c8);}(_0xfc0c,0xa2));var _0xcfc0=function(_0x85e2ac,_0x1341d1){_0x85e2ac=_0x85e2ac-0x0;var _0x5942d0=_0xfc0c[_0x85e2ac];return _0x5942d0;};'use strict';var util=require(_0xcfc0('0x0'));var db=require(_0xcfc0('0x1'))['db'];var users=[];for(var i=0x1;i<=0xc8;i+=0x1){users[_0xcfc0('0x2')]({'name':util[_0xcfc0('0x3')](_0xcfc0('0x4'),'agent',i),'fullname':util['format'](_0xcfc0('0x4'),_0xcfc0('0x5'),i),'email':util['format'](_0xcfc0('0x6'),_0xcfc0('0x5'),i),'role':_0xcfc0('0x5'),'password':_0xcfc0('0x7'),'internal':0xfa0+i,'type':_0xcfc0('0x8'),'transport':[_0xcfc0('0x9'),'ws',_0xcfc0('0xa')],'disallow':['all'],'allow':['ulaw'],'defaultuser':util[_0xcfc0('0x3')](_0xcfc0('0x4'),'agent',i),'encryption':_0xcfc0('0xb'),'avpf':_0xcfc0('0xb'),'force_avp':_0xcfc0('0xb'),'icesupport':_0xcfc0('0xb'),'dtlsenable':_0xcfc0('0xb'),'dtlsverify':'no','dtlscertfile':_0xcfc0('0xc'),'dtlsprivatekey':_0xcfc0('0xd'),'dtlssetup':_0xcfc0('0xe'),'callerid':util['format'](_0xcfc0('0xf'),util[_0xcfc0('0x3')]('%s%s',_0xcfc0('0x5'),i),0xfa0+i)});}db[_0xcfc0('0x10')][_0xcfc0('0x11')](users)[_0xcfc0('0x12')](function(){console[_0xcfc0('0x13')](_0xcfc0('0x14'));})[_0xcfc0('0x15')](function(_0x5cdfac){console[_0xcfc0('0x13')](_0x5cdfac);}); \ No newline at end of file +var _0x251d=['User','bulkCreate','add\x20user','catch','log','util','../mysqldb','push','format','%s%s','agent','%s%s@xcally.com','password','friend','udp','wss','all','ulaw','yes','/etc/pki/tls/private/motion.key','\x22%s\x22\x20<%s>'];(function(_0x415f8a,_0x3f7dc5){var _0x1391e7=function(_0x3569d8){while(--_0x3569d8){_0x415f8a['push'](_0x415f8a['shift']());}};_0x1391e7(++_0x3f7dc5);}(_0x251d,0x17f));var _0xd251=function(_0xeb36eb,_0x19c47a){_0xeb36eb=_0xeb36eb-0x0;var _0x442314=_0x251d[_0xeb36eb];return _0x442314;};'use strict';var util=require(_0xd251('0x0'));var db=require(_0xd251('0x1'))['db'];var users=[];for(var i=0x1;i<=0xc8;i+=0x1){users[_0xd251('0x2')]({'name':util[_0xd251('0x3')](_0xd251('0x4'),_0xd251('0x5'),i),'fullname':util[_0xd251('0x3')]('%s%s',_0xd251('0x5'),i),'email':util[_0xd251('0x3')](_0xd251('0x6'),_0xd251('0x5'),i),'role':_0xd251('0x5'),'password':_0xd251('0x7'),'internal':0xfa0+i,'type':_0xd251('0x8'),'transport':[_0xd251('0x9'),'ws',_0xd251('0xa')],'disallow':[_0xd251('0xb')],'allow':[_0xd251('0xc')],'defaultuser':util[_0xd251('0x3')](_0xd251('0x4'),_0xd251('0x5'),i),'encryption':_0xd251('0xd'),'avpf':_0xd251('0xd'),'force_avp':'yes','icesupport':'yes','dtlsenable':'yes','dtlsverify':'no','dtlscertfile':'/etc/pki/tls/certs/motion.crt','dtlsprivatekey':_0xd251('0xe'),'dtlssetup':'actpass','callerid':util[_0xd251('0x3')](_0xd251('0xf'),util[_0xd251('0x3')](_0xd251('0x4'),_0xd251('0x5'),i),0xfa0+i)});}db[_0xd251('0x10')][_0xd251('0x11')](users)['then'](function(){console['log'](_0xd251('0x12'));})[_0xd251('0x13')](function(_0x3f7554){console[_0xd251('0x14')](_0x3f7554);}); \ No newline at end of file diff --git a/server/config/socketio.js b/server/config/socketio.js index af3ffda..b173b5d 100644 --- a/server/config/socketio.js +++ b/server/config/socketio.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x1ae6=['DISCONNECTED','lodash','util','bluebird','../mysqldb','./environment','name','Agents','User','role','agent','telephone','then','autoAssociation','VoiceQueues','ChatQueues','FaxQueues','SmsQueues','MailQueues','WhatsappQueues','Telephones','findAll','Trunks','IvrCampaigns','UserProfileResource','map','resourceId','where','Campaign','type','ivr','format','user:%s','handshake','query','userProfileId','ChatInteraction','ChatInteractions','MailInteractions','FaxInteraction','FaxInteractions','SmsInteraction','SmsInteractions','OpenchannelInteraction','OpenchannelInteractions','WhatsappInteraction','WhatsappInteractions','admin','voice:outbound','hasOwnProperty','include','VoiceQueue','push','ChatQueue','FaxQueue','SmsQueue','MailQueue','OpenchannelQueue','WhatsappQueue','Trunk','voice:inbound','getVoiceQueues','getChatQueues','getSmsQueues','getMailQueues','getOpenchannelQueues','length','chat','fax','sms','mail','openchannel','whatsapp','telephone:%s','campaign:%s:%s','leave','removeChatInteractions','emit','user_has_chat_interactions:remove','removeMailInteractions','user_has_fax_interactions:remove','removeSmsInteractions','user_has_sms_interactions:remove','removeOpenchannelInteractions','user_has_openchannel_interactions:remove','removeWhatsappInteractions','user_has_whatsapp_interactions:remove','catch','log','join','default','connection','address','request','remoteAddress','remotePort','connectedAt','SocketIO\x20','nsp','disconnect'];(function(_0x69fe5,_0x69298f){var _0xb60c44=function(_0x50c35a){while(--_0x50c35a){_0x69fe5['push'](_0x69fe5['shift']());}};_0xb60c44(++_0x69298f);}(_0x1ae6,0x65));var _0x61ae=function(_0xa1e3e3,_0x29fe0e){_0xa1e3e3=_0xa1e3e3-0x0;var _0xc980e9=_0x1ae6[_0xa1e3e3];return _0xc980e9;};'use strict';var _=require(_0x61ae('0x0'));var util=require(_0x61ae('0x1'));var BPromise=require(_0x61ae('0x2'));var db=require(_0x61ae('0x3'))['db'];var config=require(_0x61ae('0x4'));var queryQueues={'attributes':['id',_0x61ae('0x5')],'include':[{'as':_0x61ae('0x6'),'model':db[_0x61ae('0x7')],'attributes':['id',_0x61ae('0x5'),_0x61ae('0x8')],'raw':!![],'where':{'role':_0x61ae('0x9')},'required':![]}]};var queryTelephones={'raw':!![],'attributes':['id',_0x61ae('0x5')],'where':{'role':_0x61ae('0xa')}};var queryTrunks={'raw':!![],'attributes':['id','name']};var queryAgents={'raw':!![],'attributes':['id','name'],'where':{'role':'agent'}};var queryCampaigns={'raw':!![],'attributes':['id',_0x61ae('0x5'),'type'],'where':{'type':'ivr'}};function getAssociatedResources(_0xf6a00,_0x1864e8,_0x591eb7){return db['UserProfileSection']['findOne']({'where':{'name':_0xf6a00,'userProfileId':_0x1864e8},'raw':!![]})[_0x61ae('0xb')](function(_0x480e10){if(_0x480e10){if(_0x480e10[_0x61ae('0xc')]){switch(_0xf6a00){case _0x61ae('0xd'):case _0x61ae('0xe'):case _0x61ae('0xf'):case _0x61ae('0x10'):case _0x61ae('0x11'):case'OpenchannelQueues':case _0x61ae('0x12'):return db[_0x591eb7]['findAll'](queryQueues);case _0x61ae('0x13'):return db[_0x591eb7][_0x61ae('0x14')](queryTelephones);case _0x61ae('0x15'):return db[_0x591eb7][_0x61ae('0x14')](queryTrunks);case _0x61ae('0x16'):return db[_0x591eb7][_0x61ae('0x14')](queryCampaigns);}}else{return db[_0x61ae('0x17')]['findAll']({'attributes':['resourceId'],'where':{'sectionId':_0x480e10['id']},'raw':!![]})[_0x61ae('0xb')](function(_0x6dc672){if(_0x6dc672){var _0x5d1001={'where':{'id':_[_0x61ae('0x18')](_0x6dc672,_0x61ae('0x19'))},'raw':!![]};switch(_0x591eb7){case'User':_0x5d1001[_0x61ae('0x1a')][_0x61ae('0x8')]=_0x61ae('0xa');break;case _0x61ae('0x1b'):_0x5d1001[_0x61ae('0x1a')][_0x61ae('0x1c')]=_0x61ae('0x1d');break;}return db[_0x591eb7][_0x61ae('0x14')](_0x5d1001);}else{return[];}});}}else{return[];}})['then'](function(_0x1c6d08){return _0x1c6d08;});}function joinOrLeaveQueues(_0x3a3770,_0x56053b,_0xd6b7fd,_0x533cef){_0x3a3770[_0x56053b](util[_0x61ae('0x1e')]('%s:queue:%s',_0xd6b7fd,_0x533cef[_0x61ae('0x5')]));if(_0x533cef[_0x61ae('0x6')]){for(var _0x2f0eb2=0x0;_0x2f0eb2<_0x533cef[_0x61ae('0x6')]['length'];_0x2f0eb2+=0x1){_0x3a3770[_0x56053b](util[_0x61ae('0x1e')](_0x61ae('0x1f'),_0x533cef['Agents'][_0x2f0eb2][_0x61ae('0x5')]));}}}function joinOrLeave(_0xc69019,_0x5d9828,_0x2d3dd9){var _0x481ced;if(_0xc69019[_0x61ae('0x20')][_0x61ae('0x21')]['id']){db[_0x61ae('0x7')]['find']({'attributes':['id','name',_0x61ae('0x8'),_0x61ae('0x22')],'where':{'id':_0xc69019[_0x61ae('0x20')][_0x61ae('0x21')]['id']},'include':[{'model':db[_0x61ae('0x23')],'as':_0x61ae('0x24'),'attributes':['id'],'raw':!![]},{'model':db['MailInteraction'],'as':_0x61ae('0x25'),'attributes':['id'],'raw':!![]},{'model':db[_0x61ae('0x26')],'as':_0x61ae('0x27'),'attributes':['id'],'raw':!![]},{'model':db[_0x61ae('0x28')],'as':_0x61ae('0x29'),'attributes':['id'],'raw':!![]},{'model':db[_0x61ae('0x2a')],'as':_0x61ae('0x2b'),'attributes':['id'],'raw':!![]},{'model':db[_0x61ae('0x2c')],'as':_0x61ae('0x2d'),'attributes':['id'],'raw':!![]}]})['then'](function(_0x4d21ee){if(_0x4d21ee){_0x481ced=_0x4d21ee;_0xc69019[_0x5d9828](util[_0x61ae('0x1e')](_0x61ae('0x1f'),_0x4d21ee[_0x61ae('0x5')]));var _0x4830fb=[];switch(_0x4d21ee['role']){case _0x61ae('0x2e'):_0xc69019[_0x5d9828]('voice:inbound');_0xc69019[_0x5d9828](_0x61ae('0x2f'));if(queryQueues[_0x61ae('0x30')](_0x61ae('0x31'))){delete queryQueues['include'];}_0x4830fb['push'](db[_0x61ae('0x32')][_0x61ae('0x14')](queryQueues));_0x4830fb[_0x61ae('0x33')](db[_0x61ae('0x34')]['findAll'](queryQueues));_0x4830fb[_0x61ae('0x33')](db[_0x61ae('0x35')]['findAll'](queryQueues));_0x4830fb[_0x61ae('0x33')](db[_0x61ae('0x36')][_0x61ae('0x14')](queryQueues));_0x4830fb[_0x61ae('0x33')](db[_0x61ae('0x37')][_0x61ae('0x14')](queryQueues));_0x4830fb[_0x61ae('0x33')](db[_0x61ae('0x38')][_0x61ae('0x14')](queryQueues));_0x4830fb[_0x61ae('0x33')](db[_0x61ae('0x39')][_0x61ae('0x14')](queryQueues));_0x4830fb['push'](db['User']['findAll'](queryTelephones));_0x4830fb['push'](db[_0x61ae('0x3a')][_0x61ae('0x14')](queryTrunks));_0x4830fb[_0x61ae('0x33')](db['Campaign'][_0x61ae('0x14')](queryCampaigns));_0x4830fb['push'](db['User'][_0x61ae('0x14')](queryAgents));break;case'user':_0xc69019[_0x5d9828](_0x61ae('0x3b'));_0xc69019[_0x5d9828]('voice:outbound');_0x4830fb[_0x61ae('0x33')](getAssociatedResources(_0x61ae('0xd'),_0x4d21ee['userProfileId'],_0x61ae('0x32')));_0x4830fb['push'](getAssociatedResources('ChatQueues',_0x4d21ee[_0x61ae('0x22')],_0x61ae('0x34')));_0x4830fb[_0x61ae('0x33')](getAssociatedResources(_0x61ae('0xf'),_0x4d21ee[_0x61ae('0x22')],_0x61ae('0x35')));_0x4830fb[_0x61ae('0x33')](getAssociatedResources('SmsQueues',_0x4d21ee['userProfileId'],_0x61ae('0x36')));_0x4830fb[_0x61ae('0x33')](getAssociatedResources(_0x61ae('0x11'),_0x4d21ee[_0x61ae('0x22')],_0x61ae('0x37')));_0x4830fb[_0x61ae('0x33')](getAssociatedResources('OpenchannelQueues',_0x4d21ee[_0x61ae('0x22')],'OpenchannelQueue'));_0x4830fb[_0x61ae('0x33')](getAssociatedResources(_0x61ae('0x12'),_0x4d21ee[_0x61ae('0x22')],_0x61ae('0x39')));_0x4830fb[_0x61ae('0x33')](getAssociatedResources(_0x61ae('0x13'),_0x4d21ee[_0x61ae('0x22')],_0x61ae('0x7')));_0x4830fb[_0x61ae('0x33')](getAssociatedResources(_0x61ae('0x15'),_0x4d21ee['userProfileId'],'Trunk'));_0x4830fb[_0x61ae('0x33')](getAssociatedResources(_0x61ae('0x16'),_0x4d21ee[_0x61ae('0x22')],_0x61ae('0x1b')));_0x4830fb[_0x61ae('0x33')](db['User'][_0x61ae('0x14')](queryAgents));break;case _0x61ae('0x9'):_0xc69019[_0x5d9828](_0x61ae('0x3b'));_0xc69019[_0x5d9828](_0x61ae('0x2f'));_0x4830fb[_0x61ae('0x33')](_0x4d21ee[_0x61ae('0x3c')]({'attributes':['id',_0x61ae('0x5')]}));_0x4830fb['push'](_0x4d21ee[_0x61ae('0x3d')]({'attributes':['id',_0x61ae('0x5')]}));_0x4830fb[_0x61ae('0x33')](_0x4d21ee['getFaxQueues']({'attributes':['id',_0x61ae('0x5')]}));_0x4830fb[_0x61ae('0x33')](_0x4d21ee[_0x61ae('0x3e')]({'attributes':['id',_0x61ae('0x5')]}));_0x4830fb[_0x61ae('0x33')](_0x4d21ee[_0x61ae('0x3f')]({'attributes':['id',_0x61ae('0x5')]}));_0x4830fb[_0x61ae('0x33')](_0x4d21ee[_0x61ae('0x40')]({'attributes':['id',_0x61ae('0x5')]}));_0x4830fb['push'](_0x4d21ee['getWhatsappQueues']({'attributes':['id',_0x61ae('0x5')]}));break;}return BPromise['all'](_0x4830fb);}})[_0x61ae('0xb')](function(_0xd99b44){if(_0xd99b44&&_0xd99b44[_0x61ae('0x41')]){for(var _0x18aef3=0x0;_0x18aef3<_0xd99b44[_0x61ae('0x41')];_0x18aef3+=0x1){for(var _0x400acf=0x0;_0x400acf<_0xd99b44[_0x18aef3]['length'];_0x400acf+=0x1){switch(_0x18aef3){case 0x0:joinOrLeaveQueues(_0xc69019,_0x5d9828,'voice',_0xd99b44[_0x18aef3][_0x400acf]);break;case 0x1:joinOrLeaveQueues(_0xc69019,_0x5d9828,_0x61ae('0x42'),_0xd99b44[_0x18aef3][_0x400acf]);break;case 0x2:joinOrLeaveQueues(_0xc69019,_0x5d9828,_0x61ae('0x43'),_0xd99b44[_0x18aef3][_0x400acf]);break;case 0x3:joinOrLeaveQueues(_0xc69019,_0x5d9828,_0x61ae('0x44'),_0xd99b44[_0x18aef3][_0x400acf]);break;case 0x4:joinOrLeaveQueues(_0xc69019,_0x5d9828,_0x61ae('0x45'),_0xd99b44[_0x18aef3][_0x400acf]);break;case 0x5:joinOrLeaveQueues(_0xc69019,_0x5d9828,_0x61ae('0x46'),_0xd99b44[_0x18aef3][_0x400acf]);break;case 0x6:joinOrLeaveQueues(_0xc69019,_0x5d9828,_0x61ae('0x47'),_0xd99b44[_0x18aef3][_0x400acf]);break;case 0x7:if(_0x481ced['role']!==_0x61ae('0x9'))_0xc69019[_0x5d9828](util[_0x61ae('0x1e')](_0x61ae('0x48'),_0xd99b44[_0x18aef3][_0x400acf][_0x61ae('0x5')]));break;case 0x8:if(_0x481ced[_0x61ae('0x8')]!==_0x61ae('0x9'))_0xc69019[_0x5d9828](util[_0x61ae('0x1e')]('trunk:%s',_0xd99b44[_0x18aef3][_0x400acf][_0x61ae('0x5')]));break;case 0x9:if(_0x481ced[_0x61ae('0x8')]!==_0x61ae('0x9'))_0xc69019[_0x5d9828](util[_0x61ae('0x1e')](_0x61ae('0x49'),_0xd99b44[_0x18aef3][_0x400acf]['type'],_0xd99b44[_0x18aef3][_0x400acf]['name']));break;case 0xa:_0xc69019[_0x5d9828](util[_0x61ae('0x1e')](_0x61ae('0x1f'),_0xd99b44[_0x18aef3][_0x400acf][_0x61ae('0x5')]));break;}}}}})[_0x61ae('0xb')](function(){if(_0x5d9828===_0x61ae('0x4a')){var _0xbe20c=_[_0x61ae('0x18')](_0x481ced[_0x61ae('0x24')],'id');return _0x481ced[_0x61ae('0x4b')](_0xbe20c)[_0x61ae('0xb')](function(){for(var _0x2d3124=0x0;_0x2d3124<_0xbe20c[_0x61ae('0x41')];_0x2d3124+=0x1){_0x2d3dd9[_0x61ae('0x4c')](_0x61ae('0x4d'),{'ChatInteractionId':Number(_0xbe20c[_0x2d3124]),'UserId':Number(_0x481ced['id'])});}});}})[_0x61ae('0xb')](function(){if(_0x5d9828===_0x61ae('0x4a')){var _0x478759=_[_0x61ae('0x18')](_0x481ced[_0x61ae('0x25')],'id');return _0x481ced[_0x61ae('0x4e')](_0x478759)[_0x61ae('0xb')](function(){for(var _0x35400e=0x0;_0x35400e<_0x478759[_0x61ae('0x41')];_0x35400e+=0x1){_0x2d3dd9['emit']('user_has_mail_interactions:remove',{'MailInteractionId':Number(_0x478759[_0x35400e]),'UserId':Number(_0x481ced['id'])});}});}})[_0x61ae('0xb')](function(){if(_0x5d9828===_0x61ae('0x4a')){var _0x32ba4b=_['map'](_0x481ced[_0x61ae('0x27')],'id');return _0x481ced['removeFaxInteractions'](_0x32ba4b)[_0x61ae('0xb')](function(){for(var _0x37055c=0x0;_0x37055c<_0x32ba4b[_0x61ae('0x41')];_0x37055c+=0x1){_0x2d3dd9[_0x61ae('0x4c')](_0x61ae('0x4f'),{'FaxInteractionId':Number(_0x32ba4b[_0x37055c]),'UserId':Number(_0x481ced['id'])});}});}})[_0x61ae('0xb')](function(){if(_0x5d9828==='leave'){var _0x455c81=_['map'](_0x481ced['SmsInteractions'],'id');return _0x481ced[_0x61ae('0x50')](_0x455c81)['then'](function(){for(var _0x2d3697=0x0;_0x2d3697<_0x455c81[_0x61ae('0x41')];_0x2d3697+=0x1){_0x2d3dd9['emit'](_0x61ae('0x51'),{'SmsInteractionId':Number(_0x455c81[_0x2d3697]),'UserId':Number(_0x481ced['id'])});}});}})['then'](function(){if(_0x5d9828==='leave'){var _0x4f6fd8=_[_0x61ae('0x18')](_0x481ced[_0x61ae('0x2b')],'id');return _0x481ced[_0x61ae('0x52')](_0x4f6fd8)[_0x61ae('0xb')](function(){for(var _0x59b5eb=0x0;_0x59b5eb<_0x4f6fd8[_0x61ae('0x41')];_0x59b5eb+=0x1){_0x2d3dd9['emit'](_0x61ae('0x53'),{'OpenchannelInteractionId':Number(_0x4f6fd8[_0x59b5eb]),'UserId':Number(_0x481ced['id'])});}});}})[_0x61ae('0xb')](function(){if(_0x5d9828===_0x61ae('0x4a')){var _0x1f6231=_['map'](_0x481ced[_0x61ae('0x2d')],'id');return _0x481ced[_0x61ae('0x54')](_0x1f6231)['then'](function(){for(var _0xbfb517=0x0;_0xbfb517<_0x1f6231[_0x61ae('0x41')];_0xbfb517+=0x1){_0x2d3dd9[_0x61ae('0x4c')](_0x61ae('0x55'),{'WhatsappInteractionId':Number(_0x1f6231[_0xbfb517]),'UserId':Number(_0x481ced['id'])});}});}})[_0x61ae('0x56')](function(_0x57e756){_0xc69019[_0x61ae('0x57')](_0x57e756);});}}function onDisconnect(_0xe60fbe,_0x4839b2){joinOrLeave(_0xe60fbe,_0x61ae('0x4a'),_0x4839b2);}function onConnect(_0x5ca248){joinOrLeave(_0x5ca248,_0x61ae('0x58'));}exports[_0x61ae('0x59')]=function(_0x47e711){_0x47e711['on'](_0x61ae('0x5a'),function(_0x30a29c){_0x30a29c['setMaxListeners'](0x0);_0x30a29c[_0x61ae('0x5b')]=_0x30a29c[_0x61ae('0x5c')]['connection'][_0x61ae('0x5d')]+':'+_0x30a29c[_0x61ae('0x5c')][_0x61ae('0x5a')][_0x61ae('0x5e')];_0x30a29c[_0x61ae('0x5f')]=new Date();_0x30a29c[_0x61ae('0x57')]=function(_0x446b51){console[_0x61ae('0x57')](_0x61ae('0x60')+_0x30a29c[_0x61ae('0x61')][_0x61ae('0x5')]+'['+_0x30a29c[_0x61ae('0x5b')]+']',_0x446b51);};_0x30a29c['on'](_0x61ae('0x62'),function(){onDisconnect(_0x30a29c,_0x47e711);_0x30a29c[_0x61ae('0x57')](_0x61ae('0x63'));});onConnect(_0x30a29c);_0x30a29c['log']('CONNECTED');});}; \ No newline at end of file +var _0xd26f=['SocketIO\x20','CONNECTED','lodash','util','./environment','name','Agents','User','role','agent','telephone','type','ivr','UserProfileSection','findOne','then','autoAssociation','ChatQueues','SmsQueues','findAll','Trunks','IvrCampaigns','UserProfileResource','resourceId','map','where','Campaign','format','handshake','find','userProfileId','query','ChatInteractions','MailInteraction','FaxInteraction','FaxInteractions','SmsInteraction','SmsInteractions','OpenchannelInteraction','OpenchannelInteractions','WhatsappInteraction','WhatsappInteractions','admin','voice:inbound','include','VoiceQueue','push','ChatQueue','FaxQueue','SmsQueue','MailQueue','OpenchannelQueue','WhatsappQueue','Trunk','user','voice:outbound','MailQueues','OpenchannelQueues','WhatsappQueues','Telephones','getVoiceQueues','getChatQueues','getSmsQueues','getMailQueues','length','voice','fax','mail','openchannel','whatsapp','leave','removeChatInteractions','emit','user_has_chat_interactions:remove','MailInteractions','user_has_mail_interactions:remove','removeFaxInteractions','user_has_fax_interactions:remove','user_has_sms_interactions:remove','removeOpenchannelInteractions','user_has_whatsapp_interactions:remove','catch','log','join','default','connection','setMaxListeners','address','request','remoteAddress','remotePort'];(function(_0x14c0da,_0x1139f3){var _0x120e32=function(_0x25e7c2){while(--_0x25e7c2){_0x14c0da['push'](_0x14c0da['shift']());}};_0x120e32(++_0x1139f3);}(_0xd26f,0x113));var _0xfd26=function(_0x167cc1,_0x56ef5a){_0x167cc1=_0x167cc1-0x0;var _0x10bc4b=_0xd26f[_0x167cc1];return _0x10bc4b;};'use strict';var _=require(_0xfd26('0x0'));var util=require(_0xfd26('0x1'));var BPromise=require('bluebird');var db=require('../mysqldb')['db'];var config=require(_0xfd26('0x2'));var queryQueues={'attributes':['id',_0xfd26('0x3')],'include':[{'as':_0xfd26('0x4'),'model':db[_0xfd26('0x5')],'attributes':['id',_0xfd26('0x3'),_0xfd26('0x6')],'raw':!![],'where':{'role':_0xfd26('0x7')},'required':![]}]};var queryTelephones={'raw':!![],'attributes':['id',_0xfd26('0x3')],'where':{'role':_0xfd26('0x8')}};var queryTrunks={'raw':!![],'attributes':['id','name']};var queryAgents={'raw':!![],'attributes':['id',_0xfd26('0x3')],'where':{'role':_0xfd26('0x7')}};var queryCampaigns={'raw':!![],'attributes':['id',_0xfd26('0x3'),_0xfd26('0x9')],'where':{'type':_0xfd26('0xa')}};function getAssociatedResources(_0x447f02,_0x5a3c54,_0xcf2fdb){return db[_0xfd26('0xb')][_0xfd26('0xc')]({'where':{'name':_0x447f02,'userProfileId':_0x5a3c54},'raw':!![]})[_0xfd26('0xd')](function(_0x13719f){if(_0x13719f){if(_0x13719f[_0xfd26('0xe')]){switch(_0x447f02){case'VoiceQueues':case _0xfd26('0xf'):case'FaxQueues':case _0xfd26('0x10'):case'MailQueues':case'OpenchannelQueues':case'WhatsappQueues':return db[_0xcf2fdb]['findAll'](queryQueues);case'Telephones':return db[_0xcf2fdb][_0xfd26('0x11')](queryTelephones);case _0xfd26('0x12'):return db[_0xcf2fdb][_0xfd26('0x11')](queryTrunks);case _0xfd26('0x13'):return db[_0xcf2fdb][_0xfd26('0x11')](queryCampaigns);}}else{return db[_0xfd26('0x14')][_0xfd26('0x11')]({'attributes':[_0xfd26('0x15')],'where':{'sectionId':_0x13719f['id']},'raw':!![]})[_0xfd26('0xd')](function(_0xb19013){if(_0xb19013){var _0x9c5bcd={'where':{'id':_[_0xfd26('0x16')](_0xb19013,_0xfd26('0x15'))},'raw':!![]};switch(_0xcf2fdb){case _0xfd26('0x5'):_0x9c5bcd[_0xfd26('0x17')]['role']=_0xfd26('0x8');break;case _0xfd26('0x18'):_0x9c5bcd[_0xfd26('0x17')][_0xfd26('0x9')]=_0xfd26('0xa');break;}return db[_0xcf2fdb]['findAll'](_0x9c5bcd);}else{return[];}});}}else{return[];}})[_0xfd26('0xd')](function(_0x51801e){return _0x51801e;});}function joinOrLeaveQueues(_0x53cd2b,_0x56d960,_0x3b5b36,_0x14c99d){_0x53cd2b[_0x56d960](util['format']('%s:queue:%s',_0x3b5b36,_0x14c99d[_0xfd26('0x3')]));if(_0x14c99d[_0xfd26('0x4')]){for(var _0x5b4004=0x0;_0x5b4004<_0x14c99d[_0xfd26('0x4')]['length'];_0x5b4004+=0x1){_0x53cd2b[_0x56d960](util[_0xfd26('0x19')]('user:%s',_0x14c99d[_0xfd26('0x4')][_0x5b4004]['name']));}}}function joinOrLeave(_0xcf941a,_0xd6887,_0x51271d){var _0x5f5d51;if(_0xcf941a[_0xfd26('0x1a')]['query']['id']){db[_0xfd26('0x5')][_0xfd26('0x1b')]({'attributes':['id',_0xfd26('0x3'),_0xfd26('0x6'),_0xfd26('0x1c')],'where':{'id':_0xcf941a['handshake'][_0xfd26('0x1d')]['id']},'include':[{'model':db['ChatInteraction'],'as':_0xfd26('0x1e'),'attributes':['id'],'raw':!![]},{'model':db[_0xfd26('0x1f')],'as':'MailInteractions','attributes':['id'],'raw':!![]},{'model':db[_0xfd26('0x20')],'as':_0xfd26('0x21'),'attributes':['id'],'raw':!![]},{'model':db[_0xfd26('0x22')],'as':_0xfd26('0x23'),'attributes':['id'],'raw':!![]},{'model':db[_0xfd26('0x24')],'as':_0xfd26('0x25'),'attributes':['id'],'raw':!![]},{'model':db[_0xfd26('0x26')],'as':_0xfd26('0x27'),'attributes':['id'],'raw':!![]}]})[_0xfd26('0xd')](function(_0x5b3be9){if(_0x5b3be9){_0x5f5d51=_0x5b3be9;_0xcf941a[_0xd6887](util['format']('user:%s',_0x5b3be9['name']));var _0xe29044=[];switch(_0x5b3be9['role']){case _0xfd26('0x28'):_0xcf941a[_0xd6887](_0xfd26('0x29'));_0xcf941a[_0xd6887]('voice:outbound');if(queryQueues['hasOwnProperty'](_0xfd26('0x2a'))){delete queryQueues['include'];}_0xe29044['push'](db[_0xfd26('0x2b')][_0xfd26('0x11')](queryQueues));_0xe29044[_0xfd26('0x2c')](db[_0xfd26('0x2d')][_0xfd26('0x11')](queryQueues));_0xe29044['push'](db[_0xfd26('0x2e')][_0xfd26('0x11')](queryQueues));_0xe29044[_0xfd26('0x2c')](db[_0xfd26('0x2f')][_0xfd26('0x11')](queryQueues));_0xe29044['push'](db[_0xfd26('0x30')]['findAll'](queryQueues));_0xe29044[_0xfd26('0x2c')](db[_0xfd26('0x31')][_0xfd26('0x11')](queryQueues));_0xe29044['push'](db[_0xfd26('0x32')][_0xfd26('0x11')](queryQueues));_0xe29044[_0xfd26('0x2c')](db[_0xfd26('0x5')]['findAll'](queryTelephones));_0xe29044['push'](db[_0xfd26('0x33')]['findAll'](queryTrunks));_0xe29044[_0xfd26('0x2c')](db['Campaign'][_0xfd26('0x11')](queryCampaigns));_0xe29044[_0xfd26('0x2c')](db[_0xfd26('0x5')]['findAll'](queryAgents));break;case _0xfd26('0x34'):_0xcf941a[_0xd6887](_0xfd26('0x29'));_0xcf941a[_0xd6887](_0xfd26('0x35'));_0xe29044[_0xfd26('0x2c')](getAssociatedResources('VoiceQueues',_0x5b3be9[_0xfd26('0x1c')],'VoiceQueue'));_0xe29044[_0xfd26('0x2c')](getAssociatedResources('ChatQueues',_0x5b3be9[_0xfd26('0x1c')],_0xfd26('0x2d')));_0xe29044[_0xfd26('0x2c')](getAssociatedResources('FaxQueues',_0x5b3be9[_0xfd26('0x1c')],_0xfd26('0x2e')));_0xe29044[_0xfd26('0x2c')](getAssociatedResources(_0xfd26('0x10'),_0x5b3be9[_0xfd26('0x1c')],_0xfd26('0x2f')));_0xe29044[_0xfd26('0x2c')](getAssociatedResources(_0xfd26('0x36'),_0x5b3be9[_0xfd26('0x1c')],_0xfd26('0x30')));_0xe29044[_0xfd26('0x2c')](getAssociatedResources(_0xfd26('0x37'),_0x5b3be9['userProfileId'],_0xfd26('0x31')));_0xe29044['push'](getAssociatedResources(_0xfd26('0x38'),_0x5b3be9[_0xfd26('0x1c')],_0xfd26('0x32')));_0xe29044[_0xfd26('0x2c')](getAssociatedResources(_0xfd26('0x39'),_0x5b3be9[_0xfd26('0x1c')],'User'));_0xe29044[_0xfd26('0x2c')](getAssociatedResources('Trunks',_0x5b3be9[_0xfd26('0x1c')],_0xfd26('0x33')));_0xe29044[_0xfd26('0x2c')](getAssociatedResources(_0xfd26('0x13'),_0x5b3be9[_0xfd26('0x1c')],'Campaign'));_0xe29044[_0xfd26('0x2c')](db[_0xfd26('0x5')]['findAll'](queryAgents));break;case _0xfd26('0x7'):_0xcf941a[_0xd6887](_0xfd26('0x29'));_0xcf941a[_0xd6887]('voice:outbound');_0xe29044['push'](_0x5b3be9[_0xfd26('0x3a')]({'attributes':['id',_0xfd26('0x3')]}));_0xe29044[_0xfd26('0x2c')](_0x5b3be9[_0xfd26('0x3b')]({'attributes':['id',_0xfd26('0x3')]}));_0xe29044['push'](_0x5b3be9['getFaxQueues']({'attributes':['id',_0xfd26('0x3')]}));_0xe29044[_0xfd26('0x2c')](_0x5b3be9[_0xfd26('0x3c')]({'attributes':['id','name']}));_0xe29044['push'](_0x5b3be9[_0xfd26('0x3d')]({'attributes':['id',_0xfd26('0x3')]}));_0xe29044[_0xfd26('0x2c')](_0x5b3be9['getOpenchannelQueues']({'attributes':['id',_0xfd26('0x3')]}));_0xe29044['push'](_0x5b3be9['getWhatsappQueues']({'attributes':['id',_0xfd26('0x3')]}));break;}return BPromise['all'](_0xe29044);}})['then'](function(_0x442212){if(_0x442212&&_0x442212['length']){for(var _0x582aac=0x0;_0x582aac<_0x442212[_0xfd26('0x3e')];_0x582aac+=0x1){for(var _0xc1f2d=0x0;_0xc1f2d<_0x442212[_0x582aac][_0xfd26('0x3e')];_0xc1f2d+=0x1){switch(_0x582aac){case 0x0:joinOrLeaveQueues(_0xcf941a,_0xd6887,_0xfd26('0x3f'),_0x442212[_0x582aac][_0xc1f2d]);break;case 0x1:joinOrLeaveQueues(_0xcf941a,_0xd6887,'chat',_0x442212[_0x582aac][_0xc1f2d]);break;case 0x2:joinOrLeaveQueues(_0xcf941a,_0xd6887,_0xfd26('0x40'),_0x442212[_0x582aac][_0xc1f2d]);break;case 0x3:joinOrLeaveQueues(_0xcf941a,_0xd6887,'sms',_0x442212[_0x582aac][_0xc1f2d]);break;case 0x4:joinOrLeaveQueues(_0xcf941a,_0xd6887,_0xfd26('0x41'),_0x442212[_0x582aac][_0xc1f2d]);break;case 0x5:joinOrLeaveQueues(_0xcf941a,_0xd6887,_0xfd26('0x42'),_0x442212[_0x582aac][_0xc1f2d]);break;case 0x6:joinOrLeaveQueues(_0xcf941a,_0xd6887,_0xfd26('0x43'),_0x442212[_0x582aac][_0xc1f2d]);break;case 0x7:if(_0x5f5d51[_0xfd26('0x6')]!==_0xfd26('0x7'))_0xcf941a[_0xd6887](util[_0xfd26('0x19')]('telephone:%s',_0x442212[_0x582aac][_0xc1f2d]['name']));break;case 0x8:if(_0x5f5d51[_0xfd26('0x6')]!==_0xfd26('0x7'))_0xcf941a[_0xd6887](util[_0xfd26('0x19')]('trunk:%s',_0x442212[_0x582aac][_0xc1f2d]['name']));break;case 0x9:if(_0x5f5d51['role']!==_0xfd26('0x7'))_0xcf941a[_0xd6887](util[_0xfd26('0x19')]('campaign:%s:%s',_0x442212[_0x582aac][_0xc1f2d][_0xfd26('0x9')],_0x442212[_0x582aac][_0xc1f2d][_0xfd26('0x3')]));break;case 0xa:_0xcf941a[_0xd6887](util['format']('user:%s',_0x442212[_0x582aac][_0xc1f2d][_0xfd26('0x3')]));break;}}}}})[_0xfd26('0xd')](function(){if(_0xd6887===_0xfd26('0x44')){var _0x4e755d=_[_0xfd26('0x16')](_0x5f5d51[_0xfd26('0x1e')],'id');return _0x5f5d51[_0xfd26('0x45')](_0x4e755d)[_0xfd26('0xd')](function(){for(var _0x3649b9=0x0;_0x3649b9<_0x4e755d[_0xfd26('0x3e')];_0x3649b9+=0x1){_0x51271d[_0xfd26('0x46')](_0xfd26('0x47'),{'ChatInteractionId':Number(_0x4e755d[_0x3649b9]),'UserId':Number(_0x5f5d51['id'])});}});}})[_0xfd26('0xd')](function(){if(_0xd6887===_0xfd26('0x44')){var _0x2cc6da=_[_0xfd26('0x16')](_0x5f5d51[_0xfd26('0x48')],'id');return _0x5f5d51['removeMailInteractions'](_0x2cc6da)[_0xfd26('0xd')](function(){for(var _0x18e3dd=0x0;_0x18e3dd<_0x2cc6da[_0xfd26('0x3e')];_0x18e3dd+=0x1){_0x51271d[_0xfd26('0x46')](_0xfd26('0x49'),{'MailInteractionId':Number(_0x2cc6da[_0x18e3dd]),'UserId':Number(_0x5f5d51['id'])});}});}})['then'](function(){if(_0xd6887==='leave'){var _0x53b9f4=_[_0xfd26('0x16')](_0x5f5d51[_0xfd26('0x21')],'id');return _0x5f5d51[_0xfd26('0x4a')](_0x53b9f4)[_0xfd26('0xd')](function(){for(var _0x58427d=0x0;_0x58427d<_0x53b9f4[_0xfd26('0x3e')];_0x58427d+=0x1){_0x51271d[_0xfd26('0x46')](_0xfd26('0x4b'),{'FaxInteractionId':Number(_0x53b9f4[_0x58427d]),'UserId':Number(_0x5f5d51['id'])});}});}})[_0xfd26('0xd')](function(){if(_0xd6887===_0xfd26('0x44')){var _0x46310e=_[_0xfd26('0x16')](_0x5f5d51[_0xfd26('0x23')],'id');return _0x5f5d51['removeSmsInteractions'](_0x46310e)[_0xfd26('0xd')](function(){for(var _0x520023=0x0;_0x520023<_0x46310e[_0xfd26('0x3e')];_0x520023+=0x1){_0x51271d[_0xfd26('0x46')](_0xfd26('0x4c'),{'SmsInteractionId':Number(_0x46310e[_0x520023]),'UserId':Number(_0x5f5d51['id'])});}});}})['then'](function(){if(_0xd6887===_0xfd26('0x44')){var _0x2be44d=_[_0xfd26('0x16')](_0x5f5d51['OpenchannelInteractions'],'id');return _0x5f5d51[_0xfd26('0x4d')](_0x2be44d)[_0xfd26('0xd')](function(){for(var _0x1a327f=0x0;_0x1a327f<_0x2be44d[_0xfd26('0x3e')];_0x1a327f+=0x1){_0x51271d[_0xfd26('0x46')]('user_has_openchannel_interactions:remove',{'OpenchannelInteractionId':Number(_0x2be44d[_0x1a327f]),'UserId':Number(_0x5f5d51['id'])});}});}})[_0xfd26('0xd')](function(){if(_0xd6887===_0xfd26('0x44')){var _0x2dac48=_[_0xfd26('0x16')](_0x5f5d51[_0xfd26('0x27')],'id');return _0x5f5d51['removeWhatsappInteractions'](_0x2dac48)[_0xfd26('0xd')](function(){for(var _0x34a398=0x0;_0x34a398<_0x2dac48[_0xfd26('0x3e')];_0x34a398+=0x1){_0x51271d[_0xfd26('0x46')](_0xfd26('0x4e'),{'WhatsappInteractionId':Number(_0x2dac48[_0x34a398]),'UserId':Number(_0x5f5d51['id'])});}});}})[_0xfd26('0x4f')](function(_0xfa6181){_0xcf941a[_0xfd26('0x50')](_0xfa6181);});}}function onDisconnect(_0x26034c,_0x5c5bd7){joinOrLeave(_0x26034c,_0xfd26('0x44'),_0x5c5bd7);}function onConnect(_0x560f9f){joinOrLeave(_0x560f9f,_0xfd26('0x51'));}exports[_0xfd26('0x52')]=function(_0xe62ed7){_0xe62ed7['on'](_0xfd26('0x53'),function(_0xeb4427){_0xeb4427[_0xfd26('0x54')](0x0);_0xeb4427[_0xfd26('0x55')]=_0xeb4427[_0xfd26('0x56')][_0xfd26('0x53')][_0xfd26('0x57')]+':'+_0xeb4427['request'][_0xfd26('0x53')][_0xfd26('0x58')];_0xeb4427['connectedAt']=new Date();_0xeb4427['log']=function(_0x182811){console[_0xfd26('0x50')](_0xfd26('0x59')+_0xeb4427['nsp']['name']+'['+_0xeb4427[_0xfd26('0x55')]+']',_0x182811);};_0xeb4427['on']('disconnect',function(){onDisconnect(_0xeb4427,_0xe62ed7);_0xeb4427[_0xfd26('0x50')]('DISCONNECTED');});onConnect(_0xeb4427);_0xeb4427['log'](_0xfd26('0x5a'));});}; \ No newline at end of file diff --git a/server/config/triggers/index.js b/server/config/triggers/index.js index a1cb3cf..cefb851 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 _0xbf2d=['../../mysqldb','../logger','triggers','client','http','Chat','ChatInteraction','afterCreate','newinteraction','afterUpdate','closedinteraction','ChatMessage','newmessage','Sms','SmsInteraction','SmsMessage','Whatsapp','WhatsappInteraction','Fax','FaxInteraction','FaxMessage','Mail','MailInteraction','MailMessage','Openchannel','OpenchannelInteraction','OpenchannelMessage','request','EventManager','info','error','Trigger,\x20%s','catch','get','motionChannel','event','resolve','then','ContactId','undefined','SELECT\x20*\x20FROM\x20cm_contacts\x20WHERE\x20id\x20=\x20','sequelize','Sequelize','QueryTypes','SELECT','contact','UserId','interface','SIP/%s','name','agent','channel','outgoingmessage','AfterCreateMessage','offlineMessage','opened','format','AfterCreate','changed','closed','substatus','query','User','fullname','email','internal','default','length','hasOwnProperty','model','hook','callback','toLowerCase'];(function(_0x1d0745,_0x127107){var _0x146bc8=function(_0x3fa4e5){while(--_0x3fa4e5){_0x1d0745['push'](_0x1d0745['shift']());}};_0x146bc8(++_0x127107);}(_0xbf2d,0x16d));var _0xdbf2=function(_0x5a6360,_0x385c27){_0x5a6360=_0x5a6360-0x0;var _0x770b03=_0xbf2d[_0x5a6360];return _0x770b03;};'use strict';var util=require('util');var db=require(_0xdbf2('0x0'))['db'];var jayson=require('jayson/promise');var logger=require(_0xdbf2('0x1'))(_0xdbf2('0x2'));var client=jayson[_0xdbf2('0x3')][_0xdbf2('0x4')]({'port':0x232a});var triggers=[{'channel':_0xdbf2('0x5'),'model':_0xdbf2('0x6'),'event':_0xdbf2('0x7'),'condition':_0xdbf2('0x8'),'callback':afterCreate},{'channel':'Chat','model':'ChatInteraction','event':_0xdbf2('0x9'),'condition':_0xdbf2('0xa'),'callback':afterUpdate},{'channel':_0xdbf2('0x5'),'model':_0xdbf2('0xb'),'event':_0xdbf2('0x7'),'condition':_0xdbf2('0xc'),'callback':afterCreateMessage},{'channel':_0xdbf2('0x5'),'model':'ChatOfflineMessage','event':_0xdbf2('0x7'),'condition':'newmessage','callback':afterCreateOfflineMessage},{'channel':_0xdbf2('0xd'),'model':_0xdbf2('0xe'),'event':_0xdbf2('0x7'),'condition':_0xdbf2('0x8'),'callback':afterCreate},{'channel':_0xdbf2('0xd'),'model':_0xdbf2('0xe'),'event':_0xdbf2('0x9'),'condition':_0xdbf2('0xa'),'callback':afterUpdate},{'channel':_0xdbf2('0xd'),'model':_0xdbf2('0xf'),'event':_0xdbf2('0x7'),'condition':_0xdbf2('0xc'),'callback':afterCreateMessage},{'channel':_0xdbf2('0x10'),'model':_0xdbf2('0x11'),'event':'afterCreate','condition':_0xdbf2('0x8'),'callback':afterCreate},{'channel':_0xdbf2('0x10'),'model':_0xdbf2('0x11'),'event':_0xdbf2('0x9'),'condition':'closedinteraction','callback':afterUpdate},{'channel':_0xdbf2('0x10'),'model':'WhatsappMessage','event':_0xdbf2('0x7'),'condition':_0xdbf2('0xc'),'callback':afterCreateMessage},{'channel':_0xdbf2('0x12'),'model':_0xdbf2('0x13'),'event':_0xdbf2('0x7'),'condition':_0xdbf2('0x8'),'callback':afterCreate},{'channel':_0xdbf2('0x12'),'model':_0xdbf2('0x13'),'event':_0xdbf2('0x9'),'condition':_0xdbf2('0xa'),'callback':afterUpdate},{'channel':_0xdbf2('0x12'),'model':_0xdbf2('0x14'),'event':_0xdbf2('0x7'),'condition':_0xdbf2('0xc'),'callback':afterCreateMessage},{'channel':_0xdbf2('0x15'),'model':_0xdbf2('0x16'),'event':_0xdbf2('0x7'),'condition':_0xdbf2('0x8'),'callback':afterCreate},{'channel':_0xdbf2('0x15'),'model':_0xdbf2('0x16'),'event':_0xdbf2('0x9'),'condition':_0xdbf2('0xa'),'callback':afterUpdate},{'channel':_0xdbf2('0x15'),'model':_0xdbf2('0x17'),'event':_0xdbf2('0x7'),'condition':'newmessage','callback':afterCreateMessage},{'channel':_0xdbf2('0x18'),'model':_0xdbf2('0x19'),'event':_0xdbf2('0x7'),'condition':_0xdbf2('0x8'),'callback':afterCreate},{'channel':'Openchannel','model':_0xdbf2('0x19'),'event':'afterUpdate','condition':_0xdbf2('0xa'),'callback':afterUpdate},{'channel':_0xdbf2('0x18'),'model':_0xdbf2('0x1a'),'event':'afterCreate','condition':_0xdbf2('0xc'),'callback':afterCreateMessage}];function request(_0x21e5f9){return client[_0xdbf2('0x1b')](_0xdbf2('0x1c'),_0x21e5f9)['then'](function(_0x3d2eda){logger[_0xdbf2('0x1d')]('Trigger,\x20%s',_0xdbf2('0x1c'),_0x3d2eda);if(_0x3d2eda['error']){if(_0x3d2eda[_0xdbf2('0x1e')]['code']===0x1f4){logger[_0xdbf2('0x1e')](_0xdbf2('0x1f'),_0xdbf2('0x1c'),_0x3d2eda['error']);}}})[_0xdbf2('0x20')](function(_0x5eeb74){logger['error'](_0xdbf2('0x1f'),'EventManager',_0x5eeb74);});}function afterCreateMessage(_0x5cfa72){return function(_0x31ddec){_0x31ddec=_0x31ddec[_0xdbf2('0x21')]({'plain':!![]});_0x31ddec['channel']=_0x5cfa72;_0x31ddec[_0xdbf2('0x22')]=_0x5cfa72;_0x31ddec[_0xdbf2('0x23')]=_0x31ddec['direction'];Promise[_0xdbf2('0x24')]()[_0xdbf2('0x25')](function(){if(typeof _0x31ddec[_0xdbf2('0x26')]===_0xdbf2('0x27'))return null;var _0x4ad687=_0xdbf2('0x28')+_0x31ddec[_0xdbf2('0x26')];return db[_0xdbf2('0x29')]['query'](_0x4ad687,{'type':db[_0xdbf2('0x2a')][_0xdbf2('0x2b')][_0xdbf2('0x2c')],'raw':!![]});})[_0xdbf2('0x25')](function(_0x3230c3){if(_0x3230c3){_0x31ddec[_0xdbf2('0x2d')]=_0x3230c3[0x0];}if(typeof _0x31ddec[_0xdbf2('0x2e')]==='undefined')return;return getAgent(_0x31ddec[_0xdbf2('0x2e')]);})[_0xdbf2('0x25')](function(_0x460558){if(_0x460558){_0x31ddec[_0xdbf2('0x2f')]=util['format'](_0xdbf2('0x30'),_0x460558[_0xdbf2('0x31')]);_0x31ddec[_0xdbf2('0x32')]=_0x460558;_0x31ddec[_0xdbf2('0x33')]=_0x5cfa72;return request({'event':'incomingmessage','message':_0x31ddec});}else{return request({'event':_0xdbf2('0x34'),'message':_0x31ddec});}})[_0xdbf2('0x20')](function(_0x587d71){logger[_0xdbf2('0x1e')](_0xdbf2('0x1f'),_0xdbf2('0x35'),_0x587d71);});};}function afterCreateOfflineMessage(_0x3a6fa0){return function(_0x3b8f48){_0x3b8f48=_0x3b8f48[_0xdbf2('0x21')]({'plain':!![]});_0x3b8f48[_0xdbf2('0x33')]=_0x3a6fa0;_0x3b8f48[_0xdbf2('0x22')]=_0x3a6fa0;_0x3b8f48[_0xdbf2('0x23')]=_0xdbf2('0x36');return request({'event':_0x3b8f48[_0xdbf2('0x23')],'message':_0x3b8f48});};}function afterCreate(_0x2d1667,_0x20890){return function(_0xf61c2e){_0xf61c2e=_0xf61c2e[_0xdbf2('0x21')]({'plain':!![]});_0xf61c2e[_0xdbf2('0x33')]=_0x2d1667;_0xf61c2e[_0xdbf2('0x22')]=_0x2d1667;_0xf61c2e[_0xdbf2('0x23')]=_0xdbf2('0x37');Promise[_0xdbf2('0x24')]()[_0xdbf2('0x25')](function(){var _0x270caf=_0xdbf2('0x28')+_0xf61c2e['ContactId'];return db['sequelize']['query'](_0x270caf,{'type':db[_0xdbf2('0x2a')][_0xdbf2('0x2b')][_0xdbf2('0x2c')],'raw':!![]});})[_0xdbf2('0x25')](function(_0x112beb){if(_0x112beb){_0xf61c2e[_0xdbf2('0x2d')]=_0x112beb[0x0];}if(typeof _0xf61c2e[_0xdbf2('0x2e')]==='undefined')return;return getAgent(_0xf61c2e[_0xdbf2('0x2e')]);})[_0xdbf2('0x25')](function(_0x5d727b){if(_0x5d727b){_0xf61c2e[_0xdbf2('0x2f')]=util[_0xdbf2('0x38')]('SIP/%s',_0x5d727b[_0xdbf2('0x31')]);_0xf61c2e[_0xdbf2('0x32')]=_0x5d727b;}return request({'event':_0x20890,'message':_0xf61c2e});})[_0xdbf2('0x20')](function(_0x216114){logger[_0xdbf2('0x1e')]('Trigger,\x20%s',_0xdbf2('0x39'),_0x216114);});};}function afterUpdate(_0x1ed4ce){return function(_0x36275e){var _0x23b78e=_0x36275e[_0xdbf2('0x3a')]('closed')&&_0x36275e[_0xdbf2('0x3b')];var _0x430a8a=_0x36275e[_0xdbf2('0x3a')](_0xdbf2('0x3c'));if(_0x23b78e||_0x430a8a){var _0x33def4=_0x23b78e?_0xdbf2('0xa'):'substatus';var _0x530afe=_0x36275e['get']({'plain':!![]});_0x530afe[_0xdbf2('0x33')]=_0x1ed4ce;_0x530afe[_0xdbf2('0x22')]=_0x1ed4ce;_0x530afe['event']=_0x23b78e?'closed':'substatus';var _0x4e4dc0=_0xdbf2('0x28')+_0x530afe[_0xdbf2('0x26')];return db[_0xdbf2('0x29')][_0xdbf2('0x3d')](_0x4e4dc0,{'type':db[_0xdbf2('0x2a')]['QueryTypes'][_0xdbf2('0x2c')],'raw':!![]})['then'](function(_0x422313){if(_0x422313){_0x530afe[_0xdbf2('0x2d')]=_0x422313[0x0];}if(typeof _0x530afe[_0xdbf2('0x2e')]===_0xdbf2('0x27'))return;return getAgent(_0x530afe[_0xdbf2('0x2e')]);})['then'](function(_0x20cd8e){if(_0x20cd8e){_0x530afe[_0xdbf2('0x2f')]=util['format'](_0xdbf2('0x30'),_0x20cd8e[_0xdbf2('0x31')]);_0x530afe[_0xdbf2('0x32')]=_0x20cd8e;}return request({'event':_0x33def4,'message':_0x530afe});})[_0xdbf2('0x20')](function(_0x9bff1e){logger['error'](_0xdbf2('0x1f'),'AfterUpdate',_0x9bff1e);});}};}function getAgent(_0x37445a){return db[_0xdbf2('0x3e')]['find']({'where':{'id':_0x37445a},'attributes':['id',_0xdbf2('0x31'),_0xdbf2('0x3f'),_0xdbf2('0x40'),_0xdbf2('0x41')],'raw':!![]})[_0xdbf2('0x25')](function(_0x26c9ca){return _0x26c9ca;});}exports[_0xdbf2('0x42')]=function(){for(var _0x2d146c=0x0;_0x2d146c=_0x4a25e[_0x3e06('0x13')]){throw Error(_0x3e06('0x14'));}_0x42a4a7(_0x275703);})[_0x3e06('0x15')](function(_0x56cdb7){_0x28c390(_0x56cdb7);});});}; \ No newline at end of file +var _0x93a4=['Maximum\x20login\x20has\x20been\x20reached','bluebird','./license/util','voice','mail','sms','whatsapp','openchannel','isValidChannel','toLowerCase','clearBlockUser','isUndefined','updateAttributes','getLicense','role','agent','User','count','then'];(function(_0x5c950a,_0x60cbb5){var _0x406772=function(_0x1dc4d9){while(--_0x1dc4d9){_0x5c950a['push'](_0x5c950a['shift']());}};_0x406772(++_0x60cbb5);}(_0x93a4,0x99));var _0x493a=function(_0x1666c7,_0x54bb9a){_0x1666c7=_0x1666c7-0x0;var _0x341d90=_0x93a4[_0x1666c7];return _0x341d90;};'use strict';var _=require('lodash');var BPromise=require(_0x493a('0x0'));var db=require('../mysqldb')['db'];var util=require(_0x493a('0x1'));var channels=[_0x493a('0x2'),_0x493a('0x3'),'chat','fax',_0x493a('0x4'),_0x493a('0x5'),_0x493a('0x6')];exports['getChannels']=function(){return channels;};exports[_0x493a('0x7')]=function(_0x3d06f4){_0x3d06f4=_0x3d06f4[_0x493a('0x8')]();return _['includes'](channels,_0x3d06f4);};exports[_0x493a('0x9')]=function(_0x3faa75,_0x34fed7,_0x31d491,_0x507a42){var _0x52fad8={'loginAttempts':_0x34fed7,'blocked':_0x31d491};if(!_[_0x493a('0xa')](_0x507a42)){_0x52fad8['blockedAt']=_0x507a42;}return _0x3faa75[_0x493a('0xb')](_0x52fad8);};exports[_0x493a('0xc')]=function(_0x3a0bcf){return new BPromise(function(_0x1f809b,_0x1dee96){var _0x238369=0x0;if(_0x3a0bcf[_0x493a('0xd')]!==_0x493a('0xe')){_0x1f809b(_0x3a0bcf);}db[_0x493a('0xf')][_0x493a('0x10')]({'where':{'role':_0x493a('0xe'),'online':!![],'id':{'$ne':_0x3a0bcf['id']}}})['then'](function(_0x252210){_0x238369=_0x252210;return util[_0x493a('0xc')]();})[_0x493a('0x11')](function(_0xf3e982){if(_0xf3e982&&_0xf3e982['agents']&&_0x238369>=_0xf3e982['agents']){throw Error(_0x493a('0x12'));}_0x1f809b(_0x3a0bcf);})['catch'](function(_0x5966d1){_0x1dee96(_0x5966d1);});});}; \ No newline at end of file diff --git a/server/errors/api.js b/server/errors/api.js index 14ceefd..8a0a380 100644 --- a/server/errors/api.js +++ b/server/errors/api.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0xa870=['Bad\x20Request','Forbidden','Not\x20Found','Message\x20sent\x20outside\x20a\x20valid\x20interval','Out\x20Of\x20Interval','details','Resource\x20Conflict','Conflict','error','statusMessage','status','exports','util','../config/logger','api','message','Internal\x20Server\x20Error','name','Error','inherits'];(function(_0x44f274,_0x204885){var _0x2b5f73=function(_0x97da8a){while(--_0x97da8a){_0x44f274['push'](_0x44f274['shift']());}};_0x2b5f73(++_0x204885);}(_0xa870,0x174));var _0x0a87=function(_0xd2d4f2,_0x48883e){_0xd2d4f2=_0xd2d4f2-0x0;var _0x2006d9=_0xa870[_0xd2d4f2];return _0x2006d9;};'use strict';var util=require(_0x0a87('0x0'));var logger=require(_0x0a87('0x1'))(_0x0a87('0x2'));var APIError=function(_0x3c216c,_0x39f097){this[_0x0a87('0x3')]=_0x3c216c||_0x0a87('0x4');this[_0x0a87('0x5')]=_0x39f097||_0x0a87('0x6');util[_0x0a87('0x7')](APIError,Error);};var APIBadRequestError=function(_0x205167){this[_0x0a87('0x3')]=_0x205167||_0x0a87('0x8');this[_0x0a87('0x5')]='Bad\x20Request';util[_0x0a87('0x7')](APIBadRequestError,APIError);};var APIForbiddenError=function(_0x1a51d7){this['message']=_0x1a51d7||'Forbidden';this[_0x0a87('0x5')]=_0x0a87('0x9');util['inherits'](APIForbiddenError,APIError);};var APINotFoundError=function(_0x158d43){this[_0x0a87('0x3')]=_0x158d43||'Entity\x20not\x20found';this[_0x0a87('0x5')]=_0x0a87('0xa');util[_0x0a87('0x7')](APINotFoundError,APIError);};var APIOutOfIntervalError=function(_0x5bf7e2){this[_0x0a87('0x3')]=_0x5bf7e2||_0x0a87('0xb');this['name']=_0x0a87('0xc');this['code']=0x193;this[_0x0a87('0xd')]={'type':'OutOfInterval'};util[_0x0a87('0x7')](APIOutOfIntervalError,APIError);};var APIConflictError=function(_0x58b5df){this[_0x0a87('0x3')]=_0x58b5df||_0x0a87('0xe');this[_0x0a87('0x5')]=_0x0a87('0xf');util[_0x0a87('0x7')](APIBadRequestError,APIError);};function getStatusCode(_0x27b5fa){switch(_0x27b5fa){case _0x0a87('0x8'):return 0x190;case'Forbidden',_0x0a87('0xc'):return 0x193;case'Not\x20Found':return 0x194;case _0x0a87('0xf'):return 0x199;default:return 0x1f4;}}function getCustomStatusMessage(_0x17961e){if(_0x17961e===_0x0a87('0xc'))return _0x17961e;return null;}function handleError(_0x19e140){return function(_0x3c8330){logger[_0x0a87('0x10')](_0x3c8330['stack']);var _0x186ad0=getStatusCode(_0x3c8330[_0x0a87('0x5')]);var _0x280c85=getCustomStatusMessage(_0x3c8330[_0x0a87('0x5')]);if(_0x3c8330[_0x0a87('0x5')]){delete _0x3c8330['name'];}if(_0x280c85){_0x19e140[_0x0a87('0x11')]=_0x280c85;}return _0x19e140[_0x0a87('0x12')](_0x186ad0)['send'](_0x3c8330);};}module[_0x0a87('0x13')]={'APIError':APIError,'APIBadRequestError':APIBadRequestError,'APIForbiddenError':APIForbiddenError,'APINotFoundError':APINotFoundError,'APIOutOfIntervalError':APIOutOfIntervalError,'APIConflict':APIConflictError,'handleError':handleError}; \ No newline at end of file +var _0x411f=['Entity\x20not\x20found','Not\x20Found','Message\x20sent\x20outside\x20a\x20valid\x20interval','Out\x20Of\x20Interval','code','details','Resource\x20Conflict','Conflict','error','status','util','../config/logger','api','message','Internal\x20Server\x20Error','name','inherits','Bad\x20Request','Forbidden'];(function(_0x316c42,_0x3391f0){var _0x2b38f7=function(_0x38d2cf){while(--_0x38d2cf){_0x316c42['push'](_0x316c42['shift']());}};_0x2b38f7(++_0x3391f0);}(_0x411f,0x1bf));var _0xf411=function(_0x39f093,_0x52a5db){_0x39f093=_0x39f093-0x0;var _0xd93750=_0x411f[_0x39f093];return _0xd93750;};'use strict';var util=require(_0xf411('0x0'));var logger=require(_0xf411('0x1'))(_0xf411('0x2'));var APIError=function(_0x3ff13c,_0x252560){this[_0xf411('0x3')]=_0x3ff13c||_0xf411('0x4');this[_0xf411('0x5')]=_0x252560||'Error';util[_0xf411('0x6')](APIError,Error);};var APIBadRequestError=function(_0x256289){this[_0xf411('0x3')]=_0x256289||_0xf411('0x7');this['name']=_0xf411('0x7');util[_0xf411('0x6')](APIBadRequestError,APIError);};var APIForbiddenError=function(_0x1f7e2b){this['message']=_0x1f7e2b||_0xf411('0x8');this[_0xf411('0x5')]='Forbidden';util['inherits'](APIForbiddenError,APIError);};var APINotFoundError=function(_0x33c5fb){this['message']=_0x33c5fb||_0xf411('0x9');this[_0xf411('0x5')]=_0xf411('0xa');util[_0xf411('0x6')](APINotFoundError,APIError);};var APIOutOfIntervalError=function(_0x481e52){this[_0xf411('0x3')]=_0x481e52||_0xf411('0xb');this[_0xf411('0x5')]=_0xf411('0xc');this[_0xf411('0xd')]=0x193;this[_0xf411('0xe')]={'type':'OutOfInterval'};util['inherits'](APIOutOfIntervalError,APIError);};var APIConflictError=function(_0x52c918){this['message']=_0x52c918||_0xf411('0xf');this[_0xf411('0x5')]=_0xf411('0x10');util[_0xf411('0x6')](APIBadRequestError,APIError);};function getStatusCode(_0x513709){switch(_0x513709){case _0xf411('0x7'):return 0x190;case _0xf411('0x8'),_0xf411('0xc'):return 0x193;case _0xf411('0xa'):return 0x194;case _0xf411('0x10'):return 0x199;default:return 0x1f4;}}function getCustomStatusMessage(_0x3bcb3d){if(_0x3bcb3d===_0xf411('0xc'))return _0x3bcb3d;return null;}function handleError(_0x320ea7){return function(_0x553e69){logger[_0xf411('0x11')](_0x553e69['stack']);var _0x5d2afb=getStatusCode(_0x553e69[_0xf411('0x5')]);var _0x51e06f=getCustomStatusMessage(_0x553e69[_0xf411('0x5')]);if(_0x553e69[_0xf411('0x5')]){delete _0x553e69[_0xf411('0x5')];}if(_0x51e06f){_0x320ea7['statusMessage']=_0x51e06f;}return _0x320ea7[_0xf411('0x12')](_0x5d2afb)['send'](_0x553e69);};}module['exports']={'APIError':APIError,'APIBadRequestError':APIBadRequestError,'APIForbiddenError':APIForbiddenError,'APINotFoundError':APINotFoundError,'APIOutOfIntervalError':APIOutOfIntervalError,'APIConflict':APIConflictError,'handleError':handleError}; \ No newline at end of file diff --git a/server/errors/index.js b/server/errors/index.js index c404190..7d430dc 100644 --- a/server/errors/index.js +++ b/server/errors/index.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0xb477=['render','send','status'];(function(_0x5372cf,_0x550796){var _0x30443a=function(_0x3a983){while(--_0x3a983){_0x5372cf['push'](_0x5372cf['shift']());}};_0x30443a(++_0x550796);}(_0xb477,0x8f));var _0x7b47=function(_0x5d2803,_0xf375bd){_0x5d2803=_0x5d2803-0x0;var _0xdcad2c=_0xb477[_0x5d2803];return _0xdcad2c;};'use strict';module['exports'][0x194]=function pageNotFound(_0x185574,_0x12a8af){var _0x96d22d='404';var _0x110b50=0x194;var _0x21cd06={'status':_0x110b50};_0x12a8af[_0x7b47('0x0')](_0x21cd06['status']);_0x12a8af[_0x7b47('0x1')](_0x96d22d,{},function(_0x1c3e88,_0x125ce6){if(_0x1c3e88){return _0x12a8af[_0x7b47('0x0')](_0x21cd06[_0x7b47('0x0')])['json'](_0x21cd06);}_0x12a8af[_0x7b47('0x2')](_0x125ce6);});}; \ No newline at end of file +var _0x9c28=['status','send','exports','404'];(function(_0x36b444,_0x505b35){var _0x786323=function(_0x146af0){while(--_0x146af0){_0x36b444['push'](_0x36b444['shift']());}};_0x786323(++_0x505b35);}(_0x9c28,0x1f2));var _0x89c2=function(_0x34edce,_0x4cbe16){_0x34edce=_0x34edce-0x0;var _0x534068=_0x9c28[_0x34edce];return _0x534068;};'use strict';module[_0x89c2('0x0')][0x194]=function pageNotFound(_0x2d154c,_0x397222){var _0x4e4651=_0x89c2('0x1');var _0x5bb8a3=0x194;var _0x378ce3={'status':_0x5bb8a3};_0x397222[_0x89c2('0x2')](_0x378ce3[_0x89c2('0x2')]);_0x397222['render'](_0x4e4651,{},function(_0x236bad,_0x404665){if(_0x236bad){return _0x397222[_0x89c2('0x2')](_0x378ce3[_0x89c2('0x2')])['json'](_0x378ce3);}_0x397222[_0x89c2('0x3')](_0x404665);});}; \ No newline at end of file diff --git a/server/mysqldb/index.js b/server/mysqldb/index.js index 8147b00..00c106c 100644 --- a/server/mysqldb/index.js +++ b/server/mysqldb/index.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x0e3e=['../api/intFreshdeskAccount/intFreshdeskAccount.model','FreshdeskConfiguration','../api/intFreshdeskConfiguration/intFreshdeskConfiguration.model','../api/intFreshdeskField/intFreshdeskField.model','VtigerAccount','../api/intVtigerAccount/intVtigerAccount.model','../api/intVtigerConfiguration/intVtigerConfiguration.model','VtigerField','../api/intVtigerField/intVtigerField.model','ServicenowAccount','../api/intServicenowAccount/intServicenowAccount.model','../api/intServicenowConfiguration/intServicenowConfiguration.model','ServicenowField','../api/intServicenowField/intServicenowField.model','Dynamics365Account','../api/intDynamics365Account/intDynamics365Account.model','../api/intDynamics365Configuration/intDynamics365Configuration.model','Dynamics365Field','../api/intDynamics365Field/intDynamics365Field.model','FreshsalesAccount','../api/intFreshsalesAccount/intFreshsalesAccount.model','FreshsalesConfiguration','../api/intFreshsalesConfiguration/intFreshsalesConfiguration.model','FreshsalesField','../api/intFreshsalesField/intFreshsalesField.model','Network','ChatQueueReport','../api/chatQueueReport/chatQueueReport.model','ChatInternalMessage','../api/chatInternalMessage/chatInternalMessage.model','JscriptyAnswerReport','../api/jscriptyAnswerReport/jscriptyAnswerReport.model','JscriptyQuestionReport','../api/jscriptyQuestionReport/jscriptyQuestionReport.model','../api/jscriptySessionReport/jscriptySessionReport.model','SmsQueueReport','SquareReport','JscriptyProject','../api/jscriptyProject/jscriptyProject.model','Setting','SquareOdbc','../api/squareOdbc/squareOdbc.model','SquareRecording','SquareMessage','Team','../api/team/team.model','License','../api/license/license.model','Campaign','../api/campaign/campaign.model','../api/migration/migration.model','../api/attachment/attachment.model','MailTransferReport','../api/mailTransferReport/mailTransferReport.model','ChatTransferReport','../api/chatTransferReport/chatTransferReport.model','FaxTransferReport','OpenchannelTransferReport','../api/openchannelTransferReport/openchannelTransferReport.model','../api/smsTransferReport/smsTransferReport.model','VoicePrefix','../api/voicePrefix/voicePrefix.model','UserProfileSection','UserProfileResource','../api/userProfileResource/userProfileResource.model','UserNotification','WhatsappAccount','../api/whatsappAccount/whatsappAccount.model','WhatsappInteraction','WhatsappMessage','../api/whatsappMessage/whatsappMessage.model','WhatsappTransferReport','../api/whatsappTransferReport/whatsappTransferReport.model','WhatsappQueue','CloudProvider','../api/cloudProvider/cloudProvider.model','TeamVoiceQueue','../api/teamVoiceQueue/teamVoiceQueue.model','TeamVoicePrefix','../api/teamVoicePrefix/teamVoicePrefix.model','UserVoicePrefix','../api/userVoicePrefix/userVoicePrefix.model','UserSetting','../api/user-setting/user-setting.model','MailInteractionHasTag','UserId','hasOne','userSetting','hasMany','Recordings','VoiceQueuesRt','VoiceExtension','Extensions','cascade','CmHopperFinal','HopperFinals','OpenchannelInteractions','ChatInteractions','SmsInteraction','FaxInteraction','FaxInteractions','MailInteractions','WhatsappInteractions','UserNotifications','SenderId','SET\x20NULL','UserProfile','userProfileId','belongsToMany','Groups','chat_group_has_users','CmContact','Contacts','CmList','cm_user_has_lists','user_has_mail_interactions','user_has_chat_interactions','SmsInteractions','user_has_sms_interactions','OpenchannelInteraction','user_has_openchannel_interactions','VoiceQueues','VoicePrefixes','MailQueues','UserMailQueue','ChatQueues','FaxQueues','UserFaxQueue','OpenchannelQueues','UserOpenchannelQueue','WhatsappQueues','UserWhatsappQueue','ChatWebsites','FaxAccounts','user_has_fax_accounts','user_has_mail_accounts','OpenchannelAccounts','user_has_openchannel_accounts','SmsAccounts','user_has_sms_accounts','user_has_whatsapp_accounts','VoiceChanSpy','SpiedAgents','ChanSpyId','Applications','Sounds','moh_has_sounds','VoiceQueue','Members','VoiceQueueId','HopperBlacks','JscriptySessionReport','belongsTo','TrunkId','TrunkBackup','IntervalId','mandatoryDispositionPause','mandatoryDispositionPauseId','Agents','Teams','BlackLists','voice_queues_has_cm_blacklists','mailboxuser','mailbox','QueueCalls','uniqueid','VoiceCallReport','AgentReports','Contact','ContactId','MailAccountId','restrict','CloudProviderId','Smtp','Messages','List','ListId','team_has_mail_queues','MailInteractionId','Account','Owner','Tags','mail_interaction_has_tags','ThroughTags','Attachment','Interaction','ChatWebsiteId','TagId','Items','Disposition','Dispositions','FaxAccountId','FaxInteractionId','fax_interaction_has_tags','Users','user_has_fax_interactions','AttachmentId','team_has_fax_queues','SmsAccountId','Answers','SmsInteractionId','sms_interaction_has_tags','UserSmsQueue','SmsQueueId','OpenchannelAccountId','Interactions','OpenchannelApplication','OpenchannelInteractionId','openchannel_interaction_has_tags','OpenchannelQueueId','team_has_openchannel_queues','ProactiveActions','ChatMessage','user_has_chat_websites','Agent','Queue','ChatQueueId','chat_interaction_has_tags','ChatInteractionId','Attachments','ChatOfflineMessageId','team_has_chat_queues','ChatGroupId','Website','CompanyId','Phones','CmContactId','Hoppers','HopperHistories','JscriptySessions','Company','cm_user_has_contacts','cm_contact_has_tags','AdditionalPhones','CmHopperId','CampaignId','OwnerId','All','OneAll','Any','AutomationAnyId','Action','Actions','AutomationId','MailApplications','ChatApplications','FaxApplications','DefaultReportId','CustomReportId','Mohs','ItemType','ItemTypeId','Hopper','AllConditions','AllCondition','TriggerAllId','AnyCondition','TriggerAnyId','TriggerId','Fields','MetricId','Configurations','AccountId','SalesforceField','Subjects','Descriptions','DescriptionId','SubjectId','Description','Field','FieldId','int_desk_configuration_has_tags','Subject','VariableId','ZohoField','ZendeskAccount','int_zendesk_configuration_has_tags','FreshdeskField','int_freshdesk_configuration_has_tags','VtigerConfiguration','ServicenowConfiguration','Dynamics365Configuration','FromId','SessionId','ProjectId','user_has_teams','team_has_sms_queues','TrunkBackupId','SquareProject','Lists','campaigns_has_cm_blacklists','FromMailAccountId','FromUserId','FromAgent','ToUserId','ToAgent','ToMailQueueId','ToQueue','ToMailAccountId','ToAccount','FromChatWebsiteId','FromAccount','ToChatQueueId','ToChatWebsiteId','FromFaxAccountId','ToFaxQueueId','FromOpenchannelAccountId','ToOpenchannelQueueId','ToOpenchannelAccountId','SmsTransferReport','FromSmsAccountId','ToSmsAccountId','CmCustomField','HopperHistory','Resources','WhatsappAccountId','WhatsappApplication','whatsapp_interaction_has_tags','WhatsappInteractionId','WhatsappQueueReport','ToQueueId','WhatsappQueueId','team_has_whatsapp_queues','../config/environment','sequelize','lodash','jstz','determine','defaultsDeep','xcall','127.0.0.1','mysql','utf8mb4','name','utf8','utf8_general_ci','sequelizeHistory','motion2','database','username','password','options','User','import','../api/user/user.model','../api/voiceChanSpy/voiceChanSpy.model','VoiceContext','../api/voiceContext/voiceContext.model','VoiceMusicOnHold','../api/voiceMusicOnHold/voiceMusicOnHold.model','../api/voiceQueue/voiceQueue.model','VoiceRecording','../api/voiceRecording/voiceRecording.model','ScreenRecording','../api/screenRecording/screenRecording.model','VoiceMail','../api/voiceMail/voiceMail.model','VoiceMailMessage','../api/voiceMailMessage/voiceMailMessage.model','../api/voiceCallReport/voiceCallReport.model','VoiceDialReport','../api/voiceDialReport/voiceDialReport.model','VoiceAgentReport','../api/voiceAgentReport/voiceAgentReport.model','MemberReport','../api/memberReport/memberReport.model','Trunk','../api/voiceTransferReport/voiceTransferReport.model','UserVoiceQueueRt','UserVoiceQueue','../api/userVoiceQueue/userVoiceQueue.model','UserChatQueue','../api/userChatQueue/userChatQueue.model','../api/userMailQueue/userMailQueue.model','../api/userOpenchannelQueue/userOpenchannelQueue.model','MailServerIn','../api/mailServerIn/mailServerIn.model','MailServerOut','../api/mailServerOut/mailServerOut.model','MailAccount','../api/mailAccount/mailAccount.model','MailQueue','../api/mailQueue/mailQueue.model','MailSubstatus','../api/mailSubstatus/mailSubstatus.model','MailInteraction','../api/mailInteraction/mailInteraction.model','MailMessage','../api/mailMessage/mailMessage.model','MailApplication','MailQueueReport','../api/mailQueueReport/mailQueueReport.model','Dashboard','../api/dashboard/dashboard.model','FaxAccount','FaxApplication','../api/faxInteraction/faxInteraction.model','FaxMessage','../api/faxMessage/faxMessage.model','FaxQueue','FaxQueueReport','../api/faxQueueReport/faxQueueReport.model','SmsAccount','../api/smsAccount/smsAccount.model','SmsApplication','../api/smsApplication/smsApplication.model','SmsMessage','../api/smsMessage/smsMessage.model','SmsQueue','OpenchannelAccount','../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','../api/chatApplication/chatApplication.model','ChatInteraction','../api/chatMessage/chatMessage.model','ChatOfflineMessage','../api/chatOfflineMessage/chatOfflineMessage.model','ChatQueue','../api/chatQueue/chatQueue.model','ChatGroup','../api/chatGroup/chatGroup.model','ChatProactiveAction','../api/chatProactiveAction/chatProactiveAction.model','CmCompany','../api/cmContact/cmContact.model','CmHopper','../api/cmHopper/cmHopper.model','CmHopperBlack','../api/cmHopperBlack/cmHopperBlack.model','../api/cmHopperFinal/cmHopperFinal.model','CmHopperHistory','../api/cmHopperHistory/cmHopperHistory.model','ReportAgentPreview','../api/reportAgentPreview/reportAgentPreview.model','../api/cmCustomField/cmCustomField.model','Automation','../api/automation/automation.model','CannedAnswer','../api/disposition/disposition.model','Condition','../api/condition/condition.model','Interval','../api/interval/interval.model','Pause','Cdr','VoiceQueuesLog','../api/voiceQueuesLog/voiceQueuesLog.model','Schedule','Sound','../api/sound/sound.model','Tag','../api/tag/tag.model','ContactItemType','CmContactHasItem','../api/cmContactHasItem/cmContactHasItem.model','CmHopperAdditionalPhone','../api/cmHopperAdditionalPhone/cmHopperAdditionalPhone.model','Template','../api/template/template.model','Trigger','Variable','Integration','IntegrationReport','../api/integrationReport/integrationReport.model','AnalyticCustomReport','AnalyticDefaultReport','../api/analyticDefaultReport/analyticDefaultReport.model','AnalyticExtractedReport','../api/analyticExtractedReport/analyticExtractedReport.model','AnalyticMetric','../api/analyticMetric/analyticMetric.model','AnalyticFieldReport','../api/analyticFieldReport/analyticFieldReport.model','AnalyticTreeReport','SalesforceAccount','SalesforceConfiguration','../api/intSalesforceConfiguration/intSalesforceConfiguration.model','SugarcrmAccount','SugarcrmConfiguration','SugarcrmField','../api/intSugarcrmField/intSugarcrmField.model','DeskConfiguration','DeskField','../api/intDeskField/intDeskField.model','ZohoAccount','../api/intZohoAccount/intZohoAccount.model','ZohoConfiguration','../api/intZohoConfiguration/intZohoConfiguration.model','../api/intZendeskAccount/intZendeskAccount.model','ZendeskConfiguration','../api/intZendeskConfiguration/intZendeskConfiguration.model','ZendeskField','FreshdeskAccount'];(function(_0x2b543b,_0x5801fa){var _0x45bed7=function(_0x4f3c55){while(--_0x4f3c55){_0x2b543b['push'](_0x2b543b['shift']());}};_0x45bed7(++_0x5801fa);}(_0x0e3e,0x143));var _0xe0e3=function(_0x28ad97,_0x488ddd){_0x28ad97=_0x28ad97-0x0;var _0x209ff6=_0x0e3e[_0x28ad97];return _0x209ff6;};'use strict';var config=require(_0xe0e3('0x0'));var Sequelize=require(_0xe0e3('0x1'));var _=require(_0xe0e3('0x2'));var jstz=require(_0xe0e3('0x3'));var timezone=jstz[_0xe0e3('0x4')]();config[_0xe0e3('0x1')]=_[_0xe0e3('0x5')](config[_0xe0e3('0x1')],{'database':'motion2','username':_0xe0e3('0x6'),'password':'xC@LL1234','options':{'host':_0xe0e3('0x7'),'port':0xcea,'dialect':_0xe0e3('0x8'),'dialectOptions':{'charset':_0xe0e3('0x9')},'logging':![],'timezone':timezone[_0xe0e3('0xa')](),'define':{'charset':_0xe0e3('0xb'),'collate':_0xe0e3('0xc')}}});config[_0xe0e3('0xd')]=_[_0xe0e3('0x5')](config[_0xe0e3('0xd')],{'database':_0xe0e3('0xe'),'username':_0xe0e3('0x6'),'password':'xC@LL1234','options':{'host':'127.0.0.1','port':0xcea,'dialect':_0xe0e3('0x8'),'dialectOptions':{'charset':_0xe0e3('0x9')},'logging':![],'timezone':timezone[_0xe0e3('0xa')](),'define':{'charset':_0xe0e3('0xb'),'collate':_0xe0e3('0xc')}}});var db={'Sequelize':Sequelize,'sequelize':new Sequelize(config[_0xe0e3('0x1')][_0xe0e3('0xf')],config[_0xe0e3('0x1')][_0xe0e3('0x10')],config[_0xe0e3('0x1')][_0xe0e3('0x11')],config[_0xe0e3('0x1')][_0xe0e3('0x12')])};var dbH={'Sequelize':Sequelize,'sequelize':new Sequelize(config['sequelizeHistory'][_0xe0e3('0xf')],config[_0xe0e3('0xd')]['username'],config[_0xe0e3('0xd')][_0xe0e3('0x11')],config[_0xe0e3('0xd')][_0xe0e3('0x12')])};db[_0xe0e3('0x13')]=db[_0xe0e3('0x1')][_0xe0e3('0x14')](_0xe0e3('0x15'));db['VoiceChanSpy']=db[_0xe0e3('0x1')][_0xe0e3('0x14')](_0xe0e3('0x16'));db[_0xe0e3('0x17')]=db[_0xe0e3('0x1')]['import'](_0xe0e3('0x18'));db['VoiceExtension']=db[_0xe0e3('0x1')][_0xe0e3('0x14')]('../api/voiceExtension/voiceExtension.model');db[_0xe0e3('0x19')]=db['sequelize'][_0xe0e3('0x14')](_0xe0e3('0x1a'));db['VoiceQueue']=db[_0xe0e3('0x1')][_0xe0e3('0x14')](_0xe0e3('0x1b'));db[_0xe0e3('0x1c')]=db[_0xe0e3('0x1')]['import'](_0xe0e3('0x1d'));db[_0xe0e3('0x1e')]=db[_0xe0e3('0x1')][_0xe0e3('0x14')](_0xe0e3('0x1f'));db[_0xe0e3('0x20')]=db[_0xe0e3('0x1')][_0xe0e3('0x14')](_0xe0e3('0x21'));db[_0xe0e3('0x22')]=db[_0xe0e3('0x1')][_0xe0e3('0x14')](_0xe0e3('0x23'));db['VoiceCallReport']=db['sequelize'][_0xe0e3('0x14')](_0xe0e3('0x24'));db[_0xe0e3('0x25')]=db[_0xe0e3('0x1')]['import'](_0xe0e3('0x26'));db[_0xe0e3('0x27')]=db['sequelize'][_0xe0e3('0x14')](_0xe0e3('0x28'));db['VoiceQueueReport']=db[_0xe0e3('0x1')][_0xe0e3('0x14')]('../api/voiceQueueReport/voiceQueueReport.model');db[_0xe0e3('0x29')]=db[_0xe0e3('0x1')][_0xe0e3('0x14')](_0xe0e3('0x2a'));db[_0xe0e3('0x2b')]=db[_0xe0e3('0x1')][_0xe0e3('0x14')]('../api/trunk/trunk.model');db['VoiceTransferReport']=db['sequelize']['import'](_0xe0e3('0x2c'));db[_0xe0e3('0x2d')]=db[_0xe0e3('0x1')][_0xe0e3('0x14')]('../api/userVoiceQueueRt/userVoiceQueueRt.model');db[_0xe0e3('0x2e')]=db[_0xe0e3('0x1')]['import'](_0xe0e3('0x2f'));db[_0xe0e3('0x30')]=db['sequelize'][_0xe0e3('0x14')](_0xe0e3('0x31'));db['UserMailQueue']=db['sequelize'][_0xe0e3('0x14')](_0xe0e3('0x32'));db['UserFaxQueue']=db[_0xe0e3('0x1')]['import']('../api/userFaxQueue/userFaxQueue.model');db['UserSmsQueue']=db[_0xe0e3('0x1')][_0xe0e3('0x14')]('../api/userSmsQueue/userSmsQueue.model');db['UserOpenchannelQueue']=db['sequelize'][_0xe0e3('0x14')](_0xe0e3('0x33'));db['UserWhatsappQueue']=db[_0xe0e3('0x1')][_0xe0e3('0x14')]('../api/userWhatsappQueue/userWhatsappQueue.model');db[_0xe0e3('0x34')]=db[_0xe0e3('0x1')][_0xe0e3('0x14')](_0xe0e3('0x35'));db[_0xe0e3('0x36')]=db[_0xe0e3('0x1')]['import'](_0xe0e3('0x37'));db[_0xe0e3('0x38')]=db[_0xe0e3('0x1')][_0xe0e3('0x14')](_0xe0e3('0x39'));db[_0xe0e3('0x3a')]=db['sequelize'][_0xe0e3('0x14')](_0xe0e3('0x3b'));db[_0xe0e3('0x3c')]=db['sequelize']['import'](_0xe0e3('0x3d'));db[_0xe0e3('0x3e')]=db[_0xe0e3('0x1')][_0xe0e3('0x14')](_0xe0e3('0x3f'));db[_0xe0e3('0x40')]=db[_0xe0e3('0x1')][_0xe0e3('0x14')](_0xe0e3('0x41'));db[_0xe0e3('0x42')]=db['sequelize']['import']('../api/mailApplication/mailApplication.model');db[_0xe0e3('0x43')]=db[_0xe0e3('0x1')]['import'](_0xe0e3('0x44'));db[_0xe0e3('0x45')]=db[_0xe0e3('0x1')][_0xe0e3('0x14')](_0xe0e3('0x46'));db['DashboardItem']=db[_0xe0e3('0x1')][_0xe0e3('0x14')]('../api/dashboardItem/dashboardItem.model');db[_0xe0e3('0x47')]=db[_0xe0e3('0x1')][_0xe0e3('0x14')]('../api/faxAccount/faxAccount.model');db[_0xe0e3('0x48')]=db['sequelize'][_0xe0e3('0x14')]('../api/faxApplication/faxApplication.model');db['FaxInteraction']=db[_0xe0e3('0x1')][_0xe0e3('0x14')](_0xe0e3('0x49'));db[_0xe0e3('0x4a')]=db[_0xe0e3('0x1')][_0xe0e3('0x14')](_0xe0e3('0x4b'));db[_0xe0e3('0x4c')]=db['sequelize'][_0xe0e3('0x14')]('../api/faxQueue/faxQueue.model');db[_0xe0e3('0x4d')]=db[_0xe0e3('0x1')][_0xe0e3('0x14')](_0xe0e3('0x4e'));db[_0xe0e3('0x4f')]=db[_0xe0e3('0x1')]['import'](_0xe0e3('0x50'));db[_0xe0e3('0x51')]=db['sequelize'][_0xe0e3('0x14')](_0xe0e3('0x52'));db['SmsInteraction']=db[_0xe0e3('0x1')][_0xe0e3('0x14')]('../api/smsInteraction/smsInteraction.model');db[_0xe0e3('0x53')]=db[_0xe0e3('0x1')]['import'](_0xe0e3('0x54'));db[_0xe0e3('0x55')]=db[_0xe0e3('0x1')][_0xe0e3('0x14')]('../api/smsQueue/smsQueue.model');db[_0xe0e3('0x56')]=db['sequelize'][_0xe0e3('0x14')]('../api/openchannelAccount/openchannelAccount.model');db['OpenchannelApplication']=db['sequelize'][_0xe0e3('0x14')](_0xe0e3('0x57'));db['OpenchannelInteraction']=db[_0xe0e3('0x1')][_0xe0e3('0x14')](_0xe0e3('0x58'));db[_0xe0e3('0x59')]=db['sequelize'][_0xe0e3('0x14')](_0xe0e3('0x5a'));db[_0xe0e3('0x5b')]=db['sequelize'][_0xe0e3('0x14')](_0xe0e3('0x5c'));db[_0xe0e3('0x5d')]=db[_0xe0e3('0x1')][_0xe0e3('0x14')]('../api/chatWebsite/chatWebsite.model');db[_0xe0e3('0x5e')]=db[_0xe0e3('0x1')][_0xe0e3('0x14')](_0xe0e3('0x5f'));db[_0xe0e3('0x60')]=db[_0xe0e3('0x1')][_0xe0e3('0x14')](_0xe0e3('0x61'));db[_0xe0e3('0x62')]=db[_0xe0e3('0x1')][_0xe0e3('0x14')]('../api/chatInteraction/chatInteraction.model');db['ChatMessage']=db[_0xe0e3('0x1')][_0xe0e3('0x14')](_0xe0e3('0x63'));db[_0xe0e3('0x64')]=db['sequelize'][_0xe0e3('0x14')](_0xe0e3('0x65'));db[_0xe0e3('0x66')]=db[_0xe0e3('0x1')]['import'](_0xe0e3('0x67'));db[_0xe0e3('0x68')]=db[_0xe0e3('0x1')][_0xe0e3('0x14')](_0xe0e3('0x69'));db[_0xe0e3('0x6a')]=db[_0xe0e3('0x1')][_0xe0e3('0x14')](_0xe0e3('0x6b'));db[_0xe0e3('0x6c')]=db['sequelize'][_0xe0e3('0x14')]('../api/cmCompany/cmCompany.model');db['CmContact']=db[_0xe0e3('0x1')][_0xe0e3('0x14')](_0xe0e3('0x6d'));db[_0xe0e3('0x6e')]=db['sequelize'][_0xe0e3('0x14')](_0xe0e3('0x6f'));db[_0xe0e3('0x70')]=db[_0xe0e3('0x1')][_0xe0e3('0x14')](_0xe0e3('0x71'));db['CmHopperFinal']=db[_0xe0e3('0x1')][_0xe0e3('0x14')](_0xe0e3('0x72'));db[_0xe0e3('0x73')]=db['sequelize'][_0xe0e3('0x14')](_0xe0e3('0x74'));db[_0xe0e3('0x75')]=db[_0xe0e3('0x1')][_0xe0e3('0x14')](_0xe0e3('0x76'));db['CmCustomField']=db[_0xe0e3('0x1')]['import'](_0xe0e3('0x77'));db['Action']=db[_0xe0e3('0x1')][_0xe0e3('0x14')]('../api/action/action.model');db[_0xe0e3('0x78')]=db[_0xe0e3('0x1')][_0xe0e3('0x14')](_0xe0e3('0x79'));db[_0xe0e3('0x7a')]=db[_0xe0e3('0x1')]['import']('../api/cannedAnswer/cannedAnswer.model');db['Disposition']=db[_0xe0e3('0x1')]['import'](_0xe0e3('0x7b'));db[_0xe0e3('0x7c')]=db[_0xe0e3('0x1')]['import'](_0xe0e3('0x7d'));db[_0xe0e3('0x7e')]=db['sequelize'][_0xe0e3('0x14')](_0xe0e3('0x7f'));db[_0xe0e3('0x80')]=db[_0xe0e3('0x1')]['import']('../api/pause/pause.model');db[_0xe0e3('0x81')]=db['sequelize'][_0xe0e3('0x14')]('../api/cdr/cdr.model');db[_0xe0e3('0x82')]=db['sequelize'][_0xe0e3('0x14')](_0xe0e3('0x83'));db[_0xe0e3('0x84')]=db[_0xe0e3('0x1')][_0xe0e3('0x14')]('../api/schedule/schedule.model');db[_0xe0e3('0x85')]=db['sequelize'][_0xe0e3('0x14')](_0xe0e3('0x86'));db[_0xe0e3('0x87')]=db[_0xe0e3('0x1')][_0xe0e3('0x14')](_0xe0e3('0x88'));db[_0xe0e3('0x89')]=db[_0xe0e3('0x1')]['import']('../api/contactItemType/contactItemType.model');db[_0xe0e3('0x8a')]=db[_0xe0e3('0x1')][_0xe0e3('0x14')](_0xe0e3('0x8b'));db[_0xe0e3('0x8c')]=db[_0xe0e3('0x1')][_0xe0e3('0x14')](_0xe0e3('0x8d'));db[_0xe0e3('0x8e')]=db['sequelize']['import'](_0xe0e3('0x8f'));db[_0xe0e3('0x90')]=db['sequelize']['import']('../api/trigger/trigger.model');db[_0xe0e3('0x91')]=db[_0xe0e3('0x1')][_0xe0e3('0x14')]('../api/variable/variable.model');db[_0xe0e3('0x92')]=db[_0xe0e3('0x1')][_0xe0e3('0x14')]('../api/integration/integration.model');db[_0xe0e3('0x93')]=db[_0xe0e3('0x1')]['import'](_0xe0e3('0x94'));db[_0xe0e3('0x95')]=db[_0xe0e3('0x1')][_0xe0e3('0x14')]('../api/analyticCustomReport/analyticCustomReport.model');db[_0xe0e3('0x96')]=db[_0xe0e3('0x1')][_0xe0e3('0x14')](_0xe0e3('0x97'));db[_0xe0e3('0x98')]=db[_0xe0e3('0x1')][_0xe0e3('0x14')](_0xe0e3('0x99'));db[_0xe0e3('0x9a')]=db[_0xe0e3('0x1')]['import'](_0xe0e3('0x9b'));db[_0xe0e3('0x9c')]=db['sequelize'][_0xe0e3('0x14')](_0xe0e3('0x9d'));db[_0xe0e3('0x9e')]=db[_0xe0e3('0x1')][_0xe0e3('0x14')]('../api/analyticTreeReport/analyticTreeReport.model');db[_0xe0e3('0x9f')]=db[_0xe0e3('0x1')][_0xe0e3('0x14')]('../api/intSalesforceAccount/intSalesforceAccount.model');db[_0xe0e3('0xa0')]=db[_0xe0e3('0x1')][_0xe0e3('0x14')](_0xe0e3('0xa1'));db['SalesforceField']=db['sequelize']['import']('../api/intSalesforceField/intSalesforceField.model');db[_0xe0e3('0xa2')]=db[_0xe0e3('0x1')][_0xe0e3('0x14')]('../api/intSugarcrmAccount/intSugarcrmAccount.model');db[_0xe0e3('0xa3')]=db['sequelize'][_0xe0e3('0x14')]('../api/intSugarcrmConfiguration/intSugarcrmConfiguration.model');db[_0xe0e3('0xa4')]=db[_0xe0e3('0x1')][_0xe0e3('0x14')](_0xe0e3('0xa5'));db['DeskAccount']=db[_0xe0e3('0x1')][_0xe0e3('0x14')]('../api/intDeskAccount/intDeskAccount.model');db[_0xe0e3('0xa6')]=db[_0xe0e3('0x1')][_0xe0e3('0x14')]('../api/intDeskConfiguration/intDeskConfiguration.model');db[_0xe0e3('0xa7')]=db['sequelize']['import'](_0xe0e3('0xa8'));db[_0xe0e3('0xa9')]=db['sequelize'][_0xe0e3('0x14')](_0xe0e3('0xaa'));db[_0xe0e3('0xab')]=db[_0xe0e3('0x1')][_0xe0e3('0x14')](_0xe0e3('0xac'));db['ZohoField']=db[_0xe0e3('0x1')][_0xe0e3('0x14')]('../api/intZohoField/intZohoField.model');db['ZendeskAccount']=db[_0xe0e3('0x1')][_0xe0e3('0x14')](_0xe0e3('0xad'));db[_0xe0e3('0xae')]=db['sequelize'][_0xe0e3('0x14')](_0xe0e3('0xaf'));db[_0xe0e3('0xb0')]=db[_0xe0e3('0x1')]['import']('../api/intZendeskField/intZendeskField.model');db[_0xe0e3('0xb1')]=db[_0xe0e3('0x1')][_0xe0e3('0x14')](_0xe0e3('0xb2'));db[_0xe0e3('0xb3')]=db[_0xe0e3('0x1')]['import'](_0xe0e3('0xb4'));db['FreshdeskField']=db[_0xe0e3('0x1')][_0xe0e3('0x14')](_0xe0e3('0xb5'));db[_0xe0e3('0xb6')]=db['sequelize']['import'](_0xe0e3('0xb7'));db['VtigerConfiguration']=db[_0xe0e3('0x1')][_0xe0e3('0x14')](_0xe0e3('0xb8'));db[_0xe0e3('0xb9')]=db[_0xe0e3('0x1')][_0xe0e3('0x14')](_0xe0e3('0xba'));db[_0xe0e3('0xbb')]=db[_0xe0e3('0x1')][_0xe0e3('0x14')](_0xe0e3('0xbc'));db['ServicenowConfiguration']=db['sequelize']['import'](_0xe0e3('0xbd'));db[_0xe0e3('0xbe')]=db[_0xe0e3('0x1')][_0xe0e3('0x14')](_0xe0e3('0xbf'));db[_0xe0e3('0xc0')]=db[_0xe0e3('0x1')]['import'](_0xe0e3('0xc1'));db['Dynamics365Configuration']=db['sequelize']['import'](_0xe0e3('0xc2'));db[_0xe0e3('0xc3')]=db[_0xe0e3('0x1')][_0xe0e3('0x14')](_0xe0e3('0xc4'));db[_0xe0e3('0xc5')]=db[_0xe0e3('0x1')]['import'](_0xe0e3('0xc6'));db[_0xe0e3('0xc7')]=db['sequelize'][_0xe0e3('0x14')](_0xe0e3('0xc8'));db[_0xe0e3('0xc9')]=db[_0xe0e3('0x1')][_0xe0e3('0x14')](_0xe0e3('0xca'));db[_0xe0e3('0x92')]=db['sequelize'][_0xe0e3('0x14')]('../api/integration/integration.model');db[_0xe0e3('0xcb')]=db[_0xe0e3('0x1')]['import']('../api/network/network.model');db[_0xe0e3('0xcc')]=db['sequelize'][_0xe0e3('0x14')](_0xe0e3('0xcd'));db[_0xe0e3('0xce')]=db[_0xe0e3('0x1')][_0xe0e3('0x14')](_0xe0e3('0xcf'));db[_0xe0e3('0xd0')]=db[_0xe0e3('0x1')][_0xe0e3('0x14')](_0xe0e3('0xd1'));db[_0xe0e3('0xd2')]=db[_0xe0e3('0x1')][_0xe0e3('0x14')](_0xe0e3('0xd3'));db['JscriptySessionReport']=db['sequelize']['import'](_0xe0e3('0xd4'));db[_0xe0e3('0xd5')]=db[_0xe0e3('0x1')][_0xe0e3('0x14')]('../api/smsQueueReport/smsQueueReport.model');db[_0xe0e3('0xd6')]=db[_0xe0e3('0x1')][_0xe0e3('0x14')]('../api/squareReport/squareReport.model');db['SquareDetailsReport']=db[_0xe0e3('0x1')][_0xe0e3('0x14')]('../api/squareReportDetail/squareReportDetail.model');db[_0xe0e3('0xd7')]=db['sequelize'][_0xe0e3('0x14')](_0xe0e3('0xd8'));db[_0xe0e3('0xd9')]=db[_0xe0e3('0x1')][_0xe0e3('0x14')]('../api/setting/setting.model');db[_0xe0e3('0xda')]=db['sequelize'][_0xe0e3('0x14')](_0xe0e3('0xdb'));db['SquareProject']=db['sequelize'][_0xe0e3('0x14')]('../api/squareProject/squareProject.model');db[_0xe0e3('0xdc')]=db[_0xe0e3('0x1')]['import']('../api/squareRecording/squareRecording.model');db[_0xe0e3('0xdd')]=db['sequelize']['import']('../api/squareMessage/squareMessage.model');db[_0xe0e3('0xde')]=db[_0xe0e3('0x1')][_0xe0e3('0x14')](_0xe0e3('0xdf'));db[_0xe0e3('0xe0')]=db[_0xe0e3('0x1')][_0xe0e3('0x14')](_0xe0e3('0xe1'));db[_0xe0e3('0xe2')]=db[_0xe0e3('0x1')][_0xe0e3('0x14')](_0xe0e3('0xe3'));db['Migration']=db['sequelize']['import'](_0xe0e3('0xe4'));db['Attachment']=db[_0xe0e3('0x1')][_0xe0e3('0x14')](_0xe0e3('0xe5'));db['Plugin']=db[_0xe0e3('0x1')]['import']('../api/plugin/plugin.model');db[_0xe0e3('0xe6')]=db[_0xe0e3('0x1')][_0xe0e3('0x14')](_0xe0e3('0xe7'));db[_0xe0e3('0xe8')]=db[_0xe0e3('0x1')][_0xe0e3('0x14')](_0xe0e3('0xe9'));db[_0xe0e3('0xea')]=db['sequelize'][_0xe0e3('0x14')]('../api/faxTransferReport/faxTransferReport.model');db[_0xe0e3('0xeb')]=db[_0xe0e3('0x1')]['import'](_0xe0e3('0xec'));db['SmsTransferReport']=db[_0xe0e3('0x1')][_0xe0e3('0x14')](_0xe0e3('0xed'));db['CmList']=db[_0xe0e3('0x1')]['import']('../api/cmList/cmList.model');db[_0xe0e3('0xee')]=db[_0xe0e3('0x1')][_0xe0e3('0x14')](_0xe0e3('0xef'));db['UserProfile']=db['sequelize']['import']('../api/userProfile/userProfile.model');db[_0xe0e3('0xf0')]=db[_0xe0e3('0x1')][_0xe0e3('0x14')]('../api/userProfileSection/userProfileSection.model');db[_0xe0e3('0xf1')]=db['sequelize'][_0xe0e3('0x14')](_0xe0e3('0xf2'));db[_0xe0e3('0xf3')]=db[_0xe0e3('0x1')][_0xe0e3('0x14')]('../api/userNotification/userNotification.model');db[_0xe0e3('0xf4')]=db[_0xe0e3('0x1')][_0xe0e3('0x14')](_0xe0e3('0xf5'));db['WhatsappApplication']=db[_0xe0e3('0x1')][_0xe0e3('0x14')]('../api/whatsappApplication/whatsappApplication.model');db[_0xe0e3('0xf6')]=db[_0xe0e3('0x1')][_0xe0e3('0x14')]('../api/whatsappInteraction/whatsappInteraction.model');db[_0xe0e3('0xf7')]=db[_0xe0e3('0x1')]['import'](_0xe0e3('0xf8'));db['WhatsappQueueReport']=db[_0xe0e3('0x1')][_0xe0e3('0x14')]('../api/whatsappQueueReport/whatsappQueueReport.model');db[_0xe0e3('0xf9')]=db[_0xe0e3('0x1')][_0xe0e3('0x14')](_0xe0e3('0xfa'));db[_0xe0e3('0xfb')]=db[_0xe0e3('0x1')]['import']('../api/whatsappQueue/whatsappQueue.model');db[_0xe0e3('0xfc')]=db['sequelize'][_0xe0e3('0x14')](_0xe0e3('0xfd'));db[_0xe0e3('0xfe')]=db[_0xe0e3('0x1')][_0xe0e3('0x14')](_0xe0e3('0xff'));db[_0xe0e3('0x100')]=db['sequelize'][_0xe0e3('0x14')](_0xe0e3('0x101'));db[_0xe0e3('0x102')]=db[_0xe0e3('0x1')][_0xe0e3('0x14')](_0xe0e3('0x103'));db[_0xe0e3('0x104')]=db['sequelize']['import'](_0xe0e3('0x105'));db[_0xe0e3('0x106')]=db[_0xe0e3('0x1')][_0xe0e3('0x14')]('../api/mailInteractionHasTag/mailInteractionHasTag.model');db['User']['hasOne'](db[_0xe0e3('0x20')],{'as':_0xe0e3('0x20'),'onDelete':'cascade','foreignKey':_0xe0e3('0x107')});db[_0xe0e3('0x13')][_0xe0e3('0x108')](db[_0xe0e3('0x104')],{'as':_0xe0e3('0x109'),'onDelete':'cascade','foreignKey':_0xe0e3('0x107')});db[_0xe0e3('0x13')][_0xe0e3('0x10a')](db[_0xe0e3('0x1c')],{'as':_0xe0e3('0x10b'),'foreignKey':_0xe0e3('0x107')});db[_0xe0e3('0x13')][_0xe0e3('0x10a')](db[_0xe0e3('0x2d')],{'as':_0xe0e3('0x10c'),'foreignKey':'UserId'});db[_0xe0e3('0x13')][_0xe0e3('0x10a')](db[_0xe0e3('0x10d')],{'as':_0xe0e3('0x10e'),'onDelete':_0xe0e3('0x10f'),'hooks':!![]});db[_0xe0e3('0x13')][_0xe0e3('0x10a')](db[_0xe0e3('0x110')],{'as':_0xe0e3('0x111'),'foreignKey':_0xe0e3('0x107')});db[_0xe0e3('0x13')][_0xe0e3('0x10a')](db[_0xe0e3('0x73')],{'as':'HopperHistory','foreignKey':_0xe0e3('0x107')});db[_0xe0e3('0x13')][_0xe0e3('0x10a')](db[_0xe0e3('0x75')],{'as':_0xe0e3('0x75'),'foreignKey':_0xe0e3('0x107')});db[_0xe0e3('0x13')][_0xe0e3('0x10a')](db['OpenchannelInteraction'],{'as':_0xe0e3('0x112'),'foreignKey':_0xe0e3('0x107')});db[_0xe0e3('0x13')][_0xe0e3('0x10a')](db[_0xe0e3('0x62')],{'as':_0xe0e3('0x113'),'foreignKey':_0xe0e3('0x107')});db[_0xe0e3('0x13')][_0xe0e3('0x10a')](db[_0xe0e3('0x114')],{'as':'SmsInteractions','foreignKey':_0xe0e3('0x107')});db['User']['hasMany'](db[_0xe0e3('0x115')],{'as':_0xe0e3('0x116'),'foreignKey':_0xe0e3('0x107')});db[_0xe0e3('0x13')]['hasMany'](db[_0xe0e3('0x3e')],{'as':_0xe0e3('0x117'),'foreignKey':_0xe0e3('0x107')});db['User']['hasMany'](db[_0xe0e3('0xf6')],{'as':_0xe0e3('0x118'),'foreignKey':_0xe0e3('0x107')});db[_0xe0e3('0x13')]['hasMany'](db[_0xe0e3('0xf3')],{'as':_0xe0e3('0x119'),'foreignKey':_0xe0e3('0x11a')});db[_0xe0e3('0x13')][_0xe0e3('0x10a')](db[_0xe0e3('0x6e')],{'as':'Hoppers','foreignKey':_0xe0e3('0x107'),'onDelete':_0xe0e3('0x11b')});db[_0xe0e3('0x13')]['belongsTo'](db[_0xe0e3('0x11c')],{'as':_0xe0e3('0x11c'),'foreignKey':_0xe0e3('0x11d')});db['User'][_0xe0e3('0x11e')](db['ChatGroup'],{'as':_0xe0e3('0x11f'),'through':_0xe0e3('0x120')});db[_0xe0e3('0x13')]['belongsToMany'](db[_0xe0e3('0x121')],{'as':_0xe0e3('0x122'),'through':'cm_user_has_contacts'});db[_0xe0e3('0x13')][_0xe0e3('0x11e')](db[_0xe0e3('0x123')],{'as':'Lists','through':_0xe0e3('0x124')});db[_0xe0e3('0x13')][_0xe0e3('0x11e')](db[_0xe0e3('0xde')],{'through':'user_has_teams'});db[_0xe0e3('0x13')][_0xe0e3('0x11e')](db[_0xe0e3('0x3e')],{'as':_0xe0e3('0x117'),'through':_0xe0e3('0x125')});db[_0xe0e3('0x13')][_0xe0e3('0x11e')](db[_0xe0e3('0x62')],{'as':'ChatInteractions','through':_0xe0e3('0x126')});db[_0xe0e3('0x13')][_0xe0e3('0x11e')](db[_0xe0e3('0x115')],{'as':_0xe0e3('0x116'),'through':'user_has_fax_interactions'});db[_0xe0e3('0x13')][_0xe0e3('0x11e')](db['SmsInteraction'],{'as':_0xe0e3('0x127'),'through':_0xe0e3('0x128')});db[_0xe0e3('0x13')][_0xe0e3('0x11e')](db[_0xe0e3('0x129')],{'as':_0xe0e3('0x112'),'through':_0xe0e3('0x12a')});db['User']['belongsToMany'](db['WhatsappInteraction'],{'as':_0xe0e3('0x118'),'through':'user_has_whatsapp_interactions'});db[_0xe0e3('0x13')]['belongsToMany'](db['VoiceQueue'],{'as':_0xe0e3('0x12b'),'through':'UserVoiceQueue','required':![]});db[_0xe0e3('0x13')][_0xe0e3('0x11e')](db[_0xe0e3('0xee')],{'as':_0xe0e3('0x12c'),'through':_0xe0e3('0x102'),'required':![]});db['User']['belongsToMany'](db['MailQueue'],{'as':_0xe0e3('0x12d'),'through':_0xe0e3('0x12e'),'required':![]});db[_0xe0e3('0x13')][_0xe0e3('0x11e')](db[_0xe0e3('0x66')],{'as':_0xe0e3('0x12f'),'through':_0xe0e3('0x30'),'required':![],'hooks':!![]});db[_0xe0e3('0x13')][_0xe0e3('0x11e')](db[_0xe0e3('0x4c')],{'as':_0xe0e3('0x130'),'through':_0xe0e3('0x131'),'required':![]});db['User'][_0xe0e3('0x11e')](db['SmsQueue'],{'as':'SmsQueues','through':'UserSmsQueue','required':![]});db[_0xe0e3('0x13')][_0xe0e3('0x11e')](db[_0xe0e3('0x5b')],{'as':_0xe0e3('0x132'),'through':_0xe0e3('0x133'),'required':![]});db[_0xe0e3('0x13')][_0xe0e3('0x11e')](db['WhatsappQueue'],{'as':_0xe0e3('0x134'),'through':_0xe0e3('0x135'),'required':![]});db['User'][_0xe0e3('0x11e')](db[_0xe0e3('0x123')],{'through':_0xe0e3('0x124')});db[_0xe0e3('0x13')]['belongsToMany'](db[_0xe0e3('0x5d')],{'as':_0xe0e3('0x136'),'through':'user_has_chat_websites'});db[_0xe0e3('0x13')][_0xe0e3('0x11e')](db[_0xe0e3('0x47')],{'as':_0xe0e3('0x137'),'through':_0xe0e3('0x138')});db[_0xe0e3('0x13')]['belongsToMany'](db[_0xe0e3('0x38')],{'as':'MailAccounts','through':_0xe0e3('0x139')});db['User'][_0xe0e3('0x11e')](db[_0xe0e3('0x56')],{'as':_0xe0e3('0x13a'),'through':_0xe0e3('0x13b')});db['User'][_0xe0e3('0x11e')](db['SmsAccount'],{'as':_0xe0e3('0x13c'),'through':_0xe0e3('0x13d')});db[_0xe0e3('0x13')][_0xe0e3('0x11e')](db[_0xe0e3('0xf4')],{'as':'WhatsappAccounts','through':_0xe0e3('0x13e')});db[_0xe0e3('0x13f')]['hasMany'](db[_0xe0e3('0x10d')],{'as':_0xe0e3('0x140'),'onDelete':_0xe0e3('0x10f'),'foreignKey':_0xe0e3('0x141')});db[_0xe0e3('0x17')][_0xe0e3('0x10a')](db[_0xe0e3('0x10d')],{'onDelete':'cascade'});db['VoiceExtension'][_0xe0e3('0x10a')](db[_0xe0e3('0x10d')],{'as':_0xe0e3('0x142'),'onDelete':_0xe0e3('0x10f')});db['VoiceMusicOnHold'][_0xe0e3('0x11e')](db['Sound'],{'as':_0xe0e3('0x143'),'through':_0xe0e3('0x144')});db[_0xe0e3('0x145')][_0xe0e3('0x10a')](db[_0xe0e3('0x2d')],{'as':_0xe0e3('0x146'),'foreignKey':_0xe0e3('0x147')});db['VoiceQueue'][_0xe0e3('0x10a')](db[_0xe0e3('0x6e')],{'as':'Hoppers','foreignKey':_0xe0e3('0x147')});db[_0xe0e3('0x145')][_0xe0e3('0x10a')](db[_0xe0e3('0x110')],{'as':_0xe0e3('0x111'),'foreignKey':_0xe0e3('0x147')});db[_0xe0e3('0x145')][_0xe0e3('0x10a')](db[_0xe0e3('0x73')],{'as':'HopperHistories','foreignKey':'VoiceQueueId'});db[_0xe0e3('0x145')][_0xe0e3('0x10a')](db[_0xe0e3('0x75')],{'as':_0xe0e3('0x75'),'foreignKey':_0xe0e3('0x147')});db[_0xe0e3('0x145')][_0xe0e3('0x10a')](db[_0xe0e3('0x70')],{'as':_0xe0e3('0x148'),'foreignKey':'VoiceQueueId'});db[_0xe0e3('0x145')]['hasMany'](db[_0xe0e3('0x149')],{'as':'JscriptySessions','foreignKey':_0xe0e3('0x147')});db['VoiceQueue'][_0xe0e3('0x14a')](db[_0xe0e3('0x2b')],{'as':_0xe0e3('0x2b'),'foreignKey':_0xe0e3('0x14b')});db['VoiceQueue'][_0xe0e3('0x14a')](db[_0xe0e3('0x2b')],{'as':_0xe0e3('0x14c'),'foreignKey':'TrunkBackupId'});db['VoiceQueue']['belongsTo'](db['Interval'],{'as':_0xe0e3('0x7e'),'foreignKey':_0xe0e3('0x14d')});db['VoiceQueue'][_0xe0e3('0x14a')](db[_0xe0e3('0x80')],{'as':_0xe0e3('0x14e'),'foreignKey':_0xe0e3('0x14f')});db[_0xe0e3('0x145')]['belongsToMany'](db[_0xe0e3('0x123')],{'as':'Lists','through':'voice_queues_has_cm_lists'});db[_0xe0e3('0x145')][_0xe0e3('0x11e')](db[_0xe0e3('0x13')],{'as':_0xe0e3('0x150'),'through':_0xe0e3('0x2e')});db[_0xe0e3('0x145')][_0xe0e3('0x11e')](db[_0xe0e3('0xde')],{'as':_0xe0e3('0x151'),'through':'TeamVoiceQueue'});db['VoiceQueue'][_0xe0e3('0x11e')](db[_0xe0e3('0x123')],{'as':_0xe0e3('0x152'),'through':_0xe0e3('0x153')});db[_0xe0e3('0x1c')][_0xe0e3('0x14a')](db[_0xe0e3('0x13')],{'as':_0xe0e3('0x13'),'foreignKey':_0xe0e3('0x107')});db['ScreenRecording'][_0xe0e3('0x14a')](db[_0xe0e3('0x13')],{'as':_0xe0e3('0x13'),'foreignKey':_0xe0e3('0x107')});db['VoiceMail'][_0xe0e3('0x10a')](db['VoiceMailMessage'],{'as':'Messages','onDelete':_0xe0e3('0x10f'),'foreignKey':_0xe0e3('0x154'),'sourceKey':'mailbox'});db['VoiceMailMessage']['belongsTo'](db['VoiceMail'],{'foreignKey':_0xe0e3('0x154'),'targetKey':_0xe0e3('0x155')});db['VoiceCallReport']['hasMany'](db['VoiceQueueReport'],{'as':_0xe0e3('0x156'),'foreignKey':_0xe0e3('0x157'),'constraints':![]});db[_0xe0e3('0x158')]['hasMany'](db['VoiceAgentReport'],{'as':_0xe0e3('0x159'),'foreignKey':'uniqueid','constraints':![]});db['VoiceCallReport'][_0xe0e3('0x14a')](db['User'],{'as':_0xe0e3('0x13'),'foreignKey':'UserId'});db[_0xe0e3('0x158')][_0xe0e3('0x14a')](db[_0xe0e3('0x121')],{'as':_0xe0e3('0x15a'),'foreignKey':_0xe0e3('0x15b')});db[_0xe0e3('0x34')][_0xe0e3('0x14a')](db[_0xe0e3('0x38')],{'as':'MailAccount','foreignKey':_0xe0e3('0x15c')});db['MailServerIn'][_0xe0e3('0x14a')](db[_0xe0e3('0xfc')],{'as':'CloudProvider','foreignKey':'CloudProviderId','onDelete':_0xe0e3('0x15d')});db[_0xe0e3('0x36')][_0xe0e3('0x14a')](db[_0xe0e3('0x38')],{'as':_0xe0e3('0x38'),'foreignKey':'MailAccountId'});db[_0xe0e3('0x36')][_0xe0e3('0x14a')](db[_0xe0e3('0xfc')],{'as':_0xe0e3('0xfc'),'foreignKey':_0xe0e3('0x15e'),'onDelete':_0xe0e3('0x15d')});db[_0xe0e3('0x38')][_0xe0e3('0x108')](db[_0xe0e3('0x34')],{'as':'Imap','onDelete':_0xe0e3('0x10f')});db[_0xe0e3('0x38')][_0xe0e3('0x108')](db[_0xe0e3('0x36')],{'as':_0xe0e3('0x15f'),'onDelete':'cascade'});db['MailAccount']['hasMany'](db['Disposition'],{'as':'Dispositions','foreignKey':_0xe0e3('0x15c'),'onDelete':_0xe0e3('0x10f')});db[_0xe0e3('0x38')][_0xe0e3('0x10a')](db[_0xe0e3('0x7a')],{'as':'Answers','foreignKey':_0xe0e3('0x15c')});db['MailAccount'][_0xe0e3('0x10a')](db[_0xe0e3('0x40')],{'as':_0xe0e3('0x160'),'foreignKey':_0xe0e3('0x15c')});db[_0xe0e3('0x38')][_0xe0e3('0x10a')](db['MailInteraction'],{'as':'Interactions'});db[_0xe0e3('0x38')][_0xe0e3('0x10a')](db[_0xe0e3('0x42')],{'as':_0xe0e3('0x142'),'foreignKey':'MailAccountId','onDelete':_0xe0e3('0x10f')});db[_0xe0e3('0x38')][_0xe0e3('0x14a')](db[_0xe0e3('0x123')],{'as':_0xe0e3('0x161'),'foreignKey':_0xe0e3('0x162')});db[_0xe0e3('0x38')][_0xe0e3('0x14a')](db[_0xe0e3('0x8e')],{'as':_0xe0e3('0x8e'),'foreignKey':'TemplateId'});db[_0xe0e3('0x38')][_0xe0e3('0x14a')](db[_0xe0e3('0x80')],{'as':_0xe0e3('0x14e'),'foreignKey':_0xe0e3('0x14f')});db[_0xe0e3('0x38')][_0xe0e3('0x11e')](db[_0xe0e3('0x13')],{'as':_0xe0e3('0x150'),'through':_0xe0e3('0x139')});db[_0xe0e3('0x3a')][_0xe0e3('0x11e')](db['User'],{'as':_0xe0e3('0x150'),'through':_0xe0e3('0x12e')});db[_0xe0e3('0x3a')]['belongsToMany'](db['Team'],{'through':_0xe0e3('0x163'),'as':_0xe0e3('0x151')});db[_0xe0e3('0x3e')][_0xe0e3('0x10a')](db['MailMessage'],{'as':'Messages','onDelete':_0xe0e3('0x10f'),'foreignKey':_0xe0e3('0x164')});db[_0xe0e3('0x3e')][_0xe0e3('0x14a')](db['MailAccount'],{'as':_0xe0e3('0x165'),'foreignKey':_0xe0e3('0x15c')});db[_0xe0e3('0x3e')][_0xe0e3('0x14a')](db[_0xe0e3('0x121')],{'as':_0xe0e3('0x15a'),'foreignKey':_0xe0e3('0x15b')});db[_0xe0e3('0x3e')][_0xe0e3('0x14a')](db[_0xe0e3('0x13')],{'as':_0xe0e3('0x166'),'foreignKey':_0xe0e3('0x107')});db['MailInteraction'][_0xe0e3('0x11e')](db['Tag'],{'through':'mail_interaction_has_tags','as':_0xe0e3('0x167')});db['MailInteraction'][_0xe0e3('0x11e')](db[_0xe0e3('0x87')],{'through':_0xe0e3('0x168'),'as':_0xe0e3('0x169')});db[_0xe0e3('0x3e')]['belongsToMany'](db['User'],{'as':'Users','through':'user_has_mail_interactions','foreignKey':_0xe0e3('0x164')});db['MailMessage'][_0xe0e3('0x10a')](db[_0xe0e3('0x16a')],{'as':'Attachments','onDelete':_0xe0e3('0x10f')});db['MailMessage']['belongsTo'](db[_0xe0e3('0x13')],{'as':_0xe0e3('0x13')});db[_0xe0e3('0x40')]['belongsTo'](db[_0xe0e3('0x121')],{'onDelete':_0xe0e3('0x10f'),'as':_0xe0e3('0x15a')});db[_0xe0e3('0x40')]['belongsTo'](db[_0xe0e3('0x3e')],{'as':_0xe0e3('0x16b'),'foreignKey':_0xe0e3('0x164')});db['MailMessage'][_0xe0e3('0x14a')](db[_0xe0e3('0x38')],{'as':_0xe0e3('0x165'),'foreignKey':'MailAccountId'});db[_0xe0e3('0x40')][_0xe0e3('0x14a')](db[_0xe0e3('0x5d')],{'as':_0xe0e3('0x5d'),'foreignKey':_0xe0e3('0x16c')});db[_0xe0e3('0x40')][_0xe0e3('0x14a')](db[_0xe0e3('0x64')],{'as':_0xe0e3('0x64'),'foreignKey':'ChatOfflineMessageId'});db['MailApplication']['belongsTo'](db[_0xe0e3('0x13')],{'onDelete':'restrict'});db[_0xe0e3('0x42')][_0xe0e3('0x14a')](db[_0xe0e3('0x3a')],{'onDelete':_0xe0e3('0x15d')});db['MailApplication'][_0xe0e3('0x14a')](db['MailAccount'],{'onDelete':_0xe0e3('0x15d')});db[_0xe0e3('0x42')][_0xe0e3('0x14a')](db['Interval'],{'onDelete':_0xe0e3('0x15d'),'foreignKey':_0xe0e3('0x14d')});db[_0xe0e3('0x42')][_0xe0e3('0x14a')](db['Tag'],{'onDelete':'restrict','foreignKey':_0xe0e3('0x16d')});db[_0xe0e3('0x43')][_0xe0e3('0x14a')](db[_0xe0e3('0x38')],{});db['MailQueueReport'][_0xe0e3('0x14a')](db[_0xe0e3('0x123')],{'as':_0xe0e3('0x161'),'foreignKey':'ListId'});db['MailQueueReport'][_0xe0e3('0x14a')](db['CmContact'],{'as':_0xe0e3('0x15a'),'foreignKey':_0xe0e3('0x15b')});db[_0xe0e3('0x43')][_0xe0e3('0x14a')](db[_0xe0e3('0x3e')],{});db['MailQueueReport'][_0xe0e3('0x14a')](db[_0xe0e3('0x40')],{});db[_0xe0e3('0x43')][_0xe0e3('0x14a')](db['User'],{});db[_0xe0e3('0x43')]['belongsTo'](db[_0xe0e3('0x3a')],{});db[_0xe0e3('0x45')]['hasMany'](db['DashboardItem'],{'as':_0xe0e3('0x16e'),'onDelete':'cascade'});db[_0xe0e3('0x47')][_0xe0e3('0x10a')](db[_0xe0e3('0x16f')],{'as':_0xe0e3('0x170'),'foreignKey':_0xe0e3('0x171'),'onDelete':_0xe0e3('0x10f')});db[_0xe0e3('0x47')][_0xe0e3('0x10a')](db[_0xe0e3('0x7a')],{'as':'Answers','foreignKey':'FaxAccountId'});db['FaxAccount'][_0xe0e3('0x10a')](db[_0xe0e3('0x115')],{'as':'Interactions'});db['FaxAccount'][_0xe0e3('0x10a')](db[_0xe0e3('0x48')],{'as':_0xe0e3('0x142'),'foreignKey':_0xe0e3('0x171'),'onDelete':_0xe0e3('0x10f')});db[_0xe0e3('0x47')][_0xe0e3('0x10a')](db[_0xe0e3('0x10d')],{'as':'Exntensions','onDelete':_0xe0e3('0x10f')});db[_0xe0e3('0x47')][_0xe0e3('0x10a')](db[_0xe0e3('0x4a')],{'as':_0xe0e3('0x160')});db[_0xe0e3('0x47')]['belongsTo'](db[_0xe0e3('0x2b')],{'as':_0xe0e3('0x2b')});db[_0xe0e3('0x47')][_0xe0e3('0x14a')](db[_0xe0e3('0x123')],{'as':_0xe0e3('0x161'),'foreignKey':_0xe0e3('0x162')});db['FaxAccount'][_0xe0e3('0x14a')](db['Pause'],{'as':'mandatoryDispositionPause','foreignKey':'mandatoryDispositionPauseId'});db[_0xe0e3('0x47')][_0xe0e3('0x11e')](db[_0xe0e3('0x13')],{'as':'Agents','through':_0xe0e3('0x138')});db[_0xe0e3('0x48')][_0xe0e3('0x14a')](db['User'],{'onDelete':_0xe0e3('0x15d')});db[_0xe0e3('0x48')][_0xe0e3('0x14a')](db[_0xe0e3('0x4c')],{'onDelete':_0xe0e3('0x15d')});db[_0xe0e3('0x48')][_0xe0e3('0x14a')](db['FaxAccount'],{'onDelete':_0xe0e3('0x15d')});db[_0xe0e3('0x48')][_0xe0e3('0x14a')](db[_0xe0e3('0x87')],{'onDelete':_0xe0e3('0x15d'),'foreignKey':_0xe0e3('0x16d')});db[_0xe0e3('0x115')][_0xe0e3('0x10a')](db[_0xe0e3('0x4a')],{'as':_0xe0e3('0x160'),'onDelete':_0xe0e3('0x10f'),'foreignKey':_0xe0e3('0x172')});db[_0xe0e3('0x115')][_0xe0e3('0x14a')](db[_0xe0e3('0x47')],{'as':_0xe0e3('0x165'),'foreignKey':_0xe0e3('0x171')});db[_0xe0e3('0x115')]['belongsTo'](db[_0xe0e3('0x121')],{'as':'Contact','foreignKey':'ContactId'});db[_0xe0e3('0x115')][_0xe0e3('0x14a')](db[_0xe0e3('0x13')],{'as':_0xe0e3('0x166'),'foreignKey':_0xe0e3('0x107')});db[_0xe0e3('0x115')][_0xe0e3('0x11e')](db[_0xe0e3('0x87')],{'through':_0xe0e3('0x173'),'as':_0xe0e3('0x167')});db[_0xe0e3('0x115')][_0xe0e3('0x11e')](db['Tag'],{'through':_0xe0e3('0x173'),'as':'ThroughTags'});db[_0xe0e3('0x115')]['belongsToMany'](db['User'],{'as':_0xe0e3('0x174'),'through':_0xe0e3('0x175'),'foreignKey':_0xe0e3('0x172')});db[_0xe0e3('0x4a')]['belongsTo'](db[_0xe0e3('0x13')],{'onDelete':_0xe0e3('0x10f'),'as':_0xe0e3('0x13')});db[_0xe0e3('0x4a')][_0xe0e3('0x14a')](db['FaxInteraction'],{'as':_0xe0e3('0x16b'),'foreignKey':_0xe0e3('0x172')});db[_0xe0e3('0x4a')][_0xe0e3('0x14a')](db[_0xe0e3('0x121')],{'onDelete':'cascade','as':'Contact'});db[_0xe0e3('0x4a')]['belongsTo'](db[_0xe0e3('0x16a')],{'as':'Attachment','foreignKey':_0xe0e3('0x176')});db[_0xe0e3('0x4a')][_0xe0e3('0x14a')](db[_0xe0e3('0x47')],{'as':_0xe0e3('0x165'),'foreignKey':_0xe0e3('0x171')});db[_0xe0e3('0x4c')][_0xe0e3('0x11e')](db[_0xe0e3('0x13')],{'as':_0xe0e3('0x150'),'through':_0xe0e3('0x131')});db[_0xe0e3('0x4c')][_0xe0e3('0x11e')](db[_0xe0e3('0xde')],{'through':_0xe0e3('0x177'),'as':_0xe0e3('0x151')});db[_0xe0e3('0x4d')][_0xe0e3('0x14a')](db['FaxAccount'],{});db[_0xe0e3('0x4d')]['belongsTo'](db[_0xe0e3('0x123')],{'as':_0xe0e3('0x161'),'foreignKey':_0xe0e3('0x162')});db[_0xe0e3('0x4d')][_0xe0e3('0x14a')](db[_0xe0e3('0x121')],{'as':_0xe0e3('0x15a'),'foreignKey':_0xe0e3('0x15b')});db[_0xe0e3('0x4d')][_0xe0e3('0x14a')](db[_0xe0e3('0x115')],{});db[_0xe0e3('0x4d')]['belongsTo'](db[_0xe0e3('0x4a')],{});db[_0xe0e3('0x4d')][_0xe0e3('0x14a')](db[_0xe0e3('0x13')],{});db[_0xe0e3('0x4d')][_0xe0e3('0x14a')](db[_0xe0e3('0x4c')],{});db[_0xe0e3('0x4f')]['hasMany'](db[_0xe0e3('0x16f')],{'as':'Dispositions','foreignKey':_0xe0e3('0x178'),'onDelete':_0xe0e3('0x10f')});db[_0xe0e3('0x4f')][_0xe0e3('0x10a')](db['CannedAnswer'],{'as':_0xe0e3('0x179'),'foreignKey':_0xe0e3('0x178')});db[_0xe0e3('0x4f')][_0xe0e3('0x10a')](db[_0xe0e3('0x53')],{'as':_0xe0e3('0x160'),'foreignKey':_0xe0e3('0x178')});db[_0xe0e3('0x4f')][_0xe0e3('0x10a')](db['SmsInteraction'],{'as':'Interactions'});db[_0xe0e3('0x4f')][_0xe0e3('0x10a')](db[_0xe0e3('0x51')],{'as':_0xe0e3('0x142'),'foreignKey':_0xe0e3('0x178'),'onDelete':_0xe0e3('0x10f')});db['SmsAccount']['belongsTo'](db[_0xe0e3('0x123')],{'as':_0xe0e3('0x161'),'foreignKey':_0xe0e3('0x162')});db[_0xe0e3('0x4f')]['belongsTo'](db[_0xe0e3('0x80')],{'as':_0xe0e3('0x14e'),'foreignKey':_0xe0e3('0x14f')});db[_0xe0e3('0x4f')][_0xe0e3('0x11e')](db['User'],{'as':_0xe0e3('0x150'),'through':'user_has_sms_accounts'});db[_0xe0e3('0x51')][_0xe0e3('0x14a')](db[_0xe0e3('0x13')],{'onDelete':_0xe0e3('0x15d')});db[_0xe0e3('0x51')]['belongsTo'](db['SmsQueue'],{'onDelete':_0xe0e3('0x15d')});db['SmsApplication'][_0xe0e3('0x14a')](db[_0xe0e3('0x4f')],{'onDelete':_0xe0e3('0x15d')});db['SmsApplication'][_0xe0e3('0x14a')](db[_0xe0e3('0x7e')],{'onDelete':_0xe0e3('0x15d'),'foreignKey':_0xe0e3('0x14d')});db[_0xe0e3('0x51')][_0xe0e3('0x14a')](db[_0xe0e3('0x87')],{'onDelete':_0xe0e3('0x15d'),'foreignKey':_0xe0e3('0x16d')});db['SmsInteraction'][_0xe0e3('0x10a')](db[_0xe0e3('0x53')],{'as':_0xe0e3('0x160'),'onDelete':'cascade','foreignKey':_0xe0e3('0x17a')});db[_0xe0e3('0x114')][_0xe0e3('0x14a')](db['SmsAccount'],{'as':'Account','foreignKey':_0xe0e3('0x178')});db[_0xe0e3('0x114')][_0xe0e3('0x14a')](db[_0xe0e3('0x121')],{'as':_0xe0e3('0x15a'),'foreignKey':_0xe0e3('0x15b')});db[_0xe0e3('0x114')][_0xe0e3('0x14a')](db[_0xe0e3('0x13')],{'as':_0xe0e3('0x166'),'foreignKey':_0xe0e3('0x107')});db['SmsInteraction'][_0xe0e3('0x11e')](db['Tag'],{'through':_0xe0e3('0x17b'),'as':'Tags'});db[_0xe0e3('0x114')][_0xe0e3('0x11e')](db['Tag'],{'through':_0xe0e3('0x17b'),'as':_0xe0e3('0x169')});db['SmsInteraction'][_0xe0e3('0x11e')](db[_0xe0e3('0x13')],{'as':_0xe0e3('0x174'),'through':_0xe0e3('0x128'),'foreignKey':_0xe0e3('0x17a')});db[_0xe0e3('0x53')][_0xe0e3('0x14a')](db[_0xe0e3('0x13')],{'as':'User'});db[_0xe0e3('0x53')][_0xe0e3('0x14a')](db['CmContact'],{'onDelete':_0xe0e3('0x10f'),'as':_0xe0e3('0x15a')});db[_0xe0e3('0x53')]['belongsTo'](db[_0xe0e3('0x114')],{'onDelete':_0xe0e3('0x10f'),'as':_0xe0e3('0x16b'),'foreignKey':'SmsInteractionId'});db['SmsMessage'][_0xe0e3('0x14a')](db[_0xe0e3('0x4f')],{'as':_0xe0e3('0x165'),'foreignKey':_0xe0e3('0x178')});db[_0xe0e3('0x55')]['belongsToMany'](db[_0xe0e3('0x13')],{'as':'Agents','through':_0xe0e3('0x17c'),'foreignKey':_0xe0e3('0x17d')});db[_0xe0e3('0x55')][_0xe0e3('0x11e')](db['Team'],{'through':'team_has_sms_queues','as':'Teams'});db[_0xe0e3('0x56')][_0xe0e3('0x10a')](db[_0xe0e3('0x16f')],{'as':'Dispositions','foreignKey':'OpenchannelAccountId','onDelete':_0xe0e3('0x10f')});db[_0xe0e3('0x56')][_0xe0e3('0x10a')](db[_0xe0e3('0x7a')],{'as':_0xe0e3('0x179'),'foreignKey':_0xe0e3('0x17e')});db['OpenchannelAccount'][_0xe0e3('0x10a')](db[_0xe0e3('0x129')],{'as':_0xe0e3('0x17f'),'foreignKey':_0xe0e3('0x17e')});db[_0xe0e3('0x56')][_0xe0e3('0x10a')](db['OpenchannelMessage'],{'as':_0xe0e3('0x160'),'foreignKey':_0xe0e3('0x17e')});db[_0xe0e3('0x56')]['hasMany'](db[_0xe0e3('0x180')],{'as':'Applications','foreignKey':_0xe0e3('0x17e'),'onDelete':_0xe0e3('0x10f')});db['OpenchannelAccount'][_0xe0e3('0x14a')](db[_0xe0e3('0x123')],{'as':_0xe0e3('0x161'),'foreignKey':_0xe0e3('0x162')});db[_0xe0e3('0x56')][_0xe0e3('0x14a')](db[_0xe0e3('0x80')],{'as':_0xe0e3('0x14e'),'foreignKey':_0xe0e3('0x14f')});db[_0xe0e3('0x56')][_0xe0e3('0x11e')](db['User'],{'as':'Agents','through':_0xe0e3('0x13b')});db[_0xe0e3('0x180')][_0xe0e3('0x14a')](db['User'],{'onDelete':_0xe0e3('0x15d')});db[_0xe0e3('0x180')][_0xe0e3('0x14a')](db[_0xe0e3('0x5b')],{'onDelete':_0xe0e3('0x15d'),'foreignKey':'OpenchannelQueueId'});db[_0xe0e3('0x180')]['belongsTo'](db[_0xe0e3('0x56')],{'onDelete':_0xe0e3('0x15d'),'foreignKey':_0xe0e3('0x17e')});db[_0xe0e3('0x180')][_0xe0e3('0x14a')](db[_0xe0e3('0x7e')],{'onDelete':'restrict','foreignKey':'IntervalId'});db['OpenchannelApplication']['belongsTo'](db[_0xe0e3('0x87')],{'onDelete':'restrict','foreignKey':_0xe0e3('0x16d')});db[_0xe0e3('0x129')][_0xe0e3('0x10a')](db[_0xe0e3('0x59')],{'as':_0xe0e3('0x160'),'onDelete':_0xe0e3('0x10f'),'foreignKey':_0xe0e3('0x181')});db['OpenchannelInteraction']['belongsTo'](db[_0xe0e3('0x56')],{'as':_0xe0e3('0x165'),'foreignKey':_0xe0e3('0x17e')});db[_0xe0e3('0x129')]['belongsTo'](db[_0xe0e3('0x121')],{'as':_0xe0e3('0x15a'),'foreignKey':_0xe0e3('0x15b')});db[_0xe0e3('0x129')]['belongsTo'](db[_0xe0e3('0x13')],{'as':_0xe0e3('0x166'),'foreignKey':_0xe0e3('0x107')});db[_0xe0e3('0x129')][_0xe0e3('0x11e')](db[_0xe0e3('0x87')],{'through':_0xe0e3('0x182'),'as':_0xe0e3('0x167')});db[_0xe0e3('0x129')]['belongsToMany'](db['Tag'],{'through':_0xe0e3('0x182'),'as':_0xe0e3('0x169')});db[_0xe0e3('0x129')]['belongsToMany'](db[_0xe0e3('0x13')],{'as':'Users','through':_0xe0e3('0x12a'),'foreignKey':'OpenchannelInteractionId'});db[_0xe0e3('0x59')]['belongsTo'](db[_0xe0e3('0x13')],{'onDelete':_0xe0e3('0x10f'),'as':_0xe0e3('0x13')});db[_0xe0e3('0x59')][_0xe0e3('0x14a')](db['CmContact'],{'onDelete':_0xe0e3('0x10f'),'as':_0xe0e3('0x15a')});db['OpenchannelMessage']['belongsTo'](db[_0xe0e3('0x129')],{'onDelete':_0xe0e3('0x10f'),'as':_0xe0e3('0x16b'),'foreignKey':_0xe0e3('0x181')});db[_0xe0e3('0x59')][_0xe0e3('0x14a')](db[_0xe0e3('0x16a')],{'as':_0xe0e3('0x16a'),'foreignKey':_0xe0e3('0x176')});db[_0xe0e3('0x59')][_0xe0e3('0x14a')](db[_0xe0e3('0x56')],{'as':_0xe0e3('0x165'),'foreignKey':'OpenchannelAccountId'});db[_0xe0e3('0x5b')][_0xe0e3('0x11e')](db[_0xe0e3('0x13')],{'as':_0xe0e3('0x150'),'through':'UserOpenchannelQueue','foreignKey':_0xe0e3('0x183')});db[_0xe0e3('0x5b')][_0xe0e3('0x11e')](db[_0xe0e3('0xde')],{'through':_0xe0e3('0x184'),'as':'Teams'});db[_0xe0e3('0x5d')]['hasMany'](db[_0xe0e3('0x16f')],{'as':_0xe0e3('0x170'),'foreignKey':_0xe0e3('0x16c'),'onDelete':'cascade'});db[_0xe0e3('0x5d')][_0xe0e3('0x10a')](db['CannedAnswer'],{'as':_0xe0e3('0x179'),'foreignKey':_0xe0e3('0x16c')});db[_0xe0e3('0x5d')]['hasMany'](db[_0xe0e3('0x6a')],{'as':_0xe0e3('0x185')});db[_0xe0e3('0x5d')][_0xe0e3('0x10a')](db[_0xe0e3('0x62')],{'as':'Interactions'});db['ChatWebsite'][_0xe0e3('0x10a')](db[_0xe0e3('0x60')],{'as':_0xe0e3('0x142'),'foreignKey':_0xe0e3('0x16c'),'onDelete':_0xe0e3('0x10f')});db[_0xe0e3('0x5d')]['hasMany'](db[_0xe0e3('0x186')],{'as':'Messages'});db[_0xe0e3('0x5d')]['belongsTo'](db['CmList'],{'as':'List','foreignKey':_0xe0e3('0x162')});db[_0xe0e3('0x5d')][_0xe0e3('0x14a')](db[_0xe0e3('0x7e')],{'as':'Interval','foreignKey':_0xe0e3('0x14d')});db[_0xe0e3('0x5d')][_0xe0e3('0x14a')](db[_0xe0e3('0x38')],{'as':_0xe0e3('0x38'),'foreignKey':'MailAccountId'});db['ChatWebsite']['belongsTo'](db[_0xe0e3('0x80')],{'as':_0xe0e3('0x14e'),'foreignKey':_0xe0e3('0x14f')});db['ChatWebsite'][_0xe0e3('0x11e')](db[_0xe0e3('0x13')],{'as':_0xe0e3('0x150'),'through':_0xe0e3('0x187')});db['OpenchannelQueueReport'][_0xe0e3('0x14a')](db[_0xe0e3('0x56')],{});db[_0xe0e3('0x5e')]['belongsTo'](db[_0xe0e3('0x123')],{'as':_0xe0e3('0x161'),'foreignKey':_0xe0e3('0x162')});db['OpenchannelQueueReport'][_0xe0e3('0x14a')](db[_0xe0e3('0x121')],{'as':'Contact','foreignKey':_0xe0e3('0x15b')});db[_0xe0e3('0x5e')][_0xe0e3('0x14a')](db[_0xe0e3('0x129')],{});db['OpenchannelQueueReport'][_0xe0e3('0x14a')](db[_0xe0e3('0x59')],{});db[_0xe0e3('0x5e')]['belongsTo'](db[_0xe0e3('0x13')],{});db[_0xe0e3('0x5e')][_0xe0e3('0x14a')](db[_0xe0e3('0x5b')],{});db[_0xe0e3('0x60')][_0xe0e3('0x14a')](db[_0xe0e3('0x13')],{'as':_0xe0e3('0x188'),'foreignKey':_0xe0e3('0x107'),'onDelete':_0xe0e3('0x15d')});db[_0xe0e3('0x60')]['belongsTo'](db[_0xe0e3('0x66')],{'as':_0xe0e3('0x189'),'foreignKey':_0xe0e3('0x18a'),'onDelete':'restrict'});db[_0xe0e3('0x60')][_0xe0e3('0x14a')](db[_0xe0e3('0x5d')],{'as':'Website','foreignKey':_0xe0e3('0x16c'),'onDelete':_0xe0e3('0x15d')});db[_0xe0e3('0x60')][_0xe0e3('0x14a')](db['Tag'],{'onDelete':_0xe0e3('0x15d'),'foreignKey':'TagId'});db[_0xe0e3('0x62')][_0xe0e3('0x10a')](db[_0xe0e3('0x186')],{'as':'Messages','onDelete':_0xe0e3('0x10f'),'foreignKey':'ChatInteractionId'});db[_0xe0e3('0x62')][_0xe0e3('0x14a')](db['ChatWebsite'],{'as':_0xe0e3('0x165'),'foreignKey':_0xe0e3('0x16c')});db[_0xe0e3('0x62')]['belongsTo'](db['CmContact'],{'as':_0xe0e3('0x15a'),'foreignKey':_0xe0e3('0x15b')});db[_0xe0e3('0x62')][_0xe0e3('0x14a')](db[_0xe0e3('0x13')],{'as':_0xe0e3('0x166'),'foreignKey':_0xe0e3('0x107')});db[_0xe0e3('0x62')][_0xe0e3('0x11e')](db[_0xe0e3('0x87')],{'through':_0xe0e3('0x18b'),'as':_0xe0e3('0x167')});db[_0xe0e3('0x62')][_0xe0e3('0x11e')](db['Tag'],{'through':_0xe0e3('0x18b'),'as':_0xe0e3('0x169')});db['ChatInteraction'][_0xe0e3('0x11e')](db['User'],{'as':_0xe0e3('0x174'),'through':'user_has_chat_interactions','foreignKey':_0xe0e3('0x18c')});db[_0xe0e3('0x186')]['belongsTo'](db[_0xe0e3('0x13')],{'onDelete':'cascade','as':_0xe0e3('0x13')});db[_0xe0e3('0x186')][_0xe0e3('0x14a')](db[_0xe0e3('0x121')],{'onDelete':'cascade','as':_0xe0e3('0x15a'),'foreignKey':'ContactId'});db[_0xe0e3('0x186')][_0xe0e3('0x14a')](db['ChatInteraction'],{'onDelete':_0xe0e3('0x10f'),'as':_0xe0e3('0x16b'),'foreignKey':'ChatInteractionId'});db['ChatMessage'][_0xe0e3('0x14a')](db[_0xe0e3('0x16a')],{'as':_0xe0e3('0x16a'),'foreignKey':_0xe0e3('0x176')});db['ChatMessage'][_0xe0e3('0x14a')](db[_0xe0e3('0x5d')],{'as':_0xe0e3('0x165'),'foreignKey':_0xe0e3('0x16c')});db['ChatOfflineMessage'][_0xe0e3('0x10a')](db[_0xe0e3('0x16a')],{'as':_0xe0e3('0x18d'),'foreignKey':_0xe0e3('0x18e'),'onDelete':_0xe0e3('0x10f'),'hooks':!![]});db['ChatOfflineMessage'][_0xe0e3('0x14a')](db[_0xe0e3('0x121')],{'onDelete':_0xe0e3('0x10f'),'as':_0xe0e3('0x15a'),'foreignKey':_0xe0e3('0x15b')});db[_0xe0e3('0x64')][_0xe0e3('0x14a')](db[_0xe0e3('0x5d')],{'as':'Account','foreignKey':'ChatWebsiteId'});db[_0xe0e3('0x66')][_0xe0e3('0x11e')](db['User'],{'as':_0xe0e3('0x150'),'through':_0xe0e3('0x30'),'hooks':!![]});db['ChatQueue']['belongsToMany'](db['Team'],{'through':_0xe0e3('0x18f'),'as':_0xe0e3('0x151')});db[_0xe0e3('0x68')][_0xe0e3('0x10a')](db['ChatInternalMessage'],{'as':'Messages','foreignKey':_0xe0e3('0x190'),'onDelete':_0xe0e3('0x10f')});db[_0xe0e3('0x68')][_0xe0e3('0x11e')](db[_0xe0e3('0x13')],{'as':'Members','through':'chat_group_has_users'});db[_0xe0e3('0x6a')][_0xe0e3('0x14a')](db[_0xe0e3('0x5d')],{'as':_0xe0e3('0x191'),'foreignKey':_0xe0e3('0x16c')});db['CmCompany'][_0xe0e3('0x10a')](db[_0xe0e3('0x121')],{'as':_0xe0e3('0x122'),'foreignKey':_0xe0e3('0x192')});db[_0xe0e3('0x121')]['hasMany'](db[_0xe0e3('0x8a')],{'as':_0xe0e3('0x193'),'foreignKey':_0xe0e3('0x194')});db['CmContact']['hasMany'](db[_0xe0e3('0x6e')],{'as':_0xe0e3('0x195'),'foreignKey':_0xe0e3('0x15b')});db[_0xe0e3('0x121')][_0xe0e3('0x10a')](db[_0xe0e3('0x110')],{'as':'HopperFinals','foreignKey':_0xe0e3('0x15b')});db['CmContact']['hasMany'](db[_0xe0e3('0x73')],{'as':_0xe0e3('0x196'),'foreignKey':'ContactId'});db[_0xe0e3('0x121')][_0xe0e3('0x10a')](db[_0xe0e3('0x75')],{'as':_0xe0e3('0x75'),'foreignKey':_0xe0e3('0x15b')});db[_0xe0e3('0x121')][_0xe0e3('0x10a')](db[_0xe0e3('0x149')],{'as':_0xe0e3('0x197'),'foreignKey':_0xe0e3('0x15b')});db[_0xe0e3('0x121')][_0xe0e3('0x10a')](db['OpenchannelInteraction'],{'as':_0xe0e3('0x112'),'foreignKey':_0xe0e3('0x15b'),'onDelete':_0xe0e3('0x15d')});db['CmContact'][_0xe0e3('0x10a')](db[_0xe0e3('0x62')],{'as':_0xe0e3('0x113'),'foreignKey':_0xe0e3('0x15b'),'onDelete':_0xe0e3('0x15d')});db[_0xe0e3('0x121')][_0xe0e3('0x10a')](db['SmsInteraction'],{'as':'SmsInteractions','foreignKey':_0xe0e3('0x15b'),'onDelete':_0xe0e3('0x15d')});db[_0xe0e3('0x121')]['hasMany'](db[_0xe0e3('0x115')],{'as':_0xe0e3('0x116'),'foreignKey':_0xe0e3('0x15b'),'onDelete':_0xe0e3('0x15d')});db[_0xe0e3('0x121')]['hasMany'](db[_0xe0e3('0x3e')],{'as':'MailInteractions','foreignKey':'ContactId','onDelete':_0xe0e3('0x15d')});db[_0xe0e3('0x121')][_0xe0e3('0x14a')](db['CmCompany'],{'as':_0xe0e3('0x198'),'foreignKey':_0xe0e3('0x192')});db['CmContact']['belongsTo'](db[_0xe0e3('0x123')],{'as':'List','foreignKey':_0xe0e3('0x162'),'onDelete':_0xe0e3('0x10f')});db['CmContact']['belongsToMany'](db['User'],{'as':'Users','through':_0xe0e3('0x199')});db[_0xe0e3('0x121')][_0xe0e3('0x11e')](db[_0xe0e3('0x87')],{'as':_0xe0e3('0x167'),'through':_0xe0e3('0x19a')});db[_0xe0e3('0x121')]['belongsToMany'](db[_0xe0e3('0x87')],{'through':_0xe0e3('0x19a'),'as':'ThroughTags'});db[_0xe0e3('0x6e')][_0xe0e3('0x10a')](db[_0xe0e3('0x8c')],{'as':_0xe0e3('0x19b'),'foreignKey':_0xe0e3('0x19c')});db['CmHopper'][_0xe0e3('0x14a')](db[_0xe0e3('0x121')],{'as':_0xe0e3('0x15a'),'foreignKey':_0xe0e3('0x15b'),'onDelete':_0xe0e3('0x10f')});db[_0xe0e3('0x6e')][_0xe0e3('0x14a')](db[_0xe0e3('0x123')],{'as':_0xe0e3('0x161'),'foreignKey':_0xe0e3('0x162'),'onDelete':_0xe0e3('0x10f')});db[_0xe0e3('0x6e')][_0xe0e3('0x14a')](db['User'],{'as':_0xe0e3('0x188'),'foreignKey':_0xe0e3('0x107')});db[_0xe0e3('0x6e')][_0xe0e3('0x14a')](db[_0xe0e3('0x145')],{'as':_0xe0e3('0x189'),'foreignKey':_0xe0e3('0x147'),'onDelete':_0xe0e3('0x10f')});db['CmHopper'][_0xe0e3('0x14a')](db[_0xe0e3('0xe2')],{'as':_0xe0e3('0xe2'),'foreignKey':_0xe0e3('0x19d'),'onDelete':_0xe0e3('0x10f')});db[_0xe0e3('0x6e')][_0xe0e3('0x14a')](db[_0xe0e3('0x13')],{'as':'Owner','foreignKey':_0xe0e3('0x19e')});db[_0xe0e3('0x70')]['belongsTo'](db[_0xe0e3('0x121')],{'as':'Contact','foreignKey':_0xe0e3('0x15b'),'onDelete':_0xe0e3('0x10f')});db[_0xe0e3('0x70')][_0xe0e3('0x14a')](db[_0xe0e3('0x123')],{'as':'List','foreignKey':'ListId','onDelete':_0xe0e3('0x10f')});db[_0xe0e3('0x70')][_0xe0e3('0x14a')](db[_0xe0e3('0x145')],{'as':_0xe0e3('0x189'),'foreignKey':'VoiceQueueId','onDelete':_0xe0e3('0x10f')});db[_0xe0e3('0x70')][_0xe0e3('0x14a')](db[_0xe0e3('0xe2')],{'as':_0xe0e3('0xe2'),'foreignKey':'CampaignId','onDelete':_0xe0e3('0x10f')});db[_0xe0e3('0x78')]['hasMany'](db['Condition'],{'as':{'plural':_0xe0e3('0x19f'),'singular':_0xe0e3('0x1a0')},'foreignKey':'AutomationAllId','onDelete':_0xe0e3('0x10f'),'hooks':!![]});db[_0xe0e3('0x78')][_0xe0e3('0x10a')](db[_0xe0e3('0x7c')],{'as':{'plural':_0xe0e3('0x1a1'),'singular':'OneAny'},'foreignKey':_0xe0e3('0x1a2'),'onDelete':_0xe0e3('0x10f'),'hooks':!![]});db[_0xe0e3('0x78')][_0xe0e3('0x10a')](db[_0xe0e3('0x1a3')],{'as':_0xe0e3('0x1a4'),'foreignKey':_0xe0e3('0x1a5'),'onDelete':'cascade','hooks':!![]});db[_0xe0e3('0x16f')][_0xe0e3('0x10a')](db[_0xe0e3('0x16f')],{'as':'Dispositions','foreignKey':'ParentId','onDelete':'cascade'});db[_0xe0e3('0x7e')][_0xe0e3('0x10a')](db[_0xe0e3('0x7e')],{'as':'Intervals','foreignKey':'IntervalId','onDelete':_0xe0e3('0x10f'),'hooks':!![],'required':![]});db[_0xe0e3('0x7e')]['hasMany'](db['VoiceExtension'],{'as':'Extensions','foreignKey':'IntervalId','onDelete':_0xe0e3('0x15d')});db[_0xe0e3('0x7e')][_0xe0e3('0x10a')](db['MailApplication'],{'as':_0xe0e3('0x1a6'),'foreignKey':'IntervalId'});db[_0xe0e3('0x7e')][_0xe0e3('0x10a')](db[_0xe0e3('0x60')],{'as':_0xe0e3('0x1a7'),'foreignKey':_0xe0e3('0x14d')});db[_0xe0e3('0x7e')][_0xe0e3('0x10a')](db[_0xe0e3('0x48')],{'as':_0xe0e3('0x1a8'),'foreignKey':_0xe0e3('0x14d')});db[_0xe0e3('0x7e')]['hasMany'](db['SmsApplication'],{'as':'SmsApplications','foreignKey':_0xe0e3('0x14d')});db[_0xe0e3('0x84')][_0xe0e3('0x14a')](db[_0xe0e3('0x38')],{});db[_0xe0e3('0x84')][_0xe0e3('0x14a')](db['AnalyticDefaultReport'],{'foreignKey':_0xe0e3('0x1a9')});db['Schedule'][_0xe0e3('0x14a')](db[_0xe0e3('0x95')],{'foreignKey':_0xe0e3('0x1aa')});db[_0xe0e3('0x85')]['belongsToMany'](db[_0xe0e3('0x19')],{'as':_0xe0e3('0x1ab'),'through':'moh_has_sounds','onDelete':_0xe0e3('0x15d')});db[_0xe0e3('0x87')][_0xe0e3('0x11e')](db[_0xe0e3('0x121')],{'through':'cm_contact_has_tags'});db[_0xe0e3('0x87')][_0xe0e3('0x11e')](db[_0xe0e3('0x62')],{'through':_0xe0e3('0x18b')});db[_0xe0e3('0x87')][_0xe0e3('0x11e')](db[_0xe0e3('0x3e')],{'through':_0xe0e3('0x168')});db[_0xe0e3('0x87')][_0xe0e3('0x11e')](db[_0xe0e3('0x114')],{'through':_0xe0e3('0x17b')});db[_0xe0e3('0x87')][_0xe0e3('0x11e')](db[_0xe0e3('0x115')],{'through':_0xe0e3('0x173')});db[_0xe0e3('0x87')][_0xe0e3('0x11e')](db[_0xe0e3('0x129')],{'through':_0xe0e3('0x182')});db['Tag'][_0xe0e3('0x11e')](db['WhatsappInteraction'],{'through':'whatsapp_interaction_has_tags'});db[_0xe0e3('0x8a')][_0xe0e3('0x14a')](db[_0xe0e3('0x89')],{'as':_0xe0e3('0x1ac'),'foreignKey':_0xe0e3('0x1ad')});db[_0xe0e3('0x8c')][_0xe0e3('0x14a')](db['CmHopper'],{'as':_0xe0e3('0x1ae'),'foreignKey':_0xe0e3('0x19c')});db[_0xe0e3('0x8a')][_0xe0e3('0x14a')](db['CmContact'],{'as':_0xe0e3('0x15a'),'foreignKey':_0xe0e3('0x194')});db[_0xe0e3('0x90')][_0xe0e3('0x10a')](db[_0xe0e3('0x7c')],{'as':{'plural':_0xe0e3('0x1af'),'singular':_0xe0e3('0x1b0')},'foreignKey':_0xe0e3('0x1b1'),'onDelete':'cascade','hooks':!![]});db[_0xe0e3('0x90')][_0xe0e3('0x10a')](db[_0xe0e3('0x7c')],{'as':{'plural':'AnyConditions','singular':_0xe0e3('0x1b2')},'foreignKey':_0xe0e3('0x1b3'),'onDelete':_0xe0e3('0x10f'),'hooks':!![]});db[_0xe0e3('0x90')][_0xe0e3('0x10a')](db['Action'],{'as':_0xe0e3('0x1a4'),'foreignKey':_0xe0e3('0x1b4'),'onDelete':_0xe0e3('0x10f'),'hooks':!![]});db[_0xe0e3('0x95')][_0xe0e3('0x10a')](db[_0xe0e3('0x9c')],{'as':_0xe0e3('0x1b5'),'onDelete':_0xe0e3('0x10f'),'foreignKey':_0xe0e3('0x1aa'),'hooks':!![]});db[_0xe0e3('0x96')][_0xe0e3('0x10a')](db['AnalyticFieldReport'],{'as':_0xe0e3('0x1b5'),'onDelete':_0xe0e3('0x10f'),'foreignKey':_0xe0e3('0x1a9')});db[_0xe0e3('0x9a')]['hasMany'](db[_0xe0e3('0x9c')],{'as':_0xe0e3('0x1b5'),'onDelete':_0xe0e3('0x10f'),'foreignKey':_0xe0e3('0x1b6')});db['AnalyticFieldReport'][_0xe0e3('0x14a')](db[_0xe0e3('0x9a')],{'foreignKey':_0xe0e3('0x1b6')});db[_0xe0e3('0x9f')][_0xe0e3('0x10a')](db[_0xe0e3('0xa0')],{'as':_0xe0e3('0x1b7'),'onDelete':_0xe0e3('0x10f'),'foreignKey':_0xe0e3('0x1b8')});db['SalesforceConfiguration'][_0xe0e3('0x10a')](db[_0xe0e3('0x1b9')],{'as':_0xe0e3('0x1ba'),'onDelete':'cascade','foreignKey':'SubjectId'});db[_0xe0e3('0xa0')][_0xe0e3('0x10a')](db[_0xe0e3('0x1b9')],{'as':_0xe0e3('0x1bb'),'onDelete':'cascade','foreignKey':_0xe0e3('0x1bc')});db[_0xe0e3('0xa0')]['hasMany'](db[_0xe0e3('0x1b9')],{'as':'Fields','onDelete':_0xe0e3('0x10f'),'foreignKey':'FieldId'});db['SalesforceConfiguration'][_0xe0e3('0x14a')](db['SalesforceAccount'],{'as':_0xe0e3('0x165'),'foreignKey':'AccountId'});db[_0xe0e3('0x1b9')][_0xe0e3('0x10a')](db[_0xe0e3('0x1b9')],{'as':'Subject','foreignKey':_0xe0e3('0x1bd')});db[_0xe0e3('0x1b9')][_0xe0e3('0x10a')](db['SalesforceField'],{'as':_0xe0e3('0x1be'),'foreignKey':_0xe0e3('0x1bc')});db['SalesforceField'][_0xe0e3('0x10a')](db[_0xe0e3('0x1b9')],{'as':_0xe0e3('0x1bf'),'foreignKey':_0xe0e3('0x1c0')});db[_0xe0e3('0x1b9')][_0xe0e3('0x14a')](db[_0xe0e3('0x91')],{'as':'Variable','foreignKey':'VariableId'});db[_0xe0e3('0xa2')][_0xe0e3('0x10a')](db['SugarcrmConfiguration'],{'as':_0xe0e3('0x1b7'),'onDelete':_0xe0e3('0x10f'),'foreignKey':'AccountId'});db[_0xe0e3('0xa3')]['hasMany'](db[_0xe0e3('0xa4')],{'as':'Subjects','onDelete':_0xe0e3('0x10f'),'foreignKey':'SubjectId'});db['SugarcrmConfiguration']['hasMany'](db[_0xe0e3('0xa4')],{'as':_0xe0e3('0x1bb'),'onDelete':_0xe0e3('0x10f'),'foreignKey':_0xe0e3('0x1bc')});db[_0xe0e3('0xa3')][_0xe0e3('0x10a')](db[_0xe0e3('0xa4')],{'as':_0xe0e3('0x1b5'),'onDelete':_0xe0e3('0x10f'),'foreignKey':_0xe0e3('0x1c0')});db[_0xe0e3('0xa3')]['belongsTo'](db[_0xe0e3('0xa2')],{'as':'Account','foreignKey':_0xe0e3('0x1b8')});db['SugarcrmField']['hasMany'](db[_0xe0e3('0xa4')],{'as':'Subject','foreignKey':_0xe0e3('0x1bd')});db[_0xe0e3('0xa4')]['hasMany'](db['SugarcrmField'],{'as':_0xe0e3('0x1be'),'foreignKey':_0xe0e3('0x1bc')});db[_0xe0e3('0xa4')][_0xe0e3('0x10a')](db[_0xe0e3('0xa4')],{'as':_0xe0e3('0x1bf'),'foreignKey':_0xe0e3('0x1c0')});db[_0xe0e3('0xa4')][_0xe0e3('0x14a')](db[_0xe0e3('0x91')],{'as':_0xe0e3('0x91'),'foreignKey':'VariableId'});db['DeskAccount'][_0xe0e3('0x10a')](db[_0xe0e3('0xa6')],{'as':_0xe0e3('0x1b7'),'onDelete':_0xe0e3('0x10f'),'foreignKey':_0xe0e3('0x1b8')});db['DeskConfiguration']['hasMany'](db[_0xe0e3('0xa7')],{'as':_0xe0e3('0x1ba'),'onDelete':_0xe0e3('0x10f'),'foreignKey':'SubjectId'});db[_0xe0e3('0xa6')][_0xe0e3('0x10a')](db[_0xe0e3('0xa7')],{'as':'Descriptions','onDelete':'cascade','foreignKey':'DescriptionId'});db[_0xe0e3('0xa6')]['hasMany'](db[_0xe0e3('0xa7')],{'as':_0xe0e3('0x1b5'),'onDelete':'cascade','foreignKey':'FieldId'});db[_0xe0e3('0xa6')]['belongsTo'](db['DeskAccount'],{'as':'Account','foreignKey':_0xe0e3('0x1b8')});db[_0xe0e3('0xa6')][_0xe0e3('0x11e')](db[_0xe0e3('0x87')],{'through':_0xe0e3('0x1c1')});db[_0xe0e3('0xa7')][_0xe0e3('0x10a')](db[_0xe0e3('0xa7')],{'as':_0xe0e3('0x1c2'),'foreignKey':_0xe0e3('0x1bd')});db[_0xe0e3('0xa7')]['hasMany'](db[_0xe0e3('0xa7')],{'as':_0xe0e3('0x1be'),'foreignKey':_0xe0e3('0x1bc')});db[_0xe0e3('0xa7')][_0xe0e3('0x10a')](db[_0xe0e3('0xa7')],{'as':_0xe0e3('0x1bf'),'foreignKey':_0xe0e3('0x1c0')});db[_0xe0e3('0xa7')][_0xe0e3('0x14a')](db[_0xe0e3('0x91')],{'as':_0xe0e3('0x91'),'foreignKey':_0xe0e3('0x1c3')});db[_0xe0e3('0xa9')][_0xe0e3('0x10a')](db[_0xe0e3('0xab')],{'as':_0xe0e3('0x1b7'),'onDelete':_0xe0e3('0x10f'),'foreignKey':_0xe0e3('0x1b8')});db[_0xe0e3('0xab')][_0xe0e3('0x10a')](db[_0xe0e3('0x1c4')],{'as':_0xe0e3('0x1ba'),'onDelete':'cascade','foreignKey':'SubjectId'});db[_0xe0e3('0xab')][_0xe0e3('0x10a')](db[_0xe0e3('0x1c4')],{'as':_0xe0e3('0x1bb'),'onDelete':_0xe0e3('0x10f'),'foreignKey':_0xe0e3('0x1bc')});db[_0xe0e3('0xab')]['hasMany'](db[_0xe0e3('0x1c4')],{'as':_0xe0e3('0x1b5'),'onDelete':_0xe0e3('0x10f'),'foreignKey':_0xe0e3('0x1c0')});db[_0xe0e3('0xab')][_0xe0e3('0x14a')](db['ZohoAccount'],{'as':'Account','foreignKey':'AccountId'});db[_0xe0e3('0x1c4')]['hasMany'](db[_0xe0e3('0x1c4')],{'as':_0xe0e3('0x1c2'),'foreignKey':_0xe0e3('0x1bd')});db[_0xe0e3('0x1c4')][_0xe0e3('0x10a')](db[_0xe0e3('0x1c4')],{'as':_0xe0e3('0x1be'),'foreignKey':'DescriptionId'});db[_0xe0e3('0x1c4')][_0xe0e3('0x10a')](db[_0xe0e3('0x1c4')],{'as':_0xe0e3('0x1bf'),'foreignKey':'FieldId'});db[_0xe0e3('0x1c4')][_0xe0e3('0x14a')](db[_0xe0e3('0x91')],{'as':'Variable','foreignKey':_0xe0e3('0x1c3')});db[_0xe0e3('0x1c5')][_0xe0e3('0x10a')](db[_0xe0e3('0xae')],{'as':_0xe0e3('0x1b7'),'onDelete':_0xe0e3('0x10f'),'foreignKey':_0xe0e3('0x1b8')});db[_0xe0e3('0xae')][_0xe0e3('0x10a')](db[_0xe0e3('0xb0')],{'as':_0xe0e3('0x1ba'),'foreignKey':_0xe0e3('0x1bd')});db['ZendeskConfiguration']['hasMany'](db[_0xe0e3('0xb0')],{'as':'Descriptions','foreignKey':_0xe0e3('0x1bc')});db[_0xe0e3('0xae')][_0xe0e3('0x10a')](db['ZendeskField'],{'as':_0xe0e3('0x1b5'),'foreignKey':_0xe0e3('0x1c0')});db[_0xe0e3('0xae')][_0xe0e3('0x14a')](db[_0xe0e3('0x1c5')],{'as':_0xe0e3('0x165'),'foreignKey':_0xe0e3('0x1b8')});db[_0xe0e3('0xae')][_0xe0e3('0x11e')](db[_0xe0e3('0x87')],{'through':_0xe0e3('0x1c6')});db[_0xe0e3('0xb0')][_0xe0e3('0x10a')](db[_0xe0e3('0xb0')],{'as':_0xe0e3('0x1c2'),'foreignKey':_0xe0e3('0x1bd')});db[_0xe0e3('0xb0')][_0xe0e3('0x10a')](db[_0xe0e3('0xb0')],{'as':_0xe0e3('0x1be'),'foreignKey':_0xe0e3('0x1bc')});db[_0xe0e3('0xb0')][_0xe0e3('0x10a')](db[_0xe0e3('0xb0')],{'as':_0xe0e3('0x1bf'),'foreignKey':'FieldId'});db['ZendeskField']['belongsTo'](db[_0xe0e3('0x91')],{'as':'Variable','foreignKey':'VariableId'});db[_0xe0e3('0xb1')]['hasMany'](db[_0xe0e3('0xb3')],{'as':_0xe0e3('0x1b7'),'onDelete':'cascade','foreignKey':_0xe0e3('0x1b8')});db['FreshdeskConfiguration']['hasMany'](db['FreshdeskField'],{'as':_0xe0e3('0x1ba'),'onDelete':_0xe0e3('0x10f'),'foreignKey':_0xe0e3('0x1bd')});db[_0xe0e3('0xb3')][_0xe0e3('0x10a')](db[_0xe0e3('0x1c7')],{'as':'Descriptions','onDelete':_0xe0e3('0x10f'),'foreignKey':_0xe0e3('0x1bc')});db[_0xe0e3('0xb3')][_0xe0e3('0x10a')](db[_0xe0e3('0x1c7')],{'as':_0xe0e3('0x1b5'),'onDelete':_0xe0e3('0x10f'),'foreignKey':_0xe0e3('0x1c0')});db[_0xe0e3('0xb3')][_0xe0e3('0x14a')](db['FreshdeskAccount'],{'as':_0xe0e3('0x165'),'foreignKey':'AccountId'});db[_0xe0e3('0xb3')]['belongsToMany'](db[_0xe0e3('0x87')],{'through':_0xe0e3('0x1c8')});db[_0xe0e3('0x1c7')][_0xe0e3('0x10a')](db['FreshdeskField'],{'as':_0xe0e3('0x1c2'),'foreignKey':_0xe0e3('0x1bd')});db[_0xe0e3('0x1c7')][_0xe0e3('0x10a')](db['FreshdeskField'],{'as':_0xe0e3('0x1be'),'foreignKey':_0xe0e3('0x1bc')});db[_0xe0e3('0x1c7')]['hasMany'](db['FreshdeskField'],{'as':_0xe0e3('0x1bf'),'foreignKey':_0xe0e3('0x1c0')});db[_0xe0e3('0x1c7')]['belongsTo'](db['Variable'],{'as':_0xe0e3('0x91'),'foreignKey':_0xe0e3('0x1c3')});db[_0xe0e3('0xb6')][_0xe0e3('0x10a')](db[_0xe0e3('0x1c9')],{'as':_0xe0e3('0x1b7'),'onDelete':_0xe0e3('0x10f'),'foreignKey':_0xe0e3('0x1b8')});db[_0xe0e3('0x1c9')]['hasMany'](db[_0xe0e3('0xb9')],{'as':_0xe0e3('0x1ba'),'foreignKey':_0xe0e3('0x1bd')});db[_0xe0e3('0x1c9')][_0xe0e3('0x10a')](db['VtigerField'],{'as':_0xe0e3('0x1bb'),'foreignKey':'DescriptionId'});db['VtigerConfiguration'][_0xe0e3('0x10a')](db[_0xe0e3('0xb9')],{'as':_0xe0e3('0x1b5'),'foreignKey':'FieldId'});db[_0xe0e3('0x1c9')][_0xe0e3('0x14a')](db[_0xe0e3('0xb6')],{'as':_0xe0e3('0x165'),'foreignKey':_0xe0e3('0x1b8')});db[_0xe0e3('0xb9')][_0xe0e3('0x10a')](db['VtigerField'],{'as':_0xe0e3('0x1c2'),'foreignKey':_0xe0e3('0x1bd')});db[_0xe0e3('0xb9')][_0xe0e3('0x10a')](db[_0xe0e3('0xb9')],{'as':_0xe0e3('0x1be'),'foreignKey':_0xe0e3('0x1bc')});db[_0xe0e3('0xb9')][_0xe0e3('0x10a')](db[_0xe0e3('0xb9')],{'as':_0xe0e3('0x1bf'),'foreignKey':_0xe0e3('0x1c0')});db[_0xe0e3('0xb9')][_0xe0e3('0x14a')](db['Variable'],{'as':_0xe0e3('0x91'),'foreignKey':_0xe0e3('0x1c3')});db[_0xe0e3('0xbb')][_0xe0e3('0x10a')](db[_0xe0e3('0x1ca')],{'as':_0xe0e3('0x1b7'),'onDelete':'cascade','foreignKey':_0xe0e3('0x1b8')});db['ServicenowConfiguration'][_0xe0e3('0x10a')](db[_0xe0e3('0xbe')],{'as':_0xe0e3('0x1ba'),'foreignKey':_0xe0e3('0x1bd')});db[_0xe0e3('0x1ca')]['hasMany'](db[_0xe0e3('0xbe')],{'as':_0xe0e3('0x1bb'),'foreignKey':_0xe0e3('0x1bc')});db[_0xe0e3('0x1ca')][_0xe0e3('0x10a')](db[_0xe0e3('0xbe')],{'as':'Fields','foreignKey':_0xe0e3('0x1c0')});db[_0xe0e3('0x1ca')][_0xe0e3('0x14a')](db[_0xe0e3('0xbb')],{'as':_0xe0e3('0x165'),'foreignKey':_0xe0e3('0x1b8')});db[_0xe0e3('0xbe')][_0xe0e3('0x10a')](db[_0xe0e3('0xbe')],{'as':_0xe0e3('0x1c2'),'foreignKey':'SubjectId'});db['ServicenowField'][_0xe0e3('0x10a')](db['ServicenowField'],{'as':'Description','foreignKey':_0xe0e3('0x1bc')});db[_0xe0e3('0xbe')][_0xe0e3('0x10a')](db[_0xe0e3('0xbe')],{'as':_0xe0e3('0x1bf'),'foreignKey':_0xe0e3('0x1c0')});db['ServicenowField']['belongsTo'](db[_0xe0e3('0x91')],{'as':_0xe0e3('0x91'),'foreignKey':_0xe0e3('0x1c3')});db[_0xe0e3('0xc0')][_0xe0e3('0x10a')](db[_0xe0e3('0x1cb')],{'as':'Configurations','onDelete':'cascade','foreignKey':_0xe0e3('0x1b8')});db[_0xe0e3('0xc0')][_0xe0e3('0x14a')](db[_0xe0e3('0xfc')],{'as':'CloudProvider','foreignKey':_0xe0e3('0x15e')});db[_0xe0e3('0x1cb')][_0xe0e3('0x10a')](db['Dynamics365Field'],{'as':'Subjects','onDelete':_0xe0e3('0x10f'),'foreignKey':'SubjectId'});db[_0xe0e3('0x1cb')][_0xe0e3('0x10a')](db[_0xe0e3('0xc3')],{'as':_0xe0e3('0x1bb'),'onDelete':_0xe0e3('0x10f'),'foreignKey':_0xe0e3('0x1bc')});db['Dynamics365Configuration'][_0xe0e3('0x10a')](db[_0xe0e3('0xc3')],{'as':_0xe0e3('0x1b5'),'onDelete':_0xe0e3('0x10f'),'foreignKey':_0xe0e3('0x1c0')});db[_0xe0e3('0x1cb')]['belongsTo'](db[_0xe0e3('0xc0')],{'as':_0xe0e3('0x165'),'foreignKey':'AccountId'});db[_0xe0e3('0xc3')][_0xe0e3('0x10a')](db['Dynamics365Field'],{'as':_0xe0e3('0x1c2'),'foreignKey':_0xe0e3('0x1bd')});db[_0xe0e3('0xc3')][_0xe0e3('0x10a')](db[_0xe0e3('0xc3')],{'as':_0xe0e3('0x1be'),'foreignKey':'DescriptionId'});db['Dynamics365Field']['hasMany'](db[_0xe0e3('0xc3')],{'as':_0xe0e3('0x1bf'),'foreignKey':_0xe0e3('0x1c0')});db['Dynamics365Field'][_0xe0e3('0x14a')](db['Variable'],{'as':_0xe0e3('0x91'),'foreignKey':_0xe0e3('0x1c3')});db[_0xe0e3('0xc5')]['hasMany'](db[_0xe0e3('0xc7')],{'as':_0xe0e3('0x1b7'),'onDelete':_0xe0e3('0x10f'),'foreignKey':_0xe0e3('0x1b8')});db[_0xe0e3('0xc7')][_0xe0e3('0x10a')](db[_0xe0e3('0xc9')],{'as':_0xe0e3('0x1ba'),'foreignKey':'SubjectId'});db['FreshsalesConfiguration']['hasMany'](db[_0xe0e3('0xc9')],{'as':_0xe0e3('0x1bb'),'foreignKey':'DescriptionId'});db[_0xe0e3('0xc7')][_0xe0e3('0x10a')](db[_0xe0e3('0xc9')],{'as':'Fields','foreignKey':_0xe0e3('0x1c0')});db[_0xe0e3('0xc7')][_0xe0e3('0x14a')](db['FreshsalesAccount'],{'as':_0xe0e3('0x165'),'foreignKey':_0xe0e3('0x1b8')});db['FreshsalesField'][_0xe0e3('0x10a')](db[_0xe0e3('0xc9')],{'as':_0xe0e3('0x1c2'),'foreignKey':_0xe0e3('0x1bd')});db[_0xe0e3('0xc9')][_0xe0e3('0x10a')](db[_0xe0e3('0xc9')],{'as':_0xe0e3('0x1be'),'foreignKey':_0xe0e3('0x1bc')});db['FreshsalesField'][_0xe0e3('0x10a')](db[_0xe0e3('0xc9')],{'as':_0xe0e3('0x1bf'),'foreignKey':_0xe0e3('0x1c0')});db['FreshsalesField'][_0xe0e3('0x14a')](db[_0xe0e3('0x91')],{'as':'Variable','foreignKey':'VariableId'});db[_0xe0e3('0xcc')]['belongsTo'](db[_0xe0e3('0x5d')],{});db[_0xe0e3('0xcc')][_0xe0e3('0x14a')](db['CmList'],{'as':_0xe0e3('0x161'),'foreignKey':_0xe0e3('0x162')});db[_0xe0e3('0xcc')][_0xe0e3('0x14a')](db[_0xe0e3('0x121')],{'as':_0xe0e3('0x15a'),'foreignKey':_0xe0e3('0x15b')});db[_0xe0e3('0xcc')][_0xe0e3('0x14a')](db[_0xe0e3('0x62')],{});db[_0xe0e3('0xcc')][_0xe0e3('0x14a')](db[_0xe0e3('0x186')],{});db['ChatQueueReport'][_0xe0e3('0x14a')](db[_0xe0e3('0x13')],{});db[_0xe0e3('0xcc')][_0xe0e3('0x14a')](db[_0xe0e3('0x66')],{});db[_0xe0e3('0xce')][_0xe0e3('0x14a')](db['User'],{'onDelete':_0xe0e3('0x10f'),'foreignKey':_0xe0e3('0x1cc')});db['ChatInternalMessage'][_0xe0e3('0x14a')](db[_0xe0e3('0x13')],{'onDelete':'cascade','foreignKey':'ToId'});db['JscriptySessionReport'][_0xe0e3('0x10a')](db[_0xe0e3('0xd2')],{'foreignKey':_0xe0e3('0x1cd'),'onDelete':_0xe0e3('0x10f')});db['JscriptySessionReport'][_0xe0e3('0x10a')](db['JscriptyAnswerReport'],{'foreignKey':_0xe0e3('0x1cd'),'onDelete':_0xe0e3('0x10f')});db['SmsQueueReport'][_0xe0e3('0x14a')](db[_0xe0e3('0x4f')],{});db[_0xe0e3('0xd5')][_0xe0e3('0x14a')](db['CmList'],{'as':_0xe0e3('0x161'),'foreignKey':_0xe0e3('0x162')});db[_0xe0e3('0xd5')][_0xe0e3('0x14a')](db[_0xe0e3('0x121')],{'as':'Contact','foreignKey':_0xe0e3('0x15b')});db[_0xe0e3('0xd5')][_0xe0e3('0x14a')](db[_0xe0e3('0x114')],{});db['SmsQueueReport']['belongsTo'](db[_0xe0e3('0x53')],{});db['SmsQueueReport'][_0xe0e3('0x14a')](db[_0xe0e3('0x13')],{});db[_0xe0e3('0xd5')]['belongsTo'](db[_0xe0e3('0x55')],{});db[_0xe0e3('0xd7')][_0xe0e3('0x10a')](db[_0xe0e3('0x149')],{'foreignKey':_0xe0e3('0x1ce')});db[_0xe0e3('0xd7')][_0xe0e3('0x10a')](db['JscriptyQuestionReport'],{'foreignKey':_0xe0e3('0x1ce')});db[_0xe0e3('0xd7')][_0xe0e3('0x10a')](db[_0xe0e3('0xd0')],{'foreignKey':'ProjectId'});db[_0xe0e3('0xde')][_0xe0e3('0x11e')](db[_0xe0e3('0x13')],{'as':_0xe0e3('0x150'),'through':_0xe0e3('0x1cf')});db['Team']['belongsToMany'](db['VoiceQueue'],{'through':_0xe0e3('0xfe'),'as':_0xe0e3('0x12b')});db['Team']['belongsToMany'](db['MailQueue'],{'through':_0xe0e3('0x163'),'as':_0xe0e3('0x12d')});db[_0xe0e3('0xde')][_0xe0e3('0x11e')](db[_0xe0e3('0x66')],{'through':_0xe0e3('0x18f'),'as':_0xe0e3('0x12f')});db[_0xe0e3('0xde')][_0xe0e3('0x11e')](db['FaxQueue'],{'through':'team_has_fax_queues','as':_0xe0e3('0x130')});db['Team'][_0xe0e3('0x11e')](db[_0xe0e3('0x55')],{'through':_0xe0e3('0x1d0'),'as':'SmsQueues'});db[_0xe0e3('0xde')][_0xe0e3('0x11e')](db[_0xe0e3('0x5b')],{'through':_0xe0e3('0x184'),'as':_0xe0e3('0x132')});db['Team']['belongsToMany'](db['WhatsappQueue'],{'through':'team_has_whatsapp_queues','as':_0xe0e3('0x134')});db[_0xe0e3('0xde')][_0xe0e3('0x11e')](db[_0xe0e3('0xee')],{'through':_0xe0e3('0x100'),'as':_0xe0e3('0x12c')});db[_0xe0e3('0xe2')]['hasMany'](db[_0xe0e3('0x6e')],{'as':_0xe0e3('0x195'),'foreignKey':_0xe0e3('0x19d')});db[_0xe0e3('0xe2')][_0xe0e3('0x10a')](db[_0xe0e3('0x110')],{'as':_0xe0e3('0x111'),'foreignKey':'CampaignId'});db[_0xe0e3('0xe2')][_0xe0e3('0x10a')](db[_0xe0e3('0x73')],{'as':_0xe0e3('0x196'),'foreignKey':'CampaignId'});db['Campaign']['hasMany'](db[_0xe0e3('0x70')],{'as':_0xe0e3('0x148'),'foreignKey':_0xe0e3('0x19d')});db[_0xe0e3('0xe2')][_0xe0e3('0x14a')](db['Trunk'],{'as':_0xe0e3('0x2b'),'foreignKey':_0xe0e3('0x14b')});db[_0xe0e3('0xe2')][_0xe0e3('0x14a')](db[_0xe0e3('0x2b')],{'as':_0xe0e3('0x14c'),'foreignKey':_0xe0e3('0x1d1')});db['Campaign'][_0xe0e3('0x14a')](db[_0xe0e3('0x7e')],{'as':_0xe0e3('0x7e'),'foreignKey':_0xe0e3('0x14d')});db[_0xe0e3('0xe2')]['belongsTo'](db[_0xe0e3('0x1d2')],{'as':'SquareProject','foreignKey':'SquareProjectId'});db[_0xe0e3('0xe2')]['belongsToMany'](db[_0xe0e3('0x123')],{'as':_0xe0e3('0x1d3'),'through':'campaigns_has_cm_lists'});db[_0xe0e3('0xe2')][_0xe0e3('0x11e')](db['CmList'],{'as':_0xe0e3('0x152'),'through':_0xe0e3('0x1d4')});db[_0xe0e3('0x16a')][_0xe0e3('0x14a')](db[_0xe0e3('0x64')],{'as':'ChatOfflineMessage','foreignKey':_0xe0e3('0x18e')});db[_0xe0e3('0xe6')][_0xe0e3('0x14a')](db['MailMessage'],{});db[_0xe0e3('0xe6')][_0xe0e3('0x14a')](db['MailInteraction'],{});db[_0xe0e3('0xe6')][_0xe0e3('0x14a')](db[_0xe0e3('0x38')],{'foreignKey':_0xe0e3('0x1d5'),'as':'FromAccount'});db[_0xe0e3('0xe6')][_0xe0e3('0x14a')](db[_0xe0e3('0x13')],{'foreignKey':_0xe0e3('0x1d6'),'as':_0xe0e3('0x1d7')});db[_0xe0e3('0xe6')][_0xe0e3('0x14a')](db[_0xe0e3('0x13')],{'foreignKey':_0xe0e3('0x1d8'),'as':_0xe0e3('0x1d9')});db[_0xe0e3('0xe6')][_0xe0e3('0x14a')](db['MailQueue'],{'foreignKey':_0xe0e3('0x1da'),'as':_0xe0e3('0x1db')});db['MailTransferReport'][_0xe0e3('0x14a')](db[_0xe0e3('0x38')],{'foreignKey':_0xe0e3('0x1dc'),'as':_0xe0e3('0x1dd')});db[_0xe0e3('0xe8')][_0xe0e3('0x14a')](db[_0xe0e3('0x186')],{});db[_0xe0e3('0xe8')][_0xe0e3('0x14a')](db['ChatInteraction'],{});db['ChatTransferReport'][_0xe0e3('0x14a')](db[_0xe0e3('0x5d')],{'foreignKey':_0xe0e3('0x1de'),'as':_0xe0e3('0x1df')});db[_0xe0e3('0xe8')]['belongsTo'](db['User'],{'foreignKey':_0xe0e3('0x1d6'),'as':_0xe0e3('0x1d7')});db[_0xe0e3('0xe8')][_0xe0e3('0x14a')](db[_0xe0e3('0x13')],{'foreignKey':_0xe0e3('0x1d8'),'as':_0xe0e3('0x1d9')});db[_0xe0e3('0xe8')][_0xe0e3('0x14a')](db['ChatQueue'],{'foreignKey':_0xe0e3('0x1e0'),'as':_0xe0e3('0x1db')});db[_0xe0e3('0xe8')]['belongsTo'](db['ChatWebsite'],{'foreignKey':_0xe0e3('0x1e1'),'as':_0xe0e3('0x1dd')});db['FaxTransferReport'][_0xe0e3('0x14a')](db[_0xe0e3('0x4a')],{});db[_0xe0e3('0xea')][_0xe0e3('0x14a')](db[_0xe0e3('0x115')],{});db['FaxTransferReport']['belongsTo'](db[_0xe0e3('0x47')],{'foreignKey':_0xe0e3('0x1e2'),'as':'FromAccount'});db['FaxTransferReport'][_0xe0e3('0x14a')](db[_0xe0e3('0x13')],{'foreignKey':_0xe0e3('0x1d6'),'as':_0xe0e3('0x1d7')});db[_0xe0e3('0xea')][_0xe0e3('0x14a')](db[_0xe0e3('0x13')],{'foreignKey':_0xe0e3('0x1d8'),'as':_0xe0e3('0x1d9')});db[_0xe0e3('0xea')]['belongsTo'](db[_0xe0e3('0x4c')],{'foreignKey':_0xe0e3('0x1e3'),'as':_0xe0e3('0x1db')});db[_0xe0e3('0xea')][_0xe0e3('0x14a')](db[_0xe0e3('0x47')],{'foreignKey':'ToFaxAccountId','as':_0xe0e3('0x1dd')});db[_0xe0e3('0xeb')][_0xe0e3('0x14a')](db[_0xe0e3('0x59')],{});db['OpenchannelTransferReport']['belongsTo'](db['OpenchannelInteraction'],{});db[_0xe0e3('0xeb')][_0xe0e3('0x14a')](db[_0xe0e3('0x56')],{'foreignKey':_0xe0e3('0x1e4'),'as':_0xe0e3('0x1df')});db[_0xe0e3('0xeb')][_0xe0e3('0x14a')](db[_0xe0e3('0x13')],{'foreignKey':_0xe0e3('0x1d6'),'as':_0xe0e3('0x1d7')});db[_0xe0e3('0xeb')][_0xe0e3('0x14a')](db[_0xe0e3('0x13')],{'foreignKey':'ToUserId','as':_0xe0e3('0x1d9')});db[_0xe0e3('0xeb')][_0xe0e3('0x14a')](db[_0xe0e3('0x5b')],{'foreignKey':_0xe0e3('0x1e5'),'as':_0xe0e3('0x1db')});db[_0xe0e3('0xeb')][_0xe0e3('0x14a')](db[_0xe0e3('0x56')],{'foreignKey':_0xe0e3('0x1e6'),'as':'ToAccount'});db['SmsTransferReport'][_0xe0e3('0x14a')](db['SmsMessage'],{});db['SmsTransferReport']['belongsTo'](db[_0xe0e3('0x114')],{});db[_0xe0e3('0x1e7')]['belongsTo'](db['SmsAccount'],{'foreignKey':_0xe0e3('0x1e8'),'as':_0xe0e3('0x1df')});db[_0xe0e3('0x1e7')]['belongsTo'](db[_0xe0e3('0x13')],{'foreignKey':_0xe0e3('0x1d6'),'as':_0xe0e3('0x1d7')});db[_0xe0e3('0x1e7')][_0xe0e3('0x14a')](db[_0xe0e3('0x13')],{'foreignKey':'ToUserId','as':'ToAgent'});db[_0xe0e3('0x1e7')][_0xe0e3('0x14a')](db[_0xe0e3('0x55')],{'foreignKey':'ToSmsQueueId','as':_0xe0e3('0x1db')});db['SmsTransferReport'][_0xe0e3('0x14a')](db[_0xe0e3('0x4f')],{'foreignKey':_0xe0e3('0x1e9'),'as':_0xe0e3('0x1dd')});db['CmList'][_0xe0e3('0x10a')](db[_0xe0e3('0x16f')],{'as':'Dispositions','foreignKey':_0xe0e3('0x162'),'onDelete':_0xe0e3('0x10f')});db[_0xe0e3('0x123')]['hasMany'](db[_0xe0e3('0x1ea')],{'as':'CustomFields','foreignKey':_0xe0e3('0x162')});db[_0xe0e3('0x123')][_0xe0e3('0x10a')](db[_0xe0e3('0x121')],{'as':_0xe0e3('0x122'),'onDelete':_0xe0e3('0x10f'),'foreignKey':'ListId'});db['CmList'][_0xe0e3('0x10a')](db[_0xe0e3('0x110')],{'as':_0xe0e3('0x111'),'foreignKey':_0xe0e3('0x162')});db['CmList'][_0xe0e3('0x10a')](db['CmHopperHistory'],{'as':_0xe0e3('0x1eb'),'foreignKey':_0xe0e3('0x162')});db['CmList'][_0xe0e3('0x10a')](db['ReportAgentPreview'],{'as':_0xe0e3('0x75'),'foreignKey':_0xe0e3('0x162')});db[_0xe0e3('0x123')][_0xe0e3('0x11e')](db[_0xe0e3('0x145')],{'as':'Queues','through':'voice_queues_has_cm_lists'});db[_0xe0e3('0x123')][_0xe0e3('0x11e')](db[_0xe0e3('0x13')],{'as':'Agents','through':'cm_user_has_lists'});db['VoicePrefix'][_0xe0e3('0x10a')](db[_0xe0e3('0x10d')],{'as':_0xe0e3('0x10e'),'onDelete':'cascade'});db['VoicePrefix'][_0xe0e3('0x11e')](db['User'],{'as':'Agents','through':_0xe0e3('0x102')});db[_0xe0e3('0xee')][_0xe0e3('0x11e')](db[_0xe0e3('0xde')],{'through':_0xe0e3('0x100'),'as':'Teams'});db[_0xe0e3('0x11c')][_0xe0e3('0x10a')](db[_0xe0e3('0x13')],{'as':_0xe0e3('0x174'),'foreignKey':_0xe0e3('0x11d')});db[_0xe0e3('0x11c')]['hasMany'](db[_0xe0e3('0xf0')],{'as':'UserProfileSections','foreignKey':_0xe0e3('0x11d'),'onDelete':_0xe0e3('0x10f')});db[_0xe0e3('0xf0')]['hasMany'](db['UserProfileResource'],{'as':_0xe0e3('0x1ec'),'foreignKey':'sectionId','onDelete':_0xe0e3('0x10f')});db[_0xe0e3('0xf4')][_0xe0e3('0x10a')](db[_0xe0e3('0x16f')],{'as':_0xe0e3('0x170'),'foreignKey':_0xe0e3('0x1ed'),'onDelete':_0xe0e3('0x10f')});db[_0xe0e3('0xf4')][_0xe0e3('0x10a')](db[_0xe0e3('0x7a')],{'as':_0xe0e3('0x179'),'foreignKey':_0xe0e3('0x1ed')});db[_0xe0e3('0xf4')][_0xe0e3('0x10a')](db[_0xe0e3('0xf7')],{'as':_0xe0e3('0x160'),'foreignKey':'WhatsappAccountId'});db[_0xe0e3('0xf4')]['hasMany'](db['WhatsappInteraction'],{'as':_0xe0e3('0x17f')});db['WhatsappAccount']['hasMany'](db['WhatsappApplication'],{'as':'Applications','foreignKey':_0xe0e3('0x1ed'),'onDelete':'cascade'});db['WhatsappAccount']['belongsTo'](db['CmList'],{'as':_0xe0e3('0x161'),'foreignKey':_0xe0e3('0x162')});db[_0xe0e3('0xf4')][_0xe0e3('0x14a')](db[_0xe0e3('0x80')],{'as':_0xe0e3('0x14e'),'foreignKey':_0xe0e3('0x14f')});db['WhatsappAccount'][_0xe0e3('0x11e')](db[_0xe0e3('0x13')],{'as':'Agents','through':'user_has_whatsapp_accounts'});db[_0xe0e3('0x1ee')][_0xe0e3('0x14a')](db['User'],{'onDelete':_0xe0e3('0x15d')});db['WhatsappApplication'][_0xe0e3('0x14a')](db['WhatsappQueue'],{'onDelete':_0xe0e3('0x15d')});db[_0xe0e3('0x1ee')][_0xe0e3('0x14a')](db['WhatsappAccount'],{'onDelete':_0xe0e3('0x15d')});db[_0xe0e3('0x1ee')][_0xe0e3('0x14a')](db[_0xe0e3('0x7e')],{'onDelete':_0xe0e3('0x15d'),'foreignKey':_0xe0e3('0x14d')});db['WhatsappApplication'][_0xe0e3('0x14a')](db[_0xe0e3('0x87')],{'onDelete':_0xe0e3('0x15d'),'foreignKey':_0xe0e3('0x16d')});db['WhatsappInteraction'][_0xe0e3('0x10a')](db[_0xe0e3('0xf7')],{'as':_0xe0e3('0x160'),'onDelete':_0xe0e3('0x10f'),'foreignKey':'WhatsappInteractionId'});db[_0xe0e3('0xf6')][_0xe0e3('0x14a')](db['WhatsappAccount'],{'as':_0xe0e3('0x165'),'foreignKey':'WhatsappAccountId'});db[_0xe0e3('0xf6')][_0xe0e3('0x14a')](db[_0xe0e3('0x121')],{'as':_0xe0e3('0x15a'),'foreignKey':_0xe0e3('0x15b')});db[_0xe0e3('0xf6')][_0xe0e3('0x14a')](db[_0xe0e3('0x13')],{'as':_0xe0e3('0x166'),'foreignKey':_0xe0e3('0x107')});db[_0xe0e3('0xf6')][_0xe0e3('0x11e')](db['Tag'],{'through':'whatsapp_interaction_has_tags','as':_0xe0e3('0x167')});db[_0xe0e3('0xf6')]['belongsToMany'](db['Tag'],{'through':_0xe0e3('0x1ef'),'as':_0xe0e3('0x169')});db[_0xe0e3('0xf6')][_0xe0e3('0x11e')](db[_0xe0e3('0x13')],{'as':_0xe0e3('0x174'),'through':'user_has_whatsapp_interactions','foreignKey':'WhatsappInteractionId'});db['WhatsappMessage']['belongsTo'](db[_0xe0e3('0x13')],{'as':'User'});db[_0xe0e3('0xf7')][_0xe0e3('0x14a')](db['CmContact'],{'onDelete':_0xe0e3('0x10f'),'as':_0xe0e3('0x15a')});db[_0xe0e3('0xf7')][_0xe0e3('0x14a')](db['WhatsappInteraction'],{'onDelete':'cascade','as':_0xe0e3('0x16b'),'foreignKey':_0xe0e3('0x1f0')});db[_0xe0e3('0xf7')][_0xe0e3('0x14a')](db[_0xe0e3('0xf4')],{'as':'Account','foreignKey':_0xe0e3('0x1ed')});db[_0xe0e3('0x1f1')][_0xe0e3('0x14a')](db[_0xe0e3('0xf4')],{});db[_0xe0e3('0x1f1')][_0xe0e3('0x14a')](db['CmList'],{'as':'List','foreignKey':'ListId'});db['WhatsappQueueReport']['belongsTo'](db[_0xe0e3('0x121')],{'as':_0xe0e3('0x15a'),'foreignKey':_0xe0e3('0x15b')});db[_0xe0e3('0x1f1')][_0xe0e3('0x14a')](db['WhatsappInteraction'],{});db['WhatsappQueueReport']['belongsTo'](db['WhatsappQueue'],{});db[_0xe0e3('0x1f1')][_0xe0e3('0x14a')](db['WhatsappMessage'],{});db[_0xe0e3('0x1f1')]['belongsTo'](db[_0xe0e3('0x13')],{});db[_0xe0e3('0xf9')][_0xe0e3('0x14a')](db[_0xe0e3('0xf7')],{});db[_0xe0e3('0xf9')][_0xe0e3('0x14a')](db[_0xe0e3('0xf6')],{});db[_0xe0e3('0xf9')]['belongsTo'](db[_0xe0e3('0xf4')],{'foreignKey':'FromWhatsappAccountId','as':'FromAccount'});db[_0xe0e3('0xf9')][_0xe0e3('0x14a')](db[_0xe0e3('0xf4')],{'foreignKey':'ToWhatsappAccountId','as':_0xe0e3('0x1dd')});db[_0xe0e3('0xf9')][_0xe0e3('0x14a')](db[_0xe0e3('0xfb')],{'foreignKey':_0xe0e3('0x1f2'),'as':'ToQueue'});db[_0xe0e3('0xf9')][_0xe0e3('0x14a')](db[_0xe0e3('0x13')],{'foreignKey':_0xe0e3('0x1d6'),'as':_0xe0e3('0x1d7')});db['WhatsappTransferReport'][_0xe0e3('0x14a')](db[_0xe0e3('0x13')],{'foreignKey':_0xe0e3('0x1d8'),'as':_0xe0e3('0x1d9')});db['WhatsappQueue'][_0xe0e3('0x11e')](db[_0xe0e3('0x13')],{'as':_0xe0e3('0x150'),'through':_0xe0e3('0x135'),'foreignKey':_0xe0e3('0x1f3')});db[_0xe0e3('0xfb')][_0xe0e3('0x11e')](db[_0xe0e3('0xde')],{'through':_0xe0e3('0x1f4'),'as':_0xe0e3('0x151')});db['UserSetting'][_0xe0e3('0x14a')](db['User'],{'as':'user','foreignKey':_0xe0e3('0x107'),'onDelete':'cascade','hooks':!![]});db['CloudProvider'][_0xe0e3('0x108')](db[_0xe0e3('0xc0')],{'as':_0xe0e3('0xc0'),'onDelete':'restrict'});db[_0xe0e3('0xfc')][_0xe0e3('0x108')](db['MailServerIn'],{'as':'Imap','onDelete':_0xe0e3('0x15d')});db['CloudProvider'][_0xe0e3('0x108')](db[_0xe0e3('0x36')],{'as':_0xe0e3('0x15f'),'onDelete':_0xe0e3('0x15d')});module['exports']={'db':db,'dbH':dbH}; \ No newline at end of file +var _0x46cf=['SenderId','Hoppers','belongsTo','userProfileId','belongsToMany','Contacts','cm_user_has_contacts','Lists','user_has_teams','user_has_chat_interactions','FaxInteractions','user_has_fax_interactions','user_has_sms_interactions','OpenchannelInteractions','user_has_openchannel_interactions','user_has_whatsapp_interactions','VoicePrefixes','MailQueues','ChatQueues','FaxQueues','UserFaxQueue','SmsQueues','OpenchannelQueues','WhatsappQueue','WhatsappQueues','cm_user_has_lists','user_has_chat_websites','FaxAccounts','user_has_fax_accounts','user_has_mail_accounts','user_has_openchannel_accounts','SmsAccounts','user_has_sms_accounts','WhatsappAccount','WhatsappAccounts','user_has_whatsapp_accounts','VoiceExtension','SpiedAgents','ChanSpyId','Applications','Sounds','moh_has_sounds','VoiceQueueId','HopperHistories','HopperBlacks','JscriptySessions','TrunkId','TrunkBackupId','Interval','voice_queues_has_cm_lists','Agents','Teams','BlackLists','voice_queues_has_cm_blacklists','Messages','mailboxuser','mailbox','QueueCalls','uniqueid','AgentReports','Contact','MailServerIn','MailAccountId','CloudProviderId','restrict','Imap','Smtp','Dispositions','Answers','Interactions','List','ListId','Template','mandatoryDispositionPause','MailInteractionId','Account','mail_interaction_has_tags','Tags','ThroughTags','Users','user_has_mail_interactions','Attachments','ChatWebsiteId','ChatOfflineMessageId','TagId','MailQueueReport','ContactId','Exntensions','FaxMessage','mandatoryDispositionPauseId','FaxInteractionId','FaxAccountId','Owner','fax_interaction_has_tags','Interaction','team_has_fax_queues','SmsAccountId','IntervalId','SmsInteractionId','SmsQueueId','team_has_sms_queues','OpenchannelAccountId','openchannel_interaction_has_tags','OpenchannelInteractionId','AttachmentId','team_has_openchannel_queues','ProactiveActions','ChatApplication','Agent','Queue','ChatQueueId','Website','ChatInteractionId','team_has_chat_queues','chat_group_has_users','CmCompany','CmContactId','Company','CompanyId','cm_contact_has_tags','AdditionalPhones','CmHopperId','Campaign','CampaignId','OwnerId','OneAll','Any','OneAny','AutomationAnyId','Actions','AutomationId','Intervals','MailApplications','ChatApplications','FaxApplications','SmsApplications','AnalyticDefaultReport','CustomReportId','chat_interaction_has_tags','sms_interaction_has_tags','ItemType','ItemTypeId','Hopper','AllConditions','AllCondition','TriggerAllId','AnyConditions','AnyCondition','TriggerAnyId','TriggerId','Fields','AnalyticMetric','MetricId','Configurations','AccountId','SalesforceField','Subjects','SubjectId','DescriptionId','FieldId','Subject','Description','Field','VariableId','DeskAccount','DeskConfiguration','Descriptions','ZohoConfiguration','ZohoField','ZohoAccount','int_zendesk_configuration_has_tags','FreshdeskField','FreshdeskAccount','int_freshdesk_configuration_has_tags','ServicenowConfiguration','ServicenowField','FreshsalesConfiguration','FromId','ToId','SessionId','ProjectId','team_has_mail_queues','team_has_whatsapp_queues','TrunkBackup','SquareProjectId','campaigns_has_cm_lists','campaigns_has_cm_blacklists','ChatOfflineMessage','FromMailAccountId','FromAccount','FromUserId','FromAgent','ToAgent','ToMailQueueId','ToQueue','ToMailAccountId','ToAccount','ChatTransferReport','FromChatWebsiteId','ToUserId','ToChatQueueId','ToChatWebsiteId','FromFaxAccountId','ToFaxQueueId','ToFaxAccountId','OpenchannelTransferReport','FromOpenchannelAccountId','ToOpenchannelAccountId','FromSmsAccountId','ToSmsQueueId','ToSmsAccountId','CmCustomField','CustomFields','Queues','UserProfileSections','Resources','sectionId','WhatsappAccountId','WhatsappInteractionId','whatsapp_interaction_has_tags','WhatsappTransferReport','ToWhatsappAccountId','ToQueueId','user','../config/environment','sequelize','lodash','jstz','determine','defaultsDeep','xcall','xC@LL1234','127.0.0.1','name','utf8','sequelizeHistory','motion2','utf8mb4','utf8_general_ci','database','username','password','options','User','VoiceChanSpy','import','../api/voiceChanSpy/voiceChanSpy.model','VoiceContext','../api/voiceExtension/voiceExtension.model','VoiceMusicOnHold','../api/voiceMusicOnHold/voiceMusicOnHold.model','VoiceQueue','../api/voiceQueue/voiceQueue.model','VoiceRecording','ScreenRecording','../api/voiceMail/voiceMail.model','VoiceMailMessage','../api/voiceMailMessage/voiceMailMessage.model','VoiceCallReport','../api/voiceCallReport/voiceCallReport.model','VoiceDialReport','../api/voiceDialReport/voiceDialReport.model','VoiceAgentReport','../api/voiceAgentReport/voiceAgentReport.model','VoiceQueueReport','../api/voiceQueueReport/voiceQueueReport.model','MemberReport','../api/memberReport/memberReport.model','Trunk','../api/trunk/trunk.model','VoiceTransferReport','../api/userVoiceQueueRt/userVoiceQueueRt.model','UserVoiceQueue','UserChatQueue','../api/userChatQueue/userChatQueue.model','UserMailQueue','../api/userMailQueue/userMailQueue.model','../api/userFaxQueue/userFaxQueue.model','UserSmsQueue','../api/userSmsQueue/userSmsQueue.model','UserOpenchannelQueue','../api/userOpenchannelQueue/userOpenchannelQueue.model','UserWhatsappQueue','../api/userWhatsappQueue/userWhatsappQueue.model','../api/mailServerIn/mailServerIn.model','MailServerOut','MailAccount','../api/mailAccount/mailAccount.model','MailQueue','../api/mailQueue/mailQueue.model','MailSubstatus','MailInteraction','../api/mailInteraction/mailInteraction.model','MailMessage','MailApplication','../api/mailApplication/mailApplication.model','../api/mailQueueReport/mailQueueReport.model','Dashboard','../api/dashboard/dashboard.model','DashboardItem','FaxAccount','../api/faxAccount/faxAccount.model','FaxApplication','../api/faxApplication/faxApplication.model','FaxInteraction','FaxQueue','../api/faxQueue/faxQueue.model','FaxQueueReport','../api/faxQueueReport/faxQueueReport.model','SmsAccount','../api/smsAccount/smsAccount.model','SmsApplication','../api/smsApplication/smsApplication.model','SmsMessage','../api/smsMessage/smsMessage.model','SmsQueue','../api/smsQueue/smsQueue.model','OpenchannelAccount','../api/openchannelAccount/openchannelAccount.model','OpenchannelApplication','OpenchannelInteraction','../api/openchannelInteraction/openchannelInteraction.model','OpenchannelMessage','../api/openchannelMessage/openchannelMessage.model','OpenchannelQueue','../api/openchannelQueue/openchannelQueue.model','ChatWebsite','../api/chatWebsite/chatWebsite.model','OpenchannelQueueReport','../api/chatApplication/chatApplication.model','../api/chatInteraction/chatInteraction.model','ChatMessage','../api/chatOfflineMessage/chatOfflineMessage.model','ChatQueue','ChatGroup','../api/chatGroup/chatGroup.model','ChatProactiveAction','../api/chatProactiveAction/chatProactiveAction.model','../api/cmCompany/cmCompany.model','CmContact','../api/cmContact/cmContact.model','CmHopper','../api/cmHopper/cmHopper.model','CmHopperBlack','CmHopperFinal','../api/cmHopperFinal/cmHopperFinal.model','CmHopperHistory','../api/cmHopperHistory/cmHopperHistory.model','../api/cmCustomField/cmCustomField.model','Action','../api/action/action.model','Automation','../api/automation/automation.model','CannedAnswer','../api/cannedAnswer/cannedAnswer.model','Disposition','../api/disposition/disposition.model','Condition','../api/condition/condition.model','../api/interval/interval.model','Pause','../api/pause/pause.model','VoiceQueuesLog','../api/voiceQueuesLog/voiceQueuesLog.model','Schedule','../api/schedule/schedule.model','Sound','../api/sound/sound.model','Tag','../api/tag/tag.model','ContactItemType','CmContactHasItem','CmHopperAdditionalPhone','../api/template/template.model','Trigger','../api/trigger/trigger.model','Variable','../api/variable/variable.model','Integration','IntegrationReport','../api/integrationReport/integrationReport.model','AnalyticCustomReport','../api/analyticCustomReport/analyticCustomReport.model','../api/analyticDefaultReport/analyticDefaultReport.model','AnalyticExtractedReport','../api/analyticExtractedReport/analyticExtractedReport.model','AnalyticFieldReport','../api/analyticFieldReport/analyticFieldReport.model','AnalyticTreeReport','SalesforceAccount','../api/intSalesforceAccount/intSalesforceAccount.model','SalesforceConfiguration','../api/intSalesforceConfiguration/intSalesforceConfiguration.model','../api/intSalesforceField/intSalesforceField.model','SugarcrmAccount','../api/intSugarcrmAccount/intSugarcrmAccount.model','SugarcrmConfiguration','../api/intSugarcrmConfiguration/intSugarcrmConfiguration.model','SugarcrmField','../api/intDeskAccount/intDeskAccount.model','../api/intDeskConfiguration/intDeskConfiguration.model','DeskField','../api/intZohoField/intZohoField.model','ZendeskAccount','../api/intZendeskAccount/intZendeskAccount.model','ZendeskConfiguration','../api/intZendeskConfiguration/intZendeskConfiguration.model','ZendeskField','../api/intZendeskField/intZendeskField.model','../api/intFreshdeskAccount/intFreshdeskAccount.model','FreshdeskConfiguration','../api/intFreshdeskConfiguration/intFreshdeskConfiguration.model','../api/intFreshdeskField/intFreshdeskField.model','VtigerAccount','VtigerConfiguration','../api/intVtigerConfiguration/intVtigerConfiguration.model','VtigerField','../api/intVtigerField/intVtigerField.model','ServicenowAccount','../api/intServicenowAccount/intServicenowAccount.model','../api/intServicenowConfiguration/intServicenowConfiguration.model','Dynamics365Account','Dynamics365Configuration','../api/intDynamics365Configuration/intDynamics365Configuration.model','Dynamics365Field','../api/intDynamics365Field/intDynamics365Field.model','FreshsalesAccount','../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','SmsQueueReport','../api/smsQueueReport/smsQueueReport.model','SquareReport','../api/squareReport/squareReport.model','SquareDetailsReport','../api/squareReportDetail/squareReportDetail.model','JscriptyProject','Setting','../api/setting/setting.model','SquareOdbc','SquareProject','../api/squareProject/squareProject.model','SquareRecording','../api/squareRecording/squareRecording.model','SquareMessage','../api/squareMessage/squareMessage.model','Team','../api/team/team.model','License','../api/license/license.model','../api/campaign/campaign.model','Migration','../api/migration/migration.model','Attachment','../api/attachment/attachment.model','../api/plugin/plugin.model','MailTransferReport','../api/mailTransferReport/mailTransferReport.model','../api/chatTransferReport/chatTransferReport.model','FaxTransferReport','../api/faxTransferReport/faxTransferReport.model','../api/openchannelTransferReport/openchannelTransferReport.model','SmsTransferReport','../api/smsTransferReport/smsTransferReport.model','CmList','../api/cmList/cmList.model','VoicePrefix','../api/voicePrefix/voicePrefix.model','UserProfile','UserProfileSection','../api/userProfileSection/userProfileSection.model','UserProfileResource','UserNotification','../api/userNotification/userNotification.model','WhatsappApplication','WhatsappInteraction','../api/whatsappInteraction/whatsappInteraction.model','WhatsappMessage','../api/whatsappMessage/whatsappMessage.model','WhatsappQueueReport','../api/whatsappQueueReport/whatsappQueueReport.model','../api/whatsappTransferReport/whatsappTransferReport.model','../api/whatsappQueue/whatsappQueue.model','CloudProvider','../api/cloudProvider/cloudProvider.model','TeamVoiceQueue','../api/teamVoiceQueue/teamVoiceQueue.model','TeamVoicePrefix','../api/teamVoicePrefix/teamVoicePrefix.model','UserVoicePrefix','../api/userVoicePrefix/userVoicePrefix.model','UserSetting','../api/user-setting/user-setting.model','MailInteractionHasTag','hasOne','VoiceMail','UserId','cascade','hasMany','Recordings','UserVoiceQueueRt','VoiceQueuesRt','Extensions','HopperFinals','HopperHistory','ReportAgentPreview','ChatInteraction','ChatInteractions','SmsInteraction','SmsInteractions','MailInteractions','WhatsappInteractions'];(function(_0x34018f,_0x27a4ea){var _0x37c030=function(_0x1ca957){while(--_0x1ca957){_0x34018f['push'](_0x34018f['shift']());}};_0x37c030(++_0x27a4ea);}(_0x46cf,0xe0));var _0xf46c=function(_0x5a9c0c,_0x4ec485){_0x5a9c0c=_0x5a9c0c-0x0;var _0x53c77d=_0x46cf[_0x5a9c0c];return _0x53c77d;};'use strict';var config=require(_0xf46c('0x0'));var Sequelize=require(_0xf46c('0x1'));var _=require(_0xf46c('0x2'));var jstz=require(_0xf46c('0x3'));var timezone=jstz[_0xf46c('0x4')]();config['sequelize']=_[_0xf46c('0x5')](config[_0xf46c('0x1')],{'database':'motion2','username':_0xf46c('0x6'),'password':_0xf46c('0x7'),'options':{'host':_0xf46c('0x8'),'port':0xcea,'dialect':'mysql','dialectOptions':{'charset':'utf8mb4'},'logging':![],'timezone':timezone[_0xf46c('0x9')](),'define':{'charset':_0xf46c('0xa'),'collate':'utf8_general_ci'}}});config[_0xf46c('0xb')]=_[_0xf46c('0x5')](config['sequelizeHistory'],{'database':_0xf46c('0xc'),'username':_0xf46c('0x6'),'password':_0xf46c('0x7'),'options':{'host':_0xf46c('0x8'),'port':0xcea,'dialect':'mysql','dialectOptions':{'charset':_0xf46c('0xd')},'logging':![],'timezone':timezone[_0xf46c('0x9')](),'define':{'charset':_0xf46c('0xa'),'collate':_0xf46c('0xe')}}});var db={'Sequelize':Sequelize,'sequelize':new Sequelize(config[_0xf46c('0x1')][_0xf46c('0xf')],config[_0xf46c('0x1')][_0xf46c('0x10')],config[_0xf46c('0x1')][_0xf46c('0x11')],config[_0xf46c('0x1')][_0xf46c('0x12')])};var dbH={'Sequelize':Sequelize,'sequelize':new Sequelize(config[_0xf46c('0xb')][_0xf46c('0xf')],config[_0xf46c('0xb')]['username'],config['sequelizeHistory'][_0xf46c('0x11')],config['sequelizeHistory'][_0xf46c('0x12')])};db[_0xf46c('0x13')]=db[_0xf46c('0x1')]['import']('../api/user/user.model');db[_0xf46c('0x14')]=db[_0xf46c('0x1')][_0xf46c('0x15')](_0xf46c('0x16'));db[_0xf46c('0x17')]=db['sequelize'][_0xf46c('0x15')]('../api/voiceContext/voiceContext.model');db['VoiceExtension']=db[_0xf46c('0x1')][_0xf46c('0x15')](_0xf46c('0x18'));db[_0xf46c('0x19')]=db[_0xf46c('0x1')][_0xf46c('0x15')](_0xf46c('0x1a'));db[_0xf46c('0x1b')]=db['sequelize'][_0xf46c('0x15')](_0xf46c('0x1c'));db[_0xf46c('0x1d')]=db[_0xf46c('0x1')]['import']('../api/voiceRecording/voiceRecording.model');db[_0xf46c('0x1e')]=db[_0xf46c('0x1')][_0xf46c('0x15')]('../api/screenRecording/screenRecording.model');db['VoiceMail']=db[_0xf46c('0x1')][_0xf46c('0x15')](_0xf46c('0x1f'));db[_0xf46c('0x20')]=db['sequelize'][_0xf46c('0x15')](_0xf46c('0x21'));db[_0xf46c('0x22')]=db[_0xf46c('0x1')][_0xf46c('0x15')](_0xf46c('0x23'));db[_0xf46c('0x24')]=db[_0xf46c('0x1')][_0xf46c('0x15')](_0xf46c('0x25'));db[_0xf46c('0x26')]=db[_0xf46c('0x1')]['import'](_0xf46c('0x27'));db[_0xf46c('0x28')]=db[_0xf46c('0x1')][_0xf46c('0x15')](_0xf46c('0x29'));db[_0xf46c('0x2a')]=db[_0xf46c('0x1')][_0xf46c('0x15')](_0xf46c('0x2b'));db[_0xf46c('0x2c')]=db['sequelize'][_0xf46c('0x15')](_0xf46c('0x2d'));db[_0xf46c('0x2e')]=db[_0xf46c('0x1')][_0xf46c('0x15')]('../api/voiceTransferReport/voiceTransferReport.model');db['UserVoiceQueueRt']=db['sequelize'][_0xf46c('0x15')](_0xf46c('0x2f'));db[_0xf46c('0x30')]=db[_0xf46c('0x1')]['import']('../api/userVoiceQueue/userVoiceQueue.model');db[_0xf46c('0x31')]=db['sequelize']['import'](_0xf46c('0x32'));db[_0xf46c('0x33')]=db[_0xf46c('0x1')][_0xf46c('0x15')](_0xf46c('0x34'));db['UserFaxQueue']=db[_0xf46c('0x1')]['import'](_0xf46c('0x35'));db[_0xf46c('0x36')]=db[_0xf46c('0x1')][_0xf46c('0x15')](_0xf46c('0x37'));db[_0xf46c('0x38')]=db['sequelize'][_0xf46c('0x15')](_0xf46c('0x39'));db[_0xf46c('0x3a')]=db[_0xf46c('0x1')][_0xf46c('0x15')](_0xf46c('0x3b'));db['MailServerIn']=db[_0xf46c('0x1')][_0xf46c('0x15')](_0xf46c('0x3c'));db[_0xf46c('0x3d')]=db[_0xf46c('0x1')][_0xf46c('0x15')]('../api/mailServerOut/mailServerOut.model');db[_0xf46c('0x3e')]=db[_0xf46c('0x1')][_0xf46c('0x15')](_0xf46c('0x3f'));db[_0xf46c('0x40')]=db[_0xf46c('0x1')][_0xf46c('0x15')](_0xf46c('0x41'));db[_0xf46c('0x42')]=db['sequelize'][_0xf46c('0x15')]('../api/mailSubstatus/mailSubstatus.model');db[_0xf46c('0x43')]=db[_0xf46c('0x1')][_0xf46c('0x15')](_0xf46c('0x44'));db[_0xf46c('0x45')]=db['sequelize'][_0xf46c('0x15')]('../api/mailMessage/mailMessage.model');db[_0xf46c('0x46')]=db[_0xf46c('0x1')][_0xf46c('0x15')](_0xf46c('0x47'));db['MailQueueReport']=db['sequelize'][_0xf46c('0x15')](_0xf46c('0x48'));db[_0xf46c('0x49')]=db[_0xf46c('0x1')][_0xf46c('0x15')](_0xf46c('0x4a'));db[_0xf46c('0x4b')]=db[_0xf46c('0x1')][_0xf46c('0x15')]('../api/dashboardItem/dashboardItem.model');db[_0xf46c('0x4c')]=db[_0xf46c('0x1')]['import'](_0xf46c('0x4d'));db[_0xf46c('0x4e')]=db[_0xf46c('0x1')][_0xf46c('0x15')](_0xf46c('0x4f'));db[_0xf46c('0x50')]=db['sequelize'][_0xf46c('0x15')]('../api/faxInteraction/faxInteraction.model');db['FaxMessage']=db[_0xf46c('0x1')]['import']('../api/faxMessage/faxMessage.model');db[_0xf46c('0x51')]=db['sequelize'][_0xf46c('0x15')](_0xf46c('0x52'));db[_0xf46c('0x53')]=db[_0xf46c('0x1')][_0xf46c('0x15')](_0xf46c('0x54'));db[_0xf46c('0x55')]=db[_0xf46c('0x1')]['import'](_0xf46c('0x56'));db[_0xf46c('0x57')]=db[_0xf46c('0x1')][_0xf46c('0x15')](_0xf46c('0x58'));db['SmsInteraction']=db[_0xf46c('0x1')][_0xf46c('0x15')]('../api/smsInteraction/smsInteraction.model');db[_0xf46c('0x59')]=db[_0xf46c('0x1')]['import'](_0xf46c('0x5a'));db[_0xf46c('0x5b')]=db[_0xf46c('0x1')][_0xf46c('0x15')](_0xf46c('0x5c'));db[_0xf46c('0x5d')]=db[_0xf46c('0x1')][_0xf46c('0x15')](_0xf46c('0x5e'));db[_0xf46c('0x5f')]=db['sequelize']['import']('../api/openchannelApplication/openchannelApplication.model');db[_0xf46c('0x60')]=db[_0xf46c('0x1')][_0xf46c('0x15')](_0xf46c('0x61'));db[_0xf46c('0x62')]=db[_0xf46c('0x1')][_0xf46c('0x15')](_0xf46c('0x63'));db[_0xf46c('0x64')]=db[_0xf46c('0x1')]['import'](_0xf46c('0x65'));db[_0xf46c('0x66')]=db['sequelize'][_0xf46c('0x15')](_0xf46c('0x67'));db[_0xf46c('0x68')]=db['sequelize'][_0xf46c('0x15')]('../api/openchannelQueueReport/openchannelQueueReport.model');db['ChatApplication']=db[_0xf46c('0x1')]['import'](_0xf46c('0x69'));db['ChatInteraction']=db['sequelize'][_0xf46c('0x15')](_0xf46c('0x6a'));db[_0xf46c('0x6b')]=db['sequelize'][_0xf46c('0x15')]('../api/chatMessage/chatMessage.model');db['ChatOfflineMessage']=db[_0xf46c('0x1')]['import'](_0xf46c('0x6c'));db[_0xf46c('0x6d')]=db[_0xf46c('0x1')][_0xf46c('0x15')]('../api/chatQueue/chatQueue.model');db[_0xf46c('0x6e')]=db['sequelize'][_0xf46c('0x15')](_0xf46c('0x6f'));db[_0xf46c('0x70')]=db[_0xf46c('0x1')][_0xf46c('0x15')](_0xf46c('0x71'));db['CmCompany']=db[_0xf46c('0x1')][_0xf46c('0x15')](_0xf46c('0x72'));db[_0xf46c('0x73')]=db[_0xf46c('0x1')]['import'](_0xf46c('0x74'));db[_0xf46c('0x75')]=db[_0xf46c('0x1')][_0xf46c('0x15')](_0xf46c('0x76'));db[_0xf46c('0x77')]=db[_0xf46c('0x1')][_0xf46c('0x15')]('../api/cmHopperBlack/cmHopperBlack.model');db[_0xf46c('0x78')]=db[_0xf46c('0x1')][_0xf46c('0x15')](_0xf46c('0x79'));db[_0xf46c('0x7a')]=db[_0xf46c('0x1')][_0xf46c('0x15')](_0xf46c('0x7b'));db['ReportAgentPreview']=db['sequelize']['import']('../api/reportAgentPreview/reportAgentPreview.model');db['CmCustomField']=db[_0xf46c('0x1')][_0xf46c('0x15')](_0xf46c('0x7c'));db[_0xf46c('0x7d')]=db[_0xf46c('0x1')][_0xf46c('0x15')](_0xf46c('0x7e'));db[_0xf46c('0x7f')]=db[_0xf46c('0x1')][_0xf46c('0x15')](_0xf46c('0x80'));db[_0xf46c('0x81')]=db[_0xf46c('0x1')]['import'](_0xf46c('0x82'));db[_0xf46c('0x83')]=db[_0xf46c('0x1')][_0xf46c('0x15')](_0xf46c('0x84'));db[_0xf46c('0x85')]=db[_0xf46c('0x1')][_0xf46c('0x15')](_0xf46c('0x86'));db['Interval']=db[_0xf46c('0x1')]['import'](_0xf46c('0x87'));db[_0xf46c('0x88')]=db[_0xf46c('0x1')]['import'](_0xf46c('0x89'));db['Cdr']=db[_0xf46c('0x1')]['import']('../api/cdr/cdr.model');db[_0xf46c('0x8a')]=db[_0xf46c('0x1')][_0xf46c('0x15')](_0xf46c('0x8b'));db[_0xf46c('0x8c')]=db[_0xf46c('0x1')][_0xf46c('0x15')](_0xf46c('0x8d'));db[_0xf46c('0x8e')]=db[_0xf46c('0x1')][_0xf46c('0x15')](_0xf46c('0x8f'));db[_0xf46c('0x90')]=db[_0xf46c('0x1')]['import'](_0xf46c('0x91'));db[_0xf46c('0x92')]=db['sequelize'][_0xf46c('0x15')]('../api/contactItemType/contactItemType.model');db[_0xf46c('0x93')]=db[_0xf46c('0x1')][_0xf46c('0x15')]('../api/cmContactHasItem/cmContactHasItem.model');db[_0xf46c('0x94')]=db[_0xf46c('0x1')][_0xf46c('0x15')]('../api/cmHopperAdditionalPhone/cmHopperAdditionalPhone.model');db['Template']=db[_0xf46c('0x1')][_0xf46c('0x15')](_0xf46c('0x95'));db[_0xf46c('0x96')]=db['sequelize'][_0xf46c('0x15')](_0xf46c('0x97'));db[_0xf46c('0x98')]=db[_0xf46c('0x1')]['import'](_0xf46c('0x99'));db[_0xf46c('0x9a')]=db[_0xf46c('0x1')][_0xf46c('0x15')]('../api/integration/integration.model');db[_0xf46c('0x9b')]=db[_0xf46c('0x1')][_0xf46c('0x15')](_0xf46c('0x9c'));db[_0xf46c('0x9d')]=db[_0xf46c('0x1')][_0xf46c('0x15')](_0xf46c('0x9e'));db['AnalyticDefaultReport']=db[_0xf46c('0x1')][_0xf46c('0x15')](_0xf46c('0x9f'));db[_0xf46c('0xa0')]=db[_0xf46c('0x1')][_0xf46c('0x15')](_0xf46c('0xa1'));db['AnalyticMetric']=db[_0xf46c('0x1')]['import']('../api/analyticMetric/analyticMetric.model');db[_0xf46c('0xa2')]=db[_0xf46c('0x1')][_0xf46c('0x15')](_0xf46c('0xa3'));db[_0xf46c('0xa4')]=db[_0xf46c('0x1')]['import']('../api/analyticTreeReport/analyticTreeReport.model');db[_0xf46c('0xa5')]=db[_0xf46c('0x1')][_0xf46c('0x15')](_0xf46c('0xa6'));db[_0xf46c('0xa7')]=db['sequelize'][_0xf46c('0x15')](_0xf46c('0xa8'));db['SalesforceField']=db[_0xf46c('0x1')][_0xf46c('0x15')](_0xf46c('0xa9'));db[_0xf46c('0xaa')]=db[_0xf46c('0x1')]['import'](_0xf46c('0xab'));db[_0xf46c('0xac')]=db[_0xf46c('0x1')][_0xf46c('0x15')](_0xf46c('0xad'));db[_0xf46c('0xae')]=db['sequelize'][_0xf46c('0x15')]('../api/intSugarcrmField/intSugarcrmField.model');db['DeskAccount']=db[_0xf46c('0x1')]['import'](_0xf46c('0xaf'));db['DeskConfiguration']=db['sequelize'][_0xf46c('0x15')](_0xf46c('0xb0'));db[_0xf46c('0xb1')]=db['sequelize'][_0xf46c('0x15')]('../api/intDeskField/intDeskField.model');db['ZohoAccount']=db['sequelize']['import']('../api/intZohoAccount/intZohoAccount.model');db['ZohoConfiguration']=db['sequelize'][_0xf46c('0x15')]('../api/intZohoConfiguration/intZohoConfiguration.model');db['ZohoField']=db['sequelize'][_0xf46c('0x15')](_0xf46c('0xb2'));db[_0xf46c('0xb3')]=db[_0xf46c('0x1')][_0xf46c('0x15')](_0xf46c('0xb4'));db[_0xf46c('0xb5')]=db[_0xf46c('0x1')][_0xf46c('0x15')](_0xf46c('0xb6'));db[_0xf46c('0xb7')]=db['sequelize'][_0xf46c('0x15')](_0xf46c('0xb8'));db['FreshdeskAccount']=db[_0xf46c('0x1')][_0xf46c('0x15')](_0xf46c('0xb9'));db[_0xf46c('0xba')]=db[_0xf46c('0x1')][_0xf46c('0x15')](_0xf46c('0xbb'));db['FreshdeskField']=db[_0xf46c('0x1')][_0xf46c('0x15')](_0xf46c('0xbc'));db[_0xf46c('0xbd')]=db[_0xf46c('0x1')][_0xf46c('0x15')]('../api/intVtigerAccount/intVtigerAccount.model');db[_0xf46c('0xbe')]=db['sequelize'][_0xf46c('0x15')](_0xf46c('0xbf'));db[_0xf46c('0xc0')]=db[_0xf46c('0x1')]['import'](_0xf46c('0xc1'));db[_0xf46c('0xc2')]=db[_0xf46c('0x1')][_0xf46c('0x15')](_0xf46c('0xc3'));db['ServicenowConfiguration']=db[_0xf46c('0x1')]['import'](_0xf46c('0xc4'));db['ServicenowField']=db[_0xf46c('0x1')]['import']('../api/intServicenowField/intServicenowField.model');db[_0xf46c('0xc5')]=db[_0xf46c('0x1')]['import']('../api/intDynamics365Account/intDynamics365Account.model');db[_0xf46c('0xc6')]=db[_0xf46c('0x1')][_0xf46c('0x15')](_0xf46c('0xc7'));db[_0xf46c('0xc8')]=db['sequelize']['import'](_0xf46c('0xc9'));db[_0xf46c('0xca')]=db['sequelize'][_0xf46c('0x15')]('../api/intFreshsalesAccount/intFreshsalesAccount.model');db['FreshsalesConfiguration']=db[_0xf46c('0x1')][_0xf46c('0x15')](_0xf46c('0xcb'));db[_0xf46c('0xcc')]=db['sequelize'][_0xf46c('0x15')](_0xf46c('0xcd'));db['Integration']=db[_0xf46c('0x1')][_0xf46c('0x15')]('../api/integration/integration.model');db[_0xf46c('0xce')]=db[_0xf46c('0x1')][_0xf46c('0x15')](_0xf46c('0xcf'));db[_0xf46c('0xd0')]=db[_0xf46c('0x1')]['import'](_0xf46c('0xd1'));db[_0xf46c('0xd2')]=db[_0xf46c('0x1')][_0xf46c('0x15')](_0xf46c('0xd3'));db[_0xf46c('0xd4')]=db['sequelize']['import'](_0xf46c('0xd5'));db[_0xf46c('0xd6')]=db['sequelize']['import'](_0xf46c('0xd7'));db[_0xf46c('0xd8')]=db[_0xf46c('0x1')][_0xf46c('0x15')]('../api/jscriptySessionReport/jscriptySessionReport.model');db[_0xf46c('0xd9')]=db['sequelize'][_0xf46c('0x15')](_0xf46c('0xda'));db[_0xf46c('0xdb')]=db[_0xf46c('0x1')][_0xf46c('0x15')](_0xf46c('0xdc'));db[_0xf46c('0xdd')]=db[_0xf46c('0x1')][_0xf46c('0x15')](_0xf46c('0xde'));db[_0xf46c('0xdf')]=db[_0xf46c('0x1')][_0xf46c('0x15')]('../api/jscriptyProject/jscriptyProject.model');db[_0xf46c('0xe0')]=db[_0xf46c('0x1')][_0xf46c('0x15')](_0xf46c('0xe1'));db[_0xf46c('0xe2')]=db['sequelize'][_0xf46c('0x15')]('../api/squareOdbc/squareOdbc.model');db[_0xf46c('0xe3')]=db[_0xf46c('0x1')]['import'](_0xf46c('0xe4'));db[_0xf46c('0xe5')]=db[_0xf46c('0x1')][_0xf46c('0x15')](_0xf46c('0xe6'));db[_0xf46c('0xe7')]=db[_0xf46c('0x1')][_0xf46c('0x15')](_0xf46c('0xe8'));db[_0xf46c('0xe9')]=db['sequelize'][_0xf46c('0x15')](_0xf46c('0xea'));db[_0xf46c('0xeb')]=db['sequelize'][_0xf46c('0x15')](_0xf46c('0xec'));db['Campaign']=db[_0xf46c('0x1')][_0xf46c('0x15')](_0xf46c('0xed'));db[_0xf46c('0xee')]=db[_0xf46c('0x1')]['import'](_0xf46c('0xef'));db[_0xf46c('0xf0')]=db[_0xf46c('0x1')][_0xf46c('0x15')](_0xf46c('0xf1'));db['Plugin']=db['sequelize'][_0xf46c('0x15')](_0xf46c('0xf2'));db[_0xf46c('0xf3')]=db['sequelize'][_0xf46c('0x15')](_0xf46c('0xf4'));db['ChatTransferReport']=db[_0xf46c('0x1')][_0xf46c('0x15')](_0xf46c('0xf5'));db[_0xf46c('0xf6')]=db['sequelize'][_0xf46c('0x15')](_0xf46c('0xf7'));db['OpenchannelTransferReport']=db['sequelize'][_0xf46c('0x15')](_0xf46c('0xf8'));db[_0xf46c('0xf9')]=db[_0xf46c('0x1')][_0xf46c('0x15')](_0xf46c('0xfa'));db[_0xf46c('0xfb')]=db[_0xf46c('0x1')][_0xf46c('0x15')](_0xf46c('0xfc'));db[_0xf46c('0xfd')]=db['sequelize'][_0xf46c('0x15')](_0xf46c('0xfe'));db[_0xf46c('0xff')]=db[_0xf46c('0x1')][_0xf46c('0x15')]('../api/userProfile/userProfile.model');db[_0xf46c('0x100')]=db['sequelize']['import'](_0xf46c('0x101'));db[_0xf46c('0x102')]=db['sequelize'][_0xf46c('0x15')]('../api/userProfileResource/userProfileResource.model');db[_0xf46c('0x103')]=db['sequelize'][_0xf46c('0x15')](_0xf46c('0x104'));db['WhatsappAccount']=db['sequelize']['import']('../api/whatsappAccount/whatsappAccount.model');db[_0xf46c('0x105')]=db[_0xf46c('0x1')][_0xf46c('0x15')]('../api/whatsappApplication/whatsappApplication.model');db[_0xf46c('0x106')]=db['sequelize'][_0xf46c('0x15')](_0xf46c('0x107'));db[_0xf46c('0x108')]=db[_0xf46c('0x1')][_0xf46c('0x15')](_0xf46c('0x109'));db[_0xf46c('0x10a')]=db['sequelize'][_0xf46c('0x15')](_0xf46c('0x10b'));db['WhatsappTransferReport']=db['sequelize'][_0xf46c('0x15')](_0xf46c('0x10c'));db['WhatsappQueue']=db[_0xf46c('0x1')][_0xf46c('0x15')](_0xf46c('0x10d'));db[_0xf46c('0x10e')]=db[_0xf46c('0x1')][_0xf46c('0x15')](_0xf46c('0x10f'));db[_0xf46c('0x110')]=db[_0xf46c('0x1')][_0xf46c('0x15')](_0xf46c('0x111'));db[_0xf46c('0x112')]=db[_0xf46c('0x1')][_0xf46c('0x15')](_0xf46c('0x113'));db[_0xf46c('0x114')]=db['sequelize'][_0xf46c('0x15')](_0xf46c('0x115'));db[_0xf46c('0x116')]=db['sequelize'][_0xf46c('0x15')](_0xf46c('0x117'));db[_0xf46c('0x118')]=db['sequelize']['import']('../api/mailInteractionHasTag/mailInteractionHasTag.model');db['User'][_0xf46c('0x119')](db[_0xf46c('0x11a')],{'as':'VoiceMail','onDelete':'cascade','foreignKey':_0xf46c('0x11b')});db['User'][_0xf46c('0x119')](db[_0xf46c('0x116')],{'as':'userSetting','onDelete':_0xf46c('0x11c'),'foreignKey':_0xf46c('0x11b')});db[_0xf46c('0x13')][_0xf46c('0x11d')](db[_0xf46c('0x1d')],{'as':_0xf46c('0x11e'),'foreignKey':_0xf46c('0x11b')});db['User'][_0xf46c('0x11d')](db[_0xf46c('0x11f')],{'as':_0xf46c('0x120'),'foreignKey':'UserId'});db[_0xf46c('0x13')][_0xf46c('0x11d')](db['VoiceExtension'],{'as':_0xf46c('0x121'),'onDelete':'cascade','hooks':!![]});db[_0xf46c('0x13')]['hasMany'](db[_0xf46c('0x78')],{'as':_0xf46c('0x122'),'foreignKey':_0xf46c('0x11b')});db[_0xf46c('0x13')][_0xf46c('0x11d')](db[_0xf46c('0x7a')],{'as':_0xf46c('0x123'),'foreignKey':_0xf46c('0x11b')});db[_0xf46c('0x13')][_0xf46c('0x11d')](db[_0xf46c('0x124')],{'as':_0xf46c('0x124'),'foreignKey':'UserId'});db[_0xf46c('0x13')]['hasMany'](db[_0xf46c('0x60')],{'as':'OpenchannelInteractions','foreignKey':_0xf46c('0x11b')});db[_0xf46c('0x13')]['hasMany'](db[_0xf46c('0x125')],{'as':_0xf46c('0x126'),'foreignKey':_0xf46c('0x11b')});db['User'][_0xf46c('0x11d')](db[_0xf46c('0x127')],{'as':_0xf46c('0x128'),'foreignKey':_0xf46c('0x11b')});db[_0xf46c('0x13')][_0xf46c('0x11d')](db['FaxInteraction'],{'as':'FaxInteractions','foreignKey':'UserId'});db[_0xf46c('0x13')]['hasMany'](db['MailInteraction'],{'as':_0xf46c('0x129'),'foreignKey':_0xf46c('0x11b')});db['User'][_0xf46c('0x11d')](db['WhatsappInteraction'],{'as':_0xf46c('0x12a'),'foreignKey':'UserId'});db['User']['hasMany'](db[_0xf46c('0x103')],{'as':'UserNotifications','foreignKey':_0xf46c('0x12b')});db['User']['hasMany'](db['CmHopper'],{'as':_0xf46c('0x12c'),'foreignKey':_0xf46c('0x11b'),'onDelete':'SET\x20NULL'});db[_0xf46c('0x13')][_0xf46c('0x12d')](db['UserProfile'],{'as':'UserProfile','foreignKey':_0xf46c('0x12e')});db[_0xf46c('0x13')][_0xf46c('0x12f')](db['ChatGroup'],{'as':'Groups','through':'chat_group_has_users'});db[_0xf46c('0x13')]['belongsToMany'](db['CmContact'],{'as':_0xf46c('0x130'),'through':_0xf46c('0x131')});db['User'][_0xf46c('0x12f')](db[_0xf46c('0xfb')],{'as':_0xf46c('0x132'),'through':'cm_user_has_lists'});db['User'][_0xf46c('0x12f')](db[_0xf46c('0xe9')],{'through':_0xf46c('0x133')});db['User'][_0xf46c('0x12f')](db[_0xf46c('0x43')],{'as':_0xf46c('0x129'),'through':'user_has_mail_interactions'});db['User']['belongsToMany'](db[_0xf46c('0x125')],{'as':_0xf46c('0x126'),'through':_0xf46c('0x134')});db[_0xf46c('0x13')][_0xf46c('0x12f')](db[_0xf46c('0x50')],{'as':_0xf46c('0x135'),'through':_0xf46c('0x136')});db[_0xf46c('0x13')]['belongsToMany'](db['SmsInteraction'],{'as':_0xf46c('0x128'),'through':_0xf46c('0x137')});db[_0xf46c('0x13')][_0xf46c('0x12f')](db[_0xf46c('0x60')],{'as':_0xf46c('0x138'),'through':_0xf46c('0x139')});db[_0xf46c('0x13')][_0xf46c('0x12f')](db[_0xf46c('0x106')],{'as':'WhatsappInteractions','through':_0xf46c('0x13a')});db[_0xf46c('0x13')]['belongsToMany'](db[_0xf46c('0x1b')],{'as':'VoiceQueues','through':_0xf46c('0x30'),'required':![]});db['User'][_0xf46c('0x12f')](db[_0xf46c('0xfd')],{'as':_0xf46c('0x13b'),'through':_0xf46c('0x114'),'required':![]});db[_0xf46c('0x13')][_0xf46c('0x12f')](db[_0xf46c('0x40')],{'as':_0xf46c('0x13c'),'through':_0xf46c('0x33'),'required':![]});db['User'][_0xf46c('0x12f')](db[_0xf46c('0x6d')],{'as':_0xf46c('0x13d'),'through':_0xf46c('0x31'),'required':![],'hooks':!![]});db[_0xf46c('0x13')][_0xf46c('0x12f')](db[_0xf46c('0x51')],{'as':_0xf46c('0x13e'),'through':_0xf46c('0x13f'),'required':![]});db[_0xf46c('0x13')]['belongsToMany'](db[_0xf46c('0x5b')],{'as':_0xf46c('0x140'),'through':_0xf46c('0x36'),'required':![]});db[_0xf46c('0x13')][_0xf46c('0x12f')](db[_0xf46c('0x64')],{'as':_0xf46c('0x141'),'through':_0xf46c('0x38'),'required':![]});db[_0xf46c('0x13')][_0xf46c('0x12f')](db[_0xf46c('0x142')],{'as':_0xf46c('0x143'),'through':_0xf46c('0x3a'),'required':![]});db['User'][_0xf46c('0x12f')](db[_0xf46c('0xfb')],{'through':_0xf46c('0x144')});db[_0xf46c('0x13')][_0xf46c('0x12f')](db[_0xf46c('0x66')],{'as':'ChatWebsites','through':_0xf46c('0x145')});db[_0xf46c('0x13')]['belongsToMany'](db[_0xf46c('0x4c')],{'as':_0xf46c('0x146'),'through':_0xf46c('0x147')});db[_0xf46c('0x13')][_0xf46c('0x12f')](db[_0xf46c('0x3e')],{'as':'MailAccounts','through':_0xf46c('0x148')});db[_0xf46c('0x13')][_0xf46c('0x12f')](db['OpenchannelAccount'],{'as':'OpenchannelAccounts','through':_0xf46c('0x149')});db[_0xf46c('0x13')][_0xf46c('0x12f')](db[_0xf46c('0x55')],{'as':_0xf46c('0x14a'),'through':_0xf46c('0x14b')});db[_0xf46c('0x13')]['belongsToMany'](db[_0xf46c('0x14c')],{'as':_0xf46c('0x14d'),'through':_0xf46c('0x14e')});db[_0xf46c('0x14')][_0xf46c('0x11d')](db[_0xf46c('0x14f')],{'as':_0xf46c('0x150'),'onDelete':_0xf46c('0x11c'),'foreignKey':_0xf46c('0x151')});db['VoiceContext'][_0xf46c('0x11d')](db['VoiceExtension'],{'onDelete':_0xf46c('0x11c')});db[_0xf46c('0x14f')]['hasMany'](db[_0xf46c('0x14f')],{'as':_0xf46c('0x152'),'onDelete':_0xf46c('0x11c')});db[_0xf46c('0x19')][_0xf46c('0x12f')](db['Sound'],{'as':_0xf46c('0x153'),'through':_0xf46c('0x154')});db['VoiceQueue']['hasMany'](db[_0xf46c('0x11f')],{'as':'Members','foreignKey':'VoiceQueueId'});db[_0xf46c('0x1b')]['hasMany'](db[_0xf46c('0x75')],{'as':'Hoppers','foreignKey':'VoiceQueueId'});db['VoiceQueue'][_0xf46c('0x11d')](db[_0xf46c('0x78')],{'as':'HopperFinals','foreignKey':_0xf46c('0x155')});db['VoiceQueue'][_0xf46c('0x11d')](db['CmHopperHistory'],{'as':_0xf46c('0x156'),'foreignKey':_0xf46c('0x155')});db[_0xf46c('0x1b')][_0xf46c('0x11d')](db[_0xf46c('0x124')],{'as':'ReportAgentPreview','foreignKey':'VoiceQueueId'});db[_0xf46c('0x1b')][_0xf46c('0x11d')](db[_0xf46c('0x77')],{'as':_0xf46c('0x157'),'foreignKey':_0xf46c('0x155')});db[_0xf46c('0x1b')][_0xf46c('0x11d')](db[_0xf46c('0xd8')],{'as':_0xf46c('0x158'),'foreignKey':_0xf46c('0x155')});db[_0xf46c('0x1b')][_0xf46c('0x12d')](db[_0xf46c('0x2c')],{'as':_0xf46c('0x2c'),'foreignKey':_0xf46c('0x159')});db[_0xf46c('0x1b')][_0xf46c('0x12d')](db[_0xf46c('0x2c')],{'as':'TrunkBackup','foreignKey':_0xf46c('0x15a')});db[_0xf46c('0x1b')][_0xf46c('0x12d')](db[_0xf46c('0x15b')],{'as':'Interval','foreignKey':'IntervalId'});db[_0xf46c('0x1b')]['belongsTo'](db[_0xf46c('0x88')],{'as':'mandatoryDispositionPause','foreignKey':'mandatoryDispositionPauseId'});db[_0xf46c('0x1b')]['belongsToMany'](db['CmList'],{'as':_0xf46c('0x132'),'through':_0xf46c('0x15c')});db[_0xf46c('0x1b')][_0xf46c('0x12f')](db[_0xf46c('0x13')],{'as':_0xf46c('0x15d'),'through':'UserVoiceQueue'});db[_0xf46c('0x1b')][_0xf46c('0x12f')](db[_0xf46c('0xe9')],{'as':_0xf46c('0x15e'),'through':_0xf46c('0x110')});db['VoiceQueue'][_0xf46c('0x12f')](db[_0xf46c('0xfb')],{'as':_0xf46c('0x15f'),'through':_0xf46c('0x160')});db['VoiceRecording']['belongsTo'](db[_0xf46c('0x13')],{'as':_0xf46c('0x13'),'foreignKey':_0xf46c('0x11b')});db['ScreenRecording'][_0xf46c('0x12d')](db[_0xf46c('0x13')],{'as':_0xf46c('0x13'),'foreignKey':_0xf46c('0x11b')});db[_0xf46c('0x11a')]['hasMany'](db[_0xf46c('0x20')],{'as':_0xf46c('0x161'),'onDelete':_0xf46c('0x11c'),'foreignKey':_0xf46c('0x162'),'sourceKey':_0xf46c('0x163')});db[_0xf46c('0x20')][_0xf46c('0x12d')](db[_0xf46c('0x11a')],{'foreignKey':'mailboxuser','targetKey':_0xf46c('0x163')});db[_0xf46c('0x22')][_0xf46c('0x11d')](db[_0xf46c('0x28')],{'as':_0xf46c('0x164'),'foreignKey':_0xf46c('0x165'),'constraints':![]});db[_0xf46c('0x22')]['hasMany'](db[_0xf46c('0x26')],{'as':_0xf46c('0x166'),'foreignKey':_0xf46c('0x165'),'constraints':![]});db['VoiceCallReport'][_0xf46c('0x12d')](db[_0xf46c('0x13')],{'as':'User','foreignKey':_0xf46c('0x11b')});db[_0xf46c('0x22')][_0xf46c('0x12d')](db[_0xf46c('0x73')],{'as':_0xf46c('0x167'),'foreignKey':'ContactId'});db[_0xf46c('0x168')]['belongsTo'](db['MailAccount'],{'as':'MailAccount','foreignKey':_0xf46c('0x169')});db[_0xf46c('0x168')][_0xf46c('0x12d')](db[_0xf46c('0x10e')],{'as':'CloudProvider','foreignKey':_0xf46c('0x16a'),'onDelete':_0xf46c('0x16b')});db['MailServerOut'][_0xf46c('0x12d')](db[_0xf46c('0x3e')],{'as':_0xf46c('0x3e'),'foreignKey':_0xf46c('0x169')});db[_0xf46c('0x3d')]['belongsTo'](db[_0xf46c('0x10e')],{'as':_0xf46c('0x10e'),'foreignKey':_0xf46c('0x16a'),'onDelete':'restrict'});db[_0xf46c('0x3e')]['hasOne'](db[_0xf46c('0x168')],{'as':_0xf46c('0x16c'),'onDelete':_0xf46c('0x11c')});db['MailAccount'][_0xf46c('0x119')](db['MailServerOut'],{'as':_0xf46c('0x16d'),'onDelete':_0xf46c('0x11c')});db['MailAccount'][_0xf46c('0x11d')](db['Disposition'],{'as':_0xf46c('0x16e'),'foreignKey':_0xf46c('0x169'),'onDelete':_0xf46c('0x11c')});db[_0xf46c('0x3e')]['hasMany'](db['CannedAnswer'],{'as':_0xf46c('0x16f'),'foreignKey':_0xf46c('0x169')});db[_0xf46c('0x3e')]['hasMany'](db[_0xf46c('0x45')],{'as':'Messages','foreignKey':_0xf46c('0x169')});db[_0xf46c('0x3e')][_0xf46c('0x11d')](db[_0xf46c('0x43')],{'as':_0xf46c('0x170')});db['MailAccount'][_0xf46c('0x11d')](db[_0xf46c('0x46')],{'as':'Applications','foreignKey':_0xf46c('0x169'),'onDelete':'cascade'});db[_0xf46c('0x3e')]['belongsTo'](db[_0xf46c('0xfb')],{'as':_0xf46c('0x171'),'foreignKey':_0xf46c('0x172')});db[_0xf46c('0x3e')][_0xf46c('0x12d')](db['Template'],{'as':_0xf46c('0x173'),'foreignKey':'TemplateId'});db[_0xf46c('0x3e')]['belongsTo'](db[_0xf46c('0x88')],{'as':_0xf46c('0x174'),'foreignKey':'mandatoryDispositionPauseId'});db['MailAccount']['belongsToMany'](db[_0xf46c('0x13')],{'as':'Agents','through':'user_has_mail_accounts'});db['MailQueue'][_0xf46c('0x12f')](db['User'],{'as':_0xf46c('0x15d'),'through':_0xf46c('0x33')});db['MailQueue'][_0xf46c('0x12f')](db['Team'],{'through':'team_has_mail_queues','as':_0xf46c('0x15e')});db[_0xf46c('0x43')][_0xf46c('0x11d')](db['MailMessage'],{'as':'Messages','onDelete':_0xf46c('0x11c'),'foreignKey':_0xf46c('0x175')});db[_0xf46c('0x43')]['belongsTo'](db[_0xf46c('0x3e')],{'as':_0xf46c('0x176'),'foreignKey':'MailAccountId'});db[_0xf46c('0x43')][_0xf46c('0x12d')](db[_0xf46c('0x73')],{'as':_0xf46c('0x167'),'foreignKey':'ContactId'});db[_0xf46c('0x43')]['belongsTo'](db[_0xf46c('0x13')],{'as':'Owner','foreignKey':_0xf46c('0x11b')});db[_0xf46c('0x43')][_0xf46c('0x12f')](db[_0xf46c('0x90')],{'through':_0xf46c('0x177'),'as':_0xf46c('0x178')});db[_0xf46c('0x43')]['belongsToMany'](db['Tag'],{'through':_0xf46c('0x177'),'as':_0xf46c('0x179')});db['MailInteraction'][_0xf46c('0x12f')](db[_0xf46c('0x13')],{'as':_0xf46c('0x17a'),'through':_0xf46c('0x17b'),'foreignKey':_0xf46c('0x175')});db[_0xf46c('0x45')]['hasMany'](db[_0xf46c('0xf0')],{'as':_0xf46c('0x17c'),'onDelete':_0xf46c('0x11c')});db[_0xf46c('0x45')]['belongsTo'](db[_0xf46c('0x13')],{'as':_0xf46c('0x13')});db[_0xf46c('0x45')][_0xf46c('0x12d')](db['CmContact'],{'onDelete':'cascade','as':_0xf46c('0x167')});db[_0xf46c('0x45')][_0xf46c('0x12d')](db[_0xf46c('0x43')],{'as':'Interaction','foreignKey':_0xf46c('0x175')});db['MailMessage'][_0xf46c('0x12d')](db[_0xf46c('0x3e')],{'as':_0xf46c('0x176'),'foreignKey':_0xf46c('0x169')});db[_0xf46c('0x45')][_0xf46c('0x12d')](db[_0xf46c('0x66')],{'as':'ChatWebsite','foreignKey':_0xf46c('0x17d')});db[_0xf46c('0x45')]['belongsTo'](db['ChatOfflineMessage'],{'as':'ChatOfflineMessage','foreignKey':_0xf46c('0x17e')});db[_0xf46c('0x46')]['belongsTo'](db[_0xf46c('0x13')],{'onDelete':'restrict'});db[_0xf46c('0x46')]['belongsTo'](db[_0xf46c('0x40')],{'onDelete':'restrict'});db['MailApplication'][_0xf46c('0x12d')](db[_0xf46c('0x3e')],{'onDelete':_0xf46c('0x16b')});db[_0xf46c('0x46')][_0xf46c('0x12d')](db['Interval'],{'onDelete':_0xf46c('0x16b'),'foreignKey':'IntervalId'});db[_0xf46c('0x46')][_0xf46c('0x12d')](db[_0xf46c('0x90')],{'onDelete':_0xf46c('0x16b'),'foreignKey':_0xf46c('0x17f')});db[_0xf46c('0x180')][_0xf46c('0x12d')](db[_0xf46c('0x3e')],{});db[_0xf46c('0x180')][_0xf46c('0x12d')](db[_0xf46c('0xfb')],{'as':_0xf46c('0x171'),'foreignKey':_0xf46c('0x172')});db[_0xf46c('0x180')]['belongsTo'](db[_0xf46c('0x73')],{'as':_0xf46c('0x167'),'foreignKey':_0xf46c('0x181')});db[_0xf46c('0x180')][_0xf46c('0x12d')](db[_0xf46c('0x43')],{});db[_0xf46c('0x180')][_0xf46c('0x12d')](db[_0xf46c('0x45')],{});db['MailQueueReport'][_0xf46c('0x12d')](db[_0xf46c('0x13')],{});db[_0xf46c('0x180')][_0xf46c('0x12d')](db[_0xf46c('0x40')],{});db[_0xf46c('0x49')][_0xf46c('0x11d')](db[_0xf46c('0x4b')],{'as':'Items','onDelete':'cascade'});db[_0xf46c('0x4c')][_0xf46c('0x11d')](db['Disposition'],{'as':_0xf46c('0x16e'),'foreignKey':'FaxAccountId','onDelete':_0xf46c('0x11c')});db[_0xf46c('0x4c')][_0xf46c('0x11d')](db[_0xf46c('0x81')],{'as':_0xf46c('0x16f'),'foreignKey':'FaxAccountId'});db[_0xf46c('0x4c')]['hasMany'](db[_0xf46c('0x50')],{'as':_0xf46c('0x170')});db[_0xf46c('0x4c')][_0xf46c('0x11d')](db[_0xf46c('0x4e')],{'as':_0xf46c('0x152'),'foreignKey':'FaxAccountId','onDelete':_0xf46c('0x11c')});db[_0xf46c('0x4c')][_0xf46c('0x11d')](db['VoiceExtension'],{'as':_0xf46c('0x182'),'onDelete':'cascade'});db[_0xf46c('0x4c')][_0xf46c('0x11d')](db[_0xf46c('0x183')],{'as':_0xf46c('0x161')});db[_0xf46c('0x4c')][_0xf46c('0x12d')](db['Trunk'],{'as':_0xf46c('0x2c')});db[_0xf46c('0x4c')][_0xf46c('0x12d')](db[_0xf46c('0xfb')],{'as':_0xf46c('0x171'),'foreignKey':_0xf46c('0x172')});db['FaxAccount'][_0xf46c('0x12d')](db['Pause'],{'as':_0xf46c('0x174'),'foreignKey':_0xf46c('0x184')});db[_0xf46c('0x4c')][_0xf46c('0x12f')](db[_0xf46c('0x13')],{'as':_0xf46c('0x15d'),'through':_0xf46c('0x147')});db['FaxApplication'][_0xf46c('0x12d')](db[_0xf46c('0x13')],{'onDelete':'restrict'});db[_0xf46c('0x4e')]['belongsTo'](db['FaxQueue'],{'onDelete':'restrict'});db[_0xf46c('0x4e')][_0xf46c('0x12d')](db[_0xf46c('0x4c')],{'onDelete':_0xf46c('0x16b')});db['FaxApplication']['belongsTo'](db['Tag'],{'onDelete':'restrict','foreignKey':_0xf46c('0x17f')});db[_0xf46c('0x50')]['hasMany'](db[_0xf46c('0x183')],{'as':_0xf46c('0x161'),'onDelete':_0xf46c('0x11c'),'foreignKey':_0xf46c('0x185')});db[_0xf46c('0x50')][_0xf46c('0x12d')](db[_0xf46c('0x4c')],{'as':_0xf46c('0x176'),'foreignKey':_0xf46c('0x186')});db[_0xf46c('0x50')][_0xf46c('0x12d')](db['CmContact'],{'as':_0xf46c('0x167'),'foreignKey':_0xf46c('0x181')});db[_0xf46c('0x50')][_0xf46c('0x12d')](db[_0xf46c('0x13')],{'as':_0xf46c('0x187'),'foreignKey':'UserId'});db[_0xf46c('0x50')][_0xf46c('0x12f')](db['Tag'],{'through':_0xf46c('0x188'),'as':_0xf46c('0x178')});db[_0xf46c('0x50')][_0xf46c('0x12f')](db['Tag'],{'through':'fax_interaction_has_tags','as':_0xf46c('0x179')});db[_0xf46c('0x50')][_0xf46c('0x12f')](db[_0xf46c('0x13')],{'as':'Users','through':_0xf46c('0x136'),'foreignKey':'FaxInteractionId'});db[_0xf46c('0x183')][_0xf46c('0x12d')](db[_0xf46c('0x13')],{'onDelete':_0xf46c('0x11c'),'as':'User'});db['FaxMessage'][_0xf46c('0x12d')](db[_0xf46c('0x50')],{'as':_0xf46c('0x189'),'foreignKey':'FaxInteractionId'});db[_0xf46c('0x183')]['belongsTo'](db[_0xf46c('0x73')],{'onDelete':'cascade','as':_0xf46c('0x167')});db[_0xf46c('0x183')][_0xf46c('0x12d')](db['Attachment'],{'as':'Attachment','foreignKey':'AttachmentId'});db[_0xf46c('0x183')][_0xf46c('0x12d')](db[_0xf46c('0x4c')],{'as':_0xf46c('0x176'),'foreignKey':_0xf46c('0x186')});db[_0xf46c('0x51')]['belongsToMany'](db[_0xf46c('0x13')],{'as':_0xf46c('0x15d'),'through':_0xf46c('0x13f')});db[_0xf46c('0x51')]['belongsToMany'](db[_0xf46c('0xe9')],{'through':_0xf46c('0x18a'),'as':'Teams'});db['FaxQueueReport'][_0xf46c('0x12d')](db[_0xf46c('0x4c')],{});db[_0xf46c('0x53')][_0xf46c('0x12d')](db[_0xf46c('0xfb')],{'as':_0xf46c('0x171'),'foreignKey':'ListId'});db[_0xf46c('0x53')][_0xf46c('0x12d')](db[_0xf46c('0x73')],{'as':'Contact','foreignKey':_0xf46c('0x181')});db[_0xf46c('0x53')]['belongsTo'](db[_0xf46c('0x50')],{});db[_0xf46c('0x53')][_0xf46c('0x12d')](db['FaxMessage'],{});db[_0xf46c('0x53')]['belongsTo'](db['User'],{});db['FaxQueueReport']['belongsTo'](db[_0xf46c('0x51')],{});db[_0xf46c('0x55')]['hasMany'](db[_0xf46c('0x83')],{'as':_0xf46c('0x16e'),'foreignKey':_0xf46c('0x18b'),'onDelete':_0xf46c('0x11c')});db[_0xf46c('0x55')][_0xf46c('0x11d')](db[_0xf46c('0x81')],{'as':_0xf46c('0x16f'),'foreignKey':'SmsAccountId'});db[_0xf46c('0x55')][_0xf46c('0x11d')](db[_0xf46c('0x59')],{'as':'Messages','foreignKey':_0xf46c('0x18b')});db[_0xf46c('0x55')][_0xf46c('0x11d')](db[_0xf46c('0x127')],{'as':_0xf46c('0x170')});db[_0xf46c('0x55')][_0xf46c('0x11d')](db[_0xf46c('0x57')],{'as':_0xf46c('0x152'),'foreignKey':_0xf46c('0x18b'),'onDelete':_0xf46c('0x11c')});db['SmsAccount'][_0xf46c('0x12d')](db[_0xf46c('0xfb')],{'as':_0xf46c('0x171'),'foreignKey':_0xf46c('0x172')});db[_0xf46c('0x55')][_0xf46c('0x12d')](db[_0xf46c('0x88')],{'as':_0xf46c('0x174'),'foreignKey':_0xf46c('0x184')});db['SmsAccount'][_0xf46c('0x12f')](db[_0xf46c('0x13')],{'as':'Agents','through':_0xf46c('0x14b')});db[_0xf46c('0x57')][_0xf46c('0x12d')](db[_0xf46c('0x13')],{'onDelete':_0xf46c('0x16b')});db[_0xf46c('0x57')][_0xf46c('0x12d')](db[_0xf46c('0x5b')],{'onDelete':_0xf46c('0x16b')});db[_0xf46c('0x57')][_0xf46c('0x12d')](db[_0xf46c('0x55')],{'onDelete':_0xf46c('0x16b')});db[_0xf46c('0x57')][_0xf46c('0x12d')](db[_0xf46c('0x15b')],{'onDelete':_0xf46c('0x16b'),'foreignKey':_0xf46c('0x18c')});db[_0xf46c('0x57')][_0xf46c('0x12d')](db[_0xf46c('0x90')],{'onDelete':_0xf46c('0x16b'),'foreignKey':_0xf46c('0x17f')});db['SmsInteraction'][_0xf46c('0x11d')](db[_0xf46c('0x59')],{'as':_0xf46c('0x161'),'onDelete':'cascade','foreignKey':_0xf46c('0x18d')});db['SmsInteraction'][_0xf46c('0x12d')](db['SmsAccount'],{'as':_0xf46c('0x176'),'foreignKey':_0xf46c('0x18b')});db['SmsInteraction'][_0xf46c('0x12d')](db[_0xf46c('0x73')],{'as':_0xf46c('0x167'),'foreignKey':_0xf46c('0x181')});db[_0xf46c('0x127')][_0xf46c('0x12d')](db['User'],{'as':'Owner','foreignKey':_0xf46c('0x11b')});db[_0xf46c('0x127')]['belongsToMany'](db[_0xf46c('0x90')],{'through':'sms_interaction_has_tags','as':_0xf46c('0x178')});db[_0xf46c('0x127')][_0xf46c('0x12f')](db['Tag'],{'through':'sms_interaction_has_tags','as':_0xf46c('0x179')});db[_0xf46c('0x127')][_0xf46c('0x12f')](db[_0xf46c('0x13')],{'as':_0xf46c('0x17a'),'through':'user_has_sms_interactions','foreignKey':_0xf46c('0x18d')});db['SmsMessage'][_0xf46c('0x12d')](db[_0xf46c('0x13')],{'as':_0xf46c('0x13')});db['SmsMessage'][_0xf46c('0x12d')](db[_0xf46c('0x73')],{'onDelete':_0xf46c('0x11c'),'as':_0xf46c('0x167')});db['SmsMessage'][_0xf46c('0x12d')](db[_0xf46c('0x127')],{'onDelete':_0xf46c('0x11c'),'as':_0xf46c('0x189'),'foreignKey':_0xf46c('0x18d')});db[_0xf46c('0x59')][_0xf46c('0x12d')](db['SmsAccount'],{'as':'Account','foreignKey':_0xf46c('0x18b')});db['SmsQueue'][_0xf46c('0x12f')](db[_0xf46c('0x13')],{'as':_0xf46c('0x15d'),'through':_0xf46c('0x36'),'foreignKey':_0xf46c('0x18e')});db[_0xf46c('0x5b')][_0xf46c('0x12f')](db['Team'],{'through':_0xf46c('0x18f'),'as':'Teams'});db[_0xf46c('0x5d')][_0xf46c('0x11d')](db[_0xf46c('0x83')],{'as':'Dispositions','foreignKey':_0xf46c('0x190'),'onDelete':_0xf46c('0x11c')});db[_0xf46c('0x5d')]['hasMany'](db['CannedAnswer'],{'as':'Answers','foreignKey':_0xf46c('0x190')});db['OpenchannelAccount'][_0xf46c('0x11d')](db[_0xf46c('0x60')],{'as':_0xf46c('0x170'),'foreignKey':_0xf46c('0x190')});db[_0xf46c('0x5d')][_0xf46c('0x11d')](db['OpenchannelMessage'],{'as':_0xf46c('0x161'),'foreignKey':_0xf46c('0x190')});db[_0xf46c('0x5d')][_0xf46c('0x11d')](db[_0xf46c('0x5f')],{'as':_0xf46c('0x152'),'foreignKey':_0xf46c('0x190'),'onDelete':_0xf46c('0x11c')});db[_0xf46c('0x5d')]['belongsTo'](db[_0xf46c('0xfb')],{'as':_0xf46c('0x171'),'foreignKey':_0xf46c('0x172')});db[_0xf46c('0x5d')]['belongsTo'](db[_0xf46c('0x88')],{'as':_0xf46c('0x174'),'foreignKey':'mandatoryDispositionPauseId'});db[_0xf46c('0x5d')][_0xf46c('0x12f')](db[_0xf46c('0x13')],{'as':_0xf46c('0x15d'),'through':_0xf46c('0x149')});db[_0xf46c('0x5f')][_0xf46c('0x12d')](db[_0xf46c('0x13')],{'onDelete':'restrict'});db[_0xf46c('0x5f')][_0xf46c('0x12d')](db[_0xf46c('0x64')],{'onDelete':'restrict','foreignKey':'OpenchannelQueueId'});db[_0xf46c('0x5f')]['belongsTo'](db[_0xf46c('0x5d')],{'onDelete':_0xf46c('0x16b'),'foreignKey':_0xf46c('0x190')});db[_0xf46c('0x5f')][_0xf46c('0x12d')](db[_0xf46c('0x15b')],{'onDelete':_0xf46c('0x16b'),'foreignKey':_0xf46c('0x18c')});db[_0xf46c('0x5f')][_0xf46c('0x12d')](db[_0xf46c('0x90')],{'onDelete':_0xf46c('0x16b'),'foreignKey':_0xf46c('0x17f')});db['OpenchannelInteraction'][_0xf46c('0x11d')](db[_0xf46c('0x62')],{'as':_0xf46c('0x161'),'onDelete':'cascade','foreignKey':'OpenchannelInteractionId'});db[_0xf46c('0x60')][_0xf46c('0x12d')](db[_0xf46c('0x5d')],{'as':_0xf46c('0x176'),'foreignKey':'OpenchannelAccountId'});db[_0xf46c('0x60')][_0xf46c('0x12d')](db[_0xf46c('0x73')],{'as':_0xf46c('0x167'),'foreignKey':_0xf46c('0x181')});db[_0xf46c('0x60')][_0xf46c('0x12d')](db[_0xf46c('0x13')],{'as':_0xf46c('0x187'),'foreignKey':_0xf46c('0x11b')});db[_0xf46c('0x60')][_0xf46c('0x12f')](db[_0xf46c('0x90')],{'through':_0xf46c('0x191'),'as':'Tags'});db[_0xf46c('0x60')][_0xf46c('0x12f')](db[_0xf46c('0x90')],{'through':_0xf46c('0x191'),'as':_0xf46c('0x179')});db[_0xf46c('0x60')][_0xf46c('0x12f')](db[_0xf46c('0x13')],{'as':_0xf46c('0x17a'),'through':'user_has_openchannel_interactions','foreignKey':_0xf46c('0x192')});db[_0xf46c('0x62')][_0xf46c('0x12d')](db['User'],{'onDelete':_0xf46c('0x11c'),'as':_0xf46c('0x13')});db[_0xf46c('0x62')][_0xf46c('0x12d')](db[_0xf46c('0x73')],{'onDelete':'cascade','as':_0xf46c('0x167')});db[_0xf46c('0x62')][_0xf46c('0x12d')](db[_0xf46c('0x60')],{'onDelete':'cascade','as':_0xf46c('0x189'),'foreignKey':_0xf46c('0x192')});db[_0xf46c('0x62')][_0xf46c('0x12d')](db[_0xf46c('0xf0')],{'as':_0xf46c('0xf0'),'foreignKey':_0xf46c('0x193')});db[_0xf46c('0x62')][_0xf46c('0x12d')](db[_0xf46c('0x5d')],{'as':'Account','foreignKey':_0xf46c('0x190')});db[_0xf46c('0x64')]['belongsToMany'](db[_0xf46c('0x13')],{'as':_0xf46c('0x15d'),'through':_0xf46c('0x38'),'foreignKey':'OpenchannelQueueId'});db['OpenchannelQueue']['belongsToMany'](db['Team'],{'through':_0xf46c('0x194'),'as':'Teams'});db[_0xf46c('0x66')][_0xf46c('0x11d')](db['Disposition'],{'as':'Dispositions','foreignKey':_0xf46c('0x17d'),'onDelete':'cascade'});db[_0xf46c('0x66')][_0xf46c('0x11d')](db[_0xf46c('0x81')],{'as':_0xf46c('0x16f'),'foreignKey':_0xf46c('0x17d')});db[_0xf46c('0x66')][_0xf46c('0x11d')](db[_0xf46c('0x70')],{'as':_0xf46c('0x195')});db[_0xf46c('0x66')][_0xf46c('0x11d')](db[_0xf46c('0x125')],{'as':_0xf46c('0x170')});db[_0xf46c('0x66')][_0xf46c('0x11d')](db[_0xf46c('0x196')],{'as':_0xf46c('0x152'),'foreignKey':_0xf46c('0x17d'),'onDelete':_0xf46c('0x11c')});db[_0xf46c('0x66')][_0xf46c('0x11d')](db[_0xf46c('0x6b')],{'as':'Messages'});db[_0xf46c('0x66')][_0xf46c('0x12d')](db[_0xf46c('0xfb')],{'as':_0xf46c('0x171'),'foreignKey':'ListId'});db['ChatWebsite']['belongsTo'](db[_0xf46c('0x15b')],{'as':_0xf46c('0x15b'),'foreignKey':_0xf46c('0x18c')});db[_0xf46c('0x66')][_0xf46c('0x12d')](db[_0xf46c('0x3e')],{'as':_0xf46c('0x3e'),'foreignKey':'MailAccountId'});db[_0xf46c('0x66')]['belongsTo'](db[_0xf46c('0x88')],{'as':_0xf46c('0x174'),'foreignKey':_0xf46c('0x184')});db['ChatWebsite'][_0xf46c('0x12f')](db['User'],{'as':_0xf46c('0x15d'),'through':_0xf46c('0x145')});db[_0xf46c('0x68')][_0xf46c('0x12d')](db[_0xf46c('0x5d')],{});db['OpenchannelQueueReport'][_0xf46c('0x12d')](db[_0xf46c('0xfb')],{'as':_0xf46c('0x171'),'foreignKey':_0xf46c('0x172')});db[_0xf46c('0x68')][_0xf46c('0x12d')](db['CmContact'],{'as':'Contact','foreignKey':_0xf46c('0x181')});db['OpenchannelQueueReport'][_0xf46c('0x12d')](db[_0xf46c('0x60')],{});db[_0xf46c('0x68')][_0xf46c('0x12d')](db[_0xf46c('0x62')],{});db[_0xf46c('0x68')][_0xf46c('0x12d')](db['User'],{});db[_0xf46c('0x68')][_0xf46c('0x12d')](db[_0xf46c('0x64')],{});db[_0xf46c('0x196')][_0xf46c('0x12d')](db[_0xf46c('0x13')],{'as':_0xf46c('0x197'),'foreignKey':_0xf46c('0x11b'),'onDelete':_0xf46c('0x16b')});db['ChatApplication'][_0xf46c('0x12d')](db['ChatQueue'],{'as':_0xf46c('0x198'),'foreignKey':_0xf46c('0x199'),'onDelete':_0xf46c('0x16b')});db[_0xf46c('0x196')][_0xf46c('0x12d')](db[_0xf46c('0x66')],{'as':_0xf46c('0x19a'),'foreignKey':_0xf46c('0x17d'),'onDelete':_0xf46c('0x16b')});db['ChatApplication'][_0xf46c('0x12d')](db[_0xf46c('0x90')],{'onDelete':_0xf46c('0x16b'),'foreignKey':'TagId'});db[_0xf46c('0x125')][_0xf46c('0x11d')](db['ChatMessage'],{'as':_0xf46c('0x161'),'onDelete':'cascade','foreignKey':_0xf46c('0x19b')});db[_0xf46c('0x125')][_0xf46c('0x12d')](db[_0xf46c('0x66')],{'as':_0xf46c('0x176'),'foreignKey':_0xf46c('0x17d')});db[_0xf46c('0x125')]['belongsTo'](db[_0xf46c('0x73')],{'as':_0xf46c('0x167'),'foreignKey':'ContactId'});db['ChatInteraction']['belongsTo'](db[_0xf46c('0x13')],{'as':_0xf46c('0x187'),'foreignKey':_0xf46c('0x11b')});db[_0xf46c('0x125')][_0xf46c('0x12f')](db['Tag'],{'through':'chat_interaction_has_tags','as':_0xf46c('0x178')});db[_0xf46c('0x125')][_0xf46c('0x12f')](db[_0xf46c('0x90')],{'through':'chat_interaction_has_tags','as':'ThroughTags'});db[_0xf46c('0x125')]['belongsToMany'](db[_0xf46c('0x13')],{'as':_0xf46c('0x17a'),'through':_0xf46c('0x134'),'foreignKey':_0xf46c('0x19b')});db['ChatMessage']['belongsTo'](db[_0xf46c('0x13')],{'onDelete':_0xf46c('0x11c'),'as':_0xf46c('0x13')});db['ChatMessage'][_0xf46c('0x12d')](db[_0xf46c('0x73')],{'onDelete':'cascade','as':'Contact','foreignKey':_0xf46c('0x181')});db[_0xf46c('0x6b')]['belongsTo'](db['ChatInteraction'],{'onDelete':_0xf46c('0x11c'),'as':'Interaction','foreignKey':_0xf46c('0x19b')});db[_0xf46c('0x6b')]['belongsTo'](db[_0xf46c('0xf0')],{'as':_0xf46c('0xf0'),'foreignKey':_0xf46c('0x193')});db['ChatMessage']['belongsTo'](db[_0xf46c('0x66')],{'as':_0xf46c('0x176'),'foreignKey':_0xf46c('0x17d')});db['ChatOfflineMessage']['hasMany'](db['Attachment'],{'as':_0xf46c('0x17c'),'foreignKey':'ChatOfflineMessageId','onDelete':_0xf46c('0x11c'),'hooks':!![]});db['ChatOfflineMessage'][_0xf46c('0x12d')](db[_0xf46c('0x73')],{'onDelete':_0xf46c('0x11c'),'as':'Contact','foreignKey':'ContactId'});db['ChatOfflineMessage']['belongsTo'](db[_0xf46c('0x66')],{'as':_0xf46c('0x176'),'foreignKey':_0xf46c('0x17d')});db[_0xf46c('0x6d')][_0xf46c('0x12f')](db[_0xf46c('0x13')],{'as':_0xf46c('0x15d'),'through':_0xf46c('0x31'),'hooks':!![]});db[_0xf46c('0x6d')]['belongsToMany'](db[_0xf46c('0xe9')],{'through':_0xf46c('0x19c'),'as':_0xf46c('0x15e')});db['ChatGroup']['hasMany'](db[_0xf46c('0xd2')],{'as':_0xf46c('0x161'),'foreignKey':'ChatGroupId','onDelete':_0xf46c('0x11c')});db[_0xf46c('0x6e')]['belongsToMany'](db[_0xf46c('0x13')],{'as':'Members','through':_0xf46c('0x19d')});db[_0xf46c('0x70')][_0xf46c('0x12d')](db[_0xf46c('0x66')],{'as':'Website','foreignKey':_0xf46c('0x17d')});db[_0xf46c('0x19e')][_0xf46c('0x11d')](db['CmContact'],{'as':_0xf46c('0x130'),'foreignKey':'CompanyId'});db[_0xf46c('0x73')][_0xf46c('0x11d')](db[_0xf46c('0x93')],{'as':'Phones','foreignKey':_0xf46c('0x19f')});db['CmContact'][_0xf46c('0x11d')](db[_0xf46c('0x75')],{'as':_0xf46c('0x12c'),'foreignKey':'ContactId'});db[_0xf46c('0x73')][_0xf46c('0x11d')](db['CmHopperFinal'],{'as':_0xf46c('0x122'),'foreignKey':_0xf46c('0x181')});db[_0xf46c('0x73')][_0xf46c('0x11d')](db[_0xf46c('0x7a')],{'as':_0xf46c('0x156'),'foreignKey':_0xf46c('0x181')});db[_0xf46c('0x73')]['hasMany'](db['ReportAgentPreview'],{'as':'ReportAgentPreview','foreignKey':_0xf46c('0x181')});db[_0xf46c('0x73')][_0xf46c('0x11d')](db['JscriptySessionReport'],{'as':_0xf46c('0x158'),'foreignKey':_0xf46c('0x181')});db[_0xf46c('0x73')]['hasMany'](db[_0xf46c('0x60')],{'as':_0xf46c('0x138'),'foreignKey':'ContactId','onDelete':_0xf46c('0x16b')});db[_0xf46c('0x73')][_0xf46c('0x11d')](db[_0xf46c('0x125')],{'as':_0xf46c('0x126'),'foreignKey':_0xf46c('0x181'),'onDelete':'restrict'});db[_0xf46c('0x73')][_0xf46c('0x11d')](db[_0xf46c('0x127')],{'as':'SmsInteractions','foreignKey':_0xf46c('0x181'),'onDelete':_0xf46c('0x16b')});db['CmContact'][_0xf46c('0x11d')](db[_0xf46c('0x50')],{'as':_0xf46c('0x135'),'foreignKey':_0xf46c('0x181'),'onDelete':_0xf46c('0x16b')});db[_0xf46c('0x73')][_0xf46c('0x11d')](db['MailInteraction'],{'as':_0xf46c('0x129'),'foreignKey':'ContactId','onDelete':_0xf46c('0x16b')});db[_0xf46c('0x73')][_0xf46c('0x12d')](db[_0xf46c('0x19e')],{'as':_0xf46c('0x1a0'),'foreignKey':_0xf46c('0x1a1')});db[_0xf46c('0x73')][_0xf46c('0x12d')](db[_0xf46c('0xfb')],{'as':'List','foreignKey':_0xf46c('0x172'),'onDelete':_0xf46c('0x11c')});db[_0xf46c('0x73')][_0xf46c('0x12f')](db['User'],{'as':_0xf46c('0x17a'),'through':_0xf46c('0x131')});db['CmContact']['belongsToMany'](db[_0xf46c('0x90')],{'as':_0xf46c('0x178'),'through':_0xf46c('0x1a2')});db[_0xf46c('0x73')][_0xf46c('0x12f')](db[_0xf46c('0x90')],{'through':'cm_contact_has_tags','as':_0xf46c('0x179')});db[_0xf46c('0x75')][_0xf46c('0x11d')](db[_0xf46c('0x94')],{'as':_0xf46c('0x1a3'),'foreignKey':_0xf46c('0x1a4')});db[_0xf46c('0x75')][_0xf46c('0x12d')](db[_0xf46c('0x73')],{'as':_0xf46c('0x167'),'foreignKey':_0xf46c('0x181'),'onDelete':_0xf46c('0x11c')});db[_0xf46c('0x75')]['belongsTo'](db[_0xf46c('0xfb')],{'as':_0xf46c('0x171'),'foreignKey':_0xf46c('0x172'),'onDelete':_0xf46c('0x11c')});db[_0xf46c('0x75')][_0xf46c('0x12d')](db['User'],{'as':'Agent','foreignKey':_0xf46c('0x11b')});db['CmHopper'][_0xf46c('0x12d')](db[_0xf46c('0x1b')],{'as':_0xf46c('0x198'),'foreignKey':'VoiceQueueId','onDelete':_0xf46c('0x11c')});db[_0xf46c('0x75')]['belongsTo'](db[_0xf46c('0x1a5')],{'as':'Campaign','foreignKey':_0xf46c('0x1a6'),'onDelete':_0xf46c('0x11c')});db[_0xf46c('0x75')][_0xf46c('0x12d')](db[_0xf46c('0x13')],{'as':_0xf46c('0x187'),'foreignKey':_0xf46c('0x1a7')});db[_0xf46c('0x77')][_0xf46c('0x12d')](db[_0xf46c('0x73')],{'as':_0xf46c('0x167'),'foreignKey':_0xf46c('0x181'),'onDelete':_0xf46c('0x11c')});db['CmHopperBlack'][_0xf46c('0x12d')](db['CmList'],{'as':'List','foreignKey':'ListId','onDelete':'cascade'});db[_0xf46c('0x77')][_0xf46c('0x12d')](db[_0xf46c('0x1b')],{'as':_0xf46c('0x198'),'foreignKey':_0xf46c('0x155'),'onDelete':_0xf46c('0x11c')});db[_0xf46c('0x77')]['belongsTo'](db[_0xf46c('0x1a5')],{'as':_0xf46c('0x1a5'),'foreignKey':_0xf46c('0x1a6'),'onDelete':_0xf46c('0x11c')});db[_0xf46c('0x7f')][_0xf46c('0x11d')](db[_0xf46c('0x85')],{'as':{'plural':'All','singular':_0xf46c('0x1a8')},'foreignKey':'AutomationAllId','onDelete':_0xf46c('0x11c'),'hooks':!![]});db[_0xf46c('0x7f')][_0xf46c('0x11d')](db[_0xf46c('0x85')],{'as':{'plural':_0xf46c('0x1a9'),'singular':_0xf46c('0x1aa')},'foreignKey':_0xf46c('0x1ab'),'onDelete':'cascade','hooks':!![]});db['Automation'][_0xf46c('0x11d')](db[_0xf46c('0x7d')],{'as':_0xf46c('0x1ac'),'foreignKey':_0xf46c('0x1ad'),'onDelete':_0xf46c('0x11c'),'hooks':!![]});db['Disposition'][_0xf46c('0x11d')](db['Disposition'],{'as':'Dispositions','foreignKey':'ParentId','onDelete':'cascade'});db[_0xf46c('0x15b')][_0xf46c('0x11d')](db[_0xf46c('0x15b')],{'as':_0xf46c('0x1ae'),'foreignKey':'IntervalId','onDelete':_0xf46c('0x11c'),'hooks':!![],'required':![]});db[_0xf46c('0x15b')][_0xf46c('0x11d')](db[_0xf46c('0x14f')],{'as':'Extensions','foreignKey':_0xf46c('0x18c'),'onDelete':'restrict'});db[_0xf46c('0x15b')]['hasMany'](db[_0xf46c('0x46')],{'as':_0xf46c('0x1af'),'foreignKey':_0xf46c('0x18c')});db[_0xf46c('0x15b')]['hasMany'](db['ChatApplication'],{'as':_0xf46c('0x1b0'),'foreignKey':_0xf46c('0x18c')});db[_0xf46c('0x15b')][_0xf46c('0x11d')](db[_0xf46c('0x4e')],{'as':_0xf46c('0x1b1'),'foreignKey':_0xf46c('0x18c')});db[_0xf46c('0x15b')]['hasMany'](db['SmsApplication'],{'as':_0xf46c('0x1b2'),'foreignKey':_0xf46c('0x18c')});db['Schedule'][_0xf46c('0x12d')](db['MailAccount'],{});db['Schedule']['belongsTo'](db[_0xf46c('0x1b3')],{'foreignKey':'DefaultReportId'});db['Schedule'][_0xf46c('0x12d')](db[_0xf46c('0x9d')],{'foreignKey':_0xf46c('0x1b4')});db['Sound'][_0xf46c('0x12f')](db[_0xf46c('0x19')],{'as':'Mohs','through':_0xf46c('0x154'),'onDelete':_0xf46c('0x16b')});db['Tag'][_0xf46c('0x12f')](db['CmContact'],{'through':_0xf46c('0x1a2')});db[_0xf46c('0x90')][_0xf46c('0x12f')](db[_0xf46c('0x125')],{'through':_0xf46c('0x1b5')});db[_0xf46c('0x90')][_0xf46c('0x12f')](db[_0xf46c('0x43')],{'through':_0xf46c('0x177')});db['Tag'][_0xf46c('0x12f')](db[_0xf46c('0x127')],{'through':_0xf46c('0x1b6')});db[_0xf46c('0x90')][_0xf46c('0x12f')](db['FaxInteraction'],{'through':_0xf46c('0x188')});db[_0xf46c('0x90')]['belongsToMany'](db[_0xf46c('0x60')],{'through':_0xf46c('0x191')});db[_0xf46c('0x90')][_0xf46c('0x12f')](db[_0xf46c('0x106')],{'through':'whatsapp_interaction_has_tags'});db[_0xf46c('0x93')][_0xf46c('0x12d')](db['ContactItemType'],{'as':_0xf46c('0x1b7'),'foreignKey':_0xf46c('0x1b8')});db[_0xf46c('0x94')][_0xf46c('0x12d')](db['CmHopper'],{'as':_0xf46c('0x1b9'),'foreignKey':_0xf46c('0x1a4')});db[_0xf46c('0x93')][_0xf46c('0x12d')](db[_0xf46c('0x73')],{'as':_0xf46c('0x167'),'foreignKey':_0xf46c('0x19f')});db[_0xf46c('0x96')][_0xf46c('0x11d')](db[_0xf46c('0x85')],{'as':{'plural':_0xf46c('0x1ba'),'singular':_0xf46c('0x1bb')},'foreignKey':_0xf46c('0x1bc'),'onDelete':'cascade','hooks':!![]});db[_0xf46c('0x96')][_0xf46c('0x11d')](db[_0xf46c('0x85')],{'as':{'plural':_0xf46c('0x1bd'),'singular':_0xf46c('0x1be')},'foreignKey':_0xf46c('0x1bf'),'onDelete':_0xf46c('0x11c'),'hooks':!![]});db['Trigger'][_0xf46c('0x11d')](db[_0xf46c('0x7d')],{'as':_0xf46c('0x1ac'),'foreignKey':_0xf46c('0x1c0'),'onDelete':'cascade','hooks':!![]});db[_0xf46c('0x9d')][_0xf46c('0x11d')](db[_0xf46c('0xa2')],{'as':_0xf46c('0x1c1'),'onDelete':_0xf46c('0x11c'),'foreignKey':'CustomReportId','hooks':!![]});db[_0xf46c('0x1b3')][_0xf46c('0x11d')](db[_0xf46c('0xa2')],{'as':_0xf46c('0x1c1'),'onDelete':_0xf46c('0x11c'),'foreignKey':'DefaultReportId'});db[_0xf46c('0x1c2')][_0xf46c('0x11d')](db[_0xf46c('0xa2')],{'as':_0xf46c('0x1c1'),'onDelete':_0xf46c('0x11c'),'foreignKey':_0xf46c('0x1c3')});db[_0xf46c('0xa2')][_0xf46c('0x12d')](db['AnalyticMetric'],{'foreignKey':'MetricId'});db[_0xf46c('0xa5')][_0xf46c('0x11d')](db[_0xf46c('0xa7')],{'as':_0xf46c('0x1c4'),'onDelete':'cascade','foreignKey':_0xf46c('0x1c5')});db[_0xf46c('0xa7')]['hasMany'](db[_0xf46c('0x1c6')],{'as':_0xf46c('0x1c7'),'onDelete':_0xf46c('0x11c'),'foreignKey':_0xf46c('0x1c8')});db[_0xf46c('0xa7')][_0xf46c('0x11d')](db[_0xf46c('0x1c6')],{'as':'Descriptions','onDelete':_0xf46c('0x11c'),'foreignKey':_0xf46c('0x1c9')});db[_0xf46c('0xa7')][_0xf46c('0x11d')](db[_0xf46c('0x1c6')],{'as':_0xf46c('0x1c1'),'onDelete':_0xf46c('0x11c'),'foreignKey':_0xf46c('0x1ca')});db[_0xf46c('0xa7')][_0xf46c('0x12d')](db[_0xf46c('0xa5')],{'as':_0xf46c('0x176'),'foreignKey':_0xf46c('0x1c5')});db[_0xf46c('0x1c6')]['hasMany'](db['SalesforceField'],{'as':_0xf46c('0x1cb'),'foreignKey':_0xf46c('0x1c8')});db['SalesforceField']['hasMany'](db[_0xf46c('0x1c6')],{'as':_0xf46c('0x1cc'),'foreignKey':_0xf46c('0x1c9')});db[_0xf46c('0x1c6')][_0xf46c('0x11d')](db['SalesforceField'],{'as':_0xf46c('0x1cd'),'foreignKey':'FieldId'});db['SalesforceField'][_0xf46c('0x12d')](db['Variable'],{'as':_0xf46c('0x98'),'foreignKey':_0xf46c('0x1ce')});db[_0xf46c('0xaa')][_0xf46c('0x11d')](db[_0xf46c('0xac')],{'as':_0xf46c('0x1c4'),'onDelete':_0xf46c('0x11c'),'foreignKey':'AccountId'});db[_0xf46c('0xac')][_0xf46c('0x11d')](db['SugarcrmField'],{'as':_0xf46c('0x1c7'),'onDelete':_0xf46c('0x11c'),'foreignKey':'SubjectId'});db[_0xf46c('0xac')][_0xf46c('0x11d')](db[_0xf46c('0xae')],{'as':'Descriptions','onDelete':_0xf46c('0x11c'),'foreignKey':_0xf46c('0x1c9')});db['SugarcrmConfiguration'][_0xf46c('0x11d')](db['SugarcrmField'],{'as':'Fields','onDelete':_0xf46c('0x11c'),'foreignKey':_0xf46c('0x1ca')});db[_0xf46c('0xac')]['belongsTo'](db['SugarcrmAccount'],{'as':_0xf46c('0x176'),'foreignKey':'AccountId'});db['SugarcrmField'][_0xf46c('0x11d')](db[_0xf46c('0xae')],{'as':_0xf46c('0x1cb'),'foreignKey':_0xf46c('0x1c8')});db[_0xf46c('0xae')][_0xf46c('0x11d')](db[_0xf46c('0xae')],{'as':_0xf46c('0x1cc'),'foreignKey':'DescriptionId'});db['SugarcrmField'][_0xf46c('0x11d')](db[_0xf46c('0xae')],{'as':'Field','foreignKey':_0xf46c('0x1ca')});db[_0xf46c('0xae')][_0xf46c('0x12d')](db[_0xf46c('0x98')],{'as':'Variable','foreignKey':_0xf46c('0x1ce')});db[_0xf46c('0x1cf')][_0xf46c('0x11d')](db[_0xf46c('0x1d0')],{'as':'Configurations','onDelete':_0xf46c('0x11c'),'foreignKey':_0xf46c('0x1c5')});db[_0xf46c('0x1d0')][_0xf46c('0x11d')](db[_0xf46c('0xb1')],{'as':_0xf46c('0x1c7'),'onDelete':_0xf46c('0x11c'),'foreignKey':_0xf46c('0x1c8')});db[_0xf46c('0x1d0')][_0xf46c('0x11d')](db['DeskField'],{'as':_0xf46c('0x1d1'),'onDelete':_0xf46c('0x11c'),'foreignKey':_0xf46c('0x1c9')});db['DeskConfiguration'][_0xf46c('0x11d')](db[_0xf46c('0xb1')],{'as':_0xf46c('0x1c1'),'onDelete':_0xf46c('0x11c'),'foreignKey':'FieldId'});db[_0xf46c('0x1d0')][_0xf46c('0x12d')](db['DeskAccount'],{'as':_0xf46c('0x176'),'foreignKey':_0xf46c('0x1c5')});db[_0xf46c('0x1d0')][_0xf46c('0x12f')](db[_0xf46c('0x90')],{'through':'int_desk_configuration_has_tags'});db[_0xf46c('0xb1')][_0xf46c('0x11d')](db['DeskField'],{'as':_0xf46c('0x1cb'),'foreignKey':'SubjectId'});db[_0xf46c('0xb1')][_0xf46c('0x11d')](db[_0xf46c('0xb1')],{'as':_0xf46c('0x1cc'),'foreignKey':_0xf46c('0x1c9')});db[_0xf46c('0xb1')][_0xf46c('0x11d')](db[_0xf46c('0xb1')],{'as':_0xf46c('0x1cd'),'foreignKey':_0xf46c('0x1ca')});db[_0xf46c('0xb1')][_0xf46c('0x12d')](db[_0xf46c('0x98')],{'as':'Variable','foreignKey':_0xf46c('0x1ce')});db['ZohoAccount']['hasMany'](db['ZohoConfiguration'],{'as':_0xf46c('0x1c4'),'onDelete':_0xf46c('0x11c'),'foreignKey':_0xf46c('0x1c5')});db[_0xf46c('0x1d2')][_0xf46c('0x11d')](db[_0xf46c('0x1d3')],{'as':_0xf46c('0x1c7'),'onDelete':_0xf46c('0x11c'),'foreignKey':'SubjectId'});db['ZohoConfiguration']['hasMany'](db[_0xf46c('0x1d3')],{'as':_0xf46c('0x1d1'),'onDelete':_0xf46c('0x11c'),'foreignKey':_0xf46c('0x1c9')});db[_0xf46c('0x1d2')][_0xf46c('0x11d')](db[_0xf46c('0x1d3')],{'as':_0xf46c('0x1c1'),'onDelete':'cascade','foreignKey':_0xf46c('0x1ca')});db[_0xf46c('0x1d2')]['belongsTo'](db[_0xf46c('0x1d4')],{'as':_0xf46c('0x176'),'foreignKey':'AccountId'});db[_0xf46c('0x1d3')][_0xf46c('0x11d')](db[_0xf46c('0x1d3')],{'as':_0xf46c('0x1cb'),'foreignKey':'SubjectId'});db[_0xf46c('0x1d3')][_0xf46c('0x11d')](db['ZohoField'],{'as':_0xf46c('0x1cc'),'foreignKey':'DescriptionId'});db['ZohoField'][_0xf46c('0x11d')](db[_0xf46c('0x1d3')],{'as':_0xf46c('0x1cd'),'foreignKey':'FieldId'});db[_0xf46c('0x1d3')][_0xf46c('0x12d')](db[_0xf46c('0x98')],{'as':_0xf46c('0x98'),'foreignKey':_0xf46c('0x1ce')});db['ZendeskAccount'][_0xf46c('0x11d')](db['ZendeskConfiguration'],{'as':'Configurations','onDelete':_0xf46c('0x11c'),'foreignKey':'AccountId'});db['ZendeskConfiguration'][_0xf46c('0x11d')](db[_0xf46c('0xb7')],{'as':_0xf46c('0x1c7'),'foreignKey':_0xf46c('0x1c8')});db[_0xf46c('0xb5')][_0xf46c('0x11d')](db[_0xf46c('0xb7')],{'as':_0xf46c('0x1d1'),'foreignKey':_0xf46c('0x1c9')});db['ZendeskConfiguration']['hasMany'](db[_0xf46c('0xb7')],{'as':'Fields','foreignKey':'FieldId'});db[_0xf46c('0xb5')][_0xf46c('0x12d')](db[_0xf46c('0xb3')],{'as':'Account','foreignKey':'AccountId'});db[_0xf46c('0xb5')]['belongsToMany'](db[_0xf46c('0x90')],{'through':_0xf46c('0x1d5')});db[_0xf46c('0xb7')][_0xf46c('0x11d')](db[_0xf46c('0xb7')],{'as':_0xf46c('0x1cb'),'foreignKey':_0xf46c('0x1c8')});db[_0xf46c('0xb7')]['hasMany'](db[_0xf46c('0xb7')],{'as':_0xf46c('0x1cc'),'foreignKey':'DescriptionId'});db[_0xf46c('0xb7')]['hasMany'](db[_0xf46c('0xb7')],{'as':_0xf46c('0x1cd'),'foreignKey':_0xf46c('0x1ca')});db['ZendeskField']['belongsTo'](db['Variable'],{'as':_0xf46c('0x98'),'foreignKey':'VariableId'});db['FreshdeskAccount'][_0xf46c('0x11d')](db[_0xf46c('0xba')],{'as':_0xf46c('0x1c4'),'onDelete':_0xf46c('0x11c'),'foreignKey':'AccountId'});db[_0xf46c('0xba')][_0xf46c('0x11d')](db[_0xf46c('0x1d6')],{'as':'Subjects','onDelete':'cascade','foreignKey':_0xf46c('0x1c8')});db[_0xf46c('0xba')][_0xf46c('0x11d')](db[_0xf46c('0x1d6')],{'as':_0xf46c('0x1d1'),'onDelete':_0xf46c('0x11c'),'foreignKey':_0xf46c('0x1c9')});db[_0xf46c('0xba')][_0xf46c('0x11d')](db[_0xf46c('0x1d6')],{'as':_0xf46c('0x1c1'),'onDelete':_0xf46c('0x11c'),'foreignKey':_0xf46c('0x1ca')});db[_0xf46c('0xba')][_0xf46c('0x12d')](db[_0xf46c('0x1d7')],{'as':'Account','foreignKey':_0xf46c('0x1c5')});db[_0xf46c('0xba')]['belongsToMany'](db[_0xf46c('0x90')],{'through':_0xf46c('0x1d8')});db[_0xf46c('0x1d6')][_0xf46c('0x11d')](db['FreshdeskField'],{'as':_0xf46c('0x1cb'),'foreignKey':_0xf46c('0x1c8')});db[_0xf46c('0x1d6')][_0xf46c('0x11d')](db[_0xf46c('0x1d6')],{'as':_0xf46c('0x1cc'),'foreignKey':_0xf46c('0x1c9')});db[_0xf46c('0x1d6')][_0xf46c('0x11d')](db[_0xf46c('0x1d6')],{'as':_0xf46c('0x1cd'),'foreignKey':_0xf46c('0x1ca')});db['FreshdeskField'][_0xf46c('0x12d')](db['Variable'],{'as':'Variable','foreignKey':'VariableId'});db['VtigerAccount']['hasMany'](db[_0xf46c('0xbe')],{'as':_0xf46c('0x1c4'),'onDelete':_0xf46c('0x11c'),'foreignKey':'AccountId'});db['VtigerConfiguration']['hasMany'](db['VtigerField'],{'as':_0xf46c('0x1c7'),'foreignKey':_0xf46c('0x1c8')});db[_0xf46c('0xbe')][_0xf46c('0x11d')](db['VtigerField'],{'as':'Descriptions','foreignKey':_0xf46c('0x1c9')});db[_0xf46c('0xbe')][_0xf46c('0x11d')](db[_0xf46c('0xc0')],{'as':_0xf46c('0x1c1'),'foreignKey':_0xf46c('0x1ca')});db[_0xf46c('0xbe')][_0xf46c('0x12d')](db['VtigerAccount'],{'as':_0xf46c('0x176'),'foreignKey':_0xf46c('0x1c5')});db['VtigerField'][_0xf46c('0x11d')](db[_0xf46c('0xc0')],{'as':_0xf46c('0x1cb'),'foreignKey':_0xf46c('0x1c8')});db[_0xf46c('0xc0')][_0xf46c('0x11d')](db[_0xf46c('0xc0')],{'as':_0xf46c('0x1cc'),'foreignKey':'DescriptionId'});db['VtigerField'][_0xf46c('0x11d')](db[_0xf46c('0xc0')],{'as':_0xf46c('0x1cd'),'foreignKey':_0xf46c('0x1ca')});db[_0xf46c('0xc0')][_0xf46c('0x12d')](db[_0xf46c('0x98')],{'as':'Variable','foreignKey':_0xf46c('0x1ce')});db[_0xf46c('0xc2')][_0xf46c('0x11d')](db['ServicenowConfiguration'],{'as':_0xf46c('0x1c4'),'onDelete':'cascade','foreignKey':'AccountId'});db[_0xf46c('0x1d9')][_0xf46c('0x11d')](db[_0xf46c('0x1da')],{'as':_0xf46c('0x1c7'),'foreignKey':'SubjectId'});db[_0xf46c('0x1d9')][_0xf46c('0x11d')](db[_0xf46c('0x1da')],{'as':'Descriptions','foreignKey':_0xf46c('0x1c9')});db[_0xf46c('0x1d9')]['hasMany'](db[_0xf46c('0x1da')],{'as':'Fields','foreignKey':_0xf46c('0x1ca')});db[_0xf46c('0x1d9')][_0xf46c('0x12d')](db[_0xf46c('0xc2')],{'as':_0xf46c('0x176'),'foreignKey':_0xf46c('0x1c5')});db[_0xf46c('0x1da')][_0xf46c('0x11d')](db[_0xf46c('0x1da')],{'as':_0xf46c('0x1cb'),'foreignKey':_0xf46c('0x1c8')});db[_0xf46c('0x1da')][_0xf46c('0x11d')](db[_0xf46c('0x1da')],{'as':_0xf46c('0x1cc'),'foreignKey':_0xf46c('0x1c9')});db[_0xf46c('0x1da')]['hasMany'](db[_0xf46c('0x1da')],{'as':_0xf46c('0x1cd'),'foreignKey':_0xf46c('0x1ca')});db[_0xf46c('0x1da')]['belongsTo'](db[_0xf46c('0x98')],{'as':_0xf46c('0x98'),'foreignKey':'VariableId'});db[_0xf46c('0xc5')]['hasMany'](db['Dynamics365Configuration'],{'as':_0xf46c('0x1c4'),'onDelete':_0xf46c('0x11c'),'foreignKey':'AccountId'});db[_0xf46c('0xc5')][_0xf46c('0x12d')](db[_0xf46c('0x10e')],{'as':_0xf46c('0x10e'),'foreignKey':'CloudProviderId'});db[_0xf46c('0xc6')]['hasMany'](db['Dynamics365Field'],{'as':'Subjects','onDelete':_0xf46c('0x11c'),'foreignKey':_0xf46c('0x1c8')});db['Dynamics365Configuration'][_0xf46c('0x11d')](db[_0xf46c('0xc8')],{'as':_0xf46c('0x1d1'),'onDelete':'cascade','foreignKey':'DescriptionId'});db[_0xf46c('0xc6')][_0xf46c('0x11d')](db[_0xf46c('0xc8')],{'as':_0xf46c('0x1c1'),'onDelete':_0xf46c('0x11c'),'foreignKey':_0xf46c('0x1ca')});db[_0xf46c('0xc6')][_0xf46c('0x12d')](db[_0xf46c('0xc5')],{'as':'Account','foreignKey':'AccountId'});db['Dynamics365Field'][_0xf46c('0x11d')](db[_0xf46c('0xc8')],{'as':_0xf46c('0x1cb'),'foreignKey':_0xf46c('0x1c8')});db[_0xf46c('0xc8')][_0xf46c('0x11d')](db[_0xf46c('0xc8')],{'as':_0xf46c('0x1cc'),'foreignKey':_0xf46c('0x1c9')});db[_0xf46c('0xc8')]['hasMany'](db[_0xf46c('0xc8')],{'as':_0xf46c('0x1cd'),'foreignKey':'FieldId'});db[_0xf46c('0xc8')][_0xf46c('0x12d')](db[_0xf46c('0x98')],{'as':_0xf46c('0x98'),'foreignKey':_0xf46c('0x1ce')});db[_0xf46c('0xca')][_0xf46c('0x11d')](db[_0xf46c('0x1db')],{'as':_0xf46c('0x1c4'),'onDelete':_0xf46c('0x11c'),'foreignKey':_0xf46c('0x1c5')});db[_0xf46c('0x1db')][_0xf46c('0x11d')](db[_0xf46c('0xcc')],{'as':_0xf46c('0x1c7'),'foreignKey':_0xf46c('0x1c8')});db[_0xf46c('0x1db')]['hasMany'](db['FreshsalesField'],{'as':_0xf46c('0x1d1'),'foreignKey':_0xf46c('0x1c9')});db[_0xf46c('0x1db')]['hasMany'](db[_0xf46c('0xcc')],{'as':_0xf46c('0x1c1'),'foreignKey':'FieldId'});db[_0xf46c('0x1db')][_0xf46c('0x12d')](db[_0xf46c('0xca')],{'as':'Account','foreignKey':_0xf46c('0x1c5')});db['FreshsalesField']['hasMany'](db[_0xf46c('0xcc')],{'as':_0xf46c('0x1cb'),'foreignKey':_0xf46c('0x1c8')});db[_0xf46c('0xcc')][_0xf46c('0x11d')](db['FreshsalesField'],{'as':_0xf46c('0x1cc'),'foreignKey':_0xf46c('0x1c9')});db[_0xf46c('0xcc')][_0xf46c('0x11d')](db[_0xf46c('0xcc')],{'as':_0xf46c('0x1cd'),'foreignKey':_0xf46c('0x1ca')});db[_0xf46c('0xcc')][_0xf46c('0x12d')](db[_0xf46c('0x98')],{'as':_0xf46c('0x98'),'foreignKey':_0xf46c('0x1ce')});db[_0xf46c('0xd0')]['belongsTo'](db[_0xf46c('0x66')],{});db[_0xf46c('0xd0')][_0xf46c('0x12d')](db[_0xf46c('0xfb')],{'as':_0xf46c('0x171'),'foreignKey':_0xf46c('0x172')});db[_0xf46c('0xd0')][_0xf46c('0x12d')](db[_0xf46c('0x73')],{'as':_0xf46c('0x167'),'foreignKey':'ContactId'});db['ChatQueueReport'][_0xf46c('0x12d')](db[_0xf46c('0x125')],{});db[_0xf46c('0xd0')][_0xf46c('0x12d')](db['ChatMessage'],{});db[_0xf46c('0xd0')][_0xf46c('0x12d')](db[_0xf46c('0x13')],{});db[_0xf46c('0xd0')][_0xf46c('0x12d')](db[_0xf46c('0x6d')],{});db[_0xf46c('0xd2')][_0xf46c('0x12d')](db['User'],{'onDelete':_0xf46c('0x11c'),'foreignKey':_0xf46c('0x1dc')});db[_0xf46c('0xd2')][_0xf46c('0x12d')](db[_0xf46c('0x13')],{'onDelete':_0xf46c('0x11c'),'foreignKey':_0xf46c('0x1dd')});db[_0xf46c('0xd8')][_0xf46c('0x11d')](db[_0xf46c('0xd6')],{'foreignKey':_0xf46c('0x1de'),'onDelete':_0xf46c('0x11c')});db[_0xf46c('0xd8')]['hasMany'](db['JscriptyAnswerReport'],{'foreignKey':_0xf46c('0x1de'),'onDelete':_0xf46c('0x11c')});db[_0xf46c('0xd9')][_0xf46c('0x12d')](db['SmsAccount'],{});db[_0xf46c('0xd9')][_0xf46c('0x12d')](db['CmList'],{'as':_0xf46c('0x171'),'foreignKey':'ListId'});db[_0xf46c('0xd9')]['belongsTo'](db['CmContact'],{'as':_0xf46c('0x167'),'foreignKey':_0xf46c('0x181')});db[_0xf46c('0xd9')][_0xf46c('0x12d')](db[_0xf46c('0x127')],{});db['SmsQueueReport']['belongsTo'](db[_0xf46c('0x59')],{});db[_0xf46c('0xd9')][_0xf46c('0x12d')](db[_0xf46c('0x13')],{});db[_0xf46c('0xd9')][_0xf46c('0x12d')](db['SmsQueue'],{});db[_0xf46c('0xdf')][_0xf46c('0x11d')](db[_0xf46c('0xd8')],{'foreignKey':_0xf46c('0x1df')});db[_0xf46c('0xdf')][_0xf46c('0x11d')](db[_0xf46c('0xd6')],{'foreignKey':'ProjectId'});db[_0xf46c('0xdf')][_0xf46c('0x11d')](db[_0xf46c('0xd4')],{'foreignKey':_0xf46c('0x1df')});db[_0xf46c('0xe9')][_0xf46c('0x12f')](db[_0xf46c('0x13')],{'as':'Agents','through':_0xf46c('0x133')});db[_0xf46c('0xe9')][_0xf46c('0x12f')](db['VoiceQueue'],{'through':_0xf46c('0x110'),'as':'VoiceQueues'});db[_0xf46c('0xe9')][_0xf46c('0x12f')](db[_0xf46c('0x40')],{'through':_0xf46c('0x1e0'),'as':_0xf46c('0x13c')});db['Team'][_0xf46c('0x12f')](db[_0xf46c('0x6d')],{'through':_0xf46c('0x19c'),'as':_0xf46c('0x13d')});db[_0xf46c('0xe9')][_0xf46c('0x12f')](db[_0xf46c('0x51')],{'through':_0xf46c('0x18a'),'as':'FaxQueues'});db[_0xf46c('0xe9')][_0xf46c('0x12f')](db[_0xf46c('0x5b')],{'through':_0xf46c('0x18f'),'as':'SmsQueues'});db[_0xf46c('0xe9')][_0xf46c('0x12f')](db[_0xf46c('0x64')],{'through':'team_has_openchannel_queues','as':_0xf46c('0x141')});db[_0xf46c('0xe9')][_0xf46c('0x12f')](db['WhatsappQueue'],{'through':_0xf46c('0x1e1'),'as':_0xf46c('0x143')});db[_0xf46c('0xe9')][_0xf46c('0x12f')](db[_0xf46c('0xfd')],{'through':_0xf46c('0x112'),'as':_0xf46c('0x13b')});db[_0xf46c('0x1a5')][_0xf46c('0x11d')](db[_0xf46c('0x75')],{'as':'Hoppers','foreignKey':_0xf46c('0x1a6')});db[_0xf46c('0x1a5')][_0xf46c('0x11d')](db['CmHopperFinal'],{'as':_0xf46c('0x122'),'foreignKey':_0xf46c('0x1a6')});db[_0xf46c('0x1a5')][_0xf46c('0x11d')](db[_0xf46c('0x7a')],{'as':_0xf46c('0x156'),'foreignKey':'CampaignId'});db[_0xf46c('0x1a5')][_0xf46c('0x11d')](db[_0xf46c('0x77')],{'as':_0xf46c('0x157'),'foreignKey':_0xf46c('0x1a6')});db[_0xf46c('0x1a5')]['belongsTo'](db[_0xf46c('0x2c')],{'as':_0xf46c('0x2c'),'foreignKey':_0xf46c('0x159')});db[_0xf46c('0x1a5')]['belongsTo'](db[_0xf46c('0x2c')],{'as':_0xf46c('0x1e2'),'foreignKey':_0xf46c('0x15a')});db[_0xf46c('0x1a5')][_0xf46c('0x12d')](db[_0xf46c('0x15b')],{'as':_0xf46c('0x15b'),'foreignKey':_0xf46c('0x18c')});db[_0xf46c('0x1a5')][_0xf46c('0x12d')](db['SquareProject'],{'as':_0xf46c('0xe3'),'foreignKey':_0xf46c('0x1e3')});db[_0xf46c('0x1a5')][_0xf46c('0x12f')](db[_0xf46c('0xfb')],{'as':_0xf46c('0x132'),'through':_0xf46c('0x1e4')});db[_0xf46c('0x1a5')][_0xf46c('0x12f')](db[_0xf46c('0xfb')],{'as':_0xf46c('0x15f'),'through':_0xf46c('0x1e5')});db[_0xf46c('0xf0')][_0xf46c('0x12d')](db[_0xf46c('0x1e6')],{'as':_0xf46c('0x1e6'),'foreignKey':_0xf46c('0x17e')});db[_0xf46c('0xf3')][_0xf46c('0x12d')](db['MailMessage'],{});db['MailTransferReport'][_0xf46c('0x12d')](db['MailInteraction'],{});db[_0xf46c('0xf3')][_0xf46c('0x12d')](db[_0xf46c('0x3e')],{'foreignKey':_0xf46c('0x1e7'),'as':_0xf46c('0x1e8')});db['MailTransferReport'][_0xf46c('0x12d')](db[_0xf46c('0x13')],{'foreignKey':_0xf46c('0x1e9'),'as':_0xf46c('0x1ea')});db['MailTransferReport']['belongsTo'](db['User'],{'foreignKey':'ToUserId','as':_0xf46c('0x1eb')});db[_0xf46c('0xf3')][_0xf46c('0x12d')](db[_0xf46c('0x40')],{'foreignKey':_0xf46c('0x1ec'),'as':_0xf46c('0x1ed')});db[_0xf46c('0xf3')][_0xf46c('0x12d')](db[_0xf46c('0x3e')],{'foreignKey':_0xf46c('0x1ee'),'as':_0xf46c('0x1ef')});db[_0xf46c('0x1f0')][_0xf46c('0x12d')](db[_0xf46c('0x6b')],{});db[_0xf46c('0x1f0')]['belongsTo'](db[_0xf46c('0x125')],{});db[_0xf46c('0x1f0')]['belongsTo'](db['ChatWebsite'],{'foreignKey':_0xf46c('0x1f1'),'as':_0xf46c('0x1e8')});db[_0xf46c('0x1f0')][_0xf46c('0x12d')](db[_0xf46c('0x13')],{'foreignKey':_0xf46c('0x1e9'),'as':_0xf46c('0x1ea')});db[_0xf46c('0x1f0')][_0xf46c('0x12d')](db[_0xf46c('0x13')],{'foreignKey':_0xf46c('0x1f2'),'as':_0xf46c('0x1eb')});db[_0xf46c('0x1f0')][_0xf46c('0x12d')](db['ChatQueue'],{'foreignKey':_0xf46c('0x1f3'),'as':_0xf46c('0x1ed')});db[_0xf46c('0x1f0')][_0xf46c('0x12d')](db['ChatWebsite'],{'foreignKey':_0xf46c('0x1f4'),'as':_0xf46c('0x1ef')});db[_0xf46c('0xf6')]['belongsTo'](db[_0xf46c('0x183')],{});db[_0xf46c('0xf6')][_0xf46c('0x12d')](db[_0xf46c('0x50')],{});db[_0xf46c('0xf6')]['belongsTo'](db['FaxAccount'],{'foreignKey':_0xf46c('0x1f5'),'as':_0xf46c('0x1e8')});db['FaxTransferReport'][_0xf46c('0x12d')](db['User'],{'foreignKey':_0xf46c('0x1e9'),'as':'FromAgent'});db[_0xf46c('0xf6')][_0xf46c('0x12d')](db[_0xf46c('0x13')],{'foreignKey':_0xf46c('0x1f2'),'as':_0xf46c('0x1eb')});db[_0xf46c('0xf6')][_0xf46c('0x12d')](db['FaxQueue'],{'foreignKey':_0xf46c('0x1f6'),'as':_0xf46c('0x1ed')});db['FaxTransferReport'][_0xf46c('0x12d')](db[_0xf46c('0x4c')],{'foreignKey':_0xf46c('0x1f7'),'as':_0xf46c('0x1ef')});db[_0xf46c('0x1f8')][_0xf46c('0x12d')](db[_0xf46c('0x62')],{});db[_0xf46c('0x1f8')][_0xf46c('0x12d')](db[_0xf46c('0x60')],{});db['OpenchannelTransferReport'][_0xf46c('0x12d')](db[_0xf46c('0x5d')],{'foreignKey':_0xf46c('0x1f9'),'as':_0xf46c('0x1e8')});db[_0xf46c('0x1f8')][_0xf46c('0x12d')](db['User'],{'foreignKey':'FromUserId','as':_0xf46c('0x1ea')});db[_0xf46c('0x1f8')]['belongsTo'](db['User'],{'foreignKey':_0xf46c('0x1f2'),'as':_0xf46c('0x1eb')});db[_0xf46c('0x1f8')]['belongsTo'](db[_0xf46c('0x64')],{'foreignKey':'ToOpenchannelQueueId','as':_0xf46c('0x1ed')});db[_0xf46c('0x1f8')][_0xf46c('0x12d')](db['OpenchannelAccount'],{'foreignKey':_0xf46c('0x1fa'),'as':_0xf46c('0x1ef')});db[_0xf46c('0xf9')][_0xf46c('0x12d')](db['SmsMessage'],{});db['SmsTransferReport'][_0xf46c('0x12d')](db['SmsInteraction'],{});db[_0xf46c('0xf9')][_0xf46c('0x12d')](db[_0xf46c('0x55')],{'foreignKey':_0xf46c('0x1fb'),'as':_0xf46c('0x1e8')});db['SmsTransferReport']['belongsTo'](db[_0xf46c('0x13')],{'foreignKey':_0xf46c('0x1e9'),'as':_0xf46c('0x1ea')});db['SmsTransferReport']['belongsTo'](db[_0xf46c('0x13')],{'foreignKey':'ToUserId','as':_0xf46c('0x1eb')});db[_0xf46c('0xf9')][_0xf46c('0x12d')](db[_0xf46c('0x5b')],{'foreignKey':_0xf46c('0x1fc'),'as':_0xf46c('0x1ed')});db[_0xf46c('0xf9')]['belongsTo'](db[_0xf46c('0x55')],{'foreignKey':_0xf46c('0x1fd'),'as':_0xf46c('0x1ef')});db[_0xf46c('0xfb')][_0xf46c('0x11d')](db['Disposition'],{'as':'Dispositions','foreignKey':'ListId','onDelete':_0xf46c('0x11c')});db[_0xf46c('0xfb')][_0xf46c('0x11d')](db[_0xf46c('0x1fe')],{'as':_0xf46c('0x1ff'),'foreignKey':_0xf46c('0x172')});db[_0xf46c('0xfb')][_0xf46c('0x11d')](db[_0xf46c('0x73')],{'as':_0xf46c('0x130'),'onDelete':_0xf46c('0x11c'),'foreignKey':_0xf46c('0x172')});db[_0xf46c('0xfb')][_0xf46c('0x11d')](db['CmHopperFinal'],{'as':_0xf46c('0x122'),'foreignKey':_0xf46c('0x172')});db[_0xf46c('0xfb')][_0xf46c('0x11d')](db[_0xf46c('0x7a')],{'as':_0xf46c('0x123'),'foreignKey':_0xf46c('0x172')});db[_0xf46c('0xfb')][_0xf46c('0x11d')](db['ReportAgentPreview'],{'as':'ReportAgentPreview','foreignKey':'ListId'});db[_0xf46c('0xfb')][_0xf46c('0x12f')](db[_0xf46c('0x1b')],{'as':_0xf46c('0x200'),'through':_0xf46c('0x15c')});db[_0xf46c('0xfb')]['belongsToMany'](db[_0xf46c('0x13')],{'as':_0xf46c('0x15d'),'through':_0xf46c('0x144')});db[_0xf46c('0xfd')][_0xf46c('0x11d')](db[_0xf46c('0x14f')],{'as':_0xf46c('0x121'),'onDelete':'cascade'});db[_0xf46c('0xfd')]['belongsToMany'](db[_0xf46c('0x13')],{'as':_0xf46c('0x15d'),'through':_0xf46c('0x114')});db[_0xf46c('0xfd')][_0xf46c('0x12f')](db[_0xf46c('0xe9')],{'through':_0xf46c('0x112'),'as':_0xf46c('0x15e')});db[_0xf46c('0xff')][_0xf46c('0x11d')](db['User'],{'as':_0xf46c('0x17a'),'foreignKey':_0xf46c('0x12e')});db[_0xf46c('0xff')]['hasMany'](db[_0xf46c('0x100')],{'as':_0xf46c('0x201'),'foreignKey':'userProfileId','onDelete':'cascade'});db['UserProfileSection'][_0xf46c('0x11d')](db[_0xf46c('0x102')],{'as':_0xf46c('0x202'),'foreignKey':_0xf46c('0x203'),'onDelete':_0xf46c('0x11c')});db['WhatsappAccount'][_0xf46c('0x11d')](db[_0xf46c('0x83')],{'as':'Dispositions','foreignKey':_0xf46c('0x204'),'onDelete':_0xf46c('0x11c')});db[_0xf46c('0x14c')][_0xf46c('0x11d')](db[_0xf46c('0x81')],{'as':_0xf46c('0x16f'),'foreignKey':'WhatsappAccountId'});db['WhatsappAccount']['hasMany'](db[_0xf46c('0x108')],{'as':_0xf46c('0x161'),'foreignKey':'WhatsappAccountId'});db['WhatsappAccount'][_0xf46c('0x11d')](db[_0xf46c('0x106')],{'as':_0xf46c('0x170')});db[_0xf46c('0x14c')][_0xf46c('0x11d')](db[_0xf46c('0x105')],{'as':_0xf46c('0x152'),'foreignKey':_0xf46c('0x204'),'onDelete':'cascade'});db[_0xf46c('0x14c')][_0xf46c('0x12d')](db[_0xf46c('0xfb')],{'as':_0xf46c('0x171'),'foreignKey':_0xf46c('0x172')});db[_0xf46c('0x14c')][_0xf46c('0x12d')](db[_0xf46c('0x88')],{'as':_0xf46c('0x174'),'foreignKey':_0xf46c('0x184')});db[_0xf46c('0x14c')]['belongsToMany'](db[_0xf46c('0x13')],{'as':_0xf46c('0x15d'),'through':_0xf46c('0x14e')});db[_0xf46c('0x105')]['belongsTo'](db[_0xf46c('0x13')],{'onDelete':_0xf46c('0x16b')});db[_0xf46c('0x105')]['belongsTo'](db[_0xf46c('0x142')],{'onDelete':_0xf46c('0x16b')});db[_0xf46c('0x105')][_0xf46c('0x12d')](db[_0xf46c('0x14c')],{'onDelete':'restrict'});db[_0xf46c('0x105')][_0xf46c('0x12d')](db['Interval'],{'onDelete':'restrict','foreignKey':_0xf46c('0x18c')});db[_0xf46c('0x105')][_0xf46c('0x12d')](db[_0xf46c('0x90')],{'onDelete':_0xf46c('0x16b'),'foreignKey':'TagId'});db[_0xf46c('0x106')]['hasMany'](db[_0xf46c('0x108')],{'as':_0xf46c('0x161'),'onDelete':_0xf46c('0x11c'),'foreignKey':_0xf46c('0x205')});db[_0xf46c('0x106')][_0xf46c('0x12d')](db[_0xf46c('0x14c')],{'as':_0xf46c('0x176'),'foreignKey':_0xf46c('0x204')});db[_0xf46c('0x106')]['belongsTo'](db['CmContact'],{'as':'Contact','foreignKey':_0xf46c('0x181')});db[_0xf46c('0x106')][_0xf46c('0x12d')](db[_0xf46c('0x13')],{'as':'Owner','foreignKey':_0xf46c('0x11b')});db[_0xf46c('0x106')][_0xf46c('0x12f')](db[_0xf46c('0x90')],{'through':_0xf46c('0x206'),'as':'Tags'});db[_0xf46c('0x106')][_0xf46c('0x12f')](db[_0xf46c('0x90')],{'through':_0xf46c('0x206'),'as':_0xf46c('0x179')});db[_0xf46c('0x106')][_0xf46c('0x12f')](db['User'],{'as':_0xf46c('0x17a'),'through':_0xf46c('0x13a'),'foreignKey':_0xf46c('0x205')});db[_0xf46c('0x108')][_0xf46c('0x12d')](db[_0xf46c('0x13')],{'as':_0xf46c('0x13')});db['WhatsappMessage'][_0xf46c('0x12d')](db[_0xf46c('0x73')],{'onDelete':_0xf46c('0x11c'),'as':_0xf46c('0x167')});db[_0xf46c('0x108')][_0xf46c('0x12d')](db[_0xf46c('0x106')],{'onDelete':_0xf46c('0x11c'),'as':_0xf46c('0x189'),'foreignKey':'WhatsappInteractionId'});db['WhatsappMessage'][_0xf46c('0x12d')](db[_0xf46c('0x14c')],{'as':_0xf46c('0x176'),'foreignKey':_0xf46c('0x204')});db['WhatsappQueueReport'][_0xf46c('0x12d')](db['WhatsappAccount'],{});db[_0xf46c('0x10a')][_0xf46c('0x12d')](db['CmList'],{'as':'List','foreignKey':_0xf46c('0x172')});db['WhatsappQueueReport'][_0xf46c('0x12d')](db[_0xf46c('0x73')],{'as':_0xf46c('0x167'),'foreignKey':'ContactId'});db['WhatsappQueueReport'][_0xf46c('0x12d')](db[_0xf46c('0x106')],{});db[_0xf46c('0x10a')][_0xf46c('0x12d')](db['WhatsappQueue'],{});db[_0xf46c('0x10a')]['belongsTo'](db['WhatsappMessage'],{});db['WhatsappQueueReport'][_0xf46c('0x12d')](db[_0xf46c('0x13')],{});db[_0xf46c('0x207')][_0xf46c('0x12d')](db[_0xf46c('0x108')],{});db[_0xf46c('0x207')][_0xf46c('0x12d')](db['WhatsappInteraction'],{});db['WhatsappTransferReport']['belongsTo'](db[_0xf46c('0x14c')],{'foreignKey':'FromWhatsappAccountId','as':_0xf46c('0x1e8')});db[_0xf46c('0x207')][_0xf46c('0x12d')](db[_0xf46c('0x14c')],{'foreignKey':_0xf46c('0x208'),'as':'ToAccount'});db[_0xf46c('0x207')][_0xf46c('0x12d')](db[_0xf46c('0x142')],{'foreignKey':_0xf46c('0x209'),'as':'ToQueue'});db[_0xf46c('0x207')][_0xf46c('0x12d')](db[_0xf46c('0x13')],{'foreignKey':_0xf46c('0x1e9'),'as':_0xf46c('0x1ea')});db['WhatsappTransferReport'][_0xf46c('0x12d')](db[_0xf46c('0x13')],{'foreignKey':_0xf46c('0x1f2'),'as':_0xf46c('0x1eb')});db[_0xf46c('0x142')]['belongsToMany'](db[_0xf46c('0x13')],{'as':_0xf46c('0x15d'),'through':'UserWhatsappQueue','foreignKey':'WhatsappQueueId'});db[_0xf46c('0x142')][_0xf46c('0x12f')](db[_0xf46c('0xe9')],{'through':_0xf46c('0x1e1'),'as':_0xf46c('0x15e')});db[_0xf46c('0x116')]['belongsTo'](db['User'],{'as':_0xf46c('0x20a'),'foreignKey':_0xf46c('0x11b'),'onDelete':_0xf46c('0x11c'),'hooks':!![]});db[_0xf46c('0x10e')][_0xf46c('0x119')](db[_0xf46c('0xc5')],{'as':_0xf46c('0xc5'),'onDelete':_0xf46c('0x16b')});db[_0xf46c('0x10e')]['hasOne'](db[_0xf46c('0x168')],{'as':'Imap','onDelete':_0xf46c('0x16b')});db[_0xf46c('0x10e')][_0xf46c('0x119')](db[_0xf46c('0x3d')],{'as':'Smtp','onDelete':'restrict'});module['exports']={'db':db,'dbH':dbH}; \ No newline at end of file diff --git a/server/routes.js b/server/routes.js index eea6f0e..44db10d 100644 --- a/server/routes.js +++ b/server/routes.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x1b18=['./api/cannedAnswer','/api/dispositions','./api/disposition','/api/conditions','/api/intervals','./api/interval','/api/pauses','./api/pause','/api/voiceQueuesLog','./api/voiceQueuesLog','/api/schedules','./api/schedule','/api/sounds','./api/sound','/api/tags','./api/tag','./api/contactItemType','/api/cm_contact_has_items','./api/cmContactHasItem','./api/cmHopperAdditionalPhone','/api/templates','./api/template','/api/triggers','./api/variable','/api/integrations','./api/integration','/api/integrations/reports','/api/analytics/custom_reports','./api/analyticCustomReport','/api/analytics/default_reports','./api/analyticDefaultReport','./api/analyticExtractedReport','/api/analytics/metrics','/api/analytics/tree_reports','/api/integrations/salesforce/accounts','/api/integrations/salesforce/configurations','./api/intSalesforceConfiguration','/api/integrations/salesforce/fields','./api/intSugarcrmAccount','./api/intSugarcrmConfiguration','/api/integrations/sugarcrm/fields','./api/intSugarcrmField','/api/integrations/desk/accounts','./api/intDeskAccount','/api/integrations/desk/configurations','./api/intDeskConfiguration','/api/integrations/desk/fields','./api/intDeskField','/api/integrations/zoho/accounts','./api/intZohoAccount','/api/integrations/zoho/configurations','/api/integrations/zoho/fields','./api/intZohoField','/api/integrations/zendesk/accounts','./api/intZendeskAccount','/api/integrations/zendesk/configurations','./api/intZendeskConfiguration','/api/integrations/zendesk/fields','./api/intZendeskField','/api/integrations/freshdesk/accounts','./api/intFreshdeskAccount','./api/intFreshdeskConfiguration','/api/integrations/freshdesk/fields','./api/intFreshdeskField','/api/integrations/vtiger/configurations','/api/integrations/vtiger/fields','./api/intVtigerField','/api/integrations/servicenow/accounts','./api/intServicenowAccount','/api/integrations/servicenow/configurations','/api/integrations/servicenow/fields','./api/intDynamics365Account','/api/integrations/dynamics365/configurations','/api/integrations/freshsales/accounts','/api/integrations/freshsales/configurations','./api/intFreshsalesConfiguration','/api/integrations/freshsales/fields','./api/intFreshsalesField','/api/networks','./api/chatQueueReport','./api/chatInternalMessage','./api/jscriptyAnswerReport','./api/jscriptyQuestionReport','/api/jscripty/sessions/reports','./api/jscriptySessionReport','/api/sms/reports/queue','/api/square/reports','/api/square/details/reports','/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/squareMessage','./api/team','./api/license','./api/campaign','/api/migrations','./api/migration','/api/attachments','./api/attachment','/api/plugins','./api/plugin','/api/mail/reports/transfer','./api/mailTransferReport','/api/chat/reports/transfer','/api/fax/reports/transfer','./api/faxTransferReport','./api/openchannelTransferReport','/api/sms/reports/transfer','./api/smsTransferReport','/api/cm/lists','./api/cmList','/api/voice/prefixes','./api/voicePrefix','/api/userProfiles','/api/userProfile/sections','./api/userProfileResource','/api/userNotifications','./api/userNotification','./api/whatsappAccount','./api/whatsappApplication','/api/whatsapp/interactions','./api/whatsappInteraction','./api/whatsappMessage','/api/whatsapp/reports/queue','./api/whatsappQueueReport','/api/whatsapp/reports/transfer','./api/whatsappTransferReport','/api/whatsapp/queues','./api/whatsappQueue','/api/cloudProviders','./api/cloudProvider','/api/realtime','./api/realtime','/api/user-settings','./api/mailInteractionHasTag','/api/auth/local','./api/authLocal','/api/auth/google','./api/authActiveDirectory','/api/jira','./api/jira','/api/rpc','./api/rpc','/api/version','./api/version','/api/system','./api/system','./api/pm2','./api/webbar','/api/logs','/apidoc','static','join','root','/www','/demo','/snippet','3.12.1','/:url(api|auth|components|app|bower_components|assets)/*','get','route','sendFile','resolve','appPath','/index.html','path','express','./config/environment','setupLoggers','default','use','./api/user','/api/voice/chanspy','./api/voiceChanSpy','/api/voice/contexts','./api/voiceContext','/api/voice/extensions','./api/voiceExtension','/api/voice/queues','/api/voice/recordings','/api/screen/recordings','./api/screenRecording','/api/voice/mails/messages','./api/voiceMailMessage','/api/voice/calls/reports','./api/voiceCallReport','/api/voice/dials/reports','./api/voiceAgentReport','/api/voice/queues/reports','./api/voiceQueueReport','/api/members/reports','./api/memberReport','/api/trunks','./api/trunk','/api/mail/out_servers','./api/mailServerOut','./api/mailAccount','/api/mail/queues','./api/mailSubstatus','/api/mail/interactions','/api/mail/messages','./api/mailQueueReport','/api/dashboards','./api/dashboard','/api/fax/accounts','./api/faxAccount','/api/fax/applications','./api/faxApplication','/api/fax/interactions','/api/fax/messages','./api/faxMessage','./api/faxQueue','/api/fax/reports/queue','/api/sms/accounts','./api/smsAccount','/api/sms/applications','/api/sms/interactions','./api/smsInteraction','/api/sms/messages','./api/smsMessage','/api/openchannel/accounts','./api/openchannelAccount','/api/openchannel/applications','./api/openchannelApplication','/api/openchannel/interactions','./api/openchannelInteraction','/api/openchannel/messages','./api/openchannelMessage','/api/openchannel/queues','./api/openchannelQueue','/api/chat/websites','./api/chatWebsite','./api/chatApplication','/api/chat/interactions','./api/chatMessage','/api/chat/offline_messages','/api/chat/queues','./api/chatQueue','./api/chatGroup','/api/chat/proactive_actions','./api/cmCompany','/api/cm/contacts','./api/cmContact','/api/cm/hopper','/api/cm/hopper_black','./api/cmHopperBlack','/api/cm/hopper_final','./api/cmHopperFinal','/api/cm/hopper_history','./api/cmHopperHistory','/api/cm/custom_fields','./api/cmCustomField','./api/action','./api/automation','/api/canned_answers'];(function(_0x4c1de5,_0x456c1f){var _0x8d5965=function(_0x20062b){while(--_0x20062b){_0x4c1de5['push'](_0x4c1de5['shift']());}};_0x8d5965(++_0x456c1f);}(_0x1b18,0x1b4));var _0x81b1=function(_0x40a045,_0x516f0e){_0x40a045=_0x40a045-0x0;var _0x1a687c=_0x1b18[_0x40a045];return _0x1a687c;};'use strict';var path=require(_0x81b1('0x0'));var express=require(_0x81b1('0x1'));var errors=require('./errors');var config=require(_0x81b1('0x2'));var setupLoggers=require('./utils/client-side-logger')[_0x81b1('0x3')];var clientSideLogs=require('./api/client-side-logs');exports[_0x81b1('0x4')]=function(_0x5ba49d){return setupLoggers(_0x5ba49d)['then'](function(){_0x5ba49d[_0x81b1('0x5')]('/api/users',require(_0x81b1('0x6')));_0x5ba49d[_0x81b1('0x5')](_0x81b1('0x7'),require(_0x81b1('0x8')));_0x5ba49d['use'](_0x81b1('0x9'),require(_0x81b1('0xa')));_0x5ba49d[_0x81b1('0x5')](_0x81b1('0xb'),require(_0x81b1('0xc')));_0x5ba49d[_0x81b1('0x5')]('/api/voice/mohs',require('./api/voiceMusicOnHold'));_0x5ba49d['use'](_0x81b1('0xd'),require('./api/voiceQueue'));_0x5ba49d[_0x81b1('0x5')](_0x81b1('0xe'),require('./api/voiceRecording'));_0x5ba49d[_0x81b1('0x5')](_0x81b1('0xf'),require(_0x81b1('0x10')));_0x5ba49d[_0x81b1('0x5')]('/api/voice/mails',require('./api/voiceMail'));_0x5ba49d[_0x81b1('0x5')](_0x81b1('0x11'),require(_0x81b1('0x12')));_0x5ba49d['use'](_0x81b1('0x13'),require(_0x81b1('0x14')));_0x5ba49d[_0x81b1('0x5')](_0x81b1('0x15'),require('./api/voiceDialReport'));_0x5ba49d[_0x81b1('0x5')]('/api/voice/agents/reports',require(_0x81b1('0x16')));_0x5ba49d[_0x81b1('0x5')](_0x81b1('0x17'),require(_0x81b1('0x18')));_0x5ba49d[_0x81b1('0x5')](_0x81b1('0x19'),require(_0x81b1('0x1a')));_0x5ba49d['use'](_0x81b1('0x1b'),require(_0x81b1('0x1c')));_0x5ba49d[_0x81b1('0x5')]('/api/voice/transfers/reports',require('./api/voiceTransferReport'));_0x5ba49d['use'](_0x81b1('0x1d'),require(_0x81b1('0x1e')));_0x5ba49d[_0x81b1('0x5')]('/api/mail/accounts',require(_0x81b1('0x1f')));_0x5ba49d[_0x81b1('0x5')](_0x81b1('0x20'),require('./api/mailQueue'));_0x5ba49d[_0x81b1('0x5')]('/api/mail/substatuses',require(_0x81b1('0x21')));_0x5ba49d[_0x81b1('0x5')](_0x81b1('0x22'),require('./api/mailInteraction'));_0x5ba49d[_0x81b1('0x5')](_0x81b1('0x23'),require('./api/mailMessage'));_0x5ba49d['use']('/api/mail/applications',require('./api/mailApplication'));_0x5ba49d[_0x81b1('0x5')]('/api/mail/reports/queue',require(_0x81b1('0x24')));_0x5ba49d[_0x81b1('0x5')](_0x81b1('0x25'),require(_0x81b1('0x26')));_0x5ba49d[_0x81b1('0x5')]('/api/dashboards/items',require('./api/dashboardItem'));_0x5ba49d['use'](_0x81b1('0x27'),require(_0x81b1('0x28')));_0x5ba49d[_0x81b1('0x5')](_0x81b1('0x29'),require(_0x81b1('0x2a')));_0x5ba49d[_0x81b1('0x5')](_0x81b1('0x2b'),require('./api/faxInteraction'));_0x5ba49d[_0x81b1('0x5')](_0x81b1('0x2c'),require(_0x81b1('0x2d')));_0x5ba49d['use']('/api/fax/queues',require(_0x81b1('0x2e')));_0x5ba49d['use'](_0x81b1('0x2f'),require('./api/faxQueueReport'));_0x5ba49d['use'](_0x81b1('0x30'),require(_0x81b1('0x31')));_0x5ba49d[_0x81b1('0x5')](_0x81b1('0x32'),require('./api/smsApplication'));_0x5ba49d[_0x81b1('0x5')](_0x81b1('0x33'),require(_0x81b1('0x34')));_0x5ba49d['use'](_0x81b1('0x35'),require(_0x81b1('0x36')));_0x5ba49d['use']('/api/sms/queues',require('./api/smsQueue'));_0x5ba49d['use'](_0x81b1('0x37'),require(_0x81b1('0x38')));_0x5ba49d[_0x81b1('0x5')](_0x81b1('0x39'),require(_0x81b1('0x3a')));_0x5ba49d[_0x81b1('0x5')](_0x81b1('0x3b'),require(_0x81b1('0x3c')));_0x5ba49d[_0x81b1('0x5')](_0x81b1('0x3d'),require(_0x81b1('0x3e')));_0x5ba49d[_0x81b1('0x5')](_0x81b1('0x3f'),require(_0x81b1('0x40')));_0x5ba49d[_0x81b1('0x5')](_0x81b1('0x41'),require(_0x81b1('0x42')));_0x5ba49d[_0x81b1('0x5')]('/api/openchannel/reports/queue',require('./api/openchannelQueueReport'));_0x5ba49d[_0x81b1('0x5')]('/api/chat/applications',require(_0x81b1('0x43')));_0x5ba49d[_0x81b1('0x5')](_0x81b1('0x44'),require('./api/chatInteraction'));_0x5ba49d[_0x81b1('0x5')]('/api/chat/messages',require(_0x81b1('0x45')));_0x5ba49d['use'](_0x81b1('0x46'),require('./api/chatOfflineMessage'));_0x5ba49d[_0x81b1('0x5')](_0x81b1('0x47'),require(_0x81b1('0x48')));_0x5ba49d[_0x81b1('0x5')]('/api/chat/groups',require(_0x81b1('0x49')));_0x5ba49d[_0x81b1('0x5')](_0x81b1('0x4a'),require('./api/chatProactiveAction'));_0x5ba49d[_0x81b1('0x5')]('/api/cm/companies',require(_0x81b1('0x4b')));_0x5ba49d[_0x81b1('0x5')](_0x81b1('0x4c'),require(_0x81b1('0x4d')));_0x5ba49d[_0x81b1('0x5')](_0x81b1('0x4e'),require('./api/cmHopper'));_0x5ba49d[_0x81b1('0x5')](_0x81b1('0x4f'),require(_0x81b1('0x50')));_0x5ba49d['use'](_0x81b1('0x51'),require(_0x81b1('0x52')));_0x5ba49d['use'](_0x81b1('0x53'),require(_0x81b1('0x54')));_0x5ba49d[_0x81b1('0x5')](_0x81b1('0x55'),require(_0x81b1('0x56')));_0x5ba49d[_0x81b1('0x5')]('/api/actions',require(_0x81b1('0x57')));_0x5ba49d[_0x81b1('0x5')]('/api/automations',require(_0x81b1('0x58')));_0x5ba49d[_0x81b1('0x5')](_0x81b1('0x59'),require(_0x81b1('0x5a')));_0x5ba49d[_0x81b1('0x5')](_0x81b1('0x5b'),require(_0x81b1('0x5c')));_0x5ba49d[_0x81b1('0x5')](_0x81b1('0x5d'),require('./api/condition'));_0x5ba49d[_0x81b1('0x5')](_0x81b1('0x5e'),require(_0x81b1('0x5f')));_0x5ba49d[_0x81b1('0x5')](_0x81b1('0x60'),require(_0x81b1('0x61')));_0x5ba49d[_0x81b1('0x5')]('/api/cdr',require('./api/cdr'));_0x5ba49d[_0x81b1('0x5')](_0x81b1('0x62'),require(_0x81b1('0x63')));_0x5ba49d['use'](_0x81b1('0x64'),require(_0x81b1('0x65')));_0x5ba49d[_0x81b1('0x5')](_0x81b1('0x66'),require(_0x81b1('0x67')));_0x5ba49d['use'](_0x81b1('0x68'),require(_0x81b1('0x69')));_0x5ba49d[_0x81b1('0x5')]('/api/contact_item_types',require(_0x81b1('0x6a')));_0x5ba49d[_0x81b1('0x5')](_0x81b1('0x6b'),require(_0x81b1('0x6c')));_0x5ba49d['use']('/api/cm_hopper_additional_phones',require(_0x81b1('0x6d')));_0x5ba49d[_0x81b1('0x5')](_0x81b1('0x6e'),require(_0x81b1('0x6f')));_0x5ba49d[_0x81b1('0x5')](_0x81b1('0x70'),require('./api/trigger'));_0x5ba49d[_0x81b1('0x5')]('/api/variables',require(_0x81b1('0x71')));_0x5ba49d['use'](_0x81b1('0x72'),require(_0x81b1('0x73')));_0x5ba49d[_0x81b1('0x5')](_0x81b1('0x74'),require('./api/integrationReport'));_0x5ba49d['use'](_0x81b1('0x75'),require(_0x81b1('0x76')));_0x5ba49d[_0x81b1('0x5')](_0x81b1('0x77'),require(_0x81b1('0x78')));_0x5ba49d[_0x81b1('0x5')]('/api/analytics/extracted_reports',require(_0x81b1('0x79')));_0x5ba49d['use'](_0x81b1('0x7a'),require('./api/analyticMetric'));_0x5ba49d['use']('/api/analytics/field_reports',require('./api/analyticFieldReport'));_0x5ba49d[_0x81b1('0x5')](_0x81b1('0x7b'),require('./api/analyticTreeReport'));_0x5ba49d[_0x81b1('0x5')](_0x81b1('0x7c'),require('./api/intSalesforceAccount'));_0x5ba49d[_0x81b1('0x5')](_0x81b1('0x7d'),require(_0x81b1('0x7e')));_0x5ba49d[_0x81b1('0x5')](_0x81b1('0x7f'),require('./api/intSalesforceField'));_0x5ba49d[_0x81b1('0x5')]('/api/integrations/sugarcrm/accounts',require(_0x81b1('0x80')));_0x5ba49d[_0x81b1('0x5')]('/api/integrations/sugarcrm/configurations',require(_0x81b1('0x81')));_0x5ba49d[_0x81b1('0x5')](_0x81b1('0x82'),require(_0x81b1('0x83')));_0x5ba49d[_0x81b1('0x5')](_0x81b1('0x84'),require(_0x81b1('0x85')));_0x5ba49d[_0x81b1('0x5')](_0x81b1('0x86'),require(_0x81b1('0x87')));_0x5ba49d[_0x81b1('0x5')](_0x81b1('0x88'),require(_0x81b1('0x89')));_0x5ba49d[_0x81b1('0x5')](_0x81b1('0x8a'),require(_0x81b1('0x8b')));_0x5ba49d[_0x81b1('0x5')](_0x81b1('0x8c'),require('./api/intZohoConfiguration'));_0x5ba49d['use'](_0x81b1('0x8d'),require(_0x81b1('0x8e')));_0x5ba49d['use'](_0x81b1('0x8f'),require(_0x81b1('0x90')));_0x5ba49d[_0x81b1('0x5')](_0x81b1('0x91'),require(_0x81b1('0x92')));_0x5ba49d[_0x81b1('0x5')](_0x81b1('0x93'),require(_0x81b1('0x94')));_0x5ba49d['use'](_0x81b1('0x95'),require(_0x81b1('0x96')));_0x5ba49d[_0x81b1('0x5')]('/api/integrations/freshdesk/configurations',require(_0x81b1('0x97')));_0x5ba49d[_0x81b1('0x5')](_0x81b1('0x98'),require(_0x81b1('0x99')));_0x5ba49d[_0x81b1('0x5')]('/api/integrations/vtiger/accounts',require('./api/intVtigerAccount'));_0x5ba49d['use'](_0x81b1('0x9a'),require('./api/intVtigerConfiguration'));_0x5ba49d[_0x81b1('0x5')](_0x81b1('0x9b'),require(_0x81b1('0x9c')));_0x5ba49d[_0x81b1('0x5')](_0x81b1('0x9d'),require(_0x81b1('0x9e')));_0x5ba49d[_0x81b1('0x5')](_0x81b1('0x9f'),require('./api/intServicenowConfiguration'));_0x5ba49d[_0x81b1('0x5')](_0x81b1('0xa0'),require('./api/intServicenowField'));_0x5ba49d[_0x81b1('0x5')]('/api/integrations/dynamics365/accounts',require(_0x81b1('0xa1')));_0x5ba49d[_0x81b1('0x5')](_0x81b1('0xa2'),require('./api/intDynamics365Configuration'));_0x5ba49d[_0x81b1('0x5')]('/api/integrations/dynamics365/fields',require('./api/intDynamics365Field'));_0x5ba49d[_0x81b1('0x5')](_0x81b1('0xa3'),require('./api/intFreshsalesAccount'));_0x5ba49d[_0x81b1('0x5')](_0x81b1('0xa4'),require(_0x81b1('0xa5')));_0x5ba49d[_0x81b1('0x5')](_0x81b1('0xa6'),require(_0x81b1('0xa7')));_0x5ba49d[_0x81b1('0x5')](_0x81b1('0xa8'),require('./api/network'));_0x5ba49d[_0x81b1('0x5')]('/api/chat/reports/queue',require(_0x81b1('0xa9')));_0x5ba49d[_0x81b1('0x5')]('/api/chat/internal/messages',require(_0x81b1('0xaa')));_0x5ba49d['use']('/api/jscripty/answers/reports',require(_0x81b1('0xab')));_0x5ba49d[_0x81b1('0x5')]('/api/jscripty/questions/reports',require(_0x81b1('0xac')));_0x5ba49d[_0x81b1('0x5')](_0x81b1('0xad'),require(_0x81b1('0xae')));_0x5ba49d[_0x81b1('0x5')](_0x81b1('0xaf'),require('./api/smsQueueReport'));_0x5ba49d[_0x81b1('0x5')](_0x81b1('0xb0'),require('./api/squareReport'));_0x5ba49d['use'](_0x81b1('0xb1'),require('./api/squareReportDetail'));_0x5ba49d[_0x81b1('0x5')](_0x81b1('0xb2'),require(_0x81b1('0xb3')));_0x5ba49d[_0x81b1('0x5')](_0x81b1('0xb4'),require(_0x81b1('0xb5')));_0x5ba49d[_0x81b1('0x5')](_0x81b1('0xb6'),require(_0x81b1('0xb7')));_0x5ba49d[_0x81b1('0x5')](_0x81b1('0xb8'),require(_0x81b1('0xb9')));_0x5ba49d[_0x81b1('0x5')](_0x81b1('0xba'),require(_0x81b1('0xbb')));_0x5ba49d[_0x81b1('0x5')](_0x81b1('0xbc'),require(_0x81b1('0xbd')));_0x5ba49d[_0x81b1('0x5')]('/api/teams',require(_0x81b1('0xbe')));_0x5ba49d[_0x81b1('0x5')]('/api/license',require(_0x81b1('0xbf')));_0x5ba49d['use']('/api/campaigns',require(_0x81b1('0xc0')));_0x5ba49d[_0x81b1('0x5')](_0x81b1('0xc1'),require(_0x81b1('0xc2')));_0x5ba49d[_0x81b1('0x5')](_0x81b1('0xc3'),require(_0x81b1('0xc4')));_0x5ba49d[_0x81b1('0x5')](_0x81b1('0xc5'),require(_0x81b1('0xc6')));_0x5ba49d[_0x81b1('0x5')](_0x81b1('0xc7'),require(_0x81b1('0xc8')));_0x5ba49d['use'](_0x81b1('0xc9'),require('./api/chatTransferReport'));_0x5ba49d[_0x81b1('0x5')](_0x81b1('0xca'),require(_0x81b1('0xcb')));_0x5ba49d[_0x81b1('0x5')]('/api/openchannel/reports/transfer',require(_0x81b1('0xcc')));_0x5ba49d['use'](_0x81b1('0xcd'),require(_0x81b1('0xce')));_0x5ba49d['use'](_0x81b1('0xcf'),require(_0x81b1('0xd0')));_0x5ba49d['use'](_0x81b1('0xd1'),require(_0x81b1('0xd2')));_0x5ba49d[_0x81b1('0x5')](_0x81b1('0xd3'),require('./api/userProfile'));_0x5ba49d[_0x81b1('0x5')](_0x81b1('0xd4'),require('./api/userProfileSection'));_0x5ba49d[_0x81b1('0x5')]('/api/userProfile/resources',require(_0x81b1('0xd5')));_0x5ba49d['use'](_0x81b1('0xd6'),require(_0x81b1('0xd7')));_0x5ba49d[_0x81b1('0x5')]('/api/whatsapp/accounts',require(_0x81b1('0xd8')));_0x5ba49d[_0x81b1('0x5')]('/api/whatsapp/applications',require(_0x81b1('0xd9')));_0x5ba49d[_0x81b1('0x5')](_0x81b1('0xda'),require(_0x81b1('0xdb')));_0x5ba49d[_0x81b1('0x5')]('/api/whatsapp/messages',require(_0x81b1('0xdc')));_0x5ba49d[_0x81b1('0x5')](_0x81b1('0xdd'),require(_0x81b1('0xde')));_0x5ba49d[_0x81b1('0x5')](_0x81b1('0xdf'),require(_0x81b1('0xe0')));_0x5ba49d[_0x81b1('0x5')](_0x81b1('0xe1'),require(_0x81b1('0xe2')));_0x5ba49d[_0x81b1('0x5')](_0x81b1('0xe3'),require(_0x81b1('0xe4')));_0x5ba49d['use'](_0x81b1('0xe5'),require(_0x81b1('0xe6')));_0x5ba49d[_0x81b1('0x5')](_0x81b1('0xe7'),require('./api/user-setting'));_0x5ba49d[_0x81b1('0x5')]('/api/mail_interaction_has_tags',require(_0x81b1('0xe8')));_0x5ba49d[_0x81b1('0x5')](_0x81b1('0xe9'),require(_0x81b1('0xea')));_0x5ba49d[_0x81b1('0x5')](_0x81b1('0xeb'),require('./api/authGoogle'));_0x5ba49d[_0x81b1('0x5')]('/api/auth/activedirectory',require(_0x81b1('0xec')));_0x5ba49d[_0x81b1('0x5')](_0x81b1('0xed'),require(_0x81b1('0xee')));_0x5ba49d[_0x81b1('0x5')](_0x81b1('0xef'),require(_0x81b1('0xf0')));_0x5ba49d[_0x81b1('0x5')](_0x81b1('0xf1'),require(_0x81b1('0xf2')));_0x5ba49d[_0x81b1('0x5')](_0x81b1('0xf3'),require(_0x81b1('0xf4')));_0x5ba49d[_0x81b1('0x5')]('/api/pm2',require(_0x81b1('0xf5')));_0x5ba49d['use']('/api/webbar',require(_0x81b1('0xf6')));_0x5ba49d['use'](_0x81b1('0xf7'),clientSideLogs);_0x5ba49d[_0x81b1('0x5')](_0x81b1('0xf8'),express[_0x81b1('0xf9')](path[_0x81b1('0xfa')](config[_0x81b1('0xfb')],_0x81b1('0xf8'))));_0x5ba49d[_0x81b1('0x5')](_0x81b1('0xfc'),express[_0x81b1('0xf9')](path[_0x81b1('0xfa')](config[_0x81b1('0xfb')],_0x81b1('0xfc'))));_0x5ba49d[_0x81b1('0x5')](_0x81b1('0xfd'),express['static'](path[_0x81b1('0xfa')](config[_0x81b1('0xfb')],_0x81b1('0xfd'))));_0x5ba49d[_0x81b1('0x5')](_0x81b1('0xfe'),express[_0x81b1('0xf9')](path[_0x81b1('0xfa')](config['root'],'snippet',_0x81b1('0xff'))));_0x5ba49d[_0x81b1('0x5')]('/plugins',express[_0x81b1('0xf9')](path[_0x81b1('0xfa')](config[_0x81b1('0xfb')],'/server/files/plugins')));_0x5ba49d['route'](_0x81b1('0x100'))[_0x81b1('0x101')](errors[0x194]);_0x5ba49d[_0x81b1('0x102')]('/*')[_0x81b1('0x101')](function(_0x303e7a,_0x58eccf){_0x58eccf[_0x81b1('0x103')](path[_0x81b1('0x104')](_0x5ba49d[_0x81b1('0x101')](_0x81b1('0x105'))+_0x81b1('0x106')));});return _0x5ba49d;});}; \ No newline at end of file +var _0x6470=['/api/analytics/extracted_reports','./api/analyticExtractedReport','/api/analytics/metrics','/api/analytics/field_reports','./api/analyticFieldReport','/api/integrations/salesforce/accounts','/api/integrations/salesforce/configurations','/api/integrations/salesforce/fields','/api/integrations/sugarcrm/configurations','/api/integrations/sugarcrm/fields','./api/intSugarcrmField','./api/intDeskAccount','/api/integrations/desk/configurations','./api/intDeskConfiguration','./api/intDeskField','/api/integrations/zoho/accounts','./api/intZohoAccount','./api/intZohoConfiguration','./api/intZohoField','/api/integrations/zendesk/accounts','./api/intZendeskAccount','/api/integrations/zendesk/configurations','./api/intZendeskConfiguration','/api/integrations/zendesk/fields','/api/integrations/freshdesk/accounts','./api/intFreshdeskAccount','/api/integrations/freshdesk/configurations','./api/intFreshdeskConfiguration','/api/integrations/vtiger/accounts','./api/intVtigerAccount','/api/integrations/vtiger/configurations','./api/intVtigerConfiguration','./api/intVtigerField','/api/integrations/servicenow/accounts','./api/intServicenowAccount','/api/integrations/servicenow/configurations','./api/intServicenowConfiguration','/api/integrations/servicenow/fields','./api/intServicenowField','/api/integrations/dynamics365/accounts','./api/intDynamics365Account','./api/intDynamics365Configuration','./api/intDynamics365Field','/api/integrations/freshsales/accounts','./api/intFreshsalesAccount','./api/intFreshsalesConfiguration','./api/intFreshsalesField','/api/networks','./api/network','/api/chat/reports/queue','/api/chat/internal/messages','./api/chatInternalMessage','/api/jscripty/questions/reports','./api/jscriptyQuestionReport','/api/jscripty/sessions/reports','./api/jscriptySessionReport','/api/sms/reports/queue','./api/smsQueueReport','/api/square/reports','./api/squareReport','/api/square/details/reports','/api/jscripty/projects','./api/jscriptyProject','/api/settings','./api/setting','./api/squareOdbc','/api/square/projects','./api/squareProject','/api/square/recordings','./api/squareRecording','/api/square/messages','/api/teams','./api/team','./api/license','./api/campaign','/api/migrations','./api/migration','./api/attachment','./api/plugin','/api/mail/reports/transfer','./api/mailTransferReport','/api/chat/reports/transfer','./api/faxTransferReport','/api/openchannel/reports/transfer','./api/openchannelTransferReport','/api/sms/reports/transfer','./api/smsTransferReport','/api/cm/lists','./api/cmList','/api/voice/prefixes','./api/voicePrefix','/api/userProfiles','./api/userProfile','./api/userProfileSection','/api/userProfile/resources','./api/userProfileResource','/api/userNotifications','./api/userNotification','/api/whatsapp/accounts','./api/whatsappAccount','./api/whatsappApplication','./api/whatsappInteraction','/api/whatsapp/messages','/api/whatsapp/reports/queue','./api/whatsappQueueReport','/api/whatsapp/reports/transfer','./api/whatsappTransferReport','/api/whatsapp/queues','./api/whatsappQueue','/api/cloudProviders','./api/cloudProvider','/api/realtime','./api/realtime','/api/user-settings','./api/user-setting','/api/auth/local','./api/authLocal','/api/auth/google','./api/authGoogle','./api/authActiveDirectory','/api/jira','/api/rpc','./api/rpc','/api/system','./api/system','./api/pm2','/api/webbar','/api/logs','/apidoc','static','join','root','/www','/snippet','snippet','3.12.1','route','/:url(api|auth|components|app|bower_components|assets)/*','get','sendFile','resolve','appPath','/index.html','path','express','./utils/client-side-logger','./api/client-side-logs','default','then','use','./api/user','./api/voiceChanSpy','/api/voice/contexts','/api/voice/mohs','./api/voiceMusicOnHold','/api/voice/queues','./api/voiceQueue','/api/voice/recordings','./api/voiceRecording','./api/screenRecording','/api/voice/mails','./api/voiceMail','/api/voice/mails/messages','./api/voiceMailMessage','/api/voice/dials/reports','./api/voiceDialReport','/api/voice/agents/reports','./api/voiceAgentReport','./api/memberReport','/api/trunks','./api/voiceTransferReport','/api/mail/out_servers','/api/mail/accounts','/api/mail/queues','/api/mail/substatuses','./api/mailSubstatus','./api/mailInteraction','/api/mail/messages','./api/mailMessage','/api/mail/applications','./api/mailApplication','/api/mail/reports/queue','./api/dashboard','/api/dashboards/items','./api/dashboardItem','/api/fax/accounts','/api/fax/applications','./api/faxApplication','/api/fax/interactions','/api/fax/messages','./api/faxMessage','/api/fax/queues','/api/fax/reports/queue','./api/faxQueueReport','/api/sms/accounts','./api/smsAccount','/api/sms/interactions','./api/smsInteraction','./api/smsMessage','/api/sms/queues','./api/smsQueue','/api/openchannel/accounts','./api/openchannelAccount','/api/openchannel/applications','./api/openchannelApplication','./api/openchannelInteraction','./api/openchannelMessage','/api/openchannel/queues','./api/openchannelQueue','./api/chatWebsite','/api/openchannel/reports/queue','./api/openchannelQueueReport','./api/chatApplication','/api/chat/interactions','./api/chatInteraction','/api/chat/messages','./api/chatMessage','./api/chatOfflineMessage','/api/chat/queues','./api/chatQueue','/api/chat/groups','/api/chat/proactive_actions','./api/chatProactiveAction','./api/cmCompany','/api/cm/contacts','./api/cmContact','./api/cmHopper','/api/cm/hopper_black','/api/cm/hopper_final','./api/cmHopperFinal','/api/cm/hopper_history','./api/cmHopperHistory','/api/cm/custom_fields','./api/cmCustomField','/api/actions','./api/action','/api/automations','/api/canned_answers','./api/cannedAnswer','/api/dispositions','/api/conditions','./api/condition','/api/intervals','./api/interval','/api/pauses','/api/cdr','./api/cdr','/api/voiceQueuesLog','./api/voiceQueuesLog','/api/schedules','./api/schedule','/api/sounds','./api/sound','/api/tags','./api/tag','/api/contact_item_types','/api/cm_contact_has_items','/api/cm_hopper_additional_phones','./api/cmHopperAdditionalPhone','./api/template','/api/triggers','./api/trigger','/api/variables','./api/integration','/api/integrations/reports','./api/integrationReport','/api/analytics/custom_reports','./api/analyticCustomReport','./api/analyticDefaultReport'];(function(_0x1f6afd,_0x2e061d){var _0x17dda9=function(_0x5cb907){while(--_0x5cb907){_0x1f6afd['push'](_0x1f6afd['shift']());}};_0x17dda9(++_0x2e061d);}(_0x6470,0x19c));var _0x0647=function(_0x139378,_0x3123b2){_0x139378=_0x139378-0x0;var _0x35c8e9=_0x6470[_0x139378];return _0x35c8e9;};'use strict';var path=require(_0x0647('0x0'));var express=require(_0x0647('0x1'));var errors=require('./errors');var config=require('./config/environment');var setupLoggers=require(_0x0647('0x2'))['setupLoggers'];var clientSideLogs=require(_0x0647('0x3'));exports[_0x0647('0x4')]=function(_0x31879c){return setupLoggers(_0x31879c)[_0x0647('0x5')](function(){_0x31879c[_0x0647('0x6')]('/api/users',require(_0x0647('0x7')));_0x31879c['use']('/api/voice/chanspy',require(_0x0647('0x8')));_0x31879c['use'](_0x0647('0x9'),require('./api/voiceContext'));_0x31879c[_0x0647('0x6')]('/api/voice/extensions',require('./api/voiceExtension'));_0x31879c[_0x0647('0x6')](_0x0647('0xa'),require(_0x0647('0xb')));_0x31879c[_0x0647('0x6')](_0x0647('0xc'),require(_0x0647('0xd')));_0x31879c[_0x0647('0x6')](_0x0647('0xe'),require(_0x0647('0xf')));_0x31879c[_0x0647('0x6')]('/api/screen/recordings',require(_0x0647('0x10')));_0x31879c[_0x0647('0x6')](_0x0647('0x11'),require(_0x0647('0x12')));_0x31879c['use'](_0x0647('0x13'),require(_0x0647('0x14')));_0x31879c[_0x0647('0x6')]('/api/voice/calls/reports',require('./api/voiceCallReport'));_0x31879c[_0x0647('0x6')](_0x0647('0x15'),require(_0x0647('0x16')));_0x31879c[_0x0647('0x6')](_0x0647('0x17'),require(_0x0647('0x18')));_0x31879c['use']('/api/voice/queues/reports',require('./api/voiceQueueReport'));_0x31879c[_0x0647('0x6')]('/api/members/reports',require(_0x0647('0x19')));_0x31879c['use'](_0x0647('0x1a'),require('./api/trunk'));_0x31879c['use']('/api/voice/transfers/reports',require(_0x0647('0x1b')));_0x31879c[_0x0647('0x6')](_0x0647('0x1c'),require('./api/mailServerOut'));_0x31879c[_0x0647('0x6')](_0x0647('0x1d'),require('./api/mailAccount'));_0x31879c['use'](_0x0647('0x1e'),require('./api/mailQueue'));_0x31879c[_0x0647('0x6')](_0x0647('0x1f'),require(_0x0647('0x20')));_0x31879c['use']('/api/mail/interactions',require(_0x0647('0x21')));_0x31879c['use'](_0x0647('0x22'),require(_0x0647('0x23')));_0x31879c[_0x0647('0x6')](_0x0647('0x24'),require(_0x0647('0x25')));_0x31879c['use'](_0x0647('0x26'),require('./api/mailQueueReport'));_0x31879c[_0x0647('0x6')]('/api/dashboards',require(_0x0647('0x27')));_0x31879c[_0x0647('0x6')](_0x0647('0x28'),require(_0x0647('0x29')));_0x31879c['use'](_0x0647('0x2a'),require('./api/faxAccount'));_0x31879c[_0x0647('0x6')](_0x0647('0x2b'),require(_0x0647('0x2c')));_0x31879c[_0x0647('0x6')](_0x0647('0x2d'),require('./api/faxInteraction'));_0x31879c[_0x0647('0x6')](_0x0647('0x2e'),require(_0x0647('0x2f')));_0x31879c[_0x0647('0x6')](_0x0647('0x30'),require('./api/faxQueue'));_0x31879c['use'](_0x0647('0x31'),require(_0x0647('0x32')));_0x31879c[_0x0647('0x6')](_0x0647('0x33'),require(_0x0647('0x34')));_0x31879c[_0x0647('0x6')]('/api/sms/applications',require('./api/smsApplication'));_0x31879c[_0x0647('0x6')](_0x0647('0x35'),require(_0x0647('0x36')));_0x31879c[_0x0647('0x6')]('/api/sms/messages',require(_0x0647('0x37')));_0x31879c[_0x0647('0x6')](_0x0647('0x38'),require(_0x0647('0x39')));_0x31879c[_0x0647('0x6')](_0x0647('0x3a'),require(_0x0647('0x3b')));_0x31879c[_0x0647('0x6')](_0x0647('0x3c'),require(_0x0647('0x3d')));_0x31879c[_0x0647('0x6')]('/api/openchannel/interactions',require(_0x0647('0x3e')));_0x31879c[_0x0647('0x6')]('/api/openchannel/messages',require(_0x0647('0x3f')));_0x31879c[_0x0647('0x6')](_0x0647('0x40'),require(_0x0647('0x41')));_0x31879c[_0x0647('0x6')]('/api/chat/websites',require(_0x0647('0x42')));_0x31879c[_0x0647('0x6')](_0x0647('0x43'),require(_0x0647('0x44')));_0x31879c[_0x0647('0x6')]('/api/chat/applications',require(_0x0647('0x45')));_0x31879c['use'](_0x0647('0x46'),require(_0x0647('0x47')));_0x31879c['use'](_0x0647('0x48'),require(_0x0647('0x49')));_0x31879c[_0x0647('0x6')]('/api/chat/offline_messages',require(_0x0647('0x4a')));_0x31879c[_0x0647('0x6')](_0x0647('0x4b'),require(_0x0647('0x4c')));_0x31879c[_0x0647('0x6')](_0x0647('0x4d'),require('./api/chatGroup'));_0x31879c[_0x0647('0x6')](_0x0647('0x4e'),require(_0x0647('0x4f')));_0x31879c[_0x0647('0x6')]('/api/cm/companies',require(_0x0647('0x50')));_0x31879c[_0x0647('0x6')](_0x0647('0x51'),require(_0x0647('0x52')));_0x31879c['use']('/api/cm/hopper',require(_0x0647('0x53')));_0x31879c[_0x0647('0x6')](_0x0647('0x54'),require('./api/cmHopperBlack'));_0x31879c[_0x0647('0x6')](_0x0647('0x55'),require(_0x0647('0x56')));_0x31879c[_0x0647('0x6')](_0x0647('0x57'),require(_0x0647('0x58')));_0x31879c[_0x0647('0x6')](_0x0647('0x59'),require(_0x0647('0x5a')));_0x31879c[_0x0647('0x6')](_0x0647('0x5b'),require(_0x0647('0x5c')));_0x31879c[_0x0647('0x6')](_0x0647('0x5d'),require('./api/automation'));_0x31879c[_0x0647('0x6')](_0x0647('0x5e'),require(_0x0647('0x5f')));_0x31879c[_0x0647('0x6')](_0x0647('0x60'),require('./api/disposition'));_0x31879c[_0x0647('0x6')](_0x0647('0x61'),require(_0x0647('0x62')));_0x31879c[_0x0647('0x6')](_0x0647('0x63'),require(_0x0647('0x64')));_0x31879c[_0x0647('0x6')](_0x0647('0x65'),require('./api/pause'));_0x31879c['use'](_0x0647('0x66'),require(_0x0647('0x67')));_0x31879c[_0x0647('0x6')](_0x0647('0x68'),require(_0x0647('0x69')));_0x31879c[_0x0647('0x6')](_0x0647('0x6a'),require(_0x0647('0x6b')));_0x31879c[_0x0647('0x6')](_0x0647('0x6c'),require(_0x0647('0x6d')));_0x31879c['use'](_0x0647('0x6e'),require(_0x0647('0x6f')));_0x31879c['use'](_0x0647('0x70'),require('./api/contactItemType'));_0x31879c[_0x0647('0x6')](_0x0647('0x71'),require('./api/cmContactHasItem'));_0x31879c['use'](_0x0647('0x72'),require(_0x0647('0x73')));_0x31879c[_0x0647('0x6')]('/api/templates',require(_0x0647('0x74')));_0x31879c['use'](_0x0647('0x75'),require(_0x0647('0x76')));_0x31879c[_0x0647('0x6')](_0x0647('0x77'),require('./api/variable'));_0x31879c['use']('/api/integrations',require(_0x0647('0x78')));_0x31879c['use'](_0x0647('0x79'),require(_0x0647('0x7a')));_0x31879c[_0x0647('0x6')](_0x0647('0x7b'),require(_0x0647('0x7c')));_0x31879c[_0x0647('0x6')]('/api/analytics/default_reports',require(_0x0647('0x7d')));_0x31879c[_0x0647('0x6')](_0x0647('0x7e'),require(_0x0647('0x7f')));_0x31879c[_0x0647('0x6')](_0x0647('0x80'),require('./api/analyticMetric'));_0x31879c[_0x0647('0x6')](_0x0647('0x81'),require(_0x0647('0x82')));_0x31879c[_0x0647('0x6')]('/api/analytics/tree_reports',require('./api/analyticTreeReport'));_0x31879c['use'](_0x0647('0x83'),require('./api/intSalesforceAccount'));_0x31879c[_0x0647('0x6')](_0x0647('0x84'),require('./api/intSalesforceConfiguration'));_0x31879c[_0x0647('0x6')](_0x0647('0x85'),require('./api/intSalesforceField'));_0x31879c['use']('/api/integrations/sugarcrm/accounts',require('./api/intSugarcrmAccount'));_0x31879c[_0x0647('0x6')](_0x0647('0x86'),require('./api/intSugarcrmConfiguration'));_0x31879c[_0x0647('0x6')](_0x0647('0x87'),require(_0x0647('0x88')));_0x31879c[_0x0647('0x6')]('/api/integrations/desk/accounts',require(_0x0647('0x89')));_0x31879c[_0x0647('0x6')](_0x0647('0x8a'),require(_0x0647('0x8b')));_0x31879c[_0x0647('0x6')]('/api/integrations/desk/fields',require(_0x0647('0x8c')));_0x31879c[_0x0647('0x6')](_0x0647('0x8d'),require(_0x0647('0x8e')));_0x31879c[_0x0647('0x6')]('/api/integrations/zoho/configurations',require(_0x0647('0x8f')));_0x31879c[_0x0647('0x6')]('/api/integrations/zoho/fields',require(_0x0647('0x90')));_0x31879c[_0x0647('0x6')](_0x0647('0x91'),require(_0x0647('0x92')));_0x31879c[_0x0647('0x6')](_0x0647('0x93'),require(_0x0647('0x94')));_0x31879c['use'](_0x0647('0x95'),require('./api/intZendeskField'));_0x31879c[_0x0647('0x6')](_0x0647('0x96'),require(_0x0647('0x97')));_0x31879c['use'](_0x0647('0x98'),require(_0x0647('0x99')));_0x31879c[_0x0647('0x6')]('/api/integrations/freshdesk/fields',require('./api/intFreshdeskField'));_0x31879c[_0x0647('0x6')](_0x0647('0x9a'),require(_0x0647('0x9b')));_0x31879c[_0x0647('0x6')](_0x0647('0x9c'),require(_0x0647('0x9d')));_0x31879c[_0x0647('0x6')]('/api/integrations/vtiger/fields',require(_0x0647('0x9e')));_0x31879c[_0x0647('0x6')](_0x0647('0x9f'),require(_0x0647('0xa0')));_0x31879c['use'](_0x0647('0xa1'),require(_0x0647('0xa2')));_0x31879c['use'](_0x0647('0xa3'),require(_0x0647('0xa4')));_0x31879c[_0x0647('0x6')](_0x0647('0xa5'),require(_0x0647('0xa6')));_0x31879c[_0x0647('0x6')]('/api/integrations/dynamics365/configurations',require(_0x0647('0xa7')));_0x31879c['use']('/api/integrations/dynamics365/fields',require(_0x0647('0xa8')));_0x31879c[_0x0647('0x6')](_0x0647('0xa9'),require(_0x0647('0xaa')));_0x31879c[_0x0647('0x6')]('/api/integrations/freshsales/configurations',require(_0x0647('0xab')));_0x31879c[_0x0647('0x6')]('/api/integrations/freshsales/fields',require(_0x0647('0xac')));_0x31879c[_0x0647('0x6')](_0x0647('0xad'),require(_0x0647('0xae')));_0x31879c[_0x0647('0x6')](_0x0647('0xaf'),require('./api/chatQueueReport'));_0x31879c[_0x0647('0x6')](_0x0647('0xb0'),require(_0x0647('0xb1')));_0x31879c[_0x0647('0x6')]('/api/jscripty/answers/reports',require('./api/jscriptyAnswerReport'));_0x31879c[_0x0647('0x6')](_0x0647('0xb2'),require(_0x0647('0xb3')));_0x31879c[_0x0647('0x6')](_0x0647('0xb4'),require(_0x0647('0xb5')));_0x31879c['use'](_0x0647('0xb6'),require(_0x0647('0xb7')));_0x31879c[_0x0647('0x6')](_0x0647('0xb8'),require(_0x0647('0xb9')));_0x31879c['use'](_0x0647('0xba'),require('./api/squareReportDetail'));_0x31879c[_0x0647('0x6')](_0x0647('0xbb'),require(_0x0647('0xbc')));_0x31879c[_0x0647('0x6')](_0x0647('0xbd'),require(_0x0647('0xbe')));_0x31879c['use']('/api/square/odbc',require(_0x0647('0xbf')));_0x31879c[_0x0647('0x6')](_0x0647('0xc0'),require(_0x0647('0xc1')));_0x31879c['use'](_0x0647('0xc2'),require(_0x0647('0xc3')));_0x31879c[_0x0647('0x6')](_0x0647('0xc4'),require('./api/squareMessage'));_0x31879c['use'](_0x0647('0xc5'),require(_0x0647('0xc6')));_0x31879c['use']('/api/license',require(_0x0647('0xc7')));_0x31879c[_0x0647('0x6')]('/api/campaigns',require(_0x0647('0xc8')));_0x31879c[_0x0647('0x6')](_0x0647('0xc9'),require(_0x0647('0xca')));_0x31879c['use']('/api/attachments',require(_0x0647('0xcb')));_0x31879c[_0x0647('0x6')]('/api/plugins',require(_0x0647('0xcc')));_0x31879c[_0x0647('0x6')](_0x0647('0xcd'),require(_0x0647('0xce')));_0x31879c[_0x0647('0x6')](_0x0647('0xcf'),require('./api/chatTransferReport'));_0x31879c['use']('/api/fax/reports/transfer',require(_0x0647('0xd0')));_0x31879c['use'](_0x0647('0xd1'),require(_0x0647('0xd2')));_0x31879c['use'](_0x0647('0xd3'),require(_0x0647('0xd4')));_0x31879c['use'](_0x0647('0xd5'),require(_0x0647('0xd6')));_0x31879c[_0x0647('0x6')](_0x0647('0xd7'),require(_0x0647('0xd8')));_0x31879c[_0x0647('0x6')](_0x0647('0xd9'),require(_0x0647('0xda')));_0x31879c['use']('/api/userProfile/sections',require(_0x0647('0xdb')));_0x31879c[_0x0647('0x6')](_0x0647('0xdc'),require(_0x0647('0xdd')));_0x31879c[_0x0647('0x6')](_0x0647('0xde'),require(_0x0647('0xdf')));_0x31879c[_0x0647('0x6')](_0x0647('0xe0'),require(_0x0647('0xe1')));_0x31879c[_0x0647('0x6')]('/api/whatsapp/applications',require(_0x0647('0xe2')));_0x31879c['use']('/api/whatsapp/interactions',require(_0x0647('0xe3')));_0x31879c[_0x0647('0x6')](_0x0647('0xe4'),require('./api/whatsappMessage'));_0x31879c[_0x0647('0x6')](_0x0647('0xe5'),require(_0x0647('0xe6')));_0x31879c[_0x0647('0x6')](_0x0647('0xe7'),require(_0x0647('0xe8')));_0x31879c[_0x0647('0x6')](_0x0647('0xe9'),require(_0x0647('0xea')));_0x31879c[_0x0647('0x6')](_0x0647('0xeb'),require(_0x0647('0xec')));_0x31879c['use'](_0x0647('0xed'),require(_0x0647('0xee')));_0x31879c[_0x0647('0x6')](_0x0647('0xef'),require(_0x0647('0xf0')));_0x31879c[_0x0647('0x6')]('/api/mail_interaction_has_tags',require('./api/mailInteractionHasTag'));_0x31879c[_0x0647('0x6')](_0x0647('0xf1'),require(_0x0647('0xf2')));_0x31879c['use'](_0x0647('0xf3'),require(_0x0647('0xf4')));_0x31879c[_0x0647('0x6')]('/api/auth/activedirectory',require(_0x0647('0xf5')));_0x31879c[_0x0647('0x6')](_0x0647('0xf6'),require('./api/jira'));_0x31879c[_0x0647('0x6')](_0x0647('0xf7'),require(_0x0647('0xf8')));_0x31879c[_0x0647('0x6')]('/api/version',require('./api/version'));_0x31879c['use'](_0x0647('0xf9'),require(_0x0647('0xfa')));_0x31879c[_0x0647('0x6')]('/api/pm2',require(_0x0647('0xfb')));_0x31879c[_0x0647('0x6')](_0x0647('0xfc'),require('./api/webbar'));_0x31879c['use'](_0x0647('0xfd'),clientSideLogs);_0x31879c[_0x0647('0x6')](_0x0647('0xfe'),express[_0x0647('0xff')](path[_0x0647('0x100')](config[_0x0647('0x101')],_0x0647('0xfe'))));_0x31879c[_0x0647('0x6')](_0x0647('0x102'),express['static'](path[_0x0647('0x100')](config[_0x0647('0x101')],_0x0647('0x102'))));_0x31879c[_0x0647('0x6')]('/demo',express[_0x0647('0xff')](path[_0x0647('0x100')](config[_0x0647('0x101')],'/demo')));_0x31879c['use'](_0x0647('0x103'),express[_0x0647('0xff')](path[_0x0647('0x100')](config[_0x0647('0x101')],_0x0647('0x104'),_0x0647('0x105'))));_0x31879c[_0x0647('0x6')]('/plugins',express[_0x0647('0xff')](path[_0x0647('0x100')](config[_0x0647('0x101')],'/server/files/plugins')));_0x31879c[_0x0647('0x106')](_0x0647('0x107'))[_0x0647('0x108')](errors[0x194]);_0x31879c[_0x0647('0x106')]('/*')[_0x0647('0x108')](function(_0x3f3691,_0x5f2687){_0x5f2687[_0x0647('0x109')](path[_0x0647('0x10a')](_0x31879c['get'](_0x0647('0x10b'))+_0x0647('0x10c')));});return _0x31879c;});}; \ No newline at end of file diff --git a/server/rpc/index.js b/server/rpc/index.js index 7cff573..d649665 100644 --- a/server/rpc/index.js +++ b/server/rpc/index.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0xd4e8=['jayson/promise','lodash','../config/environment','listen','merge','../api/user/user.rpc','../api/voiceExtension/voiceExtension.rpc','../api/voiceRecording/voiceRecording.rpc','../api/voiceCallReport/voiceCallReport.rpc','../api/voiceAgentReport/voiceAgentReport.rpc','../api/memberReport/memberReport.rpc','../api/trunk/trunk.rpc','../api/voiceTransferReport/voiceTransferReport.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/mailQueueReport/mailQueueReport.rpc','../api/faxAccount/faxAccount.rpc','../api/faxApplication/faxApplication.rpc','../api/faxInteraction/faxInteraction.rpc','../api/faxQueueReport/faxQueueReport.rpc','../api/smsAccount/smsAccount.rpc','../api/smsMessage/smsMessage.rpc','../api/smsQueue/smsQueue.rpc','../api/openchannelApplication/openchannelApplication.rpc','../api/openchannelInteraction/openchannelInteraction.rpc','../api/openchannelMessage/openchannelMessage.rpc','../api/openchannelQueue/openchannelQueue.rpc','../api/openchannelQueueReport/openchannelQueueReport.rpc','../api/chatInteraction/chatInteraction.rpc','../api/chatMessage/chatMessage.rpc','../api/cmContact/cmContact.rpc','../api/cmHopper/cmHopper.rpc','../api/cmHopperFinal/cmHopperFinal.rpc','../api/reportAgentPreview/reportAgentPreview.rpc','../api/interval/interval.rpc','../api/pause/pause.rpc','../api/sound/sound.rpc','../api/template/template.rpc','../api/trigger/trigger.rpc','../api/variable/variable.rpc','../api/intSalesforceAccount/intSalesforceAccount.rpc','../api/intSugarcrmAccount/intSugarcrmAccount.rpc','../api/intDeskAccount/intDeskAccount.rpc','../api/intZohoAccount/intZohoAccount.rpc','../api/intZendeskAccount/intZendeskAccount.rpc','../api/intFreshdeskAccount/intFreshdeskAccount.rpc','../api/intVtigerAccount/intVtigerAccount.rpc','../api/intServicenowAccount/intServicenowAccount.rpc','../api/intDynamics365Account/intDynamics365Account.rpc','../api/intFreshsalesAccount/intFreshsalesAccount.rpc','../api/chatQueueReport/chatQueueReport.rpc','../api/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/whatsappInteraction/whatsappInteraction.rpc','../api/whatsappMessage/whatsappMessage.rpc','../api/whatsappQueueReport/whatsappQueueReport.rpc','../api/whatsappQueue/whatsappQueue.rpc','server','http','rpc','port','localhost','error','log','Express\x20RPC\x20server\x20listening\x20on\x20%s:%d!','../config/triggers'];(function(_0x14add3,_0x13ce8d){var _0x4a174f=function(_0x2b3ed7){while(--_0x2b3ed7){_0x14add3['push'](_0x14add3['shift']());}};_0x4a174f(++_0x13ce8d);}(_0xd4e8,0xe7));var _0x8d4e=function(_0x2f8255,_0x44ff85){_0x2f8255=_0x2f8255-0x0;var _0x2207f6=_0xd4e8[_0x2f8255];return _0x2207f6;};'use strict';var jayson=require(_0x8d4e('0x0'));var _=require(_0x8d4e('0x1'));var config=require(_0x8d4e('0x2'));exports[_0x8d4e('0x3')]=function(){return new Promise(function(_0x4c8a72,_0x1caaa7){var _0x4208e2={};_0x4208e2=_[_0x8d4e('0x4')](_0x4208e2,require(_0x8d4e('0x5')));_0x4208e2=_[_0x8d4e('0x4')](_0x4208e2,require(_0x8d4e('0x6')));_0x4208e2=_[_0x8d4e('0x4')](_0x4208e2,require('../api/voiceQueue/voiceQueue.rpc'));_0x4208e2=_[_0x8d4e('0x4')](_0x4208e2,require(_0x8d4e('0x7')));_0x4208e2=_['merge'](_0x4208e2,require(_0x8d4e('0x8')));_0x4208e2=_[_0x8d4e('0x4')](_0x4208e2,require('../api/voiceDialReport/voiceDialReport.rpc'));_0x4208e2=_[_0x8d4e('0x4')](_0x4208e2,require(_0x8d4e('0x9')));_0x4208e2=_['merge'](_0x4208e2,require('../api/voiceQueueReport/voiceQueueReport.rpc'));_0x4208e2=_[_0x8d4e('0x4')](_0x4208e2,require(_0x8d4e('0xa')));_0x4208e2=_['merge'](_0x4208e2,require(_0x8d4e('0xb')));_0x4208e2=_[_0x8d4e('0x4')](_0x4208e2,require(_0x8d4e('0xc')));_0x4208e2=_['merge'](_0x4208e2,require(_0x8d4e('0xd')));_0x4208e2=_[_0x8d4e('0x4')](_0x4208e2,require(_0x8d4e('0xe')));_0x4208e2=_['merge'](_0x4208e2,require(_0x8d4e('0xf')));_0x4208e2=_['merge'](_0x4208e2,require(_0x8d4e('0x10')));_0x4208e2=_[_0x8d4e('0x4')](_0x4208e2,require('../api/mailInteraction/mailInteraction.rpc'));_0x4208e2=_[_0x8d4e('0x4')](_0x4208e2,require(_0x8d4e('0x11')));_0x4208e2=_[_0x8d4e('0x4')](_0x4208e2,require(_0x8d4e('0x12')));_0x4208e2=_[_0x8d4e('0x4')](_0x4208e2,require(_0x8d4e('0x13')));_0x4208e2=_[_0x8d4e('0x4')](_0x4208e2,require(_0x8d4e('0x14')));_0x4208e2=_['merge'](_0x4208e2,require(_0x8d4e('0x15')));_0x4208e2=_[_0x8d4e('0x4')](_0x4208e2,require(_0x8d4e('0x16')));_0x4208e2=_[_0x8d4e('0x4')](_0x4208e2,require('../api/faxMessage/faxMessage.rpc'));_0x4208e2=_[_0x8d4e('0x4')](_0x4208e2,require('../api/faxQueue/faxQueue.rpc'));_0x4208e2=_['merge'](_0x4208e2,require(_0x8d4e('0x17')));_0x4208e2=_['merge'](_0x4208e2,require(_0x8d4e('0x18')));_0x4208e2=_[_0x8d4e('0x4')](_0x4208e2,require('../api/smsInteraction/smsInteraction.rpc'));_0x4208e2=_[_0x8d4e('0x4')](_0x4208e2,require(_0x8d4e('0x19')));_0x4208e2=_[_0x8d4e('0x4')](_0x4208e2,require(_0x8d4e('0x1a')));_0x4208e2=_['merge'](_0x4208e2,require(_0x8d4e('0x1b')));_0x4208e2=_[_0x8d4e('0x4')](_0x4208e2,require(_0x8d4e('0x1c')));_0x4208e2=_['merge'](_0x4208e2,require(_0x8d4e('0x1d')));_0x4208e2=_[_0x8d4e('0x4')](_0x4208e2,require(_0x8d4e('0x1e')));_0x4208e2=_['merge'](_0x4208e2,require(_0x8d4e('0x1f')));_0x4208e2=_['merge'](_0x4208e2,require(_0x8d4e('0x20')));_0x4208e2=_[_0x8d4e('0x4')](_0x4208e2,require(_0x8d4e('0x21')));_0x4208e2=_['merge'](_0x4208e2,require('../api/chatQueue/chatQueue.rpc'));_0x4208e2=_[_0x8d4e('0x4')](_0x4208e2,require(_0x8d4e('0x22')));_0x4208e2=_[_0x8d4e('0x4')](_0x4208e2,require(_0x8d4e('0x23')));_0x4208e2=_[_0x8d4e('0x4')](_0x4208e2,require('../api/cmHopperBlack/cmHopperBlack.rpc'));_0x4208e2=_['merge'](_0x4208e2,require(_0x8d4e('0x24')));_0x4208e2=_[_0x8d4e('0x4')](_0x4208e2,require('../api/cmHopperHistory/cmHopperHistory.rpc'));_0x4208e2=_[_0x8d4e('0x4')](_0x4208e2,require(_0x8d4e('0x25')));_0x4208e2=_[_0x8d4e('0x4')](_0x4208e2,require(_0x8d4e('0x26')));_0x4208e2=_['merge'](_0x4208e2,require(_0x8d4e('0x27')));_0x4208e2=_['merge'](_0x4208e2,require(_0x8d4e('0x28')));_0x4208e2=_[_0x8d4e('0x4')](_0x4208e2,require('../api/cmHopperAdditionalPhone/cmHopperAdditionalPhone.rpc'));_0x4208e2=_[_0x8d4e('0x4')](_0x4208e2,require(_0x8d4e('0x29')));_0x4208e2=_['merge'](_0x4208e2,require(_0x8d4e('0x2a')));_0x4208e2=_[_0x8d4e('0x4')](_0x4208e2,require(_0x8d4e('0x2b')));_0x4208e2=_[_0x8d4e('0x4')](_0x4208e2,require(_0x8d4e('0x2c')));_0x4208e2=_[_0x8d4e('0x4')](_0x4208e2,require(_0x8d4e('0x2d')));_0x4208e2=_[_0x8d4e('0x4')](_0x4208e2,require(_0x8d4e('0x2e')));_0x4208e2=_['merge'](_0x4208e2,require(_0x8d4e('0x2f')));_0x4208e2=_[_0x8d4e('0x4')](_0x4208e2,require(_0x8d4e('0x30')));_0x4208e2=_['merge'](_0x4208e2,require(_0x8d4e('0x31')));_0x4208e2=_['merge'](_0x4208e2,require(_0x8d4e('0x32')));_0x4208e2=_[_0x8d4e('0x4')](_0x4208e2,require(_0x8d4e('0x33')));_0x4208e2=_[_0x8d4e('0x4')](_0x4208e2,require(_0x8d4e('0x34')));_0x4208e2=_[_0x8d4e('0x4')](_0x4208e2,require(_0x8d4e('0x35')));_0x4208e2=_['merge'](_0x4208e2,require(_0x8d4e('0x36')));_0x4208e2=_['merge'](_0x4208e2,require(_0x8d4e('0x37')));_0x4208e2=_['merge'](_0x4208e2,require('../api/squareReport/squareReport.rpc'));_0x4208e2=_[_0x8d4e('0x4')](_0x4208e2,require(_0x8d4e('0x38')));_0x4208e2=_[_0x8d4e('0x4')](_0x4208e2,require(_0x8d4e('0x39')));_0x4208e2=_[_0x8d4e('0x4')](_0x4208e2,require(_0x8d4e('0x3a')));_0x4208e2=_[_0x8d4e('0x4')](_0x4208e2,require('../api/squareProject/squareProject.rpc'));_0x4208e2=_[_0x8d4e('0x4')](_0x4208e2,require(_0x8d4e('0x3b')));_0x4208e2=_['merge'](_0x4208e2,require(_0x8d4e('0x3c')));_0x4208e2=_[_0x8d4e('0x4')](_0x4208e2,require(_0x8d4e('0x3d')));_0x4208e2=_[_0x8d4e('0x4')](_0x4208e2,require(_0x8d4e('0x3e')));_0x4208e2=_[_0x8d4e('0x4')](_0x4208e2,require(_0x8d4e('0x3f')));_0x4208e2=_[_0x8d4e('0x4')](_0x4208e2,require('../api/whatsappAccount/whatsappAccount.rpc'));_0x4208e2=_[_0x8d4e('0x4')](_0x4208e2,require(_0x8d4e('0x40')));_0x4208e2=_['merge'](_0x4208e2,require(_0x8d4e('0x41')));_0x4208e2=_['merge'](_0x4208e2,require(_0x8d4e('0x42')));_0x4208e2=_[_0x8d4e('0x4')](_0x4208e2,require(_0x8d4e('0x43')));var _0x1f7a22=jayson[_0x8d4e('0x44')](_0x4208e2)[_0x8d4e('0x45')]();var _0x14b612=config[_0x8d4e('0x46')][_0x8d4e('0x47')]||config[_0x8d4e('0x47')]+0x1;var _0x552b7a=config[_0x8d4e('0x46')]['ip']||_0x8d4e('0x48');_0x1f7a22['on'](_0x8d4e('0x49'),function(_0x3d2721){return _0x1caaa7(_0x3d2721);});_0x1f7a22[_0x8d4e('0x3')](_0x14b612,_0x552b7a,function(){console[_0x8d4e('0x4a')](_0x8d4e('0x4b'),_0x552b7a,_0x14b612);require(_0x8d4e('0x4c'))['default']();return _0x4c8a72('RPC\x20listening\x20on\x20'+_0x552b7a+':'+_0x14b612);});});}; \ No newline at end of file +var _0xbc74=['Express\x20RPC\x20server\x20listening\x20on\x20%s:%d!','../config/triggers','RPC\x20listening\x20on\x20','jayson/promise','lodash','../config/environment','merge','../api/voiceQueue/voiceQueue.rpc','../api/voiceRecording/voiceRecording.rpc','../api/voiceCallReport/voiceCallReport.rpc','../api/voiceDialReport/voiceDialReport.rpc','../api/voiceAgentReport/voiceAgentReport.rpc','../api/memberReport/memberReport.rpc','../api/mailServerIn/mailServerIn.rpc','../api/mailAccount/mailAccount.rpc','../api/mailQueue/mailQueue.rpc','../api/mailInteraction/mailInteraction.rpc','../api/mailApplication/mailApplication.rpc','../api/mailQueueReport/mailQueueReport.rpc','../api/faxApplication/faxApplication.rpc','../api/faxInteraction/faxInteraction.rpc','../api/faxMessage/faxMessage.rpc','../api/faxQueue/faxQueue.rpc','../api/faxQueueReport/faxQueueReport.rpc','../api/smsAccount/smsAccount.rpc','../api/smsQueue/smsQueue.rpc','../api/openchannelApplication/openchannelApplication.rpc','../api/openchannelInteraction/openchannelInteraction.rpc','../api/openchannelMessage/openchannelMessage.rpc','../api/openchannelQueue/openchannelQueue.rpc','../api/chatInteraction/chatInteraction.rpc','../api/chatMessage/chatMessage.rpc','../api/chatQueue/chatQueue.rpc','../api/cmContact/cmContact.rpc','../api/cmHopper/cmHopper.rpc','../api/cmHopperBlack/cmHopperBlack.rpc','../api/cmHopperHistory/cmHopperHistory.rpc','../api/interval/interval.rpc','../api/cmHopperAdditionalPhone/cmHopperAdditionalPhone.rpc','../api/trigger/trigger.rpc','../api/intSalesforceAccount/intSalesforceAccount.rpc','../api/intDeskAccount/intDeskAccount.rpc','../api/intZohoAccount/intZohoAccount.rpc','../api/intZendeskAccount/intZendeskAccount.rpc','../api/intFreshdeskAccount/intFreshdeskAccount.rpc','../api/intVtigerAccount/intVtigerAccount.rpc','../api/intServicenowAccount/intServicenowAccount.rpc','../api/intDynamics365Account/intDynamics365Account.rpc','../api/intFreshsalesAccount/intFreshsalesAccount.rpc','../api/chatQueueReport/chatQueueReport.rpc','../api/smsQueueReport/smsQueueReport.rpc','../api/squareReport/squareReport.rpc','../api/squareReportDetail/squareReportDetail.rpc','../api/setting/setting.rpc','../api/squareOdbc/squareOdbc.rpc','../api/squareProject/squareProject.rpc','../api/plugin/plugin.rpc','../api/whatsappAccount/whatsappAccount.rpc','../api/whatsappInteraction/whatsappInteraction.rpc','../api/whatsappMessage/whatsappMessage.rpc','../api/whatsappQueueReport/whatsappQueueReport.rpc','localhost','listen','log'];(function(_0x5f2fea,_0x9fde07){var _0x198a0c=function(_0x2bb11a){while(--_0x2bb11a){_0x5f2fea['push'](_0x5f2fea['shift']());}};_0x198a0c(++_0x9fde07);}(_0xbc74,0x1c3));var _0x4bc7=function(_0x4f9b18,_0x2cb5ca){_0x4f9b18=_0x4f9b18-0x0;var _0x29f20c=_0xbc74[_0x4f9b18];return _0x29f20c;};'use strict';var jayson=require(_0x4bc7('0x0'));var _=require(_0x4bc7('0x1'));var config=require(_0x4bc7('0x2'));exports['listen']=function(){return new Promise(function(_0x370c04,_0x3b7ba0){var _0xcadf47={};_0xcadf47=_[_0x4bc7('0x3')](_0xcadf47,require('../api/user/user.rpc'));_0xcadf47=_[_0x4bc7('0x3')](_0xcadf47,require('../api/voiceExtension/voiceExtension.rpc'));_0xcadf47=_['merge'](_0xcadf47,require(_0x4bc7('0x4')));_0xcadf47=_[_0x4bc7('0x3')](_0xcadf47,require(_0x4bc7('0x5')));_0xcadf47=_[_0x4bc7('0x3')](_0xcadf47,require(_0x4bc7('0x6')));_0xcadf47=_[_0x4bc7('0x3')](_0xcadf47,require(_0x4bc7('0x7')));_0xcadf47=_[_0x4bc7('0x3')](_0xcadf47,require(_0x4bc7('0x8')));_0xcadf47=_['merge'](_0xcadf47,require('../api/voiceQueueReport/voiceQueueReport.rpc'));_0xcadf47=_[_0x4bc7('0x3')](_0xcadf47,require(_0x4bc7('0x9')));_0xcadf47=_[_0x4bc7('0x3')](_0xcadf47,require('../api/trunk/trunk.rpc'));_0xcadf47=_[_0x4bc7('0x3')](_0xcadf47,require('../api/voiceTransferReport/voiceTransferReport.rpc'));_0xcadf47=_[_0x4bc7('0x3')](_0xcadf47,require('../api/userVoiceQueueRt/userVoiceQueueRt.rpc'));_0xcadf47=_[_0x4bc7('0x3')](_0xcadf47,require(_0x4bc7('0xa')));_0xcadf47=_['merge'](_0xcadf47,require(_0x4bc7('0xb')));_0xcadf47=_[_0x4bc7('0x3')](_0xcadf47,require(_0x4bc7('0xc')));_0xcadf47=_[_0x4bc7('0x3')](_0xcadf47,require(_0x4bc7('0xd')));_0xcadf47=_['merge'](_0xcadf47,require('../api/mailMessage/mailMessage.rpc'));_0xcadf47=_[_0x4bc7('0x3')](_0xcadf47,require(_0x4bc7('0xe')));_0xcadf47=_[_0x4bc7('0x3')](_0xcadf47,require(_0x4bc7('0xf')));_0xcadf47=_[_0x4bc7('0x3')](_0xcadf47,require('../api/faxAccount/faxAccount.rpc'));_0xcadf47=_[_0x4bc7('0x3')](_0xcadf47,require(_0x4bc7('0x10')));_0xcadf47=_[_0x4bc7('0x3')](_0xcadf47,require(_0x4bc7('0x11')));_0xcadf47=_[_0x4bc7('0x3')](_0xcadf47,require(_0x4bc7('0x12')));_0xcadf47=_[_0x4bc7('0x3')](_0xcadf47,require(_0x4bc7('0x13')));_0xcadf47=_[_0x4bc7('0x3')](_0xcadf47,require(_0x4bc7('0x14')));_0xcadf47=_[_0x4bc7('0x3')](_0xcadf47,require(_0x4bc7('0x15')));_0xcadf47=_[_0x4bc7('0x3')](_0xcadf47,require('../api/smsInteraction/smsInteraction.rpc'));_0xcadf47=_['merge'](_0xcadf47,require('../api/smsMessage/smsMessage.rpc'));_0xcadf47=_[_0x4bc7('0x3')](_0xcadf47,require(_0x4bc7('0x16')));_0xcadf47=_[_0x4bc7('0x3')](_0xcadf47,require(_0x4bc7('0x17')));_0xcadf47=_[_0x4bc7('0x3')](_0xcadf47,require(_0x4bc7('0x18')));_0xcadf47=_[_0x4bc7('0x3')](_0xcadf47,require(_0x4bc7('0x19')));_0xcadf47=_['merge'](_0xcadf47,require(_0x4bc7('0x1a')));_0xcadf47=_[_0x4bc7('0x3')](_0xcadf47,require('../api/openchannelQueueReport/openchannelQueueReport.rpc'));_0xcadf47=_['merge'](_0xcadf47,require(_0x4bc7('0x1b')));_0xcadf47=_[_0x4bc7('0x3')](_0xcadf47,require(_0x4bc7('0x1c')));_0xcadf47=_['merge'](_0xcadf47,require(_0x4bc7('0x1d')));_0xcadf47=_[_0x4bc7('0x3')](_0xcadf47,require(_0x4bc7('0x1e')));_0xcadf47=_['merge'](_0xcadf47,require(_0x4bc7('0x1f')));_0xcadf47=_[_0x4bc7('0x3')](_0xcadf47,require(_0x4bc7('0x20')));_0xcadf47=_[_0x4bc7('0x3')](_0xcadf47,require('../api/cmHopperFinal/cmHopperFinal.rpc'));_0xcadf47=_[_0x4bc7('0x3')](_0xcadf47,require(_0x4bc7('0x21')));_0xcadf47=_['merge'](_0xcadf47,require('../api/reportAgentPreview/reportAgentPreview.rpc'));_0xcadf47=_[_0x4bc7('0x3')](_0xcadf47,require(_0x4bc7('0x22')));_0xcadf47=_[_0x4bc7('0x3')](_0xcadf47,require('../api/pause/pause.rpc'));_0xcadf47=_[_0x4bc7('0x3')](_0xcadf47,require('../api/sound/sound.rpc'));_0xcadf47=_[_0x4bc7('0x3')](_0xcadf47,require(_0x4bc7('0x23')));_0xcadf47=_[_0x4bc7('0x3')](_0xcadf47,require('../api/template/template.rpc'));_0xcadf47=_[_0x4bc7('0x3')](_0xcadf47,require(_0x4bc7('0x24')));_0xcadf47=_[_0x4bc7('0x3')](_0xcadf47,require('../api/variable/variable.rpc'));_0xcadf47=_['merge'](_0xcadf47,require(_0x4bc7('0x25')));_0xcadf47=_[_0x4bc7('0x3')](_0xcadf47,require('../api/intSugarcrmAccount/intSugarcrmAccount.rpc'));_0xcadf47=_[_0x4bc7('0x3')](_0xcadf47,require(_0x4bc7('0x26')));_0xcadf47=_[_0x4bc7('0x3')](_0xcadf47,require(_0x4bc7('0x27')));_0xcadf47=_[_0x4bc7('0x3')](_0xcadf47,require(_0x4bc7('0x28')));_0xcadf47=_[_0x4bc7('0x3')](_0xcadf47,require(_0x4bc7('0x29')));_0xcadf47=_[_0x4bc7('0x3')](_0xcadf47,require(_0x4bc7('0x2a')));_0xcadf47=_[_0x4bc7('0x3')](_0xcadf47,require(_0x4bc7('0x2b')));_0xcadf47=_[_0x4bc7('0x3')](_0xcadf47,require(_0x4bc7('0x2c')));_0xcadf47=_[_0x4bc7('0x3')](_0xcadf47,require(_0x4bc7('0x2d')));_0xcadf47=_['merge'](_0xcadf47,require(_0x4bc7('0x2e')));_0xcadf47=_[_0x4bc7('0x3')](_0xcadf47,require(_0x4bc7('0x2f')));_0xcadf47=_[_0x4bc7('0x3')](_0xcadf47,require(_0x4bc7('0x30')));_0xcadf47=_[_0x4bc7('0x3')](_0xcadf47,require(_0x4bc7('0x31')));_0xcadf47=_[_0x4bc7('0x3')](_0xcadf47,require(_0x4bc7('0x32')));_0xcadf47=_[_0x4bc7('0x3')](_0xcadf47,require(_0x4bc7('0x33')));_0xcadf47=_['merge'](_0xcadf47,require(_0x4bc7('0x34')));_0xcadf47=_[_0x4bc7('0x3')](_0xcadf47,require('../api/squareRecording/squareRecording.rpc'));_0xcadf47=_[_0x4bc7('0x3')](_0xcadf47,require('../api/squareMessage/squareMessage.rpc'));_0xcadf47=_[_0x4bc7('0x3')](_0xcadf47,require('../api/campaign/campaign.rpc'));_0xcadf47=_['merge'](_0xcadf47,require('../api/attachment/attachment.rpc'));_0xcadf47=_[_0x4bc7('0x3')](_0xcadf47,require(_0x4bc7('0x35')));_0xcadf47=_[_0x4bc7('0x3')](_0xcadf47,require(_0x4bc7('0x36')));_0xcadf47=_[_0x4bc7('0x3')](_0xcadf47,require(_0x4bc7('0x37')));_0xcadf47=_[_0x4bc7('0x3')](_0xcadf47,require(_0x4bc7('0x38')));_0xcadf47=_['merge'](_0xcadf47,require(_0x4bc7('0x39')));_0xcadf47=_['merge'](_0xcadf47,require('../api/whatsappQueue/whatsappQueue.rpc'));var _0x10ee70=jayson['server'](_0xcadf47)['http']();var _0x4a4b74=config['rpc']['port']||config['port']+0x1;var _0x19e3e9=config['rpc']['ip']||_0x4bc7('0x3a');_0x10ee70['on']('error',function(_0x1f334c){return _0x3b7ba0(_0x1f334c);});_0x10ee70[_0x4bc7('0x3b')](_0x4a4b74,_0x19e3e9,function(){console[_0x4bc7('0x3c')](_0x4bc7('0x3d'),_0x19e3e9,_0x4a4b74);require(_0x4bc7('0x3e'))['default']();return _0x370c04(_0x4bc7('0x3f')+_0x19e3e9+':'+_0x4a4b74);});});}; \ No newline at end of file diff --git a/server/services/agi/channel.js b/server/services/agi/channel.js index b829cb8..29d7aa0 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 _0x0bcc=['setTimeout','headers','ready','line','toLowerCase','hangup','emit','substring','search','520\x20End\x20of\x20proper','function','no\x20code','replace','substr','indexOf','split','length','match','error','E_AGI_SOCKET_ERROR','code','close','E_AGI_SOCKET_CLOSE','timeout','E_AGI_SOCKET_TIMEOUT','destroy','pipe','command','write','inherits','prototype','sendRequest','sync','answer','ANSWER','beep','format','GET\x20DATA\x20\x22%s\x22\x20%s\x20%s','NO\x20MESSAGE','exec','EXEC\x20%s\x20%s','setExtension','SET\x20EXTENSION\x20%s','setPriority','SET\x20PRIORITY\x20%s','HANGUP','setVariable','isNumber','SET\x20VARIABLE\x20%s\x20\x22%s\x22','toString','sayNumber','SAY\x20NUMBER\x20%s\x20%s','sayDigits','SAY\x20DIGITS\x20%s\x20%s','continueAt','extension','setContext','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','noop','label','exports','EventEmitter','./reply','./error','call','setEncoding','utf8'];(function(_0x2b488c,_0x14067e){var _0x342338=function(_0x4104fd){while(--_0x4104fd){_0x2b488c['push'](_0x2b488c['shift']());}};_0x342338(++_0x14067e);}(_0x0bcc,0x1bc));var _0xc0bc=function(_0x2a416a,_0x2f0660){_0x2a416a=_0x2a416a-0x0;var _0x52bb59=_0x0bcc[_0x2a416a];return _0x52bb59;};'use strict';var util=require('util');var _=require('lodash');var EventEmitter=require('events')[_0xc0bc('0x0')];var AGIReply=require(_0xc0bc('0x1'));var AGIError=require(_0xc0bc('0x2'));function AGIChannel(_0x490896){var _0x513f43=this,_0x3416a5=new AGIReply(),_0x1e7f1c=![],_0x5d84a2={};EventEmitter[_0xc0bc('0x3')](_0x513f43);_0x490896[_0xc0bc('0x4')](_0xc0bc('0x5'));_0x490896[_0xc0bc('0x6')](0x8*0x3c*0x3c*0x3e8);_0x3416a5[_0xc0bc('0x4')](_0xc0bc('0x5'));_0x3416a5['on'](_0xc0bc('0x7'),function(_0x41c2ff){for(var _0x13ce4a in _0x41c2ff){_0x513f43[_0x13ce4a]=_0x41c2ff[_0x13ce4a];}_0x513f43['emit'](_0xc0bc('0x8'));});_0x3416a5['on'](_0xc0bc('0x9'),function(_0x3965de){if(_0x3965de[_0xc0bc('0xa')]()==_0xc0bc('0xb')){_0x513f43[_0xc0bc('0xc')]('hangup');return;}if(_0x3965de[_0xc0bc('0xd')](0x0,0xb)=='520-Invalid'){_0x1e7f1c=!![];}if(_0x1e7f1c){_0x5d84a2['rx']+=_0x3965de+'\x0a';if(_0x3965de[_0xc0bc('0xe')](_0xc0bc('0xf'))!=-0x1){_0x1e7f1c=![];}}else{_0x5d84a2['rx']=_0x3965de;}if(_0x1e7f1c){return;}if(typeof _0x5d84a2['cb']==_0xc0bc('0x10')){var _0x132618=_0x5d84a2['rx'][_0xc0bc('0xd')](0x0,0x3),_0x56fa53=null,_0x4d9e1c=null;_0x132618=parseInt(_0x132618);if(isNaN(_0x132618)){_0x5d84a2['cb'](null,{'code':0x1f4,'result':-0x1,'extra':_0xc0bc('0x11')});return;}if(_0x132618!=0xc8){_0x5d84a2['cb'](null,{'code':_0x132618,'result':-0x1,'extra':'KO'});return;}_0x56fa53=_0x5d84a2['rx']['substring'](0x4)[_0xc0bc('0x12')]('result=','');if(_0x56fa53['indexOf']('\x20')!=-0x1){_0x56fa53=_0x56fa53[_0xc0bc('0x13')](0x0,_0x56fa53[_0xc0bc('0x14')]('\x20'));}if(_['startsWith'](_0x56fa53,'-1')){_0x56fa53=parseInt(_0x56fa53);}_0x4d9e1c=_0x5d84a2['rx'][_0xc0bc('0x15')]('\x20');if(_0x4d9e1c[_0xc0bc('0x16')]==0x3){_0x4d9e1c=_0x4d9e1c[0x2][_0xc0bc('0xd')](0x1,_0x4d9e1c[0x2][_0xc0bc('0x16')]-0x1);}else if(_0x4d9e1c[_0xc0bc('0x16')]>0x3){var _0x2f756c=/\((.+)\)/;var _0xce067c=_0x5d84a2['rx'][_0xc0bc('0x17')](_0x2f756c);if(_0xce067c){_0x4d9e1c=_0xce067c[0x1];}else{_0x4d9e1c=null;}}else{_0x4d9e1c=null;}_0x5d84a2['cb'](null,{'code':_0x132618,'result':_0x56fa53,'extra':_0x4d9e1c});}});_0x490896['on'](_0xc0bc('0x18'),function(_0x56a0e3){_0x513f43[_0xc0bc('0xc')](_0xc0bc('0x18'),new AGIError(_0xc0bc('0x19'),_0x56a0e3[_0xc0bc('0x1a')]));});_0x490896['on'](_0xc0bc('0x1b'),function(){_0x513f43[_0xc0bc('0xc')](_0xc0bc('0x1b'),new AGIError(_0xc0bc('0x1c')));});_0x490896['on'](_0xc0bc('0x1d'),function(){_0x513f43[_0xc0bc('0xc')](_0xc0bc('0x1d'),new AGIError(_0xc0bc('0x1e')));_0x490896[_0xc0bc('0x1f')]();});_0x490896[_0xc0bc('0x20')](_0x3416a5);this[_0xc0bc('0x21')]=function(_0x6fc1c7,_0x5729a8){var _0x6fc1c7=_0x6fc1c7||'',_0x5729a8=typeof _0x5729a8==_0xc0bc('0x10')?_0x5729a8:new Function();_0x5d84a2={'tx':_0x6fc1c7,'rx':'','cb':_0x5729a8};_0x490896[_0xc0bc('0x22')](_0x6fc1c7+'\x0a');},this[_0xc0bc('0x1b')]=function(){_0x490896[_0xc0bc('0x1f')]();};}util[_0xc0bc('0x23')](AGIChannel,EventEmitter);AGIChannel[_0xc0bc('0x24')][_0xc0bc('0x25')]=function(_0x2ab7d3){return this['command'][_0xc0bc('0x26')](this,_0x2ab7d3);};AGIChannel[_0xc0bc('0x24')][_0xc0bc('0x27')]=function(){return this[_0xc0bc('0x25')](_0xc0bc('0x28'));};AGIChannel[_0xc0bc('0x24')]['getData']=function(_0x1e5759,_0x25ae07,_0xc28a91){_0x1e5759=_0x1e5759===undefined?_0xc0bc('0x29'):_0x1e5759;_0x25ae07=_0x25ae07===undefined?'5':_0x25ae07;_0xc28a91=_0xc28a91===undefined?'1':_0xc28a91;return this[_0xc0bc('0x25')](util[_0xc0bc('0x2a')](_0xc0bc('0x2b'),_0x1e5759,_0x25ae07*0x3e8,_0xc28a91));};AGIChannel[_0xc0bc('0x24')]['noop']=function(_0x5162e8){_0x5162e8=_0x5162e8||_0xc0bc('0x2c');return this[_0xc0bc('0x25')](util['format']('VERBOSE\x20\x22%s\x22',_0x5162e8));};AGIChannel[_0xc0bc('0x24')][_0xc0bc('0x2d')]=function(_0x5ee20d,_0x2921f1){if(_['isArray'](_0x2921f1)){return this['sendRequest'](util[_0xc0bc('0x2a')](_0xc0bc('0x2e'),_0x5ee20d,_0x2921f1['join'](',')));}return this[_0xc0bc('0x25')](util[_0xc0bc('0x2a')](_0xc0bc('0x2e'),_0x5ee20d,_0x2921f1));};AGIChannel[_0xc0bc('0x24')]['setContext']=function(_0x261647){return this['sendRequest'](util[_0xc0bc('0x2a')]('SET\x20CONTEXT\x20%s',_0x261647));};AGIChannel[_0xc0bc('0x24')][_0xc0bc('0x2f')]=function(_0x46e5b7){return this[_0xc0bc('0x25')](util[_0xc0bc('0x2a')](_0xc0bc('0x30'),_0x46e5b7));};AGIChannel[_0xc0bc('0x24')][_0xc0bc('0x31')]=function(_0x15d813){return this[_0xc0bc('0x25')](util[_0xc0bc('0x2a')](_0xc0bc('0x32'),_0x15d813));};AGIChannel[_0xc0bc('0x24')][_0xc0bc('0xb')]=function(){return this[_0xc0bc('0x25')](_0xc0bc('0x33'));};AGIChannel['prototype'][_0xc0bc('0x34')]=function(_0x3284e7,_0x520ddb){var _0x41c620=_['isBoolean'](_0x520ddb)||_[_0xc0bc('0x35')](_0x520ddb)?_0x520ddb['toString']():_0x520ddb;return this[_0xc0bc('0x25')](util[_0xc0bc('0x2a')](_0xc0bc('0x36'),_0x3284e7,_0x41c620?_0x41c620[_0xc0bc('0x37')]()[_0xc0bc('0x12')](/(\r\n|\n|\r)/gm,'\x20'):''));};AGIChannel[_0xc0bc('0x24')][_0xc0bc('0x38')]=function(_0x4a64a9,_0x2aae87){return this[_0xc0bc('0x25')](util[_0xc0bc('0x2a')](_0xc0bc('0x39'),_0x4a64a9,_0x2aae87));};AGIChannel['prototype'][_0xc0bc('0x3a')]=function(_0x1329f1,_0x100b81){return this[_0xc0bc('0x25')](util[_0xc0bc('0x2a')](_0xc0bc('0x3b'),_0x1329f1,_0x100b81));};AGIChannel[_0xc0bc('0x24')]['sayPhonetic']=function(_0x16082d,_0x3bbc83){return this[_0xc0bc('0x25')](util[_0xc0bc('0x2a')]('SAY\x20PHONETIC\x20\x22%s\x22\x20%s',_0x16082d,_0x3bbc83));};AGIChannel[_0xc0bc('0x24')][_0xc0bc('0x3c')]=function(_0x2487e5,_0x2bf2ae,_0x4ef9b5){_0x2bf2ae=_0x2bf2ae||this[_0xc0bc('0x3d')];_0x4ef9b5=_0x4ef9b5||0x1;this[_0xc0bc('0x3e')](_0x2487e5);this[_0xc0bc('0x2f')](_0x2bf2ae);this[_0xc0bc('0x31')](_0x4ef9b5);return this['noop'](util[_0xc0bc('0x2a')]('GOTO\x20%s\x20%s\x20%s',_0x2487e5,_0x2bf2ae,_0x4ef9b5));};AGIChannel[_0xc0bc('0x24')]['getVariable']=function(_0xf277d9){return this[_0xc0bc('0x25')](util['format'](_0xc0bc('0x3f'),_0xf277d9));};AGIChannel['prototype'][_0xc0bc('0x40')]=function(_0x341bd4,_0x3f0edf,_0x534d09,_0x4e5452,_0x2f917d,_0x3ad75f){_0x3f0edf=_0x3f0edf||_0xc0bc('0x41');_0x534d09=_0x534d09||'';_0x4e5452=_0x4e5452===undefined?-0x1:_0x4e5452==='-1'?-0x1:_0x4e5452*0x3e8;_0x2f917d=_0x2f917d===undefined?'':'s='+_0x2f917d;_0x3ad75f=_0x3ad75f?_0xc0bc('0x42'):'';return this['sendRequest'](util['format'](_0xc0bc('0x43'),_0x341bd4,_0x3f0edf,_0x534d09,_0x4e5452,_0x3ad75f,_0x2f917d));};AGIChannel[_0xc0bc('0x24')]['streamFile']=function(_0x217acd,_0x4f8c5b){_0x4f8c5b=_0x4f8c5b||'';return this[_0xc0bc('0x25')](util['format']('STREAM\x20FILE\x20\x22%s\x22\x20\x22%s\x22',_0x217acd,_0x4f8c5b));};AGIChannel['prototype'][_0xc0bc('0x44')]=function(_0x1f5483){return this[_0xc0bc('0x2d')](_0xc0bc('0x45'),_0x1f5483);};AGIChannel['prototype'][_0xc0bc('0x46')]=function(_0x161348){return this[_0xc0bc('0x2d')](_0xc0bc('0x47'),_0x161348);};AGIChannel['prototype']['error']=function(_0x5b4412,_0xaa044f){this[_0xc0bc('0x48')](util[_0xc0bc('0x2a')]('ID:%s\x20-\x20LABEL:\x20%s\x20-\x20MSG:\x20%s',_0x5b4412['id'],_0x5b4412[_0xc0bc('0x49')],_0xaa044f));return{'code':0x1f4,'result':'-1','extra':''};};module[_0xc0bc('0x4a')]=AGIChannel; \ No newline at end of file +var _0xf96b=['format','GET\x20DATA\x20\x22%s\x22\x20%s\x20%s','NO\x20MESSAGE','VERBOSE\x20\x22%s\x22','exec','EXEC\x20%s\x20%s','setContext','SET\x20CONTEXT\x20%s','setExtension','setPriority','SET\x20PRIORITY\x20%s','HANGUP','setVariable','isBoolean','isNumber','toString','sayNumber','SAY\x20DIGITS\x20%s\x20%s','sayPhonetic','SAY\x20PHONETIC\x20\x22%s\x22\x20%s','continueAt','extension','noop','getVariable','GET\x20VARIABLE\x20\x22%s\x22','wav','BEEP','RECORD\x20FILE\x20\x22%s\x22\x20\x22%s\x22\x20\x22%s\x22\x20%s\x20%s\x20%s','streamFile','STREAM\x20FILE\x20\x22%s\x22\x20\x22%s\x22','agi','AGI','ID:%s\x20-\x20LABEL:\x20%s\x20-\x20MSG:\x20%s','label','util','lodash','events','EventEmitter','./reply','./error','call','setEncoding','setTimeout','utf8','headers','emit','ready','line','toLowerCase','hangup','substring','520-Invalid','520\x20End\x20of\x20proper','function','no\x20code','replace','result=','substr','indexOf','startsWith','split','length','match','error','code','close','E_AGI_SOCKET_CLOSE','timeout','E_AGI_SOCKET_TIMEOUT','pipe','command','write','inherits','prototype','sync','sendRequest','getData'];(function(_0x1ada8b,_0x2b4817){var _0x5ca2e7=function(_0x72b2f){while(--_0x72b2f){_0x1ada8b['push'](_0x1ada8b['shift']());}};_0x5ca2e7(++_0x2b4817);}(_0xf96b,0x109));var _0xbf96=function(_0x467099,_0x3b4305){_0x467099=_0x467099-0x0;var _0x109e03=_0xf96b[_0x467099];return _0x109e03;};'use strict';var util=require(_0xbf96('0x0'));var _=require(_0xbf96('0x1'));var EventEmitter=require(_0xbf96('0x2'))[_0xbf96('0x3')];var AGIReply=require(_0xbf96('0x4'));var AGIError=require(_0xbf96('0x5'));function AGIChannel(_0x440d4e){var _0x25c3d7=this,_0x42be7e=new AGIReply(),_0x38565=![],_0xab8e7={};EventEmitter[_0xbf96('0x6')](_0x25c3d7);_0x440d4e[_0xbf96('0x7')]('utf8');_0x440d4e[_0xbf96('0x8')](0x8*0x3c*0x3c*0x3e8);_0x42be7e[_0xbf96('0x7')](_0xbf96('0x9'));_0x42be7e['on'](_0xbf96('0xa'),function(_0x56d77d){for(var _0x337087 in _0x56d77d){_0x25c3d7[_0x337087]=_0x56d77d[_0x337087];}_0x25c3d7[_0xbf96('0xb')](_0xbf96('0xc'));});_0x42be7e['on'](_0xbf96('0xd'),function(_0x10440d){if(_0x10440d[_0xbf96('0xe')]()==_0xbf96('0xf')){_0x25c3d7[_0xbf96('0xb')]('hangup');return;}if(_0x10440d[_0xbf96('0x10')](0x0,0xb)==_0xbf96('0x11')){_0x38565=!![];}if(_0x38565){_0xab8e7['rx']+=_0x10440d+'\x0a';if(_0x10440d['search'](_0xbf96('0x12'))!=-0x1){_0x38565=![];}}else{_0xab8e7['rx']=_0x10440d;}if(_0x38565){return;}if(typeof _0xab8e7['cb']==_0xbf96('0x13')){var _0x17115d=_0xab8e7['rx'][_0xbf96('0x10')](0x0,0x3),_0x48a709=null,_0xafd96c=null;_0x17115d=parseInt(_0x17115d);if(isNaN(_0x17115d)){_0xab8e7['cb'](null,{'code':0x1f4,'result':-0x1,'extra':_0xbf96('0x14')});return;}if(_0x17115d!=0xc8){_0xab8e7['cb'](null,{'code':_0x17115d,'result':-0x1,'extra':'KO'});return;}_0x48a709=_0xab8e7['rx'][_0xbf96('0x10')](0x4)[_0xbf96('0x15')](_0xbf96('0x16'),'');if(_0x48a709['indexOf']('\x20')!=-0x1){_0x48a709=_0x48a709[_0xbf96('0x17')](0x0,_0x48a709[_0xbf96('0x18')]('\x20'));}if(_[_0xbf96('0x19')](_0x48a709,'-1')){_0x48a709=parseInt(_0x48a709);}_0xafd96c=_0xab8e7['rx'][_0xbf96('0x1a')]('\x20');if(_0xafd96c[_0xbf96('0x1b')]==0x3){_0xafd96c=_0xafd96c[0x2][_0xbf96('0x10')](0x1,_0xafd96c[0x2][_0xbf96('0x1b')]-0x1);}else if(_0xafd96c['length']>0x3){var _0x3296a7=/\((.+)\)/;var _0x55428f=_0xab8e7['rx'][_0xbf96('0x1c')](_0x3296a7);if(_0x55428f){_0xafd96c=_0x55428f[0x1];}else{_0xafd96c=null;}}else{_0xafd96c=null;}_0xab8e7['cb'](null,{'code':_0x17115d,'result':_0x48a709,'extra':_0xafd96c});}});_0x440d4e['on'](_0xbf96('0x1d'),function(_0x568425){_0x25c3d7[_0xbf96('0xb')](_0xbf96('0x1d'),new AGIError('E_AGI_SOCKET_ERROR',_0x568425[_0xbf96('0x1e')]));});_0x440d4e['on'](_0xbf96('0x1f'),function(){_0x25c3d7[_0xbf96('0xb')](_0xbf96('0x1f'),new AGIError(_0xbf96('0x20')));});_0x440d4e['on'](_0xbf96('0x21'),function(){_0x25c3d7[_0xbf96('0xb')]('timeout',new AGIError(_0xbf96('0x22')));_0x440d4e['destroy']();});_0x440d4e[_0xbf96('0x23')](_0x42be7e);this[_0xbf96('0x24')]=function(_0x11bd93,_0x4c65ae){var _0x11bd93=_0x11bd93||'',_0x4c65ae=typeof _0x4c65ae==_0xbf96('0x13')?_0x4c65ae:new Function();_0xab8e7={'tx':_0x11bd93,'rx':'','cb':_0x4c65ae};_0x440d4e[_0xbf96('0x25')](_0x11bd93+'\x0a');},this[_0xbf96('0x1f')]=function(){_0x440d4e['destroy']();};}util[_0xbf96('0x26')](AGIChannel,EventEmitter);AGIChannel[_0xbf96('0x27')]['sendRequest']=function(_0x496cef){return this[_0xbf96('0x24')][_0xbf96('0x28')](this,_0x496cef);};AGIChannel[_0xbf96('0x27')]['answer']=function(){return this[_0xbf96('0x29')]('ANSWER');};AGIChannel['prototype'][_0xbf96('0x2a')]=function(_0x30f345,_0x1e4c4f,_0x40b6fb){_0x30f345=_0x30f345===undefined?'beep':_0x30f345;_0x1e4c4f=_0x1e4c4f===undefined?'5':_0x1e4c4f;_0x40b6fb=_0x40b6fb===undefined?'1':_0x40b6fb;return this[_0xbf96('0x29')](util[_0xbf96('0x2b')](_0xbf96('0x2c'),_0x30f345,_0x1e4c4f*0x3e8,_0x40b6fb));};AGIChannel[_0xbf96('0x27')]['noop']=function(_0x59edc6){_0x59edc6=_0x59edc6||_0xbf96('0x2d');return this[_0xbf96('0x29')](util[_0xbf96('0x2b')](_0xbf96('0x2e'),_0x59edc6));};AGIChannel[_0xbf96('0x27')][_0xbf96('0x2f')]=function(_0x1dfa13,_0x2764e0){if(_['isArray'](_0x2764e0)){return this[_0xbf96('0x29')](util[_0xbf96('0x2b')](_0xbf96('0x30'),_0x1dfa13,_0x2764e0['join'](',')));}return this['sendRequest'](util[_0xbf96('0x2b')]('EXEC\x20%s\x20%s',_0x1dfa13,_0x2764e0));};AGIChannel[_0xbf96('0x27')][_0xbf96('0x31')]=function(_0x41e2b3){return this[_0xbf96('0x29')](util[_0xbf96('0x2b')](_0xbf96('0x32'),_0x41e2b3));};AGIChannel[_0xbf96('0x27')][_0xbf96('0x33')]=function(_0x37a1c0){return this['sendRequest'](util[_0xbf96('0x2b')]('SET\x20EXTENSION\x20%s',_0x37a1c0));};AGIChannel[_0xbf96('0x27')][_0xbf96('0x34')]=function(_0x251510){return this['sendRequest'](util[_0xbf96('0x2b')](_0xbf96('0x35'),_0x251510));};AGIChannel[_0xbf96('0x27')][_0xbf96('0xf')]=function(){return this[_0xbf96('0x29')](_0xbf96('0x36'));};AGIChannel[_0xbf96('0x27')][_0xbf96('0x37')]=function(_0x4f360d,_0x1109b8){var _0x53a3ee=_[_0xbf96('0x38')](_0x1109b8)||_[_0xbf96('0x39')](_0x1109b8)?_0x1109b8[_0xbf96('0x3a')]():_0x1109b8;return this[_0xbf96('0x29')](util[_0xbf96('0x2b')]('SET\x20VARIABLE\x20%s\x20\x22%s\x22',_0x4f360d,_0x53a3ee?_0x53a3ee[_0xbf96('0x3a')]()['replace'](/(\r\n|\n|\r)/gm,'\x20'):''));};AGIChannel[_0xbf96('0x27')][_0xbf96('0x3b')]=function(_0x44adfa,_0xdb1713){return this[_0xbf96('0x29')](util[_0xbf96('0x2b')]('SAY\x20NUMBER\x20%s\x20%s',_0x44adfa,_0xdb1713));};AGIChannel[_0xbf96('0x27')]['sayDigits']=function(_0x2f367e,_0x3db5f7){return this[_0xbf96('0x29')](util['format'](_0xbf96('0x3c'),_0x2f367e,_0x3db5f7));};AGIChannel[_0xbf96('0x27')][_0xbf96('0x3d')]=function(_0x4caef2,_0x1b84ad){return this[_0xbf96('0x29')](util[_0xbf96('0x2b')](_0xbf96('0x3e'),_0x4caef2,_0x1b84ad));};AGIChannel[_0xbf96('0x27')][_0xbf96('0x3f')]=function(_0x3835e9,_0x519994,_0x6be4f3){_0x519994=_0x519994||this[_0xbf96('0x40')];_0x6be4f3=_0x6be4f3||0x1;this['setContext'](_0x3835e9);this[_0xbf96('0x33')](_0x519994);this[_0xbf96('0x34')](_0x6be4f3);return this[_0xbf96('0x41')](util[_0xbf96('0x2b')]('GOTO\x20%s\x20%s\x20%s',_0x3835e9,_0x519994,_0x6be4f3));};AGIChannel[_0xbf96('0x27')][_0xbf96('0x42')]=function(_0x1a39d1){return this[_0xbf96('0x29')](util[_0xbf96('0x2b')](_0xbf96('0x43'),_0x1a39d1));};AGIChannel['prototype']['recordFile']=function(_0x3a59da,_0x1c16c0,_0xa66257,_0x52cfad,_0x24e023,_0x1a453c){_0x1c16c0=_0x1c16c0||_0xbf96('0x44');_0xa66257=_0xa66257||'';_0x52cfad=_0x52cfad===undefined?-0x1:_0x52cfad==='-1'?-0x1:_0x52cfad*0x3e8;_0x24e023=_0x24e023===undefined?'':'s='+_0x24e023;_0x1a453c=_0x1a453c?_0xbf96('0x45'):'';return this[_0xbf96('0x29')](util[_0xbf96('0x2b')](_0xbf96('0x46'),_0x3a59da,_0x1c16c0,_0xa66257,_0x52cfad,_0x1a453c,_0x24e023));};AGIChannel[_0xbf96('0x27')][_0xbf96('0x47')]=function(_0x5b41f1,_0x2089e2){_0x2089e2=_0x2089e2||'';return this['sendRequest'](util['format'](_0xbf96('0x48'),_0x5b41f1,_0x2089e2));};AGIChannel['prototype'][_0xbf96('0x49')]=function(_0x5b8d10){return this[_0xbf96('0x2f')](_0xbf96('0x4a'),_0x5b8d10);};AGIChannel[_0xbf96('0x27')]['wait']=function(_0x1e97b0){return this[_0xbf96('0x2f')]('WAIT',_0x1e97b0);};AGIChannel[_0xbf96('0x27')]['error']=function(_0x296292,_0xa852de){this[_0xbf96('0x41')](util[_0xbf96('0x2b')](_0xbf96('0x4b'),_0x296292['id'],_0x296292[_0xbf96('0x4c')],_0xa852de));return{'code':0x1f4,'result':'-1','extra':''};};module['exports']=AGIChannel; \ No newline at end of file diff --git a/server/services/agi/error.js b/server/services/agi/error.js index f4b9aa1..08db8a0 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 _0x08a3=['Empty\x20command.','Missing\x20\x27ivr.agi_network_script\x27.','Missing\x20\x27ivr.entry\x27\x20menu.','E_AGI_UNDEFINED','push','apply','message','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\x20closed.','Socket\x20timeout.'];(function(_0x2a9234,_0x56dadd){var _0x2b866c=function(_0x2ba3a6){while(--_0x2ba3a6){_0x2a9234['push'](_0x2a9234['shift']());}};_0x2b866c(++_0x56dadd);}(_0x08a3,0x12a));var _0x308a=function(_0x48394f,_0x5e432e){_0x48394f=_0x48394f-0x0;var _0x217cff=_0x08a3[_0x48394f];return _0x217cff;};'use strict';var util=require(_0x308a('0x0'));var error={'E_AGI_UNDEFINED':_0x308a('0x1'),'E_AGI_ARGUMENT_PORT':_0x308a('0x2'),'E_AGI_SERVER_ERROR':_0x308a('0x3'),'E_AGI_SERVER_CLOSE':'Server\x20closed.','E_AGI_SERVER_MAXCONNECTION':_0x308a('0x4'),'E_AGI_SERVER_VOICE_DISABLED':_0x308a('0x5'),'E_AGI_SOCKET_ERROR':'Socket\x20error.\x20Code:\x20%s.','E_AGI_SOCKET_CLOSE':_0x308a('0x6'),'E_AGI_SOCKET_TIMEOUT':_0x308a('0x7'),'E_AGI_COMMAND_EMPTY':_0x308a('0x8'),'E_AGI_IVR_AGI_NETWORK_SCRIPT':_0x308a('0x9'),'E_AGI_IVR_ENTRY':_0x308a('0xa')};function AGIError(_0x2efb01){var _0x2efb01=_0x2efb01||null,_0x31a8b7=_0x31a8b7||[],_0x106699=0x1,_0x256f7b='';if(!error[_0x2efb01]){_0x2efb01=_0x308a('0xb');}_0x31a8b7[_0x308a('0xc')](error[_0x2efb01]);while(arguments[_0x106699]){_0x31a8b7[_0x308a('0xc')](arguments[_0x106699]);_0x106699++;}_0x256f7b=util['format'][_0x308a('0xd')](util,_0x31a8b7);this[_0x308a('0xe')]=_0x256f7b;this[_0x308a('0xf')]=_0x2efb01;}module[_0x308a('0x10')]=AGIError; \ No newline at end of file +var _0x1470=['Missing\x20\x27ivr.agi_network_script\x27.','Missing\x20\x27ivr.entry\x27\x20menu.','E_AGI_UNDEFINED','push','format','util','Undefined\x20error.','Argument\x20\x27port\x27\x20missing\x20in\x20function\x20call.','Server\x20error.\x20Code:\x20%s.','Server\x20closed.','[LICENSE]\x20Server\x20max\x20connection.\x20Count:\x20%s.','[LICENSE\x20VOICE]\x20Server\x20license\x20voice\x20disabled.','Socket\x20error.\x20Code:\x20%s.','Socket\x20closed.'];(function(_0x4607e1,_0x596f78){var _0x22f1b2=function(_0x122dcc){while(--_0x122dcc){_0x4607e1['push'](_0x4607e1['shift']());}};_0x22f1b2(++_0x596f78);}(_0x1470,0x171));var _0x0147=function(_0x2d7f04,_0x50e80c){_0x2d7f04=_0x2d7f04-0x0;var _0x36d3e8=_0x1470[_0x2d7f04];return _0x36d3e8;};'use strict';var util=require(_0x0147('0x0'));var error={'E_AGI_UNDEFINED':_0x0147('0x1'),'E_AGI_ARGUMENT_PORT':_0x0147('0x2'),'E_AGI_SERVER_ERROR':_0x0147('0x3'),'E_AGI_SERVER_CLOSE':_0x0147('0x4'),'E_AGI_SERVER_MAXCONNECTION':_0x0147('0x5'),'E_AGI_SERVER_VOICE_DISABLED':_0x0147('0x6'),'E_AGI_SOCKET_ERROR':_0x0147('0x7'),'E_AGI_SOCKET_CLOSE':_0x0147('0x8'),'E_AGI_SOCKET_TIMEOUT':'Socket\x20timeout.','E_AGI_COMMAND_EMPTY':'Empty\x20command.','E_AGI_IVR_AGI_NETWORK_SCRIPT':_0x0147('0x9'),'E_AGI_IVR_ENTRY':_0x0147('0xa')};function AGIError(_0x2a97b5){var _0x2a97b5=_0x2a97b5||null,_0x262052=_0x262052||[],_0x727c21=0x1,_0x2a69e1='';if(!error[_0x2a97b5]){_0x2a97b5=_0x0147('0xb');}_0x262052[_0x0147('0xc')](error[_0x2a97b5]);while(arguments[_0x727c21]){_0x262052[_0x0147('0xc')](arguments[_0x727c21]);_0x727c21++;}_0x2a69e1=util[_0x0147('0xd')]['apply'](util,_0x262052);this['message']=_0x2a69e1;this['name']=_0x2a97b5;}module['exports']=AGIError; \ No newline at end of file diff --git a/server/services/agi/events.js b/server/services/agi/events.js index 8c3f7d1..c5a76ce 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 _0xf4b0=['defaults','subscribe','agi','emit','error','E_AGI_SERVER_ERROR','message','parse','projectUpdate','exports','lodash','events','EventEmitter','ioredis','../../config/environment','redis'];(function(_0x145f84,_0x15ef38){var _0x2d4a88=function(_0x4069de){while(--_0x4069de){_0x145f84['push'](_0x145f84['shift']());}};_0x2d4a88(++_0x15ef38);}(_0xf4b0,0x17a));var _0x0f4b=function(_0x160d71,_0x2ef6a9){_0x160d71=_0x160d71-0x0;var _0x422cb4=_0xf4b0[_0x160d71];return _0x422cb4;};'use strict';var _=require(_0x0f4b('0x0'));var EventEmitter=require(_0x0f4b('0x1'))[_0x0f4b('0x2')];var Redis=require(_0x0f4b('0x3'));var AGIError=require('./error');var config=require(_0x0f4b('0x4'));config[_0x0f4b('0x5')]=_[_0x0f4b('0x6')](config[_0x0f4b('0x5')],{'host':'localhost','port':0x18eb});var eventEmitter=new EventEmitter();var sub=new Redis(config['redis']);sub[_0x0f4b('0x7')](_0x0f4b('0x8'),function(_0x76c616){if(_0x76c616)return eventEmitter[_0x0f4b('0x9')](_0x0f4b('0xa'),new AGIError(_0x0f4b('0xb'),_0x76c616));});sub['on'](_0x0f4b('0xc'),function(_0x1f3257,_0x17499f){if(_0x1f3257!=='agi')return;try{var _0x1705b4=JSON[_0x0f4b('0xd')](_0x17499f);eventEmitter['emit'](_0x0f4b('0xe'),_0x1705b4);}catch(_0xb26fb8){eventEmitter[_0x0f4b('0x9')](_0x0f4b('0xa'),new AGIError(_0x0f4b('0xb'),_0xb26fb8));}});module[_0x0f4b('0xf')]={'EventEmitter':eventEmitter}; \ No newline at end of file +var _0x7192=['redis','localhost','error','E_AGI_SERVER_ERROR','message','parse','emit','projectUpdate','lodash','EventEmitter','ioredis','./error','../../config/environment'];(function(_0x3a8538,_0x378463){var _0x2bc616=function(_0x428084){while(--_0x428084){_0x3a8538['push'](_0x3a8538['shift']());}};_0x2bc616(++_0x378463);}(_0x7192,0xf2));var _0x2719=function(_0x14f75f,_0x4e53f9){_0x14f75f=_0x14f75f-0x0;var _0x236349=_0x7192[_0x14f75f];return _0x236349;};'use strict';var _=require(_0x2719('0x0'));var EventEmitter=require('events')[_0x2719('0x1')];var Redis=require(_0x2719('0x2'));var AGIError=require(_0x2719('0x3'));var config=require(_0x2719('0x4'));config[_0x2719('0x5')]=_['defaults'](config[_0x2719('0x5')],{'host':_0x2719('0x6'),'port':0x18eb});var eventEmitter=new EventEmitter();var sub=new Redis(config[_0x2719('0x5')]);sub['subscribe']('agi',function(_0x2bb1c1){if(_0x2bb1c1)return eventEmitter['emit'](_0x2719('0x7'),new AGIError(_0x2719('0x8'),_0x2bb1c1));});sub['on'](_0x2719('0x9'),function(_0x16e2b9,_0x33c87a){if(_0x16e2b9!=='agi')return;try{var _0xfa11f4=JSON[_0x2719('0xa')](_0x33c87a);eventEmitter[_0x2719('0xb')](_0x2719('0xc'),_0xfa11f4);}catch(_0x336da2){eventEmitter[_0x2719('0xb')]('error',new AGIError(_0x2719('0x8'),_0x336da2));}});module['exports']={'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 be52179..77a7e1b 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 _0x0135=['../../../config/logger','menu','vertices','edges','prototype','addEdge','push','size','numberOfEdges','getVertex','info','no\x20vertex\x20found','stop\x20traverse','length','no\x20edge/s\x20available','condition','agicommand','default','target','invalid','traverseBFS','vswitch','condition\x20not\x20found','exports','lodash'];(function(_0x58cf89,_0xf2cfdb){var _0xf1d095=function(_0x2b6dbe){while(--_0x2b6dbe){_0x58cf89['push'](_0x58cf89['shift']());}};_0xf1d095(++_0xf2cfdb);}(_0x0135,0x15d));var _0x5013=function(_0x596713,_0x43ded9){_0x596713=_0x596713-0x0;var _0x1a6c3e=_0x0135[_0x596713];return _0x1a6c3e;};'use strict';var _=require(_0x5013('0x0'));var logger=require(_0x5013('0x1'))('agi');var verticesWithRetry=[_0x5013('0x2'),'getdigits','getsecretdigits'];var Graph=function(){this[_0x5013('0x3')]={};this[_0x5013('0x4')]={};this['numberOfEdges']=0x0;};Graph[_0x5013('0x5')]['addVertex']=function(_0x17e7f3){this[_0x5013('0x3')][_0x17e7f3['id']]=_0x17e7f3;this['edges'][_0x17e7f3['id']]=[];};Graph[_0x5013('0x5')][_0x5013('0x6')]=function(_0x1f1236,_0x1863a6,_0x3e84a7){this['edges'][_0x1f1236][_0x5013('0x7')]({'target':_0x1863a6,'condition':_0x3e84a7});this['numberOfEdges']+=0x1;};Graph[_0x5013('0x5')][_0x5013('0x8')]=function(){return _['size'](this[_0x5013('0x3')]);};Graph[_0x5013('0x5')]['relations']=function(){return this[_0x5013('0x9')];};Graph[_0x5013('0x5')][_0x5013('0xa')]=function(_0x1ed153){return this[_0x5013('0x3')][_0x1ed153];};Graph[_0x5013('0x5')]['traverseBFS']=function(_0x163546,_0x10d120){if(!this[_0x5013('0x3')][_0x163546]){return logger[_0x5013('0xb')](_0x5013('0xc'));}var _0x587b7d=_0x10d120(this[_0x5013('0x3')][_0x163546]);if(!_0x587b7d){return logger['info'](_0x5013('0xd'));}if(this[_0x5013('0x4')][_0x163546][_0x5013('0xe')]===0x0){return logger['info'](_0x5013('0xf'));}for(var _0x167c1b=0x0,_0x413940=[],_0xbb7339=![];_0x167c1b\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','createSquareReport','catch','agi_','substring','debug','variables','stringify','[START]\x20%s\x20project:\x20from\x20\x22%s\x22\x20<%s>\x20to\x20extension\x20%s\x20with\x20uniqueid\x20%s','timeout','hangup','find','handleNotFound','handleUnpublished','initialize','getLicense','then','voice','callysquare','[LICENSE]\x20CHANNELS:\x20%s','finally','./server','listening','connection','close','lodash','syncho'];(function(_0x3dd15e,_0x1f0015){var _0x231fd0=function(_0x4f680a){while(--_0x4f680a){_0x3dd15e['push'](_0x3dd15e['shift']());}};_0x231fd0(++_0x1f0015);}(_0x963f,0x12a));var _0xf963=function(_0x5c73f1,_0x36a15d){_0x5c73f1=_0x5c73f1-0x0;var _0x28ba81=_0x963f[_0x5c73f1];return _0x28ba81;};'use strict';var _=require(_0xf963('0x0'));var syncho=require(_0xf963('0x1'));var util=require('util');var config=require(_0xf963('0x2'));var logger=require('../../config/logger')(_0xf963('0x3'));var utilLicense=require(_0xf963('0x4'));var rpc=require(_0xf963('0x5'));var Project=require('./project');var AGIEmitter=require('./events')[_0xf963('0x6')];var projects=[];config['agi']=_[_0xf963('0x7')](config[_0xf963('0x3')],{'ip':_0xf963('0x8'),'port':0x11dd});AGIEmitter['on'](_0xf963('0x9'),projectUpdateHandler);function connectionHandler(_0x29e819){process[_0xf963('0xa')](function(){syncho(function(){try{setChannelVariables(_0x29e819);agiHandler(_0x29e819);}catch(_0x5bcd18){logger[_0xf963('0xb')](_0x5bcd18[_0xf963('0xc')]);}});});}function projectUpdateHandler(_0x3fbe5b){try{var _0x364f74=_[_0xf963('0xd')](projects,['id',_0x3fbe5b['id']]);if(_0x364f74>-0x1){if(_0x3fbe5b[_0xf963('0xe')]===!![]){projects[_0xf963('0xf')](_0x364f74,0x1);}else{projects[_0x364f74]=_0x3fbe5b;}}else{projects['push'](_0x3fbe5b);}}catch(_0x53cb9f){logger[_0xf963('0xb')](_0x53cb9f[_0xf963('0xc')]);}}function listeningHandler(){var _0x28a19b=config[_0xf963('0x10')]===_0xf963('0x11')||![];console[_0xf963('0x12')](_0xf963('0x13'),config['agi'][_0xf963('0x14')]);logger[_0xf963('0x15')](util[_0xf963('0x16')](_0xf963('0x17'),_0x28a19b?config['agi']['ip']:_0xf963('0x18'),config[_0xf963('0x3')][_0xf963('0x14')]));}function errorHandler(_0x32d824){if(_0x32d824&&_0x32d824[_0xf963('0x19')]&&_0x32d824[_0xf963('0x1a')]){logger[_0xf963('0xb')](util[_0xf963('0x16')]('[%s]\x20%s',_0x32d824['name'],_0x32d824[_0xf963('0x1a')]));}else{logger[_0xf963('0xb')](util[_0xf963('0x16')]('[ERROR]\x20%s',_0x32d824[_0xf963('0xc')]));}}function closeHandler(){logger[_0xf963('0x15')](util['format'](_0xf963('0x1b'),this[_0xf963('0x1c')],this[_0xf963('0x1d')],this[_0xf963('0x1e')],this[_0xf963('0x1f')],this['uniqueid']));try{createSquareReport(this);}catch(_0x40e91e){logger[_0xf963('0xb')](_0x40e91e[_0xf963('0xc')]);}}function timeoutHandler(){logger[_0xf963('0x15')](util[_0xf963('0x16')](_0xf963('0x20'),this[_0xf963('0x1c')],this[_0xf963('0x1d')],this[_0xf963('0x1e')],this['dnid'],this[_0xf963('0x21')]));}function hangupHandler(){logger[_0xf963('0x15')](util['format'](_0xf963('0x22'),this['arg_1'],this['calleridname'],this['callerid'],this['dnid'],this[_0xf963('0x21')]));this[_0xf963('0x23')]=!![];}function createSquareReport(_0x56e55f,_0x4ae20a){rpc[_0xf963('0x24')](_0x56e55f)['then'](function(_0x5ebbed){if(_0x4ae20a){_0x4ae20a(null,_0x5ebbed);}})[_0xf963('0x25')](function(_0x50394e){if(_0x4ae20a){_0x4ae20a(null,_0x50394e);}});}function setChannelVariables(_0x5beda4){for(var _0x2f9055 in _0x5beda4){if(_0x5beda4['hasOwnProperty'](_0x2f9055)){if(_0x2f9055['indexOf'](_0xf963('0x26'))===0x0){_0x5beda4[_0x2f9055[_0xf963('0x27')](0x4)]=_0x5beda4[_0x2f9055];delete _0x5beda4[_0x2f9055];}}}}function agiHandler(_0x5ae69c){logger[_0xf963('0x28')](_0xf963('0x29'),JSON[_0xf963('0x2a')](_0x5ae69c,null,0x2));logger[_0xf963('0x15')](util[_0xf963('0x16')](_0xf963('0x2b'),_0x5ae69c[_0xf963('0x1c')],_0x5ae69c[_0xf963('0x1d')],_0x5ae69c[_0xf963('0x1e')],_0x5ae69c[_0xf963('0x1f')],_0x5ae69c[_0xf963('0x21')]));_0x5ae69c['on'](_0xf963('0xb'),errorHandler);_0x5ae69c['on']('close',closeHandler);_0x5ae69c['on'](_0xf963('0x2c'),timeoutHandler);_0x5ae69c[_0xf963('0x23')]=![];_0x5ae69c['on'](_0xf963('0x2d'),hangupHandler);var _0x1dbcc8=_[_0xf963('0x2e')](projects,[_0xf963('0x19'),_0x5ae69c[_0xf963('0x1c')]]);if(!_0x1dbcc8)return Project[_0xf963('0x2f')](_0x5ae69c);if(!_0x1dbcc8[_0xf963('0x11')])return Project[_0xf963('0x30')](_0x5ae69c);return Project[_0xf963('0x31')](_0x1dbcc8,_0x5ae69c);}function main(){var _0x64d210;return utilLicense[_0xf963('0x32')]()[_0xf963('0x33')](function(_0x16e52f){if(!_0x16e52f)return;if(_0x16e52f[_0xf963('0x34')]){if(_0x16e52f[_0xf963('0x35')]&&_0x16e52f[_0xf963('0x35')]>0x0){logger['info'](util['format'](_0xf963('0x36'),_0x16e52f[_0xf963('0x35')]));_0x64d210=_0x16e52f[_0xf963('0x35')];}else{logger['info']('[LICENSE]\x20CHANNELS:\x20UNLIMITED');}}else{logger['info']('[LICENSE]\x20VOICE\x20IS\x20DISABLED');_0x64d210=-0x1;}})['then'](function(){return Project['getAll']();})[_0xf963('0x33')](function(_0x397eb6){projects=_0x397eb6;return;})['catch'](function(_0xec6233){logger[_0xf963('0xb')]('[LICENSE]',_0xec6233[_0xf963('0xc')]);})[_0xf963('0x37')](function(){var _0x2c486f=require(_0xf963('0x38'))(config[_0xf963('0x3')]['port'],config[_0xf963('0x3')]['ip'],_0x64d210);_0x2c486f['on']('error',errorHandler);_0x2c486f['on'](_0xf963('0x39'),listeningHandler);_0x2c486f['on'](_0xf963('0x3a'),connectionHandler);_0x2c486f['on'](_0xf963('0x3b'),closeHandler);});}main(); \ No newline at end of file +var _0x0c25=['./project','./events','EventEmitter','127.0.0.1','projectUpdate','nextTick','stack','findIndex','splice','push','error','env','production','Cally\x20Square\x20server\x20listening\x20on\x20port\x20%d!','port','info','format','host.docker.internal','message','[%s]\x20%s','name','[ERROR]\x20%s','arg_1','calleridname','callerid','dnid','uniqueid','[HANGUP]\x20%s\x20project:\x20from\x20\x22%s\x22\x20<%s>\x20to\x20extension\x20%s\x20with\x20uniqueid\x20%s','createSquareReport','then','hasOwnProperty','indexOf','substring','variables','stringify','[START]\x20%s\x20project:\x20from\x20\x22%s\x22\x20<%s>\x20to\x20extension\x20%s\x20with\x20uniqueid\x20%s','evtHangup','find','handleUnpublished','initialize','getLicense','voice','callysquare','[LICENSE]\x20CHANNELS:\x20%s','[LICENSE]\x20CHANNELS:\x20UNLIMITED','getAll','catch','finally','listening','connection','close','lodash','syncho','../../config/environment','../../config/logger','agi','../../config/license/util'];(function(_0xaaf2e2,_0x19d28a){var _0x28bc36=function(_0x53bdb5){while(--_0x53bdb5){_0xaaf2e2['push'](_0xaaf2e2['shift']());}};_0x28bc36(++_0x19d28a);}(_0x0c25,0xde));var _0x50c2=function(_0x1bfe2b,_0x34856e){_0x1bfe2b=_0x1bfe2b-0x0;var _0x1477d4=_0x0c25[_0x1bfe2b];return _0x1477d4;};'use strict';var _=require(_0x50c2('0x0'));var syncho=require(_0x50c2('0x1'));var util=require('util');var config=require(_0x50c2('0x2'));var logger=require(_0x50c2('0x3'))(_0x50c2('0x4'));var utilLicense=require(_0x50c2('0x5'));var rpc=require('./rpc');var Project=require(_0x50c2('0x6'));var AGIEmitter=require(_0x50c2('0x7'))[_0x50c2('0x8')];var projects=[];config[_0x50c2('0x4')]=_['defaults'](config[_0x50c2('0x4')],{'ip':_0x50c2('0x9'),'port':0x11dd});AGIEmitter['on'](_0x50c2('0xa'),projectUpdateHandler);function connectionHandler(_0x24b791){process[_0x50c2('0xb')](function(){syncho(function(){try{setChannelVariables(_0x24b791);agiHandler(_0x24b791);}catch(_0x34c931){logger['error'](_0x34c931[_0x50c2('0xc')]);}});});}function projectUpdateHandler(_0x28edce){try{var _0x5a269e=_[_0x50c2('0xd')](projects,['id',_0x28edce['id']]);if(_0x5a269e>-0x1){if(_0x28edce['deleted']===!![]){projects[_0x50c2('0xe')](_0x5a269e,0x1);}else{projects[_0x5a269e]=_0x28edce;}}else{projects[_0x50c2('0xf')](_0x28edce);}}catch(_0x5283e0){logger[_0x50c2('0x10')](_0x5283e0[_0x50c2('0xc')]);}}function listeningHandler(){var _0x482356=config[_0x50c2('0x11')]===_0x50c2('0x12')||![];console['log'](_0x50c2('0x13'),config['agi'][_0x50c2('0x14')]);logger[_0x50c2('0x15')](util[_0x50c2('0x16')]('[LISTENING]\x20Cally\x20Square\x20listening\x20%s:%d',_0x482356?config[_0x50c2('0x4')]['ip']:_0x50c2('0x17'),config['agi'][_0x50c2('0x14')]));}function errorHandler(_0x2b7120){if(_0x2b7120&&_0x2b7120['name']&&_0x2b7120[_0x50c2('0x18')]){logger[_0x50c2('0x10')](util['format'](_0x50c2('0x19'),_0x2b7120[_0x50c2('0x1a')],_0x2b7120['message']));}else{logger[_0x50c2('0x10')](util[_0x50c2('0x16')](_0x50c2('0x1b'),_0x2b7120[_0x50c2('0xc')]));}}function closeHandler(){logger[_0x50c2('0x15')](util[_0x50c2('0x16')]('[CLOSE]\x20%s\x20project:\x20from\x20\x22%s\x22\x20<%s>\x20to\x20extension\x20%s\x20with\x20uniqueid\x20%s',this[_0x50c2('0x1c')],this[_0x50c2('0x1d')],this[_0x50c2('0x1e')],this[_0x50c2('0x1f')],this[_0x50c2('0x20')]));try{createSquareReport(this);}catch(_0x38ed4e){logger[_0x50c2('0x10')](_0x38ed4e[_0x50c2('0xc')]);}}function timeoutHandler(){logger['info'](util[_0x50c2('0x16')]('[TIMEOUT]\x20%s\x20project:\x20from\x20\x22%s\x22\x20<%s>\x20to\x20extension\x20%s\x20with\x20uniqueid\x20%s',this[_0x50c2('0x1c')],this[_0x50c2('0x1d')],this[_0x50c2('0x1e')],this[_0x50c2('0x1f')],this[_0x50c2('0x20')]));}function hangupHandler(){logger[_0x50c2('0x15')](util[_0x50c2('0x16')](_0x50c2('0x21'),this[_0x50c2('0x1c')],this[_0x50c2('0x1d')],this[_0x50c2('0x1e')],this[_0x50c2('0x1f')],this[_0x50c2('0x20')]));this['evtHangup']=!![];}function createSquareReport(_0x589057,_0x578e7c){rpc[_0x50c2('0x22')](_0x589057)[_0x50c2('0x23')](function(_0x165ec7){if(_0x578e7c){_0x578e7c(null,_0x165ec7);}})['catch'](function(_0x2fe010){if(_0x578e7c){_0x578e7c(null,_0x2fe010);}});}function setChannelVariables(_0x45e7bc){for(var _0x917afe in _0x45e7bc){if(_0x45e7bc[_0x50c2('0x24')](_0x917afe)){if(_0x917afe[_0x50c2('0x25')]('agi_')===0x0){_0x45e7bc[_0x917afe[_0x50c2('0x26')](0x4)]=_0x45e7bc[_0x917afe];delete _0x45e7bc[_0x917afe];}}}}function agiHandler(_0x542843){logger['debug'](_0x50c2('0x27'),JSON[_0x50c2('0x28')](_0x542843,null,0x2));logger[_0x50c2('0x15')](util['format'](_0x50c2('0x29'),_0x542843['arg_1'],_0x542843[_0x50c2('0x1d')],_0x542843[_0x50c2('0x1e')],_0x542843['dnid'],_0x542843[_0x50c2('0x20')]));_0x542843['on'](_0x50c2('0x10'),errorHandler);_0x542843['on']('close',closeHandler);_0x542843['on']('timeout',timeoutHandler);_0x542843[_0x50c2('0x2a')]=![];_0x542843['on']('hangup',hangupHandler);var _0x554516=_[_0x50c2('0x2b')](projects,[_0x50c2('0x1a'),_0x542843[_0x50c2('0x1c')]]);if(!_0x554516)return Project['handleNotFound'](_0x542843);if(!_0x554516[_0x50c2('0x12')])return Project[_0x50c2('0x2c')](_0x542843);return Project[_0x50c2('0x2d')](_0x554516,_0x542843);}function main(){var _0x3b474d;return utilLicense[_0x50c2('0x2e')]()[_0x50c2('0x23')](function(_0xb39589){if(!_0xb39589)return;if(_0xb39589[_0x50c2('0x2f')]){if(_0xb39589['callysquare']&&_0xb39589[_0x50c2('0x30')]>0x0){logger[_0x50c2('0x15')](util['format'](_0x50c2('0x31'),_0xb39589['callysquare']));_0x3b474d=_0xb39589[_0x50c2('0x30')];}else{logger[_0x50c2('0x15')](_0x50c2('0x32'));}}else{logger[_0x50c2('0x15')]('[LICENSE]\x20VOICE\x20IS\x20DISABLED');_0x3b474d=-0x1;}})[_0x50c2('0x23')](function(){return Project[_0x50c2('0x33')]();})[_0x50c2('0x23')](function(_0x36c056){projects=_0x36c056;return;})[_0x50c2('0x34')](function(_0x41df77){logger[_0x50c2('0x10')]('[LICENSE]',_0x41df77['stack']);})[_0x50c2('0x35')](function(){var _0x2e6217=require('./server')(config[_0x50c2('0x4')][_0x50c2('0x14')],config[_0x50c2('0x4')]['ip'],_0x3b474d);_0x2e6217['on'](_0x50c2('0x10'),errorHandler);_0x2e6217['on'](_0x50c2('0x36'),listeningHandler);_0x2e6217['on'](_0x50c2('0x37'),connectionHandler);_0x2e6217['on'](_0x50c2('0x38'),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 c3ce44e..871a4e9 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 _0x66c9=['catch','sendMailMessage','SendMail','bluebird','client','http','request','then','error','message'];(function(_0x1c1cca,_0x5ba2ca){var _0x5b68e3=function(_0x169d00){while(--_0x169d00){_0x1c1cca['push'](_0x1c1cca['shift']());}};_0x5b68e3(++_0x5ba2ca);}(_0x66c9,0x1d9));var _0x966c=function(_0x1b2b22,_0x247e8a){_0x1b2b22=_0x1b2b22-0x0;var _0x31b947=_0x66c9[_0x1b2b22];return _0x31b947;};'use strict';var BPromise=require(_0x966c('0x0'));var jayson=require('jayson/promise');var client=jayson[_0x966c('0x1')][_0x966c('0x2')]({'port':0x232b});function request(_0x365f65,_0x3c352a){return new BPromise(function(_0x46a7d1,_0x442cd8){return client[_0x966c('0x3')](_0x365f65,_0x3c352a)[_0x966c('0x4')](function(_0x55c9ca){if(_0x55c9ca['error']){return _0x442cd8(_0x55c9ca[_0x966c('0x5')][_0x966c('0x6')]);}else{return _0x46a7d1(_0x55c9ca['result']);}})[_0x966c('0x7')](function(_0x134e08){return _0x442cd8(_0x134e08);});});}exports[_0x966c('0x8')]=function(_0x263284,_0x26073b){return request(_0x966c('0x9'),{'account':_0x263284,'message':_0x26073b});}; \ No newline at end of file +var _0x410a=['sendMailMessage','client','http','request','then','error','message','result'];(function(_0x3ea2f8,_0x36795c){var _0x5b43bf=function(_0x282da9){while(--_0x282da9){_0x3ea2f8['push'](_0x3ea2f8['shift']());}};_0x5b43bf(++_0x36795c);}(_0x410a,0x1f1));var _0xa410=function(_0x18b7d0,_0x58a664){_0x18b7d0=_0x18b7d0-0x0;var _0xe4d47d=_0x410a[_0x18b7d0];return _0xe4d47d;};'use strict';var BPromise=require('bluebird');var jayson=require('jayson/promise');var client=jayson[_0xa410('0x0')][_0xa410('0x1')]({'port':0x232b});function request(_0x3fb380,_0x4c09f6){return new BPromise(function(_0x35521a,_0x58239b){return client[_0xa410('0x2')](_0x3fb380,_0x4c09f6)[_0xa410('0x3')](function(_0x2d6e6a){if(_0x2d6e6a[_0xa410('0x4')]){return _0x58239b(_0x2d6e6a['error'][_0xa410('0x5')]);}else{return _0x35521a(_0x2d6e6a[_0xa410('0x6')]);}})['catch'](function(_0x4149a7){return _0x58239b(_0x4149a7);});});}exports[_0xa410('0x7')]=function(_0x381e83,_0x4c7aa4){return request('SendMail',{'account':_0x381e83,'message':_0x4c7aa4});}; \ No newline at end of file diff --git a/server/services/agi/project.js b/server/services/agi/project.js index 63c88d2..99f6118 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 _0x1e79=['arg_1','calleridname','callerid','dnid','uniqueid','traverseBFS','clear','gotoc','info','context','extension','priority','response','isUndefined','result','toString','agicommand\x20not\x20found','[FINALLY\x20TRAVERSE]\x20%s\x20project:\x20from\x20\x22%s\x22\x20<%s>\x20to\x20extension\x20%s\x20with\x20uniqueid\x20%s','finally','[END]\x20%s\x20project:\x20from\x20\x22%s\x22\x20<%s>\x20to\x20extension\x20%s\x20with\x20uniqueid\x20%s','[GOTO]\x20context:\x20%s\x20extension:\x20%s\x20priority:\x20%s','continueAt','close','Project\x20%s\x20not\x20found','Project\x20%s\x20not\x20published','exports','moment','xml2json','util','../../config/logger','./rpc','./mailRpc','./graph','getSquareProjects','catch','error','stack','agicommand','hasOwnProperty','maxRetry','retry','mxCell','isArray','length','source','target','value','mxGraphModel','root','inspect','production','start','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'];(function(_0x716e01,_0xeb326){var _0x1860bf=function(_0x5ced78){while(--_0x5ced78){_0x716e01['push'](_0x716e01['shift']());}};_0x1860bf(++_0xeb326);}(_0x1e79,0x8e));var _0x91e7=function(_0x58319a,_0x145060){_0x58319a=_0x58319a-0x0;var _0x4cf654=_0x1e79[_0x58319a];return _0x4cf654;};'use strict';var _=require('lodash');var moment=require(_0x91e7('0x0'));var parser=require(_0x91e7('0x1'));var util=require(_0x91e7('0x2'));var logger=require(_0x91e7('0x3'))('agi');var rpc=require(_0x91e7('0x4'));var mailRpc=require(_0x91e7('0x5'));var Graph=require(_0x91e7('0x6'));var Vertices=require('./vertices');var AGI_CODE_SUCCESS=0xc8;var AGI_RESULT_ERROR=-0x1;function getAll(){return rpc[_0x91e7('0x7')]()[_0x91e7('0x8')](function(_0x5c215b){logger[_0x91e7('0x9')]('Unable\x20to\x20download\x20CallySquare\x20projects',_0x5c215b[_0x91e7('0xa')]);return[];});}function addVertex(_0x1e4fb7,_0x1d4ff5,_0x3ea131){_0x1d4ff5[_0x91e7('0xb')]=_0x3ea131;if(_0x1d4ff5[_0x91e7('0xc')]('retry')){_0x1d4ff5[_0x91e7('0xd')]=parseInt(_0x1d4ff5[_0x91e7('0xe')],0xa);}_0x1e4fb7['addVertex'](_['omit'](_0x1d4ff5,_0x91e7('0xf')));}function initGraph(_0x30fb84,_0x508e5b){var _0x2316df=new Graph();for(var _0x44366d in _0x30fb84){if(_0x30fb84[_0x91e7('0xc')](_0x44366d)){if(_[_0x91e7('0x10')](_0x30fb84[_0x44366d])){for(var _0x12fc03=0x0;_0x12fc03<_0x30fb84[_0x44366d][_0x91e7('0x11')];_0x12fc03+=0x1){addVertex(_0x2316df,_0x30fb84[_0x44366d][_0x12fc03],_0x44366d);}}else{addVertex(_0x2316df,_0x30fb84[_0x44366d],_0x44366d);}}}for(var _0x5999a9=0x0;_0x5999a9<_0x508e5b[_0x91e7('0x11')];_0x5999a9+=0x1){if(_0x508e5b[_0x5999a9][_0x91e7('0x12')]&&_0x508e5b[_0x5999a9][_0x91e7('0x13')]){_0x2316df['addEdge'](_0x508e5b[_0x5999a9]['source'],_0x508e5b[_0x5999a9][_0x91e7('0x13')],_0x508e5b[_0x5999a9][_0x91e7('0x14')]);}}return _0x2316df;}function getRoot(_0x57d849){return parser['toJson'](_0x57d849,{'object':!![]})[_0x91e7('0x15')][_0x91e7('0x16')];}function inspect(_0x4b8d53){return util[_0x91e7('0x17')](_0x4b8d53,{'showHidden':![],'depth':null});}function initialize(_0x3f4368,_0x4dd521){var _0x8e5b49=getRoot(_0x3f4368[_0x91e7('0x18')]);if(!_0x8e5b49||!_0x8e5b49[_0x91e7('0x19')])return;var _0x112b1b,_0x355752,_0x47a38f;logger[_0x91e7('0x1a')](_0x91e7('0x16'),JSON[_0x91e7('0x1b')](_0x8e5b49,null,0x2));_0x4dd521['joinAt']=moment()[_0x91e7('0x1c')](_0x91e7('0x1d'));_0x112b1b=initGraph(_[_0x91e7('0x1e')](_0x8e5b49,_0x91e7('0xf')),_0x8e5b49[_0x91e7('0xf')]);_0x355752=new Vertices(_0x4dd521,rpc,mailRpc);logger['info'](util[_0x91e7('0x1c')](_0x91e7('0x1f'),_0x4dd521[_0x91e7('0x20')],_0x4dd521[_0x91e7('0x21')],_0x4dd521[_0x91e7('0x22')],_0x4dd521[_0x91e7('0x23')],_0x4dd521[_0x91e7('0x24')]));_0x112b1b[_0x91e7('0x25')](_0x8e5b49[_0x91e7('0x19')]['id'],function(_0x5dfd7e){try{_0x5dfd7e=_0x355752[_0x91e7('0x26')](_0x5dfd7e);logger[_0x91e7('0x1a')]('vertex',JSON['stringify'](_0x5dfd7e,null,0x2));if(_0x5dfd7e['agicommand']===_0x91e7('0x27')){logger[_0x91e7('0x28')]('gotoc\x20block\x20stop\x20traverse\x20BFS');_0x4dd521[_0x91e7('0x29')]=_0x5dfd7e[_0x91e7('0x29')]||_0x4dd521[_0x91e7('0x29')];_0x4dd521[_0x91e7('0x2a')]=_0x5dfd7e[_0x91e7('0x2a')];_0x4dd521[_0x91e7('0x2b')]=_0x5dfd7e[_0x91e7('0x2b')]?_0x5dfd7e['priority']-0x1:0x1;return null;}else if(_0x5dfd7e&&_0x355752[_0x5dfd7e[_0x91e7('0xb')]]){_0x47a38f=_0x355752[_0x5dfd7e['agicommand']](_0x5dfd7e);logger[_0x91e7('0x28')](_0x91e7('0x2c'),JSON[_0x91e7('0x1b')](_0x47a38f,null,0x2));if(_0x47a38f&&_0x47a38f['code']===AGI_CODE_SUCCESS&&_0x47a38f['result']!==AGI_RESULT_ERROR&&!_0x4dd521['evtHangup']){logger[_0x91e7('0x1a')](_0x91e7('0x2c'),inspect(_0x47a38f));return _[_0x91e7('0x2d')](_0x47a38f[_0x91e7('0x2e')])?null:_0x47a38f[_0x91e7('0x2e')][_0x91e7('0x2f')]();}else{logger[_0x91e7('0x9')](_0x91e7('0x2c'),inspect(_0x47a38f));return null;}}else{logger[_0x91e7('0x9')](_0x91e7('0x30'));return null;}}catch(_0x4da95e){logger[_0x91e7('0x9')](_0x4da95e[_0x91e7('0xa')]);return null;}});if(_0x8e5b49['finally']){logger[_0x91e7('0x28')](util[_0x91e7('0x1c')](_0x91e7('0x31'),_0x4dd521[_0x91e7('0x20')],_0x4dd521[_0x91e7('0x21')],_0x4dd521[_0x91e7('0x22')],_0x4dd521[_0x91e7('0x23')],_0x4dd521[_0x91e7('0x24')]));_0x112b1b[_0x91e7('0x25')](_0x8e5b49[_0x91e7('0x32')]['id'],function(_0x3a2ac7){try{_0x3a2ac7=_0x355752[_0x91e7('0x26')](_0x3a2ac7);logger[_0x91e7('0x1a')]('vertex',JSON[_0x91e7('0x1b')](_0x3a2ac7,null,0x2));if(_0x3a2ac7&&_0x355752[_0x3a2ac7[_0x91e7('0xb')]]){_0x47a38f=_0x355752[_0x3a2ac7[_0x91e7('0xb')]](_0x3a2ac7);if(_0x47a38f){logger[_0x91e7('0x1a')](_0x91e7('0x2c'),inspect(_0x47a38f));return _[_0x91e7('0x2d')](_0x47a38f['result'])?null:_0x47a38f[_0x91e7('0x2e')][_0x91e7('0x2f')]();}else{logger[_0x91e7('0x9')]('response',inspect(_0x47a38f));return null;}}else{logger[_0x91e7('0x9')](_0x91e7('0x30'));return null;}}catch(_0x12be54){logger[_0x91e7('0x9')](_0x12be54[_0x91e7('0xa')]);return null;}});}logger['info'](util[_0x91e7('0x1c')](_0x91e7('0x33'),_0x4dd521[_0x91e7('0x20')],_0x4dd521[_0x91e7('0x21')],_0x4dd521[_0x91e7('0x22')],_0x4dd521['dnid'],_0x4dd521['uniqueid']));logger[_0x91e7('0x28')](util[_0x91e7('0x1c')](_0x91e7('0x34'),_0x4dd521[_0x91e7('0x29')],_0x4dd521[_0x91e7('0x2a')],parseInt(_0x4dd521[_0x91e7('0x2b')],0xa)+0x1));_0x4dd521[_0x91e7('0x35')](_0x4dd521[_0x91e7('0x29')],_0x4dd521[_0x91e7('0x2a')],parseInt(_0x4dd521['priority'],0xa)+0x1);_0x4dd521[_0x91e7('0x36')]();}function handleNotFound(_0x291b6c){logger[_0x91e7('0x9')](util[_0x91e7('0x1c')](_0x91e7('0x37'),_0x291b6c['arg_1']));_0x291b6c['continueAt'](_0x291b6c[_0x91e7('0x29')],_0x291b6c[_0x91e7('0x2a')],parseInt(_0x291b6c['priority'],0xa)+0x1);_0x291b6c[_0x91e7('0x36')]();}function handleUnpublished(_0x2d91c2){logger[_0x91e7('0x9')](util[_0x91e7('0x1c')](_0x91e7('0x38'),_0x2d91c2[_0x91e7('0x20')]));_0x2d91c2[_0x91e7('0x35')](_0x2d91c2[_0x91e7('0x29')],_0x2d91c2[_0x91e7('0x2a')],parseInt(_0x2d91c2['priority'],0xa)+0x1);_0x2d91c2[_0x91e7('0x36')]();}module[_0x91e7('0x39')]={'getAll':getAll,'handleNotFound':handleNotFound,'handleUnpublished':handleUnpublished,'initialize':initialize}; \ No newline at end of file +var _0xa59d=['toJson','mxGraphModel','root','inspect','production','debug','stringify','joinAt','format','YYYY-MM-DD\x20HH:mm:ss','arg_1','calleridname','callerid','dnid','uniqueid','traverseBFS','vertex','gotoc','info','context','extension','priority','response','code','result','evtHangup','isUndefined','toString','finally','[FINALLY\x20TRAVERSE]\x20%s\x20project:\x20from\x20\x22%s\x22\x20<%s>\x20to\x20extension\x20%s\x20with\x20uniqueid\x20%s','clear','agicommand\x20not\x20found','[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','exports','lodash','moment','xml2json','util','../../config/logger','./rpc','./graph','getSquareProjects','catch','error','Unable\x20to\x20download\x20CallySquare\x20projects','stack','agicommand','hasOwnProperty','maxRetry','retry','addVertex','omit','mxCell','isArray','length','source','target','value'];(function(_0x26797a,_0x104240){var _0xeb5295=function(_0x238784){while(--_0x238784){_0x26797a['push'](_0x26797a['shift']());}};_0xeb5295(++_0x104240);}(_0xa59d,0x156));var _0xda59=function(_0x2641f9,_0x26715f){_0x2641f9=_0x2641f9-0x0;var _0x585741=_0xa59d[_0x2641f9];return _0x585741;};'use strict';var _=require(_0xda59('0x0'));var moment=require(_0xda59('0x1'));var parser=require(_0xda59('0x2'));var util=require(_0xda59('0x3'));var logger=require(_0xda59('0x4'))('agi');var rpc=require(_0xda59('0x5'));var mailRpc=require('./mailRpc');var Graph=require(_0xda59('0x6'));var Vertices=require('./vertices');var AGI_CODE_SUCCESS=0xc8;var AGI_RESULT_ERROR=-0x1;function getAll(){return rpc[_0xda59('0x7')]()[_0xda59('0x8')](function(_0x4ca81f){logger[_0xda59('0x9')](_0xda59('0xa'),_0x4ca81f[_0xda59('0xb')]);return[];});}function addVertex(_0x5a0692,_0x813460,_0x118153){_0x813460[_0xda59('0xc')]=_0x118153;if(_0x813460[_0xda59('0xd')]('retry')){_0x813460[_0xda59('0xe')]=parseInt(_0x813460[_0xda59('0xf')],0xa);}_0x5a0692[_0xda59('0x10')](_[_0xda59('0x11')](_0x813460,_0xda59('0x12')));}function initGraph(_0x4a11d3,_0x16a555){var _0x2e9ed1=new Graph();for(var _0x59d971 in _0x4a11d3){if(_0x4a11d3[_0xda59('0xd')](_0x59d971)){if(_[_0xda59('0x13')](_0x4a11d3[_0x59d971])){for(var _0x380fca=0x0;_0x380fca<_0x4a11d3[_0x59d971][_0xda59('0x14')];_0x380fca+=0x1){addVertex(_0x2e9ed1,_0x4a11d3[_0x59d971][_0x380fca],_0x59d971);}}else{addVertex(_0x2e9ed1,_0x4a11d3[_0x59d971],_0x59d971);}}}for(var _0x60659c=0x0;_0x60659c<_0x16a555[_0xda59('0x14')];_0x60659c+=0x1){if(_0x16a555[_0x60659c][_0xda59('0x15')]&&_0x16a555[_0x60659c][_0xda59('0x16')]){_0x2e9ed1['addEdge'](_0x16a555[_0x60659c][_0xda59('0x15')],_0x16a555[_0x60659c]['target'],_0x16a555[_0x60659c][_0xda59('0x17')]);}}return _0x2e9ed1;}function getRoot(_0x4a2049){return parser[_0xda59('0x18')](_0x4a2049,{'object':!![]})[_0xda59('0x19')][_0xda59('0x1a')];}function inspect(_0xc53602){return util[_0xda59('0x1b')](_0xc53602,{'showHidden':![],'depth':null});}function initialize(_0x31444a,_0x3c64be){var _0x72168f=getRoot(_0x31444a[_0xda59('0x1c')]);if(!_0x72168f||!_0x72168f['start'])return;var _0x12490d,_0x3e74f2,_0x3616dd;logger[_0xda59('0x1d')]('root',JSON[_0xda59('0x1e')](_0x72168f,null,0x2));_0x3c64be[_0xda59('0x1f')]=moment()[_0xda59('0x20')](_0xda59('0x21'));_0x12490d=initGraph(_[_0xda59('0x11')](_0x72168f,_0xda59('0x12')),_0x72168f['mxCell']);_0x3e74f2=new Vertices(_0x3c64be,rpc,mailRpc);logger['info'](util[_0xda59('0x20')]('[START\x20TRAVERSE]\x20%s\x20project:\x20from\x20\x22%s\x22\x20<%s>\x20to\x20extension\x20%s\x20with\x20uniqueid\x20%s',_0x3c64be[_0xda59('0x22')],_0x3c64be[_0xda59('0x23')],_0x3c64be[_0xda59('0x24')],_0x3c64be[_0xda59('0x25')],_0x3c64be[_0xda59('0x26')]));_0x12490d[_0xda59('0x27')](_0x72168f['start']['id'],function(_0x5bd012){try{_0x5bd012=_0x3e74f2['clear'](_0x5bd012);logger['debug'](_0xda59('0x28'),JSON[_0xda59('0x1e')](_0x5bd012,null,0x2));if(_0x5bd012[_0xda59('0xc')]===_0xda59('0x29')){logger[_0xda59('0x2a')]('gotoc\x20block\x20stop\x20traverse\x20BFS');_0x3c64be[_0xda59('0x2b')]=_0x5bd012[_0xda59('0x2b')]||_0x3c64be['context'];_0x3c64be[_0xda59('0x2c')]=_0x5bd012[_0xda59('0x2c')];_0x3c64be['priority']=_0x5bd012[_0xda59('0x2d')]?_0x5bd012[_0xda59('0x2d')]-0x1:0x1;return null;}else if(_0x5bd012&&_0x3e74f2[_0x5bd012[_0xda59('0xc')]]){_0x3616dd=_0x3e74f2[_0x5bd012[_0xda59('0xc')]](_0x5bd012);logger[_0xda59('0x2a')](_0xda59('0x2e'),JSON[_0xda59('0x1e')](_0x3616dd,null,0x2));if(_0x3616dd&&_0x3616dd[_0xda59('0x2f')]===AGI_CODE_SUCCESS&&_0x3616dd[_0xda59('0x30')]!==AGI_RESULT_ERROR&&!_0x3c64be[_0xda59('0x31')]){logger['debug'](_0xda59('0x2e'),inspect(_0x3616dd));return _[_0xda59('0x32')](_0x3616dd[_0xda59('0x30')])?null:_0x3616dd[_0xda59('0x30')][_0xda59('0x33')]();}else{logger[_0xda59('0x9')](_0xda59('0x2e'),inspect(_0x3616dd));return null;}}else{logger[_0xda59('0x9')]('agicommand\x20not\x20found');return null;}}catch(_0x2ac6da){logger[_0xda59('0x9')](_0x2ac6da[_0xda59('0xb')]);return null;}});if(_0x72168f[_0xda59('0x34')]){logger[_0xda59('0x2a')](util[_0xda59('0x20')](_0xda59('0x35'),_0x3c64be[_0xda59('0x22')],_0x3c64be['calleridname'],_0x3c64be[_0xda59('0x24')],_0x3c64be[_0xda59('0x25')],_0x3c64be['uniqueid']));_0x12490d[_0xda59('0x27')](_0x72168f[_0xda59('0x34')]['id'],function(_0xb100ab){try{_0xb100ab=_0x3e74f2[_0xda59('0x36')](_0xb100ab);logger[_0xda59('0x1d')](_0xda59('0x28'),JSON[_0xda59('0x1e')](_0xb100ab,null,0x2));if(_0xb100ab&&_0x3e74f2[_0xb100ab[_0xda59('0xc')]]){_0x3616dd=_0x3e74f2[_0xb100ab[_0xda59('0xc')]](_0xb100ab);if(_0x3616dd){logger[_0xda59('0x1d')](_0xda59('0x2e'),inspect(_0x3616dd));return _['isUndefined'](_0x3616dd[_0xda59('0x30')])?null:_0x3616dd[_0xda59('0x30')][_0xda59('0x33')]();}else{logger['error'](_0xda59('0x2e'),inspect(_0x3616dd));return null;}}else{logger[_0xda59('0x9')](_0xda59('0x37'));return null;}}catch(_0x22cf16){logger[_0xda59('0x9')](_0x22cf16['stack']);return null;}});}logger[_0xda59('0x2a')](util[_0xda59('0x20')](_0xda59('0x38'),_0x3c64be[_0xda59('0x22')],_0x3c64be['calleridname'],_0x3c64be[_0xda59('0x24')],_0x3c64be[_0xda59('0x25')],_0x3c64be[_0xda59('0x26')]));logger[_0xda59('0x2a')](util[_0xda59('0x20')]('[GOTO]\x20context:\x20%s\x20extension:\x20%s\x20priority:\x20%s',_0x3c64be[_0xda59('0x2b')],_0x3c64be[_0xda59('0x2c')],parseInt(_0x3c64be[_0xda59('0x2d')],0xa)+0x1));_0x3c64be[_0xda59('0x39')](_0x3c64be['context'],_0x3c64be[_0xda59('0x2c')],parseInt(_0x3c64be[_0xda59('0x2d')],0xa)+0x1);_0x3c64be[_0xda59('0x3a')]();}function handleNotFound(_0x270afd){logger['error'](util['format'](_0xda59('0x3b'),_0x270afd['arg_1']));_0x270afd[_0xda59('0x39')](_0x270afd[_0xda59('0x2b')],_0x270afd[_0xda59('0x2c')],parseInt(_0x270afd[_0xda59('0x2d')],0xa)+0x1);_0x270afd[_0xda59('0x3a')]();}function handleUnpublished(_0xb96305){logger['error'](util['format']('Project\x20%s\x20not\x20published',_0xb96305[_0xda59('0x22')]));_0xb96305[_0xda59('0x39')](_0xb96305[_0xda59('0x2b')],_0xb96305[_0xda59('0x2c')],parseInt(_0xb96305[_0xda59('0x2d')],0xa)+0x1);_0xb96305[_0xda59('0x3a')]();}module[_0xda59('0x3c')]={'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 566375d..3137cd9 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 _0xa9e7=['line','exports','stream','Transform','call','_localBuffer','inherits','prototype','_transform','\x0d\x0a\x0d\x0a','toString','_inBody','indexOf','substring','length','split','trim'];(function(_0x1f65ee,_0x1792a0){var _0x381fd8=function(_0x1f2973){while(--_0x1f2973){_0x1f65ee['push'](_0x1f65ee['shift']());}};_0x381fd8(++_0x1792a0);}(_0xa9e7,0x79));var _0x7a9e=function(_0x5806c3,_0x5105d8){_0x5806c3=_0x5806c3-0x0;var _0x48ac77=_0xa9e7[_0x5806c3];return _0x48ac77;};'use strict';var util=require('util');var Transform=require(_0x7a9e('0x0'))[_0x7a9e('0x1')];function AGIReply(_0x2940ba){Transform[_0x7a9e('0x2')](this,_0x2940ba);this[_0x7a9e('0x3')]='';this['_inBody']=![];}util[_0x7a9e('0x4')](AGIReply,Transform);AGIReply[_0x7a9e('0x5')][_0x7a9e('0x6')]=function(_0x22dd2e,_0x301f27,_0x40775c){var _0x1f890a='\x0a',_0x32ef48=['\x0a\x0a',_0x7a9e('0x7')],_0x9dcfe6=-0x1,_0x23f2ad=-0x1,_0x11d46e='',_0x262964=0x0,_0x264650='',_0x305781='';this['_localBuffer']+=_0x22dd2e[_0x7a9e('0x8')]();_0x264650=this[_0x7a9e('0x3')];if(!this[_0x7a9e('0x9')]){_0x262964=0x0;while(_0x32ef48[_0x262964]){while((_0x23f2ad=_0x264650[_0x7a9e('0xa')](_0x32ef48[_0x262964]))!=-0x1){_0x11d46e=_0x32ef48[_0x262964];_0x305781=_0x264650[_0x7a9e('0xb')](0x0,_0x23f2ad);_0x264650=_0x264650['substring'](_0x23f2ad+_0x11d46e[_0x7a9e('0xc')]);var _0x101d5e=_0x305781[_0x7a9e('0xd')](_0x1f890a),_0x5491ea=0x0,_0x46b68a={},_0x19ffdb='',_0x4e7620='',_0x25931e=-0x1;while(_0x101d5e[_0x5491ea]){_0x25931e=_0x101d5e[_0x5491ea][_0x7a9e('0xa')](':');if(_0x25931e!=-0x1){_0x19ffdb=_0x101d5e[_0x5491ea]['slice'](0x0,_0x25931e)[_0x7a9e('0xe')]();_0x4e7620=_0x101d5e[_0x5491ea]['slice'](_0x25931e+0x1)[_0x7a9e('0xe')]();if(_0x19ffdb[_0x7a9e('0xc')]>0x0){_0x46b68a[_0x19ffdb]=_0x4e7620;}}else{}_0x5491ea++;}this['emit']('headers',_0x46b68a);this['_inBody']=!![];}_0x262964++;}this[_0x7a9e('0x3')]=_0x264650;}else{while((_0x9dcfe6=_0x264650['indexOf'](_0x1f890a))!=-0x1){_0x305781=_0x264650[_0x7a9e('0xb')](0x0,_0x9dcfe6);this['emit'](_0x7a9e('0xf'),_0x305781);_0x264650=_0x264650[_0x7a9e('0xb')](_0x9dcfe6+_0x1f890a['length']);}this[_0x7a9e('0x3')]=_0x264650;}_0x40775c();};module[_0x7a9e('0x10')]=AGIReply; \ No newline at end of file +var _0x6f58=['stream','Transform','_inBody','_transform','\x0d\x0a\x0d\x0a','_localBuffer','length','split','indexOf','slice','trim','emit','headers','line','substring','exports','util'];(function(_0x4dab47,_0x4fe1e3){var _0x852b=function(_0x1b626d){while(--_0x1b626d){_0x4dab47['push'](_0x4dab47['shift']());}};_0x852b(++_0x4fe1e3);}(_0x6f58,0x1ec));var _0x86f5=function(_0x1631f0,_0x361f98){_0x1631f0=_0x1631f0-0x0;var _0x50f20a=_0x6f58[_0x1631f0];return _0x50f20a;};'use strict';var util=require(_0x86f5('0x0'));var Transform=require(_0x86f5('0x1'))[_0x86f5('0x2')];function AGIReply(_0x3137dc){Transform['call'](this,_0x3137dc);this['_localBuffer']='';this[_0x86f5('0x3')]=![];}util['inherits'](AGIReply,Transform);AGIReply['prototype'][_0x86f5('0x4')]=function(_0x5cc87e,_0x732700,_0x359cc9){var _0x168278='\x0a',_0x1d2298=['\x0a\x0a',_0x86f5('0x5')],_0x510ba4=-0x1,_0x482573=-0x1,_0x41971a='',_0x8bfb9f=0x0,_0x154e69='',_0x428f50='';this[_0x86f5('0x6')]+=_0x5cc87e['toString']();_0x154e69=this['_localBuffer'];if(!this['_inBody']){_0x8bfb9f=0x0;while(_0x1d2298[_0x8bfb9f]){while((_0x482573=_0x154e69['indexOf'](_0x1d2298[_0x8bfb9f]))!=-0x1){_0x41971a=_0x1d2298[_0x8bfb9f];_0x428f50=_0x154e69['substring'](0x0,_0x482573);_0x154e69=_0x154e69['substring'](_0x482573+_0x41971a[_0x86f5('0x7')]);var _0x44cbf6=_0x428f50[_0x86f5('0x8')](_0x168278),_0x1a8958=0x0,_0x152365={},_0x390030='',_0xdc7ce6='',_0x56663b=-0x1;while(_0x44cbf6[_0x1a8958]){_0x56663b=_0x44cbf6[_0x1a8958][_0x86f5('0x9')](':');if(_0x56663b!=-0x1){_0x390030=_0x44cbf6[_0x1a8958][_0x86f5('0xa')](0x0,_0x56663b)[_0x86f5('0xb')]();_0xdc7ce6=_0x44cbf6[_0x1a8958][_0x86f5('0xa')](_0x56663b+0x1)[_0x86f5('0xb')]();if(_0x390030[_0x86f5('0x7')]>0x0){_0x152365[_0x390030]=_0xdc7ce6;}}else{}_0x1a8958++;}this[_0x86f5('0xc')](_0x86f5('0xd'),_0x152365);this['_inBody']=!![];}_0x8bfb9f++;}this['_localBuffer']=_0x154e69;}else{while((_0x510ba4=_0x154e69['indexOf'](_0x168278))!=-0x1){_0x428f50=_0x154e69['substring'](0x0,_0x510ba4);this[_0x86f5('0xc')](_0x86f5('0xe'),_0x428f50);_0x154e69=_0x154e69[_0x86f5('0xf')](_0x510ba4+_0x168278[_0x86f5('0x7')]);}this[_0x86f5('0x6')]=_0x154e69;}_0x359cc9();};module[_0x86f5('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 a94b00a..116173c 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 _0xe009=['ShowMailAccount','Smtp','name','getSquareProjectById','getVoiceQueueById','getVariableById','ShowVariable','getSquareOdbcById','ShowUser','getContactByPhone','phone','getTrunkById','ShowTrunk','getSoundById','ShowSound','ShowInterval','Interval','getSmsAccountById','ShowSmsAccount','createSmsMessage','CreateSmsMessage','createSquareDetailsReport','CreateSquareDetailsReport','createSquareReport','CreateSquareReport','merge','arg_1','arg_2','format','YYYY-MM-DD\x20HH:mm:ss','createSquareRecording','CreateSquareRecording','createSquareMessage','ShowCmHopper','ListId','CreateCmContact','getPauseById','ShowPause','agentLogin','LoginUser','agentPause','PauseUser','agentUnpause','UnpauseUser','agentLogout','LogoutUser','lodash','moment','jayson/promise','client','request','then','error','message','result','catch','getSquareProjects','production','getSquareProject','ShowSquareProject','getMailAccountById'];(function(_0x2fe386,_0x129abb){var _0x418923=function(_0x3e06b6){while(--_0x3e06b6){_0x2fe386['push'](_0x2fe386['shift']());}};_0x418923(++_0x129abb);}(_0xe009,0x122));var _0x9e00=function(_0x2b43e0,_0x23ff95){_0x2b43e0=_0x2b43e0-0x0;var _0x14e7e9=_0xe009[_0x2b43e0];return _0x14e7e9;};'use strict';var _=require(_0x9e00('0x0'));var moment=require(_0x9e00('0x1'));var jayson=require(_0x9e00('0x2'));var client=jayson[_0x9e00('0x3')]['http']({'port':0x2329});function request(_0x126adc,_0x4b0d66){return new Promise(function(_0x49a072,_0x24d136){return client[_0x9e00('0x4')](_0x126adc,_0x4b0d66)[_0x9e00('0x5')](function(_0x360443){if(_0x360443[_0x9e00('0x6')]){return _0x24d136(_0x360443[_0x9e00('0x6')][_0x9e00('0x7')]);}else{return _0x49a072(_0x360443[_0x9e00('0x8')]);}})[_0x9e00('0x9')](function(_0x5da6a4){return _0x24d136(_0x5da6a4);});});}exports[_0x9e00('0xa')]=function(){return request('GetSquareProjects',{'options':{'raw':![],'attributes':['id','name',_0x9e00('0xb')]}});};exports[_0x9e00('0xc')]=function(_0x9aa2b6){return request(_0x9e00('0xd'),{'options':{'raw':![],'where':{'name':_0x9aa2b6},'attributes':['production']}});};exports[_0x9e00('0xe')]=function(_0x3fdabe){return request(_0x9e00('0xf'),{'options':{'raw':![],'where':{'id':_0x3fdabe},'include':[{'model':'MailServerOut','as':_0x9e00('0x10'),'include':[{'model':'CloudProvider','as':'CloudProvider'}]}],'attributes':['id',_0x9e00('0x11'),'email'],'smtp':!![]}});};exports[_0x9e00('0x12')]=function(_0x3b1960){return request(_0x9e00('0xd'),{'options':{'where':{'id':_0x3b1960},'attributes':[_0x9e00('0x11')]}});};exports[_0x9e00('0x13')]=function(_0x40b563){return request('ShowVoiceQueue',{'options':{'where':{'id':_0x40b563},'attributes':['name']}});};exports[_0x9e00('0x14')]=function(_0x4f3aad){return request(_0x9e00('0x15'),{'options':{'where':{'id':_0x4f3aad},'attributes':[_0x9e00('0x11')]}});};exports[_0x9e00('0x16')]=function(_0x1ce9bd){return request('ShowSquareOdbc',{'options':{'where':{'id':_0x1ce9bd},'attributes':['dsn']}});};exports['getUserById']=function(_0x4a2ce8){return request(_0x9e00('0x17'),{'options':{'where':{'id':_0x4a2ce8},'attributes':['name']}});};exports[_0x9e00('0x18')]=function(_0x4402b){return request('GetContactByPhone',{'options':{'where':{'phone':_0x4402b[_0x9e00('0x19')]},'attributes':['id']}});};exports[_0x9e00('0x1a')]=function(_0x11246e){return request(_0x9e00('0x1b'),{'options':{'where':{'id':_0x11246e},'attributes':[_0x9e00('0x11')]}});};exports[_0x9e00('0x1c')]=function(_0x6eba21){return request(_0x9e00('0x1d'),{'options':{'where':{'id':_0x6eba21},'attributes':['save_name']}});};exports['getIntervalById']=function(_0x181609){return request(_0x9e00('0x1e'),{'options':{'raw':![],'where':{'id':_0x181609},'include':[{'model':_0x9e00('0x1f'),'as':'Intervals'}]}});};exports[_0x9e00('0x20')]=function(_0x35a1ef){return request(_0x9e00('0x21'),{'options':{'where':{'id':_0x35a1ef},'attributes':['id','name']}});};exports[_0x9e00('0x22')]=function(_0x4008f9){return request(_0x9e00('0x23'),{'body':_0x4008f9});};exports[_0x9e00('0x24')]=function(_0x826a6){return request(_0x9e00('0x25'),{'body':_0x826a6});};exports[_0x9e00('0x26')]=function(_0x741ba2){return request(_0x9e00('0x27'),{'body':_[_0x9e00('0x28')](_0x741ba2,{'project_name':_0x741ba2[_0x9e00('0x29')],'prev_project_name':_0x741ba2[_0x9e00('0x2a')]||'','is_subproject':_0x741ba2[_0x9e00('0x2a')]?!![]:![],'leaveAt':moment()[_0x9e00('0x2b')](_0x9e00('0x2c'))})});};exports[_0x9e00('0x2d')]=function(_0x277807){return request(_0x9e00('0x2e'),{'body':_0x277807});};exports[_0x9e00('0x2f')]=function(_0x5aedc1){return request('CreateSquareMessage',{'body':_0x5aedc1});};exports['createCmContact']=function(_0x418d06){return request(_0x9e00('0x30'),{'options':{'raw':![],'where':{'phone':_0x418d06[_0x9e00('0x19')],'ListId':_0x418d06[_0x9e00('0x31')]}}})['then'](function(_0x2205a4){if(_0x2205a4){return _0x2205a4;}return request(_0x9e00('0x32'),{'body':_0x418d06});});};exports[_0x9e00('0x33')]=function(_0x54a102){return request(_0x9e00('0x34'),{'options':{'where':{'id':_0x54a102},'attributes':[_0x9e00('0x11')]}});};exports[_0x9e00('0x35')]=function(_0x26ecf0,_0x39fb37){return request(_0x9e00('0x36'),{'body':{'interface':_0x39fb37},'options':{'where':_0x26ecf0}});};exports[_0x9e00('0x37')]=function(_0x3d1987,_0x50da18,_0x506dad){return request(_0x9e00('0x38'),{'body':{'type':_0x50da18,'uniqueid':_0x506dad},'options':{'where':_0x3d1987}});};exports[_0x9e00('0x39')]=function(_0x58b531){return request(_0x9e00('0x3a'),{'body':{},'options':{'where':_0x58b531}});};exports[_0x9e00('0x3b')]=function(_0x26c99b){return request(_0x9e00('0x3c'),{'body':{},'options':{'where':_0x26c99b}});}; \ No newline at end of file +var _0xb91a=['name','getVoiceQueueById','ShowVoiceQueue','ShowVariable','getSquareOdbcById','ShowSquareOdbc','dsn','getUserById','GetContactByPhone','phone','ShowSound','getIntervalById','ShowInterval','Intervals','getSmsAccountById','ShowSmsAccount','createSmsMessage','CreateSquareReport','arg_1','arg_2','format','createSquareRecording','CreateSquareRecording','createSquareMessage','CreateSquareMessage','ShowCmHopper','ListId','CreateCmContact','getPauseById','ShowPause','agentLogin','LoginUser','PauseUser','UnpauseUser','agentLogout','LogoutUser','lodash','moment','jayson/promise','request','then','error','message','catch','production','getSquareProject','ShowSquareProject','getMailAccountById','ShowMailAccount','MailServerOut','Smtp','CloudProvider'];(function(_0x49797d,_0x25e37d){var _0x183ce9=function(_0x23b4b0){while(--_0x23b4b0){_0x49797d['push'](_0x49797d['shift']());}};_0x183ce9(++_0x25e37d);}(_0xb91a,0xf4));var _0xab91=function(_0x3fbc02,_0x28bf86){_0x3fbc02=_0x3fbc02-0x0;var _0x4c350d=_0xb91a[_0x3fbc02];return _0x4c350d;};'use strict';var _=require(_0xab91('0x0'));var moment=require(_0xab91('0x1'));var jayson=require(_0xab91('0x2'));var client=jayson['client']['http']({'port':0x2329});function request(_0x36ffe5,_0x37cd1e){return new Promise(function(_0xb312db,_0x439eb2){return client[_0xab91('0x3')](_0x36ffe5,_0x37cd1e)[_0xab91('0x4')](function(_0x1686bb){if(_0x1686bb[_0xab91('0x5')]){return _0x439eb2(_0x1686bb[_0xab91('0x5')][_0xab91('0x6')]);}else{return _0xb312db(_0x1686bb['result']);}})[_0xab91('0x7')](function(_0x1e8d52){return _0x439eb2(_0x1e8d52);});});}exports['getSquareProjects']=function(){return request('GetSquareProjects',{'options':{'raw':![],'attributes':['id','name',_0xab91('0x8')]}});};exports[_0xab91('0x9')]=function(_0x275029){return request(_0xab91('0xa'),{'options':{'raw':![],'where':{'name':_0x275029},'attributes':[_0xab91('0x8')]}});};exports[_0xab91('0xb')]=function(_0x982ce9){return request(_0xab91('0xc'),{'options':{'raw':![],'where':{'id':_0x982ce9},'include':[{'model':_0xab91('0xd'),'as':_0xab91('0xe'),'include':[{'model':_0xab91('0xf'),'as':_0xab91('0xf')}]}],'attributes':['id',_0xab91('0x10'),'email'],'smtp':!![]}});};exports['getSquareProjectById']=function(_0x40c32d){return request(_0xab91('0xa'),{'options':{'where':{'id':_0x40c32d},'attributes':[_0xab91('0x10')]}});};exports[_0xab91('0x11')]=function(_0x14b304){return request(_0xab91('0x12'),{'options':{'where':{'id':_0x14b304},'attributes':['name']}});};exports['getVariableById']=function(_0x3c102a){return request(_0xab91('0x13'),{'options':{'where':{'id':_0x3c102a},'attributes':[_0xab91('0x10')]}});};exports[_0xab91('0x14')]=function(_0x1f4252){return request(_0xab91('0x15'),{'options':{'where':{'id':_0x1f4252},'attributes':[_0xab91('0x16')]}});};exports[_0xab91('0x17')]=function(_0x499daf){return request('ShowUser',{'options':{'where':{'id':_0x499daf},'attributes':[_0xab91('0x10')]}});};exports['getContactByPhone']=function(_0x609b8c){return request(_0xab91('0x18'),{'options':{'where':{'phone':_0x609b8c[_0xab91('0x19')]},'attributes':['id']}});};exports['getTrunkById']=function(_0xe80258){return request('ShowTrunk',{'options':{'where':{'id':_0xe80258},'attributes':[_0xab91('0x10')]}});};exports['getSoundById']=function(_0x4977f3){return request(_0xab91('0x1a'),{'options':{'where':{'id':_0x4977f3},'attributes':['save_name']}});};exports[_0xab91('0x1b')]=function(_0x1f5def){return request(_0xab91('0x1c'),{'options':{'raw':![],'where':{'id':_0x1f5def},'include':[{'model':'Interval','as':_0xab91('0x1d')}]}});};exports[_0xab91('0x1e')]=function(_0xdedffe){return request(_0xab91('0x1f'),{'options':{'where':{'id':_0xdedffe},'attributes':['id',_0xab91('0x10')]}});};exports[_0xab91('0x20')]=function(_0xf8db06){return request('CreateSmsMessage',{'body':_0xf8db06});};exports['createSquareDetailsReport']=function(_0x18445a){return request('CreateSquareDetailsReport',{'body':_0x18445a});};exports['createSquareReport']=function(_0x3167ae){return request(_0xab91('0x21'),{'body':_['merge'](_0x3167ae,{'project_name':_0x3167ae[_0xab91('0x22')],'prev_project_name':_0x3167ae['arg_2']||'','is_subproject':_0x3167ae[_0xab91('0x23')]?!![]:![],'leaveAt':moment()[_0xab91('0x24')]('YYYY-MM-DD\x20HH:mm:ss')})});};exports[_0xab91('0x25')]=function(_0x5b57e9){return request(_0xab91('0x26'),{'body':_0x5b57e9});};exports[_0xab91('0x27')]=function(_0x35a319){return request(_0xab91('0x28'),{'body':_0x35a319});};exports['createCmContact']=function(_0x281ede){return request(_0xab91('0x29'),{'options':{'raw':![],'where':{'phone':_0x281ede[_0xab91('0x19')],'ListId':_0x281ede[_0xab91('0x2a')]}}})[_0xab91('0x4')](function(_0x398fd3){if(_0x398fd3){return _0x398fd3;}return request(_0xab91('0x2b'),{'body':_0x281ede});});};exports[_0xab91('0x2c')]=function(_0x4dd0fd){return request(_0xab91('0x2d'),{'options':{'where':{'id':_0x4dd0fd},'attributes':[_0xab91('0x10')]}});};exports[_0xab91('0x2e')]=function(_0x108d31,_0x1c5ec7){return request(_0xab91('0x2f'),{'body':{'interface':_0x1c5ec7},'options':{'where':_0x108d31}});};exports['agentPause']=function(_0x3749e1,_0x2744e8,_0xaf40a5){return request(_0xab91('0x30'),{'body':{'type':_0x2744e8,'uniqueid':_0xaf40a5},'options':{'where':_0x3749e1}});};exports['agentUnpause']=function(_0x25e1f3){return request(_0xab91('0x31'),{'body':{},'options':{'where':_0x25e1f3}});};exports[_0xab91('0x32')]=function(_0x50253b){return request(_0xab91('0x33'),{'body':{},'options':{'where':_0x50253b}});}; \ 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 c56f370..77e3bae 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 _0x5549=['./lex','exports','./polly'];(function(_0x2c9bbf,_0x550130){var _0x27aead=function(_0x458c63){while(--_0x458c63){_0x2c9bbf['push'](_0x2c9bbf['shift']());}};_0x27aead(++_0x550130);}(_0x5549,0x1f4));var _0x9554=function(_0x585422,_0x589c3c){_0x585422=_0x585422-0x0;var _0x5dda7b=_0x5549[_0x585422];return _0x5dda7b;};var polly=require(_0x9554('0x0'));var lex=require(_0x9554('0x1'));module[_0x9554('0x2')]={'polly':polly,'lex':lex}; \ No newline at end of file +var _0x7ebb=['./lex','exports','./polly'];(function(_0xb4791c,_0x4007ba){var _0xe1ffeb=function(_0xeb020e){while(--_0xeb020e){_0xb4791c['push'](_0xb4791c['shift']());}};_0xe1ffeb(++_0x4007ba);}(_0x7ebb,0x161));var _0xb7eb=function(_0xf7dd0f,_0x396c3b){_0xf7dd0f=_0xf7dd0f-0x0;var _0x3fc64b=_0x7ebb[_0xf7dd0f];return _0x3fc64b;};var polly=require(_0xb7eb('0x0'));var lex=require(_0xb7eb('0x1'));module[_0xb7eb('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 fdf6bd2..6981c9d 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 _0x6e6c=['exports','./lib/api'];(function(_0x1177d5,_0x22b649){var _0xc3ddc2=function(_0x43ff95){while(--_0x43ff95){_0x1177d5['push'](_0x1177d5['shift']());}};_0xc3ddc2(++_0x22b649);}(_0x6e6c,0xc3));var _0xc6e6=function(_0x397e5f,_0x454c8f){_0x397e5f=_0x397e5f-0x0;var _0x5302b8=_0x6e6c[_0x397e5f];return _0x5302b8;};'use strict';var lex=require(_0xc6e6('0x0'));module[_0xc6e6('0x1')]=function(_0x545f2c,_0x370b21,_0x1b63fe,_0x58f303,_0x550e47,_0x2e97f5){return lex(_0x545f2c,_0x370b21,_0x1b63fe,_0x58f303,_0x550e47,_0x2e97f5);}; \ No newline at end of file +var _0x3c81=['./lib/api','exports'];(function(_0x4bb389,_0x267e18){var _0x16d057=function(_0x4bfd30){while(--_0x4bfd30){_0x4bb389['push'](_0x4bb389['shift']());}};_0x16d057(++_0x267e18);}(_0x3c81,0x102));var _0x13c8=function(_0x30e06e,_0x492ed4){_0x30e06e=_0x30e06e-0x0;var _0x1275c0=_0x3c81[_0x30e06e];return _0x1275c0;};'use strict';var lex=require(_0x13c8('0x0'));module[_0x13c8('0x1')]=function(_0x48c35b,_0x252f26,_0x131d0b,_0x4954c2,_0x5913e9,_0x5c3ba4){return lex(_0x48c35b,_0x252f26,_0x131d0b,_0x4954c2,_0x5913e9,_0x5c3ba4);}; \ 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 a8214f2..f54dde7 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(_0x4b10c4,_0x587878){var _0x490fb5=function(_0x48d5e3){while(--_0x48d5e3){_0x4b10c4['push'](_0x4b10c4['shift']());}};_0x490fb5(++_0x587878);}(_0xa9e0,0x123));var _0x0a9e=function(_0x4dbaad,_0x730318){_0x4dbaad=_0x4dbaad-0x0;var _0x226c72=_0xa9e0[_0x4dbaad];return _0x226c72;};'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(_0xdecd36,_0x33b08f){var _0x561fac=function(_0xa9daff){while(--_0xa9daff){_0xdecd36['push'](_0xdecd36['shift']());}};_0x561fac(++_0x33b08f);}(_0xa9e0,0x123));var _0x0a9e=function(_0x4bfac3,_0x58324d){_0x4bfac3=_0x4bfac3-0x0;var _0x15f0f2=_0xa9e0[_0x4bfac3];return _0x15f0f2;};'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 fe53845..60b87f7 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 _0x29fc=['exports'];(function(_0x24e884,_0x846436){var _0x10bd08=function(_0x18d1eb){while(--_0x18d1eb){_0x24e884['push'](_0x24e884['shift']());}};_0x10bd08(++_0x846436);}(_0x29fc,0x1d0));var _0xc29f=function(_0x357848,_0x32edab){_0x357848=_0x357848-0x0;var _0x19647c=_0x29fc[_0x357848];return _0x19647c;};'use strict';var polly=require('./lib/api');module[_0xc29f('0x0')]=function(_0xde0ce2,_0x1e76c5,_0x44bce4,_0x3575cb,_0x195803,_0x292954,_0x394d94){return polly(_0xde0ce2,_0x1e76c5,_0x44bce4,_0x3575cb,_0x195803,_0x292954,_0x394d94);}; \ No newline at end of file +var _0x1619=['./lib/api','exports'];(function(_0xc6a44c,_0x3123e4){var _0x16324d=function(_0x139a05){while(--_0x139a05){_0xc6a44c['push'](_0xc6a44c['shift']());}};_0x16324d(++_0x3123e4);}(_0x1619,0x82));var _0x9161=function(_0x5b3dcf,_0x3cbe41){_0x5b3dcf=_0x5b3dcf-0x0;var _0x3ffcbe=_0x1619[_0x5b3dcf];return _0x3ffcbe;};'use strict';var polly=require(_0x9161('0x0'));module[_0x9161('0x1')]=function(_0x106f4d,_0x3618ac,_0x3d2b00,_0x487edf,_0x541f59,_0x16bb10,_0x2660c5){return polly(_0x106f4d,_0x3618ac,_0x3d2b00,_0x487edf,_0x541f59,_0x16bb10,_0x2660c5);}; \ 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 523f07b..f39b37e 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 _0xc202=['synthesizeSpeech','AudioStream','writeFile','Invalid\x20data\x20response\x20from\x20aws\x20Polly!','exports','text','randomstring'];(function(_0x30c7c5,_0x168208){var _0x29e24e=function(_0x427d3e){while(--_0x427d3e){_0x30c7c5['push'](_0x30c7c5['shift']());}};_0x29e24e(++_0x168208);}(_0xc202,0x13a));var _0x2c20=function(_0x43cd16,_0x559043){_0x43cd16=_0x43cd16-0x0;var _0x4a3145=_0xc202[_0x43cd16];return _0x4a3145;};'use strict';var fs=require('fs');var path=require('path');var BPromise=require('bluebird');var rs=require(_0x2c20('0x0'));var AWS=require('aws-sdk');function pollyResult(_0x7afffe,_0x53fb70,_0xb40286){return new BPromise(function(_0x51fdf6,_0x550484){_0x7afffe[_0x2c20('0x1')](_0x53fb70,function(_0x4d6c5b,_0x25c9f5){if(_0x4d6c5b){_0x550484(_0x4d6c5b);}else if(_0x25c9f5){if(_0x25c9f5[_0x2c20('0x2')]instanceof Buffer){fs[_0x2c20('0x3')](_0xb40286,_0x25c9f5[_0x2c20('0x2')],function(_0x4dab01){if(_0x4dab01){_0x550484(_0x4dab01);}else{_0x51fdf6();}});}else{_0x550484(new Error(_0x2c20('0x4')));}}else{_0x550484(new Error('No\x20data\x20response\x20from\x20aws\x20Polly!'));}});});}module[_0x2c20('0x5')]=function(_0x240115,_0x1a0d76,_0x4dee09,_0x335016,_0x514284,_0x509def,_0x314581){var _0x6163b6=new AWS['Polly']({'accessKeyId':_0x240115,'secretAccessKey':_0x1a0d76,'region':_0x4dee09});var _0x394182={'Text':_0x514284,'TextType':_0x509def||_0x2c20('0x6'),'OutputFormat':'mp3','VoiceId':_0x335016};return pollyResult(_0x6163b6,_0x394182,_0x314581);}; \ No newline at end of file +var _0x2e72=['exports','Polly','text','mp3','path','bluebird','randomstring','aws-sdk','synthesizeSpeech','AudioStream','writeFile','Invalid\x20data\x20response\x20from\x20aws\x20Polly!','No\x20data\x20response\x20from\x20aws\x20Polly!'];(function(_0x2c5340,_0x5c86e5){var _0x3c505e=function(_0x1089d9){while(--_0x1089d9){_0x2c5340['push'](_0x2c5340['shift']());}};_0x3c505e(++_0x5c86e5);}(_0x2e72,0x79));var _0x22e7=function(_0x537501,_0x1509e4){_0x537501=_0x537501-0x0;var _0x54bfc2=_0x2e72[_0x537501];return _0x54bfc2;};'use strict';var fs=require('fs');var path=require(_0x22e7('0x0'));var BPromise=require(_0x22e7('0x1'));var rs=require(_0x22e7('0x2'));var AWS=require(_0x22e7('0x3'));function pollyResult(_0x53606f,_0x3c7a1a,_0x48f63d){return new BPromise(function(_0xb41879,_0x4895f3){_0x53606f[_0x22e7('0x4')](_0x3c7a1a,function(_0x532bb3,_0x5f2cd2){if(_0x532bb3){_0x4895f3(_0x532bb3);}else if(_0x5f2cd2){if(_0x5f2cd2[_0x22e7('0x5')]instanceof Buffer){fs[_0x22e7('0x6')](_0x48f63d,_0x5f2cd2[_0x22e7('0x5')],function(_0x27a836){if(_0x27a836){_0x4895f3(_0x27a836);}else{_0xb41879();}});}else{_0x4895f3(new Error(_0x22e7('0x7')));}}else{_0x4895f3(new Error(_0x22e7('0x8')));}});});}module[_0x22e7('0x9')]=function(_0x344a39,_0x14ea98,_0x19267a,_0x8ab55,_0x48a88c,_0x14e01f,_0x340a2e){var _0x327882=new AWS[(_0x22e7('0xa'))]({'accessKeyId':_0x344a39,'secretAccessKey':_0x14ea98,'region':_0x19267a});var _0x44847e={'Text':_0x48a88c,'TextType':_0x14e01f||_0x22e7('0xb'),'OutputFormat':_0x22e7('0xc'),'VoiceId':_0x8ab55};return pollyResult(_0x327882,_0x44847e,_0x340a2e);}; \ 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 44b1370..b8f40eb 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 _0x5f7c=['exports'];(function(_0x56f6e9,_0x12b2c4){var _0x42879f=function(_0x31cbd8){while(--_0x31cbd8){_0x56f6e9['push'](_0x56f6e9['shift']());}};_0x42879f(++_0x12b2c4);}(_0x5f7c,0x140));var _0xc5f7=function(_0x31d5b6,_0x5d48d9){_0x31d5b6=_0x31d5b6-0x0;var _0x3e763f=_0x5f7c[_0x31d5b6];return _0x3e763f;};'use strict';var asr=require('./lib/api');module[_0xc5f7('0x0')]=function(_0x30c2de,_0x2d0b61,_0x10f04f,_0x4dc253){return asr(_0x30c2de,_0x2d0b61,_0x10f04f);}; \ No newline at end of file +var _0x2c59=['exports'];(function(_0x39e84d,_0x11931d){var _0x1991bc=function(_0xc81e32){while(--_0xc81e32){_0x39e84d['push'](_0x39e84d['shift']());}};_0x1991bc(++_0x11931d);}(_0x2c59,0x1a4));var _0x92c5=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0x2c59[_0x3dd15e];return _0x231fd0;};'use strict';var asr=require('./lib/api');module[_0x92c5('0x0')]=function(_0xbb5460,_0x49106c,_0x4b20e6,_0x3e8dfa){return asr(_0xbb5460,_0x49106c,_0x4b20e6);}; \ 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 d1aa313..6a7c289 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 _0xf194=['LINEAR16','8000','url','bluebird','https://speech.googleapis.com','exports','string','length','lang\x20should\x20be\x20a\x20string','readFileSync','base64','POST','/v1/speech:recognize?key='];(function(_0xd955d8,_0x430750){var _0x1b05ad=function(_0x5bef77){while(--_0x5bef77){_0xd955d8['push'](_0xd955d8['shift']());}};_0x1b05ad(++_0x430750);}(_0xf194,0x91));var _0x4f19=function(_0x18bbf4,_0x578955){_0x18bbf4=_0x18bbf4-0x0;var _0x36adff=_0xf194[_0x18bbf4];return _0x36adff;};'use strict';var url=require(_0x4f19('0x0'));var BPromise=require(_0x4f19('0x1'));var fs=require('fs');var host=_0x4f19('0x2');module[_0x4f19('0x3')]=function(_0x52e2fb,_0x13475c,_0x533c58){return new BPromise(function(_0x5db065,_0x5c0587){var _0x2db75c;if(typeof _0x52e2fb!==_0x4f19('0x4')||_0x52e2fb[_0x4f19('0x5')]===0x0){return _0x5c0587('filepath\x20should\x20be\x20a\x20string');}if(typeof _0x13475c!==_0x4f19('0x4')||_0x13475c[_0x4f19('0x5')]===0x0){return _0x5c0587('key\x20should\x20be\x20a\x20string');}if(typeof _0x533c58!=='undefined'&&(typeof _0x533c58!==_0x4f19('0x4')||_0x533c58[_0x4f19('0x5')]===0x0)){return _0x5c0587(_0x4f19('0x6'));}try{_0x2db75c=fs[_0x4f19('0x7')](_0x52e2fb)['toString'](_0x4f19('0x8'));}catch(_0x9cb3e7){return _0x5c0587(_0x9cb3e7);}return _0x5db065({'method':_0x4f19('0x9'),'uri':host+_0x4f19('0xa')+_0x13475c,'body':{'config':{'encoding':_0x4f19('0xb'),'sampleRateHertz':_0x4f19('0xc'),'languageCode':_0x533c58},'audio':{'content':_0x2db75c}},'json':!![]});});}; \ No newline at end of file +var _0x7dc2=['readFileSync','toString','/v1/speech:recognize?key=','LINEAR16','8000','https://speech.googleapis.com','exports','string','length','key\x20should\x20be\x20a\x20string','undefined','lang\x20should\x20be\x20a\x20string'];(function(_0x137917,_0x2a85df){var _0x174c18=function(_0x1fa085){while(--_0x1fa085){_0x137917['push'](_0x137917['shift']());}};_0x174c18(++_0x2a85df);}(_0x7dc2,0x19d));var _0x27dc=function(_0x321bb2,_0x202794){_0x321bb2=_0x321bb2-0x0;var _0x9c12ed=_0x7dc2[_0x321bb2];return _0x9c12ed;};'use strict';var url=require('url');var BPromise=require('bluebird');var fs=require('fs');var host=_0x27dc('0x0');module[_0x27dc('0x1')]=function(_0x49a9e7,_0x426f56,_0x57d4b4){return new BPromise(function(_0x15d70c,_0x29ba23){var _0x52337b;if(typeof _0x49a9e7!==_0x27dc('0x2')||_0x49a9e7[_0x27dc('0x3')]===0x0){return _0x29ba23('filepath\x20should\x20be\x20a\x20string');}if(typeof _0x426f56!==_0x27dc('0x2')||_0x426f56['length']===0x0){return _0x29ba23(_0x27dc('0x4'));}if(typeof _0x57d4b4!==_0x27dc('0x5')&&(typeof _0x57d4b4!=='string'||_0x57d4b4[_0x27dc('0x3')]===0x0)){return _0x29ba23(_0x27dc('0x6'));}try{_0x52337b=fs[_0x27dc('0x7')](_0x49a9e7)[_0x27dc('0x8')]('base64');}catch(_0x1d93ef){return _0x29ba23(_0x1d93ef);}return _0x15d70c({'method':'POST','uri':host+_0x27dc('0x9')+_0x426f56,'body':{'config':{'encoding':_0x27dc('0xa'),'sampleRateHertz':_0x27dc('0xb'),'languageCode':_0x57d4b4},'audio':{'content':_0x52337b}},'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 876cb5b..7af32ac 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 _0xb041=['./asr'];(function(_0x5a26f5,_0x196300){var _0x2e9ef7=function(_0x593736){while(--_0x593736){_0x5a26f5['push'](_0x5a26f5['shift']());}};_0x2e9ef7(++_0x196300);}(_0xb041,0x18f));var _0x1b04=function(_0x392d9a,_0x41b6ad){_0x392d9a=_0x392d9a-0x0;var _0xbb87cf=_0xb041[_0x392d9a];return _0xbb87cf;};var asr=require(_0x1b04('0x0'));module['exports']={'asr':asr}; \ No newline at end of file +var _0x0739=['exports'];(function(_0x1a6403,_0xf18658){var _0x587a43=function(_0x193bfa){while(--_0x193bfa){_0x1a6403['push'](_0x1a6403['shift']());}};_0x587a43(++_0xf18658);}(_0x0739,0x74));var _0x9073=function(_0x26a5fb,_0x7e8349){_0x26a5fb=_0x26a5fb-0x0;var _0x58dc9b=_0x0739[_0x26a5fb];return _0x58dc9b;};var asr=require('./asr');module[_0x9073('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 26be9ad..fa5e5b1 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 _0xc4ba=['error\x20convert','start','resolve','tmp','generate','writeFileSync','base64','then','unlink','chmodSync','readFileSync','toString','https://texttospeech.googleapis.com/v1/','?key=','ssml','input','voice','audioConfig','MP3','POST','from','writeFile','777','googleCloudTTS\x20path','split','googleTTS','utf8','application/x-www-form-urlencoded','f.req=','stringify','jQ1olc','generic','data','text\x20length\x20limit\x20reached','\x22\x20might\x20not\x20exist','parse\x20response\x20failed:\x0a','.mp3','goggleTTS\x20path','asr','results','map','alternatives','transcript','join','googleASR\x20transcription','[%s]\x20%s:%s','message','googleDialogflow','textRequest','result','source','resolvedQuery','action','actionIncomplete','fulfillment','speech','score','status','code','metadata','isFallbackIntent','googleDialogflowV2','replace','detectIntent','length','queryResult','allRequiredParamsPresent','diagnosticInfo','fields','end_conversation','boolValue','fulfillmentText','intent','displayName','isFallback','languageCode','responseId','intentDetectionConfidence','Tilde\x20ASR\x20transcription','Tilde\x20ASR\x20confidence','awsPolly','polly','.wav','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','nda','text','channelData','CustomActionData','AudioFromTts','Data','audiofile','dirName','bluebird','dialogflow','https','md5','querystring','request-promise','randomstring','google-tts-api','url','parse','./aws','./google','./tilde','../../../config/logger','agi','https://api.ispeech.org/api/rest','protocol','https:','host','WHAT_EVER','get','statusCode','error','statusMessage','request\x20to\x20','\x20failed,\x20status\x20code\x20=\x20','createWriteStream','finish','info','close','download\x20error','pipe','path'];(function(_0x5c1422,_0x30ff18){var _0x1a1c8c=function(_0x35cc83){while(--_0x35cc83){_0x5c1422['push'](_0x5c1422['shift']());}};_0x1a1c8c(++_0x30ff18);}(_0xc4ba,0xe9));var _0xac4b=function(_0x5ba53d,_0x4ccc51){_0x5ba53d=_0x5ba53d-0x0;var _0x5636d4=_0xc4ba[_0x5ba53d];return _0x5636d4;};'use strict';var apiai=require('apiai-promise');var BPromise=require(_0xac4b('0x0'));var dialogflow=require(_0xac4b('0x1'));var fs=require('fs');var http=require('http');var https=require(_0xac4b('0x2'));var md5=require(_0xac4b('0x3'));var path=require('path');var querystring=require(_0xac4b('0x4'));var rp=require(_0xac4b('0x5'));var rs=require(_0xac4b('0x6'));var sox=require('sox');var tts=require(_0xac4b('0x7'));var urlParse=require(_0xac4b('0x8'))[_0xac4b('0x9')];var util=require('util');var aws=require(_0xac4b('0xa'));var google=require(_0xac4b('0xb'));var sestek=require('./sestek');var tilde=require(_0xac4b('0xc'));var logger=require(_0xac4b('0xd'))(_0xac4b('0xe'));var ISPEECH_API=_0xac4b('0xf');function downloadFile(_0x2789ca,_0x12193c){return new BPromise(function(_0x4dd92c,_0x771cbe){var _0x24008d=urlParse(_0x2789ca);var _0x20b7ec=_0x24008d[_0xac4b('0x10')]===_0xac4b('0x11')?https:http;var _0x3c86ac={'host':_0x24008d[_0xac4b('0x12')],'path':_0x24008d['path'],'headers':{'user-agent':_0xac4b('0x13')}};_0x20b7ec[_0xac4b('0x14')](_0x3c86ac,function(_0x46d337){if(_0x46d337[_0xac4b('0x15')]!==0xc8){logger[_0xac4b('0x16')]('request\x20to\x20'+_0x2789ca+'\x20failed,\x20status\x20code\x20=\x20'+_0x46d337[_0xac4b('0x15')]+'\x20('+_0x46d337[_0xac4b('0x17')]+')');_0x771cbe(new Error(_0xac4b('0x18')+_0x2789ca+_0xac4b('0x19')+_0x46d337[_0xac4b('0x15')]+'\x20('+_0x46d337[_0xac4b('0x17')]+')'));return;}var _0xeaa233=fs[_0xac4b('0x1a')](_0x12193c);_0xeaa233['on'](_0xac4b('0x1b'),function(){logger[_0xac4b('0x1c')]('finish\x20download\x20file');_0xeaa233[_0xac4b('0x1d')](_0x4dd92c);});_0xeaa233['on']('error',function(_0x27d856){fs['unlink'](_0x12193c);logger['error'](_0xac4b('0x1e'),_0x27d856);_0x771cbe(_0x27d856);});_0x46d337[_0xac4b('0x1f')](_0xeaa233);})['on'](_0xac4b('0x16'),function(_0x2c63a6){logger[_0xac4b('0x16')](_0x2c63a6);_0x771cbe(_0x2c63a6);})['end']();});}function uploadFile(_0x5f2afe){return new BPromise(function(_0x464044,_0x2aa1e9){var _0x305b57=urlParse(_0x5f2afe);var _0x3437e1=_0x305b57['protocol']===_0xac4b('0x11')?https:http;var _0x988188={'host':_0x305b57[_0xac4b('0x12')],'path':_0x305b57[_0xac4b('0x20')],'headers':{'user-agent':_0xac4b('0x13')}};_0x3437e1[_0xac4b('0x14')](_0x988188,function(_0x21a362){if(_0x21a362[_0xac4b('0x15')]!==0xc8){_0x2aa1e9(new Error(_0xac4b('0x18')+_0x5f2afe+_0xac4b('0x19')+_0x21a362['statusCode']+'\x20('+_0x21a362['statusMessage']+')'));return;}var _0x30ba0d='';_0x21a362['on']('data',function(_0x20bd8d){_0x30ba0d+=_0x20bd8d;});_0x21a362['on']('end',function(){_0x464044(_0x30ba0d);});})['on']('error',function(_0x56db6d){_0x2aa1e9(_0x56db6d);})['end']();});}function convertFile(_0x18de38,_0xb9b8f5){return new BPromise(function(_0x488c8a,_0x5eeacb){var _0x5b98d5=sox['transcode'](_0x18de38,_0xb9b8f5,{'sampleRate':0x1f40,'format':'wav','channelCount':0x1,'bitRate':0xc0*0x400,'compressionQuality':0x5});_0x5b98d5['on'](_0xac4b('0x16'),function(_0x218a16){logger[_0xac4b('0x16')](_0xac4b('0x21'),_0x218a16);_0x5eeacb(_0x218a16);});_0x5b98d5['on']('end',function(){logger[_0xac4b('0x1c')]('finish\x20to\x20convert');_0x488c8a();});_0x5b98d5[_0xac4b('0x22')]();});}function base64Decode(_0x58ff5e,_0xd2c987){var _0x3af4d0=path[_0xac4b('0x23')](__dirname,_0xac4b('0x24'),rs[_0xac4b('0x25')](0x4)+'.wav');fs[_0xac4b('0x26')](_0x3af4d0,_0x58ff5e,_0xac4b('0x27'));return convertFile(_0x3af4d0,_0xd2c987)[_0xac4b('0x28')](function(){try{fs[_0xac4b('0x29')](_0x3af4d0);fs[_0xac4b('0x2a')](_0xd2c987,'777');}catch(_0x371eed){logger[_0xac4b('0x16')](_0x371eed);}return _0xd2c987['split']('.')[0x0];});}function base64Encode(_0x2788b3){var _0x1f1716=fs[_0xac4b('0x2b')](_0x2788b3);return new Buffer(_0x1f1716)[_0xac4b('0x2c')](_0xac4b('0x27'));}exports['googleCloudTTS']=function(_0x283dcf,_0x28a06f,_0x1b4c79,_0x3b8dea,_0x1330a2,_0x3ab83b){var _0x2d112f,_0x50d2ee;var _0xfe7909=_0xac4b('0x2d');var _0x5376b4=_0xac4b('0x2e')+_0x283dcf;var _0x1c3456={};if(_0x28a06f===_0xac4b('0x2f')){_0x1c3456[_0xac4b('0x30')]={'ssml':_0x1b4c79};}else{_0x1c3456[_0xac4b('0x30')]={'text':_0x1b4c79};};_0x1c3456[_0xac4b('0x31')]={'languageCode':_0x3b8dea,'ssmlGender':_0x1330a2};_0x1c3456[_0xac4b('0x32')]={'audioEncoding':_0xac4b('0x33'),'sampleRateHertz':0x1f40};var _0x2728c0={'url':_0xfe7909+'text:synthesize'+_0x5376b4,'method':_0xac4b('0x34'),'json':!![],'body':_0x1c3456};return rp(_0x2728c0)[_0xac4b('0x28')](function(_0x548775){return new BPromise(function(_0x47cf05,_0x2901ba){_0x2d112f=path[_0xac4b('0x23')](__dirname,_0xac4b('0x24'),rs[_0xac4b('0x25')](0x4)+'.mp3');var _0x406540=Buffer[_0xac4b('0x35')](_0x548775['audioContent'],_0xac4b('0x27'));return fs[_0xac4b('0x36')](_0x2d112f,_0x406540,function(_0x1ed63a){_0x2901ba(_0x1ed63a);},function(_0x2b0746){fs[_0xac4b('0x2a')](_0x2d112f,_0xac4b('0x37'));_0x47cf05(_0x2b0746);});});})['then'](function(_0x2abf2b){_0x50d2ee=path[_0xac4b('0x23')](__dirname,_0xac4b('0x24'),rs[_0xac4b('0x25')](0x4)+'.wav');return convertFile(_0x2d112f,_0x50d2ee);})['then'](function(){try{fs[_0xac4b('0x29')](_0x2d112f);fs['chmodSync'](_0x50d2ee,'777');}catch(_0x46cc60){logger['error'](_0x46cc60);}logger[_0xac4b('0x1c')](_0xac4b('0x38'),_0x50d2ee['split']('.')[0x0]);return _0x50d2ee[_0xac4b('0x39')]('.')[0x0];});};exports[_0xac4b('0x3a')]=function(_0x213fc7,_0x588a04){var _0x487b24='https://translate.google.com/_/TranslateWebserverUi/data/batchexecute';var _0xc8ba83,_0x1648be;var _0x71b458;var _0x146512={'encoding':_0xac4b('0x3b'),'method':_0xac4b('0x34'),'timeout':0x2710,'url':_0x487b24,'headers':{'Content-Type':_0xac4b('0x3c')},'body':_0xac4b('0x3d')+encodeURIComponent(JSON[_0xac4b('0x3e')]([[[_0xac4b('0x3f'),JSON[_0xac4b('0x3e')]([_0x213fc7,_0x588a04||'en',![],'null']),null,_0xac4b('0x40')]]]))};return rp(_0x146512)['then'](function(_0x493786){try{_0x71b458=eval(_0x493786['slice'](0x5))[0x0][0x2];}catch(_0x5169a3){throw new Error('parse\x20response\x20failed:\x0a'+_0x493786[_0xac4b('0x41')]);}if(!_0x71b458){if(_0x213fc7['length']>0xc8){throw new Error(_0xac4b('0x42'));}else{throw new Error('lang\x20\x22'+_0x588a04+_0xac4b('0x43'));}}try{_0x71b458=eval(_0x71b458)[0x0];}catch(_0xe84fec){throw new Error(_0xac4b('0x44')+res['data']);}const _0x5056bf=_0x71b458;_0xc8ba83=path[_0xac4b('0x23')](__dirname,'tmp',rs[_0xac4b('0x25')](0x4)+_0xac4b('0x45'));fs[_0xac4b('0x26')](_0xc8ba83,_0x71b458,{'encoding':_0xac4b('0x27')});_0x1648be=path[_0xac4b('0x23')](__dirname,_0xac4b('0x24'),rs[_0xac4b('0x25')](0x4)+'.wav');return convertFile(_0xc8ba83,_0x1648be);})[_0xac4b('0x28')](function(){try{fs[_0xac4b('0x29')](_0xc8ba83);fs[_0xac4b('0x2a')](_0x1648be,_0xac4b('0x37'));}catch(_0xabe13f){logger[_0xac4b('0x16')](_0xabe13f);}logger[_0xac4b('0x1c')](_0xac4b('0x46'),_0x1648be[_0xac4b('0x39')]('.')[0x0]);return _0x1648be[_0xac4b('0x39')]('.')[0x0];});};exports['googleASR']=function(_0x5a6c70,_0x46992e,_0x16e395){return google[_0xac4b('0x47')](_0x5a6c70,_0x46992e,_0x16e395)['then'](function(_0x48279b){logger[_0xac4b('0x1c')](_0x48279b['uri']);return rp(_0x48279b);})[_0xac4b('0x28')](function(_0x3357ff){var _0x11f2cd='';var _0x216593=0x0;try{fs[_0xac4b('0x29')](_0x5a6c70);}catch(_0x5151a9){logger[_0xac4b('0x16')](_0x5151a9);}if(_0x3357ff&&_0x3357ff['results']){_0x11f2cd=_0x3357ff[_0xac4b('0x48')][_0xac4b('0x49')](function(_0x175b4a){return _0x175b4a&&_0x175b4a[_0xac4b('0x4a')][0x0]&&_0x175b4a[_0xac4b('0x4a')][0x0][_0xac4b('0x4b')]?_0x175b4a[_0xac4b('0x4a')][0x0][_0xac4b('0x4b')]:'';})[_0xac4b('0x4c')]('\x0a');_0x216593=_0x3357ff[_0xac4b('0x48')][_0xac4b('0x49')](function(_0x37451b){return _0x37451b&&_0x37451b[_0xac4b('0x4a')][0x0]&&_0x37451b[_0xac4b('0x4a')][0x0]['confidence']?_0x37451b[_0xac4b('0x4a')][0x0]['confidence']:0x0;})[_0xac4b('0x4c')]('\x0a');}logger[_0xac4b('0x1c')](_0xac4b('0x4d'),_0x11f2cd);logger[_0xac4b('0x1c')]('googleASR\x20confidence',_0x216593);return{'transcript':_0x11f2cd,'confidence':_0x216593};})['catch'](function(_0x5435b9){logger[_0xac4b('0x16')](_0xac4b('0x4e'),_0x5435b9['statusCode'],_0x5435b9['name'],_0x5435b9[_0xac4b('0x4f')]);});};exports[_0xac4b('0x50')]=function(_0x943524,_0x16e7eb,_0x493151,_0x5c2667){var _0x19e1e6=apiai(_0x16e7eb,{'language':_0x5c2667||'en'});return _0x19e1e6[_0xac4b('0x51')](_0x493151,{'sessionId':md5(_0x943524)})[_0xac4b('0x28')](function(_0x563136){logger['info'](JSON[_0xac4b('0x3e')](_0x563136));return{'source':_0x563136[_0xac4b('0x52')][_0xac4b('0x53')],'resolvedQuery':_0x563136[_0xac4b('0x52')][_0xac4b('0x54')],'action':_0x563136[_0xac4b('0x52')][_0xac4b('0x55')],'actionIncomplete':_0x563136['result'][_0xac4b('0x56')],'speech':_0x563136[_0xac4b('0x52')][_0xac4b('0x57')][_0xac4b('0x58')],'score':_0x563136[_0xac4b('0x52')][_0xac4b('0x59')],'statusCode':_0x563136[_0xac4b('0x5a')][_0xac4b('0x5b')],'endConversation':_0x563136[_0xac4b('0x52')][_0xac4b('0x5c')]['endConversation']||![],'isFallbackIntent':_0x563136['result'][_0xac4b('0x5c')][_0xac4b('0x5d')]};});};exports[_0xac4b('0x5e')]=function(_0x3bbb3a,_0x2f5a8d,_0x2c0323,_0x1256c3,_0x3703d1,_0xe8010){var _0x14c57b=_0x1256c3[_0xac4b('0x5f')](/\\n/g,'\x0a');var _0x177957={'credentials':{'private_key':_0x14c57b,'client_email':_0x2c0323}};var _0xe69a5a=new dialogflow['SessionsClient'](_0x177957);var _0x4bcf37=_0xe69a5a['sessionPath'](_0x2f5a8d,md5(_0x3bbb3a));var _0x5de294={'session':_0x4bcf37,'queryInput':{'text':{'text':_0x3703d1,'languageCode':_0xe8010}}};return _0xe69a5a[_0xac4b('0x60')](_0x5de294)['then'](function(_0x15d16a){if(_0x15d16a&&_0x15d16a[_0xac4b('0x61')]){logger[_0xac4b('0x1c')]('Dialogflow\x20V2\x20response:',JSON[_0xac4b('0x3e')](_0x15d16a));var _0x5513d0=_0x15d16a[0x0];if(_0x5513d0){var _0x136b8a={'action':_0x5513d0['queryResult']['action'],'allRequiredParamsPresent':_0x5513d0[_0xac4b('0x62')][_0xac4b('0x63')],'endConversation':_0x5513d0[_0xac4b('0x62')]['diagnosticInfo']&&_0x5513d0[_0xac4b('0x62')][_0xac4b('0x64')][_0xac4b('0x65')]?_0x5513d0[_0xac4b('0x62')]['diagnosticInfo'][_0xac4b('0x65')][_0xac4b('0x66')][_0xac4b('0x67')]:![],'fulfillmentText':_0x5513d0[_0xac4b('0x62')][_0xac4b('0x68')],'intentName':_0x5513d0['queryResult'][_0xac4b('0x69')]['name'],'intentDisplayName':_0x5513d0[_0xac4b('0x62')]['intent'][_0xac4b('0x6a')],'isFallbackIntent':_0x5513d0[_0xac4b('0x62')][_0xac4b('0x69')][_0xac4b('0x6b')],'languageCode':_0x5513d0[_0xac4b('0x62')][_0xac4b('0x6c')],'queryText':_0x5513d0[_0xac4b('0x62')]['queryText'],'responseId':_0x5513d0[_0xac4b('0x6d')],'score':_0x5513d0[_0xac4b('0x62')][_0xac4b('0x6e')],'speech':_0x5513d0[_0xac4b('0x62')]['fulfillmentText'],'providerResponse':JSON[_0xac4b('0x3e')](_0x15d16a)};return _0x136b8a;}}});};exports['tildeASR']=function(_0xfea76e,_0x2f4838,_0xb15c47,_0x7fbb6){return tilde[_0xac4b('0x47')](_0xfea76e,_0x2f4838,_0xb15c47,_0x7fbb6)[_0xac4b('0x28')](function(_0x53639a){try{fs[_0xac4b('0x29')](_0xfea76e);}catch(_0x5cf9db){logger['error'](_0x5cf9db);}logger[_0xac4b('0x1c')](_0xac4b('0x6f'),_0x53639a[_0xac4b('0x4b')]);logger[_0xac4b('0x1c')](_0xac4b('0x70'),_0x53639a['confidence']);return _0x53639a;});};exports[_0xac4b('0x71')]=function(_0x405b2f,_0x406a8e,_0x37675b,_0x120e55,_0x162c54,_0x3fce6e){var _0x3530f9=path[_0xac4b('0x23')](__dirname,_0xac4b('0x24'),rs[_0xac4b('0x25')](0x4)+'.mp3');var _0x180e15;return aws[_0xac4b('0x72')](_0x405b2f,_0x406a8e,_0x37675b,_0x120e55,_0x162c54,_0x3fce6e,_0x3530f9)['then'](function(){_0x180e15=path[_0xac4b('0x23')](__dirname,_0xac4b('0x24'),rs[_0xac4b('0x25')](0x4)+_0xac4b('0x73'));return convertFile(_0x3530f9,_0x180e15);})[_0xac4b('0x28')](function(){try{fs[_0xac4b('0x29')](_0x3530f9);fs['chmodSync'](_0x180e15,'777');}catch(_0xa1618b){logger[_0xac4b('0x16')](_0xa1618b);}return _0x180e15[_0xac4b('0x39')]('.')[0x0];});};exports[_0xac4b('0x74')]=function(_0x5abba9,_0x54272f,_0x177aa9,_0x1979dc,_0x39c6f3,_0x3736ee){return aws[_0xac4b('0x75')](_0x5abba9,_0x54272f,_0x177aa9,_0x1979dc,_0x39c6f3,_0x3736ee)[_0xac4b('0x28')](function(_0x28261a){logger[_0xac4b('0x1c')](JSON[_0xac4b('0x3e')](_0x28261a));return _0x28261a;});};exports[_0xac4b('0x76')]=function(_0x571a8f,_0x345c08,_0x49487f,_0x6b4ed){var _0x3c73f=util[_0xac4b('0x77')](_0xac4b('0x78'),ISPEECH_API,_0x571a8f,encodeURIComponent(_0x345c08),_0x49487f,_0x6b4ed);var _0x2e9581=path[_0xac4b('0x23')](__dirname,_0xac4b('0x24'),rs[_0xac4b('0x25')](0x4)+_0xac4b('0x45'));var _0x290b77;return downloadFile(_0x3c73f,_0x2e9581)[_0xac4b('0x28')](function(){_0x290b77=path[_0xac4b('0x23')](__dirname,_0xac4b('0x24'),rs['generate'](0x4)+'.wav');return convertFile(_0x2e9581,_0x290b77);})[_0xac4b('0x28')](function(){try{fs[_0xac4b('0x29')](_0x2e9581);fs[_0xac4b('0x2a')](_0x290b77,_0xac4b('0x37'));}catch(_0x2bef04){logger[_0xac4b('0x16')](_0x2bef04);}return _0x290b77[_0xac4b('0x39')]('.')[0x0];});};exports[_0xac4b('0x79')]=function(_0x1ec34c,_0x4a16a1,_0x45a55c,_0x3544c0){var _0x5d2be5=util[_0xac4b('0x77')](_0xac4b('0x7a'),ISPEECH_API,_0x4a16a1,_0x45a55c,base64Encode(_0x1ec34c),_0x3544c0?util[_0xac4b('0x77')](_0xac4b('0x7b'),encodeURIComponent(_0x3544c0)):_0xac4b('0x7c'));return uploadFile(_0x5d2be5)[_0xac4b('0x28')](function(_0x573091){return querystring[_0xac4b('0x9')](_0x573091);});};exports['sestekNDA']=function(_0x5480ad,_0x51a40d){return sestek[_0xac4b('0x7d')](_0x5480ad,_0x51a40d)[_0xac4b('0x28')](function(_0x4e29a6){logger[_0xac4b('0x1c')](JSON[_0xac4b('0x3e')](_0x4e29a6));var _0x2c8e8b={'speech':_0x4e29a6[_0xac4b('0x7e')],'action':_0x4e29a6[_0xac4b('0x7f')]?_0x4e29a6[_0xac4b('0x7f')]['CustomAction']:undefined,'actiondata':_0x4e29a6[_0xac4b('0x7f')]?_0x4e29a6['channelData'][_0xac4b('0x80')]:undefined};if(_0x4e29a6[_0xac4b('0x7f')]&&_0x4e29a6[_0xac4b('0x7f')][_0xac4b('0x81')]){return base64Decode(_0x4e29a6[_0xac4b('0x7f')][_0xac4b('0x81')][_0xac4b('0x82')],path[_0xac4b('0x23')](__dirname,_0xac4b('0x24'),rs[_0xac4b('0x25')](0x4)+_0xac4b('0x73')))[_0xac4b('0x28')](function(_0x167ff3){_0x2c8e8b[_0xac4b('0x83')]=_0x167ff3;return _0x2c8e8b;});}return _0x2c8e8b;});};exports[_0xac4b('0x84')]=function(){return __dirname;}; \ No newline at end of file +var _0xcf28=['./tilde','../../../config/logger','agi','https:','host','WHAT_EVER','get','statusCode','request\x20to\x20','\x20failed,\x20status\x20code\x20=\x20','statusMessage','createWriteStream','finish','info','finish\x20download\x20file','close','unlink','error','download\x20error','pipe','protocol','data','end','wav','error\x20convert','start','resolve','tmp','generate','.wav','base64','then','chmodSync','777','split','readFileSync','https://texttospeech.googleapis.com/v1/','?key=','ssml','input','voice','audioConfig','MP3','text:synthesize','POST','.mp3','from','audioContent','writeFile','googleCloudTTS\x20path','googleTTS','utf8','application/x-www-form-urlencoded','stringify','jQ1olc','generic','slice','parse\x20response\x20failed:\x0a','length','text\x20length\x20limit\x20reached','lang\x20\x22','\x22\x20might\x20not\x20exist','goggleTTS\x20path','asr','uri','results','map','alternatives','transcript','confidence','googleASR\x20transcription','googleASR\x20confidence','catch','[%s]\x20%s:%s','name','message','googleDialogflow','result','source','action','actionIncomplete','status','code','endConversation','metadata','isFallbackIntent','googleDialogflowV2','SessionsClient','sessionPath','detectIntent','queryResult','allRequiredParamsPresent','diagnosticInfo','fields','end_conversation','fulfillmentText','displayName','intent','languageCode','queryText','tildeASR','Tilde\x20ASR\x20confidence','awsPolly','polly','awsLex','ispeechTTS','%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','format','freeform=3','sestekNDA','channelData','CustomAction','CustomActionData','AudioFromTts','audiofile','dirName','apiai-promise','bluebird','dialogflow','http','https','md5','path','querystring','request-promise','randomstring','sox','google-tts-api','url','parse','util','./aws','./google','./sestek'];(function(_0x1af561,_0x40dfe6){var _0x30c5d2=function(_0x2cd55e){while(--_0x2cd55e){_0x1af561['push'](_0x1af561['shift']());}};_0x30c5d2(++_0x40dfe6);}(_0xcf28,0xfe));var _0x8cf2=function(_0x257f32,_0x13b585){_0x257f32=_0x257f32-0x0;var _0x3d8e76=_0xcf28[_0x257f32];return _0x3d8e76;};'use strict';var apiai=require(_0x8cf2('0x0'));var BPromise=require(_0x8cf2('0x1'));var dialogflow=require(_0x8cf2('0x2'));var fs=require('fs');var http=require(_0x8cf2('0x3'));var https=require(_0x8cf2('0x4'));var md5=require(_0x8cf2('0x5'));var path=require(_0x8cf2('0x6'));var querystring=require(_0x8cf2('0x7'));var rp=require(_0x8cf2('0x8'));var rs=require(_0x8cf2('0x9'));var sox=require(_0x8cf2('0xa'));var tts=require(_0x8cf2('0xb'));var urlParse=require(_0x8cf2('0xc'))[_0x8cf2('0xd')];var util=require(_0x8cf2('0xe'));var aws=require(_0x8cf2('0xf'));var google=require(_0x8cf2('0x10'));var sestek=require(_0x8cf2('0x11'));var tilde=require(_0x8cf2('0x12'));var logger=require(_0x8cf2('0x13'))(_0x8cf2('0x14'));var ISPEECH_API='https://api.ispeech.org/api/rest';function downloadFile(_0x1dbd8b,_0x60de48){return new BPromise(function(_0x9a52d3,_0x5d4f96){var _0x57f8cd=urlParse(_0x1dbd8b);var _0x4a7f1e=_0x57f8cd['protocol']===_0x8cf2('0x15')?https:http;var _0x879706={'host':_0x57f8cd[_0x8cf2('0x16')],'path':_0x57f8cd[_0x8cf2('0x6')],'headers':{'user-agent':_0x8cf2('0x17')}};_0x4a7f1e[_0x8cf2('0x18')](_0x879706,function(_0x37224e){if(_0x37224e[_0x8cf2('0x19')]!==0xc8){logger['error'](_0x8cf2('0x1a')+_0x1dbd8b+_0x8cf2('0x1b')+_0x37224e['statusCode']+'\x20('+_0x37224e[_0x8cf2('0x1c')]+')');_0x5d4f96(new Error(_0x8cf2('0x1a')+_0x1dbd8b+_0x8cf2('0x1b')+_0x37224e[_0x8cf2('0x19')]+'\x20('+_0x37224e[_0x8cf2('0x1c')]+')'));return;}var _0x3c8779=fs[_0x8cf2('0x1d')](_0x60de48);_0x3c8779['on'](_0x8cf2('0x1e'),function(){logger[_0x8cf2('0x1f')](_0x8cf2('0x20'));_0x3c8779[_0x8cf2('0x21')](_0x9a52d3);});_0x3c8779['on']('error',function(_0x41d0dd){fs[_0x8cf2('0x22')](_0x60de48);logger[_0x8cf2('0x23')](_0x8cf2('0x24'),_0x41d0dd);_0x5d4f96(_0x41d0dd);});_0x37224e[_0x8cf2('0x25')](_0x3c8779);})['on'](_0x8cf2('0x23'),function(_0x4d8546){logger[_0x8cf2('0x23')](_0x4d8546);_0x5d4f96(_0x4d8546);})['end']();});}function uploadFile(_0x5309c3){return new BPromise(function(_0x1685a8,_0x215604){var _0x3c17a3=urlParse(_0x5309c3);var _0x519338=_0x3c17a3[_0x8cf2('0x26')]==='https:'?https:http;var _0xcf3c6={'host':_0x3c17a3['host'],'path':_0x3c17a3[_0x8cf2('0x6')],'headers':{'user-agent':_0x8cf2('0x17')}};_0x519338[_0x8cf2('0x18')](_0xcf3c6,function(_0x1c0e1e){if(_0x1c0e1e[_0x8cf2('0x19')]!==0xc8){_0x215604(new Error('request\x20to\x20'+_0x5309c3+'\x20failed,\x20status\x20code\x20=\x20'+_0x1c0e1e[_0x8cf2('0x19')]+'\x20('+_0x1c0e1e[_0x8cf2('0x1c')]+')'));return;}var _0x3ad1e4='';_0x1c0e1e['on'](_0x8cf2('0x27'),function(_0xe19bb9){_0x3ad1e4+=_0xe19bb9;});_0x1c0e1e['on'](_0x8cf2('0x28'),function(){_0x1685a8(_0x3ad1e4);});})['on'](_0x8cf2('0x23'),function(_0x18ae18){_0x215604(_0x18ae18);})[_0x8cf2('0x28')]();});}function convertFile(_0x65313d,_0x43d785){return new BPromise(function(_0x16898b,_0x5f0747){var _0xfe9029=sox['transcode'](_0x65313d,_0x43d785,{'sampleRate':0x1f40,'format':_0x8cf2('0x29'),'channelCount':0x1,'bitRate':0xc0*0x400,'compressionQuality':0x5});_0xfe9029['on']('error',function(_0x4cc4ec){logger[_0x8cf2('0x23')](_0x8cf2('0x2a'),_0x4cc4ec);_0x5f0747(_0x4cc4ec);});_0xfe9029['on'](_0x8cf2('0x28'),function(){logger[_0x8cf2('0x1f')]('finish\x20to\x20convert');_0x16898b();});_0xfe9029[_0x8cf2('0x2b')]();});}function base64Decode(_0x222348,_0x54e019){var _0x4e68df=path[_0x8cf2('0x2c')](__dirname,_0x8cf2('0x2d'),rs[_0x8cf2('0x2e')](0x4)+_0x8cf2('0x2f'));fs['writeFileSync'](_0x4e68df,_0x222348,_0x8cf2('0x30'));return convertFile(_0x4e68df,_0x54e019)[_0x8cf2('0x31')](function(){try{fs[_0x8cf2('0x22')](_0x4e68df);fs[_0x8cf2('0x32')](_0x54e019,_0x8cf2('0x33'));}catch(_0x3756d6){logger[_0x8cf2('0x23')](_0x3756d6);}return _0x54e019[_0x8cf2('0x34')]('.')[0x0];});}function base64Encode(_0x4007e5){var _0x37c3e6=fs[_0x8cf2('0x35')](_0x4007e5);return new Buffer(_0x37c3e6)['toString'](_0x8cf2('0x30'));}exports['googleCloudTTS']=function(_0x14d282,_0x2a1fbf,_0x23bc88,_0x32efee,_0x31cf24,_0x1b305a){var _0x34c430,_0x3c5036;var _0x1fd816=_0x8cf2('0x36');var _0x4330e5=_0x8cf2('0x37')+_0x14d282;var _0xa78735={};if(_0x2a1fbf===_0x8cf2('0x38')){_0xa78735[_0x8cf2('0x39')]={'ssml':_0x23bc88};}else{_0xa78735[_0x8cf2('0x39')]={'text':_0x23bc88};};_0xa78735[_0x8cf2('0x3a')]={'languageCode':_0x32efee,'ssmlGender':_0x31cf24};_0xa78735[_0x8cf2('0x3b')]={'audioEncoding':_0x8cf2('0x3c'),'sampleRateHertz':0x1f40};var _0x5c2959={'url':_0x1fd816+_0x8cf2('0x3d')+_0x4330e5,'method':_0x8cf2('0x3e'),'json':!![],'body':_0xa78735};return rp(_0x5c2959)[_0x8cf2('0x31')](function(_0x5b4888){return new BPromise(function(_0x5566e3,_0x10031c){_0x34c430=path[_0x8cf2('0x2c')](__dirname,_0x8cf2('0x2d'),rs[_0x8cf2('0x2e')](0x4)+_0x8cf2('0x3f'));var _0x11c5a5=Buffer[_0x8cf2('0x40')](_0x5b4888[_0x8cf2('0x41')],_0x8cf2('0x30'));return fs[_0x8cf2('0x42')](_0x34c430,_0x11c5a5,function(_0x134e32){_0x10031c(_0x134e32);},function(_0x5593bb){fs[_0x8cf2('0x32')](_0x34c430,'777');_0x5566e3(_0x5593bb);});});})[_0x8cf2('0x31')](function(_0x32c03e){_0x3c5036=path[_0x8cf2('0x2c')](__dirname,_0x8cf2('0x2d'),rs[_0x8cf2('0x2e')](0x4)+_0x8cf2('0x2f'));return convertFile(_0x34c430,_0x3c5036);})['then'](function(){try{fs[_0x8cf2('0x22')](_0x34c430);fs[_0x8cf2('0x32')](_0x3c5036,_0x8cf2('0x33'));}catch(_0x553c9a){logger[_0x8cf2('0x23')](_0x553c9a);}logger[_0x8cf2('0x1f')](_0x8cf2('0x43'),_0x3c5036[_0x8cf2('0x34')]('.')[0x0]);return _0x3c5036[_0x8cf2('0x34')]('.')[0x0];});};exports[_0x8cf2('0x44')]=function(_0xf089e5,_0x255d1a){var _0x11f80d='https://translate.google.com/_/TranslateWebserverUi/data/batchexecute';var _0x5af4fa,_0x1d32b5;var _0x27bb7e;var _0x3abf5d={'encoding':_0x8cf2('0x45'),'method':_0x8cf2('0x3e'),'timeout':0x2710,'url':_0x11f80d,'headers':{'Content-Type':_0x8cf2('0x46')},'body':'f.req='+encodeURIComponent(JSON[_0x8cf2('0x47')]([[[_0x8cf2('0x48'),JSON[_0x8cf2('0x47')]([_0xf089e5,_0x255d1a||'en',![],'null']),null,_0x8cf2('0x49')]]]))};return rp(_0x3abf5d)[_0x8cf2('0x31')](function(_0x359aee){try{_0x27bb7e=eval(_0x359aee[_0x8cf2('0x4a')](0x5))[0x0][0x2];}catch(_0x40daab){throw new Error(_0x8cf2('0x4b')+_0x359aee['data']);}if(!_0x27bb7e){if(_0xf089e5[_0x8cf2('0x4c')]>0xc8){throw new Error(_0x8cf2('0x4d'));}else{throw new Error(_0x8cf2('0x4e')+_0x255d1a+_0x8cf2('0x4f'));}}try{_0x27bb7e=eval(_0x27bb7e)[0x0];}catch(_0x191609){throw new Error(_0x8cf2('0x4b')+res[_0x8cf2('0x27')]);}const _0x521295=_0x27bb7e;_0x5af4fa=path['resolve'](__dirname,'tmp',rs[_0x8cf2('0x2e')](0x4)+_0x8cf2('0x3f'));fs['writeFileSync'](_0x5af4fa,_0x27bb7e,{'encoding':_0x8cf2('0x30')});_0x1d32b5=path['resolve'](__dirname,_0x8cf2('0x2d'),rs[_0x8cf2('0x2e')](0x4)+_0x8cf2('0x2f'));return convertFile(_0x5af4fa,_0x1d32b5);})[_0x8cf2('0x31')](function(){try{fs['unlink'](_0x5af4fa);fs[_0x8cf2('0x32')](_0x1d32b5,'777');}catch(_0x101286){logger[_0x8cf2('0x23')](_0x101286);}logger[_0x8cf2('0x1f')](_0x8cf2('0x50'),_0x1d32b5[_0x8cf2('0x34')]('.')[0x0]);return _0x1d32b5[_0x8cf2('0x34')]('.')[0x0];});};exports['googleASR']=function(_0x1625d2,_0x43f9e4,_0x585351){return google[_0x8cf2('0x51')](_0x1625d2,_0x43f9e4,_0x585351)[_0x8cf2('0x31')](function(_0xce6b1b){logger['info'](_0xce6b1b[_0x8cf2('0x52')]);return rp(_0xce6b1b);})[_0x8cf2('0x31')](function(_0x5d1dda){var _0x13c417='';var _0x42c493=0x0;try{fs['unlink'](_0x1625d2);}catch(_0xe9b7c3){logger[_0x8cf2('0x23')](_0xe9b7c3);}if(_0x5d1dda&&_0x5d1dda[_0x8cf2('0x53')]){_0x13c417=_0x5d1dda[_0x8cf2('0x53')][_0x8cf2('0x54')](function(_0x31acd2){return _0x31acd2&&_0x31acd2[_0x8cf2('0x55')][0x0]&&_0x31acd2[_0x8cf2('0x55')][0x0][_0x8cf2('0x56')]?_0x31acd2['alternatives'][0x0][_0x8cf2('0x56')]:'';})['join']('\x0a');_0x42c493=_0x5d1dda[_0x8cf2('0x53')][_0x8cf2('0x54')](function(_0x2f6f80){return _0x2f6f80&&_0x2f6f80[_0x8cf2('0x55')][0x0]&&_0x2f6f80[_0x8cf2('0x55')][0x0][_0x8cf2('0x57')]?_0x2f6f80[_0x8cf2('0x55')][0x0][_0x8cf2('0x57')]:0x0;})['join']('\x0a');}logger[_0x8cf2('0x1f')](_0x8cf2('0x58'),_0x13c417);logger[_0x8cf2('0x1f')](_0x8cf2('0x59'),_0x42c493);return{'transcript':_0x13c417,'confidence':_0x42c493};})[_0x8cf2('0x5a')](function(_0x89572c){logger[_0x8cf2('0x23')](_0x8cf2('0x5b'),_0x89572c[_0x8cf2('0x19')],_0x89572c[_0x8cf2('0x5c')],_0x89572c[_0x8cf2('0x5d')]);});};exports[_0x8cf2('0x5e')]=function(_0x3c06e5,_0x9ab120,_0x3104c1,_0x32d1ff){var _0x385304=apiai(_0x9ab120,{'language':_0x32d1ff||'en'});return _0x385304['textRequest'](_0x3104c1,{'sessionId':md5(_0x3c06e5)})[_0x8cf2('0x31')](function(_0x33ec14){logger[_0x8cf2('0x1f')](JSON[_0x8cf2('0x47')](_0x33ec14));return{'source':_0x33ec14[_0x8cf2('0x5f')][_0x8cf2('0x60')],'resolvedQuery':_0x33ec14['result']['resolvedQuery'],'action':_0x33ec14['result'][_0x8cf2('0x61')],'actionIncomplete':_0x33ec14['result'][_0x8cf2('0x62')],'speech':_0x33ec14[_0x8cf2('0x5f')]['fulfillment']['speech'],'score':_0x33ec14[_0x8cf2('0x5f')]['score'],'statusCode':_0x33ec14[_0x8cf2('0x63')][_0x8cf2('0x64')],'endConversation':_0x33ec14[_0x8cf2('0x5f')]['metadata'][_0x8cf2('0x65')]||![],'isFallbackIntent':_0x33ec14[_0x8cf2('0x5f')][_0x8cf2('0x66')][_0x8cf2('0x67')]};});};exports[_0x8cf2('0x68')]=function(_0x4ee953,_0x1e3c92,_0x138880,_0x46b720,_0x5aaf01,_0x4078f8){var _0x52f735=_0x46b720['replace'](/\\n/g,'\x0a');var _0x56b86c={'credentials':{'private_key':_0x52f735,'client_email':_0x138880}};var _0x2c8417=new dialogflow[(_0x8cf2('0x69'))](_0x56b86c);var _0x40f992=_0x2c8417[_0x8cf2('0x6a')](_0x1e3c92,md5(_0x4ee953));var _0x870cee={'session':_0x40f992,'queryInput':{'text':{'text':_0x5aaf01,'languageCode':_0x4078f8}}};return _0x2c8417[_0x8cf2('0x6b')](_0x870cee)[_0x8cf2('0x31')](function(_0x301180){if(_0x301180&&_0x301180[_0x8cf2('0x4c')]){logger[_0x8cf2('0x1f')]('Dialogflow\x20V2\x20response:',JSON[_0x8cf2('0x47')](_0x301180));var _0x226427=_0x301180[0x0];if(_0x226427){var _0x10e6e6={'action':_0x226427[_0x8cf2('0x6c')][_0x8cf2('0x61')],'allRequiredParamsPresent':_0x226427['queryResult'][_0x8cf2('0x6d')],'endConversation':_0x226427[_0x8cf2('0x6c')][_0x8cf2('0x6e')]&&_0x226427['queryResult'][_0x8cf2('0x6e')]['fields']?_0x226427[_0x8cf2('0x6c')][_0x8cf2('0x6e')][_0x8cf2('0x6f')][_0x8cf2('0x70')]['boolValue']:![],'fulfillmentText':_0x226427[_0x8cf2('0x6c')][_0x8cf2('0x71')],'intentName':_0x226427[_0x8cf2('0x6c')]['intent'][_0x8cf2('0x5c')],'intentDisplayName':_0x226427[_0x8cf2('0x6c')]['intent'][_0x8cf2('0x72')],'isFallbackIntent':_0x226427[_0x8cf2('0x6c')][_0x8cf2('0x73')]['isFallback'],'languageCode':_0x226427[_0x8cf2('0x6c')][_0x8cf2('0x74')],'queryText':_0x226427[_0x8cf2('0x6c')][_0x8cf2('0x75')],'responseId':_0x226427['responseId'],'score':_0x226427[_0x8cf2('0x6c')]['intentDetectionConfidence'],'speech':_0x226427[_0x8cf2('0x6c')][_0x8cf2('0x71')],'providerResponse':JSON[_0x8cf2('0x47')](_0x301180)};return _0x10e6e6;}}});};exports[_0x8cf2('0x76')]=function(_0x16d733,_0x174ca3,_0x1efb10,_0x3522fa){return tilde['asr'](_0x16d733,_0x174ca3,_0x1efb10,_0x3522fa)[_0x8cf2('0x31')](function(_0x14664a){try{fs[_0x8cf2('0x22')](_0x16d733);}catch(_0x2fa942){logger['error'](_0x2fa942);}logger[_0x8cf2('0x1f')]('Tilde\x20ASR\x20transcription',_0x14664a['transcript']);logger['info'](_0x8cf2('0x77'),_0x14664a[_0x8cf2('0x57')]);return _0x14664a;});};exports[_0x8cf2('0x78')]=function(_0x5523c8,_0x20f896,_0x26eba6,_0x48c9de,_0x50ea8d,_0x1a110a){var _0x190f64=path[_0x8cf2('0x2c')](__dirname,_0x8cf2('0x2d'),rs[_0x8cf2('0x2e')](0x4)+'.mp3');var _0x23510b;return aws[_0x8cf2('0x79')](_0x5523c8,_0x20f896,_0x26eba6,_0x48c9de,_0x50ea8d,_0x1a110a,_0x190f64)[_0x8cf2('0x31')](function(){_0x23510b=path['resolve'](__dirname,_0x8cf2('0x2d'),rs['generate'](0x4)+_0x8cf2('0x2f'));return convertFile(_0x190f64,_0x23510b);})['then'](function(){try{fs[_0x8cf2('0x22')](_0x190f64);fs[_0x8cf2('0x32')](_0x23510b,_0x8cf2('0x33'));}catch(_0x5b2b78){logger[_0x8cf2('0x23')](_0x5b2b78);}return _0x23510b[_0x8cf2('0x34')]('.')[0x0];});};exports[_0x8cf2('0x7a')]=function(_0x3b5e89,_0x5046b1,_0x1fd6ff,_0x51dc1d,_0x40b283,_0x21ef0a){return aws['lex'](_0x3b5e89,_0x5046b1,_0x1fd6ff,_0x51dc1d,_0x40b283,_0x21ef0a)[_0x8cf2('0x31')](function(_0x4a9260){logger[_0x8cf2('0x1f')](JSON[_0x8cf2('0x47')](_0x4a9260));return _0x4a9260;});};exports[_0x8cf2('0x7b')]=function(_0x5db292,_0x3d7052,_0x9dffb2,_0x1cafef){var _0x1bef5f=util['format'](_0x8cf2('0x7c'),ISPEECH_API,_0x5db292,encodeURIComponent(_0x3d7052),_0x9dffb2,_0x1cafef);var _0x357a02=path[_0x8cf2('0x2c')](__dirname,'tmp',rs[_0x8cf2('0x2e')](0x4)+_0x8cf2('0x3f'));var _0x1aa4e8;return downloadFile(_0x1bef5f,_0x357a02)[_0x8cf2('0x31')](function(){_0x1aa4e8=path[_0x8cf2('0x2c')](__dirname,_0x8cf2('0x2d'),rs['generate'](0x4)+_0x8cf2('0x2f'));return convertFile(_0x357a02,_0x1aa4e8);})[_0x8cf2('0x31')](function(){try{fs[_0x8cf2('0x22')](_0x357a02);fs[_0x8cf2('0x32')](_0x1aa4e8,_0x8cf2('0x33'));}catch(_0x242f0b){logger[_0x8cf2('0x23')](_0x242f0b);}return _0x1aa4e8[_0x8cf2('0x34')]('.')[0x0];});};exports[_0x8cf2('0x7d')]=function(_0x4ec5e6,_0x4d94a1,_0x50629f,_0x114b33){var _0x42f901=util['format'](_0x8cf2('0x7e'),ISPEECH_API,_0x4d94a1,_0x50629f,base64Encode(_0x4ec5e6),_0x114b33?util[_0x8cf2('0x7f')]('model=%s',encodeURIComponent(_0x114b33)):_0x8cf2('0x80'));return uploadFile(_0x42f901)[_0x8cf2('0x31')](function(_0x3332e3){return querystring[_0x8cf2('0xd')](_0x3332e3);});};exports[_0x8cf2('0x81')]=function(_0x431121,_0x594cb7){return sestek['nda'](_0x431121,_0x594cb7)[_0x8cf2('0x31')](function(_0x25bcb7){logger[_0x8cf2('0x1f')](JSON[_0x8cf2('0x47')](_0x25bcb7));var _0x320597={'speech':_0x25bcb7['text'],'action':_0x25bcb7[_0x8cf2('0x82')]?_0x25bcb7[_0x8cf2('0x82')][_0x8cf2('0x83')]:undefined,'actiondata':_0x25bcb7[_0x8cf2('0x82')]?_0x25bcb7[_0x8cf2('0x82')][_0x8cf2('0x84')]:undefined};if(_0x25bcb7[_0x8cf2('0x82')]&&_0x25bcb7[_0x8cf2('0x82')][_0x8cf2('0x85')]){return base64Decode(_0x25bcb7[_0x8cf2('0x82')][_0x8cf2('0x85')]['Data'],path[_0x8cf2('0x2c')](__dirname,_0x8cf2('0x2d'),rs[_0x8cf2('0x2e')](0x4)+_0x8cf2('0x2f')))[_0x8cf2('0x31')](function(_0x12e793){_0x320597[_0x8cf2('0x86')]=_0x12e793;return _0x320597;});}return _0x320597;});};exports[_0x8cf2('0x87')]=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 ad535f7..e888b9b 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 _0xba3c=['./nda'];(function(_0x14ff51,_0x14491b){var _0x4e0122=function(_0xc7922){while(--_0xc7922){_0x14ff51['push'](_0x14ff51['shift']());}};_0x4e0122(++_0x14491b);}(_0xba3c,0x11f));var _0xcba3=function(_0x150248,_0x157d95){_0x150248=_0x150248-0x0;var _0x313f3d=_0xba3c[_0x150248];return _0x313f3d;};var nda=require(_0xcba3('0x0'));module['exports']={'nda':nda}; \ No newline at end of file +var _0x2cee=['exports','./nda'];(function(_0xae5400,_0x2fba71){var _0x5415af=function(_0x41b34e){while(--_0x41b34e){_0xae5400['push'](_0xae5400['shift']());}};_0x5415af(++_0x2fba71);}(_0x2cee,0x6d));var _0xe2ce=function(_0x59b71b,_0x480bc6){_0x59b71b=_0x59b71b-0x0;var _0x2207c6=_0x2cee[_0x59b71b];return _0x2207c6;};var nda=require(_0xe2ce('0x0'));module[_0xe2ce('0x1')]={'nda':nda}; \ No newline at end of file diff --git a/server/services/agi/scripts/sestek/nda/index.js b/server/services/agi/scripts/sestek/nda/index.js index 1fad00d..5687321 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 _0x878f=['ndauth_url','/token','password','then','ndaactivity_type','message','Nda','callerid','calleridname','extension','Bearer\x20','access_token','project','channelData','ProjectName','body','AudioOutputSettings','CustomAction','custom_action','custom_action_data','CustomActionData','info','stringify','url','../../../../../config/logger','agi','exports','POST','resolve'];(function(_0x5026f7,_0x6c0044){var _0x1cdc85=function(_0x19d310){while(--_0x19d310){_0x5026f7['push'](_0x5026f7['shift']());}};_0x1cdc85(++_0x6c0044);}(_0x878f,0x173));var _0xf878=function(_0x1790ca,_0x5ea976){_0x1790ca=_0x1790ca-0x0;var _0x46e531=_0x878f[_0x1790ca];return _0x46e531;};'use strict';var rp=require('request-promise');var url=require(_0xf878('0x0'));var logger=require(_0xf878('0x1'))(_0xf878('0x2'));module[_0xf878('0x3')]=function(_0x1b3d0b,_0x3d74cf){var _0x9e6783={'method':_0xf878('0x4'),'uri':url[_0xf878('0x5')](_0x3d74cf[_0xf878('0x6')],_0xf878('0x7')),'form':{'grant_type':'password','username':_0x3d74cf['username'],'password':_0x3d74cf[_0xf878('0x8')]},'json':!![]};return rp(_0x9e6783)[_0xf878('0x9')](function(_0x59e564){var _0x52851e={'method':'POST','uri':url[_0xf878('0x5')](_0x3d74cf['ndassistant_url'],'/api/NaturalDialogAssistant/v1/Run'),'body':{'type':_0x3d74cf[_0xf878('0xa')]||_0xf878('0xb'),'channelId':_0xf878('0xc'),'conversation':{'id':_0x1b3d0b['uniqueid']},'from':{'id':_0x1b3d0b[_0xf878('0xd')],'name':_0x1b3d0b[_0xf878('0xe')]},'recipient':{'id':_0x1b3d0b['dnid'],'name':_0x1b3d0b[_0xf878('0xf')]},'text':_0x3d74cf['text'],'channelData':{}},'headers':{'Authorization':_0xf878('0x10')+_0x59e564[_0xf878('0x11')]},'json':!![]};if(_0x3d74cf[_0xf878('0x12')]){_0x52851e['body'][_0xf878('0x13')][_0xf878('0x14')]=_0x3d74cf[_0xf878('0x12')];}if(_0x3d74cf['ndagenerate_audio']=='1'){_0x52851e[_0xf878('0x15')][_0xf878('0x13')][_0xf878('0x16')]={'Generate':!![],'PutInStructuredPart':![],'ExpectedFormat':'audio/wav'};}if(_0x3d74cf['custom_action']){_0x52851e[_0xf878('0x15')][_0xf878('0x13')][_0xf878('0x17')]=_0x3d74cf[_0xf878('0x18')];if(_0x3d74cf[_0xf878('0x19')]){_0x52851e[_0xf878('0x15')][_0xf878('0x13')][_0xf878('0x1a')]=_0x3d74cf[_0xf878('0x19')];}}logger[_0xf878('0x1b')](JSON[_0xf878('0x1c')](_0x52851e));return rp(_0x52851e);});}; \ No newline at end of file +var _0x570f=['POST','resolve','ndauth_url','/token','username','then','/api/NaturalDialogAssistant/v1/Run','ndaactivity_type','message','Nda','uniqueid','calleridname','dnid','extension','Bearer\x20','access_token','project','channelData','ProjectName','ndagenerate_audio','AudioOutputSettings','audio/wav','custom_action','body','CustomAction','custom_action_data','info','stringify','request-promise','url','../../../../../config/logger'];(function(_0x14600e,_0x4bf8c9){var _0x388a5a=function(_0x582388){while(--_0x582388){_0x14600e['push'](_0x14600e['shift']());}};_0x388a5a(++_0x4bf8c9);}(_0x570f,0x152));var _0xf570=function(_0x4206f9,_0xbb9cd1){_0x4206f9=_0x4206f9-0x0;var _0x47cfda=_0x570f[_0x4206f9];return _0x47cfda;};'use strict';var rp=require(_0xf570('0x0'));var url=require(_0xf570('0x1'));var logger=require(_0xf570('0x2'))('agi');module['exports']=function(_0x1904b3,_0x3f4fef){var _0x1ed19d={'method':_0xf570('0x3'),'uri':url[_0xf570('0x4')](_0x3f4fef[_0xf570('0x5')],_0xf570('0x6')),'form':{'grant_type':'password','username':_0x3f4fef[_0xf570('0x7')],'password':_0x3f4fef['password']},'json':!![]};return rp(_0x1ed19d)[_0xf570('0x8')](function(_0x5910a8){var _0x2575c0={'method':'POST','uri':url[_0xf570('0x4')](_0x3f4fef['ndassistant_url'],_0xf570('0x9')),'body':{'type':_0x3f4fef[_0xf570('0xa')]||_0xf570('0xb'),'channelId':_0xf570('0xc'),'conversation':{'id':_0x1904b3[_0xf570('0xd')]},'from':{'id':_0x1904b3['callerid'],'name':_0x1904b3[_0xf570('0xe')]},'recipient':{'id':_0x1904b3[_0xf570('0xf')],'name':_0x1904b3[_0xf570('0x10')]},'text':_0x3f4fef['text'],'channelData':{}},'headers':{'Authorization':_0xf570('0x11')+_0x5910a8[_0xf570('0x12')]},'json':!![]};if(_0x3f4fef[_0xf570('0x13')]){_0x2575c0['body'][_0xf570('0x14')][_0xf570('0x15')]=_0x3f4fef[_0xf570('0x13')];}if(_0x3f4fef[_0xf570('0x16')]=='1'){_0x2575c0['body'][_0xf570('0x14')][_0xf570('0x17')]={'Generate':!![],'PutInStructuredPart':![],'ExpectedFormat':_0xf570('0x18')};}if(_0x3f4fef[_0xf570('0x19')]){_0x2575c0[_0xf570('0x1a')][_0xf570('0x14')][_0xf570('0x1b')]=_0x3f4fef[_0xf570('0x19')];if(_0x3f4fef[_0xf570('0x1c')]){_0x2575c0[_0xf570('0x1a')][_0xf570('0x14')]['CustomActionData']=_0x3f4fef[_0xf570('0x1c')];}}logger[_0xf570('0x1d')](JSON[_0xf570('0x1e')](_0x2575c0));return rp(_0x2575c0);});}; \ 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 e6ba18a..c2f56cf 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 _0x11e9=['exports'];(function(_0x158e09,_0xa01b44){var _0xda60e4=function(_0x570cb6){while(--_0x570cb6){_0x158e09['push'](_0x158e09['shift']());}};_0xda60e4(++_0xa01b44);}(_0x11e9,0xb3));var _0x911e=function(_0x3ee7db,_0x586a2a){_0x3ee7db=_0x3ee7db-0x0;var _0x555965=_0x11e9[_0x3ee7db];return _0x555965;};'use strict';var asr=require('./lib/api');module[_0x911e('0x0')]=function(_0x41def5,_0x9f9ec7,_0x11c585,_0x3352c2){return asr(_0x41def5,_0x9f9ec7,_0x11c585,_0x3352c2);}; \ No newline at end of file +var _0x289a=['./lib/api','exports'];(function(_0x21d15e,_0x308a5f){var _0x499a97=function(_0x54b30a){while(--_0x54b30a){_0x21d15e['push'](_0x21d15e['shift']());}};_0x499a97(++_0x308a5f);}(_0x289a,0x118));var _0xa289=function(_0x2d34d6,_0x397ff9){_0x2d34d6=_0x2d34d6-0x0;var _0x1d3d12=_0x289a[_0x2d34d6];return _0x1d3d12;};'use strict';var asr=require(_0xa289('0x0'));module[_0xa289('0x1')]=function(_0x5dd9d9,_0x54527a,_0x4916a4,_0x4a663c){return asr(_0x5dd9d9,_0x54527a,_0x4916a4,_0x4a663c);}; \ 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 9df9e8f..677fb72 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 _0xfea3=['result','final','Tilde\x20ASR\x20hypoteses','hypotheses','likelihood','Success.','Aborted.\x20Recognition\x20was\x20aborted\x20for\x20some\x20reason.','Not\x20available.\x20Max\x20load\x20limit\x20reached.','Authentication\x20failed.','All\x20recognition\x20workers\x20are\x20currently\x20in\x20use\x20and\x20real-time\x20recognition\x20is\x20not\x20possible.','terminate','Close\x20Tilde\x20ASR\x20socket','Error\x20Tilde\x20ASR\x20socket','isNil','isObject','message','bluebird','lodash','agi','exports','wss://runa.tilde.lv/client/ws/speech/LVASR-ONLINE','No\x20speech.\x20Sent\x20when\x20the\x20incoming\x20audio\x20contains\x20a\x20large\x20portion\x20of\x20silence\x20or\x20non-speech','createHash','sha1','update','digest','hex','info','Open\x20Tilde\x20ASR\x20socket','unix','send','stringify','createReadStream','data','close','EOS','error'];(function(_0x836465,_0x5442ae){var _0x2150ea=function(_0x4f4bc2){while(--_0x4f4bc2){_0x836465['push'](_0x836465['shift']());}};_0x2150ea(++_0x5442ae);}(_0xfea3,0x15d));var _0x3fea=function(_0x2d0679,_0x535d5f){_0x2d0679=_0x2d0679-0x0;var _0x344700=_0xfea3[_0x2d0679];return _0x344700;};'use strict';var BPromise=require(_0x3fea('0x0'));var _=require(_0x3fea('0x1'));var fs=require('fs');var WebSocket=require('ws');var moment=require('moment');var crypto=require('crypto');var logger=require('../../../../../../config/logger')(_0x3fea('0x2'));module[_0x3fea('0x3')]=function(_0x5721e3,_0x1fa5b8,_0x30ba28,_0x2d90b5){return new BPromise(function(_0xa3b188,_0x16d98c){logger['info']('Tilde\x20URI',_0x2d90b5||'wss://runa.tilde.lv/client/ws/speech/LVASR-ONLINE');var _0x3682dc=new WebSocket(_0x2d90b5||_0x3fea('0x4'),{'perMessageDeflate':![]});var _0x490877='';var _0x52febe='0';var _0x5778f8='1';var _0xc3ef0b=_0x3fea('0x5');function _0x360d4(_0x3b52fd){var _0x8e6914=crypto[_0x3fea('0x6')](_0x3fea('0x7'));_0x8e6914[_0x3fea('0x8')](_0x3b52fd);return _0x8e6914[_0x3fea('0x9')](_0x3fea('0xa'));}function _0x512b9f(){try{logger[_0x3fea('0xb')](_0x3fea('0xc'));var _0x65c990=moment()[_0x3fea('0xd')]();var _0x2d3501=_0x360d4(_0x65c990+_0x1fa5b8+_0x30ba28);_0x3682dc[_0x3fea('0xe')](JSON[_0x3fea('0xf')]({'appID':_0x1fa5b8,'timestamp':_0x65c990,'appKey':_0x2d3501}));var _0x297c0e=fs[_0x3fea('0x10')](_0x5721e3);_0x297c0e['on'](_0x3fea('0x11'),function(_0x4ec25a){_0x3682dc[_0x3fea('0xe')](_0x4ec25a);});_0x297c0e['on'](_0x3fea('0x12'),function(){_0x3682dc['send'](_0x3fea('0x13'));});}catch(_0x522642){logger[_0x3fea('0x14')]('Tilde\x20ASR\x20send\x20error',JSON[_0x3fea('0xf')](_0x522642));_0x3682dc['terminate']();}}function _0x8d6c58(_0x3cf218){try{if(_0x3cf218){var _0x53b1b0=JSON['parse'](_0x3cf218);switch(_0x53b1b0['status']){case 0x0:if(_0x53b1b0[_0x3fea('0x15')]){if(_0x53b1b0[_0x3fea('0x15')][_0x3fea('0x16')]){logger[_0x3fea('0xb')](_0x3fea('0x17'),JSON[_0x3fea('0xf')](_0x53b1b0[_0x3fea('0x15')][_0x3fea('0x18')]));_0x490877=_0x53b1b0[_0x3fea('0x15')][_0x3fea('0x18')][0x0]['transcript'];_0x52febe=_0x53b1b0[_0x3fea('0x15')][_0x3fea('0x18')][0x0][_0x3fea('0x19')];_0x5778f8='0';_0xc3ef0b=_0x3fea('0x1a');_0x3682dc['terminate']();}}break;case 0x1:logger['info'](_0x3fea('0x5'));_0x5778f8='1';_0xc3ef0b=_0x3fea('0x5');break;case 0x2:logger['info'](_0x3fea('0x1b'));_0x5778f8='2';_0xc3ef0b=_0x3fea('0x1b');break;case 0x9:logger[_0x3fea('0xb')](_0x3fea('0x1c'));_0x5778f8='9';_0xc3ef0b=_0x3fea('0x1c');break;case 0xa:logger[_0x3fea('0xb')](_0x3fea('0x1d'));_0x5778f8='10';_0xc3ef0b=_0x3fea('0x1d');break;case 0xb:logger[_0x3fea('0xb')](_0x3fea('0x1e'));_0x5778f8='11';_0xc3ef0b='All\x20recognition\x20workers\x20are\x20currently\x20in\x20use\x20and\x20real-time\x20recognition\x20is\x20not\x20possible.';}}}catch(_0x27f06d){logger['error']('Tilde\x20ASR\x20parse\x20error',JSON[_0x3fea('0xf')](_0x27f06d));_0x3682dc[_0x3fea('0x1f')]();}}function _0x5eb2dd(){logger[_0x3fea('0xb')](_0x3fea('0x20'));_0xa3b188({'transcript':_0x490877,'confidence':_0x52febe,'status':_0x5778f8,'status_message':_0xc3ef0b});}function _0x3c8063(_0x220a9c){logger[_0x3fea('0x14')](_0x3fea('0x21'));if(!_[_0x3fea('0x22')](_0x220a9c)){logger['error'](_[_0x3fea('0x23')](_0x220a9c)?JSON[_0x3fea('0xf')](_0x220a9c):_0x220a9c);}}_0x3682dc['on']('open',_0x512b9f);_0x3682dc['on'](_0x3fea('0x24'),_0x8d6c58);_0x3682dc['on'](_0x3fea('0x12'),_0x5eb2dd);_0x3682dc['on']('error',_0x3c8063);});}; \ No newline at end of file +var _0x4922=['Not\x20available.\x20Max\x20load\x20limit\x20reached.','Authentication\x20failed.','All\x20recognition\x20workers\x20are\x20currently\x20in\x20use\x20and\x20real-time\x20recognition\x20is\x20not\x20possible.','error','Tilde\x20ASR\x20parse\x20error','Close\x20Tilde\x20ASR\x20socket','Error\x20Tilde\x20ASR\x20socket','isObject','message','close','bluebird','moment','crypto','../../../../../../config/logger','agi','exports','info','Tilde\x20URI','wss://runa.tilde.lv/client/ws/speech/LVASR-ONLINE','No\x20speech.\x20Sent\x20when\x20the\x20incoming\x20audio\x20contains\x20a\x20large\x20portion\x20of\x20silence\x20or\x20non-speech','createHash','sha1','update','digest','hex','Open\x20Tilde\x20ASR\x20socket','send','stringify','Tilde\x20ASR\x20send\x20error','terminate','parse','status','result','final','Tilde\x20ASR\x20hypoteses','hypotheses','transcript','likelihood','Aborted.\x20Recognition\x20was\x20aborted\x20for\x20some\x20reason.'];(function(_0x20a584,_0xe384a5){var _0x4b41a8=function(_0x2127c6){while(--_0x2127c6){_0x20a584['push'](_0x20a584['shift']());}};_0x4b41a8(++_0xe384a5);}(_0x4922,0xf4));var _0x2492=function(_0xba1076,_0x130e38){_0xba1076=_0xba1076-0x0;var _0x4e9ea4=_0x4922[_0xba1076];return _0x4e9ea4;};'use strict';var BPromise=require(_0x2492('0x0'));var _=require('lodash');var fs=require('fs');var WebSocket=require('ws');var moment=require(_0x2492('0x1'));var crypto=require(_0x2492('0x2'));var logger=require(_0x2492('0x3'))(_0x2492('0x4'));module[_0x2492('0x5')]=function(_0x6a993c,_0x2e91a6,_0x2cb35b,_0x188756){return new BPromise(function(_0x7b2b72,_0x38e6ae){logger[_0x2492('0x6')](_0x2492('0x7'),_0x188756||_0x2492('0x8'));var _0x10816c=new WebSocket(_0x188756||_0x2492('0x8'),{'perMessageDeflate':![]});var _0x5c776e='';var _0xfc5567='0';var _0x1ee3a7='1';var _0x3bef29=_0x2492('0x9');function _0x5e7241(_0x5e5b5a){var _0x3af068=crypto[_0x2492('0xa')](_0x2492('0xb'));_0x3af068[_0x2492('0xc')](_0x5e5b5a);return _0x3af068[_0x2492('0xd')](_0x2492('0xe'));}function _0x1450bb(){try{logger[_0x2492('0x6')](_0x2492('0xf'));var _0x4e35a3=moment()['unix']();var _0x568762=_0x5e7241(_0x4e35a3+_0x2e91a6+_0x2cb35b);_0x10816c[_0x2492('0x10')](JSON[_0x2492('0x11')]({'appID':_0x2e91a6,'timestamp':_0x4e35a3,'appKey':_0x568762}));var _0x5434a6=fs['createReadStream'](_0x6a993c);_0x5434a6['on']('data',function(_0x121d46){_0x10816c[_0x2492('0x10')](_0x121d46);});_0x5434a6['on']('close',function(){_0x10816c[_0x2492('0x10')]('EOS');});}catch(_0x3e5c9e){logger['error'](_0x2492('0x12'),JSON[_0x2492('0x11')](_0x3e5c9e));_0x10816c[_0x2492('0x13')]();}}function _0x4e6a1f(_0x1a936f){try{if(_0x1a936f){var _0x1602a2=JSON[_0x2492('0x14')](_0x1a936f);switch(_0x1602a2[_0x2492('0x15')]){case 0x0:if(_0x1602a2[_0x2492('0x16')]){if(_0x1602a2[_0x2492('0x16')][_0x2492('0x17')]){logger[_0x2492('0x6')](_0x2492('0x18'),JSON[_0x2492('0x11')](_0x1602a2['result'][_0x2492('0x19')]));_0x5c776e=_0x1602a2['result'][_0x2492('0x19')][0x0][_0x2492('0x1a')];_0xfc5567=_0x1602a2[_0x2492('0x16')][_0x2492('0x19')][0x0][_0x2492('0x1b')];_0x1ee3a7='0';_0x3bef29='Success.';_0x10816c[_0x2492('0x13')]();}}break;case 0x1:logger[_0x2492('0x6')](_0x2492('0x9'));_0x1ee3a7='1';_0x3bef29=_0x2492('0x9');break;case 0x2:logger[_0x2492('0x6')](_0x2492('0x1c'));_0x1ee3a7='2';_0x3bef29=_0x2492('0x1c');break;case 0x9:logger[_0x2492('0x6')]('Not\x20available.\x20Max\x20load\x20limit\x20reached.');_0x1ee3a7='9';_0x3bef29=_0x2492('0x1d');break;case 0xa:logger[_0x2492('0x6')]('Authentication\x20failed.');_0x1ee3a7='10';_0x3bef29=_0x2492('0x1e');break;case 0xb:logger[_0x2492('0x6')](_0x2492('0x1f'));_0x1ee3a7='11';_0x3bef29=_0x2492('0x1f');}}}catch(_0x400af2){logger[_0x2492('0x20')](_0x2492('0x21'),JSON[_0x2492('0x11')](_0x400af2));_0x10816c['terminate']();}}function _0x342162(){logger[_0x2492('0x6')](_0x2492('0x22'));_0x7b2b72({'transcript':_0x5c776e,'confidence':_0xfc5567,'status':_0x1ee3a7,'status_message':_0x3bef29});}function _0xd15530(_0x3099ff){logger['error'](_0x2492('0x23'));if(!_['isNil'](_0x3099ff)){logger[_0x2492('0x20')](_[_0x2492('0x24')](_0x3099ff)?JSON[_0x2492('0x11')](_0x3099ff):_0x3099ff);}}_0x10816c['on']('open',_0x1450bb);_0x10816c['on'](_0x2492('0x25'),_0x4e6a1f);_0x10816c['on'](_0x2492('0x26'),_0x342162);_0x10816c['on'](_0x2492('0x20'),_0xd15530);});}; \ 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 1041753..6a3d910 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 _0xafca=['exports'];(function(_0x5ee1f5,_0x4d0591){var _0x2e2963=function(_0x5d915){while(--_0x5d915){_0x5ee1f5['push'](_0x5ee1f5['shift']());}};_0x2e2963(++_0x4d0591);}(_0xafca,0xae));var _0xaafc=function(_0x20a584,_0xe384a5){_0x20a584=_0x20a584-0x0;var _0x4b41a8=_0xafca[_0x20a584];return _0x4b41a8;};var asr=require('./asr');module[_0xaafc('0x0')]={'asr':asr}; \ No newline at end of file +var _0xac51=['exports'];(function(_0xab98b7,_0x4f1dcb){var _0x31e5fa=function(_0xbb323c){while(--_0xbb323c){_0xab98b7['push'](_0xab98b7['shift']());}};_0x31e5fa(++_0x4f1dcb);}(_0xac51,0x8b));var _0x1ac5=function(_0x779693,_0x382cf9){_0x779693=_0x779693-0x0;var _0x5a91c1=_0xac51[_0x779693];return _0x5a91c1;};var asr=require('./asr');module[_0x1ac5('0x0')]={'asr':asr}; \ No newline at end of file diff --git a/server/services/agi/server.js b/server/services/agi/server.js index 97c354b..a6b0aab 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 _0xa9e0=['ready','E_AGI_SERVER_ERROR','close','E_AGI_SERVER_CLOSE','inherits','exports','util','net','events','./channel','call','emit','createServer','listening','connection','getConnections','error','E_AGI_SERVER_VOICE_DISABLED','destroy'];(function(_0x58afd5,_0x534a48){var _0x3e503b=function(_0x27ba44){while(--_0x27ba44){_0x58afd5['push'](_0x58afd5['shift']());}};_0x3e503b(++_0x534a48);}(_0xa9e0,0x123));var _0x0a9e=function(_0x1ac595,_0x5d2081){_0x1ac595=_0x1ac595-0x0;var _0x455fff=_0xa9e0[_0x1ac595];return _0x455fff;};'use strict';var util=require(_0x0a9e('0x0'));var net=require(_0x0a9e('0x1'));var EventEmitter=require(_0x0a9e('0x2'))['EventEmitter'];var AGIError=require('./error');var AGIChannel=require(_0x0a9e('0x3'));var AGIServer=function(_0x4ce2f1,_0x333808,_0x432180){var _0x2ab90b=this;var _0x991246=null;var _0x981158=0x0;if(!_0x4ce2f1)_0x4ce2f1=0x11dd;if(!_0x333808)_0x333808='127.0.0.1';EventEmitter[_0x0a9e('0x4')](_0x2ab90b);function _0x441e3a(){if(!_0x4ce2f1){_0x2ab90b[_0x0a9e('0x5')]('error',new AGIError('E_AGI_ARGUMENT_PORT'));return![];}_0x991246=net[_0x0a9e('0x6')]();_0x991246['listen'](_0x4ce2f1,_0x333808);_0x991246['on']('listening',function(){_0x2ab90b[_0x0a9e('0x5')](_0x0a9e('0x7'));});_0x991246['on'](_0x0a9e('0x8'),function(_0x3ab53f){_0x991246[_0x0a9e('0x9')](function(_0xbd1168,_0x4a4c56){if(_0xbd1168){_0x2ab90b['emit']('error',new AGIError('E_AGI_SERVER_ERROR',_0xbd1168));}else if(_0x432180&&_0x432180<0x0){_0x2ab90b[_0x0a9e('0x5')](_0x0a9e('0xa'),new AGIError(_0x0a9e('0xb')));_0x3ab53f[_0x0a9e('0xc')]();}else if(_0x432180&&_0x432180>0x0&&_0x432180<_0x4a4c56){_0x981158+=0x1;_0x2ab90b[_0x0a9e('0x5')](_0x0a9e('0xa'),new AGIError('E_AGI_SERVER_MAXCONNECTION',_0x981158));_0x3ab53f[_0x0a9e('0xc')]();}else{var _0x239b12=new AGIChannel(_0x3ab53f);_0x239b12['on'](_0x0a9e('0xd'),function(){_0x2ab90b[_0x0a9e('0x5')](_0x0a9e('0x8'),_0x239b12);});}});});_0x991246['on'](_0x0a9e('0xa'),function(_0x52a03d){_0x2ab90b[_0x0a9e('0x5')]('error',new AGIError(_0x0a9e('0xe'),_0x52a03d['code']));});_0x991246['on'](_0x0a9e('0xf'),function(){_0x2ab90b[_0x0a9e('0x5')]('close',new AGIError(_0x0a9e('0x10')));});}process['nextTick'](function(){_0x441e3a();});};util[_0x0a9e('0x11')](AGIServer,EventEmitter);module[_0x0a9e('0x12')]=function(_0x106033,_0x205fd6,_0x31b1ca){return new AGIServer(_0x106033,_0x205fd6,_0x31b1ca);}; \ No newline at end of file +var _0xe706=['connection','getConnections','E_AGI_SERVER_ERROR','E_AGI_SERVER_VOICE_DISABLED','destroy','E_AGI_SERVER_MAXCONNECTION','close','nextTick','exports','util','net','events','./error','./channel','127.0.0.1','call','emit','error','E_AGI_ARGUMENT_PORT','createServer','listen','listening'];(function(_0x2a7b50,_0x545d55){var _0x4224c9=function(_0x2b96f6){while(--_0x2b96f6){_0x2a7b50['push'](_0x2a7b50['shift']());}};_0x4224c9(++_0x545d55);}(_0xe706,0xa3));var _0x6e70=function(_0x36c0d1,_0x1d9948){_0x36c0d1=_0x36c0d1-0x0;var _0x59c859=_0xe706[_0x36c0d1];return _0x59c859;};'use strict';var util=require(_0x6e70('0x0'));var net=require(_0x6e70('0x1'));var EventEmitter=require(_0x6e70('0x2'))['EventEmitter'];var AGIError=require(_0x6e70('0x3'));var AGIChannel=require(_0x6e70('0x4'));var AGIServer=function(_0x2ca810,_0x7dfbc3,_0x142c27){var _0x2164a4=this;var _0x376a8d=null;var _0x506db9=0x0;if(!_0x2ca810)_0x2ca810=0x11dd;if(!_0x7dfbc3)_0x7dfbc3=_0x6e70('0x5');EventEmitter[_0x6e70('0x6')](_0x2164a4);function _0x36357b(){if(!_0x2ca810){_0x2164a4[_0x6e70('0x7')](_0x6e70('0x8'),new AGIError(_0x6e70('0x9')));return![];}_0x376a8d=net[_0x6e70('0xa')]();_0x376a8d[_0x6e70('0xb')](_0x2ca810,_0x7dfbc3);_0x376a8d['on'](_0x6e70('0xc'),function(){_0x2164a4[_0x6e70('0x7')](_0x6e70('0xc'));});_0x376a8d['on'](_0x6e70('0xd'),function(_0x743eb5){_0x376a8d[_0x6e70('0xe')](function(_0x37b3e0,_0x4600f9){if(_0x37b3e0){_0x2164a4['emit']('error',new AGIError(_0x6e70('0xf'),_0x37b3e0));}else if(_0x142c27&&_0x142c27<0x0){_0x2164a4[_0x6e70('0x7')](_0x6e70('0x8'),new AGIError(_0x6e70('0x10')));_0x743eb5[_0x6e70('0x11')]();}else if(_0x142c27&&_0x142c27>0x0&&_0x142c27<_0x4600f9){_0x506db9+=0x1;_0x2164a4[_0x6e70('0x7')](_0x6e70('0x8'),new AGIError(_0x6e70('0x12'),_0x506db9));_0x743eb5['destroy']();}else{var _0x52737e=new AGIChannel(_0x743eb5);_0x52737e['on']('ready',function(){_0x2164a4[_0x6e70('0x7')]('connection',_0x52737e);});}});});_0x376a8d['on']('error',function(_0x304716){_0x2164a4[_0x6e70('0x7')]('error',new AGIError(_0x6e70('0xf'),_0x304716['code']));});_0x376a8d['on'](_0x6e70('0x13'),function(){_0x2164a4[_0x6e70('0x7')]('close',new AGIError('E_AGI_SERVER_CLOSE'));});}process[_0x6e70('0x14')](function(){_0x36357b();});};util['inherits'](AGIServer,EventEmitter);module[_0x6e70('0x15')]=function(_0x173afe,_0x53acdc,_0x497d61){return new AGIServer(_0x173afe,_0x53acdc,_0x497d61);}; \ No newline at end of file diff --git a/server/services/agi/vertices.js b/server/services/agi/vertices.js index 858819a..ab099fd 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 _0xaf93=['googleDialogflowV2','dialogflowV2_project_id','client_email','private_key','dialogflowV2_language','sestekNDA','ispeechTTS','key','ispeechASR','ispeech_asr_language','model','aws_access_key_id','aws_secret_access_key','aws_polly_region','aws_polly_voice','aws_text_type','awsLex','googleASR','tildeASR','appid','appsecret','clear','includes','isString','replaceObjectAllVariables','replaceAllVariables','recursiveNodeIndex','isPlainObject','isArray','length','saveRestApiResult','hasOwnProperty','%s.%s','setVariable','split','replaceAll','getAndSetVariable','The\x20\x22%s\x22\x20variable\x20value\x20is:\x20%s','extra','isConfigured','retry','maxRetry','label','noop','no\x20text\x20configured','result','mrcprecog','Enter\x20in\x20MRCPRecog\x20(%s)\x20block','grammar','no\x20grammar\x20configured','MRCPRecog','MRCP_RECOG_CONFIDENCE','RECOG_INPUT()','MRCP_RECOG_TRANSCRIPT','Enter\x20in\x20AGI\x20(%s)\x20block','command','args','answer','Enter\x20in\x20ANSWER\x20(%s)\x20block','Wait\x20%s\x20seconds\x20before\x20answer','wait','Enter\x20in\x20CALLBACK\x20(%s)\x20block','no\x20list\x20selected','delay','minutes','callback_priority','CALLBACK\x20added\x20phone:\x20%s\x20on\x20list:\x20%s\x20at\x20%s','custom_app','Enter\x20in\x20CUSTOM\x20APP\x20(%s)\x20block','Executed\x20command\x20%s\x20%s','MRCPSynth','sestektts','Enter\x20in\x20SESTEKTTS\x20(%s)\x20block','Executed\x20command\x20MRCPSynth\x20%s','lumenvoxasr','Enter\x20in\x20LUMENVOXASR\x20(%s)\x20block','RECOG_CONFIDENCE()','LUMENVOX_ASR_CONFIDENCE','LUMENVOX_ASR_TRANSCRIPT','LUMENVOX_ASR_INSTANCE','Executed\x20command\x20MRCPRecog\x20%s','Enter\x20in\x20SESTEKASR\x20(%s)\x20block','SESTEK_ASR_TRANSCRIPT','RECOG_INSTANCE()','SESTEK_ASR_INSTANCE','database','Enter\x20in\x20DATABASE\x20(%s)\x20block','odbc_id','no\x20database\x20selected','no\x20odbc\x20database\x20found','no\x20query\x20configured','replace','query:\x20%s','variable_id','no\x20variable\x20selected\x20for\x20the\x20result','no\x20variable\x20found','forEach','keys','%s[%s][%s]','%s_ROWS_COUNT','variable\x20%s\x20set','dial','debug','Enter\x20in\x20DIAL\x20(%s)\x20block','sip_id','no\x20user\x20selected','no\x20user\x20found','DIAL','SIP/%s','opts','Executed\x20command\x20%s','Enter\x20in\x20DIALOGFLOW\x20(%s)\x20block','no\x20key\x20configured','bot','Trying\x20Dialogflow:\x20%s','DIALOGFLOW_%s','out','dialogflow','Dialogflow\x20Result\x20%s','Dialogflow\x20is\x20unreachable','dialogflowV2','Enter\x20in\x20DIALOGFLOW\x20V2\x20(%s)\x20block','no\x20private_key\x20configured','no\x20anguage\x20configured','speech','DialogflowV2\x20is\x20unreachable','sesteknda','ndauth_url','username','no\x20username\x20configured','password','no\x20password\x20configured','ndassistant_url','Trying\x20SestekNDA:\x20%s','SESTEK_NDA_%s','audiofile','Sestek\x20NDA\x20%s\x20file\x20created','streamFile','unlink','.wav','SestekNDA\x20Result\x20%s','SestekNDA\x20is\x20unreachable','end','Enter\x20in\x20END\x20(%s)\x20block','Enter\x20in\x20EXTERNAL\x20DIAL\x20(%s)\x20block','trunk_id','no\x20trunk\x20selected','getTrunk','no\x20trunk\x20found','trunk_name','SIP/%s/%s','finally','Enter\x20in\x20FINALLY\x20(%s)\x20block','getdigits','Enter\x20in\x20GETDIGITS\x20(%s)\x20block','no\x20file\x20audio\x20selected','file_id','no\x20file\x20audio\x20found','getData','response','mindigit','hiddendigitsnum','generate','hiddendigitspos','first','substr','Enter\x20in\x20GETSECRETDIGITS\x20(%s)\x20block','goal','Enter\x20in\x20GOAL\x20(%s)\x20block','goalname','GOAL\x20%s','awspolly','[AGI]\x20Enter\x20in\x20AWSPOLLY\x20(%s)\x20block','no\x20valid\x20credentials\x20configured','aws\x20Polly\x20%s\x20file\x20created','aws\x20Polly\x20is\x20unreachable','awslex','Enter\x20in\x20Amazon\x20Lex\x20(%s)\x20block','AWS_LEX_%s','Amazon\x20Lex\x20ready\x20for\x20fulfillment','amazonlex','Amazon\x20Lex\x20is\x20unreachable','googleasr','Enter\x20in\x20GOOGLEASR\x20(%s)\x20block\x20%s','%s/recordings/%s','beep','google\x20%s\x20file\x20created','GOOGLE_ASR_%s','GoogleASR\x20Result\x20%s','tildeasr','no\x20appid\x20configured','no\x20appsecret\x20configured','NOBEEP','recordFile','intKey','tilde\x20%s\x20file\x20created','TILDE_ASR_%s','Enter\x20in\x20GOTO\x20(%s)\x20block','extension','gotoif','Enter\x20in\x20GOTOIF\x20(%s)\x20block','condition','true','false','EVAL\x20CONDITION\x20%s\x20%s','gotoiftime','Enter\x20in\x20GOTOIFTIME\x20(%s)\x20block','interval_id','no\x20interval\x20configured','IFTIME(%s?true:false)','IFTIME\x20%s\x20%s','hangup','wav','ispeech\x20%s\x20file\x20created','IspeechASR\x20Result\x20%s','ispeechtts','Enter\x20in\x20ISPEECHTTS\x20(%s)\x20block','Trying\x20ispeech\x20TTS\x20%s','ispeech\x20TTS\x20is\x20unreachable','login','Enter\x20in\x20LOGIN\x20(%s)\x20block','no\x20find\x20by\x20configured','findBy','AGENT\x20%s\x20FOUND\x20BY','AGENT\x20%s\x20NOT\x20FOUND\x20BY','Enter\x20in\x20LOGOUT\x20(%s)\x20block','FIND\x20AGENT\x20%s\x20BY\x20%s','agentLogout','failure','math','Enter\x20in\x20MATH\x20(%s)\x20block','operation','no\x20operation\x20configured','math\x20%s','variable\x20%s[key]\x20set','Enter\x20in\x20NOOP\x20(%s)\x20block','output','pause','Enter\x20in\x20PAUSE\x20(%s)\x20block','pause_id','success','playback','Enter\x20in\x20PLAYBACK\x20(%s)\x20block','queue','Enter\x20in\x20QUEUE\x20(%s)\x20block','queue_id','no\x20queue\x20selected','getVoiceQueue','no\x20queue\x20found','indexOf','toLowerCase','QUEUE','macro','record','Enter\x20in\x20RECORD\x20(%s)\x20block','recordingFormat','%s_%s','%s/recordings/%s.%s','RECORDING_SAVENAME','Recording\x20%s\x20%s\x20%s\x20%s','escape_digits','Enter\x20in\x20RESTAPI\x20(%s)\x20block','no\x20url\x20configured','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','sayDigits','digits','sayNumber','sayphonetic','Enter\x20in\x20SAYPHONETIC\x20(%s)\x20block','sayPhonetic','sendMail','account_id','no\x20mail\x20account\x20configured','getMailAccount','Smtp','no\x20mail\x20account\x20found','\x22%s\x22\x20<%s>','user','bcc','subject','template_id','smtpOptions','Mail\x20message\x20added\x20to\x20outgoing\x20process','sendFax','Enter\x20in\x20SENDFAX\x20(%s)\x20block','SENDFAX\x20block\x20not\x20implemented','sendSMS','Enter\x20in\x20SENDSMS\x20(%s)\x20block','no\x20sms\x20account\x20configured','getSmsAccount','sms_account_id','sms_text','sendSMS\x20message','Trying\x20SendSMS\x20with\x20account\x20%s','Sms\x20message\x20added\x20to\x20outgoing\x20process','set','Enter\x20in\x20SET\x20(%s)\x20block','no\x20variable\x20selected','variable_value','start','Enter\x20in\x20START\x20(%s)\x20block','XMCS-UNIQUEID','Answer','Skipped\x20Answer','subproject','no\x20subproject\x20found\x20with\x20id\x20%d','project_id','project\x20in\x20subproject\x20must\x20be\x20different\x20from\x20the\x20called\x20project','agi://%s/square,\x22%s\x22,\x22%s\x22','127.0.0.1','AGI','system','Enter\x20in\x20SYSTEM\x20(%s)\x20block','sh\x20command:\x20%s\x20result\x20no\x20stored','Enter\x20in\x20Google\x20Cloud\x20TTS\x20(%s)\x20block','no\x20apiKey\x20configured','Google\x20Cloud\x20TTS\x20%s\x20file\x20created','Google\x20Cloud\x20TTS\x20is\x20unreachable','Enter\x20in\x20GOOGLETTS\x20(%s)\x20block','Trying\x20Google\x20TTS\x20%s','Google\x20TTS\x20%s\x20file\x20created','Google\x20TTS\x20is\x20unreachable','unpause','Enter\x20in\x20UNPAUSE\x20(%s)\x20block','Enter\x20in\x20VOICEMAIL\x20(%s)\x20block','VOICEMAIL','mailbox','vswitch','Enter\x20in\x20SWITCH\x20(%s)\x20block','join','exports','util','lodash','randomstring','moment','request-promise','../../config/logger','agi','../../config/environment','./scripts','/var/opt/motion2/server/files','rawHeaders','menu','getsecretdigits','mailRpc','prototype','getVariable','rpc','getVariableById','then','name','catch','getVoiceQueueById','getSquareProject','getSquareOdbc','getSquareOdbcById','dsn','getUser','getTrunkById','getSound','getSoundById','save_name','sendMailMessage','getIntervals','IntervalId','interval','map','%s/sounds/converted/%s','open','error','ODBC\x20connection\x20successfully','query','info','Query\x20executed\x20correctly\x20%s','close','Error\x20closing\x20connection\x20to\x20odbc\x20%s','getSmsAccountById','createSmsMessage','createSquareDetailsReport','channel','agicommand','arg_1','callerid','createSquareRecording','calleridname','context','priority','dnid','createSquareMessage','createCmContact','isEmpty','isNil','lastName','phone','list_id','scheduledAt','uniqueid','Callback\x20scheduled\x20at\x20','getPauseById','agentPause','agent','agentUnpause','agentLogin','format','%s/%s@from-sip/n','LOCAL','shellCommand','exec','googleCloudTTS','apiKey','text','languageCode','en-US','ssmlGender','MALE','audioEncoding','MP3','googleTTS','google_tts_language','restAPI','url','timeout','number','POST','method','toUpperCase','rawBody','parse','headers','computedVariables','sync','uri','render','body','stringify','An\x20incorrect\x20formatted\x20json\x20has\x20been\x20passed\x20to\x20the\x20function','statusCode','statusMessage','message','options','googleDialogflow','dialogflow_language'];(function(_0x5b149f,_0x2ca754){var _0x36306f=function(_0x23fe8c){while(--_0x23fe8c){_0x5b149f['push'](_0x5b149f['shift']());}};_0x36306f(++_0x2ca754);}(_0xaf93,0x151));var _0x3af9=function(_0x34a62c,_0x353cbe){_0x34a62c=_0x34a62c-0x0;var _0x5c3f14=_0xaf93[_0x34a62c];return _0x5c3f14;};'use strict';var fs=require('fs');var util=require(_0x3af9('0x0'));var _=require(_0x3af9('0x1'));var sh=require('shelljs');var odbc=require('odbc')();var rs=require(_0x3af9('0x2'));var moment=require(_0x3af9('0x3'));var Mustache=require('mustache');var rp=require(_0x3af9('0x4'));var logger=require(_0x3af9('0x5'))(_0x3af9('0x6'));var config=require(_0x3af9('0x7'));var scripts=require(_0x3af9('0x8'));var FILES_PATH=_0x3af9('0x9');var recursiveMapAttributes=[_0x3af9('0xa'),'rawBody'];var verticesWithRetry=[_0x3af9('0xb'),'getdigits',_0x3af9('0xc')];var AGIVertices=function(_0x53b5ba,_0x5325b1,_0x43ca48){this['channel']=_0x53b5ba;this['rpc']=_0x5325b1;this[_0x3af9('0xd')]=_0x43ca48;};AGIVertices[_0x3af9('0xe')][_0x3af9('0xf')]=function(_0x17ad50,_0x507254){this[_0x3af9('0x10')][_0x3af9('0x11')](_0x17ad50)[_0x3af9('0x12')](function(_0x4ff90e){_0x507254(null,_0x4ff90e?_0x4ff90e[_0x3af9('0x13')]:![]);})[_0x3af9('0x14')](function(_0x212f63){_0x507254(_0x212f63);});};AGIVertices[_0x3af9('0xe')]['getVoiceQueue']=function(_0x3b4d2f,_0x5477a7){this[_0x3af9('0x10')][_0x3af9('0x15')](_0x3b4d2f)[_0x3af9('0x12')](function(_0x50887b){_0x5477a7(null,_0x50887b?_0x50887b[_0x3af9('0x13')]:![]);})[_0x3af9('0x14')](function(_0x37cb8b){_0x5477a7(_0x37cb8b);});};AGIVertices['prototype'][_0x3af9('0x16')]=function(_0x9c7d69,_0xa92aa4){this[_0x3af9('0x10')]['getSquareProjectById'](_0x9c7d69)[_0x3af9('0x12')](function(_0xcf2214){_0xa92aa4(null,_0xcf2214?_0xcf2214[_0x3af9('0x13')]:![]);})[_0x3af9('0x14')](function(_0x314df2){_0xa92aa4(_0x314df2);});};AGIVertices['prototype'][_0x3af9('0x17')]=function(_0x2b39f5,_0x1f9214){this[_0x3af9('0x10')][_0x3af9('0x18')](_0x2b39f5)['then'](function(_0x39312c){_0x1f9214(null,_0x39312c?_0x39312c[_0x3af9('0x19')]:![]);})[_0x3af9('0x14')](function(_0x1e0f4f){_0x1f9214(_0x1e0f4f);});};AGIVertices[_0x3af9('0xe')][_0x3af9('0x1a')]=function(_0x5e65b3,_0x4a88ea){this[_0x3af9('0x10')]['getUserById'](_0x5e65b3)['then'](function(_0x35000e){_0x4a88ea(null,_0x35000e?_0x35000e['name']:![]);})[_0x3af9('0x14')](function(_0x307f9d){_0x4a88ea(_0x307f9d);});};AGIVertices['prototype']['getTrunk']=function(_0x59c458,_0x119e85){this[_0x3af9('0x10')][_0x3af9('0x1b')](_0x59c458)[_0x3af9('0x12')](function(_0x240a16){_0x119e85(null,_0x240a16?_0x240a16[_0x3af9('0x13')]:![]);})[_0x3af9('0x14')](function(_0x22d269){_0x119e85(_0x22d269);});};AGIVertices['prototype'][_0x3af9('0x1c')]=function(_0x574b71,_0x485754){var _0x177650=this;this[_0x3af9('0x10')][_0x3af9('0x1d')](_0x574b71)[_0x3af9('0x12')](function(_0x374382){_0x485754(null,_0x374382?_0x177650['getSoundPath'](_0x374382[_0x3af9('0x1e')]):![]);})[_0x3af9('0x14')](function(_0x165620){_0x485754(_0x165620);});};AGIVertices['prototype']['getMailAccount']=function(_0x1a4932,_0x1d022d){this[_0x3af9('0x10')]['getMailAccountById'](_0x1a4932)[_0x3af9('0x12')](function(_0x115673){_0x1d022d(null,_0x115673?_0x115673:![]);})[_0x3af9('0x14')](function(_0x515fba){_0x1d022d(_0x515fba);});};AGIVertices[_0x3af9('0xe')][_0x3af9('0x1f')]=function(_0x407572,_0x52c794,_0x3c8320){this[_0x3af9('0xd')][_0x3af9('0x1f')](_0x407572,_0x52c794)['then'](function(){_0x3c8320(null);})[_0x3af9('0x14')](function(_0x3d8073){_0x3c8320(_0x3d8073);});};AGIVertices['prototype'][_0x3af9('0x20')]=function(_0x588d5b,_0x431087){this['rpc']['getIntervalById'](_0x588d5b)[_0x3af9('0x12')](function(_0x53a20f){if(_0x53a20f){if(_0x53a20f[_0x3af9('0x21')]){_0x431087(null,[_0x53a20f[_0x3af9('0x22')]]);}else{_0x431087(null,_[_0x3af9('0x23')](_0x53a20f['Intervals'],'interval'));}}else{_0x431087(null,![]);}})[_0x3af9('0x14')](function(_0x1bc341){_0x431087(_0x1bc341);});};AGIVertices['prototype']['getSoundPath']=function(_0x20e25e){return util['format'](_0x3af9('0x24'),FILES_PATH,_0x20e25e);};AGIVertices[_0x3af9('0xe')]['getQueryOdbc']=function(_0x554566,_0x3b2c42,_0x3472d3){odbc[_0x3af9('0x25')](_0x554566,function(_0x30a6af){if(_0x30a6af){logger[_0x3af9('0x26')]('Error\x20getting\x20ODBC\x20connection\x20%s',_0x30a6af);_0x3472d3(_0x30a6af);}else{logger['info'](_0x3af9('0x27'));odbc[_0x3af9('0x28')](_0x3b2c42,function(_0x2c52eb,_0x241f26){if(_0x2c52eb){logger['info']('Error\x20executing\x20query\x20%s',_0x3b2c42);_0x3472d3(_0x2c52eb);}else{logger[_0x3af9('0x29')](_0x3af9('0x2a'),_0x3b2c42);odbc[_0x3af9('0x2b')](function(_0x591ebc){if(_0x591ebc){logger[_0x3af9('0x26')](_0x3af9('0x2c'),_0x591ebc);}_0x3472d3(null,_0x241f26);});}});}});};AGIVertices[_0x3af9('0xe')]['getSmsAccount']=function(_0x40c8ab,_0x597222){this[_0x3af9('0x10')][_0x3af9('0x2d')](_0x40c8ab)[_0x3af9('0x12')](function(_0x4465ee){_0x597222(null,_0x4465ee?_0x4465ee:![]);})[_0x3af9('0x14')](function(_0x18a75c){_0x597222(_0x18a75c);});};AGIVertices[_0x3af9('0xe')][_0x3af9('0x2e')]=function(_0x278594,_0x319f48){this[_0x3af9('0x10')]['createSmsMessage'](_0x278594)[_0x3af9('0x12')](function(_0x34dc9a){_0x319f48(null,_0x34dc9a);})[_0x3af9('0x14')](function(_0x3232b6){_0x319f48(_0x3232b6);});};AGIVertices[_0x3af9('0xe')][_0x3af9('0x2f')]=function(_0x3722a8,_0x384a61,_0x14325a){this[_0x3af9('0x10')][_0x3af9('0x2f')]({'uniqueid':this[_0x3af9('0x30')]['uniqueid'],'node':_0x3722a8['label'],'application':_0x3722a8[_0x3af9('0x31')],'data':_0x384a61||null,'project_name':this[_0x3af9('0x30')][_0x3af9('0x32')],'callerid':this[_0x3af9('0x30')][_0x3af9('0x33')]})[_0x3af9('0x12')](function(_0x1738b4){if(_0x14325a){_0x14325a(null,_0x1738b4);}})[_0x3af9('0x14')](function(_0xe43c45){if(_0x14325a){_0x14325a(_0xe43c45);}});};AGIVertices[_0x3af9('0xe')][_0x3af9('0x34')]=function(_0x2ae756,_0x3214c9,_0x56585c,_0x19e3e4){this[_0x3af9('0x10')][_0x3af9('0x34')]({'uniqueid':this[_0x3af9('0x30')]['uniqueid'],'callerid':this['channel'][_0x3af9('0x33')],'calleridname':this['channel'][_0x3af9('0x35')],'context':this[_0x3af9('0x30')][_0x3af9('0x36')],'extension':this[_0x3af9('0x30')]['extension'],'priority':this[_0x3af9('0x30')][_0x3af9('0x37')],'accountcode':this[_0x3af9('0x30')]['accountcode'],'dnid':this['channel'][_0x3af9('0x38')],'projectName':this['channel']['arg_1'],'saveName':_0x3214c9,'filename':_0x2ae756['file']||_0x3214c9,'savePath':_0x56585c})[_0x3af9('0x12')](function(_0x3bc784){_0x19e3e4(null,_0x3bc784);})[_0x3af9('0x14')](function(_0x42b78e){_0x19e3e4(_0x42b78e);});};AGIVertices[_0x3af9('0xe')][_0x3af9('0x39')]=function(_0x442681,_0x48377b,_0x10dce4,_0x3b59b0,_0x38c943){this[_0x3af9('0x10')][_0x3af9('0x39')]({'uniqueid':this[_0x3af9('0x30')]['uniqueid'],'body':_0x442681,'direction':_0x48377b,'providerName':_0x10dce4,'providerResponse':_0x3b59b0})[_0x3af9('0x12')](function(_0xd341e4){if(_0x38c943){_0x38c943(null,_0xd341e4);}})[_0x3af9('0x14')](function(_0x431c8d){if(_0x38c943){_0x38c943(_0x431c8d);}});};AGIVertices['prototype'][_0x3af9('0x3a')]=function(_0x39d954,_0x2e55f2){this[_0x3af9('0x10')]['createCmContact']({'firstName':_[_0x3af9('0x3b')](_0x39d954[_0x3af9('0x13')])||_[_0x3af9('0x3c')](_0x39d954[_0x3af9('0x13')])?'callback_'+Math['random']():_0x39d954[_0x3af9('0x13')],'lastName':_[_0x3af9('0x3b')](_0x39d954[_0x3af9('0x3d')])||_[_0x3af9('0x3c')](_0x39d954[_0x3af9('0x3d')])?null:_0x39d954[_0x3af9('0x3d')],'phone':_0x39d954[_0x3af9('0x3e')],'ListId':_0x39d954[_0x3af9('0x3f')],'scheduledat':_0x39d954[_0x3af9('0x40')],'callbackUniqueid':this[_0x3af9('0x30')][_0x3af9('0x41')],'tags':'callback','description':_0x3af9('0x42')+_0x39d954[_0x3af9('0x40')]['toString'](),'priority':_0x39d954['callback_priority']})[_0x3af9('0x12')](function(_0x4b205f){_0x2e55f2(null,_0x4b205f);})[_0x3af9('0x14')](function(_0x125140){_0x2e55f2(_0x125140);});};AGIVertices['prototype']['getPause']=function(_0x3ba6d7,_0x4a90d6){this[_0x3af9('0x10')][_0x3af9('0x43')](_0x3ba6d7)['then'](function(_0x3ed77e){_0x4a90d6(null,_0x3ed77e?_0x3ed77e['name']:![]);})[_0x3af9('0x14')](function(_0x3e630){_0x4a90d6(_0x3e630);});};AGIVertices[_0x3af9('0xe')]['agentPause']=function(_0x476650,_0x1d6c31,_0x9c28e9){var _0x2ef2c6={'role':'agent'};_0x2ef2c6[_0x476650]=this[_0x3af9('0x30')][_0x3af9('0x33')];this[_0x3af9('0x10')][_0x3af9('0x44')](_0x2ef2c6,_0x1d6c31,this[_0x3af9('0x30')][_0x3af9('0x41')])[_0x3af9('0x12')](function(_0x58ad44){_0x9c28e9(null,_[_0x3af9('0x3c')](_0x58ad44)?![]:!![]);})[_0x3af9('0x14')](function(_0x28e8fb){logger[_0x3af9('0x26')](_0x28e8fb);_0x9c28e9(null,![]);});};AGIVertices[_0x3af9('0xe')]['agentUnpause']=function(_0xcbb657,_0x2bc934){var _0x3c736b={'role':_0x3af9('0x45')};_0x3c736b[_0xcbb657]=this[_0x3af9('0x30')][_0x3af9('0x33')];this[_0x3af9('0x10')][_0x3af9('0x46')](_0x3c736b)[_0x3af9('0x12')](function(_0x2e6e85){_0x2bc934(null,_['isNil'](_0x2e6e85)?![]:!![]);})[_0x3af9('0x14')](function(_0x43587b){logger[_0x3af9('0x26')](_0x43587b);_0x2bc934(null,![]);});};AGIVertices[_0x3af9('0xe')]['agentLogout']=function(_0x3940d0,_0x35c8dd){var _0x117719={'role':_0x3af9('0x45')};_0x117719[_0x3940d0]=this[_0x3af9('0x30')][_0x3af9('0x33')];this[_0x3af9('0x10')]['agentLogout'](_0x117719)[_0x3af9('0x12')](function(_0x5d7376){_0x35c8dd(null,_[_0x3af9('0x3c')](_0x5d7376)?![]:!![]);})[_0x3af9('0x14')](function(_0x36a80f){logger[_0x3af9('0x26')](_0x36a80f);_0x35c8dd(null,![]);});};AGIVertices[_0x3af9('0xe')][_0x3af9('0x47')]=function(_0x50c934,_0x1ef413){var _0x498081={'role':_0x3af9('0x45')};_0x498081[_0x50c934]=this[_0x3af9('0x30')][_0x3af9('0x33')];var _0x3e88eb=_0x50c934!='internal'?util[_0x3af9('0x48')](_0x3af9('0x49'),_0x3af9('0x4a'),this[_0x3af9('0x30')][_0x3af9('0x33')]):undefined;this[_0x3af9('0x10')][_0x3af9('0x47')](_0x498081,_0x3e88eb)[_0x3af9('0x12')](function(_0x1a9972){_0x1ef413(null,_[_0x3af9('0x3c')](_0x1a9972)?![]:!![]);})['catch'](function(_0x5b6e67){logger[_0x3af9('0x26')](_0x5b6e67);_0x1ef413(null,![]);});};AGIVertices[_0x3af9('0xe')][_0x3af9('0x4b')]=function(_0x1c8cfe,_0x2643b0){sh[_0x3af9('0x4c')](_['trim'](_0x1c8cfe),function(_0xd450d5,_0x44cdc7){var _0x2c18ad=_0x44cdc7['replace'](/(\r\n|\n|\r)/gm,'');_0x2643b0(null,_0x2c18ad);});};AGIVertices[_0x3af9('0xe')][_0x3af9('0x4d')]=function(_0x218eb0,_0x554ee6){scripts[_0x3af9('0x4d')](_0x218eb0[_0x3af9('0x4e')],_0x218eb0['google_cloud_tts_text_type']||_0x3af9('0x4f'),_0x218eb0[_0x3af9('0x4f')],_0x218eb0[_0x3af9('0x50')]||_0x3af9('0x51'),_0x218eb0[_0x3af9('0x52')]||_0x3af9('0x53'),_0x218eb0[_0x3af9('0x54')]||_0x3af9('0x55'))[_0x3af9('0x12')](function(_0x1d0a56){_0x554ee6(null,_0x1d0a56);})[_0x3af9('0x14')](function(_0x25c595){_0x554ee6(_0x25c595);});};AGIVertices[_0x3af9('0xe')][_0x3af9('0x56')]=function(_0x204964,_0x3f017){scripts['googleTTS'](_0x204964[_0x3af9('0x4f')],_0x204964[_0x3af9('0x57')]||'en',0x1)['then'](function(_0x2abe70){_0x3f017(null,_0x2abe70);})['catch'](function(_0x5941f7){_0x3f017(_0x5941f7);});};AGIVertices[_0x3af9('0xe')][_0x3af9('0x58')]=function(_0x545839,_0x45c2d7){var _0x10f926={'uri':_0x545839[_0x3af9('0x59')],'method':_0x545839['method'],'json':!![],'resolveWithFullResponse':!![],'strictSSL':![],'timeout':typeof parseInt(_0x545839[_0x3af9('0x5a')])===_0x3af9('0x5b')&&parseInt(_0x545839[_0x3af9('0x5a')])>=0x1?parseInt(_0x545839[_0x3af9('0x5a')])*0x3e8:0x5*0x3e8};if(_['includes']([_0x3af9('0x5c'),'PUT'],_0x10f926[_0x3af9('0x5d')][_0x3af9('0x5e')]())){try{_0x10f926['body']=_0x545839[_0x3af9('0x5f')]?JSON[_0x3af9('0x60')](_0x545839['rawBody']):{};}catch(_0x25dcd7){logger[_0x3af9('0x26')]('An\x20incorrect\x20formatted\x20json\x20body\x20has\x20been\x20passed\x20to\x20the\x20function',_0x25dcd7);}}try{_0x10f926[_0x3af9('0x61')]=_0x545839['rawHeaders']?JSON[_0x3af9('0x60')](_0x545839[_0x3af9('0xa')]):{};}catch(_0xebc836){logger[_0x3af9('0x26')]('An\x20incorrect\x20formatted\x20json\x20headers\x20has\x20been\x20passed\x20to\x20the\x20function',_0xebc836);}if(_0x545839[_0x3af9('0x62')]){try{var _0x54492a=require(_0x545839[_0x3af9('0x62')])[_0x3af9('0x63')](this,_0x10f926);_0x10f926[_0x3af9('0x64')]=Mustache[_0x3af9('0x65')](_0x545839['url'],_0x54492a,{},['$$','$$']);if(_0x10f926[_0x3af9('0x61')]){_0x10f926['headers']=JSON[_0x3af9('0x60')](Mustache[_0x3af9('0x65')](JSON['stringify'](_0x10f926[_0x3af9('0x61')]),_0x54492a,{},['$$','$$']));}if(_0x10f926[_0x3af9('0x66')]){_0x10f926[_0x3af9('0x66')]=JSON['parse'](Mustache[_0x3af9('0x65')](JSON[_0x3af9('0x67')](_0x10f926[_0x3af9('0x66')]),_0x54492a,{},['$$','$$']));}}catch(_0x8c67f2){logger['error'](_0x3af9('0x68'),_0x8c67f2);}}rp(_0x10f926)[_0x3af9('0x12')](function(_0x4426cd){var _0x3c7309={'statusCode':_0x4426cd[_0x3af9('0x69')]||0xc8,'statusMessage':_0x4426cd[_0x3af9('0x6a')]||'OK','headers':_0x4426cd['headers']||{},'body':_0x4426cd[_0x3af9('0x66')]||{}};_0x45c2d7(null,_0x3c7309);})[_0x3af9('0x14')](function(_0x3515ae){var _0x3b5f92={'statusCode':_0x3515ae[_0x3af9('0x69')]||0x1f4,'statusMessage':_0x3515ae[_0x3af9('0x6b')]||'500\x20-\x20Internal\x20Server\x20Error','headers':_0x3515ae['options'][_0x3af9('0x61')]||{},'body':_0x3515ae[_0x3af9('0x6c')][_0x3af9('0x66')]||{}};_0x45c2d7(null,_0x3b5f92);});};AGIVertices[_0x3af9('0xe')]['googleDialogflow']=function(_0x1f0d6a,_0x4f4573){scripts[_0x3af9('0x6d')](this[_0x3af9('0x30')][_0x3af9('0x41')],_0x1f0d6a['key'],_0x1f0d6a[_0x3af9('0x4f')],_0x1f0d6a[_0x3af9('0x6e')]||'en')[_0x3af9('0x12')](function(_0x10c157){_0x4f4573(null,_0x10c157);})[_0x3af9('0x14')](function(_0x431e1e){_0x4f4573(_0x431e1e);});};AGIVertices[_0x3af9('0xe')][_0x3af9('0x6f')]=function(_0x27c280,_0x4e4fdf){scripts[_0x3af9('0x6f')](this[_0x3af9('0x30')]['uniqueid'],_0x27c280[_0x3af9('0x70')],_0x27c280[_0x3af9('0x71')],_0x27c280[_0x3af9('0x72')],_0x27c280[_0x3af9('0x4f')],_0x27c280[_0x3af9('0x73')]||'en')[_0x3af9('0x12')](function(_0x189b00){_0x4e4fdf(null,_0x189b00);})[_0x3af9('0x14')](function(_0x8aa7e8){_0x4e4fdf(_0x8aa7e8);});};AGIVertices[_0x3af9('0xe')][_0x3af9('0x74')]=function(_0xb677bc,_0xd60655){scripts[_0x3af9('0x74')](this[_0x3af9('0x30')],_0xb677bc)['then'](function(_0x460638){_0xd60655(null,_0x460638);})['catch'](function(_0x34f174){_0xd60655(_0x34f174);});};AGIVertices[_0x3af9('0xe')][_0x3af9('0x75')]=function(_0x3f303b,_0x4640e5){scripts[_0x3af9('0x75')](_0x3f303b[_0x3af9('0x76')],_0x3f303b['text'],_0x3f303b['ispeech_tts_language']||_0x3af9('0x51'),_0x3f303b['speed'])['then'](function(_0x50ee69){_0x4640e5(null,_0x50ee69);})[_0x3af9('0x14')](function(_0xa7f316){_0x4640e5(_0xa7f316);});};AGIVertices[_0x3af9('0xe')][_0x3af9('0x77')]=function(_0x200550,_0x5e2f70,_0x2df886){scripts[_0x3af9('0x77')](_0x5e2f70,_0x200550[_0x3af9('0x76')],_0x200550[_0x3af9('0x78')]||'en-US',this['isConfigured'](_0x200550[_0x3af9('0x79')])?_0x200550[_0x3af9('0x79')]:undefined)[_0x3af9('0x12')](function(_0x35abd3){_0x2df886(null,_0x35abd3);})[_0x3af9('0x14')](function(_0x12c2dc){_0x2df886(_0x12c2dc);});};AGIVertices[_0x3af9('0xe')]['awsPolly']=function(_0x4bf705,_0x29b74f){scripts['awsPolly'](_0x4bf705[_0x3af9('0x7a')],_0x4bf705[_0x3af9('0x7b')],_0x4bf705[_0x3af9('0x7c')],_0x4bf705[_0x3af9('0x7d')]||'Amy',_0x4bf705['text'],_0x4bf705[_0x3af9('0x7e')]||_0x3af9('0x4f'))['then'](function(_0x22d19f){_0x29b74f(null,_0x22d19f);})[_0x3af9('0x14')](function(_0x4b70d3){_0x29b74f(_0x4b70d3);});};AGIVertices[_0x3af9('0xe')][_0x3af9('0x7f')]=function(_0x180055,_0x170534){scripts['awsLex'](this[_0x3af9('0x30')][_0x3af9('0x41')],_0x180055['aws_access_key_id'],_0x180055[_0x3af9('0x7b')],_0x180055['aws_lex_region'],_0x180055[_0x3af9('0x4f')],_0x180055['aws_bot_name'])[_0x3af9('0x12')](function(_0x1a309b){_0x170534(null,_0x1a309b);})['catch'](function(_0x3a6231){_0x170534(_0x3a6231);});};AGIVertices[_0x3af9('0xe')][_0x3af9('0x80')]=function(_0x47a517,_0x3899d5,_0x3e22fb){scripts[_0x3af9('0x80')](_0x3899d5,_0x47a517[_0x3af9('0x76')],_0x47a517['google_asr_language']||_0x3af9('0x51'))['then'](function(_0x5c4bc5){_0x3e22fb(null,_0x5c4bc5);})[_0x3af9('0x14')](function(_0x362d33){_0x3e22fb(_0x362d33);});};AGIVertices['prototype'][_0x3af9('0x81')]=function(_0x452671,_0x2dd587,_0x380c2d){scripts['tildeASR'](_0x2dd587,_0x452671[_0x3af9('0x82')],_0x452671[_0x3af9('0x83')],_0x452671['uri'])[_0x3af9('0x12')](function(_0x3045a0){_0x380c2d(null,_0x3045a0);})[_0x3af9('0x14')](function(_0x107863){_0x380c2d(_0x107863);});};AGIVertices[_0x3af9('0xe')][_0x3af9('0x84')]=function(_0x142fe7){var _0x4106f0=_[_0x3af9('0x85')](verticesWithRetry,_0x142fe7[_0x3af9('0x31')])?_0x142fe7:_['clone'](_0x142fe7);for(var _0x4873a8 in _0x4106f0){if(_0x4106f0['hasOwnProperty'](_0x4873a8)){if(_0x4106f0[_0x4873a8]&&_[_0x3af9('0x86')](_0x4106f0[_0x4873a8])){if(_['includes'](recursiveMapAttributes,_0x4873a8)){_0x4106f0[_0x4873a8]=this[_0x3af9('0x87')](_0x4106f0[_0x4873a8]);}else{_0x4106f0[_0x4873a8]=this[_0x3af9('0x88')](_0x4106f0[_0x4873a8]);}}}}return _0x4106f0;};AGIVertices[_0x3af9('0xe')][_0x3af9('0x89')]=function(_0x2262f5){for(var _0x35cb7f in _0x2262f5){if(_0x2262f5['hasOwnProperty'](_0x35cb7f)){if(_[_0x3af9('0x8a')](_0x2262f5[_0x35cb7f])){this[_0x3af9('0x89')](_0x2262f5[_0x35cb7f]);}else if(_[_0x3af9('0x8b')](_0x2262f5[_0x35cb7f])){for(var _0x257e43=0x0;_0x257e43<_0x2262f5[_0x35cb7f][_0x3af9('0x8c')];_0x257e43++){this[_0x3af9('0x89')](_0x2262f5[_0x35cb7f][_0x257e43]);}}else if(_[_0x3af9('0x86')](_0x2262f5[_0x35cb7f])){_0x2262f5[_0x35cb7f]=this['replaceAllVariables'](_0x2262f5[_0x35cb7f]);}}}};AGIVertices[_0x3af9('0xe')][_0x3af9('0x8d')]=function(_0x3bc135,_0x2ffddf){for(var _0x535dd0 in _0x3bc135){if(_0x3bc135[_0x3af9('0x8e')](_0x535dd0)){if(_['isPlainObject'](_0x3bc135[_0x535dd0])){if(!_['isEmpty'](_0x3bc135[_0x535dd0])){this['saveRestApiResult'](_0x3bc135[_0x535dd0],util[_0x3af9('0x48')](_0x3af9('0x8f'),_0x2ffddf,_0x535dd0));}}else if(_[_0x3af9('0x8b')](_0x3bc135[_0x535dd0])){for(var _0x555a25=0x0;_0x555a25<_0x3bc135[_0x535dd0][_0x3af9('0x8c')];_0x555a25++){this[_0x3af9('0x8d')](_0x3bc135[_0x535dd0][_0x555a25],util[_0x3af9('0x48')](_0x3af9('0x8f'),_0x2ffddf,_0x535dd0+'['+_0x555a25+']'));}}else{if(!_[_0x3af9('0x3c')](_0x3bc135[_0x535dd0])){this[_0x3af9('0x30')][_0x3af9('0x90')](util[_0x3af9('0x48')](_0x3af9('0x8f'),_0x2ffddf,_0x535dd0),_0x3bc135[_0x535dd0]);}}}}};AGIVertices[_0x3af9('0xe')]['replaceObjectAllVariables']=function(_0x245d0c){try{var _0x2ecfcd=JSON['parse'](_0x245d0c);this[_0x3af9('0x89')](_0x2ecfcd);return JSON[_0x3af9('0x67')](_0x2ecfcd);}catch(_0x434f44){return this['replaceAllVariables'](_0x245d0c);}};AGIVertices['prototype'][_0x3af9('0x88')]=function(_0x14686a){var _0x5ad7e0=_0x14686a[_0x3af9('0x91')]('{');for(var _0x397aff=0x1;_0x397aff<_0x5ad7e0[_0x3af9('0x8c')];_0x397aff+=0x1){var _0x3c413d=_0x5ad7e0[_0x397aff][_0x3af9('0x91')]('}');if(_0x3c413d[_0x3af9('0x8c')]>0x1){_0x14686a=_0x14686a[_0x3af9('0x92')]('{'+_0x3c413d[0x0]+'}',this['channel'][_0x3af9('0xf')](_0x3c413d[0x0])['extra']||_0x3c413d[0x0]);}}if(_0x5ad7e0[_0x3af9('0x8c')]===0x1){return _0x14686a['toString']();}return this[_0x3af9('0x88')](_0x14686a);};AGIVertices[_0x3af9('0xe')][_0x3af9('0x93')]=function(_0x4271b6,_0x1a60b5){var _0xdc5481=this['channel']['getVariable'](_0x4271b6);if(_0xdc5481['result']===-0x1){return _0xdc5481;}logger[_0x3af9('0x29')](util[_0x3af9('0x48')](_0x3af9('0x94'),_0x1a60b5,_0xdc5481[_0x3af9('0x95')]));return this[_0x3af9('0x30')][_0x3af9('0x90')](_0x1a60b5,_0xdc5481[_0x3af9('0x95')]);};AGIVertices[_0x3af9('0xe')][_0x3af9('0x96')]=function(_0x3172ed){return _0x3172ed&&_0x3172ed!=='0'&&_0x3172ed!=='-1'&&_0x3172ed!=='';};AGIVertices['prototype']['maxRetry']=function(_0x33e4a0){this[_0x3af9('0x2f')][_0x3af9('0x63')](this,_0x33e4a0,'-');_0x33e4a0[_0x3af9('0x97')]=_0x33e4a0[_0x3af9('0x98')];return{'code':0xc8,'result':'-'};};AGIVertices[_0x3af9('0xe')]['mrcpsynth']=function(_0x45075b){logger[_0x3af9('0x29')](util[_0x3af9('0x48')]('Enter\x20in\x20MRCPSynth\x20(%s)\x20block',_0x45075b[_0x3af9('0x99')]));if(!this[_0x3af9('0x96')](_0x45075b[_0x3af9('0x4f')])){return this[_0x3af9('0x30')][_0x3af9('0x9a')](_0x3af9('0x9b'));}var _0x2a9b4c='\x22'+_0x45075b[_0x3af9('0x4f')]+'\x22';if(this['isConfigured'](_0x45075b['options'])){_0x2a9b4c+=','+_0x45075b['options'];}var _0x28eee=this[_0x3af9('0x30')]['exec']('MRCPSynth',_0x2a9b4c);if(_0x28eee[_0x3af9('0x9c')]===-0x1){return _0x28eee;}return this[_0x3af9('0x30')][_0x3af9('0x9a')](util[_0x3af9('0x48')]('Executed\x20command\x20MRCPSynth\x20%s',_0x2a9b4c));};AGIVertices['prototype'][_0x3af9('0x9d')]=function(_0xef1c84){logger[_0x3af9('0x29')](util[_0x3af9('0x48')](_0x3af9('0x9e'),_0xef1c84[_0x3af9('0x99')]));if(!this['isConfigured'](_0xef1c84[_0x3af9('0x9f')])){return this['channel'][_0x3af9('0x9a')](_0x3af9('0xa0'));}var _0x51fe5e=_0xef1c84[_0x3af9('0x9f')];if(this['isConfigured'](_0xef1c84['options'])){_0x51fe5e+=','+_0xef1c84[_0x3af9('0x6c')];}var _0xdc01fd=this[_0x3af9('0x30')]['exec'](_0x3af9('0xa1'),_0x51fe5e);if(_0xdc01fd[_0x3af9('0x9c')]===-0x1){return _0xdc01fd;}var _0x362fbe=this['getAndSetVariable']('RECOG_CONFIDENCE()',_0x3af9('0xa2'));if(_0x362fbe['result']===-0x1){return _0x362fbe;}var _0x44db25=this[_0x3af9('0x93')](_0x3af9('0xa3'),_0x3af9('0xa4'));if(_0x44db25['result']===-0x1){return _0x44db25;}var _0x164751=this[_0x3af9('0x93')]('RECOG_INSTANCE()','MRCP_RECOG_INSTANCE');if(_0x164751['result']===-0x1){return _0x164751;}return this['channel'][_0x3af9('0x9a')](util[_0x3af9('0x48')]('Executed\x20command\x20MRCPRecog\x20%s',_0x51fe5e));};AGIVertices[_0x3af9('0xe')][_0x3af9('0x6')]=function(_0x2b9d14){logger[_0x3af9('0x29')](util[_0x3af9('0x48')](_0x3af9('0xa5'),_0x2b9d14['label']));return this[_0x3af9('0x30')][_0x3af9('0x6')]([_0x2b9d14[_0x3af9('0xa6')],_0x2b9d14[_0x3af9('0xa7')]]);};AGIVertices['prototype'][_0x3af9('0xa8')]=function(_0x48f15b){logger[_0x3af9('0x29')](util[_0x3af9('0x48')](_0x3af9('0xa9'),_0x48f15b[_0x3af9('0x99')]));if(this['isConfigured'](_0x48f15b[_0x3af9('0x5a')])){logger[_0x3af9('0x29')](util[_0x3af9('0x48')](_0x3af9('0xaa'),_0x48f15b[_0x3af9('0x5a')]));var _0x260a93=this[_0x3af9('0x30')][_0x3af9('0xab')](_0x48f15b['timeout']);if(_0x260a93['result']===-0x1){return _0x260a93;}}return this[_0x3af9('0x30')][_0x3af9('0xa8')]();};AGIVertices['prototype']['callback']=function(_0x53119b){logger[_0x3af9('0x29')](util['format'](_0x3af9('0xac'),_0x53119b[_0x3af9('0x99')]));if(!this['isConfigured'](_0x53119b[_0x3af9('0x3f')])){return this[_0x3af9('0x30')][_0x3af9('0x26')](_0x53119b,_0x3af9('0xad'));}_0x53119b[_0x3af9('0x40')]=moment();if(this[_0x3af9('0x96')](_0x53119b[_0x3af9('0xae')])){_0x53119b[_0x3af9('0x40')]=moment()['add'](_0x53119b[_0x3af9('0xae')],_0x3af9('0xaf'));}if(!this[_0x3af9('0x96')](_0x53119b[_0x3af9('0xb0')])){_0x53119b['callback_priority']=0x2;}this[_0x3af9('0x3a')]['sync'](this,_0x53119b);return this['channel'][_0x3af9('0x9a')](util[_0x3af9('0x48')](_0x3af9('0xb1'),_0x53119b['phone'],_0x53119b[_0x3af9('0x3f')],_0x53119b[_0x3af9('0x40')]));};AGIVertices[_0x3af9('0xe')][_0x3af9('0xb2')]=function(_0x327e7b){logger[_0x3af9('0x29')](util[_0x3af9('0x48')](_0x3af9('0xb3'),_0x327e7b[_0x3af9('0x99')]));var _0x209bf2=this[_0x3af9('0x30')][_0x3af9('0x4c')](_0x327e7b['application'],_0x327e7b['options']);if(_0x209bf2[_0x3af9('0x9c')]===-0x1){return _0x209bf2;}return this[_0x3af9('0x30')]['noop'](util[_0x3af9('0x48')](_0x3af9('0xb4'),_0x327e7b['application'],_0x327e7b[_0x3af9('0x6c')]));};AGIVertices[_0x3af9('0xe')]['lumenvoxtts']=function(_0x358c1c){logger[_0x3af9('0x29')](util[_0x3af9('0x48')]('Enter\x20in\x20LUMENVOXTTS\x20(%s)\x20block',_0x358c1c[_0x3af9('0x99')]));if(!this[_0x3af9('0x96')](_0x358c1c[_0x3af9('0x4f')])){return this[_0x3af9('0x30')]['noop'](_0x3af9('0x9b'));}var _0x87ccb3='\x22'+_0x358c1c[_0x3af9('0x4f')]+'\x22';if(this[_0x3af9('0x96')](_0x358c1c[_0x3af9('0x6c')])){_0x87ccb3+=','+_0x358c1c['options'];}var _0x243237=this[_0x3af9('0x30')][_0x3af9('0x4c')](_0x3af9('0xb5'),_0x87ccb3);if(_0x243237[_0x3af9('0x9c')]===-0x1){return _0x243237;}return this[_0x3af9('0x30')][_0x3af9('0x9a')](util[_0x3af9('0x48')]('Executed\x20command\x20MRCPSynth\x20%s',_0x87ccb3));};AGIVertices['prototype'][_0x3af9('0xb6')]=function(_0xcda563){logger[_0x3af9('0x29')](util[_0x3af9('0x48')](_0x3af9('0xb7'),_0xcda563[_0x3af9('0x99')]));if(!this[_0x3af9('0x96')](_0xcda563[_0x3af9('0x4f')])){return this['channel'][_0x3af9('0x9a')](_0x3af9('0x9b'));}var _0x46a5da='\x22'+_0xcda563[_0x3af9('0x4f')]+'\x22';if(this[_0x3af9('0x96')](_0xcda563[_0x3af9('0x6c')])){_0x46a5da+=','+_0xcda563[_0x3af9('0x6c')];}var _0x4027dc=this[_0x3af9('0x30')]['exec'](_0x3af9('0xb5'),_0x46a5da);if(_0x4027dc[_0x3af9('0x9c')]===-0x1){return _0x4027dc;}return this[_0x3af9('0x30')][_0x3af9('0x9a')](util['format'](_0x3af9('0xb8'),_0x46a5da));};AGIVertices[_0x3af9('0xe')][_0x3af9('0xb9')]=function(_0x4221ae){logger[_0x3af9('0x29')](util[_0x3af9('0x48')](_0x3af9('0xba'),_0x4221ae[_0x3af9('0x99')]));if(!this[_0x3af9('0x96')](_0x4221ae[_0x3af9('0x9f')])){return this[_0x3af9('0x30')][_0x3af9('0x9a')](_0x3af9('0xa0'));}var _0x58358d=_0x4221ae[_0x3af9('0x9f')];if(this[_0x3af9('0x96')](_0x4221ae[_0x3af9('0x6c')])){_0x58358d+=','+_0x4221ae[_0x3af9('0x6c')];}var _0x17caa2=this[_0x3af9('0x30')][_0x3af9('0x4c')]('MRCPRecog',_0x58358d);if(_0x17caa2['result']===-0x1){return _0x17caa2;}var _0x54d823=this[_0x3af9('0x93')](_0x3af9('0xbb'),_0x3af9('0xbc'));if(_0x54d823[_0x3af9('0x9c')]===-0x1){return _0x54d823;}var _0x459d89=this[_0x3af9('0x93')](_0x3af9('0xa3'),_0x3af9('0xbd'));if(_0x459d89[_0x3af9('0x9c')]===-0x1){return _0x459d89;}var _0x29d8eb=this['getAndSetVariable']('RECOG_INSTANCE()',_0x3af9('0xbe'));if(_0x29d8eb[_0x3af9('0x9c')]===-0x1){return _0x29d8eb;}return this['channel'][_0x3af9('0x9a')](util['format'](_0x3af9('0xbf'),_0x58358d));};AGIVertices['prototype']['sestekasr']=function(_0x439ef9){logger[_0x3af9('0x29')](util['format'](_0x3af9('0xc0'),_0x439ef9[_0x3af9('0x99')]));if(!this[_0x3af9('0x96')](_0x439ef9[_0x3af9('0x9f')])){return this[_0x3af9('0x30')][_0x3af9('0x9a')](_0x3af9('0xa0'));}var _0x1bfa19=_0x439ef9[_0x3af9('0x9f')];if(this['isConfigured'](_0x439ef9[_0x3af9('0x6c')])){_0x1bfa19+=','+_0x439ef9['options'];}var _0x351872=this[_0x3af9('0x30')][_0x3af9('0x4c')](_0x3af9('0xa1'),_0x1bfa19);if(_0x351872[_0x3af9('0x9c')]===-0x1){return _0x351872;}var _0x38b873=this[_0x3af9('0x93')](_0x3af9('0xbb'),'SESTEK_ASR_CONFIDENCE');if(_0x38b873[_0x3af9('0x9c')]===-0x1){return _0x38b873;}var _0x311d25=this[_0x3af9('0x93')](_0x3af9('0xa3'),_0x3af9('0xc1'));if(_0x311d25[_0x3af9('0x9c')]===-0x1){return _0x311d25;}var _0x51d863=this[_0x3af9('0x93')](_0x3af9('0xc2'),_0x3af9('0xc3'));if(_0x51d863['result']===-0x1){return _0x51d863;}return this[_0x3af9('0x30')]['noop'](util[_0x3af9('0x48')]('Executed\x20command\x20MRCPRecog\x20%s',_0x1bfa19));};AGIVertices[_0x3af9('0xe')][_0x3af9('0xc4')]=function(_0x3583ec){logger['info'](util[_0x3af9('0x48')](_0x3af9('0xc5'),_0x3583ec[_0x3af9('0x99')]));if(!this[_0x3af9('0x96')](_0x3583ec[_0x3af9('0xc6')])){return this[_0x3af9('0x30')][_0x3af9('0x26')](_0x3583ec,_0x3af9('0xc7'));}var _0x189e18=this['getSquareOdbc']['sync'](this,_0x3583ec[_0x3af9('0xc6')]);if(!_0x189e18){return this['channel'][_0x3af9('0x26')](_0x3583ec,_0x3af9('0xc8'));}if(!this[_0x3af9('0x96')](_0x3583ec[_0x3af9('0x28')])){return this['channel'][_0x3af9('0x26')](_0x3583ec,_0x3af9('0xc9'));}var _0x4f89d4=_0x3583ec[_0x3af9('0x28')][_0x3af9('0xca')](/(\r\n|\n|\r)/gm,'\x20');this[_0x3af9('0x30')][_0x3af9('0x9a')](util['format'](_0x3af9('0xcb'),_0x4f89d4));var _0x4fbe70=this['getQueryOdbc']['sync'](this,_0x189e18,_0x4f89d4);this[_0x3af9('0x2f')][_0x3af9('0x63')](this,_0x3583ec,_0x4f89d4);if(!this['isConfigured'](_0x3583ec[_0x3af9('0xcc')])){return this[_0x3af9('0x30')][_0x3af9('0x9a')](_0x3af9('0xcd'));}var _0x16d276=this['getVariable'][_0x3af9('0x63')](this,_0x3583ec[_0x3af9('0xcc')]);if(!_0x16d276){return this['channel'][_0x3af9('0x26')](_0x3583ec,_0x3af9('0xce'));}var _0x4737b3=this;_0x4fbe70[_0x3af9('0xcf')](function(_0x41eb20,_0x3966d9){Object[_0x3af9('0xd0')](_0x41eb20)[_0x3af9('0xcf')](function(_0x5c127b){_0x4737b3[_0x3af9('0x30')][_0x3af9('0x90')](util[_0x3af9('0x48')](_0x3af9('0xd1'),_0x16d276,_0x3966d9,_0x5c127b),_0x41eb20[_0x5c127b]);});});this[_0x3af9('0x30')]['setVariable'](util['format'](_0x3af9('0xd2'),_0x16d276),_0x4fbe70[_0x3af9('0x8c')]);return this[_0x3af9('0x30')][_0x3af9('0x9a')](util[_0x3af9('0x48')](_0x3af9('0xd3'),_0x16d276));};AGIVertices[_0x3af9('0xe')][_0x3af9('0xd4')]=function(_0x5d001d){logger[_0x3af9('0xd5')](util[_0x3af9('0x48')](_0x3af9('0xd6'),_0x5d001d[_0x3af9('0x99')]));if(!this[_0x3af9('0x96')](_0x5d001d[_0x3af9('0xd7')])){return this['channel']['error'](_0x5d001d,_0x3af9('0xd8'));}var _0xf8e49b=this[_0x3af9('0x1a')]['sync'](this,_0x5d001d[_0x3af9('0xd7')]);if(!_0xf8e49b){return this[_0x3af9('0x30')][_0x3af9('0x26')](_0x5d001d,_0x3af9('0xd9'));}var _0x559e01=this[_0x3af9('0x30')][_0x3af9('0x4c')](_0x3af9('0xda'),[util[_0x3af9('0x48')](_0x3af9('0xdb'),_0xf8e49b),_0x5d001d[_0x3af9('0x5a')],_0x5d001d[_0x3af9('0xdc')],_0x5d001d['url']]);if(_0x559e01[_0x3af9('0x9c')]===-0x1){return _0x559e01;}return this[_0x3af9('0x30')][_0x3af9('0x9a')](util['format'](_0x3af9('0xdd'),_0x3af9('0xda')));};AGIVertices[_0x3af9('0xe')]['dialogflow']=function(_0x4fe2b2){logger[_0x3af9('0x29')](util[_0x3af9('0x48')](_0x3af9('0xde'),_0x4fe2b2[_0x3af9('0x99')]));if(!this[_0x3af9('0x96')](_0x4fe2b2[_0x3af9('0x76')])){return this[_0x3af9('0x30')][_0x3af9('0x9a')](_0x3af9('0xdf'));}if(!this['isConfigured'](_0x4fe2b2['text'])){return this[_0x3af9('0x30')][_0x3af9('0x9a')]('no\x20text\x20configured');}this['channel'][_0x3af9('0xe0')]=!![];this[_0x3af9('0x2f')](_0x4fe2b2);this[_0x3af9('0x39')](_0x4fe2b2['text'],'in','','');this['channel'][_0x3af9('0x9a')](util[_0x3af9('0x48')](_0x3af9('0xe1'),_0x4fe2b2[_0x3af9('0x4f')]));var _0x5d9bfb=this[_0x3af9('0x6d')][_0x3af9('0x63')](this,_0x4fe2b2);if(_0x5d9bfb){for(var _0x1e60e2 in _0x5d9bfb){if(_0x5d9bfb[_0x3af9('0x8e')](_0x1e60e2)){this[_0x3af9('0x30')][_0x3af9('0x90')](util[_0x3af9('0x48')](_0x3af9('0xe2'),_0x1e60e2[_0x3af9('0x5e')]()),_0x5d9bfb[_0x1e60e2]);}}this[_0x3af9('0x39')](_0x5d9bfb['speech'],_0x3af9('0xe3'),_0x3af9('0xe4'),'');return this['channel']['noop'](util[_0x3af9('0x48')](_0x3af9('0xe5'),_0x5d9bfb['speech']));}return this[_0x3af9('0x30')][_0x3af9('0x26')](_0x4fe2b2,_0x3af9('0xe6'));};AGIVertices[_0x3af9('0xe')][_0x3af9('0xe7')]=function(_0x137677){logger[_0x3af9('0x29')](util[_0x3af9('0x48')](_0x3af9('0xe8'),_0x137677[_0x3af9('0x99')]));if(!this[_0x3af9('0x96')](_0x137677[_0x3af9('0x70')])){return this[_0x3af9('0x30')][_0x3af9('0x9a')]('no\x20project_id\x20configured');}if(!this[_0x3af9('0x96')](_0x137677[_0x3af9('0x71')])){return this[_0x3af9('0x30')][_0x3af9('0x9a')]('no\x20client_email\x20configured');}if(!this[_0x3af9('0x96')](_0x137677[_0x3af9('0x72')])){return this[_0x3af9('0x30')][_0x3af9('0x9a')](_0x3af9('0xe9'));}if(!this[_0x3af9('0x96')](_0x137677[_0x3af9('0x73')])){return this[_0x3af9('0x30')][_0x3af9('0x9a')](_0x3af9('0xea'));}if(!this['isConfigured'](_0x137677[_0x3af9('0x4f')])){return this['channel'][_0x3af9('0x9a')](_0x3af9('0x9b'));}this[_0x3af9('0x30')][_0x3af9('0xe0')]=!![];this[_0x3af9('0x2f')](_0x137677);this[_0x3af9('0x39')](_0x137677['text'],'in','','');this['channel'][_0x3af9('0x9a')](util[_0x3af9('0x48')]('Trying\x20DialogflowV2:\x20%s',_0x137677[_0x3af9('0x4f')]));var _0x27188d=this[_0x3af9('0x6f')][_0x3af9('0x63')](this,_0x137677);if(_0x27188d){for(var _0x404222 in _0x27188d){if(_0x27188d[_0x3af9('0x8e')](_0x404222)){if(_0x404222!=='providerResponse'){this[_0x3af9('0x30')][_0x3af9('0x90')](util['format'](_0x3af9('0xe2'),_0x404222[_0x3af9('0x5e')]()),_0x27188d[_0x404222]);}}}this[_0x3af9('0x39')](_0x27188d[_0x3af9('0xeb')],_0x3af9('0xe3'),_0x3af9('0xe7'),_0x27188d['providerResponse']);return this['channel'][_0x3af9('0x9a')](util[_0x3af9('0x48')]('DialogflowV2\x20Result\x20%s',_0x27188d['speech']));}return this[_0x3af9('0x30')][_0x3af9('0x26')](_0x137677,_0x3af9('0xec'));};AGIVertices[_0x3af9('0xe')][_0x3af9('0xed')]=function(_0x251970){logger[_0x3af9('0x29')](util[_0x3af9('0x48')]('Enter\x20in\x20SESTEKNDA\x20(%s)\x20block',_0x251970['label']));if(!this['isConfigured'](_0x251970[_0x3af9('0xee')])){return this[_0x3af9('0x30')][_0x3af9('0x9a')]('no\x20ndauth\x20url\x20configured');}if(!this[_0x3af9('0x96')](_0x251970[_0x3af9('0xef')])){return this[_0x3af9('0x30')][_0x3af9('0x9a')](_0x3af9('0xf0'));}if(!this[_0x3af9('0x96')](_0x251970[_0x3af9('0xf1')])){return this[_0x3af9('0x30')]['noop'](_0x3af9('0xf2'));}if(!this[_0x3af9('0x96')](_0x251970[_0x3af9('0xf3')])){return this[_0x3af9('0x30')][_0x3af9('0x9a')](_0x3af9('0x9b'));}this[_0x3af9('0x30')][_0x3af9('0xe0')]=!![];this[_0x3af9('0x2f')](_0x251970);this[_0x3af9('0x39')](_0x251970['text'],'in','','');this[_0x3af9('0x30')][_0x3af9('0x9a')](util[_0x3af9('0x48')](_0x3af9('0xf4'),_0x251970['text']));var _0x1a6ce5=this[_0x3af9('0x74')][_0x3af9('0x63')](this,_0x251970);if(_0x1a6ce5){for(var _0x4e2d90 in _0x1a6ce5){if(_0x1a6ce5[_0x3af9('0x8e')](_0x4e2d90)){this[_0x3af9('0x30')][_0x3af9('0x90')](util[_0x3af9('0x48')](_0x3af9('0xf5'),_0x4e2d90[_0x3af9('0x5e')]()),_0x1a6ce5[_0x4e2d90]);}}this[_0x3af9('0x39')](_0x1a6ce5['speech'],_0x3af9('0xe3'),_0x3af9('0xed'),'');if(_0x1a6ce5[_0x3af9('0xf6')]){this[_0x3af9('0x30')]['noop'](util[_0x3af9('0x48')](_0x3af9('0xf7'),_0x1a6ce5[_0x3af9('0xf6')]));var _0xe2a7ca=this[_0x3af9('0x30')][_0x3af9('0xf8')](_0x1a6ce5['audiofile']);try{fs[_0x3af9('0xf9')](_0x1a6ce5[_0x3af9('0xf6')]+_0x3af9('0xfa'));}catch(_0x5a9413){logger['error'](_0x5a9413);}return _0xe2a7ca;}else{return this[_0x3af9('0x30')][_0x3af9('0x9a')](util[_0x3af9('0x48')](_0x3af9('0xfb'),_0x1a6ce5[_0x3af9('0xeb')]));}}return this[_0x3af9('0x30')][_0x3af9('0x26')](_0x251970,_0x3af9('0xfc'));};AGIVertices[_0x3af9('0xe')][_0x3af9('0xfd')]=function(_0x471c98){logger[_0x3af9('0x29')](util[_0x3af9('0x48')](_0x3af9('0xfe'),_0x471c98[_0x3af9('0x99')]));return this[_0x3af9('0x30')][_0x3af9('0x9a')](_0x3af9('0xfd'));};AGIVertices['prototype']['ext_dial']=function(_0x3acf69){logger[_0x3af9('0x29')](util[_0x3af9('0x48')](_0x3af9('0xff'),_0x3acf69[_0x3af9('0x99')]));var _0x28f905='';if(_0x3acf69[_0x3af9('0x100')]){if(!this['isConfigured'](_0x3acf69['trunk_id'])){return this['channel']['error'](_0x3acf69,_0x3af9('0x101'));}else{var _0x4cdb2a=parseInt(_0x3acf69['trunk_id'],0xa);if(isNaN(_0x4cdb2a)){_0x28f905=_0x3acf69['trunk_id'];}else{_0x28f905=this[_0x3af9('0x102')][_0x3af9('0x63')](this,_0x3acf69['trunk_id']);if(!_0x28f905){return this[_0x3af9('0x30')][_0x3af9('0x26')](_0x3acf69,_0x3af9('0x103'));}}}}else if(_0x3acf69[_0x3af9('0x104')]){_0x28f905=_0x3acf69['trunk_name'];}else{return this[_0x3af9('0x30')][_0x3af9('0x26')](_0x3acf69,_0x3af9('0x101'));}var _0x4eb2a2=this[_0x3af9('0x30')][_0x3af9('0x4c')]('DIAL',[util[_0x3af9('0x48')](_0x3af9('0x105'),_0x28f905,_0x3acf69[_0x3af9('0x3e')]),_0x3acf69['timeout'],_0x3acf69[_0x3af9('0xdc')],_0x3acf69[_0x3af9('0x59')]]);if(_0x4eb2a2['result']===-0x1){return _0x4eb2a2;}return this[_0x3af9('0x30')][_0x3af9('0x9a')](util['format']('Executed\x20command\x20%s',_0x3af9('0xda')));};AGIVertices[_0x3af9('0xe')][_0x3af9('0x106')]=function(_0x12553e){logger[_0x3af9('0x29')](util[_0x3af9('0x48')](_0x3af9('0x107'),_0x12553e[_0x3af9('0x99')]));return this[_0x3af9('0x30')][_0x3af9('0x9a')](_0x3af9('0x106'));};AGIVertices[_0x3af9('0xe')][_0x3af9('0x108')]=function(_0x30aa4d){logger[_0x3af9('0x29')](util[_0x3af9('0x48')](_0x3af9('0x109'),_0x30aa4d[_0x3af9('0x99')]));if(_0x30aa4d[_0x3af9('0x97')]===0x0){return this[_0x3af9('0x98')](_0x30aa4d);}_0x30aa4d[_0x3af9('0x97')]-=0x1;if(!this[_0x3af9('0x96')](_0x30aa4d['file_id'])){return this[_0x3af9('0x30')][_0x3af9('0x26')](_0x30aa4d,_0x3af9('0x10a'));}var _0x2b09b3=this[_0x3af9('0x1c')][_0x3af9('0x63')](this,_0x30aa4d[_0x3af9('0x10b')]);if(!_0x2b09b3){return this[_0x3af9('0x30')][_0x3af9('0x26')](_0x30aa4d,_0x3af9('0x10c'));}if(!this['isConfigured'](_0x30aa4d['variable_id'])){return this['channel'][_0x3af9('0x26')](_0x3af9('0xcd'));}var _0xa46a83=this[_0x3af9('0x30')][_0x3af9('0x10d')](_0x2b09b3,_0x30aa4d[_0x3af9('0x10e')],_0x30aa4d['maxdigit']);var _0x1e00c0=_0xa46a83[_0x3af9('0x9c')]?_0xa46a83[_0x3af9('0x9c')]['toString']():'';logger['info']('test',JSON[_0x3af9('0x67')](_0xa46a83));if(_0xa46a83[_0x3af9('0x9c')]===-0x1){this[_0x3af9('0x2f')]['sync'](this,_0x30aa4d,_0x1e00c0);return _0xa46a83;}else if(_0xa46a83[_0x3af9('0x95')]===_0x3af9('0x5a')){_0xa46a83[_0x3af9('0x9c')]=_0x1e00c0[_0x3af9('0x8c')]>=parseInt(_0x30aa4d[_0x3af9('0x10f')])?'x':'i';}else{_0xa46a83[_0x3af9('0x9c')]=_0x1e00c0[_0x3af9('0x8c')]>=parseInt(_0x30aa4d[_0x3af9('0x10f')])&&_0x1e00c0['length']<=parseInt(_0x30aa4d['maxdigit'])?'x':'i';}var _0x4cbce6=this['getVariable']['sync'](this,_0x30aa4d['variable_id']);if(!_0x4cbce6){return this[_0x3af9('0x30')][_0x3af9('0x26')](_0x30aa4d,'no\x20variable\x20found');}this[_0x3af9('0x30')][_0x3af9('0x90')](_0x4cbce6,_0x1e00c0);if(this[_0x3af9('0x96')](_0x30aa4d[_0x3af9('0x110')])){var _0x22bb35=parseInt(_0x30aa4d[_0x3af9('0x110')],0xa);var _0x3c0533=rs[_0x3af9('0x111')]({'charset':'*','length':_0x22bb35});var _0x12b518=_0x1e00c0['length'];if(_0x12b518>0x0){if(_0x12b518>_0x22bb35){this[_0x3af9('0x2f')][_0x3af9('0x63')](this,_0x30aa4d,_0x30aa4d[_0x3af9('0x112')]===_0x3af9('0x113')?_0x3c0533+_0x1e00c0[_0x3af9('0x114')](_0x22bb35):_0x1e00c0[_0x3af9('0x114')](0x0,_0x12b518-_0x22bb35)+_0x3c0533);}else{this[_0x3af9('0x2f')]['sync'](this,_0x30aa4d,rs['generate']({'charset':'*','length':_0x12b518}));}}else{this[_0x3af9('0x2f')][_0x3af9('0x63')](this,_0x30aa4d,'');}}else{this[_0x3af9('0x2f')][_0x3af9('0x63')](this,_0x30aa4d,_0x1e00c0);}return _0xa46a83;};AGIVertices[_0x3af9('0xe')][_0x3af9('0xc')]=function(_0x3e0c0f){logger[_0x3af9('0x29')](util[_0x3af9('0x48')](_0x3af9('0x115'),_0x3e0c0f[_0x3af9('0x99')]));return this[_0x3af9('0x108')](_0x3e0c0f);};AGIVertices[_0x3af9('0xe')][_0x3af9('0x116')]=function(_0x57f579){logger[_0x3af9('0x29')](util[_0x3af9('0x48')](_0x3af9('0x117'),_0x57f579[_0x3af9('0x99')]));this[_0x3af9('0x2f')][_0x3af9('0x63')](this,_0x57f579,_0x57f579[_0x3af9('0x118')]);return this[_0x3af9('0x30')][_0x3af9('0x9a')](util[_0x3af9('0x48')](_0x3af9('0x119'),_0x57f579['goalname']));};AGIVertices[_0x3af9('0xe')][_0x3af9('0x11a')]=function(_0x2f7d3e){logger['info'](util[_0x3af9('0x48')](_0x3af9('0x11b'),_0x2f7d3e[_0x3af9('0x99')]));if(!this[_0x3af9('0x96')](_0x2f7d3e['aws_access_key_id'])||!this[_0x3af9('0x96')](_0x2f7d3e[_0x3af9('0x7b')])){return this[_0x3af9('0x30')]['noop'](_0x3af9('0x11c'));}if(!this[_0x3af9('0x96')](_0x2f7d3e[_0x3af9('0x4f')])){return this['channel'][_0x3af9('0x9a')]('no\x20text\x20configured');}this[_0x3af9('0x30')][_0x3af9('0x9a')](util[_0x3af9('0x48')]('Trying\x20aws\x20Polly\x20%s',_0x2f7d3e['text']));var _0x2ae136=this['awsPolly'][_0x3af9('0x63')](this,_0x2f7d3e);if(_0x2ae136){this[_0x3af9('0x30')][_0x3af9('0x9a')](util['format'](_0x3af9('0x11d'),_0x2ae136));var _0x1d4ef4=this[_0x3af9('0x30')][_0x3af9('0xf8')](_0x2ae136);try{fs[_0x3af9('0xf9')](_0x2ae136+_0x3af9('0xfa'));}catch(_0x29a406){logger[_0x3af9('0x26')](_0x29a406);}return _0x1d4ef4;}return this['channel']['error'](_0x2f7d3e,_0x3af9('0x11e'));};AGIVertices['prototype'][_0x3af9('0x11f')]=function(_0xc15d87){logger[_0x3af9('0x29')](util['format'](_0x3af9('0x120'),_0xc15d87['label']));if(!this[_0x3af9('0x96')](_0xc15d87[_0x3af9('0x7a')])||!this[_0x3af9('0x96')](_0xc15d87['aws_secret_access_key'])){return this[_0x3af9('0x30')][_0x3af9('0x9a')](_0x3af9('0x11c'));}if(!this['isConfigured'](_0xc15d87['aws_bot_name'])){return this[_0x3af9('0x30')][_0x3af9('0x9a')]('no\x20bot\x20name\x20configured');}if(!this[_0x3af9('0x96')](_0xc15d87[_0x3af9('0x4f')])){return this[_0x3af9('0x30')]['noop']('no\x20text\x20configured');}this[_0x3af9('0x30')]['bot']=!![];this[_0x3af9('0x2f')](_0xc15d87);this[_0x3af9('0x39')](_0xc15d87[_0x3af9('0x4f')],'in','','');this[_0x3af9('0x30')][_0x3af9('0x9a')](util[_0x3af9('0x48')]('Trying\x20Amazon\x20Lex:\x20%s',_0xc15d87['text']));var _0x380c3b=this[_0x3af9('0x7f')][_0x3af9('0x63')](this,_0xc15d87);if(_0x380c3b){for(var _0x499de9 in _0x380c3b){if(_0x380c3b[_0x3af9('0x8e')](_0x499de9)&&_[_0x3af9('0x86')](_0x380c3b[_0x499de9])){this['channel']['setVariable'](util[_0x3af9('0x48')](_0x3af9('0x121'),_0x499de9[_0x3af9('0x5e')]()),_0x380c3b[_0x499de9]);}}if(_[_0x3af9('0x3c')](_0x380c3b[_0x3af9('0x6b')])){return this[_0x3af9('0x30')]['noop'](_0x3af9('0x122'));}else{this['createSquareMessage'](_0x380c3b[_0x3af9('0x6b')],_0x3af9('0xe3'),_0x3af9('0x123'),'');return this['channel'][_0x3af9('0x9a')](util['format']('Amazon\x20Lex\x20Result\x20%s',_0x380c3b[_0x3af9('0x6b')]));}}return this[_0x3af9('0x30')][_0x3af9('0x26')](_0xc15d87,_0x3af9('0x124'));};AGIVertices[_0x3af9('0xe')][_0x3af9('0x125')]=function(_0xd5f468){logger[_0x3af9('0x29')](util['format'](_0x3af9('0x126'),_0xd5f468[_0x3af9('0x99')],_0xd5f468['timeout']));if(!this['isConfigured'](_0xd5f468[_0x3af9('0x76')])){return this[_0x3af9('0x30')][_0x3af9('0x9a')](_0x3af9('0xdf'));}var _0x30e181='wav';var _0x59af37=util[_0x3af9('0x48')](_0x3af9('0x127'),FILES_PATH,rs[_0x3af9('0x111')](0x4));var _0x24c8b6=util[_0x3af9('0x48')](_0x3af9('0x8f'),_0x59af37,_0x30e181);var _0x43534b=!![];if(_0xd5f468[_0x3af9('0x128')]==='NOBEEP'){_0x43534b=![];}var _0x2eda24=this[_0x3af9('0x30')]['recordFile'](_0x59af37,_0x30e181,_0xd5f468['intKey'],_0xd5f468[_0x3af9('0x5a')],undefined,_0x43534b);if(_0x2eda24['result']!==-0x1){this[_0x3af9('0x30')][_0x3af9('0x9a')](util[_0x3af9('0x48')](_0x3af9('0x129'),_0x24c8b6));var _0x4e7f3d=this[_0x3af9('0x80')][_0x3af9('0x63')](this,_0xd5f468,_0x24c8b6);if(_0x4e7f3d){for(var _0x5a5792 in _0x4e7f3d){if(_0x4e7f3d[_0x3af9('0x8e')](_0x5a5792)){this[_0x3af9('0x30')]['setVariable'](util[_0x3af9('0x48')](_0x3af9('0x12a'),_0x5a5792['toUpperCase']()),_0x4e7f3d[_0x5a5792]);}}return this[_0x3af9('0x30')][_0x3af9('0x9a')](util[_0x3af9('0x48')](_0x3af9('0x12b'),JSON[_0x3af9('0x67')](_0x4e7f3d)));}}return _0x2eda24;};AGIVertices[_0x3af9('0xe')][_0x3af9('0x12c')]=function(_0xcceabb){logger['info'](util[_0x3af9('0x48')]('Enter\x20in\x20TILDEASR\x20(%s)\x20block',_0xcceabb[_0x3af9('0x99')]));if(!this['isConfigured'](_0xcceabb[_0x3af9('0x82')])){return this[_0x3af9('0x30')][_0x3af9('0x9a')](_0x3af9('0x12d'));}if(!this[_0x3af9('0x96')](_0xcceabb[_0x3af9('0x83')])){return this[_0x3af9('0x30')][_0x3af9('0x9a')](_0x3af9('0x12e'));}var _0x19bfdf='wav';var _0x34e79a=util[_0x3af9('0x48')](_0x3af9('0x127'),FILES_PATH,rs[_0x3af9('0x111')](0x4));var _0x4b208a=util[_0x3af9('0x48')]('%s.%s',_0x34e79a,_0x19bfdf);var _0x2f7534=!![];if(_0xcceabb[_0x3af9('0x128')]===_0x3af9('0x12f')){_0x2f7534=![];}var _0x1ecc43=this['channel'][_0x3af9('0x130')](_0x34e79a,_0x19bfdf,_0xcceabb[_0x3af9('0x131')],_0xcceabb[_0x3af9('0x5a')],undefined,_0x2f7534);if(_0x1ecc43[_0x3af9('0x9c')]!==-0x1){this[_0x3af9('0x30')][_0x3af9('0x9a')](util[_0x3af9('0x48')](_0x3af9('0x132'),_0x4b208a));var _0x3f29c6=this[_0x3af9('0x81')]['sync'](this,_0xcceabb,_0x4b208a);if(_0x3f29c6){for(var _0x1ded78 in _0x3f29c6){if(_0x3f29c6[_0x3af9('0x8e')](_0x1ded78)){this[_0x3af9('0x30')][_0x3af9('0x90')](util[_0x3af9('0x48')](_0x3af9('0x133'),_0x1ded78[_0x3af9('0x5e')]()),_0x3f29c6[_0x1ded78]);}}return this['channel']['noop'](util['format']('TildeASR\x20Result\x20%s',JSON[_0x3af9('0x67')](_0x3f29c6)));}}return _0x1ecc43;};AGIVertices[_0x3af9('0xe')]['gotoc']=function(_0x6e1089){logger['info'](util['format'](_0x3af9('0x134'),_0x6e1089[_0x3af9('0x99')]));return this[_0x3af9('0x30')]['continueAt'](_0x6e1089[_0x3af9('0x36')],_0x6e1089[_0x3af9('0x135')],_0x6e1089[_0x3af9('0x37')]);};AGIVertices[_0x3af9('0xe')][_0x3af9('0x136')]=function(_0xe30208){logger['info'](util[_0x3af9('0x48')](_0x3af9('0x137'),_0xe30208[_0x3af9('0x99')]));if(!this[_0x3af9('0x96')](_0xe30208[_0x3af9('0x138')])){return this['channel'][_0x3af9('0x26')](_0xe30208,'no\x20condition\x20configured');}try{var _0x371967=eval(_0xe30208[_0x3af9('0x138')])?_0x3af9('0x139'):_0x3af9('0x13a');this['channel'][_0x3af9('0x9a')](util['format'](_0x3af9('0x13b'),_0xe30208[_0x3af9('0x138')],_0x371967));return{'code':0xc8,'result':_0x371967};}catch(_0x384179){return{'code':0xc8,'result':_0x3af9('0x13a')};}};AGIVertices[_0x3af9('0xe')][_0x3af9('0x13c')]=function(_0x453554){logger[_0x3af9('0x29')](util[_0x3af9('0x48')](_0x3af9('0x13d'),_0x453554[_0x3af9('0x99')]));if(!this[_0x3af9('0x96')](_0x453554[_0x3af9('0x13e')])){return this[_0x3af9('0x30')][_0x3af9('0x26')](_0x453554,_0x3af9('0x13f'));}var _0x66e7e0=this[_0x3af9('0x20')]['sync'](this,_0x453554[_0x3af9('0x13e')]);if(!_0x66e7e0){return this[_0x3af9('0x30')][_0x3af9('0x26')](_0x453554,'no\x20intervals\x20found');}for(var _0x3e165d=0x0;_0x3e165d<_0x66e7e0[_0x3af9('0x8c')];_0x3e165d+=0x1){var _0x335964=this[_0x3af9('0x30')][_0x3af9('0xf')](util[_0x3af9('0x48')](_0x3af9('0x140'),_0x66e7e0[_0x3e165d]));if(_0x335964[_0x3af9('0x9c')]===-0x1){return _0x335964;}logger[_0x3af9('0x29')](util['format'](_0x3af9('0x141'),_0x66e7e0[_0x3e165d],_0x335964[_0x3af9('0x95')]));if(_0x335964[_0x3af9('0x95')]===_0x3af9('0x139')){logger[_0x3af9('0x29')](util[_0x3af9('0x48')](_0x3af9('0x141'),_0x66e7e0[_0x3e165d],_0x3af9('0x139')));this[_0x3af9('0x30')][_0x3af9('0x9a')](util[_0x3af9('0x48')]('IFTIME\x20%s\x20%s',_0x66e7e0[_0x3e165d],_0x3af9('0x139')));return{'code':0xc8,'result':_0x3af9('0x139')};}else{logger['info'](util[_0x3af9('0x48')]('IFTIME\x20%s\x20%s',_0x66e7e0[_0x3e165d],_0x3af9('0x13a')));this['channel'][_0x3af9('0x9a')](util[_0x3af9('0x48')](_0x3af9('0x141'),_0x66e7e0[_0x3e165d],'false'));}}return{'code':0xc8,'result':_0x3af9('0x13a')};};AGIVertices[_0x3af9('0xe')][_0x3af9('0x142')]=function(_0x506b97){logger[_0x3af9('0x29')](util[_0x3af9('0x48')]('Enter\x20in\x20HANGUP\x20(%s)\x20block',_0x506b97[_0x3af9('0x99')]));return this['channel'][_0x3af9('0x142')]();};AGIVertices[_0x3af9('0xe')]['ispeechasr']=function(_0x13d6ff){logger[_0x3af9('0x29')](util['format']('Enter\x20in\x20ISPEECHASR\x20(%s)\x20block',_0x13d6ff['label']));if(!this[_0x3af9('0x96')](_0x13d6ff[_0x3af9('0x76')])){return this[_0x3af9('0x30')]['noop'](_0x3af9('0xdf'));}var _0x3a4642=_0x3af9('0x143');var _0x3a3c8a=util['format']('%s/recordings/%s',FILES_PATH,rs[_0x3af9('0x111')](0x4));var _0x2ba4e0=util[_0x3af9('0x48')]('%s.%s',_0x3a3c8a,_0x3a4642);var _0x7b8542=!![];if(_0x13d6ff[_0x3af9('0x128')]===_0x3af9('0x12f')){_0x7b8542=![];}var _0x1224b8=this[_0x3af9('0x30')][_0x3af9('0x130')](_0x3a3c8a,_0x3a4642,_0x13d6ff[_0x3af9('0x131')],_0x13d6ff[_0x3af9('0x5a')],undefined,_0x7b8542);if(_0x1224b8['result']!==-0x1){this[_0x3af9('0x30')][_0x3af9('0x9a')](util[_0x3af9('0x48')](_0x3af9('0x144'),_0x2ba4e0));var _0x5d92a7=this[_0x3af9('0x77')][_0x3af9('0x63')](this,_0x13d6ff,_0x2ba4e0);if(_0x5d92a7){for(var _0x12439a in _0x5d92a7){if(_0x5d92a7['hasOwnProperty'](_0x12439a)){this['channel'][_0x3af9('0x90')](util['format']('ISPEECH_ASR_%s',_0x12439a[_0x3af9('0x5e')]()),_0x5d92a7[_0x12439a]);}}return this[_0x3af9('0x30')][_0x3af9('0x9a')](util['format'](_0x3af9('0x145'),JSON[_0x3af9('0x67')](_0x5d92a7)));}}return _0x1224b8;};AGIVertices[_0x3af9('0xe')][_0x3af9('0x146')]=function(_0x577e44){logger[_0x3af9('0x29')](util['format'](_0x3af9('0x147'),_0x577e44[_0x3af9('0x99')]));if(!this[_0x3af9('0x96')](_0x577e44[_0x3af9('0x76')])){return this[_0x3af9('0x30')][_0x3af9('0x9a')]('no\x20key\x20configured');}if(!this['isConfigured'](_0x577e44['text'])){return this['channel']['noop'](_0x3af9('0x9b'));}this[_0x3af9('0x30')][_0x3af9('0x9a')](util['format'](_0x3af9('0x148'),_0x577e44[_0x3af9('0x4f')]));var _0x125ae5=this[_0x3af9('0x75')][_0x3af9('0x63')](this,_0x577e44);if(_0x125ae5){this['channel'][_0x3af9('0x9a')](util['format'](_0x3af9('0x144'),_0x125ae5));var _0x2a433c=this[_0x3af9('0x30')][_0x3af9('0xf8')](_0x125ae5,_0x577e44[_0x3af9('0x131')]);try{fs[_0x3af9('0xf9')](_0x125ae5+_0x3af9('0xfa'));}catch(_0x45c14f){logger[_0x3af9('0x26')](_0x45c14f);}return _0x2a433c;}return this[_0x3af9('0x30')][_0x3af9('0x26')](_0x577e44,_0x3af9('0x149'));};AGIVertices['prototype'][_0x3af9('0x14a')]=function(_0x48b5f5){logger[_0x3af9('0x29')](util[_0x3af9('0x48')](_0x3af9('0x14b'),_0x48b5f5[_0x3af9('0x99')]));if(!this[_0x3af9('0x96')](_0x48b5f5['findBy'])){return this[_0x3af9('0x30')][_0x3af9('0x26')](_0x48b5f5,_0x3af9('0x14c'));}logger[_0x3af9('0x29')](util[_0x3af9('0x48')]('FIND\x20AGENT\x20%s\x20BY\x20%s',this['channel'][_0x3af9('0x33')],_0x48b5f5[_0x3af9('0x14d')]));var _0x2a8ec3=this[_0x3af9('0x47')][_0x3af9('0x63')](this,_0x48b5f5[_0x3af9('0x14d')]);if(_0x2a8ec3){logger[_0x3af9('0x29')](util[_0x3af9('0x48')]('AGENT\x20%s\x20FOUND\x20BY',this[_0x3af9('0x30')][_0x3af9('0x33')],_0x48b5f5[_0x3af9('0x14d')]));this[_0x3af9('0x30')]['noop'](util[_0x3af9('0x48')](_0x3af9('0x14e'),this[_0x3af9('0x30')]['callerid'],_0x48b5f5['findBy']));return{'code':0xc8,'result':'success'};}else{logger[_0x3af9('0x29')](util['format'](_0x3af9('0x14f'),this[_0x3af9('0x30')][_0x3af9('0x33')],_0x48b5f5['findBy']));this['channel'][_0x3af9('0x9a')](util['format']('AGENT\x20%s\x20NOT\x20FOUND\x20BY',this['channel']['callerid'],_0x48b5f5[_0x3af9('0x14d')]));return{'code':0xc8,'result':'failure'};}};AGIVertices[_0x3af9('0xe')]['logout']=function(_0x36bc34){logger['info'](util[_0x3af9('0x48')](_0x3af9('0x150'),_0x36bc34['label']));if(!this[_0x3af9('0x96')](_0x36bc34['findBy'])){return this[_0x3af9('0x30')][_0x3af9('0x26')](_0x36bc34,_0x3af9('0x14c'));}logger[_0x3af9('0x29')](util[_0x3af9('0x48')](_0x3af9('0x151'),this[_0x3af9('0x30')][_0x3af9('0x33')],_0x36bc34[_0x3af9('0x14d')]));var _0x1a61ca=this[_0x3af9('0x152')][_0x3af9('0x63')](this,_0x36bc34[_0x3af9('0x14d')]);if(_0x1a61ca){logger[_0x3af9('0x29')](util[_0x3af9('0x48')]('AGENT\x20%s\x20FOUND\x20BY',this['channel']['callerid'],_0x36bc34[_0x3af9('0x14d')]));this[_0x3af9('0x30')]['noop'](util[_0x3af9('0x48')](_0x3af9('0x14e'),this['channel']['callerid'],_0x36bc34['findBy']));return{'code':0xc8,'result':'success'};}else{logger['info'](util[_0x3af9('0x48')]('AGENT\x20%s\x20NOT\x20FOUND\x20BY',this['channel'][_0x3af9('0x33')],_0x36bc34['findBy']));this['channel'][_0x3af9('0x9a')](util[_0x3af9('0x48')](_0x3af9('0x14f'),this[_0x3af9('0x30')][_0x3af9('0x33')],_0x36bc34['findBy']));return{'code':0xc8,'result':_0x3af9('0x153')};}};AGIVertices[_0x3af9('0xe')][_0x3af9('0x154')]=function(_0x14ed9b){logger[_0x3af9('0x29')](util[_0x3af9('0x48')](_0x3af9('0x155'),_0x14ed9b[_0x3af9('0x99')]));if(!this[_0x3af9('0x96')](_0x14ed9b[_0x3af9('0x156')])){return this[_0x3af9('0x30')][_0x3af9('0x26')](_0x14ed9b,_0x3af9('0x157'));}this['channel'][_0x3af9('0x9a')](util[_0x3af9('0x48')](_0x3af9('0x158'),_0x14ed9b['operation']));var _0x5c33e4=eval(_0x14ed9b[_0x3af9('0x156')]);if(!this['isConfigured'](_0x14ed9b[_0x3af9('0xcc')])){return this['channel']['noop'](_0x3af9('0xcd'));}var _0x73c886=this[_0x3af9('0xf')]['sync'](this,_0x14ed9b[_0x3af9('0xcc')]);if(!_0x73c886){return this[_0x3af9('0x30')][_0x3af9('0x26')](_0x14ed9b,'no\x20variable\x20found');}if(_['isArray'](_0x5c33e4)){var _0x3b32ff=this;_0x5c33e4[_0x3af9('0xcf')](function(_0x55fa31,_0x32e30f){_0x3b32ff[_0x3af9('0x30')][_0x3af9('0x90')](util[_0x3af9('0x48')]('%s[%s]',_0x73c886,_0x32e30f),_0x55fa31);});return this['channel'][_0x3af9('0x9a')](util[_0x3af9('0x48')](_0x3af9('0x159'),_0x73c886));}else{return this[_0x3af9('0x30')]['setVariable'](_0x73c886,_0x5c33e4);}};AGIVertices['prototype'][_0x3af9('0xb')]=function(_0x3394ee){logger['info'](util['format']('Enter\x20in\x20MENU\x20(%s)\x20block',_0x3394ee[_0x3af9('0x99')]));if(_0x3394ee['retry']===0x0){return this[_0x3af9('0x98')](_0x3394ee);}_0x3394ee[_0x3af9('0x97')]-=0x1;if(!this[_0x3af9('0x96')](_0x3394ee['file_id'])){return this[_0x3af9('0x30')][_0x3af9('0x26')](_0x3394ee,'no\x20file\x20audio\x20selected');}var _0x4fb4b2=this[_0x3af9('0x1c')][_0x3af9('0x63')](this,_0x3394ee[_0x3af9('0x10b')]);if(!_0x4fb4b2){return this[_0x3af9('0x30')][_0x3af9('0x26')](_0x3394ee,_0x3af9('0x10c'));}var _0x4947dd=this[_0x3af9('0x30')][_0x3af9('0x10d')](_0x4fb4b2,_0x3394ee['response'],_0x3394ee['digit']);var _0x47eddb=_0x4947dd[_0x3af9('0x9c')];if(_0x4947dd['result']===-0x1){this[_0x3af9('0x2f')][_0x3af9('0x63')](this,_0x3394ee,'-1');return _0x4947dd;}else if(_0x4947dd[_0x3af9('0x95')]===_0x3af9('0x5a')){_0x4947dd['result']=_0x4947dd[_0x3af9('0x9c')][_0x3af9('0x8c')]>0x0?_0x4947dd['result']:'t';}else if(_['isEmpty'](_0x4947dd['result'])){_0x4947dd[_0x3af9('0x9c')]='#';_0x47eddb='#';}if(!this[_0x3af9('0x96')](_0x3394ee[_0x3af9('0xcc')])){this[_0x3af9('0x30')][_0x3af9('0x9a')](_0x3af9('0xcd'));}else{var _0x412485=this[_0x3af9('0xf')][_0x3af9('0x63')](this,_0x3394ee[_0x3af9('0xcc')]);if(!_0x412485){return this[_0x3af9('0x30')][_0x3af9('0x26')](_0x3394ee,'no\x20variable\x20found');}this[_0x3af9('0x30')]['setVariable'](_0x412485,_0x47eddb);}this[_0x3af9('0x2f')][_0x3af9('0x63')](this,_0x3394ee,_0x47eddb);return _0x4947dd;};AGIVertices[_0x3af9('0xe')][_0x3af9('0x9a')]=function(_0x3c3a36){logger[_0x3af9('0x29')](util['format'](_0x3af9('0x15a'),_0x3c3a36[_0x3af9('0x99')]));return this[_0x3af9('0x30')]['noop'](_0x3c3a36[_0x3af9('0x15b')]||_0x3c3a36[_0x3af9('0x99')]);};AGIVertices[_0x3af9('0xe')][_0x3af9('0x15c')]=function(_0xa7a6b5){logger[_0x3af9('0x29')](util[_0x3af9('0x48')](_0x3af9('0x15d'),_0xa7a6b5['label']));if(!this[_0x3af9('0x96')](_0xa7a6b5[_0x3af9('0x14d')])){return this[_0x3af9('0x30')]['error'](_0xa7a6b5,_0x3af9('0x14c'));}logger[_0x3af9('0x29')](util[_0x3af9('0x48')]('FIND\x20AGENT\x20%s\x20BY\x20%s',this[_0x3af9('0x30')]['callerid'],_0xa7a6b5[_0x3af9('0x14d')]));var _0x52c5e6=this['getPause'][_0x3af9('0x63')](this,_0xa7a6b5[_0x3af9('0x15e')]);var _0x3200f6=this[_0x3af9('0x44')]['sync'](this,_0xa7a6b5[_0x3af9('0x14d')],_0x52c5e6);if(_0x3200f6){logger[_0x3af9('0x29')](util[_0x3af9('0x48')](_0x3af9('0x14e'),this['channel']['callerid'],_0xa7a6b5[_0x3af9('0x14d')]));this[_0x3af9('0x30')][_0x3af9('0x9a')](util[_0x3af9('0x48')](_0x3af9('0x14e'),this[_0x3af9('0x30')]['callerid'],_0xa7a6b5[_0x3af9('0x14d')]));return{'code':0xc8,'result':_0x3af9('0x15f')};}else{logger[_0x3af9('0x29')](util['format'](_0x3af9('0x14f'),this[_0x3af9('0x30')][_0x3af9('0x33')],_0xa7a6b5[_0x3af9('0x14d')]));this['channel'][_0x3af9('0x9a')](util['format'](_0x3af9('0x14e'),this['channel'][_0x3af9('0x33')],_0xa7a6b5[_0x3af9('0x14d')]));return{'code':0xc8,'result':_0x3af9('0x153')};}};AGIVertices[_0x3af9('0xe')][_0x3af9('0x160')]=function(_0x368634){logger[_0x3af9('0x29')](util[_0x3af9('0x48')](_0x3af9('0x161'),_0x368634['label']));if(!this[_0x3af9('0x96')](_0x368634['file_id'])){return this['channel'][_0x3af9('0x26')](_0x368634,_0x3af9('0x10a'));}var _0x3bbc49=this[_0x3af9('0x1c')][_0x3af9('0x63')](this,_0x368634[_0x3af9('0x10b')]);if(!_0x3bbc49){return this['channel'][_0x3af9('0x26')](_0x368634,'no\x20file\x20audio\x20found');}var _0x3a0042=this[_0x3af9('0x30')][_0x3af9('0x4c')]('PLAYBACK',[_0x3bbc49,_0x368634['opts']]);if(_0x3a0042['result']===-0x1){return _0x3a0042;}return this[_0x3af9('0x30')][_0x3af9('0x9a')](util[_0x3af9('0x48')]('Executed\x20command\x20%s\x20%s','PLAYBACK',_0x3bbc49));};AGIVertices[_0x3af9('0xe')][_0x3af9('0x162')]=function(_0x55b6db){logger[_0x3af9('0x29')](util['format'](_0x3af9('0x163'),_0x55b6db[_0x3af9('0x99')]));if(!this['isConfigured'](_0x55b6db[_0x3af9('0x164')])){return this[_0x3af9('0x30')][_0x3af9('0x26')](_0x55b6db,_0x3af9('0x165'));}var _0x3153e5='';var _0x195c46=parseInt(_0x55b6db[_0x3af9('0x164')],0xa);if(isNaN(_0x195c46)){_0x3153e5=_0x55b6db[_0x3af9('0x164')];}else{_0x3153e5=this[_0x3af9('0x166')][_0x3af9('0x63')](this,_0x55b6db[_0x3af9('0x164')]);if(!_0x3153e5){return this['channel'][_0x3af9('0x26')](_0x55b6db,_0x3af9('0x167'));}}var _0x1d719e='';if(this[_0x3af9('0x96')](_0x55b6db[_0x3af9('0x10b')])){var _0x46bd25=this['getSound'][_0x3af9('0x63')](this,_0x55b6db[_0x3af9('0x10b')]);if(_0x46bd25){_0x1d719e=_0x46bd25;}}this[_0x3af9('0x2f')]['sync'](this,_0x55b6db,_0x3153e5);if(_0x55b6db[_0x3af9('0xdc')][_0x3af9('0x168')]('x')<0x0){_0x55b6db['opts']+='x';}if(_0x55b6db[_0x3af9('0xdc')][_0x3af9('0x168')]('X')<0x0){_0x55b6db[_0x3af9('0xdc')]+='X';}this[_0x3af9('0x30')][_0x3af9('0x90')]('XMCS-QUEUE',_0x3153e5?_0x3153e5[_0x3af9('0x169')]():'');var _0x5649de=this[_0x3af9('0x30')]['exec'](_0x3af9('0x16a'),[_0x3153e5,_0x55b6db['opts'],_0x55b6db[_0x3af9('0x59')],_0x1d719e,_0x55b6db[_0x3af9('0x5a')],_0x55b6db[_0x3af9('0x6')],_0x55b6db[_0x3af9('0x16b')],_0x55b6db['gosub'],'',_0x55b6db['position']]);if(_0x5649de['result']===-0x1){return _0x5649de;}return this[_0x3af9('0x30')][_0x3af9('0x9a')](util['format'](_0x3af9('0xb4'),_0x3af9('0x16a'),_0x3153e5));};AGIVertices[_0x3af9('0xe')][_0x3af9('0x16c')]=function(_0x2659b8){logger[_0x3af9('0x29')](util[_0x3af9('0x48')](_0x3af9('0x16d'),_0x2659b8[_0x3af9('0x99')]));var _0x3dc522=_0x2659b8[_0x3af9('0x16e')]||_0x3af9('0x143');var _0x4ddcd5=util['format'](_0x3af9('0x16f'),this['channel'][_0x3af9('0x41')],rs[_0x3af9('0x111')](0x5));var _0x49e656=util[_0x3af9('0x48')](_0x3af9('0x170'),FILES_PATH,_0x4ddcd5,_0x3dc522);var _0x500dfc=util[_0x3af9('0x48')](_0x3af9('0x127'),FILES_PATH,_0x4ddcd5);this[_0x3af9('0x34')][_0x3af9('0x63')](this,_0x2659b8,_0x4ddcd5,_0x49e656);this['channel'][_0x3af9('0x90')](_0x3af9('0x171'),_0x4ddcd5);logger[_0x3af9('0x29')](_0x3af9('0x172'),_0x500dfc,_0x3dc522,_0x2659b8[_0x3af9('0x173')],_0x2659b8['timeout']);return this[_0x3af9('0x30')][_0x3af9('0x130')](_0x500dfc,_0x3dc522,_0x2659b8[_0x3af9('0x173')],_0x2659b8['timeout'],undefined,!![]);};AGIVertices[_0x3af9('0xe')]['restapi']=function(_0xc6106e){logger['info'](util[_0x3af9('0x48')](_0x3af9('0x174'),_0xc6106e[_0x3af9('0x99')]));if(!this[_0x3af9('0x96')](_0xc6106e[_0x3af9('0x59')])){return this[_0x3af9('0x30')][_0x3af9('0x9a')](_0x3af9('0x175'));}var _0x16146f=this[_0x3af9('0x58')][_0x3af9('0x63')](this,_0xc6106e);logger[_0x3af9('0x29')](util[_0x3af9('0x48')]('Response:',util[_0x3af9('0x176')](_0x16146f,{'showHidden':![],'depth':null})));if(!this[_0x3af9('0x96')](_0xc6106e[_0x3af9('0xcc')])){return this[_0x3af9('0x30')][_0x3af9('0x9a')](_0x3af9('0x177'));}var _0xb60141=this[_0x3af9('0xf')][_0x3af9('0x63')](this,_0xc6106e[_0x3af9('0xcc')]);if(!_0xb60141){return this[_0x3af9('0x30')]['error'](_0xc6106e,_0x3af9('0xce'));}this['channel'][_0x3af9('0x90')](util[_0x3af9('0x48')](_0x3af9('0x178'),_0xb60141),_0x16146f[_0x3af9('0x69')]?_0x16146f[_0x3af9('0x69')]:'200');this[_0x3af9('0x30')]['setVariable'](util['format'](_0x3af9('0x179'),_0xb60141),_0x16146f[_0x3af9('0x6a')]?_0x16146f[_0x3af9('0x6a')]:'OK');if(_0x16146f[_0x3af9('0x66')]){try{this[_0x3af9('0x8d')](_0x16146f['body'],_0xb60141);}catch(_0x4e87dd){logger['error'](util[_0x3af9('0x48')](_0x3af9('0x17a'),_0xb60141));}}return this['channel'][_0x3af9('0x9a')](util[_0x3af9('0x48')](_0x3af9('0xd3'),_0xb60141));};AGIVertices[_0x3af9('0xe')][_0x3af9('0x17b')]=function(_0x5ae257){logger[_0x3af9('0x29')](util[_0x3af9('0x48')](_0x3af9('0x17c'),_0x5ae257[_0x3af9('0x99')]));return this[_0x3af9('0x30')][_0x3af9('0x17d')](_0x5ae257[_0x3af9('0x17e')][_0x3af9('0xca')](/\s+/g,''),_0x5ae257[_0x3af9('0x173')]);};AGIVertices['prototype']['saynumber']=function(_0x18fe34){logger[_0x3af9('0x29')](util[_0x3af9('0x48')]('Enter\x20in\x20SAYNUMBER\x20(%s)\x20block',_0x18fe34[_0x3af9('0x99')]));return this[_0x3af9('0x30')][_0x3af9('0x17f')](_0x18fe34[_0x3af9('0x5b')][_0x3af9('0xca')](/\s+/g,''),_0x18fe34['escape_digits']);};AGIVertices[_0x3af9('0xe')][_0x3af9('0x180')]=function(_0x4f61c7){logger['info'](util[_0x3af9('0x48')](_0x3af9('0x181'),_0x4f61c7['label']));return this[_0x3af9('0x30')][_0x3af9('0x182')](_0x4f61c7[_0x3af9('0x4f')],_0x4f61c7[_0x3af9('0x173')]);};AGIVertices[_0x3af9('0xe')][_0x3af9('0x183')]=function(_0x59ca9a){logger[_0x3af9('0x29')](util[_0x3af9('0x48')]('Enter\x20in\x20SENDMAIL\x20(%s)\x20block',_0x59ca9a[_0x3af9('0x99')]));if(!this[_0x3af9('0x96')](_0x59ca9a[_0x3af9('0x184')])){return this[_0x3af9('0x30')][_0x3af9('0x9a')](_0x3af9('0x185'));}var _0x53c588=this[_0x3af9('0x186')][_0x3af9('0x63')](this,_0x59ca9a[_0x3af9('0x184')]);if(!_0x53c588||!_0x53c588[_0x3af9('0x187')]){return this[_0x3af9('0x30')]['error'](_0x59ca9a,_0x3af9('0x188'));}var _0xdaf93c={'from':util[_0x3af9('0x48')](_0x3af9('0x189'),_0x53c588['name'],_0x53c588['email']||_0x53c588[_0x3af9('0x187')][_0x3af9('0x18a')]),'to':_0x59ca9a['to']||'','cc':_0x59ca9a['cc']||'','bcc':_0x59ca9a[_0x3af9('0x18b')]||'','subject':_0x59ca9a[_0x3af9('0x18c')],'html':_0x59ca9a[_0x3af9('0x4f')],'text':_0x59ca9a[_0x3af9('0x4f')]};if(this[_0x3af9('0x96')](_0x59ca9a[_0x3af9('0x18d')])){}logger[_0x3af9('0xd5')]('sendMail\x20message',JSON['stringify'](_0xdaf93c));this[_0x3af9('0x2f')][_0x3af9('0x63')](this,_0x59ca9a,_0x59ca9a['account_id']);this[_0x3af9('0x30')][_0x3af9('0x9a')](util[_0x3af9('0x48')]('Trying\x20SendMail\x20with\x20account\x20%s',_0x53c588['name']));this[_0x3af9('0x1f')]['sync'](this,_0x53c588[_0x3af9('0x18e')],_0xdaf93c);return this[_0x3af9('0x30')][_0x3af9('0x9a')](_0x3af9('0x18f'));};AGIVertices[_0x3af9('0xe')][_0x3af9('0x190')]=function(_0x53f89d){logger[_0x3af9('0x29')](util[_0x3af9('0x48')](_0x3af9('0x191'),_0x53f89d[_0x3af9('0x99')]));return this[_0x3af9('0x30')][_0x3af9('0x9a')](_0x3af9('0x192'));};AGIVertices[_0x3af9('0xe')][_0x3af9('0x193')]=function(_0x2b96c5){logger[_0x3af9('0x29')](util['format'](_0x3af9('0x194'),_0x2b96c5[_0x3af9('0x99')]));if(!this['isConfigured'](_0x2b96c5['sms_account_id'])){return this[_0x3af9('0x30')][_0x3af9('0x9a')](_0x3af9('0x195'));}var _0x3cf327=this[_0x3af9('0x196')][_0x3af9('0x63')](this,_0x2b96c5[_0x3af9('0x197')]);if(!_0x3cf327){return this[_0x3af9('0x30')][_0x3af9('0x26')](_0x2b96c5,'no\x20sms\x20account\x20found');}var _0x15db8e={'body':_0x2b96c5[_0x3af9('0x198')],'phone':_0x2b96c5['to']||'','SmsAccountId':_0x3cf327['id']};logger[_0x3af9('0xd5')](_0x3af9('0x199'),JSON['stringify'](_0x15db8e));this[_0x3af9('0x2f')][_0x3af9('0x63')](this,_0x2b96c5,_0x2b96c5[_0x3af9('0x197')]);this['channel'][_0x3af9('0x9a')](util[_0x3af9('0x48')](_0x3af9('0x19a'),_0x3cf327['name']));this[_0x3af9('0x2e')][_0x3af9('0x63')](this,_0x15db8e);return this['channel'][_0x3af9('0x9a')](_0x3af9('0x19b'));};AGIVertices['prototype'][_0x3af9('0x19c')]=function(_0x383943){logger[_0x3af9('0x29')](util[_0x3af9('0x48')](_0x3af9('0x19d'),_0x383943[_0x3af9('0x99')]));if(!this[_0x3af9('0x96')](_0x383943[_0x3af9('0xcc')])){return this['channel'][_0x3af9('0x26')](_0x383943,_0x3af9('0x19e'));}var _0x2c98e1=this['getVariable'][_0x3af9('0x63')](this,_0x383943['variable_id']);if(!_0x2c98e1){return this[_0x3af9('0x30')]['error'](_0x383943,'no\x20variable\x20found');}return this[_0x3af9('0x30')][_0x3af9('0x90')](_0x2c98e1,_0x383943[_0x3af9('0x19f')]);};AGIVertices[_0x3af9('0xe')][_0x3af9('0x1a0')]=function(_0x2d1e53){logger[_0x3af9('0x29')](util[_0x3af9('0x48')](_0x3af9('0x1a1'),_0x2d1e53['label']));this[_0x3af9('0x30')][_0x3af9('0x9a')]('START\x20CALLY\x20SQUARE');var _0x3d856d=this['channel'][_0x3af9('0xf')](_0x3af9('0x1a2'));if(!_['isEmpty'](_0x3d856d[_0x3af9('0x95')])){this[_0x3af9('0x30')][_0x3af9('0x41')]=_0x3d856d[_0x3af9('0x95')];}if(_0x2d1e53[_0x3af9('0xa8')]==='yes'){this[_0x3af9('0x30')]['noop'](_0x3af9('0x1a3'));return this[_0x3af9('0x30')][_0x3af9('0xa8')]();}return this[_0x3af9('0x30')][_0x3af9('0x9a')](_0x3af9('0x1a4'));};AGIVertices['prototype'][_0x3af9('0x1a5')]=function(_0x82418){logger[_0x3af9('0x29')](util[_0x3af9('0x48')]('Enter\x20in\x20SUBPROJECT\x20(%s)\x20block',_0x82418[_0x3af9('0x99')]));if(!this[_0x3af9('0x96')](_0x82418['project_id'])){return this['channel'][_0x3af9('0x26')](_0x82418,'no\x20subproject\x20selected');}var _0x241f21=this[_0x3af9('0x16')][_0x3af9('0x63')](this,_0x82418['project_id']);if(!this[_0x3af9('0x96')](_0x241f21)){return this[_0x3af9('0x30')][_0x3af9('0x26')](_0x82418,util['format'](_0x3af9('0x1a6'),_0x82418[_0x3af9('0x1a7')]));}if(_0x241f21===this[_0x3af9('0x30')][_0x3af9('0x32')]){return this[_0x3af9('0x30')][_0x3af9('0x26')](_0x82418,_0x3af9('0x1a8'));}this['createSquareDetailsReport'][_0x3af9('0x63')](this,_0x82418,_0x241f21);var _0xd213f0=this[_0x3af9('0x30')][_0x3af9('0x4c')]('AGI',util[_0x3af9('0x48')](_0x3af9('0x1a9'),config[_0x3af9('0x6')]['host']||_0x3af9('0x1aa'),_0x241f21,this[_0x3af9('0x30')][_0x3af9('0x32')]));if(_0xd213f0[_0x3af9('0x9c')]===-0x1){return _0xd213f0;}return this[_0x3af9('0x30')]['noop'](util['format'](_0x3af9('0xb4'),_0x3af9('0x1ab'),_0x241f21));};AGIVertices[_0x3af9('0xe')][_0x3af9('0x1ac')]=function(_0x2cd0bd){logger[_0x3af9('0x29')](util[_0x3af9('0x48')](_0x3af9('0x1ad'),_0x2cd0bd[_0x3af9('0x99')]));var _0x3ea407=this[_0x3af9('0x4b')][_0x3af9('0x63')](this,_0x2cd0bd[_0x3af9('0xa6')]);this['createSquareDetailsReport']['sync'](this,_0x2cd0bd,_0x2cd0bd[_0x3af9('0xa6')]);if(this[_0x3af9('0x96')](_0x2cd0bd[_0x3af9('0xcc')])){var _0xbe7f1e=this[_0x3af9('0xf')][_0x3af9('0x63')](this,_0x2cd0bd[_0x3af9('0xcc')]);if(_0xbe7f1e){this[_0x3af9('0x30')][_0x3af9('0x90')](_0xbe7f1e,_0x3ea407);return this[_0x3af9('0x30')][_0x3af9('0x9a')](util[_0x3af9('0x48')]('sh\x20command:\x20%s\x20result\x20on\x20variable:\x20%s',_0x2cd0bd[_0x3af9('0xa6')],_0xbe7f1e));}}return this[_0x3af9('0x30')][_0x3af9('0x9a')](util[_0x3af9('0x48')](_0x3af9('0x1ae'),_0x2cd0bd[_0x3af9('0xa6')]));};AGIVertices['prototype']['google_cloud_tts']=function(_0x35e263){logger[_0x3af9('0x29')](util[_0x3af9('0x48')](_0x3af9('0x1af'),_0x35e263['label']));_0x35e263[_0x3af9('0x4f')]=_0x35e263[_0x3af9('0x4f')][_0x3af9('0xca')](/(\r\n|\n|\r)/gm,'\x20');if(!this[_0x3af9('0x96')](_0x35e263[_0x3af9('0x4e')])){return this[_0x3af9('0x30')][_0x3af9('0x9a')](_0x3af9('0x1b0'));}if(!this[_0x3af9('0x96')](_0x35e263[_0x3af9('0x4f')])){return this[_0x3af9('0x30')][_0x3af9('0x9a')](_0x3af9('0x9b'));}this[_0x3af9('0x30')][_0x3af9('0x9a')](util[_0x3af9('0x48')]('Trying\x20Google\x20Cloud\x20TTS\x20%s',_0x35e263[_0x3af9('0x4f')]));var _0x28280f=this[_0x3af9('0x4d')][_0x3af9('0x63')](this,_0x35e263);if(_0x28280f){this[_0x3af9('0x30')][_0x3af9('0x9a')](util[_0x3af9('0x48')](_0x3af9('0x1b1'),_0x28280f));var _0x1f9cb8=this['channel'][_0x3af9('0xf8')](_0x28280f);try{fs[_0x3af9('0xf9')](_0x28280f+_0x3af9('0xfa'));}catch(_0x5c0548){logger[_0x3af9('0x26')](_0x5c0548);}return _0x1f9cb8;}return this[_0x3af9('0x30')]['error'](_0x35e263,_0x3af9('0x1b2'));};AGIVertices[_0x3af9('0xe')]['tts']=function(_0x1d2cb3){logger[_0x3af9('0x29')](util['format'](_0x3af9('0x1b3'),_0x1d2cb3['label']));_0x1d2cb3[_0x3af9('0x4f')]=_0x1d2cb3[_0x3af9('0x4f')][_0x3af9('0xca')](/(\r\n|\n|\r)/gm,'\x20');if(!this[_0x3af9('0x96')](_0x1d2cb3[_0x3af9('0x4f')])){return this['channel'][_0x3af9('0x9a')]('no\x20text\x20configured');}this['channel']['noop'](util[_0x3af9('0x48')](_0x3af9('0x1b4'),_0x1d2cb3[_0x3af9('0x4f')]));var _0x480cca=this[_0x3af9('0x56')][_0x3af9('0x63')](this,_0x1d2cb3);if(_0x480cca){this[_0x3af9('0x30')][_0x3af9('0x9a')](util['format'](_0x3af9('0x1b5'),_0x480cca));var _0x3fdcee=this[_0x3af9('0x30')][_0x3af9('0xf8')](_0x480cca);try{fs[_0x3af9('0xf9')](_0x480cca+_0x3af9('0xfa'));}catch(_0x16c0b5){logger[_0x3af9('0x26')](_0x16c0b5);}return _0x3fdcee;}return this[_0x3af9('0x30')]['error'](_0x1d2cb3,_0x3af9('0x1b6'));};AGIVertices[_0x3af9('0xe')][_0x3af9('0x1b7')]=function(_0x54c220){logger['info'](util['format'](_0x3af9('0x1b8'),_0x54c220['label']));if(!this['isConfigured'](_0x54c220[_0x3af9('0x14d')])){return this['channel']['error'](_0x54c220,_0x3af9('0x14c'));}logger[_0x3af9('0x29')](util[_0x3af9('0x48')]('FIND\x20AGENT\x20%s\x20BY\x20%s',this[_0x3af9('0x30')][_0x3af9('0x33')],_0x54c220[_0x3af9('0x14d')]));var _0x68263=this['agentUnpause'][_0x3af9('0x63')](this,_0x54c220[_0x3af9('0x14d')]);if(_0x68263){logger[_0x3af9('0x29')](util[_0x3af9('0x48')]('AGENT\x20%s\x20FOUND\x20BY',this[_0x3af9('0x30')][_0x3af9('0x33')],_0x54c220['findBy']));this[_0x3af9('0x30')][_0x3af9('0x9a')](util[_0x3af9('0x48')](_0x3af9('0x14e'),this[_0x3af9('0x30')][_0x3af9('0x33')],_0x54c220['findBy']));return{'code':0xc8,'result':_0x3af9('0x15f')};}else{logger['info'](util[_0x3af9('0x48')](_0x3af9('0x14f'),this[_0x3af9('0x30')][_0x3af9('0x33')],_0x54c220[_0x3af9('0x14d')]));this[_0x3af9('0x30')][_0x3af9('0x9a')](util['format'](_0x3af9('0x14f'),this[_0x3af9('0x30')][_0x3af9('0x33')],_0x54c220['findBy']));return{'code':0xc8,'result':_0x3af9('0x153')};}};AGIVertices[_0x3af9('0xe')]['voicemail']=function(_0x477deb){logger[_0x3af9('0x29')](util[_0x3af9('0x48')](_0x3af9('0x1b9'),_0x477deb[_0x3af9('0x99')]));var _0x5bf09e=this[_0x3af9('0x30')]['exec'](_0x3af9('0x1ba'),[_0x477deb[_0x3af9('0x1bb')],_0x477deb[_0x3af9('0x6c')]]);if(_0x5bf09e[_0x3af9('0x9c')]===-0x1){return _0x5bf09e;}return this['channel'][_0x3af9('0x9a')](util[_0x3af9('0x48')](_0x3af9('0xb4'),_0x3af9('0x1ba'),_0x477deb[_0x3af9('0x1bb')]));};AGIVertices['prototype'][_0x3af9('0x1bc')]=function(_0x22ba2a){logger['info'](util['format'](_0x3af9('0x1bd'),_0x22ba2a[_0x3af9('0x99')]));if(!this[_0x3af9('0x96')](_0x22ba2a['variable_id'])){return this[_0x3af9('0x30')]['error'](_0x22ba2a,_0x3af9('0x19e'));}var _0x13ab06=this[_0x3af9('0xf')][_0x3af9('0x63')](this,_0x22ba2a[_0x3af9('0xcc')]);if(!_0x13ab06){return this['channel'][_0x3af9('0x26')](_0x22ba2a,_0x3af9('0xce'));}var _0x151a04=this[_0x3af9('0x30')][_0x3af9('0xf')](_0x13ab06);return{'code':0xc8,'result':_0x151a04['extra']?_0x151a04[_0x3af9('0x95')]:'-'};};String[_0x3af9('0xe')][_0x3af9('0x92')]=function(_0x43d6b,_0x3417ef){return this[_0x3af9('0x91')](_0x43d6b)[_0x3af9('0x1be')](_0x3417ef);};module[_0x3af9('0x1bf')]=AGIVertices; \ No newline at end of file +var _0x3685=['Executed\x20command\x20MRCPRecog\x20%s','sestekasr','SESTEK_ASR_CONFIDENCE','SESTEK_ASR_TRANSCRIPT','SESTEK_ASR_INSTANCE','database','Enter\x20in\x20DATABASE\x20(%s)\x20block','no\x20database\x20selected','odbc_id','no\x20odbc\x20database\x20found','no\x20query\x20configured','variable_id','no\x20variable\x20selected\x20for\x20the\x20result','no\x20variable\x20found','keys','forEach','%s[%s][%s]','%s_ROWS_COUNT','dial','debug','Enter\x20in\x20DIAL\x20(%s)\x20block','no\x20user\x20selected','no\x20user\x20found','Executed\x20command\x20%s','DIAL','dialogflow','no\x20key\x20configured','bot','Trying\x20Dialogflow:\x20%s','DIALOGFLOW_%s','speech','out','Dialogflow\x20Result\x20%s','dialogflowV2','Enter\x20in\x20DIALOGFLOW\x20V2\x20(%s)\x20block','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','username','no\x20username\x20configured','password','no\x20password\x20configured','SESTEK_NDA_%s','Sestek\x20NDA\x20%s\x20file\x20created','audiofile','unlink','.wav','SestekNDA\x20is\x20unreachable','end','Enter\x20in\x20END\x20(%s)\x20block','ext_dial','Enter\x20in\x20EXTERNAL\x20DIAL\x20(%s)\x20block','trunk_id','no\x20trunk\x20found','trunk_name','no\x20trunk\x20selected','SIP/%s/%s','opts','finally','Enter\x20in\x20FINALLY\x20(%s)\x20block','Enter\x20in\x20GETDIGITS\x20(%s)\x20block','retry','file_id','no\x20file\x20audio\x20found','getData','response','maxdigit','test','mindigit','hiddendigitsnum','generate','hiddendigitspos','substr','getsecretdigits','Enter\x20in\x20GETSECRETDIGITS\x20(%s)\x20block','Enter\x20in\x20GOAL\x20(%s)\x20block','goalname','GOAL\x20%s','awspolly','[AGI]\x20Enter\x20in\x20AWSPOLLY\x20(%s)\x20block','no\x20valid\x20credentials\x20configured','Trying\x20aws\x20Polly\x20%s','aws\x20Polly\x20%s\x20file\x20created','streamFile','awslex','no\x20bot\x20name\x20configured','amazonlex','Amazon\x20Lex\x20Result\x20%s','Amazon\x20Lex\x20is\x20unreachable','googleasr','Enter\x20in\x20GOOGLEASR\x20(%s)\x20block\x20%s','wav','%s/recordings/%s','beep','recordFile','intKey','google\x20%s\x20file\x20created','GoogleASR\x20Result\x20%s','no\x20appid\x20configured','no\x20appsecret\x20configured','NOBEEP','tilde\x20%s\x20file\x20created','TILDE_ASR_%s','gotoc','Enter\x20in\x20GOTO\x20(%s)\x20block','continueAt','gotoif','Enter\x20in\x20GOTOIF\x20(%s)\x20block','no\x20condition\x20configured','condition','EVAL\x20CONDITION\x20%s\x20%s','false','gotoiftime','interval_id','no\x20interval\x20configured','getIntervals','IFTIME(%s?true:false)','IFTIME\x20%s\x20%s','true','hangup','ispeechasr','Enter\x20in\x20ISPEECHASR\x20(%s)\x20block','ISPEECH_ASR_%s','ispeechtts','Enter\x20in\x20ISPEECHTTS\x20(%s)\x20block','Trying\x20ispeech\x20TTS\x20%s','ispeech\x20TTS\x20is\x20unreachable','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','math','Enter\x20in\x20MATH\x20(%s)\x20block','operation','no\x20operation\x20configured','math\x20%s','isArray','%s[%s]','variable\x20%s[key]\x20set','Enter\x20in\x20MENU\x20(%s)\x20block','digit','output','Enter\x20in\x20PAUSE\x20(%s)\x20block','pause_id','playback','Enter\x20in\x20PLAYBACK\x20(%s)\x20block','PLAYBACK','queue','Enter\x20in\x20QUEUE\x20(%s)\x20block','queue_id','no\x20queue\x20selected','no\x20queue\x20found','indexOf','XMCS-QUEUE','toLowerCase','QUEUE','macro','gosub','position','Enter\x20in\x20RECORD\x20(%s)\x20block','recordingFormat','%s/recordings/%s.%s','RECORDING_SAVENAME','Recording\x20%s\x20%s\x20%s\x20%s','escape_digits','restapi','Enter\x20in\x20RESTAPI\x20(%s)\x20block','no\x20url\x20configured','Response:','inspect','no\x20variable\x20selected\x20for\x20the\x20response','%s_STATUS_CODE','Unable\x20to\x20set\x20result\x20in\x20variable\x20%s','variable\x20%s\x20set','saydigits','sayDigits','digits','Enter\x20in\x20SAYNUMBER\x20(%s)\x20block','number','sayphonetic','Enter\x20in\x20SAYPHONETIC\x20(%s)\x20block','sendMail','Enter\x20in\x20SENDMAIL\x20(%s)\x20block','account_id','no\x20mail\x20account\x20configured','\x22%s\x22\x20<%s>','email','Smtp','user','bcc','template_id','sendMail\x20message','Mail\x20message\x20added\x20to\x20outgoing\x20process','SENDFAX\x20block\x20not\x20implemented','sendSMS','Enter\x20in\x20SENDSMS\x20(%s)\x20block','no\x20sms\x20account\x20configured','no\x20sms\x20account\x20found','sms_text','sendSMS\x20message','Trying\x20SendSMS\x20with\x20account\x20%s','Sms\x20message\x20added\x20to\x20outgoing\x20process','Enter\x20in\x20SET\x20(%s)\x20block','no\x20variable\x20selected','variable_value','XMCS-UNIQUEID','yes','Answer','Skipped\x20Answer','subproject','project_id','AGI','agi://%s/square,\x22%s\x22,\x22%s\x22','host','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','apiKey','no\x20apiKey\x20configured','Trying\x20Google\x20Cloud\x20TTS\x20%s','Google\x20Cloud\x20TTS\x20%s\x20file\x20created','Google\x20Cloud\x20TTS\x20is\x20unreachable','Enter\x20in\x20GOOGLETTS\x20(%s)\x20block','Trying\x20Google\x20TTS\x20%s','Google\x20TTS\x20%s\x20file\x20created','Google\x20TTS\x20is\x20unreachable','unpause','Enter\x20in\x20UNPAUSE\x20(%s)\x20block','voicemail','mailbox','vswitch','Enter\x20in\x20SWITCH\x20(%s)\x20block','join','exports','util','shelljs','odbc','randomstring','moment','mustache','request-promise','../../config/logger','agi','../../config/environment','./scripts','rawHeaders','rawBody','menu','getdigits','channel','rpc','mailRpc','prototype','getVariable','getVariableById','name','getVoiceQueue','getVoiceQueueById','then','catch','getSquareProject','getSquareProjectById','getSquareOdbc','getSquareOdbcById','getUser','getUserById','getTrunk','getTrunkById','getSound','getSoundById','getSoundPath','save_name','getMailAccount','sendMailMessage','IntervalId','interval','map','%s/sounds/converted/%s','open','error','Error\x20getting\x20ODBC\x20connection\x20%s','info','ODBC\x20connection\x20successfully','query','Query\x20executed\x20correctly\x20%s','close','Error\x20closing\x20connection\x20to\x20odbc\x20%s','getSmsAccount','getSmsAccountById','createSmsMessage','createSquareDetailsReport','uniqueid','label','arg_1','callerid','createSquareRecording','calleridname','context','extension','priority','dnid','file','createSquareMessage','createCmContact','isEmpty','isNil','random','lastName','phone','list_id','scheduledAt','callback','Callback\x20scheduled\x20at\x20','toString','callback_priority','getPause','getPauseById','agentPause','agent','agentUnpause','agentLogout','agentLogin','internal','format','%s/%s@from-sip/n','LOCAL','shellCommand','exec','trim','replace','googleCloudTTS','google_cloud_tts_text_type','text','en-US','audioEncoding','MP3','googleTTS','google_tts_language','url','timeout','includes','method','toUpperCase','body','An\x20incorrect\x20formatted\x20json\x20body\x20has\x20been\x20passed\x20to\x20the\x20function','An\x20incorrect\x20formatted\x20json\x20headers\x20has\x20been\x20passed\x20to\x20the\x20function','computedVariables','sync','uri','render','headers','parse','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','speed','ispeechASR','ispeech_asr_language','model','awsPolly','aws_access_key_id','aws_polly_region','aws_polly_voice','Amy','aws_text_type','awsLex','aws_secret_access_key','aws_lex_region','aws_bot_name','googleASR','tildeASR','appid','appsecret','clear','agicommand','hasOwnProperty','replaceObjectAllVariables','replaceAllVariables','recursiveNodeIndex','length','isString','isPlainObject','saveRestApiResult','setVariable','%s.%s','split','replaceAll','The\x20\x22%s\x22\x20variable\x20value\x20is:\x20%s','extra','maxRetry','mrcpsynth','isConfigured','no\x20text\x20configured','MRCPSynth','noop','Executed\x20command\x20MRCPSynth\x20%s','grammar','MRCPRecog','result','RECOG_CONFIDENCE()','RECOG_INPUT()','MRCP_RECOG_TRANSCRIPT','getAndSetVariable','MRCP_RECOG_INSTANCE','Enter\x20in\x20AGI\x20(%s)\x20block','command','args','answer','Wait\x20%s\x20seconds\x20before\x20answer','wait','Enter\x20in\x20CALLBACK\x20(%s)\x20block','delay','minutes','CALLBACK\x20added\x20phone:\x20%s\x20on\x20list:\x20%s\x20at\x20%s','custom_app','Enter\x20in\x20CUSTOM\x20APP\x20(%s)\x20block','application','Executed\x20command\x20%s\x20%s','Enter\x20in\x20LUMENVOXASR\x20(%s)\x20block','LUMENVOX_ASR_CONFIDENCE','LUMENVOX_ASR_TRANSCRIPT','RECOG_INSTANCE()','LUMENVOX_ASR_INSTANCE'];(function(_0x594e3a,_0x45d55d){var _0x32e532=function(_0x296408){while(--_0x296408){_0x594e3a['push'](_0x594e3a['shift']());}};_0x32e532(++_0x45d55d);}(_0x3685,0xf8));var _0x5368=function(_0x20a584,_0xe384a5){_0x20a584=_0x20a584-0x0;var _0x4b41a8=_0x3685[_0x20a584];return _0x4b41a8;};'use strict';var fs=require('fs');var util=require(_0x5368('0x0'));var _=require('lodash');var sh=require(_0x5368('0x1'));var odbc=require(_0x5368('0x2'))();var rs=require(_0x5368('0x3'));var moment=require(_0x5368('0x4'));var Mustache=require(_0x5368('0x5'));var rp=require(_0x5368('0x6'));var logger=require(_0x5368('0x7'))(_0x5368('0x8'));var config=require(_0x5368('0x9'));var scripts=require(_0x5368('0xa'));var FILES_PATH='/var/opt/motion2/server/files';var recursiveMapAttributes=[_0x5368('0xb'),_0x5368('0xc')];var verticesWithRetry=[_0x5368('0xd'),_0x5368('0xe'),'getsecretdigits'];var AGIVertices=function(_0x14e621,_0x374865,_0x3e6051){this[_0x5368('0xf')]=_0x14e621;this[_0x5368('0x10')]=_0x374865;this[_0x5368('0x11')]=_0x3e6051;};AGIVertices[_0x5368('0x12')][_0x5368('0x13')]=function(_0x521e25,_0x3d9625){this[_0x5368('0x10')][_0x5368('0x14')](_0x521e25)['then'](function(_0x164bec){_0x3d9625(null,_0x164bec?_0x164bec[_0x5368('0x15')]:![]);})['catch'](function(_0x5d6a86){_0x3d9625(_0x5d6a86);});};AGIVertices['prototype'][_0x5368('0x16')]=function(_0x28d957,_0x3a6157){this[_0x5368('0x10')][_0x5368('0x17')](_0x28d957)[_0x5368('0x18')](function(_0x173cd2){_0x3a6157(null,_0x173cd2?_0x173cd2[_0x5368('0x15')]:![]);})[_0x5368('0x19')](function(_0x5b1da2){_0x3a6157(_0x5b1da2);});};AGIVertices['prototype'][_0x5368('0x1a')]=function(_0x183041,_0x59c422){this[_0x5368('0x10')][_0x5368('0x1b')](_0x183041)[_0x5368('0x18')](function(_0x24a4b3){_0x59c422(null,_0x24a4b3?_0x24a4b3['name']:![]);})[_0x5368('0x19')](function(_0x56ac4d){_0x59c422(_0x56ac4d);});};AGIVertices['prototype'][_0x5368('0x1c')]=function(_0x5e1398,_0x52afa9){this['rpc'][_0x5368('0x1d')](_0x5e1398)[_0x5368('0x18')](function(_0x2dda00){_0x52afa9(null,_0x2dda00?_0x2dda00['dsn']:![]);})['catch'](function(_0x2f21fc){_0x52afa9(_0x2f21fc);});};AGIVertices[_0x5368('0x12')][_0x5368('0x1e')]=function(_0x38f367,_0x1c2fcd){this[_0x5368('0x10')][_0x5368('0x1f')](_0x38f367)[_0x5368('0x18')](function(_0x380945){_0x1c2fcd(null,_0x380945?_0x380945[_0x5368('0x15')]:![]);})['catch'](function(_0x45884f){_0x1c2fcd(_0x45884f);});};AGIVertices[_0x5368('0x12')][_0x5368('0x20')]=function(_0x30d098,_0x1c287f){this[_0x5368('0x10')][_0x5368('0x21')](_0x30d098)[_0x5368('0x18')](function(_0x47c30f){_0x1c287f(null,_0x47c30f?_0x47c30f['name']:![]);})['catch'](function(_0x15c206){_0x1c287f(_0x15c206);});};AGIVertices[_0x5368('0x12')][_0x5368('0x22')]=function(_0x452c81,_0x131722){var _0x4b94cd=this;this[_0x5368('0x10')][_0x5368('0x23')](_0x452c81)[_0x5368('0x18')](function(_0x2bcf41){_0x131722(null,_0x2bcf41?_0x4b94cd[_0x5368('0x24')](_0x2bcf41[_0x5368('0x25')]):![]);})[_0x5368('0x19')](function(_0x2963a6){_0x131722(_0x2963a6);});};AGIVertices[_0x5368('0x12')][_0x5368('0x26')]=function(_0x260eab,_0x46ea22){this[_0x5368('0x10')]['getMailAccountById'](_0x260eab)[_0x5368('0x18')](function(_0x256abd){_0x46ea22(null,_0x256abd?_0x256abd:![]);})[_0x5368('0x19')](function(_0x5953b6){_0x46ea22(_0x5953b6);});};AGIVertices[_0x5368('0x12')]['sendMailMessage']=function(_0x26fc48,_0x18b186,_0x5007b6){this[_0x5368('0x11')][_0x5368('0x27')](_0x26fc48,_0x18b186)['then'](function(){_0x5007b6(null);})['catch'](function(_0x32a50e){_0x5007b6(_0x32a50e);});};AGIVertices[_0x5368('0x12')]['getIntervals']=function(_0x46169e,_0x2fde35){this[_0x5368('0x10')]['getIntervalById'](_0x46169e)[_0x5368('0x18')](function(_0x5b4993){if(_0x5b4993){if(_0x5b4993[_0x5368('0x28')]){_0x2fde35(null,[_0x5b4993[_0x5368('0x29')]]);}else{_0x2fde35(null,_[_0x5368('0x2a')](_0x5b4993['Intervals'],_0x5368('0x29')));}}else{_0x2fde35(null,![]);}})[_0x5368('0x19')](function(_0xce8b4){_0x2fde35(_0xce8b4);});};AGIVertices[_0x5368('0x12')]['getSoundPath']=function(_0x3818ad){return util['format'](_0x5368('0x2b'),FILES_PATH,_0x3818ad);};AGIVertices[_0x5368('0x12')]['getQueryOdbc']=function(_0x1b84fb,_0x197659,_0x46e59a){odbc[_0x5368('0x2c')](_0x1b84fb,function(_0x584e82){if(_0x584e82){logger[_0x5368('0x2d')](_0x5368('0x2e'),_0x584e82);_0x46e59a(_0x584e82);}else{logger[_0x5368('0x2f')](_0x5368('0x30'));odbc[_0x5368('0x31')](_0x197659,function(_0x5d384a,_0x1183a1){if(_0x5d384a){logger[_0x5368('0x2f')]('Error\x20executing\x20query\x20%s',_0x197659);_0x46e59a(_0x5d384a);}else{logger[_0x5368('0x2f')](_0x5368('0x32'),_0x197659);odbc[_0x5368('0x33')](function(_0x5e796f){if(_0x5e796f){logger[_0x5368('0x2d')](_0x5368('0x34'),_0x5e796f);}_0x46e59a(null,_0x1183a1);});}});}});};AGIVertices[_0x5368('0x12')][_0x5368('0x35')]=function(_0x55449f,_0x592536){this[_0x5368('0x10')][_0x5368('0x36')](_0x55449f)[_0x5368('0x18')](function(_0x4e7278){_0x592536(null,_0x4e7278?_0x4e7278:![]);})['catch'](function(_0x328ee5){_0x592536(_0x328ee5);});};AGIVertices['prototype'][_0x5368('0x37')]=function(_0x14f426,_0x50a593){this[_0x5368('0x10')][_0x5368('0x37')](_0x14f426)[_0x5368('0x18')](function(_0xed1792){_0x50a593(null,_0xed1792);})[_0x5368('0x19')](function(_0x404290){_0x50a593(_0x404290);});};AGIVertices[_0x5368('0x12')][_0x5368('0x38')]=function(_0x48c86,_0x43c776,_0x311c7c){this[_0x5368('0x10')]['createSquareDetailsReport']({'uniqueid':this[_0x5368('0xf')][_0x5368('0x39')],'node':_0x48c86[_0x5368('0x3a')],'application':_0x48c86['agicommand'],'data':_0x43c776||null,'project_name':this[_0x5368('0xf')][_0x5368('0x3b')],'callerid':this['channel'][_0x5368('0x3c')]})[_0x5368('0x18')](function(_0xffa746){if(_0x311c7c){_0x311c7c(null,_0xffa746);}})[_0x5368('0x19')](function(_0x43f2d3){if(_0x311c7c){_0x311c7c(_0x43f2d3);}});};AGIVertices[_0x5368('0x12')][_0x5368('0x3d')]=function(_0x5b562d,_0x315a7d,_0x17ad01,_0x5dc8bf){this['rpc'][_0x5368('0x3d')]({'uniqueid':this[_0x5368('0xf')][_0x5368('0x39')],'callerid':this[_0x5368('0xf')]['callerid'],'calleridname':this['channel'][_0x5368('0x3e')],'context':this['channel'][_0x5368('0x3f')],'extension':this['channel'][_0x5368('0x40')],'priority':this['channel'][_0x5368('0x41')],'accountcode':this[_0x5368('0xf')]['accountcode'],'dnid':this['channel'][_0x5368('0x42')],'projectName':this['channel'][_0x5368('0x3b')],'saveName':_0x315a7d,'filename':_0x5b562d[_0x5368('0x43')]||_0x315a7d,'savePath':_0x17ad01})[_0x5368('0x18')](function(_0x121d8d){_0x5dc8bf(null,_0x121d8d);})['catch'](function(_0x1adfc8){_0x5dc8bf(_0x1adfc8);});};AGIVertices[_0x5368('0x12')][_0x5368('0x44')]=function(_0x1d9c87,_0x20e641,_0x4399c3,_0x33626d,_0x489b4d){this['rpc'][_0x5368('0x44')]({'uniqueid':this[_0x5368('0xf')][_0x5368('0x39')],'body':_0x1d9c87,'direction':_0x20e641,'providerName':_0x4399c3,'providerResponse':_0x33626d})['then'](function(_0x42b09e){if(_0x489b4d){_0x489b4d(null,_0x42b09e);}})[_0x5368('0x19')](function(_0x1791d4){if(_0x489b4d){_0x489b4d(_0x1791d4);}});};AGIVertices[_0x5368('0x12')][_0x5368('0x45')]=function(_0x233bf6,_0x13e1eb){this[_0x5368('0x10')]['createCmContact']({'firstName':_[_0x5368('0x46')](_0x233bf6[_0x5368('0x15')])||_[_0x5368('0x47')](_0x233bf6[_0x5368('0x15')])?'callback_'+Math[_0x5368('0x48')]():_0x233bf6[_0x5368('0x15')],'lastName':_[_0x5368('0x46')](_0x233bf6[_0x5368('0x49')])||_[_0x5368('0x47')](_0x233bf6[_0x5368('0x49')])?null:_0x233bf6[_0x5368('0x49')],'phone':_0x233bf6[_0x5368('0x4a')],'ListId':_0x233bf6[_0x5368('0x4b')],'scheduledat':_0x233bf6[_0x5368('0x4c')],'callbackUniqueid':this[_0x5368('0xf')][_0x5368('0x39')],'tags':_0x5368('0x4d'),'description':_0x5368('0x4e')+_0x233bf6['scheduledAt'][_0x5368('0x4f')](),'priority':_0x233bf6[_0x5368('0x50')]})[_0x5368('0x18')](function(_0x2971de){_0x13e1eb(null,_0x2971de);})[_0x5368('0x19')](function(_0x4631b5){_0x13e1eb(_0x4631b5);});};AGIVertices['prototype'][_0x5368('0x51')]=function(_0x4a5654,_0x3cc107){this[_0x5368('0x10')][_0x5368('0x52')](_0x4a5654)[_0x5368('0x18')](function(_0xe348e1){_0x3cc107(null,_0xe348e1?_0xe348e1[_0x5368('0x15')]:![]);})[_0x5368('0x19')](function(_0x5e17d0){_0x3cc107(_0x5e17d0);});};AGIVertices[_0x5368('0x12')][_0x5368('0x53')]=function(_0x45bba1,_0x3822ff,_0xf127d0){var _0x7bf888={'role':_0x5368('0x54')};_0x7bf888[_0x45bba1]=this[_0x5368('0xf')][_0x5368('0x3c')];this[_0x5368('0x10')][_0x5368('0x53')](_0x7bf888,_0x3822ff,this[_0x5368('0xf')][_0x5368('0x39')])['then'](function(_0x4fa56e){_0xf127d0(null,_['isNil'](_0x4fa56e)?![]:!![]);})[_0x5368('0x19')](function(_0x32532a){logger[_0x5368('0x2d')](_0x32532a);_0xf127d0(null,![]);});};AGIVertices[_0x5368('0x12')]['agentUnpause']=function(_0x4935ef,_0x382421){var _0x3192e4={'role':_0x5368('0x54')};_0x3192e4[_0x4935ef]=this['channel'][_0x5368('0x3c')];this['rpc'][_0x5368('0x55')](_0x3192e4)[_0x5368('0x18')](function(_0x5d3c3d){_0x382421(null,_[_0x5368('0x47')](_0x5d3c3d)?![]:!![]);})[_0x5368('0x19')](function(_0x59dae2){logger[_0x5368('0x2d')](_0x59dae2);_0x382421(null,![]);});};AGIVertices[_0x5368('0x12')][_0x5368('0x56')]=function(_0x58685a,_0x501658){var _0x3b047f={'role':_0x5368('0x54')};_0x3b047f[_0x58685a]=this['channel']['callerid'];this[_0x5368('0x10')][_0x5368('0x56')](_0x3b047f)[_0x5368('0x18')](function(_0x5834d6){_0x501658(null,_[_0x5368('0x47')](_0x5834d6)?![]:!![]);})[_0x5368('0x19')](function(_0x2940a1){logger[_0x5368('0x2d')](_0x2940a1);_0x501658(null,![]);});};AGIVertices['prototype'][_0x5368('0x57')]=function(_0x5a70f4,_0x21b54b){var _0xfbb98c={'role':_0x5368('0x54')};_0xfbb98c[_0x5a70f4]=this['channel'][_0x5368('0x3c')];var _0x242a9a=_0x5a70f4!=_0x5368('0x58')?util[_0x5368('0x59')](_0x5368('0x5a'),_0x5368('0x5b'),this[_0x5368('0xf')][_0x5368('0x3c')]):undefined;this[_0x5368('0x10')][_0x5368('0x57')](_0xfbb98c,_0x242a9a)[_0x5368('0x18')](function(_0x23dd59){_0x21b54b(null,_[_0x5368('0x47')](_0x23dd59)?![]:!![]);})[_0x5368('0x19')](function(_0x27e47a){logger[_0x5368('0x2d')](_0x27e47a);_0x21b54b(null,![]);});};AGIVertices[_0x5368('0x12')][_0x5368('0x5c')]=function(_0x3debf0,_0x5ec9ca){sh[_0x5368('0x5d')](_[_0x5368('0x5e')](_0x3debf0),function(_0x2f8493,_0x486ab6){var _0x35ff81=_0x486ab6[_0x5368('0x5f')](/(\r\n|\n|\r)/gm,'');_0x5ec9ca(null,_0x35ff81);});};AGIVertices[_0x5368('0x12')][_0x5368('0x60')]=function(_0x433096,_0x5eea25){scripts['googleCloudTTS'](_0x433096['apiKey'],_0x433096[_0x5368('0x61')]||_0x5368('0x62'),_0x433096[_0x5368('0x62')],_0x433096['languageCode']||_0x5368('0x63'),_0x433096['ssmlGender']||'MALE',_0x433096[_0x5368('0x64')]||_0x5368('0x65'))[_0x5368('0x18')](function(_0x17eed8){_0x5eea25(null,_0x17eed8);})[_0x5368('0x19')](function(_0x39c550){_0x5eea25(_0x39c550);});};AGIVertices[_0x5368('0x12')][_0x5368('0x66')]=function(_0x339283,_0x2ce9da){scripts['googleTTS'](_0x339283[_0x5368('0x62')],_0x339283[_0x5368('0x67')]||'en',0x1)[_0x5368('0x18')](function(_0x53875a){_0x2ce9da(null,_0x53875a);})[_0x5368('0x19')](function(_0x1227b2){_0x2ce9da(_0x1227b2);});};AGIVertices[_0x5368('0x12')]['restAPI']=function(_0x3a296c,_0xcf017e){var _0x54f932={'uri':_0x3a296c[_0x5368('0x68')],'method':_0x3a296c['method'],'json':!![],'resolveWithFullResponse':!![],'strictSSL':![],'timeout':typeof parseInt(_0x3a296c[_0x5368('0x69')])==='number'&&parseInt(_0x3a296c[_0x5368('0x69')])>=0x1?parseInt(_0x3a296c[_0x5368('0x69')])*0x3e8:0x5*0x3e8};if(_[_0x5368('0x6a')](['POST','PUT'],_0x54f932[_0x5368('0x6b')][_0x5368('0x6c')]())){try{_0x54f932[_0x5368('0x6d')]=_0x3a296c[_0x5368('0xc')]?JSON['parse'](_0x3a296c['rawBody']):{};}catch(_0xc04ddb){logger['error'](_0x5368('0x6e'),_0xc04ddb);}}try{_0x54f932['headers']=_0x3a296c[_0x5368('0xb')]?JSON['parse'](_0x3a296c['rawHeaders']):{};}catch(_0xb9f734){logger['error'](_0x5368('0x6f'),_0xb9f734);}if(_0x3a296c[_0x5368('0x70')]){try{var _0x4c1a45=require(_0x3a296c[_0x5368('0x70')])[_0x5368('0x71')](this,_0x54f932);_0x54f932[_0x5368('0x72')]=Mustache[_0x5368('0x73')](_0x3a296c['url'],_0x4c1a45,{},['$$','$$']);if(_0x54f932[_0x5368('0x74')]){_0x54f932[_0x5368('0x74')]=JSON[_0x5368('0x75')](Mustache[_0x5368('0x73')](JSON[_0x5368('0x76')](_0x54f932[_0x5368('0x74')]),_0x4c1a45,{},['$$','$$']));}if(_0x54f932['body']){_0x54f932[_0x5368('0x6d')]=JSON[_0x5368('0x75')](Mustache[_0x5368('0x73')](JSON[_0x5368('0x76')](_0x54f932[_0x5368('0x6d')]),_0x4c1a45,{},['$$','$$']));}}catch(_0x257055){logger[_0x5368('0x2d')](_0x5368('0x77'),_0x257055);}}rp(_0x54f932)[_0x5368('0x18')](function(_0x58fbd5){var _0x9edb90={'statusCode':_0x58fbd5[_0x5368('0x78')]||0xc8,'statusMessage':_0x58fbd5[_0x5368('0x79')]||'OK','headers':_0x58fbd5[_0x5368('0x74')]||{},'body':_0x58fbd5[_0x5368('0x6d')]||{}};_0xcf017e(null,_0x9edb90);})[_0x5368('0x19')](function(_0x28ecb9){var _0x290bb8={'statusCode':_0x28ecb9[_0x5368('0x78')]||0x1f4,'statusMessage':_0x28ecb9[_0x5368('0x7a')]||_0x5368('0x7b'),'headers':_0x28ecb9[_0x5368('0x7c')][_0x5368('0x74')]||{},'body':_0x28ecb9[_0x5368('0x7c')]['body']||{}};_0xcf017e(null,_0x290bb8);});};AGIVertices[_0x5368('0x12')][_0x5368('0x7d')]=function(_0x4f50c7,_0x460ff3){scripts['googleDialogflow'](this[_0x5368('0xf')][_0x5368('0x39')],_0x4f50c7[_0x5368('0x7e')],_0x4f50c7['text'],_0x4f50c7[_0x5368('0x7f')]||'en')[_0x5368('0x18')](function(_0x574f33){_0x460ff3(null,_0x574f33);})[_0x5368('0x19')](function(_0xd179){_0x460ff3(_0xd179);});};AGIVertices[_0x5368('0x12')][_0x5368('0x80')]=function(_0x2ef8e3,_0x40e04a){scripts[_0x5368('0x80')](this[_0x5368('0xf')]['uniqueid'],_0x2ef8e3[_0x5368('0x81')],_0x2ef8e3[_0x5368('0x82')],_0x2ef8e3[_0x5368('0x83')],_0x2ef8e3[_0x5368('0x62')],_0x2ef8e3['dialogflowV2_language']||'en')[_0x5368('0x18')](function(_0x548708){_0x40e04a(null,_0x548708);})['catch'](function(_0x599fc8){_0x40e04a(_0x599fc8);});};AGIVertices['prototype'][_0x5368('0x84')]=function(_0x54a74c,_0x28803a){scripts['sestekNDA'](this[_0x5368('0xf')],_0x54a74c)[_0x5368('0x18')](function(_0x4d73e6){_0x28803a(null,_0x4d73e6);})[_0x5368('0x19')](function(_0x53a93f){_0x28803a(_0x53a93f);});};AGIVertices[_0x5368('0x12')][_0x5368('0x85')]=function(_0x338b4b,_0x4aade6){scripts[_0x5368('0x85')](_0x338b4b[_0x5368('0x7e')],_0x338b4b[_0x5368('0x62')],_0x338b4b[_0x5368('0x86')]||_0x5368('0x63'),_0x338b4b[_0x5368('0x87')])[_0x5368('0x18')](function(_0x3ea3fe){_0x4aade6(null,_0x3ea3fe);})[_0x5368('0x19')](function(_0x4944de){_0x4aade6(_0x4944de);});};AGIVertices[_0x5368('0x12')][_0x5368('0x88')]=function(_0xb093c,_0x566b21,_0x4741af){scripts['ispeechASR'](_0x566b21,_0xb093c[_0x5368('0x7e')],_0xb093c[_0x5368('0x89')]||'en-US',this['isConfigured'](_0xb093c[_0x5368('0x8a')])?_0xb093c[_0x5368('0x8a')]:undefined)[_0x5368('0x18')](function(_0x3a0638){_0x4741af(null,_0x3a0638);})['catch'](function(_0x80a8b0){_0x4741af(_0x80a8b0);});};AGIVertices[_0x5368('0x12')][_0x5368('0x8b')]=function(_0x2f1623,_0x7c35c4){scripts[_0x5368('0x8b')](_0x2f1623[_0x5368('0x8c')],_0x2f1623['aws_secret_access_key'],_0x2f1623[_0x5368('0x8d')],_0x2f1623[_0x5368('0x8e')]||_0x5368('0x8f'),_0x2f1623[_0x5368('0x62')],_0x2f1623[_0x5368('0x90')]||_0x5368('0x62'))[_0x5368('0x18')](function(_0x13f17a){_0x7c35c4(null,_0x13f17a);})[_0x5368('0x19')](function(_0x509fe9){_0x7c35c4(_0x509fe9);});};AGIVertices[_0x5368('0x12')][_0x5368('0x91')]=function(_0x3f497e,_0x421ad6){scripts['awsLex'](this[_0x5368('0xf')][_0x5368('0x39')],_0x3f497e[_0x5368('0x8c')],_0x3f497e[_0x5368('0x92')],_0x3f497e[_0x5368('0x93')],_0x3f497e[_0x5368('0x62')],_0x3f497e[_0x5368('0x94')])[_0x5368('0x18')](function(_0x227040){_0x421ad6(null,_0x227040);})['catch'](function(_0x1dd220){_0x421ad6(_0x1dd220);});};AGIVertices[_0x5368('0x12')][_0x5368('0x95')]=function(_0x21a7b0,_0x14a279,_0x2776a5){scripts[_0x5368('0x95')](_0x14a279,_0x21a7b0[_0x5368('0x7e')],_0x21a7b0['google_asr_language']||_0x5368('0x63'))[_0x5368('0x18')](function(_0x130e44){_0x2776a5(null,_0x130e44);})['catch'](function(_0x1f3ca8){_0x2776a5(_0x1f3ca8);});};AGIVertices[_0x5368('0x12')][_0x5368('0x96')]=function(_0x2339a6,_0x257e05,_0x2dc9a1){scripts[_0x5368('0x96')](_0x257e05,_0x2339a6[_0x5368('0x97')],_0x2339a6[_0x5368('0x98')],_0x2339a6[_0x5368('0x72')])[_0x5368('0x18')](function(_0x50137e){_0x2dc9a1(null,_0x50137e);})[_0x5368('0x19')](function(_0x45b55e){_0x2dc9a1(_0x45b55e);});};AGIVertices[_0x5368('0x12')][_0x5368('0x99')]=function(_0x50cbf2){var _0x2dbe1e=_['includes'](verticesWithRetry,_0x50cbf2[_0x5368('0x9a')])?_0x50cbf2:_['clone'](_0x50cbf2);for(var _0x1247d0 in _0x2dbe1e){if(_0x2dbe1e[_0x5368('0x9b')](_0x1247d0)){if(_0x2dbe1e[_0x1247d0]&&_['isString'](_0x2dbe1e[_0x1247d0])){if(_['includes'](recursiveMapAttributes,_0x1247d0)){_0x2dbe1e[_0x1247d0]=this[_0x5368('0x9c')](_0x2dbe1e[_0x1247d0]);}else{_0x2dbe1e[_0x1247d0]=this[_0x5368('0x9d')](_0x2dbe1e[_0x1247d0]);}}}}return _0x2dbe1e;};AGIVertices['prototype']['recursiveNodeIndex']=function(_0x5e21a7){for(var _0x268bd2 in _0x5e21a7){if(_0x5e21a7[_0x5368('0x9b')](_0x268bd2)){if(_['isPlainObject'](_0x5e21a7[_0x268bd2])){this[_0x5368('0x9e')](_0x5e21a7[_0x268bd2]);}else if(_['isArray'](_0x5e21a7[_0x268bd2])){for(var _0x24fd25=0x0;_0x24fd25<_0x5e21a7[_0x268bd2][_0x5368('0x9f')];_0x24fd25++){this[_0x5368('0x9e')](_0x5e21a7[_0x268bd2][_0x24fd25]);}}else if(_[_0x5368('0xa0')](_0x5e21a7[_0x268bd2])){_0x5e21a7[_0x268bd2]=this[_0x5368('0x9d')](_0x5e21a7[_0x268bd2]);}}}};AGIVertices['prototype']['saveRestApiResult']=function(_0x543c89,_0x143d3b){for(var _0x16c465 in _0x543c89){if(_0x543c89[_0x5368('0x9b')](_0x16c465)){if(_[_0x5368('0xa1')](_0x543c89[_0x16c465])){if(!_[_0x5368('0x46')](_0x543c89[_0x16c465])){this[_0x5368('0xa2')](_0x543c89[_0x16c465],util[_0x5368('0x59')]('%s.%s',_0x143d3b,_0x16c465));}}else if(_['isArray'](_0x543c89[_0x16c465])){for(var _0x25e15f=0x0;_0x25e15f<_0x543c89[_0x16c465][_0x5368('0x9f')];_0x25e15f++){this[_0x5368('0xa2')](_0x543c89[_0x16c465][_0x25e15f],util['format']('%s.%s',_0x143d3b,_0x16c465+'['+_0x25e15f+']'));}}else{if(!_[_0x5368('0x47')](_0x543c89[_0x16c465])){this[_0x5368('0xf')][_0x5368('0xa3')](util[_0x5368('0x59')](_0x5368('0xa4'),_0x143d3b,_0x16c465),_0x543c89[_0x16c465]);}}}}};AGIVertices[_0x5368('0x12')][_0x5368('0x9c')]=function(_0x52b55e){try{var _0x2bf1aa=JSON['parse'](_0x52b55e);this[_0x5368('0x9e')](_0x2bf1aa);return JSON[_0x5368('0x76')](_0x2bf1aa);}catch(_0x4fb269){return this['replaceAllVariables'](_0x52b55e);}};AGIVertices[_0x5368('0x12')][_0x5368('0x9d')]=function(_0x13843d){var _0x51bd1e=_0x13843d[_0x5368('0xa5')]('{');for(var _0x7765ff=0x1;_0x7765ff<_0x51bd1e[_0x5368('0x9f')];_0x7765ff+=0x1){var _0x27d207=_0x51bd1e[_0x7765ff]['split']('}');if(_0x27d207['length']>0x1){_0x13843d=_0x13843d[_0x5368('0xa6')]('{'+_0x27d207[0x0]+'}',this[_0x5368('0xf')][_0x5368('0x13')](_0x27d207[0x0])['extra']||_0x27d207[0x0]);}}if(_0x51bd1e[_0x5368('0x9f')]===0x1){return _0x13843d[_0x5368('0x4f')]();}return this[_0x5368('0x9d')](_0x13843d);};AGIVertices[_0x5368('0x12')]['getAndSetVariable']=function(_0x40e962,_0x51c9c9){var _0x47b392=this[_0x5368('0xf')][_0x5368('0x13')](_0x40e962);if(_0x47b392['result']===-0x1){return _0x47b392;}logger[_0x5368('0x2f')](util[_0x5368('0x59')](_0x5368('0xa7'),_0x51c9c9,_0x47b392['extra']));return this[_0x5368('0xf')][_0x5368('0xa3')](_0x51c9c9,_0x47b392[_0x5368('0xa8')]);};AGIVertices[_0x5368('0x12')]['isConfigured']=function(_0x14b2b1){return _0x14b2b1&&_0x14b2b1!=='0'&&_0x14b2b1!=='-1'&&_0x14b2b1!=='';};AGIVertices[_0x5368('0x12')][_0x5368('0xa9')]=function(_0x2f78ba){this[_0x5368('0x38')][_0x5368('0x71')](this,_0x2f78ba,'-');_0x2f78ba['retry']=_0x2f78ba[_0x5368('0xa9')];return{'code':0xc8,'result':'-'};};AGIVertices[_0x5368('0x12')][_0x5368('0xaa')]=function(_0x205465){logger[_0x5368('0x2f')](util[_0x5368('0x59')]('Enter\x20in\x20MRCPSynth\x20(%s)\x20block',_0x205465[_0x5368('0x3a')]));if(!this[_0x5368('0xab')](_0x205465[_0x5368('0x62')])){return this['channel']['noop'](_0x5368('0xac'));}var _0x2a1b43='\x22'+_0x205465[_0x5368('0x62')]+'\x22';if(this[_0x5368('0xab')](_0x205465['options'])){_0x2a1b43+=','+_0x205465[_0x5368('0x7c')];}var _0x45cb3c=this[_0x5368('0xf')][_0x5368('0x5d')](_0x5368('0xad'),_0x2a1b43);if(_0x45cb3c['result']===-0x1){return _0x45cb3c;}return this[_0x5368('0xf')][_0x5368('0xae')](util['format'](_0x5368('0xaf'),_0x2a1b43));};AGIVertices[_0x5368('0x12')]['mrcprecog']=function(_0x17e874){logger['info'](util[_0x5368('0x59')]('Enter\x20in\x20MRCPRecog\x20(%s)\x20block',_0x17e874['label']));if(!this[_0x5368('0xab')](_0x17e874[_0x5368('0xb0')])){return this[_0x5368('0xf')][_0x5368('0xae')]('no\x20grammar\x20configured');}var _0x1c5d2b=_0x17e874['grammar'];if(this['isConfigured'](_0x17e874[_0x5368('0x7c')])){_0x1c5d2b+=','+_0x17e874[_0x5368('0x7c')];}var _0x4ae15a=this[_0x5368('0xf')]['exec'](_0x5368('0xb1'),_0x1c5d2b);if(_0x4ae15a[_0x5368('0xb2')]===-0x1){return _0x4ae15a;}var _0x538ae9=this['getAndSetVariable'](_0x5368('0xb3'),'MRCP_RECOG_CONFIDENCE');if(_0x538ae9[_0x5368('0xb2')]===-0x1){return _0x538ae9;}var _0x186169=this['getAndSetVariable'](_0x5368('0xb4'),_0x5368('0xb5'));if(_0x186169[_0x5368('0xb2')]===-0x1){return _0x186169;}var _0x2c34cd=this[_0x5368('0xb6')]('RECOG_INSTANCE()',_0x5368('0xb7'));if(_0x2c34cd[_0x5368('0xb2')]===-0x1){return _0x2c34cd;}return this[_0x5368('0xf')][_0x5368('0xae')](util['format']('Executed\x20command\x20MRCPRecog\x20%s',_0x1c5d2b));};AGIVertices[_0x5368('0x12')][_0x5368('0x8')]=function(_0x103b03){logger['info'](util[_0x5368('0x59')](_0x5368('0xb8'),_0x103b03[_0x5368('0x3a')]));return this[_0x5368('0xf')][_0x5368('0x8')]([_0x103b03[_0x5368('0xb9')],_0x103b03[_0x5368('0xba')]]);};AGIVertices[_0x5368('0x12')][_0x5368('0xbb')]=function(_0x1421a2){logger[_0x5368('0x2f')](util[_0x5368('0x59')]('Enter\x20in\x20ANSWER\x20(%s)\x20block',_0x1421a2[_0x5368('0x3a')]));if(this['isConfigured'](_0x1421a2[_0x5368('0x69')])){logger[_0x5368('0x2f')](util[_0x5368('0x59')](_0x5368('0xbc'),_0x1421a2[_0x5368('0x69')]));var _0x39219b=this[_0x5368('0xf')][_0x5368('0xbd')](_0x1421a2[_0x5368('0x69')]);if(_0x39219b[_0x5368('0xb2')]===-0x1){return _0x39219b;}}return this['channel'][_0x5368('0xbb')]();};AGIVertices[_0x5368('0x12')][_0x5368('0x4d')]=function(_0x26ab21){logger['info'](util[_0x5368('0x59')](_0x5368('0xbe'),_0x26ab21[_0x5368('0x3a')]));if(!this[_0x5368('0xab')](_0x26ab21['list_id'])){return this[_0x5368('0xf')][_0x5368('0x2d')](_0x26ab21,'no\x20list\x20selected');}_0x26ab21[_0x5368('0x4c')]=moment();if(this[_0x5368('0xab')](_0x26ab21['delay'])){_0x26ab21['scheduledAt']=moment()['add'](_0x26ab21[_0x5368('0xbf')],_0x5368('0xc0'));}if(!this[_0x5368('0xab')](_0x26ab21[_0x5368('0x50')])){_0x26ab21[_0x5368('0x50')]=0x2;}this[_0x5368('0x45')]['sync'](this,_0x26ab21);return this[_0x5368('0xf')][_0x5368('0xae')](util[_0x5368('0x59')](_0x5368('0xc1'),_0x26ab21[_0x5368('0x4a')],_0x26ab21[_0x5368('0x4b')],_0x26ab21[_0x5368('0x4c')]));};AGIVertices[_0x5368('0x12')][_0x5368('0xc2')]=function(_0x14ac47){logger['info'](util[_0x5368('0x59')](_0x5368('0xc3'),_0x14ac47[_0x5368('0x3a')]));var _0x3225ba=this[_0x5368('0xf')][_0x5368('0x5d')](_0x14ac47[_0x5368('0xc4')],_0x14ac47['options']);if(_0x3225ba[_0x5368('0xb2')]===-0x1){return _0x3225ba;}return this[_0x5368('0xf')][_0x5368('0xae')](util['format'](_0x5368('0xc5'),_0x14ac47['application'],_0x14ac47[_0x5368('0x7c')]));};AGIVertices[_0x5368('0x12')]['lumenvoxtts']=function(_0x20fd08){logger[_0x5368('0x2f')](util[_0x5368('0x59')]('Enter\x20in\x20LUMENVOXTTS\x20(%s)\x20block',_0x20fd08[_0x5368('0x3a')]));if(!this[_0x5368('0xab')](_0x20fd08['text'])){return this[_0x5368('0xf')][_0x5368('0xae')](_0x5368('0xac'));}var _0x1289ab='\x22'+_0x20fd08[_0x5368('0x62')]+'\x22';if(this['isConfigured'](_0x20fd08[_0x5368('0x7c')])){_0x1289ab+=','+_0x20fd08[_0x5368('0x7c')];}var _0xabf083=this[_0x5368('0xf')]['exec'](_0x5368('0xad'),_0x1289ab);if(_0xabf083[_0x5368('0xb2')]===-0x1){return _0xabf083;}return this[_0x5368('0xf')][_0x5368('0xae')](util['format'](_0x5368('0xaf'),_0x1289ab));};AGIVertices[_0x5368('0x12')]['sestektts']=function(_0x5c5eb2){logger[_0x5368('0x2f')](util[_0x5368('0x59')]('Enter\x20in\x20SESTEKTTS\x20(%s)\x20block',_0x5c5eb2[_0x5368('0x3a')]));if(!this[_0x5368('0xab')](_0x5c5eb2[_0x5368('0x62')])){return this[_0x5368('0xf')][_0x5368('0xae')](_0x5368('0xac'));}var _0x37e03b='\x22'+_0x5c5eb2[_0x5368('0x62')]+'\x22';if(this[_0x5368('0xab')](_0x5c5eb2['options'])){_0x37e03b+=','+_0x5c5eb2['options'];}var _0x583382=this[_0x5368('0xf')]['exec'](_0x5368('0xad'),_0x37e03b);if(_0x583382[_0x5368('0xb2')]===-0x1){return _0x583382;}return this[_0x5368('0xf')][_0x5368('0xae')](util['format'](_0x5368('0xaf'),_0x37e03b));};AGIVertices[_0x5368('0x12')]['lumenvoxasr']=function(_0x3ca129){logger[_0x5368('0x2f')](util[_0x5368('0x59')](_0x5368('0xc6'),_0x3ca129['label']));if(!this[_0x5368('0xab')](_0x3ca129['grammar'])){return this[_0x5368('0xf')][_0x5368('0xae')]('no\x20grammar\x20configured');}var _0x1210e9=_0x3ca129[_0x5368('0xb0')];if(this['isConfigured'](_0x3ca129[_0x5368('0x7c')])){_0x1210e9+=','+_0x3ca129[_0x5368('0x7c')];}var _0x4f31d0=this[_0x5368('0xf')][_0x5368('0x5d')](_0x5368('0xb1'),_0x1210e9);if(_0x4f31d0[_0x5368('0xb2')]===-0x1){return _0x4f31d0;}var _0x2eb508=this[_0x5368('0xb6')]('RECOG_CONFIDENCE()',_0x5368('0xc7'));if(_0x2eb508[_0x5368('0xb2')]===-0x1){return _0x2eb508;}var _0x213204=this['getAndSetVariable'](_0x5368('0xb4'),_0x5368('0xc8'));if(_0x213204['result']===-0x1){return _0x213204;}var _0x5c1213=this['getAndSetVariable'](_0x5368('0xc9'),_0x5368('0xca'));if(_0x5c1213[_0x5368('0xb2')]===-0x1){return _0x5c1213;}return this[_0x5368('0xf')][_0x5368('0xae')](util['format'](_0x5368('0xcb'),_0x1210e9));};AGIVertices['prototype'][_0x5368('0xcc')]=function(_0x31943c){logger[_0x5368('0x2f')](util[_0x5368('0x59')]('Enter\x20in\x20SESTEKASR\x20(%s)\x20block',_0x31943c[_0x5368('0x3a')]));if(!this[_0x5368('0xab')](_0x31943c['grammar'])){return this[_0x5368('0xf')][_0x5368('0xae')]('no\x20grammar\x20configured');}var _0xdb07d3=_0x31943c['grammar'];if(this[_0x5368('0xab')](_0x31943c[_0x5368('0x7c')])){_0xdb07d3+=','+_0x31943c[_0x5368('0x7c')];}var _0x3f5cfe=this[_0x5368('0xf')][_0x5368('0x5d')](_0x5368('0xb1'),_0xdb07d3);if(_0x3f5cfe[_0x5368('0xb2')]===-0x1){return _0x3f5cfe;}var _0x147341=this['getAndSetVariable'](_0x5368('0xb3'),_0x5368('0xcd'));if(_0x147341[_0x5368('0xb2')]===-0x1){return _0x147341;}var _0x265dc5=this[_0x5368('0xb6')](_0x5368('0xb4'),_0x5368('0xce'));if(_0x265dc5[_0x5368('0xb2')]===-0x1){return _0x265dc5;}var _0x24c8a1=this[_0x5368('0xb6')](_0x5368('0xc9'),_0x5368('0xcf'));if(_0x24c8a1['result']===-0x1){return _0x24c8a1;}return this['channel'][_0x5368('0xae')](util[_0x5368('0x59')](_0x5368('0xcb'),_0xdb07d3));};AGIVertices[_0x5368('0x12')][_0x5368('0xd0')]=function(_0x599f9d){logger['info'](util['format'](_0x5368('0xd1'),_0x599f9d['label']));if(!this['isConfigured'](_0x599f9d['odbc_id'])){return this[_0x5368('0xf')][_0x5368('0x2d')](_0x599f9d,_0x5368('0xd2'));}var _0x4e62cd=this['getSquareOdbc']['sync'](this,_0x599f9d[_0x5368('0xd3')]);if(!_0x4e62cd){return this['channel'][_0x5368('0x2d')](_0x599f9d,_0x5368('0xd4'));}if(!this['isConfigured'](_0x599f9d[_0x5368('0x31')])){return this[_0x5368('0xf')]['error'](_0x599f9d,_0x5368('0xd5'));}var _0x532f3d=_0x599f9d[_0x5368('0x31')]['replace'](/(\r\n|\n|\r)/gm,'\x20');this[_0x5368('0xf')]['noop'](util[_0x5368('0x59')]('query:\x20%s',_0x532f3d));var _0x1c095d=this['getQueryOdbc'][_0x5368('0x71')](this,_0x4e62cd,_0x532f3d);this[_0x5368('0x38')][_0x5368('0x71')](this,_0x599f9d,_0x532f3d);if(!this[_0x5368('0xab')](_0x599f9d[_0x5368('0xd6')])){return this['channel'][_0x5368('0xae')](_0x5368('0xd7'));}var _0xac2075=this['getVariable']['sync'](this,_0x599f9d[_0x5368('0xd6')]);if(!_0xac2075){return this['channel']['error'](_0x599f9d,_0x5368('0xd8'));}var _0x28a052=this;_0x1c095d['forEach'](function(_0x5f0f8d,_0x4edeb7){Object[_0x5368('0xd9')](_0x5f0f8d)[_0x5368('0xda')](function(_0x117f59){_0x28a052[_0x5368('0xf')]['setVariable'](util['format'](_0x5368('0xdb'),_0xac2075,_0x4edeb7,_0x117f59),_0x5f0f8d[_0x117f59]);});});this['channel'][_0x5368('0xa3')](util[_0x5368('0x59')](_0x5368('0xdc'),_0xac2075),_0x1c095d['length']);return this['channel'][_0x5368('0xae')](util[_0x5368('0x59')]('variable\x20%s\x20set',_0xac2075));};AGIVertices[_0x5368('0x12')][_0x5368('0xdd')]=function(_0x3b206b){logger[_0x5368('0xde')](util[_0x5368('0x59')](_0x5368('0xdf'),_0x3b206b['label']));if(!this[_0x5368('0xab')](_0x3b206b['sip_id'])){return this['channel'][_0x5368('0x2d')](_0x3b206b,_0x5368('0xe0'));}var _0x41a1eb=this[_0x5368('0x1e')][_0x5368('0x71')](this,_0x3b206b['sip_id']);if(!_0x41a1eb){return this[_0x5368('0xf')][_0x5368('0x2d')](_0x3b206b,_0x5368('0xe1'));}var _0x2227db=this['channel'][_0x5368('0x5d')]('DIAL',[util[_0x5368('0x59')]('SIP/%s',_0x41a1eb),_0x3b206b[_0x5368('0x69')],_0x3b206b['opts'],_0x3b206b[_0x5368('0x68')]]);if(_0x2227db[_0x5368('0xb2')]===-0x1){return _0x2227db;}return this[_0x5368('0xf')][_0x5368('0xae')](util['format'](_0x5368('0xe2'),_0x5368('0xe3')));};AGIVertices[_0x5368('0x12')][_0x5368('0xe4')]=function(_0x9f0dc3){logger['info'](util[_0x5368('0x59')]('Enter\x20in\x20DIALOGFLOW\x20(%s)\x20block',_0x9f0dc3['label']));if(!this[_0x5368('0xab')](_0x9f0dc3[_0x5368('0x7e')])){return this[_0x5368('0xf')][_0x5368('0xae')](_0x5368('0xe5'));}if(!this[_0x5368('0xab')](_0x9f0dc3[_0x5368('0x62')])){return this[_0x5368('0xf')][_0x5368('0xae')](_0x5368('0xac'));}this[_0x5368('0xf')][_0x5368('0xe6')]=!![];this[_0x5368('0x38')](_0x9f0dc3);this[_0x5368('0x44')](_0x9f0dc3[_0x5368('0x62')],'in','','');this[_0x5368('0xf')][_0x5368('0xae')](util[_0x5368('0x59')](_0x5368('0xe7'),_0x9f0dc3['text']));var _0x1c0922=this['googleDialogflow'][_0x5368('0x71')](this,_0x9f0dc3);if(_0x1c0922){for(var _0x8952b0 in _0x1c0922){if(_0x1c0922[_0x5368('0x9b')](_0x8952b0)){this[_0x5368('0xf')][_0x5368('0xa3')](util[_0x5368('0x59')](_0x5368('0xe8'),_0x8952b0[_0x5368('0x6c')]()),_0x1c0922[_0x8952b0]);}}this[_0x5368('0x44')](_0x1c0922[_0x5368('0xe9')],_0x5368('0xea'),_0x5368('0xe4'),'');return this[_0x5368('0xf')][_0x5368('0xae')](util[_0x5368('0x59')](_0x5368('0xeb'),_0x1c0922['speech']));}return this[_0x5368('0xf')]['error'](_0x9f0dc3,'Dialogflow\x20is\x20unreachable');};AGIVertices[_0x5368('0x12')][_0x5368('0xec')]=function(_0x54ba44){logger[_0x5368('0x2f')](util['format'](_0x5368('0xed'),_0x54ba44[_0x5368('0x3a')]));if(!this[_0x5368('0xab')](_0x54ba44[_0x5368('0x81')])){return this['channel'][_0x5368('0xae')]('no\x20project_id\x20configured');}if(!this['isConfigured'](_0x54ba44[_0x5368('0x82')])){return this[_0x5368('0xf')][_0x5368('0xae')](_0x5368('0xee'));}if(!this[_0x5368('0xab')](_0x54ba44['private_key'])){return this[_0x5368('0xf')]['noop'](_0x5368('0xef'));}if(!this[_0x5368('0xab')](_0x54ba44['dialogflowV2_language'])){return this[_0x5368('0xf')][_0x5368('0xae')](_0x5368('0xf0'));}if(!this[_0x5368('0xab')](_0x54ba44[_0x5368('0x62')])){return this[_0x5368('0xf')]['noop'](_0x5368('0xac'));}this[_0x5368('0xf')][_0x5368('0xe6')]=!![];this[_0x5368('0x38')](_0x54ba44);this[_0x5368('0x44')](_0x54ba44['text'],'in','','');this['channel'][_0x5368('0xae')](util['format'](_0x5368('0xf1'),_0x54ba44['text']));var _0x1f0aeb=this['googleDialogflowV2'][_0x5368('0x71')](this,_0x54ba44);if(_0x1f0aeb){for(var _0x327850 in _0x1f0aeb){if(_0x1f0aeb[_0x5368('0x9b')](_0x327850)){if(_0x327850!==_0x5368('0xf2')){this[_0x5368('0xf')]['setVariable'](util[_0x5368('0x59')](_0x5368('0xe8'),_0x327850['toUpperCase']()),_0x1f0aeb[_0x327850]);}}}this[_0x5368('0x44')](_0x1f0aeb[_0x5368('0xe9')],'out',_0x5368('0xec'),_0x1f0aeb[_0x5368('0xf2')]);return this[_0x5368('0xf')][_0x5368('0xae')](util['format'](_0x5368('0xf3'),_0x1f0aeb['speech']));}return this['channel'][_0x5368('0x2d')](_0x54ba44,_0x5368('0xf4'));};AGIVertices['prototype'][_0x5368('0xf5')]=function(_0x222ee0){logger[_0x5368('0x2f')](util[_0x5368('0x59')](_0x5368('0xf6'),_0x222ee0[_0x5368('0x3a')]));if(!this[_0x5368('0xab')](_0x222ee0[_0x5368('0xf7')])){return this[_0x5368('0xf')]['noop']('no\x20ndauth\x20url\x20configured');}if(!this['isConfigured'](_0x222ee0[_0x5368('0xf8')])){return this[_0x5368('0xf')]['noop'](_0x5368('0xf9'));}if(!this[_0x5368('0xab')](_0x222ee0[_0x5368('0xfa')])){return this[_0x5368('0xf')][_0x5368('0xae')](_0x5368('0xfb'));}if(!this['isConfigured'](_0x222ee0['ndassistant_url'])){return this[_0x5368('0xf')][_0x5368('0xae')](_0x5368('0xac'));}this[_0x5368('0xf')][_0x5368('0xe6')]=!![];this['createSquareDetailsReport'](_0x222ee0);this['createSquareMessage'](_0x222ee0['text'],'in','','');this[_0x5368('0xf')]['noop'](util[_0x5368('0x59')]('Trying\x20SestekNDA:\x20%s',_0x222ee0[_0x5368('0x62')]));var _0x3584dd=this['sestekNDA'][_0x5368('0x71')](this,_0x222ee0);if(_0x3584dd){for(var _0x5a2cdd in _0x3584dd){if(_0x3584dd[_0x5368('0x9b')](_0x5a2cdd)){this['channel'][_0x5368('0xa3')](util[_0x5368('0x59')](_0x5368('0xfc'),_0x5a2cdd[_0x5368('0x6c')]()),_0x3584dd[_0x5a2cdd]);}}this[_0x5368('0x44')](_0x3584dd['speech'],'out','sesteknda','');if(_0x3584dd['audiofile']){this[_0x5368('0xf')][_0x5368('0xae')](util[_0x5368('0x59')](_0x5368('0xfd'),_0x3584dd[_0x5368('0xfe')]));var _0x23f2e9=this[_0x5368('0xf')]['streamFile'](_0x3584dd[_0x5368('0xfe')]);try{fs[_0x5368('0xff')](_0x3584dd['audiofile']+_0x5368('0x100'));}catch(_0x5a433b){logger[_0x5368('0x2d')](_0x5a433b);}return _0x23f2e9;}else{return this[_0x5368('0xf')][_0x5368('0xae')](util['format']('SestekNDA\x20Result\x20%s',_0x3584dd[_0x5368('0xe9')]));}}return this[_0x5368('0xf')][_0x5368('0x2d')](_0x222ee0,_0x5368('0x101'));};AGIVertices['prototype'][_0x5368('0x102')]=function(_0x50f41a){logger[_0x5368('0x2f')](util[_0x5368('0x59')](_0x5368('0x103'),_0x50f41a[_0x5368('0x3a')]));return this[_0x5368('0xf')][_0x5368('0xae')](_0x5368('0x102'));};AGIVertices['prototype'][_0x5368('0x104')]=function(_0xede30e){logger['info'](util[_0x5368('0x59')](_0x5368('0x105'),_0xede30e['label']));var _0x281e7e='';if(_0xede30e[_0x5368('0x106')]){if(!this['isConfigured'](_0xede30e[_0x5368('0x106')])){return this[_0x5368('0xf')][_0x5368('0x2d')](_0xede30e,'no\x20trunk\x20selected');}else{var _0x34f89a=parseInt(_0xede30e['trunk_id'],0xa);if(isNaN(_0x34f89a)){_0x281e7e=_0xede30e[_0x5368('0x106')];}else{_0x281e7e=this[_0x5368('0x20')]['sync'](this,_0xede30e[_0x5368('0x106')]);if(!_0x281e7e){return this[_0x5368('0xf')][_0x5368('0x2d')](_0xede30e,_0x5368('0x107'));}}}}else if(_0xede30e[_0x5368('0x108')]){_0x281e7e=_0xede30e[_0x5368('0x108')];}else{return this[_0x5368('0xf')]['error'](_0xede30e,_0x5368('0x109'));}var _0x33959b=this[_0x5368('0xf')][_0x5368('0x5d')](_0x5368('0xe3'),[util[_0x5368('0x59')](_0x5368('0x10a'),_0x281e7e,_0xede30e[_0x5368('0x4a')]),_0xede30e[_0x5368('0x69')],_0xede30e[_0x5368('0x10b')],_0xede30e['url']]);if(_0x33959b[_0x5368('0xb2')]===-0x1){return _0x33959b;}return this[_0x5368('0xf')][_0x5368('0xae')](util['format'](_0x5368('0xe2'),_0x5368('0xe3')));};AGIVertices[_0x5368('0x12')][_0x5368('0x10c')]=function(_0x5280ee){logger[_0x5368('0x2f')](util[_0x5368('0x59')](_0x5368('0x10d'),_0x5280ee[_0x5368('0x3a')]));return this['channel'][_0x5368('0xae')](_0x5368('0x10c'));};AGIVertices[_0x5368('0x12')][_0x5368('0xe')]=function(_0x55bc2a){logger[_0x5368('0x2f')](util[_0x5368('0x59')](_0x5368('0x10e'),_0x55bc2a[_0x5368('0x3a')]));if(_0x55bc2a[_0x5368('0x10f')]===0x0){return this[_0x5368('0xa9')](_0x55bc2a);}_0x55bc2a[_0x5368('0x10f')]-=0x1;if(!this['isConfigured'](_0x55bc2a[_0x5368('0x110')])){return this[_0x5368('0xf')][_0x5368('0x2d')](_0x55bc2a,'no\x20file\x20audio\x20selected');}var _0x251897=this[_0x5368('0x22')][_0x5368('0x71')](this,_0x55bc2a[_0x5368('0x110')]);if(!_0x251897){return this['channel']['error'](_0x55bc2a,_0x5368('0x111'));}if(!this[_0x5368('0xab')](_0x55bc2a[_0x5368('0xd6')])){return this[_0x5368('0xf')][_0x5368('0x2d')](_0x5368('0xd7'));}var _0x56521f=this[_0x5368('0xf')][_0x5368('0x112')](_0x251897,_0x55bc2a[_0x5368('0x113')],_0x55bc2a[_0x5368('0x114')]);var _0x1d81d8=_0x56521f['result']?_0x56521f['result'][_0x5368('0x4f')]():'';logger[_0x5368('0x2f')](_0x5368('0x115'),JSON[_0x5368('0x76')](_0x56521f));if(_0x56521f[_0x5368('0xb2')]===-0x1){this[_0x5368('0x38')]['sync'](this,_0x55bc2a,_0x1d81d8);return _0x56521f;}else if(_0x56521f[_0x5368('0xa8')]==='timeout'){_0x56521f[_0x5368('0xb2')]=_0x1d81d8[_0x5368('0x9f')]>=parseInt(_0x55bc2a['mindigit'])?'x':'i';}else{_0x56521f['result']=_0x1d81d8['length']>=parseInt(_0x55bc2a[_0x5368('0x116')])&&_0x1d81d8[_0x5368('0x9f')]<=parseInt(_0x55bc2a[_0x5368('0x114')])?'x':'i';}var _0x11c004=this[_0x5368('0x13')][_0x5368('0x71')](this,_0x55bc2a['variable_id']);if(!_0x11c004){return this['channel']['error'](_0x55bc2a,'no\x20variable\x20found');}this[_0x5368('0xf')]['setVariable'](_0x11c004,_0x1d81d8);if(this[_0x5368('0xab')](_0x55bc2a[_0x5368('0x117')])){var _0x37acda=parseInt(_0x55bc2a[_0x5368('0x117')],0xa);var _0x2ab8cb=rs[_0x5368('0x118')]({'charset':'*','length':_0x37acda});var _0x24e39c=_0x1d81d8[_0x5368('0x9f')];if(_0x24e39c>0x0){if(_0x24e39c>_0x37acda){this['createSquareDetailsReport'][_0x5368('0x71')](this,_0x55bc2a,_0x55bc2a[_0x5368('0x119')]==='first'?_0x2ab8cb+_0x1d81d8[_0x5368('0x11a')](_0x37acda):_0x1d81d8['substr'](0x0,_0x24e39c-_0x37acda)+_0x2ab8cb);}else{this['createSquareDetailsReport'][_0x5368('0x71')](this,_0x55bc2a,rs[_0x5368('0x118')]({'charset':'*','length':_0x24e39c}));}}else{this['createSquareDetailsReport'][_0x5368('0x71')](this,_0x55bc2a,'');}}else{this[_0x5368('0x38')][_0x5368('0x71')](this,_0x55bc2a,_0x1d81d8);}return _0x56521f;};AGIVertices[_0x5368('0x12')][_0x5368('0x11b')]=function(_0x1e4cad){logger[_0x5368('0x2f')](util[_0x5368('0x59')](_0x5368('0x11c'),_0x1e4cad[_0x5368('0x3a')]));return this[_0x5368('0xe')](_0x1e4cad);};AGIVertices['prototype']['goal']=function(_0x119d68){logger[_0x5368('0x2f')](util['format'](_0x5368('0x11d'),_0x119d68[_0x5368('0x3a')]));this[_0x5368('0x38')][_0x5368('0x71')](this,_0x119d68,_0x119d68[_0x5368('0x11e')]);return this[_0x5368('0xf')][_0x5368('0xae')](util[_0x5368('0x59')](_0x5368('0x11f'),_0x119d68[_0x5368('0x11e')]));};AGIVertices['prototype'][_0x5368('0x120')]=function(_0x3c68fb){logger['info'](util[_0x5368('0x59')](_0x5368('0x121'),_0x3c68fb[_0x5368('0x3a')]));if(!this[_0x5368('0xab')](_0x3c68fb[_0x5368('0x8c')])||!this[_0x5368('0xab')](_0x3c68fb[_0x5368('0x92')])){return this[_0x5368('0xf')]['noop'](_0x5368('0x122'));}if(!this[_0x5368('0xab')](_0x3c68fb[_0x5368('0x62')])){return this[_0x5368('0xf')][_0x5368('0xae')](_0x5368('0xac'));}this[_0x5368('0xf')][_0x5368('0xae')](util['format'](_0x5368('0x123'),_0x3c68fb['text']));var _0xe95422=this[_0x5368('0x8b')]['sync'](this,_0x3c68fb);if(_0xe95422){this['channel']['noop'](util[_0x5368('0x59')](_0x5368('0x124'),_0xe95422));var _0x3345b1=this[_0x5368('0xf')][_0x5368('0x125')](_0xe95422);try{fs[_0x5368('0xff')](_0xe95422+_0x5368('0x100'));}catch(_0x440ab3){logger[_0x5368('0x2d')](_0x440ab3);}return _0x3345b1;}return this[_0x5368('0xf')]['error'](_0x3c68fb,'aws\x20Polly\x20is\x20unreachable');};AGIVertices[_0x5368('0x12')][_0x5368('0x126')]=function(_0x1b6ada){logger['info'](util['format']('Enter\x20in\x20Amazon\x20Lex\x20(%s)\x20block',_0x1b6ada[_0x5368('0x3a')]));if(!this[_0x5368('0xab')](_0x1b6ada[_0x5368('0x8c')])||!this['isConfigured'](_0x1b6ada[_0x5368('0x92')])){return this[_0x5368('0xf')]['noop'](_0x5368('0x122'));}if(!this[_0x5368('0xab')](_0x1b6ada[_0x5368('0x94')])){return this['channel'][_0x5368('0xae')](_0x5368('0x127'));}if(!this[_0x5368('0xab')](_0x1b6ada[_0x5368('0x62')])){return this[_0x5368('0xf')]['noop'](_0x5368('0xac'));}this[_0x5368('0xf')][_0x5368('0xe6')]=!![];this[_0x5368('0x38')](_0x1b6ada);this[_0x5368('0x44')](_0x1b6ada['text'],'in','','');this[_0x5368('0xf')]['noop'](util[_0x5368('0x59')]('Trying\x20Amazon\x20Lex:\x20%s',_0x1b6ada[_0x5368('0x62')]));var _0x34a43a=this[_0x5368('0x91')][_0x5368('0x71')](this,_0x1b6ada);if(_0x34a43a){for(var _0x2ca6e2 in _0x34a43a){if(_0x34a43a[_0x5368('0x9b')](_0x2ca6e2)&&_[_0x5368('0xa0')](_0x34a43a[_0x2ca6e2])){this[_0x5368('0xf')][_0x5368('0xa3')](util[_0x5368('0x59')]('AWS_LEX_%s',_0x2ca6e2[_0x5368('0x6c')]()),_0x34a43a[_0x2ca6e2]);}}if(_['isNil'](_0x34a43a[_0x5368('0x7a')])){return this[_0x5368('0xf')]['noop']('Amazon\x20Lex\x20ready\x20for\x20fulfillment');}else{this[_0x5368('0x44')](_0x34a43a[_0x5368('0x7a')],_0x5368('0xea'),_0x5368('0x128'),'');return this['channel'][_0x5368('0xae')](util['format'](_0x5368('0x129'),_0x34a43a['message']));}}return this['channel'][_0x5368('0x2d')](_0x1b6ada,_0x5368('0x12a'));};AGIVertices[_0x5368('0x12')][_0x5368('0x12b')]=function(_0x1f2692){logger[_0x5368('0x2f')](util['format'](_0x5368('0x12c'),_0x1f2692[_0x5368('0x3a')],_0x1f2692[_0x5368('0x69')]));if(!this[_0x5368('0xab')](_0x1f2692[_0x5368('0x7e')])){return this[_0x5368('0xf')][_0x5368('0xae')](_0x5368('0xe5'));}var _0x1c9b6c=_0x5368('0x12d');var _0x7c87ab=util[_0x5368('0x59')](_0x5368('0x12e'),FILES_PATH,rs[_0x5368('0x118')](0x4));var _0x45f16=util[_0x5368('0x59')](_0x5368('0xa4'),_0x7c87ab,_0x1c9b6c);var _0x32350=!![];if(_0x1f2692[_0x5368('0x12f')]==='NOBEEP'){_0x32350=![];}var _0xfd4698=this[_0x5368('0xf')][_0x5368('0x130')](_0x7c87ab,_0x1c9b6c,_0x1f2692[_0x5368('0x131')],_0x1f2692[_0x5368('0x69')],undefined,_0x32350);if(_0xfd4698[_0x5368('0xb2')]!==-0x1){this[_0x5368('0xf')][_0x5368('0xae')](util[_0x5368('0x59')](_0x5368('0x132'),_0x45f16));var _0x39cdf9=this[_0x5368('0x95')][_0x5368('0x71')](this,_0x1f2692,_0x45f16);if(_0x39cdf9){for(var _0x55d31f in _0x39cdf9){if(_0x39cdf9[_0x5368('0x9b')](_0x55d31f)){this[_0x5368('0xf')][_0x5368('0xa3')](util[_0x5368('0x59')]('GOOGLE_ASR_%s',_0x55d31f[_0x5368('0x6c')]()),_0x39cdf9[_0x55d31f]);}}return this['channel']['noop'](util[_0x5368('0x59')](_0x5368('0x133'),JSON[_0x5368('0x76')](_0x39cdf9)));}}return _0xfd4698;};AGIVertices['prototype']['tildeasr']=function(_0x1c0b00){logger[_0x5368('0x2f')](util[_0x5368('0x59')]('Enter\x20in\x20TILDEASR\x20(%s)\x20block',_0x1c0b00['label']));if(!this[_0x5368('0xab')](_0x1c0b00[_0x5368('0x97')])){return this[_0x5368('0xf')]['noop'](_0x5368('0x134'));}if(!this[_0x5368('0xab')](_0x1c0b00[_0x5368('0x98')])){return this[_0x5368('0xf')]['noop'](_0x5368('0x135'));}var _0x46d905=_0x5368('0x12d');var _0x32581d=util[_0x5368('0x59')](_0x5368('0x12e'),FILES_PATH,rs[_0x5368('0x118')](0x4));var _0x4cca3c=util[_0x5368('0x59')]('%s.%s',_0x32581d,_0x46d905);var _0x172e78=!![];if(_0x1c0b00[_0x5368('0x12f')]===_0x5368('0x136')){_0x172e78=![];}var _0x563927=this['channel'][_0x5368('0x130')](_0x32581d,_0x46d905,_0x1c0b00['intKey'],_0x1c0b00[_0x5368('0x69')],undefined,_0x172e78);if(_0x563927['result']!==-0x1){this[_0x5368('0xf')]['noop'](util['format'](_0x5368('0x137'),_0x4cca3c));var _0x3c3312=this['tildeASR'][_0x5368('0x71')](this,_0x1c0b00,_0x4cca3c);if(_0x3c3312){for(var _0x5c5deb in _0x3c3312){if(_0x3c3312[_0x5368('0x9b')](_0x5c5deb)){this[_0x5368('0xf')][_0x5368('0xa3')](util[_0x5368('0x59')](_0x5368('0x138'),_0x5c5deb[_0x5368('0x6c')]()),_0x3c3312[_0x5c5deb]);}}return this[_0x5368('0xf')][_0x5368('0xae')](util['format']('TildeASR\x20Result\x20%s',JSON[_0x5368('0x76')](_0x3c3312)));}}return _0x563927;};AGIVertices[_0x5368('0x12')][_0x5368('0x139')]=function(_0xfbadd0){logger[_0x5368('0x2f')](util[_0x5368('0x59')](_0x5368('0x13a'),_0xfbadd0['label']));return this[_0x5368('0xf')][_0x5368('0x13b')](_0xfbadd0[_0x5368('0x3f')],_0xfbadd0['extension'],_0xfbadd0[_0x5368('0x41')]);};AGIVertices['prototype'][_0x5368('0x13c')]=function(_0x5aff03){logger[_0x5368('0x2f')](util['format'](_0x5368('0x13d'),_0x5aff03[_0x5368('0x3a')]));if(!this[_0x5368('0xab')](_0x5aff03['condition'])){return this['channel']['error'](_0x5aff03,_0x5368('0x13e'));}try{var _0x215a70=eval(_0x5aff03[_0x5368('0x13f')])?'true':'false';this[_0x5368('0xf')][_0x5368('0xae')](util[_0x5368('0x59')](_0x5368('0x140'),_0x5aff03[_0x5368('0x13f')],_0x215a70));return{'code':0xc8,'result':_0x215a70};}catch(_0x1c24dd){return{'code':0xc8,'result':_0x5368('0x141')};}};AGIVertices[_0x5368('0x12')][_0x5368('0x142')]=function(_0x5a7a9c){logger[_0x5368('0x2f')](util['format']('Enter\x20in\x20GOTOIFTIME\x20(%s)\x20block',_0x5a7a9c[_0x5368('0x3a')]));if(!this['isConfigured'](_0x5a7a9c[_0x5368('0x143')])){return this[_0x5368('0xf')][_0x5368('0x2d')](_0x5a7a9c,_0x5368('0x144'));}var _0x5d49e9=this[_0x5368('0x145')]['sync'](this,_0x5a7a9c[_0x5368('0x143')]);if(!_0x5d49e9){return this['channel'][_0x5368('0x2d')](_0x5a7a9c,'no\x20intervals\x20found');}for(var _0x3abd42=0x0;_0x3abd42<_0x5d49e9[_0x5368('0x9f')];_0x3abd42+=0x1){var _0x1075cf=this[_0x5368('0xf')]['getVariable'](util[_0x5368('0x59')](_0x5368('0x146'),_0x5d49e9[_0x3abd42]));if(_0x1075cf[_0x5368('0xb2')]===-0x1){return _0x1075cf;}logger[_0x5368('0x2f')](util[_0x5368('0x59')]('IFTIME\x20%s\x20%s',_0x5d49e9[_0x3abd42],_0x1075cf['extra']));if(_0x1075cf[_0x5368('0xa8')]==='true'){logger[_0x5368('0x2f')](util[_0x5368('0x59')](_0x5368('0x147'),_0x5d49e9[_0x3abd42],_0x5368('0x148')));this[_0x5368('0xf')][_0x5368('0xae')](util[_0x5368('0x59')](_0x5368('0x147'),_0x5d49e9[_0x3abd42],_0x5368('0x148')));return{'code':0xc8,'result':_0x5368('0x148')};}else{logger[_0x5368('0x2f')](util[_0x5368('0x59')](_0x5368('0x147'),_0x5d49e9[_0x3abd42],_0x5368('0x141')));this[_0x5368('0xf')]['noop'](util[_0x5368('0x59')](_0x5368('0x147'),_0x5d49e9[_0x3abd42],'false'));}}return{'code':0xc8,'result':_0x5368('0x141')};};AGIVertices[_0x5368('0x12')][_0x5368('0x149')]=function(_0x521db6){logger[_0x5368('0x2f')](util[_0x5368('0x59')]('Enter\x20in\x20HANGUP\x20(%s)\x20block',_0x521db6['label']));return this[_0x5368('0xf')][_0x5368('0x149')]();};AGIVertices[_0x5368('0x12')][_0x5368('0x14a')]=function(_0x4808a7){logger['info'](util[_0x5368('0x59')](_0x5368('0x14b'),_0x4808a7[_0x5368('0x3a')]));if(!this[_0x5368('0xab')](_0x4808a7[_0x5368('0x7e')])){return this['channel'][_0x5368('0xae')]('no\x20key\x20configured');}var _0x3fb75d='wav';var _0x4f7d0c=util['format'](_0x5368('0x12e'),FILES_PATH,rs[_0x5368('0x118')](0x4));var _0x4d8785=util['format'](_0x5368('0xa4'),_0x4f7d0c,_0x3fb75d);var _0x520d4b=!![];if(_0x4808a7[_0x5368('0x12f')]===_0x5368('0x136')){_0x520d4b=![];}var _0xa1f97b=this[_0x5368('0xf')][_0x5368('0x130')](_0x4f7d0c,_0x3fb75d,_0x4808a7['intKey'],_0x4808a7[_0x5368('0x69')],undefined,_0x520d4b);if(_0xa1f97b[_0x5368('0xb2')]!==-0x1){this[_0x5368('0xf')]['noop'](util[_0x5368('0x59')]('ispeech\x20%s\x20file\x20created',_0x4d8785));var _0x4de0f5=this[_0x5368('0x88')][_0x5368('0x71')](this,_0x4808a7,_0x4d8785);if(_0x4de0f5){for(var _0x234409 in _0x4de0f5){if(_0x4de0f5[_0x5368('0x9b')](_0x234409)){this[_0x5368('0xf')]['setVariable'](util[_0x5368('0x59')](_0x5368('0x14c'),_0x234409[_0x5368('0x6c')]()),_0x4de0f5[_0x234409]);}}return this[_0x5368('0xf')]['noop'](util[_0x5368('0x59')]('IspeechASR\x20Result\x20%s',JSON['stringify'](_0x4de0f5)));}}return _0xa1f97b;};AGIVertices['prototype'][_0x5368('0x14d')]=function(_0x556266){logger['info'](util['format'](_0x5368('0x14e'),_0x556266[_0x5368('0x3a')]));if(!this[_0x5368('0xab')](_0x556266['key'])){return this[_0x5368('0xf')]['noop'](_0x5368('0xe5'));}if(!this[_0x5368('0xab')](_0x556266[_0x5368('0x62')])){return this['channel'][_0x5368('0xae')](_0x5368('0xac'));}this['channel'][_0x5368('0xae')](util[_0x5368('0x59')](_0x5368('0x14f'),_0x556266[_0x5368('0x62')]));var _0x1a5b5f=this[_0x5368('0x85')][_0x5368('0x71')](this,_0x556266);if(_0x1a5b5f){this[_0x5368('0xf')][_0x5368('0xae')](util['format']('ispeech\x20%s\x20file\x20created',_0x1a5b5f));var _0x49cfa4=this[_0x5368('0xf')][_0x5368('0x125')](_0x1a5b5f,_0x556266['intKey']);try{fs[_0x5368('0xff')](_0x1a5b5f+'.wav');}catch(_0x47d45a){logger[_0x5368('0x2d')](_0x47d45a);}return _0x49cfa4;}return this[_0x5368('0xf')][_0x5368('0x2d')](_0x556266,_0x5368('0x150'));};AGIVertices[_0x5368('0x12')]['login']=function(_0xd2b6bf){logger['info'](util[_0x5368('0x59')](_0x5368('0x151'),_0xd2b6bf[_0x5368('0x3a')]));if(!this['isConfigured'](_0xd2b6bf[_0x5368('0x152')])){return this[_0x5368('0xf')]['error'](_0xd2b6bf,_0x5368('0x153'));}logger['info'](util[_0x5368('0x59')](_0x5368('0x154'),this['channel']['callerid'],_0xd2b6bf['findBy']));var _0x488470=this['agentLogin'][_0x5368('0x71')](this,_0xd2b6bf['findBy']);if(_0x488470){logger[_0x5368('0x2f')](util[_0x5368('0x59')](_0x5368('0x155'),this[_0x5368('0xf')][_0x5368('0x3c')],_0xd2b6bf['findBy']));this[_0x5368('0xf')][_0x5368('0xae')](util[_0x5368('0x59')](_0x5368('0x155'),this[_0x5368('0xf')][_0x5368('0x3c')],_0xd2b6bf[_0x5368('0x152')]));return{'code':0xc8,'result':_0x5368('0x156')};}else{logger['info'](util[_0x5368('0x59')](_0x5368('0x157'),this[_0x5368('0xf')][_0x5368('0x3c')],_0xd2b6bf[_0x5368('0x152')]));this[_0x5368('0xf')][_0x5368('0xae')](util[_0x5368('0x59')]('AGENT\x20%s\x20NOT\x20FOUND\x20BY',this['channel'][_0x5368('0x3c')],_0xd2b6bf['findBy']));return{'code':0xc8,'result':_0x5368('0x158')};}};AGIVertices[_0x5368('0x12')]['logout']=function(_0x371452){logger['info'](util[_0x5368('0x59')](_0x5368('0x159'),_0x371452['label']));if(!this[_0x5368('0xab')](_0x371452[_0x5368('0x152')])){return this[_0x5368('0xf')]['error'](_0x371452,_0x5368('0x153'));}logger[_0x5368('0x2f')](util[_0x5368('0x59')](_0x5368('0x154'),this['channel'][_0x5368('0x3c')],_0x371452[_0x5368('0x152')]));var _0x41477b=this[_0x5368('0x56')]['sync'](this,_0x371452[_0x5368('0x152')]);if(_0x41477b){logger[_0x5368('0x2f')](util[_0x5368('0x59')](_0x5368('0x155'),this[_0x5368('0xf')]['callerid'],_0x371452[_0x5368('0x152')]));this[_0x5368('0xf')][_0x5368('0xae')](util[_0x5368('0x59')](_0x5368('0x155'),this[_0x5368('0xf')]['callerid'],_0x371452['findBy']));return{'code':0xc8,'result':_0x5368('0x156')};}else{logger['info'](util[_0x5368('0x59')](_0x5368('0x157'),this[_0x5368('0xf')]['callerid'],_0x371452['findBy']));this[_0x5368('0xf')][_0x5368('0xae')](util[_0x5368('0x59')](_0x5368('0x157'),this[_0x5368('0xf')][_0x5368('0x3c')],_0x371452[_0x5368('0x152')]));return{'code':0xc8,'result':_0x5368('0x158')};}};AGIVertices[_0x5368('0x12')][_0x5368('0x15a')]=function(_0x403175){logger[_0x5368('0x2f')](util[_0x5368('0x59')](_0x5368('0x15b'),_0x403175[_0x5368('0x3a')]));if(!this[_0x5368('0xab')](_0x403175[_0x5368('0x15c')])){return this[_0x5368('0xf')][_0x5368('0x2d')](_0x403175,_0x5368('0x15d'));}this['channel']['noop'](util['format'](_0x5368('0x15e'),_0x403175[_0x5368('0x15c')]));var _0x19695f=eval(_0x403175[_0x5368('0x15c')]);if(!this['isConfigured'](_0x403175[_0x5368('0xd6')])){return this[_0x5368('0xf')][_0x5368('0xae')](_0x5368('0xd7'));}var _0x4db42c=this[_0x5368('0x13')]['sync'](this,_0x403175['variable_id']);if(!_0x4db42c){return this[_0x5368('0xf')][_0x5368('0x2d')](_0x403175,_0x5368('0xd8'));}if(_[_0x5368('0x15f')](_0x19695f)){var _0x573e4f=this;_0x19695f[_0x5368('0xda')](function(_0x15e216,_0x2b4e89){_0x573e4f[_0x5368('0xf')][_0x5368('0xa3')](util[_0x5368('0x59')](_0x5368('0x160'),_0x4db42c,_0x2b4e89),_0x15e216);});return this[_0x5368('0xf')]['noop'](util['format'](_0x5368('0x161'),_0x4db42c));}else{return this[_0x5368('0xf')][_0x5368('0xa3')](_0x4db42c,_0x19695f);}};AGIVertices[_0x5368('0x12')][_0x5368('0xd')]=function(_0x3e1661){logger[_0x5368('0x2f')](util[_0x5368('0x59')](_0x5368('0x162'),_0x3e1661['label']));if(_0x3e1661[_0x5368('0x10f')]===0x0){return this['maxRetry'](_0x3e1661);}_0x3e1661[_0x5368('0x10f')]-=0x1;if(!this[_0x5368('0xab')](_0x3e1661[_0x5368('0x110')])){return this[_0x5368('0xf')][_0x5368('0x2d')](_0x3e1661,'no\x20file\x20audio\x20selected');}var _0xe04abc=this['getSound'][_0x5368('0x71')](this,_0x3e1661[_0x5368('0x110')]);if(!_0xe04abc){return this['channel'][_0x5368('0x2d')](_0x3e1661,_0x5368('0x111'));}var _0x107153=this['channel'][_0x5368('0x112')](_0xe04abc,_0x3e1661[_0x5368('0x113')],_0x3e1661[_0x5368('0x163')]);var _0x85e78d=_0x107153[_0x5368('0xb2')];if(_0x107153[_0x5368('0xb2')]===-0x1){this[_0x5368('0x38')]['sync'](this,_0x3e1661,'-1');return _0x107153;}else if(_0x107153[_0x5368('0xa8')]===_0x5368('0x69')){_0x107153[_0x5368('0xb2')]=_0x107153['result'][_0x5368('0x9f')]>0x0?_0x107153[_0x5368('0xb2')]:'t';}else if(_[_0x5368('0x46')](_0x107153[_0x5368('0xb2')])){_0x107153[_0x5368('0xb2')]='#';_0x85e78d='#';}if(!this[_0x5368('0xab')](_0x3e1661[_0x5368('0xd6')])){this['channel'][_0x5368('0xae')](_0x5368('0xd7'));}else{var _0x95f32f=this['getVariable'][_0x5368('0x71')](this,_0x3e1661[_0x5368('0xd6')]);if(!_0x95f32f){return this[_0x5368('0xf')][_0x5368('0x2d')](_0x3e1661,_0x5368('0xd8'));}this[_0x5368('0xf')][_0x5368('0xa3')](_0x95f32f,_0x85e78d);}this[_0x5368('0x38')][_0x5368('0x71')](this,_0x3e1661,_0x85e78d);return _0x107153;};AGIVertices[_0x5368('0x12')]['noop']=function(_0x4acf05){logger['info'](util[_0x5368('0x59')]('Enter\x20in\x20NOOP\x20(%s)\x20block',_0x4acf05[_0x5368('0x3a')]));return this[_0x5368('0xf')][_0x5368('0xae')](_0x4acf05[_0x5368('0x164')]||_0x4acf05[_0x5368('0x3a')]);};AGIVertices[_0x5368('0x12')]['pause']=function(_0x23ff7e){logger['info'](util[_0x5368('0x59')](_0x5368('0x165'),_0x23ff7e[_0x5368('0x3a')]));if(!this[_0x5368('0xab')](_0x23ff7e[_0x5368('0x152')])){return this[_0x5368('0xf')]['error'](_0x23ff7e,_0x5368('0x153'));}logger[_0x5368('0x2f')](util[_0x5368('0x59')](_0x5368('0x154'),this['channel']['callerid'],_0x23ff7e[_0x5368('0x152')]));var _0x33a274=this[_0x5368('0x51')][_0x5368('0x71')](this,_0x23ff7e[_0x5368('0x166')]);var _0xf09bcf=this['agentPause'][_0x5368('0x71')](this,_0x23ff7e[_0x5368('0x152')],_0x33a274);if(_0xf09bcf){logger['info'](util[_0x5368('0x59')](_0x5368('0x155'),this['channel']['callerid'],_0x23ff7e[_0x5368('0x152')]));this[_0x5368('0xf')][_0x5368('0xae')](util['format'](_0x5368('0x155'),this['channel'][_0x5368('0x3c')],_0x23ff7e[_0x5368('0x152')]));return{'code':0xc8,'result':_0x5368('0x156')};}else{logger[_0x5368('0x2f')](util[_0x5368('0x59')](_0x5368('0x157'),this[_0x5368('0xf')][_0x5368('0x3c')],_0x23ff7e['findBy']));this[_0x5368('0xf')]['noop'](util[_0x5368('0x59')](_0x5368('0x155'),this['channel'][_0x5368('0x3c')],_0x23ff7e['findBy']));return{'code':0xc8,'result':_0x5368('0x158')};}};AGIVertices[_0x5368('0x12')][_0x5368('0x167')]=function(_0x3b0bb5){logger[_0x5368('0x2f')](util[_0x5368('0x59')](_0x5368('0x168'),_0x3b0bb5['label']));if(!this['isConfigured'](_0x3b0bb5[_0x5368('0x110')])){return this['channel'][_0x5368('0x2d')](_0x3b0bb5,'no\x20file\x20audio\x20selected');}var _0x3a0735=this['getSound'][_0x5368('0x71')](this,_0x3b0bb5['file_id']);if(!_0x3a0735){return this[_0x5368('0xf')][_0x5368('0x2d')](_0x3b0bb5,'no\x20file\x20audio\x20found');}var _0x47b350=this[_0x5368('0xf')][_0x5368('0x5d')]('PLAYBACK',[_0x3a0735,_0x3b0bb5['opts']]);if(_0x47b350['result']===-0x1){return _0x47b350;}return this[_0x5368('0xf')][_0x5368('0xae')](util[_0x5368('0x59')](_0x5368('0xc5'),_0x5368('0x169'),_0x3a0735));};AGIVertices[_0x5368('0x12')][_0x5368('0x16a')]=function(_0x49710c){logger[_0x5368('0x2f')](util['format'](_0x5368('0x16b'),_0x49710c[_0x5368('0x3a')]));if(!this[_0x5368('0xab')](_0x49710c[_0x5368('0x16c')])){return this[_0x5368('0xf')]['error'](_0x49710c,_0x5368('0x16d'));}var _0x554ece='';var _0x18e065=parseInt(_0x49710c[_0x5368('0x16c')],0xa);if(isNaN(_0x18e065)){_0x554ece=_0x49710c[_0x5368('0x16c')];}else{_0x554ece=this[_0x5368('0x16')][_0x5368('0x71')](this,_0x49710c[_0x5368('0x16c')]);if(!_0x554ece){return this[_0x5368('0xf')][_0x5368('0x2d')](_0x49710c,_0x5368('0x16e'));}}var _0x12f783='';if(this[_0x5368('0xab')](_0x49710c[_0x5368('0x110')])){var _0x1f59a5=this['getSound'][_0x5368('0x71')](this,_0x49710c[_0x5368('0x110')]);if(_0x1f59a5){_0x12f783=_0x1f59a5;}}this[_0x5368('0x38')][_0x5368('0x71')](this,_0x49710c,_0x554ece);if(_0x49710c[_0x5368('0x10b')][_0x5368('0x16f')]('x')<0x0){_0x49710c[_0x5368('0x10b')]+='x';}if(_0x49710c[_0x5368('0x10b')][_0x5368('0x16f')]('X')<0x0){_0x49710c['opts']+='X';}this[_0x5368('0xf')][_0x5368('0xa3')](_0x5368('0x170'),_0x554ece?_0x554ece[_0x5368('0x171')]():'');var _0x354dcf=this[_0x5368('0xf')][_0x5368('0x5d')](_0x5368('0x172'),[_0x554ece,_0x49710c[_0x5368('0x10b')],_0x49710c[_0x5368('0x68')],_0x12f783,_0x49710c[_0x5368('0x69')],_0x49710c['agi'],_0x49710c[_0x5368('0x173')],_0x49710c[_0x5368('0x174')],'',_0x49710c[_0x5368('0x175')]]);if(_0x354dcf[_0x5368('0xb2')]===-0x1){return _0x354dcf;}return this[_0x5368('0xf')][_0x5368('0xae')](util[_0x5368('0x59')]('Executed\x20command\x20%s\x20%s',_0x5368('0x172'),_0x554ece));};AGIVertices[_0x5368('0x12')]['record']=function(_0x2bd076){logger[_0x5368('0x2f')](util['format'](_0x5368('0x176'),_0x2bd076['label']));var _0x4ec64a=_0x2bd076[_0x5368('0x177')]||_0x5368('0x12d');var _0x451c98=util[_0x5368('0x59')]('%s_%s',this[_0x5368('0xf')][_0x5368('0x39')],rs[_0x5368('0x118')](0x5));var _0x330dec=util[_0x5368('0x59')](_0x5368('0x178'),FILES_PATH,_0x451c98,_0x4ec64a);var _0x5a506d=util['format'](_0x5368('0x12e'),FILES_PATH,_0x451c98);this[_0x5368('0x3d')][_0x5368('0x71')](this,_0x2bd076,_0x451c98,_0x330dec);this['channel']['setVariable'](_0x5368('0x179'),_0x451c98);logger[_0x5368('0x2f')](_0x5368('0x17a'),_0x5a506d,_0x4ec64a,_0x2bd076[_0x5368('0x17b')],_0x2bd076[_0x5368('0x69')]);return this['channel'][_0x5368('0x130')](_0x5a506d,_0x4ec64a,_0x2bd076['escape_digits'],_0x2bd076[_0x5368('0x69')],undefined,!![]);};AGIVertices['prototype'][_0x5368('0x17c')]=function(_0x4eeb36){logger[_0x5368('0x2f')](util[_0x5368('0x59')](_0x5368('0x17d'),_0x4eeb36[_0x5368('0x3a')]));if(!this[_0x5368('0xab')](_0x4eeb36['url'])){return this[_0x5368('0xf')][_0x5368('0xae')](_0x5368('0x17e'));}var _0xd8540a=this['restAPI'][_0x5368('0x71')](this,_0x4eeb36);logger['info'](util[_0x5368('0x59')](_0x5368('0x17f'),util[_0x5368('0x180')](_0xd8540a,{'showHidden':![],'depth':null})));if(!this[_0x5368('0xab')](_0x4eeb36[_0x5368('0xd6')])){return this[_0x5368('0xf')][_0x5368('0xae')](_0x5368('0x181'));}var _0x1db020=this[_0x5368('0x13')]['sync'](this,_0x4eeb36[_0x5368('0xd6')]);if(!_0x1db020){return this[_0x5368('0xf')][_0x5368('0x2d')](_0x4eeb36,'no\x20variable\x20found');}this[_0x5368('0xf')][_0x5368('0xa3')](util[_0x5368('0x59')](_0x5368('0x182'),_0x1db020),_0xd8540a[_0x5368('0x78')]?_0xd8540a[_0x5368('0x78')]:'200');this['channel']['setVariable'](util[_0x5368('0x59')]('%s_STATUS_MESSAGE',_0x1db020),_0xd8540a[_0x5368('0x79')]?_0xd8540a[_0x5368('0x79')]:'OK');if(_0xd8540a[_0x5368('0x6d')]){try{this[_0x5368('0xa2')](_0xd8540a[_0x5368('0x6d')],_0x1db020);}catch(_0x3d7689){logger[_0x5368('0x2d')](util['format'](_0x5368('0x183'),_0x1db020));}}return this[_0x5368('0xf')][_0x5368('0xae')](util['format'](_0x5368('0x184'),_0x1db020));};AGIVertices[_0x5368('0x12')][_0x5368('0x185')]=function(_0x4030d4){logger[_0x5368('0x2f')](util[_0x5368('0x59')]('Enter\x20in\x20SAYDIGITS\x20(%s)\x20block',_0x4030d4['label']));return this[_0x5368('0xf')][_0x5368('0x186')](_0x4030d4[_0x5368('0x187')]['replace'](/\s+/g,''),_0x4030d4[_0x5368('0x17b')]);};AGIVertices['prototype']['saynumber']=function(_0xfbf8df){logger[_0x5368('0x2f')](util['format'](_0x5368('0x188'),_0xfbf8df['label']));return this[_0x5368('0xf')]['sayNumber'](_0xfbf8df[_0x5368('0x189')][_0x5368('0x5f')](/\s+/g,''),_0xfbf8df[_0x5368('0x17b')]);};AGIVertices[_0x5368('0x12')][_0x5368('0x18a')]=function(_0x214200){logger[_0x5368('0x2f')](util['format'](_0x5368('0x18b'),_0x214200[_0x5368('0x3a')]));return this[_0x5368('0xf')]['sayPhonetic'](_0x214200[_0x5368('0x62')],_0x214200[_0x5368('0x17b')]);};AGIVertices['prototype'][_0x5368('0x18c')]=function(_0x2761f4){logger['info'](util['format'](_0x5368('0x18d'),_0x2761f4[_0x5368('0x3a')]));if(!this['isConfigured'](_0x2761f4[_0x5368('0x18e')])){return this['channel'][_0x5368('0xae')](_0x5368('0x18f'));}var _0x1d44c4=this['getMailAccount'][_0x5368('0x71')](this,_0x2761f4[_0x5368('0x18e')]);if(!_0x1d44c4||!_0x1d44c4['Smtp']){return this[_0x5368('0xf')]['error'](_0x2761f4,'no\x20mail\x20account\x20found');}var _0x11be20={'from':util[_0x5368('0x59')](_0x5368('0x190'),_0x1d44c4['name'],_0x1d44c4[_0x5368('0x191')]||_0x1d44c4[_0x5368('0x192')][_0x5368('0x193')]),'to':_0x2761f4['to']||'','cc':_0x2761f4['cc']||'','bcc':_0x2761f4[_0x5368('0x194')]||'','subject':_0x2761f4['subject'],'html':_0x2761f4[_0x5368('0x62')],'text':_0x2761f4[_0x5368('0x62')]};if(this[_0x5368('0xab')](_0x2761f4[_0x5368('0x195')])){}logger[_0x5368('0xde')](_0x5368('0x196'),JSON[_0x5368('0x76')](_0x11be20));this[_0x5368('0x38')][_0x5368('0x71')](this,_0x2761f4,_0x2761f4[_0x5368('0x18e')]);this['channel'][_0x5368('0xae')](util[_0x5368('0x59')]('Trying\x20SendMail\x20with\x20account\x20%s',_0x1d44c4[_0x5368('0x15')]));this[_0x5368('0x27')][_0x5368('0x71')](this,_0x1d44c4['smtpOptions'],_0x11be20);return this['channel'][_0x5368('0xae')](_0x5368('0x197'));};AGIVertices[_0x5368('0x12')]['sendFax']=function(_0x58fba2){logger[_0x5368('0x2f')](util[_0x5368('0x59')]('Enter\x20in\x20SENDFAX\x20(%s)\x20block',_0x58fba2[_0x5368('0x3a')]));return this['channel'][_0x5368('0xae')](_0x5368('0x198'));};AGIVertices[_0x5368('0x12')][_0x5368('0x199')]=function(_0xd6b618){logger[_0x5368('0x2f')](util[_0x5368('0x59')](_0x5368('0x19a'),_0xd6b618['label']));if(!this[_0x5368('0xab')](_0xd6b618['sms_account_id'])){return this[_0x5368('0xf')][_0x5368('0xae')](_0x5368('0x19b'));}var _0x17c060=this[_0x5368('0x35')][_0x5368('0x71')](this,_0xd6b618['sms_account_id']);if(!_0x17c060){return this[_0x5368('0xf')][_0x5368('0x2d')](_0xd6b618,_0x5368('0x19c'));}var _0x48a79c={'body':_0xd6b618[_0x5368('0x19d')],'phone':_0xd6b618['to']||'','SmsAccountId':_0x17c060['id']};logger[_0x5368('0xde')](_0x5368('0x19e'),JSON['stringify'](_0x48a79c));this['createSquareDetailsReport']['sync'](this,_0xd6b618,_0xd6b618['sms_account_id']);this['channel'][_0x5368('0xae')](util[_0x5368('0x59')](_0x5368('0x19f'),_0x17c060['name']));this[_0x5368('0x37')]['sync'](this,_0x48a79c);return this[_0x5368('0xf')][_0x5368('0xae')](_0x5368('0x1a0'));};AGIVertices['prototype']['set']=function(_0x500769){logger[_0x5368('0x2f')](util[_0x5368('0x59')](_0x5368('0x1a1'),_0x500769[_0x5368('0x3a')]));if(!this[_0x5368('0xab')](_0x500769[_0x5368('0xd6')])){return this[_0x5368('0xf')][_0x5368('0x2d')](_0x500769,_0x5368('0x1a2'));}var _0x48d159=this[_0x5368('0x13')][_0x5368('0x71')](this,_0x500769[_0x5368('0xd6')]);if(!_0x48d159){return this[_0x5368('0xf')][_0x5368('0x2d')](_0x500769,_0x5368('0xd8'));}return this['channel']['setVariable'](_0x48d159,_0x500769[_0x5368('0x1a3')]);};AGIVertices['prototype']['start']=function(_0x55ebc4){logger[_0x5368('0x2f')](util['format']('Enter\x20in\x20START\x20(%s)\x20block',_0x55ebc4[_0x5368('0x3a')]));this[_0x5368('0xf')][_0x5368('0xae')]('START\x20CALLY\x20SQUARE');var _0x34a155=this[_0x5368('0xf')][_0x5368('0x13')](_0x5368('0x1a4'));if(!_[_0x5368('0x46')](_0x34a155['extra'])){this[_0x5368('0xf')]['uniqueid']=_0x34a155[_0x5368('0xa8')];}if(_0x55ebc4[_0x5368('0xbb')]===_0x5368('0x1a5')){this['channel']['noop'](_0x5368('0x1a6'));return this[_0x5368('0xf')][_0x5368('0xbb')]();}return this[_0x5368('0xf')]['noop'](_0x5368('0x1a7'));};AGIVertices['prototype'][_0x5368('0x1a8')]=function(_0x56fb0d){logger[_0x5368('0x2f')](util['format']('Enter\x20in\x20SUBPROJECT\x20(%s)\x20block',_0x56fb0d[_0x5368('0x3a')]));if(!this['isConfigured'](_0x56fb0d['project_id'])){return this[_0x5368('0xf')][_0x5368('0x2d')](_0x56fb0d,'no\x20subproject\x20selected');}var _0xa07511=this[_0x5368('0x1a')][_0x5368('0x71')](this,_0x56fb0d['project_id']);if(!this[_0x5368('0xab')](_0xa07511)){return this[_0x5368('0xf')][_0x5368('0x2d')](_0x56fb0d,util[_0x5368('0x59')]('no\x20subproject\x20found\x20with\x20id\x20%d',_0x56fb0d[_0x5368('0x1a9')]));}if(_0xa07511===this[_0x5368('0xf')][_0x5368('0x3b')]){return this[_0x5368('0xf')][_0x5368('0x2d')](_0x56fb0d,'project\x20in\x20subproject\x20must\x20be\x20different\x20from\x20the\x20called\x20project');}this['createSquareDetailsReport'][_0x5368('0x71')](this,_0x56fb0d,_0xa07511);var _0x13230e=this[_0x5368('0xf')][_0x5368('0x5d')](_0x5368('0x1aa'),util[_0x5368('0x59')](_0x5368('0x1ab'),config[_0x5368('0x8')][_0x5368('0x1ac')]||'127.0.0.1',_0xa07511,this['channel'][_0x5368('0x3b')]));if(_0x13230e['result']===-0x1){return _0x13230e;}return this[_0x5368('0xf')][_0x5368('0xae')](util[_0x5368('0x59')](_0x5368('0xc5'),_0x5368('0x1aa'),_0xa07511));};AGIVertices[_0x5368('0x12')][_0x5368('0x1ad')]=function(_0x1ec487){logger[_0x5368('0x2f')](util['format'](_0x5368('0x1ae'),_0x1ec487[_0x5368('0x3a')]));var _0x173525=this[_0x5368('0x5c')]['sync'](this,_0x1ec487['command']);this['createSquareDetailsReport'][_0x5368('0x71')](this,_0x1ec487,_0x1ec487[_0x5368('0xb9')]);if(this[_0x5368('0xab')](_0x1ec487[_0x5368('0xd6')])){var _0x2eb8ff=this[_0x5368('0x13')][_0x5368('0x71')](this,_0x1ec487[_0x5368('0xd6')]);if(_0x2eb8ff){this[_0x5368('0xf')][_0x5368('0xa3')](_0x2eb8ff,_0x173525);return this[_0x5368('0xf')]['noop'](util[_0x5368('0x59')]('sh\x20command:\x20%s\x20result\x20on\x20variable:\x20%s',_0x1ec487['command'],_0x2eb8ff));}}return this[_0x5368('0xf')][_0x5368('0xae')](util[_0x5368('0x59')](_0x5368('0x1af'),_0x1ec487['command']));};AGIVertices[_0x5368('0x12')][_0x5368('0x1b0')]=function(_0x2869bb){logger[_0x5368('0x2f')](util[_0x5368('0x59')](_0x5368('0x1b1'),_0x2869bb[_0x5368('0x3a')]));_0x2869bb[_0x5368('0x62')]=_0x2869bb[_0x5368('0x62')]['replace'](/(\r\n|\n|\r)/gm,'\x20');if(!this[_0x5368('0xab')](_0x2869bb[_0x5368('0x1b2')])){return this[_0x5368('0xf')][_0x5368('0xae')](_0x5368('0x1b3'));}if(!this[_0x5368('0xab')](_0x2869bb[_0x5368('0x62')])){return this[_0x5368('0xf')]['noop']('no\x20text\x20configured');}this[_0x5368('0xf')][_0x5368('0xae')](util[_0x5368('0x59')](_0x5368('0x1b4'),_0x2869bb[_0x5368('0x62')]));var _0x4b17fb=this[_0x5368('0x60')]['sync'](this,_0x2869bb);if(_0x4b17fb){this['channel']['noop'](util[_0x5368('0x59')](_0x5368('0x1b5'),_0x4b17fb));var _0x536990=this[_0x5368('0xf')]['streamFile'](_0x4b17fb);try{fs[_0x5368('0xff')](_0x4b17fb+'.wav');}catch(_0x2f0916){logger['error'](_0x2f0916);}return _0x536990;}return this['channel'][_0x5368('0x2d')](_0x2869bb,_0x5368('0x1b6'));};AGIVertices[_0x5368('0x12')]['tts']=function(_0x4ba0c7){logger['info'](util[_0x5368('0x59')](_0x5368('0x1b7'),_0x4ba0c7[_0x5368('0x3a')]));_0x4ba0c7['text']=_0x4ba0c7[_0x5368('0x62')][_0x5368('0x5f')](/(\r\n|\n|\r)/gm,'\x20');if(!this[_0x5368('0xab')](_0x4ba0c7[_0x5368('0x62')])){return this[_0x5368('0xf')][_0x5368('0xae')]('no\x20text\x20configured');}this['channel'][_0x5368('0xae')](util['format'](_0x5368('0x1b8'),_0x4ba0c7[_0x5368('0x62')]));var _0x3c90d6=this[_0x5368('0x66')][_0x5368('0x71')](this,_0x4ba0c7);if(_0x3c90d6){this[_0x5368('0xf')][_0x5368('0xae')](util['format'](_0x5368('0x1b9'),_0x3c90d6));var _0x507dda=this[_0x5368('0xf')][_0x5368('0x125')](_0x3c90d6);try{fs[_0x5368('0xff')](_0x3c90d6+_0x5368('0x100'));}catch(_0x2ee236){logger[_0x5368('0x2d')](_0x2ee236);}return _0x507dda;}return this[_0x5368('0xf')][_0x5368('0x2d')](_0x4ba0c7,_0x5368('0x1ba'));};AGIVertices['prototype'][_0x5368('0x1bb')]=function(_0x5ef8a0){logger[_0x5368('0x2f')](util[_0x5368('0x59')](_0x5368('0x1bc'),_0x5ef8a0['label']));if(!this[_0x5368('0xab')](_0x5ef8a0['findBy'])){return this['channel'][_0x5368('0x2d')](_0x5ef8a0,_0x5368('0x153'));}logger[_0x5368('0x2f')](util[_0x5368('0x59')](_0x5368('0x154'),this[_0x5368('0xf')][_0x5368('0x3c')],_0x5ef8a0['findBy']));var _0x5c37c1=this[_0x5368('0x55')]['sync'](this,_0x5ef8a0[_0x5368('0x152')]);if(_0x5c37c1){logger[_0x5368('0x2f')](util['format']('AGENT\x20%s\x20FOUND\x20BY',this[_0x5368('0xf')][_0x5368('0x3c')],_0x5ef8a0[_0x5368('0x152')]));this[_0x5368('0xf')][_0x5368('0xae')](util[_0x5368('0x59')](_0x5368('0x155'),this[_0x5368('0xf')][_0x5368('0x3c')],_0x5ef8a0[_0x5368('0x152')]));return{'code':0xc8,'result':_0x5368('0x156')};}else{logger['info'](util[_0x5368('0x59')](_0x5368('0x157'),this[_0x5368('0xf')]['callerid'],_0x5ef8a0[_0x5368('0x152')]));this['channel'][_0x5368('0xae')](util[_0x5368('0x59')](_0x5368('0x157'),this[_0x5368('0xf')][_0x5368('0x3c')],_0x5ef8a0[_0x5368('0x152')]));return{'code':0xc8,'result':_0x5368('0x158')};}};AGIVertices[_0x5368('0x12')][_0x5368('0x1bd')]=function(_0x2fabbc){logger[_0x5368('0x2f')](util['format']('Enter\x20in\x20VOICEMAIL\x20(%s)\x20block',_0x2fabbc[_0x5368('0x3a')]));var _0x219e77=this['channel'][_0x5368('0x5d')]('VOICEMAIL',[_0x2fabbc[_0x5368('0x1be')],_0x2fabbc[_0x5368('0x7c')]]);if(_0x219e77[_0x5368('0xb2')]===-0x1){return _0x219e77;}return this[_0x5368('0xf')]['noop'](util[_0x5368('0x59')](_0x5368('0xc5'),'VOICEMAIL',_0x2fabbc['mailbox']));};AGIVertices[_0x5368('0x12')][_0x5368('0x1bf')]=function(_0x4b0729){logger[_0x5368('0x2f')](util['format'](_0x5368('0x1c0'),_0x4b0729['label']));if(!this[_0x5368('0xab')](_0x4b0729['variable_id'])){return this['channel'][_0x5368('0x2d')](_0x4b0729,_0x5368('0x1a2'));}var _0x433413=this[_0x5368('0x13')][_0x5368('0x71')](this,_0x4b0729[_0x5368('0xd6')]);if(!_0x433413){return this['channel'][_0x5368('0x2d')](_0x4b0729,_0x5368('0xd8'));}var _0x708d77=this['channel']['getVariable'](_0x433413);return{'code':0xc8,'result':_0x708d77[_0x5368('0xa8')]?_0x708d77[_0x5368('0xa8')]:'-'};};String[_0x5368('0x12')][_0x5368('0xa6')]=function(_0x17e661,_0x396e88){return this[_0x5368('0xa5')](_0x17e661)[_0x5368('0x1c1')](_0x396e88);};module[_0x5368('0x1c2')]=AGIVertices; \ No newline at end of file diff --git a/server/services/ami/acw/index.js b/server/services/ami/acw/index.js index bbb5dab..01e1f23 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 _0xb9b2=['startAcw','ACW','mandatoryDisposition','name','mandatoryDispositionPause','QueuePause','agents','voicePause','[%s][START][AGENT:%s][QUEUE:%s]','attended','destlinkedid','savePause','available','[%s][TIMER:%s][AGENT:%s][QUEUE:%s]','acwTimeout','stopAcw','format','YYYY-MM-DD\x20HH:mm:ss','finally','[ACW][START]\x20%s','timer','queue','[%s][TIMER][STOP][AGENT:%s]','getAgent','pauseType','[%s][UPDATE][ACWTIME:%s]','[ACW][STOP]\x20Interface\x20%s\x20doesn\x27t\x20have\x20timer','[ACW][TIMERS]','stringify','[ACW][STOP]\x20%s','message','syncAgentConnect','interface','[ACW][syncAgentConnect]\x20%s','[ACW][syncAgentConnectPreview]\x20%s','syncHangupRequest','linkedid','isUndefined','[%s][HANGUP:LINKEDID]','[ACW][syncHangupRequest]\x20%s','[%s][HANGUPATTENDEDTRANSFER:UNIQUEID]','[%s][HANGUPATTENDEDTRANSFER:LINKEDID]','syncAttendedTransfer','isNil','transfereeuniqueid','secondtransfereruniqueid','transfertargetuniqueid','origtransfereruniqueid','deleteChannelAfterTimeout','[ACW][syncAttendedTransfer]\x20%s','[%s][BLINDTRANSFER:UNIQUEID]','transfererlinkedid','[%s][BLINDTRANSFER:LINKEDID]','autopause','all','[%s][AUTOPAUSE][AGENT:%s][QUEUE:%]','Auto-Pause','[ACW][syncAgentRingNoAnswer]\x20%s','exports','lodash','../ami','../../../config/logger','acw','../rpc/user','../rpc/voiceAgentReport','voiceQueues','timers','channels','agentconnect','bind','hanguprequest','hangup','syncHangup','syncAgentRingNoAnswer','attendedtransfer','syncBlindTransfer','custom:agentConnectPreview','syncAgentConnectPreview','milliseconds','diff','prototype','updateAcw','lastPauseAt','update','uniqueid','then','info','catch','error','[%s][UPDATE][ERRORS:%s]'];(function(_0x422758,_0x4941f4){var _0x3de4f6=function(_0x205f51){while(--_0x205f51){_0x422758['push'](_0x422758['shift']());}};_0x3de4f6(++_0x4941f4);}(_0xb9b2,0x149));var _0x2b9b=function(_0x54d4a8,_0x585a59){_0x54d4a8=_0x54d4a8-0x0;var _0x3b321b=_0xb9b2[_0x54d4a8];return _0x3b321b;};'use strict';var _=require(_0x2b9b('0x0'));var moment=require('moment');var ami=require(_0x2b9b('0x1'));var logger=require(_0x2b9b('0x2'))(_0x2b9b('0x3'));var RpcUser=require(_0x2b9b('0x4'));var RpcVoiceAgentReport=require(_0x2b9b('0x5'));function Acw(_0x242814){this[_0x2b9b('0x6')]=_0x242814['voiceQueues'];this['agents']=_0x242814['agents'];this['timers']=_0x242814[_0x2b9b('0x7')];this[_0x2b9b('0x8')]={};ami['on'](_0x2b9b('0x9'),this['syncAgentConnect'][_0x2b9b('0xa')](this));ami['on'](_0x2b9b('0xb'),this['syncHangupRequest'][_0x2b9b('0xa')](this));ami['on'](_0x2b9b('0xc'),this[_0x2b9b('0xd')]['bind'](this));ami['on']('agentringnoanswer',this[_0x2b9b('0xe')][_0x2b9b('0xa')](this));ami['on'](_0x2b9b('0xf'),this['syncAttendedTransfer'][_0x2b9b('0xa')](this));ami['on']('blindtransfer',this[_0x2b9b('0x10')][_0x2b9b('0xa')](this));ami['on'](_0x2b9b('0x11'),this[_0x2b9b('0x12')][_0x2b9b('0xa')](this));}function getDiff(_0x28efcc){var _0xcaf55c=moment()[_0x2b9b('0x13')](0x0);var _0x5dd3f6=moment(_0x28efcc)['milliseconds'](0x0);return _0xcaf55c[_0x2b9b('0x14')](_0x5dd3f6,'seconds');}Acw[_0x2b9b('0x15')][_0x2b9b('0x16')]=function(_0x435d33,_0x124b60){var _0x1a73d1=this;var _0x361925=getDiff(_0x1a73d1[_0x2b9b('0x7')][_0x435d33][_0x2b9b('0x17')]);clearTimeout(_0x1a73d1[_0x2b9b('0x7')][_0x435d33]['timer']);_0x1a73d1[_0x2b9b('0x7')][_0x435d33]['timer']=![];return RpcVoiceAgentReport[_0x2b9b('0x18')]({'acwtime':_0x361925},_0x1a73d1[_0x2b9b('0x7')][_0x435d33][_0x2b9b('0x19')],_0x435d33)[_0x2b9b('0x1a')](function(_0x1fe253){logger[_0x2b9b('0x1b')]('[%s][UPDATE][ACWTIME:%s]',_0x124b60,_0x361925,_0x1fe253);})[_0x2b9b('0x1c')](function(_0x1dbbdc){logger[_0x2b9b('0x1d')](_0x2b9b('0x1e'),_0x124b60,_0x1dbbdc);})['finally'](function(){delete _0x1a73d1[_0x2b9b('0x7')][_0x435d33];});};Acw[_0x2b9b('0x15')][_0x2b9b('0x1f')]=function(_0x2c879d){try{var _0x384c43=this;var _0x1ea0a4=this[_0x2b9b('0x8')][_0x2c879d]['interface'];var _0x59b021=this[_0x2b9b('0x8')][_0x2c879d]['queue'];var _0x5bb34c=this[_0x2b9b('0x6')][_0x59b021];var _0x22ec82=![];var _0x521768=_0x2b9b('0x20');if(_0x5bb34c[_0x2b9b('0x21')]&&_0x5bb34c['mandatoryDispositionPause'][_0x2b9b('0x22')]){_0x22ec82=!![];_0x521768=_0x5bb34c[_0x2b9b('0x23')][_0x2b9b('0x22')];}return ami['Action']({'action':_0x2b9b('0x24'),'interface':_0x1ea0a4,'paused':!![],'reason':_0x521768})['then'](function(){if(_0x384c43[_0x2b9b('0x25')][_0x1ea0a4]){return RpcUser['getAgent'](_0x384c43[_0x2b9b('0x25')][_0x1ea0a4]['id'])[_0x2b9b('0x1a')](function(_0x1d95ab){if(!_0x1d95ab||_0x1d95ab[_0x2b9b('0x26')]){logger[_0x2b9b('0x1b')]('[%s][INPAUSE][AGENT:%s][QUEUE:%s]',_0x2c879d,_0x1ea0a4,_0x59b021);return;}logger[_0x2b9b('0x1b')](_0x2b9b('0x27'),_0x2c879d,_0x1ea0a4,_0x59b021);var _0x481af6=_0x384c43[_0x2b9b('0x8')][_0x2c879d][_0x2b9b('0x28')]&&_0x384c43[_0x2b9b('0x8')][_0x2c879d][_0x2b9b('0x29')]?_0x384c43[_0x2b9b('0x8')][_0x2c879d][_0x2b9b('0x29')]:_0x2c879d;return RpcUser[_0x2b9b('0x2a')](_0x384c43[_0x2b9b('0x25')][_0x1ea0a4],_0x521768,_0x481af6)['then'](function(_0x3402ba){_0x384c43[_0x2b9b('0x6')][_0x59b021][_0x2b9b('0x2b')]-=0x1;_0x384c43[_0x2b9b('0x6')][_0x59b021]['paused']+=0x1;return _0x3402ba;});})[_0x2b9b('0x1a')](function(_0x1a95a8){if(_0x22ec82||!_0x1a95a8){return;}_0x384c43[_0x2b9b('0x7')][_0x1ea0a4]={};logger['info'](_0x2b9b('0x2c'),_0x2c879d,_0x384c43[_0x2b9b('0x6')][_0x59b021][_0x2b9b('0x2d')],_0x1ea0a4,_0x59b021);_0x384c43['timers'][_0x1ea0a4]['timer']=setTimeout(_0x384c43[_0x2b9b('0x2e')]['bind'](_0x384c43,_0x1ea0a4),_0x384c43[_0x2b9b('0x6')][_0x59b021][_0x2b9b('0x2d')]*0x3e8);_0x384c43[_0x2b9b('0x7')][_0x1ea0a4][_0x2b9b('0x17')]=moment()[_0x2b9b('0x2f')](_0x2b9b('0x30'));_0x384c43[_0x2b9b('0x7')][_0x1ea0a4]['uniqueid']=_0x2c879d;_0x384c43[_0x2b9b('0x7')][_0x1ea0a4]['queue']=_0x59b021;_0x384c43['timers'][_0x1ea0a4][_0x2b9b('0x16')]=_0x384c43['updateAcw'][_0x2b9b('0xa')](_0x384c43,_0x1ea0a4,_0x2c879d);});}})[_0x2b9b('0x1c')](function(){logger[_0x2b9b('0x1d')](_0x2b9b('0x2c'),_0x2c879d,_0x384c43['voiceQueues'][_0x59b021]['acwTimeout'],_0x1ea0a4,_0x59b021);})[_0x2b9b('0x31')](function(){delete _0x384c43[_0x2b9b('0x8')][_0x2c879d];});}catch(_0x182956){logger[_0x2b9b('0x1d')](_0x2b9b('0x32'),_0x182956['message']);}};Acw[_0x2b9b('0x15')]['stopAcw']=function(_0x392565){try{var _0x3fdbe2=this;if(_0x3fdbe2[_0x2b9b('0x7')][_0x392565]){_0x3fdbe2[_0x2b9b('0x7')][_0x392565][_0x2b9b('0x33')]=![];var _0x3390a6=_0x3fdbe2['timers'][_0x392565][_0x2b9b('0x19')];var _0x5f41f4=_0x3fdbe2[_0x2b9b('0x7')][_0x392565][_0x2b9b('0x34')];var _0x1ffae2=_0x3fdbe2[_0x2b9b('0x6')][_0x5f41f4][_0x2b9b('0x2d')];logger[_0x2b9b('0x1b')](_0x2b9b('0x35'),_0x3390a6,_0x392565);RpcUser[_0x2b9b('0x36')](this[_0x2b9b('0x25')][_0x392565]['id'])[_0x2b9b('0x1a')](function(_0x216587){if(_0x216587[_0x2b9b('0x37')]==='ACW'){return RpcUser['saveUnpause'](_0x3fdbe2[_0x2b9b('0x25')][_0x392565]);}});RpcVoiceAgentReport[_0x2b9b('0x18')]({'acwtime':_0x1ffae2,'agentacw':!![]},_0x3390a6,_0x392565)[_0x2b9b('0x1a')](function(_0x2b6453){logger[_0x2b9b('0x1b')](_0x2b9b('0x38'),_0x3390a6,_0x1ffae2,_0x2b6453);})[_0x2b9b('0x1c')](function(_0x32063d){logger[_0x2b9b('0x1d')](_0x2b9b('0x1e'),_0x3390a6,_0x32063d);});}else{logger[_0x2b9b('0x1d')](_0x2b9b('0x39'),_0x392565);if(_0x3fdbe2[_0x2b9b('0x7')]){logger[_0x2b9b('0x1b')](_0x2b9b('0x3a'),JSON[_0x2b9b('0x3b')](_0x3fdbe2['timers']));}}}catch(_0x194579){logger['error'](_0x2b9b('0x3c'),_0x194579[_0x2b9b('0x3d')]);}};Acw[_0x2b9b('0x15')][_0x2b9b('0x3e')]=function(_0x5c5b30){try{if(this[_0x2b9b('0x6')][_0x5c5b30['queue']]&&(this[_0x2b9b('0x6')][_0x5c5b30['queue']][_0x2b9b('0x3')]||this['voiceQueues'][_0x5c5b30[_0x2b9b('0x34')]][_0x2b9b('0x21')])){if(this[_0x2b9b('0x25')][_0x5c5b30['interface']]){this[_0x2b9b('0x8')][_0x5c5b30[_0x2b9b('0x19')]]={'queue':_0x5c5b30['queue'],'interface':_0x5c5b30[_0x2b9b('0x3f')],'destlinkedid':_0x5c5b30[_0x2b9b('0x29')]};}}}catch(_0x19b611){logger['error'](_0x2b9b('0x40'),_0x19b611[_0x2b9b('0x3d')]);}};Acw[_0x2b9b('0x15')][_0x2b9b('0x12')]=function(_0x4e6781){try{if(this['voiceQueues'][_0x4e6781['queue']]&&(this['voiceQueues'][_0x4e6781['queue']][_0x2b9b('0x3')]||this[_0x2b9b('0x6')][_0x4e6781[_0x2b9b('0x34')]][_0x2b9b('0x21')])){if(this[_0x2b9b('0x25')][_0x4e6781['interface']]){this[_0x2b9b('0x8')][_0x4e6781[_0x2b9b('0x19')]]={'queue':_0x4e6781[_0x2b9b('0x34')],'interface':_0x4e6781[_0x2b9b('0x3f')]};}}}catch(_0x4cc584){logger[_0x2b9b('0x1d')](_0x2b9b('0x41'),_0x4cc584[_0x2b9b('0x3d')]);}};Acw['prototype'][_0x2b9b('0x42')]=function(_0x28c01a){try{if(this[_0x2b9b('0x8')][_0x28c01a['uniqueid']]&&_['isUndefined'](this[_0x2b9b('0x8')][_0x28c01a[_0x2b9b('0x19')]]['attended'])){logger[_0x2b9b('0x1b')]('[%s][HANGUP:UNIQUEID]',_0x28c01a['uniqueid']);this[_0x2b9b('0x1f')](_0x28c01a[_0x2b9b('0x19')]);}else if(this[_0x2b9b('0x8')][_0x28c01a[_0x2b9b('0x43')]]&&_[_0x2b9b('0x44')](this[_0x2b9b('0x8')][_0x28c01a['linkedid']][_0x2b9b('0x28')])){logger['info'](_0x2b9b('0x45'),_0x28c01a[_0x2b9b('0x43')]);this[_0x2b9b('0x1f')](_0x28c01a['linkedid']);}}catch(_0x3cd9f4){logger['error'](_0x2b9b('0x46'),_0x3cd9f4[_0x2b9b('0x3d')]);}};Acw[_0x2b9b('0x15')][_0x2b9b('0xd')]=function(_0x2ecd98){try{if(this['channels'][_0x2ecd98[_0x2b9b('0x19')]]&&this[_0x2b9b('0x8')][_0x2ecd98[_0x2b9b('0x19')]]['attended']){logger[_0x2b9b('0x1b')](_0x2b9b('0x47'),_0x2ecd98['uniqueid']);this['startAcw'](_0x2ecd98[_0x2b9b('0x19')]);}else if(this[_0x2b9b('0x8')][_0x2ecd98[_0x2b9b('0x43')]]&&this[_0x2b9b('0x8')][_0x2ecd98[_0x2b9b('0x43')]][_0x2b9b('0x28')]){logger[_0x2b9b('0x1b')](_0x2b9b('0x48'),_0x2ecd98[_0x2b9b('0x43')]);this[_0x2b9b('0x1f')](_0x2ecd98['linkedid']);}}catch(_0x3b5ee5){logger['error']('[ACW][syncHangup]\x20%s',_0x3b5ee5[_0x2b9b('0x3d')]);}};Acw[_0x2b9b('0x15')][_0x2b9b('0x49')]=function(_0x5b69ad){try{if(!_[_0x2b9b('0x4a')](this[_0x2b9b('0x8')][_0x5b69ad[_0x2b9b('0x4b')]])){this['startAcw'](_0x5b69ad['transfereeuniqueid']);if(this['channels'][_0x5b69ad[_0x2b9b('0x4c')]]){this[_0x2b9b('0x8')][_0x5b69ad[_0x2b9b('0x4c')]][_0x2b9b('0x28')]=!![];this[_0x2b9b('0x8')][_0x5b69ad[_0x2b9b('0x4d')]]=this['channels'][_0x5b69ad[_0x2b9b('0x4c')]];this['deleteChannelAfterTimeout'](_0x5b69ad[_0x2b9b('0x4c')]);}}else if(!_[_0x2b9b('0x4a')](this['channels'][_0x5b69ad[_0x2b9b('0x4d')]])){this[_0x2b9b('0x1f')](_0x5b69ad[_0x2b9b('0x4d')]);if(this[_0x2b9b('0x8')][_0x5b69ad[_0x2b9b('0x4e')]]){this['channels'][_0x5b69ad[_0x2b9b('0x4e')]][_0x2b9b('0x28')]=!![];this[_0x2b9b('0x8')][_0x5b69ad[_0x2b9b('0x4b')]]=this[_0x2b9b('0x8')][_0x5b69ad['origtransfereruniqueid']];this[_0x2b9b('0x4f')](_0x5b69ad[_0x2b9b('0x4e')]);}}}catch(_0x138e32){logger[_0x2b9b('0x1d')](_0x2b9b('0x50'),_0x138e32[_0x2b9b('0x3d')]);}};Acw[_0x2b9b('0x15')]['syncBlindTransfer']=function(_0x35e5fb){try{if(this[_0x2b9b('0x8')][_0x35e5fb['transfereruniqueid']]){logger[_0x2b9b('0x1b')](_0x2b9b('0x51'),JSON[_0x2b9b('0x3b')](_0x35e5fb['transfereruniqueid']));this[_0x2b9b('0x1f')](_0x35e5fb['transfereruniqueid']);}else if(this[_0x2b9b('0x8')][_0x35e5fb[_0x2b9b('0x52')]]){logger[_0x2b9b('0x1b')](_0x2b9b('0x53'),JSON[_0x2b9b('0x3b')](_0x35e5fb[_0x2b9b('0x52')]));this['startAcw'](_0x35e5fb['transfererlinkedid']);}}catch(_0x4a3e35){logger[_0x2b9b('0x1d')]('[ACW][syncBlindTransfer]\x20%s',_0x4a3e35['message']);}};Acw[_0x2b9b('0x15')][_0x2b9b('0xe')]=function(_0xfbc96b){try{if(this[_0x2b9b('0x6')][_0xfbc96b[_0x2b9b('0x34')]]&&this[_0x2b9b('0x6')][_0xfbc96b[_0x2b9b('0x34')]][_0x2b9b('0x54')]===_0x2b9b('0x55')){if(this[_0x2b9b('0x25')][_0xfbc96b[_0x2b9b('0x3f')]]){logger[_0x2b9b('0x1b')](_0x2b9b('0x56'),_0xfbc96b[_0x2b9b('0x19')],_0xfbc96b['interface'],_0xfbc96b[_0x2b9b('0x34')]);return RpcUser['savePause'](this['agents'][_0xfbc96b[_0x2b9b('0x3f')]],_0x2b9b('0x57'),_0xfbc96b[_0x2b9b('0x19')]);}}}catch(_0xf74844){logger[_0x2b9b('0x1d')](_0x2b9b('0x58'),_0xf74844[_0x2b9b('0x3d')]);}};Acw[_0x2b9b('0x15')][_0x2b9b('0x4f')]=function(_0x25b215,_0x123b06=0x2710){if(this[_0x2b9b('0x8')][_0x25b215]){setTimeout(()=>{delete this[_0x2b9b('0x8')][_0x25b215];},_0x123b06);}};module[_0x2b9b('0x59')]=Acw; \ No newline at end of file +var _0xf62b=['autopause','all','[%s][AUTOPAUSE][AGENT:%s][QUEUE:%]','Auto-Pause','[ACW][syncAgentRingNoAnswer]\x20%s','lodash','moment','../ami','../../../config/logger','acw','../rpc/user','../rpc/voiceAgentReport','voiceQueues','agents','timers','channels','agentconnect','syncAgentConnect','bind','hanguprequest','hangup','syncHangup','agentringnoanswer','syncAgentRingNoAnswer','syncAttendedTransfer','blindtransfer','syncBlindTransfer','custom:agentConnectPreview','syncAgentConnectPreview','milliseconds','diff','seconds','prototype','updateAcw','lastPauseAt','timer','uniqueid','then','info','[%s][UPDATE][ACWTIME:%s]','catch','finally','startAcw','interface','ACW','mandatoryDisposition','name','Action','QueuePause','getAgent','[%s][INPAUSE][AGENT:%s][QUEUE:%s]','[%s][START][AGENT:%s][QUEUE:%s]','attended','destlinkedid','savePause','available','paused','[%s][TIMER:%s][AGENT:%s][QUEUE:%s]','acwTimeout','stopAcw','format','YYYY-MM-DD\x20HH:mm:ss','error','[%s][TIMER][STOP][AGENT:%s]','saveUnpause','update','[%s][UPDATE][ERRORS:%s]','[ACW][TIMERS]','stringify','[ACW][STOP]\x20%s','queue','[ACW][syncAgentConnect]\x20%s','[ACW][syncAgentConnectPreview]\x20%s','message','syncHangupRequest','isUndefined','[%s][HANGUP:UNIQUEID]','linkedid','[%s][HANGUP:LINKEDID]','[ACW][syncHangupRequest]\x20%s','[%s][HANGUPATTENDEDTRANSFER:UNIQUEID]','[%s][HANGUPATTENDEDTRANSFER:LINKEDID]','[ACW][syncHangup]\x20%s','isNil','transfereeuniqueid','secondtransfereruniqueid','transfertargetuniqueid','deleteChannelAfterTimeout','origtransfereruniqueid','[ACW][syncAttendedTransfer]\x20%s','transfereruniqueid','[%s][BLINDTRANSFER:UNIQUEID]','transfererlinkedid','[%s][BLINDTRANSFER:LINKEDID]','[ACW][syncBlindTransfer]\x20%s'];(function(_0x3825a8,_0x2ce1a2){var _0xabc9bc=function(_0x101073){while(--_0x101073){_0x3825a8['push'](_0x3825a8['shift']());}};_0xabc9bc(++_0x2ce1a2);}(_0xf62b,0x1e0));var _0xbf62=function(_0x5293c8,_0xab0c3c){_0x5293c8=_0x5293c8-0x0;var _0x3623fb=_0xf62b[_0x5293c8];return _0x3623fb;};'use strict';var _=require(_0xbf62('0x0'));var moment=require(_0xbf62('0x1'));var ami=require(_0xbf62('0x2'));var logger=require(_0xbf62('0x3'))(_0xbf62('0x4'));var RpcUser=require(_0xbf62('0x5'));var RpcVoiceAgentReport=require(_0xbf62('0x6'));function Acw(_0x3fac1d){this[_0xbf62('0x7')]=_0x3fac1d[_0xbf62('0x7')];this[_0xbf62('0x8')]=_0x3fac1d['agents'];this[_0xbf62('0x9')]=_0x3fac1d[_0xbf62('0x9')];this[_0xbf62('0xa')]={};ami['on'](_0xbf62('0xb'),this[_0xbf62('0xc')][_0xbf62('0xd')](this));ami['on'](_0xbf62('0xe'),this['syncHangupRequest']['bind'](this));ami['on'](_0xbf62('0xf'),this[_0xbf62('0x10')][_0xbf62('0xd')](this));ami['on'](_0xbf62('0x11'),this[_0xbf62('0x12')][_0xbf62('0xd')](this));ami['on']('attendedtransfer',this[_0xbf62('0x13')][_0xbf62('0xd')](this));ami['on'](_0xbf62('0x14'),this[_0xbf62('0x15')][_0xbf62('0xd')](this));ami['on'](_0xbf62('0x16'),this[_0xbf62('0x17')]['bind'](this));}function getDiff(_0x5c5030){var _0x2f2402=moment()[_0xbf62('0x18')](0x0);var _0x4ab20e=moment(_0x5c5030)[_0xbf62('0x18')](0x0);return _0x2f2402[_0xbf62('0x19')](_0x4ab20e,_0xbf62('0x1a'));}Acw[_0xbf62('0x1b')][_0xbf62('0x1c')]=function(_0x2f6e43,_0x472b89){var _0x5782ad=this;var _0x36c64b=getDiff(_0x5782ad['timers'][_0x2f6e43][_0xbf62('0x1d')]);clearTimeout(_0x5782ad[_0xbf62('0x9')][_0x2f6e43][_0xbf62('0x1e')]);_0x5782ad['timers'][_0x2f6e43][_0xbf62('0x1e')]=![];return RpcVoiceAgentReport['update']({'acwtime':_0x36c64b},_0x5782ad[_0xbf62('0x9')][_0x2f6e43][_0xbf62('0x1f')],_0x2f6e43)[_0xbf62('0x20')](function(_0xe5f60e){logger[_0xbf62('0x21')](_0xbf62('0x22'),_0x472b89,_0x36c64b,_0xe5f60e);})[_0xbf62('0x23')](function(_0x38a8e4){logger['error']('[%s][UPDATE][ERRORS:%s]',_0x472b89,_0x38a8e4);})[_0xbf62('0x24')](function(){delete _0x5782ad['timers'][_0x2f6e43];});};Acw['prototype'][_0xbf62('0x25')]=function(_0x504947){try{var _0x479456=this;var _0x28d7d7=this['channels'][_0x504947][_0xbf62('0x26')];var _0x3ea343=this[_0xbf62('0xa')][_0x504947]['queue'];var _0x2aad32=this[_0xbf62('0x7')][_0x3ea343];var _0x3d4165=![];var _0x3bad4e=_0xbf62('0x27');if(_0x2aad32[_0xbf62('0x28')]&&_0x2aad32['mandatoryDispositionPause']['name']){_0x3d4165=!![];_0x3bad4e=_0x2aad32['mandatoryDispositionPause'][_0xbf62('0x29')];}return ami[_0xbf62('0x2a')]({'action':_0xbf62('0x2b'),'interface':_0x28d7d7,'paused':!![],'reason':_0x3bad4e})['then'](function(){if(_0x479456[_0xbf62('0x8')][_0x28d7d7]){return RpcUser[_0xbf62('0x2c')](_0x479456[_0xbf62('0x8')][_0x28d7d7]['id'])[_0xbf62('0x20')](function(_0x58b124){if(!_0x58b124||_0x58b124['voicePause']){logger['info'](_0xbf62('0x2d'),_0x504947,_0x28d7d7,_0x3ea343);return;}logger[_0xbf62('0x21')](_0xbf62('0x2e'),_0x504947,_0x28d7d7,_0x3ea343);var _0x54de9b=_0x479456[_0xbf62('0xa')][_0x504947][_0xbf62('0x2f')]&&_0x479456[_0xbf62('0xa')][_0x504947][_0xbf62('0x30')]?_0x479456['channels'][_0x504947][_0xbf62('0x30')]:_0x504947;return RpcUser[_0xbf62('0x31')](_0x479456['agents'][_0x28d7d7],_0x3bad4e,_0x54de9b)[_0xbf62('0x20')](function(_0x25e92c){_0x479456[_0xbf62('0x7')][_0x3ea343][_0xbf62('0x32')]-=0x1;_0x479456[_0xbf62('0x7')][_0x3ea343][_0xbf62('0x33')]+=0x1;return _0x25e92c;});})[_0xbf62('0x20')](function(_0x49fbc3){if(_0x3d4165||!_0x49fbc3){return;}_0x479456['timers'][_0x28d7d7]={};logger['info'](_0xbf62('0x34'),_0x504947,_0x479456[_0xbf62('0x7')][_0x3ea343][_0xbf62('0x35')],_0x28d7d7,_0x3ea343);_0x479456[_0xbf62('0x9')][_0x28d7d7][_0xbf62('0x1e')]=setTimeout(_0x479456[_0xbf62('0x36')]['bind'](_0x479456,_0x28d7d7),_0x479456[_0xbf62('0x7')][_0x3ea343][_0xbf62('0x35')]*0x3e8);_0x479456[_0xbf62('0x9')][_0x28d7d7][_0xbf62('0x1d')]=moment()[_0xbf62('0x37')](_0xbf62('0x38'));_0x479456[_0xbf62('0x9')][_0x28d7d7]['uniqueid']=_0x504947;_0x479456['timers'][_0x28d7d7]['queue']=_0x3ea343;_0x479456[_0xbf62('0x9')][_0x28d7d7][_0xbf62('0x1c')]=_0x479456[_0xbf62('0x1c')][_0xbf62('0xd')](_0x479456,_0x28d7d7,_0x504947);});}})['catch'](function(){logger[_0xbf62('0x39')](_0xbf62('0x34'),_0x504947,_0x479456['voiceQueues'][_0x3ea343][_0xbf62('0x35')],_0x28d7d7,_0x3ea343);})[_0xbf62('0x24')](function(){delete _0x479456['channels'][_0x504947];});}catch(_0x3aeb14){logger[_0xbf62('0x39')]('[ACW][START]\x20%s',_0x3aeb14['message']);}};Acw[_0xbf62('0x1b')]['stopAcw']=function(_0x17745e){try{var _0x42e14e=this;if(_0x42e14e[_0xbf62('0x9')][_0x17745e]){_0x42e14e[_0xbf62('0x9')][_0x17745e][_0xbf62('0x1e')]=![];var _0x959857=_0x42e14e[_0xbf62('0x9')][_0x17745e][_0xbf62('0x1f')];var _0x364dc2=_0x42e14e['timers'][_0x17745e]['queue'];var _0x36ed42=_0x42e14e[_0xbf62('0x7')][_0x364dc2][_0xbf62('0x35')];logger[_0xbf62('0x21')](_0xbf62('0x3a'),_0x959857,_0x17745e);RpcUser[_0xbf62('0x2c')](this['agents'][_0x17745e]['id'])[_0xbf62('0x20')](function(_0x1b30b1){if(_0x1b30b1['pauseType']===_0xbf62('0x27')){return RpcUser[_0xbf62('0x3b')](_0x42e14e[_0xbf62('0x8')][_0x17745e]);}});RpcVoiceAgentReport[_0xbf62('0x3c')]({'acwtime':_0x36ed42,'agentacw':!![]},_0x959857,_0x17745e)[_0xbf62('0x20')](function(_0x9e943){logger[_0xbf62('0x21')](_0xbf62('0x22'),_0x959857,_0x36ed42,_0x9e943);})[_0xbf62('0x23')](function(_0x534e0b){logger[_0xbf62('0x39')](_0xbf62('0x3d'),_0x959857,_0x534e0b);});}else{logger[_0xbf62('0x39')]('[ACW][STOP]\x20Interface\x20%s\x20doesn\x27t\x20have\x20timer',_0x17745e);if(_0x42e14e[_0xbf62('0x9')]){logger[_0xbf62('0x21')](_0xbf62('0x3e'),JSON[_0xbf62('0x3f')](_0x42e14e['timers']));}}}catch(_0x1d3c5f){logger['error'](_0xbf62('0x40'),_0x1d3c5f['message']);}};Acw[_0xbf62('0x1b')]['syncAgentConnect']=function(_0x190c38){try{if(this[_0xbf62('0x7')][_0x190c38[_0xbf62('0x41')]]&&(this[_0xbf62('0x7')][_0x190c38[_0xbf62('0x41')]]['acw']||this['voiceQueues'][_0x190c38[_0xbf62('0x41')]][_0xbf62('0x28')])){if(this[_0xbf62('0x8')][_0x190c38[_0xbf62('0x26')]]){this[_0xbf62('0xa')][_0x190c38[_0xbf62('0x1f')]]={'queue':_0x190c38[_0xbf62('0x41')],'interface':_0x190c38[_0xbf62('0x26')],'destlinkedid':_0x190c38[_0xbf62('0x30')]};}}}catch(_0x1fde5a){logger['error'](_0xbf62('0x42'),_0x1fde5a['message']);}};Acw['prototype']['syncAgentConnectPreview']=function(_0x4b0bc4){try{if(this[_0xbf62('0x7')][_0x4b0bc4[_0xbf62('0x41')]]&&(this['voiceQueues'][_0x4b0bc4[_0xbf62('0x41')]][_0xbf62('0x4')]||this['voiceQueues'][_0x4b0bc4[_0xbf62('0x41')]]['mandatoryDisposition'])){if(this['agents'][_0x4b0bc4[_0xbf62('0x26')]]){this['channels'][_0x4b0bc4[_0xbf62('0x1f')]]={'queue':_0x4b0bc4[_0xbf62('0x41')],'interface':_0x4b0bc4[_0xbf62('0x26')]};}}}catch(_0x542af6){logger[_0xbf62('0x39')](_0xbf62('0x43'),_0x542af6[_0xbf62('0x44')]);}};Acw[_0xbf62('0x1b')][_0xbf62('0x45')]=function(_0x19a22f){try{if(this[_0xbf62('0xa')][_0x19a22f[_0xbf62('0x1f')]]&&_[_0xbf62('0x46')](this[_0xbf62('0xa')][_0x19a22f[_0xbf62('0x1f')]][_0xbf62('0x2f')])){logger[_0xbf62('0x21')](_0xbf62('0x47'),_0x19a22f[_0xbf62('0x1f')]);this[_0xbf62('0x25')](_0x19a22f[_0xbf62('0x1f')]);}else if(this[_0xbf62('0xa')][_0x19a22f[_0xbf62('0x48')]]&&_['isUndefined'](this[_0xbf62('0xa')][_0x19a22f[_0xbf62('0x48')]][_0xbf62('0x2f')])){logger[_0xbf62('0x21')](_0xbf62('0x49'),_0x19a22f['linkedid']);this[_0xbf62('0x25')](_0x19a22f[_0xbf62('0x48')]);}}catch(_0x3ecbc4){logger[_0xbf62('0x39')](_0xbf62('0x4a'),_0x3ecbc4[_0xbf62('0x44')]);}};Acw['prototype'][_0xbf62('0x10')]=function(_0x4b0b8d){try{if(this['channels'][_0x4b0b8d[_0xbf62('0x1f')]]&&this[_0xbf62('0xa')][_0x4b0b8d['uniqueid']]['attended']){logger[_0xbf62('0x21')](_0xbf62('0x4b'),_0x4b0b8d['uniqueid']);this[_0xbf62('0x25')](_0x4b0b8d[_0xbf62('0x1f')]);}else if(this[_0xbf62('0xa')][_0x4b0b8d[_0xbf62('0x48')]]&&this[_0xbf62('0xa')][_0x4b0b8d[_0xbf62('0x48')]]['attended']){logger[_0xbf62('0x21')](_0xbf62('0x4c'),_0x4b0b8d[_0xbf62('0x48')]);this[_0xbf62('0x25')](_0x4b0b8d['linkedid']);}}catch(_0x26d1d6){logger['error'](_0xbf62('0x4d'),_0x26d1d6[_0xbf62('0x44')]);}};Acw[_0xbf62('0x1b')]['syncAttendedTransfer']=function(_0xe351c3){try{if(!_[_0xbf62('0x4e')](this[_0xbf62('0xa')][_0xe351c3['transfereeuniqueid']])){this[_0xbf62('0x25')](_0xe351c3[_0xbf62('0x4f')]);if(this[_0xbf62('0xa')][_0xe351c3[_0xbf62('0x50')]]){this[_0xbf62('0xa')][_0xe351c3[_0xbf62('0x50')]]['attended']=!![];this[_0xbf62('0xa')][_0xe351c3[_0xbf62('0x51')]]=this[_0xbf62('0xa')][_0xe351c3[_0xbf62('0x50')]];this[_0xbf62('0x52')](_0xe351c3[_0xbf62('0x50')]);}}else if(!_[_0xbf62('0x4e')](this['channels'][_0xe351c3[_0xbf62('0x51')]])){this[_0xbf62('0x25')](_0xe351c3['transfertargetuniqueid']);if(this['channels'][_0xe351c3[_0xbf62('0x53')]]){this['channels'][_0xe351c3[_0xbf62('0x53')]][_0xbf62('0x2f')]=!![];this[_0xbf62('0xa')][_0xe351c3[_0xbf62('0x4f')]]=this[_0xbf62('0xa')][_0xe351c3['origtransfereruniqueid']];this[_0xbf62('0x52')](_0xe351c3[_0xbf62('0x53')]);}}}catch(_0x57b178){logger[_0xbf62('0x39')](_0xbf62('0x54'),_0x57b178[_0xbf62('0x44')]);}};Acw[_0xbf62('0x1b')][_0xbf62('0x15')]=function(_0x998d8c){try{if(this['channels'][_0x998d8c[_0xbf62('0x55')]]){logger[_0xbf62('0x21')](_0xbf62('0x56'),JSON[_0xbf62('0x3f')](_0x998d8c[_0xbf62('0x55')]));this[_0xbf62('0x25')](_0x998d8c[_0xbf62('0x55')]);}else if(this[_0xbf62('0xa')][_0x998d8c[_0xbf62('0x57')]]){logger[_0xbf62('0x21')](_0xbf62('0x58'),JSON[_0xbf62('0x3f')](_0x998d8c['transfererlinkedid']));this[_0xbf62('0x25')](_0x998d8c['transfererlinkedid']);}}catch(_0x5220b7){logger[_0xbf62('0x39')](_0xbf62('0x59'),_0x5220b7[_0xbf62('0x44')]);}};Acw[_0xbf62('0x1b')][_0xbf62('0x12')]=function(_0x35fcb3){try{if(this['voiceQueues'][_0x35fcb3['queue']]&&this[_0xbf62('0x7')][_0x35fcb3['queue']][_0xbf62('0x5a')]===_0xbf62('0x5b')){if(this[_0xbf62('0x8')][_0x35fcb3[_0xbf62('0x26')]]){logger['info'](_0xbf62('0x5c'),_0x35fcb3[_0xbf62('0x1f')],_0x35fcb3[_0xbf62('0x26')],_0x35fcb3['queue']);return RpcUser[_0xbf62('0x31')](this[_0xbf62('0x8')][_0x35fcb3[_0xbf62('0x26')]],_0xbf62('0x5d'),_0x35fcb3['uniqueid']);}}}catch(_0x10ab24){logger['error'](_0xbf62('0x5e'),_0x10ab24[_0xbf62('0x44')]);}};Acw[_0xbf62('0x1b')][_0xbf62('0x52')]=function(_0xc710b6,_0x3c3422=0x2710){if(this[_0xbf62('0xa')][_0xc710b6]){setTimeout(()=>{delete this[_0xbf62('0xa')][_0xc710b6];},_0x3c3422);}};module['exports']=Acw; \ No newline at end of file diff --git a/server/services/ami/ami.js b/server/services/ami/ami.js index 30afbf5..31fe40d 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 _0x09e0=['fullybooted','Fullybooted\x20\x22%s\x22\x20to\x20%s:%s','resolve','then','catch','[ami.js][fullybooted]','exports','asterisk-manager','bluebird','util','../../config/logger','../../config/environment','asterisk','port','password','keepConnected','Action','error','format','Manager\x20\x22%s\x22\x20error\x20to\x20%s:%s\x20with:\x0a%s','inspect','username','actionSipShowRegistry','sipshowregistry','actionDeviceStateList','devicestatelist','actionSipPeerStatus','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'];(function(_0x16aba9,_0x55563f){var _0x574784=function(_0x1b7bcb){while(--_0x1b7bcb){_0x16aba9['push'](_0x16aba9['shift']());}};_0x574784(++_0x55563f);}(_0x09e0,0x15d));var _0x009e=function(_0x5774be,_0x2259d3){_0x5774be=_0x5774be-0x0;var _0x4914b4=_0x09e0[_0x5774be];return _0x4914b4;};'use strict';var Manager=require(_0x009e('0x0'));var BPromise=require(_0x009e('0x1'));var util=require(_0x009e('0x2'));var logger=require(_0x009e('0x3'))('ami');var config=require(_0x009e('0x4'));var ami=new Manager(config[_0x009e('0x5')][_0x009e('0x6')],config['asterisk']['ip'],config[_0x009e('0x5')]['username'],config[_0x009e('0x5')][_0x009e('0x7')],!![]);ami[_0x009e('0x8')]();ami[_0x009e('0x9')]=BPromise['promisify'](ami['action']);function error(_0x1dcd7e){logger[_0x009e('0xa')](util[_0x009e('0xb')](_0x009e('0xc'),config['asterisk']['username'],config['asterisk']['ip'],config[_0x009e('0x5')]['port'],util[_0x009e('0xd')](_0x1dcd7e,![],null)));}function close(){logger[_0x009e('0xa')](util['format']('Manager\x20\x22%s\x22\x20closed\x20to\x20%s:%s',config['asterisk'][_0x009e('0xe')],config[_0x009e('0x5')]['ip'],config[_0x009e('0x5')][_0x009e('0x6')]));}ami[_0x009e('0xf')]=function(){return function(){return ami[_0x009e('0x9')]({'action':_0x009e('0x10')});};};ami[_0x009e('0x11')]=function(){return function(){return ami[_0x009e('0x9')]({'action':_0x009e('0x12')});};};ami[_0x009e('0x13')]=function(){return function(){return ami[_0x009e('0x9')]({'action':_0x009e('0x14')});};};ami[_0x009e('0x15')]=function(){return function(){return ami[_0x009e('0x9')]({'action':_0x009e('0x16')});};};ami[_0x009e('0x17')]=function(){return function(){return ami[_0x009e('0x9')]({'action':_0x009e('0x18')});};};function connect(){logger[_0x009e('0x19')](util[_0x009e('0xb')](_0x009e('0x1a'),config[_0x009e('0x5')]['username'],config[_0x009e('0x5')]['ip'],config[_0x009e('0x5')]['port']));ami[_0x009e('0x1b')]('error',error);ami[_0x009e('0x1b')](_0x009e('0x1c'),close);}ami['on'](_0x009e('0x1d'),connect);ami['on']('shutdown',function(_0x2da818){logger[_0x009e('0x19')](util[_0x009e('0xb')](_0x009e('0x1e'),config[_0x009e('0x5')][_0x009e('0xe')],config[_0x009e('0x5')]['ip'],config['asterisk'][_0x009e('0x6')],util[_0x009e('0xd')](_0x2da818,![],null)));});ami['on'](_0x009e('0x1f'),function(){logger[_0x009e('0x19')](util[_0x009e('0xb')](_0x009e('0x20'),config[_0x009e('0x5')][_0x009e('0xe')],config['asterisk']['ip'],config[_0x009e('0x5')]['port']));return Promise[_0x009e('0x21')]()[_0x009e('0x22')](ami['actionSipShowRegistry']())[_0x009e('0x22')](ami['actionDeviceStateList']())[_0x009e('0x22')](ami[_0x009e('0x13')]())[_0x009e('0x22')](ami['actionQueueSummary']())['then'](ami[_0x009e('0x17')]())[_0x009e('0x23')](function(_0x2e7e65){logger[_0x009e('0xa')](_0x009e('0x24'),util[_0x009e('0xd')](_0x2e7e65,{'showHidden':![],'depth':null}));});});ami[_0x009e('0x1b')](_0x009e('0xa'),error);ami[_0x009e('0x1b')]('close',close);module[_0x009e('0x25')]=ami; \ No newline at end of file +var _0x20e4=['resolve','then','catch','[ami.js][fullybooted]','exports','asterisk-manager','bluebird','util','../../config/logger','ami','asterisk','port','username','keepConnected','Action','action','error','Manager\x20\x22%s\x22\x20error\x20to\x20%s:%s\x20with:\x0a%s','inspect','format','Manager\x20\x22%s\x22\x20closed\x20to\x20%s:%s','actionDeviceStateList','actionSipPeerStatus','sippeerstatus','actionQueueSummary','actionCoreShowChannels','coreshowchannels','info','once','connect','shutdown','fullybooted'];(function(_0x5e8766,_0x2dc43e){var _0x484b49=function(_0x18bc30){while(--_0x18bc30){_0x5e8766['push'](_0x5e8766['shift']());}};_0x484b49(++_0x2dc43e);}(_0x20e4,0x185));var _0x420e=function(_0x4aebb5,_0x2af41a){_0x4aebb5=_0x4aebb5-0x0;var _0x1095f7=_0x20e4[_0x4aebb5];return _0x1095f7;};'use strict';var Manager=require(_0x420e('0x0'));var BPromise=require(_0x420e('0x1'));var util=require(_0x420e('0x2'));var logger=require(_0x420e('0x3'))(_0x420e('0x4'));var config=require('../../config/environment');var ami=new Manager(config[_0x420e('0x5')][_0x420e('0x6')],config[_0x420e('0x5')]['ip'],config[_0x420e('0x5')][_0x420e('0x7')],config[_0x420e('0x5')]['password'],!![]);ami[_0x420e('0x8')]();ami[_0x420e('0x9')]=BPromise['promisify'](ami[_0x420e('0xa')]);function error(_0x26fb83){logger[_0x420e('0xb')](util['format'](_0x420e('0xc'),config[_0x420e('0x5')]['username'],config[_0x420e('0x5')]['ip'],config[_0x420e('0x5')]['port'],util[_0x420e('0xd')](_0x26fb83,![],null)));}function close(){logger[_0x420e('0xb')](util[_0x420e('0xe')](_0x420e('0xf'),config[_0x420e('0x5')]['username'],config[_0x420e('0x5')]['ip'],config[_0x420e('0x5')][_0x420e('0x6')]));}ami['actionSipShowRegistry']=function(){return function(){return ami['Action']({'action':'sipshowregistry'});};};ami[_0x420e('0x10')]=function(){return function(){return ami[_0x420e('0x9')]({'action':'devicestatelist'});};};ami[_0x420e('0x11')]=function(){return function(){return ami[_0x420e('0x9')]({'action':_0x420e('0x12')});};};ami[_0x420e('0x13')]=function(){return function(){return ami[_0x420e('0x9')]({'action':'queuesummary'});};};ami[_0x420e('0x14')]=function(){return function(){return ami[_0x420e('0x9')]({'action':_0x420e('0x15')});};};function connect(){logger[_0x420e('0x16')](util[_0x420e('0xe')]('Manager\x20\x22%s\x22\x20logged\x20on\x20to\x20%s:%s',config[_0x420e('0x5')]['username'],config['asterisk']['ip'],config[_0x420e('0x5')][_0x420e('0x6')]));ami[_0x420e('0x17')](_0x420e('0xb'),error);ami['once']('close',close);}ami['on'](_0x420e('0x18'),connect);ami['on'](_0x420e('0x19'),function(_0x1208a1){logger[_0x420e('0x16')](util[_0x420e('0xe')]('Shutdown\x20\x22%s\x22\x20to\x20%s:%s\x20with:\x0a%s',config[_0x420e('0x5')][_0x420e('0x7')],config[_0x420e('0x5')]['ip'],config[_0x420e('0x5')][_0x420e('0x6')],util[_0x420e('0xd')](_0x1208a1,![],null)));});ami['on'](_0x420e('0x1a'),function(){logger[_0x420e('0x16')](util[_0x420e('0xe')]('Fullybooted\x20\x22%s\x22\x20to\x20%s:%s',config['asterisk'][_0x420e('0x7')],config[_0x420e('0x5')]['ip'],config[_0x420e('0x5')][_0x420e('0x6')]));return Promise[_0x420e('0x1b')]()[_0x420e('0x1c')](ami['actionSipShowRegistry']())[_0x420e('0x1c')](ami[_0x420e('0x10')]())['then'](ami['actionSipPeerStatus']())['then'](ami[_0x420e('0x13')]())[_0x420e('0x1c')](ami[_0x420e('0x14')]())[_0x420e('0x1d')](function(_0x4dd9b){logger[_0x420e('0xb')](_0x420e('0x1e'),util[_0x420e('0xd')](_0x4dd9b,{'showHidden':![],'depth':null}));});});ami[_0x420e('0x17')](_0x420e('0xb'),error);ami['once']('close',close);module[_0x420e('0x1f')]=ami; \ No newline at end of file diff --git a/server/services/ami/client.js b/server/services/ami/client.js index f9f7c68..5fb9783 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 _0xac4a=['ami','client','http','then','debug','memberReport','error','message','result','catch','rpc','jayson/promise','bluebird','../../config/logger'];(function(_0x53ccf2,_0x13cb67){var _0x5a2964=function(_0x3b0514){while(--_0x3b0514){_0x53ccf2['push'](_0x53ccf2['shift']());}};_0x5a2964(++_0x13cb67);}(_0xac4a,0x13f));var _0xaac4=function(_0x4ba1e3,_0x53d0e0){_0x4ba1e3=_0x4ba1e3-0x0;var _0x14163f=_0xac4a[_0x4ba1e3];return _0x14163f;};'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 +var _0xb43b=['catch','exports','jayson/promise','bluebird','ami','client','http','rpc','memberReport','error','message','result'];(function(_0x3335f5,_0x1a6c6e){var _0x965dc=function(_0x56bd97){while(--_0x56bd97){_0x3335f5['push'](_0x3335f5['shift']());}};_0x965dc(++_0x1a6c6e);}(_0xb43b,0x1b2));var _0xbb43=function(_0x3d3c53,_0x23c84c){_0x3d3c53=_0x3d3c53-0x0;var _0xafbc80=_0xb43b[_0x3d3c53];return _0xafbc80;};'use strict';var jayson=require(_0xbb43('0x0'));var BPromise=require(_0xbb43('0x1'));var logger=require('../../config/logger')(_0xbb43('0x2'));var client=jayson[_0xbb43('0x3')][_0xbb43('0x4')]({'port':0x2329});client['Request']=function(_0x131e9e,_0x41aff6){return new BPromise(function(_0x351254,_0x16432a){return client['request'](_0x131e9e,_0x41aff6)['then'](function(_0x378df5){logger['debug'](_0xbb43('0x5'),_0xbb43('0x6'),_0x131e9e,_0x41aff6,_0x378df5);if(_0x378df5[_0xbb43('0x7')]){logger[_0xbb43('0x7')](_0xbb43('0x5'),'memberReport',_0x131e9e,_0x378df5[_0xbb43('0x7')][_0xbb43('0x8')],_0x41aff6);return _0x16432a(_0x378df5['error'][_0xbb43('0x8')]);}else{return _0x351254(_0x378df5[_0xbb43('0x9')]);}})[_0xbb43('0xa')](function(_0x5e3611){logger[_0xbb43('0x7')](_0xbb43('0x5'),'memberReport',_0x131e9e,_0x5e3611,_0x41aff6);return _0x16432a(_0x5e3611);});});};module[_0xbb43('0xb')]=client; \ No newline at end of file diff --git a/server/services/ami/dialer/index.js b/server/services/ami/dialer/index.js index 9b6879d..e8a5464 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 _0x0e3a=['Drop\x20Rate:\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20','---------------------------','getSeconds','startProgressive\x20value\x20cleared','handlePredictive','error','CAMPAIGN_STATUS','CONTACTS_RESCHEDULED','[getContactDialer2][ReScheduled]','contactsRescheduled','contacts','message','NO_AVAILABLE_CONTACTS','[getContactDialer2][Empty]','state','statedesc','endtime','starttime','queueStatusComplete','[booked][unlockQueueStatus]','pick','Interval','NULL_INTERVAL','\x20INTERVAL_IS_NULL','Intervals','isIVRCampaignActive','INACTIVE','\x20NOT\x20Active','isIVRCampaign','campaign:ivr:%s','campaign:save','sendMessageOneNotActive','originated','[syncQueueSummary]\x20Campaign\x20Ivr:\x20','DISACTIVED','is\x20deactivated','[ifTime][Action]','Error','stringify','isTrunkReachable','active','SIP/%s','status','unmonitored','checkIsTrunkReachable','Trunk','TRUNK_NOT_REACHABLE','\x20trunk\x20is\x20not\x20reachable','checkIfTime','ifTimeIvr','ifTime','Failure','\x20Intervals\x20is\x20null\x20','isEmpty','EMPTY_INTERVAL','\x20Intervals\x20is\x20empty\x20','timezones','UNKNOWN_TIMEZONE','\x20Timezone\x20unknow\x20','isArray','length','push','Action','command','iftime\x20%s,%s','indexOf','true','content','catch','some','[ifTime][promiseAll]','Global:\x20','\x20Interval\x20is\x20overtime:\x20','resetActiveCalls','syncCampaigns','dialTimezone','checkIfTimeIntervals','launchHandleIvr','checkDialMethod','dialMethod','handlePower','power','dialPowerLevel','Queue','method\x20not\x20recognized','dialGlobalInterval','silly','Dialer::ifTime()','Voice\x20Queue\x20%s\x20$s','intervalIftime','OVERTIME_INTERVAL','Timezone:\x20','AMI\x20IfTime','queue','uniqueid','ivr','[syncAgentConnect]','answertime','YYYY-MM-DD\x20HH:mm:ss','outboundAnswerCallsDay','agent','agiafterat','dialQueueProject2','dialAgiAfterHangupAgent','createHistory','[syncAgentComplete][createHistory]','moveContactManagedDialer','[syncAgentComplete]','decrementOriginate','[syncQueueCallerAbandon]','droptime','dialQueueTimeout','outboundDropCallsDayTimeout','predictiveIntervalErlangCallsDroppedCalls','Drop','dropreason','TIMEOUT','countdropretry','countglobal','dialDropRetryFrequency','callAdditionalPhoneAfterMin','verifyAdditionalPhones','voiceQueue','additional','dialDropMaxRetry','queueCallerAbandonCreateState','rescheduleContact','add','minutes','ContactId','ListId','VoiceQueueId','CampaignId','[rescheduleContact][Drop]','calleridname','calleridnum','swapAdditionalPhones','outboundDropCallsDayCallersExit','Abandoned','countabandonedretry','dialAbandonedMaxRetry','dialAbandonedRetryFrequency','[rescheduleContact][Abandoned]','[syncAgentComplete][createHistory][11]','channel','actionid','strategy','rrmemory','isNil','locked','paused','stateinterface','merge','idHopper','syncQueueStatusComplete','roundrobin','run','[Catch][Preview][syncQueueStatusComplete]','[syncQueueStatusComplete]','[unlock][syncQueueStatusComplete]','_rr','unlockRR','[booked][RR]','Agent:\x20','contactAgent-idHopper:\x20','[booked][unlock]','[unlock3][syncQueueStatusComplete]','responsetime','getQueue','response','Success','[syncOriginateResponse]','callProgressDetecting','syncVarSet','variable','amdstatus','xcally-motion-dialer','dialAMDActive','value','HANGUP','[syncVarSet]','outboundAnswerAgiCallsDay','HangupInAMD','membername','AMD','emit','custom:amd','countmachineretry','amd','buildObj','[syncAgentComplete][createHistory][0]','countbusyretry','countnoanswerretry','countnosuchnumberretry','countagentrejectretry','dialGlobalMaxRetry','stateGlobal','reason19\x20machine....','dialMachineMaxRetry','reason\x2019\x20machine....','[rescheduleContact][Machine]','saveInDb','[syncHangupInAMDIvr][createHistory]','MACHINE','createStateFinal','dialMachineRetryFrequency','[syncHangup]','ivrAnswerCallsDay','Normal\x20Clearing','[syncAgentCompleteIvr][createHistory]','[syncAgentCompleteIvr]','[syncHangupIvr][createHistory]','[syncHangupIvr]','dialQueueProject','AGI','[syncHangup2]','cause-txt','outboundUnknownCallsDay','Unknown','[syncHangup][createHistory]','running','isPreviewCampaign','statusMessage','getQueueCampaignStatusMessage','resolve','available','talking','pTalking','ACTIVE','[syncQueueSummary]','queueSummaryCountersUpdated','updateReportFromOutboundQueue','syncQueueSummaryComplete','throttle','dialPreviewRecallmeReminder','filter','online','handlePreviewRecallNotifications','map','Agent','user:%s','checkPreviewRecallReminder','[uniqueid]','[actions]','clearZombieChannels','undefined','enqueue','getVoiceQueueRtPauses','[getVoiceQueueRtPauses]\x20','emptyContact','UserId','[emptyContact][createHistory]','[syncQueueCallerAbandon]\x20[Drop]','handleIvr','actionOriginate','object','originate','voiceQueue\x20is\x20undefine','phone','contact\x20is\x20undefine','getCaller','\x22agi://%s/square,%s\x22','NONE','\x22%s,%s%s,,,%s\x22','dialQueueOptions','XMD-AMDINITIALSILENCE','dialAMDGreeting','XMD-AMDAFTERGREETINGSILENCE','dialAMDAfterGreetingSilence','XMD-AMDTOTALANALYSISTIME','XMD-AMDMINWORDLENGTH','dialAMDMinWordLength','XMD-AMDBETWEENWORDSSILENCE','XMD-AMDMAXIMUMNUMBEROFWORDS','dialAMDMaximumNumberOfWords','dialAMDSilenceThreshold','dialAMDMaximumWordLength','isOutboundQueue','XMD-VOICEQUEUEID','XMD-CAMPAIGNID','setXMDContactVariables','Contact','assign','getCallerId','callerid','dialRandomLastDigitCallerIdNumber','getCallerIdRandom','dialOriginateCallerIdNumber','TrunkBackup','dialOriginateCallerIdName','XMD-ORIGINATECALLERIDNAME','originatecalleridname','extractCalleridName','XMD-ORIGINATECALLERIDNUM','variables','SIP/%s/%s%s','dialPrefix','substring','dialCutDigit','trim','from-sip','outboundOriginateFailureCallsDay','[originateError]:\x20%s','OriginateError','[originate][error]','originate\x20action\x20Error','checkRetriveMax','countcongestionretry','dialNoAnswerMaxRetry','dialNoAnswerRetryFrequency','[rescheduleContact][NoAnswer]','dialBusyRetryFrequency','[rescheduleContact]\x20[Busy]','dialCongestionRetryFrequency','[rescheduleContact]\x20[Congestion]','dialNoSuchNumberMaxRetry','dialNoSuchNumberRetryFrequency','[rescheduleContact][NoSuchNumber]','dialAgentRejectMaxRetry','dialAgentRejectRetryFrequency','[rescheduleContact][AgentReject]','[callProgressDetecting]','entity\x20is\x20undefine','evt\x20is\x20undefine','reason','outboundNoSuchCallsDay','NoSuchNumber','custom:agentnosuchnumber','reason\x200\x20no\x20such\x20number....','outboundNoAnswerCallsDay','NoAnswer','custom:agentnoanswer','[syncAgentComplete][createHistory][3]','reason\x203\x20ringing\x20no\x20answer','outboundBusyCallsDay','Busy','custom:agentbusy','busy','[syncAgentComplete][createHistory][5]','dialBusyMaxRetry','reason\x205\x20busy','outboundCongestionCallsDay','congestion','reason\x208\x20congestion','reason\x2011\x20abandoned','outboundRejectCallsDay','custom:agentreject','reason\x2020\x20agentreject','Global','[moveContactManagedDialer][0]','contact\x20not\x20moved','round','predictiveIntervalAvailable','floor','predictiveIntervalHitRate','[startMethodPredictive][StartProgressive]','check\x20predictive\x20is\x20not\x20undefine','check\x20handlePredictive\x20is\x20not\x20undefine','dialPredictiveInterval','[startMethodPredictive][StartProgressive][Loop]','dialPredictiveOptimization','dropRate','[stopMethodPredictive][ReStartProgressive][ExceededDropDay]','Dropped\x20calls\x20day','[stopMethodPredictive][ReStartProgressive][ExceededDropInterval]','Max\x20Drop\x20','Drop\x20in\x20this\x20interval','started\x20in\x20predictive\x20at','avgHandleTime','getDataPredictive','startMethodPredictive','recalculate\x20predictive\x20at','Predictive\x20for\x20every\x20interval','switch\x20in\x20progressive\x20because\x20available\x20agents\x20(',')\x20are\x20less\x20than\x20threshold\x20(',')\x20are\x20more\x20than\x20threshold\x20(','dialPredictiveOptimizationPercentage','abandonmentRate','agentBusyFactor','busyFactor','[getDataPredictive]','Unknown\x20Predictive','getDataPredictiveOld','loggedIn','predictiveIntervalPauses','outboundQueuePauses','[CatchErlangB]','check\x20failure','erlangCallToSecond','milliseconds','checkContactBlack','recallme','[booked][checkContactBlack]','queueStatusComplete:\x20','Queue:\x20','queuestatus','[checkContactBlack]','[unlockOriginate][syncQueueStatusComplete]','[booked][checkContactBlack][else]','scheduledat','voicePause','unlockContact','outboundReCallsDay','[rescheduleContact][dialRecallInQueue]','QUEUE_RECALL','RecallInQueue','[Originate][HistoryDialRecallInQueue][historyCatch]','RecallFailedTimeout','[Originate][HistoryRecallClose][historyCatch]','[Originate][HistoryRecallClose]','outboundBlacklistCallsDay','BLACKLIST','Blacklist','[Originate][historyBlacklist]','inBlackList','limitCalls','temp','maxNumberOriginate','getContactDialerIvr','checkContactEmpty','[actionOriginate]\x20','checkIsBlackListIvr','[actionOriginateIvr]','[handleIvr]','dialLimitQueue','not_inuse','reachable','getContactDialer','RUNNING','checkIsBlackList','[actionOriginate]','[handlePower]','tryOriginatePredictive','[handlePredictive][limitChannel]','dialOrderByScheduledAt','countReScheduled','[countReScheduled]\x20','[actionOriginatePredictive]','[getContactCampaign2]','--------\x20Drop\x20Rate\x20--------','Interval:\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20','Ts:\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20','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','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','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','lodash','uuid','moment','ioredis','./utils','./utils/hopper','../preview/util/util','../../../config/logger','dialer','booked','predictive','predictiveCalls','syncQueueSummary','redis','defaults','localhost','socket.io-emitter','../rpc/cmHopper','../rpc/voiceQueueRt','../rpc/setting','./models/agentComplete','env','XCALLY_IP_AGI','prototype','tail','finally','sequence','preview','voiceQueues','campaigns','agents','trunks','channels','actions','uniqueId','startPredictive','startProgressive','queueBooked','queueBookedRR','queuesSummary','syncAgentConnect','syncQueueCallerAbandon','originateresponse','syncOriginateResponse','bind','custom:queuesummary','custom:queuesummarycomplete','hangup','syncHangup','syncNewExten','syncQueueMember','queuestatuscomplete','loopCampaigns','getSettings','then','previewRecallmeReminderInterval','type','outbound','debug','[voiceQueueReport][queuesummary]\x20sending\x20voice_queue:save\x20event:','inspect','format','name','voice_queue:save','info','-----\x20Stats\x20Predictive\x20---','Total\x20Calls:\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20','Answered\x20Calls:\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20','Dropped\x20Timeout:\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20','predictiveIntervalDroppedCallsTimeout','predictiveIntervalDroppedCallsCallersExit','predictiveIntervalAvgHoldtime','predictiveIntervalAvgTalktime','predictiveIntervalTotalCalls','isUndefined','Avg\x20Talk\x20Time\x20is\x20not\x20enough\x20for\x20predictive','Avg\x20Hold\x20Time\x20is\x20not\x20enough\x20for\x20predictive','Total\x20Calls\x20are\x20not\x20enough\x20for\x20predictive','History\x20information\x20are\x20empty','Scheduled\x20Calls:\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20','erlangCalls','One\x20call\x20every:\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20','erlangAbandonmentRate','Agent\x20Busy\x20Factor:\x20\x20\x20\x20\x20\x20\x20\x20\x20','erlangBusyFactor'];(function(_0x1c1667,_0x13e2ad){var _0x307062=function(_0x256299){while(--_0x256299){_0x1c1667['push'](_0x1c1667['shift']());}};_0x307062(++_0x13e2ad);}(_0x0e3a,0x1c6));var _0xa0e3=function(_0x4565bf,_0x5ad9d6){_0x4565bf=_0x4565bf-0x0;var _0x5610ba=_0x0e3a[_0x4565bf];return _0x5610ba;};'use strict';var util=require('util');var _=require(_0xa0e3('0x0'));var uuid=require(_0xa0e3('0x1'));var moment=require(_0xa0e3('0x2'));var rr=require('rr');var Redis=require(_0xa0e3('0x3'));var utils=require(_0xa0e3('0x4'));var hopperUtils=require(_0xa0e3('0x5'));var ut=require(_0xa0e3('0x6'));var config=require('../../../config/environment/');var logger=require(_0xa0e3('0x7'))(_0xa0e3('0x8'));var loggerBooked=require('../../../config/logger')(_0xa0e3('0x9'));var loggerPredictive=require(_0xa0e3('0x7'))(_0xa0e3('0xa'));var loggerPredictiveCalls=require(_0xa0e3('0x7'))(_0xa0e3('0xb'));var loggerSyncQueueSummary=require(_0xa0e3('0x7'))(_0xa0e3('0xc'));var ami=require('../ami');config[_0xa0e3('0xd')]=_[_0xa0e3('0xe')](config[_0xa0e3('0xd')],{'host':_0xa0e3('0xf'),'port':0x18eb});var io=require(_0xa0e3('0x10'))(new Redis(config[_0xa0e3('0xd')]));var cmHopper=require(_0xa0e3('0x11'));var voiceQueueRt=require(_0xa0e3('0x12'));var RpcSetting=require(_0xa0e3('0x13'));var Interval=require('../rpc/interval');var Action=require('./models/action');var History=require('./models/history');var Final=require('./models/final');var AgentComplete=require(_0xa0e3('0x14'));var QueueCallerAbandon=require('./models/queueCallerAbandon');var Hangup=require('./models/hangup');var ipAgi=process[_0xa0e3('0x15')][_0xa0e3('0x16')]||'127.0.0.1';var previewRecallmeReminderInterval=0x1;var Sequence=function(){};Sequence[_0xa0e3('0x17')]['enqueue']=function(_0x3c0a09){this['tail']=this['tail']?this[_0xa0e3('0x18')][_0xa0e3('0x19')](_0x3c0a09):_0x3c0a09();};function Dialer(_0x3a77e8,_0x5d359a){this[_0xa0e3('0x1a')]=new Sequence();this[_0xa0e3('0x1b')]=_0x5d359a;this[_0xa0e3('0x1c')]=_0x3a77e8[_0xa0e3('0x1c')];this[_0xa0e3('0x1d')]=_0x3a77e8[_0xa0e3('0x1d')];this[_0xa0e3('0x1e')]=_0x3a77e8['agents'];this[_0xa0e3('0x1f')]=_0x3a77e8['trunks'];this['maxNumberOriginate']=config['maxNumberOriginate']||0x2;this[_0xa0e3('0x20')]={};this[_0xa0e3('0x21')]={};this['contactsId']={};this[_0xa0e3('0x22')]={};this['optionPredictive']={};this[_0xa0e3('0x23')]={};this[_0xa0e3('0x24')]={};this['ivrOriginated']={};this[_0xa0e3('0x25')]={};this[_0xa0e3('0x26')]={};this[_0xa0e3('0x27')]={};ami['on']('agentconnect',this[_0xa0e3('0x28')]['bind'](this));ami['on']('queuecallerabandon',this[_0xa0e3('0x29')]['bind'](this));ami['on'](_0xa0e3('0x2a'),this[_0xa0e3('0x2b')][_0xa0e3('0x2c')](this));ami['on']('agentcomplete',this['syncAgentComplete']['bind'](this));ami['on'](_0xa0e3('0x2d'),this['syncQueueSummary']['bind'](this));ami['on'](_0xa0e3('0x2e'),this['syncQueueSummaryComplete'][_0xa0e3('0x2c')](this));ami['on'](_0xa0e3('0x2f'),this[_0xa0e3('0x30')][_0xa0e3('0x2c')](this));ami['on']('newexten',this[_0xa0e3('0x31')][_0xa0e3('0x2c')](this));ami['on']('varset',this['syncVarSet']['bind'](this));ami['on']('queuemember',this[_0xa0e3('0x32')][_0xa0e3('0x2c')](this));ami['on'](_0xa0e3('0x33'),this['syncQueueStatusComplete'][_0xa0e3('0x2c')](this));this[_0xa0e3('0x34')]();this['loopClearZombieChannels']();RpcSetting[_0xa0e3('0x35')]()[_0xa0e3('0x36')](function(_0x39fc01){previewRecallmeReminderInterval=_0x39fc01[_0xa0e3('0x37')];});}function isNotNull(_0x5699cf){return _0x5699cf!==null&&!_['isUndefined'](_0x5699cf);}function msgResponse(_0x28864f,_0x5ad56e,_0xa1ca92){return{'action':_0x28864f,'response':_0x5ad56e,'message':_0xa1ca92,'stack':_0xa1ca92};}function emit(_0x4fa9af,_0x539939,_0x631435){io['to'](_0x4fa9af)['emit'](_0x539939,_0x631435);}function emitOutboundVoiceQueueSummary(_0x2d982e){if(_0x2d982e[_0xa0e3('0x38')]===_0xa0e3('0x39')){logger[_0xa0e3('0x3a')](_0xa0e3('0x3b'),util[_0xa0e3('0x3c')](_0x2d982e,{'showHidden':![],'depth':null}));emit(util[_0xa0e3('0x3d')]('voice:queue:%s',_0x2d982e[_0xa0e3('0x3e')]),_0xa0e3('0x3f'),_0x2d982e);}}function checkGetDataPredictive(_0x1e2df9){if(isNotNull(_0x1e2df9)&&!_['isEmpty'](_0x1e2df9)){loggerPredictive[_0xa0e3('0x40')](_0xa0e3('0x41'));loggerPredictive[_0xa0e3('0x40')](_0xa0e3('0x42'),_0x1e2df9['predictiveIntervalTotalCalls']);loggerPredictive[_0xa0e3('0x40')](_0xa0e3('0x43'),_0x1e2df9['predictiveIntervalAnsweredCalls']);loggerPredictive['info'](_0xa0e3('0x44'),_0x1e2df9[_0xa0e3('0x45')]);loggerPredictive[_0xa0e3('0x40')]('Dropped\x20Exit:\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20',_0x1e2df9[_0xa0e3('0x46')]);loggerPredictive[_0xa0e3('0x40')]('AVG\x20Hold\x20Time:\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20',_0x1e2df9[_0xa0e3('0x47')]);loggerPredictive[_0xa0e3('0x40')]('AVG\x20Talk\x20Time:\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20',_0x1e2df9[_0xa0e3('0x48')]);loggerPredictive['info']('---------------------------');if(_0x1e2df9[_0xa0e3('0x49')]>0x0){if(!_[_0xa0e3('0x4a')](_0x1e2df9[_0xa0e3('0x48')])&&_0x1e2df9[_0xa0e3('0x48')]>0x0){return!![];}loggerPredictive[_0xa0e3('0x40')](_0xa0e3('0x4b'));if(!_[_0xa0e3('0x4a')](_0x1e2df9[_0xa0e3('0x47')])&&_0x1e2df9[_0xa0e3('0x47')]>0x0){return!![];}loggerPredictive[_0xa0e3('0x40')](_0xa0e3('0x4c'));}else{loggerPredictive[_0xa0e3('0x40')](_0xa0e3('0x4d'));}}else{loggerPredictive[_0xa0e3('0x40')](_0xa0e3('0x4e'));}return![];}function mergeDataErlangB(_0xd4512a){return function(_0x5e7008){loggerPredictive['info']('---------\x20ErlangB\x20---------');loggerPredictive[_0xa0e3('0x40')](_0xa0e3('0x4f'),_0x5e7008[_0xa0e3('0x50')]);loggerPredictive['info'](_0xa0e3('0x51'),_0x5e7008['erlangCallToSecond']);loggerPredictive['info']('Drop\x20Rate:\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20',_0x5e7008[_0xa0e3('0x52')]);loggerPredictive[_0xa0e3('0x40')](_0xa0e3('0x53'),_0x5e7008[_0xa0e3('0x54')]);loggerPredictive[_0xa0e3('0x40')](_0xa0e3('0x55'),_0x5e7008[_0xa0e3('0x52')]);loggerPredictive[_0xa0e3('0x40')](_0xa0e3('0x56'));_['merge'](_0xd4512a,_0x5e7008);};}function ifInterval(_0x26e5c9,_0x9310be){if(_[_0xa0e3('0x4a')](_0x9310be)){return![];}return utils[_0xa0e3('0x57')](undefined,_0x9310be)<_0x26e5c9*0x3c;}function clearPredictiveAttributes(_0x482836){if(_0x482836['startProgressive']){_0x482836[_0xa0e3('0x24')]=undefined;loggerPredictive[_0xa0e3('0x3a')](_0x482836['name'],_0xa0e3('0x58'));}if(_0x482836[_0xa0e3('0x23')]){_0x482836[_0xa0e3('0x23')]=undefined;loggerPredictive['debug'](_0x482836[_0xa0e3('0x3e')],'startPredictive\x20value\x20cleared');}if(_0x482836[_0xa0e3('0x59')]){clearInterval(_0x482836[_0xa0e3('0x59')]);_0x482836[_0xa0e3('0x59')]=undefined;loggerPredictive[_0xa0e3('0x3a')](_0x482836[_0xa0e3('0x3e')],'handlePredictive\x20interval\x20cleared');}}function loggerCatchPredictive(_0x5aab5d,_0x8c3b1a){return function(_0xc0bcbf){loggerPredictive[_0xa0e3('0x5a')](_0x8c3b1a['name'],_0x5aab5d);loggerPredictive[_0xa0e3('0x5a')](_0xc0bcbf['stack']);clearPredictiveAttributes(_0x8c3b1a);};}function loggerCatch(_0x3553be){return function(_0xd5ac5){logger[_0xa0e3('0x5a')](_0x3553be,util[_0xa0e3('0x3c')](_0xd5ac5,{'showHidden':![],'depth':null}));};}function sendMessageReschedule(_0x53c340){return function(_0x1ed5d9){if(isNotNull(_0x1ed5d9)&&isNotNull(_0x1ed5d9[0x0])){if(_0x1ed5d9[0x0]['contactsRescheduled']>0x0){_0x53c340['message']=utils[_0xa0e3('0x5b')][_0xa0e3('0x5c')];logger[_0xa0e3('0x40')](_0xa0e3('0x5d')+_0x53c340[_0xa0e3('0x3e')],_0x1ed5d9[0x0][_0xa0e3('0x5e')],_0xa0e3('0x5f'));}else{_0x53c340[_0xa0e3('0x60')]=utils[_0xa0e3('0x5b')][_0xa0e3('0x61')];logger[_0xa0e3('0x40')](_0xa0e3('0x62')+_0x53c340[_0xa0e3('0x3e')]);}}};}function createObjHistory(_0x584074,_0x1b4b13,_0x555472,_0x282798,_0x1a3694){_0x584074['message']=_0x555472;var _0x3cef4f=new Action(_0x584074,_0x1b4b13);var _0x16a46a=new History(_0x3cef4f);_0x16a46a[_0xa0e3('0x63')]=_0x282798;_0x16a46a[_0xa0e3('0x64')]=_0x1a3694;_0x16a46a[_0xa0e3('0x65')]=_0x3cef4f[_0xa0e3('0x66')];return _0x16a46a;}function unlockQueueStatus(_0x465e48,_0x5da54d){setTimeout(function(){if(_[_0xa0e3('0x4a')](_0x465e48[_0xa0e3('0x67')])){loggerBooked[_0xa0e3('0x5a')]('[unlockQueueStatus][undefined]',_0x5da54d);}_0x465e48['queueStatusComplete']=!![];loggerBooked[_0xa0e3('0x40')](_0xa0e3('0x68'),_0x5da54d,JSON['stringify'](_[_0xa0e3('0x69')](_0x465e48,[_0xa0e3('0x3e'),_0xa0e3('0x67')])));},0x1f3);}function checkInterval(_0x1666aa){return function(){if(!isNotNull(_0x1666aa[_0xa0e3('0x6a')])){_0x1666aa[_0xa0e3('0x60')]=utils[_0xa0e3('0x5b')]['NULL_INTERVAL'];throw _0x1666aa[_0xa0e3('0x3e')]+'\x20INTERVAL_IS_NULL';}if(!isNotNull(_0x1666aa[_0xa0e3('0x6a')]['Intervals'])){_0x1666aa[_0xa0e3('0x60')]=utils[_0xa0e3('0x5b')][_0xa0e3('0x6b')];throw _0x1666aa[_0xa0e3('0x3e')]+_0xa0e3('0x6c');}if(!isNotNull(_['isEmpty'](_0x1666aa[_0xa0e3('0x6a')][_0xa0e3('0x6d')]))){_0x1666aa[_0xa0e3('0x60')]=utils[_0xa0e3('0x5b')][_0xa0e3('0x6b')];throw _0x1666aa['name']+_0xa0e3('0x6c');}};}function checkIsIVRCampaignActive(_0x143de0){return function(){if(!utils[_0xa0e3('0x6e')](_0x143de0)){_0x143de0[_0xa0e3('0x60')]=utils[_0xa0e3('0x5b')][_0xa0e3('0x6f')];throw _0x143de0[_0xa0e3('0x3e')]+_0xa0e3('0x70');}};}function emitCampaignSummary(_0xaeec0f){if(utils[_0xa0e3('0x71')](_0xaeec0f)){emit(util[_0xa0e3('0x3d')](_0xa0e3('0x72'),_0xaeec0f['name']),_0xa0e3('0x73'),_0xaeec0f);}}function loggerCatchQueueSummary(_0x7e9668,_0x242b6f){return function(_0x2ce5c2){clearPredictiveAttributes(_0x242b6f);emitCampaignSummary(_0x242b6f);loggerSyncQueueSummary[_0xa0e3('0x3a')](_0x7e9668,util[_0xa0e3('0x3c')](_0x2ce5c2,{'showHidden':![],'depth':null}));};}function notSendMessagesCampaign(_0x439933){if(_0x439933[_0xa0e3('0x74')]){if(_0x439933[_0xa0e3('0x75')]===0x0){_0x439933[_0xa0e3('0x74')]=![];_0x439933[_0xa0e3('0x60')]=utils[_0xa0e3('0x5b')][_0xa0e3('0x6f')];loggerSyncQueueSummary['debug'](_0xa0e3('0x76'),_0x439933[_0xa0e3('0x3e')],'is\x20not\x20active');}else{_0x439933[_0xa0e3('0x60')]=utils['CAMPAIGN_STATUS'][_0xa0e3('0x77')];loggerSyncQueueSummary['debug'](_0xa0e3('0x76'),_0x439933[_0xa0e3('0x3e')],_0xa0e3('0x78'));}emitCampaignSummary(_0x439933);}}function myreject(_0x49ecb0){return function(_0x57a79a){return _0x49ecb0(msgResponse(_0xa0e3('0x79'),_0xa0e3('0x7a'),JSON[_0xa0e3('0x7b')](_0x57a79a)));};}Dialer[_0xa0e3('0x17')][_0xa0e3('0x7c')]=function(_0x3f434b){return!_[_0xa0e3('0x4a')](_0x3f434b)&&_0x3f434b&&!_[_0xa0e3('0x4a')](_0x3f434b[_0xa0e3('0x3e')])&&!_[_0xa0e3('0x4a')](_0x3f434b[_0xa0e3('0x7d')])&&_0x3f434b[_0xa0e3('0x7d')]&&(this[_0xa0e3('0x1f')][util[_0xa0e3('0x3d')](_0xa0e3('0x7e'),_0x3f434b[_0xa0e3('0x3e')])][_0xa0e3('0x7f')]==='reachable'||this[_0xa0e3('0x1f')][util[_0xa0e3('0x3d')]('SIP/%s',_0x3f434b['name'])][_0xa0e3('0x7f')]===_0xa0e3('0x80'));};Dialer[_0xa0e3('0x17')][_0xa0e3('0x81')]=function(_0x200375){var _0x31a035=this;return function(){if(!_0x31a035[_0xa0e3('0x7c')](_0x200375[_0xa0e3('0x82')])){if(!_0x31a035[_0xa0e3('0x7c')](_0x200375['TrunkBackup'])){_0x200375[_0xa0e3('0x60')]=utils[_0xa0e3('0x5b')][_0xa0e3('0x83')];throw _0x200375[_0xa0e3('0x3e')]+_0xa0e3('0x84');}}};};Dialer['prototype'][_0xa0e3('0x85')]=function(_0x2d1333,_0x49315f,_0x39dfe1,_0x405627){var _0x2bda77=this;return function(){var _0x1af496=!![];return _0x2bda77[_0xa0e3('0x86')](_0x2d1333,_0x49315f,_0x39dfe1,_0x405627,_0x1af496);};};Dialer[_0xa0e3('0x17')]['checkIfTimeIntervals']=function(_0x56a936,_0x2d24a3,_0x437faa,_0x5eff79){var _0x5c0a32=this;return function(){var _0x30d6ed=![];return _0x5c0a32[_0xa0e3('0x86')](_0x56a936[_0xa0e3('0x6d')],_0x2d24a3,_0x437faa,_0x5eff79,_0x30d6ed);};};Dialer[_0xa0e3('0x17')][_0xa0e3('0x86')]=function(_0x3892df,_0x4eb995,_0x5b08d2,_0x593db0,_0x441172){var _0x56ea20=[];return new Promise(function(_0x1cdd4b,_0x159de4){if(!isNotNull(_0x3892df)){_0x593db0[_0xa0e3('0x60')]=utils[_0xa0e3('0x5b')]['NULL_INTERVAL'];return _0x159de4(msgResponse(_0xa0e3('0x87'),_0xa0e3('0x88'),_0x5b08d2+_0xa0e3('0x89')));}if(_[_0xa0e3('0x8a')](_0x3892df)){_0x593db0[_0xa0e3('0x60')]=utils[_0xa0e3('0x5b')][_0xa0e3('0x8b')];return _0x159de4(msgResponse(_0xa0e3('0x87'),_0xa0e3('0x88'),_0x5b08d2+_0xa0e3('0x8c')));}if(_0x4eb995&&_[_0xa0e3('0x4a')](config[_0xa0e3('0x8d')][_0x4eb995])){_0x593db0[_0xa0e3('0x60')]=utils[_0xa0e3('0x5b')][_0xa0e3('0x8e')];return _0x159de4(msgResponse(_0xa0e3('0x87'),_0xa0e3('0x88'),_0x5b08d2+_0xa0e3('0x8f')+_0x4eb995));}if(_[_0xa0e3('0x90')](_0x3892df)){for(var _0x4f3934=0x0;_0x4f3934<_0x3892df[_0xa0e3('0x91')];_0x4f3934+=0x1){_0x56ea20[_0xa0e3('0x92')](ami[_0xa0e3('0x93')]({'action':_0xa0e3('0x94'),'command':util[_0xa0e3('0x3d')](_0xa0e3('0x95'),_0x3892df[_0x4f3934]['interval'],!_[_0xa0e3('0x4a')](config[_0xa0e3('0x8d')][_0x4eb995])?_0x4eb995:'')})[_0xa0e3('0x36')](function(_0x180fa2){return _0x180fa2['content'][_0xa0e3('0x96')](_0xa0e3('0x97'))>=0x0;})['catch'](myreject(_0x159de4)));}}else{_0x56ea20['push'](ami[_0xa0e3('0x93')]({'action':_0xa0e3('0x94'),'command':util[_0xa0e3('0x3d')]('iftime\x20%s,%s',_0x3892df,!_['isUndefined'](config[_0xa0e3('0x8d')][_0x4eb995])?_0x4eb995:'')})[_0xa0e3('0x36')](function(_0x2a4050){return _0x2a4050[_0xa0e3('0x98')][_0xa0e3('0x96')]('true')>=0x0;})[_0xa0e3('0x99')](myreject(_0x159de4)));}Promise['all'](_0x56ea20)[_0xa0e3('0x36')](function(_0x1d04dd){var _0x5cc76d=_[_0xa0e3('0x9a')](_0x1d04dd);if(_0x5cc76d){return _0x1cdd4b(_0x5cc76d);}else{_0x593db0[_0xa0e3('0x60')]=_0x441172?utils[_0xa0e3('0x5b')]['OVERTIME_GLOBAL_INTERVAL']:utils[_0xa0e3('0x5b')]['OVERTIME_INTERVAL'];return _0x159de4(msgResponse(_0xa0e3('0x9b'),'Failure',_0xa0e3('0x9c')+_0x441172+'\x20'+_0x5b08d2+_0xa0e3('0x9d')+util[_0xa0e3('0x3c')](_0x3892df,{'showHidden':![],'depth':null})+'Timezone:\x20'+_0x4eb995));}})['catch'](function(_0x76d277){return _0x159de4(msgResponse(_0xa0e3('0x87'),_0xa0e3('0x88'),JSON[_0xa0e3('0x7b')](_0x76d277)));});});};Dialer['prototype']['loopCampaigns']=function(){var _0x4cef65=this;return cmHopper[_0xa0e3('0x9e')]({'active':![]},{'where':{'active':!![]}})[_0xa0e3('0x36')](function(){setInterval(function(){_0x4cef65[_0xa0e3('0x9f')]();},0x3e8);});};Dialer[_0xa0e3('0x17')][_0xa0e3('0x9f')]=function(){var _0x592745=this;var _0x53cac5;for(var _0x4073bb in this[_0xa0e3('0x1d')]){if(typeof this[_0xa0e3('0x1d')][_0x4073bb]!=='undefined'){_0x53cac5=this[_0xa0e3('0x1d')][_0x4073bb];if(utils[_0xa0e3('0x71')](_0x53cac5)&&utils[_0xa0e3('0x6e')](_0x53cac5)){_0x53cac5['sendMessageOneNotActive']=!![];Promise['resolve']()[_0xa0e3('0x36')](checkIsIVRCampaignActive(_0x53cac5))[_0xa0e3('0x36')](checkInterval(_0x53cac5))[_0xa0e3('0x36')](_0x592745[_0xa0e3('0x81')](_0x53cac5))[_0xa0e3('0x36')](_0x592745['checkIfTime'](_0x53cac5['dialGlobalInterval'],_0x53cac5[_0xa0e3('0xa0')],_0x53cac5[_0xa0e3('0x3e')],_0x53cac5))[_0xa0e3('0x36')](_0x592745[_0xa0e3('0xa1')](_0x53cac5[_0xa0e3('0x6a')],_0x53cac5[_0xa0e3('0xa0')],_0x53cac5['name'],_0x53cac5))[_0xa0e3('0x36')](_0x592745[_0xa0e3('0xa2')](_0x53cac5))[_0xa0e3('0x99')](loggerCatchQueueSummary('[syncCampaigns]',_0x53cac5));}else{notSendMessagesCampaign(_0x53cac5);}}}};Dialer['prototype'][_0xa0e3('0xa3')]=function(_0x2ddbd0){if(_0x2ddbd0[_0xa0e3('0xa4')]!==_0xa0e3('0xa')){clearPredictiveAttributes(_0x2ddbd0);}switch(_0x2ddbd0[_0xa0e3('0xa4')]){case'progressive':this[_0xa0e3('0xa5')](_0x2ddbd0,0x1);break;case _0xa0e3('0xa6'):this[_0xa0e3('0xa5')](_0x2ddbd0,_0x2ddbd0[_0xa0e3('0xa7')]);break;case _0xa0e3('0xa'):this[_0xa0e3('0xa')](_0x2ddbd0);break;case _0xa0e3('0x9'):this['handlePower'](_0x2ddbd0,0x1);break;default:logger[_0xa0e3('0x5a')](_0xa0e3('0xa8'),_0x2ddbd0[_0xa0e3('0x3e')],_0xa0e3('0xa9'));}};Dialer['prototype'][_0xa0e3('0x87')]=function(_0x35f74e,_0x6b35e9){var _0x792a7d=_0x35f74e[_0xa0e3('0xa0')];var _0xcda35a=_0x6b35e9?_0x35f74e[_0xa0e3('0xaa')]:_0x35f74e['Interval'][_0xa0e3('0x6d')];logger[_0xa0e3('0xab')](_0xa0e3('0xac'),_0xcda35a,_0x792a7d,_0x35f74e['name'],util[_0xa0e3('0x3d')](_0xa0e3('0xad'),_0x35f74e[_0xa0e3('0x3e')],_0x35f74e['id']));var _0x3eb177=null;return Interval[_0xa0e3('0xae')](_0xcda35a,_0x792a7d)[_0xa0e3('0x36')](function(_0x5c95fb){if(_0x5c95fb===!![]){return _0x5c95fb;}else{_0x35f74e[_0xa0e3('0x60')]=_0x6b35e9?utils['CAMPAIGN_STATUS']['OVERTIME_GLOBAL_INTERVAL']:utils[_0xa0e3('0x5b')][_0xa0e3('0xaf')];_0x3eb177=msgResponse('[ifTime][promiseAll]',_0xa0e3('0x88'),_0xa0e3('0x9c')+_0x6b35e9+'\x20'+_0x35f74e['name']+'\x20Interval\x20is\x20overtime:\x20'+util[_0xa0e3('0x3c')](_0xcda35a,{'showHidden':![],'depth':null})+_0xa0e3('0xb0')+_0x792a7d);}if(_0x3eb177!==null){logger[_0xa0e3('0xab')]('Dialer::ifTime()\x20errResponse\x20NOT\x20NULL:',_0x3eb177);_0x3eb177['isGlobal']=_0x6b35e9;throw _0x3eb177;}})[_0xa0e3('0x99')](function(_0x17c5a8){logger[_0xa0e3('0x5a')](_0xa0e3('0xb1'),_0x17c5a8);throw msgResponse(_0xa0e3('0x79'),_0xa0e3('0x7a'),util[_0xa0e3('0x3c')](_0x17c5a8,{'showHidden':![],'depth':null}));});};Dialer[_0xa0e3('0x17')][_0xa0e3('0x28')]=function(_0x36293d){if(this['voiceQueues'][_0x36293d[_0xa0e3('0xb2')]]){if(this[_0xa0e3('0x22')][_0x36293d[_0xa0e3('0xb3')]]&&this['uniqueId'][_0x36293d[_0xa0e3('0xb3')]]['type']!==_0xa0e3('0xb4')){utils['decrementOriginate'](this[_0xa0e3('0x1c')][_0x36293d[_0xa0e3('0xb2')]],_0xa0e3('0xb5'));this[_0xa0e3('0x22')][_0x36293d[_0xa0e3('0xb3')]][_0xa0e3('0xb6')]=moment()[_0xa0e3('0x3d')](_0xa0e3('0xb7'));}}};Dialer[_0xa0e3('0x17')]['syncAgentComplete']=function(_0x3df956){var _0x2f0276=this[_0xa0e3('0x22')][_0x3df956['uniqueid']];if(this['voiceQueues'][_0x3df956[_0xa0e3('0xb2')]]){if(_0x2f0276&&_0x2f0276[_0xa0e3('0x38')]!==_0xa0e3('0xb4')){delete this['uniqueId'][_0x3df956['uniqueid']];this[_0xa0e3('0x1c')][_0x3df956['queue']][_0xa0e3('0xb8')]+=0x1;var _0x26e2bd=new AgentComplete(_0x2f0276,_0x3df956);if(_0x3df956['reason']===_0xa0e3('0xb9')){_0x26e2bd[_0xa0e3('0xba')]=this[_0xa0e3('0x1c')][_0x3df956[_0xa0e3('0xb2')]][_0xa0e3('0xbb')]&&this[_0xa0e3('0x1c')][_0x3df956['queue']][_0xa0e3('0xbc')]?moment()[_0xa0e3('0x3d')](_0xa0e3('0xb7')):undefined;}hopperUtils[_0xa0e3('0xbd')](_0x26e2bd)[_0xa0e3('0x99')](loggerCatch(_0xa0e3('0xbe')));hopperUtils[_0xa0e3('0xbf')](_0x26e2bd)[_0xa0e3('0x99')](loggerCatch(_0xa0e3('0xc0')));}}};Dialer['prototype'][_0xa0e3('0x29')]=function(_0x484a9a){var _0x5e4f11=this[_0xa0e3('0x22')][_0x484a9a[_0xa0e3('0xb3')]];var _0x1e9a29=this;var _0x42757b=![];var _0x2eb4c2;var _0x160bac;if(this[_0xa0e3('0x1c')][_0x484a9a['queue']]){if(_0x5e4f11&&_0x5e4f11[_0xa0e3('0x38')]!==_0xa0e3('0xb4')){delete this[_0xa0e3('0x22')][_0x484a9a['uniqueid']];utils[_0xa0e3('0xc1')](this['voiceQueues'][_0x484a9a['queue']],_0xa0e3('0xc2'));_0x5e4f11[_0xa0e3('0xc3')]=moment()[_0xa0e3('0x3d')](_0xa0e3('0xb7'));var _0x94a9ec=new QueueCallerAbandon(_0x5e4f11,_0x484a9a);if(utils['getSeconds'](_0x5e4f11[_0xa0e3('0xc3')],_0x5e4f11['responsetime'])>=_0x5e4f11[_0xa0e3('0xc4')]){this[_0xa0e3('0x1c')][_0x484a9a[_0xa0e3('0xb2')]][_0xa0e3('0x45')]+=0x1;this[_0xa0e3('0x1c')][_0x484a9a[_0xa0e3('0xb2')]][_0xa0e3('0xc5')]+=0x1;this[_0xa0e3('0x1c')][_0x484a9a[_0xa0e3('0xb2')]][_0xa0e3('0xc6')]+=0x1;_0x94a9ec[_0xa0e3('0x63')]=0xa;_0x94a9ec[_0xa0e3('0x64')]=_0xa0e3('0xc7');_0x94a9ec[_0xa0e3('0xc8')]=_0xa0e3('0xc9');_0x94a9ec[_0xa0e3('0xba')]=this['voiceQueues'][_0x484a9a[_0xa0e3('0xb2')]][_0xa0e3('0xbb')]?moment()[_0xa0e3('0x3d')](_0xa0e3('0xb7')):undefined;_0x94a9ec[_0xa0e3('0xca')]+=0x1;_0x94a9ec[_0xa0e3('0xcb')]+=0x1;_0x2eb4c2=this[_0xa0e3('0x1c')][_0x484a9a[_0xa0e3('0xb2')]][_0xa0e3('0xcc')];_0x160bac=this[_0xa0e3('0x1c')][_0x484a9a[_0xa0e3('0xb2')]][_0xa0e3('0xcd')];hopperUtils[_0xa0e3('0xce')](_0x94a9ec,_0x94a9ec[_0xa0e3('0x63')],_0x5e4f11[_0xa0e3('0xcf')])[_0xa0e3('0x36')](function(_0x4f9ebe){_0x42757b=_0x4f9ebe[_0xa0e3('0xd0')]==0x1;if(_0x94a9ec[_0xa0e3('0xca')]>=_0x1e9a29[_0xa0e3('0x1c')][_0x484a9a[_0xa0e3('0xb2')]][_0xa0e3('0xd1')]){_0x1e9a29[_0xa0e3('0xd2')](_0x94a9ec,_0x4f9ebe[_0xa0e3('0xd0')]);}else{hopperUtils[_0xa0e3('0xd3')]({'active':![],'countdropretry':_0x94a9ec[_0xa0e3('0xca')],'scheduledat':moment()[_0xa0e3('0xd4')](_0x1e9a29[_0xa0e3('0x1c')][_0x484a9a['queue']][_0xa0e3('0xcc')],_0xa0e3('0xd5'))['format'](_0xa0e3('0xb7')),'ContactId':_0x5e4f11[_0xa0e3('0xd6')],'ListId':_0x5e4f11[_0xa0e3('0xd7')],'VoiceQueueId':_0x5e4f11[_0xa0e3('0xd8')]||undefined,'CampaignId':_0x5e4f11[_0xa0e3('0xd9')]||undefined})[_0xa0e3('0x99')](loggerCatch(_0xa0e3('0xda')));var _0x4e5543=new History(_0x94a9ec);_0x4e5543[_0xa0e3('0x63')]=0xa;_0x4e5543['statedesc']=_0xa0e3('0xc7');_0x4e5543[_0xa0e3('0x66')]=moment()[_0xa0e3('0x3d')]('YYYY-MM-DD\x20HH:mm:ss');_0x4e5543[_0xa0e3('0x65')]=_0x4e5543['starttime'];_0x4e5543[_0xa0e3('0xdb')]=_0x94a9ec['calleridname'];_0x4e5543['calleridnum']=_0x94a9ec[_0xa0e3('0xdc')];hopperUtils[_0xa0e3('0xbd')](_0x4e5543)[_0xa0e3('0x99')](loggerCatch('[syncAgentComplete][createHistory][10]'));}})[_0xa0e3('0x36')](function(){if(_0x42757b)hopperUtils[_0xa0e3('0xdd')](_0x94a9ec,_0x2eb4c2,_0x160bac)['then'](function(){return 0x1;});});}else{this[_0xa0e3('0x1c')][_0x484a9a[_0xa0e3('0xb2')]][_0xa0e3('0x46')]+=0x1;this[_0xa0e3('0x1c')][_0x484a9a[_0xa0e3('0xb2')]][_0xa0e3('0xde')]+=0x1;_0x94a9ec['state']=0xb;_0x94a9ec['statedesc']=_0xa0e3('0xdf');_0x94a9ec[_0xa0e3('0xc8')]='CALLEREXIT';_0x94a9ec[_0xa0e3('0xe0')]+=0x1;_0x94a9ec[_0xa0e3('0xcb')]+=0x1;_0x2eb4c2=this[_0xa0e3('0x1c')][_0x484a9a['queue']]['dialAbandonedRetryFrequency'];_0x160bac=this['voiceQueues'][_0x484a9a[_0xa0e3('0xb2')]][_0xa0e3('0xcd')];hopperUtils[_0xa0e3('0xce')](_0x94a9ec,_0x94a9ec[_0xa0e3('0x63')],_0x5e4f11['voiceQueue'])['then'](function(_0x464524){if(_0x94a9ec[_0xa0e3('0xe0')]>=_0x1e9a29[_0xa0e3('0x1c')][_0x484a9a[_0xa0e3('0xb2')]][_0xa0e3('0xe1')]){_0x1e9a29['queueCallerAbandonCreateState'](_0x94a9ec,_0x464524[_0xa0e3('0xd0')]);}else{hopperUtils[_0xa0e3('0xd3')]({'active':![],'countabandonedretry':_0x94a9ec['countabandonedretry'],'scheduledat':moment()[_0xa0e3('0xd4')](_0x1e9a29[_0xa0e3('0x1c')][_0x484a9a[_0xa0e3('0xb2')]][_0xa0e3('0xe2')],_0xa0e3('0xd5'))[_0xa0e3('0x3d')](_0xa0e3('0xb7')),'ContactId':_0x5e4f11['ContactId'],'ListId':_0x5e4f11[_0xa0e3('0xd7')],'VoiceQueueId':_0x5e4f11[_0xa0e3('0xd8')]||undefined,'CampaignId':_0x5e4f11[_0xa0e3('0xd9')]||undefined})['catch'](loggerCatch(_0xa0e3('0xe3')));var _0x137414=new History(_0x94a9ec);_0x137414[_0xa0e3('0x63')]=0xb;_0x137414[_0xa0e3('0x64')]='Abandoned';_0x137414[_0xa0e3('0x66')]=moment()['format']('YYYY-MM-DD\x20HH:mm:ss');_0x137414[_0xa0e3('0x65')]=_0x137414[_0xa0e3('0x66')];_0x137414['calleridname']=_0x94a9ec['calleridname'];_0x137414[_0xa0e3('0xdc')]=_0x94a9ec['calleridnum'];hopperUtils[_0xa0e3('0xbd')](_0x137414)[_0xa0e3('0x99')](loggerCatch(_0xa0e3('0xe4')));}})[_0xa0e3('0x36')](function(){if(_0x42757b)hopperUtils[_0xa0e3('0xdd')](_0x94a9ec,_0x2eb4c2,_0x160bac)[_0xa0e3('0x36')](function(){return 0x1;});});}}}};Dialer[_0xa0e3('0x17')]['syncNewExten']=function(_0x2de29c){if(this[_0xa0e3('0x21')][_0x2de29c[_0xa0e3('0xb3')]]){this[_0xa0e3('0x21')][_0x2de29c[_0xa0e3('0xb3')]][_0xa0e3('0xe5')]=_0x2de29c[_0xa0e3('0xe5')];}if(this['uniqueId'][_0x2de29c[_0xa0e3('0xb3')]]){this['uniqueId'][_0x2de29c[_0xa0e3('0xb3')]][_0xa0e3('0xe5')]=_0x2de29c['channel'];}};Dialer[_0xa0e3('0x17')]['syncQueueMember']=function(_0x1a689b){if(!this['actions'][_0x1a689b['actionid']]){return;}var _0x31b764=this[_0xa0e3('0x1c')][this[_0xa0e3('0x21')][_0x1a689b[_0xa0e3('0xe6')]][_0xa0e3('0xb2')]][_0xa0e3('0xe7')]||_0xa0e3('0xe8');if(_0x31b764==='roundrobin'){if(this[_0xa0e3('0x21')][_0x1a689b['actionid']]&&_[_0xa0e3('0xe9')](this[_0xa0e3('0x21')][_0x1a689b[_0xa0e3('0xe6')]][_0xa0e3('0xea')])&&_0x1a689b[_0xa0e3('0x7f')]==='1'&&_0x1a689b[_0xa0e3('0xeb')]==='0'){if(this[_0xa0e3('0x1e')][_0x1a689b['stateinterface']]){if(!this[_0xa0e3('0x1e')][_0x1a689b[_0xa0e3('0xec')]][_0xa0e3('0xea')]){this[_0xa0e3('0x1e')][_0x1a689b[_0xa0e3('0xec')]][_0xa0e3('0xea')]=!![];this[_0xa0e3('0x21')][_0x1a689b[_0xa0e3('0xe6')]][_0xa0e3('0xea')]=!![];this['actions'][_0x1a689b[_0xa0e3('0xe6')]][_0xa0e3('0xec')]=_0x1a689b['stateinterface'];}}}}else if(_0x31b764===_0xa0e3('0xe8')){if(this[_0xa0e3('0x21')][_0x1a689b['actionid']]){if(this[_0xa0e3('0x1e')][_0x1a689b[_0xa0e3('0xec')]]){this[_0xa0e3('0x21')][_0x1a689b[_0xa0e3('0xe6')]][_0xa0e3('0xec')]=_0x1a689b['stateinterface'];if(_[_0xa0e3('0xe9')](this[_0xa0e3('0x25')][this[_0xa0e3('0x21')][_0x1a689b[_0xa0e3('0xe6')]][_0xa0e3('0xb2')]])){this[_0xa0e3('0x25')][this[_0xa0e3('0x21')][_0x1a689b[_0xa0e3('0xe6')]]['queue']]=[];}this['queueBooked'][this[_0xa0e3('0x21')][_0x1a689b['actionid']][_0xa0e3('0xb2')]][_0xa0e3('0x92')](_[_0xa0e3('0xed')](_[_0xa0e3('0x69')](this[_0xa0e3('0x21')][_0x1a689b[_0xa0e3('0xe6')]],[_0xa0e3('0xee'),_0xa0e3('0xec')]),{'status':_0x1a689b[_0xa0e3('0x7f')],'paused':_0x1a689b[_0xa0e3('0xeb')]}));}}}};Dialer['prototype'][_0xa0e3('0xef')]=function(_0x4913f4){if(!this['actions'][_0x4913f4[_0xa0e3('0xe6')]]){return;}var _0x9d87ec=this;var _0x247372=this[_0xa0e3('0x1c')][this[_0xa0e3('0x21')][_0x4913f4[_0xa0e3('0xe6')]][_0xa0e3('0xb2')]];var _0x278c48=_0x247372[_0xa0e3('0xe7')]||_0xa0e3('0xe8');if(_0x278c48===_0xa0e3('0xf0')){if(this[_0xa0e3('0x21')][_0x4913f4[_0xa0e3('0xe6')]]&&this['actions'][_0x4913f4['actionid']][_0xa0e3('0xec')]){this[_0xa0e3('0x1b')][_0xa0e3('0xf1')](this['actions'][_0x4913f4['actionid']][_0xa0e3('0xee')],this['actions'][_0x4913f4['actionid']][_0xa0e3('0xec')])[_0xa0e3('0x99')](function(_0x1fccb6){logger[_0xa0e3('0x5a')](_0xa0e3('0xf2'),util['inspect'](_0x1fccb6,{'showHidden':![],'depth':null}));})['finally'](function(){utils['decrementOriginate'](_0x9d87ec[_0xa0e3('0x1c')][_0x9d87ec[_0xa0e3('0x21')][_0x4913f4[_0xa0e3('0xe6')]][_0xa0e3('0xb2')]],_0xa0e3('0xf3'));_0x9d87ec['agents'][_0x9d87ec[_0xa0e3('0x21')][_0x4913f4[_0xa0e3('0xe6')]][_0xa0e3('0xec')]][_0xa0e3('0xea')]=![];delete _0x9d87ec[_0xa0e3('0x21')][_0x4913f4[_0xa0e3('0xe6')]];unlockQueueStatus(_0x247372);});}else{utils[_0xa0e3('0xc1')](this[_0xa0e3('0x1c')][this['actions'][_0x4913f4['actionid']][_0xa0e3('0xb2')]],_0xa0e3('0xf3'));hopperUtils['rescheduleContact']({'active':![],'ContactId':this['actions'][_0x4913f4[_0xa0e3('0xe6')]][_0xa0e3('0xd6')],'ListId':this[_0xa0e3('0x21')][_0x4913f4[_0xa0e3('0xe6')]]['ListId'],'VoiceQueueId':this[_0xa0e3('0x21')][_0x4913f4['actionid']][_0xa0e3('0xd8')]||undefined,'CampaignId':this[_0xa0e3('0x21')][_0x4913f4[_0xa0e3('0xe6')]]['CampaignId']||undefined})[_0xa0e3('0x99')](loggerCatch(_0xa0e3('0xf4')));delete this[_0xa0e3('0x21')][_0x4913f4[_0xa0e3('0xe6')]];unlockQueueStatus(_0x247372);}}else if(_0x278c48==='rrmemory'){var _0xac2cb3;if(this[_0xa0e3('0x21')][_0x4913f4[_0xa0e3('0xe6')]]&&!_[_0xa0e3('0x8a')](this['queueBooked'][this['actions'][_0x4913f4[_0xa0e3('0xe6')]][_0xa0e3('0xb2')]])){if(this[_0xa0e3('0x26')][_0x9d87ec['actions'][_0x4913f4[_0xa0e3('0xe6')]][_0xa0e3('0xb2')]]){this['queueBookedRR'][_0x9d87ec[_0xa0e3('0x21')][_0x4913f4['actionid']][_0xa0e3('0xb2')]]=this[_0xa0e3('0x26')][this['actions'][_0x4913f4[_0xa0e3('0xe6')]][_0xa0e3('0xb2')]]?this['queueBookedRR'][this['actions'][_0x4913f4[_0xa0e3('0xe6')]][_0xa0e3('0xb2')]]:this[_0xa0e3('0x25')][this[_0xa0e3('0x21')][_0x4913f4[_0xa0e3('0xe6')]][_0xa0e3('0xb2')]]?this[_0xa0e3('0x25')][this[_0xa0e3('0x21')][_0x4913f4[_0xa0e3('0xe6')]]['queue']][_0xa0e3('0xf5')]||0x0:0x0;}this['queueBooked'][this[_0xa0e3('0x21')][_0x4913f4[_0xa0e3('0xe6')]]['queue']][_0xa0e3('0xf5')]=this[_0xa0e3('0x26')][this['actions'][_0x4913f4['actionid']][_0xa0e3('0xb2')]];for(var _0x1ee5db=0x0;_0x1ee5db=_0x3f94aa[_0xa0e3('0x118')]){_0xd77107[_0xa0e3('0x119')](_0x5a3372,_0x5032e1,_0x2db415,_0xa0e3('0x11a'));}else{if(_0x5a3372[_0xa0e3('0x110')]>=_0x3f94aa[_0xa0e3('0x11b')]){_0xd77107['createStateFinal'](_0x5a3372,_0x5032e1,_0x2db415,_0xa0e3('0x11c'));}else{hopperUtils[_0xa0e3('0xd3')]({'active':![],'countmachineretry':_0x5a3372[_0xa0e3('0x110')],'scheduledat':moment()[_0xa0e3('0xd4')](_0x3f94aa['dialMachineRetryFrequency'],_0xa0e3('0xd5'))['format'](_0xa0e3('0xb7')),'ContactId':_0x5a3372[_0xa0e3('0xd6')],'ListId':_0x5a3372['ListId'],'VoiceQueueId':_0x5a3372[_0xa0e3('0xd8')]||undefined,'CampaignId':_0x5a3372[_0xa0e3('0xd9')]||undefined})[_0xa0e3('0x99')](loggerCatch(_0xa0e3('0x11d')));_0x5032e1({'reschedule':0x1});}}});}if(_0x5cbc97[_0xa0e3('0x38')]==='ivr'&&this[_0xa0e3('0x1d')][_0x5cbc97['queue']][_0xa0e3('0x106')]&&_0x2c316b['value']===_0xa0e3('0x108')){delete this[_0xa0e3('0x22')][_0x2c316b['uniqueid']];utils[_0xa0e3('0xc1')](this['campaigns'][_0x5cbc97[_0xa0e3('0xb2')]],_0xa0e3('0x109'));_0x15b1a0=new Hangup(_0x5cbc97,_0x2c316b);_0x15b1a0[_0xa0e3('0x63')]=0x12;_0x15b1a0['statedesc']='HangupInAMD';_0x15b1a0[_0xa0e3('0x10c')]=_0xa0e3('0x10d');ami['emit'](_0xa0e3('0x10f'),ut[_0xa0e3('0x112')](_0x15b1a0,_0xa0e3('0x111')));this[_0xa0e3('0x11e')](_0x15b1a0,_0xa0e3('0x11f'),'[syncHangupInAMDIvr]');}if(_0x5cbc97[_0xa0e3('0x38')]===_0xa0e3('0xb4')&&this[_0xa0e3('0x1d')][_0x5cbc97[_0xa0e3('0xb2')]][_0xa0e3('0x106')]&&_0x2c316b[_0xa0e3('0x107')]===_0xa0e3('0x120')){return new Promise(function(_0x4b32f5,_0x3dca1a){delete _0xd77107[_0xa0e3('0x22')][_0x2c316b[_0xa0e3('0xb3')]];utils['decrementOriginate'](_0xd77107[_0xa0e3('0x1d')][_0x5cbc97['queue']],_0xa0e3('0x109'));_0xd77107[_0xa0e3('0x1d')][_0x5cbc97[_0xa0e3('0xb2')]][_0xa0e3('0xb8')]+=0x1;_0xd77107[_0xa0e3('0x1d')][_0x5cbc97[_0xa0e3('0xb2')]]['outboundAnswerAgiCallsDay']+=0x1;var _0x35097c=_0xd77107[_0xa0e3('0x1d')][_0x5cbc97['queue']];var _0x4742c1=new Hangup(_0x5cbc97,_0x2c316b);_0x4742c1[_0xa0e3('0x63')]=0x13;_0x4742c1[_0xa0e3('0x64')]='Machine';_0x4742c1['membername']=_0xa0e3('0x10d');_0x4742c1[_0xa0e3('0x110')]+=0x1;_0x4742c1['countglobal']+=0x1;_0x4742c1[_0xa0e3('0x111')]=!![];ami[_0xa0e3('0x10e')](_0xa0e3('0x10f'),ut[_0xa0e3('0x112')](_0x4742c1,'amd'));hopperUtils[_0xa0e3('0xbd')](_0x4742c1)[_0xa0e3('0x99')](loggerCatch(_0xa0e3('0x113')));if(_0x4742c1[_0xa0e3('0x114')]+_0x4742c1['countcongestionretry']+_0x4742c1[_0xa0e3('0x115')]+_0x4742c1['countnosuchnumberretry']+_0x4742c1[_0xa0e3('0xca')]+_0x4742c1['countabandonedretry']+_0x4742c1[_0xa0e3('0x110')]+_0x4742c1['countagentrejectretry']>=_0x35097c[_0xa0e3('0x118')]){_0xd77107[_0xa0e3('0x119')](_0x4742c1,_0x4b32f5,_0x3dca1a,_0xa0e3('0x11a'));}else{if(_0x4742c1[_0xa0e3('0x110')]>=_0x35097c['dialMachineMaxRetry']){_0xd77107[_0xa0e3('0x121')](_0x4742c1,_0x4b32f5,_0x3dca1a,'reason\x2019\x20machine....');}else{hopperUtils[_0xa0e3('0xd3')]({'active':![],'countmachineretry':_0x4742c1[_0xa0e3('0x110')],'scheduledat':moment()[_0xa0e3('0xd4')](_0x35097c[_0xa0e3('0x122')],_0xa0e3('0xd5'))[_0xa0e3('0x3d')](_0xa0e3('0xb7')),'ContactId':_0x4742c1[_0xa0e3('0xd6')],'ListId':_0x4742c1['ListId'],'VoiceQueueId':_0x4742c1[_0xa0e3('0xd8')]||undefined,'CampaignId':_0x4742c1['CampaignId']||undefined})[_0xa0e3('0x99')](loggerCatch(_0xa0e3('0x11d')));_0x4b32f5({'reschedule':0x1});}}});}}};Dialer[_0xa0e3('0x17')]['syncHangup']=function(_0x2785d3){var _0x55ae2f=this['uniqueId'][_0x2785d3[_0xa0e3('0xb3')]];var _0xe5b3ba;if(!_0x55ae2f){return;}if(_0x55ae2f['type']==='ivr'){delete this['uniqueId'][_0x2785d3[_0xa0e3('0xb3')]];utils[_0xa0e3('0xc1')](this['campaigns'][_0x55ae2f[_0xa0e3('0xb2')]],_0xa0e3('0x123'));this['campaigns'][_0x55ae2f[_0xa0e3('0xb2')]][_0xa0e3('0x124')]+=0x1;if(_0x2785d3['cause-txt']===_0xa0e3('0x125')){const _0x2e0adb=new AgentComplete(_0x55ae2f,_0x2785d3);_0x2e0adb[_0xa0e3('0xd9')]=this[_0xa0e3('0x1d')][_0x55ae2f[_0xa0e3('0xb2')]]['id'];hopperUtils[_0xa0e3('0xbd')](_0x2e0adb)[_0xa0e3('0x99')](loggerCatch(_0xa0e3('0x126')));hopperUtils[_0xa0e3('0xbf')](_0x2e0adb)['catch'](loggerCatch(_0xa0e3('0x127')));}else{_0xe5b3ba=new Hangup(_0x55ae2f,_0x2785d3);hopperUtils[_0xa0e3('0xbd')](_0xe5b3ba)[_0xa0e3('0x99')](loggerCatch(_0xa0e3('0x128')));hopperUtils['moveContactManagedDialer'](_0xe5b3ba)[_0xa0e3('0x99')](loggerCatch(_0xa0e3('0x129')));}}else{if(isNotNull(this[_0xa0e3('0x1c')][_0x55ae2f[_0xa0e3('0xb2')]][_0xa0e3('0x12a')])){delete this[_0xa0e3('0x22')][_0x2785d3['uniqueid']];utils['decrementOriginate'](this[_0xa0e3('0x1c')][_0x55ae2f['queue']],_0xa0e3('0x123'));this[_0xa0e3('0x1c')][_0x55ae2f[_0xa0e3('0xb2')]][_0xa0e3('0xb8')]+=0x1;this[_0xa0e3('0x1c')][_0x55ae2f[_0xa0e3('0xb2')]][_0xa0e3('0x10a')]+=0x1;_0xe5b3ba=new Hangup(_0x55ae2f,_0x2785d3);_0xe5b3ba[_0xa0e3('0x63')]=0x10;_0xe5b3ba[_0xa0e3('0x64')]='AnswerAGI';_0xe5b3ba['membername']=_0xa0e3('0x12b');hopperUtils[_0xa0e3('0xbd')](_0xe5b3ba)[_0xa0e3('0x99')](loggerCatch('[syncHangupIvr][createHistory]'));hopperUtils[_0xa0e3('0xbf')](_0xe5b3ba)[_0xa0e3('0x99')](loggerCatch('[syncHangupIvr]'));}else{delete this['uniqueId'][_0x2785d3[_0xa0e3('0xb3')]];utils['decrementOriginate'](this['voiceQueues'][_0x55ae2f[_0xa0e3('0xb2')]],_0xa0e3('0x12c'));if(_0x2785d3[_0xa0e3('0x12d')]===_0xa0e3('0x125')){this[_0xa0e3('0x1c')][_0x55ae2f[_0xa0e3('0xb2')]][_0xa0e3('0xb8')]+=0x1;const _0x8b84e7=new AgentComplete(_0x55ae2f,_0x2785d3);_0x8b84e7[_0xa0e3('0xd8')]=this[_0xa0e3('0x1c')][_0x55ae2f['queue']]['id'];hopperUtils[_0xa0e3('0xbd')](_0x8b84e7)['catch'](loggerCatch('[syncAgentComplete][createHistory]'));hopperUtils['moveContactManagedDialer'](_0x8b84e7)['catch'](loggerCatch(_0xa0e3('0xc0')));}else{this[_0xa0e3('0x1c')][_0x55ae2f[_0xa0e3('0xb2')]][_0xa0e3('0x12e')]+=0x1;_0xe5b3ba=new Hangup(_0x55ae2f,_0x2785d3);_0xe5b3ba[_0xa0e3('0x63')]=0xc;_0xe5b3ba[_0xa0e3('0x64')]=_0x2785d3['cause-txt'];_0xe5b3ba[_0xa0e3('0x10c')]=_0xa0e3('0x12f');hopperUtils[_0xa0e3('0xbd')](_0xe5b3ba)[_0xa0e3('0x99')](loggerCatch(_0xa0e3('0x130')));hopperUtils[_0xa0e3('0xbf')](_0xe5b3ba)[_0xa0e3('0x99')](loggerCatch(_0xa0e3('0x123')));}}}};Dialer[_0xa0e3('0x17')][_0xa0e3('0xc')]=function(_0x2bf73f){var _0x360ea6=this;if(!_0x360ea6[_0xa0e3('0x27')][_0x2bf73f[_0xa0e3('0x3e')]]){_0x360ea6[_0xa0e3('0x27')][_0x2bf73f[_0xa0e3('0x3e')]]={'running':![]};}else if(_0x360ea6['queuesSummary'][_0x2bf73f[_0xa0e3('0x3e')]][_0xa0e3('0x131')]===!![]){return;}else if(_0x360ea6['queuesSummary'][_0x2bf73f[_0xa0e3('0x3e')]][_0xa0e3('0x131')]===![]){_0x360ea6['queuesSummary'][_0x2bf73f[_0xa0e3('0x3e')]]['running']=!![];}var _0x2105da=_0x360ea6[_0xa0e3('0x1c')][_0x2bf73f['name']];var _0x37c88a=_0x2105da[_0xa0e3('0x60')]!==utils['CAMPAIGN_STATUS']['INACTIVE'];var _0x529864=utils[_0xa0e3('0x132')](_0x2105da);_0x2105da[_0xa0e3('0x133')]=utils[_0xa0e3('0x134')](_0x2105da,_0x360ea6[_0xa0e3('0x1f')]);Promise[_0xa0e3('0x135')]()[_0xa0e3('0x36')](function(){if(_0x2105da[_0xa0e3('0x133')]===utils['CAMPAIGN_STATUS'][_0xa0e3('0x6f')]){if(_0x37c88a){clearPredictiveAttributes(_0x2105da);_0x2bf73f[_0xa0e3('0x23')]=undefined;_0x2bf73f['startProgressive']=undefined;}if(_0x2105da[_0xa0e3('0x133')]===utils['CAMPAIGN_STATUS'][_0xa0e3('0x6f')]){_0x2bf73f[_0xa0e3('0x136')]=0x0;_0x2bf73f['paused']=0x0;_0x2bf73f['inUse']=0x0;_0x2bf73f[_0xa0e3('0x137')]=0x0;_0x2bf73f[_0xa0e3('0x138')]=0x0;}}else if(_0x2105da[_0xa0e3('0x133')]===utils['CAMPAIGN_STATUS'][_0xa0e3('0x139')]&&!_0x529864){return _0x360ea6[_0xa0e3('0x87')](_0x2105da,!![])['then'](function(){return _0x360ea6['ifTime'](_0x2105da,![]);})[_0xa0e3('0x36')](function(){return _0x360ea6['checkDialMethod'](_0x2105da);})[_0xa0e3('0x99')](function(_0x1fc58a){loggerSyncQueueSummary[_0xa0e3('0x3a')](_0xa0e3('0x13a'),util['inspect'](_0x1fc58a,{'showHidden':![],'depth':null}));clearPredictiveAttributes(_0x2105da);});}else{clearPredictiveAttributes(_0x2105da);}})[_0xa0e3('0x36')](function(){var _0x5191b7=_0x2bf73f['compareToOutboundQueue'](_0x2105da);if(_0x5191b7||_0x2105da['queueSummaryCountersUpdated']){_0x2105da[_0xa0e3('0x13b')]=![];_0x2bf73f[_0xa0e3('0x13c')](_0x2105da);Object['assign'](_0x2105da,_0x2bf73f);emitOutboundVoiceQueueSummary(_0x2bf73f);}_0x360ea6[_0xa0e3('0x27')][_0x2105da[_0xa0e3('0x3e')]]['running']=![];})['catch'](function(_0x59a334){logger[_0xa0e3('0x5a')](_0xa0e3('0x13a'),util['inspect'](_0x59a334,{'showHidden':![],'depth':null}));_0x360ea6['queuesSummary'][_0x2105da[_0xa0e3('0x3e')]][_0xa0e3('0x131')]=![];});};Dialer[_0xa0e3('0x17')][_0xa0e3('0x13d')]=_[_0xa0e3('0x13e')](function(){var _0x47cc16=_['filter'](this[_0xa0e3('0x1c')],function(_0x1d7e71){return _0x1d7e71[_0xa0e3('0x13f')];});var _0x4fd8b8=_[_0xa0e3('0x140')](this[_0xa0e3('0x1e')],function(_0x9e38ba){return _0x9e38ba[_0xa0e3('0x141')]&&_0x9e38ba[_0xa0e3('0x7f')]==='reachable';});if(_0x47cc16[_0xa0e3('0x91')]>0x0&&_0x4fd8b8[_0xa0e3('0x91')]>0x0){return Promise[_0xa0e3('0x135')]()[_0xa0e3('0x36')](cmHopper[_0xa0e3('0x142')](_[_0xa0e3('0x143')](_0x47cc16,'id'),previewRecallmeReminderInterval,_[_0xa0e3('0x143')](_0x4fd8b8,'id')))[_0xa0e3('0x36')](function(_0x16acc0){for(var _0x498551=0x0;_0x498551<_0x16acc0['length'];_0x498551++){var _0x12a012=_0x16acc0[_0x498551][_0xa0e3('0x144')][_0xa0e3('0x3e')];if(_0x12a012)io['to'](util[_0xa0e3('0x3d')](_0xa0e3('0x145'),_0x12a012))[_0xa0e3('0x10e')]('user:dialPreviewRecallReminder',{'hopper':_0x16acc0[_0x498551]});}})[_0xa0e3('0x99')](function(_0x1cab65){logger[_0xa0e3('0x5a')](_0xa0e3('0x146'),_0x1cab65);});}},0x3c*0x3e8,{'leading':!![]});Dialer[_0xa0e3('0x17')]['loopClearZombieChannels']=function(){var _0x31b449=this;setInterval(function(){_0x31b449['clearZombieChannels'](_0x31b449[_0xa0e3('0x22')],_0xa0e3('0x147'));_0x31b449['clearZombieChannels'](_0x31b449[_0xa0e3('0x21')],_0xa0e3('0x148'));},0x32c8);};Dialer['prototype'][_0xa0e3('0x149')]=function(_0x344e7b,_0x4d4f1a){var _0x3da643=this;for(var _0x5cc3e3 in _0x344e7b){if(typeof _0x344e7b[_0x5cc3e3]!==_0xa0e3('0x14a')){this['sequence'][_0xa0e3('0x14b')](function(){if(!_['isNil'](_0x344e7b[_0x5cc3e3])){return ami[_0xa0e3('0x93')]({'action':_0xa0e3('0x7f'),'channel':_0x344e7b[_0x5cc3e3][_0xa0e3('0xe5')]})[_0xa0e3('0x99')](function(_0x20d1da){if(_0x20d1da[_0xa0e3('0x60')]==='No\x20such\x20channel'){setTimeout(function(){if(_0x344e7b[_0x5cc3e3]&&_0x344e7b[_0x5cc3e3][_0xa0e3('0x38')]!==_0xa0e3('0xb4')){utils[_0xa0e3('0xc1')](_0x3da643[_0xa0e3('0x1c')][_0x344e7b[_0x5cc3e3][_0xa0e3('0xb2')]],'[clearZombieChannels]');logger[_0xa0e3('0x5a')]('[Dialer][checkChannel]',_0x4d4f1a,_0x5cc3e3,_0x344e7b[_0x5cc3e3][_0xa0e3('0xb2')]);delete _0x344e7b[_0x5cc3e3];}if(_0x344e7b[_0x5cc3e3]&&_0x344e7b[_0x5cc3e3][_0xa0e3('0x38')]===_0xa0e3('0xb4')){utils[_0xa0e3('0xc1')](_0x3da643[_0xa0e3('0x1d')][_0x344e7b[_0x5cc3e3][_0xa0e3('0xb2')]],'[clearZombieChannels]');logger[_0xa0e3('0x5a')]('[Dialer][checkChannel][ivr]',_0x4d4f1a,_0x5cc3e3,_0x344e7b[_0x5cc3e3][_0xa0e3('0xb2')]);delete _0x344e7b[_0x5cc3e3];}},0x2328);}});}});}}};Dialer['prototype']['getVoiceQueueRtPauses']=function(_0x4a70be){return Promise[_0xa0e3('0x135')]()['then'](voiceQueueRt[_0xa0e3('0x14c')](_0x4a70be))[_0xa0e3('0x99')](loggerCatch(_0xa0e3('0x14d')));};Dialer[_0xa0e3('0x17')][_0xa0e3('0x14e')]=function(_0x3257d9,_0x1fbd26,_0x4108ec){var _0x27d3cc={'state':0x19,'statedesc':'notFound'};utils[_0xa0e3('0xc1')](_0x1fbd26,'[emptyContact]'+_0x3257d9);this[_0xa0e3('0x11e')](_[_0xa0e3('0xed')](_0x27d3cc,_['pick'](_0x4108ec,[_0xa0e3('0xd6'),_0xa0e3('0xd7'),_0xa0e3('0x14f'),_0xa0e3('0xd8'),_0xa0e3('0xd9')])),_0xa0e3('0x150'),'[emptyContact]');logger[_0xa0e3('0x5a')](_0x3257d9);};Dialer[_0xa0e3('0x17')][_0xa0e3('0x11e')]=function(_0x3c8bf6,_0x433159,_0x371fab){hopperUtils[_0xa0e3('0xbd')](_0x3c8bf6)['catch'](loggerCatch(_0x433159));hopperUtils[_0xa0e3('0xbf')](_0x3c8bf6)[_0xa0e3('0x99')](loggerCatch(_0x371fab));};Dialer['prototype'][_0xa0e3('0xd2')]=function(_0x575381,_0x4e2c58){hopperUtils['createHistory'](_0x575381)[_0xa0e3('0x99')](loggerCatch(_0xa0e3('0xbe')));if(_0x4e2c58==0x0){hopperUtils[_0xa0e3('0xbf')](_0x575381)[_0xa0e3('0x99')](loggerCatch(_0xa0e3('0x151')));}};Dialer[_0xa0e3('0x17')][_0xa0e3('0x146')]=function(_0x260add){return Promise[_0xa0e3('0x135')]()[_0xa0e3('0x36')](cmHopper[_0xa0e3('0x142')](_0x260add['id'],previewRecallmeReminderInterval))[_0xa0e3('0x36')](function(_0x507648){for(var _0x181760=0x0;_0x181760<_0x507648[_0xa0e3('0x91')];_0x181760++){var _0x2d8da9=_0x507648[_0x181760][_0xa0e3('0x144')]['name'];if(_0x2d8da9)io['to'](util[_0xa0e3('0x3d')](_0xa0e3('0x145'),_0x2d8da9))[_0xa0e3('0x10e')]('user:dialPreviewRecallReminder',{'hopper':_0x507648[_0x181760]});}})[_0xa0e3('0x99')](function(){});};Dialer[_0xa0e3('0x17')]['launchHandleIvr']=function(_0x360795){var _0x171d5f=this;return function(){_0x171d5f[_0xa0e3('0x152')](_0x360795);};};Dialer[_0xa0e3('0x17')][_0xa0e3('0x153')]=function(_0x147598,_0x13c94a){var _0x4f881e=this;var _0x1641fb=uuid['v4']();this[_0xa0e3('0x21')][_0x1641fb]=new Action(_0x147598,_0x13c94a,_0x1641fb);return new Promise(function(_0x2f8603,_0x4b9e5f){if(_[_0xa0e3('0x4a')](_0x147598)&&typeof _0x147598!==_0xa0e3('0x154')){return _0x4b9e5f(msgResponse(_0xa0e3('0x155'),'Failure',_0xa0e3('0x156')));}if(_[_0xa0e3('0x4a')](_0x13c94a[_0xa0e3('0x157')])||_0x13c94a[_0xa0e3('0x157')]===null){return _0x4b9e5f(msgResponse('originate',_0xa0e3('0x88'),_0xa0e3('0x158')));}var _0x5302d1={'XMD-CALLERID':_0x4f881e[_0xa0e3('0x21')][_0x1641fb][_0xa0e3('0x159')](),'XMD-AGI':_0x147598[_0xa0e3('0x12a')]?util[_0xa0e3('0x3d')](_0xa0e3('0x15a'),ipAgi,_0x147598['dialQueueProject']):_0xa0e3('0x15b'),'XMD-AGIAFTER':_0x147598[_0xa0e3('0xbb')]?util['format'](_0xa0e3('0x15a'),ipAgi,_0x147598[_0xa0e3('0xbb')]):_0xa0e3('0x15b'),'XMD-QUEUE':utils['isOutboundQueue'](_0x147598)?util[_0xa0e3('0x3d')](_0xa0e3('0x15c'),_0x147598[_0xa0e3('0x3e')],_0x147598[_0xa0e3('0x15d')]||'',_0x147598[_0xa0e3('0xbc')]?'c':'',_0x147598['dialQueueTimeout']||0x3):'NONE','XMD-CONTACTID':_0x13c94a[_0xa0e3('0xd6')],'XMD-CDRTYPE':_0xa0e3('0x8'),'CALLERID(all)':_0x4f881e[_0xa0e3('0x21')][_0x1641fb][_0xa0e3('0x159')](),'XMD-AMD':_0x147598[_0xa0e3('0x106')]?'ACTIVE':_0xa0e3('0x15b'),'XMD-DESTINATION':'xcally-motion-dialer'};if(_0x147598[_0xa0e3('0x106')]){_0x5302d1[_0xa0e3('0x15e')]=_0x147598['dialAMDInitialSilence']||0x9c4;_0x5302d1['XMD-AMDGREETING']=_0x147598[_0xa0e3('0x15f')]||0x5dc;_0x5302d1[_0xa0e3('0x160')]=_0x147598[_0xa0e3('0x161')]||0x320;_0x5302d1[_0xa0e3('0x162')]=_0x147598['dialAMDTotalAnalysisTime']||0x1388;_0x5302d1[_0xa0e3('0x163')]=_0x147598[_0xa0e3('0x164')]||0x64;_0x5302d1[_0xa0e3('0x165')]=_0x147598['dialAMDBetweenWordsSilence']||0x32;_0x5302d1[_0xa0e3('0x166')]=_0x147598[_0xa0e3('0x167')]||0x3;_0x5302d1['XMD-AMDSILENCETHRESHOLD']=_0x147598[_0xa0e3('0x168')]||0x100;_0x5302d1['XMD-AMDMAXIMUMWORDLENGTH']=_0x147598[_0xa0e3('0x169')]||0x1388;}if(utils[_0xa0e3('0x16a')](_0x147598)){_0x5302d1[_0xa0e3('0x16b')]=_0x13c94a[_0xa0e3('0xd8')];}else{_0x5302d1[_0xa0e3('0x16c')]=_0x13c94a[_0xa0e3('0xd9')];}var _0x308496=utils[_0xa0e3('0x16d')](_0x13c94a[_0xa0e3('0x16e')]);Object[_0xa0e3('0x16f')](_0x5302d1,_0x308496);var _0x3179c7=_0x4f881e[_0xa0e3('0x7c')](_0x147598[_0xa0e3('0x82')])?utils[_0xa0e3('0x170')](_0x147598[_0xa0e3('0x82')][_0xa0e3('0x171')],_0x147598['dialOriginateCallerIdName'],_0x147598[_0xa0e3('0x172')]>0x0?utils[_0xa0e3('0x173')](_0x147598['dialOriginateCallerIdNumber'],_0x147598['dialRandomLastDigitCallerIdNumber']):_0x147598[_0xa0e3('0x174')]):utils[_0xa0e3('0x170')](_[_0xa0e3('0xe9')](_0x147598[_0xa0e3('0x175')])?_0x147598[_0xa0e3('0x82')][_0xa0e3('0x171')]:_0x147598[_0xa0e3('0x175')]['callerid'],_0x147598[_0xa0e3('0x176')],_0x147598[_0xa0e3('0x172')]>0x0?utils[_0xa0e3('0x173')](_0x147598['dialOriginateCallerIdNumber'],_0x147598[_0xa0e3('0x172')]):_0x147598[_0xa0e3('0x174')]);if(_0x3179c7){_0x5302d1[_0xa0e3('0x177')]=_0x4f881e[_0xa0e3('0x21')][_0x1641fb][_0xa0e3('0x178')]=utils[_0xa0e3('0x179')](_0x3179c7);_0x5302d1[_0xa0e3('0x17a')]=_0x13c94a[_0xa0e3('0x157')];}_0x147598[_0xa0e3('0x17b')]=_0x5302d1;return ami['Action']({'actionid':_0x1641fb,'action':_0xa0e3('0x155'),'channel':_0x4f881e[_0xa0e3('0x7c')](_0x147598['Trunk'])?util[_0xa0e3('0x3d')](_0xa0e3('0x17c'),_0x147598[_0xa0e3('0x82')][_0xa0e3('0x3e')],isNotNull(_0x147598[_0xa0e3('0x17d')])?_0x147598[_0xa0e3('0x17d')]['trim']()||'':'',_0x147598['dialCutDigit']>0x0?_0x13c94a['phone'][_0xa0e3('0x17e')](_0x147598[_0xa0e3('0x17f')]):_0x13c94a['phone']):util[_0xa0e3('0x3d')](_0xa0e3('0x17c'),_[_0xa0e3('0xe9')](_0x147598['TrunkBackup'])?_0x147598['Trunk'][_0xa0e3('0x3e')]:_0x147598[_0xa0e3('0x175')][_0xa0e3('0x3e')],isNotNull(_0x147598[_0xa0e3('0x17d')])?_0x147598[_0xa0e3('0x17d')][_0xa0e3('0x180')]()||'':'',_0x147598[_0xa0e3('0x17f')]>0x0?_0x13c94a[_0xa0e3('0x157')][_0xa0e3('0x17e')](_0x147598[_0xa0e3('0x17f')]):_0x13c94a[_0xa0e3('0x157')]),'callerid':_0x3179c7,'Exten':_0xa0e3('0x105'),'Context':_0xa0e3('0x181'),'Priority':'1','variable':_0x5302d1,'timeout':(_0x147598['dialOriginateTimeout']||0x1e)*0x3e8,'async':!![],'channelid':_0x1641fb})[_0xa0e3('0x36')](function(_0x6a7675){return _0x2f8603(_0x6a7675);})['catch'](function(_0x4ca57c){_0x147598[_0xa0e3('0x182')]+=0x1;var _0x3975d0=new History(_0x4f881e[_0xa0e3('0x21')][_0x1641fb]);logger[_0xa0e3('0x5a')](util[_0xa0e3('0x3d')](_0xa0e3('0x183'),JSON[_0xa0e3('0x7b')](_0x4ca57c)));_0x3975d0[_0xa0e3('0x63')]=0xe;_0x3975d0[_0xa0e3('0x64')]=_0xa0e3('0x184');_0x3975d0[_0xa0e3('0x66')]=moment()[_0xa0e3('0x3d')](_0xa0e3('0xb7'));_0x3975d0[_0xa0e3('0x65')]=_0x3975d0[_0xa0e3('0x66')];hopperUtils[_0xa0e3('0xbd')](_0x3975d0)[_0xa0e3('0x99')](loggerCatch(_0xa0e3('0x185')));_0x4f881e['moveContactManagedDialer'](_0x3975d0)[_0xa0e3('0x99')](loggerCatch(_0xa0e3('0x185')))[_0xa0e3('0x19')](function(){delete _0x4f881e[_0xa0e3('0x21')][_0x1641fb];return _0x4b9e5f(msgResponse(_0xa0e3('0x155'),_0xa0e3('0x7a'),_0xa0e3('0x186')));});});});};Dialer[_0xa0e3('0x17')][_0xa0e3('0x187')]=function(_0x596867,_0x39f8b8,_0x109d22){var _0x2b9687=new History(_0x39f8b8);if(_0x2b9687['countbusyretry']+_0x2b9687[_0xa0e3('0x188')]+_0x2b9687[_0xa0e3('0x115')]+_0x2b9687[_0xa0e3('0x116')]+_0x2b9687[_0xa0e3('0xca')]+_0x2b9687['countabandonedretry']+_0x2b9687[_0xa0e3('0x110')]+_0x2b9687['countagentrejectretry']>=_0x109d22[_0xa0e3('0x118')]-0x1){return!![];}switch(_0x596867){case 0x3:if(_0x2b9687['countnoanswerretry']>=_0x109d22[_0xa0e3('0x189')]-0x1){return!![];}hopperUtils[_0xa0e3('0xd3')]({'active':![],'countnoanswerretry':_0x2b9687[_0xa0e3('0x115')]+=0x1,'scheduledat':moment()[_0xa0e3('0xd4')](_0x109d22[_0xa0e3('0x18a')],_0xa0e3('0xd5'))[_0xa0e3('0x3d')](_0xa0e3('0xb7')),'ContactId':_0x2b9687[_0xa0e3('0xd6')],'ListId':_0x2b9687[_0xa0e3('0xd7')],'VoiceQueueId':_0x2b9687[_0xa0e3('0xd8')]||undefined,'CampaignId':_0x2b9687['CampaignId']||undefined})[_0xa0e3('0x99')](loggerCatch(_0xa0e3('0x18b')));break;case 0x5:if(_0x2b9687[_0xa0e3('0x114')]>=_0x109d22['dialBusyMaxRetry']-0x1){return!![];}hopperUtils[_0xa0e3('0xd3')]({'active':![],'countbusyretry':_0x2b9687[_0xa0e3('0x114')]+=0x1,'scheduledat':moment()[_0xa0e3('0xd4')](_0x109d22[_0xa0e3('0x18c')],_0xa0e3('0xd5'))[_0xa0e3('0x3d')](_0xa0e3('0xb7')),'ContactId':_0x2b9687[_0xa0e3('0xd6')],'ListId':_0x2b9687['ListId'],'VoiceQueueId':_0x2b9687[_0xa0e3('0xd8')]||undefined,'CampaignId':_0x2b9687[_0xa0e3('0xd9')]||undefined})[_0xa0e3('0x99')](loggerCatch(_0xa0e3('0x18d')));break;case 0x8:if(_0x2b9687['countcongestionretry']>=_0x109d22['dialCongestionMaxRetry']-0x1){return!![];}hopperUtils['rescheduleContact']({'active':![],'countcongestionretry':_0x2b9687[_0xa0e3('0x188')]+=0x1,'scheduledat':moment()[_0xa0e3('0xd4')](_0x109d22[_0xa0e3('0x18e')],'minutes')['format'](_0xa0e3('0xb7')),'ContactId':_0x2b9687[_0xa0e3('0xd6')],'ListId':_0x2b9687['ListId'],'VoiceQueueId':_0x2b9687['VoiceQueueId']||undefined,'CampaignId':_0x2b9687[_0xa0e3('0xd9')]||undefined})[_0xa0e3('0x99')](loggerCatch(_0xa0e3('0x18f')));break;case 0x0:if(_0x2b9687[_0xa0e3('0x116')]>=_0x109d22[_0xa0e3('0x190')]-0x1){return!![];}else{hopperUtils[_0xa0e3('0xd3')]({'active':![],'countnosuchnumberretry':_0x2b9687[_0xa0e3('0x116')]+=0x1,'scheduledat':moment()[_0xa0e3('0xd4')](_0x109d22[_0xa0e3('0x191')],_0xa0e3('0xd5'))['format'](_0xa0e3('0xb7')),'ContactId':_0x2b9687[_0xa0e3('0xd6')],'ListId':_0x2b9687[_0xa0e3('0xd7')],'VoiceQueueId':_0x2b9687['VoiceQueueId']||undefined,'CampaignId':_0x2b9687[_0xa0e3('0xd9')]||undefined})[_0xa0e3('0x99')](loggerCatch(_0xa0e3('0x192')));}break;case 0xa:if(_0x2b9687[_0xa0e3('0xca')]>=_0x109d22['dialDropMaxRetry']-0x1){return!![];}hopperUtils['rescheduleContact']({'active':![],'countdropretry':_0x2b9687[_0xa0e3('0xca')]+=0x1,'scheduledat':moment()['add'](_0x109d22[_0xa0e3('0xcc')],_0xa0e3('0xd5'))[_0xa0e3('0x3d')](_0xa0e3('0xb7')),'ContactId':_0x2b9687[_0xa0e3('0xd6')],'ListId':_0x2b9687[_0xa0e3('0xd7')],'VoiceQueueId':_0x2b9687[_0xa0e3('0xd8')]||undefined,'CampaignId':_0x2b9687['CampaignId']||undefined})[_0xa0e3('0x99')](loggerCatch(_0xa0e3('0xda')));break;case 0xb:if(_0x2b9687['countabandonedretry']>=_0x109d22[_0xa0e3('0xe1')]-0x1){return!![];}hopperUtils[_0xa0e3('0xd3')]({'active':![],'countabandonedretry':_0x2b9687[_0xa0e3('0xe0')]+=0x1,'scheduledat':moment()[_0xa0e3('0xd4')](_0x109d22[_0xa0e3('0xe2')],_0xa0e3('0xd5'))[_0xa0e3('0x3d')](_0xa0e3('0xb7')),'ContactId':_0x2b9687['ContactId'],'ListId':_0x2b9687[_0xa0e3('0xd7')],'VoiceQueueId':_0x2b9687[_0xa0e3('0xd8')]||undefined,'CampaignId':_0x2b9687[_0xa0e3('0xd9')]||undefined})['catch'](loggerCatch(_0xa0e3('0xe3')));break;case 0x13:if(_0x2b9687['countmachineretry']>=_0x109d22[_0xa0e3('0x11b')]-0x1){return!![];}hopperUtils[_0xa0e3('0xd3')]({'active':![],'countmachineretry':_0x2b9687[_0xa0e3('0x110')]+=0x1,'scheduledat':moment()['add'](_0x109d22[_0xa0e3('0x122')],'minutes')['format'](_0xa0e3('0xb7')),'ContactId':_0x2b9687[_0xa0e3('0xd6')],'ListId':_0x2b9687[_0xa0e3('0xd7')],'VoiceQueueId':_0x2b9687['VoiceQueueId']||undefined,'CampaignId':_0x2b9687[_0xa0e3('0xd9')]||undefined})[_0xa0e3('0x99')](loggerCatch(_0xa0e3('0x11d')));break;case 0x14:if(_0x2b9687[_0xa0e3('0x117')]>=_0x109d22[_0xa0e3('0x193')]-0x1){return!![];}hopperUtils[_0xa0e3('0xd3')]({'active':![],'countagentrejectretry':_0x2b9687[_0xa0e3('0x117')]+=0x1,'scheduledat':moment()[_0xa0e3('0xd4')](_0x109d22[_0xa0e3('0x194')],_0xa0e3('0xd5'))[_0xa0e3('0x3d')](_0xa0e3('0xb7')),'ContactId':_0x2b9687[_0xa0e3('0xd6')],'ListId':_0x2b9687[_0xa0e3('0xd7')],'VoiceQueueId':_0x2b9687[_0xa0e3('0xd8')]||undefined,'CampaignId':_0x2b9687[_0xa0e3('0xd9')]||undefined})[_0xa0e3('0x99')](loggerCatch(_0xa0e3('0x195')));break;default:return!![];}};Dialer[_0xa0e3('0x17')][_0xa0e3('0x101')]=function(_0x139338,_0x489527,_0x3acb4e){var _0x212474=this;var _0x5a88c3=new History(_0x139338);var _0x19a76b=![];var _0x6d3505;var _0x128173;return new Promise(function(_0x4433b1,_0x212b7a){if(_[_0xa0e3('0x4a')](_0x489527)&&typeof _0x489527!==_0xa0e3('0x154')){return _0x212b7a(msgResponse(_0xa0e3('0x196'),_0xa0e3('0x88'),_0xa0e3('0x197')));}if(_[_0xa0e3('0x4a')](_0x3acb4e)&&typeof _0x3acb4e!=='object'){return _0x212b7a(msgResponse(_0xa0e3('0x196'),_0xa0e3('0x88'),_0xa0e3('0x198')));}hopperUtils[_0xa0e3('0xce')](_0x5a88c3,_0x3acb4e[_0xa0e3('0x199')],_0x489527)['then'](function(_0x230198){if(_0x230198['additional']==0x1)_0x19a76b=!![];switch(_0x3acb4e[_0xa0e3('0x199')]){case'0':_0x489527[_0xa0e3('0x19a')]+=0x1;_0x5a88c3[_0xa0e3('0x63')]=0x0;_0x5a88c3[_0xa0e3('0x64')]=_0xa0e3('0x19b');_0x5a88c3[_0xa0e3('0x116')]+=0x1;_0x5a88c3[_0xa0e3('0xcb')]+=0x1;ami[_0xa0e3('0x10e')](_0xa0e3('0x19c'),ut['buildObj'](_0x139338,'nosuchnumber'));_0x6d3505=_0x489527[_0xa0e3('0x191')];_0x128173=_0x489527[_0xa0e3('0xcd')];hopperUtils[_0xa0e3('0xbd')](_0x5a88c3)[_0xa0e3('0x99')](loggerCatch(_0xa0e3('0x113')));if(_0x212474[_0xa0e3('0x187')](0x0,_0x139338,_0x489527)&&!_0x19a76b){if(_0x5a88c3['countnosuchnumberretry']>=_0x489527[_0xa0e3('0x190')]){_0x212474[_0xa0e3('0x121')](_0x5a88c3,_0x4433b1,_0x212b7a,_0xa0e3('0x19d'));}else{_0x212474[_0xa0e3('0x119')](_0x5a88c3,_0x4433b1,_0x212b7a,_0xa0e3('0x19d'));}}break;case'3':_0x489527[_0xa0e3('0x19e')]+=0x1;_0x5a88c3['state']=0x3;_0x5a88c3[_0xa0e3('0x64')]=_0xa0e3('0x19f');_0x5a88c3[_0xa0e3('0x115')]+=0x1;_0x5a88c3['countglobal']+=0x1;var _0xec28e5=ut['buildNoAnswerEventPayload'](_0x139338,_0x489527);ami[_0xa0e3('0x10e')](_0xa0e3('0x1a0'),_0xec28e5);_0x6d3505=_0x489527['dialNoAnswerRetryFrequency'];_0x128173=_0x489527[_0xa0e3('0xcd')];hopperUtils[_0xa0e3('0xbd')](_0x5a88c3)[_0xa0e3('0x99')](loggerCatch(_0xa0e3('0x1a1')));if(_0x212474[_0xa0e3('0x187')](0x3,_0x139338,_0x489527)&&!_0x19a76b){if(_0x5a88c3[_0xa0e3('0x115')]>=_0x489527[_0xa0e3('0x189')]){_0x212474[_0xa0e3('0x121')](_0x5a88c3,_0x4433b1,_0x212b7a,_0xa0e3('0x1a2'));}else{_0x212474[_0xa0e3('0x119')](_0x5a88c3,_0x4433b1,_0x212b7a,_0xa0e3('0x1a2'));}}break;case'5':_0x489527[_0xa0e3('0x1a3')]+=0x1;_0x5a88c3[_0xa0e3('0x63')]=0x5;_0x5a88c3[_0xa0e3('0x64')]=_0xa0e3('0x1a4');_0x5a88c3[_0xa0e3('0x114')]+=0x1;_0x5a88c3[_0xa0e3('0xcb')]+=0x1;ami[_0xa0e3('0x10e')](_0xa0e3('0x1a5'),ut['buildObj'](_0x139338,_0xa0e3('0x1a6')));_0x6d3505=_0x489527[_0xa0e3('0x18c')];_0x128173=_0x489527[_0xa0e3('0xcd')];hopperUtils[_0xa0e3('0xbd')](_0x5a88c3)['catch'](loggerCatch(_0xa0e3('0x1a7')));if(_0x212474['checkRetriveMax'](0x5,_0x139338,_0x489527)&&!_0x19a76b){if(_0x5a88c3[_0xa0e3('0x114')]>=_0x489527[_0xa0e3('0x1a8')]){_0x212474[_0xa0e3('0x121')](_0x5a88c3,_0x4433b1,_0x212b7a,_0xa0e3('0x1a9'));}else{_0x212474[_0xa0e3('0x119')](_0x5a88c3,_0x4433b1,_0x212b7a,_0xa0e3('0x1a9'));}}break;case'8':_0x489527[_0xa0e3('0x1aa')]+=0x1;_0x5a88c3[_0xa0e3('0x63')]=0x8;_0x5a88c3[_0xa0e3('0x64')]='Congestion';_0x5a88c3['countcongestionretry']+=0x1;_0x5a88c3[_0xa0e3('0xcb')]+=0x1;_0x6d3505=_0x489527[_0xa0e3('0x18e')];_0x128173=_0x489527[_0xa0e3('0xcd')];ami[_0xa0e3('0x10e')]('custom:agentcongestion',ut[_0xa0e3('0x112')](_0x139338,_0xa0e3('0x1ab')));hopperUtils[_0xa0e3('0xbd')](_0x5a88c3)[_0xa0e3('0x99')](loggerCatch('[syncAgentComplete][createHistory][8]'));if(_0x212474['checkRetriveMax'](0x8,_0x139338,_0x489527)&&!_0x19a76b){if(_0x5a88c3[_0xa0e3('0x188')]>=_0x489527['dialCongestionMaxRetry']){_0x212474[_0xa0e3('0x121')](_0x5a88c3,_0x4433b1,_0x212b7a,_0xa0e3('0x1ac'));}else{_0x212474[_0xa0e3('0x119')](_0x5a88c3,_0x4433b1,_0x212b7a,_0xa0e3('0x1ac'));}}break;case'11':_0x489527['outboundAbandonedCallsDay']+=0x1;_0x5a88c3[_0xa0e3('0x63')]=0xb;_0x5a88c3[_0xa0e3('0x64')]=_0xa0e3('0xdf');_0x5a88c3['countabandonedretry']+=0x1;_0x5a88c3['countglobal']+=0x1;_0x6d3505=_0x489527[_0xa0e3('0xe2')];_0x128173=_0x489527['callAdditionalPhoneAfterMin'];hopperUtils[_0xa0e3('0xbd')](_0x5a88c3)['catch'](loggerCatch(_0xa0e3('0xe4')));if(_0x212474[_0xa0e3('0x187')](0xb,_0x139338,_0x489527)&&!_0x19a76b){if(_0x5a88c3[_0xa0e3('0xe0')]>=_0x489527[_0xa0e3('0xe1')]){_0x212474['createStateFinal'](_0x5a88c3,_0x4433b1,_0x212b7a,_0xa0e3('0x1ad'));}else{_0x212474[_0xa0e3('0x119')](_0x5a88c3,_0x4433b1,_0x212b7a,_0xa0e3('0x1ad'));}}break;case'20':_0x489527[_0xa0e3('0x1ae')]+=0x1;_0x5a88c3[_0xa0e3('0x63')]=0x14;_0x5a88c3[_0xa0e3('0x64')]='AgentReject';_0x5a88c3[_0xa0e3('0x117')]+=0x1;_0x5a88c3[_0xa0e3('0xcb')]+=0x1;_0x6d3505=_0x489527[_0xa0e3('0x194')];_0x128173=_0x489527[_0xa0e3('0xcd')];ami[_0xa0e3('0x10e')](_0xa0e3('0x1af'),ut[_0xa0e3('0x112')](_0x139338,'agentreject'));hopperUtils[_0xa0e3('0xbd')](_0x5a88c3)[_0xa0e3('0x99')](loggerCatch('[syncAgentComplete][createHistory][20]'));if(_0x212474[_0xa0e3('0x187')](0x14,_0x139338,_0x489527)&&!_0x19a76b){if(_0x5a88c3[_0xa0e3('0x117')]>=_0x489527['dialAgentRejectMaxRetry']){_0x212474[_0xa0e3('0x121')](_0x5a88c3,_0x4433b1,_0x212b7a,'reason\x2020\x20agentreject');}else{_0x212474['stateGlobal'](_0x5a88c3,_0x4433b1,_0x212b7a,_0xa0e3('0x1b0'));}}break;default:_0x489527[_0xa0e3('0x12e')]+=0x1;_0x5a88c3[_0xa0e3('0x63')]=0xc;_0x5a88c3[_0xa0e3('0x64')]=_0x3acb4e[_0xa0e3('0x199')];_0x6d3505=_0x489527[_0xa0e3('0x194')];_0x128173=_0x489527['callAdditionalPhoneAfterMin'];hopperUtils['createHistory'](_0x5a88c3)[_0xa0e3('0x99')](loggerCatch('[syncAgentComplete][createHistory][?]'));if(_0x212474[_0xa0e3('0x187')](_0x3acb4e[_0xa0e3('0x199')],_0x139338,_0x489527)&&!_0x19a76b){if(_0x5a88c3['countbusyretry']+_0x5a88c3['countcongestionretry']+_0x5a88c3[_0xa0e3('0x115')]+_0x5a88c3[_0xa0e3('0x116')]+_0x5a88c3['countdropretry']+_0x5a88c3[_0xa0e3('0xe0')]+_0x5a88c3['countmachineretry']+_0x5a88c3[_0xa0e3('0x117')]>=_0x489527['dialGlobalMaxRetry']){_0x212474[_0xa0e3('0x119')](_0x5a88c3,_0x4433b1,_0x212b7a,_0x3acb4e['reason']);}else{_0x212474[_0xa0e3('0x121')](_0x5a88c3,_0x4433b1,_0x212b7a,_0x3acb4e[_0xa0e3('0x199')]);}}}})[_0xa0e3('0x36')](function(){if(_0x19a76b){hopperUtils['swapAdditionalPhones'](_0x5a88c3,_0x6d3505,_0x128173)[_0xa0e3('0x36')](function(){return _0x4433b1(0x1);});}});});};Dialer[_0xa0e3('0x17')][_0xa0e3('0x119')]=function(_0x4398d5,_0x1c11ba,_0x44a898,_0xea52ca){var _0x5ee28f=new Final(_0x4398d5);_0x5ee28f[_0xa0e3('0x63')]=0xf;_0x5ee28f[_0xa0e3('0x64')]=_0xa0e3('0x1b1');this[_0xa0e3('0x121')](_0x5ee28f,_0x1c11ba,_0x44a898,_0xea52ca);};Dialer[_0xa0e3('0x17')][_0xa0e3('0x121')]=function(_0x4a248b,_0x28dc81,_0x4c8ea6,_0x22b09c){hopperUtils[_0xa0e3('0xbf')](_0x4a248b)['then'](function(){return _0x28dc81(msgResponse(_0xa0e3('0x196'),_0xa0e3('0xff'),_0x22b09c));})[_0xa0e3('0x99')](function(){return _0x4c8ea6(msgResponse(_0xa0e3('0x1b2'),_0xa0e3('0x88'),_0xa0e3('0x1b3')));});};Dialer[_0xa0e3('0x17')][_0xa0e3('0xa')]=function(_0x449711){var _0x525f3c=_0x449711['dialPredictiveOptimizationPercentage']/0x64;var _0x180cff=_0x449711['outboundDropCallsDayTimeout']/(_0x449711[_0xa0e3('0xc5')]+_0x449711[_0xa0e3('0xb8')]);var _0x523ec3=Math[_0xa0e3('0x1b4')](_0x449711['predictiveIntervalAvailable']*(_0x449711['predictiveIntervalMaxThreshold']/0x64));var _0x3d49ab=Math[_0xa0e3('0x1b4')](_0x449711[_0xa0e3('0x1b5')]*(_0x449711['predictiveIntervalMinThreshold']/0x64));var _0x13305d=_0x449711[_0xa0e3('0x136')]+_0x449711['talking'];var _0x49d436=Math[_0xa0e3('0x1b6')](_0x449711[_0xa0e3('0x50')]*_0x449711[_0xa0e3('0x52')]*_0x449711[_0xa0e3('0x1b7')]*_0x449711['predictiveIntervalMultiplicativeFactor']);if(_[_0xa0e3('0x4a')](_0x449711['startProgressive'])){if(!_[_0xa0e3('0x4a')](_0x449711['startPredictive'])){_0x449711[_0xa0e3('0x23')]=undefined;loggerPredictive[_0xa0e3('0x5a')](_0xa0e3('0x1b8'),_0xa0e3('0x1b9'));}if(!_[_0xa0e3('0x4a')](_0x449711[_0xa0e3('0x59')])){loggerPredictive[_0xa0e3('0x5a')]('[startMethodPredictive][StartProgressive]',_0xa0e3('0x1ba'));clearInterval(_0x449711['handlePredictive']);_0x449711[_0xa0e3('0x59')]=undefined;}_0x449711[_0xa0e3('0x24')]=moment()[_0xa0e3('0x3d')]('YYYY-MM-DD\x20HH:mm:ss');loggerPredictive[_0xa0e3('0x40')](_0x449711[_0xa0e3('0x3e')],'collection\x20data\x20in\x20progressive\x20at',_0x449711[_0xa0e3('0x24')]);this['handlePower'](_0x449711,0x1);}else if(ifInterval(_0x449711[_0xa0e3('0x1bb')],_0x449711[_0xa0e3('0x24')])){this[_0xa0e3('0xa5')](_0x449711,0x1);loggerPredictiveCalls[_0xa0e3('0x40')](_0xa0e3('0x1bc'),_0x449711['startProgressive'],_0x449711[_0xa0e3('0x3e')]);_0x449711[_0xa0e3('0x50')]=0x0;_0x449711[_0xa0e3('0xc6')]=0x0;}else if(_0x525f3c<_0x180cff&&_0x449711[_0xa0e3('0x1bd')]===_0xa0e3('0x1be')){clearPredictiveAttributes(_0x449711);loggerPredictive[_0xa0e3('0x40')](_0xa0e3('0x1bf'),_0xa0e3('0x1c0'),_0x180cff,_0xa0e3('0x24'),_0x449711[_0xa0e3('0x3e')]);}else if(_0x49d436<_0x449711[_0xa0e3('0xc6')]&&_0x449711[_0xa0e3('0x1bd')]===_0xa0e3('0x1be')){clearPredictiveAttributes(_0x449711);loggerPredictive['info'](_0xa0e3('0x1c1'),_0xa0e3('0x1c2'),_0x49d436,_0xa0e3('0x1c3'),_0x449711[_0xa0e3('0xc6')],'startProgressive',_0x449711[_0xa0e3('0x3e')]);}else if(!ifInterval(_0x449711[_0xa0e3('0x1bb')],_0x449711[_0xa0e3('0x24')])&&_[_0xa0e3('0x4a')](_0x449711['startPredictive'])&&!_[_0xa0e3('0x4a')](_0x449711['startProgressive'])){_0x449711[_0xa0e3('0x23')]=moment()['format'](_0xa0e3('0xb7'));loggerPredictive[_0xa0e3('0x40')](_0x449711[_0xa0e3('0x3e')],_0xa0e3('0x1c4'),_0x449711[_0xa0e3('0x23')]);hopperUtils[_0xa0e3('0x1c5')](_0x449711[_0xa0e3('0x1bb')])[_0xa0e3('0x36')](this[_0xa0e3('0x1c6')](_0x449711))[_0xa0e3('0x36')](mergeDataErlangB(_0x449711))[_0xa0e3('0x36')](this[_0xa0e3('0x1c7')](_0x449711))[_0xa0e3('0x99')](loggerCatchPredictive('Predictive\x20after\x20first\x20interval',_0x449711));}else if(!ifInterval(_0x449711['dialPredictiveInterval'],_0x449711['startPredictive'])){_0x449711['predictiveIntervalErlangCallsDroppedCalls']=0x0;_0x449711[_0xa0e3('0x23')]=moment()[_0xa0e3('0x3d')](_0xa0e3('0xb7'));loggerPredictive['info'](_0x449711[_0xa0e3('0x3e')],_0xa0e3('0x1c8'),_0x449711[_0xa0e3('0x23')]);clearInterval(_0x449711[_0xa0e3('0x59')]);_0x449711[_0xa0e3('0x59')]=undefined;hopperUtils['avgHandleTime'](_0x449711['dialPredictiveInterval'])[_0xa0e3('0x36')](this[_0xa0e3('0x1c6')](_0x449711))[_0xa0e3('0x36')](mergeDataErlangB(_0x449711))[_0xa0e3('0x36')](this[_0xa0e3('0x1c7')](_0x449711))[_0xa0e3('0x99')](loggerCatchPredictive(_0xa0e3('0x1c9'),_0x449711));}else if(_0x449711[_0xa0e3('0x1b5')]&&_0x13305d<_0x449711['predictiveIntervalAvailable']-_0x3d49ab){clearPredictiveAttributes(_0x449711);loggerPredictive[_0xa0e3('0x40')](_0x449711[_0xa0e3('0x3e')],_0xa0e3('0x1ca'),_0x13305d,_0xa0e3('0x1cb'),_0x449711[_0xa0e3('0x1b5')],'-',_0x3d49ab,'=',_0x449711[_0xa0e3('0x1b5')]-_0x3d49ab,')');}else if(_0x449711[_0xa0e3('0x1b5')]&&_0x13305d>_0x449711['predictiveIntervalAvailable']+_0x523ec3){clearPredictiveAttributes(_0x449711);loggerPredictive[_0xa0e3('0x40')](_0x449711[_0xa0e3('0x3e')],'switch\x20in\x20progressive\x20because\x20available\x20agents\x20(',_0x13305d,_0xa0e3('0x1cc'),_0x449711[_0xa0e3('0x1b5')],'+',_0x523ec3,'=',_0x449711[_0xa0e3('0x1b5')]+_0x523ec3,')');}};Dialer['prototype'][_0xa0e3('0x1c6')]=function(_0x809304){var _0x58a252=this;return function(_0x7f509e){return new Promise(function(_0x2d4bda,_0x2b270f){_[_0xa0e3('0xed')](_0x809304,_0x7f509e[0x0]);if(checkGetDataPredictive(_0x7f509e[0x0])){var _0x4899af=_0x809304[_0xa0e3('0x1b5')]=_0x809304[_0xa0e3('0x137')]+_0x809304['available'];var _0x555455=_0x809304[_0xa0e3('0x1bb')]*0x3c;var _0x25e36d=_0x7f509e[0x0]['predictiveIntervalAvgTalktime']+_0x7f509e[0x0]['predictiveIntervalAvgHoldtime'];var _0x35ad14=(_0x7f509e[0x0]['predictiveIntervalAnsweredCalls']+_0x7f509e[0x0][_0xa0e3('0x45')]+_0x7f509e[0x0]['predictiveIntervalDroppedCallsCallersExit'])/_0x7f509e[0x0]['predictiveIntervalTotalCalls'];_0x809304[_0xa0e3('0x1b7')]=_0x35ad14>0x0?_0x35ad14:0x1;switch(_0x809304[_0xa0e3('0x1bd')]){case _0xa0e3('0x1be'):var _0x5b04ee=_0x809304[_0xa0e3('0x1cd')]/0x64;return _0x58a252[_0xa0e3('0x1ce')](_0x4899af,_0x555455,_0x25e36d,_0x35ad14,_0x5b04ee)[_0xa0e3('0x36')](function(_0x530a26){return _0x2d4bda(_0x530a26);});case _0xa0e3('0x1cf'):var _0x3f89ae=_0x809304[_0xa0e3('0x1cd')]/0x64;return _0x58a252[_0xa0e3('0x1d0')](_0x4899af,_0x555455,_0x25e36d,_0x35ad14,_0x3f89ae)[_0xa0e3('0x36')](function(_0x4ed786){return _0x2d4bda(_0x4ed786);});default:return _0x2b270f(msgResponse(_0xa0e3('0x1d1'),'Failure',_0xa0e3('0x1d2')));}}else{return _0x2b270f(msgResponse('[getDataPredictive]',_0xa0e3('0x88'),'check\x20failure'));}});};};Dialer[_0xa0e3('0x17')][_0xa0e3('0x1d3')]=function(_0x5b1e03){var _0x372b4c=this;return function(_0x46c362){return new Promise(function(_0x452866,_0x300b3f){_[_0xa0e3('0xed')](_0x5b1e03,_0x46c362[0x0]);if(checkGetDataPredictive(_0x46c362[0x0])){loggerPredictive['info'](JSON['stringify'](_0x46c362[0x0]));if(_0x5b1e03[_0xa0e3('0x1bd')]===_0xa0e3('0x1be')){return _0x372b4c[_0xa0e3('0x14c')](_0x5b1e03['id'])[_0xa0e3('0x36')](function(_0x4ce274){var _0x262498=_0x5b1e03[_0xa0e3('0x1d4')]-_0x4ce274[0x0]['outboundQueuePauses'];var _0x4c4532=_0x5b1e03[_0xa0e3('0x1bb')]*0x3c;var _0x29de2=_0x46c362[0x0]['predictiveIntervalAvgTalktime']+_0x46c362[0x0][_0xa0e3('0x47')];var _0x309800=(_0x46c362[0x0]['predictiveIntervalAnsweredCalls']+_0x46c362[0x0][_0xa0e3('0x45')]+_0x46c362[0x0][_0xa0e3('0x46')])/_0x46c362[0x0]['predictiveIntervalTotalCalls'];var _0x4cdd65=_0x5b1e03[_0xa0e3('0x1cd')]/0x64;_0x5b1e03[_0xa0e3('0x1d5')]=_0x4ce274[0x0][_0xa0e3('0x1d6')]||0x0;_0x5b1e03[_0xa0e3('0x1b7')]=_0x309800>0x0?_0x309800:0x1;return _0x372b4c[_0xa0e3('0x1ce')](_0x262498,_0x4c4532,_0x29de2,_0x309800,_0x4cdd65);})[_0xa0e3('0x36')](function(_0x38227f){return _0x452866(_0x38227f);})[_0xa0e3('0x99')](function(_0x105b8f){return _0x300b3f(msgResponse(_0xa0e3('0x1d7'),_0xa0e3('0x88'),JSON['stringify'](_0x105b8f)));});}if(_0x5b1e03['dialPredictiveOptimization']===_0xa0e3('0x1cf')){return _0x372b4c[_0xa0e3('0x14c')](_0x5b1e03['id'])[_0xa0e3('0x36')](function(_0x1a665c){var _0x1470ec=_0x5b1e03['loggedIn']-_0x1a665c[0x0][_0xa0e3('0x1d6')];var _0x4d9312=_0x5b1e03['dialPredictiveInterval']*0x3c;var _0x1b14cf=_0x46c362[0x0][_0xa0e3('0x48')]+_0x46c362[0x0]['predictiveIntervalAvgHoldtime'];var _0xcc6fb5=(_0x46c362[0x0]['predictiveIntervalAnsweredCalls']+_0x46c362[0x0][_0xa0e3('0x45')]+_0x46c362[0x0][_0xa0e3('0x46')])/_0x46c362[0x0][_0xa0e3('0x49')];var _0x4943e0=_0x5b1e03[_0xa0e3('0x1cd')]/0x64;_0x5b1e03['predictiveIntervalPauses']=_0x1a665c[0x0][_0xa0e3('0x1d6')]||0x0;_0x5b1e03[_0xa0e3('0x1b7')]=_0xcc6fb5>0x0?_0xcc6fb5:0x1;return _0x372b4c[_0xa0e3('0x1d0')](_0x1470ec,_0x4d9312,_0x1b14cf,_0xcc6fb5,_0x4943e0);})['then'](function(_0x3528f6){return _0x452866(_0x3528f6);})[_0xa0e3('0x99')](function(_0x2e91dd){return _0x300b3f(msgResponse(_0xa0e3('0x1d7'),_0xa0e3('0x88'),JSON[_0xa0e3('0x7b')](_0x2e91dd)));});}}else{return _0x300b3f(msgResponse(_0xa0e3('0x1d1'),_0xa0e3('0x88'),_0xa0e3('0x1d8')));}});};};Dialer[_0xa0e3('0x17')]['startMethodPredictive']=function(_0x3b3aea){var _0x53d496=this;return function(){var _0x194847=0x0;var _0x2b8c11=Math[_0xa0e3('0x1b6')](_0x3b3aea[_0xa0e3('0x1d9')]*0x3e8);if(_0x2b8c11>0x0){_0x2b8c11=_0x2b8c11<0x64?0x64:_0x2b8c11;loggerPredictive[_0xa0e3('0x40')](_0x3b3aea['name'],'one\x20call\x20every:',_0x2b8c11,_0xa0e3('0x1da'));_0x3b3aea[_0xa0e3('0x59')]=setInterval(function(){_0x53d496['handlePredictive'](_0x3b3aea);loggerPredictiveCalls[_0xa0e3('0x40')]('[handlePredictive]',_0x194847+=0x1);},_0x2b8c11);}else{loggerPredictive[_0xa0e3('0x40')](_0x3b3aea[_0xa0e3('0x3e')],'fail\x20to\x20scheduled\x20calls');}};};Dialer[_0xa0e3('0x17')][_0xa0e3('0x1db')]=function(_0x4f726b,_0x54ddd6){var _0x1eec42=this;return function(_0x373caa){if(_[_0xa0e3('0x8a')](_0x373caa)){if(_['isNil'](_0x54ddd6[_0xa0e3('0x14f')])||!_0x54ddd6[_0xa0e3('0x1dc')]){if(_0x4f726b['dialMethod']===_0xa0e3('0x9')){_0x4f726b[_0xa0e3('0x67')]=_[_0xa0e3('0x4a')](_0x4f726b[_0xa0e3('0x67')])?!![]:_0x4f726b['queueStatusComplete'];var _0xe2b09b=uuid['v4']();_0x1eec42[_0xa0e3('0x21')][_0xe2b09b]=new Action(_0x4f726b,_0x54ddd6,_0xe2b09b);loggerBooked['info'](_0xa0e3('0x1dd'),_0xe2b09b,_0xa0e3('0x1de'),JSON[_0xa0e3('0x7b')](_0x4f726b[_0xa0e3('0x67')]),_0xa0e3('0x1df'),_0x4f726b[_0xa0e3('0x3e')]);if(_0x4f726b[_0xa0e3('0x67')]){_0x4f726b[_0xa0e3('0x67')]=![];_0x1eec42[_0xa0e3('0x25')][_0x1eec42['actions'][_0xe2b09b][_0xa0e3('0xb2')]]=[];ami[_0xa0e3('0x93')]({'actionid':_0xe2b09b,'action':_0xa0e3('0x1e0'),'queue':_0x4f726b[_0xa0e3('0x3e')]})[_0xa0e3('0x99')](function(){utils[_0xa0e3('0xc1')](_0x4f726b,_0xa0e3('0x1e1'));hopperUtils[_0xa0e3('0xd3')]({'active':![],'ContactId':_0x1eec42[_0xa0e3('0x21')][_0xe2b09b][_0xa0e3('0xd6')],'ListId':_0x1eec42[_0xa0e3('0x21')][_0xe2b09b][_0xa0e3('0xd7')],'VoiceQueueId':_0x1eec42[_0xa0e3('0x21')][_0xe2b09b]['VoiceQueueId']||undefined,'CampaignId':_0x1eec42[_0xa0e3('0x21')][_0xe2b09b][_0xa0e3('0xd9')]||undefined})[_0xa0e3('0x99')](loggerCatch(_0xa0e3('0x1e2')));delete _0x1eec42[_0xa0e3('0x21')][_0xe2b09b];});}else{loggerBooked[_0xa0e3('0x40')](_0xa0e3('0x1e3'),JSON['stringify'](_0x4f726b[_0xa0e3('0x67')]),_0xa0e3('0x1df'),_0x4f726b[_0xa0e3('0x3e')]);utils['decrementOriginate'](_0x4f726b,_0xa0e3('0x1e1'));hopperUtils[_0xa0e3('0xd3')]({'active':![],'ContactId':_0x1eec42[_0xa0e3('0x21')][_0xe2b09b][_0xa0e3('0xd6')],'ListId':_0x1eec42[_0xa0e3('0x21')][_0xe2b09b]['ListId'],'VoiceQueueId':_0x1eec42[_0xa0e3('0x21')][_0xe2b09b][_0xa0e3('0xd8')]||undefined,'CampaignId':_0x1eec42[_0xa0e3('0x21')][_0xe2b09b]['CampaignId']||undefined})['catch'](loggerCatch(_0xa0e3('0x1e2')));delete _0x1eec42['actions'][_0xe2b09b];}}else{return _0x1eec42['actionOriginate'](_0x4f726b,_0x54ddd6);}}else{if(utils[_0xa0e3('0x57')](undefined,_0x54ddd6[_0xa0e3('0x1e4')])<_0x4f726b['dialRecallMeTimeout']*0x3c){if(_0x54ddd6['Agent']&&!_0x54ddd6[_0xa0e3('0x144')][_0xa0e3('0x1e5')]){_0x1eec42[_0xa0e3('0x1b')][_0xa0e3('0xf1')](_0x54ddd6['id'])[_0xa0e3('0x19')](function(){utils[_0xa0e3('0xc1')](_0x4f726b,'[checkContactBlack]');});}else{hopperUtils[_0xa0e3('0x1e6')]({'active':![]},_0x54ddd6['id'],0x1)[_0xa0e3('0x19')](function(){utils[_0xa0e3('0xc1')](_0x4f726b,_0xa0e3('0x1e1'));});}}else{_0x4f726b[_0xa0e3('0x1e7')]+=0x1;utils[_0xa0e3('0xc1')](_0x4f726b,'[checkContactBlack]');if(_0x4f726b['dialRecallInQueue']){hopperUtils[_0xa0e3('0xd3')]({'active':![],'recallme':![],'UserId':null,'ContactId':_0x54ddd6[_0xa0e3('0xd6')],'ListId':_0x54ddd6[_0xa0e3('0xd7')],'VoiceQueueId':_0x54ddd6['VoiceQueueId']||undefined,'CampaignId':_0x54ddd6[_0xa0e3('0xd9')]||undefined})[_0xa0e3('0x99')](loggerCatch(_0xa0e3('0x1e8')));hopperUtils[_0xa0e3('0xbd')](createObjHistory(_0x4f726b,_0x54ddd6,utils['CAMPAIGN_STATUS'][_0xa0e3('0x1e9')],0x17,_0xa0e3('0x1ea')))['catch'](loggerCatch(_0xa0e3('0x1eb')));}else{_0x1eec42[_0xa0e3('0x11e')](createObjHistory(_0x4f726b,_0x54ddd6,utils[_0xa0e3('0x5b')]['RECALL_TIMEOUT'],0x16,_0xa0e3('0x1ec')),_0xa0e3('0x1ed'),_0xa0e3('0x1ee'));}}}}else{_0x4f726b[_0xa0e3('0x1ef')]+=0x1;_0x1eec42['saveInDb'](createObjHistory(_0x4f726b,_0x54ddd6,utils['CAMPAIGN_STATUS'][_0xa0e3('0x1f0')],0xd,_0xa0e3('0x1f1')),_0xa0e3('0x1f2'),'[Originate][MoveBlacklist]');throw _0xa0e3('0x1f3');}};};Dialer[_0xa0e3('0x17')][_0xa0e3('0x152')]=function(_0x128778){var _0x218771=this;var _0x3f8363=_0x128778[_0xa0e3('0x1f4')]-_0x128778[_0xa0e3('0x75')];emitCampaignSummary(_0x128778);if(_0x3f8363>0x0&&_0x128778[_0xa0e3('0x1f5')]==0x0){if(_0x3f8363>this['maxNumberOriginate']){_0x3f8363=this[_0xa0e3('0x1f6')];}_0x128778[_0xa0e3('0x1f5')]=0x1;hopperUtils[_0xa0e3('0x1f7')](_0x128778,_0x3f8363)['then'](function(_0x23699f){_0x128778[_0xa0e3('0x1f5')]=0x0;if(_0x23699f){if(!utils[_0xa0e3('0x1f8')](_0x23699f)){_0x128778[_0xa0e3('0x60')]=utils['CAMPAIGN_STATUS'][_0xa0e3('0x61')];logger[_0xa0e3('0x40')]('[getContactCampaign2][Empty]'+_0x128778['name']);}else{_0x128778[_0xa0e3('0x75')]+=_0x23699f[_0xa0e3('0x91')];_0x128778['message']=utils[_0xa0e3('0x5b')]['RUNNING'];for(var _0x40b4aa=0x0;_0x40b4aa<_0x23699f[_0xa0e3('0x91')];_0x40b4aa+=0x1){_0x128778['ivrTotalCallsDays']+=0x1;if(_[_0xa0e3('0xe9')](_0x23699f[_0x40b4aa])||_[_0xa0e3('0xe9')](_0x23699f[_0x40b4aa][_0xa0e3('0x16e')])||_[_0xa0e3('0xe9')](_0x23699f[_0x40b4aa][_0xa0e3('0x157')])){_0x218771['emptyContact'](_0xa0e3('0x1f9'),_0x128778,_0x23699f[_0x40b4aa]);}else{hopperUtils[_0xa0e3('0x1fa')](_[_0xa0e3('0x69')](_0x23699f[_0x40b4aa],[_0xa0e3('0xd9'),_0xa0e3('0x157')]))['then'](_0x218771[_0xa0e3('0x1db')](_0x128778,_0x23699f[_0x40b4aa]))[_0xa0e3('0x99')](function(_0x4a7a51){logger[_0xa0e3('0x5a')](_0xa0e3('0x1fb'),_0x4a7a51);utils[_0xa0e3('0xc1')](_0x128778,_0xa0e3('0x1fc'));});}}}}})[_0xa0e3('0x99')](function(_0x5e64d5){_0x128778['temp']=0x0;logger[_0xa0e3('0x5a')]('[getContactCampaign2]',_0x5e64d5);});}};Dialer['prototype'][_0xa0e3('0xa5')]=function(_0x3205d9,_0x36b3fd){var _0x30fd68=this;var _0x554822=[];if(_0x36b3fd<0x1||_0x3205d9[_0xa0e3('0xa4')]===_0xa0e3('0x9')){_0x36b3fd=0x1;}var _0xa73043=Math[_0xa0e3('0x1b6')](_0x3205d9[_0xa0e3('0x136')]*_0x36b3fd)-_0x3205d9[_0xa0e3('0x75')];if(_0x3205d9[_0xa0e3('0x1fd')]>0x0){var _0x41d5d0=_0x3205d9[_0xa0e3('0x1fd')]-_0x3205d9[_0xa0e3('0x75')]-_0x3205d9[_0xa0e3('0x137')]-_0x3205d9[_0xa0e3('0x138')];if(_0xa73043>_0x41d5d0){_0xa73043=_0x41d5d0;}}if(_0xa73043>0x0&&_0x3205d9[_0xa0e3('0x1f5')]==0x0){if(_0x3205d9[_0xa0e3('0xa4')]===_0xa0e3('0x9')){_0xa73043=0x1;}if(_0xa73043>this[_0xa0e3('0x1f6')]){_0xa73043=this[_0xa0e3('0x1f6')];}for(var _0x30d48a in this[_0xa0e3('0x1e')]){if(typeof this[_0xa0e3('0x1e')][_0x30d48a]!==_0xa0e3('0x14a')){if(this[_0xa0e3('0x1e')][_0x30d48a][_0xa0e3('0x63')]===_0xa0e3('0x1fe')&&this['agents'][_0x30d48a]['status']===_0xa0e3('0x1ff')){_0x554822[_0xa0e3('0x92')](this['agents'][_0x30d48a]['id']);}}}_0x3205d9[_0xa0e3('0x1f5')]=0x1;hopperUtils[_0xa0e3('0x200')](_0x3205d9,_0x554822,_0xa73043)[_0xa0e3('0x36')](function(_0x5a8388){_0x3205d9['temp']=0x0;if(_0x5a8388){if(!utils[_0xa0e3('0x1f8')](_0x5a8388)){hopperUtils['countReScheduled'](_0x3205d9)[_0xa0e3('0x36')](sendMessageReschedule(_0x3205d9))['catch'](loggerCatch('[countReScheduled]\x20'));}else{_0x3205d9[_0xa0e3('0x75')]+=_0x5a8388['length'];_0x3205d9['message']=_0x3205d9[_0xa0e3('0xa4')]===_0xa0e3('0x9')?utils[_0xa0e3('0x5b')][_0xa0e3('0x139')]:utils[_0xa0e3('0x5b')][_0xa0e3('0x201')];for(var _0x16a36c=0x0;_0x16a36c<_0x5a8388['length'];_0x16a36c+=0x1){if(_[_0xa0e3('0xe9')](_0x5a8388[_0x16a36c])||_['isNil'](_0x5a8388[_0x16a36c][_0xa0e3('0x16e')])||_[_0xa0e3('0xe9')](_0x5a8388[_0x16a36c][_0xa0e3('0x157')])){_0x30fd68[_0xa0e3('0x14e')]('[actionOriginate]\x20',_0x3205d9,_0x5a8388[_0x16a36c]);}else{hopperUtils[_0xa0e3('0x202')](_[_0xa0e3('0x69')](_0x5a8388[_0x16a36c],[_0xa0e3('0xd8'),_0xa0e3('0x157')]))[_0xa0e3('0x36')](_0x30fd68[_0xa0e3('0x1db')](_0x3205d9,_0x5a8388[_0x16a36c]))['catch'](function(_0x2f6c5b){logger[_0xa0e3('0x5a')](_0xa0e3('0x203'),_0x2f6c5b);utils['decrementOriginate'](_0x3205d9,_0xa0e3('0x204'));});}}}}})[_0xa0e3('0x99')](function(_0x10eeaf){_0x3205d9[_0xa0e3('0x1f5')]=0x0;logger['error']('[getContactCampaign2]',_0x10eeaf);});}};Dialer['prototype'][_0xa0e3('0x59')]=function(_0x2fa53d){if(_0x2fa53d['dialLimitQueue']>0x0){var _0x1b28e4=_0x2fa53d[_0xa0e3('0x1fd')]-_0x2fa53d[_0xa0e3('0x75')]-_0x2fa53d[_0xa0e3('0x137')];if(_0x1b28e4>0x0&&_0x2fa53d[_0xa0e3('0x1f5')]==0x0){this[_0xa0e3('0x205')](_0x2fa53d);}else{loggerPredictiveCalls[_0xa0e3('0x40')](_0xa0e3('0x206'));}}else{this['tryOriginatePredictive'](_0x2fa53d);}};Dialer[_0xa0e3('0x17')][_0xa0e3('0x205')]=function(_0x5d04bd){var _0x264954=this;var _0xacd0df=[];_0x5d04bd['originated']+=0x1;for(var _0x372aaa in this[_0xa0e3('0x1e')]){if(typeof this[_0xa0e3('0x1e')][_0x372aaa]!==_0xa0e3('0x14a')){if(this[_0xa0e3('0x1e')][_0x372aaa]['state']==='not_inuse'&&this[_0xa0e3('0x1e')][_0x372aaa][_0xa0e3('0x7f')]===_0xa0e3('0x1ff')){_0xacd0df['push'](this[_0xa0e3('0x1e')][_0x372aaa]['id']);}}}_0x5d04bd[_0xa0e3('0x1f5')]=0x1;return this['getContactDialer'](_0x5d04bd['id'],_0xacd0df,0x1,_0x5d04bd[_0xa0e3('0x207')],_0x5d04bd)['then'](function(_0x12a86e){_0x5d04bd[_0xa0e3('0x1f5')]=0x1;if(_0x12a86e){if(!utils[_0xa0e3('0x1f8')](_0x12a86e)){utils['checkContactLowerLimitOriginate'](_0x5d04bd,0x1,0x0);return hopperUtils[_0xa0e3('0x208')](_0x5d04bd)['then'](sendMessageReschedule(_0x5d04bd))['catch'](loggerCatch(_0xa0e3('0x209')));}else{_0x5d04bd['message']=utils['CAMPAIGN_STATUS'][_0xa0e3('0x201')];if(_['isNil'](_0x12a86e[0x0])||_[_0xa0e3('0xe9')](_0x12a86e[0x0][_0xa0e3('0x16e')])||_['isNil'](_0x12a86e[0x0][_0xa0e3('0x157')])){_0x264954[_0xa0e3('0x14e')](_0xa0e3('0x1f9'),_0x5d04bd,_0x12a86e[0x0]);}else{return hopperUtils[_0xa0e3('0x202')](_[_0xa0e3('0x69')](_0x12a86e[0x0],[_0xa0e3('0xd8'),_0xa0e3('0x157')]))[_0xa0e3('0x36')](_0x264954[_0xa0e3('0x1db')](_0x5d04bd,_0x12a86e[0x0]))[_0xa0e3('0x99')](function(_0x3a55db){logger[_0xa0e3('0x5a')]('[actionOriginatePredictive]',_0x3a55db);utils[_0xa0e3('0xc1')](_0x5d04bd,_0xa0e3('0x20a'));});}}}})[_0xa0e3('0x99')](function(_0x445521){_0x5d04bd[_0xa0e3('0x1f5')]=0x0;logger[_0xa0e3('0x5a')](_0xa0e3('0x20b'),_0x445521);});};Dialer[_0xa0e3('0x17')][_0xa0e3('0x1ce')]=function(_0x54d09a,_0x146b4c,_0x93bbba,_0x5cf9df,_0x2dcf9e,_0x25bd0b){loggerPredictive[_0xa0e3('0x40')](_0xa0e3('0x20c'));loggerPredictive['info']('M:\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20',_0x54d09a);loggerPredictive['info'](_0xa0e3('0x20d'),_0x146b4c);loggerPredictive['info'](_0xa0e3('0x20e'),_0x93bbba);loggerPredictive[_0xa0e3('0x40')]('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',_0x5cf9df);loggerPredictive['info'](_0xa0e3('0x20f'),_0x2dcf9e);loggerPredictive[_0xa0e3('0x40')]('---------------------------');return new Promise(function(_0x4a5a56,_0x1024dd){if(_0x54d09a<=0x0||isNaN(_0x54d09a)){return _0x1024dd(msgResponse(_0xa0e3('0x210'),_0xa0e3('0x7a'),_0xa0e3('0x211')+_0x54d09a));}if(_0x93bbba<=0x0||isNaN(_0x93bbba)){return _0x1024dd(msgResponse(_0xa0e3('0x210'),_0xa0e3('0x7a'),_0xa0e3('0x212')+_0x93bbba));}if(_0x5cf9df<=0x0||isNaN(_0x5cf9df)){return _0x1024dd(msgResponse(_0xa0e3('0x210'),_0xa0e3('0x7a'),_0xa0e3('0x213')+_0x5cf9df));}if(_0x146b4c<=0x0||isNaN(_0x146b4c)){return _0x1024dd(msgResponse('[abandonmentRate]',_0xa0e3('0x7a'),_0xa0e3('0x214')+_0x146b4c));}if(_0x2dcf9e<=0x0||isNaN(_0x2dcf9e)){return _0x1024dd(msgResponse(_0xa0e3('0x210'),_0xa0e3('0x7a'),_0xa0e3('0x215')+_0x2dcf9e));}_0x25bd0b=_0x25bd0b||0x0;var _0x4f687b=0x1/_0x93bbba;var _0x46cf40=0x0;var _0x2578c7=0x0;var _0x5386bb=0x0;var _0x7cc94c=0x0;for(var _0x935809=0x0;_0x5386bb<_0x2dcf9e;_0x935809+=0x1){_0x2578c7=_0x935809/_0x146b4c;_0x46cf40=(_0x5cf9df*_0x2578c7+_0x25bd0b)/_0x4f687b;_0x5386bb=utils[_0xa0e3('0x216')](_0x46cf40,_0x54d09a);_0x7cc94c=_0x46cf40/_0x54d09a*(0x1-utils[_0xa0e3('0x216')](_0x46cf40,_0x54d09a));}return _0x4a5a56({'erlangCalls':_0x935809,'erlangCallToSecond':_0x146b4c/_0x935809,'erlangAbandonmentRate':_0x5386bb,'erlangBusyFactor':_0x7cc94c});});};Dialer[_0xa0e3('0x17')]['busyFactor']=function(_0x2f4a10,_0x3dcc17,_0x114a53,_0x2af59d,_0x3c0cd8,_0x48afa2){loggerPredictive[_0xa0e3('0x40')]('----\x20Agent\x20Busy\x20Factor\x20----');loggerPredictive[_0xa0e3('0x40')](_0xa0e3('0x217'),_0x2f4a10);loggerPredictive[_0xa0e3('0x40')](_0xa0e3('0x20d'),_0x3dcc17);loggerPredictive[_0xa0e3('0x40')](_0xa0e3('0x20e'),_0x114a53);loggerPredictive[_0xa0e3('0x40')]('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',_0x2af59d);loggerPredictive[_0xa0e3('0x40')](_0xa0e3('0x218'),_0x3c0cd8);loggerPredictive[_0xa0e3('0x40')]('---------------------------');return new Promise(function(_0x16bac0,_0x2ddfda){if(_0x2f4a10<=0x0||isNaN(_0x2f4a10)){return _0x2ddfda(msgResponse(_0xa0e3('0x219'),'Error',_0xa0e3('0x211')+_0x2f4a10));}if(_0x114a53<=0x0||isNaN(_0x114a53)){return _0x2ddfda(msgResponse('[busyFactor]',_0xa0e3('0x7a'),_0xa0e3('0x212')+_0x114a53));}if(_0x2af59d<=0x0||isNaN(_0x2af59d)){return _0x2ddfda(msgResponse(_0xa0e3('0x219'),'Error','p\x20=\x20'+_0x2af59d));}if(_0x3dcc17<=0x0||isNaN(_0x3dcc17)){return _0x2ddfda(msgResponse(_0xa0e3('0x219'),_0xa0e3('0x7a'),_0xa0e3('0x214')+_0x3dcc17));}if(_0x3c0cd8<=0x0||isNaN(_0x3c0cd8)){return _0x2ddfda(msgResponse('[busyFactor]',_0xa0e3('0x7a'),_0xa0e3('0x21a')+_0x3c0cd8));}_0x48afa2=_0x48afa2||0x0;var _0x4eddb3=0x1/_0x114a53;var _0x479823=0x0;var _0x18aa90=0x0;var _0x3d3d63=0x0;var _0x177bac=0x0;for(var _0x263c13=0x0;_0x177bac<_0x3c0cd8;_0x263c13+=0x1){_0x18aa90=_0x263c13/_0x3dcc17;_0x479823=(_0x2af59d*_0x18aa90+_0x48afa2)/_0x4eddb3;_0x3d3d63=utils[_0xa0e3('0x216')](_0x479823,_0x2f4a10);_0x177bac=_0x479823/_0x2f4a10*(0x1-utils[_0xa0e3('0x216')](_0x479823,_0x2f4a10));}return _0x16bac0({'erlangCalls':_0x263c13,'erlangCallToSecond':_0x3dcc17/_0x263c13,'erlangAbandonmentRate':_0x3d3d63,'erlangBusyFactor':_0x177bac});});};module['exports']=Dialer; \ No newline at end of file +var _0xdd28=['getSettings','then','isUndefined','emit','type','outbound','inspect','format','voice:queue:%s','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','predictiveIntervalAnsweredCalls','Dropped\x20Timeout:\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20','Dropped\x20Exit:\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20','predictiveIntervalDroppedCallsCallersExit','predictiveIntervalAvgHoldtime','AVG\x20Talk\x20Time:\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20','predictiveIntervalAvgTalktime','---------------------------','predictiveIntervalTotalCalls','Avg\x20Talk\x20Time\x20is\x20not\x20enough\x20for\x20predictive','Avg\x20Hold\x20Time\x20is\x20not\x20enough\x20for\x20predictive','Total\x20Calls\x20are\x20not\x20enough\x20for\x20predictive','---------\x20ErlangB\x20---------','Scheduled\x20Calls:\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20','One\x20call\x20every:\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20','erlangCallToSecond','Drop\x20Rate:\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20','erlangAbandonmentRate','Agent\x20Busy\x20Factor:\x20\x20\x20\x20\x20\x20\x20\x20\x20','erlangBusyFactor','merge','getSeconds','debug','startProgressive\x20value\x20cleared','handlePredictive','error','stack','contactsRescheduled','CONTACTS_RESCHEDULED','[getContactDialer2][ReScheduled]','contacts','message','CAMPAIGN_STATUS','NO_AVAILABLE_CONTACTS','[getContactDialer2][Empty]','statedesc','starttime','queueStatusComplete','[unlockQueueStatus][undefined]','pick','Interval','NULL_INTERVAL','\x20INTERVAL_IS_NULL','Intervals','INACTIVE','\x20NOT\x20Active','isIVRCampaign','campaign:ivr:%s','campaign:save','originated','sendMessageOneNotActive','is\x20not\x20active','[syncQueueSummary]\x20Campaign\x20Ivr:\x20','is\x20deactivated','[ifTime][Action]','stringify','prototype','isTrunkReachable','active','SIP/%s','reachable','status','unmonitored','checkIsTrunkReachable','Trunk','TRUNK_NOT_REACHABLE','ifTimeIvr','ifTime','\x20Intervals\x20is\x20empty\x20','timezones','UNKNOWN_TIMEZONE','Failure','\x20Timezone\x20unknow\x20','length','push','Action','command','iftime\x20%s,%s','interval','content','indexOf','true','catch','OVERTIME_INTERVAL','[ifTime][promiseAll]','Global:\x20','\x20Interval\x20is\x20overtime:\x20','resetActiveCalls','syncCampaigns','isIVRCampaignActive','resolve','checkIfTime','dialTimezone','checkIfTimeIntervals','checkDialMethod','dialMethod','progressive','power','handlePower','dialPowerLevel','Queue','method\x20not\x20recognized','dialGlobalInterval','silly','Dialer::ifTime()','intervalIftime','OVERTIME_GLOBAL_INTERVAL','Dialer::ifTime()\x20errResponse\x20NOT\x20NULL:','AMI\x20IfTime','queue','uniqueid','ivr','decrementOriginate','answertime','YYYY-MM-DD\x20HH:mm:ss','outboundAnswerCallsDay','reason','agiafterat','dialQueueProject2','dialAgiAfterHangupAgent','createHistory','[syncAgentComplete][createHistory]','moveContactManagedDialer','[syncAgentComplete]','[syncQueueCallerAbandon]','droptime','responsetime','dialQueueTimeout','predictiveIntervalDroppedCallsTimeout','outboundDropCallsDayTimeout','predictiveIntervalErlangCallsDroppedCalls','state','Drop','TIMEOUT','countdropretry','countglobal','dialDropRetryFrequency','callAdditionalPhoneAfterMin','verifyAdditionalPhones','additional','dialDropMaxRetry','add','minutes','ContactId','ListId','VoiceQueueId','CampaignId','[rescheduleContact][Drop]','endtime','calleridname','calleridnum','[syncAgentComplete][createHistory][10]','outboundDropCallsDayCallersExit','Abandoned','dropreason','CALLEREXIT','countabandonedretry','voiceQueue','dialAbandonedMaxRetry','queueCallerAbandonCreateState','[rescheduleContact][Abandoned]','swapAdditionalPhones','actions','channel','actionid','strategy','rrmemory','roundrobin','isNil','locked','paused','stateinterface','idHopper','run','[Catch][Preview][syncQueueStatusComplete]','[syncQueueStatusComplete]','rescheduleContact','_rr','unlockRR','contactAgent-idHopper:\x20','Agent:\x20','[booked][unlock]','[booked][unlock2]','[unlock2][syncQueueStatusComplete]','[booked][unlock3]','[unlock3][syncQueueStatusComplete]','getQueue','response','Success','[syncOriginateResponse]','[callProgressDetecting]\x20','variable','amdstatus','xcally-motion-dialer','dialAMDActive','HANGUP','[syncVarSet]','HangupInAMD','membername','AMD','buildObj','amd','saveInDb','[syncHangupInAMD][createHistory]','[syncHangupInAMD]','value','MACHINE','outboundAnswerAgiCallsDay','countmachineretry','[syncAgentComplete][createHistory][0]','countbusyretry','countnoanswerretry','countagentrejectretry','dialGlobalMaxRetry','reason19\x20machine....','dialMachineMaxRetry','createStateFinal','reason\x2019\x20machine....','dialMachineRetryFrequency','[rescheduleContact][Machine]','custom:amd','[syncHangupInAMDIvr][createHistory]','Machine','countcongestionretry','countnosuchnumberretry','stateGlobal','[syncHangup]','ivrAnswerCallsDay','cause-txt','[syncAgentCompleteIvr][createHistory]','[syncAgentCompleteIvr]','[syncHangupIvr][createHistory]','[syncHangupIvr]','dialQueueProject','AnswerAGI','[syncHangup2]','Normal\x20Clearing','Unknown','[syncHangup][createHistory]','running','isPreviewCampaign','statusMessage','inUse','talking','pTalking','[syncQueueSummary]','compareToOutboundQueue','queueSummaryCountersUpdated','assign','throttle','filter','dialPreviewRecallmeReminder','online','handlePreviewRecallNotifications','map','Agent','user:%s','user:dialPreviewRecallReminder','checkPreviewRecallReminder','clearZombieChannels','[uniqueid]','undefined','enqueue','[clearZombieChannels]','[Dialer][checkChannel]','getVoiceQueueRtPauses','[getVoiceQueueRtPauses]\x20','emptyContact','notFound','[emptyContact][createHistory]','handleIvr','actionOriginate','object','originate','phone','contact\x20is\x20undefine','getCaller','\x22agi://%s/square,%s\x22','\x22%s,%s%s,,,%s\x22','dialQueueOptions','NONE','ACTIVE','dialAMDInitialSilence','XMD-AMDGREETING','dialAMDGreeting','dialAMDTotalAnalysisTime','XMD-AMDMINWORDLENGTH','XMD-AMDBETWEENWORDSSILENCE','dialAMDBetweenWordsSilence','XMD-AMDMAXIMUMNUMBEROFWORDS','dialAMDMaximumNumberOfWords','XMD-AMDSILENCETHRESHOLD','dialAMDSilenceThreshold','XMD-AMDMAXIMUMWORDLENGTH','dialAMDMaximumWordLength','isOutboundQueue','XMD-VOICEQUEUEID','XMD-CAMPAIGNID','setXMDContactVariables','Contact','getCallerId','callerid','dialOriginateCallerIdName','getCallerIdRandom','dialOriginateCallerIdNumber','dialRandomLastDigitCallerIdNumber','TrunkBackup','XMD-ORIGINATECALLERIDNAME','originatecalleridname','extractCalleridName','variables','SIP/%s/%s%s','dialPrefix','trim','dialCutDigit','substring','from-sip','dialOriginateTimeout','[originateError]:\x20%s','OriginateError','[originate][error]','Error','checkRetriveMax','dialNoAnswerMaxRetry','dialNoAnswerRetryFrequency','dialBusyMaxRetry','dialCongestionMaxRetry','[rescheduleContact]\x20[Congestion]','dialNoSuchNumberMaxRetry','dialNoSuchNumberRetryFrequency','dialAbandonedRetryFrequency','dialAgentRejectRetryFrequency','[rescheduleContact][AgentReject]','callProgressDetecting','[callProgressDetecting]','entity\x20is\x20undefine','evt\x20is\x20undefine','outboundNoSuchCallsDay','nosuchnumber','reason\x200\x20no\x20such\x20number....','outboundNoAnswerCallsDay','NoAnswer','buildNoAnswerEventPayload','custom:agentnoanswer','[syncAgentComplete][createHistory][3]','reason\x203\x20ringing\x20no\x20answer','custom:agentbusy','busy','[syncAgentComplete][createHistory][5]','reason\x205\x20busy','outboundCongestionCallsDay','Congestion','custom:agentcongestion','congestion','[syncAgentComplete][createHistory][8]','reason\x208\x20congestion','outboundAbandonedCallsDay','[syncAgentComplete][createHistory][11]','reason\x2011\x20abandoned','outboundRejectCallsDay','AgentReject','custom:agentreject','agentreject','[syncAgentComplete][createHistory][20]','dialAgentRejectMaxRetry','reason\x2020\x20agentreject','outboundUnknownCallsDay','[syncAgentComplete][createHistory][?]','Global','[moveContactManagedDialer][0]','contact\x20not\x20moved','dialPredictiveOptimizationPercentage','round','predictiveIntervalAvailable','predictiveIntervalMaxThreshold','predictiveIntervalMinThreshold','available','floor','erlangCalls','[startMethodPredictive][StartProgressive]','check\x20predictive\x20is\x20not\x20undefine','check\x20handlePredictive\x20is\x20not\x20undefine','collection\x20data\x20in\x20progressive\x20at','dialPredictiveInterval','dialPredictiveOptimization','dropRate','[stopMethodPredictive][ReStartProgressive][ExceededDropDay]','Dropped\x20calls\x20day','[stopMethodPredictive][ReStartProgressive][ExceededDropInterval]','Max\x20Drop\x20','Drop\x20in\x20this\x20interval','started\x20in\x20predictive\x20at','avgHandleTime','getDataPredictive','startMethodPredictive','Predictive\x20after\x20first\x20interval','switch\x20in\x20progressive\x20because\x20available\x20agents\x20(',')\x20are\x20less\x20than\x20threshold\x20(',')\x20are\x20more\x20than\x20threshold\x20(','agentBusyFactor','[getDataPredictive]','Unknown\x20Predictive','outboundQueuePauses','predictiveIntervalHitRate','abandonmentRate','[CatchErlangB]','loggedIn','predictiveIntervalPauses','busyFactor','one\x20call\x20every:','milliseconds','[handlePredictive]','fail\x20to\x20scheduled\x20calls','checkContactBlack','UserId','recallme','[booked][checkContactBlack]','queueStatusComplete:\x20','Queue:\x20','queuestatus','[unlockOriginate][syncQueueStatusComplete]','[checkContactBlack]','scheduledat','dialRecallMeTimeout','voicePause','preview','outboundReCallsDay','dialRecallInQueue','RecallInQueue','[Originate][HistoryDialRecallInQueue][historyCatch]','RECALL_TIMEOUT','RecallFailedTimeout','[Originate][HistoryRecallClose]','outboundBlacklistCallsDay','BLACKLIST','Blacklist','[Originate][historyBlacklist]','[Originate][MoveBlacklist]','inBlackList','limitCalls','temp','getContactDialerIvr','[getContactCampaign2][Empty]','RUNNING','[actionOriginate]\x20','checkIsBlackListIvr','[actionOriginateIvr]','[handleIvr]','[getContactCampaign2]','booked','not_inuse','getContactDialer','checkContactEmpty','countReScheduled','[countReScheduled]\x20','checkIsBlackList','[actionOriginate]','[handlePower]','dialLimitQueue','tryOriginatePredictive','[handlePredictive][limitChannel]','dialOrderByScheduledAt','[actionOriginatePredictive]','--------\x20Drop\x20Rate\x20--------','Interval:\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20','Ts:\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20','P:\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20','[abandonmentRate]','m\x20=\x20','p\x20=\x20','interval\x20=\x20','erlangb','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','Umin:\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20','[busyFactor]','exports','util','lodash','uuid','moment','ioredis','./utils','./utils/hopper','dialer','../../../config/logger','predictive','predictiveCalls','syncQueueSummary','redis','defaults','socket.io-emitter','../rpc/cmHopper','../rpc/voiceQueueRt','../rpc/setting','../rpc/interval','./models/action','./models/history','./models/final','./models/agentComplete','env','XCALLY_IP_AGI','127.0.0.1','tail','finally','sequence','voiceQueues','campaigns','agents','trunks','maxNumberOriginate','contactsId','uniqueId','optionPredictive','startPredictive','startProgressive','queueBooked','queueBookedRR','queuesSummary','bind','queuecallerabandon','syncQueueCallerAbandon','syncOriginateResponse','agentcomplete','syncAgentComplete','syncQueueSummaryComplete','hangup','syncHangup','syncNewExten','varset','syncVarSet','queuemember','syncQueueMember','loopCampaigns','loopClearZombieChannels'];(function(_0x6f28c1,_0x2915b1){var _0x3f96f0=function(_0x4f2bde){while(--_0x4f2bde){_0x6f28c1['push'](_0x6f28c1['shift']());}};_0x3f96f0(++_0x2915b1);}(_0xdd28,0x1eb));var _0x8dd2=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0xdd28[_0x3dd15e];return _0x231fd0;};'use strict';var util=require(_0x8dd2('0x0'));var _=require(_0x8dd2('0x1'));var uuid=require(_0x8dd2('0x2'));var moment=require(_0x8dd2('0x3'));var rr=require('rr');var Redis=require(_0x8dd2('0x4'));var utils=require(_0x8dd2('0x5'));var hopperUtils=require(_0x8dd2('0x6'));var ut=require('../preview/util/util');var config=require('../../../config/environment/');var logger=require('../../../config/logger')(_0x8dd2('0x7'));var loggerBooked=require(_0x8dd2('0x8'))('booked');var loggerPredictive=require(_0x8dd2('0x8'))(_0x8dd2('0x9'));var loggerPredictiveCalls=require(_0x8dd2('0x8'))(_0x8dd2('0xa'));var loggerSyncQueueSummary=require(_0x8dd2('0x8'))(_0x8dd2('0xb'));var ami=require('../ami');config[_0x8dd2('0xc')]=_[_0x8dd2('0xd')](config[_0x8dd2('0xc')],{'host':'localhost','port':0x18eb});var io=require(_0x8dd2('0xe'))(new Redis(config[_0x8dd2('0xc')]));var cmHopper=require(_0x8dd2('0xf'));var voiceQueueRt=require(_0x8dd2('0x10'));var RpcSetting=require(_0x8dd2('0x11'));var Interval=require(_0x8dd2('0x12'));var Action=require(_0x8dd2('0x13'));var History=require(_0x8dd2('0x14'));var Final=require(_0x8dd2('0x15'));var AgentComplete=require(_0x8dd2('0x16'));var QueueCallerAbandon=require('./models/queueCallerAbandon');var Hangup=require('./models/hangup');var ipAgi=process[_0x8dd2('0x17')][_0x8dd2('0x18')]||_0x8dd2('0x19');var previewRecallmeReminderInterval=0x1;var Sequence=function(){};Sequence['prototype']['enqueue']=function(_0x5a691d){this['tail']=this[_0x8dd2('0x1a')]?this['tail'][_0x8dd2('0x1b')](_0x5a691d):_0x5a691d();};function Dialer(_0x285060,_0x1bed3d){this[_0x8dd2('0x1c')]=new Sequence();this['preview']=_0x1bed3d;this[_0x8dd2('0x1d')]=_0x285060[_0x8dd2('0x1d')];this[_0x8dd2('0x1e')]=_0x285060[_0x8dd2('0x1e')];this[_0x8dd2('0x1f')]=_0x285060[_0x8dd2('0x1f')];this[_0x8dd2('0x20')]=_0x285060['trunks'];this[_0x8dd2('0x21')]=config[_0x8dd2('0x21')]||0x2;this['channels']={};this['actions']={};this[_0x8dd2('0x22')]={};this[_0x8dd2('0x23')]={};this[_0x8dd2('0x24')]={};this[_0x8dd2('0x25')]={};this[_0x8dd2('0x26')]={};this['ivrOriginated']={};this[_0x8dd2('0x27')]={};this[_0x8dd2('0x28')]={};this[_0x8dd2('0x29')]={};ami['on']('agentconnect',this['syncAgentConnect'][_0x8dd2('0x2a')](this));ami['on'](_0x8dd2('0x2b'),this[_0x8dd2('0x2c')][_0x8dd2('0x2a')](this));ami['on']('originateresponse',this[_0x8dd2('0x2d')][_0x8dd2('0x2a')](this));ami['on'](_0x8dd2('0x2e'),this[_0x8dd2('0x2f')][_0x8dd2('0x2a')](this));ami['on']('custom:queuesummary',this[_0x8dd2('0xb')][_0x8dd2('0x2a')](this));ami['on']('custom:queuesummarycomplete',this[_0x8dd2('0x30')][_0x8dd2('0x2a')](this));ami['on'](_0x8dd2('0x31'),this[_0x8dd2('0x32')]['bind'](this));ami['on']('newexten',this[_0x8dd2('0x33')][_0x8dd2('0x2a')](this));ami['on'](_0x8dd2('0x34'),this[_0x8dd2('0x35')][_0x8dd2('0x2a')](this));ami['on'](_0x8dd2('0x36'),this[_0x8dd2('0x37')]['bind'](this));ami['on']('queuestatuscomplete',this['syncQueueStatusComplete']['bind'](this));this[_0x8dd2('0x38')]();this[_0x8dd2('0x39')]();RpcSetting[_0x8dd2('0x3a')]()[_0x8dd2('0x3b')](function(_0x5e1422){previewRecallmeReminderInterval=_0x5e1422['previewRecallmeReminderInterval'];});}function isNotNull(_0x586922){return _0x586922!==null&&!_[_0x8dd2('0x3c')](_0x586922);}function msgResponse(_0x308b4f,_0x9d02a5,_0x5bb2f1){return{'action':_0x308b4f,'response':_0x9d02a5,'message':_0x5bb2f1,'stack':_0x5bb2f1};}function emit(_0x3e3979,_0x205463,_0xbf8097){io['to'](_0x3e3979)[_0x8dd2('0x3d')](_0x205463,_0xbf8097);}function emitOutboundVoiceQueueSummary(_0x74fd1c){if(_0x74fd1c[_0x8dd2('0x3e')]===_0x8dd2('0x3f')){logger['debug']('[voiceQueueReport][queuesummary]\x20sending\x20voice_queue:save\x20event:',util[_0x8dd2('0x40')](_0x74fd1c,{'showHidden':![],'depth':null}));emit(util[_0x8dd2('0x41')](_0x8dd2('0x42'),_0x74fd1c[_0x8dd2('0x43')]),_0x8dd2('0x44'),_0x74fd1c);}}function checkGetDataPredictive(_0xeac4f3){if(isNotNull(_0xeac4f3)&&!_[_0x8dd2('0x45')](_0xeac4f3)){loggerPredictive['info']('-----\x20Stats\x20Predictive\x20---');loggerPredictive[_0x8dd2('0x46')](_0x8dd2('0x47'),_0xeac4f3['predictiveIntervalTotalCalls']);loggerPredictive['info'](_0x8dd2('0x48'),_0xeac4f3[_0x8dd2('0x49')]);loggerPredictive[_0x8dd2('0x46')](_0x8dd2('0x4a'),_0xeac4f3['predictiveIntervalDroppedCallsTimeout']);loggerPredictive[_0x8dd2('0x46')](_0x8dd2('0x4b'),_0xeac4f3[_0x8dd2('0x4c')]);loggerPredictive['info']('AVG\x20Hold\x20Time:\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20',_0xeac4f3[_0x8dd2('0x4d')]);loggerPredictive[_0x8dd2('0x46')](_0x8dd2('0x4e'),_0xeac4f3[_0x8dd2('0x4f')]);loggerPredictive[_0x8dd2('0x46')](_0x8dd2('0x50'));if(_0xeac4f3[_0x8dd2('0x51')]>0x0){if(!_[_0x8dd2('0x3c')](_0xeac4f3[_0x8dd2('0x4f')])&&_0xeac4f3[_0x8dd2('0x4f')]>0x0){return!![];}loggerPredictive[_0x8dd2('0x46')](_0x8dd2('0x52'));if(!_[_0x8dd2('0x3c')](_0xeac4f3[_0x8dd2('0x4d')])&&_0xeac4f3[_0x8dd2('0x4d')]>0x0){return!![];}loggerPredictive[_0x8dd2('0x46')](_0x8dd2('0x53'));}else{loggerPredictive['info'](_0x8dd2('0x54'));}}else{loggerPredictive['info']('History\x20information\x20are\x20empty');}return![];}function mergeDataErlangB(_0x3baf37){return function(_0x34523c){loggerPredictive[_0x8dd2('0x46')](_0x8dd2('0x55'));loggerPredictive[_0x8dd2('0x46')](_0x8dd2('0x56'),_0x34523c['erlangCalls']);loggerPredictive[_0x8dd2('0x46')](_0x8dd2('0x57'),_0x34523c[_0x8dd2('0x58')]);loggerPredictive[_0x8dd2('0x46')](_0x8dd2('0x59'),_0x34523c[_0x8dd2('0x5a')]);loggerPredictive[_0x8dd2('0x46')](_0x8dd2('0x5b'),_0x34523c[_0x8dd2('0x5c')]);loggerPredictive[_0x8dd2('0x46')](_0x8dd2('0x59'),_0x34523c[_0x8dd2('0x5a')]);loggerPredictive[_0x8dd2('0x46')]('---------------------------');_[_0x8dd2('0x5d')](_0x3baf37,_0x34523c);};}function ifInterval(_0x2433aa,_0x442c79){if(_[_0x8dd2('0x3c')](_0x442c79)){return![];}return utils[_0x8dd2('0x5e')](undefined,_0x442c79)<_0x2433aa*0x3c;}function clearPredictiveAttributes(_0x3f1928){if(_0x3f1928[_0x8dd2('0x26')]){_0x3f1928[_0x8dd2('0x26')]=undefined;loggerPredictive[_0x8dd2('0x5f')](_0x3f1928[_0x8dd2('0x43')],_0x8dd2('0x60'));}if(_0x3f1928['startPredictive']){_0x3f1928['startPredictive']=undefined;loggerPredictive[_0x8dd2('0x5f')](_0x3f1928['name'],'startPredictive\x20value\x20cleared');}if(_0x3f1928[_0x8dd2('0x61')]){clearInterval(_0x3f1928[_0x8dd2('0x61')]);_0x3f1928[_0x8dd2('0x61')]=undefined;loggerPredictive[_0x8dd2('0x5f')](_0x3f1928[_0x8dd2('0x43')],'handlePredictive\x20interval\x20cleared');}}function loggerCatchPredictive(_0x404dc1,_0x1168b3){return function(_0x3a03ad){loggerPredictive[_0x8dd2('0x62')](_0x1168b3['name'],_0x404dc1);loggerPredictive[_0x8dd2('0x62')](_0x3a03ad[_0x8dd2('0x63')]);clearPredictiveAttributes(_0x1168b3);};}function loggerCatch(_0x177bc7){return function(_0x483551){logger[_0x8dd2('0x62')](_0x177bc7,util['inspect'](_0x483551,{'showHidden':![],'depth':null}));};}function sendMessageReschedule(_0x1c80de){return function(_0x4839cb){if(isNotNull(_0x4839cb)&&isNotNull(_0x4839cb[0x0])){if(_0x4839cb[0x0][_0x8dd2('0x64')]>0x0){_0x1c80de['message']=utils['CAMPAIGN_STATUS'][_0x8dd2('0x65')];logger[_0x8dd2('0x46')](_0x8dd2('0x66')+_0x1c80de[_0x8dd2('0x43')],_0x4839cb[0x0][_0x8dd2('0x64')],_0x8dd2('0x67'));}else{_0x1c80de[_0x8dd2('0x68')]=utils[_0x8dd2('0x69')][_0x8dd2('0x6a')];logger[_0x8dd2('0x46')](_0x8dd2('0x6b')+_0x1c80de['name']);}}};}function createObjHistory(_0x5eafa2,_0x1fe2c0,_0x4b3e38,_0x48ff00,_0x2c3a11){_0x5eafa2[_0x8dd2('0x68')]=_0x4b3e38;var _0x36904e=new Action(_0x5eafa2,_0x1fe2c0);var _0x567ebf=new History(_0x36904e);_0x567ebf['state']=_0x48ff00;_0x567ebf[_0x8dd2('0x6c')]=_0x2c3a11;_0x567ebf['endtime']=_0x36904e[_0x8dd2('0x6d')];return _0x567ebf;}function unlockQueueStatus(_0x3e5899,_0x2139b9){setTimeout(function(){if(_[_0x8dd2('0x3c')](_0x3e5899[_0x8dd2('0x6e')])){loggerBooked[_0x8dd2('0x62')](_0x8dd2('0x6f'),_0x2139b9);}_0x3e5899[_0x8dd2('0x6e')]=!![];loggerBooked[_0x8dd2('0x46')]('[booked][unlockQueueStatus]',_0x2139b9,JSON['stringify'](_[_0x8dd2('0x70')](_0x3e5899,[_0x8dd2('0x43'),'queueStatusComplete'])));},0x1f3);}function checkInterval(_0x5c640e){return function(){if(!isNotNull(_0x5c640e[_0x8dd2('0x71')])){_0x5c640e[_0x8dd2('0x68')]=utils['CAMPAIGN_STATUS'][_0x8dd2('0x72')];throw _0x5c640e[_0x8dd2('0x43')]+_0x8dd2('0x73');}if(!isNotNull(_0x5c640e[_0x8dd2('0x71')][_0x8dd2('0x74')])){_0x5c640e[_0x8dd2('0x68')]=utils['CAMPAIGN_STATUS'][_0x8dd2('0x72')];throw _0x5c640e[_0x8dd2('0x43')]+_0x8dd2('0x73');}if(!isNotNull(_[_0x8dd2('0x45')](_0x5c640e[_0x8dd2('0x71')][_0x8dd2('0x74')]))){_0x5c640e['message']=utils[_0x8dd2('0x69')][_0x8dd2('0x72')];throw _0x5c640e['name']+'\x20INTERVAL_IS_NULL';}};}function checkIsIVRCampaignActive(_0x367971){return function(){if(!utils['isIVRCampaignActive'](_0x367971)){_0x367971[_0x8dd2('0x68')]=utils['CAMPAIGN_STATUS'][_0x8dd2('0x75')];throw _0x367971[_0x8dd2('0x43')]+_0x8dd2('0x76');}};}function emitCampaignSummary(_0x260eb4){if(utils[_0x8dd2('0x77')](_0x260eb4)){emit(util[_0x8dd2('0x41')](_0x8dd2('0x78'),_0x260eb4['name']),_0x8dd2('0x79'),_0x260eb4);}}function loggerCatchQueueSummary(_0x26baf7,_0x5c836d){return function(_0x56716f){clearPredictiveAttributes(_0x5c836d);emitCampaignSummary(_0x5c836d);loggerSyncQueueSummary['debug'](_0x26baf7,util[_0x8dd2('0x40')](_0x56716f,{'showHidden':![],'depth':null}));};}function notSendMessagesCampaign(_0x350cb0){if(_0x350cb0['sendMessageOneNotActive']){if(_0x350cb0[_0x8dd2('0x7a')]===0x0){_0x350cb0[_0x8dd2('0x7b')]=![];_0x350cb0[_0x8dd2('0x68')]=utils[_0x8dd2('0x69')][_0x8dd2('0x75')];loggerSyncQueueSummary[_0x8dd2('0x5f')]('[syncQueueSummary]\x20Campaign\x20Ivr:\x20',_0x350cb0[_0x8dd2('0x43')],_0x8dd2('0x7c'));}else{_0x350cb0['message']=utils['CAMPAIGN_STATUS']['DISACTIVED'];loggerSyncQueueSummary[_0x8dd2('0x5f')](_0x8dd2('0x7d'),_0x350cb0[_0x8dd2('0x43')],_0x8dd2('0x7e'));}emitCampaignSummary(_0x350cb0);}}function myreject(_0x4d9cef){return function(_0x36fc8b){return _0x4d9cef(msgResponse(_0x8dd2('0x7f'),'Error',JSON[_0x8dd2('0x80')](_0x36fc8b)));};}Dialer[_0x8dd2('0x81')][_0x8dd2('0x82')]=function(_0x140e99){return!_[_0x8dd2('0x3c')](_0x140e99)&&_0x140e99&&!_[_0x8dd2('0x3c')](_0x140e99[_0x8dd2('0x43')])&&!_[_0x8dd2('0x3c')](_0x140e99['active'])&&_0x140e99[_0x8dd2('0x83')]&&(this[_0x8dd2('0x20')][util['format'](_0x8dd2('0x84'),_0x140e99[_0x8dd2('0x43')])]['status']===_0x8dd2('0x85')||this[_0x8dd2('0x20')][util[_0x8dd2('0x41')]('SIP/%s',_0x140e99[_0x8dd2('0x43')])][_0x8dd2('0x86')]===_0x8dd2('0x87'));};Dialer[_0x8dd2('0x81')][_0x8dd2('0x88')]=function(_0x310e70){var _0xdefb60=this;return function(){if(!_0xdefb60[_0x8dd2('0x82')](_0x310e70[_0x8dd2('0x89')])){if(!_0xdefb60[_0x8dd2('0x82')](_0x310e70['TrunkBackup'])){_0x310e70[_0x8dd2('0x68')]=utils[_0x8dd2('0x69')][_0x8dd2('0x8a')];throw _0x310e70['name']+'\x20trunk\x20is\x20not\x20reachable';}}};};Dialer[_0x8dd2('0x81')]['checkIfTime']=function(_0x2e5e96,_0x369051,_0x4fa66d,_0x5c9b12){var _0x84615c=this;return function(){var _0x3860fb=!![];return _0x84615c['ifTimeIvr'](_0x2e5e96,_0x369051,_0x4fa66d,_0x5c9b12,_0x3860fb);};};Dialer[_0x8dd2('0x81')]['checkIfTimeIntervals']=function(_0x4f2859,_0x2249e8,_0x21d952,_0x22a554){var _0x1f694c=this;return function(){var _0x5a45c0=![];return _0x1f694c[_0x8dd2('0x8b')](_0x4f2859[_0x8dd2('0x74')],_0x2249e8,_0x21d952,_0x22a554,_0x5a45c0);};};Dialer['prototype'][_0x8dd2('0x8b')]=function(_0x73e3b0,_0x3a87f8,_0x5b45d5,_0x501701,_0x317dee){var _0x43f936=[];return new Promise(function(_0x253688,_0x77bd2b){if(!isNotNull(_0x73e3b0)){_0x501701[_0x8dd2('0x68')]=utils[_0x8dd2('0x69')][_0x8dd2('0x72')];return _0x77bd2b(msgResponse('ifTime','Failure',_0x5b45d5+'\x20Intervals\x20is\x20null\x20'));}if(_[_0x8dd2('0x45')](_0x73e3b0)){_0x501701[_0x8dd2('0x68')]=utils[_0x8dd2('0x69')]['EMPTY_INTERVAL'];return _0x77bd2b(msgResponse(_0x8dd2('0x8c'),'Failure',_0x5b45d5+_0x8dd2('0x8d')));}if(_0x3a87f8&&_['isUndefined'](config[_0x8dd2('0x8e')][_0x3a87f8])){_0x501701['message']=utils[_0x8dd2('0x69')][_0x8dd2('0x8f')];return _0x77bd2b(msgResponse('ifTime',_0x8dd2('0x90'),_0x5b45d5+_0x8dd2('0x91')+_0x3a87f8));}if(_['isArray'](_0x73e3b0)){for(var _0x47ec85=0x0;_0x47ec85<_0x73e3b0[_0x8dd2('0x92')];_0x47ec85+=0x1){_0x43f936[_0x8dd2('0x93')](ami[_0x8dd2('0x94')]({'action':_0x8dd2('0x95'),'command':util[_0x8dd2('0x41')](_0x8dd2('0x96'),_0x73e3b0[_0x47ec85][_0x8dd2('0x97')],!_[_0x8dd2('0x3c')](config['timezones'][_0x3a87f8])?_0x3a87f8:'')})['then'](function(_0x4e1c3a){return _0x4e1c3a[_0x8dd2('0x98')][_0x8dd2('0x99')](_0x8dd2('0x9a'))>=0x0;})[_0x8dd2('0x9b')](myreject(_0x77bd2b)));}}else{_0x43f936['push'](ami[_0x8dd2('0x94')]({'action':_0x8dd2('0x95'),'command':util[_0x8dd2('0x41')](_0x8dd2('0x96'),_0x73e3b0,!_[_0x8dd2('0x3c')](config[_0x8dd2('0x8e')][_0x3a87f8])?_0x3a87f8:'')})['then'](function(_0x4773ac){return _0x4773ac[_0x8dd2('0x98')]['indexOf']('true')>=0x0;})[_0x8dd2('0x9b')](myreject(_0x77bd2b)));}Promise['all'](_0x43f936)[_0x8dd2('0x3b')](function(_0x12dc33){var _0x300924=_['some'](_0x12dc33);if(_0x300924){return _0x253688(_0x300924);}else{_0x501701[_0x8dd2('0x68')]=_0x317dee?utils[_0x8dd2('0x69')]['OVERTIME_GLOBAL_INTERVAL']:utils[_0x8dd2('0x69')][_0x8dd2('0x9c')];return _0x77bd2b(msgResponse(_0x8dd2('0x9d'),_0x8dd2('0x90'),_0x8dd2('0x9e')+_0x317dee+'\x20'+_0x5b45d5+_0x8dd2('0x9f')+util[_0x8dd2('0x40')](_0x73e3b0,{'showHidden':![],'depth':null})+'Timezone:\x20'+_0x3a87f8));}})[_0x8dd2('0x9b')](function(_0x4b24bf){return _0x77bd2b(msgResponse(_0x8dd2('0x8c'),_0x8dd2('0x90'),JSON[_0x8dd2('0x80')](_0x4b24bf)));});});};Dialer[_0x8dd2('0x81')][_0x8dd2('0x38')]=function(){var _0x5e555e=this;return cmHopper[_0x8dd2('0xa0')]({'active':![]},{'where':{'active':!![]}})[_0x8dd2('0x3b')](function(){setInterval(function(){_0x5e555e['syncCampaigns']();},0x3e8);});};Dialer['prototype'][_0x8dd2('0xa1')]=function(){var _0x280c8a=this;var _0x34e1bb;for(var _0x335117 in this['campaigns']){if(typeof this[_0x8dd2('0x1e')][_0x335117]!=='undefined'){_0x34e1bb=this[_0x8dd2('0x1e')][_0x335117];if(utils[_0x8dd2('0x77')](_0x34e1bb)&&utils[_0x8dd2('0xa2')](_0x34e1bb)){_0x34e1bb['sendMessageOneNotActive']=!![];Promise[_0x8dd2('0xa3')]()[_0x8dd2('0x3b')](checkIsIVRCampaignActive(_0x34e1bb))[_0x8dd2('0x3b')](checkInterval(_0x34e1bb))['then'](_0x280c8a[_0x8dd2('0x88')](_0x34e1bb))[_0x8dd2('0x3b')](_0x280c8a[_0x8dd2('0xa4')](_0x34e1bb['dialGlobalInterval'],_0x34e1bb[_0x8dd2('0xa5')],_0x34e1bb[_0x8dd2('0x43')],_0x34e1bb))[_0x8dd2('0x3b')](_0x280c8a[_0x8dd2('0xa6')](_0x34e1bb['Interval'],_0x34e1bb[_0x8dd2('0xa5')],_0x34e1bb[_0x8dd2('0x43')],_0x34e1bb))['then'](_0x280c8a['launchHandleIvr'](_0x34e1bb))[_0x8dd2('0x9b')](loggerCatchQueueSummary('[syncCampaigns]',_0x34e1bb));}else{notSendMessagesCampaign(_0x34e1bb);}}}};Dialer[_0x8dd2('0x81')][_0x8dd2('0xa7')]=function(_0x2f256c){if(_0x2f256c[_0x8dd2('0xa8')]!==_0x8dd2('0x9')){clearPredictiveAttributes(_0x2f256c);}switch(_0x2f256c[_0x8dd2('0xa8')]){case _0x8dd2('0xa9'):this['handlePower'](_0x2f256c,0x1);break;case _0x8dd2('0xaa'):this[_0x8dd2('0xab')](_0x2f256c,_0x2f256c[_0x8dd2('0xac')]);break;case _0x8dd2('0x9'):this['predictive'](_0x2f256c);break;case'booked':this[_0x8dd2('0xab')](_0x2f256c,0x1);break;default:logger[_0x8dd2('0x62')](_0x8dd2('0xad'),_0x2f256c[_0x8dd2('0x43')],_0x8dd2('0xae'));}};Dialer[_0x8dd2('0x81')][_0x8dd2('0x8c')]=function(_0x2fd23e,_0x31aa2a){var _0x385a1d=_0x2fd23e[_0x8dd2('0xa5')];var _0x52b4cf=_0x31aa2a?_0x2fd23e[_0x8dd2('0xaf')]:_0x2fd23e[_0x8dd2('0x71')]['Intervals'];logger[_0x8dd2('0xb0')](_0x8dd2('0xb1'),_0x52b4cf,_0x385a1d,_0x2fd23e['name'],util[_0x8dd2('0x41')]('Voice\x20Queue\x20%s\x20$s',_0x2fd23e['name'],_0x2fd23e['id']));var _0x5c8315=null;return Interval[_0x8dd2('0xb2')](_0x52b4cf,_0x385a1d)[_0x8dd2('0x3b')](function(_0x453990){if(_0x453990===!![]){return _0x453990;}else{_0x2fd23e[_0x8dd2('0x68')]=_0x31aa2a?utils[_0x8dd2('0x69')][_0x8dd2('0xb3')]:utils[_0x8dd2('0x69')]['OVERTIME_INTERVAL'];_0x5c8315=msgResponse(_0x8dd2('0x9d'),_0x8dd2('0x90'),_0x8dd2('0x9e')+_0x31aa2a+'\x20'+_0x2fd23e['name']+_0x8dd2('0x9f')+util['inspect'](_0x52b4cf,{'showHidden':![],'depth':null})+'Timezone:\x20'+_0x385a1d);}if(_0x5c8315!==null){logger[_0x8dd2('0xb0')](_0x8dd2('0xb4'),_0x5c8315);_0x5c8315['isGlobal']=_0x31aa2a;throw _0x5c8315;}})[_0x8dd2('0x9b')](function(_0x239de5){logger[_0x8dd2('0x62')](_0x8dd2('0xb5'),_0x239de5);throw msgResponse('[ifTime][Action]','Error',util[_0x8dd2('0x40')](_0x239de5,{'showHidden':![],'depth':null}));});};Dialer['prototype']['syncAgentConnect']=function(_0x2db22d){if(this[_0x8dd2('0x1d')][_0x2db22d[_0x8dd2('0xb6')]]){if(this[_0x8dd2('0x23')][_0x2db22d[_0x8dd2('0xb7')]]&&this['uniqueId'][_0x2db22d[_0x8dd2('0xb7')]][_0x8dd2('0x3e')]!==_0x8dd2('0xb8')){utils[_0x8dd2('0xb9')](this[_0x8dd2('0x1d')][_0x2db22d[_0x8dd2('0xb6')]],'[syncAgentConnect]');this[_0x8dd2('0x23')][_0x2db22d[_0x8dd2('0xb7')]][_0x8dd2('0xba')]=moment()[_0x8dd2('0x41')](_0x8dd2('0xbb'));}}};Dialer[_0x8dd2('0x81')][_0x8dd2('0x2f')]=function(_0x3b1e60){var _0x87326b=this[_0x8dd2('0x23')][_0x3b1e60[_0x8dd2('0xb7')]];if(this[_0x8dd2('0x1d')][_0x3b1e60[_0x8dd2('0xb6')]]){if(_0x87326b&&_0x87326b[_0x8dd2('0x3e')]!=='ivr'){delete this[_0x8dd2('0x23')][_0x3b1e60['uniqueid']];this[_0x8dd2('0x1d')][_0x3b1e60[_0x8dd2('0xb6')]][_0x8dd2('0xbc')]+=0x1;var _0x48233c=new AgentComplete(_0x87326b,_0x3b1e60);if(_0x3b1e60[_0x8dd2('0xbd')]==='agent'){_0x48233c[_0x8dd2('0xbe')]=this[_0x8dd2('0x1d')][_0x3b1e60[_0x8dd2('0xb6')]][_0x8dd2('0xbf')]&&this[_0x8dd2('0x1d')][_0x3b1e60[_0x8dd2('0xb6')]][_0x8dd2('0xc0')]?moment()[_0x8dd2('0x41')](_0x8dd2('0xbb')):undefined;}hopperUtils[_0x8dd2('0xc1')](_0x48233c)[_0x8dd2('0x9b')](loggerCatch(_0x8dd2('0xc2')));hopperUtils[_0x8dd2('0xc3')](_0x48233c)[_0x8dd2('0x9b')](loggerCatch(_0x8dd2('0xc4')));}}};Dialer[_0x8dd2('0x81')][_0x8dd2('0x2c')]=function(_0x2c9066){var _0x948564=this['uniqueId'][_0x2c9066[_0x8dd2('0xb7')]];var _0x3dcea7=this;var _0x2f6d0e=![];var _0xe01277;var _0x287685;if(this[_0x8dd2('0x1d')][_0x2c9066['queue']]){if(_0x948564&&_0x948564['type']!==_0x8dd2('0xb8')){delete this[_0x8dd2('0x23')][_0x2c9066['uniqueid']];utils[_0x8dd2('0xb9')](this[_0x8dd2('0x1d')][_0x2c9066[_0x8dd2('0xb6')]],_0x8dd2('0xc5'));_0x948564[_0x8dd2('0xc6')]=moment()[_0x8dd2('0x41')]('YYYY-MM-DD\x20HH:mm:ss');var _0x1e4a00=new QueueCallerAbandon(_0x948564,_0x2c9066);if(utils[_0x8dd2('0x5e')](_0x948564[_0x8dd2('0xc6')],_0x948564[_0x8dd2('0xc7')])>=_0x948564[_0x8dd2('0xc8')]){this[_0x8dd2('0x1d')][_0x2c9066[_0x8dd2('0xb6')]][_0x8dd2('0xc9')]+=0x1;this['voiceQueues'][_0x2c9066['queue']][_0x8dd2('0xca')]+=0x1;this['voiceQueues'][_0x2c9066[_0x8dd2('0xb6')]][_0x8dd2('0xcb')]+=0x1;_0x1e4a00[_0x8dd2('0xcc')]=0xa;_0x1e4a00[_0x8dd2('0x6c')]=_0x8dd2('0xcd');_0x1e4a00['dropreason']=_0x8dd2('0xce');_0x1e4a00[_0x8dd2('0xbe')]=this[_0x8dd2('0x1d')][_0x2c9066[_0x8dd2('0xb6')]]['dialQueueProject2']?moment()[_0x8dd2('0x41')](_0x8dd2('0xbb')):undefined;_0x1e4a00[_0x8dd2('0xcf')]+=0x1;_0x1e4a00[_0x8dd2('0xd0')]+=0x1;_0xe01277=this[_0x8dd2('0x1d')][_0x2c9066[_0x8dd2('0xb6')]][_0x8dd2('0xd1')];_0x287685=this['voiceQueues'][_0x2c9066[_0x8dd2('0xb6')]][_0x8dd2('0xd2')];hopperUtils[_0x8dd2('0xd3')](_0x1e4a00,_0x1e4a00[_0x8dd2('0xcc')],_0x948564['voiceQueue'])[_0x8dd2('0x3b')](function(_0x1dd502){_0x2f6d0e=_0x1dd502[_0x8dd2('0xd4')]==0x1;if(_0x1e4a00[_0x8dd2('0xcf')]>=_0x3dcea7['voiceQueues'][_0x2c9066[_0x8dd2('0xb6')]][_0x8dd2('0xd5')]){_0x3dcea7['queueCallerAbandonCreateState'](_0x1e4a00,_0x1dd502['additional']);}else{hopperUtils['rescheduleContact']({'active':![],'countdropretry':_0x1e4a00[_0x8dd2('0xcf')],'scheduledat':moment()[_0x8dd2('0xd6')](_0x3dcea7[_0x8dd2('0x1d')][_0x2c9066[_0x8dd2('0xb6')]]['dialDropRetryFrequency'],_0x8dd2('0xd7'))[_0x8dd2('0x41')]('YYYY-MM-DD\x20HH:mm:ss'),'ContactId':_0x948564[_0x8dd2('0xd8')],'ListId':_0x948564[_0x8dd2('0xd9')],'VoiceQueueId':_0x948564[_0x8dd2('0xda')]||undefined,'CampaignId':_0x948564[_0x8dd2('0xdb')]||undefined})['catch'](loggerCatch(_0x8dd2('0xdc')));var _0x50dd15=new History(_0x1e4a00);_0x50dd15[_0x8dd2('0xcc')]=0xa;_0x50dd15['statedesc']=_0x8dd2('0xcd');_0x50dd15[_0x8dd2('0x6d')]=moment()[_0x8dd2('0x41')](_0x8dd2('0xbb'));_0x50dd15[_0x8dd2('0xdd')]=_0x50dd15['starttime'];_0x50dd15[_0x8dd2('0xde')]=_0x1e4a00['calleridname'];_0x50dd15[_0x8dd2('0xdf')]=_0x1e4a00[_0x8dd2('0xdf')];hopperUtils[_0x8dd2('0xc1')](_0x50dd15)[_0x8dd2('0x9b')](loggerCatch(_0x8dd2('0xe0')));}})['then'](function(){if(_0x2f6d0e)hopperUtils['swapAdditionalPhones'](_0x1e4a00,_0xe01277,_0x287685)[_0x8dd2('0x3b')](function(){return 0x1;});});}else{this[_0x8dd2('0x1d')][_0x2c9066[_0x8dd2('0xb6')]]['predictiveIntervalDroppedCallsCallersExit']+=0x1;this[_0x8dd2('0x1d')][_0x2c9066['queue']][_0x8dd2('0xe1')]+=0x1;_0x1e4a00[_0x8dd2('0xcc')]=0xb;_0x1e4a00[_0x8dd2('0x6c')]=_0x8dd2('0xe2');_0x1e4a00[_0x8dd2('0xe3')]=_0x8dd2('0xe4');_0x1e4a00[_0x8dd2('0xe5')]+=0x1;_0x1e4a00[_0x8dd2('0xd0')]+=0x1;_0xe01277=this['voiceQueues'][_0x2c9066['queue']]['dialAbandonedRetryFrequency'];_0x287685=this[_0x8dd2('0x1d')][_0x2c9066[_0x8dd2('0xb6')]][_0x8dd2('0xd2')];hopperUtils[_0x8dd2('0xd3')](_0x1e4a00,_0x1e4a00[_0x8dd2('0xcc')],_0x948564[_0x8dd2('0xe6')])[_0x8dd2('0x3b')](function(_0x4376fb){if(_0x1e4a00[_0x8dd2('0xe5')]>=_0x3dcea7[_0x8dd2('0x1d')][_0x2c9066[_0x8dd2('0xb6')]][_0x8dd2('0xe7')]){_0x3dcea7[_0x8dd2('0xe8')](_0x1e4a00,_0x4376fb[_0x8dd2('0xd4')]);}else{hopperUtils['rescheduleContact']({'active':![],'countabandonedretry':_0x1e4a00[_0x8dd2('0xe5')],'scheduledat':moment()['add'](_0x3dcea7[_0x8dd2('0x1d')][_0x2c9066[_0x8dd2('0xb6')]]['dialAbandonedRetryFrequency'],_0x8dd2('0xd7'))[_0x8dd2('0x41')](_0x8dd2('0xbb')),'ContactId':_0x948564[_0x8dd2('0xd8')],'ListId':_0x948564[_0x8dd2('0xd9')],'VoiceQueueId':_0x948564[_0x8dd2('0xda')]||undefined,'CampaignId':_0x948564[_0x8dd2('0xdb')]||undefined})[_0x8dd2('0x9b')](loggerCatch(_0x8dd2('0xe9')));var _0x1fceb7=new History(_0x1e4a00);_0x1fceb7[_0x8dd2('0xcc')]=0xb;_0x1fceb7[_0x8dd2('0x6c')]=_0x8dd2('0xe2');_0x1fceb7[_0x8dd2('0x6d')]=moment()['format'](_0x8dd2('0xbb'));_0x1fceb7[_0x8dd2('0xdd')]=_0x1fceb7[_0x8dd2('0x6d')];_0x1fceb7[_0x8dd2('0xde')]=_0x1e4a00['calleridname'];_0x1fceb7[_0x8dd2('0xdf')]=_0x1e4a00['calleridnum'];hopperUtils[_0x8dd2('0xc1')](_0x1fceb7)[_0x8dd2('0x9b')](loggerCatch('[syncAgentComplete][createHistory][11]'));}})[_0x8dd2('0x3b')](function(){if(_0x2f6d0e)hopperUtils[_0x8dd2('0xea')](_0x1e4a00,_0xe01277,_0x287685)[_0x8dd2('0x3b')](function(){return 0x1;});});}}}};Dialer[_0x8dd2('0x81')]['syncNewExten']=function(_0x42fb9f){if(this[_0x8dd2('0xeb')][_0x42fb9f[_0x8dd2('0xb7')]]){this[_0x8dd2('0xeb')][_0x42fb9f[_0x8dd2('0xb7')]][_0x8dd2('0xec')]=_0x42fb9f[_0x8dd2('0xec')];}if(this['uniqueId'][_0x42fb9f['uniqueid']]){this[_0x8dd2('0x23')][_0x42fb9f['uniqueid']]['channel']=_0x42fb9f[_0x8dd2('0xec')];}};Dialer[_0x8dd2('0x81')]['syncQueueMember']=function(_0x20d52c){if(!this[_0x8dd2('0xeb')][_0x20d52c[_0x8dd2('0xed')]]){return;}var _0x5f1a28=this[_0x8dd2('0x1d')][this['actions'][_0x20d52c[_0x8dd2('0xed')]]['queue']][_0x8dd2('0xee')]||_0x8dd2('0xef');if(_0x5f1a28===_0x8dd2('0xf0')){if(this['actions'][_0x20d52c[_0x8dd2('0xed')]]&&_[_0x8dd2('0xf1')](this[_0x8dd2('0xeb')][_0x20d52c[_0x8dd2('0xed')]][_0x8dd2('0xf2')])&&_0x20d52c[_0x8dd2('0x86')]==='1'&&_0x20d52c[_0x8dd2('0xf3')]==='0'){if(this[_0x8dd2('0x1f')][_0x20d52c[_0x8dd2('0xf4')]]){if(!this[_0x8dd2('0x1f')][_0x20d52c[_0x8dd2('0xf4')]][_0x8dd2('0xf2')]){this['agents'][_0x20d52c[_0x8dd2('0xf4')]][_0x8dd2('0xf2')]=!![];this[_0x8dd2('0xeb')][_0x20d52c[_0x8dd2('0xed')]][_0x8dd2('0xf2')]=!![];this['actions'][_0x20d52c[_0x8dd2('0xed')]][_0x8dd2('0xf4')]=_0x20d52c['stateinterface'];}}}}else if(_0x5f1a28===_0x8dd2('0xef')){if(this[_0x8dd2('0xeb')][_0x20d52c[_0x8dd2('0xed')]]){if(this['agents'][_0x20d52c[_0x8dd2('0xf4')]]){this[_0x8dd2('0xeb')][_0x20d52c['actionid']]['stateinterface']=_0x20d52c['stateinterface'];if(_[_0x8dd2('0xf1')](this['queueBooked'][this[_0x8dd2('0xeb')][_0x20d52c['actionid']][_0x8dd2('0xb6')]])){this[_0x8dd2('0x27')][this[_0x8dd2('0xeb')][_0x20d52c[_0x8dd2('0xed')]][_0x8dd2('0xb6')]]=[];}this[_0x8dd2('0x27')][this[_0x8dd2('0xeb')][_0x20d52c[_0x8dd2('0xed')]][_0x8dd2('0xb6')]][_0x8dd2('0x93')](_[_0x8dd2('0x5d')](_[_0x8dd2('0x70')](this[_0x8dd2('0xeb')][_0x20d52c[_0x8dd2('0xed')]],[_0x8dd2('0xf5'),_0x8dd2('0xf4')]),{'status':_0x20d52c[_0x8dd2('0x86')],'paused':_0x20d52c[_0x8dd2('0xf3')]}));}}}};Dialer[_0x8dd2('0x81')]['syncQueueStatusComplete']=function(_0x283555){if(!this[_0x8dd2('0xeb')][_0x283555[_0x8dd2('0xed')]]){return;}var _0x5340eb=this;var _0x253c7b=this[_0x8dd2('0x1d')][this[_0x8dd2('0xeb')][_0x283555['actionid']][_0x8dd2('0xb6')]];var _0x31d984=_0x253c7b[_0x8dd2('0xee')]||_0x8dd2('0xef');if(_0x31d984==='roundrobin'){if(this[_0x8dd2('0xeb')][_0x283555[_0x8dd2('0xed')]]&&this[_0x8dd2('0xeb')][_0x283555[_0x8dd2('0xed')]][_0x8dd2('0xf4')]){this['preview'][_0x8dd2('0xf6')](this[_0x8dd2('0xeb')][_0x283555[_0x8dd2('0xed')]]['idHopper'],this[_0x8dd2('0xeb')][_0x283555[_0x8dd2('0xed')]][_0x8dd2('0xf4')])[_0x8dd2('0x9b')](function(_0x58bf81){logger[_0x8dd2('0x62')](_0x8dd2('0xf7'),util[_0x8dd2('0x40')](_0x58bf81,{'showHidden':![],'depth':null}));})['finally'](function(){utils['decrementOriginate'](_0x5340eb[_0x8dd2('0x1d')][_0x5340eb['actions'][_0x283555[_0x8dd2('0xed')]]['queue']],'[syncQueueStatusComplete]');_0x5340eb[_0x8dd2('0x1f')][_0x5340eb[_0x8dd2('0xeb')][_0x283555[_0x8dd2('0xed')]][_0x8dd2('0xf4')]]['locked']=![];delete _0x5340eb[_0x8dd2('0xeb')][_0x283555['actionid']];unlockQueueStatus(_0x253c7b);});}else{utils['decrementOriginate'](this[_0x8dd2('0x1d')][this[_0x8dd2('0xeb')][_0x283555[_0x8dd2('0xed')]]['queue']],_0x8dd2('0xf8'));hopperUtils[_0x8dd2('0xf9')]({'active':![],'ContactId':this[_0x8dd2('0xeb')][_0x283555[_0x8dd2('0xed')]][_0x8dd2('0xd8')],'ListId':this[_0x8dd2('0xeb')][_0x283555[_0x8dd2('0xed')]][_0x8dd2('0xd9')],'VoiceQueueId':this[_0x8dd2('0xeb')][_0x283555[_0x8dd2('0xed')]][_0x8dd2('0xda')]||undefined,'CampaignId':this['actions'][_0x283555[_0x8dd2('0xed')]][_0x8dd2('0xdb')]||undefined})[_0x8dd2('0x9b')](loggerCatch('[unlock][syncQueueStatusComplete]'));delete this[_0x8dd2('0xeb')][_0x283555[_0x8dd2('0xed')]];unlockQueueStatus(_0x253c7b);}}else if(_0x31d984==='rrmemory'){var _0xe44407;if(this[_0x8dd2('0xeb')][_0x283555[_0x8dd2('0xed')]]&&!_[_0x8dd2('0x45')](this[_0x8dd2('0x27')][this[_0x8dd2('0xeb')][_0x283555[_0x8dd2('0xed')]]['queue']])){if(this[_0x8dd2('0x28')][_0x5340eb[_0x8dd2('0xeb')][_0x283555[_0x8dd2('0xed')]][_0x8dd2('0xb6')]]){this[_0x8dd2('0x28')][_0x5340eb[_0x8dd2('0xeb')][_0x283555[_0x8dd2('0xed')]][_0x8dd2('0xb6')]]=this['queueBookedRR'][this[_0x8dd2('0xeb')][_0x283555[_0x8dd2('0xed')]][_0x8dd2('0xb6')]]?this[_0x8dd2('0x28')][this[_0x8dd2('0xeb')][_0x283555[_0x8dd2('0xed')]][_0x8dd2('0xb6')]]:this['queueBooked'][this[_0x8dd2('0xeb')][_0x283555['actionid']][_0x8dd2('0xb6')]]?this['queueBooked'][this[_0x8dd2('0xeb')][_0x283555['actionid']][_0x8dd2('0xb6')]][_0x8dd2('0xfa')]||0x0:0x0;}this[_0x8dd2('0x27')][this[_0x8dd2('0xeb')][_0x283555[_0x8dd2('0xed')]][_0x8dd2('0xb6')]][_0x8dd2('0xfa')]=this[_0x8dd2('0x28')][this[_0x8dd2('0xeb')][_0x283555[_0x8dd2('0xed')]][_0x8dd2('0xb6')]];for(var _0x5c541b=0x0;_0x5c541b=_0x4050e4[_0x8dd2('0x11e')]){_0x10fd6f['stateGlobal'](_0x4b3ab7,_0x3c2a22,_0x384f96,_0x8dd2('0x11f'));}else{if(_0x4b3ab7[_0x8dd2('0x119')]>=_0x4050e4[_0x8dd2('0x120')]){_0x10fd6f[_0x8dd2('0x121')](_0x4b3ab7,_0x3c2a22,_0x384f96,_0x8dd2('0x122'));}else{hopperUtils[_0x8dd2('0xf9')]({'active':![],'countmachineretry':_0x4b3ab7[_0x8dd2('0x119')],'scheduledat':moment()[_0x8dd2('0xd6')](_0x4050e4[_0x8dd2('0x123')],_0x8dd2('0xd7'))[_0x8dd2('0x41')]('YYYY-MM-DD\x20HH:mm:ss'),'ContactId':_0x4b3ab7[_0x8dd2('0xd8')],'ListId':_0x4b3ab7['ListId'],'VoiceQueueId':_0x4b3ab7[_0x8dd2('0xda')]||undefined,'CampaignId':_0x4b3ab7[_0x8dd2('0xdb')]||undefined})[_0x8dd2('0x9b')](loggerCatch(_0x8dd2('0x124')));_0x3c2a22({'reschedule':0x1});}}});}if(_0x53d769['type']===_0x8dd2('0xb8')&&this[_0x8dd2('0x1e')][_0x53d769[_0x8dd2('0xb6')]][_0x8dd2('0x10b')]&&_0x26b35f['value']==='HANGUP'){delete this[_0x8dd2('0x23')][_0x26b35f['uniqueid']];utils[_0x8dd2('0xb9')](this[_0x8dd2('0x1e')][_0x53d769['queue']],'[syncVarSet]');_0x4ffd05=new Hangup(_0x53d769,_0x26b35f);_0x4ffd05[_0x8dd2('0xcc')]=0x12;_0x4ffd05[_0x8dd2('0x6c')]='HangupInAMD';_0x4ffd05[_0x8dd2('0x10f')]=_0x8dd2('0x110');ami[_0x8dd2('0x3d')](_0x8dd2('0x125'),ut[_0x8dd2('0x111')](_0x4ffd05,_0x8dd2('0x112')));this['saveInDb'](_0x4ffd05,_0x8dd2('0x126'),'[syncHangupInAMDIvr]');}if(_0x53d769[_0x8dd2('0x3e')]===_0x8dd2('0xb8')&&this[_0x8dd2('0x1e')][_0x53d769[_0x8dd2('0xb6')]]['dialAMDActive']&&_0x26b35f[_0x8dd2('0x116')]===_0x8dd2('0x117')){return new Promise(function(_0xd4e4bf,_0x1be899){delete _0x10fd6f['uniqueId'][_0x26b35f[_0x8dd2('0xb7')]];utils['decrementOriginate'](_0x10fd6f['campaigns'][_0x53d769[_0x8dd2('0xb6')]],_0x8dd2('0x10d'));_0x10fd6f[_0x8dd2('0x1e')][_0x53d769['queue']][_0x8dd2('0xbc')]+=0x1;_0x10fd6f[_0x8dd2('0x1e')][_0x53d769['queue']][_0x8dd2('0x118')]+=0x1;var _0x43e000=_0x10fd6f[_0x8dd2('0x1e')][_0x53d769[_0x8dd2('0xb6')]];var _0x1433a0=new Hangup(_0x53d769,_0x26b35f);_0x1433a0['state']=0x13;_0x1433a0[_0x8dd2('0x6c')]=_0x8dd2('0x127');_0x1433a0[_0x8dd2('0x10f')]=_0x8dd2('0x110');_0x1433a0[_0x8dd2('0x119')]+=0x1;_0x1433a0['countglobal']+=0x1;_0x1433a0[_0x8dd2('0x112')]=!![];ami[_0x8dd2('0x3d')]('custom:amd',ut['buildObj'](_0x1433a0,'amd'));hopperUtils['createHistory'](_0x1433a0)[_0x8dd2('0x9b')](loggerCatch('[syncAgentComplete][createHistory][0]'));if(_0x1433a0['countbusyretry']+_0x1433a0[_0x8dd2('0x128')]+_0x1433a0['countnoanswerretry']+_0x1433a0[_0x8dd2('0x129')]+_0x1433a0[_0x8dd2('0xcf')]+_0x1433a0[_0x8dd2('0xe5')]+_0x1433a0[_0x8dd2('0x119')]+_0x1433a0[_0x8dd2('0x11d')]>=_0x43e000[_0x8dd2('0x11e')]){_0x10fd6f[_0x8dd2('0x12a')](_0x1433a0,_0xd4e4bf,_0x1be899,_0x8dd2('0x11f'));}else{if(_0x1433a0[_0x8dd2('0x119')]>=_0x43e000[_0x8dd2('0x120')]){_0x10fd6f[_0x8dd2('0x121')](_0x1433a0,_0xd4e4bf,_0x1be899,_0x8dd2('0x122'));}else{hopperUtils[_0x8dd2('0xf9')]({'active':![],'countmachineretry':_0x1433a0[_0x8dd2('0x119')],'scheduledat':moment()['add'](_0x43e000[_0x8dd2('0x123')],_0x8dd2('0xd7'))[_0x8dd2('0x41')](_0x8dd2('0xbb')),'ContactId':_0x1433a0[_0x8dd2('0xd8')],'ListId':_0x1433a0[_0x8dd2('0xd9')],'VoiceQueueId':_0x1433a0[_0x8dd2('0xda')]||undefined,'CampaignId':_0x1433a0[_0x8dd2('0xdb')]||undefined})['catch'](loggerCatch(_0x8dd2('0x124')));_0xd4e4bf({'reschedule':0x1});}}});}}};Dialer[_0x8dd2('0x81')][_0x8dd2('0x32')]=function(_0x412c58){var _0xfe6ee1=this[_0x8dd2('0x23')][_0x412c58[_0x8dd2('0xb7')]];var _0x25ea48;if(!_0xfe6ee1){return;}if(_0xfe6ee1[_0x8dd2('0x3e')]===_0x8dd2('0xb8')){delete this[_0x8dd2('0x23')][_0x412c58[_0x8dd2('0xb7')]];utils[_0x8dd2('0xb9')](this[_0x8dd2('0x1e')][_0xfe6ee1[_0x8dd2('0xb6')]],_0x8dd2('0x12b'));this[_0x8dd2('0x1e')][_0xfe6ee1[_0x8dd2('0xb6')]][_0x8dd2('0x12c')]+=0x1;if(_0x412c58[_0x8dd2('0x12d')]==='Normal\x20Clearing'){const _0x4def37=new AgentComplete(_0xfe6ee1,_0x412c58);_0x4def37[_0x8dd2('0xdb')]=this['campaigns'][_0xfe6ee1[_0x8dd2('0xb6')]]['id'];hopperUtils['createHistory'](_0x4def37)[_0x8dd2('0x9b')](loggerCatch(_0x8dd2('0x12e')));hopperUtils[_0x8dd2('0xc3')](_0x4def37)['catch'](loggerCatch(_0x8dd2('0x12f')));}else{_0x25ea48=new Hangup(_0xfe6ee1,_0x412c58);hopperUtils[_0x8dd2('0xc1')](_0x25ea48)[_0x8dd2('0x9b')](loggerCatch(_0x8dd2('0x130')));hopperUtils[_0x8dd2('0xc3')](_0x25ea48)['catch'](loggerCatch(_0x8dd2('0x131')));}}else{if(isNotNull(this[_0x8dd2('0x1d')][_0xfe6ee1[_0x8dd2('0xb6')]][_0x8dd2('0x132')])){delete this[_0x8dd2('0x23')][_0x412c58['uniqueid']];utils[_0x8dd2('0xb9')](this[_0x8dd2('0x1d')][_0xfe6ee1[_0x8dd2('0xb6')]],_0x8dd2('0x12b'));this[_0x8dd2('0x1d')][_0xfe6ee1[_0x8dd2('0xb6')]][_0x8dd2('0xbc')]+=0x1;this[_0x8dd2('0x1d')][_0xfe6ee1[_0x8dd2('0xb6')]][_0x8dd2('0x118')]+=0x1;_0x25ea48=new Hangup(_0xfe6ee1,_0x412c58);_0x25ea48[_0x8dd2('0xcc')]=0x10;_0x25ea48[_0x8dd2('0x6c')]=_0x8dd2('0x133');_0x25ea48[_0x8dd2('0x10f')]='AGI';hopperUtils[_0x8dd2('0xc1')](_0x25ea48)[_0x8dd2('0x9b')](loggerCatch(_0x8dd2('0x130')));hopperUtils[_0x8dd2('0xc3')](_0x25ea48)[_0x8dd2('0x9b')](loggerCatch(_0x8dd2('0x131')));}else{delete this[_0x8dd2('0x23')][_0x412c58[_0x8dd2('0xb7')]];utils[_0x8dd2('0xb9')](this[_0x8dd2('0x1d')][_0xfe6ee1[_0x8dd2('0xb6')]],_0x8dd2('0x134'));if(_0x412c58[_0x8dd2('0x12d')]===_0x8dd2('0x135')){this[_0x8dd2('0x1d')][_0xfe6ee1[_0x8dd2('0xb6')]][_0x8dd2('0xbc')]+=0x1;const _0xb4dd9a=new AgentComplete(_0xfe6ee1,_0x412c58);_0xb4dd9a[_0x8dd2('0xda')]=this['voiceQueues'][_0xfe6ee1[_0x8dd2('0xb6')]]['id'];hopperUtils[_0x8dd2('0xc1')](_0xb4dd9a)['catch'](loggerCatch(_0x8dd2('0xc2')));hopperUtils[_0x8dd2('0xc3')](_0xb4dd9a)[_0x8dd2('0x9b')](loggerCatch(_0x8dd2('0xc4')));}else{this['voiceQueues'][_0xfe6ee1[_0x8dd2('0xb6')]]['outboundUnknownCallsDay']+=0x1;_0x25ea48=new Hangup(_0xfe6ee1,_0x412c58);_0x25ea48[_0x8dd2('0xcc')]=0xc;_0x25ea48[_0x8dd2('0x6c')]=_0x412c58[_0x8dd2('0x12d')];_0x25ea48[_0x8dd2('0x10f')]=_0x8dd2('0x136');hopperUtils['createHistory'](_0x25ea48)[_0x8dd2('0x9b')](loggerCatch(_0x8dd2('0x137')));hopperUtils[_0x8dd2('0xc3')](_0x25ea48)[_0x8dd2('0x9b')](loggerCatch(_0x8dd2('0x12b')));}}}};Dialer[_0x8dd2('0x81')][_0x8dd2('0xb')]=function(_0x55c327){var _0x4e47e5=this;if(!_0x4e47e5[_0x8dd2('0x29')][_0x55c327[_0x8dd2('0x43')]]){_0x4e47e5['queuesSummary'][_0x55c327['name']]={'running':![]};}else if(_0x4e47e5['queuesSummary'][_0x55c327[_0x8dd2('0x43')]][_0x8dd2('0x138')]===!![]){return;}else if(_0x4e47e5[_0x8dd2('0x29')][_0x55c327[_0x8dd2('0x43')]][_0x8dd2('0x138')]===![]){_0x4e47e5['queuesSummary'][_0x55c327[_0x8dd2('0x43')]][_0x8dd2('0x138')]=!![];}var _0x46908a=_0x4e47e5['voiceQueues'][_0x55c327['name']];var _0x41b446=_0x46908a[_0x8dd2('0x68')]!==utils[_0x8dd2('0x69')][_0x8dd2('0x75')];var _0xdd9caa=utils[_0x8dd2('0x139')](_0x46908a);_0x46908a[_0x8dd2('0x13a')]=utils['getQueueCampaignStatusMessage'](_0x46908a,_0x4e47e5[_0x8dd2('0x20')]);Promise[_0x8dd2('0xa3')]()[_0x8dd2('0x3b')](function(){if(_0x46908a[_0x8dd2('0x13a')]===utils[_0x8dd2('0x69')][_0x8dd2('0x75')]){if(_0x41b446){clearPredictiveAttributes(_0x46908a);_0x55c327[_0x8dd2('0x25')]=undefined;_0x55c327[_0x8dd2('0x26')]=undefined;}if(_0x46908a[_0x8dd2('0x13a')]===utils[_0x8dd2('0x69')][_0x8dd2('0x75')]){_0x55c327['available']=0x0;_0x55c327[_0x8dd2('0xf3')]=0x0;_0x55c327[_0x8dd2('0x13b')]=0x0;_0x55c327[_0x8dd2('0x13c')]=0x0;_0x55c327[_0x8dd2('0x13d')]=0x0;}}else if(_0x46908a[_0x8dd2('0x13a')]===utils[_0x8dd2('0x69')]['ACTIVE']&&!_0xdd9caa){return _0x4e47e5[_0x8dd2('0x8c')](_0x46908a,!![])[_0x8dd2('0x3b')](function(){return _0x4e47e5[_0x8dd2('0x8c')](_0x46908a,![]);})['then'](function(){return _0x4e47e5[_0x8dd2('0xa7')](_0x46908a);})[_0x8dd2('0x9b')](function(_0x59cb13){loggerSyncQueueSummary[_0x8dd2('0x5f')](_0x8dd2('0x13e'),util[_0x8dd2('0x40')](_0x59cb13,{'showHidden':![],'depth':null}));clearPredictiveAttributes(_0x46908a);});}else{clearPredictiveAttributes(_0x46908a);}})[_0x8dd2('0x3b')](function(){var _0xa87ba2=_0x55c327[_0x8dd2('0x13f')](_0x46908a);if(_0xa87ba2||_0x46908a[_0x8dd2('0x140')]){_0x46908a[_0x8dd2('0x140')]=![];_0x55c327['updateReportFromOutboundQueue'](_0x46908a);Object[_0x8dd2('0x141')](_0x46908a,_0x55c327);emitOutboundVoiceQueueSummary(_0x55c327);}_0x4e47e5[_0x8dd2('0x29')][_0x46908a[_0x8dd2('0x43')]][_0x8dd2('0x138')]=![];})[_0x8dd2('0x9b')](function(_0xe1b727){logger[_0x8dd2('0x62')](_0x8dd2('0x13e'),util[_0x8dd2('0x40')](_0xe1b727,{'showHidden':![],'depth':null}));_0x4e47e5[_0x8dd2('0x29')][_0x46908a[_0x8dd2('0x43')]][_0x8dd2('0x138')]=![];});};Dialer[_0x8dd2('0x81')][_0x8dd2('0x30')]=_[_0x8dd2('0x142')](function(){var _0xfd0340=_[_0x8dd2('0x143')](this['voiceQueues'],function(_0x765123){return _0x765123[_0x8dd2('0x144')];});var _0x3b6759=_[_0x8dd2('0x143')](this[_0x8dd2('0x1f')],function(_0x5d9e20){return _0x5d9e20[_0x8dd2('0x145')]&&_0x5d9e20[_0x8dd2('0x86')]===_0x8dd2('0x85');});if(_0xfd0340['length']>0x0&&_0x3b6759[_0x8dd2('0x92')]>0x0){return Promise[_0x8dd2('0xa3')]()[_0x8dd2('0x3b')](cmHopper[_0x8dd2('0x146')](_[_0x8dd2('0x147')](_0xfd0340,'id'),previewRecallmeReminderInterval,_[_0x8dd2('0x147')](_0x3b6759,'id')))[_0x8dd2('0x3b')](function(_0x31211b){for(var _0xe7aab7=0x0;_0xe7aab7<_0x31211b[_0x8dd2('0x92')];_0xe7aab7++){var _0x1babc7=_0x31211b[_0xe7aab7][_0x8dd2('0x148')][_0x8dd2('0x43')];if(_0x1babc7)io['to'](util['format'](_0x8dd2('0x149'),_0x1babc7))[_0x8dd2('0x3d')](_0x8dd2('0x14a'),{'hopper':_0x31211b[_0xe7aab7]});}})[_0x8dd2('0x9b')](function(_0x494684){logger[_0x8dd2('0x62')](_0x8dd2('0x14b'),_0x494684);});}},0x3c*0x3e8,{'leading':!![]});Dialer[_0x8dd2('0x81')]['loopClearZombieChannels']=function(){var _0x11f65a=this;setInterval(function(){_0x11f65a[_0x8dd2('0x14c')](_0x11f65a[_0x8dd2('0x23')],_0x8dd2('0x14d'));_0x11f65a['clearZombieChannels'](_0x11f65a[_0x8dd2('0xeb')],'[actions]');},0x32c8);};Dialer['prototype']['clearZombieChannels']=function(_0x461d2c,_0x4512a4){var _0x8aaf9b=this;for(var _0xf17fd7 in _0x461d2c){if(typeof _0x461d2c[_0xf17fd7]!==_0x8dd2('0x14e')){this[_0x8dd2('0x1c')][_0x8dd2('0x14f')](function(){if(!_[_0x8dd2('0xf1')](_0x461d2c[_0xf17fd7])){return ami[_0x8dd2('0x94')]({'action':_0x8dd2('0x86'),'channel':_0x461d2c[_0xf17fd7][_0x8dd2('0xec')]})[_0x8dd2('0x9b')](function(_0x1beb18){if(_0x1beb18[_0x8dd2('0x68')]==='No\x20such\x20channel'){setTimeout(function(){if(_0x461d2c[_0xf17fd7]&&_0x461d2c[_0xf17fd7][_0x8dd2('0x3e')]!==_0x8dd2('0xb8')){utils[_0x8dd2('0xb9')](_0x8aaf9b['voiceQueues'][_0x461d2c[_0xf17fd7][_0x8dd2('0xb6')]],_0x8dd2('0x150'));logger[_0x8dd2('0x62')](_0x8dd2('0x151'),_0x4512a4,_0xf17fd7,_0x461d2c[_0xf17fd7][_0x8dd2('0xb6')]);delete _0x461d2c[_0xf17fd7];}if(_0x461d2c[_0xf17fd7]&&_0x461d2c[_0xf17fd7][_0x8dd2('0x3e')]===_0x8dd2('0xb8')){utils['decrementOriginate'](_0x8aaf9b[_0x8dd2('0x1e')][_0x461d2c[_0xf17fd7][_0x8dd2('0xb6')]],_0x8dd2('0x150'));logger['error']('[Dialer][checkChannel][ivr]',_0x4512a4,_0xf17fd7,_0x461d2c[_0xf17fd7][_0x8dd2('0xb6')]);delete _0x461d2c[_0xf17fd7];}},0x2328);}});}});}}};Dialer[_0x8dd2('0x81')]['getVoiceQueueRtPauses']=function(_0x578ba0){return Promise[_0x8dd2('0xa3')]()[_0x8dd2('0x3b')](voiceQueueRt[_0x8dd2('0x152')](_0x578ba0))[_0x8dd2('0x9b')](loggerCatch(_0x8dd2('0x153')));};Dialer[_0x8dd2('0x81')][_0x8dd2('0x154')]=function(_0x15de6b,_0x3e607f,_0x3f1f51){var _0x306b3a={'state':0x19,'statedesc':_0x8dd2('0x155')};utils[_0x8dd2('0xb9')](_0x3e607f,'[emptyContact]'+_0x15de6b);this['saveInDb'](_['merge'](_0x306b3a,_[_0x8dd2('0x70')](_0x3f1f51,[_0x8dd2('0xd8'),_0x8dd2('0xd9'),'UserId',_0x8dd2('0xda'),_0x8dd2('0xdb')])),_0x8dd2('0x156'),'[emptyContact]');logger['error'](_0x15de6b);};Dialer[_0x8dd2('0x81')][_0x8dd2('0x113')]=function(_0x157623,_0x597753,_0x1c310a){hopperUtils['createHistory'](_0x157623)['catch'](loggerCatch(_0x597753));hopperUtils[_0x8dd2('0xc3')](_0x157623)[_0x8dd2('0x9b')](loggerCatch(_0x1c310a));};Dialer[_0x8dd2('0x81')][_0x8dd2('0xe8')]=function(_0xa0b277,_0x3ae058){hopperUtils[_0x8dd2('0xc1')](_0xa0b277)[_0x8dd2('0x9b')](loggerCatch(_0x8dd2('0xc2')));if(_0x3ae058==0x0){hopperUtils[_0x8dd2('0xc3')](_0xa0b277)[_0x8dd2('0x9b')](loggerCatch('[syncQueueCallerAbandon]\x20[Drop]'));}};Dialer[_0x8dd2('0x81')][_0x8dd2('0x14b')]=function(_0x4a1760){return Promise[_0x8dd2('0xa3')]()['then'](cmHopper[_0x8dd2('0x146')](_0x4a1760['id'],previewRecallmeReminderInterval))[_0x8dd2('0x3b')](function(_0x10cec2){for(var _0x3eb748=0x0;_0x3eb748<_0x10cec2[_0x8dd2('0x92')];_0x3eb748++){var _0x160bfe=_0x10cec2[_0x3eb748][_0x8dd2('0x148')][_0x8dd2('0x43')];if(_0x160bfe)io['to'](util[_0x8dd2('0x41')](_0x8dd2('0x149'),_0x160bfe))['emit'](_0x8dd2('0x14a'),{'hopper':_0x10cec2[_0x3eb748]});}})[_0x8dd2('0x9b')](function(){});};Dialer[_0x8dd2('0x81')]['launchHandleIvr']=function(_0x4f6bd7){var _0x7c4a9e=this;return function(){_0x7c4a9e[_0x8dd2('0x157')](_0x4f6bd7);};};Dialer[_0x8dd2('0x81')][_0x8dd2('0x158')]=function(_0x31494e,_0x4644e0){var _0x176188=this;var _0xf56081=uuid['v4']();this['actions'][_0xf56081]=new Action(_0x31494e,_0x4644e0,_0xf56081);return new Promise(function(_0x6ac1d4,_0x3e1a55){if(_[_0x8dd2('0x3c')](_0x31494e)&&typeof _0x31494e!==_0x8dd2('0x159')){return _0x3e1a55(msgResponse(_0x8dd2('0x15a'),_0x8dd2('0x90'),'voiceQueue\x20is\x20undefine'));}if(_[_0x8dd2('0x3c')](_0x4644e0[_0x8dd2('0x15b')])||_0x4644e0[_0x8dd2('0x15b')]===null){return _0x3e1a55(msgResponse(_0x8dd2('0x15a'),_0x8dd2('0x90'),_0x8dd2('0x15c')));}var _0x5929ad={'XMD-CALLERID':_0x176188[_0x8dd2('0xeb')][_0xf56081][_0x8dd2('0x15d')](),'XMD-AGI':_0x31494e[_0x8dd2('0x132')]?util[_0x8dd2('0x41')](_0x8dd2('0x15e'),ipAgi,_0x31494e['dialQueueProject']):'NONE','XMD-AGIAFTER':_0x31494e['dialQueueProject2']?util[_0x8dd2('0x41')]('\x22agi://%s/square,%s\x22',ipAgi,_0x31494e['dialQueueProject2']):'NONE','XMD-QUEUE':utils['isOutboundQueue'](_0x31494e)?util[_0x8dd2('0x41')](_0x8dd2('0x15f'),_0x31494e[_0x8dd2('0x43')],_0x31494e[_0x8dd2('0x160')]||'',_0x31494e[_0x8dd2('0xc0')]?'c':'',_0x31494e[_0x8dd2('0xc8')]||0x3):_0x8dd2('0x161'),'XMD-CONTACTID':_0x4644e0[_0x8dd2('0xd8')],'XMD-CDRTYPE':_0x8dd2('0x7'),'CALLERID(all)':_0x176188[_0x8dd2('0xeb')][_0xf56081][_0x8dd2('0x15d')](),'XMD-AMD':_0x31494e[_0x8dd2('0x10b')]?_0x8dd2('0x162'):'NONE','XMD-DESTINATION':_0x8dd2('0x10a')};if(_0x31494e[_0x8dd2('0x10b')]){_0x5929ad['XMD-AMDINITIALSILENCE']=_0x31494e[_0x8dd2('0x163')]||0x9c4;_0x5929ad[_0x8dd2('0x164')]=_0x31494e[_0x8dd2('0x165')]||0x5dc;_0x5929ad['XMD-AMDAFTERGREETINGSILENCE']=_0x31494e['dialAMDAfterGreetingSilence']||0x320;_0x5929ad['XMD-AMDTOTALANALYSISTIME']=_0x31494e[_0x8dd2('0x166')]||0x1388;_0x5929ad[_0x8dd2('0x167')]=_0x31494e['dialAMDMinWordLength']||0x64;_0x5929ad[_0x8dd2('0x168')]=_0x31494e[_0x8dd2('0x169')]||0x32;_0x5929ad[_0x8dd2('0x16a')]=_0x31494e[_0x8dd2('0x16b')]||0x3;_0x5929ad[_0x8dd2('0x16c')]=_0x31494e[_0x8dd2('0x16d')]||0x100;_0x5929ad[_0x8dd2('0x16e')]=_0x31494e[_0x8dd2('0x16f')]||0x1388;}if(utils[_0x8dd2('0x170')](_0x31494e)){_0x5929ad[_0x8dd2('0x171')]=_0x4644e0[_0x8dd2('0xda')];}else{_0x5929ad[_0x8dd2('0x172')]=_0x4644e0[_0x8dd2('0xdb')];}var _0x4e7c98=utils[_0x8dd2('0x173')](_0x4644e0[_0x8dd2('0x174')]);Object[_0x8dd2('0x141')](_0x5929ad,_0x4e7c98);var _0x276398=_0x176188[_0x8dd2('0x82')](_0x31494e[_0x8dd2('0x89')])?utils[_0x8dd2('0x175')](_0x31494e[_0x8dd2('0x89')][_0x8dd2('0x176')],_0x31494e[_0x8dd2('0x177')],_0x31494e['dialRandomLastDigitCallerIdNumber']>0x0?utils[_0x8dd2('0x178')](_0x31494e[_0x8dd2('0x179')],_0x31494e[_0x8dd2('0x17a')]):_0x31494e[_0x8dd2('0x179')]):utils[_0x8dd2('0x175')](_[_0x8dd2('0xf1')](_0x31494e['TrunkBackup'])?_0x31494e[_0x8dd2('0x89')][_0x8dd2('0x176')]:_0x31494e[_0x8dd2('0x17b')][_0x8dd2('0x176')],_0x31494e['dialOriginateCallerIdName'],_0x31494e[_0x8dd2('0x17a')]>0x0?utils[_0x8dd2('0x178')](_0x31494e['dialOriginateCallerIdNumber'],_0x31494e['dialRandomLastDigitCallerIdNumber']):_0x31494e[_0x8dd2('0x179')]);if(_0x276398){_0x5929ad[_0x8dd2('0x17c')]=_0x176188[_0x8dd2('0xeb')][_0xf56081][_0x8dd2('0x17d')]=utils[_0x8dd2('0x17e')](_0x276398);_0x5929ad['XMD-ORIGINATECALLERIDNUM']=_0x4644e0[_0x8dd2('0x15b')];}_0x31494e[_0x8dd2('0x17f')]=_0x5929ad;return ami['Action']({'actionid':_0xf56081,'action':_0x8dd2('0x15a'),'channel':_0x176188[_0x8dd2('0x82')](_0x31494e['Trunk'])?util[_0x8dd2('0x41')](_0x8dd2('0x180'),_0x31494e[_0x8dd2('0x89')]['name'],isNotNull(_0x31494e['dialPrefix'])?_0x31494e[_0x8dd2('0x181')][_0x8dd2('0x182')]()||'':'',_0x31494e[_0x8dd2('0x183')]>0x0?_0x4644e0[_0x8dd2('0x15b')][_0x8dd2('0x184')](_0x31494e['dialCutDigit']):_0x4644e0[_0x8dd2('0x15b')]):util[_0x8dd2('0x41')](_0x8dd2('0x180'),_[_0x8dd2('0xf1')](_0x31494e[_0x8dd2('0x17b')])?_0x31494e['Trunk'][_0x8dd2('0x43')]:_0x31494e[_0x8dd2('0x17b')][_0x8dd2('0x43')],isNotNull(_0x31494e[_0x8dd2('0x181')])?_0x31494e[_0x8dd2('0x181')][_0x8dd2('0x182')]()||'':'',_0x31494e[_0x8dd2('0x183')]>0x0?_0x4644e0[_0x8dd2('0x15b')][_0x8dd2('0x184')](_0x31494e[_0x8dd2('0x183')]):_0x4644e0[_0x8dd2('0x15b')]),'callerid':_0x276398,'Exten':_0x8dd2('0x10a'),'Context':_0x8dd2('0x185'),'Priority':'1','variable':_0x5929ad,'timeout':(_0x31494e[_0x8dd2('0x186')]||0x1e)*0x3e8,'async':!![],'channelid':_0xf56081})[_0x8dd2('0x3b')](function(_0x4a45ce){return _0x6ac1d4(_0x4a45ce);})['catch'](function(_0x3059ef){_0x31494e['outboundOriginateFailureCallsDay']+=0x1;var _0xdd8f27=new History(_0x176188[_0x8dd2('0xeb')][_0xf56081]);logger[_0x8dd2('0x62')](util[_0x8dd2('0x41')](_0x8dd2('0x187'),JSON[_0x8dd2('0x80')](_0x3059ef)));_0xdd8f27[_0x8dd2('0xcc')]=0xe;_0xdd8f27[_0x8dd2('0x6c')]=_0x8dd2('0x188');_0xdd8f27[_0x8dd2('0x6d')]=moment()[_0x8dd2('0x41')](_0x8dd2('0xbb'));_0xdd8f27[_0x8dd2('0xdd')]=_0xdd8f27[_0x8dd2('0x6d')];hopperUtils['createHistory'](_0xdd8f27)[_0x8dd2('0x9b')](loggerCatch('[originate][error]'));_0x176188[_0x8dd2('0xc3')](_0xdd8f27)['catch'](loggerCatch(_0x8dd2('0x189')))[_0x8dd2('0x1b')](function(){delete _0x176188[_0x8dd2('0xeb')][_0xf56081];return _0x3e1a55(msgResponse(_0x8dd2('0x15a'),_0x8dd2('0x18a'),'originate\x20action\x20Error'));});});});};Dialer['prototype'][_0x8dd2('0x18b')]=function(_0x47a4b9,_0xc3eb01,_0x590f1d){var _0x579126=new History(_0xc3eb01);if(_0x579126[_0x8dd2('0x11b')]+_0x579126[_0x8dd2('0x128')]+_0x579126[_0x8dd2('0x11c')]+_0x579126[_0x8dd2('0x129')]+_0x579126[_0x8dd2('0xcf')]+_0x579126['countabandonedretry']+_0x579126[_0x8dd2('0x119')]+_0x579126[_0x8dd2('0x11d')]>=_0x590f1d['dialGlobalMaxRetry']-0x1){return!![];}switch(_0x47a4b9){case 0x3:if(_0x579126[_0x8dd2('0x11c')]>=_0x590f1d[_0x8dd2('0x18c')]-0x1){return!![];}hopperUtils[_0x8dd2('0xf9')]({'active':![],'countnoanswerretry':_0x579126[_0x8dd2('0x11c')]+=0x1,'scheduledat':moment()[_0x8dd2('0xd6')](_0x590f1d[_0x8dd2('0x18d')],'minutes')['format']('YYYY-MM-DD\x20HH:mm:ss'),'ContactId':_0x579126['ContactId'],'ListId':_0x579126[_0x8dd2('0xd9')],'VoiceQueueId':_0x579126[_0x8dd2('0xda')]||undefined,'CampaignId':_0x579126[_0x8dd2('0xdb')]||undefined})[_0x8dd2('0x9b')](loggerCatch('[rescheduleContact][NoAnswer]'));break;case 0x5:if(_0x579126['countbusyretry']>=_0x590f1d[_0x8dd2('0x18e')]-0x1){return!![];}hopperUtils['rescheduleContact']({'active':![],'countbusyretry':_0x579126['countbusyretry']+=0x1,'scheduledat':moment()['add'](_0x590f1d['dialBusyRetryFrequency'],_0x8dd2('0xd7'))['format'](_0x8dd2('0xbb')),'ContactId':_0x579126[_0x8dd2('0xd8')],'ListId':_0x579126['ListId'],'VoiceQueueId':_0x579126[_0x8dd2('0xda')]||undefined,'CampaignId':_0x579126[_0x8dd2('0xdb')]||undefined})[_0x8dd2('0x9b')](loggerCatch('[rescheduleContact]\x20[Busy]'));break;case 0x8:if(_0x579126[_0x8dd2('0x128')]>=_0x590f1d[_0x8dd2('0x18f')]-0x1){return!![];}hopperUtils[_0x8dd2('0xf9')]({'active':![],'countcongestionretry':_0x579126[_0x8dd2('0x128')]+=0x1,'scheduledat':moment()[_0x8dd2('0xd6')](_0x590f1d['dialCongestionRetryFrequency'],'minutes')[_0x8dd2('0x41')]('YYYY-MM-DD\x20HH:mm:ss'),'ContactId':_0x579126['ContactId'],'ListId':_0x579126[_0x8dd2('0xd9')],'VoiceQueueId':_0x579126[_0x8dd2('0xda')]||undefined,'CampaignId':_0x579126[_0x8dd2('0xdb')]||undefined})[_0x8dd2('0x9b')](loggerCatch(_0x8dd2('0x190')));break;case 0x0:if(_0x579126['countnosuchnumberretry']>=_0x590f1d[_0x8dd2('0x191')]-0x1){return!![];}else{hopperUtils[_0x8dd2('0xf9')]({'active':![],'countnosuchnumberretry':_0x579126['countnosuchnumberretry']+=0x1,'scheduledat':moment()['add'](_0x590f1d[_0x8dd2('0x192')],_0x8dd2('0xd7'))['format'](_0x8dd2('0xbb')),'ContactId':_0x579126[_0x8dd2('0xd8')],'ListId':_0x579126[_0x8dd2('0xd9')],'VoiceQueueId':_0x579126[_0x8dd2('0xda')]||undefined,'CampaignId':_0x579126[_0x8dd2('0xdb')]||undefined})[_0x8dd2('0x9b')](loggerCatch('[rescheduleContact][NoSuchNumber]'));}break;case 0xa:if(_0x579126[_0x8dd2('0xcf')]>=_0x590f1d[_0x8dd2('0xd5')]-0x1){return!![];}hopperUtils['rescheduleContact']({'active':![],'countdropretry':_0x579126[_0x8dd2('0xcf')]+=0x1,'scheduledat':moment()[_0x8dd2('0xd6')](_0x590f1d[_0x8dd2('0xd1')],_0x8dd2('0xd7'))['format'](_0x8dd2('0xbb')),'ContactId':_0x579126[_0x8dd2('0xd8')],'ListId':_0x579126[_0x8dd2('0xd9')],'VoiceQueueId':_0x579126[_0x8dd2('0xda')]||undefined,'CampaignId':_0x579126[_0x8dd2('0xdb')]||undefined})['catch'](loggerCatch('[rescheduleContact][Drop]'));break;case 0xb:if(_0x579126[_0x8dd2('0xe5')]>=_0x590f1d[_0x8dd2('0xe7')]-0x1){return!![];}hopperUtils['rescheduleContact']({'active':![],'countabandonedretry':_0x579126['countabandonedretry']+=0x1,'scheduledat':moment()[_0x8dd2('0xd6')](_0x590f1d[_0x8dd2('0x193')],_0x8dd2('0xd7'))[_0x8dd2('0x41')](_0x8dd2('0xbb')),'ContactId':_0x579126[_0x8dd2('0xd8')],'ListId':_0x579126[_0x8dd2('0xd9')],'VoiceQueueId':_0x579126[_0x8dd2('0xda')]||undefined,'CampaignId':_0x579126['CampaignId']||undefined})[_0x8dd2('0x9b')](loggerCatch('[rescheduleContact][Abandoned]'));break;case 0x13:if(_0x579126[_0x8dd2('0x119')]>=_0x590f1d[_0x8dd2('0x120')]-0x1){return!![];}hopperUtils[_0x8dd2('0xf9')]({'active':![],'countmachineretry':_0x579126['countmachineretry']+=0x1,'scheduledat':moment()[_0x8dd2('0xd6')](_0x590f1d[_0x8dd2('0x123')],_0x8dd2('0xd7'))[_0x8dd2('0x41')]('YYYY-MM-DD\x20HH:mm:ss'),'ContactId':_0x579126['ContactId'],'ListId':_0x579126[_0x8dd2('0xd9')],'VoiceQueueId':_0x579126[_0x8dd2('0xda')]||undefined,'CampaignId':_0x579126[_0x8dd2('0xdb')]||undefined})[_0x8dd2('0x9b')](loggerCatch(_0x8dd2('0x124')));break;case 0x14:if(_0x579126[_0x8dd2('0x11d')]>=_0x590f1d['dialAgentRejectMaxRetry']-0x1){return!![];}hopperUtils[_0x8dd2('0xf9')]({'active':![],'countagentrejectretry':_0x579126[_0x8dd2('0x11d')]+=0x1,'scheduledat':moment()[_0x8dd2('0xd6')](_0x590f1d[_0x8dd2('0x194')],_0x8dd2('0xd7'))['format'](_0x8dd2('0xbb')),'ContactId':_0x579126['ContactId'],'ListId':_0x579126[_0x8dd2('0xd9')],'VoiceQueueId':_0x579126[_0x8dd2('0xda')]||undefined,'CampaignId':_0x579126[_0x8dd2('0xdb')]||undefined})[_0x8dd2('0x9b')](loggerCatch(_0x8dd2('0x195')));break;default:return!![];}};Dialer['prototype'][_0x8dd2('0x196')]=function(_0xab58d,_0x4e9bf9,_0x5590c3){var _0x4a3fab=this;var _0x5bdfd7=new History(_0xab58d);var _0x5e3408=![];var _0x1436c7;var _0x4acd45;return new Promise(function(_0x9e028f,_0x16bcf6){if(_['isUndefined'](_0x4e9bf9)&&typeof _0x4e9bf9!==_0x8dd2('0x159')){return _0x16bcf6(msgResponse(_0x8dd2('0x197'),'Failure',_0x8dd2('0x198')));}if(_['isUndefined'](_0x5590c3)&&typeof _0x5590c3!==_0x8dd2('0x159')){return _0x16bcf6(msgResponse(_0x8dd2('0x197'),_0x8dd2('0x90'),_0x8dd2('0x199')));}hopperUtils[_0x8dd2('0xd3')](_0x5bdfd7,_0x5590c3['reason'],_0x4e9bf9)[_0x8dd2('0x3b')](function(_0x4dafc7){if(_0x4dafc7[_0x8dd2('0xd4')]==0x1)_0x5e3408=!![];switch(_0x5590c3[_0x8dd2('0xbd')]){case'0':_0x4e9bf9[_0x8dd2('0x19a')]+=0x1;_0x5bdfd7[_0x8dd2('0xcc')]=0x0;_0x5bdfd7['statedesc']='NoSuchNumber';_0x5bdfd7[_0x8dd2('0x129')]+=0x1;_0x5bdfd7[_0x8dd2('0xd0')]+=0x1;ami[_0x8dd2('0x3d')]('custom:agentnosuchnumber',ut[_0x8dd2('0x111')](_0xab58d,_0x8dd2('0x19b')));_0x1436c7=_0x4e9bf9[_0x8dd2('0x192')];_0x4acd45=_0x4e9bf9[_0x8dd2('0xd2')];hopperUtils[_0x8dd2('0xc1')](_0x5bdfd7)['catch'](loggerCatch(_0x8dd2('0x11a')));if(_0x4a3fab[_0x8dd2('0x18b')](0x0,_0xab58d,_0x4e9bf9)&&!_0x5e3408){if(_0x5bdfd7[_0x8dd2('0x129')]>=_0x4e9bf9[_0x8dd2('0x191')]){_0x4a3fab[_0x8dd2('0x121')](_0x5bdfd7,_0x9e028f,_0x16bcf6,_0x8dd2('0x19c'));}else{_0x4a3fab[_0x8dd2('0x12a')](_0x5bdfd7,_0x9e028f,_0x16bcf6,'reason\x200\x20no\x20such\x20number....');}}break;case'3':_0x4e9bf9[_0x8dd2('0x19d')]+=0x1;_0x5bdfd7['state']=0x3;_0x5bdfd7[_0x8dd2('0x6c')]=_0x8dd2('0x19e');_0x5bdfd7[_0x8dd2('0x11c')]+=0x1;_0x5bdfd7[_0x8dd2('0xd0')]+=0x1;var _0x793656=ut[_0x8dd2('0x19f')](_0xab58d,_0x4e9bf9);ami[_0x8dd2('0x3d')](_0x8dd2('0x1a0'),_0x793656);_0x1436c7=_0x4e9bf9[_0x8dd2('0x18d')];_0x4acd45=_0x4e9bf9['callAdditionalPhoneAfterMin'];hopperUtils[_0x8dd2('0xc1')](_0x5bdfd7)[_0x8dd2('0x9b')](loggerCatch(_0x8dd2('0x1a1')));if(_0x4a3fab[_0x8dd2('0x18b')](0x3,_0xab58d,_0x4e9bf9)&&!_0x5e3408){if(_0x5bdfd7[_0x8dd2('0x11c')]>=_0x4e9bf9['dialNoAnswerMaxRetry']){_0x4a3fab[_0x8dd2('0x121')](_0x5bdfd7,_0x9e028f,_0x16bcf6,_0x8dd2('0x1a2'));}else{_0x4a3fab['stateGlobal'](_0x5bdfd7,_0x9e028f,_0x16bcf6,_0x8dd2('0x1a2'));}}break;case'5':_0x4e9bf9['outboundBusyCallsDay']+=0x1;_0x5bdfd7[_0x8dd2('0xcc')]=0x5;_0x5bdfd7[_0x8dd2('0x6c')]='Busy';_0x5bdfd7[_0x8dd2('0x11b')]+=0x1;_0x5bdfd7[_0x8dd2('0xd0')]+=0x1;ami['emit'](_0x8dd2('0x1a3'),ut['buildObj'](_0xab58d,_0x8dd2('0x1a4')));_0x1436c7=_0x4e9bf9['dialBusyRetryFrequency'];_0x4acd45=_0x4e9bf9['callAdditionalPhoneAfterMin'];hopperUtils['createHistory'](_0x5bdfd7)[_0x8dd2('0x9b')](loggerCatch(_0x8dd2('0x1a5')));if(_0x4a3fab[_0x8dd2('0x18b')](0x5,_0xab58d,_0x4e9bf9)&&!_0x5e3408){if(_0x5bdfd7['countbusyretry']>=_0x4e9bf9[_0x8dd2('0x18e')]){_0x4a3fab[_0x8dd2('0x121')](_0x5bdfd7,_0x9e028f,_0x16bcf6,_0x8dd2('0x1a6'));}else{_0x4a3fab[_0x8dd2('0x12a')](_0x5bdfd7,_0x9e028f,_0x16bcf6,'reason\x205\x20busy');}}break;case'8':_0x4e9bf9[_0x8dd2('0x1a7')]+=0x1;_0x5bdfd7['state']=0x8;_0x5bdfd7['statedesc']=_0x8dd2('0x1a8');_0x5bdfd7[_0x8dd2('0x128')]+=0x1;_0x5bdfd7[_0x8dd2('0xd0')]+=0x1;_0x1436c7=_0x4e9bf9['dialCongestionRetryFrequency'];_0x4acd45=_0x4e9bf9['callAdditionalPhoneAfterMin'];ami[_0x8dd2('0x3d')](_0x8dd2('0x1a9'),ut['buildObj'](_0xab58d,_0x8dd2('0x1aa')));hopperUtils[_0x8dd2('0xc1')](_0x5bdfd7)[_0x8dd2('0x9b')](loggerCatch(_0x8dd2('0x1ab')));if(_0x4a3fab['checkRetriveMax'](0x8,_0xab58d,_0x4e9bf9)&&!_0x5e3408){if(_0x5bdfd7[_0x8dd2('0x128')]>=_0x4e9bf9[_0x8dd2('0x18f')]){_0x4a3fab['createStateFinal'](_0x5bdfd7,_0x9e028f,_0x16bcf6,_0x8dd2('0x1ac'));}else{_0x4a3fab[_0x8dd2('0x12a')](_0x5bdfd7,_0x9e028f,_0x16bcf6,_0x8dd2('0x1ac'));}}break;case'11':_0x4e9bf9[_0x8dd2('0x1ad')]+=0x1;_0x5bdfd7[_0x8dd2('0xcc')]=0xb;_0x5bdfd7['statedesc']='Abandoned';_0x5bdfd7[_0x8dd2('0xe5')]+=0x1;_0x5bdfd7[_0x8dd2('0xd0')]+=0x1;_0x1436c7=_0x4e9bf9['dialAbandonedRetryFrequency'];_0x4acd45=_0x4e9bf9['callAdditionalPhoneAfterMin'];hopperUtils['createHistory'](_0x5bdfd7)[_0x8dd2('0x9b')](loggerCatch(_0x8dd2('0x1ae')));if(_0x4a3fab['checkRetriveMax'](0xb,_0xab58d,_0x4e9bf9)&&!_0x5e3408){if(_0x5bdfd7[_0x8dd2('0xe5')]>=_0x4e9bf9[_0x8dd2('0xe7')]){_0x4a3fab['createStateFinal'](_0x5bdfd7,_0x9e028f,_0x16bcf6,'reason\x2011\x20abandoned');}else{_0x4a3fab['stateGlobal'](_0x5bdfd7,_0x9e028f,_0x16bcf6,_0x8dd2('0x1af'));}}break;case'20':_0x4e9bf9[_0x8dd2('0x1b0')]+=0x1;_0x5bdfd7[_0x8dd2('0xcc')]=0x14;_0x5bdfd7['statedesc']=_0x8dd2('0x1b1');_0x5bdfd7['countagentrejectretry']+=0x1;_0x5bdfd7['countglobal']+=0x1;_0x1436c7=_0x4e9bf9[_0x8dd2('0x194')];_0x4acd45=_0x4e9bf9[_0x8dd2('0xd2')];ami['emit'](_0x8dd2('0x1b2'),ut[_0x8dd2('0x111')](_0xab58d,_0x8dd2('0x1b3')));hopperUtils[_0x8dd2('0xc1')](_0x5bdfd7)['catch'](loggerCatch(_0x8dd2('0x1b4')));if(_0x4a3fab[_0x8dd2('0x18b')](0x14,_0xab58d,_0x4e9bf9)&&!_0x5e3408){if(_0x5bdfd7[_0x8dd2('0x11d')]>=_0x4e9bf9[_0x8dd2('0x1b5')]){_0x4a3fab[_0x8dd2('0x121')](_0x5bdfd7,_0x9e028f,_0x16bcf6,_0x8dd2('0x1b6'));}else{_0x4a3fab[_0x8dd2('0x12a')](_0x5bdfd7,_0x9e028f,_0x16bcf6,_0x8dd2('0x1b6'));}}break;default:_0x4e9bf9[_0x8dd2('0x1b7')]+=0x1;_0x5bdfd7['state']=0xc;_0x5bdfd7[_0x8dd2('0x6c')]=_0x5590c3['reason'];_0x1436c7=_0x4e9bf9[_0x8dd2('0x194')];_0x4acd45=_0x4e9bf9[_0x8dd2('0xd2')];hopperUtils['createHistory'](_0x5bdfd7)[_0x8dd2('0x9b')](loggerCatch(_0x8dd2('0x1b8')));if(_0x4a3fab[_0x8dd2('0x18b')](_0x5590c3[_0x8dd2('0xbd')],_0xab58d,_0x4e9bf9)&&!_0x5e3408){if(_0x5bdfd7[_0x8dd2('0x11b')]+_0x5bdfd7[_0x8dd2('0x128')]+_0x5bdfd7[_0x8dd2('0x11c')]+_0x5bdfd7['countnosuchnumberretry']+_0x5bdfd7[_0x8dd2('0xcf')]+_0x5bdfd7['countabandonedretry']+_0x5bdfd7[_0x8dd2('0x119')]+_0x5bdfd7['countagentrejectretry']>=_0x4e9bf9[_0x8dd2('0x11e')]){_0x4a3fab[_0x8dd2('0x12a')](_0x5bdfd7,_0x9e028f,_0x16bcf6,_0x5590c3[_0x8dd2('0xbd')]);}else{_0x4a3fab[_0x8dd2('0x121')](_0x5bdfd7,_0x9e028f,_0x16bcf6,_0x5590c3[_0x8dd2('0xbd')]);}}}})['then'](function(){if(_0x5e3408){hopperUtils[_0x8dd2('0xea')](_0x5bdfd7,_0x1436c7,_0x4acd45)['then'](function(){return _0x9e028f(0x1);});}});});};Dialer[_0x8dd2('0x81')][_0x8dd2('0x12a')]=function(_0x380d97,_0x19f56b,_0x32138a,_0x2ec8b5){var _0xb30edc=new Final(_0x380d97);_0xb30edc[_0x8dd2('0xcc')]=0xf;_0xb30edc[_0x8dd2('0x6c')]=_0x8dd2('0x1b9');this[_0x8dd2('0x121')](_0xb30edc,_0x19f56b,_0x32138a,_0x2ec8b5);};Dialer[_0x8dd2('0x81')]['createStateFinal']=function(_0x3ffbbf,_0x335355,_0x522d9b,_0x5128db){hopperUtils[_0x8dd2('0xc3')](_0x3ffbbf)[_0x8dd2('0x3b')](function(){return _0x335355(msgResponse(_0x8dd2('0x197'),_0x8dd2('0x105'),_0x5128db));})[_0x8dd2('0x9b')](function(){return _0x522d9b(msgResponse(_0x8dd2('0x1ba'),'Failure',_0x8dd2('0x1bb')));});};Dialer[_0x8dd2('0x81')][_0x8dd2('0x9')]=function(_0x3ba9e1){var _0x4d8604=_0x3ba9e1[_0x8dd2('0x1bc')]/0x64;var _0x284abc=_0x3ba9e1[_0x8dd2('0xca')]/(_0x3ba9e1[_0x8dd2('0xca')]+_0x3ba9e1[_0x8dd2('0xbc')]);var _0x434cf6=Math[_0x8dd2('0x1bd')](_0x3ba9e1[_0x8dd2('0x1be')]*(_0x3ba9e1[_0x8dd2('0x1bf')]/0x64));var _0x5b7943=Math[_0x8dd2('0x1bd')](_0x3ba9e1[_0x8dd2('0x1be')]*(_0x3ba9e1[_0x8dd2('0x1c0')]/0x64));var _0x3ffab0=_0x3ba9e1[_0x8dd2('0x1c1')]+_0x3ba9e1[_0x8dd2('0x13c')];var _0xa47a63=Math[_0x8dd2('0x1c2')](_0x3ba9e1[_0x8dd2('0x1c3')]*_0x3ba9e1[_0x8dd2('0x5a')]*_0x3ba9e1['predictiveIntervalHitRate']*_0x3ba9e1['predictiveIntervalMultiplicativeFactor']);if(_[_0x8dd2('0x3c')](_0x3ba9e1[_0x8dd2('0x26')])){if(!_[_0x8dd2('0x3c')](_0x3ba9e1[_0x8dd2('0x25')])){_0x3ba9e1['startPredictive']=undefined;loggerPredictive[_0x8dd2('0x62')](_0x8dd2('0x1c4'),_0x8dd2('0x1c5'));}if(!_[_0x8dd2('0x3c')](_0x3ba9e1['handlePredictive'])){loggerPredictive[_0x8dd2('0x62')](_0x8dd2('0x1c4'),_0x8dd2('0x1c6'));clearInterval(_0x3ba9e1[_0x8dd2('0x61')]);_0x3ba9e1['handlePredictive']=undefined;}_0x3ba9e1['startProgressive']=moment()[_0x8dd2('0x41')]('YYYY-MM-DD\x20HH:mm:ss');loggerPredictive[_0x8dd2('0x46')](_0x3ba9e1['name'],_0x8dd2('0x1c7'),_0x3ba9e1[_0x8dd2('0x26')]);this[_0x8dd2('0xab')](_0x3ba9e1,0x1);}else if(ifInterval(_0x3ba9e1[_0x8dd2('0x1c8')],_0x3ba9e1[_0x8dd2('0x26')])){this[_0x8dd2('0xab')](_0x3ba9e1,0x1);loggerPredictiveCalls[_0x8dd2('0x46')]('[startMethodPredictive][StartProgressive][Loop]',_0x3ba9e1[_0x8dd2('0x26')],_0x3ba9e1[_0x8dd2('0x43')]);_0x3ba9e1[_0x8dd2('0x1c3')]=0x0;_0x3ba9e1[_0x8dd2('0xcb')]=0x0;}else if(_0x4d8604<_0x284abc&&_0x3ba9e1[_0x8dd2('0x1c9')]===_0x8dd2('0x1ca')){clearPredictiveAttributes(_0x3ba9e1);loggerPredictive['info'](_0x8dd2('0x1cb'),_0x8dd2('0x1cc'),_0x284abc,_0x8dd2('0x26'),_0x3ba9e1[_0x8dd2('0x43')]);}else if(_0xa47a63<_0x3ba9e1['predictiveIntervalErlangCallsDroppedCalls']&&_0x3ba9e1[_0x8dd2('0x1c9')]===_0x8dd2('0x1ca')){clearPredictiveAttributes(_0x3ba9e1);loggerPredictive[_0x8dd2('0x46')](_0x8dd2('0x1cd'),_0x8dd2('0x1ce'),_0xa47a63,_0x8dd2('0x1cf'),_0x3ba9e1['predictiveIntervalErlangCallsDroppedCalls'],_0x8dd2('0x26'),_0x3ba9e1['name']);}else if(!ifInterval(_0x3ba9e1[_0x8dd2('0x1c8')],_0x3ba9e1[_0x8dd2('0x26')])&&_[_0x8dd2('0x3c')](_0x3ba9e1[_0x8dd2('0x25')])&&!_[_0x8dd2('0x3c')](_0x3ba9e1[_0x8dd2('0x26')])){_0x3ba9e1[_0x8dd2('0x25')]=moment()[_0x8dd2('0x41')](_0x8dd2('0xbb'));loggerPredictive[_0x8dd2('0x46')](_0x3ba9e1[_0x8dd2('0x43')],_0x8dd2('0x1d0'),_0x3ba9e1['startPredictive']);hopperUtils[_0x8dd2('0x1d1')](_0x3ba9e1[_0x8dd2('0x1c8')])['then'](this[_0x8dd2('0x1d2')](_0x3ba9e1))[_0x8dd2('0x3b')](mergeDataErlangB(_0x3ba9e1))[_0x8dd2('0x3b')](this[_0x8dd2('0x1d3')](_0x3ba9e1))[_0x8dd2('0x9b')](loggerCatchPredictive(_0x8dd2('0x1d4'),_0x3ba9e1));}else if(!ifInterval(_0x3ba9e1[_0x8dd2('0x1c8')],_0x3ba9e1[_0x8dd2('0x25')])){_0x3ba9e1['predictiveIntervalErlangCallsDroppedCalls']=0x0;_0x3ba9e1[_0x8dd2('0x25')]=moment()[_0x8dd2('0x41')](_0x8dd2('0xbb'));loggerPredictive[_0x8dd2('0x46')](_0x3ba9e1[_0x8dd2('0x43')],'recalculate\x20predictive\x20at',_0x3ba9e1[_0x8dd2('0x25')]);clearInterval(_0x3ba9e1['handlePredictive']);_0x3ba9e1[_0x8dd2('0x61')]=undefined;hopperUtils[_0x8dd2('0x1d1')](_0x3ba9e1[_0x8dd2('0x1c8')])[_0x8dd2('0x3b')](this[_0x8dd2('0x1d2')](_0x3ba9e1))['then'](mergeDataErlangB(_0x3ba9e1))[_0x8dd2('0x3b')](this[_0x8dd2('0x1d3')](_0x3ba9e1))[_0x8dd2('0x9b')](loggerCatchPredictive('Predictive\x20for\x20every\x20interval',_0x3ba9e1));}else if(_0x3ba9e1[_0x8dd2('0x1be')]&&_0x3ffab0<_0x3ba9e1[_0x8dd2('0x1be')]-_0x5b7943){clearPredictiveAttributes(_0x3ba9e1);loggerPredictive[_0x8dd2('0x46')](_0x3ba9e1['name'],_0x8dd2('0x1d5'),_0x3ffab0,_0x8dd2('0x1d6'),_0x3ba9e1['predictiveIntervalAvailable'],'-',_0x5b7943,'=',_0x3ba9e1['predictiveIntervalAvailable']-_0x5b7943,')');}else if(_0x3ba9e1[_0x8dd2('0x1be')]&&_0x3ffab0>_0x3ba9e1[_0x8dd2('0x1be')]+_0x434cf6){clearPredictiveAttributes(_0x3ba9e1);loggerPredictive['info'](_0x3ba9e1[_0x8dd2('0x43')],_0x8dd2('0x1d5'),_0x3ffab0,_0x8dd2('0x1d7'),_0x3ba9e1[_0x8dd2('0x1be')],'+',_0x434cf6,'=',_0x3ba9e1[_0x8dd2('0x1be')]+_0x434cf6,')');}};Dialer[_0x8dd2('0x81')][_0x8dd2('0x1d2')]=function(_0x398f82){var _0x41300d=this;return function(_0x523fcb){return new Promise(function(_0x5e6b94,_0x1796e2){_[_0x8dd2('0x5d')](_0x398f82,_0x523fcb[0x0]);if(checkGetDataPredictive(_0x523fcb[0x0])){var _0x292023=_0x398f82[_0x8dd2('0x1be')]=_0x398f82[_0x8dd2('0x13c')]+_0x398f82[_0x8dd2('0x1c1')];var _0x37e8dd=_0x398f82[_0x8dd2('0x1c8')]*0x3c;var _0x4740f1=_0x523fcb[0x0][_0x8dd2('0x4f')]+_0x523fcb[0x0]['predictiveIntervalAvgHoldtime'];var _0x11ffa6=(_0x523fcb[0x0]['predictiveIntervalAnsweredCalls']+_0x523fcb[0x0][_0x8dd2('0xc9')]+_0x523fcb[0x0][_0x8dd2('0x4c')])/_0x523fcb[0x0][_0x8dd2('0x51')];_0x398f82['predictiveIntervalHitRate']=_0x11ffa6>0x0?_0x11ffa6:0x1;switch(_0x398f82[_0x8dd2('0x1c9')]){case _0x8dd2('0x1ca'):var _0x3e3efc=_0x398f82[_0x8dd2('0x1bc')]/0x64;return _0x41300d['abandonmentRate'](_0x292023,_0x37e8dd,_0x4740f1,_0x11ffa6,_0x3e3efc)[_0x8dd2('0x3b')](function(_0x4ad4e8){return _0x5e6b94(_0x4ad4e8);});case _0x8dd2('0x1d8'):var _0x377763=_0x398f82[_0x8dd2('0x1bc')]/0x64;return _0x41300d['busyFactor'](_0x292023,_0x37e8dd,_0x4740f1,_0x11ffa6,_0x377763)[_0x8dd2('0x3b')](function(_0x257a92){return _0x5e6b94(_0x257a92);});default:return _0x1796e2(msgResponse(_0x8dd2('0x1d9'),_0x8dd2('0x90'),_0x8dd2('0x1da')));}}else{return _0x1796e2(msgResponse('[getDataPredictive]',_0x8dd2('0x90'),'check\x20failure'));}});};};Dialer[_0x8dd2('0x81')]['getDataPredictiveOld']=function(_0x3238b9){var _0x43a860=this;return function(_0x4d5237){return new Promise(function(_0x3d5827,_0x2f7e12){_[_0x8dd2('0x5d')](_0x3238b9,_0x4d5237[0x0]);if(checkGetDataPredictive(_0x4d5237[0x0])){loggerPredictive[_0x8dd2('0x46')](JSON['stringify'](_0x4d5237[0x0]));if(_0x3238b9[_0x8dd2('0x1c9')]==='dropRate'){return _0x43a860[_0x8dd2('0x152')](_0x3238b9['id'])['then'](function(_0x25f700){var _0x2d0211=_0x3238b9['loggedIn']-_0x25f700[0x0][_0x8dd2('0x1db')];var _0x2f9706=_0x3238b9[_0x8dd2('0x1c8')]*0x3c;var _0x5bf9d3=_0x4d5237[0x0][_0x8dd2('0x4f')]+_0x4d5237[0x0][_0x8dd2('0x4d')];var _0x1c92d3=(_0x4d5237[0x0][_0x8dd2('0x49')]+_0x4d5237[0x0][_0x8dd2('0xc9')]+_0x4d5237[0x0]['predictiveIntervalDroppedCallsCallersExit'])/_0x4d5237[0x0][_0x8dd2('0x51')];var _0x106ed6=_0x3238b9[_0x8dd2('0x1bc')]/0x64;_0x3238b9['predictiveIntervalPauses']=_0x25f700[0x0][_0x8dd2('0x1db')]||0x0;_0x3238b9[_0x8dd2('0x1dc')]=_0x1c92d3>0x0?_0x1c92d3:0x1;return _0x43a860[_0x8dd2('0x1dd')](_0x2d0211,_0x2f9706,_0x5bf9d3,_0x1c92d3,_0x106ed6);})[_0x8dd2('0x3b')](function(_0x418985){return _0x3d5827(_0x418985);})[_0x8dd2('0x9b')](function(_0x345ef3){return _0x2f7e12(msgResponse(_0x8dd2('0x1de'),_0x8dd2('0x90'),JSON[_0x8dd2('0x80')](_0x345ef3)));});}if(_0x3238b9[_0x8dd2('0x1c9')]===_0x8dd2('0x1d8')){return _0x43a860[_0x8dd2('0x152')](_0x3238b9['id'])['then'](function(_0x5293bc){var _0x5dcbb9=_0x3238b9[_0x8dd2('0x1df')]-_0x5293bc[0x0][_0x8dd2('0x1db')];var _0x361b54=_0x3238b9[_0x8dd2('0x1c8')]*0x3c;var _0xc493dc=_0x4d5237[0x0][_0x8dd2('0x4f')]+_0x4d5237[0x0][_0x8dd2('0x4d')];var _0x1396b1=(_0x4d5237[0x0][_0x8dd2('0x49')]+_0x4d5237[0x0][_0x8dd2('0xc9')]+_0x4d5237[0x0][_0x8dd2('0x4c')])/_0x4d5237[0x0][_0x8dd2('0x51')];var _0x214ce2=_0x3238b9[_0x8dd2('0x1bc')]/0x64;_0x3238b9[_0x8dd2('0x1e0')]=_0x5293bc[0x0][_0x8dd2('0x1db')]||0x0;_0x3238b9[_0x8dd2('0x1dc')]=_0x1396b1>0x0?_0x1396b1:0x1;return _0x43a860[_0x8dd2('0x1e1')](_0x5dcbb9,_0x361b54,_0xc493dc,_0x1396b1,_0x214ce2);})[_0x8dd2('0x3b')](function(_0x1ac25f){return _0x3d5827(_0x1ac25f);})[_0x8dd2('0x9b')](function(_0x32d0c6){return _0x2f7e12(msgResponse(_0x8dd2('0x1de'),_0x8dd2('0x90'),JSON[_0x8dd2('0x80')](_0x32d0c6)));});}}else{return _0x2f7e12(msgResponse('[getDataPredictive]',_0x8dd2('0x90'),'check\x20failure'));}});};};Dialer[_0x8dd2('0x81')][_0x8dd2('0x1d3')]=function(_0x4d807){var _0x35f9bb=this;return function(){var _0x59bc72=0x0;var _0x2cbe6d=Math[_0x8dd2('0x1c2')](_0x4d807[_0x8dd2('0x58')]*0x3e8);if(_0x2cbe6d>0x0){_0x2cbe6d=_0x2cbe6d<0x64?0x64:_0x2cbe6d;loggerPredictive[_0x8dd2('0x46')](_0x4d807[_0x8dd2('0x43')],_0x8dd2('0x1e2'),_0x2cbe6d,_0x8dd2('0x1e3'));_0x4d807['handlePredictive']=setInterval(function(){_0x35f9bb[_0x8dd2('0x61')](_0x4d807);loggerPredictiveCalls[_0x8dd2('0x46')](_0x8dd2('0x1e4'),_0x59bc72+=0x1);},_0x2cbe6d);}else{loggerPredictive[_0x8dd2('0x46')](_0x4d807['name'],_0x8dd2('0x1e5'));}};};Dialer[_0x8dd2('0x81')][_0x8dd2('0x1e6')]=function(_0x55c309,_0x36caf4){var _0x4eb17b=this;return function(_0x5a6993){if(_[_0x8dd2('0x45')](_0x5a6993)){if(_['isNil'](_0x36caf4[_0x8dd2('0x1e7')])||!_0x36caf4[_0x8dd2('0x1e8')]){if(_0x55c309['dialMethod']==='booked'){_0x55c309['queueStatusComplete']=_[_0x8dd2('0x3c')](_0x55c309[_0x8dd2('0x6e')])?!![]:_0x55c309[_0x8dd2('0x6e')];var _0x4b422d=uuid['v4']();_0x4eb17b[_0x8dd2('0xeb')][_0x4b422d]=new Action(_0x55c309,_0x36caf4,_0x4b422d);loggerBooked[_0x8dd2('0x46')](_0x8dd2('0x1e9'),_0x4b422d,_0x8dd2('0x1ea'),JSON[_0x8dd2('0x80')](_0x55c309[_0x8dd2('0x6e')]),_0x8dd2('0x1eb'),_0x55c309[_0x8dd2('0x43')]);if(_0x55c309[_0x8dd2('0x6e')]){_0x55c309[_0x8dd2('0x6e')]=![];_0x4eb17b[_0x8dd2('0x27')][_0x4eb17b[_0x8dd2('0xeb')][_0x4b422d]['queue']]=[];ami[_0x8dd2('0x94')]({'actionid':_0x4b422d,'action':_0x8dd2('0x1ec'),'queue':_0x55c309[_0x8dd2('0x43')]})[_0x8dd2('0x9b')](function(){utils[_0x8dd2('0xb9')](_0x55c309,'[checkContactBlack]');hopperUtils[_0x8dd2('0xf9')]({'active':![],'ContactId':_0x4eb17b[_0x8dd2('0xeb')][_0x4b422d][_0x8dd2('0xd8')],'ListId':_0x4eb17b['actions'][_0x4b422d][_0x8dd2('0xd9')],'VoiceQueueId':_0x4eb17b[_0x8dd2('0xeb')][_0x4b422d]['VoiceQueueId']||undefined,'CampaignId':_0x4eb17b[_0x8dd2('0xeb')][_0x4b422d][_0x8dd2('0xdb')]||undefined})[_0x8dd2('0x9b')](loggerCatch(_0x8dd2('0x1ed')));delete _0x4eb17b['actions'][_0x4b422d];});}else{loggerBooked[_0x8dd2('0x46')]('[booked][checkContactBlack][else]',JSON[_0x8dd2('0x80')](_0x55c309[_0x8dd2('0x6e')]),'Queue:\x20',_0x55c309[_0x8dd2('0x43')]);utils[_0x8dd2('0xb9')](_0x55c309,_0x8dd2('0x1ee'));hopperUtils['rescheduleContact']({'active':![],'ContactId':_0x4eb17b[_0x8dd2('0xeb')][_0x4b422d][_0x8dd2('0xd8')],'ListId':_0x4eb17b[_0x8dd2('0xeb')][_0x4b422d]['ListId'],'VoiceQueueId':_0x4eb17b[_0x8dd2('0xeb')][_0x4b422d][_0x8dd2('0xda')]||undefined,'CampaignId':_0x4eb17b['actions'][_0x4b422d][_0x8dd2('0xdb')]||undefined})[_0x8dd2('0x9b')](loggerCatch(_0x8dd2('0x1ed')));delete _0x4eb17b[_0x8dd2('0xeb')][_0x4b422d];}}else{return _0x4eb17b['actionOriginate'](_0x55c309,_0x36caf4);}}else{if(utils[_0x8dd2('0x5e')](undefined,_0x36caf4[_0x8dd2('0x1ef')])<_0x55c309[_0x8dd2('0x1f0')]*0x3c){if(_0x36caf4[_0x8dd2('0x148')]&&!_0x36caf4[_0x8dd2('0x148')][_0x8dd2('0x1f1')]){_0x4eb17b[_0x8dd2('0x1f2')][_0x8dd2('0xf6')](_0x36caf4['id'])[_0x8dd2('0x1b')](function(){utils[_0x8dd2('0xb9')](_0x55c309,'[checkContactBlack]');});}else{hopperUtils['unlockContact']({'active':![]},_0x36caf4['id'],0x1)[_0x8dd2('0x1b')](function(){utils[_0x8dd2('0xb9')](_0x55c309,_0x8dd2('0x1ee'));});}}else{_0x55c309[_0x8dd2('0x1f3')]+=0x1;utils[_0x8dd2('0xb9')](_0x55c309,'[checkContactBlack]');if(_0x55c309[_0x8dd2('0x1f4')]){hopperUtils['rescheduleContact']({'active':![],'recallme':![],'UserId':null,'ContactId':_0x36caf4[_0x8dd2('0xd8')],'ListId':_0x36caf4[_0x8dd2('0xd9')],'VoiceQueueId':_0x36caf4[_0x8dd2('0xda')]||undefined,'CampaignId':_0x36caf4[_0x8dd2('0xdb')]||undefined})[_0x8dd2('0x9b')](loggerCatch('[rescheduleContact][dialRecallInQueue]'));hopperUtils[_0x8dd2('0xc1')](createObjHistory(_0x55c309,_0x36caf4,utils['CAMPAIGN_STATUS']['QUEUE_RECALL'],0x17,_0x8dd2('0x1f5')))['catch'](loggerCatch(_0x8dd2('0x1f6')));}else{_0x4eb17b[_0x8dd2('0x113')](createObjHistory(_0x55c309,_0x36caf4,utils[_0x8dd2('0x69')][_0x8dd2('0x1f7')],0x16,_0x8dd2('0x1f8')),'[Originate][HistoryRecallClose][historyCatch]',_0x8dd2('0x1f9'));}}}}else{_0x55c309[_0x8dd2('0x1fa')]+=0x1;_0x4eb17b[_0x8dd2('0x113')](createObjHistory(_0x55c309,_0x36caf4,utils[_0x8dd2('0x69')][_0x8dd2('0x1fb')],0xd,_0x8dd2('0x1fc')),_0x8dd2('0x1fd'),_0x8dd2('0x1fe'));throw _0x8dd2('0x1ff');}};};Dialer[_0x8dd2('0x81')][_0x8dd2('0x157')]=function(_0x55a3a5){var _0x34c7ef=this;var _0x58f884=_0x55a3a5[_0x8dd2('0x200')]-_0x55a3a5[_0x8dd2('0x7a')];emitCampaignSummary(_0x55a3a5);if(_0x58f884>0x0&&_0x55a3a5[_0x8dd2('0x201')]==0x0){if(_0x58f884>this[_0x8dd2('0x21')]){_0x58f884=this[_0x8dd2('0x21')];}_0x55a3a5[_0x8dd2('0x201')]=0x1;hopperUtils[_0x8dd2('0x202')](_0x55a3a5,_0x58f884)[_0x8dd2('0x3b')](function(_0x5e23d5){_0x55a3a5[_0x8dd2('0x201')]=0x0;if(_0x5e23d5){if(!utils['checkContactEmpty'](_0x5e23d5)){_0x55a3a5[_0x8dd2('0x68')]=utils[_0x8dd2('0x69')][_0x8dd2('0x6a')];logger[_0x8dd2('0x46')](_0x8dd2('0x203')+_0x55a3a5['name']);}else{_0x55a3a5[_0x8dd2('0x7a')]+=_0x5e23d5[_0x8dd2('0x92')];_0x55a3a5[_0x8dd2('0x68')]=utils['CAMPAIGN_STATUS'][_0x8dd2('0x204')];for(var _0xe6d755=0x0;_0xe6d755<_0x5e23d5[_0x8dd2('0x92')];_0xe6d755+=0x1){_0x55a3a5['ivrTotalCallsDays']+=0x1;if(_[_0x8dd2('0xf1')](_0x5e23d5[_0xe6d755])||_[_0x8dd2('0xf1')](_0x5e23d5[_0xe6d755][_0x8dd2('0x174')])||_[_0x8dd2('0xf1')](_0x5e23d5[_0xe6d755][_0x8dd2('0x15b')])){_0x34c7ef[_0x8dd2('0x154')](_0x8dd2('0x205'),_0x55a3a5,_0x5e23d5[_0xe6d755]);}else{hopperUtils[_0x8dd2('0x206')](_['pick'](_0x5e23d5[_0xe6d755],['CampaignId','phone']))[_0x8dd2('0x3b')](_0x34c7ef[_0x8dd2('0x1e6')](_0x55a3a5,_0x5e23d5[_0xe6d755]))[_0x8dd2('0x9b')](function(_0x274049){logger[_0x8dd2('0x62')](_0x8dd2('0x207'),_0x274049);utils[_0x8dd2('0xb9')](_0x55a3a5,_0x8dd2('0x208'));});}}}}})[_0x8dd2('0x9b')](function(_0x26ee80){_0x55a3a5[_0x8dd2('0x201')]=0x0;logger[_0x8dd2('0x62')](_0x8dd2('0x209'),_0x26ee80);});}};Dialer[_0x8dd2('0x81')][_0x8dd2('0xab')]=function(_0x59a768,_0x347a64){var _0x13cc05=this;var _0x33763d=[];if(_0x347a64<0x1||_0x59a768[_0x8dd2('0xa8')]===_0x8dd2('0x20a')){_0x347a64=0x1;}var _0x5c1a62=Math['floor'](_0x59a768[_0x8dd2('0x1c1')]*_0x347a64)-_0x59a768[_0x8dd2('0x7a')];if(_0x59a768['dialLimitQueue']>0x0){var _0x4a023b=_0x59a768['dialLimitQueue']-_0x59a768[_0x8dd2('0x7a')]-_0x59a768[_0x8dd2('0x13c')]-_0x59a768['pTalking'];if(_0x5c1a62>_0x4a023b){_0x5c1a62=_0x4a023b;}}if(_0x5c1a62>0x0&&_0x59a768['temp']==0x0){if(_0x59a768[_0x8dd2('0xa8')]===_0x8dd2('0x20a')){_0x5c1a62=0x1;}if(_0x5c1a62>this[_0x8dd2('0x21')]){_0x5c1a62=this[_0x8dd2('0x21')];}for(var _0x5e65af in this['agents']){if(typeof this['agents'][_0x5e65af]!==_0x8dd2('0x14e')){if(this[_0x8dd2('0x1f')][_0x5e65af][_0x8dd2('0xcc')]===_0x8dd2('0x20b')&&this[_0x8dd2('0x1f')][_0x5e65af][_0x8dd2('0x86')]===_0x8dd2('0x85')){_0x33763d[_0x8dd2('0x93')](this['agents'][_0x5e65af]['id']);}}}_0x59a768['temp']=0x1;hopperUtils[_0x8dd2('0x20c')](_0x59a768,_0x33763d,_0x5c1a62)[_0x8dd2('0x3b')](function(_0x1da46f){_0x59a768[_0x8dd2('0x201')]=0x0;if(_0x1da46f){if(!utils[_0x8dd2('0x20d')](_0x1da46f)){hopperUtils[_0x8dd2('0x20e')](_0x59a768)[_0x8dd2('0x3b')](sendMessageReschedule(_0x59a768))[_0x8dd2('0x9b')](loggerCatch(_0x8dd2('0x20f')));}else{_0x59a768[_0x8dd2('0x7a')]+=_0x1da46f['length'];_0x59a768[_0x8dd2('0x68')]=_0x59a768[_0x8dd2('0xa8')]===_0x8dd2('0x20a')?utils['CAMPAIGN_STATUS'][_0x8dd2('0x162')]:utils['CAMPAIGN_STATUS'][_0x8dd2('0x204')];for(var _0xe583bb=0x0;_0xe583bb<_0x1da46f[_0x8dd2('0x92')];_0xe583bb+=0x1){if(_[_0x8dd2('0xf1')](_0x1da46f[_0xe583bb])||_['isNil'](_0x1da46f[_0xe583bb][_0x8dd2('0x174')])||_[_0x8dd2('0xf1')](_0x1da46f[_0xe583bb]['phone'])){_0x13cc05[_0x8dd2('0x154')](_0x8dd2('0x205'),_0x59a768,_0x1da46f[_0xe583bb]);}else{hopperUtils[_0x8dd2('0x210')](_[_0x8dd2('0x70')](_0x1da46f[_0xe583bb],[_0x8dd2('0xda'),'phone']))[_0x8dd2('0x3b')](_0x13cc05[_0x8dd2('0x1e6')](_0x59a768,_0x1da46f[_0xe583bb]))['catch'](function(_0x242044){logger[_0x8dd2('0x62')](_0x8dd2('0x211'),_0x242044);utils[_0x8dd2('0xb9')](_0x59a768,_0x8dd2('0x212'));});}}}}})[_0x8dd2('0x9b')](function(_0x13e89c){_0x59a768[_0x8dd2('0x201')]=0x0;logger[_0x8dd2('0x62')](_0x8dd2('0x209'),_0x13e89c);});}};Dialer[_0x8dd2('0x81')][_0x8dd2('0x61')]=function(_0x37e321){if(_0x37e321[_0x8dd2('0x213')]>0x0){var _0x30df55=_0x37e321[_0x8dd2('0x213')]-_0x37e321['originated']-_0x37e321[_0x8dd2('0x13c')];if(_0x30df55>0x0&&_0x37e321[_0x8dd2('0x201')]==0x0){this[_0x8dd2('0x214')](_0x37e321);}else{loggerPredictiveCalls['info'](_0x8dd2('0x215'));}}else{this['tryOriginatePredictive'](_0x37e321);}};Dialer['prototype'][_0x8dd2('0x214')]=function(_0x463fe2){var _0x305ce6=this;var _0x252c87=[];_0x463fe2['originated']+=0x1;for(var _0x3cda77 in this[_0x8dd2('0x1f')]){if(typeof this[_0x8dd2('0x1f')][_0x3cda77]!=='undefined'){if(this[_0x8dd2('0x1f')][_0x3cda77][_0x8dd2('0xcc')]===_0x8dd2('0x20b')&&this[_0x8dd2('0x1f')][_0x3cda77][_0x8dd2('0x86')]===_0x8dd2('0x85')){_0x252c87[_0x8dd2('0x93')](this['agents'][_0x3cda77]['id']);}}}_0x463fe2[_0x8dd2('0x201')]=0x1;return this[_0x8dd2('0x20c')](_0x463fe2['id'],_0x252c87,0x1,_0x463fe2[_0x8dd2('0x216')],_0x463fe2)[_0x8dd2('0x3b')](function(_0x32d3ad){_0x463fe2[_0x8dd2('0x201')]=0x1;if(_0x32d3ad){if(!utils[_0x8dd2('0x20d')](_0x32d3ad)){utils['checkContactLowerLimitOriginate'](_0x463fe2,0x1,0x0);return hopperUtils[_0x8dd2('0x20e')](_0x463fe2)['then'](sendMessageReschedule(_0x463fe2))[_0x8dd2('0x9b')](loggerCatch('[countReScheduled]\x20'));}else{_0x463fe2[_0x8dd2('0x68')]=utils[_0x8dd2('0x69')][_0x8dd2('0x204')];if(_['isNil'](_0x32d3ad[0x0])||_[_0x8dd2('0xf1')](_0x32d3ad[0x0][_0x8dd2('0x174')])||_['isNil'](_0x32d3ad[0x0]['phone'])){_0x305ce6[_0x8dd2('0x154')](_0x8dd2('0x205'),_0x463fe2,_0x32d3ad[0x0]);}else{return hopperUtils[_0x8dd2('0x210')](_[_0x8dd2('0x70')](_0x32d3ad[0x0],['VoiceQueueId',_0x8dd2('0x15b')]))[_0x8dd2('0x3b')](_0x305ce6[_0x8dd2('0x1e6')](_0x463fe2,_0x32d3ad[0x0]))[_0x8dd2('0x9b')](function(_0x38524e){logger['error'](_0x8dd2('0x217'),_0x38524e);utils[_0x8dd2('0xb9')](_0x463fe2,'[actionOriginatePredictive]');});}}}})[_0x8dd2('0x9b')](function(_0x764fc2){_0x463fe2['temp']=0x0;logger[_0x8dd2('0x62')](_0x8dd2('0x209'),_0x764fc2);});};Dialer['prototype'][_0x8dd2('0x1dd')]=function(_0x24f291,_0x121288,_0x87f42,_0x321442,_0x4ef99d,_0x44e223){loggerPredictive[_0x8dd2('0x46')](_0x8dd2('0x218'));loggerPredictive[_0x8dd2('0x46')]('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',_0x24f291);loggerPredictive[_0x8dd2('0x46')](_0x8dd2('0x219'),_0x121288);loggerPredictive[_0x8dd2('0x46')](_0x8dd2('0x21a'),_0x87f42);loggerPredictive[_0x8dd2('0x46')](_0x8dd2('0x21b'),_0x321442);loggerPredictive[_0x8dd2('0x46')]('Amax:\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20',_0x4ef99d);loggerPredictive[_0x8dd2('0x46')](_0x8dd2('0x50'));return new Promise(function(_0x502f9f,_0x9d6e24){if(_0x24f291<=0x0||isNaN(_0x24f291)){return _0x9d6e24(msgResponse(_0x8dd2('0x21c'),'Error',_0x8dd2('0x21d')+_0x24f291));}if(_0x87f42<=0x0||isNaN(_0x87f42)){return _0x9d6e24(msgResponse(_0x8dd2('0x21c'),_0x8dd2('0x18a'),'Ts\x20=\x20'+_0x87f42));}if(_0x321442<=0x0||isNaN(_0x321442)){return _0x9d6e24(msgResponse(_0x8dd2('0x21c'),_0x8dd2('0x18a'),_0x8dd2('0x21e')+_0x321442));}if(_0x121288<=0x0||isNaN(_0x121288)){return _0x9d6e24(msgResponse(_0x8dd2('0x21c'),_0x8dd2('0x18a'),_0x8dd2('0x21f')+_0x121288));}if(_0x4ef99d<=0x0||isNaN(_0x4ef99d)){return _0x9d6e24(msgResponse(_0x8dd2('0x21c'),_0x8dd2('0x18a'),'Amax\x20=\x20'+_0x4ef99d));}_0x44e223=_0x44e223||0x0;var _0x5d67ca=0x1/_0x87f42;var _0x4d3e20=0x0;var _0x5ba608=0x0;var _0x55f5eb=0x0;var _0x3cebf7=0x0;for(var _0x4ae61a=0x0;_0x55f5eb<_0x4ef99d;_0x4ae61a+=0x1){_0x5ba608=_0x4ae61a/_0x121288;_0x4d3e20=(_0x321442*_0x5ba608+_0x44e223)/_0x5d67ca;_0x55f5eb=utils[_0x8dd2('0x220')](_0x4d3e20,_0x24f291);_0x3cebf7=_0x4d3e20/_0x24f291*(0x1-utils[_0x8dd2('0x220')](_0x4d3e20,_0x24f291));}return _0x502f9f({'erlangCalls':_0x4ae61a,'erlangCallToSecond':_0x121288/_0x4ae61a,'erlangAbandonmentRate':_0x55f5eb,'erlangBusyFactor':_0x3cebf7});});};Dialer['prototype'][_0x8dd2('0x1e1')]=function(_0x23e519,_0x3d402c,_0x72b513,_0x3d2430,_0x2497c6,_0x4d3b3b){loggerPredictive[_0x8dd2('0x46')]('----\x20Agent\x20Busy\x20Factor\x20----');loggerPredictive[_0x8dd2('0x46')](_0x8dd2('0x221'),_0x23e519);loggerPredictive[_0x8dd2('0x46')](_0x8dd2('0x219'),_0x3d402c);loggerPredictive[_0x8dd2('0x46')](_0x8dd2('0x21a'),_0x72b513);loggerPredictive['info'](_0x8dd2('0x21b'),_0x3d2430);loggerPredictive['info'](_0x8dd2('0x222'),_0x2497c6);loggerPredictive['info'](_0x8dd2('0x50'));return new Promise(function(_0xa4b6d5,_0x5b85dd){if(_0x23e519<=0x0||isNaN(_0x23e519)){return _0x5b85dd(msgResponse(_0x8dd2('0x223'),'Error',_0x8dd2('0x21d')+_0x23e519));}if(_0x72b513<=0x0||isNaN(_0x72b513)){return _0x5b85dd(msgResponse('[busyFactor]',_0x8dd2('0x18a'),'Ts\x20=\x20'+_0x72b513));}if(_0x3d2430<=0x0||isNaN(_0x3d2430)){return _0x5b85dd(msgResponse(_0x8dd2('0x223'),'Error',_0x8dd2('0x21e')+_0x3d2430));}if(_0x3d402c<=0x0||isNaN(_0x3d402c)){return _0x5b85dd(msgResponse(_0x8dd2('0x223'),_0x8dd2('0x18a'),_0x8dd2('0x21f')+_0x3d402c));}if(_0x2497c6<=0x0||isNaN(_0x2497c6)){return _0x5b85dd(msgResponse(_0x8dd2('0x223'),_0x8dd2('0x18a'),'Umin\x20=\x20'+_0x2497c6));}_0x4d3b3b=_0x4d3b3b||0x0;var _0x3cbcb3=0x1/_0x72b513;var _0x5a525a=0x0;var _0x3412a7=0x0;var _0x1b8682=0x0;var _0x3c850a=0x0;for(var _0x5e7f50=0x0;_0x3c850a<_0x2497c6;_0x5e7f50+=0x1){_0x3412a7=_0x5e7f50/_0x3d402c;_0x5a525a=(_0x3d2430*_0x3412a7+_0x4d3b3b)/_0x3cbcb3;_0x1b8682=utils[_0x8dd2('0x220')](_0x5a525a,_0x23e519);_0x3c850a=_0x5a525a/_0x23e519*(0x1-utils[_0x8dd2('0x220')](_0x5a525a,_0x23e519));}return _0xa4b6d5({'erlangCalls':_0x5e7f50,'erlangCallToSecond':_0x3d402c/_0x5e7f50,'erlangAbandonmentRate':_0x1b8682,'erlangBusyFactor':_0x3c850a});});};module[_0x8dd2('0x224')]=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 0add37c..82d4eec 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 _0x99da=['util','lodash','moment','isNil','string','voiceQueue','name','Contact','phone','number','queue','type','dialQueueTimeout','scheduledat','countbusyretry','countcongestionretry','countnoanswerretry','countnosuchnumberretry','countdropretry','countabandonedretry','countmachineretry','countagentrejectretry','ContactId','ListId','UserId','VoiceQueueId','CampaignId','ContactFirstName','firstName','format','YYYY-MM-DD\x20HH:mm:ss','callback','callbackuniqueid','recallme','originatecalleridnum','originatecalleridname','prototype','getCaller','\x22%s\x22\x20<%s>','dialCutDigit','substring','getQueue','exports'];(function(_0x3dd15e,_0x1f0015){var _0x231fd0=function(_0x4f680a){while(--_0x4f680a){_0x3dd15e['push'](_0x3dd15e['shift']());}};_0x231fd0(++_0x1f0015);}(_0x99da,0x81));var _0xa99d=function(_0x36eb7f,_0x57dca4){_0x36eb7f=_0x36eb7f-0x0;var _0x50023b=_0x99da[_0x36eb7f];return _0x50023b;};'use strict';var util=require(_0xa99d('0x0'));var _=require(_0xa99d('0x1'));var moment=require(_0xa99d('0x2'));function checkNameSurname(_0x430cba,_0x26854d,_0x3f2072){var _0x1b0e6c='';if(!_[_0xa99d('0x3')](_0x26854d)&&'string'===typeof _0x26854d){_0x1b0e6c+=_0x26854d;}if(!_[_0xa99d('0x3')](_0x3f2072)&&_0xa99d('0x4')===typeof _0x3f2072){_0x1b0e6c+='\x20'+_0x3f2072;}if(_0x1b0e6c!==''){return _0x1b0e6c;}return _0x430cba;}function Action(_0x2289f9,_0x49f834,_0x2d6883){this[_0xa99d('0x5')]=_0x2289f9;this['uniqueid']=_0x2d6883||undefined;this[_0xa99d('0x6')]=checkNameSurname(_0x49f834[_0xa99d('0x7')][_0xa99d('0x8')],_0x49f834[_0xa99d('0x7')]['firstName'],_0x49f834['Contact']['lastName']);this[_0xa99d('0x9')]=_0x49f834[_0xa99d('0x8')];this[_0xa99d('0xa')]=_0x2289f9['name'];this['active']=_0x49f834['active']||![];this['type']=_0x2289f9[_0xa99d('0xb')];this[_0xa99d('0xc')]=_0x2289f9[_0xa99d('0xc')]||0x3;this['scheduledat']=_0x49f834[_0xa99d('0xd')];this[_0xa99d('0xe')]=_0x49f834[_0xa99d('0xe')];this[_0xa99d('0xf')]=_0x49f834[_0xa99d('0xf')];this[_0xa99d('0x10')]=_0x49f834[_0xa99d('0x10')];this[_0xa99d('0x11')]=_0x49f834['countnosuchnumberretry'];this['countdropretry']=_0x49f834[_0xa99d('0x12')];this[_0xa99d('0x13')]=_0x49f834[_0xa99d('0x13')];this['countmachineretry']=_0x49f834[_0xa99d('0x14')];this[_0xa99d('0x15')]=_0x49f834[_0xa99d('0x15')];this['ContactId']=_0x49f834[_0xa99d('0x16')];this[_0xa99d('0x17')]=_0x49f834['ListId'];this['UserId']=_0x49f834[_0xa99d('0x18')];this[_0xa99d('0x19')]=_0x49f834['VoiceQueueId'];this['CampaignId']=_0x49f834[_0xa99d('0x1a')];this['idHopper']=_0x49f834['id'];this[_0xa99d('0x1b')]=_0x49f834[_0xa99d('0x7')][_0xa99d('0x1c')]||'';this['starttime']=moment()[_0xa99d('0x1d')](_0xa99d('0x1e'));this[_0xa99d('0x1f')]=_0x49f834[_0xa99d('0x1f')];this[_0xa99d('0x20')]=_0x49f834[_0xa99d('0x20')];this['callbackat']=_0x49f834['callbackat'];this[_0xa99d('0x21')]=_0x49f834[_0xa99d('0x21')];this[_0xa99d('0x22')]='';this[_0xa99d('0x23')]='';}Action[_0xa99d('0x24')][_0xa99d('0x25')]=function(){return util[_0xa99d('0x1d')](_0xa99d('0x26'),this[_0xa99d('0x6')],this[_0xa99d('0x5')][_0xa99d('0x27')]>0x0?this[_0xa99d('0x9')][_0xa99d('0x28')](this[_0xa99d('0x5')][_0xa99d('0x27')]):this[_0xa99d('0x9')]);};Action[_0xa99d('0x24')][_0xa99d('0x29')]=function(){return this[_0xa99d('0xa')];};module[_0xa99d('0x2a')]=Action; \ No newline at end of file +var _0x00eb=['exports','util','lodash','moment','isNil','string','voiceQueue','uniqueid','name','Contact','phone','firstName','lastName','number','queue','active','type','dialQueueTimeout','scheduledat','countcongestionretry','countnoanswerretry','countdropretry','countabandonedretry','countmachineretry','countagentrejectretry','ContactId','ListId','UserId','VoiceQueueId','CampaignId','idHopper','ContactFirstName','starttime','format','YYYY-MM-DD\x20HH:mm:ss','callback','callbackat','recallme','originatecalleridname','prototype','getCaller','\x22%s\x22\x20<%s>','dialCutDigit'];(function(_0x11a3a9,_0x2ca0a4){var _0x138011=function(_0x4247b3){while(--_0x4247b3){_0x11a3a9['push'](_0x11a3a9['shift']());}};_0x138011(++_0x2ca0a4);}(_0x00eb,0x103));var _0xb00e=function(_0x4bed99,_0x341d9e){_0x4bed99=_0x4bed99-0x0;var _0x4ad38f=_0x00eb[_0x4bed99];return _0x4ad38f;};'use strict';var util=require(_0xb00e('0x0'));var _=require(_0xb00e('0x1'));var moment=require(_0xb00e('0x2'));function checkNameSurname(_0x23cc82,_0x28f25f,_0xf291d8){var _0x1b2262='';if(!_[_0xb00e('0x3')](_0x28f25f)&&_0xb00e('0x4')===typeof _0x28f25f){_0x1b2262+=_0x28f25f;}if(!_['isNil'](_0xf291d8)&&'string'===typeof _0xf291d8){_0x1b2262+='\x20'+_0xf291d8;}if(_0x1b2262!==''){return _0x1b2262;}return _0x23cc82;}function Action(_0xdc9423,_0x242879,_0x4d9214){this[_0xb00e('0x5')]=_0xdc9423;this[_0xb00e('0x6')]=_0x4d9214||undefined;this[_0xb00e('0x7')]=checkNameSurname(_0x242879[_0xb00e('0x8')][_0xb00e('0x9')],_0x242879[_0xb00e('0x8')][_0xb00e('0xa')],_0x242879['Contact'][_0xb00e('0xb')]);this[_0xb00e('0xc')]=_0x242879['phone'];this[_0xb00e('0xd')]=_0xdc9423[_0xb00e('0x7')];this[_0xb00e('0xe')]=_0x242879[_0xb00e('0xe')]||![];this['type']=_0xdc9423[_0xb00e('0xf')];this['dialQueueTimeout']=_0xdc9423[_0xb00e('0x10')]||0x3;this[_0xb00e('0x11')]=_0x242879['scheduledat'];this['countbusyretry']=_0x242879['countbusyretry'];this[_0xb00e('0x12')]=_0x242879['countcongestionretry'];this[_0xb00e('0x13')]=_0x242879[_0xb00e('0x13')];this['countnosuchnumberretry']=_0x242879['countnosuchnumberretry'];this['countdropretry']=_0x242879[_0xb00e('0x14')];this['countabandonedretry']=_0x242879[_0xb00e('0x15')];this['countmachineretry']=_0x242879[_0xb00e('0x16')];this['countagentrejectretry']=_0x242879[_0xb00e('0x17')];this[_0xb00e('0x18')]=_0x242879[_0xb00e('0x18')];this[_0xb00e('0x19')]=_0x242879['ListId'];this[_0xb00e('0x1a')]=_0x242879[_0xb00e('0x1a')];this[_0xb00e('0x1b')]=_0x242879[_0xb00e('0x1b')];this[_0xb00e('0x1c')]=_0x242879['CampaignId'];this[_0xb00e('0x1d')]=_0x242879['id'];this[_0xb00e('0x1e')]=_0x242879[_0xb00e('0x8')][_0xb00e('0xa')]||'';this[_0xb00e('0x1f')]=moment()[_0xb00e('0x20')](_0xb00e('0x21'));this[_0xb00e('0x22')]=_0x242879[_0xb00e('0x22')];this['callbackuniqueid']=_0x242879['callbackuniqueid'];this[_0xb00e('0x23')]=_0x242879[_0xb00e('0x23')];this[_0xb00e('0x24')]=_0x242879['recallme'];this['originatecalleridnum']='';this[_0xb00e('0x25')]='';}Action[_0xb00e('0x26')][_0xb00e('0x27')]=function(){return util['format'](_0xb00e('0x28'),this[_0xb00e('0x7')],this[_0xb00e('0x5')]['dialCutDigit']>0x0?this['number']['substring'](this[_0xb00e('0x5')][_0xb00e('0x29')]):this['number']);};Action['prototype']['getQueue']=function(){return this['queue'];};module[_0xb00e('0x2a')]=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 ee981c6..bc2be10 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 _0x01f0=['../utils','state','statedesc','Answer','scheduledat','type','campaigntype','queue','countbusyretry','countcongestionretry','countnoanswerretry','countglobal','countnosuchnumberretry','countdropretry','countabandonedretry','countmachineretry','countagentrejectretry','uniqueid','calleridname','calleridnum','number','starttime','responsetime','answertime','format','ringtime','getSeconds','talktime','membername','reason','callback','callbackuniqueid','callbackat','recallme','ContactId','ListId','UserId','VoiceQueueId','CampaignId','originatecalleridnum','originatecalleridname','agiafterat','exports'];(function(_0x3dd15e,_0x1f0015){var _0x231fd0=function(_0x4f680a){while(--_0x4f680a){_0x3dd15e['push'](_0x3dd15e['shift']());}};_0x231fd0(++_0x1f0015);}(_0x01f0,0x158));var _0x001f=function(_0x2e51be,_0x5b8590){_0x2e51be=_0x2e51be-0x0;var _0x23542d=_0x01f0[_0x2e51be];return _0x23542d;};'use strict';var moment=require('moment');var utils=require(_0x001f('0x0'));function AgentComplete(_0x170daf,_0x22c20e){this[_0x001f('0x1')]=0x4;this[_0x001f('0x2')]=_0x001f('0x3');this['scheduledat']=_0x170daf[_0x001f('0x4')];this[_0x001f('0x5')]=_0x170daf['type'];this[_0x001f('0x6')]=_0x170daf['type']==='outbound'?_0x001f('0x7'):_0x170daf['type'];this[_0x001f('0x8')]=_0x170daf[_0x001f('0x8')];this[_0x001f('0x9')]=_0x170daf[_0x001f('0x9')];this['countnoanswerretry']=_0x170daf[_0x001f('0xa')];this[_0x001f('0xb')]=_0x170daf[_0x001f('0x8')]+_0x170daf[_0x001f('0x9')]+_0x170daf[_0x001f('0xa')]+_0x170daf[_0x001f('0xc')]+_0x170daf[_0x001f('0xd')]+_0x170daf[_0x001f('0xe')]+_0x170daf[_0x001f('0xf')]+_0x170daf[_0x001f('0x10')];this[_0x001f('0xc')]=_0x170daf[_0x001f('0xc')];this[_0x001f('0xd')]=_0x170daf[_0x001f('0xd')];this['countabandonedretry']=_0x170daf[_0x001f('0xe')];this[_0x001f('0xf')]=_0x170daf[_0x001f('0xf')];this[_0x001f('0x10')]=_0x170daf[_0x001f('0x10')];this[_0x001f('0x11')]=_0x22c20e['uniqueid'];this[_0x001f('0x12')]=_0x170daf['name'];this[_0x001f('0x13')]=_0x170daf[_0x001f('0x14')];this[_0x001f('0x15')]=_0x170daf[_0x001f('0x15')];this['responsetime']=_0x170daf[_0x001f('0x16')];this[_0x001f('0x17')]=_0x170daf['answertime'];this['endtime']=moment()[_0x001f('0x18')]('YYYY-MM-DD\x20HH:mm:ss');this[_0x001f('0x19')]=utils[_0x001f('0x1a')](_0x170daf[_0x001f('0x16')],_0x170daf[_0x001f('0x15')]);this['holdtime']=utils[_0x001f('0x1a')](_0x170daf[_0x001f('0x17')],_0x170daf[_0x001f('0x16')]);this[_0x001f('0x1b')]=utils[_0x001f('0x1a')](this['endtime'],_0x170daf[_0x001f('0x17')]);this['queue']=_0x22c20e[_0x001f('0x7')];this[_0x001f('0x1c')]=_0x22c20e[_0x001f('0x1c')];this[_0x001f('0x1d')]=_0x22c20e[_0x001f('0x1d')];this[_0x001f('0x1e')]=_0x170daf['callback'];this[_0x001f('0x1f')]=_0x170daf[_0x001f('0x1f')];this[_0x001f('0x20')]=_0x170daf[_0x001f('0x20')];this[_0x001f('0x21')]=_0x170daf[_0x001f('0x21')];this['ContactId']=_0x170daf[_0x001f('0x22')];this['ListId']=_0x170daf[_0x001f('0x23')];this[_0x001f('0x24')]=_0x170daf['UserId'];this[_0x001f('0x25')]=_0x170daf[_0x001f('0x25')];this[_0x001f('0x26')]=_0x170daf['CampaignId'];this[_0x001f('0x27')]=_0x170daf[_0x001f('0x27')]||'';this[_0x001f('0x28')]=_0x170daf[_0x001f('0x28')]||'';this[_0x001f('0x29')]=_0x170daf[_0x001f('0x29')];}module[_0x001f('0x2a')]=AgentComplete; \ No newline at end of file +var _0x962b=['reason','callback','callbackuniqueid','callbackat','ContactId','ListId','UserId','VoiceQueueId','CampaignId','originatecalleridnum','originatecalleridname','agiafterat','exports','Answer','scheduledat','type','outbound','countbusyretry','countcongestionretry','countnoanswerretry','countglobal','countdropretry','countabandonedretry','countmachineretry','countagentrejectretry','countnosuchnumberretry','uniqueid','calleridname','name','number','starttime','responsetime','endtime','format','YYYY-MM-DD\x20HH:mm:ss','ringtime','getSeconds','answertime','talktime','queue','membername'];(function(_0x25e7cb,_0x3579b7){var _0x375d92=function(_0xe8cf3b){while(--_0xe8cf3b){_0x25e7cb['push'](_0x25e7cb['shift']());}};_0x375d92(++_0x3579b7);}(_0x962b,0x12c));var _0xb962=function(_0x4b3d13,_0x3da236){_0x4b3d13=_0x4b3d13-0x0;var _0x278db6=_0x962b[_0x4b3d13];return _0x278db6;};'use strict';var moment=require('moment');var utils=require('../utils');function AgentComplete(_0x586d7d,_0x3754a3){this['state']=0x4;this['statedesc']=_0xb962('0x0');this['scheduledat']=_0x586d7d[_0xb962('0x1')];this[_0xb962('0x2')]=_0x586d7d[_0xb962('0x2')];this['campaigntype']=_0x586d7d['type']===_0xb962('0x3')?'queue':_0x586d7d[_0xb962('0x2')];this[_0xb962('0x4')]=_0x586d7d[_0xb962('0x4')];this[_0xb962('0x5')]=_0x586d7d[_0xb962('0x5')];this[_0xb962('0x6')]=_0x586d7d[_0xb962('0x6')];this[_0xb962('0x7')]=_0x586d7d[_0xb962('0x4')]+_0x586d7d[_0xb962('0x5')]+_0x586d7d[_0xb962('0x6')]+_0x586d7d['countnosuchnumberretry']+_0x586d7d[_0xb962('0x8')]+_0x586d7d[_0xb962('0x9')]+_0x586d7d[_0xb962('0xa')]+_0x586d7d[_0xb962('0xb')];this['countnosuchnumberretry']=_0x586d7d[_0xb962('0xc')];this[_0xb962('0x8')]=_0x586d7d['countdropretry'];this[_0xb962('0x9')]=_0x586d7d['countabandonedretry'];this[_0xb962('0xa')]=_0x586d7d[_0xb962('0xa')];this[_0xb962('0xb')]=_0x586d7d[_0xb962('0xb')];this[_0xb962('0xd')]=_0x3754a3[_0xb962('0xd')];this[_0xb962('0xe')]=_0x586d7d[_0xb962('0xf')];this['calleridnum']=_0x586d7d[_0xb962('0x10')];this['starttime']=_0x586d7d[_0xb962('0x11')];this[_0xb962('0x12')]=_0x586d7d['responsetime'];this['answertime']=_0x586d7d['answertime'];this[_0xb962('0x13')]=moment()[_0xb962('0x14')](_0xb962('0x15'));this[_0xb962('0x16')]=utils[_0xb962('0x17')](_0x586d7d[_0xb962('0x12')],_0x586d7d[_0xb962('0x11')]);this['holdtime']=utils[_0xb962('0x17')](_0x586d7d[_0xb962('0x18')],_0x586d7d[_0xb962('0x12')]);this[_0xb962('0x19')]=utils[_0xb962('0x17')](this[_0xb962('0x13')],_0x586d7d['answertime']);this['queue']=_0x3754a3[_0xb962('0x1a')];this[_0xb962('0x1b')]=_0x3754a3[_0xb962('0x1b')];this['reason']=_0x3754a3[_0xb962('0x1c')];this[_0xb962('0x1d')]=_0x586d7d[_0xb962('0x1d')];this[_0xb962('0x1e')]=_0x586d7d[_0xb962('0x1e')];this[_0xb962('0x1f')]=_0x586d7d[_0xb962('0x1f')];this['recallme']=_0x586d7d['recallme'];this[_0xb962('0x20')]=_0x586d7d[_0xb962('0x20')];this[_0xb962('0x21')]=_0x586d7d[_0xb962('0x21')];this[_0xb962('0x22')]=_0x586d7d[_0xb962('0x22')];this[_0xb962('0x23')]=_0x586d7d[_0xb962('0x23')];this[_0xb962('0x24')]=_0x586d7d[_0xb962('0x24')];this[_0xb962('0x25')]=_0x586d7d[_0xb962('0x25')]||'';this['originatecalleridname']=_0x586d7d[_0xb962('0x26')]||'';this[_0xb962('0x27')]=_0x586d7d[_0xb962('0x27')];}module[_0xb962('0x28')]=AgentComplete; \ No newline at end of file diff --git a/server/services/ami/dialer/models/final.js b/server/services/ami/dialer/models/final.js index f62e97d..ae6cc04 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 _0xcb8c=['type','queue','countbusyretry','countcongestionretry','countnoanswerretry','countglobal','countnosuchnumberretry','countabandonedretry','countmachineretry','countagentrejectretry','countdropretry','calleridname','calleridnum','starttime','responsetime','endtime','ringtime','holdtime','talktime','callback','callbackuniqueid','callbackat','recallme','ListId','UserId','VoiceQueueId','CampaignId','originatecalleridnum','originatecalleridname','state','statedesc','exports','uniqueid','scheduledat'];(function(_0x23ab29,_0x1f9249){var _0x1ce0a0=function(_0x3cf531){while(--_0x3cf531){_0x23ab29['push'](_0x23ab29['shift']());}};_0x1ce0a0(++_0x1f9249);}(_0xcb8c,0x64));var _0xccb8=function(_0x33c589,_0x418862){_0x33c589=_0x33c589-0x0;var _0x4fa17c=_0xcb8c[_0x33c589];return _0x4fa17c;};'use strict';function Final(_0x2e3f18){this[_0xccb8('0x0')]=_0x2e3f18[_0xccb8('0x0')];this[_0xccb8('0x1')]=_0x2e3f18[_0xccb8('0x1')];this[_0xccb8('0x2')]=_0x2e3f18[_0xccb8('0x2')];this['campaigntype']=_0x2e3f18['type']==='outbound'?_0xccb8('0x3'):_0x2e3f18[_0xccb8('0x2')];this[_0xccb8('0x4')]=_0x2e3f18[_0xccb8('0x4')];this[_0xccb8('0x5')]=_0x2e3f18['countcongestionretry'];this[_0xccb8('0x6')]=_0x2e3f18[_0xccb8('0x6')];this[_0xccb8('0x7')]=_0x2e3f18[_0xccb8('0x4')]+_0x2e3f18[_0xccb8('0x5')]+_0x2e3f18[_0xccb8('0x6')]+_0x2e3f18[_0xccb8('0x8')]+_0x2e3f18['countdropretry']+_0x2e3f18[_0xccb8('0x9')]+_0x2e3f18[_0xccb8('0xa')]+_0x2e3f18[_0xccb8('0xb')];this['countnosuchnumberretry']=_0x2e3f18[_0xccb8('0x8')];this[_0xccb8('0xc')]=_0x2e3f18[_0xccb8('0xc')];this[_0xccb8('0x9')]=_0x2e3f18[_0xccb8('0x9')];this[_0xccb8('0xa')]=_0x2e3f18[_0xccb8('0xa')];this[_0xccb8('0xb')]=_0x2e3f18[_0xccb8('0xb')];this['queue']=_0x2e3f18[_0xccb8('0x3')];this[_0xccb8('0xd')]=_0x2e3f18[_0xccb8('0xd')];this[_0xccb8('0xe')]=_0x2e3f18['calleridnum'];this[_0xccb8('0xf')]=_0x2e3f18[_0xccb8('0xf')];this[_0xccb8('0x10')]=_0x2e3f18[_0xccb8('0x10')];this[_0xccb8('0x11')]=_0x2e3f18['responsetime'];this[_0xccb8('0x12')]=_0x2e3f18[_0xccb8('0x12')]||0x0;this[_0xccb8('0x13')]=_0x2e3f18[_0xccb8('0x13')]||0x0;this[_0xccb8('0x14')]=_0x2e3f18[_0xccb8('0x14')]||0x0;this[_0xccb8('0x15')]=_0x2e3f18[_0xccb8('0x15')];this['callbackuniqueid']=_0x2e3f18[_0xccb8('0x16')];this[_0xccb8('0x17')]=_0x2e3f18[_0xccb8('0x17')];this[_0xccb8('0x18')]=_0x2e3f18[_0xccb8('0x18')];this['ContactId']=_0x2e3f18['ContactId'];this[_0xccb8('0x19')]=_0x2e3f18[_0xccb8('0x19')];this[_0xccb8('0x1a')]=_0x2e3f18[_0xccb8('0x1a')];this[_0xccb8('0x1b')]=_0x2e3f18[_0xccb8('0x1b')];this[_0xccb8('0x1c')]=_0x2e3f18[_0xccb8('0x1c')];this[_0xccb8('0x1d')]=_0x2e3f18[_0xccb8('0x1d')]||'';this[_0xccb8('0x1e')]=_0x2e3f18[_0xccb8('0x1e')]||'';this[_0xccb8('0x1f')]=_0x2e3f18[_0xccb8('0x1f')];this[_0xccb8('0x20')]=_0x2e3f18['statedesc'];}module[_0xccb8('0x21')]=Final; \ No newline at end of file +var _0x02b0=['campaigntype','outbound','queue','countbusyretry','countcongestionretry','countnoanswerretry','countglobal','countnosuchnumberretry','countdropretry','countabandonedretry','countmachineretry','countagentrejectretry','calleridname','calleridnum','starttime','responsetime','ringtime','holdtime','talktime','callback','callbackuniqueid','callbackat','recallme','ContactId','ListId','UserId','VoiceQueueId','CampaignId','originatecalleridnum','originatecalleridname','state','uniqueid','scheduledat','type'];(function(_0x558023,_0x1d46fe){var _0x59e328=function(_0x4a2a9a){while(--_0x4a2a9a){_0x558023['push'](_0x558023['shift']());}};_0x59e328(++_0x1d46fe);}(_0x02b0,0xc9));var _0x002b=function(_0x32c012,_0xe3c576){_0x32c012=_0x32c012-0x0;var _0x48562e=_0x02b0[_0x32c012];return _0x48562e;};'use strict';function Final(_0x12226d){this['uniqueid']=_0x12226d[_0x002b('0x0')];this[_0x002b('0x1')]=_0x12226d[_0x002b('0x1')];this[_0x002b('0x2')]=_0x12226d['type'];this[_0x002b('0x3')]=_0x12226d['type']===_0x002b('0x4')?_0x002b('0x5'):_0x12226d[_0x002b('0x2')];this['countbusyretry']=_0x12226d[_0x002b('0x6')];this['countcongestionretry']=_0x12226d[_0x002b('0x7')];this[_0x002b('0x8')]=_0x12226d[_0x002b('0x8')];this[_0x002b('0x9')]=_0x12226d['countbusyretry']+_0x12226d[_0x002b('0x7')]+_0x12226d[_0x002b('0x8')]+_0x12226d[_0x002b('0xa')]+_0x12226d[_0x002b('0xb')]+_0x12226d[_0x002b('0xc')]+_0x12226d[_0x002b('0xd')]+_0x12226d[_0x002b('0xe')];this['countnosuchnumberretry']=_0x12226d[_0x002b('0xa')];this['countdropretry']=_0x12226d['countdropretry'];this['countabandonedretry']=_0x12226d[_0x002b('0xc')];this['countmachineretry']=_0x12226d['countmachineretry'];this[_0x002b('0xe')]=_0x12226d['countagentrejectretry'];this[_0x002b('0x5')]=_0x12226d[_0x002b('0x5')];this[_0x002b('0xf')]=_0x12226d[_0x002b('0xf')];this['calleridnum']=_0x12226d[_0x002b('0x10')];this[_0x002b('0x11')]=_0x12226d[_0x002b('0x11')];this[_0x002b('0x12')]=_0x12226d['responsetime'];this['endtime']=_0x12226d[_0x002b('0x12')];this[_0x002b('0x13')]=_0x12226d[_0x002b('0x13')]||0x0;this['holdtime']=_0x12226d[_0x002b('0x14')]||0x0;this[_0x002b('0x15')]=_0x12226d[_0x002b('0x15')]||0x0;this[_0x002b('0x16')]=_0x12226d[_0x002b('0x16')];this[_0x002b('0x17')]=_0x12226d[_0x002b('0x17')];this[_0x002b('0x18')]=_0x12226d[_0x002b('0x18')];this[_0x002b('0x19')]=_0x12226d[_0x002b('0x19')];this[_0x002b('0x1a')]=_0x12226d[_0x002b('0x1a')];this[_0x002b('0x1b')]=_0x12226d[_0x002b('0x1b')];this[_0x002b('0x1c')]=_0x12226d[_0x002b('0x1c')];this[_0x002b('0x1d')]=_0x12226d[_0x002b('0x1d')];this[_0x002b('0x1e')]=_0x12226d['CampaignId'];this[_0x002b('0x1f')]=_0x12226d[_0x002b('0x1f')]||'';this['originatecalleridname']=_0x12226d[_0x002b('0x20')]||'';this[_0x002b('0x21')]=_0x12226d['state'];this['statedesc']=_0x12226d['statedesc'];}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 2e5147e..fe5ad5c 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 _0xa468=['scheduledat','campaigntype','type','outbound','queue','amd','countbusyretry','countcongestionretry','countnoanswerretry','countnosuchnumberretry','countabandonedretry','countmachineretry','countagentrejectretry','uniqueid','calleridname','name','calleridnum','number','starttime','responsetime','endtime','format','YYYY-MM-DD\x20HH:mm:ss','ringtime','getSeconds','holdtime','talktime','membername','IVR','cause-txt','callback','callbackuniqueid','recallme','ContactId','ListId','UserId','VoiceQueueId','CampaignId','exports','moment','../utils','state','statedesc'];(function(_0x18f52a,_0x43f385){var _0x3ef08b=function(_0x2c4c4e){while(--_0x2c4c4e){_0x18f52a['push'](_0x18f52a['shift']());}};_0x3ef08b(++_0x43f385);}(_0xa468,0x17f));var _0x8a46=function(_0x2dafbe,_0x5d04de){_0x2dafbe=_0x2dafbe-0x0;var _0x58a45a=_0xa468[_0x2dafbe];return _0x58a45a;};'use strict';var moment=require(_0x8a46('0x0'));var utils=require(_0x8a46('0x1'));function Hangup(_0x240562,_0x2bca41){this[_0x8a46('0x2')]=0x4;this[_0x8a46('0x3')]='Answer';this['scheduledat']=_0x240562[_0x8a46('0x4')];this['type']=_0x240562['type'];this[_0x8a46('0x5')]=_0x240562[_0x8a46('0x6')]===_0x8a46('0x7')?_0x8a46('0x8'):_0x240562[_0x8a46('0x6')];this['amd']=_0x240562[_0x8a46('0x9')]||![];this[_0x8a46('0xa')]=_0x240562[_0x8a46('0xa')];this['countcongestionretry']=_0x240562[_0x8a46('0xb')];this[_0x8a46('0xc')]=_0x240562[_0x8a46('0xc')];this['countglobal']=_0x240562[_0x8a46('0xa')]+_0x240562[_0x8a46('0xb')]+_0x240562['countnoanswerretry']+_0x240562[_0x8a46('0xd')]+_0x240562['countdropretry']+_0x240562[_0x8a46('0xe')]+_0x240562[_0x8a46('0xf')]+_0x240562[_0x8a46('0x10')];this[_0x8a46('0xd')]=_0x240562[_0x8a46('0xd')];this['countdropretry']=_0x240562['countdropretry'];this[_0x8a46('0xe')]=_0x240562[_0x8a46('0xe')];this[_0x8a46('0xf')]=_0x240562[_0x8a46('0xf')];this['countagentrejectretry']=_0x240562[_0x8a46('0x10')];this[_0x8a46('0x11')]=_0x2bca41[_0x8a46('0x11')];this[_0x8a46('0x12')]=_0x240562[_0x8a46('0x13')];this[_0x8a46('0x14')]=_0x240562[_0x8a46('0x15')];this[_0x8a46('0x16')]=_0x240562[_0x8a46('0x16')];this[_0x8a46('0x17')]=_0x240562['responsetime'];this[_0x8a46('0x18')]=moment()[_0x8a46('0x19')](_0x8a46('0x1a'));this[_0x8a46('0x1b')]=utils[_0x8a46('0x1c')](_0x240562['responsetime'],_0x240562[_0x8a46('0x16')]);this[_0x8a46('0x1d')]=0x0;this[_0x8a46('0x1e')]=utils['getSeconds'](this[_0x8a46('0x18')],_0x240562[_0x8a46('0x17')]);this['queue']=_0x240562[_0x8a46('0x8')];this[_0x8a46('0x1f')]=_0x8a46('0x20');this['reason']=_0x2bca41[_0x8a46('0x21')];this[_0x8a46('0x22')]=_0x240562[_0x8a46('0x22')];this[_0x8a46('0x23')]=_0x240562[_0x8a46('0x23')];this['callbackat']=_0x240562['callbackat'];this['recallme']=_0x240562[_0x8a46('0x24')];this[_0x8a46('0x25')]=_0x240562[_0x8a46('0x25')];this[_0x8a46('0x26')]=_0x240562['ListId'];this[_0x8a46('0x27')]=_0x240562[_0x8a46('0x27')];this[_0x8a46('0x28')]=_0x240562[_0x8a46('0x28')];this[_0x8a46('0x29')]=_0x240562[_0x8a46('0x29')];}module[_0x8a46('0x2a')]=Hangup; \ No newline at end of file +var _0x75a0=['ContactId','ListId','UserId','VoiceQueueId','CampaignId','exports','moment','../utils','state','statedesc','Answer','scheduledat','type','outbound','queue','amd','countbusyretry','countcongestionretry','countnoanswerretry','countnosuchnumberretry','countdropretry','countabandonedretry','countagentrejectretry','countmachineretry','uniqueid','calleridname','name','calleridnum','number','starttime','responsetime','endtime','format','YYYY-MM-DD\x20HH:mm:ss','ringtime','getSeconds','holdtime','talktime','IVR','reason','callback','callbackuniqueid','callbackat','recallme'];(function(_0x2889c0,_0x583c31){var _0x118837=function(_0x4e7fbb){while(--_0x4e7fbb){_0x2889c0['push'](_0x2889c0['shift']());}};_0x118837(++_0x583c31);}(_0x75a0,0x10e));var _0x075a=function(_0x528372,_0x1bc4c8){_0x528372=_0x528372-0x0;var _0x2e2c58=_0x75a0[_0x528372];return _0x2e2c58;};'use strict';var moment=require(_0x075a('0x0'));var utils=require(_0x075a('0x1'));function Hangup(_0x3aac4f,_0x2c9b43){this[_0x075a('0x2')]=0x4;this[_0x075a('0x3')]=_0x075a('0x4');this[_0x075a('0x5')]=_0x3aac4f[_0x075a('0x5')];this[_0x075a('0x6')]=_0x3aac4f['type'];this['campaigntype']=_0x3aac4f[_0x075a('0x6')]===_0x075a('0x7')?_0x075a('0x8'):_0x3aac4f['type'];this[_0x075a('0x9')]=_0x3aac4f['amd']||![];this[_0x075a('0xa')]=_0x3aac4f['countbusyretry'];this[_0x075a('0xb')]=_0x3aac4f[_0x075a('0xb')];this['countnoanswerretry']=_0x3aac4f['countnoanswerretry'];this['countglobal']=_0x3aac4f['countbusyretry']+_0x3aac4f[_0x075a('0xb')]+_0x3aac4f[_0x075a('0xc')]+_0x3aac4f[_0x075a('0xd')]+_0x3aac4f[_0x075a('0xe')]+_0x3aac4f[_0x075a('0xf')]+_0x3aac4f['countmachineretry']+_0x3aac4f[_0x075a('0x10')];this[_0x075a('0xd')]=_0x3aac4f[_0x075a('0xd')];this[_0x075a('0xe')]=_0x3aac4f['countdropretry'];this['countabandonedretry']=_0x3aac4f[_0x075a('0xf')];this[_0x075a('0x11')]=_0x3aac4f[_0x075a('0x11')];this[_0x075a('0x10')]=_0x3aac4f[_0x075a('0x10')];this[_0x075a('0x12')]=_0x2c9b43[_0x075a('0x12')];this[_0x075a('0x13')]=_0x3aac4f[_0x075a('0x14')];this[_0x075a('0x15')]=_0x3aac4f[_0x075a('0x16')];this[_0x075a('0x17')]=_0x3aac4f[_0x075a('0x17')];this[_0x075a('0x18')]=_0x3aac4f['responsetime'];this[_0x075a('0x19')]=moment()[_0x075a('0x1a')](_0x075a('0x1b'));this[_0x075a('0x1c')]=utils[_0x075a('0x1d')](_0x3aac4f[_0x075a('0x18')],_0x3aac4f[_0x075a('0x17')]);this[_0x075a('0x1e')]=0x0;this[_0x075a('0x1f')]=utils[_0x075a('0x1d')](this[_0x075a('0x19')],_0x3aac4f[_0x075a('0x18')]);this[_0x075a('0x8')]=_0x3aac4f[_0x075a('0x8')];this['membername']=_0x075a('0x20');this[_0x075a('0x21')]=_0x2c9b43['cause-txt'];this[_0x075a('0x22')]=_0x3aac4f['callback'];this[_0x075a('0x23')]=_0x3aac4f['callbackuniqueid'];this[_0x075a('0x24')]=_0x3aac4f['callbackat'];this[_0x075a('0x25')]=_0x3aac4f[_0x075a('0x25')];this[_0x075a('0x26')]=_0x3aac4f[_0x075a('0x26')];this[_0x075a('0x27')]=_0x3aac4f[_0x075a('0x27')];this[_0x075a('0x28')]=_0x3aac4f[_0x075a('0x28')];this[_0x075a('0x29')]=_0x3aac4f[_0x075a('0x29')];this['CampaignId']=_0x3aac4f[_0x075a('0x2a')];}module[_0x075a('0x2b')]=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 2cb13a0..262f0bd 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 _0x55e5=['responsetime','endtime','ringtime','holdtime','talktime','callback','callbackuniqueid','callbackat','recallme','ContactId','ListId','UserId','VoiceQueueId','originatecalleridnum','originatecalleridname','state','statedesc','exports','../utils','uniqueid','scheduledat','type','campaigntype','countbusyretry','countcongestionretry','countnoanswerretry','countglobal','countnosuchnumberretry','countdropretry','countabandonedretry','countmachineretry','countagentrejectretry','calleridname','calleridnum','number','starttime'];(function(_0x3b71fc,_0x214d48){var _0x5ee9cf=function(_0x323185){while(--_0x323185){_0x3b71fc['push'](_0x3b71fc['shift']());}};_0x5ee9cf(++_0x214d48);}(_0x55e5,0xa2));var _0x555e=function(_0x30f45a,_0x3502b2){_0x30f45a=_0x30f45a-0x0;var _0x9998d9=_0x55e5[_0x30f45a];return _0x9998d9;};'use strict';var utils=require(_0x555e('0x0'));function History(_0x5c5c8e){this[_0x555e('0x1')]=_0x5c5c8e[_0x555e('0x1')];this[_0x555e('0x2')]=_0x5c5c8e[_0x555e('0x2')]||undefined;this[_0x555e('0x3')]=_0x5c5c8e[_0x555e('0x3')];this[_0x555e('0x4')]=_0x5c5c8e['type']==='outbound'?'queue':_0x5c5c8e[_0x555e('0x3')];this[_0x555e('0x5')]=_0x5c5c8e[_0x555e('0x5')];this[_0x555e('0x6')]=_0x5c5c8e[_0x555e('0x6')];this[_0x555e('0x7')]=_0x5c5c8e[_0x555e('0x7')];this[_0x555e('0x8')]=_0x5c5c8e['countbusyretry']+_0x5c5c8e[_0x555e('0x6')]+_0x5c5c8e[_0x555e('0x7')]+_0x5c5c8e[_0x555e('0x9')]+_0x5c5c8e[_0x555e('0xa')]+_0x5c5c8e[_0x555e('0xb')]+_0x5c5c8e[_0x555e('0xc')]+_0x5c5c8e[_0x555e('0xd')];this[_0x555e('0x9')]=_0x5c5c8e[_0x555e('0x9')];this[_0x555e('0xa')]=_0x5c5c8e['countdropretry'];this[_0x555e('0xb')]=_0x5c5c8e['countabandonedretry'];this['countmachineretry']=_0x5c5c8e[_0x555e('0xc')];this['countagentrejectretry']=_0x5c5c8e[_0x555e('0xd')];this['queue']=_0x5c5c8e['queue'];this[_0x555e('0xe')]=_0x5c5c8e['name'];this[_0x555e('0xf')]=_0x5c5c8e[_0x555e('0x10')];this[_0x555e('0x11')]=_0x5c5c8e[_0x555e('0x11')];this[_0x555e('0x12')]=_0x5c5c8e[_0x555e('0x12')];this[_0x555e('0x13')]=_0x5c5c8e[_0x555e('0x12')];this[_0x555e('0x14')]=utils['getSeconds'](_0x5c5c8e[_0x555e('0x12')],_0x5c5c8e[_0x555e('0x11')]);this[_0x555e('0x15')]=0x0;this[_0x555e('0x16')]=0x0;this['callback']=_0x5c5c8e[_0x555e('0x17')];this[_0x555e('0x18')]=_0x5c5c8e[_0x555e('0x18')];this[_0x555e('0x19')]=_0x5c5c8e[_0x555e('0x19')];this[_0x555e('0x1a')]=_0x5c5c8e[_0x555e('0x1a')];this['ContactId']=_0x5c5c8e[_0x555e('0x1b')];this['ListId']=_0x5c5c8e[_0x555e('0x1c')];this[_0x555e('0x1d')]=_0x5c5c8e[_0x555e('0x1d')];this[_0x555e('0x1e')]=_0x5c5c8e[_0x555e('0x1e')];this['CampaignId']=_0x5c5c8e['CampaignId'];this[_0x555e('0x1f')]=_0x5c5c8e[_0x555e('0x1f')]||'';this[_0x555e('0x20')]=_0x5c5c8e[_0x555e('0x20')]||'';this[_0x555e('0x21')]=_0x5c5c8e['state'];this[_0x555e('0x22')]=_0x5c5c8e[_0x555e('0x22')];}module[_0x555e('0x23')]=History; \ No newline at end of file +var _0x06a3=['callback','callbackuniqueid','callbackat','recallme','ContactId','ListId','UserId','VoiceQueueId','CampaignId','originatecalleridnum','originatecalleridname','state','exports','uniqueid','scheduledat','type','campaigntype','queue','countbusyretry','countcongestionretry','countnoanswerretry','countglobal','countnosuchnumberretry','countabandonedretry','countmachineretry','countagentrejectretry','countdropretry','calleridname','name','number','starttime','responsetime','endtime','ringtime','getSeconds','talktime'];(function(_0x2c1ad0,_0x5c2efb){var _0x22da92=function(_0x104fb5){while(--_0x104fb5){_0x2c1ad0['push'](_0x2c1ad0['shift']());}};_0x22da92(++_0x5c2efb);}(_0x06a3,0x175));var _0x306a=function(_0x26f4a4,_0xeb0dc6){_0x26f4a4=_0x26f4a4-0x0;var _0x437404=_0x06a3[_0x26f4a4];return _0x437404;};'use strict';var utils=require('../utils');function History(_0x29d9e1){this[_0x306a('0x0')]=_0x29d9e1[_0x306a('0x0')];this[_0x306a('0x1')]=_0x29d9e1[_0x306a('0x1')]||undefined;this[_0x306a('0x2')]=_0x29d9e1[_0x306a('0x2')];this[_0x306a('0x3')]=_0x29d9e1['type']==='outbound'?_0x306a('0x4'):_0x29d9e1[_0x306a('0x2')];this[_0x306a('0x5')]=_0x29d9e1['countbusyretry'];this[_0x306a('0x6')]=_0x29d9e1['countcongestionretry'];this[_0x306a('0x7')]=_0x29d9e1[_0x306a('0x7')];this[_0x306a('0x8')]=_0x29d9e1['countbusyretry']+_0x29d9e1[_0x306a('0x6')]+_0x29d9e1[_0x306a('0x7')]+_0x29d9e1[_0x306a('0x9')]+_0x29d9e1['countdropretry']+_0x29d9e1[_0x306a('0xa')]+_0x29d9e1[_0x306a('0xb')]+_0x29d9e1[_0x306a('0xc')];this['countnosuchnumberretry']=_0x29d9e1[_0x306a('0x9')];this[_0x306a('0xd')]=_0x29d9e1['countdropretry'];this[_0x306a('0xa')]=_0x29d9e1[_0x306a('0xa')];this['countmachineretry']=_0x29d9e1[_0x306a('0xb')];this['countagentrejectretry']=_0x29d9e1[_0x306a('0xc')];this['queue']=_0x29d9e1[_0x306a('0x4')];this[_0x306a('0xe')]=_0x29d9e1[_0x306a('0xf')];this['calleridnum']=_0x29d9e1[_0x306a('0x10')];this['starttime']=_0x29d9e1[_0x306a('0x11')];this[_0x306a('0x12')]=_0x29d9e1[_0x306a('0x12')];this[_0x306a('0x13')]=_0x29d9e1['responsetime'];this[_0x306a('0x14')]=utils[_0x306a('0x15')](_0x29d9e1['responsetime'],_0x29d9e1[_0x306a('0x11')]);this['holdtime']=0x0;this[_0x306a('0x16')]=0x0;this['callback']=_0x29d9e1[_0x306a('0x17')];this['callbackuniqueid']=_0x29d9e1[_0x306a('0x18')];this[_0x306a('0x19')]=_0x29d9e1[_0x306a('0x19')];this['recallme']=_0x29d9e1[_0x306a('0x1a')];this[_0x306a('0x1b')]=_0x29d9e1[_0x306a('0x1b')];this[_0x306a('0x1c')]=_0x29d9e1[_0x306a('0x1c')];this[_0x306a('0x1d')]=_0x29d9e1['UserId'];this['VoiceQueueId']=_0x29d9e1[_0x306a('0x1e')];this[_0x306a('0x1f')]=_0x29d9e1['CampaignId'];this[_0x306a('0x20')]=_0x29d9e1['originatecalleridnum']||'';this[_0x306a('0x21')]=_0x29d9e1['originatecalleridname']||'';this[_0x306a('0x22')]=_0x29d9e1[_0x306a('0x22')];this['statedesc']=_0x29d9e1['statedesc'];}module[_0x306a('0x23')]=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 9aef580..e443f5e 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 _0x88c7=['name','calleridnum','number','starttime','droptime','dropreason','endtime','ringtime','getSeconds','holdtime','responsetime','talktime','membername','connectedlinename','reason','callback','callbackuniqueid','callbackat','recallme','ContactId','ListId','UserId','VoiceQueueId','CampaignId','originatecalleridnum','originatecalleridname','agiafterat','state','statedesc','../utils','scheduledat','type','outbound','queue','countbusyretry','countcongestionretry','countnoanswerretry','countglobal','countnosuchnumberretry','countdropretry','countmachineretry','countagentrejectretry','countabandonedretry','uniqueid','calleridname'];(function(_0x466a62,_0xd4bb2d){var _0x580a24=function(_0x2f27b4){while(--_0x2f27b4){_0x466a62['push'](_0x466a62['shift']());}};_0x580a24(++_0xd4bb2d);}(_0x88c7,0x185));var _0x788c=function(_0x1fdf39,_0x3b28e8){_0x1fdf39=_0x1fdf39-0x0;var _0x29705e=_0x88c7[_0x1fdf39];return _0x29705e;};'use strict';var utils=require(_0x788c('0x0'));function QueueCallerAbandon(_0x1e297a,_0x305ba6){this[_0x788c('0x1')]=_0x1e297a[_0x788c('0x1')];this[_0x788c('0x2')]=_0x1e297a['type'];this['campaigntype']=_0x1e297a[_0x788c('0x2')]===_0x788c('0x3')?_0x788c('0x4'):_0x1e297a['type'];this[_0x788c('0x5')]=_0x1e297a['countbusyretry'];this['countcongestionretry']=_0x1e297a[_0x788c('0x6')];this[_0x788c('0x7')]=_0x1e297a['countnoanswerretry'];this[_0x788c('0x8')]=_0x1e297a['countbusyretry']+_0x1e297a[_0x788c('0x6')]+_0x1e297a[_0x788c('0x7')]+_0x1e297a[_0x788c('0x9')]+_0x1e297a[_0x788c('0xa')]+_0x1e297a['countabandonedretry']+_0x1e297a[_0x788c('0xb')]+_0x1e297a[_0x788c('0xc')];this[_0x788c('0x9')]=_0x1e297a[_0x788c('0x9')];this[_0x788c('0xa')]=_0x1e297a['countdropretry'];this[_0x788c('0xd')]=_0x1e297a[_0x788c('0xd')];this[_0x788c('0xb')]=_0x1e297a[_0x788c('0xb')];this[_0x788c('0xc')]=_0x1e297a[_0x788c('0xc')];this[_0x788c('0xe')]=_0x305ba6['uniqueid'];this[_0x788c('0xf')]=_0x1e297a[_0x788c('0x10')];this[_0x788c('0x11')]=_0x1e297a[_0x788c('0x12')];this[_0x788c('0x13')]=_0x1e297a[_0x788c('0x13')];this['responsetime']=_0x1e297a['responsetime'];this[_0x788c('0x14')]=_0x1e297a[_0x788c('0x14')];this[_0x788c('0x15')]=_0x1e297a[_0x788c('0x15')];this[_0x788c('0x16')]=this[_0x788c('0x14')];this[_0x788c('0x17')]=utils[_0x788c('0x18')](_0x1e297a['responsetime'],_0x1e297a[_0x788c('0x13')]);this[_0x788c('0x19')]=utils[_0x788c('0x18')](this[_0x788c('0x14')],_0x1e297a[_0x788c('0x1a')]);this[_0x788c('0x1b')]=0x0;this[_0x788c('0x4')]=_0x305ba6['queue'];this[_0x788c('0x1c')]=_0x305ba6[_0x788c('0x1d')];this[_0x788c('0x1e')]=_0x305ba6[_0x788c('0x1e')];this[_0x788c('0x1f')]=_0x1e297a[_0x788c('0x1f')];this[_0x788c('0x20')]=_0x1e297a['callbackuniqueid'];this[_0x788c('0x21')]=_0x1e297a[_0x788c('0x21')];this[_0x788c('0x22')]=_0x1e297a[_0x788c('0x22')];this[_0x788c('0x23')]=_0x1e297a['ContactId'];this[_0x788c('0x24')]=_0x1e297a['ListId'];this[_0x788c('0x25')]=_0x1e297a[_0x788c('0x25')];this[_0x788c('0x26')]=_0x1e297a[_0x788c('0x26')];this['CampaignId']=_0x1e297a[_0x788c('0x27')];this['originatecalleridnum']=_0x1e297a[_0x788c('0x28')]||'';this[_0x788c('0x29')]=_0x1e297a[_0x788c('0x29')]||'';this[_0x788c('0x2a')]=_0x1e297a[_0x788c('0x2a')];this[_0x788c('0x2b')]=_0x1e297a[_0x788c('0x2b')];this[_0x788c('0x2c')]=_0x1e297a[_0x788c('0x2c')];}module['exports']=QueueCallerAbandon; \ No newline at end of file +var _0x5098=['getSeconds','holdtime','membername','connectedlinename','reason','callback','callbackuniqueid','callbackat','recallme','ContactId','ListId','UserId','VoiceQueueId','CampaignId','originatecalleridnum','originatecalleridname','agiafterat','state','statedesc','exports','../utils','scheduledat','type','campaigntype','outbound','queue','countbusyretry','countcongestionretry','countnoanswerretry','countdropretry','countmachineretry','countabandonedretry','countagentrejectretry','uniqueid','name','calleridnum','number','starttime','responsetime','droptime','dropreason','endtime','ringtime'];(function(_0x167cc1,_0x56ef5a){var _0x10bc4b=function(_0xd6a255){while(--_0xd6a255){_0x167cc1['push'](_0x167cc1['shift']());}};_0x10bc4b(++_0x56ef5a);}(_0x5098,0x6a));var _0x8509=function(_0x4f17fa,_0x192e94){_0x4f17fa=_0x4f17fa-0x0;var _0x4e75b8=_0x5098[_0x4f17fa];return _0x4e75b8;};'use strict';var utils=require(_0x8509('0x0'));function QueueCallerAbandon(_0x4ea09f,_0x25399d){this[_0x8509('0x1')]=_0x4ea09f[_0x8509('0x1')];this[_0x8509('0x2')]=_0x4ea09f['type'];this[_0x8509('0x3')]=_0x4ea09f[_0x8509('0x2')]===_0x8509('0x4')?_0x8509('0x5'):_0x4ea09f[_0x8509('0x2')];this[_0x8509('0x6')]=_0x4ea09f[_0x8509('0x6')];this[_0x8509('0x7')]=_0x4ea09f[_0x8509('0x7')];this['countnoanswerretry']=_0x4ea09f[_0x8509('0x8')];this['countglobal']=_0x4ea09f[_0x8509('0x6')]+_0x4ea09f[_0x8509('0x7')]+_0x4ea09f[_0x8509('0x8')]+_0x4ea09f['countnosuchnumberretry']+_0x4ea09f[_0x8509('0x9')]+_0x4ea09f['countabandonedretry']+_0x4ea09f[_0x8509('0xa')]+_0x4ea09f['countagentrejectretry'];this['countnosuchnumberretry']=_0x4ea09f['countnosuchnumberretry'];this[_0x8509('0x9')]=_0x4ea09f[_0x8509('0x9')];this[_0x8509('0xb')]=_0x4ea09f[_0x8509('0xb')];this[_0x8509('0xa')]=_0x4ea09f[_0x8509('0xa')];this[_0x8509('0xc')]=_0x4ea09f['countagentrejectretry'];this[_0x8509('0xd')]=_0x25399d[_0x8509('0xd')];this['calleridname']=_0x4ea09f[_0x8509('0xe')];this[_0x8509('0xf')]=_0x4ea09f[_0x8509('0x10')];this['starttime']=_0x4ea09f[_0x8509('0x11')];this[_0x8509('0x12')]=_0x4ea09f[_0x8509('0x12')];this[_0x8509('0x13')]=_0x4ea09f[_0x8509('0x13')];this['dropreason']=_0x4ea09f[_0x8509('0x14')];this[_0x8509('0x15')]=this['droptime'];this[_0x8509('0x16')]=utils[_0x8509('0x17')](_0x4ea09f['responsetime'],_0x4ea09f[_0x8509('0x11')]);this[_0x8509('0x18')]=utils[_0x8509('0x17')](this['droptime'],_0x4ea09f[_0x8509('0x12')]);this['talktime']=0x0;this['queue']=_0x25399d[_0x8509('0x5')];this[_0x8509('0x19')]=_0x25399d[_0x8509('0x1a')];this[_0x8509('0x1b')]=_0x25399d['reason'];this[_0x8509('0x1c')]=_0x4ea09f[_0x8509('0x1c')];this['callbackuniqueid']=_0x4ea09f[_0x8509('0x1d')];this[_0x8509('0x1e')]=_0x4ea09f['callbackat'];this[_0x8509('0x1f')]=_0x4ea09f[_0x8509('0x1f')];this[_0x8509('0x20')]=_0x4ea09f['ContactId'];this['ListId']=_0x4ea09f[_0x8509('0x21')];this[_0x8509('0x22')]=_0x4ea09f['UserId'];this[_0x8509('0x23')]=_0x4ea09f[_0x8509('0x23')];this['CampaignId']=_0x4ea09f[_0x8509('0x24')];this['originatecalleridnum']=_0x4ea09f[_0x8509('0x25')]||'';this[_0x8509('0x26')]=_0x4ea09f[_0x8509('0x26')]||'';this[_0x8509('0x27')]=_0x4ea09f[_0x8509('0x27')];this[_0x8509('0x28')]=_0x4ea09f['state'];this[_0x8509('0x29')]=_0x4ea09f['statedesc'];}module[_0x8509('0x2a')]=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 4cf7f0c..55f916b 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 _0x3d04=['[avgHandleTime]','avgHandleTime','createHistory','[createHistory]','util','../../../../config/logger','dialer','../../rpc/cmHopper','../../rpc/cmHopperAdditionalPhone','../../rpc/cmHopperBlack','../../rpc/cmHopperHistory','getContactDialer','error','[getContactDialer]','catch','[getContactDialerIvr]','getContactDialerIvr','[countReScheduled]','countReScheduled','rescheduleContact','unlockContact','[unlockContact]','moveContactManagedDialer','[moveContactManagedDialer]','checkIsBlackList','[checkIsBlackList]','checkIsBlackListIvr','[checkIsBlackListIvr]','verifyAdditionalPhones','[swapAdditionalPhone]','swapAdditionalPhones'];(function(_0xd308f,_0x3d0a33){var _0x24595c=function(_0x3e51b9){while(--_0x3e51b9){_0xd308f['push'](_0xd308f['shift']());}};_0x24595c(++_0x3d0a33);}(_0x3d04,0xbe));var _0x43d0=function(_0x14add3,_0x13ce8d){_0x14add3=_0x14add3-0x0;var _0x4a174f=_0x3d04[_0x14add3];return _0x4a174f;};'use strict';var util=require(_0x43d0('0x0'));var logger=require(_0x43d0('0x1'))(_0x43d0('0x2'));var cmHopper=require(_0x43d0('0x3'));var cmHopperAdditionalPhone=require(_0x43d0('0x4'));var cmHopperBlack=require(_0x43d0('0x5'));var cmHopperHistory=require(_0x43d0('0x6'));function inspectError(_0x1f80fd){return util['inspect'](_0x1f80fd,{'showHidden':![],'depth':null});}function getContactDialer(_0x2a4d4c,_0x1a75d4,_0x746f5e){return cmHopper[_0x43d0('0x7')](_0x2a4d4c['id'],_0x1a75d4,_0x746f5e,_0x2a4d4c['dialOrderByScheduledAt'])['catch'](function(_0x50919e){_0x2a4d4c['temp']=0x0;logger[_0x43d0('0x8')](_0x43d0('0x9'),inspectError(_0x50919e));});}exports[_0x43d0('0x7')]=getContactDialer;function getContactDialerIvr(_0x46e560,_0x44a763){return cmHopper['getContactDialerIvr'](_0x46e560['id'],_0x44a763,_0x46e560['dialOrderByScheduledAt'])[_0x43d0('0xa')](function(_0x54885c){_0x46e560['temp']=0x0;logger[_0x43d0('0x8')](_0x43d0('0xb'),inspectError(_0x54885c));});}exports[_0x43d0('0xc')]=getContactDialerIvr;function countReScheduled(_0x375174){return cmHopper['countReScheduled'](_0x375174)[_0x43d0('0xa')](function(_0x23daaa){logger['error'](_0x43d0('0xd'),inspectError(_0x23daaa));});}exports[_0x43d0('0xe')]=countReScheduled;function rescheduleContact(_0x1b4f09){return cmHopper['rescheduleContact'](_0x1b4f09)[_0x43d0('0xa')](function(_0x2454fa){logger[_0x43d0('0x8')]('[rescheduleContact]',inspectError(_0x2454fa));});}exports[_0x43d0('0xf')]=rescheduleContact;function unlockContact(_0x357f87,_0x44e6ec,_0x1218b5){return cmHopper[_0x43d0('0x10')](_0x357f87,_0x44e6ec,_0x1218b5)['catch'](function(_0x5d4fc4){logger[_0x43d0('0x8')](_0x43d0('0x11'),inspectError(_0x5d4fc4));});}exports[_0x43d0('0x10')]=unlockContact;function moveContactManagedDialer(_0x56a27b){return cmHopper[_0x43d0('0x12')](_0x56a27b)['catch'](function(_0x2c9d06){logger[_0x43d0('0x8')](_0x43d0('0x13'),inspectError(_0x2c9d06));});}exports['moveContactManagedDialer']=moveContactManagedDialer;function checkIsBlackList(_0x3d7dcc){return cmHopperBlack[_0x43d0('0x14')](_0x3d7dcc)['catch'](function(_0x474d96){logger[_0x43d0('0x8')](_0x43d0('0x15'),inspectError(_0x474d96));});}exports[_0x43d0('0x14')]=checkIsBlackList;function checkIsBlackListIvr(_0x3009a7){return cmHopperBlack[_0x43d0('0x16')](_0x3009a7)[_0x43d0('0xa')](function(_0x1e7993){logger[_0x43d0('0x8')](_0x43d0('0x17'),inspectError(_0x1e7993));});}exports[_0x43d0('0x16')]=checkIsBlackListIvr;function verifyAdditionalPhones(_0x19d2ff,_0x326be8,_0xbc72e6){return cmHopperAdditionalPhone[_0x43d0('0x18')](_0x19d2ff,_0x326be8,_0xbc72e6)['catch'](function(_0x2c7b24){logger[_0x43d0('0x8')]('[verifyAdditionalPhone]',inspectError(_0x2c7b24));});}exports[_0x43d0('0x18')]=verifyAdditionalPhones;function swapAdditionalPhones(_0x5456ab,_0x29c111,_0x44497b){return cmHopperAdditionalPhone['swapAdditionalPhones'](_0x5456ab,_0x29c111,_0x44497b)[_0x43d0('0xa')](function(_0x238c64){logger['error'](_0x43d0('0x19'),inspectError(_0x238c64));});}exports[_0x43d0('0x1a')]=swapAdditionalPhones;function avgHandleTime(_0x22ae3c){return cmHopperHistory['avgHandleTime'](_0x22ae3c)[_0x43d0('0xa')](function(_0x38e89e){logger[_0x43d0('0x8')](_0x43d0('0x1b'),inspectError(_0x38e89e));});}exports[_0x43d0('0x1c')]=avgHandleTime;function createHistory(_0x440ecb){return cmHopperHistory[_0x43d0('0x1d')](_0x440ecb)['catch'](function(_0x2b0784){logger[_0x43d0('0x8')](_0x43d0('0x1e'),inspectError(_0x2b0784));});}exports['createHistory']=createHistory; \ No newline at end of file +var _0x5d58=['../../rpc/cmHopperHistory','inspect','getContactDialer','dialOrderByScheduledAt','catch','temp','error','getContactDialerIvr','[getContactDialerIvr]','countReScheduled','rescheduleContact','[rescheduleContact]','unlockContact','[unlockContact]','moveContactManagedDialer','[moveContactManagedDialer]','checkIsBlackList','[checkIsBlackList]','checkIsBlackListIvr','[verifyAdditionalPhone]','verifyAdditionalPhones','swapAdditionalPhones','[swapAdditionalPhone]','[avgHandleTime]','avgHandleTime','createHistory','[createHistory]','../../rpc/cmHopperBlack'];(function(_0x5f2da6,_0x5ad591){var _0x1c7e21=function(_0x4ee65e){while(--_0x4ee65e){_0x5f2da6['push'](_0x5f2da6['shift']());}};_0x1c7e21(++_0x5ad591);}(_0x5d58,0x187));var _0x85d5=function(_0x2caf57,_0x49c631){_0x2caf57=_0x2caf57-0x0;var _0x224f2b=_0x5d58[_0x2caf57];return _0x224f2b;};'use strict';var util=require('util');var logger=require('../../../../config/logger')('dialer');var cmHopper=require('../../rpc/cmHopper');var cmHopperAdditionalPhone=require('../../rpc/cmHopperAdditionalPhone');var cmHopperBlack=require(_0x85d5('0x0'));var cmHopperHistory=require(_0x85d5('0x1'));function inspectError(_0x53ca58){return util[_0x85d5('0x2')](_0x53ca58,{'showHidden':![],'depth':null});}function getContactDialer(_0x30bfe8,_0x54207b,_0x1eb211){return cmHopper[_0x85d5('0x3')](_0x30bfe8['id'],_0x54207b,_0x1eb211,_0x30bfe8[_0x85d5('0x4')])[_0x85d5('0x5')](function(_0x5f47ec){_0x30bfe8[_0x85d5('0x6')]=0x0;logger[_0x85d5('0x7')]('[getContactDialer]',inspectError(_0x5f47ec));});}exports[_0x85d5('0x3')]=getContactDialer;function getContactDialerIvr(_0x4eb3ae,_0x1098be){return cmHopper[_0x85d5('0x8')](_0x4eb3ae['id'],_0x1098be,_0x4eb3ae[_0x85d5('0x4')])['catch'](function(_0x499b36){_0x4eb3ae['temp']=0x0;logger[_0x85d5('0x7')](_0x85d5('0x9'),inspectError(_0x499b36));});}exports[_0x85d5('0x8')]=getContactDialerIvr;function countReScheduled(_0x25369e){return cmHopper[_0x85d5('0xa')](_0x25369e)[_0x85d5('0x5')](function(_0x31409d){logger['error']('[countReScheduled]',inspectError(_0x31409d));});}exports['countReScheduled']=countReScheduled;function rescheduleContact(_0x3e1285){return cmHopper[_0x85d5('0xb')](_0x3e1285)[_0x85d5('0x5')](function(_0x1704f0){logger[_0x85d5('0x7')](_0x85d5('0xc'),inspectError(_0x1704f0));});}exports[_0x85d5('0xb')]=rescheduleContact;function unlockContact(_0x586382,_0x18e977,_0x2d7c95){return cmHopper[_0x85d5('0xd')](_0x586382,_0x18e977,_0x2d7c95)[_0x85d5('0x5')](function(_0x19f7d5){logger[_0x85d5('0x7')](_0x85d5('0xe'),inspectError(_0x19f7d5));});}exports[_0x85d5('0xd')]=unlockContact;function moveContactManagedDialer(_0x17652b){return cmHopper[_0x85d5('0xf')](_0x17652b)[_0x85d5('0x5')](function(_0x432bd6){logger[_0x85d5('0x7')](_0x85d5('0x10'),inspectError(_0x432bd6));});}exports[_0x85d5('0xf')]=moveContactManagedDialer;function checkIsBlackList(_0x26981b){return cmHopperBlack[_0x85d5('0x11')](_0x26981b)[_0x85d5('0x5')](function(_0x53bd11){logger[_0x85d5('0x7')](_0x85d5('0x12'),inspectError(_0x53bd11));});}exports['checkIsBlackList']=checkIsBlackList;function checkIsBlackListIvr(_0x231b57){return cmHopperBlack[_0x85d5('0x13')](_0x231b57)['catch'](function(_0x58290b){logger[_0x85d5('0x7')]('[checkIsBlackListIvr]',inspectError(_0x58290b));});}exports[_0x85d5('0x13')]=checkIsBlackListIvr;function verifyAdditionalPhones(_0x5ce96e,_0x240000,_0x1f8d27){return cmHopperAdditionalPhone['verifyAdditionalPhones'](_0x5ce96e,_0x240000,_0x1f8d27)['catch'](function(_0x4da71b){logger['error'](_0x85d5('0x14'),inspectError(_0x4da71b));});}exports[_0x85d5('0x15')]=verifyAdditionalPhones;function swapAdditionalPhones(_0x244353,_0x466bbd,_0x12fea3){return cmHopperAdditionalPhone[_0x85d5('0x16')](_0x244353,_0x466bbd,_0x12fea3)['catch'](function(_0x7e9a11){logger['error'](_0x85d5('0x17'),inspectError(_0x7e9a11));});}exports[_0x85d5('0x16')]=swapAdditionalPhones;function avgHandleTime(_0x233ccd){return cmHopperHistory['avgHandleTime'](_0x233ccd)[_0x85d5('0x5')](function(_0x367704){logger[_0x85d5('0x7')](_0x85d5('0x18'),inspectError(_0x367704));});}exports[_0x85d5('0x19')]=avgHandleTime;function createHistory(_0x56031f){return cmHopperHistory[_0x85d5('0x1a')](_0x56031f)[_0x85d5('0x5')](function(_0x330f8a){logger[_0x85d5('0x7')](_0x85d5('0x1b'),inspectError(_0x330f8a));});}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 abb7d5a..624f88b 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 _0x0817=['paused','talking','pTalking','waiting','inUse','originated','Trunk','name','active','hasQueueCampaignDataChanged','dialTimezone','isNil','dialGlobalInterval','Interval','Intervals','isEmpty','EMPTY_INTERVAL','UNKNOWN_TIMEZONE','SIP/','reachable','unmonitored','includes','status','TrunkBackup','INACTIVE','DISACTIVED','NO_AGENTS_LOGGED','UNREACHABLE_TRUNK','getQueueCampaignStatusMessage','getQueueCampaignActiveStatusMessage','match','extractCalleridName','isUndefined','string','format','\x22%s\x22\x20<%s>','\x22\x22\x20<>','getCallerId','\x5cw{0,','pow','replace','random','toString','getCallerIdRandom','error','decrementOriginate','checkContactEmpty','erlangb','[checkContactLowerLimitOriginate]\x20','createdAt','updatedAt','length','XMD-','toUpperCase','substring','lodash','moment','../../../../config/logger','ACTIVE','BLACKLIST','RESCHEDULED_CONTACTS','IS_DISACTIVED','INTERVAL_IS_EMPTY','INTERVAL_IS_NULL','INTERVAL_IS_OVERTIME','GLOBAL_INTERVAL_IS_OVERTIME','RUNNING','TIMEZONE_UNKNOW','CAMPAIGN_STATUS','dialMethod','preview','isPreviewCampaign','ivr','isIVRCampaign','type','outbound','isOutboundQueue','dialActive','isQueueCampaignActive','milliseconds','diff','seconds','message','available','loggedIn','loggedInDb'];(function(_0x520a18,_0x2e7d0a){var _0x5b0ba6=function(_0x9c9347){while(--_0x9c9347){_0x520a18['push'](_0x520a18['shift']());}};_0x5b0ba6(++_0x2e7d0a);}(_0x0817,0x8d));var _0x7081=function(_0x4107f5,_0x40cd40){_0x4107f5=_0x4107f5-0x0;var _0x29d363=_0x0817[_0x4107f5];return _0x29d363;};'use strict';var _=require(_0x7081('0x0'));var moment=require(_0x7081('0x1'));var util=require('util');var logger=require(_0x7081('0x2'))('dialer');var timezones=require('../../../../config/environment/shared')['timezones'];var CAMPAIGN_STATUS={'ACTIVE':_0x7081('0x3'),'BLACKLIST':_0x7081('0x4'),'CONTACTS_RESCHEDULED':_0x7081('0x5'),'DEACTIVATED':'DEACTIVATED','DISACTIVED':_0x7081('0x6'),'EMPTY_INTERVAL':_0x7081('0x7'),'INACTIVE':'NOT_ACTIVE','NO_AGENTS_LOGGED':'AGENTS_NOT_LOGGED','NO_AVAILABLE_CONTACTS':'AVAILABLE_CONTACTS_FINISHED','NULL_INTERVAL':_0x7081('0x8'),'OVERTIME_INTERVAL':_0x7081('0x9'),'OVERTIME_GLOBAL_INTERVAL':_0x7081('0xa'),'QUEUE_RECALL':'RECALLINQUEUE','RECALL_TIMEOUT':'RECALLFAILEDTIMEOUT','RUNNING':_0x7081('0xb'),'UNKNOWN_TIMEZONE':_0x7081('0xc'),'UNREACHABLE_TRUNK':'TRUNK_IS_NOT_REACHABLE'};exports[_0x7081('0xd')]=CAMPAIGN_STATUS;function isPreviewCampaign(_0x550f37){return _0x550f37[_0x7081('0xe')]===_0x7081('0xf');}exports[_0x7081('0x10')]=isPreviewCampaign;function isIVRCampaign(_0x57e1e3){return _0x57e1e3['type']===_0x7081('0x11');}exports[_0x7081('0x12')]=isIVRCampaign;function isOutboundQueue(_0x4c4704){return _0x4c4704[_0x7081('0x13')]===_0x7081('0x14');}exports[_0x7081('0x15')]=isOutboundQueue;function isQueueCampaignActive(_0x243ffd){return _0x243ffd[_0x7081('0x16')];}exports[_0x7081('0x17')]=isQueueCampaignActive;function isIVRCampaignActive(_0x5b19c3){return _0x5b19c3['active'];}exports['isIVRCampaignActive']=isIVRCampaignActive;function getSeconds(_0x1d866c,_0x46bb91){var _0x560be9=moment(_0x1d866c)[_0x7081('0x18')](0x0);var _0x150179=moment(_0x46bb91)[_0x7081('0x18')](0x0);return _0x560be9[_0x7081('0x19')](_0x150179,_0x7081('0x1a'));}exports['getSeconds']=getSeconds;function hasQueueCampaignDataChanged(_0x594f10,_0x21ca99){var _0x4105f3=![];var _0x25e4af=_0x594f10[_0x7081('0xe')]!==_0x21ca99[_0x7081('0xe')]||_0x594f10['dialActive']!==_0x21ca99['dialActive']||_0x594f10[_0x7081('0x1b')]!==_0x21ca99['message'];var _0x2dcb8c=_0x594f10['available']!==_0x21ca99[_0x7081('0x1c')]||_0x594f10[_0x7081('0x1d')]!==_0x21ca99[_0x7081('0x1d')]||_0x594f10[_0x7081('0x1e')]!==_0x21ca99['loggedInDb']||_0x594f10[_0x7081('0x1f')]!==_0x21ca99[_0x7081('0x1f')]||_0x594f10[_0x7081('0x20')]!==_0x21ca99[_0x7081('0x20')]||_0x594f10['pTalking']!==_0x21ca99[_0x7081('0x21')]||_0x594f10['waiting']!==_0x21ca99[_0x7081('0x22')]||_0x594f10['inUse']!==_0x21ca99[_0x7081('0x23')]||_0x594f10['originated']!==_0x21ca99[_0x7081('0x24')];if(_0x594f10[_0x7081('0x25')]&&_0x21ca99[_0x7081('0x25')]){_0x4105f3=_0x594f10['Trunk'][_0x7081('0x26')]!==_0x21ca99[_0x7081('0x25')]['name']||_0x594f10['Trunk']['active']!==_0x21ca99['Trunk'][_0x7081('0x27')];}return _0x25e4af||_0x2dcb8c||_0x4105f3;}exports[_0x7081('0x28')]=hasQueueCampaignDataChanged;function checkAnyValidQueueCampaignInterval(_0x50edaa){var _0x4e68d3=null;var _0x4c6960=_0x50edaa[_0x7081('0x29')];if(_[_0x7081('0x2a')](_0x50edaa[_0x7081('0x2b')])||_['isNil'](_0x50edaa[_0x7081('0x2c')])||_[_0x7081('0x2a')](_0x50edaa[_0x7081('0x2c')][_0x7081('0x2d')])){_0x4e68d3=CAMPAIGN_STATUS['NULL_INTERVAL'];}else if(_['isEmpty'](_0x50edaa[_0x7081('0x2b')])||_[_0x7081('0x2e')](_0x50edaa['Interval'][_0x7081('0x2d')])){_0x4e68d3=CAMPAIGN_STATUS[_0x7081('0x2f')];}else if(_0x4c6960&&!timezones[_0x4c6960]){_0x4e68d3=CAMPAIGN_STATUS[_0x7081('0x30')];}return _0x4e68d3;}function checkAnyValidTrunk(_0x43a4b7,_0x35f1df){var _0xabd14f=null;var _0x49eef4=_0x7081('0x31');var _0x436521=[_0x7081('0x32'),_0x7081('0x33')];var _0x3021d3=!![];if(_0x43a4b7[_0x7081('0x25')]&&_0x43a4b7[_0x7081('0x25')][_0x7081('0x27')]){_0x49eef4+=_0x43a4b7['Trunk'][_0x7081('0x26')];_0xabd14f=_0x35f1df[_0x49eef4];_0x3021d3=_0x436521[_0x7081('0x34')](_0xabd14f[_0x7081('0x35')]);}else if(_0x43a4b7[_0x7081('0x36')]&&_0x43a4b7[_0x7081('0x36')]['active']){_0x49eef4+=_0x43a4b7[_0x7081('0x36')]['name'];_0xabd14f=_0x35f1df[_0x49eef4];_0x3021d3=_0x436521['includes'](_0xabd14f[_0x7081('0x35')]);}return _0x3021d3;}function getQueueCampaignStatusMessage(_0x5a523a,_0x1c3b0b){var _0x8e57bc=CAMPAIGN_STATUS['ACTIVE'];var _0x3fc8be=isPreviewCampaign(_0x5a523a);if(!isQueueCampaignActive(_0x5a523a)){if(_0x3fc8be){_0x8e57bc=CAMPAIGN_STATUS[_0x7081('0x37')];}else{if(_0x5a523a['originated']===0x0&&_0x5a523a['talking']===0x0&&_0x5a523a['waiting']===0x0&&(_0x5a523a[_0x7081('0x21')]||0x0)===0x0){_0x8e57bc=CAMPAIGN_STATUS[_0x7081('0x37')];}else{_0x8e57bc=CAMPAIGN_STATUS[_0x7081('0x38')];}}}else if(_0x5a523a[_0x7081('0x1d')]===0x0){_0x8e57bc=CAMPAIGN_STATUS[_0x7081('0x39')];}else if(!checkAnyValidTrunk(_0x5a523a,_0x1c3b0b)){_0x8e57bc=CAMPAIGN_STATUS[_0x7081('0x3a')];}else if(!isPreviewCampaign(_0x5a523a)){var _0x5ed584=checkAnyValidQueueCampaignInterval(_0x5a523a);if(_0x5ed584){_0x8e57bc=_0x5ed584;}}return _0x8e57bc;}exports[_0x7081('0x3b')]=getQueueCampaignStatusMessage;function getQueueCampaignActiveStatusMessage(_0x136a5d){var _0x2b8a12=CAMPAIGN_STATUS['DISACTIVED'];if(_0x136a5d[_0x7081('0x24')]===0x0&&_0x136a5d['talking']===0x0&&_0x136a5d['waiting']===0x0&&(_0x136a5d[_0x7081('0x21')]||0x0)===0x0){_0x2b8a12=CAMPAIGN_STATUS[_0x7081('0x37')];}return _0x2b8a12;}exports[_0x7081('0x3c')]=getQueueCampaignActiveStatusMessage;function extractCalleridName(_0x37d443){var _0x5e2345=_0x37d443[_0x7081('0x3d')](/"(.*?)"/);return _0x5e2345?_0x5e2345[0x1]:_0x37d443;}exports[_0x7081('0x3e')]=extractCalleridName;function getCallerId(_0x411887,_0x4c93b3,_0xdeb9c2){if(!_[_0x7081('0x3f')](_0xdeb9c2)&&typeof _0xdeb9c2===_0x7081('0x40')&&!_['isEmpty'](_0xdeb9c2)){if(!_[_0x7081('0x3f')](_0x4c93b3)&&typeof _0x4c93b3===_0x7081('0x40')&&!_['isEmpty'](_0x4c93b3)){return util[_0x7081('0x41')](_0x7081('0x42'),_0x4c93b3,_0xdeb9c2);}return util[_0x7081('0x41')](_0x7081('0x42'),_0xdeb9c2,_0xdeb9c2);}if(!_['isUndefined'](_0x411887)&&typeof _0x411887===_0x7081('0x40')&&!_[_0x7081('0x2e')](_0x411887)){return _0x411887;}return _0x7081('0x43');}exports[_0x7081('0x44')]=getCallerId;function getCallerIdRandom(_0x566387,_0x20db0c){var _0x1d8280;var _0x15cf12;var _0x25a5f5;if(_0x20db0c<=0x0){_0x20db0c=0x1;}_0x1d8280=new RegExp(_0x7081('0x45')+_0x20db0c+'}$');_0x15cf12=Math[_0x7081('0x46')](0xa,_0x20db0c-0x1);_0x25a5f5=Math[_0x7081('0x46')](0xa,_0x20db0c)-0x1;return util[_0x7081('0x41')]('%s',_[_0x7081('0x47')](_0x566387,_0x1d8280,_[_0x7081('0x48')](_0x15cf12,_0x25a5f5)[_0x7081('0x49')]()));}exports[_0x7081('0x4a')]=getCallerIdRandom;function decrementOriginate(_0x25479d,_0x15547b){if(_0x25479d[_0x7081('0x24')]&&_0x25479d[_0x7081('0x24')]>0x0){_0x25479d[_0x7081('0x24')]-=0x1;}else{logger[_0x7081('0x4b')]('[decrementOriginate]\x20queue\x20originate\x20value',_0x15547b);}}exports[_0x7081('0x4c')]=decrementOriginate;function checkContactEmpty(_0x152eac){return _0x152eac&&_0x152eac['length']>0x0;}exports[_0x7081('0x4d')]=checkContactEmpty;function erlangb(_0x5c47a0,_0x4dc214){if(_0x4dc214===0x0){return 0x0;}var _0x40d475=0x1;for(var _0x35af86=0x1;_0x35af86<=_0x4dc214;_0x35af86+=0x1){_0x40d475=0x1+_0x40d475*_0x35af86/_0x5c47a0;}return 0x1/_0x40d475;}exports[_0x7081('0x4e')]=erlangb;function checkContactLowerLimitOriginate(_0x4f331a,_0xf2d6ef,_0x40dc4c){if(_0xf2d6ef>_0x40dc4c){for(var _0x4ecc9d=0x0;_0x4ecc9d<_0xf2d6ef-_0x40dc4c;_0x4ecc9d+=0x1){decrementOriginate(_0x4f331a,_0x7081('0x4f'));}}}exports['checkContactLowerLimitOriginate']=checkContactLowerLimitOriginate;function setXMDContactVariables(_0x58b034){var _0x258658={};var _0x255e2a=['id',_0x7081('0x50'),'tags',_0x7081('0x51')];const _0x596eae=0xfa;if(_0x58b034){for(var _0x109e6e in _0x58b034){if(typeof _0x58b034[_0x109e6e]!=='undefined'){if(!_[_0x7081('0x2a')](_0x58b034[_0x109e6e])&&!_0x255e2a[_0x7081('0x34')](_0x109e6e)){if(_0x109e6e==='description'&&_0x58b034[_0x109e6e][_0x7081('0x52')]>_0x596eae){_0x258658[_0x7081('0x53')+_0x109e6e[_0x7081('0x54')]()]=_0x58b034[_0x109e6e]['toString']()[_0x7081('0x55')](0x0,_0x596eae);}else{_0x258658[_0x7081('0x53')+_0x109e6e[_0x7081('0x54')]()]=_0x58b034[_0x109e6e];}}}}}return _0x258658;}exports['setXMDContactVariables']=setXMDContactVariables; \ No newline at end of file +var _0x1cf8=['getCallerIdRandom','error','[decrementOriginate]\x20queue\x20originate\x20value','decrementOriginate','length','checkContactEmpty','erlangb','createdAt','tags','updatedAt','undefined','XMD-','toUpperCase','substring','setXMDContactVariables','lodash','moment','../../../../config/logger','../../../../config/environment/shared','timezones','IS_DISACTIVED','INTERVAL_IS_EMPTY','NOT_ACTIVE','AGENTS_NOT_LOGGED','AVAILABLE_CONTACTS_FINISHED','INTERVAL_IS_OVERTIME','GLOBAL_INTERVAL_IS_OVERTIME','RECALLINQUEUE','RECALLFAILEDTIMEOUT','RUNNING','TIMEZONE_UNKNOW','dialMethod','preview','type','ivr','isIVRCampaign','outbound','isOutboundQueue','dialActive','isQueueCampaignActive','active','milliseconds','diff','message','available','loggedIn','loggedInDb','paused','talking','pTalking','waiting','inUse','Trunk','name','hasQueueCampaignDataChanged','dialTimezone','isNil','dialGlobalInterval','Interval','Intervals','NULL_INTERVAL','isEmpty','EMPTY_INTERVAL','SIP/','reachable','unmonitored','includes','status','TrunkBackup','ACTIVE','INACTIVE','originated','DISACTIVED','NO_AGENTS_LOGGED','getQueueCampaignStatusMessage','getQueueCampaignActiveStatusMessage','extractCalleridName','isUndefined','string','format','\x22%s\x22\x20<%s>','\x22\x22\x20<>','getCallerId','\x5cw{0,','pow','replace','random','toString'];(function(_0x4db348,_0x5daa1e){var _0x32e7fd=function(_0x125952){while(--_0x125952){_0x4db348['push'](_0x4db348['shift']());}};_0x32e7fd(++_0x5daa1e);}(_0x1cf8,0x117));var _0x81cf=function(_0x52e251,_0x3b6303){_0x52e251=_0x52e251-0x0;var _0x5eee63=_0x1cf8[_0x52e251];return _0x5eee63;};'use strict';var _=require(_0x81cf('0x0'));var moment=require(_0x81cf('0x1'));var util=require('util');var logger=require(_0x81cf('0x2'))('dialer');var timezones=require(_0x81cf('0x3'))[_0x81cf('0x4')];var CAMPAIGN_STATUS={'ACTIVE':'ACTIVE','BLACKLIST':'BLACKLIST','CONTACTS_RESCHEDULED':'RESCHEDULED_CONTACTS','DEACTIVATED':'DEACTIVATED','DISACTIVED':_0x81cf('0x5'),'EMPTY_INTERVAL':_0x81cf('0x6'),'INACTIVE':_0x81cf('0x7'),'NO_AGENTS_LOGGED':_0x81cf('0x8'),'NO_AVAILABLE_CONTACTS':_0x81cf('0x9'),'NULL_INTERVAL':'INTERVAL_IS_NULL','OVERTIME_INTERVAL':_0x81cf('0xa'),'OVERTIME_GLOBAL_INTERVAL':_0x81cf('0xb'),'QUEUE_RECALL':_0x81cf('0xc'),'RECALL_TIMEOUT':_0x81cf('0xd'),'RUNNING':_0x81cf('0xe'),'UNKNOWN_TIMEZONE':_0x81cf('0xf'),'UNREACHABLE_TRUNK':'TRUNK_IS_NOT_REACHABLE'};exports['CAMPAIGN_STATUS']=CAMPAIGN_STATUS;function isPreviewCampaign(_0x3bbb02){return _0x3bbb02[_0x81cf('0x10')]===_0x81cf('0x11');}exports['isPreviewCampaign']=isPreviewCampaign;function isIVRCampaign(_0x488da7){return _0x488da7[_0x81cf('0x12')]===_0x81cf('0x13');}exports[_0x81cf('0x14')]=isIVRCampaign;function isOutboundQueue(_0x887ce2){return _0x887ce2[_0x81cf('0x12')]===_0x81cf('0x15');}exports[_0x81cf('0x16')]=isOutboundQueue;function isQueueCampaignActive(_0x214d6b){return _0x214d6b[_0x81cf('0x17')];}exports[_0x81cf('0x18')]=isQueueCampaignActive;function isIVRCampaignActive(_0x5ea7cb){return _0x5ea7cb[_0x81cf('0x19')];}exports['isIVRCampaignActive']=isIVRCampaignActive;function getSeconds(_0x19b9b4,_0x42f59e){var _0x281d44=moment(_0x19b9b4)[_0x81cf('0x1a')](0x0);var _0x25352b=moment(_0x42f59e)[_0x81cf('0x1a')](0x0);return _0x281d44[_0x81cf('0x1b')](_0x25352b,'seconds');}exports['getSeconds']=getSeconds;function hasQueueCampaignDataChanged(_0x5ac590,_0x1b6290){var _0xddf728=![];var _0x52694b=_0x5ac590[_0x81cf('0x10')]!==_0x1b6290['dialMethod']||_0x5ac590[_0x81cf('0x17')]!==_0x1b6290['dialActive']||_0x5ac590[_0x81cf('0x1c')]!==_0x1b6290['message'];var _0x2fa64a=_0x5ac590['available']!==_0x1b6290[_0x81cf('0x1d')]||_0x5ac590[_0x81cf('0x1e')]!==_0x1b6290[_0x81cf('0x1e')]||_0x5ac590[_0x81cf('0x1f')]!==_0x1b6290[_0x81cf('0x1f')]||_0x5ac590['paused']!==_0x1b6290[_0x81cf('0x20')]||_0x5ac590[_0x81cf('0x21')]!==_0x1b6290[_0x81cf('0x21')]||_0x5ac590[_0x81cf('0x22')]!==_0x1b6290[_0x81cf('0x22')]||_0x5ac590[_0x81cf('0x23')]!==_0x1b6290[_0x81cf('0x23')]||_0x5ac590['inUse']!==_0x1b6290[_0x81cf('0x24')]||_0x5ac590['originated']!==_0x1b6290['originated'];if(_0x5ac590[_0x81cf('0x25')]&&_0x1b6290[_0x81cf('0x25')]){_0xddf728=_0x5ac590['Trunk'][_0x81cf('0x26')]!==_0x1b6290['Trunk'][_0x81cf('0x26')]||_0x5ac590['Trunk'][_0x81cf('0x19')]!==_0x1b6290[_0x81cf('0x25')]['active'];}return _0x52694b||_0x2fa64a||_0xddf728;}exports[_0x81cf('0x27')]=hasQueueCampaignDataChanged;function checkAnyValidQueueCampaignInterval(_0x6769bc){var _0x1c179f=null;var _0x438cb5=_0x6769bc[_0x81cf('0x28')];if(_[_0x81cf('0x29')](_0x6769bc[_0x81cf('0x2a')])||_[_0x81cf('0x29')](_0x6769bc[_0x81cf('0x2b')])||_[_0x81cf('0x29')](_0x6769bc[_0x81cf('0x2b')][_0x81cf('0x2c')])){_0x1c179f=CAMPAIGN_STATUS[_0x81cf('0x2d')];}else if(_[_0x81cf('0x2e')](_0x6769bc['dialGlobalInterval'])||_[_0x81cf('0x2e')](_0x6769bc['Interval'][_0x81cf('0x2c')])){_0x1c179f=CAMPAIGN_STATUS[_0x81cf('0x2f')];}else if(_0x438cb5&&!timezones[_0x438cb5]){_0x1c179f=CAMPAIGN_STATUS['UNKNOWN_TIMEZONE'];}return _0x1c179f;}function checkAnyValidTrunk(_0x4a8902,_0x44314f){var _0x14149b=null;var _0x57e2f6=_0x81cf('0x30');var _0x1215a7=[_0x81cf('0x31'),_0x81cf('0x32')];var _0x125c11=!![];if(_0x4a8902[_0x81cf('0x25')]&&_0x4a8902['Trunk'][_0x81cf('0x19')]){_0x57e2f6+=_0x4a8902['Trunk']['name'];_0x14149b=_0x44314f[_0x57e2f6];_0x125c11=_0x1215a7[_0x81cf('0x33')](_0x14149b[_0x81cf('0x34')]);}else if(_0x4a8902[_0x81cf('0x35')]&&_0x4a8902[_0x81cf('0x35')][_0x81cf('0x19')]){_0x57e2f6+=_0x4a8902[_0x81cf('0x35')][_0x81cf('0x26')];_0x14149b=_0x44314f[_0x57e2f6];_0x125c11=_0x1215a7[_0x81cf('0x33')](_0x14149b[_0x81cf('0x34')]);}return _0x125c11;}function getQueueCampaignStatusMessage(_0xfade4d,_0xe6a8f7){var _0x2e18ab=CAMPAIGN_STATUS[_0x81cf('0x36')];var _0x895cd1=isPreviewCampaign(_0xfade4d);if(!isQueueCampaignActive(_0xfade4d)){if(_0x895cd1){_0x2e18ab=CAMPAIGN_STATUS[_0x81cf('0x37')];}else{if(_0xfade4d[_0x81cf('0x38')]===0x0&&_0xfade4d[_0x81cf('0x21')]===0x0&&_0xfade4d[_0x81cf('0x23')]===0x0&&(_0xfade4d[_0x81cf('0x22')]||0x0)===0x0){_0x2e18ab=CAMPAIGN_STATUS[_0x81cf('0x37')];}else{_0x2e18ab=CAMPAIGN_STATUS[_0x81cf('0x39')];}}}else if(_0xfade4d[_0x81cf('0x1e')]===0x0){_0x2e18ab=CAMPAIGN_STATUS[_0x81cf('0x3a')];}else if(!checkAnyValidTrunk(_0xfade4d,_0xe6a8f7)){_0x2e18ab=CAMPAIGN_STATUS['UNREACHABLE_TRUNK'];}else if(!isPreviewCampaign(_0xfade4d)){var _0x59d873=checkAnyValidQueueCampaignInterval(_0xfade4d);if(_0x59d873){_0x2e18ab=_0x59d873;}}return _0x2e18ab;}exports[_0x81cf('0x3b')]=getQueueCampaignStatusMessage;function getQueueCampaignActiveStatusMessage(_0x1a1085){var _0x265755=CAMPAIGN_STATUS[_0x81cf('0x39')];if(_0x1a1085[_0x81cf('0x38')]===0x0&&_0x1a1085[_0x81cf('0x21')]===0x0&&_0x1a1085[_0x81cf('0x23')]===0x0&&(_0x1a1085[_0x81cf('0x22')]||0x0)===0x0){_0x265755=CAMPAIGN_STATUS['INACTIVE'];}return _0x265755;}exports[_0x81cf('0x3c')]=getQueueCampaignActiveStatusMessage;function extractCalleridName(_0x363f17){var _0xcb813c=_0x363f17['match'](/"(.*?)"/);return _0xcb813c?_0xcb813c[0x1]:_0x363f17;}exports[_0x81cf('0x3d')]=extractCalleridName;function getCallerId(_0x26b6b4,_0x1e5c71,_0x2096dd){if(!_[_0x81cf('0x3e')](_0x2096dd)&&typeof _0x2096dd==='string'&&!_['isEmpty'](_0x2096dd)){if(!_['isUndefined'](_0x1e5c71)&&typeof _0x1e5c71===_0x81cf('0x3f')&&!_[_0x81cf('0x2e')](_0x1e5c71)){return util[_0x81cf('0x40')](_0x81cf('0x41'),_0x1e5c71,_0x2096dd);}return util[_0x81cf('0x40')](_0x81cf('0x41'),_0x2096dd,_0x2096dd);}if(!_['isUndefined'](_0x26b6b4)&&typeof _0x26b6b4===_0x81cf('0x3f')&&!_[_0x81cf('0x2e')](_0x26b6b4)){return _0x26b6b4;}return _0x81cf('0x42');}exports[_0x81cf('0x43')]=getCallerId;function getCallerIdRandom(_0xf27f98,_0x588003){var _0x47a4a0;var _0x3b9625;var _0x2811f1;if(_0x588003<=0x0){_0x588003=0x1;}_0x47a4a0=new RegExp(_0x81cf('0x44')+_0x588003+'}$');_0x3b9625=Math[_0x81cf('0x45')](0xa,_0x588003-0x1);_0x2811f1=Math[_0x81cf('0x45')](0xa,_0x588003)-0x1;return util[_0x81cf('0x40')]('%s',_[_0x81cf('0x46')](_0xf27f98,_0x47a4a0,_[_0x81cf('0x47')](_0x3b9625,_0x2811f1)[_0x81cf('0x48')]()));}exports[_0x81cf('0x49')]=getCallerIdRandom;function decrementOriginate(_0x3bb3b4,_0x11b4d8){if(_0x3bb3b4[_0x81cf('0x38')]&&_0x3bb3b4[_0x81cf('0x38')]>0x0){_0x3bb3b4[_0x81cf('0x38')]-=0x1;}else{logger[_0x81cf('0x4a')](_0x81cf('0x4b'),_0x11b4d8);}}exports[_0x81cf('0x4c')]=decrementOriginate;function checkContactEmpty(_0x2cdde6){return _0x2cdde6&&_0x2cdde6[_0x81cf('0x4d')]>0x0;}exports[_0x81cf('0x4e')]=checkContactEmpty;function erlangb(_0x44b3cf,_0x655fa6){if(_0x655fa6===0x0){return 0x0;}var _0x305dc2=0x1;for(var _0x562c7f=0x1;_0x562c7f<=_0x655fa6;_0x562c7f+=0x1){_0x305dc2=0x1+_0x305dc2*_0x562c7f/_0x44b3cf;}return 0x1/_0x305dc2;}exports[_0x81cf('0x4f')]=erlangb;function checkContactLowerLimitOriginate(_0x18ce81,_0x415925,_0x31bd8b){if(_0x415925>_0x31bd8b){for(var _0x313f33=0x0;_0x313f33<_0x415925-_0x31bd8b;_0x313f33+=0x1){decrementOriginate(_0x18ce81,'[checkContactLowerLimitOriginate]\x20');}}}exports['checkContactLowerLimitOriginate']=checkContactLowerLimitOriginate;function setXMDContactVariables(_0x193fe0){var _0x418d58={};var _0x5b2e0b=['id',_0x81cf('0x50'),_0x81cf('0x51'),_0x81cf('0x52')];const _0x31abb6=0xfa;if(_0x193fe0){for(var _0x3ce1da in _0x193fe0){if(typeof _0x193fe0[_0x3ce1da]!==_0x81cf('0x53')){if(!_['isNil'](_0x193fe0[_0x3ce1da])&&!_0x5b2e0b[_0x81cf('0x33')](_0x3ce1da)){if(_0x3ce1da==='description'&&_0x193fe0[_0x3ce1da][_0x81cf('0x4d')]>_0x31abb6){_0x418d58[_0x81cf('0x54')+_0x3ce1da[_0x81cf('0x55')]()]=_0x193fe0[_0x3ce1da][_0x81cf('0x48')]()[_0x81cf('0x56')](0x0,_0x31abb6);}else{_0x418d58[_0x81cf('0x54')+_0x3ce1da['toUpperCase']()]=_0x193fe0[_0x3ce1da];}}}}}return _0x418d58;}exports[_0x81cf('0x57')]=setXMDContactVariables; \ No newline at end of file diff --git a/server/services/ami/fax/action.js b/server/services/ami/fax/action.js index ed91c99..f06d983 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(_0x4cfc35,_0xb52690){var _0x43a384=function(_0x3d896f){while(--_0x3d896f){_0x4cfc35['push'](_0x4cfc35['shift']());}};_0x43a384(++_0xb52690);}(_0xa9e0,0x123));var _0x0a9e=function(_0x2a6809,_0x44edde){_0x2a6809=_0x2a6809-0x0;var _0x11c371=_0xa9e0[_0x2a6809];return _0x11c371;};'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(_0x519ad5,_0x2dbb51){var _0x58c6e0=function(_0x599baa){while(--_0x599baa){_0x519ad5['push'](_0x519ad5['shift']());}};_0x58c6e0(++_0x2dbb51);}(_0xa9e0,0x123));var _0x0a9e=function(_0x14add3,_0x13ce8d){_0x14add3=_0x14add3-0x0;var _0x4a174f=_0xa9e0[_0x14add3];return _0x4a174f;};'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 1137ba6..8519463 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 _0x01a6=['exports','bluebird','uuid','moment','path','./util/gs','../../../config/logger','fax','./rpcDb','./channel','./util/util','./action','../rpc/faxAccount','../rpc/faxMessage','faxAccounts','trunks','actions','newchannel','syncNewchannel','bind','varset','syncVarSet','syncNewExten','faxstatus','syncFaxStatus','receivefax','syncReceiveFax','hangup','syncHangup','originateresponse','prototype','context','from-voip-provider','localstationid','channels','uniqueid','name','info','\x20syncNewchannel\x20','channel','variable','hasOwnProperty','syncNewState','channelstate','channelstatedesc','value','operation','status','filename','\x20syncFaxStatus\x20','remotestationid','pagestransferred','resolution','transferrate','/var/opt/motion2/server/files/attachments/','\x20result\x20conversion\x20file\x20','message','parse','.pdf','application/pdf','then','notify','calleridnum','catch','error','\x20notify\x20','stringify','\x20receiveFax\x20','syncOriginateResponse','response','reason','update','AttachmentId','SENDING\x20FAILED\x20','logger','[Fax][Message][Error][NoUpdate1]','[Fax][Message][Error][NoUpdate2]','updateStatus','[Fax][Message][Updated]','[Fax][Message][NoUpdate1]','[Fax][Message][NoUpdate2]','deleteChannelAfterTimeout','faxpages','SUCCESS','SENDING\x20FAILED:\x20','faxstatusstring','execOriginate','[Fax][execOriginate][success]','[Fax][execOriginate][failure]','Fax\x20failed','checkAfterSend','checkTrunk','FaxAccountId','Trunk','isValid','Trunk\x20Reachable','format','gs\x20-q\x20-dNOPAUSE\x20-dBATCH\x20-sDEVICE=tiffg4\x20-sPAPERSIZE=letter\x20-sOutputFile=/var/opt/motion2/server/files/attachments/%s.tif\x20\x20%s\x20-c\x20quit','dir','XMF-PATH','Convert\x20pdf\x20to\x20tif','Action','variablesAction','addVariables','ext','isTrunkReachable','isNil','SIP/%s','\x20Trunk\x20is\x20not\x20active','Trunk\x20not\x20working\x20correctly','[Fax][checkTrunk][Empty\x20Fax]','[Fax][checkTrunk][Empty\x20path]','Empty\x20path'];(function(_0x1f2d6b,_0x3e1d3d){var _0x2ea88e=function(_0x449112){while(--_0x449112){_0x1f2d6b['push'](_0x1f2d6b['shift']());}};_0x2ea88e(++_0x3e1d3d);}(_0x01a6,0x72));var _0x601a=function(_0x5ee7a4,_0x5154fb){_0x5ee7a4=_0x5ee7a4-0x0;var _0x36d79e=_0x01a6[_0x5ee7a4];return _0x36d79e;};'use strict';var util=require('util');var _=require('lodash');var BPromise=require(_0x601a('0x0'));var uuid=require(_0x601a('0x1'));var moment=require(_0x601a('0x2'));var path=require(_0x601a('0x3'));var tiff2pdf=require('tiff2pdf');var gs=require(_0x601a('0x4'));var logger=require(_0x601a('0x5'))(_0x601a('0x6'));var ami=require('../ami');var rpcDb=require(_0x601a('0x7'));var Channel=require(_0x601a('0x8'));var ut=require(_0x601a('0x9'));var Action=require(_0x601a('0xa'));var faxAccount=require(_0x601a('0xb'));var attachment=require('../rpc/attachment');var faxMessage=require(_0x601a('0xc'));function Fax(_0x251f73){this['channels']={};this[_0x601a('0xd')]=_0x251f73['faxAccounts'];this[_0x601a('0xe')]=_0x251f73[_0x601a('0xe')];this[_0x601a('0xf')]={};ami['on'](_0x601a('0x10'),this[_0x601a('0x11')][_0x601a('0x12')](this));ami['on'](_0x601a('0x13'),this[_0x601a('0x14')][_0x601a('0x12')](this));ami['on']('newstate',this['syncNewState'][_0x601a('0x12')](this));ami['on']('newexten',this[_0x601a('0x15')][_0x601a('0x12')](this));ami['on'](_0x601a('0x16'),this[_0x601a('0x17')][_0x601a('0x12')](this));ami['on'](_0x601a('0x18'),this[_0x601a('0x19')][_0x601a('0x12')](this));ami['on'](_0x601a('0x1a'),this[_0x601a('0x1b')][_0x601a('0x12')](this));ami['on'](_0x601a('0x1c'),this['syncOriginateResponse'][_0x601a('0x12')](this));}Fax[_0x601a('0x1d')]['syncNewchannel']=function(_0x28c8ff){if(_0x28c8ff[_0x601a('0x1e')]===_0x601a('0x1f')){for(var _0x2282d1 in this[_0x601a('0xd')]){if(this[_0x601a('0xd')]['hasOwnProperty'](_0x2282d1)){if(_0x28c8ff['exten']===this['faxAccounts'][_0x2282d1][_0x601a('0x20')]){this[_0x601a('0x21')][_0x28c8ff['uniqueid']]={};this[_0x601a('0x21')][_0x28c8ff[_0x601a('0x22')]]['channel']=_0x28c8ff['channel'];this[_0x601a('0x21')][_0x28c8ff[_0x601a('0x22')]]['id']=this[_0x601a('0xd')][_0x2282d1]['id'];this['channels'][_0x28c8ff[_0x601a('0x22')]][_0x601a('0x23')]=this[_0x601a('0xd')][_0x2282d1][_0x601a('0x23')];logger[_0x601a('0x24')](_0x28c8ff[_0x601a('0x22')],_0x601a('0x25'));}}}}if(this[_0x601a('0xf')][_0x28c8ff[_0x601a('0x22')]]){this[_0x601a('0x21')][_0x28c8ff[_0x601a('0x22')]]={};this['channels'][_0x28c8ff[_0x601a('0x22')]]['channel']=_0x28c8ff[_0x601a('0x26')];logger[_0x601a('0x24')](_0x28c8ff[_0x601a('0x22')],_0x601a('0x25'));}};Fax['prototype']['syncVarSet']=function(_0x599253){if(this[_0x601a('0x21')][_0x599253[_0x601a('0x22')]]){for(var _0x259ba2 in _0x599253[_0x601a('0x27')]){if(_0x599253['variable'][_0x601a('0x28')](_0x259ba2)){this[_0x601a('0x21')][_0x599253[_0x601a('0x22')]][_0x259ba2]=_0x599253['value'];}}}};Fax[_0x601a('0x1d')][_0x601a('0x29')]=function(_0x180b12){if(this[_0x601a('0x21')][_0x180b12[_0x601a('0x22')]]){this['channels'][_0x180b12['uniqueid']][_0x601a('0x2a')]=_0x180b12[_0x601a('0x2a')];this['channels'][_0x180b12[_0x601a('0x22')]][_0x601a('0x2b')]=_0x180b12['channelstatedesc'];}};Fax[_0x601a('0x1d')]['syncNewExten']=function(_0x3751f0){if(this[_0x601a('0x21')][_0x3751f0[_0x601a('0x22')]]){for(var _0x2b8a3f in _0x3751f0[_0x601a('0x27')]){if(_0x3751f0[_0x601a('0x27')][_0x601a('0x28')](_0x2b8a3f)){this['channels'][_0x3751f0[_0x601a('0x22')]][_0x2b8a3f]=_0x3751f0[_0x601a('0x2c')];}}}};Fax[_0x601a('0x1d')]['syncFaxStatus']=function(_0x597840){if(this['channels'][_0x597840[_0x601a('0x22')]]){this['channels'][_0x597840[_0x601a('0x22')]][_0x601a('0x2d')]=_0x597840[_0x601a('0x2d')];this['channels'][_0x597840[_0x601a('0x22')]]['status']=_0x597840[_0x601a('0x2e')];this[_0x601a('0x21')][_0x597840['uniqueid']][_0x601a('0x20')]=_0x597840[_0x601a('0x20')];this[_0x601a('0x21')][_0x597840[_0x601a('0x22')]][_0x601a('0x2f')]=_0x597840['filename'];logger[_0x601a('0x24')](_0x597840['uniqueid'],_0x601a('0x30'));}};Fax['prototype'][_0x601a('0x19')]=function(_0x327bec){var _0x2a4dc5=this;if(this['channels'][_0x327bec[_0x601a('0x22')]]){var _0x2ee244=this[_0x601a('0x21')][_0x327bec[_0x601a('0x22')]]['id'];this['channels'][_0x327bec[_0x601a('0x22')]][_0x601a('0x31')]=_0x327bec[_0x601a('0x31')];this[_0x601a('0x21')][_0x327bec['uniqueid']][_0x601a('0x32')]=_0x327bec['pagestransferred'];this['channels'][_0x327bec['uniqueid']][_0x601a('0x20')]=_0x327bec[_0x601a('0x20')];this[_0x601a('0x21')][_0x327bec['uniqueid']]['resolution']=_0x327bec[_0x601a('0x33')];this[_0x601a('0x21')][_0x327bec[_0x601a('0x22')]][_0x601a('0x34')]=_0x327bec['transferrate'];this[_0x601a('0x21')][_0x327bec['uniqueid']]['filename']=_0x327bec[_0x601a('0x2f')];this[_0x601a('0x21')][_0x327bec['uniqueid']]['calleridnum']=_0x327bec['calleridnum'];if(this[_0x601a('0x21')][_0x327bec[_0x601a('0x22')]][_0x601a('0x32')]>0x0){tiff2pdf(_0x327bec[_0x601a('0x2f')],_0x601a('0x35'),function(_0x5e7ce4){logger[_0x601a('0x24')](_0x327bec[_0x601a('0x22')],_0x601a('0x36'),_0x5e7ce4[_0x601a('0x37')]);attachment['create']({'name':path[_0x601a('0x38')](_0x327bec['filename'])['name'],'basename':path[_0x601a('0x38')](_0x327bec[_0x601a('0x2f')])[_0x601a('0x23')]+_0x601a('0x39'),'type':_0x601a('0x3a')})[_0x601a('0x3b')](function(_0x11f11a){faxAccount[_0x601a('0x3c')](_0x2ee244,{'from':_0x327bec[_0x601a('0x3d')],'mapKey':'fax','body':path[_0x601a('0x38')](_0x327bec[_0x601a('0x2f')])[_0x601a('0x23')]+_0x601a('0x39'),'AttachmentId':_0x11f11a['id']})[_0x601a('0x3e')](function(_0x3d31e7){logger[_0x601a('0x3f')](_0x327bec[_0x601a('0x22')],_0x601a('0x40'),JSON[_0x601a('0x41')](_0x3d31e7));});})[_0x601a('0x3e')](function(_0x166410){logger[_0x601a('0x3f')](_0x327bec['uniqueid'],_0x601a('0x42'),JSON[_0x601a('0x41')](_0x166410));});});}logger[_0x601a('0x24')](_0x327bec[_0x601a('0x22')],'\x20receiveFax\x20');}};Fax['prototype'][_0x601a('0x43')]=function(_0x2bf138){if(this[_0x601a('0xf')][_0x2bf138[_0x601a('0x22')]]){_['merge'](this[_0x601a('0x21')][_0x2bf138[_0x601a('0x22')]],_['pick'](_0x2bf138,[_0x601a('0x44'),_0x601a('0x45')]));}};function updateStatus(_0xb44517){if(_0xb44517['AttachmentId']){faxMessage[_0x601a('0x46')](_0xb44517[_0x601a('0x47')],{'failMessage':_0x601a('0x48')})[_0x601a('0x3b')](function(_0xb5b7fc){ut[_0x601a('0x49')]('[Fax][Message][Error][Updated]',_0xb5b7fc);})['catch'](function(_0x442267){ut[_0x601a('0x49')](_0x601a('0x4a'),_0x442267);});}else{ut['logger'](_0x601a('0x4b'));}}Fax[_0x601a('0x1d')][_0x601a('0x4c')]=function(_0x30dc96,_0x1fc1f5,_0x1d2d39){var _0x4c258b=this;var _0x4cf07e={};if(_0x1fc1f5){_0x4cf07e={'read':_0x1fc1f5};}else{_0x4cf07e={'failMessage':_0x1d2d39};}if(this[_0x601a('0xf')][_0x30dc96][_0x601a('0x47')]){faxMessage[_0x601a('0x46')](this[_0x601a('0xf')][_0x30dc96]['AttachmentId'],_0x4cf07e)[_0x601a('0x3b')](function(_0xfdba2d){ut[_0x601a('0x49')](_0x601a('0x4d'),_0xfdba2d);})[_0x601a('0x3e')](function(_0x53df02){ut[_0x601a('0x49')](_0x601a('0x4e'),_0x53df02);})['finally'](function(){delete _0x4c258b[_0x601a('0x21')][_0x30dc96];delete _0x4c258b[_0x601a('0xf')][_0x30dc96];});}else{ut['logger'](_0x601a('0x4f'));this[_0x601a('0x50')](_0x30dc96);delete this[_0x601a('0xf')][_0x30dc96];}};Fax[_0x601a('0x1d')]['syncHangup']=function(_0x38637e){var _0x24e37f=this;if(this[_0x601a('0x21')][_0x38637e[_0x601a('0x22')]]){if(this['actions'][_0x38637e['uniqueid']]){this[_0x601a('0x21')][_0x38637e[_0x601a('0x22')]]['id']=this[_0x601a('0xf')][_0x38637e[_0x601a('0x22')]]['id'];this[_0x601a('0x21')][_0x38637e['uniqueid']][_0x601a('0x23')]=this[_0x601a('0xf')][_0x38637e[_0x601a('0x22')]]['name'];}logger['info'](_0x38637e[_0x601a('0x22')],this[_0x601a('0xf')][_0x38637e['uniqueid']]?'\x20hangup\x20sendFile\x20':'\x20hangup\x20faxRiceive\x20',JSON['stringify'](this[_0x601a('0x21')][_0x38637e['uniqueid']]));if(this[_0x601a('0xf')][_0x38637e[_0x601a('0x22')]]){if(this[_0x601a('0x21')][_0x38637e[_0x601a('0x22')]][_0x601a('0x51')]>0x0&&this[_0x601a('0x21')][_0x38637e['uniqueid']]['faxstatus']===_0x601a('0x52')){this[_0x601a('0x4c')](_0x38637e[_0x601a('0x22')],!![]);}else{this[_0x601a('0x4c')](_0x38637e[_0x601a('0x22')],![],this['channels'][_0x38637e[_0x601a('0x22')]]['faxstatusstring']?_0x601a('0x53')+this[_0x601a('0x21')][_0x38637e[_0x601a('0x22')]][_0x601a('0x54')]:'SENDING\x20FAILED');}}}};Fax[_0x601a('0x1d')]['send']=function(_0x4c9cca){var _0x28863b=this;return new BPromise(function(_0x5b00a6,_0x121ead){_0x28863b[_0x601a('0x55')](_0x4c9cca,_0x28863b[_0x601a('0xd')][_0x4c9cca['FaxAccountId']])[_0x601a('0x3b')](function(_0xf5d701){ut[_0x601a('0x49')](_0x601a('0x56'),_0xf5d701);_0x5b00a6(ut[_0x601a('0x37')]('Fax\x20received'));})[_0x601a('0x3e')](function(_0x37dfbd){ut['logger'](_0x601a('0x57'),_0x37dfbd);updateStatus(_0x4c9cca);_0x121ead(ut[_0x601a('0x37')](_0x601a('0x58')));});});};Fax[_0x601a('0x1d')][_0x601a('0x59')]=function(_0x8673e0){var _0x28c046=this;return new BPromise(function(_0x389da6,_0xc28c42){var _0x480263=_0x28c046[_0x601a('0x5a')](_0x28c046['faxAccounts'][_0x8673e0[_0x601a('0x5b')]][_0x601a('0x5c')],_0x8673e0);if(_0x480263[_0x601a('0x5d')]){_0x389da6(ut['message'](_0x601a('0x5e')));}else{_0xc28c42(ut['message'](_0x480263[_0x601a('0x37')]));}});};function originate(_0x146b13,_0x3fb5b8,_0x2e4589){return new BPromise(function(_0x3e96f9,_0x3f26a8){if(_0x2e4589){var _0x2b5b4a=util[_0x601a('0x5f')](_0x601a('0x60'),path[_0x601a('0x38')](_0x146b13[_0x601a('0x3')])['name'],_0x146b13['path']);gs['execute'](_0x2b5b4a)[_0x601a('0x3b')](function(){_0x146b13[_0x601a('0x3')]=util['format']('%s/%s.tif',path[_0x601a('0x38')](_0x146b13[_0x601a('0x3')])[_0x601a('0x61')],path['parse'](_0x146b13['path'])[_0x601a('0x23')]);_0x3fb5b8[_0x601a('0x62')]=_0x146b13[_0x601a('0x3')];ut[_0x601a('0x49')](_0x601a('0x63'),'');ami[_0x601a('0x64')](ut[_0x601a('0x65')](_0x146b13,_0x3fb5b8))[_0x601a('0x3b')](function(_0x28e667){_0x3e96f9(_0x28e667);})[_0x601a('0x3e')](function(_0x26a361){_0x3f26a8(_0x26a361);});})[_0x601a('0x3e')](function(_0x26f6e4){_0x3f26a8(_0x26f6e4);});}else{ami[_0x601a('0x64')](ut[_0x601a('0x65')](_0x146b13,_0x3fb5b8))[_0x601a('0x3b')](function(_0x103a3f){_0x3e96f9(_0x103a3f);})[_0x601a('0x3e')](function(_0x434199){_0x3f26a8(_0x434199);});}});}Fax[_0x601a('0x1d')][_0x601a('0x55')]=function(_0x41a0ed,_0xf427c6){var _0x52aa75=this;return new BPromise(function(_0x2429ec,_0x3fbef9){var _0x36a4b7=uuid['v4']();var _0x48a666=ut[_0x601a('0x66')](_0x41a0ed,_0xf427c6);_0x52aa75['actions'][_0x36a4b7]=new Action(_0x36a4b7,_0xf427c6,_0x41a0ed);var _0x27eeac=_0x52aa75[_0x601a('0xf')][_0x36a4b7];if(path[_0x601a('0x38')](_0x41a0ed['path'])[_0x601a('0x67')]===_0x601a('0x39')){originate(_0x27eeac,_0x48a666,!![])['then'](function(_0x5931da){_0x2429ec(_0x5931da);})[_0x601a('0x3e')](function(_0x1c3a4a){_0x3fbef9(_0x1c3a4a);});}else{originate(_0x27eeac,_0x48a666,![])[_0x601a('0x3b')](function(_0x992d04){_0x2429ec(_0x992d04);})[_0x601a('0x3e')](function(_0x2cda9b){_0x3fbef9(_0x2cda9b);});}});};Fax[_0x601a('0x1d')][_0x601a('0x68')]=function(_0xbe5d79){return!_['isNil'](_0xbe5d79)&&!_[_0x601a('0x69')](_0xbe5d79['name'])&&!_[_0x601a('0x69')](_0xbe5d79['active'])&&_0xbe5d79['active']&&!_[_0x601a('0x69')](this[_0x601a('0xe')][util[_0x601a('0x5f')](_0x601a('0x6a'),_0xbe5d79[_0x601a('0x23')])])&&!_[_0x601a('0x69')](this[_0x601a('0xe')][util['format'](_0x601a('0x6a'),_0xbe5d79[_0x601a('0x23')])][_0x601a('0x2e')])&&(this[_0x601a('0xe')][util['format'](_0x601a('0x6a'),_0xbe5d79[_0x601a('0x23')])][_0x601a('0x2e')]==='reachable'||this[_0x601a('0xe')][util[_0x601a('0x5f')]('SIP/%s',_0xbe5d79[_0x601a('0x23')])][_0x601a('0x2e')]==='unmonitored');};Fax[_0x601a('0x1d')][_0x601a('0x5a')]=function(_0x272dc6,_0x193307){if(!this[_0x601a('0x68')](_0x272dc6)){ut[_0x601a('0x49')]('[Fax][checkTrunk][Trunk\x20not\x20working\x20correctly]',_[_0x601a('0x69')](_0x272dc6)?'':_0x272dc6['name']+_0x601a('0x6b'));return{'isValid':![],'message':_0x601a('0x6c')};}if(_[_0x601a('0x69')](_0x193307[_0x601a('0x6')])){ut[_0x601a('0x49')](_0x601a('0x6d'),JSON[_0x601a('0x41')](_0x193307));return{'isValid':![],'message':'Empty\x20Fax'};}if(_['isNil'](_0x193307[_0x601a('0x3')])){ut['logger'](_0x601a('0x6e'),JSON[_0x601a('0x41')](_0x193307));return{'isValid':![],'message':_0x601a('0x6f')};}return{'isValid':!![],'message':'Is\x20Valid'};};Fax['prototype'][_0x601a('0x50')]=function(_0x531ed1,_0x484c4e=0x2710){if(this[_0x601a('0x21')][_0x531ed1]){setTimeout(()=>{delete this[_0x601a('0x21')][_0x531ed1];},_0x484c4e);}};module[_0x601a('0x70')]=Fax; \ No newline at end of file +var _0x6254=['gs\x20-q\x20-dNOPAUSE\x20-dBATCH\x20-sDEVICE=tiffg4\x20-sPAPERSIZE=letter\x20-sOutputFile=/var/opt/motion2/server/files/attachments/%s.tif\x20\x20%s\x20-c\x20quit','execute','%s/%s.tif','XMF-PATH','Convert\x20pdf\x20to\x20tif','Action','variablesAction','ext','isTrunkReachable','isNil','active','SIP/%s','reachable','[Fax][checkTrunk][Trunk\x20not\x20working\x20correctly]','\x20Trunk\x20is\x20not\x20active','Trunk\x20not\x20working\x20correctly','fax','[Fax][checkTrunk][Empty\x20path]','deleteChannelAfterTimeout','util','bluebird','uuid','moment','path','tiff2pdf','./util/gs','../../../config/logger','../ami','./channel','./util/util','./action','../rpc/faxAccount','../rpc/attachment','channels','faxAccounts','trunks','actions','syncNewchannel','bind','varset','syncVarSet','newstate','syncNewState','newexten','syncNewExten','faxstatus','syncFaxStatus','syncReceiveFax','hangup','syncHangup','originateresponse','prototype','context','hasOwnProperty','exten','localstationid','uniqueid','channel','name','info','\x20syncNewchannel\x20','variable','channelstate','channelstatedesc','value','operation','status','filename','\x20syncFaxStatus\x20','remotestationid','pagestransferred','resolution','transferrate','calleridnum','/var/opt/motion2/server/files/attachments/','\x20result\x20conversion\x20file\x20','message','parse','.pdf','then','notify','\x20notify\x20','stringify','catch','error','\x20receiveFax\x20','syncOriginateResponse','merge','response','reason','update','SENDING\x20FAILED\x20','logger','[Fax][Message][Error][Updated]','[Fax][Message][Error][NoUpdate1]','[Fax][Message][Error][NoUpdate2]','AttachmentId','[Fax][Message][Updated]','[Fax][Message][NoUpdate1]','finally','[Fax][Message][NoUpdate2]','\x20hangup\x20faxRiceive\x20','faxpages','SUCCESS','updateStatus','faxstatusstring','SENDING\x20FAILED:\x20','SENDING\x20FAILED','execOriginate','FaxAccountId','[Fax][execOriginate][success]','[Fax][execOriginate][failure]','Fax\x20failed','checkTrunk','Trunk','isValid','Trunk\x20Reachable','format'];(function(_0x3a3b27,_0xd6b03a){var _0x42289f=function(_0x5487ae){while(--_0x5487ae){_0x3a3b27['push'](_0x3a3b27['shift']());}};_0x42289f(++_0xd6b03a);}(_0x6254,0x89));var _0x4625=function(_0x55fb83,_0x1d3856){_0x55fb83=_0x55fb83-0x0;var _0x59a87a=_0x6254[_0x55fb83];return _0x59a87a;};'use strict';var util=require(_0x4625('0x0'));var _=require('lodash');var BPromise=require(_0x4625('0x1'));var uuid=require(_0x4625('0x2'));var moment=require(_0x4625('0x3'));var path=require(_0x4625('0x4'));var tiff2pdf=require(_0x4625('0x5'));var gs=require(_0x4625('0x6'));var logger=require(_0x4625('0x7'))('fax');var ami=require(_0x4625('0x8'));var rpcDb=require('./rpcDb');var Channel=require(_0x4625('0x9'));var ut=require(_0x4625('0xa'));var Action=require(_0x4625('0xb'));var faxAccount=require(_0x4625('0xc'));var attachment=require(_0x4625('0xd'));var faxMessage=require('../rpc/faxMessage');function Fax(_0x513f8a){this[_0x4625('0xe')]={};this['faxAccounts']=_0x513f8a[_0x4625('0xf')];this[_0x4625('0x10')]=_0x513f8a[_0x4625('0x10')];this[_0x4625('0x11')]={};ami['on']('newchannel',this[_0x4625('0x12')][_0x4625('0x13')](this));ami['on'](_0x4625('0x14'),this[_0x4625('0x15')]['bind'](this));ami['on'](_0x4625('0x16'),this[_0x4625('0x17')][_0x4625('0x13')](this));ami['on'](_0x4625('0x18'),this[_0x4625('0x19')][_0x4625('0x13')](this));ami['on'](_0x4625('0x1a'),this[_0x4625('0x1b')]['bind'](this));ami['on']('receivefax',this[_0x4625('0x1c')][_0x4625('0x13')](this));ami['on'](_0x4625('0x1d'),this[_0x4625('0x1e')]['bind'](this));ami['on'](_0x4625('0x1f'),this['syncOriginateResponse'][_0x4625('0x13')](this));}Fax[_0x4625('0x20')]['syncNewchannel']=function(_0x5f4891){if(_0x5f4891[_0x4625('0x21')]==='from-voip-provider'){for(var _0x5a8b04 in this[_0x4625('0xf')]){if(this[_0x4625('0xf')][_0x4625('0x22')](_0x5a8b04)){if(_0x5f4891[_0x4625('0x23')]===this['faxAccounts'][_0x5a8b04][_0x4625('0x24')]){this['channels'][_0x5f4891[_0x4625('0x25')]]={};this[_0x4625('0xe')][_0x5f4891[_0x4625('0x25')]]['channel']=_0x5f4891[_0x4625('0x26')];this[_0x4625('0xe')][_0x5f4891[_0x4625('0x25')]]['id']=this['faxAccounts'][_0x5a8b04]['id'];this[_0x4625('0xe')][_0x5f4891[_0x4625('0x25')]][_0x4625('0x27')]=this['faxAccounts'][_0x5a8b04][_0x4625('0x27')];logger[_0x4625('0x28')](_0x5f4891[_0x4625('0x25')],_0x4625('0x29'));}}}}if(this['actions'][_0x5f4891[_0x4625('0x25')]]){this[_0x4625('0xe')][_0x5f4891[_0x4625('0x25')]]={};this[_0x4625('0xe')][_0x5f4891['uniqueid']][_0x4625('0x26')]=_0x5f4891['channel'];logger['info'](_0x5f4891['uniqueid'],_0x4625('0x29'));}};Fax[_0x4625('0x20')][_0x4625('0x15')]=function(_0x2ff572){if(this[_0x4625('0xe')][_0x2ff572[_0x4625('0x25')]]){for(var _0xa4e23b in _0x2ff572[_0x4625('0x2a')]){if(_0x2ff572[_0x4625('0x2a')][_0x4625('0x22')](_0xa4e23b)){this[_0x4625('0xe')][_0x2ff572['uniqueid']][_0xa4e23b]=_0x2ff572['value'];}}}};Fax[_0x4625('0x20')][_0x4625('0x17')]=function(_0x5327a8){if(this['channels'][_0x5327a8[_0x4625('0x25')]]){this[_0x4625('0xe')][_0x5327a8['uniqueid']][_0x4625('0x2b')]=_0x5327a8[_0x4625('0x2b')];this['channels'][_0x5327a8[_0x4625('0x25')]][_0x4625('0x2c')]=_0x5327a8['channelstatedesc'];}};Fax['prototype'][_0x4625('0x19')]=function(_0x1d4220){if(this[_0x4625('0xe')][_0x1d4220[_0x4625('0x25')]]){for(var _0x356c8f in _0x1d4220[_0x4625('0x2a')]){if(_0x1d4220['variable'][_0x4625('0x22')](_0x356c8f)){this['channels'][_0x1d4220[_0x4625('0x25')]][_0x356c8f]=_0x1d4220[_0x4625('0x2d')];}}}};Fax[_0x4625('0x20')][_0x4625('0x1b')]=function(_0x1596cc){if(this[_0x4625('0xe')][_0x1596cc[_0x4625('0x25')]]){this[_0x4625('0xe')][_0x1596cc[_0x4625('0x25')]]['operation']=_0x1596cc[_0x4625('0x2e')];this['channels'][_0x1596cc[_0x4625('0x25')]][_0x4625('0x2f')]=_0x1596cc['status'];this[_0x4625('0xe')][_0x1596cc[_0x4625('0x25')]][_0x4625('0x24')]=_0x1596cc['localstationid'];this['channels'][_0x1596cc[_0x4625('0x25')]]['filename']=_0x1596cc[_0x4625('0x30')];logger[_0x4625('0x28')](_0x1596cc['uniqueid'],_0x4625('0x31'));}};Fax[_0x4625('0x20')][_0x4625('0x1c')]=function(_0xbd907e){var _0x446ccb=this;if(this[_0x4625('0xe')][_0xbd907e[_0x4625('0x25')]]){var _0x503c44=this[_0x4625('0xe')][_0xbd907e[_0x4625('0x25')]]['id'];this[_0x4625('0xe')][_0xbd907e[_0x4625('0x25')]]['remotestationid']=_0xbd907e[_0x4625('0x32')];this[_0x4625('0xe')][_0xbd907e[_0x4625('0x25')]]['pagestransferred']=_0xbd907e[_0x4625('0x33')];this[_0x4625('0xe')][_0xbd907e[_0x4625('0x25')]][_0x4625('0x24')]=_0xbd907e[_0x4625('0x24')];this[_0x4625('0xe')][_0xbd907e[_0x4625('0x25')]][_0x4625('0x34')]=_0xbd907e['resolution'];this['channels'][_0xbd907e[_0x4625('0x25')]][_0x4625('0x35')]=_0xbd907e[_0x4625('0x35')];this[_0x4625('0xe')][_0xbd907e[_0x4625('0x25')]]['filename']=_0xbd907e[_0x4625('0x30')];this[_0x4625('0xe')][_0xbd907e[_0x4625('0x25')]]['calleridnum']=_0xbd907e[_0x4625('0x36')];if(this['channels'][_0xbd907e[_0x4625('0x25')]][_0x4625('0x33')]>0x0){tiff2pdf(_0xbd907e['filename'],_0x4625('0x37'),function(_0x3b2b1b){logger[_0x4625('0x28')](_0xbd907e['uniqueid'],_0x4625('0x38'),_0x3b2b1b[_0x4625('0x39')]);attachment['create']({'name':path[_0x4625('0x3a')](_0xbd907e[_0x4625('0x30')])[_0x4625('0x27')],'basename':path['parse'](_0xbd907e[_0x4625('0x30')])['name']+_0x4625('0x3b'),'type':'application/pdf'})[_0x4625('0x3c')](function(_0x5179ea){faxAccount[_0x4625('0x3d')](_0x503c44,{'from':_0xbd907e[_0x4625('0x36')],'mapKey':'fax','body':path[_0x4625('0x3a')](_0xbd907e[_0x4625('0x30')])[_0x4625('0x27')]+_0x4625('0x3b'),'AttachmentId':_0x5179ea['id']})['catch'](function(_0x1dc8a9){logger['error'](_0xbd907e[_0x4625('0x25')],_0x4625('0x3e'),JSON[_0x4625('0x3f')](_0x1dc8a9));});})[_0x4625('0x40')](function(_0x394396){logger[_0x4625('0x41')](_0xbd907e['uniqueid'],_0x4625('0x42'),JSON[_0x4625('0x3f')](_0x394396));});});}logger[_0x4625('0x28')](_0xbd907e[_0x4625('0x25')],_0x4625('0x42'));}};Fax['prototype'][_0x4625('0x43')]=function(_0x64f5ee){if(this[_0x4625('0x11')][_0x64f5ee[_0x4625('0x25')]]){_[_0x4625('0x44')](this[_0x4625('0xe')][_0x64f5ee[_0x4625('0x25')]],_['pick'](_0x64f5ee,[_0x4625('0x45'),_0x4625('0x46')]));}};function updateStatus(_0x2bb490){if(_0x2bb490['AttachmentId']){faxMessage[_0x4625('0x47')](_0x2bb490['AttachmentId'],{'failMessage':_0x4625('0x48')})[_0x4625('0x3c')](function(_0x1f6eef){ut[_0x4625('0x49')](_0x4625('0x4a'),_0x1f6eef);})[_0x4625('0x40')](function(_0x15724a){ut[_0x4625('0x49')](_0x4625('0x4b'),_0x15724a);});}else{ut[_0x4625('0x49')](_0x4625('0x4c'));}}Fax[_0x4625('0x20')]['updateStatus']=function(_0x1fcd9e,_0x5d940b,_0x109da3){var _0x229b7b=this;var _0x14d89d={};if(_0x5d940b){_0x14d89d={'read':_0x5d940b};}else{_0x14d89d={'failMessage':_0x109da3};}if(this['actions'][_0x1fcd9e][_0x4625('0x4d')]){faxMessage['update'](this[_0x4625('0x11')][_0x1fcd9e][_0x4625('0x4d')],_0x14d89d)[_0x4625('0x3c')](function(_0x35c677){ut[_0x4625('0x49')](_0x4625('0x4e'),_0x35c677);})[_0x4625('0x40')](function(_0x1c1241){ut[_0x4625('0x49')](_0x4625('0x4f'),_0x1c1241);})[_0x4625('0x50')](function(){delete _0x229b7b['channels'][_0x1fcd9e];delete _0x229b7b['actions'][_0x1fcd9e];});}else{ut['logger'](_0x4625('0x51'));this['deleteChannelAfterTimeout'](_0x1fcd9e);delete this['actions'][_0x1fcd9e];}};Fax[_0x4625('0x20')]['syncHangup']=function(_0x5af03d){var _0x4bf2c6=this;if(this['channels'][_0x5af03d[_0x4625('0x25')]]){if(this[_0x4625('0x11')][_0x5af03d['uniqueid']]){this[_0x4625('0xe')][_0x5af03d['uniqueid']]['id']=this[_0x4625('0x11')][_0x5af03d[_0x4625('0x25')]]['id'];this[_0x4625('0xe')][_0x5af03d[_0x4625('0x25')]][_0x4625('0x27')]=this[_0x4625('0x11')][_0x5af03d[_0x4625('0x25')]][_0x4625('0x27')];}logger[_0x4625('0x28')](_0x5af03d[_0x4625('0x25')],this['actions'][_0x5af03d[_0x4625('0x25')]]?'\x20hangup\x20sendFile\x20':_0x4625('0x52'),JSON[_0x4625('0x3f')](this[_0x4625('0xe')][_0x5af03d[_0x4625('0x25')]]));if(this['actions'][_0x5af03d[_0x4625('0x25')]]){if(this[_0x4625('0xe')][_0x5af03d[_0x4625('0x25')]][_0x4625('0x53')]>0x0&&this['channels'][_0x5af03d['uniqueid']][_0x4625('0x1a')]===_0x4625('0x54')){this[_0x4625('0x55')](_0x5af03d[_0x4625('0x25')],!![]);}else{this[_0x4625('0x55')](_0x5af03d[_0x4625('0x25')],![],this[_0x4625('0xe')][_0x5af03d['uniqueid']][_0x4625('0x56')]?_0x4625('0x57')+this[_0x4625('0xe')][_0x5af03d[_0x4625('0x25')]]['faxstatusstring']:_0x4625('0x58'));}}}};Fax[_0x4625('0x20')]['send']=function(_0x22db3b){var _0x33543c=this;return new BPromise(function(_0x226333,_0x18f350){_0x33543c[_0x4625('0x59')](_0x22db3b,_0x33543c[_0x4625('0xf')][_0x22db3b[_0x4625('0x5a')]])[_0x4625('0x3c')](function(_0x1d26ed){ut[_0x4625('0x49')](_0x4625('0x5b'),_0x1d26ed);_0x226333(ut[_0x4625('0x39')]('Fax\x20received'));})[_0x4625('0x40')](function(_0x1edaa3){ut['logger'](_0x4625('0x5c'),_0x1edaa3);updateStatus(_0x22db3b);_0x18f350(ut[_0x4625('0x39')](_0x4625('0x5d')));});});};Fax[_0x4625('0x20')]['checkAfterSend']=function(_0xdf8bd6){var _0x3594ed=this;return new BPromise(function(_0x296fbe,_0x37fca2){var _0x22c521=_0x3594ed[_0x4625('0x5e')](_0x3594ed[_0x4625('0xf')][_0xdf8bd6[_0x4625('0x5a')]][_0x4625('0x5f')],_0xdf8bd6);if(_0x22c521[_0x4625('0x60')]){_0x296fbe(ut[_0x4625('0x39')](_0x4625('0x61')));}else{_0x37fca2(ut['message'](_0x22c521[_0x4625('0x39')]));}});};function originate(_0x19857c,_0x3d9aa7,_0x2fe962){return new BPromise(function(_0x37cd8c,_0x187dd3){if(_0x2fe962){var _0xff98cc=util[_0x4625('0x62')](_0x4625('0x63'),path[_0x4625('0x3a')](_0x19857c[_0x4625('0x4')])[_0x4625('0x27')],_0x19857c[_0x4625('0x4')]);gs[_0x4625('0x64')](_0xff98cc)[_0x4625('0x3c')](function(){_0x19857c[_0x4625('0x4')]=util['format'](_0x4625('0x65'),path[_0x4625('0x3a')](_0x19857c[_0x4625('0x4')])['dir'],path[_0x4625('0x3a')](_0x19857c[_0x4625('0x4')])['name']);_0x3d9aa7[_0x4625('0x66')]=_0x19857c[_0x4625('0x4')];ut[_0x4625('0x49')](_0x4625('0x67'),'');ami['Action'](ut['variablesAction'](_0x19857c,_0x3d9aa7))[_0x4625('0x3c')](function(_0x4f87db){_0x37cd8c(_0x4f87db);})[_0x4625('0x40')](function(_0x42f047){_0x187dd3(_0x42f047);});})[_0x4625('0x40')](function(_0x9d0655){_0x187dd3(_0x9d0655);});}else{ami[_0x4625('0x68')](ut[_0x4625('0x69')](_0x19857c,_0x3d9aa7))['then'](function(_0x5f304c){_0x37cd8c(_0x5f304c);})[_0x4625('0x40')](function(_0x229d2e){_0x187dd3(_0x229d2e);});}});}Fax['prototype'][_0x4625('0x59')]=function(_0x52e996,_0x1e7ca7){var _0x46baa1=this;return new BPromise(function(_0x5cf2a3,_0x5e3a7f){var _0x32009b=uuid['v4']();var _0x90d936=ut['addVariables'](_0x52e996,_0x1e7ca7);_0x46baa1[_0x4625('0x11')][_0x32009b]=new Action(_0x32009b,_0x1e7ca7,_0x52e996);var _0x30585c=_0x46baa1[_0x4625('0x11')][_0x32009b];if(path[_0x4625('0x3a')](_0x52e996[_0x4625('0x4')])[_0x4625('0x6a')]===_0x4625('0x3b')){originate(_0x30585c,_0x90d936,!![])[_0x4625('0x3c')](function(_0x38ad4d){_0x5cf2a3(_0x38ad4d);})[_0x4625('0x40')](function(_0x56be6b){_0x5e3a7f(_0x56be6b);});}else{originate(_0x30585c,_0x90d936,![])[_0x4625('0x3c')](function(_0x344bf0){_0x5cf2a3(_0x344bf0);})[_0x4625('0x40')](function(_0x55a89d){_0x5e3a7f(_0x55a89d);});}});};Fax['prototype'][_0x4625('0x6b')]=function(_0x511631){return!_[_0x4625('0x6c')](_0x511631)&&!_[_0x4625('0x6c')](_0x511631['name'])&&!_[_0x4625('0x6c')](_0x511631['active'])&&_0x511631[_0x4625('0x6d')]&&!_[_0x4625('0x6c')](this[_0x4625('0x10')][util[_0x4625('0x62')](_0x4625('0x6e'),_0x511631[_0x4625('0x27')])])&&!_['isNil'](this['trunks'][util[_0x4625('0x62')](_0x4625('0x6e'),_0x511631[_0x4625('0x27')])][_0x4625('0x2f')])&&(this[_0x4625('0x10')][util['format'](_0x4625('0x6e'),_0x511631['name'])]['status']===_0x4625('0x6f')||this['trunks'][util[_0x4625('0x62')](_0x4625('0x6e'),_0x511631[_0x4625('0x27')])][_0x4625('0x2f')]==='unmonitored');};Fax[_0x4625('0x20')]['checkTrunk']=function(_0x139e59,_0x7be045){if(!this[_0x4625('0x6b')](_0x139e59)){ut[_0x4625('0x49')](_0x4625('0x70'),_[_0x4625('0x6c')](_0x139e59)?'':_0x139e59[_0x4625('0x27')]+_0x4625('0x71'));return{'isValid':![],'message':_0x4625('0x72')};}if(_[_0x4625('0x6c')](_0x7be045[_0x4625('0x73')])){ut[_0x4625('0x49')]('[Fax][checkTrunk][Empty\x20Fax]',JSON[_0x4625('0x3f')](_0x7be045));return{'isValid':![],'message':'Empty\x20Fax'};}if(_[_0x4625('0x6c')](_0x7be045[_0x4625('0x4')])){ut['logger'](_0x4625('0x74'),JSON[_0x4625('0x3f')](_0x7be045));return{'isValid':![],'message':'Empty\x20path'};}return{'isValid':!![],'message':'Is\x20Valid'};};Fax[_0x4625('0x20')][_0x4625('0x75')]=function(_0x2bf8ae,_0x31b50c=0x2710){if(this[_0x4625('0xe')][_0x2bf8ae]){setTimeout(()=>{delete this['channels'][_0x2bf8ae];},_0x31b50c);}};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 056ba9d..200a886 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 _0x5695=['resolve','catch','util','bluebird','../../../config/logger','preview','lodash','../rpc/faxAccount','notify'];(function(_0x30a1e1,_0x5743be){var _0x44b892=function(_0x302dbf){while(--_0x302dbf){_0x30a1e1['push'](_0x30a1e1['shift']());}};_0x44b892(++_0x5743be);}(_0x5695,0xad));var _0x5569=function(_0x5da8db,_0x5c2103){_0x5da8db=_0x5da8db-0x0;var _0x1eb753=_0x5695[_0x5da8db];return _0x1eb753;};'use strict';var util=require(_0x5569('0x0'));var BPromise=require(_0x5569('0x1'));var logger=require(_0x5569('0x2'))(_0x5569('0x3'));var _=require(_0x5569('0x4'));var faxAccount=require(_0x5569('0x5'));function loggerCatch(_0x53461d){return function(_0xd3ab61){logger['error'](_0x53461d,util['inspect'](_0xd3ab61,{'showHidden':![],'depth':null}));};}exports[_0x5569('0x6')]=function(_0x3e86e8,_0x2aca21){return BPromise[_0x5569('0x7')]()['then'](faxAccount[_0x5569('0x6')](_0x3e86e8,_0x2aca21))[_0x5569('0x8')](loggerCatch('[Notify]\x20'));}; \ No newline at end of file +var _0x68a9=['../../../config/logger','preview','lodash','../rpc/faxAccount','error','inspect','notify','resolve','then','catch','bluebird'];(function(_0x326749,_0x41d490){var _0x5ac6cc=function(_0x2dfb01){while(--_0x2dfb01){_0x326749['push'](_0x326749['shift']());}};_0x5ac6cc(++_0x41d490);}(_0x68a9,0x83));var _0x968a=function(_0x5c3c0b,_0x4ee35e){_0x5c3c0b=_0x5c3c0b-0x0;var _0x52ecd2=_0x68a9[_0x5c3c0b];return _0x52ecd2;};'use strict';var util=require('util');var BPromise=require(_0x968a('0x0'));var logger=require(_0x968a('0x1'))(_0x968a('0x2'));var _=require(_0x968a('0x3'));var faxAccount=require(_0x968a('0x4'));function loggerCatch(_0x98f07e){return function(_0x4364a7){logger[_0x968a('0x5')](_0x98f07e,util[_0x968a('0x6')](_0x4364a7,{'showHidden':![],'depth':null}));};}exports[_0x968a('0x7')]=function(_0x585a59,_0x1d455e){return BPromise[_0x968a('0x8')]()[_0x968a('0x9')](faxAccount[_0x968a('0x7')](_0x585a59,_0x1d455e))[_0x968a('0xa')](loggerCatch('[Notify]\x20'));}; \ 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 c8f594a..b18fd6e 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 _0x2890=['exec','execute','info','Exec\x20gs','inspect','util','../../../../config/logger','bluebird','child_process'];(function(_0x8c43de,_0x90ff31){var _0xa6591b=function(_0x469716){while(--_0x469716){_0x8c43de['push'](_0x8c43de['shift']());}};_0xa6591b(++_0x90ff31);}(_0x2890,0x8c));var _0x0289=function(_0x1cef07,_0x26684a){_0x1cef07=_0x1cef07-0x0;var _0x3437e8=_0x2890[_0x1cef07];return _0x3437e8;};'use strict';var util=require(_0x0289('0x0'));var logger=require(_0x0289('0x1'))('fax');var BPromise=require(_0x0289('0x2'));var exec=require(_0x0289('0x3'))[_0x0289('0x4')];exports[_0x0289('0x5')]=function(_0x480917){return new BPromise(function(_0x53fcbc,_0x25271f){exec(_0x480917,function(_0x3084b6,_0x46956c,_0x856d46){logger[_0x0289('0x6')](_0x0289('0x7'),_0x46956c);if(_0x3084b6){logger[_0x0289('0x6')](_0x0289('0x7'),'\x20Error\x20:',util[_0x0289('0x8')](_0x3084b6,{'showHidden':![],'depth':null}),_0x46956c,_0x856d46);_0x25271f(_0x3084b6);}_0x53fcbc(_0x46956c);});});}; \ No newline at end of file +var _0xe725=['\x20Error\x20:','inspect','util','../../../../config/logger','fax','exec','execute','info'];(function(_0x3daa86,_0x1948b8){var _0x2699f9=function(_0x58f3f6){while(--_0x58f3f6){_0x3daa86['push'](_0x3daa86['shift']());}};_0x2699f9(++_0x1948b8);}(_0xe725,0x132));var _0x5e72=function(_0xfae23b,_0x2be4ba){_0xfae23b=_0xfae23b-0x0;var _0x200640=_0xe725[_0xfae23b];return _0x200640;};'use strict';var util=require(_0x5e72('0x0'));var logger=require(_0x5e72('0x1'))(_0x5e72('0x2'));var BPromise=require('bluebird');var exec=require('child_process')[_0x5e72('0x3')];exports[_0x5e72('0x4')]=function(_0xca8dd3){return new BPromise(function(_0x5c138c,_0x18a991){exec(_0xca8dd3,function(_0x761473,_0x542bcd,_0x1411c0){logger[_0x5e72('0x5')]('Exec\x20gs',_0x542bcd);if(_0x761473){logger[_0x5e72('0x5')]('Exec\x20gs',_0x5e72('0x6'),util[_0x5e72('0x7')](_0x761473,{'showHidden':![],'depth':null}),_0x542bcd,_0x1411c0);_0x18a991(_0x761473);}_0x5c138c(_0x542bcd);});});}; \ 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 f4d0adf..07e4a53 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 _0xd6dc=['path','variablesAction','uniqueid','originate','channel','xcally-motion-fax','from-sip','headerinfo','lodash','moment','fax','message','logger','info','inspect','ecm','minrate','format','modem','gateway','faxdetect','t38timeout','localstationid'];(function(_0x21a9d9,_0x4d5ac8){var _0x46adce=function(_0xfdd336){while(--_0xfdd336){_0x21a9d9['push'](_0x21a9d9['shift']());}};_0x46adce(++_0x4d5ac8);}(_0xd6dc,0x178));var _0xcd6d=function(_0x5194d4,_0x565c55){_0x5194d4=_0x5194d4-0x0;var _0x53c786=_0xd6dc[_0x5194d4];return _0x53c786;};'use strict';var util=require('util');var _=require(_0xcd6d('0x0'));var moment=require(_0xcd6d('0x1'));var logger=require('../../../../config/logger')(_0xcd6d('0x2'));exports[_0xcd6d('0x3')]=function(_0x4a8c29){return{'message':_0x4a8c29};};exports[_0xcd6d('0x4')]=function(_0x3b1775,_0x471674){logger[_0xcd6d('0x5')](_0x3b1775,util[_0xcd6d('0x6')](_0x471674,{'showHidden':![],'depth':null}));};exports['addVariables']=function(_0x3ea64f,_0x37e185){var _0x25c444={'XMF-ECM':_0x37e185[_0xcd6d('0x7')],'XMF-HEADERINFO':_0x37e185['headerinfo'],'XMF-MINRATE':_0x37e185[_0xcd6d('0x8')],'XMF-MAXRATE':_0x37e185['maxrate'],'XMF-MODEM':util[_0xcd6d('0x9')]('\x22%s\x22',_0x37e185[_0xcd6d('0xa')]),'XMF-GATEWAY':_0x37e185[_0xcd6d('0xb')],'XMF-FAXDETECT':_0x37e185[_0xcd6d('0xc')],'XMF-T38TIMEOUT':_0x37e185[_0xcd6d('0xd')],'XMF-LOCALSTATIONID':_0x37e185[_0xcd6d('0xe')],'XMF-PATH':_0x3ea64f[_0xcd6d('0xf')]};return _0x25c444;};exports[_0xcd6d('0x10')]=function(_0x2ebf62,_0x37d9c9){return{'actionid':_0x2ebf62[_0xcd6d('0x11')],'action':_0xcd6d('0x12'),'channel':_0x2ebf62[_0xcd6d('0x13')],'Exten':_0xcd6d('0x14'),'Context':_0xcd6d('0x15'),'Priority':'1','callerid':util[_0xcd6d('0x9')]('\x22%s\x22\x20<%s>',_0x2ebf62['headerinfo']?_0x2ebf62[_0xcd6d('0x16')]:'',_0x2ebf62[_0xcd6d('0xe')]),'variable':_0x37d9c9,'timeout':0x1e*0x3e8,'async':!![],'channelid':_0x2ebf62[_0xcd6d('0x11')]};}; \ No newline at end of file +var _0x615a=['minrate','maxrate','\x22%s\x22','gateway','faxdetect','t38timeout','localstationid','path','variablesAction','originate','channel','xcally-motion-fax','format','\x22%s\x22\x20<%s>','util','lodash','../../../../config/logger','logger','info','inspect','ecm','headerinfo'];(function(_0x3c9943,_0x32a82a){var _0x1f55d5=function(_0x4adc3c){while(--_0x4adc3c){_0x3c9943['push'](_0x3c9943['shift']());}};_0x1f55d5(++_0x32a82a);}(_0x615a,0x1c6));var _0xa615=function(_0x364e2b,_0x30b028){_0x364e2b=_0x364e2b-0x0;var _0x943fef=_0x615a[_0x364e2b];return _0x943fef;};'use strict';var util=require(_0xa615('0x0'));var _=require(_0xa615('0x1'));var moment=require('moment');var logger=require(_0xa615('0x2'))('fax');exports['message']=function(_0x465891){return{'message':_0x465891};};exports[_0xa615('0x3')]=function(_0x78826d,_0x1213ec){logger[_0xa615('0x4')](_0x78826d,util[_0xa615('0x5')](_0x1213ec,{'showHidden':![],'depth':null}));};exports['addVariables']=function(_0x5da55f,_0x4eb602){var _0x3535e8={'XMF-ECM':_0x4eb602[_0xa615('0x6')],'XMF-HEADERINFO':_0x4eb602[_0xa615('0x7')],'XMF-MINRATE':_0x4eb602[_0xa615('0x8')],'XMF-MAXRATE':_0x4eb602[_0xa615('0x9')],'XMF-MODEM':util['format'](_0xa615('0xa'),_0x4eb602['modem']),'XMF-GATEWAY':_0x4eb602[_0xa615('0xb')],'XMF-FAXDETECT':_0x4eb602[_0xa615('0xc')],'XMF-T38TIMEOUT':_0x4eb602[_0xa615('0xd')],'XMF-LOCALSTATIONID':_0x4eb602[_0xa615('0xe')],'XMF-PATH':_0x5da55f[_0xa615('0xf')]};return _0x3535e8;};exports[_0xa615('0x10')]=function(_0x201429,_0x11241f){return{'actionid':_0x201429['uniqueid'],'action':_0xa615('0x11'),'channel':_0x201429[_0xa615('0x12')],'Exten':_0xa615('0x13'),'Context':'from-sip','Priority':'1','callerid':util[_0xa615('0x14')](_0xa615('0x15'),_0x201429[_0xa615('0x7')]?_0x201429[_0xa615('0x7')]:'',_0x201429[_0xa615('0xe')]),'variable':_0x11241f,'timeout':0x1e*0x3e8,'async':!![],'channelid':_0x201429['uniqueid']};}; \ No newline at end of file diff --git a/server/services/ami/index.js b/server/services/ami/index.js index 84455be..eee5032 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 _0x5f48=['initSalesforceAccounts','getSugarcrmAccounts','initSugarcrmAccounts','getFreshdeskAccounts','initFreshdeskAccounts','getDeskAccounts','initDeskAccounts','getZohoAccounts','initZohoAccounts','getVtigerAccounts','getFreshsalesAccounts','initFreshsalesAccounts','getServicenowAccounts','initServicenowAccounts','getDynamics365Accounts','initDynamics365Accounts','getCampaigns','initCampaigns','getVoiceExtensions','initVoiceExtensions','getFaxAccounts','getVoiceQueueReports','getVoiceQueueHopperHistory','getCampaignHopperHistory','getVoiceCallReports','initVoiceCallReports','catch','[index.js][initParams]','inspect','listen','sync','[index.js][main]','moment','./server','./realtime','./acw','./trigger','./preview','./fax','./rpc/user','./rpc/voiceQueue','./rpc/voiceQueueReport','./rpc/voiceCallReport','./rpc/trunk','./rpc/trigger','./rpc/template','./rpc/cmHopperHistory','./rpc/voiceExtension','./rpc/faxAccount','./rpc/integrations/salesforce','./rpc/integrations/freshdesk','./rpc/integrations/desk','./rpc/integrations/zoho','./rpc/integrations/vtiger','./rpc/integrations/servicenow','./rpc/integrations/dynamics365','../../config/logger','get','hour','resolve','then','initTelephones','getTrunks','initTrunks','getVoiceQueues','getTriggers','initTriggers','getTemplates','initTemplates','initZendeskAccounts','getSalesforceAccounts'];(function(_0x2d98f1,_0x21174b){var _0x701cc7=function(_0x24dd62){while(--_0x24dd62){_0x2d98f1['push'](_0x2d98f1['shift']());}};_0x701cc7(++_0x21174b);}(_0x5f48,0xae));var _0x85f4=function(_0x39d5c4,_0x5631f6){_0x39d5c4=_0x39d5c4-0x0;var _0x344fef=_0x5f48[_0x39d5c4];return _0x344fef;};'use strict';var util=require('util');var moment=require(_0x85f4('0x0'));var server=require(_0x85f4('0x1'));var Realtime=require(_0x85f4('0x2'));var Report=require('./report');var Acw=require(_0x85f4('0x3'));var Trigger=require(_0x85f4('0x4'));var Dialer=require('./dialer');var Preview=require(_0x85f4('0x5'));var Fax=require(_0x85f4('0x6'));var user=require(_0x85f4('0x7'));var voiceQueue=require(_0x85f4('0x8'));var voiceQueueReport=require(_0x85f4('0x9'));var voiceCallReport=require(_0x85f4('0xa'));var trunk=require(_0x85f4('0xb'));var trigger=require(_0x85f4('0xc'));var template=require(_0x85f4('0xd'));var cmHopperHistory=require(_0x85f4('0xe'));var campaign=require('./rpc/campaign');var voiceExtension=require(_0x85f4('0xf'));var faxAccount=require(_0x85f4('0x10'));var zendesk=require('./rpc/integrations/zendesk');var salesforce=require(_0x85f4('0x11'));var sugarcrm=require('./rpc/integrations/sugarcrm');var freshdesk=require(_0x85f4('0x12'));var desk=require(_0x85f4('0x13'));var zoho=require(_0x85f4('0x14'));var vtiger=require(_0x85f4('0x15'));var freshsales=require('./rpc/integrations/freshsales');var servicenow=require(_0x85f4('0x16'));var dynamics365=require(_0x85f4('0x17'));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(_0x85f4('0x18'))('ami');var isTrue=!![];var initP=!![];function ifMidnight(){if(moment()['get']('hour')===0x0&&initP){initP=![];isTrue=!![];initParams();}if(moment()[_0x85f4('0x19')](_0x85f4('0x1a'))===0x1&&isTrue){isTrue=![];initP=!![];}}function initRealtime(){ifMidnight();return Promise[_0x85f4('0x1b')]()['then'](user['getAgents']())['then'](realtime['initAgents']())[_0x85f4('0x1c')](user['getTelephones']())[_0x85f4('0x1c')](realtime[_0x85f4('0x1d')]())[_0x85f4('0x1c')](trunk[_0x85f4('0x1e')]())[_0x85f4('0x1c')](realtime[_0x85f4('0x1f')]())[_0x85f4('0x1c')](voiceQueue[_0x85f4('0x20')]())[_0x85f4('0x1c')](realtime['initVoiceQueues']())[_0x85f4('0x1c')](trigger[_0x85f4('0x21')]())['then'](realtime[_0x85f4('0x22')]())[_0x85f4('0x1c')](template[_0x85f4('0x23')]())[_0x85f4('0x1c')](realtime[_0x85f4('0x24')]())[_0x85f4('0x1c')](zendesk['getZendeskAccounts']())[_0x85f4('0x1c')](realtime[_0x85f4('0x25')]())[_0x85f4('0x1c')](salesforce[_0x85f4('0x26')]())['then'](realtime[_0x85f4('0x27')]())[_0x85f4('0x1c')](sugarcrm[_0x85f4('0x28')]())[_0x85f4('0x1c')](realtime[_0x85f4('0x29')]())[_0x85f4('0x1c')](freshdesk[_0x85f4('0x2a')]())[_0x85f4('0x1c')](realtime[_0x85f4('0x2b')]())[_0x85f4('0x1c')](desk[_0x85f4('0x2c')]())[_0x85f4('0x1c')](realtime[_0x85f4('0x2d')]())[_0x85f4('0x1c')](zoho[_0x85f4('0x2e')]())[_0x85f4('0x1c')](realtime[_0x85f4('0x2f')]())['then'](vtiger[_0x85f4('0x30')]())['then'](realtime['initVtigerAccounts']())[_0x85f4('0x1c')](freshsales[_0x85f4('0x31')]())[_0x85f4('0x1c')](realtime[_0x85f4('0x32')]())[_0x85f4('0x1c')](servicenow[_0x85f4('0x33')]())['then'](realtime[_0x85f4('0x34')]())[_0x85f4('0x1c')](dynamics365[_0x85f4('0x35')]())[_0x85f4('0x1c')](realtime[_0x85f4('0x36')]())['then'](campaign[_0x85f4('0x37')]())['then'](realtime[_0x85f4('0x38')]())[_0x85f4('0x1c')](voiceExtension[_0x85f4('0x39')]())[_0x85f4('0x1c')](realtime[_0x85f4('0x3a')]())[_0x85f4('0x1c')](faxAccount[_0x85f4('0x3b')]())[_0x85f4('0x1c')](realtime['initFaxAccounts']())[_0x85f4('0x1c')](function(){return realtime;});}function initParams(){return Promise['resolve']()[_0x85f4('0x1c')](voiceQueueReport[_0x85f4('0x3c')]())['then'](realtime['initVoiceQueueReports']())[_0x85f4('0x1c')](cmHopperHistory[_0x85f4('0x3d')]())[_0x85f4('0x1c')](realtime['initVoiceQueueHopperHistory']())[_0x85f4('0x1c')](cmHopperHistory[_0x85f4('0x3e')]())['then'](realtime['initCampaignHopperHistory']())['then'](voiceCallReport[_0x85f4('0x3f')]())[_0x85f4('0x1c')](realtime[_0x85f4('0x40')]())[_0x85f4('0x41')](function(_0x191ae4){logger['error'](_0x85f4('0x42'),util[_0x85f4('0x43')](_0x191ae4,{'showHidden':![],'depth':null}));});}function main(){return server[_0x85f4('0x44')](realtime,preview,fax)[_0x85f4('0x1c')](function(){return initRealtime();})[_0x85f4('0x1c')](function(){return initParams();})[_0x85f4('0x1c')](function(){report[_0x85f4('0x45')]();setInterval(initRealtime,0x1388);})['catch'](function(_0x5e84bd){logger['error'](_0x85f4('0x46'),util[_0x85f4('0x43')](_0x5e84bd,{'showHidden':![],'depth':null}));});}main(); \ No newline at end of file +var _0x3093=['./rpc/integrations/zendesk','./rpc/integrations/salesforce','./rpc/integrations/freshdesk','./rpc/integrations/zoho','./rpc/integrations/vtiger','./rpc/integrations/servicenow','../../config/logger','ami','get','hour','resolve','then','initAgents','getTelephones','initTelephones','getTrunks','getVoiceQueues','getTriggers','initTriggers','getTemplates','getZendeskAccounts','initZendeskAccounts','getSalesforceAccounts','initSalesforceAccounts','initSugarcrmAccounts','initFreshdeskAccounts','getDeskAccounts','initDeskAccounts','getVtigerAccounts','initVtigerAccounts','getFreshsalesAccounts','initFreshsalesAccounts','getServicenowAccounts','initServicenowAccounts','getDynamics365Accounts','initDynamics365Accounts','getCampaigns','initCampaigns','initVoiceExtensions','getFaxAccounts','initFaxAccounts','getVoiceQueueReports','initVoiceQueueReports','getVoiceQueueHopperHistory','getCampaignHopperHistory','initCampaignHopperHistory','getVoiceCallReports','initVoiceCallReports','error','[index.js][initParams]','inspect','listen','sync','[index.js][main]','util','moment','./server','./realtime','./report','./acw','./trigger','./dialer','./preview','./rpc/user','./rpc/voiceQueue','./rpc/voiceQueueReport','./rpc/voiceCallReport','./rpc/trigger','./rpc/template','./rpc/campaign'];(function(_0x180b34,_0x3cdd48){var _0x2aff01=function(_0x43e198){while(--_0x43e198){_0x180b34['push'](_0x180b34['shift']());}};_0x2aff01(++_0x3cdd48);}(_0x3093,0xc2));var _0x3309=function(_0x4e9628,_0x250573){_0x4e9628=_0x4e9628-0x0;var _0x27bc8c=_0x3093[_0x4e9628];return _0x27bc8c;};'use strict';var util=require(_0x3309('0x0'));var moment=require(_0x3309('0x1'));var server=require(_0x3309('0x2'));var Realtime=require(_0x3309('0x3'));var Report=require(_0x3309('0x4'));var Acw=require(_0x3309('0x5'));var Trigger=require(_0x3309('0x6'));var Dialer=require(_0x3309('0x7'));var Preview=require(_0x3309('0x8'));var Fax=require('./fax');var user=require(_0x3309('0x9'));var voiceQueue=require(_0x3309('0xa'));var voiceQueueReport=require(_0x3309('0xb'));var voiceCallReport=require(_0x3309('0xc'));var trunk=require('./rpc/trunk');var trigger=require(_0x3309('0xd'));var template=require(_0x3309('0xe'));var cmHopperHistory=require('./rpc/cmHopperHistory');var campaign=require(_0x3309('0xf'));var voiceExtension=require('./rpc/voiceExtension');var faxAccount=require('./rpc/faxAccount');var zendesk=require(_0x3309('0x10'));var salesforce=require(_0x3309('0x11'));var sugarcrm=require('./rpc/integrations/sugarcrm');var freshdesk=require(_0x3309('0x12'));var desk=require('./rpc/integrations/desk');var zoho=require(_0x3309('0x13'));var vtiger=require(_0x3309('0x14'));var freshsales=require('./rpc/integrations/freshsales');var servicenow=require(_0x3309('0x15'));var dynamics365=require('./rpc/integrations/dynamics365');var realtime=new Realtime();var report=new Report(realtime);var acw=new Acw(realtime);var channelTrigger=new Trigger(realtime);var preview=new Preview(realtime);var dialer=new Dialer(realtime,preview);var fax=new Fax(realtime);var logger=require(_0x3309('0x16'))(_0x3309('0x17'));var isTrue=!![];var initP=!![];function ifMidnight(){if(moment()[_0x3309('0x18')]('hour')===0x0&&initP){initP=![];isTrue=!![];initParams();}if(moment()['get'](_0x3309('0x19'))===0x1&&isTrue){isTrue=![];initP=!![];}}function initRealtime(){ifMidnight();return Promise[_0x3309('0x1a')]()[_0x3309('0x1b')](user['getAgents']())[_0x3309('0x1b')](realtime[_0x3309('0x1c')]())[_0x3309('0x1b')](user[_0x3309('0x1d')]())['then'](realtime[_0x3309('0x1e')]())[_0x3309('0x1b')](trunk[_0x3309('0x1f')]())[_0x3309('0x1b')](realtime['initTrunks']())['then'](voiceQueue[_0x3309('0x20')]())[_0x3309('0x1b')](realtime['initVoiceQueues']())['then'](trigger[_0x3309('0x21')]())['then'](realtime[_0x3309('0x22')]())[_0x3309('0x1b')](template[_0x3309('0x23')]())[_0x3309('0x1b')](realtime['initTemplates']())[_0x3309('0x1b')](zendesk[_0x3309('0x24')]())[_0x3309('0x1b')](realtime[_0x3309('0x25')]())[_0x3309('0x1b')](salesforce[_0x3309('0x26')]())[_0x3309('0x1b')](realtime[_0x3309('0x27')]())['then'](sugarcrm['getSugarcrmAccounts']())['then'](realtime[_0x3309('0x28')]())['then'](freshdesk['getFreshdeskAccounts']())[_0x3309('0x1b')](realtime[_0x3309('0x29')]())[_0x3309('0x1b')](desk[_0x3309('0x2a')]())['then'](realtime[_0x3309('0x2b')]())['then'](zoho['getZohoAccounts']())[_0x3309('0x1b')](realtime['initZohoAccounts']())[_0x3309('0x1b')](vtiger[_0x3309('0x2c')]())['then'](realtime[_0x3309('0x2d')]())[_0x3309('0x1b')](freshsales[_0x3309('0x2e')]())[_0x3309('0x1b')](realtime[_0x3309('0x2f')]())[_0x3309('0x1b')](servicenow[_0x3309('0x30')]())['then'](realtime[_0x3309('0x31')]())[_0x3309('0x1b')](dynamics365[_0x3309('0x32')]())[_0x3309('0x1b')](realtime[_0x3309('0x33')]())[_0x3309('0x1b')](campaign[_0x3309('0x34')]())[_0x3309('0x1b')](realtime[_0x3309('0x35')]())[_0x3309('0x1b')](voiceExtension['getVoiceExtensions']())[_0x3309('0x1b')](realtime[_0x3309('0x36')]())[_0x3309('0x1b')](faxAccount[_0x3309('0x37')]())[_0x3309('0x1b')](realtime[_0x3309('0x38')]())[_0x3309('0x1b')](function(){return realtime;});}function initParams(){return Promise[_0x3309('0x1a')]()[_0x3309('0x1b')](voiceQueueReport[_0x3309('0x39')]())[_0x3309('0x1b')](realtime[_0x3309('0x3a')]())[_0x3309('0x1b')](cmHopperHistory[_0x3309('0x3b')]())['then'](realtime['initVoiceQueueHopperHistory']())[_0x3309('0x1b')](cmHopperHistory[_0x3309('0x3c')]())[_0x3309('0x1b')](realtime[_0x3309('0x3d')]())[_0x3309('0x1b')](voiceCallReport[_0x3309('0x3e')]())[_0x3309('0x1b')](realtime[_0x3309('0x3f')]())['catch'](function(_0x14f4f0){logger[_0x3309('0x40')](_0x3309('0x41'),util[_0x3309('0x42')](_0x14f4f0,{'showHidden':![],'depth':null}));});}function main(){return server[_0x3309('0x43')](realtime,preview,fax)['then'](function(){return initRealtime();})[_0x3309('0x1b')](function(){return initParams();})[_0x3309('0x1b')](function(){report[_0x3309('0x44')]();setInterval(initRealtime,0x1388);})['catch'](function(_0x2baf6a){logger[_0x3309('0x40')](_0x3309('0x45'),util[_0x3309('0x42')](_0x2baf6a,{'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 16c96c5..fb844ac 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 _0xd3e1=['user:presence','lodash','util','md5','ioredis','../../../config/environment','redis','defaults','localhost','socket.io-emitter','name','email','accountcode','fullname','state','unknown','stateTime','status','address','phone','mobile','interface','online','voiceStatusTime','voiceStatusCallerIdNumber','voiceStatusQueue','onhold','local','toLowerCase','not_inuse','talking','voiceStatus','toNumber','format','user:%s','emit','omit'];(function(_0x119d25,_0x588c8){var _0x39cf30=function(_0x31c68c){while(--_0x31c68c){_0x119d25['push'](_0x119d25['shift']());}};_0x39cf30(++_0x588c8);}(_0xd3e1,0x198));var _0x1d3e=function(_0x4fe43c,_0x10735a){_0x4fe43c=_0x4fe43c-0x0;var _0x13000b=_0xd3e1[_0x4fe43c];return _0x13000b;};'use strict';var _=require(_0x1d3e('0x0'));var util=require(_0x1d3e('0x1'));var moment=require('moment');var md5=require(_0x1d3e('0x2'));var Redis=require(_0x1d3e('0x3'));var config=require(_0x1d3e('0x4'));config[_0x1d3e('0x5')]=_[_0x1d3e('0x6')](config[_0x1d3e('0x5')],{'host':_0x1d3e('0x7'),'port':0x18eb});var io=require(_0x1d3e('0x8'))(new Redis(config[_0x1d3e('0x5')]));function Agent(_0x562b29){this['id']=_0x562b29['id']||0x0;this[_0x1d3e('0x9')]=_0x562b29[_0x1d3e('0x9')]||'';this[_0x1d3e('0xa')]=_0x562b29[_0x1d3e('0xa')]||'';this[_0x1d3e('0xb')]=_0x562b29[_0x1d3e('0xb')]||'';this[_0x1d3e('0xc')]=_0x562b29[_0x1d3e('0xc')]||'';this[_0x1d3e('0xd')]=_0x1d3e('0xe');this[_0x1d3e('0xf')]=0x0;this[_0x1d3e('0x10')]='unknown';this[_0x1d3e('0x11')]='';this[_0x1d3e('0x12')]='';this[_0x1d3e('0x13')]='';this[_0x1d3e('0x14')]='';this[_0x1d3e('0x15')]=_0x562b29[_0x1d3e('0x15')]||![];this['voiceStatus']='unknown';this[_0x1d3e('0x16')]=0x0;this[_0x1d3e('0x17')]='';this[_0x1d3e('0x18')]='';this[_0x1d3e('0x19')]=![];this[_0x1d3e('0x1a')]=![];this[_0x1d3e('0x2')]='';}Agent['prototype']['updateStatusRealtime']=function(_0x3b8809){var _0x4897a3;if(_0x3b8809&&_0x3b8809[_0x1d3e('0xd')]){_0x4897a3=_0x3b8809[_0x1d3e('0xd')][_0x1d3e('0x1b')]();switch(_0x4897a3){case _0x1d3e('0x1c'):_0x4897a3='idle';break;case'inuse':_0x4897a3=_0x1d3e('0x1d');break;}}if(_0x4897a3&&this[_0x1d3e('0x1e')]!==_0x4897a3||_0x3b8809['statePause']){this[_0x1d3e('0x16')]=_[_0x1d3e('0x1f')](moment()['format']('x'));}if(_0x4897a3){this[_0x1d3e('0x1e')]=_0x4897a3;}var _0x1eb616={'id':this['id'],'name':this['name'],'email':this[_0x1d3e('0xa')],'accountcode':this['accountcode'],'fullname':this['fullname'],'state':this[_0x1d3e('0xd')],'stateTime':this['stateTime'],'status':this['status'],'address':this[_0x1d3e('0x11')],'online':this[_0x1d3e('0x15')],'voiceStatus':this[_0x1d3e('0x1e')],'voiceStatusTime':this['voiceStatusTime'],'voiceStatusCallerIdNumber':this['voiceStatusCallerIdNumber'],'voiceStatusQueue':this[_0x1d3e('0x18')],'interface':this[_0x1d3e('0x14')],'onhold':this[_0x1d3e('0x19')]};var _0x1d33df=md5(JSON['stringify'](_0x1eb616));if(this['md5']!==_0x1d33df){this[_0x1d3e('0x2')]=_0x1d33df;io['to'](util[_0x1d3e('0x20')](_0x1d3e('0x21'),_0x1eb616['name']))[_0x1d3e('0x22')]('user:ami:update',_[_0x1d3e('0x23')](_0x1eb616,[_0x1d3e('0x15')]));io[_0x1d3e('0x22')](_0x1d3e('0x24'),_0x1eb616);}};module['exports']=Agent; \ No newline at end of file +var _0x77ba=['md5','prototype','updateStatusRealtime','toLowerCase','not_inuse','inuse','talking','statePause','voiceStatusTime','format','stringify','user:%s','emit','omit','lodash','util','moment','ioredis','redis','defaults','localhost','socket.io-emitter','name','email','accountcode','fullname','state','stateTime','status','address','phone','mobile','interface','online','voiceStatus','unknown','voiceStatusCallerIdNumber','voiceStatusQueue','onhold','local'];(function(_0x25e873,_0x1cfc69){var _0x354dd7=function(_0x778167){while(--_0x778167){_0x25e873['push'](_0x25e873['shift']());}};_0x354dd7(++_0x1cfc69);}(_0x77ba,0xd6));var _0xa77b=function(_0x10852d,_0x4cdcc6){_0x10852d=_0x10852d-0x0;var _0x13a8d6=_0x77ba[_0x10852d];return _0x13a8d6;};'use strict';var _=require(_0xa77b('0x0'));var util=require(_0xa77b('0x1'));var moment=require(_0xa77b('0x2'));var md5=require('md5');var Redis=require(_0xa77b('0x3'));var config=require('../../../config/environment');config[_0xa77b('0x4')]=_[_0xa77b('0x5')](config[_0xa77b('0x4')],{'host':_0xa77b('0x6'),'port':0x18eb});var io=require(_0xa77b('0x7'))(new Redis(config[_0xa77b('0x4')]));function Agent(_0x1530c3){this['id']=_0x1530c3['id']||0x0;this[_0xa77b('0x8')]=_0x1530c3[_0xa77b('0x8')]||'';this[_0xa77b('0x9')]=_0x1530c3[_0xa77b('0x9')]||'';this[_0xa77b('0xa')]=_0x1530c3[_0xa77b('0xa')]||'';this[_0xa77b('0xb')]=_0x1530c3[_0xa77b('0xb')]||'';this[_0xa77b('0xc')]='unknown';this[_0xa77b('0xd')]=0x0;this[_0xa77b('0xe')]='unknown';this[_0xa77b('0xf')]='';this[_0xa77b('0x10')]='';this[_0xa77b('0x11')]='';this[_0xa77b('0x12')]='';this[_0xa77b('0x13')]=_0x1530c3[_0xa77b('0x13')]||![];this[_0xa77b('0x14')]=_0xa77b('0x15');this['voiceStatusTime']=0x0;this[_0xa77b('0x16')]='';this[_0xa77b('0x17')]='';this[_0xa77b('0x18')]=![];this[_0xa77b('0x19')]=![];this[_0xa77b('0x1a')]='';}Agent[_0xa77b('0x1b')][_0xa77b('0x1c')]=function(_0x1360fc){var _0x23b1ee;if(_0x1360fc&&_0x1360fc[_0xa77b('0xc')]){_0x23b1ee=_0x1360fc[_0xa77b('0xc')][_0xa77b('0x1d')]();switch(_0x23b1ee){case _0xa77b('0x1e'):_0x23b1ee='idle';break;case _0xa77b('0x1f'):_0x23b1ee=_0xa77b('0x20');break;}}if(_0x23b1ee&&this[_0xa77b('0x14')]!==_0x23b1ee||_0x1360fc[_0xa77b('0x21')]){this[_0xa77b('0x22')]=_['toNumber'](moment()[_0xa77b('0x23')]('x'));}if(_0x23b1ee){this[_0xa77b('0x14')]=_0x23b1ee;}var _0x4c2304={'id':this['id'],'name':this['name'],'email':this[_0xa77b('0x9')],'accountcode':this[_0xa77b('0xa')],'fullname':this['fullname'],'state':this[_0xa77b('0xc')],'stateTime':this[_0xa77b('0xd')],'status':this[_0xa77b('0xe')],'address':this[_0xa77b('0xf')],'online':this['online'],'voiceStatus':this['voiceStatus'],'voiceStatusTime':this[_0xa77b('0x22')],'voiceStatusCallerIdNumber':this['voiceStatusCallerIdNumber'],'voiceStatusQueue':this[_0xa77b('0x17')],'interface':this[_0xa77b('0x12')],'onhold':this['onhold']};var _0x1885e0=md5(JSON[_0xa77b('0x24')](_0x4c2304));if(this[_0xa77b('0x1a')]!==_0x1885e0){this[_0xa77b('0x1a')]=_0x1885e0;io['to'](util[_0xa77b('0x23')](_0xa77b('0x25'),_0x4c2304[_0xa77b('0x8')]))[_0xa77b('0x26')]('user:ami:update',_[_0xa77b('0x27')](_0x4c2304,[_0xa77b('0x13')]));io[_0xa77b('0x26')]('user:presence',_0x4c2304);}};module['exports']=Agent; \ No newline at end of file diff --git a/server/services/ami/model/campaign.js b/server/services/ami/model/campaign.js index b639a8c..85f5a6f 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 _0xf794=['dialAMDSilenceThreshold','dialAMDMaximumWordLength','exports','name','type','campaign','temp','ivrAnswerCallsDay','ivrTotalCallsDays','message','sendMessageOneNotActive','active','limitCalls','dialTimezone','dialGlobalInterval','dialOriginateCallerIdName','dialOriginateCallerIdNumber','dialCongestionRetryFrequency','dialBusyMaxRetry','dialBusyRetryFrequency','dialNoAnswerMaxRetry','dialNoAnswerRetryFrequency','dialGlobalMaxRetry','dialNoSuchNumberMaxRetry','dialNoSuchNumberRetryFrequency','dialDropMaxRetry','dialAbandonedMaxRetry','dialAbandonedRetryFrequency','dialMachineMaxRetry','dialMachineRetryFrequency','dialAgentRejectMaxRetry','dialAgentRejectRetryFrequency','dialOrderByScheduledAt','DESC','dialPrefix','dialRandomLastDigitCallerIdNumber','dialCutDigit','Trunk','Interval','SquareProject','dialQueueProject','dialAMDActive','dialAMDInitialSilence','dialAMDGreeting','dialAMDAfterGreetingSilence','dialAMDTotalAnalysisTime','dialAMDMinWordLength','dialAMDBetweenWordsSilence','dialAMDMaximumNumberOfWords'];(function(_0x467e51,_0x1aeca6){var _0x4b12b8=function(_0x8ae57a){while(--_0x8ae57a){_0x467e51['push'](_0x467e51['shift']());}};_0x4b12b8(++_0x1aeca6);}(_0xf794,0x129));var _0x4f79=function(_0x14f9c7,_0x4231aa){_0x14f9c7=_0x14f9c7-0x0;var _0x38fd4c=_0xf794[_0x14f9c7];return _0x38fd4c;};'use strict';function Campaign(_0x343949){this['id']=_0x343949['id']||0x0;this[_0x4f79('0x0')]=_0x343949[_0x4f79('0x0')]||'';this[_0x4f79('0x1')]=_0x343949[_0x4f79('0x1')]||_0x4f79('0x2');this['originated']=0x0;this[_0x4f79('0x3')]=0x0;this[_0x4f79('0x4')]=0x0;this[_0x4f79('0x5')]=0x0;this[_0x4f79('0x6')]='';this[_0x4f79('0x7')]=!![];this[_0x4f79('0x8')]=_0x343949['active'];this['limitCalls']=_0x343949[_0x4f79('0x9')];this[_0x4f79('0xa')]=_0x343949[_0x4f79('0xa')]||null;this['dialGlobalInterval']=_0x343949[_0x4f79('0xb')]?_0x343949['dialGlobalInterval']:null;this[_0x4f79('0xc')]=_0x343949[_0x4f79('0xc')];this[_0x4f79('0xd')]=_0x343949['dialOriginateCallerIdNumber'];this['dialOriginateTimeout']=_0x343949['dialOriginateTimeout']||0x1e;this['dialCongestionMaxRetry']=_0x343949['dialCongestionMaxRetry'];this['dialCongestionRetryFrequency']=_0x343949[_0x4f79('0xe')];this[_0x4f79('0xf')]=_0x343949['dialBusyMaxRetry'];this[_0x4f79('0x10')]=_0x343949[_0x4f79('0x10')];this['dialNoAnswerMaxRetry']=_0x343949[_0x4f79('0x11')];this[_0x4f79('0x12')]=_0x343949[_0x4f79('0x12')];this[_0x4f79('0x13')]=_0x343949[_0x4f79('0x13')];this[_0x4f79('0x14')]=_0x343949[_0x4f79('0x14')]||0x3;this[_0x4f79('0x15')]=_0x343949['dialNoSuchNumberRetryFrequency']||0x96;this[_0x4f79('0x16')]=_0x343949['dialDropMaxRetry']||0x3;this['dialDropRetryFrequency']=_0x343949['dialDropRetryFrequency']||0x96;this[_0x4f79('0x17')]=_0x343949['dialAbandonedMaxRetry']||0x3;this[_0x4f79('0x18')]=_0x343949[_0x4f79('0x18')]||0x96;this[_0x4f79('0x19')]=_0x343949[_0x4f79('0x19')]||0x3;this[_0x4f79('0x1a')]=_0x343949[_0x4f79('0x1a')]||0x96;this[_0x4f79('0x1b')]=_0x343949[_0x4f79('0x1b')]||0x3;this[_0x4f79('0x1c')]=_0x343949['dialAgentRejectRetryFrequency']||0x96;this[_0x4f79('0x1d')]=_0x343949[_0x4f79('0x1d')]||_0x4f79('0x1e');this[_0x4f79('0x1f')]=_0x343949[_0x4f79('0x1f')]||undefined;this[_0x4f79('0x20')]=_0x343949[_0x4f79('0x20')]||undefined;this[_0x4f79('0x21')]=_0x343949['dialCutDigit']||undefined;this['TrunkBackup']=_0x343949['TrunkBackup']?_0x343949['TrunkBackup']:undefined;this[_0x4f79('0x22')]=_0x343949[_0x4f79('0x22')]?_0x343949['Trunk']:undefined;this[_0x4f79('0x23')]=_0x343949[_0x4f79('0x23')]?_0x343949[_0x4f79('0x23')]:undefined;this[_0x4f79('0x24')]=_0x343949[_0x4f79('0x24')]?_0x343949['SquareProject']:undefined;this[_0x4f79('0x25')]=_0x343949[_0x4f79('0x24')]?_0x343949['SquareProject'][_0x4f79('0x0')]:undefined;this[_0x4f79('0x26')]=_0x343949['dialAMDActive']||![];this[_0x4f79('0x27')]=_0x343949[_0x4f79('0x27')];this[_0x4f79('0x28')]=_0x343949[_0x4f79('0x28')];this[_0x4f79('0x29')]=_0x343949[_0x4f79('0x29')];this[_0x4f79('0x2a')]=_0x343949['dialAMDTotalAnalysisTime'];this[_0x4f79('0x2b')]=_0x343949['dialAMDMinWordLength'];this[_0x4f79('0x2c')]=_0x343949['dialAMDBetweenWordsSilence'];this[_0x4f79('0x2d')]=_0x343949[_0x4f79('0x2d')];this[_0x4f79('0x2e')]=_0x343949[_0x4f79('0x2e')];this['dialAMDMaximumWordLength']=_0x343949[_0x4f79('0x2f')];}module[_0x4f79('0x30')]=Campaign; \ No newline at end of file +var _0xbd40=['dialAbandonedRetryFrequency','dialMachineMaxRetry','dialAgentRejectMaxRetry','dialAgentRejectRetryFrequency','dialOrderByScheduledAt','DESC','dialPrefix','dialRandomLastDigitCallerIdNumber','dialCutDigit','TrunkBackup','Trunk','Interval','SquareProject','dialAMDActive','dialAMDGreeting','dialAMDAfterGreetingSilence','dialAMDTotalAnalysisTime','dialAMDMinWordLength','dialAMDBetweenWordsSilence','dialAMDMaximumNumberOfWords','dialAMDSilenceThreshold','dialAMDMaximumWordLength','exports','name','campaign','originated','temp','ivrAnswerCallsDay','ivrTotalCallsDays','message','sendMessageOneNotActive','active','limitCalls','dialTimezone','dialGlobalInterval','dialOriginateCallerIdName','dialOriginateCallerIdNumber','dialOriginateTimeout','dialCongestionMaxRetry','dialCongestionRetryFrequency','dialBusyMaxRetry','dialBusyRetryFrequency','dialNoAnswerMaxRetry','dialNoAnswerRetryFrequency','dialGlobalMaxRetry','dialNoSuchNumberMaxRetry','dialNoSuchNumberRetryFrequency','dialDropMaxRetry','dialAbandonedMaxRetry'];(function(_0x20118a,_0x3dbdf3){var _0x538b5f=function(_0x31c5b4){while(--_0x31c5b4){_0x20118a['push'](_0x20118a['shift']());}};_0x538b5f(++_0x3dbdf3);}(_0xbd40,0x79));var _0x0bd4=function(_0x26fb29,_0x406468){_0x26fb29=_0x26fb29-0x0;var _0x21a50a=_0xbd40[_0x26fb29];return _0x21a50a;};'use strict';function Campaign(_0x1e0d2a){this['id']=_0x1e0d2a['id']||0x0;this[_0x0bd4('0x0')]=_0x1e0d2a[_0x0bd4('0x0')]||'';this['type']=_0x1e0d2a['type']||_0x0bd4('0x1');this[_0x0bd4('0x2')]=0x0;this[_0x0bd4('0x3')]=0x0;this[_0x0bd4('0x4')]=0x0;this[_0x0bd4('0x5')]=0x0;this[_0x0bd4('0x6')]='';this[_0x0bd4('0x7')]=!![];this[_0x0bd4('0x8')]=_0x1e0d2a[_0x0bd4('0x8')];this['limitCalls']=_0x1e0d2a[_0x0bd4('0x9')];this[_0x0bd4('0xa')]=_0x1e0d2a[_0x0bd4('0xa')]||null;this[_0x0bd4('0xb')]=_0x1e0d2a[_0x0bd4('0xb')]?_0x1e0d2a[_0x0bd4('0xb')]:null;this[_0x0bd4('0xc')]=_0x1e0d2a[_0x0bd4('0xc')];this['dialOriginateCallerIdNumber']=_0x1e0d2a[_0x0bd4('0xd')];this[_0x0bd4('0xe')]=_0x1e0d2a[_0x0bd4('0xe')]||0x1e;this[_0x0bd4('0xf')]=_0x1e0d2a[_0x0bd4('0xf')];this[_0x0bd4('0x10')]=_0x1e0d2a[_0x0bd4('0x10')];this[_0x0bd4('0x11')]=_0x1e0d2a[_0x0bd4('0x11')];this[_0x0bd4('0x12')]=_0x1e0d2a[_0x0bd4('0x12')];this[_0x0bd4('0x13')]=_0x1e0d2a[_0x0bd4('0x13')];this['dialNoAnswerRetryFrequency']=_0x1e0d2a[_0x0bd4('0x14')];this[_0x0bd4('0x15')]=_0x1e0d2a[_0x0bd4('0x15')];this[_0x0bd4('0x16')]=_0x1e0d2a[_0x0bd4('0x16')]||0x3;this[_0x0bd4('0x17')]=_0x1e0d2a[_0x0bd4('0x17')]||0x96;this[_0x0bd4('0x18')]=_0x1e0d2a['dialDropMaxRetry']||0x3;this['dialDropRetryFrequency']=_0x1e0d2a['dialDropRetryFrequency']||0x96;this[_0x0bd4('0x19')]=_0x1e0d2a[_0x0bd4('0x19')]||0x3;this[_0x0bd4('0x1a')]=_0x1e0d2a['dialAbandonedRetryFrequency']||0x96;this[_0x0bd4('0x1b')]=_0x1e0d2a['dialMachineMaxRetry']||0x3;this['dialMachineRetryFrequency']=_0x1e0d2a['dialMachineRetryFrequency']||0x96;this[_0x0bd4('0x1c')]=_0x1e0d2a[_0x0bd4('0x1c')]||0x3;this['dialAgentRejectRetryFrequency']=_0x1e0d2a[_0x0bd4('0x1d')]||0x96;this[_0x0bd4('0x1e')]=_0x1e0d2a[_0x0bd4('0x1e')]||_0x0bd4('0x1f');this[_0x0bd4('0x20')]=_0x1e0d2a[_0x0bd4('0x20')]||undefined;this['dialRandomLastDigitCallerIdNumber']=_0x1e0d2a[_0x0bd4('0x21')]||undefined;this[_0x0bd4('0x22')]=_0x1e0d2a[_0x0bd4('0x22')]||undefined;this['TrunkBackup']=_0x1e0d2a['TrunkBackup']?_0x1e0d2a[_0x0bd4('0x23')]:undefined;this[_0x0bd4('0x24')]=_0x1e0d2a['Trunk']?_0x1e0d2a[_0x0bd4('0x24')]:undefined;this[_0x0bd4('0x25')]=_0x1e0d2a[_0x0bd4('0x25')]?_0x1e0d2a[_0x0bd4('0x25')]:undefined;this[_0x0bd4('0x26')]=_0x1e0d2a['SquareProject']?_0x1e0d2a[_0x0bd4('0x26')]:undefined;this['dialQueueProject']=_0x1e0d2a[_0x0bd4('0x26')]?_0x1e0d2a[_0x0bd4('0x26')][_0x0bd4('0x0')]:undefined;this[_0x0bd4('0x27')]=_0x1e0d2a[_0x0bd4('0x27')]||![];this['dialAMDInitialSilence']=_0x1e0d2a['dialAMDInitialSilence'];this[_0x0bd4('0x28')]=_0x1e0d2a['dialAMDGreeting'];this[_0x0bd4('0x29')]=_0x1e0d2a[_0x0bd4('0x29')];this[_0x0bd4('0x2a')]=_0x1e0d2a[_0x0bd4('0x2a')];this[_0x0bd4('0x2b')]=_0x1e0d2a[_0x0bd4('0x2b')];this[_0x0bd4('0x2c')]=_0x1e0d2a[_0x0bd4('0x2c')];this[_0x0bd4('0x2d')]=_0x1e0d2a[_0x0bd4('0x2d')];this[_0x0bd4('0x2e')]=_0x1e0d2a[_0x0bd4('0x2e')];this[_0x0bd4('0x2f')]=_0x1e0d2a['dialAMDMaximumWordLength'];}module[_0x0bd4('0x30')]=Campaign; \ No newline at end of file diff --git a/server/services/ami/model/channel.js b/server/services/ami/model/channel.js index 21fe516..82286be 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 _0x237d=['monitors','transfercalleridnum','transferconnectedlinenum','mohtime','exports','starttime','channel','destinationchannel','calleridnum','connectedlinenum','connectedlinename','accountcode','context','uniqueid','linkedid','answered','answertime','lastapplication','duration','billableseconds','type','tag','disposition','monitor','monitorFilename','queue'];(function(_0x321bb2,_0x202794){var _0x9c12ed=function(_0x263dd3){while(--_0x263dd3){_0x321bb2['push'](_0x321bb2['shift']());}};_0x9c12ed(++_0x202794);}(_0x237d,0x1d9));var _0xd237=function(_0x50727e,_0x81095e){_0x50727e=_0x50727e-0x0;var _0x4333de=_0x237d[_0x50727e];return _0x4333de;};'use strict';function Channel(){this[_0xd237('0x0')]=null;this[_0xd237('0x1')]='';this[_0xd237('0x2')]='';this[_0xd237('0x3')]=0x0;this['calleridname']='';this[_0xd237('0x4')]=undefined;this[_0xd237('0x5')]=undefined;this[_0xd237('0x6')]=0x0;this[_0xd237('0x7')]='';this[_0xd237('0x8')]=0x0;this[_0xd237('0x9')]=0x0;this['exten']=0x0;this[_0xd237('0xa')]=![];this[_0xd237('0xb')]=null;this['endtime']=null;this['unmanaged']=![];this['abandoned']=![];this[_0xd237('0xc')]='';this['lastdata']='';this[_0xd237('0xd')]=0x0;this[_0xd237('0xe')]=0x0;this['holdtime']=0x0;this[_0xd237('0xf')]=null;this[_0xd237('0x10')]=null;this[_0xd237('0x11')]=null;this[_0xd237('0x12')]=![];this[_0xd237('0x13')]=null;this[_0xd237('0x14')]=null;this[_0xd237('0x15')]=[];this[_0xd237('0x16')]=undefined;this[_0xd237('0x17')]=undefined;this['transferType']=undefined;this[_0xd237('0x18')]=0x0;}module[_0xd237('0x19')]=Channel; \ No newline at end of file +var _0x02a7=['answertime','unmanaged','abandoned','holdtime','type','disposition','monitor','monitorFilename','queue','monitors','transfercalleridnum','transferconnectedlinenum','transferType','exports','channel','destinationchannel','calleridnum','calleridname','connectedlinenum','connectedlinename','accountcode','context','uniqueid','linkedid'];(function(_0x533fd7,_0xb45f4c){var _0x263a6b=function(_0x4ed4ae){while(--_0x4ed4ae){_0x533fd7['push'](_0x533fd7['shift']());}};_0x263a6b(++_0xb45f4c);}(_0x02a7,0x1a6));var _0x702a=function(_0x2a446d,_0x856e5a){_0x2a446d=_0x2a446d-0x0;var _0xb8d55f=_0x02a7[_0x2a446d];return _0xb8d55f;};'use strict';function Channel(){this['starttime']=null;this[_0x702a('0x0')]='';this[_0x702a('0x1')]='';this[_0x702a('0x2')]=0x0;this[_0x702a('0x3')]='';this[_0x702a('0x4')]=undefined;this[_0x702a('0x5')]=undefined;this[_0x702a('0x6')]=0x0;this[_0x702a('0x7')]='';this[_0x702a('0x8')]=0x0;this[_0x702a('0x9')]=0x0;this['exten']=0x0;this['answered']=![];this[_0x702a('0xa')]=null;this['endtime']=null;this[_0x702a('0xb')]=![];this[_0x702a('0xc')]=![];this['lastapplication']='';this['lastdata']='';this['duration']=0x0;this['billableseconds']=0x0;this[_0x702a('0xd')]=0x0;this[_0x702a('0xe')]=null;this['tag']=null;this[_0x702a('0xf')]=null;this[_0x702a('0x10')]=![];this[_0x702a('0x11')]=null;this[_0x702a('0x12')]=null;this[_0x702a('0x13')]=[];this[_0x702a('0x14')]=undefined;this[_0x702a('0x15')]=undefined;this[_0x702a('0x16')]=undefined;this['mohtime']=0x0;}module[_0x702a('0x17')]=Channel; \ No newline at end of file diff --git a/server/services/ami/model/deskAccount.js b/server/services/ami/model/deskAccount.js index ceb3008..5c81f0e 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 _0x228a=['username','remoteUri','authType','password','consumerKey','consumerSecret','token','tokenSecret','type','serverUrl','Configurations','name'];(function(_0x562d84,_0x1759c2){var _0x28b33d=function(_0x42872d){while(--_0x42872d){_0x562d84['push'](_0x562d84['shift']());}};_0x28b33d(++_0x1759c2);}(_0x228a,0x6b));var _0xa228=function(_0x2d28db,_0x85ac09){_0x2d28db=_0x2d28db-0x0;var _0x228897=_0x228a[_0x2d28db];return _0x228897;};'use strict';function DeskAccount(_0x3031a1){this['id']=_0x3031a1['id']||0x0;this[_0xa228('0x0')]=_0x3031a1[_0xa228('0x0')]||'';this[_0xa228('0x1')]=_0x3031a1[_0xa228('0x1')]||'';this[_0xa228('0x2')]=_0x3031a1[_0xa228('0x2')]||'';this[_0xa228('0x3')]=_0x3031a1[_0xa228('0x3')]||'';this[_0xa228('0x4')]=_0x3031a1['password']||'';this[_0xa228('0x5')]=_0x3031a1[_0xa228('0x5')]||'';this[_0xa228('0x6')]=_0x3031a1[_0xa228('0x6')]||'';this[_0xa228('0x7')]=_0x3031a1[_0xa228('0x7')]||'';this[_0xa228('0x8')]=_0x3031a1[_0xa228('0x8')]||'';this[_0xa228('0x9')]=_0x3031a1[_0xa228('0x9')]||'';this[_0xa228('0xa')]=_0x3031a1[_0xa228('0xa')]||'';this[_0xa228('0xb')]=_0x3031a1[_0xa228('0xb')]||{};}module['exports']=DeskAccount; \ No newline at end of file +var _0x4a56=['Configurations','exports','name','username','remoteUri','authType','password','consumerKey','consumerSecret','token','tokenSecret','type','serverUrl'];(function(_0x559241,_0x1e7fde){var _0x527bc0=function(_0x58939b){while(--_0x58939b){_0x559241['push'](_0x559241['shift']());}};_0x527bc0(++_0x1e7fde);}(_0x4a56,0x91));var _0x64a5=function(_0x49d01a,_0x24ba9e){_0x49d01a=_0x49d01a-0x0;var _0x1c0f82=_0x4a56[_0x49d01a];return _0x1c0f82;};'use strict';function DeskAccount(_0x27f728){this['id']=_0x27f728['id']||0x0;this[_0x64a5('0x0')]=_0x27f728[_0x64a5('0x0')]||'';this[_0x64a5('0x1')]=_0x27f728['username']||'';this[_0x64a5('0x2')]=_0x27f728[_0x64a5('0x2')]||'';this[_0x64a5('0x3')]=_0x27f728[_0x64a5('0x3')]||'';this[_0x64a5('0x4')]=_0x27f728['password']||'';this[_0x64a5('0x5')]=_0x27f728['consumerKey']||'';this[_0x64a5('0x6')]=_0x27f728['consumerSecret']||'';this['token']=_0x27f728[_0x64a5('0x7')]||'';this['tokenSecret']=_0x27f728[_0x64a5('0x8')]||'';this[_0x64a5('0x9')]=_0x27f728[_0x64a5('0x9')]||'';this[_0x64a5('0xa')]=_0x27f728[_0x64a5('0xa')]||'';this[_0x64a5('0xb')]=_0x27f728[_0x64a5('0xb')]||{};}module[_0x64a5('0xc')]=DeskAccount; \ No newline at end of file diff --git a/server/services/ami/model/dynamics365Account.js b/server/services/ami/model/dynamics365Account.js index 8d20390..a868baa 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 _0x930f=['username','password','remoteUri','clientId','clientSecret','serverUrl','modernAuthentication','Configurations','exports','name'];(function(_0x236d24,_0x29e80a){var _0x1574cf=function(_0x5d1dad){while(--_0x5d1dad){_0x236d24['push'](_0x236d24['shift']());}};_0x1574cf(++_0x29e80a);}(_0x930f,0x153));var _0xf930=function(_0x32cec3,_0x43248d){_0x32cec3=_0x32cec3-0x0;var _0x5486ab=_0x930f[_0x32cec3];return _0x5486ab;};'use strict';function Dynamics365Account(_0xf9eb82){this['id']=_0xf9eb82['id']||0x0;this[_0xf930('0x0')]=_0xf9eb82[_0xf930('0x0')]||'';this[_0xf930('0x1')]=_0xf9eb82[_0xf930('0x1')]||'';this['password']=_0xf9eb82[_0xf930('0x2')]||'';this[_0xf930('0x3')]=_0xf9eb82[_0xf930('0x3')]||'';this['tenantId']=_0xf9eb82['tenantId']||'';this[_0xf930('0x4')]=_0xf9eb82[_0xf930('0x4')]||'';this['clientSecret']=_0xf9eb82[_0xf930('0x5')]||{};this[_0xf930('0x6')]=_0xf9eb82[_0xf930('0x6')]||'';this['modernAuthentication']=_0xf9eb82[_0xf930('0x7')]||![];this[_0xf930('0x8')]=_0xf9eb82[_0xf930('0x8')]||{};this['CloudProvider']=_0xf9eb82['CloudProvider']||{};}module[_0xf930('0x9')]=Dynamics365Account; \ No newline at end of file +var _0xe402=['modernAuthentication','Configurations','CloudProvider','exports','name','username','password','remoteUri','tenantId','clientId','clientSecret','serverUrl'];(function(_0x1a8b69,_0x6325c0){var _0x5d8be5=function(_0x57cbd0){while(--_0x57cbd0){_0x1a8b69['push'](_0x1a8b69['shift']());}};_0x5d8be5(++_0x6325c0);}(_0xe402,0xf4));var _0x2e40=function(_0x48776c,_0x5a3ac9){_0x48776c=_0x48776c-0x0;var _0x318056=_0xe402[_0x48776c];return _0x318056;};'use strict';function Dynamics365Account(_0x5f3243){this['id']=_0x5f3243['id']||0x0;this[_0x2e40('0x0')]=_0x5f3243[_0x2e40('0x0')]||'';this[_0x2e40('0x1')]=_0x5f3243[_0x2e40('0x1')]||'';this['password']=_0x5f3243[_0x2e40('0x2')]||'';this[_0x2e40('0x3')]=_0x5f3243[_0x2e40('0x3')]||'';this[_0x2e40('0x4')]=_0x5f3243['tenantId']||'';this[_0x2e40('0x5')]=_0x5f3243[_0x2e40('0x5')]||'';this[_0x2e40('0x6')]=_0x5f3243['clientSecret']||{};this[_0x2e40('0x7')]=_0x5f3243[_0x2e40('0x7')]||'';this[_0x2e40('0x8')]=_0x5f3243['modernAuthentication']||![];this[_0x2e40('0x9')]=_0x5f3243[_0x2e40('0x9')]||{};this[_0x2e40('0xa')]=_0x5f3243[_0x2e40('0xa')]||{};}module[_0x2e40('0xb')]=Dynamics365Account; \ No newline at end of file diff --git a/server/services/ami/model/faxAccount.js b/server/services/ami/model/faxAccount.js index 1730dac..09ee5be 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 _0x9cf4=['gateway','faxdetect','t38timeout','tech','SIP','Trunk','ListId','key','exports','name','description','headerinfo','localstationid','minrate','maxrate','v17,v27,v29'];(function(_0x18b5e8,_0x51e875){var _0x25baed=function(_0x3fcdf9){while(--_0x3fcdf9){_0x18b5e8['push'](_0x18b5e8['shift']());}};_0x25baed(++_0x51e875);}(_0x9cf4,0x1b9));var _0x49cf=function(_0x295343,_0xccce4f){_0x295343=_0x295343-0x0;var _0x5baa15=_0x9cf4[_0x295343];return _0x5baa15;};'use strict';function FaxAccount(_0x5bb965){this['id']=_0x5bb965['id']||0x0;this['name']=_0x5bb965[_0x49cf('0x0')]||'';this[_0x49cf('0x1')]=_0x5bb965[_0x49cf('0x1')];this['ecm']=_0x5bb965['ecm'];this[_0x49cf('0x2')]=_0x5bb965['headerinfo'];this[_0x49cf('0x3')]=_0x5bb965[_0x49cf('0x3')];this[_0x49cf('0x4')]=_0x5bb965[_0x49cf('0x4')]||0x960;this[_0x49cf('0x5')]=_0x5bb965['maxrate']||0x3840;this['modem']=_0x5bb965['modem']||_0x49cf('0x6');this[_0x49cf('0x7')]=_0x5bb965['gateway']||'no';this[_0x49cf('0x8')]=_0x5bb965[_0x49cf('0x8')]||'no';this[_0x49cf('0x9')]=_0x5bb965[_0x49cf('0x9')]||0x1388;this[_0x49cf('0xa')]=_0x5bb965[_0x49cf('0xa')]||_0x49cf('0xb');this[_0x49cf('0xc')]=_0x5bb965[_0x49cf('0xc')]?_0x5bb965[_0x49cf('0xc')]:undefined;this['ListId']=_0x5bb965[_0x49cf('0xd')];this[_0x49cf('0xe')]=_0x5bb965['key'];}module[_0x49cf('0xf')]=FaxAccount; \ No newline at end of file +var _0xeb54=['key','exports','description','ecm','headerinfo','localstationid','minrate','maxrate','modem','v17,v27,v29','gateway','faxdetect','t38timeout','tech','Trunk','ListId'];(function(_0x38d5b2,_0xe77bf4){var _0x5b4ba8=function(_0x28ee00){while(--_0x28ee00){_0x38d5b2['push'](_0x38d5b2['shift']());}};_0x5b4ba8(++_0xe77bf4);}(_0xeb54,0x172));var _0x4eb5=function(_0x18d63d,_0x4eff87){_0x18d63d=_0x18d63d-0x0;var _0x1b3735=_0xeb54[_0x18d63d];return _0x1b3735;};'use strict';function FaxAccount(_0x1a4f7c){this['id']=_0x1a4f7c['id']||0x0;this['name']=_0x1a4f7c['name']||'';this['description']=_0x1a4f7c[_0x4eb5('0x0')];this[_0x4eb5('0x1')]=_0x1a4f7c[_0x4eb5('0x1')];this[_0x4eb5('0x2')]=_0x1a4f7c[_0x4eb5('0x2')];this[_0x4eb5('0x3')]=_0x1a4f7c[_0x4eb5('0x3')];this[_0x4eb5('0x4')]=_0x1a4f7c[_0x4eb5('0x4')]||0x960;this[_0x4eb5('0x5')]=_0x1a4f7c[_0x4eb5('0x5')]||0x3840;this[_0x4eb5('0x6')]=_0x1a4f7c['modem']||_0x4eb5('0x7');this[_0x4eb5('0x8')]=_0x1a4f7c['gateway']||'no';this[_0x4eb5('0x9')]=_0x1a4f7c[_0x4eb5('0x9')]||'no';this[_0x4eb5('0xa')]=_0x1a4f7c[_0x4eb5('0xa')]||0x1388;this[_0x4eb5('0xb')]=_0x1a4f7c[_0x4eb5('0xb')]||'SIP';this[_0x4eb5('0xc')]=_0x1a4f7c[_0x4eb5('0xc')]?_0x1a4f7c[_0x4eb5('0xc')]:undefined;this[_0x4eb5('0xd')]=_0x1a4f7c['ListId'];this['key']=_0x1a4f7c[_0x4eb5('0xe')];}module[_0x4eb5('0xf')]=FaxAccount; \ No newline at end of file diff --git a/server/services/ami/model/freshdeskAccount.js b/server/services/ami/model/freshdeskAccount.js index 9ad9a0c..5b4df65 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 _0x5e44=['username','apiKey','token','remoteUri','serverUrl','Configurations','exports','name'];(function(_0x3d56d5,_0x492dc9){var _0x50b4f3=function(_0x281f89){while(--_0x281f89){_0x3d56d5['push'](_0x3d56d5['shift']());}};_0x50b4f3(++_0x492dc9);}(_0x5e44,0x1d7));var _0x45e4=function(_0x4f1b85,_0x2d591c){_0x4f1b85=_0x4f1b85-0x0;var _0x3b37f5=_0x5e44[_0x4f1b85];return _0x3b37f5;};'use strict';function FreshdeskAccount(_0x348be7){this['id']=_0x348be7['id']||0x0;this[_0x45e4('0x0')]=_0x348be7[_0x45e4('0x0')]||'';this[_0x45e4('0x1')]=_0x348be7[_0x45e4('0x1')]||'';this[_0x45e4('0x2')]=_0x348be7[_0x45e4('0x3')]||'';this['remoteUri']=_0x348be7[_0x45e4('0x4')]||'';this[_0x45e4('0x5')]=_0x348be7[_0x45e4('0x5')]||'';this[_0x45e4('0x6')]=_0x348be7[_0x45e4('0x6')]||{};}module[_0x45e4('0x7')]=FreshdeskAccount; \ No newline at end of file +var _0xc99e=['name','apiKey','token','remoteUri','serverUrl','Configurations','exports'];(function(_0x76fc96,_0x554c0c){var _0x55eb88=function(_0x236229){while(--_0x236229){_0x76fc96['push'](_0x76fc96['shift']());}};_0x55eb88(++_0x554c0c);}(_0xc99e,0x188));var _0xec99=function(_0x5bb18e,_0x55fab0){_0x5bb18e=_0x5bb18e-0x0;var _0x591970=_0xc99e[_0x5bb18e];return _0x591970;};'use strict';function FreshdeskAccount(_0x4af35c){this['id']=_0x4af35c['id']||0x0;this[_0xec99('0x0')]=_0x4af35c[_0xec99('0x0')]||'';this['username']=_0x4af35c['username']||'';this[_0xec99('0x1')]=_0x4af35c[_0xec99('0x2')]||'';this['remoteUri']=_0x4af35c[_0xec99('0x3')]||'';this[_0xec99('0x4')]=_0x4af35c[_0xec99('0x4')]||'';this['Configurations']=_0x4af35c[_0xec99('0x5')]||{};}module[_0xec99('0x6')]=FreshdeskAccount; \ No newline at end of file diff --git a/server/services/ami/model/freshsalesAccount.js b/server/services/ami/model/freshsalesAccount.js index 4770e5a..00b94d6 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 _0x9432=['serverUrl','Configurations','exports','name','username','token'];(function(_0x4b5c3b,_0x40b342){var _0xa00fcc=function(_0x1d9cd4){while(--_0x1d9cd4){_0x4b5c3b['push'](_0x4b5c3b['shift']());}};_0xa00fcc(++_0x40b342);}(_0x9432,0x1e3));var _0x2943=function(_0x4c09c6,_0xbcf99e){_0x4c09c6=_0x4c09c6-0x0;var _0x2f274d=_0x9432[_0x4c09c6];return _0x2f274d;};'use strict';function FreshsalesAccount(_0x2a81c1){this['id']=_0x2a81c1['id']||0x0;this[_0x2943('0x0')]=_0x2a81c1['name']||'';this[_0x2943('0x1')]=_0x2a81c1[_0x2943('0x1')]||'';this['apiKey']=_0x2a81c1[_0x2943('0x2')]||'';this['remoteUri']=_0x2a81c1['remoteUri']||'';this[_0x2943('0x3')]=_0x2a81c1[_0x2943('0x3')]||'';this[_0x2943('0x4')]=_0x2a81c1[_0x2943('0x4')]||{};}module[_0x2943('0x5')]=FreshsalesAccount; \ No newline at end of file +var _0x873a=['name','username','remoteUri','serverUrl','Configurations','exports'];(function(_0x50582b,_0x306a05){var _0x316c37=function(_0x46dc6c){while(--_0x46dc6c){_0x50582b['push'](_0x50582b['shift']());}};_0x316c37(++_0x306a05);}(_0x873a,0x1c2));var _0xa873=function(_0x47cac7,_0x41db55){_0x47cac7=_0x47cac7-0x0;var _0x47c062=_0x873a[_0x47cac7];return _0x47c062;};'use strict';function FreshsalesAccount(_0x4c8d3b){this['id']=_0x4c8d3b['id']||0x0;this[_0xa873('0x0')]=_0x4c8d3b[_0xa873('0x0')]||'';this['username']=_0x4c8d3b[_0xa873('0x1')]||'';this['apiKey']=_0x4c8d3b['token']||'';this[_0xa873('0x2')]=_0x4c8d3b[_0xa873('0x2')]||'';this['serverUrl']=_0x4c8d3b[_0xa873('0x3')]||'';this[_0xa873('0x4')]=_0x4c8d3b['Configurations']||{};}module[_0xa873('0x5')]=FreshsalesAccount; \ No newline at end of file diff --git a/server/services/ami/model/queueReport.js b/server/services/ami/model/queueReport.js index ce1ed5a..e4df40d 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 _0x2467=['voice','mohtime','variables','type','calleridname','queue','queuecallerjoinAt','position','queuecallerabandon','queuecallercompleteAt','queuecallerexitAt','channel','connectedlinenum','connectedlinename','context','exten','priority','holdtime'];(function(_0x2cca6e,_0x5c4d19){var _0x3ddfb5=function(_0x2ae4b8){while(--_0x2ae4b8){_0x2cca6e['push'](_0x2cca6e['shift']());}};_0x3ddfb5(++_0x5c4d19);}(_0x2467,0x147));var _0x7246=function(_0x1c9676,_0x1447c5){_0x1c9676=_0x1c9676-0x0;var _0x37be7e=_0x2467[_0x1c9676];return _0x37be7e;};'use strict';function QueueReport(){this[_0x7246('0x0')]='inbound';this['uniqueid']='';this['calleridnum']='';this[_0x7246('0x1')]='';this[_0x7246('0x2')]='';this[_0x7246('0x3')]=null;this['queuecallerleaveAt']=null;this[_0x7246('0x4')]=0x1;this['count']=0x1;this[_0x7246('0x5')]=![];this['queuecallerabandonAt']=null;this['queuecallercomplete']=![];this[_0x7246('0x6')]=null;this['queuecallerexit']=![];this[_0x7246('0x7')]=null;this['originalposition']=0x1;this[_0x7246('0x8')]='';this[_0x7246('0x9')]='';this[_0x7246('0xa')]='';this['accountcode']='';this[_0x7246('0xb')]='';this[_0x7246('0xc')]='';this[_0x7246('0xd')]='';this[_0x7246('0xe')]=0x0;this['assigned']=![];this['lastAssignedTo']='';this['motionChannel']=_0x7246('0xf');this[_0x7246('0x10')]=0x0;this[_0x7246('0x11')]={};}module['exports']=QueueReport; \ No newline at end of file +var _0x649a=['queue','queuecallerjoinAt','position','count','queuecallerabandonAt','queuecallercomplete','queuecallercompleteAt','queuecallerexit','queuecallerexitAt','channel','accountcode','context','exten','assigned','lastAssignedTo','voice','mohtime','exports','type','inbound','uniqueid','calleridnum','calleridname'];(function(_0x3dd15e,_0x1f0015){var _0x231fd0=function(_0x4f680a){while(--_0x4f680a){_0x3dd15e['push'](_0x3dd15e['shift']());}};_0x231fd0(++_0x1f0015);}(_0x649a,0x10f));var _0xa649=function(_0xd3fee5,_0x1428b5){_0xd3fee5=_0xd3fee5-0x0;var _0xb7815a=_0x649a[_0xd3fee5];return _0xb7815a;};'use strict';function QueueReport(){this[_0xa649('0x0')]=_0xa649('0x1');this[_0xa649('0x2')]='';this[_0xa649('0x3')]='';this[_0xa649('0x4')]='';this[_0xa649('0x5')]='';this[_0xa649('0x6')]=null;this['queuecallerleaveAt']=null;this[_0xa649('0x7')]=0x1;this[_0xa649('0x8')]=0x1;this['queuecallerabandon']=![];this[_0xa649('0x9')]=null;this[_0xa649('0xa')]=![];this[_0xa649('0xb')]=null;this[_0xa649('0xc')]=![];this[_0xa649('0xd')]=null;this['originalposition']=0x1;this[_0xa649('0xe')]='';this['connectedlinenum']='';this['connectedlinename']='';this[_0xa649('0xf')]='';this[_0xa649('0x10')]='';this[_0xa649('0x11')]='';this['priority']='';this['holdtime']=0x0;this[_0xa649('0x12')]=![];this[_0xa649('0x13')]='';this['motionChannel']=_0xa649('0x14');this[_0xa649('0x15')]=0x0;this['variables']={};}module[_0xa649('0x16')]=QueueReport; \ No newline at end of file diff --git a/server/services/ami/model/salesforceAccount.js b/server/services/ami/model/salesforceAccount.js index 7c3718f..9b31b05 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 _0x9a6b=['integrationTab','serverUrl','Configurations','username','remoteUri','password','clientId','clientSecret','type'];(function(_0x1e6350,_0x2de3ae){var _0x23e891=function(_0x4c0376){while(--_0x4c0376){_0x1e6350['push'](_0x1e6350['shift']());}};_0x23e891(++_0x2de3ae);}(_0x9a6b,0x13e));var _0xb9a6=function(_0x538506,_0x1414fa){_0x538506=_0x538506-0x0;var _0x5787d5=_0x9a6b[_0x538506];return _0x5787d5;};'use strict';function SalesforceAccount(_0x494484){this['id']=_0x494484['id']||0x0;this['name']=_0x494484['name']||'';this['username']=_0x494484[_0xb9a6('0x0')]||'';this[_0xb9a6('0x1')]=_0x494484[_0xb9a6('0x1')]||'';this[_0xb9a6('0x2')]=_0x494484[_0xb9a6('0x2')]||'';this[_0xb9a6('0x3')]=_0x494484[_0xb9a6('0x3')]||'';this[_0xb9a6('0x4')]=_0x494484['clientSecret']||'';this['securityToken']=_0x494484['securityToken']||'';this[_0xb9a6('0x5')]=_0x494484[_0xb9a6('0x5')]||_0xb9a6('0x6');this[_0xb9a6('0x7')]=_0x494484['serverUrl']||'';this[_0xb9a6('0x8')]=_0x494484[_0xb9a6('0x8')]||{};}module['exports']=SalesforceAccount; \ No newline at end of file +var _0x1a80=['exports','name','username','remoteUri','password','clientId','clientSecret','securityToken','type','integrationTab','serverUrl','Configurations'];(function(_0x4565b0,_0x473f35){var _0x26e1eb=function(_0x2ed554){while(--_0x2ed554){_0x4565b0['push'](_0x4565b0['shift']());}};_0x26e1eb(++_0x473f35);}(_0x1a80,0x1e1));var _0x01a8=function(_0x51fddc,_0x38f307){_0x51fddc=_0x51fddc-0x0;var _0xad12ee=_0x1a80[_0x51fddc];return _0xad12ee;};'use strict';function SalesforceAccount(_0x515240){this['id']=_0x515240['id']||0x0;this['name']=_0x515240[_0x01a8('0x0')]||'';this['username']=_0x515240[_0x01a8('0x1')]||'';this['remoteUri']=_0x515240[_0x01a8('0x2')]||'';this[_0x01a8('0x3')]=_0x515240[_0x01a8('0x3')]||'';this[_0x01a8('0x4')]=_0x515240[_0x01a8('0x4')]||'';this[_0x01a8('0x5')]=_0x515240['clientSecret']||'';this[_0x01a8('0x6')]=_0x515240[_0x01a8('0x6')]||'';this['type']=_0x515240[_0x01a8('0x7')]||_0x01a8('0x8');this[_0x01a8('0x9')]=_0x515240['serverUrl']||'';this[_0x01a8('0xa')]=_0x515240['Configurations']||{};}module[_0x01a8('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 f3cd0a2..5ad0c92 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 _0xe1e4=['password','remoteUri','serverUrl','Configurations','exports','name','username'];(function(_0x3e4011,_0x1daf18){var _0x43dbbe=function(_0x2d98a7){while(--_0x2d98a7){_0x3e4011['push'](_0x3e4011['shift']());}};_0x43dbbe(++_0x1daf18);}(_0xe1e4,0x67));var _0x4e1e=function(_0x27af45,_0x1b57aa){_0x27af45=_0x27af45-0x0;var _0x18df21=_0xe1e4[_0x27af45];return _0x18df21;};'use strict';function ServicenowAccount(_0x221afa){this['id']=_0x221afa['id']||0x0;this[_0x4e1e('0x0')]=_0x221afa['name']||'';this['username']=_0x221afa[_0x4e1e('0x1')]||'';this[_0x4e1e('0x2')]=_0x221afa[_0x4e1e('0x2')]||'';this[_0x4e1e('0x3')]=_0x221afa[_0x4e1e('0x3')]||'';this[_0x4e1e('0x4')]=_0x221afa[_0x4e1e('0x4')]||'';this[_0x4e1e('0x5')]=_0x221afa[_0x4e1e('0x5')]||{};}module[_0x4e1e('0x6')]=ServicenowAccount; \ No newline at end of file +var _0xddb2=['serverUrl','exports','password'];(function(_0x5259c4,_0x48b195){var _0x39edd3=function(_0x177a88){while(--_0x177a88){_0x5259c4['push'](_0x5259c4['shift']());}};_0x39edd3(++_0x48b195);}(_0xddb2,0xf5));var _0x2ddb=function(_0x1a3def,_0x40269b){_0x1a3def=_0x1a3def-0x0;var _0x23a0e9=_0xddb2[_0x1a3def];return _0x23a0e9;};'use strict';function ServicenowAccount(_0x391d9d){this['id']=_0x391d9d['id']||0x0;this['name']=_0x391d9d['name']||'';this['username']=_0x391d9d['username']||'';this[_0x2ddb('0x0')]=_0x391d9d[_0x2ddb('0x0')]||'';this['remoteUri']=_0x391d9d['remoteUri']||'';this[_0x2ddb('0x1')]=_0x391d9d[_0x2ddb('0x1')]||'';this['Configurations']=_0x391d9d['Configurations']||{};}module[_0x2ddb('0x2')]=ServicenowAccount; \ No newline at end of file diff --git a/server/services/ami/model/sugarcrmAccount.js b/server/services/ami/model/sugarcrmAccount.js index ce672e7..db95606 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 _0x25db=['serverUrl','Configurations','exports','name','username','password','remoteUri'];(function(_0x307d86,_0x9264f2){var _0x361745=function(_0x1b64e1){while(--_0x1b64e1){_0x307d86['push'](_0x307d86['shift']());}};_0x361745(++_0x9264f2);}(_0x25db,0x137));var _0xb25d=function(_0x25a0d1,_0xf1de45){_0x25a0d1=_0x25a0d1-0x0;var _0x2de5bc=_0x25db[_0x25a0d1];return _0x2de5bc;};'use strict';function SugarcrmAccount(_0x2ce74e){this['id']=_0x2ce74e['id']||0x0;this[_0xb25d('0x0')]=_0x2ce74e[_0xb25d('0x0')]||'';this[_0xb25d('0x1')]=_0x2ce74e['username']||'';this[_0xb25d('0x2')]=_0x2ce74e[_0xb25d('0x2')]||'';this[_0xb25d('0x3')]=_0x2ce74e[_0xb25d('0x3')]||'';this[_0xb25d('0x4')]=_0x2ce74e[_0xb25d('0x4')]||'';this[_0xb25d('0x5')]=_0x2ce74e[_0xb25d('0x5')]||{};}module[_0xb25d('0x6')]=SugarcrmAccount; \ No newline at end of file +var _0x97da=['username','password','remoteUri','serverUrl','Configurations','exports','name'];(function(_0x2a4559,_0x22195e){var _0x1e51f7=function(_0x3d2ca7){while(--_0x3d2ca7){_0x2a4559['push'](_0x2a4559['shift']());}};_0x1e51f7(++_0x22195e);}(_0x97da,0x164));var _0xa97d=function(_0x48d889,_0x13d644){_0x48d889=_0x48d889-0x0;var _0x52fce2=_0x97da[_0x48d889];return _0x52fce2;};'use strict';function SugarcrmAccount(_0x4c5ed1){this['id']=_0x4c5ed1['id']||0x0;this[_0xa97d('0x0')]=_0x4c5ed1[_0xa97d('0x0')]||'';this['username']=_0x4c5ed1[_0xa97d('0x1')]||'';this[_0xa97d('0x2')]=_0x4c5ed1[_0xa97d('0x2')]||'';this[_0xa97d('0x3')]=_0x4c5ed1[_0xa97d('0x3')]||'';this['serverUrl']=_0x4c5ed1[_0xa97d('0x4')]||'';this[_0xa97d('0x5')]=_0x4c5ed1['Configurations']||{};}module[_0xa97d('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 4718158..c012012 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 _0xd23d=['state','unknown','address','exports','name','accountcode'];(function(_0x2f6247,_0x16ba65){var _0xd3511=function(_0x43cb0f){while(--_0x43cb0f){_0x2f6247['push'](_0x2f6247['shift']());}};_0xd3511(++_0x16ba65);}(_0xd23d,0xa0));var _0xdd23=function(_0x5c14f6,_0x2979d8){_0x5c14f6=_0x5c14f6-0x0;var _0x4949b3=_0xd23d[_0x5c14f6];return _0x4949b3;};'use strict';function Telephone(_0x1c345b){this['id']=_0x1c345b['id']||0x0;this[_0xdd23('0x0')]=_0x1c345b[_0xdd23('0x0')]||'';this[_0xdd23('0x1')]=_0x1c345b[_0xdd23('0x1')]||'';this[_0xdd23('0x2')]=_0xdd23('0x3');this['stateTime']=0x0;this['status']='unknown';this[_0xdd23('0x4')]='';}module[_0xdd23('0x5')]=Telephone; \ No newline at end of file +var _0x83f2=['stateTime','status','exports','name','state','unknown'];(function(_0x321bb2,_0x202794){var _0x9c12ed=function(_0x263dd3){while(--_0x263dd3){_0x321bb2['push'](_0x321bb2['shift']());}};_0x9c12ed(++_0x202794);}(_0x83f2,0x87));var _0x283f=function(_0x33a49c,_0x1d0074){_0x33a49c=_0x33a49c-0x0;var _0x595401=_0x83f2[_0x33a49c];return _0x595401;};'use strict';function Telephone(_0x1e99eb){this['id']=_0x1e99eb['id']||0x0;this[_0x283f('0x0')]=_0x1e99eb['name']||'';this['accountcode']=_0x1e99eb['accountcode']||'';this[_0x283f('0x1')]=_0x283f('0x2');this[_0x283f('0x3')]=0x0;this[_0x283f('0x4')]='unknown';this['address']='';}module[_0x283f('0x5')]=Telephone; \ No newline at end of file diff --git a/server/services/ami/model/template.js b/server/services/ami/model/template.js index fb7faa2..2892352 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(_0x57576,_0x1de56e){var _0xc895f5=function(_0x9e727c){while(--_0x9e727c){_0x57576['push'](_0x57576['shift']());}};_0xc895f5(++_0x1de56e);}(_0xa9e0,0x123));var _0x0a9e=function(_0x5b78e8,_0x55096b){_0x5b78e8=_0x5b78e8-0x0;var _0xf2c321=_0xa9e0[_0x5b78e8];return _0xf2c321;};'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(_0x2e7696,_0x39173a){var _0x571c6c=function(_0x148c91){while(--_0x148c91){_0x2e7696['push'](_0x2e7696['shift']());}};_0x571c6c(++_0x39173a);}(_0xb10b,0x12a));var _0xbb10=function(_0x3a10e3,_0x3cdb35){_0x3a10e3=_0x3a10e3-0x0;var _0xf067c8=_0xb10b[_0x3a10e3];return _0xf067c8;};'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 5bb439b..4608c96 100644 --- a/server/services/ami/model/trigger.js +++ b/server/services/ami/model/trigger.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x8603=['exports','name','channel','status','AllConditions','AnyConditions','Actions'];(function(_0x308590,_0x12a424){var _0x5a4110=function(_0x3283bc){while(--_0x3283bc){_0x308590['push'](_0x308590['shift']());}};_0x5a4110(++_0x12a424);}(_0x8603,0x190));var _0x3860=function(_0x1a7bdd,_0x3a087b){_0x1a7bdd=_0x1a7bdd-0x0;var _0xebe0d1=_0x8603[_0x1a7bdd];return _0xebe0d1;};'use strict';function Trigger(_0xba4b79){this['id']=_0xba4b79['id']||0x0;this[_0x3860('0x0')]=_0xba4b79[_0x3860('0x0')]||'';this[_0x3860('0x1')]=_0xba4b79['channel']||'voice';this[_0x3860('0x2')]=_0xba4b79[_0x3860('0x2')]||![];this[_0x3860('0x3')]=_0xba4b79['AllConditions']||[];this[_0x3860('0x4')]=_0xba4b79['AnyConditions']||[];this[_0x3860('0x5')]=_0xba4b79[_0x3860('0x5')]||[];}module[_0x3860('0x6')]=Trigger; \ No newline at end of file +var _0x1a85=['status','AllConditions','AnyConditions','Actions','name','channel'];(function(_0x397e5f,_0x454c8f){var _0x5302b8=function(_0x1a29ef){while(--_0x1a29ef){_0x397e5f['push'](_0x397e5f['shift']());}};_0x5302b8(++_0x454c8f);}(_0x1a85,0x178));var _0x51a8=function(_0x421263,_0x18187d){_0x421263=_0x421263-0x0;var _0x34e4b5=_0x1a85[_0x421263];return _0x34e4b5;};'use strict';function Trigger(_0x4570ac){this['id']=_0x4570ac['id']||0x0;this['name']=_0x4570ac[_0x51a8('0x0')]||'';this[_0x51a8('0x1')]=_0x4570ac[_0x51a8('0x1')]||'voice';this['status']=_0x4570ac[_0x51a8('0x2')]||![];this[_0x51a8('0x3')]=_0x4570ac[_0x51a8('0x3')]||[];this['AnyConditions']=_0x4570ac[_0x51a8('0x4')]||[];this['Actions']=_0x4570ac[_0x51a8('0x5')]||[];}module['exports']=Trigger; \ No newline at end of file diff --git a/server/services/ami/model/trunk.js b/server/services/ami/model/trunk.js index 0bacd79..97fc496 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 _0x4c22=['domainport','registrationtime','defaultuser','exports','active','name','state','unknown','stateTime','status','registry','split','port','domain'];(function(_0x33a6c3,_0x36acba){var _0x30590b=function(_0x5136de){while(--_0x5136de){_0x33a6c3['push'](_0x33a6c3['shift']());}};_0x30590b(++_0x36acba);}(_0x4c22,0x154));var _0x24c2=function(_0x479b74,_0x2121e3){_0x479b74=_0x479b74-0x0;var _0x538fe9=_0x4c22[_0x479b74];return _0x538fe9;};'use strict';function Trunk(_0x434272){this['id']=_0x434272['id']||0x0;this[_0x24c2('0x0')]=_0x434272[_0x24c2('0x0')]||![];this[_0x24c2('0x1')]=_0x434272[_0x24c2('0x1')]||'';this[_0x24c2('0x2')]=_0x24c2('0x3');this[_0x24c2('0x4')]=0x0;this[_0x24c2('0x5')]=_0x24c2('0x3');this[_0x24c2('0x6')]=_0x434272['registry']&&_0x434272[_0x24c2('0x6')]['indexOf'](':')?_0x434272[_0x24c2('0x6')][_0x24c2('0x7')](':')[0x0]:'';this['host']='';this[_0x24c2('0x8')]='';this[_0x24c2('0x9')]='';this[_0x24c2('0xa')]='';this['refresh']='';this['stateRegistry']='unknown';this[_0x24c2('0xb')]='';this['address']='';this[_0x24c2('0xc')]=_0x434272[_0x24c2('0xc')]||'';}module[_0x24c2('0xd')]=Trunk; \ No newline at end of file +var _0xd70c=['state','stateTime','status','unknown','registry','indexOf','split','port','domain','stateRegistry','registrationtime','address','defaultuser','exports','active','name'];(function(_0x5138e0,_0x24fbbc){var _0x18e57b=function(_0x5eda17){while(--_0x5eda17){_0x5138e0['push'](_0x5138e0['shift']());}};_0x18e57b(++_0x24fbbc);}(_0xd70c,0x9e));var _0xcd70=function(_0x3dd419,_0x4c60b){_0x3dd419=_0x3dd419-0x0;var _0xf005fc=_0xd70c[_0x3dd419];return _0xf005fc;};'use strict';function Trunk(_0x250298){this['id']=_0x250298['id']||0x0;this[_0xcd70('0x0')]=_0x250298[_0xcd70('0x0')]||![];this[_0xcd70('0x1')]=_0x250298['name']||'';this[_0xcd70('0x2')]='unknown';this[_0xcd70('0x3')]=0x0;this[_0xcd70('0x4')]=_0xcd70('0x5');this['registry']=_0x250298[_0xcd70('0x6')]&&_0x250298[_0xcd70('0x6')][_0xcd70('0x7')](':')?_0x250298[_0xcd70('0x6')][_0xcd70('0x8')](':')[0x0]:'';this['host']='';this[_0xcd70('0x9')]='';this[_0xcd70('0xa')]='';this['domainport']='';this['refresh']='';this[_0xcd70('0xb')]='unknown';this[_0xcd70('0xc')]='';this[_0xcd70('0xd')]='';this['defaultuser']=_0x250298[_0xcd70('0xe')]||'';}module[_0xcd70('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 13a5c19..3153cf7 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 _0x28e3=['exports','exten','recordingFormat','none','mandatoryDisposition'];(function(_0x5f457c,_0x1569f5){var _0x3a1067=function(_0x345f79){while(--_0x345f79){_0x5f457c['push'](_0x5f457c['shift']());}};_0x3a1067(++_0x1569f5);}(_0x28e3,0x19b));var _0x328e=function(_0x33032e,_0x31411a){_0x33032e=_0x33032e-0x0;var _0x13316b=_0x28e3[_0x33032e];return _0x13316b;};'use strict';function voiceExtension(_0x3a1c9a){this['id']=_0x3a1c9a['id']||0x0;this[_0x328e('0x0')]=_0x3a1c9a[_0x328e('0x0')]||'';this['recordingFormat']=_0x3a1c9a[_0x328e('0x1')]||_0x328e('0x2');this[_0x328e('0x3')]=_0x3a1c9a[_0x328e('0x3')]||![];}module[_0x328e('0x4')]=voiceExtension; \ No newline at end of file +var _0x6c22=['exten','recordingFormat','none','mandatoryDisposition','exports'];(function(_0x2656f9,_0x501aaf){var _0xd2211e=function(_0x2278c0){while(--_0x2278c0){_0x2656f9['push'](_0x2656f9['shift']());}};_0xd2211e(++_0x501aaf);}(_0x6c22,0x16d));var _0x26c2=function(_0x5dca17,_0x43cdb8){_0x5dca17=_0x5dca17-0x0;var _0xcc7f0c=_0x6c22[_0x5dca17];return _0xcc7f0c;};'use strict';function voiceExtension(_0x4a02e5){this['id']=_0x4a02e5['id']||0x0;this[_0x26c2('0x0')]=_0x4a02e5[_0x26c2('0x0')]||'';this[_0x26c2('0x1')]=_0x4a02e5[_0x26c2('0x1')]||_0x26c2('0x2');this['mandatoryDisposition']=_0x4a02e5[_0x26c2('0x3')]||![];}module[_0x26c2('0x4')]=voiceExtension; \ No newline at end of file diff --git a/server/services/ami/model/voiceQueue.js b/server/services/ami/model/voiceQueue.js index 31c3bb2..595dac0 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 _0x4672=['outboundUnknownCallsDay','outboundBlacklistCallsDay','outboundOriginateFailureCallsDay','outboundReCallsDay','startProgressive','startPredictive','handlePredictive','predictiveIntervalMultiplicativeFactor','predictiveIntervalTotalCalls','predictiveIntervalAnsweredCalls','predictiveIntervalDroppedCallsCallersExit','predictiveIntervalDroppedCallsTimeout','predictiveIntervalAvgTalktime','predictiveIntervalAvailable','predictiveIntervalMaxThreshold','predictiveIntervalMinThreshold','dialPredictiveIntervalMaxThreshold','predictiveIntervalErlangCallsDroppedCalls','erlangCalls','erlangBusyFactor','dialRecallMeTimeout','dialRecallInQueue','dialPreviewAutoRecallMe','dialPreviewRecallmeReminder','dialQueueProject2','dialAgiAfterHangupClient','dialAgiAfterHangupAgent','mandatoryDisposition','mandatoryDispositionPause','queueSummaryCountersUpdated','exports','wav','gsm','fewestcalls','linear','ringall','roundrobin','rrmemory','rrordered','name','monitor_format','type','inbound','waiting','total','answered','sumHoldTime','sumBillable','unmanaged','abandoned','busy','inUse','invalid','loggedIn','notInUse','onHold','ringing','ringInUse','talking','unavailable','unknown','acw','autopause','sendMessageOneNotActive','message','originated','temp','dialTimezone','dialGlobalInterval','dialActive','dialMethod','dialLimitChannel','dialLimitQueue','dialPredictiveOptimization','dialPredictiveOptimizationPercentage','dialPredictiveInterval','dialOriginateCallerIdName','dialOriginateCallerIdNumber','dialQueueOptions','dialQueueTimeout','dialQueueProject','dialCongestionMaxRetry','dialCongestionRetryFrequency','dialBusyMaxRetry','dialBusyRetryFrequency','dialNoAnswerMaxRetry','dialNoAnswerRetryFrequency','dialNoSuchNumberMaxRetry','dialNoSuchNumberRetryFrequency','dialDropMaxRetry','dialDropRetryFrequency','dialAbandonedMaxRetry','dialAbandonedRetryFrequency','dialMachineRetryFrequency','dialAgentRejectMaxRetry','dialAgentRejectRetryFrequency','callAdditionalPhoneAfterMin','dialGlobalMaxRetry','Trunk','TrunkBackup','dialPrefix','dialOrderByScheduledAt','DESC','dialRandomLastDigitCallerIdNumber','dialCutDigit','strategy','dialAMDActive','dialAMDInitialSilence','dialAMDGreeting','dialAMDTotalAnalysisTime','dialAMDMinWordLength','dialAMDBetweenWordsSilence','dialAMDMaximumNumberOfWords','dialAMDSilenceThreshold','dialAMDMaximumWordLength','outboundRejectCallsDay','pTalking','timeout','outboundAnswerCallsDay','outboundAnswerAgiCallsDay','outboundBusyCallsDay'];(function(_0x3c5b9f,_0x5ca6dc){var _0x1eb640=function(_0x4796b0){while(--_0x4796b0){_0x3c5b9f['push'](_0x3c5b9f['shift']());}};_0x1eb640(++_0x5ca6dc);}(_0x4672,0x18a));var _0x2467=function(_0x1d7827,_0x42b0db){_0x1d7827=_0x1d7827-0x0;var _0xb449f1=_0x4672[_0x1d7827];return _0xb449f1;};'use strict';var monitorFormat={'wav':_0x2467('0x0'),'wav49':'wav49','gsm':_0x2467('0x1')};var strategy={'fewestcalls':_0x2467('0x2'),'leastrecent':'leastrecent','linear':_0x2467('0x3'),'random':'random','ringall':_0x2467('0x4'),'rr':_0x2467('0x5'),'rrmemory':_0x2467('0x6'),'rrordered':_0x2467('0x7'),'wrandom':'wrandom'};function VoiceQueue(_0x19e085){this['id']=_0x19e085['id']||0x0;this['name']=_0x19e085[_0x2467('0x8')]||'';this[_0x2467('0x9')]=_0x19e085[_0x2467('0x9')]||'';this[_0x2467('0xa')]=_0x19e085[_0x2467('0xa')]||_0x2467('0xb');this[_0x2467('0xc')]=0x0;this[_0x2467('0xd')]=0x0;this[_0x2467('0xe')]=0x0;this['sumDuration']=0x0;this[_0x2467('0xf')]=0x0;this[_0x2467('0x10')]=0x0;this[_0x2467('0x11')]=0x0;this[_0x2467('0x12')]=0x0;this['available']=0x0;this[_0x2467('0x13')]=0x0;this[_0x2467('0x14')]=0x0;this[_0x2467('0x15')]=0x0;this[_0x2467('0x16')]=0x0;this[_0x2467('0x17')]=0x0;this[_0x2467('0x18')]=0x0;this['paused']=0x0;this[_0x2467('0x19')]=0x0;this[_0x2467('0x1a')]=0x0;this[_0x2467('0x1b')]=0x0;this[_0x2467('0x1c')]=0x0;this[_0x2467('0x1d')]=0x0;this[_0x2467('0x1e')]=_0x19e085[_0x2467('0x1e')]||![];this['acwTimeout']=_0x19e085['acwTimeout']||0xa;this['autopause']=_0x19e085[_0x2467('0x1f')]||'no';this[_0x2467('0x20')]=!![];this[_0x2467('0x21')]='';this['statusMessage']='';this[_0x2467('0x22')]=0x0;this[_0x2467('0x23')]=0x0;this['dialTimezone']=_0x19e085[_0x2467('0x24')]||null;this[_0x2467('0x25')]=_0x19e085[_0x2467('0x25')]?_0x19e085[_0x2467('0x25')]:null;this[_0x2467('0x26')]=_0x19e085[_0x2467('0x26')];this[_0x2467('0x27')]=_0x19e085['dialMethod']||'progressive';this[_0x2467('0x28')]=_0x19e085['dialLimitChannel']||0x0;this[_0x2467('0x29')]=_0x19e085[_0x2467('0x29')]||0x0;this['dialPowerLevel']=_0x19e085['dialPowerLevel']||0x1;this[_0x2467('0x2a')]=_0x19e085[_0x2467('0x2a')]||'dropRate';this[_0x2467('0x2b')]=_0x19e085[_0x2467('0x2b')]||0.03;this[_0x2467('0x2c')]=_0x19e085[_0x2467('0x2c')]||0x258;this['dialOriginateCallerIdName']=_0x19e085[_0x2467('0x2d')]||'anonymous';this['dialOriginateCallerIdNumber']=_0x19e085[_0x2467('0x2e')]||'anonymous';this['dialOriginateTimeout']=_0x19e085['dialOriginateTimeout']||0x1e;this[_0x2467('0x2f')]=_0x19e085[_0x2467('0x2f')]||'tTxX';this[_0x2467('0x30')]=_0x19e085[_0x2467('0x30')]||0x3;this[_0x2467('0x31')]=_0x19e085[_0x2467('0x31')]||undefined;this[_0x2467('0x32')]=_0x19e085[_0x2467('0x32')]||0x3;this['dialCongestionRetryFrequency']=_0x19e085[_0x2467('0x33')]||0x96;this[_0x2467('0x34')]=_0x19e085[_0x2467('0x34')]||0x3;this[_0x2467('0x35')]=_0x19e085[_0x2467('0x35')]||0x96;this[_0x2467('0x36')]=_0x19e085[_0x2467('0x36')]||0x3;this[_0x2467('0x37')]=_0x19e085['dialNoAnswerRetryFrequency']||0x96;this[_0x2467('0x38')]=_0x19e085[_0x2467('0x38')]||0x3;this[_0x2467('0x39')]=_0x19e085[_0x2467('0x39')]||0x96;this[_0x2467('0x3a')]=_0x19e085[_0x2467('0x3a')]||0x3;this[_0x2467('0x3b')]=_0x19e085['dialDropRetryFrequency']||0x96;this[_0x2467('0x3c')]=_0x19e085['dialAbandonedMaxRetry']||0x3;this['dialAbandonedRetryFrequency']=_0x19e085[_0x2467('0x3d')]||0x96;this['dialMachineMaxRetry']=_0x19e085['dialMachineMaxRetry']||0x3;this['dialMachineRetryFrequency']=_0x19e085[_0x2467('0x3e')]||0x96;this[_0x2467('0x3f')]=_0x19e085[_0x2467('0x3f')]||0x3;this[_0x2467('0x40')]=_0x19e085['dialAgentRejectRetryFrequency']||0x96;this[_0x2467('0x41')]=_0x19e085[_0x2467('0x41')]||0x3;this[_0x2467('0x42')]=_0x19e085['dialGlobalMaxRetry']||0x4;this[_0x2467('0x43')]=_0x19e085['Trunk']?_0x19e085['Trunk']:undefined;this[_0x2467('0x44')]=_0x19e085[_0x2467('0x44')]?_0x19e085[_0x2467('0x44')]:undefined;this[_0x2467('0x45')]=_0x19e085[_0x2467('0x45')]||undefined;this['Interval']=_0x19e085['Interval']?_0x19e085['Interval']:undefined;this[_0x2467('0x46')]=_0x19e085[_0x2467('0x46')]||_0x2467('0x47');this[_0x2467('0x48')]=_0x19e085[_0x2467('0x48')]||undefined;this[_0x2467('0x49')]=_0x19e085[_0x2467('0x49')]||undefined;this[_0x2467('0x4a')]=strategy[_0x19e085[_0x2467('0x4a')]];this['queueStatusComplete']=!![];this[_0x2467('0x4b')]=_0x19e085[_0x2467('0x4b')]||![];this[_0x2467('0x4c')]=_0x19e085[_0x2467('0x4c')];this[_0x2467('0x4d')]=_0x19e085[_0x2467('0x4d')];this['dialAMDAfterGreetingSilence']=_0x19e085['dialAMDAfterGreetingSilence'];this[_0x2467('0x4e')]=_0x19e085[_0x2467('0x4e')];this[_0x2467('0x4f')]=_0x19e085[_0x2467('0x4f')];this[_0x2467('0x50')]=_0x19e085['dialAMDBetweenWordsSilence'];this[_0x2467('0x51')]=_0x19e085['dialAMDMaximumNumberOfWords'];this['dialAMDSilenceThreshold']=_0x19e085[_0x2467('0x52')];this[_0x2467('0x53')]=_0x19e085[_0x2467('0x53')];this[_0x2467('0x54')]=0x0;this[_0x2467('0x55')]=0x0;this[_0x2467('0x56')]=_0x19e085[_0x2467('0x56')];this[_0x2467('0x57')]=0x0;this[_0x2467('0x58')]=0x0;this['outboundNoAnswerCallsDay']=0x0;this[_0x2467('0x59')]=0x0;this['outboundCongestionCallsDay']=0x0;this['outboundNoSuchCallsDay']=0x0;this[_0x2467('0x5a')]=0x0;this[_0x2467('0x5b')]=0x0;this[_0x2467('0x5c')]=0x0;this['outboundDropCallsDayCallersExit']=0x0;this['outboundDropCallsDayTimeout']=0x0;this['outboundDropCallsDayACS']=0x0;this[_0x2467('0x5d')]=0x0;this['outboundAbandonedDay']=0x0;this[_0x2467('0x5e')]=undefined;this[_0x2467('0x5f')]=undefined;this[_0x2467('0x60')]=undefined;this[_0x2467('0x61')]=1.05;this[_0x2467('0x62')]=0x0;this[_0x2467('0x63')]=0x0;this[_0x2467('0x64')]=0x0;this[_0x2467('0x65')]=0x0;this['predictiveIntervalAvgHoldtime']=0x0;this[_0x2467('0x66')]=0x0;this['predictiveIntervalPauses']=0x0;this[_0x2467('0x67')]=0x0;this[_0x2467('0x68')]=_0x19e085['dialPredictiveIntervalMaxThreshold']||0x14;this[_0x2467('0x69')]=_0x19e085[_0x2467('0x6a')]||0xa;this['predictiveIntervalErlangCalls']=0x0;this[_0x2467('0x6b')]=0x0;this['predictiveIntervalHitRate']=0x1;this[_0x2467('0x6c')]=0x0;this['erlangCallToSecond']=0x0;this['erlangAbandonmentRate']=0x0;this[_0x2467('0x6d')]=0x0;this[_0x2467('0x6e')]=_0x19e085[_0x2467('0x6e')]||0x1e;this[_0x2467('0x6f')]=_0x19e085[_0x2467('0x6f')]||![];this[_0x2467('0x70')]=!!_0x19e085[_0x2467('0x70')]||![];this[_0x2467('0x71')]=!!_0x19e085[_0x2467('0x71')]||![];this[_0x2467('0x72')]=_0x19e085[_0x2467('0x72')]||undefined;this[_0x2467('0x73')]=_0x19e085['dialAgiAfterHangupClient']||![];this['dialAgiAfterHangupAgent']=_0x19e085[_0x2467('0x74')]||![];this[_0x2467('0x9')]=monitorFormat[_0x19e085[_0x2467('0x9')]]?monitorFormat[_0x19e085[_0x2467('0x9')]]:undefined;this[_0x2467('0x75')]=_0x19e085[_0x2467('0x75')]||![];this[_0x2467('0x76')]=_0x19e085[_0x2467('0x76')]?_0x19e085['mandatoryDispositionPause']:undefined;this[_0x2467('0x77')]=![];}module[_0x2467('0x78')]=VoiceQueue; \ No newline at end of file +var _0xb9e0=['fewestcalls','leastrecent','linear','random','ringall','roundrobin','rrmemory','rrordered','wrandom','name','monitor_format','type','inbound','waiting','total','answered','sumBillable','unmanaged','abandoned','available','busy','inUse','invalid','loggedIn','onHold','ringing','ringInUse','talking','unavailable','acw','acwTimeout','autopause','sendMessageOneNotActive','message','statusMessage','originated','temp','dialGlobalInterval','dialActive','dialMethod','dialLimitChannel','dialLimitQueue','dialPowerLevel','dialPredictiveOptimization','dropRate','dialPredictiveOptimizationPercentage','dialPredictiveInterval','dialOriginateCallerIdName','anonymous','dialOriginateCallerIdNumber','dialOriginateTimeout','dialQueueOptions','tTxX','dialQueueTimeout','dialQueueProject','dialCongestionMaxRetry','dialCongestionRetryFrequency','dialBusyMaxRetry','dialBusyRetryFrequency','dialNoAnswerMaxRetry','dialNoAnswerRetryFrequency','dialNoSuchNumberMaxRetry','dialDropMaxRetry','dialDropRetryFrequency','dialAbandonedMaxRetry','dialAbandonedRetryFrequency','dialMachineMaxRetry','dialMachineRetryFrequency','dialAgentRejectMaxRetry','dialAgentRejectRetryFrequency','callAdditionalPhoneAfterMin','dialGlobalMaxRetry','Trunk','TrunkBackup','dialPrefix','Interval','dialOrderByScheduledAt','DESC','dialRandomLastDigitCallerIdNumber','dialCutDigit','strategy','queueStatusComplete','dialAMDActive','dialAMDInitialSilence','dialAMDGreeting','dialAMDAfterGreetingSilence','dialAMDTotalAnalysisTime','dialAMDMinWordLength','dialAMDBetweenWordsSilence','dialAMDMaximumNumberOfWords','dialAMDSilenceThreshold','dialAMDMaximumWordLength','outboundRejectCallsDay','pTalking','timeout','outboundAnswerCallsDay','outboundAnswerAgiCallsDay','outboundBusyCallsDay','outboundNoSuchCallsDay','outboundUnknownCallsDay','outboundOriginateFailureCallsDay','outboundDropCallsDayCallersExit','outboundDropCallsDayACS','outboundReCallsDay','startProgressive','startPredictive','handlePredictive','predictiveIntervalMultiplicativeFactor','predictiveIntervalTotalCalls','predictiveIntervalAnsweredCalls','predictiveIntervalDroppedCallsTimeout','predictiveIntervalAvgHoldtime','predictiveIntervalAvgTalktime','predictiveIntervalPauses','predictiveIntervalAvailable','predictiveIntervalMaxThreshold','dialPredictiveIntervalMaxThreshold','predictiveIntervalErlangCalls','predictiveIntervalErlangCallsDroppedCalls','predictiveIntervalHitRate','erlangCalls','dialRecallMeTimeout','dialRecallInQueue','dialPreviewAutoRecallMe','dialPreviewRecallmeReminder','dialQueueProject2','dialAgiAfterHangupClient','dialAgiAfterHangupAgent','mandatoryDispositionPause','queueSummaryCountersUpdated','wav','wav49','gsm'];(function(_0x321bb2,_0x202794){var _0x9c12ed=function(_0x263dd3){while(--_0x263dd3){_0x321bb2['push'](_0x321bb2['shift']());}};_0x9c12ed(++_0x202794);}(_0xb9e0,0x18c));var _0x0b9e=function(_0x553f95,_0x1bc68c){_0x553f95=_0x553f95-0x0;var _0x4e795c=_0xb9e0[_0x553f95];return _0x4e795c;};'use strict';var monitorFormat={'wav':_0x0b9e('0x0'),'wav49':_0x0b9e('0x1'),'gsm':_0x0b9e('0x2')};var strategy={'fewestcalls':_0x0b9e('0x3'),'leastrecent':_0x0b9e('0x4'),'linear':_0x0b9e('0x5'),'random':_0x0b9e('0x6'),'ringall':_0x0b9e('0x7'),'rr':_0x0b9e('0x8'),'rrmemory':_0x0b9e('0x9'),'rrordered':_0x0b9e('0xa'),'wrandom':_0x0b9e('0xb')};function VoiceQueue(_0x101c1c){this['id']=_0x101c1c['id']||0x0;this[_0x0b9e('0xc')]=_0x101c1c[_0x0b9e('0xc')]||'';this[_0x0b9e('0xd')]=_0x101c1c['monitor_format']||'';this[_0x0b9e('0xe')]=_0x101c1c[_0x0b9e('0xe')]||_0x0b9e('0xf');this[_0x0b9e('0x10')]=0x0;this[_0x0b9e('0x11')]=0x0;this[_0x0b9e('0x12')]=0x0;this['sumDuration']=0x0;this['sumHoldTime']=0x0;this[_0x0b9e('0x13')]=0x0;this[_0x0b9e('0x14')]=0x0;this[_0x0b9e('0x15')]=0x0;this[_0x0b9e('0x16')]=0x0;this[_0x0b9e('0x17')]=0x0;this[_0x0b9e('0x18')]=0x0;this[_0x0b9e('0x19')]=0x0;this[_0x0b9e('0x1a')]=0x0;this['notInUse']=0x0;this[_0x0b9e('0x1b')]=0x0;this['paused']=0x0;this[_0x0b9e('0x1c')]=0x0;this[_0x0b9e('0x1d')]=0x0;this[_0x0b9e('0x1e')]=0x0;this[_0x0b9e('0x1f')]=0x0;this['unknown']=0x0;this[_0x0b9e('0x20')]=_0x101c1c[_0x0b9e('0x20')]||![];this[_0x0b9e('0x21')]=_0x101c1c[_0x0b9e('0x21')]||0xa;this[_0x0b9e('0x22')]=_0x101c1c[_0x0b9e('0x22')]||'no';this[_0x0b9e('0x23')]=!![];this[_0x0b9e('0x24')]='';this[_0x0b9e('0x25')]='';this[_0x0b9e('0x26')]=0x0;this[_0x0b9e('0x27')]=0x0;this['dialTimezone']=_0x101c1c['dialTimezone']||null;this[_0x0b9e('0x28')]=_0x101c1c[_0x0b9e('0x28')]?_0x101c1c[_0x0b9e('0x28')]:null;this[_0x0b9e('0x29')]=_0x101c1c[_0x0b9e('0x29')];this[_0x0b9e('0x2a')]=_0x101c1c[_0x0b9e('0x2a')]||'progressive';this[_0x0b9e('0x2b')]=_0x101c1c[_0x0b9e('0x2b')]||0x0;this[_0x0b9e('0x2c')]=_0x101c1c[_0x0b9e('0x2c')]||0x0;this['dialPowerLevel']=_0x101c1c[_0x0b9e('0x2d')]||0x1;this['dialPredictiveOptimization']=_0x101c1c[_0x0b9e('0x2e')]||_0x0b9e('0x2f');this['dialPredictiveOptimizationPercentage']=_0x101c1c[_0x0b9e('0x30')]||0.03;this['dialPredictiveInterval']=_0x101c1c[_0x0b9e('0x31')]||0x258;this[_0x0b9e('0x32')]=_0x101c1c['dialOriginateCallerIdName']||_0x0b9e('0x33');this[_0x0b9e('0x34')]=_0x101c1c[_0x0b9e('0x34')]||_0x0b9e('0x33');this[_0x0b9e('0x35')]=_0x101c1c[_0x0b9e('0x35')]||0x1e;this[_0x0b9e('0x36')]=_0x101c1c[_0x0b9e('0x36')]||_0x0b9e('0x37');this[_0x0b9e('0x38')]=_0x101c1c[_0x0b9e('0x38')]||0x3;this[_0x0b9e('0x39')]=_0x101c1c[_0x0b9e('0x39')]||undefined;this[_0x0b9e('0x3a')]=_0x101c1c[_0x0b9e('0x3a')]||0x3;this[_0x0b9e('0x3b')]=_0x101c1c['dialCongestionRetryFrequency']||0x96;this[_0x0b9e('0x3c')]=_0x101c1c[_0x0b9e('0x3c')]||0x3;this[_0x0b9e('0x3d')]=_0x101c1c[_0x0b9e('0x3d')]||0x96;this[_0x0b9e('0x3e')]=_0x101c1c[_0x0b9e('0x3e')]||0x3;this['dialNoAnswerRetryFrequency']=_0x101c1c[_0x0b9e('0x3f')]||0x96;this[_0x0b9e('0x40')]=_0x101c1c[_0x0b9e('0x40')]||0x3;this['dialNoSuchNumberRetryFrequency']=_0x101c1c['dialNoSuchNumberRetryFrequency']||0x96;this[_0x0b9e('0x41')]=_0x101c1c['dialDropMaxRetry']||0x3;this[_0x0b9e('0x42')]=_0x101c1c[_0x0b9e('0x42')]||0x96;this[_0x0b9e('0x43')]=_0x101c1c['dialAbandonedMaxRetry']||0x3;this['dialAbandonedRetryFrequency']=_0x101c1c[_0x0b9e('0x44')]||0x96;this[_0x0b9e('0x45')]=_0x101c1c[_0x0b9e('0x45')]||0x3;this[_0x0b9e('0x46')]=_0x101c1c['dialMachineRetryFrequency']||0x96;this[_0x0b9e('0x47')]=_0x101c1c[_0x0b9e('0x47')]||0x3;this[_0x0b9e('0x48')]=_0x101c1c['dialAgentRejectRetryFrequency']||0x96;this[_0x0b9e('0x49')]=_0x101c1c[_0x0b9e('0x49')]||0x3;this[_0x0b9e('0x4a')]=_0x101c1c[_0x0b9e('0x4a')]||0x4;this[_0x0b9e('0x4b')]=_0x101c1c[_0x0b9e('0x4b')]?_0x101c1c[_0x0b9e('0x4b')]:undefined;this['TrunkBackup']=_0x101c1c[_0x0b9e('0x4c')]?_0x101c1c[_0x0b9e('0x4c')]:undefined;this[_0x0b9e('0x4d')]=_0x101c1c[_0x0b9e('0x4d')]||undefined;this[_0x0b9e('0x4e')]=_0x101c1c[_0x0b9e('0x4e')]?_0x101c1c[_0x0b9e('0x4e')]:undefined;this[_0x0b9e('0x4f')]=_0x101c1c[_0x0b9e('0x4f')]||_0x0b9e('0x50');this[_0x0b9e('0x51')]=_0x101c1c['dialRandomLastDigitCallerIdNumber']||undefined;this[_0x0b9e('0x52')]=_0x101c1c[_0x0b9e('0x52')]||undefined;this['strategy']=strategy[_0x101c1c[_0x0b9e('0x53')]];this[_0x0b9e('0x54')]=!![];this['dialAMDActive']=_0x101c1c[_0x0b9e('0x55')]||![];this[_0x0b9e('0x56')]=_0x101c1c[_0x0b9e('0x56')];this[_0x0b9e('0x57')]=_0x101c1c[_0x0b9e('0x57')];this[_0x0b9e('0x58')]=_0x101c1c[_0x0b9e('0x58')];this[_0x0b9e('0x59')]=_0x101c1c[_0x0b9e('0x59')];this[_0x0b9e('0x5a')]=_0x101c1c[_0x0b9e('0x5a')];this['dialAMDBetweenWordsSilence']=_0x101c1c[_0x0b9e('0x5b')];this[_0x0b9e('0x5c')]=_0x101c1c[_0x0b9e('0x5c')];this['dialAMDSilenceThreshold']=_0x101c1c[_0x0b9e('0x5d')];this[_0x0b9e('0x5e')]=_0x101c1c[_0x0b9e('0x5e')];this[_0x0b9e('0x5f')]=0x0;this[_0x0b9e('0x60')]=0x0;this[_0x0b9e('0x61')]=_0x101c1c['timeout'];this[_0x0b9e('0x62')]=0x0;this[_0x0b9e('0x63')]=0x0;this['outboundNoAnswerCallsDay']=0x0;this[_0x0b9e('0x64')]=0x0;this['outboundCongestionCallsDay']=0x0;this[_0x0b9e('0x65')]=0x0;this[_0x0b9e('0x66')]=0x0;this['outboundBlacklistCallsDay']=0x0;this[_0x0b9e('0x67')]=0x0;this[_0x0b9e('0x68')]=0x0;this['outboundDropCallsDayTimeout']=0x0;this[_0x0b9e('0x69')]=0x0;this[_0x0b9e('0x6a')]=0x0;this['outboundAbandonedDay']=0x0;this[_0x0b9e('0x6b')]=undefined;this[_0x0b9e('0x6c')]=undefined;this[_0x0b9e('0x6d')]=undefined;this[_0x0b9e('0x6e')]=1.05;this[_0x0b9e('0x6f')]=0x0;this[_0x0b9e('0x70')]=0x0;this['predictiveIntervalDroppedCallsCallersExit']=0x0;this[_0x0b9e('0x71')]=0x0;this[_0x0b9e('0x72')]=0x0;this[_0x0b9e('0x73')]=0x0;this[_0x0b9e('0x74')]=0x0;this[_0x0b9e('0x75')]=0x0;this[_0x0b9e('0x76')]=_0x101c1c[_0x0b9e('0x77')]||0x14;this['predictiveIntervalMinThreshold']=_0x101c1c[_0x0b9e('0x77')]||0xa;this[_0x0b9e('0x78')]=0x0;this[_0x0b9e('0x79')]=0x0;this[_0x0b9e('0x7a')]=0x1;this[_0x0b9e('0x7b')]=0x0;this['erlangCallToSecond']=0x0;this['erlangAbandonmentRate']=0x0;this['erlangBusyFactor']=0x0;this[_0x0b9e('0x7c')]=_0x101c1c['dialRecallMeTimeout']||0x1e;this['dialRecallInQueue']=_0x101c1c[_0x0b9e('0x7d')]||![];this[_0x0b9e('0x7e')]=!!_0x101c1c['dialPreviewAutoRecallMe']||![];this[_0x0b9e('0x7f')]=!!_0x101c1c['dialPreviewRecallmeReminder']||![];this[_0x0b9e('0x80')]=_0x101c1c[_0x0b9e('0x80')]||undefined;this[_0x0b9e('0x81')]=_0x101c1c[_0x0b9e('0x81')]||![];this['dialAgiAfterHangupAgent']=_0x101c1c[_0x0b9e('0x82')]||![];this[_0x0b9e('0xd')]=monitorFormat[_0x101c1c[_0x0b9e('0xd')]]?monitorFormat[_0x101c1c[_0x0b9e('0xd')]]:undefined;this['mandatoryDisposition']=_0x101c1c['mandatoryDisposition']||![];this[_0x0b9e('0x83')]=_0x101c1c[_0x0b9e('0x83')]?_0x101c1c[_0x0b9e('0x83')]:undefined;this[_0x0b9e('0x84')]=![];}module['exports']=VoiceQueue; \ No newline at end of file diff --git a/server/services/ami/model/voiceQueueSummary.js b/server/services/ami/model/voiceQueueSummary.js index 64a7474..3e8e6d6 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 _0x4300=['outboundRejectCallsDay','outboundUnknownCallsDay','paused','sumBillable','sumDuration','total','name','abandoned','busy','invalid','notInUse','ringing','ringInUse','sumHoldTime','type','unavailable','unknown','unmanaged','outbound','pTalking','dialActive','dialMethod','dialOriginateCallerIdNumber','dialOriginateTimeout','dialPrefix','temp','outboundAnswerAgiCallsDay','outboundAnswerCallsDay','outboundDropCallsDayCallersExit','outboundDropCallsDayTimeout','predictiveIntervalAnsweredCalls','predictiveIntervalAvgHoldtime','predictiveIntervalAvgTalktime','predictiveIntervalDroppedCallsCallersExit','predictiveIntervalDroppedCallsTimeout','predictiveIntervalErlangCalls','predictiveIntervalErlangCallsDroppedCalls','predictiveIntervalHitRate','predictiveIntervalMultiplicativeFactor','predictiveIntervalPauses','predictiveIntervalAvailable','predictiveIntervalTotalCalls','originated','erlangCalls','erlangCallToSecond','erlangAbandonmentRate','erlangBusyFactor','startPredictive','startProgressive','message','statusMessage','Trunk','active','prototype','createReport','onHold','loggedin','callers','online','incall','includes','status','booked','keys','queue','dialer','exten','xcally-motion-preview','compareToInboundQueue','some','compareToOutboundQueue','updateReportFromOutboundQueue','preview','exports','available','talking','waiting','answered','inUse','loggedInDb','outboundAbandonedCallsDay','outboundBlacklistCallsDay','outboundBusyCallsDay','outboundCongestionCallsDay','outboundNoAnswerCallsDay','outboundNoSuchCallsDay','outboundReCallsDay'];(function(_0x34ef19,_0x38f3dc){var _0x38116b=function(_0x2d1d39){while(--_0x2d1d39){_0x34ef19['push'](_0x34ef19['shift']());}};_0x38116b(++_0x38f3dc);}(_0x4300,0x1a6));var _0x0430=function(_0xded540,_0x3dd05f){_0xded540=_0xded540-0x0;var _0x15b9c2=_0x4300[_0xded540];return _0x15b9c2;};'use strict';var INBOUND_COUNTERS=[_0x0430('0x0'),'loggedIn','loggedInDb','paused','ringing',_0x0430('0x1'),_0x0430('0x2')];var OUTBOUND_COUNTERS=[_0x0430('0x0'),_0x0430('0x3'),_0x0430('0x4'),'loggedIn',_0x0430('0x5'),'originated',_0x0430('0x6'),'outboundAnswerCallsDay',_0x0430('0x7'),_0x0430('0x8'),_0x0430('0x9'),_0x0430('0xa'),_0x0430('0xb'),_0x0430('0xc'),_0x0430('0xd'),_0x0430('0xe'),_0x0430('0xf'),'pTalking',_0x0430('0x1'),_0x0430('0x10'),_0x0430('0x11'),_0x0430('0x12'),_0x0430('0x2')];function VoiceQueueSummary(_0x3ae2a9){this['id']=_0x3ae2a9['id'];this[_0x0430('0x13')]=_0x3ae2a9[_0x0430('0x13')];this['strategy']=_0x3ae2a9['strategy'];this[_0x0430('0x14')]=_0x3ae2a9[_0x0430('0x14')]||0x0;this[_0x0430('0x3')]=_0x3ae2a9[_0x0430('0x3')]||0x0;this[_0x0430('0x0')]=_0x3ae2a9[_0x0430('0x0')]||0x0;this[_0x0430('0x15')]=_0x3ae2a9['busy']||0x0;this[_0x0430('0x4')]=_0x3ae2a9[_0x0430('0x4')]||0x0;this[_0x0430('0x16')]=_0x3ae2a9[_0x0430('0x16')]||0x0;this['loggedIn']=_0x3ae2a9['loggedIn']||0x0;this['loggedInDb']=_0x3ae2a9[_0x0430('0x5')]||0x0;this['onHold']=_0x3ae2a9['onHold']||0x0;this[_0x0430('0x17')]=_0x3ae2a9[_0x0430('0x17')]||0x0;this[_0x0430('0xf')]=_0x3ae2a9[_0x0430('0xf')]||0x0;this[_0x0430('0x18')]=_0x3ae2a9['ringing']||0x0;this['ringInUse']=_0x3ae2a9[_0x0430('0x19')];this[_0x0430('0x10')]=_0x3ae2a9[_0x0430('0x10')];this[_0x0430('0x11')]=_0x3ae2a9['sumDuration'];this['sumHoldTime']=_0x3ae2a9[_0x0430('0x1a')]||0x0;this[_0x0430('0x1')]=_0x3ae2a9[_0x0430('0x1')]||0x0;this[_0x0430('0x12')]=_0x3ae2a9[_0x0430('0x12')]||0x0;this[_0x0430('0x1b')]=_0x3ae2a9['type'];this[_0x0430('0x1c')]=_0x3ae2a9[_0x0430('0x1c')]||0x0;this[_0x0430('0x1d')]=_0x3ae2a9[_0x0430('0x1d')]||0x0;this['unmanaged']=_0x3ae2a9[_0x0430('0x1e')]||0x0;this[_0x0430('0x2')]=_0x3ae2a9[_0x0430('0x2')]||0x0;if(_0x3ae2a9[_0x0430('0x1b')]===_0x0430('0x1f')){this[_0x0430('0x20')]=_0x3ae2a9[_0x0430('0x20')]||0x0;this[_0x0430('0x21')]=_0x3ae2a9[_0x0430('0x21')];this['dialMethod']=_0x3ae2a9[_0x0430('0x22')];this['dialOriginateCallerIdName']=_0x3ae2a9['dialOriginateCallerIdName'];this[_0x0430('0x23')]=_0x3ae2a9[_0x0430('0x23')];this['dialOriginateTimeout']=_0x3ae2a9[_0x0430('0x24')];this[_0x0430('0x25')]=_0x3ae2a9[_0x0430('0x25')];this[_0x0430('0x26')]=_0x3ae2a9[_0x0430('0x26')];this[_0x0430('0x27')]=_0x3ae2a9[_0x0430('0x27')];this[_0x0430('0x28')]=_0x3ae2a9[_0x0430('0x28')];this['outboundBlacklistCallsDay']=_0x3ae2a9['outboundBlacklistCallsDay'];this['outboundBusyCallsDay']=_0x3ae2a9[_0x0430('0x8')];this['outboundCongestionCallsDay']=_0x3ae2a9[_0x0430('0x9')];this['outboundDropCallsDayACS']=_0x3ae2a9['outboundDropCallsDayACS'];this[_0x0430('0x29')]=_0x3ae2a9[_0x0430('0x29')];this[_0x0430('0x2a')]=_0x3ae2a9[_0x0430('0x2a')];this['outboundNoAnswerCallsDay']=_0x3ae2a9['outboundNoAnswerCallsDay'];this[_0x0430('0xb')]=_0x3ae2a9[_0x0430('0xb')];this['outboundOriginateFailureCallsDay']=_0x3ae2a9['outboundOriginateFailureCallsDay'];this[_0x0430('0xc')]=_0x3ae2a9[_0x0430('0xc')];this[_0x0430('0xd')]=_0x3ae2a9[_0x0430('0xd')];this[_0x0430('0xe')]=_0x3ae2a9[_0x0430('0xe')];this[_0x0430('0x2b')]=_0x3ae2a9[_0x0430('0x2b')];this[_0x0430('0x2c')]=_0x3ae2a9['predictiveIntervalAvgHoldtime'];this[_0x0430('0x2d')]=_0x3ae2a9[_0x0430('0x2d')];this[_0x0430('0x2e')]=_0x3ae2a9['predictiveIntervalDroppedCallsCallersExit'];this[_0x0430('0x2f')]=_0x3ae2a9['predictiveIntervalDroppedCallsTimeout'];this[_0x0430('0x30')]=_0x3ae2a9['predictiveIntervalErlangCalls'];this['predictiveIntervalErlangCallsDroppedCalls']=_0x3ae2a9[_0x0430('0x31')];this[_0x0430('0x32')]=_0x3ae2a9[_0x0430('0x32')];this[_0x0430('0x33')]=_0x3ae2a9[_0x0430('0x33')];this[_0x0430('0x34')]=_0x3ae2a9['predictiveIntervalPauses'];this[_0x0430('0x35')]=_0x3ae2a9[_0x0430('0x35')];this[_0x0430('0x36')]=_0x3ae2a9[_0x0430('0x36')];this[_0x0430('0x37')]=_0x3ae2a9[_0x0430('0x37')];this[_0x0430('0x38')]=_0x3ae2a9[_0x0430('0x38')];this[_0x0430('0x39')]=_0x3ae2a9[_0x0430('0x39')];this['erlangAbandonmentRate']=_0x3ae2a9[_0x0430('0x3a')];this[_0x0430('0x3b')]=_0x3ae2a9[_0x0430('0x3b')];this[_0x0430('0x3c')]=_0x3ae2a9[_0x0430('0x3c')];this[_0x0430('0x3d')]=_0x3ae2a9['startProgressive'];this[_0x0430('0x3e')]=_0x3ae2a9[_0x0430('0x3e')];this['statusMessage']=_0x3ae2a9[_0x0430('0x3f')];}if(_0x3ae2a9[_0x0430('0x40')]){this[_0x0430('0x40')]={'id':_0x3ae2a9[_0x0430('0x40')]['id'],'name':_0x3ae2a9[_0x0430('0x40')][_0x0430('0x13')],'active':_0x3ae2a9[_0x0430('0x40')][_0x0430('0x41')],'callerid':_0x3ae2a9[_0x0430('0x40')]['callerid']};}}VoiceQueueSummary[_0x0430('0x42')][_0x0430('0x43')]=function(_0x456f36,_0x3f5218,_0x4adc1c,_0x29e273){this[_0x0430('0x5')]=0x0;this[_0x0430('0x1')]=0x0;this[_0x0430('0xf')]=0x0;this[_0x0430('0x1d')]=0x0;this[_0x0430('0x17')]=0x0;this[_0x0430('0x4')]=0x0;this[_0x0430('0x15')]=0x0;this[_0x0430('0x16')]=0x0;this[_0x0430('0x1c')]=0x0;this[_0x0430('0x18')]=0x0;this['ringInUse']=0x0;this[_0x0430('0x44')]=0x0;if(_0x4adc1c){if(_0x4adc1c['available']){this['available']=Number(_0x4adc1c[_0x0430('0x0')]);}if(_0x4adc1c['loggedin']){this['loggedIn']=Number(_0x4adc1c[_0x0430('0x45')]);}if(_0x4adc1c['callers']){this['waiting']=Number(_0x4adc1c[_0x0430('0x46')]);}}for(var _0x57454d=0x0;_0x57454d<_0x456f36['length'];_0x57454d++){var _0x456cd0=_0x3f5218['SIP/'+_0x456f36[_0x57454d]['name']];if(_0x456cd0&&_0x456cd0[_0x0430('0x47')]){this[_0x0430('0x5')]+=0x1;}if(_0x456f36[_0x57454d][_0x0430('0x48')]==='1'){this['talking']+=0x1;}if(_0x456f36[_0x57454d][_0x0430('0xf')]==='1'&&!['2','7','8'][_0x0430('0x49')](_0x456f36[_0x57454d][_0x0430('0x4a')])){this['paused']+=0x1;}switch(_0x456f36[_0x57454d]['status']){case'0':this[_0x0430('0x1d')]+=0x1;break;case'1':this[_0x0430('0x17')]+=0x1;break;case'2':this[_0x0430('0x4')]+=0x1;break;case'3':this[_0x0430('0x15')]+=0x1;break;case'4':this['invalid']+=0x1;break;case'5':this['unavailable']+=0x1;break;case'6':this['ringing']+=0x1;break;case'7':this[_0x0430('0x19')]+=0x1;break;case'8':this[_0x0430('0x44')]+=0x1;break;}}if(this[_0x0430('0x22')]===_0x0430('0x4b')){var _0xe86f29=Object[_0x0430('0x4c')](_0x29e273);for(var _0x5c3184=0x0;_0x5c3184<_0xe86f29['length'];_0x5c3184++){var _0x29ed30=_0xe86f29[_0x5c3184];var _0xfc248=_0x29e273[_0x29ed30];if(_0xfc248[_0x0430('0x4d')]===this[_0x0430('0x13')]&&_0xfc248[_0x0430('0x1b')]===_0x0430('0x4e')&&_0xfc248[_0x0430('0x4f')]===_0x0430('0x50')){this[_0x0430('0x1')]+=0x1;}}if(this[_0x0430('0x1')]>this[_0x0430('0x4')]){this[_0x0430('0x1')]=this['inUse'];}this['pTalking']=0x0;}return this;};VoiceQueueSummary[_0x0430('0x42')][_0x0430('0x51')]=function(_0x25dbb4){var _0x1c769a=![];if(_0x25dbb4){_0x1c769a=INBOUND_COUNTERS[_0x0430('0x52')](function(_0x261996){return this[_0x261996]!==_0x25dbb4[_0x261996];},this);}return _0x1c769a;};VoiceQueueSummary[_0x0430('0x42')][_0x0430('0x53')]=function(_0x261c6f){var _0xe42193=![];var _0x40b02a=![];var _0x1a7698=![];if(_0x261c6f){_0xe42193=this[_0x0430('0x22')]!==_0x261c6f[_0x0430('0x22')]||this[_0x0430('0x21')]!==_0x261c6f[_0x0430('0x21')]||this[_0x0430('0x3e')]!==_0x261c6f[_0x0430('0x3e')]||this['statusMessage']!==_0x261c6f[_0x0430('0x3f')];_0x40b02a=OUTBOUND_COUNTERS[_0x0430('0x52')](function(_0x2f0149){return this[_0x2f0149]!==_0x261c6f[_0x2f0149];},this);if(this[_0x0430('0x40')]&&_0x261c6f[_0x0430('0x40')]){_0x1a7698=this[_0x0430('0x40')][_0x0430('0x13')]!==_0x261c6f[_0x0430('0x40')][_0x0430('0x13')]||this['Trunk'][_0x0430('0x41')]!==_0x261c6f[_0x0430('0x40')][_0x0430('0x41')];}}return _0xe42193||_0x40b02a||_0x1a7698;};VoiceQueueSummary['prototype'][_0x0430('0x54')]=function(_0x5457b3){this[_0x0430('0x3')]=_0x5457b3[_0x0430('0x3')];this[_0x0430('0x3e')]=_0x5457b3[_0x0430('0x3e')];this[_0x0430('0x3f')]=_0x5457b3[_0x0430('0x3f')];this['originated']=_0x5457b3[_0x0430('0x37')];this[_0x0430('0x6')]=_0x5457b3[_0x0430('0x6')];this[_0x0430('0x28')]=_0x5457b3[_0x0430('0x28')];this[_0x0430('0x7')]=_0x5457b3[_0x0430('0x7')];this[_0x0430('0x8')]=_0x5457b3[_0x0430('0x8')];this[_0x0430('0x9')]=_0x5457b3[_0x0430('0x9')];this[_0x0430('0xa')]=_0x5457b3['outboundNoAnswerCallsDay'];this[_0x0430('0xb')]=_0x5457b3[_0x0430('0xb')];this[_0x0430('0xc')]=_0x5457b3[_0x0430('0xc')];this[_0x0430('0xd')]=_0x5457b3[_0x0430('0xd')];this[_0x0430('0xe')]=_0x5457b3[_0x0430('0xe')];this[_0x0430('0x10')]=_0x5457b3['sumBillable'];this[_0x0430('0x11')]=_0x5457b3[_0x0430('0x11')];this[_0x0430('0x12')]=_0x5457b3[_0x0430('0x12')];if(this[_0x0430('0x22')]===_0x0430('0x55')){this[_0x0430('0x20')]=_0x5457b3[_0x0430('0x20')];}};module[_0x0430('0x56')]=VoiceQueueSummary; \ No newline at end of file +var _0xac21=['available','inUse','originated','outboundAbandonedCallsDay','outboundAnswerCallsDay','outboundBlacklistCallsDay','outboundBusyCallsDay','outboundCongestionCallsDay','outboundNoSuchCallsDay','outboundReCallsDay','outboundRejectCallsDay','outboundUnknownCallsDay','paused','pTalking','sumBillable','sumDuration','total','name','strategy','abandoned','answered','busy','invalid','onHold','notInUse','ringInUse','sumHoldTime','talking','type','unavailable','unknown','unmanaged','outbound','dialActive','dialMethod','dialOriginateCallerIdName','dialOriginateCallerIdNumber','dialOriginateTimeout','dialPrefix','temp','outboundAnswerAgiCallsDay','outboundDropCallsDayACS','outboundDropCallsDayCallersExit','outboundOriginateFailureCallsDay','predictiveIntervalAnsweredCalls','predictiveIntervalAvgHoldtime','predictiveIntervalAvgTalktime','predictiveIntervalDroppedCallsCallersExit','predictiveIntervalDroppedCallsTimeout','predictiveIntervalErlangCalls','predictiveIntervalErlangCallsDroppedCalls','predictiveIntervalHitRate','predictiveIntervalMultiplicativeFactor','predictiveIntervalPauses','predictiveIntervalAvailable','predictiveIntervalTotalCalls','erlangCalls','erlangCallToSecond','erlangAbandonmentRate','erlangBusyFactor','startPredictive','startProgressive','message','statusMessage','Trunk','prototype','createReport','loggedin','callers','length','SIP/','online','includes','status','booked','keys','queue','some','compareToOutboundQueue','active','outboundNoAnswerCallsDay','preview','exports','loggedIn','loggedInDb','ringing','waiting'];(function(_0x53ccf2,_0x13cb67){var _0x5a2964=function(_0x3b0514){while(--_0x3b0514){_0x53ccf2['push'](_0x53ccf2['shift']());}};_0x5a2964(++_0x13cb67);}(_0xac21,0x1af));var _0x1ac2=function(_0xacecc0,_0x21b3a3){_0xacecc0=_0xacecc0-0x0;var _0x3831d4=_0xac21[_0xacecc0];return _0x3831d4;};'use strict';var INBOUND_COUNTERS=['available',_0x1ac2('0x0'),_0x1ac2('0x1'),'paused',_0x1ac2('0x2'),'talking',_0x1ac2('0x3')];var OUTBOUND_COUNTERS=[_0x1ac2('0x4'),'answered',_0x1ac2('0x5'),'loggedIn',_0x1ac2('0x1'),_0x1ac2('0x6'),_0x1ac2('0x7'),_0x1ac2('0x8'),_0x1ac2('0x9'),_0x1ac2('0xa'),_0x1ac2('0xb'),'outboundNoAnswerCallsDay',_0x1ac2('0xc'),_0x1ac2('0xd'),_0x1ac2('0xe'),_0x1ac2('0xf'),_0x1ac2('0x10'),_0x1ac2('0x11'),'talking',_0x1ac2('0x12'),_0x1ac2('0x13'),_0x1ac2('0x14'),_0x1ac2('0x3')];function VoiceQueueSummary(_0x405ca6){this['id']=_0x405ca6['id'];this[_0x1ac2('0x15')]=_0x405ca6['name'];this[_0x1ac2('0x16')]=_0x405ca6[_0x1ac2('0x16')];this[_0x1ac2('0x17')]=_0x405ca6[_0x1ac2('0x17')]||0x0;this[_0x1ac2('0x18')]=_0x405ca6[_0x1ac2('0x18')]||0x0;this[_0x1ac2('0x4')]=_0x405ca6[_0x1ac2('0x4')]||0x0;this[_0x1ac2('0x19')]=_0x405ca6['busy']||0x0;this[_0x1ac2('0x5')]=_0x405ca6[_0x1ac2('0x5')]||0x0;this[_0x1ac2('0x1a')]=_0x405ca6[_0x1ac2('0x1a')]||0x0;this[_0x1ac2('0x0')]=_0x405ca6[_0x1ac2('0x0')]||0x0;this[_0x1ac2('0x1')]=_0x405ca6[_0x1ac2('0x1')]||0x0;this['onHold']=_0x405ca6[_0x1ac2('0x1b')]||0x0;this[_0x1ac2('0x1c')]=_0x405ca6['notInUse']||0x0;this[_0x1ac2('0x10')]=_0x405ca6[_0x1ac2('0x10')]||0x0;this['ringing']=_0x405ca6[_0x1ac2('0x2')]||0x0;this['ringInUse']=_0x405ca6[_0x1ac2('0x1d')];this[_0x1ac2('0x12')]=_0x405ca6['sumBillable'];this[_0x1ac2('0x13')]=_0x405ca6[_0x1ac2('0x13')];this[_0x1ac2('0x1e')]=_0x405ca6[_0x1ac2('0x1e')]||0x0;this[_0x1ac2('0x1f')]=_0x405ca6[_0x1ac2('0x1f')]||0x0;this[_0x1ac2('0x14')]=_0x405ca6[_0x1ac2('0x14')]||0x0;this[_0x1ac2('0x20')]=_0x405ca6[_0x1ac2('0x20')];this[_0x1ac2('0x21')]=_0x405ca6['unavailable']||0x0;this[_0x1ac2('0x22')]=_0x405ca6[_0x1ac2('0x22')]||0x0;this[_0x1ac2('0x23')]=_0x405ca6[_0x1ac2('0x23')]||0x0;this[_0x1ac2('0x3')]=_0x405ca6[_0x1ac2('0x3')]||0x0;if(_0x405ca6['type']===_0x1ac2('0x24')){this[_0x1ac2('0x11')]=_0x405ca6[_0x1ac2('0x11')]||0x0;this[_0x1ac2('0x25')]=_0x405ca6[_0x1ac2('0x25')];this['dialMethod']=_0x405ca6[_0x1ac2('0x26')];this[_0x1ac2('0x27')]=_0x405ca6[_0x1ac2('0x27')];this[_0x1ac2('0x28')]=_0x405ca6[_0x1ac2('0x28')];this['dialOriginateTimeout']=_0x405ca6[_0x1ac2('0x29')];this[_0x1ac2('0x2a')]=_0x405ca6['dialPrefix'];this[_0x1ac2('0x2b')]=_0x405ca6['temp'];this[_0x1ac2('0x2c')]=_0x405ca6[_0x1ac2('0x2c')];this[_0x1ac2('0x8')]=_0x405ca6['outboundAnswerCallsDay'];this[_0x1ac2('0x9')]=_0x405ca6['outboundBlacklistCallsDay'];this['outboundBusyCallsDay']=_0x405ca6[_0x1ac2('0xa')];this[_0x1ac2('0xb')]=_0x405ca6[_0x1ac2('0xb')];this[_0x1ac2('0x2d')]=_0x405ca6[_0x1ac2('0x2d')];this[_0x1ac2('0x2e')]=_0x405ca6[_0x1ac2('0x2e')];this['outboundDropCallsDayTimeout']=_0x405ca6['outboundDropCallsDayTimeout'];this['outboundNoAnswerCallsDay']=_0x405ca6['outboundNoAnswerCallsDay'];this[_0x1ac2('0xc')]=_0x405ca6[_0x1ac2('0xc')];this[_0x1ac2('0x2f')]=_0x405ca6['outboundOriginateFailureCallsDay'];this[_0x1ac2('0xd')]=_0x405ca6[_0x1ac2('0xd')];this['outboundRejectCallsDay']=_0x405ca6[_0x1ac2('0xe')];this[_0x1ac2('0xf')]=_0x405ca6['outboundUnknownCallsDay'];this[_0x1ac2('0x30')]=_0x405ca6[_0x1ac2('0x30')];this[_0x1ac2('0x31')]=_0x405ca6[_0x1ac2('0x31')];this[_0x1ac2('0x32')]=_0x405ca6['predictiveIntervalAvgTalktime'];this[_0x1ac2('0x33')]=_0x405ca6[_0x1ac2('0x33')];this['predictiveIntervalDroppedCallsTimeout']=_0x405ca6[_0x1ac2('0x34')];this[_0x1ac2('0x35')]=_0x405ca6[_0x1ac2('0x35')];this['predictiveIntervalErlangCallsDroppedCalls']=_0x405ca6[_0x1ac2('0x36')];this[_0x1ac2('0x37')]=_0x405ca6[_0x1ac2('0x37')];this[_0x1ac2('0x38')]=_0x405ca6[_0x1ac2('0x38')];this[_0x1ac2('0x39')]=_0x405ca6[_0x1ac2('0x39')];this[_0x1ac2('0x3a')]=_0x405ca6['predictiveIntervalAvailable'];this[_0x1ac2('0x3b')]=_0x405ca6[_0x1ac2('0x3b')];this['originated']=_0x405ca6[_0x1ac2('0x6')];this[_0x1ac2('0x3c')]=_0x405ca6[_0x1ac2('0x3c')];this[_0x1ac2('0x3d')]=_0x405ca6[_0x1ac2('0x3d')];this[_0x1ac2('0x3e')]=_0x405ca6[_0x1ac2('0x3e')];this[_0x1ac2('0x3f')]=_0x405ca6[_0x1ac2('0x3f')];this[_0x1ac2('0x40')]=_0x405ca6[_0x1ac2('0x40')];this[_0x1ac2('0x41')]=_0x405ca6['startProgressive'];this['message']=_0x405ca6[_0x1ac2('0x42')];this[_0x1ac2('0x43')]=_0x405ca6[_0x1ac2('0x43')];}if(_0x405ca6['Trunk']){this['Trunk']={'id':_0x405ca6[_0x1ac2('0x44')]['id'],'name':_0x405ca6[_0x1ac2('0x44')]['name'],'active':_0x405ca6['Trunk']['active'],'callerid':_0x405ca6[_0x1ac2('0x44')]['callerid']};}}VoiceQueueSummary[_0x1ac2('0x45')][_0x1ac2('0x46')]=function(_0x3c2538,_0x374419,_0x82b44,_0x36b42f){this['loggedInDb']=0x0;this[_0x1ac2('0x1f')]=0x0;this['paused']=0x0;this[_0x1ac2('0x22')]=0x0;this[_0x1ac2('0x1c')]=0x0;this[_0x1ac2('0x5')]=0x0;this['busy']=0x0;this['invalid']=0x0;this[_0x1ac2('0x21')]=0x0;this['ringing']=0x0;this[_0x1ac2('0x1d')]=0x0;this[_0x1ac2('0x1b')]=0x0;if(_0x82b44){if(_0x82b44['available']){this[_0x1ac2('0x4')]=Number(_0x82b44['available']);}if(_0x82b44[_0x1ac2('0x47')]){this['loggedIn']=Number(_0x82b44['loggedin']);}if(_0x82b44[_0x1ac2('0x48')]){this['waiting']=Number(_0x82b44[_0x1ac2('0x48')]);}}for(var _0x4df450=0x0;_0x4df450<_0x3c2538[_0x1ac2('0x49')];_0x4df450++){var _0x297a0c=_0x374419[_0x1ac2('0x4a')+_0x3c2538[_0x4df450][_0x1ac2('0x15')]];if(_0x297a0c&&_0x297a0c[_0x1ac2('0x4b')]){this[_0x1ac2('0x1')]+=0x1;}if(_0x3c2538[_0x4df450]['incall']==='1'){this[_0x1ac2('0x1f')]+=0x1;}if(_0x3c2538[_0x4df450][_0x1ac2('0x10')]==='1'&&!['2','7','8'][_0x1ac2('0x4c')](_0x3c2538[_0x4df450]['status'])){this[_0x1ac2('0x10')]+=0x1;}switch(_0x3c2538[_0x4df450][_0x1ac2('0x4d')]){case'0':this[_0x1ac2('0x22')]+=0x1;break;case'1':this['notInUse']+=0x1;break;case'2':this[_0x1ac2('0x5')]+=0x1;break;case'3':this[_0x1ac2('0x19')]+=0x1;break;case'4':this['invalid']+=0x1;break;case'5':this['unavailable']+=0x1;break;case'6':this[_0x1ac2('0x2')]+=0x1;break;case'7':this[_0x1ac2('0x1d')]+=0x1;break;case'8':this[_0x1ac2('0x1b')]+=0x1;break;}}if(this['dialMethod']===_0x1ac2('0x4e')){var _0x318d98=Object[_0x1ac2('0x4f')](_0x36b42f);for(var _0x39129d=0x0;_0x39129d<_0x318d98[_0x1ac2('0x49')];_0x39129d++){var _0x3e06e2=_0x318d98[_0x39129d];var _0x29527e=_0x36b42f[_0x3e06e2];if(_0x29527e[_0x1ac2('0x50')]===this[_0x1ac2('0x15')]&&_0x29527e[_0x1ac2('0x20')]==='dialer'&&_0x29527e['exten']==='xcally-motion-preview'){this[_0x1ac2('0x1f')]+=0x1;}}if(this[_0x1ac2('0x1f')]>this[_0x1ac2('0x5')]){this[_0x1ac2('0x1f')]=this[_0x1ac2('0x5')];}this['pTalking']=0x0;}return this;};VoiceQueueSummary['prototype']['compareToInboundQueue']=function(_0x2acf50){var _0x1879ae=![];if(_0x2acf50){_0x1879ae=INBOUND_COUNTERS[_0x1ac2('0x51')](function(_0x1f153c){return this[_0x1f153c]!==_0x2acf50[_0x1f153c];},this);}return _0x1879ae;};VoiceQueueSummary['prototype'][_0x1ac2('0x52')]=function(_0x14d04a){var _0x56d721=![];var _0x411ab3=![];var _0x404be5=![];if(_0x14d04a){_0x56d721=this[_0x1ac2('0x26')]!==_0x14d04a[_0x1ac2('0x26')]||this['dialActive']!==_0x14d04a[_0x1ac2('0x25')]||this['message']!==_0x14d04a[_0x1ac2('0x42')]||this[_0x1ac2('0x43')]!==_0x14d04a['statusMessage'];_0x411ab3=OUTBOUND_COUNTERS[_0x1ac2('0x51')](function(_0x230e0e){return this[_0x230e0e]!==_0x14d04a[_0x230e0e];},this);if(this[_0x1ac2('0x44')]&&_0x14d04a[_0x1ac2('0x44')]){_0x404be5=this[_0x1ac2('0x44')][_0x1ac2('0x15')]!==_0x14d04a[_0x1ac2('0x44')][_0x1ac2('0x15')]||this[_0x1ac2('0x44')][_0x1ac2('0x53')]!==_0x14d04a['Trunk']['active'];}}return _0x56d721||_0x411ab3||_0x404be5;};VoiceQueueSummary[_0x1ac2('0x45')]['updateReportFromOutboundQueue']=function(_0x5ab826){this[_0x1ac2('0x18')]=_0x5ab826[_0x1ac2('0x18')];this[_0x1ac2('0x42')]=_0x5ab826[_0x1ac2('0x42')];this[_0x1ac2('0x43')]=_0x5ab826['statusMessage'];this[_0x1ac2('0x6')]=_0x5ab826[_0x1ac2('0x6')];this[_0x1ac2('0x7')]=_0x5ab826[_0x1ac2('0x7')];this[_0x1ac2('0x8')]=_0x5ab826[_0x1ac2('0x8')];this['outboundBlacklistCallsDay']=_0x5ab826[_0x1ac2('0x9')];this['outboundBusyCallsDay']=_0x5ab826['outboundBusyCallsDay'];this[_0x1ac2('0xb')]=_0x5ab826['outboundCongestionCallsDay'];this[_0x1ac2('0x54')]=_0x5ab826[_0x1ac2('0x54')];this['outboundNoSuchCallsDay']=_0x5ab826['outboundNoSuchCallsDay'];this[_0x1ac2('0xd')]=_0x5ab826[_0x1ac2('0xd')];this[_0x1ac2('0xe')]=_0x5ab826[_0x1ac2('0xe')];this[_0x1ac2('0xf')]=_0x5ab826[_0x1ac2('0xf')];this[_0x1ac2('0x12')]=_0x5ab826[_0x1ac2('0x12')];this[_0x1ac2('0x13')]=_0x5ab826['sumDuration'];this['total']=_0x5ab826[_0x1ac2('0x14')];if(this[_0x1ac2('0x26')]===_0x1ac2('0x55')){this[_0x1ac2('0x11')]=_0x5ab826[_0x1ac2('0x11')];}};module[_0x1ac2('0x56')]=VoiceQueueSummary; \ No newline at end of file diff --git a/server/services/ami/model/vtigerAccount.js b/server/services/ami/model/vtigerAccount.js index 9b3dab2..d062bf7 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 _0xdf44=['serverUrl','Configurations','exports','name','username','accessKey','remoteUri'];(function(_0x509ff0,_0x55ac03){var _0x53325e=function(_0x145e4f){while(--_0x145e4f){_0x509ff0['push'](_0x509ff0['shift']());}};_0x53325e(++_0x55ac03);}(_0xdf44,0x114));var _0x4df4=function(_0xd1d19a,_0x1933f0){_0xd1d19a=_0xd1d19a-0x0;var _0x52a79d=_0xdf44[_0xd1d19a];return _0x52a79d;};'use strict';function VtigerAccount(_0x5e7a59){this['id']=_0x5e7a59['id']||0x0;this[_0x4df4('0x0')]=_0x5e7a59['name']||'';this[_0x4df4('0x1')]=_0x5e7a59[_0x4df4('0x1')]||'';this[_0x4df4('0x2')]=_0x5e7a59[_0x4df4('0x2')]||'';this[_0x4df4('0x3')]=_0x5e7a59[_0x4df4('0x3')]||'';this[_0x4df4('0x4')]=_0x5e7a59[_0x4df4('0x4')]||'';this[_0x4df4('0x5')]=_0x5e7a59[_0x4df4('0x5')]||{};}module[_0x4df4('0x6')]=VtigerAccount; \ No newline at end of file +var _0xb483=['accessKey','remoteUri','serverUrl','Configurations','exports','name'];(function(_0x490f0e,_0x21c987){var _0x15376a=function(_0x14e398){while(--_0x14e398){_0x490f0e['push'](_0x490f0e['shift']());}};_0x15376a(++_0x21c987);}(_0xb483,0x107));var _0x3b48=function(_0x427018,_0x159464){_0x427018=_0x427018-0x0;var _0x40e826=_0xb483[_0x427018];return _0x40e826;};'use strict';function VtigerAccount(_0x23b3d9){this['id']=_0x23b3d9['id']||0x0;this[_0x3b48('0x0')]=_0x23b3d9['name']||'';this['username']=_0x23b3d9['username']||'';this[_0x3b48('0x1')]=_0x23b3d9[_0x3b48('0x1')]||'';this[_0x3b48('0x2')]=_0x23b3d9[_0x3b48('0x2')]||'';this['serverUrl']=_0x23b3d9[_0x3b48('0x3')]||'';this[_0x3b48('0x4')]=_0x23b3d9['Configurations']||{};}module[_0x3b48('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 379966e..4abdef9 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 _0x3c84=['password','remoteUri','authType','type','integrationTab','serverUrl','Configurations','exports','name','username'];(function(_0x525372,_0xc9adb6){var _0x4bee0e=function(_0x4f52ac){while(--_0x4f52ac){_0x525372['push'](_0x525372['shift']());}};_0x4bee0e(++_0xc9adb6);}(_0x3c84,0x15c));var _0x43c8=function(_0x20ba68,_0x48f312){_0x20ba68=_0x20ba68-0x0;var _0x3cddf2=_0x3c84[_0x20ba68];return _0x3cddf2;};'use strict';function ZendeskAccount(_0x12dedb){this['id']=_0x12dedb['id']||0x0;this[_0x43c8('0x0')]=_0x12dedb[_0x43c8('0x0')]||'';this[_0x43c8('0x1')]=_0x12dedb[_0x43c8('0x1')]||'';this['password']=_0x12dedb[_0x43c8('0x2')]||'';this['token']=_0x12dedb['token']||'';this[_0x43c8('0x3')]=_0x12dedb[_0x43c8('0x3')]||'';this[_0x43c8('0x4')]=_0x12dedb[_0x43c8('0x4')]||'';this[_0x43c8('0x5')]=_0x12dedb[_0x43c8('0x5')]||_0x43c8('0x6');this[_0x43c8('0x7')]=_0x12dedb[_0x43c8('0x7')]||'';this[_0x43c8('0x8')]=_0x12dedb['Configurations']||{};}module[_0x43c8('0x9')]=ZendeskAccount; \ No newline at end of file +var _0x14b7=['username','password','token','remoteUri','authType','type','integrationTab','Configurations','exports','name'];(function(_0x2eff9b,_0x549f39){var _0x135814=function(_0x3d6d98){while(--_0x3d6d98){_0x2eff9b['push'](_0x2eff9b['shift']());}};_0x135814(++_0x549f39);}(_0x14b7,0x121));var _0x714b=function(_0x4945e8,_0x597c5e){_0x4945e8=_0x4945e8-0x0;var _0x4300ca=_0x14b7[_0x4945e8];return _0x4300ca;};'use strict';function ZendeskAccount(_0xea1ae3){this['id']=_0xea1ae3['id']||0x0;this[_0x714b('0x0')]=_0xea1ae3[_0x714b('0x0')]||'';this[_0x714b('0x1')]=_0xea1ae3[_0x714b('0x1')]||'';this[_0x714b('0x2')]=_0xea1ae3[_0x714b('0x2')]||'';this['token']=_0xea1ae3[_0x714b('0x3')]||'';this['remoteUri']=_0xea1ae3[_0x714b('0x4')]||'';this[_0x714b('0x5')]=_0xea1ae3[_0x714b('0x5')]||'';this[_0x714b('0x6')]=_0xea1ae3[_0x714b('0x6')]||_0x714b('0x7');this['serverUrl']=_0xea1ae3['serverUrl']||'';this[_0x714b('0x8')]=_0xea1ae3['Configurations']||{};}module[_0x714b('0x9')]=ZendeskAccount; \ No newline at end of file diff --git a/server/services/ami/model/zohoAccount.js b/server/services/ami/model/zohoAccount.js index 65a8ba2..493acc2 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 _0x8c2d=['exports','name','description','host','zone','clientId','clientSecret','serverUrl','code','Configurations'];(function(_0x60f55d,_0x3ff7cb){var _0x17e002=function(_0x464d18){while(--_0x464d18){_0x60f55d['push'](_0x60f55d['shift']());}};_0x17e002(++_0x3ff7cb);}(_0x8c2d,0x14b));var _0xd8c2=function(_0x376b45,_0x5964fb){_0x376b45=_0x376b45-0x0;var _0x2341b3=_0x8c2d[_0x376b45];return _0x2341b3;};'use strict';function ZohoAccount(_0xa31a73){this['id']=_0xa31a73['id']||0x0;this[_0xd8c2('0x0')]=_0xa31a73[_0xd8c2('0x0')]||'';this[_0xd8c2('0x1')]=_0xa31a73['description']||'';this['host']=_0xa31a73[_0xd8c2('0x2')]||'';this[_0xd8c2('0x3')]=_0xa31a73[_0xd8c2('0x3')]||'';this[_0xd8c2('0x4')]=_0xa31a73[_0xd8c2('0x4')]||'';this[_0xd8c2('0x5')]=_0xa31a73[_0xd8c2('0x5')]||'';this['serverUrl']=_0xa31a73[_0xd8c2('0x6')]||'';this[_0xd8c2('0x7')]=_0xa31a73[_0xd8c2('0x7')]||'';this['refreshToken']=_0xa31a73['refreshToken']||'';this[_0xd8c2('0x8')]=_0xa31a73[_0xd8c2('0x8')]||{};}module[_0xd8c2('0x9')]=ZohoAccount; \ No newline at end of file +var _0xbeaf=['host','zone','clientId','clientSecret','serverUrl','code','refreshToken','exports','name','description'];(function(_0x156470,_0x43f1d1){var _0x2199cc=function(_0x46b700){while(--_0x46b700){_0x156470['push'](_0x156470['shift']());}};_0x2199cc(++_0x43f1d1);}(_0xbeaf,0x10c));var _0xfbea=function(_0x465028,_0x4570ac){_0x465028=_0x465028-0x0;var _0xb783d4=_0xbeaf[_0x465028];return _0xb783d4;};'use strict';function ZohoAccount(_0x1b69db){this['id']=_0x1b69db['id']||0x0;this['name']=_0x1b69db[_0xfbea('0x0')]||'';this[_0xfbea('0x1')]=_0x1b69db[_0xfbea('0x1')]||'';this['host']=_0x1b69db[_0xfbea('0x2')]||'';this[_0xfbea('0x3')]=_0x1b69db[_0xfbea('0x3')]||'';this[_0xfbea('0x4')]=_0x1b69db[_0xfbea('0x4')]||'';this['clientSecret']=_0x1b69db[_0xfbea('0x5')]||'';this[_0xfbea('0x6')]=_0x1b69db[_0xfbea('0x6')]||'';this[_0xfbea('0x7')]=_0x1b69db[_0xfbea('0x7')]||'';this[_0xfbea('0x8')]=_0x1b69db[_0xfbea('0x8')]||'';this['Configurations']=_0x1b69db['Configurations']||{};}module[_0xfbea('0x9')]=ZohoAccount; \ No newline at end of file diff --git a/server/services/ami/preview/action.js b/server/services/ami/preview/action.js index eb44a7b..b27b76c 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 _0x1893=['type','queue','dialAnswer','membername','Agent','channelAgent','format','calleridname','Contact','phone','firstName','lastName','active','calleridnum','scheduledat','countbusyretry','countcongestionretry','countnoanswerretry','countglobal','countnosuchnumberretry','countdropretry','countabandonedretry','countagentrejectretry','countmachineretry','callback','callbackuniqueid','callbackat','recallme','ContactId','ListId','UserId','VoiceQueueId','getCaller','\x22%s\x22\x20<%s>','number','exports','moment','isNil','string','uniqueid','idContact','name'];(function(_0x52f611,_0x49a6a0){var _0x4d9bc4=function(_0x5957c6){while(--_0x5957c6){_0x52f611['push'](_0x52f611['shift']());}};_0x4d9bc4(++_0x49a6a0);}(_0x1893,0xa2));var _0x3189=function(_0x41e3e5,_0x441240){_0x41e3e5=_0x41e3e5-0x0;var _0x4b5b5c=_0x1893[_0x41e3e5];return _0x4b5b5c;};'use strict';var util=require('util');var _=require('lodash');var moment=require(_0x3189('0x0'));function checkNameSurname(_0x3aec2b,_0x1b12ad,_0x106df4){var _0x10c189='';if(!_[_0x3189('0x1')](_0x1b12ad)&&_0x3189('0x2')===typeof _0x1b12ad){_0x10c189+=_0x1b12ad;}if(!_['isNil'](_0x106df4)&&_0x3189('0x2')===typeof _0x106df4){_0x10c189+='\x20'+_0x106df4;}if(_0x10c189!==''){return _0x10c189;}return _0x3aec2b;}function Action(_0x4faebf,_0x2333e6,_0x4080a9,_0x77c566,_0x118970){this[_0x3189('0x3')]=_0x4080a9||undefined;this[_0x3189('0x4')]=_0x4faebf['id'];this['queue']=_0x2333e6[_0x3189('0x5')];this['type']=_0x2333e6[_0x3189('0x6')];this['campaigntype']=_0x3189('0x7');this[_0x3189('0x8')]=![];this[_0x3189('0x9')]=_[_0x3189('0x1')](_0x4faebf['Agent'])?undefined:_0x4faebf[_0x3189('0xa')][_0x3189('0x5')];this[_0x3189('0xb')]=this[_0x3189('0x9')]?util[_0x3189('0xc')]('SIP/%s',this[_0x3189('0x9')]):_0x77c566||undefined;this[_0x3189('0xd')]=checkNameSurname(_0x4faebf[_0x3189('0xe')][_0x3189('0xf')],_0x4faebf[_0x3189('0xe')][_0x3189('0x10')],_0x4faebf[_0x3189('0xe')][_0x3189('0x11')]);this['active']=_0x4faebf[_0x3189('0x12')]||![];this[_0x3189('0x13')]=_0x4faebf[_0x3189('0xf')];this[_0x3189('0x14')]=_0x4faebf['scheduledat'];this[_0x3189('0x15')]=_0x4faebf['countbusyretry']||0x0;this['countcongestionretry']=_0x4faebf[_0x3189('0x16')]||0x0;this['countnoanswerretry']=_0x4faebf[_0x3189('0x17')]||0x0;this[_0x3189('0x18')]=(_0x4faebf[_0x3189('0x15')]||0x0)+(_0x4faebf[_0x3189('0x16')]||0x0)+(_0x4faebf['countnoanswerretry']||0x0)+(_0x4faebf[_0x3189('0x19')]||0x0)+(_0x4faebf[_0x3189('0x1a')]||0x0)+(_0x4faebf[_0x3189('0x1b')]||0x0)+(_0x4faebf['countmachineretry']||0x0)+(_0x4faebf[_0x3189('0x1c')]||0x0);this[_0x3189('0x19')]=_0x4faebf[_0x3189('0x19')]||0x0;this[_0x3189('0x1a')]=_0x4faebf[_0x3189('0x1a')]||0x0;this['countabandonedretry']=_0x4faebf[_0x3189('0x1b')]||0x0;this[_0x3189('0x1d')]=_0x4faebf[_0x3189('0x1d')]||0x0;this['countagentrejectretry']=_0x4faebf[_0x3189('0x1c')]||0x0;this['callback']=_0x4faebf[_0x3189('0x1e')];this[_0x3189('0x1f')]=_0x4faebf[_0x3189('0x1f')];this[_0x3189('0x20')]=_0x4faebf[_0x3189('0x20')];this[_0x3189('0x21')]=_0x4faebf['recallme'];this['ContactId']=_0x4faebf[_0x3189('0x22')];this[_0x3189('0x23')]=_0x4faebf[_0x3189('0x23')];this[_0x3189('0x24')]=_[_0x3189('0x1')](_0x4faebf[_0x3189('0xa')])?_0x4faebf[_0x3189('0x24')]:_0x4faebf[_0x3189('0xa')]['id'];this[_0x3189('0x25')]=_0x4faebf[_0x3189('0x25')];this['originatecalleridnum']='';this['originatecalleridname']='';}Action['prototype'][_0x3189('0x26')]=function(){return util[_0x3189('0xc')](_0x3189('0x27'),this[_0x3189('0xd')],this[_0x3189('0x28')]);};module[_0x3189('0x29')]=Action; \ No newline at end of file +var _0x236c=['recallme','ContactId','ListId','UserId','originatecalleridnum','prototype','calleridname','number','util','moment','string','isNil','uniqueid','type','campaigntype','queue','dialAnswer','membername','Agent','name','format','phone','Contact','firstName','active','scheduledat','countbusyretry','countnoanswerretry','countglobal','countabandonedretry','countmachineretry','countagentrejectretry','countnosuchnumberretry','countdropretry','callback','callbackuniqueid','callbackat'];(function(_0xbce370,_0x1ef649){var _0x5d00d5=function(_0x17c6aa){while(--_0x17c6aa){_0xbce370['push'](_0xbce370['shift']());}};_0x5d00d5(++_0x1ef649);}(_0x236c,0x155));var _0xc236=function(_0x5a6235,_0x24852a){_0x5a6235=_0x5a6235-0x0;var _0x24d0a9=_0x236c[_0x5a6235];return _0x24d0a9;};'use strict';var util=require(_0xc236('0x0'));var _=require('lodash');var moment=require(_0xc236('0x1'));function checkNameSurname(_0x404d50,_0x39c024,_0x8072){var _0x2bf2d3='';if(!_['isNil'](_0x39c024)&&_0xc236('0x2')===typeof _0x39c024){_0x2bf2d3+=_0x39c024;}if(!_[_0xc236('0x3')](_0x8072)&&_0xc236('0x2')===typeof _0x8072){_0x2bf2d3+='\x20'+_0x8072;}if(_0x2bf2d3!==''){return _0x2bf2d3;}return _0x404d50;}function Action(_0xd582f6,_0x23d3cc,_0x461c3a,_0x5abd65,_0xd612c6){this[_0xc236('0x4')]=_0x461c3a||undefined;this['idContact']=_0xd582f6['id'];this['queue']=_0x23d3cc['name'];this[_0xc236('0x5')]=_0x23d3cc['type'];this[_0xc236('0x6')]=_0xc236('0x7');this[_0xc236('0x8')]=![];this[_0xc236('0x9')]=_[_0xc236('0x3')](_0xd582f6['Agent'])?undefined:_0xd582f6[_0xc236('0xa')][_0xc236('0xb')];this['channelAgent']=this[_0xc236('0x9')]?util[_0xc236('0xc')]('SIP/%s',this[_0xc236('0x9')]):_0x5abd65||undefined;this['calleridname']=checkNameSurname(_0xd582f6['Contact'][_0xc236('0xd')],_0xd582f6[_0xc236('0xe')][_0xc236('0xf')],_0xd582f6[_0xc236('0xe')]['lastName']);this[_0xc236('0x10')]=_0xd582f6['active']||![];this['calleridnum']=_0xd582f6[_0xc236('0xd')];this[_0xc236('0x11')]=_0xd582f6[_0xc236('0x11')];this[_0xc236('0x12')]=_0xd582f6[_0xc236('0x12')]||0x0;this['countcongestionretry']=_0xd582f6['countcongestionretry']||0x0;this['countnoanswerretry']=_0xd582f6[_0xc236('0x13')]||0x0;this[_0xc236('0x14')]=(_0xd582f6[_0xc236('0x12')]||0x0)+(_0xd582f6['countcongestionretry']||0x0)+(_0xd582f6[_0xc236('0x13')]||0x0)+(_0xd582f6['countnosuchnumberretry']||0x0)+(_0xd582f6['countdropretry']||0x0)+(_0xd582f6[_0xc236('0x15')]||0x0)+(_0xd582f6[_0xc236('0x16')]||0x0)+(_0xd582f6[_0xc236('0x17')]||0x0);this[_0xc236('0x18')]=_0xd582f6[_0xc236('0x18')]||0x0;this[_0xc236('0x19')]=_0xd582f6[_0xc236('0x19')]||0x0;this[_0xc236('0x15')]=_0xd582f6[_0xc236('0x15')]||0x0;this[_0xc236('0x16')]=_0xd582f6[_0xc236('0x16')]||0x0;this['countagentrejectretry']=_0xd582f6[_0xc236('0x17')]||0x0;this[_0xc236('0x1a')]=_0xd582f6[_0xc236('0x1a')];this[_0xc236('0x1b')]=_0xd582f6[_0xc236('0x1b')];this[_0xc236('0x1c')]=_0xd582f6[_0xc236('0x1c')];this[_0xc236('0x1d')]=_0xd582f6[_0xc236('0x1d')];this[_0xc236('0x1e')]=_0xd582f6[_0xc236('0x1e')];this['ListId']=_0xd582f6[_0xc236('0x1f')];this[_0xc236('0x20')]=_[_0xc236('0x3')](_0xd582f6[_0xc236('0xa')])?_0xd582f6['UserId']:_0xd582f6[_0xc236('0xa')]['id'];this['VoiceQueueId']=_0xd582f6['VoiceQueueId'];this[_0xc236('0x21')]='';this['originatecalleridname']='';}Action[_0xc236('0x22')]['getCaller']=function(){return util[_0xc236('0xc')]('\x22%s\x22\x20<%s>',this[_0xc236('0x23')],this[_0xc236('0x24')]);};module['exports']=Action; \ No newline at end of file diff --git a/server/services/ami/preview/index.js b/server/services/ami/preview/index.js index 3cb9818..2e76fb8 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 _0x7363=['[callProgressDetectingCustomer][logNoAnswerGlobal]','dialNoAnswerMaxRetry','CONGESTION','outboundCongestionCallsDay','countcongestionretry','dialCongestionRetryFrequency','custom:agentcongestion','congestion','[callProgressDetectingCustomer][logCongestion]','dialCongestionMaxRetry','CANCEL','countagentrejectretry','custom:agentreject','agentreject','[syncHangupRequest][logAgentReject]','AgentReject','[callProgressDetectingCustomer][logAgentReject]','dialAgentRejectMaxRetry','dialAgentRejectRetryFrequency','ABANDONED','outboundAbandonedCallsDay','countabandonedretry','Abandoned','[callProgressDetectingCustomer][logAbandoned]','dialAbandonedMaxRety','dialAbandonedRetryFrequency','outboundUnknownCallsDay','countmachineretry','dialstatus','custom:amd','amd','[callProgressDetectingCustomer][hangupInAMD]','cause-txt','[callProgressDetectingCustomer][machine]','[default]','[Dialer][decrementTalking][no\x20Hangup][Preview]','[callProgressDetectingCustomer][logUnknownGlobal]','[originated][decrement][callProgressDetectingCustomer]','originated:\x20','destlinkedid','queueSummaryCountersUpdated','callProgressDetectingAgent','isUndefined','object','logAgent','createAgentHistory','AnswerAGI','[callProgressDetectingAgent][logAnswerAGI]','reason','[callProgressDetectingAgent][logCongestion]','[originated][decrement][callProgressDetectingAgent]','[verifyAdditionalPhone]\x20','[swapAdditionalPhone]\x20','resolve','Contact','phone','VoiceQueueId','Contact\x20is\x20undefined','agents','execCall','[Preview][execCall][success]','\x20IdHopper:\x20','custom:agentcalled','called','[Preview][execCall][failure]','Call\x20failed','outboundBlacklistCallsDay','[Blacklist][error]','active','SIP/%s','reachable','unlock','disableContact','execRun','recallme','validateContact','isValid','[Preview][checkIsBlackList]','Call\x20unsuccessful','[Preview][getContactPreview]','isEmpty','[Preview][validateContact][Empty\x20Contact]','[Preview][validateContact][Empty\x20Campaign]','Empty\x20Campaign','[Preview][validateContact][Trunk\x20not\x20working\x20correctly]','campaign\x20Name:\x20','\x20Trunk\x20is\x20not\x20active','[Preview][validateContact][Campaign\x20Active]','\x20Not\x20Active','Is\x20Valid','SIP/%s/%s%s','dialPrefix','trim','dialCutDigit','substring','getCallerId','callerid','dialOriginateCallerIdName','dialRandomLastDigitCallerIdNumber','getCallerIdRandom','dialOriginateCallerIdNumber','extractCalleridName','originatecalleridnum','extractCalleridNumber','addVariables','setXMDContactVariables','assign','merge','variables','variablesAction','[originated][increment]','OriginateError','actionid','lookAgent','logLookAgent','clone','responsetime','isFailure','response','unlockContact','[callProgressDetectingAgent][logAnswer]','[syncHangup][talking]','cause','[syncHangup][talking][cause]','dialQueueProject','transfer','[syncHangup][talking][transfer]','syncHangupRequest','filterKey','variable','value','[syncVarSet][Preview]','inspect','transfertargetlinkedid','syncBlindTransfer','transfererlinkedid','exports','util','lodash','uuid','moment','../../../config/environment','preview','../../../config/logger','actionPreview','./action','./util/util','redis','defaults','socket.io-emitter','enqueue','tail','finally','sequence','trunks','actions','clockClearZombieChannels','syncOriginateResponse','bind','hangup','syncHangup','hanguprequest','syncDialEnd','newexten','syncNewExten','varset','syncVarSet','attendedtransfer','syncAttendedTransfer','blindtransfer','loopCampaigns','emit','[DEBUG]\x20Emit\x20voice_queue_channel:remove\x20event','stringify','format','voice:queue:%s','name','voice_queue_channel:remove','voice_queue_presence:remove','sendMessageOneNotActive','pTalking','available','paused','message','CAMPAIGN_STATUS','INACTIVE','\x20is\x20not\x20active','DEACTIVATED','logger','[CampaignPreview]\x20Campaign\x20Queue:\x20','syncCampaigns','prototype','campaignsPreview','hasOwnProperty','dialMethod','booked','outbound','clearZombieChannels','type','recallMe','clearZombieChannel','isNil','[clearZombieChannels][talking]','Queue','queue','originated','pTalking:\x20','pick','UserId','Action','status','channel','catch','No\x20such\x20channel','decrementOriginate','dialAnswer','decrementTalking','[clearZombieChannel]','loggerError','[Dialer][checkChannel][pTalking][Preview]','info','[action]','size','getContactRecallMe','agentReadyId','length','getDiff','scheduledat','Agent','voicePause','run','then','logger2','[RecallMe]','starttime','YYYY-MM-DD\x20HH:mm:ss','logCustomer','RecallInQueue','dialRecallInQueue','rescheduleContactInQueue','createBody','createCustomerHistory','[HistoryDialRecallInQueue][historyCatch]','RecallFailedTimeout','createCustomerFinal','[HistoryRecallClose]','[getContactRecallMe]','setMessage','IsNotLoggedIn','isActive','dialActive','isTrunkReachable','Trunk','TrunkBackup','UNREACHABLE_TRUNK','ACTIVE','callProgressDetectingCustomer','countnosuchnumberretry','totalGlobal','custom:agentnosuchnumber','buildObj','nosuchnumber','[callProgressDetectingCustomer][logNoSuch]','verifyAdditionalPhones','dialNoSuchNumberRetryFrequency','callAdditionalPhoneAfterMin','cloneAction','Global','[callProgressDetectingCustomer][logNoSuchGlobal]','dialNoSuchNumberMaxRetry','rescheduleContact','scheduledAt','unlockAgent','activeContact','actioncountonusuch','idContact','incrementPreviewCounters','swapAdditionalPhones','ANSWER','answertime','uniqueid','\x20Queue','acw','custom:agentConnectPreview','channelAgent','custom:agentcomplete','complete','outboundAnswerCallsDay','total','answered','[16]','countglobal','Answer','[callProgressDetectingCustomer][logAnswer]','[callProgressDetectingCustomer][logAnswerGlobal]','crateCustomerReportQueue','sumDuration','talktime','[syncHangup][talking][decrement]','linkedid','BUSY','outboundBusyCallsDay','countbusyretry','Busy','busy','[callProgressDetectingCustomer][logBusy]','dialGlobalMaxRetry','[callProgressDetectingCustomer][logBusyGlobal]','dialBusyMaxRetry','dialBusyRetryFrequency','NOANSWER','outboundNoAnswerCallsDay','countnoanswerretry','NoAnswer','dialNoAnswerRetryFrequency','buildNoAnswerEventPayload','custom:agentnoanswer','[callProgressDetectingCustomer][logNoAnswer]','additional'];(function(_0xef8146,_0x459c34){var _0x5a6cb0=function(_0x2f84ec){while(--_0x2f84ec){_0xef8146['push'](_0xef8146['shift']());}};_0x5a6cb0(++_0x459c34);}(_0x7363,0x89));var _0x3736=function(_0x1ff716,_0x2fa637){_0x1ff716=_0x1ff716-0x0;var _0x12bf0b=_0x7363[_0x1ff716];return _0x12bf0b;};'use strict';var util=require(_0x3736('0x0'));var _=require(_0x3736('0x1'));var uuid=require(_0x3736('0x2'));var moment=require(_0x3736('0x3'));var Redis=require('ioredis');var config=require(_0x3736('0x4'));var logger=require('../../../config/logger')(_0x3736('0x5'));var loggerAction=require(_0x3736('0x6'))(_0x3736('0x7'));var ami=require('../ami');var rpcDb=require('./rpcDb');var cmHopperAdditionalPhone=require('../rpc/cmHopperAdditionalPhone');var Action=require(_0x3736('0x8'));var ut=require(_0x3736('0x9'));var utils=require('../dialer/utils');config[_0x3736('0xa')]=_[_0x3736('0xb')](config[_0x3736('0xa')],{'host':'localhost','port':0x18eb});var io=require(_0x3736('0xc'))(new Redis(config[_0x3736('0xa')]));var Sequence=function(){};Sequence['prototype'][_0x3736('0xd')]=function(_0x423996){this['tail']=this[_0x3736('0xe')]?this[_0x3736('0xe')][_0x3736('0xf')](_0x423996):_0x423996();};function Preview(_0x22552f){this[_0x3736('0x10')]=new Sequence();this['campaignsPreview']=_0x22552f['voiceQueues'];this[_0x3736('0x11')]=_0x22552f['trunks'];this[_0x3736('0x12')]={};this['agents']=_0x22552f['agents'];this[_0x3736('0x13')]=0x0;ami['on']('originateresponse',this[_0x3736('0x14')][_0x3736('0x15')](this));ami['on'](_0x3736('0x16'),this[_0x3736('0x17')][_0x3736('0x15')](this));ami['on'](_0x3736('0x18'),this['syncHangupRequest'][_0x3736('0x15')](this));ami['on']('dialend',this[_0x3736('0x19')][_0x3736('0x15')](this));ami['on'](_0x3736('0x1a'),this[_0x3736('0x1b')][_0x3736('0x15')](this));ami['on'](_0x3736('0x1c'),this[_0x3736('0x1d')][_0x3736('0x15')](this));ami['on'](_0x3736('0x1e'),this[_0x3736('0x1f')][_0x3736('0x15')](this));ami['on'](_0x3736('0x20'),this['syncBlindTransfer'][_0x3736('0x15')](this));this[_0x3736('0x21')](this['campaignsPreview']);}function emit(_0x2c6c2f,_0x31510f,_0x6d978c){io['to'](_0x2c6c2f)[_0x3736('0x22')](_0x31510f,_0x6d978c);}function emitVoiceQueueChannelRemove(_0x39c9ce){logger['info'](_0x3736('0x23'),JSON[_0x3736('0x24')](_0x39c9ce));emit(util[_0x3736('0x25')](_0x3736('0x26'),_0x39c9ce[_0x3736('0x27')]),_0x3736('0x28'),_0x39c9ce);io[_0x3736('0x22')](_0x3736('0x29'),_0x39c9ce);}function notSendMessagesQueue(_0x4f2841){if(_0x4f2841[_0x3736('0x2a')]){if(_0x4f2841['originated']===0x0&&_0x4f2841[_0x3736('0x2b')]===0x0){_0x4f2841[_0x3736('0x2a')]=![];_0x4f2841[_0x3736('0x2c')]=0x0;_0x4f2841[_0x3736('0x2d')]=0x0;_0x4f2841[_0x3736('0x2e')]=utils[_0x3736('0x2f')][_0x3736('0x30')];ut['logger']('[CampaignPreview]\x20Campaign\x20Queue:\x20',_0x4f2841[_0x3736('0x27')]+_0x3736('0x31'));}else{_0x4f2841['message']=utils[_0x3736('0x2f')][_0x3736('0x32')];ut[_0x3736('0x33')](_0x3736('0x34'),_0x4f2841[_0x3736('0x27')]+'\x20is\x20deactivated');}}}Preview['prototype'][_0x3736('0x21')]=function(){var _0x26d84e=this;setInterval(function(){_0x26d84e[_0x3736('0x35')]();},0x7cf);};Preview[_0x3736('0x36')][_0x3736('0x35')]=function(){var _0x98edbe=this[_0x3736('0x37')];this[_0x3736('0x13')]+=0x1;for(var _0x3dbcaa in _0x98edbe){if(_0x98edbe[_0x3736('0x38')](_0x3dbcaa)&&(_0x98edbe[_0x3dbcaa][_0x3736('0x39')]===_0x3736('0x5')||_0x98edbe[_0x3dbcaa][_0x3736('0x39')]===_0x3736('0x3a'))&&_0x98edbe[_0x3dbcaa]['type']===_0x3736('0x3b')){if(this['clockClearZombieChannels']>0x7){this[_0x3736('0x13')]=0x0;this[_0x3736('0x3c')]();}}if(_0x98edbe[_0x3736('0x38')](_0x3dbcaa)&&_0x98edbe[_0x3dbcaa][_0x3736('0x39')]===_0x3736('0x5')&&_0x98edbe[_0x3dbcaa][_0x3736('0x3d')]===_0x3736('0x3b')){if(_0x98edbe[_0x3dbcaa]['dialActive']){this['setMessage'](_0x98edbe[_0x3dbcaa]);if(_0x98edbe[_0x3dbcaa]['dialPreviewAutoRecallMe'])this[_0x3736('0x3e')](_0x98edbe[_0x3dbcaa]);}else{notSendMessagesQueue(_0x98edbe[_0x3dbcaa]);}}}};Preview['prototype'][_0x3736('0x3f')]=function(_0x26cf49){var _0x2b9db9=this;this[_0x3736('0x10')]['enqueue'](function(){if(!_[_0x3736('0x40')](_0x2b9db9['actions'][_0x26cf49])){loggerAction['info'](_0x3736('0x41'),_0x26cf49,_0x3736('0x42'),_0x2b9db9[_0x3736('0x12')][_0x26cf49]['queue'],'originated:\x20',JSON[_0x3736('0x24')](_0x2b9db9[_0x3736('0x37')][_0x2b9db9['actions'][_0x26cf49][_0x3736('0x43')]][_0x3736('0x44')]),_0x3736('0x45'),JSON['stringify'](_0x2b9db9[_0x3736('0x37')][_0x2b9db9[_0x3736('0x12')][_0x26cf49][_0x3736('0x43')]][_0x3736('0x2b')]),JSON['stringify'](_0x2b9db9[_0x3736('0x12')][_0x26cf49]['dialAnswer']),JSON[_0x3736('0x24')](_[_0x3736('0x46')](_0x2b9db9[_0x3736('0x12')][_0x26cf49],['contactId',_0x3736('0x47'),'VoiceQueueId','ListId'])));return ami[_0x3736('0x48')]({'action':_0x3736('0x49'),'channel':_0x2b9db9['actions'][_0x26cf49][_0x3736('0x4a')]})[_0x3736('0x4b')](function(_0x23f013){if(_0x23f013[_0x3736('0x2e')]===_0x3736('0x4c')){setTimeout(function(){if(_0x2b9db9[_0x3736('0x12')][_0x26cf49]){utils[_0x3736('0x4d')](_0x2b9db9[_0x3736('0x37')][_0x2b9db9[_0x3736('0x12')][_0x26cf49][_0x3736('0x43')]],'[clearZombieChannel]');if(_0x2b9db9[_0x3736('0x12')][_0x26cf49][_0x3736('0x4e')]===!![]){ut[_0x3736('0x4f')](_0x2b9db9['campaignsPreview'][_0x2b9db9['actions'][_0x26cf49][_0x3736('0x43')]],_0x3736('0x50'));ut[_0x3736('0x51')](_0x3736('0x52')+_0x26cf49,_0x2b9db9[_0x3736('0x12')][_0x26cf49][_0x3736('0x43')]);}ut[_0x3736('0x51')]('[Dialer][checkChannel][Preview]'+_0x26cf49,_0x2b9db9[_0x3736('0x12')][_0x26cf49][_0x3736('0x43')]);delete _0x2b9db9[_0x3736('0x12')][_0x26cf49];}},0x2328);}});}});};Preview[_0x3736('0x36')][_0x3736('0x3c')]=function(){var _0x52abed=this;loggerAction[_0x3736('0x53')](_0x3736('0x54'),_[_0x3736('0x55')](this['actions']));for(var _0x402f0d in this[_0x3736('0x12')]){if(_0x52abed[_0x3736('0x12')][_0x3736('0x38')](_0x402f0d)){_0x52abed['clearZombieChannel'](_0x402f0d);}}};Preview['prototype'][_0x3736('0x3e')]=function(_0x4571c1){var _0x2db1f9=this;rpcDb[_0x3736('0x56')](_0x4571c1['id'],ut[_0x3736('0x57')](this['agents']))['then'](function(_0xb8a154){if(!_['isNil'](_0xb8a154)){for(var _0x1410af=0x0;_0x1410af<_0xb8a154[_0x3736('0x58')];_0x1410af+=0x1){if(ut[_0x3736('0x59')](_0xb8a154[_0x1410af][_0x3736('0x5a')])<_0x4571c1['dialRecallMeTimeout']*0x3c){if(_0xb8a154[_0x1410af][_0x3736('0x5b')]&&!_0xb8a154[_0x1410af][_0x3736('0x5b')][_0x3736('0x5c')]){_0x2db1f9[_0x3736('0x5d')](_0xb8a154[_0x1410af]['id'])[_0x3736('0x5e')](ut[_0x3736('0x5f')]('[RecallMe]'))[_0x3736('0x4b')](ut[_0x3736('0x5f')](_0x3736('0x60')));}else{rpcDb['disableContact'](_0xb8a154[_0x1410af]['id']);}}else{var _0x5d9e04=new Action(_0xb8a154[_0x1410af],_0x4571c1);_0x5d9e04[_0x3736('0x61')]=moment()[_0x3736('0x25')](_0x3736('0x62'));_0x4571c1['outboundReCallsDay']+=0x1;ut[_0x3736('0x63')](_0x5d9e04,0x17,_0x3736('0x64'));if(_0x4571c1[_0x3736('0x65')]){rpcDb[_0x3736('0x66')](ut[_0x3736('0x67')](_0xb8a154[_0x1410af]));rpcDb[_0x3736('0x68')](_0x5d9e04,_0x3736('0x69'));}else{ut[_0x3736('0x63')](_0x5d9e04,0x16,_0x3736('0x6a'));rpcDb[_0x3736('0x68')](_0x5d9e04,'[HistoryRecallClose]');rpcDb[_0x3736('0x6b')](_0x5d9e04,_0x3736('0x6c'));}}}}})[_0x3736('0x4b')](ut[_0x3736('0x5f')](_0x3736('0x6d')));};Preview[_0x3736('0x36')][_0x3736('0x6e')]=function(_0x558980){_0x558980[_0x3736('0x2a')]=!![];if(ut[_0x3736('0x6f')](_0x558980['loggedIn'])){_0x558980[_0x3736('0x2e')]=utils[_0x3736('0x2f')]['NO_AGENTS_LOGGED'];}else if(!ut[_0x3736('0x70')](_0x558980[_0x3736('0x71')])){_0x558980[_0x3736('0x2e')]=utils[_0x3736('0x2f')]['INACTIVE'];}else if(!this[_0x3736('0x72')](_0x558980[_0x3736('0x73')])){if(!this[_0x3736('0x72')](_0x558980[_0x3736('0x74')])){_0x558980[_0x3736('0x2e')]=utils[_0x3736('0x2f')][_0x3736('0x75')];}else{_0x558980['message']=utils[_0x3736('0x2f')][_0x3736('0x76')];}}else{_0x558980[_0x3736('0x2e')]=utils[_0x3736('0x2f')][_0x3736('0x76')];}};Preview[_0x3736('0x36')][_0x3736('0x77')]=function(_0x56767b,_0x3fe1b3,_0x583ed9){var _0x3a3e79=this;var _0x48be88=this[_0x3736('0x12')][_0x3fe1b3];var _0x33d0d0=this[_0x3736('0x37')][_0x48be88[_0x3736('0x43')]];var _0x29c262;var _0x5acfc8=![];var _0x49a855=0x2;var _0x3aac16=0x3;if(_0x33d0d0){switch(_0x583ed9){case'1':_0x33d0d0['outboundNoSuchCallsDay']+=0x1;_0x48be88[_0x3736('0x78')]+=0x1;_0x48be88['countglobal']=ut[_0x3736('0x79')](_0x48be88);ut[_0x3736('0x63')](_0x48be88,0x0,'NoSuchNumber');ami[_0x3736('0x22')](_0x3736('0x7a'),ut[_0x3736('0x7b')](_0x48be88,_0x3736('0x7c')));rpcDb['createCustomerHistory'](_0x48be88,_0x3736('0x7d'));_0x3a3e79[_0x3736('0x7e')](_0x48be88,'0',_0x33d0d0)[_0x3736('0x5e')](function(_0x4f0f6e){_0x5acfc8=_0x4f0f6e['additional']==0x1;_0x49a855=_0x33d0d0[_0x3736('0x7f')];_0x3aac16=_0x33d0d0[_0x3736('0x80')];if(!_0x5acfc8){if(ut[_0x3736('0x79')](_0x48be88)>=_0x33d0d0['dialGlobalMaxRetry']){_0x29c262=ut[_0x3736('0x81')](_0x48be88,0xf,_0x3736('0x82'));rpcDb[_0x3736('0x6b')](_0x29c262,_0x3736('0x83'));}else{if(_0x48be88[_0x3736('0x78')]>=_0x33d0d0[_0x3736('0x84')]){rpcDb[_0x3736('0x6b')](_0x48be88,_0x3736('0x83'));}else{rpcDb[_0x3736('0x85')](ut[_0x3736('0x86')](_0x48be88,_0x3736('0x78'),_0x33d0d0[_0x3736('0x7f')]),_0x48be88[_0x3736('0x87')],_0x48be88[_0x3736('0x88')]);}}delete this[_0x3736('0x12')][_0x56767b['linkedid']];}else{_0x48be88[_0x3736('0x78')]++;logger[_0x3736('0x53')](_0x3736('0x89'),_0x48be88[_0x3736('0x78')]);logger[_0x3736('0x53')]('id',_0x48be88[_0x3736('0x8a')]);_0x3a3e79[_0x3736('0x8b')]({'id':_0x48be88[_0x3736('0x8a')],'field':{'countnosuchnumberretry':_0x48be88['countnosuchnumberretry']}})[_0x3736('0x5e')](function(){_0x3a3e79[_0x3736('0x8c')](_0x48be88,_0x49a855,_0x3aac16)[_0x3736('0x5e')](function(){});});}});break;case _0x3736('0x8d'):var _0x57c87b=moment()[_0x3736('0x25')](_0x3736('0x62'));_0x48be88['responsetime']=_0x57c87b;_0x48be88[_0x3736('0x8e')]=_0x57c87b;_0x48be88[_0x3736('0x4e')]=!![];_0x33d0d0['pTalking']+=0x1;logger['info']('[syncHangup][talking][increment]',_0x48be88[_0x3736('0x8f')],_0x3736('0x90'),_0x33d0d0[_0x3736('0x27')],_0x3736('0x45'),_0x33d0d0[_0x3736('0x2b')]);ami['emit']('custom:agentconnect',ut[_0x3736('0x7b')](_0x48be88,'connect',this[_0x3736('0x37')][_0x48be88[_0x3736('0x43')]]));if(_0x33d0d0[_0x3736('0x91')]||_0x33d0d0['mandatoryDisposition']){ami[_0x3736('0x22')](_0x3736('0x92'),{'queue':_0x48be88[_0x3736('0x43')],'interface':_0x48be88[_0x3736('0x93')],'uniqueid':_0x48be88[_0x3736('0x8f')]});}break;case'16':ami['emit'](_0x3736('0x94'),ut[_0x3736('0x7b')](_0x48be88,_0x3736('0x95'),this[_0x3736('0x37')][_0x48be88['queue']]));emitVoiceQueueChannelRemove(ut['buildObj'](_0x48be88,_0x3736('0x95')));_0x33d0d0[_0x3736('0x96')]+=0x1;_0x33d0d0[_0x3736('0x97')]+=0x1;_0x33d0d0[_0x3736('0x98')]+=0x1;ut[_0x3736('0x4f')](_0x33d0d0,_0x3736('0x99'));_0x48be88[_0x3736('0x9a')]=ut[_0x3736('0x79')](_0x48be88);ut['logCustomer'](_0x48be88,0x4,_0x3736('0x9b'));rpcDb['createCustomerHistory'](_0x48be88,_0x3736('0x9c'));rpcDb[_0x3736('0x6b')](_0x48be88,_0x3736('0x9d'));rpcDb[_0x3736('0x9e')](_0x48be88);_0x33d0d0[_0x3736('0x9f')]+=_0x48be88[_0x3736('0xa0')];_0x33d0d0['sumBillable']+=_0x48be88[_0x3736('0xa0')];logger[_0x3736('0x53')](_0x3736('0xa1'),_0x48be88[_0x3736('0x8f')],'\x20Queue',_0x33d0d0[_0x3736('0x27')],_0x3736('0x45'),_0x33d0d0[_0x3736('0x2b')]);delete this['actions'][_0x56767b[_0x3736('0xa2')]];break;case _0x3736('0xa3'):_0x33d0d0[_0x3736('0xa4')]+=0x1;_0x48be88[_0x3736('0xa5')]+=0x1;_0x48be88[_0x3736('0x9a')]=ut[_0x3736('0x79')](_0x48be88);ut['logCustomer'](_0x48be88,0x5,_0x3736('0xa6'));_0x49a855=_0x33d0d0['dialBusyRetryFrequency'];_0x3aac16=_0x33d0d0[_0x3736('0x80')];ami['emit']('custom:agentbusy',ut[_0x3736('0x7b')](_0x48be88,_0x3736('0xa7')));rpcDb[_0x3736('0x68')](_0x48be88,_0x3736('0xa8'));_0x3a3e79[_0x3736('0x7e')](_0x48be88,'5',_0x33d0d0)['then'](function(_0x42a26f){_0x5acfc8=_0x42a26f['additional']==0x1;if(!_0x5acfc8){if(ut[_0x3736('0x79')](_0x48be88)>=_0x33d0d0[_0x3736('0xa9')]){_0x29c262=ut[_0x3736('0x81')](_0x48be88,0xf,_0x3736('0x82'));rpcDb['createCustomerFinal'](_0x29c262,_0x3736('0xaa'));}else{if(_0x48be88[_0x3736('0xa5')]>=_0x33d0d0[_0x3736('0xab')]){rpcDb[_0x3736('0x6b')](_0x48be88,_0x3736('0xa8'));}else{rpcDb[_0x3736('0x85')](ut[_0x3736('0x86')](_0x48be88,'countbusyretry',_0x33d0d0[_0x3736('0xac')]),_0x48be88[_0x3736('0x87')],_0x48be88[_0x3736('0x88')]);}}}else{_0x48be88[_0x3736('0xa5')]++;_0x3a3e79[_0x3736('0x8b')]({'id':_0x48be88[_0x3736('0x8a')],'field':{'countbusyretry':_0x48be88[_0x3736('0xa5')]}})[_0x3736('0x5e')](function(){_0x3a3e79['swapAdditionalPhones'](_0x48be88,_0x49a855,_0x3aac16)['then'](function(){});});}});break;case _0x3736('0xad'):_0x33d0d0[_0x3736('0xae')]+=0x1;_0x48be88[_0x3736('0xaf')]+=0x1;_0x48be88[_0x3736('0x9a')]=ut['totalGlobal'](_0x48be88);ut[_0x3736('0x63')](_0x48be88,0x3,_0x3736('0xb0'));_0x49a855=_0x33d0d0[_0x3736('0xb1')];_0x3aac16=_0x33d0d0['callAdditionalPhoneAfterMin'];var _0x5eeb3f=ut[_0x3736('0xb2')](_0x48be88,_0x33d0d0);ami['emit'](_0x3736('0xb3'),_0x5eeb3f);rpcDb[_0x3736('0x68')](_0x48be88,_0x3736('0xb4'));_0x3a3e79[_0x3736('0x7e')](_0x48be88,'3',_0x33d0d0)[_0x3736('0x5e')](function(_0xcb0fb6){_0x5acfc8=_0xcb0fb6[_0x3736('0xb5')]==0x1;if(!_0x5acfc8){if(ut['totalGlobal'](_0x48be88)>=_0x33d0d0[_0x3736('0xa9')]){_0x29c262=ut[_0x3736('0x81')](_0x48be88,0xf,'Global');rpcDb[_0x3736('0x6b')](_0x29c262,_0x3736('0xb6'));}else{if(_0x48be88[_0x3736('0xaf')]>=_0x33d0d0[_0x3736('0xb7')]){rpcDb['createCustomerFinal'](_0x48be88,_0x3736('0xb4'));}else{rpcDb[_0x3736('0x85')](ut['scheduledAt'](_0x48be88,_0x3736('0xaf'),_0x33d0d0['dialNoAnswerRetryFrequency']),_0x48be88[_0x3736('0x87')],_0x48be88[_0x3736('0x88')]);}}}else{_0x48be88[_0x3736('0xaf')]++;_0x3a3e79[_0x3736('0x8b')]({'id':_0x48be88[_0x3736('0x8a')],'field':{'countnoanswerretry':_0x48be88[_0x3736('0xaf')]}})[_0x3736('0x5e')](function(){_0x3a3e79[_0x3736('0x8c')](_0x48be88,_0x49a855,_0x3aac16)[_0x3736('0x5e')](function(){});});}});break;case _0x3736('0xb8'):_0x33d0d0[_0x3736('0xb9')]+=0x1;_0x48be88[_0x3736('0xba')]+=0x1;_0x48be88['countglobal']=ut[_0x3736('0x79')](_0x48be88);ut[_0x3736('0x63')](_0x48be88,0x8,'Congestion');_0x49a855=_0x33d0d0[_0x3736('0xbb')];_0x3aac16=_0x33d0d0[_0x3736('0x80')];ami['emit'](_0x3736('0xbc'),ut[_0x3736('0x7b')](_0x48be88,_0x3736('0xbd')));rpcDb[_0x3736('0x68')](_0x48be88,_0x3736('0xbe'));_0x3a3e79['verifyAdditionalPhones'](_0x48be88,'8',_0x33d0d0)[_0x3736('0x5e')](function(_0x508990){_0x5acfc8=_0x508990[_0x3736('0xb5')]==0x1;if(!_0x5acfc8){if(ut[_0x3736('0x79')](_0x48be88)>=_0x33d0d0['dialGlobalMaxRetry']){_0x29c262=ut[_0x3736('0x81')](_0x48be88,0xf,_0x3736('0x82'));rpcDb['createCustomerFinal'](_0x29c262,'[callProgressDetectingCustomer][logCongestionGlobal]');}else{if(_0x48be88['countcongestionretry']>=_0x33d0d0[_0x3736('0xbf')]){rpcDb[_0x3736('0x6b')](_0x48be88,'[callProgressDetectingCustomer][logCongestion]');}else{rpcDb[_0x3736('0x85')](ut[_0x3736('0x86')](_0x48be88,_0x3736('0xba'),_0x33d0d0[_0x3736('0xac')]),_0x48be88[_0x3736('0x87')],_0x48be88[_0x3736('0x88')]);}}}else{_0x48be88[_0x3736('0xba')]++;_0x3a3e79[_0x3736('0x8b')]({'id':_0x48be88[_0x3736('0x8a')],'field':{'countcongestionretry':_0x48be88[_0x3736('0xba')]}})[_0x3736('0x5e')](function(){_0x3a3e79[_0x3736('0x8c')](_0x48be88,_0x49a855,_0x3aac16)[_0x3736('0x5e')](function(){});});}});break;case _0x3736('0xc0'):_0x33d0d0['outboundRejectCallsDay']+=0x1;_0x48be88[_0x3736('0xc1')]+=0x1;_0x48be88[_0x3736('0x9a')]=ut[_0x3736('0x79')](_0x48be88);ut[_0x3736('0x63')](_0x48be88,0x14,'AgentReject');_0x49a855=_0x33d0d0['dialAgentRejectRetryFrequency'];_0x3aac16=_0x33d0d0[_0x3736('0x80')];ami['emit'](_0x3736('0xc2'),ut[_0x3736('0x7b')](_0x48be88,_0x3736('0xc3')));rpcDb[_0x3736('0x68')](_0x48be88,_0x3736('0xc4'));_0x3a3e79['verifyAdditionalPhones'](_0x48be88,'20',_0x33d0d0)[_0x3736('0x5e')](function(_0x1ef52e){_0x5acfc8=_0x1ef52e[_0x3736('0xb5')]==0x1;if(!_0x5acfc8){if(ut['totalGlobal'](_0x48be88)>=_0x33d0d0[_0x3736('0xa9')]){_0x29c262=ut[_0x3736('0x81')](_0x48be88,0x14,_0x3736('0xc5'));rpcDb[_0x3736('0x6b')](_0x29c262,_0x3736('0xc6'));}else{if(_0x48be88[_0x3736('0xc1')]>=_0x33d0d0[_0x3736('0xc7')]){rpcDb[_0x3736('0x6b')](_0x48be88,_0x3736('0xc6'));}else{rpcDb['rescheduleContact'](ut['scheduledAt'](_0x48be88,_0x3736('0xc1'),_0x33d0d0[_0x3736('0xc8')]),_0x48be88[_0x3736('0x87')],_0x48be88[_0x3736('0x88')]);}}}else{_0x48be88['countnoanswerretry']++;_0x3a3e79[_0x3736('0x8b')]({'id':_0x48be88[_0x3736('0x8a')],'field':{'countnoanswerretry':_0x48be88[_0x3736('0xaf')]}})['then'](function(){_0x3a3e79[_0x3736('0x8c')](_0x48be88,_0x49a855,_0x3aac16)[_0x3736('0x5e')](function(){});});}});break;case _0x3736('0xc9'):_0x33d0d0[_0x3736('0xca')]+=0x1;_0x48be88[_0x3736('0xcb')]+=0x1;_0x48be88[_0x3736('0x9a')]=ut[_0x3736('0x79')](_0x48be88);ut[_0x3736('0x63')](_0x48be88,0xb,_0x3736('0xcc'));rpcDb['createCustomerHistory'](_0x48be88,_0x3736('0xcd'));_0x3a3e79[_0x3736('0x7e')](_0x48be88,'11',_0x33d0d0)[_0x3736('0x5e')](function(_0x46c125){_0x5acfc8=_0x46c125[_0x3736('0xb5')]==0x1;if(!_0x5acfc8){if(ut[_0x3736('0x79')](_0x48be88)>=_0x33d0d0['dialGlobalMaxRetry']){_0x29c262=ut[_0x3736('0x81')](_0x48be88,0xf,'Global');rpcDb[_0x3736('0x6b')](_0x29c262,_0x3736('0xcd'));}else{if(_0x48be88['countabandonedetry']>=_0x33d0d0[_0x3736('0xce')]){rpcDb[_0x3736('0x6b')](_0x48be88,'[callProgressDetectingCustomer][logAbandoned]');}else{rpcDb[_0x3736('0x85')](ut[_0x3736('0x86')](_0x48be88,'countabandonedretry',_0x33d0d0[_0x3736('0xcf')]),_0x48be88[_0x3736('0x87')],_0x48be88['activeContact']);}}}else{_0x48be88[_0x3736('0xaf')]++;_0x3a3e79[_0x3736('0x8b')]({'id':_0x48be88[_0x3736('0x8a')],'field':{'countnoanswerretry':_0x48be88['countnoanswerretry']}})[_0x3736('0x5e')](function(){_0x3a3e79[_0x3736('0x8c')](_0x48be88,_0x49a855,_0x3aac16)[_0x3736('0x5e')](function(){});});}});break;case'18':_0x33d0d0[_0x3736('0xd0')]+=0x1;_0x48be88[_0x3736('0xd1')]+=0x1;_0x48be88[_0x3736('0x9a')]=ut[_0x3736('0x79')](_0x48be88);ut[_0x3736('0x63')](_0x48be88,0x12,_0x56767b['cause-txt']||_0x56767b[_0x3736('0xd2')]);ami[_0x3736('0x22')](_0x3736('0xd3'),ut[_0x3736('0x7b')](_0x48be88,_0x3736('0xd4')));rpcDb[_0x3736('0x68')](_0x48be88,_0x3736('0xd5'));_0x3a3e79['verifyAdditionalPhones'](_0x48be88,'18',_0x33d0d0)[_0x3736('0x5e')](function(_0x2cc292){_0x5acfc8=_0x2cc292['additional']==0x1;if(!_0x5acfc8){if(ut['totalGlobal'](_0x48be88)>=_0x33d0d0[_0x3736('0xa9')]){_0x29c262=ut[_0x3736('0x81')](_0x48be88,0x12,_0x3736('0x82'));rpcDb[_0x3736('0x6b')](_0x29c262,'[callProgressDetectingCustomer][hangupInAMD]');}else{rpcDb[_0x3736('0x6b')](_0x48be88,_0x3736('0xd5'));}}else{_0x48be88[_0x3736('0xaf')]++;_0x3a3e79[_0x3736('0x8b')]({'id':_0x48be88['idContact'],'field':{'countnoanswerretry':_0x48be88['countnoanswerretry']}})[_0x3736('0x5e')](function(){_0x3a3e79[_0x3736('0x8c')](_0x48be88,_0x49a855,_0x3aac16)['then'](function(){});});}});delete this[_0x3736('0x12')][_0x56767b[_0x3736('0xa2')]];break;case'19':_0x33d0d0[_0x3736('0xd0')]+=0x1;_0x48be88[_0x3736('0x9a')]=ut['totalGlobal'](_0x48be88);ut[_0x3736('0x63')](_0x48be88,0x13,_0x56767b[_0x3736('0xd6')]||_0x56767b[_0x3736('0xd2')]);ami[_0x3736('0x22')](_0x3736('0xd3'),ut[_0x3736('0x7b')](_0x48be88,_0x3736('0xd4')));rpcDb[_0x3736('0x68')](_0x48be88,_0x3736('0xd7'));_0x3a3e79[_0x3736('0x7e')](_0x48be88,'18',_0x33d0d0)[_0x3736('0x5e')](function(_0x32afd9){_0x5acfc8=_0x32afd9[_0x3736('0xb5')]==0x1;if(!_0x5acfc8){if(ut[_0x3736('0x79')](_0x48be88)>=_0x33d0d0[_0x3736('0xa9')]){_0x29c262=ut[_0x3736('0x81')](_0x48be88,0xf,_0x3736('0x82'));rpcDb[_0x3736('0x6b')](_0x29c262,_0x3736('0xd7'));}else{rpcDb[_0x3736('0x6b')](_0x48be88,_0x3736('0xd7'));}}else{_0x48be88[_0x3736('0xaf')]++;_0x3a3e79[_0x3736('0x8b')]({'id':_0x48be88[_0x3736('0x8a')],'field':{'countnoanswerretry':_0x48be88[_0x3736('0xaf')]}})[_0x3736('0x5e')](function(){_0x3a3e79['swapAdditionalPhones'](_0x48be88,_0x49a855,_0x3aac16)[_0x3736('0x5e')](function(){});});}});delete this['actions'][_0x56767b['linkedid']];break;default:if(_0x48be88[_0x3736('0x4e')]){ut[_0x3736('0x4f')](_0x33d0d0,_0x3736('0xd8'));ut[_0x3736('0x51')](_0x3736('0xd9')+_0x33d0d0[_0x3736('0x27')],_0x56767b);}_0x33d0d0[_0x3736('0xd0')]+=0x1;_0x48be88[_0x3736('0x9a')]=ut['totalGlobal'](_0x48be88);ut['logCustomer'](_0x48be88,0xc,_0x56767b[_0x3736('0xd6')]||_0x56767b[_0x3736('0xd2')]);_0x49a855=_0x33d0d0['dialAgentRejectRetryFrequency'];_0x3aac16=_0x33d0d0['callAdditionalPhoneAfterMin'];rpcDb['createCustomerHistory'](_0x48be88,'[callProgressDetectingCustomer][logUnknown]');_0x3a3e79[_0x3736('0x7e')](_0x48be88,'20',_0x33d0d0)[_0x3736('0x5e')](function(_0x416b67){_0x5acfc8=_0x416b67[_0x3736('0xb5')]==0x1;if(!_0x5acfc8){if(ut[_0x3736('0x79')](_0x48be88)>=_0x33d0d0[_0x3736('0xa9')]){_0x29c262=ut[_0x3736('0x81')](_0x48be88,0xf,'Global');rpcDb[_0x3736('0x6b')](_0x29c262,_0x3736('0xda'));}else{rpcDb[_0x3736('0x6b')](_0x48be88,_0x3736('0xda'));}delete this[_0x3736('0x12')][_0x56767b['linkedid']];}else{_0x3a3e79[_0x3736('0x8c')](_0x48be88,_0x49a855,_0x3aac16)['then'](function(){});}});}if(!(_0x48be88['dialAnswer']&&_0x583ed9==='16')){utils[_0x3736('0x4d')](_0x33d0d0,'[callProgressDetectingCustomer]');logger[_0x3736('0x53')](_0x3736('0xdb'),_0x48be88[_0x3736('0x8f')],_0x3736('0x90'),_0x33d0d0['name'],_0x3736('0xdc'),_0x33d0d0[_0x3736('0x44')]);}if(_0x583ed9!=='ANSWER'){delete this[_0x3736('0x12')][_0x56767b[_0x3736('0xa2')]];delete this[_0x3736('0x12')][_0x56767b[_0x3736('0xdd')]];}_0x33d0d0[_0x3736('0xde')]=!![];}};Preview[_0x3736('0x36')][_0x3736('0xdf')]=function(_0x4db3fb,_0x57fa7f,_0x3b6132){if(_[_0x3736('0xe0')](_0x57fa7f)&&_0x3736('0xe1')!==typeof _0x57fa7f){return;}if(_['isUndefined'](_0x3b6132)&&_0x3736('0xe1')!==typeof _0x3b6132){return;}switch(_0x3b6132['reason']){case'0':ut[_0x3736('0xe2')](_0x4db3fb,0x0,'NoSuchNumber');rpcDb[_0x3736('0xe3')](_0x4db3fb,'[callProgressDetectingAgent][logNoSuch]');break;case'3':ut[_0x3736('0xe2')](_0x4db3fb,0x3,_0x3736('0xb0'));rpcDb[_0x3736('0xe3')](_0x4db3fb,'[callProgressDetectingAgent][logNoAnswer]');break;case'5':ut[_0x3736('0xe2')](_0x4db3fb,0x5,_0x3736('0xa6'));rpcDb[_0x3736('0xe3')](_0x4db3fb,'[callProgressDetectingAgent][logBusy]');break;case'8':ut[_0x3736('0xe2')](_0x4db3fb,0x8,'Congestion');rpcDb[_0x3736('0xe3')](_0x4db3fb,'[callProgressDetectingAgent][logCongestion]');break;case'22':ut[_0x3736('0xe2')](_0x4db3fb,0x16,_0x3736('0xe4'));rpcDb[_0x3736('0xe3')](_0x4db3fb,_0x3736('0xe5'));break;default:ut['logAgent'](_0x4db3fb,0xc,_0x3b6132[_0x3736('0xe6')]);rpcDb['createAgentHistory'](_0x4db3fb,_0x3736('0xe7'));}utils[_0x3736('0x4d')](_0x57fa7f,'[callProgressDetectingAgent]');logger[_0x3736('0x53')](_0x3736('0xe8'),_0x4db3fb[_0x3736('0x8f')],_0x3736('0x90'),_0x57fa7f['name'],_0x3736('0xdc'),_0x57fa7f['originated']);delete this[_0x3736('0x12')][_0x4db3fb[_0x3736('0x8f')]];};Preview[_0x3736('0x36')][_0x3736('0x7e')]=function(_0x232049,_0x4d8887,_0x46232f){return cmHopperAdditionalPhone[_0x3736('0x7e')](_0x232049,_0x4d8887,_0x46232f)[_0x3736('0x4b')](logger[_0x3736('0x53')](_0x3736('0xe9')));};Preview['prototype'][_0x3736('0x8c')]=function(_0x1d8bb5,_0x344571,_0x82d6e4){return cmHopperAdditionalPhone[_0x3736('0x8c')](_0x1d8bb5,_0x344571,_0x82d6e4)[_0x3736('0x4b')](logger[_0x3736('0x53')](_0x3736('0xea')));};Preview['prototype'][_0x3736('0x8b')]=function(_0x541936){return Promise[_0x3736('0xeb')]()[_0x3736('0x5e')](cmHopperAdditionalPhone[_0x3736('0x8b')](_0x541936))[_0x3736('0x4b')](logger[_0x3736('0x53')]('[incrementPreviewCounters]\x20'));};Preview[_0x3736('0x36')]['checkInBlack']=function(_0x42e5d1,_0x17cb12,_0x589424,_0x8b1376,_0x433e50){var _0x1b8d5e=this;return new Promise(function(_0x248002,_0x1e9d90){if(_[_0x3736('0x40')](_0x17cb12)||_[_0x3736('0x40')](_0x17cb12[_0x3736('0xec')])||_[_0x3736('0x40')](_0x17cb12[_0x3736('0xed')])||_[_0x3736('0x40')](_0x17cb12[_0x3736('0xee')])){_0x1e9d90(ut[_0x3736('0x2e')](_0x3736('0xef'),_0x8b1376,_0x433e50));return;}var _0x5e47ae=uuid['v4']();var _0x3e36f7=_0x1b8d5e[_0x3736('0x37')][_0x17cb12[_0x3736('0x42')][_0x3736('0x27')]];var _0x33f9e9=_0x589424?_0x1b8d5e[_0x3736('0xf0')][_0x589424]['id']:undefined;_0x1b8d5e[_0x3736('0x12')][_0x5e47ae]=new Action(_0x17cb12,_0x3e36f7,_0x5e47ae,_0x589424,_0x33f9e9);var _0x3c035e=_0x1b8d5e['actions'][_0x5e47ae];_0x3c035e[_0x3736('0x87')]=_0x8b1376;_0x3c035e[_0x3736('0x88')]=_0x433e50;_0x3c035e['lookAgent']=_0x589424;if(_['isEmpty'](_0x42e5d1)){_0x1b8d5e[_0x3736('0xf1')](_0x3c035e,_0x3e36f7,_0x17cb12,_0x589424)[_0x3736('0x5e')](function(_0x26781e){logger[_0x3736('0x53')](_0x3736('0xf2'),'Queue:\x20'+_0x3c035e[_0x3736('0x43')]+_0x3736('0xf3')+_0x3c035e[_0x3736('0x8a')],JSON[_0x3736('0x24')](_0x26781e));ami[_0x3736('0x22')](_0x3736('0xf4'),ut[_0x3736('0x7b')](_0x3c035e,_0x3736('0xf5'),_0x1b8d5e['campaignsPreview'][_0x3c035e[_0x3736('0x43')]]));_0x248002(ut[_0x3736('0x2e')]('Calling'));})[_0x3736('0x4b')](function(_0x33a50d){ut[_0x3736('0x33')](_0x3736('0xf6'),_0x33a50d);_0x1e9d90(ut['message'](_0x3736('0xf7'),_0x8b1376,_0x433e50));});}else{_0x3e36f7[_0x3736('0xf8')]+=0x1;ut['logBlacklist'](_0x3c035e);rpcDb['createHistory'](_0x3c035e,_0x3736('0xf9'));delete _0x1b8d5e['actions'][_0x5e47ae];_0x1e9d90(ut['message']('Contact\x20in\x20black\x20List',_0x8b1376,_0x433e50));}});};Preview[_0x3736('0x36')]['isTrunkReachable']=function(_0x3be262){return!_[_0x3736('0x40')](_0x3be262)&&!_[_0x3736('0x40')](_0x3be262[_0x3736('0x27')])&&!_[_0x3736('0x40')](_0x3be262[_0x3736('0xfa')])&&_0x3be262[_0x3736('0xfa')]&&!_['isNil'](this[_0x3736('0x11')][util[_0x3736('0x25')]('SIP/%s',_0x3be262[_0x3736('0x27')])])&&!_[_0x3736('0x40')](this['trunks'][util[_0x3736('0x25')](_0x3736('0xfb'),_0x3be262['name'])][_0x3736('0x49')])&&(this[_0x3736('0x11')][util[_0x3736('0x25')](_0x3736('0xfb'),_0x3be262[_0x3736('0x27')])][_0x3736('0x49')]===_0x3736('0xfc')||this[_0x3736('0x11')][util[_0x3736('0x25')](_0x3736('0xfb'),_0x3be262[_0x3736('0x27')])][_0x3736('0x49')]==='unmonitored');};Preview[_0x3736('0x36')][_0x3736('0x5d')]=function(_0x7fefe,_0x11f551){return this['execRun'](_0x7fefe,_0x11f551)[_0x3736('0x5e')](function(_0xa788a1){return _['pick'](_0xa788a1,['message']);})[_0x3736('0x4b')](function(_0x59ad06){if(_0x59ad06[_0x3736('0xfd')]){rpcDb['unlockContact'](_0x7fefe);}if(_0x59ad06[_0x3736('0xfa')]){rpcDb[_0x3736('0xfe')](_0x7fefe);}throw _['pick'](_0x59ad06,[_0x3736('0x2e')]);});};Preview[_0x3736('0x36')][_0x3736('0xff')]=function(_0x148a44,_0x107df5){var _0x24cdbd=this;var _0x3f162c,_0x13cb3f;return rpcDb['getContactPreview'](_0x148a44)[_0x3736('0x5e')](function(_0x4fdfdf){if(!_[_0x3736('0x40')](_0x4fdfdf[0x0])){_0x13cb3f=_0x4fdfdf[0x0][_0x3736('0x100')]?![]:!![];_0x3f162c=_0x4fdfdf[0x0][_0x3736('0x100')]?!![]:![];_0x3f162c=_0x107df5?!![]:_0x3f162c;}var _0x1eb119=_0x24cdbd[_0x3736('0x101')](_0x4fdfdf);if(_0x1eb119[_0x3736('0x102')]){rpcDb['checkIsBlackList'](_['pick'](_0x4fdfdf[0x0],[_0x3736('0xee'),_0x3736('0xed')]))[_0x3736('0x5e')](function(_0x2ca79a){_0x24cdbd['checkInBlack'](_0x2ca79a,_0x4fdfdf[0x0],_0x107df5,_0x13cb3f,_0x3f162c)[_0x3736('0x5e')](function(_0x44364e){return _0x44364e;})[_0x3736('0x4b')](function(_0x4db6e5){throw _0x4db6e5;});})['catch'](function(_0x5b842a){ut[_0x3736('0x33')](_0x3736('0x103'),_0x5b842a);throw ut[_0x3736('0x2e')](_0x3736('0x104'),_0x13cb3f,_0x3f162c);});}else{throw ut['message'](_0x1eb119['message'],_0x13cb3f,_0x3f162c);}})['catch'](function(_0x563f50){ut[_0x3736('0x33')](_0x3736('0x105'),_0x563f50);throw ut[_0x3736('0x2e')]('Call\x20unsuccessful',![],!![]);});};Preview[_0x3736('0x36')][_0x3736('0x101')]=function(_0x86344d){if(_[_0x3736('0x40')](_0x86344d)||_[_0x3736('0x106')](_0x86344d)||!_[_0x3736('0x40')](_0x86344d[0x0][_0x3736('0x5b')])&&_[_0x3736('0x40')](_0x86344d[0x0][_0x3736('0x5b')][_0x3736('0x27')])){ut[_0x3736('0x33')](_0x3736('0x107'),_0x86344d);return{'isValid':![],'message':'Empty\x20Contact'};}var _0x129b5d=this['campaignsPreview'][_0x86344d[0x0][_0x3736('0x42')][_0x3736('0x27')]];_0x129b5d[_0x3736('0x2e')]=utils[_0x3736('0x2f')][_0x3736('0x76')];if(_[_0x3736('0x40')](_0x129b5d)){ut[_0x3736('0x33')](_0x3736('0x108'),_0x129b5d);return{'isValid':![],'message':_0x3736('0x109')};}if(!this[_0x3736('0x72')](_0x129b5d[_0x3736('0x73')])){ut[_0x3736('0x33')](_0x3736('0x10a'),_0x3736('0x10b')+_0x129b5d['name']+_0x3736('0x10c'));if(!this[_0x3736('0x72')](_0x129b5d[_0x3736('0x74')])){ut['logger'](_0x3736('0x10a'),_0x129b5d[_0x3736('0x27')]+'\x20Trunk\x20Backup\x20is\x20not\x20active');return{'isValid':![],'message':'Trunk\x20not\x20working\x20correctly'};}}if(!ut[_0x3736('0x70')](_0x129b5d[_0x3736('0x71')])){ut['logger'](_0x3736('0x10d'),_0x129b5d[_0x3736('0x27')]+'\x20Not\x20Active');return{'isValid':![],'message':_0x3736('0x10b')+_0x129b5d[_0x3736('0x27')]+_0x3736('0x10e')};}return{'isValid':!![],'message':_0x3736('0x10f')};};Preview[_0x3736('0x36')][_0x3736('0xf1')]=function(_0x378ffe,_0x570b89,_0x1d3a5a,_0x59b0ba){var _0x158407=this;return new Promise(function(_0x4b8bd0,_0x42e14e){var _0x2dd8ca=_0x378ffe[_0x3736('0x8f')];var _0x6abb12=_0x158407[_0x3736('0x72')](_0x570b89[_0x3736('0x73')])?util[_0x3736('0x25')](_0x3736('0x110'),_0x570b89[_0x3736('0x73')][_0x3736('0x27')],_['isNil'](_0x570b89[_0x3736('0x111')])?'':_0x570b89[_0x3736('0x111')][_0x3736('0x112')]()||'',_0x570b89[_0x3736('0x113')]>0x0?_0x1d3a5a[_0x3736('0xed')][_0x3736('0x114')](_0x570b89[_0x3736('0x113')]):_0x1d3a5a[_0x3736('0xed')]):util[_0x3736('0x25')](_0x3736('0x110'),_[_0x3736('0x40')](_0x570b89[_0x3736('0x74')])?_0x570b89[_0x3736('0x73')]['name']:_0x570b89[_0x3736('0x74')][_0x3736('0x27')],_[_0x3736('0x40')](_0x570b89[_0x3736('0x111')])?'':_0x570b89[_0x3736('0x111')][_0x3736('0x112')]()||'',_0x570b89[_0x3736('0x113')]>0x0?_0x1d3a5a[_0x3736('0xed')][_0x3736('0x114')](_0x570b89[_0x3736('0x113')]):_0x1d3a5a[_0x3736('0xed')]);var _0x399a5e=_0x158407['isTrunkReachable'](_0x570b89[_0x3736('0x73')])?ut[_0x3736('0x115')](_0x570b89[_0x3736('0x73')][_0x3736('0x116')],_0x570b89[_0x3736('0x117')],_0x570b89[_0x3736('0x118')]>0x0?ut[_0x3736('0x119')](_0x570b89[_0x3736('0x11a')],_0x570b89[_0x3736('0x118')]):_0x570b89['dialOriginateCallerIdNumber']):ut['getCallerId'](_['isNil'](_0x570b89[_0x3736('0x74')])?_0x570b89[_0x3736('0x73')][_0x3736('0x116')]:_0x570b89[_0x3736('0x74')][_0x3736('0x116')],_0x570b89['dialOriginateCallerIdName'],_0x570b89[_0x3736('0x118')]>0x0?ut[_0x3736('0x119')](_0x570b89[_0x3736('0x11a')],_0x570b89[_0x3736('0x118')]):_0x570b89['dialOriginateCallerIdNumber']);if(_0x399a5e){_0x378ffe['originatecalleridname']=ut[_0x3736('0x11b')](_0x399a5e);_0x378ffe[_0x3736('0x11c')]=ut[_0x3736('0x11d')](_0x399a5e);}var _0x160f26=ut[_0x3736('0x11e')](_0x570b89,_0x1d3a5a,_0x6abb12,_0x399a5e,_0x2dd8ca,_0x378ffe);var _0x2c540f=utils[_0x3736('0x11f')](_0x1d3a5a[_0x3736('0xec')]);Object[_0x3736('0x120')](_0x160f26,_0x2c540f);_[_0x3736('0x121')](_0x378ffe,ut['toLowerVariables'](_0x160f26));_0x378ffe[_0x3736('0x61')]=moment()['format']('YYYY-MM-DD\x20HH:mm:ss');_0x570b89[_0x3736('0x122')]=_0x160f26;var _0x49a3ff=ut[_0x3736('0x123')](_0x378ffe,_0x570b89,_0x160f26,_0x378ffe[_0x3736('0x88')],_0x59b0ba);return ami[_0x3736('0x48')](_0x49a3ff)['then'](function(_0x496e3f){_0x570b89[_0x3736('0x44')]+=0x1;logger[_0x3736('0x53')](_0x3736('0x124'),_0x2dd8ca,_0x3736('0x90'),_0x570b89[_0x3736('0x27')],_0x3736('0xdc'),_0x570b89[_0x3736('0x44')]);_0x4b8bd0(_0x496e3f);})['catch'](function(_0x3d4f2f){ut[_0x3736('0xe2')](_0x378ffe,0xe,_0x3736('0x125'));rpcDb['createAgentHistory'](_0x378ffe,'[originateFailure][logOriginateFailure]');_0x42e14e(_0x3d4f2f);});});};Preview[_0x3736('0x36')][_0x3736('0x1b')]=function(_0x854ad6){if(this['actions'][_0x854ad6[_0x3736('0xa2')]]){this[_0x3736('0x12')][_0x854ad6[_0x3736('0xa2')]]['channel']=_0x854ad6['channel'];}};Preview[_0x3736('0x36')][_0x3736('0x14')]=function(_0x10df15){var _0x4e10ec=this;var _0x18b6ad=this['actions'][_0x10df15[_0x3736('0x126')]];if(_0x18b6ad){if(_0x18b6ad[_0x3736('0x127')]&&this[_0x3736('0xf0')][_0x18b6ad[_0x3736('0x127')]]){ut[_0x3736('0x128')](_0x18b6ad,this[_0x3736('0xf0')][_0x18b6ad['lookAgent']][_0x3736('0x27')],this[_0x3736('0xf0')][_0x18b6ad['lookAgent']]['id']);}var _0x597f16=_[_0x3736('0x129')](_0x18b6ad);_0x597f16[_0x3736('0x12a')]=moment()[_0x3736('0x25')](_0x3736('0x62'));var _0xb340ce=_0x4e10ec[_0x3736('0x37')][_0x18b6ad[_0x3736('0x43')]];if(ut[_0x3736('0x12b')](_0x10df15[_0x3736('0x12c')])){if(_0x18b6ad[_0x3736('0x87')]){rpcDb[_0x3736('0x12d')](_0x18b6ad['idContact']);}if(_0x18b6ad[_0x3736('0x88')]){rpcDb[_0x3736('0xfe')](_0x18b6ad[_0x3736('0x8a')]);}ami[_0x3736('0x22')]('custom:agentringnoanswer',ut[_0x3736('0x7b')](_0x18b6ad,'rejected',this['campaignsPreview'][_0x18b6ad[_0x3736('0x43')]]));this['callProgressDetectingAgent'](_0x597f16,_0xb340ce,_0x10df15);}else{_0x18b6ad['starttime']=moment()[_0x3736('0x25')](_0x3736('0x62'));ut[_0x3736('0xe2')](_0x597f16,0x4,_0x3736('0x9b'));rpcDb['createAgentHistory'](_0x597f16,_0x3736('0x12e'));}}};Preview['prototype'][_0x3736('0x17')]=function(_0x155390){var _0x5225d9=this[_0x3736('0x12')][_0x155390[_0x3736('0xa2')]];var _0xf55600;if(_0x5225d9){_0xf55600=this[_0x3736('0x37')][_0x5225d9['queue']];logger['info'](_0x3736('0x12f'),_0x155390[_0x3736('0xa2')],_0x3736('0x90'),_0xf55600[_0x3736('0x27')],_0x3736('0x45'),_0xf55600[_0x3736('0x2b')]);}if(this[_0x3736('0x12')][_0x155390[_0x3736('0xa2')]]&&_0x155390[_0x3736('0xa2')]!==_0x155390['uniqueid']){if(_0x155390[_0x3736('0x130')]==='16'&&this['actions'][_0x155390[_0x3736('0xa2')]][_0x3736('0x4e')]){this['callProgressDetectingCustomer'](_0x155390,_0x155390['linkedid'],_0x155390[_0x3736('0x130')]);}else if(this[_0x3736('0x12')][_0x155390[_0x3736('0xa2')]][_0x3736('0x4e')]){logger[_0x3736('0x53')](_0x3736('0x131'),_0x155390[_0x3736('0xa2')],_0x155390[_0x3736('0x130')],_0x3736('0x90'),_0xf55600[_0x3736('0x27')],'pTalking:\x20',_0xf55600[_0x3736('0x2b')]);this['callProgressDetectingCustomer'](_0x155390,_0x155390[_0x3736('0xa2')],_0x155390[_0x3736('0x130')]);}}else if(_0x5225d9&&_[_0x3736('0x40')](_0x5225d9['statedesc'])&&_0xf55600[_0x3736('0x132')]&&_0x155390['linkedid']===_0x155390[_0x3736('0x8f')]&&_['isNil'](_0x155390[_0x3736('0xe6')])&&_0x155390[_0x3736('0x130')]==='16'&&_0x155390['channelstate']==='6'&&_['isUndefined'](_0x5225d9[_0x3736('0x133')])){if(_0x5225d9[_0x3736('0x87')]){rpcDb[_0x3736('0x12d')](_0x5225d9[_0x3736('0x8a')]);}if(_0x5225d9[_0x3736('0x88')]){rpcDb[_0x3736('0xfe')](_0x5225d9[_0x3736('0x8a')]);}_0x155390[_0x3736('0xe6')]='22';this[_0x3736('0xdf')](_0x5225d9,_0xf55600,_0x155390);}else if(_0x5225d9&&_0x5225d9['transfer']){if(_0x155390[_0x3736('0x130')]==='16'&&this[_0x3736('0x12')][_0x155390['linkedid']]['dialAnswer']){logger[_0x3736('0x53')](_0x3736('0x134'),_0x155390['linkedid'],_0x155390[_0x3736('0x130')],_0x3736('0x90'),_0xf55600[_0x3736('0x27')],_0x3736('0x45'),_0xf55600['pTalking']);this[_0x3736('0x77')](_0x155390,_0x155390[_0x3736('0xa2')],_0x155390[_0x3736('0x130')]);}else if(this['actions'][_0x155390['linkedid']]['dialAnswer']){logger[_0x3736('0x53')]('[syncHangup][talking][cause]',_0x155390['linkedid'],_0x155390[_0x3736('0x130')],_0x3736('0x90'),_0xf55600[_0x3736('0x27')],_0x3736('0x45'),_0xf55600['pTalking']);this[_0x3736('0x77')](_0x155390,_0x155390[_0x3736('0xa2')],_0x155390['cause']);}}};Preview[_0x3736('0x36')][_0x3736('0x19')]=function(_0x5e9c14){if(this[_0x3736('0x12')][_0x5e9c14['destlinkedid']]&&_0x5e9c14[_0x3736('0xdd')]!==_0x5e9c14['destuniqueid']){this[_0x3736('0x77')](_0x5e9c14,_0x5e9c14[_0x3736('0xdd')],_0x5e9c14['dialstatus']);}};Preview[_0x3736('0x36')][_0x3736('0x135')]=function(_0x1db153){if(this[_0x3736('0x12')][_0x1db153[_0x3736('0xa2')]]&&_0x1db153[_0x3736('0xa2')]!==_0x1db153['uniqueid']&&!this['actions'][_0x1db153[_0x3736('0xa2')]]['dialAnswer']){if(_0x1db153[_0x3736('0x130')]==='1'){this[_0x3736('0x77')](_0x1db153,_0x1db153[_0x3736('0xa2')],_0x1db153[_0x3736('0x130')]);}}};Preview[_0x3736('0x36')]['addVariable']=function(_0x4a3719,_0x2dd98d,_0x2706a9){if(this[_0x3736('0x12')][_0x4a3719]){if(_[_0x3736('0x40')](this['actions'][_0x4a3719][_0x3736('0x122')])){this[_0x3736('0x12')][_0x4a3719][_0x3736('0x122')]={};}this['actions'][_0x4a3719]['variables'][_0x2dd98d]=_0x2706a9;}};Preview['prototype']['syncVarSet']=function(_0x4e0ec8){try{if(!_[_0x3736('0x40')](_0x4e0ec8)){if(ut[_0x3736('0x136')](_['keys'](_0x4e0ec8[_0x3736('0x137')])[0x0])){this['addVariable'](_0x4e0ec8[_0x3736('0x8f')],_['keys'](_0x4e0ec8['variable'])[0x0],_0x4e0ec8[_0x3736('0x138')]);}}}catch(_0x1db779){logger['error'](_0x3736('0x139'),util[_0x3736('0x13a')](_0x1db779,{'showHidden':![],'depth':null}));}};Preview[_0x3736('0x36')][_0x3736('0x1f')]=function(_0x2c84b4){if(_0x2c84b4){if(this['actions'][_0x2c84b4[_0x3736('0x13b')]]){this['actions'][_0x2c84b4[_0x3736('0x13b')]][_0x3736('0x133')]=!![];}}};Preview['prototype'][_0x3736('0x13c')]=function(_0x331ca7){if(_0x331ca7){if(this['actions'][_0x331ca7[_0x3736('0x13d')]]){this[_0x3736('0x12')][_0x331ca7[_0x3736('0x13d')]][_0x3736('0x133')]=!![];}}};module[_0x3736('0x13e')]=Preview; \ No newline at end of file +var _0x305a=['createAgentHistory','[callProgressDetectingAgent][logNoSuch]','[callProgressDetectingAgent][logAnswerAGI]','[callProgressDetectingAgent][logCongestion]','[callProgressDetectingAgent]','[originated][decrement][callProgressDetectingAgent]','[verifyAdditionalPhone]\x20','[swapAdditionalPhone]\x20','[incrementPreviewCounters]\x20','checkInBlack','isNil','Contact\x20is\x20undefined','isEmpty','execCall','[Preview][execCall][success]','\x20IdHopper:\x20','called','Calling','[Preview][execCall][failure]','outboundBlacklistCallsDay','createHistory','Contact\x20in\x20black\x20List','SIP/%s','reachable','unmonitored','execRun','unlock','unlockContact','disableContact','recallme','validateContact','isValid','checkIsBlackList','phone','[Preview][checkIsBlackList]','Call\x20unsuccessful','[Preview][getContactPreview]','[Preview][validateContact][Empty\x20Contact]','Empty\x20Contact','Queue','[Preview][validateContact][Empty\x20Campaign]','Empty\x20Campaign','[Preview][validateContact][Trunk\x20not\x20working\x20correctly]','\x20Trunk\x20is\x20not\x20active','\x20Trunk\x20Backup\x20is\x20not\x20active','[Preview][validateContact][Campaign\x20Active]','\x20Not\x20Active','campaign\x20Name:\x20','Is\x20Valid','SIP/%s/%s%s','dialPrefix','trim','dialCutDigit','substring','callerid','dialOriginateCallerIdName','dialRandomLastDigitCallerIdNumber','getCallerIdRandom','dialOriginateCallerIdNumber','getCallerId','extractCalleridName','extractCalleridNumber','addVariables','setXMDContactVariables','assign','merge','toLowerVariables','starttime','variables','variablesAction','OriginateError','[originateFailure][logOriginateFailure]','syncNewExten','actionid','lookAgent','logLookAgent','clone','response','rejected','Answer','[callProgressDetectingAgent][logAnswer]','[syncHangup][talking]','cause','callProgressDetectingCustomer','statedesc','dialQueueProject','channelstate','transfer','[syncHangup][talking][transfer]','[syncHangup][talking][cause]','syncDialEnd','destuniqueid','syncVarSet','filterKey','keys','variable','addVariable','value','error','transfertargetlinkedid','transfererlinkedid','exports','util','lodash','uuid','../../../config/environment','../../../config/logger','actionPreview','../ami','./rpcDb','../rpc/cmHopperAdditionalPhone','./action','./util/util','redis','defaults','localhost','socket.io-emitter','prototype','enqueue','tail','finally','sequence','campaignsPreview','voiceQueues','trunks','agents','clockClearZombieChannels','originateresponse','syncOriginateResponse','bind','hangup','syncHangup','hanguprequest','syncHangupRequest','dialend','varset','attendedtransfer','syncAttendedTransfer','blindtransfer','syncBlindTransfer','loopCampaigns','emit','[DEBUG]\x20Emit\x20voice_queue_channel:remove\x20event','stringify','format','voice:queue:%s','name','voice_queue_channel:remove','voice_queue_presence:remove','sendMessageOneNotActive','available','paused','message','CAMPAIGN_STATUS','INACTIVE','logger','\x20is\x20not\x20active','DEACTIVATED','[CampaignPreview]\x20Campaign\x20Queue:\x20','\x20is\x20deactivated','syncCampaigns','hasOwnProperty','dialMethod','preview','type','outbound','dialActive','setMessage','dialPreviewAutoRecallMe','info','[clearZombieChannels][talking]','actions','queue','originated:\x20','originated','pTalking:\x20','pTalking','dialAnswer','pick','contactId','UserId','VoiceQueueId','ListId','Action','status','channel','catch','No\x20such\x20channel','decrementOriginate','[clearZombieChannel]','decrementTalking','loggerError','[Dialer][checkChannel][pTalking][Preview]','[Dialer][checkChannel][Preview]','clearZombieChannels','[action]','size','clearZombieChannel','recallMe','getContactRecallMe','agentReadyId','length','getDiff','scheduledat','dialRecallMeTimeout','Agent','run','then','logger2','[RecallMe]','YYYY-MM-DD\x20HH:mm:ss','outboundReCallsDay','logCustomer','dialRecallInQueue','rescheduleContactInQueue','[HistoryDialRecallInQueue][historyCatch]','createCustomerHistory','[HistoryRecallClose]','createCustomerFinal','IsNotLoggedIn','loggedIn','NO_AGENTS_LOGGED','isActive','Trunk','isTrunkReachable','TrunkBackup','UNREACHABLE_TRUNK','ACTIVE','outboundNoSuchCallsDay','countnosuchnumberretry','totalGlobal','custom:agentnosuchnumber','nosuchnumber','[callProgressDetectingCustomer][logNoSuch]','verifyAdditionalPhones','additional','callAdditionalPhoneAfterMin','dialGlobalMaxRetry','cloneAction','Global','[callProgressDetectingCustomer][logNoSuchGlobal]','dialNoSuchNumberMaxRetry','rescheduleContact','scheduledAt','dialNoSuchNumberRetryFrequency','unlockAgent','activeContact','actioncountonusuch','incrementPreviewCounters','idContact','ANSWER','responsetime','answertime','[syncHangup][talking][increment]','uniqueid','\x20Queue','custom:agentconnect','acw','mandatoryDisposition','custom:agentcomplete','buildObj','complete','outboundAnswerCallsDay','total','answered','[16]','crateCustomerReportQueue','sumDuration','sumBillable','[syncHangup][talking][decrement]','BUSY','outboundBusyCallsDay','countbusyretry','Busy','custom:agentbusy','busy','[callProgressDetectingCustomer][logBusy]','[callProgressDetectingCustomer][logBusyGlobal]','dialBusyMaxRetry','dialBusyRetryFrequency','swapAdditionalPhones','NOANSWER','outboundNoAnswerCallsDay','countglobal','NoAnswer','dialNoAnswerRetryFrequency','buildNoAnswerEventPayload','custom:agentnoanswer','[callProgressDetectingCustomer][logNoAnswerGlobal]','countnoanswerretry','dialNoAnswerMaxRetry','[callProgressDetectingCustomer][logNoAnswer]','outboundCongestionCallsDay','Congestion','dialCongestionRetryFrequency','custom:agentcongestion','congestion','[callProgressDetectingCustomer][logCongestion]','[callProgressDetectingCustomer][logCongestionGlobal]','dialCongestionMaxRetry','countcongestionretry','CANCEL','AgentReject','dialAgentRejectRetryFrequency','custom:agentreject','agentreject','[syncHangupRequest][logAgentReject]','[callProgressDetectingCustomer][logAgentReject]','dialAgentRejectMaxRetry','ABANDONED','outboundAbandonedCallsDay','Abandoned','[callProgressDetectingCustomer][logAbandoned]','countabandonedetry','countabandonedretry','dialAbandonedRetryFrequency','outboundUnknownCallsDay','cause-txt','dialstatus','custom:amd','amd','[callProgressDetectingCustomer][hangupInAMD]','linkedid','[callProgressDetectingCustomer][machine]','[default]','[Dialer][decrementTalking][no\x20Hangup][Preview]','[callProgressDetectingCustomer][logUnknown]','[callProgressDetectingCustomer][logUnknownGlobal]','[originated][decrement][callProgressDetectingCustomer]','destlinkedid','callProgressDetectingAgent','isUndefined','object','reason','logAgent','NoSuchNumber'];(function(_0x2438ea,_0x373659){var _0x365aeb=function(_0x522b64){while(--_0x522b64){_0x2438ea['push'](_0x2438ea['shift']());}};_0x365aeb(++_0x373659);}(_0x305a,0x1b6));var _0xa305=function(_0x59f591,_0x35c178){_0x59f591=_0x59f591-0x0;var _0x37aad3=_0x305a[_0x59f591];return _0x37aad3;};'use strict';var util=require(_0xa305('0x0'));var _=require(_0xa305('0x1'));var uuid=require(_0xa305('0x2'));var moment=require('moment');var Redis=require('ioredis');var config=require(_0xa305('0x3'));var logger=require(_0xa305('0x4'))('preview');var loggerAction=require(_0xa305('0x4'))(_0xa305('0x5'));var ami=require(_0xa305('0x6'));var rpcDb=require(_0xa305('0x7'));var cmHopperAdditionalPhone=require(_0xa305('0x8'));var Action=require(_0xa305('0x9'));var ut=require(_0xa305('0xa'));var utils=require('../dialer/utils');config[_0xa305('0xb')]=_[_0xa305('0xc')](config[_0xa305('0xb')],{'host':_0xa305('0xd'),'port':0x18eb});var io=require(_0xa305('0xe'))(new Redis(config[_0xa305('0xb')]));var Sequence=function(){};Sequence[_0xa305('0xf')][_0xa305('0x10')]=function(_0x310917){this[_0xa305('0x11')]=this[_0xa305('0x11')]?this[_0xa305('0x11')][_0xa305('0x12')](_0x310917):_0x310917();};function Preview(_0x1fce65){this[_0xa305('0x13')]=new Sequence();this[_0xa305('0x14')]=_0x1fce65[_0xa305('0x15')];this['trunks']=_0x1fce65[_0xa305('0x16')];this['actions']={};this[_0xa305('0x17')]=_0x1fce65[_0xa305('0x17')];this[_0xa305('0x18')]=0x0;ami['on'](_0xa305('0x19'),this[_0xa305('0x1a')][_0xa305('0x1b')](this));ami['on'](_0xa305('0x1c'),this[_0xa305('0x1d')][_0xa305('0x1b')](this));ami['on'](_0xa305('0x1e'),this[_0xa305('0x1f')][_0xa305('0x1b')](this));ami['on'](_0xa305('0x20'),this['syncDialEnd']['bind'](this));ami['on']('newexten',this['syncNewExten'][_0xa305('0x1b')](this));ami['on'](_0xa305('0x21'),this['syncVarSet']['bind'](this));ami['on'](_0xa305('0x22'),this[_0xa305('0x23')][_0xa305('0x1b')](this));ami['on'](_0xa305('0x24'),this[_0xa305('0x25')][_0xa305('0x1b')](this));this[_0xa305('0x26')](this[_0xa305('0x14')]);}function emit(_0x58fcf4,_0x507b75,_0xfd863e){io['to'](_0x58fcf4)[_0xa305('0x27')](_0x507b75,_0xfd863e);}function emitVoiceQueueChannelRemove(_0x53eb62){logger['info'](_0xa305('0x28'),JSON[_0xa305('0x29')](_0x53eb62));emit(util[_0xa305('0x2a')](_0xa305('0x2b'),_0x53eb62[_0xa305('0x2c')]),_0xa305('0x2d'),_0x53eb62);io[_0xa305('0x27')](_0xa305('0x2e'),_0x53eb62);}function notSendMessagesQueue(_0x17e11d){if(_0x17e11d[_0xa305('0x2f')]){if(_0x17e11d['originated']===0x0&&_0x17e11d['pTalking']===0x0){_0x17e11d['sendMessageOneNotActive']=![];_0x17e11d[_0xa305('0x30')]=0x0;_0x17e11d[_0xa305('0x31')]=0x0;_0x17e11d[_0xa305('0x32')]=utils[_0xa305('0x33')][_0xa305('0x34')];ut[_0xa305('0x35')]('[CampaignPreview]\x20Campaign\x20Queue:\x20',_0x17e11d[_0xa305('0x2c')]+_0xa305('0x36'));}else{_0x17e11d[_0xa305('0x32')]=utils[_0xa305('0x33')][_0xa305('0x37')];ut[_0xa305('0x35')](_0xa305('0x38'),_0x17e11d[_0xa305('0x2c')]+_0xa305('0x39'));}}}Preview['prototype'][_0xa305('0x26')]=function(){var _0x25f018=this;setInterval(function(){_0x25f018[_0xa305('0x3a')]();},0x7cf);};Preview[_0xa305('0xf')][_0xa305('0x3a')]=function(){var _0x3338da=this[_0xa305('0x14')];this['clockClearZombieChannels']+=0x1;for(var _0x58381f in _0x3338da){if(_0x3338da[_0xa305('0x3b')](_0x58381f)&&(_0x3338da[_0x58381f][_0xa305('0x3c')]===_0xa305('0x3d')||_0x3338da[_0x58381f][_0xa305('0x3c')]==='booked')&&_0x3338da[_0x58381f][_0xa305('0x3e')]==='outbound'){if(this[_0xa305('0x18')]>0x7){this['clockClearZombieChannels']=0x0;this['clearZombieChannels']();}}if(_0x3338da[_0xa305('0x3b')](_0x58381f)&&_0x3338da[_0x58381f][_0xa305('0x3c')]===_0xa305('0x3d')&&_0x3338da[_0x58381f][_0xa305('0x3e')]===_0xa305('0x3f')){if(_0x3338da[_0x58381f][_0xa305('0x40')]){this[_0xa305('0x41')](_0x3338da[_0x58381f]);if(_0x3338da[_0x58381f][_0xa305('0x42')])this['recallMe'](_0x3338da[_0x58381f]);}else{notSendMessagesQueue(_0x3338da[_0x58381f]);}}}};Preview[_0xa305('0xf')]['clearZombieChannel']=function(_0x4ddf66){var _0x417946=this;this['sequence'][_0xa305('0x10')](function(){if(!_['isNil'](_0x417946['actions'][_0x4ddf66])){loggerAction[_0xa305('0x43')](_0xa305('0x44'),_0x4ddf66,'Queue',_0x417946[_0xa305('0x45')][_0x4ddf66][_0xa305('0x46')],_0xa305('0x47'),JSON[_0xa305('0x29')](_0x417946['campaignsPreview'][_0x417946[_0xa305('0x45')][_0x4ddf66][_0xa305('0x46')]][_0xa305('0x48')]),_0xa305('0x49'),JSON[_0xa305('0x29')](_0x417946['campaignsPreview'][_0x417946[_0xa305('0x45')][_0x4ddf66]['queue']][_0xa305('0x4a')]),JSON[_0xa305('0x29')](_0x417946[_0xa305('0x45')][_0x4ddf66][_0xa305('0x4b')]),JSON[_0xa305('0x29')](_[_0xa305('0x4c')](_0x417946[_0xa305('0x45')][_0x4ddf66],[_0xa305('0x4d'),_0xa305('0x4e'),_0xa305('0x4f'),_0xa305('0x50')])));return ami[_0xa305('0x51')]({'action':_0xa305('0x52'),'channel':_0x417946[_0xa305('0x45')][_0x4ddf66][_0xa305('0x53')]})[_0xa305('0x54')](function(_0x506c36){if(_0x506c36[_0xa305('0x32')]===_0xa305('0x55')){setTimeout(function(){if(_0x417946[_0xa305('0x45')][_0x4ddf66]){utils[_0xa305('0x56')](_0x417946[_0xa305('0x14')][_0x417946[_0xa305('0x45')][_0x4ddf66][_0xa305('0x46')]],_0xa305('0x57'));if(_0x417946[_0xa305('0x45')][_0x4ddf66][_0xa305('0x4b')]===!![]){ut[_0xa305('0x58')](_0x417946['campaignsPreview'][_0x417946[_0xa305('0x45')][_0x4ddf66][_0xa305('0x46')]],'[clearZombieChannel]');ut[_0xa305('0x59')](_0xa305('0x5a')+_0x4ddf66,_0x417946[_0xa305('0x45')][_0x4ddf66][_0xa305('0x46')]);}ut['loggerError'](_0xa305('0x5b')+_0x4ddf66,_0x417946['actions'][_0x4ddf66][_0xa305('0x46')]);delete _0x417946[_0xa305('0x45')][_0x4ddf66];}},0x2328);}});}});};Preview[_0xa305('0xf')][_0xa305('0x5c')]=function(){var _0x19aa95=this;loggerAction['info'](_0xa305('0x5d'),_[_0xa305('0x5e')](this[_0xa305('0x45')]));for(var _0x1b2882 in this['actions']){if(_0x19aa95['actions']['hasOwnProperty'](_0x1b2882)){_0x19aa95[_0xa305('0x5f')](_0x1b2882);}}};Preview[_0xa305('0xf')][_0xa305('0x60')]=function(_0xc0f824){var _0x5dde25=this;rpcDb[_0xa305('0x61')](_0xc0f824['id'],ut[_0xa305('0x62')](this[_0xa305('0x17')]))['then'](function(_0x49b3ae){if(!_['isNil'](_0x49b3ae)){for(var _0x5259f9=0x0;_0x5259f9<_0x49b3ae[_0xa305('0x63')];_0x5259f9+=0x1){if(ut[_0xa305('0x64')](_0x49b3ae[_0x5259f9][_0xa305('0x65')])<_0xc0f824[_0xa305('0x66')]*0x3c){if(_0x49b3ae[_0x5259f9]['Agent']&&!_0x49b3ae[_0x5259f9][_0xa305('0x67')]['voicePause']){_0x5dde25[_0xa305('0x68')](_0x49b3ae[_0x5259f9]['id'])[_0xa305('0x69')](ut[_0xa305('0x6a')](_0xa305('0x6b')))[_0xa305('0x54')](ut['logger2']('[RecallMe]'));}else{rpcDb['disableContact'](_0x49b3ae[_0x5259f9]['id']);}}else{var _0x319b6e=new Action(_0x49b3ae[_0x5259f9],_0xc0f824);_0x319b6e['starttime']=moment()[_0xa305('0x2a')](_0xa305('0x6c'));_0xc0f824[_0xa305('0x6d')]+=0x1;ut[_0xa305('0x6e')](_0x319b6e,0x17,'RecallInQueue');if(_0xc0f824[_0xa305('0x6f')]){rpcDb[_0xa305('0x70')](ut['createBody'](_0x49b3ae[_0x5259f9]));rpcDb['createCustomerHistory'](_0x319b6e,_0xa305('0x71'));}else{ut[_0xa305('0x6e')](_0x319b6e,0x16,'RecallFailedTimeout');rpcDb[_0xa305('0x72')](_0x319b6e,_0xa305('0x73'));rpcDb[_0xa305('0x74')](_0x319b6e,_0xa305('0x73'));}}}}})[_0xa305('0x54')](ut[_0xa305('0x6a')]('[getContactRecallMe]'));};Preview[_0xa305('0xf')]['setMessage']=function(_0x4a5b91){_0x4a5b91[_0xa305('0x2f')]=!![];if(ut[_0xa305('0x75')](_0x4a5b91[_0xa305('0x76')])){_0x4a5b91['message']=utils[_0xa305('0x33')][_0xa305('0x77')];}else if(!ut[_0xa305('0x78')](_0x4a5b91['dialActive'])){_0x4a5b91[_0xa305('0x32')]=utils[_0xa305('0x33')][_0xa305('0x34')];}else if(!this['isTrunkReachable'](_0x4a5b91[_0xa305('0x79')])){if(!this[_0xa305('0x7a')](_0x4a5b91[_0xa305('0x7b')])){_0x4a5b91['message']=utils[_0xa305('0x33')][_0xa305('0x7c')];}else{_0x4a5b91[_0xa305('0x32')]=utils['CAMPAIGN_STATUS'][_0xa305('0x7d')];}}else{_0x4a5b91[_0xa305('0x32')]=utils[_0xa305('0x33')][_0xa305('0x7d')];}};Preview['prototype']['callProgressDetectingCustomer']=function(_0x17cf4e,_0x1c3140,_0x4efa8a){var _0x479762=this;var _0x1b5ac6=this[_0xa305('0x45')][_0x1c3140];var _0x2cf6b4=this['campaignsPreview'][_0x1b5ac6[_0xa305('0x46')]];var _0xe60212;var _0x329148=![];var _0x13c7d0=0x2;var _0xc92139=0x3;if(_0x2cf6b4){switch(_0x4efa8a){case'1':_0x2cf6b4[_0xa305('0x7e')]+=0x1;_0x1b5ac6[_0xa305('0x7f')]+=0x1;_0x1b5ac6['countglobal']=ut[_0xa305('0x80')](_0x1b5ac6);ut['logCustomer'](_0x1b5ac6,0x0,'NoSuchNumber');ami[_0xa305('0x27')](_0xa305('0x81'),ut['buildObj'](_0x1b5ac6,_0xa305('0x82')));rpcDb[_0xa305('0x72')](_0x1b5ac6,_0xa305('0x83'));_0x479762[_0xa305('0x84')](_0x1b5ac6,'0',_0x2cf6b4)[_0xa305('0x69')](function(_0x1532b3){_0x329148=_0x1532b3[_0xa305('0x85')]==0x1;_0x13c7d0=_0x2cf6b4['dialNoSuchNumberRetryFrequency'];_0xc92139=_0x2cf6b4[_0xa305('0x86')];if(!_0x329148){if(ut[_0xa305('0x80')](_0x1b5ac6)>=_0x2cf6b4[_0xa305('0x87')]){_0xe60212=ut[_0xa305('0x88')](_0x1b5ac6,0xf,_0xa305('0x89'));rpcDb[_0xa305('0x74')](_0xe60212,_0xa305('0x8a'));}else{if(_0x1b5ac6[_0xa305('0x7f')]>=_0x2cf6b4[_0xa305('0x8b')]){rpcDb['createCustomerFinal'](_0x1b5ac6,_0xa305('0x8a'));}else{rpcDb[_0xa305('0x8c')](ut[_0xa305('0x8d')](_0x1b5ac6,_0xa305('0x7f'),_0x2cf6b4[_0xa305('0x8e')]),_0x1b5ac6[_0xa305('0x8f')],_0x1b5ac6[_0xa305('0x90')]);}}delete this['actions'][_0x17cf4e['linkedid']];}else{_0x1b5ac6[_0xa305('0x7f')]++;logger[_0xa305('0x43')](_0xa305('0x91'),_0x1b5ac6[_0xa305('0x7f')]);logger[_0xa305('0x43')]('id',_0x1b5ac6['idContact']);_0x479762[_0xa305('0x92')]({'id':_0x1b5ac6[_0xa305('0x93')],'field':{'countnosuchnumberretry':_0x1b5ac6[_0xa305('0x7f')]}})['then'](function(){_0x479762['swapAdditionalPhones'](_0x1b5ac6,_0x13c7d0,_0xc92139)[_0xa305('0x69')](function(){});});}});break;case _0xa305('0x94'):var _0x8f46c8=moment()['format']('YYYY-MM-DD\x20HH:mm:ss');_0x1b5ac6[_0xa305('0x95')]=_0x8f46c8;_0x1b5ac6[_0xa305('0x96')]=_0x8f46c8;_0x1b5ac6[_0xa305('0x4b')]=!![];_0x2cf6b4['pTalking']+=0x1;logger['info'](_0xa305('0x97'),_0x1b5ac6[_0xa305('0x98')],_0xa305('0x99'),_0x2cf6b4[_0xa305('0x2c')],_0xa305('0x49'),_0x2cf6b4[_0xa305('0x4a')]);ami[_0xa305('0x27')](_0xa305('0x9a'),ut['buildObj'](_0x1b5ac6,'connect',this[_0xa305('0x14')][_0x1b5ac6[_0xa305('0x46')]]));if(_0x2cf6b4[_0xa305('0x9b')]||_0x2cf6b4[_0xa305('0x9c')]){ami[_0xa305('0x27')]('custom:agentConnectPreview',{'queue':_0x1b5ac6[_0xa305('0x46')],'interface':_0x1b5ac6['channelAgent'],'uniqueid':_0x1b5ac6['uniqueid']});}break;case'16':ami[_0xa305('0x27')](_0xa305('0x9d'),ut[_0xa305('0x9e')](_0x1b5ac6,_0xa305('0x9f'),this[_0xa305('0x14')][_0x1b5ac6['queue']]));emitVoiceQueueChannelRemove(ut[_0xa305('0x9e')](_0x1b5ac6,'complete'));_0x2cf6b4[_0xa305('0xa0')]+=0x1;_0x2cf6b4[_0xa305('0xa1')]+=0x1;_0x2cf6b4[_0xa305('0xa2')]+=0x1;ut[_0xa305('0x58')](_0x2cf6b4,_0xa305('0xa3'));_0x1b5ac6['countglobal']=ut[_0xa305('0x80')](_0x1b5ac6);ut[_0xa305('0x6e')](_0x1b5ac6,0x4,'Answer');rpcDb[_0xa305('0x72')](_0x1b5ac6,'[callProgressDetectingCustomer][logAnswer]');rpcDb[_0xa305('0x74')](_0x1b5ac6,'[callProgressDetectingCustomer][logAnswerGlobal]');rpcDb[_0xa305('0xa4')](_0x1b5ac6);_0x2cf6b4[_0xa305('0xa5')]+=_0x1b5ac6['talktime'];_0x2cf6b4[_0xa305('0xa6')]+=_0x1b5ac6['talktime'];logger[_0xa305('0x43')](_0xa305('0xa7'),_0x1b5ac6[_0xa305('0x98')],'\x20Queue',_0x2cf6b4[_0xa305('0x2c')],_0xa305('0x49'),_0x2cf6b4[_0xa305('0x4a')]);delete this['actions'][_0x17cf4e['linkedid']];break;case _0xa305('0xa8'):_0x2cf6b4[_0xa305('0xa9')]+=0x1;_0x1b5ac6[_0xa305('0xaa')]+=0x1;_0x1b5ac6['countglobal']=ut[_0xa305('0x80')](_0x1b5ac6);ut[_0xa305('0x6e')](_0x1b5ac6,0x5,_0xa305('0xab'));_0x13c7d0=_0x2cf6b4['dialBusyRetryFrequency'];_0xc92139=_0x2cf6b4[_0xa305('0x86')];ami[_0xa305('0x27')](_0xa305('0xac'),ut[_0xa305('0x9e')](_0x1b5ac6,_0xa305('0xad')));rpcDb[_0xa305('0x72')](_0x1b5ac6,_0xa305('0xae'));_0x479762[_0xa305('0x84')](_0x1b5ac6,'5',_0x2cf6b4)[_0xa305('0x69')](function(_0x8f2dd0){_0x329148=_0x8f2dd0[_0xa305('0x85')]==0x1;if(!_0x329148){if(ut['totalGlobal'](_0x1b5ac6)>=_0x2cf6b4['dialGlobalMaxRetry']){_0xe60212=ut[_0xa305('0x88')](_0x1b5ac6,0xf,'Global');rpcDb['createCustomerFinal'](_0xe60212,_0xa305('0xaf'));}else{if(_0x1b5ac6[_0xa305('0xaa')]>=_0x2cf6b4[_0xa305('0xb0')]){rpcDb[_0xa305('0x74')](_0x1b5ac6,_0xa305('0xae'));}else{rpcDb['rescheduleContact'](ut['scheduledAt'](_0x1b5ac6,_0xa305('0xaa'),_0x2cf6b4[_0xa305('0xb1')]),_0x1b5ac6[_0xa305('0x8f')],_0x1b5ac6[_0xa305('0x90')]);}}}else{_0x1b5ac6['countbusyretry']++;_0x479762[_0xa305('0x92')]({'id':_0x1b5ac6[_0xa305('0x93')],'field':{'countbusyretry':_0x1b5ac6[_0xa305('0xaa')]}})[_0xa305('0x69')](function(){_0x479762[_0xa305('0xb2')](_0x1b5ac6,_0x13c7d0,_0xc92139)[_0xa305('0x69')](function(){});});}});break;case _0xa305('0xb3'):_0x2cf6b4[_0xa305('0xb4')]+=0x1;_0x1b5ac6['countnoanswerretry']+=0x1;_0x1b5ac6[_0xa305('0xb5')]=ut['totalGlobal'](_0x1b5ac6);ut[_0xa305('0x6e')](_0x1b5ac6,0x3,_0xa305('0xb6'));_0x13c7d0=_0x2cf6b4[_0xa305('0xb7')];_0xc92139=_0x2cf6b4[_0xa305('0x86')];var _0xab696e=ut[_0xa305('0xb8')](_0x1b5ac6,_0x2cf6b4);ami[_0xa305('0x27')](_0xa305('0xb9'),_0xab696e);rpcDb[_0xa305('0x72')](_0x1b5ac6,'[callProgressDetectingCustomer][logNoAnswer]');_0x479762[_0xa305('0x84')](_0x1b5ac6,'3',_0x2cf6b4)[_0xa305('0x69')](function(_0x43f13e){_0x329148=_0x43f13e['additional']==0x1;if(!_0x329148){if(ut['totalGlobal'](_0x1b5ac6)>=_0x2cf6b4[_0xa305('0x87')]){_0xe60212=ut[_0xa305('0x88')](_0x1b5ac6,0xf,'Global');rpcDb[_0xa305('0x74')](_0xe60212,_0xa305('0xba'));}else{if(_0x1b5ac6[_0xa305('0xbb')]>=_0x2cf6b4[_0xa305('0xbc')]){rpcDb[_0xa305('0x74')](_0x1b5ac6,_0xa305('0xbd'));}else{rpcDb['rescheduleContact'](ut['scheduledAt'](_0x1b5ac6,_0xa305('0xbb'),_0x2cf6b4[_0xa305('0xb7')]),_0x1b5ac6[_0xa305('0x8f')],_0x1b5ac6[_0xa305('0x90')]);}}}else{_0x1b5ac6[_0xa305('0xbb')]++;_0x479762[_0xa305('0x92')]({'id':_0x1b5ac6[_0xa305('0x93')],'field':{'countnoanswerretry':_0x1b5ac6[_0xa305('0xbb')]}})[_0xa305('0x69')](function(){_0x479762['swapAdditionalPhones'](_0x1b5ac6,_0x13c7d0,_0xc92139)['then'](function(){});});}});break;case'CONGESTION':_0x2cf6b4[_0xa305('0xbe')]+=0x1;_0x1b5ac6['countcongestionretry']+=0x1;_0x1b5ac6[_0xa305('0xb5')]=ut[_0xa305('0x80')](_0x1b5ac6);ut['logCustomer'](_0x1b5ac6,0x8,_0xa305('0xbf'));_0x13c7d0=_0x2cf6b4[_0xa305('0xc0')];_0xc92139=_0x2cf6b4[_0xa305('0x86')];ami['emit'](_0xa305('0xc1'),ut[_0xa305('0x9e')](_0x1b5ac6,_0xa305('0xc2')));rpcDb['createCustomerHistory'](_0x1b5ac6,_0xa305('0xc3'));_0x479762[_0xa305('0x84')](_0x1b5ac6,'8',_0x2cf6b4)[_0xa305('0x69')](function(_0x474a19){_0x329148=_0x474a19[_0xa305('0x85')]==0x1;if(!_0x329148){if(ut['totalGlobal'](_0x1b5ac6)>=_0x2cf6b4['dialGlobalMaxRetry']){_0xe60212=ut[_0xa305('0x88')](_0x1b5ac6,0xf,_0xa305('0x89'));rpcDb[_0xa305('0x74')](_0xe60212,_0xa305('0xc4'));}else{if(_0x1b5ac6['countcongestionretry']>=_0x2cf6b4[_0xa305('0xc5')]){rpcDb[_0xa305('0x74')](_0x1b5ac6,'[callProgressDetectingCustomer][logCongestion]');}else{rpcDb[_0xa305('0x8c')](ut[_0xa305('0x8d')](_0x1b5ac6,_0xa305('0xc6'),_0x2cf6b4['dialBusyRetryFrequency']),_0x1b5ac6[_0xa305('0x8f')],_0x1b5ac6[_0xa305('0x90')]);}}}else{_0x1b5ac6['countcongestionretry']++;_0x479762[_0xa305('0x92')]({'id':_0x1b5ac6[_0xa305('0x93')],'field':{'countcongestionretry':_0x1b5ac6[_0xa305('0xc6')]}})[_0xa305('0x69')](function(){_0x479762[_0xa305('0xb2')](_0x1b5ac6,_0x13c7d0,_0xc92139)[_0xa305('0x69')](function(){});});}});break;case _0xa305('0xc7'):_0x2cf6b4['outboundRejectCallsDay']+=0x1;_0x1b5ac6['countagentrejectretry']+=0x1;_0x1b5ac6[_0xa305('0xb5')]=ut[_0xa305('0x80')](_0x1b5ac6);ut[_0xa305('0x6e')](_0x1b5ac6,0x14,_0xa305('0xc8'));_0x13c7d0=_0x2cf6b4[_0xa305('0xc9')];_0xc92139=_0x2cf6b4[_0xa305('0x86')];ami[_0xa305('0x27')](_0xa305('0xca'),ut['buildObj'](_0x1b5ac6,_0xa305('0xcb')));rpcDb['createCustomerHistory'](_0x1b5ac6,_0xa305('0xcc'));_0x479762['verifyAdditionalPhones'](_0x1b5ac6,'20',_0x2cf6b4)['then'](function(_0x4fd951){_0x329148=_0x4fd951['additional']==0x1;if(!_0x329148){if(ut[_0xa305('0x80')](_0x1b5ac6)>=_0x2cf6b4['dialGlobalMaxRetry']){_0xe60212=ut[_0xa305('0x88')](_0x1b5ac6,0x14,_0xa305('0xc8'));rpcDb['createCustomerFinal'](_0xe60212,_0xa305('0xcd'));}else{if(_0x1b5ac6['countagentrejectretry']>=_0x2cf6b4[_0xa305('0xce')]){rpcDb[_0xa305('0x74')](_0x1b5ac6,_0xa305('0xcd'));}else{rpcDb['rescheduleContact'](ut[_0xa305('0x8d')](_0x1b5ac6,'countagentrejectretry',_0x2cf6b4[_0xa305('0xc9')]),_0x1b5ac6['unlockAgent'],_0x1b5ac6[_0xa305('0x90')]);}}}else{_0x1b5ac6[_0xa305('0xbb')]++;_0x479762[_0xa305('0x92')]({'id':_0x1b5ac6['idContact'],'field':{'countnoanswerretry':_0x1b5ac6[_0xa305('0xbb')]}})[_0xa305('0x69')](function(){_0x479762[_0xa305('0xb2')](_0x1b5ac6,_0x13c7d0,_0xc92139)['then'](function(){});});}});break;case _0xa305('0xcf'):_0x2cf6b4[_0xa305('0xd0')]+=0x1;_0x1b5ac6['countabandonedretry']+=0x1;_0x1b5ac6[_0xa305('0xb5')]=ut[_0xa305('0x80')](_0x1b5ac6);ut[_0xa305('0x6e')](_0x1b5ac6,0xb,_0xa305('0xd1'));rpcDb[_0xa305('0x72')](_0x1b5ac6,_0xa305('0xd2'));_0x479762['verifyAdditionalPhones'](_0x1b5ac6,'11',_0x2cf6b4)[_0xa305('0x69')](function(_0x1181eb){_0x329148=_0x1181eb['additional']==0x1;if(!_0x329148){if(ut[_0xa305('0x80')](_0x1b5ac6)>=_0x2cf6b4[_0xa305('0x87')]){_0xe60212=ut[_0xa305('0x88')](_0x1b5ac6,0xf,'Global');rpcDb[_0xa305('0x74')](_0xe60212,'[callProgressDetectingCustomer][logAbandoned]');}else{if(_0x1b5ac6[_0xa305('0xd3')]>=_0x2cf6b4['dialAbandonedMaxRety']){rpcDb[_0xa305('0x74')](_0x1b5ac6,_0xa305('0xd2'));}else{rpcDb[_0xa305('0x8c')](ut[_0xa305('0x8d')](_0x1b5ac6,_0xa305('0xd4'),_0x2cf6b4[_0xa305('0xd5')]),_0x1b5ac6['unlockAgent'],_0x1b5ac6[_0xa305('0x90')]);}}}else{_0x1b5ac6['countnoanswerretry']++;_0x479762['incrementPreviewCounters']({'id':_0x1b5ac6['idContact'],'field':{'countnoanswerretry':_0x1b5ac6[_0xa305('0xbb')]}})[_0xa305('0x69')](function(){_0x479762[_0xa305('0xb2')](_0x1b5ac6,_0x13c7d0,_0xc92139)[_0xa305('0x69')](function(){});});}});break;case'18':_0x2cf6b4[_0xa305('0xd6')]+=0x1;_0x1b5ac6['countmachineretry']+=0x1;_0x1b5ac6['countglobal']=ut[_0xa305('0x80')](_0x1b5ac6);ut[_0xa305('0x6e')](_0x1b5ac6,0x12,_0x17cf4e[_0xa305('0xd7')]||_0x17cf4e[_0xa305('0xd8')]);ami[_0xa305('0x27')](_0xa305('0xd9'),ut[_0xa305('0x9e')](_0x1b5ac6,_0xa305('0xda')));rpcDb['createCustomerHistory'](_0x1b5ac6,_0xa305('0xdb'));_0x479762[_0xa305('0x84')](_0x1b5ac6,'18',_0x2cf6b4)['then'](function(_0x31e4d1){_0x329148=_0x31e4d1[_0xa305('0x85')]==0x1;if(!_0x329148){if(ut['totalGlobal'](_0x1b5ac6)>=_0x2cf6b4[_0xa305('0x87')]){_0xe60212=ut['cloneAction'](_0x1b5ac6,0x12,_0xa305('0x89'));rpcDb[_0xa305('0x74')](_0xe60212,_0xa305('0xdb'));}else{rpcDb[_0xa305('0x74')](_0x1b5ac6,'[callProgressDetectingCustomer][hangupInAMD]');}}else{_0x1b5ac6[_0xa305('0xbb')]++;_0x479762['incrementPreviewCounters']({'id':_0x1b5ac6['idContact'],'field':{'countnoanswerretry':_0x1b5ac6[_0xa305('0xbb')]}})['then'](function(){_0x479762[_0xa305('0xb2')](_0x1b5ac6,_0x13c7d0,_0xc92139)[_0xa305('0x69')](function(){});});}});delete this[_0xa305('0x45')][_0x17cf4e[_0xa305('0xdc')]];break;case'19':_0x2cf6b4[_0xa305('0xd6')]+=0x1;_0x1b5ac6[_0xa305('0xb5')]=ut[_0xa305('0x80')](_0x1b5ac6);ut['logCustomer'](_0x1b5ac6,0x13,_0x17cf4e['cause-txt']||_0x17cf4e[_0xa305('0xd8')]);ami['emit']('custom:amd',ut[_0xa305('0x9e')](_0x1b5ac6,'amd'));rpcDb[_0xa305('0x72')](_0x1b5ac6,_0xa305('0xdd'));_0x479762['verifyAdditionalPhones'](_0x1b5ac6,'18',_0x2cf6b4)[_0xa305('0x69')](function(_0x130606){_0x329148=_0x130606[_0xa305('0x85')]==0x1;if(!_0x329148){if(ut[_0xa305('0x80')](_0x1b5ac6)>=_0x2cf6b4[_0xa305('0x87')]){_0xe60212=ut[_0xa305('0x88')](_0x1b5ac6,0xf,_0xa305('0x89'));rpcDb[_0xa305('0x74')](_0xe60212,_0xa305('0xdd'));}else{rpcDb[_0xa305('0x74')](_0x1b5ac6,_0xa305('0xdd'));}}else{_0x1b5ac6[_0xa305('0xbb')]++;_0x479762[_0xa305('0x92')]({'id':_0x1b5ac6[_0xa305('0x93')],'field':{'countnoanswerretry':_0x1b5ac6[_0xa305('0xbb')]}})[_0xa305('0x69')](function(){_0x479762[_0xa305('0xb2')](_0x1b5ac6,_0x13c7d0,_0xc92139)[_0xa305('0x69')](function(){});});}});delete this[_0xa305('0x45')][_0x17cf4e['linkedid']];break;default:if(_0x1b5ac6['dialAnswer']){ut['decrementTalking'](_0x2cf6b4,_0xa305('0xde'));ut[_0xa305('0x59')](_0xa305('0xdf')+_0x2cf6b4[_0xa305('0x2c')],_0x17cf4e);}_0x2cf6b4[_0xa305('0xd6')]+=0x1;_0x1b5ac6[_0xa305('0xb5')]=ut[_0xa305('0x80')](_0x1b5ac6);ut[_0xa305('0x6e')](_0x1b5ac6,0xc,_0x17cf4e[_0xa305('0xd7')]||_0x17cf4e['dialstatus']);_0x13c7d0=_0x2cf6b4[_0xa305('0xc9')];_0xc92139=_0x2cf6b4['callAdditionalPhoneAfterMin'];rpcDb[_0xa305('0x72')](_0x1b5ac6,_0xa305('0xe0'));_0x479762[_0xa305('0x84')](_0x1b5ac6,'20',_0x2cf6b4)[_0xa305('0x69')](function(_0xf7b0f3){_0x329148=_0xf7b0f3[_0xa305('0x85')]==0x1;if(!_0x329148){if(ut['totalGlobal'](_0x1b5ac6)>=_0x2cf6b4[_0xa305('0x87')]){_0xe60212=ut['cloneAction'](_0x1b5ac6,0xf,'Global');rpcDb[_0xa305('0x74')](_0xe60212,'[callProgressDetectingCustomer][logUnknownGlobal]');}else{rpcDb[_0xa305('0x74')](_0x1b5ac6,_0xa305('0xe1'));}delete this[_0xa305('0x45')][_0x17cf4e[_0xa305('0xdc')]];}else{_0x479762['swapAdditionalPhones'](_0x1b5ac6,_0x13c7d0,_0xc92139)[_0xa305('0x69')](function(){});}});}if(!(_0x1b5ac6['dialAnswer']&&_0x4efa8a==='16')){utils[_0xa305('0x56')](_0x2cf6b4,'[callProgressDetectingCustomer]');logger[_0xa305('0x43')](_0xa305('0xe2'),_0x1b5ac6[_0xa305('0x98')],'\x20Queue',_0x2cf6b4[_0xa305('0x2c')],_0xa305('0x47'),_0x2cf6b4[_0xa305('0x48')]);}if(_0x4efa8a!==_0xa305('0x94')){delete this['actions'][_0x17cf4e[_0xa305('0xdc')]];delete this['actions'][_0x17cf4e[_0xa305('0xe3')]];}_0x2cf6b4['queueSummaryCountersUpdated']=!![];}};Preview['prototype'][_0xa305('0xe4')]=function(_0x175c96,_0x786c73,_0x3e628f){if(_[_0xa305('0xe5')](_0x786c73)&&_0xa305('0xe6')!==typeof _0x786c73){return;}if(_[_0xa305('0xe5')](_0x3e628f)&&_0xa305('0xe6')!==typeof _0x3e628f){return;}switch(_0x3e628f[_0xa305('0xe7')]){case'0':ut[_0xa305('0xe8')](_0x175c96,0x0,_0xa305('0xe9'));rpcDb[_0xa305('0xea')](_0x175c96,_0xa305('0xeb'));break;case'3':ut['logAgent'](_0x175c96,0x3,'NoAnswer');rpcDb[_0xa305('0xea')](_0x175c96,'[callProgressDetectingAgent][logNoAnswer]');break;case'5':ut[_0xa305('0xe8')](_0x175c96,0x5,_0xa305('0xab'));rpcDb['createAgentHistory'](_0x175c96,'[callProgressDetectingAgent][logBusy]');break;case'8':ut['logAgent'](_0x175c96,0x8,_0xa305('0xbf'));rpcDb[_0xa305('0xea')](_0x175c96,'[callProgressDetectingAgent][logCongestion]');break;case'22':ut[_0xa305('0xe8')](_0x175c96,0x16,'AnswerAGI');rpcDb['createAgentHistory'](_0x175c96,_0xa305('0xec'));break;default:ut['logAgent'](_0x175c96,0xc,_0x3e628f[_0xa305('0xe7')]);rpcDb[_0xa305('0xea')](_0x175c96,_0xa305('0xed'));}utils['decrementOriginate'](_0x786c73,_0xa305('0xee'));logger[_0xa305('0x43')](_0xa305('0xef'),_0x175c96[_0xa305('0x98')],_0xa305('0x99'),_0x786c73['name'],_0xa305('0x47'),_0x786c73[_0xa305('0x48')]);delete this['actions'][_0x175c96[_0xa305('0x98')]];};Preview[_0xa305('0xf')]['verifyAdditionalPhones']=function(_0x1d4c3c,_0x32f28a,_0xfa0cb2){return cmHopperAdditionalPhone[_0xa305('0x84')](_0x1d4c3c,_0x32f28a,_0xfa0cb2)[_0xa305('0x54')](logger[_0xa305('0x43')](_0xa305('0xf0')));};Preview[_0xa305('0xf')][_0xa305('0xb2')]=function(_0x4fe0b3,_0x5a67d8,_0x2e76fa){return cmHopperAdditionalPhone['swapAdditionalPhones'](_0x4fe0b3,_0x5a67d8,_0x2e76fa)[_0xa305('0x54')](logger[_0xa305('0x43')](_0xa305('0xf1')));};Preview[_0xa305('0xf')][_0xa305('0x92')]=function(_0x5b00d4){return Promise['resolve']()[_0xa305('0x69')](cmHopperAdditionalPhone[_0xa305('0x92')](_0x5b00d4))['catch'](logger[_0xa305('0x43')](_0xa305('0xf2')));};Preview['prototype'][_0xa305('0xf3')]=function(_0x313a00,_0x58a990,_0x514489,_0x164b36,_0xffe2c9){var _0x12ac69=this;return new Promise(function(_0x7f5abb,_0x182e26){if(_[_0xa305('0xf4')](_0x58a990)||_[_0xa305('0xf4')](_0x58a990['Contact'])||_[_0xa305('0xf4')](_0x58a990['phone'])||_[_0xa305('0xf4')](_0x58a990[_0xa305('0x4f')])){_0x182e26(ut[_0xa305('0x32')](_0xa305('0xf5'),_0x164b36,_0xffe2c9));return;}var _0x1c8bf8=uuid['v4']();var _0x403940=_0x12ac69['campaignsPreview'][_0x58a990['Queue'][_0xa305('0x2c')]];var _0x1846c7=_0x514489?_0x12ac69[_0xa305('0x17')][_0x514489]['id']:undefined;_0x12ac69[_0xa305('0x45')][_0x1c8bf8]=new Action(_0x58a990,_0x403940,_0x1c8bf8,_0x514489,_0x1846c7);var _0xd83227=_0x12ac69[_0xa305('0x45')][_0x1c8bf8];_0xd83227[_0xa305('0x8f')]=_0x164b36;_0xd83227[_0xa305('0x90')]=_0xffe2c9;_0xd83227['lookAgent']=_0x514489;if(_[_0xa305('0xf6')](_0x313a00)){_0x12ac69[_0xa305('0xf7')](_0xd83227,_0x403940,_0x58a990,_0x514489)['then'](function(_0x1d2c55){logger[_0xa305('0x43')](_0xa305('0xf8'),'Queue:\x20'+_0xd83227[_0xa305('0x46')]+_0xa305('0xf9')+_0xd83227[_0xa305('0x93')],JSON[_0xa305('0x29')](_0x1d2c55));ami[_0xa305('0x27')]('custom:agentcalled',ut['buildObj'](_0xd83227,_0xa305('0xfa'),_0x12ac69[_0xa305('0x14')][_0xd83227['queue']]));_0x7f5abb(ut[_0xa305('0x32')](_0xa305('0xfb')));})[_0xa305('0x54')](function(_0x780185){ut[_0xa305('0x35')](_0xa305('0xfc'),_0x780185);_0x182e26(ut[_0xa305('0x32')]('Call\x20failed',_0x164b36,_0xffe2c9));});}else{_0x403940[_0xa305('0xfd')]+=0x1;ut['logBlacklist'](_0xd83227);rpcDb[_0xa305('0xfe')](_0xd83227,'[Blacklist][error]');delete _0x12ac69[_0xa305('0x45')][_0x1c8bf8];_0x182e26(ut[_0xa305('0x32')](_0xa305('0xff'),_0x164b36,_0xffe2c9));}});};Preview[_0xa305('0xf')][_0xa305('0x7a')]=function(_0x231070){return!_[_0xa305('0xf4')](_0x231070)&&!_[_0xa305('0xf4')](_0x231070[_0xa305('0x2c')])&&!_[_0xa305('0xf4')](_0x231070['active'])&&_0x231070['active']&&!_[_0xa305('0xf4')](this['trunks'][util['format'](_0xa305('0x100'),_0x231070[_0xa305('0x2c')])])&&!_[_0xa305('0xf4')](this['trunks'][util[_0xa305('0x2a')](_0xa305('0x100'),_0x231070[_0xa305('0x2c')])][_0xa305('0x52')])&&(this[_0xa305('0x16')][util[_0xa305('0x2a')](_0xa305('0x100'),_0x231070[_0xa305('0x2c')])][_0xa305('0x52')]===_0xa305('0x101')||this[_0xa305('0x16')][util[_0xa305('0x2a')](_0xa305('0x100'),_0x231070[_0xa305('0x2c')])][_0xa305('0x52')]===_0xa305('0x102'));};Preview[_0xa305('0xf')][_0xa305('0x68')]=function(_0x3b7702,_0x4c8b98){return this[_0xa305('0x103')](_0x3b7702,_0x4c8b98)[_0xa305('0x69')](function(_0x4e2646){return _['pick'](_0x4e2646,[_0xa305('0x32')]);})[_0xa305('0x54')](function(_0x5196e7){if(_0x5196e7[_0xa305('0x104')]){rpcDb[_0xa305('0x105')](_0x3b7702);}if(_0x5196e7['active']){rpcDb[_0xa305('0x106')](_0x3b7702);}throw _['pick'](_0x5196e7,[_0xa305('0x32')]);});};Preview['prototype'][_0xa305('0x103')]=function(_0x50dff7,_0x276c6b){var _0x3e85c3=this;var _0x586ce4,_0x58c92a;return rpcDb['getContactPreview'](_0x50dff7)[_0xa305('0x69')](function(_0x3b778c){if(!_[_0xa305('0xf4')](_0x3b778c[0x0])){_0x58c92a=_0x3b778c[0x0][_0xa305('0x107')]?![]:!![];_0x586ce4=_0x3b778c[0x0][_0xa305('0x107')]?!![]:![];_0x586ce4=_0x276c6b?!![]:_0x586ce4;}var _0x4fd06f=_0x3e85c3[_0xa305('0x108')](_0x3b778c);if(_0x4fd06f[_0xa305('0x109')]){rpcDb[_0xa305('0x10a')](_[_0xa305('0x4c')](_0x3b778c[0x0],[_0xa305('0x4f'),_0xa305('0x10b')]))[_0xa305('0x69')](function(_0x31b55c){_0x3e85c3[_0xa305('0xf3')](_0x31b55c,_0x3b778c[0x0],_0x276c6b,_0x58c92a,_0x586ce4)[_0xa305('0x69')](function(_0x1e278b){return _0x1e278b;})[_0xa305('0x54')](function(_0x5de139){throw _0x5de139;});})['catch'](function(_0x47360b){ut['logger'](_0xa305('0x10c'),_0x47360b);throw ut[_0xa305('0x32')](_0xa305('0x10d'),_0x58c92a,_0x586ce4);});}else{throw ut['message'](_0x4fd06f[_0xa305('0x32')],_0x58c92a,_0x586ce4);}})[_0xa305('0x54')](function(_0x4f3a88){ut['logger'](_0xa305('0x10e'),_0x4f3a88);throw ut['message'](_0xa305('0x10d'),![],!![]);});};Preview[_0xa305('0xf')]['validateContact']=function(_0x18a3f7){if(_[_0xa305('0xf4')](_0x18a3f7)||_[_0xa305('0xf6')](_0x18a3f7)||!_[_0xa305('0xf4')](_0x18a3f7[0x0]['Agent'])&&_['isNil'](_0x18a3f7[0x0][_0xa305('0x67')][_0xa305('0x2c')])){ut['logger'](_0xa305('0x10f'),_0x18a3f7);return{'isValid':![],'message':_0xa305('0x110')};}var _0x48755f=this[_0xa305('0x14')][_0x18a3f7[0x0][_0xa305('0x111')][_0xa305('0x2c')]];_0x48755f[_0xa305('0x32')]=utils[_0xa305('0x33')]['ACTIVE'];if(_[_0xa305('0xf4')](_0x48755f)){ut[_0xa305('0x35')](_0xa305('0x112'),_0x48755f);return{'isValid':![],'message':_0xa305('0x113')};}if(!this['isTrunkReachable'](_0x48755f[_0xa305('0x79')])){ut[_0xa305('0x35')](_0xa305('0x114'),'campaign\x20Name:\x20'+_0x48755f[_0xa305('0x2c')]+_0xa305('0x115'));if(!this[_0xa305('0x7a')](_0x48755f[_0xa305('0x7b')])){ut['logger'](_0xa305('0x114'),_0x48755f[_0xa305('0x2c')]+_0xa305('0x116'));return{'isValid':![],'message':'Trunk\x20not\x20working\x20correctly'};}}if(!ut['isActive'](_0x48755f[_0xa305('0x40')])){ut[_0xa305('0x35')](_0xa305('0x117'),_0x48755f[_0xa305('0x2c')]+_0xa305('0x118'));return{'isValid':![],'message':_0xa305('0x119')+_0x48755f['name']+_0xa305('0x118')};}return{'isValid':!![],'message':_0xa305('0x11a')};};Preview[_0xa305('0xf')][_0xa305('0xf7')]=function(_0x26554b,_0x3c6fe1,_0x140534,_0x3f8faa){var _0x5858c5=this;return new Promise(function(_0x58e48f,_0x49b041){var _0x40d2ee=_0x26554b['uniqueid'];var _0x5d2a25=_0x5858c5[_0xa305('0x7a')](_0x3c6fe1[_0xa305('0x79')])?util['format'](_0xa305('0x11b'),_0x3c6fe1[_0xa305('0x79')][_0xa305('0x2c')],_[_0xa305('0xf4')](_0x3c6fe1[_0xa305('0x11c')])?'':_0x3c6fe1[_0xa305('0x11c')][_0xa305('0x11d')]()||'',_0x3c6fe1['dialCutDigit']>0x0?_0x140534[_0xa305('0x10b')]['substring'](_0x3c6fe1['dialCutDigit']):_0x140534[_0xa305('0x10b')]):util['format'](_0xa305('0x11b'),_['isNil'](_0x3c6fe1['TrunkBackup'])?_0x3c6fe1['Trunk'][_0xa305('0x2c')]:_0x3c6fe1[_0xa305('0x7b')][_0xa305('0x2c')],_[_0xa305('0xf4')](_0x3c6fe1['dialPrefix'])?'':_0x3c6fe1[_0xa305('0x11c')]['trim']()||'',_0x3c6fe1[_0xa305('0x11e')]>0x0?_0x140534[_0xa305('0x10b')][_0xa305('0x11f')](_0x3c6fe1[_0xa305('0x11e')]):_0x140534['phone']);var _0x48a2fc=_0x5858c5[_0xa305('0x7a')](_0x3c6fe1[_0xa305('0x79')])?ut['getCallerId'](_0x3c6fe1[_0xa305('0x79')][_0xa305('0x120')],_0x3c6fe1[_0xa305('0x121')],_0x3c6fe1[_0xa305('0x122')]>0x0?ut[_0xa305('0x123')](_0x3c6fe1[_0xa305('0x124')],_0x3c6fe1['dialRandomLastDigitCallerIdNumber']):_0x3c6fe1[_0xa305('0x124')]):ut[_0xa305('0x125')](_[_0xa305('0xf4')](_0x3c6fe1['TrunkBackup'])?_0x3c6fe1[_0xa305('0x79')]['callerid']:_0x3c6fe1[_0xa305('0x7b')][_0xa305('0x120')],_0x3c6fe1[_0xa305('0x121')],_0x3c6fe1['dialRandomLastDigitCallerIdNumber']>0x0?ut['getCallerIdRandom'](_0x3c6fe1[_0xa305('0x124')],_0x3c6fe1[_0xa305('0x122')]):_0x3c6fe1[_0xa305('0x124')]);if(_0x48a2fc){_0x26554b['originatecalleridname']=ut[_0xa305('0x126')](_0x48a2fc);_0x26554b['originatecalleridnum']=ut[_0xa305('0x127')](_0x48a2fc);}var _0x21983e=ut[_0xa305('0x128')](_0x3c6fe1,_0x140534,_0x5d2a25,_0x48a2fc,_0x40d2ee,_0x26554b);var _0xeb7aef=utils[_0xa305('0x129')](_0x140534['Contact']);Object[_0xa305('0x12a')](_0x21983e,_0xeb7aef);_[_0xa305('0x12b')](_0x26554b,ut[_0xa305('0x12c')](_0x21983e));_0x26554b[_0xa305('0x12d')]=moment()[_0xa305('0x2a')](_0xa305('0x6c'));_0x3c6fe1[_0xa305('0x12e')]=_0x21983e;var _0x180bcd=ut[_0xa305('0x12f')](_0x26554b,_0x3c6fe1,_0x21983e,_0x26554b[_0xa305('0x90')],_0x3f8faa);return ami[_0xa305('0x51')](_0x180bcd)[_0xa305('0x69')](function(_0x1e1e0e){_0x3c6fe1['originated']+=0x1;logger[_0xa305('0x43')]('[originated][increment]',_0x40d2ee,_0xa305('0x99'),_0x3c6fe1[_0xa305('0x2c')],'originated:\x20',_0x3c6fe1['originated']);_0x58e48f(_0x1e1e0e);})[_0xa305('0x54')](function(_0x50fec3){ut[_0xa305('0xe8')](_0x26554b,0xe,_0xa305('0x130'));rpcDb[_0xa305('0xea')](_0x26554b,_0xa305('0x131'));_0x49b041(_0x50fec3);});});};Preview[_0xa305('0xf')][_0xa305('0x132')]=function(_0x481530){if(this[_0xa305('0x45')][_0x481530[_0xa305('0xdc')]]){this[_0xa305('0x45')][_0x481530[_0xa305('0xdc')]]['channel']=_0x481530[_0xa305('0x53')];}};Preview[_0xa305('0xf')][_0xa305('0x1a')]=function(_0x339657){var _0x1bb4d8=this;var _0x3bf98d=this['actions'][_0x339657[_0xa305('0x133')]];if(_0x3bf98d){if(_0x3bf98d['lookAgent']&&this[_0xa305('0x17')][_0x3bf98d[_0xa305('0x134')]]){ut[_0xa305('0x135')](_0x3bf98d,this[_0xa305('0x17')][_0x3bf98d[_0xa305('0x134')]]['name'],this[_0xa305('0x17')][_0x3bf98d[_0xa305('0x134')]]['id']);}var _0x647f6d=_[_0xa305('0x136')](_0x3bf98d);_0x647f6d[_0xa305('0x95')]=moment()[_0xa305('0x2a')](_0xa305('0x6c'));var _0x10caec=_0x1bb4d8[_0xa305('0x14')][_0x3bf98d[_0xa305('0x46')]];if(ut['isFailure'](_0x339657[_0xa305('0x137')])){if(_0x3bf98d['unlockAgent']){rpcDb[_0xa305('0x105')](_0x3bf98d[_0xa305('0x93')]);}if(_0x3bf98d[_0xa305('0x90')]){rpcDb[_0xa305('0x106')](_0x3bf98d[_0xa305('0x93')]);}ami[_0xa305('0x27')]('custom:agentringnoanswer',ut['buildObj'](_0x3bf98d,_0xa305('0x138'),this[_0xa305('0x14')][_0x3bf98d[_0xa305('0x46')]]));this[_0xa305('0xe4')](_0x647f6d,_0x10caec,_0x339657);}else{_0x3bf98d[_0xa305('0x12d')]=moment()[_0xa305('0x2a')](_0xa305('0x6c'));ut[_0xa305('0xe8')](_0x647f6d,0x4,_0xa305('0x139'));rpcDb[_0xa305('0xea')](_0x647f6d,_0xa305('0x13a'));}}};Preview['prototype'][_0xa305('0x1d')]=function(_0x1d50a5){var _0xf32fde=this['actions'][_0x1d50a5['linkedid']];var _0x379049;if(_0xf32fde){_0x379049=this[_0xa305('0x14')][_0xf32fde[_0xa305('0x46')]];logger[_0xa305('0x43')](_0xa305('0x13b'),_0x1d50a5[_0xa305('0xdc')],_0xa305('0x99'),_0x379049[_0xa305('0x2c')],_0xa305('0x49'),_0x379049[_0xa305('0x4a')]);}if(this[_0xa305('0x45')][_0x1d50a5[_0xa305('0xdc')]]&&_0x1d50a5['linkedid']!==_0x1d50a5[_0xa305('0x98')]){if(_0x1d50a5[_0xa305('0x13c')]==='16'&&this['actions'][_0x1d50a5[_0xa305('0xdc')]]['dialAnswer']){this[_0xa305('0x13d')](_0x1d50a5,_0x1d50a5['linkedid'],_0x1d50a5['cause']);}else if(this[_0xa305('0x45')][_0x1d50a5[_0xa305('0xdc')]][_0xa305('0x4b')]){logger[_0xa305('0x43')]('[syncHangup][talking][cause]',_0x1d50a5['linkedid'],_0x1d50a5[_0xa305('0x13c')],_0xa305('0x99'),_0x379049[_0xa305('0x2c')],'pTalking:\x20',_0x379049[_0xa305('0x4a')]);this['callProgressDetectingCustomer'](_0x1d50a5,_0x1d50a5[_0xa305('0xdc')],_0x1d50a5[_0xa305('0x13c')]);}}else if(_0xf32fde&&_['isNil'](_0xf32fde[_0xa305('0x13e')])&&_0x379049[_0xa305('0x13f')]&&_0x1d50a5['linkedid']===_0x1d50a5[_0xa305('0x98')]&&_['isNil'](_0x1d50a5[_0xa305('0xe7')])&&_0x1d50a5['cause']==='16'&&_0x1d50a5[_0xa305('0x140')]==='6'&&_['isUndefined'](_0xf32fde[_0xa305('0x141')])){if(_0xf32fde[_0xa305('0x8f')]){rpcDb['unlockContact'](_0xf32fde[_0xa305('0x93')]);}if(_0xf32fde[_0xa305('0x90')]){rpcDb[_0xa305('0x106')](_0xf32fde[_0xa305('0x93')]);}_0x1d50a5[_0xa305('0xe7')]='22';this[_0xa305('0xe4')](_0xf32fde,_0x379049,_0x1d50a5);}else if(_0xf32fde&&_0xf32fde[_0xa305('0x141')]){if(_0x1d50a5[_0xa305('0x13c')]==='16'&&this[_0xa305('0x45')][_0x1d50a5[_0xa305('0xdc')]]['dialAnswer']){logger[_0xa305('0x43')](_0xa305('0x142'),_0x1d50a5[_0xa305('0xdc')],_0x1d50a5[_0xa305('0x13c')],_0xa305('0x99'),_0x379049[_0xa305('0x2c')],_0xa305('0x49'),_0x379049[_0xa305('0x4a')]);this[_0xa305('0x13d')](_0x1d50a5,_0x1d50a5[_0xa305('0xdc')],_0x1d50a5[_0xa305('0x13c')]);}else if(this[_0xa305('0x45')][_0x1d50a5[_0xa305('0xdc')]]['dialAnswer']){logger[_0xa305('0x43')](_0xa305('0x143'),_0x1d50a5[_0xa305('0xdc')],_0x1d50a5[_0xa305('0x13c')],_0xa305('0x99'),_0x379049[_0xa305('0x2c')],_0xa305('0x49'),_0x379049[_0xa305('0x4a')]);this[_0xa305('0x13d')](_0x1d50a5,_0x1d50a5[_0xa305('0xdc')],_0x1d50a5['cause']);}}};Preview[_0xa305('0xf')][_0xa305('0x144')]=function(_0x3108ca){if(this[_0xa305('0x45')][_0x3108ca[_0xa305('0xe3')]]&&_0x3108ca[_0xa305('0xe3')]!==_0x3108ca[_0xa305('0x145')]){this[_0xa305('0x13d')](_0x3108ca,_0x3108ca[_0xa305('0xe3')],_0x3108ca[_0xa305('0xd8')]);}};Preview[_0xa305('0xf')]['syncHangupRequest']=function(_0x4f2b48){if(this[_0xa305('0x45')][_0x4f2b48[_0xa305('0xdc')]]&&_0x4f2b48[_0xa305('0xdc')]!==_0x4f2b48[_0xa305('0x98')]&&!this[_0xa305('0x45')][_0x4f2b48[_0xa305('0xdc')]][_0xa305('0x4b')]){if(_0x4f2b48['cause']==='1'){this[_0xa305('0x13d')](_0x4f2b48,_0x4f2b48['linkedid'],_0x4f2b48[_0xa305('0x13c')]);}}};Preview[_0xa305('0xf')]['addVariable']=function(_0x14984e,_0x3b3b87,_0x3738c0){if(this[_0xa305('0x45')][_0x14984e]){if(_[_0xa305('0xf4')](this[_0xa305('0x45')][_0x14984e][_0xa305('0x12e')])){this[_0xa305('0x45')][_0x14984e]['variables']={};}this[_0xa305('0x45')][_0x14984e][_0xa305('0x12e')][_0x3b3b87]=_0x3738c0;}};Preview[_0xa305('0xf')][_0xa305('0x146')]=function(_0x2133ca){try{if(!_[_0xa305('0xf4')](_0x2133ca)){if(ut[_0xa305('0x147')](_[_0xa305('0x148')](_0x2133ca[_0xa305('0x149')])[0x0])){this[_0xa305('0x14a')](_0x2133ca[_0xa305('0x98')],_['keys'](_0x2133ca[_0xa305('0x149')])[0x0],_0x2133ca[_0xa305('0x14b')]);}}}catch(_0x5aac8f){logger[_0xa305('0x14c')]('[syncVarSet][Preview]',util['inspect'](_0x5aac8f,{'showHidden':![],'depth':null}));}};Preview[_0xa305('0xf')][_0xa305('0x23')]=function(_0x1b7516){if(_0x1b7516){if(this[_0xa305('0x45')][_0x1b7516[_0xa305('0x14d')]]){this['actions'][_0x1b7516[_0xa305('0x14d')]][_0xa305('0x141')]=!![];}}};Preview['prototype'][_0xa305('0x25')]=function(_0x28f186){if(_0x28f186){if(this[_0xa305('0x45')][_0x28f186['transfererlinkedid']]){this[_0xa305('0x45')][_0x28f186[_0xa305('0x14e')]][_0xa305('0x141')]=!![];}}};module[_0xa305('0x14f')]=Preview; \ No newline at end of file diff --git a/server/services/ami/preview/rpcDb.js b/server/services/ami/preview/rpcDb.js index 975edd4..3841282 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 _0xa3da=['[countReScheduled]\x20','disableContact','unlockContact','[activeContact]\x20','type','uniqueid','calleridnum','calleridname','queue','queuecallerjoinAt','answertime','queuecallerleaveAt','queuecallercompleteAt','endtime','connectedlinename','membername','context','exten','xcally-motion-preview','holdtime','assigned','lastAssignedTo','queuecallerexitreason','COMPLETED','create','[voiceQueueReport]\x20','getContactRecallMe','[GetContactRecallMe]\x20','rescheduleContactInQueue','rescheduleContact','[rescheduleContactInQueue]\x20','util','bluebird','../../../config/logger','preview','../rpc/cmHopperHistory','../rpc/cmHopperBlack','../rpc/agentReportPreview','../rpc/voiceQueueReport','error','inspect','createHistory','catch','resolve','then','moveContactManagedDialer','[moveContactManagedDialer]\x20','checkIsBlackList','[checkIsBlackList]\x20','getContactPreview','[getContactPreview]\x20','createCustomerHistory','createCustomerFinal','UserId','active','[rescheduleContact]\x20','countReScheduled'];(function(_0x5cbe20,_0x2d4042){var _0x5926de=function(_0x48c035){while(--_0x48c035){_0x5cbe20['push'](_0x5cbe20['shift']());}};_0x5926de(++_0x2d4042);}(_0xa3da,0x13c));var _0xaa3d=function(_0x5bd426,_0x4878e5){_0x5bd426=_0x5bd426-0x0;var _0x23a7eb=_0xa3da[_0x5bd426];return _0x23a7eb;};'use strict';var util=require(_0xaa3d('0x0'));var BPromise=require(_0xaa3d('0x1'));var logger=require(_0xaa3d('0x2'))(_0xaa3d('0x3'));var cmHopper=require('../rpc/cmHopper');var cmHopperHistory=require(_0xaa3d('0x4'));var cmHopperBlack=require(_0xaa3d('0x5'));var agentReportPreview=require(_0xaa3d('0x6'));var voiceQueueReport=require(_0xaa3d('0x7'));function loggerCatch(_0x398af1){return function(_0x4ead76){logger[_0xaa3d('0x8')](_0x398af1,util[_0xaa3d('0x9')](_0x4ead76,{'showHidden':![],'depth':null}));};}function create(_0x19347f){return cmHopperHistory[_0xaa3d('0xa')](_0x19347f)[_0xaa3d('0xb')](loggerCatch('[createHistory]\x20'));}function createAgent(_0x2ba815){return BPromise[_0xaa3d('0xc')]()[_0xaa3d('0xd')](agentReportPreview[_0xaa3d('0xa')](_0x2ba815))[_0xaa3d('0xb')](loggerCatch('[createHistory]\x20'));}function moveContact(_0x536454){return cmHopper[_0xaa3d('0xe')](_0x536454,!![])[_0xaa3d('0xb')](loggerCatch(_0xaa3d('0xf')));}exports[_0xaa3d('0x10')]=function(_0x69ea68){return cmHopperBlack[_0xaa3d('0x10')](_0x69ea68)['catch'](loggerCatch(_0xaa3d('0x11')));};exports[_0xaa3d('0x12')]=function(_0x492e87){return BPromise[_0xaa3d('0xc')]()[_0xaa3d('0xd')](cmHopper[_0xaa3d('0x12')](_0x492e87))[_0xaa3d('0xb')](loggerCatch(_0xaa3d('0x13')));};exports[_0xaa3d('0xa')]=function(_0x11c07a,_0x236bbe){create(_0x11c07a)[_0xaa3d('0xb')](loggerCatch(_0x236bbe));moveContact(_0x11c07a)[_0xaa3d('0xb')](loggerCatch(_0x236bbe));};exports['createAgentHistory']=function(_0x2602e1,_0x432dfd){createAgent(_0x2602e1)[_0xaa3d('0xb')](loggerCatch(_0x432dfd));};exports[_0xaa3d('0x14')]=function(_0x151e26,_0x450730){create(_0x151e26)[_0xaa3d('0xb')](loggerCatch(_0x450730));};exports[_0xaa3d('0x15')]=function(_0x2afc94,_0x51cff6){moveContact(_0x2afc94)[_0xaa3d('0xb')](loggerCatch(_0x51cff6));};exports['rescheduleContact']=function(_0x38eb21,_0x138538,_0x455d6e){if(_0x138538){_0x38eb21[_0xaa3d('0x16')]=null;}if(_0x455d6e){_0x38eb21[_0xaa3d('0x17')]=![];}return cmHopper['rescheduleContact'](_0x38eb21)['catch'](loggerCatch(_0xaa3d('0x18')));};exports[_0xaa3d('0x19')]=function(_0x11668b){return cmHopper[_0xaa3d('0x19')](_0x11668b)[_0xaa3d('0xb')](loggerCatch(_0xaa3d('0x1a')));};exports['unlockContact']=function(_0x5b1994){return cmHopper['unlockContact']({'UserId':null},_0x5b1994,0x1)[_0xaa3d('0xb')](loggerCatch('[unlockContact]\x20'));};exports[_0xaa3d('0x1b')]=function(_0x3a9516){return cmHopper[_0xaa3d('0x1c')]({'active':![]},_0x3a9516,0x1)[_0xaa3d('0xb')](loggerCatch(_0xaa3d('0x1d')));};exports['crateCustomerReportQueue']=function(_0x57933f){var _0x194af4={};_0x194af4[_0xaa3d('0x1e')]=_0x57933f[_0xaa3d('0x1e')];_0x194af4[_0xaa3d('0x1f')]=_0x57933f[_0xaa3d('0x1f')];_0x194af4[_0xaa3d('0x20')]=_0x57933f[_0xaa3d('0x20')];_0x194af4[_0xaa3d('0x21')]=_0x57933f[_0xaa3d('0x21')];_0x194af4['queue']=_0x57933f[_0xaa3d('0x22')];_0x194af4[_0xaa3d('0x23')]=_0x57933f[_0xaa3d('0x24')];_0x194af4[_0xaa3d('0x25')]=_0x57933f[_0xaa3d('0x24')];_0x194af4['queuecallercomplete']=0x1;_0x194af4[_0xaa3d('0x26')]=_0x57933f[_0xaa3d('0x27')];_0x194af4[_0xaa3d('0x28')]=_0x57933f[_0xaa3d('0x29')];_0x194af4[_0xaa3d('0x2a')]='from-sip';_0x194af4[_0xaa3d('0x2b')]=_0xaa3d('0x2c');_0x194af4[_0xaa3d('0x2d')]=0x0;_0x194af4[_0xaa3d('0x2e')]=0x1;_0x194af4[_0xaa3d('0x2f')]=_0x57933f[_0xaa3d('0x29')];_0x194af4[_0xaa3d('0x30')]=_0xaa3d('0x31');return BPromise[_0xaa3d('0xc')]()[_0xaa3d('0xd')](voiceQueueReport[_0xaa3d('0x32')](_0x194af4))[_0xaa3d('0xb')](loggerCatch(_0xaa3d('0x33')));};exports[_0xaa3d('0x34')]=function(_0x532592,_0x383059){return BPromise['resolve']()[_0xaa3d('0xd')](cmHopper[_0xaa3d('0x34')](_0x532592,_0x383059))[_0xaa3d('0xb')](loggerCatch(_0xaa3d('0x35')));};exports[_0xaa3d('0x36')]=function(_0x32b40a){return cmHopper[_0xaa3d('0x37')](_0x32b40a,!![],!![])[_0xaa3d('0xb')](loggerCatch(_0xaa3d('0x38')));}; \ No newline at end of file +var _0x5abd=['uniqueid','calleridnum','calleridname','queue','queuecallerjoinAt','answertime','queuecallercomplete','queuecallercompleteAt','connectedlinename','membername','context','from-sip','exten','xcally-motion-preview','holdtime','assigned','lastAssignedTo','queuecallerexitreason','COMPLETED','create','[voiceQueueReport]\x20','getContactRecallMe','[GetContactRecallMe]\x20','rescheduleContactInQueue','[rescheduleContactInQueue]\x20','util','bluebird','../../../config/logger','preview','../rpc/voiceQueueReport','error','createHistory','catch','[createHistory]\x20','resolve','then','moveContactManagedDialer','checkIsBlackList','[checkIsBlackList]\x20','getContactPreview','createCustomerFinal','rescheduleContact','UserId','active','[rescheduleContact]\x20','countReScheduled','[countReScheduled]\x20','[unlockContact]\x20','unlockContact','crateCustomerReportQueue','type'];(function(_0x2cb7ec,_0x40d674){var _0x5d3251=function(_0x3c4fac){while(--_0x3c4fac){_0x2cb7ec['push'](_0x2cb7ec['shift']());}};_0x5d3251(++_0x40d674);}(_0x5abd,0x14b));var _0xd5ab=function(_0x2d1e79,_0x25db6d){_0x2d1e79=_0x2d1e79-0x0;var _0x362a8b=_0x5abd[_0x2d1e79];return _0x362a8b;};'use strict';var util=require(_0xd5ab('0x0'));var BPromise=require(_0xd5ab('0x1'));var logger=require(_0xd5ab('0x2'))(_0xd5ab('0x3'));var cmHopper=require('../rpc/cmHopper');var cmHopperHistory=require('../rpc/cmHopperHistory');var cmHopperBlack=require('../rpc/cmHopperBlack');var agentReportPreview=require('../rpc/agentReportPreview');var voiceQueueReport=require(_0xd5ab('0x4'));function loggerCatch(_0x5b6f0e){return function(_0x3795e2){logger[_0xd5ab('0x5')](_0x5b6f0e,util['inspect'](_0x3795e2,{'showHidden':![],'depth':null}));};}function create(_0x2b2ef3){return cmHopperHistory[_0xd5ab('0x6')](_0x2b2ef3)[_0xd5ab('0x7')](loggerCatch(_0xd5ab('0x8')));}function createAgent(_0x22be00){return BPromise[_0xd5ab('0x9')]()[_0xd5ab('0xa')](agentReportPreview['createHistory'](_0x22be00))[_0xd5ab('0x7')](loggerCatch(_0xd5ab('0x8')));}function moveContact(_0x52b231){return cmHopper[_0xd5ab('0xb')](_0x52b231,!![])['catch'](loggerCatch('[moveContactManagedDialer]\x20'));}exports[_0xd5ab('0xc')]=function(_0x4b6d61){return cmHopperBlack[_0xd5ab('0xc')](_0x4b6d61)[_0xd5ab('0x7')](loggerCatch(_0xd5ab('0xd')));};exports[_0xd5ab('0xe')]=function(_0x34fea4){return BPromise[_0xd5ab('0x9')]()[_0xd5ab('0xa')](cmHopper[_0xd5ab('0xe')](_0x34fea4))[_0xd5ab('0x7')](loggerCatch('[getContactPreview]\x20'));};exports[_0xd5ab('0x6')]=function(_0x5340af,_0x1d7572){create(_0x5340af)['catch'](loggerCatch(_0x1d7572));moveContact(_0x5340af)[_0xd5ab('0x7')](loggerCatch(_0x1d7572));};exports['createAgentHistory']=function(_0x19d75d,_0x184866){createAgent(_0x19d75d)[_0xd5ab('0x7')](loggerCatch(_0x184866));};exports['createCustomerHistory']=function(_0x5794c0,_0x2300e7){create(_0x5794c0)['catch'](loggerCatch(_0x2300e7));};exports[_0xd5ab('0xf')]=function(_0x3f60db,_0x4e5d50){moveContact(_0x3f60db)[_0xd5ab('0x7')](loggerCatch(_0x4e5d50));};exports[_0xd5ab('0x10')]=function(_0x3b938e,_0x235576,_0x29f4f4){if(_0x235576){_0x3b938e[_0xd5ab('0x11')]=null;}if(_0x29f4f4){_0x3b938e[_0xd5ab('0x12')]=![];}return cmHopper['rescheduleContact'](_0x3b938e)['catch'](loggerCatch(_0xd5ab('0x13')));};exports[_0xd5ab('0x14')]=function(_0x41a47b){return cmHopper[_0xd5ab('0x14')](_0x41a47b)['catch'](loggerCatch(_0xd5ab('0x15')));};exports['unlockContact']=function(_0x1e2695){return cmHopper['unlockContact']({'UserId':null},_0x1e2695,0x1)[_0xd5ab('0x7')](loggerCatch(_0xd5ab('0x16')));};exports['disableContact']=function(_0x321c5d){return cmHopper[_0xd5ab('0x17')]({'active':![]},_0x321c5d,0x1)[_0xd5ab('0x7')](loggerCatch('[activeContact]\x20'));};exports[_0xd5ab('0x18')]=function(_0x497633){var _0x45c3a3={};_0x45c3a3[_0xd5ab('0x19')]=_0x497633[_0xd5ab('0x19')];_0x45c3a3[_0xd5ab('0x1a')]=_0x497633[_0xd5ab('0x1a')];_0x45c3a3['calleridnum']=_0x497633[_0xd5ab('0x1b')];_0x45c3a3[_0xd5ab('0x1c')]=_0x497633[_0xd5ab('0x1c')];_0x45c3a3['queue']=_0x497633[_0xd5ab('0x1d')];_0x45c3a3[_0xd5ab('0x1e')]=_0x497633[_0xd5ab('0x1f')];_0x45c3a3['queuecallerleaveAt']=_0x497633[_0xd5ab('0x1f')];_0x45c3a3[_0xd5ab('0x20')]=0x1;_0x45c3a3[_0xd5ab('0x21')]=_0x497633['endtime'];_0x45c3a3[_0xd5ab('0x22')]=_0x497633[_0xd5ab('0x23')];_0x45c3a3[_0xd5ab('0x24')]=_0xd5ab('0x25');_0x45c3a3[_0xd5ab('0x26')]=_0xd5ab('0x27');_0x45c3a3[_0xd5ab('0x28')]=0x0;_0x45c3a3[_0xd5ab('0x29')]=0x1;_0x45c3a3[_0xd5ab('0x2a')]=_0x497633[_0xd5ab('0x23')];_0x45c3a3[_0xd5ab('0x2b')]=_0xd5ab('0x2c');return BPromise[_0xd5ab('0x9')]()[_0xd5ab('0xa')](voiceQueueReport[_0xd5ab('0x2d')](_0x45c3a3))['catch'](loggerCatch(_0xd5ab('0x2e')));};exports[_0xd5ab('0x2f')]=function(_0x2aec74,_0x2e88c0){return BPromise[_0xd5ab('0x9')]()['then'](cmHopper['getContactRecallMe'](_0x2aec74,_0x2e88c0))[_0xd5ab('0x7')](loggerCatch(_0xd5ab('0x30')));};exports[_0xd5ab('0x31')]=function(_0x4cee9d){return cmHopper[_0xd5ab('0x10')](_0x4cee9d,!![],!![])['catch'](loggerCatch(_0xd5ab('0x32')));}; \ 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 b3a572f..f579c38 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 _0x13c4=['callbackuniqueid','callbackat','recallme','UserId','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','rtpaudioqosjitterbridged','rtpaudioqoslossbridged','rtpaudioqosrttbridged','rtpaudioqosjitter','rtpaudioqosloss','rtpaudioqosrtt','bridgepeer','bridgepvtcallid','\x5cw{0,','pow','replace','extractCalleridName','match','extractCalleridNumber','noanswer','variables','forEach','lodash','moment','../../../../config/logger','preview','XCALLY_IP_AGI','127.0.0.1','../../dialer/utils','loggerCatch','error','inspect','logger','info','loggerError','logger2','message','getCallerId','isUndefined','string','isEmpty','format','\x22%s\x22\x20<%s>','\x22\x22\x20<>','isActive','isNil','addVariables','Queue','name','calleridnum','dialer','dialOriginateTimeout','\x22rtTxX%s%s\x22','U(xcally-mixmonitor-context)','dialQueueProject','\x22agi://%s/square,%s\x22','dialQueueProject2','NONE','originatecalleridnum','originatecalleridname','Call-Type:\x20PREVIEW','_XCALLY_MIXMONITOR_FORMAT','monitor_format','_XCALLY_MIXMONITOR_UNIQUEID','toLowerVariables','hasOwnProperty','toLower','logBlacklist','YYYY-MM-DD\x20HH:mm:ss','state','statedesc','starttime','responsetime','endtime','logAgent','ringtime','getSeconds','logLookAgent','membername','logCustomer','answertime','isFailure','Failure','calleridname','BOOKED','uniqueid','originate','timeout','totalGlobal','countbusyretry','countnoanswerretry','countagentrejectretry','countnosuchnumberretry','cloneAction','clone','Global','scheduledat','add','minutes','ContactId','ListId','VoiceQueueId','decrementTalking','pTalking','[decrementTalking]\x20is\x20null\x20or\x20undefined','IsNotLoggedIn','lastevent','interface','voice','mandatoryDisposition','not_inuse','status','reachable','push','getDiff','milliseconds','seconds','createBody','CampaignId','filterKey','idContact','queue','type','campaigntype','dialAnswer','active','countcongestionretry','countglobal'];(function(_0x5dda2a,_0x55fdb6){var _0x3cf95e=function(_0x189100){while(--_0x189100){_0x5dda2a['push'](_0x5dda2a['shift']());}};_0x3cf95e(++_0x55fdb6);}(_0x13c4,0x13d));var _0x413c=function(_0x5da875,_0x475a8b){_0x5da875=_0x5da875-0x0;var _0x25d687=_0x13c4[_0x5da875];return _0x25d687;};'use strict';var util=require('util');var _=require(_0x413c('0x0'));var moment=require(_0x413c('0x1'));var logger=require(_0x413c('0x2'))(_0x413c('0x3'));var ipAgi=process['env'][_0x413c('0x4')]||_0x413c('0x5');var utils=require(_0x413c('0x6'));exports[_0x413c('0x7')]=function(_0x26eac4){return function(_0xa6edea){logger[_0x413c('0x8')](_0x26eac4,util[_0x413c('0x9')](_0xa6edea,{'showHidden':![],'depth':null}));};};exports[_0x413c('0xa')]=function(_0x3c5321,_0x55a1b2){logger[_0x413c('0xb')](_0x3c5321,util['inspect'](_0x55a1b2,{'showHidden':![],'depth':null}));};exports[_0x413c('0xc')]=function(_0x19d240,_0x4f9570){logger[_0x413c('0x8')](_0x19d240,util['inspect'](_0x4f9570,{'showHidden':![],'depth':null}));};exports[_0x413c('0xd')]=function(_0x23a29d){return function(_0x37f6ec){logger[_0x413c('0xb')](_0x23a29d,util[_0x413c('0x9')](_0x37f6ec,{'showHidden':![],'depth':null}));};};exports[_0x413c('0xe')]=function(_0x1653b1,_0x1dc4ed,_0x2251e5){return{'message':_0x1653b1,'unlock':_0x1dc4ed,'active':_0x2251e5};};exports[_0x413c('0xf')]=function(_0x9c9d4c,_0x22e39b,_0x4ab42f){if(!_[_0x413c('0x10')](_0x4ab42f)&&_0x413c('0x11')===typeof _0x4ab42f&&!_[_0x413c('0x12')](_0x4ab42f)){if(!_['isUndefined'](_0x22e39b)&&'string'===typeof _0x22e39b&&!_[_0x413c('0x12')](_0x22e39b)){return util[_0x413c('0x13')](_0x413c('0x14'),_0x22e39b,_0x4ab42f);}return util[_0x413c('0x13')](_0x413c('0x14'),_0x4ab42f,_0x4ab42f);}if(!_['isUndefined'](_0x9c9d4c)&&_0x413c('0x11')===typeof _0x9c9d4c&&!_['isEmpty'](_0x9c9d4c)){return _0x9c9d4c;}return _0x413c('0x15');};exports[_0x413c('0x16')]=function(_0x3cd1cc){if(_[_0x413c('0x17')](_0x3cd1cc)){return![];}return _0x3cd1cc;};exports[_0x413c('0x18')]=function(_0x419abd,_0x1d100d,_0x244e39,_0x574bad,_0x226863,_0x389a08){var _0xf7d8fb={'XMD-QUEUE':_0x1d100d[_0x413c('0x19')]?_0x1d100d['Queue'][_0x413c('0x1a')]:'','XMD-CALLERID':_0x574bad,'XMD-CALLERID-PREVIEW':_0x389a08?util['format'](_0x413c('0x14'),_0x389a08['calleridname'],_0x389a08[_0x413c('0x1b')]):_0x574bad,'XMD-DIALID':_0x226863,'XMD-CONTACTID':_0x1d100d['ContactId'],'XMD-CDRTYPE':_0x413c('0x1c'),'CALLERID(all)':_0x574bad,'XMD-VOICEQUEUEID':_0x1d100d['VoiceQueueId'],'XMD-DIALCHANNEL':_0x244e39,'XMD-DIALTIMEOUT':_0x419abd[_0x413c('0x1d')]||0x1e,'XMD-DIALOPTIONS':util[_0x413c('0x13')](_0x413c('0x1e'),_0x419abd['dialQueueProject2']?'g':'',_[_0x413c('0x12')](_0x419abd['monitor_format'])?'':_0x413c('0x1f')),'XMD-DIALURL':_0x419abd['dialPreviewUrl']||'','XMD-AGI':_0x419abd[_0x413c('0x20')]?util[_0x413c('0x13')](_0x413c('0x21'),ipAgi,_0x419abd[_0x413c('0x20')]):'NONE','XMD-AGIAFTER':_0x419abd[_0x413c('0x22')]?util[_0x413c('0x13')](_0x413c('0x21'),ipAgi,_0x419abd['dialQueueProject2']):_0x413c('0x23'),'XMD-ORIGINATECALLERIDNUM':_0x389a08?_0x389a08[_0x413c('0x24')]:'','XMD-ORIGINATECALLERIDNAME':_0x389a08?_0x389a08[_0x413c('0x25')]:'','XMD-DESTINATION':'xcally-motion-preview','SIPADDHEADER':_0x413c('0x26')};if(!_[_0x413c('0x12')](_0x419abd['monitor_format'])){_0xf7d8fb[util[_0x413c('0x13')]('%s',_0x413c('0x27'))]=_0x419abd[_0x413c('0x28')];_0xf7d8fb[util[_0x413c('0x13')]('%s',_0x413c('0x29'))]=_0x226863;}return _0xf7d8fb;};exports[_0x413c('0x2a')]=function(_0x477e84){var _0x137652={};for(var _0x4a300d in _0x477e84){if(_0x477e84[_0x413c('0x2b')](_0x4a300d)){_0x137652[util[_0x413c('0x13')]('%s',_[_0x413c('0x2c')](_0x4a300d))]=_0x477e84[_0x4a300d];}}return{'variables':_0x137652};};exports[_0x413c('0x2d')]=function(_0x5333e5){var _0x401fc6=moment()[_0x413c('0x13')](_0x413c('0x2e'));_0x5333e5[_0x413c('0x2f')]=0xd;_0x5333e5[_0x413c('0x30')]='Blacklist';_0x5333e5[_0x413c('0x31')]=_0x401fc6;_0x5333e5[_0x413c('0x32')]=_0x401fc6;_0x5333e5[_0x413c('0x33')]=_0x401fc6;};exports[_0x413c('0x34')]=function(_0x3f1368,_0x2cbbd4,_0x83eab5){var _0x47b314=moment()[_0x413c('0x13')](_0x413c('0x2e'));_0x3f1368['state']=_0x2cbbd4;_0x3f1368['statedesc']=_0x83eab5;_0x3f1368[_0x413c('0x32')]=_0x47b314;_0x3f1368[_0x413c('0x35')]=utils[_0x413c('0x36')](_0x3f1368[_0x413c('0x32')],_0x3f1368[_0x413c('0x31')]);};exports[_0x413c('0x37')]=function(_0x27753e,_0x40badf,_0x3dfeb8){_0x27753e[_0x413c('0x38')]=_0x40badf;_0x27753e['UserId']=_0x3dfeb8;};exports[_0x413c('0x39')]=function(_0x505ecc,_0x4d2182,_0x27bf98){var _0x5d90ed=moment()[_0x413c('0x13')](_0x413c('0x2e'));_0x505ecc[_0x413c('0x2f')]=_0x4d2182;_0x505ecc['statedesc']=_0x27bf98;_0x505ecc[_0x413c('0x32')]=_0x505ecc[_0x413c('0x32')]?_0x505ecc[_0x413c('0x32')]:_0x5d90ed;_0x505ecc[_0x413c('0x33')]=_0x505ecc['endtime']?_0x505ecc['endtime']:_0x5d90ed;_0x505ecc[_0x413c('0x35')]=utils[_0x413c('0x36')](_0x505ecc[_0x413c('0x32')]||0x0,_0x505ecc[_0x413c('0x31')]||0x0);_0x505ecc['talktime']=_0x505ecc[_0x413c('0x3a')]?utils[_0x413c('0x36')](_0x505ecc[_0x413c('0x33')],_0x505ecc[_0x413c('0x3a')]):0x0;};exports[_0x413c('0x3b')]=function(_0x2c6629){return _0x2c6629===_0x413c('0x3c');};exports['variablesAction']=function(_0x498634,_0x8cfac7,_0x571cba,_0x34b553,_0x169718){var _0x32cd1b=_0x34b553?'RECALL':_0x498634[_0x413c('0x3d')];_0x32cd1b=_0x169718?_0x413c('0x3e'):_0x32cd1b;return{'actionid':_0x498634[_0x413c('0x3f')],'action':_0x413c('0x40'),'channel':_0x498634['channelAgent'],'callerid':util[_0x413c('0x13')]('\x22%s\x22\x20<%s>',_0x32cd1b,_0x498634['calleridnum']),'Exten':'xcally-motion-preview','Context':'from-sip','Priority':'1','variable':_0x571cba,'timeout':(_0x8cfac7[_0x413c('0x41')]||0x1e)*0x3e8,'async':!![],'channelid':_0x498634[_0x413c('0x3f')]};};exports[_0x413c('0x42')]=function(_0x506af8){return _0x506af8[_0x413c('0x43')]+_0x506af8['countcongestionretry']+_0x506af8[_0x413c('0x44')]+_0x506af8[_0x413c('0x45')]+_0x506af8[_0x413c('0x46')];};exports[_0x413c('0x47')]=function(_0x40de26){var _0x3b66ed=_[_0x413c('0x48')](_0x40de26);_0x3b66ed[_0x413c('0x2f')]=0xf;_0x3b66ed['statedesc']=_0x413c('0x49');return _0x3b66ed;};exports['scheduledAt']=function(_0x1c4c8f,_0x510f68,_0x4c72cb){var _0x3c8789={};_0x3c8789[_0x510f68]=_0x1c4c8f[_0x510f68];_0x3c8789['active']=![];_0x3c8789[_0x413c('0x4a')]=moment()[_0x413c('0x4b')](_0x4c72cb,_0x413c('0x4c'))[_0x413c('0x13')](_0x413c('0x2e'));_0x3c8789[_0x413c('0x4d')]=_0x1c4c8f[_0x413c('0x4d')];_0x3c8789[_0x413c('0x4e')]=_0x1c4c8f[_0x413c('0x4e')];_0x3c8789[_0x413c('0x4f')]=_0x1c4c8f[_0x413c('0x4f')]||undefined;return _0x3c8789;};exports[_0x413c('0x50')]=function(_0x3928f1,_0x32306a){if(!_['isNil'](_0x3928f1)){if(_0x3928f1[_0x413c('0x51')]>0x0){_0x3928f1[_0x413c('0x51')]-=0x1;}else{logger[_0x413c('0xb')](_0x32306a,'[decrementTalking]\x20object\x20talking\x20is\x20negative');}}else{logger[_0x413c('0x8')](_0x32306a,_0x413c('0x52'));}};exports[_0x413c('0x53')]=function(_0x3e3acc){if(_0x3e3acc<=0x0){return!![];}return![];};function buildObj(_0x338758,_0x23cd42,_0x2aa8ae){_0x338758[_0x413c('0x54')]=_0x23cd42;_0x338758[_0x413c('0x1a')]=_0x338758['queue'];_0x338758[_0x413c('0x55')]=_0x338758['channelAgent'];_0x338758['motionChannel']=_0x413c('0x56');if(_0x2aa8ae){_0x338758[_0x413c('0x57')]=_0x2aa8ae[_0x413c('0x57')];}return _0x338758;}exports['buildObj']=buildObj;exports['agentReadyId']=function(_0x154844){var _0x5c9d9a=[];for(var _0x45416d in _0x154844){if(_0x154844[_0x413c('0x2b')](_0x45416d)){if(!_[_0x413c('0x17')](_0x154844[_0x45416d])&&_0x154844[_0x45416d]['state']===_0x413c('0x58')&&_0x154844[_0x45416d][_0x413c('0x59')]===_0x413c('0x5a')){_0x5c9d9a[_0x413c('0x5b')](_0x154844[_0x45416d]['id']);}}}return _0x5c9d9a;};exports[_0x413c('0x5c')]=function(_0x429def){var _0x2a6d90=moment()[_0x413c('0x5d')](0x0);var _0x5bf0e5=moment(_0x429def)[_0x413c('0x5d')](0x0);return _0x2a6d90['diff'](_0x5bf0e5,_0x413c('0x5e'));};exports[_0x413c('0x5f')]=function(_0x2b06ef){return{'active':![],'recallme':![],'UserId':null,'ContactId':_0x2b06ef['ContactId'],'ListId':_0x2b06ef['ListId'],'VoiceQueueId':_0x2b06ef[_0x413c('0x4f')]||undefined,'CampaignId':_0x2b06ef[_0x413c('0x60')]||undefined};};exports[_0x413c('0x61')]=function(_0x37230d){if(_0x37230d==='uniqueid'||_0x37230d===_0x413c('0x62')||_0x37230d===_0x413c('0x63')||_0x37230d===_0x413c('0x64')||_0x37230d===_0x413c('0x65')||_0x37230d===_0x413c('0x66')||_0x37230d===_0x413c('0x38')||_0x37230d==='channelAgent'||_0x37230d===_0x413c('0x3d')||_0x37230d===_0x413c('0x67')||_0x37230d==='calleridnum'||_0x37230d==='scheduledat'||_0x37230d===_0x413c('0x43')||_0x37230d===_0x413c('0x68')||_0x37230d===_0x413c('0x44')||_0x37230d===_0x413c('0x69')||_0x37230d==='callback'||_0x37230d===_0x413c('0x6a')||_0x37230d===_0x413c('0x6b')||_0x37230d===_0x413c('0x6c')||_0x37230d===_0x413c('0x4d')||_0x37230d===_0x413c('0x4e')||_0x37230d===_0x413c('0x6d')||_0x37230d===_0x413c('0x4f')||_0x37230d==='sipcallid'||_0x37230d===_0x413c('0x6e')||_0x37230d===_0x413c('0x6f')||_0x37230d==='xmd-phone'||_0x37230d===_0x413c('0x70')||_0x37230d===_0x413c('0x71')||_0x37230d===_0x413c('0x72')||_0x37230d===_0x413c('0x73')||_0x37230d===_0x413c('0x74')||_0x37230d===_0x413c('0x75')||_0x37230d===_0x413c('0x76')||_0x37230d===_0x413c('0x77')||_0x37230d===_0x413c('0x78')||_0x37230d===_0x413c('0x79')||_0x37230d==='xmd-agi'||_0x37230d===_0x413c('0x7a')||_0x37230d===_0x413c('0x7b')||_0x37230d==='rtpaudioqosjitter'||_0x37230d===_0x413c('0x7c')||_0x37230d==='rtpaudioqosloss'||_0x37230d===_0x413c('0x7d')||_0x37230d==='rtpaudioqosrtt'||_0x37230d===_0x413c('0x7e')||_0x37230d===_0x413c('0x7a')||_0x37230d===_0x413c('0x7b')||_0x37230d===_0x413c('0x7f')||_0x37230d==='rtpaudioqosjitterbridged'||_0x37230d===_0x413c('0x80')||_0x37230d===_0x413c('0x7d')||_0x37230d===_0x413c('0x81')||_0x37230d==='rtpaudioqosrttbridged'||_0x37230d===_0x413c('0x82')||_0x37230d===_0x413c('0x83')||_0x37230d===_0x413c('0x2f')||_0x37230d==='statedesc'){return![];}return!![];};exports['getCallerIdRandom']=function(_0x54f8f3,_0x2bddd0){var _0x2e92ed,_0x10d5f0,_0x22c0e7;if(_0x2bddd0<=0x0){_0x2bddd0=0x1;}_0x2e92ed=new RegExp(_0x413c('0x84')+_0x2bddd0+'}$');_0x10d5f0=Math['pow'](0xa,_0x2bddd0-0x1);_0x22c0e7=Math[_0x413c('0x85')](0xa,_0x2bddd0)-0x1;return util['format']('%s',_[_0x413c('0x86')](_0x54f8f3,_0x2e92ed,_['random'](_0x10d5f0,_0x22c0e7)));};exports[_0x413c('0x87')]=function(_0x589559){var _0x3bed1d=_0x589559[_0x413c('0x88')](/"(.*?)"/);return _0x3bed1d?_0x3bed1d[0x1]:_0x589559;};exports[_0x413c('0x89')]=function(_0x1d3cab){var _0x107573=_0x1d3cab[_0x413c('0x88')](/<(.*?)>/);return _0x107573?_0x107573[0x1]:_0x1d3cab;};function buildNoAnswerEventPayload(_0xb0bf6f,_0x20e35f){var _0x14cbd9=buildObj(_0xb0bf6f,_0x413c('0x8a'));if(!_[_0x413c('0x12')](_0x20e35f[_0x413c('0x8b')])){Object['keys'](_0x20e35f['variables'])[_0x413c('0x8c')](function(_0x20af6b){_0x14cbd9[_0x20af6b['toLowerCase']()]=_0x20e35f[_0x413c('0x8b')][_0x20af6b];});}return _0x14cbd9;}exports['buildNoAnswerEventPayload']=buildNoAnswerEventPayload; \ No newline at end of file +var _0xf4c4=['Failure','RECALL','uniqueid','channelAgent','from-sip','timeout','countbusyretry','countcongestionretry','countnoanswerretry','countnosuchnumberretry','cloneAction','clone','Global','active','add','minutes','ListId','decrementTalking','pTalking','[decrementTalking]\x20object\x20talking\x20is\x20negative','error','[decrementTalking]\x20is\x20null\x20or\x20undefined','IsNotLoggedIn','queue','interface','motionChannel','voice','mandatoryDisposition','buildObj','agentReadyId','status','reachable','push','getDiff','milliseconds','diff','createBody','CampaignId','filterKey','idContact','type','dialAnswer','membername','scheduledat','countglobal','callbackat','recallme','sipcallid','xmd-voicequeueid','xmd-phone','xmd-listid','xmd-dialurl','xmd-dialoptions','xmd-dialid','xmd-dialchannel','xmd-cdrtype','xmd-agiafter','xmd-agi','rtpaudioqos','rtpaudioqosbridged','rtpaudioqosjitter','rtpaudioqosrtt','rtpaudioqosrttbridged','rtpaudioqosloss','rtpaudioqoslossbridged','bridgepeer','bridgepvtcallid','getCallerIdRandom','\x5cw{0,','pow','replace','extractCalleridName','match','extractCalleridNumber','variables','keys','forEach','toLowerCase','buildNoAnswerEventPayload','util','lodash','moment','../../../../config/logger','preview','env','XCALLY_IP_AGI','127.0.0.1','../../dialer/utils','loggerCatch','inspect','logger','info','logger2','getCallerId','isUndefined','string','isEmpty','format','\x22%s\x22\x20<%s>','isActive','isNil','Queue','name','calleridname','calleridnum','ContactId','dialer','VoiceQueueId','dialOriginateTimeout','\x22rtTxX%s%s\x22','dialQueueProject2','monitor_format','U(xcally-mixmonitor-context)','dialQueueProject','\x22agi://%s/square,%s\x22','NONE','originatecalleridnum','originatecalleridname','xcally-motion-preview','Call-Type:\x20PREVIEW','_XCALLY_MIXMONITOR_FORMAT','_XCALLY_MIXMONITOR_UNIQUEID','toLowerVariables','hasOwnProperty','toLower','logBlacklist','YYYY-MM-DD\x20HH:mm:ss','state','statedesc','responsetime','endtime','logAgent','ringtime','getSeconds','UserId','logCustomer','starttime','talktime'];(function(_0x37bd26,_0x5ad346){var _0xe83dc4=function(_0x1ac229){while(--_0x1ac229){_0x37bd26['push'](_0x37bd26['shift']());}};_0xe83dc4(++_0x5ad346);}(_0xf4c4,0x1ed));var _0x4f4c=function(_0x25b24a,_0x1c0163){_0x25b24a=_0x25b24a-0x0;var _0x224e68=_0xf4c4[_0x25b24a];return _0x224e68;};'use strict';var util=require(_0x4f4c('0x0'));var _=require(_0x4f4c('0x1'));var moment=require(_0x4f4c('0x2'));var logger=require(_0x4f4c('0x3'))(_0x4f4c('0x4'));var ipAgi=process[_0x4f4c('0x5')][_0x4f4c('0x6')]||_0x4f4c('0x7');var utils=require(_0x4f4c('0x8'));exports[_0x4f4c('0x9')]=function(_0x41bd7b){return function(_0x55ca57){logger['error'](_0x41bd7b,util[_0x4f4c('0xa')](_0x55ca57,{'showHidden':![],'depth':null}));};};exports[_0x4f4c('0xb')]=function(_0x34333f,_0x2a7ec7){logger[_0x4f4c('0xc')](_0x34333f,util[_0x4f4c('0xa')](_0x2a7ec7,{'showHidden':![],'depth':null}));};exports['loggerError']=function(_0x4d9023,_0x39307d){logger['error'](_0x4d9023,util[_0x4f4c('0xa')](_0x39307d,{'showHidden':![],'depth':null}));};exports[_0x4f4c('0xd')]=function(_0x40036c){return function(_0x1f9cd8){logger[_0x4f4c('0xc')](_0x40036c,util['inspect'](_0x1f9cd8,{'showHidden':![],'depth':null}));};};exports['message']=function(_0x30d65c,_0x1ebcb7,_0x54556a){return{'message':_0x30d65c,'unlock':_0x1ebcb7,'active':_0x54556a};};exports[_0x4f4c('0xe')]=function(_0x26f3ea,_0x4b30ed,_0x7eff6b){if(!_[_0x4f4c('0xf')](_0x7eff6b)&&_0x4f4c('0x10')===typeof _0x7eff6b&&!_['isEmpty'](_0x7eff6b)){if(!_[_0x4f4c('0xf')](_0x4b30ed)&&_0x4f4c('0x10')===typeof _0x4b30ed&&!_[_0x4f4c('0x11')](_0x4b30ed)){return util[_0x4f4c('0x12')](_0x4f4c('0x13'),_0x4b30ed,_0x7eff6b);}return util[_0x4f4c('0x12')]('\x22%s\x22\x20<%s>',_0x7eff6b,_0x7eff6b);}if(!_['isUndefined'](_0x26f3ea)&&'string'===typeof _0x26f3ea&&!_['isEmpty'](_0x26f3ea)){return _0x26f3ea;}return'\x22\x22\x20<>';};exports[_0x4f4c('0x14')]=function(_0x2113f4){if(_[_0x4f4c('0x15')](_0x2113f4)){return![];}return _0x2113f4;};exports['addVariables']=function(_0x277e36,_0x80de5e,_0x2d6072,_0x4d7f02,_0x47562b,_0x4e93a1){var _0x404b70={'XMD-QUEUE':_0x80de5e[_0x4f4c('0x16')]?_0x80de5e[_0x4f4c('0x16')][_0x4f4c('0x17')]:'','XMD-CALLERID':_0x4d7f02,'XMD-CALLERID-PREVIEW':_0x4e93a1?util[_0x4f4c('0x12')](_0x4f4c('0x13'),_0x4e93a1[_0x4f4c('0x18')],_0x4e93a1[_0x4f4c('0x19')]):_0x4d7f02,'XMD-DIALID':_0x47562b,'XMD-CONTACTID':_0x80de5e[_0x4f4c('0x1a')],'XMD-CDRTYPE':_0x4f4c('0x1b'),'CALLERID(all)':_0x4d7f02,'XMD-VOICEQUEUEID':_0x80de5e[_0x4f4c('0x1c')],'XMD-DIALCHANNEL':_0x2d6072,'XMD-DIALTIMEOUT':_0x277e36[_0x4f4c('0x1d')]||0x1e,'XMD-DIALOPTIONS':util[_0x4f4c('0x12')](_0x4f4c('0x1e'),_0x277e36[_0x4f4c('0x1f')]?'g':'',_[_0x4f4c('0x11')](_0x277e36[_0x4f4c('0x20')])?'':_0x4f4c('0x21')),'XMD-DIALURL':_0x277e36['dialPreviewUrl']||'','XMD-AGI':_0x277e36[_0x4f4c('0x22')]?util['format'](_0x4f4c('0x23'),ipAgi,_0x277e36[_0x4f4c('0x22')]):'NONE','XMD-AGIAFTER':_0x277e36[_0x4f4c('0x1f')]?util['format']('\x22agi://%s/square,%s\x22',ipAgi,_0x277e36[_0x4f4c('0x1f')]):_0x4f4c('0x24'),'XMD-ORIGINATECALLERIDNUM':_0x4e93a1?_0x4e93a1[_0x4f4c('0x25')]:'','XMD-ORIGINATECALLERIDNAME':_0x4e93a1?_0x4e93a1[_0x4f4c('0x26')]:'','XMD-DESTINATION':_0x4f4c('0x27'),'SIPADDHEADER':_0x4f4c('0x28')};if(!_[_0x4f4c('0x11')](_0x277e36['monitor_format'])){_0x404b70[util[_0x4f4c('0x12')]('%s',_0x4f4c('0x29'))]=_0x277e36[_0x4f4c('0x20')];_0x404b70[util[_0x4f4c('0x12')]('%s',_0x4f4c('0x2a'))]=_0x47562b;}return _0x404b70;};exports[_0x4f4c('0x2b')]=function(_0x1dcbe0){var _0x4014b9={};for(var _0x148735 in _0x1dcbe0){if(_0x1dcbe0[_0x4f4c('0x2c')](_0x148735)){_0x4014b9[util['format']('%s',_[_0x4f4c('0x2d')](_0x148735))]=_0x1dcbe0[_0x148735];}}return{'variables':_0x4014b9};};exports[_0x4f4c('0x2e')]=function(_0x36af41){var _0x19b54c=moment()['format'](_0x4f4c('0x2f'));_0x36af41[_0x4f4c('0x30')]=0xd;_0x36af41[_0x4f4c('0x31')]='Blacklist';_0x36af41['starttime']=_0x19b54c;_0x36af41[_0x4f4c('0x32')]=_0x19b54c;_0x36af41[_0x4f4c('0x33')]=_0x19b54c;};exports[_0x4f4c('0x34')]=function(_0x561912,_0x597b20,_0x118da8){var _0x248b49=moment()[_0x4f4c('0x12')](_0x4f4c('0x2f'));_0x561912[_0x4f4c('0x30')]=_0x597b20;_0x561912[_0x4f4c('0x31')]=_0x118da8;_0x561912[_0x4f4c('0x32')]=_0x248b49;_0x561912[_0x4f4c('0x35')]=utils[_0x4f4c('0x36')](_0x561912['responsetime'],_0x561912['starttime']);};exports['logLookAgent']=function(_0xf646fc,_0x2e5866,_0x3b3718){_0xf646fc['membername']=_0x2e5866;_0xf646fc[_0x4f4c('0x37')]=_0x3b3718;};exports[_0x4f4c('0x38')]=function(_0x5b0d83,_0x5a139b,_0x3fa76d){var _0x4eeb4e=moment()[_0x4f4c('0x12')](_0x4f4c('0x2f'));_0x5b0d83['state']=_0x5a139b;_0x5b0d83[_0x4f4c('0x31')]=_0x3fa76d;_0x5b0d83[_0x4f4c('0x32')]=_0x5b0d83[_0x4f4c('0x32')]?_0x5b0d83[_0x4f4c('0x32')]:_0x4eeb4e;_0x5b0d83[_0x4f4c('0x33')]=_0x5b0d83[_0x4f4c('0x33')]?_0x5b0d83['endtime']:_0x4eeb4e;_0x5b0d83[_0x4f4c('0x35')]=utils['getSeconds'](_0x5b0d83[_0x4f4c('0x32')]||0x0,_0x5b0d83[_0x4f4c('0x39')]||0x0);_0x5b0d83[_0x4f4c('0x3a')]=_0x5b0d83['answertime']?utils['getSeconds'](_0x5b0d83['endtime'],_0x5b0d83['answertime']):0x0;};exports['isFailure']=function(_0x59ec9c){return _0x59ec9c===_0x4f4c('0x3b');};exports['variablesAction']=function(_0x4161fc,_0x1807ce,_0x3d42eb,_0x3a7407,_0x254d1a){var _0xb76605=_0x3a7407?_0x4f4c('0x3c'):_0x4161fc[_0x4f4c('0x18')];_0xb76605=_0x254d1a?'BOOKED':_0xb76605;return{'actionid':_0x4161fc[_0x4f4c('0x3d')],'action':'originate','channel':_0x4161fc[_0x4f4c('0x3e')],'callerid':util[_0x4f4c('0x12')]('\x22%s\x22\x20<%s>',_0xb76605,_0x4161fc[_0x4f4c('0x19')]),'Exten':_0x4f4c('0x27'),'Context':_0x4f4c('0x3f'),'Priority':'1','variable':_0x3d42eb,'timeout':(_0x1807ce[_0x4f4c('0x40')]||0x1e)*0x3e8,'async':!![],'channelid':_0x4161fc['uniqueid']};};exports['totalGlobal']=function(_0x5cf941){return _0x5cf941[_0x4f4c('0x41')]+_0x5cf941[_0x4f4c('0x42')]+_0x5cf941[_0x4f4c('0x43')]+_0x5cf941['countagentrejectretry']+_0x5cf941[_0x4f4c('0x44')];};exports[_0x4f4c('0x45')]=function(_0x289ab0){var _0xdbaa35=_[_0x4f4c('0x46')](_0x289ab0);_0xdbaa35['state']=0xf;_0xdbaa35[_0x4f4c('0x31')]=_0x4f4c('0x47');return _0xdbaa35;};exports['scheduledAt']=function(_0x312648,_0x5767f5,_0x28ef4b){var _0x506476={};_0x506476[_0x5767f5]=_0x312648[_0x5767f5];_0x506476[_0x4f4c('0x48')]=![];_0x506476['scheduledat']=moment()[_0x4f4c('0x49')](_0x28ef4b,_0x4f4c('0x4a'))[_0x4f4c('0x12')](_0x4f4c('0x2f'));_0x506476['ContactId']=_0x312648[_0x4f4c('0x1a')];_0x506476[_0x4f4c('0x4b')]=_0x312648[_0x4f4c('0x4b')];_0x506476[_0x4f4c('0x1c')]=_0x312648['VoiceQueueId']||undefined;return _0x506476;};exports[_0x4f4c('0x4c')]=function(_0x361cf6,_0x56c0a5){if(!_[_0x4f4c('0x15')](_0x361cf6)){if(_0x361cf6['pTalking']>0x0){_0x361cf6[_0x4f4c('0x4d')]-=0x1;}else{logger[_0x4f4c('0xc')](_0x56c0a5,_0x4f4c('0x4e'));}}else{logger[_0x4f4c('0x4f')](_0x56c0a5,_0x4f4c('0x50'));}};exports[_0x4f4c('0x51')]=function(_0x368e42){if(_0x368e42<=0x0){return!![];}return![];};function buildObj(_0x1ddec7,_0x14b24c,_0x12cbbf){_0x1ddec7['lastevent']=_0x14b24c;_0x1ddec7['name']=_0x1ddec7[_0x4f4c('0x52')];_0x1ddec7[_0x4f4c('0x53')]=_0x1ddec7['channelAgent'];_0x1ddec7[_0x4f4c('0x54')]=_0x4f4c('0x55');if(_0x12cbbf){_0x1ddec7[_0x4f4c('0x56')]=_0x12cbbf[_0x4f4c('0x56')];}return _0x1ddec7;}exports[_0x4f4c('0x57')]=buildObj;exports[_0x4f4c('0x58')]=function(_0x25bd97){var _0x55442f=[];for(var _0x40aa99 in _0x25bd97){if(_0x25bd97[_0x4f4c('0x2c')](_0x40aa99)){if(!_['isNil'](_0x25bd97[_0x40aa99])&&_0x25bd97[_0x40aa99][_0x4f4c('0x30')]==='not_inuse'&&_0x25bd97[_0x40aa99][_0x4f4c('0x59')]===_0x4f4c('0x5a')){_0x55442f[_0x4f4c('0x5b')](_0x25bd97[_0x40aa99]['id']);}}}return _0x55442f;};exports[_0x4f4c('0x5c')]=function(_0x7330df){var _0x174d4f=moment()[_0x4f4c('0x5d')](0x0);var _0x4f0095=moment(_0x7330df)[_0x4f4c('0x5d')](0x0);return _0x174d4f[_0x4f4c('0x5e')](_0x4f0095,'seconds');};exports[_0x4f4c('0x5f')]=function(_0x5d44b4){return{'active':![],'recallme':![],'UserId':null,'ContactId':_0x5d44b4['ContactId'],'ListId':_0x5d44b4[_0x4f4c('0x4b')],'VoiceQueueId':_0x5d44b4[_0x4f4c('0x1c')]||undefined,'CampaignId':_0x5d44b4[_0x4f4c('0x60')]||undefined};};exports[_0x4f4c('0x61')]=function(_0x1b9d0c){if(_0x1b9d0c===_0x4f4c('0x3d')||_0x1b9d0c===_0x4f4c('0x62')||_0x1b9d0c==='queue'||_0x1b9d0c===_0x4f4c('0x63')||_0x1b9d0c==='campaigntype'||_0x1b9d0c===_0x4f4c('0x64')||_0x1b9d0c===_0x4f4c('0x65')||_0x1b9d0c==='channelAgent'||_0x1b9d0c==='calleridname'||_0x1b9d0c===_0x4f4c('0x48')||_0x1b9d0c===_0x4f4c('0x19')||_0x1b9d0c===_0x4f4c('0x66')||_0x1b9d0c==='countbusyretry'||_0x1b9d0c==='countcongestionretry'||_0x1b9d0c===_0x4f4c('0x43')||_0x1b9d0c===_0x4f4c('0x67')||_0x1b9d0c==='callback'||_0x1b9d0c==='callbackuniqueid'||_0x1b9d0c===_0x4f4c('0x68')||_0x1b9d0c===_0x4f4c('0x69')||_0x1b9d0c==='ContactId'||_0x1b9d0c===_0x4f4c('0x4b')||_0x1b9d0c===_0x4f4c('0x37')||_0x1b9d0c===_0x4f4c('0x1c')||_0x1b9d0c===_0x4f4c('0x6a')||_0x1b9d0c===_0x4f4c('0x6b')||_0x1b9d0c==='xmd-queue'||_0x1b9d0c===_0x4f4c('0x6c')||_0x1b9d0c===_0x4f4c('0x6d')||_0x1b9d0c===_0x4f4c('0x6e')||_0x1b9d0c==='xmd-dialtimeout'||_0x1b9d0c===_0x4f4c('0x6f')||_0x1b9d0c===_0x4f4c('0x70')||_0x1b9d0c===_0x4f4c('0x71')||_0x1b9d0c==='xmd-contactid'||_0x1b9d0c===_0x4f4c('0x72')||_0x1b9d0c==='xmd-callerid'||_0x1b9d0c===_0x4f4c('0x73')||_0x1b9d0c===_0x4f4c('0x74')||_0x1b9d0c===_0x4f4c('0x75')||_0x1b9d0c===_0x4f4c('0x76')||_0x1b9d0c===_0x4f4c('0x77')||_0x1b9d0c==='rtpaudioqosjitterbridged'||_0x1b9d0c==='rtpaudioqosloss'||_0x1b9d0c==='rtpaudioqoslossbridged'||_0x1b9d0c===_0x4f4c('0x78')||_0x1b9d0c===_0x4f4c('0x79')||_0x1b9d0c===_0x4f4c('0x75')||_0x1b9d0c===_0x4f4c('0x76')||_0x1b9d0c===_0x4f4c('0x77')||_0x1b9d0c==='rtpaudioqosjitterbridged'||_0x1b9d0c===_0x4f4c('0x7a')||_0x1b9d0c===_0x4f4c('0x7b')||_0x1b9d0c===_0x4f4c('0x78')||_0x1b9d0c===_0x4f4c('0x79')||_0x1b9d0c===_0x4f4c('0x7c')||_0x1b9d0c===_0x4f4c('0x7d')||_0x1b9d0c==='state'||_0x1b9d0c===_0x4f4c('0x31')){return![];}return!![];};exports[_0x4f4c('0x7e')]=function(_0x1892cf,_0x2df193){var _0x41679f,_0x4c8507,_0x515fcb;if(_0x2df193<=0x0){_0x2df193=0x1;}_0x41679f=new RegExp(_0x4f4c('0x7f')+_0x2df193+'}$');_0x4c8507=Math['pow'](0xa,_0x2df193-0x1);_0x515fcb=Math[_0x4f4c('0x80')](0xa,_0x2df193)-0x1;return util[_0x4f4c('0x12')]('%s',_[_0x4f4c('0x81')](_0x1892cf,_0x41679f,_['random'](_0x4c8507,_0x515fcb)));};exports[_0x4f4c('0x82')]=function(_0x44b37b){var _0x41735e=_0x44b37b[_0x4f4c('0x83')](/"(.*?)"/);return _0x41735e?_0x41735e[0x1]:_0x44b37b;};exports[_0x4f4c('0x84')]=function(_0x10d88b){var _0x2f752b=_0x10d88b[_0x4f4c('0x83')](/<(.*?)>/);return _0x2f752b?_0x2f752b[0x1]:_0x10d88b;};function buildNoAnswerEventPayload(_0x247439,_0x5838ec){var _0x13a5ef=buildObj(_0x247439,'noanswer');if(!_['isEmpty'](_0x5838ec[_0x4f4c('0x85')])){Object[_0x4f4c('0x86')](_0x5838ec[_0x4f4c('0x85')])[_0x4f4c('0x87')](function(_0xbef5e1){_0x13a5ef[_0xbef5e1[_0x4f4c('0x88')]()]=_0x5838ec[_0x4f4c('0x85')][_0xbef5e1];});}return _0x13a5ef;}exports[_0x4f4c('0x89')]=buildNoAnswerEventPayload; \ No newline at end of file diff --git a/server/services/ami/properties.js b/server/services/ami/properties.js index c4e5b73..b2ec906 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 _0xdb95=['voicequeuechannelredirect','string','queueremove','boolean','reload','voicequeuechannel','voicechannel','voicequeuechannelhangup'];(function(_0x287646,_0x3e9a73){var _0x365aa2=function(_0xb46a52){while(--_0xb46a52){_0x287646['push'](_0x287646['shift']());}};_0x365aa2(++_0x3e9a73);}(_0xdb95,0x189));var _0x5db9=function(_0x504eba,_0x13ad6d){_0x504eba=_0x504eba-0x0;var _0x16e283=_0xdb95[_0x504eba];return _0x16e283;};'use strict';exports['queueadd']={'queue':{'type':_0x5db9('0x0'),'required':!![]},'interface':{'type':_0x5db9('0x0'),'required':!![]},'membername':{'type':_0x5db9('0x0'),'required':!![]},'penalty':{'type':'number','required':![]},'paused':{'type':'boolean','required':![]}};exports[_0x5db9('0x1')]={'queue':{'type':_0x5db9('0x0'),'required':!![]},'interface':{'type':_0x5db9('0x0'),'required':!![]}};exports['queuepause']={'interface':{'type':'string','required':!![]},'paused':{'type':_0x5db9('0x2')},'reason':{'type':_0x5db9('0x0'),'required':![]}};exports[_0x5db9('0x3')]={'module':{'type':_0x5db9('0x0'),'required':![]}};exports[_0x5db9('0x4')]={'uniqueid':{'type':_0x5db9('0x0'),'required':!![]}};exports[_0x5db9('0x5')]={'uniqueid':{'type':'string','required':!![]},'filename':{'type':_0x5db9('0x0')},'format':{'type':_0x5db9('0x0')},'mixmonitorid':{'type':_0x5db9('0x0')}};exports[_0x5db9('0x6')]={'uniqueid':{'type':_0x5db9('0x0'),'required':!![]}};exports[_0x5db9('0x7')]={'uniqueid':{'type':_0x5db9('0x0'),'required':!![]},'exten':{'type':_0x5db9('0x0'),'required':!![]},'context':{'type':'string'}}; \ No newline at end of file +var _0xaa38=['reload','voicechannel','voicequeuechannelhangup','voicequeuechannelredirect','queueadd','string','number','queueremove','queuepause'];(function(_0x128d3f,_0x1c473e){var _0x253c8e=function(_0xd04c8b){while(--_0xd04c8b){_0x128d3f['push'](_0x128d3f['shift']());}};_0x253c8e(++_0x1c473e);}(_0xaa38,0x1f3));var _0x8aa3=function(_0x391760,_0x470e98){_0x391760=_0x391760-0x0;var _0x236c4f=_0xaa38[_0x391760];return _0x236c4f;};'use strict';exports[_0x8aa3('0x0')]={'queue':{'type':_0x8aa3('0x1'),'required':!![]},'interface':{'type':'string','required':!![]},'membername':{'type':_0x8aa3('0x1'),'required':!![]},'penalty':{'type':_0x8aa3('0x2'),'required':![]},'paused':{'type':'boolean','required':![]}};exports[_0x8aa3('0x3')]={'queue':{'type':_0x8aa3('0x1'),'required':!![]},'interface':{'type':'string','required':!![]}};exports[_0x8aa3('0x4')]={'interface':{'type':'string','required':!![]},'paused':{'type':'boolean'},'reason':{'type':_0x8aa3('0x1'),'required':![]}};exports[_0x8aa3('0x5')]={'module':{'type':_0x8aa3('0x1'),'required':![]}};exports['voicequeuechannel']={'uniqueid':{'type':_0x8aa3('0x1'),'required':!![]}};exports[_0x8aa3('0x6')]={'uniqueid':{'type':_0x8aa3('0x1'),'required':!![]},'filename':{'type':_0x8aa3('0x1')},'format':{'type':_0x8aa3('0x1')},'mixmonitorid':{'type':'string'}};exports[_0x8aa3('0x7')]={'uniqueid':{'type':_0x8aa3('0x1'),'required':!![]}};exports[_0x8aa3('0x8')]={'uniqueid':{'type':_0x8aa3('0x1'),'required':!![]},'exten':{'type':_0x8aa3('0x1'),'required':!![]},'context':{'type':'string'}}; \ No newline at end of file diff --git a/server/services/ami/realtime/index.js b/server/services/ami/realtime/index.js index 1b6e714..6b725e1 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 _0xb10b=['../model/voiceExtension','../model/zendeskAccount','../model/freshdeskAccount','../model/sugarcrmAccount','../model/deskAccount','../model/vtigerAccount','../model/servicenowAccount','../model/dynamics365Account','../model/freshsalesAccount','../model/faxAccount','agents','telephones','triggers','campaigns','templates','voiceExtensions','queueChannels','outboundChannels','timers','settings','zendeskAccounts','salesforceAccounts','freshdeskAccounts','zohoAccounts','deskAccounts','vtigerAccounts','servicenowAccounts','dynamics365Accounts','freshsalesAccounts','faxAccounts','mapKeys','hasOwnProperty','SIP/%s','name','interface','format','total','answered','sumHoldTime','sumDuration','ivrTotalCallsDays','isEmpty','unmanaged','sumBillable','outboundAnswerAgiCallsDay','outboundNoAnswerCallsDay','outboundBusyCallsDay','outboundNoSuchCallsDay','outboundDropCallsDayTimeout','outboundBlacklistCallsDay','outboundOriginateFailureCallsDay','outboundRejectCallsDay','outboundAnswerCallsDay','queueStatusComplete','mergeFromDatabase','prototype','initAgents','length','isNil','isUndefined','initTelephones','trunks','initTemplates','initZendeskAccounts','initSalesforceAccounts','initFreshdeskAccounts','initDeskAccounts','initSugarcrmAccounts','sugarcrmAccounts','initVtigerAccounts','initVoiceQueueHopperHistory','voiceQueues','groupBy','uniqueid','queue','queuecallerexit','abandoned','queuecallerleaveAt','diff','seconds','queuecallercompleteAt','queuecallerabandonAt','queuecallerexitAt','queuecallercomplete','initVoiceCallReports','outbound','duration','billableseconds','initCampaigns','dialQueueProject','initCampaignHopperHistory','merge','initFaxAccounts','initVoiceQueues','lodash','util','../model/agent','../model/telephone','../model/voiceQueue','../model/trigger','../model/template','../model/campaign'];(function(_0x38803b,_0x3ce03e){var _0x5d5b68=function(_0x219bfb){while(--_0x219bfb){_0x38803b['push'](_0x38803b['shift']());}};_0x5d5b68(++_0x3ce03e);}(_0xb10b,0x12a));var _0xbb10=function(_0x5c43e1,_0x4c1705){_0x5c43e1=_0x5c43e1-0x0;var _0x397fa7=_0xb10b[_0x5c43e1];return _0x397fa7;};'use strict';var _=require(_0xbb10('0x0'));var moment=require('moment');var util=require(_0xbb10('0x1'));var Agent=require(_0xbb10('0x2'));var Telephone=require(_0xbb10('0x3'));var Trunk=require('../model/trunk');var VoiceQueue=require(_0xbb10('0x4'));var Trigger=require(_0xbb10('0x5'));var Template=require(_0xbb10('0x6'));var Campaign=require(_0xbb10('0x7'));var VoiceExtension=require(_0xbb10('0x8'));var ZendeskAccount=require(_0xbb10('0x9'));var SalesforceAccount=require('../model/salesforceAccount');var FreshdeskAccount=require(_0xbb10('0xa'));var SugarcrmAccount=require(_0xbb10('0xb'));var ZohoAccount=require('../model/zohoAccount');var DeskAccount=require(_0xbb10('0xc'));var VtigerAccount=require(_0xbb10('0xd'));var ServicenowAccount=require(_0xbb10('0xe'));var Dynamics365Account=require(_0xbb10('0xf'));var FreshsalesAccount=require(_0xbb10('0x10'));var FaxAccount=require(_0xbb10('0x11'));function Realtime(){this[_0xbb10('0x12')]={};this[_0xbb10('0x13')]={};this['trunks']={};this['voiceQueues']={};this[_0xbb10('0x14')]={};this[_0xbb10('0x15')]={};this[_0xbb10('0x16')]={};this['outbound']={'total':0x0,'answered':0x0,'sumHoldTime':0x0,'sumDuration':0x0,'sumBillable':0x0};this[_0xbb10('0x17')]={};this['channels']={};this[_0xbb10('0x18')]={};this[_0xbb10('0x19')]={};this[_0xbb10('0x1a')]={};this[_0xbb10('0x1b')]={};this[_0xbb10('0x1c')]={};this[_0xbb10('0x1d')]={};this['sugarcrmAccounts']={};this[_0xbb10('0x1e')]={};this[_0xbb10('0x1f')]={};this[_0xbb10('0x20')]={};this[_0xbb10('0x21')]={};this[_0xbb10('0x22')]={};this[_0xbb10('0x23')]={};this[_0xbb10('0x24')]={};this[_0xbb10('0x25')]={};}function freeIsNotKey(_0x3e26f4,_0x2b184e,_0x4a2bfc){var _0x2eca0f=_[_0xbb10('0x26')](_0x3e26f4,function(_0x133ac2){return _0x133ac2[_0x4a2bfc];});for(var _0x42db98 in _0x2b184e){if(_0x2b184e[_0xbb10('0x27')](_0x42db98)){if(!_0x2eca0f[_0x42db98]){delete _0x2b184e[_0x42db98];}}}}function freeIsNotKeySip(_0x1682a4,_0x575cca){var _0x30efc6=_[_0xbb10('0x26')](_0x1682a4,function(_0xe1c665){return util['format'](_0xbb10('0x28'),_0xe1c665[_0xbb10('0x29')]);});for(var _0x388fab in _0x575cca){if(_0x575cca[_0xbb10('0x27')](_0x388fab)){if(!_0x30efc6[_0x388fab]){delete _0x575cca[_0x388fab];}}}}function freeIsNotKeyAgent(_0xdf237d,_0x44e563){var _0x4deb49=_[_0xbb10('0x26')](_0xdf237d,function(_0x12ef77){var _0x50aea1=_['isNil'](_0x12ef77[_0xbb10('0x2a')])?util[_0xbb10('0x2b')](_0xbb10('0x28'),_0x12ef77[_0xbb10('0x29')]):_0x12ef77[_0xbb10('0x2a')];return _0x50aea1;});for(var _0x1824b7 in _0x44e563){if(_0x44e563[_0xbb10('0x27')](_0x1824b7)){if(!_0x4deb49[_0x1824b7]){delete _0x44e563[_0x1824b7];}}}}function clearVoiceCallReports(_0x436104){_0x436104[_0xbb10('0x2c')]=0x0;_0x436104[_0xbb10('0x2d')]=0x0;_0x436104[_0xbb10('0x2e')]=0x0;_0x436104[_0xbb10('0x2f')]=0x0;_0x436104['sumBillable']=0x0;}function clearCampaigns(_0x4fedac){if(!_['isEmpty'](_0x4fedac)){for(var _0xc93a04 in _0x4fedac){if(_0x4fedac[_0xbb10('0x27')](_0xc93a04)){_0x4fedac[_0xc93a04][_0xbb10('0x30')]=0x0;_0x4fedac[_0xc93a04]['ivrAnswerCallsDay']=0x0;}}}}function clearVoiceQueues(_0x2fdde9){if(!_[_0xbb10('0x31')](_0x2fdde9)){for(var _0x6ed43b in _0x2fdde9){if(_0x2fdde9[_0xbb10('0x27')](_0x6ed43b)){_0x2fdde9[_0x6ed43b][_0xbb10('0x2c')]=0x0;_0x2fdde9[_0x6ed43b][_0xbb10('0x2d')]=0x0;_0x2fdde9[_0x6ed43b][_0xbb10('0x32')]=0x0;_0x2fdde9[_0x6ed43b]['abandoned']=0x0;_0x2fdde9[_0x6ed43b][_0xbb10('0x2e')]=0x0;_0x2fdde9[_0x6ed43b][_0xbb10('0x2f')]=0x0;_0x2fdde9[_0x6ed43b][_0xbb10('0x33')]=0x0;_0x2fdde9[_0x6ed43b][_0xbb10('0x34')]=0x0;_0x2fdde9[_0x6ed43b][_0xbb10('0x35')]=0x0;_0x2fdde9[_0x6ed43b][_0xbb10('0x36')]=0x0;_0x2fdde9[_0x6ed43b]['outboundCongestionCallsDay']=0x0;_0x2fdde9[_0x6ed43b][_0xbb10('0x37')]=0x0;_0x2fdde9[_0x6ed43b]['outboundUnknownCallsDay']=0x0;_0x2fdde9[_0x6ed43b][_0xbb10('0x38')]=0x0;_0x2fdde9[_0x6ed43b]['outboundDropCallsDayCallersExit']=0x0;_0x2fdde9[_0x6ed43b][_0xbb10('0x39')]=0x0;_0x2fdde9[_0x6ed43b][_0xbb10('0x3a')]=0x0;_0x2fdde9[_0x6ed43b][_0xbb10('0x3b')]=0x0;_0x2fdde9[_0x6ed43b]['outboundReCallsDay']=0x0;_0x2fdde9[_0x6ed43b]['outboundAnswerAgiCallsDay']=0x0;_0x2fdde9[_0x6ed43b][_0xbb10('0x3c')]=0x0;_0x2fdde9[_0x6ed43b][_0xbb10('0x3d')]=!![];}}}}Realtime['prototype'][_0xbb10('0x3e')]=function(_0x37dde7,_0x2f653f){for(var _0x1c0b57 in _0x2f653f){if(_0x37dde7[_0xbb10('0x27')](_0x1c0b57)){_0x37dde7[_0x1c0b57]=_0x2f653f[_0x1c0b57];}}};Realtime[_0xbb10('0x3f')][_0xbb10('0x40')]=function(){var _0x4975f5=this;return function(_0x25acb3){if(_0x25acb3){freeIsNotKeyAgent(_0x25acb3,_0x4975f5[_0xbb10('0x12')]);for(var _0x441d15=0x0,_0x8c1ce6={};_0x441d15<_0x25acb3[_0xbb10('0x41')];_0x441d15+=0x1){_0x8c1ce6=_0x25acb3[_0x441d15];var _0x9de708=_[_0xbb10('0x42')](_0x8c1ce6[_0xbb10('0x2a')])?util[_0xbb10('0x2b')]('SIP/%s',_0x8c1ce6[_0xbb10('0x29')]):_0x8c1ce6[_0xbb10('0x2a')];if(_[_0xbb10('0x43')](_0x4975f5[_0xbb10('0x12')][_0x9de708])){_0x4975f5['agents'][_0x9de708]=new Agent(_0x8c1ce6);}else{_0x4975f5[_0xbb10('0x3e')](_0x4975f5['agents'][_0x9de708],_0x8c1ce6);}}}return _0x4975f5['agents'];};};Realtime[_0xbb10('0x3f')][_0xbb10('0x44')]=function(){var _0x26e76a=this;return function(_0x120d21){if(_0x120d21){freeIsNotKeySip(_0x120d21,_0x26e76a[_0xbb10('0x13')]);for(var _0x29d11a=0x0,_0x547062={};_0x29d11a<_0x120d21[_0xbb10('0x41')];_0x29d11a+=0x1){_0x547062=_0x120d21[_0x29d11a];if(_[_0xbb10('0x43')](_0x26e76a['telephones'][util['format']('SIP/%s',_0x547062[_0xbb10('0x29')])])){_0x26e76a[_0xbb10('0x13')][util[_0xbb10('0x2b')]('SIP/%s',_0x547062[_0xbb10('0x29')])]=new Telephone(_0x547062);}else{_0x26e76a[_0xbb10('0x3e')](_0x26e76a[_0xbb10('0x13')][util['format'](_0xbb10('0x28'),_0x547062[_0xbb10('0x29')])],_0x547062);}}}return _0x26e76a[_0xbb10('0x13')];};};Realtime[_0xbb10('0x3f')]['initTrunks']=function(){var _0xd238e9=this;return function(_0x110eb5){if(_0x110eb5){freeIsNotKeySip(_0x110eb5,_0xd238e9['trunks']);for(var _0xe2040f=0x0,_0x2e3214={};_0xe2040f<_0x110eb5[_0xbb10('0x41')];_0xe2040f+=0x1){_0x2e3214=_0x110eb5[_0xe2040f];if(_[_0xbb10('0x43')](_0xd238e9[_0xbb10('0x45')][util[_0xbb10('0x2b')]('SIP/%s',_0x2e3214[_0xbb10('0x29')])])){_0xd238e9[_0xbb10('0x45')][util[_0xbb10('0x2b')](_0xbb10('0x28'),_0x2e3214['name'])]=new Trunk(_0x2e3214);}else{_0xd238e9[_0xbb10('0x3e')](_0xd238e9[_0xbb10('0x45')][util[_0xbb10('0x2b')](_0xbb10('0x28'),_0x2e3214['name'])],_0x2e3214);}}}return _0xd238e9[_0xbb10('0x45')];};};Realtime[_0xbb10('0x3f')]['initTriggers']=function(){var _0x5d9a4f=this;return function(_0x38d78f){if(_0x38d78f){freeIsNotKey(_0x38d78f,_0x5d9a4f['triggers'],'id');for(var _0x318984=0x0,_0x180933={};_0x318984<_0x38d78f['length'];_0x318984+=0x1){_0x180933=_0x38d78f[_0x318984];if(_[_0xbb10('0x43')](_0x5d9a4f[_0xbb10('0x14')][_0x180933['id']])){_0x5d9a4f[_0xbb10('0x14')][_0x180933['id']]=new Trigger(_0x180933);}else{_0x5d9a4f['mergeFromDatabase'](_0x5d9a4f[_0xbb10('0x14')][_0x180933['id']],_0x180933);}}}return _0x5d9a4f[_0xbb10('0x14')];};};Realtime[_0xbb10('0x3f')][_0xbb10('0x46')]=function(){var _0x36e1fa=this;return function(_0x19f94d){if(_0x19f94d){freeIsNotKey(_0x19f94d,_0x36e1fa[_0xbb10('0x16')],'id');for(var _0x3efa96=0x0,_0x205bb4={};_0x3efa96<_0x19f94d[_0xbb10('0x41')];_0x3efa96+=0x1){_0x205bb4=_0x19f94d[_0x3efa96];if(_[_0xbb10('0x43')](_0x36e1fa[_0xbb10('0x16')][_0x205bb4['id']])){_0x36e1fa['templates'][_0x205bb4['id']]=new Template(_0x205bb4);}else{_0x36e1fa[_0xbb10('0x3e')](_0x36e1fa[_0xbb10('0x16')][_0x205bb4['id']],_0x205bb4);}}}return _0x36e1fa['templates'];};};Realtime[_0xbb10('0x3f')][_0xbb10('0x47')]=function(){var _0x1a7df6=this;return function(_0x5a5226){if(_0x5a5226){freeIsNotKey(_0x5a5226,_0x1a7df6[_0xbb10('0x1c')],'id');for(var _0x39f0de=0x0,_0x3e06b0={};_0x39f0de<_0x5a5226['length'];_0x39f0de+=0x1){_0x3e06b0=_0x5a5226[_0x39f0de];if(_['isUndefined'](_0x1a7df6[_0xbb10('0x1c')][_0x3e06b0['id']])){_0x1a7df6[_0xbb10('0x1c')][_0x3e06b0['id']]=new ZendeskAccount(_0x3e06b0);}else{_0x1a7df6[_0xbb10('0x3e')](_0x1a7df6['zendeskAccounts'][_0x3e06b0['id']],_0x3e06b0);}}}return _0x1a7df6['zendeskAccounts'];};};Realtime[_0xbb10('0x3f')][_0xbb10('0x48')]=function(){var _0x1bd054=this;return function(_0xf820fe){if(_0xf820fe){freeIsNotKey(_0xf820fe,_0x1bd054[_0xbb10('0x1d')],'id');for(var _0x22b315=0x0,_0x2f2552={};_0x22b315<_0xf820fe[_0xbb10('0x41')];_0x22b315+=0x1){_0x2f2552=_0xf820fe[_0x22b315];if(_[_0xbb10('0x43')](_0x1bd054[_0xbb10('0x1d')][_0x2f2552['id']])){_0x1bd054['salesforceAccounts'][_0x2f2552['id']]=new SalesforceAccount(_0x2f2552);}else{_0x1bd054['mergeFromDatabase'](_0x1bd054[_0xbb10('0x1d')][_0x2f2552['id']],_0x2f2552);}}}return _0x1bd054[_0xbb10('0x1d')];};};Realtime[_0xbb10('0x3f')][_0xbb10('0x49')]=function(){var _0x36aa7d=this;return function(_0x440f9e){if(_0x440f9e){freeIsNotKey(_0x440f9e,_0x36aa7d[_0xbb10('0x1e')],'id');for(var _0x445870=0x0,_0x1c0d8f={};_0x445870<_0x440f9e[_0xbb10('0x41')];_0x445870+=0x1){_0x1c0d8f=_0x440f9e[_0x445870];if(_[_0xbb10('0x43')](_0x36aa7d[_0xbb10('0x1e')][_0x1c0d8f['id']])){_0x36aa7d[_0xbb10('0x1e')][_0x1c0d8f['id']]=new FreshdeskAccount(_0x1c0d8f);}else{_0x36aa7d[_0xbb10('0x3e')](_0x36aa7d[_0xbb10('0x1e')][_0x1c0d8f['id']],_0x1c0d8f);}}}return _0x36aa7d['freshdeskAccounts'];};};Realtime[_0xbb10('0x3f')]['initZohoAccounts']=function(){var _0x33d60a=this;return function(_0x2e21a0){if(_0x2e21a0){freeIsNotKey(_0x2e21a0,_0x33d60a[_0xbb10('0x1f')],'id');for(var _0x3f27ce=0x0,_0x26e66e={};_0x3f27ce<_0x2e21a0[_0xbb10('0x41')];_0x3f27ce+=0x1){_0x26e66e=_0x2e21a0[_0x3f27ce];if(_[_0xbb10('0x43')](_0x33d60a[_0xbb10('0x1f')][_0x26e66e['id']])){_0x33d60a[_0xbb10('0x1f')][_0x26e66e['id']]=new ZohoAccount(_0x26e66e);}else{_0x33d60a[_0xbb10('0x3e')](_0x33d60a[_0xbb10('0x1f')][_0x26e66e['id']],_0x26e66e);}}}return _0x33d60a[_0xbb10('0x1f')];};};Realtime[_0xbb10('0x3f')][_0xbb10('0x4a')]=function(){var _0x4475e1=this;return function(_0x5de0cc){if(_0x5de0cc){freeIsNotKey(_0x5de0cc,_0x4475e1[_0xbb10('0x20')],'id');for(var _0x466eb7=0x0,_0x1b83a9={};_0x466eb7<_0x5de0cc[_0xbb10('0x41')];_0x466eb7+=0x1){_0x1b83a9=_0x5de0cc[_0x466eb7];if(_[_0xbb10('0x43')](_0x4475e1[_0xbb10('0x20')][_0x1b83a9['id']])){_0x4475e1['deskAccounts'][_0x1b83a9['id']]=new DeskAccount(_0x1b83a9);}else{_0x4475e1[_0xbb10('0x3e')](_0x4475e1[_0xbb10('0x20')][_0x1b83a9['id']],_0x1b83a9);}}}return _0x4475e1[_0xbb10('0x20')];};};Realtime[_0xbb10('0x3f')][_0xbb10('0x4b')]=function(){var _0x22de7f=this;return function(_0x175872){if(_0x175872){freeIsNotKey(_0x175872,_0x22de7f[_0xbb10('0x4c')],'id');for(var _0x205e01=0x0,_0x40c4fb={};_0x205e01<_0x175872[_0xbb10('0x41')];_0x205e01+=0x1){_0x40c4fb=_0x175872[_0x205e01];if(_[_0xbb10('0x43')](_0x22de7f[_0xbb10('0x4c')][_0x40c4fb['id']])){_0x22de7f['sugarcrmAccounts'][_0x40c4fb['id']]=new SugarcrmAccount(_0x40c4fb);}else{_0x22de7f['mergeFromDatabase'](_0x22de7f[_0xbb10('0x4c')][_0x40c4fb['id']],_0x40c4fb);}}}return _0x22de7f[_0xbb10('0x4c')];};};Realtime[_0xbb10('0x3f')][_0xbb10('0x4d')]=function(){var _0x5573bb=this;return function(_0x506498){if(_0x506498){freeIsNotKey(_0x506498,_0x5573bb[_0xbb10('0x21')],'id');for(var _0xaf2cc3=0x0,_0x410bef={};_0xaf2cc3<_0x506498[_0xbb10('0x41')];_0xaf2cc3+=0x1){_0x410bef=_0x506498[_0xaf2cc3];if(_[_0xbb10('0x43')](_0x5573bb[_0xbb10('0x21')][_0x410bef['id']])){_0x5573bb[_0xbb10('0x21')][_0x410bef['id']]=new VtigerAccount(_0x410bef);}else{_0x5573bb['mergeFromDatabase'](_0x5573bb[_0xbb10('0x21')][_0x410bef['id']],_0x410bef);}}}return _0x5573bb[_0xbb10('0x21')];};};Realtime['prototype']['initServicenowAccounts']=function(){var _0x5a231f=this;return function(_0x32c1e8){if(_0x32c1e8){freeIsNotKey(_0x32c1e8,_0x5a231f[_0xbb10('0x22')],'id');for(var _0x155dc5=0x0,_0x5bd1c0={};_0x155dc5<_0x32c1e8['length'];_0x155dc5+=0x1){_0x5bd1c0=_0x32c1e8[_0x155dc5];if(_['isUndefined'](_0x5a231f[_0xbb10('0x22')][_0x5bd1c0['id']])){_0x5a231f[_0xbb10('0x22')][_0x5bd1c0['id']]=new ServicenowAccount(_0x5bd1c0);}else{_0x5a231f[_0xbb10('0x3e')](_0x5a231f['servicenowAccounts'][_0x5bd1c0['id']],_0x5bd1c0);}}}return _0x5a231f[_0xbb10('0x22')];};};Realtime[_0xbb10('0x3f')]['initDynamics365Accounts']=function(){var _0x4a560c=this;return function(_0x27d7b9){if(_0x27d7b9){freeIsNotKey(_0x27d7b9,_0x4a560c[_0xbb10('0x23')],'id');for(var _0xd77753=0x0,_0x237246={};_0xd77753<_0x27d7b9['length'];_0xd77753+=0x1){_0x237246=_0x27d7b9[_0xd77753];if(_[_0xbb10('0x43')](_0x4a560c[_0xbb10('0x23')][_0x237246['id']])){_0x4a560c[_0xbb10('0x23')][_0x237246['id']]=new Dynamics365Account(_0x237246);}else{_0x4a560c['mergeFromDatabase'](_0x4a560c[_0xbb10('0x23')][_0x237246['id']],_0x237246);}}}return _0x4a560c[_0xbb10('0x23')];};};Realtime[_0xbb10('0x3f')]['initFreshsalesAccounts']=function(){var _0x2ca491=this;return function(_0x31e85e){if(_0x31e85e){freeIsNotKey(_0x31e85e,_0x2ca491[_0xbb10('0x24')],'id');for(var _0x37b65f=0x0,_0x5e4a6e={};_0x37b65f<_0x31e85e[_0xbb10('0x41')];_0x37b65f+=0x1){_0x5e4a6e=_0x31e85e[_0x37b65f];if(_[_0xbb10('0x43')](_0x2ca491[_0xbb10('0x24')][_0x5e4a6e['id']])){_0x2ca491[_0xbb10('0x24')][_0x5e4a6e['id']]=new FreshsalesAccount(_0x5e4a6e);}else{_0x2ca491['mergeFromDatabase'](_0x2ca491[_0xbb10('0x24')][_0x5e4a6e['id']],_0x5e4a6e);}}}return _0x2ca491[_0xbb10('0x24')];};};Realtime[_0xbb10('0x3f')][_0xbb10('0x4e')]=function(){var _0x12f750=this;return function(_0x17807e){for(var _0x1e4694=0x0;_0x1e4694<_0x17807e['length'];_0x1e4694+=0x1){_['merge'](_0x12f750['voiceQueues'][_0x17807e[_0x1e4694][_0xbb10('0x29')]],_0x17807e[_0x1e4694]);}return _0x12f750[_0xbb10('0x4f')];};};Realtime[_0xbb10('0x3f')]['initVoiceQueueReports']=function(){var _0x5cd089=this;return function(_0x46f462){clearVoiceQueues(_0x5cd089[_0xbb10('0x4f')]);if(_0x46f462){_0x46f462=_[_0xbb10('0x50')](_0x46f462,_0xbb10('0x51'));for(var _0x260e06 in _0x46f462){if(_0x46f462[_0xbb10('0x27')](_0x260e06)){for(var _0x4cf2f3=0x0;_0x4cf2f3<_0x46f462[_0x260e06][_0xbb10('0x41')];_0x4cf2f3+=0x1){var _0x15fae2=_0x46f462[_0x260e06][_0x4cf2f3][_0xbb10('0x52')];if(_0x5cd089[_0xbb10('0x4f')][_0x15fae2]){if(_0x46f462[_0x260e06][_0x4cf2f3][_0xbb10('0x53')]){_0x5cd089['voiceQueues'][_0x15fae2]['unmanaged']+=0x1;}if(_0x46f462[_0x260e06][_0x4cf2f3]['queuecallerabandon']){_0x5cd089[_0xbb10('0x4f')][_0x15fae2][_0xbb10('0x54')]+=0x1;}_0x5cd089[_0xbb10('0x4f')][_0x15fae2][_0xbb10('0x2e')]+=moment(_0x46f462[_0x260e06][_0x4cf2f3][_0xbb10('0x55')])[_0xbb10('0x56')](moment(_0x46f462[_0x260e06][_0x4cf2f3]['queuecallerjoinAt']),_0xbb10('0x57'))||0x0;if(_0x4cf2f3===_0x46f462[_0x260e06]['length']-0x1){_0x5cd089['voiceQueues'][_0x15fae2]['sumDuration']+=moment(_0x46f462[_0x260e06][_0x4cf2f3][_0xbb10('0x58')]||_0x46f462[_0x260e06][_0x4cf2f3][_0xbb10('0x59')]||_0x46f462[_0x260e06][_0x4cf2f3][_0xbb10('0x5a')])[_0xbb10('0x56')](moment(_0x46f462[_0x260e06][_0x4cf2f3]['queuecallerjoinAt']),_0xbb10('0x57'))||0x0;_0x5cd089['voiceQueues'][_0x15fae2]['total']+=0x1;if(_0x46f462[_0x260e06][_0x4cf2f3][_0xbb10('0x5b')]){_0x5cd089[_0xbb10('0x4f')][_0x15fae2][_0xbb10('0x2d')]+=0x1;_0x5cd089[_0xbb10('0x4f')][_0x15fae2][_0xbb10('0x33')]+=moment(_0x46f462[_0x260e06][_0x4cf2f3]['queuecallercompleteAt'])[_0xbb10('0x56')](moment(_0x46f462[_0x260e06][_0x4cf2f3][_0xbb10('0x55')]),_0xbb10('0x57'))||0x0;}}else{_0x5cd089[_0xbb10('0x4f')][_0x15fae2][_0xbb10('0x2f')]+=_0x5cd089[_0xbb10('0x4f')][_0x15fae2][_0xbb10('0x2e')]||0x0;}}}}}}return _0x5cd089['voiceQueues'];};};Realtime[_0xbb10('0x3f')][_0xbb10('0x5c')]=function(){var _0x30f3ea=this;return function(_0x322b41){clearVoiceCallReports(_0x30f3ea[_0xbb10('0x5d')]);if(_0x322b41){for(var _0x172be3=0x0;_0x172be3<_0x322b41[_0xbb10('0x41')];_0x172be3+=0x1){_0x30f3ea[_0xbb10('0x5d')]['total']+=0x1;_0x30f3ea[_0xbb10('0x5d')][_0xbb10('0x2f')]+=_0x322b41[_0x172be3][_0xbb10('0x5e')];if(_0x322b41[_0x172be3]['disposition']==='ANSWERED'){_0x30f3ea['outbound'][_0xbb10('0x2d')]+=0x1;_0x30f3ea['outbound']['sumHoldTime']+=_0x322b41[_0x172be3][_0xbb10('0x5e')]-_0x322b41[_0x172be3][_0xbb10('0x5f')]||0x0;_0x30f3ea[_0xbb10('0x5d')][_0xbb10('0x33')]+=_0x322b41[_0x172be3][_0xbb10('0x5f')];}}}return _0x30f3ea[_0xbb10('0x5d')];};};Realtime[_0xbb10('0x3f')][_0xbb10('0x60')]=function(){var _0x188b97=this;return function(_0x5206e1){if(_0x5206e1){freeIsNotKey(_0x5206e1,_0x188b97[_0xbb10('0x15')],_0xbb10('0x29'));for(var _0x46b6d2=0x0,_0x35b811={};_0x46b6d2<_0x5206e1['length'];_0x46b6d2+=0x1){_0x35b811=_0x5206e1[_0x46b6d2];if(_['isUndefined'](_0x188b97[_0xbb10('0x15')][_0x35b811[_0xbb10('0x29')]])){_0x188b97[_0xbb10('0x15')][_0x35b811[_0xbb10('0x29')]]=new Campaign(_0x35b811);}else{_0x188b97['mergeFromDatabase'](_0x188b97[_0xbb10('0x15')][_0x35b811[_0xbb10('0x29')]],_0x35b811);_0x188b97[_0xbb10('0x15')][_0x35b811[_0xbb10('0x29')]][_0xbb10('0x61')]=_0x35b811['SquareProject']?_0x35b811['SquareProject'][_0xbb10('0x29')]:undefined;}}}return _0x188b97[_0xbb10('0x15')];};};Realtime[_0xbb10('0x3f')]['initVoiceExtensions']=function(){var _0x256b35=this;return function(_0x13e2ab){if(_0x13e2ab){freeIsNotKey(_0x13e2ab,_0x256b35['voiceExtensions'],'id');for(var _0x5caa06=0x0,_0x2f667f={};_0x5caa06<_0x13e2ab[_0xbb10('0x41')];_0x5caa06+=0x1){_0x2f667f=_0x13e2ab[_0x5caa06];if(_[_0xbb10('0x43')](_0x256b35['voiceExtensions'][_0x2f667f['id']])){_0x256b35[_0xbb10('0x17')][_0x2f667f['id']]=new VoiceExtension(_0x2f667f);}else{_0x256b35[_0xbb10('0x3e')](_0x256b35[_0xbb10('0x17')][_0x2f667f['id']],_0x2f667f);}}}return _0x256b35[_0xbb10('0x17')];};};Realtime[_0xbb10('0x3f')][_0xbb10('0x62')]=function(){var _0x45bd4e=this;return function(_0x226363){clearCampaigns(_0x45bd4e[_0xbb10('0x15')]);for(var _0x479d51=0x0;_0x479d51<_0x226363[_0xbb10('0x41')];_0x479d51+=0x1){_[_0xbb10('0x63')](_0x45bd4e[_0xbb10('0x15')][_0x226363[_0x479d51][_0xbb10('0x29')]],_0x226363[_0x479d51]);}return _0x45bd4e[_0xbb10('0x15')];};};Realtime[_0xbb10('0x3f')][_0xbb10('0x64')]=function(){var _0x305d52=this;return function(_0x17ed20){if(_0x17ed20){freeIsNotKey(_0x17ed20,_0x305d52[_0xbb10('0x25')],'id');for(var _0x15e043=0x0,_0x2a4278={};_0x15e043<_0x17ed20['length'];_0x15e043+=0x1){_0x2a4278=_0x17ed20[_0x15e043];if(_['isUndefined'](_0x305d52[_0xbb10('0x25')][_0x2a4278['id']])){_0x305d52[_0xbb10('0x25')][_0x2a4278['id']]=new FaxAccount(_0x2a4278);}else{_0x305d52[_0xbb10('0x3e')](_0x305d52[_0xbb10('0x25')][_0x2a4278['id']],_0x2a4278);}}}return _0x305d52[_0xbb10('0x25')];};};Realtime['prototype'][_0xbb10('0x65')]=function(){var _0x332fbe=this;return function(_0x3b4d0b){if(_0x3b4d0b){freeIsNotKey(_0x3b4d0b,_0x332fbe[_0xbb10('0x4f')],_0xbb10('0x29'));for(var _0x379d49=0x0,_0x546db5={};_0x379d49<_0x3b4d0b[_0xbb10('0x41')];_0x379d49+=0x1){_0x546db5=_0x3b4d0b[_0x379d49];if(_[_0xbb10('0x43')](_0x332fbe['voiceQueues'][_0x546db5[_0xbb10('0x29')]])){_0x332fbe['voiceQueues'][_0x546db5[_0xbb10('0x29')]]=new VoiceQueue(_0x546db5);}else{_0x332fbe[_0xbb10('0x3e')](_0x332fbe[_0xbb10('0x4f')][_0x546db5[_0xbb10('0x29')]],_0x546db5);}}}return _0x332fbe[_0xbb10('0x4f')];};};module['exports']=Realtime; \ No newline at end of file +var _0xdb28=['initTriggers','triggers','initTemplates','initZendeskAccounts','zendeskAccounts','initFreshdeskAccounts','initZohoAccounts','initDeskAccounts','initSugarcrmAccounts','initVtigerAccounts','initServicenowAccounts','initDynamics365Accounts','initFreshsalesAccounts','initVoiceQueueHopperHistory','merge','groupBy','uniqueid','queuecallerexit','queuecallerabandon','queuecallerjoinAt','seconds','queuecallercompleteAt','queuecallerabandonAt','queuecallerexitAt','diff','queuecallercomplete','queuecallerleaveAt','initVoiceCallReports','outbound','duration','disposition','ANSWERED','billableseconds','initCampaigns','dialQueueProject','SquareProject','initVoiceExtensions','initCampaignHopperHistory','initVoiceQueues','exports','lodash','moment','util','../model/agent','../model/trunk','../model/voiceQueue','../model/trigger','../model/template','../model/campaign','../model/zendeskAccount','../model/salesforceAccount','../model/zohoAccount','../model/deskAccount','../model/vtigerAccount','../model/servicenowAccount','../model/dynamics365Account','../model/freshsalesAccount','../model/faxAccount','telephones','trunks','voiceQueues','campaigns','templates','voiceExtensions','channels','queueChannels','outboundChannels','timers','salesforceAccounts','sugarcrmAccounts','freshdeskAccounts','zohoAccounts','deskAccounts','vtigerAccounts','servicenowAccounts','dynamics365Accounts','freshsalesAccounts','faxAccounts','mapKeys','hasOwnProperty','format','SIP/%s','name','isNil','interface','sumDuration','sumBillable','isEmpty','ivrAnswerCallsDay','total','answered','unmanaged','abandoned','sumHoldTime','outboundAnswerAgiCallsDay','outboundNoAnswerCallsDay','outboundCongestionCallsDay','outboundDropCallsDayTimeout','outboundDropCallsDayCallersExit','outboundBlacklistCallsDay','outboundRejectCallsDay','outboundAnswerCallsDay','queueStatusComplete','prototype','initAgents','agents','length','isUndefined','mergeFromDatabase','initTelephones','initTrunks'];(function(_0x194816,_0xb9eb1){var _0x247ab8=function(_0x37f87c){while(--_0x37f87c){_0x194816['push'](_0x194816['shift']());}};_0x247ab8(++_0xb9eb1);}(_0xdb28,0x106));var _0x8db2=function(_0x4e14a8,_0x5764c1){_0x4e14a8=_0x4e14a8-0x0;var _0x1e0824=_0xdb28[_0x4e14a8];return _0x1e0824;};'use strict';var _=require(_0x8db2('0x0'));var moment=require(_0x8db2('0x1'));var util=require(_0x8db2('0x2'));var Agent=require(_0x8db2('0x3'));var Telephone=require('../model/telephone');var Trunk=require(_0x8db2('0x4'));var VoiceQueue=require(_0x8db2('0x5'));var Trigger=require(_0x8db2('0x6'));var Template=require(_0x8db2('0x7'));var Campaign=require(_0x8db2('0x8'));var VoiceExtension=require('../model/voiceExtension');var ZendeskAccount=require(_0x8db2('0x9'));var SalesforceAccount=require(_0x8db2('0xa'));var FreshdeskAccount=require('../model/freshdeskAccount');var SugarcrmAccount=require('../model/sugarcrmAccount');var ZohoAccount=require(_0x8db2('0xb'));var DeskAccount=require(_0x8db2('0xc'));var VtigerAccount=require(_0x8db2('0xd'));var ServicenowAccount=require(_0x8db2('0xe'));var Dynamics365Account=require(_0x8db2('0xf'));var FreshsalesAccount=require(_0x8db2('0x10'));var FaxAccount=require(_0x8db2('0x11'));function Realtime(){this['agents']={};this[_0x8db2('0x12')]={};this[_0x8db2('0x13')]={};this[_0x8db2('0x14')]={};this['triggers']={};this[_0x8db2('0x15')]={};this[_0x8db2('0x16')]={};this['outbound']={'total':0x0,'answered':0x0,'sumHoldTime':0x0,'sumDuration':0x0,'sumBillable':0x0};this[_0x8db2('0x17')]={};this[_0x8db2('0x18')]={};this[_0x8db2('0x19')]={};this[_0x8db2('0x1a')]={};this[_0x8db2('0x1b')]={};this['settings']={};this['zendeskAccounts']={};this[_0x8db2('0x1c')]={};this[_0x8db2('0x1d')]={};this[_0x8db2('0x1e')]={};this[_0x8db2('0x1f')]={};this[_0x8db2('0x20')]={};this[_0x8db2('0x21')]={};this[_0x8db2('0x22')]={};this[_0x8db2('0x23')]={};this[_0x8db2('0x24')]={};this[_0x8db2('0x25')]={};}function freeIsNotKey(_0x5489a9,_0x13b0f5,_0x24da1b){var _0x48101e=_[_0x8db2('0x26')](_0x5489a9,function(_0x44957d){return _0x44957d[_0x24da1b];});for(var _0x21db8c in _0x13b0f5){if(_0x13b0f5[_0x8db2('0x27')](_0x21db8c)){if(!_0x48101e[_0x21db8c]){delete _0x13b0f5[_0x21db8c];}}}}function freeIsNotKeySip(_0x2efd06,_0x46ce14){var _0x51d60d=_['mapKeys'](_0x2efd06,function(_0x77789){return util[_0x8db2('0x28')](_0x8db2('0x29'),_0x77789[_0x8db2('0x2a')]);});for(var _0x58562e in _0x46ce14){if(_0x46ce14[_0x8db2('0x27')](_0x58562e)){if(!_0x51d60d[_0x58562e]){delete _0x46ce14[_0x58562e];}}}}function freeIsNotKeyAgent(_0x36a9ff,_0x260940){var _0x297ba3=_[_0x8db2('0x26')](_0x36a9ff,function(_0x597260){var _0x124467=_[_0x8db2('0x2b')](_0x597260[_0x8db2('0x2c')])?util[_0x8db2('0x28')](_0x8db2('0x29'),_0x597260[_0x8db2('0x2a')]):_0x597260[_0x8db2('0x2c')];return _0x124467;});for(var _0x5c6614 in _0x260940){if(_0x260940[_0x8db2('0x27')](_0x5c6614)){if(!_0x297ba3[_0x5c6614]){delete _0x260940[_0x5c6614];}}}}function clearVoiceCallReports(_0x4f6516){_0x4f6516['total']=0x0;_0x4f6516['answered']=0x0;_0x4f6516['sumHoldTime']=0x0;_0x4f6516[_0x8db2('0x2d')]=0x0;_0x4f6516[_0x8db2('0x2e')]=0x0;}function clearCampaigns(_0x3be281){if(!_[_0x8db2('0x2f')](_0x3be281)){for(var _0x145328 in _0x3be281){if(_0x3be281[_0x8db2('0x27')](_0x145328)){_0x3be281[_0x145328]['ivrTotalCallsDays']=0x0;_0x3be281[_0x145328][_0x8db2('0x30')]=0x0;}}}}function clearVoiceQueues(_0x372311){if(!_[_0x8db2('0x2f')](_0x372311)){for(var _0x8b7cec in _0x372311){if(_0x372311['hasOwnProperty'](_0x8b7cec)){_0x372311[_0x8b7cec][_0x8db2('0x31')]=0x0;_0x372311[_0x8b7cec][_0x8db2('0x32')]=0x0;_0x372311[_0x8b7cec][_0x8db2('0x33')]=0x0;_0x372311[_0x8b7cec][_0x8db2('0x34')]=0x0;_0x372311[_0x8b7cec][_0x8db2('0x35')]=0x0;_0x372311[_0x8b7cec][_0x8db2('0x2d')]=0x0;_0x372311[_0x8b7cec][_0x8db2('0x2e')]=0x0;_0x372311[_0x8b7cec][_0x8db2('0x36')]=0x0;_0x372311[_0x8b7cec][_0x8db2('0x37')]=0x0;_0x372311[_0x8b7cec]['outboundBusyCallsDay']=0x0;_0x372311[_0x8b7cec][_0x8db2('0x38')]=0x0;_0x372311[_0x8b7cec]['outboundNoSuchCallsDay']=0x0;_0x372311[_0x8b7cec]['outboundUnknownCallsDay']=0x0;_0x372311[_0x8b7cec][_0x8db2('0x39')]=0x0;_0x372311[_0x8b7cec][_0x8db2('0x3a')]=0x0;_0x372311[_0x8b7cec][_0x8db2('0x3b')]=0x0;_0x372311[_0x8b7cec]['outboundOriginateFailureCallsDay']=0x0;_0x372311[_0x8b7cec][_0x8db2('0x3c')]=0x0;_0x372311[_0x8b7cec]['outboundReCallsDay']=0x0;_0x372311[_0x8b7cec][_0x8db2('0x36')]=0x0;_0x372311[_0x8b7cec][_0x8db2('0x3d')]=0x0;_0x372311[_0x8b7cec][_0x8db2('0x3e')]=!![];}}}}Realtime['prototype']['mergeFromDatabase']=function(_0x35d337,_0x1a460b){for(var _0x4df530 in _0x1a460b){if(_0x35d337['hasOwnProperty'](_0x4df530)){_0x35d337[_0x4df530]=_0x1a460b[_0x4df530];}}};Realtime[_0x8db2('0x3f')][_0x8db2('0x40')]=function(){var _0xc884a=this;return function(_0x2a2d65){if(_0x2a2d65){freeIsNotKeyAgent(_0x2a2d65,_0xc884a[_0x8db2('0x41')]);for(var _0xd39848=0x0,_0x101711={};_0xd39848<_0x2a2d65[_0x8db2('0x42')];_0xd39848+=0x1){_0x101711=_0x2a2d65[_0xd39848];var _0x46e0c8=_[_0x8db2('0x2b')](_0x101711['interface'])?util[_0x8db2('0x28')](_0x8db2('0x29'),_0x101711['name']):_0x101711[_0x8db2('0x2c')];if(_[_0x8db2('0x43')](_0xc884a['agents'][_0x46e0c8])){_0xc884a['agents'][_0x46e0c8]=new Agent(_0x101711);}else{_0xc884a[_0x8db2('0x44')](_0xc884a['agents'][_0x46e0c8],_0x101711);}}}return _0xc884a[_0x8db2('0x41')];};};Realtime[_0x8db2('0x3f')][_0x8db2('0x45')]=function(){var _0x22c896=this;return function(_0x5cc419){if(_0x5cc419){freeIsNotKeySip(_0x5cc419,_0x22c896[_0x8db2('0x12')]);for(var _0x5e34e0=0x0,_0x227a08={};_0x5e34e0<_0x5cc419[_0x8db2('0x42')];_0x5e34e0+=0x1){_0x227a08=_0x5cc419[_0x5e34e0];if(_[_0x8db2('0x43')](_0x22c896[_0x8db2('0x12')][util['format']('SIP/%s',_0x227a08[_0x8db2('0x2a')])])){_0x22c896[_0x8db2('0x12')][util['format'](_0x8db2('0x29'),_0x227a08[_0x8db2('0x2a')])]=new Telephone(_0x227a08);}else{_0x22c896[_0x8db2('0x44')](_0x22c896['telephones'][util[_0x8db2('0x28')](_0x8db2('0x29'),_0x227a08[_0x8db2('0x2a')])],_0x227a08);}}}return _0x22c896[_0x8db2('0x12')];};};Realtime[_0x8db2('0x3f')][_0x8db2('0x46')]=function(){var _0x380046=this;return function(_0x1575ea){if(_0x1575ea){freeIsNotKeySip(_0x1575ea,_0x380046[_0x8db2('0x13')]);for(var _0x63c561=0x0,_0x21cf7c={};_0x63c561<_0x1575ea[_0x8db2('0x42')];_0x63c561+=0x1){_0x21cf7c=_0x1575ea[_0x63c561];if(_[_0x8db2('0x43')](_0x380046['trunks'][util[_0x8db2('0x28')](_0x8db2('0x29'),_0x21cf7c['name'])])){_0x380046['trunks'][util[_0x8db2('0x28')]('SIP/%s',_0x21cf7c[_0x8db2('0x2a')])]=new Trunk(_0x21cf7c);}else{_0x380046[_0x8db2('0x44')](_0x380046[_0x8db2('0x13')][util[_0x8db2('0x28')](_0x8db2('0x29'),_0x21cf7c[_0x8db2('0x2a')])],_0x21cf7c);}}}return _0x380046[_0x8db2('0x13')];};};Realtime['prototype'][_0x8db2('0x47')]=function(){var _0x3d44de=this;return function(_0x40c69e){if(_0x40c69e){freeIsNotKey(_0x40c69e,_0x3d44de[_0x8db2('0x48')],'id');for(var _0x482b26=0x0,_0x424c27={};_0x482b26<_0x40c69e[_0x8db2('0x42')];_0x482b26+=0x1){_0x424c27=_0x40c69e[_0x482b26];if(_[_0x8db2('0x43')](_0x3d44de[_0x8db2('0x48')][_0x424c27['id']])){_0x3d44de['triggers'][_0x424c27['id']]=new Trigger(_0x424c27);}else{_0x3d44de[_0x8db2('0x44')](_0x3d44de['triggers'][_0x424c27['id']],_0x424c27);}}}return _0x3d44de[_0x8db2('0x48')];};};Realtime[_0x8db2('0x3f')][_0x8db2('0x49')]=function(){var _0x4d2164=this;return function(_0x4b0e72){if(_0x4b0e72){freeIsNotKey(_0x4b0e72,_0x4d2164[_0x8db2('0x16')],'id');for(var _0x47c556=0x0,_0x173cc7={};_0x47c556<_0x4b0e72[_0x8db2('0x42')];_0x47c556+=0x1){_0x173cc7=_0x4b0e72[_0x47c556];if(_[_0x8db2('0x43')](_0x4d2164[_0x8db2('0x16')][_0x173cc7['id']])){_0x4d2164[_0x8db2('0x16')][_0x173cc7['id']]=new Template(_0x173cc7);}else{_0x4d2164[_0x8db2('0x44')](_0x4d2164[_0x8db2('0x16')][_0x173cc7['id']],_0x173cc7);}}}return _0x4d2164[_0x8db2('0x16')];};};Realtime[_0x8db2('0x3f')][_0x8db2('0x4a')]=function(){var _0x1362ed=this;return function(_0x36f9d6){if(_0x36f9d6){freeIsNotKey(_0x36f9d6,_0x1362ed['zendeskAccounts'],'id');for(var _0x449109=0x0,_0x2ada52={};_0x449109<_0x36f9d6[_0x8db2('0x42')];_0x449109+=0x1){_0x2ada52=_0x36f9d6[_0x449109];if(_[_0x8db2('0x43')](_0x1362ed['zendeskAccounts'][_0x2ada52['id']])){_0x1362ed['zendeskAccounts'][_0x2ada52['id']]=new ZendeskAccount(_0x2ada52);}else{_0x1362ed[_0x8db2('0x44')](_0x1362ed[_0x8db2('0x4b')][_0x2ada52['id']],_0x2ada52);}}}return _0x1362ed[_0x8db2('0x4b')];};};Realtime['prototype']['initSalesforceAccounts']=function(){var _0x494d6e=this;return function(_0x44ac56){if(_0x44ac56){freeIsNotKey(_0x44ac56,_0x494d6e[_0x8db2('0x1c')],'id');for(var _0x55c7dd=0x0,_0x383fa1={};_0x55c7dd<_0x44ac56[_0x8db2('0x42')];_0x55c7dd+=0x1){_0x383fa1=_0x44ac56[_0x55c7dd];if(_[_0x8db2('0x43')](_0x494d6e[_0x8db2('0x1c')][_0x383fa1['id']])){_0x494d6e['salesforceAccounts'][_0x383fa1['id']]=new SalesforceAccount(_0x383fa1);}else{_0x494d6e['mergeFromDatabase'](_0x494d6e[_0x8db2('0x1c')][_0x383fa1['id']],_0x383fa1);}}}return _0x494d6e[_0x8db2('0x1c')];};};Realtime[_0x8db2('0x3f')][_0x8db2('0x4c')]=function(){var _0x3daed6=this;return function(_0x2bf408){if(_0x2bf408){freeIsNotKey(_0x2bf408,_0x3daed6[_0x8db2('0x1e')],'id');for(var _0x3ca2a7=0x0,_0x4187d6={};_0x3ca2a7<_0x2bf408[_0x8db2('0x42')];_0x3ca2a7+=0x1){_0x4187d6=_0x2bf408[_0x3ca2a7];if(_[_0x8db2('0x43')](_0x3daed6[_0x8db2('0x1e')][_0x4187d6['id']])){_0x3daed6[_0x8db2('0x1e')][_0x4187d6['id']]=new FreshdeskAccount(_0x4187d6);}else{_0x3daed6[_0x8db2('0x44')](_0x3daed6[_0x8db2('0x1e')][_0x4187d6['id']],_0x4187d6);}}}return _0x3daed6['freshdeskAccounts'];};};Realtime[_0x8db2('0x3f')][_0x8db2('0x4d')]=function(){var _0x579317=this;return function(_0x27b644){if(_0x27b644){freeIsNotKey(_0x27b644,_0x579317[_0x8db2('0x1f')],'id');for(var _0x3af298=0x0,_0x547215={};_0x3af298<_0x27b644[_0x8db2('0x42')];_0x3af298+=0x1){_0x547215=_0x27b644[_0x3af298];if(_[_0x8db2('0x43')](_0x579317[_0x8db2('0x1f')][_0x547215['id']])){_0x579317[_0x8db2('0x1f')][_0x547215['id']]=new ZohoAccount(_0x547215);}else{_0x579317[_0x8db2('0x44')](_0x579317['zohoAccounts'][_0x547215['id']],_0x547215);}}}return _0x579317[_0x8db2('0x1f')];};};Realtime[_0x8db2('0x3f')][_0x8db2('0x4e')]=function(){var _0x58bb60=this;return function(_0x1e7d1a){if(_0x1e7d1a){freeIsNotKey(_0x1e7d1a,_0x58bb60[_0x8db2('0x20')],'id');for(var _0x33dddd=0x0,_0x7b0de8={};_0x33dddd<_0x1e7d1a[_0x8db2('0x42')];_0x33dddd+=0x1){_0x7b0de8=_0x1e7d1a[_0x33dddd];if(_[_0x8db2('0x43')](_0x58bb60[_0x8db2('0x20')][_0x7b0de8['id']])){_0x58bb60['deskAccounts'][_0x7b0de8['id']]=new DeskAccount(_0x7b0de8);}else{_0x58bb60[_0x8db2('0x44')](_0x58bb60[_0x8db2('0x20')][_0x7b0de8['id']],_0x7b0de8);}}}return _0x58bb60['deskAccounts'];};};Realtime[_0x8db2('0x3f')][_0x8db2('0x4f')]=function(){var _0x533e41=this;return function(_0x107bbe){if(_0x107bbe){freeIsNotKey(_0x107bbe,_0x533e41[_0x8db2('0x1d')],'id');for(var _0x63e8f7=0x0,_0x30f4f3={};_0x63e8f7<_0x107bbe[_0x8db2('0x42')];_0x63e8f7+=0x1){_0x30f4f3=_0x107bbe[_0x63e8f7];if(_[_0x8db2('0x43')](_0x533e41[_0x8db2('0x1d')][_0x30f4f3['id']])){_0x533e41[_0x8db2('0x1d')][_0x30f4f3['id']]=new SugarcrmAccount(_0x30f4f3);}else{_0x533e41[_0x8db2('0x44')](_0x533e41[_0x8db2('0x1d')][_0x30f4f3['id']],_0x30f4f3);}}}return _0x533e41[_0x8db2('0x1d')];};};Realtime[_0x8db2('0x3f')][_0x8db2('0x50')]=function(){var _0x1ce89f=this;return function(_0x64ec90){if(_0x64ec90){freeIsNotKey(_0x64ec90,_0x1ce89f[_0x8db2('0x21')],'id');for(var _0x4a20a7=0x0,_0xe0c3e={};_0x4a20a7<_0x64ec90[_0x8db2('0x42')];_0x4a20a7+=0x1){_0xe0c3e=_0x64ec90[_0x4a20a7];if(_[_0x8db2('0x43')](_0x1ce89f[_0x8db2('0x21')][_0xe0c3e['id']])){_0x1ce89f[_0x8db2('0x21')][_0xe0c3e['id']]=new VtigerAccount(_0xe0c3e);}else{_0x1ce89f['mergeFromDatabase'](_0x1ce89f[_0x8db2('0x21')][_0xe0c3e['id']],_0xe0c3e);}}}return _0x1ce89f[_0x8db2('0x21')];};};Realtime[_0x8db2('0x3f')][_0x8db2('0x51')]=function(){var _0x2ad70f=this;return function(_0x348da8){if(_0x348da8){freeIsNotKey(_0x348da8,_0x2ad70f[_0x8db2('0x22')],'id');for(var _0x2c7b04=0x0,_0x24cfe9={};_0x2c7b04<_0x348da8[_0x8db2('0x42')];_0x2c7b04+=0x1){_0x24cfe9=_0x348da8[_0x2c7b04];if(_[_0x8db2('0x43')](_0x2ad70f[_0x8db2('0x22')][_0x24cfe9['id']])){_0x2ad70f[_0x8db2('0x22')][_0x24cfe9['id']]=new ServicenowAccount(_0x24cfe9);}else{_0x2ad70f[_0x8db2('0x44')](_0x2ad70f[_0x8db2('0x22')][_0x24cfe9['id']],_0x24cfe9);}}}return _0x2ad70f[_0x8db2('0x22')];};};Realtime[_0x8db2('0x3f')][_0x8db2('0x52')]=function(){var _0x5a719f=this;return function(_0x3273dd){if(_0x3273dd){freeIsNotKey(_0x3273dd,_0x5a719f['dynamics365Accounts'],'id');for(var _0x364176=0x0,_0x570c53={};_0x364176<_0x3273dd[_0x8db2('0x42')];_0x364176+=0x1){_0x570c53=_0x3273dd[_0x364176];if(_[_0x8db2('0x43')](_0x5a719f[_0x8db2('0x23')][_0x570c53['id']])){_0x5a719f[_0x8db2('0x23')][_0x570c53['id']]=new Dynamics365Account(_0x570c53);}else{_0x5a719f[_0x8db2('0x44')](_0x5a719f['dynamics365Accounts'][_0x570c53['id']],_0x570c53);}}}return _0x5a719f['dynamics365Accounts'];};};Realtime[_0x8db2('0x3f')][_0x8db2('0x53')]=function(){var _0x21ec87=this;return function(_0x3ba1d2){if(_0x3ba1d2){freeIsNotKey(_0x3ba1d2,_0x21ec87[_0x8db2('0x24')],'id');for(var _0x1f28d2=0x0,_0x3e3de3={};_0x1f28d2<_0x3ba1d2[_0x8db2('0x42')];_0x1f28d2+=0x1){_0x3e3de3=_0x3ba1d2[_0x1f28d2];if(_['isUndefined'](_0x21ec87[_0x8db2('0x24')][_0x3e3de3['id']])){_0x21ec87[_0x8db2('0x24')][_0x3e3de3['id']]=new FreshsalesAccount(_0x3e3de3);}else{_0x21ec87[_0x8db2('0x44')](_0x21ec87[_0x8db2('0x24')][_0x3e3de3['id']],_0x3e3de3);}}}return _0x21ec87[_0x8db2('0x24')];};};Realtime[_0x8db2('0x3f')][_0x8db2('0x54')]=function(){var _0x20caf0=this;return function(_0x4938bb){for(var _0x54318c=0x0;_0x54318c<_0x4938bb[_0x8db2('0x42')];_0x54318c+=0x1){_[_0x8db2('0x55')](_0x20caf0[_0x8db2('0x14')][_0x4938bb[_0x54318c][_0x8db2('0x2a')]],_0x4938bb[_0x54318c]);}return _0x20caf0[_0x8db2('0x14')];};};Realtime['prototype']['initVoiceQueueReports']=function(){var _0x3611da=this;return function(_0x364807){clearVoiceQueues(_0x3611da['voiceQueues']);if(_0x364807){_0x364807=_[_0x8db2('0x56')](_0x364807,_0x8db2('0x57'));for(var _0x1ab84c in _0x364807){if(_0x364807['hasOwnProperty'](_0x1ab84c)){for(var _0x26523b=0x0;_0x26523b<_0x364807[_0x1ab84c][_0x8db2('0x42')];_0x26523b+=0x1){var _0x2cf731=_0x364807[_0x1ab84c][_0x26523b]['queue'];if(_0x3611da[_0x8db2('0x14')][_0x2cf731]){if(_0x364807[_0x1ab84c][_0x26523b][_0x8db2('0x58')]){_0x3611da[_0x8db2('0x14')][_0x2cf731][_0x8db2('0x33')]+=0x1;}if(_0x364807[_0x1ab84c][_0x26523b][_0x8db2('0x59')]){_0x3611da['voiceQueues'][_0x2cf731][_0x8db2('0x34')]+=0x1;}_0x3611da[_0x8db2('0x14')][_0x2cf731][_0x8db2('0x35')]+=moment(_0x364807[_0x1ab84c][_0x26523b]['queuecallerleaveAt'])['diff'](moment(_0x364807[_0x1ab84c][_0x26523b][_0x8db2('0x5a')]),_0x8db2('0x5b'))||0x0;if(_0x26523b===_0x364807[_0x1ab84c]['length']-0x1){_0x3611da[_0x8db2('0x14')][_0x2cf731][_0x8db2('0x2d')]+=moment(_0x364807[_0x1ab84c][_0x26523b][_0x8db2('0x5c')]||_0x364807[_0x1ab84c][_0x26523b][_0x8db2('0x5d')]||_0x364807[_0x1ab84c][_0x26523b][_0x8db2('0x5e')])[_0x8db2('0x5f')](moment(_0x364807[_0x1ab84c][_0x26523b][_0x8db2('0x5a')]),_0x8db2('0x5b'))||0x0;_0x3611da[_0x8db2('0x14')][_0x2cf731][_0x8db2('0x31')]+=0x1;if(_0x364807[_0x1ab84c][_0x26523b][_0x8db2('0x60')]){_0x3611da[_0x8db2('0x14')][_0x2cf731][_0x8db2('0x32')]+=0x1;_0x3611da['voiceQueues'][_0x2cf731][_0x8db2('0x2e')]+=moment(_0x364807[_0x1ab84c][_0x26523b]['queuecallercompleteAt'])[_0x8db2('0x5f')](moment(_0x364807[_0x1ab84c][_0x26523b][_0x8db2('0x61')]),'seconds')||0x0;}}else{_0x3611da[_0x8db2('0x14')][_0x2cf731][_0x8db2('0x2d')]+=_0x3611da['voiceQueues'][_0x2cf731][_0x8db2('0x35')]||0x0;}}}}}}return _0x3611da[_0x8db2('0x14')];};};Realtime[_0x8db2('0x3f')][_0x8db2('0x62')]=function(){var _0x242379=this;return function(_0x31a095){clearVoiceCallReports(_0x242379[_0x8db2('0x63')]);if(_0x31a095){for(var _0x3ac0fa=0x0;_0x3ac0fa<_0x31a095[_0x8db2('0x42')];_0x3ac0fa+=0x1){_0x242379['outbound']['total']+=0x1;_0x242379[_0x8db2('0x63')]['sumDuration']+=_0x31a095[_0x3ac0fa][_0x8db2('0x64')];if(_0x31a095[_0x3ac0fa][_0x8db2('0x65')]===_0x8db2('0x66')){_0x242379['outbound'][_0x8db2('0x32')]+=0x1;_0x242379[_0x8db2('0x63')][_0x8db2('0x35')]+=_0x31a095[_0x3ac0fa]['duration']-_0x31a095[_0x3ac0fa][_0x8db2('0x67')]||0x0;_0x242379[_0x8db2('0x63')][_0x8db2('0x2e')]+=_0x31a095[_0x3ac0fa][_0x8db2('0x67')];}}}return _0x242379['outbound'];};};Realtime[_0x8db2('0x3f')][_0x8db2('0x68')]=function(){var _0x299640=this;return function(_0x1edb1a){if(_0x1edb1a){freeIsNotKey(_0x1edb1a,_0x299640[_0x8db2('0x15')],_0x8db2('0x2a'));for(var _0x1aadfb=0x0,_0x3682bf={};_0x1aadfb<_0x1edb1a[_0x8db2('0x42')];_0x1aadfb+=0x1){_0x3682bf=_0x1edb1a[_0x1aadfb];if(_[_0x8db2('0x43')](_0x299640[_0x8db2('0x15')][_0x3682bf['name']])){_0x299640[_0x8db2('0x15')][_0x3682bf[_0x8db2('0x2a')]]=new Campaign(_0x3682bf);}else{_0x299640[_0x8db2('0x44')](_0x299640['campaigns'][_0x3682bf['name']],_0x3682bf);_0x299640['campaigns'][_0x3682bf[_0x8db2('0x2a')]][_0x8db2('0x69')]=_0x3682bf[_0x8db2('0x6a')]?_0x3682bf[_0x8db2('0x6a')][_0x8db2('0x2a')]:undefined;}}}return _0x299640[_0x8db2('0x15')];};};Realtime[_0x8db2('0x3f')][_0x8db2('0x6b')]=function(){var _0x3b1929=this;return function(_0x37cf6d){if(_0x37cf6d){freeIsNotKey(_0x37cf6d,_0x3b1929[_0x8db2('0x17')],'id');for(var _0x4d0ff6=0x0,_0x360a06={};_0x4d0ff6<_0x37cf6d[_0x8db2('0x42')];_0x4d0ff6+=0x1){_0x360a06=_0x37cf6d[_0x4d0ff6];if(_[_0x8db2('0x43')](_0x3b1929[_0x8db2('0x17')][_0x360a06['id']])){_0x3b1929['voiceExtensions'][_0x360a06['id']]=new VoiceExtension(_0x360a06);}else{_0x3b1929['mergeFromDatabase'](_0x3b1929[_0x8db2('0x17')][_0x360a06['id']],_0x360a06);}}}return _0x3b1929[_0x8db2('0x17')];};};Realtime['prototype'][_0x8db2('0x6c')]=function(){var _0x121f31=this;return function(_0x9132b4){clearCampaigns(_0x121f31['campaigns']);for(var _0x5dc46c=0x0;_0x5dc46c<_0x9132b4['length'];_0x5dc46c+=0x1){_[_0x8db2('0x55')](_0x121f31[_0x8db2('0x15')][_0x9132b4[_0x5dc46c][_0x8db2('0x2a')]],_0x9132b4[_0x5dc46c]);}return _0x121f31[_0x8db2('0x15')];};};Realtime[_0x8db2('0x3f')]['initFaxAccounts']=function(){var _0x30930a=this;return function(_0x5e349c){if(_0x5e349c){freeIsNotKey(_0x5e349c,_0x30930a[_0x8db2('0x25')],'id');for(var _0x353101=0x0,_0xa083b1={};_0x353101<_0x5e349c[_0x8db2('0x42')];_0x353101+=0x1){_0xa083b1=_0x5e349c[_0x353101];if(_[_0x8db2('0x43')](_0x30930a['faxAccounts'][_0xa083b1['id']])){_0x30930a['faxAccounts'][_0xa083b1['id']]=new FaxAccount(_0xa083b1);}else{_0x30930a[_0x8db2('0x44')](_0x30930a['faxAccounts'][_0xa083b1['id']],_0xa083b1);}}}return _0x30930a[_0x8db2('0x25')];};};Realtime[_0x8db2('0x3f')][_0x8db2('0x6d')]=function(){var _0x1e7bc2=this;return function(_0x2b7224){if(_0x2b7224){freeIsNotKey(_0x2b7224,_0x1e7bc2[_0x8db2('0x14')],'name');for(var _0x19f9a0=0x0,_0x222ea2={};_0x19f9a0<_0x2b7224[_0x8db2('0x42')];_0x19f9a0+=0x1){_0x222ea2=_0x2b7224[_0x19f9a0];if(_['isUndefined'](_0x1e7bc2[_0x8db2('0x14')][_0x222ea2[_0x8db2('0x2a')]])){_0x1e7bc2['voiceQueues'][_0x222ea2[_0x8db2('0x2a')]]=new VoiceQueue(_0x222ea2);}else{_0x1e7bc2[_0x8db2('0x44')](_0x1e7bc2[_0x8db2('0x14')][_0x222ea2[_0x8db2('0x2a')]],_0x222ea2);}}}return _0x1e7bc2[_0x8db2('0x14')];};};module[_0x8db2('0x6e')]=Realtime; \ No newline at end of file diff --git a/server/services/ami/realtime/utils.js b/server/services/ami/realtime/utils.js index f51f253..cee6e44 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 _0x2930=['assign','hasOwnProperty','mergeDBDataToRealtime'];(function(_0x3b632f,_0x453380){var _0x10e788=function(_0x2228a4){while(--_0x2228a4){_0x3b632f['push'](_0x3b632f['shift']());}};_0x10e788(++_0x453380);}(_0x2930,0x93));var _0x0293=function(_0x4cfa6b,_0x509763){_0x4cfa6b=_0x4cfa6b-0x0;var _0x5b6b29=_0x2930[_0x4cfa6b];return _0x5b6b29;};'use strict';function mergeDBDataToRealtime(_0x18f187,_0x17180e){var _0x201385=Object[_0x0293('0x0')]({},_0x18f187);for(var _0x1f92d0 in _0x17180e){if(_0x201385[_0x0293('0x1')](_0x1f92d0)){_0x201385[_0x1f92d0]=_0x17180e[_0x1f92d0];}}return _0x201385;}exports[_0x0293('0x2')]=mergeDBDataToRealtime; \ No newline at end of file +var _0xac95=['hasOwnProperty','mergeDBDataToRealtime','assign'];(function(_0x3ab9ee,_0x4a74b8){var _0x82ee88=function(_0x6ccc7e){while(--_0x6ccc7e){_0x3ab9ee['push'](_0x3ab9ee['shift']());}};_0x82ee88(++_0x4a74b8);}(_0xac95,0x173));var _0x5ac9=function(_0x16724e,_0x52dfdb){_0x16724e=_0x16724e-0x0;var _0x31c2e7=_0xac95[_0x16724e];return _0x31c2e7;};'use strict';function mergeDBDataToRealtime(_0x59c151,_0x49edce){var _0x8b8ec4=Object[_0x5ac9('0x0')]({},_0x59c151);for(var _0x22136a in _0x49edce){if(_0x8b8ec4[_0x5ac9('0x1')](_0x22136a)){_0x8b8ec4[_0x22136a]=_0x49edce[_0x22136a];}}return _0x8b8ec4;}exports[_0x5ac9('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 f99db4d..cc42cbc 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 _0xd9c8=['monitor','monitorFilename','monitors','createdAt','exten','xcally-motion-dialer','isArray','forEach','startsWith','Local','substring','indexOf','mobile','phone','transfererlinkedid','../rpc/voiceAgentReport','../rpc/voiceCallReport','../rpc/voiceDialReport','../rpc/voiceQueueReport','../rpc/voiceRecording','../rpc/voiceTransferReport','./voiceQueueReport','./voiceCallReport','./voiceAgentReport','./voiceDialReport','realtime','telephones','prototype','sync','xdr','voiceQueueReport','bind','custom:voiceCallReport','custom:voiceAgentReport','voiceAgentReport','custom:voiceDialReport','blindtransfer','attendedtransfer','attendedTransfer','findAgent','find','agents','accountcode','name','isNil','SIP/%s','length','connectedlinenum','assigned','lastAssignedTo','interface','format','queuecallercomplete','queuecallercompleteAt','YYYY-MM-DD\x20HH:mm:ss','create','match','keys','getCallType','channel','getAgentByInternal','calleridnum','outbound','internal','voiceCallReport','destination','type','lastapplication','queue','lastdata','context','callerid','xcally-motion-preview','calleridpreview','originatecalleridnum','destinationchannel','disposition','ANSWERED','\x22%s\x22\x20<%s>','calleridname','linkedid','transfers','transfereelinkedid','uniqueid','blindTransfer','UserId','split'];(function(_0x369627,_0x5a2fca){var _0x1156ef=function(_0x55162a){while(--_0x55162a){_0x369627['push'](_0x369627['shift']());}};_0x1156ef(++_0x5a2fca);}(_0xd9c8,0x66));var _0x8d9c=function(_0x3ab9ee,_0x4a74b8){_0x3ab9ee=_0x3ab9ee-0x0;var _0x82ee88=_0xd9c8[_0x3ab9ee];return _0x82ee88;};'use strict';var _=require('lodash');var moment=require('moment');var util=require('util');var config=require('../../../config/environment');var ami=require('../ami');var RpcVoiceAgentReport=require(_0x8d9c('0x0'));var RpcVoiceCallReport=require(_0x8d9c('0x1'));var RpcVoiceDialReport=require(_0x8d9c('0x2'));var RpcMemberReport=require('../rpc/memberReport');var RpcVoiceQueueReport=require(_0x8d9c('0x3'));var RpcVoiceRecording=require(_0x8d9c('0x4'));var RpcVoiceTransferReport=require(_0x8d9c('0x5'));var VoiceQueueReport=require(_0x8d9c('0x6'));var VoiceCallReport=require(_0x8d9c('0x7'));var VoiceAgentReport=require(_0x8d9c('0x8'));var VoiceDialReport=require(_0x8d9c('0x9'));var UserReport=require('./userReport');function Report(_0x596c7f){this[_0x8d9c('0xa')]=_0x596c7f;this['agents']=_0x596c7f['agents'];this['telephones']=_0x596c7f[_0x8d9c('0xb')];}Report[_0x8d9c('0xc')][_0x8d9c('0xd')]=function(_0x2e7d31){var _0x26abdb=new VoiceQueueReport(this[_0x8d9c('0xa')]);var _0x63cc4d=new VoiceAgentReport(this['realtime']);var _0x4af79c=new VoiceDialReport(this[_0x8d9c('0xa')]);var _0x2b4081=new VoiceCallReport(this['realtime']);var _0x2bd3c2=new UserReport(this[_0x8d9c('0xa')]);if(config['xdr']&&config[_0x8d9c('0xe')]['disabled']){ami['on']('custom:voiceQueueReport',this[_0x8d9c('0xf')][_0x8d9c('0x10')](this));ami['on'](_0x8d9c('0x11'),this['voiceCallReport'][_0x8d9c('0x10')](this));ami['on'](_0x8d9c('0x12'),this[_0x8d9c('0x13')]['bind'](this));ami['on'](_0x8d9c('0x14'),this['voiceDialReport'][_0x8d9c('0x10')](this));ami['on'](_0x8d9c('0x15'),this['blindTransfer'][_0x8d9c('0x10')](this));ami['on'](_0x8d9c('0x16'),this[_0x8d9c('0x17')][_0x8d9c('0x10')](this));}};Report[_0x8d9c('0xc')][_0x8d9c('0x18')]=function(_0x432ba6){var _0x438ccd;_0x438ccd=_[_0x8d9c('0x19')](this[_0x8d9c('0x1a')],function(_0x2e7427){return _0x2e7427[_0x8d9c('0x1b')]==_0x432ba6||_0x2e7427[_0x8d9c('0x1c')]==_0x432ba6;});if(_[_0x8d9c('0x1d')](_0x438ccd)){var _0x281748=_[_0x8d9c('0x19')](this[_0x8d9c('0xb')],function(_0x1f4df0){return _0x1f4df0['accountcode']==_0x432ba6||_0x1f4df0[_0x8d9c('0x1c')]==_0x432ba6;});if(_0x281748){_0x438ccd=_[_0x8d9c('0x19')](this[_0x8d9c('0x1a')],function(_0x46e06c){return _0x46e06c['interface']==util['format'](_0x8d9c('0x1e'),_0x281748[_0x8d9c('0x1c')]);});}}return _0x438ccd;};Report['prototype']['voiceQueueReport']=function(_0x5ed599){for(var _0x1392e1=0x0;_0x1392e1<_0x5ed599[_0x8d9c('0x1f')];_0x1392e1+=0x1){var _0x49b03f=this['findAgent'](_0x5ed599[_0x1392e1][_0x8d9c('0x20')]);if(_0x49b03f){_0x5ed599[_0x1392e1][_0x8d9c('0x1b')]=_0x49b03f[_0x8d9c('0x1b')];_0x5ed599[_0x1392e1][_0x8d9c('0x21')]=!![];_0x5ed599[_0x1392e1][_0x8d9c('0x22')]=_0x49b03f[_0x8d9c('0x1c')];_0x5ed599[_0x1392e1][_0x8d9c('0x23')]=_['isNil'](_0x49b03f[_0x8d9c('0x23')])?util[_0x8d9c('0x24')]('SIP/%s',_0x49b03f[_0x8d9c('0x1c')]):_0x49b03f[_0x8d9c('0x23')];if(_0x5ed599[_0x1392e1][_0x8d9c('0x25')]){_0x5ed599[_0x1392e1][_0x8d9c('0x26')]=moment()['format'](_0x8d9c('0x27'));}if(_0x5ed599[_0x1392e1]['queuecallerexit']){_0x5ed599[_0x1392e1]['queuecallerexitAt']=moment()[_0x8d9c('0x24')](_0x8d9c('0x27'));}RpcMemberReport[_0x8d9c('0xf')](_0x5ed599[_0x1392e1]);}RpcVoiceQueueReport[_0x8d9c('0x28')](_0x5ed599[_0x1392e1]);}};function extractCalleridNumber(_0x2f5287){var _0x5d8418=_0x2f5287[_0x8d9c('0x29')](/<(.*?)>/);return _0x5d8418?_0x5d8418[0x1]:_0x2f5287;}Report[_0x8d9c('0xc')]['getAgentByInternal']=function(_0x4e43a7){for(var _0xf9b7b4=0x0;_0xf9b7b4','transfers','linkedid','transfereelinkedid','uniqueid','getCallType','membername','monitor','monitorFilename','monitors','filename','connectedlinename','xcally-motion-dialer','exten','isArray','startsWith','Local','substring','indexOf','mobile','phone','blindTransfer','transfererlinkedid','exports','moment','util','../../../config/environment','../rpc/voiceAgentReport','../rpc/voiceCallReport','../rpc/memberReport','../rpc/voiceQueueReport','../rpc/voiceRecording','./voiceQueueReport','./voiceCallReport','./voiceAgentReport','./userReport','realtime','agents','telephones','prototype','sync','xdr','disabled','custom:voiceQueueReport','voiceQueueReport','bind','custom:voiceCallReport','voiceCallReport','voiceAgentReport','custom:voiceDialReport','voiceDialReport','blindtransfer','attendedtransfer','attendedTransfer','find','accountcode','name','isNil','format','SIP/%s','findAgent','connectedlinenum','assigned','lastAssignedTo','interface','queuecallercomplete','queuecallercompleteAt','YYYY-MM-DD\x20HH:mm:ss','queuecallerexit','queuecallerexitAt','create','match','getAgentByInternal','length','keys','channel','split','calleridnum','destination','type','dialer','queue','lastdata','context','from-voip-provider','callerid'];(function(_0x29567b,_0x1b5ff6){var _0xfa8c2e=function(_0x420930){while(--_0x420930){_0x29567b['push'](_0x29567b['shift']());}};_0xfa8c2e(++_0x1b5ff6);}(_0x6522,0x1ea));var _0x2652=function(_0x4565bf,_0x5ad9d6){_0x4565bf=_0x4565bf-0x0;var _0x5610ba=_0x6522[_0x4565bf];return _0x5610ba;};'use strict';var _=require('lodash');var moment=require(_0x2652('0x0'));var util=require(_0x2652('0x1'));var config=require(_0x2652('0x2'));var ami=require('../ami');var RpcVoiceAgentReport=require(_0x2652('0x3'));var RpcVoiceCallReport=require(_0x2652('0x4'));var RpcVoiceDialReport=require('../rpc/voiceDialReport');var RpcMemberReport=require(_0x2652('0x5'));var RpcVoiceQueueReport=require(_0x2652('0x6'));var RpcVoiceRecording=require(_0x2652('0x7'));var RpcVoiceTransferReport=require('../rpc/voiceTransferReport');var VoiceQueueReport=require(_0x2652('0x8'));var VoiceCallReport=require(_0x2652('0x9'));var VoiceAgentReport=require(_0x2652('0xa'));var VoiceDialReport=require('./voiceDialReport');var UserReport=require(_0x2652('0xb'));function Report(_0x40e304){this[_0x2652('0xc')]=_0x40e304;this['agents']=_0x40e304[_0x2652('0xd')];this[_0x2652('0xe')]=_0x40e304[_0x2652('0xe')];}Report[_0x2652('0xf')][_0x2652('0x10')]=function(_0x4698e7){var _0x55f002=new VoiceQueueReport(this[_0x2652('0xc')]);var _0x48ea47=new VoiceAgentReport(this[_0x2652('0xc')]);var _0x27e9da=new VoiceDialReport(this[_0x2652('0xc')]);var _0x5f0cda=new VoiceCallReport(this[_0x2652('0xc')]);var _0x29eff6=new UserReport(this[_0x2652('0xc')]);if(config[_0x2652('0x11')]&&config[_0x2652('0x11')][_0x2652('0x12')]){ami['on'](_0x2652('0x13'),this[_0x2652('0x14')][_0x2652('0x15')](this));ami['on'](_0x2652('0x16'),this[_0x2652('0x17')]['bind'](this));ami['on']('custom:voiceAgentReport',this[_0x2652('0x18')][_0x2652('0x15')](this));ami['on'](_0x2652('0x19'),this[_0x2652('0x1a')][_0x2652('0x15')](this));ami['on'](_0x2652('0x1b'),this['blindTransfer'][_0x2652('0x15')](this));ami['on'](_0x2652('0x1c'),this[_0x2652('0x1d')]['bind'](this));}};Report[_0x2652('0xf')]['findAgent']=function(_0x302fd3){var _0x3b395c;_0x3b395c=_[_0x2652('0x1e')](this[_0x2652('0xd')],function(_0xd81ef2){return _0xd81ef2[_0x2652('0x1f')]==_0x302fd3||_0xd81ef2[_0x2652('0x20')]==_0x302fd3;});if(_[_0x2652('0x21')](_0x3b395c)){var _0x4c79a9=_[_0x2652('0x1e')](this[_0x2652('0xe')],function(_0x18efd2){return _0x18efd2[_0x2652('0x1f')]==_0x302fd3||_0x18efd2[_0x2652('0x20')]==_0x302fd3;});if(_0x4c79a9){_0x3b395c=_['find'](this[_0x2652('0xd')],function(_0x80385d){return _0x80385d['interface']==util[_0x2652('0x22')](_0x2652('0x23'),_0x4c79a9['name']);});}}return _0x3b395c;};Report[_0x2652('0xf')][_0x2652('0x14')]=function(_0x2d6d81){for(var _0xc2d1bc=0x0;_0xc2d1bc<_0x2d6d81['length'];_0xc2d1bc+=0x1){var _0x42c466=this[_0x2652('0x24')](_0x2d6d81[_0xc2d1bc][_0x2652('0x25')]);if(_0x42c466){_0x2d6d81[_0xc2d1bc][_0x2652('0x1f')]=_0x42c466['accountcode'];_0x2d6d81[_0xc2d1bc][_0x2652('0x26')]=!![];_0x2d6d81[_0xc2d1bc][_0x2652('0x27')]=_0x42c466[_0x2652('0x20')];_0x2d6d81[_0xc2d1bc][_0x2652('0x28')]=_[_0x2652('0x21')](_0x42c466[_0x2652('0x28')])?util[_0x2652('0x22')](_0x2652('0x23'),_0x42c466[_0x2652('0x20')]):_0x42c466[_0x2652('0x28')];if(_0x2d6d81[_0xc2d1bc][_0x2652('0x29')]){_0x2d6d81[_0xc2d1bc][_0x2652('0x2a')]=moment()['format'](_0x2652('0x2b'));}if(_0x2d6d81[_0xc2d1bc][_0x2652('0x2c')]){_0x2d6d81[_0xc2d1bc][_0x2652('0x2d')]=moment()['format'](_0x2652('0x2b'));}RpcMemberReport[_0x2652('0x14')](_0x2d6d81[_0xc2d1bc]);}RpcVoiceQueueReport[_0x2652('0x2e')](_0x2d6d81[_0xc2d1bc]);}};function extractCalleridNumber(_0x3940b1){var _0x32e871=_0x3940b1[_0x2652('0x2f')](/<(.*?)>/);return _0x32e871?_0x32e871[0x1]:_0x3940b1;}Report['prototype'][_0x2652('0x30')]=function(_0x1cc404){for(var _0x30de10=0x0;_0x30de10{delete this[_0xbd62('0xa')][_0x459e8e];},_0x1b2694);}};module[_0xbd62('0x9f')]=VoiceAgentReport; \ No newline at end of file +var _0x738b=['lastIndexOf','onhold','[%s][voiceAgentReport][musiconholdstop]\x20event:','[%s][voiceAgentReport][musiconholdstop]\x20interface:%s','[%s][voiceAgentReport][musiconholdstop]','exports','lodash','util','ioredis','../../../config/environment','../../../config/logger','../ami','defaults','redis','localhost','socket.io-emitter','channels','voiceChannels','voiceQueues','agents','variables','agentcalled','agentconnect','syncAgentConnect','bind','agentringnoanswer','syncAgentRingNoAnswer','queuecallerabandon','syncAgentComplete','varset','syncVarSet','musiconholdstart','syncMusicOnHoldStart','syncMusicOnHoldStop','attendedtransfer','syncAttendedTransfer','blindtransfer','prototype','emit','isNotNull','isUndefined','syncAgentCalled','info','[%s][voiceAgentReport][agentcalled]\x20agent:%s\x20destuniqueid:%s\x20lastevent:called','membername','debug','[%s][voiceAgentReport][agentcalled]\x20event:','uniqueid','inspect','interface','queue','called','mandatoryDisposition','type','voice','omit','event','destuniqueid','[%s][voiceAgentReport][agentcalled]\x20sending\x20agentcalled\x20event:','calleridnum','[%s][voiceAgentReport][agentcalled]\x20sending\x20user:called\x20event:','user:%s','user:called','error','[%s][voiceAgentReport][agentcalled]','hasOwnProperty','[%s][voiceAgentReport][agentconnect]\x20agent:%s\x20destuniqueid:%s\x20lastevent:connect','format','YYYY-MM-DD\x20HH:mm:ss','connectedlinename','connectedlinenum','destchannelstate','destchannelstatedesc','holdtime','lastevent','merge','pick','destconnectedlinenum','name','accountcode','exten','custom:agentconnect','user:agentconnect','agentcomplete','[%s][voiceAgentReport][agentconnect]\x20agent:%s\x20destuniqueid:%s\x20lastevent:answered_elsewhere','agentringnoanswerAt','answeredelsewheremembername','answered_elsewhere','reason','[%s][voiceAgentReport][agentconnect]\x20sending\x20agentansweredelsewhere\x20event:','[%s][voiceAgentReport][agentconnect]\x20Else\x20path\x20should\x20never\x20be\x20taken','rejected','custom:agentringnoanswer','assign','syncQueueCallerAbandon','[%s][voiceAgentReport][queuecallerabandon]\x20event:','[%s][voiceAgentReport][queuecallerabandon]\x20agent:%s\x20destuniqueid:%s\x20lastevent:abandoned','abandoned','[%s][voiceAgentReport][queuecallerabandon]\x20sending\x20agentqueuecallerabandon\x20event:','custom:agentqueuecallerabandon','[%s][voiceAgentReport][queuecallerabandon]','[%s][voiceAgentReport][agentcomplete]\x20event:','agentconnectAt','[%s][voiceAgentReport][agentcomplete]\x20agent:%s\x20destuniqueid:%s\x20lastevent:complete','complete','transfer','agent','talktime','acw','acwtime','acwTimeout','agentacw','custom:agentcomplete','destaccountcode','user:agentcomplete','addVariable','keys','variable','value','[%s][voiceAgentReport][varset]\x20destuniqueid:%s\x20variable:%s\x20value:%s','rtpaudioqos','rtpaudioqosbridged','rtpaudioqosjitter','rtpaudioqosloss','rtpaudioqoslossbridged','rtpaudioqosrtt','sipcallid','sipuri','bridgepeer','bridgepvtcallid','membercalls','memberdynamic','memberinterface','memberlastcall','memberpenalty','memberrealtime','isNil','includes','syncHangup','[%s][voiceAgentReport][hangup]\x20event:','[%s][voiceAgentReport][hangup]\x20destuniqueid:%s','agentcompleteAt','[%s][voiceAgentReport][hangup]\x20sending\x20voiceAgentReport\x20event:','values','custom:voiceAgentReport','deleteChannelAfterTimeout','[%s][voiceAgentReport][attendedtransfer]\x20event:','transfereeuniqueid','origtransfereruniqueid','diff','seconds','secondtransfereruniqueid','[%s][voiceAgentReport][attendedtransfer]','syncBlindTransfer','transfereruniqueid','[%s][voiceAgentReport][blindtransfer]\x20agent:%s\x20destuniqueid:%s\x20lastevent:complete','[%s][voiceAgentReport][blindtransfer]','channel','substring'];(function(_0x1fd132,_0x3165a8){var _0x494673=function(_0x581a99){while(--_0x581a99){_0x1fd132['push'](_0x1fd132['shift']());}};_0x494673(++_0x3165a8);}(_0x738b,0x144));var _0xb738=function(_0x298abb,_0x40e171){_0x298abb=_0x298abb-0x0;var _0x3092ef=_0x738b[_0x298abb];return _0x3092ef;};'use strict';var _=require(_0xb738('0x0'));var moment=require('moment');var util=require(_0xb738('0x1'));var Redis=require(_0xb738('0x2'));var config=require(_0xb738('0x3'));var logger=require(_0xb738('0x4'))('ami');var ami=require(_0xb738('0x5'));config['redis']=_[_0xb738('0x6')](config[_0xb738('0x7')],{'host':_0xb738('0x8'),'port':0x18eb});var io=require(_0xb738('0x9'))(new Redis(config[_0xb738('0x7')]));function VoiceAgentReport(_0x49e386){this[_0xb738('0xa')]={};this[_0xb738('0xb')]=_0x49e386[_0xb738('0xa')];this[_0xb738('0xc')]=_0x49e386[_0xb738('0xc')];this[_0xb738('0xd')]=_0x49e386[_0xb738('0xd')];this[_0xb738('0xe')]={};ami['on'](_0xb738('0xf'),this['syncAgentCalled']['bind'](this));ami['on'](_0xb738('0x10'),this[_0xb738('0x11')][_0xb738('0x12')](this));ami['on'](_0xb738('0x13'),this[_0xb738('0x14')][_0xb738('0x12')](this));ami['on'](_0xb738('0x15'),this['syncQueueCallerAbandon'][_0xb738('0x12')](this));ami['on']('agentcomplete',this[_0xb738('0x16')][_0xb738('0x12')](this));ami['on'](_0xb738('0x17'),this[_0xb738('0x18')][_0xb738('0x12')](this));ami['on']('hangup',this['syncHangup'][_0xb738('0x12')](this));ami['on'](_0xb738('0x19'),this[_0xb738('0x1a')]['bind'](this));ami['on']('musiconholdstop',this[_0xb738('0x1b')][_0xb738('0x12')](this));ami['on'](_0xb738('0x1c'),this[_0xb738('0x1d')][_0xb738('0x12')](this));ami['on'](_0xb738('0x1e'),this['syncBlindTransfer'][_0xb738('0x12')](this));}VoiceAgentReport[_0xb738('0x1f')][_0xb738('0x20')]=function(_0x7c2c85,_0x32fefc,_0xa74a1){io['to'](_0x7c2c85)[_0xb738('0x20')](_0x32fefc,_0xa74a1);};VoiceAgentReport['prototype'][_0xb738('0x21')]=function(_0x343051){return _0x343051!==null&&!_[_0xb738('0x22')](_0x343051);};VoiceAgentReport[_0xb738('0x1f')][_0xb738('0x23')]=function(_0xec3f3e){try{if(this[_0xb738('0x21')](_0xec3f3e)){logger[_0xb738('0x24')](_0xb738('0x25'),_0xec3f3e['uniqueid'],_0xec3f3e[_0xb738('0x26')],_0xec3f3e['destuniqueid']);logger[_0xb738('0x27')](_0xb738('0x28'),_0xec3f3e[_0xb738('0x29')],util[_0xb738('0x2a')](_0xec3f3e,{'showHidden':![],'depth':null}));if(_['isUndefined'](this[_0xb738('0xa')][_0xec3f3e['uniqueid']])){this[_0xb738('0xa')][_0xec3f3e[_0xb738('0x29')]]={};}var _0x18e3b1=this[_0xb738('0xd')][_0xec3f3e[_0xb738('0x2b')]];var _0x19c761=this[_0xb738('0xa')][_0xec3f3e[_0xb738('0x29')]][_0xec3f3e['destuniqueid']];var _0x4adf39=this['voiceQueues'][_0xec3f3e[_0xb738('0x2c')]];var _0x175e55=this[_0xb738('0xe')][_0xec3f3e[_0xb738('0x29')]];if(_['isUndefined'](_0x19c761)){_0x19c761={'agentcalledAt':moment()['format']('YYYY-MM-DD\x20HH:mm:ss'),'lastevent':_0xb738('0x2d'),'mandatoryDisposition':_0x4adf39&&_0x4adf39[_0xb738('0x2e')]?_0x4adf39['mandatoryDisposition']:![],'type':_0x4adf39&&_0x4adf39[_0xb738('0x2f')]?_0x4adf39[_0xb738('0x2f')]:'inbound','variables':_0x175e55,'motionChannel':_0xb738('0x30')};}Object['assign'](_0x19c761,_[_0xb738('0x31')](_0xec3f3e,[_0xb738('0x32'),'privilege']));this[_0xb738('0xa')][_0xec3f3e[_0xb738('0x29')]][_0xec3f3e[_0xb738('0x33')]]=_0x19c761;logger['debug'](_0xb738('0x34'),_0xec3f3e[_0xb738('0x29')],util[_0xb738('0x2a')](_0x19c761,{'showHidden':![],'depth':null}));ami[_0xb738('0x20')]('custom:agentcalled',_0x19c761);var _0xf1321f={'id':_0x18e3b1['id'],'calleridnum':_0x19c761[_0xb738('0x35')],'queue':_0x19c761[_0xb738('0x2c')],'variables':_0x19c761['variables'],'uniqueid':_0xec3f3e[_0xb738('0x29')]};logger[_0xb738('0x27')](_0xb738('0x36'),_0xec3f3e[_0xb738('0x29')],util[_0xb738('0x2a')](_0xf1321f,{'showHidden':![],'depth':null}));this['emit'](util['format'](_0xb738('0x37'),_0xec3f3e[_0xb738('0x26')]),_0xb738('0x38'),_0xf1321f);}}catch(_0x51e3d8){logger[_0xb738('0x39')](_0xb738('0x3a'),_0xec3f3e[_0xb738('0x29')],util[_0xb738('0x2a')](_0x51e3d8,{'showHidden':![],'depth':null}));}};VoiceAgentReport['prototype'][_0xb738('0x11')]=function(_0x73b10a){try{if(this['isNotNull'](_0x73b10a)){if(this[_0xb738('0xa')][_0x73b10a[_0xb738('0x29')]]){for(var _0x39c722 in this[_0xb738('0xa')][_0x73b10a[_0xb738('0x29')]]){if(this[_0xb738('0xa')][_0x73b10a['uniqueid']][_0xb738('0x3b')](_0x39c722)){if(_0x73b10a[_0xb738('0x33')]===_0x39c722){logger[_0xb738('0x24')](_0xb738('0x3c'),_0x73b10a[_0xb738('0x29')],_0x73b10a[_0xb738('0x26')],_0x73b10a[_0xb738('0x33')]);this[_0xb738('0xa')][_0x73b10a['uniqueid']][_0x39c722]['agentconnectAt']=moment()[_0xb738('0x3d')](_0xb738('0x3e'));this[_0xb738('0xa')][_0x73b10a['uniqueid']][_0x39c722][_0xb738('0x3f')]=_0x73b10a[_0xb738('0x3f')];this[_0xb738('0xa')][_0x73b10a[_0xb738('0x29')]][_0x39c722][_0xb738('0x40')]=_0x73b10a[_0xb738('0x40')];this[_0xb738('0xa')][_0x73b10a[_0xb738('0x29')]][_0x39c722][_0xb738('0x41')]=_0x73b10a[_0xb738('0x41')];this[_0xb738('0xa')][_0x73b10a['uniqueid']][_0x39c722][_0xb738('0x42')]=_0x73b10a[_0xb738('0x42')];this['channels'][_0x73b10a[_0xb738('0x29')]][_0x39c722][_0xb738('0x43')]=_0x73b10a['holdtime'];this[_0xb738('0xa')][_0x73b10a[_0xb738('0x29')]][_0x39c722][_0xb738('0x44')]='connect';_[_0xb738('0x45')](this['agents'][_0x73b10a[_0xb738('0x2b')]],_[_0xb738('0x46')](_0x73b10a,[_0xb738('0x2c'),_0xb738('0x47')]));var _0x1ee70c=this['agents'][_0x73b10a[_0xb738('0x2b')]];var _0x2a5e69={'id':_0x1ee70c['id'],'name':_0x1ee70c[_0xb738('0x48')],'agentconnected':!![],'destaccountcode':_0x1ee70c[_0xb738('0x49')],'destconnectedlinenum':this[_0xb738('0xa')][_0x73b10a['uniqueid']][_0x73b10a[_0xb738('0x33')]][_0xb738('0x4a')],'queue':this['channels'][_0x73b10a[_0xb738('0x29')]][_0x73b10a['destuniqueid']][_0xb738('0x2c')],'uniqueid':this[_0xb738('0xa')][_0x73b10a[_0xb738('0x29')]][_0x73b10a['destuniqueid']][_0xb738('0x29')]};ami[_0xb738('0x20')](_0xb738('0x4b'),this[_0xb738('0xa')][_0x73b10a[_0xb738('0x29')]][_0x73b10a[_0xb738('0x33')]]);this[_0xb738('0x20')](util[_0xb738('0x3d')]('user:%s',_0x73b10a[_0xb738('0x26')]),_0xb738('0x4c'),_0x2a5e69);}else if(!this[_0xb738('0xa')][_0x73b10a[_0xb738('0x29')]][_0x39c722][_0xb738('0x13')]&&!this[_0xb738('0xa')][_0x73b10a['uniqueid']][_0x39c722][_0xb738('0x4d')]){logger[_0xb738('0x24')](_0xb738('0x4e'),_0x73b10a[_0xb738('0x29')],this[_0xb738('0xa')][_0x73b10a[_0xb738('0x29')]][_0x39c722][_0xb738('0x26')],_0x39c722);this['channels'][_0x73b10a[_0xb738('0x29')]][_0x39c722][_0xb738('0x13')]=!![];this[_0xb738('0xa')][_0x73b10a['uniqueid']][_0x39c722][_0xb738('0x4f')]=moment()['format'](_0xb738('0x3e'));this[_0xb738('0xa')][_0x73b10a[_0xb738('0x29')]][_0x39c722]['answeredelsewheredestinationuniqueid']=_0x73b10a['destuniqueid'];this[_0xb738('0xa')][_0x73b10a[_0xb738('0x29')]][_0x39c722][_0xb738('0x50')]=_0x73b10a['membername'];this[_0xb738('0xa')][_0x73b10a[_0xb738('0x29')]][_0x39c722][_0xb738('0x44')]=_0xb738('0x51');this[_0xb738('0xa')][_0x73b10a[_0xb738('0x29')]][_0x39c722][_0xb738('0x52')]='answered_elsewhere';logger[_0xb738('0x27')](_0xb738('0x53'),_0x73b10a[_0xb738('0x29')],util['inspect'](this['channels'][_0x73b10a[_0xb738('0x29')]][_0x39c722],{'showHidden':![],'depth':null}));ami[_0xb738('0x20')]('custom:agentansweredelsewhere',this[_0xb738('0xa')][_0x73b10a[_0xb738('0x29')]][_0x39c722]);}else{logger[_0xb738('0x27')](_0xb738('0x54'),_0x73b10a['uniqueid']);}}}}}}catch(_0x53d68d){logger[_0xb738('0x39')]('[%s][voiceAgentReport][agentconnect]',_0x73b10a[_0xb738('0x29')],util[_0xb738('0x2a')](_0x53d68d,{'showHidden':![],'depth':null}));}};VoiceAgentReport[_0xb738('0x1f')]['syncAgentRingNoAnswer']=function(_0x3d8675){try{if(this[_0xb738('0x21')](_0x3d8675)){logger['debug']('[%s][voiceAgentReport][agentringnoanswer]\x20event:',_0x3d8675[_0xb738('0x29')],util['inspect'](_0x3d8675,{'showHidden':![],'depth':null}));if(this['channels'][_0x3d8675[_0xb738('0x29')]]&&this[_0xb738('0xa')][_0x3d8675[_0xb738('0x29')]][_0x3d8675['destuniqueid']]){logger['info']('[%s][voiceAgentReport][agentringnoanswer]\x20agent:%s\x20destuniqueid:%s\x20lastevent:rejected',_0x3d8675[_0xb738('0x29')],_0x3d8675['membername'],_0x3d8675[_0xb738('0x33')]);var _0x5752b9=this['agents'][_0x3d8675[_0xb738('0x2b')]];var _0x41600d=this[_0xb738('0xa')][_0x3d8675[_0xb738('0x29')]][_0x3d8675[_0xb738('0x33')]];_0x41600d[_0xb738('0x13')]=!![];_0x41600d['agentringnoanswerAt']=moment()[_0xb738('0x3d')](_0xb738('0x3e'));_0x41600d['lastevent']=_0xb738('0x55');_0x41600d[_0xb738('0x52')]=_0xb738('0x55');var _0x289878={'id':_0x5752b9['id'],'name':_0x5752b9[_0xb738('0x48')],'queue':_0x41600d['queue'],'uniqueid':_0x41600d[_0xb738('0x29')]};logger[_0xb738('0x27')]('[%s][voiceAgentReport][agentringnoanswer]\x20sending\x20agentringnoanswer\x20event:',_0x3d8675['uniqueid'],util[_0xb738('0x2a')](_0x289878,{'showHidden':![],'depth':null}));this[_0xb738('0x20')](util[_0xb738('0x3d')](_0xb738('0x37'),_0x5752b9[_0xb738('0x48')]),'user:agentringnoanswer',_0x289878);ami['emit'](_0xb738('0x56'),_0x41600d);this['channels'][_0x3d8675[_0xb738('0x29')]][_0x3d8675[_0xb738('0x33')]]=Object[_0xb738('0x57')]({},_0x41600d);}}}catch(_0x4d5b1d){logger['error']('[%s][voiceAgentReport][agentringnoanswer]',_0x3d8675[_0xb738('0x29')],util[_0xb738('0x2a')](_0x4d5b1d,{'showHidden':![],'depth':null}));}};VoiceAgentReport[_0xb738('0x1f')][_0xb738('0x58')]=function(_0x3c2d22){try{if(this[_0xb738('0x21')](_0x3c2d22)){logger[_0xb738('0x27')](_0xb738('0x59'),_0x3c2d22['uniqueid'],util[_0xb738('0x2a')](_0x3c2d22,{'showHidden':![],'depth':null}));if(this[_0xb738('0xa')][_0x3c2d22[_0xb738('0x29')]]){for(var _0x133b2b in this[_0xb738('0xa')][_0x3c2d22['uniqueid']]){if(this[_0xb738('0xa')][_0x3c2d22[_0xb738('0x29')]][_0xb738('0x3b')](_0x133b2b)&&!this[_0xb738('0xa')][_0x3c2d22[_0xb738('0x29')]][_0x133b2b][_0xb738('0x13')]&&!this['channels'][_0x3c2d22[_0xb738('0x29')]][_0x133b2b]['agentcomplete']){logger[_0xb738('0x24')](_0xb738('0x5a'),_0x3c2d22[_0xb738('0x29')],this[_0xb738('0xa')][_0x3c2d22[_0xb738('0x29')]][_0x133b2b]['membername'],_0x133b2b);this[_0xb738('0xa')][_0x3c2d22[_0xb738('0x29')]][_0x133b2b][_0xb738('0x13')]=!![];this[_0xb738('0xa')][_0x3c2d22[_0xb738('0x29')]][_0x133b2b][_0xb738('0x4f')]=moment()[_0xb738('0x3d')](_0xb738('0x3e'));this[_0xb738('0xa')][_0x3c2d22[_0xb738('0x29')]][_0x133b2b][_0xb738('0x44')]=_0xb738('0x5b');this[_0xb738('0xa')][_0x3c2d22['uniqueid']][_0x133b2b][_0xb738('0x52')]='abandoned';logger[_0xb738('0x27')](_0xb738('0x5c'),_0x3c2d22[_0xb738('0x29')],util[_0xb738('0x2a')](this['channels'][_0x3c2d22[_0xb738('0x29')]][_0x133b2b],{'showHidden':![],'depth':null}));ami[_0xb738('0x20')](_0xb738('0x5d'),this[_0xb738('0xa')][_0x3c2d22['uniqueid']][_0x133b2b]);}}}}}catch(_0x511586){logger['error'](_0xb738('0x5e'),_0x3c2d22[_0xb738('0x29')],util['inspect'](_0x511586,{'showHidden':![],'depth':null}));}};VoiceAgentReport[_0xb738('0x1f')]['syncAgentComplete']=function(_0x4d1f1a){try{if(this[_0xb738('0x21')](_0x4d1f1a)){logger['debug'](_0xb738('0x5f'),_0x4d1f1a[_0xb738('0x29')],util[_0xb738('0x2a')](_0x4d1f1a,{'showHidden':![],'depth':null}));if(this['channels'][_0x4d1f1a['uniqueid']]){for(var _0x4e292a in this[_0xb738('0xa')][_0x4d1f1a['uniqueid']]){if(this[_0xb738('0xa')][_0x4d1f1a['uniqueid']][_0xb738('0x3b')](_0x4e292a)){if(this['channels'][_0x4d1f1a[_0xb738('0x29')]][_0x4e292a][_0xb738('0x60')]&&!this[_0xb738('0xa')][_0x4d1f1a[_0xb738('0x29')]][_0x4e292a][_0xb738('0x4d')]){logger[_0xb738('0x24')](_0xb738('0x61'),_0x4d1f1a['uniqueid'],this[_0xb738('0xa')][_0x4d1f1a['uniqueid']][_0x4e292a]['membername'],_0x4e292a);this[_0xb738('0xa')][_0x4d1f1a[_0xb738('0x29')]][_0x4e292a][_0xb738('0x4d')]=!![];this[_0xb738('0xa')][_0x4d1f1a[_0xb738('0x29')]][_0x4e292a]['agentcompleteAt']=moment()[_0xb738('0x3d')](_0xb738('0x3e'));this[_0xb738('0xa')][_0x4d1f1a[_0xb738('0x29')]][_0x4e292a][_0xb738('0x44')]=_0xb738('0x62');this[_0xb738('0xa')][_0x4d1f1a[_0xb738('0x29')]][_0x4e292a]['reason']=_0x4d1f1a['reason']==_0xb738('0x63')?_0xb738('0x64'):_0x4d1f1a[_0xb738('0x52')];this[_0xb738('0xa')][_0x4d1f1a[_0xb738('0x29')]][_0x4e292a]['talktime']=_0x4d1f1a[_0xb738('0x65')];if(this['voiceQueues'][_0x4d1f1a[_0xb738('0x2c')]]&&this[_0xb738('0xc')][_0x4d1f1a['queue']][_0xb738('0x66')]){this[_0xb738('0xa')][_0x4d1f1a[_0xb738('0x29')]][_0x4e292a][_0xb738('0x67')]=this[_0xb738('0xc')][_0x4d1f1a[_0xb738('0x2c')]][_0xb738('0x68')];this[_0xb738('0xa')][_0x4d1f1a[_0xb738('0x29')]][_0x4e292a][_0xb738('0x69')]=!![];}this[_0xb738('0xd')][_0x4d1f1a['interface']]=_[_0xb738('0x31')](this[_0xb738('0xd')][_0x4d1f1a[_0xb738('0x2b')]],[_0xb738('0x2c'),_0xb738('0x47')]);logger[_0xb738('0x27')]('[%s][voiceAgentReport][agentcomplete]\x20sending\x20agentcomplete\x20event:',_0x4d1f1a[_0xb738('0x29')],util[_0xb738('0x2a')](this[_0xb738('0xa')][_0x4d1f1a[_0xb738('0x29')]][_0x4e292a],{'showHidden':![],'depth':null}));ami[_0xb738('0x20')](_0xb738('0x6a'),this['channels'][_0x4d1f1a[_0xb738('0x29')]][_0x4e292a]);logger[_0xb738('0x27')]('[%s][voiceAgentReport][agentcomplete]\x20sending\x20user:agentcomplete\x20event:',_0x4d1f1a['uniqueid'],util['inspect']({'id':this[_0xb738('0xd')][_0x4d1f1a[_0xb738('0x2b')]]['id'],'destaccountcode':_0x4d1f1a[_0xb738('0x6b')]},{'showHidden':![],'depth':null}));this[_0xb738('0x20')](util['format'](_0xb738('0x37'),_0x4d1f1a['membername']),_0xb738('0x6c'),{'id':this[_0xb738('0xd')][_0x4d1f1a['interface']]['id'],'destaccountcode':Number(_0x4d1f1a[_0xb738('0x6b')])});}}}}}}catch(_0x4b5c28){logger[_0xb738('0x39')]('[%s][voiceAgentReport][agentcomplete]',_0x4d1f1a[_0xb738('0x29')],util[_0xb738('0x2a')](_0x4b5c28,{'showHidden':![],'depth':null}));}};VoiceAgentReport[_0xb738('0x1f')]['syncVarSet']=function(_0x372ef7){try{if(this['isNotNull'](_0x372ef7)){logger['debug']('[%s][voiceAgentReport][varset]\x20event:',_0x372ef7[_0xb738('0x29')],util[_0xb738('0x2a')](_0x372ef7,{'showHidden':![],'depth':null}));this[_0xb738('0x6d')](_0x372ef7[_0xb738('0x29')],_[_0xb738('0x6e')](_0x372ef7[_0xb738('0x6f')])[0x0],_0x372ef7[_0xb738('0x70')]);if(this[_0xb738('0xa')][_0x372ef7[_0xb738('0x29')]]){for(var _0x39e49e in this[_0xb738('0xa')][_0x372ef7[_0xb738('0x29')]]){if(this[_0xb738('0xa')][_0x372ef7[_0xb738('0x29')]][_0xb738('0x3b')](_0x39e49e)){logger[_0xb738('0x24')](_0xb738('0x71'),_0x372ef7['uniqueid'],_0x39e49e,_[_0xb738('0x6e')](_0x372ef7[_0xb738('0x6f')])[0x0],_0x372ef7[_0xb738('0x70')]);if(_[_0xb738('0x22')](this[_0xb738('0xa')][_0x372ef7[_0xb738('0x29')]][_0x39e49e][_0xb738('0xe')])){this[_0xb738('0xa')][_0x372ef7['uniqueid']][_0x39e49e][_0xb738('0xe')]={};}this[_0xb738('0xa')][_0x372ef7[_0xb738('0x29')]][_0x39e49e][_0xb738('0xe')]=this['variables'][_0x372ef7[_0xb738('0x29')]];}}}}}catch(_0x15af5d){logger[_0xb738('0x39')]('[%s][voiceAgentReport][varset]',_0x372ef7['uniqueid'],util[_0xb738('0x2a')](_0x15af5d,{'showHidden':![],'depth':null}));}};VoiceAgentReport['prototype'][_0xb738('0x6d')]=function(_0x1186bc,_0x2ce8f6,_0x3dbed1){var _0x7e073=[_0xb738('0x72'),_0xb738('0x73'),_0xb738('0x74'),'rtpaudioqosjitterbridged',_0xb738('0x75'),_0xb738('0x76'),_0xb738('0x77'),'rtpaudioqosrttbridged',_0xb738('0x78'),_0xb738('0x79'),_0xb738('0x7a'),_0xb738('0x7b'),_0xb738('0x7c'),_0xb738('0x7d'),_0xb738('0x7e'),_0xb738('0x7f'),_0xb738('0x26'),_0xb738('0x80'),_0xb738('0x81')];if(!_[_0xb738('0x82')](_0x2ce8f6)&&!_[_0xb738('0x83')](_0x7e073,_0x2ce8f6)){if(_['isUndefined'](this[_0xb738('0xe')][_0x1186bc])){this[_0xb738('0xe')][_0x1186bc]={};}this['variables'][_0x1186bc][_0x2ce8f6]=_0x3dbed1;}};VoiceAgentReport['prototype'][_0xb738('0x84')]=function(_0x2d00eb){try{if(this[_0xb738('0x21')](_0x2d00eb)){logger[_0xb738('0x27')](_0xb738('0x85'),_0x2d00eb['uniqueid'],util[_0xb738('0x2a')](_0x2d00eb,{'showHidden':![],'depth':null}));if(this[_0xb738('0xa')][_0x2d00eb['uniqueid']]){for(var _0x58fdf1 in this[_0xb738('0xa')][_0x2d00eb[_0xb738('0x29')]]){if(this[_0xb738('0xa')][_0x2d00eb[_0xb738('0x29')]][_0xb738('0x3b')](_0x58fdf1)){if(this['channels'][_0x2d00eb[_0xb738('0x29')]][_0x58fdf1]['reason']==_0xb738('0x63')&&this[_0xb738('0xa')][_0x2d00eb['uniqueid']][_0x58fdf1][_0xb738('0x4d')]){logger[_0xb738('0x24')](_0xb738('0x86'),_0x2d00eb[_0xb738('0x29')],_0x58fdf1);this['channels'][_0x2d00eb[_0xb738('0x29')]][_0x58fdf1][_0xb738('0x87')]=moment()[_0xb738('0x3d')](_0xb738('0x3e'));}}}logger[_0xb738('0x27')](_0xb738('0x88'),_0x2d00eb[_0xb738('0x29')],util['inspect'](_[_0xb738('0x89')](this['channels'][_0x2d00eb[_0xb738('0x29')]]),{'showHidden':![],'depth':null}));ami[_0xb738('0x20')](_0xb738('0x8a'),_[_0xb738('0x89')](this[_0xb738('0xa')][_0x2d00eb[_0xb738('0x29')]]));this[_0xb738('0x8b')](_0x2d00eb['uniqueid']);}if(this[_0xb738('0xe')][_0x2d00eb[_0xb738('0x29')]]){delete this['variables'][_0x2d00eb['uniqueid']];}}}catch(_0x924f8f){logger[_0xb738('0x39')]('[%s][voiceAgentReport][hangup]',_0x2d00eb[_0xb738('0x29')],util[_0xb738('0x2a')](_0x924f8f,{'showHidden':![],'depth':null}));}};VoiceAgentReport[_0xb738('0x1f')][_0xb738('0x1d')]=function(_0x5394a5){try{if(this['isNotNull'](_0x5394a5)){logger[_0xb738('0x27')](_0xb738('0x8c'),_0x5394a5[_0xb738('0x29')],util[_0xb738('0x2a')](_0x5394a5,{'showHidden':![],'depth':null}));if(this[_0xb738('0xa')][_0x5394a5[_0xb738('0x8d')]]){for(var _0x30d3bd in this[_0xb738('0xa')][_0x5394a5[_0xb738('0x8d')]]){if(this[_0xb738('0xa')][_0x5394a5[_0xb738('0x8d')]]['hasOwnProperty'](_0x30d3bd)){if(_0x5394a5[_0xb738('0x8e')]===_0x30d3bd){logger[_0xb738('0x24')]('[%s][voiceAgentReport][attendedtransfer]\x20agent:%s\x20destuniqueid:%s\x20lastevent:complete',_0x5394a5['uniqueid'],this['channels'][_0x5394a5['transfereeuniqueid']][_0x30d3bd]['membername'],_0x30d3bd);var _0x52aa14=moment();this[_0xb738('0xa')][_0x5394a5['transfereeuniqueid']][_0x30d3bd][_0xb738('0x4d')]=!![];this[_0xb738('0xa')][_0x5394a5['transfereeuniqueid']][_0x30d3bd][_0xb738('0x87')]=moment()[_0xb738('0x3d')]('YYYY-MM-DD\x20HH:mm:ss');this['channels'][_0x5394a5['transfereeuniqueid']][_0x30d3bd][_0xb738('0x44')]=_0xb738('0x62');this[_0xb738('0xa')][_0x5394a5[_0xb738('0x8d')]][_0x30d3bd]['reason']='transfer';this[_0xb738('0xa')][_0x5394a5['transfereeuniqueid']][_0x30d3bd][_0xb738('0x65')]=_0x52aa14[_0xb738('0x8f')](this[_0xb738('0xa')][_0x5394a5[_0xb738('0x8d')]][_0x30d3bd]['agentconnectAt'],_0xb738('0x90'));}}}}if(this['channels'][_0x5394a5[_0xb738('0x91')]]){var _0x218fce=this[_0xb738('0xa')][_0x5394a5[_0xb738('0x91')]];this[_0xb738('0xa')][_0x5394a5[_0xb738('0x91')]]=this[_0xb738('0xa')][_0x5394a5[_0xb738('0x8d')]];this[_0xb738('0xa')][_0x5394a5['transfereeuniqueid']]=_0x218fce;}}}catch(_0x48bd7a){logger[_0xb738('0x39')](_0xb738('0x92'),_0x5394a5['uniqueid'],util['inspect'](_0x48bd7a,{'showHidden':![],'depth':null}));}};VoiceAgentReport['prototype'][_0xb738('0x93')]=function(_0x6aeae3){try{if(this[_0xb738('0x21')](_0x6aeae3)){logger['debug']('[%s][voiceAgentReport][blindtransfer]\x20event:',_0x6aeae3[_0xb738('0x29')],util['inspect'](_0x6aeae3,{'showHidden':![],'depth':null}));if(this[_0xb738('0xa')][_0x6aeae3[_0xb738('0x8d')]]){for(var _0x422771 in this[_0xb738('0xa')][_0x6aeae3[_0xb738('0x8d')]]){if(this[_0xb738('0xa')][_0x6aeae3['transfereeuniqueid']][_0xb738('0x3b')](_0x422771)){if(_0x6aeae3[_0xb738('0x94')]===_0x422771){logger[_0xb738('0x24')](_0xb738('0x95'),_0x6aeae3[_0xb738('0x29')],this[_0xb738('0xa')][_0x6aeae3[_0xb738('0x8d')]][_0x422771][_0xb738('0x26')],_0x422771);var _0x40568b=moment();this[_0xb738('0xa')][_0x6aeae3[_0xb738('0x8d')]][_0x422771][_0xb738('0x4d')]=!![];this[_0xb738('0xa')][_0x6aeae3[_0xb738('0x8d')]][_0x422771][_0xb738('0x87')]=_0x40568b;this[_0xb738('0xa')][_0x6aeae3[_0xb738('0x8d')]][_0x422771][_0xb738('0x44')]='complete';this[_0xb738('0xa')][_0x6aeae3[_0xb738('0x8d')]][_0x422771][_0xb738('0x52')]=_0xb738('0x63');this[_0xb738('0xa')][_0x6aeae3['transfereeuniqueid']][_0x422771][_0xb738('0x65')]=_0x40568b['diff'](this['channels'][_0x6aeae3[_0xb738('0x8d')]][_0x422771]['agentconnectAt'],_0xb738('0x90'));}}}}}}catch(_0x3bc812){logger[_0xb738('0x39')](_0xb738('0x96'),_0x6aeae3[_0xb738('0x29')],util[_0xb738('0x2a')](_0x3bc812,{'showHidden':![],'depth':null}));}};VoiceAgentReport[_0xb738('0x1f')][_0xb738('0x1a')]=function(_0x3f651d){var _0x258157='';try{if(this[_0xb738('0x21')](_0x3f651d)){logger[_0xb738('0x27')]('[%s][voiceAgentReport][musiconholdstart]\x20event:',_0x3f651d['uniqueid'],util[_0xb738('0x2a')](_0x3f651d,{'showHidden':![],'depth':null}));if(_0x3f651d[_0xb738('0x97')]){_0x258157=_0x3f651d['channel'][_0xb738('0x98')](0x0,_0x3f651d['channel'][_0xb738('0x99')]('-'));if(this[_0xb738('0xd')][_0x258157]){logger[_0xb738('0x24')]('[%s][voiceAgentReport][musiconholdstart]\x20interface:%s',_0x3f651d[_0xb738('0x29')],_0x258157);this[_0xb738('0xd')][_0x258157][_0xb738('0x9a')]=!![];}}}}catch(_0x549240){logger[_0xb738('0x39')]('[%s][voiceAgentReport][musiconholdstart]',_0x3f651d[_0xb738('0x29')],util['inspect'](_0x549240,{'showHidden':![],'depth':null}));}};VoiceAgentReport[_0xb738('0x1f')][_0xb738('0x1b')]=function(_0x27653e){var _0xd1617f='';try{if(this[_0xb738('0x21')](_0x27653e)){logger[_0xb738('0x27')](_0xb738('0x9b'),_0x27653e['uniqueid'],util['inspect'](_0x27653e,{'showHidden':![],'depth':null}));if(_0x27653e[_0xb738('0x97')]){_0xd1617f=_0x27653e['channel'][_0xb738('0x98')](0x0,_0x27653e[_0xb738('0x97')]['lastIndexOf']('-'));if(this[_0xb738('0xd')][_0xd1617f]){logger[_0xb738('0x24')](_0xb738('0x9c'),_0x27653e[_0xb738('0x29')],_0xd1617f);this['agents'][_0xd1617f][_0xb738('0x9a')]=![];}}}}catch(_0x5e6d7b){logger[_0xb738('0x39')](_0xb738('0x9d'),_0x27653e[_0xb738('0x29')],util[_0xb738('0x2a')](_0x5e6d7b,{'showHidden':![],'depth':null}));}};VoiceAgentReport[_0xb738('0x1f')][_0xb738('0x8b')]=function(_0x54ad7e,_0x387660=0x2710){if(this[_0xb738('0xa')][_0x54ad7e]){setTimeout(()=>{delete this[_0xb738('0xa')][_0x54ad7e];},_0x387660);}};module[_0xb738('0x9e')]=VoiceAgentReport; \ No newline at end of file diff --git a/server/services/ami/report/voiceCallReport.js b/server/services/ami/report/voiceCallReport.js index e78bc6c..3cd472c 100644 --- a/server/services/ami/report/voiceCallReport.js +++ b/server/services/ami/report/voiceCallReport.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0xa499=['diff','connectedlinenum','connectedlinename','toNumber','membername','destinationchannel','UserId','[%s][voiceCallReport][newstate]\x20sending\x20user:agentconnect\x20event:','[%s][voiceCallReport][newstate]','[%s][voiceCallReport][mixMonitorFilename]\x20monitorFilename:%s','endsWith','.wav49','replace','.WAV','monitorFilename','monitors','isNil','rec','[%s][voiceCallReport][mixMonitorFilename]','variable','[%s][voiceCallReport][varset]\x20variable:mixmonitor_filename\x20value:%s','value','syncMixMonitorFilename','[%s][voiceCallReport][varset]\x20variable:xmd-phone\x20value:%s','xmd-callerid','[%s][voiceCallReport][varset]\x20variable:xmd-callerid\x20value:%s','callerid','xmd-cdrtype','xmd-queue','[%s][voiceCallReport][varset]\x20variable:xmd-queue\x20value:%s','originatecalleridnum','xmd-destination','[%s][voiceCallReport][varset]\x20variable:xmd-destination\x20value:%s','destination','[%s][voiceCallReport][varset]\x20variable:xmd-callerid-preview\x20value:%s','calleridpreview','xmcs-queue','sipcallid','[%s][voiceCallReport][varset]\x20variable:sipcallid\x20value:%s','mixmonitor_filename','parse','sipcalllinkedid','[%s][voiceCallReport][varset]','[%s][voiceCallReport][hangup]\x20event:','deleteChannelAfterTimeout','[%s][voiceCallReport][hangup]\x20reason:%s','cause-txt','endtime','billableseconds','omit','[%s][voiceCallReport][hangup]\x20sending\x20user:agentcomplete\x20event:','user:agentcomplete','length','transferType','resolve','then','undefined','transferToInternal','isEmpty','stopRecordingOnTransfer','Action','catch','webbar:stopmonitors','BlindTransfer','outbound','[%s][voiceCallReport][hangup]\x20sending\x20hangup\x20event:','custom:voiceCallReport','origtransferercalleridnum','[%s][voiceCallReport][attendedtransfer]\x20event:','transfereeuniqueid','transfercalleridnum','transferconnectedlinenum','transfertargetcalleridnum','secondtransfereruniqueid','ATTENDED','transfertargetuniqueid','origtransfereruniqueid','some','origtransfererlinkedid','[%s][voiceCallReport][attendedtransfer]','transfereecalleridnum','extension','[%s][voiceCallReport][blindtransfer]\x20event:','syncHangup','transfererchannel','BLIND','[%s][voiceCallReport][blindtransfer]','[%s][voiceCallReport][musiconholdstart]\x20event:','mohstarttime','[%s][voiceCallReport][musiconholdstart]\x20mohstarttime:%s','syncMusicOnHoldStop','[%s][voiceCallReport][musiconholdstop]\x20event:','milliseconds','[%s][voiceCallReport][musiconholdstop]\x20mohtime:%s','mohtime','[%s][voiceCallReport][musiconholdstop]','lodash','moment','util','path','ioredis','../../../config/environment','../../../config/logger','ami','../ami','../model/channel','../rpc/setting','queue','agi','NO\x20ANSWER','FAILED','BUSY','redis','defaults','socket.io-emitter','channels','agents','blindTransfers','syncNewExten','bind','syncNewChannel','newstate','syncNewState','varset','syncVarSet','newcallerid','attendedtransfer','syncAttendedTransfer','syncBlindTransfer','musiconholdstart','syncMusicOnHoldStart','musiconholdstop','info','[voiceCallReport][coreshowchannels]\x20started','actionCoreShowChannels','[voiceCallReport][coreshowchannels]','prototype','isNotNull','isUndefined','emit','syncNewCallerId','[%s][voiceCallReport][newcallerid]\x20calleridname:%s\x20calleridnum:%s','calleridname','debug','[%s][voiceCallReport][newcallerid]\x20event:','uniqueid','inspect','merge','pick','from-sip','exten','xcally-motion-preview','format','user:%s','name','accountcode','error','[%s][voiceCallReport][newcallerid]','[%s][voiceCallReport][newchannel]\x20event:','channel','linkedid','[%s][voiceCallReport][newchannel]\x20context:%s\x20exten:%s','context','starttime','YYYY-MM-DD\x20HH:mm:ss','disposition','channelstate','keys','split','destconnectedlinenum','[%s][voiceCallReport][newchannel]\x20sending\x20user:agentconnect\x20event:','user:agentconnect','[%s][voiceCallReport][newchannel]','OutgoingSpoolFailed','application','toLowerCase','applicationdata','appdata','duration','seconds','includes','lastapplication','lastdata','set','startsWith','cdr(','match','type','[%s][voiceCallReport][newexten]','[%s][voiceCallReport][newstate]\x20linkedid:%s\x20calleridname:%s\x20calleridnum:%s','calleridnum','[%s][voiceCallReport][newstate]\x20event:','answered','answertime','holdtime'];(function(_0x54cc35,_0x41060e){var _0x5d0fcc=function(_0x266b40){while(--_0x266b40){_0x54cc35['push'](_0x54cc35['shift']());}};_0x5d0fcc(++_0x41060e);}(_0xa499,0x1e6));var _0x9a49=function(_0x1762b4,_0x33d836){_0x1762b4=_0x1762b4-0x0;var _0x29beda=_0xa499[_0x1762b4];return _0x29beda;};'use strict';var _=require(_0x9a49('0x0'));var moment=require(_0x9a49('0x1'));var util=require(_0x9a49('0x2'));var path=require(_0x9a49('0x3'));var Redis=require(_0x9a49('0x4'));var config=require(_0x9a49('0x5'));var logger=require(_0x9a49('0x6'))(_0x9a49('0x7'));var ami=require(_0x9a49('0x8'));var Channel=require(_0x9a49('0x9'));var RpcSetting=require(_0x9a49('0xa'));var applications=['set',_0x9a49('0xb'),_0x9a49('0xc'),'dial','playback','voicemail'];var dispositions=[_0x9a49('0xd'),_0x9a49('0xe'),_0x9a49('0xe'),_0x9a49('0xd'),_0x9a49('0xd'),_0x9a49('0xd'),'ANSWERED',_0x9a49('0xf'),'FAILED',_0x9a49('0xe'),_0x9a49('0xe')];config[_0x9a49('0x10')]=_[_0x9a49('0x11')](config['redis'],{'host':'localhost','port':0x18eb});var io=require(_0x9a49('0x12'))(new Redis(config['redis']));function VoiceCallReport(_0x1bc92c){this[_0x9a49('0x13')]=_0x1bc92c[_0x9a49('0x13')];this[_0x9a49('0x14')]=_0x1bc92c[_0x9a49('0x14')];this[_0x9a49('0x15')]={};ami['on']('coreshowchannel',this[_0x9a49('0x16')][_0x9a49('0x17')](this));ami['on']('newexten',this[_0x9a49('0x16')]['bind'](this));ami['on']('newchannel',this[_0x9a49('0x18')]['bind'](this));ami['on'](_0x9a49('0x19'),this[_0x9a49('0x1a')]['bind'](this));ami['on'](_0x9a49('0x1b'),this[_0x9a49('0x1c')][_0x9a49('0x17')](this));ami['on']('hangup',this['syncHangup'][_0x9a49('0x17')](this));ami['on'](_0x9a49('0x1d'),this['syncNewCallerId'][_0x9a49('0x17')](this));ami['on'](_0x9a49('0x1e'),this[_0x9a49('0x1f')]['bind'](this));ami['on']('blindtransfer',this[_0x9a49('0x20')][_0x9a49('0x17')](this));ami['on'](_0x9a49('0x21'),this[_0x9a49('0x22')][_0x9a49('0x17')](this));ami['on'](_0x9a49('0x23'),this['syncMusicOnHoldStop']['bind'](this));try{logger[_0x9a49('0x24')](_0x9a49('0x25'));ami[_0x9a49('0x26')]();}catch(_0x4da84f){logger['error'](_0x9a49('0x27'),util['inspect'](_0x4da84f,{'showHidden':![],'depth':null}));}}VoiceCallReport[_0x9a49('0x28')][_0x9a49('0x29')]=function(_0x5222cd){return _0x5222cd!==null&&!_[_0x9a49('0x2a')](_0x5222cd);};VoiceCallReport['prototype'][_0x9a49('0x2b')]=function(_0x3cf5b9,_0x1332cf,_0x30fb20){io['to'](_0x3cf5b9)['emit'](_0x1332cf,_0x30fb20);};VoiceCallReport[_0x9a49('0x28')][_0x9a49('0x2c')]=function(_0x135085){try{if(this[_0x9a49('0x29')](_0x135085)){logger[_0x9a49('0x24')](_0x9a49('0x2d'),_0x135085['uniqueid'],_0x135085[_0x9a49('0x2e')],_0x135085['calleridnum']);logger[_0x9a49('0x2f')](_0x9a49('0x30'),_0x135085[_0x9a49('0x31')],util[_0x9a49('0x32')](_0x135085,{'showHidden':![],'depth':null}));if(_0x135085[_0x9a49('0x31')]===_0x135085['linkedid']){if(!_[_0x9a49('0x2a')](this[_0x9a49('0x13')][_0x135085[_0x9a49('0x31')]])){_[_0x9a49('0x33')](this[_0x9a49('0x13')][_0x135085['uniqueid']],_[_0x9a49('0x34')](_0x135085,_['keys'](this[_0x9a49('0x13')][_0x135085[_0x9a49('0x31')]])));}}if(_0x135085['context']===_0x9a49('0x35')){var _0x31c3af=this[_0x9a49('0x14')][_0x135085['channel']['split']('-')[0x0]];if(_0x31c3af){if(_0x135085[_0x9a49('0x36')]==_0x9a49('0x37')){_0x31c3af['destconnectedlinenum']=_0x135085['connectedlinenum'];this[_0x9a49('0x2b')](util[_0x9a49('0x38')](_0x9a49('0x39'),_0x31c3af[_0x9a49('0x3a')]),'user:agentconnect',{'id':_0x31c3af['id'],'destaccountcode':_0x31c3af[_0x9a49('0x3b')],'destconnectedlinenum':_0x135085['connectedlinenum']});}}}}}catch(_0x402952){logger[_0x9a49('0x3c')](_0x9a49('0x3d'),_0x135085['uniqueid'],util[_0x9a49('0x32')](_0x402952,{'showHidden':![],'depth':null}));}};VoiceCallReport['prototype'][_0x9a49('0x18')]=function(_0x10c0f2){try{if(this[_0x9a49('0x29')](_0x10c0f2)){logger['debug'](_0x9a49('0x3e'),_0x10c0f2['uniqueid'],util[_0x9a49('0x32')](_0x10c0f2,{'showHidden':![],'depth':null}));if(this[_0x9a49('0x13')][_0x10c0f2[_0x9a49('0x31')]]){return;}if(_0x10c0f2[_0x9a49('0x3f')]==='OutgoingSpoolFailed'){return;}if(_0x10c0f2[_0x9a49('0x31')]!==_0x10c0f2[_0x9a49('0x40')]&&!this[_0x9a49('0x15')][_0x10c0f2[_0x9a49('0x40')]]){return;}logger[_0x9a49('0x24')](_0x9a49('0x41'),_0x10c0f2[_0x9a49('0x31')],_0x10c0f2[_0x9a49('0x42')],_0x10c0f2[_0x9a49('0x36')]);this[_0x9a49('0x13')][_0x10c0f2['uniqueid']]=new Channel();this['channels'][_0x10c0f2[_0x9a49('0x31')]][_0x9a49('0x43')]=moment()['format'](_0x9a49('0x44'));this[_0x9a49('0x13')][_0x10c0f2['uniqueid']][_0x9a49('0x45')]=dispositions[_['toNumber'](_0x10c0f2[_0x9a49('0x46')])];_[_0x9a49('0x33')](this[_0x9a49('0x13')][_0x10c0f2[_0x9a49('0x31')]],_['pick'](_0x10c0f2,_[_0x9a49('0x47')](this[_0x9a49('0x13')][_0x10c0f2[_0x9a49('0x31')]])));if(_0x10c0f2[_0x9a49('0x42')]===_0x9a49('0x35')){var _0x48ae5d=this[_0x9a49('0x14')][_0x10c0f2[_0x9a49('0x3f')][_0x9a49('0x48')]('-')[0x0]];if(_0x48ae5d&&typeof _0x48ae5d['destconnectedlinenum']==='undefined'){_0x48ae5d[_0x9a49('0x49')]=_0x10c0f2[_0x9a49('0x36')];logger[_0x9a49('0x2f')](_0x9a49('0x4a'),_0x10c0f2[_0x9a49('0x31')],util[_0x9a49('0x32')]({'id':_0x48ae5d['id'],'destaccountcode':_0x48ae5d['accountcode'],'destconnectedlinenum':_0x10c0f2[_0x9a49('0x36')]},{'showHidden':![],'depth':null}));this[_0x9a49('0x2b')](util[_0x9a49('0x38')](_0x9a49('0x39'),_0x48ae5d[_0x9a49('0x3a')]),_0x9a49('0x4b'),{'id':_0x48ae5d['id'],'destaccountcode':_0x48ae5d[_0x9a49('0x3b')],'destconnectedlinenum':_0x10c0f2[_0x9a49('0x36')]});}}}}catch(_0x25e130){logger[_0x9a49('0x3c')](_0x9a49('0x4c'),_0x10c0f2['uniqueid'],util[_0x9a49('0x32')](_0x25e130,{'showHidden':![],'depth':null}));}};VoiceCallReport[_0x9a49('0x28')][_0x9a49('0x16')]=function(_0x508a94){try{if(this['isNotNull'](_0x508a94)){logger[_0x9a49('0x2f')]('[%s][voiceCallReport][newexten]\x20event:',_0x508a94[_0x9a49('0x31')],util[_0x9a49('0x32')](_0x508a94,{'showHidden':![],'depth':null}));if(_0x508a94[_0x9a49('0x3f')]===_0x9a49('0x4d')||_0x508a94[_0x9a49('0x36')]==='h')return;if(_0x508a94['uniqueid']===_0x508a94[_0x9a49('0x40')]||this[_0x9a49('0x15')][_0x508a94[_0x9a49('0x40')]]){_0x508a94[_0x9a49('0x4e')]=_0x508a94[_0x9a49('0x4e')]?_0x508a94[_0x9a49('0x4e')][_0x9a49('0x4f')]():undefined;_0x508a94[_0x9a49('0x50')]=_0x508a94['appdata']||_0x508a94[_0x9a49('0x50')];if(_0x508a94[_0x9a49('0x51')]&&_0x508a94[_0x9a49('0x4e')]!=='queue'){_0x508a94['applicationdata']=_0x508a94[_0x9a49('0x50')][_0x9a49('0x4f')]();}logger['info']('[%s][voiceCallReport][newexten]\x20application:%s\x20appdata:%s',_0x508a94[_0x9a49('0x31')],_0x508a94[_0x9a49('0x4e')],_0x508a94['applicationdata']);if(_[_0x9a49('0x2a')](this[_0x9a49('0x13')][_0x508a94[_0x9a49('0x31')]])){this[_0x9a49('0x13')][_0x508a94['uniqueid']]=new Channel();this[_0x9a49('0x13')][_0x508a94['uniqueid']][_0x9a49('0x43')]=_0x508a94['duration']?moment()['subtract'](moment[_0x9a49('0x52')](_0x508a94[_0x9a49('0x52')])[_0x9a49('0x53')](),_0x9a49('0x53'))[_0x9a49('0x38')](_0x9a49('0x44')):moment()[_0x9a49('0x38')](_0x9a49('0x44'));this[_0x9a49('0x13')][_0x508a94[_0x9a49('0x31')]][_0x9a49('0x45')]=_0x9a49('0xd');}_[_0x9a49('0x33')](this[_0x9a49('0x13')][_0x508a94[_0x9a49('0x31')]],_[_0x9a49('0x34')](_0x508a94,_[_0x9a49('0x47')](this[_0x9a49('0x13')][_0x508a94[_0x9a49('0x31')]])));if(_[_0x9a49('0x54')](applications,_0x508a94[_0x9a49('0x4e')])){this[_0x9a49('0x13')][_0x508a94[_0x9a49('0x31')]][_0x9a49('0x55')]=_0x508a94[_0x9a49('0x4e')];this['channels'][_0x508a94['uniqueid']][_0x9a49('0x56')]=_0x508a94[_0x9a49('0x50')];if(_0x508a94['application']===_0x9a49('0x57')&&_[_0x9a49('0x58')](_0x508a94[_0x9a49('0x50')][_0x9a49('0x4f')](),_0x9a49('0x59'))){var _0x3ea642=_0x508a94[_0x9a49('0x50')][_0x9a49('0x48')]('=');var _0x4e6ce2=_0x3ea642[0x0][_0x9a49('0x4f')]()[_0x9a49('0x5a')](/cdr\((.*)\)/);if(_0x4e6ce2){if(_0x4e6ce2[0x1]===_0x9a49('0x5b')&&!_['isNil'](this['channels'][_0x508a94[_0x9a49('0x31')]][_0x4e6ce2[0x1]]))return;this['channels'][_0x508a94[_0x9a49('0x31')]][_0x4e6ce2[0x1]]=_0x3ea642[0x1];}}else if(_0x508a94[_0x9a49('0x4e')]===_0x9a49('0xb')){this['channels'][_0x508a94[_0x9a49('0x31')]]['queue']=_0x508a94[_0x9a49('0x50')]['split'](',')[0x0];}}}}}catch(_0x569957){logger[_0x9a49('0x3c')](_0x9a49('0x5c'),_0x508a94[_0x9a49('0x31')],util[_0x9a49('0x32')](_0x569957,{'showHidden':![],'depth':null}));}};VoiceCallReport['prototype'][_0x9a49('0x1a')]=function(_0x5a28a0){try{if(this['isNotNull'](_0x5a28a0)){logger[_0x9a49('0x24')](_0x9a49('0x5d'),_0x5a28a0[_0x9a49('0x31')],_0x5a28a0[_0x9a49('0x40')],_0x5a28a0['calleridname'],_0x5a28a0[_0x9a49('0x5e')]);logger[_0x9a49('0x2f')](_0x9a49('0x5f'),_0x5a28a0[_0x9a49('0x31')],util[_0x9a49('0x32')](_0x5a28a0,{'showHidden':![],'depth':null}));if(_0x5a28a0[_0x9a49('0x46')]!=='6')return;var _0x4ca95a=this['agents'][_0x5a28a0[_0x9a49('0x3f')][_0x9a49('0x48')]('-')[0x0]];if(_0x5a28a0['uniqueid']!==_0x5a28a0[_0x9a49('0x40')]){var _0x4c44d3=moment();if(this['channels'][_0x5a28a0['linkedid']]){if(!this[_0x9a49('0x13')][_0x5a28a0['linkedid']]['answered']){this[_0x9a49('0x13')][_0x5a28a0['linkedid']][_0x9a49('0x60')]=!![];this[_0x9a49('0x13')][_0x5a28a0[_0x9a49('0x40')]][_0x9a49('0x61')]=_0x4c44d3['format'](_0x9a49('0x44'));if(this['channels'][_0x5a28a0[_0x9a49('0x40')]]['starttime']){this[_0x9a49('0x13')][_0x5a28a0[_0x9a49('0x40')]][_0x9a49('0x62')]=_0x4c44d3[_0x9a49('0x63')](this['channels'][_0x5a28a0[_0x9a49('0x40')]][_0x9a49('0x43')],_0x9a49('0x53'));}}this[_0x9a49('0x13')][_0x5a28a0[_0x9a49('0x40')]][_0x9a49('0x40')]=_0x5a28a0[_0x9a49('0x31')];if(_0x5a28a0['calleridnum']!=='xcally-motion-preview'){this['channels'][_0x5a28a0['linkedid']][_0x9a49('0x64')]=_0x5a28a0[_0x9a49('0x5e')];}this[_0x9a49('0x13')][_0x5a28a0[_0x9a49('0x40')]][_0x9a49('0x65')]=_0x5a28a0['calleridname'];this[_0x9a49('0x13')][_0x5a28a0[_0x9a49('0x40')]]['destinationchannel']=_0x5a28a0[_0x9a49('0x3f')];this[_0x9a49('0x13')][_0x5a28a0[_0x9a49('0x40')]][_0x9a49('0x45')]=dispositions[_[_0x9a49('0x66')](_0x5a28a0[_0x9a49('0x46')])];if(_0x4ca95a){this['channels'][_0x5a28a0[_0x9a49('0x40')]]['UserId']=_0x4ca95a['id'];this['channels'][_0x5a28a0[_0x9a49('0x40')]][_0x9a49('0x67')]=_0x4ca95a['name'];}}if(this[_0x9a49('0x13')][_0x5a28a0[_0x9a49('0x31')]]){if(!this[_0x9a49('0x13')][_0x5a28a0[_0x9a49('0x31')]][_0x9a49('0x60')]){this[_0x9a49('0x13')][_0x5a28a0[_0x9a49('0x31')]][_0x9a49('0x60')]=!![];this['channels'][_0x5a28a0[_0x9a49('0x31')]]['answertime']=_0x4c44d3['format'](_0x9a49('0x44'));if(this['channels'][_0x5a28a0['uniqueid']][_0x9a49('0x43')]){this[_0x9a49('0x13')][_0x5a28a0[_0x9a49('0x31')]]['holdtime']=_0x4c44d3[_0x9a49('0x63')](this[_0x9a49('0x13')][_0x5a28a0['uniqueid']][_0x9a49('0x43')],'seconds');}}if(_0x5a28a0[_0x9a49('0x5e')]!==_0x9a49('0x37')){this[_0x9a49('0x13')][_0x5a28a0['uniqueid']][_0x9a49('0x64')]=_0x5a28a0[_0x9a49('0x5e')];}this[_0x9a49('0x13')][_0x5a28a0[_0x9a49('0x31')]][_0x9a49('0x65')]=_0x5a28a0[_0x9a49('0x2e')];this['channels'][_0x5a28a0[_0x9a49('0x31')]][_0x9a49('0x68')]=_0x5a28a0['channel'];this['channels'][_0x5a28a0[_0x9a49('0x31')]][_0x9a49('0x45')]=dispositions[_[_0x9a49('0x66')](_0x5a28a0[_0x9a49('0x46')])];}}else{if(this[_0x9a49('0x13')][_0x5a28a0[_0x9a49('0x31')]]){if(_0x4ca95a){this[_0x9a49('0x13')][_0x5a28a0[_0x9a49('0x31')]][_0x9a49('0x69')]=_0x4ca95a['id'];this[_0x9a49('0x13')][_0x5a28a0[_0x9a49('0x31')]]['membername']=_0x4ca95a[_0x9a49('0x3a')];}}}if(_0x5a28a0[_0x9a49('0x42')]===_0x9a49('0x35')){if(_0x4ca95a){_0x4ca95a[_0x9a49('0x49')]=_0x5a28a0[_0x9a49('0x36')];var _0x578dcf;if(this[_0x9a49('0x13')][_0x5a28a0[_0x9a49('0x31')]]){_0x578dcf=this['channels'][_0x5a28a0[_0x9a49('0x31')]][_0x9a49('0xb')];}else if(this['channels'][_0x5a28a0[_0x9a49('0x40')]]){_0x578dcf=this[_0x9a49('0x13')][_0x5a28a0[_0x9a49('0x40')]][_0x9a49('0xb')];}_0x4ca95a['queue']=_0x578dcf;var _0x5e02b8={'id':_0x4ca95a['id'],'name':_0x4ca95a[_0x9a49('0x3a')],'agentconnected':!![],'destaccountcode':_0x4ca95a[_0x9a49('0x3b')],'destconnectedlinenum':_0x5a28a0[_0x9a49('0x36')],'queue':_0x578dcf||undefined,'uniqueid':_0x5a28a0[_0x9a49('0x40')]};logger[_0x9a49('0x2f')](_0x9a49('0x6a'),_0x5a28a0[_0x9a49('0x31')],util[_0x9a49('0x32')](_0x5e02b8,{'showHidden':![],'depth':null}));this[_0x9a49('0x2b')](util[_0x9a49('0x38')](_0x9a49('0x39'),_0x4ca95a[_0x9a49('0x3a')]),_0x9a49('0x4b'),_0x5e02b8);}}}}catch(_0xf26c6c){logger[_0x9a49('0x3c')](_0x9a49('0x6b'),_0x5a28a0[_0x9a49('0x31')],util['inspect'](_0xf26c6c,{'showHidden':![],'depth':null}));}};VoiceCallReport[_0x9a49('0x28')]['syncMixMonitorFilename']=function(_0xcc4a2f,_0xd517c2){try{if(this[_0x9a49('0x13')][_0xcc4a2f]){logger[_0x9a49('0x24')](_0x9a49('0x6c'),_0xcc4a2f,_0xd517c2);this[_0x9a49('0x13')][_0xcc4a2f]['monitor']=!![];if(_[_0x9a49('0x6d')](_0xd517c2,_0x9a49('0x6e'))){_0xd517c2=_0xd517c2[_0x9a49('0x6f')](_0x9a49('0x6e'),_0x9a49('0x70'));}this['channels'][_0xcc4a2f][_0x9a49('0x71')]=_0xd517c2;var _0x242149=_['find'](this[_0x9a49('0x13')][_0xcc4a2f][_0x9a49('0x72')],{'filename':_0xd517c2});if(_[_0x9a49('0x73')](_0x242149)){this[_0x9a49('0x13')][_0xcc4a2f][_0x9a49('0x72')]['push']({'filename':_0xd517c2,'createdAt':moment()[_0x9a49('0x38')](_0x9a49('0x44')),'mixmonitorid':'','status':_0x9a49('0x74')});}}}catch(_0x26dc7c){logger[_0x9a49('0x3c')](_0x9a49('0x75'),_0xcc4a2f,util['inspect'](_0x26dc7c,{'showHidden':![],'depth':null}));}};VoiceCallReport['prototype'][_0x9a49('0x1c')]=function(_0x485b67){try{if(this['isNotNull'](_0x485b67)){logger[_0x9a49('0x2f')]('[%s][voiceCallReport][varset]\x20event:',_0x485b67[_0x9a49('0x31')],util[_0x9a49('0x32')](_0x485b67,{'showHidden':![],'depth':null}));if(this[_0x9a49('0x13')][_0x485b67['uniqueid']]&&_0x485b67[_0x9a49('0x3f')]!=_0x9a49('0x4d')){if(this[_0x9a49('0x29')](_0x485b67[_0x9a49('0x76')])){if(this['isNotNull'](_0x485b67[_0x9a49('0x76')]['mixmonitor_filename'])){logger[_0x9a49('0x24')](_0x9a49('0x77'),_0x485b67[_0x9a49('0x31')],_0x485b67[_0x9a49('0x78')]);this[_0x9a49('0x79')](_0x485b67[_0x9a49('0x31')],_0x485b67[_0x9a49('0x78')]);}else if(this['isNotNull'](_0x485b67['variable']['xmd-phone'])){logger[_0x9a49('0x24')](_0x9a49('0x7a'),_0x485b67[_0x9a49('0x31')],_0x485b67[_0x9a49('0x78')]);this[_0x9a49('0x13')][_0x485b67[_0x9a49('0x31')]][_0x9a49('0x5e')]=_0x485b67[_0x9a49('0x78')];}else if(this[_0x9a49('0x29')](_0x485b67[_0x9a49('0x76')][_0x9a49('0x7b')])){logger[_0x9a49('0x24')](_0x9a49('0x7c'),_0x485b67[_0x9a49('0x31')],_0x485b67[_0x9a49('0x78')]);this['channels'][_0x485b67[_0x9a49('0x31')]][_0x9a49('0x7d')]=_0x485b67['value'];}else if(this[_0x9a49('0x29')](_0x485b67[_0x9a49('0x76')][_0x9a49('0x7e')])){logger['info']('[%s][voiceCallReport][varset]\x20variable:xmd-cdrtype\x20value:%s',_0x485b67[_0x9a49('0x31')],_0x485b67[_0x9a49('0x78')]);this[_0x9a49('0x13')][_0x485b67[_0x9a49('0x31')]][_0x9a49('0x5b')]=_0x485b67[_0x9a49('0x78')];}else if(this[_0x9a49('0x29')](_0x485b67['variable'][_0x9a49('0x7f')])){logger[_0x9a49('0x24')](_0x9a49('0x80'),_0x485b67[_0x9a49('0x31')],_0x485b67[_0x9a49('0x78')]['split'](',')[0x0]);this['channels'][_0x485b67[_0x9a49('0x31')]][_0x9a49('0xb')]=_0x485b67[_0x9a49('0x78')][_0x9a49('0x48')](',')[0x0];}else if(this[_0x9a49('0x29')](_0x485b67[_0x9a49('0x76')]['xmd-originatecalleridnum'])){logger[_0x9a49('0x24')]('[%s][voiceCallReport][varset]\x20variable:xmd-originatecalleridnum\x20value:%s',_0x485b67[_0x9a49('0x31')],_0x485b67[_0x9a49('0x78')]);this['channels'][_0x485b67[_0x9a49('0x31')]][_0x9a49('0x81')]=_0x485b67[_0x9a49('0x78')];}else if(this[_0x9a49('0x29')](_0x485b67[_0x9a49('0x76')][_0x9a49('0x82')])){logger[_0x9a49('0x24')](_0x9a49('0x83'),_0x485b67[_0x9a49('0x31')],_0x485b67['value']);this[_0x9a49('0x13')][_0x485b67[_0x9a49('0x31')]][_0x9a49('0x84')]=_0x485b67[_0x9a49('0x78')];}else if(this[_0x9a49('0x29')](_0x485b67[_0x9a49('0x76')]['xmd-callerid-preview'])){logger[_0x9a49('0x24')](_0x9a49('0x85'),_0x485b67[_0x9a49('0x31')],_0x485b67[_0x9a49('0x78')]);this[_0x9a49('0x13')][_0x485b67['uniqueid']][_0x9a49('0x86')]=_0x485b67[_0x9a49('0x78')];}else if(this[_0x9a49('0x29')](_0x485b67[_0x9a49('0x76')][_0x9a49('0x87')])){logger[_0x9a49('0x24')]('[%s][voiceCallReport][varset]\x20variable:xmcs-queue\x20value:%s',_0x485b67[_0x9a49('0x31')],_0x485b67[_0x9a49('0x78')]);this[_0x9a49('0x13')][_0x485b67[_0x9a49('0x31')]][_0x9a49('0xb')]=_0x485b67[_0x9a49('0x78')];}else if(this['isNotNull'](_0x485b67[_0x9a49('0x76')][_0x9a49('0x88')])){logger[_0x9a49('0x24')](_0x9a49('0x89'),_0x485b67[_0x9a49('0x31')],_0x485b67[_0x9a49('0x78')]);this[_0x9a49('0x13')][_0x485b67[_0x9a49('0x31')]]['sipcalluniqueid']=_0x485b67[_0x9a49('0x78')];}}}else if(this['isNotNull'](_0x485b67[_0x9a49('0x76')][_0x9a49('0x8a')])){if(_0x485b67[_0x9a49('0x78')]){var _0x547216=path[_0x9a49('0x8b')](_0x485b67[_0x9a49('0x78')])[_0x9a49('0x3a')];logger[_0x9a49('0x24')]('[%s][voiceCallReport][varset]\x20variable:mixmonitor_filename\x20value:%s',_0x547216,_0x485b67[_0x9a49('0x78')]);this[_0x9a49('0x79')](_0x547216,_0x485b67[_0x9a49('0x78')]);}}else if(this[_0x9a49('0x13')][_0x485b67[_0x9a49('0x40')]]){if(this[_0x9a49('0x29')](_0x485b67[_0x9a49('0x76')])){if(this['isNotNull'](_0x485b67[_0x9a49('0x76')][_0x9a49('0x88')])){logger[_0x9a49('0x24')](_0x9a49('0x89'),_0x485b67[_0x9a49('0x40')],_0x485b67['value']);this[_0x9a49('0x13')][_0x485b67[_0x9a49('0x40')]][_0x9a49('0x8c')]=_0x485b67['value'];}}}}}catch(_0x2ef538){logger[_0x9a49('0x3c')](_0x9a49('0x8d'),_0x485b67[_0x9a49('0x31')],util['inspect'](_0x2ef538,{'showHidden':![],'depth':null}));}};VoiceCallReport[_0x9a49('0x28')]['syncHangup']=function(_0x20a0c2){try{if(this['isNotNull'](_0x20a0c2)){logger[_0x9a49('0x2f')](_0x9a49('0x8e'),_0x20a0c2['uniqueid'],util['inspect'](_0x20a0c2,{'showHidden':![],'depth':null}));if(this['blindTransfers'][_0x20a0c2[_0x9a49('0x40')]]){if(this[_0x9a49('0x13')][this['blindTransfers'][_0x20a0c2[_0x9a49('0x40')]][_0x9a49('0x40')]]){this[_0x9a49('0x13')][this[_0x9a49('0x15')][_0x20a0c2[_0x9a49('0x40')]][_0x9a49('0x40')]]['uniqueid']=_0x20a0c2[_0x9a49('0x31')];this['channels'][this['blindTransfers'][_0x20a0c2[_0x9a49('0x40')]][_0x9a49('0x40')]][_0x9a49('0x60')]=this[_0x9a49('0x13')][_0x20a0c2[_0x9a49('0x31')]][_0x9a49('0x60')];this[_0x9a49('0x13')][this[_0x9a49('0x15')][_0x20a0c2['linkedid']][_0x9a49('0x40')]]['answertime']=this[_0x9a49('0x13')][_0x20a0c2[_0x9a49('0x31')]]['answertime'];this[_0x9a49('0x13')][this[_0x9a49('0x15')][_0x20a0c2[_0x9a49('0x40')]][_0x9a49('0x40')]]['destinationchannel']=this[_0x9a49('0x13')][this['blindTransfers'][_0x20a0c2[_0x9a49('0x40')]]['linkedid']]['channel'];this[_0x9a49('0x13')][this[_0x9a49('0x15')][_0x20a0c2[_0x9a49('0x40')]][_0x9a49('0x40')]][_0x9a49('0x45')]=this[_0x9a49('0x13')][_0x20a0c2['uniqueid']][_0x9a49('0x45')];this[_0x9a49('0x13')][_0x20a0c2[_0x9a49('0x31')]]=this[_0x9a49('0x13')][this[_0x9a49('0x15')][_0x20a0c2[_0x9a49('0x40')]]['linkedid']];this[_0x9a49('0x8f')](this[_0x9a49('0x15')][_0x20a0c2[_0x9a49('0x40')]]['linkedid']);}else if(this['channels'][this['blindTransfers'][_0x20a0c2['linkedid']][_0x9a49('0x31')]]){this[_0x9a49('0x13')][this[_0x9a49('0x15')][_0x20a0c2[_0x9a49('0x40')]][_0x9a49('0x31')]][_0x9a49('0x31')]=[this[_0x9a49('0x13')][this[_0x9a49('0x15')][_0x20a0c2['linkedid']][_0x9a49('0x31')]]['linkedid'],this['channels'][this['blindTransfers'][_0x20a0c2[_0x9a49('0x40')]]['uniqueid']]['linkedid']=this[_0x9a49('0x13')][this[_0x9a49('0x15')][_0x20a0c2[_0x9a49('0x40')]]['uniqueid']][_0x9a49('0x31')]][0x0];this['channels'][this[_0x9a49('0x15')][_0x20a0c2['linkedid']]['uniqueid']][_0x9a49('0x60')]=this[_0x9a49('0x13')][_0x20a0c2['uniqueid']]['answered'];this[_0x9a49('0x13')][this[_0x9a49('0x15')][_0x20a0c2[_0x9a49('0x40')]][_0x9a49('0x31')]][_0x9a49('0x61')]=this[_0x9a49('0x13')][_0x20a0c2[_0x9a49('0x31')]][_0x9a49('0x61')];this[_0x9a49('0x13')][this['blindTransfers'][_0x20a0c2[_0x9a49('0x40')]][_0x9a49('0x31')]][_0x9a49('0x68')]=this[_0x9a49('0x13')][this[_0x9a49('0x15')][_0x20a0c2[_0x9a49('0x40')]][_0x9a49('0x31')]]['channel'];this['channels'][this[_0x9a49('0x15')][_0x20a0c2['linkedid']][_0x9a49('0x31')]][_0x9a49('0x45')]=this['channels'][_0x20a0c2[_0x9a49('0x31')]][_0x9a49('0x45')];this[_0x9a49('0x13')][_0x20a0c2[_0x9a49('0x31')]]=this[_0x9a49('0x13')][this[_0x9a49('0x15')][_0x20a0c2[_0x9a49('0x40')]]['uniqueid']];this[_0x9a49('0x8f')](this[_0x9a49('0x15')][_0x20a0c2[_0x9a49('0x40')]]['uniqueid']);}}if(this[_0x9a49('0x13')][_0x20a0c2[_0x9a49('0x31')]]){logger[_0x9a49('0x24')](_0x9a49('0x90'),_0x20a0c2[_0x9a49('0x31')],_0x20a0c2[_0x9a49('0x91')]);var _0x573446=moment();this[_0x9a49('0x13')][_0x20a0c2[_0x9a49('0x31')]][_0x9a49('0x92')]=_0x573446[_0x9a49('0x38')](_0x9a49('0x44'));this['channels'][_0x20a0c2['uniqueid']][_0x9a49('0x52')]=_0x573446[_0x9a49('0x63')](this[_0x9a49('0x13')][_0x20a0c2['uniqueid']][_0x9a49('0x43')],'seconds');if(this[_0x9a49('0x13')][_0x20a0c2[_0x9a49('0x31')]]['answered']){this[_0x9a49('0x13')][_0x20a0c2[_0x9a49('0x31')]][_0x9a49('0x93')]=_0x573446[_0x9a49('0x63')](this[_0x9a49('0x13')][_0x20a0c2[_0x9a49('0x31')]][_0x9a49('0x61')],_0x9a49('0x53'));this['channels'][_0x20a0c2[_0x9a49('0x31')]]['holdtime']=this[_0x9a49('0x13')][_0x20a0c2['uniqueid']][_0x9a49('0x52')]-this[_0x9a49('0x13')][_0x20a0c2[_0x9a49('0x31')]][_0x9a49('0x93')];}if(_0x20a0c2['context']===_0x9a49('0x35')){if(this[_0x9a49('0x14')][_0x20a0c2[_0x9a49('0x3f')][_0x9a49('0x48')]('-')[0x0]]){this[_0x9a49('0x14')][_0x20a0c2[_0x9a49('0x3f')]['split']('-')[0x0]]=_[_0x9a49('0x94')](this[_0x9a49('0x14')][_0x20a0c2[_0x9a49('0x3f')]['split']('-')[0x0]],[_0x9a49('0x49')]);logger[_0x9a49('0x2f')](_0x9a49('0x95'),_0x20a0c2[_0x9a49('0x31')],util[_0x9a49('0x32')]({'id':this[_0x9a49('0x14')][_0x20a0c2[_0x9a49('0x3f')][_0x9a49('0x48')]('-')[0x0]]['id'],'destaccountcode':this[_0x9a49('0x14')][_0x20a0c2[_0x9a49('0x3f')][_0x9a49('0x48')]('-')[0x0]][_0x9a49('0x3b')]},{'showHidden':![],'depth':null}));this[_0x9a49('0x2b')](util[_0x9a49('0x38')](_0x9a49('0x39'),this[_0x9a49('0x14')][_0x20a0c2['channel'][_0x9a49('0x48')]('-')[0x0]][_0x9a49('0x3a')]),_0x9a49('0x96'),{'id':this[_0x9a49('0x14')][_0x20a0c2['channel'][_0x9a49('0x48')]('-')[0x0]]['id'],'destaccountcode':this[_0x9a49('0x14')][_0x20a0c2['channel'][_0x9a49('0x48')]('-')[0x0]][_0x9a49('0x3b')]});for(var _0x1fc1ff=0x0;_0x1fc1ff{delete this[_0x9a49('0x13')][_0x275226];},_0x2f6550);}};module['exports']=VoiceCallReport; \ No newline at end of file +var _0x8cb2=['originatecalleridnum','xmd-destination','[%s][voiceCallReport][varset]\x20variable:xmd-destination\x20value:%s','xmd-callerid-preview','[%s][voiceCallReport][varset]\x20variable:xmd-callerid-preview\x20value:%s','calleridpreview','xmcs-queue','[%s][voiceCallReport][varset]\x20variable:xmcs-queue\x20value:%s','mixmonitor_filename','parse','sipcallid','[%s][voiceCallReport][varset]\x20variable:sipcallid\x20value:%s','sipcalllinkedid','[%s][voiceCallReport][varset]','[%s][voiceCallReport][hangup]\x20event:','deleteChannelAfterTimeout','[%s][voiceCallReport][hangup]\x20reason:%s','cause-txt','billableseconds','omit','user:agentcomplete','length','transferType','resolve','then','transferToInternal','isEmpty','getSettings','stopRecordingOnTransfer','Action','catch','StopMixMonitor','finally','webbar:stopmonitors','BlindTransfer','outbound','[%s][voiceCallReport][hangup]\x20sending\x20hangup\x20event:','custom:voiceCallReport','[%s][voiceCallReport][hangup]','origtransferercalleridnum','transfertargetcalleridnum','transfereeuniqueid','transfercalleridnum','secondtransfereruniqueid','ATTENDED','transfertargetuniqueid','transferconnectedlinenum','origtransfereruniqueid','origtransfererlinkedid','some','routeid','[%s][voiceCallReport][attendedtransfer]','[%s][voiceCallReport][blindtransfer]\x20transfercalleridnum:%s\x20transferconnectedlinenum:%s','transfereecalleridnum','extension','[%s][voiceCallReport][blindtransfer]\x20event:','transfereruniqueid','transfererchannel','BLIND','[%s][voiceCallReport][blindtransfer]','[%s][voiceCallReport][musiconholdstart]\x20event:','mohstarttime','[%s][voiceCallReport][musiconholdstart]\x20mohstarttime:%s','[%s][voiceCallReport][musiconholdstop]\x20mohtime:%s','mohtime','[%s][voiceCallReport][musiconholdstop]','exports','lodash','moment','util','path','ioredis','../../../config/environment','../../../config/logger','ami','../ami','../model/channel','../rpc/setting','set','agi','dial','playback','voicemail','FAILED','NO\x20ANSWER','ANSWERED','redis','defaults','socket.io-emitter','channels','agents','blindTransfers','syncNewExten','bind','newexten','newchannel','newstate','syncNewState','varset','syncVarSet','hangup','syncHangup','newcallerid','syncNewCallerId','attendedtransfer','syncAttendedTransfer','syncBlindTransfer','musiconholdstart','syncMusicOnHoldStart','syncMusicOnHoldStop','info','[voiceCallReport][coreshowchannels]\x20started','actionCoreShowChannels','error','[voiceCallReport][coreshowchannels]','inspect','isNotNull','isUndefined','prototype','emit','uniqueid','calleridname','calleridnum','debug','[%s][voiceCallReport][newcallerid]\x20event:','linkedid','pick','context','from-sip','channel','split','exten','xcally-motion-preview','destconnectedlinenum','connectedlinenum','format','user:%s','name','user:agentconnect','accountcode','[%s][voiceCallReport][newcallerid]','[%s][voiceCallReport][newchannel]\x20event:','[%s][voiceCallReport][newchannel]\x20context:%s\x20exten:%s','starttime','YYYY-MM-DD\x20HH:mm:ss','disposition','toNumber','channelstate','keys','undefined','[%s][voiceCallReport][newchannel]\x20sending\x20user:agentconnect\x20event:','[%s][voiceCallReport][newchannel]','OutgoingSpoolFailed','application','applicationdata','appdata','queue','[%s][voiceCallReport][newexten]\x20application:%s\x20appdata:%s','duration','subtract','seconds','includes','lastapplication','startsWith','toLowerCase','cdr(','match','type','isNil','[%s][voiceCallReport][newexten]','[%s][voiceCallReport][newstate]\x20event:','answered','diff','connectedlinename','destinationchannel','UserId','membername','answertime','holdtime','[%s][voiceCallReport][newstate]','[%s][voiceCallReport][mixMonitorFilename]\x20monitorFilename:%s','monitor','endsWith','.wav49','replace','.WAV','find','monitors','push','rec','[%s][voiceCallReport][mixMonitorFilename]','variable','[%s][voiceCallReport][varset]\x20variable:mixmonitor_filename\x20value:%s','value','syncMixMonitorFilename','[%s][voiceCallReport][varset]\x20variable:xmd-phone\x20value:%s','xmd-callerid','[%s][voiceCallReport][varset]\x20variable:xmd-callerid\x20value:%s','xmd-cdrtype','xmd-queue','[%s][voiceCallReport][varset]\x20variable:xmd-queue\x20value:%s','xmd-originatecalleridnum','[%s][voiceCallReport][varset]\x20variable:xmd-originatecalleridnum\x20value:%s'];(function(_0x597484,_0x199340){var _0x218e64=function(_0x390d55){while(--_0x390d55){_0x597484['push'](_0x597484['shift']());}};_0x218e64(++_0x199340);}(_0x8cb2,0x1d9));var _0x28cb=function(_0x3ab51d,_0x2fa01d){_0x3ab51d=_0x3ab51d-0x0;var _0x29a04e=_0x8cb2[_0x3ab51d];return _0x29a04e;};'use strict';var _=require(_0x28cb('0x0'));var moment=require(_0x28cb('0x1'));var util=require(_0x28cb('0x2'));var path=require(_0x28cb('0x3'));var Redis=require(_0x28cb('0x4'));var config=require(_0x28cb('0x5'));var logger=require(_0x28cb('0x6'))(_0x28cb('0x7'));var ami=require(_0x28cb('0x8'));var Channel=require(_0x28cb('0x9'));var RpcSetting=require(_0x28cb('0xa'));var applications=[_0x28cb('0xb'),'queue',_0x28cb('0xc'),_0x28cb('0xd'),_0x28cb('0xe'),_0x28cb('0xf')];var dispositions=['NO\x20ANSWER',_0x28cb('0x10'),_0x28cb('0x10'),_0x28cb('0x11'),_0x28cb('0x11'),_0x28cb('0x11'),_0x28cb('0x12'),'BUSY',_0x28cb('0x10'),_0x28cb('0x10'),'FAILED'];config[_0x28cb('0x13')]=_[_0x28cb('0x14')](config[_0x28cb('0x13')],{'host':'localhost','port':0x18eb});var io=require(_0x28cb('0x15'))(new Redis(config[_0x28cb('0x13')]));function VoiceCallReport(_0x391a57){this[_0x28cb('0x16')]=_0x391a57[_0x28cb('0x16')];this['agents']=_0x391a57[_0x28cb('0x17')];this[_0x28cb('0x18')]={};ami['on']('coreshowchannel',this[_0x28cb('0x19')][_0x28cb('0x1a')](this));ami['on'](_0x28cb('0x1b'),this[_0x28cb('0x19')]['bind'](this));ami['on'](_0x28cb('0x1c'),this['syncNewChannel'][_0x28cb('0x1a')](this));ami['on'](_0x28cb('0x1d'),this[_0x28cb('0x1e')][_0x28cb('0x1a')](this));ami['on'](_0x28cb('0x1f'),this[_0x28cb('0x20')][_0x28cb('0x1a')](this));ami['on'](_0x28cb('0x21'),this[_0x28cb('0x22')][_0x28cb('0x1a')](this));ami['on'](_0x28cb('0x23'),this[_0x28cb('0x24')][_0x28cb('0x1a')](this));ami['on'](_0x28cb('0x25'),this[_0x28cb('0x26')][_0x28cb('0x1a')](this));ami['on']('blindtransfer',this[_0x28cb('0x27')]['bind'](this));ami['on'](_0x28cb('0x28'),this[_0x28cb('0x29')][_0x28cb('0x1a')](this));ami['on']('musiconholdstop',this[_0x28cb('0x2a')][_0x28cb('0x1a')](this));try{logger[_0x28cb('0x2b')](_0x28cb('0x2c'));ami[_0x28cb('0x2d')]();}catch(_0x594f75){logger[_0x28cb('0x2e')](_0x28cb('0x2f'),util[_0x28cb('0x30')](_0x594f75,{'showHidden':![],'depth':null}));}}VoiceCallReport['prototype'][_0x28cb('0x31')]=function(_0x17c9d1){return _0x17c9d1!==null&&!_[_0x28cb('0x32')](_0x17c9d1);};VoiceCallReport[_0x28cb('0x33')][_0x28cb('0x34')]=function(_0x2ce727,_0x27f34d,_0x1fca18){io['to'](_0x2ce727)['emit'](_0x27f34d,_0x1fca18);};VoiceCallReport[_0x28cb('0x33')][_0x28cb('0x24')]=function(_0x38a4ed){try{if(this[_0x28cb('0x31')](_0x38a4ed)){logger['info']('[%s][voiceCallReport][newcallerid]\x20calleridname:%s\x20calleridnum:%s',_0x38a4ed[_0x28cb('0x35')],_0x38a4ed[_0x28cb('0x36')],_0x38a4ed[_0x28cb('0x37')]);logger[_0x28cb('0x38')](_0x28cb('0x39'),_0x38a4ed['uniqueid'],util[_0x28cb('0x30')](_0x38a4ed,{'showHidden':![],'depth':null}));if(_0x38a4ed[_0x28cb('0x35')]===_0x38a4ed[_0x28cb('0x3a')]){if(!_[_0x28cb('0x32')](this[_0x28cb('0x16')][_0x38a4ed[_0x28cb('0x35')]])){_['merge'](this[_0x28cb('0x16')][_0x38a4ed[_0x28cb('0x35')]],_[_0x28cb('0x3b')](_0x38a4ed,_['keys'](this[_0x28cb('0x16')][_0x38a4ed['uniqueid']])));}}if(_0x38a4ed[_0x28cb('0x3c')]===_0x28cb('0x3d')){var _0xea7ee4=this['agents'][_0x38a4ed[_0x28cb('0x3e')][_0x28cb('0x3f')]('-')[0x0]];if(_0xea7ee4){if(_0x38a4ed[_0x28cb('0x40')]==_0x28cb('0x41')){_0xea7ee4[_0x28cb('0x42')]=_0x38a4ed[_0x28cb('0x43')];this[_0x28cb('0x34')](util[_0x28cb('0x44')](_0x28cb('0x45'),_0xea7ee4[_0x28cb('0x46')]),_0x28cb('0x47'),{'id':_0xea7ee4['id'],'destaccountcode':_0xea7ee4[_0x28cb('0x48')],'destconnectedlinenum':_0x38a4ed[_0x28cb('0x43')]});}}}}}catch(_0x4ba08f){logger[_0x28cb('0x2e')](_0x28cb('0x49'),_0x38a4ed[_0x28cb('0x35')],util[_0x28cb('0x30')](_0x4ba08f,{'showHidden':![],'depth':null}));}};VoiceCallReport[_0x28cb('0x33')]['syncNewChannel']=function(_0x2460f5){try{if(this[_0x28cb('0x31')](_0x2460f5)){logger[_0x28cb('0x38')](_0x28cb('0x4a'),_0x2460f5['uniqueid'],util[_0x28cb('0x30')](_0x2460f5,{'showHidden':![],'depth':null}));if(this[_0x28cb('0x16')][_0x2460f5[_0x28cb('0x35')]]){return;}if(_0x2460f5['channel']==='OutgoingSpoolFailed'){return;}if(_0x2460f5[_0x28cb('0x35')]!==_0x2460f5[_0x28cb('0x3a')]&&!this[_0x28cb('0x18')][_0x2460f5['linkedid']]){return;}logger['info'](_0x28cb('0x4b'),_0x2460f5[_0x28cb('0x35')],_0x2460f5['context'],_0x2460f5['exten']);this[_0x28cb('0x16')][_0x2460f5['uniqueid']]=new Channel();this[_0x28cb('0x16')][_0x2460f5[_0x28cb('0x35')]][_0x28cb('0x4c')]=moment()[_0x28cb('0x44')](_0x28cb('0x4d'));this[_0x28cb('0x16')][_0x2460f5[_0x28cb('0x35')]][_0x28cb('0x4e')]=dispositions[_[_0x28cb('0x4f')](_0x2460f5[_0x28cb('0x50')])];_['merge'](this['channels'][_0x2460f5['uniqueid']],_[_0x28cb('0x3b')](_0x2460f5,_[_0x28cb('0x51')](this['channels'][_0x2460f5[_0x28cb('0x35')]])));if(_0x2460f5[_0x28cb('0x3c')]===_0x28cb('0x3d')){var _0x577d19=this['agents'][_0x2460f5['channel']['split']('-')[0x0]];if(_0x577d19&&typeof _0x577d19[_0x28cb('0x42')]===_0x28cb('0x52')){_0x577d19[_0x28cb('0x42')]=_0x2460f5['exten'];logger[_0x28cb('0x38')](_0x28cb('0x53'),_0x2460f5[_0x28cb('0x35')],util[_0x28cb('0x30')]({'id':_0x577d19['id'],'destaccountcode':_0x577d19['accountcode'],'destconnectedlinenum':_0x2460f5[_0x28cb('0x40')]},{'showHidden':![],'depth':null}));this[_0x28cb('0x34')](util[_0x28cb('0x44')]('user:%s',_0x577d19[_0x28cb('0x46')]),_0x28cb('0x47'),{'id':_0x577d19['id'],'destaccountcode':_0x577d19[_0x28cb('0x48')],'destconnectedlinenum':_0x2460f5[_0x28cb('0x40')]});}}}}catch(_0x23e880){logger[_0x28cb('0x2e')](_0x28cb('0x54'),_0x2460f5['uniqueid'],util[_0x28cb('0x30')](_0x23e880,{'showHidden':![],'depth':null}));}};VoiceCallReport['prototype'][_0x28cb('0x19')]=function(_0x493e77){try{if(this[_0x28cb('0x31')](_0x493e77)){logger[_0x28cb('0x38')]('[%s][voiceCallReport][newexten]\x20event:',_0x493e77['uniqueid'],util[_0x28cb('0x30')](_0x493e77,{'showHidden':![],'depth':null}));if(_0x493e77['channel']===_0x28cb('0x55')||_0x493e77[_0x28cb('0x40')]==='h')return;if(_0x493e77[_0x28cb('0x35')]===_0x493e77['linkedid']||this[_0x28cb('0x18')][_0x493e77[_0x28cb('0x3a')]]){_0x493e77[_0x28cb('0x56')]=_0x493e77['application']?_0x493e77[_0x28cb('0x56')]['toLowerCase']():undefined;_0x493e77[_0x28cb('0x57')]=_0x493e77['appdata']||_0x493e77[_0x28cb('0x57')];if(_0x493e77[_0x28cb('0x58')]&&_0x493e77[_0x28cb('0x56')]!==_0x28cb('0x59')){_0x493e77[_0x28cb('0x57')]=_0x493e77[_0x28cb('0x57')]['toLowerCase']();}logger['info'](_0x28cb('0x5a'),_0x493e77[_0x28cb('0x35')],_0x493e77[_0x28cb('0x56')],_0x493e77['applicationdata']);if(_[_0x28cb('0x32')](this['channels'][_0x493e77['uniqueid']])){this['channels'][_0x493e77['uniqueid']]=new Channel();this[_0x28cb('0x16')][_0x493e77['uniqueid']]['starttime']=_0x493e77[_0x28cb('0x5b')]?moment()[_0x28cb('0x5c')](moment[_0x28cb('0x5b')](_0x493e77[_0x28cb('0x5b')])[_0x28cb('0x5d')](),_0x28cb('0x5d'))[_0x28cb('0x44')](_0x28cb('0x4d')):moment()['format'](_0x28cb('0x4d'));this[_0x28cb('0x16')][_0x493e77[_0x28cb('0x35')]]['disposition']=_0x28cb('0x11');}_['merge'](this[_0x28cb('0x16')][_0x493e77[_0x28cb('0x35')]],_['pick'](_0x493e77,_[_0x28cb('0x51')](this[_0x28cb('0x16')][_0x493e77[_0x28cb('0x35')]])));if(_[_0x28cb('0x5e')](applications,_0x493e77[_0x28cb('0x56')])){this[_0x28cb('0x16')][_0x493e77[_0x28cb('0x35')]][_0x28cb('0x5f')]=_0x493e77[_0x28cb('0x56')];this[_0x28cb('0x16')][_0x493e77[_0x28cb('0x35')]]['lastdata']=_0x493e77[_0x28cb('0x57')];if(_0x493e77[_0x28cb('0x56')]===_0x28cb('0xb')&&_[_0x28cb('0x60')](_0x493e77[_0x28cb('0x57')][_0x28cb('0x61')](),_0x28cb('0x62'))){var _0x4c95da=_0x493e77[_0x28cb('0x57')]['split']('=');var _0xd36d9b=_0x4c95da[0x0][_0x28cb('0x61')]()[_0x28cb('0x63')](/cdr\((.*)\)/);if(_0xd36d9b){if(_0xd36d9b[0x1]===_0x28cb('0x64')&&!_[_0x28cb('0x65')](this[_0x28cb('0x16')][_0x493e77['uniqueid']][_0xd36d9b[0x1]]))return;this[_0x28cb('0x16')][_0x493e77['uniqueid']][_0xd36d9b[0x1]]=_0x4c95da[0x1];}}else if(_0x493e77[_0x28cb('0x56')]===_0x28cb('0x59')){this[_0x28cb('0x16')][_0x493e77[_0x28cb('0x35')]][_0x28cb('0x59')]=_0x493e77[_0x28cb('0x57')]['split'](',')[0x0];}}}}}catch(_0x202bf2){logger[_0x28cb('0x2e')](_0x28cb('0x66'),_0x493e77['uniqueid'],util[_0x28cb('0x30')](_0x202bf2,{'showHidden':![],'depth':null}));}};VoiceCallReport[_0x28cb('0x33')]['syncNewState']=function(_0x23a13d){try{if(this['isNotNull'](_0x23a13d)){logger[_0x28cb('0x2b')]('[%s][voiceCallReport][newstate]\x20linkedid:%s\x20calleridname:%s\x20calleridnum:%s',_0x23a13d['uniqueid'],_0x23a13d['linkedid'],_0x23a13d[_0x28cb('0x36')],_0x23a13d['calleridnum']);logger[_0x28cb('0x38')](_0x28cb('0x67'),_0x23a13d[_0x28cb('0x35')],util[_0x28cb('0x30')](_0x23a13d,{'showHidden':![],'depth':null}));if(_0x23a13d[_0x28cb('0x50')]!=='6')return;var _0x4c47f4=this[_0x28cb('0x17')][_0x23a13d['channel']['split']('-')[0x0]];if(_0x23a13d[_0x28cb('0x35')]!==_0x23a13d[_0x28cb('0x3a')]){var _0x1971a8=moment();if(this[_0x28cb('0x16')][_0x23a13d['linkedid']]){if(!this[_0x28cb('0x16')][_0x23a13d['linkedid']][_0x28cb('0x68')]){this[_0x28cb('0x16')][_0x23a13d['linkedid']][_0x28cb('0x68')]=!![];this[_0x28cb('0x16')][_0x23a13d['linkedid']]['answertime']=_0x1971a8[_0x28cb('0x44')](_0x28cb('0x4d'));if(this[_0x28cb('0x16')][_0x23a13d['linkedid']][_0x28cb('0x4c')]){this[_0x28cb('0x16')][_0x23a13d['linkedid']]['holdtime']=_0x1971a8[_0x28cb('0x69')](this[_0x28cb('0x16')][_0x23a13d[_0x28cb('0x3a')]]['starttime'],'seconds');}}this[_0x28cb('0x16')][_0x23a13d['linkedid']][_0x28cb('0x3a')]=_0x23a13d[_0x28cb('0x35')];if(_0x23a13d['calleridnum']!==_0x28cb('0x41')){this['channels'][_0x23a13d[_0x28cb('0x3a')]][_0x28cb('0x43')]=_0x23a13d[_0x28cb('0x37')];}this[_0x28cb('0x16')][_0x23a13d['linkedid']][_0x28cb('0x6a')]=_0x23a13d[_0x28cb('0x36')];this[_0x28cb('0x16')][_0x23a13d[_0x28cb('0x3a')]][_0x28cb('0x6b')]=_0x23a13d[_0x28cb('0x3e')];this[_0x28cb('0x16')][_0x23a13d[_0x28cb('0x3a')]][_0x28cb('0x4e')]=dispositions[_['toNumber'](_0x23a13d[_0x28cb('0x50')])];if(_0x4c47f4){this[_0x28cb('0x16')][_0x23a13d[_0x28cb('0x3a')]][_0x28cb('0x6c')]=_0x4c47f4['id'];this[_0x28cb('0x16')][_0x23a13d[_0x28cb('0x3a')]][_0x28cb('0x6d')]=_0x4c47f4['name'];}}if(this['channels'][_0x23a13d[_0x28cb('0x35')]]){if(!this[_0x28cb('0x16')][_0x23a13d[_0x28cb('0x35')]][_0x28cb('0x68')]){this['channels'][_0x23a13d['uniqueid']][_0x28cb('0x68')]=!![];this[_0x28cb('0x16')][_0x23a13d[_0x28cb('0x35')]][_0x28cb('0x6e')]=_0x1971a8[_0x28cb('0x44')](_0x28cb('0x4d'));if(this[_0x28cb('0x16')][_0x23a13d[_0x28cb('0x35')]]['starttime']){this[_0x28cb('0x16')][_0x23a13d['uniqueid']][_0x28cb('0x6f')]=_0x1971a8['diff'](this['channels'][_0x23a13d[_0x28cb('0x35')]]['starttime'],'seconds');}}if(_0x23a13d[_0x28cb('0x37')]!=='xcally-motion-preview'){this[_0x28cb('0x16')][_0x23a13d[_0x28cb('0x35')]][_0x28cb('0x43')]=_0x23a13d[_0x28cb('0x37')];}this[_0x28cb('0x16')][_0x23a13d['uniqueid']]['connectedlinename']=_0x23a13d[_0x28cb('0x36')];this[_0x28cb('0x16')][_0x23a13d['uniqueid']]['destinationchannel']=_0x23a13d[_0x28cb('0x3e')];this[_0x28cb('0x16')][_0x23a13d['uniqueid']]['disposition']=dispositions[_['toNumber'](_0x23a13d[_0x28cb('0x50')])];}}else{if(this[_0x28cb('0x16')][_0x23a13d[_0x28cb('0x35')]]){if(_0x4c47f4){this[_0x28cb('0x16')][_0x23a13d[_0x28cb('0x35')]][_0x28cb('0x6c')]=_0x4c47f4['id'];this[_0x28cb('0x16')][_0x23a13d[_0x28cb('0x35')]][_0x28cb('0x6d')]=_0x4c47f4[_0x28cb('0x46')];}}}if(_0x23a13d[_0x28cb('0x3c')]===_0x28cb('0x3d')){if(_0x4c47f4){_0x4c47f4[_0x28cb('0x42')]=_0x23a13d['exten'];var _0x373fea;if(this['channels'][_0x23a13d[_0x28cb('0x35')]]){_0x373fea=this[_0x28cb('0x16')][_0x23a13d['uniqueid']][_0x28cb('0x59')];}else if(this[_0x28cb('0x16')][_0x23a13d[_0x28cb('0x3a')]]){_0x373fea=this[_0x28cb('0x16')][_0x23a13d[_0x28cb('0x3a')]][_0x28cb('0x59')];}_0x4c47f4[_0x28cb('0x59')]=_0x373fea;var _0x12baf1={'id':_0x4c47f4['id'],'name':_0x4c47f4[_0x28cb('0x46')],'agentconnected':!![],'destaccountcode':_0x4c47f4[_0x28cb('0x48')],'destconnectedlinenum':_0x23a13d[_0x28cb('0x40')],'queue':_0x373fea||undefined,'uniqueid':_0x23a13d[_0x28cb('0x3a')]};logger[_0x28cb('0x38')]('[%s][voiceCallReport][newstate]\x20sending\x20user:agentconnect\x20event:',_0x23a13d['uniqueid'],util[_0x28cb('0x30')](_0x12baf1,{'showHidden':![],'depth':null}));this[_0x28cb('0x34')](util[_0x28cb('0x44')](_0x28cb('0x45'),_0x4c47f4[_0x28cb('0x46')]),'user:agentconnect',_0x12baf1);}}}}catch(_0x35c969){logger[_0x28cb('0x2e')](_0x28cb('0x70'),_0x23a13d[_0x28cb('0x35')],util['inspect'](_0x35c969,{'showHidden':![],'depth':null}));}};VoiceCallReport[_0x28cb('0x33')]['syncMixMonitorFilename']=function(_0x3a0361,_0x258dbc){try{if(this[_0x28cb('0x16')][_0x3a0361]){logger['info'](_0x28cb('0x71'),_0x3a0361,_0x258dbc);this[_0x28cb('0x16')][_0x3a0361][_0x28cb('0x72')]=!![];if(_[_0x28cb('0x73')](_0x258dbc,_0x28cb('0x74'))){_0x258dbc=_0x258dbc[_0x28cb('0x75')]('.wav49',_0x28cb('0x76'));}this[_0x28cb('0x16')][_0x3a0361]['monitorFilename']=_0x258dbc;var _0x41d506=_[_0x28cb('0x77')](this[_0x28cb('0x16')][_0x3a0361][_0x28cb('0x78')],{'filename':_0x258dbc});if(_['isNil'](_0x41d506)){this[_0x28cb('0x16')][_0x3a0361][_0x28cb('0x78')][_0x28cb('0x79')]({'filename':_0x258dbc,'createdAt':moment()['format'](_0x28cb('0x4d')),'mixmonitorid':'','status':_0x28cb('0x7a')});}}}catch(_0x49142f){logger['error'](_0x28cb('0x7b'),_0x3a0361,util[_0x28cb('0x30')](_0x49142f,{'showHidden':![],'depth':null}));}};VoiceCallReport[_0x28cb('0x33')]['syncVarSet']=function(_0x4b5966){try{if(this[_0x28cb('0x31')](_0x4b5966)){logger[_0x28cb('0x38')]('[%s][voiceCallReport][varset]\x20event:',_0x4b5966[_0x28cb('0x35')],util[_0x28cb('0x30')](_0x4b5966,{'showHidden':![],'depth':null}));if(this[_0x28cb('0x16')][_0x4b5966[_0x28cb('0x35')]]&&_0x4b5966['channel']!='OutgoingSpoolFailed'){if(this[_0x28cb('0x31')](_0x4b5966['variable'])){if(this['isNotNull'](_0x4b5966[_0x28cb('0x7c')]['mixmonitor_filename'])){logger[_0x28cb('0x2b')](_0x28cb('0x7d'),_0x4b5966[_0x28cb('0x35')],_0x4b5966[_0x28cb('0x7e')]);this[_0x28cb('0x7f')](_0x4b5966[_0x28cb('0x35')],_0x4b5966['value']);}else if(this[_0x28cb('0x31')](_0x4b5966[_0x28cb('0x7c')]['xmd-phone'])){logger['info'](_0x28cb('0x80'),_0x4b5966[_0x28cb('0x35')],_0x4b5966[_0x28cb('0x7e')]);this[_0x28cb('0x16')][_0x4b5966[_0x28cb('0x35')]][_0x28cb('0x37')]=_0x4b5966['value'];}else if(this[_0x28cb('0x31')](_0x4b5966[_0x28cb('0x7c')][_0x28cb('0x81')])){logger[_0x28cb('0x2b')](_0x28cb('0x82'),_0x4b5966[_0x28cb('0x35')],_0x4b5966[_0x28cb('0x7e')]);this['channels'][_0x4b5966[_0x28cb('0x35')]]['callerid']=_0x4b5966['value'];}else if(this[_0x28cb('0x31')](_0x4b5966[_0x28cb('0x7c')][_0x28cb('0x83')])){logger['info']('[%s][voiceCallReport][varset]\x20variable:xmd-cdrtype\x20value:%s',_0x4b5966[_0x28cb('0x35')],_0x4b5966[_0x28cb('0x7e')]);this[_0x28cb('0x16')][_0x4b5966[_0x28cb('0x35')]][_0x28cb('0x64')]=_0x4b5966[_0x28cb('0x7e')];}else if(this[_0x28cb('0x31')](_0x4b5966[_0x28cb('0x7c')][_0x28cb('0x84')])){logger[_0x28cb('0x2b')](_0x28cb('0x85'),_0x4b5966[_0x28cb('0x35')],_0x4b5966[_0x28cb('0x7e')]['split'](',')[0x0]);this['channels'][_0x4b5966[_0x28cb('0x35')]]['queue']=_0x4b5966[_0x28cb('0x7e')]['split'](',')[0x0];}else if(this[_0x28cb('0x31')](_0x4b5966[_0x28cb('0x7c')][_0x28cb('0x86')])){logger['info'](_0x28cb('0x87'),_0x4b5966[_0x28cb('0x35')],_0x4b5966['value']);this[_0x28cb('0x16')][_0x4b5966[_0x28cb('0x35')]][_0x28cb('0x88')]=_0x4b5966[_0x28cb('0x7e')];}else if(this[_0x28cb('0x31')](_0x4b5966['variable'][_0x28cb('0x89')])){logger[_0x28cb('0x2b')](_0x28cb('0x8a'),_0x4b5966['uniqueid'],_0x4b5966[_0x28cb('0x7e')]);this[_0x28cb('0x16')][_0x4b5966['uniqueid']]['destination']=_0x4b5966[_0x28cb('0x7e')];}else if(this[_0x28cb('0x31')](_0x4b5966[_0x28cb('0x7c')][_0x28cb('0x8b')])){logger[_0x28cb('0x2b')](_0x28cb('0x8c'),_0x4b5966[_0x28cb('0x35')],_0x4b5966[_0x28cb('0x7e')]);this['channels'][_0x4b5966[_0x28cb('0x35')]][_0x28cb('0x8d')]=_0x4b5966[_0x28cb('0x7e')];}else if(this[_0x28cb('0x31')](_0x4b5966['variable'][_0x28cb('0x8e')])){logger[_0x28cb('0x2b')](_0x28cb('0x8f'),_0x4b5966[_0x28cb('0x35')],_0x4b5966['value']);this[_0x28cb('0x16')][_0x4b5966['uniqueid']]['queue']=_0x4b5966[_0x28cb('0x7e')];}else if(this[_0x28cb('0x31')](_0x4b5966[_0x28cb('0x7c')]['sipcallid'])){logger[_0x28cb('0x2b')]('[%s][voiceCallReport][varset]\x20variable:sipcallid\x20value:%s',_0x4b5966[_0x28cb('0x35')],_0x4b5966[_0x28cb('0x7e')]);this[_0x28cb('0x16')][_0x4b5966[_0x28cb('0x35')]]['sipcalluniqueid']=_0x4b5966[_0x28cb('0x7e')];}}}else if(this[_0x28cb('0x31')](_0x4b5966[_0x28cb('0x7c')][_0x28cb('0x90')])){if(_0x4b5966[_0x28cb('0x7e')]){var _0x428c14=path[_0x28cb('0x91')](_0x4b5966['value'])[_0x28cb('0x46')];logger[_0x28cb('0x2b')](_0x28cb('0x7d'),_0x428c14,_0x4b5966[_0x28cb('0x7e')]);this[_0x28cb('0x7f')](_0x428c14,_0x4b5966[_0x28cb('0x7e')]);}}else if(this[_0x28cb('0x16')][_0x4b5966[_0x28cb('0x3a')]]){if(this[_0x28cb('0x31')](_0x4b5966['variable'])){if(this[_0x28cb('0x31')](_0x4b5966[_0x28cb('0x7c')][_0x28cb('0x92')])){logger['info'](_0x28cb('0x93'),_0x4b5966[_0x28cb('0x3a')],_0x4b5966[_0x28cb('0x7e')]);this[_0x28cb('0x16')][_0x4b5966[_0x28cb('0x3a')]][_0x28cb('0x94')]=_0x4b5966['value'];}}}}}catch(_0x40cb08){logger['error'](_0x28cb('0x95'),_0x4b5966[_0x28cb('0x35')],util[_0x28cb('0x30')](_0x40cb08,{'showHidden':![],'depth':null}));}};VoiceCallReport[_0x28cb('0x33')][_0x28cb('0x22')]=function(_0xba1476){try{if(this['isNotNull'](_0xba1476)){logger[_0x28cb('0x38')](_0x28cb('0x96'),_0xba1476[_0x28cb('0x35')],util[_0x28cb('0x30')](_0xba1476,{'showHidden':![],'depth':null}));if(this[_0x28cb('0x18')][_0xba1476[_0x28cb('0x3a')]]){if(this[_0x28cb('0x16')][this[_0x28cb('0x18')][_0xba1476[_0x28cb('0x3a')]][_0x28cb('0x3a')]]){this[_0x28cb('0x16')][this[_0x28cb('0x18')][_0xba1476['linkedid']][_0x28cb('0x3a')]][_0x28cb('0x35')]=_0xba1476['uniqueid'];this[_0x28cb('0x16')][this['blindTransfers'][_0xba1476[_0x28cb('0x3a')]][_0x28cb('0x3a')]]['answered']=this[_0x28cb('0x16')][_0xba1476['uniqueid']][_0x28cb('0x68')];this[_0x28cb('0x16')][this[_0x28cb('0x18')][_0xba1476[_0x28cb('0x3a')]][_0x28cb('0x3a')]]['answertime']=this['channels'][_0xba1476['uniqueid']]['answertime'];this[_0x28cb('0x16')][this[_0x28cb('0x18')][_0xba1476[_0x28cb('0x3a')]]['linkedid']]['destinationchannel']=this[_0x28cb('0x16')][this[_0x28cb('0x18')][_0xba1476['linkedid']]['linkedid']][_0x28cb('0x3e')];this[_0x28cb('0x16')][this[_0x28cb('0x18')][_0xba1476[_0x28cb('0x3a')]][_0x28cb('0x3a')]][_0x28cb('0x4e')]=this[_0x28cb('0x16')][_0xba1476[_0x28cb('0x35')]][_0x28cb('0x4e')];this[_0x28cb('0x16')][_0xba1476[_0x28cb('0x35')]]=this[_0x28cb('0x16')][this[_0x28cb('0x18')][_0xba1476['linkedid']][_0x28cb('0x3a')]];this['deleteChannelAfterTimeout'](this['blindTransfers'][_0xba1476[_0x28cb('0x3a')]][_0x28cb('0x3a')]);}else if(this[_0x28cb('0x16')][this['blindTransfers'][_0xba1476[_0x28cb('0x3a')]][_0x28cb('0x35')]]){this[_0x28cb('0x16')][this[_0x28cb('0x18')][_0xba1476['linkedid']]['uniqueid']]['uniqueid']=[this['channels'][this[_0x28cb('0x18')][_0xba1476[_0x28cb('0x3a')]][_0x28cb('0x35')]][_0x28cb('0x3a')],this['channels'][this[_0x28cb('0x18')][_0xba1476[_0x28cb('0x3a')]][_0x28cb('0x35')]]['linkedid']=this[_0x28cb('0x16')][this[_0x28cb('0x18')][_0xba1476[_0x28cb('0x3a')]][_0x28cb('0x35')]][_0x28cb('0x35')]][0x0];this[_0x28cb('0x16')][this[_0x28cb('0x18')][_0xba1476[_0x28cb('0x3a')]][_0x28cb('0x35')]][_0x28cb('0x68')]=this['channels'][_0xba1476[_0x28cb('0x35')]][_0x28cb('0x68')];this[_0x28cb('0x16')][this['blindTransfers'][_0xba1476[_0x28cb('0x3a')]]['uniqueid']][_0x28cb('0x6e')]=this[_0x28cb('0x16')][_0xba1476[_0x28cb('0x35')]]['answertime'];this[_0x28cb('0x16')][this[_0x28cb('0x18')][_0xba1476[_0x28cb('0x3a')]][_0x28cb('0x35')]][_0x28cb('0x6b')]=this[_0x28cb('0x16')][this[_0x28cb('0x18')][_0xba1476[_0x28cb('0x3a')]][_0x28cb('0x35')]][_0x28cb('0x3e')];this[_0x28cb('0x16')][this[_0x28cb('0x18')][_0xba1476[_0x28cb('0x3a')]]['uniqueid']]['disposition']=this['channels'][_0xba1476[_0x28cb('0x35')]]['disposition'];this[_0x28cb('0x16')][_0xba1476[_0x28cb('0x35')]]=this[_0x28cb('0x16')][this[_0x28cb('0x18')][_0xba1476['linkedid']][_0x28cb('0x35')]];this[_0x28cb('0x97')](this[_0x28cb('0x18')][_0xba1476[_0x28cb('0x3a')]]['uniqueid']);}}if(this[_0x28cb('0x16')][_0xba1476['uniqueid']]){logger[_0x28cb('0x2b')](_0x28cb('0x98'),_0xba1476[_0x28cb('0x35')],_0xba1476[_0x28cb('0x99')]);var _0x4f242a=moment();this[_0x28cb('0x16')][_0xba1476[_0x28cb('0x35')]]['endtime']=_0x4f242a[_0x28cb('0x44')](_0x28cb('0x4d'));this[_0x28cb('0x16')][_0xba1476[_0x28cb('0x35')]][_0x28cb('0x5b')]=_0x4f242a[_0x28cb('0x69')](this[_0x28cb('0x16')][_0xba1476['uniqueid']]['starttime'],_0x28cb('0x5d'));if(this[_0x28cb('0x16')][_0xba1476[_0x28cb('0x35')]][_0x28cb('0x68')]){this[_0x28cb('0x16')][_0xba1476[_0x28cb('0x35')]]['billableseconds']=_0x4f242a[_0x28cb('0x69')](this[_0x28cb('0x16')][_0xba1476[_0x28cb('0x35')]][_0x28cb('0x6e')],_0x28cb('0x5d'));this['channels'][_0xba1476[_0x28cb('0x35')]]['holdtime']=this[_0x28cb('0x16')][_0xba1476[_0x28cb('0x35')]]['duration']-this[_0x28cb('0x16')][_0xba1476['uniqueid']][_0x28cb('0x9a')];}if(_0xba1476[_0x28cb('0x3c')]===_0x28cb('0x3d')){if(this['agents'][_0xba1476[_0x28cb('0x3e')][_0x28cb('0x3f')]('-')[0x0]]){this[_0x28cb('0x17')][_0xba1476[_0x28cb('0x3e')][_0x28cb('0x3f')]('-')[0x0]]=_[_0x28cb('0x9b')](this[_0x28cb('0x17')][_0xba1476['channel'][_0x28cb('0x3f')]('-')[0x0]],[_0x28cb('0x42')]);logger[_0x28cb('0x38')]('[%s][voiceCallReport][hangup]\x20sending\x20user:agentcomplete\x20event:',_0xba1476[_0x28cb('0x35')],util['inspect']({'id':this['agents'][_0xba1476[_0x28cb('0x3e')][_0x28cb('0x3f')]('-')[0x0]]['id'],'destaccountcode':this[_0x28cb('0x17')][_0xba1476['channel']['split']('-')[0x0]][_0x28cb('0x48')]},{'showHidden':![],'depth':null}));this[_0x28cb('0x34')](util[_0x28cb('0x44')](_0x28cb('0x45'),this[_0x28cb('0x17')][_0xba1476[_0x28cb('0x3e')][_0x28cb('0x3f')]('-')[0x0]][_0x28cb('0x46')]),_0x28cb('0x9c'),{'id':this[_0x28cb('0x17')][_0xba1476[_0x28cb('0x3e')]['split']('-')[0x0]]['id'],'destaccountcode':this['agents'][_0xba1476['channel'][_0x28cb('0x3f')]('-')[0x0]][_0x28cb('0x48')]});for(var _0x45f587=0x0;_0x45f587{delete this[_0x28cb('0x16')][_0x5d394f];},_0x42804c);}};module[_0x28cb('0xca')]=VoiceCallReport; \ No newline at end of file diff --git a/server/services/ami/report/voiceDialReport.js b/server/services/ami/report/voiceDialReport.js index 994bea7..405b440 100644 --- a/server/services/ami/report/voiceDialReport.js +++ b/server/services/ami/report/voiceDialReport.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0xe28f=['complete','total','holdtime','billableseconds','sumHoldTime','sumBillable','sumDuration','[%s][voiceDialReport][hangup]\x20sending\x20voiceDialReport\x20event:','custom:voiceDialReport','custom:dialend','voice_outbound:save','[DEBUG]\x20Emit\x20voice_outbound_channel:remove\x20event','stringify','[%s][voiceDialReport][hangup]\x20sending\x20voice_outbound_channel:remove\x20event:','voice_outbound_channel:remove','deleteChannelAfterTimeout','linkedid','destuniqueid','[%s][voiceDialReport][hangup]','syncNewExten','application','toLowerCase','set','applicationdata','appdata','startsWith','[%s][voiceDialReport][newexten]\x20application:%s\x20appdata:%s','split','match','lodash','moment','../../../config/environment','../../../config/logger','ami','../ami','redis','defaults','localhost','socket.io-emitter','outbound','applications','variables','dialbegin','syncDialBegin','bind','syncDialEnd','hangup','syncHangup','isNotNull','isUndefined','prototype','emit','[%s][voiceDialReport][dialbegin]\x20event:','inspect','channels','uniqueid','merge','format','YYYY-MM-DD\x20HH:mm:ss','channel','substring','lastIndexOf','event','info','[%s][voiceDialReport][dialbegin]\x20agent:%s\x20interface:%s\x20lastevent:called','membername','interface','debug','[%s][voiceDialReport][dialbegin]\x20sending\x20voice_outbound_channel:save\x20event:','voice_outbound_channel:save','[%s][voiceDialReport][dialbegin]','[%s][voiceDialReport][dialend]\x20event:','dialstatus','ANSWER','connectedlinenum','connectedlinename','answertime','lastevent','[%s][voiceDialReport][dialend]\x20sending\x20dialconnect\x20event:','custom:dialconnect','[%s][voiceDialReport][dialend]\x20sending\x20voice_outbound_channel:save\x20event:','voice:outbound','error','[%s][voiceDialReport][dialend]','[%s][voiceDialReport][varset]\x20event:','addVariable','keys','variable','outboundrouteid','value','voice','[%s][voiceDialReport][varset]\x20outboundrouteid:%s\x20variable:%s\x20value:%s','[%s][voiceDialReport][varset]\x20sending\x20voice_outbound_channel:save\x20event:','[%s][voiceDialReport][varset]','rtpaudioqos','rtpaudioqosjitter','rtpaudioqosjitterbridged','rtpaudioqoslossbridged','rtpaudioqosrtt','rtpaudioqosrttbridged','sipcallid','sipuri','bridgepeer','bridgepvtcallid','membercalls','memberdynamic','memberinterface','memberrealtime','isNil','includes','[%s][voiceDialReport][hangup]\x20event:','[%s][voiceDialReport][hangup]\x20reason:%s\x20lasteevent:complete','duration','diff','seconds'];(function(_0x280918,_0x5b4cbc){var _0x5020b9=function(_0x5f20b6){while(--_0x5f20b6){_0x280918['push'](_0x280918['shift']());}};_0x5020b9(++_0x5b4cbc);}(_0xe28f,0x1e9));var _0xfe28=function(_0xbdc67f,_0x2622b3){_0xbdc67f=_0xbdc67f-0x0;var _0x59b4f8=_0xe28f[_0xbdc67f];return _0x59b4f8;};'use strict';var _=require(_0xfe28('0x0'));var moment=require(_0xfe28('0x1'));var util=require('util');var Redis=require('ioredis');var config=require(_0xfe28('0x2'));var logger=require(_0xfe28('0x3'))(_0xfe28('0x4'));var ami=require(_0xfe28('0x5'));config[_0xfe28('0x6')]=_[_0xfe28('0x7')](config['redis'],{'host':_0xfe28('0x8'),'port':0x18eb});var io=require(_0xfe28('0x9'))(new Redis(config['redis']));function VoiceDialReport(_0x5a7515){this['channels']=_0x5a7515['outboundChannels'];this[_0xfe28('0xa')]=_0x5a7515[_0xfe28('0xa')];this[_0xfe28('0xb')]={};this[_0xfe28('0xc')]={};ami['on'](_0xfe28('0xd'),this[_0xfe28('0xe')][_0xfe28('0xf')](this));ami['on']('dialend',this[_0xfe28('0x10')][_0xfe28('0xf')](this));ami['on']('varset',this['syncVarSet'][_0xfe28('0xf')](this));ami['on'](_0xfe28('0x11'),this[_0xfe28('0x12')][_0xfe28('0xf')](this));}VoiceDialReport['prototype'][_0xfe28('0x13')]=function(_0x49e7f0){return _0x49e7f0!==null&&!_[_0xfe28('0x14')](_0x49e7f0);};VoiceDialReport[_0xfe28('0x15')][_0xfe28('0x16')]=function(_0x14ef53,_0x2f8125,_0x3168a7){io['to'](_0x14ef53)[_0xfe28('0x16')](_0x2f8125,_0x3168a7);};VoiceDialReport[_0xfe28('0x15')][_0xfe28('0xe')]=function(_0x398089){try{if(this[_0xfe28('0x13')](_0x398089)){logger['debug'](_0xfe28('0x17'),_0x398089['uniqueid'],util[_0xfe28('0x18')](_0x398089,{'showHidden':![],'depth':null}));if(this[_0xfe28('0x19')][_0x398089[_0xfe28('0x1a')]]){_[_0xfe28('0x1b')](this[_0xfe28('0x19')][_0x398089[_0xfe28('0x1a')]],{'starttime':moment()[_0xfe28('0x1c')](_0xfe28('0x1d')),'lastevent':'called','interface':_0x398089[_0xfe28('0x1e')][_0xfe28('0x1f')](0x0,_0x398089['channel'][_0xfe28('0x20')]('-')),'membername':_0x398089[_0xfe28('0x1e')][_0xfe28('0x1f')](_0x398089['channel'][_0xfe28('0x20')]('/')+0x1,_0x398089[_0xfe28('0x1e')][_0xfe28('0x20')]('-'))},_['omit'](_0x398089,[_0xfe28('0x21'),'privilege']));logger[_0xfe28('0x22')](_0xfe28('0x23'),_0x398089[_0xfe28('0x1a')],this[_0xfe28('0x19')][_0x398089[_0xfe28('0x1a')]][_0xfe28('0x24')],this[_0xfe28('0x19')][_0x398089[_0xfe28('0x1a')]][_0xfe28('0x25')]);logger[_0xfe28('0x26')](_0xfe28('0x27'),_0x398089[_0xfe28('0x1a')],util['inspect'](this['channels'][_0x398089[_0xfe28('0x1a')]],{'showHidden':![],'depth':null}));if(this[_0xfe28('0xb')][_0x398089[_0xfe28('0x1a')]])_[_0xfe28('0x1b')](this[_0xfe28('0x19')][_0x398089[_0xfe28('0x1a')]],this[_0xfe28('0xb')][_0x398089[_0xfe28('0x1a')]]);this[_0xfe28('0x16')]('voice:outbound',_0xfe28('0x28'),this[_0xfe28('0x19')][_0x398089[_0xfe28('0x1a')]]);logger[_0xfe28('0x26')]('[%s][voiceDialReport][dialbegin]\x20sending\x20dialbegin\x20event:',_0x398089[_0xfe28('0x1a')],util[_0xfe28('0x18')](this[_0xfe28('0x19')][_0x398089[_0xfe28('0x1a')]],{'showHidden':![],'depth':null}));ami[_0xfe28('0x16')]('custom:dialbegin',this[_0xfe28('0x19')][_0x398089['uniqueid']]);}}}catch(_0x294182){logger['error'](_0xfe28('0x29'),_0x398089[_0xfe28('0x1a')],util['inspect'](_0x294182,{'showHidden':![],'depth':null}));}};VoiceDialReport['prototype']['syncDialEnd']=function(_0x4949a1){try{if(this['isNotNull'](_0x4949a1)){logger['debug'](_0xfe28('0x2a'),_0x4949a1['uniqueid'],util[_0xfe28('0x18')](_0x4949a1,{'showHidden':![],'depth':null}));if(this[_0xfe28('0x19')][_0x4949a1[_0xfe28('0x1a')]]){this[_0xfe28('0x19')][_0x4949a1[_0xfe28('0x1a')]][_0xfe28('0x2b')]=_0x4949a1[_0xfe28('0x2b')];if(_0x4949a1[_0xfe28('0x2b')]===_0xfe28('0x2c')){this['channels'][_0x4949a1[_0xfe28('0x1a')]][_0xfe28('0x2d')]=_0x4949a1['connectedlinenum'];this['channels'][_0x4949a1[_0xfe28('0x1a')]][_0xfe28('0x2e')]=_0x4949a1[_0xfe28('0x2e')];this[_0xfe28('0x19')][_0x4949a1[_0xfe28('0x1a')]][_0xfe28('0x2f')]=moment()[_0xfe28('0x1c')](_0xfe28('0x1d'));this[_0xfe28('0x19')][_0x4949a1[_0xfe28('0x1a')]][_0xfe28('0x30')]='connect';logger[_0xfe28('0x22')]('[%s][voiceDialReport][dialend]\x20agent:%s\x20lastevent:connect',_0x4949a1[_0xfe28('0x1a')],_0x4949a1[_0xfe28('0x1e')][_0xfe28('0x1f')](_0x4949a1[_0xfe28('0x1e')]['lastIndexOf']('/')+0x1,_0x4949a1[_0xfe28('0x1e')][_0xfe28('0x20')]('-')));logger[_0xfe28('0x26')](_0xfe28('0x31'),_0x4949a1[_0xfe28('0x1a')],util['inspect'](this[_0xfe28('0x19')][_0x4949a1[_0xfe28('0x1a')]],{'showHidden':![],'depth':null}));ami[_0xfe28('0x16')](_0xfe28('0x32'),this[_0xfe28('0x19')][_0x4949a1[_0xfe28('0x1a')]]);}logger[_0xfe28('0x26')](_0xfe28('0x33'),_0x4949a1['uniqueid'],util[_0xfe28('0x18')](this[_0xfe28('0x19')][_0x4949a1[_0xfe28('0x1a')]],{'showHidden':![],'depth':null}));this['emit'](_0xfe28('0x34'),'voice_outbound_channel:save',this['channels'][_0x4949a1[_0xfe28('0x1a')]]);}}}catch(_0x35c9c5){logger[_0xfe28('0x35')](_0xfe28('0x36'),_0x4949a1['uniqueid'],util[_0xfe28('0x18')](_0x35c9c5,{'showHidden':![],'depth':null}));}};VoiceDialReport[_0xfe28('0x15')]['syncVarSet']=function(_0xde35c4){try{if(this[_0xfe28('0x13')](_0xde35c4)){logger['debug'](_0xfe28('0x37'),_0xde35c4[_0xfe28('0x1a')],util[_0xfe28('0x18')](_0xde35c4,{'showHidden':![],'depth':null}));this[_0xfe28('0x38')](_0xde35c4['uniqueid'],_[_0xfe28('0x39')](_0xde35c4[_0xfe28('0x3a')])[0x0],_0xde35c4['value']);if(this[_0xfe28('0x13')](_0xde35c4[_0xfe28('0x3a')])&&this[_0xfe28('0x13')](_0xde35c4[_0xfe28('0x3a')][_0xfe28('0x3b')])){if(_[_0xfe28('0x14')](this[_0xfe28('0x19')][_0xde35c4[_0xfe28('0x1a')]])){this[_0xfe28('0x19')][_0xde35c4[_0xfe28('0x1a')]]={'routeId':_0xde35c4[_0xfe28('0x3c')],'variables':this[_0xfe28('0xc')][_0xde35c4['uniqueid']],'motionChannel':_0xfe28('0x3d')};logger[_0xfe28('0x22')](_0xfe28('0x3e'),_0xde35c4[_0xfe28('0x1a')],_0xde35c4['variable'][_0xfe28('0x3b')],_[_0xfe28('0x39')](_0xde35c4['variable'])[0x0],_0xde35c4[_0xfe28('0x3c')]);logger[_0xfe28('0x26')](_0xfe28('0x3f'),_0xde35c4[_0xfe28('0x1a')],util[_0xfe28('0x18')](this['channels'][_0xde35c4[_0xfe28('0x1a')]],{'showHidden':![],'depth':null}));this[_0xfe28('0x16')](_0xfe28('0x34'),_0xfe28('0x28'),this[_0xfe28('0x19')][_0xde35c4['uniqueid']]);}}}}catch(_0x461e72){logger[_0xfe28('0x35')](_0xfe28('0x40'),_0xde35c4[_0xfe28('0x1a')],util[_0xfe28('0x18')](_0x461e72,{'showHidden':![],'depth':null}));}};VoiceDialReport[_0xfe28('0x15')]['addVariable']=function(_0x9281fd,_0x2f93b3,_0x467ab6){var _0x3a2d7c=[_0xfe28('0x41'),'rtpaudioqosbridged',_0xfe28('0x42'),_0xfe28('0x43'),'rtpaudioqosloss',_0xfe28('0x44'),_0xfe28('0x45'),_0xfe28('0x46'),_0xfe28('0x47'),_0xfe28('0x48'),_0xfe28('0x49'),_0xfe28('0x4a'),_0xfe28('0x4b'),_0xfe28('0x4c'),_0xfe28('0x4d'),'memberlastcall',_0xfe28('0x24'),'memberpenalty',_0xfe28('0x4e')];if(!_[_0xfe28('0x4f')](_0x2f93b3)&&!_[_0xfe28('0x50')](_0x3a2d7c,_0x2f93b3)){if(_['isUndefined'](this[_0xfe28('0xc')][_0x9281fd])){this[_0xfe28('0xc')][_0x9281fd]={};}this[_0xfe28('0xc')][_0x9281fd][_0x2f93b3]=_0x467ab6;}};VoiceDialReport['prototype']['syncHangup']=function(_0xe9ab80){try{if(this[_0xfe28('0x13')](_0xe9ab80)){logger['debug'](_0xfe28('0x51'),_0xe9ab80[_0xfe28('0x1a')],util[_0xfe28('0x18')](_0xe9ab80,{'showHidden':![],'depth':null}));if(this[_0xfe28('0x19')][_0xe9ab80[_0xfe28('0x1a')]]){logger[_0xfe28('0x22')](_0xfe28('0x52'),_0xe9ab80[_0xfe28('0x1a')],_0xe9ab80['cause-txt']);this[_0xfe28('0x19')][_0xe9ab80[_0xfe28('0x1a')]]['endtime']=moment()['format']('YYYY-MM-DD\x20HH:mm:ss');this[_0xfe28('0x19')][_0xe9ab80[_0xfe28('0x1a')]][_0xfe28('0x53')]=moment(this[_0xfe28('0x19')][_0xe9ab80['uniqueid']]['endtime'])[_0xfe28('0x54')](this[_0xfe28('0x19')][_0xe9ab80[_0xfe28('0x1a')]]['starttime'],_0xfe28('0x55'));this['channels'][_0xe9ab80['uniqueid']]['lastevent']=_0xfe28('0x56');this[_0xfe28('0xa')][_0xfe28('0x57')]+=0x1;if(this[_0xfe28('0x19')][_0xe9ab80['uniqueid']]['answertime']){this[_0xfe28('0xa')]['answered']+=0x1;this[_0xfe28('0x19')][_0xe9ab80['uniqueid']][_0xfe28('0x58')]=moment(this[_0xfe28('0x19')][_0xe9ab80[_0xfe28('0x1a')]][_0xfe28('0x2f')])['diff'](this[_0xfe28('0x19')][_0xe9ab80['uniqueid']]['starttime'],'seconds');this['channels'][_0xe9ab80[_0xfe28('0x1a')]][_0xfe28('0x59')]=moment(this[_0xfe28('0x19')][_0xe9ab80[_0xfe28('0x1a')]]['endtime'])[_0xfe28('0x54')](this[_0xfe28('0x19')][_0xe9ab80[_0xfe28('0x1a')]][_0xfe28('0x2f')],_0xfe28('0x55'));this[_0xfe28('0xa')][_0xfe28('0x5a')]+=this[_0xfe28('0x19')][_0xe9ab80[_0xfe28('0x1a')]][_0xfe28('0x58')]||0x0;this[_0xfe28('0xa')][_0xfe28('0x5b')]+=this[_0xfe28('0x19')][_0xe9ab80[_0xfe28('0x1a')]][_0xfe28('0x59')];}this[_0xfe28('0xa')][_0xfe28('0x5c')]+=this[_0xfe28('0x19')][_0xe9ab80[_0xfe28('0x1a')]][_0xfe28('0x53')];logger['debug'](_0xfe28('0x5d'),_0xe9ab80[_0xfe28('0x1a')],util[_0xfe28('0x18')](this[_0xfe28('0x19')][_0xe9ab80['uniqueid']],{'showHidden':![],'depth':null}));ami[_0xfe28('0x16')](_0xfe28('0x5e'),this['channels'][_0xe9ab80['uniqueid']]);logger[_0xfe28('0x26')]('[%s][voiceDialReport][hangup]\x20sending\x20dialend\x20event:',_0xe9ab80['uniqueid'],util[_0xfe28('0x18')](this[_0xfe28('0x19')][_0xe9ab80[_0xfe28('0x1a')]],{'showHidden':![],'depth':null}));ami[_0xfe28('0x16')](_0xfe28('0x5f'),this[_0xfe28('0x19')][_0xe9ab80['uniqueid']]);logger[_0xfe28('0x26')]('[%s][voiceDialReport][hangup]\x20sending\x20voice_outbound:save\x20event:',_0xe9ab80[_0xfe28('0x1a')],util['inspect'](this['channels'][_0xe9ab80[_0xfe28('0x1a')]],{'showHidden':![],'depth':null}));this[_0xfe28('0x16')](_0xfe28('0x34'),_0xfe28('0x60'),this['outbound']);logger[_0xfe28('0x22')](_0xfe28('0x61'),JSON[_0xfe28('0x62')](this[_0xfe28('0x19')][_0xe9ab80['uniqueid']]));logger['debug'](_0xfe28('0x63'),_0xe9ab80[_0xfe28('0x1a')],util[_0xfe28('0x18')](this[_0xfe28('0x19')][_0xe9ab80['uniqueid']],{'showHidden':![],'depth':null}));this[_0xfe28('0x16')]('voice:outbound',_0xfe28('0x64'),this[_0xfe28('0x19')][_0xe9ab80[_0xfe28('0x1a')]]);this[_0xfe28('0x65')](_0xe9ab80['uniqueid']);}else if(this[_0xfe28('0x19')][_0xe9ab80[_0xfe28('0x66')]]){this[_0xfe28('0x19')][_0xe9ab80['linkedid']][_0xfe28('0x1a')]=this[_0xfe28('0x19')][_0xe9ab80['linkedid']][_0xfe28('0x67')];}if(this[_0xfe28('0xc')][_0xe9ab80[_0xfe28('0x1a')]]){delete this[_0xfe28('0xc')][_0xe9ab80[_0xfe28('0x1a')]];}}}catch(_0x291ba6){logger[_0xfe28('0x35')](_0xfe28('0x68'),_0xe9ab80[_0xfe28('0x1a')],util[_0xfe28('0x18')](_0x291ba6,{'showHidden':![],'depth':null}));}};VoiceDialReport[_0xfe28('0x15')][_0xfe28('0x69')]=function(_0x3ba79b){try{if(this[_0xfe28('0x13')](_0x3ba79b)){logger['debug']('[%s][voiceDialReport][newexten]\x20event:',_0x3ba79b[_0xfe28('0x1a')],util['inspect'](_0x3ba79b,{'showHidden':![],'depth':null}));if(_0x3ba79b[_0xfe28('0x6a')][_0xfe28('0x6b')]()===_0xfe28('0x6c')){_0x3ba79b[_0xfe28('0x6d')]=(_0x3ba79b[_0xfe28('0x6e')]||_0x3ba79b['applicationdata'])[_0xfe28('0x6b')]();if(_[_0xfe28('0x6f')](_0x3ba79b[_0xfe28('0x6d')],'cdr(')){if(_[_0xfe28('0x14')](this['applications'][_0x3ba79b[_0xfe28('0x1a')]]))this[_0xfe28('0xb')][_0x3ba79b[_0xfe28('0x1a')]]={};logger[_0xfe28('0x22')](_0xfe28('0x70'),_0x3ba79b[_0xfe28('0x1a')],_0x3ba79b['application'],_0x3ba79b[_0xfe28('0x6d')]);var _0x529462=_0x3ba79b[_0xfe28('0x6d')][_0xfe28('0x71')]('=');var _0x255752=_0x529462[0x0][_0xfe28('0x72')](/cdr\((.*)\)/);if(_0x255752)this['applications'][_0x3ba79b['uniqueid']][_0x255752[0x1]]=_0x529462[0x1];}}}}catch(_0x54fb20){logger[_0xfe28('0x35')]('[%s][voiceDialReport][newexten]',_0x3ba79b[_0xfe28('0x1a')],util['inspect'](_0x54fb20,{'showHidden':![],'depth':null}));}};VoiceDialReport[_0xfe28('0x15')][_0xfe28('0x65')]=function(_0x42462f,_0x2c0d77=0x2710){if(this['channels'][_0x42462f]){setTimeout(()=>{delete this[_0xfe28('0x19')][_0x42462f];},_0x2c0d77);}};module['exports']=VoiceDialReport; \ No newline at end of file +var _0x1eff=['outboundChannels','outbound','applications','variables','dialbegin','bind','syncVarSet','hangup','syncHangup','prototype','isNotNull','isUndefined','emit','syncDialBegin','[%s][voiceDialReport][dialbegin]\x20event:','uniqueid','inspect','merge','format','YYYY-MM-DD\x20HH:mm:ss','called','channel','substring','lastIndexOf','event','privilege','[%s][voiceDialReport][dialbegin]\x20agent:%s\x20interface:%s\x20lastevent:called','membername','interface','debug','voice:outbound','[%s][voiceDialReport][dialbegin]\x20sending\x20dialbegin\x20event:','custom:dialbegin','error','[%s][voiceDialReport][dialbegin]','syncDialEnd','[%s][voiceDialReport][dialend]\x20event:','dialstatus','ANSWER','connectedlinenum','connectedlinename','lastevent','info','[%s][voiceDialReport][dialend]\x20agent:%s\x20lastevent:connect','[%s][voiceDialReport][dialend]\x20sending\x20dialconnect\x20event:','custom:dialconnect','[%s][voiceDialReport][dialend]\x20sending\x20voice_outbound_channel:save\x20event:','voice_outbound_channel:save','[%s][voiceDialReport][dialend]','[%s][voiceDialReport][varset]\x20event:','addVariable','keys','variable','value','voice','[%s][voiceDialReport][varset]\x20outboundrouteid:%s\x20variable:%s\x20value:%s','outboundrouteid','rtpaudioqos','rtpaudioqosbridged','rtpaudioqosjitterbridged','rtpaudioqosloss','rtpaudioqosrtt','rtpaudioqosrttbridged','sipuri','membercalls','memberdynamic','memberlastcall','memberpenalty','memberrealtime','isNil','includes','[%s][voiceDialReport][hangup]\x20event:','cause-txt','endtime','diff','complete','total','holdtime','answertime','starttime','seconds','billableseconds','sumHoldTime','sumBillable','[%s][voiceDialReport][hangup]\x20sending\x20dialend\x20event:','custom:dialend','voice_outbound:save','[DEBUG]\x20Emit\x20voice_outbound_channel:remove\x20event','[%s][voiceDialReport][hangup]\x20sending\x20voice_outbound_channel:remove\x20event:','deleteChannelAfterTimeout','linkedid','destuniqueid','[%s][voiceDialReport][hangup]','syncNewExten','[%s][voiceDialReport][newexten]\x20event:','application','set','appdata','applicationdata','toLowerCase','startsWith','cdr(','match','[%s][voiceDialReport][newexten]','exports','lodash','util','ioredis','../../../config/environment','ami','../ami','defaults','redis','localhost','channels'];(function(_0x48b810,_0x173a5e){var _0x23c17d=function(_0x38531e){while(--_0x38531e){_0x48b810['push'](_0x48b810['shift']());}};_0x23c17d(++_0x173a5e);}(_0x1eff,0xdc));var _0xf1ef=function(_0x3ed1ad,_0xfbb9dd){_0x3ed1ad=_0x3ed1ad-0x0;var _0x353bdc=_0x1eff[_0x3ed1ad];return _0x353bdc;};'use strict';var _=require(_0xf1ef('0x0'));var moment=require('moment');var util=require(_0xf1ef('0x1'));var Redis=require(_0xf1ef('0x2'));var config=require(_0xf1ef('0x3'));var logger=require('../../../config/logger')(_0xf1ef('0x4'));var ami=require(_0xf1ef('0x5'));config['redis']=_[_0xf1ef('0x6')](config[_0xf1ef('0x7')],{'host':_0xf1ef('0x8'),'port':0x18eb});var io=require('socket.io-emitter')(new Redis(config['redis']));function VoiceDialReport(_0x8b0d2f){this[_0xf1ef('0x9')]=_0x8b0d2f[_0xf1ef('0xa')];this[_0xf1ef('0xb')]=_0x8b0d2f[_0xf1ef('0xb')];this[_0xf1ef('0xc')]={};this[_0xf1ef('0xd')]={};ami['on'](_0xf1ef('0xe'),this['syncDialBegin'][_0xf1ef('0xf')](this));ami['on']('dialend',this['syncDialEnd']['bind'](this));ami['on']('varset',this[_0xf1ef('0x10')]['bind'](this));ami['on'](_0xf1ef('0x11'),this[_0xf1ef('0x12')]['bind'](this));}VoiceDialReport[_0xf1ef('0x13')][_0xf1ef('0x14')]=function(_0x2c7334){return _0x2c7334!==null&&!_[_0xf1ef('0x15')](_0x2c7334);};VoiceDialReport[_0xf1ef('0x13')][_0xf1ef('0x16')]=function(_0x2e50a3,_0x585b49,_0x2957e5){io['to'](_0x2e50a3)[_0xf1ef('0x16')](_0x585b49,_0x2957e5);};VoiceDialReport['prototype'][_0xf1ef('0x17')]=function(_0x593d83){try{if(this[_0xf1ef('0x14')](_0x593d83)){logger['debug'](_0xf1ef('0x18'),_0x593d83[_0xf1ef('0x19')],util[_0xf1ef('0x1a')](_0x593d83,{'showHidden':![],'depth':null}));if(this[_0xf1ef('0x9')][_0x593d83[_0xf1ef('0x19')]]){_[_0xf1ef('0x1b')](this[_0xf1ef('0x9')][_0x593d83[_0xf1ef('0x19')]],{'starttime':moment()[_0xf1ef('0x1c')](_0xf1ef('0x1d')),'lastevent':_0xf1ef('0x1e'),'interface':_0x593d83[_0xf1ef('0x1f')][_0xf1ef('0x20')](0x0,_0x593d83[_0xf1ef('0x1f')][_0xf1ef('0x21')]('-')),'membername':_0x593d83[_0xf1ef('0x1f')][_0xf1ef('0x20')](_0x593d83['channel'][_0xf1ef('0x21')]('/')+0x1,_0x593d83[_0xf1ef('0x1f')]['lastIndexOf']('-'))},_['omit'](_0x593d83,[_0xf1ef('0x22'),_0xf1ef('0x23')]));logger['info'](_0xf1ef('0x24'),_0x593d83[_0xf1ef('0x19')],this['channels'][_0x593d83[_0xf1ef('0x19')]][_0xf1ef('0x25')],this[_0xf1ef('0x9')][_0x593d83[_0xf1ef('0x19')]][_0xf1ef('0x26')]);logger[_0xf1ef('0x27')]('[%s][voiceDialReport][dialbegin]\x20sending\x20voice_outbound_channel:save\x20event:',_0x593d83[_0xf1ef('0x19')],util[_0xf1ef('0x1a')](this[_0xf1ef('0x9')][_0x593d83[_0xf1ef('0x19')]],{'showHidden':![],'depth':null}));if(this[_0xf1ef('0xc')][_0x593d83[_0xf1ef('0x19')]])_[_0xf1ef('0x1b')](this[_0xf1ef('0x9')][_0x593d83[_0xf1ef('0x19')]],this[_0xf1ef('0xc')][_0x593d83['uniqueid']]);this['emit'](_0xf1ef('0x28'),'voice_outbound_channel:save',this[_0xf1ef('0x9')][_0x593d83['uniqueid']]);logger[_0xf1ef('0x27')](_0xf1ef('0x29'),_0x593d83[_0xf1ef('0x19')],util[_0xf1ef('0x1a')](this[_0xf1ef('0x9')][_0x593d83[_0xf1ef('0x19')]],{'showHidden':![],'depth':null}));ami[_0xf1ef('0x16')](_0xf1ef('0x2a'),this[_0xf1ef('0x9')][_0x593d83[_0xf1ef('0x19')]]);}}}catch(_0x20dac6){logger[_0xf1ef('0x2b')](_0xf1ef('0x2c'),_0x593d83[_0xf1ef('0x19')],util[_0xf1ef('0x1a')](_0x20dac6,{'showHidden':![],'depth':null}));}};VoiceDialReport[_0xf1ef('0x13')][_0xf1ef('0x2d')]=function(_0x47125a){try{if(this[_0xf1ef('0x14')](_0x47125a)){logger[_0xf1ef('0x27')](_0xf1ef('0x2e'),_0x47125a[_0xf1ef('0x19')],util[_0xf1ef('0x1a')](_0x47125a,{'showHidden':![],'depth':null}));if(this['channels'][_0x47125a[_0xf1ef('0x19')]]){this[_0xf1ef('0x9')][_0x47125a[_0xf1ef('0x19')]][_0xf1ef('0x2f')]=_0x47125a['dialstatus'];if(_0x47125a[_0xf1ef('0x2f')]===_0xf1ef('0x30')){this[_0xf1ef('0x9')][_0x47125a[_0xf1ef('0x19')]][_0xf1ef('0x31')]=_0x47125a[_0xf1ef('0x31')];this['channels'][_0x47125a['uniqueid']][_0xf1ef('0x32')]=_0x47125a[_0xf1ef('0x32')];this[_0xf1ef('0x9')][_0x47125a['uniqueid']]['answertime']=moment()['format'](_0xf1ef('0x1d'));this[_0xf1ef('0x9')][_0x47125a[_0xf1ef('0x19')]][_0xf1ef('0x33')]='connect';logger[_0xf1ef('0x34')](_0xf1ef('0x35'),_0x47125a[_0xf1ef('0x19')],_0x47125a[_0xf1ef('0x1f')][_0xf1ef('0x20')](_0x47125a['channel'][_0xf1ef('0x21')]('/')+0x1,_0x47125a[_0xf1ef('0x1f')][_0xf1ef('0x21')]('-')));logger[_0xf1ef('0x27')](_0xf1ef('0x36'),_0x47125a[_0xf1ef('0x19')],util['inspect'](this['channels'][_0x47125a['uniqueid']],{'showHidden':![],'depth':null}));ami[_0xf1ef('0x16')](_0xf1ef('0x37'),this[_0xf1ef('0x9')][_0x47125a[_0xf1ef('0x19')]]);}logger[_0xf1ef('0x27')](_0xf1ef('0x38'),_0x47125a[_0xf1ef('0x19')],util[_0xf1ef('0x1a')](this[_0xf1ef('0x9')][_0x47125a[_0xf1ef('0x19')]],{'showHidden':![],'depth':null}));this[_0xf1ef('0x16')]('voice:outbound',_0xf1ef('0x39'),this['channels'][_0x47125a[_0xf1ef('0x19')]]);}}}catch(_0xb970c8){logger[_0xf1ef('0x2b')](_0xf1ef('0x3a'),_0x47125a['uniqueid'],util[_0xf1ef('0x1a')](_0xb970c8,{'showHidden':![],'depth':null}));}};VoiceDialReport[_0xf1ef('0x13')][_0xf1ef('0x10')]=function(_0x45670e){try{if(this[_0xf1ef('0x14')](_0x45670e)){logger[_0xf1ef('0x27')](_0xf1ef('0x3b'),_0x45670e[_0xf1ef('0x19')],util[_0xf1ef('0x1a')](_0x45670e,{'showHidden':![],'depth':null}));this[_0xf1ef('0x3c')](_0x45670e[_0xf1ef('0x19')],_[_0xf1ef('0x3d')](_0x45670e[_0xf1ef('0x3e')])[0x0],_0x45670e[_0xf1ef('0x3f')]);if(this[_0xf1ef('0x14')](_0x45670e['variable'])&&this[_0xf1ef('0x14')](_0x45670e[_0xf1ef('0x3e')]['outboundrouteid'])){if(_[_0xf1ef('0x15')](this[_0xf1ef('0x9')][_0x45670e[_0xf1ef('0x19')]])){this[_0xf1ef('0x9')][_0x45670e[_0xf1ef('0x19')]]={'routeId':_0x45670e[_0xf1ef('0x3f')],'variables':this['variables'][_0x45670e['uniqueid']],'motionChannel':_0xf1ef('0x40')};logger[_0xf1ef('0x34')](_0xf1ef('0x41'),_0x45670e[_0xf1ef('0x19')],_0x45670e['variable'][_0xf1ef('0x42')],_[_0xf1ef('0x3d')](_0x45670e[_0xf1ef('0x3e')])[0x0],_0x45670e[_0xf1ef('0x3f')]);logger['debug']('[%s][voiceDialReport][varset]\x20sending\x20voice_outbound_channel:save\x20event:',_0x45670e[_0xf1ef('0x19')],util[_0xf1ef('0x1a')](this['channels'][_0x45670e[_0xf1ef('0x19')]],{'showHidden':![],'depth':null}));this[_0xf1ef('0x16')](_0xf1ef('0x28'),_0xf1ef('0x39'),this[_0xf1ef('0x9')][_0x45670e[_0xf1ef('0x19')]]);}}}}catch(_0x55d6f9){logger['error']('[%s][voiceDialReport][varset]',_0x45670e[_0xf1ef('0x19')],util['inspect'](_0x55d6f9,{'showHidden':![],'depth':null}));}};VoiceDialReport[_0xf1ef('0x13')][_0xf1ef('0x3c')]=function(_0x66a427,_0x29533e,_0x522eff){var _0x4b3f36=[_0xf1ef('0x43'),_0xf1ef('0x44'),'rtpaudioqosjitter',_0xf1ef('0x45'),_0xf1ef('0x46'),'rtpaudioqoslossbridged',_0xf1ef('0x47'),_0xf1ef('0x48'),'sipcallid',_0xf1ef('0x49'),'bridgepeer','bridgepvtcallid',_0xf1ef('0x4a'),_0xf1ef('0x4b'),'memberinterface',_0xf1ef('0x4c'),_0xf1ef('0x25'),_0xf1ef('0x4d'),_0xf1ef('0x4e')];if(!_[_0xf1ef('0x4f')](_0x29533e)&&!_[_0xf1ef('0x50')](_0x4b3f36,_0x29533e)){if(_['isUndefined'](this[_0xf1ef('0xd')][_0x66a427])){this[_0xf1ef('0xd')][_0x66a427]={};}this[_0xf1ef('0xd')][_0x66a427][_0x29533e]=_0x522eff;}};VoiceDialReport[_0xf1ef('0x13')]['syncHangup']=function(_0x8a7d6f){try{if(this[_0xf1ef('0x14')](_0x8a7d6f)){logger[_0xf1ef('0x27')](_0xf1ef('0x51'),_0x8a7d6f['uniqueid'],util['inspect'](_0x8a7d6f,{'showHidden':![],'depth':null}));if(this['channels'][_0x8a7d6f['uniqueid']]){logger[_0xf1ef('0x34')]('[%s][voiceDialReport][hangup]\x20reason:%s\x20lasteevent:complete',_0x8a7d6f['uniqueid'],_0x8a7d6f[_0xf1ef('0x52')]);this[_0xf1ef('0x9')][_0x8a7d6f[_0xf1ef('0x19')]][_0xf1ef('0x53')]=moment()[_0xf1ef('0x1c')](_0xf1ef('0x1d'));this['channels'][_0x8a7d6f[_0xf1ef('0x19')]]['duration']=moment(this['channels'][_0x8a7d6f[_0xf1ef('0x19')]][_0xf1ef('0x53')])[_0xf1ef('0x54')](this['channels'][_0x8a7d6f[_0xf1ef('0x19')]]['starttime'],'seconds');this['channels'][_0x8a7d6f['uniqueid']]['lastevent']=_0xf1ef('0x55');this['outbound'][_0xf1ef('0x56')]+=0x1;if(this[_0xf1ef('0x9')][_0x8a7d6f[_0xf1ef('0x19')]]['answertime']){this[_0xf1ef('0xb')]['answered']+=0x1;this[_0xf1ef('0x9')][_0x8a7d6f[_0xf1ef('0x19')]][_0xf1ef('0x57')]=moment(this[_0xf1ef('0x9')][_0x8a7d6f[_0xf1ef('0x19')]][_0xf1ef('0x58')])[_0xf1ef('0x54')](this[_0xf1ef('0x9')][_0x8a7d6f[_0xf1ef('0x19')]][_0xf1ef('0x59')],_0xf1ef('0x5a'));this[_0xf1ef('0x9')][_0x8a7d6f[_0xf1ef('0x19')]][_0xf1ef('0x5b')]=moment(this[_0xf1ef('0x9')][_0x8a7d6f[_0xf1ef('0x19')]][_0xf1ef('0x53')])[_0xf1ef('0x54')](this[_0xf1ef('0x9')][_0x8a7d6f[_0xf1ef('0x19')]][_0xf1ef('0x58')],'seconds');this['outbound'][_0xf1ef('0x5c')]+=this[_0xf1ef('0x9')][_0x8a7d6f[_0xf1ef('0x19')]][_0xf1ef('0x57')]||0x0;this[_0xf1ef('0xb')][_0xf1ef('0x5d')]+=this['channels'][_0x8a7d6f[_0xf1ef('0x19')]][_0xf1ef('0x5b')];}this[_0xf1ef('0xb')]['sumDuration']+=this[_0xf1ef('0x9')][_0x8a7d6f[_0xf1ef('0x19')]]['duration'];logger[_0xf1ef('0x27')]('[%s][voiceDialReport][hangup]\x20sending\x20voiceDialReport\x20event:',_0x8a7d6f['uniqueid'],util[_0xf1ef('0x1a')](this[_0xf1ef('0x9')][_0x8a7d6f[_0xf1ef('0x19')]],{'showHidden':![],'depth':null}));ami[_0xf1ef('0x16')]('custom:voiceDialReport',this['channels'][_0x8a7d6f[_0xf1ef('0x19')]]);logger[_0xf1ef('0x27')](_0xf1ef('0x5e'),_0x8a7d6f[_0xf1ef('0x19')],util[_0xf1ef('0x1a')](this[_0xf1ef('0x9')][_0x8a7d6f[_0xf1ef('0x19')]],{'showHidden':![],'depth':null}));ami[_0xf1ef('0x16')](_0xf1ef('0x5f'),this[_0xf1ef('0x9')][_0x8a7d6f[_0xf1ef('0x19')]]);logger[_0xf1ef('0x27')]('[%s][voiceDialReport][hangup]\x20sending\x20voice_outbound:save\x20event:',_0x8a7d6f[_0xf1ef('0x19')],util[_0xf1ef('0x1a')](this[_0xf1ef('0x9')][_0x8a7d6f[_0xf1ef('0x19')]],{'showHidden':![],'depth':null}));this[_0xf1ef('0x16')](_0xf1ef('0x28'),_0xf1ef('0x60'),this[_0xf1ef('0xb')]);logger[_0xf1ef('0x34')](_0xf1ef('0x61'),JSON['stringify'](this[_0xf1ef('0x9')][_0x8a7d6f['uniqueid']]));logger[_0xf1ef('0x27')](_0xf1ef('0x62'),_0x8a7d6f[_0xf1ef('0x19')],util[_0xf1ef('0x1a')](this[_0xf1ef('0x9')][_0x8a7d6f[_0xf1ef('0x19')]],{'showHidden':![],'depth':null}));this['emit'](_0xf1ef('0x28'),'voice_outbound_channel:remove',this[_0xf1ef('0x9')][_0x8a7d6f[_0xf1ef('0x19')]]);this[_0xf1ef('0x63')](_0x8a7d6f[_0xf1ef('0x19')]);}else if(this['channels'][_0x8a7d6f[_0xf1ef('0x64')]]){this[_0xf1ef('0x9')][_0x8a7d6f[_0xf1ef('0x64')]]['uniqueid']=this[_0xf1ef('0x9')][_0x8a7d6f['linkedid']][_0xf1ef('0x65')];}if(this[_0xf1ef('0xd')][_0x8a7d6f['uniqueid']]){delete this[_0xf1ef('0xd')][_0x8a7d6f['uniqueid']];}}}catch(_0x1d0bba){logger[_0xf1ef('0x2b')](_0xf1ef('0x66'),_0x8a7d6f[_0xf1ef('0x19')],util[_0xf1ef('0x1a')](_0x1d0bba,{'showHidden':![],'depth':null}));}};VoiceDialReport[_0xf1ef('0x13')][_0xf1ef('0x67')]=function(_0x2a1d9d){try{if(this[_0xf1ef('0x14')](_0x2a1d9d)){logger['debug'](_0xf1ef('0x68'),_0x2a1d9d[_0xf1ef('0x19')],util[_0xf1ef('0x1a')](_0x2a1d9d,{'showHidden':![],'depth':null}));if(_0x2a1d9d[_0xf1ef('0x69')]['toLowerCase']()===_0xf1ef('0x6a')){_0x2a1d9d['applicationdata']=(_0x2a1d9d[_0xf1ef('0x6b')]||_0x2a1d9d[_0xf1ef('0x6c')])[_0xf1ef('0x6d')]();if(_[_0xf1ef('0x6e')](_0x2a1d9d[_0xf1ef('0x6c')],_0xf1ef('0x6f'))){if(_[_0xf1ef('0x15')](this[_0xf1ef('0xc')][_0x2a1d9d['uniqueid']]))this[_0xf1ef('0xc')][_0x2a1d9d[_0xf1ef('0x19')]]={};logger[_0xf1ef('0x34')]('[%s][voiceDialReport][newexten]\x20application:%s\x20appdata:%s',_0x2a1d9d[_0xf1ef('0x19')],_0x2a1d9d[_0xf1ef('0x69')],_0x2a1d9d[_0xf1ef('0x6c')]);var _0x1c0ccd=_0x2a1d9d['applicationdata']['split']('=');var _0x4dd50b=_0x1c0ccd[0x0][_0xf1ef('0x70')](/cdr\((.*)\)/);if(_0x4dd50b)this[_0xf1ef('0xc')][_0x2a1d9d['uniqueid']][_0x4dd50b[0x1]]=_0x1c0ccd[0x1];}}}}catch(_0x23bcb4){logger[_0xf1ef('0x2b')](_0xf1ef('0x71'),_0x2a1d9d[_0xf1ef('0x19')],util[_0xf1ef('0x1a')](_0x23bcb4,{'showHidden':![],'depth':null}));}};VoiceDialReport[_0xf1ef('0x13')][_0xf1ef('0x63')]=function(_0x4091a1,_0x319364=0x2710){if(this[_0xf1ef('0x9')][_0x4091a1]){setTimeout(()=>{delete this[_0xf1ef('0x9')][_0x4091a1];},_0x319364);}};module[_0xf1ef('0x72')]=VoiceDialReport; \ No newline at end of file diff --git a/server/services/ami/report/voiceQueueReport.js b/server/services/ami/report/voiceQueueReport.js index 720be0f..6833117 100644 --- a/server/services/ami/report/voiceQueueReport.js +++ b/server/services/ami/report/voiceQueueReport.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0xb4b3=['handleInboundQueueSummaryReport','type','outbound','custom:queuesummary','statusRequests','syncQueueSummaryComplete','completeEvent','[voiceQueueReport][queuesummary]\x20event:','[voiceQueueReport][queuesummary]\x20name:%s','debug','custom:queuesummarycomplete','[%s][voiceQueueReport][queuecallerjoin]','queuecallerjoinAt','YYYY-MM-DD\x20HH:mm:ss','position','count','info','assign','pick','keys','push','[%s][voiceQueueReport][queuecallerabandon]','last','queuecallercompleteAt','holdtime','originalposition','queuecallerabandonAt','ABANDONED','lastAssignedTo','[voiceQueueReport][queuecallerabandon]\x20name:%s\x20type:%s','[%s][voiceQueueReport][queuecallerleave]','connectedlinenum','connectedlinename','[voiceQueueReport][queuecallerleave]\x20name:%s\x20type:%s\x20connectedlinenum:%s\x20connectedlinename:%s','[%s][voiceQueueReport][agentconnect]','COMPLETEDBYAGENT','[voiceQueueReport][agentconnect]\x20name:%s\x20type:%s\x20queuecallerexitreason:COMPLETEDBYAGENT','assigned','queuecallerexitAt','transfer','reason','startsWith','toLowerCase','linkedid','add','transfertype','FORWARD','transferexten','[voiceQueueReport][agentcomplete]\x20name:%s\x20type:%s\x20queuecallerexitreason:FORWARDTRANSFER','toUpperCase','[%s][voiceQueueReport][agentcomplete]','[%s][voiceQueueReport][varset]','variable','value','TIMEOUT','lastevent','timeout','[%s][voiceQueueReport][varset]\x20sending\x20timeout\x20event:','custom:timeout','queuecallerleaveAt','queueposition','[%s][voiceQueueReport][varset]\x20name:%s\x20type:%s\x20variable:%s\x20value:%s','rtpaudioqos','rtpaudioqosbridged','rtpaudioqosjitter','rtpaudioqosjitterbridged','rtpaudioqosrtt','rtpaudioqosrttbridged','sipcallid','bridgepeer','bridgepvtcallid','membercalls','memberdynamic','memberinterface','memberlastcall','membername','memberpenalty','memberrealtime','isNil','includes','length','sumHoldTime','seconds','ATTENDEDTRANSFER','sumDuration','diff','total','answered','sumBillable','unmanaged','custom:queuecallerunmanaged','abandoned','[%s][voiceQueueReport][hangup]\x20sending\x20queuecallerabandon\x20event:','custom:queuecallerabandon','[%s][voiceQueueReport][hangup]\x20name:%s\x20type:%s\x20reason:%s','[%s][voiceQueueReport][hangup]\x20sending\x20voiceQueueReport\x20event:','deleteChannelAfterTimeout','[%s][voiceQueueReport][handleHangup]','handleHangup','cause-txt','[%s][voiceQueueReport][syncHangup]\x20No\x20available\x20data\x20in\x20queueReports\x20structure:\x20clear\x20action\x20in\x20variablea\x20and\x20channels\x20structures\x20needed','transferuniqueid','secondtransfereruniqueid','transfereeuniqueid','[%s][voiceQueueReport][attendedTransfer]\x20name:%s\x20type:%s\x20transferexten:%s\x20transferuniqueid:%s','transfertargetuniqueid','origtransfererexten','origtransfereruniqueid','ATTENDED','transferid','[%s][voiceQueueReport][blindtransfer]','BLINDTRANSFER','BLIND','[%s][voiceQueueReport][blindTransfer]\x20name:%s\x20type:%s\x20transferexten:%s\x20transferuniqueid:%s','context','mohstarttime','[%s][voiceQueueReport][musiconholdstart]','[%s][voiceQueueReport][musiconholdstop]','mohtime','milliseconds','[%s][voiceQueueReport][musiconholdstop]\x20mohtime:%s','syncNewExten','[%s][voiceQueueReport][newexten]\x20event:','application','set','applicationdata','appdata','cdr(','[%s][voiceQueueReport][newexten]\x20application:%s\x20appdata:%s','match','[%s][voiceQueueReport][newexten]','exports','moment','util','ioredis','../../../config/logger','ami','../ami','../model/queueReport','../model/voiceQueueSummary','redis','defaults','localhost','socket.io-emitter','prototype','enqueue','tail','sequence','queueReports','realtime','agents','queueChannels','voiceQueues','campaigns','summary','variables','queuesummary','syncQueueSummary','bind','queuemember','syncQueueMember','queuestatuscomplete','queuecallerjoin','syncQueueCallerJoin','queuecallerabandon','syncQueueCallerAbandon','queuecallerleave','agentcomplete','syncAgentComplete','agentconnect','syncAgentConnect','varset','syncVarSet','hangup','syncHangup','fullybooted','syncFullyBooted','musiconholdstart','syncMusicOnHoldStart','musiconholdstop','syncMusicOnHoldStop','attendedtransfer','syncAttendedTransfer','blindtransfer','syncBlindTransfer','isEmpty','hasOwnProperty','originated','talking','pTalking','waiting','unlockRR','queuecallerexit','queuecallercomplete','clearZombieChannels','channels','switch','Action','status','channel','message','No\x20such\x20channel','error','[%s][voiceQueueReport][checkChannel]','inspect','[%s][voiceQueueReport][checkQueueReport]','[FullyBooted]\x20clear\x20realtime','clearQueueReport','emitVoiceQueueChannelRemove','clearqueuereport','emit','emitVoiceQueueChannelSave','[%s][voiceQueueReport][',']\x20sending\x20voice_queue_channel:save\x20event:','uniqueid','format','voice:queue:%s','queue','voice_queue_channel:save','voice_queue_presence:save',']\x20sending\x20voice_queue_channel:remove\x20event:','queuecallerexitreason','voice_queue_channel:remove','voice_queue_presence:remove','emitInboundVoiceQueueSummary','inbound','[voiceQueueReport][queuesummary]\x20sending\x20voice_queue:save\x20event:','name','voice_queue:save','isNotNull','isUndefined','queues','[voiceQueueReport][queues]','loopQueueSummary','isRunning','then','queuestatus','catch','[voiceQueueReport][queuesummary]','createReport','createQueueSummaryReport','syncQueueStatusComplete','actionid'];(function(_0x414d0d,_0x2216bf){var _0x15eacc=function(_0x1045fb){while(--_0x1045fb){_0x414d0d['push'](_0x414d0d['shift']());}};_0x15eacc(++_0x2216bf);}(_0xb4b3,0x84));var _0x3b4b=function(_0x83edb9,_0x83ab6b){_0x83edb9=_0x83edb9-0x0;var _0x44050a=_0xb4b3[_0x83edb9];return _0x44050a;};'use strict';var _=require('lodash');var moment=require(_0x3b4b('0x0'));var util=require(_0x3b4b('0x1'));var Redis=require(_0x3b4b('0x2'));var config=require('../../../config/environment');var logger=require(_0x3b4b('0x3'))(_0x3b4b('0x4'));var ami=require(_0x3b4b('0x5'));var QueueReport=require(_0x3b4b('0x6'));var VoiceQueueSummary=require(_0x3b4b('0x7'));config[_0x3b4b('0x8')]=_[_0x3b4b('0x9')](config[_0x3b4b('0x8')],{'host':_0x3b4b('0xa'),'port':0x18eb});var io=require(_0x3b4b('0xb'))(new Redis(config[_0x3b4b('0x8')]));var Sequence=function(){};Sequence[_0x3b4b('0xc')][_0x3b4b('0xd')]=function(_0x39529f){this['tail']=this[_0x3b4b('0xe')]?this[_0x3b4b('0xe')]['finally'](_0x39529f):_0x39529f();};function VoiceQueueReport(_0x118427){this[_0x3b4b('0xf')]=new Sequence();this[_0x3b4b('0x10')]={};this[_0x3b4b('0x11')]=_0x118427;this['agents']=_0x118427[_0x3b4b('0x12')];this['channels']=_0x118427[_0x3b4b('0x13')];this['voiceQueues']=_0x118427[_0x3b4b('0x14')];this[_0x3b4b('0x15')]=_0x118427[_0x3b4b('0x15')];this[_0x3b4b('0x16')]=initializeSummary();this[_0x3b4b('0x17')]={};ami['on'](_0x3b4b('0x18'),this[_0x3b4b('0x19')][_0x3b4b('0x1a')](this));ami['on']('queuesummarycomplete',this['syncQueueSummaryComplete'][_0x3b4b('0x1a')](this));ami['on'](_0x3b4b('0x1b'),this[_0x3b4b('0x1c')]['bind'](this));ami['on'](_0x3b4b('0x1d'),this['syncQueueStatusComplete'][_0x3b4b('0x1a')](this));ami['on'](_0x3b4b('0x1e'),this[_0x3b4b('0x1f')][_0x3b4b('0x1a')](this));ami['on'](_0x3b4b('0x20'),this[_0x3b4b('0x21')]['bind'](this));ami['on'](_0x3b4b('0x22'),this['syncQueueCallerLeave'][_0x3b4b('0x1a')](this));ami['on'](_0x3b4b('0x23'),this[_0x3b4b('0x24')][_0x3b4b('0x1a')](this));ami['on'](_0x3b4b('0x25'),this[_0x3b4b('0x26')][_0x3b4b('0x1a')](this));ami['on'](_0x3b4b('0x27'),this[_0x3b4b('0x28')][_0x3b4b('0x1a')](this));ami['on'](_0x3b4b('0x29'),this[_0x3b4b('0x2a')]['bind'](this));ami['on'](_0x3b4b('0x2b'),this[_0x3b4b('0x2c')][_0x3b4b('0x1a')](this));ami['on'](_0x3b4b('0x2d'),this[_0x3b4b('0x2e')][_0x3b4b('0x1a')](this));ami['on'](_0x3b4b('0x2f'),this[_0x3b4b('0x30')][_0x3b4b('0x1a')](this));ami['on'](_0x3b4b('0x31'),this[_0x3b4b('0x32')][_0x3b4b('0x1a')](this));ami['on'](_0x3b4b('0x33'),this[_0x3b4b('0x34')][_0x3b4b('0x1a')](this));this['loopQueueSummary']();this['loopQueueShow']();}function clearChannels(_0x4b4a29){if(!_[_0x3b4b('0x35')](_0x4b4a29)){for(var _0xb734a4 in _0x4b4a29){if(_0x4b4a29[_0x3b4b('0x36')](_0xb734a4)){delete _0x4b4a29[_0xb734a4];}}}}function clearCampaigns(_0x332397){if(!_[_0x3b4b('0x35')](_0x332397)){for(var _0x5a5d25 in _0x332397){if(_0x332397[_0x3b4b('0x36')](_0x5a5d25)){_0x332397[_0x5a5d25][_0x3b4b('0x37')]=0x0;}}}}function clearVoiceQueues(_0x55fccc){if(!_[_0x3b4b('0x35')](_0x55fccc)){for(var _0x39162b in _0x55fccc){if(_0x55fccc[_0x3b4b('0x36')](_0x39162b)){_0x55fccc[_0x39162b]['originated']=0x0;_0x55fccc[_0x39162b][_0x3b4b('0x38')]=0x0;_0x55fccc[_0x39162b][_0x3b4b('0x39')]=0x0;_0x55fccc[_0x39162b][_0x3b4b('0x3a')]=0x0;_0x55fccc[_0x39162b]['queueStatusComplete']=!![];}}}}function clearAgentBooked(_0xce597d){if(!_[_0x3b4b('0x35')](_0xce597d)){for(var _0x1e15fa in _0xce597d){if(_0xce597d[_0x3b4b('0x36')](_0x1e15fa)){_0xce597d[_0x1e15fa][_0x3b4b('0x3b')]=!![];}}}}function initializeSummary(){return{'id':null,'completeEvent':null,'isRunning':![],'queues':{},'queuestatus':{},'statusRequests':0x0};}function hasCallerLeftTheQueue(_0x1eecac){return _0x1eecac[_0x3b4b('0x3c')]||_0x1eecac[_0x3b4b('0x20')]||_0x1eecac[_0x3b4b('0x3d')];}VoiceQueueReport[_0x3b4b('0xc')][_0x3b4b('0x3e')]=function(){var _0xd1fd18=this;for(var _0x1e5dae in this[_0x3b4b('0x3f')]){if(this['channels'][_0x3b4b('0x36')](_0x1e5dae)&&!this[_0x3b4b('0x3f')][_0x1e5dae][_0x3b4b('0x40')]){this[_0x3b4b('0xf')][_0x3b4b('0xd')](function(){if(!_['isNil'](_0xd1fd18[_0x3b4b('0x3f')][_0x1e5dae])){return ami[_0x3b4b('0x41')]({'action':_0x3b4b('0x42'),'channel':_0xd1fd18['channels'][_0x1e5dae][_0x3b4b('0x43')]})['catch'](function(_0x31e7e2){if(_0x31e7e2[_0x3b4b('0x44')]===_0x3b4b('0x45')){setTimeout(function(){if(_0xd1fd18[_0x3b4b('0x3f')][_0x1e5dae]){delete _0xd1fd18[_0x3b4b('0x3f')][_0x1e5dae];logger[_0x3b4b('0x46')](_0x3b4b('0x47'),_0x1e5dae,util[_0x3b4b('0x48')](_0x31e7e2,{'showHidden':![],'depth':null}));}if(_0xd1fd18[_0x3b4b('0x10')][_0x1e5dae]){delete _0xd1fd18[_0x3b4b('0x10')][_0x1e5dae];logger['error'](_0x3b4b('0x49'),_0x1e5dae,util[_0x3b4b('0x48')](_0x31e7e2,{'showHidden':![],'depth':null}));}if(_0xd1fd18['variables'][_0x1e5dae]){delete _0xd1fd18[_0x3b4b('0x17')][_0x1e5dae];logger['error']('[%s][voiceQueueReport][checkVariables]',_0x1e5dae,util[_0x3b4b('0x48')](_0x31e7e2,{'showHidden':![],'depth':null}));}},0x1f40);}});}});}}};VoiceQueueReport[_0x3b4b('0xc')][_0x3b4b('0x2c')]=function(){logger['error'](_0x3b4b('0x4a'));clearChannels(this[_0x3b4b('0x3f')]);this[_0x3b4b('0x4b')](this[_0x3b4b('0x10')]);clearAgentBooked(this['agents']);clearVoiceQueues(this[_0x3b4b('0x14')]);clearCampaigns(this[_0x3b4b('0x15')]);this['summary']=initializeSummary();};VoiceQueueReport['prototype'][_0x3b4b('0x4b')]=function(_0x38e728){var _0x139d7a=this;if(!_[_0x3b4b('0x35')](_0x38e728)){for(var _0x12e94e in _0x38e728){if(_0x38e728['hasOwnProperty'](_0x12e94e)){_0x139d7a[_0x3b4b('0x4c')](_0x38e728[_0x12e94e],_0x3b4b('0x4d'));delete _0x38e728[_0x12e94e];}}}};VoiceQueueReport['prototype'][_0x3b4b('0x4e')]=function(_0x45879e,_0x5ebd91,_0x4ee287){io['to'](_0x45879e)[_0x3b4b('0x4e')](_0x5ebd91,_0x4ee287);};VoiceQueueReport[_0x3b4b('0xc')][_0x3b4b('0x4f')]=function(_0x24c817,_0x15513f){logger['debug'](_0x3b4b('0x50')+_0x15513f+_0x3b4b('0x51'),_0x24c817[_0x3b4b('0x52')],util[_0x3b4b('0x48')](_0x24c817,{'showHidden':![],'depth':null}));this['emit'](util[_0x3b4b('0x53')](_0x3b4b('0x54'),_0x24c817[_0x3b4b('0x55')]),_0x3b4b('0x56'),_0x24c817);io[_0x3b4b('0x4e')](_0x3b4b('0x57'),_0x24c817);};VoiceQueueReport[_0x3b4b('0xc')][_0x3b4b('0x4c')]=function(_0x444262,_0x5e3ffd){logger['debug']('[%s][voiceQueueReport]['+_0x5e3ffd+_0x3b4b('0x58'),_0x444262[_0x3b4b('0x52')],util[_0x3b4b('0x48')](_0x444262,{'showHidden':![],'depth':null}));if(_0x444262[_0x3b4b('0x59')]==='ATTENDEDTRANSFER'){return;}this[_0x3b4b('0x4e')](util[_0x3b4b('0x53')]('voice:queue:%s',_0x444262['queue']),_0x3b4b('0x5a'),_0x444262);io[_0x3b4b('0x4e')](_0x3b4b('0x5b'),_0x444262);};VoiceQueueReport['prototype'][_0x3b4b('0x5c')]=function(_0x562016){if(_0x562016['type']===_0x3b4b('0x5d')){logger['debug'](_0x3b4b('0x5e'),util['inspect'](_0x562016,{'showHidden':![],'depth':null}));this[_0x3b4b('0x4e')](util[_0x3b4b('0x53')](_0x3b4b('0x54'),_0x562016[_0x3b4b('0x5f')]),_0x3b4b('0x60'),_0x562016);}};VoiceQueueReport[_0x3b4b('0xc')][_0x3b4b('0x61')]=function(_0x40e2fe){return _0x40e2fe!==null&&!_[_0x3b4b('0x62')](_0x40e2fe);};VoiceQueueReport[_0x3b4b('0xc')]['loopQueueShow']=function(){var _0x54e524=this;setInterval(function(){_0x54e524[_0x3b4b('0x3e')]();ami[_0x3b4b('0x41')]({'action':_0x3b4b('0x63')})['catch'](function(_0x1c3e28){logger['error'](_0x3b4b('0x64'),util[_0x3b4b('0x48')](_0x1c3e28,{'showHidden':![],'depth':null}));});},0x2710);};VoiceQueueReport[_0x3b4b('0xc')][_0x3b4b('0x65')]=function(){var _0x14ac2a=this;setInterval(function(){if(!_0x14ac2a['summary'][_0x3b4b('0x66')]){return ami[_0x3b4b('0x41')]({'action':_0x3b4b('0x18')})[_0x3b4b('0x67')](function(_0x4d1913){_0x14ac2a[_0x3b4b('0x16')]['id']=_0x4d1913['actionid'];_0x14ac2a[_0x3b4b('0x16')][_0x3b4b('0x66')]=!![];_0x14ac2a[_0x3b4b('0x16')][_0x3b4b('0x68')][_0x4d1913['actionid']]={};})[_0x3b4b('0x69')](function(_0x3e801e){logger['error'](_0x3b4b('0x6a'),util[_0x3b4b('0x48')](_0x3e801e,{'showHidden':![],'depth':null}));});}},0x3e8);};VoiceQueueReport['prototype']['createQueueSummaryReport']=function(_0x1f28dc,_0x458b68){var _0x15c62a;if(this[_0x3b4b('0x16')]&&this['summary']['queues']&&this['summary'][_0x3b4b('0x63')][_0x1f28dc['name']]){_0x15c62a=this[_0x3b4b('0x16')]['queues'][_0x1f28dc['name']]['summaryEvent'];}var _0x5c80f8=new VoiceQueueSummary(_0x1f28dc);return _0x5c80f8[_0x3b4b('0x6b')](_0x458b68[_0x3b4b('0x12')],this[_0x3b4b('0x12')],_0x15c62a,this[_0x3b4b('0x11')][_0x3b4b('0x3f')]);};VoiceQueueReport[_0x3b4b('0xc')]['handleInboundQueueSummaryReport']=function(_0x5b0026,_0x3e5fc7){var _0x4241dd=this[_0x3b4b('0x6c')](_0x5b0026,_0x3e5fc7);var _0x212e11=![];_0x212e11=_0x4241dd['compareToInboundQueue'](_0x5b0026);if(_0x212e11){Object['assign'](_0x5b0026,_0x4241dd);this['realtime'][_0x3b4b('0x14')][_0x5b0026['name']]=_0x5b0026;this[_0x3b4b('0x5c')](_0x4241dd);}};VoiceQueueReport[_0x3b4b('0xc')][_0x3b4b('0x6d')]=function(_0x395c99){var _0x381faf=null;var _0x12e40b=this[_0x3b4b('0x16')]['id'];if(this[_0x3b4b('0x16')]['queuestatus'][_0x12e40b]){_0x381faf=this[_0x3b4b('0x16')][_0x3b4b('0x68')][_0x12e40b][_0x395c99[_0x3b4b('0x6e')]];}if(!_0x381faf){this[_0x3b4b('0x16')]=initializeSummary();return;}var _0x72f3f2=this['voiceQueues'][_0x381faf[_0x3b4b('0x55')]];if(_0x72f3f2['type']==='inbound'){this[_0x3b4b('0x6f')](_0x72f3f2,_0x381faf);}else if(_0x72f3f2[_0x3b4b('0x70')]===_0x3b4b('0x71')){var _0x3a7694=this['createQueueSummaryReport'](_0x72f3f2,_0x381faf);ami[_0x3b4b('0x4e')](_0x3b4b('0x72'),_0x3a7694);}this['summary'][_0x3b4b('0x73')]-=0x1;var _0x42e776=this[_0x3b4b('0x16')][_0x3b4b('0x73')]>0x0?!![]:![];if(!_0x42e776){return this[_0x3b4b('0x74')](this['summary'][_0x3b4b('0x75')]);}};VoiceQueueReport[_0x3b4b('0xc')][_0x3b4b('0x1c')]=function(_0x269f83){var _0x551533=this[_0x3b4b('0x16')]['id'];if(this[_0x3b4b('0x16')]['queuestatus'][_0x551533]&&this[_0x3b4b('0x16')][_0x3b4b('0x68')][_0x551533][_0x269f83[_0x3b4b('0x6e')]]){this[_0x3b4b('0x16')][_0x3b4b('0x68')][_0x551533][_0x269f83[_0x3b4b('0x6e')]][_0x3b4b('0x12')]['push'](_0x269f83);}};VoiceQueueReport[_0x3b4b('0xc')][_0x3b4b('0x19')]=function(_0x100f8e){var _0x239907=this;try{if(this['isNotNull'](_0x100f8e)&&this['isNotNull'](_0x100f8e[_0x3b4b('0x55')])){logger['debug'](_0x3b4b('0x76'),util['inspect'](_0x100f8e,{'showHidden':![],'depth':null}));var _0x4d9410=this[_0x3b4b('0x14')][_0x100f8e['queue']];if(_0x4d9410){logger['debug'](_0x3b4b('0x77'),_0x4d9410['name']);this[_0x3b4b('0x16')][_0x3b4b('0x63')][_0x4d9410[_0x3b4b('0x5f')]]={'summaryEvent':_0x100f8e};this['summary']['statusRequests']+=0x1;return ami[_0x3b4b('0x41')]({'action':_0x3b4b('0x68'),'queue':_0x4d9410[_0x3b4b('0x5f')]})[_0x3b4b('0x67')](function(_0xbd29ed){if(!_0x239907['summary'][_0x3b4b('0x68')][_0x100f8e[_0x3b4b('0x6e')]]){_0x239907[_0x3b4b('0x16')]['queuestatus'][_0x100f8e[_0x3b4b('0x6e')]]={};}_0x239907[_0x3b4b('0x16')][_0x3b4b('0x68')][_0x100f8e['actionid']][_0xbd29ed[_0x3b4b('0x6e')]]={'queue':_0x4d9410['name'],'agents':[]};})[_0x3b4b('0x69')](function(_0x4b76c5){throw _0x4b76c5;});}}}catch(_0x2e31bf){logger[_0x3b4b('0x46')](_0x3b4b('0x6a'),util['inspect'](_0x2e31bf,{'showHidden':![],'depth':null}));}};VoiceQueueReport['prototype'][_0x3b4b('0x74')]=function(_0x477944){if(this[_0x3b4b('0x16')][_0x3b4b('0x73')]>0x0){this[_0x3b4b('0x16')]['completeEvent']=_0x477944;return;}logger[_0x3b4b('0x78')]('[voiceQueueReport][queuesummarycomplete]\x20event:',util[_0x3b4b('0x48')](_0x477944,{'showHidden':![],'depth':null}));this[_0x3b4b('0x16')]=initializeSummary();ami['emit'](_0x3b4b('0x79'),{});};VoiceQueueReport[_0x3b4b('0xc')][_0x3b4b('0x1f')]=function(_0x1b6251){try{if(this[_0x3b4b('0x61')](_0x1b6251)){logger[_0x3b4b('0x78')](_0x3b4b('0x7a'),_0x1b6251[_0x3b4b('0x52')],util[_0x3b4b('0x48')](_0x1b6251,{'showHidden':![],'depth':null}));if(_[_0x3b4b('0x62')](this['queueReports'][_0x1b6251[_0x3b4b('0x52')]])){this[_0x3b4b('0x10')][_0x1b6251['uniqueid']]=[];}if(_[_0x3b4b('0x62')](this['channels'][_0x1b6251['uniqueid']])){this['channels'][_0x1b6251['uniqueid']]={};}var _0x2072d4=new QueueReport();_0x2072d4[_0x3b4b('0x55')]=_0x1b6251[_0x3b4b('0x55')];_0x2072d4['type']=this[_0x3b4b('0x14')][_0x2072d4[_0x3b4b('0x55')]]&&this[_0x3b4b('0x14')][_0x2072d4['queue']]['type']?this['voiceQueues'][_0x2072d4['queue']][_0x3b4b('0x70')]||_0x3b4b('0x5d'):'inbound';_0x2072d4[_0x3b4b('0x7b')]=moment()[_0x3b4b('0x53')](_0x3b4b('0x7c'));_0x2072d4['position']=_0x1b6251[_0x3b4b('0x7d')];_0x2072d4[_0x3b4b('0x7e')]=_0x1b6251['count'];_0x2072d4[_0x3b4b('0x52')]=_0x1b6251[_0x3b4b('0x52')];logger[_0x3b4b('0x7f')]('[voiceQueueReport][queuecallerjoin]\x20name:%s\x20type:%s',_0x2072d4[_0x3b4b('0x55')],_0x2072d4[_0x3b4b('0x70')]);Object[_0x3b4b('0x80')](_0x2072d4,_[_0x3b4b('0x81')](_0x1b6251,_[_0x3b4b('0x82')](_0x2072d4)));this['queueReports'][_0x1b6251['uniqueid']][_0x3b4b('0x83')](_0x2072d4);this[_0x3b4b('0x3f')][_0x1b6251[_0x3b4b('0x52')]]=_0x2072d4;this[_0x3b4b('0x4f')](_0x2072d4,_0x3b4b('0x1e'));}}catch(_0x315ab6){logger[_0x3b4b('0x46')]('[%s][voiceQueueReport][queuecallerjoin]',_0x1b6251[_0x3b4b('0x52')],util[_0x3b4b('0x48')](_0x315ab6,{'showHidden':![],'depth':null}));}};VoiceQueueReport[_0x3b4b('0xc')][_0x3b4b('0x21')]=function(_0x3131dc){try{if(this[_0x3b4b('0x61')](_0x3131dc)){logger[_0x3b4b('0x78')](_0x3b4b('0x84'),_0x3131dc[_0x3b4b('0x52')],util[_0x3b4b('0x48')](_0x3131dc,{'showHidden':![],'depth':null}));if(this[_0x3b4b('0x10')][_0x3131dc['uniqueid']]){var _0x11d5bf=_[_0x3b4b('0x85')](this[_0x3b4b('0x10')][_0x3131dc[_0x3b4b('0x52')]]);_0x11d5bf[_0x3b4b('0x3d')]=![];_0x11d5bf[_0x3b4b('0x86')]=null;_0x11d5bf[_0x3b4b('0x87')]=_0x3131dc[_0x3b4b('0x87')];_0x11d5bf['originalposition']=_0x3131dc[_0x3b4b('0x88')];_0x11d5bf[_0x3b4b('0x20')]=!![];_0x11d5bf[_0x3b4b('0x89')]=moment()['format'](_0x3b4b('0x7c'));_0x11d5bf['queuecallerexitreason']=_0x3b4b('0x8a');_0x11d5bf[_0x3b4b('0x8b')]=null;logger[_0x3b4b('0x7f')](_0x3b4b('0x8c'),_0x11d5bf[_0x3b4b('0x55')],_0x11d5bf[_0x3b4b('0x70')]);this[_0x3b4b('0x3f')][_0x3131dc['uniqueid']]=_0x11d5bf;this['emitVoiceQueueChannelRemove'](_0x11d5bf,_0x3b4b('0x20'));}}}catch(_0x54e114){logger[_0x3b4b('0x46')](_0x3b4b('0x84'),_0x3131dc[_0x3b4b('0x52')],util[_0x3b4b('0x48')](_0x54e114,{'showHidden':![],'depth':null}));}};VoiceQueueReport[_0x3b4b('0xc')]['syncQueueCallerLeave']=function(_0x13544a){try{if(this[_0x3b4b('0x61')](_0x13544a)){logger[_0x3b4b('0x78')](_0x3b4b('0x8d'),_0x13544a[_0x3b4b('0x52')],util['inspect'](_0x13544a,{'showHidden':![],'depth':null}));if(this[_0x3b4b('0x10')][_0x13544a['uniqueid']]){var _0x5a8532=_['last'](this[_0x3b4b('0x10')][_0x13544a['uniqueid']]);_0x5a8532['queuecallerleaveAt']=moment()['format'](_0x3b4b('0x7c'));_0x5a8532[_0x3b4b('0x8e')]=_0x13544a[_0x3b4b('0x8e')];_0x5a8532[_0x3b4b('0x8f')]=_0x13544a[_0x3b4b('0x8f')];logger['info'](_0x3b4b('0x90'),_0x5a8532['queue'],_0x5a8532['type'],_0x13544a[_0x3b4b('0x8e')],_0x13544a[_0x3b4b('0x8f')]);this[_0x3b4b('0x3f')][_0x13544a['uniqueid']]=_0x5a8532;this[_0x3b4b('0x4f')](_0x5a8532,_0x3b4b('0x22'));}}}catch(_0x12817d){logger[_0x3b4b('0x46')](_0x3b4b('0x8d'),_0x13544a[_0x3b4b('0x52')],util[_0x3b4b('0x48')](_0x12817d,{'showHidden':![],'depth':null}));}};VoiceQueueReport[_0x3b4b('0xc')][_0x3b4b('0x26')]=function(_0x3c95c4){try{if(this['isNotNull'](_0x3c95c4)){logger[_0x3b4b('0x78')](_0x3b4b('0x91'),_0x3c95c4[_0x3b4b('0x52')],util['inspect'](_0x3c95c4,{'showHidden':![],'depth':null}));if(this[_0x3b4b('0x10')][_0x3c95c4[_0x3b4b('0x52')]]){var _0x3df7ee=_[_0x3b4b('0x85')](this['queueReports'][_0x3c95c4[_0x3b4b('0x52')]]);_0x3df7ee[_0x3b4b('0x3d')]=!![];_0x3df7ee[_0x3b4b('0x59')]=_0x3b4b('0x92');logger[_0x3b4b('0x7f')](_0x3b4b('0x93'),_0x3df7ee[_0x3b4b('0x55')],_0x3df7ee[_0x3b4b('0x70')]);}}}catch(_0x1884d2){logger[_0x3b4b('0x46')](_0x3b4b('0x91'),_0x3c95c4[_0x3b4b('0x52')],util[_0x3b4b('0x48')](_0x1884d2,{'showHidden':![],'depth':null}));}};VoiceQueueReport[_0x3b4b('0xc')][_0x3b4b('0x24')]=function(_0x17892a){try{if(this['isNotNull'](_0x17892a)){logger[_0x3b4b('0x78')]('[%s][voiceQueueReport][agentcomplete]',_0x17892a[_0x3b4b('0x52')],util['inspect'](_0x17892a,{'showHidden':![],'depth':null}));if(this[_0x3b4b('0x10')][_0x17892a[_0x3b4b('0x52')]]){var _0x5d6cad=_[_0x3b4b('0x85')](this[_0x3b4b('0x10')][_0x17892a[_0x3b4b('0x52')]]);_0x5d6cad[_0x3b4b('0x20')]=![];_0x5d6cad[_0x3b4b('0x89')]=null;_0x5d6cad[_0x3b4b('0x94')]=!![];_0x5d6cad[_0x3b4b('0x8b')]=_0x17892a['membername'];_0x5d6cad[_0x3b4b('0x87')]=_0x17892a[_0x3b4b('0x87')];_0x5d6cad[_0x3b4b('0x3d')]=!![];_0x5d6cad[_0x3b4b('0x3c')]=![];_0x5d6cad[_0x3b4b('0x95')]=null;if(!_0x5d6cad[_0x3b4b('0x96')]){if(_0x17892a[_0x3b4b('0x97')]==_0x3b4b('0x96')){_0x5d6cad[_0x3b4b('0x59')]='COMPLETED';logger[_0x3b4b('0x7f')]('[voiceQueueReport][agentcomplete]\x20name:%s\x20type:%s\x20queuecallerexitreason:COMPLETED',_0x5d6cad[_0x3b4b('0x55')],_0x5d6cad[_0x3b4b('0x70')]);}else{if(_[_0x3b4b('0x98')](_0x17892a['channel'][_0x3b4b('0x99')](),'local/')){if(this['queueReports'][_0x17892a[_0x3b4b('0x9a')]]){var _0xeab480=_[_0x3b4b('0x85')](this[_0x3b4b('0x10')][_0x17892a[_0x3b4b('0x9a')]]);_0xeab480[_0x3b4b('0x3d')]=![];_0xeab480[_0x3b4b('0x3c')]=!![];_0xeab480[_0x3b4b('0x95')]=moment(_0x5d6cad[_0x3b4b('0x7b')])[_0x3b4b('0x9b')](_0x17892a[_0x3b4b('0x87')],'seconds')[_0x3b4b('0x53')]('YYYY-MM-DD\x20HH:mm:ss');_0xeab480[_0x3b4b('0x59')]='FORWARDTRANSFER';_0xeab480[_0x3b4b('0x96')]=!![];_0xeab480[_0x3b4b('0x9c')]=_0x3b4b('0x9d');_0xeab480[_0x3b4b('0x9e')]=_0x17892a['destexten'];_0xeab480['transferuniqueid']=_0x17892a[_0x3b4b('0x52')];logger[_0x3b4b('0x7f')](_0x3b4b('0x9f'),_0xeab480[_0x3b4b('0x55')],_0xeab480['type']);var _0x2bd957=this[_0x3b4b('0x10')][_0x17892a[_0x3b4b('0x9a')]];this[_0x3b4b('0x10')][_0x17892a[_0x3b4b('0x9a')]]=this[_0x3b4b('0x10')][_0x17892a[_0x3b4b('0x52')]];this[_0x3b4b('0x10')][_0x17892a['uniqueid']]=_0x2bd957;}}else{_0x5d6cad['queuecallerexitreason']='COMPLETEDBY'+_0x17892a['reason'][_0x3b4b('0xa0')]();logger[_0x3b4b('0x7f')]('[voiceQueueReport][agentcomplete]\x20name:%s\x20type:%s\x20queuecallerexitreason:%s',_0x5d6cad[_0x3b4b('0x55')],_0x5d6cad[_0x3b4b('0x70')],_0x5d6cad[_0x3b4b('0x59')]);}}}this['channels'][_0x17892a['uniqueid']]=_0x5d6cad;}}}catch(_0x1a2325){logger[_0x3b4b('0x46')](_0x3b4b('0xa1'),_0x17892a['uniqueid'],util[_0x3b4b('0x48')](_0x1a2325,{'showHidden':![],'depth':null}));}};VoiceQueueReport['prototype'][_0x3b4b('0x28')]=function(_0x1dd744){try{if(this['isNotNull'](_0x1dd744)){logger[_0x3b4b('0x78')](_0x3b4b('0xa2'),_0x1dd744[_0x3b4b('0x52')],util['inspect'](_0x1dd744,{'showHidden':![],'depth':null}));this['addVariable'](_0x1dd744['uniqueid'],_[_0x3b4b('0x82')](_0x1dd744[_0x3b4b('0xa3')])[0x0],_0x1dd744[_0x3b4b('0xa4')]);if(this[_0x3b4b('0x10')][_0x1dd744[_0x3b4b('0x52')]]){var _0x31f98c=_[_0x3b4b('0x85')](this[_0x3b4b('0x10')][_0x1dd744[_0x3b4b('0x52')]]);if(_0x31f98c){if(this[_0x3b4b('0x61')](_0x1dd744[_0x3b4b('0xa3')])&&this[_0x3b4b('0x61')](_0x1dd744[_0x3b4b('0xa3')][_0x3b4b('0x68')])){switch(_0x1dd744[_0x3b4b('0xa4')]){case'CONTINUE':_0x31f98c['queuecallerexit']=![];_0x31f98c['queuecallerexitAt']=null;break;case _0x3b4b('0xa5'):_0x31f98c[_0x3b4b('0xa6')]=_0x3b4b('0xa7');_0x31f98c['queuecallerexit']=!![];_0x31f98c[_0x3b4b('0x95')]=moment()['format'](_0x3b4b('0x7c'));_0x31f98c['queuecallerleaveAt']=moment()['format'](_0x3b4b('0x7c'));logger[_0x3b4b('0x78')](_0x3b4b('0xa8'),_0x1dd744['uniqueid'],util[_0x3b4b('0x48')](_0x31f98c,{'showHidden':![],'depth':null}));ami[_0x3b4b('0x4e')](_0x3b4b('0xa9'),_0x31f98c);break;default:_0x31f98c[_0x3b4b('0x3c')]=!![];_0x31f98c[_0x3b4b('0x95')]=moment()[_0x3b4b('0x53')](_0x3b4b('0x7c'));_0x31f98c[_0x3b4b('0xaa')]=moment()[_0x3b4b('0x53')](_0x3b4b('0x7c'));}_0x31f98c[_0x3b4b('0x20')]=![];_0x31f98c[_0x3b4b('0x89')]=null;_0x31f98c[_0x3b4b('0x59')]=_0x1dd744[_0x3b4b('0xa4')];this[_0x3b4b('0x3f')][_0x1dd744[_0x3b4b('0x52')]]=_0x31f98c;this[_0x3b4b('0x4c')](_0x31f98c,_0x3b4b('0x27'));}else if(this['isNotNull'](_0x1dd744[_0x3b4b('0xa3')])&&this[_0x3b4b('0x61')](_0x1dd744[_0x3b4b('0xa3')][_0x3b4b('0xab')])){if(!_0x31f98c['queuecallerabandon']){_0x31f98c[_0x3b4b('0x3c')]=!![];_0x31f98c['queuecallerexitAt']=moment()[_0x3b4b('0x53')](_0x3b4b('0x7c'));_0x31f98c[_0x3b4b('0x59')]='EXITWITHKEY';_0x31f98c[_0x3b4b('0xaa')]=moment()['format'](_0x3b4b('0x7c'));this['channels'][_0x1dd744[_0x3b4b('0x52')]]=_0x31f98c;}}logger['info'](_0x3b4b('0xac'),_0x1dd744[_0x3b4b('0x52')],_0x31f98c[_0x3b4b('0x55')],_0x31f98c['type'],_[_0x3b4b('0x82')](_0x1dd744[_0x3b4b('0xa3')])[0x0],_0x1dd744[_0x3b4b('0xa4')]);_0x31f98c['variables']=this[_0x3b4b('0x17')][_0x1dd744[_0x3b4b('0x52')]];}}}}catch(_0xcd4ff){logger[_0x3b4b('0x46')](_0x3b4b('0xa2'),_0x1dd744[_0x3b4b('0x52')],util['inspect'](_0xcd4ff,{'showHidden':![],'depth':null}));}};VoiceQueueReport['prototype']['addVariable']=function(_0x44e10b,_0x462e36,_0x144821){var _0x1d0bfe=[_0x3b4b('0xad'),_0x3b4b('0xae'),_0x3b4b('0xaf'),_0x3b4b('0xb0'),'rtpaudioqosloss','rtpaudioqoslossbridged',_0x3b4b('0xb1'),_0x3b4b('0xb2'),_0x3b4b('0xb3'),'sipuri',_0x3b4b('0xb4'),_0x3b4b('0xb5'),_0x3b4b('0xb6'),_0x3b4b('0xb7'),_0x3b4b('0xb8'),_0x3b4b('0xb9'),_0x3b4b('0xba'),_0x3b4b('0xbb'),_0x3b4b('0xbc')];if(!_[_0x3b4b('0xbd')](_0x462e36)&&!_[_0x3b4b('0xbe')](_0x1d0bfe,_0x462e36)){if(_['isUndefined'](this['variables'][_0x44e10b])){this[_0x3b4b('0x17')][_0x44e10b]={};}this[_0x3b4b('0x17')][_0x44e10b][_0x462e36]=_0x144821;}};VoiceQueueReport['prototype']['handleHangup']=function(_0x59e245,_0x321d41,_0x5e7cd2){try{var _0x5702e5={};if(this['queueReports'][_0x59e245]){for(var _0x14fc2c=0x0;_0x14fc2c{delete this[_0x3b4b('0x3f')][_0x35bc86];},_0x295b7f);}};module[_0x3b4b('0xf2')]=VoiceQueueReport; \ No newline at end of file +var _0x3429=['queuecallerjoinAt','seconds','FORWARDTRANSFER','transferexten','transferuniqueid','[voiceQueueReport][agentcomplete]\x20name:%s\x20type:%s\x20queuecallerexitreason:FORWARDTRANSFER','COMPLETEDBY','toUpperCase','[voiceQueueReport][agentcomplete]\x20name:%s\x20type:%s\x20queuecallerexitreason:%s','syncVarSet','[%s][voiceQueueReport][varset]','addVariable','value','variable','CONTINUE','queueposition','EXITWITHKEY','[%s][voiceQueueReport][varset]\x20name:%s\x20type:%s\x20variable:%s\x20value:%s','rtpaudioqos','rtpaudioqosbridged','rtpaudioqosjitter','rtpaudioqosjitterbridged','rtpaudioqosloss','rtpaudioqoslossbridged','rtpaudioqosrtt','sipcallid','bridgepeer','membercalls','memberdynamic','memberinterface','memberlastcall','memberpenalty','memberrealtime','includes','handleHangup','sumHoldTime','diff','ATTENDEDTRANSFER','length','milliseconds','sumBillable','unmanaged','lastevent','custom:queuecallerunmanaged','abandoned','[%s][voiceQueueReport][hangup]\x20sending\x20queuecallerabandon\x20event:','custom:queuecallerabandon','sumDuration','[%s][voiceQueueReport][hangup]\x20name:%s\x20type:%s\x20reason:%s','hangup','[%s][voiceQueueReport][hangup]\x20sending\x20voiceQueueReport\x20event:','custom:voiceQueueReport','deleteChannelAfterTimeout','[%s][voiceQueueReport][handleHangup]','[%s][voiceQueueReport][hangup]','cause-txt','cause','transferid','[%s][voiceQueueReport][syncHangup]\x20No\x20available\x20data\x20in\x20queueReports\x20structure:\x20clear\x20action\x20in\x20variablea\x20and\x20channels\x20structures\x20needed','[%s][voiceQueueReport][attendedtransfer]','transfereeuniqueid','secondtransfererexten','secondtransfereruniqueid','transfertype','ATTENDED','[%s][voiceQueueReport][attendedTransfer]\x20name:%s\x20type:%s\x20transferexten:%s\x20transferuniqueid:%s','transfertargetuniqueid','origtransfererexten','origtransfereruniqueid','syncBlindTransfer','[%s][voiceQueueReport][blindtransfer]','BLIND','[%s][voiceQueueReport][blindTransfer]\x20name:%s\x20type:%s\x20transferexten:%s\x20transferuniqueid:%s','BlindTransfer','context','[%s][voiceQueueReport][musiconholdstart]','mohstarttime','[%s][voiceQueueReport][musiconholdstart]\x20mohstarttime:%s','[%s][voiceQueueReport][musiconholdstop]','mohtime','[%s][voiceQueueReport][musiconholdstop]\x20mohtime:%s','syncNewExten','[%s][voiceQueueReport][newexten]\x20event:','application','set','applicationdata','cdr(','[%s][voiceQueueReport][newexten]\x20application:%s\x20appdata:%s','split','match','[%s][voiceQueueReport][newexten]','exports','lodash','util','ioredis','../../../config/environment','../../../config/logger','../ami','../model/voiceQueueSummary','redis','defaults','localhost','socket.io-emitter','prototype','tail','finally','sequence','realtime','agents','channels','queueChannels','voiceQueues','summary','variables','bind','syncQueueSummaryComplete','queuemember','syncQueueMember','queuestatuscomplete','syncQueueStatusComplete','queuecallerabandon','syncQueueCallerAbandon','queuecallerleave','syncQueueCallerLeave','agentcomplete','syncAgentComplete','agentconnect','syncAgentConnect','varset','syncHangup','fullybooted','syncFullyBooted','musiconholdstart','syncMusicOnHoldStart','syncMusicOnHoldStop','attendedtransfer','syncAttendedTransfer','blindtransfer','loopQueueSummary','loopQueueShow','isEmpty','hasOwnProperty','originated','talking','pTalking','waiting','queueStatusComplete','unlockRR','queuecallercomplete','clearZombieChannels','switch','enqueue','isNil','status','catch','No\x20such\x20channel','[%s][voiceQueueReport][checkChannel]','inspect','queueReports','error','[%s][voiceQueueReport][checkVariables]','[FullyBooted]\x20clear\x20realtime','clearQueueReport','emitVoiceQueueChannelRemove','clearqueuereport','emit','[%s][voiceQueueReport][',']\x20sending\x20voice_queue_channel:save\x20event:','uniqueid','voice:queue:%s','queue','voice_queue_channel:save','voice_queue_presence:save','debug',']\x20sending\x20voice_queue_channel:remove\x20event:','queuecallerexitreason','format','voice_queue_presence:remove','emitInboundVoiceQueueSummary','type','inbound','[voiceQueueReport][queuesummary]\x20sending\x20voice_queue:save\x20event:','name','voice_queue:save','isUndefined','[voiceQueueReport][queues]','isRunning','Action','then','actionid','queuestatus','[voiceQueueReport][queuesummary]','createQueueSummaryReport','queues','summaryEvent','createReport','compareToInboundQueue','assign','statusRequests','completeEvent','syncQueueSummary','isNotNull','[voiceQueueReport][queuesummary]\x20event:','[voiceQueueReport][queuesummary]\x20name:%s','syncQueueCallerJoin','YYYY-MM-DD\x20HH:mm:ss','position','count','info','[voiceQueueReport][queuecallerjoin]\x20name:%s\x20type:%s','pick','keys','push','emitVoiceQueueChannelSave','queuecallerjoin','[%s][voiceQueueReport][queuecallerjoin]','[%s][voiceQueueReport][queuecallerabandon]','last','queuecallercompleteAt','holdtime','originalposition','queuecallerabandonAt','ABANDONED','[voiceQueueReport][queuecallerabandon]\x20name:%s\x20type:%s','[%s][voiceQueueReport][queuecallerleave]','queuecallerleaveAt','connectedlinenum','connectedlinename','[%s][voiceQueueReport][agentconnect]','COMPLETEDBYAGENT','[voiceQueueReport][agentconnect]\x20name:%s\x20type:%s\x20queuecallerexitreason:COMPLETEDBYAGENT','[%s][voiceQueueReport][agentcomplete]','assigned','lastAssignedTo','membername','queuecallerexit','transfer','reason','COMPLETED','startsWith','channel','toLowerCase','local/','linkedid','queuecallerexitAt'];(function(_0x7be615,_0x140448){var _0x3db4f0=function(_0x49458a){while(--_0x49458a){_0x7be615['push'](_0x7be615['shift']());}};_0x3db4f0(++_0x140448);}(_0x3429,0x151));var _0x9342=function(_0x21a31d,_0xbbf356){_0x21a31d=_0x21a31d-0x0;var _0x51d847=_0x3429[_0x21a31d];return _0x51d847;};'use strict';var _=require(_0x9342('0x0'));var moment=require('moment');var util=require(_0x9342('0x1'));var Redis=require(_0x9342('0x2'));var config=require(_0x9342('0x3'));var logger=require(_0x9342('0x4'))('ami');var ami=require(_0x9342('0x5'));var QueueReport=require('../model/queueReport');var VoiceQueueSummary=require(_0x9342('0x6'));config[_0x9342('0x7')]=_[_0x9342('0x8')](config[_0x9342('0x7')],{'host':_0x9342('0x9'),'port':0x18eb});var io=require(_0x9342('0xa'))(new Redis(config[_0x9342('0x7')]));var Sequence=function(){};Sequence[_0x9342('0xb')]['enqueue']=function(_0x2f69a2){this[_0x9342('0xc')]=this[_0x9342('0xc')]?this[_0x9342('0xc')][_0x9342('0xd')](_0x2f69a2):_0x2f69a2();};function VoiceQueueReport(_0x1d1b2e){this[_0x9342('0xe')]=new Sequence();this['queueReports']={};this[_0x9342('0xf')]=_0x1d1b2e;this[_0x9342('0x10')]=_0x1d1b2e[_0x9342('0x10')];this[_0x9342('0x11')]=_0x1d1b2e[_0x9342('0x12')];this[_0x9342('0x13')]=_0x1d1b2e[_0x9342('0x13')];this['campaigns']=_0x1d1b2e['campaigns'];this[_0x9342('0x14')]=initializeSummary();this[_0x9342('0x15')]={};ami['on']('queuesummary',this['syncQueueSummary'][_0x9342('0x16')](this));ami['on']('queuesummarycomplete',this[_0x9342('0x17')][_0x9342('0x16')](this));ami['on'](_0x9342('0x18'),this[_0x9342('0x19')][_0x9342('0x16')](this));ami['on'](_0x9342('0x1a'),this[_0x9342('0x1b')]['bind'](this));ami['on']('queuecallerjoin',this['syncQueueCallerJoin'][_0x9342('0x16')](this));ami['on'](_0x9342('0x1c'),this[_0x9342('0x1d')][_0x9342('0x16')](this));ami['on'](_0x9342('0x1e'),this[_0x9342('0x1f')]['bind'](this));ami['on'](_0x9342('0x20'),this[_0x9342('0x21')]['bind'](this));ami['on'](_0x9342('0x22'),this[_0x9342('0x23')][_0x9342('0x16')](this));ami['on'](_0x9342('0x24'),this['syncVarSet'][_0x9342('0x16')](this));ami['on']('hangup',this[_0x9342('0x25')][_0x9342('0x16')](this));ami['on'](_0x9342('0x26'),this[_0x9342('0x27')][_0x9342('0x16')](this));ami['on'](_0x9342('0x28'),this[_0x9342('0x29')][_0x9342('0x16')](this));ami['on']('musiconholdstop',this[_0x9342('0x2a')][_0x9342('0x16')](this));ami['on'](_0x9342('0x2b'),this[_0x9342('0x2c')][_0x9342('0x16')](this));ami['on'](_0x9342('0x2d'),this['syncBlindTransfer'][_0x9342('0x16')](this));this[_0x9342('0x2e')]();this[_0x9342('0x2f')]();}function clearChannels(_0x10e670){if(!_[_0x9342('0x30')](_0x10e670)){for(var _0x111714 in _0x10e670){if(_0x10e670[_0x9342('0x31')](_0x111714)){delete _0x10e670[_0x111714];}}}}function clearCampaigns(_0x4ab493){if(!_[_0x9342('0x30')](_0x4ab493)){for(var _0x339ae5 in _0x4ab493){if(_0x4ab493['hasOwnProperty'](_0x339ae5)){_0x4ab493[_0x339ae5][_0x9342('0x32')]=0x0;}}}}function clearVoiceQueues(_0x471a71){if(!_[_0x9342('0x30')](_0x471a71)){for(var _0x43ff72 in _0x471a71){if(_0x471a71[_0x9342('0x31')](_0x43ff72)){_0x471a71[_0x43ff72][_0x9342('0x32')]=0x0;_0x471a71[_0x43ff72][_0x9342('0x33')]=0x0;_0x471a71[_0x43ff72][_0x9342('0x34')]=0x0;_0x471a71[_0x43ff72][_0x9342('0x35')]=0x0;_0x471a71[_0x43ff72][_0x9342('0x36')]=!![];}}}}function clearAgentBooked(_0xe9ac4c){if(!_[_0x9342('0x30')](_0xe9ac4c)){for(var _0x1665d5 in _0xe9ac4c){if(_0xe9ac4c[_0x9342('0x31')](_0x1665d5)){_0xe9ac4c[_0x1665d5][_0x9342('0x37')]=!![];}}}}function initializeSummary(){return{'id':null,'completeEvent':null,'isRunning':![],'queues':{},'queuestatus':{},'statusRequests':0x0};}function hasCallerLeftTheQueue(_0x15b6d6){return _0x15b6d6['queuecallerexit']||_0x15b6d6[_0x9342('0x1c')]||_0x15b6d6[_0x9342('0x38')];}VoiceQueueReport['prototype'][_0x9342('0x39')]=function(){var _0x5ef578=this;for(var _0x339879 in this[_0x9342('0x11')]){if(this['channels'][_0x9342('0x31')](_0x339879)&&!this[_0x9342('0x11')][_0x339879][_0x9342('0x3a')]){this[_0x9342('0xe')][_0x9342('0x3b')](function(){if(!_[_0x9342('0x3c')](_0x5ef578[_0x9342('0x11')][_0x339879])){return ami['Action']({'action':_0x9342('0x3d'),'channel':_0x5ef578['channels'][_0x339879]['channel']})[_0x9342('0x3e')](function(_0x1a2a75){if(_0x1a2a75['message']===_0x9342('0x3f')){setTimeout(function(){if(_0x5ef578[_0x9342('0x11')][_0x339879]){delete _0x5ef578[_0x9342('0x11')][_0x339879];logger['error'](_0x9342('0x40'),_0x339879,util[_0x9342('0x41')](_0x1a2a75,{'showHidden':![],'depth':null}));}if(_0x5ef578[_0x9342('0x42')][_0x339879]){delete _0x5ef578[_0x9342('0x42')][_0x339879];logger[_0x9342('0x43')]('[%s][voiceQueueReport][checkQueueReport]',_0x339879,util[_0x9342('0x41')](_0x1a2a75,{'showHidden':![],'depth':null}));}if(_0x5ef578[_0x9342('0x15')][_0x339879]){delete _0x5ef578[_0x9342('0x15')][_0x339879];logger[_0x9342('0x43')](_0x9342('0x44'),_0x339879,util[_0x9342('0x41')](_0x1a2a75,{'showHidden':![],'depth':null}));}},0x1f40);}});}});}}};VoiceQueueReport[_0x9342('0xb')]['syncFullyBooted']=function(){logger[_0x9342('0x43')](_0x9342('0x45'));clearChannels(this[_0x9342('0x11')]);this[_0x9342('0x46')](this[_0x9342('0x42')]);clearAgentBooked(this[_0x9342('0x10')]);clearVoiceQueues(this['voiceQueues']);clearCampaigns(this['campaigns']);this['summary']=initializeSummary();};VoiceQueueReport[_0x9342('0xb')]['clearQueueReport']=function(_0x585e4d){var _0x2d2742=this;if(!_[_0x9342('0x30')](_0x585e4d)){for(var _0x13f05d in _0x585e4d){if(_0x585e4d['hasOwnProperty'](_0x13f05d)){_0x2d2742[_0x9342('0x47')](_0x585e4d[_0x13f05d],_0x9342('0x48'));delete _0x585e4d[_0x13f05d];}}}};VoiceQueueReport[_0x9342('0xb')]['emit']=function(_0x1c7269,_0x59436c,_0x3af841){io['to'](_0x1c7269)[_0x9342('0x49')](_0x59436c,_0x3af841);};VoiceQueueReport[_0x9342('0xb')]['emitVoiceQueueChannelSave']=function(_0x4998cb,_0x37067c){logger['debug'](_0x9342('0x4a')+_0x37067c+_0x9342('0x4b'),_0x4998cb[_0x9342('0x4c')],util['inspect'](_0x4998cb,{'showHidden':![],'depth':null}));this[_0x9342('0x49')](util['format'](_0x9342('0x4d'),_0x4998cb[_0x9342('0x4e')]),_0x9342('0x4f'),_0x4998cb);io[_0x9342('0x49')](_0x9342('0x50'),_0x4998cb);};VoiceQueueReport[_0x9342('0xb')][_0x9342('0x47')]=function(_0x165c76,_0x174ea0){logger[_0x9342('0x51')](_0x9342('0x4a')+_0x174ea0+_0x9342('0x52'),_0x165c76['uniqueid'],util[_0x9342('0x41')](_0x165c76,{'showHidden':![],'depth':null}));if(_0x165c76[_0x9342('0x53')]==='ATTENDEDTRANSFER'){return;}this[_0x9342('0x49')](util[_0x9342('0x54')](_0x9342('0x4d'),_0x165c76['queue']),'voice_queue_channel:remove',_0x165c76);io[_0x9342('0x49')](_0x9342('0x55'),_0x165c76);};VoiceQueueReport[_0x9342('0xb')][_0x9342('0x56')]=function(_0x438c9c){if(_0x438c9c[_0x9342('0x57')]===_0x9342('0x58')){logger[_0x9342('0x51')](_0x9342('0x59'),util[_0x9342('0x41')](_0x438c9c,{'showHidden':![],'depth':null}));this[_0x9342('0x49')](util[_0x9342('0x54')](_0x9342('0x4d'),_0x438c9c[_0x9342('0x5a')]),_0x9342('0x5b'),_0x438c9c);}};VoiceQueueReport[_0x9342('0xb')]['isNotNull']=function(_0x56a8a6){return _0x56a8a6!==null&&!_[_0x9342('0x5c')](_0x56a8a6);};VoiceQueueReport[_0x9342('0xb')][_0x9342('0x2f')]=function(){var _0x73e3e6=this;setInterval(function(){_0x73e3e6[_0x9342('0x39')]();ami['Action']({'action':'queues'})[_0x9342('0x3e')](function(_0x270654){logger[_0x9342('0x43')](_0x9342('0x5d'),util['inspect'](_0x270654,{'showHidden':![],'depth':null}));});},0x2710);};VoiceQueueReport[_0x9342('0xb')][_0x9342('0x2e')]=function(){var _0x56939d=this;setInterval(function(){if(!_0x56939d[_0x9342('0x14')][_0x9342('0x5e')]){return ami[_0x9342('0x5f')]({'action':'queuesummary'})[_0x9342('0x60')](function(_0x1f6d42){_0x56939d[_0x9342('0x14')]['id']=_0x1f6d42[_0x9342('0x61')];_0x56939d['summary']['isRunning']=!![];_0x56939d['summary'][_0x9342('0x62')][_0x1f6d42['actionid']]={};})[_0x9342('0x3e')](function(_0x30d32f){logger[_0x9342('0x43')](_0x9342('0x63'),util[_0x9342('0x41')](_0x30d32f,{'showHidden':![],'depth':null}));});}},0x3e8);};VoiceQueueReport['prototype'][_0x9342('0x64')]=function(_0x395cf2,_0x18d2fd){var _0x23e982;if(this['summary']&&this[_0x9342('0x14')][_0x9342('0x65')]&&this[_0x9342('0x14')]['queues'][_0x395cf2[_0x9342('0x5a')]]){_0x23e982=this[_0x9342('0x14')][_0x9342('0x65')][_0x395cf2[_0x9342('0x5a')]][_0x9342('0x66')];}var _0x14b631=new VoiceQueueSummary(_0x395cf2);return _0x14b631[_0x9342('0x67')](_0x18d2fd[_0x9342('0x10')],this[_0x9342('0x10')],_0x23e982,this[_0x9342('0xf')]['channels']);};VoiceQueueReport[_0x9342('0xb')]['handleInboundQueueSummaryReport']=function(_0x517f0c,_0x319642){var _0xb2aa8f=this['createQueueSummaryReport'](_0x517f0c,_0x319642);var _0x90bcbc=![];_0x90bcbc=_0xb2aa8f[_0x9342('0x68')](_0x517f0c);if(_0x90bcbc){Object[_0x9342('0x69')](_0x517f0c,_0xb2aa8f);this[_0x9342('0xf')][_0x9342('0x13')][_0x517f0c[_0x9342('0x5a')]]=_0x517f0c;this[_0x9342('0x56')](_0xb2aa8f);}};VoiceQueueReport[_0x9342('0xb')][_0x9342('0x1b')]=function(_0x4f5a4d){var _0x167ebf=null;var _0x31b179=this[_0x9342('0x14')]['id'];if(this[_0x9342('0x14')][_0x9342('0x62')][_0x31b179]){_0x167ebf=this[_0x9342('0x14')][_0x9342('0x62')][_0x31b179][_0x4f5a4d['actionid']];}if(!_0x167ebf){this['summary']=initializeSummary();return;}var _0x1fd674=this[_0x9342('0x13')][_0x167ebf[_0x9342('0x4e')]];if(_0x1fd674[_0x9342('0x57')]===_0x9342('0x58')){this['handleInboundQueueSummaryReport'](_0x1fd674,_0x167ebf);}else if(_0x1fd674[_0x9342('0x57')]==='outbound'){var _0x2184c5=this[_0x9342('0x64')](_0x1fd674,_0x167ebf);ami[_0x9342('0x49')]('custom:queuesummary',_0x2184c5);}this['summary'][_0x9342('0x6a')]-=0x1;var _0x3c623e=this[_0x9342('0x14')][_0x9342('0x6a')]>0x0?!![]:![];if(!_0x3c623e){return this[_0x9342('0x17')](this['summary'][_0x9342('0x6b')]);}};VoiceQueueReport[_0x9342('0xb')]['syncQueueMember']=function(_0x4246e9){var _0x4e5541=this['summary']['id'];if(this[_0x9342('0x14')]['queuestatus'][_0x4e5541]&&this['summary']['queuestatus'][_0x4e5541][_0x4246e9[_0x9342('0x61')]]){this[_0x9342('0x14')]['queuestatus'][_0x4e5541][_0x4246e9[_0x9342('0x61')]][_0x9342('0x10')]['push'](_0x4246e9);}};VoiceQueueReport[_0x9342('0xb')][_0x9342('0x6c')]=function(_0x1f62b8){var _0x52ea35=this;try{if(this['isNotNull'](_0x1f62b8)&&this[_0x9342('0x6d')](_0x1f62b8['queue'])){logger[_0x9342('0x51')](_0x9342('0x6e'),util[_0x9342('0x41')](_0x1f62b8,{'showHidden':![],'depth':null}));var _0x29d3c1=this[_0x9342('0x13')][_0x1f62b8[_0x9342('0x4e')]];if(_0x29d3c1){logger[_0x9342('0x51')](_0x9342('0x6f'),_0x29d3c1['name']);this[_0x9342('0x14')][_0x9342('0x65')][_0x29d3c1['name']]={'summaryEvent':_0x1f62b8};this['summary'][_0x9342('0x6a')]+=0x1;return ami[_0x9342('0x5f')]({'action':_0x9342('0x62'),'queue':_0x29d3c1[_0x9342('0x5a')]})[_0x9342('0x60')](function(_0x9a7dad){if(!_0x52ea35[_0x9342('0x14')][_0x9342('0x62')][_0x1f62b8['actionid']]){_0x52ea35[_0x9342('0x14')][_0x9342('0x62')][_0x1f62b8[_0x9342('0x61')]]={};}_0x52ea35[_0x9342('0x14')]['queuestatus'][_0x1f62b8['actionid']][_0x9a7dad[_0x9342('0x61')]]={'queue':_0x29d3c1[_0x9342('0x5a')],'agents':[]};})['catch'](function(_0x3e3214){throw _0x3e3214;});}}}catch(_0x338b96){logger[_0x9342('0x43')](_0x9342('0x63'),util[_0x9342('0x41')](_0x338b96,{'showHidden':![],'depth':null}));}};VoiceQueueReport[_0x9342('0xb')][_0x9342('0x17')]=function(_0x20d09f){if(this['summary']['statusRequests']>0x0){this[_0x9342('0x14')][_0x9342('0x6b')]=_0x20d09f;return;}logger[_0x9342('0x51')]('[voiceQueueReport][queuesummarycomplete]\x20event:',util[_0x9342('0x41')](_0x20d09f,{'showHidden':![],'depth':null}));this[_0x9342('0x14')]=initializeSummary();ami['emit']('custom:queuesummarycomplete',{});};VoiceQueueReport[_0x9342('0xb')][_0x9342('0x70')]=function(_0x189b9b){try{if(this['isNotNull'](_0x189b9b)){logger[_0x9342('0x51')]('[%s][voiceQueueReport][queuecallerjoin]',_0x189b9b[_0x9342('0x4c')],util[_0x9342('0x41')](_0x189b9b,{'showHidden':![],'depth':null}));if(_[_0x9342('0x5c')](this[_0x9342('0x42')][_0x189b9b[_0x9342('0x4c')]])){this[_0x9342('0x42')][_0x189b9b[_0x9342('0x4c')]]=[];}if(_['isUndefined'](this[_0x9342('0x11')][_0x189b9b[_0x9342('0x4c')]])){this[_0x9342('0x11')][_0x189b9b[_0x9342('0x4c')]]={};}var _0x3a4622=new QueueReport();_0x3a4622[_0x9342('0x4e')]=_0x189b9b[_0x9342('0x4e')];_0x3a4622['type']=this[_0x9342('0x13')][_0x3a4622[_0x9342('0x4e')]]&&this[_0x9342('0x13')][_0x3a4622[_0x9342('0x4e')]]['type']?this[_0x9342('0x13')][_0x3a4622['queue']][_0x9342('0x57')]||_0x9342('0x58'):_0x9342('0x58');_0x3a4622['queuecallerjoinAt']=moment()[_0x9342('0x54')](_0x9342('0x71'));_0x3a4622[_0x9342('0x72')]=_0x189b9b[_0x9342('0x72')];_0x3a4622[_0x9342('0x73')]=_0x189b9b[_0x9342('0x73')];_0x3a4622[_0x9342('0x4c')]=_0x189b9b['uniqueid'];logger[_0x9342('0x74')](_0x9342('0x75'),_0x3a4622['queue'],_0x3a4622[_0x9342('0x57')]);Object[_0x9342('0x69')](_0x3a4622,_[_0x9342('0x76')](_0x189b9b,_[_0x9342('0x77')](_0x3a4622)));this[_0x9342('0x42')][_0x189b9b['uniqueid']][_0x9342('0x78')](_0x3a4622);this[_0x9342('0x11')][_0x189b9b[_0x9342('0x4c')]]=_0x3a4622;this[_0x9342('0x79')](_0x3a4622,_0x9342('0x7a'));}}catch(_0x253fbc){logger['error'](_0x9342('0x7b'),_0x189b9b[_0x9342('0x4c')],util[_0x9342('0x41')](_0x253fbc,{'showHidden':![],'depth':null}));}};VoiceQueueReport[_0x9342('0xb')][_0x9342('0x1d')]=function(_0x6dddf4){try{if(this[_0x9342('0x6d')](_0x6dddf4)){logger[_0x9342('0x51')](_0x9342('0x7c'),_0x6dddf4[_0x9342('0x4c')],util['inspect'](_0x6dddf4,{'showHidden':![],'depth':null}));if(this['queueReports'][_0x6dddf4[_0x9342('0x4c')]]){var _0xedae07=_[_0x9342('0x7d')](this[_0x9342('0x42')][_0x6dddf4['uniqueid']]);_0xedae07['queuecallercomplete']=![];_0xedae07[_0x9342('0x7e')]=null;_0xedae07[_0x9342('0x7f')]=_0x6dddf4['holdtime'];_0xedae07[_0x9342('0x80')]=_0x6dddf4['originalposition'];_0xedae07[_0x9342('0x1c')]=!![];_0xedae07[_0x9342('0x81')]=moment()[_0x9342('0x54')](_0x9342('0x71'));_0xedae07['queuecallerexitreason']=_0x9342('0x82');_0xedae07['lastAssignedTo']=null;logger[_0x9342('0x74')](_0x9342('0x83'),_0xedae07[_0x9342('0x4e')],_0xedae07[_0x9342('0x57')]);this['channels'][_0x6dddf4[_0x9342('0x4c')]]=_0xedae07;this['emitVoiceQueueChannelRemove'](_0xedae07,_0x9342('0x1c'));}}}catch(_0x316f1d){logger[_0x9342('0x43')]('[%s][voiceQueueReport][queuecallerabandon]',_0x6dddf4[_0x9342('0x4c')],util[_0x9342('0x41')](_0x316f1d,{'showHidden':![],'depth':null}));}};VoiceQueueReport[_0x9342('0xb')][_0x9342('0x1f')]=function(_0x43e079){try{if(this[_0x9342('0x6d')](_0x43e079)){logger['debug'](_0x9342('0x84'),_0x43e079[_0x9342('0x4c')],util['inspect'](_0x43e079,{'showHidden':![],'depth':null}));if(this[_0x9342('0x42')][_0x43e079['uniqueid']]){var _0x4b731e=_['last'](this['queueReports'][_0x43e079['uniqueid']]);_0x4b731e[_0x9342('0x85')]=moment()['format'](_0x9342('0x71'));_0x4b731e['connectedlinenum']=_0x43e079[_0x9342('0x86')];_0x4b731e['connectedlinename']=_0x43e079[_0x9342('0x87')];logger['info']('[voiceQueueReport][queuecallerleave]\x20name:%s\x20type:%s\x20connectedlinenum:%s\x20connectedlinename:%s',_0x4b731e[_0x9342('0x4e')],_0x4b731e[_0x9342('0x57')],_0x43e079[_0x9342('0x86')],_0x43e079[_0x9342('0x87')]);this['channels'][_0x43e079['uniqueid']]=_0x4b731e;this[_0x9342('0x79')](_0x4b731e,_0x9342('0x1e'));}}}catch(_0x1dcdd6){logger['error']('[%s][voiceQueueReport][queuecallerleave]',_0x43e079[_0x9342('0x4c')],util[_0x9342('0x41')](_0x1dcdd6,{'showHidden':![],'depth':null}));}};VoiceQueueReport[_0x9342('0xb')][_0x9342('0x23')]=function(_0x1ae76e){try{if(this[_0x9342('0x6d')](_0x1ae76e)){logger[_0x9342('0x51')](_0x9342('0x88'),_0x1ae76e['uniqueid'],util[_0x9342('0x41')](_0x1ae76e,{'showHidden':![],'depth':null}));if(this['queueReports'][_0x1ae76e[_0x9342('0x4c')]]){var _0x251fe8=_[_0x9342('0x7d')](this[_0x9342('0x42')][_0x1ae76e['uniqueid']]);_0x251fe8['queuecallercomplete']=!![];_0x251fe8[_0x9342('0x53')]=_0x9342('0x89');logger[_0x9342('0x74')](_0x9342('0x8a'),_0x251fe8['queue'],_0x251fe8[_0x9342('0x57')]);}}}catch(_0x30392e){logger['error'](_0x9342('0x88'),_0x1ae76e[_0x9342('0x4c')],util['inspect'](_0x30392e,{'showHidden':![],'depth':null}));}};VoiceQueueReport['prototype'][_0x9342('0x21')]=function(_0x4abf2b){try{if(this[_0x9342('0x6d')](_0x4abf2b)){logger['debug'](_0x9342('0x8b'),_0x4abf2b[_0x9342('0x4c')],util[_0x9342('0x41')](_0x4abf2b,{'showHidden':![],'depth':null}));if(this[_0x9342('0x42')][_0x4abf2b[_0x9342('0x4c')]]){var _0x596265=_[_0x9342('0x7d')](this[_0x9342('0x42')][_0x4abf2b[_0x9342('0x4c')]]);_0x596265[_0x9342('0x1c')]=![];_0x596265[_0x9342('0x81')]=null;_0x596265[_0x9342('0x8c')]=!![];_0x596265[_0x9342('0x8d')]=_0x4abf2b[_0x9342('0x8e')];_0x596265[_0x9342('0x7f')]=_0x4abf2b[_0x9342('0x7f')];_0x596265[_0x9342('0x38')]=!![];_0x596265[_0x9342('0x8f')]=![];_0x596265['queuecallerexitAt']=null;if(!_0x596265[_0x9342('0x90')]){if(_0x4abf2b[_0x9342('0x91')]==_0x9342('0x90')){_0x596265['queuecallerexitreason']=_0x9342('0x92');logger[_0x9342('0x74')]('[voiceQueueReport][agentcomplete]\x20name:%s\x20type:%s\x20queuecallerexitreason:COMPLETED',_0x596265[_0x9342('0x4e')],_0x596265['type']);}else{if(_[_0x9342('0x93')](_0x4abf2b[_0x9342('0x94')][_0x9342('0x95')](),_0x9342('0x96'))){if(this[_0x9342('0x42')][_0x4abf2b['linkedid']]){var _0x116d17=_[_0x9342('0x7d')](this[_0x9342('0x42')][_0x4abf2b[_0x9342('0x97')]]);_0x116d17[_0x9342('0x38')]=![];_0x116d17[_0x9342('0x8f')]=!![];_0x116d17[_0x9342('0x98')]=moment(_0x596265[_0x9342('0x99')])['add'](_0x4abf2b['holdtime'],_0x9342('0x9a'))[_0x9342('0x54')](_0x9342('0x71'));_0x116d17[_0x9342('0x53')]=_0x9342('0x9b');_0x116d17[_0x9342('0x90')]=!![];_0x116d17['transfertype']='FORWARD';_0x116d17[_0x9342('0x9c')]=_0x4abf2b['destexten'];_0x116d17[_0x9342('0x9d')]=_0x4abf2b[_0x9342('0x4c')];logger[_0x9342('0x74')](_0x9342('0x9e'),_0x116d17['queue'],_0x116d17[_0x9342('0x57')]);var _0x1793a8=this[_0x9342('0x42')][_0x4abf2b[_0x9342('0x97')]];this[_0x9342('0x42')][_0x4abf2b[_0x9342('0x97')]]=this[_0x9342('0x42')][_0x4abf2b[_0x9342('0x4c')]];this[_0x9342('0x42')][_0x4abf2b['uniqueid']]=_0x1793a8;}}else{_0x596265[_0x9342('0x53')]=_0x9342('0x9f')+_0x4abf2b[_0x9342('0x91')][_0x9342('0xa0')]();logger[_0x9342('0x74')](_0x9342('0xa1'),_0x596265['queue'],_0x596265['type'],_0x596265['queuecallerexitreason']);}}}this[_0x9342('0x11')][_0x4abf2b[_0x9342('0x4c')]]=_0x596265;}}}catch(_0x356810){logger[_0x9342('0x43')]('[%s][voiceQueueReport][agentcomplete]',_0x4abf2b[_0x9342('0x4c')],util[_0x9342('0x41')](_0x356810,{'showHidden':![],'depth':null}));}};VoiceQueueReport[_0x9342('0xb')][_0x9342('0xa2')]=function(_0x59a8ee){try{if(this['isNotNull'](_0x59a8ee)){logger[_0x9342('0x51')](_0x9342('0xa3'),_0x59a8ee[_0x9342('0x4c')],util['inspect'](_0x59a8ee,{'showHidden':![],'depth':null}));this[_0x9342('0xa4')](_0x59a8ee[_0x9342('0x4c')],_[_0x9342('0x77')](_0x59a8ee['variable'])[0x0],_0x59a8ee[_0x9342('0xa5')]);if(this['queueReports'][_0x59a8ee[_0x9342('0x4c')]]){var _0x15f47b=_[_0x9342('0x7d')](this[_0x9342('0x42')][_0x59a8ee[_0x9342('0x4c')]]);if(_0x15f47b){if(this[_0x9342('0x6d')](_0x59a8ee[_0x9342('0xa6')])&&this[_0x9342('0x6d')](_0x59a8ee[_0x9342('0xa6')][_0x9342('0x62')])){switch(_0x59a8ee[_0x9342('0xa5')]){case _0x9342('0xa7'):_0x15f47b['queuecallerexit']=![];_0x15f47b[_0x9342('0x98')]=null;break;case'TIMEOUT':_0x15f47b['lastevent']='timeout';_0x15f47b[_0x9342('0x8f')]=!![];_0x15f47b[_0x9342('0x98')]=moment()[_0x9342('0x54')](_0x9342('0x71'));_0x15f47b[_0x9342('0x85')]=moment()[_0x9342('0x54')]('YYYY-MM-DD\x20HH:mm:ss');logger[_0x9342('0x51')]('[%s][voiceQueueReport][varset]\x20sending\x20timeout\x20event:',_0x59a8ee['uniqueid'],util[_0x9342('0x41')](_0x15f47b,{'showHidden':![],'depth':null}));ami[_0x9342('0x49')]('custom:timeout',_0x15f47b);break;default:_0x15f47b[_0x9342('0x8f')]=!![];_0x15f47b[_0x9342('0x98')]=moment()['format']('YYYY-MM-DD\x20HH:mm:ss');_0x15f47b[_0x9342('0x85')]=moment()[_0x9342('0x54')](_0x9342('0x71'));}_0x15f47b[_0x9342('0x1c')]=![];_0x15f47b[_0x9342('0x81')]=null;_0x15f47b[_0x9342('0x53')]=_0x59a8ee[_0x9342('0xa5')];this[_0x9342('0x11')][_0x59a8ee['uniqueid']]=_0x15f47b;this[_0x9342('0x47')](_0x15f47b,'varset');}else if(this[_0x9342('0x6d')](_0x59a8ee['variable'])&&this['isNotNull'](_0x59a8ee['variable'][_0x9342('0xa8')])){if(!_0x15f47b[_0x9342('0x1c')]){_0x15f47b[_0x9342('0x8f')]=!![];_0x15f47b[_0x9342('0x98')]=moment()[_0x9342('0x54')](_0x9342('0x71'));_0x15f47b[_0x9342('0x53')]=_0x9342('0xa9');_0x15f47b[_0x9342('0x85')]=moment()[_0x9342('0x54')]('YYYY-MM-DD\x20HH:mm:ss');this[_0x9342('0x11')][_0x59a8ee[_0x9342('0x4c')]]=_0x15f47b;}}logger[_0x9342('0x74')](_0x9342('0xaa'),_0x59a8ee[_0x9342('0x4c')],_0x15f47b['queue'],_0x15f47b['type'],_[_0x9342('0x77')](_0x59a8ee[_0x9342('0xa6')])[0x0],_0x59a8ee['value']);_0x15f47b[_0x9342('0x15')]=this['variables'][_0x59a8ee[_0x9342('0x4c')]];}}}}catch(_0x23e8ad){logger[_0x9342('0x43')](_0x9342('0xa3'),_0x59a8ee[_0x9342('0x4c')],util['inspect'](_0x23e8ad,{'showHidden':![],'depth':null}));}};VoiceQueueReport['prototype'][_0x9342('0xa4')]=function(_0xdbdcbf,_0x48185a,_0x3d3af8){var _0x39327c=[_0x9342('0xab'),_0x9342('0xac'),_0x9342('0xad'),_0x9342('0xae'),_0x9342('0xaf'),_0x9342('0xb0'),_0x9342('0xb1'),'rtpaudioqosrttbridged',_0x9342('0xb2'),'sipuri',_0x9342('0xb3'),'bridgepvtcallid',_0x9342('0xb4'),_0x9342('0xb5'),_0x9342('0xb6'),_0x9342('0xb7'),'membername',_0x9342('0xb8'),_0x9342('0xb9')];if(!_[_0x9342('0x3c')](_0x48185a)&&!_[_0x9342('0xba')](_0x39327c,_0x48185a)){if(_['isUndefined'](this[_0x9342('0x15')][_0xdbdcbf])){this[_0x9342('0x15')][_0xdbdcbf]={};}this['variables'][_0xdbdcbf][_0x48185a]=_0x3d3af8;}};VoiceQueueReport[_0x9342('0xb')][_0x9342('0xbb')]=function(_0x12b4fe,_0x2b4ea3,_0x1f0ce8){try{var _0x459a7c={};if(this[_0x9342('0x42')][_0x12b4fe]){for(var _0x6c8a1d=0x0;_0x6c8a1d{delete this[_0x9342('0x11')][_0xc8a88c];},_0x2c7188);}};module[_0x9342('0xf4')]=VoiceQueueReport; \ No newline at end of file diff --git a/server/services/ami/rpc/agentReportPreview.js b/server/services/ami/rpc/agentReportPreview.js index f124e20..6d6bbc5 100644 --- a/server/services/ami/rpc/agentReportPreview.js +++ b/server/services/ami/rpc/agentReportPreview.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x2e33=['createHistory','campaign','queue','Request','CreateReportAgentPreview'];(function(_0x33d59e,_0xcbe0e3){var _0x465442=function(_0x225071){while(--_0x225071){_0x33d59e['push'](_0x33d59e['shift']());}};_0x465442(++_0xcbe0e3);}(_0x2e33,0x1a9));var _0x32e3=function(_0x35e0f8,_0x4f07ba){_0x35e0f8=_0x35e0f8-0x0;var _0x4d56ca=_0x2e33[_0x35e0f8];return _0x4d56ca;};'use strict';var client=require('../client');exports[_0x32e3('0x0')]=function(_0x579c4d){return function(){_0x579c4d[_0x32e3('0x1')]=_0x579c4d[_0x32e3('0x2')];return client[_0x32e3('0x3')]('CreateReportAgentPreview',{'body':_0x579c4d,'log':_0x32e3('0x4')});};}; \ No newline at end of file +var _0xeb1e=['campaign','CreateReportAgentPreview','../client','createHistory'];(function(_0x5c05e2,_0xdd34b2){var _0x36d6c7=function(_0x4bb656){while(--_0x4bb656){_0x5c05e2['push'](_0x5c05e2['shift']());}};_0x36d6c7(++_0xdd34b2);}(_0xeb1e,0x76));var _0xeeb1=function(_0x148118,_0x4cbd08){_0x148118=_0x148118-0x0;var _0x5758d3=_0xeb1e[_0x148118];return _0x5758d3;};'use strict';var client=require(_0xeeb1('0x0'));exports[_0xeeb1('0x1')]=function(_0x41893a){return function(){_0x41893a[_0xeeb1('0x2')]=_0x41893a['queue'];return client['Request'](_0xeeb1('0x3'),{'body':_0x41893a,'log':_0xeeb1('0x3')});};}; \ No newline at end of file diff --git a/server/services/ami/rpc/attachment.js b/server/services/ami/rpc/attachment.js index f4f79e1..7778899 100644 --- a/server/services/ami/rpc/attachment.js +++ b/server/services/ami/rpc/attachment.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0xf59f=['Request','CreateAttachment','../client','create'];(function(_0x30e76f,_0x269c7c){var _0x5605e3=function(_0x129a9a){while(--_0x129a9a){_0x30e76f['push'](_0x30e76f['shift']());}};_0x5605e3(++_0x269c7c);}(_0xf59f,0x182));var _0xff59=function(_0x300f84,_0x4cd052){_0x300f84=_0x300f84-0x0;var _0x1c7983=_0xf59f[_0x300f84];return _0x1c7983;};'use strict';var client=require(_0xff59('0x0'));exports[_0xff59('0x1')]=function(_0x1ae116){return client[_0xff59('0x2')](_0xff59('0x3'),{'body':_0x1ae116,'log':_0xff59('0x3')});}; \ No newline at end of file +var _0xbd8e=['create','CreateAttachment','../client'];(function(_0x2b9c17,_0xc8ac81){var _0x28711d=function(_0x135903){while(--_0x135903){_0x2b9c17['push'](_0x2b9c17['shift']());}};_0x28711d(++_0xc8ac81);}(_0xbd8e,0x1b5));var _0xebd8=function(_0x14add3,_0x13ce8d){_0x14add3=_0x14add3-0x0;var _0x4a174f=_0xbd8e[_0x14add3];return _0x4a174f;};'use strict';var client=require(_0xebd8('0x0'));exports[_0xebd8('0x1')]=function(_0x49fbe9){return client['Request'](_0xebd8('0x2'),{'body':_0x49fbe9,'log':'CreateAttachment'});}; \ No newline at end of file diff --git a/server/services/ami/rpc/campaign.js b/server/services/ami/rpc/campaign.js index aaeda6e..f06f03b 100644 --- a/server/services/ami/rpc/campaign.js +++ b/server/services/ami/rpc/campaign.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x7a54=['dialNoAnswerMaxRetry','dialNoAnswerRetryFrequency','dialNoSuchNumberMaxRetry','dialAbandonedMaxRetry','dialAbandonedRetryFrequency','dialMachineRetryFrequency','dialTimezone','dialGlobalInterval','dialAMDActive','dialAMDInitialSilence','dialAMDGreeting','dialAMDAfterGreetingSilence','dialAMDTotalAnalysisTime','dialAMDBetweenWordsSilence','dialAMDMaximumNumberOfWords','dialAMDSilenceThreshold','dialAMDMaximumWordLength','dialOrderByScheduledAt','dialPrefix','dialRandomLastDigitCallerIdNumber','dialCutDigit','Trunk','callerid','active','Interval','Intervals','interval','SquareProject','../client','getCampaigns','Request','name','type','limitCalls','dialOriginateCallerIdName','dialOriginateCallerIdNumber','dialOriginateTimeout','dialCongestionMaxRetry','dialBusyMaxRetry'];(function(_0x5081b3,_0x14523b){var _0xff4a66=function(_0x436cea){while(--_0x436cea){_0x5081b3['push'](_0x5081b3['shift']());}};_0xff4a66(++_0x14523b);}(_0x7a54,0x106));var _0x47a5=function(_0x1b4468,_0x2aa00f){_0x1b4468=_0x1b4468-0x0;var _0x1a0c51=_0x7a54[_0x1b4468];return _0x1a0c51;};'use strict';var client=require(_0x47a5('0x0'));exports[_0x47a5('0x1')]=function(){return function(){return client[_0x47a5('0x2')]('GetCampaign',{'options':{'raw':![],'attributes':['id',_0x47a5('0x3'),_0x47a5('0x4'),'active',_0x47a5('0x5'),_0x47a5('0x6'),_0x47a5('0x7'),_0x47a5('0x8'),_0x47a5('0x9'),'dialCongestionRetryFrequency',_0x47a5('0xa'),'dialBusyRetryFrequency',_0x47a5('0xb'),_0x47a5('0xc'),'dialGlobalMaxRetry',_0x47a5('0xd'),'dialNoSuchNumberRetryFrequency','dialDropMaxRetry','dialDropRetryFrequency',_0x47a5('0xe'),_0x47a5('0xf'),'dialMachineMaxRetry',_0x47a5('0x10'),'dialAgentRejectMaxRetry','dialAgentRejectRetryFrequency',_0x47a5('0x11'),_0x47a5('0x12'),_0x47a5('0x13'),_0x47a5('0x14'),_0x47a5('0x15'),_0x47a5('0x16'),_0x47a5('0x17'),'dialAMDMinWordLength',_0x47a5('0x18'),_0x47a5('0x19'),_0x47a5('0x1a'),_0x47a5('0x1b'),_0x47a5('0x1c'),_0x47a5('0x1d'),_0x47a5('0x1e'),_0x47a5('0x1f')],'include':[{'model':'Trunk','as':_0x47a5('0x20'),'attributes':['id',_0x47a5('0x3'),_0x47a5('0x21'),_0x47a5('0x22')]},{'model':_0x47a5('0x20'),'as':'TrunkBackup','attributes':['id','name',_0x47a5('0x21'),'active']},{'model':'Interval','as':_0x47a5('0x23'),'attributes':['id',_0x47a5('0x3')],'include':[{'model':_0x47a5('0x23'),'as':_0x47a5('0x24'),'attributes':['id',_0x47a5('0x3'),_0x47a5('0x25')]}]},{'model':_0x47a5('0x26'),'as':_0x47a5('0x26'),'attributes':['id',_0x47a5('0x3')]}]},'log':'getCampaign'});};}; \ No newline at end of file +var _0x1261=['Interval','interval','SquareProject','getCampaign','getCampaigns','Request','GetCampaign','name','type','active','limitCalls','dialOriginateCallerIdName','dialOriginateCallerIdNumber','dialOriginateTimeout','dialBusyMaxRetry','dialBusyRetryFrequency','dialNoAnswerRetryFrequency','dialGlobalMaxRetry','dialNoSuchNumberMaxRetry','dialNoSuchNumberRetryFrequency','dialDropMaxRetry','dialAbandonedMaxRetry','dialAbandonedRetryFrequency','dialMachineMaxRetry','dialAgentRejectMaxRetry','dialGlobalInterval','dialAMDInitialSilence','dialAMDGreeting','dialAMDAfterGreetingSilence','dialAMDTotalAnalysisTime','dialAMDMinWordLength','dialAMDBetweenWordsSilence','dialAMDMaximumNumberOfWords','dialAMDSilenceThreshold','dialAMDMaximumWordLength','dialRandomLastDigitCallerIdNumber','dialCutDigit','Trunk','TrunkBackup','callerid'];(function(_0x1294a7,_0x3f43fd){var _0x45c61e=function(_0x14488a){while(--_0x14488a){_0x1294a7['push'](_0x1294a7['shift']());}};_0x45c61e(++_0x3f43fd);}(_0x1261,0x144));var _0x1126=function(_0x53208e,_0x4a1eb8){_0x53208e=_0x53208e-0x0;var _0xa97d9b=_0x1261[_0x53208e];return _0xa97d9b;};'use strict';var client=require('../client');exports[_0x1126('0x0')]=function(){return function(){return client[_0x1126('0x1')](_0x1126('0x2'),{'options':{'raw':![],'attributes':['id',_0x1126('0x3'),_0x1126('0x4'),_0x1126('0x5'),_0x1126('0x6'),_0x1126('0x7'),_0x1126('0x8'),_0x1126('0x9'),'dialCongestionMaxRetry','dialCongestionRetryFrequency',_0x1126('0xa'),_0x1126('0xb'),'dialNoAnswerMaxRetry',_0x1126('0xc'),_0x1126('0xd'),_0x1126('0xe'),_0x1126('0xf'),_0x1126('0x10'),'dialDropRetryFrequency',_0x1126('0x11'),_0x1126('0x12'),_0x1126('0x13'),'dialMachineRetryFrequency',_0x1126('0x14'),'dialAgentRejectRetryFrequency','dialTimezone',_0x1126('0x15'),'dialAMDActive',_0x1126('0x16'),_0x1126('0x17'),_0x1126('0x18'),_0x1126('0x19'),_0x1126('0x1a'),_0x1126('0x1b'),_0x1126('0x1c'),_0x1126('0x1d'),_0x1126('0x1e'),'dialOrderByScheduledAt','dialPrefix',_0x1126('0x1f'),_0x1126('0x20')],'include':[{'model':_0x1126('0x21'),'as':'Trunk','attributes':['id',_0x1126('0x3'),'callerid',_0x1126('0x5')]},{'model':_0x1126('0x21'),'as':_0x1126('0x22'),'attributes':['id','name',_0x1126('0x23'),_0x1126('0x5')]},{'model':'Interval','as':'Interval','attributes':['id',_0x1126('0x3')],'include':[{'model':_0x1126('0x24'),'as':'Intervals','attributes':['id','name',_0x1126('0x25')]}]},{'model':'SquareProject','as':_0x1126('0x26'),'attributes':['id',_0x1126('0x3')]}]},'log':_0x1126('0x27')});};}; \ No newline at end of file diff --git a/server/services/ami/rpc/cmContact.js b/server/services/ami/rpc/cmContact.js index 6dda5ce..3f7af85 100644 --- a/server/services/ami/rpc/cmContact.js +++ b/server/services/ami/rpc/cmContact.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x6257=['CreateCmContact','getContacts','Request','GetCmContact','../client','createContact'];(function(_0x484689,_0x25eb83){var _0x3bdeea=function(_0x5cbda4){while(--_0x5cbda4){_0x484689['push'](_0x484689['shift']());}};_0x3bdeea(++_0x25eb83);}(_0x6257,0x1e4));var _0x7625=function(_0xc8c735,_0x263fd0){_0xc8c735=_0xc8c735-0x0;var _0x3fe541=_0x6257[_0xc8c735];return _0x3fe541;};'use strict';var client=require(_0x7625('0x0'));exports[_0x7625('0x1')]=function(_0x6640fc){return function(){return client['Request'](_0x7625('0x2'),{'body':_0x6640fc,'log':_0x7625('0x2')});};};exports[_0x7625('0x3')]=function(_0x5880b1){return function(){return client[_0x7625('0x4')](_0x7625('0x5'),{'options':_0x5880b1,'log':'GetCmContact'});};}; \ No newline at end of file +var _0x8094=['getContacts','Request','GetCmContact','createContact','CreateCmContact'];(function(_0x16fb34,_0x255ebf){var _0x1e8b3a=function(_0x391c36){while(--_0x391c36){_0x16fb34['push'](_0x16fb34['shift']());}};_0x1e8b3a(++_0x255ebf);}(_0x8094,0x1a7));var _0x4809=function(_0xd5709b,_0x101823){_0xd5709b=_0xd5709b-0x0;var _0x3dc484=_0x8094[_0xd5709b];return _0x3dc484;};'use strict';var client=require('../client');exports[_0x4809('0x0')]=function(_0x2ef2d0){return function(){return client['Request']('CreateCmContact',{'body':_0x2ef2d0,'log':_0x4809('0x1')});};};exports[_0x4809('0x2')]=function(_0x4a9cdf){return function(){return client[_0x4809('0x3')](_0x4809('0x4'),{'options':_0x4a9cdf,'log':_0x4809('0x4')});};}; \ No newline at end of file diff --git a/server/services/ami/rpc/cmHopper.js b/server/services/ami/rpc/cmHopper.js index a347b6b..4536942 100644 --- a/server/services/ami/rpc/cmHopper.js +++ b/server/services/ami/rpc/cmHopper.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x5292=['Contact','updateContacts','UpdateCmHopper','rescheduleContact','ContactId','ListId','VoiceQueueId','CampaignId','destroyContact','DestroyCmHopper','getContactDialer','GetContactDialer','format','YYYY-MM-DD\x20HH:mm:ss','priority','DESC','scheduledat','ASC','GetContactDialerIvr','moveContactManagedDialer','queue','MoveContactManagedDialer','CountReScheduled','countReScheduled','getContactPreview','User','Agent','name','VoiceQueue','Queue','getCmHopper','unlockContact','GetContactRecallMe','voicePause','db.CmHopper.UserId','ResetActiveCalls','handlePreviewRecallNotifications','../client','moment','Request','GetCmHopper','CmContact'];(function(_0x45913a,_0x2db7c2){var _0x4a33e1=function(_0x4a2235){while(--_0x4a2235){_0x45913a['push'](_0x45913a['shift']());}};_0x4a33e1(++_0x2db7c2);}(_0x5292,0xf7));var _0x2529=function(_0x21f7d4,_0x3fb9df){_0x21f7d4=_0x21f7d4-0x0;var _0x143fa7=_0x5292[_0x21f7d4];return _0x143fa7;};'use strict';var client=require(_0x2529('0x0'));var moment=require(_0x2529('0x1'));exports['getContacts']=function(_0x2ec817,_0x522ab4){return function(){return client[_0x2529('0x2')](_0x2529('0x3'),{'options':{'where':{'VoiceQueueId':_0x2ec817},'include':[{'model':_0x2529('0x4'),'as':_0x2529('0x5')}],'limit':_0x522ab4,'raw':![]},'log':'getCmHopper'});};};exports[_0x2529('0x6')]=function(_0x482dba,_0x4c9b4c,_0x4e7a9e){return function(){return client[_0x2529('0x2')](_0x2529('0x7'),{'body':_0x482dba,'options':{'where':{'VoiceQueueId':_0x4c9b4c,'scheduledat':{'$lte':moment()['format']('YYYY-MM-DD\x20HH:mm:ss')}},'limit':_0x4e7a9e},'log':_0x2529('0x7')});};};exports[_0x2529('0x8')]=function(_0x5850a7){return client[_0x2529('0x2')](_0x2529('0x7'),{'body':_0x5850a7,'options':{'where':{'ContactId':_0x5850a7[_0x2529('0x9')],'ListId':_0x5850a7[_0x2529('0xa')],'VoiceQueueId':_0x5850a7[_0x2529('0xb')],'CampaignId':_0x5850a7[_0x2529('0xc')]}},'log':_0x2529('0x8')});};exports[_0x2529('0xd')]=function(_0x4f3cf9,_0x42f613,_0x4fb3e0){return function(){return client['Request'](_0x2529('0xe'),{'options':{'where':{'VoiceQueueId':_0x4f3cf9,'ListId':_0x42f613,'ContactId':_0x4fb3e0}},'log':_0x2529('0xe')});};};exports[_0x2529('0xf')]=function(_0xfb9ae2,_0x2c6a91,_0x31c39c,_0x3f3b40){return client['Request'](_0x2529('0x10'),{'body':{'active':!![]},'options':{'where':{'VoiceQueueId':_0xfb9ae2,'active':![],'scheduledat':{'$lte':moment()[_0x2529('0x11')](_0x2529('0x12'))},'$or':[{'UserId':null},{'UserId':{'$in':_0x2c6a91}}]},'order':[[_0x2529('0x13'),_0x2529('0x14')],[_0x2529('0x15'),_0x3f3b40],['id',_0x2529('0x16')]],'raw':!![],'limit':_0x31c39c},'log':_0x2529('0x10')});};exports['getContactDialerIvr']=function(_0x163bf4,_0x502ea8,_0x337720){return client[_0x2529('0x2')](_0x2529('0x10'),{'body':{'active':!![]},'options':{'where':{'CampaignId':_0x163bf4,'active':![],'scheduledat':{'$lte':moment()['format']('YYYY-MM-DD\x20HH:mm:ss')}},'include':[{'model':_0x2529('0x4'),'as':_0x2529('0x5')}],'order':[[_0x2529('0x13'),_0x2529('0x14')],[_0x2529('0x15'),_0x337720],['id','ASC']],'raw':!![],'limit':_0x502ea8},'log':_0x2529('0x17')});};exports[_0x2529('0x18')]=function(_0x1ca15f,_0xeff5a6){_0x1ca15f['campaign']=_0x1ca15f[_0x2529('0x19')];return client[_0x2529('0x2')](_0x2529('0x1a'),{'body':_0x1ca15f,'options':{'where':{'ContactId':_0x1ca15f['ContactId'],'ListId':_0x1ca15f[_0x2529('0xa')],'VoiceQueueId':_0x1ca15f[_0x2529('0xb')],'CampaignId':_0x1ca15f[_0x2529('0xc')],'active':_0xeff5a6?undefined:!![]}},'log':_0x2529('0x1a')});};exports['countReScheduled']=function(_0x2736f6){return client[_0x2529('0x2')](_0x2529('0x1b'),{'options':{'where':{'VoiceQueueId':_0x2736f6['id']?_0x2736f6['id']||null:null}},'log':_0x2529('0x1c')});};exports[_0x2529('0x1d')]=function(_0xbb3c1b){return function(){return client['Request']('GetCmHopperPreview',{'options':{'where':{'id':_0xbb3c1b},'include':[{'model':_0x2529('0x4'),'as':_0x2529('0x5')},{'model':_0x2529('0x1e'),'as':_0x2529('0x1f'),'attributes':['id',_0x2529('0x20')]},{'model':_0x2529('0x21'),'as':_0x2529('0x22'),'attributes':['id',_0x2529('0x20')]}],'raw':!![]},'log':_0x2529('0x23')});};};exports[_0x2529('0x24')]=function(_0x5852aa,_0x1c5209,_0x6d26cb){return client['Request'](_0x2529('0x7'),{'body':_0x5852aa,'options':{'where':{'id':_0x1c5209},'limit':_0x6d26cb},'log':_0x2529('0x7')});};exports['getContactRecallMe']=function(_0x17bcbd,_0x1d7e98){return function(){return client['Request'](_0x2529('0x25'),{'body':{'active':!![]},'options':{'where':{'VoiceQueueId':_0x17bcbd,'active':![],'recallme':!![],'scheduledat':{'$lte':moment()[_0x2529('0x11')]('YYYY-MM-DD\x20HH:mm:ss')},'UserId':{'$in':_0x1d7e98}},'order':[[_0x2529('0x13'),_0x2529('0x14')],[_0x2529('0x15'),_0x2529('0x14')],['id',_0x2529('0x16')]],'include':[{'model':'CmContact','as':_0x2529('0x5')},{'model':_0x2529('0x1e'),'as':_0x2529('0x1f'),'attributes':['id',_0x2529('0x20'),_0x2529('0x26')]}],'group':_0x2529('0x27'),'raw':!![]},'log':_0x2529('0x10')});};};exports['resetActiveCalls']=function(_0x4ab0ed,_0x14aabd){return client['Request'](_0x2529('0x28'),{'body':_0x4ab0ed,'options':_0x14aabd||{},'log':'ResetActiveCalls'});};exports['handlePreviewRecallNotifications']=function(_0x543ac5,_0x30cdfb,_0x3c815f){return function(){return client[_0x2529('0x2')]('CmHopperHandlePreviewRecallNotifications',{'body':{'where':{'voiceQueueIds':_0x543ac5,'interval':_0x30cdfb,'availableAgentsIds':_0x3c815f}},'log':_0x2529('0x29')});};}; \ No newline at end of file +var _0x3f27=['rescheduleContact','ContactId','VoiceQueueId','CampaignId','DestroyCmHopper','getContactDialer','GetContactDialer','priority','DESC','scheduledat','ASC','getContactDialerIvr','format','YYYY-MM-DD\x20HH:mm:ss','Contact','GetContactDialerIvr','moveContactManagedDialer','queue','MoveContactManagedDialer','CountReScheduled','getContactPreview','User','Queue','name','getCmHopper','unlockContact','getContactRecallMe','GetContactRecallMe','voicePause','resetActiveCalls','ResetActiveCalls','handlePreviewRecallNotifications','../client','moment','getContacts','GetCmHopper','CmContact','Request','UpdateCmHopper'];(function(_0x509b9f,_0x2a3acf){var _0x4681c7=function(_0x5bc8aa){while(--_0x5bc8aa){_0x509b9f['push'](_0x509b9f['shift']());}};_0x4681c7(++_0x2a3acf);}(_0x3f27,0x1f4));var _0x73f2=function(_0x21af9b,_0x8daa1b){_0x21af9b=_0x21af9b-0x0;var _0x567fab=_0x3f27[_0x21af9b];return _0x567fab;};'use strict';var client=require(_0x73f2('0x0'));var moment=require(_0x73f2('0x1'));exports[_0x73f2('0x2')]=function(_0x833cdd,_0x329305){return function(){return client['Request'](_0x73f2('0x3'),{'options':{'where':{'VoiceQueueId':_0x833cdd},'include':[{'model':_0x73f2('0x4'),'as':'Contact'}],'limit':_0x329305,'raw':![]},'log':'getCmHopper'});};};exports['updateContacts']=function(_0x3adbeb,_0x54631b,_0x17f054){return function(){return client[_0x73f2('0x5')](_0x73f2('0x6'),{'body':_0x3adbeb,'options':{'where':{'VoiceQueueId':_0x54631b,'scheduledat':{'$lte':moment()['format']('YYYY-MM-DD\x20HH:mm:ss')}},'limit':_0x17f054},'log':_0x73f2('0x6')});};};exports[_0x73f2('0x7')]=function(_0x222576){return client[_0x73f2('0x5')](_0x73f2('0x6'),{'body':_0x222576,'options':{'where':{'ContactId':_0x222576[_0x73f2('0x8')],'ListId':_0x222576['ListId'],'VoiceQueueId':_0x222576[_0x73f2('0x9')],'CampaignId':_0x222576[_0x73f2('0xa')]}},'log':_0x73f2('0x7')});};exports['destroyContact']=function(_0x48e825,_0x50ee1f,_0x2b587b){return function(){return client[_0x73f2('0x5')](_0x73f2('0xb'),{'options':{'where':{'VoiceQueueId':_0x48e825,'ListId':_0x50ee1f,'ContactId':_0x2b587b}},'log':_0x73f2('0xb')});};};exports[_0x73f2('0xc')]=function(_0x467e75,_0x41f588,_0x481776,_0x4d4bd2){return client[_0x73f2('0x5')](_0x73f2('0xd'),{'body':{'active':!![]},'options':{'where':{'VoiceQueueId':_0x467e75,'active':![],'scheduledat':{'$lte':moment()['format']('YYYY-MM-DD\x20HH:mm:ss')},'$or':[{'UserId':null},{'UserId':{'$in':_0x41f588}}]},'order':[[_0x73f2('0xe'),_0x73f2('0xf')],[_0x73f2('0x10'),_0x4d4bd2],['id',_0x73f2('0x11')]],'raw':!![],'limit':_0x481776},'log':_0x73f2('0xd')});};exports[_0x73f2('0x12')]=function(_0x32e9c6,_0x205e3e,_0x41e10c){return client[_0x73f2('0x5')](_0x73f2('0xd'),{'body':{'active':!![]},'options':{'where':{'CampaignId':_0x32e9c6,'active':![],'scheduledat':{'$lte':moment()[_0x73f2('0x13')](_0x73f2('0x14'))}},'include':[{'model':'CmContact','as':_0x73f2('0x15')}],'order':[[_0x73f2('0xe'),_0x73f2('0xf')],[_0x73f2('0x10'),_0x41e10c],['id','ASC']],'raw':!![],'limit':_0x205e3e},'log':_0x73f2('0x16')});};exports[_0x73f2('0x17')]=function(_0x416ead,_0x2ae791){_0x416ead['campaign']=_0x416ead[_0x73f2('0x18')];return client[_0x73f2('0x5')](_0x73f2('0x19'),{'body':_0x416ead,'options':{'where':{'ContactId':_0x416ead['ContactId'],'ListId':_0x416ead['ListId'],'VoiceQueueId':_0x416ead[_0x73f2('0x9')],'CampaignId':_0x416ead[_0x73f2('0xa')],'active':_0x2ae791?undefined:!![]}},'log':_0x73f2('0x19')});};exports['countReScheduled']=function(_0x4844df){return client[_0x73f2('0x5')](_0x73f2('0x1a'),{'options':{'where':{'VoiceQueueId':_0x4844df['id']?_0x4844df['id']||null:null}},'log':'countReScheduled'});};exports[_0x73f2('0x1b')]=function(_0x86c182){return function(){return client[_0x73f2('0x5')]('GetCmHopperPreview',{'options':{'where':{'id':_0x86c182},'include':[{'model':_0x73f2('0x4'),'as':_0x73f2('0x15')},{'model':_0x73f2('0x1c'),'as':'Agent','attributes':['id','name']},{'model':'VoiceQueue','as':_0x73f2('0x1d'),'attributes':['id',_0x73f2('0x1e')]}],'raw':!![]},'log':_0x73f2('0x1f')});};};exports[_0x73f2('0x20')]=function(_0x4168eb,_0x3f784d,_0x545fb5){return client[_0x73f2('0x5')](_0x73f2('0x6'),{'body':_0x4168eb,'options':{'where':{'id':_0x3f784d},'limit':_0x545fb5},'log':'UpdateCmHopper'});};exports[_0x73f2('0x21')]=function(_0x1a23a4,_0x15a367){return function(){return client[_0x73f2('0x5')](_0x73f2('0x22'),{'body':{'active':!![]},'options':{'where':{'VoiceQueueId':_0x1a23a4,'active':![],'recallme':!![],'scheduledat':{'$lte':moment()['format'](_0x73f2('0x14'))},'UserId':{'$in':_0x15a367}},'order':[[_0x73f2('0xe'),'DESC'],['scheduledat',_0x73f2('0xf')],['id',_0x73f2('0x11')]],'include':[{'model':_0x73f2('0x4'),'as':'Contact'},{'model':'User','as':'Agent','attributes':['id','name',_0x73f2('0x23')]}],'group':'db.CmHopper.UserId','raw':!![]},'log':_0x73f2('0xd')});};};exports[_0x73f2('0x24')]=function(_0x37ec0f,_0x3e0da7){return client['Request'](_0x73f2('0x25'),{'body':_0x37ec0f,'options':_0x3e0da7||{},'log':_0x73f2('0x25')});};exports[_0x73f2('0x26')]=function(_0x48f4be,_0x3d62a0,_0x1fd87e){return function(){return client[_0x73f2('0x5')]('CmHopperHandlePreviewRecallNotifications',{'body':{'where':{'voiceQueueIds':_0x48f4be,'interval':_0x3d62a0,'availableAgentsIds':_0x1fd87e}},'log':_0x73f2('0x26')});};}; \ No newline at end of file diff --git a/server/services/ami/rpc/cmHopperAdditionalPhone.js b/server/services/ami/rpc/cmHopperAdditionalPhone.js index 642495b..0f92899 100644 --- a/server/services/ami/rpc/cmHopperAdditionalPhone.js +++ b/server/services/ami/rpc/cmHopperAdditionalPhone.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0xf79f=['../client','verifyAdditionalPhones','Request','VerifyAdditionalPhones','swapAdditionalPhones','SwapAdditionalPhones','incrementPreviewCounters','IncrementPreviewCounters'];(function(_0x3dd15e,_0x1f0015){var _0x231fd0=function(_0x4f680a){while(--_0x4f680a){_0x3dd15e['push'](_0x3dd15e['shift']());}};_0x231fd0(++_0x1f0015);}(_0xf79f,0x108));var _0xff79=function(_0x5293c8,_0xab0c3c){_0x5293c8=_0x5293c8-0x0;var _0x3623fb=_0xf79f[_0x5293c8];return _0x3623fb;};'use strict';var client=require(_0xff79('0x0'));exports[_0xff79('0x1')]=function(_0x1fec4f,_0x32d99a,_0x45a126){return client[_0xff79('0x2')]('VerifyAdditionalPhones',{'body':_0x1fec4f,'reason':_0x32d99a,'entity':_0x45a126,'log':_0xff79('0x3')});};exports[_0xff79('0x4')]=function(_0x4b485e,_0x1f9a57,_0x250e34){return client['Request']('SwapAdditionalPhones',{'body':_0x4b485e,'duration':_0x1f9a57,'waitTime':_0x250e34,'log':_0xff79('0x5')});};exports[_0xff79('0x6')]=function(_0x3779f0){return function(){return client[_0xff79('0x2')]('IncrementPreviewCounters',{'body':_0x3779f0,'log':_0xff79('0x7')});};}; \ No newline at end of file +var _0xca4b=['Request','VerifyAdditionalPhones','swapAdditionalPhones','SwapAdditionalPhones','incrementPreviewCounters','IncrementPreviewCounters'];(function(_0x48f7cf,_0x4baa04){var _0xc201c0=function(_0x23ff34){while(--_0x23ff34){_0x48f7cf['push'](_0x48f7cf['shift']());}};_0xc201c0(++_0x4baa04);}(_0xca4b,0x1ec));var _0xbca4=function(_0xff9c56,_0x19bc8c){_0xff9c56=_0xff9c56-0x0;var _0x46e8c5=_0xca4b[_0xff9c56];return _0x46e8c5;};'use strict';var client=require('../client');exports['verifyAdditionalPhones']=function(_0x352f7c,_0x43a44f,_0x1b4588){return client[_0xbca4('0x0')]('VerifyAdditionalPhones',{'body':_0x352f7c,'reason':_0x43a44f,'entity':_0x1b4588,'log':_0xbca4('0x1')});};exports[_0xbca4('0x2')]=function(_0x5d0c9b,_0x5dd8af,_0x111a50){return client['Request'](_0xbca4('0x3'),{'body':_0x5d0c9b,'duration':_0x5dd8af,'waitTime':_0x111a50,'log':_0xbca4('0x3')});};exports[_0xbca4('0x4')]=function(_0x3e7278){return function(){return client['Request'](_0xbca4('0x5'),{'body':_0x3e7278,'log':_0xbca4('0x5')});};}; \ No newline at end of file diff --git a/server/services/ami/rpc/cmHopperBlack.js b/server/services/ami/rpc/cmHopperBlack.js index db94da2..c9f083f 100644 --- a/server/services/ami/rpc/cmHopperBlack.js +++ b/server/services/ami/rpc/cmHopperBlack.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x240d=['checkIsBlackListIvr','CampaignId','phone','GetCmHopperBlackIvr','../client','checkIsBlackList','Request','GetCmHopperBlack','VoiceQueueId'];(function(_0x4f9265,_0x562e88){var _0xa667b=function(_0x1021b9){while(--_0x1021b9){_0x4f9265['push'](_0x4f9265['shift']());}};_0xa667b(++_0x562e88);}(_0x240d,0xca));var _0xd240=function(_0x335707,_0x1babc9){_0x335707=_0x335707-0x0;var _0x4a0d74=_0x240d[_0x335707];return _0x4a0d74;};'use strict';var client=require(_0xd240('0x0'));exports[_0xd240('0x1')]=function(_0x43412f){return client[_0xd240('0x2')](_0xd240('0x3'),{'options':{'where':{'VoiceQueueId':_0x43412f[_0xd240('0x4')],'phone':_0x43412f['phone']},'raw':![]},'log':_0xd240('0x3')});};exports[_0xd240('0x5')]=function(_0x12a0f1){return client[_0xd240('0x2')]('GetCmHopperBlack',{'options':{'where':{'CampaignId':_0x12a0f1[_0xd240('0x6')],'phone':_0x12a0f1[_0xd240('0x7')]},'raw':![]},'log':_0xd240('0x8')});}; \ No newline at end of file +var _0xf7c6=['CampaignId','GetCmHopperBlackIvr','../client','checkIsBlackList','Request','GetCmHopperBlack','VoiceQueueId','phone','checkIsBlackListIvr'];(function(_0xa464c9,_0x7c86d8){var _0x3d73c4=function(_0x5c2056){while(--_0x5c2056){_0xa464c9['push'](_0xa464c9['shift']());}};_0x3d73c4(++_0x7c86d8);}(_0xf7c6,0x1a9));var _0x6f7c=function(_0x51f632,_0x5a14d5){_0x51f632=_0x51f632-0x0;var _0x24cf36=_0xf7c6[_0x51f632];return _0x24cf36;};'use strict';var client=require(_0x6f7c('0x0'));exports[_0x6f7c('0x1')]=function(_0x360f45){return client[_0x6f7c('0x2')](_0x6f7c('0x3'),{'options':{'where':{'VoiceQueueId':_0x360f45[_0x6f7c('0x4')],'phone':_0x360f45[_0x6f7c('0x5')]},'raw':![]},'log':'GetCmHopperBlack'});};exports[_0x6f7c('0x6')]=function(_0x520c41){return client[_0x6f7c('0x2')](_0x6f7c('0x3'),{'options':{'where':{'CampaignId':_0x520c41[_0x6f7c('0x7')],'phone':_0x520c41[_0x6f7c('0x5')]},'raw':![]},'log':_0x6f7c('0x8')});}; \ No newline at end of file diff --git a/server/services/ami/rpc/cmHopperFinal.js b/server/services/ami/rpc/cmHopperFinal.js index 51c9729..0f7faf3 100644 --- a/server/services/ami/rpc/cmHopperFinal.js +++ b/server/services/ami/rpc/cmHopperFinal.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x28a4=['campaign','Request','CreateCmHopperFinal','../client','createContact'];(function(_0x5488a5,_0x35c5ca){var _0x202bdd=function(_0x3d903c){while(--_0x3d903c){_0x5488a5['push'](_0x5488a5['shift']());}};_0x202bdd(++_0x35c5ca);}(_0x28a4,0x134));var _0x428a=function(_0x1d2ef2,_0x1a7599){_0x1d2ef2=_0x1d2ef2-0x0;var _0x345183=_0x28a4[_0x1d2ef2];return _0x345183;};'use strict';var client=require(_0x428a('0x0'));exports[_0x428a('0x1')]=function(_0x2b93b6){return function(){_0x2b93b6[_0x428a('0x2')]=_0x2b93b6['queue'];return client[_0x428a('0x3')](_0x428a('0x4'),{'body':_0x2b93b6,'log':'CreateCmHopperFinal'});};}; \ No newline at end of file +var _0x5713=['CreateCmHopperFinal','campaign','queue','Request'];(function(_0x188a50,_0x593551){var _0x10942c=function(_0xe83b73){while(--_0xe83b73){_0x188a50['push'](_0x188a50['shift']());}};_0x10942c(++_0x593551);}(_0x5713,0x6d));var _0x3571=function(_0x7ccbf1,_0x1145af){_0x7ccbf1=_0x7ccbf1-0x0;var _0x29112a=_0x5713[_0x7ccbf1];return _0x29112a;};'use strict';var client=require('../client');exports['createContact']=function(_0x3e71e5){return function(){_0x3e71e5[_0x3571('0x0')]=_0x3e71e5[_0x3571('0x1')];return client[_0x3571('0x2')](_0x3571('0x3'),{'body':_0x3e71e5,'log':_0x3571('0x3')});};}; \ No newline at end of file diff --git a/server/services/ami/rpc/cmHopperHistory.js b/server/services/ami/rpc/cmHopperHistory.js index 8526156..7ff8a0c 100644 --- a/server/services/ami/rpc/cmHopperHistory.js +++ b/server/services/ami/rpc/cmHopperHistory.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x6a22=['Request','CreateCmHopperHistory','avgHandleTime','AvgHandleTime','minutes','format','YYYY-MM-DD\x20HH:mm:ss','getVoiceQueueHopperHistory','startOf','day','endOf','GetVoiceQueueHopperHistory','getCampaignHopperHistory','GetCampaignHopperHistory','ivr','../client','moment','createHistory','campaign','queue'];(function(_0x5ed592,_0x445b0e){var _0x41ebb5=function(_0x56556e){while(--_0x56556e){_0x5ed592['push'](_0x5ed592['shift']());}};_0x41ebb5(++_0x445b0e);}(_0x6a22,0x87));var _0x26a2=function(_0x4bde34,_0xaa7b76){_0x4bde34=_0x4bde34-0x0;var _0x57ef23=_0x6a22[_0x4bde34];return _0x57ef23;};'use strict';var client=require(_0x26a2('0x0'));var moment=require(_0x26a2('0x1'));exports[_0x26a2('0x2')]=function(_0x5e3ca2){_0x5e3ca2[_0x26a2('0x3')]=_0x5e3ca2[_0x26a2('0x4')];return client[_0x26a2('0x5')](_0x26a2('0x6'),{'body':_0x5e3ca2,'log':_0x26a2('0x6')});};exports[_0x26a2('0x7')]=function(_0xedd430){return client['Request'](_0x26a2('0x8'),{'options':{'where':{'endtime':{'$between':[moment()['subtract'](_0xedd430,_0x26a2('0x9'))[_0x26a2('0xa')](_0x26a2('0xb')),moment()[_0x26a2('0xa')](_0x26a2('0xb'))]}},'raw':![]},'log':'GetCmHopperHistory'});};exports[_0x26a2('0xc')]=function(){return function(){return client['Request']('GetVoiceQueueHopperHistory',{'options':{'where':{'createdAt':{'$between':[moment()[_0x26a2('0xd')](_0x26a2('0xe'))[_0x26a2('0xa')](_0x26a2('0xb')),moment()[_0x26a2('0xf')](_0x26a2('0xe'))[_0x26a2('0xa')](_0x26a2('0xb'))]},'campaigntype':_0x26a2('0x4')},'raw':![]},'log':_0x26a2('0x10')});};};exports[_0x26a2('0x11')]=function(){return function(){return client[_0x26a2('0x5')](_0x26a2('0x12'),{'options':{'where':{'createdAt':{'$between':[moment()[_0x26a2('0xd')](_0x26a2('0xe'))[_0x26a2('0xa')](_0x26a2('0xb')),moment()[_0x26a2('0xf')](_0x26a2('0xe'))[_0x26a2('0xa')]('YYYY-MM-DD\x20HH:mm:ss')]},'campaigntype':_0x26a2('0x13')},'raw':![]},'log':_0x26a2('0x12')});};}; \ No newline at end of file +var _0x9374=['getCampaignHopperHistory','GetCampaignHopperHistory','endOf','moment','createHistory','queue','CreateCmHopperHistory','Request','subtract','minutes','format','YYYY-MM-DD\x20HH:mm:ss','GetCmHopperHistory','getVoiceQueueHopperHistory','GetVoiceQueueHopperHistory','startOf','day'];(function(_0x163040,_0x38a58c){var _0x364667=function(_0x3b104f){while(--_0x3b104f){_0x163040['push'](_0x163040['shift']());}};_0x364667(++_0x38a58c);}(_0x9374,0x1ac));var _0x4937=function(_0xe9a431,_0x1e7009){_0xe9a431=_0xe9a431-0x0;var _0x591b10=_0x9374[_0xe9a431];return _0x591b10;};'use strict';var client=require('../client');var moment=require(_0x4937('0x0'));exports[_0x4937('0x1')]=function(_0x7ae017){_0x7ae017['campaign']=_0x7ae017[_0x4937('0x2')];return client['Request'](_0x4937('0x3'),{'body':_0x7ae017,'log':_0x4937('0x3')});};exports['avgHandleTime']=function(_0x540db6){return client[_0x4937('0x4')]('AvgHandleTime',{'options':{'where':{'endtime':{'$between':[moment()[_0x4937('0x5')](_0x540db6,_0x4937('0x6'))[_0x4937('0x7')](_0x4937('0x8')),moment()[_0x4937('0x7')](_0x4937('0x8'))]}},'raw':![]},'log':_0x4937('0x9')});};exports[_0x4937('0xa')]=function(){return function(){return client[_0x4937('0x4')](_0x4937('0xb'),{'options':{'where':{'createdAt':{'$between':[moment()[_0x4937('0xc')](_0x4937('0xd'))[_0x4937('0x7')](_0x4937('0x8')),moment()['endOf'](_0x4937('0xd'))[_0x4937('0x7')]('YYYY-MM-DD\x20HH:mm:ss')]},'campaigntype':_0x4937('0x2')},'raw':![]},'log':_0x4937('0xb')});};};exports[_0x4937('0xe')]=function(){return function(){return client[_0x4937('0x4')](_0x4937('0xf'),{'options':{'where':{'createdAt':{'$between':[moment()['startOf'](_0x4937('0xd'))[_0x4937('0x7')]('YYYY-MM-DD\x20HH:mm:ss'),moment()[_0x4937('0x10')](_0x4937('0xd'))[_0x4937('0x7')](_0x4937('0x8'))]},'campaigntype':'ivr'},'raw':![]},'log':_0x4937('0xf')});};}; \ No newline at end of file diff --git a/server/services/ami/rpc/faxAccount.js b/server/services/ami/rpc/faxAccount.js index 95af727..632e105 100644 --- a/server/services/ami/rpc/faxAccount.js +++ b/server/services/ami/rpc/faxAccount.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0xf61e=['callerid','active','getFaxAccount','notify','NotifyFaxAccount','../client','getFaxAccounts','Request','GetFaxAccount','name','description','ecm','headerinfo','localstationid','minrate','maxrate','modem','faxdetect','t38timeout','TrunkId','ListId','key'];(function(_0x145eca,_0xadec6f){var _0x5e52b9=function(_0x254c86){while(--_0x254c86){_0x145eca['push'](_0x145eca['shift']());}};_0x5e52b9(++_0xadec6f);}(_0xf61e,0x191));var _0xef61=function(_0x2d60a8,_0x5ecd0c){_0x2d60a8=_0x2d60a8-0x0;var _0x59a395=_0xf61e[_0x2d60a8];return _0x59a395;};'use strict';var client=require(_0xef61('0x0'));exports[_0xef61('0x1')]=function(){return function(){return client[_0xef61('0x2')](_0xef61('0x3'),{'options':{'raw':![],'attributes':['id',_0xef61('0x4'),_0xef61('0x5'),_0xef61('0x6'),_0xef61('0x7'),_0xef61('0x8'),_0xef61('0x9'),_0xef61('0xa'),_0xef61('0xb'),'gateway',_0xef61('0xc'),_0xef61('0xd'),'tech',_0xef61('0xe'),_0xef61('0xf'),_0xef61('0x10')],'include':[{'model':'Trunk','as':'Trunk','attributes':['id',_0xef61('0x4'),_0xef61('0x11'),_0xef61('0x12')]}]},'log':_0xef61('0x13')});};};exports[_0xef61('0x14')]=function(_0xdcd707,_0x1394af){return client[_0xef61('0x2')](_0xef61('0x15'),{'account':{'id':_0xdcd707},'body':_0x1394af,'log':_0xef61('0x15')});}; \ No newline at end of file +var _0xa2cb=['Trunk','active','getFaxAccount','notify','Request','NotifyFaxAccount','../client','getFaxAccounts','GetFaxAccount','name','description','ecm','headerinfo','faxdetect','tech','ListId','key'];(function(_0x3dd15e,_0x1f0015){var _0x231fd0=function(_0x4f680a){while(--_0x4f680a){_0x3dd15e['push'](_0x3dd15e['shift']());}};_0x231fd0(++_0x1f0015);}(_0xa2cb,0x7d));var _0xba2c=function(_0x2e50b7,_0x435216){_0x2e50b7=_0x2e50b7-0x0;var _0x2ecd00=_0xa2cb[_0x2e50b7];return _0x2ecd00;};'use strict';var client=require(_0xba2c('0x0'));exports[_0xba2c('0x1')]=function(){return function(){return client['Request'](_0xba2c('0x2'),{'options':{'raw':![],'attributes':['id',_0xba2c('0x3'),_0xba2c('0x4'),_0xba2c('0x5'),_0xba2c('0x6'),'localstationid','minrate','maxrate','modem','gateway',_0xba2c('0x7'),'t38timeout',_0xba2c('0x8'),'TrunkId',_0xba2c('0x9'),_0xba2c('0xa')],'include':[{'model':'Trunk','as':_0xba2c('0xb'),'attributes':['id',_0xba2c('0x3'),'callerid',_0xba2c('0xc')]}]},'log':_0xba2c('0xd')});};};exports[_0xba2c('0xe')]=function(_0x15781e,_0x49a776){return client[_0xba2c('0xf')](_0xba2c('0x10'),{'account':{'id':_0x15781e},'body':_0x49a776,'log':_0xba2c('0x10')});}; \ No newline at end of file diff --git a/server/services/ami/rpc/faxMessage.js b/server/services/ami/rpc/faxMessage.js index f4aeb9e..622cbda 100644 --- a/server/services/ami/rpc/faxMessage.js +++ b/server/services/ami/rpc/faxMessage.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x085b=['UpdateFaxMessage'];(function(_0x202506,_0x5b9c15){var _0x4c3e29=function(_0x4b5698){while(--_0x4b5698){_0x202506['push'](_0x202506['shift']());}};_0x4c3e29(++_0x5b9c15);}(_0x085b,0x89));var _0xb085=function(_0x20c937,_0x3f8dc3){_0x20c937=_0x20c937-0x0;var _0x3b27a0=_0x085b[_0x20c937];return _0x3b27a0;};'use strict';var client=require('../client');exports['update']=function(_0x8e2296,_0x2ada52){return client['Request'](_0xb085('0x0'),{'body':_0x2ada52,'options':{'where':{'AttachmentId':_0x8e2296}},'log':_0xb085('0x0')});}; \ No newline at end of file +var _0x9824=['UpdateFaxMessage','../client','update','Request'];(function(_0x7577b9,_0x4fe21c){var _0x2660c8=function(_0x3f94ae){while(--_0x3f94ae){_0x7577b9['push'](_0x7577b9['shift']());}};_0x2660c8(++_0x4fe21c);}(_0x9824,0x91));var _0x4982=function(_0x1015f8,_0xa58762){_0x1015f8=_0x1015f8-0x0;var _0x56299a=_0x9824[_0x1015f8];return _0x56299a;};'use strict';var client=require(_0x4982('0x0'));exports[_0x4982('0x1')]=function(_0x2c7d4b,_0x7d49ee){return client[_0x4982('0x2')]('UpdateFaxMessage',{'body':_0x7d49ee,'options':{'where':{'AttachmentId':_0x2c7d4b}},'log':_0x4982('0x3')});}; \ No newline at end of file diff --git a/server/services/ami/rpc/integrations/desk.js b/server/services/ami/rpc/integrations/desk.js index bf8ab7d..02fe1b7 100644 --- a/server/services/ami/rpc/integrations/desk.js +++ b/server/services/ami/rpc/integrations/desk.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x8771=['keyType','keyContent','variableName','Fields','idField','customField','Tag','Tags','GetDeskAccount','../../client','getDeskAccounts','Request','name','description','password','remoteUri','authType','type','serverUrl','Configurations','DeskField','Subjects','content','Variable','Descriptions'];(function(_0x23ca2f,_0x271c2b){var _0x4f4b51=function(_0x1cb6c0){while(--_0x1cb6c0){_0x23ca2f['push'](_0x23ca2f['shift']());}};_0x4f4b51(++_0x271c2b);}(_0x8771,0x1cb));var _0x1877=function(_0x27b7d2,_0x56c091){_0x27b7d2=_0x27b7d2-0x0;var _0x3ef6be=_0x8771[_0x27b7d2];return _0x3ef6be;};'use strict';var client=require(_0x1877('0x0'));exports[_0x1877('0x1')]=function(){return function(_0x17bc5a){return client[_0x1877('0x2')]('GetDeskAccount',{'options':{'raw':![],'attributes':['id',_0x1877('0x3'),_0x1877('0x4'),'username',_0x1877('0x5'),_0x1877('0x6'),_0x1877('0x7'),_0x1877('0x8'),_0x1877('0x9')],'include':[{'model':'DeskConfiguration','as':_0x1877('0xa'),'attributes':['id',_0x1877('0x3')],'include':[{'model':_0x1877('0xb'),'as':_0x1877('0xc'),'attributes':['id','type',_0x1877('0xd'),'variableName'],'include':[{'model':'Variable','as':_0x1877('0xe'),'attributes':['id',_0x1877('0x3')]}]},{'model':'DeskField','as':_0x1877('0xf'),'attributes':['id',_0x1877('0x8'),'content','key',_0x1877('0x10'),_0x1877('0x11'),_0x1877('0x12')],'include':[{'model':_0x1877('0xe'),'as':_0x1877('0xe'),'attributes':['id',_0x1877('0x3')]}]},{'model':_0x1877('0xb'),'as':_0x1877('0x13'),'attributes':['id',_0x1877('0x8'),_0x1877('0xd'),_0x1877('0x14'),'nameField',_0x1877('0x15'),_0x1877('0x12')],'include':[{'model':_0x1877('0xe'),'as':_0x1877('0xe'),'attributes':['id','name']}]},{'model':_0x1877('0x16'),'as':_0x1877('0x17'),'attributes':['id',_0x1877('0x3')]}]}]},'log':_0x1877('0x18')});};}; \ No newline at end of file +var _0xe3b7=['variableName','key','keyType','keyContent','Variable','idField','nameField','customField','Tags','../../client','getDeskAccounts','GetDeskAccount','name','username','remoteUri','type','serverUrl','Configurations','DeskField','content'];(function(_0x1b6d49,_0x4f4d35){var _0xaeb1ec=function(_0x6b3bfd){while(--_0x6b3bfd){_0x1b6d49['push'](_0x1b6d49['shift']());}};_0xaeb1ec(++_0x4f4d35);}(_0xe3b7,0x6d));var _0x7e3b=function(_0x5416db,_0x55683a){_0x5416db=_0x5416db-0x0;var _0x243e35=_0xe3b7[_0x5416db];return _0x243e35;};'use strict';var client=require(_0x7e3b('0x0'));exports[_0x7e3b('0x1')]=function(){return function(_0x3f058f){return client['Request'](_0x7e3b('0x2'),{'options':{'raw':![],'attributes':['id',_0x7e3b('0x3'),'description',_0x7e3b('0x4'),'password',_0x7e3b('0x5'),'authType',_0x7e3b('0x6'),_0x7e3b('0x7')],'include':[{'model':'DeskConfiguration','as':_0x7e3b('0x8'),'attributes':['id',_0x7e3b('0x3')],'include':[{'model':_0x7e3b('0x9'),'as':'Subjects','attributes':['id','type',_0x7e3b('0xa'),_0x7e3b('0xb')],'include':[{'model':'Variable','as':'Variable','attributes':['id',_0x7e3b('0x3')]}]},{'model':_0x7e3b('0x9'),'as':'Descriptions','attributes':['id','type',_0x7e3b('0xa'),_0x7e3b('0xc'),_0x7e3b('0xd'),_0x7e3b('0xe'),_0x7e3b('0xb')],'include':[{'model':_0x7e3b('0xf'),'as':_0x7e3b('0xf'),'attributes':['id',_0x7e3b('0x3')]}]},{'model':_0x7e3b('0x9'),'as':'Fields','attributes':['id',_0x7e3b('0x6'),_0x7e3b('0xa'),_0x7e3b('0x10'),_0x7e3b('0x11'),_0x7e3b('0x12'),_0x7e3b('0xb')],'include':[{'model':_0x7e3b('0xf'),'as':'Variable','attributes':['id',_0x7e3b('0x3')]}]},{'model':'Tag','as':_0x7e3b('0x13'),'attributes':['id',_0x7e3b('0x3')]}]}]},'log':_0x7e3b('0x2')});};}; \ No newline at end of file diff --git a/server/services/ami/rpc/integrations/dynamics365.js b/server/services/ami/rpc/integrations/dynamics365.js index 9f85e8c..fbaad17 100644 --- a/server/services/ami/rpc/integrations/dynamics365.js +++ b/server/services/ami/rpc/integrations/dynamics365.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0xf65d=['key','keyType','Fields','idField','nameField','customField','CloudProvider','data5','data7','../../client','Request','GetDynamics365Account','name','username','password','clientSecret','description','modernAuthentication','Configurations','ticketType','moduleCreate','additionalSearchContact','openNewTab','Subjects','content','variableName','Variable','Dynamics365Field','Descriptions','type'];(function(_0x18ba2d,_0x2969a4){var _0x44e3cb=function(_0x515304){while(--_0x515304){_0x18ba2d['push'](_0x18ba2d['shift']());}};_0x44e3cb(++_0x2969a4);}(_0xf65d,0x9f));var _0xdf65=function(_0x5cca9f,_0x154684){_0x5cca9f=_0x5cca9f-0x0;var _0x55edda=_0xf65d[_0x5cca9f];return _0x55edda;};'use strict';var client=require(_0xdf65('0x0'));exports['getDynamics365Accounts']=function(){return function(_0x42bfd2){return client[_0xdf65('0x1')](_0xdf65('0x2'),{'options':{'raw':![],'attributes':['id',_0xdf65('0x3'),_0xdf65('0x4'),_0xdf65('0x5'),'remoteUri','tenantId','clientId',_0xdf65('0x6'),'serverUrl',_0xdf65('0x7'),_0xdf65('0x8')],'include':[{'model':'Dynamics365Configuration','as':_0xdf65('0x9'),'attributes':['id',_0xdf65('0x3'),_0xdf65('0xa'),_0xdf65('0xb'),_0xdf65('0xc'),_0xdf65('0xd')],'include':[{'model':'Dynamics365Field','as':_0xdf65('0xe'),'attributes':['id','type',_0xdf65('0xf'),_0xdf65('0x10')],'include':[{'model':_0xdf65('0x11'),'as':'Variable','attributes':['id','name']}]},{'model':_0xdf65('0x12'),'as':_0xdf65('0x13'),'attributes':['id',_0xdf65('0x14'),_0xdf65('0xf'),_0xdf65('0x15'),_0xdf65('0x16'),'keyContent',_0xdf65('0x10')],'include':[{'model':_0xdf65('0x11'),'as':'Variable','attributes':['id','name']}]},{'model':'Dynamics365Field','as':_0xdf65('0x17'),'attributes':['id',_0xdf65('0x14'),_0xdf65('0xf'),_0xdf65('0x18'),_0xdf65('0x19'),_0xdf65('0x1a'),_0xdf65('0x10')],'include':[{'model':_0xdf65('0x11'),'as':_0xdf65('0x11'),'attributes':['id',_0xdf65('0x3')]}]}]},{'model':'CloudProvider','as':_0xdf65('0x1b'),'attributes':['id','data2',_0xdf65('0x1c'),_0xdf65('0x1d')]}]},'log':_0xdf65('0x2')});};}; \ No newline at end of file +var _0x94e6=['Variable','Descriptions','keyType','variableName','Fields','idField','nameField','customField','CloudProvider','data2','data5','data7','../../client','Request','GetDynamics365Account','name','username','password','tenantId','clientId','description','modernAuthentication','Dynamics365Configuration','ticketType','Dynamics365Field','Subjects','type','content'];(function(_0x492af5,_0xd51471){var _0x59f529=function(_0x40c9aa){while(--_0x40c9aa){_0x492af5['push'](_0x492af5['shift']());}};_0x59f529(++_0xd51471);}(_0x94e6,0x194));var _0x694e=function(_0x1c1b6d,_0x41951f){_0x1c1b6d=_0x1c1b6d-0x0;var _0x3e0d11=_0x94e6[_0x1c1b6d];return _0x3e0d11;};'use strict';var client=require(_0x694e('0x0'));exports['getDynamics365Accounts']=function(){return function(_0x32423f){return client[_0x694e('0x1')](_0x694e('0x2'),{'options':{'raw':![],'attributes':['id',_0x694e('0x3'),_0x694e('0x4'),_0x694e('0x5'),'remoteUri',_0x694e('0x6'),_0x694e('0x7'),'clientSecret','serverUrl',_0x694e('0x8'),_0x694e('0x9')],'include':[{'model':_0x694e('0xa'),'as':'Configurations','attributes':['id','name',_0x694e('0xb'),'moduleCreate','additionalSearchContact','openNewTab'],'include':[{'model':_0x694e('0xc'),'as':_0x694e('0xd'),'attributes':['id',_0x694e('0xe'),_0x694e('0xf'),'variableName'],'include':[{'model':_0x694e('0x10'),'as':_0x694e('0x10'),'attributes':['id','name']}]},{'model':_0x694e('0xc'),'as':_0x694e('0x11'),'attributes':['id',_0x694e('0xe'),_0x694e('0xf'),'key',_0x694e('0x12'),'keyContent',_0x694e('0x13')],'include':[{'model':_0x694e('0x10'),'as':_0x694e('0x10'),'attributes':['id',_0x694e('0x3')]}]},{'model':_0x694e('0xc'),'as':_0x694e('0x14'),'attributes':['id',_0x694e('0xe'),_0x694e('0xf'),_0x694e('0x15'),_0x694e('0x16'),_0x694e('0x17'),_0x694e('0x13')],'include':[{'model':_0x694e('0x10'),'as':'Variable','attributes':['id',_0x694e('0x3')]}]}]},{'model':_0x694e('0x18'),'as':_0x694e('0x18'),'attributes':['id',_0x694e('0x19'),_0x694e('0x1a'),_0x694e('0x1b')]}]},'log':_0x694e('0x2')});};}; \ No newline at end of file diff --git a/server/services/ami/rpc/integrations/freshdesk.js b/server/services/ami/rpc/integrations/freshdesk.js index b617b9e..5b5690d 100644 --- a/server/services/ami/rpc/integrations/freshdesk.js +++ b/server/services/ami/rpc/integrations/freshdesk.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x2964=['type','content','variableName','Variable','Descriptions','key','keyType','Fields','idField','nameField','customField','../../client','getFreshdeskAccounts','Request','GetFreshdeskAccount','name','username','apiKey','remoteUri','FreshdeskConfiguration','Configurations','Tag','FreshdeskField'];(function(_0x44b5f6,_0xa66e98){var _0x439ac8=function(_0x236f6f){while(--_0x236f6f){_0x44b5f6['push'](_0x44b5f6['shift']());}};_0x439ac8(++_0xa66e98);}(_0x2964,0x108));var _0x4296=function(_0x45312c,_0x32ad2f){_0x45312c=_0x45312c-0x0;var _0x246131=_0x2964[_0x45312c];return _0x246131;};'use strict';var client=require(_0x4296('0x0'));exports[_0x4296('0x1')]=function(){return function(_0x31be5e){return client[_0x4296('0x2')](_0x4296('0x3'),{'options':{'raw':![],'attributes':['id',_0x4296('0x4'),_0x4296('0x5'),_0x4296('0x6'),_0x4296('0x7'),'serverUrl'],'include':[{'model':_0x4296('0x8'),'as':_0x4296('0x9'),'attributes':['id',_0x4296('0x4')],'include':[{'model':_0x4296('0xa'),'attributes':['id',_0x4296('0x4')]},{'model':_0x4296('0xb'),'as':'Subjects','attributes':['id',_0x4296('0xc'),_0x4296('0xd'),_0x4296('0xe')],'include':[{'model':_0x4296('0xf'),'as':_0x4296('0xf'),'attributes':['id',_0x4296('0x4')]}]},{'model':_0x4296('0xb'),'as':_0x4296('0x10'),'attributes':['id',_0x4296('0xc'),_0x4296('0xd'),_0x4296('0x11'),_0x4296('0x12'),'keyContent',_0x4296('0xe')],'include':[{'model':_0x4296('0xf'),'as':_0x4296('0xf'),'attributes':['id',_0x4296('0x4')]}]},{'model':_0x4296('0xb'),'as':_0x4296('0x13'),'attributes':['id',_0x4296('0xc'),'content',_0x4296('0x14'),_0x4296('0x15'),_0x4296('0x16'),'variableName'],'include':[{'model':_0x4296('0xf'),'as':_0x4296('0xf'),'attributes':['id',_0x4296('0x4')]}]}]}]},'log':'GetFreshdeskAccount'});};}; \ No newline at end of file +var _0xe1e3=['nameField','customField','GetFreshdeskAccount','../../client','getFreshdeskAccounts','Request','username','remoteUri','serverUrl','FreshdeskConfiguration','Configurations','name','Tag','FreshdeskField','Subjects','type','content','variableName','Variable','Descriptions','key','keyType'];(function(_0x339028,_0x5d0d7b){var _0x3ee8cb=function(_0x1fe47a){while(--_0x1fe47a){_0x339028['push'](_0x339028['shift']());}};_0x3ee8cb(++_0x5d0d7b);}(_0xe1e3,0x1bb));var _0x3e1e=function(_0x51e987,_0x3509fe){_0x51e987=_0x51e987-0x0;var _0x5af0bb=_0xe1e3[_0x51e987];return _0x5af0bb;};'use strict';var client=require(_0x3e1e('0x0'));exports[_0x3e1e('0x1')]=function(){return function(_0x55659f){return client[_0x3e1e('0x2')]('GetFreshdeskAccount',{'options':{'raw':![],'attributes':['id','name',_0x3e1e('0x3'),'apiKey',_0x3e1e('0x4'),_0x3e1e('0x5')],'include':[{'model':_0x3e1e('0x6'),'as':_0x3e1e('0x7'),'attributes':['id',_0x3e1e('0x8')],'include':[{'model':_0x3e1e('0x9'),'attributes':['id','name']},{'model':_0x3e1e('0xa'),'as':_0x3e1e('0xb'),'attributes':['id',_0x3e1e('0xc'),_0x3e1e('0xd'),_0x3e1e('0xe')],'include':[{'model':_0x3e1e('0xf'),'as':'Variable','attributes':['id','name']}]},{'model':'FreshdeskField','as':_0x3e1e('0x10'),'attributes':['id','type',_0x3e1e('0xd'),_0x3e1e('0x11'),_0x3e1e('0x12'),'keyContent',_0x3e1e('0xe')],'include':[{'model':'Variable','as':'Variable','attributes':['id','name']}]},{'model':'FreshdeskField','as':'Fields','attributes':['id',_0x3e1e('0xc'),'content','idField',_0x3e1e('0x13'),_0x3e1e('0x14'),_0x3e1e('0xe')],'include':[{'model':'Variable','as':'Variable','attributes':['id',_0x3e1e('0x8')]}]}]}]},'log':_0x3e1e('0x15')});};}; \ No newline at end of file diff --git a/server/services/ami/rpc/integrations/freshsales.js b/server/services/ami/rpc/integrations/freshsales.js index 170e25c..cf4f716 100644 --- a/server/services/ami/rpc/integrations/freshsales.js +++ b/server/services/ami/rpc/integrations/freshsales.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x9f5a=['keyType','GetFreshsalesccount','../../client','getFreshsalesAccounts','Request','name','username','apiKey','serverUrl','Configurations','Subjects','type','content','variableName','Variable','Descriptions','key'];(function(_0x3c2d04,_0x364734){var _0x5415c2=function(_0x1091d5){while(--_0x1091d5){_0x3c2d04['push'](_0x3c2d04['shift']());}};_0x5415c2(++_0x364734);}(_0x9f5a,0xbd));var _0xa9f5=function(_0x7893c6,_0x1cf1e9){_0x7893c6=_0x7893c6-0x0;var _0x28aade=_0x9f5a[_0x7893c6];return _0x28aade;};'use strict';var client=require(_0xa9f5('0x0'));exports[_0xa9f5('0x1')]=function(){return function(_0x218f89){return client[_0xa9f5('0x2')]('GetFreshsalesAccount',{'options':{'raw':![],'attributes':['id',_0xa9f5('0x3'),_0xa9f5('0x4'),_0xa9f5('0x5'),'remoteUri',_0xa9f5('0x6')],'include':[{'model':'FreshsalesConfiguration','as':_0xa9f5('0x7'),'attributes':['id',_0xa9f5('0x3')],'include':[{'model':'FreshsalesField','as':_0xa9f5('0x8'),'attributes':['id',_0xa9f5('0x9'),_0xa9f5('0xa'),_0xa9f5('0xb')],'include':[{'model':_0xa9f5('0xc'),'as':_0xa9f5('0xc'),'attributes':['id',_0xa9f5('0x3')]}]},{'model':'FreshsalesField','as':_0xa9f5('0xd'),'attributes':['id',_0xa9f5('0x9'),'content',_0xa9f5('0xe'),_0xa9f5('0xf'),'keyContent','variableName'],'include':[{'model':_0xa9f5('0xc'),'as':_0xa9f5('0xc'),'attributes':['id',_0xa9f5('0x3')]}]}]}]},'log':_0xa9f5('0x10')});};}; \ No newline at end of file +var _0x723e=['name','username','apiKey','remoteUri','serverUrl','FreshsalesConfiguration','FreshsalesField','Subjects','type','content','variableName','Variable','Descriptions','key','keyType','keyContent','GetFreshsalesccount','getFreshsalesAccounts','Request','GetFreshsalesAccount'];(function(_0x345ce9,_0x3945cf){var _0x42a312=function(_0x3d8685){while(--_0x3d8685){_0x345ce9['push'](_0x345ce9['shift']());}};_0x42a312(++_0x3945cf);}(_0x723e,0x179));var _0xe723=function(_0x5cf0a6,_0x24b92f){_0x5cf0a6=_0x5cf0a6-0x0;var _0x3e8375=_0x723e[_0x5cf0a6];return _0x3e8375;};'use strict';var client=require('../../client');exports[_0xe723('0x0')]=function(){return function(_0x95eab5){return client[_0xe723('0x1')](_0xe723('0x2'),{'options':{'raw':![],'attributes':['id',_0xe723('0x3'),_0xe723('0x4'),_0xe723('0x5'),_0xe723('0x6'),_0xe723('0x7')],'include':[{'model':_0xe723('0x8'),'as':'Configurations','attributes':['id',_0xe723('0x3')],'include':[{'model':_0xe723('0x9'),'as':_0xe723('0xa'),'attributes':['id',_0xe723('0xb'),_0xe723('0xc'),_0xe723('0xd')],'include':[{'model':_0xe723('0xe'),'as':_0xe723('0xe'),'attributes':['id','name']}]},{'model':_0xe723('0x9'),'as':_0xe723('0xf'),'attributes':['id',_0xe723('0xb'),'content',_0xe723('0x10'),_0xe723('0x11'),_0xe723('0x12'),'variableName'],'include':[{'model':_0xe723('0xe'),'as':_0xe723('0xe'),'attributes':['id',_0xe723('0x3')]}]}]}]},'log':_0xe723('0x13')});};}; \ No newline at end of file diff --git a/server/services/ami/rpc/integrations/salesforce.js b/server/services/ami/rpc/integrations/salesforce.js index b90b5f7..e9f192b 100644 --- a/server/services/ami/rpc/integrations/salesforce.js +++ b/server/services/ami/rpc/integrations/salesforce.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0xc306=['Subjects','SalesforceField','Descriptions','Variable','Fields','../../client','Request','GetSalesforceAccount','name','username','remoteUri','clientSecret','securityToken','serverUrl','type','SalesforceConfiguration','Configurations','moduleCreate','ticketType','leadId','additionalSearchContact'];(function(_0x3c621b,_0x8c5275){var _0x1fc19b=function(_0x318029){while(--_0x318029){_0x3c621b['push'](_0x3c621b['shift']());}};_0x1fc19b(++_0x8c5275);}(_0xc306,0x1a9));var _0x6c30=function(_0x3513bd,_0x295038){_0x3513bd=_0x3513bd-0x0;var _0x4c33b8=_0xc306[_0x3513bd];return _0x4c33b8;};'use strict';var client=require(_0x6c30('0x0'));exports['getSalesforceAccounts']=function(){return function(_0x46ca00){return client[_0x6c30('0x1')](_0x6c30('0x2'),{'options':{'raw':![],'attributes':['id',_0x6c30('0x3'),_0x6c30('0x4'),'password',_0x6c30('0x5'),'clientId',_0x6c30('0x6'),_0x6c30('0x7'),_0x6c30('0x8'),_0x6c30('0x9')],'include':[{'model':_0x6c30('0xa'),'as':_0x6c30('0xb'),'attributes':['id',_0x6c30('0x3'),'moduleSearch',_0x6c30('0xc'),_0x6c30('0xd'),_0x6c30('0xe'),'additionalSearchAccount',_0x6c30('0xf'),'additionalSearchLead'],'include':[{'model':'SalesforceField','as':_0x6c30('0x10'),'include':[{'model':'Variable','as':'Variable','attributes':['id','name']}]},{'model':_0x6c30('0x11'),'as':_0x6c30('0x12'),'include':[{'model':_0x6c30('0x13'),'as':'Variable','attributes':['id',_0x6c30('0x3')]}]},{'model':'SalesforceField','as':_0x6c30('0x14'),'include':[{'model':'Variable','as':'Variable','attributes':['id',_0x6c30('0x3')]}]}]}]},'log':_0x6c30('0x2')});};}; \ No newline at end of file +var _0x7f48=['password','clientId','clientSecret','securityToken','SalesforceConfiguration','Configurations','moduleSearch','moduleCreate','ticketType','leadId','additionalSearchAccount','additionalSearchContact','additionalSearchLead','SalesforceField','Subjects','Variable','name','Fields','../../client','getSalesforceAccounts','Request','username'];(function(_0x5c3854,_0x3cc982){var _0x3f1c1b=function(_0x10ba05){while(--_0x10ba05){_0x5c3854['push'](_0x5c3854['shift']());}};_0x3f1c1b(++_0x3cc982);}(_0x7f48,0xac));var _0x87f4=function(_0x187ee1,_0x3fd1e6){_0x187ee1=_0x187ee1-0x0;var _0x388160=_0x7f48[_0x187ee1];return _0x388160;};'use strict';var client=require(_0x87f4('0x0'));exports[_0x87f4('0x1')]=function(){return function(_0x514279){return client[_0x87f4('0x2')]('GetSalesforceAccount',{'options':{'raw':![],'attributes':['id','name',_0x87f4('0x3'),_0x87f4('0x4'),'remoteUri',_0x87f4('0x5'),_0x87f4('0x6'),_0x87f4('0x7'),'serverUrl','type'],'include':[{'model':_0x87f4('0x8'),'as':_0x87f4('0x9'),'attributes':['id','name',_0x87f4('0xa'),_0x87f4('0xb'),_0x87f4('0xc'),_0x87f4('0xd'),_0x87f4('0xe'),_0x87f4('0xf'),_0x87f4('0x10')],'include':[{'model':_0x87f4('0x11'),'as':_0x87f4('0x12'),'include':[{'model':_0x87f4('0x13'),'as':'Variable','attributes':['id',_0x87f4('0x14')]}]},{'model':_0x87f4('0x11'),'as':'Descriptions','include':[{'model':_0x87f4('0x13'),'as':'Variable','attributes':['id',_0x87f4('0x14')]}]},{'model':_0x87f4('0x11'),'as':_0x87f4('0x15'),'include':[{'model':'Variable','as':_0x87f4('0x13'),'attributes':['id',_0x87f4('0x14')]}]}]}]},'log':'GetSalesforceAccount'});};}; \ No newline at end of file diff --git a/server/services/ami/rpc/integrations/servicenow.js b/server/services/ami/rpc/integrations/servicenow.js index d48ec97..859b4b5 100644 --- a/server/services/ami/rpc/integrations/servicenow.js +++ b/server/services/ami/rpc/integrations/servicenow.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0xc4aa=['keyContent','Fields','content','idField','nameField','customField','GetServicenowkAccount','../../client','getServicenowAccounts','Request','GetServicenowAccount','name','email','remoteUri','serverUrl','ServicenowConfiguration','Configurations','ServicenowField','Subjects','variableName','Variable','Descriptions','type','key'];(function(_0x5b3aea,_0x5bc599){var _0xe3042f=function(_0x2c3869){while(--_0x2c3869){_0x5b3aea['push'](_0x5b3aea['shift']());}};_0xe3042f(++_0x5bc599);}(_0xc4aa,0x1b7));var _0xac4a=function(_0x42cae2,_0x284ef8){_0x42cae2=_0x42cae2-0x0;var _0x5f256f=_0xc4aa[_0x42cae2];return _0x5f256f;};'use strict';var client=require(_0xac4a('0x0'));exports[_0xac4a('0x1')]=function(){return function(_0x40a0d0){return client[_0xac4a('0x2')](_0xac4a('0x3'),{'options':{'raw':![],'attributes':['id',_0xac4a('0x4'),'description','username','password',_0xac4a('0x5'),_0xac4a('0x6'),_0xac4a('0x7')],'include':[{'model':_0xac4a('0x8'),'as':_0xac4a('0x9'),'attributes':['id',_0xac4a('0x4')],'include':[{'model':_0xac4a('0xa'),'as':_0xac4a('0xb'),'attributes':['id','type','content',_0xac4a('0xc')],'include':[{'model':_0xac4a('0xd'),'as':_0xac4a('0xd'),'attributes':['id','name']}]},{'model':_0xac4a('0xa'),'as':_0xac4a('0xe'),'attributes':['id',_0xac4a('0xf'),'content',_0xac4a('0x10'),'keyType',_0xac4a('0x11'),'variableName'],'include':[{'model':_0xac4a('0xd'),'as':_0xac4a('0xd'),'attributes':['id',_0xac4a('0x4')]}]},{'model':'ServicenowField','as':_0xac4a('0x12'),'attributes':['id',_0xac4a('0xf'),_0xac4a('0x13'),_0xac4a('0x14'),_0xac4a('0x15'),_0xac4a('0x16'),_0xac4a('0xc')],'include':[{'model':_0xac4a('0xd'),'as':_0xac4a('0xd'),'attributes':['id',_0xac4a('0x4')]}]}]}]},'log':_0xac4a('0x17')});};}; \ No newline at end of file +var _0x7a54=['GetServicenowAccount','name','username','password','email','remoteUri','serverUrl','Configurations','ServicenowField','Subjects','content','type','keyType','keyContent','variableName','Variable','idField','nameField','customField','GetServicenowkAccount','../../client','getServicenowAccounts'];(function(_0x230e39,_0x5341){var _0xa804e=function(_0xe14796){while(--_0xe14796){_0x230e39['push'](_0x230e39['shift']());}};_0xa804e(++_0x5341);}(_0x7a54,0x106));var _0x47a5=function(_0x39b83f,_0x1642bf){_0x39b83f=_0x39b83f-0x0;var _0x34a513=_0x7a54[_0x39b83f];return _0x34a513;};'use strict';var client=require(_0x47a5('0x0'));exports[_0x47a5('0x1')]=function(){return function(_0x44b31e){return client['Request'](_0x47a5('0x2'),{'options':{'raw':![],'attributes':['id',_0x47a5('0x3'),'description',_0x47a5('0x4'),_0x47a5('0x5'),_0x47a5('0x6'),_0x47a5('0x7'),_0x47a5('0x8')],'include':[{'model':'ServicenowConfiguration','as':_0x47a5('0x9'),'attributes':['id','name'],'include':[{'model':_0x47a5('0xa'),'as':_0x47a5('0xb'),'attributes':['id','type',_0x47a5('0xc'),'variableName'],'include':[{'model':'Variable','as':'Variable','attributes':['id',_0x47a5('0x3')]}]},{'model':_0x47a5('0xa'),'as':'Descriptions','attributes':['id',_0x47a5('0xd'),'content','key',_0x47a5('0xe'),_0x47a5('0xf'),_0x47a5('0x10')],'include':[{'model':_0x47a5('0x11'),'as':_0x47a5('0x11'),'attributes':['id',_0x47a5('0x3')]}]},{'model':_0x47a5('0xa'),'as':'Fields','attributes':['id',_0x47a5('0xd'),_0x47a5('0xc'),_0x47a5('0x12'),_0x47a5('0x13'),_0x47a5('0x14'),_0x47a5('0x10')],'include':[{'model':_0x47a5('0x11'),'as':_0x47a5('0x11'),'attributes':['id','name']}]}]}]},'log':_0x47a5('0x15')});};}; \ No newline at end of file diff --git a/server/services/ami/rpc/integrations/sugarcrm.js b/server/services/ami/rpc/integrations/sugarcrm.js index 36c0dc5..95809e1 100644 --- a/server/services/ami/rpc/integrations/sugarcrm.js +++ b/server/services/ami/rpc/integrations/sugarcrm.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x1967=['serverUrl','SugarcrmConfiguration','SugarcrmField','Subjects','type','content','variableName','Variable','Descriptions','keyType','keyContent','Fields','idField','customField','getSugarcrmAccounts','Request','GetSugarcrmAccount','name','username','password','remoteUri'];(function(_0x2e06db,_0xdddf5a){var _0x28fd9a=function(_0x272b09){while(--_0x272b09){_0x2e06db['push'](_0x2e06db['shift']());}};_0x28fd9a(++_0xdddf5a);}(_0x1967,0x173));var _0x7196=function(_0x3d9bb4,_0xf906e3){_0x3d9bb4=_0x3d9bb4-0x0;var _0x5f4e6a=_0x1967[_0x3d9bb4];return _0x5f4e6a;};'use strict';var client=require('../../client');exports[_0x7196('0x0')]=function(){return function(_0xdb72bb){return client[_0x7196('0x1')](_0x7196('0x2'),{'options':{'raw':![],'attributes':['id',_0x7196('0x3'),_0x7196('0x4'),_0x7196('0x5'),_0x7196('0x6'),_0x7196('0x7')],'include':[{'model':_0x7196('0x8'),'as':'Configurations','attributes':['id',_0x7196('0x3')],'include':[{'model':_0x7196('0x9'),'as':_0x7196('0xa'),'attributes':['id',_0x7196('0xb'),_0x7196('0xc'),_0x7196('0xd')],'include':[{'model':'Variable','as':_0x7196('0xe'),'attributes':['id',_0x7196('0x3')]}]},{'model':_0x7196('0x9'),'as':_0x7196('0xf'),'attributes':['id',_0x7196('0xb'),'content','key',_0x7196('0x10'),_0x7196('0x11'),_0x7196('0xd')],'include':[{'model':_0x7196('0xe'),'as':_0x7196('0xe'),'attributes':['id',_0x7196('0x3')]}]},{'model':_0x7196('0x9'),'as':_0x7196('0x12'),'attributes':['id',_0x7196('0xb'),_0x7196('0xc'),_0x7196('0x13'),'nameField',_0x7196('0x14'),_0x7196('0xd')],'include':[{'model':_0x7196('0xe'),'as':_0x7196('0xe'),'attributes':['id','name']}]}]}]},'log':_0x7196('0x2')});};}; \ No newline at end of file +var _0x2ef3=['SugarcrmField','Descriptions','keyType','keyContent','Fields','idField','../../client','getSugarcrmAccounts','Request','GetSugarcrmAccount','name','password','remoteUri','SugarcrmConfiguration','Configurations','Subjects','type','content','variableName','Variable'];(function(_0x422559,_0x431db3){var _0x33b51a=function(_0x125e43){while(--_0x125e43){_0x422559['push'](_0x422559['shift']());}};_0x33b51a(++_0x431db3);}(_0x2ef3,0xba));var _0x32ef=function(_0x2e99a0,_0x3ad317){_0x2e99a0=_0x2e99a0-0x0;var _0x2ce6a0=_0x2ef3[_0x2e99a0];return _0x2ce6a0;};'use strict';var client=require(_0x32ef('0x0'));exports[_0x32ef('0x1')]=function(){return function(_0x47513a){return client[_0x32ef('0x2')](_0x32ef('0x3'),{'options':{'raw':![],'attributes':['id',_0x32ef('0x4'),'username',_0x32ef('0x5'),_0x32ef('0x6'),'serverUrl'],'include':[{'model':_0x32ef('0x7'),'as':_0x32ef('0x8'),'attributes':['id','name'],'include':[{'model':'SugarcrmField','as':_0x32ef('0x9'),'attributes':['id',_0x32ef('0xa'),_0x32ef('0xb'),_0x32ef('0xc')],'include':[{'model':_0x32ef('0xd'),'as':_0x32ef('0xd'),'attributes':['id',_0x32ef('0x4')]}]},{'model':_0x32ef('0xe'),'as':_0x32ef('0xf'),'attributes':['id',_0x32ef('0xa'),'content','key',_0x32ef('0x10'),_0x32ef('0x11'),_0x32ef('0xc')],'include':[{'model':_0x32ef('0xd'),'as':'Variable','attributes':['id',_0x32ef('0x4')]}]},{'model':'SugarcrmField','as':_0x32ef('0x12'),'attributes':['id','type',_0x32ef('0xb'),_0x32ef('0x13'),'nameField','customField',_0x32ef('0xc')],'include':[{'model':'Variable','as':_0x32ef('0xd'),'attributes':['id',_0x32ef('0x4')]}]}]}]},'log':_0x32ef('0x3')});};}; \ No newline at end of file diff --git a/server/services/ami/rpc/integrations/vtiger.js b/server/services/ami/rpc/integrations/vtiger.js index 49b38d2..ed313cd 100644 --- a/server/services/ami/rpc/integrations/vtiger.js +++ b/server/services/ami/rpc/integrations/vtiger.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0xdbd9=['Fields','idField','customField','../../client','getVtigerAccounts','GetVtigerAccount','name','description','username','remoteUri','serverUrl','Configurations','VtigerField','Subjects','type','content','variableName','Descriptions','keyType','keyContent','Variable'];(function(_0x49a4a1,_0x54d8d6){var _0x1956e9=function(_0x557a61){while(--_0x557a61){_0x49a4a1['push'](_0x49a4a1['shift']());}};_0x1956e9(++_0x54d8d6);}(_0xdbd9,0xc0));var _0x9dbd=function(_0x4924c4,_0x1c9478){_0x4924c4=_0x4924c4-0x0;var _0x2149a=_0xdbd9[_0x4924c4];return _0x2149a;};'use strict';var client=require(_0x9dbd('0x0'));exports[_0x9dbd('0x1')]=function(){return function(_0x1d952e){return client['Request'](_0x9dbd('0x2'),{'options':{'raw':![],'attributes':['id',_0x9dbd('0x3'),_0x9dbd('0x4'),_0x9dbd('0x5'),'accessKey',_0x9dbd('0x6'),_0x9dbd('0x7')],'include':[{'model':'VtigerConfiguration','as':_0x9dbd('0x8'),'attributes':['id','name'],'include':[{'model':_0x9dbd('0x9'),'as':_0x9dbd('0xa'),'attributes':['id',_0x9dbd('0xb'),_0x9dbd('0xc'),_0x9dbd('0xd')],'include':[{'model':'Variable','as':'Variable','attributes':['id',_0x9dbd('0x3')]}]},{'model':_0x9dbd('0x9'),'as':_0x9dbd('0xe'),'attributes':['id',_0x9dbd('0xb'),'content','key',_0x9dbd('0xf'),_0x9dbd('0x10'),'variableName'],'include':[{'model':_0x9dbd('0x11'),'as':_0x9dbd('0x11'),'attributes':['id','name']}]},{'model':_0x9dbd('0x9'),'as':_0x9dbd('0x12'),'attributes':['id',_0x9dbd('0xb'),'content',_0x9dbd('0x13'),'nameField',_0x9dbd('0x14'),'variableName'],'include':[{'model':'Variable','as':_0x9dbd('0x11'),'attributes':['id',_0x9dbd('0x3')]}]}]}]},'log':_0x9dbd('0x2')});};}; \ No newline at end of file +var _0xf2b2=['Configurations','name','VtigerField','type','content','variableName','Variable','Descriptions','key','keyType','keyContent','idField','nameField','GetVtigerAccount','../../client','getVtigerAccounts','description','remoteUri','serverUrl','VtigerConfiguration'];(function(_0x56e0e8,_0x16ef91){var _0x2dab50=function(_0x4fe720){while(--_0x4fe720){_0x56e0e8['push'](_0x56e0e8['shift']());}};_0x2dab50(++_0x16ef91);}(_0xf2b2,0x14e));var _0x2f2b=function(_0x415b48,_0xefb24c){_0x415b48=_0x415b48-0x0;var _0x1465e8=_0xf2b2[_0x415b48];return _0x1465e8;};'use strict';var client=require(_0x2f2b('0x0'));exports[_0x2f2b('0x1')]=function(){return function(_0x1ca1f6){return client['Request']('GetVtigerAccount',{'options':{'raw':![],'attributes':['id','name',_0x2f2b('0x2'),'username','accessKey',_0x2f2b('0x3'),_0x2f2b('0x4')],'include':[{'model':_0x2f2b('0x5'),'as':_0x2f2b('0x6'),'attributes':['id',_0x2f2b('0x7')],'include':[{'model':_0x2f2b('0x8'),'as':'Subjects','attributes':['id',_0x2f2b('0x9'),_0x2f2b('0xa'),_0x2f2b('0xb')],'include':[{'model':_0x2f2b('0xc'),'as':_0x2f2b('0xc'),'attributes':['id',_0x2f2b('0x7')]}]},{'model':_0x2f2b('0x8'),'as':_0x2f2b('0xd'),'attributes':['id','type',_0x2f2b('0xa'),_0x2f2b('0xe'),_0x2f2b('0xf'),_0x2f2b('0x10'),_0x2f2b('0xb')],'include':[{'model':_0x2f2b('0xc'),'as':_0x2f2b('0xc'),'attributes':['id',_0x2f2b('0x7')]}]},{'model':_0x2f2b('0x8'),'as':'Fields','attributes':['id',_0x2f2b('0x9'),_0x2f2b('0xa'),_0x2f2b('0x11'),_0x2f2b('0x12'),'customField',_0x2f2b('0xb')],'include':[{'model':_0x2f2b('0xc'),'as':_0x2f2b('0xc'),'attributes':['id',_0x2f2b('0x7')]}]}]}]},'log':_0x2f2b('0x13')});};}; \ No newline at end of file diff --git a/server/services/ami/rpc/integrations/zendesk.js b/server/services/ami/rpc/integrations/zendesk.js index 88428e6..b7f31c9 100644 --- a/server/services/ami/rpc/integrations/zendesk.js +++ b/server/services/ami/rpc/integrations/zendesk.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0xe5e7=['name','username','password','remoteUri','authType','serverUrl','type','ZendeskConfiguration','Configurations','Tag','Subjects','variableName','Variable','Descriptions','content','key','keyType','keyContent','ZendeskField','Fields','idField','customField','GetZendeskAccount','../../client','getZendeskAccounts','Request'];(function(_0x14add3,_0x13ce8d){var _0x4a174f=function(_0x2b3ed7){while(--_0x2b3ed7){_0x14add3['push'](_0x14add3['shift']());}};_0x4a174f(++_0x13ce8d);}(_0xe5e7,0x1eb));var _0x7e5e=function(_0x3f31de,_0x26c218){_0x3f31de=_0x3f31de-0x0;var _0x5dba7f=_0xe5e7[_0x3f31de];return _0x5dba7f;};'use strict';var client=require(_0x7e5e('0x0'));exports[_0x7e5e('0x1')]=function(){return function(_0x175fe9){return client[_0x7e5e('0x2')]('GetZendeskAccount',{'options':{'raw':![],'attributes':['id',_0x7e5e('0x3'),_0x7e5e('0x4'),_0x7e5e('0x5'),'token',_0x7e5e('0x6'),_0x7e5e('0x7'),_0x7e5e('0x8'),_0x7e5e('0x9')],'include':[{'model':_0x7e5e('0xa'),'as':_0x7e5e('0xb'),'attributes':['id','name'],'include':[{'model':_0x7e5e('0xc'),'attributes':['id',_0x7e5e('0x3')]},{'model':'ZendeskField','as':_0x7e5e('0xd'),'attributes':['id',_0x7e5e('0x9'),'content',_0x7e5e('0xe')],'include':[{'model':_0x7e5e('0xf'),'as':'Variable','attributes':['id',_0x7e5e('0x3')]}]},{'model':'ZendeskField','as':_0x7e5e('0x10'),'attributes':['id',_0x7e5e('0x9'),_0x7e5e('0x11'),_0x7e5e('0x12'),_0x7e5e('0x13'),_0x7e5e('0x14'),_0x7e5e('0xe')],'include':[{'model':_0x7e5e('0xf'),'as':_0x7e5e('0xf'),'attributes':['id',_0x7e5e('0x3')]}]},{'model':_0x7e5e('0x15'),'as':_0x7e5e('0x16'),'attributes':['id','type',_0x7e5e('0x11'),_0x7e5e('0x17'),'nameField',_0x7e5e('0x18'),_0x7e5e('0xe')],'include':[{'model':_0x7e5e('0xf'),'as':_0x7e5e('0xf'),'attributes':['id',_0x7e5e('0x3')]}]}]}]},'log':_0x7e5e('0x19')});};}; \ No newline at end of file +var _0xea05=['variableName','idField','nameField','customField','../../client','getZendeskAccounts','Request','GetZendeskAccount','name','username','password','token','authType','type','Tag','ZendeskField','content','Variable','Descriptions'];(function(_0x1986b9,_0x2259a6){var _0x55b610=function(_0xa915e0){while(--_0xa915e0){_0x1986b9['push'](_0x1986b9['shift']());}};_0x55b610(++_0x2259a6);}(_0xea05,0x1df));var _0x5ea0=function(_0x343ed6,_0x23347d){_0x343ed6=_0x343ed6-0x0;var _0x38fa22=_0xea05[_0x343ed6];return _0x38fa22;};'use strict';var client=require(_0x5ea0('0x0'));exports[_0x5ea0('0x1')]=function(){return function(_0x1c062f){return client[_0x5ea0('0x2')](_0x5ea0('0x3'),{'options':{'raw':![],'attributes':['id',_0x5ea0('0x4'),_0x5ea0('0x5'),_0x5ea0('0x6'),_0x5ea0('0x7'),'remoteUri',_0x5ea0('0x8'),'serverUrl',_0x5ea0('0x9')],'include':[{'model':'ZendeskConfiguration','as':'Configurations','attributes':['id',_0x5ea0('0x4')],'include':[{'model':_0x5ea0('0xa'),'attributes':['id','name']},{'model':_0x5ea0('0xb'),'as':'Subjects','attributes':['id',_0x5ea0('0x9'),_0x5ea0('0xc'),'variableName'],'include':[{'model':_0x5ea0('0xd'),'as':_0x5ea0('0xd'),'attributes':['id','name']}]},{'model':_0x5ea0('0xb'),'as':_0x5ea0('0xe'),'attributes':['id',_0x5ea0('0x9'),_0x5ea0('0xc'),'key','keyType','keyContent',_0x5ea0('0xf')],'include':[{'model':_0x5ea0('0xd'),'as':_0x5ea0('0xd'),'attributes':['id','name']}]},{'model':'ZendeskField','as':'Fields','attributes':['id',_0x5ea0('0x9'),_0x5ea0('0xc'),_0x5ea0('0x10'),_0x5ea0('0x11'),_0x5ea0('0x12'),'variableName'],'include':[{'model':_0x5ea0('0xd'),'as':_0x5ea0('0xd'),'attributes':['id','name']}]}]}]},'log':_0x5ea0('0x3')});};}; \ No newline at end of file diff --git a/server/services/ami/rpc/integrations/zoho.js b/server/services/ami/rpc/integrations/zoho.js index f6731ed..41485a4 100644 --- a/server/services/ami/rpc/integrations/zoho.js +++ b/server/services/ami/rpc/integrations/zoho.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x744f=['ZohoConfiguration','Configurations','name','moduleSearch','type','content','variableName','Variable','ZohoField','Descriptions','key','keyType','Fields','idField','customField','GetZohoAccount','../../client','getZohoAccounts','Request','description','host','zone','clientId','clientSecret','code','refreshToken'];(function(_0x3d1427,_0x5ae045){var _0x30b5a6=function(_0x3738a9){while(--_0x3738a9){_0x3d1427['push'](_0x3d1427['shift']());}};_0x30b5a6(++_0x5ae045);}(_0x744f,0x1b0));var _0xf744=function(_0x1e44ff,_0x4ebe40){_0x1e44ff=_0x1e44ff-0x0;var _0x4a575f=_0x744f[_0x1e44ff];return _0x4a575f;};'use strict';var client=require(_0xf744('0x0'));exports[_0xf744('0x1')]=function(){return function(_0x1e845f){return client[_0xf744('0x2')]('GetZohoAccount',{'options':{'raw':![],'attributes':['id','name',_0xf744('0x3'),_0xf744('0x4'),_0xf744('0x5'),_0xf744('0x6'),_0xf744('0x7'),'serverUrl',_0xf744('0x8'),_0xf744('0x9')],'include':[{'model':_0xf744('0xa'),'as':_0xf744('0xb'),'attributes':['id',_0xf744('0xc'),'moduleCreate',_0xf744('0xd'),_0xf744('0x3')],'include':[{'model':'ZohoField','as':'Subjects','attributes':['id',_0xf744('0xe'),_0xf744('0xf'),_0xf744('0x10')],'include':[{'model':_0xf744('0x11'),'as':_0xf744('0x11'),'attributes':['id',_0xf744('0xc')]}]},{'model':_0xf744('0x12'),'as':_0xf744('0x13'),'attributes':['id',_0xf744('0xe'),_0xf744('0xf'),_0xf744('0x14'),_0xf744('0x15'),'keyContent','variableName'],'include':[{'model':_0xf744('0x11'),'as':_0xf744('0x11'),'attributes':['id','name']}]},{'model':_0xf744('0x12'),'as':_0xf744('0x16'),'attributes':['id','type',_0xf744('0xf'),_0xf744('0x17'),'nameField',_0xf744('0x18'),'variableName'],'include':[{'model':_0xf744('0x11'),'as':_0xf744('0x11'),'attributes':['id','name']}]}]}]},'log':_0xf744('0x19')});};}; \ No newline at end of file +var _0xa639=['GetZohoAccount','name','description','host','zone','serverUrl','refreshToken','ZohoConfiguration','Configurations','moduleSearch','ZohoField','Subjects','type','content','variableName','Variable','Descriptions','key','keyContent','Fields','idField','nameField','customField','Request'];(function(_0x52e94f,_0x22e52d){var _0x127d43=function(_0x423f67){while(--_0x423f67){_0x52e94f['push'](_0x52e94f['shift']());}};_0x127d43(++_0x22e52d);}(_0xa639,0x107));var _0x9a63=function(_0x5e4272,_0x524e58){_0x5e4272=_0x5e4272-0x0;var _0x2708e4=_0xa639[_0x5e4272];return _0x2708e4;};'use strict';var client=require('../../client');exports['getZohoAccounts']=function(){return function(_0x659c72){return client[_0x9a63('0x0')](_0x9a63('0x1'),{'options':{'raw':![],'attributes':['id',_0x9a63('0x2'),_0x9a63('0x3'),_0x9a63('0x4'),_0x9a63('0x5'),'clientId','clientSecret',_0x9a63('0x6'),'code',_0x9a63('0x7')],'include':[{'model':_0x9a63('0x8'),'as':_0x9a63('0x9'),'attributes':['id','name','moduleCreate',_0x9a63('0xa'),_0x9a63('0x3')],'include':[{'model':_0x9a63('0xb'),'as':_0x9a63('0xc'),'attributes':['id',_0x9a63('0xd'),_0x9a63('0xe'),_0x9a63('0xf')],'include':[{'model':_0x9a63('0x10'),'as':_0x9a63('0x10'),'attributes':['id',_0x9a63('0x2')]}]},{'model':_0x9a63('0xb'),'as':_0x9a63('0x11'),'attributes':['id',_0x9a63('0xd'),'content',_0x9a63('0x12'),'keyType',_0x9a63('0x13'),_0x9a63('0xf')],'include':[{'model':_0x9a63('0x10'),'as':_0x9a63('0x10'),'attributes':['id',_0x9a63('0x2')]}]},{'model':_0x9a63('0xb'),'as':_0x9a63('0x14'),'attributes':['id',_0x9a63('0xd'),_0x9a63('0xe'),_0x9a63('0x15'),_0x9a63('0x16'),_0x9a63('0x17'),'variableName'],'include':[{'model':_0x9a63('0x10'),'as':_0x9a63('0x10'),'attributes':['id',_0x9a63('0x2')]}]}]}]},'log':_0x9a63('0x1')});};}; \ No newline at end of file diff --git a/server/services/ami/rpc/interval.js b/server/services/ami/rpc/interval.js index ce660fe..35fbe74 100644 --- a/server/services/ami/rpc/interval.js +++ b/server/services/ami/rpc/interval.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x4793=['length','resolve','every','number','map','interval','concat','Request','IntervalIftime','intervalIftime','../../../config/logger','dialer','../client','replace','trim','silly','intervalIftime\x20called\x20with','isArray'];(function(_0x1b8c20,_0xb8728b){var _0x58e15b=function(_0x497cb8){while(--_0x497cb8){_0x1b8c20['push'](_0x1b8c20['shift']());}};_0x58e15b(++_0xb8728b);}(_0x4793,0x88));var _0x3479=function(_0x5297f2,_0x529d75){_0x5297f2=_0x5297f2-0x0;var _0x17e6b6=_0x4793[_0x5297f2];return _0x17e6b6;};var logger=require(_0x3479('0x0'))(_0x3479('0x1'));var client=require(_0x3479('0x2'));function intervalIftime(_0x1d2255,_0xcf3052){const _0x47d489=new Error()['stack'][_0x3479('0x3')](/^Error/,'')[_0x3479('0x4')]();logger[_0x3479('0x5')](_0x3479('0x6'),_0x1d2255,_0xcf3052,_0x47d489);const _0x1a984d=Array[_0x3479('0x7')](_0x1d2255);if(!_0x1d2255||_0x1a984d&&_0x1d2255[_0x3479('0x8')]===0x0){return Promise[_0x3479('0x9')](![]);}else{var _0x15116f=[];var _0x51c9dd=[];var _0x5c3d2a=_0x1a984d?_0x1d2255:[_0x1d2255];var _0x455b99=_0x5c3d2a[_0x3479('0xa')](function(_0x57633b){return typeof _0x57633b===_0x3479('0xb');});var _0x67ebad=_0x5c3d2a['every'](function(_0x1eb0bc){return typeof _0x1eb0bc==='string';});if(!_0x455b99&&!_0x67ebad){_0x15116f=_0x5c3d2a[_0x3479('0xc')](function(_0x383a76){return _0x383a76['id'];});if(_0x15116f[_0x3479('0x8')]===0x0){_0x51c9dd=_0x5c3d2a['map'](function(_0x113828){return _0x113828[_0x3479('0xd')];});}}else{if(_0x455b99){_0x15116f=_0x15116f['concat'](_0x5c3d2a);}if(_0x67ebad){_0x51c9dd=_0x51c9dd[_0x3479('0xe')](_0x5c3d2a);}}return client[_0x3479('0xf')](_0x3479('0x10'),{'intervalIds':_0x15116f,'intervals':_0x51c9dd,'timezone':_0xcf3052,'log':_0x3479('0x10')});}}exports[_0x3479('0x11')]=intervalIftime; \ No newline at end of file +var _0xfa06=['length','Request','IntervalIftime','intervalIftime','dialer','../client','stack','replace','trim','silly','intervalIftime\x20called\x20with','isArray','resolve','number','map'];(function(_0x20a584,_0xe384a5){var _0x4b41a8=function(_0x2127c6){while(--_0x2127c6){_0x20a584['push'](_0x20a584['shift']());}};_0x4b41a8(++_0xe384a5);}(_0xfa06,0xd6));var _0x6fa0=function(_0xe66cf2,_0x32ba5f){_0xe66cf2=_0xe66cf2-0x0;var _0x2d84e7=_0xfa06[_0xe66cf2];return _0x2d84e7;};var logger=require('../../../config/logger')(_0x6fa0('0x0'));var client=require(_0x6fa0('0x1'));function intervalIftime(_0x4097ee,_0x1ac30c){const _0x2d8d9d=new Error()[_0x6fa0('0x2')][_0x6fa0('0x3')](/^Error/,'')[_0x6fa0('0x4')]();logger[_0x6fa0('0x5')](_0x6fa0('0x6'),_0x4097ee,_0x1ac30c,_0x2d8d9d);const _0x3800ab=Array[_0x6fa0('0x7')](_0x4097ee);if(!_0x4097ee||_0x3800ab&&_0x4097ee['length']===0x0){return Promise[_0x6fa0('0x8')](![]);}else{var _0xb55559=[];var _0x31ad05=[];var _0x4c8bf6=_0x3800ab?_0x4097ee:[_0x4097ee];var _0x3529b3=_0x4c8bf6['every'](function(_0x9f018b){return typeof _0x9f018b===_0x6fa0('0x9');});var _0x441cbd=_0x4c8bf6['every'](function(_0x400102){return typeof _0x400102==='string';});if(!_0x3529b3&&!_0x441cbd){_0xb55559=_0x4c8bf6[_0x6fa0('0xa')](function(_0x5faac5){return _0x5faac5['id'];});if(_0xb55559[_0x6fa0('0xb')]===0x0){_0x31ad05=_0x4c8bf6['map'](function(_0x3b4f23){return _0x3b4f23['interval'];});}}else{if(_0x3529b3){_0xb55559=_0xb55559['concat'](_0x4c8bf6);}if(_0x441cbd){_0x31ad05=_0x31ad05['concat'](_0x4c8bf6);}}return client[_0x6fa0('0xc')](_0x6fa0('0xd'),{'intervalIds':_0xb55559,'intervals':_0x31ad05,'timezone':_0x1ac30c,'log':_0x6fa0('0xd')});}}exports[_0x6fa0('0xe')]=intervalIftime; \ No newline at end of file diff --git a/server/services/ami/rpc/memberReport.js b/server/services/ami/rpc/memberReport.js index 206cbe1..8febb83 100644 --- a/server/services/ami/rpc/memberReport.js +++ b/server/services/ami/rpc/memberReport.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x675e=['moment','util','../client','voiceQueueReport','Request','CreateMemberReport','voice','lastAssignedTo','interface','format','TALKING','diff','queuecallerleaveAt','seconds','inbound','calleridnum','exten','queue','accountcode','toNumber','uniqueid','voiceDialReport','starttime','endtime','outbound','dialstring','agent'];(function(_0x589589,_0x484d80){var _0x1ae411=function(_0x193408){while(--_0x193408){_0x589589['push'](_0x589589['shift']());}};_0x1ae411(++_0x484d80);}(_0x675e,0xbd));var _0xe675=function(_0x59d89e,_0x55edf5){_0x59d89e=_0x59d89e-0x0;var _0x554e93=_0x675e[_0x59d89e];return _0x554e93;};'use strict';var moment=require(_0xe675('0x0'));var _=require('lodash');var util=require(_0xe675('0x1'));var client=require(_0xe675('0x2'));exports[_0xe675('0x3')]=function(_0x52e0a1){var _0x2a467a=_0x52e0a1['queuecallercompleteAt']||_0x52e0a1['queuecallerexitAt'];return client[_0xe675('0x4')](_0xe675('0x5'),{'body':{'channel':_0xe675('0x6'),'membername':_0x52e0a1[_0xe675('0x7')],'interface':_['isNil'](_0x52e0a1[_0xe675('0x8')])?util[_0xe675('0x9')]('SIP/%s',_0x52e0a1[_0xe675('0x7')]):_0x52e0a1[_0xe675('0x8')],'type':_0xe675('0xa'),'enterAt':_0x52e0a1['queuecallerleaveAt'],'exitAt':_0x2a467a,'duration':moment(_0x2a467a)[_0xe675('0xb')](_0x52e0a1[_0xe675('0xc')],_0xe675('0xd')),'data1':_0xe675('0xe'),'data2':_0x52e0a1[_0xe675('0xf')],'data3':_0x52e0a1[_0xe675('0x10')],'data4':null,'data5':_0x52e0a1[_0xe675('0x11')],'role':'agent','internal':_0x52e0a1[_0xe675('0x12')]?_[_0xe675('0x13')](_0x52e0a1['accountcode']):undefined,'uniqueid':_0x52e0a1[_0xe675('0x14')]},'log':'CreateMemberReport'});};exports[_0xe675('0x15')]=function(_0x473f34){return client[_0xe675('0x4')](_0xe675('0x5'),{'body':{'channel':'voice','membername':_0x473f34['membername'],'interface':_0x473f34[_0xe675('0x8')],'type':_0xe675('0xa'),'enterAt':_0x473f34[_0xe675('0x16')],'exitAt':_0x473f34['endtime'],'duration':moment(_0x473f34[_0xe675('0x17')])[_0xe675('0xb')](_0x473f34[_0xe675('0x16')],'seconds')>=0x0?moment(_0x473f34[_0xe675('0x17')])[_0xe675('0xb')](_0x473f34[_0xe675('0x16')],_0xe675('0xd')):null,'data1':_0xe675('0x18'),'data2':_0x473f34[_0xe675('0x12')],'data3':_0x473f34[_0xe675('0x10')],'data4':_0x473f34[_0xe675('0x19')]||null,'role':_0xe675('0x1a'),'internal':_0x473f34[_0xe675('0x12')]?_[_0xe675('0x13')](_0x473f34['accountcode']):undefined,'uniqueid':_0x473f34[_0xe675('0x14')]},'log':_0xe675('0x5')});}; \ No newline at end of file +var _0x82b3=['Request','CreateMemberReport','voice','lastAssignedTo','isNil','interface','format','SIP/%s','diff','queuecallerleaveAt','seconds','inbound','exten','queue','agent','accountcode','toNumber','endtime','starttime','outbound','uniqueid','moment','util','../client','voiceQueueReport'];(function(_0x5f2aa6,_0x5afbff){var _0x36c296=function(_0x37dde3){while(--_0x37dde3){_0x5f2aa6['push'](_0x5f2aa6['shift']());}};_0x36c296(++_0x5afbff);}(_0x82b3,0xdd));var _0x382b=function(_0x114a85,_0x4c239b){_0x114a85=_0x114a85-0x0;var _0x252d23=_0x82b3[_0x114a85];return _0x252d23;};'use strict';var moment=require(_0x382b('0x0'));var _=require('lodash');var util=require(_0x382b('0x1'));var client=require(_0x382b('0x2'));exports[_0x382b('0x3')]=function(_0xc3022e){var _0xf724ca=_0xc3022e['queuecallercompleteAt']||_0xc3022e['queuecallerexitAt'];return client[_0x382b('0x4')](_0x382b('0x5'),{'body':{'channel':_0x382b('0x6'),'membername':_0xc3022e[_0x382b('0x7')],'interface':_[_0x382b('0x8')](_0xc3022e[_0x382b('0x9')])?util[_0x382b('0xa')](_0x382b('0xb'),_0xc3022e['lastAssignedTo']):_0xc3022e[_0x382b('0x9')],'type':'TALKING','enterAt':_0xc3022e['queuecallerleaveAt'],'exitAt':_0xf724ca,'duration':moment(_0xf724ca)[_0x382b('0xc')](_0xc3022e[_0x382b('0xd')],_0x382b('0xe')),'data1':_0x382b('0xf'),'data2':_0xc3022e['calleridnum'],'data3':_0xc3022e[_0x382b('0x10')],'data4':null,'data5':_0xc3022e[_0x382b('0x11')],'role':_0x382b('0x12'),'internal':_0xc3022e[_0x382b('0x13')]?_[_0x382b('0x14')](_0xc3022e['accountcode']):undefined,'uniqueid':_0xc3022e['uniqueid']},'log':_0x382b('0x5')});};exports['voiceDialReport']=function(_0x5a9f8d){return client[_0x382b('0x4')](_0x382b('0x5'),{'body':{'channel':_0x382b('0x6'),'membername':_0x5a9f8d['membername'],'interface':_0x5a9f8d[_0x382b('0x9')],'type':'TALKING','enterAt':_0x5a9f8d['starttime'],'exitAt':_0x5a9f8d[_0x382b('0x15')],'duration':moment(_0x5a9f8d[_0x382b('0x15')])[_0x382b('0xc')](_0x5a9f8d[_0x382b('0x16')],_0x382b('0xe'))>=0x0?moment(_0x5a9f8d[_0x382b('0x15')])[_0x382b('0xc')](_0x5a9f8d['starttime'],_0x382b('0xe')):null,'data1':_0x382b('0x17'),'data2':_0x5a9f8d['accountcode'],'data3':_0x5a9f8d[_0x382b('0x10')],'data4':_0x5a9f8d['dialstring']||null,'role':'agent','internal':_0x5a9f8d[_0x382b('0x13')]?_[_0x382b('0x14')](_0x5a9f8d[_0x382b('0x13')]):undefined,'uniqueid':_0x5a9f8d[_0x382b('0x18')]},'log':_0x382b('0x5')});}; \ No newline at end of file diff --git a/server/services/ami/rpc/setting.js b/server/services/ami/rpc/setting.js index 13ca6af..3026ffa 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 _0xb01a=['ShowSetting','stopRecordingOnTransfer','previewRecallmeReminderInterval','GetSettings','../client','getSettings','Request'];(function(_0x22998b,_0xaa31fa){var _0xda88=function(_0x30269c){while(--_0x30269c){_0x22998b['push'](_0x22998b['shift']());}};_0xda88(++_0xaa31fa);}(_0xb01a,0x1a1));var _0xab01=function(_0x4aabea,_0x46cbe7){_0x4aabea=_0x4aabea-0x0;var _0x5e834a=_0xb01a[_0x4aabea];return _0x5e834a;};'use strict';var client=require(_0xab01('0x0'));exports[_0xab01('0x1')]=function(){return client[_0xab01('0x2')](_0xab01('0x3'),{'options':{'raw':!![],'where':{'id':0x1},'attributes':[_0xab01('0x4'),_0xab01('0x5')]},'log':_0xab01('0x6')});}; \ No newline at end of file +var _0x40ac=['ShowSetting','stopRecordingOnTransfer','previewRecallmeReminderInterval','GetSettings','../client','Request'];(function(_0x21130c,_0x58424d){var _0x4f27d9=function(_0x257775){while(--_0x257775){_0x21130c['push'](_0x21130c['shift']());}};_0x4f27d9(++_0x58424d);}(_0x40ac,0x1de));var _0xc40a=function(_0x39b007,_0x45f4a8){_0x39b007=_0x39b007-0x0;var _0x26f00d=_0x40ac[_0x39b007];return _0x26f00d;};'use strict';var client=require(_0xc40a('0x0'));exports['getSettings']=function(){return client[_0xc40a('0x1')](_0xc40a('0x2'),{'options':{'raw':!![],'where':{'id':0x1},'attributes':[_0xc40a('0x3'),_0xc40a('0x4')]},'log':_0xc40a('0x5')});}; \ No newline at end of file diff --git a/server/services/ami/rpc/template.js b/server/services/ami/rpc/template.js index a75a0cb..76fde4b 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 _0xbcf1=['Request','GetTemplate','name','../client'];(function(_0x42afde,_0x377195){var _0x5e9990=function(_0x157ea9){while(--_0x157ea9){_0x42afde['push'](_0x42afde['shift']());}};_0x5e9990(++_0x377195);}(_0xbcf1,0x97));var _0x1bcf=function(_0x4f6f84,_0x31e197){_0x4f6f84=_0x4f6f84-0x0;var _0x20d989=_0xbcf1[_0x4f6f84];return _0x20d989;};'use strict';var client=require(_0x1bcf('0x0'));exports['getTemplates']=function(_0x399a59){return function(_0xe87b5){return client[_0x1bcf('0x1')](_0x1bcf('0x2'),{'options':{'raw':!![],'attributes':['id',_0x1bcf('0x3'),'html']},'log':_0x1bcf('0x2')});};}; \ No newline at end of file +var _0xd943=['name','html','GetTemplate','getTemplates','Request'];(function(_0x57eace,_0x52a51a){var _0xd53fdd=function(_0x316cd4){while(--_0x316cd4){_0x57eace['push'](_0x57eace['shift']());}};_0xd53fdd(++_0x52a51a);}(_0xd943,0xa8));var _0x3d94=function(_0x44a0ae,_0x23b01a){_0x44a0ae=_0x44a0ae-0x0;var _0x5c543e=_0xd943[_0x44a0ae];return _0x5c543e;};'use strict';var client=require('../client');exports[_0x3d94('0x0')]=function(_0x30f33d){return function(_0x8f98fd){return client[_0x3d94('0x1')]('GetTemplate',{'options':{'raw':!![],'attributes':['id',_0x3d94('0x2'),_0x3d94('0x3')]},'log':_0x3d94('0x4')});};}; \ No newline at end of file diff --git a/server/services/ami/rpc/trigger.js b/server/services/ami/rpc/trigger.js index 043c631..576b01a 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 _0xb7c7=['GetTrigger','../client','getTriggers','Request','channel','status','Condition','AllConditions','field','operator','value','AnyConditions','Action','Actions','action','data1','data2','data3','data4','data5','data6','data7'];(function(_0x3fec75,_0x3cd9ea){var _0x2561fe=function(_0x2b8625){while(--_0x2b8625){_0x3fec75['push'](_0x3fec75['shift']());}};_0x2561fe(++_0x3cd9ea);}(_0xb7c7,0x1e5));var _0x7b7c=function(_0x5d1044,_0x18f656){_0x5d1044=_0x5d1044-0x0;var _0x3cd90e=_0xb7c7[_0x5d1044];return _0x3cd90e;};'use strict';var client=require(_0x7b7c('0x0'));exports[_0x7b7c('0x1')]=function(_0x591113){return function(_0x5b3537){return client[_0x7b7c('0x2')]('GetTrigger',{'options':{'raw':![],'attributes':['id','name',_0x7b7c('0x3'),_0x7b7c('0x4')],'include':[{'model':_0x7b7c('0x5'),'as':_0x7b7c('0x6'),'attributes':['id',_0x7b7c('0x7'),_0x7b7c('0x8'),_0x7b7c('0x9')]},{'model':'Condition','as':_0x7b7c('0xa'),'attributes':['id',_0x7b7c('0x7'),_0x7b7c('0x8'),_0x7b7c('0x9')]},{'model':_0x7b7c('0xb'),'as':_0x7b7c('0xc'),'attributes':['id',_0x7b7c('0xd'),_0x7b7c('0xe'),_0x7b7c('0xf'),_0x7b7c('0x10'),_0x7b7c('0x11'),_0x7b7c('0x12'),_0x7b7c('0x13'),_0x7b7c('0x14')]}]},'log':_0x7b7c('0x15')});};}; \ No newline at end of file +var _0x064d=['Condition','AllConditions','field','operator','value','AnyConditions','Action','Actions','data1','data2','data3','data5','data7','../client','getTriggers','GetTrigger','channel','status'];(function(_0x1dc9f1,_0x2e0e0c){var _0x3388ed=function(_0x36880c){while(--_0x36880c){_0x1dc9f1['push'](_0x1dc9f1['shift']());}};_0x3388ed(++_0x2e0e0c);}(_0x064d,0x109));var _0xd064=function(_0x33fb09,_0x270ce2){_0x33fb09=_0x33fb09-0x0;var _0x5d5baa=_0x064d[_0x33fb09];return _0x5d5baa;};'use strict';var client=require(_0xd064('0x0'));exports[_0xd064('0x1')]=function(_0xe674a9){return function(_0x369275){return client['Request'](_0xd064('0x2'),{'options':{'raw':![],'attributes':['id','name',_0xd064('0x3'),_0xd064('0x4')],'include':[{'model':_0xd064('0x5'),'as':_0xd064('0x6'),'attributes':['id',_0xd064('0x7'),_0xd064('0x8'),_0xd064('0x9')]},{'model':_0xd064('0x5'),'as':_0xd064('0xa'),'attributes':['id','field',_0xd064('0x8'),_0xd064('0x9')]},{'model':_0xd064('0xb'),'as':_0xd064('0xc'),'attributes':['id','action',_0xd064('0xd'),_0xd064('0xe'),_0xd064('0xf'),'data4',_0xd064('0x10'),'data6',_0xd064('0x11')]}]},'log':_0xd064('0x2')});};}; \ No newline at end of file diff --git a/server/services/ami/rpc/trunk.js b/server/services/ami/rpc/trunk.js index e6932ad..aebf1a9 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 _0xfde9=['../client','getTrunks','Request','name','registry','GetTrunk'];(function(_0xf7cf2b,_0x388045){var _0x29fa68=function(_0x560270){while(--_0x560270){_0xf7cf2b['push'](_0xf7cf2b['shift']());}};_0x29fa68(++_0x388045);}(_0xfde9,0x66));var _0x9fde=function(_0x2e6c19,_0x131233){_0x2e6c19=_0x2e6c19-0x0;var _0x52885d=_0xfde9[_0x2e6c19];return _0x52885d;};'use strict';var client=require(_0x9fde('0x0'));exports[_0x9fde('0x1')]=function(_0x27dcb7){return function(_0x1c2167){return client[_0x9fde('0x2')]('GetTrunk',{'options':{'raw':!![],'where':{'active':0x1},'attributes':['id',_0x9fde('0x3'),_0x9fde('0x4'),'defaultuser']},'log':_0x9fde('0x5')});};}; \ No newline at end of file +var _0x684d=['name','registry','defaultuser','GetTrunk','../client','getTrunks','Request'];(function(_0x28d951,_0x21dd60){var _0x5d751e=function(_0x1654be){while(--_0x1654be){_0x28d951['push'](_0x28d951['shift']());}};_0x5d751e(++_0x21dd60);}(_0x684d,0xcf));var _0xd684=function(_0xa2702b,_0x230ead){_0xa2702b=_0xa2702b-0x0;var _0x405ce3=_0x684d[_0xa2702b];return _0x405ce3;};'use strict';var client=require(_0xd684('0x0'));exports[_0xd684('0x1')]=function(_0x566705){return function(_0x7ac651){return client[_0xd684('0x2')]('GetTrunk',{'options':{'raw':!![],'where':{'active':0x1},'attributes':['id',_0xd684('0x3'),_0xd684('0x4'),_0xd684('0x5')]},'log':_0xd684('0x6')});};}; \ No newline at end of file diff --git a/server/services/ami/rpc/user.js b/server/services/ami/rpc/user.js index 90413c4..1ae1f47 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 _0xedd9=['mobile','getTelephones','internal','PauseUser','savePause','saveUnpause','UnpauseUser','ShowUser','interface','getAgent','getAgents','Request','GetUser','agent','name','email','accountcode','fullname','lastLoginAt','pauseType','lastPauseAt','voicePause'];(function(_0x1135c8,_0x18ec43){var _0x3021f4=function(_0x4d7cdc){while(--_0x4d7cdc){_0x1135c8['push'](_0x1135c8['shift']());}};_0x3021f4(++_0x18ec43);}(_0xedd9,0xfc));var _0x9edd=function(_0xa31c12,_0x4881a4){_0xa31c12=_0xa31c12-0x0;var _0x646746=_0xedd9[_0xa31c12];return _0x646746;};'use strict';var client=require('../client');exports[_0x9edd('0x0')]=function(){return function(){return client[_0x9edd('0x1')](_0x9edd('0x2'),{'options':{'raw':![],'where':{'role':_0x9edd('0x3')},'attributes':['id',_0x9edd('0x4'),_0x9edd('0x5'),_0x9edd('0x6'),_0x9edd('0x7'),'online',_0x9edd('0x8'),_0x9edd('0x9'),_0x9edd('0xa'),_0x9edd('0xb'),'phone',_0x9edd('0xc'),'interface']},'log':_0x9edd('0x0')});};};exports[_0x9edd('0xd')]=function(){return function(){return client[_0x9edd('0x1')](_0x9edd('0x2'),{'options':{'raw':!![],'where':{'role':'telephone'},'attributes':['id',_0x9edd('0x4'),'accountcode',_0x9edd('0xe')]},'log':_0x9edd('0xd')});};};exports['savePause']=function(_0xbf9da6,_0x13dc4f,_0x5b6c00){return client[_0x9edd('0x1')](_0x9edd('0xf'),{'body':{'type':_0x13dc4f,'uniqueid':_0x5b6c00},'options':{'where':{'id':_0xbf9da6['id']}},'log':_0x9edd('0x10')});};exports[_0x9edd('0x11')]=function(_0x287ddd){return client[_0x9edd('0x1')](_0x9edd('0x12'),{'body':{},'options':{'where':{'id':_0x287ddd['id']}},'log':_0x9edd('0x10')});};exports['getAgent']=function(_0x176bfa){return client[_0x9edd('0x1')](_0x9edd('0x13'),{'options':{'raw':![],'where':{'role':_0x9edd('0x3'),'id':_0x176bfa},'attributes':['id',_0x9edd('0x4'),_0x9edd('0x5'),_0x9edd('0x6'),_0x9edd('0x7'),'online',_0x9edd('0x8'),_0x9edd('0x9'),_0x9edd('0xa'),'voicePause',_0x9edd('0x14')]},'log':_0x9edd('0x15')});}; \ No newline at end of file +var _0x70e0=['getAgents','Request','name','email','accountcode','fullname','lastLoginAt','lastPauseAt','interface','getTelephones','GetUser','telephone','savePause','PauseUser','saveUnpause','getAgent','agent','online','pauseType','../client'];(function(_0x3df9fe,_0x2a8b74){var _0x16c2c6=function(_0x325903){while(--_0x325903){_0x3df9fe['push'](_0x3df9fe['shift']());}};_0x16c2c6(++_0x2a8b74);}(_0x70e0,0x17b));var _0x070e=function(_0x45887c,_0x3e250a){_0x45887c=_0x45887c-0x0;var _0x27c241=_0x70e0[_0x45887c];return _0x27c241;};'use strict';var client=require(_0x070e('0x0'));exports[_0x070e('0x1')]=function(){return function(){return client[_0x070e('0x2')]('GetUser',{'options':{'raw':![],'where':{'role':'agent'},'attributes':['id',_0x070e('0x3'),_0x070e('0x4'),_0x070e('0x5'),_0x070e('0x6'),'online',_0x070e('0x7'),'pauseType',_0x070e('0x8'),'voicePause','phone','mobile',_0x070e('0x9')]},'log':_0x070e('0x1')});};};exports[_0x070e('0xa')]=function(){return function(){return client[_0x070e('0x2')](_0x070e('0xb'),{'options':{'raw':!![],'where':{'role':_0x070e('0xc')},'attributes':['id',_0x070e('0x3'),'accountcode','internal']},'log':_0x070e('0xa')});};};exports[_0x070e('0xd')]=function(_0x12bb37,_0xb8d819,_0xa927a2){return client[_0x070e('0x2')](_0x070e('0xe'),{'body':{'type':_0xb8d819,'uniqueid':_0xa927a2},'options':{'where':{'id':_0x12bb37['id']}},'log':_0x070e('0xd')});};exports[_0x070e('0xf')]=function(_0x5bf079){return client[_0x070e('0x2')]('UnpauseUser',{'body':{},'options':{'where':{'id':_0x5bf079['id']}},'log':'savePause'});};exports[_0x070e('0x10')]=function(_0x56c7ba){return client['Request']('ShowUser',{'options':{'raw':![],'where':{'role':_0x070e('0x11'),'id':_0x56c7ba},'attributes':['id',_0x070e('0x3'),'email','accountcode',_0x070e('0x6'),_0x070e('0x12'),_0x070e('0x7'),_0x070e('0x13'),'lastPauseAt','voicePause',_0x070e('0x9')]},'log':_0x070e('0x10')});}; \ No newline at end of file diff --git a/server/services/ami/rpc/voiceAgentReport.js b/server/services/ami/rpc/voiceAgentReport.js index 1bc1f5a..e38969d 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 _0xa51f=['update','UpdateVoiceAgentReport','../client','create','Request','CreateVoiceAgentReport'];(function(_0x455161,_0x520f10){var _0x3e7c03=function(_0xb17908){while(--_0xb17908){_0x455161['push'](_0x455161['shift']());}};_0x3e7c03(++_0x520f10);}(_0xa51f,0x11c));var _0xfa51=function(_0xcaf223,_0xd39f07){_0xcaf223=_0xcaf223-0x0;var _0x17e00d=_0xa51f[_0xcaf223];return _0x17e00d;};'use strict';var client=require(_0xfa51('0x0'));exports[_0xfa51('0x1')]=function(_0x372665){return client[_0xfa51('0x2')](_0xfa51('0x3'),{'body':_0x372665,'log':_0xfa51('0x3')});};exports[_0xfa51('0x4')]=function(_0x928fd0,_0x285767,_0x1826d4){return client[_0xfa51('0x2')](_0xfa51('0x5'),{'body':_0x928fd0,'options':{'where':{'uniqueid':_0x285767,'interface':_0x1826d4,'agentcomplete':!![]}},'log':'UpdateVoiceAgentReport'});}; \ No newline at end of file +var _0xcf87=['CreateVoiceAgentReport','update','Request','../client','create'];(function(_0xfd780a,_0x3947cc){var _0x12bfa0=function(_0x3ece54){while(--_0x3ece54){_0xfd780a['push'](_0xfd780a['shift']());}};_0x12bfa0(++_0x3947cc);}(_0xcf87,0xe9));var _0x7cf8=function(_0x1cc063,_0x1d4623){_0x1cc063=_0x1cc063-0x0;var _0x1cd169=_0xcf87[_0x1cc063];return _0x1cd169;};'use strict';var client=require(_0x7cf8('0x0'));exports[_0x7cf8('0x1')]=function(_0x82fa9){return client['Request'](_0x7cf8('0x2'),{'body':_0x82fa9,'log':_0x7cf8('0x2')});};exports[_0x7cf8('0x3')]=function(_0x593c7d,_0xe5c034,_0x2b39be){return client[_0x7cf8('0x4')]('UpdateVoiceAgentReport',{'body':_0x593c7d,'options':{'where':{'uniqueid':_0xe5c034,'interface':_0x2b39be,'agentcomplete':!![]}},'log':'UpdateVoiceAgentReport'});}; \ No newline at end of file diff --git a/server/services/ami/rpc/voiceCallReport.js b/server/services/ami/rpc/voiceCallReport.js index 7ff4ea2..9520168 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 _0xbadd=['YYYY-MM-DD\x20HH:mm:ss','endOf','type','disposition','duration','billableseconds','moment','util','../client','create','calleridnum','callerid','DOCUMENTATION','CreateVoiceCallReport','getVoiceCallReports','Request','outbound','startOf','day','format'];(function(_0x31e99f,_0x2a34d9){var _0x1f503f=function(_0x1d96e8){while(--_0x1d96e8){_0x31e99f['push'](_0x31e99f['shift']());}};_0x1f503f(++_0x2a34d9);}(_0xbadd,0x182));var _0xdbad=function(_0x45977c,_0x7eaed0){_0x45977c=_0x45977c-0x0;var _0x399413=_0xbadd[_0x45977c];return _0x399413;};'use strict';var moment=require(_0xdbad('0x0'));var util=require(_0xdbad('0x1'));var _=require('lodash');var client=require(_0xdbad('0x2'));exports[_0xdbad('0x3')]=function(_0x4393ea){return client['Request']('CreateVoiceCallReport',{'body':_['merge'](_0x4393ea,{'source':_0x4393ea[_0xdbad('0x4')],'destinationcontext':_0x4393ea['context'],'callerid':_0x4393ea[_0xdbad('0x5')],'amaflags':_0xdbad('0x6')}),'log':_0xdbad('0x7')});};exports[_0xdbad('0x8')]=function(){return function(){return client[_0xdbad('0x9')]('GetVoiceCallReport',{'options':{'where':{'type':[_0xdbad('0xa')],'createdAt':{'$between':[moment()[_0xdbad('0xb')](_0xdbad('0xc'))[_0xdbad('0xd')](_0xdbad('0xe')),moment()[_0xdbad('0xf')](_0xdbad('0xc'))[_0xdbad('0xd')]('YYYY-MM-DD\x20HH:mm:ss')]}},'attributes':[_0xdbad('0x10'),_0xdbad('0x11'),_0xdbad('0x12'),_0xdbad('0x13')]},'log':'GetVoiceCallReports'});};}; \ No newline at end of file +var _0xd007=['create','Request','merge','calleridnum','context','callerid','CreateVoiceCallReport','getVoiceCallReports','GetVoiceCallReport','outbound','startOf','day','format','YYYY-MM-DD\x20HH:mm:ss','type','disposition','GetVoiceCallReports','moment','util','../client'];(function(_0x4d88f6,_0x52f758){var _0x2041c8=function(_0x16f556){while(--_0x16f556){_0x4d88f6['push'](_0x4d88f6['shift']());}};_0x2041c8(++_0x52f758);}(_0xd007,0x1dd));var _0x7d00=function(_0x3527ef,_0x1fa855){_0x3527ef=_0x3527ef-0x0;var _0x471455=_0xd007[_0x3527ef];return _0x471455;};'use strict';var moment=require(_0x7d00('0x0'));var util=require(_0x7d00('0x1'));var _=require('lodash');var client=require(_0x7d00('0x2'));exports[_0x7d00('0x3')]=function(_0x1cec2c){return client[_0x7d00('0x4')]('CreateVoiceCallReport',{'body':_[_0x7d00('0x5')](_0x1cec2c,{'source':_0x1cec2c[_0x7d00('0x6')],'destinationcontext':_0x1cec2c[_0x7d00('0x7')],'callerid':_0x1cec2c[_0x7d00('0x8')],'amaflags':'DOCUMENTATION'}),'log':_0x7d00('0x9')});};exports[_0x7d00('0xa')]=function(){return function(){return client[_0x7d00('0x4')](_0x7d00('0xb'),{'options':{'where':{'type':[_0x7d00('0xc')],'createdAt':{'$between':[moment()[_0x7d00('0xd')](_0x7d00('0xe'))[_0x7d00('0xf')]('YYYY-MM-DD\x20HH:mm:ss'),moment()['endOf'](_0x7d00('0xe'))[_0x7d00('0xf')](_0x7d00('0x10'))]}},'attributes':[_0x7d00('0x11'),_0x7d00('0x12'),'duration','billableseconds']},'log':_0x7d00('0x13')});};}; \ No newline at end of file diff --git a/server/services/ami/rpc/voiceDialReport.js b/server/services/ami/rpc/voiceDialReport.js index b5558ea..c21e7d0 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 _0x7152=['../client','Request','CreateVoiceDialReport'];(function(_0x147886,_0x4f2f54){var _0x3abc3a=function(_0x5f5533){while(--_0x5f5533){_0x147886['push'](_0x147886['shift']());}};_0x3abc3a(++_0x4f2f54);}(_0x7152,0xc3));var _0x2715=function(_0xf51c06,_0x388e5b){_0xf51c06=_0xf51c06-0x0;var _0x1d5420=_0x7152[_0xf51c06];return _0x1d5420;};'use strict';var client=require(_0x2715('0x0'));exports['create']=function(_0x4c6b7f){return client[_0x2715('0x1')](_0x2715('0x2'),{'body':_0x4c6b7f,'log':_0x2715('0x2')});}; \ No newline at end of file +var _0x18fb=['CreateVoiceDialReport','../client','Request'];(function(_0x3fa524,_0x2e81bf){var _0x2b3a89=function(_0x327879){while(--_0x327879){_0x3fa524['push'](_0x3fa524['shift']());}};_0x2b3a89(++_0x2e81bf);}(_0x18fb,0x118));var _0xb18f=function(_0x14add3,_0x13ce8d){_0x14add3=_0x14add3-0x0;var _0x4a174f=_0x18fb[_0x14add3];return _0x4a174f;};'use strict';var client=require(_0xb18f('0x0'));exports['create']=function(_0x1c8490){return client[_0xb18f('0x1')]('CreateVoiceDialReport',{'body':_0x1c8490,'log':_0xb18f('0x2')});}; \ No newline at end of file diff --git a/server/services/ami/rpc/voiceExtension.js b/server/services/ami/rpc/voiceExtension.js index 59decce..5b27e11 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 _0xa1b9=['Request','GetVoiceExtension','exten','recordingFormat','getVoiceExtensions','../client'];(function(_0x57a659,_0x4aaf91){var _0x36e35e=function(_0x14bcd9){while(--_0x14bcd9){_0x57a659['push'](_0x57a659['shift']());}};_0x36e35e(++_0x4aaf91);}(_0xa1b9,0x71));var _0x9a1b=function(_0x1b349a,_0x22222c){_0x1b349a=_0x1b349a-0x0;var _0x5d1f7c=_0xa1b9[_0x1b349a];return _0x5d1f7c;};'use strict';var client=require(_0x9a1b('0x0'));exports['getVoiceExtensions']=function(){return function(){return client[_0x9a1b('0x1')](_0x9a1b('0x2'),{'options':{'raw':!![],'attributes':['id',_0x9a1b('0x3'),_0x9a1b('0x4')],'where':{'VoiceExtensionId':null}},'log':_0x9a1b('0x5')});};}; \ No newline at end of file +var _0x878f=['recordingFormat','getVoiceExtensions','Request','GetVoiceExtension','exten'];(function(_0x265d13,_0x53aa53){var _0x488923=function(_0x59547a){while(--_0x59547a){_0x265d13['push'](_0x265d13['shift']());}};_0x488923(++_0x53aa53);}(_0x878f,0x173));var _0xf878=function(_0x1f0bf0,_0x917f76){_0x1f0bf0=_0x1f0bf0-0x0;var _0x47a4aa=_0x878f[_0x1f0bf0];return _0x47a4aa;};'use strict';var client=require('../client');exports[_0xf878('0x0')]=function(){return function(){return client[_0xf878('0x1')](_0xf878('0x2'),{'options':{'raw':!![],'attributes':['id',_0xf878('0x3'),_0xf878('0x4')],'where':{'VoiceExtensionId':null}},'log':_0xf878('0x0')});};}; \ No newline at end of file diff --git a/server/services/ami/rpc/voiceQueue.js b/server/services/ami/rpc/voiceQueue.js index 5125773..5fa3491 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 _0x66fa=['dialOrderByScheduledAt','dialAgiAfterHangupAgent','dialQueueProject2','monitor_format','strategy','dialRandomLastDigitCallerIdNumber','dialCutDigit','dialNoSuchNumberMaxRetry','dialNoSuchNumberRetryFrequency','dialDropMaxRetry','dialDropRetryFrequency','dialAbandonedMaxRetry','dialAbandonedRetryFrequency','dialMachineMaxRetry','dialMachineRetryFrequency','dialAgentRejectMaxRetry','mandatoryDisposition','dialPredictiveIntervalMinThreshold','dialPreviewAutoRecallMe','dialPreviewRecallmeReminder','Trunk','name','callerid','active','Pause','mandatoryDispositionPause','TrunkBackup','Interval','Intervals','interval','../client','Request','GetVoiceQueue','acw','acwTimeout','autopause','dialActive','dialMethod','dialLimitChannel','dialLimitQueue','dialPowerLevel','dialPredictiveOptimization','dialOriginateCallerIdName','dialOriginateTimeout','dialQueueOptions','dialQueueTimeout','dialQueueProject','dialCongestionMaxRetry','dialBusyMaxRetry','dialBusyRetryFrequency','dialNoAnswerMaxRetry','dialNoAnswerRetryFrequency','dialGlobalMaxRetry','dialTimezone','dialGlobalInterval','dialCheckDuplicateType','dialAMDActive','dialAMDGreeting','dialAMDAfterGreetingSilence','dialAMDTotalAnalysisTime','dialAMDMinWordLength','dialAMDBetweenWordsSilence','dialAMDSilenceThreshold','dialAMDMaximumWordLength','timeout','dialRecallMeTimeout','dialRecallInQueue'];(function(_0xefd519,_0xc62635){var _0x4bb882=function(_0x37e0a1){while(--_0x37e0a1){_0xefd519['push'](_0xefd519['shift']());}};_0x4bb882(++_0xc62635);}(_0x66fa,0x16d));var _0xa66f=function(_0x579987,_0xc3640c){_0x579987=_0x579987-0x0;var _0x1057fa=_0x66fa[_0x579987];return _0x1057fa;};'use strict';var client=require(_0xa66f('0x0'));exports['getVoiceQueues']=function(){return function(){return client[_0xa66f('0x1')](_0xa66f('0x2'),{'options':{'raw':![],'attributes':['id','name',_0xa66f('0x3'),_0xa66f('0x4'),_0xa66f('0x5'),'monitor_format','type',_0xa66f('0x6'),_0xa66f('0x7'),_0xa66f('0x8'),_0xa66f('0x9'),_0xa66f('0xa'),_0xa66f('0xb'),'dialPredictiveOptimizationPercentage','dialPredictiveInterval',_0xa66f('0xc'),'dialOriginateCallerIdNumber',_0xa66f('0xd'),_0xa66f('0xe'),_0xa66f('0xf'),_0xa66f('0x10'),_0xa66f('0x11'),'dialCongestionRetryFrequency',_0xa66f('0x12'),_0xa66f('0x13'),_0xa66f('0x14'),_0xa66f('0x15'),_0xa66f('0x16'),_0xa66f('0x17'),_0xa66f('0x18'),'dialPrefix',_0xa66f('0x19'),_0xa66f('0x1a'),'dialAMDInitialSilence',_0xa66f('0x1b'),_0xa66f('0x1c'),_0xa66f('0x1d'),_0xa66f('0x1e'),_0xa66f('0x1f'),'dialAMDMaximumNumberOfWords',_0xa66f('0x20'),_0xa66f('0x21'),_0xa66f('0x22'),_0xa66f('0x23'),_0xa66f('0x24'),_0xa66f('0x25'),_0xa66f('0x26'),'dialAgiAfterHangupClient',_0xa66f('0x27'),_0xa66f('0x28'),_0xa66f('0x29'),_0xa66f('0x2a'),_0xa66f('0x2b'),_0xa66f('0x2c'),_0xa66f('0x2d'),_0xa66f('0x2e'),_0xa66f('0x2f'),_0xa66f('0x30'),_0xa66f('0x31'),_0xa66f('0x32'),_0xa66f('0x33'),_0xa66f('0x34'),'dialAgentRejectRetryFrequency',_0xa66f('0x35'),'dialPredictiveIntervalMaxThreshold',_0xa66f('0x36'),_0xa66f('0x37'),_0xa66f('0x38')],'include':[{'model':_0xa66f('0x39'),'as':_0xa66f('0x39'),'attributes':['id',_0xa66f('0x3a'),_0xa66f('0x3b'),_0xa66f('0x3c')]},{'model':_0xa66f('0x3d'),'as':_0xa66f('0x3e'),'attributes':['id',_0xa66f('0x3a')]},{'model':_0xa66f('0x39'),'as':_0xa66f('0x3f'),'attributes':['id','name',_0xa66f('0x3b'),'active']},{'model':_0xa66f('0x40'),'as':_0xa66f('0x40'),'attributes':['id',_0xa66f('0x3a')],'include':[{'model':_0xa66f('0x40'),'as':_0xa66f('0x41'),'attributes':['id',_0xa66f('0x3a'),_0xa66f('0x42')]}]}]},'log':'getVoiceQueues'});};}; \ No newline at end of file +var _0x8407=['Request','GetVoiceQueue','name','acw','acwTimeout','autopause','monitor_format','type','dialActive','dialMethod','dialLimitChannel','dialPowerLevel','dialPredictiveOptimization','dialPredictiveOptimizationPercentage','dialQueueTimeout','dialQueueProject','dialCongestionMaxRetry','dialCongestionRetryFrequency','dialBusyMaxRetry','dialBusyRetryFrequency','dialNoAnswerMaxRetry','dialNoAnswerRetryFrequency','dialGlobalMaxRetry','dialTimezone','dialPrefix','dialCheckDuplicateType','dialAMDActive','dialAMDInitialSilence','dialAMDGreeting','dialAMDAfterGreetingSilence','dialAMDTotalAnalysisTime','dialAMDMinWordLength','dialAMDBetweenWordsSilence','dialAMDSilenceThreshold','dialAMDMaximumWordLength','dialRecallInQueue','dialOrderByScheduledAt','dialAgiAfterHangupAgent','dialAgiAfterHangupClient','dialQueueProject2','dialNoSuchNumberMaxRetry','dialDropMaxRetry','dialDropRetryFrequency','dialAbandonedMaxRetry','dialMachineMaxRetry','dialMachineRetryFrequency','dialAgentRejectMaxRetry','dialPredictiveIntervalMaxThreshold','dialPredictiveIntervalMinThreshold','dialPreviewRecallmeReminder','Trunk','callerid','active','Pause','mandatoryDispositionPause','TrunkBackup','Interval','Intervals','interval','getVoiceQueues'];(function(_0x312967,_0x58c294){var _0xcd8e69=function(_0x374b62){while(--_0x374b62){_0x312967['push'](_0x312967['shift']());}};_0xcd8e69(++_0x58c294);}(_0x8407,0x1e0));var _0x7840=function(_0x215523,_0x49a675){_0x215523=_0x215523-0x0;var _0x1b596b=_0x8407[_0x215523];return _0x1b596b;};'use strict';var client=require('../client');exports['getVoiceQueues']=function(){return function(){return client[_0x7840('0x0')](_0x7840('0x1'),{'options':{'raw':![],'attributes':['id',_0x7840('0x2'),_0x7840('0x3'),_0x7840('0x4'),_0x7840('0x5'),_0x7840('0x6'),_0x7840('0x7'),_0x7840('0x8'),_0x7840('0x9'),_0x7840('0xa'),'dialLimitQueue',_0x7840('0xb'),_0x7840('0xc'),_0x7840('0xd'),'dialPredictiveInterval','dialOriginateCallerIdName','dialOriginateCallerIdNumber','dialOriginateTimeout','dialQueueOptions',_0x7840('0xe'),_0x7840('0xf'),_0x7840('0x10'),_0x7840('0x11'),_0x7840('0x12'),_0x7840('0x13'),_0x7840('0x14'),_0x7840('0x15'),_0x7840('0x16'),_0x7840('0x17'),'dialGlobalInterval',_0x7840('0x18'),_0x7840('0x19'),_0x7840('0x1a'),_0x7840('0x1b'),_0x7840('0x1c'),_0x7840('0x1d'),_0x7840('0x1e'),_0x7840('0x1f'),_0x7840('0x20'),'dialAMDMaximumNumberOfWords',_0x7840('0x21'),_0x7840('0x22'),'timeout','dialRecallMeTimeout',_0x7840('0x23'),_0x7840('0x24'),_0x7840('0x25'),_0x7840('0x26'),_0x7840('0x27'),_0x7840('0x6'),'strategy','dialRandomLastDigitCallerIdNumber','dialCutDigit',_0x7840('0x28'),'dialNoSuchNumberRetryFrequency',_0x7840('0x29'),_0x7840('0x2a'),_0x7840('0x2b'),'dialAbandonedRetryFrequency',_0x7840('0x2c'),_0x7840('0x2d'),_0x7840('0x2e'),'dialAgentRejectRetryFrequency','mandatoryDisposition',_0x7840('0x2f'),_0x7840('0x30'),'dialPreviewAutoRecallMe',_0x7840('0x31')],'include':[{'model':_0x7840('0x32'),'as':_0x7840('0x32'),'attributes':['id',_0x7840('0x2'),_0x7840('0x33'),_0x7840('0x34')]},{'model':_0x7840('0x35'),'as':_0x7840('0x36'),'attributes':['id',_0x7840('0x2')]},{'model':_0x7840('0x32'),'as':_0x7840('0x37'),'attributes':['id',_0x7840('0x2'),_0x7840('0x33'),'active']},{'model':_0x7840('0x38'),'as':_0x7840('0x38'),'attributes':['id',_0x7840('0x2')],'include':[{'model':_0x7840('0x38'),'as':_0x7840('0x39'),'attributes':['id',_0x7840('0x2'),_0x7840('0x3a')]}]}]},'log':_0x7840('0x3b')});};}; \ No newline at end of file diff --git a/server/services/ami/rpc/voiceQueueReport.js b/server/services/ami/rpc/voiceQueueReport.js index c544dab..a71b288 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(_0x1d22c9,_0x3dfaa6){var _0x155867=function(_0x2e3843){while(--_0x2e3843){_0x1d22c9['push'](_0x1d22c9['shift']());}};_0x155867(++_0x3dfaa6);}(_0xa9e0,0x123));var _0x0a9e=function(_0x2cfb58,_0x3d9412){_0x2cfb58=_0x2cfb58-0x0;var _0xd99951=_0xa9e0[_0x2cfb58];return _0xd99951;};'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(_0x33acda,_0x6cfb30){var _0x2a5805=function(_0x1a55a5){while(--_0x1a55a5){_0x33acda['push'](_0x33acda['shift']());}};_0x2a5805(++_0x6cfb30);}(_0xa9e0,0x123));var _0x0a9e=function(_0x138f59,_0x1b53fb){_0x138f59=_0x138f59-0x0;var _0x3d114d=_0xa9e0[_0x138f59];return _0x3d114d;};'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 e477c51..9eed2e0 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 _0x2e96=['Request','GetVoiceQueueRtPauses','getVoiceQueueRtPauses'];(function(_0x3a7b62,_0x543b98){var _0x1cfe99=function(_0x29e4e5){while(--_0x29e4e5){_0x3a7b62['push'](_0x3a7b62['shift']());}};_0x1cfe99(++_0x543b98);}(_0x2e96,0x16a));var _0x62e9=function(_0x4cb734,_0x2f1f3c){_0x4cb734=_0x4cb734-0x0;var _0x152dad=_0x2e96[_0x4cb734];return _0x152dad;};'use strict';var client=require('../client');exports[_0x62e9('0x0')]=function(_0x4b0fed){return function(){return client[_0x62e9('0x1')](_0x62e9('0x2'),{'options':{'where':{'VoiceQueueId':_0x4b0fed,'paused':!![]},'raw':!![]},'log':_0x62e9('0x0')});};}; \ No newline at end of file +var _0x65da=['getVoiceQueueRtPauses','GetVoiceQueueRtPauses'];(function(_0x57b0c2,_0x45c488){var _0x178460=function(_0x39782b){while(--_0x39782b){_0x57b0c2['push'](_0x57b0c2['shift']());}};_0x178460(++_0x45c488);}(_0x65da,0x112));var _0xa65d=function(_0xdea41a,_0x552987){_0xdea41a=_0xdea41a-0x0;var _0x15d0d8=_0x65da[_0xdea41a];return _0x15d0d8;};'use strict';var client=require('../client');exports[_0xa65d('0x0')]=function(_0x5b51d3){return function(){return client['Request'](_0xa65d('0x1'),{'options':{'where':{'VoiceQueueId':_0x5b51d3,'paused':!![]},'raw':!![]},'log':_0xa65d('0x0')});};}; \ No newline at end of file diff --git a/server/services/ami/rpc/voiceRecording.js b/server/services/ami/rpc/voiceRecording.js index 4e2aeda..4fc9507 100644 --- a/server/services/ami/rpc/voiceRecording.js +++ b/server/services/ami/rpc/voiceRecording.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x7a54=['create','Request','CreateVoiceRecording','monitorFilename','lodash','../client'];(function(_0x294bd5,_0x336ea9){var _0x5b2942=function(_0x221601){while(--_0x221601){_0x294bd5['push'](_0x294bd5['shift']());}};_0x5b2942(++_0x336ea9);}(_0x7a54,0x106));var _0x47a5=function(_0x139c17,_0x1f5ca4){_0x139c17=_0x139c17-0x0;var _0x2c9927=_0x7a54[_0x139c17];return _0x2c9927;};'use strict';var _=require(_0x47a5('0x0'));var client=require(_0x47a5('0x1'));exports[_0x47a5('0x2')]=function(_0x58157c){return client[_0x47a5('0x3')](_0x47a5('0x4'),{'body':_['merge'](_0x58157c,{'value':_0x58157c[_0x47a5('0x5')]}),'log':_0x47a5('0x4')});}; \ No newline at end of file +var _0x9957=['CreateVoiceRecording','merge','monitorFilename','lodash','../client','create'];(function(_0x49e6a5,_0x5cb549){var _0x2ca017=function(_0x152885){while(--_0x152885){_0x49e6a5['push'](_0x49e6a5['shift']());}};_0x2ca017(++_0x5cb549);}(_0x9957,0x93));var _0x7995=function(_0x2dafbe,_0x5d04de){_0x2dafbe=_0x2dafbe-0x0;var _0x58a45a=_0x9957[_0x2dafbe];return _0x58a45a;};'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 65299c8..1ba1edc 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 _0x462d=['secondtransfererconnectedlinenum','secondtransfererconnectedlinename','origtransfereraccountcode','secondtransferercontext','origtransfererlinkedid','transfertargetchannel','transfertargetcalleridname','transfertargetconnectedlinenum','transfertargetconnectedlinename','transfertargetaccountcode','transfertargetcontext','transfertargetexten','transfertargetlinkedid','origtransferercontext','origtransfererexten','../client','transfers','blindTransfer','CreateVoiceTransferReport','result','transfererchannel','transferercalleridnum','transferercalleridname','transfererconnectedlinenum','transfererconnectedlinename','transfereraccountcode','transferercontext','transfererexten','transfererlinkedid','transfereechannel','transfereecalleridnum','transfereeconnectedlinenum','transfereeaccountcode','transfereecontext','transfereelinkedid','isexternal','context','extension','blind','Request','origtransfererchannel','origtransferercalleridnum','origtransferercalleridname'];(function(_0x3d74b7,_0x16caa0){var _0x1bd2a4=function(_0x28b3d5){while(--_0x28b3d5){_0x3d74b7['push'](_0x3d74b7['shift']());}};_0x1bd2a4(++_0x16caa0);}(_0x462d,0x65));var _0xd462=function(_0x16b8f8,_0x2ed7a6){_0x16b8f8=_0x16b8f8-0x0;var _0x19278a=_0x462d[_0x16b8f8];return _0x19278a;};'use strict';var client=require(_0xd462('0x0'));exports[_0xd462('0x1')]={};exports[_0xd462('0x2')]=function(_0xbe42df){return client['Request'](_0xd462('0x3'),{'body':{'result':_0xbe42df[_0xd462('0x4')],'transfererchannel':_0xbe42df[_0xd462('0x5')],'transferercalleridnum':_0xbe42df[_0xd462('0x6')],'transferercalleridname':_0xbe42df[_0xd462('0x7')],'transfererconnectedlinenum':_0xbe42df[_0xd462('0x8')],'transfererconnectedlinename':_0xbe42df[_0xd462('0x9')],'transfereraccountcode':_0xbe42df[_0xd462('0xa')],'transferercontext':_0xbe42df[_0xd462('0xb')],'transfererexten':_0xbe42df[_0xd462('0xc')],'transfererlinkedid':_0xbe42df[_0xd462('0xd')],'transfereechannel':_0xbe42df[_0xd462('0xe')],'transfereecalleridnum':_0xbe42df[_0xd462('0xf')],'transfereecalleridname':_0xbe42df['transfereecalleridname'],'transfereeconnectedlinenum':_0xbe42df[_0xd462('0x10')],'transfereeconnectedlinename':_0xbe42df['transfereeconnectedlinename'],'transfereeaccountcode':_0xbe42df[_0xd462('0x11')],'transfereecontext':_0xbe42df[_0xd462('0x12')],'transfereeexten':_0xbe42df['transfereeexten'],'transfereelinkedid':_0xbe42df[_0xd462('0x13')],'isexternal':_0xbe42df[_0xd462('0x14')],'context':_0xbe42df[_0xd462('0x15')],'extension':_0xbe42df[_0xd462('0x16')],'type':_0xd462('0x17')},'log':_0xd462('0x3')});};exports['attendedTransfer']=function(_0x59f77c){return client[_0xd462('0x18')](_0xd462('0x3'),{'body':{'result':_0x59f77c['result'],'transfererchannel':_0x59f77c[_0xd462('0x19')],'transferercalleridnum':_0x59f77c[_0xd462('0x1a')],'transferercalleridname':_0x59f77c[_0xd462('0x1b')],'transfererconnectedlinenum':_0x59f77c[_0xd462('0x1c')],'transfererconnectedlinename':_0x59f77c[_0xd462('0x1d')],'transfereraccountcode':_0x59f77c[_0xd462('0x1e')],'transferercontext':_0x59f77c[_0xd462('0x1f')],'transfererexten':_0x59f77c['secondtransfererexten'],'transfererlinkedid':_0x59f77c[_0xd462('0x20')],'transfereechannel':_0x59f77c[_0xd462('0x21')],'transfereecalleridnum':_0x59f77c['transfertargetcalleridnum'],'transfereecalleridname':_0x59f77c[_0xd462('0x22')],'transfereeconnectedlinenum':_0x59f77c[_0xd462('0x23')],'transfereeconnectedlinename':_0x59f77c[_0xd462('0x24')],'transfereeaccountcode':_0x59f77c[_0xd462('0x25')],'transfereecontext':_0x59f77c[_0xd462('0x26')],'transfereeexten':_0x59f77c[_0xd462('0x27')],'transfereelinkedid':_0x59f77c[_0xd462('0x28')],'isexternal':_0x59f77c[_0xd462('0x14')],'context':_0x59f77c[_0xd462('0x29')],'extension':_0x59f77c[_0xd462('0x2a')],'type':'attended'},'log':'CreateVoiceTransferReport'});}; \ No newline at end of file +var _0x757a=['origtransferercalleridname','secondtransfererconnectedlinenum','origtransfererlinkedid','transfertargetchannel','transfertargetcalleridnum','transfertargetcalleridname','transfertargetconnectedlinename','transfertargetaccountcode','transfertargetcontext','transfertargetlinkedid','origtransferercontext','origtransfererexten','transfers','Request','CreateVoiceTransferReport','result','transfererchannel','transferercalleridname','transfererconnectedlinenum','transfererconnectedlinename','transfererlinkedid','transfereechannel','transfereecalleridnum','transfereecalleridname','transfereeconnectedlinenum','transfereeconnectedlinename','transfereeaccountcode','transfereelinkedid','isexternal','context','extension','attendedTransfer','origtransfererchannel'];(function(_0x41cd99,_0x226682){var _0x2fd51b=function(_0x2c3134){while(--_0x2c3134){_0x41cd99['push'](_0x41cd99['shift']());}};_0x2fd51b(++_0x226682);}(_0x757a,0x90));var _0xa757=function(_0x619ce5,_0x522191){_0x619ce5=_0x619ce5-0x0;var _0x1c1363=_0x757a[_0x619ce5];return _0x1c1363;};'use strict';var client=require('../client');exports[_0xa757('0x0')]={};exports['blindTransfer']=function(_0x105e53){return client[_0xa757('0x1')](_0xa757('0x2'),{'body':{'result':_0x105e53[_0xa757('0x3')],'transfererchannel':_0x105e53[_0xa757('0x4')],'transferercalleridnum':_0x105e53['transferercalleridnum'],'transferercalleridname':_0x105e53[_0xa757('0x5')],'transfererconnectedlinenum':_0x105e53[_0xa757('0x6')],'transfererconnectedlinename':_0x105e53[_0xa757('0x7')],'transfereraccountcode':_0x105e53['transfereraccountcode'],'transferercontext':_0x105e53['transferercontext'],'transfererexten':_0x105e53['transfererexten'],'transfererlinkedid':_0x105e53[_0xa757('0x8')],'transfereechannel':_0x105e53[_0xa757('0x9')],'transfereecalleridnum':_0x105e53[_0xa757('0xa')],'transfereecalleridname':_0x105e53[_0xa757('0xb')],'transfereeconnectedlinenum':_0x105e53[_0xa757('0xc')],'transfereeconnectedlinename':_0x105e53[_0xa757('0xd')],'transfereeaccountcode':_0x105e53[_0xa757('0xe')],'transfereecontext':_0x105e53['transfereecontext'],'transfereeexten':_0x105e53['transfereeexten'],'transfereelinkedid':_0x105e53[_0xa757('0xf')],'isexternal':_0x105e53[_0xa757('0x10')],'context':_0x105e53[_0xa757('0x11')],'extension':_0x105e53[_0xa757('0x12')],'type':'blind'},'log':_0xa757('0x2')});};exports[_0xa757('0x13')]=function(_0xa3150c){return client[_0xa757('0x1')](_0xa757('0x2'),{'body':{'result':_0xa3150c[_0xa757('0x3')],'transfererchannel':_0xa3150c[_0xa757('0x14')],'transferercalleridnum':_0xa3150c['origtransferercalleridnum'],'transferercalleridname':_0xa3150c[_0xa757('0x15')],'transfererconnectedlinenum':_0xa3150c[_0xa757('0x16')],'transfererconnectedlinename':_0xa3150c['secondtransfererconnectedlinename'],'transfereraccountcode':_0xa3150c['origtransfereraccountcode'],'transferercontext':_0xa3150c['secondtransferercontext'],'transfererexten':_0xa3150c['secondtransfererexten'],'transfererlinkedid':_0xa3150c[_0xa757('0x17')],'transfereechannel':_0xa3150c[_0xa757('0x18')],'transfereecalleridnum':_0xa3150c[_0xa757('0x19')],'transfereecalleridname':_0xa3150c[_0xa757('0x1a')],'transfereeconnectedlinenum':_0xa3150c['transfertargetconnectedlinenum'],'transfereeconnectedlinename':_0xa3150c[_0xa757('0x1b')],'transfereeaccountcode':_0xa3150c[_0xa757('0x1c')],'transfereecontext':_0xa3150c[_0xa757('0x1d')],'transfereeexten':_0xa3150c['transfertargetexten'],'transfereelinkedid':_0xa3150c[_0xa757('0x1e')],'isexternal':_0xa3150c['isexternal'],'context':_0xa3150c[_0xa757('0x1f')],'extension':_0xa3150c[_0xa757('0x20')],'type':'attended'},'log':_0xa757('0x2')});}; \ No newline at end of file diff --git a/server/services/ami/server/index.js b/server/services/ami/server/index.js index d84945b..3f72d50 100644 --- a/server/services/ami/server/index.js +++ b/server/services/ami/server/index.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0xb10b=['type','Invalid\x20type\x20parameter.\x20Allowed\x20values:\x20inbound,\x20outbound','filter','count','rows','voicequeuechannel','voicequeuechannelhangup','Hangup','voicequeuechannelredirect','Redirect','telephones','trunks','run','event','Event\x20name\x20mandatory','faxAccounts','send','checkAfterSend','server','http','127.0.0.1','RPC\x20listening\x20on\x20port:','lodash','jayson/promise','validate','moment','../properties','../ami','../model/voiceQueueSummary','listen','format','%s/%s','SIP','name','timers','timer','updateAcw','agents','voiceStatus','pause','QueuePause','isConnected','error','asterisk','username','ami\x20disconnected','join','pick','keys','module','action','Reload','Action','then','message','catch','command','Command','content','voiceQueues','hasOwnProperty','push','length','find','omit','undefined','values','voicechannel','map','channels','uniqueid','channel','%s.%s','filename','wav','ai(mixmonitorid)','/var/spool/asterisk/monitor/','toLowerCase','mixmonitorid','rec','status','MixMonitor\x20Success','Channel\x20doesn\x27t\x20exist','resolve','StopMixMonitor','destinationchannel','monitors','stop','queueChannels','inbound','outbound','includes'];(function(_0x4a3a51,_0x33ac28){var _0xd8d48e=function(_0x1c359d){while(--_0x1c359d){_0x4a3a51['push'](_0x4a3a51['shift']());}};_0xd8d48e(++_0x33ac28);}(_0xb10b,0x12a));var _0xbb10=function(_0x20c809,_0x26b566){_0x20c809=_0x20c809-0x0;var _0x1064a1=_0xb10b[_0x20c809];return _0x1064a1;};'use strict';var _=require(_0xbb10('0x0'));var util=require('util');var jayson=require(_0xbb10('0x1'));var schema=require(_0xbb10('0x2'));var moment=require(_0xbb10('0x3'));var config=require('../../../config/environment');var properties=require(_0xbb10('0x4'));var ami=require(_0xbb10('0x5'));var VoiceQueueSummary=require(_0xbb10('0x6'));exports[_0xbb10('0x7')]=function(_0x49baf4,_0x312b72,_0x481979){return new Promise(function(_0x328583,_0x3cdd53){var _0x513741={'QueuePause':function(_0x1b9e94){return new Promise(function(_0x3fb675){var _0x21370f=util[_0xbb10('0x8')](_0xbb10('0x9'),_0xbb10('0xa'),_0x1b9e94[_0xbb10('0xb')]);if(_0x49baf4[_0xbb10('0xc')]&&_0x49baf4['timers'][_0x21370f]&&_0x49baf4['timers'][_0x21370f][_0xbb10('0xd')]){_0x49baf4[_0xbb10('0xc')][_0x21370f][_0xbb10('0xe')]();}if(_0x49baf4['agents'][_0x21370f]){_0x49baf4[_0xbb10('0xf')][_0x21370f]['updateStatusRealtime']({'state':_0x49baf4[_0xbb10('0xf')][_0x21370f][_0xbb10('0x10')],'statePause':_0x1b9e94[_0xbb10('0x11')]?!![]:![]});}_0x3fb675({'code':0xc8,'message':_0xbb10('0x12')});});},'Reload':function(_0x442548){var _0x147230=this;return new Promise(function(_0x58a612,_0x26e021){if(ami[_0xbb10('0x13')]()==![]){return _0x26e021(_0x147230[_0xbb10('0x14')](0x1f4,[config[_0xbb10('0x15')]['ip'],config[_0xbb10('0x15')][_0xbb10('0x16')],_0xbb10('0x17')][_0xbb10('0x18')]('\x20')));}_0x442548=_[_0xbb10('0x19')](_0x442548,_[_0xbb10('0x1a')](properties['reload'][_0xbb10('0x1b')]));_0x442548[_0xbb10('0x1c')]=_0xbb10('0x1d');return ami[_0xbb10('0x1e')](_0x442548)[_0xbb10('0x1f')](function(_0x1682a4){_0x58a612({'code':0xc8,'message':_0x1682a4[_0xbb10('0x20')]});})[_0xbb10('0x21')](function(_0xbf2906){_0x26e021(_0x147230[_0xbb10('0x14')](0x1f5,_0xbf2906['message']));});});},'Command':function(_0x5ff0cf){var _0x19f48d=this;return new Promise(function(_0x388fab,_0x109908){if(ami[_0xbb10('0x13')]()==![]){return _0x109908(_0x19f48d[_0xbb10('0x14')](0x1f4,[config['asterisk']['ip'],config[_0xbb10('0x15')][_0xbb10('0x16')],'ami\x20disconnected']['join']('\x20')));}_0x5ff0cf=_[_0xbb10('0x19')](_0x5ff0cf,_0xbb10('0x22'));_0x5ff0cf[_0xbb10('0x1c')]=_0xbb10('0x23');return ami[_0xbb10('0x1e')](_0x5ff0cf)[_0xbb10('0x1f')](function(_0x407cb4){_0x388fab({'code':0xc8,'message':_0x407cb4[_0xbb10('0x24')]});})[_0xbb10('0x21')](function(_0x395404){_0x109908(_0x19f48d[_0xbb10('0x14')](0x1f5,_0x395404[_0xbb10('0x20')]));});});},'VoiceQueues':function(){return new Promise(function(_0x537898){var _0x4fedac=[];for(var _0x4fb5e0 in _0x49baf4[_0xbb10('0x25')]){if(_0x49baf4[_0xbb10('0x25')][_0xbb10('0x26')](_0x4fb5e0)){var _0x4e25ff=_0x49baf4[_0xbb10('0x25')][_0x4fb5e0];var _0x24d586=new VoiceQueueSummary(_0x4e25ff);_0x4fedac[_0xbb10('0x27')](_0x24d586);}}_0x537898({'count':_0x4fedac[_0xbb10('0x28')],'rows':_0x4fedac});});},'UpdateVoiceQueue':function(_0x1acce9){return new Promise(function(_0x20d946,_0x2a0e8b){var _0x4aabb9=_[_0xbb10('0x29')](_0x49baf4[_0xbb10('0x25')],{'id':parseInt(_0x1acce9['id'])});var _0xfc3595=_[_0xbb10('0x2a')](_0x1acce9,['id']);if(_0x4aabb9){for(var _0x1d30aa in _0xfc3595){if(typeof _0xfc3595[_0x1d30aa]!==_0xbb10('0x2b')&&typeof _0x4aabb9[_0x1d30aa]!=='undefined'){_0x4aabb9[_0x1d30aa]=_0xfc3595[_0x1d30aa];}}_0x20d946(_0x4aabb9);}else{_0x2a0e8b();}});},'VoiceChannels':function(){return new Promise(function(_0x221624){var _0x4ee02e=_[_0xbb10('0x2c')](_0x49baf4['channels']);_0x221624({'count':_0x4ee02e[_0xbb10('0x28')],'rows':_0x4ee02e});});},'VoiceChannelMixMonitor':function(_0x1dcc9c){var _0x1b59f9=this;return new Promise(function(_0x491db4,_0x518d47){if(ami[_0xbb10('0x13')]()==![]){return _0x518d47(_0x1b59f9[_0xbb10('0x14')](0x1f4,[config['asterisk']['ip'],config[_0xbb10('0x15')][_0xbb10('0x16')],_0xbb10('0x17')][_0xbb10('0x18')]('\x20')));}var _0x37a83f=schema(properties[_0xbb10('0x2d')])[_0xbb10('0x2')](_0x1dcc9c);if(_0x37a83f['length']>0x0){return _0x518d47(_0x1b59f9[_0xbb10('0x14')](0x1f4,_[_0xbb10('0x2e')](_0x37a83f,_0xbb10('0x20'))[_0xbb10('0x18')](',\x20')));}var _0xfb2c5e=_[_0xbb10('0x29')](_0x49baf4[_0xbb10('0x2f')],{'uniqueid':_0x1dcc9c[_0xbb10('0x30')]});if(_0xfb2c5e&&_0xfb2c5e[_0xbb10('0x31')]){var _0x56943c=util[_0xbb10('0x8')](_0xbb10('0x32'),_0x1dcc9c[_0xbb10('0x33')]||_0x1dcc9c[_0xbb10('0x30')],_0x1dcc9c['format']||_0xbb10('0x34'));return ami['Action']({'action':'MixMonitor','channel':_0xfb2c5e[_0xbb10('0x31')],'file':_0x56943c,'options':_0xbb10('0x35')})[_0xbb10('0x1f')](function(_0x120d21){var _0x15d895=_[_0xbb10('0x29')](_0xfb2c5e['monitors'],{'filename':_0xbb10('0x36')+_0x56943c[_0xbb10('0x37')]()});if(_['isNil'](_0x15d895)){_0xfb2c5e['monitors']['push']({'filename':_0xbb10('0x36')+_0x56943c[_0xbb10('0x37')](),'createdAt':moment()[_0xbb10('0x8')]('YYYY-MM-DD\x20HH:mm:ss'),'mixmonitorid':_0x120d21[_0xbb10('0x38')],'status':_0xbb10('0x39')});}else{_0x15d895[_0xbb10('0x38')]=_0x120d21['mixmonitorid'];_0x15d895[_0xbb10('0x3a')]=_0xbb10('0x39');}_0x491db4({'code':0xc8,'message':[_0x1dcc9c[_0xbb10('0x30')],_0xbb10('0x3b'),_0x120d21['mixmonitorid']][_0xbb10('0x18')]('\x20'),'mixmonitorid':_0x120d21[_0xbb10('0x38')]});})['catch'](function(_0xe2040f){_0x518d47(_0x1b59f9[_0xbb10('0x14')](0x1f5,[_0x1dcc9c[_0xbb10('0x30')],_0xe2040f[_0xbb10('0x20')][_0xbb10('0x37')]()][_0xbb10('0x18')]('\x20')));});}else{return _0x518d47(_0x1b59f9['error'](0x1f5,_0xbb10('0x3c')));}});},'VoiceChannelStopMixMonitor':function(_0x1c7fae){var _0x3e7b4c=this;return new Promise(function(_0x3d3c41,_0x4943d9){if(ami[_0xbb10('0x13')]()==![]){return _0x4943d9(_0x3e7b4c[_0xbb10('0x14')](0x1f4,[config[_0xbb10('0x15')]['ip'],config[_0xbb10('0x15')]['username'],_0xbb10('0x17')][_0xbb10('0x18')]('\x20')));}var _0x54ac18=schema(properties['voicechannel'])[_0xbb10('0x2')](_0x1c7fae);if(_0x54ac18['length']>0x0){return _0x4943d9(_0x3e7b4c[_0xbb10('0x14')](0x1f4,_[_0xbb10('0x2e')](_0x54ac18,'message')[_0xbb10('0x18')](',\x20')));}var _0x1d82bf=_[_0xbb10('0x29')](_0x49baf4['channels'],{'uniqueid':_0x1c7fae[_0xbb10('0x30')]});if(_0x1d82bf){return Promise[_0xbb10('0x3d')]()[_0xbb10('0x1f')](function(){if(_0x1d82bf[_0xbb10('0x31')]){return ami[_0xbb10('0x1e')]({'action':_0xbb10('0x3e'),'channel':_0x1d82bf[_0xbb10('0x31')],'mixmonitorid':_0x1c7fae[_0xbb10('0x38')]})[_0xbb10('0x21')](function(){});}})[_0xbb10('0x1f')](function(){if(_0x1d82bf[_0xbb10('0x3f')]){return ami[_0xbb10('0x1e')]({'action':'StopMixMonitor','channel':_0x1d82bf[_0xbb10('0x3f')],'mixmonitorid':_0x1c7fae[_0xbb10('0x38')]})['catch'](function(){});}})[_0xbb10('0x1f')](function(){var _0x2f5027=_[_0xbb10('0x29')](_0x1d82bf[_0xbb10('0x40')],{'mixmonitorid':_0x1c7fae[_0xbb10('0x38')]});if(_0x2f5027){_0x2f5027[_0xbb10('0x3a')]=_0xbb10('0x41');}})['then'](function(){var _0x4a9793=util[_0xbb10('0x8')](_0xbb10('0x32'),_0x1c7fae[_0xbb10('0x33')]||_0x1c7fae['uniqueid'],_0x1c7fae['format']||_0xbb10('0x34'));var _0x34cf4e=_[_0xbb10('0x29')](_0x1d82bf[_0xbb10('0x40')],{'filename':_0xbb10('0x36')+_0x4a9793[_0xbb10('0x37')]()});if(_0x34cf4e){_0x34cf4e[_0xbb10('0x3a')]=_0xbb10('0x41');}})[_0xbb10('0x1f')](function(){_0x3d3c41({'code':0xc8,'message':[_0x1c7fae[_0xbb10('0x30')],'StopMixMonitor\x20Success']['join']('\x20')});})[_0xbb10('0x21')](function(_0x467dba){_0x4943d9(_0x3e7b4c[_0xbb10('0x14')](0x1f5,[_0x1c7fae[_0xbb10('0x30')],_0x467dba[_0xbb10('0x20')][_0xbb10('0x37')]()][_0xbb10('0x18')]('\x20')));});}else{return _0x4943d9(_0x3e7b4c[_0xbb10('0x14')](0x1f5,_0xbb10('0x3c')));}});},'VoiceQueuesChannels':function(_0x1214f7){var _0x19ca3e=this;return new Promise(function(_0x20e18a){var _0x61e689=_[_0xbb10('0x2c')](_0x49baf4[_0xbb10('0x42')]);var _0x547a7a={'count':_0x61e689[_0xbb10('0x28')],'rows':_0x61e689};if(_0x1214f7&&_0x1214f7['type']){if(![_0xbb10('0x43'),_0xbb10('0x44')][_0xbb10('0x45')](_0x1214f7[_0xbb10('0x46')])){return _0x3cdd53(_0x19ca3e[_0xbb10('0x14')](0x190,_0xbb10('0x47')));}var _0x2e3326=_[_0xbb10('0x48')](_0x61e689,function(_0x180400){return _0x180400[_0xbb10('0x46')]===_0x1214f7[_0xbb10('0x46')];});_0x547a7a[_0xbb10('0x49')]=_0x2e3326[_0xbb10('0x28')];_0x547a7a[_0xbb10('0x4a')]=_0x2e3326;}_0x20e18a(_0x547a7a);});},'VoiceQueuesChannel':function(_0x4475e1){var _0x5de0cc=this;return new Promise(function(_0x4571b6,_0x466eb7){var _0x1b83a9=schema(properties[_0xbb10('0x4b')])[_0xbb10('0x2')](_0x4475e1);if(_0x1b83a9[_0xbb10('0x28')]>0x0){return _0x466eb7(_0x5de0cc['error'](0x1f4,_[_0xbb10('0x2e')](_0x1b83a9,_0xbb10('0x20'))[_0xbb10('0x18')](',\x20')));}var _0x14fed3=_[_0xbb10('0x29')](_0x49baf4[_0xbb10('0x42')],{'uniqueid':_0x4475e1[_0xbb10('0x30')]});if(_0x14fed3){_0x4571b6(_0x14fed3);}else{return _0x466eb7(_0x5de0cc[_0xbb10('0x14')](0x1f5,_0xbb10('0x3c')));}});},'VoiceQueuesChannelHangup':function(_0x40c4fb){var _0x2eb05a=this;return new Promise(function(_0x2a1ce1,_0x16932f){if(ami['isConnected']()==![]){return _0x16932f(_0x2eb05a['error'](0x1f4,[config[_0xbb10('0x15')]['ip'],config[_0xbb10('0x15')][_0xbb10('0x16')],_0xbb10('0x17')]['join']('\x20')));}var _0x506498=schema(properties[_0xbb10('0x4c')])[_0xbb10('0x2')](_0x40c4fb);if(_0x506498[_0xbb10('0x28')]>0x0){return _0x16932f(_0x2eb05a[_0xbb10('0x14')](0x1f4,_[_0xbb10('0x2e')](_0x506498,_0xbb10('0x20'))[_0xbb10('0x18')](',\x20')));}var _0x4a5fb9=_[_0xbb10('0x29')](_0x49baf4[_0xbb10('0x42')],{'uniqueid':_0x40c4fb['uniqueid']});if(_0x4a5fb9&&_0x4a5fb9['channel']){return ami['Action']({'action':_0xbb10('0x4d'),'channel':_0x4a5fb9[_0xbb10('0x31')]})[_0xbb10('0x1f')](function(_0x5bd1c0){_0x2a1ce1({'code':0xc8,'message':[_0x40c4fb['uniqueid'],_0x5bd1c0['message'][_0xbb10('0x37')]()][_0xbb10('0x18')]('\x20')});})[_0xbb10('0x21')](function(_0x4e9fbd){_0x16932f(_0x2eb05a[_0xbb10('0x14')](0x1f5,[_0x40c4fb[_0xbb10('0x30')],_0x4e9fbd['message']['toLowerCase']()][_0xbb10('0x18')]('\x20')));});}else{return _0x16932f(_0x2eb05a[_0xbb10('0x14')](0x1f5,_0xbb10('0x3c')));}});},'VoiceQueuesChannelRedirect':function(_0x237246){var _0x54b7c5=this;return new Promise(function(_0x43eaec,_0xec48ac){if(ami[_0xbb10('0x13')]()==![]){return _0xec48ac(_0x54b7c5['error'](0x1f4,[config[_0xbb10('0x15')]['ip'],config[_0xbb10('0x15')][_0xbb10('0x16')],'ami\x20disconnected'][_0xbb10('0x18')]('\x20')));}var _0x31e85e=schema(properties[_0xbb10('0x4e')])[_0xbb10('0x2')](_0x237246);if(_0x31e85e['length']>0x0){return _0xec48ac(_0x54b7c5[_0xbb10('0x14')](0x1f4,_[_0xbb10('0x2e')](_0x31e85e,_0xbb10('0x20'))[_0xbb10('0x18')](',\x20')));}var _0x56b3a3=_[_0xbb10('0x29')](_0x49baf4[_0xbb10('0x42')],{'uniqueid':_0x237246[_0xbb10('0x30')]});if(_0x56b3a3&&_0x56b3a3[_0xbb10('0x31')]){return ami[_0xbb10('0x1e')]({'action':_0xbb10('0x4f'),'channel':_0x56b3a3[_0xbb10('0x31')],'exten':_0x237246['exten'],'context':_0x237246['context']||_0x56b3a3['context'],'priority':0x1})[_0xbb10('0x1f')](function(_0x9c672d){_0x43eaec({'code':0xc8,'message':[_0x237246[_0xbb10('0x30')],_0x9c672d['message']['toLowerCase']()][_0xbb10('0x18')]('\x20')});})[_0xbb10('0x21')](function(_0xd9e743){_0xec48ac(_0x54b7c5[_0xbb10('0x14')](0x1f5,[_0x237246[_0xbb10('0x30')],_0xd9e743[_0xbb10('0x20')]['toLowerCase']()][_0xbb10('0x18')]('\x20')));});}else{return _0xec48ac(_0x54b7c5[_0xbb10('0x14')](0x1f5,_0xbb10('0x3c')));}});},'Agents':function(_0x14f16b){return new Promise(function(_0x2aaaa6){var _0x5bfc68=_['values'](_0x49baf4['agents']);if(_0x14f16b&&_0x14f16b['id']){var _0x329da7=_[_0xbb10('0x29')](_0x5bfc68,function(_0x36917f){return _0x36917f['id']===_0x14f16b['id'];});_0x2aaaa6(_0x329da7);}else{_0x2aaaa6({'count':_0x5bfc68[_0xbb10('0x28')],'rows':_0x5bfc68});}});},'Telephones':function(){return new Promise(function(_0x2f7d2a){var _0x1d40b8=_['values'](_0x49baf4[_0xbb10('0x50')]);_0x2f7d2a({'count':_0x1d40b8['length'],'rows':_0x1d40b8});});},'Trunks':function(){return new Promise(function(_0x4fe3b5){var _0x519a54=_[_0xbb10('0x2c')](_0x49baf4[_0xbb10('0x51')]);_0x4fe3b5({'count':_0x519a54[_0xbb10('0x28')],'rows':_0x519a54});});},'OutboundChannels':function(){return new Promise(function(_0x108f99){var _0x5ce94f=_[_0xbb10('0x2c')](_0x49baf4['outboundChannels']);_0x108f99({'count':_0x5ce94f['length'],'rows':_0x5ce94f});});},'Outbound':function(){return new Promise(function(_0x165fe9){_0x165fe9(_0x49baf4[_0xbb10('0x44')]);});},'Campaigns':function(){return new Promise(function(_0x29529c){var _0x2bd2ab=_[_0xbb10('0x2c')](_0x49baf4['campaigns']);_0x29529c({'count':_0x2bd2ab[_0xbb10('0x28')],'rows':_0x2bd2ab});});},'VoiceQueuesPreview':function(_0x19fcec){var _0x2c6429=this;return new Promise(function(_0x3f3d38,_0x43cdb7){_0x312b72[_0xbb10('0x52')](_0x19fcec['id'])[_0xbb10('0x1f')](function(_0x53fa98){_0x3f3d38({'code':0xc8,'message':_0x53fa98[_0xbb10('0x20')]});})[_0xbb10('0x21')](function(_0x30f3ea){_0x43cdb7(_0x2c6429[_0xbb10('0x14')](0x1f4,_0x30f3ea[_0xbb10('0x20')]));});});},'EventManager':function(_0x172be3){var _0xa3b23=this;return new Promise(function(_0x312a08,_0x5a4429){if(!_0x172be3[_0xbb10('0x53')]){return _0x5a4429(_0xa3b23[_0xbb10('0x14')](0x1f4,_0xbb10('0x54')));}ami['emit']('custom:'+_0x172be3['event'],_0x172be3[_0xbb10('0x20')]);_0x312a08({'code':0xc8,'message':_0x172be3});});},'FaxAccounts':function(){return new Promise(function(_0x5a3c44){var _0x4e3d6a=_[_0xbb10('0x2c')](_0x49baf4[_0xbb10('0x55')]);_0x5a3c44({'count':_0x4e3d6a[_0xbb10('0x28')],'rows':_0x4e3d6a});});},'SendFax':function(_0x12ed63){var _0x32ec27=this;return new Promise(function(_0x24dca6,_0x33116){_0x481979[_0xbb10('0x56')](_0x12ed63)[_0xbb10('0x1f')](function(_0x5206e1){_0x24dca6({'code':0xc8,'message':_0x5206e1[_0xbb10('0x20')]});})[_0xbb10('0x21')](function(_0x46b6d2){_0x33116(_0x32ec27[_0xbb10('0x14')](0x1f4,_0x46b6d2['message']));});});},'CheckAfterSend':function(_0x4c0795){var _0x3547a3=this;return new Promise(function(_0x2280bd,_0x30f0a4){_0x481979[_0xbb10('0x57')](_0x4c0795)['then'](function(_0x17d596){_0x2280bd({'code':0xc8,'message':_0x17d596[_0xbb10('0x20')]});})[_0xbb10('0x21')](function(_0xf7b3e1){_0x30f0a4(_0x3547a3[_0xbb10('0x14')](0x1f4,_0xf7b3e1['message']));});});}};var _0x5f0691=jayson[_0xbb10('0x58')](_0x513741)[_0xbb10('0x59')]();_0x5f0691['on'](_0xbb10('0x14'),function(_0x5239da){return _0x3cdd53(_0x5239da);});_0x5f0691[_0xbb10('0x7')](0x232a,_0xbb10('0x5a'),function(){console['log']('AMI\x20RPC\x20server\x20listening\x20on\x20127.0.0.1:%d!',0x232a);return _0x328583(_0xbb10('0x5b')+0x232a);});});}; \ No newline at end of file +var _0xb10b=['type','Invalid\x20type\x20parameter.\x20Allowed\x20values:\x20inbound,\x20outbound','filter','count','rows','voicequeuechannel','voicequeuechannelhangup','Hangup','voicequeuechannelredirect','Redirect','telephones','trunks','run','event','Event\x20name\x20mandatory','faxAccounts','send','checkAfterSend','server','http','127.0.0.1','RPC\x20listening\x20on\x20port:','lodash','jayson/promise','validate','moment','../properties','../ami','../model/voiceQueueSummary','listen','format','%s/%s','SIP','name','timers','timer','updateAcw','agents','voiceStatus','pause','QueuePause','isConnected','error','asterisk','username','ami\x20disconnected','join','pick','keys','module','action','Reload','Action','then','message','catch','command','Command','content','voiceQueues','hasOwnProperty','push','length','find','omit','undefined','values','voicechannel','map','channels','uniqueid','channel','%s.%s','filename','wav','ai(mixmonitorid)','/var/spool/asterisk/monitor/','toLowerCase','mixmonitorid','rec','status','MixMonitor\x20Success','Channel\x20doesn\x27t\x20exist','resolve','StopMixMonitor','destinationchannel','monitors','stop','queueChannels','inbound','outbound','includes'];(function(_0x1ec03f,_0x4151a1){var _0xa2c46a=function(_0x31d2ac){while(--_0x31d2ac){_0x1ec03f['push'](_0x1ec03f['shift']());}};_0xa2c46a(++_0x4151a1);}(_0xb10b,0x12a));var _0xbb10=function(_0x1f6835,_0xff3520){_0x1f6835=_0x1f6835-0x0;var _0x10aee2=_0xb10b[_0x1f6835];return _0x10aee2;};'use strict';var _=require(_0xbb10('0x0'));var util=require('util');var jayson=require(_0xbb10('0x1'));var schema=require(_0xbb10('0x2'));var moment=require(_0xbb10('0x3'));var config=require('../../../config/environment');var properties=require(_0xbb10('0x4'));var ami=require(_0xbb10('0x5'));var VoiceQueueSummary=require(_0xbb10('0x6'));exports[_0xbb10('0x7')]=function(_0x49baf4,_0x312b72,_0x481979){return new Promise(function(_0x328583,_0x3cdd53){var _0x513741={'QueuePause':function(_0x1b9e94){return new Promise(function(_0x3fb675){var _0x21370f=util[_0xbb10('0x8')](_0xbb10('0x9'),_0xbb10('0xa'),_0x1b9e94[_0xbb10('0xb')]);if(_0x49baf4[_0xbb10('0xc')]&&_0x49baf4['timers'][_0x21370f]&&_0x49baf4['timers'][_0x21370f][_0xbb10('0xd')]){_0x49baf4[_0xbb10('0xc')][_0x21370f][_0xbb10('0xe')]();}if(_0x49baf4['agents'][_0x21370f]){_0x49baf4[_0xbb10('0xf')][_0x21370f]['updateStatusRealtime']({'state':_0x49baf4[_0xbb10('0xf')][_0x21370f][_0xbb10('0x10')],'statePause':_0x1b9e94[_0xbb10('0x11')]?!![]:![]});}_0x3fb675({'code':0xc8,'message':_0xbb10('0x12')});});},'Reload':function(_0x442548){var _0x147230=this;return new Promise(function(_0x58a612,_0x26e021){if(ami[_0xbb10('0x13')]()==![]){return _0x26e021(_0x147230[_0xbb10('0x14')](0x1f4,[config[_0xbb10('0x15')]['ip'],config[_0xbb10('0x15')][_0xbb10('0x16')],_0xbb10('0x17')][_0xbb10('0x18')]('\x20')));}_0x442548=_[_0xbb10('0x19')](_0x442548,_[_0xbb10('0x1a')](properties['reload'][_0xbb10('0x1b')]));_0x442548[_0xbb10('0x1c')]=_0xbb10('0x1d');return ami[_0xbb10('0x1e')](_0x442548)[_0xbb10('0x1f')](function(_0x1682a4){_0x58a612({'code':0xc8,'message':_0x1682a4[_0xbb10('0x20')]});})[_0xbb10('0x21')](function(_0xbf2906){_0x26e021(_0x147230[_0xbb10('0x14')](0x1f5,_0xbf2906['message']));});});},'Command':function(_0x5ff0cf){var _0x19f48d=this;return new Promise(function(_0x388fab,_0x109908){if(ami[_0xbb10('0x13')]()==![]){return _0x109908(_0x19f48d[_0xbb10('0x14')](0x1f4,[config['asterisk']['ip'],config[_0xbb10('0x15')][_0xbb10('0x16')],'ami\x20disconnected']['join']('\x20')));}_0x5ff0cf=_[_0xbb10('0x19')](_0x5ff0cf,_0xbb10('0x22'));_0x5ff0cf[_0xbb10('0x1c')]=_0xbb10('0x23');return ami[_0xbb10('0x1e')](_0x5ff0cf)[_0xbb10('0x1f')](function(_0x407cb4){_0x388fab({'code':0xc8,'message':_0x407cb4[_0xbb10('0x24')]});})[_0xbb10('0x21')](function(_0x395404){_0x109908(_0x19f48d[_0xbb10('0x14')](0x1f5,_0x395404[_0xbb10('0x20')]));});});},'VoiceQueues':function(){return new Promise(function(_0x537898){var _0x4fedac=[];for(var _0x4fb5e0 in _0x49baf4[_0xbb10('0x25')]){if(_0x49baf4[_0xbb10('0x25')][_0xbb10('0x26')](_0x4fb5e0)){var _0x4e25ff=_0x49baf4[_0xbb10('0x25')][_0x4fb5e0];var _0x24d586=new VoiceQueueSummary(_0x4e25ff);_0x4fedac[_0xbb10('0x27')](_0x24d586);}}_0x537898({'count':_0x4fedac[_0xbb10('0x28')],'rows':_0x4fedac});});},'UpdateVoiceQueue':function(_0x1acce9){return new Promise(function(_0x20d946,_0x2a0e8b){var _0x4aabb9=_[_0xbb10('0x29')](_0x49baf4[_0xbb10('0x25')],{'id':parseInt(_0x1acce9['id'])});var _0xfc3595=_[_0xbb10('0x2a')](_0x1acce9,['id']);if(_0x4aabb9){for(var _0x1d30aa in _0xfc3595){if(typeof _0xfc3595[_0x1d30aa]!==_0xbb10('0x2b')&&typeof _0x4aabb9[_0x1d30aa]!=='undefined'){_0x4aabb9[_0x1d30aa]=_0xfc3595[_0x1d30aa];}}_0x20d946(_0x4aabb9);}else{_0x2a0e8b();}});},'VoiceChannels':function(){return new Promise(function(_0x221624){var _0x4ee02e=_[_0xbb10('0x2c')](_0x49baf4['channels']);_0x221624({'count':_0x4ee02e[_0xbb10('0x28')],'rows':_0x4ee02e});});},'VoiceChannelMixMonitor':function(_0x1dcc9c){var _0x1b59f9=this;return new Promise(function(_0x491db4,_0x518d47){if(ami[_0xbb10('0x13')]()==![]){return _0x518d47(_0x1b59f9[_0xbb10('0x14')](0x1f4,[config['asterisk']['ip'],config[_0xbb10('0x15')][_0xbb10('0x16')],_0xbb10('0x17')][_0xbb10('0x18')]('\x20')));}var _0x37a83f=schema(properties[_0xbb10('0x2d')])[_0xbb10('0x2')](_0x1dcc9c);if(_0x37a83f['length']>0x0){return _0x518d47(_0x1b59f9[_0xbb10('0x14')](0x1f4,_[_0xbb10('0x2e')](_0x37a83f,_0xbb10('0x20'))[_0xbb10('0x18')](',\x20')));}var _0xfb2c5e=_[_0xbb10('0x29')](_0x49baf4[_0xbb10('0x2f')],{'uniqueid':_0x1dcc9c[_0xbb10('0x30')]});if(_0xfb2c5e&&_0xfb2c5e[_0xbb10('0x31')]){var _0x56943c=util[_0xbb10('0x8')](_0xbb10('0x32'),_0x1dcc9c[_0xbb10('0x33')]||_0x1dcc9c[_0xbb10('0x30')],_0x1dcc9c['format']||_0xbb10('0x34'));return ami['Action']({'action':'MixMonitor','channel':_0xfb2c5e[_0xbb10('0x31')],'file':_0x56943c,'options':_0xbb10('0x35')})[_0xbb10('0x1f')](function(_0x120d21){var _0x15d895=_[_0xbb10('0x29')](_0xfb2c5e['monitors'],{'filename':_0xbb10('0x36')+_0x56943c[_0xbb10('0x37')]()});if(_['isNil'](_0x15d895)){_0xfb2c5e['monitors']['push']({'filename':_0xbb10('0x36')+_0x56943c[_0xbb10('0x37')](),'createdAt':moment()[_0xbb10('0x8')]('YYYY-MM-DD\x20HH:mm:ss'),'mixmonitorid':_0x120d21[_0xbb10('0x38')],'status':_0xbb10('0x39')});}else{_0x15d895[_0xbb10('0x38')]=_0x120d21['mixmonitorid'];_0x15d895[_0xbb10('0x3a')]=_0xbb10('0x39');}_0x491db4({'code':0xc8,'message':[_0x1dcc9c[_0xbb10('0x30')],_0xbb10('0x3b'),_0x120d21['mixmonitorid']][_0xbb10('0x18')]('\x20'),'mixmonitorid':_0x120d21[_0xbb10('0x38')]});})['catch'](function(_0xe2040f){_0x518d47(_0x1b59f9[_0xbb10('0x14')](0x1f5,[_0x1dcc9c[_0xbb10('0x30')],_0xe2040f[_0xbb10('0x20')][_0xbb10('0x37')]()][_0xbb10('0x18')]('\x20')));});}else{return _0x518d47(_0x1b59f9['error'](0x1f5,_0xbb10('0x3c')));}});},'VoiceChannelStopMixMonitor':function(_0x1c7fae){var _0x3e7b4c=this;return new Promise(function(_0x3d3c41,_0x4943d9){if(ami[_0xbb10('0x13')]()==![]){return _0x4943d9(_0x3e7b4c[_0xbb10('0x14')](0x1f4,[config[_0xbb10('0x15')]['ip'],config[_0xbb10('0x15')]['username'],_0xbb10('0x17')][_0xbb10('0x18')]('\x20')));}var _0x54ac18=schema(properties['voicechannel'])[_0xbb10('0x2')](_0x1c7fae);if(_0x54ac18['length']>0x0){return _0x4943d9(_0x3e7b4c[_0xbb10('0x14')](0x1f4,_[_0xbb10('0x2e')](_0x54ac18,'message')[_0xbb10('0x18')](',\x20')));}var _0x1d82bf=_[_0xbb10('0x29')](_0x49baf4['channels'],{'uniqueid':_0x1c7fae[_0xbb10('0x30')]});if(_0x1d82bf){return Promise[_0xbb10('0x3d')]()[_0xbb10('0x1f')](function(){if(_0x1d82bf[_0xbb10('0x31')]){return ami[_0xbb10('0x1e')]({'action':_0xbb10('0x3e'),'channel':_0x1d82bf[_0xbb10('0x31')],'mixmonitorid':_0x1c7fae[_0xbb10('0x38')]})[_0xbb10('0x21')](function(){});}})[_0xbb10('0x1f')](function(){if(_0x1d82bf[_0xbb10('0x3f')]){return ami[_0xbb10('0x1e')]({'action':'StopMixMonitor','channel':_0x1d82bf[_0xbb10('0x3f')],'mixmonitorid':_0x1c7fae[_0xbb10('0x38')]})['catch'](function(){});}})[_0xbb10('0x1f')](function(){var _0x2f5027=_[_0xbb10('0x29')](_0x1d82bf[_0xbb10('0x40')],{'mixmonitorid':_0x1c7fae[_0xbb10('0x38')]});if(_0x2f5027){_0x2f5027[_0xbb10('0x3a')]=_0xbb10('0x41');}})['then'](function(){var _0x4a9793=util[_0xbb10('0x8')](_0xbb10('0x32'),_0x1c7fae[_0xbb10('0x33')]||_0x1c7fae['uniqueid'],_0x1c7fae['format']||_0xbb10('0x34'));var _0x34cf4e=_[_0xbb10('0x29')](_0x1d82bf[_0xbb10('0x40')],{'filename':_0xbb10('0x36')+_0x4a9793[_0xbb10('0x37')]()});if(_0x34cf4e){_0x34cf4e[_0xbb10('0x3a')]=_0xbb10('0x41');}})[_0xbb10('0x1f')](function(){_0x3d3c41({'code':0xc8,'message':[_0x1c7fae[_0xbb10('0x30')],'StopMixMonitor\x20Success']['join']('\x20')});})[_0xbb10('0x21')](function(_0x467dba){_0x4943d9(_0x3e7b4c[_0xbb10('0x14')](0x1f5,[_0x1c7fae[_0xbb10('0x30')],_0x467dba[_0xbb10('0x20')][_0xbb10('0x37')]()][_0xbb10('0x18')]('\x20')));});}else{return _0x4943d9(_0x3e7b4c[_0xbb10('0x14')](0x1f5,_0xbb10('0x3c')));}});},'VoiceQueuesChannels':function(_0x1214f7){var _0x19ca3e=this;return new Promise(function(_0x20e18a){var _0x61e689=_[_0xbb10('0x2c')](_0x49baf4[_0xbb10('0x42')]);var _0x547a7a={'count':_0x61e689[_0xbb10('0x28')],'rows':_0x61e689};if(_0x1214f7&&_0x1214f7['type']){if(![_0xbb10('0x43'),_0xbb10('0x44')][_0xbb10('0x45')](_0x1214f7[_0xbb10('0x46')])){return _0x3cdd53(_0x19ca3e[_0xbb10('0x14')](0x190,_0xbb10('0x47')));}var _0x2e3326=_[_0xbb10('0x48')](_0x61e689,function(_0x180400){return _0x180400[_0xbb10('0x46')]===_0x1214f7[_0xbb10('0x46')];});_0x547a7a[_0xbb10('0x49')]=_0x2e3326[_0xbb10('0x28')];_0x547a7a[_0xbb10('0x4a')]=_0x2e3326;}_0x20e18a(_0x547a7a);});},'VoiceQueuesChannel':function(_0x4475e1){var _0x5de0cc=this;return new Promise(function(_0x4571b6,_0x466eb7){var _0x1b83a9=schema(properties[_0xbb10('0x4b')])[_0xbb10('0x2')](_0x4475e1);if(_0x1b83a9[_0xbb10('0x28')]>0x0){return _0x466eb7(_0x5de0cc['error'](0x1f4,_[_0xbb10('0x2e')](_0x1b83a9,_0xbb10('0x20'))[_0xbb10('0x18')](',\x20')));}var _0x14fed3=_[_0xbb10('0x29')](_0x49baf4[_0xbb10('0x42')],{'uniqueid':_0x4475e1[_0xbb10('0x30')]});if(_0x14fed3){_0x4571b6(_0x14fed3);}else{return _0x466eb7(_0x5de0cc[_0xbb10('0x14')](0x1f5,_0xbb10('0x3c')));}});},'VoiceQueuesChannelHangup':function(_0x40c4fb){var _0x2eb05a=this;return new Promise(function(_0x2a1ce1,_0x16932f){if(ami['isConnected']()==![]){return _0x16932f(_0x2eb05a['error'](0x1f4,[config[_0xbb10('0x15')]['ip'],config[_0xbb10('0x15')][_0xbb10('0x16')],_0xbb10('0x17')]['join']('\x20')));}var _0x506498=schema(properties[_0xbb10('0x4c')])[_0xbb10('0x2')](_0x40c4fb);if(_0x506498[_0xbb10('0x28')]>0x0){return _0x16932f(_0x2eb05a[_0xbb10('0x14')](0x1f4,_[_0xbb10('0x2e')](_0x506498,_0xbb10('0x20'))[_0xbb10('0x18')](',\x20')));}var _0x4a5fb9=_[_0xbb10('0x29')](_0x49baf4[_0xbb10('0x42')],{'uniqueid':_0x40c4fb['uniqueid']});if(_0x4a5fb9&&_0x4a5fb9['channel']){return ami['Action']({'action':_0xbb10('0x4d'),'channel':_0x4a5fb9[_0xbb10('0x31')]})[_0xbb10('0x1f')](function(_0x5bd1c0){_0x2a1ce1({'code':0xc8,'message':[_0x40c4fb['uniqueid'],_0x5bd1c0['message'][_0xbb10('0x37')]()][_0xbb10('0x18')]('\x20')});})[_0xbb10('0x21')](function(_0x4e9fbd){_0x16932f(_0x2eb05a[_0xbb10('0x14')](0x1f5,[_0x40c4fb[_0xbb10('0x30')],_0x4e9fbd['message']['toLowerCase']()][_0xbb10('0x18')]('\x20')));});}else{return _0x16932f(_0x2eb05a[_0xbb10('0x14')](0x1f5,_0xbb10('0x3c')));}});},'VoiceQueuesChannelRedirect':function(_0x237246){var _0x54b7c5=this;return new Promise(function(_0x43eaec,_0xec48ac){if(ami[_0xbb10('0x13')]()==![]){return _0xec48ac(_0x54b7c5['error'](0x1f4,[config[_0xbb10('0x15')]['ip'],config[_0xbb10('0x15')][_0xbb10('0x16')],'ami\x20disconnected'][_0xbb10('0x18')]('\x20')));}var _0x31e85e=schema(properties[_0xbb10('0x4e')])[_0xbb10('0x2')](_0x237246);if(_0x31e85e['length']>0x0){return _0xec48ac(_0x54b7c5[_0xbb10('0x14')](0x1f4,_[_0xbb10('0x2e')](_0x31e85e,_0xbb10('0x20'))[_0xbb10('0x18')](',\x20')));}var _0x56b3a3=_[_0xbb10('0x29')](_0x49baf4[_0xbb10('0x42')],{'uniqueid':_0x237246[_0xbb10('0x30')]});if(_0x56b3a3&&_0x56b3a3[_0xbb10('0x31')]){return ami[_0xbb10('0x1e')]({'action':_0xbb10('0x4f'),'channel':_0x56b3a3[_0xbb10('0x31')],'exten':_0x237246['exten'],'context':_0x237246['context']||_0x56b3a3['context'],'priority':0x1})[_0xbb10('0x1f')](function(_0x9c672d){_0x43eaec({'code':0xc8,'message':[_0x237246[_0xbb10('0x30')],_0x9c672d['message']['toLowerCase']()][_0xbb10('0x18')]('\x20')});})[_0xbb10('0x21')](function(_0xd9e743){_0xec48ac(_0x54b7c5[_0xbb10('0x14')](0x1f5,[_0x237246[_0xbb10('0x30')],_0xd9e743[_0xbb10('0x20')]['toLowerCase']()][_0xbb10('0x18')]('\x20')));});}else{return _0xec48ac(_0x54b7c5[_0xbb10('0x14')](0x1f5,_0xbb10('0x3c')));}});},'Agents':function(_0x14f16b){return new Promise(function(_0x2aaaa6){var _0x5bfc68=_['values'](_0x49baf4['agents']);if(_0x14f16b&&_0x14f16b['id']){var _0x329da7=_[_0xbb10('0x29')](_0x5bfc68,function(_0x36917f){return _0x36917f['id']===_0x14f16b['id'];});_0x2aaaa6(_0x329da7);}else{_0x2aaaa6({'count':_0x5bfc68[_0xbb10('0x28')],'rows':_0x5bfc68});}});},'Telephones':function(){return new Promise(function(_0x2f7d2a){var _0x1d40b8=_['values'](_0x49baf4[_0xbb10('0x50')]);_0x2f7d2a({'count':_0x1d40b8['length'],'rows':_0x1d40b8});});},'Trunks':function(){return new Promise(function(_0x4fe3b5){var _0x519a54=_[_0xbb10('0x2c')](_0x49baf4[_0xbb10('0x51')]);_0x4fe3b5({'count':_0x519a54[_0xbb10('0x28')],'rows':_0x519a54});});},'OutboundChannels':function(){return new Promise(function(_0x108f99){var _0x5ce94f=_[_0xbb10('0x2c')](_0x49baf4['outboundChannels']);_0x108f99({'count':_0x5ce94f['length'],'rows':_0x5ce94f});});},'Outbound':function(){return new Promise(function(_0x165fe9){_0x165fe9(_0x49baf4[_0xbb10('0x44')]);});},'Campaigns':function(){return new Promise(function(_0x29529c){var _0x2bd2ab=_[_0xbb10('0x2c')](_0x49baf4['campaigns']);_0x29529c({'count':_0x2bd2ab[_0xbb10('0x28')],'rows':_0x2bd2ab});});},'VoiceQueuesPreview':function(_0x19fcec){var _0x2c6429=this;return new Promise(function(_0x3f3d38,_0x43cdb7){_0x312b72[_0xbb10('0x52')](_0x19fcec['id'])[_0xbb10('0x1f')](function(_0x53fa98){_0x3f3d38({'code':0xc8,'message':_0x53fa98[_0xbb10('0x20')]});})[_0xbb10('0x21')](function(_0x30f3ea){_0x43cdb7(_0x2c6429[_0xbb10('0x14')](0x1f4,_0x30f3ea[_0xbb10('0x20')]));});});},'EventManager':function(_0x172be3){var _0xa3b23=this;return new Promise(function(_0x312a08,_0x5a4429){if(!_0x172be3[_0xbb10('0x53')]){return _0x5a4429(_0xa3b23[_0xbb10('0x14')](0x1f4,_0xbb10('0x54')));}ami['emit']('custom:'+_0x172be3['event'],_0x172be3[_0xbb10('0x20')]);_0x312a08({'code':0xc8,'message':_0x172be3});});},'FaxAccounts':function(){return new Promise(function(_0x5a3c44){var _0x4e3d6a=_[_0xbb10('0x2c')](_0x49baf4[_0xbb10('0x55')]);_0x5a3c44({'count':_0x4e3d6a[_0xbb10('0x28')],'rows':_0x4e3d6a});});},'SendFax':function(_0x12ed63){var _0x32ec27=this;return new Promise(function(_0x24dca6,_0x33116){_0x481979[_0xbb10('0x56')](_0x12ed63)[_0xbb10('0x1f')](function(_0x5206e1){_0x24dca6({'code':0xc8,'message':_0x5206e1[_0xbb10('0x20')]});})[_0xbb10('0x21')](function(_0x46b6d2){_0x33116(_0x32ec27[_0xbb10('0x14')](0x1f4,_0x46b6d2['message']));});});},'CheckAfterSend':function(_0x4c0795){var _0x3547a3=this;return new Promise(function(_0x2280bd,_0x30f0a4){_0x481979[_0xbb10('0x57')](_0x4c0795)['then'](function(_0x17d596){_0x2280bd({'code':0xc8,'message':_0x17d596[_0xbb10('0x20')]});})[_0xbb10('0x21')](function(_0xf7b3e1){_0x30f0a4(_0x3547a3[_0xbb10('0x14')](0x1f4,_0xf7b3e1['message']));});});}};var _0x5f0691=jayson[_0xbb10('0x58')](_0x513741)[_0xbb10('0x59')]();_0x5f0691['on'](_0xbb10('0x14'),function(_0x5239da){return _0x3cdd53(_0x5239da);});_0x5f0691[_0xbb10('0x7')](0x232a,_0xbb10('0x5a'),function(){console['log']('AMI\x20RPC\x20server\x20listening\x20on\x20127.0.0.1:%d!',0x232a);return _0x328583(_0xbb10('0x5b')+0x232a);});});}; \ No newline at end of file diff --git a/server/services/ami/trigger/cmContact/index.js b/server/services/ami/trigger/cmContact/index.js index 7a8bf2a..a8b03b1 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 _0xd9b9=['[CM][%s][%s]\x20Autocreate\x20disabled','format','user:%s','trigger:%s','action','merge','bluebird','ioredis','util','../../../../config/environment','../../../../config/logger','../../rpc/cmContact','redis','socket.io-emitter','info','[CM][%s][%s]','stringify','emit','exec','data2','isNil','data5','xmd-contactid','ListId','data3','split','phone','$or','map','routeId','destcalleridnum','calleridnum','firstName','lastName','mobile','fax','createdAt','scheduledAt','updatedAt','union','resolve','then','getContacts','isEmpty','[CM][%s][%s]\x20Contact\x20found:%s','uniqueid','[CM][%s][%s]\x20Multiple\x20contacts\x20found:[%s]','[CM][%s][%s]\x20Contact\x20not\x20found','data4','[CM][%s][%s]\x20Autocreate\x20enabled','calleridname','Unknown','destcalleridname','','createContact','push','[CM][%s][%s]\x20Contact\x20created:%s'];(function(_0x2b2c53,_0x4bcf9b){var _0x311ec2=function(_0x4a8e72){while(--_0x4a8e72){_0x2b2c53['push'](_0x2b2c53['shift']());}};_0x311ec2(++_0x4bcf9b);}(_0xd9b9,0xea));var _0x9d9b=function(_0x1e70c8,_0x449866){_0x1e70c8=_0x1e70c8-0x0;var _0x78e667=_0xd9b9[_0x1e70c8];return _0x78e667;};'use strict';var _=require('lodash');var BPromise=require(_0x9d9b('0x0'));var Redis=require(_0x9d9b('0x1'));var util=require(_0x9d9b('0x2'));var config=require(_0x9d9b('0x3'));var logger=require(_0x9d9b('0x4'))('trigger');var cmContactRpc=require(_0x9d9b('0x5'));config[_0x9d9b('0x6')]=_['defaults'](config['redis'],{'host':'localhost','port':0x18eb});var io=require(_0x9d9b('0x7'))(new Redis(config['redis']));function emit(_0x576dc8,_0x166b77,_0x1fd3d7,_0x4bf3e9,_0x57ec63){logger[_0x9d9b('0x8')](_0x9d9b('0x9'),_0x576dc8,_0x166b77['id'],_0x1fd3d7,_0x4bf3e9,JSON[_0x9d9b('0xa')](_0x57ec63));io['to'](_0x1fd3d7)[_0x9d9b('0xb')](_0x4bf3e9,_0x57ec63);}exports[_0x9d9b('0xc')]=function(_0x1efcc5,_0x3cca68,_0x20aa4b,_0x545e62){var _0x169545,_0x3ed013;var _0x380430={};var _0x3949e5;var _0x39e272=Number(_0x20aa4b['data1']);var _0x1acb8c=_0x20aa4b['data2']?Boolean(Number(_0x20aa4b[_0x9d9b('0xd')])):![];var _0x3fc5e9;var _0xe956c7=![];if(!_[_0x9d9b('0xe')](_0x20aa4b['data5'])){if(_0x20aa4b[_0x9d9b('0xf')]=='1')_0xe956c7=!![];}if(!_0xe956c7){if(_0x545e62['xmd-contactid']){_0x380430['id']=_0x545e62[_0x9d9b('0x10')];}}if(!_0x380430['id']){_0x380430[_0x9d9b('0x11')]=_0x39e272;_0x3fc5e9=_0x20aa4b['data3']&&_0x20aa4b[_0x9d9b('0x12')]!=='0'?_0x20aa4b[_0x9d9b('0x12')][_0x9d9b('0x13')](','):[_0x9d9b('0x14')];_0x380430[_0x9d9b('0x15')]=_[_0x9d9b('0x16')](_0x3fc5e9,function(_0x5b24a5){var _0x1b1ee6={};_0x1b1ee6[_0x5b24a5]=_0x545e62[_0x9d9b('0x17')]?_0x545e62[_0x9d9b('0x18')]:_0x545e62[_0x9d9b('0x19')];return _0x1b1ee6;});_0x3949e5=_0x545e62[_0x9d9b('0x17')]?_0x545e62[_0x9d9b('0x18')]:_0x545e62['calleridnum'];}var _0x1ac9b6=['id',_0x9d9b('0x1a'),_0x9d9b('0x1b'),_0x9d9b('0x14'),_0x9d9b('0x1c'),_0x9d9b('0x1d'),_0x9d9b('0x11'),_0x9d9b('0x1e'),_0x9d9b('0x1f'),_0x9d9b('0x20')];var _0x17b5cd=_[_0x9d9b('0x21')](_0x1ac9b6,_0x3fc5e9);BPromise[_0x9d9b('0x22')]()[_0x9d9b('0x23')](cmContactRpc[_0x9d9b('0x24')]({'attributes':_0x17b5cd,'where':_0x380430,'phone':_0x3949e5}))['then'](function(_0x387d64){_0x3ed013=_0x387d64;if(!_[_0x9d9b('0x25')](_0x3ed013)){if(_0x3ed013['length']===0x1){_0x169545=_0x3ed013[0x0];logger[_0x9d9b('0x8')](_0x9d9b('0x26'),_0x545e62[_0x9d9b('0x27')],_0x3cca68['id'],_0x169545['id']);}else{logger[_0x9d9b('0x8')](_0x9d9b('0x28'),_0x545e62[_0x9d9b('0x27')],_0x3cca68['id'],_[_0x9d9b('0x16')](_0x3ed013,'id')['join'](','));}return;}else{logger[_0x9d9b('0x8')](_0x9d9b('0x29'),_0x545e62[_0x9d9b('0x27')],_0x3cca68['id']);var _0x41b95c={'ListId':_0x39e272};var _0x55f4af=_0x20aa4b[_0x9d9b('0x2a')]&&_0x20aa4b['data4']!=='0'?_0x20aa4b[_0x9d9b('0x2a')]:_0x9d9b('0x14');if(_0x1acb8c){logger['info'](_0x9d9b('0x2b'),_0x545e62[_0x9d9b('0x27')],_0x3cca68['id']);_0x41b95c[_0x55f4af]=_[_0x9d9b('0xe')](_0x545e62['routeId'])?_0x545e62[_0x9d9b('0x19')]:_0x545e62['destcalleridnum'];if(_[_0x9d9b('0xe')](_0x545e62['routeId'])){_0x41b95c[_0x9d9b('0x1a')]=_0x545e62[_0x9d9b('0x2c')]&&_0x545e62[_0x9d9b('0x2c')]!==''?_0x545e62[_0x9d9b('0x2c')]:_0x9d9b('0x2d');}else{_0x41b95c['firstName']=_0x545e62[_0x9d9b('0x2e')]&&_0x545e62['destcalleridname']!==_0x9d9b('0x2f')?_0x545e62[_0x9d9b('0x2e')]:'Unknown';}return BPromise['resolve']()['then'](cmContactRpc[_0x9d9b('0x30')](_0x41b95c))[_0x9d9b('0x23')](function(_0x147dbb){_0x169545=_0x147dbb;_0x3ed013[_0x9d9b('0x31')](_0x147dbb);if(_0x169545){logger[_0x9d9b('0x8')](_0x9d9b('0x32'),_0x545e62[_0x9d9b('0x27')],_0x3cca68['id'],_0x169545['id']);}return;});}else{logger[_0x9d9b('0x8')](_0x9d9b('0x33'),_0x545e62[_0x9d9b('0x27')],_0x3cca68['id']);_0x41b95c[_0x55f4af]=_[_0x9d9b('0xe')](_0x545e62[_0x9d9b('0x17')])?_0x545e62[_0x9d9b('0x19')]:_0x545e62[_0x9d9b('0x18')];if(_[_0x9d9b('0xe')](_0x545e62['routeId'])){_0x41b95c[_0x9d9b('0x1a')]=_0x545e62['calleridname']&&_0x545e62[_0x9d9b('0x2c')]!==_0x9d9b('0x2f')?_0x545e62[_0x9d9b('0x2c')]:'Unknown';}else{_0x41b95c[_0x9d9b('0x1a')]=_0x545e62[_0x9d9b('0x2e')]&&_0x545e62[_0x9d9b('0x2e')]!==_0x9d9b('0x2f')?_0x545e62[_0x9d9b('0x2e')]:_0x9d9b('0x2d');}_0x169545=_0x41b95c;_0x3ed013[_0x9d9b('0x31')](_0x41b95c);return;}}})['then'](function(){if(_0x1efcc5){emit(_0x545e62[_0x9d9b('0x27')],_0x3cca68,util[_0x9d9b('0x34')](_0x9d9b('0x35'),_0x1efcc5['name']),util[_0x9d9b('0x34')](_0x9d9b('0x36'),_0x20aa4b[_0x9d9b('0x37')]['toLowerCase']()),{'evt':_[_0x9d9b('0x38')](_0x545e62,{'autoCreate':_0x1acb8c}),'contact':_0x169545===undefined?{}:_0x169545,'contacts':_0x3ed013['length']===0x0?undefined:_0x3ed013});}});}; \ No newline at end of file +var _0x6888=['join','[CM][%s][%s]\x20Contact\x20not\x20found','data4','phone','destcalleridnum','calleridname','','Unknown','destcalleridname','resolve','createContact','push','[CM][%s][%s]\x20Contact\x20created:%s','[CM][%s][%s]\x20Autocreate\x20disabled','user:%s','name','format','trigger:%s','action','toLowerCase','merge','lodash','bluebird','ioredis','util','../../../../config/environment','../../../../config/logger','trigger','../../rpc/cmContact','defaults','socket.io-emitter','redis','info','[CM][%s][%s]','stringify','emit','exec','data1','data2','isNil','data5','xmd-contactid','ListId','data3','$or','map','routeId','calleridnum','firstName','lastName','fax','createdAt','scheduledAt','updatedAt','union','then','getContacts','length','[CM][%s][%s]\x20Contact\x20found:%s','[CM][%s][%s]\x20Multiple\x20contacts\x20found:[%s]','uniqueid'];(function(_0x2e367b,_0x4ba37d){var _0x10e75f=function(_0x49935b){while(--_0x49935b){_0x2e367b['push'](_0x2e367b['shift']());}};_0x10e75f(++_0x4ba37d);}(_0x6888,0x146));var _0x8688=function(_0x42cae2,_0x284ef8){_0x42cae2=_0x42cae2-0x0;var _0x5f256f=_0x6888[_0x42cae2];return _0x5f256f;};'use strict';var _=require(_0x8688('0x0'));var BPromise=require(_0x8688('0x1'));var Redis=require(_0x8688('0x2'));var util=require(_0x8688('0x3'));var config=require(_0x8688('0x4'));var logger=require(_0x8688('0x5'))(_0x8688('0x6'));var cmContactRpc=require(_0x8688('0x7'));config['redis']=_[_0x8688('0x8')](config['redis'],{'host':'localhost','port':0x18eb});var io=require(_0x8688('0x9'))(new Redis(config[_0x8688('0xa')]));function emit(_0x415239,_0x24e265,_0xdc4bdb,_0x2d3500,_0x58351e){logger[_0x8688('0xb')](_0x8688('0xc'),_0x415239,_0x24e265['id'],_0xdc4bdb,_0x2d3500,JSON[_0x8688('0xd')](_0x58351e));io['to'](_0xdc4bdb)[_0x8688('0xe')](_0x2d3500,_0x58351e);}exports[_0x8688('0xf')]=function(_0x15be8b,_0x3c99b1,_0x52d9e1,_0x26c1ce){var _0x1cb397,_0x18a39b;var _0x4feddc={};var _0x196e65;var _0x42d8fa=Number(_0x52d9e1[_0x8688('0x10')]);var _0x41638b=_0x52d9e1['data2']?Boolean(Number(_0x52d9e1[_0x8688('0x11')])):![];var _0x336b7a;var _0x2200d8=![];if(!_[_0x8688('0x12')](_0x52d9e1[_0x8688('0x13')])){if(_0x52d9e1[_0x8688('0x13')]=='1')_0x2200d8=!![];}if(!_0x2200d8){if(_0x26c1ce[_0x8688('0x14')]){_0x4feddc['id']=_0x26c1ce[_0x8688('0x14')];}}if(!_0x4feddc['id']){_0x4feddc[_0x8688('0x15')]=_0x42d8fa;_0x336b7a=_0x52d9e1[_0x8688('0x16')]&&_0x52d9e1[_0x8688('0x16')]!=='0'?_0x52d9e1['data3']['split'](','):['phone'];_0x4feddc[_0x8688('0x17')]=_[_0x8688('0x18')](_0x336b7a,function(_0x3fcd9f){var _0x3ad5fd={};_0x3ad5fd[_0x3fcd9f]=_0x26c1ce[_0x8688('0x19')]?_0x26c1ce['destcalleridnum']:_0x26c1ce[_0x8688('0x1a')];return _0x3ad5fd;});_0x196e65=_0x26c1ce[_0x8688('0x19')]?_0x26c1ce['destcalleridnum']:_0x26c1ce['calleridnum'];}var _0x4e82af=['id',_0x8688('0x1b'),_0x8688('0x1c'),'phone','mobile',_0x8688('0x1d'),_0x8688('0x15'),_0x8688('0x1e'),_0x8688('0x1f'),_0x8688('0x20')];var _0x37882c=_[_0x8688('0x21')](_0x4e82af,_0x336b7a);BPromise['resolve']()[_0x8688('0x22')](cmContactRpc[_0x8688('0x23')]({'attributes':_0x37882c,'where':_0x4feddc,'phone':_0x196e65}))[_0x8688('0x22')](function(_0x4bdea4){_0x18a39b=_0x4bdea4;if(!_['isEmpty'](_0x18a39b)){if(_0x18a39b[_0x8688('0x24')]===0x1){_0x1cb397=_0x18a39b[0x0];logger['info'](_0x8688('0x25'),_0x26c1ce['uniqueid'],_0x3c99b1['id'],_0x1cb397['id']);}else{logger['info'](_0x8688('0x26'),_0x26c1ce[_0x8688('0x27')],_0x3c99b1['id'],_[_0x8688('0x18')](_0x18a39b,'id')[_0x8688('0x28')](','));}return;}else{logger[_0x8688('0xb')](_0x8688('0x29'),_0x26c1ce[_0x8688('0x27')],_0x3c99b1['id']);var _0x4b1d3b={'ListId':_0x42d8fa};var _0xf16104=_0x52d9e1[_0x8688('0x2a')]&&_0x52d9e1[_0x8688('0x2a')]!=='0'?_0x52d9e1['data4']:_0x8688('0x2b');if(_0x41638b){logger[_0x8688('0xb')]('[CM][%s][%s]\x20Autocreate\x20enabled',_0x26c1ce[_0x8688('0x27')],_0x3c99b1['id']);_0x4b1d3b[_0xf16104]=_['isNil'](_0x26c1ce[_0x8688('0x19')])?_0x26c1ce[_0x8688('0x1a')]:_0x26c1ce[_0x8688('0x2c')];if(_[_0x8688('0x12')](_0x26c1ce[_0x8688('0x19')])){_0x4b1d3b['firstName']=_0x26c1ce[_0x8688('0x2d')]&&_0x26c1ce[_0x8688('0x2d')]!==_0x8688('0x2e')?_0x26c1ce[_0x8688('0x2d')]:_0x8688('0x2f');}else{_0x4b1d3b[_0x8688('0x1b')]=_0x26c1ce[_0x8688('0x30')]&&_0x26c1ce[_0x8688('0x30')]!==_0x8688('0x2e')?_0x26c1ce['destcalleridname']:_0x8688('0x2f');}return BPromise[_0x8688('0x31')]()['then'](cmContactRpc[_0x8688('0x32')](_0x4b1d3b))[_0x8688('0x22')](function(_0x7e24fa){_0x1cb397=_0x7e24fa;_0x18a39b[_0x8688('0x33')](_0x7e24fa);if(_0x1cb397){logger[_0x8688('0xb')](_0x8688('0x34'),_0x26c1ce[_0x8688('0x27')],_0x3c99b1['id'],_0x1cb397['id']);}return;});}else{logger['info'](_0x8688('0x35'),_0x26c1ce[_0x8688('0x27')],_0x3c99b1['id']);_0x4b1d3b[_0xf16104]=_[_0x8688('0x12')](_0x26c1ce[_0x8688('0x19')])?_0x26c1ce[_0x8688('0x1a')]:_0x26c1ce['destcalleridnum'];if(_[_0x8688('0x12')](_0x26c1ce[_0x8688('0x19')])){_0x4b1d3b[_0x8688('0x1b')]=_0x26c1ce[_0x8688('0x2d')]&&_0x26c1ce['calleridname']!==_0x8688('0x2e')?_0x26c1ce[_0x8688('0x2d')]:_0x8688('0x2f');}else{_0x4b1d3b[_0x8688('0x1b')]=_0x26c1ce['destcalleridname']&&_0x26c1ce[_0x8688('0x30')]!==_0x8688('0x2e')?_0x26c1ce['destcalleridname']:_0x8688('0x2f');}_0x1cb397=_0x4b1d3b;_0x18a39b['push'](_0x4b1d3b);return;}}})['then'](function(){if(_0x15be8b){emit(_0x26c1ce['uniqueid'],_0x3c99b1,util['format'](_0x8688('0x36'),_0x15be8b[_0x8688('0x37')]),util[_0x8688('0x38')](_0x8688('0x39'),_0x52d9e1[_0x8688('0x3a')][_0x8688('0x3b')]()),{'evt':_[_0x8688('0x3c')](_0x26c1ce,{'autoCreate':_0x41638b}),'contact':_0x1cb397===undefined?{}:_0x1cb397,'contacts':_0x18a39b[_0x8688('0x24')]===0x0?undefined:_0x18a39b});}});}; \ No newline at end of file diff --git a/server/services/ami/trigger/index.js b/server/services/ami/trigger/index.js index e53925c..bb8dc58 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 _0x0cfe=['html','template\x20not\x20found','data3','isNil','data4','location','uriLocation','windowWidth','800','data5','windowHeight','data6','600','winApplication','winArguments','render','format','user:%s','name','trigger:%s:%s','jscripty','data1','trigger:%s','integration','exec','queue','buildUri','parse','search','replace','checkTrigger','channel','AllConditions','every','checkConditions','some','AnyConditions','field','account','chat','operator','ChatWebsiteId','upperFirst','AccountId','value','interaction','message','event','membername','lastevent','routeId','null','substatus','offlineMessage','created','equals','lodash','url','mustache','./urlforward','./integration','./cmContact','./script','../../../config/environment','trigger','redis','defaults','localhost','socket.io-emitter','popup','winapp','triggers','agents','voiceQueues','templates','voiceExtensions','zendeskAccounts','freshdeskAccounts','salesforceAccounts','sugarcrmAccounts','zohoAccounts','deskAccounts','vtigerAccounts','servicenowAccounts','dynamics365Accounts','accounts','freshsalesAccounts','custom:agentcalled','syncCustomEvent','bind','custom:agentconnect','custom:agentringnoanswer','custom:agentcomplete','custom:agentnoanswer','custom:agentbusy','custom:agentcongestion','custom:agentreject','custom:amd','custom:timeout','custom:dialbegin','syncAgentDial','custom:dialconnect','custom:dialend','custom:newinteraction','custom:closedinteraction','custom:substatus','custom:outgoingmessage','custom:acceptmessage','custom:rejectmessage','custom:offlineMessage','prototype','emit','stringify','undefined','motionChannel','voice','debug','inspect','checkTriggers','interface','hasOwnProperty','merge','variables','Actions','action','toLowerCase','contactmanager','motionbar','browser','TemplateId','data2'];(function(_0x5c3c0b,_0x4ee35e){var _0x52ecd2=function(_0x3cf575){while(--_0x3cf575){_0x5c3c0b['push'](_0x5c3c0b['shift']());}};_0x52ecd2(++_0x4ee35e);}(_0x0cfe,0x1c1));var _0xe0cf=function(_0x388ed5,_0x550a99){_0x388ed5=_0x388ed5-0x0;var _0x56d6ec=_0x0cfe[_0x388ed5];return _0x56d6ec;};'use strict';var util=require('util');var _=require(_0xe0cf('0x0'));var url=require(_0xe0cf('0x1'));var Mustache=require(_0xe0cf('0x2'));var Redis=require('ioredis');var urlforward=require(_0xe0cf('0x3'));var integration=require(_0xe0cf('0x4'));var cmContact=require(_0xe0cf('0x5'));var script=require(_0xe0cf('0x6'));var config=require(_0xe0cf('0x7'));var logger=require('../../../config/logger')(_0xe0cf('0x8'));var ami=require('../ami');config[_0xe0cf('0x9')]=_[_0xe0cf('0xa')](config[_0xe0cf('0x9')],{'host':_0xe0cf('0xb'),'port':0x18eb});var io=require(_0xe0cf('0xc'))(new Redis(config[_0xe0cf('0x9')]));var operators={'equals':function(_0xb97c22,_0x576bc8){return _0xb97c22==_0x576bc8;},'not_equals':function(_0x18b1da,_0xac1768){return _0x18b1da!=_0xac1768;}};var barAndWebActions=[_0xe0cf('0xd'),'url',_0xe0cf('0xe')];function Trigger(_0x1ee146){this[_0xe0cf('0xf')]=_0x1ee146[_0xe0cf('0xf')];this['agents']=_0x1ee146[_0xe0cf('0x10')];this['voiceQueues']=_0x1ee146[_0xe0cf('0x11')];this[_0xe0cf('0x12')]=_0x1ee146[_0xe0cf('0x12')];this[_0xe0cf('0x13')]=_0x1ee146[_0xe0cf('0x13')];this[_0xe0cf('0x14')]=_0x1ee146[_0xe0cf('0x14')];this[_0xe0cf('0x15')]=_0x1ee146[_0xe0cf('0x15')];this['salesforceAccounts']=_0x1ee146[_0xe0cf('0x16')];this[_0xe0cf('0x17')]=_0x1ee146['sugarcrmAccounts'];this['zohoAccounts']=_0x1ee146[_0xe0cf('0x18')];this[_0xe0cf('0x19')]=_0x1ee146[_0xe0cf('0x19')];this[_0xe0cf('0x1a')]=_0x1ee146[_0xe0cf('0x1a')];this[_0xe0cf('0x1b')]=_0x1ee146['servicenowAccounts'];this[_0xe0cf('0x1c')]=_0x1ee146[_0xe0cf('0x1c')];this['freshsalesAccounts']=_0x1ee146['freshsalesAccounts'];this[_0xe0cf('0x1d')]={'zendesk':this['zendeskAccounts'],'salesforce':this[_0xe0cf('0x16')],'freshdesk':this[_0xe0cf('0x15')],'sugarcrm':this[_0xe0cf('0x17')],'zoho':this[_0xe0cf('0x18')],'desk':this[_0xe0cf('0x19')],'vtiger':this[_0xe0cf('0x1a')],'dynamics365':this[_0xe0cf('0x1c')],'freshsales':this[_0xe0cf('0x1e')],'servicenow':this['servicenowAccounts']};ami['on'](_0xe0cf('0x1f'),this[_0xe0cf('0x20')][_0xe0cf('0x21')](this));ami['on'](_0xe0cf('0x22'),this[_0xe0cf('0x20')][_0xe0cf('0x21')](this));ami['on'](_0xe0cf('0x23'),this[_0xe0cf('0x20')][_0xe0cf('0x21')](this));ami['on'](_0xe0cf('0x24'),this['syncCustomEvent']['bind'](this));ami['on']('custom:agentnosuchnumber',this['syncCustomEvent'][_0xe0cf('0x21')](this));ami['on'](_0xe0cf('0x25'),this['syncCustomEvent'][_0xe0cf('0x21')](this));ami['on'](_0xe0cf('0x26'),this[_0xe0cf('0x20')][_0xe0cf('0x21')](this));ami['on'](_0xe0cf('0x27'),this[_0xe0cf('0x20')]['bind'](this));ami['on'](_0xe0cf('0x28'),this['syncCustomEvent'][_0xe0cf('0x21')](this));ami['on'](_0xe0cf('0x29'),this['syncCustomEvent'][_0xe0cf('0x21')](this));ami['on']('custom:queuecallerabandon',this[_0xe0cf('0x20')][_0xe0cf('0x21')](this));ami['on'](_0xe0cf('0x2a'),this[_0xe0cf('0x20')]['bind'](this));ami['on'](_0xe0cf('0x2b'),this[_0xe0cf('0x2c')][_0xe0cf('0x21')](this));ami['on'](_0xe0cf('0x2d'),this[_0xe0cf('0x2c')][_0xe0cf('0x21')](this));ami['on'](_0xe0cf('0x2e'),this[_0xe0cf('0x2c')][_0xe0cf('0x21')](this));ami['on'](_0xe0cf('0x2f'),this[_0xe0cf('0x20')][_0xe0cf('0x21')](this));ami['on'](_0xe0cf('0x30'),this['syncCustomEvent']['bind'](this));ami['on'](_0xe0cf('0x31'),this['syncCustomEvent']['bind'](this));ami['on']('custom:incomingmessage',this[_0xe0cf('0x20')][_0xe0cf('0x21')](this));ami['on'](_0xe0cf('0x32'),this[_0xe0cf('0x20')]['bind'](this));ami['on'](_0xe0cf('0x33'),this[_0xe0cf('0x20')][_0xe0cf('0x21')](this));ami['on'](_0xe0cf('0x34'),this[_0xe0cf('0x20')][_0xe0cf('0x21')](this));ami['on'](_0xe0cf('0x35'),this[_0xe0cf('0x20')][_0xe0cf('0x21')](this));}Trigger[_0xe0cf('0x36')][_0xe0cf('0x37')]=function(_0x21f3a2,_0x4ff3e9,_0x5d1a9e){logger['info'](_0x21f3a2,_0x4ff3e9,JSON[_0xe0cf('0x38')](_0x5d1a9e));io['to'](_0x21f3a2)[_0xe0cf('0x37')](_0x4ff3e9,_0x5d1a9e);};Trigger[_0xe0cf('0x36')][_0xe0cf('0x20')]=function(_0x429201){var _0x46fa02=_['clone'](_0x429201);if(typeof _0x46fa02['motionChannel']===_0xe0cf('0x39')){_0x46fa02[_0xe0cf('0x3a')]=_0xe0cf('0x3b');}logger[_0xe0cf('0x3c')](_0xe0cf('0x20'),util[_0xe0cf('0x3d')](_0x46fa02,{'showHidden':!![],'depth':null}));this[_0xe0cf('0x3e')](_0x46fa02);};Trigger[_0xe0cf('0x36')][_0xe0cf('0x2c')]=function(_0x230f57){if(this[_0xe0cf('0x10')][_0x230f57[_0xe0cf('0x3f')]]){this['syncCustomEvent'](_0x230f57);}};Trigger['prototype'][_0xe0cf('0x3e')]=function(_0x10ecf9){var _0x5cf845;for(var _0x1227c1 in this[_0xe0cf('0xf')]){if(this['triggers'][_0xe0cf('0x40')](_0x1227c1)){if(this[_0xe0cf('0xf')][_0x1227c1]['status']){_0x5cf845=this['checkTrigger'](this[_0xe0cf('0xf')][_0x1227c1],_0x10ecf9);if(_0x5cf845){_[_0xe0cf('0x41')](_0x10ecf9,_0x10ecf9[_0xe0cf('0x42')]);for(var _0x4c8c4c=0x0,_0x21ca22,_0x228a82,_0x468974;_0x4c8c4c0x0){_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 _0x55ca=['debug','[HTTP]','stringify','GET','authType','basic','%s:%s','username','token','%s/token:%s','toString','base64','Searching\x20enduser\x20with\x20phone','Enduser\x20found!','_embedded','entries','Enduser\x20not\x20found,\x20creating\x20a\x20new\x20enduser!','%s/customers','POST','length','forEach','includes','picklist','type','nameField','customField','toLowerCase','content','string','idField','custom_fields','variable','variableName','customVariable','Variable','name','priority','merge','xCALLY','Motion','CTI','concat','Tags','getString','Descriptions','/api/v2/users/%d','user','Fields','stripTrailingSlash','serverUrl','[QUEUE]','recordingURL','%s/api/voice/recordings/%s/downloads?type=uniqueid&token=%s','uniqueid','Authorization','email','calleridname','calleridnum','Ticket\x20created!','The\x20Ticket\x20ID\x20is:','integrationTab','user:%s','trigger:desk:display','newTab','Displaying\x20ticket\x20to\x20agent\x20in\x20a\x20new\x20tab...','trigger:browser:url','error','Desk\x20account\x20type\x20not\x20recognized','outbound','recordingFormat','none','[OUTBOUND]','The\x20User\x20ID\x20is:','destcalleridname','destcalleridnum','The\x20Enduser\x20ID\x20is:','Displaying\x20ticket\x20to\x20agent...','%s/agent/tickets/%s','catch','unmanaged','monitor_format','lastevent','toUpperCase','Recording\x20is\x20enabled!','lodash','request-promise','./util','../../../../config/environment','desk','redis','defaults','localhost','socket.io-emitter','application/json','validateEmail','info','Getting\x20agent\x20with\x20email','format','%s/users','remoteUri','then','total_entries','find','Agent\x20not\x20found,\x20using\x20the\x20admin\x20account!','%s/users/me'];(function(_0x14a39f,_0x5da03f){var _0x5c6002=function(_0x1f581d){while(--_0x1f581d){_0x14a39f['push'](_0x14a39f['shift']());}};_0x5c6002(++_0x5da03f);}(_0x55ca,0x126));var _0xa55c=function(_0x4a0f60,_0x298c30){_0x4a0f60=_0x4a0f60-0x0;var _0x59b579=_0x55ca[_0x4a0f60];return _0x59b579;};'use strict';var _=require(_0xa55c('0x0'));var rp=require(_0xa55c('0x1'));var md5=require('md5');var util=require('util');var Redis=require('ioredis');var intUtil=require(_0xa55c('0x2'));var config=require(_0xa55c('0x3'));var logger=require('../../../../config/logger')(_0xa55c('0x4'));config[_0xa55c('0x5')]=_[_0xa55c('0x6')](config[_0xa55c('0x5')],{'host':_0xa55c('0x7'),'port':0x18eb});var io=require(_0xa55c('0x8'))(new Redis(config[_0xa55c('0x5')]));function emit(_0x4d0624,_0x2121fd,_0x2537f0){io['to'](_0x4d0624)['emit'](_0x2121fd,_0x2537f0);}var headers={'Content-Type':_0xa55c('0x9'),'Accept':_0xa55c('0x9')};function getUser(_0x52a3bc,_0x5849ad){if(intUtil[_0xa55c('0xa')](_0x5849ad)===!![]){logger[_0xa55c('0xb')](_0xa55c('0xc'),_0x5849ad);return request({'uri':util[_0xa55c('0xd')](_0xa55c('0xe'),_0x52a3bc[_0xa55c('0xf')])})[_0xa55c('0x10')](function(_0x70c2de){if(_0x70c2de[_0xa55c('0x11')]){return _[_0xa55c('0x12')](_0x70c2de['_embedded']['entries'],{'email':_0x5849ad});}})[_0xa55c('0x10')](function(_0x576044){if(_0x576044){logger['info']('Agent\x20found!');return _0x576044;}else{logger[_0xa55c('0xb')](_0xa55c('0x13'));return request({'uri':util[_0xa55c('0xd')](_0xa55c('0x14'),_0x52a3bc[_0xa55c('0xf')])});}});}else{logger[_0xa55c('0xb')]('Invalid\x20email\x20format,\x20using\x20the\x20admin\x20account!');return request({'uri':util[_0xa55c('0xd')](_0xa55c('0x14'),_0x52a3bc[_0xa55c('0xf')])});}}function request(_0x31e10d){logger[_0xa55c('0x15')](_0xa55c('0x16'),JSON[_0xa55c('0x17')](_0x31e10d));return rp(_[_0xa55c('0x6')](_0x31e10d,{'method':_0xa55c('0x18'),'headers':headers,'json':!![]}));}function getAuth(_0x4cee3c){var _0x3d4c9e;if(_0x4cee3c[_0xa55c('0x19')]===_0xa55c('0x1a')){_0x3d4c9e=util[_0xa55c('0xd')](_0xa55c('0x1b'),_0x4cee3c[_0xa55c('0x1c')],_0x4cee3c['password']);}else if(_0x4cee3c['authType']===_0xa55c('0x1d')){_0x3d4c9e=util[_0xa55c('0xd')](_0xa55c('0x1e'),_0x4cee3c['username'],_0x4cee3c[_0xa55c('0x1d')]);}return util[_0xa55c('0xd')]('Basic\x20%s',new Buffer(_0x3d4c9e)[_0xa55c('0x1f')](_0xa55c('0x20')));}function getEndUser(_0x940f28,_0x1965f1,_0x234372){logger['info'](_0xa55c('0x21'),_0x234372);return request({'uri':util['format']('%s/customers/search',_0x940f28['remoteUri']),'qs':{'phone':_0x234372}})[_0xa55c('0x10')](function(_0x54b038){if(_0x54b038[_0xa55c('0x11')]){logger[_0xa55c('0xb')](_0xa55c('0x22'));return _0x54b038[_0xa55c('0x23')][_0xa55c('0x24')][0x0];}else{logger[_0xa55c('0xb')](_0xa55c('0x25'));return request({'uri':util[_0xa55c('0xd')](_0xa55c('0x26'),_0x940f28[_0xa55c('0xf')]),'method':_0xa55c('0x27'),'body':{'first_name':_0x1965f1,'title':_0x1965f1,'phone_numbers':[{'type':'work','value':_0x234372}]}});}});}function getTags(_0x430d55,_0x28814f){var _0x1c9f6b=[];if(_0x430d55&&_0x430d55[_0xa55c('0x28')]>0x0){_0x1c9f6b=_['map'](_0x430d55,_0x28814f);}return _0x1c9f6b;}function getCustomFields(_0x1377b0,_0x22f6b6){var _0x1b8388=[];var _0x201941={'custom_fields':{}};if(_0x1377b0[_0xa55c('0x28')]>0x0){_[_0xa55c('0x29')](_0x1377b0,function(_0x52d37f){if(_[_0xa55c('0x2a')](['string',_0xa55c('0x2b')],_0x52d37f[_0xa55c('0x2c')])&&_0x52d37f[_0xa55c('0x2d')]&&!_0x52d37f[_0xa55c('0x2e')]){_0x201941[_0x52d37f['nameField'][_0xa55c('0x2f')]()]=_0x52d37f[_0xa55c('0x30')][_0xa55c('0x1f')]();}else if(_[_0xa55c('0x2a')]([_0xa55c('0x31'),_0xa55c('0x2b')],_0x52d37f[_0xa55c('0x2c')])&&_0x52d37f[_0xa55c('0x32')]&&_0x52d37f[_0xa55c('0x2e')]){_0x201941[_0xa55c('0x33')][_0x52d37f[_0xa55c('0x32')]]=_0x52d37f['content']['toString']();}else if(_0x52d37f[_0xa55c('0x2c')]===_0xa55c('0x34')&&_0x52d37f['variableName']&&_0x52d37f[_0xa55c('0x32')]&&_0x52d37f[_0xa55c('0x2e')]){_0x22f6b6[_0x52d37f[_0xa55c('0x35')]]&&(_0x201941[_0xa55c('0x33')][_0x52d37f[_0xa55c('0x32')]]=_0x22f6b6[_0x52d37f[_0xa55c('0x35')]][_0xa55c('0x1f')]());}else if(_0x52d37f[_0xa55c('0x2c')]===_0xa55c('0x36')&&_0x52d37f['Variable']&&_0x52d37f['Variable']['name']&&_0x52d37f[_0xa55c('0x32')]&&_0x52d37f[_0xa55c('0x2e')]){_0x22f6b6[_0x52d37f[_0xa55c('0x37')]['name'][_0xa55c('0x2f')]()]&&(_0x201941['custom_fields'][_0x52d37f[_0xa55c('0x32')]]=_0x22f6b6[_0x52d37f['Variable'][_0xa55c('0x38')][_0xa55c('0x2f')]()][_0xa55c('0x1f')]());}});}if(_0x201941['priority']){_0x201941[_0xa55c('0x39')]=Number(_0x201941[_0xa55c('0x39')]);}return _0x201941;}function getTicket(_0x47e93c,_0x6f9c4c,_0x194e78,_0x4d9083,_0x529ff8){logger[_0xa55c('0xb')]('Creating\x20new\x20ticket...');var _0x1e75dc=_[_0xa55c('0x3a')]({'subject':intUtil['getString'](_0x4d9083['Subjects'],_0x529ff8,'\x20'),'type':'phone','status':'new','labels':[_0xa55c('0x3b'),_0xa55c('0x3c'),_0xa55c('0x3d')][_0xa55c('0x3e')](getTags(_0x4d9083[_0xa55c('0x3f')],'name')),'description':intUtil[_0xa55c('0x40')](_0x4d9083[_0xa55c('0x41')],_0x529ff8,'\x0a'),'_links':{'assigned_user':{'href':util[_0xa55c('0xd')](_0xa55c('0x42'),_0x6f9c4c['id']),'class':_0xa55c('0x43')}},'message':{'direction':'in','body':intUtil[_0xa55c('0x40')](_0x4d9083['Descriptions'],_0x529ff8,'\x0a')}},getCustomFields(_0x4d9083[_0xa55c('0x44')],_0x529ff8));return request({'uri':util['format']('%s/customers/%d/cases',_0x47e93c[_0xa55c('0xf')],_0x194e78['id']),'method':_0xa55c('0x27'),'body':_0x1e75dc});}exports['queue']=function(_0x2bd98b,_0x508bd3,_0x5f25f7,_0x2f8449,_0x3fea03,_0x1630ac){var _0x540337,_0x1b2708;_0x1630ac[_0xa55c('0xf')]=intUtil['stripTrailingSlash'](_0x1630ac[_0xa55c('0xf')]);_0x1630ac['serverUrl']=intUtil[_0xa55c('0x45')](_0x1630ac[_0xa55c('0x46')]);if(_0x3fea03&&_0x3fea03['monitor_format']){logger[_0xa55c('0xb')](_0xa55c('0x47'),'Recording\x20is\x20enabled!');_0x508bd3[_0xa55c('0x48')]=util[_0xa55c('0xd')](_0xa55c('0x49'),_0x1630ac['serverUrl'],_0x508bd3[_0xa55c('0x4a')],md5(_0x508bd3['uniqueid']));}else{_0x508bd3[_0xa55c('0x48')]='';}headers[_0xa55c('0x4b')]=getAuth(_0x1630ac);return getUser(_0x1630ac,_0x2f8449[_0xa55c('0x4c')])['then'](function(_0x41eab1){_0x540337=_0x41eab1;logger[_0xa55c('0xb')]('The\x20User\x20ID\x20is:',_0x540337['id']);return getEndUser(_0x1630ac,_0x508bd3[_0xa55c('0x4d')],_0x508bd3[_0xa55c('0x4e')]);})['then'](function(_0x11ff1d){_0x1b2708=_0x11ff1d;logger[_0xa55c('0xb')]('The\x20Enduser\x20ID\x20is:',_0x1b2708['id']);return getTicket(_0x1630ac,_0x540337,_0x1b2708,_0x5f25f7,_0x508bd3);})[_0xa55c('0x10')](function(_0x81cee8){if(_0x81cee8){logger[_0xa55c('0xb')](_0xa55c('0x4f'));logger['info'](_0xa55c('0x50'),_0x81cee8['id']);switch(_0x1630ac['type']){case _0xa55c('0x51'):logger[_0xa55c('0xb')](_0xa55c('0x47'),'Displaying\x20ticket\x20to\x20agent...');emit(util[_0xa55c('0xd')](_0xa55c('0x52'),_0x2f8449['name']),_0xa55c('0x53'),{'recordId':_0x81cee8['id']});break;case _0xa55c('0x54'):logger[_0xa55c('0xb')](_0xa55c('0x47'),_0xa55c('0x55'));emit(util[_0xa55c('0xd')](_0xa55c('0x52'),_0x2f8449[_0xa55c('0x38')]),_0xa55c('0x56'),{'uri':util[_0xa55c('0xd')]('https://xcally.desk.com/web/agent/case/%d',_0x81cee8['id'])});break;default:logger[_0xa55c('0x57')](_0xa55c('0x47'),_0xa55c('0x58'));}}})['catch'](function(_0x4c3095){console[_0xa55c('0x57')](_0x4c3095);logger['error'](_0xa55c('0x47'),JSON['stringify'](_0x4c3095));});};exports[_0xa55c('0x59')]=function(_0x228df4,_0x181802,_0x3f9313,_0x2ecf79,_0x5b1cf3,_0x44b7c1,_0x4607ca){var _0x4b85cc,_0x3929a6;_0x44b7c1[_0xa55c('0xf')]=intUtil[_0xa55c('0x45')](_0x44b7c1[_0xa55c('0xf')]);_0x44b7c1['serverUrl']=intUtil['stripTrailingSlash'](_0x44b7c1[_0xa55c('0x46')]);if(_0x4607ca&&_0x4607ca[_0xa55c('0x5a')]&&_0x4607ca[_0xa55c('0x5a')]!==_0xa55c('0x5b')){logger['info'](_0xa55c('0x5c'),'Recording\x20is\x20enabled!');_0x181802[_0xa55c('0x48')]=util[_0xa55c('0xd')](_0xa55c('0x49'),_0x44b7c1[_0xa55c('0x46')],_0x181802[_0xa55c('0x4a')],md5(_0x181802['uniqueid']));}headers[_0xa55c('0x4b')]=getAuth(_0x44b7c1);return getUser(_0x44b7c1,_0x2ecf79['email'])[_0xa55c('0x10')](function(_0x157afe){_0x4b85cc=_0x157afe;logger[_0xa55c('0xb')](_0xa55c('0x5d'),_0x4b85cc['id']);return getEndUser(_0x44b7c1,_0x181802[_0xa55c('0x5e')],_0x181802[_0xa55c('0x5f')]);})[_0xa55c('0x10')](function(_0x53e2be){_0x3929a6=_0x53e2be;logger[_0xa55c('0xb')](_0xa55c('0x60'),_0x3929a6['id']);return getTicket(_0x44b7c1,_0x4b85cc,_0x3929a6,_0x3f9313,_0x181802);})[_0xa55c('0x10')](function(_0x23a30e){if(_0x23a30e){logger[_0xa55c('0xb')]('Ticket\x20created!');logger[_0xa55c('0xb')](_0xa55c('0x50'),_0x23a30e['id']);switch(_0x44b7c1[_0xa55c('0x2c')]){case _0xa55c('0x51'):logger[_0xa55c('0xb')]('[QUEUE]',_0xa55c('0x61'));emit(util[_0xa55c('0xd')](_0xa55c('0x52'),_0x2ecf79[_0xa55c('0x38')]),_0xa55c('0x53'),{'recordId':_0x23a30e['id']});break;case'newTab':logger[_0xa55c('0xb')]('[QUEUE]',_0xa55c('0x55'));emit(util['format'](_0xa55c('0x52'),_0x2ecf79['name']),_0xa55c('0x56'),{'uri':util[_0xa55c('0xd')](_0xa55c('0x62'),_0x44b7c1[_0xa55c('0xf')],_0x23a30e['id'])});break;default:logger[_0xa55c('0x57')](_0xa55c('0x5c'),_0xa55c('0x58'));}}})[_0xa55c('0x63')](function(_0x14b515){logger[_0xa55c('0x57')]('[OUTBOUND]',JSON[_0xa55c('0x17')](_0x14b515));});};exports[_0xa55c('0x64')]=function(_0x4ef914,_0x18b928,_0x2b8b88,_0x3e3b4b,_0x9fe234,_0x1b8b06){var _0xa38271,_0x3cef1f;_0x1b8b06[_0xa55c('0xf')]=intUtil['stripTrailingSlash'](_0x1b8b06[_0xa55c('0xf')]);_0x1b8b06[_0xa55c('0x46')]=intUtil[_0xa55c('0x45')](_0x1b8b06[_0xa55c('0x46')]);if(_0x9fe234&&_0x9fe234[_0xa55c('0x65')]){logger[_0xa55c('0xb')]('['+_0x18b928[_0xa55c('0x66')][_0xa55c('0x67')]()+']',_0xa55c('0x68'));_0x18b928['recordingURL']=util[_0xa55c('0xd')](_0xa55c('0x49'),_0x1b8b06[_0xa55c('0x46')],_0x18b928[_0xa55c('0x4a')],md5(_0x18b928[_0xa55c('0x4a')]));}else{_0x18b928[_0xa55c('0x48')]='';}headers[_0xa55c('0x4b')]=getAuth(_0x1b8b06);return getUser(_0x1b8b06)[_0xa55c('0x10')](function(_0x2e4cf7){_0xa38271=_0x2e4cf7;logger[_0xa55c('0xb')](_0xa55c('0x5d'),_0xa38271['id']);return getEndUser(_0x1b8b06,_0x18b928['calleridname'],_0x18b928[_0xa55c('0x4e')]);})['then'](function(_0x1228a4){_0x3cef1f=_0x1228a4;logger[_0xa55c('0xb')](_0xa55c('0x60'),_0x3cef1f['id']);return getTicket(_0x1b8b06,_0xa38271,_0x3cef1f,_0x2b8b88,_0x18b928);})['then'](function(_0x4d9722){if(_0x4d9722){logger[_0xa55c('0xb')](_0xa55c('0x4f'));logger[_0xa55c('0xb')](_0xa55c('0x50'),_0x4d9722['id']);}})['catch'](function(_0x149cb9){logger[_0xa55c('0x57')]('['+_0x18b928[_0xa55c('0x66')][_0xa55c('0x67')]()+']',JSON[_0xa55c('0x17')](_0x149cb9));});}; \ No newline at end of file diff --git a/server/services/ami/trigger/integration/dynamics365.js b/server/services/ami/trigger/integration/dynamics365.js index 651ee1a..8f1c879 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 _0xeb63=['value','validateEmail','email','userEmail','length','isdisabled','info','toUpperCase','systemuserid','userId',']\x20Agent\x20not\x20found,\x20using\x20the\x20admin\x20account!','internalemailaddress','outbound','destcalleridnum','calleridnum','POST','contacts','/systemusers(','headers','substring','lastIndexOf','telephone1','contacts?$select=','&$filter=','\x20eq\x20\x27','replace','%2b','enduserId','contactid','nothing',']\x20Enduser\x20NOT\x20Created\x20-\x20ModuleCreate\x20=\x20Nothing',']\x20Enduser\x20created!','forEach','includes','picklist','type','nameField','customField','idField','toLowerCase','indexOf','content','incident','incidents','assign','Subjects','getString','ticketType','phonecall','queue','/contacts(','callDirection','ticketId','%s/main.aspx?pagetype=entityrecord&etn=%s&id=%s','emit','trigger:browser:url','stripTrailingSlash','data7','unmanaged','format','serverUrl','uniqueid','[QUEUE]','recordingFormat','[OUTBOUND]','Recording\x20is\x20enabled!','recordingURL',']\x20The\x20User\x20ID\x20is:',']\x20The\x20User\x20email\x20is:','additionalSearchContact',']\x20The\x20Enduser\x20phone\x20is:',']\x20The\x20%s\x20ID\x20is:\x20%s',']\x20Call\x20direction:\x20%s','Displaying\x20call\x20in\x20a\x20new\x20tab...','name',']\x20Error\x20running\x20Dynamics365\x20integration','Error\x20running\x20Dynamics365\x20integration','lodash','request-promise','util','./util','md5','ioredis','../../../../config/logger','dynamics365','../../../../config/environment','defaults','socket.io-emitter','modernAuthentication','remoteUri','CloudProvider','tenantId','resolve','data5','username','password','clientSecret','then','access_token','catch','error',']\x20Wrong\x20credentials!','message','systemusers?$select=internalemailaddress,isdisabled,systemuserid','Bearer\x20','4.0'];(function(_0x463fb4,_0x8c632){var _0x4e418a=function(_0x521ef8){while(--_0x521ef8){_0x463fb4['push'](_0x463fb4['shift']());}};_0x4e418a(++_0x8c632);}(_0xeb63,0x121));var _0x3eb6=function(_0x11ecea,_0xac684e){_0x11ecea=_0x11ecea-0x0;var _0x3c033b=_0xeb63[_0x11ecea];return _0x3c033b;};'use strict';var _=require(_0x3eb6('0x0'));var rp=require(_0x3eb6('0x1'));var util=require(_0x3eb6('0x2'));var intUtil=require(_0x3eb6('0x3'));var md5=require(_0x3eb6('0x4'));var Redis=require(_0x3eb6('0x5'));var logger=require(_0x3eb6('0x6'))(_0x3eb6('0x7'));var config=require(_0x3eb6('0x8'));config['redis']=_[_0x3eb6('0x9')](config['redis'],{'host':'localhost','port':0x18eb});var io=require(_0x3eb6('0xa'))(new Redis(config['redis']));function getAuthToken(_0x1deec9,_0x5ebbfa,_0x266da2){if(_0x1deec9[_0x3eb6('0xb')]){_0x1deec9[_0x3eb6('0xc')]=_0x1deec9[_0x3eb6('0xd')]['data7'];_0x1deec9[_0x3eb6('0xe')]=_0x1deec9['CloudProvider']['data2'];return Promise[_0x3eb6('0xf')](_0x1deec9[_0x3eb6('0xd')][_0x3eb6('0x10')]);}var _0x23834a={'method':'POST','uri':_0x5ebbfa,'form':{'client_id':_0x1deec9['clientId'],'resource':_0x1deec9[_0x3eb6('0xc')],'username':_0x1deec9[_0x3eb6('0x11')],'password':_0x1deec9[_0x3eb6('0x12')],'grant_type':_0x3eb6('0x12'),'client_secret':_0x1deec9[_0x3eb6('0x13')]},'json':!![]};return rp(_0x23834a)[_0x3eb6('0x14')](function(_0x125709){return _0x125709[_0x3eb6('0x15')];})[_0x3eb6('0x16')](function(_0x2c9461){logger[_0x3eb6('0x17')]('['+[_0x266da2['toUpperCase']()]+_0x3eb6('0x18'));return _0x2c9461[_0x3eb6('0x19')];});}function getUser(_0xad7efb,_0x3b82d0,_0x5e9da2,_0x21615c,_0x185a18,_0x4bad54){return new Promise(function(_0x43e549,_0x994fc9){return getAuthToken(_0x3b82d0,_0x21615c,_0x4bad54)[_0x3eb6('0x14')](function(_0x3a35a6){var _0x353321={'method':'GET','uri':_0x185a18+_0x3eb6('0x1a'),'headers':{'Authorization':_0x3eb6('0x1b')+_0x3a35a6,'OData-Version':_0x3eb6('0x1c')},'json':!![]};return rp(_0x353321);})[_0x3eb6('0x14')](function(_0x15b9f1){var _0x5e8425=_0x15b9f1[_0x3eb6('0x1d')];var _0x395a4f=![];var _0x183473=null;if(!_['isNil'](_0x5e9da2)){if(intUtil[_0x3eb6('0x1e')](_0x5e9da2[_0x3eb6('0x1f')])){_0xad7efb[_0x3eb6('0x20')]=_0x5e9da2[_0x3eb6('0x1f')];for(_0x183473=0x0;_0x183473<_0x5e8425[_0x3eb6('0x21')];_0x183473++){if(_0x5e8425[_0x183473]['internalemailaddress']===_0x5e9da2[_0x3eb6('0x1f')]&&!_0x5e8425[_0x183473][_0x3eb6('0x22')]){_0x395a4f=!![];logger[_0x3eb6('0x23')]('['+[_0x4bad54[_0x3eb6('0x24')]()]+']\x20Agent\x20found\x20'+_0x5e8425[_0x183473][_0x3eb6('0x25')]+'!');_0xad7efb[_0x3eb6('0x26')]=_0x5e8425[_0x183473]['systemuserid'];}}}}if(!_0x395a4f){logger[_0x3eb6('0x23')]('['+[_0x4bad54['toUpperCase']()]+_0x3eb6('0x27'));_0xad7efb['userEmail']=_0x3b82d0[_0x3eb6('0x11')];for(_0x183473=0x0;_0x183473<_0x5e8425[_0x3eb6('0x21')];_0x183473++){if(_0x5e8425[_0x183473][_0x3eb6('0x28')]===_0x3b82d0[_0x3eb6('0x11')]){_0xad7efb[_0x3eb6('0x26')]=_0x5e8425[_0x183473][_0x3eb6('0x25')];}}}_0x43e549(_0xad7efb);})[_0x3eb6('0x16')](function(_0x3f8139){_0x994fc9(_0x3f8139['message']);});});}function createEndUser(_0x3ffc7c,_0x346f42,_0x1c0076,_0x528ccd,_0x50d2a2,_0x44d8a1,_0x4cd62e){return new Promise(function(_0x1b194d,_0x3aaa67){return getAuthToken(_0x346f42,_0x1c0076,_0x44d8a1)[_0x3eb6('0x14')](function(_0x2a3bad){var _0x5d2601=_0x44d8a1['toLowerCase']()===_0x3eb6('0x29')?_0x50d2a2[_0x3eb6('0x2a')]:_0x50d2a2[_0x3eb6('0x2b')];var _0x12acb3={'method':_0x3eb6('0x2c'),'uri':_0x528ccd+_0x3eb6('0x2d'),'body':{'fullname':_0x5d2601,'firstname':_0x5d2601,'lastname':'_','mobilephone':null,'address1_telephone1':null,'ownerid@odata.bind':_0x3eb6('0x2e')+_0x3ffc7c[_0x3eb6('0x26')]+')'},'headers':{'Authorization':'Bearer\x20'+_0x2a3bad,'OData-Version':_0x3eb6('0x1c')},'json':!![],'resolveWithFullResponse':!![]};_0x12acb3['body'][_0x4cd62e]=_0x5d2601;return rp(_0x12acb3);})[_0x3eb6('0x14')](function(_0x1933b6){var _0xa0cb27=_0x1933b6[_0x3eb6('0x2f')]['odata-entityid'];var _0x139e43=_0xa0cb27[_0x3eb6('0x30')](_0xa0cb27[_0x3eb6('0x31')]('(')+0x1,_0xa0cb27[_0x3eb6('0x31')](')'));_0x3ffc7c['enduserId']=_0x139e43;_0x1b194d(_0x3ffc7c);})[_0x3eb6('0x16')](function(_0x34037f){_0x3aaa67(_0x34037f['message']);});});}function getEndUser(_0x14d857,_0x374151,_0x44e337,_0x43beb3,_0x1d7f2f,_0x4b9d91,_0x42b5c1,_0x40a5d4){var _0x1e38f8=_0x4b9d91['toLowerCase']()==='outbound'?_0x1d7f2f['destcalleridnum']:_0x1d7f2f[_0x3eb6('0x2b')];return getAuthToken(_0x374151,_0x44e337,_0x4b9d91)[_0x3eb6('0x14')](function(_0x355e00){_0x40a5d4=_0x40a5d4?_0x40a5d4:_0x3eb6('0x32');var _0x525786={'method':'GET','uri':_0x43beb3+_0x3eb6('0x33')+_0x40a5d4+_0x3eb6('0x34')+_0x40a5d4+_0x3eb6('0x35')+_0x1e38f8[_0x3eb6('0x36')]('+',_0x3eb6('0x37'))+'\x27','headers':{'Authorization':_0x3eb6('0x1b')+_0x355e00,'If-None-Match':null,'OData-Version':_0x3eb6('0x1c')},'json':!![]};return rp(_0x525786);})[_0x3eb6('0x14')](function(_0x64cc80){var _0x40da3d=![];if(!_0x64cc80)return _0x40da3d;var _0x2b0b8c=_0x64cc80[_0x3eb6('0x1d')];for(var _0x4e44aa=0x0;_0x4e44aa<_0x2b0b8c[_0x3eb6('0x21')];_0x4e44aa++){if(_0x2b0b8c[_0x4e44aa][_0x40a5d4]===_0x1e38f8){_0x40da3d=!![];_0x14d857[_0x3eb6('0x38')]=_0x2b0b8c[_0x4e44aa][_0x3eb6('0x39')];}}return _0x40da3d;})['then'](function(_0x4b0f4e){if(_0x4b0f4e)return _0x14d857;if(_0x42b5c1===_0x3eb6('0x3a')){logger[_0x3eb6('0x23')]('['+[_0x4b9d91[_0x3eb6('0x24')]()]+_0x3eb6('0x3b'));return _0x14d857;}return createEndUser(_0x14d857,_0x374151,_0x44e337,_0x43beb3,_0x1d7f2f,_0x4b9d91,_0x40a5d4)['then'](function(_0x42cb3c){logger[_0x3eb6('0x23')]('['+[_0x4b9d91[_0x3eb6('0x24')]()]+_0x3eb6('0x3c'),_0x42cb3c['enduserId']);return _0x42cb3c;});});}function getCustomFields(_0x5cc430,_0x381652,_0x1afc17){var _0x276b99={};if(_0x5cc430[_0x3eb6('0x21')]>0x0){_[_0x3eb6('0x3d')](_0x5cc430,function(_0x113f56){if(_[_0x3eb6('0x3e')](['string',_0x3eb6('0x3f')],_0x113f56[_0x3eb6('0x40')])&&_0x113f56[_0x3eb6('0x41')]&&!_0x113f56[_0x3eb6('0x42')]){var _0x5ed7df=_0x113f56[_0x3eb6('0x43')][_0x3eb6('0x44')]();var _0x1e1264=_0x5ed7df['substring'](0x0,_0x5ed7df[_0x3eb6('0x45')]('_'));var _0x365ba3=_0x5ed7df['substring'](_0x5ed7df[_0x3eb6('0x45')]('_')+0x1);if(_0x1e1264===_0x1afc17){_0x276b99[_0x365ba3]=_0x113f56[_0x3eb6('0x46')];}}});}return _0x276b99;}function getTicket(_0x47213c,_0x117c61,_0x4370a4,_0xa0da38,_0x1213a0,_0xde1489,_0x365ed7){return new Promise(function(_0x5ae597,_0x3a34e8){var _0x324272;return getAuthToken(_0x117c61,_0x4370a4,_0x365ed7)[_0x3eb6('0x14')](function(_0x5f10c4){if(_0xde1489['ticketType']===_0x3eb6('0x47')){_0x324272={'method':_0x3eb6('0x2c'),'uri':_0xa0da38+_0x3eb6('0x48'),'body':Object[_0x3eb6('0x49')]({},{'title':intUtil['getString'](_0xde1489[_0x3eb6('0x4a')],_0x1213a0,'\x20'),'description':intUtil[_0x3eb6('0x4b')](_0xde1489['Descriptions'],_0x1213a0,'\x0a'),'customerid_contact@odata.bind':_0x47213c[_0x3eb6('0x38')]?'/contacts('+_0x47213c[_0x3eb6('0x38')]+')':undefined,'ownerid@odata.bind':_0x3eb6('0x2e')+_0x47213c['userId']+')','caseorigincode':'1'},getCustomFields(_0xde1489['Fields'],_0x1213a0,_0xde1489[_0x3eb6('0x4c')])),'headers':{'Authorization':_0x3eb6('0x1b')+_0x5f10c4,'OData-Version':'4.0'},'json':!![],'resolveWithFullResponse':!![]};}if(_0xde1489[_0x3eb6('0x4c')]===_0x3eb6('0x4d')){var _0x2259fd=_0x47213c[_0x3eb6('0x38')]?[{'partyid_systemuser@odata.bind':_0x3eb6('0x2e')+_0x47213c[_0x3eb6('0x26')]+')','participationtypemask':_0x47213c['callDirection']===_0x3eb6('0x4e')?0x2:0x1},{'partyid_contact@odata.bind':_0x3eb6('0x4f')+_0x47213c[_0x3eb6('0x38')]+')','participationtypemask':_0x47213c[_0x3eb6('0x50')]==='queue'?0x1:0x2}]:[{'partyid_systemuser@odata.bind':_0x3eb6('0x2e')+_0x47213c[_0x3eb6('0x26')]+')','participationtypemask':_0x47213c[_0x3eb6('0x50')]===_0x3eb6('0x4e')?0x2:0x1}];_0x324272={'method':'POST','uri':_0xa0da38+'phonecalls','body':Object['assign']({},{'subject':intUtil['getString'](_0xde1489['Subjects'],_0x1213a0,'\x20'),'phonenumber':String(_0x1213a0['calleridnum']),'description':intUtil[_0x3eb6('0x4b')](_0xde1489['Descriptions'],_0x1213a0,'\x0a'),'regardingobjectid_contact@odata.bind':_0x47213c[_0x3eb6('0x38')]?_0x3eb6('0x4f')+_0x47213c[_0x3eb6('0x38')]+')':undefined,'ownerid@odata.bind':'/systemusers('+_0x47213c[_0x3eb6('0x26')]+')','directioncode':_0x47213c[_0x3eb6('0x50')]===_0x3eb6('0x4e')?![]:!![],'phonecall_activity_parties':_0x2259fd},getCustomFields(_0xde1489['Fields'],_0x1213a0,_0xde1489['ticketType'])),'headers':{'Authorization':_0x3eb6('0x1b')+_0x5f10c4,'OData-Version':_0x3eb6('0x1c')},'json':!![],'resolveWithFullResponse':!![]};}return rp(_0x324272);})[_0x3eb6('0x14')](function(_0x31dd6a){var _0x8b4a38=_0x31dd6a['headers']['odata-entityid'];var _0x609e9e=_0x8b4a38['substring'](_0x8b4a38[_0x3eb6('0x31')]('(')+0x1,_0x8b4a38[_0x3eb6('0x31')](')'));_0x47213c[_0x3eb6('0x51')]=_0x609e9e;_0x5ae597(_0x47213c);})[_0x3eb6('0x16')](function(_0x2a725f){_0x3a34e8(_0x2a725f[_0x3eb6('0x19')]);});});}function emit(_0x8ed730,_0x2ee191,_0x19db8a,_0x45d405){var _0x3a09ea={'uri':util['format'](_0x3eb6('0x52'),_0x8ed730,_0x19db8a,_0x45d405)};io['to'](util['format']('user:%s',_0x2ee191))[_0x3eb6('0x53')](_0x3eb6('0x54'),_0x3a09ea);}exports['cs']=function(_0x3859fb,_0x3af7f2,_0x59a5a6,_0x3d580e,_0x42adfb,_0x13e47d,_0x164758,_0x4ff76d){var _0x243f58={};_0x13e47d[_0x3eb6('0xc')]=_0x13e47d[_0x3eb6('0xb')]?intUtil[_0x3eb6('0x55')](_0x13e47d[_0x3eb6('0xd')][_0x3eb6('0x56')]):intUtil[_0x3eb6('0x55')](_0x13e47d[_0x3eb6('0xc')]);_0x13e47d['serverUrl']=intUtil['stripTrailingSlash'](_0x13e47d['serverUrl']);_0x243f58[_0x3eb6('0x50')]=_0x4ff76d===_0x3eb6('0x4e')||_0x4ff76d===_0x3eb6('0x57')?_0x3eb6('0x4e'):_0x3eb6('0x29');var _0x4bff56=_0x13e47d[_0x3eb6('0xb')]?util[_0x3eb6('0x58')]('%s/api/data/v9.0/',_0x13e47d['CloudProvider'][_0x3eb6('0x56')]):util[_0x3eb6('0x58')]('%s/api/data/v9.0/',_0x13e47d[_0x3eb6('0xc')]);var _0x229300=util[_0x3eb6('0x58')]('https://login.microsoftonline.com/%s/oauth2/token',_0x13e47d[_0x3eb6('0xe')]);var _0x1045a0=util[_0x3eb6('0x58')]('%s/api/voice/recordings/%s/downloads?type=uniqueid&token=%s',_0x13e47d[_0x3eb6('0x59')],_0x3af7f2[_0x3eb6('0x5a')],md5(_0x3af7f2[_0x3eb6('0x5a')]));if(_0x42adfb&&_0x42adfb['monitor_format']){logger[_0x3eb6('0x23')](_0x3eb6('0x5b'),'Recording\x20is\x20enabled!');_0x3af7f2['recordingURL']=_0x1045a0;}else if(_0x164758&&_0x164758['recordingFormat']&&_0x164758[_0x3eb6('0x5c')]!=='none'){logger[_0x3eb6('0x23')](_0x3eb6('0x5d'),_0x3eb6('0x5e'));_0x3af7f2[_0x3eb6('0x5f')]=_0x1045a0;}else{_0x3af7f2[_0x3eb6('0x5f')]='';}return getUser(_0x243f58,_0x13e47d,_0x3d580e,_0x229300,_0x4bff56,_0x4ff76d)['then'](function(_0x55b197){logger['info']('['+_0x4ff76d[_0x3eb6('0x24')]()+_0x3eb6('0x60'),_0x55b197[_0x3eb6('0x26')]);logger[_0x3eb6('0x23')]('['+_0x4ff76d[_0x3eb6('0x24')]()+_0x3eb6('0x61'),_0x55b197['userEmail']);return getEndUser(_0x55b197,_0x13e47d,_0x229300,_0x4bff56,_0x3af7f2,_0x4ff76d,_0x59a5a6['moduleCreate'],_0x59a5a6[_0x3eb6('0x62')]);})[_0x3eb6('0x14')](function(_0x1298c2){logger[_0x3eb6('0x23')]('['+_0x4ff76d['toUpperCase']()+']\x20The\x20Enduser\x20ID\x20is:',_0x1298c2[_0x3eb6('0x38')]);logger[_0x3eb6('0x23')]('['+_0x4ff76d['toUpperCase']()+_0x3eb6('0x63'),_0x3af7f2[_0x3eb6('0x2b')]);return getTicket(_0x1298c2,_0x13e47d,_0x229300,_0x4bff56,_0x3af7f2,_0x59a5a6,_0x4ff76d);})[_0x3eb6('0x14')](function(_0x5b1f26){logger[_0x3eb6('0x23')](util['format']('['+_0x4ff76d[_0x3eb6('0x24')]()+_0x3eb6('0x64'),_0x59a5a6[_0x3eb6('0x4c')],_0x5b1f26[_0x3eb6('0x51')]));logger[_0x3eb6('0x23')](util[_0x3eb6('0x58')]('['+_0x4ff76d[_0x3eb6('0x24')]()+_0x3eb6('0x65'),_0x4ff76d));if(_0x4ff76d!==_0x3eb6('0x57')&&_0x59a5a6['openNewTab']){logger[_0x3eb6('0x23')]('['+_0x4ff76d['toUpperCase']()+']',_0x3eb6('0x66'));emit(_0x13e47d[_0x3eb6('0xc')],_0x3d580e[_0x3eb6('0x67')],_0x59a5a6[_0x3eb6('0x4c')],_0x5b1f26[_0x3eb6('0x51')]);}})[_0x3eb6('0x16')](function(_0x49b4b2){logger['error']('['+_0x4ff76d[_0x3eb6('0x24')]()+_0x3eb6('0x68'),_0x49b4b2['message']);console[_0x3eb6('0x17')](_0x3eb6('0x69'),_0x49b4b2);});}; \ No newline at end of file +var _0xe106=['assign','getString','Subjects','Descriptions','/contacts(','/systemusers(','Fields','phonecall','queue','callDirection','phonecalls','headers','odata-entityid','ticketId','%s/main.aspx?pagetype=entityrecord&etn=%s&id=%s','format','user:%s','emit','trigger:browser:url','stripTrailingSlash','serverUrl','unmanaged','%s/api/data/v9.0/','%s/api/voice/recordings/%s/downloads?type=uniqueid&token=%s','uniqueid','monitor_format','[QUEUE]','recordingFormat','none','[OUTBOUND]','Recording\x20is\x20enabled!','recordingURL',']\x20The\x20User\x20ID\x20is:',']\x20The\x20User\x20email\x20is:','moduleCreate','additionalSearchContact',']\x20The\x20Enduser\x20ID\x20is:',']\x20The\x20Enduser\x20phone\x20is:',']\x20Call\x20direction:\x20%s','openNewTab','Displaying\x20call\x20in\x20a\x20new\x20tab...','name',']\x20Error\x20running\x20Dynamics365\x20integration','lodash','request-promise','util','./util','ioredis','dynamics365','../../../../config/environment','defaults','socket.io-emitter','redis','modernAuthentication','remoteUri','CloudProvider','data7','resolve','POST','clientId','username','password','clientSecret','then','catch','error','toUpperCase',']\x20Wrong\x20credentials!','systemusers?$select=internalemailaddress,isdisabled,systemuserid','Bearer\x20','value','isNil','validateEmail','email','length','info','systemuserid','userId','userEmail','internalemailaddress','message','toLowerCase','outbound','destcalleridnum','4.0','body','lastIndexOf','calleridnum','GET','&$filter=','\x20eq\x20\x27','%2b','enduserId','contactid','nothing',']\x20Enduser\x20created!','picklist','type','nameField','customField','idField','substring','indexOf','content','ticketType','incidents'];(function(_0x4cdc07,_0x45b056){var _0x21b5f3=function(_0x136318){while(--_0x136318){_0x4cdc07['push'](_0x4cdc07['shift']());}};_0x21b5f3(++_0x45b056);}(_0xe106,0x95));var _0x6e10=function(_0x323d87,_0x4ef3f9){_0x323d87=_0x323d87-0x0;var _0x5e8f74=_0xe106[_0x323d87];return _0x5e8f74;};'use strict';var _=require(_0x6e10('0x0'));var rp=require(_0x6e10('0x1'));var util=require(_0x6e10('0x2'));var intUtil=require(_0x6e10('0x3'));var md5=require('md5');var Redis=require(_0x6e10('0x4'));var logger=require('../../../../config/logger')(_0x6e10('0x5'));var config=require(_0x6e10('0x6'));config['redis']=_[_0x6e10('0x7')](config['redis'],{'host':'localhost','port':0x18eb});var io=require(_0x6e10('0x8'))(new Redis(config[_0x6e10('0x9')]));function getAuthToken(_0xf76f08,_0x5b92d1,_0xa01b71){if(_0xf76f08[_0x6e10('0xa')]){_0xf76f08[_0x6e10('0xb')]=_0xf76f08[_0x6e10('0xc')][_0x6e10('0xd')];_0xf76f08['tenantId']=_0xf76f08[_0x6e10('0xc')]['data2'];return Promise[_0x6e10('0xe')](_0xf76f08[_0x6e10('0xc')]['data5']);}var _0x473d45={'method':_0x6e10('0xf'),'uri':_0x5b92d1,'form':{'client_id':_0xf76f08[_0x6e10('0x10')],'resource':_0xf76f08[_0x6e10('0xb')],'username':_0xf76f08[_0x6e10('0x11')],'password':_0xf76f08[_0x6e10('0x12')],'grant_type':'password','client_secret':_0xf76f08[_0x6e10('0x13')]},'json':!![]};return rp(_0x473d45)[_0x6e10('0x14')](function(_0xa998b7){return _0xa998b7['access_token'];})[_0x6e10('0x15')](function(_0x13d409){logger[_0x6e10('0x16')]('['+[_0xa01b71[_0x6e10('0x17')]()]+_0x6e10('0x18'));return _0x13d409['message'];});}function getUser(_0x3ade0a,_0x42c831,_0x222650,_0x1f7642,_0x1c57e8,_0x40be3c){return new Promise(function(_0x91e3b,_0x132ac4){return getAuthToken(_0x42c831,_0x1f7642,_0x40be3c)[_0x6e10('0x14')](function(_0x5cfcc5){var _0x21ba27={'method':'GET','uri':_0x1c57e8+_0x6e10('0x19'),'headers':{'Authorization':_0x6e10('0x1a')+_0x5cfcc5,'OData-Version':'4.0'},'json':!![]};return rp(_0x21ba27);})[_0x6e10('0x14')](function(_0xdf371c){var _0x38a861=_0xdf371c[_0x6e10('0x1b')];var _0x413857=![];var _0x17f21a=null;if(!_[_0x6e10('0x1c')](_0x222650)){if(intUtil[_0x6e10('0x1d')](_0x222650[_0x6e10('0x1e')])){_0x3ade0a['userEmail']=_0x222650[_0x6e10('0x1e')];for(_0x17f21a=0x0;_0x17f21a<_0x38a861[_0x6e10('0x1f')];_0x17f21a++){if(_0x38a861[_0x17f21a]['internalemailaddress']===_0x222650[_0x6e10('0x1e')]&&!_0x38a861[_0x17f21a]['isdisabled']){_0x413857=!![];logger[_0x6e10('0x20')]('['+[_0x40be3c[_0x6e10('0x17')]()]+']\x20Agent\x20found\x20'+_0x38a861[_0x17f21a][_0x6e10('0x21')]+'!');_0x3ade0a[_0x6e10('0x22')]=_0x38a861[_0x17f21a][_0x6e10('0x21')];}}}}if(!_0x413857){logger[_0x6e10('0x20')]('['+[_0x40be3c['toUpperCase']()]+']\x20Agent\x20not\x20found,\x20using\x20the\x20admin\x20account!');_0x3ade0a[_0x6e10('0x23')]=_0x42c831[_0x6e10('0x11')];for(_0x17f21a=0x0;_0x17f21a<_0x38a861['length'];_0x17f21a++){if(_0x38a861[_0x17f21a][_0x6e10('0x24')]===_0x42c831[_0x6e10('0x11')]){_0x3ade0a[_0x6e10('0x22')]=_0x38a861[_0x17f21a]['systemuserid'];}}}_0x91e3b(_0x3ade0a);})[_0x6e10('0x15')](function(_0x53694e){_0x132ac4(_0x53694e[_0x6e10('0x25')]);});});}function createEndUser(_0xbd992b,_0xf8e71,_0x831648,_0x1387df,_0x4d9823,_0x563337,_0x20de4a){return new Promise(function(_0x1b4f70,_0x13daed){return getAuthToken(_0xf8e71,_0x831648,_0x563337)['then'](function(_0xf10116){var _0x526548=_0x563337[_0x6e10('0x26')]()===_0x6e10('0x27')?_0x4d9823[_0x6e10('0x28')]:_0x4d9823['calleridnum'];var _0x896168={'method':_0x6e10('0xf'),'uri':_0x1387df+'contacts','body':{'fullname':_0x526548,'firstname':_0x526548,'lastname':'_','mobilephone':null,'address1_telephone1':null,'ownerid@odata.bind':'/systemusers('+_0xbd992b[_0x6e10('0x22')]+')'},'headers':{'Authorization':_0x6e10('0x1a')+_0xf10116,'OData-Version':_0x6e10('0x29')},'json':!![],'resolveWithFullResponse':!![]};_0x896168[_0x6e10('0x2a')][_0x20de4a]=_0x526548;return rp(_0x896168);})[_0x6e10('0x14')](function(_0xb3db3a){var _0x3be294=_0xb3db3a['headers']['odata-entityid'];var _0xaa941e=_0x3be294['substring'](_0x3be294[_0x6e10('0x2b')]('(')+0x1,_0x3be294['lastIndexOf'](')'));_0xbd992b['enduserId']=_0xaa941e;_0x1b4f70(_0xbd992b);})[_0x6e10('0x15')](function(_0x4b8b81){_0x13daed(_0x4b8b81[_0x6e10('0x25')]);});});}function getEndUser(_0x259054,_0xe9f794,_0xa0d63,_0x370073,_0x2679bb,_0x35e83e,_0x3db112,_0x5d7e80){var _0x6969c3=_0x35e83e[_0x6e10('0x26')]()===_0x6e10('0x27')?_0x2679bb['destcalleridnum']:_0x2679bb[_0x6e10('0x2c')];return getAuthToken(_0xe9f794,_0xa0d63,_0x35e83e)['then'](function(_0x35e29e){_0x5d7e80=_0x5d7e80?_0x5d7e80:'telephone1';var _0x23efd7={'method':_0x6e10('0x2d'),'uri':_0x370073+'contacts?$select='+_0x5d7e80+_0x6e10('0x2e')+_0x5d7e80+_0x6e10('0x2f')+_0x6969c3['replace']('+',_0x6e10('0x30'))+'\x27','headers':{'Authorization':_0x6e10('0x1a')+_0x35e29e,'If-None-Match':null,'OData-Version':'4.0'},'json':!![]};return rp(_0x23efd7);})[_0x6e10('0x14')](function(_0xc385ee){var _0x48b14e=![];if(!_0xc385ee)return _0x48b14e;var _0x1e2eaf=_0xc385ee[_0x6e10('0x1b')];for(var _0xe871c1=0x0;_0xe871c1<_0x1e2eaf[_0x6e10('0x1f')];_0xe871c1++){if(_0x1e2eaf[_0xe871c1][_0x5d7e80]===_0x6969c3){_0x48b14e=!![];_0x259054[_0x6e10('0x31')]=_0x1e2eaf[_0xe871c1][_0x6e10('0x32')];}}return _0x48b14e;})[_0x6e10('0x14')](function(_0x283699){if(_0x283699)return _0x259054;if(_0x3db112===_0x6e10('0x33')){logger[_0x6e10('0x20')]('['+[_0x35e83e[_0x6e10('0x17')]()]+']\x20Enduser\x20NOT\x20Created\x20-\x20ModuleCreate\x20=\x20Nothing');return _0x259054;}return createEndUser(_0x259054,_0xe9f794,_0xa0d63,_0x370073,_0x2679bb,_0x35e83e,_0x5d7e80)['then'](function(_0x46f526){logger[_0x6e10('0x20')]('['+[_0x35e83e[_0x6e10('0x17')]()]+_0x6e10('0x34'),_0x46f526[_0x6e10('0x31')]);return _0x46f526;});});}function getCustomFields(_0x54c311,_0x4f7ab4,_0x1f5c3c){var _0x51650f={};if(_0x54c311['length']>0x0){_['forEach'](_0x54c311,function(_0x258fcd){if(_['includes'](['string',_0x6e10('0x35')],_0x258fcd[_0x6e10('0x36')])&&_0x258fcd[_0x6e10('0x37')]&&!_0x258fcd[_0x6e10('0x38')]){var _0x1f6045=_0x258fcd[_0x6e10('0x39')]['toLowerCase']();var _0x67b898=_0x1f6045[_0x6e10('0x3a')](0x0,_0x1f6045['indexOf']('_'));var _0x41d303=_0x1f6045[_0x6e10('0x3a')](_0x1f6045[_0x6e10('0x3b')]('_')+0x1);if(_0x67b898===_0x1f5c3c){_0x51650f[_0x41d303]=_0x258fcd[_0x6e10('0x3c')];}}});}return _0x51650f;}function getTicket(_0x45e8a8,_0x2eee51,_0xe5a68a,_0x2aeaed,_0x255abf,_0x36f9e1,_0x7f21d){return new Promise(function(_0x4b6a74,_0x125bd3){var _0x2eab54;return getAuthToken(_0x2eee51,_0xe5a68a,_0x7f21d)[_0x6e10('0x14')](function(_0xc94ec5){if(_0x36f9e1[_0x6e10('0x3d')]==='incident'){_0x2eab54={'method':'POST','uri':_0x2aeaed+_0x6e10('0x3e'),'body':Object[_0x6e10('0x3f')]({},{'title':intUtil[_0x6e10('0x40')](_0x36f9e1[_0x6e10('0x41')],_0x255abf,'\x20'),'description':intUtil[_0x6e10('0x40')](_0x36f9e1[_0x6e10('0x42')],_0x255abf,'\x0a'),'customerid_contact@odata.bind':_0x45e8a8[_0x6e10('0x31')]?_0x6e10('0x43')+_0x45e8a8[_0x6e10('0x31')]+')':undefined,'ownerid@odata.bind':_0x6e10('0x44')+_0x45e8a8[_0x6e10('0x22')]+')','caseorigincode':'1'},getCustomFields(_0x36f9e1[_0x6e10('0x45')],_0x255abf,_0x36f9e1[_0x6e10('0x3d')])),'headers':{'Authorization':_0x6e10('0x1a')+_0xc94ec5,'OData-Version':_0x6e10('0x29')},'json':!![],'resolveWithFullResponse':!![]};}if(_0x36f9e1['ticketType']===_0x6e10('0x46')){var _0x4eb4fa=_0x45e8a8[_0x6e10('0x31')]?[{'partyid_systemuser@odata.bind':'/systemusers('+_0x45e8a8['userId']+')','participationtypemask':_0x45e8a8['callDirection']===_0x6e10('0x47')?0x2:0x1},{'partyid_contact@odata.bind':'/contacts('+_0x45e8a8[_0x6e10('0x31')]+')','participationtypemask':_0x45e8a8[_0x6e10('0x48')]===_0x6e10('0x47')?0x1:0x2}]:[{'partyid_systemuser@odata.bind':'/systemusers('+_0x45e8a8[_0x6e10('0x22')]+')','participationtypemask':_0x45e8a8[_0x6e10('0x48')]==='queue'?0x2:0x1}];_0x2eab54={'method':_0x6e10('0xf'),'uri':_0x2aeaed+_0x6e10('0x49'),'body':Object[_0x6e10('0x3f')]({},{'subject':intUtil[_0x6e10('0x40')](_0x36f9e1[_0x6e10('0x41')],_0x255abf,'\x20'),'phonenumber':String(_0x255abf[_0x6e10('0x2c')]),'description':intUtil[_0x6e10('0x40')](_0x36f9e1[_0x6e10('0x42')],_0x255abf,'\x0a'),'regardingobjectid_contact@odata.bind':_0x45e8a8[_0x6e10('0x31')]?_0x6e10('0x43')+_0x45e8a8['enduserId']+')':undefined,'ownerid@odata.bind':_0x6e10('0x44')+_0x45e8a8[_0x6e10('0x22')]+')','directioncode':_0x45e8a8['callDirection']==='queue'?![]:!![],'phonecall_activity_parties':_0x4eb4fa},getCustomFields(_0x36f9e1[_0x6e10('0x45')],_0x255abf,_0x36f9e1[_0x6e10('0x3d')])),'headers':{'Authorization':_0x6e10('0x1a')+_0xc94ec5,'OData-Version':_0x6e10('0x29')},'json':!![],'resolveWithFullResponse':!![]};}return rp(_0x2eab54);})[_0x6e10('0x14')](function(_0x241547){var _0x89af9e=_0x241547[_0x6e10('0x4a')][_0x6e10('0x4b')];var _0x23e9af=_0x89af9e[_0x6e10('0x3a')](_0x89af9e[_0x6e10('0x2b')]('(')+0x1,_0x89af9e['lastIndexOf'](')'));_0x45e8a8[_0x6e10('0x4c')]=_0x23e9af;_0x4b6a74(_0x45e8a8);})[_0x6e10('0x15')](function(_0x5cc92e){_0x125bd3(_0x5cc92e[_0x6e10('0x25')]);});});}function emit(_0x473abf,_0x40334f,_0x440822,_0x5ddee1){var _0x3270f8={'uri':util['format'](_0x6e10('0x4d'),_0x473abf,_0x440822,_0x5ddee1)};io['to'](util[_0x6e10('0x4e')](_0x6e10('0x4f'),_0x40334f))[_0x6e10('0x50')](_0x6e10('0x51'),_0x3270f8);}exports['cs']=function(_0x4aba43,_0x2fab2b,_0x130443,_0xa3835f,_0xe84718,_0x12087b,_0x18d1f1,_0x2e9b6b){var _0x17dbde={};_0x12087b['remoteUri']=_0x12087b[_0x6e10('0xa')]?intUtil[_0x6e10('0x52')](_0x12087b[_0x6e10('0xc')]['data7']):intUtil[_0x6e10('0x52')](_0x12087b['remoteUri']);_0x12087b[_0x6e10('0x53')]=intUtil['stripTrailingSlash'](_0x12087b[_0x6e10('0x53')]);_0x17dbde[_0x6e10('0x48')]=_0x2e9b6b===_0x6e10('0x47')||_0x2e9b6b===_0x6e10('0x54')?_0x6e10('0x47'):'outbound';var _0x1218d7=_0x12087b['modernAuthentication']?util[_0x6e10('0x4e')](_0x6e10('0x55'),_0x12087b[_0x6e10('0xc')]['data7']):util['format'](_0x6e10('0x55'),_0x12087b[_0x6e10('0xb')]);var _0x395ec1=util[_0x6e10('0x4e')]('https://login.microsoftonline.com/%s/oauth2/token',_0x12087b['tenantId']);var _0x2564aa=util['format'](_0x6e10('0x56'),_0x12087b[_0x6e10('0x53')],_0x2fab2b[_0x6e10('0x57')],md5(_0x2fab2b[_0x6e10('0x57')]));if(_0xe84718&&_0xe84718[_0x6e10('0x58')]){logger[_0x6e10('0x20')](_0x6e10('0x59'),'Recording\x20is\x20enabled!');_0x2fab2b['recordingURL']=_0x2564aa;}else if(_0x18d1f1&&_0x18d1f1[_0x6e10('0x5a')]&&_0x18d1f1[_0x6e10('0x5a')]!==_0x6e10('0x5b')){logger['info'](_0x6e10('0x5c'),_0x6e10('0x5d'));_0x2fab2b[_0x6e10('0x5e')]=_0x2564aa;}else{_0x2fab2b[_0x6e10('0x5e')]='';}return getUser(_0x17dbde,_0x12087b,_0xa3835f,_0x395ec1,_0x1218d7,_0x2e9b6b)['then'](function(_0x2eeff9){logger[_0x6e10('0x20')]('['+_0x2e9b6b[_0x6e10('0x17')]()+_0x6e10('0x5f'),_0x2eeff9['userId']);logger[_0x6e10('0x20')]('['+_0x2e9b6b[_0x6e10('0x17')]()+_0x6e10('0x60'),_0x2eeff9[_0x6e10('0x23')]);return getEndUser(_0x2eeff9,_0x12087b,_0x395ec1,_0x1218d7,_0x2fab2b,_0x2e9b6b,_0x130443[_0x6e10('0x61')],_0x130443[_0x6e10('0x62')]);})[_0x6e10('0x14')](function(_0x617418){logger['info']('['+_0x2e9b6b[_0x6e10('0x17')]()+_0x6e10('0x63'),_0x617418['enduserId']);logger[_0x6e10('0x20')]('['+_0x2e9b6b[_0x6e10('0x17')]()+_0x6e10('0x64'),_0x2fab2b[_0x6e10('0x2c')]);return getTicket(_0x617418,_0x12087b,_0x395ec1,_0x1218d7,_0x2fab2b,_0x130443,_0x2e9b6b);})[_0x6e10('0x14')](function(_0x4f2ce0){logger[_0x6e10('0x20')](util['format']('['+_0x2e9b6b[_0x6e10('0x17')]()+']\x20The\x20%s\x20ID\x20is:\x20%s',_0x130443['ticketType'],_0x4f2ce0['ticketId']));logger[_0x6e10('0x20')](util['format']('['+_0x2e9b6b[_0x6e10('0x17')]()+_0x6e10('0x65'),_0x2e9b6b));if(_0x2e9b6b!=='unmanaged'&&_0x130443[_0x6e10('0x66')]){logger[_0x6e10('0x20')]('['+_0x2e9b6b['toUpperCase']()+']',_0x6e10('0x67'));emit(_0x12087b[_0x6e10('0xb')],_0xa3835f[_0x6e10('0x68')],_0x130443[_0x6e10('0x3d')],_0x4f2ce0[_0x6e10('0x4c')]);}})[_0x6e10('0x15')](function(_0x413132){logger[_0x6e10('0x16')]('['+_0x2e9b6b[_0x6e10('0x17')]()+_0x6e10('0x69'),_0x413132['message']);console[_0x6e10('0x16')]('Error\x20running\x20Dynamics365\x20integration',_0x413132);});}; \ 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 785fdea..9f15335 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 _0x32c3=['destcalleridname','%s/helpdesk/tickets/%d','lastevent','toUpperCase','lodash','request-promise','md5','ioredis','../../../../config/environment','../../../../config/logger','freshdesk','socket.io-emitter','redis','application/json','emit','info','Creating\x20new\x20ticket...','merge','Caller\x20-\x20%s','calleridnum','getString','Subjects','Descriptions','
','Tags','name','mapValues','keyBy','custom_fields','value','format','remoteUri','POST','Ticket\x20created!','validateEmail','%s/api/v2/agents','Agent\x20found!','find','contact','Agent\x20not\x20found,\x20using\x20the\x20admin\x20account!','%s/api/v2/agents/me','Admin\x20account\x20selected.','Invalid\x20email\x20format,\x20using\x20the\x20admin\x20account!','then','Searching\x20enduser\x20with\x20phone','%s/api/v2/contacts','length','Enduser\x20found!','Enduser\x20not\x20found,\x20creating\x20a\x20new\x20enduser!','Enduser\x20created.','apiKey','toString','base64','debug','[HTTP]','stringify','GET','map','includes','string','picklist','customField','nameField','content','type','push','idField','variable','variableName','customVariable','Variable','toLowerCase','queue','stripTrailingSlash','serverUrl','monitor_format','[QUEUE]','Recording\x20is\x20enabled!','recordingURL','%s/api/voice/recordings/%s/downloads?type=uniqueid&token=%s','uniqueid','Authorization','email','The\x20User\x20ID\x20is:','calleridname','The\x20Enduser\x20ID\x20is:','The\x20Ticket\x20ID\x20is:','Displaying\x20ticket\x20to\x20agent\x20in\x20a\x20new\x20tab...','user:%s','trigger:browser:url','catch','error','outbound','recordingFormat','none','[OUTBOUND]'];(function(_0x1cb18a,_0x33167a){var _0x22442e=function(_0x46c611){while(--_0x46c611){_0x1cb18a['push'](_0x1cb18a['shift']());}};_0x22442e(++_0x33167a);}(_0x32c3,0x184));var _0x332c=function(_0x14add3,_0x13ce8d){_0x14add3=_0x14add3-0x0;var _0x4a174f=_0x32c3[_0x14add3];return _0x4a174f;};'use strict';var _=require(_0x332c('0x0'));var rp=require(_0x332c('0x1'));var md5=require(_0x332c('0x2'));var util=require('util');var Redis=require(_0x332c('0x3'));var intUtil=require('./util');var config=require(_0x332c('0x4'));var logger=require(_0x332c('0x5'))(_0x332c('0x6'));config['redis']=_['defaults'](config['redis'],{'host':'localhost','port':0x18eb});var io=require(_0x332c('0x7'))(new Redis(config[_0x332c('0x8')]));var headers={'Content-Type':'application/json','Accept':_0x332c('0x9')};function emit(_0x3a4896,_0x1be362,_0x42da96){io['to'](_0x3a4896)[_0x332c('0xa')](_0x1be362,_0x42da96);}function getTicket(_0x2ad9d8,_0x2db1ba,_0x5d1de6,_0x54846d,_0x285fd0){logger[_0x332c('0xb')](_0x332c('0xc'));var _0x381c55=_[_0x332c('0xd')]({'responder_id':_0x2db1ba['id'],'requester_id':_0x5d1de6['id'],'name':util['format'](_0x332c('0xe'),_0x285fd0['calleridname']),'phone':_0x285fd0[_0x332c('0xf')],'source':0x3,'priority':0x1,'status':0x2,'subject':intUtil[_0x332c('0x10')](_0x54846d[_0x332c('0x11')],_0x285fd0,'\x20'),'description':intUtil[_0x332c('0x10')](_0x54846d[_0x332c('0x12')],_0x285fd0,_0x332c('0x13')),'tags':getTags(_0x54846d[_0x332c('0x14')],_0x332c('0x15'))},getCustomFields(_0x54846d['Fields'],_0x285fd0));_0x381c55['custom_fields']=_[_0x332c('0x16')](_[_0x332c('0x17')](_0x381c55[_0x332c('0x18')],'id'),_0x332c('0x19'));return request({'uri':util[_0x332c('0x1a')]('%s/api/v2/tickets',_0x2ad9d8[_0x332c('0x1b')]),'method':_0x332c('0x1c'),'body':_0x381c55})['then'](function(_0x280d6d){logger[_0x332c('0xb')](_0x332c('0x1d'));return _0x280d6d;});}function getUser(_0x1ef932,_0xa536be){if(intUtil[_0x332c('0x1e')](_0xa536be)){return request({'uri':util[_0x332c('0x1a')](_0x332c('0x1f'),_0x1ef932['remoteUri']),'qs':{'email':_0xa536be}})['then'](function(_0x38caef){if(_0x38caef['length']){logger['info'](_0x332c('0x20'));return _[_0x332c('0x21')](_0x38caef,function(_0x4aba4f){return _0x4aba4f[_0x332c('0x22')]['email']===_0xa536be;});}else{logger[_0x332c('0xb')](_0x332c('0x23'));return request({'uri':util[_0x332c('0x1a')](_0x332c('0x24'),_0x1ef932['remoteUri'])})['then'](function(_0xa977fd){logger[_0x332c('0xb')](_0x332c('0x25'));return _0xa977fd;});}});}else{logger[_0x332c('0xb')](_0x332c('0x26'));return request({'uri':util['format']('%s/api/v2/agents/me',_0x1ef932[_0x332c('0x1b')])})[_0x332c('0x27')](function(_0x2dd262){logger['info'](_0x332c('0x25'));return _0x2dd262;});}}function getEndUser(_0x416b35,_0x1012ba,_0x592c0a){logger[_0x332c('0xb')](_0x332c('0x28'),_0x592c0a);return request({'uri':util[_0x332c('0x1a')](_0x332c('0x29'),_0x416b35[_0x332c('0x1b')]),'qs':{'phone':_0x592c0a}})[_0x332c('0x27')](function(_0x5754dd){if(_0x5754dd[_0x332c('0x2a')]){logger[_0x332c('0xb')](_0x332c('0x2b'));return _[_0x332c('0x21')](_0x5754dd,{'phone':_0x592c0a});}else{logger[_0x332c('0xb')](_0x332c('0x2c'));return request({'uri':util[_0x332c('0x1a')](_0x332c('0x29'),_0x416b35[_0x332c('0x1b')]),'method':_0x332c('0x1c'),'body':{'name':_0x1012ba,'phone':_0x592c0a}})[_0x332c('0x27')](function(_0x2e834b){logger[_0x332c('0xb')](_0x332c('0x2d'));return _0x2e834b;});}});}function getAuth(_0x211f80){return util['format']('Basic\x20%s',new Buffer(_0x211f80[_0x332c('0x2e')]+':X')[_0x332c('0x2f')](_0x332c('0x30')));}function request(_0x155663){logger[_0x332c('0x31')](_0x332c('0x32'),JSON[_0x332c('0x33')](_0x155663));return rp(_['defaults'](_0x155663,{'method':_0x332c('0x34'),'headers':headers,'json':!![]}));}function getTags(_0x4294eb,_0x495289){var _0x1aafb0=[];if(_0x4294eb&&_0x4294eb['length']>0x0){_0x1aafb0=_[_0x332c('0x35')](_0x4294eb,_0x495289);}return _0x1aafb0;}function getCustomFields(_0x2ff348,_0x1c010c){var _0x221569=[];var _0x1fcb52={'custom_fields':[]};if(_0x2ff348[_0x332c('0x2a')]>0x0){_['forEach'](_0x2ff348,function(_0x36aa19){if(_[_0x332c('0x36')]([_0x332c('0x37'),_0x332c('0x38')],_0x36aa19['type'])&&_0x36aa19['nameField']&&!_0x36aa19[_0x332c('0x39')]){_0x1fcb52[_0x36aa19[_0x332c('0x3a')]['toLowerCase']()]=_0x36aa19[_0x332c('0x3b')][_0x332c('0x2f')]();}else if(_['includes']([_0x332c('0x37'),_0x332c('0x38')],_0x36aa19[_0x332c('0x3c')])&&_0x36aa19['idField']&&_0x36aa19[_0x332c('0x39')]){_0x1fcb52[_0x332c('0x18')][_0x332c('0x3d')]({'id':_0x36aa19[_0x332c('0x3e')],'value':_0x36aa19[_0x332c('0x3b')][_0x332c('0x2f')]()});}else if(_0x36aa19[_0x332c('0x3c')]===_0x332c('0x3f')&&_0x36aa19[_0x332c('0x40')]&&_0x36aa19[_0x332c('0x3e')]&&_0x36aa19[_0x332c('0x39')]){_0x1c010c[_0x36aa19['variableName']]&&_0x1fcb52[_0x332c('0x18')][_0x332c('0x3d')]({'id':_0x36aa19['idField'],'value':_0x1c010c[_0x36aa19[_0x332c('0x40')]][_0x332c('0x2f')]()});}else if(_0x36aa19['type']===_0x332c('0x41')&&_0x36aa19['Variable']&&_0x36aa19[_0x332c('0x42')][_0x332c('0x15')]&&_0x36aa19[_0x332c('0x3e')]&&_0x36aa19['customField']){_0x1c010c[_0x36aa19[_0x332c('0x42')][_0x332c('0x15')]['toLowerCase']()]&&_0x1fcb52[_0x332c('0x18')][_0x332c('0x3d')]({'id':_0x36aa19[_0x332c('0x3e')],'value':_0x1c010c[_0x36aa19['Variable']['name'][_0x332c('0x43')]()]['toString']()});}});}return _0x1fcb52;}exports[_0x332c('0x44')]=function(_0x53cdba,_0x3aba55,_0x3a7074,_0xbd238f,_0x3d019d,_0x4e45ec){var _0x1519f5,_0x23e739;_0x4e45ec[_0x332c('0x1b')]=intUtil[_0x332c('0x45')](_0x4e45ec[_0x332c('0x1b')]);_0x4e45ec['serverUrl']=intUtil[_0x332c('0x45')](_0x4e45ec[_0x332c('0x46')]);if(_0x3d019d&&_0x3d019d[_0x332c('0x47')]){logger[_0x332c('0xb')](_0x332c('0x48'),_0x332c('0x49'));_0x3aba55[_0x332c('0x4a')]=util[_0x332c('0x1a')](_0x332c('0x4b'),_0x4e45ec[_0x332c('0x46')],_0x3aba55[_0x332c('0x4c')],md5(_0x3aba55['uniqueid']));}else{_0x3aba55[_0x332c('0x4a')]='';}headers[_0x332c('0x4d')]=getAuth(_0x4e45ec);return getUser(_0x4e45ec,_0xbd238f[_0x332c('0x4e')])['then'](function(_0x44cef5){_0x1519f5=_0x44cef5;logger[_0x332c('0xb')](_0x332c('0x4f'),_0x1519f5['id']);return getEndUser(_0x4e45ec,_0x3aba55[_0x332c('0x50')],_0x3aba55[_0x332c('0xf')]);})[_0x332c('0x27')](function(_0x1136c1){_0x23e739=_0x1136c1;logger[_0x332c('0xb')](_0x332c('0x51'),_0x23e739['id']);return getTicket(_0x4e45ec,_0x1519f5,_0x23e739,_0x3a7074,_0x3aba55);})[_0x332c('0x27')](function(_0xec9b0c){if(_0xec9b0c&&_0xec9b0c['id']){logger[_0x332c('0xb')](_0x332c('0x1d'));logger[_0x332c('0xb')](_0x332c('0x52'),_0xec9b0c['id']);logger['info'](_0x332c('0x48'),_0x332c('0x53'));emit(util[_0x332c('0x1a')](_0x332c('0x54'),_0xbd238f[_0x332c('0x15')]),_0x332c('0x55'),{'uri':util[_0x332c('0x1a')]('%s/helpdesk/tickets/%d',_0x4e45ec['remoteUri'],_0xec9b0c['id'])});}})[_0x332c('0x56')](function(_0x2ec290){logger[_0x332c('0x57')](_0x332c('0x48'),JSON[_0x332c('0x33')](_0x2ec290));});};exports[_0x332c('0x58')]=function(_0x287602,_0x5894c0,_0x3e7815,_0x152bc4,_0x5cc99f,_0x2f5151,_0x5b5831){var _0xe5ad46,_0x188c72;_0x2f5151[_0x332c('0x1b')]=intUtil[_0x332c('0x45')](_0x2f5151[_0x332c('0x1b')]);_0x2f5151['serverUrl']=intUtil[_0x332c('0x45')](_0x2f5151[_0x332c('0x46')]);if(_0x5b5831&&_0x5b5831[_0x332c('0x59')]&&_0x5b5831['recordingFormat']!==_0x332c('0x5a')){logger[_0x332c('0xb')](_0x332c('0x5b'),_0x332c('0x49'));_0x5894c0['recordingURL']=util[_0x332c('0x1a')](_0x332c('0x4b'),_0x2f5151[_0x332c('0x46')],_0x5894c0[_0x332c('0x4c')],md5(_0x5894c0[_0x332c('0x4c')]));}headers[_0x332c('0x4d')]=getAuth(_0x2f5151);return getUser(_0x2f5151,_0x152bc4[_0x332c('0x4e')])[_0x332c('0x27')](function(_0x11686b){_0xe5ad46=_0x11686b;logger[_0x332c('0xb')](_0x332c('0x4f'),_0xe5ad46['id']);return getEndUser(_0x2f5151,_0x5894c0[_0x332c('0x5c')],_0x5894c0['destcalleridnum']);})[_0x332c('0x27')](function(_0x98af16){_0x188c72=_0x98af16;logger['info'](_0x332c('0x51'),_0x188c72['id']);return getTicket(_0x2f5151,_0xe5ad46,_0x188c72,_0x3e7815,_0x5894c0);})[_0x332c('0x27')](function(_0x687e2){if(_0x687e2&&_0x687e2['id']){logger[_0x332c('0xb')](_0x332c('0x1d'));logger[_0x332c('0xb')]('The\x20Ticket\x20ID\x20is:',_0x687e2['id']);logger['info']('[OUTBOUND]','Displaying\x20ticket\x20to\x20agent\x20in\x20a\x20new\x20tab...');emit(util[_0x332c('0x1a')](_0x332c('0x54'),_0x152bc4[_0x332c('0x15')]),_0x332c('0x55'),{'uri':util[_0x332c('0x1a')](_0x332c('0x5d'),_0x2f5151[_0x332c('0x1b')],_0x687e2['id'])});}})[_0x332c('0x56')](function(_0xbc6ddf){logger[_0x332c('0x57')](_0x332c('0x5b'),JSON[_0x332c('0x33')](_0xbc6ddf));});};exports['unmanaged']=function(_0x5b05c6,_0x8899f1,_0x509da6,_0x5aad05,_0x301141,_0x5835df){var _0x21077d,_0x29ed81;_0x5835df['remoteUri']=intUtil[_0x332c('0x45')](_0x5835df[_0x332c('0x1b')]);_0x5835df[_0x332c('0x46')]=intUtil[_0x332c('0x45')](_0x5835df[_0x332c('0x46')]);if(_0x301141&&_0x301141[_0x332c('0x47')]){logger[_0x332c('0xb')]('['+_0x8899f1[_0x332c('0x5e')][_0x332c('0x5f')]()+']',_0x332c('0x49'));_0x8899f1[_0x332c('0x4a')]=util[_0x332c('0x1a')](_0x332c('0x4b'),_0x5835df[_0x332c('0x46')],_0x8899f1['uniqueid'],md5(_0x8899f1['uniqueid']));}else{_0x8899f1[_0x332c('0x4a')]='';}headers['Authorization']=getAuth(_0x5835df);return getUser(_0x5835df,'')[_0x332c('0x27')](function(_0x36195f){_0x21077d=_0x36195f;logger[_0x332c('0xb')](_0x332c('0x4f'),_0x21077d['id']);return getEndUser(_0x5835df,_0x8899f1['calleridname'],_0x8899f1[_0x332c('0xf')]);})['then'](function(_0x2d3dbe){_0x29ed81=_0x2d3dbe;logger[_0x332c('0xb')](_0x332c('0x51'),_0x29ed81['id']);return getTicket(_0x5835df,_0x21077d,_0x29ed81,_0x509da6,_0x8899f1);})[_0x332c('0x27')](function(_0xfe9a99){if(_0xfe9a99){logger['info'](_0x332c('0x1d'));logger['info'](_0x332c('0x52'),_0xfe9a99['id']);}})[_0x332c('0x56')](function(_0x4f57ea){logger[_0x332c('0x57')]('['+_0x8899f1[_0x332c('0x5e')][_0x332c('0x5f')]()+']',JSON[_0x332c('0x33')](_0x4f57ea));});}; \ No newline at end of file +var _0x6d64=['recordingURL','Authorization','The\x20User\x20ID\x20is:','calleridname','calleridnum','Ticket\x20created!','The\x20Ticket\x20ID\x20is:','[QUEUE]','Displaying\x20ticket\x20to\x20agent\x20in\x20a\x20new\x20tab...','catch','error','recordingFormat','destcalleridname','destcalleridnum','[OUTBOUND]','user:%s','trigger:browser:url','unmanaged','lastevent','toUpperCase','The\x20Enduser\x20ID\x20is:','request-promise','util','ioredis','./util','../../../../config/environment','freshdesk','redis','localhost','application/json','Creating\x20new\x20ticket...','merge','format','Caller\x20-\x20%s','getString','Descriptions','
','Tags','name','Fields','custom_fields','keyBy','remoteUri','POST','then','validateEmail','%s/api/v2/agents','length','info','Agent\x20found!','find','email','Agent\x20not\x20found,\x20using\x20the\x20admin\x20account!','%s/api/v2/agents/me','Admin\x20account\x20selected.','Searching\x20enduser\x20with\x20phone','%s/api/v2/contacts','Enduser\x20not\x20found,\x20creating\x20a\x20new\x20enduser!','Enduser\x20created.','apiKey','base64','debug','[HTTP]','stringify','defaults','map','picklist','nameField','customField','content','toString','string','type','idField','variable','variableName','push','customVariable','Variable','toLowerCase','queue','serverUrl','stripTrailingSlash','monitor_format','Recording\x20is\x20enabled!','%s/api/voice/recordings/%s/downloads?type=uniqueid&token=%s','uniqueid'];(function(_0x40099f,_0x3c8c85){var _0x821f1e=function(_0x313660){while(--_0x313660){_0x40099f['push'](_0x40099f['shift']());}};_0x821f1e(++_0x3c8c85);}(_0x6d64,0x11a));var _0x46d6=function(_0x46cd32,_0x3d16c8){_0x46cd32=_0x46cd32-0x0;var _0x5ac0f8=_0x6d64[_0x46cd32];return _0x5ac0f8;};'use strict';var _=require('lodash');var rp=require(_0x46d6('0x0'));var md5=require('md5');var util=require(_0x46d6('0x1'));var Redis=require(_0x46d6('0x2'));var intUtil=require(_0x46d6('0x3'));var config=require(_0x46d6('0x4'));var logger=require('../../../../config/logger')(_0x46d6('0x5'));config[_0x46d6('0x6')]=_['defaults'](config['redis'],{'host':_0x46d6('0x7'),'port':0x18eb});var io=require('socket.io-emitter')(new Redis(config[_0x46d6('0x6')]));var headers={'Content-Type':_0x46d6('0x8'),'Accept':_0x46d6('0x8')};function emit(_0x568984,_0x8ffbe4,_0x2a2e57){io['to'](_0x568984)['emit'](_0x8ffbe4,_0x2a2e57);}function getTicket(_0x56d11f,_0x3b7ff8,_0x4de53d,_0x515687,_0x24ce36){logger['info'](_0x46d6('0x9'));var _0x1e4d67=_[_0x46d6('0xa')]({'responder_id':_0x3b7ff8['id'],'requester_id':_0x4de53d['id'],'name':util[_0x46d6('0xb')](_0x46d6('0xc'),_0x24ce36['calleridname']),'phone':_0x24ce36['calleridnum'],'source':0x3,'priority':0x1,'status':0x2,'subject':intUtil[_0x46d6('0xd')](_0x515687['Subjects'],_0x24ce36,'\x20'),'description':intUtil[_0x46d6('0xd')](_0x515687[_0x46d6('0xe')],_0x24ce36,_0x46d6('0xf')),'tags':getTags(_0x515687[_0x46d6('0x10')],_0x46d6('0x11'))},getCustomFields(_0x515687[_0x46d6('0x12')],_0x24ce36));_0x1e4d67[_0x46d6('0x13')]=_['mapValues'](_[_0x46d6('0x14')](_0x1e4d67[_0x46d6('0x13')],'id'),'value');return request({'uri':util[_0x46d6('0xb')]('%s/api/v2/tickets',_0x56d11f[_0x46d6('0x15')]),'method':_0x46d6('0x16'),'body':_0x1e4d67})[_0x46d6('0x17')](function(_0x174d1a){logger['info']('Ticket\x20created!');return _0x174d1a;});}function getUser(_0x34d9ee,_0x14d6a9){if(intUtil[_0x46d6('0x18')](_0x14d6a9)){return request({'uri':util[_0x46d6('0xb')](_0x46d6('0x19'),_0x34d9ee['remoteUri']),'qs':{'email':_0x14d6a9}})[_0x46d6('0x17')](function(_0x553ee3){if(_0x553ee3[_0x46d6('0x1a')]){logger[_0x46d6('0x1b')](_0x46d6('0x1c'));return _[_0x46d6('0x1d')](_0x553ee3,function(_0x58fd32){return _0x58fd32['contact'][_0x46d6('0x1e')]===_0x14d6a9;});}else{logger['info'](_0x46d6('0x1f'));return request({'uri':util[_0x46d6('0xb')](_0x46d6('0x20'),_0x34d9ee['remoteUri'])})[_0x46d6('0x17')](function(_0x2ab126){logger[_0x46d6('0x1b')](_0x46d6('0x21'));return _0x2ab126;});}});}else{logger[_0x46d6('0x1b')]('Invalid\x20email\x20format,\x20using\x20the\x20admin\x20account!');return request({'uri':util[_0x46d6('0xb')](_0x46d6('0x20'),_0x34d9ee[_0x46d6('0x15')])})[_0x46d6('0x17')](function(_0x21c306){logger['info'](_0x46d6('0x21'));return _0x21c306;});}}function getEndUser(_0x21f317,_0x230717,_0x1394e7){logger[_0x46d6('0x1b')](_0x46d6('0x22'),_0x1394e7);return request({'uri':util['format'](_0x46d6('0x23'),_0x21f317['remoteUri']),'qs':{'phone':_0x1394e7}})[_0x46d6('0x17')](function(_0x8c3eba){if(_0x8c3eba[_0x46d6('0x1a')]){logger[_0x46d6('0x1b')]('Enduser\x20found!');return _['find'](_0x8c3eba,{'phone':_0x1394e7});}else{logger[_0x46d6('0x1b')](_0x46d6('0x24'));return request({'uri':util[_0x46d6('0xb')]('%s/api/v2/contacts',_0x21f317['remoteUri']),'method':'POST','body':{'name':_0x230717,'phone':_0x1394e7}})[_0x46d6('0x17')](function(_0x2c339a){logger[_0x46d6('0x1b')](_0x46d6('0x25'));return _0x2c339a;});}});}function getAuth(_0x59258b){return util[_0x46d6('0xb')]('Basic\x20%s',new Buffer(_0x59258b[_0x46d6('0x26')]+':X')['toString'](_0x46d6('0x27')));}function request(_0x20b9c8){logger[_0x46d6('0x28')](_0x46d6('0x29'),JSON[_0x46d6('0x2a')](_0x20b9c8));return rp(_[_0x46d6('0x2b')](_0x20b9c8,{'method':'GET','headers':headers,'json':!![]}));}function getTags(_0x189c3d,_0x52f864){var _0x34ff61=[];if(_0x189c3d&&_0x189c3d[_0x46d6('0x1a')]>0x0){_0x34ff61=_[_0x46d6('0x2c')](_0x189c3d,_0x52f864);}return _0x34ff61;}function getCustomFields(_0x3635fa,_0x320bec){var _0x569c25=[];var _0x23f91d={'custom_fields':[]};if(_0x3635fa['length']>0x0){_['forEach'](_0x3635fa,function(_0x4f467c){if(_['includes'](['string',_0x46d6('0x2d')],_0x4f467c['type'])&&_0x4f467c[_0x46d6('0x2e')]&&!_0x4f467c[_0x46d6('0x2f')]){_0x23f91d[_0x4f467c['nameField']['toLowerCase']()]=_0x4f467c[_0x46d6('0x30')][_0x46d6('0x31')]();}else if(_['includes']([_0x46d6('0x32'),_0x46d6('0x2d')],_0x4f467c[_0x46d6('0x33')])&&_0x4f467c[_0x46d6('0x34')]&&_0x4f467c[_0x46d6('0x2f')]){_0x23f91d['custom_fields']['push']({'id':_0x4f467c[_0x46d6('0x34')],'value':_0x4f467c[_0x46d6('0x30')][_0x46d6('0x31')]()});}else if(_0x4f467c[_0x46d6('0x33')]===_0x46d6('0x35')&&_0x4f467c[_0x46d6('0x36')]&&_0x4f467c[_0x46d6('0x34')]&&_0x4f467c['customField']){_0x320bec[_0x4f467c[_0x46d6('0x36')]]&&_0x23f91d[_0x46d6('0x13')][_0x46d6('0x37')]({'id':_0x4f467c['idField'],'value':_0x320bec[_0x4f467c['variableName']]['toString']()});}else if(_0x4f467c[_0x46d6('0x33')]===_0x46d6('0x38')&&_0x4f467c[_0x46d6('0x39')]&&_0x4f467c[_0x46d6('0x39')]['name']&&_0x4f467c[_0x46d6('0x34')]&&_0x4f467c[_0x46d6('0x2f')]){_0x320bec[_0x4f467c['Variable'][_0x46d6('0x11')][_0x46d6('0x3a')]()]&&_0x23f91d['custom_fields']['push']({'id':_0x4f467c[_0x46d6('0x34')],'value':_0x320bec[_0x4f467c[_0x46d6('0x39')][_0x46d6('0x11')][_0x46d6('0x3a')]()][_0x46d6('0x31')]()});}});}return _0x23f91d;}exports[_0x46d6('0x3b')]=function(_0x3fc039,_0x4031f3,_0xcdb7a0,_0x5b2698,_0x1d84e6,_0x61725d){var _0x49710f,_0x48b329;_0x61725d[_0x46d6('0x15')]=intUtil['stripTrailingSlash'](_0x61725d['remoteUri']);_0x61725d[_0x46d6('0x3c')]=intUtil[_0x46d6('0x3d')](_0x61725d['serverUrl']);if(_0x1d84e6&&_0x1d84e6[_0x46d6('0x3e')]){logger[_0x46d6('0x1b')]('[QUEUE]',_0x46d6('0x3f'));_0x4031f3['recordingURL']=util[_0x46d6('0xb')](_0x46d6('0x40'),_0x61725d[_0x46d6('0x3c')],_0x4031f3[_0x46d6('0x41')],md5(_0x4031f3['uniqueid']));}else{_0x4031f3[_0x46d6('0x42')]='';}headers[_0x46d6('0x43')]=getAuth(_0x61725d);return getUser(_0x61725d,_0x5b2698[_0x46d6('0x1e')])[_0x46d6('0x17')](function(_0x4bca3c){_0x49710f=_0x4bca3c;logger[_0x46d6('0x1b')](_0x46d6('0x44'),_0x49710f['id']);return getEndUser(_0x61725d,_0x4031f3[_0x46d6('0x45')],_0x4031f3[_0x46d6('0x46')]);})[_0x46d6('0x17')](function(_0x39fe7a){_0x48b329=_0x39fe7a;logger['info']('The\x20Enduser\x20ID\x20is:',_0x48b329['id']);return getTicket(_0x61725d,_0x49710f,_0x48b329,_0xcdb7a0,_0x4031f3);})[_0x46d6('0x17')](function(_0x206fee){if(_0x206fee&&_0x206fee['id']){logger['info'](_0x46d6('0x47'));logger[_0x46d6('0x1b')](_0x46d6('0x48'),_0x206fee['id']);logger[_0x46d6('0x1b')](_0x46d6('0x49'),_0x46d6('0x4a'));emit(util[_0x46d6('0xb')]('user:%s',_0x5b2698['name']),'trigger:browser:url',{'uri':util[_0x46d6('0xb')]('%s/helpdesk/tickets/%d',_0x61725d[_0x46d6('0x15')],_0x206fee['id'])});}})[_0x46d6('0x4b')](function(_0x3453ba){logger[_0x46d6('0x4c')]('[QUEUE]',JSON['stringify'](_0x3453ba));});};exports['outbound']=function(_0x3481b3,_0x4bab9b,_0x1c32e3,_0x14c90e,_0x395227,_0x1bc995,_0x1e4c6b){var _0x46bf26,_0x531597;_0x1bc995[_0x46d6('0x15')]=intUtil[_0x46d6('0x3d')](_0x1bc995[_0x46d6('0x15')]);_0x1bc995['serverUrl']=intUtil['stripTrailingSlash'](_0x1bc995[_0x46d6('0x3c')]);if(_0x1e4c6b&&_0x1e4c6b[_0x46d6('0x4d')]&&_0x1e4c6b[_0x46d6('0x4d')]!=='none'){logger[_0x46d6('0x1b')]('[OUTBOUND]',_0x46d6('0x3f'));_0x4bab9b[_0x46d6('0x42')]=util[_0x46d6('0xb')](_0x46d6('0x40'),_0x1bc995[_0x46d6('0x3c')],_0x4bab9b[_0x46d6('0x41')],md5(_0x4bab9b[_0x46d6('0x41')]));}headers['Authorization']=getAuth(_0x1bc995);return getUser(_0x1bc995,_0x14c90e[_0x46d6('0x1e')])[_0x46d6('0x17')](function(_0x1c5d33){_0x46bf26=_0x1c5d33;logger['info']('The\x20User\x20ID\x20is:',_0x46bf26['id']);return getEndUser(_0x1bc995,_0x4bab9b[_0x46d6('0x4e')],_0x4bab9b[_0x46d6('0x4f')]);})[_0x46d6('0x17')](function(_0x3cd1a9){_0x531597=_0x3cd1a9;logger[_0x46d6('0x1b')]('The\x20Enduser\x20ID\x20is:',_0x531597['id']);return getTicket(_0x1bc995,_0x46bf26,_0x531597,_0x1c32e3,_0x4bab9b);})[_0x46d6('0x17')](function(_0x29ccd6){if(_0x29ccd6&&_0x29ccd6['id']){logger[_0x46d6('0x1b')](_0x46d6('0x47'));logger[_0x46d6('0x1b')](_0x46d6('0x48'),_0x29ccd6['id']);logger['info'](_0x46d6('0x50'),_0x46d6('0x4a'));emit(util[_0x46d6('0xb')](_0x46d6('0x51'),_0x14c90e[_0x46d6('0x11')]),_0x46d6('0x52'),{'uri':util[_0x46d6('0xb')]('%s/helpdesk/tickets/%d',_0x1bc995['remoteUri'],_0x29ccd6['id'])});}})[_0x46d6('0x4b')](function(_0x4dd5d1){logger[_0x46d6('0x4c')]('[OUTBOUND]',JSON[_0x46d6('0x2a')](_0x4dd5d1));});};exports[_0x46d6('0x53')]=function(_0x5d7a0e,_0x3461eb,_0xec0fc5,_0x45c310,_0x2ede63,_0x19723d){var _0x29a0b3,_0x3ac656;_0x19723d['remoteUri']=intUtil[_0x46d6('0x3d')](_0x19723d[_0x46d6('0x15')]);_0x19723d[_0x46d6('0x3c')]=intUtil['stripTrailingSlash'](_0x19723d[_0x46d6('0x3c')]);if(_0x2ede63&&_0x2ede63['monitor_format']){logger['info']('['+_0x3461eb[_0x46d6('0x54')][_0x46d6('0x55')]()+']','Recording\x20is\x20enabled!');_0x3461eb['recordingURL']=util['format'](_0x46d6('0x40'),_0x19723d[_0x46d6('0x3c')],_0x3461eb[_0x46d6('0x41')],md5(_0x3461eb['uniqueid']));}else{_0x3461eb[_0x46d6('0x42')]='';}headers[_0x46d6('0x43')]=getAuth(_0x19723d);return getUser(_0x19723d,'')[_0x46d6('0x17')](function(_0x4733d6){_0x29a0b3=_0x4733d6;logger['info'](_0x46d6('0x44'),_0x29a0b3['id']);return getEndUser(_0x19723d,_0x3461eb['calleridname'],_0x3461eb[_0x46d6('0x46')]);})[_0x46d6('0x17')](function(_0x22807b){_0x3ac656=_0x22807b;logger[_0x46d6('0x1b')](_0x46d6('0x56'),_0x3ac656['id']);return getTicket(_0x19723d,_0x29a0b3,_0x3ac656,_0xec0fc5,_0x3461eb);})[_0x46d6('0x17')](function(_0x5aaa75){if(_0x5aaa75){logger['info'](_0x46d6('0x47'));logger[_0x46d6('0x1b')](_0x46d6('0x48'),_0x5aaa75['id']);}})[_0x46d6('0x4b')](function(_0x41a5ce){logger[_0x46d6('0x4c')]('['+_0x3461eb[_0x46d6('0x54')][_0x46d6('0x55')]()+']',JSON[_0x46d6('0x2a')](_0x41a5ce));});}; \ 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 98bb537..445a165 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 _0xdbd7=['message','/api/lookup?q=','&f=','&entities=contact','contacts','format','Searching\x20contact\x20with\x20phone\x20%s','mobile_number','contactNumber','endUserId','Contact\x20found\x20mobile_number:','work_number','Contact\x20found\x20work_number:','Contact\x20created:','POST','headers','contact','Creating\x20new\x20task','Subjects','getString','Descriptions','Contact','YYYY-MM-DDTHH:mm:ss','ticketId','task','Task\x20created:','/contacts/','emit','trigger:browser:url','Token\x20token=','apiKey','remoteUri','stripTrailingSlash','serverUrl','username','toLowerCase','outbound','calleridnum','queue','email','uniqueid','monitor_format','recordingURL','recordingFormat','[OUTBOUND]','The\x20ticket\x20ID\x20is:\x20%s','unmanaged','request-promise','md5','util','moment','bluebird','ioredis','./util','../../../../config/environment','../../../../config/logger','freshsales','redis','defaults','localhost','socket.io-emitter','GET','/api/selector/owners','Getting\x20admin\x20information','then','users','length','adminEmail','adminId','info','Admin\x20found:','Requested\x20Resource\x20not\x20Found','catch','error','toUpperCase','Getting\x20user\x20list','agentEmail','Getting\x20user\x20with\x20email','userEmail','userId','User\x20found:','Admin\x20selected'];(function(_0x774b11,_0x13d9a1){var _0x4e8263=function(_0x4ac81a){while(--_0x4ac81a){_0x774b11['push'](_0x774b11['shift']());}};_0x4e8263(++_0x13d9a1);}(_0xdbd7,0x1c9));var _0x7dbd=function(_0x2a275e,_0x5aa79b){_0x2a275e=_0x2a275e-0x0;var _0x2287fe=_0xdbd7[_0x2a275e];return _0x2287fe;};'use strict';var _=require('lodash');var rp=require(_0x7dbd('0x0'));var md5=require(_0x7dbd('0x1'));var util=require(_0x7dbd('0x2'));var moment=require(_0x7dbd('0x3'));var Promise=require(_0x7dbd('0x4'));var Redis=require(_0x7dbd('0x5'));var intUtil=require(_0x7dbd('0x6'));var config=require(_0x7dbd('0x7'));var logger=require(_0x7dbd('0x8'))(_0x7dbd('0x9'));config[_0x7dbd('0xa')]=_[_0x7dbd('0xb')](config[_0x7dbd('0xa')],{'host':_0x7dbd('0xc'),'port':0x18eb});var io=require(_0x7dbd('0xd'))(new Redis(config['redis']));function getAdminId(_0xf42059,_0x9f4d5b,_0x16fba0,_0x3946ce){return new Promise(function(_0x11e55c,_0x1e97b1){var _0x44528f=![];var _0x15da35={'method':_0x7dbd('0xe'),'uri':_0x3946ce+_0x7dbd('0xf'),'json':!![]};_0x15da35['headers']=_0x16fba0;logger['info'](_0x7dbd('0x10'));return rp(_0x15da35)[_0x7dbd('0x11')](function(_0x50064d){if(_0x50064d){var _0x25c40f=_0x50064d[_0x7dbd('0x12')];var _0x263f1f=null;for(_0x263f1f=0x0;_0x263f1f<_0x25c40f[_0x7dbd('0x13')];_0x263f1f++){if(_0x25c40f[_0x263f1f]['email']===_0xf42059[_0x7dbd('0x14')]){_0xf42059[_0x7dbd('0x15')]=_0x25c40f[_0x263f1f]['id'];_0x44528f=!![];}}if(_0x44528f){logger[_0x7dbd('0x16')](_0x7dbd('0x17'),_0xf42059['adminId']);_0x11e55c(_0xf42059);}else{_0x1e97b1({'statusCode':0x194,'message':_0x7dbd('0x18')});}}else{_0x1e97b1({'statusCode':0x194,'message':_0x7dbd('0x18')});}})[_0x7dbd('0x19')](function(_0x2c71c0){logger[_0x7dbd('0x1a')]('['+[_0x9f4d5b[_0x7dbd('0x1b')]()]+']',_0x2c71c0['message']);_0x1e97b1(_0x2c71c0);});});}function getUser(_0x13d3c1,_0x62cb29,_0x284224){return function(_0x42cb7d){return new Promise(function(_0x3dce14,_0x4bddb2){var _0x3a8a4f={'method':_0x7dbd('0xe'),'uri':_0x284224+_0x7dbd('0xf'),'json':!![]};_0x3a8a4f['headers']=_0x62cb29;logger[_0x7dbd('0x16')](_0x7dbd('0x1c'));return rp(_0x3a8a4f)['then'](function(_0xd1f14c){if(_0xd1f14c){var _0x5d277f=_0xd1f14c[_0x7dbd('0x12')];var _0x40cb92=![];var _0x4bd732=null;if(_0x42cb7d[_0x7dbd('0x1d')]!==null){logger[_0x7dbd('0x16')](_0x7dbd('0x1e'),_0x42cb7d[_0x7dbd('0x1d')]);_0x42cb7d[_0x7dbd('0x1f')]=_0x42cb7d[_0x7dbd('0x1d')];for(_0x4bd732=0x0;_0x4bd732<_0x5d277f['length'];_0x4bd732++){if(_0x5d277f[_0x4bd732]['email']===_0x42cb7d[_0x7dbd('0x1d')]){_0x40cb92=!![];_0x42cb7d[_0x7dbd('0x20')]=_0x5d277f[_0x4bd732]['id'];logger[_0x7dbd('0x16')](_0x7dbd('0x21'),_0x42cb7d[_0x7dbd('0x20')]);}}}if(!_0x40cb92){logger[_0x7dbd('0x16')](_0x7dbd('0x22'));_0x42cb7d[_0x7dbd('0x1f')]=_0x42cb7d[_0x7dbd('0x14')];_0x42cb7d['userId']=_0x42cb7d[_0x7dbd('0x15')];_0x40cb92=!![];}if(_0x40cb92){_0x3dce14(_0x42cb7d);}else{_0x4bddb2({'statusCode':0x194,'message':'Requested\x20Resource\x20not\x20Found'});}}else{_0x4bddb2({'statusCode':0x194,'message':_0x7dbd('0x18')});}})[_0x7dbd('0x19')](function(_0x5c224e){logger[_0x7dbd('0x1a')]('['+[_0x13d3c1[_0x7dbd('0x1b')]()]+']',_0x5c224e[_0x7dbd('0x23')]);_0x4bddb2(_0x5c224e);});});};}function searchContact(_0x47ad15,_0x15ad65,_0x1b17a3,_0x98e29f){return new Promise(function(_0x12ad43,_0x51abab){var _0x4d7063={'method':_0x7dbd('0xe'),'headers':_0x15ad65,'uri':_0x47ad15+_0x7dbd('0x24')+_0x98e29f+_0x7dbd('0x25')+_0x1b17a3+_0x7dbd('0x26'),'json':!![]};rp(_0x4d7063)[_0x7dbd('0x11')](function(_0x495af6){var _0x3b6a79=_['find'](_0x495af6[_0x7dbd('0x27')][_0x7dbd('0x27')],[_0x1b17a3,_0x98e29f]);_0x12ad43(_0x3b6a79);})[_0x7dbd('0x19')](function(_0x206e57){_0x51abab(_0x206e57);});});}function getEndUser(_0x5c5f31,_0x2abf14,_0x5a9bbf){return function(_0x2f502f){return new Promise(function(_0x132944,_0x146db6){logger[_0x7dbd('0x16')](util[_0x7dbd('0x28')](_0x7dbd('0x29'),_0x2f502f['contactNumber']));searchContact(_0x5a9bbf,_0x2abf14,_0x7dbd('0x2a'),_0x2f502f[_0x7dbd('0x2b')])[_0x7dbd('0x11')](function(_0x4202b0){if(_0x4202b0){_0x2f502f[_0x7dbd('0x2c')]=_0x4202b0['id'];logger[_0x7dbd('0x16')](_0x7dbd('0x2d'),_0x2f502f[_0x7dbd('0x2c')]);return _0x132944(_0x2f502f);}searchContact(_0x5a9bbf,_0x2abf14,_0x7dbd('0x2e'),_0x2f502f[_0x7dbd('0x2b')])['then'](function(_0x219cbb){if(_0x219cbb){_0x2f502f['endUserId']=_0x219cbb['id'];logger['info'](_0x7dbd('0x2f'),_0x2f502f[_0x7dbd('0x2c')]);return _0x132944(_0x2f502f);}createEndUser(_0x2f502f,_0x5c5f31,_0x2abf14,_0x5a9bbf)['then'](function(_0x1f5e91){logger[_0x7dbd('0x16')](_0x7dbd('0x30'),_0x1f5e91[_0x7dbd('0x2c')]);return _0x132944(_0x1f5e91);});});})[_0x7dbd('0x19')](function(_0x81b5f5){_0x146db6(_0x81b5f5);});});};}function createEndUser(_0x584607,_0x336796,_0x1e783c,_0x2821e0){return new Promise(function(_0x4f653f,_0x58e0b9){var _0x4f454f=moment();var _0x18db44={'method':_0x7dbd('0x31'),'uri':_0x2821e0+'/api/contacts','body':{'contact':{'last_name':_0x584607[_0x7dbd('0x2b')],'work_number':_0x584607[_0x7dbd('0x2b')],'mobile_number':_0x584607[_0x7dbd('0x2b')],'owner_id':_0x584607[_0x7dbd('0x20')],'created_at':_0x4f454f[_0x7dbd('0x28')]('YYYY-MM-DDTHH:mm:ss')}},'json':!![]};_0x18db44[_0x7dbd('0x32')]=_0x1e783c;logger[_0x7dbd('0x16')]('Contact\x20not\x20found,\x20creating\x20a\x20new\x20contact');return rp(_0x18db44)[_0x7dbd('0x11')](function(_0x57c5bd){_0x584607[_0x7dbd('0x2c')]=_0x57c5bd[_0x7dbd('0x33')]['id'];_0x4f653f(_0x584607);})[_0x7dbd('0x19')](function(_0x485699){logger[_0x7dbd('0x1a')]('['+[_0x336796[_0x7dbd('0x1b')]()]+']',_0x485699[_0x7dbd('0x23')]);_0x58e0b9(_0x485699[_0x7dbd('0x23')]);});});}function getTicket(_0xc2f285,_0x4b4d39,_0x1ebd35,_0x5ddc8d,_0x3bd119){return function(_0x3e586c){logger[_0x7dbd('0x16')](_0x7dbd('0x34'));return new Promise(function(_0x4cccea,_0x356661){var _0x1001b0=moment();var _0x2161ad={'method':_0x7dbd('0x31'),'uri':_0x1ebd35+'/api/tasks','body':{'title':intUtil['getString'](_0x5ddc8d[_0x7dbd('0x35')],_0x3bd119,'\x20'),'description':intUtil[_0x7dbd('0x36')](_0x5ddc8d[_0x7dbd('0x37')],_0x3bd119,'\x0a'),'owner_id':_0x3e586c['userId'],'creater_id':_0x3e586c[_0x7dbd('0x15')],'targetable_id':_0x3e586c[_0x7dbd('0x2c')],'targetable_type':_0x7dbd('0x38'),'created_at':_0x1001b0[_0x7dbd('0x28')](_0x7dbd('0x39')),'due_date':_0x1001b0['add'](0x1e,'m')[_0x7dbd('0x28')](_0x7dbd('0x39'))},'json':!![]};_0x2161ad['headers']=_0x4b4d39;return rp(_0x2161ad)[_0x7dbd('0x11')](function(_0x614059){_0x3e586c[_0x7dbd('0x3a')]=_0x614059[_0x7dbd('0x3b')]['id'];logger['info'](_0x7dbd('0x3c'),_0x3e586c[_0x7dbd('0x3a')]);_0x4cccea(_0x3e586c);})[_0x7dbd('0x19')](function(_0x9af5b7){logger['error']('['+[_0xc2f285['toUpperCase']()]+']',_0x9af5b7[_0x7dbd('0x23')]);_0x356661(_0x9af5b7[_0x7dbd('0x23')]);});});};}function emit(_0x2e3f3b,_0x497feb,_0x1d25c6){var _0x55244e={'uri':_0x2e3f3b+_0x7dbd('0x3d')+_0x1d25c6};io['to'](util['format']('user:%s',_0x497feb))[_0x7dbd('0x3e')](_0x7dbd('0x3f'),_0x55244e);}exports['cs']=function(_0x1ea908,_0x31f446,_0x2d880a,_0x56b743,_0x210126,_0x4d9b07,_0x399e0a,_0x4838a0){var _0x44bdcd={};var _0x626f64={'Authorization':_0x7dbd('0x40')+_0x4d9b07[_0x7dbd('0x41')]};_0x4d9b07[_0x7dbd('0x42')]=intUtil[_0x7dbd('0x43')](_0x4d9b07[_0x7dbd('0x42')]);_0x4d9b07[_0x7dbd('0x44')]=intUtil[_0x7dbd('0x43')](_0x4d9b07[_0x7dbd('0x44')]);var _0x2fc894=_0x4d9b07['remoteUri'];_0x44bdcd['adminEmail']=_0x4d9b07[_0x7dbd('0x45')];_0x44bdcd[_0x7dbd('0x2b')]=_0x4838a0[_0x7dbd('0x46')]()===_0x7dbd('0x47')?_0x31f446['destcalleridnum']:_0x31f446[_0x7dbd('0x48')];_0x44bdcd['callDirection']=_0x4838a0===_0x7dbd('0x49')||_0x4838a0==='unmanaged'?'queue':_0x7dbd('0x47');if(_0x56b743){_0x44bdcd[_0x7dbd('0x1d')]=_0x56b743[_0x7dbd('0x4a')];}var _0x47f68d=util[_0x7dbd('0x28')]('%s/api/voice/recordings/%s/downloads?type=uniqueid&token=%s',_0x4d9b07[_0x7dbd('0x44')],_0x31f446[_0x7dbd('0x4b')],md5(_0x31f446[_0x7dbd('0x4b')]));if(_0x210126&&_0x210126[_0x7dbd('0x4c')]){logger[_0x7dbd('0x16')]('[QUEUE]','Recording\x20is\x20enabled!');_0x31f446[_0x7dbd('0x4d')]=_0x47f68d;}else if(_0x399e0a&&_0x399e0a[_0x7dbd('0x4e')]&&_0x399e0a[_0x7dbd('0x4e')]!=='none'){logger[_0x7dbd('0x16')](_0x7dbd('0x4f'),'Recording\x20is\x20enabled!');_0x31f446[_0x7dbd('0x4d')]=_0x47f68d;}else{_0x31f446['recordingURL']='';}return getAdminId(_0x44bdcd,_0x4838a0,_0x626f64,_0x2fc894)[_0x7dbd('0x11')](getUser(_0x4838a0,_0x626f64,_0x2fc894))[_0x7dbd('0x11')](getEndUser(_0x4838a0,_0x626f64,_0x2fc894))['then'](getTicket(_0x4838a0,_0x626f64,_0x2fc894,_0x2d880a,_0x31f446))[_0x7dbd('0x11')](function(_0xbe361){logger[_0x7dbd('0x16')](util['format'](_0x7dbd('0x50'),_0xbe361[_0x7dbd('0x3a')]));if(_0x4838a0!==_0x7dbd('0x51')){logger[_0x7dbd('0x16')]('['+[_0x4838a0[_0x7dbd('0x1b')]()]+']','Displaying\x20task\x20in\x20a\x20new\x20tab...');emit(_0x2fc894,_0x56b743['name'],_0xbe361['endUserId']);}})[_0x7dbd('0x19')](function(_0xc2e5ef){logger[_0x7dbd('0x1a')]('['+[_0x4838a0[_0x7dbd('0x1b')]()]+']\x20Error\x20running\x20Freshsales\x20integration',util['inspect'](_0xc2e5ef,{'showHidden':!![],'depth':null}));});}; \ No newline at end of file +var _0x9872=['serverUrl','toLowerCase','destcalleridnum','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','ioredis','./util','../../../../config/environment','../../../../config/logger','freshsales','redis','defaults','localhost','GET','/api/selector/owners','headers','Getting\x20admin\x20information','users','length','email','adminEmail','adminId','Requested\x20Resource\x20not\x20Found','catch','error','message','info','Getting\x20user\x20list','then','Getting\x20user\x20with\x20email','userEmail','agentEmail','User\x20found:','Admin\x20selected','/api/lookup?q=','&f=','&entities=contact','find','contacts','format','Searching\x20contact\x20with\x20phone\x20%s','mobile_number','endUserId','work_number','contactNumber','Contact\x20found\x20work_number:','Contact\x20created:','userId','YYYY-MM-DDTHH:mm:ss','Contact\x20not\x20found,\x20creating\x20a\x20new\x20contact','toUpperCase','Creating\x20new\x20task','getString','Subjects','Descriptions','add','task','Task\x20created:','ticketId','/contacts/','user:%s','emit','trigger:browser:url','Token\x20token=','apiKey','remoteUri','stripTrailingSlash'];(function(_0x41c381,_0x1176bd){var _0x427981=function(_0x508843){while(--_0x508843){_0x41c381['push'](_0x41c381['shift']());}};_0x427981(++_0x1176bd);}(_0x9872,0xbc));var _0x2987=function(_0x2def40,_0x4c598d){_0x2def40=_0x2def40-0x0;var _0x4ab7d7=_0x9872[_0x2def40];return _0x4ab7d7;};'use strict';var _=require('lodash');var rp=require('request-promise');var md5=require(_0x2987('0x0'));var util=require(_0x2987('0x1'));var moment=require('moment');var Promise=require('bluebird');var Redis=require(_0x2987('0x2'));var intUtil=require(_0x2987('0x3'));var config=require(_0x2987('0x4'));var logger=require(_0x2987('0x5'))(_0x2987('0x6'));config[_0x2987('0x7')]=_[_0x2987('0x8')](config['redis'],{'host':_0x2987('0x9'),'port':0x18eb});var io=require('socket.io-emitter')(new Redis(config[_0x2987('0x7')]));function getAdminId(_0x2f95ed,_0x11b8c0,_0x457313,_0x360482){return new Promise(function(_0x3771b2,_0x4bd8e6){var _0x54778e=![];var _0x4058ce={'method':_0x2987('0xa'),'uri':_0x360482+_0x2987('0xb'),'json':!![]};_0x4058ce[_0x2987('0xc')]=_0x457313;logger['info'](_0x2987('0xd'));return rp(_0x4058ce)['then'](function(_0x2eae87){if(_0x2eae87){var _0x29c7da=_0x2eae87[_0x2987('0xe')];var _0x270e2c=null;for(_0x270e2c=0x0;_0x270e2c<_0x29c7da[_0x2987('0xf')];_0x270e2c++){if(_0x29c7da[_0x270e2c][_0x2987('0x10')]===_0x2f95ed[_0x2987('0x11')]){_0x2f95ed[_0x2987('0x12')]=_0x29c7da[_0x270e2c]['id'];_0x54778e=!![];}}if(_0x54778e){logger['info']('Admin\x20found:',_0x2f95ed['adminId']);_0x3771b2(_0x2f95ed);}else{_0x4bd8e6({'statusCode':0x194,'message':_0x2987('0x13')});}}else{_0x4bd8e6({'statusCode':0x194,'message':_0x2987('0x13')});}})[_0x2987('0x14')](function(_0x3a87a2){logger[_0x2987('0x15')]('['+[_0x11b8c0['toUpperCase']()]+']',_0x3a87a2[_0x2987('0x16')]);_0x4bd8e6(_0x3a87a2);});});}function getUser(_0x4937b,_0x121979,_0x4a0fc0){return function(_0x378729){return new Promise(function(_0x43dd6f,_0x2c6f10){var _0xe242a4={'method':_0x2987('0xa'),'uri':_0x4a0fc0+_0x2987('0xb'),'json':!![]};_0xe242a4['headers']=_0x121979;logger[_0x2987('0x17')](_0x2987('0x18'));return rp(_0xe242a4)[_0x2987('0x19')](function(_0x1b95b2){if(_0x1b95b2){var _0x41f267=_0x1b95b2[_0x2987('0xe')];var _0x2823b1=![];var _0x588f19=null;if(_0x378729['agentEmail']!==null){logger['info'](_0x2987('0x1a'),_0x378729['agentEmail']);_0x378729[_0x2987('0x1b')]=_0x378729[_0x2987('0x1c')];for(_0x588f19=0x0;_0x588f19<_0x41f267[_0x2987('0xf')];_0x588f19++){if(_0x41f267[_0x588f19][_0x2987('0x10')]===_0x378729[_0x2987('0x1c')]){_0x2823b1=!![];_0x378729['userId']=_0x41f267[_0x588f19]['id'];logger['info'](_0x2987('0x1d'),_0x378729['userId']);}}}if(!_0x2823b1){logger['info'](_0x2987('0x1e'));_0x378729[_0x2987('0x1b')]=_0x378729[_0x2987('0x11')];_0x378729['userId']=_0x378729[_0x2987('0x12')];_0x2823b1=!![];}if(_0x2823b1){_0x43dd6f(_0x378729);}else{_0x2c6f10({'statusCode':0x194,'message':_0x2987('0x13')});}}else{_0x2c6f10({'statusCode':0x194,'message':_0x2987('0x13')});}})[_0x2987('0x14')](function(_0x3dff38){logger['error']('['+[_0x4937b['toUpperCase']()]+']',_0x3dff38['message']);_0x2c6f10(_0x3dff38);});});};}function searchContact(_0x3f8bbd,_0x5be1b6,_0x1fc6f3,_0x466f4b){return new Promise(function(_0xbbfec2,_0x545cbb){var _0x1d9f0f={'method':'GET','headers':_0x5be1b6,'uri':_0x3f8bbd+_0x2987('0x1f')+_0x466f4b+_0x2987('0x20')+_0x1fc6f3+_0x2987('0x21'),'json':!![]};rp(_0x1d9f0f)[_0x2987('0x19')](function(_0x2a4f69){var _0x47eb95=_[_0x2987('0x22')](_0x2a4f69['contacts'][_0x2987('0x23')],[_0x1fc6f3,_0x466f4b]);_0xbbfec2(_0x47eb95);})[_0x2987('0x14')](function(_0xcedeb4){_0x545cbb(_0xcedeb4);});});}function getEndUser(_0x10b41e,_0x2ab3ba,_0x4ecab3){return function(_0x3e5168){return new Promise(function(_0x112f32,_0xf893b4){logger['info'](util[_0x2987('0x24')](_0x2987('0x25'),_0x3e5168['contactNumber']));searchContact(_0x4ecab3,_0x2ab3ba,_0x2987('0x26'),_0x3e5168['contactNumber'])['then'](function(_0x4e6d35){if(_0x4e6d35){_0x3e5168[_0x2987('0x27')]=_0x4e6d35['id'];logger[_0x2987('0x17')]('Contact\x20found\x20mobile_number:',_0x3e5168[_0x2987('0x27')]);return _0x112f32(_0x3e5168);}searchContact(_0x4ecab3,_0x2ab3ba,_0x2987('0x28'),_0x3e5168[_0x2987('0x29')])[_0x2987('0x19')](function(_0x3dbb8a){if(_0x3dbb8a){_0x3e5168[_0x2987('0x27')]=_0x3dbb8a['id'];logger[_0x2987('0x17')](_0x2987('0x2a'),_0x3e5168[_0x2987('0x27')]);return _0x112f32(_0x3e5168);}createEndUser(_0x3e5168,_0x10b41e,_0x2ab3ba,_0x4ecab3)['then'](function(_0x186cb2){logger[_0x2987('0x17')](_0x2987('0x2b'),_0x186cb2['endUserId']);return _0x112f32(_0x186cb2);});});})[_0x2987('0x14')](function(_0x335c88){_0xf893b4(_0x335c88);});});};}function createEndUser(_0x167e8a,_0x13bd96,_0x12d6ea,_0x34602b){return new Promise(function(_0x2fefad,_0x52ebeb){var _0x17437c=moment();var _0x216032={'method':'POST','uri':_0x34602b+'/api/contacts','body':{'contact':{'last_name':_0x167e8a[_0x2987('0x29')],'work_number':_0x167e8a[_0x2987('0x29')],'mobile_number':_0x167e8a[_0x2987('0x29')],'owner_id':_0x167e8a[_0x2987('0x2c')],'created_at':_0x17437c[_0x2987('0x24')](_0x2987('0x2d'))}},'json':!![]};_0x216032[_0x2987('0xc')]=_0x12d6ea;logger[_0x2987('0x17')](_0x2987('0x2e'));return rp(_0x216032)[_0x2987('0x19')](function(_0x3a7da3){_0x167e8a[_0x2987('0x27')]=_0x3a7da3['contact']['id'];_0x2fefad(_0x167e8a);})['catch'](function(_0x12fdef){logger['error']('['+[_0x13bd96[_0x2987('0x2f')]()]+']',_0x12fdef[_0x2987('0x16')]);_0x52ebeb(_0x12fdef[_0x2987('0x16')]);});});}function getTicket(_0x500f7b,_0x41f421,_0x48363c,_0x4d8902,_0x202b74){return function(_0x219651){logger[_0x2987('0x17')](_0x2987('0x30'));return new Promise(function(_0x1fe759,_0x3a56f4){var _0x9a66a8=moment();var _0x4c6be7={'method':'POST','uri':_0x48363c+'/api/tasks','body':{'title':intUtil[_0x2987('0x31')](_0x4d8902[_0x2987('0x32')],_0x202b74,'\x20'),'description':intUtil['getString'](_0x4d8902[_0x2987('0x33')],_0x202b74,'\x0a'),'owner_id':_0x219651[_0x2987('0x2c')],'creater_id':_0x219651[_0x2987('0x12')],'targetable_id':_0x219651[_0x2987('0x27')],'targetable_type':'Contact','created_at':_0x9a66a8[_0x2987('0x24')]('YYYY-MM-DDTHH:mm:ss'),'due_date':_0x9a66a8[_0x2987('0x34')](0x1e,'m')[_0x2987('0x24')]('YYYY-MM-DDTHH:mm:ss')},'json':!![]};_0x4c6be7['headers']=_0x41f421;return rp(_0x4c6be7)[_0x2987('0x19')](function(_0x53c403){_0x219651['ticketId']=_0x53c403[_0x2987('0x35')]['id'];logger[_0x2987('0x17')](_0x2987('0x36'),_0x219651[_0x2987('0x37')]);_0x1fe759(_0x219651);})[_0x2987('0x14')](function(_0xe55bfc){logger[_0x2987('0x15')]('['+[_0x500f7b[_0x2987('0x2f')]()]+']',_0xe55bfc['message']);_0x3a56f4(_0xe55bfc[_0x2987('0x16')]);});});};}function emit(_0x1ab0bf,_0x589d0a,_0x5557be){var _0x194079={'uri':_0x1ab0bf+_0x2987('0x38')+_0x5557be};io['to'](util[_0x2987('0x24')](_0x2987('0x39'),_0x589d0a))[_0x2987('0x3a')](_0x2987('0x3b'),_0x194079);}exports['cs']=function(_0x2c1871,_0x11292f,_0x19a57c,_0x3f731c,_0x446f08,_0x535b8e,_0x20f243,_0x571f35){var _0x3b0059={};var _0xaed128={'Authorization':_0x2987('0x3c')+_0x535b8e[_0x2987('0x3d')]};_0x535b8e[_0x2987('0x3e')]=intUtil[_0x2987('0x3f')](_0x535b8e[_0x2987('0x3e')]);_0x535b8e[_0x2987('0x40')]=intUtil[_0x2987('0x3f')](_0x535b8e['serverUrl']);var _0x34e2b1=_0x535b8e[_0x2987('0x3e')];_0x3b0059[_0x2987('0x11')]=_0x535b8e['username'];_0x3b0059[_0x2987('0x29')]=_0x571f35[_0x2987('0x41')]()==='outbound'?_0x11292f[_0x2987('0x42')]:_0x11292f['calleridnum'];_0x3b0059[_0x2987('0x43')]=_0x571f35===_0x2987('0x44')||_0x571f35===_0x2987('0x45')?_0x2987('0x44'):_0x2987('0x46');if(_0x3f731c){_0x3b0059['agentEmail']=_0x3f731c[_0x2987('0x10')];}var _0x55b1a2=util['format'](_0x2987('0x47'),_0x535b8e[_0x2987('0x40')],_0x11292f[_0x2987('0x48')],md5(_0x11292f['uniqueid']));if(_0x446f08&&_0x446f08[_0x2987('0x49')]){logger['info'](_0x2987('0x4a'),_0x2987('0x4b'));_0x11292f[_0x2987('0x4c')]=_0x55b1a2;}else if(_0x20f243&&_0x20f243[_0x2987('0x4d')]&&_0x20f243[_0x2987('0x4d')]!==_0x2987('0x4e')){logger[_0x2987('0x17')]('[OUTBOUND]','Recording\x20is\x20enabled!');_0x11292f[_0x2987('0x4c')]=_0x55b1a2;}else{_0x11292f[_0x2987('0x4c')]='';}return getAdminId(_0x3b0059,_0x571f35,_0xaed128,_0x34e2b1)[_0x2987('0x19')](getUser(_0x571f35,_0xaed128,_0x34e2b1))[_0x2987('0x19')](getEndUser(_0x571f35,_0xaed128,_0x34e2b1))['then'](getTicket(_0x571f35,_0xaed128,_0x34e2b1,_0x19a57c,_0x11292f))['then'](function(_0x10106e){logger['info'](util['format'](_0x2987('0x4f'),_0x10106e[_0x2987('0x37')]));if(_0x571f35!==_0x2987('0x45')){logger['info']('['+[_0x571f35[_0x2987('0x2f')]()]+']',_0x2987('0x50'));emit(_0x34e2b1,_0x3f731c[_0x2987('0x51')],_0x10106e[_0x2987('0x27')]);}})[_0x2987('0x14')](function(_0x3a9fa4){logger['error']('['+[_0x571f35['toUpperCase']()]+_0x2987('0x52'),util[_0x2987('0x53')](_0x3a9fa4,{'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 78473df..86e3513 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 _0x2799=['./freshdesk','./desk','./dynamics365','salesforce','freshdesk','zoho','desk','vtiger','dynamics365','freshsales','servicenow','includes','data1','toLowerCase','data2','find','Configurations','data3','queue','routeId','outbound','log','EVENT\x20UNKNOWN','unmanaged','zendesk','sugarcrm','../../../../config/logger','[EXEC]','format','%s\x20configuration\x20#%s\x20not\x20found','%s\x20account\x20#%s\x20not\x20found','error','lodash','./zendesk','./salesforce'];(function(_0x1e1020,_0xd64a27){var _0x464719=function(_0x376ffa){while(--_0x376ffa){_0x1e1020['push'](_0x1e1020['shift']());}};_0x464719(++_0xd64a27);}(_0x2799,0xac));var _0x9279=function(_0x3f67bd,_0x1e31f3){_0x3f67bd=_0x3f67bd-0x0;var _0x52135f=_0x2799[_0x3f67bd];return _0x52135f;};'use strict';var _=require(_0x9279('0x0'));var util=require('util');var zendesk=require(_0x9279('0x1'));var salesforce=require(_0x9279('0x2'));var sugarcrm=require('./sugarcrm');var freshdesk=require(_0x9279('0x3'));var zoho=require('./zoho');var desk=require(_0x9279('0x4'));var vtiger=require('./vtiger');var servicenow=require('./servicenow');var dynamics365=require(_0x9279('0x5'));var freshsales=require('./freshsales');var integrations=['zendesk',_0x9279('0x6'),'sugarcrm',_0x9279('0x7'),_0x9279('0x8'),_0x9279('0x9'),_0x9279('0xa'),_0x9279('0xb'),_0x9279('0xc'),_0x9279('0xd')];exports['exec']=function(_0x26aef5,_0x462825,_0x56ed33,_0x5e188c,_0x1b2a7a,_0x29a24b){if(_0x56ed33){if(_[_0x9279('0xe')](integrations,_0x26aef5[_0x9279('0xf')][_0x9279('0x10')]())){try{var _0x4ea3ea=null;var _0x32471b='';var _0x5b865b=_0x56ed33[_0x26aef5[_0x9279('0xf')][_0x9279('0x10')]()];if(_0x5b865b){var _0x356a76=_0x5b865b[_0x26aef5[_0x9279('0x11')]];if(_0x356a76){var _0x44536e=_[_0x9279('0x12')](_0x356a76[_0x9279('0x13')],{'id':parseInt(_0x26aef5[_0x9279('0x14')],0xa)});if(_0x44536e){if(_0x5e188c){if(_0x1b2a7a&&_0x462825[_0x9279('0x15')]){_0x32471b=_0x9279('0x15');}else if(_0x462825[_0x9279('0x16')]){_0x32471b=_0x9279('0x17');}else{console[_0x9279('0x18')](_0x9279('0x19'),_0x462825);}}else{_0x32471b=_0x9279('0x1a');}switch(_0x26aef5[_0x9279('0xf')]['toLowerCase']()){case _0x9279('0x1b'):zendesk[_0x32471b](_0x26aef5,_0x462825,_0x44536e,_0x5e188c,_0x1b2a7a,_0x356a76,_0x29a24b);break;case'salesforce':salesforce[_0x32471b](_0x26aef5,_0x462825,_0x44536e,_0x5e188c,_0x1b2a7a,_0x356a76,_0x29a24b);break;case _0x9279('0x1c'):sugarcrm[_0x32471b](_0x26aef5,_0x462825,_0x44536e,_0x5e188c,_0x1b2a7a,_0x356a76,_0x29a24b);break;case'freshdesk':freshdesk[_0x32471b](_0x26aef5,_0x462825,_0x44536e,_0x5e188c,_0x1b2a7a,_0x356a76,_0x29a24b);break;case _0x9279('0x8'):zoho[_0x32471b](_0x26aef5,_0x462825,_0x44536e,_0x5e188c,_0x1b2a7a,_0x356a76,_0x29a24b);break;case'desk':desk[_0x32471b](_0x26aef5,_0x462825,_0x44536e,_0x5e188c,_0x1b2a7a,_0x356a76,_0x29a24b);break;case _0x9279('0xa'):vtiger[_0x32471b](_0x26aef5,_0x462825,_0x44536e,_0x5e188c,_0x1b2a7a,_0x356a76,_0x29a24b);break;case'freshsales':freshsales['cs'](_0x26aef5,_0x462825,_0x44536e,_0x5e188c,_0x1b2a7a,_0x356a76,_0x29a24b,_0x32471b);break;case _0x9279('0xd'):servicenow['cs'](_0x26aef5,_0x462825,_0x44536e,_0x5e188c,_0x1b2a7a,_0x356a76,_0x29a24b,_0x32471b);break;case'dynamics365':dynamics365['cs'](_0x26aef5,_0x462825,_0x44536e,_0x5e188c,_0x1b2a7a,_0x356a76,_0x29a24b,_0x32471b);break;default:console[_0x9279('0x18')]('unknown\x20integration');}}else{_0x4ea3ea=require(_0x9279('0x1d'))(_0x26aef5[_0x9279('0xf')]['toLowerCase']());_0x4ea3ea['error'](_0x9279('0x1e'),util[_0x9279('0x1f')](_0x9279('0x20'),_0x26aef5[_0x9279('0xf')][_0x9279('0x10')](),_0x26aef5['data3']));}}else{_0x4ea3ea=require(_0x9279('0x1d'))(_0x26aef5['data1'][_0x9279('0x10')]());_0x4ea3ea['error'](_0x9279('0x1e'),util[_0x9279('0x1f')](_0x9279('0x21'),_0x26aef5[_0x9279('0xf')]['toLowerCase'](),_0x26aef5[_0x9279('0x11')]));}}else{}}catch(_0x5be4f7){console[_0x9279('0x22')](_0x5be4f7);}}}}; \ No newline at end of file +var _0xb751=['lodash','util','./salesforce','./zoho','./vtiger','./servicenow','./dynamics365','./freshsales','zendesk','salesforce','freshdesk','zoho','desk','vtiger','freshsales','servicenow','exec','includes','data1','toLowerCase','data2','find','Configurations','queue','routeId','outbound','log','EVENT\x20UNKNOWN','unmanaged','unknown\x20integration','../../../../config/logger','error','[EXEC]','format','%s\x20configuration\x20#%s\x20not\x20found','data3','%s\x20account\x20#%s\x20not\x20found'];(function(_0xecf074,_0x59b183){var _0x5ad316=function(_0xe5b335){while(--_0xe5b335){_0xecf074['push'](_0xecf074['shift']());}};_0x5ad316(++_0x59b183);}(_0xb751,0x6f));var _0x1b75=function(_0x26b7cb,_0x2e67e2){_0x26b7cb=_0x26b7cb-0x0;var _0x573090=_0xb751[_0x26b7cb];return _0x573090;};'use strict';var _=require(_0x1b75('0x0'));var util=require(_0x1b75('0x1'));var zendesk=require('./zendesk');var salesforce=require(_0x1b75('0x2'));var sugarcrm=require('./sugarcrm');var freshdesk=require('./freshdesk');var zoho=require(_0x1b75('0x3'));var desk=require('./desk');var vtiger=require(_0x1b75('0x4'));var servicenow=require(_0x1b75('0x5'));var dynamics365=require(_0x1b75('0x6'));var freshsales=require(_0x1b75('0x7'));var integrations=[_0x1b75('0x8'),_0x1b75('0x9'),'sugarcrm',_0x1b75('0xa'),_0x1b75('0xb'),_0x1b75('0xc'),_0x1b75('0xd'),'dynamics365',_0x1b75('0xe'),_0x1b75('0xf')];exports[_0x1b75('0x10')]=function(_0x423532,_0x3a0705,_0x3c9c15,_0x4d808a,_0x4a6034,_0x1deec6){if(_0x3c9c15){if(_[_0x1b75('0x11')](integrations,_0x423532[_0x1b75('0x12')]['toLowerCase']())){try{var _0x5b1286=null;var _0x2f99d2='';var _0x1128f3=_0x3c9c15[_0x423532[_0x1b75('0x12')][_0x1b75('0x13')]()];if(_0x1128f3){var _0x537a30=_0x1128f3[_0x423532[_0x1b75('0x14')]];if(_0x537a30){var _0x41ac9a=_[_0x1b75('0x15')](_0x537a30[_0x1b75('0x16')],{'id':parseInt(_0x423532['data3'],0xa)});if(_0x41ac9a){if(_0x4d808a){if(_0x4a6034&&_0x3a0705[_0x1b75('0x17')]){_0x2f99d2=_0x1b75('0x17');}else if(_0x3a0705[_0x1b75('0x18')]){_0x2f99d2=_0x1b75('0x19');}else{console[_0x1b75('0x1a')](_0x1b75('0x1b'),_0x3a0705);}}else{_0x2f99d2=_0x1b75('0x1c');}switch(_0x423532[_0x1b75('0x12')][_0x1b75('0x13')]()){case _0x1b75('0x8'):zendesk[_0x2f99d2](_0x423532,_0x3a0705,_0x41ac9a,_0x4d808a,_0x4a6034,_0x537a30,_0x1deec6);break;case'salesforce':salesforce[_0x2f99d2](_0x423532,_0x3a0705,_0x41ac9a,_0x4d808a,_0x4a6034,_0x537a30,_0x1deec6);break;case'sugarcrm':sugarcrm[_0x2f99d2](_0x423532,_0x3a0705,_0x41ac9a,_0x4d808a,_0x4a6034,_0x537a30,_0x1deec6);break;case _0x1b75('0xa'):freshdesk[_0x2f99d2](_0x423532,_0x3a0705,_0x41ac9a,_0x4d808a,_0x4a6034,_0x537a30,_0x1deec6);break;case _0x1b75('0xb'):zoho[_0x2f99d2](_0x423532,_0x3a0705,_0x41ac9a,_0x4d808a,_0x4a6034,_0x537a30,_0x1deec6);break;case'desk':desk[_0x2f99d2](_0x423532,_0x3a0705,_0x41ac9a,_0x4d808a,_0x4a6034,_0x537a30,_0x1deec6);break;case _0x1b75('0xd'):vtiger[_0x2f99d2](_0x423532,_0x3a0705,_0x41ac9a,_0x4d808a,_0x4a6034,_0x537a30,_0x1deec6);break;case'freshsales':freshsales['cs'](_0x423532,_0x3a0705,_0x41ac9a,_0x4d808a,_0x4a6034,_0x537a30,_0x1deec6,_0x2f99d2);break;case _0x1b75('0xf'):servicenow['cs'](_0x423532,_0x3a0705,_0x41ac9a,_0x4d808a,_0x4a6034,_0x537a30,_0x1deec6,_0x2f99d2);break;case'dynamics365':dynamics365['cs'](_0x423532,_0x3a0705,_0x41ac9a,_0x4d808a,_0x4a6034,_0x537a30,_0x1deec6,_0x2f99d2);break;default:console[_0x1b75('0x1a')](_0x1b75('0x1d'));}}else{_0x5b1286=require(_0x1b75('0x1e'))(_0x423532[_0x1b75('0x12')][_0x1b75('0x13')]());_0x5b1286[_0x1b75('0x1f')](_0x1b75('0x20'),util[_0x1b75('0x21')](_0x1b75('0x22'),_0x423532[_0x1b75('0x12')]['toLowerCase'](),_0x423532[_0x1b75('0x23')]));}}else{_0x5b1286=require('../../../../config/logger')(_0x423532[_0x1b75('0x12')]['toLowerCase']());_0x5b1286[_0x1b75('0x1f')](_0x1b75('0x20'),util[_0x1b75('0x21')](_0x1b75('0x24'),_0x423532[_0x1b75('0x12')][_0x1b75('0x13')](),_0x423532[_0x1b75('0x14')]));}}else{}}catch(_0x36c29a){console[_0x1b75('0x1f')](_0x36c29a);}}}}; \ 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 046a14a..ee7a1e7 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 _0xc4b8=['%s/%s/e','instanceUrl','error','catch','outbound','recordingFormat','[OUTBOUND]','destcalleridname','destcalleridnum','trigger:salesforce:display','newTab','trigger:browser:url','lastevent','toUpperCase',']\x20Ticket\x20%s\x20created.',']\x20Integration\x20account\x20type\x20%s.','moment','md5','jsforce','util','ioredis','../../../../config/environment','../../../../config/logger','salesforce','redis','defaults','getString','Descriptions','ticketType','Task','utc','IsReminderSet','endUserType','account','WhatId','Case','AccountId','lead','leadId','info','Association\x20between\x20Case\x20and\x20Lead\x20skipped','sobject','isNil','validateEmail','User','execute','then','find','Agent\x20%s\x20found.','Name','Agent\x20%s\x20not\x20found.\x20Switch\x20to\x20the\x20admin\x20account.','identity','resolve','user_id','display_name','Searching\x20enduser\x20with\x20phone\x20%s.\x20Serching\x20method\x20used\x20%s.','moduleSearch','contact_lead','additionalSearchContact','merge','$or','Contact','cloneDeep','additionalSearchLead','additionalSearchAccount','length','Lead','contact','Account','first','Phone','toLowerCase','moduleCreate','Enduser\x20with\x20phone\x20%s.\x20Creating\x20method\x20used\x20%s.','LastName','','Caller\x20-\x20%s','format','No\x20Company','includes','string','picklist','type','idField','content','variableName','customVariable','Variable','name','toString','password','concat','securityToken','Connection','remoteUri','https://login.salesforce.com','clientId','clientSecret','username','Connection\x20established.','serverUrl','stripTrailingSlash','monitor_format','[QUEUE]','Recording\x20is\x20enabled!','recordingURL','%s/api/voice/recordings/%s/downloads?type=uniqueid&token=%s','uniqueid','email','calleridname','calleridnum','[QUEUE]\x20Ticket\x20%s\x20created','[QUEUE]\x20Displaying\x20ticket\x20%s\x20to\x20agent\x20%s.\x20Integration\x20account\x20type\x20%s.','integrationTab','user:%s'];(function(_0x2f6b89,_0x125485){var _0x4a5983=function(_0x1447c2){while(--_0x1447c2){_0x2f6b89['push'](_0x2f6b89['shift']());}};_0x4a5983(++_0x125485);}(_0xc4b8,0x169));var _0x8c4b=function(_0x276319,_0x3be154){_0x276319=_0x276319-0x0;var _0x2d268c=_0xc4b8[_0x276319];return _0x2d268c;};'use strict';var _=require('lodash');var rp=require('request-promise');var moment=require(_0x8c4b('0x0'));var BPromise=require('bluebird');var md5=require(_0x8c4b('0x1'));var jsforce=require(_0x8c4b('0x2'));var util=require(_0x8c4b('0x3'));var Redis=require(_0x8c4b('0x4'));var intUtil=require('./util');var config=require(_0x8c4b('0x5'));var logger=require(_0x8c4b('0x6'))(_0x8c4b('0x7'));config[_0x8c4b('0x8')]=_[_0x8c4b('0x9')](config['redis'],{'host':'localhost','port':0x18eb});var io=require('socket.io-emitter')(new Redis(config[_0x8c4b('0x8')]));function emit(_0x2017ea,_0x39dc31,_0x4b5328){io['to'](_0x2017ea)['emit'](_0x39dc31,_0x4b5328);}function getTicket(_0x54a6aa,_0x8cd32f,_0x2fb0c4,_0xeabab9,_0x2b8671,_0x38c161,_0x2883d0,_0x2059ab){var _0x403653=Object['assign']({},{'OwnerId':_0x8cd32f['id'],'Subject':intUtil[_0x8c4b('0xa')](_0xeabab9['Subjects'],_0x2b8671,'\x20'),'Description':intUtil[_0x8c4b('0xa')](_0xeabab9[_0x8c4b('0xb')],_0x2b8671,'\x0a')},getCustomFields(_0x38c161,_0x2b8671));if(_0x2fb0c4){if(_0xeabab9[_0x8c4b('0xc')]===_0x8c4b('0xd')){_0x403653['ActivityDate']=moment[_0x8c4b('0xe')]();_0x403653[_0x8c4b('0xf')]=![];_0x403653['IsRecurrence']=![];if(_0x2fb0c4[_0x8c4b('0x10')]==='contact'||_0x2fb0c4['endUserType']==='lead'){_0x403653['WhoId']=_0x2fb0c4['id'];}else if(_0x2fb0c4[_0x8c4b('0x10')]===_0x8c4b('0x11')){_0x403653[_0x8c4b('0x12')]=_0x2fb0c4['id'];}}else if(_0xeabab9['ticketType']===_0x8c4b('0x13')){if(_0x2fb0c4[_0x8c4b('0x10')]==='contact'){_0x403653['ContactId']=_0x2fb0c4['id'];}else if(_0x2fb0c4['endUserType']===_0x8c4b('0x11')){_0x403653[_0x8c4b('0x14')]=_0x2fb0c4['id'];}else if(_0x2fb0c4[_0x8c4b('0x10')]===_0x8c4b('0x15')&&_0xeabab9[_0x8c4b('0x16')]){_0x403653[_0xeabab9[_0x8c4b('0x16')]]=_0x2fb0c4['id'];}else{logger[_0x8c4b('0x17')](_0x8c4b('0x18'));}}}return _0x2883d0[_0x8c4b('0x19')](_0xeabab9['ticketType'])['create'](_0x403653);}function getUser(_0x302c77,_0x2dcace,_0x39c04b){if(!_[_0x8c4b('0x1a')](_0x2dcace)&&intUtil[_0x8c4b('0x1b')](_0x2dcace)){var _0xb0228b={'Email':_0x2dcace};var _0x1fa8cd={'Id':!![],'Username':!![],'Name':!![],'Email':!![]};return _0x39c04b[_0x8c4b('0x19')](_0x8c4b('0x1c'))['find'](_0xb0228b,_0x1fa8cd)[_0x8c4b('0x1d')]()[_0x8c4b('0x1e')](function(_0x3e0bbd){if(_0x3e0bbd['length']){var _0x4dabdf=_[_0x8c4b('0x1f')](_0x3e0bbd,function(_0x462e23){return _0x462e23['Email']===_0x2dcace;});if(_0x4dabdf){logger[_0x8c4b('0x17')](_0x8c4b('0x20'),_0x2dcace);return BPromise['resolve']({'id':_0x4dabdf['Id'],'name':_0x4dabdf[_0x8c4b('0x21')]});}}else{logger['info'](_0x8c4b('0x22'),_0x2dcace);return _0x39c04b[_0x8c4b('0x23')]()[_0x8c4b('0x1e')](function(_0x374dfc){return BPromise[_0x8c4b('0x24')]({'id':_0x374dfc[_0x8c4b('0x25')],'name':_0x374dfc['display_name']});});}});}else{logger['info']('Agent\x20%s\x20not\x20found.\x20Switch\x20to\x20the\x20admin\x20account.',_0x2dcace);return _0x39c04b['identity']()[_0x8c4b('0x1e')](function(_0x4e8de3){return BPromise[_0x8c4b('0x24')]({'id':_0x4e8de3[_0x8c4b('0x25')],'name':_0x4e8de3[_0x8c4b('0x26')]});});}}function getEndUser(_0x310aea,_0x2e89f5,_0x48e0e2,_0xb856fd,_0x4c2469){var _0x244b15={'$or':{'Phone':_0xb856fd}};var _0x19c0c0={'Id':!![],'Name':!![],'Phone':!![]};return BPromise[_0x8c4b('0x24')]()[_0x8c4b('0x1e')](function(){logger[_0x8c4b('0x17')](_0x8c4b('0x27'),_0xb856fd,_0x2e89f5[_0x8c4b('0x28')]);switch(_0x2e89f5[_0x8c4b('0x28')]){case _0x8c4b('0x29'):var _0x1eb95a=_['cloneDeep'](_0x244b15);if(_0x2e89f5[_0x8c4b('0x2a')]){var _0x4ae84f={};_0x4ae84f[_0x2e89f5[_0x8c4b('0x2a')]]=_0xb856fd;_[_0x8c4b('0x2b')](_0x1eb95a[_0x8c4b('0x2c')],_0x4ae84f);}return _0x4c2469[_0x8c4b('0x19')](_0x8c4b('0x2d'))[_0x8c4b('0x1f')](_0x1eb95a,_0x19c0c0)[_0x8c4b('0x1d')]()[_0x8c4b('0x1e')](function(_0x3d1214){if(_0x3d1214&&_0x3d1214['length']){return _0x3d1214;}else{var _0x1a463a=_[_0x8c4b('0x2e')](_0x244b15);if(_0x2e89f5[_0x8c4b('0x2f')]){var _0x20612e={};_0x20612e[_0x2e89f5[_0x8c4b('0x2f')]]=_0xb856fd;_[_0x8c4b('0x2b')](_0x1a463a['$or'],_0x20612e);}return _0x4c2469[_0x8c4b('0x19')]('Lead')['find'](_0x1a463a,_0x19c0c0);}});case'account_contact_lead':var _0x304841=_[_0x8c4b('0x2e')](_0x244b15);if(_0x2e89f5[_0x8c4b('0x30')]){var _0x4ae84f={};_0x4ae84f[_0x2e89f5[_0x8c4b('0x30')]]=_0xb856fd;_[_0x8c4b('0x2b')](_0x304841[_0x8c4b('0x2c')],_0x4ae84f);}return _0x4c2469[_0x8c4b('0x19')]('Account')[_0x8c4b('0x1f')](_0x304841,_0x19c0c0)['execute']()[_0x8c4b('0x1e')](function(_0x41901a){if(_0x41901a&&_0x41901a[_0x8c4b('0x31')]){return _0x41901a;}else{var _0x28df1d=_[_0x8c4b('0x2e')](_0x244b15);if(_0x2e89f5[_0x8c4b('0x2a')]){var _0x275fc3={};_0x275fc3[_0x2e89f5[_0x8c4b('0x2a')]]=_0xb856fd;_['merge'](_0x28df1d[_0x8c4b('0x2c')],_0x275fc3);}return _0x4c2469[_0x8c4b('0x19')](_0x8c4b('0x2d'))[_0x8c4b('0x1f')](_0x28df1d,_0x19c0c0)[_0x8c4b('0x1e')](function(_0x35bb7a){if(_0x35bb7a&&_0x35bb7a[_0x8c4b('0x31')]){return _0x35bb7a;}else{var _0x142a70=_[_0x8c4b('0x2e')](_0x244b15);if(_0x2e89f5[_0x8c4b('0x2f')]){var _0x50396b={};_0x50396b[_0x2e89f5[_0x8c4b('0x2f')]]=_0xb856fd;_[_0x8c4b('0x2b')](_0x142a70['$or'],_0x50396b);}return _0x4c2469[_0x8c4b('0x19')](_0x8c4b('0x32'))[_0x8c4b('0x1f')](_0x142a70,_0x19c0c0);}});}});case _0x8c4b('0x33'):var _0x1eb95a=_[_0x8c4b('0x2e')](_0x244b15);if(_0x2e89f5[_0x8c4b('0x2a')]){var _0x4ae84f={};_0x4ae84f[_0x2e89f5['additionalSearchContact']]=_0xb856fd;_[_0x8c4b('0x2b')](_0x1eb95a['$or'],_0x4ae84f);}return _0x4c2469[_0x8c4b('0x19')](_0x8c4b('0x2d'))[_0x8c4b('0x1f')](_0x1eb95a,_0x19c0c0)[_0x8c4b('0x1d')]();case _0x8c4b('0x15'):var _0x22ae86=_[_0x8c4b('0x2e')](_0x244b15);if(_0x2e89f5['additionalSearchLead']){var _0x4ae84f={};_0x4ae84f[_0x2e89f5[_0x8c4b('0x2f')]]=_0xb856fd;_[_0x8c4b('0x2b')](_0x22ae86[_0x8c4b('0x2c')],_0x4ae84f);}return _0x4c2469['sobject'](_0x8c4b('0x32'))[_0x8c4b('0x1f')](_0x22ae86,_0x19c0c0);case _0x8c4b('0x11'):var _0x304841=_[_0x8c4b('0x2e')](_0x244b15);if(_0x2e89f5[_0x8c4b('0x30')]){var _0x4ae84f={};_0x4ae84f[_0x2e89f5[_0x8c4b('0x30')]]=_0xb856fd;_[_0x8c4b('0x2b')](_0x304841[_0x8c4b('0x2c')],_0x4ae84f);}return _0x4c2469[_0x8c4b('0x19')](_0x8c4b('0x34'))[_0x8c4b('0x1f')](_0x304841,_0x19c0c0);default:return null;}})[_0x8c4b('0x1e')](function(_0x370b57){if(_0x370b57&&_0x370b57[_0x8c4b('0x31')]){var _0x251e69=_[_0x8c4b('0x35')](_0x370b57);if(_0x251e69){return BPromise[_0x8c4b('0x24')]({'id':_0x251e69['Id'],'name':_0x251e69[_0x8c4b('0x21')],'phone':_0x251e69[_0x8c4b('0x36')],'endUserType':_0x251e69['attributes']['type'][_0x8c4b('0x37')]()});}}})['then'](function(_0x157cfb){if(_0x157cfb){logger[_0x8c4b('0x17')]('Enduser\x20(%s)\x20with\x20phone\x20%s\x20found',_0x157cfb[_0x8c4b('0x10')],_0xb856fd);return BPromise[_0x8c4b('0x24')](_0x157cfb);}else{logger[_0x8c4b('0x17')]('Enduser\x20with\x20phone\x20%s\x20not\x20found',_0xb856fd);var _0x170bf4={'Phone':_0xb856fd};if(_0x2e89f5[_0x8c4b('0x38')]){if(_0x2e89f5[_0x8c4b('0x38')]==='contact'){logger[_0x8c4b('0x17')](_0x8c4b('0x39'),_0xb856fd,_0x2e89f5[_0x8c4b('0x38')]);_0x170bf4[_0x8c4b('0x3a')]=_0x48e0e2!==_0x8c4b('0x3b')?_0x48e0e2:util['format'](_0x8c4b('0x3c'),_0xb856fd);}else if(_0x2e89f5['moduleCreate']===_0x8c4b('0x15')){logger[_0x8c4b('0x17')](_0x8c4b('0x39'),_0xb856fd,_0x2e89f5[_0x8c4b('0x38')]);_0x170bf4[_0x8c4b('0x3a')]=_0x48e0e2!==''?_0x48e0e2:util[_0x8c4b('0x3d')](_0x8c4b('0x3c'),_0xb856fd);_0x170bf4['Company']=_0x8c4b('0x3e');}else if(_0x2e89f5[_0x8c4b('0x38')]===_0x8c4b('0x11')){logger[_0x8c4b('0x17')](_0x8c4b('0x39'),_0xb856fd,_0x2e89f5[_0x8c4b('0x38')]);_0x170bf4[_0x8c4b('0x21')]=_0x48e0e2!==''?_0x48e0e2:util[_0x8c4b('0x3d')](_0x8c4b('0x3c'),_0xb856fd);}else{return null;}}return _0x4c2469['sobject'](_['upperFirst'](_0x2e89f5[_0x8c4b('0x38')]))['create'](_0x170bf4)[_0x8c4b('0x1e')](function(_0x193fbf){return BPromise[_0x8c4b('0x24')]({'id':_0x193fbf['id'],'endUserType':_0x2e89f5['moduleCreate']});});}});}function getCustomFields(_0x1694a3,_0x2b45ae){var _0x161376={};if(_0x1694a3['length']>0x0){_['forEach'](_0x1694a3,function(_0xbe7de2){if(_[_0x8c4b('0x3f')]([_0x8c4b('0x40'),_0x8c4b('0x41')],_0xbe7de2[_0x8c4b('0x42')])&&_0xbe7de2['idField']){_0x161376[_0xbe7de2[_0x8c4b('0x43')]]=_0xbe7de2[_0x8c4b('0x44')]['toString']();}else if(_0xbe7de2['type']==='variable'&&_0xbe7de2['variableName']&&_0xbe7de2[_0x8c4b('0x43')]){_0x2b45ae[_0xbe7de2['variableName']]&&(_0x161376[_0xbe7de2[_0x8c4b('0x43')]]=_0x2b45ae[_0xbe7de2[_0x8c4b('0x45')]]['toString']());}else if(_0xbe7de2[_0x8c4b('0x42')]===_0x8c4b('0x46')&&_0xbe7de2[_0x8c4b('0x47')]&&_0xbe7de2[_0x8c4b('0x47')]['name']&&_0xbe7de2['idField']){_0x2b45ae[_0xbe7de2['Variable'][_0x8c4b('0x48')][_0x8c4b('0x37')]()]&&(_0x161376[_0xbe7de2['idField']]=_0x2b45ae[_0xbe7de2[_0x8c4b('0x47')][_0x8c4b('0x48')][_0x8c4b('0x37')]()][_0x8c4b('0x49')]());}});}return _0x161376;}function getConnection(_0x30762b){var _0xf375d0=_0x30762b[_0x8c4b('0x4a')][_0x8c4b('0x4b')](_0x30762b[_0x8c4b('0x4c')]);var _0x221b93=new jsforce[(_0x8c4b('0x4d'))]({'oauth2':{'loginUrl':_0x30762b[_0x8c4b('0x4e')]||_0x8c4b('0x4f'),'clientId':_0x30762b[_0x8c4b('0x50')],'clientSecret':_0x30762b[_0x8c4b('0x51')]}});return _0x221b93['login'](_0x30762b[_0x8c4b('0x52')],_0xf375d0)[_0x8c4b('0x1e')](function(){logger['info'](_0x8c4b('0x53'));return _0x221b93;});}exports['queue']=function(_0x572193,_0x1de455,_0x2438ab,_0x58f749,_0x381838,_0x5ef51f){var _0xaf07ca,_0x101bc3,_0x38f39b,_0x3edc1a;_0x5ef51f[_0x8c4b('0x54')]=intUtil[_0x8c4b('0x55')](_0x5ef51f['serverUrl']);_0x5ef51f[_0x8c4b('0x4e')]=intUtil['stripTrailingSlash'](_0x5ef51f[_0x8c4b('0x4e')]);if(_0x381838&&_0x381838[_0x8c4b('0x56')]){logger['info'](_0x8c4b('0x57'),_0x8c4b('0x58'));_0x1de455[_0x8c4b('0x59')]=util[_0x8c4b('0x3d')](_0x8c4b('0x5a'),_0x5ef51f[_0x8c4b('0x54')],_0x1de455[_0x8c4b('0x5b')],md5(_0x1de455[_0x8c4b('0x5b')]));}else{_0x1de455[_0x8c4b('0x59')]='';}return getConnection(_0x5ef51f)[_0x8c4b('0x1e')](function(_0x35183e){_0x3edc1a=_0x35183e;return getUser(_0x5ef51f,_0x58f749[_0x8c4b('0x5c')],_0x3edc1a);})[_0x8c4b('0x1e')](function(_0x503d2d){_0xaf07ca=_0x503d2d;return getEndUser(_0x5ef51f,_0x2438ab,_0x1de455[_0x8c4b('0x5d')],_0x1de455[_0x8c4b('0x5e')],_0x3edc1a);})[_0x8c4b('0x1e')](function(_0xda8a8f){_0x101bc3=_0xda8a8f;return getTicket(_0x5ef51f,_0xaf07ca,_0x101bc3,_0x2438ab,_0x1de455,_0x2438ab['Fields'],_0x3edc1a,'queue');})[_0x8c4b('0x1e')](function(_0x2beea9){_0x38f39b=_0x2beea9;logger['info'](_0x8c4b('0x5f'),_0x38f39b['id']);logger['info'](_0x8c4b('0x60'),_0x38f39b['id'],_0x58f749[_0x8c4b('0x48')],_0x5ef51f[_0x8c4b('0x42')]);switch(_0x5ef51f['type']){case _0x8c4b('0x61'):emit(util[_0x8c4b('0x3d')](_0x8c4b('0x62'),_0x58f749['name']),'trigger:salesforce:display',{'recordId':_0x38f39b['id']});break;case'newTab':emit(util[_0x8c4b('0x3d')](_0x8c4b('0x62'),_0x58f749[_0x8c4b('0x48')]),'trigger:browser:url',{'uri':util[_0x8c4b('0x3d')](_0x8c4b('0x63'),_0x3edc1a[_0x8c4b('0x64')],_0x38f39b['id'])});break;default:logger[_0x8c4b('0x65')]('[QUEUE]\x20Salesforce\x20account\x20type\x20not\x20recognized.');}})[_0x8c4b('0x66')](function(_0x96dc77){logger[_0x8c4b('0x65')](_0x8c4b('0x57'),_0x96dc77);});};exports[_0x8c4b('0x67')]=function(_0x37caa1,_0x37cb71,_0x4c1582,_0x5080e0,_0x440dff,_0x29c6d7,_0x214a97){var _0x2f8e8f,_0x1fd3aa,_0x2559a6,_0x52c739;_0x29c6d7['serverUrl']=intUtil[_0x8c4b('0x55')](_0x29c6d7[_0x8c4b('0x54')]);_0x29c6d7[_0x8c4b('0x4e')]=intUtil[_0x8c4b('0x55')](_0x29c6d7[_0x8c4b('0x4e')]);if(_0x214a97&&_0x214a97[_0x8c4b('0x68')]&&_0x214a97[_0x8c4b('0x68')]!=='none'){logger[_0x8c4b('0x17')](_0x8c4b('0x69'),'Recording\x20is\x20enabled!');_0x37cb71['recordingURL']=util['format'](_0x8c4b('0x5a'),_0x29c6d7[_0x8c4b('0x54')],_0x37cb71['uniqueid'],md5(_0x37cb71[_0x8c4b('0x5b')]));}return getConnection(_0x29c6d7)[_0x8c4b('0x1e')](function(_0x4ce162){_0x52c739=_0x4ce162;return getUser(_0x29c6d7,_0x5080e0[_0x8c4b('0x5c')],_0x52c739);})['then'](function(_0x466b8a){_0x2f8e8f=_0x466b8a;return getEndUser(_0x29c6d7,_0x4c1582,_0x37cb71[_0x8c4b('0x6a')],_0x37cb71[_0x8c4b('0x6b')],_0x52c739);})[_0x8c4b('0x1e')](function(_0x4c114c){_0x1fd3aa=_0x4c114c;return getTicket(_0x29c6d7,_0x2f8e8f,_0x1fd3aa,_0x4c1582,_0x37cb71,_0x4c1582['Fields'],_0x52c739,_0x8c4b('0x67'));})[_0x8c4b('0x1e')](function(_0x18a2ec){_0x2559a6=_0x18a2ec;logger[_0x8c4b('0x17')]('[OUTBOUND]\x20Ticket\x20%s\x20created.',_0x2559a6['id']);logger[_0x8c4b('0x17')]('[OUTBOUND]\x20Displaying\x20ticket\x20%s\x20to\x20agent\x20%s.\x20Integration\x20account\x20type\x20%s.',_0x2559a6['id'],_0x5080e0[_0x8c4b('0x48')],_0x29c6d7[_0x8c4b('0x42')]);switch(_0x29c6d7[_0x8c4b('0x42')]){case _0x8c4b('0x61'):emit(util[_0x8c4b('0x3d')]('user:%s',_0x5080e0[_0x8c4b('0x48')]),_0x8c4b('0x6c'),{'recordId':_0x2559a6['id']});break;case _0x8c4b('0x6d'):emit(util[_0x8c4b('0x3d')](_0x8c4b('0x62'),_0x5080e0[_0x8c4b('0x48')]),_0x8c4b('0x6e'),{'uri':util[_0x8c4b('0x3d')](_0x8c4b('0x63'),_0x52c739[_0x8c4b('0x64')],_0x2559a6['id'])});break;default:logger[_0x8c4b('0x65')](_0x8c4b('0x69'),'Salesforce\x20account\x20type\x20not\x20recognized');}})[_0x8c4b('0x66')](function(_0x3e3b34){logger[_0x8c4b('0x65')](_0x8c4b('0x69'),_0x3e3b34);});};exports['unmanaged']=function(_0x5325c3,_0x203fd1,_0x481dc0,_0xc3e0d2,_0x22c726,_0xdbe274){var _0xa89d10,_0x1fc173,_0x120536,_0x565dec;_0xdbe274[_0x8c4b('0x54')]=intUtil['stripTrailingSlash'](_0xdbe274['serverUrl']);_0xdbe274[_0x8c4b('0x4e')]=intUtil['stripTrailingSlash'](_0xdbe274[_0x8c4b('0x4e')]);if(_0x22c726&&_0x22c726[_0x8c4b('0x56')]){logger[_0x8c4b('0x17')]('['+_0x203fd1[_0x8c4b('0x6f')][_0x8c4b('0x70')]()+']','Recording\x20is\x20enabled!');_0x203fd1[_0x8c4b('0x59')]=util['format'](_0x8c4b('0x5a'),_0xdbe274['serverUrl'],_0x203fd1[_0x8c4b('0x5b')],md5(_0x203fd1['uniqueid']));}else{_0x203fd1[_0x8c4b('0x59')]='';}return getConnection(_0xdbe274)[_0x8c4b('0x1e')](function(_0x408965){_0x565dec=_0x408965;if(!_[_0x8c4b('0x1a')](_0xc3e0d2)){return getUser(_0xdbe274,_0xc3e0d2['name'],_0x565dec);}else{return getUser(_0xdbe274,null,_0x565dec);}})[_0x8c4b('0x1e')](function(_0x571d90){_0xa89d10=_0x571d90;return getEndUser(_0xdbe274,_0x481dc0,_0x203fd1[_0x8c4b('0x5d')],_0x203fd1[_0x8c4b('0x5e')],_0x565dec);})['then'](function(_0x45a74f){_0x1fc173=_0x45a74f;return getTicket(_0xdbe274,_0xa89d10,_0x1fc173,_0x481dc0,_0x203fd1,_0x481dc0['Fields'],_0x565dec);})[_0x8c4b('0x1e')](function(_0x552b58){_0x120536=_0x552b58;logger[_0x8c4b('0x17')]('['+_0x203fd1[_0x8c4b('0x6f')]['toUpperCase']()+_0x8c4b('0x71'),_0x120536['id']);logger[_0x8c4b('0x17')]('['+_0x203fd1[_0x8c4b('0x6f')][_0x8c4b('0x70')]()+_0x8c4b('0x72'),_0xdbe274[_0x8c4b('0x42')]);})[_0x8c4b('0x66')](function(_0x55bded){logger[_0x8c4b('0x65')]('['+_0x203fd1[_0x8c4b('0x6f')][_0x8c4b('0x70')]()+']',_0x55bded);});}; \ No newline at end of file +var _0x18eb=['none','[OUTBOUND]','Recording\x20is\x20enabled!','email','destcalleridname','destcalleridnum','outbound','[OUTBOUND]\x20Ticket\x20%s\x20created.','[OUTBOUND]\x20Displaying\x20ticket\x20%s\x20to\x20agent\x20%s.\x20Integration\x20account\x20type\x20%s.','trigger:salesforce:display','unmanaged','monitor_format','toUpperCase','isNil',']\x20Ticket\x20%s\x20created.','lastevent',']\x20Integration\x20account\x20type\x20%s.','lodash','request-promise','moment','md5','jsforce','util','ioredis','./util','../../../../config/environment','salesforce','redis','defaults','socket.io-emitter','emit','assign','getString','Descriptions','ticketType','Task','IsReminderSet','endUserType','contact','lead','account','AccountId','leadId','Association\x20between\x20Case\x20and\x20Lead\x20skipped','sobject','validateEmail','User','find','execute','then','length','info','Agent\x20%s\x20found.','resolve','Agent\x20%s\x20not\x20found.\x20Switch\x20to\x20the\x20admin\x20account.','user_id','display_name','identity','Searching\x20enduser\x20with\x20phone\x20%s.\x20Serching\x20method\x20used\x20%s.','moduleSearch','contact_lead','cloneDeep','additionalSearchContact','merge','$or','Contact','additionalSearchLead','Lead','account_contact_lead','additionalSearchAccount','Account','first','Phone','attributes','type','toLowerCase','Enduser\x20(%s)\x20with\x20phone\x20%s\x20found','Enduser\x20with\x20phone\x20%s\x20not\x20found','moduleCreate','Enduser\x20with\x20phone\x20%s.\x20Creating\x20method\x20used\x20%s.','LastName','','format','Caller\x20-\x20%s','Company','upperFirst','create','forEach','picklist','idField','content','toString','variable','variableName','customVariable','Variable','name','concat','securityToken','Connection','remoteUri','https://login.salesforce.com','clientId','clientSecret','login','Connection\x20established.','queue','serverUrl','stripTrailingSlash','[QUEUE]','%s/api/voice/recordings/%s/downloads?type=uniqueid&token=%s','uniqueid','recordingURL','calleridname','calleridnum','Fields','[QUEUE]\x20Ticket\x20%s\x20created','[QUEUE]\x20Displaying\x20ticket\x20%s\x20to\x20agent\x20%s.\x20Integration\x20account\x20type\x20%s.','integrationTab','user:%s','newTab','trigger:browser:url','%s/%s/e','instanceUrl','error','[QUEUE]\x20Salesforce\x20account\x20type\x20not\x20recognized.','catch','recordingFormat'];(function(_0x1762b4,_0x33d836){var _0x29beda=function(_0x31c2fa){while(--_0x31c2fa){_0x1762b4['push'](_0x1762b4['shift']());}};_0x29beda(++_0x33d836);}(_0x18eb,0x91));var _0xb18e=function(_0x2a7548,_0x57800c){_0x2a7548=_0x2a7548-0x0;var _0x5d37c3=_0x18eb[_0x2a7548];return _0x5d37c3;};'use strict';var _=require(_0xb18e('0x0'));var rp=require(_0xb18e('0x1'));var moment=require(_0xb18e('0x2'));var BPromise=require('bluebird');var md5=require(_0xb18e('0x3'));var jsforce=require(_0xb18e('0x4'));var util=require(_0xb18e('0x5'));var Redis=require(_0xb18e('0x6'));var intUtil=require(_0xb18e('0x7'));var config=require(_0xb18e('0x8'));var logger=require('../../../../config/logger')(_0xb18e('0x9'));config[_0xb18e('0xa')]=_[_0xb18e('0xb')](config[_0xb18e('0xa')],{'host':'localhost','port':0x18eb});var io=require(_0xb18e('0xc'))(new Redis(config[_0xb18e('0xa')]));function emit(_0xd99e3,_0x515b31,_0x1d9b2d){io['to'](_0xd99e3)[_0xb18e('0xd')](_0x515b31,_0x1d9b2d);}function getTicket(_0x452f21,_0x2c8973,_0x140086,_0x413740,_0x303bd8,_0x1b3e35,_0x512cd3,_0x1ebfae){var _0x586891=Object[_0xb18e('0xe')]({},{'OwnerId':_0x2c8973['id'],'Subject':intUtil[_0xb18e('0xf')](_0x413740['Subjects'],_0x303bd8,'\x20'),'Description':intUtil['getString'](_0x413740[_0xb18e('0x10')],_0x303bd8,'\x0a')},getCustomFields(_0x1b3e35,_0x303bd8));if(_0x140086){if(_0x413740[_0xb18e('0x11')]===_0xb18e('0x12')){_0x586891['ActivityDate']=moment['utc']();_0x586891[_0xb18e('0x13')]=![];_0x586891['IsRecurrence']=![];if(_0x140086[_0xb18e('0x14')]===_0xb18e('0x15')||_0x140086[_0xb18e('0x14')]===_0xb18e('0x16')){_0x586891['WhoId']=_0x140086['id'];}else if(_0x140086[_0xb18e('0x14')]===_0xb18e('0x17')){_0x586891['WhatId']=_0x140086['id'];}}else if(_0x413740[_0xb18e('0x11')]==='Case'){if(_0x140086[_0xb18e('0x14')]===_0xb18e('0x15')){_0x586891['ContactId']=_0x140086['id'];}else if(_0x140086[_0xb18e('0x14')]===_0xb18e('0x17')){_0x586891[_0xb18e('0x18')]=_0x140086['id'];}else if(_0x140086[_0xb18e('0x14')]===_0xb18e('0x16')&&_0x413740[_0xb18e('0x19')]){_0x586891[_0x413740['leadId']]=_0x140086['id'];}else{logger['info'](_0xb18e('0x1a'));}}}return _0x512cd3[_0xb18e('0x1b')](_0x413740['ticketType'])['create'](_0x586891);}function getUser(_0x232a3b,_0x443642,_0x520fb4){if(!_['isNil'](_0x443642)&&intUtil[_0xb18e('0x1c')](_0x443642)){var _0x2746f3={'Email':_0x443642};var _0xa93ca5={'Id':!![],'Username':!![],'Name':!![],'Email':!![]};return _0x520fb4[_0xb18e('0x1b')](_0xb18e('0x1d'))[_0xb18e('0x1e')](_0x2746f3,_0xa93ca5)[_0xb18e('0x1f')]()[_0xb18e('0x20')](function(_0x2265e3){if(_0x2265e3[_0xb18e('0x21')]){var _0x5584b9=_['find'](_0x2265e3,function(_0x250cee){return _0x250cee['Email']===_0x443642;});if(_0x5584b9){logger[_0xb18e('0x22')](_0xb18e('0x23'),_0x443642);return BPromise[_0xb18e('0x24')]({'id':_0x5584b9['Id'],'name':_0x5584b9['Name']});}}else{logger['info'](_0xb18e('0x25'),_0x443642);return _0x520fb4['identity']()[_0xb18e('0x20')](function(_0x2f5730){return BPromise[_0xb18e('0x24')]({'id':_0x2f5730[_0xb18e('0x26')],'name':_0x2f5730[_0xb18e('0x27')]});});}});}else{logger[_0xb18e('0x22')](_0xb18e('0x25'),_0x443642);return _0x520fb4[_0xb18e('0x28')]()[_0xb18e('0x20')](function(_0x45945a){return BPromise[_0xb18e('0x24')]({'id':_0x45945a[_0xb18e('0x26')],'name':_0x45945a[_0xb18e('0x27')]});});}}function getEndUser(_0x2c9f25,_0x1b92b8,_0x2182e4,_0x478fda,_0x22402c){var _0x4cb177={'$or':{'Phone':_0x478fda}};var _0x215c8f={'Id':!![],'Name':!![],'Phone':!![]};return BPromise[_0xb18e('0x24')]()['then'](function(){logger[_0xb18e('0x22')](_0xb18e('0x29'),_0x478fda,_0x1b92b8[_0xb18e('0x2a')]);switch(_0x1b92b8[_0xb18e('0x2a')]){case _0xb18e('0x2b'):var _0x2757b9=_[_0xb18e('0x2c')](_0x4cb177);if(_0x1b92b8[_0xb18e('0x2d')]){var _0x51edbd={};_0x51edbd[_0x1b92b8[_0xb18e('0x2d')]]=_0x478fda;_[_0xb18e('0x2e')](_0x2757b9[_0xb18e('0x2f')],_0x51edbd);}return _0x22402c[_0xb18e('0x1b')](_0xb18e('0x30'))[_0xb18e('0x1e')](_0x2757b9,_0x215c8f)[_0xb18e('0x1f')]()[_0xb18e('0x20')](function(_0x359132){if(_0x359132&&_0x359132[_0xb18e('0x21')]){return _0x359132;}else{var _0x14b660=_[_0xb18e('0x2c')](_0x4cb177);if(_0x1b92b8[_0xb18e('0x31')]){var _0xb902d7={};_0xb902d7[_0x1b92b8[_0xb18e('0x31')]]=_0x478fda;_[_0xb18e('0x2e')](_0x14b660[_0xb18e('0x2f')],_0xb902d7);}return _0x22402c[_0xb18e('0x1b')](_0xb18e('0x32'))[_0xb18e('0x1e')](_0x14b660,_0x215c8f);}});case _0xb18e('0x33'):var _0x214d17=_[_0xb18e('0x2c')](_0x4cb177);if(_0x1b92b8['additionalSearchAccount']){var _0x51edbd={};_0x51edbd[_0x1b92b8[_0xb18e('0x34')]]=_0x478fda;_['merge'](_0x214d17[_0xb18e('0x2f')],_0x51edbd);}return _0x22402c[_0xb18e('0x1b')](_0xb18e('0x35'))[_0xb18e('0x1e')](_0x214d17,_0x215c8f)[_0xb18e('0x1f')]()[_0xb18e('0x20')](function(_0x52c5ed){if(_0x52c5ed&&_0x52c5ed['length']){return _0x52c5ed;}else{var _0x118580=_[_0xb18e('0x2c')](_0x4cb177);if(_0x1b92b8['additionalSearchContact']){var _0x18a183={};_0x18a183[_0x1b92b8['additionalSearchContact']]=_0x478fda;_[_0xb18e('0x2e')](_0x118580['$or'],_0x18a183);}return _0x22402c['sobject']('Contact')[_0xb18e('0x1e')](_0x118580,_0x215c8f)[_0xb18e('0x20')](function(_0x566274){if(_0x566274&&_0x566274[_0xb18e('0x21')]){return _0x566274;}else{var _0x4dc241=_[_0xb18e('0x2c')](_0x4cb177);if(_0x1b92b8['additionalSearchLead']){var _0x169443={};_0x169443[_0x1b92b8[_0xb18e('0x31')]]=_0x478fda;_[_0xb18e('0x2e')](_0x4dc241[_0xb18e('0x2f')],_0x169443);}return _0x22402c[_0xb18e('0x1b')](_0xb18e('0x32'))[_0xb18e('0x1e')](_0x4dc241,_0x215c8f);}});}});case _0xb18e('0x15'):var _0x2757b9=_[_0xb18e('0x2c')](_0x4cb177);if(_0x1b92b8[_0xb18e('0x2d')]){var _0x51edbd={};_0x51edbd[_0x1b92b8[_0xb18e('0x2d')]]=_0x478fda;_['merge'](_0x2757b9['$or'],_0x51edbd);}return _0x22402c[_0xb18e('0x1b')](_0xb18e('0x30'))[_0xb18e('0x1e')](_0x2757b9,_0x215c8f)[_0xb18e('0x1f')]();case _0xb18e('0x16'):var _0x12c1ab=_[_0xb18e('0x2c')](_0x4cb177);if(_0x1b92b8[_0xb18e('0x31')]){var _0x51edbd={};_0x51edbd[_0x1b92b8[_0xb18e('0x31')]]=_0x478fda;_[_0xb18e('0x2e')](_0x12c1ab[_0xb18e('0x2f')],_0x51edbd);}return _0x22402c['sobject']('Lead')['find'](_0x12c1ab,_0x215c8f);case _0xb18e('0x17'):var _0x214d17=_['cloneDeep'](_0x4cb177);if(_0x1b92b8['additionalSearchAccount']){var _0x51edbd={};_0x51edbd[_0x1b92b8[_0xb18e('0x34')]]=_0x478fda;_[_0xb18e('0x2e')](_0x214d17[_0xb18e('0x2f')],_0x51edbd);}return _0x22402c[_0xb18e('0x1b')](_0xb18e('0x35'))[_0xb18e('0x1e')](_0x214d17,_0x215c8f);default:return null;}})[_0xb18e('0x20')](function(_0x102236){if(_0x102236&&_0x102236['length']){var _0x578a8d=_[_0xb18e('0x36')](_0x102236);if(_0x578a8d){return BPromise[_0xb18e('0x24')]({'id':_0x578a8d['Id'],'name':_0x578a8d['Name'],'phone':_0x578a8d[_0xb18e('0x37')],'endUserType':_0x578a8d[_0xb18e('0x38')][_0xb18e('0x39')][_0xb18e('0x3a')]()});}}})['then'](function(_0x68b856){if(_0x68b856){logger['info'](_0xb18e('0x3b'),_0x68b856[_0xb18e('0x14')],_0x478fda);return BPromise[_0xb18e('0x24')](_0x68b856);}else{logger['info'](_0xb18e('0x3c'),_0x478fda);var _0xd67d2a={'Phone':_0x478fda};if(_0x1b92b8['moduleCreate']){if(_0x1b92b8[_0xb18e('0x3d')]===_0xb18e('0x15')){logger[_0xb18e('0x22')](_0xb18e('0x3e'),_0x478fda,_0x1b92b8[_0xb18e('0x3d')]);_0xd67d2a[_0xb18e('0x3f')]=_0x2182e4!==_0xb18e('0x40')?_0x2182e4:util[_0xb18e('0x41')](_0xb18e('0x42'),_0x478fda);}else if(_0x1b92b8[_0xb18e('0x3d')]===_0xb18e('0x16')){logger[_0xb18e('0x22')](_0xb18e('0x3e'),_0x478fda,_0x1b92b8[_0xb18e('0x3d')]);_0xd67d2a[_0xb18e('0x3f')]=_0x2182e4!==_0xb18e('0x40')?_0x2182e4:util[_0xb18e('0x41')](_0xb18e('0x42'),_0x478fda);_0xd67d2a[_0xb18e('0x43')]='No\x20Company';}else if(_0x1b92b8[_0xb18e('0x3d')]==='account'){logger[_0xb18e('0x22')](_0xb18e('0x3e'),_0x478fda,_0x1b92b8['moduleCreate']);_0xd67d2a['Name']=_0x2182e4!==_0xb18e('0x40')?_0x2182e4:util[_0xb18e('0x41')]('Caller\x20-\x20%s',_0x478fda);}else{return null;}}return _0x22402c['sobject'](_[_0xb18e('0x44')](_0x1b92b8[_0xb18e('0x3d')]))[_0xb18e('0x45')](_0xd67d2a)[_0xb18e('0x20')](function(_0x206330){return BPromise[_0xb18e('0x24')]({'id':_0x206330['id'],'endUserType':_0x1b92b8[_0xb18e('0x3d')]});});}});}function getCustomFields(_0x578f7a,_0x2e20b7){var _0x9a05d3={};if(_0x578f7a[_0xb18e('0x21')]>0x0){_[_0xb18e('0x46')](_0x578f7a,function(_0x2b58a1){if(_['includes'](['string',_0xb18e('0x47')],_0x2b58a1[_0xb18e('0x39')])&&_0x2b58a1[_0xb18e('0x48')]){_0x9a05d3[_0x2b58a1[_0xb18e('0x48')]]=_0x2b58a1[_0xb18e('0x49')][_0xb18e('0x4a')]();}else if(_0x2b58a1[_0xb18e('0x39')]===_0xb18e('0x4b')&&_0x2b58a1[_0xb18e('0x4c')]&&_0x2b58a1['idField']){_0x2e20b7[_0x2b58a1[_0xb18e('0x4c')]]&&(_0x9a05d3[_0x2b58a1['idField']]=_0x2e20b7[_0x2b58a1['variableName']][_0xb18e('0x4a')]());}else if(_0x2b58a1[_0xb18e('0x39')]===_0xb18e('0x4d')&&_0x2b58a1[_0xb18e('0x4e')]&&_0x2b58a1[_0xb18e('0x4e')]['name']&&_0x2b58a1[_0xb18e('0x48')]){_0x2e20b7[_0x2b58a1[_0xb18e('0x4e')][_0xb18e('0x4f')][_0xb18e('0x3a')]()]&&(_0x9a05d3[_0x2b58a1[_0xb18e('0x48')]]=_0x2e20b7[_0x2b58a1[_0xb18e('0x4e')]['name']['toLowerCase']()][_0xb18e('0x4a')]());}});}return _0x9a05d3;}function getConnection(_0x268a42){var _0x5b092a=_0x268a42['password'][_0xb18e('0x50')](_0x268a42[_0xb18e('0x51')]);var _0x4c3bbd=new jsforce[(_0xb18e('0x52'))]({'oauth2':{'loginUrl':_0x268a42[_0xb18e('0x53')]||_0xb18e('0x54'),'clientId':_0x268a42[_0xb18e('0x55')],'clientSecret':_0x268a42[_0xb18e('0x56')]}});return _0x4c3bbd[_0xb18e('0x57')](_0x268a42['username'],_0x5b092a)[_0xb18e('0x20')](function(){logger[_0xb18e('0x22')](_0xb18e('0x58'));return _0x4c3bbd;});}exports[_0xb18e('0x59')]=function(_0x291616,_0x1a40bb,_0x4767b4,_0xe5315d,_0x514746,_0x19e8cd){var _0x50b676,_0x50cf9e,_0x32e1a1,_0x42ca92;_0x19e8cd[_0xb18e('0x5a')]=intUtil[_0xb18e('0x5b')](_0x19e8cd['serverUrl']);_0x19e8cd[_0xb18e('0x53')]=intUtil[_0xb18e('0x5b')](_0x19e8cd['remoteUri']);if(_0x514746&&_0x514746['monitor_format']){logger['info'](_0xb18e('0x5c'),'Recording\x20is\x20enabled!');_0x1a40bb['recordingURL']=util[_0xb18e('0x41')](_0xb18e('0x5d'),_0x19e8cd['serverUrl'],_0x1a40bb[_0xb18e('0x5e')],md5(_0x1a40bb['uniqueid']));}else{_0x1a40bb[_0xb18e('0x5f')]='';}return getConnection(_0x19e8cd)[_0xb18e('0x20')](function(_0x3aaf86){_0x42ca92=_0x3aaf86;return getUser(_0x19e8cd,_0xe5315d['email'],_0x42ca92);})['then'](function(_0x411346){_0x50b676=_0x411346;return getEndUser(_0x19e8cd,_0x4767b4,_0x1a40bb[_0xb18e('0x60')],_0x1a40bb[_0xb18e('0x61')],_0x42ca92);})[_0xb18e('0x20')](function(_0x301691){_0x50cf9e=_0x301691;return getTicket(_0x19e8cd,_0x50b676,_0x50cf9e,_0x4767b4,_0x1a40bb,_0x4767b4[_0xb18e('0x62')],_0x42ca92,_0xb18e('0x59'));})[_0xb18e('0x20')](function(_0x58a23f){_0x32e1a1=_0x58a23f;logger[_0xb18e('0x22')](_0xb18e('0x63'),_0x32e1a1['id']);logger['info'](_0xb18e('0x64'),_0x32e1a1['id'],_0xe5315d[_0xb18e('0x4f')],_0x19e8cd[_0xb18e('0x39')]);switch(_0x19e8cd[_0xb18e('0x39')]){case _0xb18e('0x65'):emit(util['format'](_0xb18e('0x66'),_0xe5315d[_0xb18e('0x4f')]),'trigger:salesforce:display',{'recordId':_0x32e1a1['id']});break;case _0xb18e('0x67'):emit(util['format']('user:%s',_0xe5315d['name']),_0xb18e('0x68'),{'uri':util[_0xb18e('0x41')](_0xb18e('0x69'),_0x42ca92[_0xb18e('0x6a')],_0x32e1a1['id'])});break;default:logger[_0xb18e('0x6b')](_0xb18e('0x6c'));}})[_0xb18e('0x6d')](function(_0x3331f4){logger[_0xb18e('0x6b')](_0xb18e('0x5c'),_0x3331f4);});};exports['outbound']=function(_0x11d540,_0x445c3e,_0x2e2310,_0x6a69f8,_0x4f2c45,_0x2f4cde,_0x5065e6){var _0x112825,_0x3ccee4,_0x186ff7,_0x5004c;_0x2f4cde[_0xb18e('0x5a')]=intUtil[_0xb18e('0x5b')](_0x2f4cde[_0xb18e('0x5a')]);_0x2f4cde[_0xb18e('0x53')]=intUtil[_0xb18e('0x5b')](_0x2f4cde[_0xb18e('0x53')]);if(_0x5065e6&&_0x5065e6[_0xb18e('0x6e')]&&_0x5065e6[_0xb18e('0x6e')]!==_0xb18e('0x6f')){logger[_0xb18e('0x22')](_0xb18e('0x70'),_0xb18e('0x71'));_0x445c3e[_0xb18e('0x5f')]=util[_0xb18e('0x41')]('%s/api/voice/recordings/%s/downloads?type=uniqueid&token=%s',_0x2f4cde[_0xb18e('0x5a')],_0x445c3e['uniqueid'],md5(_0x445c3e[_0xb18e('0x5e')]));}return getConnection(_0x2f4cde)[_0xb18e('0x20')](function(_0x21de31){_0x5004c=_0x21de31;return getUser(_0x2f4cde,_0x6a69f8[_0xb18e('0x72')],_0x5004c);})[_0xb18e('0x20')](function(_0x5f1091){_0x112825=_0x5f1091;return getEndUser(_0x2f4cde,_0x2e2310,_0x445c3e[_0xb18e('0x73')],_0x445c3e[_0xb18e('0x74')],_0x5004c);})[_0xb18e('0x20')](function(_0x1c4718){_0x3ccee4=_0x1c4718;return getTicket(_0x2f4cde,_0x112825,_0x3ccee4,_0x2e2310,_0x445c3e,_0x2e2310[_0xb18e('0x62')],_0x5004c,_0xb18e('0x75'));})['then'](function(_0x35adab){_0x186ff7=_0x35adab;logger[_0xb18e('0x22')](_0xb18e('0x76'),_0x186ff7['id']);logger['info'](_0xb18e('0x77'),_0x186ff7['id'],_0x6a69f8[_0xb18e('0x4f')],_0x2f4cde['type']);switch(_0x2f4cde[_0xb18e('0x39')]){case _0xb18e('0x65'):emit(util[_0xb18e('0x41')](_0xb18e('0x66'),_0x6a69f8[_0xb18e('0x4f')]),_0xb18e('0x78'),{'recordId':_0x186ff7['id']});break;case _0xb18e('0x67'):emit(util[_0xb18e('0x41')](_0xb18e('0x66'),_0x6a69f8[_0xb18e('0x4f')]),'trigger:browser:url',{'uri':util[_0xb18e('0x41')]('%s/%s/e',_0x5004c[_0xb18e('0x6a')],_0x186ff7['id'])});break;default:logger[_0xb18e('0x6b')]('[OUTBOUND]','Salesforce\x20account\x20type\x20not\x20recognized');}})[_0xb18e('0x6d')](function(_0x24385f){logger[_0xb18e('0x6b')](_0xb18e('0x70'),_0x24385f);});};exports[_0xb18e('0x79')]=function(_0xb87583,_0x55d8d6,_0x290d8a,_0x35f722,_0x160fdc,_0xc7c499){var _0x532858,_0x4e8d17,_0x9423d5,_0xea55b4;_0xc7c499['serverUrl']=intUtil[_0xb18e('0x5b')](_0xc7c499[_0xb18e('0x5a')]);_0xc7c499['remoteUri']=intUtil[_0xb18e('0x5b')](_0xc7c499[_0xb18e('0x53')]);if(_0x160fdc&&_0x160fdc[_0xb18e('0x7a')]){logger[_0xb18e('0x22')]('['+_0x55d8d6['lastevent'][_0xb18e('0x7b')]()+']','Recording\x20is\x20enabled!');_0x55d8d6[_0xb18e('0x5f')]=util[_0xb18e('0x41')](_0xb18e('0x5d'),_0xc7c499['serverUrl'],_0x55d8d6[_0xb18e('0x5e')],md5(_0x55d8d6[_0xb18e('0x5e')]));}else{_0x55d8d6[_0xb18e('0x5f')]='';}return getConnection(_0xc7c499)[_0xb18e('0x20')](function(_0x15176e){_0xea55b4=_0x15176e;if(!_[_0xb18e('0x7c')](_0x35f722)){return getUser(_0xc7c499,_0x35f722[_0xb18e('0x4f')],_0xea55b4);}else{return getUser(_0xc7c499,null,_0xea55b4);}})[_0xb18e('0x20')](function(_0x455ca6){_0x532858=_0x455ca6;return getEndUser(_0xc7c499,_0x290d8a,_0x55d8d6[_0xb18e('0x60')],_0x55d8d6[_0xb18e('0x61')],_0xea55b4);})[_0xb18e('0x20')](function(_0x548378){_0x4e8d17=_0x548378;return getTicket(_0xc7c499,_0x532858,_0x4e8d17,_0x290d8a,_0x55d8d6,_0x290d8a[_0xb18e('0x62')],_0xea55b4);})[_0xb18e('0x20')](function(_0x21aa0c){_0x9423d5=_0x21aa0c;logger[_0xb18e('0x22')]('['+_0x55d8d6['lastevent'][_0xb18e('0x7b')]()+_0xb18e('0x7d'),_0x9423d5['id']);logger[_0xb18e('0x22')]('['+_0x55d8d6[_0xb18e('0x7e')][_0xb18e('0x7b')]()+_0xb18e('0x7f'),_0xc7c499['type']);})['catch'](function(_0x5bc0a2){logger['error']('['+_0x55d8d6[_0xb18e('0x7e')][_0xb18e('0x7b')]()+']',_0x5bc0a2);});}; \ 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 38278fb..c1398a4 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 _0xf617=[']\x20POST\x20incident\x20entity\x20schema','ticketId','ticketNumber','number',']\x20getTicket\x20crm','label','?sysparm_query=name%3D','label_entry','push','all','Tags','map','%26sysparm_record_target%3Dincident','%26sysparm_record_list%3Dactive%253Dtrue','%255EORDERBYDESCnumber','format','user:%s','emit','trigger:browser:url','sysparm_limit=1','sysparm_display_value=true','remoteUri','serverUrl','stripTrailingSlash','%s/api/now/table/','isNil','email','outbound','callDirection','queue','unmanaged','uniqueid','monitor_format','Recording\x20is\x20enabled!','recordingURL','recordingFormat','none','[OUTBOUND]','The\x20ticket\x20ID\x20is:\x20%s','call\x20direction:\x20%s','Displaying\x20call\x20in\x20a\x20new\x20tab...',']\x20Error\x20running\x20ServiceNow\x20integration','inspect','bluebird','request-promise','md5','ioredis','./util','../../../../config/environment','../../../../config/logger','servicenow','redis','defaults','localhost','socket.io-emitter','GET','then','result','adminId','sys_id','info','toUpperCase','],\x20getAdminUser\x20crm','error','message','validateEmail','userEmail','sys_user?sysparm_query=email%3D','],\x20getUser\x20rp\x20obj','length','active','userId','catch',']\x20using\x20admin\x20profile','adminEmail','],\x20createEndUser\x20input\x20crm','POST','sys_user?','endUserNumber','true','System','],\x20EndUser\x20schema','endUserId','],\x20getEndUser\x20input\x20crm','sys_user?sysparm_query=phone%3D','forEach','includes','string','picklist','nameField','toLowerCase','content','type','customField','idField','toString','variable','customVariable','Variable','name',']\x20getTicket\x20input\x20crm','incident','assign','getString','Subjects','Descriptions','Fields'];(function(_0x382760,_0x59c55f){var _0x3ca405=function(_0x21fae1){while(--_0x21fae1){_0x382760['push'](_0x382760['shift']());}};_0x3ca405(++_0x59c55f);}(_0xf617,0x16c));var _0x7f61=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0xf617[_0x3dd15e];return _0x231fd0;};'use strict';var _=require('lodash');var Promise=require(_0x7f61('0x0'));var rp=require(_0x7f61('0x1'));var util=require('util');var md5=require(_0x7f61('0x2'));var Redis=require(_0x7f61('0x3'));var intUtil=require(_0x7f61('0x4'));var config=require(_0x7f61('0x5'));var logger=require(_0x7f61('0x6'))(_0x7f61('0x7'));config[_0x7f61('0x8')]=_[_0x7f61('0x9')](config['redis'],{'host':_0x7f61('0xa'),'port':0x18eb});var io=require(_0x7f61('0xb'))(new Redis(config['redis']));function getAdminUser(_0x13f812,_0x3f71ba,_0x1e32d9,_0x1693c1,_0x1ffeb9,_0x1085f5){return new Promise(function(_0x21aa88,_0xf655f6){var _0x24fc9b={'method':_0x7f61('0xc'),'uri':_0x1693c1+'sys_user?sysparm_query=user_name%3Dadmin'+'&'+_0x1ffeb9+'&'+_0x1085f5,'auth':_0x3f71ba,'json':!![]};return rp(_0x24fc9b)[_0x7f61('0xd')](function(_0x33f16f){if(_0x33f16f[_0x7f61('0xe')]['length']>0x0){_0x1e32d9[_0x7f61('0xf')]=_0x33f16f['result'][0x0][_0x7f61('0x10')];}logger[_0x7f61('0x11')]('['+[_0x13f812[_0x7f61('0x12')]()]+_0x7f61('0x13'),_0x1e32d9);_0x21aa88(_0x1e32d9);})['catch'](function(_0xf1e7e5){logger[_0x7f61('0x14')]('['+[_0x13f812[_0x7f61('0x12')]()]+']',_0xf1e7e5['message']);_0xf655f6(_0xf1e7e5[_0x7f61('0x15')]);});});}function getUser(_0x14f7d1,_0x42eb2e,_0x31aec9,_0x4a763e,_0x2b1abc){return function(_0x551566){logger['info']('['+[_0x14f7d1['toUpperCase']()]+'],\x20getUser\x20input\x20crm',_0x551566);return new Promise(function(_0x122f38,_0x22be2a){if(intUtil[_0x7f61('0x16')](_0x551566[_0x7f61('0x17')])){var _0x22d543={'method':_0x7f61('0xc'),'uri':_0x31aec9+_0x7f61('0x18')+_0x551566[_0x7f61('0x17')]+'&'+_0x4a763e+'&'+_0x2b1abc,'auth':_0x42eb2e,'json':!![]};logger[_0x7f61('0x11')]('['+[_0x14f7d1[_0x7f61('0x12')]()]+_0x7f61('0x19'),_0x22d543);return rp(_0x22d543)[_0x7f61('0xd')](function(_0x417da9){logger[_0x7f61('0x11')]('['+[_0x14f7d1[_0x7f61('0x12')]()]+'],\x20getUser\x20entity',_0x417da9);if(_0x417da9[_0x7f61('0xe')][_0x7f61('0x1a')]>0x0&&String(_0x417da9[_0x7f61('0xe')][0x0][_0x7f61('0x1b')])==='true'){_0x551566[_0x7f61('0x1c')]=_0x417da9[_0x7f61('0xe')][0x0]['sys_id'];}else{_0x551566['userId']=_0x551566[_0x7f61('0xf')];_0x551566['userEmail']=_0x551566['adminEmail'];}logger[_0x7f61('0x11')]('['+[_0x14f7d1[_0x7f61('0x12')]()]+'],\x20getUser\x20crm',_0x551566);_0x122f38(_0x551566);})[_0x7f61('0x1d')](function(_0x44a226){logger['error']('['+[_0x14f7d1[_0x7f61('0x12')]()]+']',_0x44a226[_0x7f61('0x15')]);_0x22be2a(_0x44a226[_0x7f61('0x15')]);});}else{logger[_0x7f61('0x11')]('['+[_0x14f7d1[_0x7f61('0x12')]()]+_0x7f61('0x1e'));_0x551566[_0x7f61('0x1c')]=_0x551566[_0x7f61('0xf')];_0x551566[_0x7f61('0x17')]=_0x551566[_0x7f61('0x1f')];_0x122f38(_0x551566);}});};}function createEndUser(_0x55e693,_0x10b33d,_0x45dd5e,_0x4172ae,_0x4a2175){logger['info']('['+[_0x55e693['toUpperCase']()]+_0x7f61('0x20'),_0x45dd5e);return new Promise(function(_0x54a114,_0x39880a){var _0x53d2b0={'method':_0x7f61('0x21'),'uri':_0x4172ae+_0x7f61('0x22')+_0x4a2175,'body':{'user_name':_0x45dd5e['endUserNumber'],'roles':'user','first_name':_0x45dd5e[_0x7f61('0x23')],'active':_0x7f61('0x24'),'date_format':_0x7f61('0x25'),'phone':_0x45dd5e[_0x7f61('0x23')]},'auth':_0x10b33d,'json':!![]};return rp(_0x53d2b0)['then'](function(_0x893651){logger[_0x7f61('0x11')]('['+[_0x55e693[_0x7f61('0x12')]()]+_0x7f61('0x26'),_0x893651[_0x7f61('0xe')]);_0x45dd5e[_0x7f61('0x27')]=_0x893651[_0x7f61('0xe')][_0x7f61('0x10')];_0x54a114(_0x45dd5e);})[_0x7f61('0x1d')](function(_0x5329a7){logger['error']('['+[_0x55e693[_0x7f61('0x12')]()]+']',_0x5329a7[_0x7f61('0x15')]);_0x39880a(_0x5329a7[_0x7f61('0x15')]);});});}function getEndUser(_0x2f053b,_0x47bc46,_0x38afd3,_0x312454,_0x2bf7d4){return function(_0x37f144){logger['info']('['+[_0x2f053b[_0x7f61('0x12')]()]+_0x7f61('0x28'),_0x37f144);return new Promise(function(_0x313f4d,_0x3ed87e){var _0x26052e={'method':_0x7f61('0xc'),'uri':_0x38afd3+_0x7f61('0x29')+_0x37f144[_0x7f61('0x23')]+'&'+_0x312454+'&'+_0x2bf7d4,'auth':_0x47bc46,'json':!![]};return rp(_0x26052e)[_0x7f61('0xd')](function(_0xb3a6c7){if(_0xb3a6c7[_0x7f61('0xe')]['length']>0x0){_0x37f144[_0x7f61('0x27')]=_0xb3a6c7['result'][0x0]['sys_id'];logger['info']('['+[_0x2f053b[_0x7f61('0x12')]()]+'],\x20getEndUser\x20crm',_0x37f144);_0x313f4d(_0x37f144);}else{return createEndUser(_0x2f053b,_0x47bc46,_0x37f144,_0x38afd3,_0x312454)['then'](function(_0x35b116){logger['info']('['+[_0x2f053b[_0x7f61('0x12')]()]+'],\x20createEndUser\x20crm',_0x35b116);_0x313f4d(_0x35b116);});}})[_0x7f61('0x1d')](function(_0x50d498){logger[_0x7f61('0x14')]('['+[_0x2f053b[_0x7f61('0x12')]()]+']',_0x50d498['message']);_0x3ed87e(_0x50d498['message']);});});};}function getCustomFields(_0x3685c1,_0x6cbb4b){var _0x20ed6b={};if(_0x3685c1['length']>0x0){_[_0x7f61('0x2a')](_0x3685c1,function(_0x117976){if(_[_0x7f61('0x2b')]([_0x7f61('0x2c'),_0x7f61('0x2d')],_0x117976['type'])&&_0x117976[_0x7f61('0x2e')]&&!_0x117976['customField']){_0x20ed6b[_0x117976[_0x7f61('0x2e')][_0x7f61('0x2f')]()]=_0x117976[_0x7f61('0x30')]['toString']();}else if(_[_0x7f61('0x2b')]([_0x7f61('0x2c'),_0x7f61('0x2d')],_0x117976[_0x7f61('0x31')])&&_0x117976['idField']&&_0x117976[_0x7f61('0x32')]){_0x20ed6b[_0x117976[_0x7f61('0x33')][_0x7f61('0x2f')]()]=_0x117976['content'][_0x7f61('0x34')]();}else if(_0x117976[_0x7f61('0x31')]===_0x7f61('0x35')&&_0x117976['variableName']&&_0x117976[_0x7f61('0x33')]&&_0x117976['customField']){_0x20ed6b[_0x117976[_0x7f61('0x33')][_0x7f61('0x2f')]()]=_0x6cbb4b[_0x117976['variableName']]['toString']();}else if(_0x117976[_0x7f61('0x31')]===_0x7f61('0x36')&&_0x117976[_0x7f61('0x37')]&&_0x117976[_0x7f61('0x37')][_0x7f61('0x38')]&&_0x117976[_0x7f61('0x33')]&&_0x117976[_0x7f61('0x32')]){_0x20ed6b[_0x117976[_0x7f61('0x33')][_0x7f61('0x2f')]()]=_0x6cbb4b[_0x117976[_0x7f61('0x37')][_0x7f61('0x38')][_0x7f61('0x2f')]()][_0x7f61('0x34')]();}});}return _0x20ed6b;}function getTicket(_0x3ff30f,_0x47a9f0,_0x59e91a,_0x2d4a4f,_0x3db7b4,_0x2ed872){return function(_0x474536){logger[_0x7f61('0x11')]('['+[_0x3ff30f['toUpperCase']()]+_0x7f61('0x39'),_0x474536);return new Promise(function(_0x275826,_0x63450a){var _0x2794b9=_0x3ff30f['toLowerCase']()==='outbound'?_0x474536[_0x7f61('0x1c')]:_0x474536[_0x7f61('0x27')];var _0x3a5c62={'method':'POST','uri':_0x59e91a+_0x7f61('0x3a')+'?'+_0x2ed872,'body':Object[_0x7f61('0x3b')]({},{'active':_0x7f61('0x24'),'caller_id':_0x2794b9,'assigned_to':_0x474536[_0x7f61('0x1c')],'short_description':intUtil[_0x7f61('0x3c')](_0x2d4a4f[_0x7f61('0x3d')],_0x3db7b4,'\x20'),'description':intUtil[_0x7f61('0x3c')](_0x2d4a4f[_0x7f61('0x3e')],_0x3db7b4,'\x0a')},getCustomFields(_0x2d4a4f[_0x7f61('0x3f')],_0x3db7b4)),'auth':_0x47a9f0,'json':!![]};return rp(_0x3a5c62)[_0x7f61('0xd')](function(_0x1d0257){logger[_0x7f61('0x11')]('['+[_0x3ff30f[_0x7f61('0x12')]()]+_0x7f61('0x40'),_0x1d0257[_0x7f61('0xe')]);_0x474536[_0x7f61('0x41')]=_0x1d0257['result'][_0x7f61('0x10')];_0x474536[_0x7f61('0x42')]=_0x1d0257[_0x7f61('0xe')][_0x7f61('0x43')];logger[_0x7f61('0x11')]('['+[_0x3ff30f[_0x7f61('0x12')]()]+_0x7f61('0x44'),_0x474536);_0x275826(_0x474536);})['catch'](function(_0x5df93a){logger[_0x7f61('0x14')]('['+[_0x3ff30f[_0x7f61('0x12')]()]+']',_0x5df93a['message']);_0x63450a(_0x5df93a[_0x7f61('0x15')]);});});};}function createRemoteTag(_0xe1cd16,_0x40092e,_0x15be74,_0x23929a){return new Promise(function(_0x4d6725,_0x259e93){var _0x5b4018={'method':_0x7f61('0x21'),'uri':_0x15be74+'label'+'?'+_0x23929a,'body':{'short_description':_0xe1cd16,'global':!![],'active':!![],'name':_0xe1cd16},'auth':_0x40092e,'json':!![]};return rp(_0x5b4018)[_0x7f61('0xd')](function(_0x3a18e2){var _0x34677d=_0x3a18e2['result'][_0x7f61('0x10')];_0x4d6725(_0x34677d);});});}function getRemoteTag(_0x392e69,_0x29264f,_0x4d406f,_0x2c4944,_0x2189cb){return new Promise(function(_0x5d70ae,_0x24ff0c){var _0x5f27c8={'method':_0x7f61('0xc'),'uri':_0x4d406f+_0x7f61('0x45')+_0x7f61('0x46')+_0x392e69+'&'+_0x2c4944,'auth':_0x29264f,'json':!![]};return rp(_0x5f27c8)[_0x7f61('0xd')](function(_0x39e4d4){if(_0x39e4d4['result'][_0x7f61('0x1a')]>0x0){var _0x541cd4=_0x39e4d4[_0x7f61('0xe')][0x0]['sys_id'];_0x5d70ae(_0x541cd4);}else{return createRemoteTag(_0x392e69,_0x29264f,_0x4d406f,_0x2c4944)[_0x7f61('0xd')](function(_0x294719){_0x5d70ae(_0x294719);});}});});}function assignTagToIncident(_0x4ddc44,_0xb15799,_0x5a10d2,_0x4c427b,_0x67a5c8){return new Promise(function(_0x59a947,_0x4515d3){var _0x435f09={'method':_0x7f61('0x21'),'uri':_0x5a10d2+_0x7f61('0x47')+'?'+_0x67a5c8,'body':{'label':_0x4ddc44,'table':_0x7f61('0x3a'),'id_type':'Incident','table_key':_0x4c427b[_0x7f61('0x41')],'title':'Incident\x20-\x20'+_0x4c427b[_0x7f61('0x42')],'id_display':_0x4c427b[_0x7f61('0x42')]},'auth':_0xb15799,'json':!![]};return rp(_0x435f09)[_0x7f61('0xd')](function(_0x2655cb){_0x59a947();})['catch'](function(){_0x59a947();});});}function manageTags(_0x2d4ce5,_0x3a7fc7,_0x15042a,_0x45069b,_0x3666c8,_0x582865,_0x301123){return new Promise(function(_0x5e9812,_0x191328){var _0x2c2de5=[];_0x3a7fc7['forEach'](function(_0x2a51f5){_0x2c2de5[_0x7f61('0x48')](getRemoteTag(_0x2a51f5,_0x15042a,_0x45069b,_0x582865,_0x301123));});return Promise[_0x7f61('0x49')](_0x2c2de5)['then'](function(_0x9a60c5){if(_0x9a60c5[_0x7f61('0x1a')]){logger[_0x7f61('0x11')]('['+[_0x2d4ce5[_0x7f61('0x12')]()]+']\x20arrayPromises:\x20IDs\x20in\x20table\x20label',_0x9a60c5);var _0x5518cc=[];_0x9a60c5[_0x7f61('0x2a')](function(_0x2b89b5){_0x5518cc['push'](assignTagToIncident(_0x2b89b5,_0x15042a,_0x45069b,_0x3666c8,_0x582865));});return Promise['all'](_0x5518cc)[_0x7f61('0xd')](function(){_0x5e9812();})[_0x7f61('0x1d')](function(){_0x5e9812();});}else{_0x5e9812();}});});}function getTags(_0x74c244,_0x5b88a2,_0x5ee038,_0x2dd25a,_0x27e6b7,_0x425537){return function(_0xfe05e9){return new Promise(function(_0x4a6c46,_0x375640){var _0x38da5c=[];var _0x34fc29=_0x2dd25a[_0x7f61('0x4a')];if(_0x34fc29&&_0x34fc29['length']>0x0){_0x38da5c=_[_0x7f61('0x4b')](_0x34fc29,_0x7f61('0x38'));}if(_0x38da5c[_0x7f61('0x1a')]>0x0){return manageTags(_0x74c244,_0x38da5c,_0x5b88a2,_0x5ee038,_0xfe05e9,_0x27e6b7,_0x425537)['then'](function(){_0x4a6c46(_0xfe05e9);});}else{_0x4a6c46(_0xfe05e9);}});};}function emit(_0x404043,_0x54ca44,_0x4a6e99){var _0x38ff68=_0x7f61('0x4c')+'%26sysparm_record_row%3D1%26sysparm_record_rows%3D39'+_0x7f61('0x4d')+_0x7f61('0x4e');var _0x534dc9={'uri':_0x404043+'/nav_to.do?uri=incident.do?sys_id%3D'+_0x4a6e99+_0x38ff68};io['to'](util[_0x7f61('0x4f')](_0x7f61('0x50'),_0x54ca44))[_0x7f61('0x51')](_0x7f61('0x52'),_0x534dc9);}exports['cs']=function(_0x495bdf,_0x29224e,_0x17749a,_0x3d96e3,_0x286c02,_0x598685,_0x57a7f5,_0x1d40fd){var _0x4e22a8={};var _0x55510c={'user':_0x598685['username'],'pass':_0x598685['password']};var _0x4d4c0b=_0x7f61('0x53');var _0x5757dd=_0x7f61('0x54');_0x598685[_0x7f61('0x55')]=intUtil['stripTrailingSlash'](_0x598685[_0x7f61('0x55')]);_0x598685[_0x7f61('0x56')]=intUtil[_0x7f61('0x57')](_0x598685['serverUrl']);var _0x131992=util['format'](_0x7f61('0x58'),_0x598685[_0x7f61('0x55')]);_0x4e22a8['userEmail']=!_[_0x7f61('0x59')](_0x3d96e3)?_0x3d96e3[_0x7f61('0x5a')]:null;_0x4e22a8[_0x7f61('0x1f')]=_0x598685[_0x7f61('0x5a')];_0x4e22a8[_0x7f61('0x23')]=_0x1d40fd['toLowerCase']()===_0x7f61('0x5b')?_0x29224e['destcalleridnum']:_0x29224e['calleridnum'];_0x4e22a8[_0x7f61('0x5c')]=_0x1d40fd===_0x7f61('0x5d')||_0x1d40fd===_0x7f61('0x5e')?_0x7f61('0x5d'):_0x7f61('0x5b');var _0x1c7e6d=util[_0x7f61('0x4f')]('%s/api/voice/recordings/%s/downloads?type=uniqueid&token=%s',_0x598685[_0x7f61('0x56')],_0x29224e[_0x7f61('0x5f')],md5(_0x29224e[_0x7f61('0x5f')]));if(_0x286c02&&_0x286c02[_0x7f61('0x60')]){logger[_0x7f61('0x11')]('[QUEUE]',_0x7f61('0x61'));_0x29224e[_0x7f61('0x62')]=_0x1c7e6d;}else if(_0x57a7f5&&_0x57a7f5[_0x7f61('0x63')]&&_0x57a7f5[_0x7f61('0x63')]!==_0x7f61('0x64')){logger[_0x7f61('0x11')](_0x7f61('0x65'),_0x7f61('0x61'));_0x29224e[_0x7f61('0x62')]=_0x1c7e6d;}else{_0x29224e['recordingURL']='';}return getAdminUser(_0x1d40fd,_0x55510c,_0x4e22a8,_0x131992,_0x5757dd,_0x4d4c0b)[_0x7f61('0xd')](getUser(_0x1d40fd,_0x55510c,_0x131992,_0x5757dd,_0x4d4c0b))[_0x7f61('0xd')](getEndUser(_0x1d40fd,_0x55510c,_0x131992,_0x5757dd,_0x4d4c0b))['then'](getTicket(_0x1d40fd,_0x55510c,_0x131992,_0x17749a,_0x29224e,_0x5757dd))['then'](function(_0x1a3f72){logger['info'](util[_0x7f61('0x4f')](_0x7f61('0x66'),_0x1a3f72[_0x7f61('0x41')]));logger['info'](util['format'](_0x7f61('0x67'),_0x1d40fd));if(_0x1d40fd!==_0x7f61('0x5e')){logger[_0x7f61('0x11')]('['+[_0x1d40fd[_0x7f61('0x12')]()]+']',_0x7f61('0x68'));emit(_0x598685[_0x7f61('0x55')],_0x3d96e3[_0x7f61('0x38')],_0x1a3f72[_0x7f61('0x41')]);}})['catch'](function(_0x280d0d){logger[_0x7f61('0x14')]('['+[_0x1d40fd[_0x7f61('0x12')]()]+_0x7f61('0x69'),util[_0x7f61('0x6a')](_0x280d0d,{'showHidden':!![],'depth':null}));});}; \ No newline at end of file +var _0xaeaa=['string','picklist','type','nameField','customField','toLowerCase','content','toString','idField','variable','variableName','customVariable','Variable','name',']\x20getTicket\x20input\x20crm','outbound','incident','assign','getString','Subjects','Fields',']\x20POST\x20incident\x20entity\x20schema','number',']\x20getTicket\x20crm','label','?sysparm_query=name%3D','Incident','Incident\x20-\x20','ticketNumber','push','all',']\x20arrayPromises:\x20IDs\x20in\x20table\x20label','Tags','map','%26sysparm_record_target%3Dincident','%26sysparm_record_row%3D1%26sysparm_record_rows%3D39','%26sysparm_record_list%3Dactive%253Dtrue','%255EORDERBYDESCnumber','/nav_to.do?uri=incident.do?sys_id%3D','format','user:%s','emit','trigger:browser:url','username','password','sysparm_limit=1','sysparm_display_value=true','stripTrailingSlash','remoteUri','serverUrl','%s/api/now/table/','isNil','email','destcalleridnum','calleridnum','queue','unmanaged','uniqueid','monitor_format','[QUEUE]','Recording\x20is\x20enabled!','recordingURL','recordingFormat','none','The\x20ticket\x20ID\x20is:\x20%s','ticketId','call\x20direction:\x20%s','Displaying\x20call\x20in\x20a\x20new\x20tab...',']\x20Error\x20running\x20ServiceNow\x20integration','inspect','lodash','bluebird','request-promise','util','md5','./util','../../../../config/environment','servicenow','redis','defaults','localhost','GET','sys_user?sysparm_query=user_name%3Dadmin','then','result','length','adminId','sys_id','info','toUpperCase','],\x20getAdminUser\x20crm','catch','error','message','],\x20getUser\x20input\x20crm','validateEmail','userEmail','sys_user?sysparm_query=email%3D','],\x20getUser\x20rp\x20obj','],\x20getUser\x20entity','active','true','userId','adminEmail',']\x20using\x20admin\x20profile','],\x20createEndUser\x20input\x20crm','POST','sys_user?','endUserNumber','user','System','],\x20EndUser\x20schema','endUserId','],\x20getEndUser\x20input\x20crm','sys_user?sysparm_query=phone%3D','],\x20getEndUser\x20crm','],\x20createEndUser\x20crm','forEach','includes'];(function(_0x2c91b8,_0x439637){var _0x479161=function(_0xea626e){while(--_0xea626e){_0x2c91b8['push'](_0x2c91b8['shift']());}};_0x479161(++_0x439637);}(_0xaeaa,0x134));var _0xaaea=function(_0x5e4d26,_0x432f02){_0x5e4d26=_0x5e4d26-0x0;var _0x136714=_0xaeaa[_0x5e4d26];return _0x136714;};'use strict';var _=require(_0xaaea('0x0'));var Promise=require(_0xaaea('0x1'));var rp=require(_0xaaea('0x2'));var util=require(_0xaaea('0x3'));var md5=require(_0xaaea('0x4'));var Redis=require('ioredis');var intUtil=require(_0xaaea('0x5'));var config=require(_0xaaea('0x6'));var logger=require('../../../../config/logger')(_0xaaea('0x7'));config[_0xaaea('0x8')]=_[_0xaaea('0x9')](config['redis'],{'host':_0xaaea('0xa'),'port':0x18eb});var io=require('socket.io-emitter')(new Redis(config[_0xaaea('0x8')]));function getAdminUser(_0x52a9c8,_0x566e1a,_0x2c474a,_0x585c48,_0x38e499,_0x44cdcc){return new Promise(function(_0x5f13d6,_0x59f98b){var _0x3ac95e={'method':_0xaaea('0xb'),'uri':_0x585c48+_0xaaea('0xc')+'&'+_0x38e499+'&'+_0x44cdcc,'auth':_0x566e1a,'json':!![]};return rp(_0x3ac95e)[_0xaaea('0xd')](function(_0x1948d2){if(_0x1948d2[_0xaaea('0xe')][_0xaaea('0xf')]>0x0){_0x2c474a[_0xaaea('0x10')]=_0x1948d2[_0xaaea('0xe')][0x0][_0xaaea('0x11')];}logger[_0xaaea('0x12')]('['+[_0x52a9c8[_0xaaea('0x13')]()]+_0xaaea('0x14'),_0x2c474a);_0x5f13d6(_0x2c474a);})[_0xaaea('0x15')](function(_0xd29af6){logger[_0xaaea('0x16')]('['+[_0x52a9c8[_0xaaea('0x13')]()]+']',_0xd29af6['message']);_0x59f98b(_0xd29af6[_0xaaea('0x17')]);});});}function getUser(_0x4f8a84,_0x37c297,_0x498523,_0x3ecf7e,_0x33a6c5){return function(_0x4ea7f5){logger['info']('['+[_0x4f8a84[_0xaaea('0x13')]()]+_0xaaea('0x18'),_0x4ea7f5);return new Promise(function(_0x4a3ae3,_0x30803f){if(intUtil[_0xaaea('0x19')](_0x4ea7f5[_0xaaea('0x1a')])){var _0x23ba60={'method':'GET','uri':_0x498523+_0xaaea('0x1b')+_0x4ea7f5[_0xaaea('0x1a')]+'&'+_0x3ecf7e+'&'+_0x33a6c5,'auth':_0x37c297,'json':!![]};logger[_0xaaea('0x12')]('['+[_0x4f8a84[_0xaaea('0x13')]()]+_0xaaea('0x1c'),_0x23ba60);return rp(_0x23ba60)[_0xaaea('0xd')](function(_0x1f15f6){logger[_0xaaea('0x12')]('['+[_0x4f8a84[_0xaaea('0x13')]()]+_0xaaea('0x1d'),_0x1f15f6);if(_0x1f15f6[_0xaaea('0xe')][_0xaaea('0xf')]>0x0&&String(_0x1f15f6[_0xaaea('0xe')][0x0][_0xaaea('0x1e')])===_0xaaea('0x1f')){_0x4ea7f5[_0xaaea('0x20')]=_0x1f15f6[_0xaaea('0xe')][0x0][_0xaaea('0x11')];}else{_0x4ea7f5[_0xaaea('0x20')]=_0x4ea7f5[_0xaaea('0x10')];_0x4ea7f5[_0xaaea('0x1a')]=_0x4ea7f5[_0xaaea('0x21')];}logger['info']('['+[_0x4f8a84['toUpperCase']()]+'],\x20getUser\x20crm',_0x4ea7f5);_0x4a3ae3(_0x4ea7f5);})[_0xaaea('0x15')](function(_0x51190e){logger[_0xaaea('0x16')]('['+[_0x4f8a84[_0xaaea('0x13')]()]+']',_0x51190e[_0xaaea('0x17')]);_0x30803f(_0x51190e['message']);});}else{logger[_0xaaea('0x12')]('['+[_0x4f8a84[_0xaaea('0x13')]()]+_0xaaea('0x22'));_0x4ea7f5[_0xaaea('0x20')]=_0x4ea7f5['adminId'];_0x4ea7f5['userEmail']=_0x4ea7f5[_0xaaea('0x21')];_0x4a3ae3(_0x4ea7f5);}});};}function createEndUser(_0x2d676c,_0x577f19,_0x4882e7,_0x3a432e,_0x92f8f7){logger[_0xaaea('0x12')]('['+[_0x2d676c[_0xaaea('0x13')]()]+_0xaaea('0x23'),_0x4882e7);return new Promise(function(_0x422062,_0x565610){var _0x1739d3={'method':_0xaaea('0x24'),'uri':_0x3a432e+_0xaaea('0x25')+_0x92f8f7,'body':{'user_name':_0x4882e7[_0xaaea('0x26')],'roles':_0xaaea('0x27'),'first_name':_0x4882e7[_0xaaea('0x26')],'active':_0xaaea('0x1f'),'date_format':_0xaaea('0x28'),'phone':_0x4882e7['endUserNumber']},'auth':_0x577f19,'json':!![]};return rp(_0x1739d3)[_0xaaea('0xd')](function(_0x124e8b){logger['info']('['+[_0x2d676c['toUpperCase']()]+_0xaaea('0x29'),_0x124e8b[_0xaaea('0xe')]);_0x4882e7[_0xaaea('0x2a')]=_0x124e8b[_0xaaea('0xe')]['sys_id'];_0x422062(_0x4882e7);})[_0xaaea('0x15')](function(_0x3bb66b){logger[_0xaaea('0x16')]('['+[_0x2d676c[_0xaaea('0x13')]()]+']',_0x3bb66b['message']);_0x565610(_0x3bb66b[_0xaaea('0x17')]);});});}function getEndUser(_0x5580e5,_0x4ad2f2,_0x5400c7,_0x1e4b81,_0x26dd92){return function(_0x373fe3){logger[_0xaaea('0x12')]('['+[_0x5580e5['toUpperCase']()]+_0xaaea('0x2b'),_0x373fe3);return new Promise(function(_0x329763,_0x4be61c){var _0x5a7b8d={'method':_0xaaea('0xb'),'uri':_0x5400c7+_0xaaea('0x2c')+_0x373fe3[_0xaaea('0x26')]+'&'+_0x1e4b81+'&'+_0x26dd92,'auth':_0x4ad2f2,'json':!![]};return rp(_0x5a7b8d)[_0xaaea('0xd')](function(_0x3f0fa4){if(_0x3f0fa4[_0xaaea('0xe')][_0xaaea('0xf')]>0x0){_0x373fe3[_0xaaea('0x2a')]=_0x3f0fa4['result'][0x0]['sys_id'];logger[_0xaaea('0x12')]('['+[_0x5580e5['toUpperCase']()]+_0xaaea('0x2d'),_0x373fe3);_0x329763(_0x373fe3);}else{return createEndUser(_0x5580e5,_0x4ad2f2,_0x373fe3,_0x5400c7,_0x1e4b81)[_0xaaea('0xd')](function(_0xe6eb16){logger[_0xaaea('0x12')]('['+[_0x5580e5[_0xaaea('0x13')]()]+_0xaaea('0x2e'),_0xe6eb16);_0x329763(_0xe6eb16);});}})[_0xaaea('0x15')](function(_0x230988){logger['error']('['+[_0x5580e5[_0xaaea('0x13')]()]+']',_0x230988[_0xaaea('0x17')]);_0x4be61c(_0x230988[_0xaaea('0x17')]);});});};}function getCustomFields(_0x5d2a81,_0x45b095){var _0x4ba38c={};if(_0x5d2a81[_0xaaea('0xf')]>0x0){_[_0xaaea('0x2f')](_0x5d2a81,function(_0x13d5fc){if(_[_0xaaea('0x30')]([_0xaaea('0x31'),_0xaaea('0x32')],_0x13d5fc[_0xaaea('0x33')])&&_0x13d5fc[_0xaaea('0x34')]&&!_0x13d5fc[_0xaaea('0x35')]){_0x4ba38c[_0x13d5fc[_0xaaea('0x34')][_0xaaea('0x36')]()]=_0x13d5fc[_0xaaea('0x37')][_0xaaea('0x38')]();}else if(_[_0xaaea('0x30')]([_0xaaea('0x31'),_0xaaea('0x32')],_0x13d5fc[_0xaaea('0x33')])&&_0x13d5fc[_0xaaea('0x39')]&&_0x13d5fc['customField']){_0x4ba38c[_0x13d5fc[_0xaaea('0x39')]['toLowerCase']()]=_0x13d5fc[_0xaaea('0x37')][_0xaaea('0x38')]();}else if(_0x13d5fc[_0xaaea('0x33')]===_0xaaea('0x3a')&&_0x13d5fc[_0xaaea('0x3b')]&&_0x13d5fc[_0xaaea('0x39')]&&_0x13d5fc[_0xaaea('0x35')]){_0x4ba38c[_0x13d5fc[_0xaaea('0x39')][_0xaaea('0x36')]()]=_0x45b095[_0x13d5fc['variableName']][_0xaaea('0x38')]();}else if(_0x13d5fc[_0xaaea('0x33')]===_0xaaea('0x3c')&&_0x13d5fc['Variable']&&_0x13d5fc[_0xaaea('0x3d')][_0xaaea('0x3e')]&&_0x13d5fc[_0xaaea('0x39')]&&_0x13d5fc[_0xaaea('0x35')]){_0x4ba38c[_0x13d5fc[_0xaaea('0x39')][_0xaaea('0x36')]()]=_0x45b095[_0x13d5fc['Variable'][_0xaaea('0x3e')]['toLowerCase']()]['toString']();}});}return _0x4ba38c;}function getTicket(_0x2ccc9c,_0x39a4d0,_0x5c78d0,_0x5c5ea4,_0x446a75,_0x457b76){return function(_0x1fc5ca){logger['info']('['+[_0x2ccc9c[_0xaaea('0x13')]()]+_0xaaea('0x3f'),_0x1fc5ca);return new Promise(function(_0x443808,_0x5f2524){var _0x4b485d=_0x2ccc9c['toLowerCase']()===_0xaaea('0x40')?_0x1fc5ca[_0xaaea('0x20')]:_0x1fc5ca[_0xaaea('0x2a')];var _0x4582b4={'method':'POST','uri':_0x5c78d0+_0xaaea('0x41')+'?'+_0x457b76,'body':Object[_0xaaea('0x42')]({},{'active':'true','caller_id':_0x4b485d,'assigned_to':_0x1fc5ca['userId'],'short_description':intUtil[_0xaaea('0x43')](_0x5c5ea4[_0xaaea('0x44')],_0x446a75,'\x20'),'description':intUtil[_0xaaea('0x43')](_0x5c5ea4['Descriptions'],_0x446a75,'\x0a')},getCustomFields(_0x5c5ea4[_0xaaea('0x45')],_0x446a75)),'auth':_0x39a4d0,'json':!![]};return rp(_0x4582b4)[_0xaaea('0xd')](function(_0x4cfcdf){logger[_0xaaea('0x12')]('['+[_0x2ccc9c['toUpperCase']()]+_0xaaea('0x46'),_0x4cfcdf[_0xaaea('0xe')]);_0x1fc5ca['ticketId']=_0x4cfcdf[_0xaaea('0xe')][_0xaaea('0x11')];_0x1fc5ca['ticketNumber']=_0x4cfcdf['result'][_0xaaea('0x47')];logger['info']('['+[_0x2ccc9c['toUpperCase']()]+_0xaaea('0x48'),_0x1fc5ca);_0x443808(_0x1fc5ca);})[_0xaaea('0x15')](function(_0x550b12){logger[_0xaaea('0x16')]('['+[_0x2ccc9c['toUpperCase']()]+']',_0x550b12[_0xaaea('0x17')]);_0x5f2524(_0x550b12[_0xaaea('0x17')]);});});};}function createRemoteTag(_0xdc2427,_0x5b8277,_0xb50cb7,_0x167ce8){return new Promise(function(_0x59b4f7,_0x598194){var _0x3b92db={'method':_0xaaea('0x24'),'uri':_0xb50cb7+'label'+'?'+_0x167ce8,'body':{'short_description':_0xdc2427,'global':!![],'active':!![],'name':_0xdc2427},'auth':_0x5b8277,'json':!![]};return rp(_0x3b92db)[_0xaaea('0xd')](function(_0x3a96e3){var _0x845e7d=_0x3a96e3['result'][_0xaaea('0x11')];_0x59b4f7(_0x845e7d);});});}function getRemoteTag(_0x29ba3e,_0x4f4819,_0x2fab2d,_0x752cbe,_0x3cce5c){return new Promise(function(_0xea3e3e,_0x96cc24){var _0x1faefb={'method':_0xaaea('0xb'),'uri':_0x2fab2d+_0xaaea('0x49')+_0xaaea('0x4a')+_0x29ba3e+'&'+_0x752cbe,'auth':_0x4f4819,'json':!![]};return rp(_0x1faefb)['then'](function(_0x268302){if(_0x268302[_0xaaea('0xe')][_0xaaea('0xf')]>0x0){var _0xbed1a4=_0x268302[_0xaaea('0xe')][0x0]['sys_id'];_0xea3e3e(_0xbed1a4);}else{return createRemoteTag(_0x29ba3e,_0x4f4819,_0x2fab2d,_0x752cbe)[_0xaaea('0xd')](function(_0x1e66cf){_0xea3e3e(_0x1e66cf);});}});});}function assignTagToIncident(_0x38de87,_0xb429cd,_0x1c9348,_0x537f36,_0x2ea84b){return new Promise(function(_0x41cfc0,_0x5a14a0){var _0x4b2167={'method':_0xaaea('0x24'),'uri':_0x1c9348+'label_entry'+'?'+_0x2ea84b,'body':{'label':_0x38de87,'table':_0xaaea('0x41'),'id_type':_0xaaea('0x4b'),'table_key':_0x537f36['ticketId'],'title':_0xaaea('0x4c')+_0x537f36['ticketNumber'],'id_display':_0x537f36[_0xaaea('0x4d')]},'auth':_0xb429cd,'json':!![]};return rp(_0x4b2167)['then'](function(_0x1d7628){_0x41cfc0();})['catch'](function(){_0x41cfc0();});});}function manageTags(_0x50d772,_0x25a71d,_0x6739f3,_0x1db7ed,_0x5c88ce,_0xab087b,_0x193b1c){return new Promise(function(_0x314157,_0x99f1f7){var _0x1574e4=[];_0x25a71d[_0xaaea('0x2f')](function(_0x5a4326){_0x1574e4[_0xaaea('0x4e')](getRemoteTag(_0x5a4326,_0x6739f3,_0x1db7ed,_0xab087b,_0x193b1c));});return Promise[_0xaaea('0x4f')](_0x1574e4)[_0xaaea('0xd')](function(_0x212c12){if(_0x212c12['length']){logger['info']('['+[_0x50d772[_0xaaea('0x13')]()]+_0xaaea('0x50'),_0x212c12);var _0x34386f=[];_0x212c12[_0xaaea('0x2f')](function(_0x26cb34){_0x34386f[_0xaaea('0x4e')](assignTagToIncident(_0x26cb34,_0x6739f3,_0x1db7ed,_0x5c88ce,_0xab087b));});return Promise[_0xaaea('0x4f')](_0x34386f)[_0xaaea('0xd')](function(){_0x314157();})[_0xaaea('0x15')](function(){_0x314157();});}else{_0x314157();}});});}function getTags(_0x476f53,_0x25fc48,_0x27e4e1,_0x561d24,_0x31671b,_0x8ae79e){return function(_0x402b85){return new Promise(function(_0x335ade,_0x355d40){var _0x15b5c3=[];var _0x418481=_0x561d24[_0xaaea('0x51')];if(_0x418481&&_0x418481[_0xaaea('0xf')]>0x0){_0x15b5c3=_[_0xaaea('0x52')](_0x418481,_0xaaea('0x3e'));}if(_0x15b5c3[_0xaaea('0xf')]>0x0){return manageTags(_0x476f53,_0x15b5c3,_0x25fc48,_0x27e4e1,_0x402b85,_0x31671b,_0x8ae79e)[_0xaaea('0xd')](function(){_0x335ade(_0x402b85);});}else{_0x335ade(_0x402b85);}});};}function emit(_0x3098a3,_0x3e3ad6,_0x49409e){var _0x5fc806=_0xaaea('0x53')+_0xaaea('0x54')+_0xaaea('0x55')+_0xaaea('0x56');var _0x4460a0={'uri':_0x3098a3+_0xaaea('0x57')+_0x49409e+_0x5fc806};io['to'](util[_0xaaea('0x58')](_0xaaea('0x59'),_0x3e3ad6))[_0xaaea('0x5a')](_0xaaea('0x5b'),_0x4460a0);}exports['cs']=function(_0x502767,_0x132ca4,_0x2169ce,_0x371fe7,_0x377fdf,_0x13e3aa,_0x2a1837,_0x49103e){var _0x15f260={};var _0x40f05c={'user':_0x13e3aa[_0xaaea('0x5c')],'pass':_0x13e3aa[_0xaaea('0x5d')]};var _0x2d42ab=_0xaaea('0x5e');var _0x5ec1f3=_0xaaea('0x5f');_0x13e3aa['remoteUri']=intUtil[_0xaaea('0x60')](_0x13e3aa[_0xaaea('0x61')]);_0x13e3aa[_0xaaea('0x62')]=intUtil[_0xaaea('0x60')](_0x13e3aa[_0xaaea('0x62')]);var _0x147806=util[_0xaaea('0x58')](_0xaaea('0x63'),_0x13e3aa[_0xaaea('0x61')]);_0x15f260[_0xaaea('0x1a')]=!_[_0xaaea('0x64')](_0x371fe7)?_0x371fe7[_0xaaea('0x65')]:null;_0x15f260[_0xaaea('0x21')]=_0x13e3aa[_0xaaea('0x65')];_0x15f260[_0xaaea('0x26')]=_0x49103e[_0xaaea('0x36')]()===_0xaaea('0x40')?_0x132ca4[_0xaaea('0x66')]:_0x132ca4[_0xaaea('0x67')];_0x15f260['callDirection']=_0x49103e===_0xaaea('0x68')||_0x49103e===_0xaaea('0x69')?_0xaaea('0x68'):_0xaaea('0x40');var _0x140931=util[_0xaaea('0x58')]('%s/api/voice/recordings/%s/downloads?type=uniqueid&token=%s',_0x13e3aa[_0xaaea('0x62')],_0x132ca4[_0xaaea('0x6a')],md5(_0x132ca4[_0xaaea('0x6a')]));if(_0x377fdf&&_0x377fdf[_0xaaea('0x6b')]){logger[_0xaaea('0x12')](_0xaaea('0x6c'),_0xaaea('0x6d'));_0x132ca4[_0xaaea('0x6e')]=_0x140931;}else if(_0x2a1837&&_0x2a1837[_0xaaea('0x6f')]&&_0x2a1837['recordingFormat']!==_0xaaea('0x70')){logger[_0xaaea('0x12')]('[OUTBOUND]',_0xaaea('0x6d'));_0x132ca4[_0xaaea('0x6e')]=_0x140931;}else{_0x132ca4[_0xaaea('0x6e')]='';}return getAdminUser(_0x49103e,_0x40f05c,_0x15f260,_0x147806,_0x5ec1f3,_0x2d42ab)[_0xaaea('0xd')](getUser(_0x49103e,_0x40f05c,_0x147806,_0x5ec1f3,_0x2d42ab))[_0xaaea('0xd')](getEndUser(_0x49103e,_0x40f05c,_0x147806,_0x5ec1f3,_0x2d42ab))[_0xaaea('0xd')](getTicket(_0x49103e,_0x40f05c,_0x147806,_0x2169ce,_0x132ca4,_0x5ec1f3))[_0xaaea('0xd')](function(_0x28bfe2){logger[_0xaaea('0x12')](util[_0xaaea('0x58')](_0xaaea('0x71'),_0x28bfe2[_0xaaea('0x72')]));logger['info'](util[_0xaaea('0x58')](_0xaaea('0x73'),_0x49103e));if(_0x49103e!=='unmanaged'){logger['info']('['+[_0x49103e[_0xaaea('0x13')]()]+']',_0xaaea('0x74'));emit(_0x13e3aa['remoteUri'],_0x371fe7['name'],_0x28bfe2[_0xaaea('0x72')]);}})[_0xaaea('0x15')](function(_0x1e45eb){logger[_0xaaea('0x16')]('['+[_0x49103e[_0xaaea('0x13')]()]+_0xaaea('0x75'),util[_0xaaea('0x76')](_0x1e45eb,{'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 dbe08e2..f624995 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 _0x3943=['uniqueid','The\x20User\x20ID\x20is:','calleridnum','The\x20Enduser\x20ID\x20is:','Inbound','Ticket\x20created!','The\x20Ticket\x20ID\x20is:','users','contacts','version','charAt','%s/#bwc/index.php?module=Calls&action=EditView&record=%s','Displaying\x20ticket\x20to\x20agent\x20in\x20a\x20new\x20tab...','user:%s','trigger:browser:url','catch','error','outbound','%s/service/v4_1/rest.php','none','[OUTBOUND]','destcalleridname','destcalleridnum','Fields','Outbound','%s/index.php?action=ajaxui#ajaxUILoc=index.php%3Fmodule%3DCalls%26action%3DEditView%26record%3D%s','unmanaged','lastevent','toUpperCase','calleridname','lodash','request-promise','bluebird','md5','util','../../../../config/environment','../../../../config/logger','defaults','localhost','socket.io-emitter','redis','POST','emit','info','Creating\x20new\x20ticket...','Subjects','assigned_user_id','created_by','description','getString','date_start','toISOString','duration_hours','duration_minutes','parent_id','parent_type','Contacts','direction','length','forEach','variableName','push','idField','set_entry','JSON','stringify','Calls','Basic\x20%s','toString','base64','get_server_info','isNil','Getting\x20agent\x20with\x20name','get_entry_list','Employees','format','INSTR\x20(\x20users.user_name,\x20\x22%s\x22)\x20>\x200','then','entry_list','user_name','value','resolve','name_value_list','user_id','Agent\x20not\x20available,\x20using\x20the\x20admin\x20account!','Searching\x20enduser\x20with\x20phone','contacts.phone_home\x20=\x20\x22%s\x22','name','phone_home','find','Enduser\x20found!','first_name','','Enduser\x20created.','debug','[HTTP]','merge','map','type','string','nameField','customField','content','custom_fields','variable','customVariable','Variable','toLowerCase','username','PLAIN','xCALLY\x20Motion\x20integration','sessionID','Account\x20%d\x20is\x20not\x20valid','set_relationship','queue','remoteUri','stripTrailingSlash','serverUrl','uri','monitor_format','[QUEUE]','Recording\x20is\x20enabled!','recordingURL','%s/api/voice/recordings/%s/downloads?type=uniqueid&token=%s'];(function(_0x5e5e4b,_0x4ea1ab){var _0x3b3e8f=function(_0x39cc91){while(--_0x39cc91){_0x5e5e4b['push'](_0x5e5e4b['shift']());}};_0x3b3e8f(++_0x4ea1ab);}(_0x3943,0x9a));var _0x3394=function(_0x592a47,_0x569c8f){_0x592a47=_0x592a47-0x0;var _0x3eec3b=_0x3943[_0x592a47];return _0x3eec3b;};'use strict';var _=require(_0x3394('0x0'));var rp=require(_0x3394('0x1'));var BPromise=require(_0x3394('0x2'));var md5=require(_0x3394('0x3'));var util=require(_0x3394('0x4'));var Redis=require('ioredis');var intUtil=require('./util');var config=require(_0x3394('0x5'));var logger=require(_0x3394('0x6'))('sugarcrm');config['redis']=_[_0x3394('0x7')](config['redis'],{'host':_0x3394('0x8'),'port':0x18eb});var io=require(_0x3394('0x9'))(new Redis(config[_0x3394('0xa')]));var def={'method':_0x3394('0xb'),'json':!![]};function emit(_0xdd2e23,_0x190af9,_0x2f5af4){io['to'](_0xdd2e23)[_0x3394('0xc')](_0x190af9,_0x2f5af4);}function getTicket(_0x2daf81,_0x16bc56,_0x44959e,_0x33620f,_0x10a9fc,_0xd49efc,_0x150400,_0x4d2b4f){logger[_0x3394('0xd')](_0x3394('0xe'));var _0x54417f=new Date();var _0x382c3a=[{'name':'name','value':intUtil['getString'](_0x33620f[_0x3394('0xf')],_0x10a9fc,'\x20')},{'name':_0x3394('0x10'),'value':_0x16bc56['id']},{'name':_0x3394('0x11'),'value':_0x16bc56['id']},{'name':_0x3394('0x12'),'value':intUtil[_0x3394('0x13')](_0x33620f['Descriptions'],_0x10a9fc,'\x0a')},{'name':_0x3394('0x14'),'value':_0x54417f[_0x3394('0x15')]()['slice'](0x0,0x13)['replace']('T','\x20')},{'name':_0x3394('0x16'),'value':'0'},{'name':_0x3394('0x17'),'value':'15'},{'name':_0x3394('0x18'),'value':_0x44959e['id']},{'name':_0x3394('0x19'),'value':_0x3394('0x1a')},{'name':'parent_name','value':_0x44959e['name']},{'name':_0x3394('0x1b'),'value':_0x4d2b4f}];if(_0xd49efc[_0x3394('0x1c')]){_[_0x3394('0x1d')](_0xd49efc,function(_0x56d269){if(_0x10a9fc[_0x56d269[_0x3394('0x1e')]]){_0x382c3a[_0x3394('0x1f')]({'name':_0x56d269[_0x3394('0x20')],'value':_0x10a9fc[_0x56d269[_0x3394('0x1e')]]});}});}return request({'form':{'method':_0x3394('0x21'),'input_type':_0x3394('0x22'),'response_type':'JSON','rest_data':JSON[_0x3394('0x23')]({'session':_0x150400['id'],'module_name':_0x3394('0x24'),'name_value_list':_0x382c3a})}});}function getAuth(_0x30833a){return util['format'](_0x3394('0x25'),new Buffer(_0x30833a['apiKey']+':X')[_0x3394('0x26')](_0x3394('0x27')));}function getServerInfo(_0x8267de){return request({'form':{'method':_0x3394('0x28'),'input_type':_0x3394('0x22'),'response_type':_0x3394('0x22'),'rest_data':JSON[_0x3394('0x23')]({'session':_0x8267de['id']})}});}function getUser(_0x51221a,_0x4c0145,_0x3d66f0){if(!_[_0x3394('0x29')](_0x4c0145)){logger[_0x3394('0xd')](_0x3394('0x2a'),_0x4c0145);return request({'form':{'method':_0x3394('0x2b'),'input_type':_0x3394('0x22'),'response_type':_0x3394('0x22'),'rest_data':JSON[_0x3394('0x23')]({'session':_0x3d66f0['id'],'module_name':_0x3394('0x2c'),'query':util[_0x3394('0x2d')](_0x3394('0x2e'),_0x4c0145),'order_by':'','offset':'0','select_fields':['id','name','user_name'],'link_name_to_fields_array':[],'max_results':-0x1,'deleted':'0'})}})[_0x3394('0x2f')](function(_0x2f07b9){if(_0x2f07b9[_0x3394('0x30')][_0x3394('0x1c')]){var _0x4abdee=_['find'](_0x2f07b9[_0x3394('0x30')],function(_0x3f1dd2){return _0x3f1dd2['name_value_list'][_0x3394('0x31')][_0x3394('0x32')]===_0x4c0145;});if(_0x4abdee){logger[_0x3394('0xd')]('Agent\x20found!');return BPromise[_0x3394('0x33')]({'id':_0x4abdee[_0x3394('0x34')]['id'][_0x3394('0x32')],'name':_0x4abdee[_0x3394('0x34')]['name'][_0x3394('0x32')]});}}logger[_0x3394('0xd')]('Agent\x20not\x20found,\x20using\x20the\x20admin\x20account!');return BPromise[_0x3394('0x33')]({'id':_0x3d66f0[_0x3394('0x34')][_0x3394('0x35')][_0x3394('0x32')],'name':_0x3d66f0[_0x3394('0x34')][_0x3394('0x31')][_0x3394('0x32')]});});}else{logger['info'](_0x3394('0x36'));return BPromise[_0x3394('0x33')]({'id':_0x3d66f0[_0x3394('0x34')][_0x3394('0x35')]['value'],'name':_0x3d66f0[_0x3394('0x34')][_0x3394('0x31')][_0x3394('0x32')]});}}function getEndUser(_0x29d067,_0x3f19ee,_0x392b6f,_0x1e05de){logger[_0x3394('0xd')](_0x3394('0x37'),_0x392b6f);return request({'form':{'method':_0x3394('0x2b'),'input_type':'JSON','response_type':_0x3394('0x22'),'rest_data':JSON[_0x3394('0x23')]({'session':_0x1e05de['id'],'module_name':_0x3394('0x1a'),'query':util[_0x3394('0x2d')](_0x3394('0x38'),_0x392b6f),'order_by':'','offset':'0','select_fields':['id',_0x3394('0x39'),_0x3394('0x3a')],'link_name_to_fields_array':[],'max_results':-0x1,'deleted':'0'})}})[_0x3394('0x2f')](function(_0x2cbfbb){if(_0x2cbfbb['entry_list']['length']){var _0x393a94=_[_0x3394('0x3b')](_0x2cbfbb['entry_list'],function(_0x1115b0){return _0x1115b0['name_value_list']['phone_home'][_0x3394('0x32')]===_0x392b6f;});if(_0x393a94){logger[_0x3394('0xd')](_0x3394('0x3c'));return BPromise[_0x3394('0x33')]({'id':_0x393a94[_0x3394('0x34')]['id']['value'],'name':_0x393a94[_0x3394('0x34')]['name'][_0x3394('0x32')],'phone':_0x393a94[_0x3394('0x34')][_0x3394('0x3a')]['value']});}}else{logger[_0x3394('0xd')]('Enduser\x20not\x20found,\x20creating\x20a\x20new\x20enduser!');return request({'form':{'method':_0x3394('0x21'),'input_type':_0x3394('0x22'),'response_type':_0x3394('0x22'),'rest_data':JSON['stringify']({'session':_0x1e05de['id'],'module_name':_0x3394('0x1a'),'name_value_list':[{'name':_0x3394('0x3d'),'value':_0x3f19ee!==_0x3394('0x3e')?_0x3f19ee:util[_0x3394('0x2d')]('Caller\x20-\x20%s',_0x392b6f)},{'name':'phone_home','value':_0x392b6f}]})}})['then'](function(_0x1b9356){logger[_0x3394('0xd')](_0x3394('0x3f'));return BPromise[_0x3394('0x33')]({'id':_0x1b9356['id'],'name':_0x1b9356[_0x3394('0x30')][_0x3394('0x3d')][_0x3394('0x32')],'phone':_0x1b9356['entry_list']['phone_home'][_0x3394('0x32')]});});}});}function request(_0xaad630){logger[_0x3394('0x40')](_0x3394('0x41'),JSON[_0x3394('0x23')](_0xaad630));return rp(_[_0x3394('0x42')](def,_0xaad630));}function getTags(_0x539ec5,_0x22ecde){var _0xd7c733=[];if(_0x539ec5&&_0x539ec5[_0x3394('0x1c')]>0x0){_0xd7c733=_[_0x3394('0x43')](_0x539ec5,_0x22ecde);}return _0xd7c733;}function getCustomFields(_0x274215,_0x2b7d69){var _0x10a96f=[];var _0x488581={'custom_fields':[]};if(_0x274215[_0x3394('0x1c')]>0x0){_['forEach'](_0x274215,function(_0x4f0c97){if(_0x4f0c97[_0x3394('0x44')]===_0x3394('0x45')&&_0x4f0c97[_0x3394('0x46')]&&!_0x4f0c97[_0x3394('0x47')]){_0x488581[_0x4f0c97[_0x3394('0x46')]['toLowerCase']()]=_0x4f0c97[_0x3394('0x48')][_0x3394('0x26')]();}else if(_0x4f0c97[_0x3394('0x44')]===_0x3394('0x45')&&_0x4f0c97['idField']&&_0x4f0c97[_0x3394('0x47')]){_0x488581[_0x3394('0x49')]['push']({'id':_0x4f0c97[_0x3394('0x20')],'value':_0x4f0c97[_0x3394('0x48')][_0x3394('0x26')]()});}else if(_0x4f0c97['type']===_0x3394('0x4a')&&_0x4f0c97[_0x3394('0x1e')]&&_0x4f0c97[_0x3394('0x20')]&&_0x4f0c97[_0x3394('0x47')]){_0x2b7d69[_0x4f0c97[_0x3394('0x1e')]]&&_0x488581['custom_fields'][_0x3394('0x1f')]({'id':_0x4f0c97[_0x3394('0x20')],'value':_0x2b7d69[_0x4f0c97['variableName']][_0x3394('0x26')]()});}else if(_0x4f0c97['type']===_0x3394('0x4b')&&_0x4f0c97[_0x3394('0x4c')]&&_0x4f0c97[_0x3394('0x4c')][_0x3394('0x39')]&&_0x4f0c97['idField']&&_0x4f0c97['customField']){_0x2b7d69[_0x4f0c97[_0x3394('0x4c')][_0x3394('0x39')]['toLowerCase']()]&&_0x488581[_0x3394('0x49')][_0x3394('0x1f')]({'id':_0x4f0c97[_0x3394('0x20')],'value':_0x2b7d69[_0x4f0c97['Variable'][_0x3394('0x39')][_0x3394('0x4d')]()]['toString']()});}});}return _0x488581;}function getConnection(_0x18402e){return request({'method':_0x3394('0xb'),'form':{'method':'login','input_type':_0x3394('0x22'),'response_type':_0x3394('0x22'),'rest_data':JSON[_0x3394('0x23')]({'user_auth':{'user_name':_0x18402e[_0x3394('0x4e')],'password':_0x18402e['password'],'encryption':_0x3394('0x4f')},'application':_0x3394('0x50')})}})['then'](function(_0x4c0625){var _0x5232ea=_0x4c0625;if(_0x5232ea['id']){def[_0x3394('0x51')]=_0x5232ea['id'];return BPromise['resolve'](_0x5232ea);}else{throw new Error(util[_0x3394('0x2d')](_0x3394('0x52'),_0x18402e['id']));}});}function setRelationship(_0x2e02c3,_0x5eebc4,_0x3c5a3e,_0x2fecd0){return request({'form':{'method':_0x3394('0x53'),'input_type':'JSON','response_type':_0x3394('0x22'),'rest_data':JSON['stringify']({'session':_0x2e02c3['id'],'module_name':_0x3394('0x24'),'module_id':_0x3c5a3e['id'],'link_field_name':_0x2fecd0,'related_ids':[_0x5eebc4['id']],'name_value_list':[],'delete':0x0})}});}exports[_0x3394('0x54')]=function(_0x13bc90,_0x3a88f6,_0x4209da,_0x435fad,_0x3ccde5,_0x3c84e1){var _0x2b32b8,_0x1e4a0c,_0x5dd5b7,_0x19a639;_0x3c84e1[_0x3394('0x55')]=intUtil['stripTrailingSlash'](_0x3c84e1[_0x3394('0x55')]);_0x3c84e1['serverUrl']=intUtil[_0x3394('0x56')](_0x3c84e1[_0x3394('0x57')]);def[_0x3394('0x58')]=util['format']('%s/service/v4_1/rest.php',_0x3c84e1[_0x3394('0x55')]);if(_0x3ccde5&&_0x3ccde5[_0x3394('0x59')]){logger[_0x3394('0xd')](_0x3394('0x5a'),_0x3394('0x5b'));_0x3a88f6[_0x3394('0x5c')]=util[_0x3394('0x2d')](_0x3394('0x5d'),_0x3c84e1[_0x3394('0x57')],_0x3a88f6[_0x3394('0x5e')],md5(_0x3a88f6[_0x3394('0x5e')]));}else{_0x3a88f6[_0x3394('0x5c')]='';}return getConnection(_0x3c84e1)[_0x3394('0x2f')](function(_0x251850){_0x19a639=_0x251850;return getUser(_0x3c84e1,_0x435fad[_0x3394('0x39')],_0x19a639);})[_0x3394('0x2f')](function(_0x1ef931){_0x2b32b8=_0x1ef931;logger[_0x3394('0xd')](_0x3394('0x5f'),_0x2b32b8['id']);return getEndUser(_0x3c84e1,_0x3a88f6['calleridname'],_0x3a88f6[_0x3394('0x60')],_0x19a639);})['then'](function(_0x55b0f1){_0x1e4a0c=_0x55b0f1;logger[_0x3394('0xd')](_0x3394('0x61'),_0x1e4a0c['id']);return getTicket(_0x3c84e1,_0x2b32b8,_0x1e4a0c,_0x4209da,_0x3a88f6,_0x4209da['Fields'],_0x19a639,_0x3394('0x62'));})[_0x3394('0x2f')](function(_0xd9d767){_0x5dd5b7=_0xd9d767;logger['info'](_0x3394('0x63'));logger[_0x3394('0xd')](_0x3394('0x64'),_0x5dd5b7['id']);return setRelationship(_0x19a639,_0x2b32b8,_0x5dd5b7,_0x3394('0x65'));})['then'](function(){return setRelationship(_0x19a639,_0x1e4a0c,_0x5dd5b7,_0x3394('0x66'));})[_0x3394('0x2f')](function(){return getServerInfo(_0x19a639);})[_0x3394('0x2f')](function(_0x3202d8){var _0x1ac33e=parseInt(_0x3202d8[_0x3394('0x67')][_0x3394('0x68')](0x0));var _0x3a876d=util['format']('%s/index.php?action=ajaxui#ajaxUILoc=index.php%3Fmodule%3DCalls%26action%3DEditView%26record%3D%s',_0x3c84e1['remoteUri'],_0x5dd5b7['id']);if(_0x1ac33e>0x6){_0x3a876d=util[_0x3394('0x2d')](_0x3394('0x69'),_0x3c84e1[_0x3394('0x55')],_0x5dd5b7['id']);}logger[_0x3394('0xd')](_0x3394('0x5a'),_0x3394('0x6a'));emit(util[_0x3394('0x2d')](_0x3394('0x6b'),_0x435fad[_0x3394('0x39')]),_0x3394('0x6c'),{'uri':_0x3a876d});})[_0x3394('0x6d')](function(_0x4f6280){logger[_0x3394('0x6e')]('[QUEUE]',JSON['stringify'](_0x4f6280));});};exports[_0x3394('0x6f')]=function(_0x44d155,_0x1cb24c,_0x3fd339,_0x4ea34a,_0x2402ef,_0x3bbd37,_0x25677c){var _0x3ca34c,_0x1604a1,_0x5b7895,_0x380594;_0x3bbd37[_0x3394('0x55')]=intUtil['stripTrailingSlash'](_0x3bbd37['remoteUri']);_0x3bbd37[_0x3394('0x57')]=intUtil[_0x3394('0x56')](_0x3bbd37['serverUrl']);def[_0x3394('0x58')]=util[_0x3394('0x2d')](_0x3394('0x70'),_0x3bbd37[_0x3394('0x55')]);if(_0x25677c&&_0x25677c['recordingFormat']&&_0x25677c['recordingFormat']!==_0x3394('0x71')){logger['info'](_0x3394('0x72'),_0x3394('0x5b'));_0x1cb24c[_0x3394('0x5c')]=util[_0x3394('0x2d')](_0x3394('0x5d'),_0x3bbd37[_0x3394('0x57')],_0x1cb24c[_0x3394('0x5e')],md5(_0x1cb24c[_0x3394('0x5e')]));}return getConnection(_0x3bbd37)[_0x3394('0x2f')](function(_0x49815b){_0x380594=_0x49815b;return getUser(_0x3bbd37,_0x4ea34a[_0x3394('0x39')],_0x380594);})['then'](function(_0x4d2cb1){_0x3ca34c=_0x4d2cb1;logger['info'](_0x3394('0x5f'),_0x3ca34c['id']);return getEndUser(_0x3bbd37,_0x1cb24c[_0x3394('0x73')],_0x1cb24c[_0x3394('0x74')],_0x380594);})['then'](function(_0x10d3d3){_0x1604a1=_0x10d3d3;logger[_0x3394('0xd')](_0x3394('0x61'),_0x1604a1['id']);return getTicket(_0x3bbd37,_0x3ca34c,_0x1604a1,_0x3fd339,_0x1cb24c,_0x3fd339[_0x3394('0x75')],_0x380594,_0x3394('0x76'));})[_0x3394('0x2f')](function(_0x488b8e){_0x5b7895=_0x488b8e;logger[_0x3394('0xd')](_0x3394('0x63'));logger[_0x3394('0xd')](_0x3394('0x64'),_0x5b7895['id']);return setRelationship(_0x380594,_0x3ca34c,_0x5b7895,_0x3394('0x65'));})[_0x3394('0x2f')](function(){return setRelationship(_0x380594,_0x1604a1,_0x5b7895,_0x3394('0x66'));})[_0x3394('0x2f')](function(){return getServerInfo(_0x380594);})[_0x3394('0x2f')](function(_0x145545){var _0xb647cb=parseInt(_0x145545[_0x3394('0x67')][_0x3394('0x68')](0x0));var _0x47e72a=util['format'](_0x3394('0x77'),_0x3bbd37[_0x3394('0x55')],_0x5b7895['id']);if(_0xb647cb>0x6){_0x47e72a=util[_0x3394('0x2d')]('%s/#bwc/index.php?module=Calls&action=EditView&record=%s',_0x3bbd37['remoteUri'],_0x5b7895['id']);}logger[_0x3394('0xd')](_0x3394('0x72'),_0x3394('0x6a'));emit(util[_0x3394('0x2d')](_0x3394('0x6b'),_0x4ea34a[_0x3394('0x39')]),_0x3394('0x6c'),{'uri':_0x47e72a});})['catch'](function(_0x9c6934){logger[_0x3394('0x6e')]('[OUTBOUND]',JSON['stringify'](_0x9c6934));});};exports[_0x3394('0x78')]=function(_0x2d153c,_0x3ed2d7,_0x3767dc,_0x2cb2c5,_0x1ba42b,_0x56e653){var _0x1fbad1,_0x1b190d,_0x527e6a,_0x1cdd8d;_0x56e653['remoteUri']=intUtil[_0x3394('0x56')](_0x56e653[_0x3394('0x55')]);_0x56e653[_0x3394('0x57')]=intUtil['stripTrailingSlash'](_0x56e653[_0x3394('0x57')]);def[_0x3394('0x58')]=util[_0x3394('0x2d')]('%s/service/v4_1/rest.php',_0x56e653[_0x3394('0x55')]);if(_0x1ba42b&&_0x1ba42b[_0x3394('0x59')]){logger['info']('['+_0x3ed2d7[_0x3394('0x79')][_0x3394('0x7a')]()+']',_0x3394('0x5b'));_0x3ed2d7[_0x3394('0x5c')]=util[_0x3394('0x2d')](_0x3394('0x5d'),_0x56e653['serverUrl'],_0x3ed2d7[_0x3394('0x5e')],md5(_0x3ed2d7['uniqueid']));}else{_0x3ed2d7[_0x3394('0x5c')]='';}return getConnection(_0x56e653)['then'](function(_0x2ca90e){_0x1cdd8d=_0x2ca90e;if(!_[_0x3394('0x29')](_0x2cb2c5)){return getUser(_0x56e653,_0x2cb2c5[_0x3394('0x39')],_0x1cdd8d);}else{return getUser(_0x56e653,null,_0x1cdd8d);}})['then'](function(_0x3af9d0){_0x1fbad1=_0x3af9d0;logger['info'](_0x3394('0x5f'),_0x1fbad1['id']);return getEndUser(_0x56e653,_0x3ed2d7[_0x3394('0x7b')],_0x3ed2d7['calleridnum'],_0x1cdd8d);})['then'](function(_0xdb952c){_0x1b190d=_0xdb952c;logger['info'](_0x3394('0x61'),_0x1b190d['id']);return getTicket(_0x56e653,_0x1fbad1,_0x1b190d,_0x3767dc,_0x3ed2d7,_0x3767dc[_0x3394('0x75')],_0x1cdd8d,_0x3394('0x62'));})[_0x3394('0x2f')](function(_0x1c97d9){_0x527e6a=_0x1c97d9;logger['info']('Ticket\x20created!');logger[_0x3394('0xd')]('The\x20Ticket\x20ID\x20is:',_0x527e6a['id']);return setRelationship(_0x1cdd8d,_0x1fbad1,_0x527e6a,_0x3394('0x65'));})[_0x3394('0x2f')](function(){return setRelationship(_0x1cdd8d,_0x1b190d,_0x527e6a,'contacts');})[_0x3394('0x2f')](function(){return getServerInfo(_0x1cdd8d);})[_0x3394('0x6d')](function(_0x447dd6){logger['error']('['+_0x3ed2d7[_0x3394('0x79')][_0x3394('0x7a')]()+']',JSON['stringify'](_0x447dd6));});}; \ No newline at end of file +var _0x88bb=['merge','type','string','nameField','customField','toLowerCase','content','custom_fields','push','customVariable','Variable','login','username','password','xCALLY\x20Motion\x20integration','sessionID','Account\x20%d\x20is\x20not\x20valid','set_relationship','queue','remoteUri','serverUrl','stripTrailingSlash','%s/service/v4_1/rest.php','monitor_format','Recording\x20is\x20enabled!','recordingURL','%s/api/voice/recordings/%s/downloads?type=uniqueid&token=%s','uniqueid','The\x20User\x20ID\x20is:','calleridname','calleridnum','The\x20Enduser\x20ID\x20is:','Fields','Inbound','Ticket\x20created!','The\x20Ticket\x20ID\x20is:','users','contacts','version','charAt','[QUEUE]','Displaying\x20ticket\x20to\x20agent\x20in\x20a\x20new\x20tab...','user:%s','trigger:browser:url','catch','error','outbound','[OUTBOUND]','destcalleridnum','Outbound','%s/index.php?action=ajaxui#ajaxUILoc=index.php%3Fmodule%3DCalls%26action%3DEditView%26record%3D%s','%s/#bwc/index.php?module=Calls&action=EditView&record=%s','unmanaged','uri','lastevent','toUpperCase','lodash','request-promise','bluebird','md5','util','ioredis','./util','../../../../config/environment','../../../../config/logger','sugarcrm','redis','defaults','socket.io-emitter','POST','info','Creating\x20new\x20ticket...','name','getString','description','date_start','toISOString','slice','duration_hours','duration_minutes','parent_id','Contacts','parent_name','direction','length','forEach','variableName','idField','set_entry','stringify','Calls','format','Basic\x20%s','apiKey','toString','base64','get_server_info','JSON','isNil','Getting\x20agent\x20with\x20name','get_entry_list','Employees','INSTR\x20(\x20users.user_name,\x20\x22%s\x22)\x20>\x200','user_name','entry_list','find','name_value_list','value','Agent\x20found!','resolve','user_id','Agent\x20not\x20available,\x20using\x20the\x20admin\x20account!','phone_home','then','Enduser\x20found!','Enduser\x20not\x20found,\x20creating\x20a\x20new\x20enduser!','first_name','','Caller\x20-\x20%s','Enduser\x20created.'];(function(_0x3d9c01,_0x40f6cf){var _0x40990e=function(_0x1875c9){while(--_0x1875c9){_0x3d9c01['push'](_0x3d9c01['shift']());}};_0x40990e(++_0x40f6cf);}(_0x88bb,0xb0));var _0xb88b=function(_0x1b5572,_0x5ac621){_0x1b5572=_0x1b5572-0x0;var _0x1ff75c=_0x88bb[_0x1b5572];return _0x1ff75c;};'use strict';var _=require(_0xb88b('0x0'));var rp=require(_0xb88b('0x1'));var BPromise=require(_0xb88b('0x2'));var md5=require(_0xb88b('0x3'));var util=require(_0xb88b('0x4'));var Redis=require(_0xb88b('0x5'));var intUtil=require(_0xb88b('0x6'));var config=require(_0xb88b('0x7'));var logger=require(_0xb88b('0x8'))(_0xb88b('0x9'));config[_0xb88b('0xa')]=_[_0xb88b('0xb')](config[_0xb88b('0xa')],{'host':'localhost','port':0x18eb});var io=require(_0xb88b('0xc'))(new Redis(config[_0xb88b('0xa')]));var def={'method':_0xb88b('0xd'),'json':!![]};function emit(_0x1ea592,_0x3182c4,_0x40fc26){io['to'](_0x1ea592)['emit'](_0x3182c4,_0x40fc26);}function getTicket(_0x1360ac,_0x178c84,_0xd94b8f,_0x189c6e,_0x88454,_0x5eb6a5,_0x4ca773,_0xfbb637){logger[_0xb88b('0xe')](_0xb88b('0xf'));var _0x29f691=new Date();var _0x3ae941=[{'name':_0xb88b('0x10'),'value':intUtil[_0xb88b('0x11')](_0x189c6e['Subjects'],_0x88454,'\x20')},{'name':'assigned_user_id','value':_0x178c84['id']},{'name':'created_by','value':_0x178c84['id']},{'name':_0xb88b('0x12'),'value':intUtil[_0xb88b('0x11')](_0x189c6e['Descriptions'],_0x88454,'\x0a')},{'name':_0xb88b('0x13'),'value':_0x29f691[_0xb88b('0x14')]()[_0xb88b('0x15')](0x0,0x13)['replace']('T','\x20')},{'name':_0xb88b('0x16'),'value':'0'},{'name':_0xb88b('0x17'),'value':'15'},{'name':_0xb88b('0x18'),'value':_0xd94b8f['id']},{'name':'parent_type','value':_0xb88b('0x19')},{'name':_0xb88b('0x1a'),'value':_0xd94b8f[_0xb88b('0x10')]},{'name':_0xb88b('0x1b'),'value':_0xfbb637}];if(_0x5eb6a5[_0xb88b('0x1c')]){_[_0xb88b('0x1d')](_0x5eb6a5,function(_0x125c28){if(_0x88454[_0x125c28[_0xb88b('0x1e')]]){_0x3ae941['push']({'name':_0x125c28[_0xb88b('0x1f')],'value':_0x88454[_0x125c28[_0xb88b('0x1e')]]});}});}return request({'form':{'method':_0xb88b('0x20'),'input_type':'JSON','response_type':'JSON','rest_data':JSON[_0xb88b('0x21')]({'session':_0x4ca773['id'],'module_name':_0xb88b('0x22'),'name_value_list':_0x3ae941})}});}function getAuth(_0x25179d){return util[_0xb88b('0x23')](_0xb88b('0x24'),new Buffer(_0x25179d[_0xb88b('0x25')]+':X')[_0xb88b('0x26')](_0xb88b('0x27')));}function getServerInfo(_0x396024){return request({'form':{'method':_0xb88b('0x28'),'input_type':_0xb88b('0x29'),'response_type':_0xb88b('0x29'),'rest_data':JSON['stringify']({'session':_0x396024['id']})}});}function getUser(_0x35ced9,_0x2a3f28,_0x1b9b20){if(!_[_0xb88b('0x2a')](_0x2a3f28)){logger[_0xb88b('0xe')](_0xb88b('0x2b'),_0x2a3f28);return request({'form':{'method':_0xb88b('0x2c'),'input_type':_0xb88b('0x29'),'response_type':_0xb88b('0x29'),'rest_data':JSON['stringify']({'session':_0x1b9b20['id'],'module_name':_0xb88b('0x2d'),'query':util[_0xb88b('0x23')](_0xb88b('0x2e'),_0x2a3f28),'order_by':'','offset':'0','select_fields':['id',_0xb88b('0x10'),_0xb88b('0x2f')],'link_name_to_fields_array':[],'max_results':-0x1,'deleted':'0'})}})['then'](function(_0x541eea){if(_0x541eea[_0xb88b('0x30')][_0xb88b('0x1c')]){var _0x19202b=_[_0xb88b('0x31')](_0x541eea[_0xb88b('0x30')],function(_0x2037f5){return _0x2037f5[_0xb88b('0x32')][_0xb88b('0x2f')][_0xb88b('0x33')]===_0x2a3f28;});if(_0x19202b){logger[_0xb88b('0xe')](_0xb88b('0x34'));return BPromise[_0xb88b('0x35')]({'id':_0x19202b[_0xb88b('0x32')]['id'][_0xb88b('0x33')],'name':_0x19202b[_0xb88b('0x32')][_0xb88b('0x10')]['value']});}}logger[_0xb88b('0xe')]('Agent\x20not\x20found,\x20using\x20the\x20admin\x20account!');return BPromise['resolve']({'id':_0x1b9b20[_0xb88b('0x32')][_0xb88b('0x36')]['value'],'name':_0x1b9b20[_0xb88b('0x32')]['user_name'][_0xb88b('0x33')]});});}else{logger['info'](_0xb88b('0x37'));return BPromise['resolve']({'id':_0x1b9b20[_0xb88b('0x32')][_0xb88b('0x36')][_0xb88b('0x33')],'name':_0x1b9b20[_0xb88b('0x32')][_0xb88b('0x2f')][_0xb88b('0x33')]});}}function getEndUser(_0x242bae,_0x2b7334,_0x2b1f29,_0x48ad72){logger['info']('Searching\x20enduser\x20with\x20phone',_0x2b1f29);return request({'form':{'method':'get_entry_list','input_type':_0xb88b('0x29'),'response_type':_0xb88b('0x29'),'rest_data':JSON[_0xb88b('0x21')]({'session':_0x48ad72['id'],'module_name':'Contacts','query':util[_0xb88b('0x23')]('contacts.phone_home\x20=\x20\x22%s\x22',_0x2b1f29),'order_by':'','offset':'0','select_fields':['id',_0xb88b('0x10'),_0xb88b('0x38')],'link_name_to_fields_array':[],'max_results':-0x1,'deleted':'0'})}})[_0xb88b('0x39')](function(_0xa8439a){if(_0xa8439a['entry_list'][_0xb88b('0x1c')]){var _0x26ce02=_[_0xb88b('0x31')](_0xa8439a[_0xb88b('0x30')],function(_0x2f8ca4){return _0x2f8ca4[_0xb88b('0x32')][_0xb88b('0x38')][_0xb88b('0x33')]===_0x2b1f29;});if(_0x26ce02){logger['info'](_0xb88b('0x3a'));return BPromise[_0xb88b('0x35')]({'id':_0x26ce02['name_value_list']['id'][_0xb88b('0x33')],'name':_0x26ce02[_0xb88b('0x32')]['name'][_0xb88b('0x33')],'phone':_0x26ce02[_0xb88b('0x32')][_0xb88b('0x38')][_0xb88b('0x33')]});}}else{logger[_0xb88b('0xe')](_0xb88b('0x3b'));return request({'form':{'method':_0xb88b('0x20'),'input_type':_0xb88b('0x29'),'response_type':_0xb88b('0x29'),'rest_data':JSON['stringify']({'session':_0x48ad72['id'],'module_name':'Contacts','name_value_list':[{'name':_0xb88b('0x3c'),'value':_0x2b7334!==_0xb88b('0x3d')?_0x2b7334:util['format'](_0xb88b('0x3e'),_0x2b1f29)},{'name':'phone_home','value':_0x2b1f29}]})}})[_0xb88b('0x39')](function(_0x9bd1db){logger[_0xb88b('0xe')](_0xb88b('0x3f'));return BPromise[_0xb88b('0x35')]({'id':_0x9bd1db['id'],'name':_0x9bd1db[_0xb88b('0x30')][_0xb88b('0x3c')][_0xb88b('0x33')],'phone':_0x9bd1db[_0xb88b('0x30')]['phone_home'][_0xb88b('0x33')]});});}});}function request(_0x7da870){logger['debug']('[HTTP]',JSON['stringify'](_0x7da870));return rp(_[_0xb88b('0x40')](def,_0x7da870));}function getTags(_0xdbee7a,_0x491915){var _0x4a7398=[];if(_0xdbee7a&&_0xdbee7a['length']>0x0){_0x4a7398=_['map'](_0xdbee7a,_0x491915);}return _0x4a7398;}function getCustomFields(_0x2fc7fc,_0x272481){var _0x3aa7f7=[];var _0x2b2905={'custom_fields':[]};if(_0x2fc7fc[_0xb88b('0x1c')]>0x0){_[_0xb88b('0x1d')](_0x2fc7fc,function(_0x18d1ba){if(_0x18d1ba[_0xb88b('0x41')]===_0xb88b('0x42')&&_0x18d1ba[_0xb88b('0x43')]&&!_0x18d1ba[_0xb88b('0x44')]){_0x2b2905[_0x18d1ba[_0xb88b('0x43')][_0xb88b('0x45')]()]=_0x18d1ba[_0xb88b('0x46')][_0xb88b('0x26')]();}else if(_0x18d1ba[_0xb88b('0x41')]===_0xb88b('0x42')&&_0x18d1ba[_0xb88b('0x1f')]&&_0x18d1ba[_0xb88b('0x44')]){_0x2b2905[_0xb88b('0x47')][_0xb88b('0x48')]({'id':_0x18d1ba[_0xb88b('0x1f')],'value':_0x18d1ba['content']['toString']()});}else if(_0x18d1ba[_0xb88b('0x41')]==='variable'&&_0x18d1ba[_0xb88b('0x1e')]&&_0x18d1ba[_0xb88b('0x1f')]&&_0x18d1ba[_0xb88b('0x44')]){_0x272481[_0x18d1ba[_0xb88b('0x1e')]]&&_0x2b2905[_0xb88b('0x47')][_0xb88b('0x48')]({'id':_0x18d1ba[_0xb88b('0x1f')],'value':_0x272481[_0x18d1ba[_0xb88b('0x1e')]][_0xb88b('0x26')]()});}else if(_0x18d1ba[_0xb88b('0x41')]===_0xb88b('0x49')&&_0x18d1ba['Variable']&&_0x18d1ba[_0xb88b('0x4a')][_0xb88b('0x10')]&&_0x18d1ba[_0xb88b('0x1f')]&&_0x18d1ba['customField']){_0x272481[_0x18d1ba['Variable'][_0xb88b('0x10')][_0xb88b('0x45')]()]&&_0x2b2905[_0xb88b('0x47')]['push']({'id':_0x18d1ba[_0xb88b('0x1f')],'value':_0x272481[_0x18d1ba[_0xb88b('0x4a')]['name']['toLowerCase']()][_0xb88b('0x26')]()});}});}return _0x2b2905;}function getConnection(_0x46f193){return request({'method':_0xb88b('0xd'),'form':{'method':_0xb88b('0x4b'),'input_type':'JSON','response_type':_0xb88b('0x29'),'rest_data':JSON[_0xb88b('0x21')]({'user_auth':{'user_name':_0x46f193[_0xb88b('0x4c')],'password':_0x46f193[_0xb88b('0x4d')],'encryption':'PLAIN'},'application':_0xb88b('0x4e')})}})[_0xb88b('0x39')](function(_0x53a3c9){var _0x1954c5=_0x53a3c9;if(_0x1954c5['id']){def[_0xb88b('0x4f')]=_0x1954c5['id'];return BPromise[_0xb88b('0x35')](_0x1954c5);}else{throw new Error(util[_0xb88b('0x23')](_0xb88b('0x50'),_0x46f193['id']));}});}function setRelationship(_0x2de57c,_0x4a57fd,_0x20eb63,_0x34aed6){return request({'form':{'method':_0xb88b('0x51'),'input_type':_0xb88b('0x29'),'response_type':_0xb88b('0x29'),'rest_data':JSON[_0xb88b('0x21')]({'session':_0x2de57c['id'],'module_name':_0xb88b('0x22'),'module_id':_0x20eb63['id'],'link_field_name':_0x34aed6,'related_ids':[_0x4a57fd['id']],'name_value_list':[],'delete':0x0})}});}exports[_0xb88b('0x52')]=function(_0x2a78fb,_0x37dc47,_0x51c5eb,_0x3e46e3,_0x27bfd3,_0x1b4feb){var _0x385709,_0x449a6f,_0x5010f2,_0x1a1358;_0x1b4feb[_0xb88b('0x53')]=intUtil['stripTrailingSlash'](_0x1b4feb[_0xb88b('0x53')]);_0x1b4feb[_0xb88b('0x54')]=intUtil[_0xb88b('0x55')](_0x1b4feb[_0xb88b('0x54')]);def['uri']=util[_0xb88b('0x23')](_0xb88b('0x56'),_0x1b4feb['remoteUri']);if(_0x27bfd3&&_0x27bfd3[_0xb88b('0x57')]){logger[_0xb88b('0xe')]('[QUEUE]',_0xb88b('0x58'));_0x37dc47[_0xb88b('0x59')]=util[_0xb88b('0x23')](_0xb88b('0x5a'),_0x1b4feb[_0xb88b('0x54')],_0x37dc47[_0xb88b('0x5b')],md5(_0x37dc47[_0xb88b('0x5b')]));}else{_0x37dc47['recordingURL']='';}return getConnection(_0x1b4feb)[_0xb88b('0x39')](function(_0x47abf0){_0x1a1358=_0x47abf0;return getUser(_0x1b4feb,_0x3e46e3[_0xb88b('0x10')],_0x1a1358);})[_0xb88b('0x39')](function(_0x19cc39){_0x385709=_0x19cc39;logger[_0xb88b('0xe')](_0xb88b('0x5c'),_0x385709['id']);return getEndUser(_0x1b4feb,_0x37dc47[_0xb88b('0x5d')],_0x37dc47[_0xb88b('0x5e')],_0x1a1358);})[_0xb88b('0x39')](function(_0x305db0){_0x449a6f=_0x305db0;logger['info'](_0xb88b('0x5f'),_0x449a6f['id']);return getTicket(_0x1b4feb,_0x385709,_0x449a6f,_0x51c5eb,_0x37dc47,_0x51c5eb[_0xb88b('0x60')],_0x1a1358,_0xb88b('0x61'));})[_0xb88b('0x39')](function(_0x1ee4c9){_0x5010f2=_0x1ee4c9;logger[_0xb88b('0xe')](_0xb88b('0x62'));logger[_0xb88b('0xe')](_0xb88b('0x63'),_0x5010f2['id']);return setRelationship(_0x1a1358,_0x385709,_0x5010f2,_0xb88b('0x64'));})[_0xb88b('0x39')](function(){return setRelationship(_0x1a1358,_0x449a6f,_0x5010f2,_0xb88b('0x65'));})[_0xb88b('0x39')](function(){return getServerInfo(_0x1a1358);})[_0xb88b('0x39')](function(_0x1b87ad){var _0x562ae5=parseInt(_0x1b87ad[_0xb88b('0x66')][_0xb88b('0x67')](0x0));var _0x48e806=util[_0xb88b('0x23')]('%s/index.php?action=ajaxui#ajaxUILoc=index.php%3Fmodule%3DCalls%26action%3DEditView%26record%3D%s',_0x1b4feb['remoteUri'],_0x5010f2['id']);if(_0x562ae5>0x6){_0x48e806=util[_0xb88b('0x23')]('%s/#bwc/index.php?module=Calls&action=EditView&record=%s',_0x1b4feb[_0xb88b('0x53')],_0x5010f2['id']);}logger[_0xb88b('0xe')](_0xb88b('0x68'),_0xb88b('0x69'));emit(util[_0xb88b('0x23')](_0xb88b('0x6a'),_0x3e46e3['name']),_0xb88b('0x6b'),{'uri':_0x48e806});})[_0xb88b('0x6c')](function(_0x59fbd2){logger[_0xb88b('0x6d')]('[QUEUE]',JSON['stringify'](_0x59fbd2));});};exports[_0xb88b('0x6e')]=function(_0x215539,_0x29b037,_0x1f2976,_0x51729c,_0x2ac56c,_0x49ea44,_0x5af28d){var _0x538a63,_0x4aacc0,_0x2e6c40,_0xf630c6;_0x49ea44[_0xb88b('0x53')]=intUtil[_0xb88b('0x55')](_0x49ea44[_0xb88b('0x53')]);_0x49ea44[_0xb88b('0x54')]=intUtil[_0xb88b('0x55')](_0x49ea44[_0xb88b('0x54')]);def['uri']=util[_0xb88b('0x23')](_0xb88b('0x56'),_0x49ea44['remoteUri']);if(_0x5af28d&&_0x5af28d['recordingFormat']&&_0x5af28d['recordingFormat']!=='none'){logger[_0xb88b('0xe')](_0xb88b('0x6f'),_0xb88b('0x58'));_0x29b037['recordingURL']=util['format'](_0xb88b('0x5a'),_0x49ea44[_0xb88b('0x54')],_0x29b037[_0xb88b('0x5b')],md5(_0x29b037[_0xb88b('0x5b')]));}return getConnection(_0x49ea44)[_0xb88b('0x39')](function(_0x4fa600){_0xf630c6=_0x4fa600;return getUser(_0x49ea44,_0x51729c[_0xb88b('0x10')],_0xf630c6);})[_0xb88b('0x39')](function(_0x8d5d1c){_0x538a63=_0x8d5d1c;logger[_0xb88b('0xe')](_0xb88b('0x5c'),_0x538a63['id']);return getEndUser(_0x49ea44,_0x29b037['destcalleridname'],_0x29b037[_0xb88b('0x70')],_0xf630c6);})[_0xb88b('0x39')](function(_0x297985){_0x4aacc0=_0x297985;logger[_0xb88b('0xe')](_0xb88b('0x5f'),_0x4aacc0['id']);return getTicket(_0x49ea44,_0x538a63,_0x4aacc0,_0x1f2976,_0x29b037,_0x1f2976['Fields'],_0xf630c6,_0xb88b('0x71'));})['then'](function(_0xf172d7){_0x2e6c40=_0xf172d7;logger[_0xb88b('0xe')](_0xb88b('0x62'));logger['info'](_0xb88b('0x63'),_0x2e6c40['id']);return setRelationship(_0xf630c6,_0x538a63,_0x2e6c40,'users');})[_0xb88b('0x39')](function(){return setRelationship(_0xf630c6,_0x4aacc0,_0x2e6c40,'contacts');})[_0xb88b('0x39')](function(){return getServerInfo(_0xf630c6);})[_0xb88b('0x39')](function(_0x85eb41){var _0x1cb286=parseInt(_0x85eb41[_0xb88b('0x66')]['charAt'](0x0));var _0x48bfe0=util[_0xb88b('0x23')](_0xb88b('0x72'),_0x49ea44[_0xb88b('0x53')],_0x2e6c40['id']);if(_0x1cb286>0x6){_0x48bfe0=util[_0xb88b('0x23')](_0xb88b('0x73'),_0x49ea44[_0xb88b('0x53')],_0x2e6c40['id']);}logger[_0xb88b('0xe')](_0xb88b('0x6f'),_0xb88b('0x69'));emit(util[_0xb88b('0x23')](_0xb88b('0x6a'),_0x51729c[_0xb88b('0x10')]),_0xb88b('0x6b'),{'uri':_0x48bfe0});})['catch'](function(_0x2d95fc){logger[_0xb88b('0x6d')](_0xb88b('0x6f'),JSON[_0xb88b('0x21')](_0x2d95fc));});};exports[_0xb88b('0x74')]=function(_0x449721,_0x101e6b,_0x522179,_0x5720e8,_0x52805e,_0x18ddc5){var _0x7ec534,_0x3a79e6,_0x22223b,_0x2ffa35;_0x18ddc5[_0xb88b('0x53')]=intUtil[_0xb88b('0x55')](_0x18ddc5['remoteUri']);_0x18ddc5[_0xb88b('0x54')]=intUtil['stripTrailingSlash'](_0x18ddc5[_0xb88b('0x54')]);def[_0xb88b('0x75')]=util[_0xb88b('0x23')]('%s/service/v4_1/rest.php',_0x18ddc5[_0xb88b('0x53')]);if(_0x52805e&&_0x52805e[_0xb88b('0x57')]){logger[_0xb88b('0xe')]('['+_0x101e6b[_0xb88b('0x76')][_0xb88b('0x77')]()+']','Recording\x20is\x20enabled!');_0x101e6b[_0xb88b('0x59')]=util['format'](_0xb88b('0x5a'),_0x18ddc5[_0xb88b('0x54')],_0x101e6b['uniqueid'],md5(_0x101e6b['uniqueid']));}else{_0x101e6b[_0xb88b('0x59')]='';}return getConnection(_0x18ddc5)[_0xb88b('0x39')](function(_0x389214){_0x2ffa35=_0x389214;if(!_[_0xb88b('0x2a')](_0x5720e8)){return getUser(_0x18ddc5,_0x5720e8[_0xb88b('0x10')],_0x2ffa35);}else{return getUser(_0x18ddc5,null,_0x2ffa35);}})[_0xb88b('0x39')](function(_0x1bbd57){_0x7ec534=_0x1bbd57;logger[_0xb88b('0xe')](_0xb88b('0x5c'),_0x7ec534['id']);return getEndUser(_0x18ddc5,_0x101e6b[_0xb88b('0x5d')],_0x101e6b[_0xb88b('0x5e')],_0x2ffa35);})['then'](function(_0x43dfc2){_0x3a79e6=_0x43dfc2;logger[_0xb88b('0xe')]('The\x20Enduser\x20ID\x20is:',_0x3a79e6['id']);return getTicket(_0x18ddc5,_0x7ec534,_0x3a79e6,_0x522179,_0x101e6b,_0x522179[_0xb88b('0x60')],_0x2ffa35,_0xb88b('0x61'));})[_0xb88b('0x39')](function(_0x2d8336){_0x22223b=_0x2d8336;logger[_0xb88b('0xe')](_0xb88b('0x62'));logger[_0xb88b('0xe')]('The\x20Ticket\x20ID\x20is:',_0x22223b['id']);return setRelationship(_0x2ffa35,_0x7ec534,_0x22223b,_0xb88b('0x64'));})[_0xb88b('0x39')](function(){return setRelationship(_0x2ffa35,_0x3a79e6,_0x22223b,_0xb88b('0x65'));})[_0xb88b('0x39')](function(){return getServerInfo(_0x2ffa35);})[_0xb88b('0x6c')](function(_0x26452a){logger[_0xb88b('0x6d')]('['+_0x101e6b[_0xb88b('0x76')][_0xb88b('0x77')]()+']',JSON[_0xb88b('0x21')](_0x26452a));});}; \ 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 125b0ab..6e3dbbd 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 _0x7096=['customVariable','Variable','name','toLowerCase','keyType','key','format','%s:\x20%s','keyContent','join','stripTrailingSlash','slice','substring','validateEmail','isNil','test','util','sortBy','type','string','push','content','variable','variableName','toString'];(function(_0x14b6ba,_0x248760){var _0x5750ea=function(_0x4d2ee7){while(--_0x4d2ee7){_0x14b6ba['push'](_0x14b6ba['shift']());}};_0x5750ea(++_0x248760);}(_0x7096,0x1d2));var _0x6709=function(_0x6131cd,_0x4c26a1){_0x6131cd=_0x6131cd-0x0;var _0x47e916=_0x7096[_0x6131cd];return _0x47e916;};'use strict';var _=require('lodash');var util=require(_0x6709('0x0'));exports['getString']=function(_0x2020e2,_0x3b746e,_0x4385d9){var _0x3027ff=[];if(_0x2020e2['length']>0x0){var _0x471458=_[_0x6709('0x1')](_0x2020e2,['id']);for(var _0x20d149=0x0;_0x20d149<_0x471458['length'];_0x20d149++){var _0x372b8e=_0x471458[_0x20d149];if(_0x372b8e[_0x6709('0x2')]===_0x6709('0x3')){_0x3027ff[_0x6709('0x4')](_0x372b8e[_0x6709('0x5')]);}else if(_0x372b8e[_0x6709('0x2')]===_0x6709('0x6')&&_0x372b8e[_0x6709('0x7')]){_0x3b746e[_0x372b8e[_0x6709('0x7')]]&&_0x3027ff[_0x6709('0x4')](_0x3b746e[_0x372b8e['variableName']][_0x6709('0x8')]());}else if(_0x372b8e[_0x6709('0x2')]===_0x6709('0x9')&&_0x372b8e[_0x6709('0xa')]&&_0x372b8e[_0x6709('0xa')][_0x6709('0xb')]){_0x3b746e[_0x372b8e[_0x6709('0xa')][_0x6709('0xb')]['toLowerCase']()]&&_0x3027ff[_0x6709('0x4')](_0x3b746e[_0x372b8e[_0x6709('0xa')][_0x6709('0xb')][_0x6709('0xc')]()][_0x6709('0x8')]());}else if(_0x372b8e[_0x6709('0x2')]==='keyValue'){if(_0x372b8e[_0x6709('0xd')]===_0x6709('0x3')&&_0x372b8e[_0x6709('0xe')]){_0x3027ff[_0x6709('0x4')](util[_0x6709('0xf')](_0x6709('0x10'),_0x372b8e['key'],_0x372b8e[_0x6709('0x11')]));}else if(_0x372b8e[_0x6709('0xd')]==='variable'&&_0x372b8e[_0x6709('0x7')]&&_0x372b8e[_0x6709('0xe')]){_0x3b746e[_0x372b8e[_0x6709('0x7')]]&&_0x3027ff['push'](util[_0x6709('0xf')](_0x6709('0x10'),_0x372b8e[_0x6709('0xe')],_0x3b746e[_0x372b8e['variableName']]));}else if(_0x372b8e[_0x6709('0xd')]==='customVariable'&&_0x372b8e[_0x6709('0xa')]&&_0x372b8e[_0x6709('0xa')]['name']&&_0x372b8e[_0x6709('0xe')]){_0x3b746e[_0x372b8e[_0x6709('0xa')][_0x6709('0xb')][_0x6709('0xc')]()]&&_0x3027ff[_0x6709('0x4')](util['format'](_0x6709('0x10'),_0x372b8e['key'],_0x3b746e[_0x372b8e['Variable'][_0x6709('0xb')][_0x6709('0xc')]()]));}}}}return _0x3027ff[_0x6709('0x12')](_0x4385d9);};exports[_0x6709('0x13')]=function(_0x318ea2){var _0x210431=_0x318ea2[_0x6709('0x14')](-0x1);if(_0x210431==='/'){_0x318ea2=_0x318ea2[_0x6709('0x15')](0x0,_0x318ea2['lastIndexOf'](_0x210431));}return _0x318ea2;};exports[_0x6709('0x16')]=function(_0x2a706d){if(!_[_0x6709('0x17')](_0x2a706d)&&_0x2a706d!==''){var _0x1eecf5=/^(([^<>()\[\]\\.,;:\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 _0x1eecf5[_0x6709('0x18')](String(_0x2a706d)['toLowerCase']());}else{return![];}}; \ No newline at end of file +var _0x2213=['length','sortBy','string','push','content','type','variableName','toString','Variable','name','toLowerCase','keyType','key','%s:\x20%s','variable','format','customVariable','stripTrailingSlash','substring','lastIndexOf','validateEmail','isNil','test','util','getString'];(function(_0xe9dce4,_0x3a0871){var _0xcd2c07=function(_0x918f14){while(--_0x918f14){_0xe9dce4['push'](_0xe9dce4['shift']());}};_0xcd2c07(++_0x3a0871);}(_0x2213,0x143));var _0x3221=function(_0x59edde,_0x2da678){_0x59edde=_0x59edde-0x0;var _0x306dc0=_0x2213[_0x59edde];return _0x306dc0;};'use strict';var _=require('lodash');var util=require(_0x3221('0x0'));exports[_0x3221('0x1')]=function(_0x1f0c9b,_0x54d11e,_0x1dbb45){var _0x1b065a=[];if(_0x1f0c9b[_0x3221('0x2')]>0x0){var _0x868386=_[_0x3221('0x3')](_0x1f0c9b,['id']);for(var _0x42842d=0x0;_0x42842d<_0x868386[_0x3221('0x2')];_0x42842d++){var _0x42876e=_0x868386[_0x42842d];if(_0x42876e['type']===_0x3221('0x4')){_0x1b065a[_0x3221('0x5')](_0x42876e[_0x3221('0x6')]);}else if(_0x42876e[_0x3221('0x7')]==='variable'&&_0x42876e[_0x3221('0x8')]){_0x54d11e[_0x42876e[_0x3221('0x8')]]&&_0x1b065a[_0x3221('0x5')](_0x54d11e[_0x42876e[_0x3221('0x8')]][_0x3221('0x9')]());}else if(_0x42876e[_0x3221('0x7')]==='customVariable'&&_0x42876e[_0x3221('0xa')]&&_0x42876e['Variable'][_0x3221('0xb')]){_0x54d11e[_0x42876e[_0x3221('0xa')]['name'][_0x3221('0xc')]()]&&_0x1b065a[_0x3221('0x5')](_0x54d11e[_0x42876e[_0x3221('0xa')][_0x3221('0xb')][_0x3221('0xc')]()][_0x3221('0x9')]());}else if(_0x42876e[_0x3221('0x7')]==='keyValue'){if(_0x42876e[_0x3221('0xd')]===_0x3221('0x4')&&_0x42876e[_0x3221('0xe')]){_0x1b065a['push'](util['format'](_0x3221('0xf'),_0x42876e[_0x3221('0xe')],_0x42876e['keyContent']));}else if(_0x42876e[_0x3221('0xd')]===_0x3221('0x10')&&_0x42876e['variableName']&&_0x42876e[_0x3221('0xe')]){_0x54d11e[_0x42876e[_0x3221('0x8')]]&&_0x1b065a[_0x3221('0x5')](util[_0x3221('0x11')](_0x3221('0xf'),_0x42876e[_0x3221('0xe')],_0x54d11e[_0x42876e[_0x3221('0x8')]]));}else if(_0x42876e[_0x3221('0xd')]===_0x3221('0x12')&&_0x42876e[_0x3221('0xa')]&&_0x42876e['Variable'][_0x3221('0xb')]&&_0x42876e[_0x3221('0xe')]){_0x54d11e[_0x42876e[_0x3221('0xa')][_0x3221('0xb')][_0x3221('0xc')]()]&&_0x1b065a[_0x3221('0x5')](util['format'](_0x3221('0xf'),_0x42876e[_0x3221('0xe')],_0x54d11e[_0x42876e[_0x3221('0xa')][_0x3221('0xb')][_0x3221('0xc')]()]));}}}}return _0x1b065a['join'](_0x1dbb45);};exports[_0x3221('0x13')]=function(_0x5f5a50){var _0x1eafc1=_0x5f5a50['slice'](-0x1);if(_0x1eafc1==='/'){_0x5f5a50=_0x5f5a50[_0x3221('0x14')](0x0,_0x5f5a50[_0x3221('0x15')](_0x1eafc1));}return _0x5f5a50;};exports[_0x3221('0x16')]=function(_0x1c430f){if(!_[_0x3221('0x17')](_0x1c430f)&&_0x1c430f!==''){var _0x4a53e6=/^(([^<>()\[\]\\.,;:\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 _0x4a53e6[_0x3221('0x18')](String(_0x1c430f)[_0x3221('0xc')]());}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 5d9a154..85079d2 100644 --- a/server/services/ami/trigger/integration/vtiger.js +++ b/server/services/ami/trigger/integration/vtiger.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x9c44=['stringify','validateEmail','Getting\x20agent\x20with\x20email','GET','%s/webservice.php','SELECT\x20first_name,\x20last_name,\x20email1\x20FROM\x20Users\x20WHERE\x20email1=\x27%s\x27;','success','length','Agent\x20found!','email1','first_name','last_name','Agent\x20not\x20found,\x20using\x20the\x20admin\x20account!','userId','getUser','admin','Searching\x20end\x20user\x20with\x20phone','SELECT\x20id,\x20firstname,\x20lastname,\x20email,\x20phone,\x20mobile,\x20homephone,\x20otherphone,\x20assistantphone\x20FROM\x20Contacts\x20WHERE\x20phone\x20=\x20\x27%s\x27\x20OR\x20mobile\x20=\x27%s\x27\x20OR\x20homephone\x20=\x27%s\x27\x20OR\x20otherphone\x20=\x27%s\x27\x20OR\x20assistantphone\x20=\x27%s\x27;','Enduser\x20found!','firstname','lastname','Enduser\x20not\x20found,\x20creating\x20a\x20new\x20enduser!','Contacts','Enduser\x20created.','phone','getEndUser','accessKey','login','Account\x20%d\x20is\x20not\x20valid','getConnection','[HTTP]','queue','stripTrailingSlash','[QUEUE]','%s/api/voice/recordings/%s/downloads?type=uniqueid&token=%s','serverUrl','uniqueid','recordingURL','email','The\x20User\x20ID\x20is:','calleridname','The\x20Enduser\x20ID\x20is:','Fields','The\x20Ticket\x20ID\x20is:','split','Displaying\x20ticket\x20to\x20agent\x20in\x20a\x20new\x20tab...','user:%s','recordingFormat','none','[OUTBOUND]','Recording\x20is\x20enabled!','destcalleridname','destcalleridnum','Ticket\x20created!','%s/index.php?module=HelpDesk&view=Detail&record=%s&app=SUPPORT','trigger:browser:url','unmanaged','monitor_format','toUpperCase','calleridnum','lastevent','bluebird','md5','util','ioredis','./util','../../../../config/environment','redis','localhost','socket.io-emitter','emit','forEach','string','picklist','idField','content','type','variable','variableName','toString','customVariable','Variable','name','toLowerCase','info','Creating\x20new\x20ticket...','merge','Normal','Open','getString','Subjects','POST','remoteUri','create','username','sessionName','then','resolve','result','format','Ticket\x20could\x20not\x20be\x20created\x20due\x20to:\x20%s','catch','statusCode','error','[vTiger],\x20%s,\x20%s,\x20%s'];(function(_0x6fb620,_0x2ff514){var _0x1ef308=function(_0x12f32a){while(--_0x12f32a){_0x6fb620['push'](_0x6fb620['shift']());}};_0x1ef308(++_0x2ff514);}(_0x9c44,0x178));var _0x49c4=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0x9c44[_0x3dd15e];return _0x231fd0;};'use strict';var _=require('lodash');var rp=require('request-promise');var BPromise=require(_0x49c4('0x0'));var md5=require(_0x49c4('0x1'));var util=require(_0x49c4('0x2'));var Redis=require(_0x49c4('0x3'));var intUtil=require(_0x49c4('0x4'));var config=require(_0x49c4('0x5'));var logger=require('../../../../config/logger')('vTiger');config[_0x49c4('0x6')]=_['defaults'](config[_0x49c4('0x6')],{'host':_0x49c4('0x7'),'port':0x18eb});var io=require(_0x49c4('0x8'))(new Redis(config[_0x49c4('0x6')]));function emit(_0x436234,_0x511d53,_0x11c586){io['to'](_0x436234)[_0x49c4('0x9')](_0x511d53,_0x11c586);}function getCustomFields(_0x1d13fb,_0x4487ca){var _0x4c7d3a={};if(_0x1d13fb['length']>0x0){_[_0x49c4('0xa')](_0x1d13fb,function(_0x313e73){if(_['includes']([_0x49c4('0xb'),_0x49c4('0xc')],_0x313e73['type'])&&_0x313e73['idField']){_0x4c7d3a[_0x313e73[_0x49c4('0xd')]]=_0x313e73[_0x49c4('0xe')]['toString']();}else if(_0x313e73[_0x49c4('0xf')]===_0x49c4('0x10')&&_0x313e73['variableName']&&_0x313e73[_0x49c4('0xd')]&&_0x4487ca[_0x313e73[_0x49c4('0x11')]]){_0x4c7d3a[_0x313e73[_0x49c4('0xd')]]=_0x4487ca[_0x313e73[_0x49c4('0x11')]][_0x49c4('0x12')]();}else if(_0x313e73[_0x49c4('0xf')]===_0x49c4('0x13')&&_0x313e73[_0x49c4('0x14')]&&_0x313e73['Variable'][_0x49c4('0x15')]&&_0x313e73[_0x49c4('0xd')]&&_0x4487ca[_0x313e73[_0x49c4('0x14')][_0x49c4('0x15')][_0x49c4('0x16')]()]){_0x4c7d3a[_0x313e73['idField']]=_0x4487ca[_0x313e73[_0x49c4('0x14')][_0x49c4('0x15')]['toLowerCase']()]['toString']();}});}return _0x4c7d3a;}function createTicket(_0x3c782d,_0x2f82d5,_0x3addb2,_0x59f29b,_0x24856d,_0x50b151,_0x2cbd50){logger[_0x49c4('0x17')](_0x49c4('0x18'));var _0x291526=_[_0x49c4('0x19')]({'parent_id':'','assigned_user_id':_0x2f82d5['id'],'ticketpriorities':_0x49c4('0x1a'),'ticketstatus':_0x49c4('0x1b'),'ticket_title':intUtil[_0x49c4('0x1c')](_0x59f29b[_0x49c4('0x1d')],_0x24856d,'\x20'),'description':intUtil['getString'](_0x59f29b['Descriptions'],_0x24856d,'\x0a'),'contact_id':_0x3addb2['id']},getCustomFields(_0x50b151,_0x24856d));var _0x57f502={'method':_0x49c4('0x1e'),'uri':util['format']('%s/webservice.php',_0x3c782d[_0x49c4('0x1f')]),'form':{'operation':_0x49c4('0x20'),'username':_0x3c782d[_0x49c4('0x21')],'sessionName':_0x2cbd50[_0x49c4('0x22')],'elementType':'HelpDesk','element':JSON['stringify'](_0x291526)},'json':!![]};return request(_0x57f502)[_0x49c4('0x23')](function(_0x9cb797){if(_0x9cb797['success']){return BPromise[_0x49c4('0x24')]({'id':_0x9cb797[_0x49c4('0x25')]['id']});}else{throw new Error(util[_0x49c4('0x26')](_0x49c4('0x27'),JSON['stringify'](_0x9cb797['error'])));}})[_0x49c4('0x28')](function(_0x53c199){var _0x3800b7=_0x53c199[_0x49c4('0x29')]||0x1f4;logger[_0x49c4('0x2a')](_0x49c4('0x2b'),'createTicket',_0x3800b7,JSON[_0x49c4('0x2c')](_0x53c199));});}function getUser(_0x2b2793,_0x46e04d,_0x4f28a2){if(intUtil[_0x49c4('0x2d')](_0x46e04d)){logger[_0x49c4('0x17')](_0x49c4('0x2e'),_0x46e04d);return request({'method':_0x49c4('0x2f'),'uri':util[_0x49c4('0x26')](_0x49c4('0x30'),_0x2b2793[_0x49c4('0x1f')]),'qs':{'operation':'query','username':_0x2b2793['username'],'sessionName':_0x4f28a2['sessionName'],'query':util[_0x49c4('0x26')](_0x49c4('0x31'),_0x46e04d)},'json':!![]})[_0x49c4('0x23')](function(_0x27e467){if(_0x27e467[_0x49c4('0x32')]&&_0x27e467['result'][_0x49c4('0x33')]){logger[_0x49c4('0x17')](_0x49c4('0x34'));return BPromise[_0x49c4('0x24')]({'id':_0x27e467['result'][0x0]['id'],'email':_0x27e467['result'][0x0][_0x49c4('0x35')],'name':_0x27e467[_0x49c4('0x25')][0x0][_0x49c4('0x36')]+'\x20'+_0x27e467[_0x49c4('0x25')][_0x49c4('0x37')]});}else{logger['info'](_0x49c4('0x38'));return BPromise[_0x49c4('0x24')]({'id':_0x4f28a2[_0x49c4('0x39')],'email':_0x2b2793['username'],'name':'admin'});}})[_0x49c4('0x28')](function(_0x1991e9){var _0x3bec0a=_0x1991e9[_0x49c4('0x29')]||0x1f4;logger[_0x49c4('0x2a')](_0x49c4('0x2b'),_0x49c4('0x3a'),_0x3bec0a,JSON[_0x49c4('0x2c')](_0x1991e9));});}else{logger[_0x49c4('0x17')]('Agent\x20not\x20found,\x20using\x20the\x20admin\x20account!');return BPromise[_0x49c4('0x24')]({'id':_0x4f28a2['userId'],'email':_0x2b2793[_0x49c4('0x21')],'name':_0x49c4('0x3b')})[_0x49c4('0x28')](function(_0x1c2830){var _0x4ed4f8=_0x1c2830[_0x49c4('0x29')]||0x1f4;logger[_0x49c4('0x2a')](_0x49c4('0x2b'),'getUser',_0x4ed4f8,JSON[_0x49c4('0x2c')](_0x1c2830));});}}function getEndUser(_0x21d8c7,_0x178987,_0x5e5366,_0x1ba7a0){logger[_0x49c4('0x17')](_0x49c4('0x3c'),_0x5e5366);return request({'method':_0x49c4('0x2f'),'uri':util[_0x49c4('0x26')](_0x49c4('0x30'),_0x21d8c7[_0x49c4('0x1f')]),'qs':{'operation':'query','username':_0x21d8c7[_0x49c4('0x21')],'sessionName':_0x1ba7a0[_0x49c4('0x22')],'query':util[_0x49c4('0x26')](_0x49c4('0x3d'),_0x5e5366,_0x5e5366,_0x5e5366,_0x5e5366,_0x5e5366)},'json':!![]})[_0x49c4('0x23')](function(_0x29dd5d){if(_0x29dd5d[_0x49c4('0x32')]&&_0x29dd5d[_0x49c4('0x25')][_0x49c4('0x33')]){logger[_0x49c4('0x17')](_0x49c4('0x3e'));return BPromise[_0x49c4('0x24')]({'id':_0x29dd5d[_0x49c4('0x25')][0x0]['id'],'name':_0x29dd5d['result'][0x0][_0x49c4('0x3f')]+'\x20'+_0x29dd5d['result'][0x0][_0x49c4('0x40')],'phone':_0x5e5366});}else{logger[_0x49c4('0x17')](_0x49c4('0x41'));return request({'method':_0x49c4('0x1e'),'uri':util[_0x49c4('0x26')](_0x49c4('0x30'),_0x21d8c7['remoteUri']),'form':{'operation':'create','sessionName':_0x1ba7a0[_0x49c4('0x22')],'elementType':_0x49c4('0x42'),'element':JSON[_0x49c4('0x2c')]({'lastname':_0x178987,'phone':_0x5e5366,'assigned_user_id':'\x20'})},'json':!![]})[_0x49c4('0x23')](function(_0x490823){logger[_0x49c4('0x17')](_0x49c4('0x43'));return BPromise[_0x49c4('0x24')]({'id':_0x490823[_0x49c4('0x25')]['id'],'name':_0x490823[_0x49c4('0x25')][_0x49c4('0x40')],'phone':_0x490823[_0x49c4('0x25')][_0x49c4('0x44')]});})[_0x49c4('0x28')](function(_0x5640d3){var _0x2ad771=_0x5640d3['statusCode']||0x1f4;logger[_0x49c4('0x2a')](_0x49c4('0x2b'),_0x49c4('0x45'),_0x2ad771,JSON[_0x49c4('0x2c')](_0x5640d3));});}});}function getConnection(_0x2d93d8){var _0x5b296d=_0x2d93d8[_0x49c4('0x21')];var _0x15b674=_0x2d93d8[_0x49c4('0x46')];return request({'method':_0x49c4('0x2f'),'uri':util[_0x49c4('0x26')](_0x49c4('0x30'),_0x2d93d8[_0x49c4('0x1f')]),'qs':{'operation':'getchallenge','username':_0x5b296d},'json':!![]})[_0x49c4('0x23')](function(_0x5cfff9){if(_0x5cfff9[_0x49c4('0x32')]){return request({'method':_0x49c4('0x1e'),'uri':util[_0x49c4('0x26')](_0x49c4('0x30'),_0x2d93d8[_0x49c4('0x1f')]),'form':{'operation':_0x49c4('0x47'),'username':_0x5b296d,'accessKey':md5(_0x5cfff9[_0x49c4('0x25')]['token']+_0x15b674)},'json':!![]});}})[_0x49c4('0x23')](function(_0x3feaf0){if(_0x3feaf0['success']){return BPromise[_0x49c4('0x24')](_0x3feaf0[_0x49c4('0x25')]);}else{throw new Error(util[_0x49c4('0x26')](_0x49c4('0x48'),_0x2d93d8['id']));}})['catch'](function(_0x5d8bf0){var _0x144fd2=_0x5d8bf0['statusCode']||0x1f4;logger[_0x49c4('0x2a')](_0x49c4('0x2b'),_0x49c4('0x49'),_0x144fd2,JSON[_0x49c4('0x2c')](_0x5d8bf0));});}function request(_0x240c20){logger[_0x49c4('0x17')](_0x49c4('0x4a'),JSON['stringify'](_0x240c20));return rp(_0x240c20);}exports[_0x49c4('0x4b')]=function(_0x1550ce,_0x3936d3,_0x3d944c,_0x17ef75,_0x2644c0,_0x156748){var _0x25d174,_0x1e0b4f,_0x1856be,_0x5b822f;_0x156748['remoteUri']=intUtil[_0x49c4('0x4c')](_0x156748[_0x49c4('0x1f')]);if(_0x2644c0&&_0x2644c0['monitor_format']){logger['info'](_0x49c4('0x4d'),'Recording\x20is\x20enabled!');_0x3936d3['recordingURL']=util[_0x49c4('0x26')](_0x49c4('0x4e'),_0x156748[_0x49c4('0x4f')],_0x3936d3[_0x49c4('0x50')],md5(_0x3936d3[_0x49c4('0x50')]));}else{_0x3936d3[_0x49c4('0x51')]='';}return getConnection(_0x156748)[_0x49c4('0x23')](function(_0x50798e){_0x5b822f=_0x50798e;return getUser(_0x156748,_0x17ef75[_0x49c4('0x52')],_0x5b822f);})[_0x49c4('0x23')](function(_0x207572){_0x25d174=_0x207572;logger[_0x49c4('0x17')](_0x49c4('0x53'),_0x25d174['id']);return getEndUser(_0x156748,_0x3936d3[_0x49c4('0x54')],_0x3936d3['calleridnum'],_0x5b822f);})['then'](function(_0x1ef0c1){_0x1e0b4f=_0x1ef0c1;logger[_0x49c4('0x17')](_0x49c4('0x55'),_0x1e0b4f['id']);return createTicket(_0x156748,_0x25d174,_0x1e0b4f,_0x3d944c,_0x3936d3,_0x3d944c[_0x49c4('0x56')],_0x5b822f);})[_0x49c4('0x23')](function(_0x6b2592){_0x1856be=_0x6b2592;logger[_0x49c4('0x17')]('Ticket\x20created!');logger[_0x49c4('0x17')](_0x49c4('0x57'),_0x1856be['id']);var _0x4ba4eb=util[_0x49c4('0x26')]('%s/index.php?module=HelpDesk&view=Detail&record=%s&app=SUPPORT',_0x156748[_0x49c4('0x1f')],_[_0x49c4('0x58')](_0x1856be['id'],'x')[0x1]);logger[_0x49c4('0x17')](_0x49c4('0x4d'),_0x49c4('0x59'));emit(util[_0x49c4('0x26')](_0x49c4('0x5a'),_0x17ef75[_0x49c4('0x15')]),'trigger:browser:url',{'uri':_0x4ba4eb});})[_0x49c4('0x28')](function(_0x27b9c2){logger['error'](_0x49c4('0x4d'),JSON[_0x49c4('0x2c')](_0x27b9c2));});};exports['outbound']=function(_0x39c455,_0x42e0e6,_0x4f50bf,_0x4dc54d,_0x589484,_0x513879,_0xc43386){var _0x54947d,_0xb20a5d,_0x32f344,_0x515240;_0x513879[_0x49c4('0x1f')]=intUtil[_0x49c4('0x4c')](_0x513879['remoteUri']);_0x513879[_0x49c4('0x4f')]=intUtil[_0x49c4('0x4c')](_0x513879[_0x49c4('0x4f')]);if(_0xc43386&&_0xc43386[_0x49c4('0x5b')]&&_0xc43386['recordingFormat']!==_0x49c4('0x5c')){logger[_0x49c4('0x17')](_0x49c4('0x5d'),_0x49c4('0x5e'));_0x42e0e6['recordingURL']=util[_0x49c4('0x26')]('%s/api/voice/recordings/%s/downloads?type=uniqueid&token=%s',_0x513879['serverUrl'],_0x42e0e6['uniqueid'],md5(_0x42e0e6['uniqueid']));}return getConnection(_0x513879)[_0x49c4('0x23')](function(_0x32eaef){_0x515240=_0x32eaef;return getUser(_0x513879,_0x4dc54d[_0x49c4('0x52')],_0x515240);})[_0x49c4('0x23')](function(_0x5b056e){_0x54947d=_0x5b056e;logger['info'](_0x49c4('0x53'),_0x54947d['id']);return getEndUser(_0x513879,_0x42e0e6[_0x49c4('0x5f')],_0x42e0e6[_0x49c4('0x60')],_0x515240);})[_0x49c4('0x23')](function(_0x102c15){_0xb20a5d=_0x102c15;logger[_0x49c4('0x17')](_0x49c4('0x55'),_0xb20a5d['id']);return createTicket(_0x513879,_0x54947d,_0xb20a5d,_0x4f50bf,_0x42e0e6,_0x4f50bf[_0x49c4('0x56')],_0x515240);})['then'](function(_0x2276db){_0x32f344=_0x2276db;logger['info'](_0x49c4('0x61'));logger[_0x49c4('0x17')](_0x49c4('0x57'),_0x32f344['id']);var _0x1ea1b4=util[_0x49c4('0x26')](_0x49c4('0x62'),_0x513879[_0x49c4('0x1f')],_[_0x49c4('0x58')](_0x32f344['id'],'x')[0x1]);logger[_0x49c4('0x17')](_0x49c4('0x5d'),_0x49c4('0x59'));emit(util[_0x49c4('0x26')](_0x49c4('0x5a'),_0x4dc54d[_0x49c4('0x15')]),_0x49c4('0x63'),{'uri':_0x1ea1b4});})[_0x49c4('0x28')](function(_0x371e49){logger[_0x49c4('0x2a')]('[OUTBOUND]',JSON['stringify'](_0x371e49));});};exports[_0x49c4('0x64')]=function(_0x16b3e8,_0x4af680,_0x1a15f3,_0x38ad50,_0x2939fd,_0x16e7b1){var _0x4d6aaa,_0x5a14a5,_0x4a85d4,_0x2e90d8;_0x16e7b1[_0x49c4('0x1f')]=intUtil[_0x49c4('0x4c')](_0x16e7b1[_0x49c4('0x1f')]);_0x16e7b1[_0x49c4('0x4f')]=intUtil[_0x49c4('0x4c')](_0x16e7b1[_0x49c4('0x4f')]);if(_0x2939fd&&_0x2939fd[_0x49c4('0x65')]){logger[_0x49c4('0x17')]('['+_0x4af680['lastevent'][_0x49c4('0x66')]()+']',_0x49c4('0x5e'));_0x4af680[_0x49c4('0x51')]=util['format'](_0x49c4('0x4e'),_0x16e7b1[_0x49c4('0x4f')],_0x4af680[_0x49c4('0x50')],md5(_0x4af680[_0x49c4('0x50')]));}else{_0x4af680[_0x49c4('0x51')]='';}return getConnection(_0x16e7b1)[_0x49c4('0x23')](function(_0x35fa39){_0x2e90d8=_0x35fa39;return getUser(_0x16e7b1,'',_0x2e90d8);})[_0x49c4('0x23')](function(_0x4ba198){_0x4d6aaa=_0x4ba198;logger[_0x49c4('0x17')](_0x49c4('0x53'),_0x4d6aaa['id']);return getEndUser(_0x16e7b1,_0x4af680[_0x49c4('0x54')],_0x4af680[_0x49c4('0x67')],_0x2e90d8);})[_0x49c4('0x23')](function(_0x4a204d){_0x5a14a5=_0x4a204d;logger['info'](_0x49c4('0x55'),_0x5a14a5['id']);return createTicket(_0x16e7b1,_0x4d6aaa,_0x5a14a5,_0x1a15f3,_0x4af680,_0x1a15f3['Fields'],_0x2e90d8);})[_0x49c4('0x23')](function(_0x558880){_0x4a85d4=_0x558880;logger[_0x49c4('0x17')](_0x49c4('0x61'));logger[_0x49c4('0x17')](_0x49c4('0x57'),_0x4a85d4['id']);})['catch'](function(_0x123060){logger[_0x49c4('0x2a')]('['+_0x4af680[_0x49c4('0x68')][_0x49c4('0x66')]()+']',JSON[_0x49c4('0x2c')](_0x123060));});}; \ No newline at end of file +var _0xe706=['result','Agent\x20found!','email1','first_name','last_name','Agent\x20not\x20found,\x20using\x20the\x20admin\x20account!','userId','admin','getUser','username','Searching\x20end\x20user\x20with\x20phone','remoteUri','SELECT\x20id,\x20firstname,\x20lastname,\x20email,\x20phone,\x20mobile,\x20homephone,\x20otherphone,\x20assistantphone\x20FROM\x20Contacts\x20WHERE\x20phone\x20=\x20\x27%s\x27\x20OR\x20mobile\x20=\x27%s\x27\x20OR\x20homephone\x20=\x27%s\x27\x20OR\x20otherphone\x20=\x27%s\x27\x20OR\x20assistantphone\x20=\x27%s\x27;','Enduser\x20found!','firstname','lastname','Enduser\x20not\x20found,\x20creating\x20a\x20new\x20enduser!','Contacts','phone','catch','accessKey','getchallenge','token','Account\x20%d\x20is\x20not\x20valid','getConnection','queue','stripTrailingSlash','[QUEUE]','recordingURL','%s/api/voice/recordings/%s/downloads?type=uniqueid&token=%s','serverUrl','uniqueid','email','The\x20User\x20ID\x20is:','calleridname','calleridnum','The\x20Enduser\x20ID\x20is:','Fields','Ticket\x20created!','%s/index.php?module=HelpDesk&view=Detail&record=%s&app=SUPPORT','split','Displaying\x20ticket\x20to\x20agent\x20in\x20a\x20new\x20tab...','trigger:browser:url','outbound','recordingFormat','none','[OUTBOUND]','Recording\x20is\x20enabled!','destcalleridname','destcalleridnum','The\x20Ticket\x20ID\x20is:','user:%s','unmanaged','lastevent','toUpperCase','lodash','request-promise','bluebird','util','ioredis','./util','../../../../config/environment','../../../../config/logger','vTiger','redis','defaults','localhost','socket.io-emitter','emit','length','forEach','includes','string','idField','content','toString','type','variable','variableName','Variable','name','toLowerCase','info','Creating\x20new\x20ticket...','merge','Normal','Open','Subjects','getString','Descriptions','POST','format','%s/webservice.php','create','stringify','then','success','resolve','Ticket\x20could\x20not\x20be\x20created\x20due\x20to:\x20%s','statusCode','error','[vTiger],\x20%s,\x20%s,\x20%s','validateEmail','Getting\x20agent\x20with\x20email','GET','query','sessionName','SELECT\x20first_name,\x20last_name,\x20email1\x20FROM\x20Users\x20WHERE\x20email1=\x27%s\x27;'];(function(_0x56cce9,_0x268c38){var _0x268d4e=function(_0x3b114a){while(--_0x3b114a){_0x56cce9['push'](_0x56cce9['shift']());}};_0x268d4e(++_0x268c38);}(_0xe706,0xa3));var _0x6e70=function(_0x5eb1a8,_0x30e664){_0x5eb1a8=_0x5eb1a8-0x0;var _0x14c11c=_0xe706[_0x5eb1a8];return _0x14c11c;};'use strict';var _=require(_0x6e70('0x0'));var rp=require(_0x6e70('0x1'));var BPromise=require(_0x6e70('0x2'));var md5=require('md5');var util=require(_0x6e70('0x3'));var Redis=require(_0x6e70('0x4'));var intUtil=require(_0x6e70('0x5'));var config=require(_0x6e70('0x6'));var logger=require(_0x6e70('0x7'))(_0x6e70('0x8'));config[_0x6e70('0x9')]=_[_0x6e70('0xa')](config[_0x6e70('0x9')],{'host':_0x6e70('0xb'),'port':0x18eb});var io=require(_0x6e70('0xc'))(new Redis(config[_0x6e70('0x9')]));function emit(_0x45a2d4,_0x188ed3,_0x3c4843){io['to'](_0x45a2d4)[_0x6e70('0xd')](_0x188ed3,_0x3c4843);}function getCustomFields(_0x954545,_0x25e61c){var _0x100eb7={};if(_0x954545[_0x6e70('0xe')]>0x0){_[_0x6e70('0xf')](_0x954545,function(_0x3f474a){if(_[_0x6e70('0x10')]([_0x6e70('0x11'),'picklist'],_0x3f474a['type'])&&_0x3f474a[_0x6e70('0x12')]){_0x100eb7[_0x3f474a[_0x6e70('0x12')]]=_0x3f474a[_0x6e70('0x13')][_0x6e70('0x14')]();}else if(_0x3f474a[_0x6e70('0x15')]===_0x6e70('0x16')&&_0x3f474a[_0x6e70('0x17')]&&_0x3f474a[_0x6e70('0x12')]&&_0x25e61c[_0x3f474a['variableName']]){_0x100eb7[_0x3f474a['idField']]=_0x25e61c[_0x3f474a['variableName']][_0x6e70('0x14')]();}else if(_0x3f474a['type']==='customVariable'&&_0x3f474a[_0x6e70('0x18')]&&_0x3f474a[_0x6e70('0x18')]['name']&&_0x3f474a[_0x6e70('0x12')]&&_0x25e61c[_0x3f474a['Variable'][_0x6e70('0x19')][_0x6e70('0x1a')]()]){_0x100eb7[_0x3f474a['idField']]=_0x25e61c[_0x3f474a['Variable'][_0x6e70('0x19')]['toLowerCase']()][_0x6e70('0x14')]();}});}return _0x100eb7;}function createTicket(_0x173afe,_0x53acdc,_0x497d61,_0xc238ba,_0x208e21,_0x2368eb,_0x3a9978){logger[_0x6e70('0x1b')](_0x6e70('0x1c'));var _0x1b2453=_[_0x6e70('0x1d')]({'parent_id':'','assigned_user_id':_0x53acdc['id'],'ticketpriorities':_0x6e70('0x1e'),'ticketstatus':_0x6e70('0x1f'),'ticket_title':intUtil['getString'](_0xc238ba[_0x6e70('0x20')],_0x208e21,'\x20'),'description':intUtil[_0x6e70('0x21')](_0xc238ba[_0x6e70('0x22')],_0x208e21,'\x0a'),'contact_id':_0x497d61['id']},getCustomFields(_0x2368eb,_0x208e21));var _0x502b2d={'method':_0x6e70('0x23'),'uri':util[_0x6e70('0x24')](_0x6e70('0x25'),_0x173afe['remoteUri']),'form':{'operation':_0x6e70('0x26'),'username':_0x173afe['username'],'sessionName':_0x3a9978['sessionName'],'elementType':'HelpDesk','element':JSON[_0x6e70('0x27')](_0x1b2453)},'json':!![]};return request(_0x502b2d)[_0x6e70('0x28')](function(_0x51d292){if(_0x51d292[_0x6e70('0x29')]){return BPromise[_0x6e70('0x2a')]({'id':_0x51d292['result']['id']});}else{throw new Error(util[_0x6e70('0x24')](_0x6e70('0x2b'),JSON[_0x6e70('0x27')](_0x51d292['error'])));}})['catch'](function(_0x2c4d37){var _0x3af17f=_0x2c4d37[_0x6e70('0x2c')]||0x1f4;logger[_0x6e70('0x2d')](_0x6e70('0x2e'),'createTicket',_0x3af17f,JSON[_0x6e70('0x27')](_0x2c4d37));});}function getUser(_0x406f29,_0xecf336,_0x2864a0){if(intUtil[_0x6e70('0x2f')](_0xecf336)){logger[_0x6e70('0x1b')](_0x6e70('0x30'),_0xecf336);return request({'method':_0x6e70('0x31'),'uri':util[_0x6e70('0x24')](_0x6e70('0x25'),_0x406f29['remoteUri']),'qs':{'operation':_0x6e70('0x32'),'username':_0x406f29['username'],'sessionName':_0x2864a0[_0x6e70('0x33')],'query':util['format'](_0x6e70('0x34'),_0xecf336)},'json':!![]})[_0x6e70('0x28')](function(_0x30fa0b){if(_0x30fa0b['success']&&_0x30fa0b[_0x6e70('0x35')][_0x6e70('0xe')]){logger['info'](_0x6e70('0x36'));return BPromise[_0x6e70('0x2a')]({'id':_0x30fa0b['result'][0x0]['id'],'email':_0x30fa0b[_0x6e70('0x35')][0x0][_0x6e70('0x37')],'name':_0x30fa0b[_0x6e70('0x35')][0x0][_0x6e70('0x38')]+'\x20'+_0x30fa0b[_0x6e70('0x35')][_0x6e70('0x39')]});}else{logger[_0x6e70('0x1b')](_0x6e70('0x3a'));return BPromise[_0x6e70('0x2a')]({'id':_0x2864a0[_0x6e70('0x3b')],'email':_0x406f29['username'],'name':_0x6e70('0x3c')});}})['catch'](function(_0x23cd1a){var _0x3222a2=_0x23cd1a[_0x6e70('0x2c')]||0x1f4;logger[_0x6e70('0x2d')](_0x6e70('0x2e'),_0x6e70('0x3d'),_0x3222a2,JSON[_0x6e70('0x27')](_0x23cd1a));});}else{logger[_0x6e70('0x1b')](_0x6e70('0x3a'));return BPromise[_0x6e70('0x2a')]({'id':_0x2864a0[_0x6e70('0x3b')],'email':_0x406f29[_0x6e70('0x3e')],'name':_0x6e70('0x3c')})['catch'](function(_0x5446a2){var _0x5424eb=_0x5446a2[_0x6e70('0x2c')]||0x1f4;logger[_0x6e70('0x2d')](_0x6e70('0x2e'),_0x6e70('0x3d'),_0x5424eb,JSON[_0x6e70('0x27')](_0x5446a2));});}}function getEndUser(_0x3bdd87,_0x572a71,_0x3b508c,_0x9e7ad2){logger[_0x6e70('0x1b')](_0x6e70('0x3f'),_0x3b508c);return request({'method':_0x6e70('0x31'),'uri':util[_0x6e70('0x24')](_0x6e70('0x25'),_0x3bdd87[_0x6e70('0x40')]),'qs':{'operation':'query','username':_0x3bdd87[_0x6e70('0x3e')],'sessionName':_0x9e7ad2[_0x6e70('0x33')],'query':util[_0x6e70('0x24')](_0x6e70('0x41'),_0x3b508c,_0x3b508c,_0x3b508c,_0x3b508c,_0x3b508c)},'json':!![]})[_0x6e70('0x28')](function(_0x1de947){if(_0x1de947[_0x6e70('0x29')]&&_0x1de947['result']['length']){logger['info'](_0x6e70('0x42'));return BPromise[_0x6e70('0x2a')]({'id':_0x1de947[_0x6e70('0x35')][0x0]['id'],'name':_0x1de947[_0x6e70('0x35')][0x0][_0x6e70('0x43')]+'\x20'+_0x1de947['result'][0x0][_0x6e70('0x44')],'phone':_0x3b508c});}else{logger[_0x6e70('0x1b')](_0x6e70('0x45'));return request({'method':'POST','uri':util['format']('%s/webservice.php',_0x3bdd87[_0x6e70('0x40')]),'form':{'operation':'create','sessionName':_0x9e7ad2[_0x6e70('0x33')],'elementType':_0x6e70('0x46'),'element':JSON[_0x6e70('0x27')]({'lastname':_0x572a71,'phone':_0x3b508c,'assigned_user_id':'\x20'})},'json':!![]})[_0x6e70('0x28')](function(_0x59c87d){logger[_0x6e70('0x1b')]('Enduser\x20created.');return BPromise[_0x6e70('0x2a')]({'id':_0x59c87d[_0x6e70('0x35')]['id'],'name':_0x59c87d[_0x6e70('0x35')][_0x6e70('0x44')],'phone':_0x59c87d['result'][_0x6e70('0x47')]});})[_0x6e70('0x48')](function(_0x3d39c3){var _0xac87d6=_0x3d39c3[_0x6e70('0x2c')]||0x1f4;logger[_0x6e70('0x2d')](_0x6e70('0x2e'),'getEndUser',_0xac87d6,JSON[_0x6e70('0x27')](_0x3d39c3));});}});}function getConnection(_0x3884a4){var _0x10de2a=_0x3884a4[_0x6e70('0x3e')];var _0x3f86cf=_0x3884a4[_0x6e70('0x49')];return request({'method':_0x6e70('0x31'),'uri':util['format'](_0x6e70('0x25'),_0x3884a4['remoteUri']),'qs':{'operation':_0x6e70('0x4a'),'username':_0x10de2a},'json':!![]})[_0x6e70('0x28')](function(_0x4b351e){if(_0x4b351e['success']){return request({'method':_0x6e70('0x23'),'uri':util[_0x6e70('0x24')](_0x6e70('0x25'),_0x3884a4['remoteUri']),'form':{'operation':'login','username':_0x10de2a,'accessKey':md5(_0x4b351e[_0x6e70('0x35')][_0x6e70('0x4b')]+_0x3f86cf)},'json':!![]});}})[_0x6e70('0x28')](function(_0x79653){if(_0x79653[_0x6e70('0x29')]){return BPromise[_0x6e70('0x2a')](_0x79653['result']);}else{throw new Error(util[_0x6e70('0x24')](_0x6e70('0x4c'),_0x3884a4['id']));}})[_0x6e70('0x48')](function(_0x6ed023){var _0x2c3a7d=_0x6ed023['statusCode']||0x1f4;logger['error'](_0x6e70('0x2e'),_0x6e70('0x4d'),_0x2c3a7d,JSON[_0x6e70('0x27')](_0x6ed023));});}function request(_0x15f994){logger[_0x6e70('0x1b')]('[HTTP]',JSON[_0x6e70('0x27')](_0x15f994));return rp(_0x15f994);}exports[_0x6e70('0x4e')]=function(_0x1fa320,_0x23ebfb,_0x3aba34,_0x4a111a,_0x1142cd,_0x1dd242){var _0x2c20d3,_0x3fb0d3,_0x8ef4f7,_0x3fd03d;_0x1dd242['remoteUri']=intUtil[_0x6e70('0x4f')](_0x1dd242[_0x6e70('0x40')]);if(_0x1142cd&&_0x1142cd['monitor_format']){logger[_0x6e70('0x1b')](_0x6e70('0x50'),'Recording\x20is\x20enabled!');_0x23ebfb[_0x6e70('0x51')]=util[_0x6e70('0x24')](_0x6e70('0x52'),_0x1dd242[_0x6e70('0x53')],_0x23ebfb[_0x6e70('0x54')],md5(_0x23ebfb['uniqueid']));}else{_0x23ebfb[_0x6e70('0x51')]='';}return getConnection(_0x1dd242)[_0x6e70('0x28')](function(_0x10d655){_0x3fd03d=_0x10d655;return getUser(_0x1dd242,_0x4a111a[_0x6e70('0x55')],_0x3fd03d);})[_0x6e70('0x28')](function(_0x1fe13a){_0x2c20d3=_0x1fe13a;logger[_0x6e70('0x1b')](_0x6e70('0x56'),_0x2c20d3['id']);return getEndUser(_0x1dd242,_0x23ebfb[_0x6e70('0x57')],_0x23ebfb[_0x6e70('0x58')],_0x3fd03d);})[_0x6e70('0x28')](function(_0x1b12a1){_0x3fb0d3=_0x1b12a1;logger[_0x6e70('0x1b')](_0x6e70('0x59'),_0x3fb0d3['id']);return createTicket(_0x1dd242,_0x2c20d3,_0x3fb0d3,_0x3aba34,_0x23ebfb,_0x3aba34[_0x6e70('0x5a')],_0x3fd03d);})[_0x6e70('0x28')](function(_0x324fa6){_0x8ef4f7=_0x324fa6;logger[_0x6e70('0x1b')](_0x6e70('0x5b'));logger[_0x6e70('0x1b')]('The\x20Ticket\x20ID\x20is:',_0x8ef4f7['id']);var _0x28898a=util[_0x6e70('0x24')](_0x6e70('0x5c'),_0x1dd242[_0x6e70('0x40')],_[_0x6e70('0x5d')](_0x8ef4f7['id'],'x')[0x1]);logger[_0x6e70('0x1b')]('[QUEUE]',_0x6e70('0x5e'));emit(util[_0x6e70('0x24')]('user:%s',_0x4a111a[_0x6e70('0x19')]),_0x6e70('0x5f'),{'uri':_0x28898a});})[_0x6e70('0x48')](function(_0x590f7f){logger['error'](_0x6e70('0x50'),JSON[_0x6e70('0x27')](_0x590f7f));});};exports[_0x6e70('0x60')]=function(_0x41a861,_0x10d299,_0x739946,_0x30cd88,_0x57bfe5,_0x4d47e1,_0x2c8dc6){var _0x1e23c5,_0x2bf9ec,_0x2ad395,_0x5b1e6f;_0x4d47e1['remoteUri']=intUtil[_0x6e70('0x4f')](_0x4d47e1[_0x6e70('0x40')]);_0x4d47e1['serverUrl']=intUtil['stripTrailingSlash'](_0x4d47e1[_0x6e70('0x53')]);if(_0x2c8dc6&&_0x2c8dc6['recordingFormat']&&_0x2c8dc6[_0x6e70('0x61')]!==_0x6e70('0x62')){logger[_0x6e70('0x1b')](_0x6e70('0x63'),_0x6e70('0x64'));_0x10d299[_0x6e70('0x51')]=util[_0x6e70('0x24')](_0x6e70('0x52'),_0x4d47e1['serverUrl'],_0x10d299[_0x6e70('0x54')],md5(_0x10d299[_0x6e70('0x54')]));}return getConnection(_0x4d47e1)[_0x6e70('0x28')](function(_0x346c79){_0x5b1e6f=_0x346c79;return getUser(_0x4d47e1,_0x30cd88[_0x6e70('0x55')],_0x5b1e6f);})['then'](function(_0x5f5b02){_0x1e23c5=_0x5f5b02;logger['info'](_0x6e70('0x56'),_0x1e23c5['id']);return getEndUser(_0x4d47e1,_0x10d299[_0x6e70('0x65')],_0x10d299[_0x6e70('0x66')],_0x5b1e6f);})['then'](function(_0x58cf1c){_0x2bf9ec=_0x58cf1c;logger[_0x6e70('0x1b')](_0x6e70('0x59'),_0x2bf9ec['id']);return createTicket(_0x4d47e1,_0x1e23c5,_0x2bf9ec,_0x739946,_0x10d299,_0x739946[_0x6e70('0x5a')],_0x5b1e6f);})[_0x6e70('0x28')](function(_0x2285f1){_0x2ad395=_0x2285f1;logger[_0x6e70('0x1b')]('Ticket\x20created!');logger[_0x6e70('0x1b')](_0x6e70('0x67'),_0x2ad395['id']);var _0x30d11b=util[_0x6e70('0x24')]('%s/index.php?module=HelpDesk&view=Detail&record=%s&app=SUPPORT',_0x4d47e1[_0x6e70('0x40')],_['split'](_0x2ad395['id'],'x')[0x1]);logger['info'](_0x6e70('0x63'),_0x6e70('0x5e'));emit(util[_0x6e70('0x24')](_0x6e70('0x68'),_0x30cd88[_0x6e70('0x19')]),_0x6e70('0x5f'),{'uri':_0x30d11b});})['catch'](function(_0x370eeb){logger[_0x6e70('0x2d')](_0x6e70('0x63'),JSON[_0x6e70('0x27')](_0x370eeb));});};exports[_0x6e70('0x69')]=function(_0x13c092,_0x363722,_0xd9b4a9,_0x2f1362,_0x29621a,_0x575938){var _0x44c877,_0x303c5a,_0x577c3b,_0x5d398a;_0x575938['remoteUri']=intUtil[_0x6e70('0x4f')](_0x575938[_0x6e70('0x40')]);_0x575938[_0x6e70('0x53')]=intUtil[_0x6e70('0x4f')](_0x575938[_0x6e70('0x53')]);if(_0x29621a&&_0x29621a['monitor_format']){logger['info']('['+_0x363722[_0x6e70('0x6a')][_0x6e70('0x6b')]()+']','Recording\x20is\x20enabled!');_0x363722[_0x6e70('0x51')]=util[_0x6e70('0x24')](_0x6e70('0x52'),_0x575938[_0x6e70('0x53')],_0x363722[_0x6e70('0x54')],md5(_0x363722[_0x6e70('0x54')]));}else{_0x363722[_0x6e70('0x51')]='';}return getConnection(_0x575938)[_0x6e70('0x28')](function(_0x3650e9){_0x5d398a=_0x3650e9;return getUser(_0x575938,'',_0x5d398a);})[_0x6e70('0x28')](function(_0x347cc4){_0x44c877=_0x347cc4;logger[_0x6e70('0x1b')](_0x6e70('0x56'),_0x44c877['id']);return getEndUser(_0x575938,_0x363722[_0x6e70('0x57')],_0x363722['calleridnum'],_0x5d398a);})['then'](function(_0x39ed95){_0x303c5a=_0x39ed95;logger['info'](_0x6e70('0x59'),_0x303c5a['id']);return createTicket(_0x575938,_0x44c877,_0x303c5a,_0xd9b4a9,_0x363722,_0xd9b4a9['Fields'],_0x5d398a);})['then'](function(_0x402f6f){_0x577c3b=_0x402f6f;logger['info']('Ticket\x20created!');logger[_0x6e70('0x1b')](_0x6e70('0x67'),_0x577c3b['id']);})[_0x6e70('0x48')](function(_0x4e9fda){logger['error']('['+_0x363722['lastevent'][_0x6e70('0x6b')]()+']',JSON['stringify'](_0x4e9fda));});}; \ No newline at end of file diff --git a/server/services/ami/trigger/integration/zendesk.js b/server/services/ami/trigger/integration/zendesk.js index 5b744c8..55d8ae6 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 _0xf9ba=['%s/channels/voice/agents/%d/tickets/%d/display.json','Displaying\x20ticket\x20to\x20agent\x20in\x20a\x20new\x20tab...','user:%s','trigger:browser:url','%s/agent/tickets/%s','replace','/api/v2','error','Zendesk\x20account\x20type\x20not\x20recognized','catch','[QUEUE]\x20Error\x20running\x20Zendesk\x20integration','inspect','recordingFormat','none','[OUTBOUND]','The\x20User\x20ID\x20is:','destcalleridname','newTab','[OUTBOUND]\x20Error\x20running\x20Zendesk\x20integration','unmanaged','lastevent','toUpperCase','Recording\x20is\x20enabled!','calleridnum','request-promise','md5','util','../../../../config/environment','../../../../config/logger','redis','defaults','localhost','socket.io-emitter','emit','info','Creating\x20new\x20ticket...','format','%s/tickets.json','remoteUri','merge','Tags','name','getString','Descriptions','Fields','then','Ticket\x20created!','ticket','validateEmail','Getting\x20agent\x20with\x20email','%s/search.json','type:user\x20role:agent\x20email:%s','count','Agent\x20found!','find','results','agent','Agent\x20not\x20found,\x20using\x20the\x20admin\x20account!','user','%s/users/me.json','Admin\x20account\x20selected.','Searching\x20enduser\x20with\x20phone','length','end-user','first','Enduser\x20found!','Enduser\x20not\x20found,\x20creating\x20a\x20new\x20enduser!','%s/users.json','POST','Caller\x20-\x20%s','Enduser\x20created.','authType','password','username','token','%s/token:%s','toString','base64','debug','stringify','map','forEach','string','type','nameField','customField','toLowerCase','content','picklist','idField','custom_fields','push','variableName','customVariable','Variable','queue','stripTrailingSlash','serverUrl','monitor_format','[QUEUE]','recordingURL','%s/api/voice/recordings/%s/downloads?type=uniqueid&token=%s','uniqueid','Authorization','email','calleridname','The\x20Enduser\x20ID\x20is:','The\x20Ticket\x20ID\x20is:','integrationTab','Displaying\x20ticket\x20to\x20agent...'];(function(_0xfbd6da,_0x375a05){var _0x5c30a3=function(_0xe656a4){while(--_0xe656a4){_0xfbd6da['push'](_0xfbd6da['shift']());}};_0x5c30a3(++_0x375a05);}(_0xf9ba,0x86));var _0xaf9b=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0xf9ba[_0x3dd15e];return _0x231fd0;};'use strict';var _=require('lodash');var rp=require(_0xaf9b('0x0'));var md5=require(_0xaf9b('0x1'));var util=require(_0xaf9b('0x2'));var Redis=require('ioredis');var intUtil=require('./util');var config=require(_0xaf9b('0x3'));var logger=require(_0xaf9b('0x4'))('zendesk');config[_0xaf9b('0x5')]=_[_0xaf9b('0x6')](config[_0xaf9b('0x5')],{'host':_0xaf9b('0x7'),'port':0x18eb});var io=require(_0xaf9b('0x8'))(new Redis(config[_0xaf9b('0x5')]));function emit(_0x339cf6,_0x14b799,_0x3f0060){io['to'](_0x339cf6)[_0xaf9b('0x9')](_0x14b799,_0x3f0060);}var headers={'Content-Type':'application/json','Accept':'application/json'};function getTicket(_0x1c1e4d,_0x23c57b,_0x193f20,_0x1191f8,_0x2d1b88){logger[_0xaf9b('0xa')](_0xaf9b('0xb'));return request({'uri':util[_0xaf9b('0xc')](_0xaf9b('0xd'),_0x1c1e4d[_0xaf9b('0xe')]),'method':'POST','body':{'ticket':_[_0xaf9b('0xf')]({'requester_id':_0x193f20['id'],'submitter_id':_0x23c57b?_0x23c57b['id']:undefined,'assignee_id':_0x23c57b?_0x23c57b['id']:undefined,'tags':getTags(_0x1191f8[_0xaf9b('0x10')],_0xaf9b('0x11')),'subject':intUtil[_0xaf9b('0x12')](_0x1191f8['Subjects'],_0x2d1b88,'\x20'),'description':intUtil[_0xaf9b('0x12')](_0x1191f8[_0xaf9b('0x13')],_0x2d1b88,'\x0a'),'comment':{'public':![],'body':intUtil[_0xaf9b('0x12')](_0x1191f8[_0xaf9b('0x13')],_0x2d1b88,'\x0a')}},getCustomFields(_0x1191f8[_0xaf9b('0x14')],_0x2d1b88))}})[_0xaf9b('0x15')](function(_0x2ad02f){logger[_0xaf9b('0xa')](_0xaf9b('0x16'));return _0x2ad02f[_0xaf9b('0x17')];});}function getUser(_0x539577,_0x59072b){if(intUtil[_0xaf9b('0x18')](_0x59072b)){logger[_0xaf9b('0xa')](_0xaf9b('0x19'),_0x59072b);return request({'uri':util['format'](_0xaf9b('0x1a'),_0x539577['remoteUri']),'qs':{'query':util[_0xaf9b('0xc')](_0xaf9b('0x1b'),_0x59072b)}})['then'](function(_0x22eeb5){if(_0x22eeb5[_0xaf9b('0x1c')]){logger['info'](_0xaf9b('0x1d'));return _[_0xaf9b('0x1e')](_0x22eeb5[_0xaf9b('0x1f')],{'email':_0x59072b,'role':_0xaf9b('0x20')});}else{logger['info'](_0xaf9b('0x21'));return request({'uri':util['format']('%s/users/me.json',_0x539577[_0xaf9b('0xe')])})[_0xaf9b('0x15')](function(_0x4bebf9){logger['info']('Admin\x20account\x20selected.');return _0x4bebf9[_0xaf9b('0x22')];});}});}else{logger[_0xaf9b('0xa')]('Agent\x20not\x20found,\x20using\x20the\x20admin\x20account!');return request({'uri':util[_0xaf9b('0xc')](_0xaf9b('0x23'),_0x539577['remoteUri'])})[_0xaf9b('0x15')](function(_0x9b8624){logger[_0xaf9b('0xa')](_0xaf9b('0x24'));return _0x9b8624['user'];});}}function getEndUser(_0x5b093e,_0x564676,_0x54fb20){logger[_0xaf9b('0xa')](_0xaf9b('0x25'),_0x54fb20);return request({'uri':util[_0xaf9b('0xc')](_0xaf9b('0x1a'),_0x5b093e[_0xaf9b('0xe')]),'qs':{'query':util[_0xaf9b('0xc')]('type:user\x20role:end-user\x20phone:%s',_0x54fb20)}})[_0xaf9b('0x15')](function(_0x53f71c){var _0x4ffc07;if(_0x53f71c[_0xaf9b('0x1f')][_0xaf9b('0x26')]){_0x53f71c[_0xaf9b('0x1f')]=_['filter'](_0x53f71c['results'],{'suspended':![],'role':_0xaf9b('0x27')});if(_0x53f71c[_0xaf9b('0x1f')][_0xaf9b('0x26')]){_0x4ffc07=_[_0xaf9b('0x28')](_0x53f71c['results']);}}if(_0x4ffc07){logger[_0xaf9b('0xa')](_0xaf9b('0x29'));return _0x4ffc07;}else{logger['info'](_0xaf9b('0x2a'));return request({'uri':util[_0xaf9b('0xc')](_0xaf9b('0x2b'),_0x5b093e[_0xaf9b('0xe')]),'method':_0xaf9b('0x2c'),'body':{'user':{'role':_0xaf9b('0x27'),'name':util[_0xaf9b('0xc')](_0xaf9b('0x2d'),_0x564676||_0x54fb20),'phone':_0x54fb20}}})['then'](function(_0x886b8){logger['info'](_0xaf9b('0x2e'));return _0x886b8[_0xaf9b('0x22')];});}});}function getAuth(_0x514064){var _0x5c24c8;if(_0x514064[_0xaf9b('0x2f')]===_0xaf9b('0x30')){_0x5c24c8=util[_0xaf9b('0xc')]('%s:%s',_0x514064[_0xaf9b('0x31')],_0x514064[_0xaf9b('0x30')]);}else if(_0x514064[_0xaf9b('0x2f')]===_0xaf9b('0x32')){_0x5c24c8=util[_0xaf9b('0xc')](_0xaf9b('0x33'),_0x514064[_0xaf9b('0x31')],_0x514064['token']);}return util[_0xaf9b('0xc')]('Basic\x20%s',new Buffer(_0x5c24c8)[_0xaf9b('0x34')](_0xaf9b('0x35')));}function request(_0x5c1607){logger[_0xaf9b('0x36')]('[HTTP]',JSON[_0xaf9b('0x37')](_0x5c1607));return rp(_['defaults'](_0x5c1607,{'method':'GET','headers':headers,'json':!![]}));}function getTags(_0x4760de,_0x384a4e){var _0x2be6dc=[];if(_0x4760de&&_0x4760de[_0xaf9b('0x26')]>0x0){_0x2be6dc=_[_0xaf9b('0x38')](_0x4760de,_0x384a4e);}return _0x2be6dc;}function getCustomFields(_0x309e52,_0xf567a1){var _0x4ffc2c=[];var _0x3450c5={'custom_fields':[]};if(_0x309e52[_0xaf9b('0x26')]>0x0){_[_0xaf9b('0x39')](_0x309e52,function(_0x50a8d7){if(_['includes']([_0xaf9b('0x3a'),'picklist'],_0x50a8d7[_0xaf9b('0x3b')])&&_0x50a8d7[_0xaf9b('0x3c')]&&!_0x50a8d7[_0xaf9b('0x3d')]){_0x3450c5[_0x50a8d7[_0xaf9b('0x3c')][_0xaf9b('0x3e')]()]=_0x50a8d7[_0xaf9b('0x3f')][_0xaf9b('0x34')]();}else if(_['includes'](['string',_0xaf9b('0x40')],_0x50a8d7[_0xaf9b('0x3b')])&&_0x50a8d7[_0xaf9b('0x41')]&&_0x50a8d7[_0xaf9b('0x3d')]){_0x3450c5[_0xaf9b('0x42')][_0xaf9b('0x43')]({'id':_0x50a8d7['idField'],'value':_0x50a8d7[_0xaf9b('0x3f')][_0xaf9b('0x34')]()});}else if(_0x50a8d7[_0xaf9b('0x3b')]==='variable'&&_0x50a8d7[_0xaf9b('0x44')]&&_0x50a8d7['idField']&&_0x50a8d7[_0xaf9b('0x3d')]){_0xf567a1[_0x50a8d7['variableName']]&&_0x3450c5['custom_fields'][_0xaf9b('0x43')]({'id':_0x50a8d7[_0xaf9b('0x41')],'value':_0xf567a1[_0x50a8d7['variableName']]['toString']()});}else if(_0x50a8d7['type']===_0xaf9b('0x45')&&_0x50a8d7[_0xaf9b('0x46')]&&_0x50a8d7[_0xaf9b('0x46')][_0xaf9b('0x11')]&&_0x50a8d7['idField']&&_0x50a8d7[_0xaf9b('0x3d')]){_0xf567a1[_0x50a8d7[_0xaf9b('0x46')][_0xaf9b('0x11')][_0xaf9b('0x3e')]()]&&_0x3450c5[_0xaf9b('0x42')][_0xaf9b('0x43')]({'id':_0x50a8d7[_0xaf9b('0x41')],'value':_0xf567a1[_0x50a8d7[_0xaf9b('0x46')][_0xaf9b('0x11')][_0xaf9b('0x3e')]()][_0xaf9b('0x34')]()});}});}return _0x3450c5;}exports[_0xaf9b('0x47')]=function(_0x11a79d,_0x349e48,_0x58792f,_0x39e943,_0x21a632,_0x297c88){var _0x4a80f1,_0x25db03;_0x297c88[_0xaf9b('0xe')]=intUtil[_0xaf9b('0x48')](_0x297c88[_0xaf9b('0xe')]);_0x297c88['serverUrl']=intUtil[_0xaf9b('0x48')](_0x297c88[_0xaf9b('0x49')]);if(_0x21a632&&_0x21a632[_0xaf9b('0x4a')]){logger[_0xaf9b('0xa')](_0xaf9b('0x4b'),'Recording\x20is\x20enabled!');_0x349e48[_0xaf9b('0x4c')]=util[_0xaf9b('0xc')](_0xaf9b('0x4d'),_0x297c88['serverUrl'],_0x349e48[_0xaf9b('0x4e')],md5(_0x349e48[_0xaf9b('0x4e')]));}else{_0x349e48[_0xaf9b('0x4c')]='';}headers[_0xaf9b('0x4f')]=getAuth(_0x297c88);return getUser(_0x297c88,_0x39e943[_0xaf9b('0x50')])[_0xaf9b('0x15')](function(_0x5d54c0){_0x4a80f1=_0x5d54c0;logger['info']('The\x20User\x20ID\x20is:',_0x4a80f1['id']);return getEndUser(_0x297c88,_0x349e48[_0xaf9b('0x51')],_0x349e48['calleridnum']);})[_0xaf9b('0x15')](function(_0x3ebeb1){_0x25db03=_0x3ebeb1;logger['info'](_0xaf9b('0x52'),_0x25db03['id']);return getTicket(_0x297c88,_0x4a80f1,_0x25db03,_0x58792f,_0x349e48);})['then'](function(_0x832961){if(_0x832961){logger['info'](_0xaf9b('0x53'),_0x832961['id']);switch(_0x297c88[_0xaf9b('0x3b')]){case _0xaf9b('0x54'):logger[_0xaf9b('0xa')](_0xaf9b('0x4b'),_0xaf9b('0x55'));return request({'uri':util[_0xaf9b('0xc')](_0xaf9b('0x56'),_0x297c88[_0xaf9b('0xe')],_0x4a80f1['id'],_0x832961['id']),'method':'POST'});case'newTab':logger[_0xaf9b('0xa')](_0xaf9b('0x4b'),_0xaf9b('0x57'));emit(util[_0xaf9b('0xc')](_0xaf9b('0x58'),_0x39e943[_0xaf9b('0x11')]),_0xaf9b('0x59'),{'uri':util[_0xaf9b('0xc')](_0xaf9b('0x5a'),_0x297c88['remoteUri'][_0xaf9b('0x5b')](_0xaf9b('0x5c'),''),_0x832961['id'])});break;default:logger[_0xaf9b('0x5d')]('[QUEUE]',_0xaf9b('0x5e'));}}})[_0xaf9b('0x5f')](function(_0x88583){logger[_0xaf9b('0x5d')](_0xaf9b('0x60'),util[_0xaf9b('0x61')](_0x88583,{'showHidden':!![],'depth':null}));});};exports['outbound']=function(_0x3dda0c,_0x4da7f4,_0x37b715,_0x2ba23b,_0x28cb6c,_0x150e55,_0x14da95){var _0x457872,_0x512faf;_0x150e55[_0xaf9b('0xe')]=intUtil['stripTrailingSlash'](_0x150e55[_0xaf9b('0xe')]);_0x150e55[_0xaf9b('0x49')]=intUtil[_0xaf9b('0x48')](_0x150e55[_0xaf9b('0x49')]);if(_0x14da95&&_0x14da95[_0xaf9b('0x62')]&&_0x14da95[_0xaf9b('0x62')]!==_0xaf9b('0x63')){logger[_0xaf9b('0xa')](_0xaf9b('0x64'),'Recording\x20is\x20enabled!');_0x4da7f4['recordingURL']=util['format'](_0xaf9b('0x4d'),_0x150e55['serverUrl'],_0x4da7f4[_0xaf9b('0x4e')],md5(_0x4da7f4[_0xaf9b('0x4e')]));}headers['Authorization']=getAuth(_0x150e55);return getUser(_0x150e55,_0x2ba23b[_0xaf9b('0x50')])[_0xaf9b('0x15')](function(_0x3786a1){_0x457872=_0x3786a1;logger[_0xaf9b('0xa')](_0xaf9b('0x65'),_0x457872['id']);return getEndUser(_0x150e55,_0x4da7f4[_0xaf9b('0x66')],_0x4da7f4['destcalleridnum']);})[_0xaf9b('0x15')](function(_0x1b7678){_0x512faf=_0x1b7678;logger['info'](_0xaf9b('0x52'),_0x512faf['id']);return getTicket(_0x150e55,_0x457872,_0x512faf,_0x37b715,_0x4da7f4);})['then'](function(_0x58f1f1){if(_0x58f1f1){logger['info']('The\x20Ticket\x20ID\x20is:',_0x58f1f1['id']);switch(_0x150e55[_0xaf9b('0x3b')]){case _0xaf9b('0x54'):logger[_0xaf9b('0xa')](_0xaf9b('0x64'),_0xaf9b('0x55'));return request({'uri':util['format'](_0xaf9b('0x56'),_0x150e55[_0xaf9b('0xe')],_0x457872['id'],_0x58f1f1['id']),'method':_0xaf9b('0x2c')});case _0xaf9b('0x67'):logger[_0xaf9b('0xa')]('[OUTBOUND]','Displaying\x20ticket\x20to\x20agent\x20in\x20a\x20new\x20tab...');emit(util[_0xaf9b('0xc')](_0xaf9b('0x58'),_0x2ba23b['name']),_0xaf9b('0x59'),{'uri':util[_0xaf9b('0xc')](_0xaf9b('0x5a'),_0x150e55[_0xaf9b('0xe')][_0xaf9b('0x5b')](_0xaf9b('0x5c'),''),_0x58f1f1['id'])});break;default:logger[_0xaf9b('0x5d')](_0xaf9b('0x64'),_0xaf9b('0x5e'));}}})['catch'](function(_0x643c5b){logger[_0xaf9b('0x5d')](_0xaf9b('0x68'),util[_0xaf9b('0x61')](_0x643c5b,{'showHidden':!![],'depth':null}));});};exports[_0xaf9b('0x69')]=function(_0x466d7e,_0x1a9920,_0x32b459,_0x33d271,_0x3711dc,_0x5e3946){var _0x27b01b,_0x192060;_0x5e3946[_0xaf9b('0xe')]=intUtil[_0xaf9b('0x48')](_0x5e3946[_0xaf9b('0xe')]);_0x5e3946[_0xaf9b('0x49')]=intUtil[_0xaf9b('0x48')](_0x5e3946['serverUrl']);if(_0x3711dc&&_0x3711dc[_0xaf9b('0x4a')]){logger[_0xaf9b('0xa')]('['+_0x1a9920[_0xaf9b('0x6a')][_0xaf9b('0x6b')]()+']',_0xaf9b('0x6c'));_0x1a9920['recordingURL']=util[_0xaf9b('0xc')](_0xaf9b('0x4d'),_0x5e3946[_0xaf9b('0x49')],_0x1a9920['uniqueid'],md5(_0x1a9920['uniqueid']));}else{_0x1a9920['recordingURL']='';}headers[_0xaf9b('0x4f')]=getAuth(_0x5e3946);return getUser(_0x5e3946)[_0xaf9b('0x15')](function(_0x54ccea){_0x27b01b=_0x54ccea;logger[_0xaf9b('0xa')]('The\x20User\x20ID\x20is:',_0x27b01b['id']);return getEndUser(_0x5e3946,_0x1a9920['calleridname'],_0x1a9920[_0xaf9b('0x6d')]);})['then'](function(_0x40fb57){_0x192060=_0x40fb57;logger[_0xaf9b('0xa')](_0xaf9b('0x52'),_0x192060['id']);return getTicket(_0x5e3946,_0x27b01b,_0x192060,_0x32b459,_0x1a9920);})[_0xaf9b('0x15')](function(_0xdd058d){if(_0xdd058d){logger['info'](_0xaf9b('0x53'),_0xdd058d['id']);}})[_0xaf9b('0x5f')](function(_0xa023bb){logger[_0xaf9b('0x5d')]('['+_0x1a9920['lastevent']['toUpperCase']()+']'+'\x20Error\x20running\x20Zendesk\x20integration',util[_0xaf9b('0x61')](_0xa023bb,{'showHidden':!![],'depth':null}));});}; \ No newline at end of file +var _0x8c7b=['Agent\x20found!','find','results','agent','Agent\x20not\x20found,\x20using\x20the\x20admin\x20account!','%s/users/me.json','user','Admin\x20account\x20selected.','Searching\x20enduser\x20with\x20phone','type:user\x20role:end-user\x20phone:%s','length','filter','end-user','first','Enduser\x20not\x20found,\x20creating\x20a\x20new\x20enduser!','%s/users.json','Caller\x20-\x20%s','password','username','authType','%s/token:%s','token','Basic\x20%s','toString','base64','[HTTP]','stringify','defaults','map','forEach','includes','string','picklist','type','customField','nameField','toLowerCase','content','custom_fields','push','variable','variableName','idField','customVariable','Variable','name','stripTrailingSlash','serverUrl','[QUEUE]','Recording\x20is\x20enabled!','uniqueid','recordingURL','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','POST','newTab','Displaying\x20ticket\x20to\x20agent\x20in\x20a\x20new\x20tab...','user:%s','trigger:browser:url','/api/v2','error','Zendesk\x20account\x20type\x20not\x20recognized','catch','inspect','outbound','recordingFormat','none','%s/api/voice/recordings/%s/downloads?type=uniqueid&token=%s','Authorization','destcalleridnum','[OUTBOUND]','unmanaged','monitor_format','lastevent','toUpperCase','lodash','request-promise','md5','./util','../../../../config/environment','zendesk','redis','localhost','emit','application/json','info','Creating\x20new\x20ticket...','format','%s/tickets.json','remoteUri','merge','Tags','getString','Subjects','Descriptions','Fields','then','Ticket\x20created!','ticket','validateEmail','Getting\x20agent\x20with\x20email','%s/search.json','type:user\x20role:agent\x20email:%s','count'];(function(_0x188f42,_0x176a61){var _0x5642e9=function(_0x3a4a10){while(--_0x3a4a10){_0x188f42['push'](_0x188f42['shift']());}};_0x5642e9(++_0x176a61);}(_0x8c7b,0xc1));var _0xb8c7=function(_0x4a2e31,_0x4e17a2){_0x4a2e31=_0x4a2e31-0x0;var _0x60b71b=_0x8c7b[_0x4a2e31];return _0x60b71b;};'use strict';var _=require(_0xb8c7('0x0'));var rp=require(_0xb8c7('0x1'));var md5=require(_0xb8c7('0x2'));var util=require('util');var Redis=require('ioredis');var intUtil=require(_0xb8c7('0x3'));var config=require(_0xb8c7('0x4'));var logger=require('../../../../config/logger')(_0xb8c7('0x5'));config['redis']=_['defaults'](config[_0xb8c7('0x6')],{'host':_0xb8c7('0x7'),'port':0x18eb});var io=require('socket.io-emitter')(new Redis(config[_0xb8c7('0x6')]));function emit(_0x22436b,_0x12cbb1,_0x35a864){io['to'](_0x22436b)[_0xb8c7('0x8')](_0x12cbb1,_0x35a864);}var headers={'Content-Type':_0xb8c7('0x9'),'Accept':'application/json'};function getTicket(_0x18e0b7,_0x347c93,_0x279682,_0x321c72,_0x1fbd8d){logger[_0xb8c7('0xa')](_0xb8c7('0xb'));return request({'uri':util[_0xb8c7('0xc')](_0xb8c7('0xd'),_0x18e0b7[_0xb8c7('0xe')]),'method':'POST','body':{'ticket':_[_0xb8c7('0xf')]({'requester_id':_0x279682['id'],'submitter_id':_0x347c93?_0x347c93['id']:undefined,'assignee_id':_0x347c93?_0x347c93['id']:undefined,'tags':getTags(_0x321c72[_0xb8c7('0x10')],'name'),'subject':intUtil[_0xb8c7('0x11')](_0x321c72[_0xb8c7('0x12')],_0x1fbd8d,'\x20'),'description':intUtil[_0xb8c7('0x11')](_0x321c72[_0xb8c7('0x13')],_0x1fbd8d,'\x0a'),'comment':{'public':![],'body':intUtil[_0xb8c7('0x11')](_0x321c72[_0xb8c7('0x13')],_0x1fbd8d,'\x0a')}},getCustomFields(_0x321c72[_0xb8c7('0x14')],_0x1fbd8d))}})[_0xb8c7('0x15')](function(_0x5065f5){logger['info'](_0xb8c7('0x16'));return _0x5065f5[_0xb8c7('0x17')];});}function getUser(_0x4ae114,_0x4db15a){if(intUtil[_0xb8c7('0x18')](_0x4db15a)){logger['info'](_0xb8c7('0x19'),_0x4db15a);return request({'uri':util[_0xb8c7('0xc')](_0xb8c7('0x1a'),_0x4ae114[_0xb8c7('0xe')]),'qs':{'query':util['format'](_0xb8c7('0x1b'),_0x4db15a)}})[_0xb8c7('0x15')](function(_0x4db6bb){if(_0x4db6bb[_0xb8c7('0x1c')]){logger['info'](_0xb8c7('0x1d'));return _[_0xb8c7('0x1e')](_0x4db6bb[_0xb8c7('0x1f')],{'email':_0x4db15a,'role':_0xb8c7('0x20')});}else{logger[_0xb8c7('0xa')](_0xb8c7('0x21'));return request({'uri':util[_0xb8c7('0xc')](_0xb8c7('0x22'),_0x4ae114[_0xb8c7('0xe')])})[_0xb8c7('0x15')](function(_0x24ac88){logger[_0xb8c7('0xa')]('Admin\x20account\x20selected.');return _0x24ac88[_0xb8c7('0x23')];});}});}else{logger['info'](_0xb8c7('0x21'));return request({'uri':util[_0xb8c7('0xc')](_0xb8c7('0x22'),_0x4ae114[_0xb8c7('0xe')])})[_0xb8c7('0x15')](function(_0xd8053e){logger['info'](_0xb8c7('0x24'));return _0xd8053e[_0xb8c7('0x23')];});}}function getEndUser(_0x1056f5,_0x30e11c,_0x299cf6){logger[_0xb8c7('0xa')](_0xb8c7('0x25'),_0x299cf6);return request({'uri':util['format'](_0xb8c7('0x1a'),_0x1056f5[_0xb8c7('0xe')]),'qs':{'query':util[_0xb8c7('0xc')](_0xb8c7('0x26'),_0x299cf6)}})[_0xb8c7('0x15')](function(_0x410dab){var _0xb0d8e;if(_0x410dab[_0xb8c7('0x1f')][_0xb8c7('0x27')]){_0x410dab[_0xb8c7('0x1f')]=_[_0xb8c7('0x28')](_0x410dab[_0xb8c7('0x1f')],{'suspended':![],'role':_0xb8c7('0x29')});if(_0x410dab[_0xb8c7('0x1f')][_0xb8c7('0x27')]){_0xb0d8e=_[_0xb8c7('0x2a')](_0x410dab[_0xb8c7('0x1f')]);}}if(_0xb0d8e){logger[_0xb8c7('0xa')]('Enduser\x20found!');return _0xb0d8e;}else{logger[_0xb8c7('0xa')](_0xb8c7('0x2b'));return request({'uri':util[_0xb8c7('0xc')](_0xb8c7('0x2c'),_0x1056f5['remoteUri']),'method':'POST','body':{'user':{'role':_0xb8c7('0x29'),'name':util[_0xb8c7('0xc')](_0xb8c7('0x2d'),_0x30e11c||_0x299cf6),'phone':_0x299cf6}}})[_0xb8c7('0x15')](function(_0x37fcac){logger[_0xb8c7('0xa')]('Enduser\x20created.');return _0x37fcac['user'];});}});}function getAuth(_0x5a03d2){var _0x390f8e;if(_0x5a03d2['authType']===_0xb8c7('0x2e')){_0x390f8e=util[_0xb8c7('0xc')]('%s:%s',_0x5a03d2[_0xb8c7('0x2f')],_0x5a03d2[_0xb8c7('0x2e')]);}else if(_0x5a03d2[_0xb8c7('0x30')]==='token'){_0x390f8e=util['format'](_0xb8c7('0x31'),_0x5a03d2[_0xb8c7('0x2f')],_0x5a03d2[_0xb8c7('0x32')]);}return util[_0xb8c7('0xc')](_0xb8c7('0x33'),new Buffer(_0x390f8e)[_0xb8c7('0x34')](_0xb8c7('0x35')));}function request(_0x212f04){logger['debug'](_0xb8c7('0x36'),JSON[_0xb8c7('0x37')](_0x212f04));return rp(_[_0xb8c7('0x38')](_0x212f04,{'method':'GET','headers':headers,'json':!![]}));}function getTags(_0x24dd4,_0x2506f4){var _0x185648=[];if(_0x24dd4&&_0x24dd4[_0xb8c7('0x27')]>0x0){_0x185648=_[_0xb8c7('0x39')](_0x24dd4,_0x2506f4);}return _0x185648;}function getCustomFields(_0x14ed7d,_0x1bf620){var _0x24afa4=[];var _0x51d0e6={'custom_fields':[]};if(_0x14ed7d['length']>0x0){_[_0xb8c7('0x3a')](_0x14ed7d,function(_0x33c00d){if(_[_0xb8c7('0x3b')]([_0xb8c7('0x3c'),_0xb8c7('0x3d')],_0x33c00d[_0xb8c7('0x3e')])&&_0x33c00d['nameField']&&!_0x33c00d[_0xb8c7('0x3f')]){_0x51d0e6[_0x33c00d[_0xb8c7('0x40')][_0xb8c7('0x41')]()]=_0x33c00d[_0xb8c7('0x42')][_0xb8c7('0x34')]();}else if(_[_0xb8c7('0x3b')]([_0xb8c7('0x3c'),_0xb8c7('0x3d')],_0x33c00d[_0xb8c7('0x3e')])&&_0x33c00d['idField']&&_0x33c00d['customField']){_0x51d0e6[_0xb8c7('0x43')][_0xb8c7('0x44')]({'id':_0x33c00d['idField'],'value':_0x33c00d[_0xb8c7('0x42')][_0xb8c7('0x34')]()});}else if(_0x33c00d['type']===_0xb8c7('0x45')&&_0x33c00d[_0xb8c7('0x46')]&&_0x33c00d[_0xb8c7('0x47')]&&_0x33c00d[_0xb8c7('0x3f')]){_0x1bf620[_0x33c00d[_0xb8c7('0x46')]]&&_0x51d0e6[_0xb8c7('0x43')][_0xb8c7('0x44')]({'id':_0x33c00d['idField'],'value':_0x1bf620[_0x33c00d['variableName']]['toString']()});}else if(_0x33c00d['type']===_0xb8c7('0x48')&&_0x33c00d['Variable']&&_0x33c00d[_0xb8c7('0x49')][_0xb8c7('0x4a')]&&_0x33c00d[_0xb8c7('0x47')]&&_0x33c00d['customField']){_0x1bf620[_0x33c00d[_0xb8c7('0x49')][_0xb8c7('0x4a')][_0xb8c7('0x41')]()]&&_0x51d0e6[_0xb8c7('0x43')][_0xb8c7('0x44')]({'id':_0x33c00d['idField'],'value':_0x1bf620[_0x33c00d[_0xb8c7('0x49')][_0xb8c7('0x4a')][_0xb8c7('0x41')]()]['toString']()});}});}return _0x51d0e6;}exports['queue']=function(_0x3d9aab,_0x5e702e,_0x385561,_0xc1d2ee,_0x5db317,_0x364352){var _0x10eb8e,_0x34e3f3;_0x364352[_0xb8c7('0xe')]=intUtil[_0xb8c7('0x4b')](_0x364352['remoteUri']);_0x364352[_0xb8c7('0x4c')]=intUtil[_0xb8c7('0x4b')](_0x364352[_0xb8c7('0x4c')]);if(_0x5db317&&_0x5db317['monitor_format']){logger[_0xb8c7('0xa')](_0xb8c7('0x4d'),_0xb8c7('0x4e'));_0x5e702e['recordingURL']=util[_0xb8c7('0xc')]('%s/api/voice/recordings/%s/downloads?type=uniqueid&token=%s',_0x364352[_0xb8c7('0x4c')],_0x5e702e[_0xb8c7('0x4f')],md5(_0x5e702e[_0xb8c7('0x4f')]));}else{_0x5e702e[_0xb8c7('0x50')]='';}headers['Authorization']=getAuth(_0x364352);return getUser(_0x364352,_0xc1d2ee[_0xb8c7('0x51')])[_0xb8c7('0x15')](function(_0x2a2bc9){_0x10eb8e=_0x2a2bc9;logger['info'](_0xb8c7('0x52'),_0x10eb8e['id']);return getEndUser(_0x364352,_0x5e702e[_0xb8c7('0x53')],_0x5e702e[_0xb8c7('0x54')]);})['then'](function(_0x41b324){_0x34e3f3=_0x41b324;logger[_0xb8c7('0xa')](_0xb8c7('0x55'),_0x34e3f3['id']);return getTicket(_0x364352,_0x10eb8e,_0x34e3f3,_0x385561,_0x5e702e);})['then'](function(_0x4319ea){if(_0x4319ea){logger[_0xb8c7('0xa')](_0xb8c7('0x56'),_0x4319ea['id']);switch(_0x364352[_0xb8c7('0x3e')]){case _0xb8c7('0x57'):logger[_0xb8c7('0xa')](_0xb8c7('0x4d'),_0xb8c7('0x58'));return request({'uri':util[_0xb8c7('0xc')](_0xb8c7('0x59'),_0x364352[_0xb8c7('0xe')],_0x10eb8e['id'],_0x4319ea['id']),'method':_0xb8c7('0x5a')});case _0xb8c7('0x5b'):logger[_0xb8c7('0xa')]('[QUEUE]',_0xb8c7('0x5c'));emit(util['format'](_0xb8c7('0x5d'),_0xc1d2ee[_0xb8c7('0x4a')]),_0xb8c7('0x5e'),{'uri':util['format']('%s/agent/tickets/%s',_0x364352['remoteUri']['replace'](_0xb8c7('0x5f'),''),_0x4319ea['id'])});break;default:logger[_0xb8c7('0x60')](_0xb8c7('0x4d'),_0xb8c7('0x61'));}}})[_0xb8c7('0x62')](function(_0x4f6b50){logger[_0xb8c7('0x60')]('[QUEUE]\x20Error\x20running\x20Zendesk\x20integration',util[_0xb8c7('0x63')](_0x4f6b50,{'showHidden':!![],'depth':null}));});};exports[_0xb8c7('0x64')]=function(_0x3faec5,_0x35109d,_0x4e8e74,_0x449b3b,_0x2d3707,_0xb7770b,_0x24c8e2){var _0x16e113,_0x3f75e3;_0xb7770b[_0xb8c7('0xe')]=intUtil[_0xb8c7('0x4b')](_0xb7770b[_0xb8c7('0xe')]);_0xb7770b[_0xb8c7('0x4c')]=intUtil[_0xb8c7('0x4b')](_0xb7770b[_0xb8c7('0x4c')]);if(_0x24c8e2&&_0x24c8e2[_0xb8c7('0x65')]&&_0x24c8e2['recordingFormat']!==_0xb8c7('0x66')){logger['info']('[OUTBOUND]',_0xb8c7('0x4e'));_0x35109d[_0xb8c7('0x50')]=util['format'](_0xb8c7('0x67'),_0xb7770b['serverUrl'],_0x35109d[_0xb8c7('0x4f')],md5(_0x35109d[_0xb8c7('0x4f')]));}headers[_0xb8c7('0x68')]=getAuth(_0xb7770b);return getUser(_0xb7770b,_0x449b3b[_0xb8c7('0x51')])[_0xb8c7('0x15')](function(_0x33e79f){_0x16e113=_0x33e79f;logger[_0xb8c7('0xa')](_0xb8c7('0x52'),_0x16e113['id']);return getEndUser(_0xb7770b,_0x35109d['destcalleridname'],_0x35109d[_0xb8c7('0x69')]);})['then'](function(_0x17e2a7){_0x3f75e3=_0x17e2a7;logger['info']('The\x20Enduser\x20ID\x20is:',_0x3f75e3['id']);return getTicket(_0xb7770b,_0x16e113,_0x3f75e3,_0x4e8e74,_0x35109d);})[_0xb8c7('0x15')](function(_0x5daad9){if(_0x5daad9){logger['info']('The\x20Ticket\x20ID\x20is:',_0x5daad9['id']);switch(_0xb7770b[_0xb8c7('0x3e')]){case _0xb8c7('0x57'):logger[_0xb8c7('0xa')]('[OUTBOUND]',_0xb8c7('0x58'));return request({'uri':util[_0xb8c7('0xc')]('%s/channels/voice/agents/%d/tickets/%d/display.json',_0xb7770b['remoteUri'],_0x16e113['id'],_0x5daad9['id']),'method':_0xb8c7('0x5a')});case _0xb8c7('0x5b'):logger['info'](_0xb8c7('0x6a'),_0xb8c7('0x5c'));emit(util[_0xb8c7('0xc')](_0xb8c7('0x5d'),_0x449b3b[_0xb8c7('0x4a')]),_0xb8c7('0x5e'),{'uri':util[_0xb8c7('0xc')]('%s/agent/tickets/%s',_0xb7770b[_0xb8c7('0xe')]['replace'](_0xb8c7('0x5f'),''),_0x5daad9['id'])});break;default:logger[_0xb8c7('0x60')](_0xb8c7('0x6a'),_0xb8c7('0x61'));}}})[_0xb8c7('0x62')](function(_0x3b64a4){logger['error']('[OUTBOUND]\x20Error\x20running\x20Zendesk\x20integration',util[_0xb8c7('0x63')](_0x3b64a4,{'showHidden':!![],'depth':null}));});};exports[_0xb8c7('0x6b')]=function(_0x118d16,_0x452cdc,_0xa3cfad,_0x3bb539,_0x35ef41,_0x3453f0){var _0x5b0e16,_0x1d44ba;_0x3453f0[_0xb8c7('0xe')]=intUtil[_0xb8c7('0x4b')](_0x3453f0[_0xb8c7('0xe')]);_0x3453f0[_0xb8c7('0x4c')]=intUtil[_0xb8c7('0x4b')](_0x3453f0[_0xb8c7('0x4c')]);if(_0x35ef41&&_0x35ef41[_0xb8c7('0x6c')]){logger[_0xb8c7('0xa')]('['+_0x452cdc[_0xb8c7('0x6d')][_0xb8c7('0x6e')]()+']',_0xb8c7('0x4e'));_0x452cdc[_0xb8c7('0x50')]=util[_0xb8c7('0xc')](_0xb8c7('0x67'),_0x3453f0[_0xb8c7('0x4c')],_0x452cdc[_0xb8c7('0x4f')],md5(_0x452cdc[_0xb8c7('0x4f')]));}else{_0x452cdc['recordingURL']='';}headers[_0xb8c7('0x68')]=getAuth(_0x3453f0);return getUser(_0x3453f0)[_0xb8c7('0x15')](function(_0x1bb21f){_0x5b0e16=_0x1bb21f;logger[_0xb8c7('0xa')](_0xb8c7('0x52'),_0x5b0e16['id']);return getEndUser(_0x3453f0,_0x452cdc['calleridname'],_0x452cdc[_0xb8c7('0x54')]);})[_0xb8c7('0x15')](function(_0x68eefa){_0x1d44ba=_0x68eefa;logger[_0xb8c7('0xa')](_0xb8c7('0x55'),_0x1d44ba['id']);return getTicket(_0x3453f0,_0x5b0e16,_0x1d44ba,_0xa3cfad,_0x452cdc);})['then'](function(_0x47b98f){if(_0x47b98f){logger[_0xb8c7('0xa')]('The\x20Ticket\x20ID\x20is:',_0x47b98f['id']);}})[_0xb8c7('0x62')](function(_0x4b8f37){logger[_0xb8c7('0x60')]('['+_0x452cdc[_0xb8c7('0x6d')][_0xb8c7('0x6e')]()+']'+'\x20Error\x20running\x20Zendesk\x20integration',util[_0xb8c7('0x63')](_0x4b8f37,{'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 c57fee1..15be25b 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 _0xe586=['timeout','Timeout','Call_Start_Time','outbound','agentcalledAt','Call_Type','Inbound','merge','Fields','/crm/v2/Calls','Call\x20created!','err','queue','host','stripTrailingSlash','serverUrl','monitor_format','Recording\x20is\x20enabled!','recordingURL','/api/voice/recordings/','uniqueid','zoho.eu','com','calleridname','The\x20Call\x20ID\x20is:','[QUEUE]','user:%s','trigger:browser:url','https://crm.','/crm/EntityInfo.do?module=Calls&id=','recordingFormat','none','/downloads?type=uniqueid&token=','The\x20User\x20ID\x20is:','destcalleridname','destcalleridnum','Outbound','[OUTBOUND]','Displaying\x20call\x20to\x20agent\x20in\x20a\x20new\x20tab...','unmanaged','lastevent','toUpperCase','lodash','request-promise','md5','./util','moment','bluebird','../../../../config/environment','../../../../config/logger','zoho','redis','defaults','localhost','socket.io-emitter','emit','debug','[HTTP]','stringify','length','forEach','includes','string','picklist','idField','type','variable','variableName','Variable','name','toLowerCase','toString','indexOf','isNil','access_token','expires_in','zone','https://accounts.zoho.com','https://accounts.zoho.com.au','https://accounts.zoho.in','https://accounts.zoho.com.cn','https://accounts.zoho.eu','POST','/oauth/v2/token','refreshToken','then','seconds','Failing\x20creating\x20the\x20access_token','stack','info','Search\x20user','GET','format','https://www.zohoapis.%s/crm/v2/users','ActiveUsers','Zoho-oauthtoken\x20','users','findIndex','email','Using\x20the\x20admin\x20account!','profile','Administrator','user','error','Unable\x20to\x20retrieve\x20zoho\x20account\x20users:\x20','The\x20failing\x20result\x20is','data','enduserType','catch','https://www.zohoapis.','/crm/v2/','startCase','moduleCreate','role','first_name','last_name','code','SUCCESS','Error:\x20','log','moduleSearch','contact_lead','/crm/v2/Contacts/search?criteria=((Phone:equals:','uri','nothing','Contacts','/crm/v2/Leads/search?criteria=((Phone:equals:','Creating\x20new\x20call...','Owner','administrator','Subject','getString','Subjects','Who_Id','Full_Name','First_Name','Last_Name','Leads','What_Id','$se_module','Call_Duration','mm:ss','answertime','endtime','utc','YYYY-MM-DDTHH:mm:ss','diff','starttime','called','Call_Result','Called','complete','connect','Answered','rejected','Rejected','abandoned','Abandoned'];(function(_0x2682d1,_0x303ab3){var _0x13c0c2=function(_0x533814){while(--_0x533814){_0x2682d1['push'](_0x2682d1['shift']());}};_0x13c0c2(++_0x303ab3);}(_0xe586,0xc8));var _0x6e58=function(_0xc6d3e3,_0x34aac4){_0xc6d3e3=_0xc6d3e3-0x0;var _0x32c861=_0xe586[_0xc6d3e3];return _0x32c861;};'use strict';var _=require(_0x6e58('0x0'));var rp=require(_0x6e58('0x1'));var md5=require(_0x6e58('0x2'));var util=require('util');var intUtil=require(_0x6e58('0x3'));var moment=require(_0x6e58('0x4'));var Redis=require('ioredis');var BPromise=require(_0x6e58('0x5'));var config=require(_0x6e58('0x6'));var logger=require(_0x6e58('0x7'))(_0x6e58('0x8'));config[_0x6e58('0x9')]=_[_0x6e58('0xa')](config[_0x6e58('0x9')],{'host':_0x6e58('0xb'),'port':0x18eb});var io=require(_0x6e58('0xc'))(new Redis(config[_0x6e58('0x9')]));function emit(_0x631dad,_0x276317,_0x4bbff4){io['to'](_0x631dad)[_0x6e58('0xd')](_0x276317,_0x4bbff4);}function request(_0x2f6c58){logger[_0x6e58('0xe')](_0x6e58('0xf'),JSON[_0x6e58('0x10')](_0x2f6c58));return rp(_0x2f6c58);}function getCustomFields(_0x455f1f,_0x4c72a6){var _0x1261f2={};if(_0x455f1f[_0x6e58('0x11')]>0x0){_[_0x6e58('0x12')](_0x455f1f,function(_0x344b9c){if(_[_0x6e58('0x13')]([_0x6e58('0x14'),_0x6e58('0x15')],_0x344b9c['type'])&&_0x344b9c[_0x6e58('0x16')]){_0x1261f2[_0x344b9c[_0x6e58('0x16')]]=_0x344b9c['content']['toString']();}else if(_0x344b9c[_0x6e58('0x17')]===_0x6e58('0x18')&&_0x344b9c['variableName']&&_0x344b9c[_0x6e58('0x16')]&&_0x4c72a6[_0x344b9c['variableName']]){_0x1261f2[_0x344b9c['idField']]=_0x4c72a6[_0x344b9c[_0x6e58('0x19')]]['toString']();}else if(_0x344b9c['type']==='customVariable'&&_0x344b9c['Variable']&&_0x344b9c[_0x6e58('0x1a')]['name']&&_0x344b9c['idField']&&_0x4c72a6[_0x344b9c[_0x6e58('0x1a')][_0x6e58('0x1b')][_0x6e58('0x1c')]()]){_0x1261f2[_0x344b9c[_0x6e58('0x16')]]=_0x4c72a6[_0x344b9c[_0x6e58('0x1a')][_0x6e58('0x1b')][_0x6e58('0x1c')]()][_0x6e58('0x1d')]();}});}return _0x1261f2;}function getName(_0xb336ad){if(_0xb336ad[_0x6e58('0x1e')]('\x20')>0x0){var _0x20ed4d=_0xb336ad['split'](/ (.+)/);if(_0x20ed4d[0x1]){return _0x20ed4d;}}return[_0xb336ad,_0xb336ad];}var accountsTokens={};function getAccessToken(_0x593328){return new Promise(function(_0x4558a6,_0x17e5bd){if(!_[_0x6e58('0x1f')](accountsTokens[_0x593328['id']])&&!_[_0x6e58('0x1f')](accountsTokens[_0x593328['id']][_0x6e58('0x20')])){if(moment()['isBefore'](accountsTokens[_0x593328['id']][_0x6e58('0x21')])){_0x4558a6(accountsTokens[_0x593328['id']][_0x6e58('0x20')]);}}var _0x78ab9f;switch(_0x593328[_0x6e58('0x22')]){case'US':_0x78ab9f=_0x6e58('0x23');break;case'AU':_0x78ab9f=_0x6e58('0x24');break;case'EU':_0x78ab9f='https://accounts.zoho.eu';break;case'IN':_0x78ab9f=_0x6e58('0x25');break;case'CN':_0x78ab9f=_0x6e58('0x26');break;default:_0x78ab9f=_0x6e58('0x27');break;}var _0x382032={'method':_0x6e58('0x28'),'uri':_0x78ab9f+_0x6e58('0x29'),'qs':{'refresh_token':_0x593328[_0x6e58('0x2a')],'client_id':_0x593328['clientId'],'client_secret':_0x593328['clientSecret'],'grant_type':'refresh_token'},'json':!![]};return rp(_0x382032)[_0x6e58('0x2b')](function(_0x2f4bf7){accountsTokens[_0x593328['id']]={'access_token':_0x2f4bf7[_0x6e58('0x20')],'expires_in':moment()['add'](_0x2f4bf7[_0x6e58('0x21')],_0x6e58('0x2c'))};_0x4558a6(_0x2f4bf7[_0x6e58('0x20')]);})['catch'](function(_0x2d42fc){logger['error'](_0x6e58('0x2d'),_0x2d42fc[_0x6e58('0x2e')]);_0x17e5bd(_0x2d42fc);});});}function getUser(_0x377524,_0x3d9c11,_0x55adf,_0x36a1c9){logger[_0x6e58('0x2f')](_0x6e58('0x30'));return request({'method':_0x6e58('0x31'),'uri':util[_0x6e58('0x32')](_0x6e58('0x33'),_0x3d9c11),'qs':{'type':_0x6e58('0x34')},'headers':{'Authorization':_0x6e58('0x35')+_0x377524},'json':!![]})[_0x6e58('0x2b')](function(_0x232d54){if(_0x232d54['users']){var _0x23048b=-0x1;if(_['isArrayLikeObject'](_0x232d54[_0x6e58('0x36')])){if(!_[_0x6e58('0x1f')](_0x36a1c9)){_0x23048b=_[_0x6e58('0x37')](_0x232d54[_0x6e58('0x36')],function(_0x222dd2){return _0x222dd2[_0x6e58('0x38')]===_0x36a1c9;});}if(_0x23048b>=0x0){logger['info']('Agent\x20found!');}else{logger[_0x6e58('0x2f')](_0x6e58('0x39'));_0x23048b=_['findIndex'](_0x232d54[_0x6e58('0x36')],function(_0x3a44b4){return _0x3a44b4[_0x6e58('0x3a')][_0x6e58('0x1b')]===_0x6e58('0x3b');});}return _0x232d54[_0x6e58('0x36')][_0x23048b];}else{if(_0x232d54[_0x6e58('0x3c')]['profile'][_0x6e58('0x1b')]==='Administrator'){logger[_0x6e58('0x2f')](_0x6e58('0x39'));user=_0x232d54[_0x6e58('0x3c')];return user;}else{logger[_0x6e58('0x3d')]('The\x20failing\x20result\x20is',JSON[_0x6e58('0x10')](_0x232d54));throw new Error(_0x6e58('0x3e')+JSON[_0x6e58('0x10')](_0x232d54));}}}else{logger[_0x6e58('0x3d')](_0x6e58('0x3f'),JSON[_0x6e58('0x10')](_0x232d54));throw new Error(_0x6e58('0x3e')+JSON[_0x6e58('0x10')](_0x232d54));}})['catch'](function(_0x3cddaf){console['error'](_0x3cddaf);});}function getZohoUser(_0x6661,_0x2c6ece){return new BPromise(function(_0x34928e,_0x70ddea){request(_0x6661)[_0x6e58('0x2b')](function(_0xfcea93){var _0x3fdc4b=null;if(_0xfcea93){_0x3fdc4b=_0xfcea93[_0x6e58('0x40')][0x0];_0x3fdc4b[_0x6e58('0x41')]=_0x2c6ece;}_0x34928e(_0x3fdc4b);})[_0x6e58('0x42')](function(_0xfcecab){_0x70ddea(_0xfcecab);});});}function createEndUser(_0x3b00f7,_0x38e3ff,_0x16eab2,_0x46bfb4,_0x4fc07f,_0x1f23b2){var _0x16eab2=getName(_0x16eab2);return request({'method':'POST','uri':_0x6e58('0x43')+_0x38e3ff+_0x6e58('0x44')+_[_0x6e58('0x45')](_0x1f23b2[_0x6e58('0x46')])+'s','body':{'data':[{'Last_Name':_0x16eab2[0x1],'First_Name':_0x16eab2[0x0],'Phone':_0x46bfb4,'Owner':{'name':!_[_0x6e58('0x1f')](_0x4fc07f[_0x6e58('0x47')]['name'])?_0x4fc07f[_0x6e58('0x47')][_0x6e58('0x1b')]:!_['isNil'](_0x4fc07f[_0x6e58('0x48')])?_0x4fc07f[_0x6e58('0x48')]+'\x20'+_0x4fc07f[_0x6e58('0x49')]:_0x4fc07f[_0x6e58('0x49')],'id':_0x4fc07f['id']}}]},'headers':{'Authorization':_0x6e58('0x35')+_0x3b00f7},'json':!![]})[_0x6e58('0x2b')](function(_0x3ef1e2){if(_0x3ef1e2&&_0x3ef1e2[_0x6e58('0x40')][0x0][_0x6e58('0x4a')]===_0x6e58('0x4b')){var _0x58d92f=_0x3ef1e2[_0x6e58('0x40')][0x0]['details'];_0x58d92f[_0x6e58('0x41')]=_[_0x6e58('0x45')](_0x1f23b2[_0x6e58('0x46')])+'s';return _0x58d92f;}logger['error'](_0x6e58('0x3f'),JSON[_0x6e58('0x10')](data));throw new Error(_0x6e58('0x4c')+JSON[_0x6e58('0x10')](data));})['catch'](function(_0xed7a74){console[_0x6e58('0x4d')]('CREATE\x20ERROR',_0xed7a74);});}function getEndUser(_0x329218,_0x43f693,_0x171c12,_0xc81155,_0xcb34e7,_0x44b91d,_0x132d7e){var _0x4bbfd2={'method':_0x6e58('0x31'),'uri':'','headers':{'Authorization':'Zoho-oauthtoken\x20'+_0x329218},'json':!![]};switch(_0x132d7e[_0x6e58('0x4e')]){case _0x6e58('0x4f'):_0x4bbfd2['uri']=_0x6e58('0x43')+_0x43f693+_0x6e58('0x50')+_0xcb34e7+'))';return getZohoUser(_0x4bbfd2,'Contacts')[_0x6e58('0x2b')](function(_0x498ae1){if(_0x498ae1)return _0x498ae1;_0x4bbfd2[_0x6e58('0x51')]=_0x6e58('0x43')+_0x43f693+'/crm/v2/Leads/search?criteria=((Phone:equals:'+_0xcb34e7+'))';return getZohoUser(_0x4bbfd2,'Leads')['then'](function(_0x2c7d75){if(_0x2c7d75)return _0x2c7d75;if(_0x132d7e[_0x6e58('0x46')]!=_0x6e58('0x52')){return createEndUser(_0x329218,_0x43f693,_0xc81155,_0xcb34e7,_0x44b91d,_0x132d7e);}else{return{};}});});break;case'contact':_0x4bbfd2['uri']='https://www.zohoapis.'+_0x43f693+_0x6e58('0x50')+_0xcb34e7+'))';return getZohoUser(_0x4bbfd2,_0x6e58('0x53'))[_0x6e58('0x2b')](function(_0x33c81b){if(_0x33c81b)return _0x33c81b;if(_0x132d7e['moduleCreate']!='nothing'){return createEndUser(_0x329218,_0x43f693,_0xc81155,_0xcb34e7,_0x44b91d,_0x132d7e);}else{return{};}});break;case'lead':_0x4bbfd2[_0x6e58('0x51')]=_0x6e58('0x43')+_0x43f693+_0x6e58('0x54')+_0xcb34e7+'))';return getZohoUser(_0x4bbfd2,'Leads')[_0x6e58('0x2b')](function(_0x5adfbb){if(_0x5adfbb)return _0x5adfbb;if(_0x132d7e['moduleCreate']!=_0x6e58('0x52')){return createEndUser(_0x329218,_0x43f693,_0xc81155,_0xcb34e7,_0x44b91d,_0x132d7e);}else{return{};}});break;}}function getCall(_0x36c2fa,_0x487b2e,_0x3d4e06,_0x1fc5f9,_0x3ce85e,_0xf53ba6,_0x623272,_0x310392){logger[_0x6e58('0x2f')](_0x6e58('0x55'));var _0xcb6fca={};_0xcb6fca[_0x6e58('0x56')]={'name':!_[_0x6e58('0x1f')](_0x1fc5f9[_0x6e58('0x47')]['name'])&&!_[_0x6e58('0x1f')](_0x1fc5f9[_0x6e58('0x3a')][_0x6e58('0x1b')])&&_0x1fc5f9['profile'][_0x6e58('0x1b')]===_0x6e58('0x57')?_0x1fc5f9[_0x6e58('0x47')][_0x6e58('0x1b')]:!_['isNil'](_0x1fc5f9['first_name'])?_0x1fc5f9[_0x6e58('0x48')]+'\x20'+_0x1fc5f9[_0x6e58('0x49')]:_0x1fc5f9[_0x6e58('0x49')],'id':_0x1fc5f9['id']};_0xcb6fca[_0x6e58('0x58')]=intUtil[_0x6e58('0x59')](_0xf53ba6[_0x6e58('0x5a')],_0x623272,'\x20');_0xcb6fca['Description']=intUtil[_0x6e58('0x59')](_0xf53ba6['Descriptions'],_0x623272,'\x0a');if(_0x3ce85e[_0x6e58('0x41')]==='Contacts'){_0xcb6fca[_0x6e58('0x5b')]={'name':!_[_0x6e58('0x1f')](_0x3ce85e[_0x6e58('0x5c')])?_0x3ce85e[_0x6e58('0x5c')]:!_[_0x6e58('0x1f')](_0x3ce85e[_0x6e58('0x5d')])?_0x3ce85e[_0x6e58('0x5d')]+'\x20'+_0x3ce85e[_0x6e58('0x5e')]:_0x3ce85e[_0x6e58('0x5e')],'id':_0x3ce85e['id']};}if(_0x3ce85e[_0x6e58('0x41')]===_0x6e58('0x5f')){_0xcb6fca[_0x6e58('0x60')]={'name':!_[_0x6e58('0x1f')](_0x3ce85e[_0x6e58('0x5c')])?_0x3ce85e[_0x6e58('0x5c')]:!_[_0x6e58('0x1f')](_0x3ce85e[_0x6e58('0x5d')])?_0x3ce85e[_0x6e58('0x5d')]+'\x20'+_0x3ce85e[_0x6e58('0x5e')]:_0x3ce85e[_0x6e58('0x5e')],'id':_0x3ce85e['id']};_0xcb6fca[_0x6e58('0x61')]=_[_0x6e58('0x45')](_0x3ce85e['enduserType']);}if(_0x623272['talktime']){_0xcb6fca[_0x6e58('0x62')]=moment['utc'](parseInt(_0x623272['talktime'])*0x3e8)[_0x6e58('0x32')](_0x6e58('0x63'));}else if(_0x623272[_0x6e58('0x64')]&&_0x623272[_0x6e58('0x65')]){_0xcb6fca['Call_Duration']=moment[_0x6e58('0x66')](moment(_0x623272[_0x6e58('0x65')],_0x6e58('0x67'))[_0x6e58('0x68')](moment(_0x623272[_0x6e58('0x69')],_0x6e58('0x67'))))[_0x6e58('0x32')](_0x6e58('0x63'));}switch(_0x623272['lastevent']){case _0x6e58('0x6a'):_0xcb6fca[_0x6e58('0x6b')]=_0x6e58('0x6c');break;case _0x6e58('0x6d'):case _0x6e58('0x6e'):_0xcb6fca[_0x6e58('0x6b')]=_0x6e58('0x6f');break;case _0x6e58('0x70'):_0xcb6fca[_0x6e58('0x6b')]=_0x6e58('0x71');break;case _0x6e58('0x72'):_0xcb6fca[_0x6e58('0x6b')]=_0x6e58('0x73');break;case _0x6e58('0x74'):_0xcb6fca[_0x6e58('0x6b')]=_0x6e58('0x75');default:}_0xcb6fca[_0x6e58('0x76')]=(_0x310392===_0x6e58('0x77')?moment(_0x623272['starttime'])[_0x6e58('0x32')]('YYYY-MM-DDTHH:mm:ss'):moment(_0x623272[_0x6e58('0x78')])[_0x6e58('0x32')](_0x6e58('0x67')))||moment()[_0x6e58('0x32')](_0x6e58('0x67'));_0xcb6fca[_0x6e58('0x79')]=_0x310392||_0x6e58('0x7a');_0xcb6fca=_[_0x6e58('0x7b')](_0xcb6fca,getCustomFields(_0xf53ba6[_0x6e58('0x7c')],_0x623272));return request({'method':_0x6e58('0x28'),'uri':_0x6e58('0x43')+_0x487b2e+_0x6e58('0x7d'),'headers':{'Authorization':_0x6e58('0x35')+_0x36c2fa},'body':{'data':[_0xcb6fca]},'json':!![]})['then'](function(_0xc95212){if(_0xc95212&&_0xc95212[_0x6e58('0x40')][0x0][_0x6e58('0x4a')]===_0x6e58('0x4b')){logger[_0x6e58('0x2f')](_0x6e58('0x7e'));return{'id':_0xc95212[_0x6e58('0x40')][0x0]['details']['id']};}})[_0x6e58('0x42')](function(_0x2b3f5e){logger[_0x6e58('0x2f')](_0x6e58('0x7f'),_0x2b3f5e['stack']);console[_0x6e58('0x4d')](_0x6e58('0x7f'),_0x2b3f5e);});}exports[_0x6e58('0x80')]=function(_0x4fbef3,_0x17ac74,_0x30750d,_0x3d3a77,_0x11162d,_0x114e82){var _0x1b4322,_0x1921be,_0x1334e0;_0x114e82[_0x6e58('0x81')]=intUtil[_0x6e58('0x82')](_0x114e82['host']);_0x114e82[_0x6e58('0x83')]=intUtil[_0x6e58('0x82')](_0x114e82[_0x6e58('0x83')]);if(_0x11162d&&_0x11162d[_0x6e58('0x84')]){logger[_0x6e58('0x2f')]('[QUEUE]',_0x6e58('0x85'));_0x17ac74[_0x6e58('0x86')]=_0x114e82[_0x6e58('0x83')]+_0x6e58('0x87')+_0x17ac74[_0x6e58('0x88')]+'/downloads?type=uniqueid&token='+md5(_0x17ac74['uniqueid']);}else{_0x17ac74['recordingURL']='';}var _0x461b53=_0x114e82[_0x6e58('0x81')]===_0x6e58('0x89')?'eu':_0x6e58('0x8a');return getAccessToken(_0x114e82)[_0x6e58('0x2b')](function(_0x3f02cc){_0x1334e0=_0x3f02cc;return getUser(_0x1334e0,_0x461b53,_0x114e82,_0x3d3a77[_0x6e58('0x38')]);})[_0x6e58('0x2b')](function(_0x5470ee){_0x1b4322=_0x5470ee;logger['info']('The\x20User\x20ID\x20is:',_0x1b4322['id']);return getEndUser(_0x1334e0,_0x461b53,_0x114e82,_0x17ac74[_0x6e58('0x8b')],_0x17ac74['calleridnum'],_0x1b4322,_0x30750d);})[_0x6e58('0x2b')](function(_0x255065){_0x1921be=_0x255065;return getCall(_0x1334e0,_0x461b53,_0x114e82,_0x1b4322,_0x1921be,_0x30750d,_0x17ac74,_0x6e58('0x7a'));})[_0x6e58('0x2b')](function(_0x5d861e){if(_0x5d861e){logger['info'](_0x6e58('0x8c'),_0x5d861e['id']);logger['info'](_0x6e58('0x8d'),'Displaying\x20call\x20to\x20agent\x20in\x20a\x20new\x20tab...');emit(util['format'](_0x6e58('0x8e'),_0x3d3a77['name']),_0x6e58('0x8f'),{'uri':_0x6e58('0x90')+_0x114e82[_0x6e58('0x81')]+_0x6e58('0x91')+_0x5d861e['id']});}})[_0x6e58('0x42')](function(_0x364bb0){logger[_0x6e58('0x3d')]('[QUEUE]',JSON['stringify'](_0x364bb0));});};exports[_0x6e58('0x77')]=function(_0x3de280,_0xabd107,_0x421707,_0x219f98,_0x1ea873,_0x4f6248,_0x13b8c8){var _0x595845,_0x9c5bc,_0x292e88;_0x4f6248['host']=intUtil[_0x6e58('0x82')](_0x4f6248[_0x6e58('0x81')]);_0x4f6248[_0x6e58('0x83')]=intUtil[_0x6e58('0x82')](_0x4f6248[_0x6e58('0x83')]);if(_0x13b8c8&&_0x13b8c8['recordingFormat']&&_0x13b8c8[_0x6e58('0x92')]!==_0x6e58('0x93')){logger[_0x6e58('0x2f')]('[OUTBOUND]',_0x6e58('0x85'));_0xabd107[_0x6e58('0x86')]=_0x4f6248[_0x6e58('0x83')]+_0x6e58('0x87')+_0xabd107[_0x6e58('0x88')]+_0x6e58('0x94')+md5(_0xabd107[_0x6e58('0x88')]);}var _0x11e62d=_0x4f6248[_0x6e58('0x81')]===_0x6e58('0x89')?'eu':_0x6e58('0x8a');return getAccessToken(_0x4f6248)[_0x6e58('0x2b')](function(_0x4657f1){_0x292e88=_0x4657f1;return getUser(_0x292e88,_0x11e62d,_0x4f6248,_0x219f98[_0x6e58('0x38')]);})[_0x6e58('0x2b')](function(_0xd3a93e){_0x595845=_0xd3a93e;logger[_0x6e58('0x2f')](_0x6e58('0x95'),_0x595845['id']);return getEndUser(_0x292e88,_0x11e62d,_0x4f6248,_0xabd107[_0x6e58('0x96')],_0xabd107[_0x6e58('0x97')],_0x595845,_0x421707);})[_0x6e58('0x2b')](function(_0x47dbdd){_0x9c5bc=_0x47dbdd;return getCall(_0x292e88,_0x11e62d,_0x4f6248,_0x595845,_0x9c5bc,_0x421707,_0xabd107,_0x6e58('0x98'));})[_0x6e58('0x2b')](function(_0x313184){if(_0x313184){logger[_0x6e58('0x2f')](_0x6e58('0x8c'),_0x313184['id']);logger[_0x6e58('0x2f')](_0x6e58('0x99'),_0x6e58('0x9a'));emit(util[_0x6e58('0x32')](_0x6e58('0x8e'),_0x219f98[_0x6e58('0x1b')]),_0x6e58('0x8f'),{'uri':_0x6e58('0x90')+_0x4f6248['host']+_0x6e58('0x91')+_0x313184['id']});}})[_0x6e58('0x42')](function(_0x9e4b99){logger[_0x6e58('0x3d')](_0x6e58('0x99'),JSON[_0x6e58('0x10')](_0x9e4b99));});};exports[_0x6e58('0x9b')]=function(_0x38db2e,_0x47f0bd,_0x3dcaf8,_0x2d0055,_0x4ed3f4,_0x3a784b){var _0x48121d,_0x504da2,_0x5da247;_0x3a784b['host']=intUtil['stripTrailingSlash'](_0x3a784b[_0x6e58('0x81')]);_0x3a784b[_0x6e58('0x83')]=intUtil[_0x6e58('0x82')](_0x3a784b[_0x6e58('0x83')]);if(_0x4ed3f4&&_0x4ed3f4[_0x6e58('0x84')]){logger[_0x6e58('0x2f')]('['+_0x47f0bd[_0x6e58('0x9c')][_0x6e58('0x9d')]()+']',_0x6e58('0x85'));_0x47f0bd[_0x6e58('0x86')]=_0x3a784b[_0x6e58('0x83')]+_0x6e58('0x87')+_0x47f0bd[_0x6e58('0x88')]+_0x6e58('0x94')+md5(_0x47f0bd[_0x6e58('0x88')]);}else{_0x47f0bd[_0x6e58('0x86')]='';}var _0x3a6910=_0x3a784b[_0x6e58('0x81')]===_0x6e58('0x89')?'eu':_0x6e58('0x8a');return getAccessToken(_0x3a784b)[_0x6e58('0x2b')](function(_0x5b8ab9){_0x5da247=_0x5b8ab9;return getUser(_0x5da247,_0x3a6910,_0x3a784b);})[_0x6e58('0x2b')](function(_0x49ab28){_0x48121d=_0x49ab28;logger[_0x6e58('0x2f')](_0x6e58('0x95'),_0x48121d['id']);return getEndUser(_0x5da247,_0x3a6910,_0x3a784b,_0x47f0bd[_0x6e58('0x8b')],_0x47f0bd['calleridnum'],_0x48121d,_0x3dcaf8);})[_0x6e58('0x2b')](function(_0x19b5c1){_0x504da2=_0x19b5c1;return getCall(_0x5da247,_0x3a6910,_0x3a784b,_0x48121d,_0x504da2,_0x3dcaf8,_0x47f0bd,'Inbound');})[_0x6e58('0x2b')](function(_0x29e2e7){if(_0x29e2e7){logger[_0x6e58('0x2f')](_0x6e58('0x8c'),_0x29e2e7['id']);}})[_0x6e58('0x42')](function(_0x341dfa){logger[_0x6e58('0x3d')]('['+_0x47f0bd[_0x6e58('0x9c')][_0x6e58('0x9d')]()+']',JSON[_0x6e58('0x10')](_0x341dfa));});}; \ No newline at end of file +var _0x34bb=['../../../../config/logger','zoho','redis','defaults','socket.io-emitter','emit','debug','[HTTP]','stringify','length','forEach','includes','string','picklist','type','idField','content','toString','variable','variableName','customVariable','name','toLowerCase','indexOf','split','isNil','access_token','isBefore','expires_in','zone','https://accounts.zoho.com.au','https://accounts.zoho.eu','https://accounts.zoho.in','POST','/oauth/v2/token','clientId','clientSecret','then','add','catch','Failing\x20creating\x20the\x20access_token','Search\x20user','GET','format','ActiveUsers','users','isArrayLikeObject','findIndex','email','Agent\x20found!','profile','Administrator','user','error','Unable\x20to\x20retrieve\x20zoho\x20account\x20users:\x20','data','enduserType','https://www.zohoapis.','startCase','moduleCreate','role','first_name','last_name','code','SUCCESS','details','The\x20failing\x20result\x20is','Error:\x20','log','CREATE\x20ERROR','Zoho-oauthtoken\x20','moduleSearch','uri','/crm/v2/Contacts/search?criteria=((Phone:equals:','/crm/v2/Leads/search?criteria=((Phone:equals:','nothing','Contacts','lead','Creating\x20new\x20call...','Owner','Subject','getString','Description','Descriptions','Who_Id','Full_Name','First_Name','Last_Name','Leads','$se_module','talktime','Call_Duration','utc','mm:ss','answertime','endtime','YYYY-MM-DDTHH:mm:ss','diff','lastevent','Call_Result','Called','connect','Answered','abandoned','Abandoned','timeout','Timeout','Call_Start_Time','outbound','starttime','agentcalledAt','Call_Type','Inbound','merge','/crm/v2/Calls','Call\x20created!','info','err','stack','queue','host','stripTrailingSlash','serverUrl','monitor_format','[QUEUE]','Recording\x20is\x20enabled!','recordingURL','/api/voice/recordings/','/downloads?type=uniqueid&token=','uniqueid','The\x20User\x20ID\x20is:','calleridname','calleridnum','Displaying\x20call\x20to\x20agent\x20in\x20a\x20new\x20tab...','trigger:browser:url','/crm/EntityInfo.do?module=Calls&id=','recordingFormat','none','[OUTBOUND]','zoho.eu','destcalleridnum','user:%s','https://crm.','toUpperCase','The\x20Call\x20ID\x20is:','lodash','request-promise','md5','util','./util','moment','ioredis'];(function(_0x51c4b9,_0x27e0ea){var _0x22fe3b=function(_0x298dd2){while(--_0x298dd2){_0x51c4b9['push'](_0x51c4b9['shift']());}};_0x22fe3b(++_0x27e0ea);}(_0x34bb,0x129));var _0xb34b=function(_0x4edd75,_0x113a0a){_0x4edd75=_0x4edd75-0x0;var _0x55dcc3=_0x34bb[_0x4edd75];return _0x55dcc3;};'use strict';var _=require(_0xb34b('0x0'));var rp=require(_0xb34b('0x1'));var md5=require(_0xb34b('0x2'));var util=require(_0xb34b('0x3'));var intUtil=require(_0xb34b('0x4'));var moment=require(_0xb34b('0x5'));var Redis=require(_0xb34b('0x6'));var BPromise=require('bluebird');var config=require('../../../../config/environment');var logger=require(_0xb34b('0x7'))(_0xb34b('0x8'));config[_0xb34b('0x9')]=_[_0xb34b('0xa')](config['redis'],{'host':'localhost','port':0x18eb});var io=require(_0xb34b('0xb'))(new Redis(config[_0xb34b('0x9')]));function emit(_0x55cad2,_0x2c5646,_0x194a89){io['to'](_0x55cad2)[_0xb34b('0xc')](_0x2c5646,_0x194a89);}function request(_0x2e4f25){logger[_0xb34b('0xd')](_0xb34b('0xe'),JSON[_0xb34b('0xf')](_0x2e4f25));return rp(_0x2e4f25);}function getCustomFields(_0x198277,_0x247c31){var _0x320a03={};if(_0x198277[_0xb34b('0x10')]>0x0){_[_0xb34b('0x11')](_0x198277,function(_0x548c4a){if(_[_0xb34b('0x12')]([_0xb34b('0x13'),_0xb34b('0x14')],_0x548c4a[_0xb34b('0x15')])&&_0x548c4a['idField']){_0x320a03[_0x548c4a[_0xb34b('0x16')]]=_0x548c4a[_0xb34b('0x17')][_0xb34b('0x18')]();}else if(_0x548c4a['type']===_0xb34b('0x19')&&_0x548c4a[_0xb34b('0x1a')]&&_0x548c4a[_0xb34b('0x16')]&&_0x247c31[_0x548c4a['variableName']]){_0x320a03[_0x548c4a[_0xb34b('0x16')]]=_0x247c31[_0x548c4a[_0xb34b('0x1a')]][_0xb34b('0x18')]();}else if(_0x548c4a[_0xb34b('0x15')]===_0xb34b('0x1b')&&_0x548c4a['Variable']&&_0x548c4a['Variable']['name']&&_0x548c4a[_0xb34b('0x16')]&&_0x247c31[_0x548c4a['Variable'][_0xb34b('0x1c')][_0xb34b('0x1d')]()]){_0x320a03[_0x548c4a['idField']]=_0x247c31[_0x548c4a['Variable'][_0xb34b('0x1c')][_0xb34b('0x1d')]()][_0xb34b('0x18')]();}});}return _0x320a03;}function getName(_0x3fe87d){if(_0x3fe87d[_0xb34b('0x1e')]('\x20')>0x0){var _0xd5731a=_0x3fe87d[_0xb34b('0x1f')](/ (.+)/);if(_0xd5731a[0x1]){return _0xd5731a;}}return[_0x3fe87d,_0x3fe87d];}var accountsTokens={};function getAccessToken(_0x159921){return new Promise(function(_0x25893a,_0x5c24c6){if(!_[_0xb34b('0x20')](accountsTokens[_0x159921['id']])&&!_[_0xb34b('0x20')](accountsTokens[_0x159921['id']][_0xb34b('0x21')])){if(moment()[_0xb34b('0x22')](accountsTokens[_0x159921['id']][_0xb34b('0x23')])){_0x25893a(accountsTokens[_0x159921['id']][_0xb34b('0x21')]);}}var _0x3bd742;switch(_0x159921[_0xb34b('0x24')]){case'US':_0x3bd742='https://accounts.zoho.com';break;case'AU':_0x3bd742=_0xb34b('0x25');break;case'EU':_0x3bd742=_0xb34b('0x26');break;case'IN':_0x3bd742=_0xb34b('0x27');break;case'CN':_0x3bd742='https://accounts.zoho.com.cn';break;default:_0x3bd742='https://accounts.zoho.eu';break;}var _0x4cc4b4={'method':_0xb34b('0x28'),'uri':_0x3bd742+_0xb34b('0x29'),'qs':{'refresh_token':_0x159921['refreshToken'],'client_id':_0x159921[_0xb34b('0x2a')],'client_secret':_0x159921[_0xb34b('0x2b')],'grant_type':'refresh_token'},'json':!![]};return rp(_0x4cc4b4)[_0xb34b('0x2c')](function(_0x2fb771){accountsTokens[_0x159921['id']]={'access_token':_0x2fb771[_0xb34b('0x21')],'expires_in':moment()[_0xb34b('0x2d')](_0x2fb771[_0xb34b('0x23')],'seconds')};_0x25893a(_0x2fb771[_0xb34b('0x21')]);})[_0xb34b('0x2e')](function(_0x586d34){logger['error'](_0xb34b('0x2f'),_0x586d34['stack']);_0x5c24c6(_0x586d34);});});}function getUser(_0x5e5704,_0x42956f,_0x5d1f13,_0x4e156b){logger['info'](_0xb34b('0x30'));return request({'method':_0xb34b('0x31'),'uri':util[_0xb34b('0x32')]('https://www.zohoapis.%s/crm/v2/users',_0x42956f),'qs':{'type':_0xb34b('0x33')},'headers':{'Authorization':'Zoho-oauthtoken\x20'+_0x5e5704},'json':!![]})[_0xb34b('0x2c')](function(_0x100ee3){if(_0x100ee3[_0xb34b('0x34')]){var _0x37ea2f=-0x1;if(_[_0xb34b('0x35')](_0x100ee3[_0xb34b('0x34')])){if(!_[_0xb34b('0x20')](_0x4e156b)){_0x37ea2f=_[_0xb34b('0x36')](_0x100ee3[_0xb34b('0x34')],function(_0x56332f){return _0x56332f[_0xb34b('0x37')]===_0x4e156b;});}if(_0x37ea2f>=0x0){logger['info'](_0xb34b('0x38'));}else{logger['info']('Using\x20the\x20admin\x20account!');_0x37ea2f=_['findIndex'](_0x100ee3[_0xb34b('0x34')],function(_0x16051e){return _0x16051e[_0xb34b('0x39')]['name']===_0xb34b('0x3a');});}return _0x100ee3[_0xb34b('0x34')][_0x37ea2f];}else{if(_0x100ee3[_0xb34b('0x3b')]['profile']['name']===_0xb34b('0x3a')){logger['info']('Using\x20the\x20admin\x20account!');user=_0x100ee3['user'];return user;}else{logger[_0xb34b('0x3c')]('The\x20failing\x20result\x20is',JSON[_0xb34b('0xf')](_0x100ee3));throw new Error(_0xb34b('0x3d')+JSON[_0xb34b('0xf')](_0x100ee3));}}}else{logger[_0xb34b('0x3c')]('The\x20failing\x20result\x20is',JSON['stringify'](_0x100ee3));throw new Error(_0xb34b('0x3d')+JSON['stringify'](_0x100ee3));}})[_0xb34b('0x2e')](function(_0x1653a1){console[_0xb34b('0x3c')](_0x1653a1);});}function getZohoUser(_0x59b57,_0x3d775a){return new BPromise(function(_0x550d45,_0x47dfb3){request(_0x59b57)[_0xb34b('0x2c')](function(_0x5178f1){var _0x358e3a=null;if(_0x5178f1){_0x358e3a=_0x5178f1[_0xb34b('0x3e')][0x0];_0x358e3a[_0xb34b('0x3f')]=_0x3d775a;}_0x550d45(_0x358e3a);})[_0xb34b('0x2e')](function(_0x5b5043){_0x47dfb3(_0x5b5043);});});}function createEndUser(_0x2cd442,_0x55bb9d,_0xf2a326,_0x12541a,_0x390b63,_0x330df7){var _0xf2a326=getName(_0xf2a326);return request({'method':_0xb34b('0x28'),'uri':_0xb34b('0x40')+_0x55bb9d+'/crm/v2/'+_[_0xb34b('0x41')](_0x330df7[_0xb34b('0x42')])+'s','body':{'data':[{'Last_Name':_0xf2a326[0x1],'First_Name':_0xf2a326[0x0],'Phone':_0x12541a,'Owner':{'name':!_[_0xb34b('0x20')](_0x390b63[_0xb34b('0x43')][_0xb34b('0x1c')])?_0x390b63[_0xb34b('0x43')]['name']:!_[_0xb34b('0x20')](_0x390b63[_0xb34b('0x44')])?_0x390b63['first_name']+'\x20'+_0x390b63[_0xb34b('0x45')]:_0x390b63[_0xb34b('0x45')],'id':_0x390b63['id']}}]},'headers':{'Authorization':'Zoho-oauthtoken\x20'+_0x2cd442},'json':!![]})[_0xb34b('0x2c')](function(_0x3b714c){if(_0x3b714c&&_0x3b714c[_0xb34b('0x3e')][0x0][_0xb34b('0x46')]===_0xb34b('0x47')){var _0x1047ea=_0x3b714c['data'][0x0][_0xb34b('0x48')];_0x1047ea['enduserType']=_['startCase'](_0x330df7[_0xb34b('0x42')])+'s';return _0x1047ea;}logger[_0xb34b('0x3c')](_0xb34b('0x49'),JSON[_0xb34b('0xf')](data));throw new Error(_0xb34b('0x4a')+JSON[_0xb34b('0xf')](data));})[_0xb34b('0x2e')](function(_0x488779){console[_0xb34b('0x4b')](_0xb34b('0x4c'),_0x488779);});}function getEndUser(_0x5a49e1,_0x3457f6,_0x2bf46a,_0x8bb079,_0x2eaa05,_0x570f01,_0xdbdd58){var _0x16bd04={'method':'GET','uri':'','headers':{'Authorization':_0xb34b('0x4d')+_0x5a49e1},'json':!![]};switch(_0xdbdd58[_0xb34b('0x4e')]){case'contact_lead':_0x16bd04[_0xb34b('0x4f')]=_0xb34b('0x40')+_0x3457f6+_0xb34b('0x50')+_0x2eaa05+'))';return getZohoUser(_0x16bd04,'Contacts')[_0xb34b('0x2c')](function(_0x3ffc58){if(_0x3ffc58)return _0x3ffc58;_0x16bd04[_0xb34b('0x4f')]=_0xb34b('0x40')+_0x3457f6+_0xb34b('0x51')+_0x2eaa05+'))';return getZohoUser(_0x16bd04,'Leads')['then'](function(_0x322357){if(_0x322357)return _0x322357;if(_0xdbdd58[_0xb34b('0x42')]!=_0xb34b('0x52')){return createEndUser(_0x5a49e1,_0x3457f6,_0x8bb079,_0x2eaa05,_0x570f01,_0xdbdd58);}else{return{};}});});break;case'contact':_0x16bd04['uri']=_0xb34b('0x40')+_0x3457f6+_0xb34b('0x50')+_0x2eaa05+'))';return getZohoUser(_0x16bd04,_0xb34b('0x53'))['then'](function(_0x411194){if(_0x411194)return _0x411194;if(_0xdbdd58[_0xb34b('0x42')]!=_0xb34b('0x52')){return createEndUser(_0x5a49e1,_0x3457f6,_0x8bb079,_0x2eaa05,_0x570f01,_0xdbdd58);}else{return{};}});break;case _0xb34b('0x54'):_0x16bd04[_0xb34b('0x4f')]=_0xb34b('0x40')+_0x3457f6+_0xb34b('0x51')+_0x2eaa05+'))';return getZohoUser(_0x16bd04,'Leads')[_0xb34b('0x2c')](function(_0x42801d){if(_0x42801d)return _0x42801d;if(_0xdbdd58[_0xb34b('0x42')]!=_0xb34b('0x52')){return createEndUser(_0x5a49e1,_0x3457f6,_0x8bb079,_0x2eaa05,_0x570f01,_0xdbdd58);}else{return{};}});break;}}function getCall(_0x41c407,_0x11999e,_0x9a300d,_0x513196,_0x48be0a,_0x1efd5b,_0x2f18b3,_0x1dcf4b){logger['info'](_0xb34b('0x55'));var _0x17a3d2={};_0x17a3d2[_0xb34b('0x56')]={'name':!_['isNil'](_0x513196[_0xb34b('0x43')][_0xb34b('0x1c')])&&!_['isNil'](_0x513196[_0xb34b('0x39')][_0xb34b('0x1c')])&&_0x513196[_0xb34b('0x39')][_0xb34b('0x1c')]==='administrator'?_0x513196[_0xb34b('0x43')][_0xb34b('0x1c')]:!_[_0xb34b('0x20')](_0x513196[_0xb34b('0x44')])?_0x513196[_0xb34b('0x44')]+'\x20'+_0x513196[_0xb34b('0x45')]:_0x513196[_0xb34b('0x45')],'id':_0x513196['id']};_0x17a3d2[_0xb34b('0x57')]=intUtil[_0xb34b('0x58')](_0x1efd5b['Subjects'],_0x2f18b3,'\x20');_0x17a3d2[_0xb34b('0x59')]=intUtil[_0xb34b('0x58')](_0x1efd5b[_0xb34b('0x5a')],_0x2f18b3,'\x0a');if(_0x48be0a[_0xb34b('0x3f')]==='Contacts'){_0x17a3d2[_0xb34b('0x5b')]={'name':!_['isNil'](_0x48be0a[_0xb34b('0x5c')])?_0x48be0a[_0xb34b('0x5c')]:!_['isNil'](_0x48be0a[_0xb34b('0x5d')])?_0x48be0a[_0xb34b('0x5d')]+'\x20'+_0x48be0a[_0xb34b('0x5e')]:_0x48be0a['Last_Name'],'id':_0x48be0a['id']};}if(_0x48be0a[_0xb34b('0x3f')]===_0xb34b('0x5f')){_0x17a3d2['What_Id']={'name':!_[_0xb34b('0x20')](_0x48be0a['Full_Name'])?_0x48be0a['Full_Name']:!_['isNil'](_0x48be0a[_0xb34b('0x5d')])?_0x48be0a[_0xb34b('0x5d')]+'\x20'+_0x48be0a[_0xb34b('0x5e')]:_0x48be0a[_0xb34b('0x5e')],'id':_0x48be0a['id']};_0x17a3d2[_0xb34b('0x60')]=_[_0xb34b('0x41')](_0x48be0a[_0xb34b('0x3f')]);}if(_0x2f18b3[_0xb34b('0x61')]){_0x17a3d2[_0xb34b('0x62')]=moment[_0xb34b('0x63')](parseInt(_0x2f18b3['talktime'])*0x3e8)[_0xb34b('0x32')](_0xb34b('0x64'));}else if(_0x2f18b3[_0xb34b('0x65')]&&_0x2f18b3['endtime']){_0x17a3d2[_0xb34b('0x62')]=moment[_0xb34b('0x63')](moment(_0x2f18b3[_0xb34b('0x66')],_0xb34b('0x67'))[_0xb34b('0x68')](moment(_0x2f18b3['starttime'],'YYYY-MM-DDTHH:mm:ss')))['format'](_0xb34b('0x64'));}switch(_0x2f18b3[_0xb34b('0x69')]){case'called':_0x17a3d2[_0xb34b('0x6a')]=_0xb34b('0x6b');break;case'complete':case _0xb34b('0x6c'):_0x17a3d2[_0xb34b('0x6a')]=_0xb34b('0x6d');break;case'rejected':_0x17a3d2[_0xb34b('0x6a')]='Rejected';break;case _0xb34b('0x6e'):_0x17a3d2[_0xb34b('0x6a')]=_0xb34b('0x6f');break;case _0xb34b('0x70'):_0x17a3d2[_0xb34b('0x6a')]=_0xb34b('0x71');default:}_0x17a3d2[_0xb34b('0x72')]=(_0x1dcf4b===_0xb34b('0x73')?moment(_0x2f18b3[_0xb34b('0x74')])['format'](_0xb34b('0x67')):moment(_0x2f18b3[_0xb34b('0x75')])['format'](_0xb34b('0x67')))||moment()[_0xb34b('0x32')](_0xb34b('0x67'));_0x17a3d2[_0xb34b('0x76')]=_0x1dcf4b||_0xb34b('0x77');_0x17a3d2=_[_0xb34b('0x78')](_0x17a3d2,getCustomFields(_0x1efd5b['Fields'],_0x2f18b3));return request({'method':_0xb34b('0x28'),'uri':_0xb34b('0x40')+_0x11999e+_0xb34b('0x79'),'headers':{'Authorization':_0xb34b('0x4d')+_0x41c407},'body':{'data':[_0x17a3d2]},'json':!![]})[_0xb34b('0x2c')](function(_0x69b9d){if(_0x69b9d&&_0x69b9d[_0xb34b('0x3e')][0x0][_0xb34b('0x46')]===_0xb34b('0x47')){logger['info'](_0xb34b('0x7a'));return{'id':_0x69b9d['data'][0x0][_0xb34b('0x48')]['id']};}})[_0xb34b('0x2e')](function(_0x4f5968){logger[_0xb34b('0x7b')](_0xb34b('0x7c'),_0x4f5968[_0xb34b('0x7d')]);console[_0xb34b('0x4b')]('err',_0x4f5968);});}exports[_0xb34b('0x7e')]=function(_0x2cf9e0,_0x1af67e,_0x3e3d5a,_0x1145b8,_0x2327db,_0x577c70){var _0x517d8d,_0x4de7a1,_0x3d573f;_0x577c70[_0xb34b('0x7f')]=intUtil[_0xb34b('0x80')](_0x577c70[_0xb34b('0x7f')]);_0x577c70[_0xb34b('0x81')]=intUtil['stripTrailingSlash'](_0x577c70[_0xb34b('0x81')]);if(_0x2327db&&_0x2327db[_0xb34b('0x82')]){logger[_0xb34b('0x7b')](_0xb34b('0x83'),_0xb34b('0x84'));_0x1af67e[_0xb34b('0x85')]=_0x577c70[_0xb34b('0x81')]+_0xb34b('0x86')+_0x1af67e['uniqueid']+_0xb34b('0x87')+md5(_0x1af67e[_0xb34b('0x88')]);}else{_0x1af67e[_0xb34b('0x85')]='';}var _0x41d91c=_0x577c70[_0xb34b('0x7f')]==='zoho.eu'?'eu':'com';return getAccessToken(_0x577c70)[_0xb34b('0x2c')](function(_0x237073){_0x3d573f=_0x237073;return getUser(_0x3d573f,_0x41d91c,_0x577c70,_0x1145b8[_0xb34b('0x37')]);})[_0xb34b('0x2c')](function(_0xdd6439){_0x517d8d=_0xdd6439;logger[_0xb34b('0x7b')](_0xb34b('0x89'),_0x517d8d['id']);return getEndUser(_0x3d573f,_0x41d91c,_0x577c70,_0x1af67e[_0xb34b('0x8a')],_0x1af67e[_0xb34b('0x8b')],_0x517d8d,_0x3e3d5a);})[_0xb34b('0x2c')](function(_0x1eb2e1){_0x4de7a1=_0x1eb2e1;return getCall(_0x3d573f,_0x41d91c,_0x577c70,_0x517d8d,_0x4de7a1,_0x3e3d5a,_0x1af67e,_0xb34b('0x77'));})['then'](function(_0x1ed501){if(_0x1ed501){logger['info']('The\x20Call\x20ID\x20is:',_0x1ed501['id']);logger[_0xb34b('0x7b')](_0xb34b('0x83'),_0xb34b('0x8c'));emit(util[_0xb34b('0x32')]('user:%s',_0x1145b8[_0xb34b('0x1c')]),_0xb34b('0x8d'),{'uri':'https://crm.'+_0x577c70['host']+_0xb34b('0x8e')+_0x1ed501['id']});}})['catch'](function(_0x5f078d){logger['error'](_0xb34b('0x83'),JSON[_0xb34b('0xf')](_0x5f078d));});};exports[_0xb34b('0x73')]=function(_0x56d04a,_0x51e17e,_0x40cc0d,_0x3ed579,_0x2cbcdf,_0x5d6886,_0x237b0f){var _0xf2a8eb,_0x2ac698,_0x431a2f;_0x5d6886[_0xb34b('0x7f')]=intUtil[_0xb34b('0x80')](_0x5d6886[_0xb34b('0x7f')]);_0x5d6886['serverUrl']=intUtil['stripTrailingSlash'](_0x5d6886[_0xb34b('0x81')]);if(_0x237b0f&&_0x237b0f[_0xb34b('0x8f')]&&_0x237b0f[_0xb34b('0x8f')]!==_0xb34b('0x90')){logger[_0xb34b('0x7b')](_0xb34b('0x91'),_0xb34b('0x84'));_0x51e17e[_0xb34b('0x85')]=_0x5d6886[_0xb34b('0x81')]+_0xb34b('0x86')+_0x51e17e[_0xb34b('0x88')]+'/downloads?type=uniqueid&token='+md5(_0x51e17e['uniqueid']);}var _0x3c7845=_0x5d6886[_0xb34b('0x7f')]===_0xb34b('0x92')?'eu':'com';return getAccessToken(_0x5d6886)[_0xb34b('0x2c')](function(_0x1031f3){_0x431a2f=_0x1031f3;return getUser(_0x431a2f,_0x3c7845,_0x5d6886,_0x3ed579[_0xb34b('0x37')]);})[_0xb34b('0x2c')](function(_0x43b258){_0xf2a8eb=_0x43b258;logger['info'](_0xb34b('0x89'),_0xf2a8eb['id']);return getEndUser(_0x431a2f,_0x3c7845,_0x5d6886,_0x51e17e['destcalleridname'],_0x51e17e[_0xb34b('0x93')],_0xf2a8eb,_0x40cc0d);})[_0xb34b('0x2c')](function(_0x1f3d19){_0x2ac698=_0x1f3d19;return getCall(_0x431a2f,_0x3c7845,_0x5d6886,_0xf2a8eb,_0x2ac698,_0x40cc0d,_0x51e17e,'Outbound');})[_0xb34b('0x2c')](function(_0x3dbbe6){if(_0x3dbbe6){logger[_0xb34b('0x7b')]('The\x20Call\x20ID\x20is:',_0x3dbbe6['id']);logger[_0xb34b('0x7b')](_0xb34b('0x91'),_0xb34b('0x8c'));emit(util[_0xb34b('0x32')](_0xb34b('0x94'),_0x3ed579['name']),'trigger:browser:url',{'uri':_0xb34b('0x95')+_0x5d6886[_0xb34b('0x7f')]+_0xb34b('0x8e')+_0x3dbbe6['id']});}})[_0xb34b('0x2e')](function(_0x5ae263){logger['error'](_0xb34b('0x91'),JSON[_0xb34b('0xf')](_0x5ae263));});};exports['unmanaged']=function(_0x461092,_0x2aeafd,_0x4dc447,_0x5d37ed,_0x1af601,_0x48df44){var _0x304954,_0x4ef86e,_0x4c0c8d;_0x48df44[_0xb34b('0x7f')]=intUtil[_0xb34b('0x80')](_0x48df44['host']);_0x48df44[_0xb34b('0x81')]=intUtil[_0xb34b('0x80')](_0x48df44[_0xb34b('0x81')]);if(_0x1af601&&_0x1af601[_0xb34b('0x82')]){logger[_0xb34b('0x7b')]('['+_0x2aeafd[_0xb34b('0x69')][_0xb34b('0x96')]()+']',_0xb34b('0x84'));_0x2aeafd['recordingURL']=_0x48df44[_0xb34b('0x81')]+'/api/voice/recordings/'+_0x2aeafd[_0xb34b('0x88')]+_0xb34b('0x87')+md5(_0x2aeafd[_0xb34b('0x88')]);}else{_0x2aeafd[_0xb34b('0x85')]='';}var _0x372d8c=_0x48df44['host']===_0xb34b('0x92')?'eu':'com';return getAccessToken(_0x48df44)['then'](function(_0x3f7af5){_0x4c0c8d=_0x3f7af5;return getUser(_0x4c0c8d,_0x372d8c,_0x48df44);})['then'](function(_0x4d3333){_0x304954=_0x4d3333;logger['info']('The\x20User\x20ID\x20is:',_0x304954['id']);return getEndUser(_0x4c0c8d,_0x372d8c,_0x48df44,_0x2aeafd[_0xb34b('0x8a')],_0x2aeafd[_0xb34b('0x8b')],_0x304954,_0x4dc447);})['then'](function(_0x18fcc2){_0x4ef86e=_0x18fcc2;return getCall(_0x4c0c8d,_0x372d8c,_0x48df44,_0x304954,_0x4ef86e,_0x4dc447,_0x2aeafd,'Inbound');})[_0xb34b('0x2c')](function(_0x32db98){if(_0x32db98){logger[_0xb34b('0x7b')](_0xb34b('0x97'),_0x32db98['id']);}})['catch'](function(_0x4812d3){logger[_0xb34b('0x3c')]('['+_0x2aeafd[_0xb34b('0x69')]['toUpperCase']()+']',JSON[_0xb34b('0xf')](_0x4812d3));});}; \ 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 39244fa..39a5988 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 _0xf164=['shelljs','mustache','../../../../config/logger','trigger','exec','data2','Script','data3','render','error','format','%s\x20\x27%s\x27\x20failed\x20with\x20code\x20%d\x20and\x20error:\x20%s'];(function(_0x1fe2f3,_0x1078a7){var _0x2e0cbe=function(_0x56be96){while(--_0x56be96){_0x1fe2f3['push'](_0x1fe2f3['shift']());}};_0x2e0cbe(++_0x1078a7);}(_0xf164,0xa8));var _0x4f16=function(_0x38325,_0x262d3c){_0x38325=_0x38325-0x0;var _0x2994d6=_0xf164[_0x38325];return _0x2994d6;};'use strict';var util=require('util');var sh=require(_0x4f16('0x0'));var Mustache=require(_0x4f16('0x1'));var logger=require(_0x4f16('0x2'))(_0x4f16('0x3'));exports[_0x4f16('0x4')]=function(_0x2b925a,_0x30518a){var _0x2f0db2=_0x2b925a[_0x4f16('0x5')]?_0x2b925a['data2']:_0x4f16('0x6');var _0x5a035a=_0x2b925a[_0x4f16('0x7')]?Mustache[_0x4f16('0x8')](_0x2b925a[_0x4f16('0x7')],_0x30518a):_0x30518a;sh[_0x4f16('0x4')](_0x5a035a,function(_0x471a11,_0x76ee56,_0xee3148){if(_0x471a11!==0x0){logger[_0x4f16('0x9')](util[_0x4f16('0xa')](_0x4f16('0xb'),_0x2f0db2,_0x5a035a,_0x471a11,_0xee3148));}else{logger['info'](util[_0x4f16('0xa')]('%s\x20\x27%s\x27\x20succeeded\x20with\x20output:\x20%s',_0x2f0db2,_0x5a035a,_0x76ee56));}});}; \ No newline at end of file +var _0x0b00=['mustache','../../../../config/logger','trigger','data2','Script','data3','render','exec','error','format','%s\x20\x27%s\x27\x20failed\x20with\x20code\x20%d\x20and\x20error:\x20%s','info','%s\x20\x27%s\x27\x20succeeded\x20with\x20output:\x20%s','util','shelljs'];(function(_0x66d35d,_0x40dd02){var _0x3e0216=function(_0x21d409){while(--_0x21d409){_0x66d35d['push'](_0x66d35d['shift']());}};_0x3e0216(++_0x40dd02);}(_0x0b00,0x1de));var _0x00b0=function(_0x150150,_0x211206){_0x150150=_0x150150-0x0;var _0x3684c2=_0x0b00[_0x150150];return _0x3684c2;};'use strict';var util=require(_0x00b0('0x0'));var sh=require(_0x00b0('0x1'));var Mustache=require(_0x00b0('0x2'));var logger=require(_0x00b0('0x3'))(_0x00b0('0x4'));exports['exec']=function(_0x1b5bfa,_0x571d9a){var _0x2055dc=_0x1b5bfa['data2']?_0x1b5bfa[_0x00b0('0x5')]:_0x00b0('0x6');var _0x34d7b2=_0x1b5bfa[_0x00b0('0x7')]?Mustache[_0x00b0('0x8')](_0x1b5bfa[_0x00b0('0x7')],_0x571d9a):_0x571d9a;sh[_0x00b0('0x9')](_0x34d7b2,function(_0x5b59a5,_0x153c2f,_0x32b02e){if(_0x5b59a5!==0x0){logger[_0x00b0('0xa')](util[_0x00b0('0xb')](_0x00b0('0xc'),_0x2055dc,_0x34d7b2,_0x5b59a5,_0x32b02e));}else{logger[_0x00b0('0xd')](util[_0x00b0('0xb')](_0x00b0('0xe'),_0x2055dc,_0x34d7b2,_0x153c2f));}});}; \ 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 05c09a3..5df2fe4 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 _0x2762=['lodash','mustache','../../../../config/logger','trigger','exec','data1','toUpperCase','data5','number','headers','data6','render','error','stack','GET','DELETE','POST','PUT','parse','data7','body','body\x20has\x20been\x20passed\x20to\x20URLforward\x20in\x20a\x20wrong\x20format','info','format','%s\x20%s\x20sending\x20request\x20with\x20following\x20options:\x20%s',',\x20request\x20body:\x20','object','%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','data2','message','request-promise','util'];(function(_0x7a3c8f,_0x41acbc){var _0x584143=function(_0x6fa823){while(--_0x6fa823){_0x7a3c8f['push'](_0x7a3c8f['shift']());}};_0x584143(++_0x41acbc);}(_0x2762,0x130));var _0x2276=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0x2762[_0x3dd15e];return _0x231fd0;};'use strict';var rp=require(_0x2276('0x0'));var util=require(_0x2276('0x1'));var _=require(_0x2276('0x2'));var Mustache=require(_0x2276('0x3'));var logger=require(_0x2276('0x4'))(_0x2276('0x5'));exports[_0x2276('0x6')]=function(_0x1462d8,_0x18c307){var _0x41457f,_0x1aea5f;var _0x165865={'method':_0x1462d8[_0x2276('0x7')][_0x2276('0x8')](),'uri':Mustache['render'](_0x1462d8['data2'],_0x18c307),'json':!![],'resolveWithFullResponse':!![],'timeout':typeof parseInt(_0x1462d8[_0x2276('0x9')])===_0x2276('0xa')&&parseInt(_0x1462d8[_0x2276('0x9')])>=0x1&&parseInt(_0x1462d8[_0x2276('0x9')])<=0xa?parseInt(_0x1462d8[_0x2276('0x9')])*0x3e8:0x5*0x3e8};try{_0x165865[_0x2276('0xb')]=_0x1462d8[_0x2276('0xc')]?JSON['parse'](Mustache[_0x2276('0xd')](_0x1462d8[_0x2276('0xc')],_0x18c307)):{};}catch(_0x5483f7){logger[_0x2276('0xe')](_0x5483f7[_0x2276('0xf')]);}switch(_0x1462d8[_0x2276('0x7')]['toUpperCase']()){case _0x2276('0x10'):case _0x2276('0x11'):_0x41457f=null;_0x165865['qs']=_0x18c307;break;case _0x2276('0x12'):case _0x2276('0x13'):if(_0x1462d8['data7']){try{_0x41457f=JSON[_0x2276('0x14')](Mustache[_0x2276('0xd')](_0x1462d8[_0x2276('0x15')],_0x18c307));_0x165865[_0x2276('0x16')]=_0x41457f;}catch(_0x571792){logger[_0x2276('0xe')](_0x571792[_0x2276('0xf')]);logger[_0x2276('0xe')](_0x2276('0x17'));}}else{_0x41457f=_0x18c307;_0x165865[_0x2276('0x16')]=_0x41457f;}break;}logger[_0x2276('0x18')](util[_0x2276('0x19')](_0x2276('0x1a'),_0x1462d8[_0x2276('0x7')],_0x1462d8['data2'],JSON['stringify'](_0x165865)));rp(_0x165865)['then'](function(_0x7828f2){_0x41457f=!_['isNil'](_0x41457f)?_0x2276('0x1b')+_0x41457f:'';_0x1aea5f=typeof _0x7828f2[_0x2276('0x16')]===_0x2276('0x1c')?JSON['stringify'](_0x7828f2[_0x2276('0x16')]):_0x7828f2[_0x2276('0x16')];logger['info'](util[_0x2276('0x19')](_0x2276('0x1d'),_0x1462d8['data1'],_0x1462d8['data2'],_0x7828f2[_0x2276('0x1e')],_0x1aea5f));})['catch'](function(_0x52bbc2){logger[_0x2276('0xe')](util[_0x2276('0x19')](_0x2276('0x1f'),_0x1462d8['data1'],_0x1462d8[_0x2276('0x20')],_0x52bbc2[_0x2276('0x1e')],_0x52bbc2['name'],_0x52bbc2[_0x2276('0x21')]));});}; \ No newline at end of file +var _0x73fc=['statusCode','catch','message','util','mustache','../../../../config/logger','trigger','data1','toUpperCase','data2','data5','number','headers','data6','render','error','stack','GET','DELETE','POST','PUT','parse','body','body\x20has\x20been\x20passed\x20to\x20URLforward\x20in\x20a\x20wrong\x20format','info','format','%s\x20%s\x20sending\x20request\x20with\x20following\x20options:\x20%s','stringify','isNil',',\x20request\x20body:\x20','object','%s\x20%s\x20succeeded\x20with\x20status:\x20%d\x20and\x20response:\x20%s'];(function(_0x3dfa3e,_0x293558){var _0x3ff9ed=function(_0x400e9b){while(--_0x400e9b){_0x3dfa3e['push'](_0x3dfa3e['shift']());}};_0x3ff9ed(++_0x293558);}(_0x73fc,0x83));var _0xc73f=function(_0x457355,_0x108c42){_0x457355=_0x457355-0x0;var _0x542244=_0x73fc[_0x457355];return _0x542244;};'use strict';var rp=require('request-promise');var util=require(_0xc73f('0x0'));var _=require('lodash');var Mustache=require(_0xc73f('0x1'));var logger=require(_0xc73f('0x2'))(_0xc73f('0x3'));exports['exec']=function(_0x4a7c30,_0x33d02b){var _0x4d7b78,_0x396d74;var _0x5b9fa4={'method':_0x4a7c30[_0xc73f('0x4')][_0xc73f('0x5')](),'uri':Mustache['render'](_0x4a7c30[_0xc73f('0x6')],_0x33d02b),'json':!![],'resolveWithFullResponse':!![],'timeout':typeof parseInt(_0x4a7c30[_0xc73f('0x7')])===_0xc73f('0x8')&&parseInt(_0x4a7c30[_0xc73f('0x7')])>=0x1&&parseInt(_0x4a7c30['data5'])<=0xa?parseInt(_0x4a7c30[_0xc73f('0x7')])*0x3e8:0x5*0x3e8};try{_0x5b9fa4[_0xc73f('0x9')]=_0x4a7c30[_0xc73f('0xa')]?JSON['parse'](Mustache[_0xc73f('0xb')](_0x4a7c30[_0xc73f('0xa')],_0x33d02b)):{};}catch(_0xf59278){logger[_0xc73f('0xc')](_0xf59278[_0xc73f('0xd')]);}switch(_0x4a7c30[_0xc73f('0x4')][_0xc73f('0x5')]()){case _0xc73f('0xe'):case _0xc73f('0xf'):_0x4d7b78=null;_0x5b9fa4['qs']=_0x33d02b;break;case _0xc73f('0x10'):case _0xc73f('0x11'):if(_0x4a7c30['data7']){try{_0x4d7b78=JSON[_0xc73f('0x12')](Mustache[_0xc73f('0xb')](_0x4a7c30['data7'],_0x33d02b));_0x5b9fa4[_0xc73f('0x13')]=_0x4d7b78;}catch(_0xcd363e){logger[_0xc73f('0xc')](_0xcd363e[_0xc73f('0xd')]);logger[_0xc73f('0xc')](_0xc73f('0x14'));}}else{_0x4d7b78=_0x33d02b;_0x5b9fa4[_0xc73f('0x13')]=_0x4d7b78;}break;}logger[_0xc73f('0x15')](util[_0xc73f('0x16')](_0xc73f('0x17'),_0x4a7c30[_0xc73f('0x4')],_0x4a7c30[_0xc73f('0x6')],JSON[_0xc73f('0x18')](_0x5b9fa4)));rp(_0x5b9fa4)['then'](function(_0x588693){_0x4d7b78=!_[_0xc73f('0x19')](_0x4d7b78)?_0xc73f('0x1a')+_0x4d7b78:'';_0x396d74=typeof _0x588693['body']===_0xc73f('0x1b')?JSON[_0xc73f('0x18')](_0x588693[_0xc73f('0x13')]):_0x588693['body'];logger['info'](util[_0xc73f('0x16')](_0xc73f('0x1c'),_0x4a7c30[_0xc73f('0x4')],_0x4a7c30[_0xc73f('0x6')],_0x588693[_0xc73f('0x1d')],_0x396d74));})[_0xc73f('0x1e')](function(_0x10e2c6){logger[_0xc73f('0xc')](util[_0xc73f('0x16')]('%s\x20%s\x20failed\x20with\x20status:\x20%d\x20and\x20error:\x20%s\x20%s',_0x4a7c30['data1'],_0x4a7c30[_0xc73f('0x6')],_0x10e2c6[_0xc73f('0x1d')],_0x10e2c6['name'],_0x10e2c6[_0xc73f('0x1f')]));});}; \ No newline at end of file diff --git a/server/services/email/client.js b/server/services/email/client.js index fd69c9c..b34e1d3 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 _0xec7a=['catch','exports','jayson/promise','../../config/logger','http','request','then','rpc','routing','error','message','result'];(function(_0xe161df,_0x47b457){var _0x904888=function(_0x46bcf5){while(--_0x46bcf5){_0xe161df['push'](_0xe161df['shift']());}};_0x904888(++_0x47b457);}(_0xec7a,0x116));var _0xaec7=function(_0x545150,_0x2c2b6c){_0x545150=_0x545150-0x0;var _0xff7fd6=_0xec7a[_0x545150];return _0xff7fd6;};'use strict';var jayson=require(_0xaec7('0x0'));var BPromise=require('bluebird');var logger=require(_0xaec7('0x1'))('routing');var client=jayson['client'][_0xaec7('0x2')]({'port':0x2329});client['Request']=function(_0x4d8af2,_0x116123){return new BPromise(function(_0x2768a9,_0xb1e741){return client[_0xaec7('0x3')](_0x4d8af2,_0x116123)[_0xaec7('0x4')](function(_0x17e87f){logger['debug'](_0xaec7('0x5'),_0xaec7('0x6'),_0x4d8af2,_0x116123,_0x17e87f);if(_0x17e87f[_0xaec7('0x7')]){logger[_0xaec7('0x7')](_0xaec7('0x5'),_0xaec7('0x6'),_0x4d8af2,_0x17e87f['error'][_0xaec7('0x8')],_0x116123);return _0xb1e741(_0x17e87f[_0xaec7('0x7')][_0xaec7('0x8')]);}else{return _0x2768a9(_0x17e87f[_0xaec7('0x9')]);}})[_0xaec7('0xa')](function(_0x2228fe){logger[_0xaec7('0x7')](_0xaec7('0x5'),_0xaec7('0x6'),_0x4d8af2,_0x2228fe,_0x116123);return _0xb1e741(_0x2228fe);});});};module[_0xaec7('0xb')]=client; \ No newline at end of file +var _0x575a=['../../config/logger','routing','client','http','request','debug','rpc','error','message','result','bluebird'];(function(_0x12915a,_0x5f270a){var _0x12b0aa=function(_0x496cb2){while(--_0x496cb2){_0x12915a['push'](_0x12915a['shift']());}};_0x12b0aa(++_0x5f270a);}(_0x575a,0x1a1));var _0xa575=function(_0x177cc9,_0x3f6fdd){_0x177cc9=_0x177cc9-0x0;var _0x2fe577=_0x575a[_0x177cc9];return _0x2fe577;};'use strict';var jayson=require('jayson/promise');var BPromise=require(_0xa575('0x0'));var logger=require(_0xa575('0x1'))(_0xa575('0x2'));var client=jayson[_0xa575('0x3')][_0xa575('0x4')]({'port':0x2329});client['Request']=function(_0x48e9e0,_0x5477f3){return new BPromise(function(_0x153901,_0x18631e){return client[_0xa575('0x5')](_0x48e9e0,_0x5477f3)['then'](function(_0x216a69){logger[_0xa575('0x6')](_0xa575('0x7'),'routing',_0x48e9e0,_0x5477f3,_0x216a69);if(_0x216a69[_0xa575('0x8')]){logger[_0xa575('0x8')](_0xa575('0x7'),_0xa575('0x2'),_0x48e9e0,_0x216a69['error'][_0xa575('0x9')],_0x5477f3);return _0x18631e(_0x216a69[_0xa575('0x8')][_0xa575('0x9')]);}else{return _0x153901(_0x216a69[_0xa575('0xa')]);}})['catch'](function(_0x345077){logger[_0xa575('0x8')](_0xa575('0x7'),_0xa575('0x2'),_0x48e9e0,_0x345077,_0x5477f3);return _0x18631e(_0x345077);});});};module['exports']=client; \ No newline at end of file diff --git a/server/services/email/index.js b/server/services/email/index.js index a7285cc..d704610 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 _0x5652=['then','initMailAccounts','mailAccounts','getSettings','loginMailFrequency','catch','error','./lib/email','./rpc/mailAccount','./rpc/setting','../../config/logger','email','resolve'];(function(_0x5e9f5d,_0x2071c8){var _0x4bd059=function(_0x3c3f93){while(--_0x3c3f93){_0x5e9f5d['push'](_0x5e9f5d['shift']());}};_0x4bd059(++_0x2071c8);}(_0x5652,0x1db));var _0x2565=function(_0x4017b0,_0x4347db){_0x4017b0=_0x4017b0-0x0;var _0x5ed4f7=_0x5652[_0x4017b0];return _0x5ed4f7;};'use strict';var server=require('./server');var Realtime=require('./realtime');var EmailChannel=require(_0x2565('0x0'));var mailAccount=require(_0x2565('0x1'));var setting=require(_0x2565('0x2'));var logger=require(_0x2565('0x3'))(_0x2565('0x4'));var realtime=new Realtime();var email=new EmailChannel(realtime);function initRealtime(){return Promise[_0x2565('0x5')]()[_0x2565('0x6')](mailAccount['getMailAccounts']())[_0x2565('0x6')](realtime[_0x2565('0x7')]())[_0x2565('0x6')](function(){email['refresh'](realtime[_0x2565('0x8')]);return realtime;});}function main(){return server['listen'](realtime,email)['then'](function(){return initRealtime();})[_0x2565('0x6')](function(){return setting[_0x2565('0x9')]();})[_0x2565('0x6')](function(_0xfcec12){return setInterval(initRealtime,_0xfcec12[_0x2565('0xa')]*0x3e8);})[_0x2565('0xb')](function(_0x190025){logger[_0x2565('0xc')]('Email\x20service\x20initialization',_0x190025);});}main(); \ No newline at end of file +var _0x4caf=['../../config/logger','email','getMailAccounts','then','initMailAccounts','refresh','listen','getSettings','loginMailFrequency','./server','./realtime','./lib/email','./rpc/setting'];(function(_0x42afde,_0x377195){var _0x5e9990=function(_0x157ea9){while(--_0x157ea9){_0x42afde['push'](_0x42afde['shift']());}};_0x5e9990(++_0x377195);}(_0x4caf,0x8b));var _0xf4ca=function(_0x28c46b,_0x2b33c9){_0x28c46b=_0x28c46b-0x0;var _0x2e1053=_0x4caf[_0x28c46b];return _0x2e1053;};'use strict';var server=require(_0xf4ca('0x0'));var Realtime=require(_0xf4ca('0x1'));var EmailChannel=require(_0xf4ca('0x2'));var mailAccount=require('./rpc/mailAccount');var setting=require(_0xf4ca('0x3'));var logger=require(_0xf4ca('0x4'))(_0xf4ca('0x5'));var realtime=new Realtime();var email=new EmailChannel(realtime);function initRealtime(){return Promise['resolve']()['then'](mailAccount[_0xf4ca('0x6')]())[_0xf4ca('0x7')](realtime[_0xf4ca('0x8')]())[_0xf4ca('0x7')](function(){email[_0xf4ca('0x9')](realtime['mailAccounts']);return realtime;});}function main(){return server[_0xf4ca('0xa')](realtime,email)[_0xf4ca('0x7')](function(){return initRealtime();})[_0xf4ca('0x7')](function(){return setting[_0xf4ca('0xb')]();})['then'](function(_0x4b95d9){return setInterval(initRealtime,_0x4b95d9[_0xf4ca('0xc')]*0x3e8);})['catch'](function(_0x3c9593){logger['error']('Email\x20service\x20initialization',_0x3c9593);});}main(); \ No newline at end of file diff --git a/server/services/email/lib/email.js b/server/services/email/lib/email.js index a58f04e..859bdfa 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 _0x5b96=['lastSync','sendMail','send','verifySmtp','Smtp','verify','verified','moment','bluebird','md5','ioredis','../../../config/environment','../../../config/logger','email','defaults','redis','localhost','socket.io-emitter','./imap','./smtp','../rpc/mailAccount','info','mailAccounts','smtp','key','active','Imap','status','messageStatus','total','isNil','emit','mailAccount:update','prototype','refresh','hasOwnProperty','service','provider','imapAccounts','box','bind','end','handleImapEnd','error','handleImapError','disabled','handleImapBox','connected','name','messages','New\x20email\x20from\x20%s\x20%s\x20%s\x20to\x20%s','lastName','from','notify','then','Mail\x20accepted\x20from\x20routing','catch','Mail\x20not\x20accepted\x20from\x20routing\x20%s','stringify'];(function(_0x130bef,_0x14a296){var _0x345065=function(_0x2dbb3d){while(--_0x2dbb3d){_0x130bef['push'](_0x130bef['shift']());}};_0x345065(++_0x14a296);}(_0x5b96,0x7d));var _0x65b9=function(_0x85d5a8,_0x1977be){_0x85d5a8=_0x85d5a8-0x0;var _0x20479b=_0x5b96[_0x85d5a8];return _0x20479b;};'use strict';var _=require('lodash');var moment=require(_0x65b9('0x0'));var BPromise=require(_0x65b9('0x1'));var md5=require(_0x65b9('0x2'));var Redis=require(_0x65b9('0x3'));var config=require(_0x65b9('0x4'));var logger=require(_0x65b9('0x5'))(_0x65b9('0x6'));config['redis']=_[_0x65b9('0x7')](config[_0x65b9('0x8')],{'host':_0x65b9('0x9'),'port':0x18eb});var io=require(_0x65b9('0xa'))(new Redis(config[_0x65b9('0x8')]));var EmailImap=require(_0x65b9('0xb'));var EmailSmtp=require(_0x65b9('0xc'));var mailAccount=require(_0x65b9('0xd'));var md5Accounts={};function EmailChannel(_0x10f3f6){logger[_0x65b9('0xe')]('start\x20email\x20channel');this['mailAccounts']=_0x10f3f6[_0x65b9('0xf')];this['imapAccounts']={};this[_0x65b9('0x10')]=new EmailSmtp();}EmailChannel['prototype']['emit']=function(_0x3c591a){var _0x19a450=this['mailAccounts'][_0x3c591a];var _0x143faf={'id':_0x19a450['id'],'name':_0x19a450['name'],'key':_0x19a450[_0x65b9('0x11')],'active':_0x19a450[_0x65b9('0x12')],'Imap':{'status':_0x19a450[_0x65b9('0x13')][_0x65b9('0x14')],'messageStatus':_0x19a450['Imap'][_0x65b9('0x15')],'total':_0x19a450['Imap'][_0x65b9('0x16')]}};if(_[_0x65b9('0x17')](md5Accounts[_0x3c591a])){md5Accounts[_0x3c591a]={};}var _0x174e64=md5(JSON['stringify'](_0x143faf));if(md5Accounts[_0x3c591a][_0x65b9('0x2')]!==_0x174e64){md5Accounts[_0x3c591a][_0x65b9('0x2')]=_0x174e64;io[_0x65b9('0x18')](_0x65b9('0x19'),_0x143faf);}};EmailChannel[_0x65b9('0x1a')][_0x65b9('0x1b')]=function(_0x1922d3){for(var _0x29dcd4 in _0x1922d3){if(_0x1922d3[_0x65b9('0x1c')](_0x29dcd4)){if(_0x1922d3[_0x29dcd4][_0x65b9('0x13')]&&_0x1922d3[_0x29dcd4]['active']){var _0x4b31d=_0x1922d3[_0x29dcd4][_0x65b9('0x13')];if(!_0x4b31d[_0x65b9('0x1d')]&&_0x1922d3[_0x29dcd4][_0x65b9('0x1e')]!=='custom')_0x4b31d['service']=_0x1922d3[_0x29dcd4][_0x65b9('0x1e')];if(!this[_0x65b9('0x1f')][_0x65b9('0x1c')](_0x4b31d['id'])){this[_0x65b9('0x1f')][_0x4b31d['id']]=new EmailImap(_0x4b31d,_0x1922d3[_0x29dcd4][_0x65b9('0x6')]);this[_0x65b9('0x1f')][_0x4b31d['id']]['on'](_0x65b9('0x20'),this['handleImapBox'][_0x65b9('0x21')](this,_0x29dcd4));this[_0x65b9('0x1f')][_0x4b31d['id']]['on']('email',this['handleImapEmail']['bind'](this,_0x29dcd4));this[_0x65b9('0x1f')][_0x4b31d['id']]['on'](_0x65b9('0x22'),this[_0x65b9('0x23')]['bind'](this,_0x29dcd4));this[_0x65b9('0x1f')][_0x4b31d['id']]['on'](_0x65b9('0x24'),this[_0x65b9('0x25')][_0x65b9('0x21')](this,_0x29dcd4));}}else{if(_[_0x65b9('0x17')](this[_0x65b9('0xf')][_0x29dcd4][_0x65b9('0x13')])){this['mailAccounts'][_0x29dcd4][_0x65b9('0x13')]={};}this[_0x65b9('0xf')][_0x29dcd4][_0x65b9('0x13')]['status']=_0x65b9('0x26');this[_0x65b9('0xf')][_0x29dcd4]['Imap'][_0x65b9('0x15')]='';this[_0x65b9('0x18')](_0x29dcd4);}}}};EmailChannel['prototype'][_0x65b9('0x27')]=function(_0x13c10a,_0x9a6ba2){if(this['mailAccounts'][_0x13c10a]){this[_0x65b9('0xf')][_0x13c10a][_0x65b9('0x13')][_0x65b9('0x14')]=_0x65b9('0x28');this['mailAccounts'][_0x13c10a]['Imap']['messageStatus']=_0x9a6ba2[_0x65b9('0x29')];if(_0x9a6ba2[_0x65b9('0x2a')]){this[_0x65b9('0xf')][_0x13c10a][_0x65b9('0x13')]['total']=_0x9a6ba2[_0x65b9('0x2a')]['total'];}return this[_0x65b9('0x18')](_0x13c10a);}};EmailChannel[_0x65b9('0x1a')]['handleImapEmail']=function(_0x87f8b9,_0x530e4f){logger['info'](_0x65b9('0x2b'),_0x530e4f['firstName'],_0x530e4f[_0x65b9('0x2c')],_0x530e4f[_0x65b9('0x2d')],_0x87f8b9);if(this[_0x65b9('0xf')][_0x87f8b9]){return mailAccount[_0x65b9('0x2e')](_0x87f8b9,_0x530e4f)[_0x65b9('0x2f')](function(_0x5cc6ab){if(_0x5cc6ab){logger[_0x65b9('0xe')](_0x65b9('0x30'));}})[_0x65b9('0x31')](function(_0x4724b3){logger[_0x65b9('0x24')](_0x65b9('0x32'),JSON[_0x65b9('0x33')](_0x4724b3));});}};EmailChannel[_0x65b9('0x1a')]['handleImapEnd']=function(_0x582235){if(this[_0x65b9('0xf')][_0x582235]&&this['mailAccounts'][_0x582235][_0x65b9('0x13')]){if(this[_0x65b9('0x1f')][this[_0x65b9('0xf')][_0x582235][_0x65b9('0x13')]['id']]){delete this['imapAccounts'][this[_0x65b9('0xf')][_0x582235][_0x65b9('0x13')]['id']];}this[_0x65b9('0xf')][_0x582235]['Imap'][_0x65b9('0x34')]=moment();this['emit'](_0x582235);}};EmailChannel[_0x65b9('0x1a')]['handleImapError']=function(_0x4bd37a,_0x26fa25){if(this['mailAccounts'][_0x4bd37a]){this[_0x65b9('0xf')][_0x4bd37a][_0x65b9('0x13')][_0x65b9('0x14')]=_0x65b9('0x24');this['mailAccounts'][_0x4bd37a][_0x65b9('0x13')][_0x65b9('0x15')]=_0x26fa25;return this[_0x65b9('0x18')](_0x4bd37a);}};EmailChannel[_0x65b9('0x1a')][_0x65b9('0x35')]=function(_0x33c184,_0x218947){return this[_0x65b9('0x10')][_0x65b9('0x36')](_0x33c184,_0x218947);};EmailChannel[_0x65b9('0x1a')][_0x65b9('0x37')]=function(_0x37e381){var _0x317c70=this;if(this[_0x65b9('0xf')][_0x37e381['id']]){if(_[_0x65b9('0x17')](this['mailAccounts'][_0x37e381['id']][_0x65b9('0x38')])){this[_0x65b9('0xf')][_0x37e381['id']][_0x65b9('0x38')]={};}this[_0x65b9('0xf')][_0x37e381['id']][_0x65b9('0x38')][_0x65b9('0x34')]=moment();return new BPromise(function(_0x45bcc8,_0x304da6){return _0x317c70[_0x65b9('0x10')][_0x65b9('0x39')](_0x37e381)[_0x65b9('0x2f')](function(_0x1a89f0){_0x317c70[_0x65b9('0xf')][_0x37e381['id']][_0x65b9('0x38')][_0x65b9('0x14')]=_0x65b9('0x3a');_0x317c70[_0x65b9('0xf')][_0x37e381['id']][_0x65b9('0x38')][_0x65b9('0x15')]='';_0x317c70[_0x65b9('0x18')](_0x37e381['id']);_0x45bcc8(_0x1a89f0);})['catch'](function(_0x27fb13){_0x317c70[_0x65b9('0xf')][_0x37e381['id']][_0x65b9('0x38')]['status']=_0x65b9('0x24');_0x317c70['mailAccounts'][_0x37e381['id']]['Smtp']['messageStatus']=_0x27fb13;_0x317c70[_0x65b9('0x18')](_0x37e381['id']);_0x304da6(_0x27fb13);});});}return this[_0x65b9('0x10')]['verify'](_0x37e381);};module['exports']=EmailChannel; \ No newline at end of file +var _0xd8e4=['verifySmtp','Smtp','lastSync','verify','verified','exports','lodash','bluebird','ioredis','../../../config/environment','redis','defaults','localhost','socket.io-emitter','./imap','../rpc/mailAccount','info','mailAccounts','imapAccounts','smtp','prototype','emit','active','status','Imap','messageStatus','total','md5','hasOwnProperty','service','provider','custom','email','box','bind','handleImapEmail','end','error','handleImapError','isNil','disabled','handleImapBox','connected','messages','New\x20email\x20from\x20%s\x20%s\x20%s\x20to\x20%s','firstName','from','then','Mail\x20not\x20accepted\x20from\x20routing\x20%s','stringify','handleImapEnd','sendMail','send'];(function(_0x246f0c,_0x39f734){var _0x30fe50=function(_0x9a975c){while(--_0x9a975c){_0x246f0c['push'](_0x246f0c['shift']());}};_0x30fe50(++_0x39f734);}(_0xd8e4,0x144));var _0x4d8e=function(_0x234e3b,_0x55620b){_0x234e3b=_0x234e3b-0x0;var _0x1843bf=_0xd8e4[_0x234e3b];return _0x1843bf;};'use strict';var _=require(_0x4d8e('0x0'));var moment=require('moment');var BPromise=require(_0x4d8e('0x1'));var md5=require('md5');var Redis=require(_0x4d8e('0x2'));var config=require(_0x4d8e('0x3'));var logger=require('../../../config/logger')('email');config[_0x4d8e('0x4')]=_[_0x4d8e('0x5')](config['redis'],{'host':_0x4d8e('0x6'),'port':0x18eb});var io=require(_0x4d8e('0x7'))(new Redis(config[_0x4d8e('0x4')]));var EmailImap=require(_0x4d8e('0x8'));var EmailSmtp=require('./smtp');var mailAccount=require(_0x4d8e('0x9'));var md5Accounts={};function EmailChannel(_0x2b649f){logger[_0x4d8e('0xa')]('start\x20email\x20channel');this[_0x4d8e('0xb')]=_0x2b649f[_0x4d8e('0xb')];this[_0x4d8e('0xc')]={};this[_0x4d8e('0xd')]=new EmailSmtp();}EmailChannel[_0x4d8e('0xe')][_0x4d8e('0xf')]=function(_0x292328){var _0x44ed90=this[_0x4d8e('0xb')][_0x292328];var _0x3bb1d2={'id':_0x44ed90['id'],'name':_0x44ed90['name'],'key':_0x44ed90['key'],'active':_0x44ed90[_0x4d8e('0x10')],'Imap':{'status':_0x44ed90['Imap'][_0x4d8e('0x11')],'messageStatus':_0x44ed90[_0x4d8e('0x12')][_0x4d8e('0x13')],'total':_0x44ed90[_0x4d8e('0x12')][_0x4d8e('0x14')]}};if(_['isNil'](md5Accounts[_0x292328])){md5Accounts[_0x292328]={};}var _0x4cd0fd=md5(JSON['stringify'](_0x3bb1d2));if(md5Accounts[_0x292328][_0x4d8e('0x15')]!==_0x4cd0fd){md5Accounts[_0x292328][_0x4d8e('0x15')]=_0x4cd0fd;io[_0x4d8e('0xf')]('mailAccount:update',_0x3bb1d2);}};EmailChannel[_0x4d8e('0xe')]['refresh']=function(_0x19ffc0){for(var _0x5f4fe1 in _0x19ffc0){if(_0x19ffc0[_0x4d8e('0x16')](_0x5f4fe1)){if(_0x19ffc0[_0x5f4fe1][_0x4d8e('0x12')]&&_0x19ffc0[_0x5f4fe1][_0x4d8e('0x10')]){var _0x4506db=_0x19ffc0[_0x5f4fe1][_0x4d8e('0x12')];if(!_0x4506db[_0x4d8e('0x17')]&&_0x19ffc0[_0x5f4fe1][_0x4d8e('0x18')]!==_0x4d8e('0x19'))_0x4506db[_0x4d8e('0x17')]=_0x19ffc0[_0x5f4fe1][_0x4d8e('0x18')];if(!this[_0x4d8e('0xc')][_0x4d8e('0x16')](_0x4506db['id'])){this[_0x4d8e('0xc')][_0x4506db['id']]=new EmailImap(_0x4506db,_0x19ffc0[_0x5f4fe1][_0x4d8e('0x1a')]);this[_0x4d8e('0xc')][_0x4506db['id']]['on'](_0x4d8e('0x1b'),this['handleImapBox'][_0x4d8e('0x1c')](this,_0x5f4fe1));this[_0x4d8e('0xc')][_0x4506db['id']]['on'](_0x4d8e('0x1a'),this[_0x4d8e('0x1d')]['bind'](this,_0x5f4fe1));this[_0x4d8e('0xc')][_0x4506db['id']]['on'](_0x4d8e('0x1e'),this['handleImapEnd'][_0x4d8e('0x1c')](this,_0x5f4fe1));this['imapAccounts'][_0x4506db['id']]['on'](_0x4d8e('0x1f'),this[_0x4d8e('0x20')]['bind'](this,_0x5f4fe1));}}else{if(_[_0x4d8e('0x21')](this[_0x4d8e('0xb')][_0x5f4fe1][_0x4d8e('0x12')])){this[_0x4d8e('0xb')][_0x5f4fe1][_0x4d8e('0x12')]={};}this['mailAccounts'][_0x5f4fe1][_0x4d8e('0x12')][_0x4d8e('0x11')]=_0x4d8e('0x22');this[_0x4d8e('0xb')][_0x5f4fe1]['Imap'][_0x4d8e('0x13')]='';this[_0x4d8e('0xf')](_0x5f4fe1);}}}};EmailChannel[_0x4d8e('0xe')][_0x4d8e('0x23')]=function(_0x174829,_0x508f1c){if(this[_0x4d8e('0xb')][_0x174829]){this[_0x4d8e('0xb')][_0x174829][_0x4d8e('0x12')][_0x4d8e('0x11')]=_0x4d8e('0x24');this[_0x4d8e('0xb')][_0x174829][_0x4d8e('0x12')][_0x4d8e('0x13')]=_0x508f1c['name'];if(_0x508f1c[_0x4d8e('0x25')]){this[_0x4d8e('0xb')][_0x174829][_0x4d8e('0x12')][_0x4d8e('0x14')]=_0x508f1c[_0x4d8e('0x25')]['total'];}return this[_0x4d8e('0xf')](_0x174829);}};EmailChannel[_0x4d8e('0xe')][_0x4d8e('0x1d')]=function(_0x58eeb4,_0x463eab){logger[_0x4d8e('0xa')](_0x4d8e('0x26'),_0x463eab[_0x4d8e('0x27')],_0x463eab['lastName'],_0x463eab[_0x4d8e('0x28')],_0x58eeb4);if(this[_0x4d8e('0xb')][_0x58eeb4]){return mailAccount['notify'](_0x58eeb4,_0x463eab)[_0x4d8e('0x29')](function(_0x655661){if(_0x655661){logger['info']('Mail\x20accepted\x20from\x20routing');}})['catch'](function(_0x133fac){logger['error'](_0x4d8e('0x2a'),JSON[_0x4d8e('0x2b')](_0x133fac));});}};EmailChannel[_0x4d8e('0xe')][_0x4d8e('0x2c')]=function(_0x3e51fa){if(this[_0x4d8e('0xb')][_0x3e51fa]&&this[_0x4d8e('0xb')][_0x3e51fa]['Imap']){if(this[_0x4d8e('0xc')][this[_0x4d8e('0xb')][_0x3e51fa][_0x4d8e('0x12')]['id']]){delete this[_0x4d8e('0xc')][this[_0x4d8e('0xb')][_0x3e51fa][_0x4d8e('0x12')]['id']];}this[_0x4d8e('0xb')][_0x3e51fa][_0x4d8e('0x12')]['lastSync']=moment();this['emit'](_0x3e51fa);}};EmailChannel[_0x4d8e('0xe')][_0x4d8e('0x20')]=function(_0x5032c0,_0x1853ad){if(this[_0x4d8e('0xb')][_0x5032c0]){this[_0x4d8e('0xb')][_0x5032c0][_0x4d8e('0x12')][_0x4d8e('0x11')]=_0x4d8e('0x1f');this[_0x4d8e('0xb')][_0x5032c0][_0x4d8e('0x12')]['messageStatus']=_0x1853ad;return this['emit'](_0x5032c0);}};EmailChannel['prototype'][_0x4d8e('0x2d')]=function(_0x37e7f1,_0x49a81e){return this[_0x4d8e('0xd')][_0x4d8e('0x2e')](_0x37e7f1,_0x49a81e);};EmailChannel[_0x4d8e('0xe')][_0x4d8e('0x2f')]=function(_0x184e15){var _0x154e66=this;if(this[_0x4d8e('0xb')][_0x184e15['id']]){if(_[_0x4d8e('0x21')](this['mailAccounts'][_0x184e15['id']][_0x4d8e('0x30')])){this['mailAccounts'][_0x184e15['id']][_0x4d8e('0x30')]={};}this[_0x4d8e('0xb')][_0x184e15['id']][_0x4d8e('0x30')][_0x4d8e('0x31')]=moment();return new BPromise(function(_0x4d8bac,_0x347680){return _0x154e66[_0x4d8e('0xd')][_0x4d8e('0x32')](_0x184e15)[_0x4d8e('0x29')](function(_0x52202b){_0x154e66['mailAccounts'][_0x184e15['id']][_0x4d8e('0x30')][_0x4d8e('0x11')]=_0x4d8e('0x33');_0x154e66[_0x4d8e('0xb')][_0x184e15['id']][_0x4d8e('0x30')][_0x4d8e('0x13')]='';_0x154e66[_0x4d8e('0xf')](_0x184e15['id']);_0x4d8bac(_0x52202b);})['catch'](function(_0x4a50dd){_0x154e66[_0x4d8e('0xb')][_0x184e15['id']][_0x4d8e('0x30')][_0x4d8e('0x11')]=_0x4d8e('0x1f');_0x154e66[_0x4d8e('0xb')][_0x184e15['id']]['Smtp'][_0x4d8e('0x13')]=_0x4a50dd;_0x154e66[_0x4d8e('0xf')](_0x184e15['id']);_0x347680(_0x4a50dd);});});}return this[_0x4d8e('0xd')][_0x4d8e('0x32')](_0x184e15);};module[_0x4d8e('0x34')]=EmailChannel; \ No newline at end of file diff --git a/server/services/email/lib/imap.js b/server/services/email/lib/imap.js index 2a3f760..bae3508 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 _0x7904=['events','EventEmitter','../../../config/logger','email','account','getAccount','imap','once','bind','end','handleEnd','error','handleError','prototype','authTimeout','service','user','generateXOAuth2Token','CloudProvider','data5','password','authentication','anonymous@xcally.com','host','port','tls','autotls','required','handleReady','openBox','mailbox','handleOpenBox','emit','box','readUnseen','search','UNSEEN','handleReadUnseen','length','fetch','slice','message','handleFetchMessage','handleFetchError','handleFetchEnd','handleCloseBox','body','handleMessageBody','attributes','handleMessageAttributes','handleMessageEnd','handleSimpleParser','closeBox','stringify','textCode','hasOwnProperty','upperFirst','exports','util','mailparser','simpleParser','iconv'];(function(_0x4d9f07,_0x160102){var _0x5cba15=function(_0x23e266){while(--_0x23e266){_0x4d9f07['push'](_0x4d9f07['shift']());}};_0x5cba15(++_0x160102);}(_0x7904,0xf4));var _0x4790=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0x7904[_0x3dd15e];return _0x231fd0;};'use strict';var _=require('lodash');var util=require(_0x4790('0x0'));var Imap=require('imap');var simpleParser=require(_0x4790('0x1'))[_0x4790('0x2')];var Iconv=require(_0x4790('0x3'))['Iconv'];var EventEmitter=require(_0x4790('0x4'))[_0x4790('0x5')];var utils=require('./utils');var logger=require(_0x4790('0x6'))(_0x4790('0x7'));function EmailImap(_0x411234,_0xaa0661){this['mailbox']=_0x411234['mailbox'];this[_0x4790('0x8')]=this[_0x4790('0x9')](_0x411234,_0xaa0661);this['imap']=new Imap(this[_0x4790('0x8')]);this[_0x4790('0xa')][_0x4790('0xb')]('ready',this['handleReady'][_0x4790('0xc')](this));this[_0x4790('0xa')][_0x4790('0xb')](_0x4790('0xd'),this[_0x4790('0xe')][_0x4790('0xc')](this));this[_0x4790('0xa')]['on'](_0x4790('0xf'),this[_0x4790('0x10')][_0x4790('0xc')](this));this['imap']['connect']();}util['inherits'](EmailImap,EventEmitter);EmailImap[_0x4790('0x11')][_0x4790('0x9')]=function(_0x498c11,_0x1a007c){var _0x2161f8={'connTimeout':_0x498c11['connTimeout']?_0x498c11['connTimeout']*0x3e8:0x2710,'authTimeout':_0x498c11[_0x4790('0x12')]?_0x498c11[_0x4790('0x12')]*0x3e8:0x1388};if(_0x498c11[_0x4790('0x13')]){_0x2161f8[_0x4790('0x14')]=_0x498c11[_0x4790('0x14')];if(_0x498c11['modernAuthentication']){_0x2161f8['xoauth2']=utils[_0x4790('0x15')](_0x498c11[_0x4790('0x16')][_0x4790('0x17')],_0x498c11[_0x4790('0x14')]);}else{_0x2161f8[_0x4790('0x18')]=_0x498c11[_0x4790('0x18')];}}else{if(_0x498c11[_0x4790('0x19')]){_0x2161f8[_0x4790('0x14')]=_0x498c11[_0x4790('0x14')];_0x2161f8[_0x4790('0x18')]=_0x498c11['password'];}}_0x2161f8['email']=_0x1a007c||_0x498c11[_0x4790('0x14')]||_0x4790('0x1a');_0x2161f8['host']=_0x498c11[_0x4790('0x1b')];_0x2161f8['port']=_0x498c11[_0x4790('0x1c')]||0x3e1;if(_0x498c11[_0x4790('0x1d')]){_0x2161f8[_0x4790('0x1d')]=!![];}else{_0x2161f8[_0x4790('0x1d')]=![];_0x2161f8[_0x4790('0x1e')]=_0x4790('0x1f');}return _0x2161f8;};EmailImap[_0x4790('0x11')][_0x4790('0x20')]=function(){this['imap'][_0x4790('0x21')](this[_0x4790('0x22')],![],this[_0x4790('0x23')][_0x4790('0xc')](this));};EmailImap['prototype'][_0x4790('0x23')]=function(_0x4ec16a,_0xd295c4){if(_0x4ec16a){this['handleError'](_0x4ec16a,!![]);}else{this[_0x4790('0x24')](_0x4790('0x25'),_0xd295c4);this[_0x4790('0x26')]();}};EmailImap['prototype']['handleCloseBox']=function(_0x2ed840){if(_0x2ed840){this[_0x4790('0x10')](_0x2ed840,!![]);}else{this[_0x4790('0xa')][_0x4790('0xd')]();}};EmailImap['prototype'][_0x4790('0x26')]=function(){this[_0x4790('0xa')][_0x4790('0x27')]([_0x4790('0x28')],this[_0x4790('0x29')][_0x4790('0xc')](this));};EmailImap[_0x4790('0x11')]['handleReadUnseen']=function(_0x88990f,_0x40ecd4){if(_0x88990f){this[_0x4790('0x10')](_0x88990f,!![]);}else{if(_0x40ecd4[_0x4790('0x2a')]){try{var _0x400fc6=this[_0x4790('0xa')][_0x4790('0x2b')](_0x40ecd4[_0x4790('0x2c')](0x0,0xa),{'bodies':'','markSeen':!![]});_0x400fc6['on'](_0x4790('0x2d'),this[_0x4790('0x2e')]['bind'](this));_0x400fc6[_0x4790('0xb')]('error',this[_0x4790('0x2f')]['bind'](this));_0x400fc6[_0x4790('0xb')](_0x4790('0xd'),this[_0x4790('0x30')][_0x4790('0xc')](this));}catch(_0x5e711f){logger[_0x4790('0xf')](_0x5e711f);}}else{this['imap']['closeBox'](!![],this[_0x4790('0x31')][_0x4790('0xc')](this));}}};EmailImap[_0x4790('0x11')][_0x4790('0x2e')]=function(_0x5503cf){_0x5503cf['on'](_0x4790('0x32'),this[_0x4790('0x33')][_0x4790('0xc')](this));_0x5503cf[_0x4790('0xb')](_0x4790('0x34'),this[_0x4790('0x35')][_0x4790('0xc')](this));_0x5503cf[_0x4790('0xb')]('end',this[_0x4790('0x36')][_0x4790('0xc')](this));};EmailImap[_0x4790('0x11')]['handleMessageBody']=function(_0x594845){simpleParser(_0x594845,{'Iconv':Iconv},this[_0x4790('0x37')][_0x4790('0xc')](this));};EmailImap[_0x4790('0x11')][_0x4790('0x35')]=function(){};EmailImap[_0x4790('0x11')][_0x4790('0x36')]=function(){};EmailImap[_0x4790('0x11')][_0x4790('0x37')]=function(_0x40c9b0,_0x5cb65f){if(_0x40c9b0){logger[_0x4790('0xf')](_0x40c9b0);}else{var _0x2696e9=this;utils['parser'](this['account'],_0x5cb65f,function(_0x446850){_0x2696e9['emit'](_0x4790('0x7'),_0x446850);});}};EmailImap[_0x4790('0x11')][_0x4790('0x30')]=function(){this['imap'][_0x4790('0x38')](!![],this[_0x4790('0x31')][_0x4790('0xc')](this));};EmailImap[_0x4790('0x11')][_0x4790('0x2f')]=function(_0x5b77e9){this['handleError'](_0x5b77e9);this[_0x4790('0xa')][_0x4790('0x38')](!![],this[_0x4790('0x31')][_0x4790('0xc')](this));};EmailImap[_0x4790('0x11')][_0x4790('0xe')]=function(){this[_0x4790('0x24')](_0x4790('0xd'));};EmailImap[_0x4790('0x11')]['handleError']=function(_0x144aab,_0x521a8b){logger['error'](_0x4790('0x10'),this[_0x4790('0x8')][_0x4790('0x7')],JSON[_0x4790('0x39')](_0x144aab));var _0x54d187='';if(_0x144aab){if(_0x144aab[_0x4790('0x3a')]){_0x54d187=_0x144aab[_0x4790('0x3a')];}else{for(var _0x2975c3 in _0x144aab){if(_0x144aab[_0x4790('0x3b')](_0x2975c3)){_0x54d187+=_[_0x4790('0x3c')](_0x2975c3)+':\x20'+_0x144aab[_0x2975c3]+'\x0a';}}}}if(_0x521a8b){this[_0x4790('0xa')]['end']();}else{this[_0x4790('0x24')](_0x4790('0xf'),_0x54d187);this[_0x4790('0x24')](_0x4790('0xd'));}};module[_0x4790('0x3d')]=EmailImap; \ No newline at end of file +var _0x4000=['../../../config/logger','email','getAccount','imap','account','once','ready','bind','handleEnd','handleError','connect','prototype','connTimeout','authTimeout','service','user','modernAuthentication','xoauth2','generateXOAuth2Token','data5','password','anonymous@xcally.com','host','port','tls','autotls','required','mailbox','handleOpenBox','emit','box','readUnseen','handleCloseBox','end','search','UNSEEN','handleReadUnseen','fetch','slice','handleFetchMessage','error','handleFetchError','handleFetchEnd','closeBox','handleMessageBody','handleMessageAttributes','handleMessageEnd','handleSimpleParser','parser','textCode','exports','util','mailparser','simpleParser','events','EventEmitter'];(function(_0x387aa4,_0x34895e){var _0x51d5c2=function(_0x44e508){while(--_0x44e508){_0x387aa4['push'](_0x387aa4['shift']());}};_0x51d5c2(++_0x34895e);}(_0x4000,0x14b));var _0x0400=function(_0x45820c,_0x310e94){_0x45820c=_0x45820c-0x0;var _0x9ff4eb=_0x4000[_0x45820c];return _0x9ff4eb;};'use strict';var _=require('lodash');var util=require(_0x0400('0x0'));var Imap=require('imap');var simpleParser=require(_0x0400('0x1'))[_0x0400('0x2')];var Iconv=require('iconv')['Iconv'];var EventEmitter=require(_0x0400('0x3'))[_0x0400('0x4')];var utils=require('./utils');var logger=require(_0x0400('0x5'))(_0x0400('0x6'));function EmailImap(_0x495d89,_0x28a73b){this['mailbox']=_0x495d89['mailbox'];this['account']=this[_0x0400('0x7')](_0x495d89,_0x28a73b);this[_0x0400('0x8')]=new Imap(this[_0x0400('0x9')]);this[_0x0400('0x8')][_0x0400('0xa')](_0x0400('0xb'),this['handleReady'][_0x0400('0xc')](this));this[_0x0400('0x8')][_0x0400('0xa')]('end',this[_0x0400('0xd')][_0x0400('0xc')](this));this[_0x0400('0x8')]['on']('error',this[_0x0400('0xe')][_0x0400('0xc')](this));this['imap'][_0x0400('0xf')]();}util['inherits'](EmailImap,EventEmitter);EmailImap[_0x0400('0x10')]['getAccount']=function(_0x35d64b,_0x26b100){var _0x2c04f4={'connTimeout':_0x35d64b['connTimeout']?_0x35d64b[_0x0400('0x11')]*0x3e8:0x2710,'authTimeout':_0x35d64b[_0x0400('0x12')]?_0x35d64b['authTimeout']*0x3e8:0x1388};if(_0x35d64b[_0x0400('0x13')]){_0x2c04f4[_0x0400('0x14')]=_0x35d64b[_0x0400('0x14')];if(_0x35d64b[_0x0400('0x15')]){_0x2c04f4[_0x0400('0x16')]=utils[_0x0400('0x17')](_0x35d64b['CloudProvider'][_0x0400('0x18')],_0x35d64b['user']);}else{_0x2c04f4[_0x0400('0x19')]=_0x35d64b[_0x0400('0x19')];}}else{if(_0x35d64b['authentication']){_0x2c04f4[_0x0400('0x14')]=_0x35d64b[_0x0400('0x14')];_0x2c04f4[_0x0400('0x19')]=_0x35d64b[_0x0400('0x19')];}}_0x2c04f4[_0x0400('0x6')]=_0x26b100||_0x35d64b['user']||_0x0400('0x1a');_0x2c04f4[_0x0400('0x1b')]=_0x35d64b['host'];_0x2c04f4[_0x0400('0x1c')]=_0x35d64b[_0x0400('0x1c')]||0x3e1;if(_0x35d64b[_0x0400('0x1d')]){_0x2c04f4[_0x0400('0x1d')]=!![];}else{_0x2c04f4[_0x0400('0x1d')]=![];_0x2c04f4[_0x0400('0x1e')]=_0x0400('0x1f');}return _0x2c04f4;};EmailImap[_0x0400('0x10')]['handleReady']=function(){this[_0x0400('0x8')]['openBox'](this[_0x0400('0x20')],![],this[_0x0400('0x21')][_0x0400('0xc')](this));};EmailImap[_0x0400('0x10')][_0x0400('0x21')]=function(_0x4ac417,_0x3e4be0){if(_0x4ac417){this[_0x0400('0xe')](_0x4ac417,!![]);}else{this[_0x0400('0x22')](_0x0400('0x23'),_0x3e4be0);this[_0x0400('0x24')]();}};EmailImap[_0x0400('0x10')][_0x0400('0x25')]=function(_0x55b59f){if(_0x55b59f){this[_0x0400('0xe')](_0x55b59f,!![]);}else{this[_0x0400('0x8')][_0x0400('0x26')]();}};EmailImap['prototype']['readUnseen']=function(){this[_0x0400('0x8')][_0x0400('0x27')]([_0x0400('0x28')],this[_0x0400('0x29')][_0x0400('0xc')](this));};EmailImap[_0x0400('0x10')][_0x0400('0x29')]=function(_0x43232b,_0x181eb1){if(_0x43232b){this[_0x0400('0xe')](_0x43232b,!![]);}else{if(_0x181eb1['length']){try{var _0x1066eb=this[_0x0400('0x8')][_0x0400('0x2a')](_0x181eb1[_0x0400('0x2b')](0x0,0xa),{'bodies':'','markSeen':!![]});_0x1066eb['on']('message',this[_0x0400('0x2c')][_0x0400('0xc')](this));_0x1066eb[_0x0400('0xa')](_0x0400('0x2d'),this[_0x0400('0x2e')][_0x0400('0xc')](this));_0x1066eb['once'](_0x0400('0x26'),this[_0x0400('0x2f')][_0x0400('0xc')](this));}catch(_0x2d217a){logger[_0x0400('0x2d')](_0x2d217a);}}else{this[_0x0400('0x8')][_0x0400('0x30')](!![],this[_0x0400('0x25')][_0x0400('0xc')](this));}}};EmailImap[_0x0400('0x10')][_0x0400('0x2c')]=function(_0xb8fb9b){_0xb8fb9b['on']('body',this[_0x0400('0x31')][_0x0400('0xc')](this));_0xb8fb9b[_0x0400('0xa')]('attributes',this[_0x0400('0x32')][_0x0400('0xc')](this));_0xb8fb9b[_0x0400('0xa')](_0x0400('0x26'),this[_0x0400('0x33')][_0x0400('0xc')](this));};EmailImap[_0x0400('0x10')][_0x0400('0x31')]=function(_0x973e8e){simpleParser(_0x973e8e,{'Iconv':Iconv},this[_0x0400('0x34')][_0x0400('0xc')](this));};EmailImap[_0x0400('0x10')][_0x0400('0x32')]=function(){};EmailImap['prototype'][_0x0400('0x33')]=function(){};EmailImap[_0x0400('0x10')][_0x0400('0x34')]=function(_0x2db821,_0xd0e028){if(_0x2db821){logger['error'](_0x2db821);}else{var _0x343dc6=this;utils[_0x0400('0x35')](this[_0x0400('0x9')],_0xd0e028,function(_0x2f99a2){_0x343dc6[_0x0400('0x22')](_0x0400('0x6'),_0x2f99a2);});}};EmailImap[_0x0400('0x10')][_0x0400('0x2f')]=function(){this[_0x0400('0x8')][_0x0400('0x30')](!![],this['handleCloseBox'][_0x0400('0xc')](this));};EmailImap[_0x0400('0x10')][_0x0400('0x2e')]=function(_0x157aec){this['handleError'](_0x157aec);this[_0x0400('0x8')]['closeBox'](!![],this[_0x0400('0x25')][_0x0400('0xc')](this));};EmailImap[_0x0400('0x10')][_0x0400('0xd')]=function(){this['emit'](_0x0400('0x26'));};EmailImap[_0x0400('0x10')]['handleError']=function(_0x169e19,_0x4a9b5e){logger[_0x0400('0x2d')](_0x0400('0xe'),this[_0x0400('0x9')][_0x0400('0x6')],JSON['stringify'](_0x169e19));var _0x51f2a1='';if(_0x169e19){if(_0x169e19[_0x0400('0x36')]){_0x51f2a1=_0x169e19[_0x0400('0x36')];}else{for(var _0x14bdaa in _0x169e19){if(_0x169e19['hasOwnProperty'](_0x14bdaa)){_0x51f2a1+=_['upperFirst'](_0x14bdaa)+':\x20'+_0x169e19[_0x14bdaa]+'\x0a';}}}}if(_0x4a9b5e){this['imap']['end']();}else{this['emit'](_0x0400('0x2d'),_0x51f2a1);this[_0x0400('0x22')](_0x0400('0x26'));}};module[_0x0400('0x37')]=EmailImap; \ No newline at end of file diff --git a/server/services/email/lib/smtp.js b/server/services/email/lib/smtp.js index 725a2a4..31670b4 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 _0xf7d9=['prototype','send','createTransport','use','toString','verify','Not\x20verifired','nodemailer','nodemailer-plugin-inline-base64'];(function(_0x1cae17,_0x56b865){var _0x4cda99=function(_0x2c96fe){while(--_0x2c96fe){_0x1cae17['push'](_0x1cae17['shift']());}};_0x4cda99(++_0x56b865);}(_0xf7d9,0x10c));var _0x9f7d=function(_0x4aecb5,_0x1440a4){_0x4aecb5=_0x4aecb5-0x0;var _0x36df86=_0xf7d9[_0x4aecb5];return _0x36df86;};'use strict';var nodemailer=require(_0x9f7d('0x0'));var inlineBase64=require(_0x9f7d('0x1'));function EmailSmtp(){}EmailSmtp[_0x9f7d('0x2')][_0x9f7d('0x3')]=function(_0x315291,_0x2957f2){return new Promise(function(_0x36ca9f,_0x416228){var _0x5ca5c5=nodemailer[_0x9f7d('0x4')](_0x315291);_0x5ca5c5[_0x9f7d('0x5')]('compile',inlineBase64());_0x5ca5c5['sendMail'](_0x2957f2,function(_0x3369b8,_0x806655){if(_0x3369b8){_0x416228(_0x3369b8[_0x9f7d('0x6')]());}else{_0x36ca9f(_0x806655);}});});};EmailSmtp[_0x9f7d('0x2')]['verify']=function(_0x303f03){return new Promise(function(_0x577788,_0x160c76){var _0x2cf820=nodemailer[_0x9f7d('0x4')](_0x303f03);_0x2cf820[_0x9f7d('0x7')](function(_0x16075c,_0x4aa193){if(_0x16075c){_0x160c76(_0x16075c['toString']());}else{if(_0x4aa193){_0x577788(_0x4aa193);}else{_0x160c76(_0x9f7d('0x8'));}}});});};module['exports']=EmailSmtp; \ No newline at end of file +var _0x8a26=['nodemailer','nodemailer-plugin-inline-base64','prototype','createTransport','use','compile','verify','toString','exports'];(function(_0x3dd15e,_0x1f0015){var _0x231fd0=function(_0x4f680a){while(--_0x4f680a){_0x3dd15e['push'](_0x3dd15e['shift']());}};_0x231fd0(++_0x1f0015);}(_0x8a26,0x19e));var _0x68a2=function(_0x4ccbdb,_0x3441d1){_0x4ccbdb=_0x4ccbdb-0x0;var _0x12f8de=_0x8a26[_0x4ccbdb];return _0x12f8de;};'use strict';var nodemailer=require(_0x68a2('0x0'));var inlineBase64=require(_0x68a2('0x1'));function EmailSmtp(){}EmailSmtp[_0x68a2('0x2')]['send']=function(_0x49992f,_0x272761){return new Promise(function(_0x228cb5,_0x5538f6){var _0x13d553=nodemailer[_0x68a2('0x3')](_0x49992f);_0x13d553[_0x68a2('0x4')](_0x68a2('0x5'),inlineBase64());_0x13d553['sendMail'](_0x272761,function(_0x33631c,_0x33be86){if(_0x33631c){_0x5538f6(_0x33631c['toString']());}else{_0x228cb5(_0x33be86);}});});};EmailSmtp[_0x68a2('0x2')]['verify']=function(_0x2fe2a7){return new Promise(function(_0x51f78a,_0x4ac066){var _0x2edcd0=nodemailer[_0x68a2('0x3')](_0x2fe2a7);_0x2edcd0[_0x68a2('0x6')](function(_0x2b1afb,_0x161925){if(_0x2b1afb){_0x4ac066(_0x2b1afb[_0x68a2('0x7')]());}else{if(_0x161925){_0x51f78a(_0x161925);}else{_0x4ac066('Not\x20verifired');}}});});};module[_0x68a2('0x8')]=EmailSmtp; \ No newline at end of file diff --git a/server/services/email/lib/utils.js b/server/services/email/lib/utils.js index 348a4b1..1c064ea 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 _0x668c=['originTo','originCc','attachments','attach','filename','attachment-','%s-%s','now','root','server/files/attachments/','writeFileSync','content','contentType','headerLines','Auto-Submitted:\x20auto-replied','X-Auto-Response-Suppress:\x20All','Precedence:\x20auto_reply','line','isAutoreply','parser','from','messageId','inReplyTo','date','YYYY-MM-DD\x20HH:mm:ss','filter','info','format','Email\x20message\x20%s\x20is\x20in\x20TNEF\x20format:\x20message\x20content\x20will\x20be\x20converted\x20by\x20the\x20system','parseBuffer','first','BodyHTML','

Empty\x20message

','Attachments','Data','generateXOAuth2Token','user=','auth=Bearer\x20','toString','base64','lodash','moment','randomstring','util','node-tnef','email','head','address','anonymous','generate','@xcally.com','value','name','substring','indexOf','length','slice','join','Anonymous','pop','isEmpty','html','test','replace','includes','\x20[Attachment:\x20','\x20]','body','textAsHtml','0x1?_0x4bb789[_0xc668('0x10')](0x0,-0x1)[_0xc668('0x11')]('\x20'):_0x29874f[_0xc668('0xc')];}return _0xc668('0x12');}function getLastName(_0x44cd8e){var _0x5a9217=_[_0xc668('0x6')](_0x44cd8e[_0xc668('0xb')]);if(_0x5a9217&&_0x5a9217[_0xc668('0xc')]){var _0x37dd54=_0x5a9217['name']['split'](/\s+/);return _0x37dd54[_0xc668('0xf')]>0x1?_0x37dd54[_0xc668('0x13')]():'';}return'';}function getMails(_0x1d6846,_0x22c516){var _0x56a91e='';for(var _0x42d393=0x0;_0x42d393<_0x22c516['value'][_0xc668('0xf')];_0x42d393+=0x1){if(_0x22c516[_0xc668('0xb')][_0x42d393][_0xc668('0x7')]!==_0x1d6846){if(!_[_0xc668('0x14')](_0x56a91e)){_0x56a91e+=',';}_0x56a91e+=_0x22c516[_0xc668('0xb')][_0x42d393]['name']||_0x22c516[_0xc668('0xb')][_0x42d393]['address']||'';_0x56a91e+='\x20<';_0x56a91e+=_0x22c516[_0xc668('0xb')][_0x42d393]['address']?_0x22c516['value'][_0x42d393][_0xc668('0x7')]:_0xc668('0x8')+random[_0xc668('0x9')](0x6)+_0xc668('0xa');_0x56a91e+='>';}}return _0x56a91e;}function parseEmail(_0x44866f,_0x49459d,_0x189fc7){if(_0x49459d[_0xc668('0x15')]){var _0x2df966=/)<[^<]*)*<\/script>/gi;while(_0x2df966[_0xc668('0x16')](_0x49459d[_0xc668('0x15')])){_0x49459d['html']=_0x49459d[_0xc668('0x15')][_0xc668('0x17')](_0x2df966,'');}if(_0x49459d[_0xc668('0x15')][_0xc668('0x18')](_0xc668('0x19'))){var _0x322a7c=[];_0x49459d['attachments'][_0xc668('0x1a')](_0x1b6128=>{_0x322a7c[_0xc668('0x1b')](_0x1b6128['filename']);});var _0x5c0447=/]+>/g;var _0x3994d2=/src="data:image\/([a-zA-Z]*);base64,([^"]*)"/g;var _0x23d904=_0x49459d[_0xc668('0x15')][_0xc668('0x17')](_0x3994d2,_0xc668('0x1c'));var _0x4be5e9=_0x23d904['replace'](_0x5c0447,_0xc668('0x1d'));for(let _0x3e5151=0x0;_0x3e5151<_0x322a7c[_0xc668('0xf')];_0x3e5151++){var _0x599fc7=_0x4be5e9[_0xc668('0x17')]('_IMG',_0xc668('0x1e')+_0x322a7c[_0x3e5151]+_0xc668('0x1f'));_0x4be5e9=_0x599fc7;}_0x49459d[_0xc668('0x15')]=_0x4be5e9;}_0x189fc7[_0xc668('0x20')]=_0x49459d[_0xc668('0x15')];}else{_0x189fc7[_0xc668('0x20')]=_0x49459d[_0xc668('0x21')];}if(_0x189fc7['body']){_0x189fc7[_0xc668('0x20')]=_0x189fc7['body'][_0xc668('0x17')](/0x0){var _0x3d3d6a=[_0xc668('0x32'),_0xc668('0x33'),_0xc668('0x34')];for(var _0x462e0b=0x0;_0x462e0b<_0x49459d[_0xc668('0x31')][_0xc668('0xf')];_0x462e0b++){var _0x4a7915=_[_0xc668('0xe')](_0x3d3d6a,_0x49459d[_0xc668('0x31')][_0x462e0b][_0xc668('0x35')]);if(_0x4a7915>=0x0){_0x189fc7[_0xc668('0x36')]=!![];}}}return _0x189fc7;}exports[_0xc668('0x37')]=function(_0x9c42bd,_0x4fc255,_0x293271){var _0x4c7bef={'from':getAddress(_0x4fc255[_0xc668('0x38')]),'firstName':getFirstName(_0x4fc255[_0xc668('0x38')]),'lastName':getLastName(_0x4fc255[_0xc668('0x38')]),'mapKey':_0xc668('0x5'),'message':{'from':getMails(_0x9c42bd[_0xc668('0x5')],_0x4fc255[_0xc668('0x38')]),'to':_0x9c42bd[_0xc668('0x5')],'cc':'','subject':_0x4fc255['subject']||'','messageId':_0x4fc255[_0xc668('0x39')],'inReplyTo':_0x4fc255[_0xc668('0x3a')],'sentAt':moment(_0x4fc255[_0xc668('0x3b')])['format'](_0xc668('0x3c')),'attach':![],'attachments':[]}};if(!_0x4fc255[_0xc668('0x15')]&&!_0x4fc255[_0xc668('0x21')]){var _0x3dac78=_[_0xc668('0x3d')](_0x4fc255[_0xc668('0x26')],{'contentType':'application/ms-tnef'});if(_0x3dac78['length']){logger[_0xc668('0x3e')](util[_0xc668('0x3f')](_0xc668('0x40'),_0x4fc255[_0xc668('0x39')]));tnef[_0xc668('0x41')](_[_0xc668('0x42')](_0x3dac78)['content'],function(_0x457b54,_0x13f73a){if(_0x13f73a){_0x4fc255['html']=_0x13f73a[_0xc668('0x43')]||_0xc668('0x44');if(_0x13f73a[_0xc668('0x45')]){for(var _0xc68508=0x0;_0xc68508<_0x13f73a['Attachments']['length'];_0xc68508++){var _0x2a09d2=_0x13f73a[_0xc668('0x45')][_0xc68508];_0x4c7bef[_0xc668('0x23')][_0xc668('0x26')][_0xc668('0x1b')]({'filename':_0x2a09d2['Title'],'content':Buffer[_0xc668('0x38')](_0x2a09d2[_0xc668('0x46')])});}}}_0x293271(parseEmail(_0x9c42bd,_0x4fc255,_0x4c7bef));});}else{_0x4fc255['html']=_0xc668('0x44');_0x293271(parseEmail(_0x9c42bd,_0x4fc255,_0x4c7bef));}}else{_0x293271(parseEmail(_0x9c42bd,_0x4fc255,_0x4c7bef));}};exports[_0xc668('0x47')]=function(_0x461eac,_0x3b8867){var _0x5eb411=[_0xc668('0x48')+(_0x3b8867||''),_0xc668('0x49')+_0x461eac,'',''];return Buffer[_0xc668('0x38')](_0x5eb411[_0xc668('0x11')](''),'utf-8')[_0xc668('0x4a')](_0xc668('0x4b'));}; \ No newline at end of file +var _0xa9d6=['format','%s-%s','root','writeFileSync','content','contentType','headerLines','Auto-Submitted:\x20auto-replied','X-Auto-Response-Suppress:\x20All','line','isAutoreply','parser','from','subject','messageId','date','YYYY-MM-DD\x20HH:mm:ss','info','parseBuffer','first','Attachments','push','

Empty\x20message

','user=','utf-8','toString','lodash','moment','randomstring','path','util','../../../config/logger','../../../config/environment','head','value','address','anonymous','@xcally.com','name','substring','indexOf','split','length','slice','join','pop','isEmpty','generate','html','replace','includes','attachments','forEach','_IMG','\x20[Attachment:\x20','\x20]','body','textAsHtml','0x1?_0x31884d[_0x6a9d('0x11')](0x0,-0x1)[_0x6a9d('0x12')]('\x20'):_0x444931[_0x6a9d('0xc')];}return'Anonymous';}function getLastName(_0xdc77c1){var _0x364cf6=_[_0x6a9d('0x7')](_0xdc77c1[_0x6a9d('0x8')]);if(_0x364cf6&&_0x364cf6[_0x6a9d('0xc')]){var _0x57f2be=_0x364cf6[_0x6a9d('0xc')]['split'](/\s+/);return _0x57f2be['length']>0x1?_0x57f2be[_0x6a9d('0x13')]():'';}return'';}function getMails(_0x583df0,_0x29a0de){var _0x52f5ba='';for(var _0x2dcbcd=0x0;_0x2dcbcd<_0x29a0de[_0x6a9d('0x8')][_0x6a9d('0x10')];_0x2dcbcd+=0x1){if(_0x29a0de[_0x6a9d('0x8')][_0x2dcbcd][_0x6a9d('0x9')]!==_0x583df0){if(!_[_0x6a9d('0x14')](_0x52f5ba)){_0x52f5ba+=',';}_0x52f5ba+=_0x29a0de[_0x6a9d('0x8')][_0x2dcbcd][_0x6a9d('0xc')]||_0x29a0de[_0x6a9d('0x8')][_0x2dcbcd][_0x6a9d('0x9')]||'';_0x52f5ba+='\x20<';_0x52f5ba+=_0x29a0de['value'][_0x2dcbcd][_0x6a9d('0x9')]?_0x29a0de['value'][_0x2dcbcd]['address']:_0x6a9d('0xa')+random[_0x6a9d('0x15')](0x6)+_0x6a9d('0xb');_0x52f5ba+='>';}}return _0x52f5ba;}function parseEmail(_0x592221,_0x53f50c,_0x278f64){if(_0x53f50c[_0x6a9d('0x16')]){var _0x10db32=/)<[^<]*)*<\/script>/gi;while(_0x10db32['test'](_0x53f50c[_0x6a9d('0x16')])){_0x53f50c[_0x6a9d('0x16')]=_0x53f50c[_0x6a9d('0x16')][_0x6a9d('0x17')](_0x10db32,'');}if(_0x53f50c[_0x6a9d('0x16')][_0x6a9d('0x18')]('{_0xad25d4['push'](_0x26d4f3['filename']);});var _0x5b96a4=/]+>/g;var _0x59e525=/src="data:image\/([a-zA-Z]*);base64,([^"]*)"/g;var _0x5d800f=_0x53f50c['html'][_0x6a9d('0x17')](_0x59e525,'_SRC');var _0x433be4=_0x5d800f[_0x6a9d('0x17')](_0x5b96a4,_0x6a9d('0x1b'));for(let _0x50bfea=0x0;_0x50bfea<_0xad25d4['length'];_0x50bfea++){var _0x47e180=_0x433be4[_0x6a9d('0x17')]('_IMG',_0x6a9d('0x1c')+_0xad25d4[_0x50bfea]+_0x6a9d('0x1d'));_0x433be4=_0x47e180;}_0x53f50c['html']=_0x433be4;}_0x278f64['body']=_0x53f50c[_0x6a9d('0x16')];}else{_0x278f64[_0x6a9d('0x1e')]=_0x53f50c[_0x6a9d('0x1f')];}if(_0x278f64[_0x6a9d('0x1e')]){_0x278f64[_0x6a9d('0x1e')]=_0x278f64['body'][_0x6a9d('0x17')](/0x0){var _0x554374=[_0x6a9d('0x30'),_0x6a9d('0x31'),'Precedence:\x20auto_reply'];for(var _0x1bae6e=0x0;_0x1bae6e<_0x53f50c[_0x6a9d('0x2f')][_0x6a9d('0x10')];_0x1bae6e++){var _0x308fb8=_[_0x6a9d('0xe')](_0x554374,_0x53f50c[_0x6a9d('0x2f')][_0x1bae6e][_0x6a9d('0x32')]);if(_0x308fb8>=0x0){_0x278f64[_0x6a9d('0x33')]=!![];}}}return _0x278f64;}exports[_0x6a9d('0x34')]=function(_0x4dbbaa,_0x4907c0,_0x9caa66){var _0x481ee2={'from':getAddress(_0x4907c0['from']),'firstName':getFirstName(_0x4907c0[_0x6a9d('0x35')]),'lastName':getLastName(_0x4907c0[_0x6a9d('0x35')]),'mapKey':_0x6a9d('0x23'),'message':{'from':getMails(_0x4dbbaa[_0x6a9d('0x23')],_0x4907c0['from']),'to':_0x4dbbaa[_0x6a9d('0x23')],'cc':'','subject':_0x4907c0[_0x6a9d('0x36')]||'','messageId':_0x4907c0[_0x6a9d('0x37')],'inReplyTo':_0x4907c0['inReplyTo'],'sentAt':moment(_0x4907c0[_0x6a9d('0x38')])[_0x6a9d('0x29')](_0x6a9d('0x39')),'attach':![],'attachments':[]}};if(!_0x4907c0[_0x6a9d('0x16')]&&!_0x4907c0[_0x6a9d('0x1f')]){var _0x4050e8=_['filter'](_0x4907c0[_0x6a9d('0x19')],{'contentType':'application/ms-tnef'});if(_0x4050e8[_0x6a9d('0x10')]){logger[_0x6a9d('0x3a')](util[_0x6a9d('0x29')]('Email\x20message\x20%s\x20is\x20in\x20TNEF\x20format:\x20message\x20content\x20will\x20be\x20converted\x20by\x20the\x20system',_0x4907c0[_0x6a9d('0x37')]));tnef[_0x6a9d('0x3b')](_[_0x6a9d('0x3c')](_0x4050e8)['content'],function(_0x27d0b6,_0x305a40){if(_0x305a40){_0x4907c0[_0x6a9d('0x16')]=_0x305a40['BodyHTML']||'

Empty\x20message

';if(_0x305a40[_0x6a9d('0x3d')]){for(var _0x5a8ce0=0x0;_0x5a8ce0<_0x305a40[_0x6a9d('0x3d')]['length'];_0x5a8ce0++){var _0x281e1a=_0x305a40['Attachments'][_0x5a8ce0];_0x481ee2[_0x6a9d('0x21')]['attachments'][_0x6a9d('0x3e')]({'filename':_0x281e1a['Title'],'content':Buffer[_0x6a9d('0x35')](_0x281e1a['Data'])});}}}_0x9caa66(parseEmail(_0x4dbbaa,_0x4907c0,_0x481ee2));});}else{_0x4907c0['html']=_0x6a9d('0x3f');_0x9caa66(parseEmail(_0x4dbbaa,_0x4907c0,_0x481ee2));}}else{_0x9caa66(parseEmail(_0x4dbbaa,_0x4907c0,_0x481ee2));}};exports['generateXOAuth2Token']=function(_0x121e9c,_0x104639){var _0x37e604=[_0x6a9d('0x40')+(_0x104639||''),'auth=Bearer\x20'+_0x121e9c,'',''];return Buffer['from'](_0x37e604[_0x6a9d('0x12')](''),_0x6a9d('0x41'))[_0x6a9d('0x42')]('base64');}; \ No newline at end of file diff --git a/server/services/email/model/mailAccount.js b/server/services/email/model/mailAccount.js index c475b73..087bc12 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 _0xd172=['Smtp','lodash','name','Service','key','SERV','active','Imap'];(function(_0x34795b,_0x4bc04b){var _0x43e24e=function(_0x54c307){while(--_0x54c307){_0x34795b['push'](_0x34795b['shift']());}};_0x43e24e(++_0x4bc04b);}(_0xd172,0xa9));var _0x2d17=function(_0x3645f5,_0x5b0ccf){_0x3645f5=_0x3645f5-0x0;var _0x471ccd=_0xd172[_0x3645f5];return _0x471ccd;};'use strict';var _=require(_0x2d17('0x0'));function MailAccount(_0x5c57c1){this['id']=_0x5c57c1['id']||0x0;this[_0x2d17('0x1')]=_0x5c57c1[_0x2d17('0x1')]||_0x2d17('0x2');this[_0x2d17('0x3')]=_0x5c57c1[_0x2d17('0x3')]||_0x2d17('0x4');this[_0x2d17('0x5')]=_0x5c57c1[_0x2d17('0x5')]||![];this[_0x2d17('0x6')]=_0x5c57c1[_0x2d17('0x6')]||[];this['Smtp']=_0x5c57c1[_0x2d17('0x7')]||[];}module['exports']=MailAccount; \ No newline at end of file +var _0x9569=['name','Service','key','SERV','active','Smtp','exports','lodash'];(function(_0x573c94,_0x5780c9){var _0x252204=function(_0x1a8874){while(--_0x1a8874){_0x573c94['push'](_0x573c94['shift']());}};_0x252204(++_0x5780c9);}(_0x9569,0x1af));var _0x9956=function(_0x287b26,_0x21b80b){_0x287b26=_0x287b26-0x0;var _0x58568e=_0x9569[_0x287b26];return _0x58568e;};'use strict';var _=require(_0x9956('0x0'));function MailAccount(_0x14d529){this['id']=_0x14d529['id']||0x0;this['name']=_0x14d529[_0x9956('0x1')]||_0x9956('0x2');this[_0x9956('0x3')]=_0x14d529[_0x9956('0x3')]||_0x9956('0x4');this[_0x9956('0x5')]=_0x14d529[_0x9956('0x5')]||![];this['Imap']=_0x14d529['Imap']||[];this[_0x9956('0x6')]=_0x14d529[_0x9956('0x6')]||[];}module[_0x9956('0x7')]=MailAccount; \ No newline at end of file diff --git a/server/services/email/realtime/index.js b/server/services/email/realtime/index.js index c3d8ec6..2fd746e 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 _0x8528=['mergeFromDatabase','length','isUndefined','merge','exports','mailAccounts','mapKeys','hasOwnProperty'];(function(_0x473582,_0x139c3c){var _0x48feb7=function(_0x5cfa3c){while(--_0x5cfa3c){_0x473582['push'](_0x473582['shift']());}};_0x48feb7(++_0x139c3c);}(_0x8528,0xcd));var _0x8852=function(_0x27657c,_0x4e6753){_0x27657c=_0x27657c-0x0;var _0x1e6242=_0x8528[_0x27657c];return _0x1e6242;};'use strict';var _=require('lodash');var MailAccount=require('../model/mailAccount');var Realtime=function(){this[_0x8852('0x0')]={};};function freeIsNotKey(_0x30fabd,_0x21f0c1,_0x4cfb3b){var _0x3c7c0c=_[_0x8852('0x1')](_0x30fabd,function(_0x4bbe95,_0x3dffeb){return _0x4bbe95[_0x4cfb3b];});for(var _0x11334b in _0x21f0c1){if(_0x21f0c1[_0x8852('0x2')](_0x11334b)){if(!_0x3c7c0c[_0x11334b]){delete _0x21f0c1[_0x11334b];}}}}Realtime['prototype'][_0x8852('0x3')]=function(_0x2e46bd,_0x2847f2){for(var _0xe7f87b in _0x2847f2){if(_0x2e46bd[_0x8852('0x2')](_0xe7f87b)){_0x2e46bd[_0xe7f87b]=_0x2847f2[_0xe7f87b];}}};Realtime['prototype']['initMailAccounts']=function(){var _0xb3706c=this;return function(_0x43bb3f){if(_0x43bb3f){freeIsNotKey(_0x43bb3f,_0xb3706c[_0x8852('0x0')],'id');for(var _0x482e54=0x0,_0x3a8621={},_0x50bed2={};_0x482e54<_0x43bb3f[_0x8852('0x4')];_0x482e54+=0x1){_0x3a8621=_0x43bb3f[_0x482e54];if(_[_0x8852('0x5')](_0xb3706c[_0x8852('0x0')][_0x3a8621['id']])){_0xb3706c[_0x8852('0x0')][_0x3a8621['id']]=new MailAccount(_0x3a8621);}else{_[_0x8852('0x6')](_0xb3706c[_0x8852('0x0')][_0x3a8621['id']],_0x3a8621);}}}return _0xb3706c[_0x8852('0x0')];};};module[_0x8852('0x7')]=Realtime; \ No newline at end of file +var _0x83f6=['mapKeys','hasOwnProperty','prototype','initMailAccounts','length','isUndefined','exports','lodash','../model/mailAccount','mailAccounts'];(function(_0x4cf0c0,_0x5a141c){var _0x1dfa59=function(_0x6f3037){while(--_0x6f3037){_0x4cf0c0['push'](_0x4cf0c0['shift']());}};_0x1dfa59(++_0x5a141c);}(_0x83f6,0x1dd));var _0x683f=function(_0x3ce3c,_0x319337){_0x3ce3c=_0x3ce3c-0x0;var _0x55a2c9=_0x83f6[_0x3ce3c];return _0x55a2c9;};'use strict';var _=require(_0x683f('0x0'));var MailAccount=require(_0x683f('0x1'));var Realtime=function(){this[_0x683f('0x2')]={};};function freeIsNotKey(_0x5100d6,_0x3e61f5,_0x3b83a7){var _0x6ccab=_[_0x683f('0x3')](_0x5100d6,function(_0x14a988,_0x5ccb79){return _0x14a988[_0x3b83a7];});for(var _0x428578 in _0x3e61f5){if(_0x3e61f5[_0x683f('0x4')](_0x428578)){if(!_0x6ccab[_0x428578]){delete _0x3e61f5[_0x428578];}}}}Realtime[_0x683f('0x5')]['mergeFromDatabase']=function(_0x32a955,_0x5f4ff0){for(var _0x815ad in _0x5f4ff0){if(_0x32a955[_0x683f('0x4')](_0x815ad)){_0x32a955[_0x815ad]=_0x5f4ff0[_0x815ad];}}};Realtime[_0x683f('0x5')][_0x683f('0x6')]=function(){var _0x1ee431=this;return function(_0x50169e){if(_0x50169e){freeIsNotKey(_0x50169e,_0x1ee431[_0x683f('0x2')],'id');for(var _0x2d9a7f=0x0,_0x12ad0f={},_0x2151a9={};_0x2d9a7f<_0x50169e[_0x683f('0x7')];_0x2d9a7f+=0x1){_0x12ad0f=_0x50169e[_0x2d9a7f];if(_[_0x683f('0x8')](_0x1ee431[_0x683f('0x2')][_0x12ad0f['id']])){_0x1ee431[_0x683f('0x2')][_0x12ad0f['id']]=new MailAccount(_0x12ad0f);}else{_['merge'](_0x1ee431[_0x683f('0x2')][_0x12ad0f['id']],_0x12ad0f);}}}return _0x1ee431['mailAccounts'];};};module[_0x683f('0x9')]=Realtime; \ No newline at end of file diff --git a/server/services/email/rpc/mailAccount.js b/server/services/email/rpc/mailAccount.js index b4c0341..18f8968 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 _0xcde7=['MailServerIn','Imap','CloudProvider','service','data5','MailServerOut','Smtp','type','getMailAccount','notify','NotifyMailAccount','Request','GetMailAccount','name','email','key','ListId','TemplateId'];(function(_0x65a0db,_0x55c5a0){var _0x987620=function(_0x23d53f){while(--_0x23d53f){_0x65a0db['push'](_0x65a0db['shift']());}};_0x987620(++_0x55c5a0);}(_0xcde7,0x65));var _0x7cde=function(_0x5d6456,_0x58ecc7){_0x5d6456=_0x5d6456-0x0;var _0x4d66c1=_0xcde7[_0x5d6456];return _0x4d66c1;};'use strict';var client=require('../client');exports['getMailAccounts']=function(){return function(){return client[_0x7cde('0x0')](_0x7cde('0x1'),{'options':{'attributes':['id',_0x7cde('0x2'),'provider','service',_0x7cde('0x3'),'active',_0x7cde('0x4'),_0x7cde('0x5'),_0x7cde('0x6')],'raw':![],'include':[{'model':_0x7cde('0x7'),'as':_0x7cde('0x8'),'include':[{'model':_0x7cde('0x9'),'attributes':['id','name',_0x7cde('0xa'),'type',_0x7cde('0xb')],'as':_0x7cde('0x9')}]},{'model':_0x7cde('0xc'),'as':_0x7cde('0xd'),'include':[{'model':'CloudProvider','attributes':['id',_0x7cde('0x2'),_0x7cde('0xa'),_0x7cde('0xe'),_0x7cde('0xb')],'as':_0x7cde('0x9')}]}]},'log':_0x7cde('0xf')});};};exports[_0x7cde('0x10')]=function(_0x29a5f3,_0xbc825c){return client[_0x7cde('0x0')]('NotifyMailAccount',{'account':{'id':_0x29a5f3},'body':_0xbc825c,'log':_0x7cde('0x11')});}; \ No newline at end of file +var _0x3d41=['provider','active','key','TemplateId','MailServerIn','Imap','CloudProvider','service','type','data5','getMailAccount','notify','NotifyMailAccount','getMailAccounts','Request','GetMailAccount','name'];(function(_0x5b1003,_0x4bfeb9){var _0x4a3ca8=function(_0x4f5bde){while(--_0x4f5bde){_0x5b1003['push'](_0x5b1003['shift']());}};_0x4a3ca8(++_0x4bfeb9);}(_0x3d41,0xea));var _0x13d4=function(_0x59162a,_0x10e547){_0x59162a=_0x59162a-0x0;var _0x35e50d=_0x3d41[_0x59162a];return _0x35e50d;};'use strict';var client=require('../client');exports[_0x13d4('0x0')]=function(){return function(){return client[_0x13d4('0x1')](_0x13d4('0x2'),{'options':{'attributes':['id',_0x13d4('0x3'),_0x13d4('0x4'),'service','email',_0x13d4('0x5'),_0x13d4('0x6'),'ListId',_0x13d4('0x7')],'raw':![],'include':[{'model':_0x13d4('0x8'),'as':_0x13d4('0x9'),'include':[{'model':_0x13d4('0xa'),'attributes':['id',_0x13d4('0x3'),_0x13d4('0xb'),_0x13d4('0xc'),'data5'],'as':_0x13d4('0xa')}]},{'model':'MailServerOut','as':'Smtp','include':[{'model':_0x13d4('0xa'),'attributes':['id',_0x13d4('0x3'),'service',_0x13d4('0xc'),_0x13d4('0xd')],'as':'CloudProvider'}]}]},'log':_0x13d4('0xe')});};};exports[_0x13d4('0xf')]=function(_0x1b7aec,_0x288a24){return client['Request'](_0x13d4('0x10'),{'account':{'id':_0x1b7aec},'body':_0x288a24,'log':_0x13d4('0x10')});}; \ No newline at end of file diff --git a/server/services/email/rpc/setting.js b/server/services/email/rpc/setting.js index fe235cc..fb51224 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 _0x79ba=['GetSettings','../client','getSettings','ShowSetting'];(function(_0x20b13b,_0x5f0e97){var _0x104731=function(_0x2b6902){while(--_0x2b6902){_0x20b13b['push'](_0x20b13b['shift']());}};_0x104731(++_0x5f0e97);}(_0x79ba,0xc9));var _0xa79b=function(_0x292600,_0x120a55){_0x292600=_0x292600-0x0;var _0x2ef83b=_0x79ba[_0x292600];return _0x2ef83b;};'use strict';var client=require(_0xa79b('0x0'));exports[_0xa79b('0x1')]=function(){return client['Request'](_0xa79b('0x2'),{'options':{'raw':!![],'where':{'id':0x1},'attributes':['loginMailFrequency']},'log':_0xa79b('0x3')});}; \ No newline at end of file +var _0xfe46=['Request','ShowSetting','loginMailFrequency','getSettings'];(function(_0x43cd34,_0xd3307e){var _0x42f03e=function(_0x595970){while(--_0x595970){_0x43cd34['push'](_0x43cd34['shift']());}};_0x42f03e(++_0xd3307e);}(_0xfe46,0x1b7));var _0x6fe4=function(_0x3c8fa1,_0x1c9f3b){_0x3c8fa1=_0x3c8fa1-0x0;var _0x778bdb=_0xfe46[_0x3c8fa1];return _0x778bdb;};'use strict';var client=require('../client');exports[_0x6fe4('0x0')]=function(){return client[_0x6fe4('0x1')](_0x6fe4('0x2'),{'options':{'raw':!![],'where':{'id':0x1},'attributes':[_0x6fe4('0x3')]},'log':'GetSettings'});}; \ No newline at end of file diff --git a/server/services/email/server/index.js b/server/services/email/server/index.js index 7b88545..9818ed4 100644 --- a/server/services/email/server/index.js +++ b/server/services/email/server/index.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0xa9e0=['catch','values','mailAccounts','length','Imap','password','Smtp','pass','server','http','stringify','127.0.0.1','log','Email\x20RPC\x20server\x20listening\x20on\x20127.0.0.1:%d!','RPC\x20listening\x20on\x20port:','jayson/promise','bluebird','lodash','listen','sendMail','then','error','Verified'];(function(_0x59ee6f,_0x450239){var _0x4c0979=function(_0x565e92){while(--_0x565e92){_0x59ee6f['push'](_0x59ee6f['shift']());}};_0x4c0979(++_0x450239);}(_0xa9e0,0x123));var _0x0a9e=function(_0x5b561d,_0x422b7c){_0x5b561d=_0x5b561d-0x0;var _0x431060=_0xa9e0[_0x5b561d];return _0x431060;};'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(_0x40a045,_0x516f0e){var _0x1a687c=function(_0x48c9fe){while(--_0x48c9fe){_0x40a045['push'](_0x40a045['shift']());}};_0x1a687c(++_0x516f0e);}(_0xa9e0,0x123));var _0x0a9e=function(_0x2a6809,_0x44edde){_0x2a6809=_0x2a6809-0x0;var _0x11c371=_0xa9e0[_0x2a6809];return _0x11c371;};'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 67a817a..721351b 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 _0x3e55=['Express\x20server\x20listening\x20on\x20port\x20%d!','lodash','http','express','sticky-session','ioredis','../../config/environment','timeout','listen','port','socket.io','websocket','polling','redis','defaults','localhost','adapter','socket.io-redis','../../config/triggers','../../config/socketio','default','../../config/express','../../routes','listening'];(function(_0xf4ce00,_0x578006){var _0x3e55d2=function(_0xee3efe){while(--_0xee3efe){_0xf4ce00['push'](_0xf4ce00['shift']());}};_0x3e55d2(++_0x578006);}(_0x3e55,0xd9));var _0x53e5=function(_0x152866,_0x2bd0f9){_0x152866=_0x152866-0x0;var _0x1d2efe=_0x3e55[_0x152866];return _0x1d2efe;};'use strict';var _=require(_0x53e5('0x0'));var http=require(_0x53e5('0x1'));var express=require(_0x53e5('0x2'));var sticky=require(_0x53e5('0x3'));var Redis=require(_0x53e5('0x4'));var config=require(_0x53e5('0x5'));var app=express();var server=http['createServer'](app);server[_0x53e5('0x6')]=0xdbba0;if(sticky[_0x53e5('0x7')](server,config[_0x53e5('0x8')])){var socketio=require(_0x53e5('0x9'))(server,{'transports':[_0x53e5('0xa'),_0x53e5('0xb')]});config[_0x53e5('0xc')]=_[_0x53e5('0xd')](config[_0x53e5('0xc')],{'host':_0x53e5('0xe'),'port':0x18eb});socketio[_0x53e5('0xf')](require(_0x53e5('0x10'))({'pubClient':new Redis(config[_0x53e5('0xc')]),'subClient':new Redis(config[_0x53e5('0xc')])}));require(_0x53e5('0x11'))['default']();require(_0x53e5('0x12'))[_0x53e5('0x13')](socketio);require(_0x53e5('0x14'))['default'](app);require(_0x53e5('0x15'))[_0x53e5('0x13')](app);}else{server['once'](_0x53e5('0x16'),function(){console['log'](_0x53e5('0x17'),config[_0x53e5('0x8')]);});}exports=module['exports']=app; \ No newline at end of file +var _0xe1c5=['http','sticky-session','ioredis','../../config/environment','createServer','listen','port','socket.io','polling','redis','defaults','adapter','socket.io-redis','default','once','listening','Express\x20server\x20listening\x20on\x20port\x20%d!','lodash'];(function(_0x36841b,_0x5a1ba2){var _0x348f85=function(_0x1eb1b7){while(--_0x1eb1b7){_0x36841b['push'](_0x36841b['shift']());}};_0x348f85(++_0x5a1ba2);}(_0xe1c5,0x19d));var _0x5e1c=function(_0x4e835f,_0x2a9dab){_0x4e835f=_0x4e835f-0x0;var _0x45329d=_0xe1c5[_0x4e835f];return _0x45329d;};'use strict';var _=require(_0x5e1c('0x0'));var http=require(_0x5e1c('0x1'));var express=require('express');var sticky=require(_0x5e1c('0x2'));var Redis=require(_0x5e1c('0x3'));var config=require(_0x5e1c('0x4'));var app=express();var server=http[_0x5e1c('0x5')](app);server['timeout']=0xdbba0;if(sticky[_0x5e1c('0x6')](server,config[_0x5e1c('0x7')])){var socketio=require(_0x5e1c('0x8'))(server,{'transports':['websocket',_0x5e1c('0x9')]});config[_0x5e1c('0xa')]=_[_0x5e1c('0xb')](config['redis'],{'host':'localhost','port':0x18eb});socketio[_0x5e1c('0xc')](require(_0x5e1c('0xd'))({'pubClient':new Redis(config[_0x5e1c('0xa')]),'subClient':new Redis(config['redis'])}));require('../../config/triggers')[_0x5e1c('0xe')]();require('../../config/socketio')[_0x5e1c('0xe')](socketio);require('../../config/express')['default'](app);require('../../routes')[_0x5e1c('0xe')](app);}else{server[_0x5e1c('0xf')](_0x5e1c('0x10'),function(){console['log'](_0x5e1c('0x11'),config[_0x5e1c('0x7')]);});}exports=module['exports']=app; \ No newline at end of file diff --git a/server/services/routing/client.js b/server/services/routing/client.js index ece9239..92f4ebf 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 _0xfe69=['rpc','error','message','result','catch','jayson/promise','../../config/logger','routing','client','http','request','then','debug'];(function(_0x5b644e,_0x2e5e07){var _0x49c6bf=function(_0x3032d9){while(--_0x3032d9){_0x5b644e['push'](_0x5b644e['shift']());}};_0x49c6bf(++_0x2e5e07);}(_0xfe69,0x1f3));var _0x9fe6=function(_0x2dafbe,_0x5d04de){_0x2dafbe=_0x2dafbe-0x0;var _0x58a45a=_0xfe69[_0x2dafbe];return _0x58a45a;};'use strict';var jayson=require(_0x9fe6('0x0'));var BPromise=require('bluebird');var logger=require(_0x9fe6('0x1'))(_0x9fe6('0x2'));var client=jayson[_0x9fe6('0x3')][_0x9fe6('0x4')]({'port':0x2329});client['Request']=function(_0x39220b,_0x47a5c6){return new BPromise(function(_0x125896,_0x3b8d75){return client[_0x9fe6('0x5')](_0x39220b,_0x47a5c6)[_0x9fe6('0x6')](function(_0x210388){logger[_0x9fe6('0x7')](_0x9fe6('0x8'),'routing',_0x39220b,_0x47a5c6,_0x210388);if(_0x210388['error']){logger[_0x9fe6('0x9')]('rpc','routing',_0x39220b,_0x210388[_0x9fe6('0x9')]['message'],_0x47a5c6);return _0x3b8d75(_0x210388['error'][_0x9fe6('0xa')]);}else{return _0x125896(_0x210388[_0x9fe6('0xb')]);}})[_0x9fe6('0xc')](function(_0x54deaa){logger[_0x9fe6('0x9')]('rpc',_0x9fe6('0x2'),_0x39220b,_0x54deaa,_0x47a5c6);return _0x3b8d75(_0x54deaa);});});};module['exports']=client; \ No newline at end of file +var _0x0bac=['Request','then','debug','rpc','error','message','catch','jayson/promise','bluebird','../../config/logger','routing','http'];(function(_0x132c1a,_0x196bf6){var _0x2dcea1=function(_0x51a9d6){while(--_0x51a9d6){_0x132c1a['push'](_0x132c1a['shift']());}};_0x2dcea1(++_0x196bf6);}(_0x0bac,0x97));var _0xc0ba=function(_0x2c9e13,_0x2ddade){_0x2c9e13=_0x2c9e13-0x0;var _0x10ce7b=_0x0bac[_0x2c9e13];return _0x10ce7b;};'use strict';var jayson=require(_0xc0ba('0x0'));var BPromise=require(_0xc0ba('0x1'));var logger=require(_0xc0ba('0x2'))(_0xc0ba('0x3'));var client=jayson['client'][_0xc0ba('0x4')]({'port':0x2329});client[_0xc0ba('0x5')]=function(_0xd300a8,_0x375cbb){return new BPromise(function(_0x1b61d3,_0x418449){return client['request'](_0xd300a8,_0x375cbb)[_0xc0ba('0x6')](function(_0x3cd9c){logger[_0xc0ba('0x7')](_0xc0ba('0x8'),_0xc0ba('0x3'),_0xd300a8,_0x375cbb,_0x3cd9c);if(_0x3cd9c[_0xc0ba('0x9')]){logger[_0xc0ba('0x9')]('rpc',_0xc0ba('0x3'),_0xd300a8,_0x3cd9c[_0xc0ba('0x9')][_0xc0ba('0xa')],_0x375cbb);return _0x418449(_0x3cd9c[_0xc0ba('0x9')][_0xc0ba('0xa')]);}else{return _0x1b61d3(_0x3cd9c['result']);}})[_0xc0ba('0xb')](function(_0x3235c0){logger[_0xc0ba('0x9')](_0xc0ba('0x8'),_0xc0ba('0x3'),_0xd300a8,_0x3235c0,_0x375cbb);return _0x418449(_0x3235c0);});});};module['exports']=client; \ No newline at end of file diff --git a/server/services/routing/index.js b/server/services/routing/index.js index 3fe7269..a2cb1f8 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 _0x7c60=['./server','./realtime','./rpc/interval','./rpc/openchannelQueue','./rpc/chatQueue','./rpc/smsQueue','./rpc/mailQueue','./rpc/faxQueue','./rpc/whatsappQueue','resolve','then','initAgents','initIntervals','initOpenchannelQueues','getChatQueues','initChatQueues','getSmsQueues','initSmsQueues','initMailQueues','getFaxQueues','initFaxQueues','getWhatsappQueues','initWhatsappQueues','listen','catch','log','bluebird'];(function(_0x456190,_0x583b5b){var _0x1fa8b1=function(_0x50f115){while(--_0x50f115){_0x456190['push'](_0x456190['shift']());}};_0x1fa8b1(++_0x583b5b);}(_0x7c60,0x1ca));var _0x07c6=function(_0x21e2b0,_0x1774d9){_0x21e2b0=_0x21e2b0-0x0;var _0x35b6fb=_0x7c60[_0x21e2b0];return _0x35b6fb;};'use strict';var BPromise=require(_0x07c6('0x0'));var server=require(_0x07c6('0x1'));var Realtime=require(_0x07c6('0x2'));var user=require('./rpc/user');var interval=require(_0x07c6('0x3'));var openchannelQueue=require(_0x07c6('0x4'));var chatQueue=require(_0x07c6('0x5'));var smsQueue=require(_0x07c6('0x6'));var mailQueue=require(_0x07c6('0x7'));var faxQueue=require(_0x07c6('0x8'));var whatsappQueue=require(_0x07c6('0x9'));var realtime=new Realtime();function initRealtime(){return BPromise[_0x07c6('0xa')]()[_0x07c6('0xb')](user['getAgents']())['then'](realtime[_0x07c6('0xc')]())[_0x07c6('0xb')](interval['getIntervals']())['then'](realtime[_0x07c6('0xd')]())[_0x07c6('0xb')](openchannelQueue['getOpenchannelQueues']())[_0x07c6('0xb')](realtime[_0x07c6('0xe')]())[_0x07c6('0xb')](chatQueue[_0x07c6('0xf')]())[_0x07c6('0xb')](realtime[_0x07c6('0x10')]())[_0x07c6('0xb')](smsQueue[_0x07c6('0x11')]())[_0x07c6('0xb')](realtime[_0x07c6('0x12')]())[_0x07c6('0xb')](mailQueue['getMailQueues']())[_0x07c6('0xb')](realtime[_0x07c6('0x13')]())[_0x07c6('0xb')](faxQueue[_0x07c6('0x14')]())[_0x07c6('0xb')](realtime[_0x07c6('0x15')]())[_0x07c6('0xb')](whatsappQueue[_0x07c6('0x16')]())['then'](realtime[_0x07c6('0x17')]())['then'](function(){return realtime;});}function main(){return server[_0x07c6('0x18')](realtime)['then'](function(_0x105847){return initRealtime();})['then'](function(_0x3ca0cb){return setInterval(initRealtime,0x1388);})[_0x07c6('0x19')](function(_0x37439c){console[_0x07c6('0x1a')](_0x37439c);});}main(); \ No newline at end of file +var _0xd49e=['./rpc/smsQueue','./rpc/mailQueue','./rpc/faxQueue','./rpc/whatsappQueue','resolve','then','initAgents','getIntervals','initIntervals','getOpenchannelQueues','initOpenchannelQueues','getChatQueues','getSmsQueues','initSmsQueues','getMailQueues','initMailQueues','initFaxQueues','getWhatsappQueues','initWhatsappQueues','catch','./server','./realtime','./rpc/interval','./rpc/openchannelQueue','./rpc/chatQueue'];(function(_0x42415e,_0x49ba04){var _0x14cb1e=function(_0x510593){while(--_0x510593){_0x42415e['push'](_0x42415e['shift']());}};_0x14cb1e(++_0x49ba04);}(_0xd49e,0x1d6));var _0xed49=function(_0x1d83db,_0x89d115){_0x1d83db=_0x1d83db-0x0;var _0x2dc1d1=_0xd49e[_0x1d83db];return _0x2dc1d1;};'use strict';var BPromise=require('bluebird');var server=require(_0xed49('0x0'));var Realtime=require(_0xed49('0x1'));var user=require('./rpc/user');var interval=require(_0xed49('0x2'));var openchannelQueue=require(_0xed49('0x3'));var chatQueue=require(_0xed49('0x4'));var smsQueue=require(_0xed49('0x5'));var mailQueue=require(_0xed49('0x6'));var faxQueue=require(_0xed49('0x7'));var whatsappQueue=require(_0xed49('0x8'));var realtime=new Realtime();function initRealtime(){return BPromise[_0xed49('0x9')]()[_0xed49('0xa')](user['getAgents']())[_0xed49('0xa')](realtime[_0xed49('0xb')]())[_0xed49('0xa')](interval[_0xed49('0xc')]())[_0xed49('0xa')](realtime[_0xed49('0xd')]())[_0xed49('0xa')](openchannelQueue[_0xed49('0xe')]())[_0xed49('0xa')](realtime[_0xed49('0xf')]())[_0xed49('0xa')](chatQueue[_0xed49('0x10')]())[_0xed49('0xa')](realtime['initChatQueues']())[_0xed49('0xa')](smsQueue[_0xed49('0x11')]())[_0xed49('0xa')](realtime[_0xed49('0x12')]())['then'](mailQueue[_0xed49('0x13')]())[_0xed49('0xa')](realtime[_0xed49('0x14')]())[_0xed49('0xa')](faxQueue['getFaxQueues']())[_0xed49('0xa')](realtime[_0xed49('0x15')]())['then'](whatsappQueue[_0xed49('0x16')]())['then'](realtime[_0xed49('0x17')]())['then'](function(){return realtime;});}function main(){return server['listen'](realtime)[_0xed49('0xa')](function(_0x6c26bd){return initRealtime();})[_0xed49('0xa')](function(_0x47a848){return setInterval(initRealtime,0x1388);})[_0xed49('0x18')](function(_0x21658f){console['log'](_0x21658f);});}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 057812f..eac3953 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 _0x5fc3=['lodash','util','EventEmitter','init','isNil','ignoreFactChanges','inherits','activeRules','prototype','register','isArray','rules','isObject','sync','orderBy','asc','execute','clone','ruleRef','name','index_','push','call','nextTick','next','isEqual','restart','length','condition','matchPath','noop','findRules','filter','prioritize','priority','toJSON','map','consequence','toString','fromJSON','isString','parse'];(function(_0x2f19c1,_0x309c36){var _0x33aeac=function(_0x6a288a){while(--_0x6a288a){_0x2f19c1['push'](_0x2f19c1['shift']());}};_0x33aeac(++_0x309c36);}(_0x5fc3,0xa8));var _0x35fc=function(_0x356e8d,_0x24c719){_0x356e8d=_0x356e8d-0x0;var _0x39e65a=_0x5fc3[_0x356e8d];return _0x39e65a;};'use strict';var _=require(_0x35fc('0x0'));var util=require(_0x35fc('0x1'));var EventEmitter=require('events')[_0x35fc('0x2')];function RuleEngine(_0x2ac6da,_0x196bc2){this[_0x35fc('0x3')]();if(!_[_0x35fc('0x4')](_0x2ac6da)){this['register'](_0x2ac6da);}if(_0x196bc2){this[_0x35fc('0x5')]=_0x196bc2[_0x35fc('0x5')];}return this;}util[_0x35fc('0x6')](RuleEngine,EventEmitter);RuleEngine['prototype']['init']=function(_0x19a0d1){this['rules']=[];this[_0x35fc('0x7')]=[];};RuleEngine[_0x35fc('0x8')][_0x35fc('0x9')]=function(_0x1e5f90){if(Array[_0x35fc('0xa')](_0x1e5f90)){this[_0x35fc('0xb')]=this[_0x35fc('0xb')]['concat'](_0x1e5f90);}else if(_0x1e5f90!==null&&_[_0x35fc('0xc')](_0x1e5f90)){this[_0x35fc('0xb')]['push'](_0x1e5f90);}this[_0x35fc('0xd')]();};RuleEngine[_0x35fc('0x8')]['sync']=function(){this[_0x35fc('0x7')]=this[_0x35fc('0xb')]['filter'](function(_0x4cbe74){if(_[_0x35fc('0x4')](_0x4cbe74['on'])){_0x4cbe74['on']=!![];}if(_0x4cbe74['on']===!![]){return _0x4cbe74;}});this['activeRules']=_[_0x35fc('0xe')](this[_0x35fc('0x7')],['p'],[_0x35fc('0xf')]);};RuleEngine[_0x35fc('0x8')][_0x35fc('0x10')]=function(_0x5cfe94,_0x59507a){var _0x5eac0f=![];_0x5cfe94['result']=!![];var _0x398b67=_[_0x35fc('0x11')](_0x5cfe94);var _0x53b898=_[_0x35fc('0x11')](_0x5cfe94);var _0x227a49=this[_0x35fc('0x7')];var _0x480851=[];var _0x26ba54=this[_0x35fc('0x5')];(function FnRuleLoop(_0x553677){var _0x41e165={'rules':function(){return _0x227a49;},'rule':function(){return _0x227a49[_0x553677];},'when':function(_0x363e47){if(_0x363e47){var _0x2e513b=_0x227a49[_0x553677]['consequence'];_0x2e513b[_0x35fc('0x12')]=_0x227a49[_0x553677]['id']||_0x227a49[_0x553677][_0x35fc('0x13')]||_0x35fc('0x14')+_0x553677;process['nextTick'](function(){_0x480851[_0x35fc('0x15')](_0x2e513b[_0x35fc('0x12')]);_0x2e513b[_0x35fc('0x16')](_0x398b67,_0x41e165);});}else{process[_0x35fc('0x17')](function(){_0x41e165[_0x35fc('0x18')]();});}},'restart':function(){return FnRuleLoop(0x0);},'stop':function(){_0x5eac0f=!![];return FnRuleLoop(0x0);},'next':function(_0x21f1a9){if(!_0x26ba54&&!_[_0x35fc('0x19')](_0x53b898,_0x398b67)){_0x53b898=_[_0x35fc('0x11')](_0x398b67);process[_0x35fc('0x17')](function(){_0x41e165[_0x35fc('0x1a')]();});}else{process['nextTick'](function(){if(_[_0x35fc('0x4')](_0x21f1a9)){return FnRuleLoop(_0x553677+0x1);}else{return FnRuleLoop(_0x21f1a9);}});}}};if(_0x553677<_0x227a49[_0x35fc('0x1b')]&&_0x5eac0f===![]){var _0x257719=_0x227a49[_0x553677][_0x35fc('0x1c')];_0x257719[_0x35fc('0x16')](_0x398b67,_0x41e165);}else{process['nextTick'](function(){_0x398b67[_0x35fc('0x1d')]=_0x480851;return _0x59507a?_0x59507a(_0x398b67):_[_0x35fc('0x1e')]();});}}(0x0));};RuleEngine['prototype'][_0x35fc('0x1f')]=function(_0x5a93df){if(_[_0x35fc('0x4')](_0x5a93df)){return this['rules'];}else{var _0x4086e9=_['matches'](_0x5a93df);return _[_0x35fc('0x20')](this[_0x35fc('0xb')],_0x4086e9);}};RuleEngine['prototype']['turn']=function(_0x47774c,_0x58edb6){var _0x274208=_0x47774c==='on'||_0x47774c==='ON'?!![]:![];var _0x1a5d92=this['findRules'](_0x58edb6);for(var _0x26b7cb=0x0,_0x645eac=_0x1a5d92[_0x35fc('0x1b')];_0x26b7cb<_0x645eac;_0x26b7cb+=0x1){_0x1a5d92[_0x26b7cb]['on']=_0x274208;}this[_0x35fc('0xd')]();};RuleEngine[_0x35fc('0x8')][_0x35fc('0x21')]=function(_0x11ccdb,_0x451f0c){_0x11ccdb=parseInt(_0x11ccdb,0xa);var _0x54aedc=this[_0x35fc('0x1f')](_0x451f0c);for(var _0x220931=0x0,_0x22af18=_0x54aedc['length'];_0x220931<_0x22af18;_0x220931+=0x1){_0x54aedc[_0x220931][_0x35fc('0x22')]=_0x11ccdb;}this[_0x35fc('0xd')]();};RuleEngine[_0x35fc('0x8')][_0x35fc('0x23')]=function(){var _0xd8a4ca=this[_0x35fc('0xb')];if(_0xd8a4ca instanceof Array){_0xd8a4ca=_0xd8a4ca[_0x35fc('0x24')](function(_0x37b435){_0x37b435[_0x35fc('0x1c')]=_0x37b435[_0x35fc('0x1c')]['toString']();_0x37b435['consequence']=_0x37b435[_0x35fc('0x25')]['toString']();return _0x37b435;});}else if(!_[_0x35fc('0x4')](_0xd8a4ca)){_0xd8a4ca[_0x35fc('0x1c')]=_0xd8a4ca[_0x35fc('0x1c')][_0x35fc('0x26')]();_0xd8a4ca[_0x35fc('0x25')]=_0xd8a4ca[_0x35fc('0x25')]['toString']();}return _0xd8a4ca;};RuleEngine[_0x35fc('0x8')][_0x35fc('0x27')]=function(_0x46b9ef){this[_0x35fc('0x3')]();if(_[_0x35fc('0x28')](_0x46b9ef)){_0x46b9ef=JSON[_0x35fc('0x29')](_0x46b9ef);}if(_0x46b9ef instanceof Array){_0x46b9ef=_0x46b9ef['map'](function(_0x2483be){_0x2483be[_0x35fc('0x1c')]=eval('('+_0x2483be[_0x35fc('0x1c')]+')');_0x2483be['consequence']=eval('('+_0x2483be[_0x35fc('0x25')]+')');return _0x2483be;});}else if(_0x46b9ef!==null&&typeof _0x46b9ef=='object'){_0x46b9ef[_0x35fc('0x1c')]=eval('('+_0x46b9ef[_0x35fc('0x1c')]+')');_0x46b9ef[_0x35fc('0x25')]=eval('('+_0x46b9ef[_0x35fc('0x25')]+')');}this['register'](_0x46b9ef);};module['exports']=RuleEngine; \ No newline at end of file +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(_0x4f4126,_0x568680){var _0xe03ac0=function(_0x110f53){while(--_0x110f53){_0x4f4126['push'](_0x4f4126['shift']());}};_0xe03ac0(++_0x568680);}(_0x7a54,0x106));var _0x47a5=function(_0x2a31aa,_0x3de63a){_0x2a31aa=_0x2a31aa-0x0;var _0x49cef2=_0x7a54[_0x2a31aa];return _0x49cef2;};'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 diff --git a/server/services/routing/mailRpc/index.js b/server/services/routing/mailRpc/index.js index 9fb47dd..b0564ba 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 _0x48bb=['http','request','then','error','result','sendMailMessage','bluebird','client'];(function(_0x58547b,_0x4b89c2){var _0x1d3fd2=function(_0x4ac500){while(--_0x4ac500){_0x58547b['push'](_0x58547b['shift']());}};_0x1d3fd2(++_0x4b89c2);}(_0x48bb,0x8e));var _0xb48b=function(_0xb0f7c3,_0x4eae95){_0xb0f7c3=_0xb0f7c3-0x0;var _0x28ea68=_0x48bb[_0xb0f7c3];return _0x28ea68;};'use strict';var BPromise=require(_0xb48b('0x0'));var jayson=require('jayson/promise');var client=jayson[_0xb48b('0x1')][_0xb48b('0x2')]({'port':0x232b});function request(_0x15829e,_0x58fa4d){return new BPromise(function(_0x2f166b,_0x5a0128){return client[_0xb48b('0x3')](_0x15829e,_0x58fa4d)[_0xb48b('0x4')](function(_0x36d1b3){if(_0x36d1b3['error']){return _0x5a0128(_0x36d1b3[_0xb48b('0x5')]['message']);}else{return _0x2f166b(_0x36d1b3[_0xb48b('0x6')]);}})['catch'](function(_0x4c84ab){return _0x5a0128(_0x4c84ab);});});}exports[_0xb48b('0x7')]=function(_0x23ee62,_0x20deb1){return request('SendMail',{'account':_0x23ee62,'message':_0x20deb1});}; \ No newline at end of file +var _0x2874=['then','error','message','result','catch','bluebird','client','http'];(function(_0x5eb98d,_0x697d53){var _0x247e0c=function(_0x18aa6c){while(--_0x18aa6c){_0x5eb98d['push'](_0x5eb98d['shift']());}};_0x247e0c(++_0x697d53);}(_0x2874,0xa5));var _0x4287=function(_0x323430,_0x3d2b6d){_0x323430=_0x323430-0x0;var _0x9eecd1=_0x2874[_0x323430];return _0x9eecd1;};'use strict';var BPromise=require(_0x4287('0x0'));var jayson=require('jayson/promise');var client=jayson[_0x4287('0x1')][_0x4287('0x2')]({'port':0x232b});function request(_0x279c51,_0x141f9d){return new BPromise(function(_0x586b2b,_0x4f0ad3){return client['request'](_0x279c51,_0x141f9d)[_0x4287('0x3')](function(_0xe63cde){if(_0xe63cde[_0x4287('0x4')]){return _0x4f0ad3(_0xe63cde[_0x4287('0x4')][_0x4287('0x5')]);}else{return _0x586b2b(_0xe63cde[_0x4287('0x6')]);}})[_0x4287('0x7')](function(_0x539ed1){return _0x4f0ad3(_0x539ed1);});});}exports['sendMailMessage']=function(_0x1bb2e1,_0x4a9f8e){return request('SendMail',{'account':_0x1bb2e1,'message':_0x4a9f8e});}; \ No newline at end of file diff --git a/server/services/routing/model/agent.js b/server/services/routing/model/agent.js index 9ad799b..914feae 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 _0xfcbb=['exports','lodash','md5','moment','redis','defaults','localhost','socket.io-emitter','name','online','voicePause','chatPause','mailPause','faxPause','smsPause','openchannelPause','chatStatus','unknown','chatCapacity','chatCurrentCapacity','mailStatus','mailStatusTime','mailCapacity','mailCurrentCapacity','faxStatus','faxStatusTime','faxCapacity','faxCurrentCapacity','smsStatus','smsStatusTime','smsCapacity','smsCurrentCapacity','whatsappStatus','whatsappStatusTime','whatsappCapacity','whatsappCurrentCapacity','openchannelStatus','openchannelCapacity','busy','busyQueue','faxWaitingInteractions','mailWaitingInteractions','openchannelWaitingInteractions','smsWaitingInteractions','whatsappWaitingInteractions','prototype','getChannelStatus','CurrentCapacity','Capacity','maxcapacity','working','idle','updateRealtime','mail','chat','openchannel','sms','whatsapp','length','Status','StatusTime','toNumber','format','chatStatusTime','openchannelCurrentCapacity','chatWaitingInteractions','omit'];(function(_0x3dd15e,_0x1f0015){var _0x231fd0=function(_0x4f680a){while(--_0x4f680a){_0x3dd15e['push'](_0x3dd15e['shift']());}};_0x231fd0(++_0x1f0015);}(_0xfcbb,0x10d));var _0xbfcb=function(_0xda6b0,_0x412b58){_0xda6b0=_0xda6b0-0x0;var _0x543ce4=_0xfcbb[_0xda6b0];return _0x543ce4;};'use strict';var _=require(_0xbfcb('0x0'));var md5=require(_0xbfcb('0x1'));var moment=require(_0xbfcb('0x2'));var Redis=require('ioredis');var config=require('../../../config/environment');config[_0xbfcb('0x3')]=_[_0xbfcb('0x4')](config[_0xbfcb('0x3')],{'host':_0xbfcb('0x5'),'port':0x18eb});var io=require(_0xbfcb('0x6'))(new Redis(config['redis']));function Agent(_0x5201d3){this['id']=_0x5201d3['id']||0x0;this[_0xbfcb('0x7')]=_0x5201d3[_0xbfcb('0x7')]||'';this[_0xbfcb('0x8')]=_0x5201d3[_0xbfcb('0x8')]||!![];this[_0xbfcb('0x9')]=_0x5201d3[_0xbfcb('0x9')]||![];this[_0xbfcb('0xa')]=_0x5201d3['chatPause']||![];this[_0xbfcb('0xb')]=_0x5201d3[_0xbfcb('0xb')]||![];this[_0xbfcb('0xc')]=_0x5201d3['faxPause']||![];this[_0xbfcb('0xd')]=_0x5201d3[_0xbfcb('0xd')]||![];this[_0xbfcb('0xe')]=_0x5201d3[_0xbfcb('0xe')]||![];this[_0xbfcb('0xf')]=_0xbfcb('0x10');this['chatStatusTime']=0x0;this[_0xbfcb('0x11')]=_0x5201d3[_0xbfcb('0x11')]||0x0;this[_0xbfcb('0x12')]=0x0;this[_0xbfcb('0x13')]='unknown';this[_0xbfcb('0x14')]=0x0;this['mailCapacity']=_0x5201d3[_0xbfcb('0x15')]||0x0;this[_0xbfcb('0x16')]=0x0;this[_0xbfcb('0x17')]=_0xbfcb('0x10');this[_0xbfcb('0x18')]=0x0;this[_0xbfcb('0x19')]=_0x5201d3[_0xbfcb('0x19')]||0x0;this[_0xbfcb('0x1a')]=0x0;this[_0xbfcb('0x1b')]=_0xbfcb('0x10');this[_0xbfcb('0x1c')]=0x0;this[_0xbfcb('0x1d')]=_0x5201d3[_0xbfcb('0x1d')]||0x0;this[_0xbfcb('0x1e')]=0x0;this[_0xbfcb('0x1f')]=_0xbfcb('0x10');this[_0xbfcb('0x20')]=0x0;this[_0xbfcb('0x21')]=_0x5201d3[_0xbfcb('0x21')]||0x0;this[_0xbfcb('0x22')]=0x0;this[_0xbfcb('0x23')]=_0xbfcb('0x10');this['openchannelStatusTime']=0x0;this[_0xbfcb('0x24')]=_0x5201d3[_0xbfcb('0x24')]||0x0;this['openchannelCurrentCapacity']=0x0;this[_0xbfcb('0x25')]=![];this[_0xbfcb('0x26')]=undefined;this['md5']='';this['chatWaitingInteractions']={};this[_0xbfcb('0x27')]={};this[_0xbfcb('0x28')]={};this[_0xbfcb('0x29')]={};this[_0xbfcb('0x2a')]={};this[_0xbfcb('0x2b')]={};this['updateRealtime']();}Agent[_0xbfcb('0x2c')][_0xbfcb('0x2d')]=function(_0x2d9288){if(this[_0x2d9288+_0xbfcb('0x2e')]>0x0){if(this[_0x2d9288+_0xbfcb('0x2f')]>0x0&&this[_0x2d9288+_0xbfcb('0x2e')]>=this[_0x2d9288+_0xbfcb('0x2f')]){return _0xbfcb('0x30');}else{return _0xbfcb('0x31');}}else{return _0xbfcb('0x32');}};Agent[_0xbfcb('0x2c')][_0xbfcb('0x33')]=function(){var _0x3ef71c=[_0xbfcb('0x34'),_0xbfcb('0x35'),_0xbfcb('0x36'),'fax',_0xbfcb('0x37'),_0xbfcb('0x38')];for(var _0x4cf7ca=0x0;_0x4cf7ca<_0x3ef71c[_0xbfcb('0x39')];_0x4cf7ca+=0x1){var _0x15197b=this[_0xbfcb('0x2d')](_0x3ef71c[_0x4cf7ca]);if(this[_0x3ef71c[_0x4cf7ca]+_0xbfcb('0x3a')]!==_0x15197b){this[_0x3ef71c[_0x4cf7ca]+_0xbfcb('0x3b')]=_[_0xbfcb('0x3c')](moment()[_0xbfcb('0x3d')]('x'));}this[_0x3ef71c[_0x4cf7ca]+_0xbfcb('0x3a')]=_0x15197b;}var _0x434764={'id':this['id'],'name':this[_0xbfcb('0x7')],'online':this['online'],'voicePause':this[_0xbfcb('0x9')],'chatPause':this[_0xbfcb('0xa')],'mailPause':this[_0xbfcb('0xb')],'smsPause':this[_0xbfcb('0xd')],'faxPause':this[_0xbfcb('0xc')],'openchannelPause':this[_0xbfcb('0xe')],'chatStatus':this[_0xbfcb('0xf')],'chatStatusTime':this[_0xbfcb('0x3e')],'chatCapacity':this[_0xbfcb('0x11')],'chatCurrentCapacity':this['chatCurrentCapacity'],'mailStatus':this[_0xbfcb('0x13')],'mailStatusTime':this[_0xbfcb('0x14')],'mailCapacity':this[_0xbfcb('0x15')],'mailCurrentCapacity':this[_0xbfcb('0x16')],'faxStatus':this['faxStatus'],'faxStatusTime':this['faxStatusTime'],'faxCapacity':this[_0xbfcb('0x19')],'faxCurrentCapacity':this[_0xbfcb('0x1a')],'smsStatus':this[_0xbfcb('0x1b')],'smsStatusTime':this[_0xbfcb('0x1c')],'smsCapacity':this[_0xbfcb('0x1d')],'smsCurrentCapacity':this[_0xbfcb('0x1e')],'whatsappStatus':this[_0xbfcb('0x1f')],'whatsappStatusTime':this['whatsappStatusTime'],'whatsappCapacity':this['whatsappCapacity'],'whatsappCurrentCapacity':this['whatsappCurrentCapacity'],'openchannelStatus':this[_0xbfcb('0x23')],'openchannelStatusTime':this['openchannelStatusTime'],'openchannelCapacity':this[_0xbfcb('0x24')],'openchannelCurrentCapacity':this[_0xbfcb('0x3f')],'busy':this['busy'],'busyQueue':this['busyQueue'],'chatWaitingInteractions':this[_0xbfcb('0x40')],'faxWaitingInteractions':this[_0xbfcb('0x27')],'mailWaitingInteractions':this[_0xbfcb('0x28')],'openchannelWaitingInteractions':this[_0xbfcb('0x29')],'smsWaitingInteractions':this['smsWaitingInteractions'],'whatsappWaitingInteractions':this[_0xbfcb('0x2b')]};var _0xf35aa5=md5(JSON['stringify'](_0x434764));if(this['md5']!==_0xf35aa5){this[_0xbfcb('0x1')]=_0xf35aa5;io['emit']('user:routing:update',_[_0xbfcb('0x41')](_0x434764,[_0xbfcb('0x8')]));}};module[_0xbfcb('0x42')]=Agent; \ No newline at end of file +var _0x3a6d=['faxPause','smsPause','openchannelPause','chatStatus','unknown','chatStatusTime','mailStatus','mailStatusTime','mailCapacity','mailCurrentCapacity','faxStatus','faxStatusTime','faxCapacity','smsStatus','smsStatusTime','smsCapacity','whatsappStatusTime','whatsappCapacity','whatsappCurrentCapacity','openchannelStatus','openchannelCapacity','openchannelCurrentCapacity','busy','busyQueue','chatWaitingInteractions','faxWaitingInteractions','openchannelWaitingInteractions','smsWaitingInteractions','CurrentCapacity','Capacity','maxcapacity','idle','prototype','updateRealtime','mail','chat','openchannel','fax','sms','whatsapp','length','getChannelStatus','Status','StatusTime','toNumber','chatCapacity','chatCurrentCapacity','faxCurrentCapacity','smsCurrentCapacity','whatsappStatus','openchannelStatusTime','mailWaitingInteractions','stringify','omit','exports','lodash','md5','ioredis','../../../config/environment','redis','defaults','socket.io-emitter','name','online','voicePause','chatPause','mailPause'];(function(_0x27cff3,_0x2d03a9){var _0xee2ee9=function(_0x23a7b4){while(--_0x23a7b4){_0x27cff3['push'](_0x27cff3['shift']());}};_0xee2ee9(++_0x2d03a9);}(_0x3a6d,0x143));var _0xd3a6=function(_0x51020b,_0x38c2c7){_0x51020b=_0x51020b-0x0;var _0x371e47=_0x3a6d[_0x51020b];return _0x371e47;};'use strict';var _=require(_0xd3a6('0x0'));var md5=require(_0xd3a6('0x1'));var moment=require('moment');var Redis=require(_0xd3a6('0x2'));var config=require(_0xd3a6('0x3'));config[_0xd3a6('0x4')]=_[_0xd3a6('0x5')](config[_0xd3a6('0x4')],{'host':'localhost','port':0x18eb});var io=require(_0xd3a6('0x6'))(new Redis(config[_0xd3a6('0x4')]));function Agent(_0x1e44bd){this['id']=_0x1e44bd['id']||0x0;this[_0xd3a6('0x7')]=_0x1e44bd[_0xd3a6('0x7')]||'';this[_0xd3a6('0x8')]=_0x1e44bd['online']||!![];this[_0xd3a6('0x9')]=_0x1e44bd[_0xd3a6('0x9')]||![];this[_0xd3a6('0xa')]=_0x1e44bd[_0xd3a6('0xa')]||![];this[_0xd3a6('0xb')]=_0x1e44bd[_0xd3a6('0xb')]||![];this[_0xd3a6('0xc')]=_0x1e44bd[_0xd3a6('0xc')]||![];this[_0xd3a6('0xd')]=_0x1e44bd['smsPause']||![];this[_0xd3a6('0xe')]=_0x1e44bd[_0xd3a6('0xe')]||![];this[_0xd3a6('0xf')]=_0xd3a6('0x10');this[_0xd3a6('0x11')]=0x0;this['chatCapacity']=_0x1e44bd['chatCapacity']||0x0;this['chatCurrentCapacity']=0x0;this[_0xd3a6('0x12')]=_0xd3a6('0x10');this[_0xd3a6('0x13')]=0x0;this[_0xd3a6('0x14')]=_0x1e44bd[_0xd3a6('0x14')]||0x0;this[_0xd3a6('0x15')]=0x0;this[_0xd3a6('0x16')]='unknown';this[_0xd3a6('0x17')]=0x0;this[_0xd3a6('0x18')]=_0x1e44bd[_0xd3a6('0x18')]||0x0;this['faxCurrentCapacity']=0x0;this[_0xd3a6('0x19')]=_0xd3a6('0x10');this[_0xd3a6('0x1a')]=0x0;this['smsCapacity']=_0x1e44bd[_0xd3a6('0x1b')]||0x0;this['smsCurrentCapacity']=0x0;this['whatsappStatus']=_0xd3a6('0x10');this[_0xd3a6('0x1c')]=0x0;this[_0xd3a6('0x1d')]=_0x1e44bd[_0xd3a6('0x1d')]||0x0;this[_0xd3a6('0x1e')]=0x0;this[_0xd3a6('0x1f')]=_0xd3a6('0x10');this['openchannelStatusTime']=0x0;this[_0xd3a6('0x20')]=_0x1e44bd['openchannelCapacity']||0x0;this[_0xd3a6('0x21')]=0x0;this[_0xd3a6('0x22')]=![];this[_0xd3a6('0x23')]=undefined;this[_0xd3a6('0x1')]='';this[_0xd3a6('0x24')]={};this[_0xd3a6('0x25')]={};this['mailWaitingInteractions']={};this[_0xd3a6('0x26')]={};this[_0xd3a6('0x27')]={};this['whatsappWaitingInteractions']={};this['updateRealtime']();}Agent['prototype']['getChannelStatus']=function(_0x5c9075){if(this[_0x5c9075+_0xd3a6('0x28')]>0x0){if(this[_0x5c9075+_0xd3a6('0x29')]>0x0&&this[_0x5c9075+_0xd3a6('0x28')]>=this[_0x5c9075+'Capacity']){return _0xd3a6('0x2a');}else{return'working';}}else{return _0xd3a6('0x2b');}};Agent[_0xd3a6('0x2c')][_0xd3a6('0x2d')]=function(){var _0x4f6130=[_0xd3a6('0x2e'),_0xd3a6('0x2f'),_0xd3a6('0x30'),_0xd3a6('0x31'),_0xd3a6('0x32'),_0xd3a6('0x33')];for(var _0x5650d1=0x0;_0x5650d1<_0x4f6130[_0xd3a6('0x34')];_0x5650d1+=0x1){var _0x2b5448=this[_0xd3a6('0x35')](_0x4f6130[_0x5650d1]);if(this[_0x4f6130[_0x5650d1]+_0xd3a6('0x36')]!==_0x2b5448){this[_0x4f6130[_0x5650d1]+_0xd3a6('0x37')]=_[_0xd3a6('0x38')](moment()['format']('x'));}this[_0x4f6130[_0x5650d1]+'Status']=_0x2b5448;}var _0x1f4859={'id':this['id'],'name':this[_0xd3a6('0x7')],'online':this[_0xd3a6('0x8')],'voicePause':this[_0xd3a6('0x9')],'chatPause':this['chatPause'],'mailPause':this[_0xd3a6('0xb')],'smsPause':this[_0xd3a6('0xd')],'faxPause':this['faxPause'],'openchannelPause':this[_0xd3a6('0xe')],'chatStatus':this['chatStatus'],'chatStatusTime':this[_0xd3a6('0x11')],'chatCapacity':this[_0xd3a6('0x39')],'chatCurrentCapacity':this[_0xd3a6('0x3a')],'mailStatus':this[_0xd3a6('0x12')],'mailStatusTime':this[_0xd3a6('0x13')],'mailCapacity':this[_0xd3a6('0x14')],'mailCurrentCapacity':this[_0xd3a6('0x15')],'faxStatus':this['faxStatus'],'faxStatusTime':this['faxStatusTime'],'faxCapacity':this[_0xd3a6('0x18')],'faxCurrentCapacity':this[_0xd3a6('0x3b')],'smsStatus':this[_0xd3a6('0x19')],'smsStatusTime':this['smsStatusTime'],'smsCapacity':this[_0xd3a6('0x1b')],'smsCurrentCapacity':this[_0xd3a6('0x3c')],'whatsappStatus':this[_0xd3a6('0x3d')],'whatsappStatusTime':this[_0xd3a6('0x1c')],'whatsappCapacity':this[_0xd3a6('0x1d')],'whatsappCurrentCapacity':this[_0xd3a6('0x1e')],'openchannelStatus':this[_0xd3a6('0x1f')],'openchannelStatusTime':this[_0xd3a6('0x3e')],'openchannelCapacity':this['openchannelCapacity'],'openchannelCurrentCapacity':this[_0xd3a6('0x21')],'busy':this[_0xd3a6('0x22')],'busyQueue':this[_0xd3a6('0x23')],'chatWaitingInteractions':this[_0xd3a6('0x24')],'faxWaitingInteractions':this[_0xd3a6('0x25')],'mailWaitingInteractions':this[_0xd3a6('0x3f')],'openchannelWaitingInteractions':this['openchannelWaitingInteractions'],'smsWaitingInteractions':this[_0xd3a6('0x27')],'whatsappWaitingInteractions':this['whatsappWaitingInteractions']};var _0x263615=md5(JSON[_0xd3a6('0x40')](_0x1f4859));if(this[_0xd3a6('0x1')]!==_0x263615){this[_0xd3a6('0x1')]=_0x263615;io['emit']('user:routing:update',_[_0xd3a6('0x41')](_0x1f4859,[_0xd3a6('0x8')]));}};module[_0xd3a6('0x42')]=Agent; \ No newline at end of file diff --git a/server/services/routing/model/chatQueue.js b/server/services/routing/model/chatQueue.js index d8fab0f..ce35877 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 _0xbac3=['socket.io-emitter','name','timeout','strategy','beepall','Agents','waiting','updateRealtime','prototype','mapAgentsId','map','_rr','loggedIn','paused','length','chatPause','available','md5','format','chat:queue:%s','emit','chat_queue:save','lodash','ioredis','../../../config/environment','defaults','redis','localhost'];(function(_0x452f4e,_0x58eb76){var _0x9f3ba0=function(_0x16c18f){while(--_0x16c18f){_0x452f4e['push'](_0x452f4e['shift']());}};_0x9f3ba0(++_0x58eb76);}(_0xbac3,0xa2));var _0x3bac=function(_0x348652,_0x1ab849){_0x348652=_0x348652-0x0;var _0x18a9ea=_0xbac3[_0x348652];return _0x18a9ea;};'use strict';var _=require(_0x3bac('0x0'));var md5=require('md5');var util=require('util');var Redis=require(_0x3bac('0x1'));var config=require(_0x3bac('0x2'));config['redis']=_[_0x3bac('0x3')](config[_0x3bac('0x4')],{'host':_0x3bac('0x5'),'port':0x18eb});var io=require(_0x3bac('0x6'))(new Redis(config[_0x3bac('0x4')]));function ChatQueue(_0x12e39d){this['id']=_0x12e39d['id']||0x0;this[_0x3bac('0x7')]=_0x12e39d[_0x3bac('0x7')]||'';this[_0x3bac('0x8')]=_0x12e39d[_0x3bac('0x8')]||0xa;this[_0x3bac('0x9')]=_0x12e39d[_0x3bac('0x9')]||_0x3bac('0xa');this[_0x3bac('0xb')]=_0x12e39d[_0x3bac('0xb')];this['mapAgentsId']={};this[_0x3bac('0xc')]=0x0;this['md5']='';this['updateRouting']();this[_0x3bac('0xd')]();}ChatQueue[_0x3bac('0xe')]['updateRouting']=function(){var _0x50b183=this[_0x3bac('0xf')]['_rr'];this[_0x3bac('0xf')]=_[_0x3bac('0x10')](this[_0x3bac('0xb')],'id');this[_0x3bac('0xf')][_0x3bac('0x11')]=_0x50b183;};ChatQueue[_0x3bac('0xe')][_0x3bac('0xd')]=function(){this[_0x3bac('0x12')]=0x0;this[_0x3bac('0x13')]=0x0;for(var _0x56102a=0x0;_0x56102a=0x0?this[_0x3bac('0x16')]:0x0;var _0x317489={'id':this['id'],'available':this[_0x3bac('0x16')],'loggedIn':this[_0x3bac('0x12')],'name':this[_0x3bac('0x7')],'paused':this['paused'],'waiting':this[_0x3bac('0xc')]};var _0xdccbe5=md5(JSON['stringify'](_0x317489));if(this[_0x3bac('0x17')]!==_0xdccbe5){this[_0x3bac('0x17')]=_0xdccbe5;io['to'](util[_0x3bac('0x18')](_0x3bac('0x19'),_0x317489[_0x3bac('0x7')]))[_0x3bac('0x1a')](_0x3bac('0x1b'),_0x317489);}};module['exports']=ChatQueue; \ No newline at end of file +var _0xbb97=['paused','length','online','loggedIn','chatPause','available','format','chat:queue:%s','chat_queue:save','md5','util','ioredis','redis','defaults','socket.io-emitter','name','timeout','strategy','beepall','Agents','mapAgentsId','prototype','map','_rr'];(function(_0x47b58b,_0x41a189){var _0x46bebe=function(_0x22bbfa){while(--_0x22bbfa){_0x47b58b['push'](_0x47b58b['shift']());}};_0x46bebe(++_0x41a189);}(_0xbb97,0xe1));var _0x7bb9=function(_0x513a3a,_0xd78ba7){_0x513a3a=_0x513a3a-0x0;var _0x1d06c7=_0xbb97[_0x513a3a];return _0x1d06c7;};'use strict';var _=require('lodash');var md5=require(_0x7bb9('0x0'));var util=require(_0x7bb9('0x1'));var Redis=require(_0x7bb9('0x2'));var config=require('../../../config/environment');config[_0x7bb9('0x3')]=_[_0x7bb9('0x4')](config[_0x7bb9('0x3')],{'host':'localhost','port':0x18eb});var io=require(_0x7bb9('0x5'))(new Redis(config['redis']));function ChatQueue(_0x4bebea){this['id']=_0x4bebea['id']||0x0;this[_0x7bb9('0x6')]=_0x4bebea['name']||'';this[_0x7bb9('0x7')]=_0x4bebea['timeout']||0xa;this[_0x7bb9('0x8')]=_0x4bebea[_0x7bb9('0x8')]||_0x7bb9('0x9');this[_0x7bb9('0xa')]=_0x4bebea[_0x7bb9('0xa')];this[_0x7bb9('0xb')]={};this['waiting']=0x0;this[_0x7bb9('0x0')]='';this['updateRouting']();this['updateRealtime']();}ChatQueue[_0x7bb9('0xc')]['updateRouting']=function(){var _0x39a258=this[_0x7bb9('0xb')]['_rr'];this[_0x7bb9('0xb')]=_[_0x7bb9('0xd')](this[_0x7bb9('0xa')],'id');this[_0x7bb9('0xb')][_0x7bb9('0xe')]=_0x39a258;};ChatQueue[_0x7bb9('0xc')]['updateRealtime']=function(){this['loggedIn']=0x0;this[_0x7bb9('0xf')]=0x0;for(var _0x27ac6e=0x0;_0x27ac6e=0x0?this[_0x7bb9('0x14')]:0x0;var _0x2742f2={'id':this['id'],'available':this[_0x7bb9('0x14')],'loggedIn':this[_0x7bb9('0x12')],'name':this[_0x7bb9('0x6')],'paused':this[_0x7bb9('0xf')],'waiting':this['waiting']};var _0x201d5b=md5(JSON['stringify'](_0x2742f2));if(this[_0x7bb9('0x0')]!==_0x201d5b){this['md5']=_0x201d5b;io['to'](util[_0x7bb9('0x15')](_0x7bb9('0x16'),_0x2742f2[_0x7bb9('0x6')]))['emit'](_0x7bb9('0x17'),_0x2742f2);}};module['exports']=ChatQueue; \ No newline at end of file diff --git a/server/services/routing/model/faxQueue.js b/server/services/routing/model/faxQueue.js index 38e3a5c..c5ff775 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 _0x4679=['_rr','loggedIn','paused','length','online','available','name','format','fax:queue:%s','emit','fax_queue:save','exports','md5','util','ioredis','../../../config/environment','redis','defaults','localhost','socket.io-emitter','timeout','strategy','beepall','Agents','mapAgentsId','waiting','updateRouting','updateRealtime','prototype'];(function(_0x3b5250,_0x7a0b2c){var _0xc844a1=function(_0x2fbc98){while(--_0x2fbc98){_0x3b5250['push'](_0x3b5250['shift']());}};_0xc844a1(++_0x7a0b2c);}(_0x4679,0xd7));var _0x9467=function(_0x5740b8,_0x2dbc22){_0x5740b8=_0x5740b8-0x0;var _0x2ebe76=_0x4679[_0x5740b8];return _0x2ebe76;};'use strict';var _=require('lodash');var md5=require(_0x9467('0x0'));var util=require(_0x9467('0x1'));var Redis=require(_0x9467('0x2'));var config=require(_0x9467('0x3'));config[_0x9467('0x4')]=_[_0x9467('0x5')](config[_0x9467('0x4')],{'host':_0x9467('0x6'),'port':0x18eb});var io=require(_0x9467('0x7'))(new Redis(config[_0x9467('0x4')]));function FaxQueue(_0x29c428){this['id']=_0x29c428['id']||0x0;this['name']=_0x29c428['name']||'';this[_0x9467('0x8')]=_0x29c428[_0x9467('0x8')]||0xa;this[_0x9467('0x9')]=_0x29c428[_0x9467('0x9')]||_0x9467('0xa');this[_0x9467('0xb')]=_0x29c428[_0x9467('0xb')];this[_0x9467('0xc')]={};this[_0x9467('0xd')]=0x0;this[_0x9467('0x0')]='';this[_0x9467('0xe')]();this[_0x9467('0xf')]();}FaxQueue[_0x9467('0x10')][_0x9467('0xe')]=function(){var _0x298a3a=this['mapAgentsId'][_0x9467('0x11')];this[_0x9467('0xc')]=_['map'](this['Agents'],'id');this[_0x9467('0xc')][_0x9467('0x11')]=_0x298a3a;};FaxQueue[_0x9467('0x10')][_0x9467('0xf')]=function(){this[_0x9467('0x12')]=0x0;this[_0x9467('0x13')]=0x0;for(var _0x42ea57=0x0;_0x42ea57=0x0?this[_0x9467('0x16')]:0x0;var _0x39c393={'id':this['id'],'available':this[_0x9467('0x16')],'loggedIn':this[_0x9467('0x12')],'name':this[_0x9467('0x17')],'paused':this[_0x9467('0x13')],'waiting':this[_0x9467('0xd')]};var _0x56c284=md5(JSON['stringify'](_0x39c393));if(this[_0x9467('0x0')]!==_0x56c284){this[_0x9467('0x0')]=_0x56c284;io['to'](util[_0x9467('0x18')](_0x9467('0x19'),_0x39c393['name']))[_0x9467('0x1a')](_0x9467('0x1b'),_0x39c393);}};module[_0x9467('0x1c')]=FaxQueue; \ No newline at end of file +var _0x162a=['redis','name','strategy','beepall','Agents','waiting','updateRouting','updateRealtime','mapAgentsId','map','_rr','loggedIn','paused','length','online','faxPause','available','fax:queue:%s','emit','exports','lodash','md5','util','../../../config/environment','defaults'];(function(_0x41bfa8,_0x2222f0){var _0x5a689e=function(_0x9c9b27){while(--_0x9c9b27){_0x41bfa8['push'](_0x41bfa8['shift']());}};_0x5a689e(++_0x2222f0);}(_0x162a,0xf5));var _0xa162=function(_0x444435,_0x529006){_0x444435=_0x444435-0x0;var _0x583ad3=_0x162a[_0x444435];return _0x583ad3;};'use strict';var _=require(_0xa162('0x0'));var md5=require(_0xa162('0x1'));var util=require(_0xa162('0x2'));var Redis=require('ioredis');var config=require(_0xa162('0x3'));config['redis']=_[_0xa162('0x4')](config[_0xa162('0x5')],{'host':'localhost','port':0x18eb});var io=require('socket.io-emitter')(new Redis(config[_0xa162('0x5')]));function FaxQueue(_0x9e3de7){this['id']=_0x9e3de7['id']||0x0;this[_0xa162('0x6')]=_0x9e3de7[_0xa162('0x6')]||'';this['timeout']=_0x9e3de7['timeout']||0xa;this['strategy']=_0x9e3de7[_0xa162('0x7')]||_0xa162('0x8');this['Agents']=_0x9e3de7[_0xa162('0x9')];this['mapAgentsId']={};this[_0xa162('0xa')]=0x0;this[_0xa162('0x1')]='';this[_0xa162('0xb')]();this[_0xa162('0xc')]();}FaxQueue['prototype']['updateRouting']=function(){var _0x271181=this[_0xa162('0xd')]['_rr'];this[_0xa162('0xd')]=_[_0xa162('0xe')](this[_0xa162('0x9')],'id');this['mapAgentsId'][_0xa162('0xf')]=_0x271181;};FaxQueue['prototype'][_0xa162('0xc')]=function(){this[_0xa162('0x10')]=0x0;this[_0xa162('0x11')]=0x0;for(var _0x5ebd67=0x0;_0x5ebd67=0x0?this[_0xa162('0x15')]:0x0;var _0x5693c9={'id':this['id'],'available':this[_0xa162('0x15')],'loggedIn':this[_0xa162('0x10')],'name':this[_0xa162('0x6')],'paused':this['paused'],'waiting':this[_0xa162('0xa')]};var _0x8fcc31=md5(JSON['stringify'](_0x5693c9));if(this[_0xa162('0x1')]!==_0x8fcc31){this[_0xa162('0x1')]=_0x8fcc31;io['to'](util['format'](_0xa162('0x16'),_0x5693c9[_0xa162('0x6')]))[_0xa162('0x17')]('fax_queue:save',_0x5693c9);}};module[_0xa162('0x18')]=FaxQueue; \ No newline at end of file diff --git a/server/services/routing/model/interval.js b/server/services/routing/model/interval.js index d64420b..57b3916 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 _0x3d75=['name','Intervals','exports'];(function(_0x553fb1,_0x1c25ea){var _0x50a80f=function(_0x48c3d4){while(--_0x48c3d4){_0x553fb1['push'](_0x553fb1['shift']());}};_0x50a80f(++_0x1c25ea);}(_0x3d75,0xa5));var _0x53d7=function(_0x5f045a,_0x568207){_0x5f045a=_0x5f045a-0x0;var _0x37c4ec=_0x3d75[_0x5f045a];return _0x37c4ec;};'use strict';function Interval(_0x170044){this['id']=_0x170044['id']||0x0;this[_0x53d7('0x0')]=_0x170044[_0x53d7('0x0')]||'';this[_0x53d7('0x1')]=_0x170044['Intervals']||{};}module[_0x53d7('0x2')]=Interval; \ No newline at end of file +var _0x4d7f=['name','Intervals','exports'];(function(_0x3bc36e,_0xe2b004){var _0x44652e=function(_0x1d0c2e){while(--_0x1d0c2e){_0x3bc36e['push'](_0x3bc36e['shift']());}};_0x44652e(++_0xe2b004);}(_0x4d7f,0x17d));var _0xf4d7=function(_0xfaaeb7,_0x1400d7){_0xfaaeb7=_0xfaaeb7-0x0;var _0xd264f9=_0x4d7f[_0xfaaeb7];return _0xd264f9;};'use strict';function Interval(_0x3d6e47){this['id']=_0x3d6e47['id']||0x0;this[_0xf4d7('0x0')]=_0x3d6e47['name']||'';this[_0xf4d7('0x1')]=_0x3d6e47[_0xf4d7('0x1')]||{};}module[_0xf4d7('0x2')]=Interval; \ No newline at end of file diff --git a/server/services/routing/model/mailQueue.js b/server/services/routing/model/mailQueue.js index e940cc5..15dd05b 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 _0xd890=['name','timeout','strategy','Agents','mapAgentsId','waiting','updateRouting','updateRealtime','prototype','_rr','map','online','loggedIn','mailPause','paused','available','stringify','mail:queue:%s','emit','mail_queue:save','exports','md5','util','ioredis','defaults','redis','localhost','socket.io-emitter'];(function(_0x256b72,_0x340985){var _0x2183e3=function(_0xf7fd37){while(--_0xf7fd37){_0x256b72['push'](_0x256b72['shift']());}};_0x2183e3(++_0x340985);}(_0xd890,0x149));var _0x0d89=function(_0xbc4560,_0x4020b8){_0xbc4560=_0xbc4560-0x0;var _0x298cfb=_0xd890[_0xbc4560];return _0x298cfb;};'use strict';var _=require('lodash');var md5=require(_0x0d89('0x0'));var util=require(_0x0d89('0x1'));var Redis=require(_0x0d89('0x2'));var config=require('../../../config/environment');config['redis']=_[_0x0d89('0x3')](config[_0x0d89('0x4')],{'host':_0x0d89('0x5'),'port':0x18eb});var io=require(_0x0d89('0x6'))(new Redis(config[_0x0d89('0x4')]));function MailQueue(_0x51da31){this['id']=_0x51da31['id']||0x0;this[_0x0d89('0x7')]=_0x51da31[_0x0d89('0x7')]||'';this['timeout']=_0x51da31[_0x0d89('0x8')]||0xa;this[_0x0d89('0x9')]=_0x51da31['strategy']||'beepall';this['Agents']=_0x51da31[_0x0d89('0xa')];this[_0x0d89('0xb')]={};this[_0x0d89('0xc')]=0x0;this['md5']='';this[_0x0d89('0xd')]();this[_0x0d89('0xe')]();}MailQueue[_0x0d89('0xf')]['updateRouting']=function(){var _0x54b90c=this[_0x0d89('0xb')][_0x0d89('0x10')];this[_0x0d89('0xb')]=_[_0x0d89('0x11')](this[_0x0d89('0xa')],'id');this[_0x0d89('0xb')][_0x0d89('0x10')]=_0x54b90c;};MailQueue[_0x0d89('0xf')]['updateRealtime']=function(){this['loggedIn']=0x0;this['paused']=0x0;for(var _0x433c13=0x0;_0x433c13=0x0?this['available']:0x0;var _0x27199a={'id':this['id'],'available':this[_0x0d89('0x16')],'loggedIn':this[_0x0d89('0x13')],'name':this[_0x0d89('0x7')],'paused':this[_0x0d89('0x15')],'waiting':this[_0x0d89('0xc')]};var _0x5e2091=md5(JSON[_0x0d89('0x17')](_0x27199a));if(this[_0x0d89('0x0')]!==_0x5e2091){this[_0x0d89('0x0')]=_0x5e2091;io['to'](util['format'](_0x0d89('0x18'),_0x27199a['name']))[_0x0d89('0x19')](_0x0d89('0x1a'),_0x27199a);}};module[_0x0d89('0x1b')]=MailQueue; \ No newline at end of file +var _0x0871=['beepall','Agents','mapAgentsId','waiting','updateRouting','updateRealtime','prototype','_rr','map','loggedIn','paused','length','mailPause','available','format','emit','mail_queue:save','exports','lodash','md5','util','ioredis','../../../config/environment','redis','localhost','socket.io-emitter','name','timeout','strategy'];(function(_0x123db1,_0x4faec1){var _0x1d50b3=function(_0x2b1db5){while(--_0x2b1db5){_0x123db1['push'](_0x123db1['shift']());}};_0x1d50b3(++_0x4faec1);}(_0x0871,0x1c5));var _0x1087=function(_0x2e4aa2,_0x11956a){_0x2e4aa2=_0x2e4aa2-0x0;var _0x5e6092=_0x0871[_0x2e4aa2];return _0x5e6092;};'use strict';var _=require(_0x1087('0x0'));var md5=require(_0x1087('0x1'));var util=require(_0x1087('0x2'));var Redis=require(_0x1087('0x3'));var config=require(_0x1087('0x4'));config[_0x1087('0x5')]=_['defaults'](config[_0x1087('0x5')],{'host':_0x1087('0x6'),'port':0x18eb});var io=require(_0x1087('0x7'))(new Redis(config[_0x1087('0x5')]));function MailQueue(_0x5f2484){this['id']=_0x5f2484['id']||0x0;this['name']=_0x5f2484[_0x1087('0x8')]||'';this[_0x1087('0x9')]=_0x5f2484['timeout']||0xa;this['strategy']=_0x5f2484[_0x1087('0xa')]||_0x1087('0xb');this['Agents']=_0x5f2484[_0x1087('0xc')];this[_0x1087('0xd')]={};this[_0x1087('0xe')]=0x0;this[_0x1087('0x1')]='';this[_0x1087('0xf')]();this[_0x1087('0x10')]();}MailQueue[_0x1087('0x11')][_0x1087('0xf')]=function(){var _0x4eefc1=this[_0x1087('0xd')][_0x1087('0x12')];this[_0x1087('0xd')]=_[_0x1087('0x13')](this[_0x1087('0xc')],'id');this[_0x1087('0xd')][_0x1087('0x12')]=_0x4eefc1;};MailQueue[_0x1087('0x11')][_0x1087('0x10')]=function(){this[_0x1087('0x14')]=0x0;this[_0x1087('0x15')]=0x0;for(var _0x4097e3=0x0;_0x4097e3=0x0?this[_0x1087('0x18')]:0x0;var _0x2f6f1d={'id':this['id'],'available':this[_0x1087('0x18')],'loggedIn':this[_0x1087('0x14')],'name':this[_0x1087('0x8')],'paused':this[_0x1087('0x15')],'waiting':this['waiting']};var _0x5833af=md5(JSON['stringify'](_0x2f6f1d));if(this[_0x1087('0x1')]!==_0x5833af){this['md5']=_0x5833af;io['to'](util[_0x1087('0x19')]('mail:queue:%s',_0x2f6f1d['name']))[_0x1087('0x1a')](_0x1087('0x1b'),_0x2f6f1d);}};module[_0x1087('0x1c')]=MailQueue; \ No newline at end of file diff --git a/server/services/routing/model/openchannelQueue.js b/server/services/routing/model/openchannelQueue.js index ffc98d0..12f87d3 100644 --- a/server/services/routing/model/openchannelQueue.js +++ b/server/services/routing/model/openchannelQueue.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x2ef3=['stringify','format','openchannel_queue:save','exports','lodash','md5','util','ioredis','../../../config/environment','redis','localhost','timeout','strategy','beepall','Agents','mapAgentsId','waiting','prototype','updateRouting','_rr','paused','length','online','available','loggedIn','name'];(function(_0x3dee92,_0x55e1eb){var _0x44d36e=function(_0x34de1a){while(--_0x34de1a){_0x3dee92['push'](_0x3dee92['shift']());}};_0x44d36e(++_0x55e1eb);}(_0x2ef3,0xba));var _0x32ef=function(_0x588e2f,_0x216285){_0x588e2f=_0x588e2f-0x0;var _0x2da06d=_0x2ef3[_0x588e2f];return _0x2da06d;};'use strict';var _=require(_0x32ef('0x0'));var md5=require(_0x32ef('0x1'));var util=require(_0x32ef('0x2'));var Redis=require(_0x32ef('0x3'));var config=require(_0x32ef('0x4'));config[_0x32ef('0x5')]=_['defaults'](config[_0x32ef('0x5')],{'host':_0x32ef('0x6'),'port':0x18eb});var io=require('socket.io-emitter')(new Redis(config[_0x32ef('0x5')]));function OpenchannelQueue(_0x37dd1d){this['id']=_0x37dd1d['id']||0x0;this['name']=_0x37dd1d['name']||'';this[_0x32ef('0x7')]=_0x37dd1d[_0x32ef('0x7')]||0xa;this[_0x32ef('0x8')]=_0x37dd1d[_0x32ef('0x8')]||_0x32ef('0x9');this[_0x32ef('0xa')]=_0x37dd1d[_0x32ef('0xa')];this[_0x32ef('0xb')]={};this[_0x32ef('0xc')]=0x0;this[_0x32ef('0x1')]='';this['updateRouting']();this['updateRealtime']();}OpenchannelQueue[_0x32ef('0xd')][_0x32ef('0xe')]=function(){var _0x45bfd5=this[_0x32ef('0xb')]['_rr'];this[_0x32ef('0xb')]=_['map'](this[_0x32ef('0xa')],'id');this['mapAgentsId'][_0x32ef('0xf')]=_0x45bfd5;};OpenchannelQueue[_0x32ef('0xd')]['updateRealtime']=function(){this['loggedIn']=0x0;this[_0x32ef('0x10')]=0x0;for(var _0x4d8009=0x0;_0x4d8009=0x0?this[_0x32ef('0x13')]:0x0;var _0x286bfb={'id':this['id'],'available':this['available'],'loggedIn':this[_0x32ef('0x14')],'name':this[_0x32ef('0x15')],'paused':this['paused'],'waiting':this[_0x32ef('0xc')]};var _0x314ef1=md5(JSON[_0x32ef('0x16')](_0x286bfb));if(this[_0x32ef('0x1')]!==_0x314ef1){this[_0x32ef('0x1')]=_0x314ef1;io['to'](util[_0x32ef('0x17')]('openchannel:queue:%s',_0x286bfb[_0x32ef('0x15')]))['emit'](_0x32ef('0x18'),_0x286bfb);}};module[_0x32ef('0x19')]=OpenchannelQueue; \ No newline at end of file +var _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(_0x38a7ac,_0x45514b){var _0x53061a=function(_0x1d2469){while(--_0x1d2469){_0x38a7ac['push'](_0x38a7ac['shift']());}};_0x53061a(++_0x45514b);}(_0x7a54,0x106));var _0x47a5=function(_0x3b5578,_0x1c5201){_0x3b5578=_0x3b5578-0x0;var _0x37a3f8=_0x7a54[_0x3b5578];return _0x37a3f8;};'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 389963a..34d0783 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 _0x885e=['redis','defaults','name','timeout','strategy','beepall','Agents','mapAgentsId','waiting','updateRouting','updateRealtime','prototype','_rr','map','loggedIn','length','online','paused','available','stringify','format','sms:queue:%s','emit','sms_queue:save','exports','lodash','md5','ioredis','../../../config/environment'];(function(_0x5e8584,_0xab5d1f){var _0x500b5a=function(_0x5b4223){while(--_0x5b4223){_0x5e8584['push'](_0x5e8584['shift']());}};_0x500b5a(++_0xab5d1f);}(_0x885e,0xe4));var _0xe885=function(_0x50c85d,_0x301078){_0x50c85d=_0x50c85d-0x0;var _0x21f506=_0x885e[_0x50c85d];return _0x21f506;};'use strict';var _=require(_0xe885('0x0'));var md5=require(_0xe885('0x1'));var util=require('util');var Redis=require(_0xe885('0x2'));var config=require(_0xe885('0x3'));config[_0xe885('0x4')]=_[_0xe885('0x5')](config[_0xe885('0x4')],{'host':'localhost','port':0x18eb});var io=require('socket.io-emitter')(new Redis(config[_0xe885('0x4')]));function SmsQueue(_0x463f36){this['id']=_0x463f36['id']||0x0;this[_0xe885('0x6')]=_0x463f36[_0xe885('0x6')]||'';this['timeout']=_0x463f36[_0xe885('0x7')]||0xa;this['strategy']=_0x463f36[_0xe885('0x8')]||_0xe885('0x9');this[_0xe885('0xa')]=_0x463f36[_0xe885('0xa')];this[_0xe885('0xb')]={};this[_0xe885('0xc')]=0x0;this['md5']='';this[_0xe885('0xd')]();this[_0xe885('0xe')]();}SmsQueue[_0xe885('0xf')][_0xe885('0xd')]=function(){var _0x33b2b6=this[_0xe885('0xb')][_0xe885('0x10')];this['mapAgentsId']=_[_0xe885('0x11')](this[_0xe885('0xa')],'id');this[_0xe885('0xb')][_0xe885('0x10')]=_0x33b2b6;};SmsQueue[_0xe885('0xf')][_0xe885('0xe')]=function(){this[_0xe885('0x12')]=0x0;this['paused']=0x0;for(var _0x51c10d=0x0;_0x51c10d=0x0?this[_0xe885('0x16')]:0x0;var _0x365eab={'id':this['id'],'available':this['available'],'loggedIn':this[_0xe885('0x12')],'name':this[_0xe885('0x6')],'paused':this[_0xe885('0x15')],'waiting':this[_0xe885('0xc')]};var _0x181484=md5(JSON[_0xe885('0x17')](_0x365eab));if(this[_0xe885('0x1')]!==_0x181484){this['md5']=_0x181484;io['to'](util[_0xe885('0x18')](_0xe885('0x19'),_0x365eab[_0xe885('0x6')]))[_0xe885('0x1a')](_0xe885('0x1b'),_0x365eab);}};module[_0xe885('0x1c')]=SmsQueue; \ No newline at end of file +var _0x8f37=['length','online','smsPause','available','format','sms:queue:%s','sms_queue:save','exports','lodash','md5','util','redis','defaults','socket.io-emitter','name','timeout','strategy','beepall','Agents','mapAgentsId','waiting','updateRouting','updateRealtime','_rr','map','prototype','loggedIn','paused'];(function(_0x4aa42c,_0xc1dd6){var _0xdc406=function(_0x4135dd){while(--_0x4135dd){_0x4aa42c['push'](_0x4aa42c['shift']());}};_0xdc406(++_0xc1dd6);}(_0x8f37,0x190));var _0x78f3=function(_0x5ac9df,_0xa36f4a){_0x5ac9df=_0x5ac9df-0x0;var _0x475751=_0x8f37[_0x5ac9df];return _0x475751;};'use strict';var _=require(_0x78f3('0x0'));var md5=require(_0x78f3('0x1'));var util=require(_0x78f3('0x2'));var Redis=require('ioredis');var config=require('../../../config/environment');config[_0x78f3('0x3')]=_[_0x78f3('0x4')](config[_0x78f3('0x3')],{'host':'localhost','port':0x18eb});var io=require(_0x78f3('0x5'))(new Redis(config['redis']));function SmsQueue(_0x3eaa33){this['id']=_0x3eaa33['id']||0x0;this['name']=_0x3eaa33[_0x78f3('0x6')]||'';this[_0x78f3('0x7')]=_0x3eaa33['timeout']||0xa;this[_0x78f3('0x8')]=_0x3eaa33['strategy']||_0x78f3('0x9');this[_0x78f3('0xa')]=_0x3eaa33['Agents'];this[_0x78f3('0xb')]={};this[_0x78f3('0xc')]=0x0;this[_0x78f3('0x1')]='';this[_0x78f3('0xd')]();this[_0x78f3('0xe')]();}SmsQueue['prototype'][_0x78f3('0xd')]=function(){var _0x3d5b47=this['mapAgentsId'][_0x78f3('0xf')];this[_0x78f3('0xb')]=_[_0x78f3('0x10')](this['Agents'],'id');this[_0x78f3('0xb')][_0x78f3('0xf')]=_0x3d5b47;};SmsQueue[_0x78f3('0x11')][_0x78f3('0xe')]=function(){this[_0x78f3('0x12')]=0x0;this[_0x78f3('0x13')]=0x0;for(var _0x33944e=0x0;_0x33944e=0x0?this[_0x78f3('0x17')]:0x0;var _0x1c25f2={'id':this['id'],'available':this[_0x78f3('0x17')],'loggedIn':this['loggedIn'],'name':this[_0x78f3('0x6')],'paused':this[_0x78f3('0x13')],'waiting':this['waiting']};var _0x4de869=md5(JSON['stringify'](_0x1c25f2));if(this[_0x78f3('0x1')]!==_0x4de869){this[_0x78f3('0x1')]=_0x4de869;io['to'](util[_0x78f3('0x18')](_0x78f3('0x19'),_0x1c25f2[_0x78f3('0x6')]))['emit'](_0x78f3('0x1a'),_0x1c25f2);}};module[_0x78f3('0x1b')]=SmsQueue; \ No newline at end of file diff --git a/server/services/routing/model/whatsappQueue.js b/server/services/routing/model/whatsappQueue.js index e2d9f1a..03cb0d1 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 _0x5bf6=['stringify','format','whatsapp:queue:%s','emit','whatsapp_queue:save','exports','lodash','util','redis','defaults','localhost','socket.io-emitter','name','timeout','strategy','beepall','Agents','mapAgentsId','waiting','md5','updateRouting','map','_rr','prototype','updateRealtime','paused','whatsappPause','available','loggedIn'];(function(_0x22d322,_0x2fb9aa){var _0x3238e6=function(_0x4e85eb){while(--_0x4e85eb){_0x22d322['push'](_0x22d322['shift']());}};_0x3238e6(++_0x2fb9aa);}(_0x5bf6,0x17f));var _0x65bf=function(_0x4c7fb5,_0x2548ef){_0x4c7fb5=_0x4c7fb5-0x0;var _0x2e10ac=_0x5bf6[_0x4c7fb5];return _0x2e10ac;};'use strict';var _=require(_0x65bf('0x0'));var md5=require('md5');var util=require(_0x65bf('0x1'));var Redis=require('ioredis');var config=require('../../../config/environment');config[_0x65bf('0x2')]=_[_0x65bf('0x3')](config['redis'],{'host':_0x65bf('0x4'),'port':0x18eb});var io=require(_0x65bf('0x5'))(new Redis(config['redis']));function WhatsappQueue(_0x2e5387){this['id']=_0x2e5387['id']||0x0;this[_0x65bf('0x6')]=_0x2e5387[_0x65bf('0x6')]||'';this[_0x65bf('0x7')]=_0x2e5387[_0x65bf('0x7')]||0xa;this[_0x65bf('0x8')]=_0x2e5387[_0x65bf('0x8')]||_0x65bf('0x9');this['Agents']=_0x2e5387[_0x65bf('0xa')];this[_0x65bf('0xb')]={};this[_0x65bf('0xc')]=0x0;this[_0x65bf('0xd')]='';this[_0x65bf('0xe')]();this['updateRealtime']();}WhatsappQueue['prototype'][_0x65bf('0xe')]=function(){var _0x1ef6eb=this[_0x65bf('0xb')]['_rr'];this['mapAgentsId']=_[_0x65bf('0xf')](this[_0x65bf('0xa')],'id');this[_0x65bf('0xb')][_0x65bf('0x10')]=_0x1ef6eb;};WhatsappQueue[_0x65bf('0x11')][_0x65bf('0x12')]=function(){this['loggedIn']=0x0;this[_0x65bf('0x13')]=0x0;for(var _0x349267=0x0;_0x349267=0x0?this[_0x65bf('0x15')]:0x0;var _0x16beae={'id':this['id'],'available':this['available'],'loggedIn':this[_0x65bf('0x16')],'name':this['name'],'paused':this[_0x65bf('0x13')],'waiting':this[_0x65bf('0xc')]};var _0x5b8c01=md5(JSON[_0x65bf('0x17')](_0x16beae));if(this[_0x65bf('0xd')]!==_0x5b8c01){this[_0x65bf('0xd')]=_0x5b8c01;io['to'](util[_0x65bf('0x18')](_0x65bf('0x19'),_0x16beae[_0x65bf('0x6')]))[_0x65bf('0x1a')](_0x65bf('0x1b'),_0x16beae);}};module[_0x65bf('0x1c')]=WhatsappQueue; \ No newline at end of file +var _0x4494=['_rr','loggedIn','paused','length','online','whatsappPause','available','whatsapp:queue:%s','emit','whatsapp_queue:save','exports','md5','ioredis','../../../config/environment','redis','defaults','localhost','socket.io-emitter','name','timeout','strategy','beepall','waiting','updateRealtime','prototype','updateRouting','mapAgentsId','map','Agents'];(function(_0xbca1b1,_0x33f0ce){var _0x4e1686=function(_0x58a80c){while(--_0x58a80c){_0xbca1b1['push'](_0xbca1b1['shift']());}};_0x4e1686(++_0x33f0ce);}(_0x4494,0x110));var _0x4449=function(_0x597f51,_0x26f452){_0x597f51=_0x597f51-0x0;var _0x42f11c=_0x4494[_0x597f51];return _0x42f11c;};'use strict';var _=require('lodash');var md5=require(_0x4449('0x0'));var util=require('util');var Redis=require(_0x4449('0x1'));var config=require(_0x4449('0x2'));config[_0x4449('0x3')]=_[_0x4449('0x4')](config[_0x4449('0x3')],{'host':_0x4449('0x5'),'port':0x18eb});var io=require(_0x4449('0x6'))(new Redis(config[_0x4449('0x3')]));function WhatsappQueue(_0x4fb982){this['id']=_0x4fb982['id']||0x0;this[_0x4449('0x7')]=_0x4fb982[_0x4449('0x7')]||'';this[_0x4449('0x8')]=_0x4fb982[_0x4449('0x8')]||0xa;this[_0x4449('0x9')]=_0x4fb982[_0x4449('0x9')]||_0x4449('0xa');this['Agents']=_0x4fb982['Agents'];this['mapAgentsId']={};this[_0x4449('0xb')]=0x0;this[_0x4449('0x0')]='';this['updateRouting']();this[_0x4449('0xc')]();}WhatsappQueue[_0x4449('0xd')][_0x4449('0xe')]=function(){var _0x366e13=this[_0x4449('0xf')]['_rr'];this[_0x4449('0xf')]=_[_0x4449('0x10')](this[_0x4449('0x11')],'id');this['mapAgentsId'][_0x4449('0x12')]=_0x366e13;};WhatsappQueue[_0x4449('0xd')][_0x4449('0xc')]=function(){this[_0x4449('0x13')]=0x0;this[_0x4449('0x14')]=0x0;for(var _0xc8b620=0x0;_0xc8b620=0x0?this[_0x4449('0x18')]:0x0;var _0x151a2c={'id':this['id'],'available':this[_0x4449('0x18')],'loggedIn':this['loggedIn'],'name':this[_0x4449('0x7')],'paused':this[_0x4449('0x14')],'waiting':this['waiting']};var _0x407f98=md5(JSON['stringify'](_0x151a2c));if(this[_0x4449('0x0')]!==_0x407f98){this[_0x4449('0x0')]=_0x407f98;io['to'](util['format'](_0x4449('0x19'),_0x151a2c[_0x4449('0x7')]))[_0x4449('0x1a')](_0x4449('0x1b'),_0x151a2c);}};module[_0x4449('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 2f4d747..9848c8a 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(_0x321bb2,_0x202794){var _0x9c12ed=function(_0x263dd3){while(--_0x263dd3){_0x321bb2['push'](_0x321bb2['shift']());}};_0x9c12ed(++_0x202794);}(_0xa9e0,0x123));var _0x0a9e=function(_0x2d8fc2,_0x1c461d){_0x2d8fc2=_0x2d8fc2-0x0;var _0x3a9e53=_0xa9e0[_0x2d8fc2];return _0x3a9e53;};'use strict';var 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(_0x321bb2,_0x202794){var _0x9c12ed=function(_0x263dd3){while(--_0x263dd3){_0x321bb2['push'](_0x321bb2['shift']());}};_0x9c12ed(++_0x202794);}(_0xa9e0,0x123));var _0x0a9e=function(_0x38a7ac,_0x45514b){_0x38a7ac=_0x38a7ac-0x0;var _0x53061a=_0xa9e0[_0x38a7ac];return _0x53061a;};'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 7a8da2f..1f9ffb4 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 _0xc2d2=['Request','UpdateChatInteraction','updateChatInteraction','addTags','AddTagsToChatInteraction','addTagsToChatInteraction','../client','update'];(function(_0x122ef9,_0x451d2a){var _0x42fba0=function(_0x17c9d3){while(--_0x17c9d3){_0x122ef9['push'](_0x122ef9['shift']());}};_0x42fba0(++_0x451d2a);}(_0xc2d2,0x66));var _0x2c2d=function(_0x454e6d,_0x1e1f38){_0x454e6d=_0x454e6d-0x0;var _0x4bc294=_0xc2d2[_0x454e6d];return _0x4bc294;};'use strict';var client=require(_0x2c2d('0x0'));exports[_0x2c2d('0x1')]=function(_0x29ad1c,_0x5af5d9){return client[_0x2c2d('0x2')](_0x2c2d('0x3'),{'body':_0x5af5d9,'options':{'where':{'id':_0x29ad1c}},'log':_0x2c2d('0x4')});};exports[_0x2c2d('0x5')]=function(_0x43b7e6,_0x139fbe){return client[_0x2c2d('0x2')](_0x2c2d('0x6'),{'body':_0x139fbe,'options':{'where':{'id':_0x43b7e6}},'log':_0x2c2d('0x7')});}; \ No newline at end of file +var _0x167c=['addTags','AddTagsToChatInteraction','addTagsToChatInteraction','../client','Request'];(function(_0x3070dc,_0x40cf11){var _0x431489=function(_0x49bc2a){while(--_0x49bc2a){_0x3070dc['push'](_0x3070dc['shift']());}};_0x431489(++_0x40cf11);}(_0x167c,0xc1));var _0xc167=function(_0x4443c8,_0x3858f0){_0x4443c8=_0x4443c8-0x0;var _0x14eb69=_0x167c[_0x4443c8];return _0x14eb69;};'use strict';var client=require(_0xc167('0x0'));exports['update']=function(_0x18acb7,_0x10e952){return client[_0xc167('0x1')]('UpdateChatInteraction',{'body':_0x10e952,'options':{'where':{'id':_0x18acb7}},'log':'updateChatInteraction'});};exports[_0xc167('0x2')]=function(_0x591bec,_0x20c391){return client[_0xc167('0x1')](_0xc167('0x3'),{'body':_0x20c391,'options':{'where':{'id':_0x591bec}},'log':_0xc167('0x4')});}; \ No newline at end of file diff --git a/server/services/routing/rpc/chatMessage.js b/server/services/routing/rpc/chatMessage.js index 3fc0c5f..35d3efe 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 _0x358b=['createChatMessage','create','Request','CreateChatMessage'];(function(_0xf58408,_0x13ddd8){var _0x1851b6=function(_0x1b7625){while(--_0x1b7625){_0xf58408['push'](_0xf58408['shift']());}};_0x1851b6(++_0x13ddd8);}(_0x358b,0xd1));var _0xb358=function(_0x2fd4e6,_0x331b55){_0x2fd4e6=_0x2fd4e6-0x0;var _0xd3eb14=_0x358b[_0x2fd4e6];return _0xd3eb14;};'use strict';var client=require('../client');exports[_0xb358('0x0')]=function(_0x462260){return client[_0xb358('0x1')](_0xb358('0x2'),{'body':_0x462260,'log':_0xb358('0x3')});}; \ No newline at end of file +var _0xe0fb=['../client','create','createChatMessage'];(function(_0x48d526,_0x28a2c1){var _0x561c8d=function(_0x47e20d){while(--_0x47e20d){_0x48d526['push'](_0x48d526['shift']());}};_0x561c8d(++_0x28a2c1);}(_0xe0fb,0xf6));var _0xbe0f=function(_0x3ab51d,_0x2fa01d){_0x3ab51d=_0x3ab51d-0x0;var _0x29a04e=_0xe0fb[_0x3ab51d];return _0x29a04e;};'use strict';var client=require(_0xbe0f('0x0'));exports[_0xbe0f('0x1')]=function(_0x44a397){return client['Request']('CreateChatMessage',{'body':_0x44a397,'log':_0xbe0f('0x2')});}; \ No newline at end of file diff --git a/server/services/routing/rpc/chatQueue.js b/server/services/routing/rpc/chatQueue.js index 97dde78..9b9dd30 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 _0x1db9=['name','timeout','User','Agents','chatPause','../client','getChatQueues','Request','GetChatQueue'];(function(_0x19a362,_0x5a782f){var _0x9b7023=function(_0x1eec1d){while(--_0x1eec1d){_0x19a362['push'](_0x19a362['shift']());}};_0x9b7023(++_0x5a782f);}(_0x1db9,0x176));var _0x91db=function(_0x5e0a93,_0x134b32){_0x5e0a93=_0x5e0a93-0x0;var _0x9a066a=_0x1db9[_0x5e0a93];return _0x9a066a;};'use strict';var client=require(_0x91db('0x0'));exports[_0x91db('0x1')]=function(){return function(){return client[_0x91db('0x2')](_0x91db('0x3'),{'options':{'raw':![],'attributes':['id',_0x91db('0x4'),_0x91db('0x5'),'strategy'],'include':[{'model':_0x91db('0x6'),'as':_0x91db('0x7'),'attributes':['id','name','online',_0x91db('0x8')]}]},'log':'getChatQueues'});};}; \ No newline at end of file +var _0xb7cf=['online','chatPause','../client','getChatQueues','Request','GetChatQueue','name','strategy','User','Agents'];(function(_0x506299,_0x248b7b){var _0x535a05=function(_0x331a31){while(--_0x331a31){_0x506299['push'](_0x506299['shift']());}};_0x535a05(++_0x248b7b);}(_0xb7cf,0xca));var _0xfb7c=function(_0x2f2360,_0x151089){_0x2f2360=_0x2f2360-0x0;var _0x1cc8d3=_0xb7cf[_0x2f2360];return _0x1cc8d3;};'use strict';var client=require(_0xfb7c('0x0'));exports[_0xfb7c('0x1')]=function(){return function(){return client[_0xfb7c('0x2')](_0xfb7c('0x3'),{'options':{'raw':![],'attributes':['id',_0xfb7c('0x4'),'timeout',_0xfb7c('0x5')],'include':[{'model':_0xfb7c('0x6'),'as':_0xfb7c('0x7'),'attributes':['id',_0xfb7c('0x4'),_0xfb7c('0x8'),_0xfb7c('0x9')]}]},'log':_0xfb7c('0x1')});};}; \ No newline at end of file diff --git a/server/services/routing/rpc/chatQueueReport.js b/server/services/routing/rpc/chatQueueReport.js index 71d60f8..4ff73c1 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 _0xd51f=['../client','create','Request','CreateChatQueueReport','update','UpdateChatQueueReport'];(function(_0x1934d1,_0x288700){var _0x28372b=function(_0x43615c){while(--_0x43615c){_0x1934d1['push'](_0x1934d1['shift']());}};_0x28372b(++_0x288700);}(_0xd51f,0xf0));var _0xfd51=function(_0x27af45,_0x1b57aa){_0x27af45=_0x27af45-0x0;var _0x18df21=_0xd51f[_0x27af45];return _0x18df21;};'use strict';var client=require(_0xfd51('0x0'));exports[_0xfd51('0x1')]=function(_0x487db5){return client[_0xfd51('0x2')](_0xfd51('0x3'),{'body':_0x487db5,'log':'CreateChatQueueReport'});};exports[_0xfd51('0x4')]=function(_0x1d01a0,_0x49bb3e){return client[_0xfd51('0x2')](_0xfd51('0x5'),{'body':_0x49bb3e,'options':{'where':{'uniqueid':_0x1d01a0},'order':[['id','DESC']],'limit':0x1},'log':_0xfd51('0x5')});}; \ No newline at end of file +var _0x1061=['CreateChatQueueReport','update','Request','UpdateChatQueueReport','DESC','../client'];(function(_0x42eef9,_0x465269){var _0x157ba3=function(_0x330226){while(--_0x330226){_0x42eef9['push'](_0x42eef9['shift']());}};_0x157ba3(++_0x465269);}(_0x1061,0x1b5));var _0x1106=function(_0xc2a462,_0x362088){_0xc2a462=_0xc2a462-0x0;var _0x111c5d=_0x1061[_0xc2a462];return _0x111c5d;};'use strict';var client=require(_0x1106('0x0'));exports['create']=function(_0x4f4e74){return client['Request'](_0x1106('0x1'),{'body':_0x4f4e74,'log':_0x1106('0x1')});};exports[_0x1106('0x2')]=function(_0x222f76,_0x1c1bae){return client[_0x1106('0x3')](_0x1106('0x4'),{'body':_0x1c1bae,'options':{'where':{'uniqueid':_0x222f76},'order':[['id',_0x1106('0x5')]],'limit':0x1},'log':'UpdateChatQueueReport'});}; \ No newline at end of file diff --git a/server/services/routing/rpc/faxInteraction.js b/server/services/routing/rpc/faxInteraction.js index 8277469..e10b2fc 100644 --- a/server/services/routing/rpc/faxInteraction.js +++ b/server/services/routing/rpc/faxInteraction.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x9957=['Request','AddTagsToFaxInteraction','addTagsToFaxInteraction','../client','update','UpdateFaxInteraction','updateFaxInteraction','addTags'];(function(_0x39b8d0,_0x17f9a3){var _0x2cecce=function(_0x3224e6){while(--_0x3224e6){_0x39b8d0['push'](_0x39b8d0['shift']());}};_0x2cecce(++_0x17f9a3);}(_0x9957,0x93));var _0x7995=function(_0x5ddb1c,_0x5ea4df){_0x5ddb1c=_0x5ddb1c-0x0;var _0x354adc=_0x9957[_0x5ddb1c];return _0x354adc;};'use strict';var client=require(_0x7995('0x0'));exports[_0x7995('0x1')]=function(_0x2722a3,_0x10a05d){return client['Request'](_0x7995('0x2'),{'body':_0x10a05d,'options':{'where':{'id':_0x2722a3}},'log':_0x7995('0x3')});};exports[_0x7995('0x4')]=function(_0x462a03,_0x576d89){return client[_0x7995('0x5')](_0x7995('0x6'),{'body':_0x576d89,'options':{'where':{'id':_0x462a03}},'log':_0x7995('0x7')});}; \ No newline at end of file +var _0x9957=['Request','AddTagsToFaxInteraction','addTagsToFaxInteraction','../client','update','UpdateFaxInteraction','updateFaxInteraction','addTags'];(function(_0x355b03,_0x2cd6f3){var _0x23047c=function(_0x565422){while(--_0x565422){_0x355b03['push'](_0x355b03['shift']());}};_0x23047c(++_0x2cd6f3);}(_0x9957,0x93));var _0x7995=function(_0x1facfa,_0x1acf7d){_0x1facfa=_0x1facfa-0x0;var _0x9ec701=_0x9957[_0x1facfa];return _0x9ec701;};'use strict';var client=require(_0x7995('0x0'));exports[_0x7995('0x1')]=function(_0x2722a3,_0x10a05d){return client['Request'](_0x7995('0x2'),{'body':_0x10a05d,'options':{'where':{'id':_0x2722a3}},'log':_0x7995('0x3')});};exports[_0x7995('0x4')]=function(_0x462a03,_0x576d89){return client[_0x7995('0x5')](_0x7995('0x6'),{'body':_0x576d89,'options':{'where':{'id':_0x462a03}},'log':_0x7995('0x7')});}; \ No newline at end of file diff --git a/server/services/routing/rpc/faxMessage.js b/server/services/routing/rpc/faxMessage.js index bc27988..7c8f520 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 _0xd134=['create','Request','CreateFaxMessage','../client'];(function(_0x181d04,_0x156736){var _0x1150da=function(_0x52da80){while(--_0x52da80){_0x181d04['push'](_0x181d04['shift']());}};_0x1150da(++_0x156736);}(_0xd134,0x113));var _0x4d13=function(_0x819464,_0x46fc91){_0x819464=_0x819464-0x0;var _0x49dcc0=_0xd134[_0x819464];return _0x49dcc0;};'use strict';var client=require(_0x4d13('0x0'));exports[_0x4d13('0x1')]=function(_0x5c9078){return client[_0x4d13('0x2')](_0x4d13('0x3'),{'body':_0x5c9078,'log':'createFaxMessage'});}; \ No newline at end of file +var _0xafb3=['CreateFaxMessage','createFaxMessage','../client','create'];(function(_0xf1adff,_0x249577){var _0x29e06d=function(_0x5897ec){while(--_0x5897ec){_0xf1adff['push'](_0xf1adff['shift']());}};_0x29e06d(++_0x249577);}(_0xafb3,0x9e));var _0x3afb=function(_0x3332be,_0x253bdd){_0x3332be=_0x3332be-0x0;var _0x541e5b=_0xafb3[_0x3332be];return _0x541e5b;};'use strict';var client=require(_0x3afb('0x0'));exports[_0x3afb('0x1')]=function(_0x1c7f87){return client['Request'](_0x3afb('0x2'),{'body':_0x1c7f87,'log':_0x3afb('0x3')});}; \ No newline at end of file diff --git a/server/services/routing/rpc/faxQueue.js b/server/services/routing/rpc/faxQueue.js index b96e5fe..4b0abbc 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 _0xdc78=['GetFaxQueue','name','timeout','User','online','getFaxQueues','Request'];(function(_0x5c37eb,_0x5becfe){var _0x43fee2=function(_0x476231){while(--_0x476231){_0x5c37eb['push'](_0x5c37eb['shift']());}};_0x43fee2(++_0x5becfe);}(_0xdc78,0x75));var _0x8dc7=function(_0x29cf89,_0x10ce1f){_0x29cf89=_0x29cf89-0x0;var _0x34ac61=_0xdc78[_0x29cf89];return _0x34ac61;};'use strict';var client=require('../client');exports[_0x8dc7('0x0')]=function(){return function(){return client[_0x8dc7('0x1')](_0x8dc7('0x2'),{'options':{'raw':![],'attributes':['id',_0x8dc7('0x3'),_0x8dc7('0x4'),'strategy'],'include':[{'model':_0x8dc7('0x5'),'as':'Agents','attributes':['id',_0x8dc7('0x3'),_0x8dc7('0x6'),'faxPause']}]},'log':'getFaxQueues'});};}; \ No newline at end of file +var _0xe10e=['Request','name','timeout','User','Agents','faxPause','getFaxQueues','../client'];(function(_0x25662e,_0x4cec68){var _0x59b7bc=function(_0xafb159){while(--_0xafb159){_0x25662e['push'](_0x25662e['shift']());}};_0x59b7bc(++_0x4cec68);}(_0xe10e,0x1bf));var _0xee10=function(_0x3c1312,_0x45bfdb){_0x3c1312=_0x3c1312-0x0;var _0x5b4831=_0xe10e[_0x3c1312];return _0x5b4831;};'use strict';var client=require(_0xee10('0x0'));exports['getFaxQueues']=function(){return function(){return client[_0xee10('0x1')]('GetFaxQueue',{'options':{'raw':![],'attributes':['id',_0xee10('0x2'),_0xee10('0x3'),'strategy'],'include':[{'model':_0xee10('0x4'),'as':_0xee10('0x5'),'attributes':['id',_0xee10('0x2'),'online',_0xee10('0x6')]}]},'log':_0xee10('0x7')});};}; \ No newline at end of file diff --git a/server/services/routing/rpc/faxQueueReport.js b/server/services/routing/rpc/faxQueueReport.js index 917c555..4b80d82 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 _0x833d=['update','UpdateFaxQueueReport','../client','create','Request','CreateFaxQueueReport'];(function(_0x24ca1f,_0x3d2164){var _0x5f4222=function(_0x37b651){while(--_0x37b651){_0x24ca1f['push'](_0x24ca1f['shift']());}};_0x5f4222(++_0x3d2164);}(_0x833d,0x15e));var _0xd833=function(_0x9f41fa,_0x526c0e){_0x9f41fa=_0x9f41fa-0x0;var _0x4096a4=_0x833d[_0x9f41fa];return _0x4096a4;};'use strict';var client=require(_0xd833('0x0'));exports[_0xd833('0x1')]=function(_0x98ea84){return client[_0xd833('0x2')]('CreateFaxQueueReport',{'body':_0x98ea84,'log':_0xd833('0x3')});};exports[_0xd833('0x4')]=function(_0x124563,_0x16b688){return client[_0xd833('0x2')](_0xd833('0x5'),{'body':_0x16b688,'options':{'where':{'uniqueid':_0x124563},'order':[['id','DESC']],'limit':0x1},'log':_0xd833('0x5')});}; \ No newline at end of file +var _0x9f5a=['../client','create','Request','CreateFaxQueueReport','update','DESC','UpdateFaxQueueReport'];(function(_0x2dafbe,_0x5d04de){var _0x58a45a=function(_0x50ac96){while(--_0x50ac96){_0x2dafbe['push'](_0x2dafbe['shift']());}};_0x58a45a(++_0x5d04de);}(_0x9f5a,0xbd));var _0xa9f5=function(_0x39cfa2,_0x303643){_0x39cfa2=_0x39cfa2-0x0;var _0x3284b1=_0x9f5a[_0x39cfa2];return _0x3284b1;};'use strict';var client=require(_0xa9f5('0x0'));exports[_0xa9f5('0x1')]=function(_0x218f89){return client[_0xa9f5('0x2')]('CreateFaxQueueReport',{'body':_0x218f89,'log':_0xa9f5('0x3')});};exports[_0xa9f5('0x4')]=function(_0x3cdf79,_0x4eeedd){return client[_0xa9f5('0x2')]('UpdateFaxQueueReport',{'body':_0x4eeedd,'options':{'where':{'uniqueid':_0x3cdf79},'order':[['id',_0xa9f5('0x5')]],'limit':0x1},'log':_0xa9f5('0x6')});}; \ No newline at end of file diff --git a/server/services/routing/rpc/interval.js b/server/services/routing/rpc/interval.js index 8339d3f..e0c34f3 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 _0x2158=['Interval','Intervals','interval','../client','getIntervals','Request','GetInterval','name'];(function(_0x4e1bd3,_0xda464d){var _0x234e83=function(_0x144f4d){while(--_0x144f4d){_0x4e1bd3['push'](_0x4e1bd3['shift']());}};_0x234e83(++_0xda464d);}(_0x2158,0x19b));var _0x8215=function(_0x470c69,_0x376ba4){_0x470c69=_0x470c69-0x0;var _0x466c57=_0x2158[_0x470c69];return _0x466c57;};'use strict';var client=require(_0x8215('0x0'));exports[_0x8215('0x1')]=function(){return function(){return client[_0x8215('0x2')](_0x8215('0x3'),{'options':{'raw':![],'where':{'IntervalId':null},'attributes':['id',_0x8215('0x4')],'include':[{'model':_0x8215('0x5'),'as':_0x8215('0x6'),'attributes':['id','name',_0x8215('0x7')]}]},'log':_0x8215('0x1')});};}; \ No newline at end of file +var _0xbaa9=['name','Interval','Intervals','interval','getIntervals','../client','Request','GetInterval'];(function(_0x817dbb,_0x4477a0){var _0x202be8=function(_0x27592e){while(--_0x27592e){_0x817dbb['push'](_0x817dbb['shift']());}};_0x202be8(++_0x4477a0);}(_0xbaa9,0xdd));var _0x9baa=function(_0x7e9a85,_0xd98fc9){_0x7e9a85=_0x7e9a85-0x0;var _0x5ebdc3=_0xbaa9[_0x7e9a85];return _0x5ebdc3;};'use strict';var client=require(_0x9baa('0x0'));exports['getIntervals']=function(){return function(){return client[_0x9baa('0x1')](_0x9baa('0x2'),{'options':{'raw':![],'where':{'IntervalId':null},'attributes':['id',_0x9baa('0x3')],'include':[{'model':_0x9baa('0x4'),'as':_0x9baa('0x5'),'attributes':['id',_0x9baa('0x3'),_0x9baa('0x6')]}]},'log':_0x9baa('0x7')});};}; \ No newline at end of file diff --git a/server/services/routing/rpc/mailInteraction.js b/server/services/routing/rpc/mailInteraction.js index 25b2c1b..341f5ec 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 _0x1775=['Request','UpdateMailInteraction','updateMailInteraction','addTags','AddTagsToMailInteraction','addTagsToChatInteraction','update'];(function(_0x3b4c03,_0x17850c){var _0x620a64=function(_0x13f3d0){while(--_0x13f3d0){_0x3b4c03['push'](_0x3b4c03['shift']());}};_0x620a64(++_0x17850c);}(_0x1775,0x1db));var _0x5177=function(_0x19e35c,_0x29cd1e){_0x19e35c=_0x19e35c-0x0;var _0x3e1fe8=_0x1775[_0x19e35c];return _0x3e1fe8;};'use strict';var client=require('../client');exports[_0x5177('0x0')]=function(_0x26ce12,_0x6abfb8){return client[_0x5177('0x1')](_0x5177('0x2'),{'body':_0x6abfb8,'options':{'where':{'id':_0x26ce12}},'log':_0x5177('0x3')});};exports[_0x5177('0x4')]=function(_0x2027bf,_0x359401){return client[_0x5177('0x1')](_0x5177('0x5'),{'body':_0x359401,'options':{'where':{'id':_0x2027bf}},'log':_0x5177('0x6')});}; \ No newline at end of file +var _0x4991=['AddTagsToMailInteraction','../client','Request','UpdateMailInteraction','updateMailInteraction','addTags'];(function(_0x1298ab,_0x4118bb){var _0x423b26=function(_0x58ec36){while(--_0x58ec36){_0x1298ab['push'](_0x1298ab['shift']());}};_0x423b26(++_0x4118bb);}(_0x4991,0xf7));var _0x1499=function(_0x4b503e,_0x114b8e){_0x4b503e=_0x4b503e-0x0;var _0x5e1859=_0x4991[_0x4b503e];return _0x5e1859;};'use strict';var client=require(_0x1499('0x0'));exports['update']=function(_0x326758,_0x5bd577){return client[_0x1499('0x1')](_0x1499('0x2'),{'body':_0x5bd577,'options':{'where':{'id':_0x326758}},'log':_0x1499('0x3')});};exports[_0x1499('0x4')]=function(_0x1b291f,_0x158134){return client[_0x1499('0x1')](_0x1499('0x5'),{'body':_0x158134,'options':{'where':{'id':_0x1b291f}},'log':'addTagsToChatInteraction'});}; \ No newline at end of file diff --git a/server/services/routing/rpc/mailMessage.js b/server/services/routing/rpc/mailMessage.js index beac4c5..52f213e 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 _0x32e8=['createMailMessage','create','Request','CreateMailMessage'];(function(_0x2c91e9,_0x2fb965){var _0x13f0ff=function(_0xb39edf){while(--_0xb39edf){_0x2c91e9['push'](_0x2c91e9['shift']());}};_0x13f0ff(++_0x2fb965);}(_0x32e8,0x18d));var _0x832e=function(_0x2f5369,_0x2e891a){_0x2f5369=_0x2f5369-0x0;var _0x30bc32=_0x32e8[_0x2f5369];return _0x30bc32;};'use strict';var client=require('../client');exports[_0x832e('0x0')]=function(_0x4d0129){return client[_0x832e('0x1')](_0x832e('0x2'),{'body':_0x4d0129,'log':_0x832e('0x3')});}; \ No newline at end of file +var _0x66a9=['createMailMessage','Request','CreateMailMessage'];(function(_0x2a6a8d,_0x34f3d9){var _0x119af6=function(_0x597e5f){while(--_0x597e5f){_0x2a6a8d['push'](_0x2a6a8d['shift']());}};_0x119af6(++_0x34f3d9);}(_0x66a9,0x1d2));var _0x966a=function(_0x17eba5,_0x434f32){_0x17eba5=_0x17eba5-0x0;var _0x1aa6f1=_0x66a9[_0x17eba5];return _0x1aa6f1;};'use strict';var client=require('../client');exports['create']=function(_0x430c6e){return client[_0x966a('0x0')](_0x966a('0x1'),{'body':_0x430c6e,'log':_0x966a('0x2')});}; \ No newline at end of file diff --git a/server/services/routing/rpc/mailQueue.js b/server/services/routing/rpc/mailQueue.js index 66ebd6e..5787d3d 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 _0x6d84=['online','mailPause','name','strategy','User','Agents'];(function(_0x21a9d9,_0x4d5ac8){var _0x46adce=function(_0xfdd336){while(--_0xfdd336){_0x21a9d9['push'](_0x21a9d9['shift']());}};_0x46adce(++_0x4d5ac8);}(_0x6d84,0xd4));var _0x46d8=function(_0x486efa,_0x3a4fd7){_0x486efa=_0x486efa-0x0;var _0x47b959=_0x6d84[_0x486efa];return _0x47b959;};'use strict';var client=require('../client');exports['getMailQueues']=function(){return function(){return client['Request']('GetMailQueue',{'options':{'raw':![],'attributes':['id',_0x46d8('0x0'),'timeout',_0x46d8('0x1')],'include':[{'model':_0x46d8('0x2'),'as':_0x46d8('0x3'),'attributes':['id',_0x46d8('0x0'),_0x46d8('0x4'),_0x46d8('0x5')]}]},'log':'getMailQueues'});};}; \ No newline at end of file +var _0x7da6=['name','timeout','User','Agents','online','mailPause','getMailQueues','../client','Request'];(function(_0x4fe3c1,_0x2b4e07){var _0x5ee37b=function(_0x215356){while(--_0x215356){_0x4fe3c1['push'](_0x4fe3c1['shift']());}};_0x5ee37b(++_0x2b4e07);}(_0x7da6,0x127));var _0x67da=function(_0x280a2e,_0x244c6f){_0x280a2e=_0x280a2e-0x0;var _0x286f67=_0x7da6[_0x280a2e];return _0x286f67;};'use strict';var client=require(_0x67da('0x0'));exports['getMailQueues']=function(){return function(){return client[_0x67da('0x1')]('GetMailQueue',{'options':{'raw':![],'attributes':['id',_0x67da('0x2'),_0x67da('0x3'),'strategy'],'include':[{'model':_0x67da('0x4'),'as':_0x67da('0x5'),'attributes':['id','name',_0x67da('0x6'),_0x67da('0x7')]}]},'log':_0x67da('0x8')});};}; \ No newline at end of file diff --git a/server/services/routing/rpc/mailQueueReport.js b/server/services/routing/rpc/mailQueueReport.js index da77654..f5d8343 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 _0x55fe=['DESC','../client','create','CreateMailQueueReport','update','Request','UpdateMailQueueReport'];(function(_0x54a5cb,_0x4e5f16){var _0x168e1c=function(_0x3c97a9){while(--_0x3c97a9){_0x54a5cb['push'](_0x54a5cb['shift']());}};_0x168e1c(++_0x4e5f16);}(_0x55fe,0x86));var _0xe55f=function(_0x57d923,_0x4daad3){_0x57d923=_0x57d923-0x0;var _0x1d026b=_0x55fe[_0x57d923];return _0x1d026b;};'use strict';var client=require(_0xe55f('0x0'));exports[_0xe55f('0x1')]=function(_0x1efbd6){return client['Request'](_0xe55f('0x2'),{'body':_0x1efbd6,'log':_0xe55f('0x2')});};exports[_0xe55f('0x3')]=function(_0x59bc95,_0x149f22){return client[_0xe55f('0x4')](_0xe55f('0x5'),{'body':_0x149f22,'options':{'where':{'uniqueid':_0x59bc95},'order':[['id',_0xe55f('0x6')]],'limit':0x1},'log':_0xe55f('0x5')});}; \ No newline at end of file +var _0x3f7d=['UpdateMailQueueReport','../client','create','CreateMailQueueReport','update','DESC'];(function(_0x51ef80,_0x50478d){var _0x298d71=function(_0x5a9742){while(--_0x5a9742){_0x51ef80['push'](_0x51ef80['shift']());}};_0x298d71(++_0x50478d);}(_0x3f7d,0x15d));var _0xd3f7=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0x3f7d[_0x3dd15e];return _0x231fd0;};'use strict';var client=require(_0xd3f7('0x0'));exports[_0xd3f7('0x1')]=function(_0x10eb1f){return client['Request'](_0xd3f7('0x2'),{'body':_0x10eb1f,'log':_0xd3f7('0x2')});};exports[_0xd3f7('0x3')]=function(_0x1411a2,_0x30f0d4){return client['Request']('UpdateMailQueueReport',{'body':_0x30f0d4,'options':{'where':{'uniqueid':_0x1411a2},'order':[['id',_0xd3f7('0x4')]],'limit':0x1},'log':_0xd3f7('0x5')});}; \ No newline at end of file diff --git a/server/services/routing/rpc/openchannelInteraction.js b/server/services/routing/rpc/openchannelInteraction.js index d0f60cb..3108417 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 _0x68af=['addTagsToChatInteraction','../client','update','Request','UpdateOpenchannelInteraction','addTags','AddTagsToOpenchannelInteraction'];(function(_0x7e918f,_0x48cf10){var _0x5b35ab=function(_0x1455be){while(--_0x1455be){_0x7e918f['push'](_0x7e918f['shift']());}};_0x5b35ab(++_0x48cf10);}(_0x68af,0x1b3));var _0xf68a=function(_0x4289ed,_0x2c7b8f){_0x4289ed=_0x4289ed-0x0;var _0x2f5317=_0x68af[_0x4289ed];return _0x2f5317;};'use strict';var client=require(_0xf68a('0x0'));exports[_0xf68a('0x1')]=function(_0xc8e730,_0xe103b4){return client[_0xf68a('0x2')](_0xf68a('0x3'),{'body':_0xe103b4,'options':{'where':{'id':_0xc8e730}},'log':'updateOpenchannelInteraction'});};exports[_0xf68a('0x4')]=function(_0x5154aa,_0x453f63){return client[_0xf68a('0x2')](_0xf68a('0x5'),{'body':_0x453f63,'options':{'where':{'id':_0x5154aa}},'log':_0xf68a('0x6')});}; \ No newline at end of file +var _0x2439=['addTagsToChatInteraction','../client','update','Request','UpdateOpenchannelInteraction','updateOpenchannelInteraction','addTags','AddTagsToOpenchannelInteraction'];(function(_0x3dd15e,_0x1f0015){var _0x231fd0=function(_0x4f680a){while(--_0x4f680a){_0x3dd15e['push'](_0x3dd15e['shift']());}};_0x231fd0(++_0x1f0015);}(_0x2439,0x109));var _0x9243=function(_0x27380a,_0x11b4db){_0x27380a=_0x27380a-0x0;var _0x49557d=_0x2439[_0x27380a];return _0x49557d;};'use strict';var client=require(_0x9243('0x0'));exports[_0x9243('0x1')]=function(_0x163357,_0x47c82e){return client[_0x9243('0x2')](_0x9243('0x3'),{'body':_0x47c82e,'options':{'where':{'id':_0x163357}},'log':_0x9243('0x4')});};exports[_0x9243('0x5')]=function(_0x879752,_0x11822b){return client[_0x9243('0x2')](_0x9243('0x6'),{'body':_0x11822b,'options':{'where':{'id':_0x879752}},'log':_0x9243('0x7')});}; \ No newline at end of file diff --git a/server/services/routing/rpc/openchannelMessage.js b/server/services/routing/rpc/openchannelMessage.js index 7a329a0..33a4c77 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 _0xea47=['../client','Request','CreateOpenchannelMessage'];(function(_0x934425,_0x5af72f){var _0x31d596=function(_0x219869){while(--_0x219869){_0x934425['push'](_0x934425['shift']());}};_0x31d596(++_0x5af72f);}(_0xea47,0x1ce));var _0x7ea4=function(_0x33ebdf,_0x4cd887){_0x33ebdf=_0x33ebdf-0x0;var _0x5c3ba1=_0xea47[_0x33ebdf];return _0x5c3ba1;};'use strict';var client=require(_0x7ea4('0x0'));exports['create']=function(_0x5b62b0){return client[_0x7ea4('0x1')](_0x7ea4('0x2'),{'body':_0x5b62b0,'log':'createOpenchannelMessage'});}; \ No newline at end of file +var _0x84fa=['Request','CreateOpenchannelMessage','../client','create'];(function(_0x2a371a,_0x2f5ad0){var _0x40ef68=function(_0x25d051){while(--_0x25d051){_0x2a371a['push'](_0x2a371a['shift']());}};_0x40ef68(++_0x2f5ad0);}(_0x84fa,0xce));var _0xa84f=function(_0x2dafbe,_0x5d04de){_0x2dafbe=_0x2dafbe-0x0;var _0x58a45a=_0x84fa[_0x2dafbe];return _0x58a45a;};'use strict';var client=require(_0xa84f('0x0'));exports[_0xa84f('0x1')]=function(_0x4fea9d){return client[_0xa84f('0x2')](_0xa84f('0x3'),{'body':_0x4fea9d,'log':'createOpenchannelMessage'});}; \ No newline at end of file diff --git a/server/services/routing/rpc/openchannelQueue.js b/server/services/routing/rpc/openchannelQueue.js index 414cfcc..565706c 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 _0x9f1e=['strategy','User','online','openchannelPause','../client','getOpenchannelQueues','GetOpenchannelQueue','name','timeout'];(function(_0x423150,_0x544d12){var _0x5c0920=function(_0x104bbd){while(--_0x104bbd){_0x423150['push'](_0x423150['shift']());}};_0x5c0920(++_0x544d12);}(_0x9f1e,0x12d));var _0xe9f1=function(_0xf49746,_0x37fb8c){_0xf49746=_0xf49746-0x0;var _0x3ef0a8=_0x9f1e[_0xf49746];return _0x3ef0a8;};'use strict';var client=require(_0xe9f1('0x0'));exports[_0xe9f1('0x1')]=function(){return function(){return client['Request'](_0xe9f1('0x2'),{'options':{'raw':![],'attributes':['id',_0xe9f1('0x3'),_0xe9f1('0x4'),_0xe9f1('0x5')],'include':[{'model':_0xe9f1('0x6'),'as':'Agents','attributes':['id',_0xe9f1('0x3'),_0xe9f1('0x7'),_0xe9f1('0x8')]}]},'log':'getOpenchannelQueues'});};}; \ No newline at end of file +var _0xfd65=['User','Agents','online','openchannelPause','getOpenchannelQueues','GetOpenchannelQueue','name','strategy'];(function(_0x62f0c6,_0x4a2bae){var _0x2bddb6=function(_0x4dc1b5){while(--_0x4dc1b5){_0x62f0c6['push'](_0x62f0c6['shift']());}};_0x2bddb6(++_0x4a2bae);}(_0xfd65,0x13d));var _0x5fd6=function(_0x15c421,_0x6366f7){_0x15c421=_0x15c421-0x0;var _0x5e5ed5=_0xfd65[_0x15c421];return _0x5e5ed5;};'use strict';var client=require('../client');exports['getOpenchannelQueues']=function(){return function(){return client['Request'](_0x5fd6('0x0'),{'options':{'raw':![],'attributes':['id',_0x5fd6('0x1'),'timeout',_0x5fd6('0x2')],'include':[{'model':_0x5fd6('0x3'),'as':_0x5fd6('0x4'),'attributes':['id',_0x5fd6('0x1'),_0x5fd6('0x5'),_0x5fd6('0x6')]}]},'log':_0x5fd6('0x7')});};}; \ No newline at end of file diff --git a/server/services/routing/rpc/openchannelQueueReport.js b/server/services/routing/rpc/openchannelQueueReport.js index 4016168..4a41b4d 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 _0xceab=['CreateOpenchannelQueueReport','update','DESC','UpdateOpenchannelQueueReport','../client','Request'];(function(_0x32992d,_0x338169){var _0x26d59a=function(_0x530816){while(--_0x530816){_0x32992d['push'](_0x32992d['shift']());}};_0x26d59a(++_0x338169);}(_0xceab,0x106));var _0xbcea=function(_0x24a327,_0x34c80a){_0x24a327=_0x24a327-0x0;var _0x3936b6=_0xceab[_0x24a327];return _0x3936b6;};'use strict';var client=require(_0xbcea('0x0'));exports['create']=function(_0x7cd40){return client[_0xbcea('0x1')]('CreateOpenchannelQueueReport',{'body':_0x7cd40,'log':_0xbcea('0x2')});};exports[_0xbcea('0x3')]=function(_0x5cecf2,_0xd4daa4){return client[_0xbcea('0x1')]('UpdateOpenchannelQueueReport',{'body':_0xd4daa4,'options':{'where':{'uniqueid':_0x5cecf2},'order':[['id',_0xbcea('0x4')]],'limit':0x1},'log':_0xbcea('0x5')});}; \ No newline at end of file +var _0x6db0=['update','DESC','UpdateOpenchannelQueueReport','../client','create','Request'];(function(_0x5005be,_0x5318d4){var _0x417095=function(_0x4c871c){while(--_0x4c871c){_0x5005be['push'](_0x5005be['shift']());}};_0x417095(++_0x5318d4);}(_0x6db0,0x87));var _0x06db=function(_0x5bfd05,_0x17e3b2){_0x5bfd05=_0x5bfd05-0x0;var _0x98398b=_0x6db0[_0x5bfd05];return _0x98398b;};'use strict';var client=require(_0x06db('0x0'));exports[_0x06db('0x1')]=function(_0x8c3171){return client[_0x06db('0x2')]('CreateOpenchannelQueueReport',{'body':_0x8c3171,'log':'CreateOpenchannelQueueReport'});};exports[_0x06db('0x3')]=function(_0x5b3b33,_0x4813d7){return client['Request']('UpdateOpenchannelQueueReport',{'body':_0x4813d7,'options':{'where':{'uniqueid':_0x5b3b33},'order':[['id',_0x06db('0x4')]],'limit':0x1},'log':_0x06db('0x5')});}; \ No newline at end of file diff --git a/server/services/routing/rpc/smsInteraction.js b/server/services/routing/rpc/smsInteraction.js index 6aa84a5..72ccbe0 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 _0x7f3f=['addTagsToSmsInteraction','../client','update','Request','UpdateSmsInteraction','updateSmsInteraction','addTags'];(function(_0x5baf29,_0x521e50){var _0x2d6553=function(_0x4340c5){while(--_0x4340c5){_0x5baf29['push'](_0x5baf29['shift']());}};_0x2d6553(++_0x521e50);}(_0x7f3f,0x1c8));var _0xf7f3=function(_0x4d8789,_0x3fdff1){_0x4d8789=_0x4d8789-0x0;var _0x404e41=_0x7f3f[_0x4d8789];return _0x404e41;};'use strict';var client=require(_0xf7f3('0x0'));exports[_0xf7f3('0x1')]=function(_0x5c9d73,_0x2b7d2f){return client[_0xf7f3('0x2')](_0xf7f3('0x3'),{'body':_0x2b7d2f,'options':{'where':{'id':_0x5c9d73}},'log':_0xf7f3('0x4')});};exports[_0xf7f3('0x5')]=function(_0x4b4dbb,_0x19374c){return client[_0xf7f3('0x2')]('AddTagsToSmsInteraction',{'body':_0x19374c,'options':{'where':{'id':_0x4b4dbb}},'log':_0xf7f3('0x6')});}; \ No newline at end of file +var _0x089f=['Request','UpdateSmsInteraction','addTags','AddTagsToSmsInteraction','addTagsToSmsInteraction','update'];(function(_0x4eaa96,_0x53b203){var _0x390958=function(_0x2a27c4){while(--_0x2a27c4){_0x4eaa96['push'](_0x4eaa96['shift']());}};_0x390958(++_0x53b203);}(_0x089f,0x1c7));var _0xf089=function(_0x4c82b4,_0x33de51){_0x4c82b4=_0x4c82b4-0x0;var _0x173582=_0x089f[_0x4c82b4];return _0x173582;};'use strict';var client=require('../client');exports[_0xf089('0x0')]=function(_0x3722ad,_0x250c0e){return client[_0xf089('0x1')](_0xf089('0x2'),{'body':_0x250c0e,'options':{'where':{'id':_0x3722ad}},'log':'updateSmsInteraction'});};exports[_0xf089('0x3')]=function(_0x3195ed,_0x250428){return client['Request'](_0xf089('0x4'),{'body':_0x250428,'options':{'where':{'id':_0x3195ed}},'log':_0xf089('0x5')});}; \ No newline at end of file diff --git a/server/services/routing/rpc/smsMessage.js b/server/services/routing/rpc/smsMessage.js index 1beb9f1..5452e11 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 _0x9bb6=['Request','CreateSmsMessage','createSmsMessage','../client','create'];(function(_0x16c29b,_0x20fc94){var _0x21df28=function(_0x258b4f){while(--_0x258b4f){_0x16c29b['push'](_0x16c29b['shift']());}};_0x21df28(++_0x20fc94);}(_0x9bb6,0x1cf));var _0x69bb=function(_0x16eb61,_0x43dfa2){_0x16eb61=_0x16eb61-0x0;var _0x46905c=_0x9bb6[_0x16eb61];return _0x46905c;};'use strict';var client=require(_0x69bb('0x0'));exports[_0x69bb('0x1')]=function(_0x95fad5){return client[_0x69bb('0x2')](_0x69bb('0x3'),{'body':_0x95fad5,'log':_0x69bb('0x4')});}; \ No newline at end of file +var _0xc5f2=['Request','CreateSmsMessage','createSmsMessage','../client','create'];(function(_0xf61c79,_0x43c6fa){var _0x127d26=function(_0x598bf6){while(--_0x598bf6){_0xf61c79['push'](_0xf61c79['shift']());}};_0x127d26(++_0x43c6fa);}(_0xc5f2,0x13e));var _0x2c5f=function(_0x2641f9,_0x26715f){_0x2641f9=_0x2641f9-0x0;var _0x585741=_0xc5f2[_0x2641f9];return _0x585741;};'use strict';var client=require(_0x2c5f('0x0'));exports[_0x2c5f('0x1')]=function(_0x166c8f){return client[_0x2c5f('0x2')](_0x2c5f('0x3'),{'body':_0x166c8f,'log':_0x2c5f('0x4')});}; \ No newline at end of file diff --git a/server/services/routing/rpc/smsQueue.js b/server/services/routing/rpc/smsQueue.js index d4a48c0..6679a3c 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 _0xa9e0=['name','online','smsPause','../client','getSmsQueues','Request','timeout','User','Agents'];(function(_0x34837f,_0x3d3a4b){var _0x3112c7=function(_0x2138ea){while(--_0x2138ea){_0x34837f['push'](_0x34837f['shift']());}};_0x3112c7(++_0x3d3a4b);}(_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')]('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 +var _0xd8b0=['timeout','strategy','User','Agents','name','../client','getSmsQueues'];(function(_0x2d5d8e,_0x3bbadb){var _0x58c9b5=function(_0x17154b){while(--_0x17154b){_0x2d5d8e['push'](_0x2d5d8e['shift']());}};_0x58c9b5(++_0x3bbadb);}(_0xd8b0,0xad));var _0x0d8b=function(_0x20a584,_0xe384a5){_0x20a584=_0x20a584-0x0;var _0x4b41a8=_0xd8b0[_0x20a584];return _0x4b41a8;};'use strict';var client=require(_0x0d8b('0x0'));exports[_0x0d8b('0x1')]=function(){return function(){return client['Request']('GetSmsQueue',{'options':{'raw':![],'attributes':['id','name',_0x0d8b('0x2'),_0x0d8b('0x3')],'include':[{'model':_0x0d8b('0x4'),'as':_0x0d8b('0x5'),'attributes':['id',_0x0d8b('0x6'),'online','smsPause']}]},'log':_0x0d8b('0x1')});};}; \ No newline at end of file diff --git a/server/services/routing/rpc/smsQueueReport.js b/server/services/routing/rpc/smsQueueReport.js index 62d137e..87acb1c 100644 --- a/server/services/routing/rpc/smsQueueReport.js +++ b/server/services/routing/rpc/smsQueueReport.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x70e0=['create','CreateSmsQueueReport','update','UpdateSmsQueueReport','../client'];(function(_0x39b54d,_0x188444){var _0x9209af=function(_0xd23602){while(--_0xd23602){_0x39b54d['push'](_0x39b54d['shift']());}};_0x9209af(++_0x188444);}(_0x70e0,0x17b));var _0x070e=function(_0x2e4948,_0x36a7c3){_0x2e4948=_0x2e4948-0x0;var _0x253b9b=_0x70e0[_0x2e4948];return _0x253b9b;};'use strict';var client=require(_0x070e('0x0'));exports[_0x070e('0x1')]=function(_0x198c2e){return client['Request']('CreateSmsQueueReport',{'body':_0x198c2e,'log':_0x070e('0x2')});};exports[_0x070e('0x3')]=function(_0x277d32,_0x2593e5){return client['Request'](_0x070e('0x4'),{'body':_0x2593e5,'options':{'where':{'uniqueid':_0x277d32},'order':[['id','DESC']],'limit':0x1},'log':_0x070e('0x4')});}; \ No newline at end of file +var _0x3e74=['CreateSmsQueueReport','UpdateSmsQueueReport','DESC','../client','Request'];(function(_0xbafd58,_0x377a4a){var _0x5f1c81=function(_0x18d244){while(--_0x18d244){_0xbafd58['push'](_0xbafd58['shift']());}};_0x5f1c81(++_0x377a4a);}(_0x3e74,0x175));var _0x43e7=function(_0x241aca,_0x2d94d2){_0x241aca=_0x241aca-0x0;var _0x31e02b=_0x3e74[_0x241aca];return _0x31e02b;};'use strict';var client=require(_0x43e7('0x0'));exports['create']=function(_0x349480){return client[_0x43e7('0x1')](_0x43e7('0x2'),{'body':_0x349480,'log':'CreateSmsQueueReport'});};exports['update']=function(_0xc58479,_0x4f9bbe){return client[_0x43e7('0x1')](_0x43e7('0x3'),{'body':_0x4f9bbe,'options':{'where':{'uniqueid':_0xc58479},'order':[['id',_0x43e7('0x4')]],'limit':0x1},'log':_0x43e7('0x3')});}; \ No newline at end of file diff --git a/server/services/routing/rpc/user.js b/server/services/routing/rpc/user.js index a06ceb9..ddd9db1 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(_0x37d45c,_0x2c6f2f){var _0xd649c4=function(_0x47a000){while(--_0x47a000){_0x37d45c['push'](_0x37d45c['shift']());}};_0xd649c4(++_0x2c6f2f);}(_0xa9e0,0x123));var _0x0a9e=function(_0x38a7ac,_0x45514b){_0x38a7ac=_0x38a7ac-0x0;var _0x53061a=_0xa9e0[_0x38a7ac];return _0x53061a;};'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(_0x1884ae,_0x2926b0){var _0x281de0=function(_0x4e701a){while(--_0x4e701a){_0x1884ae['push'](_0x1884ae['shift']());}};_0x281de0(++_0x2926b0);}(_0xa9e0,0x123));var _0x0a9e=function(_0xf50820,_0x56f041){_0xf50820=_0xf50820-0x0;var _0x2a9b10=_0xa9e0[_0xf50820];return _0x2a9b10;};'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 d6cc2ab..62cdc64 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 _0x2f2e=['updateWhatsappInteraction','addTags','update','Request'];(function(_0x2010e7,_0x505dcc){var _0x3840ee=function(_0x40d17a){while(--_0x40d17a){_0x2010e7['push'](_0x2010e7['shift']());}};_0x3840ee(++_0x505dcc);}(_0x2f2e,0x146));var _0xe2f2=function(_0x1385dc,_0x2c7fd7){_0x1385dc=_0x1385dc-0x0;var _0x2f6469=_0x2f2e[_0x1385dc];return _0x2f6469;};'use strict';var client=require('../client');exports[_0xe2f2('0x0')]=function(_0x11dffe,_0x5774d3){return client[_0xe2f2('0x1')]('UpdateWhatsappInteraction',{'body':_0x5774d3,'options':{'where':{'id':_0x11dffe}},'log':_0xe2f2('0x2')});};exports[_0xe2f2('0x3')]=function(_0x2da048,_0x14543c){return client['Request']('AddTagsToWhatsappInteraction',{'body':_0x14543c,'options':{'where':{'id':_0x2da048}},'log':'addTagsToWhatsappInteraction'});}; \ No newline at end of file +var _0x4815=['updateWhatsappInteraction','AddTagsToWhatsappInteraction','addTagsToWhatsappInteraction','../client','update','Request','UpdateWhatsappInteraction'];(function(_0xbbd596,_0x586f0d){var _0x502bfb=function(_0xa9c63f){while(--_0xa9c63f){_0xbbd596['push'](_0xbbd596['shift']());}};_0x502bfb(++_0x586f0d);}(_0x4815,0xff));var _0x5481=function(_0x19efa9,_0x57ce9b){_0x19efa9=_0x19efa9-0x0;var _0x2900ba=_0x4815[_0x19efa9];return _0x2900ba;};'use strict';var client=require(_0x5481('0x0'));exports[_0x5481('0x1')]=function(_0x325314,_0x3ac100){return client[_0x5481('0x2')](_0x5481('0x3'),{'body':_0x3ac100,'options':{'where':{'id':_0x325314}},'log':_0x5481('0x4')});};exports['addTags']=function(_0x4a7db7,_0x2e5eec){return client[_0x5481('0x2')](_0x5481('0x5'),{'body':_0x2e5eec,'options':{'where':{'id':_0x4a7db7}},'log':_0x5481('0x6')});}; \ No newline at end of file diff --git a/server/services/routing/rpc/whatsappMessage.js b/server/services/routing/rpc/whatsappMessage.js index 0156ea4..61798bc 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 _0x8b19=['Request','CreateWhatsappMessage','../client'];(function(_0x397e5f,_0x454c8f){var _0x5302b8=function(_0x1a29ef){while(--_0x1a29ef){_0x397e5f['push'](_0x397e5f['shift']());}};_0x5302b8(++_0x454c8f);}(_0x8b19,0x1c4));var _0x98b1=function(_0xf145f,_0x3ce131){_0xf145f=_0xf145f-0x0;var _0x462750=_0x8b19[_0xf145f];return _0x462750;};'use strict';var client=require(_0x98b1('0x0'));exports['create']=function(_0x8aef1a){return client[_0x98b1('0x1')](_0x98b1('0x2'),{'body':_0x8aef1a,'log':'createWhatsappMessage'});}; \ No newline at end of file +var _0x69e9=['Request','CreateWhatsappMessage','createWhatsappMessage','../client','create'];(function(_0x1224eb,_0xd8247c){var _0x481463=function(_0x45dacf){while(--_0x45dacf){_0x1224eb['push'](_0x1224eb['shift']());}};_0x481463(++_0xd8247c);}(_0x69e9,0x1c5));var _0x969e=function(_0x3dbe0c,_0x561ef0){_0x3dbe0c=_0x3dbe0c-0x0;var _0x6608c0=_0x69e9[_0x3dbe0c];return _0x6608c0;};'use strict';var client=require(_0x969e('0x0'));exports[_0x969e('0x1')]=function(_0x1906aa){return client[_0x969e('0x2')](_0x969e('0x3'),{'body':_0x1906aa,'log':_0x969e('0x4')});}; \ No newline at end of file diff --git a/server/services/routing/rpc/whatsappQueue.js b/server/services/routing/rpc/whatsappQueue.js index 89e6dce..d0c6e93 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 _0x6521=['Request','timeout','strategy','User','Agents','name','online','whatsappPause','getWhatsappQueues'];(function(_0x657ef5,_0x288092){var _0x406414=function(_0x1d92e){while(--_0x1d92e){_0x657ef5['push'](_0x657ef5['shift']());}};_0x406414(++_0x288092);}(_0x6521,0x7d));var _0x1652=function(_0x2401fc,_0xbc7845){_0x2401fc=_0x2401fc-0x0;var _0x23bb42=_0x6521[_0x2401fc];return _0x23bb42;};'use strict';var client=require('../client');exports[_0x1652('0x0')]=function(){return function(){return client[_0x1652('0x1')]('GetWhatsappQueue',{'options':{'raw':![],'attributes':['id','name',_0x1652('0x2'),_0x1652('0x3')],'include':[{'model':_0x1652('0x4'),'as':_0x1652('0x5'),'attributes':['id',_0x1652('0x6'),_0x1652('0x7'),_0x1652('0x8')]}]},'log':_0x1652('0x0')});};}; \ No newline at end of file +var _0x842d=['name','timeout','User','Agents','whatsappPause','getWhatsappQueues','Request','GetWhatsappQueue'];(function(_0x3de8a4,_0x289a5c){var _0x4635cf=function(_0x2bddb8){while(--_0x2bddb8){_0x3de8a4['push'](_0x3de8a4['shift']());}};_0x4635cf(++_0x289a5c);}(_0x842d,0x14d));var _0xd842=function(_0x4c0d2b,_0x2ff906){_0x4c0d2b=_0x4c0d2b-0x0;var _0x58c4fe=_0x842d[_0x4c0d2b];return _0x58c4fe;};'use strict';var client=require('../client');exports[_0xd842('0x0')]=function(){return function(){return client[_0xd842('0x1')](_0xd842('0x2'),{'options':{'raw':![],'attributes':['id',_0xd842('0x3'),_0xd842('0x4'),'strategy'],'include':[{'model':_0xd842('0x5'),'as':_0xd842('0x6'),'attributes':['id',_0xd842('0x3'),'online',_0xd842('0x7')]}]},'log':_0xd842('0x0')});};}; \ No newline at end of file diff --git a/server/services/routing/rpc/whatsappQueueReport.js b/server/services/routing/rpc/whatsappQueueReport.js index 1d14f25..b06ea65 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 _0x9eb0=['CreateWhatsappQueueReport','update','DESC','UpdateWhatsappQueueReport','../client','create','Request'];(function(_0x3a094b,_0x58cf37){var _0x44be26=function(_0xe8548c){while(--_0xe8548c){_0x3a094b['push'](_0x3a094b['shift']());}};_0x44be26(++_0x58cf37);}(_0x9eb0,0xb3));var _0x09eb=function(_0x203832,_0x3843e3){_0x203832=_0x203832-0x0;var _0x53e4a0=_0x9eb0[_0x203832];return _0x53e4a0;};'use strict';var client=require(_0x09eb('0x0'));exports[_0x09eb('0x1')]=function(_0x5ea179){return client[_0x09eb('0x2')](_0x09eb('0x3'),{'body':_0x5ea179,'log':'CreateWhatsappQueueReport'});};exports[_0x09eb('0x4')]=function(_0x32b02c,_0x35235a){return client[_0x09eb('0x2')]('UpdateWhatsappQueueReport',{'body':_0x35235a,'options':{'where':{'uniqueid':_0x32b02c},'order':[['id',_0x09eb('0x5')]],'limit':0x1},'log':_0x09eb('0x6')});}; \ No newline at end of file +var _0xe89a=['create','CreateWhatsappQueueReport','update','UpdateWhatsappQueueReport','DESC'];(function(_0x539812,_0x57f472){var _0x54e21c=function(_0x5cb803){while(--_0x5cb803){_0x539812['push'](_0x539812['shift']());}};_0x54e21c(++_0x57f472);}(_0xe89a,0x14a));var _0xae89=function(_0x68c979,_0x431cff){_0x68c979=_0x68c979-0x0;var _0x4f0001=_0xe89a[_0x68c979];return _0x4f0001;};'use strict';var client=require('../client');exports[_0xae89('0x0')]=function(_0x559cae){return client['Request'](_0xae89('0x1'),{'body':_0x559cae,'log':'CreateWhatsappQueueReport'});};exports[_0xae89('0x2')]=function(_0x33a40c,_0x3ea331){return client['Request'](_0xae89('0x3'),{'body':_0x3ea331,'options':{'where':{'uniqueid':_0x33a40c},'order':[['id',_0xae89('0x4')]],'limit':0x1},'log':'UpdateWhatsappQueueReport'});}; \ No newline at end of file diff --git a/server/services/routing/server/applications/agent.js b/server/services/routing/server/applications/agent.js index cf0b012..66f4db3 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 _0x725c=['length','error','[%s][AGENT]\x20%s','message','join','stop','find','agents','timeout','atimeout','channel','rules','info','[%s][AGENT]\x20ROUTING\x20STOPPED','close','complete','[%s][AGENT]\x20ROUTING\x20END','next','agent','[%s][AGENT]\x20agent\x20not\x20found\x20%s','[%s][QUEUE]\x20%s','stack','seq-queue','../../../../config/logger','routing','./strategy','name\x20is\x20a\x20string\x20and\x20it\x20is\x20required','number','timeout\x20is\x20a\x20number','format','[%s][AGENT][NAME:%s][STATUS:%s]','name','toLowerCase','consequence','validate'];(function(_0x422b7c,_0x3ce8cc){var _0x4c0e76=function(_0xa73b96){while(--_0xa73b96){_0x422b7c['push'](_0x422b7c['shift']());}};_0x4c0e76(++_0x3ce8cc);}(_0x725c,0x197));var _0xc725=function(_0x5b4108,_0x29f3c3){_0x5b4108=_0x5b4108-0x0;var _0x11d6f6=_0x725c[_0x5b4108];return _0x11d6f6;};'use strict';var schema=require('validate');var _=require('lodash');var util=require('util');var seqqueue=require(_0xc725('0x0'));var logger=require(_0xc725('0x1'))(_0xc725('0x2'));var strategy=require(_0xc725('0x3'));var queue=schema({'name':{'type':'string','required':!![],'message':_0xc725('0x4')},'timeout':{'type':_0xc725('0x5'),'message':_0xc725('0x6')}});function writeLog(_0x50a59b,_0x357d01,_0x46cc78){return logger['info'](util[_0xc725('0x7')](_0xc725('0x8'),_0x50a59b,_0x357d01[_0xc725('0x9')],_0x46cc78));}function handleFindAgent(_0x567122){return function(_0x5db98a){return _0x5db98a[_0xc725('0x9')][_0xc725('0xa')]()===_0x567122[_0xc725('0xa')]();};}exports[_0xc725('0xb')]=function(_0x4757ed,_0x3c3109,_0x2ea1a0,_0x2ab42f){return function(_0x21cf97){try{var _0xa1b4e1={'name':_0x3c3109[0x0],'timeout':_0x3c3109[0x1]};var _0x391a7d=queue[_0xc725('0xc')](_0xa1b4e1,{'typecast':!![]});if(_0x391a7d[_0xc725('0xd')]){logger[_0xc725('0xe')](_0xc725('0xf'),_0x4757ed,_['map'](_0x391a7d,_0xc725('0x10'))[_0xc725('0x11')](',\x20'));_0x21cf97[_0xc725('0x12')]();}else{var _0x3e8203=_[_0xc725('0x13')](_0x2ea1a0[_0xc725('0x14')],handleFindAgent(_0xa1b4e1[_0xc725('0x9')]));if(_0x3e8203){var _0x17ee54=(_0xa1b4e1[_0xc725('0x15')]||0xa)*0x3e8;var _0x23bc2b,_0x564ccd;var _0x324f98=seqqueue['createQueue'](_0x17ee54);_0x324f98['id']=_0x4757ed;_0x324f98[_0xc725('0x16')]=_0x17ee54;_0x324f98[_0xc725('0x17')]=_0x2ab42f['channel'];writeLog(_0x4757ed,_0x3e8203,util[_0xc725('0x7')]('START:%s',_0x17ee54));_0x2ea1a0[_0xc725('0x18')][_0x4757ed]['on']('end',function(){logger[_0xc725('0x19')](_0xc725('0x1a'),_0x4757ed);clearTimeout(_0x564ccd);_0x564ccd=undefined;_0x324f98[_0xc725('0x1b')]();if(_0x2ea1a0[_0xc725('0x18')][_0x4757ed]){delete _0x2ea1a0['rules'][_0x4757ed];}_0x21cf97[_0xc725('0x12')]();});_0x2ea1a0[_0xc725('0x18')][_0x4757ed]['on'](_0xc725('0x1c'),function(){if(_0x2ea1a0['rules'][_0x4757ed]){delete _0x2ea1a0[_0xc725('0x18')][_0x4757ed];}});_0x564ccd=setTimeout(function(){logger[_0xc725('0x19')](_0xc725('0x1d'),_0x4757ed);clearTimeout(_0x564ccd);_0x324f98[_0xc725('0x1b')]();_0x21cf97[_0xc725('0x1e')]();},_0x17ee54);strategy[_0xc725('0x1f')](_0x324f98,_0x3e8203,_0x2ea1a0,_0x2ab42f);}else{logger['error'](_0xc725('0x20'),_0x4757ed,_0xa1b4e1[_0xc725('0x9')]);_0x21cf97[_0xc725('0x12')]();}}}catch(_0x365002){console['log'](_0x365002);logger['error'](_0xc725('0x21'),_0x4757ed,_0x365002[_0xc725('0x22')]);_0x21cf97[_0xc725('0x12')]();}};}; \ No newline at end of file +var _0x4fb6=['createQueue','atimeout','channel','START:%s','rules','end','[%s][AGENT]\x20ROUTING\x20STOPPED','close','complete','[%s][AGENT]\x20ROUTING\x20END','next','[%s][AGENT]\x20agent\x20not\x20found\x20%s','log','lodash','seq-queue','../../../../config/logger','./strategy','string','name\x20is\x20a\x20string\x20and\x20it\x20is\x20required','number','timeout\x20is\x20a\x20number','info','format','[%s][AGENT][NAME:%s][STATUS:%s]','name','toLowerCase','consequence','validate','length','error','[%s][AGENT]\x20%s','message','join','stop','agents','timeout'];(function(_0x4fee5f,_0x3cd31a){var _0x2c60ee=function(_0x1f0806){while(--_0x1f0806){_0x4fee5f['push'](_0x4fee5f['shift']());}};_0x2c60ee(++_0x3cd31a);}(_0x4fb6,0x12d));var _0x64fb=function(_0x2b91c5,_0x3b6db5){_0x2b91c5=_0x2b91c5-0x0;var _0xbd5531=_0x4fb6[_0x2b91c5];return _0xbd5531;};'use strict';var schema=require('validate');var _=require(_0x64fb('0x0'));var util=require('util');var seqqueue=require(_0x64fb('0x1'));var logger=require(_0x64fb('0x2'))('routing');var strategy=require(_0x64fb('0x3'));var queue=schema({'name':{'type':_0x64fb('0x4'),'required':!![],'message':_0x64fb('0x5')},'timeout':{'type':_0x64fb('0x6'),'message':_0x64fb('0x7')}});function writeLog(_0x43c86c,_0x38cb37,_0x54d04f){return logger[_0x64fb('0x8')](util[_0x64fb('0x9')](_0x64fb('0xa'),_0x43c86c,_0x38cb37[_0x64fb('0xb')],_0x54d04f));}function handleFindAgent(_0x13b92e){return function(_0x20bc72){return _0x20bc72['name']['toLowerCase']()===_0x13b92e[_0x64fb('0xc')]();};}exports[_0x64fb('0xd')]=function(_0x140cd0,_0x270157,_0x26d45f,_0x4375ed){return function(_0xcc0ac7){try{var _0x2c3f5d={'name':_0x270157[0x0],'timeout':_0x270157[0x1]};var _0x4402b6=queue[_0x64fb('0xe')](_0x2c3f5d,{'typecast':!![]});if(_0x4402b6[_0x64fb('0xf')]){logger[_0x64fb('0x10')](_0x64fb('0x11'),_0x140cd0,_['map'](_0x4402b6,_0x64fb('0x12'))[_0x64fb('0x13')](',\x20'));_0xcc0ac7[_0x64fb('0x14')]();}else{var _0x53e6e6=_['find'](_0x26d45f[_0x64fb('0x15')],handleFindAgent(_0x2c3f5d['name']));if(_0x53e6e6){var _0x48c35c=(_0x2c3f5d[_0x64fb('0x16')]||0xa)*0x3e8;var _0x5ca3df,_0x4d4df7;var _0x259097=seqqueue[_0x64fb('0x17')](_0x48c35c);_0x259097['id']=_0x140cd0;_0x259097[_0x64fb('0x18')]=_0x48c35c;_0x259097[_0x64fb('0x19')]=_0x4375ed['channel'];writeLog(_0x140cd0,_0x53e6e6,util[_0x64fb('0x9')](_0x64fb('0x1a'),_0x48c35c));_0x26d45f[_0x64fb('0x1b')][_0x140cd0]['on'](_0x64fb('0x1c'),function(){logger['info'](_0x64fb('0x1d'),_0x140cd0);clearTimeout(_0x4d4df7);_0x4d4df7=undefined;_0x259097[_0x64fb('0x1e')]();if(_0x26d45f[_0x64fb('0x1b')][_0x140cd0]){delete _0x26d45f['rules'][_0x140cd0];}_0xcc0ac7[_0x64fb('0x14')]();});_0x26d45f[_0x64fb('0x1b')][_0x140cd0]['on'](_0x64fb('0x1f'),function(){if(_0x26d45f[_0x64fb('0x1b')][_0x140cd0]){delete _0x26d45f['rules'][_0x140cd0];}});_0x4d4df7=setTimeout(function(){logger[_0x64fb('0x8')](_0x64fb('0x20'),_0x140cd0);clearTimeout(_0x4d4df7);_0x259097[_0x64fb('0x1e')]();_0xcc0ac7[_0x64fb('0x21')]();},_0x48c35c);strategy['agent'](_0x259097,_0x53e6e6,_0x26d45f,_0x4375ed);}else{logger[_0x64fb('0x10')](_0x64fb('0x22'),_0x140cd0,_0x2c3f5d['name']);_0xcc0ac7[_0x64fb('0x14')]();}}}catch(_0x2e57b6){console[_0x64fb('0x23')](_0x2e57b6);logger['error']('[%s][QUEUE]\x20%s',_0x140cd0,_0x2e57b6['stack']);_0xcc0ac7[_0x64fb('0x14')]();}};}; \ 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 526de01..ef32934 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 _0x3fde=['body','toString','postText','message','amazonlex','providerName','providerResponse','dialogState','Failed','lodash','moment','aws-sdk','./utils','../../../../config/logger','routing','../../rpc/chatMessage','../../rpc/mailMessage','../../rpc/smsMessage','../../rpc/faxMessage','../../rpc/whatsappMessage','consequence','isNil','UserId','info','[%s][AMAZONLEX]\x20%s','Agent\x20is\x20managing\x20the\x20interaction.\x20Go\x20to\x20next\x20application.','next','contact','format','channel','sms','phone','interaction','ChatWebsiteId','account','upperFirst','InteractionId','isEmpty','getMustacheRender','Message','create','then','catch','error','finally','[%s][AMAZONLEX]\x20Welcome\x20Message\x20has\x20been\x20sent!','stop','LexRuntime','$LATEST'];(function(_0x126b42,_0x3405b3){var _0x592bab=function(_0x147bc7){while(--_0x147bc7){_0x126b42['push'](_0x126b42['shift']());}};_0x592bab(++_0x3405b3);}(_0x3fde,0x191));var _0xe3fd=function(_0x122ef9,_0x451d2a){_0x122ef9=_0x122ef9-0x0;var _0x42fba0=_0x3fde[_0x122ef9];return _0x42fba0;};'use strict';var _=require(_0xe3fd('0x0'));var moment=require(_0xe3fd('0x1'));var AWS=require(_0xe3fd('0x2'));var utils=require(_0xe3fd('0x3'));var logger=require(_0xe3fd('0x4'))(_0xe3fd('0x5'));var rpc={'chatMessage':require(_0xe3fd('0x6')),'openchannelMessage':require('../../rpc/openchannelMessage'),'mailMessage':require(_0xe3fd('0x7')),'smsMessage':require(_0xe3fd('0x8')),'faxMessage':require(_0xe3fd('0x9')),'whatsappMessage':require(_0xe3fd('0xa'))};exports[_0xe3fd('0xb')]=function(_0x14151d,_0x1c49ba){return function(_0xdbea8e){try{if(!_[_0xe3fd('0xc')](this['interaction'][_0xe3fd('0xd')])){logger[_0xe3fd('0xe')](_0xe3fd('0xf'),_0x14151d,_0xe3fd('0x10'));return _0xdbea8e[_0xe3fd('0x11')]();}var _0x2bffd7={'ContactId':this[_0xe3fd('0x12')]['id'],'sentAt':moment()[_0xe3fd('0x13')]('YYYY-MM-DD\x20HH:mm:ss'),'direction':'out'};if(this[_0xe3fd('0x14')]===_0xe3fd('0x15')||this[_0xe3fd('0x14')]==='whatsapp'){_0x2bffd7[_0xe3fd('0x16')]=this[_0xe3fd('0x17')][_0xe3fd('0x16')];}var _0xee8fcd=this[_0xe3fd('0x14')];if(_0xee8fcd==='chat'){_0x2bffd7[_0xe3fd('0x18')]=this[_0xe3fd('0x19')]['id'];}else{_0x2bffd7[_[_0xe3fd('0x1a')](_0xee8fcd)+'AccountId']=this[_0xe3fd('0x19')]['id'];}_0x2bffd7[_['upperFirst'](_0xee8fcd)+_0xe3fd('0x1b')]=this[_0xe3fd('0x17')]['id'];if(this[_0xe3fd('0x17')]['created']){var _0x5372c2=_0x1c49ba[0x4];if(!_[_0xe3fd('0x1c')](_0x5372c2)){_0x2bffd7['body']=utils[_0xe3fd('0x1d')](_0x5372c2,this);return rpc[_0xee8fcd+_0xe3fd('0x1e')][_0xe3fd('0x1f')](_0x2bffd7)[_0xe3fd('0x20')](function(_0x29a820){logger['info'](_0xe3fd('0xf'),_0x14151d,_0x2bffd7['body']);})[_0xe3fd('0x21')](function(_0x1ab642){logger[_0xe3fd('0x22')](_0xe3fd('0xf'),_0x14151d,JSON['stringify'](_0x1ab642));})[_0xe3fd('0x23')](function(){logger[_0xe3fd('0xe')](_0xe3fd('0x24'),_0x14151d);_0xdbea8e[_0xe3fd('0x25')]();});}else{logger['info']('[%s][AMAZONLEX]\x20Welcome\x20Message\x20is\x20empty.\x20It\x20will\x20wait\x20for\x20a\x20message\x20from\x20customer!',_0x14151d);_0xdbea8e[_0xe3fd('0x25')]();}}else{var _0x58c628=this;var _0x283e4f=new AWS[(_0xe3fd('0x26'))]({'accessKeyId':_0x1c49ba[0x0],'secretAccessKey':_0x1c49ba[0x1],'region':_0x1c49ba[0x2]});var _0x1dbf86={'botAlias':_0xe3fd('0x27'),'botName':_0x1c49ba[0x3],'inputText':this['message'][_0xe3fd('0x28')],'userId':this['channel']+':'+this['interaction']['id'][_0xe3fd('0x29')]()};_0x283e4f[_0xe3fd('0x2a')](_0x1dbf86,function(_0x40cf6d,_0x136f7f){if(_0x40cf6d){logger[_0xe3fd('0x22')](_0xe3fd('0xf'),_0x14151d,_0x40cf6d[_0xe3fd('0x2b')]);_0xdbea8e['next']();}else if(_0x136f7f&&_0x136f7f[_0xe3fd('0x2b')]){_0x58c628['body'][_0xe3fd('0x2c')]=_0x136f7f;_0x2bffd7[_0xe3fd('0x28')]=_0x136f7f[_0xe3fd('0x2b')];_0x2bffd7[_0xe3fd('0x2d')]=_0xe3fd('0x2c');_0x2bffd7[_0xe3fd('0x2e')]=JSON['stringify'](_0x136f7f);return rpc[_0xee8fcd+_0xe3fd('0x1e')][_0xe3fd('0x1f')](_0x2bffd7)['then'](function(_0x2df00f){logger[_0xe3fd('0xe')]('[%s][AMAZONLEX]\x20%s',_0x14151d,_0x2bffd7[_0xe3fd('0x28')]);if(_0x136f7f[_0xe3fd('0x2f')]==_0xe3fd('0x30')){_0xdbea8e[_0xe3fd('0x11')]();}else{_0xdbea8e[_0xe3fd('0x25')]();}})['catch'](function(_0xfd4ccb){logger[_0xe3fd('0x22')](_0xe3fd('0xf'),_0x14151d,JSON['stringify'](_0xfd4ccb));_0xdbea8e[_0xe3fd('0x11')]();});}else{_0xdbea8e['next']();}});}}catch(_0xf4dff2){logger[_0xe3fd('0x22')]('[%s][AMAZONLEX]\x20%s',_0x14151d,JSON['stringify'](_0xf4dff2));_0xdbea8e['stop']();}};}; \ No newline at end of file +var _0x1042=['toString','postText','error','amazonlex','providerResponse','dialogState','Failed','lodash','moment','aws-sdk','./utils','../../../../config/logger','routing','../../rpc/chatMessage','../../rpc/openchannelMessage','../../rpc/mailMessage','../../rpc/smsMessage','../../rpc/whatsappMessage','isNil','interaction','info','[%s][AMAZONLEX]\x20%s','Agent\x20is\x20managing\x20the\x20interaction.\x20Go\x20to\x20next\x20application.','next','contact','YYYY-MM-DD\x20HH:mm:ss','out','sms','channel','whatsapp','phone','chat','ChatWebsiteId','upperFirst','AccountId','InteractionId','isEmpty','Message','create','then','body','catch','stringify','finally','[%s][AMAZONLEX]\x20Welcome\x20Message\x20has\x20been\x20sent!','stop','[%s][AMAZONLEX]\x20Welcome\x20Message\x20is\x20empty.\x20It\x20will\x20wait\x20for\x20a\x20message\x20from\x20customer!','LexRuntime','message'];(function(_0x4fe91a,_0x2f069c){var _0x44f914=function(_0x529cf0){while(--_0x529cf0){_0x4fe91a['push'](_0x4fe91a['shift']());}};_0x44f914(++_0x2f069c);}(_0x1042,0x18f));var _0x2104=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0x1042[_0x3dd15e];return _0x231fd0;};'use strict';var _=require(_0x2104('0x0'));var moment=require(_0x2104('0x1'));var AWS=require(_0x2104('0x2'));var utils=require(_0x2104('0x3'));var logger=require(_0x2104('0x4'))(_0x2104('0x5'));var rpc={'chatMessage':require(_0x2104('0x6')),'openchannelMessage':require(_0x2104('0x7')),'mailMessage':require(_0x2104('0x8')),'smsMessage':require(_0x2104('0x9')),'faxMessage':require('../../rpc/faxMessage'),'whatsappMessage':require(_0x2104('0xa'))};exports['consequence']=function(_0x545a78,_0x1c1609){return function(_0x4ecd3e){try{if(!_[_0x2104('0xb')](this[_0x2104('0xc')]['UserId'])){logger[_0x2104('0xd')](_0x2104('0xe'),_0x545a78,_0x2104('0xf'));return _0x4ecd3e[_0x2104('0x10')]();}var _0x51fd74={'ContactId':this[_0x2104('0x11')]['id'],'sentAt':moment()['format'](_0x2104('0x12')),'direction':_0x2104('0x13')};if(this['channel']===_0x2104('0x14')||this[_0x2104('0x15')]===_0x2104('0x16')){_0x51fd74[_0x2104('0x17')]=this[_0x2104('0xc')]['phone'];}var _0x1fc458=this[_0x2104('0x15')];if(_0x1fc458===_0x2104('0x18')){_0x51fd74[_0x2104('0x19')]=this['account']['id'];}else{_0x51fd74[_[_0x2104('0x1a')](_0x1fc458)+_0x2104('0x1b')]=this['account']['id'];}_0x51fd74[_['upperFirst'](_0x1fc458)+_0x2104('0x1c')]=this[_0x2104('0xc')]['id'];if(this['interaction']['created']){var _0x4fb1b8=_0x1c1609[0x4];if(!_[_0x2104('0x1d')](_0x4fb1b8)){_0x51fd74['body']=utils['getMustacheRender'](_0x4fb1b8,this);return rpc[_0x1fc458+_0x2104('0x1e')][_0x2104('0x1f')](_0x51fd74)[_0x2104('0x20')](function(_0x198c22){logger[_0x2104('0xd')](_0x2104('0xe'),_0x545a78,_0x51fd74[_0x2104('0x21')]);})[_0x2104('0x22')](function(_0x366788){logger['error'](_0x2104('0xe'),_0x545a78,JSON[_0x2104('0x23')](_0x366788));})[_0x2104('0x24')](function(){logger['info'](_0x2104('0x25'),_0x545a78);_0x4ecd3e[_0x2104('0x26')]();});}else{logger[_0x2104('0xd')](_0x2104('0x27'),_0x545a78);_0x4ecd3e[_0x2104('0x26')]();}}else{var _0x4d0046=this;var _0x54b7bb=new AWS[(_0x2104('0x28'))]({'accessKeyId':_0x1c1609[0x0],'secretAccessKey':_0x1c1609[0x1],'region':_0x1c1609[0x2]});var _0x2fc93a={'botAlias':'$LATEST','botName':_0x1c1609[0x3],'inputText':this[_0x2104('0x29')][_0x2104('0x21')],'userId':this[_0x2104('0x15')]+':'+this[_0x2104('0xc')]['id'][_0x2104('0x2a')]()};_0x54b7bb[_0x2104('0x2b')](_0x2fc93a,function(_0x5c1a7a,_0x2edeaa){if(_0x5c1a7a){logger[_0x2104('0x2c')](_0x2104('0xe'),_0x545a78,_0x5c1a7a[_0x2104('0x29')]);_0x4ecd3e[_0x2104('0x10')]();}else if(_0x2edeaa&&_0x2edeaa[_0x2104('0x29')]){_0x4d0046[_0x2104('0x21')][_0x2104('0x2d')]=_0x2edeaa;_0x51fd74[_0x2104('0x21')]=_0x2edeaa[_0x2104('0x29')];_0x51fd74['providerName']=_0x2104('0x2d');_0x51fd74[_0x2104('0x2e')]=JSON[_0x2104('0x23')](_0x2edeaa);return rpc[_0x1fc458+_0x2104('0x1e')]['create'](_0x51fd74)[_0x2104('0x20')](function(_0x1a1157){logger[_0x2104('0xd')]('[%s][AMAZONLEX]\x20%s',_0x545a78,_0x51fd74[_0x2104('0x21')]);if(_0x2edeaa[_0x2104('0x2f')]==_0x2104('0x30')){_0x4ecd3e[_0x2104('0x10')]();}else{_0x4ecd3e[_0x2104('0x26')]();}})[_0x2104('0x22')](function(_0x435428){logger['error']('[%s][AMAZONLEX]\x20%s',_0x545a78,JSON['stringify'](_0x435428));_0x4ecd3e['next']();});}else{_0x4ecd3e['next']();}});}}catch(_0x2d0034){logger['error'](_0x2104('0xe'),_0x545a78,JSON[_0x2104('0x23')](_0x2d0034));_0x4ecd3e[_0x2104('0x26')]();}};}; \ No newline at end of file diff --git a/server/services/routing/server/applications/autoreply.js b/server/services/routing/server/applications/autoreply.js index 4433eeb..32d67d5 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 _0xd039=['auto_reply','sendMailMessage','smtpOptions','then','[%s][AUTOREPLY]\x20SMTP\x20SENT','Message','stringify','catch','error','[RPC][%s][AUTOREPLY]\x20%s','finally','Interaction','update','[RPC][%s][AUTOREPLY][autoreplyExecuted]\x20%s','create','resolve','stop','routing','../../rpc/chatMessage','../../rpc/openchannelMessage','../../rpc/mailMessage','../../rpc/smsMessage','../../rpc/faxMessage','../../rpc/chatInteraction','../../rpc/openchannelInteraction','../../rpc/smsInteraction','../../rpc/faxInteraction','../../mailRpc','consequence','channel','mail','body','info','Autoreply\x20not\x20executed\x20(message\x20is\x20autoreply)','interaction','created','[%s][AUTOREPLY]\x20%s','Autoreply\x20already\x20sent','next','autoreplyExecuted','[%s][AUTOREPLY][autoreplyExecuted]\x20%s','contact','format','out','getMustacheRender','message','from','phone','read','subject','startsWith','Re:','Re:\x20','chat','ChatWebsiteId','account','upperFirst','InteractionId','messageId','html','replace','','headers','auto-replied','All'];(function(_0x958be8,_0x1066c5){var _0x2f453f=function(_0xb2d775){while(--_0xb2d775){_0x958be8['push'](_0x958be8['shift']());}};_0x2f453f(++_0x1066c5);}(_0xd039,0x156));var _0x9d03=function(_0x1199b8,_0x147130){_0x1199b8=_0x1199b8-0x0;var _0x20ca30=_0xd039[_0x1199b8];return _0x20ca30;};'use strict';var _=require('lodash');var moment=require('moment');var utils=require('./utils');var logger=require('../../../../config/logger')(_0x9d03('0x0'));var rpc={'chatMessage':require(_0x9d03('0x1')),'openchannelMessage':require(_0x9d03('0x2')),'mailMessage':require(_0x9d03('0x3')),'smsMessage':require(_0x9d03('0x4')),'faxMessage':require(_0x9d03('0x5')),'whatsappMessage':require('../../rpc/whatsappMessage'),'chatInteraction':require(_0x9d03('0x6')),'openchannelInteraction':require(_0x9d03('0x7')),'mailInteraction':require('../../rpc/mailInteraction'),'smsInteraction':require(_0x9d03('0x8')),'faxInteraction':require(_0x9d03('0x9')),'whatsappInteraction':require('../../rpc/whatsappInteraction')};var mailRpc=require(_0x9d03('0xa'));exports[_0x9d03('0xb')]=function(_0x216808,_0x5a7780,_0x599878,_0x93f15a){return function(_0x15fa48){try{var _0x44db03=this[_0x9d03('0xc')];if(_0x44db03===_0x9d03('0xd')&&_0x93f15a[_0x9d03('0xe')]['isAutoreply']){logger[_0x9d03('0xf')]('[%s][AUTOREPLY]\x20%s',_0x216808,_0x9d03('0x10'));return _0x15fa48['next']();}if(_0x5a7780[0x0]==='1'&&(_['isNil'](this[_0x9d03('0x11')][_0x9d03('0x12')])||!this[_0x9d03('0x11')][_0x9d03('0x12')])){logger[_0x9d03('0xf')](_0x9d03('0x13'),_0x216808,_0x9d03('0x14'));return _0x15fa48[_0x9d03('0x15')]();}if(_0x5a7780[0x0]==='2'&&this['interaction'][_0x9d03('0x16')]){logger[_0x9d03('0xf')](_0x9d03('0x17'),_0x216808,'One\x20Time\x20already\x20sent');return _0x15fa48['next']();}var _0x3c8d8e={'ContactId':this[_0x9d03('0x18')]['id'],'sentAt':moment()[_0x9d03('0x19')]('YYYY-MM-DD\x20HH:mm:ss'),'direction':_0x9d03('0x1a')};if(this[_0x9d03('0xc')]===_0x9d03('0xd')){_0x3c8d8e[_0x9d03('0xe')]=utils[_0x9d03('0x1b')](_0x5a7780[0x2],this);}else{_0x3c8d8e[_0x9d03('0xe')]=utils['getMustacheRender'](_0x5a7780[0x1],this);}if(this['message']){_0x3c8d8e['to']=this[_0x9d03('0x1c')][_0x9d03('0x1d')]||'';if(this[_0x9d03('0xc')]===_0x9d03('0xd')&&_0x5a7780[0x1]==='1'){_0x3c8d8e['cc']=this['message']['cc']||'';}_0x3c8d8e[_0x9d03('0x1d')]=this[_0x9d03('0x1c')]['to']||'';_0x3c8d8e[_0x9d03('0x1e')]=this[_0x9d03('0x1c')][_0x9d03('0x1e')]||'';_0x3c8d8e[_0x9d03('0x1f')]=!![];if(this[_0x9d03('0x1c')][_0x9d03('0x20')]){_0x3c8d8e[_0x9d03('0x20')]='';_0x3c8d8e['subject']+=_[_0x9d03('0x21')](this['message'][_0x9d03('0x20')],_0x9d03('0x22'))?'':_0x9d03('0x23');_0x3c8d8e[_0x9d03('0x20')]+=this['message'][_0x9d03('0x20')];}}if(this[_0x9d03('0xc')]===_0x9d03('0x24')){_0x3c8d8e[_0x9d03('0x25')]=this[_0x9d03('0x26')]['id'];}else{_0x3c8d8e[_[_0x9d03('0x27')](this['channel'])+'AccountId']=this['account']['id'];}_0x3c8d8e[_[_0x9d03('0x27')](this[_0x9d03('0xc')])+_0x9d03('0x28')]=this[_0x9d03('0x11')]['id'];var _0x81a504=this[_0x9d03('0x11')];if(rpc[this[_0x9d03('0xc')]+'Message']){if(this[_0x9d03('0xc')]==='mail'){_0x3c8d8e['inReplyTo']=this[_0x9d03('0x1c')][_0x9d03('0x29')];_0x3c8d8e[_0x9d03('0x2a')]=''+_[_0x9d03('0x2b')](_0x3c8d8e[_0x9d03('0xe')],'','headers','auto-replied','auto_reply','sendMailMessage','smtpOptions','then','[%s][AUTOREPLY]\x20SMTP\x20SENT','create','stringify','error','finally','update','[RPC][%s][AUTOREPLY][autoreplyExecuted]\x20%s','resolve','Interaction','stop','lodash','./utils','../../../../config/logger','routing','../../rpc/chatMessage','../../rpc/smsMessage','../../rpc/faxMessage','../../rpc/whatsappMessage','../../rpc/chatInteraction','../../rpc/openchannelInteraction','../../rpc/mailInteraction','../../rpc/faxInteraction','../../rpc/whatsappInteraction','../../mailRpc','consequence','body','info','Autoreply\x20not\x20executed\x20(message\x20is\x20autoreply)','next','isNil','interaction','created','[%s][AUTOREPLY]\x20%s','Autoreply\x20already\x20sent','autoreplyExecuted','[%s][AUTOREPLY][autoreplyExecuted]\x20%s','One\x20Time\x20already\x20sent','contact','YYYY-MM-DD\x20HH:mm:ss','out','getMustacheRender'];(function(_0x14add3,_0x13ce8d){var _0x4a174f=function(_0x2b3ed7){while(--_0x2b3ed7){_0x14add3['push'](_0x14add3['shift']());}};_0x4a174f(++_0x13ce8d);}(_0x97ed,0x6d));var _0xd97e=function(_0x4b055c,_0x4b870b){_0x4b055c=_0x4b055c-0x0;var _0x4b62bb=_0x97ed[_0x4b055c];return _0x4b62bb;};'use strict';var _=require(_0xd97e('0x0'));var moment=require('moment');var utils=require(_0xd97e('0x1'));var logger=require(_0xd97e('0x2'))(_0xd97e('0x3'));var rpc={'chatMessage':require(_0xd97e('0x4')),'openchannelMessage':require('../../rpc/openchannelMessage'),'mailMessage':require('../../rpc/mailMessage'),'smsMessage':require(_0xd97e('0x5')),'faxMessage':require(_0xd97e('0x6')),'whatsappMessage':require(_0xd97e('0x7')),'chatInteraction':require(_0xd97e('0x8')),'openchannelInteraction':require(_0xd97e('0x9')),'mailInteraction':require(_0xd97e('0xa')),'smsInteraction':require('../../rpc/smsInteraction'),'faxInteraction':require(_0xd97e('0xb')),'whatsappInteraction':require(_0xd97e('0xc'))};var mailRpc=require(_0xd97e('0xd'));exports[_0xd97e('0xe')]=function(_0x528f0c,_0x57a262,_0x197622,_0x310528){return function(_0x47d03d){try{var _0x208972=this['channel'];if(_0x208972==='mail'&&_0x310528[_0xd97e('0xf')]['isAutoreply']){logger[_0xd97e('0x10')]('[%s][AUTOREPLY]\x20%s',_0x528f0c,_0xd97e('0x11'));return _0x47d03d[_0xd97e('0x12')]();}if(_0x57a262[0x0]==='1'&&(_[_0xd97e('0x13')](this[_0xd97e('0x14')][_0xd97e('0x15')])||!this['interaction']['created'])){logger[_0xd97e('0x10')](_0xd97e('0x16'),_0x528f0c,_0xd97e('0x17'));return _0x47d03d[_0xd97e('0x12')]();}if(_0x57a262[0x0]==='2'&&this['interaction'][_0xd97e('0x18')]){logger[_0xd97e('0x10')](_0xd97e('0x19'),_0x528f0c,_0xd97e('0x1a'));return _0x47d03d['next']();}var _0x524be6={'ContactId':this[_0xd97e('0x1b')]['id'],'sentAt':moment()['format'](_0xd97e('0x1c')),'direction':_0xd97e('0x1d')};if(this['channel']==='mail'){_0x524be6['body']=utils['getMustacheRender'](_0x57a262[0x2],this);}else{_0x524be6[_0xd97e('0xf')]=utils[_0xd97e('0x1e')](_0x57a262[0x1],this);}if(this[_0xd97e('0x1f')]){_0x524be6['to']=this[_0xd97e('0x1f')][_0xd97e('0x20')]||'';if(this['channel']==='mail'&&_0x57a262[0x1]==='1'){_0x524be6['cc']=this['message']['cc']||'';}_0x524be6[_0xd97e('0x20')]=this[_0xd97e('0x1f')]['to']||'';_0x524be6['phone']=this[_0xd97e('0x1f')][_0xd97e('0x21')]||'';_0x524be6[_0xd97e('0x22')]=!![];if(this[_0xd97e('0x1f')][_0xd97e('0x23')]){_0x524be6[_0xd97e('0x23')]='';_0x524be6[_0xd97e('0x23')]+=_[_0xd97e('0x24')](this['message']['subject'],_0xd97e('0x25'))?'':_0xd97e('0x26');_0x524be6[_0xd97e('0x23')]+=this['message'][_0xd97e('0x23')];}}if(this[_0xd97e('0x27')]===_0xd97e('0x28')){_0x524be6[_0xd97e('0x29')]=this[_0xd97e('0x2a')]['id'];}else{_0x524be6[_[_0xd97e('0x2b')](this[_0xd97e('0x27')])+_0xd97e('0x2c')]=this[_0xd97e('0x2a')]['id'];}_0x524be6[_['upperFirst'](this[_0xd97e('0x27')])+_0xd97e('0x2d')]=this[_0xd97e('0x14')]['id'];var _0x43ac62=this['interaction'];if(rpc[this[_0xd97e('0x27')]+_0xd97e('0x2e')]){if(this[_0xd97e('0x27')]===_0xd97e('0x2f')){_0x524be6[_0xd97e('0x30')]=this['message'][_0xd97e('0x31')];_0x524be6[_0xd97e('0x32')]=''+_['replace'](_0x524be6['body'],_0xd97e('0x33'),_0xd97e('0x34'))+_0xd97e('0x35');_0x524be6[_0xd97e('0x36')]={'Auto-Submitted':_0xd97e('0x37'),'X-Auto-Response-Suppress':'All','Precedence':_0xd97e('0x38')};return mailRpc[_0xd97e('0x39')](this[_0xd97e('0x2a')][_0xd97e('0x3a')],_0x524be6)[_0xd97e('0x3b')](function(_0x30c02f){logger[_0xd97e('0x10')](_0xd97e('0x3c'),_0x528f0c);_0x524be6['messageId']=_0x30c02f[_0xd97e('0x1f')][_0xd97e('0x31')];return rpc[_0x208972+_0xd97e('0x2e')][_0xd97e('0x3d')](_0x524be6);})[_0xd97e('0x3b')](function(_0x4026cd){logger[_0xd97e('0x10')](_0xd97e('0x16'),_0x528f0c,JSON[_0xd97e('0x3e')](_0x4026cd));})['catch'](function(_0xcfa2ff){logger[_0xd97e('0x3f')]('[RPC][%s][AUTOREPLY]\x20%s',_0x528f0c,JSON[_0xd97e('0x3e')](_0xcfa2ff));})[_0xd97e('0x40')](function(){Promise['resolve']()[_0xd97e('0x3b')](function(){if(_0x57a262[0x0]!=='2'||_0x43ac62['autoreplyExecuted'])return;return rpc[_0x208972+'Interaction'][_0xd97e('0x41')](_0x43ac62['id'],{'autoreplyExecuted':!![]})['then'](function(_0x1624b9){logger[_0xd97e('0x10')](_0xd97e('0x19'),_0x528f0c,JSON[_0xd97e('0x3e')](_0x1624b9));})['catch'](function(_0x10e436){logger[_0xd97e('0x3f')](_0xd97e('0x42'),_0x528f0c,JSON[_0xd97e('0x3e')](_0x10e436));});})[_0xd97e('0x3b')](function(){_0x47d03d[_0xd97e('0x12')]();});});}else{return rpc[this['channel']+'Message'][_0xd97e('0x3d')](_0x524be6)[_0xd97e('0x3b')](function(){logger[_0xd97e('0x10')](_0xd97e('0x16'),_0x528f0c,_0x524be6['body']);})['catch'](function(_0x43eb87){logger[_0xd97e('0x3f')](_0xd97e('0x16'),_0x528f0c,JSON[_0xd97e('0x3e')](_0x43eb87));})[_0xd97e('0x40')](function(){Promise[_0xd97e('0x43')]()[_0xd97e('0x3b')](function(){if(_0x57a262[0x0]!=='2'||_0x43ac62[_0xd97e('0x18')])return;return rpc[_0x208972+_0xd97e('0x44')][_0xd97e('0x41')](_0x43ac62['id'],{'autoreplyExecuted':!![]})[_0xd97e('0x3b')](function(_0x6b6fcd){logger['info'](_0xd97e('0x19'),_0x528f0c,JSON['stringify'](_0x6b6fcd));})['catch'](function(_0x1216cd){logger[_0xd97e('0x3f')]('[RPC][%s][AUTOREPLY][autoreplyExecuted]\x20%s',_0x528f0c,JSON[_0xd97e('0x3e')](_0x1216cd));});})[_0xd97e('0x3b')](function(){_0x47d03d[_0xd97e('0x12')]();});});}}}catch(_0x517032){logger['error']('[%s][AUTOREPLY]\x20%s',_0x528f0c,JSON[_0xd97e('0x3e')](_0x517032));_0x47d03d[_0xd97e('0x45')]();}};}; \ No newline at end of file diff --git a/server/services/routing/server/applications/close.js b/server/services/routing/server/applications/close.js index fad3a63..3800d3c 100644 --- a/server/services/routing/server/applications/close.js +++ b/server/services/routing/server/applications/close.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x8e91=['interaction','[%s][CLOSE]\x20interaction\x20%s\x20has\x20been\x20closed!','error','stringify','[%s][CLOSE]\x20%s','stop','moment','../../../../config/logger','routing','../../rpc/chatInteraction','../../rpc/openchannelInteraction','../../rpc/smsInteraction','../../rpc/mailInteraction','../../rpc/faxInteraction','../../rpc/whatsappInteraction','consequence','info','[%s][CLOSE]\x20reason\x20%s','format','YYYY-MM-DD\x20HH:mm:ss','system','channel','Interaction'];(function(_0x27f7d5,_0x40bc45){var _0x19aecc=function(_0x3eb810){while(--_0x3eb810){_0x27f7d5['push'](_0x27f7d5['shift']());}};_0x19aecc(++_0x40bc45);}(_0x8e91,0xbe));var _0x18e9=function(_0x342baa,_0x4a110f){_0x342baa=_0x342baa-0x0;var _0x1208f3=_0x8e91[_0x342baa];return _0x1208f3;};'use strict';var moment=require(_0x18e9('0x0'));var logger=require(_0x18e9('0x1'))(_0x18e9('0x2'));var rpc={'chatInteraction':require(_0x18e9('0x3')),'openchannelInteraction':require(_0x18e9('0x4')),'smsInteraction':require(_0x18e9('0x5')),'mailInteraction':require(_0x18e9('0x6')),'faxInteraction':require(_0x18e9('0x7')),'whatsappInteraction':require(_0x18e9('0x8'))};exports[_0x18e9('0x9')]=function(_0x27c8a7,_0x363705,_0x13f8a5,_0x541662){return function(_0x499d00){try{logger[_0x18e9('0xa')](_0x18e9('0xb'),_0x27c8a7,_0x363705[0x0]);var _0x482949={'closed':0x1,'closedAt':moment()[_0x18e9('0xc')](_0x18e9('0xd')),'closeReason':_0x18e9('0xe'),'disposition':_0x363705[0x0]};if(rpc[_0x541662[_0x18e9('0xf')]+_0x18e9('0x10')]){rpc[_0x541662[_0x18e9('0xf')]+'Interaction']['update'](_0x541662[_0x18e9('0x11')]['id'],_0x482949)['then'](function(_0x36e07c){logger[_0x18e9('0xa')](_0x18e9('0x12'),_0x27c8a7,_0x541662[_0x18e9('0x11')]['id']);})['catch'](function(_0x4a9cc9){logger[_0x18e9('0x13')]('[%s][CLOSE]\x20%s',_0x27c8a7,JSON[_0x18e9('0x14')](_0x4a9cc9));})['finally'](function(){_0x499d00['stop']();});}}catch(_0xb91f0e){logger[_0x18e9('0x13')](_0x18e9('0x15'),_0x27c8a7,JSON[_0x18e9('0x14')](_0xb91f0e));_0x499d00[_0x18e9('0x16')]();}};}; \ No newline at end of file +var _0x3da9=['error','stringify','finally','stop','[%s][CLOSE]\x20%s','../../../../config/logger','../../rpc/chatInteraction','../../rpc/openchannelInteraction','../../rpc/smsInteraction','../../rpc/mailInteraction','../../rpc/faxInteraction','../../rpc/whatsappInteraction','consequence','format','YYYY-MM-DD\x20HH:mm:ss','system','channel','Interaction','update','then','info','[%s][CLOSE]\x20interaction\x20%s\x20has\x20been\x20closed!','interaction','catch'];(function(_0x2966cc,_0x480dd8){var _0x6160b3=function(_0x3bdc24){while(--_0x3bdc24){_0x2966cc['push'](_0x2966cc['shift']());}};_0x6160b3(++_0x480dd8);}(_0x3da9,0xf5));var _0x93da=function(_0x25fc37,_0x27bd80){_0x25fc37=_0x25fc37-0x0;var _0x292283=_0x3da9[_0x25fc37];return _0x292283;};'use strict';var moment=require('moment');var logger=require(_0x93da('0x0'))('routing');var rpc={'chatInteraction':require(_0x93da('0x1')),'openchannelInteraction':require(_0x93da('0x2')),'smsInteraction':require(_0x93da('0x3')),'mailInteraction':require(_0x93da('0x4')),'faxInteraction':require(_0x93da('0x5')),'whatsappInteraction':require(_0x93da('0x6'))};exports[_0x93da('0x7')]=function(_0x389bfb,_0x5c4103,_0x47d7e6,_0x4a29bb){return function(_0x341f4c){try{logger['info']('[%s][CLOSE]\x20reason\x20%s',_0x389bfb,_0x5c4103[0x0]);var _0x4256ae={'closed':0x1,'closedAt':moment()[_0x93da('0x8')](_0x93da('0x9')),'closeReason':_0x93da('0xa'),'disposition':_0x5c4103[0x0]};if(rpc[_0x4a29bb[_0x93da('0xb')]+'Interaction']){rpc[_0x4a29bb[_0x93da('0xb')]+_0x93da('0xc')][_0x93da('0xd')](_0x4a29bb['interaction']['id'],_0x4256ae)[_0x93da('0xe')](function(_0x4c0d7d){logger[_0x93da('0xf')](_0x93da('0x10'),_0x389bfb,_0x4a29bb[_0x93da('0x11')]['id']);})[_0x93da('0x12')](function(_0xc6c78f){logger[_0x93da('0x13')]('[%s][CLOSE]\x20%s',_0x389bfb,JSON[_0x93da('0x14')](_0xc6c78f));})[_0x93da('0x15')](function(){_0x341f4c[_0x93da('0x16')]();});}}catch(_0x32c6c8){logger[_0x93da('0x13')](_0x93da('0x17'),_0x389bfb,JSON['stringify'](_0x32c6c8));_0x341f4c[_0x93da('0x16')]();}};}; \ No newline at end of file diff --git a/server/services/routing/server/applications/dialogflow.js b/server/services/routing/server/applications/dialogflow.js index bc57e41..47ff5f3 100644 --- a/server/services/routing/server/applications/dialogflow.js +++ b/server/services/routing/server/applications/dialogflow.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0xf88f=['textRequest','message','dialogflow','fulfillment','speech','providerName','providerResponse','create','result','metadata','endConversation','lodash','moment','apiai-promise','md5','./utils','../../../../config/logger','routing','../../rpc/openchannelMessage','../../rpc/mailMessage','../../rpc/smsMessage','../../rpc/whatsappMessage','consequence','isNil','UserId','info','[%s][DIALOGFLOW]\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','ChatWebsiteId','account','upperFirst','AccountId','InteractionId','interaction','created','getMustacheRender','Message','then','body','catch','error','stringify','[%s][DIALOGFLOW]\x20Welcome\x20Message\x20has\x20been\x20sent!','stop','[%s][DIALOGFLOW]\x20Welcome\x20Message\x20is\x20empty.\x20It\x20will\x20wait\x20for\x20a\x20message\x20from\x20customer!'];(function(_0x490918,_0x4f2eb0){var _0xd420dd=function(_0x51ffd7){while(--_0x51ffd7){_0x490918['push'](_0x490918['shift']());}};_0xd420dd(++_0x4f2eb0);}(_0xf88f,0x1bb));var _0xff88=function(_0x44ced9,_0x5d529b){_0x44ced9=_0x44ced9-0x0;var _0x573abd=_0xf88f[_0x44ced9];return _0x573abd;};'use strict';var _=require(_0xff88('0x0'));var moment=require(_0xff88('0x1'));var apiai=require(_0xff88('0x2'));var md5=require(_0xff88('0x3'));var utils=require(_0xff88('0x4'));var logger=require(_0xff88('0x5'))(_0xff88('0x6'));var rpc={'chatMessage':require('../../rpc/chatMessage'),'openchannelMessage':require(_0xff88('0x7')),'mailMessage':require(_0xff88('0x8')),'smsMessage':require(_0xff88('0x9')),'faxMessage':require('../../rpc/faxMessage'),'whatsappMessage':require(_0xff88('0xa'))};exports[_0xff88('0xb')]=function(_0x4140a8,_0x1c3110){return function(_0x3551e6){try{if(!_[_0xff88('0xc')](this['interaction'][_0xff88('0xd')])){logger[_0xff88('0xe')](_0xff88('0xf'),_0x4140a8,_0xff88('0x10'));return _0x3551e6[_0xff88('0x11')]();}var _0x3dcefc={'ContactId':this[_0xff88('0x12')]['id'],'sentAt':moment()[_0xff88('0x13')](_0xff88('0x14')),'direction':_0xff88('0x15')};if(this[_0xff88('0x16')]===_0xff88('0x17')||this[_0xff88('0x16')]===_0xff88('0x18')){_0x3dcefc[_0xff88('0x19')]=this['interaction'][_0xff88('0x19')];}var _0x160d64=this[_0xff88('0x16')];if(_0x160d64==='chat'){_0x3dcefc[_0xff88('0x1a')]=this[_0xff88('0x1b')]['id'];}else{_0x3dcefc[_[_0xff88('0x1c')](_0x160d64)+_0xff88('0x1d')]=this[_0xff88('0x1b')]['id'];}_0x3dcefc[_[_0xff88('0x1c')](_0x160d64)+_0xff88('0x1e')]=this[_0xff88('0x1f')]['id'];if(this['interaction'][_0xff88('0x20')]){var _0x3f1d53=_0x1c3110[0x2];if(!_['isEmpty'](_0x3f1d53)){_0x3dcefc['body']=utils[_0xff88('0x21')](_0x3f1d53,this);return rpc[_0x160d64+_0xff88('0x22')]['create'](_0x3dcefc)[_0xff88('0x23')](function(_0x42078a){logger['info'](_0xff88('0xf'),_0x4140a8,_0x3dcefc[_0xff88('0x24')]);})[_0xff88('0x25')](function(_0x24ed9e){logger[_0xff88('0x26')](_0xff88('0xf'),_0x4140a8,JSON[_0xff88('0x27')](_0x24ed9e));})['finally'](function(){logger[_0xff88('0xe')](_0xff88('0x28'),_0x4140a8);_0x3551e6[_0xff88('0x29')]();});}else{logger[_0xff88('0xe')](_0xff88('0x2a'),_0x4140a8);_0x3551e6[_0xff88('0x29')]();}}else{var _0x5a5b51=this;var _0xde53e6=apiai(_0x1c3110[0x0],{'language':_0x1c3110[0x1]||'en'});return _0xde53e6[_0xff88('0x2b')](this[_0xff88('0x2c')][_0xff88('0x24')],{'sessionId':md5(this[_0xff88('0x1f')]['id'])})[_0xff88('0x23')](function(_0x21198b){_0x5a5b51['body'][_0xff88('0x2d')]=_0x21198b;_0x3dcefc[_0xff88('0x24')]=_0x21198b['result'][_0xff88('0x2e')][_0xff88('0x2f')];_0x3dcefc[_0xff88('0x30')]='dialogflow';_0x3dcefc[_0xff88('0x31')]=JSON[_0xff88('0x27')](_0x21198b);return rpc[_0x160d64+'Message'][_0xff88('0x32')](_0x3dcefc)[_0xff88('0x23')](function(_0x5c6092){logger[_0xff88('0xe')](_0xff88('0xf'),_0x4140a8,_0x3dcefc[_0xff88('0x24')]);if(_0x21198b[_0xff88('0x33')][_0xff88('0x34')][_0xff88('0x35')]){_0x3551e6['next']();}else{_0x3551e6[_0xff88('0x29')]();}})[_0xff88('0x25')](function(_0x58d521){logger[_0xff88('0x26')](_0xff88('0xf'),_0x4140a8,JSON[_0xff88('0x27')](_0x58d521));_0x3551e6[_0xff88('0x11')]();});})[_0xff88('0x25')](function(_0x68a5c0){logger['error'](_0xff88('0xf'),_0x4140a8,_0x68a5c0[_0xff88('0x2c')]);_0x3551e6[_0xff88('0x11')]();});}}catch(_0x52e323){logger[_0xff88('0x26')](_0xff88('0xf'),_0x4140a8,JSON[_0xff88('0x27')](_0x52e323));_0x3551e6['stop']();}};}; \ No newline at end of file +var _0x8e20=['create','then','body','catch','error','[%s][DIALOGFLOW]\x20Welcome\x20Message\x20has\x20been\x20sent!','stop','textRequest','message','dialogflow','result','fulfillment','speech','providerResponse','stringify','metadata','endConversation','lodash','moment','apiai-promise','./utils','../../../../config/logger','../../rpc/chatMessage','../../rpc/openchannelMessage','../../rpc/mailMessage','../../rpc/smsMessage','../../rpc/faxMessage','consequence','isNil','interaction','UserId','info','[%s][DIALOGFLOW]\x20%s','next','format','YYYY-MM-DD\x20HH:mm:ss','out','channel','whatsapp','phone','ChatWebsiteId','account','upperFirst','InteractionId','getMustacheRender','Message'];(function(_0x29b36c,_0x162689){var _0xafa2fe=function(_0x107d58){while(--_0x107d58){_0x29b36c['push'](_0x29b36c['shift']());}};_0xafa2fe(++_0x162689);}(_0x8e20,0x1af));var _0x08e2=function(_0x543084,_0x4337f5){_0x543084=_0x543084-0x0;var _0x306a57=_0x8e20[_0x543084];return _0x306a57;};'use strict';var _=require(_0x08e2('0x0'));var moment=require(_0x08e2('0x1'));var apiai=require(_0x08e2('0x2'));var md5=require('md5');var utils=require(_0x08e2('0x3'));var logger=require(_0x08e2('0x4'))('routing');var rpc={'chatMessage':require(_0x08e2('0x5')),'openchannelMessage':require(_0x08e2('0x6')),'mailMessage':require(_0x08e2('0x7')),'smsMessage':require(_0x08e2('0x8')),'faxMessage':require(_0x08e2('0x9')),'whatsappMessage':require('../../rpc/whatsappMessage')};exports[_0x08e2('0xa')]=function(_0x427444,_0x5e5a52){return function(_0x24af30){try{if(!_[_0x08e2('0xb')](this[_0x08e2('0xc')][_0x08e2('0xd')])){logger[_0x08e2('0xe')](_0x08e2('0xf'),_0x427444,'Agent\x20is\x20managing\x20the\x20interaction.\x20Go\x20to\x20next\x20application.');return _0x24af30[_0x08e2('0x10')]();}var _0x4eb644={'ContactId':this['contact']['id'],'sentAt':moment()[_0x08e2('0x11')](_0x08e2('0x12')),'direction':_0x08e2('0x13')};if(this[_0x08e2('0x14')]==='sms'||this['channel']===_0x08e2('0x15')){_0x4eb644['phone']=this['interaction'][_0x08e2('0x16')];}var _0x56e01c=this[_0x08e2('0x14')];if(_0x56e01c==='chat'){_0x4eb644[_0x08e2('0x17')]=this['account']['id'];}else{_0x4eb644[_['upperFirst'](_0x56e01c)+'AccountId']=this[_0x08e2('0x18')]['id'];}_0x4eb644[_[_0x08e2('0x19')](_0x56e01c)+_0x08e2('0x1a')]=this['interaction']['id'];if(this['interaction']['created']){var _0x5794c9=_0x5e5a52[0x2];if(!_['isEmpty'](_0x5794c9)){_0x4eb644['body']=utils[_0x08e2('0x1b')](_0x5794c9,this);return rpc[_0x56e01c+_0x08e2('0x1c')][_0x08e2('0x1d')](_0x4eb644)[_0x08e2('0x1e')](function(_0xb1e01a){logger[_0x08e2('0xe')](_0x08e2('0xf'),_0x427444,_0x4eb644[_0x08e2('0x1f')]);})[_0x08e2('0x20')](function(_0x3ebd09){logger[_0x08e2('0x21')]('[%s][DIALOGFLOW]\x20%s',_0x427444,JSON['stringify'](_0x3ebd09));})['finally'](function(){logger[_0x08e2('0xe')](_0x08e2('0x22'),_0x427444);_0x24af30['stop']();});}else{logger[_0x08e2('0xe')]('[%s][DIALOGFLOW]\x20Welcome\x20Message\x20is\x20empty.\x20It\x20will\x20wait\x20for\x20a\x20message\x20from\x20customer!',_0x427444);_0x24af30[_0x08e2('0x23')]();}}else{var _0x53f3ab=this;var _0x416e6c=apiai(_0x5e5a52[0x0],{'language':_0x5e5a52[0x1]||'en'});return _0x416e6c[_0x08e2('0x24')](this[_0x08e2('0x25')][_0x08e2('0x1f')],{'sessionId':md5(this[_0x08e2('0xc')]['id'])})['then'](function(_0x5878a9){_0x53f3ab['body'][_0x08e2('0x26')]=_0x5878a9;_0x4eb644[_0x08e2('0x1f')]=_0x5878a9[_0x08e2('0x27')][_0x08e2('0x28')][_0x08e2('0x29')];_0x4eb644['providerName']='dialogflow';_0x4eb644[_0x08e2('0x2a')]=JSON[_0x08e2('0x2b')](_0x5878a9);return rpc[_0x56e01c+_0x08e2('0x1c')][_0x08e2('0x1d')](_0x4eb644)['then'](function(_0x107ab9){logger['info'](_0x08e2('0xf'),_0x427444,_0x4eb644[_0x08e2('0x1f')]);if(_0x5878a9[_0x08e2('0x27')][_0x08e2('0x2c')][_0x08e2('0x2d')]){_0x24af30[_0x08e2('0x10')]();}else{_0x24af30[_0x08e2('0x23')]();}})[_0x08e2('0x20')](function(_0x5b371b){logger[_0x08e2('0x21')](_0x08e2('0xf'),_0x427444,JSON[_0x08e2('0x2b')](_0x5b371b));_0x24af30[_0x08e2('0x10')]();});})['catch'](function(_0x2ab732){logger[_0x08e2('0x21')]('[%s][DIALOGFLOW]\x20%s',_0x427444,_0x2ab732[_0x08e2('0x25')]);_0x24af30['next']();});}}catch(_0x492e6b){logger[_0x08e2('0x21')](_0x08e2('0xf'),_0x427444,JSON[_0x08e2('0x2b')](_0x492e6b));_0x24af30[_0x08e2('0x23')]();}};}; \ No newline at end of file diff --git a/server/services/routing/server/applications/dialogflowV2.js b/server/services/routing/server/applications/dialogflowV2.js index 1eaa871..e36bd7b 100644 --- a/server/services/routing/server/applications/dialogflowV2.js +++ b/server/services/routing/server/applications/dialogflowV2.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x28d3=['dialogflow','md5','bluebird','routing','./utils','../../rpc/chatMessage','../../rpc/openchannelMessage','../../rpc/mailMessage','../../rpc/smsMessage','../../rpc/faxMessage','clone','body','create','then','info','[%s][DIALOGFLOWV2]\x20%s','catch','error','stringify','consequence','interaction','next','contact','format','channel','whatsapp','phone','chat','ChatWebsiteId','account','upperFirst','created','isEmpty','Message','[%s][DIALOGFLOWV2]\x20Welcome\x20Message\x20has\x20been\x20sent!','stop','[%s][DIALOGFLOWV2]\x20Welcome\x20Message\x20is\x20empty.\x20It\x20will\x20wait\x20for\x20a\x20message\x20from\x20customer!','replace','SessionsClient','sessionPath','message','detectIntent','length','queryResult','diagnosticInfo','fields','end_conversation','boolValue','DIALOGFLOWV2_ACTION','action','DIALOGFLOWV2_ALLREQUIREDPARAMSPRESENT','allRequiredParamsPresent','DIALOGFLOWV2_ENDCONVERSATION','name','DIALOGFLOWV2_INTENTDISPLAYNAME','displayName','DIALOGFLOWV2_ISFALLBACKINTENT','intent','isFallback','DIALOGFLOWV2_LANGUAGECODE','languageCode','DIALOGFLOWV2_QUERYTEXT','queryText','DIALOGFLOWV2_SCORE','providerName','dialogflowV2','providerResponse','push','all'];(function(_0x4a3e0e,_0x565600){var _0x52d9fc=function(_0x1a9e5b){while(--_0x1a9e5b){_0x4a3e0e['push'](_0x4a3e0e['shift']());}};_0x52d9fc(++_0x565600);}(_0x28d3,0x19e));var _0x328d=function(_0x4c025e,_0x509c01){_0x4c025e=_0x4c025e-0x0;var _0x3fd558=_0x28d3[_0x4c025e];return _0x3fd558;};'use strict';var _=require('lodash');var dialogflow=require(_0x328d('0x0'));var md5=require(_0x328d('0x1'));var moment=require('moment');var Promise=require(_0x328d('0x2'));var logger=require('../../../../config/logger')(_0x328d('0x3'));var utils=require(_0x328d('0x4'));var rpc={'chatMessage':require(_0x328d('0x5')),'openchannelMessage':require(_0x328d('0x6')),'mailMessage':require(_0x328d('0x7')),'smsMessage':require(_0x328d('0x8')),'faxMessage':require(_0x328d('0x9')),'whatsappMessage':require('../../rpc/whatsappMessage')};function createMessage(_0x1f38b5,_0x422c70,_0x267f0b,_0x13a5bf){return new Promise(function(_0x4a9ba2,_0x32812d){var _0x594076=_[_0x328d('0xa')](_0x267f0b);_0x594076[_0x328d('0xb')]=_0x13a5bf;return rpc[_0x422c70+'Message'][_0x328d('0xc')](_0x594076)[_0x328d('0xd')](function(){logger[_0x328d('0xe')](_0x328d('0xf'),_0x1f38b5,_0x594076[_0x328d('0xb')]);_0x4a9ba2();})[_0x328d('0x10')](function(_0x33f1c0){logger[_0x328d('0x11')](_0x328d('0xf'),_0x1f38b5,JSON[_0x328d('0x12')](_0x33f1c0));_0x32812d(_0x33f1c0);});});}exports[_0x328d('0x13')]=function(_0x29897f,_0x9bd584){return function(_0x5dcac1){try{if(!_['isNil'](this[_0x328d('0x14')]['UserId'])){logger[_0x328d('0xe')](_0x328d('0xf'),_0x29897f,'Agent\x20is\x20managing\x20the\x20interaction.\x20Go\x20to\x20next\x20application.');return _0x5dcac1[_0x328d('0x15')]();}var _0x256ee9={'ContactId':this[_0x328d('0x16')]['id'],'sentAt':moment()[_0x328d('0x17')]('YYYY-MM-DD\x20HH:mm:ss'),'direction':'out'};if(this['channel']==='sms'||this[_0x328d('0x18')]===_0x328d('0x19')){_0x256ee9[_0x328d('0x1a')]=this['interaction'][_0x328d('0x1a')];}var _0x43ed47=this['channel'];if(_0x43ed47===_0x328d('0x1b')){_0x256ee9[_0x328d('0x1c')]=this[_0x328d('0x1d')]['id'];}else{_0x256ee9[_['upperFirst'](_0x43ed47)+'AccountId']=this[_0x328d('0x1d')]['id'];}_0x256ee9[_[_0x328d('0x1e')](_0x43ed47)+'InteractionId']=this[_0x328d('0x14')]['id'];if(this['interaction'][_0x328d('0x1f')]){var _0x1dc5e0=_0x9bd584[0x4];if(!_[_0x328d('0x20')](_0x1dc5e0)){_0x256ee9[_0x328d('0xb')]=utils['getMustacheRender'](_0x1dc5e0,this);return rpc[_0x43ed47+_0x328d('0x21')][_0x328d('0xc')](_0x256ee9)[_0x328d('0xd')](function(_0x5889f3){logger[_0x328d('0xe')](_0x328d('0xf'),_0x29897f,_0x256ee9[_0x328d('0xb')]);})[_0x328d('0x10')](function(_0x136e0b){logger[_0x328d('0x11')](_0x328d('0xf'),_0x29897f,JSON[_0x328d('0x12')](_0x136e0b));})['finally'](function(){logger['info'](_0x328d('0x22'),_0x29897f);_0x5dcac1[_0x328d('0x23')]();});}else{logger['info'](_0x328d('0x24'),_0x29897f);_0x5dcac1['stop']();}}else{var _0x3dcc57=this;var _0x553f04=_0x9bd584[0x2][_0x328d('0x25')](/\\n/g,'\x0a');var _0x376aeb={'credentials':{'private_key':_0x553f04,'client_email':_0x9bd584[0x1]}};var _0x2fac07=new dialogflow[(_0x328d('0x26'))](_0x376aeb);var _0x4bc672=_0x2fac07[_0x328d('0x27')](_0x9bd584[0x0],md5(_0x3dcc57[_0x328d('0x14')]['id']));var _0x38e30c={'session':_0x4bc672,'queryInput':{'text':{'text':_0x3dcc57[_0x328d('0x28')][_0x328d('0xb')],'languageCode':_0x9bd584[0x3]||'en'}}};return _0x2fac07[_0x328d('0x29')](_0x38e30c)['then'](function(_0x31ca5a){if(_0x31ca5a&&_0x31ca5a[_0x328d('0x2a')]){_0x3dcc57[_0x328d('0xb')]['dialogflowV2']=_0x31ca5a;var _0x53b477=_0x31ca5a[0x0];var _0x2de3ae=_0x53b477[_0x328d('0x2b')][_0x328d('0x2c')]&&_0x53b477[_0x328d('0x2b')][_0x328d('0x2c')][_0x328d('0x2d')]?_0x53b477['queryResult']['diagnosticInfo']['fields'][_0x328d('0x2e')][_0x328d('0x2f')]:![];_0x3dcc57[_0x328d('0xb')][_0x328d('0x30')]=_0x53b477[_0x328d('0x2b')][_0x328d('0x31')];_0x3dcc57['body'][_0x328d('0x32')]=_0x53b477[_0x328d('0x2b')][_0x328d('0x33')];_0x3dcc57[_0x328d('0xb')][_0x328d('0x34')]=_0x53b477[_0x328d('0x2b')][_0x328d('0x2c')]&&_0x53b477[_0x328d('0x2b')]['diagnosticInfo'][_0x328d('0x2d')]?_0x53b477[_0x328d('0x2b')][_0x328d('0x2c')]['fields'][_0x328d('0x2e')][_0x328d('0x2f')]:![];_0x3dcc57[_0x328d('0xb')]['DIALOGFLOWV2_INTENTNAME']=_0x53b477[_0x328d('0x2b')]['intent'][_0x328d('0x35')];_0x3dcc57[_0x328d('0xb')][_0x328d('0x36')]=_0x53b477[_0x328d('0x2b')]['intent'][_0x328d('0x37')];_0x3dcc57[_0x328d('0xb')][_0x328d('0x38')]=_0x53b477[_0x328d('0x2b')][_0x328d('0x39')][_0x328d('0x3a')];_0x3dcc57[_0x328d('0xb')][_0x328d('0x3b')]=_0x53b477[_0x328d('0x2b')][_0x328d('0x3c')];_0x3dcc57[_0x328d('0xb')][_0x328d('0x3d')]=_0x53b477[_0x328d('0x2b')][_0x328d('0x3e')];_0x3dcc57[_0x328d('0xb')][_0x328d('0x3f')]=_0x53b477[_0x328d('0x2b')]['intentDetectionConfidence'];_0x256ee9[_0x328d('0x40')]=_0x328d('0x41');_0x256ee9[_0x328d('0x42')]=JSON[_0x328d('0x12')](_0x31ca5a);var _0x3ab87a=[];for(var _0x339dc0=0x0;_0x339dc0<_0x31ca5a['length'];_0x339dc0++){var _0x386b56=_0x31ca5a[_0x339dc0];if(_0x386b56&&_0x386b56['queryResult']&&_0x386b56[_0x328d('0x2b')]['fulfillmentText']){_0x3ab87a[_0x328d('0x43')](createMessage(_0x29897f,_0x43ed47,_0x256ee9,_0x386b56[_0x328d('0x2b')]['fulfillmentText']));}}return Promise[_0x328d('0x44')](_0x3ab87a)[_0x328d('0xd')](function(){if(_0x2de3ae){_0x5dcac1[_0x328d('0x15')]();}else{_0x5dcac1['stop']();}})[_0x328d('0x10')](function(_0x3c54ad){logger[_0x328d('0x11')](_0x328d('0xf'),_0x29897f,JSON[_0x328d('0x12')](_0x3c54ad));_0x5dcac1['next']();});}})[_0x328d('0x10')](function(_0x5d875c){logger['error']('[%s][DIALOGFLOWV2]\x20%s',_0x29897f,_0x5d875c[_0x328d('0x28')],_0x5d875c['stack']);_0x5dcac1[_0x328d('0x15')]();});}}catch(_0x45605a){logger[_0x328d('0x11')](_0x328d('0xf'),_0x29897f,JSON[_0x328d('0x12')](_0x45605a));_0x5dcac1[_0x328d('0x23')]();}};}; \ No newline at end of file +var _0xb6ce=['stop','[%s][DIALOGFLOWV2]\x20Welcome\x20Message\x20is\x20empty.\x20It\x20will\x20wait\x20for\x20a\x20message\x20from\x20customer!','message','detectIntent','length','dialogflowV2','queryResult','diagnosticInfo','fields','end_conversation','boolValue','action','DIALOGFLOWV2_ALLREQUIREDPARAMSPRESENT','allRequiredParamsPresent','DIALOGFLOWV2_ENDCONVERSATION','DIALOGFLOWV2_INTENTNAME','intent','name','DIALOGFLOWV2_INTENTDISPLAYNAME','displayName','DIALOGFLOWV2_ISFALLBACKINTENT','DIALOGFLOWV2_LANGUAGECODE','DIALOGFLOWV2_QUERYTEXT','queryText','DIALOGFLOWV2_SCORE','providerName','providerResponse','push','fulfillmentText','stack','lodash','dialogflow','moment','bluebird','routing','../../rpc/chatMessage','../../rpc/openchannelMessage','../../rpc/mailMessage','../../rpc/smsMessage','../../rpc/faxMessage','../../rpc/whatsappMessage','clone','body','Message','create','info','[%s][DIALOGFLOWV2]\x20%s','error','stringify','consequence','interaction','Agent\x20is\x20managing\x20the\x20interaction.\x20Go\x20to\x20next\x20application.','next','contact','format','channel','sms','phone','chat','ChatWebsiteId','account','upperFirst','AccountId','InteractionId','created','isEmpty','then','catch','finally','[%s][DIALOGFLOWV2]\x20Welcome\x20Message\x20has\x20been\x20sent!'];(function(_0x283fba,_0x5bd1ce){var _0xbe2968=function(_0x241f54){while(--_0x241f54){_0x283fba['push'](_0x283fba['shift']());}};_0xbe2968(++_0x5bd1ce);}(_0xb6ce,0x17c));var _0xeb6c=function(_0x4df84a,_0x19d74e){_0x4df84a=_0x4df84a-0x0;var _0x3c0e0a=_0xb6ce[_0x4df84a];return _0x3c0e0a;};'use strict';var _=require(_0xeb6c('0x0'));var dialogflow=require(_0xeb6c('0x1'));var md5=require('md5');var moment=require(_0xeb6c('0x2'));var Promise=require(_0xeb6c('0x3'));var logger=require('../../../../config/logger')(_0xeb6c('0x4'));var utils=require('./utils');var rpc={'chatMessage':require(_0xeb6c('0x5')),'openchannelMessage':require(_0xeb6c('0x6')),'mailMessage':require(_0xeb6c('0x7')),'smsMessage':require(_0xeb6c('0x8')),'faxMessage':require(_0xeb6c('0x9')),'whatsappMessage':require(_0xeb6c('0xa'))};function createMessage(_0x253c87,_0xd20136,_0x9a6983,_0x2724e1){return new Promise(function(_0x527602,_0x5e88ab){var _0x5e6ed6=_[_0xeb6c('0xb')](_0x9a6983);_0x5e6ed6[_0xeb6c('0xc')]=_0x2724e1;return rpc[_0xd20136+_0xeb6c('0xd')][_0xeb6c('0xe')](_0x5e6ed6)['then'](function(){logger[_0xeb6c('0xf')](_0xeb6c('0x10'),_0x253c87,_0x5e6ed6[_0xeb6c('0xc')]);_0x527602();})['catch'](function(_0x324027){logger[_0xeb6c('0x11')](_0xeb6c('0x10'),_0x253c87,JSON[_0xeb6c('0x12')](_0x324027));_0x5e88ab(_0x324027);});});}exports[_0xeb6c('0x13')]=function(_0x4015bd,_0x46d43b){return function(_0x2ba244){try{if(!_['isNil'](this[_0xeb6c('0x14')]['UserId'])){logger['info']('[%s][DIALOGFLOWV2]\x20%s',_0x4015bd,_0xeb6c('0x15'));return _0x2ba244[_0xeb6c('0x16')]();}var _0x51bb2e={'ContactId':this[_0xeb6c('0x17')]['id'],'sentAt':moment()[_0xeb6c('0x18')]('YYYY-MM-DD\x20HH:mm:ss'),'direction':'out'};if(this[_0xeb6c('0x19')]===_0xeb6c('0x1a')||this[_0xeb6c('0x19')]==='whatsapp'){_0x51bb2e['phone']=this[_0xeb6c('0x14')][_0xeb6c('0x1b')];}var _0x5e8cb5=this[_0xeb6c('0x19')];if(_0x5e8cb5===_0xeb6c('0x1c')){_0x51bb2e[_0xeb6c('0x1d')]=this[_0xeb6c('0x1e')]['id'];}else{_0x51bb2e[_[_0xeb6c('0x1f')](_0x5e8cb5)+_0xeb6c('0x20')]=this[_0xeb6c('0x1e')]['id'];}_0x51bb2e[_[_0xeb6c('0x1f')](_0x5e8cb5)+_0xeb6c('0x21')]=this[_0xeb6c('0x14')]['id'];if(this['interaction'][_0xeb6c('0x22')]){var _0x421f5f=_0x46d43b[0x4];if(!_[_0xeb6c('0x23')](_0x421f5f)){_0x51bb2e[_0xeb6c('0xc')]=utils['getMustacheRender'](_0x421f5f,this);return rpc[_0x5e8cb5+'Message'][_0xeb6c('0xe')](_0x51bb2e)[_0xeb6c('0x24')](function(_0x13f68f){logger[_0xeb6c('0xf')](_0xeb6c('0x10'),_0x4015bd,_0x51bb2e[_0xeb6c('0xc')]);})[_0xeb6c('0x25')](function(_0x5a837e){logger[_0xeb6c('0x11')](_0xeb6c('0x10'),_0x4015bd,JSON['stringify'](_0x5a837e));})[_0xeb6c('0x26')](function(){logger[_0xeb6c('0xf')](_0xeb6c('0x27'),_0x4015bd);_0x2ba244[_0xeb6c('0x28')]();});}else{logger[_0xeb6c('0xf')](_0xeb6c('0x29'),_0x4015bd);_0x2ba244[_0xeb6c('0x28')]();}}else{var _0x246472=this;var _0x5268af=_0x46d43b[0x2]['replace'](/\\n/g,'\x0a');var _0x2efe37={'credentials':{'private_key':_0x5268af,'client_email':_0x46d43b[0x1]}};var _0x51a3b8=new dialogflow['SessionsClient'](_0x2efe37);var _0x2e968a=_0x51a3b8['sessionPath'](_0x46d43b[0x0],md5(_0x246472['interaction']['id']));var _0x17b6d8={'session':_0x2e968a,'queryInput':{'text':{'text':_0x246472[_0xeb6c('0x2a')][_0xeb6c('0xc')],'languageCode':_0x46d43b[0x3]||'en'}}};return _0x51a3b8[_0xeb6c('0x2b')](_0x17b6d8)[_0xeb6c('0x24')](function(_0x18de97){if(_0x18de97&&_0x18de97[_0xeb6c('0x2c')]){_0x246472[_0xeb6c('0xc')][_0xeb6c('0x2d')]=_0x18de97;var _0x313a30=_0x18de97[0x0];var _0x3011b9=_0x313a30[_0xeb6c('0x2e')]['diagnosticInfo']&&_0x313a30[_0xeb6c('0x2e')][_0xeb6c('0x2f')][_0xeb6c('0x30')]?_0x313a30['queryResult'][_0xeb6c('0x2f')][_0xeb6c('0x30')][_0xeb6c('0x31')][_0xeb6c('0x32')]:![];_0x246472[_0xeb6c('0xc')]['DIALOGFLOWV2_ACTION']=_0x313a30['queryResult'][_0xeb6c('0x33')];_0x246472[_0xeb6c('0xc')][_0xeb6c('0x34')]=_0x313a30[_0xeb6c('0x2e')][_0xeb6c('0x35')];_0x246472['body'][_0xeb6c('0x36')]=_0x313a30[_0xeb6c('0x2e')][_0xeb6c('0x2f')]&&_0x313a30[_0xeb6c('0x2e')][_0xeb6c('0x2f')]['fields']?_0x313a30[_0xeb6c('0x2e')][_0xeb6c('0x2f')]['fields'][_0xeb6c('0x31')]['boolValue']:![];_0x246472[_0xeb6c('0xc')][_0xeb6c('0x37')]=_0x313a30[_0xeb6c('0x2e')][_0xeb6c('0x38')][_0xeb6c('0x39')];_0x246472[_0xeb6c('0xc')][_0xeb6c('0x3a')]=_0x313a30[_0xeb6c('0x2e')]['intent'][_0xeb6c('0x3b')];_0x246472[_0xeb6c('0xc')][_0xeb6c('0x3c')]=_0x313a30[_0xeb6c('0x2e')][_0xeb6c('0x38')]['isFallback'];_0x246472[_0xeb6c('0xc')][_0xeb6c('0x3d')]=_0x313a30[_0xeb6c('0x2e')]['languageCode'];_0x246472['body'][_0xeb6c('0x3e')]=_0x313a30[_0xeb6c('0x2e')][_0xeb6c('0x3f')];_0x246472[_0xeb6c('0xc')][_0xeb6c('0x40')]=_0x313a30[_0xeb6c('0x2e')]['intentDetectionConfidence'];_0x51bb2e[_0xeb6c('0x41')]=_0xeb6c('0x2d');_0x51bb2e[_0xeb6c('0x42')]=JSON['stringify'](_0x18de97);var _0x3f3b8f=[];for(var _0x414cd0=0x0;_0x414cd0<_0x18de97['length'];_0x414cd0++){var _0x220f95=_0x18de97[_0x414cd0];if(_0x220f95&&_0x220f95[_0xeb6c('0x2e')]&&_0x220f95[_0xeb6c('0x2e')]['fulfillmentText']){_0x3f3b8f[_0xeb6c('0x43')](createMessage(_0x4015bd,_0x5e8cb5,_0x51bb2e,_0x220f95[_0xeb6c('0x2e')][_0xeb6c('0x44')]));}}return Promise['all'](_0x3f3b8f)[_0xeb6c('0x24')](function(){if(_0x3011b9){_0x2ba244['next']();}else{_0x2ba244[_0xeb6c('0x28')]();}})['catch'](function(_0x8bea61){logger[_0xeb6c('0x11')](_0xeb6c('0x10'),_0x4015bd,JSON[_0xeb6c('0x12')](_0x8bea61));_0x2ba244[_0xeb6c('0x16')]();});}})[_0xeb6c('0x25')](function(_0x1c3d3a){logger['error']('[%s][DIALOGFLOWV2]\x20%s',_0x4015bd,_0x1c3d3a[_0xeb6c('0x2a')],_0x1c3d3a[_0xeb6c('0x45')]);_0x2ba244[_0xeb6c('0x16')]();});}}catch(_0x347495){logger[_0xeb6c('0x11')](_0xeb6c('0x10'),_0x4015bd,JSON[_0xeb6c('0x12')](_0x347495));_0x2ba244[_0xeb6c('0x28')]();}};}; \ No newline at end of file diff --git a/server/services/routing/server/applications/gotoif.js b/server/services/routing/server/applications/gotoif.js index 5dcfdf3..fd661e2 100644 --- a/server/services/routing/server/applications/gotoif.js +++ b/server/services/routing/server/applications/gotoif.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x9ee8=['getMustacheRender','replace','length','error','[%s][GOTOIF]\x20%s','message','stop','condition','priorityTrue','priorityFalse','info','[%s][GOTOIF]\x20condition\x20%s\x20is\x20%s\x20try\x20goto\x20priority\x20%s','findIndex','[%s][GOTOIF]\x20priority\x20%s\x20found\x20at\x20index:\x20%s','next','[%s][GOTOIF]\x20priority\x20%s\x20not\x20found','[%s][GOTOIF]\x20eval\x20error:\x20%s','stringify','validate','lodash','html-to-text','./utils','../../../../config/logger','routing','string','number','priority\x20false\x20is\x20a\x20number','consequence','fromString'];(function(_0x9486d9,_0x32d164){var _0x110cdd=function(_0xe2f42b){while(--_0xe2f42b){_0x9486d9['push'](_0x9486d9['shift']());}};_0x110cdd(++_0x32d164);}(_0x9ee8,0x117));var _0x89ee=function(_0x199595,_0x392698){_0x199595=_0x199595-0x0;var _0x2efd57=_0x9ee8[_0x199595];return _0x2efd57;};'use strict';var schema=require(_0x89ee('0x0'));var _=require(_0x89ee('0x1'));var htmlToText=require(_0x89ee('0x2'));var utils=require(_0x89ee('0x3'));var logger=require(_0x89ee('0x4'))(_0x89ee('0x5'));var gotoif=schema({'condition':{'type':_0x89ee('0x6'),'required':!![],'message':'condition\x20is\x20a\x20string\x20and\x20it\x20is\x20required'},'priorityTrue':{'type':_0x89ee('0x7'),'message':'priority\x20true\x20is\x20a\x20number'},'priorityFalse':{'type':_0x89ee('0x7'),'message':_0x89ee('0x8')}});exports[_0x89ee('0x9')]=function(_0x2b5ce7,_0x597a34){return function(_0x346d25){try{var _0xd8ddd8={'condition':htmlToText[_0x89ee('0xa')](utils[_0x89ee('0xb')](_0x597a34[0x0],this),{'wordwrap':![]})[_0x89ee('0xc')](/<\/?[^>]+(>|$)/g,''),'priorityTrue':_0x597a34[0x1],'priorityFalse':_0x597a34[0x2]};var _0x5372f2=gotoif[_0x89ee('0x0')](_0xd8ddd8,{'typecast':!![]});if(_0x5372f2[_0x89ee('0xd')]){logger[_0x89ee('0xe')](_0x89ee('0xf'),_0x2b5ce7,_['map'](_0x5372f2,_0x89ee('0x10'))['join'](',\x20'));_0x346d25[_0x89ee('0x11')]();}else{try{var _0x4d2fa0=eval('('+_0xd8ddd8[_0x89ee('0x12')]+')');var _0x11f765=_0x4d2fa0?_0xd8ddd8[_0x89ee('0x13')]:_0xd8ddd8[_0x89ee('0x14')];logger[_0x89ee('0x15')](_0x89ee('0x16'),_0x2b5ce7,_0xd8ddd8[_0x89ee('0x12')],_0x4d2fa0,_0x11f765||'next');if(_0x11f765){var _0x5a0cd4=_[_0x89ee('0x17')](_0x346d25['rules'](),{'p':_0x11f765});if(_0x5a0cd4>=0x0){logger[_0x89ee('0x15')](_0x89ee('0x18'),_0x2b5ce7,_0x11f765||_0x89ee('0x19'),_0x5a0cd4);_0x346d25[_0x89ee('0x19')](_0x5a0cd4);}else{logger['info'](_0x89ee('0x1a'),_0x2b5ce7,_0x11f765||_0x89ee('0x19'));_0x346d25['stop']();}}else{_0x346d25[_0x89ee('0x19')]();}}catch(_0x590cad){logger[_0x89ee('0xe')](_0x89ee('0x1b'),_0x2b5ce7,_0x590cad['message']);_0x346d25[_0x89ee('0x11')]();}}}catch(_0x592935){logger[_0x89ee('0xe')](_0x89ee('0xf'),_0x2b5ce7,JSON[_0x89ee('0x1c')](_0x592935));_0x346d25['stop']();}};}; \ No newline at end of file +var _0x63fe=['[%s][GOTOIF]\x20priority\x20%s\x20not\x20found','[%s][GOTOIF]\x20eval\x20error:\x20%s','stringify','validate','lodash','html-to-text','./utils','routing','string','condition\x20is\x20a\x20string\x20and\x20it\x20is\x20required','number','priority\x20true\x20is\x20a\x20number','priority\x20false\x20is\x20a\x20number','consequence','fromString','getMustacheRender','length','error','[%s][GOTOIF]\x20%s','map','message','join','stop','priorityTrue','priorityFalse','[%s][GOTOIF]\x20condition\x20%s\x20is\x20%s\x20try\x20goto\x20priority\x20%s','next','findIndex','rules','info','[%s][GOTOIF]\x20priority\x20%s\x20found\x20at\x20index:\x20%s'];(function(_0x3db0be,_0x364382){var _0x2cf951=function(_0x2f367c){while(--_0x2f367c){_0x3db0be['push'](_0x3db0be['shift']());}};_0x2cf951(++_0x364382);}(_0x63fe,0x1b5));var _0xe63f=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0x63fe[_0x3dd15e];return _0x231fd0;};'use strict';var schema=require(_0xe63f('0x0'));var _=require(_0xe63f('0x1'));var htmlToText=require(_0xe63f('0x2'));var utils=require(_0xe63f('0x3'));var logger=require('../../../../config/logger')(_0xe63f('0x4'));var gotoif=schema({'condition':{'type':_0xe63f('0x5'),'required':!![],'message':_0xe63f('0x6')},'priorityTrue':{'type':_0xe63f('0x7'),'message':_0xe63f('0x8')},'priorityFalse':{'type':_0xe63f('0x7'),'message':_0xe63f('0x9')}});exports[_0xe63f('0xa')]=function(_0x329f5c,_0xa2e1e9){return function(_0x5721f1){try{var _0x26d121={'condition':htmlToText[_0xe63f('0xb')](utils[_0xe63f('0xc')](_0xa2e1e9[0x0],this),{'wordwrap':![]})['replace'](/<\/?[^>]+(>|$)/g,''),'priorityTrue':_0xa2e1e9[0x1],'priorityFalse':_0xa2e1e9[0x2]};var _0x18145c=gotoif[_0xe63f('0x0')](_0x26d121,{'typecast':!![]});if(_0x18145c[_0xe63f('0xd')]){logger[_0xe63f('0xe')](_0xe63f('0xf'),_0x329f5c,_[_0xe63f('0x10')](_0x18145c,_0xe63f('0x11'))[_0xe63f('0x12')](',\x20'));_0x5721f1[_0xe63f('0x13')]();}else{try{var _0x58c919=eval('('+_0x26d121['condition']+')');var _0x2582eb=_0x58c919?_0x26d121[_0xe63f('0x14')]:_0x26d121[_0xe63f('0x15')];logger['info'](_0xe63f('0x16'),_0x329f5c,_0x26d121['condition'],_0x58c919,_0x2582eb||_0xe63f('0x17'));if(_0x2582eb){var _0x434549=_[_0xe63f('0x18')](_0x5721f1[_0xe63f('0x19')](),{'p':_0x2582eb});if(_0x434549>=0x0){logger[_0xe63f('0x1a')](_0xe63f('0x1b'),_0x329f5c,_0x2582eb||_0xe63f('0x17'),_0x434549);_0x5721f1['next'](_0x434549);}else{logger['info'](_0xe63f('0x1c'),_0x329f5c,_0x2582eb||'next');_0x5721f1[_0xe63f('0x13')]();}}else{_0x5721f1[_0xe63f('0x17')]();}}catch(_0x527e29){logger['error'](_0xe63f('0x1d'),_0x329f5c,_0x527e29[_0xe63f('0x11')]);_0x5721f1['stop']();}}}catch(_0x1c89f2){logger['error'](_0xe63f('0xf'),_0x329f5c,JSON[_0xe63f('0x1e')](_0x1c89f2));_0x5721f1[_0xe63f('0x13')]();}};}; \ 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 ade47d5..1fc3e74 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 _0x7c1a=['error','lodash','../../../../config/logger','number','consequence','validate','length','[%s][GOTOP]\x20%s','map','join','stop','info','[%s][GOTOP]\x20priority\x20%s','priority','findIndex','[%s][GOTOP]\x20priority\x20%s\x20found\x20at\x20index:\x20%s','next','[%s][GOTOP]\x20priority\x20%s\x20not\x20found'];(function(_0x477380,_0x22d504){var _0x419c18=function(_0x87ef5){while(--_0x87ef5){_0x477380['push'](_0x477380['shift']());}};_0x419c18(++_0x22d504);}(_0x7c1a,0x1b1));var _0xa7c1=function(_0x122fe6,_0x4ac758){_0x122fe6=_0x122fe6-0x0;var _0x36b7d2=_0x7c1a[_0x122fe6];return _0x36b7d2;};'use strict';var schema=require('validate');var _=require(_0xa7c1('0x0'));var logger=require(_0xa7c1('0x1'))('routing');var gotop=schema({'priority':{'type':_0xa7c1('0x2'),'required':!![],'message':'priority\x20is\x20a\x20number\x20and\x20it\x20is\x20required'}});exports[_0xa7c1('0x3')]=function(_0x46eff1,_0x2b64a6){return function(_0x3fb056){try{var _0x2c1643={'priority':_0x2b64a6[0x0]};var _0x315088=gotop[_0xa7c1('0x4')](_0x2c1643,{'typecast':!![]});if(_0x315088[_0xa7c1('0x5')]){logger['error'](_0xa7c1('0x6'),_0x46eff1,_[_0xa7c1('0x7')](_0x315088,'message')[_0xa7c1('0x8')](',\x20'));_0x3fb056[_0xa7c1('0x9')]();}else{logger[_0xa7c1('0xa')](_0xa7c1('0xb'),_0x46eff1,_0x2c1643[_0xa7c1('0xc')]);if(_0x2c1643[_0xa7c1('0xc')]){var _0x39392f=_[_0xa7c1('0xd')](_0x3fb056['rules'](),{'p':_0x2c1643[_0xa7c1('0xc')]});if(_0x39392f>=0x0){logger[_0xa7c1('0xa')](_0xa7c1('0xe'),_0x46eff1,_0x2c1643[_0xa7c1('0xc')]||_0xa7c1('0xf'),_0x39392f);_0x3fb056[_0xa7c1('0xf')](_0x39392f);}else{logger[_0xa7c1('0xa')](_0xa7c1('0x10'),_0x46eff1,_0x2c1643['priority']||'next');_0x3fb056[_0xa7c1('0x9')]();}}else{_0x3fb056[_0xa7c1('0xf')]();}}}catch(_0x528c83){logger[_0xa7c1('0x11')](_0xa7c1('0x6'),_0x46eff1,JSON['stringify'](_0x528c83));_0x3fb056[_0xa7c1('0x9')]();}};}; \ No newline at end of file +var _0x0b3a=['[%s][GOTOP]\x20%s','stringify','validate','lodash','../../../../config/logger','routing','number','priority\x20is\x20a\x20number\x20and\x20it\x20is\x20required','consequence','length','error','map','message','join','stop','info','priority','findIndex','rules','[%s][GOTOP]\x20priority\x20%s\x20found\x20at\x20index:\x20%s','next','[%s][GOTOP]\x20priority\x20%s\x20not\x20found'];(function(_0x5817ee,_0x591dc4){var _0x5a403c=function(_0x2856fb){while(--_0x2856fb){_0x5817ee['push'](_0x5817ee['shift']());}};_0x5a403c(++_0x591dc4);}(_0x0b3a,0x1d0));var _0xa0b3=function(_0x2dacca,_0x3b55a5){_0x2dacca=_0x2dacca-0x0;var _0x4e8745=_0x0b3a[_0x2dacca];return _0x4e8745;};'use strict';var schema=require(_0xa0b3('0x0'));var _=require(_0xa0b3('0x1'));var logger=require(_0xa0b3('0x2'))(_0xa0b3('0x3'));var gotop=schema({'priority':{'type':_0xa0b3('0x4'),'required':!![],'message':_0xa0b3('0x5')}});exports[_0xa0b3('0x6')]=function(_0x406ac0,_0x82e3d9){return function(_0xaaa732){try{var _0x1012e9={'priority':_0x82e3d9[0x0]};var _0x41dfa4=gotop[_0xa0b3('0x0')](_0x1012e9,{'typecast':!![]});if(_0x41dfa4[_0xa0b3('0x7')]){logger[_0xa0b3('0x8')]('[%s][GOTOP]\x20%s',_0x406ac0,_[_0xa0b3('0x9')](_0x41dfa4,_0xa0b3('0xa'))[_0xa0b3('0xb')](',\x20'));_0xaaa732[_0xa0b3('0xc')]();}else{logger[_0xa0b3('0xd')]('[%s][GOTOP]\x20priority\x20%s',_0x406ac0,_0x1012e9[_0xa0b3('0xe')]);if(_0x1012e9[_0xa0b3('0xe')]){var _0x575f52=_[_0xa0b3('0xf')](_0xaaa732[_0xa0b3('0x10')](),{'p':_0x1012e9[_0xa0b3('0xe')]});if(_0x575f52>=0x0){logger[_0xa0b3('0xd')](_0xa0b3('0x11'),_0x406ac0,_0x1012e9[_0xa0b3('0xe')]||'next',_0x575f52);_0xaaa732[_0xa0b3('0x12')](_0x575f52);}else{logger[_0xa0b3('0xd')](_0xa0b3('0x13'),_0x406ac0,_0x1012e9[_0xa0b3('0xe')]||_0xa0b3('0x12'));_0xaaa732[_0xa0b3('0xc')]();}}else{_0xaaa732[_0xa0b3('0x12')]();}}}catch(_0x581824){logger['error'](_0xa0b3('0x14'),_0x406ac0,JSON[_0xa0b3('0x15')](_0x581824));_0xaaa732[_0xa0b3('0xc')]();}};}; \ No newline at end of file diff --git a/server/services/routing/server/applications/message.js b/server/services/routing/server/applications/message.js index 05f51fd..9ded99f 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 _0xf35d=['[%s][MESSAGE]\x20%s','body','next','stop','error','stringify','lodash','../../../../config/logger','../../rpc/chatMessage','../../rpc/openchannelMessage','../../rpc/smsMessage','../../rpc/whatsappMessage','consequence','getMustacheRender','ChatWebsiteId','channel','AccountId','InteractionId','interaction','Message','then','info'];(function(_0x4582ab,_0x455427){var _0x43e6ff=function(_0x1cfdd5){while(--_0x1cfdd5){_0x4582ab['push'](_0x4582ab['shift']());}};_0x43e6ff(++_0x455427);}(_0xf35d,0x17c));var _0xdf35=function(_0x231185,_0xb9d41){_0x231185=_0x231185-0x0;var _0x567a0c=_0xf35d[_0x231185];return _0x567a0c;};'use strict';var _=require(_0xdf35('0x0'));var utils=require('./utils');var logger=require(_0xdf35('0x1'))('routing');var rpc={'chatMessage':require(_0xdf35('0x2')),'openchannelMessage':require(_0xdf35('0x3')),'mailMessage':require('../../rpc/mailMessage'),'smsMessage':require(_0xdf35('0x4')),'faxMessage':require('../../rpc/faxMessage'),'whatsappMessage':require(_0xdf35('0x5'))};exports[_0xdf35('0x6')]=function(_0x2f8c51,_0x7cfe71){return function(_0x41036b){try{var _0x30e2ee={'body':utils[_0xdf35('0x7')](_0x7cfe71[0x0],this),'ContactId':this['contact']['id']};if(this['channel']==='chat'){_0x30e2ee[_0xdf35('0x8')]=this['account']['id'];}else{_0x30e2ee[_['upperFirst'](this[_0xdf35('0x9')])+_0xdf35('0xa')]=this['account']['id'];}_0x30e2ee[_['upperFirst'](this[_0xdf35('0x9')])+_0xdf35('0xb')]=this[_0xdf35('0xc')]['id'];if(rpc[this[_0xdf35('0x9')]+_0xdf35('0xd')]){return rpc[this[_0xdf35('0x9')]+_0xdf35('0xd')]['create'](_0x30e2ee)[_0xdf35('0xe')](function(_0x2b7cbd){logger[_0xdf35('0xf')](_0xdf35('0x10'),_0x2f8c51,_0x30e2ee[_0xdf35('0x11')]);_0x41036b[_0xdf35('0x12')]();})['catch'](function(_0x1cf678){logger['error'](_0xdf35('0x10'),_0x2f8c51,JSON['stringify'](_0x1cf678));_0x41036b[_0xdf35('0x13')]();});}}catch(_0x671421){logger[_0xdf35('0x14')]('[%s][MESSAGE]\x20%s',_0x2f8c51,JSON[_0xdf35('0x15')](_0x671421));_0x41036b[_0xdf35('0x13')]();}};}; \ No newline at end of file +var _0x7c47=['routing','../../rpc/chatMessage','../../rpc/openchannelMessage','../../rpc/mailMessage','../../rpc/smsMessage','../../rpc/faxMessage','consequence','contact','channel','chat','ChatWebsiteId','account','upperFirst','InteractionId','interaction','Message','info','body','next','catch','error','stringify','stop','[%s][MESSAGE]\x20%s','lodash','../../../../config/logger'];(function(_0x103b32,_0xb3dac3){var _0x1d3b32=function(_0x51fc3e){while(--_0x51fc3e){_0x103b32['push'](_0x103b32['shift']());}};_0x1d3b32(++_0xb3dac3);}(_0x7c47,0x1b8));var _0x77c4=function(_0x15fa79,_0x5fc825){_0x15fa79=_0x15fa79-0x0;var _0x13f21d=_0x7c47[_0x15fa79];return _0x13f21d;};'use strict';var _=require(_0x77c4('0x0'));var utils=require('./utils');var logger=require(_0x77c4('0x1'))(_0x77c4('0x2'));var rpc={'chatMessage':require(_0x77c4('0x3')),'openchannelMessage':require(_0x77c4('0x4')),'mailMessage':require(_0x77c4('0x5')),'smsMessage':require(_0x77c4('0x6')),'faxMessage':require(_0x77c4('0x7')),'whatsappMessage':require('../../rpc/whatsappMessage')};exports[_0x77c4('0x8')]=function(_0x5b6e09,_0x58f8e6){return function(_0x204030){try{var _0x440887={'body':utils['getMustacheRender'](_0x58f8e6[0x0],this),'ContactId':this[_0x77c4('0x9')]['id']};if(this[_0x77c4('0xa')]===_0x77c4('0xb')){_0x440887[_0x77c4('0xc')]=this[_0x77c4('0xd')]['id'];}else{_0x440887[_[_0x77c4('0xe')](this[_0x77c4('0xa')])+'AccountId']=this[_0x77c4('0xd')]['id'];}_0x440887[_[_0x77c4('0xe')](this[_0x77c4('0xa')])+_0x77c4('0xf')]=this[_0x77c4('0x10')]['id'];if(rpc[this[_0x77c4('0xa')]+'Message']){return rpc[this[_0x77c4('0xa')]+_0x77c4('0x11')]['create'](_0x440887)['then'](function(_0x45a7bf){logger[_0x77c4('0x12')]('[%s][MESSAGE]\x20%s',_0x5b6e09,_0x440887[_0x77c4('0x13')]);_0x204030[_0x77c4('0x14')]();})[_0x77c4('0x15')](function(_0x18ccc6){logger[_0x77c4('0x16')]('[%s][MESSAGE]\x20%s',_0x5b6e09,JSON[_0x77c4('0x17')](_0x18ccc6));_0x204030[_0x77c4('0x18')]();});}}catch(_0x482ee0){logger[_0x77c4('0x16')](_0x77c4('0x19'),_0x5b6e09,JSON[_0x77c4('0x17')](_0x482ee0));_0x204030[_0x77c4('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 753ebe1..d8b963c 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 _0x73ba=['getMustacheRender','next','stringify','./utils','[%s][NOOP]\x20%s'];(function(_0x1fa7ce,_0x474f24){var _0x33acca=function(_0x62c5ad){while(--_0x62c5ad){_0x1fa7ce['push'](_0x1fa7ce['shift']());}};_0x33acca(++_0x474f24);}(_0x73ba,0x193));var _0xa73b=function(_0x40666c,_0x55c831){_0x40666c=_0x40666c-0x0;var _0x49e3cc=_0x73ba[_0x40666c];return _0x49e3cc;};'use strict';var utils=require(_0xa73b('0x0'));var logger=require('../../../../config/logger')('routing');exports['consequence']=function(_0x41e632,_0x58810f){return function(_0x10696c){try{logger['info'](_0xa73b('0x1'),_0x41e632,utils[_0xa73b('0x2')](_0x58810f[0x0],this));_0x10696c[_0xa73b('0x3')]();}catch(_0x3c223d){logger['error'](_0xa73b('0x1'),_0x41e632,JSON[_0xa73b('0x4')](_0x3c223d));_0x10696c['stop']();}};}; \ No newline at end of file +var _0xbb48=['next','error','[%s][NOOP]\x20%s','stringify','stop','./utils','../../../../config/logger','routing','consequence','getMustacheRender'];(function(_0x1ce7d0,_0x3b8310){var _0x2bfbf4=function(_0x3a8139){while(--_0x3a8139){_0x1ce7d0['push'](_0x1ce7d0['shift']());}};_0x2bfbf4(++_0x3b8310);}(_0xbb48,0x9b));var _0x8bb4=function(_0x4565bf,_0x5ad9d6){_0x4565bf=_0x4565bf-0x0;var _0x5610ba=_0xbb48[_0x4565bf];return _0x5610ba;};'use strict';var utils=require(_0x8bb4('0x0'));var logger=require(_0x8bb4('0x1'))(_0x8bb4('0x2'));exports[_0x8bb4('0x3')]=function(_0x51a2fc,_0x1465ba){return function(_0x21d0ec){try{logger['info']('[%s][NOOP]\x20%s',_0x51a2fc,utils[_0x8bb4('0x4')](_0x1465ba[0x0],this));_0x21d0ec[_0x8bb4('0x5')]();}catch(_0x492c90){logger[_0x8bb4('0x6')](_0x8bb4('0x7'),_0x51a2fc,JSON[_0x8bb4('0x8')](_0x492c90));_0x21d0ec[_0x8bb4('0x9')]();}};}; \ No newline at end of file diff --git a/server/services/routing/server/applications/queue.js b/server/services/routing/server/applications/queue.js index efe6025..40e4f60 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 _0x8856=['../../rpc/smsInteraction','string','name\x20is\x20a\x20string\x20and\x20it\x20is\x20required','number','timeout\x20is\x20a\x20number','waiting','body','YYYY-MM-DD\x20HH:mm:ss','contact','list','upperFirst','channel','QueueId','MessageId','message','chat','AccountId','WebsiteId','info','[%s][START:QUEUE][NAME:%s]','name','QueueReport','create','catch','create\x20queue\x20report','accepted','[%s][STOP:QUEUE][NAME:%s]','Interaction','update','interaction','then','update\x20queue\x20report','timeout','error','toLowerCase','consequence','length','[%s][QUEUE]\x20%s','map','join','stop','find','atimeout','qtimeout','end','[%s][QUEUE]\x20ROUTING\x20STOPPED','close','rules','complete','[%s][QUEUE]\x20APPLICATION\x20END','next','strategy','rrmemory','beepall','[%s][QUEUE]\x20queue\x20not\x20found\x20%s','stack','validate','lodash','moment','ioredis','../../../../config/environment','./strategy','redis','defaults','socket.io-emitter','queue','from','emit','clone','queue_id','account','push','capitalize','InteractionId','pick','format','%sQueuesWaitingInteractions','%s_queue_waiting_interaction:%s','save','remove','../../rpc/mailQueueReport','../../rpc/chatQueueReport','../../rpc/faxQueueReport','../../rpc/chatInteraction','../../rpc/faxInteraction'];(function(_0x1b9c27,_0x126fd0){var _0x34d9c3=function(_0x4c1697){while(--_0x4c1697){_0x1b9c27['push'](_0x1b9c27['shift']());}};_0x34d9c3(++_0x126fd0);}(_0x8856,0xe2));var _0x6885=function(_0x321bb2,_0x202794){_0x321bb2=_0x321bb2-0x0;var _0x9c12ed=_0x8856[_0x321bb2];return _0x9c12ed;};'use strict';var schema=require(_0x6885('0x0'));var _=require(_0x6885('0x1'));var util=require('util');var seqqueue=require('seq-queue');var moment=require(_0x6885('0x2'));var Redis=require(_0x6885('0x3'));var config=require(_0x6885('0x4'));var logger=require('../../../../config/logger')('routing');var strategy=require(_0x6885('0x5'));config[_0x6885('0x6')]=_[_0x6885('0x7')](config[_0x6885('0x6')],{'host':'localhost','port':0x18eb});var io=require(_0x6885('0x8'))(new Redis(config[_0x6885('0x6')]));var attributes=['id','queue_id','account',_0x6885('0x9'),_0x6885('0xa'),'joinAt'];function emit(_0x4f6106,_0x15808a,_0x440687){io['to'](_0x4f6106)[_0x6885('0xb')](_0x15808a,_0x440687);}function emitChannelQueueInteraction(_0x243f10,_0x2083d1,_0xd605f5,_0x59a33a,_0x3a9203,_0x35d795,_0x52b619,_0x67bcf5){var _0x39755c=_[_0x6885('0xc')](_0xd605f5);_0x39755c[_0x6885('0xd')]=_0x67bcf5;_0x39755c['queue']=_0x2083d1;_0x39755c[_0x6885('0xe')]=_0x59a33a;_0x39755c['id']=_0x3a9203;if(_0x35d795){attributes[_0x6885('0xf')](_[_0x6885('0x10')](_0x243f10)+_0x6885('0x11'));_0x52b619[util['format']('%sQueuesWaitingInteractions',_0x243f10)][_0x3a9203]=_[_0x6885('0x12')](_0x39755c,attributes);}else{delete _0x52b619[util[_0x6885('0x13')](_0x6885('0x14'),_0x243f10)][_0x3a9203];}emit(util[_0x6885('0x13')]('%s:queue:%s',_0x243f10,_0x2083d1),util[_0x6885('0x13')](_0x6885('0x15'),_0x243f10,_0x35d795?_0x6885('0x16'):_0x6885('0x17')),_[_0x6885('0x12')](_0x39755c,attributes));}var rpc={'openchannelQueueReport':require('../../rpc/openchannelQueueReport'),'mailQueueReport':require(_0x6885('0x18')),'chatQueueReport':require(_0x6885('0x19')),'smsQueueReport':require('../../rpc/smsQueueReport'),'faxQueueReport':require(_0x6885('0x1a')),'whatsappQueueReport':require('../../rpc/whatsappQueueReport'),'chatInteraction':require(_0x6885('0x1b')),'faxInteraction':require(_0x6885('0x1c')),'mailInteraction':require('../../rpc/mailInteraction'),'openchannelInteraction':require('../../rpc/openchannelInteraction'),'smsInteraction':require(_0x6885('0x1d')),'whatsappInteraction':require('../../rpc/whatsappInteraction')};var queue=schema({'name':{'type':_0x6885('0x1e'),'required':!![],'message':_0x6885('0x1f')},'timeout':{'type':_0x6885('0x20'),'message':_0x6885('0x21')}});function startRouting(_0x53c991,_0x445984,_0x55cd94,_0x5981e7){if(_0x53c991&&_0x445984&&_0x55cd94){_0x445984[_0x6885('0x22')]+=0x1;var _0x2db5c2={'uniqueid':_0x53c991,'from':_0x55cd94[_0x6885('0x23')]?_0x55cd94[_0x6885('0x23')][_0x6885('0xa')]:'','joinAt':moment()[_0x6885('0x13')](_0x6885('0x24')),'ContactId':_0x55cd94['contact']?_0x55cd94[_0x6885('0x25')]['id']:null,'ListId':_0x55cd94[_0x6885('0x26')]?_0x55cd94[_0x6885('0x26')]['id']:null};_0x2db5c2[_[_0x6885('0x27')](_0x55cd94[_0x6885('0x28')])+_0x6885('0x29')]=_0x445984['id']||null;_0x2db5c2[_[_0x6885('0x27')](_0x55cd94[_0x6885('0x28')])+'InteractionId']=_0x55cd94['interaction']?_0x55cd94['interaction']['id']:null;_0x2db5c2[_[_0x6885('0x27')](_0x55cd94['channel'])+_0x6885('0x2a')]=_0x55cd94[_0x6885('0x2b')]?_0x55cd94['message']['id']:null;_0x2db5c2[_[_0x6885('0x27')](_0x55cd94[_0x6885('0x28')])+(_0x55cd94[_0x6885('0x28')]!==_0x6885('0x2c')?_0x6885('0x2d'):_0x6885('0x2e'))]=_0x55cd94[_0x6885('0xe')]?_0x55cd94[_0x6885('0xe')]['id']:null;logger[_0x6885('0x2f')](util[_0x6885('0x13')](_0x6885('0x30'),_0x53c991,_0x445984['name']));emitChannelQueueInteraction(_0x55cd94[_0x6885('0x28')],_0x445984[_0x6885('0x31')],_0x2db5c2,_0x55cd94[_0x6885('0xe')][_0x6885('0x31')],_0x55cd94[_0x6885('0x2b')]['id'],!![],_0x5981e7,_0x445984['id']);if(rpc[_0x55cd94[_0x6885('0x28')]+_0x6885('0x32')]){return rpc[_0x55cd94[_0x6885('0x28')]+_0x6885('0x32')][_0x6885('0x33')](_0x2db5c2)[_0x6885('0x34')](function(_0x227338){logger['error'](_0x6885('0x35'),_0x227338);});}}}function stopRouting(_0x2e0ea9,_0x78fc6d,_0x2aaeac,_0x368a33){if(_0x2e0ea9&&_0x78fc6d){_0x78fc6d['waiting']-=0x1;var _0x5a8f54={'leaveAt':moment()[_0x6885('0x13')](_0x6885('0x24')),'acceptAt':moment()['format'](_0x6885('0x24')),'reason':_0x6885('0x36')};logger[_0x6885('0x2f')](util[_0x6885('0x13')](_0x6885('0x37'),_0x2e0ea9,_0x78fc6d['name']));emitChannelQueueInteraction(_0x2aaeac['channel'],_0x78fc6d[_0x6885('0x31')],_0x2aaeac[_0x6885('0x23')],_0x2aaeac['account'][_0x6885('0x31')],_0x2aaeac['message']['id'],![],_0x368a33,_0x78fc6d['id']);return rpc[_0x2aaeac[_0x6885('0x28')]+_0x6885('0x38')][_0x6885('0x39')](_0x2aaeac[_0x6885('0x3a')]['id'],{'queueId':_0x78fc6d['id']})[_0x6885('0x3b')](function(){if(rpc[_0x2aaeac[_0x6885('0x28')]+_0x6885('0x32')]){return rpc[_0x2aaeac['channel']+_0x6885('0x32')][_0x6885('0x39')](_0x2e0ea9,_0x5a8f54)[_0x6885('0x34')](function(_0x8faf64){logger['error'](_0x6885('0x3c'),_0x8faf64);});}});}}function endRouting(_0x1a5974,_0x264c7b,_0x31ac16,_0x1d969f){if(_0x1a5974&&_0x264c7b){_0x264c7b['waiting']-=0x1;var _0x2d2213={'leaveAt':moment()[_0x6885('0x13')](_0x6885('0x24')),'exitAt':moment()[_0x6885('0x13')](_0x6885('0x24')),'reason':_0x6885('0x3d')};logger[_0x6885('0x2f')](util[_0x6885('0x13')]('[%s][END:QUEUE][NAME:%s]',_0x1a5974,_0x264c7b[_0x6885('0x31')]));emitChannelQueueInteraction(_0x31ac16[_0x6885('0x28')],_0x264c7b[_0x6885('0x31')],_0x31ac16[_0x6885('0x23')],_0x31ac16[_0x6885('0xe')]['name'],_0x31ac16[_0x6885('0x2b')]['id'],![],_0x1d969f);if(rpc[_0x31ac16[_0x6885('0x28')]+_0x6885('0x32')]){return rpc[_0x31ac16[_0x6885('0x28')]+_0x6885('0x32')][_0x6885('0x39')](_0x1a5974,_0x2d2213)[_0x6885('0x34')](function(_0x298465){logger[_0x6885('0x3e')](_0x6885('0x3c'),_0x298465);});}}}function handleFindQueue(_0x5c7467){return function(_0x58a362){return _0x58a362[_0x6885('0x31')][_0x6885('0x3f')]()===_0x5c7467[_0x6885('0x3f')]();};}exports[_0x6885('0x40')]=function(_0x15506c,_0x711c37,_0x35ea6e,_0x5baebd){return function(_0xb97d1e){try{var _0x448248={'name':_0x711c37[0x0],'timeout':_0x711c37[0x1]};var _0x109680=queue[_0x6885('0x0')](_0x448248,{'typecast':!![]});if(_0x109680[_0x6885('0x41')]){logger['error'](_0x6885('0x42'),_0x15506c,_[_0x6885('0x43')](_0x109680,'message')[_0x6885('0x44')](',\x20'));_0xb97d1e[_0x6885('0x45')]();}else{var _0x220207=_[_0x6885('0x46')](_0x35ea6e[_0x5baebd['channel']+'Queues'],handleFindQueue(_0x448248[_0x6885('0x31')]));if(_0x220207){startRouting(_0x15506c,_0x220207,_0x5baebd,_0x35ea6e);var _0x1e893e=(_0x220207[_0x6885('0x3d')]||0xa)*0x3e8;var _0x1a03ee=(_0x448248[_0x6885('0x3d')]||0x14)*0x3e8;var _0x26fbaf;if(_0x1e893e>_0x1a03ee){_0x1a03ee=_0x1e893e;}var _0x9dfe11=seqqueue['createQueue'](_0x1e893e);_0x9dfe11['id']=_0x15506c;_0x9dfe11[_0x6885('0x47')]=_0x1e893e;_0x9dfe11[_0x6885('0x48')]=_0x1a03ee;_0x9dfe11[_0x6885('0x28')]=_0x5baebd[_0x6885('0x28')];_0x35ea6e['rules'][_0x15506c]['on'](_0x6885('0x49'),function(){logger[_0x6885('0x2f')](_0x6885('0x4a'),_0x15506c);stopRouting(_0x15506c,_0x220207,_0x5baebd,_0x35ea6e);clearTimeout(_0x26fbaf);_0x26fbaf=undefined;_0x9dfe11[_0x6885('0x4b')](!![]);if(_0x35ea6e[_0x6885('0x4c')][_0x15506c]){delete _0x35ea6e['rules'][_0x15506c];}_0xb97d1e['stop']();});_0x35ea6e[_0x6885('0x4c')][_0x15506c]['on'](_0x6885('0x4d'),function(){if(_0x35ea6e[_0x6885('0x4c')][_0x15506c]){delete _0x35ea6e[_0x6885('0x4c')][_0x15506c];}});_0x26fbaf=setTimeout(function(){logger[_0x6885('0x2f')](_0x6885('0x4e'),_0x15506c);endRouting(_0x15506c,_0x220207,_0x5baebd,_0x35ea6e);clearTimeout(_0x26fbaf);_0x9dfe11[_0x6885('0x4b')](!![]);_0xb97d1e[_0x6885('0x4f')]();},_0x1a03ee);switch(_0x220207[_0x6885('0x50')]){case _0x6885('0x51'):strategy['rrmemory'](_0x9dfe11,_0x220207,_0x35ea6e,_0x5baebd);break;default:strategy[_0x6885('0x52')](_0x9dfe11,_0x220207,_0x35ea6e,_0x5baebd);}}else{logger[_0x6885('0x3e')](_0x6885('0x53'),_0x15506c,_0x448248['name']);_0xb97d1e[_0x6885('0x45')]();}}}catch(_0x27e2d7){logger[_0x6885('0x3e')](_0x6885('0x42'),_0x15506c,_0x27e2d7[_0x6885('0x54')]);_0xb97d1e[_0x6885('0x45')]();}};}; \ No newline at end of file +var _0xc4bc=['%s:queue:%s','%s_queue_waiting_interaction:%s','remove','../../rpc/chatQueueReport','../../rpc/faxQueueReport','../../rpc/whatsappQueueReport','../../rpc/chatInteraction','../../rpc/faxInteraction','../../rpc/mailInteraction','../../rpc/openchannelInteraction','../../rpc/smsInteraction','../../rpc/whatsappInteraction','string','name\x20is\x20a\x20string\x20and\x20it\x20is\x20required','number','timeout\x20is\x20a\x20number','body','from','YYYY-MM-DD\x20HH:mm:ss','contact','list','upperFirst','QueueId','channel','interaction','MessageId','message','AccountId','WebsiteId','info','[%s][START:QUEUE][NAME:%s]','name','QueueReport','create','error','create\x20queue\x20report','Interaction','update','catch','update\x20queue\x20report','waiting','timeout','toLowerCase','consequence','[%s][QUEUE]\x20%s','map','stop','find','Queues','createQueue','qtimeout','end','[%s][QUEUE]\x20ROUTING\x20STOPPED','rules','complete','[%s][QUEUE]\x20APPLICATION\x20END','close','next','strategy','rrmemory','[%s][QUEUE]\x20queue\x20not\x20found\x20%s','stack','validate','util','seq-queue','ioredis','../../../../config/environment','routing','./strategy','defaults','redis','localhost','socket.io-emitter','queue_id','account','queue','joinAt','clone','push','capitalize','InteractionId','%sQueuesWaitingInteractions','pick','format'];(function(_0x1c5205,_0x2d18c1){var _0x50d221=function(_0x23c4ed){while(--_0x23c4ed){_0x1c5205['push'](_0x1c5205['shift']());}};_0x50d221(++_0x2d18c1);}(_0xc4bc,0x1e2));var _0xcc4b=function(_0x226887,_0x2309ca){_0x226887=_0x226887-0x0;var _0x4c2a04=_0xc4bc[_0x226887];return _0x4c2a04;};'use strict';var schema=require(_0xcc4b('0x0'));var _=require('lodash');var util=require(_0xcc4b('0x1'));var seqqueue=require(_0xcc4b('0x2'));var moment=require('moment');var Redis=require(_0xcc4b('0x3'));var config=require(_0xcc4b('0x4'));var logger=require('../../../../config/logger')(_0xcc4b('0x5'));var strategy=require(_0xcc4b('0x6'));config['redis']=_[_0xcc4b('0x7')](config[_0xcc4b('0x8')],{'host':_0xcc4b('0x9'),'port':0x18eb});var io=require(_0xcc4b('0xa'))(new Redis(config['redis']));var attributes=['id',_0xcc4b('0xb'),_0xcc4b('0xc'),_0xcc4b('0xd'),'from',_0xcc4b('0xe')];function emit(_0x4be97b,_0x38229a,_0x4c843f){io['to'](_0x4be97b)['emit'](_0x38229a,_0x4c843f);}function emitChannelQueueInteraction(_0x3ee372,_0x2539d6,_0x6f6422,_0x1f7a7e,_0x230b92,_0x4b2c3b,_0x2784b2,_0x1a33c3){var _0x2b2098=_[_0xcc4b('0xf')](_0x6f6422);_0x2b2098[_0xcc4b('0xb')]=_0x1a33c3;_0x2b2098[_0xcc4b('0xd')]=_0x2539d6;_0x2b2098[_0xcc4b('0xc')]=_0x1f7a7e;_0x2b2098['id']=_0x230b92;if(_0x4b2c3b){attributes[_0xcc4b('0x10')](_[_0xcc4b('0x11')](_0x3ee372)+_0xcc4b('0x12'));_0x2784b2[util['format'](_0xcc4b('0x13'),_0x3ee372)][_0x230b92]=_[_0xcc4b('0x14')](_0x2b2098,attributes);}else{delete _0x2784b2[util[_0xcc4b('0x15')](_0xcc4b('0x13'),_0x3ee372)][_0x230b92];}emit(util[_0xcc4b('0x15')](_0xcc4b('0x16'),_0x3ee372,_0x2539d6),util[_0xcc4b('0x15')](_0xcc4b('0x17'),_0x3ee372,_0x4b2c3b?'save':_0xcc4b('0x18')),_[_0xcc4b('0x14')](_0x2b2098,attributes));}var rpc={'openchannelQueueReport':require('../../rpc/openchannelQueueReport'),'mailQueueReport':require('../../rpc/mailQueueReport'),'chatQueueReport':require(_0xcc4b('0x19')),'smsQueueReport':require('../../rpc/smsQueueReport'),'faxQueueReport':require(_0xcc4b('0x1a')),'whatsappQueueReport':require(_0xcc4b('0x1b')),'chatInteraction':require(_0xcc4b('0x1c')),'faxInteraction':require(_0xcc4b('0x1d')),'mailInteraction':require(_0xcc4b('0x1e')),'openchannelInteraction':require(_0xcc4b('0x1f')),'smsInteraction':require(_0xcc4b('0x20')),'whatsappInteraction':require(_0xcc4b('0x21'))};var queue=schema({'name':{'type':_0xcc4b('0x22'),'required':!![],'message':_0xcc4b('0x23')},'timeout':{'type':_0xcc4b('0x24'),'message':_0xcc4b('0x25')}});function startRouting(_0x420a13,_0x29a18c,_0x30d8a1,_0x14868a){if(_0x420a13&&_0x29a18c&&_0x30d8a1){_0x29a18c['waiting']+=0x1;var _0x2eecb2={'uniqueid':_0x420a13,'from':_0x30d8a1[_0xcc4b('0x26')]?_0x30d8a1['body'][_0xcc4b('0x27')]:'','joinAt':moment()['format'](_0xcc4b('0x28')),'ContactId':_0x30d8a1[_0xcc4b('0x29')]?_0x30d8a1['contact']['id']:null,'ListId':_0x30d8a1['list']?_0x30d8a1[_0xcc4b('0x2a')]['id']:null};_0x2eecb2[_[_0xcc4b('0x2b')](_0x30d8a1['channel'])+_0xcc4b('0x2c')]=_0x29a18c['id']||null;_0x2eecb2[_['upperFirst'](_0x30d8a1[_0xcc4b('0x2d')])+_0xcc4b('0x12')]=_0x30d8a1[_0xcc4b('0x2e')]?_0x30d8a1[_0xcc4b('0x2e')]['id']:null;_0x2eecb2[_['upperFirst'](_0x30d8a1[_0xcc4b('0x2d')])+_0xcc4b('0x2f')]=_0x30d8a1[_0xcc4b('0x30')]?_0x30d8a1[_0xcc4b('0x30')]['id']:null;_0x2eecb2[_[_0xcc4b('0x2b')](_0x30d8a1[_0xcc4b('0x2d')])+(_0x30d8a1[_0xcc4b('0x2d')]!=='chat'?_0xcc4b('0x31'):_0xcc4b('0x32'))]=_0x30d8a1['account']?_0x30d8a1[_0xcc4b('0xc')]['id']:null;logger[_0xcc4b('0x33')](util[_0xcc4b('0x15')](_0xcc4b('0x34'),_0x420a13,_0x29a18c['name']));emitChannelQueueInteraction(_0x30d8a1[_0xcc4b('0x2d')],_0x29a18c[_0xcc4b('0x35')],_0x2eecb2,_0x30d8a1['account'][_0xcc4b('0x35')],_0x30d8a1[_0xcc4b('0x30')]['id'],!![],_0x14868a,_0x29a18c['id']);if(rpc[_0x30d8a1[_0xcc4b('0x2d')]+_0xcc4b('0x36')]){return rpc[_0x30d8a1['channel']+_0xcc4b('0x36')][_0xcc4b('0x37')](_0x2eecb2)['catch'](function(_0x591a64){logger[_0xcc4b('0x38')](_0xcc4b('0x39'),_0x591a64);});}}}function stopRouting(_0x202a37,_0x5a00c5,_0x3dfdf0,_0x17217a){if(_0x202a37&&_0x5a00c5){_0x5a00c5['waiting']-=0x1;var _0x48f0ff={'leaveAt':moment()[_0xcc4b('0x15')](_0xcc4b('0x28')),'acceptAt':moment()[_0xcc4b('0x15')]('YYYY-MM-DD\x20HH:mm:ss'),'reason':'accepted'};logger[_0xcc4b('0x33')](util[_0xcc4b('0x15')]('[%s][STOP:QUEUE][NAME:%s]',_0x202a37,_0x5a00c5[_0xcc4b('0x35')]));emitChannelQueueInteraction(_0x3dfdf0[_0xcc4b('0x2d')],_0x5a00c5[_0xcc4b('0x35')],_0x3dfdf0[_0xcc4b('0x26')],_0x3dfdf0[_0xcc4b('0xc')][_0xcc4b('0x35')],_0x3dfdf0['message']['id'],![],_0x17217a,_0x5a00c5['id']);return rpc[_0x3dfdf0['channel']+_0xcc4b('0x3a')]['update'](_0x3dfdf0[_0xcc4b('0x2e')]['id'],{'queueId':_0x5a00c5['id']})['then'](function(){if(rpc[_0x3dfdf0[_0xcc4b('0x2d')]+_0xcc4b('0x36')]){return rpc[_0x3dfdf0[_0xcc4b('0x2d')]+'QueueReport'][_0xcc4b('0x3b')](_0x202a37,_0x48f0ff)[_0xcc4b('0x3c')](function(_0x56d57a){logger[_0xcc4b('0x38')](_0xcc4b('0x3d'),_0x56d57a);});}});}}function endRouting(_0x677932,_0x5872b1,_0x42312b,_0x544e69){if(_0x677932&&_0x5872b1){_0x5872b1[_0xcc4b('0x3e')]-=0x1;var _0x5090da={'leaveAt':moment()['format'](_0xcc4b('0x28')),'exitAt':moment()[_0xcc4b('0x15')](_0xcc4b('0x28')),'reason':_0xcc4b('0x3f')};logger[_0xcc4b('0x33')](util[_0xcc4b('0x15')]('[%s][END:QUEUE][NAME:%s]',_0x677932,_0x5872b1[_0xcc4b('0x35')]));emitChannelQueueInteraction(_0x42312b[_0xcc4b('0x2d')],_0x5872b1[_0xcc4b('0x35')],_0x42312b[_0xcc4b('0x26')],_0x42312b[_0xcc4b('0xc')][_0xcc4b('0x35')],_0x42312b['message']['id'],![],_0x544e69);if(rpc[_0x42312b[_0xcc4b('0x2d')]+'QueueReport']){return rpc[_0x42312b[_0xcc4b('0x2d')]+_0xcc4b('0x36')][_0xcc4b('0x3b')](_0x677932,_0x5090da)[_0xcc4b('0x3c')](function(_0x96c97f){logger[_0xcc4b('0x38')](_0xcc4b('0x3d'),_0x96c97f);});}}}function handleFindQueue(_0x4710f6){return function(_0x491e7f){return _0x491e7f[_0xcc4b('0x35')]['toLowerCase']()===_0x4710f6[_0xcc4b('0x40')]();};}exports[_0xcc4b('0x41')]=function(_0x3ad9a5,_0x353684,_0x470528,_0x84842c){return function(_0x3bd332){try{var _0x1661fb={'name':_0x353684[0x0],'timeout':_0x353684[0x1]};var _0x42be95=queue[_0xcc4b('0x0')](_0x1661fb,{'typecast':!![]});if(_0x42be95['length']){logger[_0xcc4b('0x38')](_0xcc4b('0x42'),_0x3ad9a5,_[_0xcc4b('0x43')](_0x42be95,_0xcc4b('0x30'))['join'](',\x20'));_0x3bd332[_0xcc4b('0x44')]();}else{var _0x4e82f1=_[_0xcc4b('0x45')](_0x470528[_0x84842c['channel']+_0xcc4b('0x46')],handleFindQueue(_0x1661fb[_0xcc4b('0x35')]));if(_0x4e82f1){startRouting(_0x3ad9a5,_0x4e82f1,_0x84842c,_0x470528);var _0x5b6cfa=(_0x4e82f1[_0xcc4b('0x3f')]||0xa)*0x3e8;var _0x36d6a3=(_0x1661fb[_0xcc4b('0x3f')]||0x14)*0x3e8;var _0x16bcdb;if(_0x5b6cfa>_0x36d6a3){_0x36d6a3=_0x5b6cfa;}var _0x580c3d=seqqueue[_0xcc4b('0x47')](_0x5b6cfa);_0x580c3d['id']=_0x3ad9a5;_0x580c3d['atimeout']=_0x5b6cfa;_0x580c3d[_0xcc4b('0x48')]=_0x36d6a3;_0x580c3d['channel']=_0x84842c['channel'];_0x470528['rules'][_0x3ad9a5]['on'](_0xcc4b('0x49'),function(){logger[_0xcc4b('0x33')](_0xcc4b('0x4a'),_0x3ad9a5);stopRouting(_0x3ad9a5,_0x4e82f1,_0x84842c,_0x470528);clearTimeout(_0x16bcdb);_0x16bcdb=undefined;_0x580c3d['close'](!![]);if(_0x470528['rules'][_0x3ad9a5]){delete _0x470528[_0xcc4b('0x4b')][_0x3ad9a5];}_0x3bd332[_0xcc4b('0x44')]();});_0x470528[_0xcc4b('0x4b')][_0x3ad9a5]['on'](_0xcc4b('0x4c'),function(){if(_0x470528[_0xcc4b('0x4b')][_0x3ad9a5]){delete _0x470528[_0xcc4b('0x4b')][_0x3ad9a5];}});_0x16bcdb=setTimeout(function(){logger[_0xcc4b('0x33')](_0xcc4b('0x4d'),_0x3ad9a5);endRouting(_0x3ad9a5,_0x4e82f1,_0x84842c,_0x470528);clearTimeout(_0x16bcdb);_0x580c3d[_0xcc4b('0x4e')](!![]);_0x3bd332[_0xcc4b('0x4f')]();},_0x36d6a3);switch(_0x4e82f1[_0xcc4b('0x50')]){case'rrmemory':strategy[_0xcc4b('0x51')](_0x580c3d,_0x4e82f1,_0x470528,_0x84842c);break;default:strategy['beepall'](_0x580c3d,_0x4e82f1,_0x470528,_0x84842c);}}else{logger[_0xcc4b('0x38')](_0xcc4b('0x52'),_0x3ad9a5,_0x1661fb[_0xcc4b('0x35')]);_0x3bd332['stop']();}}}catch(_0x510381){logger[_0xcc4b('0x38')]('[%s][QUEUE]\x20%s',_0x3ad9a5,_0x510381[_0xcc4b('0x53')]);_0x3bd332['stop']();}};}; \ No newline at end of file diff --git a/server/services/routing/server/applications/strategy/agent.js b/server/services/routing/server/applications/strategy/agent.js index caaed92..ca629e3 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 _0x7da7=['prototype','push','debug','[%s][AGENT]\x20try\x20with\x20%s','agents','routing','forcedOwnership','isAgentAvailable','busy','saveWaitingNotification','channel','showNotification','writeLog','RINGING','[%s][AGENT]\x20agent\x20%s\x20is\x20not\x20available','isNil','[%s][AGENT]\x20agent\x20skipped,\x20unknown\x20id\x20%s','[%s][AGENT]\x20timeout\x20with\x20%s','hideNotification','busyQueue','removeWaitingNotification','STOP','TIMEOUT','exports','lodash','uuid','./util','notificationId','agent','realtime','squeue','handleRun','bind','handleTimeout','handleDrained'];(function(_0x42e213,_0x16fb1a){var _0x347972=function(_0x4739d5){while(--_0x4739d5){_0x42e213['push'](_0x42e213['shift']());}};_0x347972(++_0x16fb1a);}(_0x7da7,0x10d));var _0x77da=function(_0x1e48d3,_0x5d8c43){_0x1e48d3=_0x1e48d3-0x0;var _0x2852b1=_0x7da7[_0x1e48d3];return _0x2852b1;};'use strict';var _=require(_0x77da('0x0'));var uuid=require(_0x77da('0x1'));var util=require(_0x77da('0x2'));var logger=require('../../../../../config/logger')('routing');var Agent=function(_0x37667b,_0xaaefb1,_0x4f60c3,_0x3a9fa6){this[_0x77da('0x3')]=uuid['v4']();this['squeue']=_0x37667b;this[_0x77da('0x4')]=_0xaaefb1;this[_0x77da('0x5')]=_0x4f60c3;this['routing']=_0x3a9fa6;this[_0x77da('0x6')]['push'](this[_0x77da('0x7')][_0x77da('0x8')](this),this[_0x77da('0x9')][_0x77da('0x8')](this));this[_0x77da('0x6')]['on']('timeout',this[_0x77da('0x9')][_0x77da('0x8')](this));this[_0x77da('0x6')]['on']('drained',this[_0x77da('0xa')][_0x77da('0x8')](this));};Agent[_0x77da('0xb')][_0x77da('0xc')]=function(){this['squeue'][_0x77da('0xc')](this[_0x77da('0x7')][_0x77da('0x8')](this),this['handleTimeout']['bind'](this));};Agent[_0x77da('0xb')][_0x77da('0xa')]=function(){this['handleTimeout'](!![]);};Agent[_0x77da('0xb')][_0x77da('0x7')]=function(){logger[_0x77da('0xd')](_0x77da('0xe'),this['squeue']['id'],this[_0x77da('0x4')]['id']);if(_['isNil'](this[_0x77da('0x5')][_0x77da('0xf')][this[_0x77da('0x4')]['id']])){logger[_0x77da('0xd')]('[%s][AGENT]\x20agent\x20skipped,\x20unknown\x20id\x20%s',this['squeue']['id'],this['agent']['id']);setTimeout(this['push'][_0x77da('0x8')](this),0x3e8);}else{if(this[_0x77da('0x10')][_0x77da('0x11')]||util[_0x77da('0x12')](this[_0x77da('0x6')]['id'],this[_0x77da('0x5')][_0x77da('0xf')][this[_0x77da('0x4')]['id']],this['squeue']['channel'],![])){this[_0x77da('0x5')][_0x77da('0xf')][this['agent']['id']][_0x77da('0x13')]=!![];this[_0x77da('0x5')][_0x77da('0xf')][this['agent']['id']]['busyQueue']=undefined;util[_0x77da('0x14')](this['realtime'],this[_0x77da('0x10')],this[_0x77da('0x4')],this[_0x77da('0x6')][_0x77da('0x15')]);util[_0x77da('0x16')](this[_0x77da('0x3')],this[_0x77da('0x6')]['id'],this['realtime']['agents'][this[_0x77da('0x4')]['id']],null,this[_0x77da('0x10')]);util[_0x77da('0x17')](this[_0x77da('0x6')]['id'],this['realtime'][_0x77da('0xf')][this[_0x77da('0x4')]['id']],_0x77da('0x18')+(this[_0x77da('0x10')][_0x77da('0x11')]?':FORCED':''));}else{logger[_0x77da('0xd')](_0x77da('0x19'),this[_0x77da('0x6')]['id'],this[_0x77da('0x4')]['id']);setTimeout(this['push']['bind'](this),0x3e8);}}};Agent['prototype'][_0x77da('0x9')]=function(_0x30456a){if(_[_0x77da('0x1a')](this[_0x77da('0x5')][_0x77da('0xf')][this['agent']['id']])){return logger[_0x77da('0xd')](_0x77da('0x1b'),this[_0x77da('0x6')]['id'],this[_0x77da('0x4')]['id']);}else{logger[_0x77da('0xd')](_0x77da('0x1c'),this['squeue']['id'],this[_0x77da('0x4')]['id']);util[_0x77da('0x1d')](this[_0x77da('0x3')],this[_0x77da('0x6')]['id'],this[_0x77da('0x5')][_0x77da('0xf')][this[_0x77da('0x4')]['id']],null,this[_0x77da('0x10')]);this['realtime']['agents'][this[_0x77da('0x4')]['id']][_0x77da('0x13')]=![];this['realtime'][_0x77da('0xf')][this[_0x77da('0x4')]['id']][_0x77da('0x1e')]=undefined;util[_0x77da('0x1f')](this[_0x77da('0x5')],this[_0x77da('0x10')],this[_0x77da('0x4')],this['squeue'][_0x77da('0x15')]);util['writeLog'](this['squeue']['id'],this['realtime'][_0x77da('0xf')][this['agent']['id']],_0x30456a?_0x77da('0x20'):_0x77da('0x21'));}if(!_0x30456a){setTimeout(this[_0x77da('0xc')][_0x77da('0x8')](this),0x3e8);}};function agent(_0x3c46d2,_0x3f0593,_0x43c20a,_0x501306){return new Agent(_0x3c46d2,_0x3f0593,_0x43c20a,_0x501306);}module[_0x77da('0x22')]=agent; \ No newline at end of file +var _0x0ba7=['handleRun','bind','handleTimeout','timeout','drained','handleDrained','prototype','debug','[%s][AGENT]\x20try\x20with\x20%s','isNil','agents','[%s][AGENT]\x20agent\x20skipped,\x20unknown\x20id\x20%s','isAgentAvailable','channel','busy','busyQueue','RINGING','forcedOwnership',':FORCED','[%s][AGENT]\x20timeout\x20with\x20%s','hideNotification','removeWaitingNotification','writeLog','STOP','TIMEOUT','lodash','./util','../../../../../config/logger','routing','notificationId','squeue','agent','realtime','push'];(function(_0x4d2cd6,_0x3dca37){var _0x23acb6=function(_0x4837d5){while(--_0x4837d5){_0x4d2cd6['push'](_0x4d2cd6['shift']());}};_0x23acb6(++_0x3dca37);}(_0x0ba7,0x16d));var _0x70ba=function(_0x11dfac,_0x130a5c){_0x11dfac=_0x11dfac-0x0;var _0x4bb484=_0x0ba7[_0x11dfac];return _0x4bb484;};'use strict';var _=require(_0x70ba('0x0'));var uuid=require('uuid');var util=require(_0x70ba('0x1'));var logger=require(_0x70ba('0x2'))(_0x70ba('0x3'));var Agent=function(_0x42d93c,_0x5e5368,_0x319ca9,_0x3e20ab){this[_0x70ba('0x4')]=uuid['v4']();this[_0x70ba('0x5')]=_0x42d93c;this[_0x70ba('0x6')]=_0x5e5368;this[_0x70ba('0x7')]=_0x319ca9;this[_0x70ba('0x3')]=_0x3e20ab;this[_0x70ba('0x5')][_0x70ba('0x8')](this[_0x70ba('0x9')][_0x70ba('0xa')](this),this[_0x70ba('0xb')][_0x70ba('0xa')](this));this[_0x70ba('0x5')]['on'](_0x70ba('0xc'),this['handleTimeout'][_0x70ba('0xa')](this));this['squeue']['on'](_0x70ba('0xd'),this[_0x70ba('0xe')][_0x70ba('0xa')](this));};Agent[_0x70ba('0xf')]['push']=function(){this['squeue'][_0x70ba('0x8')](this['handleRun'][_0x70ba('0xa')](this),this['handleTimeout'][_0x70ba('0xa')](this));};Agent[_0x70ba('0xf')]['handleDrained']=function(){this[_0x70ba('0xb')](!![]);};Agent['prototype'][_0x70ba('0x9')]=function(){logger[_0x70ba('0x10')](_0x70ba('0x11'),this[_0x70ba('0x5')]['id'],this[_0x70ba('0x6')]['id']);if(_[_0x70ba('0x12')](this[_0x70ba('0x7')][_0x70ba('0x13')][this[_0x70ba('0x6')]['id']])){logger[_0x70ba('0x10')](_0x70ba('0x14'),this[_0x70ba('0x5')]['id'],this[_0x70ba('0x6')]['id']);setTimeout(this[_0x70ba('0x8')]['bind'](this),0x3e8);}else{if(this['routing']['forcedOwnership']||util[_0x70ba('0x15')](this[_0x70ba('0x5')]['id'],this[_0x70ba('0x7')][_0x70ba('0x13')][this[_0x70ba('0x6')]['id']],this[_0x70ba('0x5')][_0x70ba('0x16')],![])){this[_0x70ba('0x7')][_0x70ba('0x13')][this[_0x70ba('0x6')]['id']][_0x70ba('0x17')]=!![];this[_0x70ba('0x7')][_0x70ba('0x13')][this[_0x70ba('0x6')]['id']][_0x70ba('0x18')]=undefined;util['saveWaitingNotification'](this[_0x70ba('0x7')],this[_0x70ba('0x3')],this['agent'],this[_0x70ba('0x5')]['channel']);util['showNotification'](this[_0x70ba('0x4')],this['squeue']['id'],this[_0x70ba('0x7')][_0x70ba('0x13')][this['agent']['id']],null,this[_0x70ba('0x3')]);util['writeLog'](this['squeue']['id'],this[_0x70ba('0x7')]['agents'][this[_0x70ba('0x6')]['id']],_0x70ba('0x19')+(this[_0x70ba('0x3')][_0x70ba('0x1a')]?_0x70ba('0x1b'):''));}else{logger[_0x70ba('0x10')]('[%s][AGENT]\x20agent\x20%s\x20is\x20not\x20available',this[_0x70ba('0x5')]['id'],this[_0x70ba('0x6')]['id']);setTimeout(this[_0x70ba('0x8')]['bind'](this),0x3e8);}}};Agent[_0x70ba('0xf')]['handleTimeout']=function(_0x5955dc){if(_['isNil'](this[_0x70ba('0x7')][_0x70ba('0x13')][this['agent']['id']])){return logger['debug'](_0x70ba('0x14'),this['squeue']['id'],this[_0x70ba('0x6')]['id']);}else{logger[_0x70ba('0x10')](_0x70ba('0x1c'),this[_0x70ba('0x5')]['id'],this[_0x70ba('0x6')]['id']);util[_0x70ba('0x1d')](this[_0x70ba('0x4')],this[_0x70ba('0x5')]['id'],this[_0x70ba('0x7')][_0x70ba('0x13')][this[_0x70ba('0x6')]['id']],null,this['routing']);this['realtime'][_0x70ba('0x13')][this[_0x70ba('0x6')]['id']][_0x70ba('0x17')]=![];this['realtime']['agents'][this['agent']['id']][_0x70ba('0x18')]=undefined;util[_0x70ba('0x1e')](this[_0x70ba('0x7')],this['routing'],this[_0x70ba('0x6')],this['squeue']['channel']);util[_0x70ba('0x1f')](this['squeue']['id'],this[_0x70ba('0x7')][_0x70ba('0x13')][this['agent']['id']],_0x5955dc?_0x70ba('0x20'):_0x70ba('0x21'));}if(!_0x5955dc){setTimeout(this[_0x70ba('0x8')]['bind'](this),0x3e8);}};function agent(_0x1402b2,_0x20c3fd,_0xbb0c72,_0x75fbbe){return new Agent(_0x1402b2,_0x20c3fd,_0xbb0c72,_0x75fbbe);}module['exports']=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 4fe4d6f..3786591 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 _0x70f0=['writeLog','RINGING','busy','busyQueue','saveWaitingNotification','[%s][QUEUE]\x20ALL\x20AGENTS\x20ARE\x20BUSY','push','[%s][QUEUE]\x20EMPTY','length','hideNotification','STOP','TIMEOUT','removeWaitingNotification','exports','lodash','uuid','./util','../../../../../config/logger','routing','notificationId','squeue','queue','realtime','bind','handleTimeout','handleDrained','prototype','handleRun','isNil','Agents','agents','debug','[%s][QUEUE]\x20agent\x20skipped,\x20unknown\x20id\x20%s','isAgentAvailable','channel'];(function(_0x3312a5,_0x528245){var _0x27f835=function(_0x5bac17){while(--_0x5bac17){_0x3312a5['push'](_0x3312a5['shift']());}};_0x27f835(++_0x528245);}(_0x70f0,0x103));var _0x070f=function(_0x5d4607,_0x6b5e7b){_0x5d4607=_0x5d4607-0x0;var _0x5e4a86=_0x70f0[_0x5d4607];return _0x5e4a86;};'use strict';var _=require(_0x070f('0x0'));var uuid=require(_0x070f('0x1'));var util=require(_0x070f('0x2'));var logger=require(_0x070f('0x3'))(_0x070f('0x4'));var Beepall=function(_0x1842ff,_0x1ecc40,_0xb8c8dd,_0x1cdf8c){this[_0x070f('0x5')]=uuid['v4']();this[_0x070f('0x6')]=_0x1842ff;this[_0x070f('0x7')]=_0x1ecc40;this[_0x070f('0x8')]=_0xb8c8dd;this[_0x070f('0x4')]=_0x1cdf8c;this['squeue']['push'](this['handleRun'][_0x070f('0x9')](this),this[_0x070f('0xa')][_0x070f('0x9')](this));this[_0x070f('0x6')]['on']('timeout',this[_0x070f('0xa')]['bind'](this));this[_0x070f('0x6')]['on']('drained',this[_0x070f('0xb')][_0x070f('0x9')](this));};Beepall[_0x070f('0xc')]['push']=function(){this[_0x070f('0x6')]['push'](this[_0x070f('0xd')][_0x070f('0x9')](this),this['handleTimeout']['bind'](this));};Beepall['prototype'][_0x070f('0xb')]=function(){this['handleTimeout'](!![]);};Beepall[_0x070f('0xc')][_0x070f('0xd')]=function(){var _0x1cb91a=!![];if(!_['isNil'](this[_0x070f('0x7')])&&!_[_0x070f('0xe')](this[_0x070f('0x7')][_0x070f('0xf')])&&this[_0x070f('0x7')]['Agents']['length']>0x0){for(var _0xec8846=0x0,_0x444272;_0xec88460x0){for(var _0x24d408=0x0,_0x26b55c;_0x24d4080x0&&_0x536d40[_0x373117+_0x8eca('0x21')]>=_0x536d40[_0x373117+_0x8eca('0x22')]){writeLog(_0x449434,_0x536d40,_0x373117['toUpperCase']()+_0x8eca('0x23'));return![];}}return!![];};exports['showNotification']=function(_0x45b28e,_0x15823b,_0x18ae97,_0x3e1f66,_0x35a2de){return sendNotification(!![],_0x45b28e,_0x15823b,_0x18ae97,_0x3e1f66,_0x35a2de);};exports[_0x8eca('0x24')]=function(_0x33e4db,_0x448def,_0x4e524f,_0x2d76d4,_0x752faf){return sendNotification(![],_0x33e4db,_0x448def,_0x4e524f,_0x2d76d4,_0x752faf);};exports[_0x8eca('0x25')]=function(_0x205b0d,_0x1b3e41,_0x8b406b){var _0x39e04f=_0x1b3e41[_0x8eca('0x26')][_0x8eca('0x27')];if(!_0x39e04f&&_0x8b406b){_0x39e04f=_0x8b406b['id'];}var _0x497122=_[_0x8eca('0x28')](_0x205b0d[_0x1b3e41[_0x8eca('0x29')]+_0x8eca('0x2a')],function(_0x1f6ed5){var _0x5eface=_[_0x8eca('0x2b')](_0x1b3e41[_0x8eca('0x29')])+_0x8eca('0x2c');return _0x1f6ed5[_0x5eface]===_0x1b3e41[_0x8eca('0x26')]['id'];});if(!_0x497122&&_0x39e04f&&_0x205b0d[_0x8eca('0x2d')][_0x39e04f]){_0x497122=_[_0x8eca('0x28')](_0x205b0d[_0x8eca('0x2d')][_0x39e04f][_0x1b3e41[_0x8eca('0x29')]+_0x8eca('0x2e')],function(_0x573d53){return _0x573d53['id']===_0x1b3e41['interaction']['id'];});}return _0x497122;};exports[_0x8eca('0x2f')]=function(_0x8abf4d,_0x278e2f,_0xe283b1,_0x3a1175){if(_0xe283b1&&_0xe283b1['id']&&_0x8abf4d[_0x8eca('0x2d')]&&_0x8abf4d[_0x8eca('0x2d')][_0xe283b1['id']]){_0x8abf4d[_0x8eca('0x2d')][_0xe283b1['id']][_0x3a1175+_0x8eca('0x2e')][_0x278e2f[_0x8eca('0x30')]['id']]={'id':_0x278e2f['interaction']['id']};}};exports['removeWaitingNotification']=function(_0x5b0a36,_0x926c70,_0x3e7de4,_0xfaaf1f){if(_0x3e7de4&&_0x3e7de4['id']&&_0x5b0a36[_0x8eca('0x2d')]&&_0x5b0a36[_0x8eca('0x2d')][_0x3e7de4['id']]){delete _0x5b0a36[_0x8eca('0x2d')][_0x3e7de4['id']][_0xfaaf1f+_0x8eca('0x2e')][_0x926c70[_0x8eca('0x30')]['id']];}};exports[_0x8eca('0x31')]=writeLog; \ No newline at end of file +var _0x5607=['UserId','channel','agents','WaitingInteractions','saveWaitingNotification','removeWaitingNotification','writeLog','lodash','util','../utils','../../../../../config/environment','routing','redis','defaults','localhost','split','\x20interaction','name','account','notificationShake','body','queue','msg','notificationTemplate','I\x20can\x27t\x20render\x20your\x20template','format','[%s][QUEUE]\x20%s','message','user:%s','emit','save','remove','debug','[%s][QUEUE][AGENT:%s][STATUS:%s]','isAgentAvailable','busy','online','Pause','PAUSE','hasOwnProperty','Capacity','CurrentCapacity','toUpperCase','\x20MAXCAPACITY','showNotification','checkWaitingNotifications','interaction'];(function(_0x386b03,_0x5d0000){var _0xd3d524=function(_0x474754){while(--_0x474754){_0x386b03['push'](_0x386b03['shift']());}};_0xd3d524(++_0x5d0000);}(_0x5607,0xc3));var _0x7560=function(_0x4ab846,_0x1079ba){_0x4ab846=_0x4ab846-0x0;var _0x2f5a1f=_0x5607[_0x4ab846];return _0x2f5a1f;};'use strict';var _=require(_0x7560('0x0'));var util=require(_0x7560('0x1'));var utils=require(_0x7560('0x2'));var Redis=require('ioredis');var config=require(_0x7560('0x3'));var logger=require('../../../../../config/logger')(_0x7560('0x4'));config[_0x7560('0x5')]=_[_0x7560('0x6')](config['redis'],{'host':_0x7560('0x7'),'port':0x18eb});var io=require('socket.io-emitter')(new Redis(config[_0x7560('0x5')]));function sendNotification(_0x119848,_0x374d8d,_0xf289e9,_0x4f2b0d,_0x1551e9,_0x2fa1a8){var _0x2fc164=_0x2fa1a8||{};var _0x56b52f=_0xf289e9[_0x7560('0x8')]('.');var _0x195e44={'uniqueid':_0x374d8d,'channel':_0x56b52f[0x0],'id':_0x56b52f[0x1],'title':_0x56b52f[0x0]+_0x7560('0x9'),'interactionId':_0x56b52f[0x2],'queue':_0x1551e9?_0x1551e9[_0x7560('0xa')]:null,'sound':_0x2fc164[_0x7560('0xb')]['notificationSound'],'shake':_0x2fc164[_0x7560('0xb')][_0x7560('0xc')]};try{if(!_0x2fc164[_0x7560('0xd')]){_0x2fc164[_0x7560('0xd')]={};}if(_0x1551e9){_0x2fc164['body'][_0x7560('0xe')]=_0x1551e9;}else if(_0x2fc164[_0x7560('0xd')][_0x7560('0xe')]){delete _0x2fc164['body'][_0x7560('0xe')];}_0x195e44[_0x7560('0xf')]=utils['getMustacheRender'](_0x2fc164[_0x7560('0xb')][_0x7560('0x10')],_0x2fc164);}catch(_0x19707c){_0x195e44[_0x7560('0xf')]=_0x7560('0x11');logger['error'](util[_0x7560('0x12')](_0x7560('0x13'),_0x374d8d,_0x19707c[_0x7560('0x14')]));}io['to'](util[_0x7560('0x12')](_0x7560('0x15'),_0x4f2b0d['name']))[_0x7560('0x16')](util['format']('notification:%s',_0x119848?_0x7560('0x17'):_0x7560('0x18')),_0x195e44);}function writeLog(_0x38dc09,_0x3c1bab,_0x3a544b){return logger[_0x7560('0x19')](util[_0x7560('0x12')](_0x7560('0x1a'),_0x38dc09,_0x3c1bab[_0x7560('0xa')],_0x3a544b));}exports[_0x7560('0x1b')]=function(_0x527c77,_0x401cfc,_0x5bb5c6,_0x5d94c6){if(_0x401cfc[_0x7560('0x1c')]){writeLog(_0x527c77,_0x401cfc,'BUSY');return![];}if(!_0x401cfc[_0x7560('0x1d')]){writeLog(_0x527c77,_0x401cfc,'OFFLINE');return![];}if(_0x401cfc[_0x5bb5c6+_0x7560('0x1e')]){writeLog(_0x527c77,_0x401cfc,_0x7560('0x1f'));return![];}if(_0x5d94c6&&_0x401cfc[_0x7560('0x20')](_0x5bb5c6+_0x7560('0x21'))&&_0x401cfc[_0x7560('0x20')](_0x5bb5c6+_0x7560('0x22'))){if(_0x401cfc[_0x5bb5c6+_0x7560('0x21')]>0x0&&_0x401cfc[_0x5bb5c6+_0x7560('0x22')]>=_0x401cfc[_0x5bb5c6+_0x7560('0x21')]){writeLog(_0x527c77,_0x401cfc,_0x5bb5c6[_0x7560('0x23')]()+_0x7560('0x24'));return![];}}return!![];};exports[_0x7560('0x25')]=function(_0x47244e,_0x2ace04,_0x24676a,_0x167530,_0x2b392e){return sendNotification(!![],_0x47244e,_0x2ace04,_0x24676a,_0x167530,_0x2b392e);};exports['hideNotification']=function(_0x19a4c9,_0xed9c26,_0x34fa3b,_0x1c3ec9,_0x3675b2){return sendNotification(![],_0x19a4c9,_0xed9c26,_0x34fa3b,_0x1c3ec9,_0x3675b2);};exports[_0x7560('0x26')]=function(_0x290aaf,_0xe6bb0,_0x5267fd){var _0x1235cd=_0xe6bb0[_0x7560('0x27')][_0x7560('0x28')];if(!_0x1235cd&&_0x5267fd){_0x1235cd=_0x5267fd['id'];}var _0x412dd9=_['some'](_0x290aaf[_0xe6bb0[_0x7560('0x29')]+'QueuesWaitingInteractions'],function(_0x262670){var _0x20f777=_['capitalize'](_0xe6bb0['channel'])+'InteractionId';return _0x262670[_0x20f777]===_0xe6bb0[_0x7560('0x27')]['id'];});if(!_0x412dd9&&_0x1235cd&&_0x290aaf[_0x7560('0x2a')][_0x1235cd]){_0x412dd9=_['some'](_0x290aaf[_0x7560('0x2a')][_0x1235cd][_0xe6bb0['channel']+_0x7560('0x2b')],function(_0x146514){return _0x146514['id']===_0xe6bb0[_0x7560('0x27')]['id'];});}return _0x412dd9;};exports[_0x7560('0x2c')]=function(_0x3e4854,_0x141259,_0x187ada,_0x31c966){if(_0x187ada&&_0x187ada['id']&&_0x3e4854[_0x7560('0x2a')]&&_0x3e4854[_0x7560('0x2a')][_0x187ada['id']]){_0x3e4854[_0x7560('0x2a')][_0x187ada['id']][_0x31c966+_0x7560('0x2b')][_0x141259['message']['id']]={'id':_0x141259[_0x7560('0x27')]['id']};}};exports[_0x7560('0x2d')]=function(_0x42f835,_0xfb0d2b,_0x31e1ad,_0x45a1e9){if(_0x31e1ad&&_0x31e1ad['id']&&_0x42f835[_0x7560('0x2a')]&&_0x42f835[_0x7560('0x2a')][_0x31e1ad['id']]){delete _0x42f835['agents'][_0x31e1ad['id']][_0x45a1e9+_0x7560('0x2b')][_0xfb0d2b[_0x7560('0x14')]['id']];}};exports[_0x7560('0x2e')]=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 48f0fd6..99ef8b4 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 _0x29a5=['getMustacheRender','info','[%s][SYSTEM]\x20commnad:\x20%s','exec','trim','[%s][SYSTEM]\x20result\x20code:\x20%s','replace','isNil','isEmpty','[%s][SYSTEM]\x20no\x20variable','[%s][SYSTEM]\x20set\x20variable\x20%s:\x20%s','body','[%s][SYSTEM]\x20%s','isObject','stringify','next','validate','shelljs','lodash','../../../../config/logger','routing','command\x20is\x20a\x20string\x20and\x20it\x20is\x20required','consequence','length','error','map','message','join','[%s][SYSTEM]\x20no\x20command\x20executed,\x20force\x20next'];(function(_0x4cfb85,_0x280710){var _0x3c01ce=function(_0x3084b0){while(--_0x3084b0){_0x4cfb85['push'](_0x4cfb85['shift']());}};_0x3c01ce(++_0x280710);}(_0x29a5,0x1e0));var _0x529a=function(_0x4a7631,_0x2c85b9){_0x4a7631=_0x4a7631-0x0;var _0x1a5a6f=_0x29a5[_0x4a7631];return _0x1a5a6f;};'use strict';var schema=require(_0x529a('0x0'));var sh=require(_0x529a('0x1'));var _=require(_0x529a('0x2'));var utils=require('./utils');var logger=require(_0x529a('0x3'))(_0x529a('0x4'));var system=schema({'command':{'type':'string','required':!![],'message':_0x529a('0x5')}});exports[_0x529a('0x6')]=function(_0x5d0666,_0x2638cf){return function(_0x45a924){try{var _0x177641={'command':_0x2638cf[0x0]};var _0x12717d=system[_0x529a('0x0')](_0x177641,{'typecast':!![]});if(_0x12717d[_0x529a('0x7')]){logger[_0x529a('0x8')]('[%s][SYSTEM]\x20%s',_0x5d0666,_[_0x529a('0x9')](_0x12717d,_0x529a('0xa'))[_0x529a('0xb')](',\x20'));logger['info'](_0x529a('0xc'),_0x5d0666);_0x45a924['next']();}else{var _0x5af338=this;var _0x6b25a1=utils[_0x529a('0xd')](_0x2638cf[0x0],this);logger[_0x529a('0xe')](_0x529a('0xf'),_0x5d0666,_0x6b25a1);sh[_0x529a('0x10')](_[_0x529a('0x11')](_0x6b25a1),function(_0xa0caf3,_0xb09f8e){logger[_0x529a('0xe')](_0x529a('0x12'),_0x5d0666,_0xa0caf3);if(_0xa0caf3==0x0){var _0x7e6328=_0xb09f8e[_0x529a('0x13')](/(\r\n|\n|\r)/gm,'');if(_[_0x529a('0x14')](_0x2638cf[0x1])||_[_0x529a('0x15')](_0x2638cf[0x1])){logger[_0x529a('0xe')](_0x529a('0x16'),_0x5d0666);_0x5af338['body'][_0x2638cf[0x1]]=_0x7e6328;}else{logger[_0x529a('0xe')](_0x529a('0x17'),_0x5d0666,_0x2638cf[0x1],_0x7e6328);_0x5af338[_0x529a('0x18')][_0x2638cf[0x1]]=_0x7e6328;}}_0x45a924['next']();});}}catch(_0x2f18ce){logger[_0x529a('0x8')](_0x529a('0x19'),_0x5d0666,_[_0x529a('0x1a')](_0x2f18ce)?JSON[_0x529a('0x1b')](_0x2f18ce):_0x2f18ce);logger[_0x529a('0xe')]('[%s][SYSTEM]\x20no\x20command\x20executed,\x20force\x20next',_0x5d0666);_0x45a924[_0x529a('0x1c')]();}};}; \ No newline at end of file +var _0xb150=['[%s][SYSTEM]\x20commnad:\x20%s','trim','[%s][SYSTEM]\x20result\x20code:\x20%s','replace','isNil','isEmpty','[%s][SYSTEM]\x20no\x20variable','isObject','validate','shelljs','lodash','./utils','../../../../config/logger','routing','string','command\x20is\x20a\x20string\x20and\x20it\x20is\x20required','consequence','length','error','[%s][SYSTEM]\x20%s','map','join','info','[%s][SYSTEM]\x20no\x20command\x20executed,\x20force\x20next','next','getMustacheRender'];(function(_0x3121e0,_0x2616c4){var _0x5155c4=function(_0x390dba){while(--_0x390dba){_0x3121e0['push'](_0x3121e0['shift']());}};_0x5155c4(++_0x2616c4);}(_0xb150,0x18e));var _0x0b15=function(_0x258586,_0x3b8d98){_0x258586=_0x258586-0x0;var _0x3e64ff=_0xb150[_0x258586];return _0x3e64ff;};'use strict';var schema=require(_0x0b15('0x0'));var sh=require(_0x0b15('0x1'));var _=require(_0x0b15('0x2'));var utils=require(_0x0b15('0x3'));var logger=require(_0x0b15('0x4'))(_0x0b15('0x5'));var system=schema({'command':{'type':_0x0b15('0x6'),'required':!![],'message':_0x0b15('0x7')}});exports[_0x0b15('0x8')]=function(_0x530fa7,_0xb43704){return function(_0x1c0e62){try{var _0x1d9d4c={'command':_0xb43704[0x0]};var _0x1dd580=system[_0x0b15('0x0')](_0x1d9d4c,{'typecast':!![]});if(_0x1dd580[_0x0b15('0x9')]){logger[_0x0b15('0xa')](_0x0b15('0xb'),_0x530fa7,_[_0x0b15('0xc')](_0x1dd580,'message')[_0x0b15('0xd')](',\x20'));logger[_0x0b15('0xe')](_0x0b15('0xf'),_0x530fa7);_0x1c0e62[_0x0b15('0x10')]();}else{var _0x44854d=this;var _0x434c03=utils[_0x0b15('0x11')](_0xb43704[0x0],this);logger[_0x0b15('0xe')](_0x0b15('0x12'),_0x530fa7,_0x434c03);sh['exec'](_[_0x0b15('0x13')](_0x434c03),function(_0x116bdf,_0x943d4f){logger[_0x0b15('0xe')](_0x0b15('0x14'),_0x530fa7,_0x116bdf);if(_0x116bdf==0x0){var _0xd73f5c=_0x943d4f[_0x0b15('0x15')](/(\r\n|\n|\r)/gm,'');if(_[_0x0b15('0x16')](_0xb43704[0x1])||_[_0x0b15('0x17')](_0xb43704[0x1])){logger[_0x0b15('0xe')](_0x0b15('0x18'),_0x530fa7);_0x44854d['body'][_0xb43704[0x1]]=_0xd73f5c;}else{logger['info']('[%s][SYSTEM]\x20set\x20variable\x20%s:\x20%s',_0x530fa7,_0xb43704[0x1],_0xd73f5c);_0x44854d['body'][_0xb43704[0x1]]=_0xd73f5c;}}_0x1c0e62[_0x0b15('0x10')]();});}}catch(_0x5ab130){logger['error']('[%s][SYSTEM]\x20%s',_0x530fa7,_[_0x0b15('0x19')](_0x5ab130)?JSON['stringify'](_0x5ab130):_0x5ab130);logger[_0x0b15('0xe')](_0x0b15('0xf'),_0x530fa7);_0x1c0e62[_0x0b15('0x10')]();}};}; \ 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 4b209e7..dfb1205 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 _0x126e=['interaction','then','info','catch','stringify','finally','isObject','../../rpc/chatInteraction','../../rpc/openchannelInteraction','../../rpc/smsInteraction','../../rpc/mailInteraction','../../rpc/faxInteraction','../../rpc/whatsappInteraction','routing','number','TagId\x20is\x20a\x20string\x20and\x20it\x20is\x20required','validate','length','error','[%s][TAG]\x20%s','map','join','[%s][TAG]\x20no\x20tags\x20saved,\x20force\x20next','next','channel','Interaction','addTags'];(function(_0x2ede8b,_0x3204ed){var _0x4819d0=function(_0x552b28){while(--_0x552b28){_0x2ede8b['push'](_0x2ede8b['shift']());}};_0x4819d0(++_0x3204ed);}(_0x126e,0x1b7));var _0xe126=function(_0x13e741,_0x5d3c24){_0x13e741=_0x13e741-0x0;var _0x3f8bb3=_0x126e[_0x13e741];return _0x3f8bb3;};'use strict';var schema=require('validate');var _=require('lodash');var rpc={'chatInteraction':require(_0xe126('0x0')),'openchannelInteraction':require(_0xe126('0x1')),'smsInteraction':require(_0xe126('0x2')),'mailInteraction':require(_0xe126('0x3')),'faxInteraction':require(_0xe126('0x4')),'whatsappInteraction':require(_0xe126('0x5'))};var logger=require('../../../../config/logger')(_0xe126('0x6'));var tag=schema({'tag':{'type':_0xe126('0x7'),'required':!![],'message':_0xe126('0x8')}});exports['consequence']=function(_0x566660,_0x4780c0,_0x130815,_0x56c861){return function(_0x5c92c1){try{var _0x467337={'tag':_0x4780c0[0x0]};var _0x309e1c=tag[_0xe126('0x9')](_0x467337,{'typecast':!![]});if(_0x309e1c[_0xe126('0xa')]){logger[_0xe126('0xb')](_0xe126('0xc'),_0x566660,_[_0xe126('0xd')](_0x309e1c,'message')[_0xe126('0xe')](',\x20'));logger['info'](_0xe126('0xf'),_0x566660);_0x5c92c1[_0xe126('0x10')]();}else{var _0x2c096a={'ids':[_0x4780c0[0x0]]};if(rpc[_0x56c861[_0xe126('0x11')]+_0xe126('0x12')]){rpc[_0x56c861['channel']+_0xe126('0x12')][_0xe126('0x13')](_0x56c861[_0xe126('0x14')]['id'],_0x2c096a)[_0xe126('0x15')](function(_0x2cd70c){logger[_0xe126('0x16')]('[%s][TAG]\x20tag\x20\x22%s\x22\x20added\x20to\x20%s\x20interaction\x20%s',_0x566660,_0x4780c0[0x1],_0x56c861[_0xe126('0x11')],_0x56c861['interaction']['id']);})[_0xe126('0x17')](function(_0x392b1a){logger[_0xe126('0xb')](_0xe126('0xc'),_0x566660,JSON[_0xe126('0x18')](_0x392b1a));logger[_0xe126('0x16')](_0xe126('0xf'),_0x566660);})[_0xe126('0x19')](function(){_0x5c92c1['next']();});}}}catch(_0x4ef256){logger[_0xe126('0xb')](_0xe126('0xc'),_0x566660,_[_0xe126('0x1a')](_0x4ef256)?JSON[_0xe126('0x18')](_0x4ef256):_0x4ef256);logger[_0xe126('0x16')](_0xe126('0xf'),_0x566660);_0x5c92c1['next']();}};}; \ No newline at end of file +var _0x4bcf=['../../rpc/chatInteraction','../../rpc/openchannelInteraction','../../rpc/mailInteraction','../../rpc/whatsappInteraction','../../../../config/logger','routing','number','TagId\x20is\x20a\x20string\x20and\x20it\x20is\x20required','length','[%s][TAG]\x20%s','map','message','join','info','[%s][TAG]\x20no\x20tags\x20saved,\x20force\x20next','channel','Interaction','addTags','interaction','[%s][TAG]\x20tag\x20\x22%s\x22\x20added\x20to\x20%s\x20interaction\x20%s','catch','error','stringify','next','validate','lodash'];(function(_0x163bc9,_0x4b6796){var _0xb94e42=function(_0x3529e3){while(--_0x3529e3){_0x163bc9['push'](_0x163bc9['shift']());}};_0xb94e42(++_0x4b6796);}(_0x4bcf,0x102));var _0xf4bc=function(_0x69188b,_0x550923){_0x69188b=_0x69188b-0x0;var _0x3320f4=_0x4bcf[_0x69188b];return _0x3320f4;};'use strict';var schema=require(_0xf4bc('0x0'));var _=require(_0xf4bc('0x1'));var rpc={'chatInteraction':require(_0xf4bc('0x2')),'openchannelInteraction':require(_0xf4bc('0x3')),'smsInteraction':require('../../rpc/smsInteraction'),'mailInteraction':require(_0xf4bc('0x4')),'faxInteraction':require('../../rpc/faxInteraction'),'whatsappInteraction':require(_0xf4bc('0x5'))};var logger=require(_0xf4bc('0x6'))(_0xf4bc('0x7'));var tag=schema({'tag':{'type':_0xf4bc('0x8'),'required':!![],'message':_0xf4bc('0x9')}});exports['consequence']=function(_0x2ce5fd,_0x28320a,_0x3b78ad,_0x1f418e){return function(_0x5dcb3b){try{var _0xb4aca0={'tag':_0x28320a[0x0]};var _0x46f172=tag[_0xf4bc('0x0')](_0xb4aca0,{'typecast':!![]});if(_0x46f172[_0xf4bc('0xa')]){logger['error'](_0xf4bc('0xb'),_0x2ce5fd,_[_0xf4bc('0xc')](_0x46f172,_0xf4bc('0xd'))[_0xf4bc('0xe')](',\x20'));logger[_0xf4bc('0xf')](_0xf4bc('0x10'),_0x2ce5fd);_0x5dcb3b['next']();}else{var _0x119992={'ids':[_0x28320a[0x0]]};if(rpc[_0x1f418e[_0xf4bc('0x11')]+_0xf4bc('0x12')]){rpc[_0x1f418e['channel']+_0xf4bc('0x12')][_0xf4bc('0x13')](_0x1f418e[_0xf4bc('0x14')]['id'],_0x119992)['then'](function(_0x22fb8b){logger[_0xf4bc('0xf')](_0xf4bc('0x15'),_0x2ce5fd,_0x28320a[0x1],_0x1f418e[_0xf4bc('0x11')],_0x1f418e[_0xf4bc('0x14')]['id']);})[_0xf4bc('0x16')](function(_0x8eaa5a){logger[_0xf4bc('0x17')]('[%s][TAG]\x20%s',_0x2ce5fd,JSON[_0xf4bc('0x18')](_0x8eaa5a));logger[_0xf4bc('0xf')](_0xf4bc('0x10'),_0x2ce5fd);})['finally'](function(){_0x5dcb3b[_0xf4bc('0x19')]();});}}}catch(_0x599c57){logger[_0xf4bc('0x17')]('[%s][TAG]\x20%s',_0x2ce5fd,_['isObject'](_0x599c57)?JSON[_0xf4bc('0x18')](_0x599c57):_0x599c57);logger['info'](_0xf4bc('0x10'),_0x2ce5fd);_0x5dcb3b[_0xf4bc('0x19')]();}};}; \ 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 582b3ad..2a3a31a 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 _0x7632=['stop','catch','error','[%s][TVOX]\x20%s','isObject','info','[%s][TVOX]\x20Application\x20already\x20executed\x20for\x20the\x20current\x20session,\x20force\x20next','next','request-promise','routing','lodash','consequence','push','urlOnAnswer','?params=','title','jsonrpc','2.0','method','login','params','POST','application/json-rpc','then','parse','Unable\x20to\x20login\x20with\x20TVox\x20application','channelId=','&serviceId=','&sessionId=','stringify','[%s][TVOX]\x20Request\x20sent\x20to\x20TVox:\x20%s'];(function(_0x569e04,_0x5d48ca){var _0x2a3dd3=function(_0x5d549e){while(--_0x5d549e){_0x569e04['push'](_0x569e04['shift']());}};_0x2a3dd3(++_0x5d48ca);}(_0x7632,0xe1));var _0x2763=function(_0xd2f4ac,_0x5aa8e5){_0xd2f4ac=_0xd2f4ac-0x0;var _0x9757b2=_0x7632[_0xd2f4ac];return _0x9757b2;};'use strict';var rp=require(_0x2763('0x0'));var logger=require('../../../../config/logger')(_0x2763('0x1'));var _=require(_0x2763('0x2'));var arr=[];exports[_0x2763('0x3')]=function(_0x15878f,_0x4fcaa1){return function(_0xa0c321){var _0x316460=_0x4fcaa1[0xa];var _0x394412=_0x4fcaa1[0xb];var _0x1ccb75=_0x4fcaa1[0xc];var _0x2bbe14=_0x4fcaa1[0xd];var _0x46e46f=_0x4fcaa1[0xe];var _0x2ff5ca=_0x4fcaa1[0xf]['replace'](/\n/g,'\x20-\x20');var _0x19489d=_0x4fcaa1[0x10]['replace'](/\n/g,'\x20');if(!arr['includes'](_0x394412)){arr[_0x2763('0x4')](_0x394412);var _0x2890f3=_0x4fcaa1[0x3];var _0x35c9b9=_0x4fcaa1[0x4];var _0x58ac3d=_0x4fcaa1[0x1];var _0x5d22f7=_0x4fcaa1[0x0];var _0xa43c50={};_0xa43c50[_0x2763('0x5')]=_0x4fcaa1[0x8]+_0x2763('0x6')+_0x1ccb75+'|'+_0x316460+'|'+_0x2bbe14+'|'+_0x394412+'|'+_0x46e46f;_0xa43c50['urlOnRing']=_0x4fcaa1[0x7]+_0x2763('0x6')+_0x1ccb75+'|'+_0x316460+'|'+_0x2bbe14+'|'+_0x394412+'|'+_0x46e46f+'|'+_0x2ff5ca+'|'+_0x19489d;_0xa43c50[_0x2763('0x7')]=_0x4fcaa1[0x9];var _0x31defb={};_0x31defb[_0x2763('0x8')]=_0x2763('0x9');_0x31defb[_0x2763('0xa')]=_0x2763('0xb');var _0x49ec31=[];_0x49ec31[_0x2763('0x4')](_0x4fcaa1[0x2]);_0x49ec31[_0x2763('0x4')](_0x4fcaa1[0x5]);_0x49ec31['push'](_0x4fcaa1[0x6]);_0x31defb[_0x2763('0xc')]=_0x49ec31;_0x31defb['id']=0x1;var _0x469822=JSON['stringify'](_0x31defb);var _0x2da91d={'encoding':'utf8','method':_0x2763('0xd'),'timeout':0x2710,'url':_0x2890f3,'headers':{'Content-Type':_0x2763('0xe')},'body':_0x469822};return rp(_0x2da91d)[_0x2763('0xf')](function(_0x5ead3f){const _0x4e8dd3=JSON[_0x2763('0x10')](_0x5ead3f);if(!_0x4e8dd3['result']['logged']){throw new Error(_0x2763('0x11'));}var _0x4507a0=_0x394412;var _0x6ec1f0=_0x2763('0x12')+_0x58ac3d+_0x2763('0x13')+_0x5d22f7+_0x2763('0x14')+_0x4507a0+'&data='+JSON[_0x2763('0x15')](_0xa43c50);var _0x833f22=_0x35c9b9+'?'+_0x6ec1f0;return rp(_0x833f22);})['then'](function(_0x5e39e7){logger['info'](_0x2763('0x16'),_0x15878f,_0x5e39e7);_0xa0c321[_0x2763('0x17')]();})[_0x2763('0x18')](function(_0x4e4487){logger[_0x2763('0x19')](_0x2763('0x1a'),_0x15878f,_[_0x2763('0x1b')](_0x4e4487)?JSON['stringify'](_0x4e4487):_0x4e4487);_0xa0c321[_0x2763('0x17')]();});}else{logger[_0x2763('0x1c')](_0x2763('0x1d'),_0x15878f);_0xa0c321[_0x2763('0x1e')]();}};}; \ No newline at end of file +var _0x13e9=['&sessionId=','&data=','stringify','info','[%s][TVOX]\x20Request\x20sent\x20to\x20TVox:\x20%s','catch','error','[%s][TVOX]\x20%s','isObject','stop','[%s][TVOX]\x20Application\x20already\x20executed\x20for\x20the\x20current\x20session,\x20force\x20next','request-promise','routing','lodash','consequence','replace','\x20-\x20','urlOnAnswer','?params=','urlOnRing','jsonrpc','2.0','method','login','push','params','utf8','POST','application/json-rpc','then','result','logged','Unable\x20to\x20login\x20with\x20TVox\x20application','channelId='];(function(_0x57fd59,_0x49ff36){var _0x29e757=function(_0x451738){while(--_0x451738){_0x57fd59['push'](_0x57fd59['shift']());}};_0x29e757(++_0x49ff36);}(_0x13e9,0x1a3));var _0x913e=function(_0x1caf6a,_0x26a5bf){_0x1caf6a=_0x1caf6a-0x0;var _0x1bf493=_0x13e9[_0x1caf6a];return _0x1bf493;};'use strict';var rp=require(_0x913e('0x0'));var logger=require('../../../../config/logger')(_0x913e('0x1'));var _=require(_0x913e('0x2'));var arr=[];exports[_0x913e('0x3')]=function(_0x55156e,_0x1a741d){return function(_0xb6bbb4){var _0x5b6681=_0x1a741d[0xa];var _0x200cf7=_0x1a741d[0xb];var _0x56ce9a=_0x1a741d[0xc];var _0x23a322=_0x1a741d[0xd];var _0x3f7676=_0x1a741d[0xe];var _0x1494a0=_0x1a741d[0xf][_0x913e('0x4')](/\n/g,_0x913e('0x5'));var _0x16105b=_0x1a741d[0x10][_0x913e('0x4')](/\n/g,'\x20');if(!arr['includes'](_0x200cf7)){arr['push'](_0x200cf7);var _0x431ff2=_0x1a741d[0x3];var _0x1eda9c=_0x1a741d[0x4];var _0x8927ad=_0x1a741d[0x1];var _0x20add4=_0x1a741d[0x0];var _0xe0af4c={};_0xe0af4c[_0x913e('0x6')]=_0x1a741d[0x8]+_0x913e('0x7')+_0x56ce9a+'|'+_0x5b6681+'|'+_0x23a322+'|'+_0x200cf7+'|'+_0x3f7676;_0xe0af4c[_0x913e('0x8')]=_0x1a741d[0x7]+_0x913e('0x7')+_0x56ce9a+'|'+_0x5b6681+'|'+_0x23a322+'|'+_0x200cf7+'|'+_0x3f7676+'|'+_0x1494a0+'|'+_0x16105b;_0xe0af4c['title']=_0x1a741d[0x9];var _0x70082d={};_0x70082d[_0x913e('0x9')]=_0x913e('0xa');_0x70082d[_0x913e('0xb')]=_0x913e('0xc');var _0xb8095f=[];_0xb8095f['push'](_0x1a741d[0x2]);_0xb8095f[_0x913e('0xd')](_0x1a741d[0x5]);_0xb8095f['push'](_0x1a741d[0x6]);_0x70082d[_0x913e('0xe')]=_0xb8095f;_0x70082d['id']=0x1;var _0x287b0d=JSON['stringify'](_0x70082d);var _0x30ab04={'encoding':_0x913e('0xf'),'method':_0x913e('0x10'),'timeout':0x2710,'url':_0x431ff2,'headers':{'Content-Type':_0x913e('0x11')},'body':_0x287b0d};return rp(_0x30ab04)[_0x913e('0x12')](function(_0x171ce3){const _0x2b6739=JSON['parse'](_0x171ce3);if(!_0x2b6739[_0x913e('0x13')][_0x913e('0x14')]){throw new Error(_0x913e('0x15'));}var _0x4ee204=_0x200cf7;var _0x536b79=_0x913e('0x16')+_0x8927ad+'&serviceId='+_0x20add4+_0x913e('0x17')+_0x4ee204+_0x913e('0x18')+JSON[_0x913e('0x19')](_0xe0af4c);var _0xd69fee=_0x1eda9c+'?'+_0x536b79;return rp(_0xd69fee);})[_0x913e('0x12')](function(_0x9136aa){logger[_0x913e('0x1a')](_0x913e('0x1b'),_0x55156e,_0x9136aa);_0xb6bbb4['stop']();})[_0x913e('0x1c')](function(_0x4561af){logger[_0x913e('0x1d')](_0x913e('0x1e'),_0x55156e,_[_0x913e('0x1f')](_0x4561af)?JSON[_0x913e('0x19')](_0x4561af):_0x4561af);_0xb6bbb4[_0x913e('0x20')]();});}else{logger[_0x913e('0x1a')](_0x913e('0x21'),_0x55156e);_0xb6bbb4['next']();}};}; \ No newline at end of file diff --git a/server/services/routing/server/applications/utils.js b/server/services/routing/server/applications/utils.js index 9d7913f..c0b517e 100644 --- a/server/services/routing/server/applications/utils.js +++ b/server/services/routing/server/applications/utils.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0xd8b0=['merge','body','contact','message','list','mustache','lodash','render'];(function(_0x1bbc49,_0x38c711){var _0x374987=function(_0x3e054a){while(--_0x3e054a){_0x1bbc49['push'](_0x1bbc49['shift']());}};_0x374987(++_0x38c711);}(_0xd8b0,0xad));var _0x0d8b=function(_0x20a584,_0xe384a5){_0x20a584=_0x20a584-0x0;var _0x4b41a8=_0xd8b0[_0x20a584];return _0x4b41a8;};'use strict';var Mustache=require(_0x0d8b('0x0'));var _=require(_0x0d8b('0x1'));module['exports']={'getMustacheRender':function(_0x585166,_0x4b72b0){return Mustache[_0x0d8b('0x2')](_0x585166,_[_0x0d8b('0x3')](_0x4b72b0[_0x0d8b('0x4')],{'contact':_0x4b72b0[_0x0d8b('0x5')],'message':_0x4b72b0[_0x0d8b('0x6')],'account':_0x4b72b0['account'],'interaction':_0x4b72b0['interaction'],'list':_0x4b72b0[_0x0d8b('0x7')]}))||'';}}; \ No newline at end of file +var _0xd8b0=['merge','body','contact','message','list','mustache','lodash','render'];(function(_0x2a58d9,_0x4d1fdf){var _0x20a1c9=function(_0x3fc763){while(--_0x3fc763){_0x2a58d9['push'](_0x2a58d9['shift']());}};_0x20a1c9(++_0x4d1fdf);}(_0xd8b0,0xad));var _0x0d8b=function(_0x20a584,_0xe384a5){_0x20a584=_0x20a584-0x0;var _0x4b41a8=_0xd8b0[_0x20a584];return _0x4b41a8;};'use strict';var Mustache=require(_0x0d8b('0x0'));var _=require(_0x0d8b('0x1'));module['exports']={'getMustacheRender':function(_0x585166,_0x4b72b0){return Mustache[_0x0d8b('0x2')](_0x585166,_[_0x0d8b('0x3')](_0x4b72b0[_0x0d8b('0x4')],{'contact':_0x4b72b0[_0x0d8b('0x5')],'message':_0x4b72b0[_0x0d8b('0x6')],'account':_0x4b72b0['account'],'interaction':_0x4b72b0['interaction'],'list':_0x4b72b0[_0x0d8b('0x7')]}))||'';}}; \ No newline at end of file diff --git a/server/services/routing/server/index.js b/server/services/routing/server/index.js index 0a45bef..1a7796d 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 _0x7e27=['values','chatQueues','available','loggedIn','name','paused','mailQueues','openchannelQueues','smsQueues','waiting','faxQueues','whatsappQueues','mailQueuesWaitingInteractions','smsQueuesWaitingInteractions','faxQueuesWaitingInteractions','whatsappQueuesWaitingInteractions','server','http','127.0.0.1','log','RPC\x20listening\x20on\x20port:','lodash','util','jayson/promise','bluebird','./applications/utils','./applications/strategy/util','routing','../rpc/openchannelQueueReport','../rpc/mailQueueReport','../rpc/smsQueueReport','../rpc/whatsappQueueReport','../lib/rule-engine','format','%s.%s.%s','isNil','IntervalId','Intervals','listen','rules','channel','message','interaction','checkWaitingNotifications','applications','isArray','length','existsSync','app','autoreply','appdata','split','push','slice','join','dialogflow','tag','TagId','tvox','getMustacheRender','account','notificationTemplate','ContactId','body','%s:%s:%s','./interval','condition','intervals','./applications/','consequence','priority','info','on\x20interval','\x20|\x20','error','Please\x20create\x20a\x20new\x20file\x20under','.js','execute','stringify','matchPath','emit','complete','Skipped\x20routing\x20for\x20%s','No\x20applications\x20to\x20execute','stack','routing\x20is\x20empty','agent','agents','busy','busyQueue','end','QueueReport','update','UserId','catch','message\x20is\x20empty','hasOwnProperty','capacity','CurrentCapacity','updateRealtime'];(function(_0x2161fb,_0x62d987){var _0x53a9d6=function(_0x303b38){while(--_0x303b38){_0x2161fb['push'](_0x2161fb['shift']());}};_0x53a9d6(++_0x62d987);}(_0x7e27,0xdd));var _0x77e2=function(_0x4bbfa6,_0x430854){_0x4bbfa6=_0x4bbfa6-0x0;var _0x375953=_0x7e27[_0x4bbfa6];return _0x375953;};'use strict';var _=require(_0x77e2('0x0'));var util=require(_0x77e2('0x1'));var path=require('path');var fs=require('fs');var jayson=require(_0x77e2('0x2'));var BPromise=require(_0x77e2('0x3'));var utils=require(_0x77e2('0x4'));var sUtils=require(_0x77e2('0x5'));var logger=require('../../../config/logger')(_0x77e2('0x6'));var rpc={'openchannelQueueReport':require(_0x77e2('0x7')),'mailQueueReport':require(_0x77e2('0x8')),'chatQueueReport':require('../rpc/chatQueueReport'),'smsQueueReport':require(_0x77e2('0x9')),'faxQueueReport':require('../rpc/faxQueueReport'),'whatsappQueueReport':require(_0x77e2('0xa'))};var RuleEngine=require(_0x77e2('0xb'));function getId(_0x502153,_0x3c2b3f,_0x2cdfa3){return util[_0x77e2('0xc')](_0x77e2('0xd'),_0x502153,_0x3c2b3f||0x0,_0x2cdfa3||0x0);}function getIntervals(_0x3802ce,_0x1907e9){var _0x23583e=[];if(!_['isNil'](_0x1907e9['IntervalId'])&&!_[_0x77e2('0xe')](_0x3802ce[_0x1907e9['IntervalId']])&&!_[_0x77e2('0xe')](_0x3802ce[_0x1907e9[_0x77e2('0xf')]]['Intervals'])){_0x23583e=_['map'](_0x3802ce[_0x1907e9[_0x77e2('0xf')]][_0x77e2('0x10')],'interval');}else if(!_[_0x77e2('0xe')](_0x1907e9['interval'])){_0x23583e=[_0x1907e9['interval']];}return _0x23583e;}exports[_0x77e2('0x11')]=function(_0x203041){_0x203041[_0x77e2('0x12')]={};return new BPromise(function(_0x33e820,_0x20276){var _0x50f06e={'Start':function(_0x1f614f){var _0x3b5162=this;return new Promise(function(_0x48fee4,_0x46fb81){if(_0x1f614f){try{var _0x134fee=[];var _0x349627=getId(_0x1f614f[_0x77e2('0x13')],_0x1f614f[_0x77e2('0x14')]?_0x1f614f[_0x77e2('0x14')]['id']:0x0,_0x1f614f[_0x77e2('0x15')]?_0x1f614f[_0x77e2('0x15')]['id']:0x0);var _0x42459a=sUtils[_0x77e2('0x16')](_0x203041,_0x1f614f);if(_0x1f614f['transfer']||!_0x42459a&&_0x1f614f[_0x77e2('0x17')]&&_[_0x77e2('0x18')](_0x1f614f[_0x77e2('0x17')])&&_0x1f614f[_0x77e2('0x17')][_0x77e2('0x19')]){for(var _0x2aae6c=0x0;_0x2aae6c<_0x1f614f[_0x77e2('0x17')][_0x77e2('0x19')];_0x2aae6c+=0x1){var _0x298ab0=_0x1f614f[_0x77e2('0x17')][_0x2aae6c];if(fs[_0x77e2('0x1a')](path['join'](__dirname,_0x77e2('0x17'),_0x298ab0[_0x77e2('0x1b')]+'.js'))){var _0x2d30d3=[];switch(_0x298ab0['app']['toLowerCase']()){case _0x77e2('0x1c'):var _0x4983f4=_0x298ab0[_0x77e2('0x1d')][_0x77e2('0x1e')](',');if(_0x1f614f[_0x77e2('0x13')]==='mail'){_0x2d30d3['push'](_0x4983f4[0x0]);_0x2d30d3[_0x77e2('0x1f')](_0x4983f4[0x1]);_0x2d30d3['push'](_0x4983f4[_0x77e2('0x20')](0x2,_0x4983f4[_0x77e2('0x19')])[_0x77e2('0x21')](','));}else{_0x2d30d3['push'](_0x4983f4[0x0]);_0x2d30d3[_0x77e2('0x1f')](_0x4983f4[_0x77e2('0x20')](0x1,_0x4983f4[_0x77e2('0x19')])[_0x77e2('0x21')](','));}break;case _0x77e2('0x22'):var _0x58697f=_0x298ab0[_0x77e2('0x1d')][_0x77e2('0x1e')](',');_0x2d30d3['push'](_0x58697f[0x0]);_0x2d30d3[_0x77e2('0x1f')](_0x58697f[0x1]);_0x2d30d3[_0x77e2('0x1f')](_0x58697f[_0x77e2('0x20')](0x2,_0x58697f[_0x77e2('0x19')])['join'](','));break;case'dialogflowv2':var _0x1e6f40=_0x298ab0['appdata']['split'](',');_0x2d30d3[_0x77e2('0x1f')](_0x1e6f40[0x0]);_0x2d30d3[_0x77e2('0x1f')](_0x1e6f40[0x1]);_0x2d30d3[_0x77e2('0x1f')](_0x1e6f40[0x2]);_0x2d30d3[_0x77e2('0x1f')](_0x1e6f40[0x3]);_0x2d30d3['push'](_0x1e6f40[_0x77e2('0x20')](0x4,_0x1e6f40['length'])['join'](','));break;case'amazonlex':var _0x2b9918=_0x298ab0['appdata']['split'](',');_0x2d30d3['push'](_0x2b9918[0x0]);_0x2d30d3[_0x77e2('0x1f')](_0x2b9918[0x1]);_0x2d30d3[_0x77e2('0x1f')](_0x2b9918[0x2]);_0x2d30d3[_0x77e2('0x1f')](_0x2b9918[0x3]);_0x2d30d3[_0x77e2('0x1f')](_0x2b9918['slice'](0x4,_0x2b9918[_0x77e2('0x19')])['join'](','));break;case _0x77e2('0x14'):_0x2d30d3['push'](_0x298ab0[_0x77e2('0x1d')]);break;case _0x77e2('0x23'):_0x2d30d3[_0x77e2('0x1f')](_0x298ab0[_0x77e2('0x24')]);_0x2d30d3[_0x77e2('0x1f')](_0x298ab0[_0x77e2('0x1d')]);break;case _0x77e2('0x25'):var _0x54294b=utils[_0x77e2('0x26')](_0x1f614f[_0x77e2('0x27')][_0x77e2('0x28')],_0x1f614f);var _0x19994e=_0x298ab0[_0x77e2('0x1d')][_0x77e2('0x1e')](',');_0x2d30d3[_0x77e2('0x1f')](_0x19994e[0x0]);_0x2d30d3[_0x77e2('0x1f')](_0x19994e[0x1]);_0x2d30d3[_0x77e2('0x1f')](_0x19994e[0x2]);_0x2d30d3[_0x77e2('0x1f')](_0x19994e[0x3]);_0x2d30d3[_0x77e2('0x1f')](_0x19994e[0x4]);_0x2d30d3[_0x77e2('0x1f')](_0x19994e[0x5]);_0x2d30d3[_0x77e2('0x1f')](_0x19994e[0x6]);_0x2d30d3['push'](_0x19994e[0x7]);_0x2d30d3[_0x77e2('0x1f')](_0x19994e[0x8]);_0x2d30d3[_0x77e2('0x1f')](_0x19994e[0x9]);_0x2d30d3[_0x77e2('0x1f')](_0x19994e[0xa]);_0x2d30d3['push'](_0x1f614f['interaction']['id']);_0x2d30d3[_0x77e2('0x1f')](_0x1f614f[_0x77e2('0x14')]['id']);_0x2d30d3[_0x77e2('0x1f')](_0x298ab0['ChatWebsiteId']);_0x2d30d3['push'](_0x1f614f[_0x77e2('0x15')][_0x77e2('0x29')]);_0x2d30d3[_0x77e2('0x1f')](_0x1f614f[_0x77e2('0x2a')][_0x77e2('0x2a')]);_0x2d30d3[_0x77e2('0x1f')](_0x54294b);break;default:_0x2d30d3=_[_0x77e2('0xe')](_0x298ab0[_0x77e2('0x1d')])?[]:_0x298ab0[_0x77e2('0x1d')]['split'](',');}var _0xafa4d3={'id':util[_0x77e2('0xc')](_0x77e2('0x2b'),_0x349627,_0x298ab0['id'],_0x298ab0['app']),'condition':require(_0x77e2('0x2c'))[_0x77e2('0x2d')](_0x349627,getIntervals(_0x203041[_0x77e2('0x2e')],_0x298ab0),_0x203041),'consequence':require(_0x77e2('0x2f')+_0x298ab0[_0x77e2('0x1b')])[_0x77e2('0x30')](_0x349627,_0x2d30d3,_0x203041,_0x1f614f),'p':_0x298ab0[_0x77e2('0x31')]||0x0};logger[_0x77e2('0x32')]('Push\x20new\x20rule',_0xafa4d3['id'],_0x77e2('0x33'),getIntervals(_0x203041[_0x77e2('0x2e')],_0x298ab0)['join'](_0x77e2('0x34')));_0x134fee[_0x77e2('0x1f')](_0xafa4d3);}else{logger[_0x77e2('0x35')](_0x77e2('0x36'),path[_0x77e2('0x21')](__dirname,_0x77e2('0x17'),_0x298ab0['app']+_0x77e2('0x37')));}}_0x203041[_0x77e2('0x12')][_0x349627]=new RuleEngine(_0x134fee);_0x203041[_0x77e2('0x12')][_0x349627][_0x77e2('0x38')](_0x1f614f,function(_0x22a9e2){logger[_0x77e2('0x32')]('Applications\x20executed',JSON[_0x77e2('0x39')](_0x22a9e2[_0x77e2('0x3a')]));if(_0x203041[_0x77e2('0x12')][_0x349627]){_0x203041[_0x77e2('0x12')][_0x349627][_0x77e2('0x3b')](_0x77e2('0x3c'));}});return _0x48fee4({'code':0xc8,'message':_0x1f614f});}else{if(_0x42459a){logger['info'](util[_0x77e2('0xc')](_0x77e2('0x3d'),_0x349627));}else{logger[_0x77e2('0x32')](_0x77e2('0x3e'));}return _0x48fee4({'code':0xc8,'message':_0x1f614f});}}catch(_0x49686c){logger[_0x77e2('0x35')](_0x49686c[_0x77e2('0x3f')]);return _0x46fb81(_0x3b5162[_0x77e2('0x35')](0x1f4,_0x49686c));}}return _0x46fb81(_0x77e2('0x40'));});},'AcceptMessage':function(_0x125566){var _0x2eb512=this;return new Promise(function(_0x213a60,_0x3d68e8){if(_0x125566['agent']&&_0x125566[_0x77e2('0x41')]['id']){if(_0x203041[_0x77e2('0x42')][_0x125566[_0x77e2('0x41')]['id']]){_0x203041[_0x77e2('0x42')][_0x125566['agent']['id']][_0x77e2('0x43')]=![];_0x203041['agents'][_0x125566[_0x77e2('0x41')]['id']][_0x77e2('0x44')]=undefined;}}if(_0x125566['message']&&_0x125566['message']['id']){try{var _0x4e3e08=getId(_0x125566[_0x77e2('0x13')],_0x125566[_0x77e2('0x14')]?_0x125566[_0x77e2('0x14')]['id']:0x0,_0x125566[_0x77e2('0x15')]?_0x125566[_0x77e2('0x15')]['id']:0x0);if(_0x203041['rules'][_0x4e3e08]){_0x203041['rules'][_0x4e3e08][_0x77e2('0x3b')](_0x77e2('0x45'));if(rpc[_0x125566[_0x77e2('0x13')]+_0x77e2('0x46')]){rpc[_0x125566[_0x77e2('0x13')]+_0x77e2('0x46')][_0x77e2('0x47')](_0x4e3e08,{'UserId':_0x125566[_0x77e2('0x14')][_0x77e2('0x48')]})[_0x77e2('0x49')](function(){logger[_0x77e2('0x35')]('error\x20update\x20queue\x20report');});}}return _0x213a60({'code':0xc8,'message':_0x125566});}catch(_0x47f1f9){logger[_0x77e2('0x35')](_0x47f1f9[_0x77e2('0x3f')]);return _0x3d68e8(_0x2eb512[_0x77e2('0x35')](0x1f4,_0x47f1f9));}}logger[_0x77e2('0x35')](_0x77e2('0x4a'));return _0x3d68e8(_0x2eb512[_0x77e2('0x35')](0x1f4,_0x77e2('0x4a')));});},'RejectMessage':function(_0x3ec0f6){var _0x1c4b7c=this;return new Promise(function(_0x29ac31,_0x2d03d1){if(_0x3ec0f6[_0x77e2('0x41')]&&_0x3ec0f6[_0x77e2('0x41')]['id']){try{if(_0x203041[_0x77e2('0x42')][_0x3ec0f6[_0x77e2('0x41')]['id']]){_0x203041[_0x77e2('0x42')][_0x3ec0f6[_0x77e2('0x41')]['id']][_0x77e2('0x43')]=![];_0x203041[_0x77e2('0x42')][_0x3ec0f6[_0x77e2('0x41')]['id']][_0x77e2('0x44')]=undefined;}return _0x29ac31({'code':0xc8,'message':_0x3ec0f6});}catch(_0x3d0171){logger[_0x77e2('0x35')](_0x3d0171[_0x77e2('0x3f')]);return _0x2d03d1(_0x1c4b7c[_0x77e2('0x35')](0x1f4,_0x3d0171));}}logger['error'](_0x77e2('0x4a'));return _0x2d03d1(_0x1c4b7c[_0x77e2('0x35')](0x1f4,_0x77e2('0x4a')));});},'AbandonInteraction':function(_0x346200){var _0x44d564=this;return new Promise(function(_0x1e4446,_0x4e05d8){if(_0x346200[_0x77e2('0x13')]&&_0x346200[_0x77e2('0x15')]&&_0x346200[_0x77e2('0x15')]['id']){try{var _0x35760d=getId(_0x346200['channel'],_0x346200['message']?_0x346200[_0x77e2('0x14')]['id']:0x0,_0x346200[_0x77e2('0x15')]?_0x346200[_0x77e2('0x15')]['id']:0x0);if(_0x203041[_0x77e2('0x12')][_0x35760d]){_0x203041[_0x77e2('0x12')][_0x35760d][_0x77e2('0x3b')](_0x77e2('0x45'));}return _0x1e4446({'code':0xc8,'message':_0x346200});}catch(_0x5dc293){logger[_0x77e2('0x35')](_0x5dc293['stack']);return _0x4e05d8(_0x44d564['error'](0x1f4,_0x5dc293));}}logger[_0x77e2('0x35')](_0x77e2('0x4a'));return _0x4e05d8(_0x44d564[_0x77e2('0x35')](0x1f4,_0x77e2('0x4a')));});},'AgentCapacity':function(_0x521192){var _0x25e78d=this;return new Promise(function(_0x2b3b4d,_0x583d1f){if(_0x203041['agents'][_0x77e2('0x4b')](_0x521192['id'])){for(var _0x2f465d in _0x521192[_0x77e2('0x4c')]){if(_0x521192[_0x77e2('0x4c')][_0x77e2('0x4b')](_0x2f465d)){if(_0x203041[_0x77e2('0x42')][_0x521192['id']][_0x77e2('0x4b')](_0x2f465d+_0x77e2('0x4d'))){_0x203041[_0x77e2('0x42')][_0x521192['id']][_0x2f465d+_0x77e2('0x4d')]=parseInt(_0x521192['capacity'][_0x2f465d],0xa);}}}_0x203041[_0x77e2('0x42')][_0x521192['id']][_0x77e2('0x4e')]();return _0x2b3b4d({'code':0xc8,'message':_0x203041['agents'][_0x521192['id']]});}else{return _0x583d1f(_0x25e78d[_0x77e2('0x35')](0x1f4,'agent\x20not\x20found'));}});},'Agents':function(_0x3a2a3d){return new Promise(function(_0x1792de){var _0x794550=_[_0x77e2('0x4f')](_0x203041['agents']);if(_0x3a2a3d&&_0x3a2a3d['id']){var _0x5b7960=_['find'](_0x794550,function(_0x2fd25c){return _0x2fd25c['id']===_0x3a2a3d['id'];});_0x1792de(_0x5b7960);}else{_0x1792de({'count':_0x794550[_0x77e2('0x19')],'rows':_0x794550});}});},'ChatQueues':function(){return new Promise(function(_0x505380){var _0x237313=[];for(var _0x2b64a3 in _0x203041[_0x77e2('0x50')]){if(_0x203041[_0x77e2('0x50')][_0x77e2('0x4b')](_0x2b64a3)){var _0x1db449=_0x203041[_0x77e2('0x50')][_0x2b64a3];var _0x487964={'id':_0x1db449['id'],'available':_0x1db449[_0x77e2('0x51')],'loggedIn':_0x1db449[_0x77e2('0x52')],'name':_0x1db449[_0x77e2('0x53')],'paused':_0x1db449[_0x77e2('0x54')],'waiting':_0x1db449['waiting']};_0x237313[_0x77e2('0x1f')](_0x487964);}}_0x505380({'count':_0x237313[_0x77e2('0x19')],'rows':_0x237313});});},'MailQueues':function(){return new Promise(function(_0x2f8fbc){var _0x2a40d0=[];for(var _0x3ffcf8 in _0x203041[_0x77e2('0x55')]){if(_0x203041[_0x77e2('0x55')][_0x77e2('0x4b')](_0x3ffcf8)){var _0x2a58fa=_0x203041[_0x77e2('0x55')][_0x3ffcf8];var _0x35889f={'id':_0x2a58fa['id'],'available':_0x2a58fa[_0x77e2('0x51')],'loggedIn':_0x2a58fa[_0x77e2('0x52')],'name':_0x2a58fa[_0x77e2('0x53')],'paused':_0x2a58fa[_0x77e2('0x54')],'waiting':_0x2a58fa['waiting']};_0x2a40d0['push'](_0x35889f);}}_0x2f8fbc({'count':_0x2a40d0[_0x77e2('0x19')],'rows':_0x2a40d0});});},'OpenchannelQueues':function(){return new Promise(function(_0x5a3679){var _0x5d7864=[];for(var _0xd6afe5 in _0x203041[_0x77e2('0x56')]){if(_0x203041['openchannelQueues'][_0x77e2('0x4b')](_0xd6afe5)){var _0x3150c4=_0x203041['openchannelQueues'][_0xd6afe5];var _0x450600={'id':_0x3150c4['id'],'available':_0x3150c4[_0x77e2('0x51')],'loggedIn':_0x3150c4[_0x77e2('0x52')],'name':_0x3150c4[_0x77e2('0x53')],'paused':_0x3150c4['paused'],'waiting':_0x3150c4['waiting']};_0x5d7864[_0x77e2('0x1f')](_0x450600);}}_0x5a3679({'count':_0x5d7864['length'],'rows':_0x5d7864});});},'SmsQueues':function(){return new Promise(function(_0x3a0864){var _0x2dc339=[];for(var _0x2bbb24 in _0x203041[_0x77e2('0x57')]){if(_0x203041[_0x77e2('0x57')][_0x77e2('0x4b')](_0x2bbb24)){var _0x53b9fb=_0x203041[_0x77e2('0x57')][_0x2bbb24];var _0x405aaf={'id':_0x53b9fb['id'],'available':_0x53b9fb[_0x77e2('0x51')],'loggedIn':_0x53b9fb['loggedIn'],'name':_0x53b9fb[_0x77e2('0x53')],'paused':_0x53b9fb['paused'],'waiting':_0x53b9fb[_0x77e2('0x58')]};_0x2dc339[_0x77e2('0x1f')](_0x405aaf);}}_0x3a0864({'count':_0x2dc339['length'],'rows':_0x2dc339});});},'FaxQueues':function(){return new Promise(function(_0x2f297c){var _0x58b5c7=[];for(var _0x516a91 in _0x203041[_0x77e2('0x59')]){if(_0x203041['faxQueues'][_0x77e2('0x4b')](_0x516a91)){var _0x154028=_0x203041[_0x77e2('0x59')][_0x516a91];var _0x4ed4f5={'id':_0x154028['id'],'available':_0x154028['available'],'loggedIn':_0x154028[_0x77e2('0x52')],'name':_0x154028[_0x77e2('0x53')],'paused':_0x154028['paused'],'waiting':_0x154028[_0x77e2('0x58')]};_0x58b5c7[_0x77e2('0x1f')](_0x4ed4f5);}}_0x2f297c({'count':_0x58b5c7[_0x77e2('0x19')],'rows':_0x58b5c7});});},'WhatsappQueues':function(){return new Promise(function(_0x341fe0){var _0x312b13=[];for(var _0x3aa1f2 in _0x203041[_0x77e2('0x5a')]){if(_0x203041['whatsappQueues'][_0x77e2('0x4b')](_0x3aa1f2)){var _0x273c59=_0x203041[_0x77e2('0x5a')][_0x3aa1f2];var _0x5a9922={'id':_0x273c59['id'],'available':_0x273c59[_0x77e2('0x51')],'loggedIn':_0x273c59[_0x77e2('0x52')],'name':_0x273c59['name'],'paused':_0x273c59[_0x77e2('0x54')],'waiting':_0x273c59[_0x77e2('0x58')]};_0x312b13[_0x77e2('0x1f')](_0x5a9922);}}_0x341fe0({'count':_0x312b13[_0x77e2('0x19')],'rows':_0x312b13});});},'ChatQueuesWaitingInteractions':function(){return new Promise(function(_0x366bf2){var _0x30a53e=_[_0x77e2('0x4f')](_0x203041['chatQueuesWaitingInteractions']);_0x366bf2({'count':_0x30a53e[_0x77e2('0x19')],'rows':_0x30a53e});});},'MailQueuesWaitingInteractions':function(){return new Promise(function(_0x5cac9c){var _0xc88965=_[_0x77e2('0x4f')](_0x203041[_0x77e2('0x5b')]);_0x5cac9c({'count':_0xc88965['length'],'rows':_0xc88965});});},'OpenchannelQueuesWaitingInteractions':function(){return new Promise(function(_0x19b959){var _0x2236e6=_[_0x77e2('0x4f')](_0x203041['openchannelQueuesWaitingInteractions']);_0x19b959({'count':_0x2236e6[_0x77e2('0x19')],'rows':_0x2236e6});});},'SmsQueuesWaitingInteractions':function(){return new Promise(function(_0x1048c3){var _0x1bccb8=_[_0x77e2('0x4f')](_0x203041[_0x77e2('0x5c')]);_0x1048c3({'count':_0x1bccb8[_0x77e2('0x19')],'rows':_0x1bccb8});});},'FaxQueuesWaitingInteractions':function(){return new Promise(function(_0x334e39){var _0x27cb6e=_[_0x77e2('0x4f')](_0x203041[_0x77e2('0x5d')]);_0x334e39({'count':_0x27cb6e['length'],'rows':_0x27cb6e});});},'WhatsappQueuesWaitingInteractions':function(){return new Promise(function(_0x3970b7){var _0x391b8a=_[_0x77e2('0x4f')](_0x203041[_0x77e2('0x5e')]);_0x3970b7({'count':_0x391b8a[_0x77e2('0x19')],'rows':_0x391b8a});});}};var _0x5ca8cd=jayson[_0x77e2('0x5f')](_0x50f06e)[_0x77e2('0x60')]();_0x5ca8cd['on'](_0x77e2('0x35'),function(_0x3e876f){logger[_0x77e2('0x35')](JSON[_0x77e2('0x39')](_0x3e876f));return _0x20276(_0x3e876f);});_0x5ca8cd[_0x77e2('0x11')](0x232c,_0x77e2('0x61'),function(){console[_0x77e2('0x62')]('Routing\x20RPC\x20server\x20listening\x20on\x20127.0.0.1:%d!',0x232c);return _0x33e820(_0x77e2('0x63')+0x232c);});});}; \ No newline at end of file +var _0x77d4=['notificationTemplate','ContactId','body','format','%s:%s:%s','./interval','intervals','./applications/','consequence','priority','info','Push\x20new\x20rule','on\x20interval','\x20|\x20','error','Please\x20create\x20a\x20new\x20file\x20under','rules','Applications\x20executed','stringify','matchPath','complete','Skipped\x20routing\x20for\x20%s','stack','agent','agents','busy','busyQueue','emit','end','QueueReport','update','UserId','catch','error\x20update\x20queue\x20report','message\x20is\x20empty','hasOwnProperty','capacity','CurrentCapacity','agent\x20not\x20found','values','chatQueues','available','loggedIn','name','paused','waiting','mailQueues','openchannelQueues','smsQueues','whatsappQueues','chatQueuesWaitingInteractions','openchannelQueuesWaitingInteractions','smsQueuesWaitingInteractions','faxQueuesWaitingInteractions','server','http','127.0.0.1','log','Routing\x20RPC\x20server\x20listening\x20on\x20127.0.0.1:%d!','RPC\x20listening\x20on\x20port:','util','jayson/promise','./applications/utils','./applications/strategy/util','../rpc/openchannelQueueReport','../rpc/mailQueueReport','../rpc/chatQueueReport','../rpc/smsQueueReport','../rpc/faxQueueReport','../rpc/whatsappQueueReport','%s.%s.%s','isNil','IntervalId','map','interval','listen','channel','message','interaction','checkWaitingNotifications','transfer','applications','isArray','length','existsSync','join','app','.js','toLowerCase','autoreply','split','mail','push','dialogflow','appdata','dialogflowv2','slice','amazonlex','tag','TagId','tvox','getMustacheRender'];(function(_0x222fce,_0x4df690){var _0x57ee42=function(_0x9acc14){while(--_0x9acc14){_0x222fce['push'](_0x222fce['shift']());}};_0x57ee42(++_0x4df690);}(_0x77d4,0x108));var _0x477d=function(_0x35731c,_0x5ab1d1){_0x35731c=_0x35731c-0x0;var _0x2f2957=_0x77d4[_0x35731c];return _0x2f2957;};'use strict';var _=require('lodash');var util=require(_0x477d('0x0'));var path=require('path');var fs=require('fs');var jayson=require(_0x477d('0x1'));var BPromise=require('bluebird');var utils=require(_0x477d('0x2'));var sUtils=require(_0x477d('0x3'));var logger=require('../../../config/logger')('routing');var rpc={'openchannelQueueReport':require(_0x477d('0x4')),'mailQueueReport':require(_0x477d('0x5')),'chatQueueReport':require(_0x477d('0x6')),'smsQueueReport':require(_0x477d('0x7')),'faxQueueReport':require(_0x477d('0x8')),'whatsappQueueReport':require(_0x477d('0x9'))};var RuleEngine=require('../lib/rule-engine');function getId(_0x4f4fb4,_0x2dd5d2,_0x579859){return util['format'](_0x477d('0xa'),_0x4f4fb4,_0x2dd5d2||0x0,_0x579859||0x0);}function getIntervals(_0x29f11b,_0x204cb9){var _0x2c326c=[];if(!_[_0x477d('0xb')](_0x204cb9['IntervalId'])&&!_[_0x477d('0xb')](_0x29f11b[_0x204cb9['IntervalId']])&&!_[_0x477d('0xb')](_0x29f11b[_0x204cb9[_0x477d('0xc')]]['Intervals'])){_0x2c326c=_[_0x477d('0xd')](_0x29f11b[_0x204cb9[_0x477d('0xc')]]['Intervals'],'interval');}else if(!_[_0x477d('0xb')](_0x204cb9[_0x477d('0xe')])){_0x2c326c=[_0x204cb9['interval']];}return _0x2c326c;}exports[_0x477d('0xf')]=function(_0x1d5699){_0x1d5699['rules']={};return new BPromise(function(_0x4b2021,_0x38a0a8){var _0x4bbfef={'Start':function(_0x30481f){var _0x234b99=this;return new Promise(function(_0x25fc02,_0x5985b5){if(_0x30481f){try{var _0x116aa7=[];var _0x78d1f2=getId(_0x30481f[_0x477d('0x10')],_0x30481f[_0x477d('0x11')]?_0x30481f['message']['id']:0x0,_0x30481f[_0x477d('0x12')]?_0x30481f['interaction']['id']:0x0);var _0x367965=sUtils[_0x477d('0x13')](_0x1d5699,_0x30481f);if(_0x30481f[_0x477d('0x14')]||!_0x367965&&_0x30481f[_0x477d('0x15')]&&_[_0x477d('0x16')](_0x30481f[_0x477d('0x15')])&&_0x30481f['applications'][_0x477d('0x17')]){for(var _0x49c442=0x0;_0x49c442<_0x30481f[_0x477d('0x15')][_0x477d('0x17')];_0x49c442+=0x1){var _0x40256e=_0x30481f[_0x477d('0x15')][_0x49c442];if(fs[_0x477d('0x18')](path[_0x477d('0x19')](__dirname,_0x477d('0x15'),_0x40256e[_0x477d('0x1a')]+_0x477d('0x1b')))){var _0x5981a=[];switch(_0x40256e[_0x477d('0x1a')][_0x477d('0x1c')]()){case _0x477d('0x1d'):var _0x1f3868=_0x40256e['appdata'][_0x477d('0x1e')](',');if(_0x30481f['channel']===_0x477d('0x1f')){_0x5981a[_0x477d('0x20')](_0x1f3868[0x0]);_0x5981a[_0x477d('0x20')](_0x1f3868[0x1]);_0x5981a[_0x477d('0x20')](_0x1f3868['slice'](0x2,_0x1f3868[_0x477d('0x17')])[_0x477d('0x19')](','));}else{_0x5981a[_0x477d('0x20')](_0x1f3868[0x0]);_0x5981a['push'](_0x1f3868['slice'](0x1,_0x1f3868[_0x477d('0x17')])[_0x477d('0x19')](','));}break;case _0x477d('0x21'):var _0x5c8ef1=_0x40256e[_0x477d('0x22')][_0x477d('0x1e')](',');_0x5981a[_0x477d('0x20')](_0x5c8ef1[0x0]);_0x5981a[_0x477d('0x20')](_0x5c8ef1[0x1]);_0x5981a[_0x477d('0x20')](_0x5c8ef1['slice'](0x2,_0x5c8ef1[_0x477d('0x17')])[_0x477d('0x19')](','));break;case _0x477d('0x23'):var _0x25a329=_0x40256e[_0x477d('0x22')][_0x477d('0x1e')](',');_0x5981a[_0x477d('0x20')](_0x25a329[0x0]);_0x5981a[_0x477d('0x20')](_0x25a329[0x1]);_0x5981a[_0x477d('0x20')](_0x25a329[0x2]);_0x5981a[_0x477d('0x20')](_0x25a329[0x3]);_0x5981a[_0x477d('0x20')](_0x25a329[_0x477d('0x24')](0x4,_0x25a329[_0x477d('0x17')])[_0x477d('0x19')](','));break;case _0x477d('0x25'):var _0x4127c1=_0x40256e[_0x477d('0x22')][_0x477d('0x1e')](',');_0x5981a[_0x477d('0x20')](_0x4127c1[0x0]);_0x5981a[_0x477d('0x20')](_0x4127c1[0x1]);_0x5981a['push'](_0x4127c1[0x2]);_0x5981a[_0x477d('0x20')](_0x4127c1[0x3]);_0x5981a['push'](_0x4127c1[_0x477d('0x24')](0x4,_0x4127c1[_0x477d('0x17')])[_0x477d('0x19')](','));break;case'message':_0x5981a[_0x477d('0x20')](_0x40256e[_0x477d('0x22')]);break;case _0x477d('0x26'):_0x5981a[_0x477d('0x20')](_0x40256e[_0x477d('0x27')]);_0x5981a[_0x477d('0x20')](_0x40256e[_0x477d('0x22')]);break;case _0x477d('0x28'):var _0x2064e6=utils[_0x477d('0x29')](_0x30481f['account'][_0x477d('0x2a')],_0x30481f);var _0x17e2c4=_0x40256e[_0x477d('0x22')]['split'](',');_0x5981a[_0x477d('0x20')](_0x17e2c4[0x0]);_0x5981a[_0x477d('0x20')](_0x17e2c4[0x1]);_0x5981a[_0x477d('0x20')](_0x17e2c4[0x2]);_0x5981a['push'](_0x17e2c4[0x3]);_0x5981a['push'](_0x17e2c4[0x4]);_0x5981a[_0x477d('0x20')](_0x17e2c4[0x5]);_0x5981a[_0x477d('0x20')](_0x17e2c4[0x6]);_0x5981a[_0x477d('0x20')](_0x17e2c4[0x7]);_0x5981a[_0x477d('0x20')](_0x17e2c4[0x8]);_0x5981a[_0x477d('0x20')](_0x17e2c4[0x9]);_0x5981a['push'](_0x17e2c4[0xa]);_0x5981a[_0x477d('0x20')](_0x30481f['interaction']['id']);_0x5981a[_0x477d('0x20')](_0x30481f[_0x477d('0x11')]['id']);_0x5981a[_0x477d('0x20')](_0x40256e['ChatWebsiteId']);_0x5981a['push'](_0x30481f[_0x477d('0x12')][_0x477d('0x2b')]);_0x5981a[_0x477d('0x20')](_0x30481f[_0x477d('0x2c')]['body']);_0x5981a[_0x477d('0x20')](_0x2064e6);break;default:_0x5981a=_[_0x477d('0xb')](_0x40256e[_0x477d('0x22')])?[]:_0x40256e[_0x477d('0x22')][_0x477d('0x1e')](',');}var _0x533974={'id':util[_0x477d('0x2d')](_0x477d('0x2e'),_0x78d1f2,_0x40256e['id'],_0x40256e['app']),'condition':require(_0x477d('0x2f'))['condition'](_0x78d1f2,getIntervals(_0x1d5699[_0x477d('0x30')],_0x40256e),_0x1d5699),'consequence':require(_0x477d('0x31')+_0x40256e[_0x477d('0x1a')])[_0x477d('0x32')](_0x78d1f2,_0x5981a,_0x1d5699,_0x30481f),'p':_0x40256e[_0x477d('0x33')]||0x0};logger[_0x477d('0x34')](_0x477d('0x35'),_0x533974['id'],_0x477d('0x36'),getIntervals(_0x1d5699[_0x477d('0x30')],_0x40256e)['join'](_0x477d('0x37')));_0x116aa7[_0x477d('0x20')](_0x533974);}else{logger[_0x477d('0x38')](_0x477d('0x39'),path['join'](__dirname,'applications',_0x40256e[_0x477d('0x1a')]+_0x477d('0x1b')));}}_0x1d5699['rules'][_0x78d1f2]=new RuleEngine(_0x116aa7);_0x1d5699[_0x477d('0x3a')][_0x78d1f2]['execute'](_0x30481f,function(_0x51ec10){logger[_0x477d('0x34')](_0x477d('0x3b'),JSON[_0x477d('0x3c')](_0x51ec10[_0x477d('0x3d')]));if(_0x1d5699[_0x477d('0x3a')][_0x78d1f2]){_0x1d5699[_0x477d('0x3a')][_0x78d1f2]['emit'](_0x477d('0x3e'));}});return _0x25fc02({'code':0xc8,'message':_0x30481f});}else{if(_0x367965){logger[_0x477d('0x34')](util[_0x477d('0x2d')](_0x477d('0x3f'),_0x78d1f2));}else{logger[_0x477d('0x34')]('No\x20applications\x20to\x20execute');}return _0x25fc02({'code':0xc8,'message':_0x30481f});}}catch(_0x4aad41){logger[_0x477d('0x38')](_0x4aad41[_0x477d('0x40')]);return _0x5985b5(_0x234b99[_0x477d('0x38')](0x1f4,_0x4aad41));}}return _0x5985b5('routing\x20is\x20empty');});},'AcceptMessage':function(_0x45a5da){var _0xf4685b=this;return new Promise(function(_0x3154da,_0x1ad4d1){if(_0x45a5da[_0x477d('0x41')]&&_0x45a5da[_0x477d('0x41')]['id']){if(_0x1d5699[_0x477d('0x42')][_0x45a5da['agent']['id']]){_0x1d5699[_0x477d('0x42')][_0x45a5da[_0x477d('0x41')]['id']][_0x477d('0x43')]=![];_0x1d5699[_0x477d('0x42')][_0x45a5da[_0x477d('0x41')]['id']][_0x477d('0x44')]=undefined;}}if(_0x45a5da[_0x477d('0x11')]&&_0x45a5da[_0x477d('0x11')]['id']){try{var _0x113162=getId(_0x45a5da[_0x477d('0x10')],_0x45a5da[_0x477d('0x11')]?_0x45a5da[_0x477d('0x11')]['id']:0x0,_0x45a5da[_0x477d('0x12')]?_0x45a5da[_0x477d('0x12')]['id']:0x0);if(_0x1d5699[_0x477d('0x3a')][_0x113162]){_0x1d5699['rules'][_0x113162][_0x477d('0x45')](_0x477d('0x46'));if(rpc[_0x45a5da['channel']+'QueueReport']){rpc[_0x45a5da['channel']+_0x477d('0x47')][_0x477d('0x48')](_0x113162,{'UserId':_0x45a5da[_0x477d('0x11')][_0x477d('0x49')]})[_0x477d('0x4a')](function(){logger[_0x477d('0x38')](_0x477d('0x4b'));});}}return _0x3154da({'code':0xc8,'message':_0x45a5da});}catch(_0x342f18){logger['error'](_0x342f18[_0x477d('0x40')]);return _0x1ad4d1(_0xf4685b[_0x477d('0x38')](0x1f4,_0x342f18));}}logger[_0x477d('0x38')](_0x477d('0x4c'));return _0x1ad4d1(_0xf4685b[_0x477d('0x38')](0x1f4,_0x477d('0x4c')));});},'RejectMessage':function(_0x22fc49){var _0x20e6b1=this;return new Promise(function(_0x5d9114,_0x3178ed){if(_0x22fc49[_0x477d('0x41')]&&_0x22fc49[_0x477d('0x41')]['id']){try{if(_0x1d5699[_0x477d('0x42')][_0x22fc49[_0x477d('0x41')]['id']]){_0x1d5699['agents'][_0x22fc49[_0x477d('0x41')]['id']][_0x477d('0x43')]=![];_0x1d5699[_0x477d('0x42')][_0x22fc49[_0x477d('0x41')]['id']][_0x477d('0x44')]=undefined;}return _0x5d9114({'code':0xc8,'message':_0x22fc49});}catch(_0x54c044){logger['error'](_0x54c044[_0x477d('0x40')]);return _0x3178ed(_0x20e6b1[_0x477d('0x38')](0x1f4,_0x54c044));}}logger[_0x477d('0x38')](_0x477d('0x4c'));return _0x3178ed(_0x20e6b1[_0x477d('0x38')](0x1f4,_0x477d('0x4c')));});},'AbandonInteraction':function(_0x44a2b2){var _0x39b961=this;return new Promise(function(_0x5929d5,_0x53aa58){if(_0x44a2b2['channel']&&_0x44a2b2['interaction']&&_0x44a2b2['interaction']['id']){try{var _0x1e238f=getId(_0x44a2b2['channel'],_0x44a2b2[_0x477d('0x11')]?_0x44a2b2['message']['id']:0x0,_0x44a2b2[_0x477d('0x12')]?_0x44a2b2[_0x477d('0x12')]['id']:0x0);if(_0x1d5699['rules'][_0x1e238f]){_0x1d5699[_0x477d('0x3a')][_0x1e238f][_0x477d('0x45')](_0x477d('0x46'));}return _0x5929d5({'code':0xc8,'message':_0x44a2b2});}catch(_0x851020){logger[_0x477d('0x38')](_0x851020['stack']);return _0x53aa58(_0x39b961[_0x477d('0x38')](0x1f4,_0x851020));}}logger[_0x477d('0x38')]('message\x20is\x20empty');return _0x53aa58(_0x39b961[_0x477d('0x38')](0x1f4,_0x477d('0x4c')));});},'AgentCapacity':function(_0x28ff7a){var _0x207460=this;return new Promise(function(_0x1e62a7,_0x57c8cd){if(_0x1d5699['agents'][_0x477d('0x4d')](_0x28ff7a['id'])){for(var _0x43ef44 in _0x28ff7a['capacity']){if(_0x28ff7a[_0x477d('0x4e')]['hasOwnProperty'](_0x43ef44)){if(_0x1d5699['agents'][_0x28ff7a['id']][_0x477d('0x4d')](_0x43ef44+_0x477d('0x4f'))){_0x1d5699[_0x477d('0x42')][_0x28ff7a['id']][_0x43ef44+_0x477d('0x4f')]=parseInt(_0x28ff7a[_0x477d('0x4e')][_0x43ef44],0xa);}}}_0x1d5699['agents'][_0x28ff7a['id']]['updateRealtime']();return _0x1e62a7({'code':0xc8,'message':_0x1d5699[_0x477d('0x42')][_0x28ff7a['id']]});}else{return _0x57c8cd(_0x207460[_0x477d('0x38')](0x1f4,_0x477d('0x50')));}});},'Agents':function(_0x2b0b84){return new Promise(function(_0x24708b){var _0x40c681=_[_0x477d('0x51')](_0x1d5699[_0x477d('0x42')]);if(_0x2b0b84&&_0x2b0b84['id']){var _0x346f62=_['find'](_0x40c681,function(_0x50585d){return _0x50585d['id']===_0x2b0b84['id'];});_0x24708b(_0x346f62);}else{_0x24708b({'count':_0x40c681[_0x477d('0x17')],'rows':_0x40c681});}});},'ChatQueues':function(){return new Promise(function(_0x5049bd){var _0x25d7cf=[];for(var _0x245256 in _0x1d5699[_0x477d('0x52')]){if(_0x1d5699['chatQueues'][_0x477d('0x4d')](_0x245256)){var _0x27d58e=_0x1d5699['chatQueues'][_0x245256];var _0x2d1e6d={'id':_0x27d58e['id'],'available':_0x27d58e[_0x477d('0x53')],'loggedIn':_0x27d58e[_0x477d('0x54')],'name':_0x27d58e[_0x477d('0x55')],'paused':_0x27d58e[_0x477d('0x56')],'waiting':_0x27d58e[_0x477d('0x57')]};_0x25d7cf['push'](_0x2d1e6d);}}_0x5049bd({'count':_0x25d7cf[_0x477d('0x17')],'rows':_0x25d7cf});});},'MailQueues':function(){return new Promise(function(_0x36bfa3){var _0x424a22=[];for(var _0x459c91 in _0x1d5699['mailQueues']){if(_0x1d5699[_0x477d('0x58')]['hasOwnProperty'](_0x459c91)){var _0x17c564=_0x1d5699[_0x477d('0x58')][_0x459c91];var _0x48597a={'id':_0x17c564['id'],'available':_0x17c564[_0x477d('0x53')],'loggedIn':_0x17c564[_0x477d('0x54')],'name':_0x17c564[_0x477d('0x55')],'paused':_0x17c564['paused'],'waiting':_0x17c564['waiting']};_0x424a22[_0x477d('0x20')](_0x48597a);}}_0x36bfa3({'count':_0x424a22[_0x477d('0x17')],'rows':_0x424a22});});},'OpenchannelQueues':function(){return new Promise(function(_0x439486){var _0x399e0d=[];for(var _0x57be6f in _0x1d5699[_0x477d('0x59')]){if(_0x1d5699[_0x477d('0x59')]['hasOwnProperty'](_0x57be6f)){var _0x38e06f=_0x1d5699[_0x477d('0x59')][_0x57be6f];var _0x1231e2={'id':_0x38e06f['id'],'available':_0x38e06f['available'],'loggedIn':_0x38e06f[_0x477d('0x54')],'name':_0x38e06f[_0x477d('0x55')],'paused':_0x38e06f[_0x477d('0x56')],'waiting':_0x38e06f['waiting']};_0x399e0d[_0x477d('0x20')](_0x1231e2);}}_0x439486({'count':_0x399e0d[_0x477d('0x17')],'rows':_0x399e0d});});},'SmsQueues':function(){return new Promise(function(_0x290e77){var _0xd3404b=[];for(var _0x104dec in _0x1d5699[_0x477d('0x5a')]){if(_0x1d5699[_0x477d('0x5a')][_0x477d('0x4d')](_0x104dec)){var _0x456891=_0x1d5699['smsQueues'][_0x104dec];var _0x4f0586={'id':_0x456891['id'],'available':_0x456891[_0x477d('0x53')],'loggedIn':_0x456891['loggedIn'],'name':_0x456891[_0x477d('0x55')],'paused':_0x456891['paused'],'waiting':_0x456891[_0x477d('0x57')]};_0xd3404b['push'](_0x4f0586);}}_0x290e77({'count':_0xd3404b[_0x477d('0x17')],'rows':_0xd3404b});});},'FaxQueues':function(){return new Promise(function(_0x2852d5){var _0x43a6b9=[];for(var _0x239a3d in _0x1d5699['faxQueues']){if(_0x1d5699['faxQueues']['hasOwnProperty'](_0x239a3d)){var _0x54924b=_0x1d5699['faxQueues'][_0x239a3d];var _0x1db0ca={'id':_0x54924b['id'],'available':_0x54924b[_0x477d('0x53')],'loggedIn':_0x54924b[_0x477d('0x54')],'name':_0x54924b[_0x477d('0x55')],'paused':_0x54924b[_0x477d('0x56')],'waiting':_0x54924b[_0x477d('0x57')]};_0x43a6b9['push'](_0x1db0ca);}}_0x2852d5({'count':_0x43a6b9[_0x477d('0x17')],'rows':_0x43a6b9});});},'WhatsappQueues':function(){return new Promise(function(_0x531a59){var _0x579533=[];for(var _0x26af90 in _0x1d5699[_0x477d('0x5b')]){if(_0x1d5699[_0x477d('0x5b')][_0x477d('0x4d')](_0x26af90)){var _0x7c4e17=_0x1d5699[_0x477d('0x5b')][_0x26af90];var _0x5ce2a1={'id':_0x7c4e17['id'],'available':_0x7c4e17['available'],'loggedIn':_0x7c4e17[_0x477d('0x54')],'name':_0x7c4e17[_0x477d('0x55')],'paused':_0x7c4e17[_0x477d('0x56')],'waiting':_0x7c4e17['waiting']};_0x579533['push'](_0x5ce2a1);}}_0x531a59({'count':_0x579533[_0x477d('0x17')],'rows':_0x579533});});},'ChatQueuesWaitingInteractions':function(){return new Promise(function(_0x39aed2){var _0x4e15f9=_[_0x477d('0x51')](_0x1d5699[_0x477d('0x5c')]);_0x39aed2({'count':_0x4e15f9[_0x477d('0x17')],'rows':_0x4e15f9});});},'MailQueuesWaitingInteractions':function(){return new Promise(function(_0x1345da){var _0x257f54=_[_0x477d('0x51')](_0x1d5699['mailQueuesWaitingInteractions']);_0x1345da({'count':_0x257f54[_0x477d('0x17')],'rows':_0x257f54});});},'OpenchannelQueuesWaitingInteractions':function(){return new Promise(function(_0x22794e){var _0x524c5c=_[_0x477d('0x51')](_0x1d5699[_0x477d('0x5d')]);_0x22794e({'count':_0x524c5c[_0x477d('0x17')],'rows':_0x524c5c});});},'SmsQueuesWaitingInteractions':function(){return new Promise(function(_0x6229a0){var _0x171f25=_['values'](_0x1d5699[_0x477d('0x5e')]);_0x6229a0({'count':_0x171f25['length'],'rows':_0x171f25});});},'FaxQueuesWaitingInteractions':function(){return new Promise(function(_0x3e1cc9){var _0x210f63=_['values'](_0x1d5699[_0x477d('0x5f')]);_0x3e1cc9({'count':_0x210f63[_0x477d('0x17')],'rows':_0x210f63});});},'WhatsappQueuesWaitingInteractions':function(){return new Promise(function(_0x4a1d9f){var _0x35b831=_[_0x477d('0x51')](_0x1d5699['whatsappQueuesWaitingInteractions']);_0x4a1d9f({'count':_0x35b831[_0x477d('0x17')],'rows':_0x35b831});});}};var _0x3a1fe9=jayson[_0x477d('0x60')](_0x4bbfef)[_0x477d('0x61')]();_0x3a1fe9['on'](_0x477d('0x38'),function(_0x231db4){logger[_0x477d('0x38')](JSON[_0x477d('0x3c')](_0x231db4));return _0x38a0a8(_0x231db4);});_0x3a1fe9[_0x477d('0xf')](0x232c,_0x477d('0x62'),function(){console[_0x477d('0x63')](_0x477d('0x64'),0x232c);return _0x4b2021(_0x477d('0x65')+0x232c);});});}; \ No newline at end of file diff --git a/server/services/routing/server/interval.js b/server/services/routing/server/interval.js index a8a802b..a725181 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 _0xb3ea=['lodash','routing','http','request','error','message','result','rules','info','[%s][INTERVAL]\x20ROUTING\x20STOPPED','stop','length','push','Command','then','indexOf','true','catch','all','some','[%s][INTERVAL]\x20%s\x20%s','join','\x20|\x20','stack','jayson/promise'];(function(_0x59a90b,_0x4484eb){var _0x2fb42e=function(_0x2cdaef){while(--_0x2cdaef){_0x59a90b['push'](_0x59a90b['shift']());}};_0x2fb42e(++_0x4484eb);}(_0xb3ea,0x112));var _0xab3e=function(_0x17fb19,_0x3a0363){_0x17fb19=_0x17fb19-0x0;var _0x16f813=_0xb3ea[_0x17fb19];return _0x16f813;};'use strict';var util=require('util');var BPromise=require('bluebird');var jayson=require(_0xab3e('0x0'));var _=require(_0xab3e('0x1'));var logger=require('../../../config/logger')(_0xab3e('0x2'));var client=jayson['client'][_0xab3e('0x3')]({'port':0x232a});function request(_0x184be2,_0x4da1ad){return new BPromise(function(_0x3521da,_0x30dee5){return client[_0xab3e('0x4')](_0x184be2,_0x4da1ad)['then'](function(_0x535824){if(_0x535824[_0xab3e('0x5')]){return _0x30dee5(_0x535824['error'][_0xab3e('0x6')]);}else{return _0x3521da(_0x535824[_0xab3e('0x7')]);}})['catch'](function(_0x3dc542){return _0x30dee5(_0x3dc542);});});}exports['condition']=function(_0x49ee0f,_0x1aeeba,_0x29423f){return function(_0x5cf897){if(_0x29423f['rules']&&!_0x29423f[_0xab3e('0x8')][_0x49ee0f]){logger[_0xab3e('0x9')](_0xab3e('0xa'),_0x49ee0f);return _0x5cf897[_0xab3e('0xb')]();}var _0x2526cb=[];for(var _0x296b27=0x0;_0x296b27<_0x1aeeba[_0xab3e('0xc')];_0x296b27+=0x1){_0x2526cb[_0xab3e('0xd')](request(_0xab3e('0xe'),{'command':util['format']('iftime\x20%s',_0x1aeeba[_0x296b27])})[_0xab3e('0xf')](function(_0x2950da){return _0x2950da&&_0x2950da[_0xab3e('0x6')]&&_0x2950da[_0xab3e('0x6')][_0xab3e('0x10')](_0xab3e('0x11'))>=0x0?!![]:![];})[_0xab3e('0x12')](function(){logger[_0xab3e('0x5')]('[%s][INTERVAL]\x20%s',_0x49ee0f,_0x1aeeba[_0x296b27]);}));}BPromise[_0xab3e('0x13')](_0x2526cb)[_0xab3e('0xf')](function(_0xb75c8c){var _0x11930d=_[_0xab3e('0x14')](_0xb75c8c);logger[_0xab3e('0x9')](_0xab3e('0x15'),_0x49ee0f,_0x1aeeba[_0xab3e('0x16')]('\x20|\x20'),_0x11930d);_0x5cf897['when'](_0x11930d);})[_0xab3e('0x12')](function(_0x57b98b){logger['error'](_0xab3e('0x15'),_0x49ee0f,_0x1aeeba['join'](_0xab3e('0x17')),_0x57b98b[_0xab3e('0x18')]);_0x5cf897[_0xab3e('0xb')]();});};}; \ No newline at end of file +var _0x43bb=['push','Command','format','iftime\x20%s','true','[%s][INTERVAL]\x20%s','all','some','[%s][INTERVAL]\x20%s\x20%s','join','\x20|\x20','when','stack','util','bluebird','jayson/promise','lodash','routing','client','http','request','then','error','message','result','catch','condition','rules','info','[%s][INTERVAL]\x20ROUTING\x20STOPPED','stop','length'];(function(_0xe5d07c,_0x1b256a){var _0x4ad3ac=function(_0x4f4b6a){while(--_0x4f4b6a){_0xe5d07c['push'](_0xe5d07c['shift']());}};_0x4ad3ac(++_0x1b256a);}(_0x43bb,0x1ed));var _0xb43b=function(_0x4381af,_0x2603e7){_0x4381af=_0x4381af-0x0;var _0x8d289=_0x43bb[_0x4381af];return _0x8d289;};'use strict';var util=require(_0xb43b('0x0'));var BPromise=require(_0xb43b('0x1'));var jayson=require(_0xb43b('0x2'));var _=require(_0xb43b('0x3'));var logger=require('../../../config/logger')(_0xb43b('0x4'));var client=jayson[_0xb43b('0x5')][_0xb43b('0x6')]({'port':0x232a});function request(_0x580199,_0x4d707d){return new BPromise(function(_0x1a70be,_0xb0d81){return client[_0xb43b('0x7')](_0x580199,_0x4d707d)[_0xb43b('0x8')](function(_0x24a4de){if(_0x24a4de[_0xb43b('0x9')]){return _0xb0d81(_0x24a4de['error'][_0xb43b('0xa')]);}else{return _0x1a70be(_0x24a4de[_0xb43b('0xb')]);}})[_0xb43b('0xc')](function(_0x15dfdd){return _0xb0d81(_0x15dfdd);});});}exports[_0xb43b('0xd')]=function(_0x23dabf,_0x2cd2e4,_0x5e4cbe){return function(_0x1f5c8d){if(_0x5e4cbe[_0xb43b('0xe')]&&!_0x5e4cbe[_0xb43b('0xe')][_0x23dabf]){logger[_0xb43b('0xf')](_0xb43b('0x10'),_0x23dabf);return _0x1f5c8d[_0xb43b('0x11')]();}var _0x150090=[];for(var _0x33f01a=0x0;_0x33f01a<_0x2cd2e4[_0xb43b('0x12')];_0x33f01a+=0x1){_0x150090[_0xb43b('0x13')](request(_0xb43b('0x14'),{'command':util[_0xb43b('0x15')](_0xb43b('0x16'),_0x2cd2e4[_0x33f01a])})[_0xb43b('0x8')](function(_0x139a80){return _0x139a80&&_0x139a80[_0xb43b('0xa')]&&_0x139a80[_0xb43b('0xa')]['indexOf'](_0xb43b('0x17'))>=0x0?!![]:![];})[_0xb43b('0xc')](function(){logger[_0xb43b('0x9')](_0xb43b('0x18'),_0x23dabf,_0x2cd2e4[_0x33f01a]);}));}BPromise[_0xb43b('0x19')](_0x150090)[_0xb43b('0x8')](function(_0x2af8f9){var _0x3c56a1=_[_0xb43b('0x1a')](_0x2af8f9);logger[_0xb43b('0xf')](_0xb43b('0x1b'),_0x23dabf,_0x2cd2e4[_0xb43b('0x1c')](_0xb43b('0x1d')),_0x3c56a1);_0x1f5c8d[_0xb43b('0x1e')](_0x3c56a1);})[_0xb43b('0xc')](function(_0x3bb1f1){logger[_0xb43b('0x9')](_0xb43b('0x1b'),_0x23dabf,_0x2cd2e4[_0xb43b('0x1c')](_0xb43b('0x1d')),_0x3bb1f1[_0xb43b('0x1f')]);_0x1f5c8d[_0xb43b('0x11')]();});};}; \ No newline at end of file diff --git a/server/services/xdr/agents.controller.js b/server/services/xdr/agents.controller.js index c9eed73..884fdcb 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 _0x44a3=['agentacw','request','CreateVoiceAgentReport','agentcalled','debug','[%s][agents][agentcalled]','uniqueid','destuniqueid','agentcalledAt','now','connectedlinenum','connectedlinename','[%s][agents][agentcalled]\x20agent:%s\x20destuniqueid:%s\x20lastevent:called','error','agentringnoanswer','[%s][agents][agentringnoanswer]','[%s][agents][agentringnoanswer]\x20agent:%s\x20destuniqueid:%s\x20lastevent:timeout','agentringnoanswerAt','timeout','reason','holdtime','ringtime','talktime','push','forIn','[%s][agents][queuecallerabandon]\x20agent:%s\x20destuniqueid:%s\x20lastevent:abandoned','abandoned','[%s][agents][queuecallerabandon]','[%s][agents][agentconnect]','[%s][agents][agentconnect]\x20agent:%s\x20destuniqueid:%s\x20lastevent:connect','agentconnectAt','connect','lastevent','answered_elsewhere','answeredelsewheredestinationuniqueid','isNil','[%s][agents][agentcomplete]','[%s][agents][agentcomplete]\x20agent:%s\x20destuniqueid:%s\x20lastevent:complete','diffTime','agentcompleteAt','complete','blindtransfer','[%s][agents][blindtransfer]\x20agent:%s\x20transferuniqueid:%s','transfereruniqueid','transfer','transfertype','blind','transferexten','extension','attendedtransfer','[%s][agents][attendedtransfer]','origtransfereruniqueid','origtransfererlinkedid','secondtransfereruniqueid','[%s][agents][attendedtransfer]\x20agent:%s','ATTENDED','origtransfererexten','transferuniqueid','transfereeuniqueid','agententerreason','secondtransfererlinkedid','secondtransfererexten','transfertargetuniqueid','clone','calleridname','hangup','cause','rejected','[%s][agents][hangup]\x20agent:%s\x20reason:%s\x20lastevent:%s','indexOf','splice','agent','[%s][agents][hangup]','lodash','util','./utils','info','format','[%s][agents][writeDB]\x20channel:%s\x20queue:%s\x20agent:%s\x20interface:%s\x20calleridnum:%s\x20connectedlinenum:%s\x20lastevent:%s','channel','queue','membername','interface','calleridnum','then','type','agentcomplete','acw'];(function(_0x5989c6,_0x53e957){var _0x5c1fe3=function(_0x3e2eef){while(--_0x3e2eef){_0x5989c6['push'](_0x5989c6['shift']());}};_0x5c1fe3(++_0x53e957);}(_0x44a3,0x1a9));var _0x344a=function(_0x102b0c,_0x33dee4){_0x102b0c=_0x102b0c-0x0;var _0x9b15ca=_0x44a3[_0x102b0c];return _0x9b15ca;};'use strict';var _=require(_0x344a('0x0'));var util=require(_0x344a('0x1'));var utils=require(_0x344a('0x2'));var agents={};var transfers={};var unanswered=[];function writeDB(_0x23cef2,_0xdffe0b){utils[_0x344a('0x3')](util[_0x344a('0x4')](_0x344a('0x5'),_0x23cef2['uniqueid'],_0x23cef2[_0x344a('0x6')],_0x23cef2[_0x344a('0x7')],_0x23cef2[_0x344a('0x8')],_0x23cef2[_0x344a('0x9')],_0x23cef2[_0x344a('0xa')],_0x23cef2['connectedlinenum'],_0x23cef2['lastevent']));if(_0x23cef2['queue']){utils['getVoiceQueueByName'](_0x23cef2[_0x344a('0x7')])[_0x344a('0xb')](function(_0x3c725e){if(_0x3c725e){_0x23cef2[_0x344a('0xc')]=_0x3c725e[_0x344a('0xc')];_0x23cef2['agentacw']=_0x23cef2[_0x344a('0xd')]?_0x3c725e[_0x344a('0xe')]:![];_0x23cef2['acwtime']=_0x23cef2[_0x344a('0xf')]?_0x3c725e['acwTimeout']:0x0;}utils[_0x344a('0x10')]('CreateVoiceAgentReport',_0x23cef2);});}else{utils[_0x344a('0x10')](_0x344a('0x11'),_0x23cef2);}if(_0xdffe0b){delete transfers[_0x23cef2['uniqueid']];}else{delete agents[_0x23cef2['destuniqueid']];}}exports[_0x344a('0x12')]=function(_0x2ad7eb){try{utils[_0x344a('0x13')](util[_0x344a('0x4')](_0x344a('0x14'),_0x2ad7eb[_0x344a('0x15')]),_0x2ad7eb);agents[_0x2ad7eb['destuniqueid']]=_0x2ad7eb;agents[_0x2ad7eb[_0x344a('0x16')]][_0x344a('0x17')]=utils[_0x344a('0x18')]();agents[_0x2ad7eb[_0x344a('0x16')]]['lastevent']='called';agents[_0x2ad7eb[_0x344a('0x16')]][_0x344a('0x19')]=null;agents[_0x2ad7eb[_0x344a('0x16')]][_0x344a('0x1a')]=null;utils['info'](util[_0x344a('0x4')](_0x344a('0x1b'),_0x2ad7eb['uniqueid'],agents[_0x2ad7eb[_0x344a('0x16')]][_0x344a('0x8')],_0x2ad7eb[_0x344a('0x16')]));}catch(_0x45a827){utils[_0x344a('0x1c')](util[_0x344a('0x4')](_0x344a('0x14'),_0x2ad7eb[_0x344a('0x15')]),_0x45a827);}};exports[_0x344a('0x1d')]=function(_0x450922){try{if(!_['isNil'](agents[_0x450922[_0x344a('0x16')]])){utils[_0x344a('0x13')](util[_0x344a('0x4')](_0x344a('0x1e'),_0x450922[_0x344a('0x15')]),_0x450922);utils[_0x344a('0x3')](util[_0x344a('0x4')](_0x344a('0x1f'),_0x450922[_0x344a('0x15')],agents[_0x450922[_0x344a('0x16')]][_0x344a('0x8')],_0x450922[_0x344a('0x16')]));agents[_0x450922[_0x344a('0x16')]][_0x344a('0x1d')]=!![];agents[_0x450922['destuniqueid']][_0x344a('0x20')]=utils['now']();agents[_0x450922[_0x344a('0x16')]]['lastevent']=_0x344a('0x21');agents[_0x450922[_0x344a('0x16')]][_0x344a('0x22')]=_0x344a('0x21');agents[_0x450922[_0x344a('0x16')]][_0x344a('0x23')]=_0x450922[_0x344a('0x24')]?parseInt(_0x450922[_0x344a('0x24')])/0x3e8:0x0;agents[_0x450922['destuniqueid']][_0x344a('0x25')]=0x0;unanswered[_0x344a('0x26')](_0x450922[_0x344a('0x16')]);}}catch(_0xc02d6){utils[_0x344a('0x1c')](util[_0x344a('0x4')]('[%s][agents][agentringnoanswer]',_0x450922[_0x344a('0x15')]),_0xc02d6);}};exports['queuecallerabandon']=function(_0x593cf6){try{_[_0x344a('0x27')](agents,function(_0x14fa86,_0x5a36bb){if(_0x14fa86['uniqueid']==_0x593cf6['uniqueid']&&!_['includes'](unanswered,_0x14fa86[_0x344a('0x16')])){utils[_0x344a('0x13')](util[_0x344a('0x4')]('[%s][agents][queuecallerabandon]',_0x593cf6[_0x344a('0x15')]),_0x593cf6);utils[_0x344a('0x3')](util[_0x344a('0x4')](_0x344a('0x28'),_0x593cf6[_0x344a('0x15')],_0x14fa86[_0x344a('0x8')],_0x14fa86[_0x344a('0x16')]));_0x14fa86['agentringnoanswer']=!![];_0x14fa86[_0x344a('0x20')]=utils['now']();_0x14fa86['lastevent']='abandoned';_0x14fa86[_0x344a('0x22')]=_0x344a('0x29');_0x14fa86[_0x344a('0x23')]=_0x593cf6[_0x344a('0x23')];_0x14fa86[_0x344a('0x25')]=0x0;writeDB(_0x14fa86);}});}catch(_0xdf6a8f){utils['error'](util[_0x344a('0x4')](_0x344a('0x2a'),_0x593cf6[_0x344a('0x15')]),_0xdf6a8f);}};exports['agentconnect']=function(_0x3698eb){try{if(agents[_0x3698eb[_0x344a('0x16')]]){utils[_0x344a('0x13')](util[_0x344a('0x4')](_0x344a('0x2b'),_0x3698eb['uniqueid']),_0x3698eb);utils[_0x344a('0x3')](util[_0x344a('0x4')](_0x344a('0x2c'),_0x3698eb[_0x344a('0x15')],agents[_0x3698eb[_0x344a('0x16')]]['membername'],_0x3698eb[_0x344a('0x16')]));agents[_0x3698eb[_0x344a('0x16')]][_0x344a('0x2d')]=utils[_0x344a('0x18')]();agents[_0x3698eb[_0x344a('0x16')]]['connectedlinenum']=_0x3698eb[_0x344a('0x19')];agents[_0x3698eb[_0x344a('0x16')]][_0x344a('0x1a')]=_0x3698eb[_0x344a('0x1a')];agents[_0x3698eb[_0x344a('0x16')]][_0x344a('0x23')]=_0x3698eb[_0x344a('0x24')];agents[_0x3698eb[_0x344a('0x16')]]['lastevent']=_0x344a('0x2e');_[_0x344a('0x27')](agents,function(_0x3d34c3,_0x28bad9){if(_0x3d34c3[_0x344a('0x16')]!=_0x3698eb['destuniqueid']&&_0x3d34c3[_0x344a('0x15')]==_0x3698eb[_0x344a('0x15')]){_0x3d34c3[_0x344a('0x25')]=0x0;_0x3d34c3[_0x344a('0x23')]=_0x3698eb[_0x344a('0x24')];_0x3d34c3[_0x344a('0x1d')]=!![];_0x3d34c3[_0x344a('0x20')]=utils[_0x344a('0x18')]();_0x3d34c3[_0x344a('0x2f')]='answered_elsewhere';_0x3d34c3[_0x344a('0x22')]=_0x344a('0x30');_0x3d34c3[_0x344a('0x31')]=_0x3698eb[_0x344a('0x16')];_0x3d34c3['answeredelsewheremembername']=_0x3698eb[_0x344a('0x8')];writeDB(_0x3d34c3);}});}}catch(_0x3069ca){utils[_0x344a('0x1c')](util[_0x344a('0x4')](_0x344a('0x2b'),_0x3698eb[_0x344a('0x15')]),_0x3069ca);}};exports[_0x344a('0xd')]=function(_0x372e7d){try{if(!_[_0x344a('0x32')](agents[_0x372e7d[_0x344a('0x16')]])){utils[_0x344a('0x13')](util['format'](_0x344a('0x33'),_0x372e7d[_0x344a('0x15')]),_0x372e7d);utils['info'](util[_0x344a('0x4')](_0x344a('0x34'),_0x372e7d['uniqueid'],agents[_0x372e7d[_0x344a('0x16')]][_0x344a('0x8')],_0x372e7d['destuniqueid']));agents[_0x372e7d[_0x344a('0x16')]][_0x344a('0xd')]=!![];agents[_0x372e7d[_0x344a('0x16')]]['agentcompleteAt']=utils[_0x344a('0x18')]();agents[_0x372e7d['destuniqueid']][_0x344a('0x25')]=utils[_0x344a('0x35')](agents[_0x372e7d[_0x344a('0x16')]][_0x344a('0x36')],agents[_0x372e7d['destuniqueid']]['agentconnectAt']);agents[_0x372e7d[_0x344a('0x16')]][_0x344a('0x22')]=_0x372e7d[_0x344a('0x22')];agents[_0x372e7d[_0x344a('0x16')]][_0x344a('0x2f')]=_0x344a('0x37');writeDB(agents[_0x372e7d[_0x344a('0x16')]]);}}catch(_0x23c214){utils[_0x344a('0x1c')](util[_0x344a('0x4')]('[%s][agents][agentcomplete]',_0x372e7d[_0x344a('0x15')]),_0x23c214);}};exports[_0x344a('0x38')]=function(_0x6fad37){try{if(!_[_0x344a('0x32')](agents[_0x6fad37['transfereruniqueid']])){utils[_0x344a('0x13')](util['format']('[%s][agents][blindtransfer]',_0x6fad37[_0x344a('0x15')]),_0x6fad37);utils[_0x344a('0x3')](util['format'](_0x344a('0x39'),_0x6fad37[_0x344a('0x15')],agents[_0x6fad37[_0x344a('0x3a')]][_0x344a('0x8')],agents[_0x6fad37['transfereruniqueid']][_0x344a('0x15')]));agents[_0x6fad37[_0x344a('0x3a')]][_0x344a('0x3b')]=!![];agents[_0x6fad37[_0x344a('0x3a')]][_0x344a('0x3c')]=_0x344a('0x3d');agents[_0x6fad37[_0x344a('0x3a')]][_0x344a('0x3e')]=_0x6fad37[_0x344a('0x3f')];agents[_0x6fad37[_0x344a('0x3a')]]['transferuniqueid']=agents[_0x6fad37[_0x344a('0x3a')]]['uniqueid'];}}catch(_0x1b7f6c){utils[_0x344a('0x1c')](util[_0x344a('0x4')]('[%s][agents][blindtransfer]',_0x6fad37[_0x344a('0x15')]),_0x1b7f6c);}};exports[_0x344a('0x40')]=function(_0x188c6b){try{utils[_0x344a('0x13')](util[_0x344a('0x4')](_0x344a('0x41'),_0x188c6b[_0x344a('0x42')]),_0x188c6b);if(_0x188c6b[_0x344a('0x42')]==_0x188c6b[_0x344a('0x43')]){if(!_['isNil'](agents[_0x188c6b[_0x344a('0x44')]])){utils[_0x344a('0x3')](util[_0x344a('0x4')](_0x344a('0x45'),_0x188c6b[_0x344a('0x42')],agents[_0x188c6b['secondtransfereruniqueid']][_0x344a('0x8')]));agents[_0x188c6b[_0x344a('0x44')]][_0x344a('0x3b')]=!![];agents[_0x188c6b[_0x344a('0x44')]]['transfertype']=_0x344a('0x46');agents[_0x188c6b[_0x344a('0x44')]]['transferexten']=_0x188c6b[_0x344a('0x47')];agents[_0x188c6b[_0x344a('0x44')]][_0x344a('0x48')]=_0x188c6b[_0x344a('0x42')];}if(_0x188c6b[_0x344a('0x49')]&&agents[_0x188c6b[_0x344a('0x49')]]){agents[_0x188c6b[_0x344a('0x49')]]['agententerreason']=0x1;transfers[_0x188c6b['transfereeuniqueid']]=_['clone'](agents[_0x188c6b[_0x344a('0x49')]]);transfers[_0x188c6b[_0x344a('0x49')]][_0x344a('0xa')]=agents[_0x188c6b[_0x344a('0x44')]]['calleridnum'];transfers[_0x188c6b[_0x344a('0x49')]]['calleridname']=agents[_0x188c6b['secondtransfereruniqueid']]['calleridname'];transfers[_0x188c6b['transfereeuniqueid']][_0x344a('0x17')]=utils[_0x344a('0x18')]();transfers[_0x188c6b[_0x344a('0x49')]][_0x344a('0x2d')]=utils['now']();transfers[_0x188c6b['transfereeuniqueid']]['holdtime']=0x0;transfers[_0x188c6b[_0x344a('0x49')]][_0x344a('0x4a')]=0x2;}}else if(_0x188c6b[_0x344a('0x44')]==_0x188c6b[_0x344a('0x4b')]){if(!_[_0x344a('0x32')](agents[_0x188c6b['origtransfereruniqueid']])){utils[_0x344a('0x3')](util[_0x344a('0x4')](_0x344a('0x45'),_0x188c6b['origtransfereruniqueid'],agents[_0x188c6b[_0x344a('0x42')]]['membername']));agents[_0x188c6b['origtransfereruniqueid']][_0x344a('0x3b')]=!![];agents[_0x188c6b['origtransfereruniqueid']]['transfertype']=_0x344a('0x46');agents[_0x188c6b[_0x344a('0x42')]]['transferexten']=_0x188c6b[_0x344a('0x4c')];agents[_0x188c6b['origtransfereruniqueid']][_0x344a('0x48')]=_0x188c6b[_0x344a('0x44')];}if(_0x188c6b[_0x344a('0x4d')]&&agents[_0x188c6b['transfertargetuniqueid']]){agents[_0x188c6b['transfertargetuniqueid']][_0x344a('0x4a')]=0x1;transfers[_0x188c6b[_0x344a('0x4d')]]=_[_0x344a('0x4e')](agents[_0x188c6b[_0x344a('0x4d')]]);transfers[_0x188c6b['transfertargetuniqueid']]['calleridnum']=agents[_0x188c6b[_0x344a('0x42')]][_0x344a('0xa')];transfers[_0x188c6b[_0x344a('0x4d')]]['calleridname']=agents[_0x188c6b[_0x344a('0x42')]][_0x344a('0x4f')];transfers[_0x188c6b['transfertargetuniqueid']][_0x344a('0x17')]=utils['now']();transfers[_0x188c6b[_0x344a('0x4d')]]['agentconnectAt']=utils['now']();transfers[_0x188c6b['transfertargetuniqueid']][_0x344a('0x23')]=0x0;transfers[_0x188c6b[_0x344a('0x4d')]][_0x344a('0x4a')]=0x2;}}}catch(_0xce0446){utils[_0x344a('0x1c')](util[_0x344a('0x4')]('[%s][agents][attendedtransfer]',_0x188c6b[_0x344a('0x42')]),_0xce0446);}};exports[_0x344a('0x50')]=function(_0x20a892){try{utils[_0x344a('0x13')](util[_0x344a('0x4')]('[%s][agents][hangup]',_0x20a892[_0x344a('0x15')]),_0x20a892);if(agents[_0x20a892[_0x344a('0x15')]]&&agents[_0x20a892['uniqueid']][_0x344a('0x22')]===_0x344a('0x21')){if(_0x20a892[_0x344a('0x51')]==='21'){agents[_0x20a892[_0x344a('0x15')]]['reason']=_0x344a('0x52');agents[_0x20a892[_0x344a('0x15')]][_0x344a('0x2f')]=_0x344a('0x52');}utils[_0x344a('0x3')](util[_0x344a('0x4')](_0x344a('0x53'),_0x20a892[_0x344a('0x15')],agents[_0x20a892['uniqueid']][_0x344a('0x8')],agents[_0x20a892[_0x344a('0x15')]][_0x344a('0x22')],agents[_0x20a892[_0x344a('0x15')]][_0x344a('0x2f')]));writeDB(agents[_0x20a892[_0x344a('0x15')]]);var _0x212b08=unanswered[_0x344a('0x54')](_0x20a892['uniqueid']);if(_0x212b08>-0x1){unanswered[_0x344a('0x55')](_0x212b08,0x1);}}if(transfers[_0x20a892[_0x344a('0x15')]]){transfers[_0x20a892[_0x344a('0x15')]][_0x344a('0xd')]=!![];transfers[_0x20a892['uniqueid']][_0x344a('0x36')]=utils[_0x344a('0x18')]();transfers[_0x20a892[_0x344a('0x15')]][_0x344a('0x25')]=utils[_0x344a('0x35')](transfers[_0x20a892[_0x344a('0x15')]][_0x344a('0x36')],transfers[_0x20a892[_0x344a('0x15')]]['agentconnectAt']);transfers[_0x20a892[_0x344a('0x15')]][_0x344a('0x22')]=_0x344a('0x56');transfers[_0x20a892[_0x344a('0x15')]]['lastevent']=_0x344a('0x37');utils[_0x344a('0x3')](util[_0x344a('0x4')](_0x344a('0x53'),_0x20a892[_0x344a('0x15')],transfers[_0x20a892[_0x344a('0x15')]]['membername'],transfers[_0x20a892[_0x344a('0x15')]][_0x344a('0x22')],transfers[_0x20a892[_0x344a('0x15')]]['lastevent']));writeDB(transfers[_0x20a892[_0x344a('0x15')]],!![]);}if(agents[_0x20a892[_0x344a('0x15')]]&&agents[_0x20a892[_0x344a('0x15')]][_0x344a('0x2d')]){agents[_0x20a892[_0x344a('0x15')]]['agentcomplete']=!![];agents[_0x20a892[_0x344a('0x15')]][_0x344a('0x36')]=utils[_0x344a('0x18')]();agents[_0x20a892['uniqueid']][_0x344a('0x25')]=utils['diffTime'](agents[_0x20a892['uniqueid']][_0x344a('0x36')],agents[_0x20a892[_0x344a('0x15')]][_0x344a('0x2d')]);agents[_0x20a892[_0x344a('0x15')]][_0x344a('0x22')]=agents[_0x20a892[_0x344a('0x15')]][_0x344a('0x3b')]?_0x344a('0x3b'):'agent';agents[_0x20a892[_0x344a('0x15')]][_0x344a('0x2f')]='complete';utils['info'](util[_0x344a('0x4')](_0x344a('0x53'),_0x20a892[_0x344a('0x15')],agents[_0x20a892[_0x344a('0x15')]]['membername'],agents[_0x20a892[_0x344a('0x15')]][_0x344a('0x22')],agents[_0x20a892[_0x344a('0x15')]]['lastevent']));writeDB(agents[_0x20a892[_0x344a('0x15')]]);}}catch(_0x1c50c3){utils[_0x344a('0x1c')](util['format'](_0x344a('0x57'),_0x20a892[_0x344a('0x15')]),_0x1c50c3);}}; \ No newline at end of file +var _0xcb91=['blind','transferexten','extension','transferuniqueid','[%s][agents][attendedtransfer]','origtransfereruniqueid','secondtransfereruniqueid','[%s][agents][attendedtransfer]\x20agent:%s','transfer','ATTENDED','transfereeuniqueid','clone','calleridname','agententerreason','secondtransfererlinkedid','secondtransfererexten','transfertargetuniqueid','hangup','cause','rejected','[%s][agents][hangup]\x20agent:%s\x20reason:%s\x20lastevent:%s','indexOf','splice','agent','[%s][agents][hangup]','./utils','info','[%s][agents][writeDB]\x20channel:%s\x20queue:%s\x20agent:%s\x20interface:%s\x20calleridnum:%s\x20connectedlinenum:%s\x20lastevent:%s','uniqueid','queue','membername','calleridnum','connectedlinenum','getVoiceQueueByName','then','type','agentacw','agentcomplete','acw','acwtime','acwTimeout','request','CreateVoiceAgentReport','debug','format','[%s][agents][agentcalled]','destuniqueid','agentcalledAt','now','connectedlinename','[%s][agents][agentcalled]\x20agent:%s\x20destuniqueid:%s\x20lastevent:called','error','isNil','[%s][agents][agentringnoanswer]\x20agent:%s\x20destuniqueid:%s\x20lastevent:timeout','agentringnoanswer','agentringnoanswerAt','lastevent','timeout','reason','holdtime','ringtime','talktime','push','[%s][agents][queuecallerabandon]','abandoned','agentconnect','[%s][agents][agentconnect]','[%s][agents][agentconnect]\x20agent:%s\x20destuniqueid:%s\x20lastevent:connect','agentconnectAt','answered_elsewhere','answeredelsewheredestinationuniqueid','answeredelsewheremembername','[%s][agents][agentcomplete]','agentcompleteAt','diffTime','complete','blindtransfer','transfereruniqueid','[%s][agents][blindtransfer]\x20agent:%s\x20transferuniqueid:%s','transfertype'];(function(_0x188379,_0x7fa345){var _0x3d8a8f=function(_0x1dee72){while(--_0x1dee72){_0x188379['push'](_0x188379['shift']());}};_0x3d8a8f(++_0x7fa345);}(_0xcb91,0x1a9));var _0x1cb9=function(_0x4bc4c8,_0x3139d3){_0x4bc4c8=_0x4bc4c8-0x0;var _0x3bb121=_0xcb91[_0x4bc4c8];return _0x3bb121;};'use strict';var _=require('lodash');var util=require('util');var utils=require(_0x1cb9('0x0'));var agents={};var transfers={};var unanswered=[];function writeDB(_0xe4a5bf,_0x17d4ec){utils[_0x1cb9('0x1')](util['format'](_0x1cb9('0x2'),_0xe4a5bf[_0x1cb9('0x3')],_0xe4a5bf['channel'],_0xe4a5bf[_0x1cb9('0x4')],_0xe4a5bf[_0x1cb9('0x5')],_0xe4a5bf['interface'],_0xe4a5bf[_0x1cb9('0x6')],_0xe4a5bf[_0x1cb9('0x7')],_0xe4a5bf['lastevent']));if(_0xe4a5bf[_0x1cb9('0x4')]){utils[_0x1cb9('0x8')](_0xe4a5bf['queue'])[_0x1cb9('0x9')](function(_0x5a0e99){if(_0x5a0e99){_0xe4a5bf['type']=_0x5a0e99[_0x1cb9('0xa')];_0xe4a5bf[_0x1cb9('0xb')]=_0xe4a5bf[_0x1cb9('0xc')]?_0x5a0e99[_0x1cb9('0xd')]:![];_0xe4a5bf[_0x1cb9('0xe')]=_0xe4a5bf['agentacw']?_0x5a0e99[_0x1cb9('0xf')]:0x0;}utils[_0x1cb9('0x10')](_0x1cb9('0x11'),_0xe4a5bf);});}else{utils[_0x1cb9('0x10')](_0x1cb9('0x11'),_0xe4a5bf);}if(_0x17d4ec){delete transfers[_0xe4a5bf['uniqueid']];}else{delete agents[_0xe4a5bf['destuniqueid']];}}exports['agentcalled']=function(_0x358866){try{utils[_0x1cb9('0x12')](util[_0x1cb9('0x13')](_0x1cb9('0x14'),_0x358866['uniqueid']),_0x358866);agents[_0x358866[_0x1cb9('0x15')]]=_0x358866;agents[_0x358866[_0x1cb9('0x15')]][_0x1cb9('0x16')]=utils[_0x1cb9('0x17')]();agents[_0x358866[_0x1cb9('0x15')]]['lastevent']='called';agents[_0x358866[_0x1cb9('0x15')]][_0x1cb9('0x7')]=null;agents[_0x358866[_0x1cb9('0x15')]][_0x1cb9('0x18')]=null;utils[_0x1cb9('0x1')](util[_0x1cb9('0x13')](_0x1cb9('0x19'),_0x358866['uniqueid'],agents[_0x358866['destuniqueid']][_0x1cb9('0x5')],_0x358866[_0x1cb9('0x15')]));}catch(_0x2b2669){utils[_0x1cb9('0x1a')](util[_0x1cb9('0x13')](_0x1cb9('0x14'),_0x358866[_0x1cb9('0x3')]),_0x2b2669);}};exports['agentringnoanswer']=function(_0x559bcc){try{if(!_[_0x1cb9('0x1b')](agents[_0x559bcc['destuniqueid']])){utils[_0x1cb9('0x12')](util[_0x1cb9('0x13')]('[%s][agents][agentringnoanswer]',_0x559bcc['uniqueid']),_0x559bcc);utils[_0x1cb9('0x1')](util[_0x1cb9('0x13')](_0x1cb9('0x1c'),_0x559bcc[_0x1cb9('0x3')],agents[_0x559bcc[_0x1cb9('0x15')]][_0x1cb9('0x5')],_0x559bcc['destuniqueid']));agents[_0x559bcc['destuniqueid']][_0x1cb9('0x1d')]=!![];agents[_0x559bcc['destuniqueid']][_0x1cb9('0x1e')]=utils[_0x1cb9('0x17')]();agents[_0x559bcc[_0x1cb9('0x15')]][_0x1cb9('0x1f')]=_0x1cb9('0x20');agents[_0x559bcc['destuniqueid']][_0x1cb9('0x21')]=_0x1cb9('0x20');agents[_0x559bcc['destuniqueid']][_0x1cb9('0x22')]=_0x559bcc[_0x1cb9('0x23')]?parseInt(_0x559bcc[_0x1cb9('0x23')])/0x3e8:0x0;agents[_0x559bcc[_0x1cb9('0x15')]][_0x1cb9('0x24')]=0x0;unanswered[_0x1cb9('0x25')](_0x559bcc[_0x1cb9('0x15')]);}}catch(_0xb644b3){utils[_0x1cb9('0x1a')](util[_0x1cb9('0x13')]('[%s][agents][agentringnoanswer]',_0x559bcc[_0x1cb9('0x3')]),_0xb644b3);}};exports['queuecallerabandon']=function(_0x110282){try{_['forIn'](agents,function(_0x278327,_0x41011c){if(_0x278327[_0x1cb9('0x3')]==_0x110282[_0x1cb9('0x3')]&&!_['includes'](unanswered,_0x278327[_0x1cb9('0x15')])){utils['debug'](util[_0x1cb9('0x13')](_0x1cb9('0x26'),_0x110282[_0x1cb9('0x3')]),_0x110282);utils['info'](util[_0x1cb9('0x13')]('[%s][agents][queuecallerabandon]\x20agent:%s\x20destuniqueid:%s\x20lastevent:abandoned',_0x110282[_0x1cb9('0x3')],_0x278327['membername'],_0x278327[_0x1cb9('0x15')]));_0x278327[_0x1cb9('0x1d')]=!![];_0x278327[_0x1cb9('0x1e')]=utils[_0x1cb9('0x17')]();_0x278327['lastevent']=_0x1cb9('0x27');_0x278327[_0x1cb9('0x21')]=_0x1cb9('0x27');_0x278327[_0x1cb9('0x22')]=_0x110282[_0x1cb9('0x22')];_0x278327[_0x1cb9('0x24')]=0x0;writeDB(_0x278327);}});}catch(_0xc6d5fd){utils[_0x1cb9('0x1a')](util[_0x1cb9('0x13')](_0x1cb9('0x26'),_0x110282[_0x1cb9('0x3')]),_0xc6d5fd);}};exports[_0x1cb9('0x28')]=function(_0x29f149){try{if(agents[_0x29f149['destuniqueid']]){utils['debug'](util[_0x1cb9('0x13')](_0x1cb9('0x29'),_0x29f149[_0x1cb9('0x3')]),_0x29f149);utils[_0x1cb9('0x1')](util[_0x1cb9('0x13')](_0x1cb9('0x2a'),_0x29f149[_0x1cb9('0x3')],agents[_0x29f149[_0x1cb9('0x15')]]['membername'],_0x29f149[_0x1cb9('0x15')]));agents[_0x29f149[_0x1cb9('0x15')]][_0x1cb9('0x2b')]=utils['now']();agents[_0x29f149[_0x1cb9('0x15')]]['connectedlinenum']=_0x29f149[_0x1cb9('0x7')];agents[_0x29f149['destuniqueid']][_0x1cb9('0x18')]=_0x29f149[_0x1cb9('0x18')];agents[_0x29f149[_0x1cb9('0x15')]][_0x1cb9('0x22')]=_0x29f149[_0x1cb9('0x23')];agents[_0x29f149[_0x1cb9('0x15')]][_0x1cb9('0x1f')]='connect';_['forIn'](agents,function(_0x4111b8,_0x1d2723){if(_0x4111b8[_0x1cb9('0x15')]!=_0x29f149[_0x1cb9('0x15')]&&_0x4111b8[_0x1cb9('0x3')]==_0x29f149[_0x1cb9('0x3')]){_0x4111b8[_0x1cb9('0x24')]=0x0;_0x4111b8['holdtime']=_0x29f149[_0x1cb9('0x23')];_0x4111b8['agentringnoanswer']=!![];_0x4111b8['agentringnoanswerAt']=utils['now']();_0x4111b8[_0x1cb9('0x1f')]=_0x1cb9('0x2c');_0x4111b8[_0x1cb9('0x21')]=_0x1cb9('0x2c');_0x4111b8[_0x1cb9('0x2d')]=_0x29f149['destuniqueid'];_0x4111b8[_0x1cb9('0x2e')]=_0x29f149['membername'];writeDB(_0x4111b8);}});}}catch(_0x91121){utils[_0x1cb9('0x1a')](util[_0x1cb9('0x13')]('[%s][agents][agentconnect]',_0x29f149[_0x1cb9('0x3')]),_0x91121);}};exports['agentcomplete']=function(_0xda1a44){try{if(!_[_0x1cb9('0x1b')](agents[_0xda1a44['destuniqueid']])){utils['debug'](util[_0x1cb9('0x13')](_0x1cb9('0x2f'),_0xda1a44[_0x1cb9('0x3')]),_0xda1a44);utils[_0x1cb9('0x1')](util[_0x1cb9('0x13')]('[%s][agents][agentcomplete]\x20agent:%s\x20destuniqueid:%s\x20lastevent:complete',_0xda1a44[_0x1cb9('0x3')],agents[_0xda1a44['destuniqueid']]['membername'],_0xda1a44['destuniqueid']));agents[_0xda1a44[_0x1cb9('0x15')]][_0x1cb9('0xc')]=!![];agents[_0xda1a44[_0x1cb9('0x15')]][_0x1cb9('0x30')]=utils[_0x1cb9('0x17')]();agents[_0xda1a44[_0x1cb9('0x15')]][_0x1cb9('0x24')]=utils[_0x1cb9('0x31')](agents[_0xda1a44[_0x1cb9('0x15')]][_0x1cb9('0x30')],agents[_0xda1a44[_0x1cb9('0x15')]]['agentconnectAt']);agents[_0xda1a44[_0x1cb9('0x15')]][_0x1cb9('0x21')]=_0xda1a44[_0x1cb9('0x21')];agents[_0xda1a44['destuniqueid']][_0x1cb9('0x1f')]=_0x1cb9('0x32');writeDB(agents[_0xda1a44[_0x1cb9('0x15')]]);}}catch(_0x2efdbb){utils[_0x1cb9('0x1a')](util['format'](_0x1cb9('0x2f'),_0xda1a44['uniqueid']),_0x2efdbb);}};exports[_0x1cb9('0x33')]=function(_0x4ac483){try{if(!_[_0x1cb9('0x1b')](agents[_0x4ac483[_0x1cb9('0x34')]])){utils[_0x1cb9('0x12')](util[_0x1cb9('0x13')]('[%s][agents][blindtransfer]',_0x4ac483[_0x1cb9('0x3')]),_0x4ac483);utils[_0x1cb9('0x1')](util[_0x1cb9('0x13')](_0x1cb9('0x35'),_0x4ac483[_0x1cb9('0x3')],agents[_0x4ac483[_0x1cb9('0x34')]][_0x1cb9('0x5')],agents[_0x4ac483[_0x1cb9('0x34')]][_0x1cb9('0x3')]));agents[_0x4ac483[_0x1cb9('0x34')]]['transfer']=!![];agents[_0x4ac483['transfereruniqueid']][_0x1cb9('0x36')]=_0x1cb9('0x37');agents[_0x4ac483[_0x1cb9('0x34')]][_0x1cb9('0x38')]=_0x4ac483[_0x1cb9('0x39')];agents[_0x4ac483[_0x1cb9('0x34')]][_0x1cb9('0x3a')]=agents[_0x4ac483[_0x1cb9('0x34')]][_0x1cb9('0x3')];}}catch(_0x166ca2){utils['error'](util[_0x1cb9('0x13')]('[%s][agents][blindtransfer]',_0x4ac483[_0x1cb9('0x3')]),_0x166ca2);}};exports['attendedtransfer']=function(_0x135795){try{utils['debug'](util['format'](_0x1cb9('0x3b'),_0x135795[_0x1cb9('0x3c')]),_0x135795);if(_0x135795[_0x1cb9('0x3c')]==_0x135795['origtransfererlinkedid']){if(!_[_0x1cb9('0x1b')](agents[_0x135795[_0x1cb9('0x3d')]])){utils['info'](util['format'](_0x1cb9('0x3e'),_0x135795[_0x1cb9('0x3c')],agents[_0x135795[_0x1cb9('0x3d')]][_0x1cb9('0x5')]));agents[_0x135795[_0x1cb9('0x3d')]][_0x1cb9('0x3f')]=!![];agents[_0x135795[_0x1cb9('0x3d')]]['transfertype']=_0x1cb9('0x40');agents[_0x135795[_0x1cb9('0x3d')]][_0x1cb9('0x38')]=_0x135795['origtransfererexten'];agents[_0x135795[_0x1cb9('0x3d')]][_0x1cb9('0x3a')]=_0x135795[_0x1cb9('0x3c')];}if(_0x135795[_0x1cb9('0x41')]&&agents[_0x135795[_0x1cb9('0x41')]]){agents[_0x135795[_0x1cb9('0x41')]]['agententerreason']=0x1;transfers[_0x135795[_0x1cb9('0x41')]]=_[_0x1cb9('0x42')](agents[_0x135795[_0x1cb9('0x41')]]);transfers[_0x135795[_0x1cb9('0x41')]][_0x1cb9('0x6')]=agents[_0x135795[_0x1cb9('0x3d')]][_0x1cb9('0x6')];transfers[_0x135795[_0x1cb9('0x41')]][_0x1cb9('0x43')]=agents[_0x135795[_0x1cb9('0x3d')]][_0x1cb9('0x43')];transfers[_0x135795['transfereeuniqueid']][_0x1cb9('0x16')]=utils[_0x1cb9('0x17')]();transfers[_0x135795[_0x1cb9('0x41')]][_0x1cb9('0x2b')]=utils['now']();transfers[_0x135795['transfereeuniqueid']][_0x1cb9('0x22')]=0x0;transfers[_0x135795[_0x1cb9('0x41')]][_0x1cb9('0x44')]=0x2;}}else if(_0x135795[_0x1cb9('0x3d')]==_0x135795[_0x1cb9('0x45')]){if(!_[_0x1cb9('0x1b')](agents[_0x135795[_0x1cb9('0x3c')]])){utils[_0x1cb9('0x1')](util['format']('[%s][agents][attendedtransfer]\x20agent:%s',_0x135795[_0x1cb9('0x3c')],agents[_0x135795['origtransfereruniqueid']]['membername']));agents[_0x135795['origtransfereruniqueid']]['transfer']=!![];agents[_0x135795['origtransfereruniqueid']][_0x1cb9('0x36')]=_0x1cb9('0x40');agents[_0x135795[_0x1cb9('0x3c')]][_0x1cb9('0x38')]=_0x135795[_0x1cb9('0x46')];agents[_0x135795[_0x1cb9('0x3c')]]['transferuniqueid']=_0x135795[_0x1cb9('0x3d')];}if(_0x135795[_0x1cb9('0x47')]&&agents[_0x135795['transfertargetuniqueid']]){agents[_0x135795['transfertargetuniqueid']][_0x1cb9('0x44')]=0x1;transfers[_0x135795[_0x1cb9('0x47')]]=_[_0x1cb9('0x42')](agents[_0x135795[_0x1cb9('0x47')]]);transfers[_0x135795[_0x1cb9('0x47')]]['calleridnum']=agents[_0x135795['origtransfereruniqueid']]['calleridnum'];transfers[_0x135795[_0x1cb9('0x47')]][_0x1cb9('0x43')]=agents[_0x135795[_0x1cb9('0x3c')]][_0x1cb9('0x43')];transfers[_0x135795[_0x1cb9('0x47')]]['agentcalledAt']=utils[_0x1cb9('0x17')]();transfers[_0x135795[_0x1cb9('0x47')]]['agentconnectAt']=utils['now']();transfers[_0x135795[_0x1cb9('0x47')]]['holdtime']=0x0;transfers[_0x135795[_0x1cb9('0x47')]][_0x1cb9('0x44')]=0x2;}}}catch(_0x2c54ea){utils[_0x1cb9('0x1a')](util[_0x1cb9('0x13')](_0x1cb9('0x3b'),_0x135795['origtransfereruniqueid']),_0x2c54ea);}};exports[_0x1cb9('0x48')]=function(_0x15fc04){try{utils[_0x1cb9('0x12')](util[_0x1cb9('0x13')]('[%s][agents][hangup]',_0x15fc04['uniqueid']),_0x15fc04);if(agents[_0x15fc04[_0x1cb9('0x3')]]&&agents[_0x15fc04[_0x1cb9('0x3')]][_0x1cb9('0x21')]===_0x1cb9('0x20')){if(_0x15fc04[_0x1cb9('0x49')]==='21'){agents[_0x15fc04[_0x1cb9('0x3')]]['reason']=_0x1cb9('0x4a');agents[_0x15fc04['uniqueid']][_0x1cb9('0x1f')]=_0x1cb9('0x4a');}utils['info'](util[_0x1cb9('0x13')](_0x1cb9('0x4b'),_0x15fc04[_0x1cb9('0x3')],agents[_0x15fc04['uniqueid']][_0x1cb9('0x5')],agents[_0x15fc04[_0x1cb9('0x3')]][_0x1cb9('0x21')],agents[_0x15fc04[_0x1cb9('0x3')]][_0x1cb9('0x1f')]));writeDB(agents[_0x15fc04[_0x1cb9('0x3')]]);var _0x5a3f1d=unanswered[_0x1cb9('0x4c')](_0x15fc04[_0x1cb9('0x3')]);if(_0x5a3f1d>-0x1){unanswered[_0x1cb9('0x4d')](_0x5a3f1d,0x1);}}if(transfers[_0x15fc04[_0x1cb9('0x3')]]){transfers[_0x15fc04[_0x1cb9('0x3')]][_0x1cb9('0xc')]=!![];transfers[_0x15fc04[_0x1cb9('0x3')]][_0x1cb9('0x30')]=utils['now']();transfers[_0x15fc04[_0x1cb9('0x3')]][_0x1cb9('0x24')]=utils['diffTime'](transfers[_0x15fc04[_0x1cb9('0x3')]]['agentcompleteAt'],transfers[_0x15fc04[_0x1cb9('0x3')]]['agentconnectAt']);transfers[_0x15fc04['uniqueid']][_0x1cb9('0x21')]=_0x1cb9('0x4e');transfers[_0x15fc04['uniqueid']][_0x1cb9('0x1f')]='complete';utils[_0x1cb9('0x1')](util[_0x1cb9('0x13')](_0x1cb9('0x4b'),_0x15fc04[_0x1cb9('0x3')],transfers[_0x15fc04['uniqueid']][_0x1cb9('0x5')],transfers[_0x15fc04[_0x1cb9('0x3')]][_0x1cb9('0x21')],transfers[_0x15fc04[_0x1cb9('0x3')]][_0x1cb9('0x1f')]));writeDB(transfers[_0x15fc04[_0x1cb9('0x3')]],!![]);}if(agents[_0x15fc04['uniqueid']]&&agents[_0x15fc04[_0x1cb9('0x3')]][_0x1cb9('0x2b')]){agents[_0x15fc04[_0x1cb9('0x3')]][_0x1cb9('0xc')]=!![];agents[_0x15fc04[_0x1cb9('0x3')]][_0x1cb9('0x30')]=utils['now']();agents[_0x15fc04[_0x1cb9('0x3')]][_0x1cb9('0x24')]=utils['diffTime'](agents[_0x15fc04[_0x1cb9('0x3')]][_0x1cb9('0x30')],agents[_0x15fc04[_0x1cb9('0x3')]][_0x1cb9('0x2b')]);agents[_0x15fc04[_0x1cb9('0x3')]][_0x1cb9('0x21')]=agents[_0x15fc04[_0x1cb9('0x3')]]['transfer']?_0x1cb9('0x3f'):'agent';agents[_0x15fc04[_0x1cb9('0x3')]][_0x1cb9('0x1f')]='complete';utils[_0x1cb9('0x1')](util[_0x1cb9('0x13')](_0x1cb9('0x4b'),_0x15fc04[_0x1cb9('0x3')],agents[_0x15fc04['uniqueid']][_0x1cb9('0x5')],agents[_0x15fc04[_0x1cb9('0x3')]][_0x1cb9('0x21')],agents[_0x15fc04['uniqueid']][_0x1cb9('0x1f')]));writeDB(agents[_0x15fc04[_0x1cb9('0x3')]]);}}catch(_0x3b456a){utils[_0x1cb9('0x1a')](util[_0x1cb9('0x13')](_0x1cb9('0x4f'),_0x15fc04[_0x1cb9('0x3')]),_0x3b456a);}}; \ No newline at end of file diff --git a/server/services/xdr/calls.controller.js b/server/services/xdr/calls.controller.js index 639a6a3..a97af12 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 _0x5f3f=['origtransfereruniqueid','secondtransfererchannel','_attended','transfertargetchannel','[%s][calls][attendedtransfer]\x20localtwolinkedid:%s\x20destinationchannel:%s','origtransfererchannel','userfield','musiconholdstart','[%s][calls][musiconholdstart]','musiconholdstartAt','[%s][calls][musiconholdstart]\x20musiconholdstartAt:%s','musiconholdstop','[%s][calls][musiconholdstop]','mohtime','varset','xmd-originatecalleridnum','source','value','variable','[%s][calls][varset]\x20variable:xmd-phone\x20value:%s','xmd-callerid-preview','xmd-callerid','[%s][calls][varset]\x20variable:%s\x20value:%s','xmd-queue','xmcs-queue','lastdata','xmd-contactid','[%s][calls][varset]\x20variable:xmd-contactid\x20value:%s','xmd-cdrtype','[%s][calls][varset]\x20variable:xmd-cdrtype\x20value:%s','type','outboundrouteid','[%s][calls][varset]\x20variable:outboundrouteid\x20value:%s','[%s][calls][varset]\x20variable:sipcallid\x20value:%s','sipcallid','[%s][calls][varset]','newexten','[%s][calls][newexten]','[%s][calls][newexten]\x20application:%s\x20appdata:%s','application','appdata','toLowerCase','set','startsWith','cdr','split','lastIndexOf','includes','noop','execif','gotoif','lodash','util','./utils','NO\x20ANSWER','FAILED','ANSWERED','BUSY','info','format','[%s][calls][writeDB]\x20channel:%s\x20queue:%s\x20agent:%s\x20interface:%s\x20calleridnum:%s\x20connectedlinenum:%s\x20lastevent:%s','uniqueid','channel','queue','membername','interface','calleridnum','connectedlinenum','lastevent','accountcode','getUserByInternal','UserId','request','CreateVoiceCallReport','newchannel','debug','[%s][calls][newchannel]','linkedid','OutgoingSpoolFailed','context','exten','error','newstate','[%s][calls][newstate]','isNil','channelstate','[%s][calls][newstate]\x20context:%s\x20channel:%s','systemanswertime','now','transfer','[%s][calls][newstate]\x20linkedid:%s\x20context:%s\x20channel:%s','destinationchannel','answertime','disposition','hangup','[%s][calls][hangup]','callerid','calleridname','cause-txt','endtime','duration','starttime','billableseconds','attendedtransfer','localtwolinkedid','[%s][calls][attendedtransfer]'];(function(_0x29c5d6,_0x2b3de8){var _0x574d0a=function(_0x540d6d){while(--_0x540d6d){_0x29c5d6['push'](_0x29c5d6['shift']());}};_0x574d0a(++_0x2b3de8);}(_0x5f3f,0x9d));var _0xf5f3=function(_0x401676,_0x3f1436){_0x401676=_0x401676-0x0;var _0x4f13fe=_0x5f3f[_0x401676];return _0x4f13fe;};'use strict';var _=require(_0xf5f3('0x0'));var util=require(_0xf5f3('0x1'));var utils=require(_0xf5f3('0x2'));var dispositions=[_0xf5f3('0x3'),_0xf5f3('0x4'),_0xf5f3('0x4'),_0xf5f3('0x3'),_0xf5f3('0x3'),_0xf5f3('0x3'),_0xf5f3('0x5'),_0xf5f3('0x6'),_0xf5f3('0x4'),'FAILED','FAILED'];var channels={};function writeDB(_0x4aae2e){utils[_0xf5f3('0x7')](util[_0xf5f3('0x8')](_0xf5f3('0x9'),_0x4aae2e[_0xf5f3('0xa')],_0x4aae2e[_0xf5f3('0xb')],_0x4aae2e[_0xf5f3('0xc')],_0x4aae2e[_0xf5f3('0xd')],_0x4aae2e[_0xf5f3('0xe')],_0x4aae2e[_0xf5f3('0xf')],_0x4aae2e[_0xf5f3('0x10')],_0x4aae2e[_0xf5f3('0x11')]));if(_0x4aae2e[_0xf5f3('0x12')]){utils[_0xf5f3('0x13')](_0x4aae2e[_0xf5f3('0x12')])['then'](function(_0x4ae046){if(_0x4ae046){_0x4aae2e[_0xf5f3('0x14')]=_0x4ae046['id'];}utils[_0xf5f3('0x15')](_0xf5f3('0x16'),_0x4aae2e);});}else{utils[_0xf5f3('0x15')]('CreateVoiceCallReport',_0x4aae2e);}if(channels[_0x4aae2e['uniqueid']]){delete channels[_0x4aae2e['uniqueid']];}}exports[_0xf5f3('0x17')]=function(_0x541c88){try{utils[_0xf5f3('0x18')](util[_0xf5f3('0x8')](_0xf5f3('0x19'),_0x541c88['uniqueid']),_0x541c88);if(_0x541c88[_0xf5f3('0xa')]==_0x541c88[_0xf5f3('0x1a')]&&_0x541c88[_0xf5f3('0xb')]!=_0xf5f3('0x1b')){utils['info'](util[_0xf5f3('0x8')]('[%s][calls][newchannel]\x20context:%s\x20exten:%s',_0x541c88[_0xf5f3('0xa')],_0x541c88[_0xf5f3('0x1c')],_0x541c88[_0xf5f3('0x1d')]));channels[_0x541c88['uniqueid']]={'uniqueid':_0x541c88[_0xf5f3('0xa')],'accountcode':_0x541c88[_0xf5f3('0x12')],'source':_0x541c88['calleridnum'],'destination':_0x541c88[_0xf5f3('0x1d')],'destinationcontext':_0x541c88[_0xf5f3('0x1c')],'channel':_0x541c88['channel'],'starttime':utils['now'](),'answertime':null,'systemanswertime':null,'mohtime':0x0,'disposition':_0xf5f3('0x3'),'amaflags':'DOCUMENTATION'};}}catch(_0x3624e1){utils[_0xf5f3('0x1e')](util[_0xf5f3('0x8')](_0xf5f3('0x19'),_0x541c88[_0xf5f3('0xa')]),_0x3624e1);}};exports[_0xf5f3('0x1f')]=function(_0x471bd7){try{utils['debug'](util['format'](_0xf5f3('0x20'),_0x471bd7['uniqueid']),_0x471bd7);if(!_[_0xf5f3('0x21')](channels[_0x471bd7['uniqueid']])&&_0x471bd7[_0xf5f3('0x22')]==0x6){utils['info'](util['format'](_0xf5f3('0x23'),_0x471bd7[_0xf5f3('0xa')],_0x471bd7[_0xf5f3('0x1c')],_0x471bd7[_0xf5f3('0xb')]));if(_['isNil'](channels[_0x471bd7[_0xf5f3('0xa')]][_0xf5f3('0x24')])){channels[_0x471bd7['uniqueid']]['systemanswertime']=utils[_0xf5f3('0x25')]();}}else if(!_[_0xf5f3('0x21')](channels[_0x471bd7[_0xf5f3('0x1a')]])&&_0x471bd7[_0xf5f3('0x22')]==0x6&&_0x471bd7[_0xf5f3('0x1c')]!=_0xf5f3('0x26')){utils[_0xf5f3('0x7')](util[_0xf5f3('0x8')](_0xf5f3('0x27'),_0x471bd7[_0xf5f3('0xa')],_0x471bd7[_0xf5f3('0x1a')],_0x471bd7['context'],_0x471bd7['channel']));channels[_0x471bd7[_0xf5f3('0x1a')]][_0xf5f3('0x12')]=_0x471bd7[_0xf5f3('0x12')];channels[_0x471bd7[_0xf5f3('0x1a')]][_0xf5f3('0x28')]=_0x471bd7[_0xf5f3('0xb')];if(_[_0xf5f3('0x21')](channels[_0x471bd7[_0xf5f3('0x1a')]][_0xf5f3('0x29')])){channels[_0x471bd7['linkedid']][_0xf5f3('0x29')]=utils[_0xf5f3('0x25')]();}channels[_0x471bd7[_0xf5f3('0x1a')]][_0xf5f3('0x2a')]=dispositions[_['toNumber'](_0x471bd7[_0xf5f3('0x22')])]||_0xf5f3('0x5');}}catch(_0x1096f3){utils[_0xf5f3('0x1e')](util[_0xf5f3('0x8')](_0xf5f3('0x20'),_0x471bd7[_0xf5f3('0xa')]),_0x1096f3);}};exports[_0xf5f3('0x2b')]=function(_0x4fdc1a){try{if(!_[_0xf5f3('0x21')](channels[_0x4fdc1a[_0xf5f3('0xa')]])){utils[_0xf5f3('0x18')](util['format'](_0xf5f3('0x2c'),_0x4fdc1a[_0xf5f3('0xa')]),_0x4fdc1a);if(_[_0xf5f3('0x21')](channels[_0x4fdc1a[_0xf5f3('0xa')]][_0xf5f3('0x2d')])){channels[_0x4fdc1a[_0xf5f3('0xa')]][_0xf5f3('0x2d')]=_0x4fdc1a[_0xf5f3('0x2e')]+'\x20<'+_0x4fdc1a[_0xf5f3('0xf')]+'>';}utils[_0xf5f3('0x7')](util[_0xf5f3('0x8')]('[%s][calls][hangup]\x20callerid:%s\x20reason:%s',_0x4fdc1a[_0xf5f3('0xa')],channels[_0x4fdc1a[_0xf5f3('0xa')]][_0xf5f3('0x2d')],_0x4fdc1a[_0xf5f3('0x2f')]));channels[_0x4fdc1a[_0xf5f3('0xa')]][_0xf5f3('0x30')]=utils[_0xf5f3('0x25')]();channels[_0x4fdc1a[_0xf5f3('0xa')]][_0xf5f3('0x31')]=utils['diffTime'](channels[_0x4fdc1a[_0xf5f3('0xa')]]['endtime'],channels[_0x4fdc1a[_0xf5f3('0xa')]][_0xf5f3('0x32')]);channels[_0x4fdc1a[_0xf5f3('0xa')]][_0xf5f3('0x33')]=channels[_0x4fdc1a[_0xf5f3('0xa')]][_0xf5f3('0x29')]?utils['diffTime'](channels[_0x4fdc1a[_0xf5f3('0xa')]][_0xf5f3('0x30')],channels[_0x4fdc1a[_0xf5f3('0xa')]]['answertime']):0x0;writeDB(channels[_0x4fdc1a[_0xf5f3('0xa')]]);}}catch(_0x3a2b8d){utils[_0xf5f3('0x1e')](util[_0xf5f3('0x8')](_0xf5f3('0x2c'),_0x4fdc1a['uniqueid']),_0x3a2b8d);}};exports[_0xf5f3('0x34')]=function(_0x28e740){try{if(!_[_0xf5f3('0x21')](channels[_0x28e740[_0xf5f3('0x35')]])){utils[_0xf5f3('0x18')](util['format'](_0xf5f3('0x36'),_0x28e740[_0xf5f3('0x37')]),_0x28e740);if(channels[_0x28e740[_0xf5f3('0x35')]][_0xf5f3('0xb')]==_0x28e740['transfereechannel']){utils['info'](util[_0xf5f3('0x8')]('[%s][calls][attendedtransfer]\x20localtwolinkedid:%s\x20destinationchannel:%s',_0x28e740[_0xf5f3('0x37')],_0x28e740[_0xf5f3('0x35')],_0x28e740[_0xf5f3('0x38')]));channels[_0x28e740[_0xf5f3('0x35')]]['destinationchannel']=_0x28e740['secondtransfererchannel'];channels[_0x28e740[_0xf5f3('0x35')]]['userfield']=_0xf5f3('0x39');}else if(channels[_0x28e740[_0xf5f3('0x35')]][_0xf5f3('0xb')]=_0x28e740[_0xf5f3('0x3a')]){utils[_0xf5f3('0x7')](util['format'](_0xf5f3('0x3b'),_0x28e740[_0xf5f3('0x37')],_0x28e740['localtwolinkedid'],_0x28e740[_0xf5f3('0x3c')]));channels[_0x28e740[_0xf5f3('0x35')]][_0xf5f3('0x28')]=_0x28e740[_0xf5f3('0x3c')];channels[_0x28e740[_0xf5f3('0x35')]][_0xf5f3('0x3d')]=_0xf5f3('0x39');}}}catch(_0x2a00a1){utils[_0xf5f3('0x1e')](util[_0xf5f3('0x8')]('[%s][calls][attendedtransfer]',_0x28e740[_0xf5f3('0x37')]),_0x2a00a1);}};exports[_0xf5f3('0x3e')]=function(_0x17c437){try{if(!_[_0xf5f3('0x21')](channels[_0x17c437[_0xf5f3('0xa')]])){utils[_0xf5f3('0x18')](util['format'](_0xf5f3('0x3f'),_0x17c437['uniqueid']),_0x17c437);channels[_0x17c437[_0xf5f3('0xa')]][_0xf5f3('0x40')]=utils[_0xf5f3('0x25')]();utils[_0xf5f3('0x7')](util[_0xf5f3('0x8')](_0xf5f3('0x41'),_0x17c437['uniqueid'],channels[_0x17c437[_0xf5f3('0xa')]][_0xf5f3('0x40')]));}}catch(_0x44c402){utils[_0xf5f3('0x1e')](util[_0xf5f3('0x8')](_0xf5f3('0x3f'),_0x17c437['uniqueid']),_0x44c402);}};exports[_0xf5f3('0x42')]=function(_0x312dca){try{if(!_[_0xf5f3('0x21')](channels[_0x312dca[_0xf5f3('0xa')]])){utils[_0xf5f3('0x18')](util['format'](_0xf5f3('0x43'),_0x312dca[_0xf5f3('0xa')]),_0x312dca);if(!_[_0xf5f3('0x21')](channels[_0x312dca[_0xf5f3('0xa')]][_0xf5f3('0x40')])){channels[_0x312dca[_0xf5f3('0xa')]]['mohtime']+=utils['diffTime'](utils[_0xf5f3('0x25')](),channels[_0x312dca[_0xf5f3('0xa')]][_0xf5f3('0x40')]);utils[_0xf5f3('0x7')](util[_0xf5f3('0x8')]('[%s][calls][musiconholdstop]\x20mohtime:%s',_0x312dca[_0xf5f3('0xa')],channels[_0x312dca['uniqueid']][_0xf5f3('0x44')]));delete channels[_0x312dca[_0xf5f3('0xa')]][_0xf5f3('0x40')];}}}catch(_0x18635e){utils[_0xf5f3('0x1e')](util[_0xf5f3('0x8')](_0xf5f3('0x43'),_0x312dca[_0xf5f3('0xa')]),_0x18635e);}};exports[_0xf5f3('0x45')]=function(_0x12e08f){try{if(!_[_0xf5f3('0x21')](channels[_0x12e08f[_0xf5f3('0xa')]])){utils[_0xf5f3('0x18')](util['format']('[%s][calls][varset]',_0x12e08f[_0xf5f3('0xa')]),_0x12e08f);if(!_[_0xf5f3('0x21')](_0x12e08f['variable'][_0xf5f3('0x46')])){utils[_0xf5f3('0x7')](util[_0xf5f3('0x8')]('[%s][calls][varset]\x20variable:xmd-originatecalleridnum\x20value:%s',_0x12e08f[_0xf5f3('0xa')],_0x12e08f['value']));channels[_0x12e08f['uniqueid']][_0xf5f3('0x47')]=_0x12e08f[_0xf5f3('0x48')];}if(!_[_0xf5f3('0x21')](_0x12e08f[_0xf5f3('0x49')]['xmd-phone'])){utils['info'](util[_0xf5f3('0x8')](_0xf5f3('0x4a'),_0x12e08f[_0xf5f3('0xa')],_0x12e08f[_0xf5f3('0x48')]));channels[_0x12e08f[_0xf5f3('0xa')]]['destination']=_0x12e08f[_0xf5f3('0x48')];channels[_0x12e08f[_0xf5f3('0xa')]]['callerid']='\x22'+_0x12e08f[_0xf5f3('0x48')]+'\x22\x20<'+_0x12e08f[_0xf5f3('0x48')]+'>';}if(!_['isNil'](_0x12e08f['variable'][_0xf5f3('0x4b')])||!_[_0xf5f3('0x21')](_0x12e08f['variable'][_0xf5f3('0x4c')])){utils[_0xf5f3('0x7')](util['format'](_0xf5f3('0x4d'),_0x12e08f[_0xf5f3('0xa')],!_[_0xf5f3('0x21')](_0x12e08f[_0xf5f3('0x49')][_0xf5f3('0x4b')])?'xmd-callerid-preview':_0xf5f3('0x4c'),_0x12e08f['value']));channels[_0x12e08f[_0xf5f3('0xa')]]['callerid']=_0x12e08f[_0xf5f3('0x48')];}if(!_[_0xf5f3('0x21')](_0x12e08f[_0xf5f3('0x49')][_0xf5f3('0x4e')])||!_[_0xf5f3('0x21')](_0x12e08f['variable'][_0xf5f3('0x4f')])){utils[_0xf5f3('0x7')](util[_0xf5f3('0x8')](_0xf5f3('0x4d'),_0x12e08f[_0xf5f3('0xa')],!_['isNil'](_0x12e08f[_0xf5f3('0x49')][_0xf5f3('0x4e')])?_0xf5f3('0x4e'):_0xf5f3('0x4f'),_0x12e08f[_0xf5f3('0x48')]));channels[_0x12e08f[_0xf5f3('0xa')]]['lastapplication']='Queue';channels[_0x12e08f['uniqueid']][_0xf5f3('0x50')]=_0x12e08f[_0xf5f3('0x48')];channels[_0x12e08f[_0xf5f3('0xa')]][_0xf5f3('0xc')]=!![];}if(!_[_0xf5f3('0x21')](_0x12e08f[_0xf5f3('0x49')][_0xf5f3('0x51')])){utils['info'](util[_0xf5f3('0x8')](_0xf5f3('0x52'),_0x12e08f[_0xf5f3('0xa')],_0x12e08f[_0xf5f3('0x48')]));channels[_0x12e08f[_0xf5f3('0xa')]]['ContactId']=_0x12e08f[_0xf5f3('0x48')];}if(!_[_0xf5f3('0x21')](_0x12e08f[_0xf5f3('0x49')][_0xf5f3('0x53')])){utils[_0xf5f3('0x7')](util['format'](_0xf5f3('0x54'),_0x12e08f[_0xf5f3('0xa')],_0x12e08f['value']));channels[_0x12e08f[_0xf5f3('0xa')]][_0xf5f3('0x55')]=_0x12e08f[_0xf5f3('0x48')];}if(!_['isNil'](_0x12e08f[_0xf5f3('0x49')][_0xf5f3('0x56')])){utils['info'](util[_0xf5f3('0x8')](_0xf5f3('0x57'),_0x12e08f[_0xf5f3('0xa')],_0x12e08f['value']));channels[_0x12e08f['uniqueid']]['routeid']=_0x12e08f['value'];}if(!_[_0xf5f3('0x21')](_0x12e08f[_0xf5f3('0x49')]['sipcallid'])){utils[_0xf5f3('0x7')](util[_0xf5f3('0x8')](_0xf5f3('0x58'),_0x12e08f[_0xf5f3('0xa')],_0x12e08f[_0xf5f3('0x48')]));channels[_0x12e08f[_0xf5f3('0xa')]][_0xf5f3('0x59')]=_0x12e08f['value'];}}}catch(_0x312cb7){utils[_0xf5f3('0x1e')](util['format'](_0xf5f3('0x5a'),_0x12e08f[_0xf5f3('0xa')]),_0x312cb7);}};exports[_0xf5f3('0x5b')]=function(_0x317b67){try{if(!_['isNil'](channels[_0x317b67['uniqueid']])){utils[_0xf5f3('0x18')](util['format'](_0xf5f3('0x5c'),_0x317b67[_0xf5f3('0xa')]),_0x317b67);utils[_0xf5f3('0x7')](util[_0xf5f3('0x8')](_0xf5f3('0x5d'),_0x317b67[_0xf5f3('0xa')],_0x317b67[_0xf5f3('0x5e')],_0x317b67[_0xf5f3('0x5f')]));if(_0x317b67[_0xf5f3('0x5e')][_0xf5f3('0x60')]()==_0xf5f3('0x61')&&_[_0xf5f3('0x62')](_0x317b67[_0xf5f3('0x5f')][_0xf5f3('0x60')](),_0xf5f3('0x63'))){var _0xf997c6=_0x317b67['appdata'][_0xf5f3('0x64')]('=');var _0xd072fc=_0xf997c6[0x0]['substring'](_0xf997c6[0x0]['lastIndexOf']('(')+0x1,_0xf997c6[0x0][_0xf5f3('0x65')](')'));var _0x24c32f=_0xf997c6[0x1];channels[_0x317b67[_0xf5f3('0xa')]][_0xd072fc]=_0x24c32f;}if(!_[_0xf5f3('0x66')]([_0xf5f3('0x2b'),_0xf5f3('0x67'),_0xf5f3('0x68'),'set',_0xf5f3('0x69')],_0x317b67[_0xf5f3('0x5e')][_0xf5f3('0x60')]())){channels[_0x317b67['uniqueid']]['lastapplication']=_0x317b67['application'];channels[_0x317b67[_0xf5f3('0xa')]][_0xf5f3('0x50')]=_0x317b67[_0xf5f3('0x5f')];}}}catch(_0x4eb599){utils[_0xf5f3('0x1e')](util['format'](_0xf5f3('0x5c'),_0x317b67['uniqueid']),_0x4eb599);}}; \ No newline at end of file +var _0xbae7=['gotoif','[%s][calls][newexten]','lodash','./utils','NO\x20ANSWER','FAILED','ANSWERED','BUSY','info','[%s][calls][writeDB]\x20channel:%s\x20queue:%s\x20agent:%s\x20interface:%s\x20calleridnum:%s\x20connectedlinenum:%s\x20lastevent:%s','uniqueid','channel','membername','interface','calleridnum','connectedlinenum','lastevent','accountcode','getUserByInternal','then','request','CreateVoiceCallReport','format','[%s][calls][newchannel]','linkedid','OutgoingSpoolFailed','[%s][calls][newchannel]\x20context:%s\x20exten:%s','exten','context','DOCUMENTATION','error','newstate','debug','[%s][calls][newstate]','isNil','channelstate','systemanswertime','transfer','[%s][calls][newstate]\x20linkedid:%s\x20context:%s\x20channel:%s','destinationchannel','answertime','now','disposition','toNumber','hangup','[%s][calls][hangup]','callerid','calleridname','cause-txt','endtime','duration','diffTime','starttime','attendedtransfer','localtwolinkedid','[%s][calls][attendedtransfer]','transfereechannel','origtransfereruniqueid','secondtransfererchannel','_attended','transfertargetchannel','[%s][calls][attendedtransfer]\x20localtwolinkedid:%s\x20destinationchannel:%s','origtransfererchannel','userfield','musiconholdstart','[%s][calls][musiconholdstart]','musiconholdstartAt','[%s][calls][musiconholdstart]\x20musiconholdstartAt:%s','musiconholdstop','[%s][calls][musiconholdstop]','mohtime','[%s][calls][musiconholdstop]\x20mohtime:%s','variable','xmd-originatecalleridnum','value','[%s][calls][varset]\x20variable:xmd-phone\x20value:%s','[%s][calls][varset]\x20variable:%s\x20value:%s','xmd-callerid-preview','xmd-callerid','xmd-queue','xmcs-queue','lastapplication','Queue','lastdata','queue','[%s][calls][varset]\x20variable:xmd-contactid\x20value:%s','ContactId','xmd-cdrtype','type','outboundrouteid','[%s][calls][varset]\x20variable:outboundrouteid\x20value:%s','routeid','sipcallid','[%s][calls][varset]\x20variable:sipcallid\x20value:%s','[%s][calls][varset]','[%s][calls][newexten]\x20application:%s\x20appdata:%s','application','appdata','toLowerCase','set','split','substring','lastIndexOf','noop','execif'];(function(_0x3dd15e,_0x1f0015){var _0x231fd0=function(_0x4f680a){while(--_0x4f680a){_0x3dd15e['push'](_0x3dd15e['shift']());}};_0x231fd0(++_0x1f0015);}(_0xbae7,0x13d));var _0x7bae=function(_0x45f395,_0x586ec3){_0x45f395=_0x45f395-0x0;var _0x568feb=_0xbae7[_0x45f395];return _0x568feb;};'use strict';var _=require(_0x7bae('0x0'));var util=require('util');var utils=require(_0x7bae('0x1'));var dispositions=[_0x7bae('0x2'),_0x7bae('0x3'),_0x7bae('0x3'),_0x7bae('0x2'),'NO\x20ANSWER',_0x7bae('0x2'),_0x7bae('0x4'),_0x7bae('0x5'),_0x7bae('0x3'),_0x7bae('0x3'),_0x7bae('0x3')];var channels={};function writeDB(_0x68cbca){utils[_0x7bae('0x6')](util['format'](_0x7bae('0x7'),_0x68cbca[_0x7bae('0x8')],_0x68cbca[_0x7bae('0x9')],_0x68cbca['queue'],_0x68cbca[_0x7bae('0xa')],_0x68cbca[_0x7bae('0xb')],_0x68cbca[_0x7bae('0xc')],_0x68cbca[_0x7bae('0xd')],_0x68cbca[_0x7bae('0xe')]));if(_0x68cbca[_0x7bae('0xf')]){utils[_0x7bae('0x10')](_0x68cbca['accountcode'])[_0x7bae('0x11')](function(_0x26eb6c){if(_0x26eb6c){_0x68cbca['UserId']=_0x26eb6c['id'];}utils[_0x7bae('0x12')](_0x7bae('0x13'),_0x68cbca);});}else{utils[_0x7bae('0x12')](_0x7bae('0x13'),_0x68cbca);}if(channels[_0x68cbca['uniqueid']]){delete channels[_0x68cbca['uniqueid']];}}exports['newchannel']=function(_0x4ce387){try{utils['debug'](util[_0x7bae('0x14')](_0x7bae('0x15'),_0x4ce387[_0x7bae('0x8')]),_0x4ce387);if(_0x4ce387[_0x7bae('0x8')]==_0x4ce387[_0x7bae('0x16')]&&_0x4ce387[_0x7bae('0x9')]!=_0x7bae('0x17')){utils[_0x7bae('0x6')](util[_0x7bae('0x14')](_0x7bae('0x18'),_0x4ce387[_0x7bae('0x8')],_0x4ce387['context'],_0x4ce387[_0x7bae('0x19')]));channels[_0x4ce387['uniqueid']]={'uniqueid':_0x4ce387[_0x7bae('0x8')],'accountcode':_0x4ce387[_0x7bae('0xf')],'source':_0x4ce387[_0x7bae('0xc')],'destination':_0x4ce387[_0x7bae('0x19')],'destinationcontext':_0x4ce387[_0x7bae('0x1a')],'channel':_0x4ce387['channel'],'starttime':utils['now'](),'answertime':null,'systemanswertime':null,'mohtime':0x0,'disposition':_0x7bae('0x2'),'amaflags':_0x7bae('0x1b')};}}catch(_0x555562){utils[_0x7bae('0x1c')](util[_0x7bae('0x14')](_0x7bae('0x15'),_0x4ce387['uniqueid']),_0x555562);}};exports[_0x7bae('0x1d')]=function(_0x459af4){try{utils[_0x7bae('0x1e')](util['format'](_0x7bae('0x1f'),_0x459af4[_0x7bae('0x8')]),_0x459af4);if(!_[_0x7bae('0x20')](channels[_0x459af4[_0x7bae('0x8')]])&&_0x459af4[_0x7bae('0x21')]==0x6){utils['info'](util[_0x7bae('0x14')]('[%s][calls][newstate]\x20context:%s\x20channel:%s',_0x459af4[_0x7bae('0x8')],_0x459af4[_0x7bae('0x1a')],_0x459af4[_0x7bae('0x9')]));if(_[_0x7bae('0x20')](channels[_0x459af4[_0x7bae('0x8')]][_0x7bae('0x22')])){channels[_0x459af4['uniqueid']][_0x7bae('0x22')]=utils['now']();}}else if(!_[_0x7bae('0x20')](channels[_0x459af4[_0x7bae('0x16')]])&&_0x459af4[_0x7bae('0x21')]==0x6&&_0x459af4[_0x7bae('0x1a')]!=_0x7bae('0x23')){utils['info'](util[_0x7bae('0x14')](_0x7bae('0x24'),_0x459af4[_0x7bae('0x8')],_0x459af4[_0x7bae('0x16')],_0x459af4['context'],_0x459af4[_0x7bae('0x9')]));channels[_0x459af4[_0x7bae('0x16')]][_0x7bae('0xf')]=_0x459af4[_0x7bae('0xf')];channels[_0x459af4['linkedid']][_0x7bae('0x25')]=_0x459af4[_0x7bae('0x9')];if(_[_0x7bae('0x20')](channels[_0x459af4[_0x7bae('0x16')]][_0x7bae('0x26')])){channels[_0x459af4[_0x7bae('0x16')]]['answertime']=utils[_0x7bae('0x27')]();}channels[_0x459af4[_0x7bae('0x16')]][_0x7bae('0x28')]=dispositions[_[_0x7bae('0x29')](_0x459af4[_0x7bae('0x21')])]||_0x7bae('0x4');}}catch(_0x279be9){utils[_0x7bae('0x1c')](util[_0x7bae('0x14')](_0x7bae('0x1f'),_0x459af4[_0x7bae('0x8')]),_0x279be9);}};exports[_0x7bae('0x2a')]=function(_0x74256b){try{if(!_[_0x7bae('0x20')](channels[_0x74256b['uniqueid']])){utils['debug'](util[_0x7bae('0x14')](_0x7bae('0x2b'),_0x74256b['uniqueid']),_0x74256b);if(_[_0x7bae('0x20')](channels[_0x74256b[_0x7bae('0x8')]][_0x7bae('0x2c')])){channels[_0x74256b[_0x7bae('0x8')]][_0x7bae('0x2c')]=_0x74256b[_0x7bae('0x2d')]+'\x20<'+_0x74256b[_0x7bae('0xc')]+'>';}utils[_0x7bae('0x6')](util['format']('[%s][calls][hangup]\x20callerid:%s\x20reason:%s',_0x74256b[_0x7bae('0x8')],channels[_0x74256b[_0x7bae('0x8')]][_0x7bae('0x2c')],_0x74256b[_0x7bae('0x2e')]));channels[_0x74256b[_0x7bae('0x8')]][_0x7bae('0x2f')]=utils[_0x7bae('0x27')]();channels[_0x74256b[_0x7bae('0x8')]][_0x7bae('0x30')]=utils[_0x7bae('0x31')](channels[_0x74256b[_0x7bae('0x8')]][_0x7bae('0x2f')],channels[_0x74256b[_0x7bae('0x8')]][_0x7bae('0x32')]);channels[_0x74256b[_0x7bae('0x8')]]['billableseconds']=channels[_0x74256b[_0x7bae('0x8')]][_0x7bae('0x26')]?utils[_0x7bae('0x31')](channels[_0x74256b['uniqueid']][_0x7bae('0x2f')],channels[_0x74256b[_0x7bae('0x8')]][_0x7bae('0x26')]):0x0;writeDB(channels[_0x74256b[_0x7bae('0x8')]]);}}catch(_0x28ce4c){utils[_0x7bae('0x1c')](util['format'](_0x7bae('0x2b'),_0x74256b[_0x7bae('0x8')]),_0x28ce4c);}};exports[_0x7bae('0x33')]=function(_0x2a6654){try{if(!_[_0x7bae('0x20')](channels[_0x2a6654[_0x7bae('0x34')]])){utils['debug'](util['format'](_0x7bae('0x35'),_0x2a6654['origtransfereruniqueid']),_0x2a6654);if(channels[_0x2a6654['localtwolinkedid']][_0x7bae('0x9')]==_0x2a6654[_0x7bae('0x36')]){utils['info'](util[_0x7bae('0x14')]('[%s][calls][attendedtransfer]\x20localtwolinkedid:%s\x20destinationchannel:%s',_0x2a6654[_0x7bae('0x37')],_0x2a6654[_0x7bae('0x34')],_0x2a6654['secondtransfererchannel']));channels[_0x2a6654[_0x7bae('0x34')]][_0x7bae('0x25')]=_0x2a6654[_0x7bae('0x38')];channels[_0x2a6654[_0x7bae('0x34')]]['userfield']=_0x7bae('0x39');}else if(channels[_0x2a6654[_0x7bae('0x34')]][_0x7bae('0x9')]=_0x2a6654[_0x7bae('0x3a')]){utils[_0x7bae('0x6')](util[_0x7bae('0x14')](_0x7bae('0x3b'),_0x2a6654[_0x7bae('0x37')],_0x2a6654['localtwolinkedid'],_0x2a6654[_0x7bae('0x3c')]));channels[_0x2a6654['localtwolinkedid']]['destinationchannel']=_0x2a6654[_0x7bae('0x3c')];channels[_0x2a6654[_0x7bae('0x34')]][_0x7bae('0x3d')]=_0x7bae('0x39');}}}catch(_0x4d6843){utils[_0x7bae('0x1c')](util['format'](_0x7bae('0x35'),_0x2a6654[_0x7bae('0x37')]),_0x4d6843);}};exports[_0x7bae('0x3e')]=function(_0x277d7d){try{if(!_[_0x7bae('0x20')](channels[_0x277d7d['uniqueid']])){utils[_0x7bae('0x1e')](util[_0x7bae('0x14')](_0x7bae('0x3f'),_0x277d7d[_0x7bae('0x8')]),_0x277d7d);channels[_0x277d7d['uniqueid']][_0x7bae('0x40')]=utils[_0x7bae('0x27')]();utils[_0x7bae('0x6')](util[_0x7bae('0x14')](_0x7bae('0x41'),_0x277d7d['uniqueid'],channels[_0x277d7d[_0x7bae('0x8')]][_0x7bae('0x40')]));}}catch(_0x408847){utils[_0x7bae('0x1c')](util[_0x7bae('0x14')](_0x7bae('0x3f'),_0x277d7d[_0x7bae('0x8')]),_0x408847);}};exports[_0x7bae('0x42')]=function(_0x2d44a1){try{if(!_[_0x7bae('0x20')](channels[_0x2d44a1[_0x7bae('0x8')]])){utils[_0x7bae('0x1e')](util['format'](_0x7bae('0x43'),_0x2d44a1[_0x7bae('0x8')]),_0x2d44a1);if(!_[_0x7bae('0x20')](channels[_0x2d44a1['uniqueid']][_0x7bae('0x40')])){channels[_0x2d44a1[_0x7bae('0x8')]][_0x7bae('0x44')]+=utils[_0x7bae('0x31')](utils[_0x7bae('0x27')](),channels[_0x2d44a1[_0x7bae('0x8')]]['musiconholdstartAt']);utils[_0x7bae('0x6')](util[_0x7bae('0x14')](_0x7bae('0x45'),_0x2d44a1[_0x7bae('0x8')],channels[_0x2d44a1[_0x7bae('0x8')]]['mohtime']));delete channels[_0x2d44a1[_0x7bae('0x8')]][_0x7bae('0x40')];}}}catch(_0x2d16e8){utils[_0x7bae('0x1c')](util['format'](_0x7bae('0x43'),_0x2d44a1['uniqueid']),_0x2d16e8);}};exports['varset']=function(_0x22ebf1){try{if(!_['isNil'](channels[_0x22ebf1[_0x7bae('0x8')]])){utils[_0x7bae('0x1e')](util[_0x7bae('0x14')]('[%s][calls][varset]',_0x22ebf1[_0x7bae('0x8')]),_0x22ebf1);if(!_[_0x7bae('0x20')](_0x22ebf1[_0x7bae('0x46')][_0x7bae('0x47')])){utils[_0x7bae('0x6')](util['format']('[%s][calls][varset]\x20variable:xmd-originatecalleridnum\x20value:%s',_0x22ebf1[_0x7bae('0x8')],_0x22ebf1[_0x7bae('0x48')]));channels[_0x22ebf1[_0x7bae('0x8')]]['source']=_0x22ebf1[_0x7bae('0x48')];}if(!_[_0x7bae('0x20')](_0x22ebf1[_0x7bae('0x46')]['xmd-phone'])){utils['info'](util[_0x7bae('0x14')](_0x7bae('0x49'),_0x22ebf1[_0x7bae('0x8')],_0x22ebf1['value']));channels[_0x22ebf1[_0x7bae('0x8')]]['destination']=_0x22ebf1['value'];channels[_0x22ebf1['uniqueid']][_0x7bae('0x2c')]='\x22'+_0x22ebf1[_0x7bae('0x48')]+'\x22\x20<'+_0x22ebf1[_0x7bae('0x48')]+'>';}if(!_[_0x7bae('0x20')](_0x22ebf1[_0x7bae('0x46')]['xmd-callerid-preview'])||!_[_0x7bae('0x20')](_0x22ebf1[_0x7bae('0x46')]['xmd-callerid'])){utils[_0x7bae('0x6')](util[_0x7bae('0x14')](_0x7bae('0x4a'),_0x22ebf1['uniqueid'],!_['isNil'](_0x22ebf1[_0x7bae('0x46')][_0x7bae('0x4b')])?_0x7bae('0x4b'):_0x7bae('0x4c'),_0x22ebf1['value']));channels[_0x22ebf1[_0x7bae('0x8')]][_0x7bae('0x2c')]=_0x22ebf1[_0x7bae('0x48')];}if(!_[_0x7bae('0x20')](_0x22ebf1[_0x7bae('0x46')][_0x7bae('0x4d')])||!_[_0x7bae('0x20')](_0x22ebf1['variable'][_0x7bae('0x4e')])){utils['info'](util[_0x7bae('0x14')]('[%s][calls][varset]\x20variable:%s\x20value:%s',_0x22ebf1[_0x7bae('0x8')],!_[_0x7bae('0x20')](_0x22ebf1[_0x7bae('0x46')][_0x7bae('0x4d')])?_0x7bae('0x4d'):_0x7bae('0x4e'),_0x22ebf1[_0x7bae('0x48')]));channels[_0x22ebf1[_0x7bae('0x8')]][_0x7bae('0x4f')]=_0x7bae('0x50');channels[_0x22ebf1[_0x7bae('0x8')]][_0x7bae('0x51')]=_0x22ebf1['value'];channels[_0x22ebf1['uniqueid']][_0x7bae('0x52')]=!![];}if(!_[_0x7bae('0x20')](_0x22ebf1[_0x7bae('0x46')]['xmd-contactid'])){utils[_0x7bae('0x6')](util['format'](_0x7bae('0x53'),_0x22ebf1['uniqueid'],_0x22ebf1['value']));channels[_0x22ebf1[_0x7bae('0x8')]][_0x7bae('0x54')]=_0x22ebf1[_0x7bae('0x48')];}if(!_[_0x7bae('0x20')](_0x22ebf1[_0x7bae('0x46')][_0x7bae('0x55')])){utils[_0x7bae('0x6')](util[_0x7bae('0x14')]('[%s][calls][varset]\x20variable:xmd-cdrtype\x20value:%s',_0x22ebf1[_0x7bae('0x8')],_0x22ebf1[_0x7bae('0x48')]));channels[_0x22ebf1[_0x7bae('0x8')]][_0x7bae('0x56')]=_0x22ebf1[_0x7bae('0x48')];}if(!_[_0x7bae('0x20')](_0x22ebf1[_0x7bae('0x46')][_0x7bae('0x57')])){utils['info'](util[_0x7bae('0x14')](_0x7bae('0x58'),_0x22ebf1['uniqueid'],_0x22ebf1[_0x7bae('0x48')]));channels[_0x22ebf1[_0x7bae('0x8')]][_0x7bae('0x59')]=_0x22ebf1['value'];}if(!_[_0x7bae('0x20')](_0x22ebf1['variable'][_0x7bae('0x5a')])){utils[_0x7bae('0x6')](util[_0x7bae('0x14')](_0x7bae('0x5b'),_0x22ebf1[_0x7bae('0x8')],_0x22ebf1[_0x7bae('0x48')]));channels[_0x22ebf1['uniqueid']][_0x7bae('0x5a')]=_0x22ebf1[_0x7bae('0x48')];}}}catch(_0x26270b){utils[_0x7bae('0x1c')](util[_0x7bae('0x14')](_0x7bae('0x5c'),_0x22ebf1[_0x7bae('0x8')]),_0x26270b);}};exports['newexten']=function(_0x2498bb){try{if(!_[_0x7bae('0x20')](channels[_0x2498bb[_0x7bae('0x8')]])){utils[_0x7bae('0x1e')](util['format']('[%s][calls][newexten]',_0x2498bb[_0x7bae('0x8')]),_0x2498bb);utils['info'](util[_0x7bae('0x14')](_0x7bae('0x5d'),_0x2498bb[_0x7bae('0x8')],_0x2498bb[_0x7bae('0x5e')],_0x2498bb[_0x7bae('0x5f')]));if(_0x2498bb['application'][_0x7bae('0x60')]()==_0x7bae('0x61')&&_['startsWith'](_0x2498bb[_0x7bae('0x5f')]['toLowerCase'](),'cdr')){var _0xc86a55=_0x2498bb[_0x7bae('0x5f')][_0x7bae('0x62')]('=');var _0x29b14c=_0xc86a55[0x0][_0x7bae('0x63')](_0xc86a55[0x0]['lastIndexOf']('(')+0x1,_0xc86a55[0x0][_0x7bae('0x64')](')'));var _0x6383c3=_0xc86a55[0x1];channels[_0x2498bb[_0x7bae('0x8')]][_0x29b14c]=_0x6383c3;}if(!_['includes']([_0x7bae('0x2a'),_0x7bae('0x65'),_0x7bae('0x66'),_0x7bae('0x61'),_0x7bae('0x67')],_0x2498bb[_0x7bae('0x5e')][_0x7bae('0x60')]())){channels[_0x2498bb[_0x7bae('0x8')]][_0x7bae('0x4f')]=_0x2498bb[_0x7bae('0x5e')];channels[_0x2498bb['uniqueid']][_0x7bae('0x51')]=_0x2498bb[_0x7bae('0x5f')];}}}catch(_0x3b3a14){utils[_0x7bae('0x1c')](util[_0x7bae('0x14')](_0x7bae('0x68'),_0x2498bb['uniqueid']),_0x3b3a14);}}; \ No newline at end of file diff --git a/server/services/xdr/core.controller.js b/server/services/xdr/core.controller.js index 8e1d592..38dea0d 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 _0x922f=['fullybooted','[core]\x20fullybooted','error','[core]\x20close','managerevent','./utils','connect','info','[core]\x20connected','shutdown','[core]\x20shutdown'];(function(_0x4c5bde,_0x51a0b8){var _0x12d0a1=function(_0x2e025f){while(--_0x2e025f){_0x4c5bde['push'](_0x4c5bde['shift']());}};_0x12d0a1(++_0x51a0b8);}(_0x922f,0x1b2));var _0xf922=function(_0xb84795,_0x199305){_0xb84795=_0xb84795-0x0;var _0x1ee336=_0x922f[_0xb84795];return _0x1ee336;};'use strict';var utils=require(_0xf922('0x0'));exports[_0xf922('0x1')]=function(){utils[_0xf922('0x2')](_0xf922('0x3'));};exports[_0xf922('0x4')]=function(){utils[_0xf922('0x2')](_0xf922('0x5'));};exports[_0xf922('0x6')]=function(){utils[_0xf922('0x2')](_0xf922('0x7'));};exports[_0xf922('0x8')]=function(_0x2c4b91){utils[_0xf922('0x8')]('[core]\x20error',_0x2c4b91);};exports['close']=function(){utils[_0xf922('0x2')](_0xf922('0x9'));};exports[_0xf922('0xa')]=function(_0x4d3091){}; \ No newline at end of file +var _0x6483=['[core]\x20fullybooted','error','[core]\x20error','[core]\x20close','managerevent','./utils','connect','[core]\x20shutdown','fullybooted','info'];(function(_0x3cec8f,_0x2f1203){var _0x9b793b=function(_0x1e137d){while(--_0x1e137d){_0x3cec8f['push'](_0x3cec8f['shift']());}};_0x9b793b(++_0x2f1203);}(_0x6483,0xa5));var _0x3648=function(_0x389459,_0x29f58d){_0x389459=_0x389459-0x0;var _0x3eda0c=_0x6483[_0x389459];return _0x3eda0c;};'use strict';var utils=require(_0x3648('0x0'));exports[_0x3648('0x1')]=function(){utils['info']('[core]\x20connected');};exports['shutdown']=function(){utils['info'](_0x3648('0x2'));};exports[_0x3648('0x3')]=function(){utils[_0x3648('0x4')](_0x3648('0x5'));};exports[_0x3648('0x6')]=function(_0x6daab7){utils[_0x3648('0x6')](_0x3648('0x7'),_0x6daab7);};exports['close']=function(){utils[_0x3648('0x4')](_0x3648('0x8'));};exports[_0x3648('0x9')]=function(_0x3e9aaa){}; \ No newline at end of file diff --git a/server/services/xdr/dials.controller.js b/server/services/xdr/dials.controller.js index 5befe73..ee97648 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 _0x9566=['[%s][dials][writeDB]\x20channel:%s\x20dialstring:%s\x20calleridnum:%s\x20connectedlinenum:%s\x20dialstatus:%s','channel','dialstring','connectedlinenum','request','CreateVoiceDialReport','debug','[%s][dials][newexten]','uniqueid','application','set','startsWith','appdata','toLowerCase','cdr(routeid)','error','varset','[%s][dials][varset]','isNil','variable','[%s][dials][varset]\x20variable:outboundrouteid\x20value:%s','value','[%s][dials][dialbegin]','assign','now','lastevent','called','dialend','[%s][dials][dialend]','dialstatus','ANSWER','answertime','connect','[%s][dials][dialend]\x20dialstatus:%s\x20answertime:%s\x20lastevent:connect','hangup','[%s][dials][hangup]','[%s][dials][hangup]\x20calleridnum:%s\x20calleridname:%s\x20lastevent:complete\x20reason:%s','calleridnum','calleridname','complete','duration','diffTime','endtime','starttime','holdtime','billableseconds','lodash','util','./utils','info','format'];(function(_0x6ebfc4,_0x14375b){var _0xda2af2=function(_0x52d9a1){while(--_0x52d9a1){_0x6ebfc4['push'](_0x6ebfc4['shift']());}};_0xda2af2(++_0x14375b);}(_0x9566,0x193));var _0x6956=function(_0x122ef9,_0x451d2a){_0x122ef9=_0x122ef9-0x0;var _0x42fba0=_0x9566[_0x122ef9];return _0x42fba0;};'use strict';var _=require(_0x6956('0x0'));var util=require(_0x6956('0x1'));var utils=require(_0x6956('0x2'));var dials={};function writeDB(_0x4189c4){utils[_0x6956('0x3')](util[_0x6956('0x4')](_0x6956('0x5'),_0x4189c4['uniqueid'],_0x4189c4[_0x6956('0x6')],_0x4189c4[_0x6956('0x7')],_0x4189c4['calleridnum'],_0x4189c4[_0x6956('0x8')],_0x4189c4['dialstatus']));utils[_0x6956('0x9')](_0x6956('0xa'),_0x4189c4);delete dials[_0x4189c4['uniqueid']];}exports['newexten']=function(_0x2e648a){try{utils[_0x6956('0xb')](util[_0x6956('0x4')](_0x6956('0xc'),_0x2e648a[_0x6956('0xd')]),_0x2e648a);utils[_0x6956('0x3')](util['format']('[%s][dials][newexten]\x20application:%s\x20appdata:%s',_0x2e648a['uniqueid'],_0x2e648a[_0x6956('0xe')],_0x2e648a['appdata']));if(_0x2e648a[_0x6956('0xe')]['toLowerCase']()==_0x6956('0xf')&&_[_0x6956('0x10')](_0x2e648a[_0x6956('0x11')][_0x6956('0x12')](),_0x6956('0x13'))){var _0x509f62=_0x2e648a[_0x6956('0x11')]['split']('=');dials[_0x2e648a[_0x6956('0xd')]]={'routeId':_0x509f62[0x1]};}}catch(_0x30d67d){utils[_0x6956('0x14')](util[_0x6956('0x4')](_0x6956('0xc'),_0x2e648a[_0x6956('0xd')]),_0x30d67d);}};exports[_0x6956('0x15')]=function(_0x2213a5){try{utils['debug'](util['format'](_0x6956('0x16'),_0x2213a5[_0x6956('0xd')]),_0x2213a5);if(!_[_0x6956('0x17')](_0x2213a5[_0x6956('0x18')]['outboundrouteid'])){utils[_0x6956('0x3')](util['format'](_0x6956('0x19'),_0x2213a5[_0x6956('0xd')],_0x2213a5[_0x6956('0x1a')]));dials[_0x2213a5['uniqueid']]={'routeId':_0x2213a5[_0x6956('0x1a')]};}}catch(_0x17bdda){utils['error'](util[_0x6956('0x4')](_0x6956('0x16'),_0x2213a5['uniqueid']),_0x17bdda);}};exports['dialbegin']=function(_0x1ab595){try{if(!_[_0x6956('0x17')](dials[_0x1ab595[_0x6956('0xd')]])){utils['debug'](util[_0x6956('0x4')](_0x6956('0x1b'),_0x1ab595[_0x6956('0xd')]),_0x1ab595);dials[_0x1ab595[_0x6956('0xd')]]=_[_0x6956('0x1c')](dials[_0x1ab595[_0x6956('0xd')]],_0x1ab595);dials[_0x1ab595[_0x6956('0xd')]]['starttime']=utils[_0x6956('0x1d')]();dials[_0x1ab595[_0x6956('0xd')]][_0x6956('0x1e')]=_0x6956('0x1f');utils[_0x6956('0x3')](util[_0x6956('0x4')]('[%s][dials][hangup]\x20starttime:%s\x20lastevent:called',_0x1ab595['uniqueid'],dials[_0x1ab595[_0x6956('0xd')]]['starttime']));}}catch(_0x30eb0b){utils[_0x6956('0x14')](util[_0x6956('0x4')]('[%s][dials][dialbegin]',_0x1ab595[_0x6956('0xd')]),_0x30eb0b);}};exports[_0x6956('0x20')]=function(_0x1ad2b5){try{if(!_[_0x6956('0x17')](dials[_0x1ad2b5[_0x6956('0xd')]])){utils[_0x6956('0xb')](util['format'](_0x6956('0x21'),_0x1ad2b5[_0x6956('0xd')]),_0x1ad2b5);dials[_0x1ad2b5['uniqueid']]['dialstatus']=_0x1ad2b5['dialstatus'];if(_0x1ad2b5[_0x6956('0x22')]==_0x6956('0x23')){dials[_0x1ad2b5[_0x6956('0xd')]]=_[_0x6956('0x1c')](dials[_0x1ad2b5[_0x6956('0xd')]],_0x1ad2b5);dials[_0x1ad2b5[_0x6956('0xd')]][_0x6956('0x24')]=utils[_0x6956('0x1d')]();dials[_0x1ad2b5[_0x6956('0xd')]][_0x6956('0x1e')]=_0x6956('0x25');utils[_0x6956('0x3')](util[_0x6956('0x4')](_0x6956('0x26'),_0x1ad2b5[_0x6956('0xd')],_0x1ad2b5['dialstatus'],dials[_0x1ad2b5[_0x6956('0xd')]][_0x6956('0x24')]));}else{utils[_0x6956('0x3')](util['format']('[%s][dials][dialend]\x20dialstatus:%s',_0x1ad2b5[_0x6956('0xd')],_0x1ad2b5['dialstatus']));}}}catch(_0xe46c50){utils[_0x6956('0x14')](util['format'](_0x6956('0x21'),_0x1ad2b5['uniqueid']),_0xe46c50);}};exports[_0x6956('0x27')]=function(_0x2332ea){try{if(!_[_0x6956('0x17')](dials[_0x2332ea[_0x6956('0xd')]])){utils[_0x6956('0xb')](util['format'](_0x6956('0x28'),_0x2332ea['uniqueid']),_0x2332ea);utils[_0x6956('0x3')](util[_0x6956('0x4')](_0x6956('0x29'),_0x2332ea[_0x6956('0xd')],_0x2332ea[_0x6956('0x2a')],_0x2332ea[_0x6956('0x2b')],_0x2332ea['cause-txt']));dials[_0x2332ea[_0x6956('0xd')]]=_[_0x6956('0x1c')](dials[_0x2332ea['uniqueid']],{'endtime':utils[_0x6956('0x1d')](),'lastevent':_0x6956('0x2c')});dials[_0x2332ea[_0x6956('0xd')]][_0x6956('0x2d')]=utils[_0x6956('0x2e')](dials[_0x2332ea[_0x6956('0xd')]][_0x6956('0x2f')],dials[_0x2332ea['uniqueid']][_0x6956('0x30')]);dials[_0x2332ea['uniqueid']][_0x6956('0x31')]=utils[_0x6956('0x2e')](dials[_0x2332ea[_0x6956('0xd')]][_0x6956('0x24')]||dials[_0x2332ea[_0x6956('0xd')]][_0x6956('0x2f')],dials[_0x2332ea[_0x6956('0xd')]][_0x6956('0x30')]);dials[_0x2332ea['uniqueid']][_0x6956('0x32')]=dials[_0x2332ea['uniqueid']]['answertime']?utils[_0x6956('0x2e')](dials[_0x2332ea[_0x6956('0xd')]][_0x6956('0x2f')],dials[_0x2332ea[_0x6956('0xd')]][_0x6956('0x24')]):0x0;writeDB(dials[_0x2332ea[_0x6956('0xd')]]);}}catch(_0x4a8eb4){utils['error'](util[_0x6956('0x4')](_0x6956('0x28'),_0x2332ea[_0x6956('0xd')]),_0x4a8eb4);}}; \ No newline at end of file +var _0xb8b3=['format','[%s][dials][writeDB]\x20channel:%s\x20dialstring:%s\x20calleridnum:%s\x20connectedlinenum:%s\x20dialstatus:%s','uniqueid','channel','calleridnum','connectedlinenum','dialstatus','request','CreateVoiceDialReport','newexten','[%s][dials][newexten]','application','appdata','toLowerCase','set','startsWith','split','error','varset','debug','isNil','outboundrouteid','[%s][dials][varset]\x20variable:outboundrouteid\x20value:%s','value','[%s][dials][varset]','dialbegin','[%s][dials][dialbegin]','assign','starttime','now','lastevent','called','[%s][dials][hangup]\x20starttime:%s\x20lastevent:called','dialend','[%s][dials][dialend]','ANSWER','[%s][dials][dialend]\x20dialstatus:%s\x20answertime:%s\x20lastevent:connect','answertime','[%s][dials][dialend]\x20dialstatus:%s','hangup','[%s][dials][hangup]','calleridname','cause-txt','complete','duration','diffTime','endtime','billableseconds','lodash','util','./utils','info'];(function(_0x48d7b3,_0xe993d2){var _0x4a2937=function(_0x2865d9){while(--_0x2865d9){_0x48d7b3['push'](_0x48d7b3['shift']());}};_0x4a2937(++_0xe993d2);}(_0xb8b3,0x134));var _0x3b8b=function(_0x502598,_0x1e95c8){_0x502598=_0x502598-0x0;var _0xbdee21=_0xb8b3[_0x502598];return _0xbdee21;};'use strict';var _=require(_0x3b8b('0x0'));var util=require(_0x3b8b('0x1'));var utils=require(_0x3b8b('0x2'));var dials={};function writeDB(_0x3bcdd7){utils[_0x3b8b('0x3')](util[_0x3b8b('0x4')](_0x3b8b('0x5'),_0x3bcdd7[_0x3b8b('0x6')],_0x3bcdd7[_0x3b8b('0x7')],_0x3bcdd7['dialstring'],_0x3bcdd7[_0x3b8b('0x8')],_0x3bcdd7[_0x3b8b('0x9')],_0x3bcdd7[_0x3b8b('0xa')]));utils[_0x3b8b('0xb')](_0x3b8b('0xc'),_0x3bcdd7);delete dials[_0x3bcdd7[_0x3b8b('0x6')]];}exports[_0x3b8b('0xd')]=function(_0x34cdcc){try{utils['debug'](util[_0x3b8b('0x4')](_0x3b8b('0xe'),_0x34cdcc[_0x3b8b('0x6')]),_0x34cdcc);utils[_0x3b8b('0x3')](util['format']('[%s][dials][newexten]\x20application:%s\x20appdata:%s',_0x34cdcc[_0x3b8b('0x6')],_0x34cdcc[_0x3b8b('0xf')],_0x34cdcc[_0x3b8b('0x10')]));if(_0x34cdcc['application'][_0x3b8b('0x11')]()==_0x3b8b('0x12')&&_[_0x3b8b('0x13')](_0x34cdcc[_0x3b8b('0x10')][_0x3b8b('0x11')](),'cdr(routeid)')){var _0x4e2082=_0x34cdcc['appdata'][_0x3b8b('0x14')]('=');dials[_0x34cdcc[_0x3b8b('0x6')]]={'routeId':_0x4e2082[0x1]};}}catch(_0x19921d){utils[_0x3b8b('0x15')](util[_0x3b8b('0x4')]('[%s][dials][newexten]',_0x34cdcc[_0x3b8b('0x6')]),_0x19921d);}};exports[_0x3b8b('0x16')]=function(_0x4e25cd){try{utils[_0x3b8b('0x17')](util[_0x3b8b('0x4')]('[%s][dials][varset]',_0x4e25cd[_0x3b8b('0x6')]),_0x4e25cd);if(!_[_0x3b8b('0x18')](_0x4e25cd['variable'][_0x3b8b('0x19')])){utils[_0x3b8b('0x3')](util[_0x3b8b('0x4')](_0x3b8b('0x1a'),_0x4e25cd[_0x3b8b('0x6')],_0x4e25cd[_0x3b8b('0x1b')]));dials[_0x4e25cd[_0x3b8b('0x6')]]={'routeId':_0x4e25cd['value']};}}catch(_0x392012){utils[_0x3b8b('0x15')](util[_0x3b8b('0x4')](_0x3b8b('0x1c'),_0x4e25cd[_0x3b8b('0x6')]),_0x392012);}};exports[_0x3b8b('0x1d')]=function(_0x191559){try{if(!_['isNil'](dials[_0x191559[_0x3b8b('0x6')]])){utils[_0x3b8b('0x17')](util[_0x3b8b('0x4')](_0x3b8b('0x1e'),_0x191559[_0x3b8b('0x6')]),_0x191559);dials[_0x191559[_0x3b8b('0x6')]]=_[_0x3b8b('0x1f')](dials[_0x191559[_0x3b8b('0x6')]],_0x191559);dials[_0x191559[_0x3b8b('0x6')]][_0x3b8b('0x20')]=utils[_0x3b8b('0x21')]();dials[_0x191559[_0x3b8b('0x6')]][_0x3b8b('0x22')]=_0x3b8b('0x23');utils[_0x3b8b('0x3')](util[_0x3b8b('0x4')](_0x3b8b('0x24'),_0x191559['uniqueid'],dials[_0x191559[_0x3b8b('0x6')]][_0x3b8b('0x20')]));}}catch(_0x4a5df5){utils[_0x3b8b('0x15')](util['format']('[%s][dials][dialbegin]',_0x191559[_0x3b8b('0x6')]),_0x4a5df5);}};exports[_0x3b8b('0x25')]=function(_0x3a753e){try{if(!_[_0x3b8b('0x18')](dials[_0x3a753e['uniqueid']])){utils['debug'](util['format'](_0x3b8b('0x26'),_0x3a753e[_0x3b8b('0x6')]),_0x3a753e);dials[_0x3a753e['uniqueid']]['dialstatus']=_0x3a753e['dialstatus'];if(_0x3a753e[_0x3b8b('0xa')]==_0x3b8b('0x27')){dials[_0x3a753e[_0x3b8b('0x6')]]=_['assign'](dials[_0x3a753e[_0x3b8b('0x6')]],_0x3a753e);dials[_0x3a753e['uniqueid']]['answertime']=utils['now']();dials[_0x3a753e[_0x3b8b('0x6')]][_0x3b8b('0x22')]='connect';utils[_0x3b8b('0x3')](util[_0x3b8b('0x4')](_0x3b8b('0x28'),_0x3a753e[_0x3b8b('0x6')],_0x3a753e[_0x3b8b('0xa')],dials[_0x3a753e[_0x3b8b('0x6')]][_0x3b8b('0x29')]));}else{utils[_0x3b8b('0x3')](util[_0x3b8b('0x4')](_0x3b8b('0x2a'),_0x3a753e['uniqueid'],_0x3a753e[_0x3b8b('0xa')]));}}}catch(_0x1e3cd6){utils[_0x3b8b('0x15')](util[_0x3b8b('0x4')](_0x3b8b('0x26'),_0x3a753e[_0x3b8b('0x6')]),_0x1e3cd6);}};exports[_0x3b8b('0x2b')]=function(_0x5c378c){try{if(!_['isNil'](dials[_0x5c378c['uniqueid']])){utils['debug'](util[_0x3b8b('0x4')](_0x3b8b('0x2c'),_0x5c378c[_0x3b8b('0x6')]),_0x5c378c);utils[_0x3b8b('0x3')](util[_0x3b8b('0x4')]('[%s][dials][hangup]\x20calleridnum:%s\x20calleridname:%s\x20lastevent:complete\x20reason:%s',_0x5c378c[_0x3b8b('0x6')],_0x5c378c[_0x3b8b('0x8')],_0x5c378c[_0x3b8b('0x2d')],_0x5c378c[_0x3b8b('0x2e')]));dials[_0x5c378c[_0x3b8b('0x6')]]=_['assign'](dials[_0x5c378c[_0x3b8b('0x6')]],{'endtime':utils[_0x3b8b('0x21')](),'lastevent':_0x3b8b('0x2f')});dials[_0x5c378c[_0x3b8b('0x6')]][_0x3b8b('0x30')]=utils[_0x3b8b('0x31')](dials[_0x5c378c['uniqueid']][_0x3b8b('0x32')],dials[_0x5c378c[_0x3b8b('0x6')]][_0x3b8b('0x20')]);dials[_0x5c378c[_0x3b8b('0x6')]]['holdtime']=utils[_0x3b8b('0x31')](dials[_0x5c378c[_0x3b8b('0x6')]]['answertime']||dials[_0x5c378c[_0x3b8b('0x6')]][_0x3b8b('0x32')],dials[_0x5c378c[_0x3b8b('0x6')]][_0x3b8b('0x20')]);dials[_0x5c378c[_0x3b8b('0x6')]][_0x3b8b('0x33')]=dials[_0x5c378c[_0x3b8b('0x6')]]['answertime']?utils[_0x3b8b('0x31')](dials[_0x5c378c['uniqueid']][_0x3b8b('0x32')],dials[_0x5c378c[_0x3b8b('0x6')]]['answertime']):0x0;writeDB(dials[_0x5c378c[_0x3b8b('0x6')]]);}}catch(_0x3ea82d){utils[_0x3b8b('0x15')](util[_0x3b8b('0x4')]('[%s][dials][hangup]',_0x5c378c[_0x3b8b('0x6')]),_0x3ea82d);}}; \ No newline at end of file diff --git a/server/services/xdr/index.js b/server/services/xdr/index.js index 6864bbe..fdc31c2 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 _0x09fa=['[%s][index][dialbegin]','[%s][index][dialend]','dialend','asterisk-manager','../../config/environment','util','xdr','disabled','env','production','local','port','asterisk','username','password','keepConnected','info','Asterisk\x20disabled\x20on\x20localhost','./agents.controller','./calls.controller','./queues.controller','./recordings.controller','./members.controller','./dials.controller','./transfers.controller','./core.controller','connect','shutdown','fullybooted','error','close','managerevent','devicestatechange','[%s][index][devicestatechange]','device','agentcalled','format','[%s][index][agentcalled]','uniqueid','agentringnoanswer','debug','[%s][index][agentringnoanswer]','agentconnect','[%s][index][agentconnect]','agentcomplete','[%s][index][agentcomplete]','queuecallerabandon','[%s][index][queuecallerabandon]','[%s][index][queuecallerjoin]','queuecallerjoin','queuecallerleave','[%s][index][queuecallerleave]','musiconholdstart','[%s][index][musiconholdstart]','musiconholdstop','[%s][index][musiconholdstop]','[%s][index][newstate]','newstate','[%s][index][hangup]','hangup','cdr','[%s][index][cdr]','blindtransfer','[%s][index][blindtransfer]','attendedtransfer','[%s][index][attendedtransfer]','origtransfereruniqueid','varset','[%s][index][varset]','newexten','[%s][index][newexten]','newchannel','[%s][index][newchannel]','dialbegin'];(function(_0x576d95,_0x214fc6){var _0x3eeab8=function(_0x7afdc1){while(--_0x7afdc1){_0x576d95['push'](_0x576d95['shift']());}};_0x3eeab8(++_0x214fc6);}(_0x09fa,0x97));var _0xa09f=function(_0x500419,_0x549162){_0x500419=_0x500419-0x0;var _0x241c1a=_0x09fa[_0x500419];return _0x241c1a;};var AsteriskManager=require(_0xa09f('0x0'));var config=require(_0xa09f('0x1'));var utils=require('./utils');var util=require(_0xa09f('0x2'));var isXDREnabled=config[_0xa09f('0x3')]&&config[_0xa09f('0x3')][_0xa09f('0x4')]?!config[_0xa09f('0x3')][_0xa09f('0x4')]:!![];var isProduction=config[_0xa09f('0x5')]===_0xa09f('0x6')||![];var isLocalAsterisk=config[_0xa09f('0x3')]&&config[_0xa09f('0x3')][_0xa09f('0x7')]===!![]||![];var ami=new AsteriskManager(config['asterisk'][_0xa09f('0x8')],config['asterisk']['ip'],config[_0xa09f('0x9')][_0xa09f('0xa')],config[_0xa09f('0x9')][_0xa09f('0xb')],!![]);ami[_0xa09f('0xc')]();if(!isXDREnabled){utils['info']('XDR\x20DISABLED');}else if(!isProduction&&!isLocalAsterisk){utils[_0xa09f('0xd')](_0xa09f('0xe'));}else{var agents=require(_0xa09f('0xf'));var calls=require(_0xa09f('0x10'));var queues=require(_0xa09f('0x11'));var recordings=require(_0xa09f('0x12'));var members=require(_0xa09f('0x13'));var dials=require(_0xa09f('0x14'));var transfers=require(_0xa09f('0x15'));var core=require(_0xa09f('0x16'));ami['on'](_0xa09f('0x17'),core[_0xa09f('0x17')]);ami['on'](_0xa09f('0x18'),core['shutdown']);ami['on'](_0xa09f('0x19'),core[_0xa09f('0x19')]);ami['on'](_0xa09f('0x1a'),core['error']);ami['on'](_0xa09f('0x1b'),core[_0xa09f('0x1b')]);ami['on']('managerevent',core[_0xa09f('0x1c')]);ami['on'](_0xa09f('0x1d'),function(_0x40550a){try{utils['debug'](util['format'](_0xa09f('0x1e'),_0x40550a[_0xa09f('0x1f')]),_0x40550a);members[_0xa09f('0x1d')](_0x40550a);}catch(_0xaabd15){utils[_0xa09f('0x1a')](util['format'](_0xa09f('0x1e'),_0x40550a[_0xa09f('0x1f')]),_0xaabd15);}});ami['on'](_0xa09f('0x20'),function(_0x2be61e){try{utils['debug'](util[_0xa09f('0x21')](_0xa09f('0x22'),_0x2be61e['uniqueid']),_0x2be61e);agents[_0xa09f('0x20')](_0x2be61e);}catch(_0x5d4701){utils['error'](util[_0xa09f('0x21')](_0xa09f('0x22'),_0x2be61e[_0xa09f('0x23')]),_0x5d4701);}});ami['on'](_0xa09f('0x24'),function(_0x224ca1){try{utils[_0xa09f('0x25')](util[_0xa09f('0x21')](_0xa09f('0x26'),_0x224ca1['uniqueid']),_0x224ca1);agents[_0xa09f('0x24')](_0x224ca1);}catch(_0x2e203a){utils[_0xa09f('0x1a')](util['format']('[%s][index][agentringnoanswer]',_0x224ca1[_0xa09f('0x23')]),_0x2e203a);}});ami['on'](_0xa09f('0x27'),function(_0x1df2af){try{utils[_0xa09f('0x25')](util[_0xa09f('0x21')](_0xa09f('0x28'),_0x1df2af[_0xa09f('0x23')]),_0x1df2af);agents['agentconnect'](_0x1df2af);queues[_0xa09f('0x27')](_0x1df2af);}catch(_0x25be5c){utils[_0xa09f('0x1a')](util[_0xa09f('0x21')]('[%s][index][agentconnect]',_0x1df2af[_0xa09f('0x23')]),_0x25be5c);}});ami['on'](_0xa09f('0x29'),function(_0x3b0623){try{utils[_0xa09f('0x25')](util[_0xa09f('0x21')](_0xa09f('0x2a'),_0x3b0623[_0xa09f('0x23')]),_0x3b0623);agents[_0xa09f('0x29')](_0x3b0623);queues[_0xa09f('0x29')](_0x3b0623);members[_0xa09f('0x29')](_0x3b0623);}catch(_0x470099){utils[_0xa09f('0x1a')](util[_0xa09f('0x21')]('[%s][index][agentcomplete]',_0x3b0623[_0xa09f('0x23')]),_0x470099);}});ami['on'](_0xa09f('0x2b'),function(_0x585208){try{utils[_0xa09f('0x25')](util[_0xa09f('0x21')](_0xa09f('0x2c'),_0x585208['uniqueid']),_0x585208);agents[_0xa09f('0x2b')](_0x585208);queues['queuecallerabandon'](_0x585208);}catch(_0x53eb52){utils[_0xa09f('0x1a')](util[_0xa09f('0x21')](_0xa09f('0x2c'),_0x585208[_0xa09f('0x23')]),_0x53eb52);}});ami['on']('queuecallerjoin',function(_0x48fbbf){try{utils[_0xa09f('0x25')](util['format'](_0xa09f('0x2d'),_0x48fbbf['uniqueid']),_0x48fbbf);queues[_0xa09f('0x2e')](_0x48fbbf);recordings[_0xa09f('0x2e')](_0x48fbbf);}catch(_0x1a4e6c){utils[_0xa09f('0x1a')](util[_0xa09f('0x21')](_0xa09f('0x2d'),_0x48fbbf[_0xa09f('0x23')]),_0x1a4e6c);}});ami['on'](_0xa09f('0x2f'),function(_0x3f1740){try{utils[_0xa09f('0x25')](util['format'](_0xa09f('0x30'),_0x3f1740['uniqueid']),_0x3f1740);queues[_0xa09f('0x2f')](_0x3f1740);}catch(_0x31366d){utils[_0xa09f('0x1a')](util['format'](_0xa09f('0x30'),_0x3f1740[_0xa09f('0x23')]),_0x31366d);}});ami['on'](_0xa09f('0x31'),function(_0x31d7da){try{utils[_0xa09f('0x25')](util[_0xa09f('0x21')]('[%s][index][musiconholdstart]',_0x31d7da['uniqueid']),_0x31d7da);queues[_0xa09f('0x31')](_0x31d7da);calls[_0xa09f('0x31')](_0x31d7da);}catch(_0x12a003){utils[_0xa09f('0x1a')](util[_0xa09f('0x21')](_0xa09f('0x32'),_0x31d7da[_0xa09f('0x23')]),_0x12a003);}});ami['on'](_0xa09f('0x33'),function(_0xd35799){try{utils['debug'](util[_0xa09f('0x21')](_0xa09f('0x34'),_0xd35799[_0xa09f('0x23')]),_0xd35799);queues[_0xa09f('0x33')](_0xd35799);calls[_0xa09f('0x33')](_0xd35799);}catch(_0x32929e){utils[_0xa09f('0x1a')](util[_0xa09f('0x21')]('[%s][index][musiconholdstop]',_0xd35799[_0xa09f('0x23')]),_0x32929e);}});ami['on']('newstate',function(_0x11b245){try{utils['debug'](util[_0xa09f('0x21')](_0xa09f('0x35'),_0x11b245[_0xa09f('0x23')]),_0x11b245);calls[_0xa09f('0x36')](_0x11b245);recordings[_0xa09f('0x36')](_0x11b245);}catch(_0x127250){utils[_0xa09f('0x1a')](util['format']('[%s][index][newstate]',_0x11b245[_0xa09f('0x23')]),_0x127250);}});ami['on']('hangup',function(_0x9735c6){try{utils[_0xa09f('0x25')](util['format'](_0xa09f('0x37'),_0x9735c6[_0xa09f('0x23')]),_0x9735c6);calls[_0xa09f('0x38')](_0x9735c6);recordings[_0xa09f('0x38')](_0x9735c6);dials['hangup'](_0x9735c6);agents[_0xa09f('0x38')](_0x9735c6);queues[_0xa09f('0x38')](_0x9735c6);}catch(_0x2d77a6){utils[_0xa09f('0x1a')](util[_0xa09f('0x21')](_0xa09f('0x37'),_0x9735c6[_0xa09f('0x23')]),_0x2d77a6);}});ami['on'](_0xa09f('0x39'),function(_0x329ce6){try{utils[_0xa09f('0x25')](util[_0xa09f('0x21')](_0xa09f('0x3a'),_0x329ce6['uniqueid']),_0x329ce6);members['cdr'](_0x329ce6);}catch(_0x5c2fe4){utils[_0xa09f('0x1a')](util['format'](_0xa09f('0x3a'),_0x329ce6[_0xa09f('0x23')]),_0x5c2fe4);}});ami['on'](_0xa09f('0x3b'),function(_0x4292c5){try{utils[_0xa09f('0x25')](util['format'](_0xa09f('0x3c'),_0x4292c5['uniqueid']),_0x4292c5);queues[_0xa09f('0x3b')](_0x4292c5);agents['blindtransfer'](_0x4292c5);transfers['blindtransfer'](_0x4292c5);}catch(_0x406a82){utils['error'](util[_0xa09f('0x21')]('[%s][index][blindtransfer]',_0x4292c5['uniqueid']),_0x406a82);}});ami['on'](_0xa09f('0x3d'),function(_0x5f3686){try{utils[_0xa09f('0x25')](util[_0xa09f('0x21')](_0xa09f('0x3e'),_0x5f3686[_0xa09f('0x3f')]),_0x5f3686);queues[_0xa09f('0x3d')](_0x5f3686);transfers['attendedtransfer'](_0x5f3686);agents['attendedtransfer'](_0x5f3686);calls[_0xa09f('0x3d')](_0x5f3686);}catch(_0xde3873){utils['error'](util['format']('[%s][index][attendedtransfer]',_0x5f3686[_0xa09f('0x3f')]),_0xde3873);}});ami['on'](_0xa09f('0x40'),function(_0x3dfc5b){try{utils[_0xa09f('0x25')](util[_0xa09f('0x21')]('[%s][index][varset]',_0x3dfc5b[_0xa09f('0x23')]),_0x3dfc5b);queues[_0xa09f('0x40')](_0x3dfc5b);recordings['varset'](_0x3dfc5b);calls[_0xa09f('0x40')](_0x3dfc5b);dials[_0xa09f('0x40')](_0x3dfc5b);}catch(_0x3d7e9e){utils[_0xa09f('0x1a')](util[_0xa09f('0x21')](_0xa09f('0x41'),_0x3dfc5b[_0xa09f('0x23')]),_0x3d7e9e);}});ami['on'](_0xa09f('0x42'),function(_0x3d08a3){try{utils[_0xa09f('0x25')](util[_0xa09f('0x21')]('[%s][index][newexten]',_0x3d08a3[_0xa09f('0x23')]),_0x3d08a3);calls[_0xa09f('0x42')](_0x3d08a3);recordings[_0xa09f('0x42')](_0x3d08a3);dials[_0xa09f('0x42')](_0x3d08a3);}catch(_0x48d602){utils[_0xa09f('0x1a')](util[_0xa09f('0x21')](_0xa09f('0x43'),_0x3d08a3[_0xa09f('0x23')]),_0x48d602);}});ami['on'](_0xa09f('0x44'),function(_0x36adfd){try{utils[_0xa09f('0x25')](util[_0xa09f('0x21')](_0xa09f('0x45'),_0x36adfd[_0xa09f('0x23')]),_0x36adfd);calls[_0xa09f('0x44')](_0x36adfd);recordings[_0xa09f('0x44')](_0x36adfd);}catch(_0x30ab99){utils[_0xa09f('0x1a')](util[_0xa09f('0x21')]('[%s][index][newchannel]',_0x36adfd[_0xa09f('0x23')]),_0x30ab99);}});ami['on'](_0xa09f('0x46'),function(_0x29bcd1){try{utils[_0xa09f('0x25')](util['format'](_0xa09f('0x47'),_0x29bcd1[_0xa09f('0x23')]),_0x29bcd1);dials['dialbegin'](_0x29bcd1);}catch(_0x2e1107){utils[_0xa09f('0x1a')](util[_0xa09f('0x21')]('[%s]dialbegin',_0x29bcd1[_0xa09f('0x23')]),_0x2e1107);}});ami['on']('dialend',function(_0x4bee8e){try{utils[_0xa09f('0x25')](util[_0xa09f('0x21')](_0xa09f('0x48'),_0x4bee8e[_0xa09f('0x23')]),_0x4bee8e);dials[_0xa09f('0x49')](_0x4bee8e);}catch(_0x28401a){utils[_0xa09f('0x1a')](util['format'](_0xa09f('0x48'),_0x4bee8e['uniqueid']),_0x28401a);}});} \ No newline at end of file +var _0x8ee0=['shutdown','fullybooted','error','close','managerevent','debug','format','device','devicestatechange','[%s][index][devicestatechange]','agentcalled','[%s][index][agentcalled]','uniqueid','agentringnoanswer','[%s][index][agentringnoanswer]','agentconnect','[%s][index][agentconnect]','agentcomplete','queuecallerabandon','[%s][index][queuecallerabandon]','queuecallerjoin','[%s][index][queuecallerjoin]','queuecallerleave','[%s][index][queuecallerleave]','musiconholdstart','[%s][index][musiconholdstart]','musiconholdstop','[%s][index][musiconholdstop]','newstate','[%s][index][newstate]','hangup','[%s][index][hangup]','[%s][index][cdr]','cdr','[%s][index][blindtransfer]','blindtransfer','attendedtransfer','[%s][index][attendedtransfer]','varset','[%s][index][varset]','newexten','[%s][index][newexten]','newchannel','[%s][index][newchannel]','dialbegin','[%s][index][dialbegin]','[%s]dialbegin','dialend','[%s][index][dialend]','asterisk-manager','../../config/environment','./utils','util','xdr','disabled','env','production','local','port','asterisk','keepConnected','XDR\x20DISABLED','Asterisk\x20disabled\x20on\x20localhost','./agents.controller','./queues.controller','./recordings.controller','./members.controller','./dials.controller','./transfers.controller','connect'];(function(_0x4bf7b0,_0x52053a){var _0x14949e=function(_0x1a8355){while(--_0x1a8355){_0x4bf7b0['push'](_0x4bf7b0['shift']());}};_0x14949e(++_0x52053a);}(_0x8ee0,0x103));var _0x08ee=function(_0x307086,_0x3bfe4e){_0x307086=_0x307086-0x0;var _0x699043=_0x8ee0[_0x307086];return _0x699043;};var AsteriskManager=require(_0x08ee('0x0'));var config=require(_0x08ee('0x1'));var utils=require(_0x08ee('0x2'));var util=require(_0x08ee('0x3'));var isXDREnabled=config[_0x08ee('0x4')]&&config[_0x08ee('0x4')][_0x08ee('0x5')]?!config[_0x08ee('0x4')][_0x08ee('0x5')]:!![];var isProduction=config[_0x08ee('0x6')]===_0x08ee('0x7')||![];var isLocalAsterisk=config[_0x08ee('0x4')]&&config['xdr'][_0x08ee('0x8')]===!![]||![];var ami=new AsteriskManager(config['asterisk'][_0x08ee('0x9')],config['asterisk']['ip'],config[_0x08ee('0xa')]['username'],config['asterisk']['password'],!![]);ami[_0x08ee('0xb')]();if(!isXDREnabled){utils['info'](_0x08ee('0xc'));}else if(!isProduction&&!isLocalAsterisk){utils['info'](_0x08ee('0xd'));}else{var agents=require(_0x08ee('0xe'));var calls=require('./calls.controller');var queues=require(_0x08ee('0xf'));var recordings=require(_0x08ee('0x10'));var members=require(_0x08ee('0x11'));var dials=require(_0x08ee('0x12'));var transfers=require(_0x08ee('0x13'));var core=require('./core.controller');ami['on'](_0x08ee('0x14'),core[_0x08ee('0x14')]);ami['on']('shutdown',core[_0x08ee('0x15')]);ami['on'](_0x08ee('0x16'),core['fullybooted']);ami['on'](_0x08ee('0x17'),core[_0x08ee('0x17')]);ami['on'](_0x08ee('0x18'),core['close']);ami['on'](_0x08ee('0x19'),core[_0x08ee('0x19')]);ami['on']('devicestatechange',function(_0x5c868f){try{utils[_0x08ee('0x1a')](util[_0x08ee('0x1b')]('[%s][index][devicestatechange]',_0x5c868f[_0x08ee('0x1c')]),_0x5c868f);members[_0x08ee('0x1d')](_0x5c868f);}catch(_0x539763){utils[_0x08ee('0x17')](util[_0x08ee('0x1b')](_0x08ee('0x1e'),_0x5c868f['device']),_0x539763);}});ami['on'](_0x08ee('0x1f'),function(_0x430f86){try{utils[_0x08ee('0x1a')](util[_0x08ee('0x1b')](_0x08ee('0x20'),_0x430f86[_0x08ee('0x21')]),_0x430f86);agents[_0x08ee('0x1f')](_0x430f86);}catch(_0x2c546e){utils[_0x08ee('0x17')](util[_0x08ee('0x1b')](_0x08ee('0x20'),_0x430f86[_0x08ee('0x21')]),_0x2c546e);}});ami['on'](_0x08ee('0x22'),function(_0x216ada){try{utils[_0x08ee('0x1a')](util[_0x08ee('0x1b')](_0x08ee('0x23'),_0x216ada[_0x08ee('0x21')]),_0x216ada);agents[_0x08ee('0x22')](_0x216ada);}catch(_0x54eee0){utils['error'](util[_0x08ee('0x1b')]('[%s][index][agentringnoanswer]',_0x216ada[_0x08ee('0x21')]),_0x54eee0);}});ami['on'](_0x08ee('0x24'),function(_0xa73aaf){try{utils[_0x08ee('0x1a')](util[_0x08ee('0x1b')]('[%s][index][agentconnect]',_0xa73aaf[_0x08ee('0x21')]),_0xa73aaf);agents['agentconnect'](_0xa73aaf);queues[_0x08ee('0x24')](_0xa73aaf);}catch(_0x5085bb){utils[_0x08ee('0x17')](util[_0x08ee('0x1b')](_0x08ee('0x25'),_0xa73aaf['uniqueid']),_0x5085bb);}});ami['on'](_0x08ee('0x26'),function(_0x1b7367){try{utils['debug'](util[_0x08ee('0x1b')]('[%s][index][agentcomplete]',_0x1b7367[_0x08ee('0x21')]),_0x1b7367);agents[_0x08ee('0x26')](_0x1b7367);queues[_0x08ee('0x26')](_0x1b7367);members[_0x08ee('0x26')](_0x1b7367);}catch(_0x440340){utils[_0x08ee('0x17')](util['format']('[%s][index][agentcomplete]',_0x1b7367[_0x08ee('0x21')]),_0x440340);}});ami['on'](_0x08ee('0x27'),function(_0x36c216){try{utils['debug'](util[_0x08ee('0x1b')](_0x08ee('0x28'),_0x36c216[_0x08ee('0x21')]),_0x36c216);agents[_0x08ee('0x27')](_0x36c216);queues[_0x08ee('0x27')](_0x36c216);}catch(_0x2eff20){utils[_0x08ee('0x17')](util[_0x08ee('0x1b')](_0x08ee('0x28'),_0x36c216['uniqueid']),_0x2eff20);}});ami['on'](_0x08ee('0x29'),function(_0x497d79){try{utils[_0x08ee('0x1a')](util[_0x08ee('0x1b')](_0x08ee('0x2a'),_0x497d79[_0x08ee('0x21')]),_0x497d79);queues[_0x08ee('0x29')](_0x497d79);recordings[_0x08ee('0x29')](_0x497d79);}catch(_0x36f48f){utils[_0x08ee('0x17')](util[_0x08ee('0x1b')](_0x08ee('0x2a'),_0x497d79[_0x08ee('0x21')]),_0x36f48f);}});ami['on'](_0x08ee('0x2b'),function(_0x5c881a){try{utils['debug'](util['format'](_0x08ee('0x2c'),_0x5c881a[_0x08ee('0x21')]),_0x5c881a);queues[_0x08ee('0x2b')](_0x5c881a);}catch(_0x3b4688){utils[_0x08ee('0x17')](util[_0x08ee('0x1b')]('[%s][index][queuecallerleave]',_0x5c881a[_0x08ee('0x21')]),_0x3b4688);}});ami['on']('musiconholdstart',function(_0x35b112){try{utils[_0x08ee('0x1a')](util[_0x08ee('0x1b')]('[%s][index][musiconholdstart]',_0x35b112['uniqueid']),_0x35b112);queues[_0x08ee('0x2d')](_0x35b112);calls[_0x08ee('0x2d')](_0x35b112);}catch(_0x1254fe){utils[_0x08ee('0x17')](util['format'](_0x08ee('0x2e'),_0x35b112[_0x08ee('0x21')]),_0x1254fe);}});ami['on'](_0x08ee('0x2f'),function(_0x3b5239){try{utils[_0x08ee('0x1a')](util[_0x08ee('0x1b')](_0x08ee('0x30'),_0x3b5239[_0x08ee('0x21')]),_0x3b5239);queues['musiconholdstop'](_0x3b5239);calls[_0x08ee('0x2f')](_0x3b5239);}catch(_0x3dada9){utils['error'](util[_0x08ee('0x1b')](_0x08ee('0x30'),_0x3b5239[_0x08ee('0x21')]),_0x3dada9);}});ami['on'](_0x08ee('0x31'),function(_0x867f55){try{utils[_0x08ee('0x1a')](util[_0x08ee('0x1b')](_0x08ee('0x32'),_0x867f55['uniqueid']),_0x867f55);calls['newstate'](_0x867f55);recordings['newstate'](_0x867f55);}catch(_0x23b08c){utils[_0x08ee('0x17')](util[_0x08ee('0x1b')](_0x08ee('0x32'),_0x867f55['uniqueid']),_0x23b08c);}});ami['on'](_0x08ee('0x33'),function(_0x3cb431){try{utils[_0x08ee('0x1a')](util['format'](_0x08ee('0x34'),_0x3cb431[_0x08ee('0x21')]),_0x3cb431);calls[_0x08ee('0x33')](_0x3cb431);recordings[_0x08ee('0x33')](_0x3cb431);dials['hangup'](_0x3cb431);agents[_0x08ee('0x33')](_0x3cb431);queues[_0x08ee('0x33')](_0x3cb431);}catch(_0x27ba50){utils[_0x08ee('0x17')](util['format'](_0x08ee('0x34'),_0x3cb431['uniqueid']),_0x27ba50);}});ami['on']('cdr',function(_0x45372e){try{utils[_0x08ee('0x1a')](util[_0x08ee('0x1b')](_0x08ee('0x35'),_0x45372e[_0x08ee('0x21')]),_0x45372e);members[_0x08ee('0x36')](_0x45372e);}catch(_0x532683){utils['error'](util[_0x08ee('0x1b')]('[%s][index][cdr]',_0x45372e[_0x08ee('0x21')]),_0x532683);}});ami['on']('blindtransfer',function(_0x2f294b){try{utils[_0x08ee('0x1a')](util[_0x08ee('0x1b')](_0x08ee('0x37'),_0x2f294b[_0x08ee('0x21')]),_0x2f294b);queues[_0x08ee('0x38')](_0x2f294b);agents['blindtransfer'](_0x2f294b);transfers['blindtransfer'](_0x2f294b);}catch(_0x1dab89){utils[_0x08ee('0x17')](util[_0x08ee('0x1b')]('[%s][index][blindtransfer]',_0x2f294b[_0x08ee('0x21')]),_0x1dab89);}});ami['on'](_0x08ee('0x39'),function(_0x2caf95){try{utils[_0x08ee('0x1a')](util[_0x08ee('0x1b')](_0x08ee('0x3a'),_0x2caf95['origtransfereruniqueid']),_0x2caf95);queues['attendedtransfer'](_0x2caf95);transfers[_0x08ee('0x39')](_0x2caf95);agents[_0x08ee('0x39')](_0x2caf95);calls['attendedtransfer'](_0x2caf95);}catch(_0x45a2dd){utils[_0x08ee('0x17')](util[_0x08ee('0x1b')](_0x08ee('0x3a'),_0x2caf95['origtransfereruniqueid']),_0x45a2dd);}});ami['on'](_0x08ee('0x3b'),function(_0x13d946){try{utils[_0x08ee('0x1a')](util[_0x08ee('0x1b')]('[%s][index][varset]',_0x13d946[_0x08ee('0x21')]),_0x13d946);queues['varset'](_0x13d946);recordings[_0x08ee('0x3b')](_0x13d946);calls[_0x08ee('0x3b')](_0x13d946);dials[_0x08ee('0x3b')](_0x13d946);}catch(_0x187758){utils['error'](util[_0x08ee('0x1b')](_0x08ee('0x3c'),_0x13d946[_0x08ee('0x21')]),_0x187758);}});ami['on'](_0x08ee('0x3d'),function(_0x1ba896){try{utils['debug'](util[_0x08ee('0x1b')](_0x08ee('0x3e'),_0x1ba896[_0x08ee('0x21')]),_0x1ba896);calls[_0x08ee('0x3d')](_0x1ba896);recordings[_0x08ee('0x3d')](_0x1ba896);dials[_0x08ee('0x3d')](_0x1ba896);}catch(_0x592194){utils[_0x08ee('0x17')](util['format']('[%s][index][newexten]',_0x1ba896[_0x08ee('0x21')]),_0x592194);}});ami['on'](_0x08ee('0x3f'),function(_0xd104fe){try{utils['debug'](util[_0x08ee('0x1b')]('[%s][index][newchannel]',_0xd104fe[_0x08ee('0x21')]),_0xd104fe);calls[_0x08ee('0x3f')](_0xd104fe);recordings[_0x08ee('0x3f')](_0xd104fe);}catch(_0xe9090e){utils[_0x08ee('0x17')](util['format'](_0x08ee('0x40'),_0xd104fe[_0x08ee('0x21')]),_0xe9090e);}});ami['on'](_0x08ee('0x41'),function(_0x51038d){try{utils[_0x08ee('0x1a')](util[_0x08ee('0x1b')](_0x08ee('0x42'),_0x51038d[_0x08ee('0x21')]),_0x51038d);dials[_0x08ee('0x41')](_0x51038d);}catch(_0x34dad1){utils[_0x08ee('0x17')](util[_0x08ee('0x1b')](_0x08ee('0x43'),_0x51038d['uniqueid']),_0x34dad1);}});ami['on'](_0x08ee('0x44'),function(_0x4de4bd){try{utils[_0x08ee('0x1a')](util[_0x08ee('0x1b')](_0x08ee('0x45'),_0x4de4bd['uniqueid']),_0x4de4bd);dials['dialend'](_0x4de4bd);}catch(_0x5d3796){utils[_0x08ee('0x17')](util[_0x08ee('0x1b')](_0x08ee('0x45'),_0x4de4bd[_0x08ee('0x21')]),_0x5d3796);}});} \ No newline at end of file diff --git a/server/services/xdr/members.controller.js b/server/services/xdr/members.controller.js index 61e7274..e54aebc 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 _0x16d2=['channel','data2','membername','type','getUserByInterface','name','internal','request','getUserByName','split','then','catch','[%s][members][writeDB]','some','startsWith','devicestatechange','debug','[%s][members][devicestatechange]','device','state','BUSY','voice','now','agent','NOT_INUSE','isNil','exitAt','enterAt','uniqueid','agentcomplete','[%s][members][agentcomplete]','queue','assign','error','cdr','[%s][members][cdr]','data1','source','data3','destinationchannel','[%s][members][cdr]\x20type:%s\x20source:%s\x20destination:%s','lodash','util','./utils','Local/_attended@transfer','Queue:','info','format','[%s][members][writeDB]\x20interface:%s\x20channel:%s\x20data2:%s\x20agent:%s\x20type:%s','interface'];(function(_0x44aec9,_0x52a392){var _0x3d6741=function(_0x523a96){while(--_0x523a96){_0x44aec9['push'](_0x44aec9['shift']());}};_0x3d6741(++_0x52a392);}(_0x16d2,0x123));var _0x216d=function(_0x475993,_0x844c92){_0x475993=_0x475993-0x0;var _0x237a25=_0x16d2[_0x475993];return _0x237a25;};'use strict';var _=require(_0x216d('0x0'));var util=require(_0x216d('0x1'));var utils=require(_0x216d('0x2'));var members={};var exclude=[_0x216d('0x3'),_0x216d('0x4')];function writeDB(_0x3a2589){utils[_0x216d('0x5')](util[_0x216d('0x6')](_0x216d('0x7'),_0x3a2589['uniqueid'],_0x3a2589[_0x216d('0x8')],_0x3a2589[_0x216d('0x9')],_0x3a2589[_0x216d('0xa')],_0x3a2589[_0x216d('0xb')],_0x3a2589[_0x216d('0xc')]));if(_0x3a2589[_0x216d('0x8')]){utils[_0x216d('0xd')](_0x3a2589[_0x216d('0x8')])['then'](function(_0x22c7b3){if(_0x22c7b3){_0x3a2589[_0x216d('0xb')]=_0x22c7b3[_0x216d('0xe')];_0x3a2589[_0x216d('0xf')]=_0x22c7b3[_0x216d('0xf')];utils[_0x216d('0x10')]('CreateMemberReport',_0x3a2589);}else{utils[_0x216d('0x11')](_0x3a2589['interface'][_0x216d('0x12')]('/')[0x1])[_0x216d('0x13')](function(_0x332e30){if(_0x332e30){_0x3a2589[_0x216d('0xb')]=_0x332e30[_0x216d('0xe')];_0x3a2589[_0x216d('0xf')]=_0x332e30['internal'];utils[_0x216d('0x10')]('CreateMemberReport',_0x3a2589);}});}})[_0x216d('0x14')](function(_0xfb7154){utils['error'](util[_0x216d('0x6')](_0x216d('0x15'),_0x3a2589['uniqueid']),_0xfb7154);});}delete members[_0x3a2589[_0x216d('0x8')]];}function startsWith(_0x494e92,_0x448c0d){return _[_0x216d('0x16')](_0x494e92,function(_0x4631b0){return _[_0x216d('0x17')](_0x448c0d,_0x4631b0);});}exports[_0x216d('0x18')]=function(_0x304dfa){try{utils[_0x216d('0x19')](util[_0x216d('0x6')](_0x216d('0x1a'),members[_0x304dfa['device']]?members[_0x304dfa[_0x216d('0x1b')]]['uniqueid']:_0x304dfa['device']),_0x304dfa);utils[_0x216d('0x5')](util[_0x216d('0x6')]('[%s][members][devicestatechange]\x20state:%s\x20interface:%s',members[_0x304dfa[_0x216d('0x1b')]]?members[_0x304dfa[_0x216d('0x1b')]]['uniqueid']:_0x304dfa[_0x216d('0x1b')],_0x304dfa[_0x216d('0x1c')],_0x304dfa[_0x216d('0x1b')]));switch(_0x304dfa[_0x216d('0x1c')]){case'INUSE':case _0x216d('0x1d'):if(!startsWith(exclude,_0x304dfa[_0x216d('0x1b')])){members[_0x304dfa[_0x216d('0x1b')]]={'channel':_0x216d('0x1e'),'interface':_0x304dfa[_0x216d('0x1b')],'type':'TALKING','enterAt':utils[_0x216d('0x1f')](),'role':_0x216d('0x20')};}break;case _0x216d('0x21'):if(!_[_0x216d('0x22')](members[_0x304dfa[_0x216d('0x1b')]])){members[_0x304dfa['device']][_0x216d('0x23')]=utils[_0x216d('0x1f')]();members[_0x304dfa[_0x216d('0x1b')]]['duration']=utils['diffTime'](members[_0x304dfa['device']]['exitAt'],members[_0x304dfa['device']][_0x216d('0x24')]);if(members[_0x304dfa[_0x216d('0x1b')]][_0x216d('0x25')]){writeDB(members[_0x304dfa[_0x216d('0x1b')]]);}}break;default:break;}}catch(_0x46d0ef){utils['error'](util['format'](_0x216d('0x1a'),members[_0x304dfa['device']]?members[_0x304dfa[_0x216d('0x1b')]][_0x216d('0x25')]:_0x304dfa[_0x216d('0x1b')]),_0x46d0ef);}};exports[_0x216d('0x26')]=function(_0x307f2b){try{if(!_[_0x216d('0x22')](members[_0x307f2b[_0x216d('0x8')]])){utils[_0x216d('0x19')](util[_0x216d('0x6')](_0x216d('0x27'),_0x307f2b[_0x216d('0x25')]),_0x307f2b);utils[_0x216d('0x5')](util[_0x216d('0x6')]('[%s][members][agentcomplete]\x20interface:%s\x20queue:%s',_0x307f2b[_0x216d('0x25')],_0x307f2b[_0x216d('0x8')],_0x307f2b[_0x216d('0x28')]));members[_0x307f2b['interface']]=_[_0x216d('0x29')](members[_0x307f2b[_0x216d('0x8')]],{'data4':_0x307f2b[_0x216d('0x28')],'uniqueid':_0x307f2b[_0x216d('0x25')]});}}catch(_0x5f3054){utils[_0x216d('0x2a')](util[_0x216d('0x6')](_0x216d('0x27'),_0x307f2b[_0x216d('0x25')]),_0x5f3054);}};exports[_0x216d('0x2b')]=function(_0x208bb6){try{utils[_0x216d('0x19')](util[_0x216d('0x6')](_0x216d('0x2c'),_0x208bb6[_0x216d('0x25')]),_0x208bb6);if(_0x208bb6[_0x216d('0x9')]){var _0x4a2caa=_0x208bb6[_0x216d('0x9')][_0x216d('0x12')]('-')[0x0];if(!_[_0x216d('0x22')](members[_0x4a2caa])){members[_0x4a2caa]=_['assign'](members[_0x4a2caa],{'data1':members[_0x4a2caa][_0x216d('0x2d')]||_0x208bb6[_0x216d('0xc')],'data2':members[_0x4a2caa]['data2']||_0x208bb6[_0x216d('0x2e')],'data3':members[_0x4a2caa]['data3']||_0x208bb6['destination'],'uniqueid':members[_0x4a2caa][_0x216d('0x25')]||_0x208bb6[_0x216d('0x25')]});utils[_0x216d('0x5')](util[_0x216d('0x6')]('[%s][members][cdr]\x20type:%s\x20source:%s\x20destination:%s',_0x208bb6['uniqueid'],members[_0x4a2caa]['data1'],members[_0x4a2caa][_0x216d('0xa')],members[_0x4a2caa][_0x216d('0x2f')]));if(members[_0x4a2caa]['exitAt']){writeDB(members[_0x4a2caa]);}}}if(_0x208bb6[_0x216d('0x30')]){var _0x2e334b=_0x208bb6['destinationchannel'][_0x216d('0x12')]('-')[0x0];if(!_[_0x216d('0x22')](members[_0x2e334b])){members[_0x2e334b]=_[_0x216d('0x29')](members[_0x2e334b],{'data1':members[_0x2e334b][_0x216d('0x2d')]||_0x208bb6[_0x216d('0xc')],'data2':members[_0x2e334b][_0x216d('0xa')]||_0x208bb6[_0x216d('0x2e')],'data3':members[_0x2e334b][_0x216d('0x2f')]||_0x208bb6['destination'],'uniqueid':members[_0x2e334b]['uniqueid']||_0x208bb6[_0x216d('0x25')]});utils[_0x216d('0x5')](util['format'](_0x216d('0x31'),_0x208bb6[_0x216d('0x25')],members[_0x2e334b][_0x216d('0x2d')],members[_0x2e334b]['data2'],members[_0x2e334b][_0x216d('0x2f')]));if(members[_0x2e334b][_0x216d('0x23')]){writeDB(members[_0x2e334b]);}}}}catch(_0x13d787){utils[_0x216d('0x2a')](util['format'](_0x216d('0x2c'),_0x208bb6[_0x216d('0x25')]),_0x13d787);}}; \ No newline at end of file +var _0xbfb8=['name','internal','request','CreateMemberReport','split','then','catch','[%s][members][writeDB]','uniqueid','some','startsWith','[%s][members][devicestatechange]','device','info','[%s][members][devicestatechange]\x20state:%s\x20interface:%s','state','INUSE','BUSY','TALKING','NOT_INUSE','isNil','exitAt','duration','diffTime','enterAt','error','agentcomplete','debug','[%s][members][agentcomplete]\x20interface:%s\x20queue:%s','assign','queue','[%s][members][agentcomplete]','cdr','[%s][members][cdr]','data2','source','data3','data1','destinationchannel','[%s][members][cdr]\x20type:%s\x20source:%s\x20destination:%s','lodash','util','./utils','Local/_attended@transfer','Queue:','format','[%s][members][writeDB]\x20interface:%s\x20channel:%s\x20data2:%s\x20agent:%s\x20type:%s','channel','type','interface','getUserByInterface','membername'];(function(_0x3a26c7,_0x37b63e){var _0x445881=function(_0x14709b){while(--_0x14709b){_0x3a26c7['push'](_0x3a26c7['shift']());}};_0x445881(++_0x37b63e);}(_0xbfb8,0x194));var _0x8bfb=function(_0x2aaaad,_0x1ace00){_0x2aaaad=_0x2aaaad-0x0;var _0xffb6cc=_0xbfb8[_0x2aaaad];return _0xffb6cc;};'use strict';var _=require(_0x8bfb('0x0'));var util=require(_0x8bfb('0x1'));var utils=require(_0x8bfb('0x2'));var members={};var exclude=[_0x8bfb('0x3'),_0x8bfb('0x4')];function writeDB(_0x339a46){utils['info'](util[_0x8bfb('0x5')](_0x8bfb('0x6'),_0x339a46['uniqueid'],_0x339a46['interface'],_0x339a46[_0x8bfb('0x7')],_0x339a46['data2'],_0x339a46['membername'],_0x339a46[_0x8bfb('0x8')]));if(_0x339a46[_0x8bfb('0x9')]){utils[_0x8bfb('0xa')](_0x339a46[_0x8bfb('0x9')])['then'](function(_0x234db1){if(_0x234db1){_0x339a46[_0x8bfb('0xb')]=_0x234db1[_0x8bfb('0xc')];_0x339a46[_0x8bfb('0xd')]=_0x234db1[_0x8bfb('0xd')];utils[_0x8bfb('0xe')](_0x8bfb('0xf'),_0x339a46);}else{utils['getUserByName'](_0x339a46[_0x8bfb('0x9')][_0x8bfb('0x10')]('/')[0x1])[_0x8bfb('0x11')](function(_0x577006){if(_0x577006){_0x339a46[_0x8bfb('0xb')]=_0x577006[_0x8bfb('0xc')];_0x339a46[_0x8bfb('0xd')]=_0x577006[_0x8bfb('0xd')];utils[_0x8bfb('0xe')](_0x8bfb('0xf'),_0x339a46);}});}})[_0x8bfb('0x12')](function(_0xdde196){utils['error'](util[_0x8bfb('0x5')](_0x8bfb('0x13'),_0x339a46[_0x8bfb('0x14')]),_0xdde196);});}delete members[_0x339a46[_0x8bfb('0x9')]];}function startsWith(_0x3bf2a4,_0x40a9ce){return _[_0x8bfb('0x15')](_0x3bf2a4,function(_0x164df9){return _[_0x8bfb('0x16')](_0x40a9ce,_0x164df9);});}exports['devicestatechange']=function(_0x317092){try{utils['debug'](util[_0x8bfb('0x5')](_0x8bfb('0x17'),members[_0x317092[_0x8bfb('0x18')]]?members[_0x317092[_0x8bfb('0x18')]]['uniqueid']:_0x317092[_0x8bfb('0x18')]),_0x317092);utils[_0x8bfb('0x19')](util[_0x8bfb('0x5')](_0x8bfb('0x1a'),members[_0x317092[_0x8bfb('0x18')]]?members[_0x317092[_0x8bfb('0x18')]][_0x8bfb('0x14')]:_0x317092['device'],_0x317092['state'],_0x317092[_0x8bfb('0x18')]));switch(_0x317092[_0x8bfb('0x1b')]){case _0x8bfb('0x1c'):case _0x8bfb('0x1d'):if(!startsWith(exclude,_0x317092[_0x8bfb('0x18')])){members[_0x317092[_0x8bfb('0x18')]]={'channel':'voice','interface':_0x317092['device'],'type':_0x8bfb('0x1e'),'enterAt':utils['now'](),'role':'agent'};}break;case _0x8bfb('0x1f'):if(!_[_0x8bfb('0x20')](members[_0x317092[_0x8bfb('0x18')]])){members[_0x317092['device']][_0x8bfb('0x21')]=utils['now']();members[_0x317092['device']][_0x8bfb('0x22')]=utils[_0x8bfb('0x23')](members[_0x317092[_0x8bfb('0x18')]][_0x8bfb('0x21')],members[_0x317092[_0x8bfb('0x18')]][_0x8bfb('0x24')]);if(members[_0x317092['device']][_0x8bfb('0x14')]){writeDB(members[_0x317092['device']]);}}break;default:break;}}catch(_0x2801ad){utils[_0x8bfb('0x25')](util[_0x8bfb('0x5')](_0x8bfb('0x17'),members[_0x317092['device']]?members[_0x317092['device']][_0x8bfb('0x14')]:_0x317092[_0x8bfb('0x18')]),_0x2801ad);}};exports[_0x8bfb('0x26')]=function(_0x5e05f4){try{if(!_[_0x8bfb('0x20')](members[_0x5e05f4[_0x8bfb('0x9')]])){utils[_0x8bfb('0x27')](util['format']('[%s][members][agentcomplete]',_0x5e05f4[_0x8bfb('0x14')]),_0x5e05f4);utils[_0x8bfb('0x19')](util['format'](_0x8bfb('0x28'),_0x5e05f4[_0x8bfb('0x14')],_0x5e05f4[_0x8bfb('0x9')],_0x5e05f4['queue']));members[_0x5e05f4[_0x8bfb('0x9')]]=_[_0x8bfb('0x29')](members[_0x5e05f4[_0x8bfb('0x9')]],{'data4':_0x5e05f4[_0x8bfb('0x2a')],'uniqueid':_0x5e05f4['uniqueid']});}}catch(_0x5ec405){utils[_0x8bfb('0x25')](util[_0x8bfb('0x5')](_0x8bfb('0x2b'),_0x5e05f4[_0x8bfb('0x14')]),_0x5ec405);}};exports[_0x8bfb('0x2c')]=function(_0x580147){try{utils['debug'](util[_0x8bfb('0x5')](_0x8bfb('0x2d'),_0x580147[_0x8bfb('0x14')]),_0x580147);if(_0x580147[_0x8bfb('0x7')]){var _0x58c0b3=_0x580147['channel'][_0x8bfb('0x10')]('-')[0x0];if(!_[_0x8bfb('0x20')](members[_0x58c0b3])){members[_0x58c0b3]=_[_0x8bfb('0x29')](members[_0x58c0b3],{'data1':members[_0x58c0b3]['data1']||_0x580147[_0x8bfb('0x8')],'data2':members[_0x58c0b3][_0x8bfb('0x2e')]||_0x580147[_0x8bfb('0x2f')],'data3':members[_0x58c0b3][_0x8bfb('0x30')]||_0x580147['destination'],'uniqueid':members[_0x58c0b3][_0x8bfb('0x14')]||_0x580147[_0x8bfb('0x14')]});utils[_0x8bfb('0x19')](util[_0x8bfb('0x5')]('[%s][members][cdr]\x20type:%s\x20source:%s\x20destination:%s',_0x580147['uniqueid'],members[_0x58c0b3][_0x8bfb('0x31')],members[_0x58c0b3][_0x8bfb('0x2e')],members[_0x58c0b3]['data3']));if(members[_0x58c0b3][_0x8bfb('0x21')]){writeDB(members[_0x58c0b3]);}}}if(_0x580147[_0x8bfb('0x32')]){var _0x5f59f6=_0x580147[_0x8bfb('0x32')][_0x8bfb('0x10')]('-')[0x0];if(!_['isNil'](members[_0x5f59f6])){members[_0x5f59f6]=_[_0x8bfb('0x29')](members[_0x5f59f6],{'data1':members[_0x5f59f6][_0x8bfb('0x31')]||_0x580147[_0x8bfb('0x8')],'data2':members[_0x5f59f6][_0x8bfb('0x2e')]||_0x580147[_0x8bfb('0x2f')],'data3':members[_0x5f59f6][_0x8bfb('0x30')]||_0x580147['destination'],'uniqueid':members[_0x5f59f6]['uniqueid']||_0x580147[_0x8bfb('0x14')]});utils[_0x8bfb('0x19')](util['format'](_0x8bfb('0x33'),_0x580147[_0x8bfb('0x14')],members[_0x5f59f6][_0x8bfb('0x31')],members[_0x5f59f6][_0x8bfb('0x2e')],members[_0x5f59f6][_0x8bfb('0x30')]));if(members[_0x5f59f6][_0x8bfb('0x21')]){writeDB(members[_0x5f59f6]);}}}}catch(_0xcc220d){utils[_0x8bfb('0x25')](util[_0x8bfb('0x5')](_0x8bfb('0x2d'),_0x580147['uniqueid']),_0xcc220d);}}; \ No newline at end of file diff --git a/server/services/xdr/queues.controller.js b/server/services/xdr/queues.controller.js index f05f958..ac69bc8 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 _0xcace=['[%s][queues][musiconholdstop]','diffTime','[%s][queues][musiconholdstop]\x20name:%s\x20mohtime:%s','lodash','util','./utils','info','format','[%s][queues][writeDB]\x20channel:%s\x20queue:%s\x20lastAssignedTo:%s\x20calleridnum:%s\x20accountcode:%s\x20queuecallerexitreason:%s','queue','calleridnum','accountcode','queuecallerexitreason','getVoiceQueueByName','type','request','CreateVoiceQueueReport','transfereduniqueid','queuecallerjoin','debug','[%s][queues][queuecallerjoin]','uniqueid','position','assign','now','error','queuecallerleaveAt','queuecallerabandon','queuecallercomplete','queuecallercompleteAt','COMPLETEDBYAGENT','[%s][queues][hangup]\x20name:%s\x20queuecallerexitreason:%s','[%s][queues][hangup]\x20name:%s\x20transfereduniqueid:%s','name','queuecallerenterreason','[%s][queues][hangup]','varset','[%s][queues][varset]','isNil','variable','value','toUpperCase','queuecallerabandonAt','queuecallerexit','queuecallerexitAt','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','connectedlinenum','connectedlinename','holdtime','queuecallerjoinAt','count','agentconnect','[%s][queues][agentconnect]','[%s][queues][agentconnect]\x20name:%s\x20agent:%s\x20accountcode:%s','membername','destaccountcode','assigned','agentcomplete','[%s][queues][agentcomplete]','lastAssignedTo','reason','transfer','COMPLETEDBY','[%s][queues][agentcomplete]\x20name:%s\x20agent:%s\x20queuecallerexitreason:%s','blindtransfer','transfereeuniqueid','[%s][queues][blindtransfer]','transfertype','transferexten','extension','attendedtransfer','[%s][queues][attendedtransfer]','origtransfereruniqueid','secondtransfererlinkedid','origtransfererexten','ATTENDED','transferuniqueid','ATTENDEDTRANSFER','origtransfererlinkedid','transfereelinkedid','clone','transfertargetuniqueid','calleridname','mohtime','[%s][queues][attendedtransfer]\x20name:%s\x20calleridnum:%s\x20calleridname:%s','secondtransfereruniqueid','secondtransfererexten','transfertargetlinkedid','[%s][queues][attendedtransfer]\x20name:%s\x20transfereduniqueid:%s\x20calleridnum:%s\x20calleridname:%s','[%s][queues][attendedtransfer]\x20name:%s\x20transfereduniqueid:%s','[%s][queues][musiconholdstart]','[%s][queues][musiconholdstop]\x20name:%s\x20musiconholdstartAt:%s','musiconholdstartAt','musiconholdstop'];(function(_0x56e60b,_0x3c1bdc){var _0x305ce1=function(_0x98659c){while(--_0x98659c){_0x56e60b['push'](_0x56e60b['shift']());}};_0x305ce1(++_0x3c1bdc);}(_0xcace,0x69));var _0xecac=function(_0x1a26d7,_0xb59032){_0x1a26d7=_0x1a26d7-0x0;var _0xa7c428=_0xcace[_0x1a26d7];return _0xa7c428;};'use strict';var _=require(_0xecac('0x0'));var util=require(_0xecac('0x1'));var utils=require(_0xecac('0x2'));var queues={};function writeDB(_0x3ca234){utils[_0xecac('0x3')](util[_0xecac('0x4')](_0xecac('0x5'),_0x3ca234['uniqueid'],_0x3ca234['channel'],_0x3ca234[_0xecac('0x6')],_0x3ca234['lastAssignedTo'],_0x3ca234[_0xecac('0x7')],_0x3ca234[_0xecac('0x8')],_0x3ca234[_0xecac('0x9')]));if(_0x3ca234[_0xecac('0x6')]){utils[_0xecac('0xa')](_0x3ca234['queue'])['then'](function(_0x1f034a){if(_0x1f034a){_0x3ca234[_0xecac('0xb')]=_0x1f034a['type'];}utils[_0xecac('0xc')]('CreateVoiceQueueReport',_0x3ca234);});}else{utils[_0xecac('0xc')](_0xecac('0xd'),_0x3ca234);}if(_0x3ca234['transfereduniqueid']){delete queues[_0x3ca234[_0xecac('0xe')]];}else{delete queues[_0x3ca234['uniqueid']];}}exports[_0xecac('0xf')]=function(_0x31d2b3){try{utils[_0xecac('0x10')](util[_0xecac('0x4')](_0xecac('0x11'),_0x31d2b3['uniqueid']),_0x31d2b3);utils[_0xecac('0x3')](util[_0xecac('0x4')]('[%s][queues][queuecallerjoin]\x20name:%s\x20position:%s',_0x31d2b3[_0xecac('0x12')],_0x31d2b3[_0xecac('0x6')],_0x31d2b3[_0xecac('0x13')]));queues[_0x31d2b3[_0xecac('0x12')]]=_[_0xecac('0x14')](_0x31d2b3,{'originalposition':_0x31d2b3[_0xecac('0x13')],'queuecallerjoinAt':utils[_0xecac('0x15')](),'mohtime':0x0});}catch(_0x1ec363){utils[_0xecac('0x16')](util[_0xecac('0x4')](_0xecac('0x11'),_0x31d2b3[_0xecac('0x12')]),_0x1ec363);}};exports['hangup']=function(_0x4dbd38){try{if(!_['isNil'](queues[_0x4dbd38['uniqueid']])){utils['debug'](util[_0xecac('0x4')]('[%s][queues][hangup]',_0x4dbd38[_0xecac('0x12')]),_0x4dbd38);if(queues[_0x4dbd38['uniqueid']][_0xecac('0x17')]){if(!queues[_0x4dbd38[_0xecac('0x12')]][_0xecac('0x18')]&&!queues[_0x4dbd38[_0xecac('0x12')]]['queuecallerexit']){queues[_0x4dbd38[_0xecac('0x12')]][_0xecac('0x19')]=!![];queues[_0x4dbd38['uniqueid']][_0xecac('0x1a')]=utils[_0xecac('0x15')]();queues[_0x4dbd38['uniqueid']][_0xecac('0x9')]=_0xecac('0x1b');}utils[_0xecac('0x3')](util[_0xecac('0x4')](_0xecac('0x1c'),_0x4dbd38[_0xecac('0x12')],queues[_0x4dbd38['uniqueid']]['name'],queues[_0x4dbd38['uniqueid']][_0xecac('0x9')]));writeDB(queues[_0x4dbd38[_0xecac('0x12')]]);}else if(queues[_0x4dbd38['uniqueid']][_0xecac('0xe')]){utils[_0xecac('0x3')](util[_0xecac('0x4')](_0xecac('0x1d'),_0x4dbd38[_0xecac('0x12')],queues[_0x4dbd38[_0xecac('0x12')]][_0xecac('0x1e')],queues[_0x4dbd38[_0xecac('0x12')]][_0xecac('0xe')]));queues[queues[_0x4dbd38[_0xecac('0x12')]][_0xecac('0xe')]]=queues[_0x4dbd38[_0xecac('0x12')]];queues[queues[_0x4dbd38[_0xecac('0x12')]][_0xecac('0xe')]][_0xecac('0x1f')]=0x2;delete queues[_0x4dbd38[_0xecac('0x12')]];}}}catch(_0x2ee343){utils[_0xecac('0x16')](util[_0xecac('0x4')](_0xecac('0x20'),_0x4dbd38[_0xecac('0x12')]),_0x2ee343);}};exports[_0xecac('0x21')]=function(_0x4c6a8d){try{utils[_0xecac('0x10')](util[_0xecac('0x4')](_0xecac('0x22'),_0x4c6a8d['uniqueid']),_0x4c6a8d);if(!_[_0xecac('0x23')](_0x4c6a8d[_0xecac('0x24')]['queuestatus'])&&_0x4c6a8d[_0xecac('0x25')][_0xecac('0x26')]()!=='CONTINUE'){if(!_[_0xecac('0x23')](queues[_0x4c6a8d['uniqueid']])){queues[_0x4c6a8d[_0xecac('0x12')]][_0xecac('0x18')]=![];queues[_0x4c6a8d[_0xecac('0x12')]][_0xecac('0x27')]=null;queues[_0x4c6a8d['uniqueid']][_0xecac('0x28')]=!![];queues[_0x4c6a8d[_0xecac('0x12')]][_0xecac('0x29')]=utils[_0xecac('0x15')]();queues[_0x4c6a8d['uniqueid']][_0xecac('0x9')]=_0x4c6a8d[_0xecac('0x25')][_0xecac('0x26')]();utils[_0xecac('0x3')](util[_0xecac('0x4')]('[%s][queues][varset]\x20name:%s\x20variable:queuestatus\x20value:%s\x20queuecallerexitreason:%s',_0x4c6a8d[_0xecac('0x12')],queues[_0x4c6a8d['uniqueid']][_0xecac('0x1e')],_0x4c6a8d['value'],queues[_0x4c6a8d[_0xecac('0x12')]][_0xecac('0x9')]));writeDB(queues[_0x4c6a8d['uniqueid']]);}}else if(!_[_0xecac('0x23')](_0x4c6a8d[_0xecac('0x24')][_0xecac('0x2a')])){if(!_[_0xecac('0x23')](queues[_0x4c6a8d[_0xecac('0x12')]])&&!queues[_0x4c6a8d[_0xecac('0x12')]][_0xecac('0x18')]){queues[_0x4c6a8d[_0xecac('0x12')]][_0xecac('0x18')]=![];queues[_0x4c6a8d[_0xecac('0x12')]][_0xecac('0x27')]=null;queues[_0x4c6a8d['uniqueid']]['queuecallerexit']=!![];queues[_0x4c6a8d['uniqueid']][_0xecac('0x29')]=utils['now']();queues[_0x4c6a8d[_0xecac('0x12')]][_0xecac('0x9')]=_0xecac('0x2b');utils[_0xecac('0x3')](util['format'](_0xecac('0x2c'),_0x4c6a8d[_0xecac('0x12')],queues[_0x4c6a8d['uniqueid']][_0xecac('0x1e')],_0x4c6a8d[_0xecac('0x25')],queues[_0x4c6a8d[_0xecac('0x12')]][_0xecac('0x9')]));}}}catch(_0x37805e){utils[_0xecac('0x16')](util[_0xecac('0x4')](_0xecac('0x22'),_0x4c6a8d['uniqueid']),_0x37805e);}};exports[_0xecac('0x18')]=function(_0x1f8a9a){try{if(!_[_0xecac('0x23')](queues[_0x1f8a9a[_0xecac('0x12')]])){utils[_0xecac('0x10')](util[_0xecac('0x4')](_0xecac('0x2d'),_0x1f8a9a[_0xecac('0x12')]),_0x1f8a9a);queues[_0x1f8a9a[_0xecac('0x12')]][_0xecac('0x28')]=![];queues[_0x1f8a9a[_0xecac('0x12')]][_0xecac('0x29')]=null;queues[_0x1f8a9a['uniqueid']][_0xecac('0x18')]=!![];queues[_0x1f8a9a[_0xecac('0x12')]][_0xecac('0x27')]=utils[_0xecac('0x15')]();queues[_0x1f8a9a['uniqueid']]['queuecallerexitreason']=_0xecac('0x2e');utils[_0xecac('0x3')](util[_0xecac('0x4')](_0xecac('0x2f'),_0x1f8a9a[_0xecac('0x12')],queues[_0x1f8a9a[_0xecac('0x12')]][_0xecac('0x1e')],queues[_0x1f8a9a['uniqueid']][_0xecac('0x9')]));}}catch(_0x5900bd){utils['error'](util[_0xecac('0x4')](_0xecac('0x2d'),_0x1f8a9a[_0xecac('0x12')]),_0x5900bd);}};exports[_0xecac('0x30')]=function(_0x29a38c){try{if(!_[_0xecac('0x23')](queues[_0x29a38c[_0xecac('0x12')]])){utils['debug'](util[_0xecac('0x4')](_0xecac('0x31'),_0x29a38c['uniqueid']),_0x29a38c);utils[_0xecac('0x3')](util[_0xecac('0x4')](_0xecac('0x32'),_0x29a38c[_0xecac('0x12')],queues[_0x29a38c['uniqueid']]['name'],_0x29a38c[_0xecac('0x33')],_0x29a38c[_0xecac('0x34')]));queues[_0x29a38c[_0xecac('0x12')]][_0xecac('0x30')]=!![];queues[_0x29a38c[_0xecac('0x12')]][_0xecac('0x17')]=utils[_0xecac('0x15')]();queues[_0x29a38c[_0xecac('0x12')]][_0xecac('0x35')]=utils['diffTime'](queues[_0x29a38c[_0xecac('0x12')]]['queuecallerleaveAt'],queues[_0x29a38c['uniqueid']][_0xecac('0x36')]);queues[_0x29a38c[_0xecac('0x12')]][_0xecac('0x13')]=_0x29a38c['position'];queues[_0x29a38c[_0xecac('0x12')]]['count']=_0x29a38c[_0xecac('0x37')];queues[_0x29a38c[_0xecac('0x12')]]['connectedlinenum']=_0x29a38c[_0xecac('0x33')];queues[_0x29a38c[_0xecac('0x12')]][_0xecac('0x34')]=_0x29a38c['connectedlinename'];}}catch(_0xc6c4a3){utils['error'](util['format'](_0xecac('0x31'),_0x29a38c[_0xecac('0x12')]),_0xc6c4a3);}};exports[_0xecac('0x38')]=function(_0x12f9f1){try{if(!_['isNil'](queues[_0x12f9f1[_0xecac('0x12')]])){utils[_0xecac('0x10')](util[_0xecac('0x4')](_0xecac('0x39'),_0x12f9f1[_0xecac('0x12')]),_0x12f9f1);utils[_0xecac('0x3')](util[_0xecac('0x4')](_0xecac('0x3a'),_0x12f9f1[_0xecac('0x12')],queues[_0x12f9f1[_0xecac('0x12')]]['name'],_0x12f9f1[_0xecac('0x3b')],_0x12f9f1[_0xecac('0x3c')]));queues[_0x12f9f1[_0xecac('0x12')]][_0xecac('0x18')]=![];queues[_0x12f9f1[_0xecac('0x12')]][_0xecac('0x18')]=![];queues[_0x12f9f1[_0xecac('0x12')]][_0xecac('0x27')]=null;queues[_0x12f9f1[_0xecac('0x12')]][_0xecac('0x28')]=![];queues[_0x12f9f1['uniqueid']][_0xecac('0x9')]=null;queues[_0x12f9f1[_0xecac('0x12')]][_0xecac('0x29')]=null;queues[_0x12f9f1[_0xecac('0x12')]][_0xecac('0x3d')]=!![];queues[_0x12f9f1[_0xecac('0x12')]]['accountcode']=_0x12f9f1['destaccountcode'];queues[_0x12f9f1[_0xecac('0x12')]]['lastAssignedTo']=_0x12f9f1[_0xecac('0x3b')];}}catch(_0x5e713c){utils[_0xecac('0x16')](util[_0xecac('0x4')](_0xecac('0x39'),_0x12f9f1[_0xecac('0x12')]),_0x5e713c);}};exports[_0xecac('0x3e')]=function(_0x2fe7b0){try{if(!_[_0xecac('0x23')](queues[_0x2fe7b0[_0xecac('0x12')]])){if(queues[_0x2fe7b0['uniqueid']][_0xecac('0x17')]){utils[_0xecac('0x10')](util['format'](_0xecac('0x3f'),_0x2fe7b0[_0xecac('0x12')]),_0x2fe7b0);queues[_0x2fe7b0[_0xecac('0x12')]]['queuecallerabandon']=![];queues[_0x2fe7b0[_0xecac('0x12')]][_0xecac('0x18')]=![];queues[_0x2fe7b0[_0xecac('0x12')]][_0xecac('0x27')]=null;queues[_0x2fe7b0[_0xecac('0x12')]][_0xecac('0x28')]=![];queues[_0x2fe7b0[_0xecac('0x12')]][_0xecac('0x29')]=null;queues[_0x2fe7b0[_0xecac('0x12')]][_0xecac('0x3d')]=!![];queues[_0x2fe7b0['uniqueid']][_0xecac('0x40')]=_0x2fe7b0[_0xecac('0x3b')];queues[_0x2fe7b0[_0xecac('0x12')]][_0xecac('0x19')]=!![];queues[_0x2fe7b0[_0xecac('0x12')]]['queuecallercompleteAt']=utils[_0xecac('0x15')]();if(_0x2fe7b0[_0xecac('0x41')]==_0xecac('0x42')){if(!queues[_0x2fe7b0[_0xecac('0x12')]][_0xecac('0x42')]){queues[_0x2fe7b0[_0xecac('0x12')]][_0xecac('0x9')]='TRANSFER';}}else{queues[_0x2fe7b0[_0xecac('0x12')]][_0xecac('0x9')]=_0xecac('0x43')+_0x2fe7b0['reason']['toUpperCase']();}utils['info'](util[_0xecac('0x4')](_0xecac('0x44'),_0x2fe7b0['uniqueid'],queues[_0x2fe7b0[_0xecac('0x12')]]['name'],_0x2fe7b0[_0xecac('0x3b')],queues[_0x2fe7b0[_0xecac('0x12')]][_0xecac('0x9')]));writeDB(queues[_0x2fe7b0[_0xecac('0x12')]]);}}}catch(_0x250a03){utils[_0xecac('0x16')](util[_0xecac('0x4')](_0xecac('0x3f'),_0x2fe7b0['uniqueid']),_0x250a03);}};exports[_0xecac('0x45')]=function(_0x3260fe){try{if(!_[_0xecac('0x23')](queues[_0x3260fe[_0xecac('0x46')]])){utils[_0xecac('0x10')](util['format'](_0xecac('0x47'),_0x3260fe[_0xecac('0x12')]),_0x3260fe);queues[_0x3260fe[_0xecac('0x46')]][_0xecac('0x42')]=!![];queues[_0x3260fe['transfereeuniqueid']][_0xecac('0x48')]='BLIND';queues[_0x3260fe[_0xecac('0x46')]][_0xecac('0x49')]=_0x3260fe[_0xecac('0x4a')];queues[_0x3260fe[_0xecac('0x46')]]['transferuniqueid']=_0x3260fe[_0xecac('0x46')];queues[_0x3260fe[_0xecac('0x46')]][_0xecac('0x9')]='BLINDTRANSFER';utils[_0xecac('0x3')](util[_0xecac('0x4')]('[%s][queues][blindtransfer]\x20name:%s\x20transferuniqueid:%s\x20transferexten:%s\x20queuecallerexitreason:BLINDTRANSFER',_0x3260fe[_0xecac('0x12')],queues[_0x3260fe[_0xecac('0x46')]][_0xecac('0x1e')],_0x3260fe['transfereeuniqueid'],_0x3260fe[_0xecac('0x4a')]));}}catch(_0x1baa26){utils['error'](util[_0xecac('0x4')]('[%s][queues][blindtransfer]',_0x3260fe[_0xecac('0x12')]),_0x1baa26);}};exports[_0xecac('0x4b')]=function(_0x3514c9){try{utils[_0xecac('0x10')](util[_0xecac('0x4')](_0xecac('0x4c'),_0x3514c9['origtransfereruniqueid']),_0x3514c9);if(_0x3514c9[_0xecac('0x4d')]==_0x3514c9['origtransfererlinkedid']){if(!_[_0xecac('0x23')](queues[_0x3514c9[_0xecac('0x4e')]])){utils['info'](util[_0xecac('0x4')]('[%s][queues][attendedtransfer]\x20name:%s\x20transferexten:%s\x20queuecallerexitreason:ATTENDEDTRANSFER',_0x3514c9[_0xecac('0x4d')],queues[_0x3514c9[_0xecac('0x4e')]][_0xecac('0x1e')],_0x3514c9[_0xecac('0x4f')]));queues[_0x3514c9[_0xecac('0x4e')]][_0xecac('0x42')]=!![];queues[_0x3514c9[_0xecac('0x4e')]][_0xecac('0x48')]=_0xecac('0x50');queues[_0x3514c9[_0xecac('0x4e')]][_0xecac('0x49')]=_0x3514c9['origtransfererexten'];queues[_0x3514c9['secondtransfererlinkedid']][_0xecac('0x51')]=_0x3514c9[_0xecac('0x4d')];queues[_0x3514c9[_0xecac('0x4e')]][_0xecac('0x9')]=_0xecac('0x52');}if(!_['isNil'](queues[_0x3514c9[_0xecac('0x53')]])){if(_0x3514c9[_0xecac('0x54')]&&queues[_0x3514c9[_0xecac('0x54')]]){queues[_0x3514c9[_0xecac('0x54')]][_0xecac('0x1f')]=0x1;queues[_0x3514c9['transfereeuniqueid']]=_[_0xecac('0x55')](queues[_0x3514c9[_0xecac('0x54')]]);queues[_0x3514c9['transfereeuniqueid']][_0xecac('0xe')]=_0x3514c9[_0xecac('0x56')];queues[_0x3514c9[_0xecac('0x46')]][_0xecac('0x1f')]=0x2;queues[_0x3514c9['transfereeuniqueid']][_0xecac('0x7')]=queues[_0x3514c9[_0xecac('0x4e')]]['calleridnum'];queues[_0x3514c9['transfereeuniqueid']]['calleridname']=queues[_0x3514c9['secondtransfererlinkedid']][_0xecac('0x57')];queues[_0x3514c9['transfereeuniqueid']][_0xecac('0x36')]=utils[_0xecac('0x15')]();queues[_0x3514c9[_0xecac('0x46')]][_0xecac('0x17')]=utils[_0xecac('0x15')]();queues[_0x3514c9[_0xecac('0x46')]][_0xecac('0x35')]=0x0;queues[_0x3514c9['transfereeuniqueid']][_0xecac('0x58')]=0x0;utils[_0xecac('0x3')](util[_0xecac('0x4')](_0xecac('0x59'),_0x3514c9[_0xecac('0x4d')],queues[_0x3514c9['transfereeuniqueid']]['name'],queues[_0x3514c9[_0xecac('0x46')]][_0xecac('0x7')],queues[_0x3514c9[_0xecac('0x46')]][_0xecac('0x57')]));}else{utils[_0xecac('0x3')](util[_0xecac('0x4')]('[%s][queues][attendedtransfer]\x20name:%s\x20transfereduniqueid:%s',_0x3514c9['origtransfereruniqueid'],queues[_0x3514c9[_0xecac('0x53')]][_0xecac('0x1e')],_0x3514c9[_0xecac('0x4e')]));queues[_0x3514c9[_0xecac('0x53')]][_0xecac('0xe')]=_0x3514c9[_0xecac('0x4e')];}}}else if(_0x3514c9[_0xecac('0x5a')]==_0x3514c9['secondtransfererlinkedid']){if(!_[_0xecac('0x23')](queues[_0x3514c9[_0xecac('0x53')]])){utils[_0xecac('0x3')](util['format']('[%s][queues][attendedtransfer]\x20name:%s\x20transferuniqueid:%s\x20transferexten:%s\x20queuecallerexitreason:ATTENDEDTRANSFER',_0x3514c9['origtransfereruniqueid'],queues[_0x3514c9[_0xecac('0x53')]][_0xecac('0x1e')],_0x3514c9[_0xecac('0x5a')],_0x3514c9[_0xecac('0x5b')]));queues[_0x3514c9[_0xecac('0x53')]][_0xecac('0x42')]=!![];queues[_0x3514c9[_0xecac('0x53')]][_0xecac('0x48')]=_0xecac('0x50');queues[_0x3514c9[_0xecac('0x53')]][_0xecac('0x49')]=_0x3514c9[_0xecac('0x5b')];queues[_0x3514c9[_0xecac('0x53')]][_0xecac('0x51')]=_0x3514c9[_0xecac('0x5a')];queues[_0x3514c9['origtransfererlinkedid']][_0xecac('0x9')]=_0xecac('0x52');}if(!_['isNil'](queues[_0x3514c9[_0xecac('0x4e')]])){if(_0x3514c9[_0xecac('0x5c')]&&queues[_0x3514c9[_0xecac('0x5c')]]){queues[_0x3514c9[_0xecac('0x5c')]]['queuecallerenterreason']=0x1;queues[_0x3514c9[_0xecac('0x56')]]=_[_0xecac('0x55')](queues[_0x3514c9[_0xecac('0x5c')]]);queues[_0x3514c9[_0xecac('0x56')]]['transfereduniqueid']=_0x3514c9[_0xecac('0x56')];queues[_0x3514c9['transfertargetuniqueid']][_0xecac('0x1f')]=0x2;queues[_0x3514c9['transfertargetuniqueid']][_0xecac('0x7')]=queues[_0x3514c9[_0xecac('0x53')]]['calleridnum'];queues[_0x3514c9[_0xecac('0x56')]][_0xecac('0x57')]=queues[_0x3514c9[_0xecac('0x53')]]['calleridname'];queues[_0x3514c9[_0xecac('0x56')]][_0xecac('0x36')]=utils[_0xecac('0x15')]();queues[_0x3514c9[_0xecac('0x56')]][_0xecac('0x17')]=utils[_0xecac('0x15')]();queues[_0x3514c9[_0xecac('0x56')]]['holdtime']=0x0;queues[_0x3514c9['transfertargetuniqueid']][_0xecac('0x58')]=0x0;utils[_0xecac('0x3')](util[_0xecac('0x4')](_0xecac('0x5d'),_0x3514c9[_0xecac('0x4d')],queues[_0x3514c9['transfertargetuniqueid']][_0xecac('0x1e')],queues[_0x3514c9[_0xecac('0x56')]][_0xecac('0xe')],queues[_0x3514c9[_0xecac('0x56')]][_0xecac('0x7')],queues[_0x3514c9[_0xecac('0x56')]][_0xecac('0x57')]));}else{utils[_0xecac('0x3')](util[_0xecac('0x4')](_0xecac('0x5e'),_0x3514c9[_0xecac('0x4d')],queues[_0x3514c9[_0xecac('0x4e')]][_0xecac('0x1e')],_0x3514c9['origtransfererlinkedid']));queues[_0x3514c9[_0xecac('0x4e')]][_0xecac('0xe')]=_0x3514c9[_0xecac('0x53')];}}}}catch(_0x3ecb5a){utils[_0xecac('0x16')](util[_0xecac('0x4')](_0xecac('0x4c'),_0x3514c9[_0xecac('0x4d')]),_0x3ecb5a);}};exports['musiconholdstart']=function(_0x114d7c){try{if(!_[_0xecac('0x23')](queues[_0x114d7c['uniqueid']])){utils['debug'](util[_0xecac('0x4')](_0xecac('0x5f'),_0x114d7c['uniqueid']),_0x114d7c);queues[_0x114d7c['uniqueid']]['musiconholdstartAt']=utils[_0xecac('0x15')]();utils[_0xecac('0x3')](util['format'](_0xecac('0x60'),_0x114d7c[_0xecac('0x12')],queues[_0x114d7c[_0xecac('0x12')]][_0xecac('0x1e')],queues[_0x114d7c[_0xecac('0x12')]][_0xecac('0x61')]));}}catch(_0x24521c){utils['error'](util[_0xecac('0x4')](_0xecac('0x5f'),_0x114d7c['uniqueid']),_0x24521c);}};exports[_0xecac('0x62')]=function(_0x1c98ec){try{if(!_['isNil'](queues[_0x1c98ec['uniqueid']])){if(!_[_0xecac('0x23')](queues[_0x1c98ec['uniqueid']]['musiconholdstartAt'])){utils[_0xecac('0x10')](util[_0xecac('0x4')](_0xecac('0x63'),_0x1c98ec[_0xecac('0x12')]),_0x1c98ec);queues[_0x1c98ec[_0xecac('0x12')]][_0xecac('0x58')]+=utils[_0xecac('0x64')](utils[_0xecac('0x15')](),queues[_0x1c98ec[_0xecac('0x12')]][_0xecac('0x61')]);utils['info'](util[_0xecac('0x4')](_0xecac('0x65'),_0x1c98ec[_0xecac('0x12')],queues[_0x1c98ec[_0xecac('0x12')]][_0xecac('0x1e')],queues[_0x1c98ec[_0xecac('0x12')]][_0xecac('0x58')]));delete queues[_0x1c98ec[_0xecac('0x12')]][_0xecac('0x61')];}}}catch(_0x162d76){utils[_0xecac('0x16')](util[_0xecac('0x4')](_0xecac('0x63'),_0x1c98ec['uniqueid']),_0x162d76);}}; \ No newline at end of file +var _0x1492=['[%s][queues][attendedtransfer]\x20name:%s\x20transfereduniqueid:%s\x20calleridnum:%s\x20calleridname:%s','musiconholdstart','[%s][queues][musiconholdstop]\x20name:%s\x20musiconholdstartAt:%s','musiconholdstartAt','[%s][queues][musiconholdstart]','diffTime','[%s][queues][musiconholdstop]\x20name:%s\x20mohtime:%s','[%s][queues][musiconholdstop]','lodash','util','info','format','[%s][queues][writeDB]\x20channel:%s\x20queue:%s\x20lastAssignedTo:%s\x20calleridnum:%s\x20accountcode:%s\x20queuecallerexitreason:%s','uniqueid','channel','queue','calleridnum','accountcode','getVoiceQueueByName','type','request','CreateVoiceQueueReport','transfereduniqueid','debug','[%s][queues][queuecallerjoin]\x20name:%s\x20position:%s','position','assign','now','error','[%s][queues][queuecallerjoin]','hangup','[%s][queues][hangup]','queuecallerleaveAt','queuecallercomplete','queuecallercompleteAt','queuecallerexitreason','COMPLETEDBYAGENT','[%s][queues][hangup]\x20name:%s\x20queuecallerexitreason:%s','name','[%s][queues][hangup]\x20name:%s\x20transfereduniqueid:%s','varset','[%s][queues][varset]','isNil','queuestatus','value','queuecallerabandon','queuecallerabandonAt','queuecallerexit','queuecallerexitAt','toUpperCase','[%s][queues][varset]\x20name:%s\x20variable:queuestatus\x20value:%s\x20queuecallerexitreason:%s','variable','queueposition','EXITWITHKEY','[%s][queues][varset]\x20name:%s\x20variable:queueposition\x20value:%s\x20queuecallerexitreason:%s','[%s][queues][queuecallerabandon]','ABANDONED','[%s][queues][queuecallerabandon]\x20name:%s\x20queuecallerexitreason:%s','queuecallerleave','[%s][queues][queuecallerleave]','connectedlinenum','holdtime','queuecallerjoinAt','count','connectedlinename','agentconnect','[%s][queues][agentconnect]','destaccountcode','assigned','lastAssignedTo','membername','agentcomplete','reason','transfer','TRANSFER','COMPLETEDBY','[%s][queues][agentcomplete]\x20name:%s\x20agent:%s\x20queuecallerexitreason:%s','[%s][queues][agentcomplete]','blindtransfer','[%s][queues][blindtransfer]','transfereeuniqueid','transfertype','BLIND','transferexten','extension','transferuniqueid','BLINDTRANSFER','[%s][queues][blindtransfer]\x20name:%s\x20transferuniqueid:%s\x20transferexten:%s\x20queuecallerexitreason:BLINDTRANSFER','attendedtransfer','[%s][queues][attendedtransfer]','origtransfereruniqueid','origtransfererlinkedid','secondtransfererlinkedid','[%s][queues][attendedtransfer]\x20name:%s\x20transferexten:%s\x20queuecallerexitreason:ATTENDEDTRANSFER','origtransfererexten','ATTENDED','ATTENDEDTRANSFER','transfereelinkedid','queuecallerenterreason','clone','calleridname','mohtime','[%s][queues][attendedtransfer]\x20name:%s\x20calleridnum:%s\x20calleridname:%s','[%s][queues][attendedtransfer]\x20name:%s\x20transfereduniqueid:%s','secondtransfereruniqueid','transfertargetlinkedid','transfertargetuniqueid'];(function(_0x105736,_0x141625){var _0x55178c=function(_0x49bdc9){while(--_0x49bdc9){_0x105736['push'](_0x105736['shift']());}};_0x55178c(++_0x141625);}(_0x1492,0x73));var _0x2149=function(_0x4c8a8f,_0x997ef){_0x4c8a8f=_0x4c8a8f-0x0;var _0x404500=_0x1492[_0x4c8a8f];return _0x404500;};'use strict';var _=require(_0x2149('0x0'));var util=require(_0x2149('0x1'));var utils=require('./utils');var queues={};function writeDB(_0x469183){utils[_0x2149('0x2')](util[_0x2149('0x3')](_0x2149('0x4'),_0x469183[_0x2149('0x5')],_0x469183[_0x2149('0x6')],_0x469183[_0x2149('0x7')],_0x469183['lastAssignedTo'],_0x469183[_0x2149('0x8')],_0x469183[_0x2149('0x9')],_0x469183['queuecallerexitreason']));if(_0x469183['queue']){utils[_0x2149('0xa')](_0x469183[_0x2149('0x7')])['then'](function(_0x946877){if(_0x946877){_0x469183['type']=_0x946877[_0x2149('0xb')];}utils[_0x2149('0xc')]('CreateVoiceQueueReport',_0x469183);});}else{utils[_0x2149('0xc')](_0x2149('0xd'),_0x469183);}if(_0x469183['transfereduniqueid']){delete queues[_0x469183[_0x2149('0xe')]];}else{delete queues[_0x469183['uniqueid']];}}exports['queuecallerjoin']=function(_0x4107f2){try{utils[_0x2149('0xf')](util[_0x2149('0x3')]('[%s][queues][queuecallerjoin]',_0x4107f2['uniqueid']),_0x4107f2);utils[_0x2149('0x2')](util['format'](_0x2149('0x10'),_0x4107f2['uniqueid'],_0x4107f2['queue'],_0x4107f2[_0x2149('0x11')]));queues[_0x4107f2[_0x2149('0x5')]]=_[_0x2149('0x12')](_0x4107f2,{'originalposition':_0x4107f2[_0x2149('0x11')],'queuecallerjoinAt':utils[_0x2149('0x13')](),'mohtime':0x0});}catch(_0x1bfbad){utils[_0x2149('0x14')](util[_0x2149('0x3')](_0x2149('0x15'),_0x4107f2[_0x2149('0x5')]),_0x1bfbad);}};exports[_0x2149('0x16')]=function(_0x2f031f){try{if(!_['isNil'](queues[_0x2f031f[_0x2149('0x5')]])){utils[_0x2149('0xf')](util[_0x2149('0x3')](_0x2149('0x17'),_0x2f031f[_0x2149('0x5')]),_0x2f031f);if(queues[_0x2f031f['uniqueid']][_0x2149('0x18')]){if(!queues[_0x2f031f[_0x2149('0x5')]]['queuecallerabandon']&&!queues[_0x2f031f[_0x2149('0x5')]]['queuecallerexit']){queues[_0x2f031f['uniqueid']][_0x2149('0x19')]=!![];queues[_0x2f031f[_0x2149('0x5')]][_0x2149('0x1a')]=utils[_0x2149('0x13')]();queues[_0x2f031f[_0x2149('0x5')]][_0x2149('0x1b')]=_0x2149('0x1c');}utils['info'](util['format'](_0x2149('0x1d'),_0x2f031f[_0x2149('0x5')],queues[_0x2f031f[_0x2149('0x5')]][_0x2149('0x1e')],queues[_0x2f031f[_0x2149('0x5')]][_0x2149('0x1b')]));writeDB(queues[_0x2f031f[_0x2149('0x5')]]);}else if(queues[_0x2f031f['uniqueid']][_0x2149('0xe')]){utils['info'](util[_0x2149('0x3')](_0x2149('0x1f'),_0x2f031f['uniqueid'],queues[_0x2f031f[_0x2149('0x5')]]['name'],queues[_0x2f031f['uniqueid']][_0x2149('0xe')]));queues[queues[_0x2f031f[_0x2149('0x5')]][_0x2149('0xe')]]=queues[_0x2f031f[_0x2149('0x5')]];queues[queues[_0x2f031f['uniqueid']][_0x2149('0xe')]]['queuecallerenterreason']=0x2;delete queues[_0x2f031f['uniqueid']];}}}catch(_0x379432){utils[_0x2149('0x14')](util[_0x2149('0x3')](_0x2149('0x17'),_0x2f031f[_0x2149('0x5')]),_0x379432);}};exports[_0x2149('0x20')]=function(_0x1b00ed){try{utils[_0x2149('0xf')](util[_0x2149('0x3')](_0x2149('0x21'),_0x1b00ed[_0x2149('0x5')]),_0x1b00ed);if(!_[_0x2149('0x22')](_0x1b00ed['variable'][_0x2149('0x23')])&&_0x1b00ed[_0x2149('0x24')]['toUpperCase']()!=='CONTINUE'){if(!_[_0x2149('0x22')](queues[_0x1b00ed[_0x2149('0x5')]])){queues[_0x1b00ed['uniqueid']][_0x2149('0x25')]=![];queues[_0x1b00ed[_0x2149('0x5')]][_0x2149('0x26')]=null;queues[_0x1b00ed[_0x2149('0x5')]][_0x2149('0x27')]=!![];queues[_0x1b00ed['uniqueid']][_0x2149('0x28')]=utils[_0x2149('0x13')]();queues[_0x1b00ed[_0x2149('0x5')]]['queuecallerexitreason']=_0x1b00ed['value'][_0x2149('0x29')]();utils['info'](util[_0x2149('0x3')](_0x2149('0x2a'),_0x1b00ed['uniqueid'],queues[_0x1b00ed['uniqueid']][_0x2149('0x1e')],_0x1b00ed[_0x2149('0x24')],queues[_0x1b00ed[_0x2149('0x5')]][_0x2149('0x1b')]));writeDB(queues[_0x1b00ed[_0x2149('0x5')]]);}}else if(!_['isNil'](_0x1b00ed[_0x2149('0x2b')][_0x2149('0x2c')])){if(!_['isNil'](queues[_0x1b00ed[_0x2149('0x5')]])&&!queues[_0x1b00ed['uniqueid']][_0x2149('0x25')]){queues[_0x1b00ed[_0x2149('0x5')]][_0x2149('0x25')]=![];queues[_0x1b00ed['uniqueid']][_0x2149('0x26')]=null;queues[_0x1b00ed[_0x2149('0x5')]]['queuecallerexit']=!![];queues[_0x1b00ed['uniqueid']]['queuecallerexitAt']=utils[_0x2149('0x13')]();queues[_0x1b00ed['uniqueid']][_0x2149('0x1b')]=_0x2149('0x2d');utils[_0x2149('0x2')](util['format'](_0x2149('0x2e'),_0x1b00ed['uniqueid'],queues[_0x1b00ed[_0x2149('0x5')]]['name'],_0x1b00ed[_0x2149('0x24')],queues[_0x1b00ed['uniqueid']][_0x2149('0x1b')]));}}}catch(_0x5dbdc6){utils[_0x2149('0x14')](util['format'](_0x2149('0x21'),_0x1b00ed['uniqueid']),_0x5dbdc6);}};exports[_0x2149('0x25')]=function(_0x6333a4){try{if(!_[_0x2149('0x22')](queues[_0x6333a4[_0x2149('0x5')]])){utils['debug'](util[_0x2149('0x3')](_0x2149('0x2f'),_0x6333a4['uniqueid']),_0x6333a4);queues[_0x6333a4[_0x2149('0x5')]][_0x2149('0x27')]=![];queues[_0x6333a4['uniqueid']][_0x2149('0x28')]=null;queues[_0x6333a4['uniqueid']]['queuecallerabandon']=!![];queues[_0x6333a4['uniqueid']][_0x2149('0x26')]=utils[_0x2149('0x13')]();queues[_0x6333a4['uniqueid']][_0x2149('0x1b')]=_0x2149('0x30');utils[_0x2149('0x2')](util[_0x2149('0x3')](_0x2149('0x31'),_0x6333a4[_0x2149('0x5')],queues[_0x6333a4[_0x2149('0x5')]][_0x2149('0x1e')],queues[_0x6333a4[_0x2149('0x5')]][_0x2149('0x1b')]));}}catch(_0xe8791c){utils[_0x2149('0x14')](util[_0x2149('0x3')]('[%s][queues][queuecallerabandon]',_0x6333a4['uniqueid']),_0xe8791c);}};exports[_0x2149('0x32')]=function(_0x22a6c8){try{if(!_[_0x2149('0x22')](queues[_0x22a6c8[_0x2149('0x5')]])){utils[_0x2149('0xf')](util[_0x2149('0x3')](_0x2149('0x33'),_0x22a6c8[_0x2149('0x5')]),_0x22a6c8);utils[_0x2149('0x2')](util[_0x2149('0x3')]('[%s][queues][queuecallerleave]\x20name:%s\x20connectedlinenum:%s\x20connectedlinename:%s',_0x22a6c8[_0x2149('0x5')],queues[_0x22a6c8[_0x2149('0x5')]][_0x2149('0x1e')],_0x22a6c8[_0x2149('0x34')],_0x22a6c8['connectedlinename']));queues[_0x22a6c8[_0x2149('0x5')]][_0x2149('0x32')]=!![];queues[_0x22a6c8[_0x2149('0x5')]][_0x2149('0x18')]=utils[_0x2149('0x13')]();queues[_0x22a6c8[_0x2149('0x5')]][_0x2149('0x35')]=utils['diffTime'](queues[_0x22a6c8[_0x2149('0x5')]][_0x2149('0x18')],queues[_0x22a6c8[_0x2149('0x5')]][_0x2149('0x36')]);queues[_0x22a6c8[_0x2149('0x5')]]['position']=_0x22a6c8[_0x2149('0x11')];queues[_0x22a6c8[_0x2149('0x5')]][_0x2149('0x37')]=_0x22a6c8['count'];queues[_0x22a6c8[_0x2149('0x5')]][_0x2149('0x34')]=_0x22a6c8['connectedlinenum'];queues[_0x22a6c8[_0x2149('0x5')]][_0x2149('0x38')]=_0x22a6c8[_0x2149('0x38')];}}catch(_0x539fde){utils[_0x2149('0x14')](util[_0x2149('0x3')](_0x2149('0x33'),_0x22a6c8[_0x2149('0x5')]),_0x539fde);}};exports[_0x2149('0x39')]=function(_0x5d9da9){try{if(!_['isNil'](queues[_0x5d9da9[_0x2149('0x5')]])){utils[_0x2149('0xf')](util[_0x2149('0x3')](_0x2149('0x3a'),_0x5d9da9[_0x2149('0x5')]),_0x5d9da9);utils[_0x2149('0x2')](util['format']('[%s][queues][agentconnect]\x20name:%s\x20agent:%s\x20accountcode:%s',_0x5d9da9[_0x2149('0x5')],queues[_0x5d9da9[_0x2149('0x5')]][_0x2149('0x1e')],_0x5d9da9['membername'],_0x5d9da9[_0x2149('0x3b')]));queues[_0x5d9da9['uniqueid']][_0x2149('0x25')]=![];queues[_0x5d9da9['uniqueid']][_0x2149('0x25')]=![];queues[_0x5d9da9[_0x2149('0x5')]][_0x2149('0x26')]=null;queues[_0x5d9da9['uniqueid']][_0x2149('0x27')]=![];queues[_0x5d9da9[_0x2149('0x5')]][_0x2149('0x1b')]=null;queues[_0x5d9da9[_0x2149('0x5')]][_0x2149('0x28')]=null;queues[_0x5d9da9[_0x2149('0x5')]][_0x2149('0x3c')]=!![];queues[_0x5d9da9[_0x2149('0x5')]][_0x2149('0x9')]=_0x5d9da9[_0x2149('0x3b')];queues[_0x5d9da9[_0x2149('0x5')]][_0x2149('0x3d')]=_0x5d9da9[_0x2149('0x3e')];}}catch(_0x255bbb){utils[_0x2149('0x14')](util[_0x2149('0x3')](_0x2149('0x3a'),_0x5d9da9['uniqueid']),_0x255bbb);}};exports[_0x2149('0x3f')]=function(_0x517a39){try{if(!_[_0x2149('0x22')](queues[_0x517a39[_0x2149('0x5')]])){if(queues[_0x517a39[_0x2149('0x5')]]['queuecallerleaveAt']){utils[_0x2149('0xf')](util[_0x2149('0x3')]('[%s][queues][agentcomplete]',_0x517a39['uniqueid']),_0x517a39);queues[_0x517a39['uniqueid']]['queuecallerabandon']=![];queues[_0x517a39['uniqueid']][_0x2149('0x25')]=![];queues[_0x517a39[_0x2149('0x5')]][_0x2149('0x26')]=null;queues[_0x517a39[_0x2149('0x5')]][_0x2149('0x27')]=![];queues[_0x517a39[_0x2149('0x5')]]['queuecallerexitAt']=null;queues[_0x517a39[_0x2149('0x5')]][_0x2149('0x3c')]=!![];queues[_0x517a39[_0x2149('0x5')]][_0x2149('0x3d')]=_0x517a39[_0x2149('0x3e')];queues[_0x517a39[_0x2149('0x5')]][_0x2149('0x19')]=!![];queues[_0x517a39[_0x2149('0x5')]]['queuecallercompleteAt']=utils[_0x2149('0x13')]();if(_0x517a39[_0x2149('0x40')]==_0x2149('0x41')){if(!queues[_0x517a39[_0x2149('0x5')]]['transfer']){queues[_0x517a39[_0x2149('0x5')]][_0x2149('0x1b')]=_0x2149('0x42');}}else{queues[_0x517a39[_0x2149('0x5')]][_0x2149('0x1b')]=_0x2149('0x43')+_0x517a39[_0x2149('0x40')]['toUpperCase']();}utils['info'](util[_0x2149('0x3')](_0x2149('0x44'),_0x517a39[_0x2149('0x5')],queues[_0x517a39[_0x2149('0x5')]]['name'],_0x517a39[_0x2149('0x3e')],queues[_0x517a39[_0x2149('0x5')]][_0x2149('0x1b')]));writeDB(queues[_0x517a39[_0x2149('0x5')]]);}}}catch(_0x156ffa){utils['error'](util['format'](_0x2149('0x45'),_0x517a39[_0x2149('0x5')]),_0x156ffa);}};exports[_0x2149('0x46')]=function(_0x48ad2f){try{if(!_['isNil'](queues[_0x48ad2f['transfereeuniqueid']])){utils[_0x2149('0xf')](util['format'](_0x2149('0x47'),_0x48ad2f[_0x2149('0x5')]),_0x48ad2f);queues[_0x48ad2f[_0x2149('0x48')]][_0x2149('0x41')]=!![];queues[_0x48ad2f[_0x2149('0x48')]][_0x2149('0x49')]=_0x2149('0x4a');queues[_0x48ad2f[_0x2149('0x48')]][_0x2149('0x4b')]=_0x48ad2f[_0x2149('0x4c')];queues[_0x48ad2f[_0x2149('0x48')]][_0x2149('0x4d')]=_0x48ad2f['transfereeuniqueid'];queues[_0x48ad2f[_0x2149('0x48')]][_0x2149('0x1b')]=_0x2149('0x4e');utils[_0x2149('0x2')](util[_0x2149('0x3')](_0x2149('0x4f'),_0x48ad2f[_0x2149('0x5')],queues[_0x48ad2f[_0x2149('0x48')]][_0x2149('0x1e')],_0x48ad2f[_0x2149('0x48')],_0x48ad2f[_0x2149('0x4c')]));}}catch(_0x1530ab){utils[_0x2149('0x14')](util[_0x2149('0x3')](_0x2149('0x47'),_0x48ad2f['uniqueid']),_0x1530ab);}};exports[_0x2149('0x50')]=function(_0x3a3d33){try{utils[_0x2149('0xf')](util[_0x2149('0x3')](_0x2149('0x51'),_0x3a3d33['origtransfereruniqueid']),_0x3a3d33);if(_0x3a3d33[_0x2149('0x52')]==_0x3a3d33[_0x2149('0x53')]){if(!_[_0x2149('0x22')](queues[_0x3a3d33[_0x2149('0x54')]])){utils[_0x2149('0x2')](util[_0x2149('0x3')](_0x2149('0x55'),_0x3a3d33[_0x2149('0x52')],queues[_0x3a3d33[_0x2149('0x54')]]['name'],_0x3a3d33[_0x2149('0x56')]));queues[_0x3a3d33[_0x2149('0x54')]][_0x2149('0x41')]=!![];queues[_0x3a3d33[_0x2149('0x54')]][_0x2149('0x49')]=_0x2149('0x57');queues[_0x3a3d33[_0x2149('0x54')]][_0x2149('0x4b')]=_0x3a3d33[_0x2149('0x56')];queues[_0x3a3d33[_0x2149('0x54')]]['transferuniqueid']=_0x3a3d33[_0x2149('0x52')];queues[_0x3a3d33[_0x2149('0x54')]]['queuecallerexitreason']=_0x2149('0x58');}if(!_[_0x2149('0x22')](queues[_0x3a3d33[_0x2149('0x53')]])){if(_0x3a3d33['transfereelinkedid']&&queues[_0x3a3d33[_0x2149('0x59')]]){queues[_0x3a3d33[_0x2149('0x59')]][_0x2149('0x5a')]=0x1;queues[_0x3a3d33['transfereeuniqueid']]=_[_0x2149('0x5b')](queues[_0x3a3d33[_0x2149('0x59')]]);queues[_0x3a3d33[_0x2149('0x48')]][_0x2149('0xe')]=_0x3a3d33['transfertargetuniqueid'];queues[_0x3a3d33['transfereeuniqueid']]['queuecallerenterreason']=0x2;queues[_0x3a3d33[_0x2149('0x48')]][_0x2149('0x8')]=queues[_0x3a3d33['secondtransfererlinkedid']][_0x2149('0x8')];queues[_0x3a3d33[_0x2149('0x48')]]['calleridname']=queues[_0x3a3d33['secondtransfererlinkedid']][_0x2149('0x5c')];queues[_0x3a3d33['transfereeuniqueid']][_0x2149('0x36')]=utils[_0x2149('0x13')]();queues[_0x3a3d33[_0x2149('0x48')]][_0x2149('0x18')]=utils[_0x2149('0x13')]();queues[_0x3a3d33[_0x2149('0x48')]]['holdtime']=0x0;queues[_0x3a3d33[_0x2149('0x48')]][_0x2149('0x5d')]=0x0;utils[_0x2149('0x2')](util[_0x2149('0x3')](_0x2149('0x5e'),_0x3a3d33[_0x2149('0x52')],queues[_0x3a3d33[_0x2149('0x48')]][_0x2149('0x1e')],queues[_0x3a3d33[_0x2149('0x48')]][_0x2149('0x8')],queues[_0x3a3d33[_0x2149('0x48')]][_0x2149('0x5c')]));}else{utils[_0x2149('0x2')](util[_0x2149('0x3')](_0x2149('0x5f'),_0x3a3d33[_0x2149('0x52')],queues[_0x3a3d33[_0x2149('0x53')]][_0x2149('0x1e')],_0x3a3d33['secondtransfererlinkedid']));queues[_0x3a3d33['origtransfererlinkedid']]['transfereduniqueid']=_0x3a3d33[_0x2149('0x54')];}}}else if(_0x3a3d33['secondtransfereruniqueid']==_0x3a3d33[_0x2149('0x54')]){if(!_[_0x2149('0x22')](queues[_0x3a3d33[_0x2149('0x53')]])){utils[_0x2149('0x2')](util[_0x2149('0x3')]('[%s][queues][attendedtransfer]\x20name:%s\x20transferuniqueid:%s\x20transferexten:%s\x20queuecallerexitreason:ATTENDEDTRANSFER',_0x3a3d33['origtransfereruniqueid'],queues[_0x3a3d33[_0x2149('0x53')]][_0x2149('0x1e')],_0x3a3d33['secondtransfereruniqueid'],_0x3a3d33['secondtransfererexten']));queues[_0x3a3d33[_0x2149('0x53')]][_0x2149('0x41')]=!![];queues[_0x3a3d33['origtransfererlinkedid']][_0x2149('0x49')]=_0x2149('0x57');queues[_0x3a3d33[_0x2149('0x53')]][_0x2149('0x4b')]=_0x3a3d33['secondtransfererexten'];queues[_0x3a3d33[_0x2149('0x53')]][_0x2149('0x4d')]=_0x3a3d33[_0x2149('0x60')];queues[_0x3a3d33[_0x2149('0x53')]]['queuecallerexitreason']=_0x2149('0x58');}if(!_[_0x2149('0x22')](queues[_0x3a3d33[_0x2149('0x54')]])){if(_0x3a3d33[_0x2149('0x61')]&&queues[_0x3a3d33['transfertargetlinkedid']]){queues[_0x3a3d33[_0x2149('0x61')]][_0x2149('0x5a')]=0x1;queues[_0x3a3d33['transfertargetuniqueid']]=_[_0x2149('0x5b')](queues[_0x3a3d33[_0x2149('0x61')]]);queues[_0x3a3d33['transfertargetuniqueid']][_0x2149('0xe')]=_0x3a3d33['transfertargetuniqueid'];queues[_0x3a3d33[_0x2149('0x62')]][_0x2149('0x5a')]=0x2;queues[_0x3a3d33[_0x2149('0x62')]][_0x2149('0x8')]=queues[_0x3a3d33[_0x2149('0x53')]][_0x2149('0x8')];queues[_0x3a3d33[_0x2149('0x62')]][_0x2149('0x5c')]=queues[_0x3a3d33[_0x2149('0x53')]][_0x2149('0x5c')];queues[_0x3a3d33['transfertargetuniqueid']][_0x2149('0x36')]=utils[_0x2149('0x13')]();queues[_0x3a3d33['transfertargetuniqueid']][_0x2149('0x18')]=utils[_0x2149('0x13')]();queues[_0x3a3d33[_0x2149('0x62')]]['holdtime']=0x0;queues[_0x3a3d33[_0x2149('0x62')]][_0x2149('0x5d')]=0x0;utils[_0x2149('0x2')](util[_0x2149('0x3')](_0x2149('0x63'),_0x3a3d33[_0x2149('0x52')],queues[_0x3a3d33[_0x2149('0x62')]][_0x2149('0x1e')],queues[_0x3a3d33[_0x2149('0x62')]]['transfereduniqueid'],queues[_0x3a3d33[_0x2149('0x62')]][_0x2149('0x8')],queues[_0x3a3d33[_0x2149('0x62')]][_0x2149('0x5c')]));}else{utils[_0x2149('0x2')](util[_0x2149('0x3')](_0x2149('0x5f'),_0x3a3d33[_0x2149('0x52')],queues[_0x3a3d33['secondtransfererlinkedid']][_0x2149('0x1e')],_0x3a3d33[_0x2149('0x53')]));queues[_0x3a3d33[_0x2149('0x54')]][_0x2149('0xe')]=_0x3a3d33['origtransfererlinkedid'];}}}}catch(_0x5a5cc1){utils[_0x2149('0x14')](util[_0x2149('0x3')](_0x2149('0x51'),_0x3a3d33[_0x2149('0x52')]),_0x5a5cc1);}};exports[_0x2149('0x64')]=function(_0x183f23){try{if(!_[_0x2149('0x22')](queues[_0x183f23['uniqueid']])){utils[_0x2149('0xf')](util[_0x2149('0x3')]('[%s][queues][musiconholdstart]',_0x183f23['uniqueid']),_0x183f23);queues[_0x183f23[_0x2149('0x5')]]['musiconholdstartAt']=utils[_0x2149('0x13')]();utils[_0x2149('0x2')](util['format'](_0x2149('0x65'),_0x183f23['uniqueid'],queues[_0x183f23[_0x2149('0x5')]][_0x2149('0x1e')],queues[_0x183f23[_0x2149('0x5')]][_0x2149('0x66')]));}}catch(_0x508241){utils['error'](util['format'](_0x2149('0x67'),_0x183f23['uniqueid']),_0x508241);}};exports['musiconholdstop']=function(_0x1c5516){try{if(!_['isNil'](queues[_0x1c5516['uniqueid']])){if(!_[_0x2149('0x22')](queues[_0x1c5516[_0x2149('0x5')]][_0x2149('0x66')])){utils[_0x2149('0xf')](util[_0x2149('0x3')]('[%s][queues][musiconholdstop]',_0x1c5516['uniqueid']),_0x1c5516);queues[_0x1c5516[_0x2149('0x5')]][_0x2149('0x5d')]+=utils[_0x2149('0x68')](utils[_0x2149('0x13')](),queues[_0x1c5516[_0x2149('0x5')]]['musiconholdstartAt']);utils[_0x2149('0x2')](util[_0x2149('0x3')](_0x2149('0x69'),_0x1c5516[_0x2149('0x5')],queues[_0x1c5516[_0x2149('0x5')]][_0x2149('0x1e')],queues[_0x1c5516[_0x2149('0x5')]][_0x2149('0x5d')]));delete queues[_0x1c5516[_0x2149('0x5')]]['musiconholdstartAt'];}}}catch(_0x59d37d){utils[_0x2149('0x14')](util[_0x2149('0x3')](_0x2149('0x6a'),_0x1c5516[_0x2149('0x5')]),_0x59d37d);}}; \ No newline at end of file diff --git a/server/services/xdr/recordings.controller.js b/server/services/xdr/recordings.controller.js index 052a746..3babf46 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 _0x0aeb=['util','info','format','[%s][recordings][writeDB]','accountcode','getUserByInternal','then','membername','name','UserId','request','CreateVoiceRecording','newchannel','debug','[%s][recordings][newchannel]','uniqueid','context','exten','newstate','isNil','channelstate','channel','linkedid','transfer','[%s][recordings][newstate]\x20linkedid:%s\x20context:%s\x20channel:%s','[%s][recordings][newstate]','varset','variable','mixmonitor_filename','[%s][recordings][varset]','value','endsWith','.wav49','replace','.WAV','monitors','push','error','hangup','[%s][recordings][hangup]\x20calleridnum:%s\x20calleridname:%s\x20reason:%s','calleridname','cause-txt','calleridnum','connectedlinenum','connectedlinename','type','outbound','forEach','clone','newexten','[%s][recordings][newexten]','[%s][recordings][newexten]\x20application:%s\x20appdata:%s','appdata','application','startsWith','toLowerCase','cdr','split','substring','lastIndexOf','[%s][recordings][queuecallerjoin]','[%s][recordings][queuecallerjoin]\x20queue:%s','queue','lodash'];(function(_0x20dce2,_0x1260ec){var _0x3eaf1c=function(_0x481458){while(--_0x481458){_0x20dce2['push'](_0x20dce2['shift']());}};_0x3eaf1c(++_0x1260ec);}(_0x0aeb,0xff));var _0xb0ae=function(_0x555002,_0x3e7927){_0x555002=_0x555002-0x0;var _0x4d7b45=_0x0aeb[_0x555002];return _0x4d7b45;};'use strict';var _=require(_0xb0ae('0x0'));var util=require(_0xb0ae('0x1'));var utils=require('./utils');var recordings={};function writeDB(_0x2be02c){utils[_0xb0ae('0x2')](util[_0xb0ae('0x3')](_0xb0ae('0x4'),_0x2be02c['uniqueid']));if(_0x2be02c[_0xb0ae('0x5')]){utils[_0xb0ae('0x6')](_0x2be02c[_0xb0ae('0x5')])[_0xb0ae('0x7')](function(_0x2ebd70){if(_0x2ebd70){_0x2be02c[_0xb0ae('0x8')]=_0x2ebd70[_0xb0ae('0x9')];_0x2be02c[_0xb0ae('0xa')]=_0x2ebd70['id'];}utils['request']('CreateVoiceRecording',_0x2be02c);});}else{utils[_0xb0ae('0xb')](_0xb0ae('0xc'),_0x2be02c);}}exports[_0xb0ae('0xd')]=function(_0x4260ee){try{utils[_0xb0ae('0xe')](util[_0xb0ae('0x3')](_0xb0ae('0xf'),_0x4260ee[_0xb0ae('0x10')]),_0x4260ee);if(_0x4260ee[_0xb0ae('0x10')]==_0x4260ee['linkedid']){utils[_0xb0ae('0x2')](util[_0xb0ae('0x3')]('[%s][recordings][newchannel]\x20context:%s\x20exten:%s',_0x4260ee[_0xb0ae('0x10')],_0x4260ee[_0xb0ae('0x11')],_0x4260ee[_0xb0ae('0x12')]));recordings[_0x4260ee['uniqueid']]={'uniqueid':_0x4260ee['uniqueid'],'accountcode':_0x4260ee[_0xb0ae('0x5')],'exten':_0x4260ee[_0xb0ae('0x12')],'context':_0x4260ee[_0xb0ae('0x11')],'channel':_0x4260ee['channel'],'monitors':[]};}}catch(_0x17df16){utils['error'](util['format'](_0xb0ae('0xf'),_0x4260ee[_0xb0ae('0x10')]),_0x17df16);}};exports[_0xb0ae('0x13')]=function(_0x133ba1){try{utils[_0xb0ae('0xe')](util[_0xb0ae('0x3')]('[%s][recordings][newstate]',_0x133ba1[_0xb0ae('0x10')]),_0x133ba1);if(!_[_0xb0ae('0x14')](recordings[_0x133ba1[_0xb0ae('0x10')]])&&_0x133ba1[_0xb0ae('0x15')]==0x6){utils[_0xb0ae('0x2')](util[_0xb0ae('0x3')]('[%s][recordings][newstate]\x20context:%s\x20channel:%s',_0x133ba1[_0xb0ae('0x10')],_0x133ba1['context'],_0x133ba1[_0xb0ae('0x16')]));}else if(!_[_0xb0ae('0x14')](recordings[_0x133ba1[_0xb0ae('0x17')]])&&_0x133ba1[_0xb0ae('0x15')]==0x6&&_0x133ba1[_0xb0ae('0x11')]!=_0xb0ae('0x18')){utils[_0xb0ae('0x2')](util['format'](_0xb0ae('0x19'),_0x133ba1['uniqueid'],_0x133ba1['linkedid'],_0x133ba1[_0xb0ae('0x11')],_0x133ba1[_0xb0ae('0x16')]));recordings[_0x133ba1['linkedid']]['accountcode']=_0x133ba1[_0xb0ae('0x5')];}}catch(_0x3569d7){utils['error'](util['format'](_0xb0ae('0x1a'),_0x133ba1[_0xb0ae('0x10')]),_0x3569d7);}};exports[_0xb0ae('0x1b')]=function(_0x4383c4){try{if(!_[_0xb0ae('0x14')](_0x4383c4['variable'])&&!_[_0xb0ae('0x14')](_0x4383c4[_0xb0ae('0x1c')][_0xb0ae('0x1d')])){utils[_0xb0ae('0xe')](util['format'](_0xb0ae('0x1e'),_0x4383c4[_0xb0ae('0x10')]),_0x4383c4);utils[_0xb0ae('0x2')](util[_0xb0ae('0x3')]('[%s][recordings][varset]\x20variable:%s\x20value:%s',_0x4383c4[_0xb0ae('0x10')],_0x4383c4['variable'],_0x4383c4[_0xb0ae('0x1f')]));if(_[_0xb0ae('0x20')](_0x4383c4[_0xb0ae('0x1f')],_0xb0ae('0x21'))){_0x4383c4[_0xb0ae('0x1f')]=_0x4383c4[_0xb0ae('0x1f')][_0xb0ae('0x22')]('.wav49',_0xb0ae('0x23'));}if(recordings[_0x4383c4['linkedid']]){var _0x5db82f=_['find'](recordings[_0x4383c4['linkedid']]['monitors'],{'value':_0x4383c4[_0xb0ae('0x1f')]});if(_[_0xb0ae('0x14')](_0x5db82f)){recordings[_0x4383c4['linkedid']][_0xb0ae('0x24')][_0xb0ae('0x25')]({'value':_0x4383c4['value']});}}}}catch(_0x2a3c4e){utils[_0xb0ae('0x26')](util[_0xb0ae('0x3')](_0xb0ae('0x1e'),_0x4383c4[_0xb0ae('0x10')]),_0x2a3c4e);}};exports[_0xb0ae('0x27')]=function(_0x5799a0){try{if(!_[_0xb0ae('0x14')](recordings[_0x5799a0['uniqueid']])){utils[_0xb0ae('0xe')](util['format']('[%s][recordings][hangup]',_0x5799a0['uniqueid']),_0x5799a0);utils['info'](util['format'](_0xb0ae('0x28'),_0x5799a0[_0xb0ae('0x10')],_0x5799a0['calleridnum'],_0x5799a0[_0xb0ae('0x29')],_0x5799a0[_0xb0ae('0x2a')]));recordings[_0x5799a0[_0xb0ae('0x10')]][_0xb0ae('0x2b')]=_0x5799a0[_0xb0ae('0x2b')];recordings[_0x5799a0[_0xb0ae('0x10')]][_0xb0ae('0x29')]=_0x5799a0[_0xb0ae('0x29')];recordings[_0x5799a0[_0xb0ae('0x10')]][_0xb0ae('0x2c')]=_0x5799a0['connectedlinenum'];recordings[_0x5799a0['uniqueid']][_0xb0ae('0x2d')]=_0x5799a0[_0xb0ae('0x2d')];if(recordings[_0x5799a0[_0xb0ae('0x10')]][_0xb0ae('0x2e')]==_0xb0ae('0x2f')&&recordings[_0x5799a0['uniqueid']][_0xb0ae('0x5')]){recordings[_0x5799a0[_0xb0ae('0x10')]]['connectedlinenum']=recordings[_0x5799a0[_0xb0ae('0x10')]][_0xb0ae('0x5')];recordings[_0x5799a0[_0xb0ae('0x10')]][_0xb0ae('0x2d')]='';}recordings[_0x5799a0['uniqueid']]['monitors'][_0xb0ae('0x30')](function(_0x514841){var _0x1ee73c=_[_0xb0ae('0x31')](recordings[_0x5799a0[_0xb0ae('0x10')]]);_0x1ee73c[_0xb0ae('0x1f')]=_0x514841[_0xb0ae('0x1f')];writeDB(_0x1ee73c);});delete recordings[_0x5799a0[_0xb0ae('0x10')]];}}catch(_0x3d3b8a){utils[_0xb0ae('0x26')](util['format']('[%s][recordings][hangup]',_0x5799a0[_0xb0ae('0x10')]),_0x3d3b8a);}};exports[_0xb0ae('0x32')]=function(_0x3d31bd){try{if(!_[_0xb0ae('0x14')](recordings[_0x3d31bd[_0xb0ae('0x10')]])){utils[_0xb0ae('0xe')](util[_0xb0ae('0x3')](_0xb0ae('0x33'),_0x3d31bd[_0xb0ae('0x10')]),_0x3d31bd);utils[_0xb0ae('0x2')](util[_0xb0ae('0x3')](_0xb0ae('0x34'),_0x3d31bd[_0xb0ae('0x10')],_0x3d31bd['application'],_0x3d31bd[_0xb0ae('0x35')]));if(_0x3d31bd[_0xb0ae('0x36')]['toLowerCase']()=='set'&&_[_0xb0ae('0x37')](_0x3d31bd[_0xb0ae('0x35')][_0xb0ae('0x38')](),_0xb0ae('0x39'))){var _0x2eef58=_0x3d31bd[_0xb0ae('0x35')][_0xb0ae('0x3a')]('=');var _0x328054=_0x2eef58[0x0][_0xb0ae('0x3b')](_0x2eef58[0x0][_0xb0ae('0x3c')]('(')+0x1,_0x2eef58[0x0][_0xb0ae('0x3c')](')'));var _0x451163=_0x2eef58[0x1];recordings[_0x3d31bd[_0xb0ae('0x10')]][_0x328054]=_0x451163;}}}catch(_0x2bd31d){utils[_0xb0ae('0x26')](util[_0xb0ae('0x3')]('[%s][recordings][newexten]',_0x3d31bd[_0xb0ae('0x10')]),_0x2bd31d);}};exports['queuecallerjoin']=function(_0x52ff3f){try{if(!_[_0xb0ae('0x14')](recordings[_0x52ff3f[_0xb0ae('0x10')]])){utils[_0xb0ae('0xe')](util[_0xb0ae('0x3')](_0xb0ae('0x3d'),_0x52ff3f[_0xb0ae('0x10')]),_0x52ff3f);utils['info'](util[_0xb0ae('0x3')](_0xb0ae('0x3e'),_0x52ff3f[_0xb0ae('0x10')],_0x52ff3f['queue']));recordings[_0x52ff3f['uniqueid']][_0xb0ae('0x3f')]=_0x52ff3f['queue'];}}catch(_0x25d41d){utils[_0xb0ae('0x26')](util[_0xb0ae('0x3')](_0xb0ae('0x3d'),_0x52ff3f[_0xb0ae('0x10')]),_0x25d41d);}}; \ No newline at end of file +var _0xf37c=['queue','lodash','./utils','info','format','getUserByInternal','accountcode','then','membername','name','UserId','request','CreateVoiceRecording','newchannel','[%s][recordings][newchannel]','uniqueid','[%s][recordings][newchannel]\x20context:%s\x20exten:%s','context','exten','channel','error','newstate','debug','[%s][recordings][newstate]','channelstate','[%s][recordings][newstate]\x20context:%s\x20channel:%s','isNil','linkedid','transfer','variable','[%s][recordings][varset]\x20variable:%s\x20value:%s','value','endsWith','.wav49','.WAV','monitors','push','hangup','[%s][recordings][hangup]','[%s][recordings][hangup]\x20calleridnum:%s\x20calleridname:%s\x20reason:%s','calleridnum','calleridname','cause-txt','connectedlinenum','connectedlinename','type','outbound','forEach','clone','[%s][recordings][newexten]\x20application:%s\x20appdata:%s','application','appdata','toLowerCase','set','startsWith','cdr','split','substring','lastIndexOf','[%s][recordings][newexten]','queuecallerjoin','[%s][recordings][queuecallerjoin]','[%s][recordings][queuecallerjoin]\x20queue:%s'];(function(_0x406c07,_0x188e1b){var _0x38722c=function(_0x2ab052){while(--_0x2ab052){_0x406c07['push'](_0x406c07['shift']());}};_0x38722c(++_0x188e1b);}(_0xf37c,0xbe));var _0xcf37=function(_0x4f96b0,_0x4b2175){_0x4f96b0=_0x4f96b0-0x0;var _0x49025b=_0xf37c[_0x4f96b0];return _0x49025b;};'use strict';var _=require(_0xcf37('0x0'));var util=require('util');var utils=require(_0xcf37('0x1'));var recordings={};function writeDB(_0x4ff4e7){utils[_0xcf37('0x2')](util[_0xcf37('0x3')]('[%s][recordings][writeDB]',_0x4ff4e7['uniqueid']));if(_0x4ff4e7['accountcode']){utils[_0xcf37('0x4')](_0x4ff4e7[_0xcf37('0x5')])[_0xcf37('0x6')](function(_0x552f78){if(_0x552f78){_0x4ff4e7[_0xcf37('0x7')]=_0x552f78[_0xcf37('0x8')];_0x4ff4e7[_0xcf37('0x9')]=_0x552f78['id'];}utils[_0xcf37('0xa')](_0xcf37('0xb'),_0x4ff4e7);});}else{utils['request'](_0xcf37('0xb'),_0x4ff4e7);}}exports[_0xcf37('0xc')]=function(_0xd88864){try{utils['debug'](util[_0xcf37('0x3')](_0xcf37('0xd'),_0xd88864[_0xcf37('0xe')]),_0xd88864);if(_0xd88864['uniqueid']==_0xd88864['linkedid']){utils[_0xcf37('0x2')](util['format'](_0xcf37('0xf'),_0xd88864[_0xcf37('0xe')],_0xd88864[_0xcf37('0x10')],_0xd88864['exten']));recordings[_0xd88864[_0xcf37('0xe')]]={'uniqueid':_0xd88864[_0xcf37('0xe')],'accountcode':_0xd88864[_0xcf37('0x5')],'exten':_0xd88864[_0xcf37('0x11')],'context':_0xd88864[_0xcf37('0x10')],'channel':_0xd88864[_0xcf37('0x12')],'monitors':[]};}}catch(_0x1f8f08){utils[_0xcf37('0x13')](util[_0xcf37('0x3')](_0xcf37('0xd'),_0xd88864['uniqueid']),_0x1f8f08);}};exports[_0xcf37('0x14')]=function(_0x2cc369){try{utils[_0xcf37('0x15')](util[_0xcf37('0x3')](_0xcf37('0x16'),_0x2cc369['uniqueid']),_0x2cc369);if(!_['isNil'](recordings[_0x2cc369[_0xcf37('0xe')]])&&_0x2cc369[_0xcf37('0x17')]==0x6){utils[_0xcf37('0x2')](util[_0xcf37('0x3')](_0xcf37('0x18'),_0x2cc369[_0xcf37('0xe')],_0x2cc369[_0xcf37('0x10')],_0x2cc369[_0xcf37('0x12')]));}else if(!_[_0xcf37('0x19')](recordings[_0x2cc369[_0xcf37('0x1a')]])&&_0x2cc369[_0xcf37('0x17')]==0x6&&_0x2cc369[_0xcf37('0x10')]!=_0xcf37('0x1b')){utils[_0xcf37('0x2')](util[_0xcf37('0x3')]('[%s][recordings][newstate]\x20linkedid:%s\x20context:%s\x20channel:%s',_0x2cc369[_0xcf37('0xe')],_0x2cc369[_0xcf37('0x1a')],_0x2cc369['context'],_0x2cc369['channel']));recordings[_0x2cc369[_0xcf37('0x1a')]][_0xcf37('0x5')]=_0x2cc369[_0xcf37('0x5')];}}catch(_0x5c4103){utils[_0xcf37('0x13')](util[_0xcf37('0x3')](_0xcf37('0x16'),_0x2cc369[_0xcf37('0xe')]),_0x5c4103);}};exports['varset']=function(_0x200f08){try{if(!_[_0xcf37('0x19')](_0x200f08[_0xcf37('0x1c')])&&!_['isNil'](_0x200f08[_0xcf37('0x1c')]['mixmonitor_filename'])){utils[_0xcf37('0x15')](util[_0xcf37('0x3')]('[%s][recordings][varset]',_0x200f08[_0xcf37('0xe')]),_0x200f08);utils[_0xcf37('0x2')](util[_0xcf37('0x3')](_0xcf37('0x1d'),_0x200f08[_0xcf37('0xe')],_0x200f08['variable'],_0x200f08[_0xcf37('0x1e')]));if(_[_0xcf37('0x1f')](_0x200f08[_0xcf37('0x1e')],_0xcf37('0x20'))){_0x200f08[_0xcf37('0x1e')]=_0x200f08['value']['replace'](_0xcf37('0x20'),_0xcf37('0x21'));}if(recordings[_0x200f08['linkedid']]){var _0x50edb0=_['find'](recordings[_0x200f08[_0xcf37('0x1a')]][_0xcf37('0x22')],{'value':_0x200f08[_0xcf37('0x1e')]});if(_[_0xcf37('0x19')](_0x50edb0)){recordings[_0x200f08[_0xcf37('0x1a')]][_0xcf37('0x22')][_0xcf37('0x23')]({'value':_0x200f08[_0xcf37('0x1e')]});}}}}catch(_0x251c96){utils['error'](util[_0xcf37('0x3')]('[%s][recordings][varset]',_0x200f08[_0xcf37('0xe')]),_0x251c96);}};exports[_0xcf37('0x24')]=function(_0x2fd596){try{if(!_[_0xcf37('0x19')](recordings[_0x2fd596[_0xcf37('0xe')]])){utils[_0xcf37('0x15')](util[_0xcf37('0x3')](_0xcf37('0x25'),_0x2fd596[_0xcf37('0xe')]),_0x2fd596);utils[_0xcf37('0x2')](util['format'](_0xcf37('0x26'),_0x2fd596['uniqueid'],_0x2fd596[_0xcf37('0x27')],_0x2fd596[_0xcf37('0x28')],_0x2fd596[_0xcf37('0x29')]));recordings[_0x2fd596[_0xcf37('0xe')]][_0xcf37('0x27')]=_0x2fd596['calleridnum'];recordings[_0x2fd596[_0xcf37('0xe')]][_0xcf37('0x28')]=_0x2fd596[_0xcf37('0x28')];recordings[_0x2fd596['uniqueid']][_0xcf37('0x2a')]=_0x2fd596[_0xcf37('0x2a')];recordings[_0x2fd596[_0xcf37('0xe')]][_0xcf37('0x2b')]=_0x2fd596[_0xcf37('0x2b')];if(recordings[_0x2fd596[_0xcf37('0xe')]][_0xcf37('0x2c')]==_0xcf37('0x2d')&&recordings[_0x2fd596[_0xcf37('0xe')]][_0xcf37('0x5')]){recordings[_0x2fd596[_0xcf37('0xe')]][_0xcf37('0x2a')]=recordings[_0x2fd596[_0xcf37('0xe')]]['accountcode'];recordings[_0x2fd596[_0xcf37('0xe')]][_0xcf37('0x2b')]='';}recordings[_0x2fd596[_0xcf37('0xe')]][_0xcf37('0x22')][_0xcf37('0x2e')](function(_0x2da481){var _0x36b552=_[_0xcf37('0x2f')](recordings[_0x2fd596[_0xcf37('0xe')]]);_0x36b552[_0xcf37('0x1e')]=_0x2da481[_0xcf37('0x1e')];writeDB(_0x36b552);});delete recordings[_0x2fd596[_0xcf37('0xe')]];}}catch(_0x53df52){utils['error'](util[_0xcf37('0x3')](_0xcf37('0x25'),_0x2fd596[_0xcf37('0xe')]),_0x53df52);}};exports['newexten']=function(_0x16b1d7){try{if(!_['isNil'](recordings[_0x16b1d7[_0xcf37('0xe')]])){utils[_0xcf37('0x15')](util[_0xcf37('0x3')]('[%s][recordings][newexten]',_0x16b1d7[_0xcf37('0xe')]),_0x16b1d7);utils[_0xcf37('0x2')](util[_0xcf37('0x3')](_0xcf37('0x30'),_0x16b1d7['uniqueid'],_0x16b1d7[_0xcf37('0x31')],_0x16b1d7[_0xcf37('0x32')]));if(_0x16b1d7[_0xcf37('0x31')][_0xcf37('0x33')]()==_0xcf37('0x34')&&_[_0xcf37('0x35')](_0x16b1d7['appdata'][_0xcf37('0x33')](),_0xcf37('0x36'))){var _0x4a2f00=_0x16b1d7[_0xcf37('0x32')][_0xcf37('0x37')]('=');var _0x541a5a=_0x4a2f00[0x0][_0xcf37('0x38')](_0x4a2f00[0x0][_0xcf37('0x39')]('(')+0x1,_0x4a2f00[0x0][_0xcf37('0x39')](')'));var _0x19ae28=_0x4a2f00[0x1];recordings[_0x16b1d7[_0xcf37('0xe')]][_0x541a5a]=_0x19ae28;}}}catch(_0x46d2cf){utils[_0xcf37('0x13')](util[_0xcf37('0x3')](_0xcf37('0x3a'),_0x16b1d7[_0xcf37('0xe')]),_0x46d2cf);}};exports[_0xcf37('0x3b')]=function(_0x150f74){try{if(!_[_0xcf37('0x19')](recordings[_0x150f74[_0xcf37('0xe')]])){utils['debug'](util[_0xcf37('0x3')](_0xcf37('0x3c'),_0x150f74['uniqueid']),_0x150f74);utils['info'](util[_0xcf37('0x3')](_0xcf37('0x3d'),_0x150f74[_0xcf37('0xe')],_0x150f74[_0xcf37('0x3e')]));recordings[_0x150f74[_0xcf37('0xe')]][_0xcf37('0x3e')]=_0x150f74[_0xcf37('0x3e')];}}catch(_0x3a81ba){utils['error'](util[_0xcf37('0x3')](_0xcf37('0x3c'),_0x150f74[_0xcf37('0xe')]),_0x3a81ba);}}; \ No newline at end of file diff --git a/server/services/xdr/transfers.controller.js b/server/services/xdr/transfers.controller.js index 9c19e3a..058b10c 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 _0xb738=['[%s][transfers][attendedtransfer]','[%s][transfers][attendedtransfer]\x20transferercalleridnum:%s\x20transferercalleridname:%s\x20transfereecalleridnum:%s\x20transfereecalleridname:%s','origtransferercalleridnum','assign','origtransferercalleridname','secondtransfererconnectedlinenum','secondtransfererconnectedlinename','secondtransferercontext','origtransfererlinkedid','origtransferercontext','origtransfererexten','attended','isNil','transfereechannel','transfertargetchannel','transfertargetcalleridname','transfertargetconnectedlinename','transfertargetaccountcode','transfertargetcontext','transfertargetexten','transfertargetlinkedid','origtransfereruniqueid','lodash','info','format','[%s][transfers][writeDB]\x20type:%s','type','debug','[%s][transfers][blindtransfer]\x20transferercalleridnum:%s\x20transferercalleridname:%s\x20transfereecalleridnum:%s\x20transfereecalleridname:%s','uniqueid','transferercalleridnum','transferercalleridname','transfereecalleridnum','blind','error','[%s][transfers][blindtransfer]','attendedtransfer'];(function(_0x1c70a4,_0x5a95b0){var _0x2bd6d0=function(_0x229aa0){while(--_0x229aa0){_0x1c70a4['push'](_0x1c70a4['shift']());}};_0x2bd6d0(++_0x5a95b0);}(_0xb738,0x119));var _0x8b73=function(_0x15cd04,_0x3a005c){_0x15cd04=_0x15cd04-0x0;var _0x3c21ba=_0xb738[_0x15cd04];return _0x3c21ba;};'use strict';var _=require(_0x8b73('0x0'));var util=require('util');var utils=require('./utils');function writeDB(_0x32eff6){utils[_0x8b73('0x1')](util[_0x8b73('0x2')](_0x8b73('0x3'),_0x32eff6[_0x8b73('0x4')]==='attended'?_0x32eff6['origtransfereruniqueid']:_0x32eff6['uniqueid'],_0x32eff6['type']));utils['request']('CreateVoiceTransferReport',_0x32eff6);}exports['blindtransfer']=function(_0x51ccfd){try{utils[_0x8b73('0x5')](util['format']('[%s][transfers][blindtransfer]',_0x51ccfd['uniqueid']),_0x51ccfd);utils['info'](util[_0x8b73('0x2')](_0x8b73('0x6'),_0x51ccfd[_0x8b73('0x7')],_0x51ccfd[_0x8b73('0x8')],_0x51ccfd[_0x8b73('0x9')],_0x51ccfd[_0x8b73('0xa')],_0x51ccfd['transfereecalleridname']));_0x51ccfd[_0x8b73('0x4')]=_0x8b73('0xb');writeDB(_0x51ccfd);}catch(_0x48043d){utils[_0x8b73('0xc')](util[_0x8b73('0x2')](_0x8b73('0xd'),_0x51ccfd[_0x8b73('0x7')]),_0x48043d);}};exports[_0x8b73('0xe')]=function(_0x569af8){try{utils[_0x8b73('0x5')](util[_0x8b73('0x2')](_0x8b73('0xf'),_0x569af8['origtransfereruniqueid']),_0x569af8);utils[_0x8b73('0x1')](util[_0x8b73('0x2')](_0x8b73('0x10'),_0x569af8['origtransfereruniqueid'],_0x569af8[_0x8b73('0x11')],_0x569af8['origtransferercalleridname'],_0x569af8['transfertargetcalleridnum'],_0x569af8['transfertargetcalleridname']));_0x569af8=_[_0x8b73('0x12')](_0x569af8,{'transfererchannel':_0x569af8['origtransfererchannel'],'transferercalleridnum':_0x569af8['origtransferercalleridnum'],'transferercalleridname':_0x569af8[_0x8b73('0x13')],'transfererconnectedlinenum':_0x569af8[_0x8b73('0x14')],'transfererconnectedlinename':_0x569af8[_0x8b73('0x15')],'transfereraccountcode':_0x569af8['origtransfereraccountcode'],'transferercontext':_0x569af8[_0x8b73('0x16')],'transfererexten':_0x569af8['secondtransfererexten'],'transfererlinkedid':_0x569af8[_0x8b73('0x17')],'context':_0x569af8[_0x8b73('0x18')],'extension':_0x569af8[_0x8b73('0x19')],'type':_0x8b73('0x1a')});if(_[_0x8b73('0x1b')](_0x569af8[_0x8b73('0x1c')])){_0x569af8=_[_0x8b73('0x12')](_0x569af8,{'transfereechannel':_0x569af8[_0x8b73('0x1d')],'transfereecalleridnum':_0x569af8['transfertargetcalleridnum'],'transfereecalleridname':_0x569af8[_0x8b73('0x1e')],'transfereeconnectedlinenum':_0x569af8['transfertargetconnectedlinenum'],'transfereeconnectedlinename':_0x569af8[_0x8b73('0x1f')],'transfereeaccountcode':_0x569af8[_0x8b73('0x20')],'transfereecontext':_0x569af8[_0x8b73('0x21')],'transfereeexten':_0x569af8[_0x8b73('0x22')],'transfereelinkedid':_0x569af8[_0x8b73('0x23')]});}writeDB(_0x569af8);}catch(_0x16e893){utils['error'](util['format'](_0x8b73('0xf'),_0x569af8[_0x8b73('0x24')]),_0x16e893);}}; \ No newline at end of file +var _0x2f78=['type','attended','origtransfereruniqueid','request','CreateVoiceTransferReport','blindtransfer','debug','[%s][transfers][blindtransfer]','uniqueid','[%s][transfers][blindtransfer]\x20transferercalleridnum:%s\x20transferercalleridname:%s\x20transfereecalleridnum:%s\x20transfereecalleridname:%s','transferercalleridnum','transferercalleridname','transfereecalleridnum','transfereecalleridname','blind','error','[%s][transfers][attendedtransfer]','[%s][transfers][attendedtransfer]\x20transferercalleridnum:%s\x20transferercalleridname:%s\x20transfereecalleridnum:%s\x20transfereecalleridname:%s','origtransferercalleridnum','origtransferercalleridname','transfertargetcalleridnum','transfertargetcalleridname','assign','origtransfererchannel','secondtransfererconnectedlinenum','secondtransfererconnectedlinename','secondtransfererexten','origtransfererlinkedid','origtransfererexten','isNil','transfereechannel','transfertargetchannel','transfertargetconnectedlinenum','transfertargetconnectedlinename','transfertargetaccountcode','transfertargetcontext','transfertargetexten','lodash','./utils','info','format','[%s][transfers][writeDB]\x20type:%s'];(function(_0x3c1a17,_0x245c7f){var _0x11a03b=function(_0x314156){while(--_0x314156){_0x3c1a17['push'](_0x3c1a17['shift']());}};_0x11a03b(++_0x245c7f);}(_0x2f78,0x19f));var _0x82f7=function(_0x1b4afd,_0x4844bd){_0x1b4afd=_0x1b4afd-0x0;var _0xec9867=_0x2f78[_0x1b4afd];return _0xec9867;};'use strict';var _=require(_0x82f7('0x0'));var util=require('util');var utils=require(_0x82f7('0x1'));function writeDB(_0x54e55c){utils[_0x82f7('0x2')](util[_0x82f7('0x3')](_0x82f7('0x4'),_0x54e55c[_0x82f7('0x5')]===_0x82f7('0x6')?_0x54e55c[_0x82f7('0x7')]:_0x54e55c['uniqueid'],_0x54e55c[_0x82f7('0x5')]));utils[_0x82f7('0x8')](_0x82f7('0x9'),_0x54e55c);}exports[_0x82f7('0xa')]=function(_0x8d801d){try{utils[_0x82f7('0xb')](util[_0x82f7('0x3')](_0x82f7('0xc'),_0x8d801d[_0x82f7('0xd')]),_0x8d801d);utils[_0x82f7('0x2')](util[_0x82f7('0x3')](_0x82f7('0xe'),_0x8d801d[_0x82f7('0xd')],_0x8d801d[_0x82f7('0xf')],_0x8d801d[_0x82f7('0x10')],_0x8d801d[_0x82f7('0x11')],_0x8d801d[_0x82f7('0x12')]));_0x8d801d['type']=_0x82f7('0x13');writeDB(_0x8d801d);}catch(_0x4d12b3){utils[_0x82f7('0x14')](util[_0x82f7('0x3')]('[%s][transfers][blindtransfer]',_0x8d801d[_0x82f7('0xd')]),_0x4d12b3);}};exports['attendedtransfer']=function(_0x2114cf){try{utils['debug'](util[_0x82f7('0x3')](_0x82f7('0x15'),_0x2114cf[_0x82f7('0x7')]),_0x2114cf);utils['info'](util[_0x82f7('0x3')](_0x82f7('0x16'),_0x2114cf[_0x82f7('0x7')],_0x2114cf[_0x82f7('0x17')],_0x2114cf[_0x82f7('0x18')],_0x2114cf[_0x82f7('0x19')],_0x2114cf[_0x82f7('0x1a')]));_0x2114cf=_[_0x82f7('0x1b')](_0x2114cf,{'transfererchannel':_0x2114cf[_0x82f7('0x1c')],'transferercalleridnum':_0x2114cf[_0x82f7('0x17')],'transferercalleridname':_0x2114cf[_0x82f7('0x18')],'transfererconnectedlinenum':_0x2114cf[_0x82f7('0x1d')],'transfererconnectedlinename':_0x2114cf[_0x82f7('0x1e')],'transfereraccountcode':_0x2114cf['origtransfereraccountcode'],'transferercontext':_0x2114cf['secondtransferercontext'],'transfererexten':_0x2114cf[_0x82f7('0x1f')],'transfererlinkedid':_0x2114cf[_0x82f7('0x20')],'context':_0x2114cf['origtransferercontext'],'extension':_0x2114cf[_0x82f7('0x21')],'type':_0x82f7('0x6')});if(_[_0x82f7('0x22')](_0x2114cf[_0x82f7('0x23')])){_0x2114cf=_[_0x82f7('0x1b')](_0x2114cf,{'transfereechannel':_0x2114cf[_0x82f7('0x24')],'transfereecalleridnum':_0x2114cf[_0x82f7('0x19')],'transfereecalleridname':_0x2114cf[_0x82f7('0x1a')],'transfereeconnectedlinenum':_0x2114cf[_0x82f7('0x25')],'transfereeconnectedlinename':_0x2114cf[_0x82f7('0x26')],'transfereeaccountcode':_0x2114cf[_0x82f7('0x27')],'transfereecontext':_0x2114cf[_0x82f7('0x28')],'transfereeexten':_0x2114cf[_0x82f7('0x29')],'transfereelinkedid':_0x2114cf['transfertargetlinkedid']});}writeDB(_0x2114cf);}catch(_0x41d09f){utils[_0x82f7('0x14')](util[_0x82f7('0x3')](_0x82f7('0x15'),_0x2114cf[_0x82f7('0x7')]),_0x41d09f);}}; \ No newline at end of file diff --git a/server/services/xdr/utils.js b/server/services/xdr/utils.js index fddce61..1e0543a 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 _0x6f17=['error','request','catch','[utils][request]\x20name:%s','internal','name','interface','then','[utils][getUser]\x20where:%s','stringify','length','[utils][getUserByInternal]\x20internal:%s\x20%s','found','notfound','getUserByInterface','[utils][getUserByInterface]\x20interface:%s\x20%s','[utils][getUserByName]','getVoiceQueueByName','GetVoiceQueue','type','acwTimeout','[utils][getVoiceQueueByName]\x20name:%s','[utils][getVoiceQueueByName]\x20name:%s\x20%s','result','[utils][getVoiceQueueByName]','add','format','YYYY-MM-DD\x20HH:mm:ss','subtractTime','subtract','seconds','diff','sumTime','isAfter','isBefore','util','client','http','../../config/logger','xdr','info','inspect','debug'];(function(_0x54dcad,_0x554f46){var _0x537c56=function(_0x48ff85){while(--_0x48ff85){_0x54dcad['push'](_0x54dcad['shift']());}};_0x537c56(++_0x554f46);}(_0x6f17,0x1a6));var _0x76f1=function(_0x1928c9,_0x13a6d1){_0x1928c9=_0x1928c9-0x0;var _0x51b5fb=_0x6f17[_0x1928c9];return _0x51b5fb;};'use strict';var BPromise=require('bluebird');var jayson=require('jayson/promise');var moment=require('moment');var util=require(_0x76f1('0x0'));var client=jayson[_0x76f1('0x1')][_0x76f1('0x2')]({'port':0x2329});var logger=require(_0x76f1('0x3'))(_0x76f1('0x4'));exports['info']=function(_0x30cedf,_0x2c156b){logger[_0x76f1('0x5')](_0x30cedf,_0x2c156b?util[_0x76f1('0x6')](_0x2c156b,{'showHidden':![],'depth':null}):'');};exports[_0x76f1('0x7')]=function(_0x44e147,_0xfbf961){logger[_0x76f1('0x7')](_0x44e147,_0xfbf961?util[_0x76f1('0x6')](_0xfbf961,{'showHidden':![],'depth':null}):'');};exports['error']=function(_0x4cb72b,_0x5cc62e){logger[_0x76f1('0x8')](_0x4cb72b,_0x5cc62e?util[_0x76f1('0x6')](_0x5cc62e,{'showHidden':![],'depth':null}):'');};exports['request']=function(_0xe96e77,_0x173f61){return client[_0x76f1('0x9')](_0xe96e77,{'body':_0x173f61})['then'](function(_0x3093f0){logger[_0x76f1('0x7')]('[utils][request]\x20name:%s',_0xe96e77,_0x3093f0?util['inspect'](_0x3093f0,{'showHidden':![],'depth':null}):'');})[_0x76f1('0xa')](function(_0x45491e){logger[_0x76f1('0x8')](_0x76f1('0xb'),_0xe96e77,_0x45491e?util['inspect'](_0x45491e,{'showHidden':![],'depth':null}):'');});};function getUser(_0xfe9370){return client[_0x76f1('0x9')]('GetUser',{'options':{'raw':!![],'attributes':['id',_0x76f1('0xc'),_0x76f1('0xd'),_0x76f1('0xe')],'where':_0xfe9370,'limit':0x1}})[_0x76f1('0xf')](function(_0xb03722){logger[_0x76f1('0x7')](_0x76f1('0x10'),JSON[_0x76f1('0x11')](_0xfe9370),_0xb03722?util[_0x76f1('0x6')](_0xb03722,{'showHidden':![],'depth':null}):'');return _0xb03722['result'][_0x76f1('0x12')]?_0xb03722['result'][0x0]:null;});}exports['getUserByInternal']=function(_0x3e33fc){return new BPromise(function(_0x506413,_0xa08b17){if(_0x3e33fc){return getUser({'internal':_0x3e33fc})[_0x76f1('0xf')](function(_0x164d53){logger[_0x76f1('0x5')](_0x76f1('0x13'),_0x3e33fc,_0x164d53?_0x76f1('0x14'):_0x76f1('0x15'));return _0x506413(_0x164d53);})[_0x76f1('0xa')](function(_0x1bfb4b){logger[_0x76f1('0x8')]('[utils][getUserByInternal]',_0x1bfb4b?util[_0x76f1('0x6')](_0x1bfb4b,{'showHidden':![],'depth':null}):'');return _0x506413(null);});}return _0x506413(null);});};exports[_0x76f1('0x16')]=function(_0x82bd0a){return new BPromise(function(_0x46afa4,_0x1aaa8f){if(_0x82bd0a){return getUser({'interface':_0x82bd0a})[_0x76f1('0xf')](function(_0x8260cf){logger[_0x76f1('0x5')](_0x76f1('0x17'),_0x82bd0a,_0x8260cf?_0x76f1('0x14'):'notfound');return _0x46afa4(_0x8260cf);})['catch'](function(_0x517fdc){logger[_0x76f1('0x8')]('[utils][getUserByInterface]',_0x517fdc?util['inspect'](_0x517fdc,{'showHidden':![],'depth':null}):'');return _0x46afa4(null);});}return _0x46afa4(null);});};exports['getUserByName']=function(_0x50fca4){return new BPromise(function(_0x519e13,_0x132e00){if(_0x50fca4){return getUser({'name':_0x50fca4})['then'](function(_0x2258ea){logger[_0x76f1('0x5')]('[utils][getUserByName]\x20name:%s\x20%s',_0x50fca4,_0x2258ea?'found':'notfound');return _0x519e13(_0x2258ea);})['catch'](function(_0x484f26){logger[_0x76f1('0x8')](_0x76f1('0x18'),_0x484f26?util['inspect'](_0x484f26,{'showHidden':![],'depth':null}):'');return _0x519e13(null);});}return _0x519e13(null);});};exports[_0x76f1('0x19')]=function(_0x405002){return new BPromise(function(_0x488a2e,_0x5ce0a7){if(_0x405002){return client[_0x76f1('0x9')](_0x76f1('0x1a'),{'options':{'raw':!![],'attributes':['id',_0x76f1('0xd'),_0x76f1('0x1b'),'acw',_0x76f1('0x1c')],'where':{'name':_0x405002},'limit':0x1}})['then'](function(_0x77f2e2){logger[_0x76f1('0x7')](_0x76f1('0x1d'),_0x405002,_0x77f2e2?util[_0x76f1('0x6')](_0x77f2e2,{'showHidden':![],'depth':null}):'');logger['info'](_0x76f1('0x1e'),_0x405002,_0x77f2e2?_0x76f1('0x14'):'notfound');return _0x488a2e(_0x77f2e2['result'][_0x76f1('0x12')]?_0x77f2e2[_0x76f1('0x1f')][0x0]:null);})[_0x76f1('0xa')](function(_0x2eb459){logger[_0x76f1('0x8')](_0x76f1('0x20'),_0x2eb459?util[_0x76f1('0x6')](_0x2eb459,{'showHidden':![],'depth':null}):'');return _0x488a2e(null);});}return _0x488a2e(null);});};exports['addTime']=function(_0x398c5c,_0x1ba05d){return moment(_0x398c5c)[_0x76f1('0x21')](_0x1ba05d,'seconds')[_0x76f1('0x22')](_0x76f1('0x23'));};exports[_0x76f1('0x24')]=function(_0x4a725a,_0x3ed613){return moment(_0x4a725a)[_0x76f1('0x25')](_0x3ed613,_0x76f1('0x26'))['format']('YYYY-MM-DD\x20HH:mm:ss');};exports['diffTime']=function(_0x2154b1,_0x3202ff){return moment(_0x2154b1)[_0x76f1('0x27')](moment(_0x3202ff),_0x76f1('0x26'));};exports[_0x76f1('0x28')]=function(_0x34ae90,_0x5627a6){return parseInt(_0x34ae90,0xa)+parseInt(_0x5627a6,0xa);};exports['now']=function(){return moment()[_0x76f1('0x22')](_0x76f1('0x23'));};exports[_0x76f1('0x29')]=function(_0x2428a4,_0x56f8ba){if(_0x56f8ba){return moment(_0x2428a4)['isAfter'](_0x56f8ba);}return!![];};exports['isBefore']=function(_0x3a063d,_0x192d8e){if(_0x192d8e){return moment(_0x3a063d)[_0x76f1('0x2a')](_0x192d8e);}else if(_0x3a063d){return!![];}return![];}; \ No newline at end of file +var _0x6863=['request','then','debug','catch','[utils][request]\x20name:%s','GetUser','name','interface','[utils][getUser]\x20where:%s','result','length','getUserByInternal','found','[utils][getUserByInternal]','getUserByInterface','[utils][getUserByInterface]\x20interface:%s\x20%s','getUserByName','[utils][getUserByName]\x20name:%s\x20%s','notfound','getVoiceQueueByName','GetVoiceQueue','type','acw','acwTimeout','[utils][getVoiceQueueByName]\x20name:%s\x20%s','[utils][getVoiceQueueByName]','addTime','seconds','format','YYYY-MM-DD\x20HH:mm:ss','subtractTime','subtract','diff','sumTime','now','isAfter','isBefore','bluebird','jayson/promise','moment','http','../../config/logger','info','inspect','error'];(function(_0xa7d678,_0x3dfdff){var _0x5cc539=function(_0x4393d7){while(--_0x4393d7){_0xa7d678['push'](_0xa7d678['shift']());}};_0x5cc539(++_0x3dfdff);}(_0x6863,0xd9));var _0x3686=function(_0x5b9aee,_0x373921){_0x5b9aee=_0x5b9aee-0x0;var _0x495cdb=_0x6863[_0x5b9aee];return _0x495cdb;};'use strict';var BPromise=require(_0x3686('0x0'));var jayson=require(_0x3686('0x1'));var moment=require(_0x3686('0x2'));var util=require('util');var client=jayson['client'][_0x3686('0x3')]({'port':0x2329});var logger=require(_0x3686('0x4'))('xdr');exports[_0x3686('0x5')]=function(_0x4d0177,_0xb93dbf){logger[_0x3686('0x5')](_0x4d0177,_0xb93dbf?util[_0x3686('0x6')](_0xb93dbf,{'showHidden':![],'depth':null}):'');};exports['debug']=function(_0x7dd73c,_0x24583a){logger['debug'](_0x7dd73c,_0x24583a?util[_0x3686('0x6')](_0x24583a,{'showHidden':![],'depth':null}):'');};exports[_0x3686('0x7')]=function(_0x5a448f,_0x39cc71){logger[_0x3686('0x7')](_0x5a448f,_0x39cc71?util[_0x3686('0x6')](_0x39cc71,{'showHidden':![],'depth':null}):'');};exports['request']=function(_0x354bea,_0x1115b8){return client[_0x3686('0x8')](_0x354bea,{'body':_0x1115b8})[_0x3686('0x9')](function(_0x38a441){logger[_0x3686('0xa')]('[utils][request]\x20name:%s',_0x354bea,_0x38a441?util['inspect'](_0x38a441,{'showHidden':![],'depth':null}):'');})[_0x3686('0xb')](function(_0x2cb001){logger[_0x3686('0x7')](_0x3686('0xc'),_0x354bea,_0x2cb001?util['inspect'](_0x2cb001,{'showHidden':![],'depth':null}):'');});};function getUser(_0x2a4f3b){return client[_0x3686('0x8')](_0x3686('0xd'),{'options':{'raw':!![],'attributes':['id','internal',_0x3686('0xe'),_0x3686('0xf')],'where':_0x2a4f3b,'limit':0x1}})[_0x3686('0x9')](function(_0x2eecfb){logger[_0x3686('0xa')](_0x3686('0x10'),JSON['stringify'](_0x2a4f3b),_0x2eecfb?util['inspect'](_0x2eecfb,{'showHidden':![],'depth':null}):'');return _0x2eecfb[_0x3686('0x11')][_0x3686('0x12')]?_0x2eecfb[_0x3686('0x11')][0x0]:null;});}exports[_0x3686('0x13')]=function(_0x198144){return new BPromise(function(_0x970b14,_0x4a2053){if(_0x198144){return getUser({'internal':_0x198144})[_0x3686('0x9')](function(_0x1af5ed){logger[_0x3686('0x5')]('[utils][getUserByInternal]\x20internal:%s\x20%s',_0x198144,_0x1af5ed?_0x3686('0x14'):'notfound');return _0x970b14(_0x1af5ed);})[_0x3686('0xb')](function(_0x2395aa){logger[_0x3686('0x7')](_0x3686('0x15'),_0x2395aa?util[_0x3686('0x6')](_0x2395aa,{'showHidden':![],'depth':null}):'');return _0x970b14(null);});}return _0x970b14(null);});};exports[_0x3686('0x16')]=function(_0x333010){return new BPromise(function(_0xff47ca,_0x49ccb2){if(_0x333010){return getUser({'interface':_0x333010})[_0x3686('0x9')](function(_0x320a4a){logger[_0x3686('0x5')](_0x3686('0x17'),_0x333010,_0x320a4a?_0x3686('0x14'):'notfound');return _0xff47ca(_0x320a4a);})[_0x3686('0xb')](function(_0x4f2772){logger[_0x3686('0x7')]('[utils][getUserByInterface]',_0x4f2772?util[_0x3686('0x6')](_0x4f2772,{'showHidden':![],'depth':null}):'');return _0xff47ca(null);});}return _0xff47ca(null);});};exports[_0x3686('0x18')]=function(_0x4c6de3){return new BPromise(function(_0x587741,_0x20d715){if(_0x4c6de3){return getUser({'name':_0x4c6de3})['then'](function(_0x4c7da2){logger[_0x3686('0x5')](_0x3686('0x19'),_0x4c6de3,_0x4c7da2?_0x3686('0x14'):_0x3686('0x1a'));return _0x587741(_0x4c7da2);})['catch'](function(_0x753972){logger['error']('[utils][getUserByName]',_0x753972?util[_0x3686('0x6')](_0x753972,{'showHidden':![],'depth':null}):'');return _0x587741(null);});}return _0x587741(null);});};exports[_0x3686('0x1b')]=function(_0x56896e){return new BPromise(function(_0x281525,_0x1f0481){if(_0x56896e){return client[_0x3686('0x8')](_0x3686('0x1c'),{'options':{'raw':!![],'attributes':['id',_0x3686('0xe'),_0x3686('0x1d'),_0x3686('0x1e'),_0x3686('0x1f')],'where':{'name':_0x56896e},'limit':0x1}})[_0x3686('0x9')](function(_0x448858){logger[_0x3686('0xa')]('[utils][getVoiceQueueByName]\x20name:%s',_0x56896e,_0x448858?util['inspect'](_0x448858,{'showHidden':![],'depth':null}):'');logger['info'](_0x3686('0x20'),_0x56896e,_0x448858?_0x3686('0x14'):_0x3686('0x1a'));return _0x281525(_0x448858[_0x3686('0x11')]['length']?_0x448858[_0x3686('0x11')][0x0]:null);})[_0x3686('0xb')](function(_0x1638af){logger[_0x3686('0x7')](_0x3686('0x21'),_0x1638af?util['inspect'](_0x1638af,{'showHidden':![],'depth':null}):'');return _0x281525(null);});}return _0x281525(null);});};exports[_0x3686('0x22')]=function(_0x596d8c,_0x112123){return moment(_0x596d8c)['add'](_0x112123,_0x3686('0x23'))[_0x3686('0x24')](_0x3686('0x25'));};exports[_0x3686('0x26')]=function(_0x4a0ba8,_0x291878){return moment(_0x4a0ba8)[_0x3686('0x27')](_0x291878,_0x3686('0x23'))[_0x3686('0x24')]('YYYY-MM-DD\x20HH:mm:ss');};exports['diffTime']=function(_0x557a09,_0x325fc8){return moment(_0x557a09)[_0x3686('0x28')](moment(_0x325fc8),'seconds');};exports[_0x3686('0x29')]=function(_0x3c2c16,_0x4ca139){return parseInt(_0x3c2c16,0xa)+parseInt(_0x4ca139,0xa);};exports[_0x3686('0x2a')]=function(){return moment()[_0x3686('0x24')]('YYYY-MM-DD\x20HH:mm:ss');};exports[_0x3686('0x2b')]=function(_0x4dbe12,_0x1f28a9){if(_0x1f28a9){return moment(_0x4dbe12)[_0x3686('0x2b')](_0x1f28a9);}return!![];};exports[_0x3686('0x2c')]=function(_0x2cbbc3,_0x47538d){if(_0x47538d){return moment(_0x2cbbc3)[_0x3686('0x2c')](_0x47538d);}else if(_0x2cbbc3){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 a6901c8..b9b61ca 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 _0xda95=['lodash','path','./loggers','fileLogger','./safe-template','safeTemplate','maskSensitiveData','join','/var','client','name','ensureDir','then','catch','log','user','no-user','data','timestamp','auth','set','client-side-logger','use','%s\x20%s\x20%s\x20%s\x20%sms\x20id=%s\x20name=%s\x20role=%s','isEmpty','body','\x20body=%s','method','headers','x-forwarded-for','connection','responseTime','inspect','logger','%s\x20%s\x20%s\x20%s\x20%sms\x20id=%s\x20name=%s\x20role=%s\x20device=%s','device','agent_id','%s\x20%s\x20%s\x20%s\x20%sms\x20id=%s\x20name=%s\x20role=%s\x20device=%s\x20(id=%s\x20name=%s)','format','remoteAddress','url','statusCode','agent_name','test','setupLoggers','fs-extra'];(function(_0x4e419f,_0x40c574){var _0x48f942=function(_0x185dd9){while(--_0x185dd9){_0x4e419f['push'](_0x4e419f['shift']());}};_0x48f942(++_0x40c574);}(_0xda95,0x1cb));var _0x5da9=function(_0x27e811,_0x20137c){_0x27e811=_0x27e811-0x0;var _0x1627fa=_0xda95[_0x27e811];return _0x1627fa;};var fs=require(_0x5da9('0x0'));var _=require(_0x5da9('0x1'));var ewinston=require('express-winston');var path=require(_0x5da9('0x2'));var util=require('util');var fileLogger=require(_0x5da9('0x3'))[_0x5da9('0x4')];var safeTemplate=require(_0x5da9('0x5'))[_0x5da9('0x6')];var maskSensitiveData=require('./mask-sensitive-data')[_0x5da9('0x7')];function ClientSideLogger(){function _0x5ca047(_0x536985){var _0xe2e9a3=path[_0x5da9('0x8')](_0x5da9('0x9'),'log','xcally');var _0x49f8eb=path['join'](_0x5da9('0xa'),_0x536985['role']+'-'+_0x536985[_0x5da9('0xb')]);return fs[_0x5da9('0xc')](path[_0x5da9('0x8')](_0xe2e9a3,_0x49f8eb))[_0x5da9('0xd')](function(){var _0x4f989e=fileLogger(_0x5da9('0xa'),path[_0x5da9('0x8')](_0xe2e9a3,_0x49f8eb));return _0x4f989e;})[_0x5da9('0xe')](function(_0x439027){throw _0x439027;});}this[_0x5da9('0xf')]=function(_0x497b3f,_0x15d532,_0x36d382,_0x29e0f0){return _0x5ca047(_0x497b3f['user'])['then'](function(_0x4f2562){var _0x10dd89=_0x4f2562[_0x15d532];return _0x10dd89;})[_0x5da9('0xd')](function(_0x2d86e6){var _0x2e3e8c=_0x497b3f[_0x5da9('0x10')]?_0x497b3f['user']['id']:_0x5da9('0x11');var _0x3f6bc5=_0x29e0f0[_0x5da9('0x12')];var _0x3f893d=_0x29e0f0[_0x5da9('0x13')];var _0x9a0f2d=new Date(Number(_0x3f893d));return _0x2d86e6(_0x2e3e8c,_0x9a0f2d,_0x36d382,_0x3f6bc5);})['catch'](function(_0x340a1e){fileLogger(_0x5da9('0xa'))['error'](_0x340a1e);});};}function setupLoggers(_0xbad669){return new Promise(function(_0x13f04d){var _0x28b3bc=new ClientSideLogger();var _0x2bad10=fileLogger('api');var _0x4dbd44=fileLogger(_0x5da9('0x14'));_0xbad669[_0x5da9('0x15')](_0x5da9('0x16'),_0x28b3bc);_0xbad669[_0x5da9('0x17')](ewinston['logger']({'winstonInstance':_0x2bad10,'meta':![],'statusLevels':!![],'msg':function(_0x487048,_0x10d123){var _0x1e94c9=_0x5da9('0x18');if(!_[_0x5da9('0x19')](_0x487048[_0x5da9('0x1a')])){_0x1e94c9+=_0x5da9('0x1b');var _0x517617=_0x487048['body'];maskSensitiveData(_0x517617);}return safeTemplate(util['format'](_0x1e94c9,_0x487048[_0x5da9('0x1c')],_0x487048[_0x5da9('0x1d')][_0x5da9('0x1e')]?_0x487048[_0x5da9('0x1d')][_0x5da9('0x1e')]:_0x487048[_0x5da9('0x1f')]['remoteAddress']||_0x487048['ip'],_0x487048['url'],_0x10d123['statusCode'],_0x10d123[_0x5da9('0x20')],_0x487048[_0x5da9('0x10')]?_0x487048[_0x5da9('0x10')]['id']:null,_0x487048[_0x5da9('0x10')]?_0x487048[_0x5da9('0x10')]['name']:null,_0x487048['user']?_0x487048[_0x5da9('0x10')]['role']:null,_0x517617?util[_0x5da9('0x21')](_0x517617,![],null):''));}}));_0xbad669[_0x5da9('0x17')](ewinston[_0x5da9('0x22')]({'winstonInstance':_0x4dbd44,'meta':![],'statusLevels':!![],'msg':function(_0x538a59,_0x546b79){var _0x1fae46=_0x5da9('0x23');if(_0x538a59[_0x5da9('0x1a')]&&_0x538a59['body'][_0x5da9('0x24')]&&_0x538a59[_0x5da9('0x1a')][_0x5da9('0x25')]){_0x1fae46=_0x5da9('0x26');}return util[_0x5da9('0x27')](_0x1fae46,_0x538a59['method'],_0x538a59[_0x5da9('0x1d')][_0x5da9('0x1e')]?_0x538a59['headers'][_0x5da9('0x1e')]:_0x538a59['connection'][_0x5da9('0x28')]||_0x538a59['ip'],_0x538a59[_0x5da9('0x29')],_0x546b79[_0x5da9('0x2a')],_0x546b79[_0x5da9('0x20')],_0x538a59['user']?_0x538a59['user']['id']:null,_0x538a59[_0x5da9('0x10')]?_0x538a59[_0x5da9('0x10')][_0x5da9('0xb')]:null,_0x538a59[_0x5da9('0x10')]?_0x538a59['user']['role']:null,_0x538a59['body']&&_0x538a59[_0x5da9('0x1a')]['device']?_0x538a59['body']['device']:'other',_0x538a59['body']&&_0x538a59[_0x5da9('0x1a')][_0x5da9('0x25')]?_0x538a59[_0x5da9('0x1a')][_0x5da9('0x25')]:'',_0x538a59[_0x5da9('0x1a')]&&_0x538a59[_0x5da9('0x1a')][_0x5da9('0x2b')]?_0x538a59[_0x5da9('0x1a')][_0x5da9('0x2b')]:'');},'ignoreRoute':function(_0x3b24dc){var _0x5b2e8d=/\/api\/users\/[0-9]+\/(login|logout)/gi;return!_0x5b2e8d[_0x5da9('0x2c')](_0x3b24dc[_0x5da9('0x29')]);}}));return _0x13f04d();});}exports[_0x5da9('0x2d')]=setupLoggers; \ No newline at end of file +var _0x7031=['catch','user','no-user','data','error','api','auth','set','client-side-logger','use','body','\x20body=%s','headers','x-forwarded-for','connection','url','statusCode','responseTime','inspect','logger','%s\x20%s\x20%s\x20%s\x20%sms\x20id=%s\x20name=%s\x20role=%s\x20device=%s','device','agent_id','%s\x20%s\x20%s\x20%s\x20%sms\x20id=%s\x20name=%s\x20role=%s\x20device=%s\x20(id=%s\x20name=%s)','format','method','remoteAddress','agent_name','test','setupLoggers','fs-extra','lodash','express-winston','path','util','./loggers','fileLogger','safeTemplate','maskSensitiveData','/var','log','xcally','join','client','role','name','ensureDir','then'];(function(_0x1620d6,_0x23de8b){var _0x3db965=function(_0x5abe67){while(--_0x5abe67){_0x1620d6['push'](_0x1620d6['shift']());}};_0x3db965(++_0x23de8b);}(_0x7031,0x10e));var _0x1703=function(_0x2ec4ae,_0x17e4e3){_0x2ec4ae=_0x2ec4ae-0x0;var _0x4c1325=_0x7031[_0x2ec4ae];return _0x4c1325;};var fs=require(_0x1703('0x0'));var _=require(_0x1703('0x1'));var ewinston=require(_0x1703('0x2'));var path=require(_0x1703('0x3'));var util=require(_0x1703('0x4'));var fileLogger=require(_0x1703('0x5'))[_0x1703('0x6')];var safeTemplate=require('./safe-template')[_0x1703('0x7')];var maskSensitiveData=require('./mask-sensitive-data')[_0x1703('0x8')];function ClientSideLogger(){function _0x565981(_0x15bc82){var _0x3bc1dc=path['join'](_0x1703('0x9'),_0x1703('0xa'),_0x1703('0xb'));var _0x160d38=path[_0x1703('0xc')](_0x1703('0xd'),_0x15bc82[_0x1703('0xe')]+'-'+_0x15bc82[_0x1703('0xf')]);return fs[_0x1703('0x10')](path[_0x1703('0xc')](_0x3bc1dc,_0x160d38))[_0x1703('0x11')](function(){var _0x3de0a8=fileLogger(_0x1703('0xd'),path[_0x1703('0xc')](_0x3bc1dc,_0x160d38));return _0x3de0a8;})[_0x1703('0x12')](function(_0x31c077){throw _0x31c077;});}this[_0x1703('0xa')]=function(_0x4d7355,_0x3aaf41,_0x255fd0,_0x5cd993){return _0x565981(_0x4d7355[_0x1703('0x13')])[_0x1703('0x11')](function(_0xf73e26){var _0xafe4d2=_0xf73e26[_0x3aaf41];return _0xafe4d2;})[_0x1703('0x11')](function(_0x427fb4){var _0x2c9809=_0x4d7355[_0x1703('0x13')]?_0x4d7355['user']['id']:_0x1703('0x14');var _0x6d2511=_0x5cd993[_0x1703('0x15')];var _0x4b5ada=_0x5cd993['timestamp'];var _0x4be63b=new Date(Number(_0x4b5ada));return _0x427fb4(_0x2c9809,_0x4be63b,_0x255fd0,_0x6d2511);})[_0x1703('0x12')](function(_0x2bb0a9){fileLogger(_0x1703('0xd'))[_0x1703('0x16')](_0x2bb0a9);});};}function setupLoggers(_0x43d217){return new Promise(function(_0x547c55){var _0x58036b=new ClientSideLogger();var _0x23a325=fileLogger(_0x1703('0x17'));var _0x4c789d=fileLogger(_0x1703('0x18'));_0x43d217[_0x1703('0x19')](_0x1703('0x1a'),_0x58036b);_0x43d217[_0x1703('0x1b')](ewinston['logger']({'winstonInstance':_0x23a325,'meta':![],'statusLevels':!![],'msg':function(_0x4cd99a,_0x5471ac){var _0x296beb='%s\x20%s\x20%s\x20%s\x20%sms\x20id=%s\x20name=%s\x20role=%s';if(!_['isEmpty'](_0x4cd99a[_0x1703('0x1c')])){_0x296beb+=_0x1703('0x1d');var _0x215ade=_0x4cd99a[_0x1703('0x1c')];maskSensitiveData(_0x215ade);}return safeTemplate(util['format'](_0x296beb,_0x4cd99a['method'],_0x4cd99a[_0x1703('0x1e')][_0x1703('0x1f')]?_0x4cd99a[_0x1703('0x1e')][_0x1703('0x1f')]:_0x4cd99a[_0x1703('0x20')]['remoteAddress']||_0x4cd99a['ip'],_0x4cd99a[_0x1703('0x21')],_0x5471ac[_0x1703('0x22')],_0x5471ac[_0x1703('0x23')],_0x4cd99a[_0x1703('0x13')]?_0x4cd99a['user']['id']:null,_0x4cd99a[_0x1703('0x13')]?_0x4cd99a[_0x1703('0x13')][_0x1703('0xf')]:null,_0x4cd99a['user']?_0x4cd99a[_0x1703('0x13')][_0x1703('0xe')]:null,_0x215ade?util[_0x1703('0x24')](_0x215ade,![],null):''));}}));_0x43d217[_0x1703('0x1b')](ewinston[_0x1703('0x25')]({'winstonInstance':_0x4c789d,'meta':![],'statusLevels':!![],'msg':function(_0x533774,_0x29c78e){var _0x4ed1ad=_0x1703('0x26');if(_0x533774['body']&&_0x533774[_0x1703('0x1c')][_0x1703('0x27')]&&_0x533774['body'][_0x1703('0x28')]){_0x4ed1ad=_0x1703('0x29');}return util[_0x1703('0x2a')](_0x4ed1ad,_0x533774[_0x1703('0x2b')],_0x533774[_0x1703('0x1e')][_0x1703('0x1f')]?_0x533774[_0x1703('0x1e')][_0x1703('0x1f')]:_0x533774[_0x1703('0x20')][_0x1703('0x2c')]||_0x533774['ip'],_0x533774[_0x1703('0x21')],_0x29c78e['statusCode'],_0x29c78e['responseTime'],_0x533774[_0x1703('0x13')]?_0x533774['user']['id']:null,_0x533774['user']?_0x533774[_0x1703('0x13')]['name']:null,_0x533774[_0x1703('0x13')]?_0x533774[_0x1703('0x13')][_0x1703('0xe')]:null,_0x533774['body']&&_0x533774['body'][_0x1703('0x27')]?_0x533774['body'][_0x1703('0x27')]:'other',_0x533774[_0x1703('0x1c')]&&_0x533774[_0x1703('0x1c')][_0x1703('0x28')]?_0x533774[_0x1703('0x1c')][_0x1703('0x28')]:'',_0x533774[_0x1703('0x1c')]&&_0x533774['body']['agent_name']?_0x533774[_0x1703('0x1c')][_0x1703('0x2d')]:'');},'ignoreRoute':function(_0x3da178){var _0x189121=/\/api\/users\/[0-9]+\/(login|logout)/gi;return!_0x189121[_0x1703('0x2e')](_0x3da178[_0x1703('0x21')]);}}));return _0x547c55();});}exports[_0x1703('0x2f')]=setupLoggers; \ No newline at end of file diff --git a/server/utils/iftime.js b/server/utils/iftime.js index 1ce4057..c5df85a 100644 --- a/server/utils/iftime.js +++ b/server/utils/iftime.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0xd131=['moment-timezone','map','source','join','Interval\x20string\x20not\x20valid','Date\x20not\x20valid','isValid','split','locale','weekdaysShort','slice','concat','circularDoWInterval','monthsShort','indexOf','exports','circularMonthInterval','clone','hours','minutes','isBefore','startOf','day','isBetween','timeCompare','format','ddd','toLowerCase','includes','dowCompare','date','daysInMonth','max','min','domCompare','MMM','monthCompare','guess','test','isMoment','padStart','length','lodash'];(function(_0x363143,_0x229d84){var _0x11bc33=function(_0x299f03){while(--_0x299f03){_0x363143['push'](_0x363143['shift']());}};_0x11bc33(++_0x229d84);}(_0xd131,0x157));var _0x1d13=function(_0x211f68,_0x47a58a){_0x211f68=_0x211f68-0x0;var _0x13604e=_0xd131[_0x211f68];return _0x13604e;};var _=require(_0x1d13('0x0'));var moment=require(_0x1d13('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][_0x1d13('0x2')](function(_0x22cd77){return _0x22cd77[_0x1d13('0x3')];})[_0x1d13('0x4')](',');var validateRx=new RegExp('^'+globalRx+'$');var EINVALID_STRING=_0x1d13('0x5');var EINVALID_DATE=_0x1d13('0x6');function throwIfDateNotValid(_0x11192b){if(!_0x11192b[_0x1d13('0x7')]()){throw new Error(EINVALID_DATE);}}function extractTime(_0x281906){var _0x593fbf=_0x281906[_0x1d13('0x8')](':')[_0x1d13('0x2')](function(_0x1fad61){return parseInt(_0x1fad61,0xa);});var _0x554870=_0x593fbf[0x0];var _0xe00af0=_0x593fbf[0x1];if(_0x554870<0x0||_0x554870>0x17||_0xe00af0<0x0||_0xe00af0>0x3b){throw new Error(EINVALID_DATE);}return[_0x554870,_0xe00af0];}function circularDoWInterval(_0x3d6378,_0x2f8e66){if(_0x3d6378===_0x2f8e66){return[_0x3d6378];}else{var _0x2ac8a5=moment[_0x1d13('0x9')]();moment[_0x1d13('0x9')]('en');var _0x6fa295=moment[_0x1d13('0xa')]()[_0x1d13('0x2')](function(_0x4e2798){return _0x4e2798['toLowerCase']();});moment[_0x1d13('0x9')](_0x2ac8a5);var _0x48eeb8=_0x6fa295['indexOf'](_0x3d6378);var _0x1e4aff=_0x6fa295['indexOf'](_0x2f8e66);if(_0x1e4aff>_0x48eeb8){return _0x6fa295['slice'](_0x48eeb8,_0x1e4aff+0x1);}else{var _0x5d6840=_0x6fa295[_0x1d13('0xb')](0x0,_0x1e4aff+0x1);var _0x9e86f4=_0x6fa295[_0x1d13('0xb')](_0x48eeb8);return _0x9e86f4[_0x1d13('0xc')](_0x5d6840);}}}module['exports'][_0x1d13('0xd')]=circularDoWInterval;function circularMonthInterval(_0x56407a,_0x125395){if(_0x56407a===_0x125395){return[_0x56407a];}else{var _0x22996a=moment[_0x1d13('0x9')]();moment[_0x1d13('0x9')]('en');var _0x567d2b=moment[_0x1d13('0xe')]()['map'](function(_0xe2562b){return _0xe2562b['toLowerCase']();});moment[_0x1d13('0x9')](_0x22996a);var _0x4c1839=_0x567d2b['indexOf'](_0x56407a);var _0x8cb39a=_0x567d2b[_0x1d13('0xf')](_0x125395);if(_0x8cb39a>_0x4c1839){return _0x567d2b[_0x1d13('0xb')](_0x4c1839,_0x8cb39a+0x1);}else{var _0x1746a6=_0x567d2b['slice'](0x0,_0x8cb39a+0x1);var _0x38efa9=_0x567d2b[_0x1d13('0xb')](_0x4c1839);return _0x38efa9[_0x1d13('0xc')](_0x1746a6);}}}module[_0x1d13('0x10')][_0x1d13('0x11')]=circularMonthInterval;function parseDom(_0xff8d9f){var _0x3c2a9e=parseInt(_0xff8d9f,0xa);if(_0x3c2a9e<0x1||_0x3c2a9e>0x1f){throw new Error(EINVALID_DATE);}return _0x3c2a9e;}function timeCompare(_0x2f0724,_0x5a7d13,_0x2b0ac1){var _0x15fd6a=_0x2f0724['clone']();var _0xb9430a=extractTime(_0x5a7d13);var _0x513f5d=_0xb9430a[0x0];var _0x5c4e9a=_0xb9430a[0x1];var _0x5b91d7=_0x2f0724[_0x1d13('0x12')]()[_0x1d13('0x13')](_0x513f5d)[_0x1d13('0x14')](_0x5c4e9a);throwIfDateNotValid(_0x5b91d7);var _0x1e062d=extractTime(_0x2b0ac1);var _0x251fd2=_0x1e062d[0x0];var _0xc17976=_0x1e062d[0x1];var _0xb31266=_0x2f0724[_0x1d13('0x12')]()[_0x1d13('0x13')](_0x251fd2)['minutes'](_0xc17976);throwIfDateNotValid(_0xb31266);if(_0xb31266[_0x1d13('0x15')](_0x5b91d7)){var _0x2f8a4f=_0x15fd6a[_0x1d13('0x12')]()[_0x1d13('0x16')](_0x1d13('0x17'));var _0x4c2b59=_0x15fd6a[_0x1d13('0x12')]()['endOf'](_0x1d13('0x17'));return _0x15fd6a[_0x1d13('0x18')](_0x5b91d7,_0x4c2b59,undefined,'[]')||_0x15fd6a[_0x1d13('0x18')](_0x2f8a4f,_0xb31266,undefined,'[]');}else{return _0x15fd6a['isBetween'](_0x5b91d7,_0xb31266,undefined,'[]');}}module[_0x1d13('0x10')][_0x1d13('0x19')]=timeCompare;function dowCompare(_0x494680,_0x40e883,_0x49b90c){var _0x3dd1f6=_0x494680[_0x1d13('0x9')]('en')[_0x1d13('0x1a')](_0x1d13('0x1b'))[_0x1d13('0x1c')]();return circularDoWInterval(_0x40e883,_0x49b90c)[_0x1d13('0x1d')](_0x3dd1f6);}module[_0x1d13('0x10')][_0x1d13('0x1e')]=dowCompare;function domCompare(_0x566537,_0x3c5a89,_0x1a0412){var _0x5171fd=_0x566537[_0x1d13('0x1f')]();if(_0x3c5a89===_0x1a0412){return _0x5171fd===_0x3c5a89;}else{var _0x412814=_0x566537[_0x1d13('0x20')]();var _0x460358=_0x3c5a89<_0x1a0412;let _0x5d0c0b=![];var _0x81fa0=0x0;var _0x30a851=0x0;if(_0x460358){_0x81fa0=Math[_0x1d13('0x21')](0x1,_0x3c5a89);_0x30a851=Math[_0x1d13('0x22')](_0x1a0412,_0x412814);_0x5d0c0b=_0x5171fd>=_0x81fa0&&_0x5171fd<=_0x30a851;}else{_0x81fa0=Math[_0x1d13('0x22')](_0x3c5a89,_0x412814);_0x30a851=Math[_0x1d13('0x21')](0x1,_0x1a0412);_0x5d0c0b=_0x5171fd>=_0x81fa0||_0x5171fd<=_0x30a851;}return _0x5d0c0b;}}module[_0x1d13('0x10')][_0x1d13('0x23')]=domCompare;function monthCompare(_0x58d54e,_0x59eba4,_0x3591dd){var _0x5814ad=_0x58d54e[_0x1d13('0x9')]('en')['format'](_0x1d13('0x24'))[_0x1d13('0x1c')]();return circularMonthInterval(_0x59eba4,_0x3591dd)['includes'](_0x5814ad);}module['exports'][_0x1d13('0x25')]=monthCompare;function iftime(_0x21f249,_0x970c08=moment['tz'][_0x1d13('0x26')](),_0x3d1dbc=moment()){if(!validateRx[_0x1d13('0x27')](_0x21f249)){throw new Error(EINVALID_STRING);}else{var _0x19d286=(moment[_0x1d13('0x28')](_0x3d1dbc)?_0x3d1dbc[_0x1d13('0x12')]():moment(_0x3d1dbc))['tz'](_0x970c08)['locale']('en');throwIfDateNotValid(_0x19d286);var _0x2c5609=_0x21f249['split'](',');var _0xf4adf7=_0x2c5609[0x0];var _0x24adc7=_0x2c5609[0x1];var _0x408e05=_0x2c5609[0x2];var _0x1696db=_0x2c5609[0x3];let _0x47cc25=!![];if(_0xf4adf7!=='*'){var _0x1d191b=_0xf4adf7[_0x1d13('0x8')]('-');var _0x20f716=_[_0x1d13('0x29')](_0x1d191b[0x0],0x5,'0');var _0x5387e3=_0x1d191b[_0x1d13('0x2a')]===0x2?_['padStart'](_0x1d191b[0x1],0x5,'0'):_0x20f716;_0x47cc25=timeCompare(_0x19d286,_0x20f716,_0x5387e3);}let _0x554fcf=!![];if(_0x24adc7!=='*'){var _0x48cad=_0x24adc7[_0x1d13('0x8')]('-');var _0x241d06=_0x48cad[0x0];var _0x425159=_0x48cad['length']===0x2?_0x48cad[0x1]:_0x241d06;_0x554fcf=dowCompare(_0x19d286,_0x241d06,_0x425159);}let _0x1d17cc=!![];if(_0x408e05!=='*'){var _0x4da18f=_0x408e05[_0x1d13('0x8')]('-');var _0x1259a0=parseDom(_0x4da18f[0x0]);var _0x354f07=_0x4da18f['length']===0x2?parseDom(_0x4da18f[0x1]):_0x1259a0;_0x1d17cc=domCompare(_0x19d286,_0x1259a0,_0x354f07);}let _0x257b74=!![];if(_0x1696db!=='*'){var _0x2ae6fd=_0x1696db[_0x1d13('0x8')]('-');var _0x528ea2=_0x2ae6fd[0x0];var _0x3497f2=_0x2ae6fd['length']===0x2?_0x2ae6fd[0x1]:_0x2ae6fd[0x0];_0x257b74=monthCompare(_0x19d286,_0x528ea2,_0x3497f2);}return _0x47cc25&&_0x554fcf&&_0x1d17cc&&_0x257b74;}}module[_0x1d13('0x10')]['iftime']=iftime; \ No newline at end of file +var _0x9ba6=['hours','minutes','isBefore','startOf','day','endOf','isBetween','timeCompare','format','ddd','includes','dowCompare','date','min','max','domCompare','monthCompare','test','isMoment','padStart','length','moment-timezone','map','source','join','Interval\x20string\x20not\x20valid','isValid','split','locale','weekdaysShort','toLowerCase','indexOf','slice','concat','exports','circularDoWInterval','monthsShort','circularMonthInterval','clone'];(function(_0x2cfb48,_0x24b83b){var _0xc4594f=function(_0x3bc089){while(--_0x3bc089){_0x2cfb48['push'](_0x2cfb48['shift']());}};_0xc4594f(++_0x24b83b);}(_0x9ba6,0x19b));var _0x69ba=function(_0x333fc2,_0x385b20){_0x333fc2=_0x333fc2-0x0;var _0x484e6e=_0x9ba6[_0x333fc2];return _0x484e6e;};var _=require('lodash');var moment=require(_0x69ba('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][_0x69ba('0x1')](function(_0x1e2f50){return _0x1e2f50[_0x69ba('0x2')];})[_0x69ba('0x3')](',');var validateRx=new RegExp('^'+globalRx+'$');var EINVALID_STRING=_0x69ba('0x4');var EINVALID_DATE='Date\x20not\x20valid';function throwIfDateNotValid(_0x536074){if(!_0x536074[_0x69ba('0x5')]()){throw new Error(EINVALID_DATE);}}function extractTime(_0x3dc36d){var _0x4f5028=_0x3dc36d[_0x69ba('0x6')](':')['map'](function(_0x410d16){return parseInt(_0x410d16,0xa);});var _0x5e166f=_0x4f5028[0x0];var _0x4def9a=_0x4f5028[0x1];if(_0x5e166f<0x0||_0x5e166f>0x17||_0x4def9a<0x0||_0x4def9a>0x3b){throw new Error(EINVALID_DATE);}return[_0x5e166f,_0x4def9a];}function circularDoWInterval(_0x47895b,_0x325f5d){if(_0x47895b===_0x325f5d){return[_0x47895b];}else{var _0x33b45c=moment[_0x69ba('0x7')]();moment[_0x69ba('0x7')]('en');var _0x455fd5=moment[_0x69ba('0x8')]()['map'](function(_0x43549b){return _0x43549b[_0x69ba('0x9')]();});moment[_0x69ba('0x7')](_0x33b45c);var _0x5005a5=_0x455fd5[_0x69ba('0xa')](_0x47895b);var _0x1e1561=_0x455fd5['indexOf'](_0x325f5d);if(_0x1e1561>_0x5005a5){return _0x455fd5[_0x69ba('0xb')](_0x5005a5,_0x1e1561+0x1);}else{var _0x3330bb=_0x455fd5[_0x69ba('0xb')](0x0,_0x1e1561+0x1);var _0x3ad011=_0x455fd5[_0x69ba('0xb')](_0x5005a5);return _0x3ad011[_0x69ba('0xc')](_0x3330bb);}}}module[_0x69ba('0xd')][_0x69ba('0xe')]=circularDoWInterval;function circularMonthInterval(_0x30a63a,_0xa09727){if(_0x30a63a===_0xa09727){return[_0x30a63a];}else{var _0x7630fd=moment[_0x69ba('0x7')]();moment[_0x69ba('0x7')]('en');var _0x1df134=moment[_0x69ba('0xf')]()[_0x69ba('0x1')](function(_0x50e83a){return _0x50e83a[_0x69ba('0x9')]();});moment['locale'](_0x7630fd);var _0xa26940=_0x1df134[_0x69ba('0xa')](_0x30a63a);var _0x2d6b62=_0x1df134[_0x69ba('0xa')](_0xa09727);if(_0x2d6b62>_0xa26940){return _0x1df134[_0x69ba('0xb')](_0xa26940,_0x2d6b62+0x1);}else{var _0x2b5f31=_0x1df134['slice'](0x0,_0x2d6b62+0x1);var _0x3813f3=_0x1df134[_0x69ba('0xb')](_0xa26940);return _0x3813f3['concat'](_0x2b5f31);}}}module[_0x69ba('0xd')][_0x69ba('0x10')]=circularMonthInterval;function parseDom(_0x1368e3){var _0x28d2b7=parseInt(_0x1368e3,0xa);if(_0x28d2b7<0x1||_0x28d2b7>0x1f){throw new Error(EINVALID_DATE);}return _0x28d2b7;}function timeCompare(_0x55e28b,_0x2973a8,_0xb54d97){var _0x2fb0fb=_0x55e28b[_0x69ba('0x11')]();var _0x464583=extractTime(_0x2973a8);var _0x548eab=_0x464583[0x0];var _0x4f2e00=_0x464583[0x1];var _0x47e7ae=_0x55e28b[_0x69ba('0x11')]()[_0x69ba('0x12')](_0x548eab)['minutes'](_0x4f2e00);throwIfDateNotValid(_0x47e7ae);var _0x24f469=extractTime(_0xb54d97);var _0x42d9ba=_0x24f469[0x0];var _0x2c83ca=_0x24f469[0x1];var _0x140c6e=_0x55e28b[_0x69ba('0x11')]()[_0x69ba('0x12')](_0x42d9ba)[_0x69ba('0x13')](_0x2c83ca);throwIfDateNotValid(_0x140c6e);if(_0x140c6e[_0x69ba('0x14')](_0x47e7ae)){var _0x31b31c=_0x2fb0fb[_0x69ba('0x11')]()[_0x69ba('0x15')](_0x69ba('0x16'));var _0x174611=_0x2fb0fb[_0x69ba('0x11')]()[_0x69ba('0x17')](_0x69ba('0x16'));return _0x2fb0fb[_0x69ba('0x18')](_0x47e7ae,_0x174611,undefined,'[]')||_0x2fb0fb['isBetween'](_0x31b31c,_0x140c6e,undefined,'[]');}else{return _0x2fb0fb[_0x69ba('0x18')](_0x47e7ae,_0x140c6e,undefined,'[]');}}module[_0x69ba('0xd')][_0x69ba('0x19')]=timeCompare;function dowCompare(_0x23d922,_0x12e2e9,_0x4b24b7){var _0x48e605=_0x23d922[_0x69ba('0x7')]('en')[_0x69ba('0x1a')](_0x69ba('0x1b'))[_0x69ba('0x9')]();return circularDoWInterval(_0x12e2e9,_0x4b24b7)[_0x69ba('0x1c')](_0x48e605);}module['exports'][_0x69ba('0x1d')]=dowCompare;function domCompare(_0x956d65,_0x4e7972,_0x32921d){var _0x50a60d=_0x956d65[_0x69ba('0x1e')]();if(_0x4e7972===_0x32921d){return _0x50a60d===_0x4e7972;}else{var _0x25b592=_0x956d65['daysInMonth']();var _0x2b559a=_0x4e7972<_0x32921d;let _0x20f1a1=![];var _0xd1eee7=0x0;var _0x762635=0x0;if(_0x2b559a){_0xd1eee7=Math['max'](0x1,_0x4e7972);_0x762635=Math[_0x69ba('0x1f')](_0x32921d,_0x25b592);_0x20f1a1=_0x50a60d>=_0xd1eee7&&_0x50a60d<=_0x762635;}else{_0xd1eee7=Math['min'](_0x4e7972,_0x25b592);_0x762635=Math[_0x69ba('0x20')](0x1,_0x32921d);_0x20f1a1=_0x50a60d>=_0xd1eee7||_0x50a60d<=_0x762635;}return _0x20f1a1;}}module['exports'][_0x69ba('0x21')]=domCompare;function monthCompare(_0x6b6d3f,_0x3a03f5,_0x1732ba){var _0x360c88=_0x6b6d3f[_0x69ba('0x7')]('en')[_0x69ba('0x1a')]('MMM')[_0x69ba('0x9')]();return circularMonthInterval(_0x3a03f5,_0x1732ba)[_0x69ba('0x1c')](_0x360c88);}module[_0x69ba('0xd')][_0x69ba('0x22')]=monthCompare;function iftime(_0x165c11,_0x4b6819=moment['tz']['guess'](),_0x5038fe=moment()){if(!validateRx[_0x69ba('0x23')](_0x165c11)){throw new Error(EINVALID_STRING);}else{var _0x5543de=(moment[_0x69ba('0x24')](_0x5038fe)?_0x5038fe[_0x69ba('0x11')]():moment(_0x5038fe))['tz'](_0x4b6819)[_0x69ba('0x7')]('en');throwIfDateNotValid(_0x5543de);var _0x536d76=_0x165c11[_0x69ba('0x6')](',');var _0x4a26d5=_0x536d76[0x0];var _0x5b3fc9=_0x536d76[0x1];var _0x565c28=_0x536d76[0x2];var _0x1329ae=_0x536d76[0x3];let _0x11ef10=!![];if(_0x4a26d5!=='*'){var _0x69fa11=_0x4a26d5[_0x69ba('0x6')]('-');var _0x480832=_[_0x69ba('0x25')](_0x69fa11[0x0],0x5,'0');var _0xbae8f1=_0x69fa11[_0x69ba('0x26')]===0x2?_[_0x69ba('0x25')](_0x69fa11[0x1],0x5,'0'):_0x480832;_0x11ef10=timeCompare(_0x5543de,_0x480832,_0xbae8f1);}let _0x23b83b=!![];if(_0x5b3fc9!=='*'){var _0x84dfe3=_0x5b3fc9[_0x69ba('0x6')]('-');var _0xc8e59c=_0x84dfe3[0x0];var _0x285064=_0x84dfe3['length']===0x2?_0x84dfe3[0x1]:_0xc8e59c;_0x23b83b=dowCompare(_0x5543de,_0xc8e59c,_0x285064);}let _0x46c839=!![];if(_0x565c28!=='*'){var _0x3fe9a0=_0x565c28[_0x69ba('0x6')]('-');var _0x3ed088=parseDom(_0x3fe9a0[0x0]);var _0x26aa0b=_0x3fe9a0['length']===0x2?parseDom(_0x3fe9a0[0x1]):_0x3ed088;_0x46c839=domCompare(_0x5543de,_0x3ed088,_0x26aa0b);}let _0x597fd8=!![];if(_0x1329ae!=='*'){var _0x5031e9=_0x1329ae[_0x69ba('0x6')]('-');var _0x4a9046=_0x5031e9[0x0];var _0x59da95=_0x5031e9[_0x69ba('0x26')]===0x2?_0x5031e9[0x1]:_0x5031e9[0x0];_0x597fd8=monthCompare(_0x5543de,_0x4a9046,_0x59da95);}return _0x11ef10&&_0x23b83b&&_0x46c839&&_0x597fd8;}}module[_0x69ba('0xd')]['iftime']=iftime; \ No newline at end of file diff --git a/server/utils/loggers.js b/server/utils/loggers.js index f941ab9..73d81f7 100644 --- a/server/utils/loggers.js +++ b/server/utils/loggers.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x7af5=['addColors','/var/log/xcally','join','format','%s-%s.log','message','{{{','replace','}}}','[%s]\x20[%s]\x20%s\x20-\x20%s','level','meta','keys','length','stringify','[%s]\x20[%s]\x20%s\x20-\x20%s\x20%s','toUpperCase','Logger','transports','File','%s-%s','error','Console','consoleLogger','fileLogger','path','moment','winston','../config/environment','debugLevel','toLowerCase','info','redBG\x20white','red','bold\x20yellow','bold\x20white','bold\x20green','gray','bold\x20blue','bold\x20cyan'];(function(_0x377fd8,_0x11062d){var _0x451606=function(_0x25e2e9){while(--_0x25e2e9){_0x377fd8['push'](_0x377fd8['shift']());}};_0x451606(++_0x11062d);}(_0x7af5,0xb9));var _0x57af=function(_0x5828a2,_0x51929a){_0x5828a2=_0x5828a2-0x0;var _0x109c48=_0x7af5[_0x5828a2];return _0x109c48;};'use strict';var path=require(_0x57af('0x0'));var util=require('util');var moment=require(_0x57af('0x1'));var winston=require(_0x57af('0x2'));var config=require(_0x57af('0x3'));var debugLevel=config[_0x57af('0x4')]?config['debugLevel'][_0x57af('0x5')]():_0x57af('0x6');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':_0x57af('0x7'),'error':_0x57af('0x8'),'warn':_0x57af('0x9'),'info':'white','print':_0x57af('0xa'),'success':_0x57af('0xb'),'http':_0x57af('0xc'),'verbose':'bold\x20magenta','debug':_0x57af('0xd'),'silly':_0x57af('0xe')};winston[_0x57af('0xf')](XC_LOG_COLORS);function getLogFileName(_0x487c2e,_0x185446,_0x1b5f1b){var _0x196b19=_0x487c2e||_0x57af('0x10');return path[_0x57af('0x11')](_0x196b19,util[_0x57af('0x12')](_0x57af('0x13'),_0x185446,_0x1b5f1b));}function formatter(_0x11f5d7,_0x4131fa){_0x4131fa[_0x57af('0x14')]=_0x4131fa['message']['replace'](/@@{/g,_0x57af('0x15'))[_0x57af('0x16')](/}@@/g,_0x57af('0x17'))[_0x57af('0x16')](/@{/g,'{{')[_0x57af('0x16')](/}@/g,'}}');return util[_0x57af('0x12')](_0x57af('0x18'),moment()[_0x57af('0x12')]('YYYY-MM-DD\x20HH:mm:ss'),_0x4131fa[_0x57af('0x19')]['toUpperCase'](),_0x11f5d7,_0x4131fa[_0x57af('0x14')]);}function fileFormat(_0x3f9522,_0xc70f74){_0xc70f74['message']=_0xc70f74['message']['replace'](/@@{/g,_0x57af('0x15'))['replace'](/}@@/g,'}}}')[_0x57af('0x16')](/@{/g,'{{')[_0x57af('0x16')](/}@/g,'}}');var _0x183fd2=_0xc70f74[_0x57af('0x1a')]&&Object[_0x57af('0x1b')](_0xc70f74[_0x57af('0x1a')])[_0x57af('0x1c')]?'\x0a\x09'+JSON[_0x57af('0x1d')](_0xc70f74[_0x57af('0x1a')]):'';return util['format'](_0x57af('0x1e'),moment()['format']('YYYY-MM-DD\x20HH:mm:ss'),_0xc70f74[_0x57af('0x19')][_0x57af('0x1f')](),_0x3f9522,_0xc70f74[_0x57af('0x14')],_0x183fd2);}function consoleLogger(){var _0x31ee11=new winston[(_0x57af('0x20'))]({'levels':XC_LOG_LEVELS,'transports':[new winston[(_0x57af('0x21'))]['Console']({'level':'warn','json':![],'formatter':function(_0x222a77){return formatter('',_0x222a77);}})]});return _0x31ee11;}function fileLogger(_0x19f1d9,_0x1c6872){var _0x2ab66e=new winston[(_0x57af('0x20'))]({'levels':XC_LOG_LEVELS,'transports':[new winston['transports'][(_0x57af('0x22'))]({'name':util['format'](_0x57af('0x23'),_0x19f1d9,_0x57af('0x24')),'filename':getLogFileName(_0x1c6872,_0x19f1d9,_0x57af('0x24')),'level':'error','json':![],'maxsize':0xa00000,'maxFiles':0xa,'tailable':!![],'formatter':function(_0x2149c3){return fileFormat(_0x19f1d9,_0x2149c3);}}),new winston[(_0x57af('0x21'))][(_0x57af('0x22'))]({'name':util['format'](_0x57af('0x23'),_0x19f1d9,debugLevel),'filename':getLogFileName(_0x1c6872,_0x19f1d9,debugLevel),'level':debugLevel,'json':![],'maxsize':0xa00000,'maxFiles':0xa,'tailable':!![],'formatter':function(_0xfa8777){return fileFormat(_0x19f1d9,_0xfa8777);}}),new winston['transports'][(_0x57af('0x25'))]({'level':'warn','json':![],'formatter':function(_0x3407e9){return fileFormat(_0x19f1d9,_0x3407e9);}})]});return _0x2ab66e;}exports[_0x57af('0x26')]=consoleLogger;exports[_0x57af('0x27')]=fileLogger; \ No newline at end of file +var _0xdd1e=['message','{{{','replace','}}}','[%s]\x20[%s]\x20%s\x20-\x20%s','YYYY-MM-DD\x20HH:mm:ss','toUpperCase','meta','keys','length','[%s]\x20[%s]\x20%s\x20-\x20%s\x20%s','Logger','Console','transports','File','%s-%s','error','consoleLogger','path','moment','../config/environment','debugLevel','toLowerCase','info','redBG\x20white','red','bold\x20yellow','bold\x20green','gray','bold\x20blue','join','format'];(function(_0x2e5d4f,_0x551d44){var _0x32de3f=function(_0x49ae31){while(--_0x49ae31){_0x2e5d4f['push'](_0x2e5d4f['shift']());}};_0x32de3f(++_0x551d44);}(_0xdd1e,0x112));var _0xedd1=function(_0x323acd,_0x17c2a8){_0x323acd=_0x323acd-0x0;var _0x1ee4bb=_0xdd1e[_0x323acd];return _0x1ee4bb;};'use strict';var path=require(_0xedd1('0x0'));var util=require('util');var moment=require(_0xedd1('0x1'));var winston=require('winston');var config=require(_0xedd1('0x2'));var debugLevel=config[_0xedd1('0x3')]?config[_0xedd1('0x3')][_0xedd1('0x4')]():_0xedd1('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':_0xedd1('0x6'),'error':_0xedd1('0x7'),'warn':_0xedd1('0x8'),'info':'white','print':'bold\x20white','success':_0xedd1('0x9'),'http':_0xedd1('0xa'),'verbose':'bold\x20magenta','debug':_0xedd1('0xb'),'silly':'bold\x20cyan'};winston['addColors'](XC_LOG_COLORS);function getLogFileName(_0x3f1a7a,_0x27bfb3,_0x25d1da){var _0x33084d=_0x3f1a7a||'/var/log/xcally';return path[_0xedd1('0xc')](_0x33084d,util[_0xedd1('0xd')]('%s-%s.log',_0x27bfb3,_0x25d1da));}function formatter(_0x1cc7e7,_0x2a900a){_0x2a900a[_0xedd1('0xe')]=_0x2a900a[_0xedd1('0xe')]['replace'](/@@{/g,_0xedd1('0xf'))[_0xedd1('0x10')](/}@@/g,_0xedd1('0x11'))[_0xedd1('0x10')](/@{/g,'{{')['replace'](/}@/g,'}}');return util['format'](_0xedd1('0x12'),moment()[_0xedd1('0xd')](_0xedd1('0x13')),_0x2a900a['level'][_0xedd1('0x14')](),_0x1cc7e7,_0x2a900a[_0xedd1('0xe')]);}function fileFormat(_0x369ab9,_0x5e9d23){_0x5e9d23[_0xedd1('0xe')]=_0x5e9d23['message'][_0xedd1('0x10')](/@@{/g,_0xedd1('0xf'))['replace'](/}@@/g,_0xedd1('0x11'))['replace'](/@{/g,'{{')['replace'](/}@/g,'}}');var _0x124785=_0x5e9d23[_0xedd1('0x15')]&&Object[_0xedd1('0x16')](_0x5e9d23[_0xedd1('0x15')])[_0xedd1('0x17')]?'\x0a\x09'+JSON['stringify'](_0x5e9d23[_0xedd1('0x15')]):'';return util[_0xedd1('0xd')](_0xedd1('0x18'),moment()[_0xedd1('0xd')](_0xedd1('0x13')),_0x5e9d23['level']['toUpperCase'](),_0x369ab9,_0x5e9d23['message'],_0x124785);}function consoleLogger(){var _0x1e4b56=new winston[(_0xedd1('0x19'))]({'levels':XC_LOG_LEVELS,'transports':[new winston['transports'][(_0xedd1('0x1a'))]({'level':'warn','json':![],'formatter':function(_0x350f82){return formatter('',_0x350f82);}})]});return _0x1e4b56;}function fileLogger(_0x13f8d7,_0x5ebbe2){var _0x4364f9=new winston[(_0xedd1('0x19'))]({'levels':XC_LOG_LEVELS,'transports':[new winston[(_0xedd1('0x1b'))][(_0xedd1('0x1c'))]({'name':util[_0xedd1('0xd')](_0xedd1('0x1d'),_0x13f8d7,_0xedd1('0x1e')),'filename':getLogFileName(_0x5ebbe2,_0x13f8d7,_0xedd1('0x1e')),'level':'error','json':![],'maxsize':0xa00000,'maxFiles':0xa,'tailable':!![],'formatter':function(_0x50e5fc){return fileFormat(_0x13f8d7,_0x50e5fc);}}),new winston[(_0xedd1('0x1b'))]['File']({'name':util[_0xedd1('0xd')](_0xedd1('0x1d'),_0x13f8d7,debugLevel),'filename':getLogFileName(_0x5ebbe2,_0x13f8d7,debugLevel),'level':debugLevel,'json':![],'maxsize':0xa00000,'maxFiles':0xa,'tailable':!![],'formatter':function(_0x2ab498){return fileFormat(_0x13f8d7,_0x2ab498);}}),new winston[(_0xedd1('0x1b'))][(_0xedd1('0x1a'))]({'level':'warn','json':![],'formatter':function(_0x56acc7){return fileFormat(_0x13f8d7,_0x56acc7);}})]});return _0x4364f9;}exports[_0xedd1('0x1f')]=consoleLogger;exports['fileLogger']=fileLogger; \ No newline at end of file diff --git a/server/utils/mask-sensitive-data.js b/server/utils/mask-sensitive-data.js index bbcedd5..a1ea9fe 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 _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(_0x14add3,_0x13ce8d){var _0x4a174f=function(_0x2b3ed7){while(--_0x2b3ed7){_0x14add3['push'](_0x14add3['shift']());}};_0x4a174f(++_0x13ce8d);}(_0x7a54,0x106));var _0x47a5=function(_0xb9b599,_0x22a87c){_0xb9b599=_0xb9b599-0x0;var _0x3b8a5d=_0x7a54[_0xb9b599];return _0x3b8a5d;};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 +var _0x1a85=['isString','@@{','replace','}@@','includes','exports','maskSensitiveData','password','newPassword','apiKey','street','phone','mobile','email','clientSecret','code','accessKey','token','accessTokenSecret','authToken','consumerKey','consumerSecret','membername','calleridname','calleridnum','exten','vidaooApiKey','clientEmail','privateKey','accesskeyid','secretaccesskey','key','user','pass','accountSid','dsn','secret','registry','isPlainObject','isArray','length'];(function(_0x4bb581,_0x6f7037){var _0x316bf5=function(_0x1f6ed0){while(--_0x1f6ed0){_0x4bb581['push'](_0x4bb581['shift']());}};_0x316bf5(++_0x6f7037);}(_0x1a85,0x178));var _0x51a8=function(_0xfaf455,_0x13c0a9){_0xfaf455=_0xfaf455-0x0;var _0x5aaa60=_0x1a85[_0xfaf455];return _0x5aaa60;};var _=require('lodash');var sensitiveFields=['username',_0x51a8('0x0'),_0x51a8('0x1'),_0x51a8('0x2'),'firstName','lastName',_0x51a8('0x3'),_0x51a8('0x4'),_0x51a8('0x5'),'fax',_0x51a8('0x6'),'clientId',_0x51a8('0x7'),'securityToken',_0x51a8('0x8'),_0x51a8('0x9'),'tenantId',_0x51a8('0xa'),'channelSecret','accessToken',_0x51a8('0xb'),_0x51a8('0xc'),_0x51a8('0xd'),_0x51a8('0xe'),_0x51a8('0xf'),_0x51a8('0x10'),_0x51a8('0x11'),_0x51a8('0x12'),_0x51a8('0x13'),_0x51a8('0x14'),_0x51a8('0x15'),_0x51a8('0x16'),_0x51a8('0x17'),_0x51a8('0x18'),_0x51a8('0x19'),_0x51a8('0x1a'),_0x51a8('0x1b'),'localstationid',_0x51a8('0x1c'),_0x51a8('0x1d'),_0x51a8('0x1e'),'oldPassword'];function maskSensitiveData(_0xf4eb6e){const _0x547d40=/(?!^)[\s\S](?!$)/g;if(_[_0x51a8('0x1f')](_0xf4eb6e)){for(const _0x2b8d37 in _0xf4eb6e){if(_[_0x51a8('0x20')](_0xf4eb6e[_0x2b8d37])){for(let _0x2b0521=0x0;_0x2b0521<_0xf4eb6e[_0x2b8d37][_0x51a8('0x21')];_0x2b0521++){maskSensitiveData(_0xf4eb6e[_0x2b8d37][_0x2b0521]);}}else if(_[_0x51a8('0x1f')](_0xf4eb6e[_0x2b8d37])){maskSensitiveData(_0xf4eb6e[_0x2b8d37]);}else if(_[_0x51a8('0x22')](_0xf4eb6e[_0x2b8d37])){_0xf4eb6e[_0x2b8d37]=_0xf4eb6e[_0x2b8d37]['replace'](/{{{/g,_0x51a8('0x23'))[_0x51a8('0x24')](/}}}/g,_0x51a8('0x25'))[_0x51a8('0x24')](/{{/g,'@{')[_0x51a8('0x24')](/}}/g,'}@');if(_[_0x51a8('0x26')](sensitiveFields,_0x2b8d37)){_0xf4eb6e[_0x2b8d37]=_0xf4eb6e[_0x2b8d37]['replace'](_0x547d40,'*');}}}}}module[_0x51a8('0x27')][_0x51a8('0x28')]=maskSensitiveData; \ No newline at end of file diff --git a/server/utils/misc.js b/server/utils/misc.js index 7e25faf..7586497 100644 --- a/server/utils/misc.js +++ b/server/utils/misc.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x0295=['exports','replace'];(function(_0x454e6d,_0x1e1f38){var _0x4bc294=function(_0x2c803a){while(--_0x2c803a){_0x454e6d['push'](_0x454e6d['shift']());}};_0x4bc294(++_0x1e1f38);}(_0x0295,0x1f0));var _0x5029=function(_0x158cfc,_0x3ff9e0){_0x158cfc=_0x158cfc-0x0;var _0x38baee=_0x0295[_0x158cfc];return _0x38baee;};module[_0x5029('0x0')]={'escapeRegExp'(_0x4e737b,_0x5e71d0=/[-[\]{}()*+?.,\\\/^$|#\s]/g){return _0x4e737b[_0x5029('0x1')](_0x5e71d0,'\x5c$&');}}; \ No newline at end of file +var _0x2ef3=['exports','replace','\x5c$&'];(function(_0x3a4c07,_0x18440c){var _0x5a4943=function(_0x4afb24){while(--_0x4afb24){_0x3a4c07['push'](_0x3a4c07['shift']());}};_0x5a4943(++_0x18440c);}(_0x2ef3,0xba));var _0x32ef=function(_0x4ce488,_0x595377){_0x4ce488=_0x4ce488-0x0;var _0x30ccc5=_0x2ef3[_0x4ce488];return _0x30ccc5;};module[_0x32ef('0x0')]={'escapeRegExp'(_0x11c049,_0x47513a=/[-[\]{}()*+?.,\\\/^$|#\s]/g){return _0x11c049[_0x32ef('0x1')](_0x47513a,_0x32ef('0x2'));}}; \ No newline at end of file diff --git a/server/utils/safe-template.js b/server/utils/safe-template.js index 55d7d87..f617f87 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 _0x896e=['map','isPlainObject','reduce','exports','safeTemplate','lodash','{\x20{\x20','\x20}\x20}','string','replace','isArray'];(function(_0xb23c09,_0x266a0f){var _0xc67cd4=function(_0x291d99){while(--_0x291d99){_0xb23c09['push'](_0xb23c09['shift']());}};_0xc67cd4(++_0x266a0f);}(_0x896e,0x1e9));var _0xe896=function(_0x4f9b7d,_0x214e33){_0x4f9b7d=_0x4f9b7d-0x0;var _0x954140=_0x896e[_0x4f9b7d];return _0x954140;};var _=require(_0xe896('0x0'));var mustacheLikeBracketsRx=/(\{|\}){2}/gm;function bracketsReplacer(_0x1bab19){return _0x1bab19==='{{'?_0xe896('0x1'):_0xe896('0x2');}function safeTemplate(_0x36085e){var _0x26d296=_0x36085e;if(typeof _0x36085e===_0xe896('0x3')){_0x26d296=_0x36085e[_0xe896('0x4')](mustacheLikeBracketsRx,bracketsReplacer);}else if(Array[_0xe896('0x5')](_0x36085e)){_0x26d296=_0x36085e[_0xe896('0x6')](function(_0x244f68){return safeTemplate(_0x244f68);});}else if(_[_0xe896('0x7')](_0x36085e)){_0x26d296=Object['keys'](_0x36085e)[_0xe896('0x8')](function(_0x7a0721,_0x3b902c){_0x7a0721[_0x3b902c]=safeTemplate(_0x36085e[_0x3b902c]);return _0x7a0721;},{});}return _0x26d296;}module[_0xe896('0x9')][_0xe896('0xa')]=safeTemplate; \ No newline at end of file +var _0x5c00=['replace','isArray','map','isPlainObject','keys','reduce','exports','safeTemplate','lodash','{\x20{\x20','string'];(function(_0x1293eb,_0x16b020){var _0x1f39cb=function(_0xda6062){while(--_0xda6062){_0x1293eb['push'](_0x1293eb['shift']());}};_0x1f39cb(++_0x16b020);}(_0x5c00,0x17e));var _0x05c0=function(_0xbe048b,_0x2f8970){_0xbe048b=_0xbe048b-0x0;var _0x1d9099=_0x5c00[_0xbe048b];return _0x1d9099;};var _=require(_0x05c0('0x0'));var mustacheLikeBracketsRx=/(\{|\}){2}/gm;function bracketsReplacer(_0x7f1364){return _0x7f1364==='{{'?_0x05c0('0x1'):'\x20}\x20}';}function safeTemplate(_0x1e76da){var _0x5859bc=_0x1e76da;if(typeof _0x1e76da===_0x05c0('0x2')){_0x5859bc=_0x1e76da[_0x05c0('0x3')](mustacheLikeBracketsRx,bracketsReplacer);}else if(Array[_0x05c0('0x4')](_0x1e76da)){_0x5859bc=_0x1e76da[_0x05c0('0x5')](function(_0x565efc){return safeTemplate(_0x565efc);});}else if(_[_0x05c0('0x6')](_0x1e76da)){_0x5859bc=Object[_0x05c0('0x7')](_0x1e76da)[_0x05c0('0x8')](function(_0x27dc10,_0x5b9f09){_0x27dc10[_0x5b9f09]=safeTemplate(_0x1e76da[_0x5b9f09]);return _0x27dc10;},{});}return _0x5859bc;}module[_0x05c0('0x9')][_0x05c0('0xa')]=safeTemplate; \ No newline at end of file diff --git a/server/utils/update-app-config.js b/server/utils/update-app-config.js index a7c7ed6..69b6846 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 _0x0ea4=['path','../config/environment','root','resolve','legacy-libs','isArray','findIndex','name','motion2','apps','env','NODE_PATH','string','pathExists','then','updated','writeJSON','fs-extra'];(function(_0x3500f2,_0x142fb1){var _0x7ad03f=function(_0x2a1a07){while(--_0x2a1a07){_0x3500f2['push'](_0x3500f2['shift']());}};_0x7ad03f(++_0x142fb1);}(_0x0ea4,0x6b));var _0x40ea=function(_0x48bcf1,_0x7a8e1f){_0x48bcf1=_0x48bcf1-0x0;var _0x25d4a1=_0x0ea4[_0x48bcf1];return _0x25d4a1;};var fs=require(_0x40ea('0x0'));var path=require(_0x40ea('0x1'));var config=require(_0x40ea('0x2'));var root=config[_0x40ea('0x3')];var APP_JSON_PATH=path[_0x40ea('0x4')](root,'server/app.json');var NODEPATH=path[_0x40ea('0x4')](root,_0x40ea('0x5'));function setLegacyLibsNodeEnvPath(_0x2dc69d){let _0x6b944b=![];if(Array[_0x40ea('0x6')](_0x2dc69d['apps'])){var _0x4cbf84=_0x2dc69d['apps'][_0x40ea('0x7')](function(_0x490b94){return _0x490b94[_0x40ea('0x8')]===_0x40ea('0x9');});if(_0x4cbf84>-0x1){var _0x3e8a45=_0x2dc69d[_0x40ea('0xa')][_0x4cbf84];if(typeof _0x3e8a45[_0x40ea('0xb')][_0x40ea('0xc')]!==_0x40ea('0xd')){_0x3e8a45['env'][_0x40ea('0xc')]=NODEPATH;_0x6b944b=!![];}}return{'appConfig':_0x2dc69d,'updated':_0x6b944b};}}function updateAppConfig(_0x5e379e){return fs[_0x40ea('0xe')](APP_JSON_PATH)[_0x40ea('0xf')](function(_0x4ec28c){if(_0x4ec28c){return fs['readJSON'](APP_JSON_PATH)[_0x40ea('0xf')](function(_0x1a9182){var _0x2d2b13=setLegacyLibsNodeEnvPath(_0x1a9182);if(_0x2d2b13[_0x40ea('0x10')]){_0x5e379e['info']('Updating\x20app.json');return fs[_0x40ea('0x11')](APP_JSON_PATH,_0x1a9182,{'spaces':0x2});}else{return Promise[_0x40ea('0x4')]();}});}else{return Promise[_0x40ea('0x4')]();}});}module['exports']=updateAppConfig; \ No newline at end of file +var _0x7fdc=['env','NODE_PATH','pathExists','then','updated','info','Updating\x20app.json','writeJSON','exports','path','root','resolve','server/app.json','legacy-libs','isArray','apps','findIndex','motion2'];(function(_0x3dd15e,_0x1f0015){var _0x231fd0=function(_0x4f680a){while(--_0x4f680a){_0x3dd15e['push'](_0x3dd15e['shift']());}};_0x231fd0(++_0x1f0015);}(_0x7fdc,0x117));var _0xc7fd=function(_0x1316bf,_0x20caa5){_0x1316bf=_0x1316bf-0x0;var _0x2f4d18=_0x7fdc[_0x1316bf];return _0x2f4d18;};var fs=require('fs-extra');var path=require(_0xc7fd('0x0'));var config=require('../config/environment');var root=config[_0xc7fd('0x1')];var APP_JSON_PATH=path[_0xc7fd('0x2')](root,_0xc7fd('0x3'));var NODEPATH=path[_0xc7fd('0x2')](root,_0xc7fd('0x4'));function setLegacyLibsNodeEnvPath(_0x553c32){let _0x37520b=![];if(Array[_0xc7fd('0x5')](_0x553c32['apps'])){var _0x18cd0e=_0x553c32[_0xc7fd('0x6')][_0xc7fd('0x7')](function(_0xa5bf10){return _0xa5bf10['name']===_0xc7fd('0x8');});if(_0x18cd0e>-0x1){var _0x17fb80=_0x553c32[_0xc7fd('0x6')][_0x18cd0e];if(typeof _0x17fb80[_0xc7fd('0x9')][_0xc7fd('0xa')]!=='string'){_0x17fb80[_0xc7fd('0x9')][_0xc7fd('0xa')]=NODEPATH;_0x37520b=!![];}}return{'appConfig':_0x553c32,'updated':_0x37520b};}}function updateAppConfig(_0x442856){return fs[_0xc7fd('0xb')](APP_JSON_PATH)[_0xc7fd('0xc')](function(_0xe302f8){if(_0xe302f8){return fs['readJSON'](APP_JSON_PATH)[_0xc7fd('0xc')](function(_0x5ef034){var _0x57a414=setLegacyLibsNodeEnvPath(_0x5ef034);if(_0x57a414[_0xc7fd('0xd')]){_0x442856[_0xc7fd('0xe')](_0xc7fd('0xf'));return fs[_0xc7fd('0x10')](APP_JSON_PATH,_0x5ef034,{'spaces':0x2});}else{return Promise[_0xc7fd('0x2')]();}});}else{return Promise[_0xc7fd('0x2')]();}});}module[_0xc7fd('0x11')]=updateAppConfig; \ No newline at end of file